{
    "mode": "info",
    "parameter": "python",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/info/python/json",
    "generated": "2026-08-06T14:27:26Z",
    "sections": {
        "File: python3.12.info,  Node: Top,  Next: What's New in Python,  Up: (dir)": {
            "content": "",
            "subsections": []
        },
        "Python": {
            "content": "Python 3.12.3, June 19, 2026\n\nunknown\n\nCopyright (C) 2001-2026, Python Software Foundation\n\n* Menu:\n\n* What's New in Python::\n* The Python Tutorial::\n* Python Setup and Usage::\n* The Python Language Reference::\n* The Python Standard Library::\n* Extending and Embedding the Python Interpreter::\n* Python/C API Reference Manual::\n* Installing Python Modules::\n* Python HOWTOs::\n* Python Frequently Asked Questions::\n* Glossary::\n* About these documents::\n* Dealing with Bugs::\n* Copyright::\n* History and License::\n* Python Module Index::\n* Index::\n\n-- The Detailed Node Listing --\n",
            "subsections": []
        },
        "What's New in Python": {
            "content": "* What's New In Python 3.12: What's New In Python 3 12.\n* What's New In Python 3.11: What's New In Python 3 11.\n* What's New In Python 3.10: What's New In Python 3 10.\n* What's New In Python 3.9: What's New In Python 3 9.\n* What's New In Python 3.8: What's New In Python 3 8.\n* What's New In Python 3.7: What's New In Python 3 7.\n* What's New In Python 3.6: What's New In Python 3 6.\n* What's New In Python 3.5: What's New In Python 3 5.\n* What's New In Python 3.4: What's New In Python 3 4.\n* What's New In Python 3.3: What's New In Python 3 3.\n* What's New In Python 3.2: What's New In Python 3 2.\n* What's New In Python 3.1: What's New In Python 3 1.\n* What's New In Python 3.0: What's New In Python 3 0.\n* What's New in Python 2.7: What's New in Python 2 7.\n* What's New in Python 2.6: What's New in Python 2 6.\n* What's New in Python 2.5: What's New in Python 2 5.\n* What's New in Python 2.4: What's New in Python 2 4.\n* What's New in Python 2.3: What's New in Python 2 3.\n* What's New in Python 2.2: What's New in Python 2 2.\n* What's New in Python 2.1: What's New in Python 2 1.\n* What's New in Python 2.0: What's New in Python 2 0.\n* Changelog::\n",
            "subsections": []
        },
        "What's New In Python 3.12": {
            "content": "* Summary - Release highlights::\n* New Features::\n* New Features Related to Type Hints::\n* Other Language Changes::\n* New Modules::\n* Improved Modules::\n* Optimizations::\n* CPython bytecode changes::\n* Demos and Tools::\n* Deprecated::\n* Removed::\n* Porting to Python 3.12: Porting to Python 3 12.\n* Build Changes::\n* C API Changes::\n* Notable changes in 3.12.10: Notable changes in 3 12 10.\n",
            "subsections": []
        },
        "New Features": {
            "content": "* PEP 453; Explicit Bootstrapping of PIP in Python Installations: PEP 453 Explicit Bootstrapping of PIP in Python Installations.\n* PEP 446; Newly Created File Descriptors Are Non-Inheritable: PEP 446 Newly Created File Descriptors Are Non-Inheritable.\n* Improvements to Codec Handling::\n* PEP 451; A ModuleSpec Type for the Import System: PEP 451 A ModuleSpec Type for the Import System.\n* Other Language Changes: Other Language Changes<9>.\n\nPEP 453: Explicit Bootstrapping of PIP in Python Installations\n\n* Bootstrapping pip By Default::\n* Documentation Changes::\n",
            "subsections": []
        },
        "New Features Related to Type Hints": {
            "content": "* PEP 604; New Type Union Operator: PEP 604 New Type Union Operator.\n* PEP 612; Parameter Specification Variables: PEP 612 Parameter Specification Variables.\n* PEP 613; TypeAlias: PEP 613 TypeAlias.\n* PEP 647; User-Defined Type Guards: PEP 647 User-Defined Type Guards.\n",
            "subsections": []
        },
        "Improved Modules": {
            "content": "* abc: abc<2>.\n* array: array<4>.\n* base64: base64<3>.\n* binascii: binascii<3>.\n* bz2: bz2<2>.\n* codecs: codecs<2>.\n* collections: collections<7>.\n* contextlib: contextlib<7>.\n* crypt: crypt<2>.\n* curses: curses<5>.\n* datetime: datetime<6>.\n* decimal: decimal<3>.\n* email: email<4>.\n* ftplib: ftplib<3>.\n* functools: functools<6>.\n* gc: gc<6>.\n* hmac: hmac<4>.\n* http: http<4>.\n* html: html<2>.\n* imaplib: imaplib<3>.\n* inspect: inspect<9>.\n* io: io<5>.\n* itertools: itertools<5>.\n* logging: logging<7>.\n* math: math<8>.\n* mmap: mmap<3>.\n* multiprocessing: multiprocessing<7>.\n* nntplib: nntplib<2>.\n* os: os<11>.\n* pdb: pdb<6>.\n* pickle: pickle<5>.\n* pydoc: pydoc<5>.\n* re: re<7>.\n* sched::\n* select: select<2>.\n* shlex: shlex<3>.\n* shutil: shutil<6>.\n* signal: signal<4>.\n* smtpd: smtpd<4>.\n* smtplib: smtplib<4>.\n* socket: socket<10>.\n* socketserver: socketserver<3>.\n* sqlite3: sqlite3<9>.\n* ssl: ssl<10>.\n* stat: stat<2>.\n* struct: struct<3>.\n* subprocess: subprocess<5>.\n* sys: sys<11>.\n* tarfile: tarfile<9>.\n* tempfile: tempfile<3>.\n* textwrap: textwrap<2>.\n* threading: threading<8>.\n* time: time<7>.\n* types: types<6>.\n* unittest: unittest<9>.\n* urllib: urllib<3>.\n* webbrowser: webbrowser<2>.\n* xml.etree.ElementTree: xml etree ElementTree<2>.\n* zlib: zlib<2>.\n\ndecimal\n\n* Features: Features<2>.\n* API changes: API changes<2>.\n\nemail\n\n* Policy Framework::\n* Provisional Policy with New Header API::\n* Other API Changes::\n",
            "subsections": []
        },
        "Deprecated": {
            "content": "* Unsupported Operating Systems: Unsupported Operating Systems<2>.\n* Deprecated Python modules, functions and methods: Deprecated Python modules functions and methods<4>.\n* Deprecated functions and types of the C API: Deprecated functions and types of the C API<3>.\n* Deprecated features::\n",
            "subsections": []
        },
        "Removed": {
            "content": "* Operating Systems No Longer Supported::\n* API and Feature Removals: API and Feature Removals<5>.\n* Code Cleanups::\n",
            "subsections": []
        },
        "Porting to Python 3.12": {
            "content": "* Changes in the Python API::\n\nC API Changes\n\n* New Features: New Features<2>.\n* Porting to Python 3.12: Porting to Python 3 12<2>.\n* Deprecated: Deprecated<2>.\n* Removed: Removed<2>.\n",
            "subsections": []
        },
        "Notable changes in 3.12.10": {
            "content": "* os.path: os path<2>.\n* tarfile::\n",
            "subsections": []
        },
        "What's New In Python 3.11": {
            "content": "* Summary - Release highlights: Summary - Release highlights<2>.\n* New Features: New Features<3>.\n* New Features Related to Type Hints: New Features Related to Type Hints<2>.\n* Other Language Changes: Other Language Changes<2>.\n* Other CPython Implementation Changes::\n* New Modules: New Modules<2>.\n* Improved Modules: Improved Modules<2>.\n* Optimizations: Optimizations<2>.\n* Faster CPython::\n* CPython bytecode changes: CPython bytecode changes<2>.\n* Deprecated: Deprecated<3>.\n* Pending Removal in Python 3.12: Pending Removal in Python 3 12.\n* Removed: Removed<3>.\n* Porting to Python 3.11: Porting to Python 3 11.\n* Build Changes: Build Changes<2>.\n* C API Changes: C API Changes<2>.\n* Notable changes in 3.11.4: Notable changes in 3 11 4.\n* Notable changes in 3.11.5: Notable changes in 3 11 5.\n",
            "subsections": []
        },
        "Faster CPython": {
            "content": "* Faster Startup::\n* Faster Runtime::\n* Misc::\n* FAQ::\n* About::\n",
            "subsections": []
        },
        "Faster Startup": {
            "content": "* Frozen imports / Static code objects::\n",
            "subsections": []
        },
        "Faster Runtime": {
            "content": "* Cheaper, lazy Python frames: Cheaper lazy Python frames.\n* Inlined Python function calls::\n* PEP 659; Specializing Adaptive Interpreter: PEP 659 Specializing Adaptive Interpreter.\n",
            "subsections": []
        },
        "FAQ": {
            "content": "* How should I write my code to utilize these speedups?::\n* Will CPython 3.11 use more memory?: Will CPython 3 11 use more memory?.\n* I don't see any speedups in my workload. Why?: I don't see any speedups in my workload Why?.\n* Is there a JIT compiler?::\n\nCPython bytecode changes\n\n* New opcodes::\n* Replaced opcodes::\n* Changed/removed opcodes::\n",
            "subsections": []
        },
        "Notable changes in 3.11.4": {
            "content": "* tarfile: tarfile<2>.\n",
            "subsections": []
        },
        "Notable changes in 3.11.5": {
            "content": "* OpenSSL::\n",
            "subsections": []
        },
        "What's New In Python 3.10": {
            "content": "* Summary - Release highlights: Summary - Release highlights<3>.\n* New Features: New Features<5>.\n* New Features Related to Type Hints: New Features Related to Type Hints<3>.\n* Other Language Changes: Other Language Changes<3>.\n* New Modules: New Modules<3>.\n* Improved Modules: Improved Modules<3>.\n* Optimizations: Optimizations<3>.\n* Deprecated: Deprecated<5>.\n* Removed: Removed<5>.\n* Porting to Python 3.10: Porting to Python 3 10.\n* CPython bytecode changes: CPython bytecode changes<3>.\n* Build Changes: Build Changes<3>.\n* C API Changes: C API Changes<3>.\n* Notable security feature in 3.10.7: Notable security feature in 3 10 7.\n* Notable security feature in 3.10.8: Notable security feature in 3 10 8.\n* Notable changes in 3.10.12: Notable changes in 3 10 12.\n",
            "subsections": []
        },
        "Better error messages": {
            "content": "* SyntaxErrors::\n* IndentationErrors::\n* AttributeErrors::\n* NameErrors::\n\nPEP 634: Structural Pattern Matching\n\n* Syntax and operations::\n* Declarative approach::\n* Simple pattern; match to a literal: Simple pattern match to a literal.\n* Patterns with a literal and variable::\n* Patterns and classes::\n* Nested patterns::\n* Complex patterns and the wildcard::\n* Guard::\n* Other Key Features::\n",
            "subsections": []
        },
        "Simple pattern: match to a literal": {
            "content": "* Behavior without the wildcard::\n",
            "subsections": []
        },
        "Patterns and classes": {
            "content": "* Patterns with positional parameters::\n",
            "subsections": []
        },
        "Porting to Python 3.10": {
            "content": "* Changes in the Python syntax::\n* Changes in the Python API: Changes in the Python API<2>.\n* Changes in the C API::\n\nC API Changes\n\n* PEP 652; Maintaining the Stable ABI: PEP 652 Maintaining the Stable ABI.\n* New Features: New Features<6>.\n* Porting to Python 3.10: Porting to Python 3 10<2>.\n* Deprecated: Deprecated<6>.\n* Removed: Removed<6>.\n",
            "subsections": []
        },
        "Notable changes in 3.10.12": {
            "content": "* tarfile: tarfile<3>.\n",
            "subsections": []
        },
        "What's New In Python 3.9": {
            "content": "* Summary - Release highlights: Summary - Release highlights<4>.\n* You should check for DeprecationWarning in your code::\n* New Features: New Features<7>.\n* Other Language Changes: Other Language Changes<4>.\n* New Modules: New Modules<4>.\n* Improved Modules: Improved Modules<4>.\n* Optimizations: Optimizations<4>.\n* Deprecated: Deprecated<7>.\n* Removed: Removed<7>.\n* Porting to Python 3.9: Porting to Python 3 9.\n* Build Changes: Build Changes<4>.\n* C API Changes: C API Changes<4>.\n* Notable changes in Python 3.9.1: Notable changes in Python 3 9 1.\n* Notable changes in Python 3.9.2: Notable changes in Python 3 9 2.\n* Notable changes in Python 3.9.3: Notable changes in Python 3 9 3.\n* Notable changes in Python 3.9.5: Notable changes in Python 3 9 5.\n* Notable security feature in 3.9.14: Notable security feature in 3 9 14.\n* Notable changes in 3.9.17: Notable changes in 3 9 17.\n",
            "subsections": []
        },
        "New Modules": {
            "content": "* faulthandler: faulthandler<4>.\n* ipaddress: ipaddress<5>.\n* lzma: lzma<2>.\n",
            "subsections": []
        },
        "Porting to Python 3.9": {
            "content": "* Changes in the Python API: Changes in the Python API<3>.\n* Changes in the C API: Changes in the C API<2>.\n* CPython bytecode changes: CPython bytecode changes<4>.\n\nC API Changes\n\n* New Features: New Features<8>.\n* Porting to Python 3.9: Porting to Python 3 9<2>.\n* Removed: Removed<8>.\n",
            "subsections": []
        },
        "Notable changes in Python 3.9.1": {
            "content": "* typing: typing<5>.\n* macOS 11.0 (Big Sur) and Apple Silicon Mac support: macOS 11 0 Big Sur and Apple Silicon Mac support.\n",
            "subsections": []
        },
        "Notable changes in Python 3.9.2": {
            "content": "* collections.abc: collections abc<2>.\n* urllib.parse: urllib parse<2>.\n",
            "subsections": []
        },
        "Notable changes in Python 3.9.5": {
            "content": "* urllib.parse: urllib parse<3>.\n",
            "subsections": []
        },
        "Notable changes in 3.9.17": {
            "content": "* tarfile: tarfile<4>.\n",
            "subsections": []
        },
        "What's New In Python 3.8": {
            "content": "* Summary - Release highlights: Summary - Release highlights<5>.\n* New Features: New Features<9>.\n* Other Language Changes: Other Language Changes<5>.\n* New Modules: New Modules<5>.\n* Improved Modules: Improved Modules<5>.\n* Optimizations: Optimizations<5>.\n* Build and C API Changes::\n* Deprecated: Deprecated<8>.\n* API and Feature Removals::\n* Porting to Python 3.8: Porting to Python 3 8.\n* Notable changes in Python 3.8.1: Notable changes in Python 3 8 1.\n* Notable changes in Python 3.8.2: Notable changes in Python 3 8 2.\n* Notable changes in Python 3.8.3: Notable changes in Python 3 8 3.\n* Notable changes in Python 3.8.8: Notable changes in Python 3 8 8.\n* Notable changes in Python 3.8.9: Notable changes in Python 3 8 9.\n* Notable changes in Python 3.8.10: Notable changes in Python 3 8 10.\n* Notable changes in Python 3.8.10: Notable changes in Python 3 8 10<2>.\n* Notable changes in Python 3.8.12: Notable changes in Python 3 8 12.\n* Notable security feature in 3.8.14: Notable security feature in 3 8 14.\n* Notable changes in 3.8.17: Notable changes in 3 8 17.\n",
            "subsections": []
        },
        "Porting to Python 3.8": {
            "content": "* Changes in Python behavior::\n* Changes in the Python API: Changes in the Python API<4>.\n* Changes in the C API: Changes in the C API<3>.\n* CPython bytecode changes: CPython bytecode changes<5>.\n* Demos and Tools: Demos and Tools<2>.\n",
            "subsections": []
        },
        "Notable changes in Python 3.8.10": {
            "content": "* urllib.parse: urllib parse<4>.\n",
            "subsections": []
        },
        "Notable changes in Python 3.8.12": {
            "content": "* Changes in the Python API: Changes in the Python API<5>.\n",
            "subsections": []
        },
        "Notable changes in 3.8.17": {
            "content": "* tarfile: tarfile<6>.\n",
            "subsections": []
        },
        "What's New In Python 3.7": {
            "content": "* Summary - Release Highlights::\n* New Features: New Features<10>.\n* Other Language Changes: Other Language Changes<6>.\n* New Modules: New Modules<6>.\n* Improved Modules: Improved Modules<6>.\n* C API Changes: C API Changes<5>.\n* Build Changes: Build Changes<5>.\n* Optimizations: Optimizations<6>.\n* Other CPython Implementation Changes: Other CPython Implementation Changes<2>.\n* Deprecated Python Behavior::\n* Deprecated Python modules, functions and methods: Deprecated Python modules functions and methods.\n* Deprecated functions and types of the C API::\n* Platform Support Removals::\n* API and Feature Removals: API and Feature Removals<2>.\n* Module Removals::\n* Windows-only Changes::\n* Porting to Python 3.7: Porting to Python 3 7.\n* Notable changes in Python 3.7.1: Notable changes in Python 3 7 1.\n* Notable changes in Python 3.7.2: Notable changes in Python 3 7 2.\n* Notable changes in Python 3.7.6: Notable changes in Python 3 7 6.\n* Notable changes in Python 3.7.10: Notable changes in Python 3 7 10.\n* Notable changes in Python 3.7.11: Notable changes in Python 3 7 11.\n* Notable security feature in 3.7.14: Notable security feature in 3 7 14.\n",
            "subsections": []
        },
        "Deprecated Python modules, functions and methods": {
            "content": "* asynchat::\n* asyncore::\n* dbm: dbm<3>.\n* distutils: distutils<6>.\n* grp::\n* importlib: importlib<6>.\n* os: os<8>.\n* re: re<4>.\n* ssl: ssl<7>.\n* tkinter: tkinter<6>.\n* venv: venv<5>.\n",
            "subsections": []
        },
        "Porting to Python 3.7": {
            "content": "* Changes in Python Behavior::\n* Changes in the Python API: Changes in the Python API<6>.\n* Changes in the C API: Changes in the C API<4>.\n* CPython bytecode changes: CPython bytecode changes<6>.\n* Windows-only Changes: Windows-only Changes<2>.\n* Other CPython implementation changes::\n",
            "subsections": []
        },
        "What's New In Python 3.6": {
            "content": "* Summary - Release highlights: Summary - Release highlights<6>.\n* New Features: New Features<11>.\n* Other Language Changes: Other Language Changes<7>.\n* New Modules: New Modules<7>.\n* Improved Modules: Improved Modules<7>.\n* Optimizations: Optimizations<7>.\n* Build and C API Changes: Build and C API Changes<2>.\n* Other Improvements::\n* Deprecated: Deprecated<9>.\n* Removed: Removed<9>.\n* Porting to Python 3.6: Porting to Python 3 6.\n* Notable changes in Python 3.6.2: Notable changes in Python 3 6 2.\n* Notable changes in Python 3.6.4: Notable changes in Python 3 6 4.\n* Notable changes in Python 3.6.5: Notable changes in Python 3 6 5.\n* Notable changes in Python 3.6.7: Notable changes in Python 3 6 7.\n* Notable changes in Python 3.6.10: Notable changes in Python 3 6 10.\n* Notable changes in Python 3.6.13: Notable changes in Python 3 6 13.\n* Notable changes in Python 3.6.14: Notable changes in Python 3 6 14.\n",
            "subsections": []
        },
        "Porting to Python 3.6": {
            "content": "* Changes in 'python' Command Behavior::\n* Changes in the Python API: Changes in the Python API<7>.\n* Changes in the C API: Changes in the C API<5>.\n* CPython bytecode changes: CPython bytecode changes<7>.\n",
            "subsections": []
        },
        "Notable changes in Python 3.6.2": {
            "content": "* New make regen-all build target::\n* Removal of make touch build target::\n",
            "subsections": []
        },
        "What's New In Python 3.5": {
            "content": "* Summary - Release highlights: Summary - Release highlights<7>.\n* New Features: New Features<12>.\n* Other Language Changes: Other Language Changes<8>.\n* New Modules: New Modules<8>.\n* Improved Modules: Improved Modules<8>.\n* Other module-level changes::\n* Optimizations: Optimizations<8>.\n* Build and C API Changes: Build and C API Changes<3>.\n* Deprecated: Deprecated<10>.\n* Removed: Removed<10>.\n* Porting to Python 3.5: Porting to Python 3 5.\n* Notable changes in Python 3.5.4: Notable changes in Python 3 5 4.\n",
            "subsections": []
        },
        "Porting to Python 3.5": {
            "content": "* Changes in Python behavior: Changes in Python behavior<2>.\n* Changes in the Python API: Changes in the Python API<8>.\n* Changes in the C API: Changes in the C API<6>.\n",
            "subsections": []
        },
        "Notable changes in Python 3.5.4": {
            "content": "* New make regen-all build target: New make regen-all build target<2>.\n* Removal of make touch build target: Removal of make touch build target<2>.\n",
            "subsections": []
        },
        "What's New In Python 3.4": {
            "content": "* Summary - Release Highlights: Summary - Release Highlights<2>.\n* New Features: New Features<13>.\n* New Modules: New Modules<9>.\n* Improved Modules: Improved Modules<9>.\n* CPython Implementation Changes::\n* Deprecated: Deprecated<11>.\n* Removed: Removed<11>.\n* Porting to Python 3.4: Porting to Python 3 4.\n* Changed in 3.4.3: Changed in 3 4 3.\n",
            "subsections": []
        },
        "Porting to Python 3.4": {
            "content": "* Changes in 'python' Command Behavior: Changes in 'python' Command Behavior<2>.\n* Changes in the Python API: Changes in the Python API<9>.\n* Changes in the C API: Changes in the C API<7>.\n",
            "subsections": []
        },
        "Changed in 3.4.3": {
            "content": "* PEP 476; Enabling certificate verification by default for stdlib http clients: PEP 476 Enabling certificate verification by default for stdlib http clients.\n",
            "subsections": []
        },
        "What's New In Python 3.3": {
            "content": "* Summary - Release highlights: Summary - Release highlights<8>.\n* PEP 405; Virtual Environments: PEP 405 Virtual Environments.\n* PEP 420; Implicit Namespace Packages: PEP 420 Implicit Namespace Packages.\n* PEP 3118; New memoryview implementation and buffer protocol documentation: PEP 3118 New memoryview implementation and buffer protocol documentation.\n* PEP 393; Flexible String Representation: PEP 393 Flexible String Representation.\n* PEP 397; Python Launcher for Windows: PEP 397 Python Launcher for Windows.\n* PEP 3151; Reworking the OS and IO exception hierarchy: PEP 3151 Reworking the OS and IO exception hierarchy.\n* PEP 380; Syntax for Delegating to a Subgenerator: PEP 380 Syntax for Delegating to a Subgenerator.\n* PEP 409; Suppressing exception context: PEP 409 Suppressing exception context.\n* PEP 414; Explicit Unicode literals: PEP 414 Explicit Unicode literals.\n* PEP 3155; Qualified name for classes and functions: PEP 3155 Qualified name for classes and functions.\n* PEP 412; Key-Sharing Dictionary: PEP 412 Key-Sharing Dictionary.\n* PEP 362; Function Signature Object: PEP 362 Function Signature Object.\n* PEP 421; Adding sys.implementation: PEP 421 Adding sys implementation.\n* Using importlib as the Implementation of Import::\n* Other Language Changes: Other Language Changes<10>.\n* A Finer-Grained Import Lock::\n* Builtin functions and types::\n* New Modules: New Modules<10>.\n* Improved Modules: Improved Modules<10>.\n* Optimizations: Optimizations<9>.\n* Build and C API Changes: Build and C API Changes<4>.\n* Deprecated: Deprecated<12>.\n* Porting to Python 3.3: Porting to Python 3 3.\n\nPEP 3118: New memoryview implementation and buffer protocol documentation\n\n* Features::\n* API changes::\n\nPEP 393: Flexible String Representation\n\n* Functionality::\n* Performance and resource usage::\n\nPEP 421: Adding sys.implementation\n\n* SimpleNamespace::\n",
            "subsections": []
        },
        "Using importlib as the Implementation of Import": {
            "content": "* New APIs::\n* Visible Changes::\n",
            "subsections": []
        },
        "Porting to Python 3.3": {
            "content": "* Porting Python code::\n* Porting C code::\n* Building C extensions::\n* Command Line Switch Changes::\n",
            "subsections": []
        },
        "What's New In Python 3.2": {
            "content": "* PEP 384; Defining a Stable ABI: PEP 384 Defining a Stable ABI.\n* PEP 389; Argparse Command Line Parsing Module: PEP 389 Argparse Command Line Parsing Module.\n* PEP 391; Dictionary Based Configuration for Logging: PEP 391 Dictionary Based Configuration for Logging.\n* PEP 3148; The concurrent.futures module: PEP 3148 The concurrent futures module.\n* PEP 3147; PYC Repository Directories: PEP 3147 PYC Repository Directories.\n* PEP 3149; ABI Version Tagged .so Files: PEP 3149 ABI Version Tagged so Files.\n* PEP 3333; Python Web Server Gateway Interface v1.0.1: PEP 3333 Python Web Server Gateway Interface v1 0 1.\n* Other Language Changes: Other Language Changes<11>.\n* New, Improved, and Deprecated Modules: New Improved and Deprecated Modules.\n* Multi-threading::\n* Optimizations: Optimizations<10>.\n* Unicode::\n* Codecs::\n* Documentation::\n* IDLE::\n* Code Repository::\n* Build and C API Changes: Build and C API Changes<5>.\n* Porting to Python 3.2: Porting to Python 3 2.\n",
            "subsections": []
        },
        "New, Improved, and Deprecated Modules": {
            "content": "* Date/Time Type::\n* The optparse Module::\n",
            "subsections": []
        },
        "What's New In Python 3.1": {
            "content": "* PEP 372; Ordered Dictionaries: PEP 372 Ordered Dictionaries.\n* PEP 378; Format Specifier for Thousands Separator: PEP 378 Format Specifier for Thousands Separator.\n* Other Language Changes: Other Language Changes<12>.\n* New, Improved, and Deprecated Modules: New Improved and Deprecated Modules<2>.\n* Optimizations: Optimizations<11>.\n* IDLE: IDLE<2>.\n* Build and C API Changes: Build and C API Changes<6>.\n* Porting to Python 3.1: Porting to Python 3 1.\n",
            "subsections": []
        },
        "What's New In Python 3.0": {
            "content": "* Common Stumbling Blocks::\n* Overview Of Syntax Changes::\n* Changes Already Present In Python 2.6: Changes Already Present In Python 2 6.\n* Library Changes::\n* PEP 3101; A New Approach To String Formatting: PEP 3101 A New Approach To String Formatting.\n* Changes To Exceptions::\n* Miscellaneous Other Changes::\n* Build and C API Changes: Build and C API Changes<7>.\n* Performance::\n* Porting To Python 3.0: Porting To Python 3 0.\n",
            "subsections": []
        },
        "Common Stumbling Blocks": {
            "content": "* Print Is A Function::\n* Views And Iterators Instead Of Lists::\n* Ordering Comparisons::\n* Integers::\n* Text Vs. Data Instead Of Unicode Vs. 8-bit: Text Vs Data Instead Of Unicode Vs 8-bit.\n",
            "subsections": []
        },
        "Overview Of Syntax Changes": {
            "content": "* New Syntax::\n* Changed Syntax::\n* Removed Syntax::\n",
            "subsections": []
        },
        "Miscellaneous Other Changes": {
            "content": "* Operators And Special Methods::\n* Builtins::\n",
            "subsections": []
        },
        "What's New in Python 2.7": {
            "content": "* The Future for Python 2.x: The Future for Python 2 x.\n* Changes to the Handling of Deprecation Warnings::\n* Python 3.1 Features: Python 3 1 Features.\n* PEP 372; Adding an Ordered Dictionary to collections: PEP 372 Adding an Ordered Dictionary to collections.\n* PEP 378; Format Specifier for Thousands Separator: PEP 378 Format Specifier for Thousands Separator<2>.\n* PEP 389; The argparse Module for Parsing Command Lines: PEP 389 The argparse Module for Parsing Command Lines.\n* PEP 391; Dictionary-Based Configuration For Logging: PEP 391 Dictionary-Based Configuration For Logging.\n* PEP 3106; Dictionary Views: PEP 3106 Dictionary Views.\n* PEP 3137; The memoryview Object: PEP 3137 The memoryview Object.\n* Other Language Changes: Other Language Changes<13>.\n* New and Improved Modules::\n* Build and C API Changes: Build and C API Changes<8>.\n* Other Changes and Fixes::\n* Porting to Python 2.7: Porting to Python 2 7.\n* New Features Added to Python 2.7 Maintenance Releases: New Features Added to Python 2 7 Maintenance Releases.\n* Acknowledgements::\n",
            "subsections": []
        },
        "Other Language Changes": {
            "content": "* String Changes::\n* Optimizations: Optimizations<16>.\n",
            "subsections": []
        },
        "New and Improved Modules": {
            "content": "* The ast module::\n* The futurebuiltins module::\n* The json module; JavaScript Object Notation: The json module JavaScript Object Notation.\n* The plistlib module; A Property-List Parser: The plistlib module A Property-List Parser.\n* ctypes Enhancements::\n* Improved SSL Support::\n",
            "subsections": []
        },
        "Build and C API Changes": {
            "content": "* Port-Specific Changes: Port-Specific Changes<3>.\n",
            "subsections": []
        },
        "New Features Added to Python 2.7 Maintenance Releases": {
            "content": "* Two new environment variables for debug mode::\n* PEP 434; IDLE Enhancement Exception for All Branches: PEP 434 IDLE Enhancement Exception for All Branches.\n* PEP 466; Network Security Enhancements for Python 2.7: PEP 466 Network Security Enhancements for Python 2 7.\n* PEP 477; Backport ensurepip (PEP 453) to Python 2.7: PEP 477 Backport ensurepip PEP 453 to Python 2 7.\n* PEP 476; Enabling certificate verification by default for stdlib http clients: PEP 476 Enabling certificate verification by default for stdlib http clients<2>.\n* PEP 493; HTTPS verification migration tools for Python 2.7: PEP 493 HTTPS verification migration tools for Python 2 7.\n* New make regen-all build target: New make regen-all build target<3>.\n* Removal of make touch build target: Removal of make touch build target<3>.\n\nPEP 477: Backport ensurepip (PEP 453) to Python 2.7\n\n* Bootstrapping pip By Default: Bootstrapping pip By Default<2>.\n* Documentation Changes: Documentation Changes<2>.\n",
            "subsections": []
        },
        "What's New in Python 2.6": {
            "content": "* Python 3.0: Python 3 0.\n* Changes to the Development Process::\n* PEP 343; The 'with' statement: PEP 343 The 'with' statement.\n* PEP 366; Explicit Relative Imports From a Main Module: PEP 366 Explicit Relative Imports From a Main Module.\n* PEP 370; Per-user site-packages Directory: PEP 370 Per-user site-packages Directory.\n* PEP 371; The multiprocessing Package: PEP 371 The multiprocessing Package.\n* PEP 3101; Advanced String Formatting: PEP 3101 Advanced String Formatting.\n* PEP 3105; print As a Function: PEP 3105 print As a Function.\n* PEP 3110; Exception-Handling Changes: PEP 3110 Exception-Handling Changes.\n* PEP 3112; Byte Literals: PEP 3112 Byte Literals.\n* PEP 3116; New I/O Library: PEP 3116 New I/O Library.\n* PEP 3118; Revised Buffer Protocol: PEP 3118 Revised Buffer Protocol.\n* PEP 3119; Abstract Base Classes: PEP 3119 Abstract Base Classes.\n* PEP 3127; Integer Literal Support and Syntax: PEP 3127 Integer Literal Support and Syntax.\n* PEP 3129; Class Decorators: PEP 3129 Class Decorators.\n* PEP 3141; A Type Hierarchy for Numbers: PEP 3141 A Type Hierarchy for Numbers.\n* Other Language Changes: Other Language Changes<14>.\n* New and Improved Modules: New and Improved Modules<2>.\n* Deprecations and Removals::\n* Build and C API Changes: Build and C API Changes<9>.\n* Porting to Python 2.6: Porting to Python 2 6.\n* Acknowledgements: Acknowledgements<2>.\n",
            "subsections": []
        },
        "Changes to the Development Process": {
            "content": "* New Issue Tracker; Roundup: New Issue Tracker Roundup.\n* New Documentation Format; reStructuredText Using Sphinx: New Documentation Format reStructuredText Using Sphinx.\n\nPEP 343: The 'with' statement\n\n* Writing Context Managers::\n* The contextlib module::\n\nPEP 3141: A Type Hierarchy for Numbers\n\n* The fractions Module::\n",
            "subsections": []
        },
        "What's New in Python 2.5": {
            "content": "* PEP 308; Conditional Expressions: PEP 308 Conditional Expressions.\n* PEP 309; Partial Function Application: PEP 309 Partial Function Application.\n* PEP 314; Metadata for Python Software Packages v1.1: PEP 314 Metadata for Python Software Packages v1 1.\n* PEP 328; Absolute and Relative Imports: PEP 328 Absolute and Relative Imports.\n* PEP 338; Executing Modules as Scripts: PEP 338 Executing Modules as Scripts.\n* PEP 341; Unified try/except/finally: PEP 341 Unified try/except/finally.\n* PEP 342; New Generator Features: PEP 342 New Generator Features.\n* PEP 343; The 'with' statement: PEP 343 The 'with' statement<2>.\n* PEP 352; Exceptions as New-Style Classes: PEP 352 Exceptions as New-Style Classes.\n* PEP 353; Using ssizet as the index type: PEP 353 Using ssizet as the index type.\n* PEP 357; The 'index' method: PEP 357 The 'index' method.\n* Other Language Changes: Other Language Changes<15>.\n* New, Improved, and Removed Modules: New Improved and Removed Modules.\n* Build and C API Changes: Build and C API Changes<10>.\n* Porting to Python 2.5: Porting to Python 2 5.\n* Acknowledgements: Acknowledgements<3>.\n\nPEP 343: The 'with' statement\n\n* Writing Context Managers: Writing Context Managers<2>.\n* The contextlib module: The contextlib module<2>.\n",
            "subsections": []
        },
        "New, Improved, and Removed Modules": {
            "content": "* The ctypes package::\n* The ElementTree package::\n* The hashlib package::\n* The sqlite3 package::\n* The wsgiref package::\n",
            "subsections": []
        },
        "What's New in Python 2.4": {
            "content": "* PEP 218; Built-In Set Objects: PEP 218 Built-In Set Objects.\n* PEP 237; Unifying Long Integers and Integers: PEP 237 Unifying Long Integers and Integers.\n* PEP 289; Generator Expressions: PEP 289 Generator Expressions.\n* PEP 292; Simpler String Substitutions: PEP 292 Simpler String Substitutions.\n* PEP 318; Decorators for Functions and Methods: PEP 318 Decorators for Functions and Methods.\n* PEP 322; Reverse Iteration: PEP 322 Reverse Iteration.\n* PEP 324; New subprocess Module: PEP 324 New subprocess Module.\n* PEP 327; Decimal Data Type: PEP 327 Decimal Data Type.\n* PEP 328; Multi-line Imports: PEP 328 Multi-line Imports.\n* PEP 331; Locale-Independent Float/String Conversions: PEP 331 Locale-Independent Float/String Conversions.\n* Other Language Changes: Other Language Changes<16>.\n* New, Improved, and Deprecated Modules: New Improved and Deprecated Modules<3>.\n* Build and C API Changes: Build and C API Changes<11>.\n* Porting to Python 2.4: Porting to Python 2 4.\n* Acknowledgements: Acknowledgements<4>.\n\nPEP 327: Decimal Data Type\n\n* Why is Decimal needed?::\n* The Decimal type::\n* The Context type::\n",
            "subsections": []
        },
        "What's New in Python 2.3": {
            "content": "* PEP 218; A Standard Set Datatype: PEP 218 A Standard Set Datatype.\n* PEP 255; Simple Generators: PEP 255 Simple Generators.\n* PEP 263; Source Code Encodings: PEP 263 Source Code Encodings.\n* PEP 273; Importing Modules from ZIP Archives: PEP 273 Importing Modules from ZIP Archives.\n* PEP 277; Unicode file name support for Windows NT: PEP 277 Unicode file name support for Windows NT.\n* PEP 278; Universal Newline Support: PEP 278 Universal Newline Support.\n* PEP 279; enumerate(): PEP 279 enumerate.\n* PEP 282; The logging Package: PEP 282 The logging Package.\n* PEP 285; A Boolean Type: PEP 285 A Boolean Type.\n* PEP 293; Codec Error Handling Callbacks: PEP 293 Codec Error Handling Callbacks.\n* PEP 301; Package Index and Metadata for Distutils: PEP 301 Package Index and Metadata for Distutils.\n* PEP 302; New Import Hooks: PEP 302 New Import Hooks.\n* PEP 305; Comma-separated Files: PEP 305 Comma-separated Files.\n* PEP 307; Pickle Enhancements: PEP 307 Pickle Enhancements.\n* Extended Slices::\n* Other Language Changes: Other Language Changes<17>.\n* New, Improved, and Deprecated Modules: New Improved and Deprecated Modules<4>.\n* Pymalloc; A Specialized Object Allocator: Pymalloc A Specialized Object Allocator.\n* Build and C API Changes: Build and C API Changes<12>.\n* Other Changes and Fixes: Other Changes and Fixes<2>.\n* Porting to Python 2.3: Porting to Python 2 3.\n* Acknowledgements: Acknowledgements<5>.\n",
            "subsections": []
        },
        "What's New in Python 2.2": {
            "content": "* Introduction::\n* PEPs 252 and 253; Type and Class Changes: PEPs 252 and 253 Type and Class Changes.\n* PEP 234; Iterators: PEP 234 Iterators.\n* PEP 255; Simple Generators: PEP 255 Simple Generators<2>.\n* PEP 237; Unifying Long Integers and Integers: PEP 237 Unifying Long Integers and Integers<2>.\n* PEP 238; Changing the Division Operator: PEP 238 Changing the Division Operator.\n* Unicode Changes::\n* PEP 227; Nested Scopes: PEP 227 Nested Scopes.\n* New and Improved Modules: New and Improved Modules<3>.\n* Interpreter Changes and Fixes::\n* Other Changes and Fixes: Other Changes and Fixes<3>.\n* Acknowledgements: Acknowledgements<6>.\n\nPEPs 252 and 253: Type and Class Changes\n\n* Old and New Classes::\n* Descriptors::\n* Multiple Inheritance; The Diamond Rule: Multiple Inheritance The Diamond Rule.\n* Attribute Access::\n* Related Links::\n",
            "subsections": []
        },
        "What's New in Python 2.1": {
            "content": "* Introduction: Introduction<2>.\n* PEP 227; Nested Scopes: PEP 227 Nested Scopes<2>.\n* PEP 236; future Directives: PEP 236 future Directives.\n* PEP 207; Rich Comparisons: PEP 207 Rich Comparisons.\n* PEP 230; Warning Framework: PEP 230 Warning Framework.\n* PEP 229; New Build System: PEP 229 New Build System.\n* PEP 205; Weak References: PEP 205 Weak References.\n* PEP 232; Function Attributes: PEP 232 Function Attributes.\n* PEP 235; Importing Modules on Case-Insensitive Platforms: PEP 235 Importing Modules on Case-Insensitive Platforms.\n* PEP 217; Interactive Display Hook: PEP 217 Interactive Display Hook.\n* PEP 208; New Coercion Model: PEP 208 New Coercion Model.\n* PEP 241; Metadata in Python Packages: PEP 241 Metadata in Python Packages.\n* New and Improved Modules: New and Improved Modules<4>.\n* Other Changes and Fixes: Other Changes and Fixes<4>.\n* Acknowledgements: Acknowledgements<7>.\n",
            "subsections": []
        },
        "What's New in Python 2.0": {
            "content": "* Introduction: Introduction<3>.\n* What About Python 1.6?: What About Python 1 6?.\n* New Development Process::\n* Unicode: Unicode<2>.\n* List Comprehensions::\n* Augmented Assignment::\n* String Methods::\n* Garbage Collection of Cycles::\n* Other Core Changes::\n* Porting to 2.0: Porting to 2 0.\n* Extending/Embedding Changes::\n* Distutils; Making Modules Easy to Install: Distutils Making Modules Easy to Install.\n* XML Modules::\n* Module changes::\n* New modules::\n* IDLE Improvements::\n* Deleted and Deprecated Modules::\n* Acknowledgements: Acknowledgements<8>.\n",
            "subsections": []
        },
        "Other Core Changes": {
            "content": "* Minor Language Changes::\n* Changes to Built-in Functions::\n\nXML Modules\n\n* SAX2 Support::\n* DOM Support::\n* Relationship to PyXML::\n",
            "subsections": []
        },
        "Changelog": {
            "content": "* Python 3.12.3 final: Python 3 12 3 final.\n* Python 3.12.2 final: Python 3 12 2 final.\n* Python 3.12.1 final: Python 3 12 1 final.\n* Python 3.12.0 final: Python 3 12 0 final.\n* Python 3.12.0 release candidate 3: Python 3 12 0 release candidate 3.\n* Python 3.12.0 release candidate 2: Python 3 12 0 release candidate 2.\n* Python 3.12.0 release candidate 1: Python 3 12 0 release candidate 1.\n* Python 3.12.0 beta 4: Python 3 12 0 beta 4.\n* Python 3.12.0 beta 3: Python 3 12 0 beta 3.\n* Python 3.12.0 beta 2: Python 3 12 0 beta 2.\n* Python 3.12.0 beta 1: Python 3 12 0 beta 1.\n* Python 3.12.0 alpha 7: Python 3 12 0 alpha 7.\n* Python 3.12.0 alpha 6: Python 3 12 0 alpha 6.\n* Python 3.12.0 alpha 5: Python 3 12 0 alpha 5.\n* Python 3.12.0 alpha 4: Python 3 12 0 alpha 4.\n* Python 3.12.0 alpha 3: Python 3 12 0 alpha 3.\n* Python 3.12.0 alpha 2: Python 3 12 0 alpha 2.\n* Python 3.12.0 alpha 1: Python 3 12 0 alpha 1.\n* Python 3.11.0 beta 1: Python 3 11 0 beta 1.\n* Python 3.11.0 alpha 7: Python 3 11 0 alpha 7.\n* Python 3.11.0 alpha 6: Python 3 11 0 alpha 6.\n* Python 3.11.0 alpha 5: Python 3 11 0 alpha 5.\n* Python 3.11.0 alpha 4: Python 3 11 0 alpha 4.\n* Python 3.11.0 alpha 3: Python 3 11 0 alpha 3.\n* Python 3.11.0 alpha 2: Python 3 11 0 alpha 2.\n* Python 3.11.0 alpha 1: Python 3 11 0 alpha 1.\n* Python 3.10.0 beta 1: Python 3 10 0 beta 1.\n* Python 3.10.0 alpha 7: Python 3 10 0 alpha 7.\n* Python 3.10.0 alpha 6: Python 3 10 0 alpha 6.\n* Python 3.10.0 alpha 5: Python 3 10 0 alpha 5.\n* Python 3.10.0 alpha 4: Python 3 10 0 alpha 4.\n* Python 3.10.0 alpha 3: Python 3 10 0 alpha 3.\n* Python 3.10.0 alpha 2: Python 3 10 0 alpha 2.\n* Python 3.10.0 alpha 1: Python 3 10 0 alpha 1.\n* Python 3.9.0 beta 1: Python 3 9 0 beta 1.\n* Python 3.9.0 alpha 6: Python 3 9 0 alpha 6.\n* Python 3.9.0 alpha 5: Python 3 9 0 alpha 5.\n* Python 3.9.0 alpha 4: Python 3 9 0 alpha 4.\n* Python 3.9.0 alpha 3: Python 3 9 0 alpha 3.\n* Python 3.9.0 alpha 2: Python 3 9 0 alpha 2.\n* Python 3.9.0 alpha 1: Python 3 9 0 alpha 1.\n* Python 3.8.0 beta 1: Python 3 8 0 beta 1.\n* Python 3.8.0 alpha 4: Python 3 8 0 alpha 4.\n* Python 3.8.0 alpha 3: Python 3 8 0 alpha 3.\n* Python 3.8.0 alpha 2: Python 3 8 0 alpha 2.\n* Python 3.8.0 alpha 1: Python 3 8 0 alpha 1.\n* Python 3.7.0 final: Python 3 7 0 final.\n* Python 3.7.0 release candidate 1: Python 3 7 0 release candidate 1.\n* Python 3.7.0 beta 5: Python 3 7 0 beta 5.\n* Python 3.7.0 beta 4: Python 3 7 0 beta 4.\n* Python 3.7.0 beta 3: Python 3 7 0 beta 3.\n* Python 3.7.0 beta 2: Python 3 7 0 beta 2.\n* Python 3.7.0 beta 1: Python 3 7 0 beta 1.\n* Python 3.7.0 alpha 4: Python 3 7 0 alpha 4.\n* Python 3.7.0 alpha 3: Python 3 7 0 alpha 3.\n* Python 3.7.0 alpha 2: Python 3 7 0 alpha 2.\n* Python 3.7.0 alpha 1: Python 3 7 0 alpha 1.\n* Python 3.6.6 final: Python 3 6 6 final.\n* Python 3.6.6 release candidate 1: Python 3 6 6 release candidate 1.\n* Python 3.6.5 final: Python 3 6 5 final.\n* Python 3.6.5 release candidate 1: Python 3 6 5 release candidate 1.\n* Python 3.6.4 final: Python 3 6 4 final.\n* Python 3.6.4 release candidate 1: Python 3 6 4 release candidate 1.\n* Python 3.6.3 final: Python 3 6 3 final.\n* Python 3.6.3 release candidate 1: Python 3 6 3 release candidate 1.\n* Python 3.6.2 final: Python 3 6 2 final.\n* Python 3.6.2 release candidate 2: Python 3 6 2 release candidate 2.\n* Python 3.6.2 release candidate 1: Python 3 6 2 release candidate 1.\n* Python 3.6.1 final: Python 3 6 1 final.\n* Python 3.6.1 release candidate 1: Python 3 6 1 release candidate 1.\n* Python 3.6.0 final: Python 3 6 0 final.\n* Python 3.6.0 release candidate 2: Python 3 6 0 release candidate 2.\n* Python 3.6.0 release candidate 1: Python 3 6 0 release candidate 1.\n* Python 3.6.0 beta 4: Python 3 6 0 beta 4.\n* Python 3.6.0 beta 3: Python 3 6 0 beta 3.\n* Python 3.6.0 beta 2: Python 3 6 0 beta 2.\n* Python 3.6.0 beta 1: Python 3 6 0 beta 1.\n* Python 3.6.0 alpha 4: Python 3 6 0 alpha 4.\n* Python 3.6.0 alpha 3: Python 3 6 0 alpha 3.\n* Python 3.6.0 alpha 2: Python 3 6 0 alpha 2.\n* Python 3.6.0 alpha 1: Python 3 6 0 alpha 1.\n* Python 3.5.5 final: Python 3 5 5 final.\n* Python 3.5.5 release candidate 1: Python 3 5 5 release candidate 1.\n* Python 3.5.4 final: Python 3 5 4 final.\n* Python 3.5.4 release candidate 1: Python 3 5 4 release candidate 1.\n* Python 3.5.3 final: Python 3 5 3 final.\n* Python 3.5.3 release candidate 1: Python 3 5 3 release candidate 1.\n* Python 3.5.2 final: Python 3 5 2 final.\n* Python 3.5.2 release candidate 1: Python 3 5 2 release candidate 1.\n* Python 3.5.1 final: Python 3 5 1 final.\n* Python 3.5.1 release candidate 1: Python 3 5 1 release candidate 1.\n* Python 3.5.0 final: Python 3 5 0 final.\n* Python 3.5.0 release candidate 4: Python 3 5 0 release candidate 4.\n* Python 3.5.0 release candidate 3: Python 3 5 0 release candidate 3.\n* Python 3.5.0 release candidate 2: Python 3 5 0 release candidate 2.\n* Python 3.5.0 release candidate 1: Python 3 5 0 release candidate 1.\n* Python 3.5.0 beta 4: Python 3 5 0 beta 4.\n* Python 3.5.0 beta 3: Python 3 5 0 beta 3.\n* Python 3.5.0 beta 2: Python 3 5 0 beta 2.\n* Python 3.5.0 beta 1: Python 3 5 0 beta 1.\n* Python 3.5.0 alpha 4: Python 3 5 0 alpha 4.\n* Python 3.5.0 alpha 3: Python 3 5 0 alpha 3.\n* Python 3.5.0 alpha 2: Python 3 5 0 alpha 2.\n* Python 3.5.0 alpha 1: Python 3 5 0 alpha 1.\n",
            "subsections": []
        },
        "Python 3.12.3 final": {
            "content": "* Security::\n* Core and Builtins::\n* Library::\n* Documentation: Documentation<2>.\n* Tests::\n* Build::\n* Windows::\n* IDLE: IDLE<3>.\n* Tools/Demos::\n* C API::\n",
            "subsections": []
        },
        "Python 3.12.2 final": {
            "content": "* Security: Security<2>.\n* Core and Builtins: Core and Builtins<2>.\n* Library: Library<2>.\n* Documentation: Documentation<3>.\n* Tests: Tests<2>.\n* Build: Build<2>.\n* Windows: Windows<2>.\n* macOS::\n* IDLE: IDLE<4>.\n* Tools/Demos: Tools/Demos<2>.\n",
            "subsections": []
        },
        "Python 3.12.1 final": {
            "content": "* Core and Builtins: Core and Builtins<3>.\n* Library: Library<3>.\n* Documentation: Documentation<4>.\n* Tests: Tests<3>.\n* Build: Build<3>.\n* Windows: Windows<3>.\n* macOS: macOS<2>.\n* IDLE: IDLE<5>.\n* C API: C API<2>.\n",
            "subsections": []
        },
        "Python 3.12.0 final": {
            "content": "* Core and Builtins: Core and Builtins<4>.\n* Library: Library<4>.\n* Documentation: Documentation<5>.\n* Windows: Windows<4>.\n* macOS: macOS<3>.\n* Tools/Demos: Tools/Demos<3>.\n",
            "subsections": []
        },
        "Python 3.12.0 release candidate 3": {
            "content": "* Core and Builtins: Core and Builtins<5>.\n* Library: Library<5>.\n* Documentation: Documentation<6>.\n* Tests: Tests<4>.\n* Build: Build<4>.\n",
            "subsections": []
        },
        "Python 3.12.0 release candidate 2": {
            "content": "* Security: Security<3>.\n* Core and Builtins: Core and Builtins<6>.\n* Library: Library<6>.\n* Documentation: Documentation<7>.\n* Tests: Tests<5>.\n* Build: Build<5>.\n* Windows: Windows<5>.\n* macOS: macOS<4>.\n* Tools/Demos: Tools/Demos<4>.\n* C API: C API<3>.\n",
            "subsections": []
        },
        "Python 3.12.0 release candidate 1": {
            "content": "* Security: Security<4>.\n* Core and Builtins: Core and Builtins<7>.\n* Library: Library<7>.\n* Documentation: Documentation<8>.\n* Tests: Tests<6>.\n* Build: Build<6>.\n* Windows: Windows<6>.\n* macOS: macOS<5>.\n* Tools/Demos: Tools/Demos<5>.\n* C API: C API<4>.\n",
            "subsections": []
        },
        "Python 3.12.0 beta 4": {
            "content": "* Security: Security<5>.\n* Core and Builtins: Core and Builtins<8>.\n* Library: Library<8>.\n* Documentation: Documentation<9>.\n* Tests: Tests<7>.\n* Build: Build<7>.\n* Tools/Demos: Tools/Demos<6>.\n* C API: C API<5>.\n",
            "subsections": []
        },
        "Python 3.12.0 beta 3": {
            "content": "* Core and Builtins: Core and Builtins<9>.\n* Library: Library<9>.\n* Tests: Tests<8>.\n* Windows: Windows<7>.\n* C API: C API<6>.\n",
            "subsections": []
        },
        "Python 3.12.0 beta 2": {
            "content": "* Security: Security<6>.\n* Core and Builtins: Core and Builtins<10>.\n* Library: Library<10>.\n* Documentation: Documentation<10>.\n* Build: Build<8>.\n* Windows: Windows<8>.\n* macOS: macOS<6>.\n* IDLE: IDLE<6>.\n* C API: C API<7>.\n",
            "subsections": []
        },
        "Python 3.12.0 beta 1": {
            "content": "* Security: Security<7>.\n* Core and Builtins: Core and Builtins<11>.\n* Library: Library<11>.\n* Documentation: Documentation<11>.\n* Tests: Tests<9>.\n* Build: Build<9>.\n* Windows: Windows<9>.\n* macOS: macOS<7>.\n* IDLE: IDLE<7>.\n* Tools/Demos: Tools/Demos<7>.\n* C API: C API<8>.\n",
            "subsections": []
        },
        "Python 3.12.0 alpha 7": {
            "content": "* Core and Builtins: Core and Builtins<12>.\n* Library: Library<12>.\n* Documentation: Documentation<12>.\n* Tests: Tests<10>.\n* Build: Build<10>.\n* Windows: Windows<10>.\n* Tools/Demos: Tools/Demos<8>.\n* C API: C API<9>.\n",
            "subsections": []
        },
        "Python 3.12.0 alpha 6": {
            "content": "* Security: Security<8>.\n* Core and Builtins: Core and Builtins<13>.\n* Library: Library<13>.\n* Documentation: Documentation<13>.\n* Tests: Tests<11>.\n* Build: Build<11>.\n* Windows: Windows<11>.\n* macOS: macOS<8>.\n* C API: C API<10>.\n",
            "subsections": []
        },
        "Python 3.12.0 alpha 5": {
            "content": "* Security: Security<9>.\n* Core and Builtins: Core and Builtins<14>.\n* Library: Library<14>.\n* Documentation: Documentation<14>.\n* Tests: Tests<12>.\n* Build: Build<12>.\n* Windows: Windows<12>.\n",
            "subsections": []
        },
        "Python 3.12.0 alpha 4": {
            "content": "* Core and Builtins: Core and Builtins<15>.\n* Library: Library<15>.\n* Documentation: Documentation<15>.\n* Tests: Tests<13>.\n* Build: Build<13>.\n* Windows: Windows<13>.\n* macOS: macOS<9>.\n* Tools/Demos: Tools/Demos<9>.\n* C API: C API<11>.\n",
            "subsections": []
        },
        "Python 3.12.0 alpha 3": {
            "content": "* Security: Security<10>.\n* Core and Builtins: Core and Builtins<16>.\n* Library: Library<16>.\n* Documentation: Documentation<16>.\n* Tests: Tests<14>.\n* Build: Build<14>.\n* Windows: Windows<14>.\n* macOS: macOS<10>.\n* Tools/Demos: Tools/Demos<10>.\n* C API: C API<12>.\n",
            "subsections": []
        },
        "Python 3.12.0 alpha 2": {
            "content": "* Security: Security<11>.\n* Core and Builtins: Core and Builtins<17>.\n* Library: Library<17>.\n* Documentation: Documentation<17>.\n* Tests: Tests<15>.\n* Build: Build<15>.\n* Windows: Windows<15>.\n* macOS: macOS<11>.\n* C API: C API<13>.\n",
            "subsections": []
        },
        "Python 3.12.0 alpha 1": {
            "content": "* Security: Security<12>.\n* Core and Builtins: Core and Builtins<18>.\n* Library: Library<18>.\n* Documentation: Documentation<18>.\n* Tests: Tests<16>.\n* Build: Build<16>.\n* Windows: Windows<16>.\n* macOS: macOS<12>.\n* IDLE: IDLE<8>.\n* Tools/Demos: Tools/Demos<11>.\n* C API: C API<14>.\n",
            "subsections": []
        },
        "Python 3.11.0 beta 1": {
            "content": "* Security: Security<13>.\n* Core and Builtins: Core and Builtins<19>.\n* Library: Library<19>.\n* Documentation: Documentation<19>.\n* Tests: Tests<17>.\n* Build: Build<17>.\n* Windows: Windows<17>.\n* macOS: macOS<13>.\n* Tools/Demos: Tools/Demos<12>.\n* C API: C API<15>.\n",
            "subsections": []
        },
        "Python 3.11.0 alpha 7": {
            "content": "* Core and Builtins: Core and Builtins<20>.\n* Library: Library<20>.\n* Documentation: Documentation<20>.\n* Tests: Tests<18>.\n* Build: Build<18>.\n* Windows: Windows<18>.\n* macOS: macOS<14>.\n* Tools/Demos: Tools/Demos<13>.\n* C API: C API<16>.\n",
            "subsections": []
        },
        "Python 3.11.0 alpha 6": {
            "content": "* Core and Builtins: Core and Builtins<21>.\n* Library: Library<21>.\n* Documentation: Documentation<21>.\n* Tests: Tests<19>.\n* Build: Build<19>.\n* Windows: Windows<19>.\n* IDLE: IDLE<9>.\n* C API: C API<17>.\n",
            "subsections": []
        },
        "Python 3.11.0 alpha 5": {
            "content": "* Core and Builtins: Core and Builtins<22>.\n* Library: Library<22>.\n* Documentation: Documentation<22>.\n* Tests: Tests<20>.\n* Build: Build<20>.\n* Windows: Windows<20>.\n* macOS: macOS<15>.\n* IDLE: IDLE<10>.\n* C API: C API<18>.\n",
            "subsections": []
        },
        "Python 3.11.0 alpha 4": {
            "content": "* Core and Builtins: Core and Builtins<23>.\n* Library: Library<23>.\n* Documentation: Documentation<23>.\n* Tests: Tests<21>.\n* Build: Build<21>.\n* Windows: Windows<21>.\n* macOS: macOS<16>.\n* C API: C API<19>.\n",
            "subsections": []
        },
        "Python 3.11.0 alpha 3": {
            "content": "* Core and Builtins: Core and Builtins<24>.\n* Library: Library<24>.\n* Documentation: Documentation<24>.\n* Tests: Tests<22>.\n* Build: Build<22>.\n* Windows: Windows<22>.\n* macOS: macOS<17>.\n* C API: C API<20>.\n",
            "subsections": []
        },
        "Python 3.11.0 alpha 2": {
            "content": "* Core and Builtins: Core and Builtins<25>.\n* Library: Library<25>.\n* Documentation: Documentation<25>.\n* Tests: Tests<23>.\n* Build: Build<23>.\n* Windows: Windows<23>.\n* macOS: macOS<18>.\n* IDLE: IDLE<11>.\n* C API: C API<21>.\n",
            "subsections": []
        },
        "Python 3.11.0 alpha 1": {
            "content": "* Security: Security<14>.\n* Core and Builtins: Core and Builtins<26>.\n* Library: Library<26>.\n* Documentation: Documentation<26>.\n* Tests: Tests<24>.\n* Build: Build<24>.\n* Windows: Windows<24>.\n* macOS: macOS<19>.\n* IDLE: IDLE<12>.\n* Tools/Demos: Tools/Demos<14>.\n* C API: C API<22>.\n",
            "subsections": []
        },
        "Python 3.10.0 beta 1": {
            "content": "* Security: Security<15>.\n* Core and Builtins: Core and Builtins<27>.\n* Library: Library<27>.\n* Documentation: Documentation<27>.\n* Tests: Tests<25>.\n* Build: Build<25>.\n* Windows: Windows<25>.\n* macOS: macOS<20>.\n* IDLE: IDLE<13>.\n* C API: C API<23>.\n",
            "subsections": []
        },
        "Python 3.10.0 alpha 7": {
            "content": "* Security: Security<16>.\n* Core and Builtins: Core and Builtins<28>.\n* Library: Library<28>.\n* Documentation: Documentation<28>.\n* Tests: Tests<26>.\n* Build: Build<26>.\n* Windows: Windows<26>.\n* IDLE: IDLE<14>.\n* C API: C API<24>.\n",
            "subsections": []
        },
        "Python 3.10.0 alpha 6": {
            "content": "* Security: Security<17>.\n* Core and Builtins: Core and Builtins<29>.\n* Library: Library<29>.\n* Documentation: Documentation<29>.\n* Tests: Tests<27>.\n* Build: Build<27>.\n* Windows: Windows<27>.\n* macOS: macOS<21>.\n* IDLE: IDLE<15>.\n* C API: C API<25>.\n",
            "subsections": []
        },
        "Python 3.10.0 alpha 5": {
            "content": "* Security: Security<18>.\n* Core and Builtins: Core and Builtins<30>.\n* Library: Library<30>.\n* Documentation: Documentation<30>.\n* Tests: Tests<28>.\n* Build: Build<28>.\n* Windows: Windows<28>.\n* macOS: macOS<22>.\n* IDLE: IDLE<16>.\n* C API: C API<26>.\n",
            "subsections": []
        },
        "Python 3.10.0 alpha 4": {
            "content": "* Core and Builtins: Core and Builtins<31>.\n* Library: Library<31>.\n* Documentation: Documentation<31>.\n* Tests: Tests<29>.\n* Build: Build<29>.\n* macOS: macOS<23>.\n* Tools/Demos: Tools/Demos<15>.\n* C API: C API<27>.\n",
            "subsections": []
        },
        "Python 3.10.0 alpha 3": {
            "content": "* Security: Security<19>.\n* Core and Builtins: Core and Builtins<32>.\n* Library: Library<32>.\n* Documentation: Documentation<32>.\n* Tests: Tests<30>.\n* Build: Build<30>.\n* Windows: Windows<29>.\n* macOS: macOS<24>.\n* IDLE: IDLE<17>.\n* Tools/Demos: Tools/Demos<16>.\n* C API: C API<28>.\n",
            "subsections": []
        },
        "Python 3.10.0 alpha 2": {
            "content": "* Security: Security<20>.\n* Core and Builtins: Core and Builtins<33>.\n* Library: Library<33>.\n* Documentation: Documentation<33>.\n* Tests: Tests<31>.\n* Build: Build<31>.\n* Windows: Windows<30>.\n* macOS: macOS<25>.\n* IDLE: IDLE<18>.\n* C API: C API<29>.\n",
            "subsections": []
        },
        "Python 3.10.0 alpha 1": {
            "content": "* Security: Security<21>.\n* Core and Builtins: Core and Builtins<34>.\n* Library: Library<34>.\n* Documentation: Documentation<34>.\n* Tests: Tests<32>.\n* Build: Build<32>.\n* Windows: Windows<31>.\n* macOS: macOS<26>.\n* IDLE: IDLE<19>.\n* C API: C API<30>.\n",
            "subsections": []
        },
        "Python 3.9.0 beta 1": {
            "content": "* Security: Security<22>.\n* Core and Builtins: Core and Builtins<35>.\n* Library: Library<35>.\n* Documentation: Documentation<35>.\n* Tests: Tests<33>.\n* Build: Build<33>.\n* Windows: Windows<32>.\n* macOS: macOS<27>.\n* Tools/Demos: Tools/Demos<17>.\n* C API: C API<31>.\n",
            "subsections": []
        },
        "Python 3.9.0 alpha 6": {
            "content": "* Security: Security<23>.\n* Core and Builtins: Core and Builtins<36>.\n* Library: Library<36>.\n* Documentation: Documentation<36>.\n* Tests: Tests<34>.\n* Build: Build<34>.\n* Windows: Windows<33>.\n* macOS: macOS<28>.\n* IDLE: IDLE<20>.\n* Tools/Demos: Tools/Demos<18>.\n* C API: C API<32>.\n",
            "subsections": []
        },
        "Python 3.9.0 alpha 5": {
            "content": "* Security: Security<24>.\n* Core and Builtins: Core and Builtins<37>.\n* Library: Library<37>.\n* Documentation: Documentation<37>.\n* Tests: Tests<35>.\n* Build: Build<35>.\n* Windows: Windows<34>.\n* macOS: macOS<29>.\n* IDLE: IDLE<21>.\n* Tools/Demos: Tools/Demos<19>.\n* C API: C API<33>.\n",
            "subsections": []
        },
        "Python 3.9.0 alpha 4": {
            "content": "* Security: Security<25>.\n* Core and Builtins: Core and Builtins<38>.\n* Library: Library<38>.\n* Documentation: Documentation<38>.\n* Tests: Tests<36>.\n* Build: Build<36>.\n* Windows: Windows<35>.\n* IDLE: IDLE<22>.\n* C API: C API<34>.\n",
            "subsections": []
        },
        "Python 3.9.0 alpha 3": {
            "content": "* Core and Builtins: Core and Builtins<39>.\n* Library: Library<39>.\n* Documentation: Documentation<39>.\n* Build: Build<37>.\n* IDLE: IDLE<23>.\n* C API: C API<35>.\n",
            "subsections": []
        },
        "Python 3.9.0 alpha 2": {
            "content": "* Security: Security<26>.\n* Core and Builtins: Core and Builtins<40>.\n* Library: Library<40>.\n* Documentation: Documentation<40>.\n* Tests: Tests<37>.\n* Build: Build<38>.\n* Windows: Windows<36>.\n* macOS: macOS<30>.\n* IDLE: IDLE<24>.\n* C API: C API<36>.\n",
            "subsections": []
        },
        "Python 3.9.0 alpha 1": {
            "content": "* Security: Security<27>.\n* Core and Builtins: Core and Builtins<41>.\n* Library: Library<41>.\n* Documentation: Documentation<41>.\n* Tests: Tests<38>.\n* Build: Build<39>.\n* Windows: Windows<37>.\n* macOS: macOS<31>.\n* IDLE: IDLE<25>.\n* Tools/Demos: Tools/Demos<20>.\n* C API: C API<37>.\n",
            "subsections": []
        },
        "Python 3.8.0 beta 1": {
            "content": "* Security: Security<28>.\n* Core and Builtins: Core and Builtins<42>.\n* Library: Library<42>.\n* Documentation: Documentation<42>.\n* Tests: Tests<39>.\n* Build: Build<40>.\n* Windows: Windows<38>.\n* macOS: macOS<32>.\n* IDLE: IDLE<26>.\n* Tools/Demos: Tools/Demos<21>.\n* C API: C API<38>.\n",
            "subsections": []
        },
        "Python 3.8.0 alpha 4": {
            "content": "* Security: Security<29>.\n* Core and Builtins: Core and Builtins<43>.\n* Library: Library<43>.\n* Documentation: Documentation<43>.\n* Tests: Tests<40>.\n* Build: Build<41>.\n* Windows: Windows<39>.\n* macOS: macOS<33>.\n* IDLE: IDLE<27>.\n* Tools/Demos: Tools/Demos<22>.\n* C API: C API<39>.\n",
            "subsections": []
        },
        "Python 3.8.0 alpha 3": {
            "content": "* Security: Security<30>.\n* Core and Builtins: Core and Builtins<44>.\n* Library: Library<44>.\n* Documentation: Documentation<44>.\n* Tests: Tests<41>.\n* Build: Build<42>.\n* Windows: Windows<40>.\n* IDLE: IDLE<28>.\n* Tools/Demos: Tools/Demos<23>.\n* C API: C API<40>.\n",
            "subsections": []
        },
        "Python 3.8.0 alpha 2": {
            "content": "* Core and Builtins: Core and Builtins<45>.\n* Library: Library<45>.\n* Documentation: Documentation<45>.\n* Tests: Tests<42>.\n* Windows: Windows<41>.\n* IDLE: IDLE<29>.\n",
            "subsections": []
        },
        "Python 3.8.0 alpha 1": {
            "content": "* Security: Security<31>.\n* Core and Builtins: Core and Builtins<46>.\n* Library: Library<46>.\n* Documentation: Documentation<46>.\n* Tests: Tests<43>.\n* Build: Build<43>.\n* Windows: Windows<42>.\n* macOS: macOS<34>.\n* IDLE: IDLE<30>.\n* Tools/Demos: Tools/Demos<24>.\n* C API: C API<41>.\n",
            "subsections": []
        },
        "Python 3.7.0 final": {
            "content": "* Library: Library<47>.\n* C API: C API<42>.\n",
            "subsections": []
        },
        "Python 3.7.0 release candidate 1": {
            "content": "* Core and Builtins: Core and Builtins<47>.\n* Library: Library<48>.\n* Documentation: Documentation<47>.\n* Build: Build<44>.\n* Windows: Windows<43>.\n* IDLE: IDLE<31>.\n",
            "subsections": []
        },
        "Python 3.7.0 beta 5": {
            "content": "* Core and Builtins: Core and Builtins<48>.\n* Library: Library<49>.\n* Documentation: Documentation<48>.\n* Tests: Tests<44>.\n* Build: Build<45>.\n* macOS: macOS<35>.\n* IDLE: IDLE<32>.\n",
            "subsections": []
        },
        "Python 3.7.0 beta 4": {
            "content": "* Core and Builtins: Core and Builtins<49>.\n* Library: Library<50>.\n* Documentation: Documentation<49>.\n* Tests: Tests<45>.\n* Build: Build<46>.\n* Windows: Windows<44>.\n* macOS: macOS<36>.\n* IDLE: IDLE<33>.\n* Tools/Demos: Tools/Demos<25>.\n",
            "subsections": []
        },
        "Python 3.7.0 beta 3": {
            "content": "* Security: Security<32>.\n* Core and Builtins: Core and Builtins<50>.\n* Library: Library<51>.\n* Documentation: Documentation<50>.\n* Tests: Tests<46>.\n* Build: Build<47>.\n* Windows: Windows<45>.\n* macOS: macOS<37>.\n* IDLE: IDLE<34>.\n* Tools/Demos: Tools/Demos<26>.\n* C API: C API<43>.\n",
            "subsections": []
        },
        "Python 3.7.0 beta 2": {
            "content": "* Security: Security<33>.\n* Core and Builtins: Core and Builtins<51>.\n* Library: Library<52>.\n* Documentation: Documentation<51>.\n* Tests: Tests<47>.\n* Build: Build<48>.\n* Windows: Windows<46>.\n* macOS: macOS<38>.\n* IDLE: IDLE<35>.\n* Tools/Demos: Tools/Demos<27>.\n",
            "subsections": []
        },
        "Python 3.7.0 beta 1": {
            "content": "* Core and Builtins: Core and Builtins<52>.\n* Library: Library<53>.\n* Documentation: Documentation<52>.\n* Tests: Tests<48>.\n* Build: Build<49>.\n* Windows: Windows<47>.\n* macOS: macOS<39>.\n* C API: C API<44>.\n",
            "subsections": []
        },
        "Python 3.7.0 alpha 4": {
            "content": "* Core and Builtins: Core and Builtins<53>.\n* Library: Library<54>.\n* Documentation: Documentation<53>.\n* Tests: Tests<49>.\n* Windows: Windows<48>.\n* Tools/Demos: Tools/Demos<28>.\n* C API: C API<45>.\n",
            "subsections": []
        },
        "Python 3.7.0 alpha 3": {
            "content": "* Core and Builtins: Core and Builtins<54>.\n* Library: Library<55>.\n* Documentation: Documentation<54>.\n* Tests: Tests<50>.\n* Build: Build<50>.\n* Windows: Windows<49>.\n* macOS: macOS<40>.\n* IDLE: IDLE<36>.\n* Tools/Demos: Tools/Demos<29>.\n* C API: C API<46>.\n",
            "subsections": []
        },
        "Python 3.7.0 alpha 2": {
            "content": "* Core and Builtins: Core and Builtins<55>.\n* Library: Library<56>.\n* Documentation: Documentation<55>.\n* Build: Build<51>.\n* IDLE: IDLE<37>.\n* C API: C API<47>.\n",
            "subsections": []
        },
        "Python 3.7.0 alpha 1": {
            "content": "* Security: Security<34>.\n* Core and Builtins: Core and Builtins<56>.\n* Library: Library<57>.\n* Documentation: Documentation<56>.\n* Tests: Tests<51>.\n* Build: Build<52>.\n* Windows: Windows<50>.\n* IDLE: IDLE<38>.\n* Tools/Demos: Tools/Demos<30>.\n* C API: C API<48>.\n",
            "subsections": []
        },
        "Python 3.6.6 release candidate 1": {
            "content": "* Core and Builtins: Core and Builtins<57>.\n* Library: Library<58>.\n* Documentation: Documentation<57>.\n* Tests: Tests<52>.\n* Build: Build<53>.\n* Windows: Windows<51>.\n* macOS: macOS<41>.\n* IDLE: IDLE<39>.\n* Tools/Demos: Tools/Demos<31>.\n* C API: C API<49>.\n",
            "subsections": []
        },
        "Python 3.6.5 final": {
            "content": "* Tests: Tests<53>.\n* Build: Build<54>.\n",
            "subsections": []
        },
        "Python 3.6.5 release candidate 1": {
            "content": "* Security: Security<35>.\n* Core and Builtins: Core and Builtins<58>.\n* Library: Library<59>.\n* Documentation: Documentation<58>.\n* Tests: Tests<54>.\n* Build: Build<55>.\n* Windows: Windows<52>.\n* macOS: macOS<42>.\n* IDLE: IDLE<40>.\n* Tools/Demos: Tools/Demos<32>.\n* C API: C API<50>.\n",
            "subsections": []
        },
        "Python 3.6.4 release candidate 1": {
            "content": "* Core and Builtins: Core and Builtins<59>.\n* Library: Library<60>.\n* Documentation: Documentation<59>.\n* Tests: Tests<55>.\n* Build: Build<56>.\n* Windows: Windows<53>.\n* macOS: macOS<43>.\n* IDLE: IDLE<41>.\n* Tools/Demos: Tools/Demos<33>.\n* C API: C API<51>.\n",
            "subsections": []
        },
        "Python 3.6.3 final": {
            "content": "* Library: Library<61>.\n* Build: Build<57>.\n",
            "subsections": []
        },
        "Python 3.6.3 release candidate 1": {
            "content": "* Security: Security<36>.\n* Core and Builtins: Core and Builtins<60>.\n* Library: Library<62>.\n* Documentation: Documentation<60>.\n* Tests: Tests<56>.\n* Build: Build<58>.\n* Windows: Windows<54>.\n* IDLE: IDLE<42>.\n* Tools/Demos: Tools/Demos<34>.\n",
            "subsections": []
        },
        "Python 3.6.2 release candidate 2": {
            "content": "* Security: Security<37>.\n",
            "subsections": []
        },
        "Python 3.6.2 release candidate 1": {
            "content": "* Security: Security<38>.\n* Core and Builtins: Core and Builtins<61>.\n* Library: Library<63>.\n* IDLE: IDLE<43>.\n* C API: C API<52>.\n* Build: Build<59>.\n* Documentation: Documentation<61>.\n* Tools/Demos: Tools/Demos<35>.\n* Tests: Tests<57>.\n* Windows: Windows<55>.\n",
            "subsections": []
        },
        "Python 3.6.1 final": {
            "content": "* Core and Builtins: Core and Builtins<62>.\n* Build: Build<60>.\n",
            "subsections": []
        },
        "Python 3.6.1 release candidate 1": {
            "content": "* Core and Builtins: Core and Builtins<63>.\n* Library: Library<64>.\n* IDLE: IDLE<44>.\n* Windows: Windows<56>.\n* C API: C API<53>.\n* Documentation: Documentation<62>.\n* Tests: Tests<58>.\n* Build: Build<61>.\n",
            "subsections": []
        },
        "Python 3.6.0 release candidate 2": {
            "content": "* Core and Builtins: Core and Builtins<64>.\n* Tools/Demos: Tools/Demos<36>.\n* Windows: Windows<57>.\n* Build: Build<62>.\n",
            "subsections": []
        },
        "Python 3.6.0 release candidate 1": {
            "content": "* Core and Builtins: Core and Builtins<65>.\n* Library: Library<65>.\n* C API: C API<54>.\n* Documentation: Documentation<63>.\n* Tools/Demos: Tools/Demos<37>.\n",
            "subsections": []
        },
        "Python 3.6.0 beta 4": {
            "content": "* Core and Builtins: Core and Builtins<66>.\n* Library: Library<66>.\n* Documentation: Documentation<64>.\n* Tests: Tests<59>.\n* Build: Build<63>.\n",
            "subsections": []
        },
        "Python 3.6.0 beta 3": {
            "content": "* Core and Builtins: Core and Builtins<67>.\n* Library: Library<67>.\n* Windows: Windows<58>.\n* Build: Build<64>.\n* Tests: Tests<60>.\n",
            "subsections": []
        },
        "Python 3.6.0 beta 2": {
            "content": "* Core and Builtins: Core and Builtins<68>.\n* Library: Library<68>.\n* Windows: Windows<59>.\n* C API: C API<55>.\n* Build: Build<65>.\n* Tests: Tests<61>.\n",
            "subsections": []
        },
        "Python 3.6.0 beta 1": {
            "content": "* Core and Builtins: Core and Builtins<69>.\n* Library: Library<69>.\n* IDLE: IDLE<45>.\n* C API: C API<56>.\n* Tests: Tests<62>.\n* Build: Build<66>.\n* Tools/Demos: Tools/Demos<38>.\n* Windows: Windows<60>.\n",
            "subsections": []
        },
        "Python 3.6.0 alpha 4": {
            "content": "* Core and Builtins: Core and Builtins<70>.\n* Library: Library<70>.\n* IDLE: IDLE<46>.\n* Tests: Tests<63>.\n* Windows: Windows<61>.\n* Build: Build<67>.\n",
            "subsections": []
        },
        "Python 3.6.0 alpha 3": {
            "content": "* Security: Security<39>.\n* Core and Builtins: Core and Builtins<71>.\n* Library: Library<71>.\n* IDLE: IDLE<47>.\n* C API: C API<57>.\n* Build: Build<68>.\n* Tools/Demos: Tools/Demos<39>.\n* Documentation: Documentation<65>.\n* Tests: Tests<64>.\n",
            "subsections": []
        },
        "Python 3.6.0 alpha 2": {
            "content": "* Security: Security<40>.\n* Core and Builtins: Core and Builtins<72>.\n* Library: Library<72>.\n* IDLE: IDLE<48>.\n* Documentation: Documentation<66>.\n* Tests: Tests<65>.\n* Windows: Windows<62>.\n* Build: Build<69>.\n* C API: C API<58>.\n* Tools/Demos: Tools/Demos<40>.\n",
            "subsections": []
        },
        "Python 3.6.0 alpha 1": {
            "content": "* Security: Security<41>.\n* Core and Builtins: Core and Builtins<73>.\n* Library: Library<73>.\n* IDLE: IDLE<49>.\n* Documentation: Documentation<67>.\n* Tests: Tests<66>.\n* Build: Build<70>.\n* Windows: Windows<63>.\n* Tools/Demos: Tools/Demos<41>.\n* C API: C API<59>.\n",
            "subsections": []
        },
        "Python 3.5.5 release candidate 1": {
            "content": "* Security: Security<42>.\n* Core and Builtins: Core and Builtins<74>.\n* Library: Library<74>.\n",
            "subsections": []
        },
        "Python 3.5.4 final": {
            "content": "* Library: Library<75>.\n",
            "subsections": []
        },
        "Python 3.5.4 release candidate 1": {
            "content": "* Security: Security<43>.\n* Core and Builtins: Core and Builtins<75>.\n* Library: Library<76>.\n* Documentation: Documentation<68>.\n* Tests: Tests<67>.\n* Build: Build<71>.\n* Windows: Windows<64>.\n* C API: C API<60>.\n",
            "subsections": []
        },
        "Python 3.5.3 release candidate 1": {
            "content": "* Security: Security<44>.\n* Core and Builtins: Core and Builtins<76>.\n* Library: Library<77>.\n* IDLE: IDLE<50>.\n* C API: C API<61>.\n* Documentation: Documentation<69>.\n* Tests: Tests<68>.\n* Tools/Demos: Tools/Demos<42>.\n* Windows: Windows<65>.\n* Build: Build<72>.\n",
            "subsections": []
        },
        "Python 3.5.2 final": {
            "content": "* Core and Builtins: Core and Builtins<77>.\n* Tests: Tests<69>.\n* IDLE: IDLE<51>.\n",
            "subsections": []
        },
        "Python 3.5.2 release candidate 1": {
            "content": "* Security: Security<45>.\n* Core and Builtins: Core and Builtins<78>.\n* Library: Library<78>.\n* IDLE: IDLE<52>.\n* Documentation: Documentation<70>.\n* Tests: Tests<70>.\n* Build: Build<73>.\n* Windows: Windows<66>.\n* Tools/Demos: Tools/Demos<43>.\n",
            "subsections": []
        },
        "Python 3.5.1 final": {
            "content": "* Core and Builtins: Core and Builtins<79>.\n* Windows: Windows<67>.\n",
            "subsections": []
        },
        "Python 3.5.1 release candidate 1": {
            "content": "* Core and Builtins: Core and Builtins<80>.\n* Library: Library<79>.\n* IDLE: IDLE<53>.\n* Documentation: Documentation<71>.\n* Tests: Tests<71>.\n* Build: Build<74>.\n* Windows: Windows<68>.\n* Tools/Demos: Tools/Demos<44>.\n",
            "subsections": []
        },
        "Python 3.5.0 final": {
            "content": "* Build: Build<75>.\n",
            "subsections": []
        },
        "Python 3.5.0 release candidate 4": {
            "content": "* Library: Library<80>.\n* Build: Build<76>.\n",
            "subsections": []
        },
        "Python 3.5.0 release candidate 3": {
            "content": "* Core and Builtins: Core and Builtins<81>.\n* Library: Library<81>.\n",
            "subsections": []
        },
        "Python 3.5.0 release candidate 2": {
            "content": "* Core and Builtins: Core and Builtins<82>.\n* Library: Library<82>.\n",
            "subsections": []
        },
        "Python 3.5.0 release candidate 1": {
            "content": "* Core and Builtins: Core and Builtins<83>.\n* Library: Library<83>.\n* IDLE: IDLE<54>.\n* Documentation: Documentation<72>.\n* Tests: Tests<72>.\n",
            "subsections": []
        },
        "Python 3.5.0 beta 4": {
            "content": "* Core and Builtins: Core and Builtins<84>.\n* Library: Library<84>.\n* Build: Build<77>.\n",
            "subsections": []
        },
        "Python 3.5.0 beta 3": {
            "content": "* Core and Builtins: Core and Builtins<85>.\n* Library: Library<85>.\n* Tests: Tests<73>.\n* Documentation: Documentation<73>.\n* Build: Build<78>.\n",
            "subsections": []
        },
        "Python 3.5.0 beta 2": {
            "content": "* Core and Builtins: Core and Builtins<86>.\n* Library: Library<86>.\n",
            "subsections": []
        },
        "Python 3.5.0 beta 1": {
            "content": "* Core and Builtins: Core and Builtins<87>.\n* Library: Library<87>.\n* IDLE: IDLE<55>.\n* Tests: Tests<74>.\n* Documentation: Documentation<74>.\n* Tools/Demos: Tools/Demos<45>.\n",
            "subsections": []
        },
        "Python 3.5.0 alpha 4": {
            "content": "* Core and Builtins: Core and Builtins<88>.\n* Library: Library<88>.\n* Build: Build<79>.\n* Tests: Tests<75>.\n* Tools/Demos: Tools/Demos<46>.\n* C API: C API<62>.\n",
            "subsections": []
        },
        "Python 3.5.0 alpha 3": {
            "content": "* Core and Builtins: Core and Builtins<89>.\n* Library: Library<89>.\n* Build: Build<80>.\n* Tests: Tests<76>.\n* Tools/Demos: Tools/Demos<47>.\n",
            "subsections": []
        },
        "Python 3.5.0 alpha 2": {
            "content": "* Core and Builtins: Core and Builtins<90>.\n* Library: Library<90>.\n* Build: Build<81>.\n* C API: C API<63>.\n* Windows: Windows<69>.\n",
            "subsections": []
        },
        "Python 3.5.0 alpha 1": {
            "content": "* Core and Builtins: Core and Builtins<91>.\n* Library: Library<91>.\n* IDLE: IDLE<56>.\n* Build: Build<82>.\n* C API: C API<64>.\n* Documentation: Documentation<75>.\n* Tests: Tests<77>.\n* Tools/Demos: Tools/Demos<48>.\n* Windows: Windows<70>.\n",
            "subsections": []
        },
        "The Python Tutorial": {
            "content": "* Whetting Your Appetite::\n* Using the Python Interpreter::\n* An Informal Introduction to Python::\n* More Control Flow Tools::\n* Data Structures::\n* Modules: Modules<2>.\n* Input and Output::\n* Errors and Exceptions::\n* Classes::\n* Brief Tour of the Standard Library::\n* Brief Tour of the Standard Library -- Part II::\n* Virtual Environments and Packages::\n* What Now?::\n* Interactive Input Editing and History Substitution::\n* Floating Point Arithmetic; Issues and Limitations: Floating Point Arithmetic Issues and Limitations.\n* Appendix::\n",
            "subsections": []
        },
        "Using the Python Interpreter": {
            "content": "* Invoking the Interpreter::\n* The Interpreter and Its Environment::\n",
            "subsections": []
        },
        "Invoking the Interpreter": {
            "content": "* Argument Passing::\n* Interactive Mode::\n",
            "subsections": []
        },
        "The Interpreter and Its Environment": {
            "content": "* Source Code Encoding::\n",
            "subsections": []
        },
        "An Informal Introduction to Python": {
            "content": "* Using Python as a Calculator::\n* First Steps Towards Programming::\n",
            "subsections": []
        },
        "Using Python as a Calculator": {
            "content": "* Numbers::\n* Text::\n* Lists::\n",
            "subsections": []
        },
        "More Control Flow Tools": {
            "content": "* if Statements::\n* for Statements::\n* The range() Function: The range Function.\n* break and continue Statements, and else Clauses on Loops: break and continue Statements and else Clauses on Loops.\n* pass Statements::\n* match Statements::\n* Defining Functions::\n* More on Defining Functions::\n* Intermezzo; Coding Style: Intermezzo Coding Style.\n",
            "subsections": []
        },
        "More on Defining Functions": {
            "content": "* Default Argument Values::\n* Keyword Arguments::\n* Special parameters::\n* Arbitrary Argument Lists::\n* Unpacking Argument Lists::\n* Lambda Expressions::\n* Documentation Strings::\n* Function Annotations::\n",
            "subsections": []
        },
        "Special parameters": {
            "content": "* Positional-or-Keyword Arguments::\n* Positional-Only Parameters::\n* Keyword-Only Arguments::\n* Function Examples::\n* Recap::\n",
            "subsections": []
        },
        "Data Structures": {
            "content": "* More on Lists::\n* The del statement::\n* Tuples and Sequences::\n* Sets::\n* Dictionaries::\n* Looping Techniques::\n* More on Conditions::\n* Comparing Sequences and Other Types::\n\nMore on Lists\n\n* Using Lists as Stacks::\n* Using Lists as Queues::\n* List Comprehensions: List Comprehensions<2>.\n* Nested List Comprehensions::\n",
            "subsections": []
        },
        "Modules": {
            "content": "* How do I create a .pyc file?: How do I create a pyc file?.\n* How do I find the current module name?::\n* How can I have modules that mutually import each other?::\n* import('x.y.z') returns <module 'x'>; how do I get z?: import 'x y z' returns <module 'x'>; how do I get z?.\n* 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?.\n",
            "subsections": []
        },
        "Packages": {
            "content": "* Regular packages::\n* Namespace packages::\n",
            "subsections": []
        },
        "Input and Output": {
            "content": "* How do I delete a file? (And other file questions...): How do I delete a file? And other file questions....\n* How do I copy a file?::\n* How do I read (or write) binary data?: How do I read or write binary data?.\n* 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?.\n* How do I access the serial (RS232) port?: How do I access the serial RS232 port?.\n* Why doesn't closing sys.stdout (stdin, stderr) really close it?: Why doesn't closing sys stdout stdin stderr really close it?.\n",
            "subsections": []
        },
        "Fancier Output Formatting": {
            "content": "* Formatted String Literals::\n* The String format() Method: The String format Method.\n* Manual String Formatting::\n* Old string formatting::\n",
            "subsections": []
        },
        "Reading and Writing Files": {
            "content": "* Methods of File Objects::\n* Saving structured data with json::\n",
            "subsections": []
        },
        "Errors and Exceptions": {
            "content": "* Syntax Errors::\n* Exceptions::\n* Handling Exceptions::\n* Raising Exceptions::\n* Exception Chaining::\n* User-defined Exceptions::\n* Defining Clean-up Actions::\n* Predefined Clean-up Actions::\n* Raising and Handling Multiple Unrelated Exceptions::\n* Enriching Exceptions with Notes::\n",
            "subsections": []
        },
        "Classes": {
            "content": "* A Word About Names and Objects::\n* Python Scopes and Namespaces::\n* A First Look at Classes::\n* Random Remarks::\n* Inheritance::\n* Private Variables::\n* Odds and Ends::\n* Iterators::\n* Generators::\n* Generator Expressions::\n",
            "subsections": []
        },
        "Python Scopes and Namespaces": {
            "content": "* Scopes and Namespaces Example::\n\nA First Look at Classes\n\n* Class Definition Syntax::\n* Class Objects::\n* Instance Objects::\n* Method Objects::\n* Class and Instance Variables::\n",
            "subsections": []
        },
        "Inheritance": {
            "content": "* Multiple Inheritance::\n",
            "subsections": []
        },
        "Brief Tour of the Standard Library": {
            "content": "* Operating System Interface::\n* File Wildcards::\n* Command Line Arguments::\n* Error Output Redirection and Program Termination::\n* String Pattern Matching::\n* Mathematics::\n* Internet Access::\n* Dates and Times::\n* Data Compression::\n* Performance Measurement::\n* Quality Control::\n* Batteries Included::\n",
            "subsections": []
        },
        "Brief Tour of the Standard Library -- Part II": {
            "content": "* Output Formatting::\n* Templating::\n* Working with Binary Data Record Layouts::\n* Multi-threading: Multi-threading<2>.\n* Logging::\n* Weak References::\n* Tools for Working with Lists::\n* Decimal Floating Point Arithmetic::\n",
            "subsections": []
        },
        "Virtual Environments and Packages": {
            "content": "* Introduction: Introduction<4>.\n* Creating Virtual Environments::\n* Managing Packages with pip::\n",
            "subsections": []
        },
        "Interactive Input Editing and History Substitution": {
            "content": "* Tab Completion and History Editing::\n* Alternatives to the Interactive Interpreter::\n",
            "subsections": []
        },
        "Floating Point Arithmetic:  Issues and Limitations": {
            "content": "* Representation Error::\n",
            "subsections": []
        },
        "Appendix": {
            "content": "* Interactive Mode: Interactive Mode<2>.\n",
            "subsections": []
        },
        "Interactive Mode": {
            "content": "* Error Handling::\n* Executable Python Scripts::\n* The Interactive Startup File::\n* The Customization Modules::\n",
            "subsections": []
        },
        "Python Setup and Usage": {
            "content": "* Command line and environment::\n* Using Python on Unix platforms::\n* Configure Python::\n* Using Python on Windows::\n* Using Python on a Mac::\n* Editors and IDEs::\n",
            "subsections": []
        },
        "Command line and environment": {
            "content": "* Command line::\n* Environment variables::\n",
            "subsections": []
        },
        "Command line": {
            "content": "* Interface options::\n* Generic options::\n* Miscellaneous options::\n* Options you shouldn't use::\n",
            "subsections": []
        },
        "Environment variables": {
            "content": "* Debug-mode variables::\n",
            "subsections": []
        },
        "Using Python on Unix platforms": {
            "content": "* Getting and installing the latest version of Python::\n* Building Python::\n* Python-related paths and files::\n* Miscellaneous::\n* Custom OpenSSL::\n",
            "subsections": []
        },
        "Getting and installing the latest version of Python": {
            "content": "* On Linux::\n* On FreeBSD and OpenBSD::\n",
            "subsections": []
        },
        "Configure Python": {
            "content": "* Build Requirements::\n* Generated files::\n* Configure Options::\n* Python Build System::\n* Compiler and linker flags::\n",
            "subsections": []
        },
        "Generated files": {
            "content": "* configure script::\n",
            "subsections": []
        },
        "Configure Options": {
            "content": "* General Options::\n* WebAssembly Options::\n* Install Options::\n* Performance options::\n* Python Debug Build::\n* Debug options::\n* Linker options::\n* Libraries options::\n* Security Options::\n* macOS Options::\n* Cross Compiling Options::\n",
            "subsections": []
        },
        "Python Build System": {
            "content": "* Main files of the build system::\n* Main build steps::\n* Main Makefile targets::\n* C extensions::\n",
            "subsections": []
        },
        "Compiler and linker flags": {
            "content": "* Preprocessor flags::\n* Compiler flags::\n* Linker flags::\n",
            "subsections": []
        },
        "Using Python on Windows": {
            "content": "* The full installer::\n* The Microsoft Store package::\n* The nuget.org packages: The nuget org packages.\n* The embeddable package::\n* Alternative bundles::\n* Configuring Python::\n* UTF-8 mode::\n* Python Launcher for Windows::\n* Finding modules::\n* Additional modules::\n* Compiling Python on Windows::\n* Other Platforms::\n",
            "subsections": []
        },
        "The full installer": {
            "content": "* Installation steps::\n* Removing the MAXPATH Limitation::\n* Installing Without UI::\n* Installing Without Downloading::\n* Modifying an install::\n",
            "subsections": []
        },
        "The Microsoft Store package": {
            "content": "* Known issues::\n",
            "subsections": []
        },
        "Known issues": {
            "content": "* Redirection of local data, registry, and temporary paths: Redirection of local data registry and temporary paths.\n",
            "subsections": []
        },
        "The embeddable package": {
            "content": "* Python Application::\n* Embedding Python::\n",
            "subsections": []
        },
        "Configuring Python": {
            "content": "* Excursus; Setting environment variables: Excursus Setting environment variables.\n* Finding the Python executable::\n",
            "subsections": []
        },
        "Python Launcher for Windows": {
            "content": "* Getting started::\n* Shebang Lines::\n* Arguments in shebang lines::\n* Customization::\n* Diagnostics::\n* Dry Run::\n* Install on demand::\n* Return codes::\n",
            "subsections": []
        },
        "Getting started": {
            "content": "* From the command-line::\n* Virtual environments::\n* From a script::\n* From file associations::\n",
            "subsections": []
        },
        "Customization": {
            "content": "* Customization via INI files::\n* Customizing default Python versions::\n",
            "subsections": []
        },
        "Additional modules": {
            "content": "* PyWin32::\n* cxFreeze::\n",
            "subsections": []
        },
        "Using Python on a Mac": {
            "content": "* Getting and Installing Python::\n* The IDE::\n* Installing Additional Python Packages::\n* GUI Programming::\n* Distributing Python Applications::\n* Other Resources::\n",
            "subsections": []
        },
        "Getting and Installing Python": {
            "content": "* How to run a Python script::\n* Running scripts with a GUI::\n* Configuration::\n",
            "subsections": []
        },
        "The Python Language Reference": {
            "content": "* Introduction: Introduction<5>.\n* Lexical analysis::\n* Data model::\n* Execution model::\n* The import system::\n* Expressions::\n* Simple statements::\n* Compound statements::\n* Top-level components::\n* Full Grammar specification::\n",
            "subsections": []
        },
        "Introduction": {
            "content": "............\n",
            "subsections": []
        },
        "Lexical analysis": {
            "content": "* Line structure::\n* Other tokens::\n* Identifiers and keywords::\n* Literals::\n* Operators::\n* Delimiters::\n",
            "subsections": []
        },
        "Line structure": {
            "content": "* Logical lines::\n* Physical lines::\n* Comments::\n* Encoding declarations::\n* Explicit line joining::\n* Implicit line joining::\n* Blank lines::\n* Indentation::\n* Whitespace between tokens::\n",
            "subsections": []
        },
        "Identifiers and keywords": {
            "content": "* Keywords::\n* Soft Keywords::\n* Reserved classes of identifiers::\n",
            "subsections": []
        },
        "Literals": {
            "content": "* String and Bytes literals::\n* String literal concatenation::\n* f-strings::\n* Numeric literals::\n* Integer literals::\n* Floating point literals::\n* Imaginary literals::\n",
            "subsections": []
        },
        "String and Bytes literals": {
            "content": "* Escape sequences::\n",
            "subsections": []
        },
        "Data model": {
            "content": "* Objects, values and types: Objects values and types.\n* The standard type hierarchy::\n* Special method names::\n* Coroutines::\n",
            "subsections": []
        },
        "The standard type hierarchy": {
            "content": "* None::\n* NotImplemented::\n* Ellipsis::\n* numbers.Number: numbers Number.\n* Sequences::\n* Set types::\n* Mappings::\n* Callable types::\n* Modules: Modules<3>.\n* Custom classes::\n* Class instances::\n* I/O objects (also known as file objects): I/O objects also known as file objects.\n* Internal types::\n\nnumbers.Number\n\n* numbers.Integral: numbers Integral.\n* numbers.Real (float): numbers Real float.\n* numbers.Complex (complex): numbers Complex complex.\n",
            "subsections": []
        },
        "Sequences": {
            "content": "* Immutable sequences::\n* Mutable sequences::\n",
            "subsections": []
        },
        "Mappings": {
            "content": "* Dictionaries: Dictionaries<2>.\n",
            "subsections": []
        },
        "Callable types": {
            "content": "* User-defined functions::\n* Instance methods::\n* Generator functions::\n* Coroutine functions::\n* Asynchronous generator functions::\n* Built-in functions::\n* Built-in methods::\n* Classes: Classes<2>.\n* Class Instances::\n",
            "subsections": []
        },
        "User-defined functions": {
            "content": "* Special read-only attributes::\n* Special writable attributes::\n",
            "subsections": []
        },
        "Internal types": {
            "content": "* Code objects::\n* Frame objects::\n* Traceback objects::\n* Slice objects::\n* Static method objects::\n* Class method objects::\n",
            "subsections": []
        },
        "Code objects": {
            "content": "* Special read-only attributes: Special read-only attributes<2>.\n* Methods on code objects::\n",
            "subsections": []
        },
        "Frame objects": {
            "content": "* Special read-only attributes: Special read-only attributes<3>.\n* Special writable attributes: Special writable attributes<2>.\n* Frame object methods::\n",
            "subsections": []
        },
        "Special method names": {
            "content": "* Basic customization::\n* Customizing attribute access::\n* Customizing class creation::\n* Customizing instance and subclass checks::\n* Emulating generic types::\n* Emulating callable objects::\n* Emulating container types::\n* Emulating numeric types::\n* With Statement Context Managers::\n* Customizing positional arguments in class pattern matching::\n* Emulating buffer types::\n* Special method lookup::\n",
            "subsections": []
        },
        "Customizing attribute access": {
            "content": "* Customizing module attribute access::\n* Implementing Descriptors::\n* Invoking Descriptors::\n* slots: slots<2>.\n",
            "subsections": []
        },
        "Customizing class creation": {
            "content": "* Metaclasses::\n* Resolving MRO entries::\n* Determining the appropriate metaclass::\n* Preparing the class namespace::\n* Executing the class body::\n* Creating the class object::\n* Uses for metaclasses::\n",
            "subsections": []
        },
        "Emulating generic types": {
            "content": "* The purpose of classgetitem::\n* classgetitem versus getitem::\n",
            "subsections": []
        },
        "Coroutines": {
            "content": "..........\n",
            "subsections": []
        },
        "Execution model": {
            "content": "* Structure of a program::\n* Naming and binding::\n* Exceptions: Exceptions<2>.\n",
            "subsections": []
        },
        "Naming and binding": {
            "content": "* Binding of names::\n* Resolution of names::\n* Annotation scopes::\n* Lazy evaluation::\n* Builtins and restricted execution::\n* Interaction with dynamic features::\n",
            "subsections": []
        },
        "The import system": {
            "content": "* importlib: importlib<9>.\n* Packages: Packages<2>.\n* Searching::\n* Loading::\n* The Path Based Finder::\n* Replacing the standard import system::\n* Package Relative Imports::\n* Special considerations for main::\n* References::\n",
            "subsections": []
        },
        "Searching": {
            "content": "* The module cache::\n* Finders and loaders::\n* Import hooks::\n* The meta path::\n",
            "subsections": []
        },
        "Loading": {
            "content": "* Loaders::\n* Submodules::\n* Module spec::\n* Import-related module attributes::\n* module.path: module path.\n* Module reprs::\n* Cached bytecode invalidation::\n",
            "subsections": []
        },
        "The Path Based Finder": {
            "content": "* Path entry finders::\n* Path entry finder protocol::\n",
            "subsections": []
        },
        "Special considerations for main": {
            "content": "* main.spec: main spec.\n",
            "subsections": []
        },
        "Expressions": {
            "content": "* Subscripting::\n* Comprehensions::\n",
            "subsections": []
        },
        "Atoms": {
            "content": "* Identifiers (Names): Identifiers Names.\n* Literals: Literals<2>.\n* Parenthesized forms::\n* Displays for lists, sets and dictionaries: Displays for lists sets and dictionaries.\n* List displays::\n* Set displays::\n* Dictionary displays::\n* Generator expressions::\n* Yield expressions::\n",
            "subsections": []
        },
        "Yield expressions": {
            "content": "* Generator-iterator methods::\n* Examples::\n* Asynchronous generator functions: Asynchronous generator functions<2>.\n* Asynchronous generator-iterator methods::\n",
            "subsections": []
        },
        "Primaries": {
            "content": "* Attribute references::\n* Subscriptions::\n* Slicings::\n* Calls::\n",
            "subsections": []
        },
        "Comparisons": {
            "content": "* Value comparisons::\n* Membership test operations::\n* Identity comparisons::\n",
            "subsections": []
        },
        "Simple statements": {
            "content": "* Expression statements::\n* Assignment statements::\n* The assert statement::\n* The pass statement::\n* The del statement: The del statement<2>.\n* The return statement::\n* The yield statement::\n* The raise statement::\n* The break statement::\n* The continue statement::\n* The import statement::\n* The global statement::\n* The nonlocal statement::\n* The type statement::\n",
            "subsections": []
        },
        "Assignment statements": {
            "content": "* Augmented assignment statements::\n* Annotated assignment statements::\n",
            "subsections": []
        },
        "The import statement": {
            "content": "* Future statements::\n",
            "subsections": []
        },
        "Compound statements": {
            "content": "* The if statement::\n* The while statement::\n* The for statement::\n* The try statement::\n* The with statement::\n* The match statement::\n* Function definitions::\n* Class definitions::\n* Coroutines: Coroutines<2>.\n* Type parameter lists::\n",
            "subsections": []
        },
        "The try statement": {
            "content": "* except clause::\n* except* clause::\n* else clause::\n* finally clause::\n",
            "subsections": []
        },
        "The match statement": {
            "content": "* Overview::\n* Guards::\n* Irrefutable Case Blocks::\n* Patterns::\n",
            "subsections": []
        },
        "Patterns": {
            "content": "* OR Patterns::\n* AS Patterns::\n* Literal Patterns::\n* Capture Patterns::\n* Wildcard Patterns::\n* Value Patterns::\n* Group Patterns::\n* Sequence Patterns::\n* Mapping Patterns::\n* Class Patterns::\n",
            "subsections": []
        },
        "Type parameter lists": {
            "content": "* Generic functions::\n* Generic classes::\n* Generic type aliases::\n",
            "subsections": []
        },
        "Top-level components": {
            "content": "* Complete Python programs::\n* File input::\n* Interactive input::\n* Expression input::\n",
            "subsections": []
        },
        "The Python Standard Library": {
            "content": "* Introduction: Introduction<6>.\n* Built-in Functions::\n* Built-in Constants::\n* Built-in Types::\n* Built-in Exceptions::\n* Text Processing Services::\n* Binary Data Services::\n* Data Types::\n* Numeric and Mathematical Modules::\n* Functional Programming Modules::\n* File and Directory Access::\n* Data Persistence::\n* Data Compression and Archiving::\n* File Formats::\n* Cryptographic Services::\n* Generic Operating System Services::\n* Concurrent Execution::\n* Networking and Interprocess Communication::\n* Internet Data Handling::\n* Structured Markup Processing Tools::\n* Internet Protocols and Support::\n* Multimedia Services::\n* Internationalization::\n* Program Frameworks::\n* Graphical User Interfaces with Tk::\n* Development Tools::\n* Debugging and Profiling::\n* Software Packaging and Distribution::\n* Python Runtime Services::\n* Custom Python Interpreters::\n* Importing Modules::\n* Python Language Services::\n* MS Windows Specific Services::\n* Unix Specific Services::\n* Modules command-line interface (CLI): Modules command-line interface CLI.\n* Superseded Modules::\n* Security Considerations: Security Considerations<4>.\n",
            "subsections": []
        },
        "Notes on availability": {
            "content": "* WebAssembly platforms::\n",
            "subsections": []
        },
        "Built-in Constants": {
            "content": "* Constants added by the site module::\n",
            "subsections": []
        },
        "Built-in Types": {
            "content": "* Truth Value Testing::\n* Boolean Operations -- and, or, not: Boolean Operations -- and or not.\n* Comparisons: Comparisons<2>.\n* Numeric Types -- int, float, complex: Numeric Types -- int float complex.\n* Boolean Type - bool::\n* Iterator Types::\n* Sequence Types -- list, tuple, range: Sequence Types -- list tuple range.\n* Text Sequence Type -- str::\n* Binary Sequence Types -- bytes, bytearray, memoryview: Binary Sequence Types -- bytes bytearray memoryview.\n* Set Types -- set, frozenset: Set Types -- set frozenset.\n* Mapping Types -- dict::\n* Context Manager Types::\n* Type Annotation Types -- Generic Alias, Union: Type Annotation Types -- Generic Alias Union.\n* Other Built-in Types::\n* Special Attributes::\n* Integer string conversion length limitation::\n",
            "subsections": []
        },
        "Numeric Types -- int, float, complex": {
            "content": "* Bitwise Operations on Integer Types::\n* Additional Methods on Integer Types::\n* Additional Methods on Float::\n* Hashing of numeric types::\n",
            "subsections": []
        },
        "Iterator Types": {
            "content": "* Generator Types::\n",
            "subsections": []
        },
        "Sequence Types -- list, tuple, range": {
            "content": "* Common Sequence Operations::\n* Immutable Sequence Types::\n* Mutable Sequence Types::\n* Lists: Lists<2>.\n* Tuples::\n* Ranges::\n",
            "subsections": []
        },
        "Text Sequence Type -- str": {
            "content": "* String Methods: String Methods<2>.\n* printf-style String Formatting::\n",
            "subsections": []
        },
        "Binary Sequence Types -- bytes, bytearray, memoryview": {
            "content": "* Bytes Objects::\n* Bytearray Objects::\n* Bytes and Bytearray Operations::\n* printf-style Bytes Formatting::\n* Memory Views::\n",
            "subsections": []
        },
        "Mapping Types -- dict": {
            "content": "* Dictionary view objects::\n",
            "subsections": []
        },
        "Type Annotation Types -- Generic Alias, Union": {
            "content": "* Generic Alias Type::\n* Union Type::\n",
            "subsections": []
        },
        "Generic Alias Type": {
            "content": "* Standard Generic Classes::\n* Special Attributes of GenericAlias objects::\n",
            "subsections": []
        },
        "Other Built-in Types": {
            "content": "* Modules: Modules<4>.\n* Classes and Class Instances::\n* Functions::\n* Methods::\n* Code Objects::\n* Type Objects::\n* The Null Object::\n* The Ellipsis Object::\n* The NotImplemented Object::\n* Internal Objects::\n",
            "subsections": []
        },
        "Integer string conversion length limitation": {
            "content": "* Affected APIs::\n* Configuring the limit::\n* Recommended configuration::\n",
            "subsections": []
        },
        "Built-in Exceptions": {
            "content": "* Exception context::\n* Inheriting from built-in exceptions::\n* Base classes::\n* Concrete exceptions::\n* Warnings::\n* Exception groups::\n* Exception hierarchy::\n",
            "subsections": []
        },
        "Concrete exceptions": {
            "content": "* OS exceptions::\n",
            "subsections": []
        },
        "Text Processing Services": {
            "content": "* string -- Common string operations::\n* re -- Regular expression operations::\n* difflib -- Helpers for computing deltas::\n* textwrap -- Text wrapping and filling::\n* unicodedata -- Unicode Database::\n* stringprep -- Internet String Preparation::\n* readline -- GNU readline interface::\n* rlcompleter -- Completion function for GNU readline::\n\nstring -- Common string operations\n\n* String constants::\n* Custom String Formatting::\n* Format String Syntax::\n* Template strings::\n* Helper functions::\n",
            "subsections": []
        },
        "Format String Syntax": {
            "content": "* Format Specification Mini-Language::\n* Format examples::\n\nre -- Regular expression operations\n\n* Regular Expression Syntax::\n* Module Contents::\n* Regular Expression Objects::\n* Match Objects::\n* Regular Expression Examples::\n",
            "subsections": []
        },
        "Module Contents": {
            "content": "* Flags::\n* Functions: Functions<2>.\n* Exceptions: Exceptions<3>.\n",
            "subsections": []
        },
        "Regular Expression Examples": {
            "content": "* Checking for a Pair::\n* Simulating scanf(): Simulating scanf.\n* search() vs. match(): search vs match.\n* Making a Phonebook::\n* Text Munging::\n* Finding all Adverbs::\n* Finding all Adverbs and their Positions::\n* Raw String Notation::\n* Writing a Tokenizer::\n\ndifflib -- Helpers for computing deltas\n\n* SequenceMatcher Objects::\n* SequenceMatcher Examples::\n* Differ Objects::\n* Differ Example::\n* A command-line interface to difflib::\n* ndiff example::\n\nreadline -- GNU readline interface\n\n* Init file::\n* Line buffer::\n* History file::\n* History list::\n* Startup hooks::\n* Completion::\n* Example::\n",
            "subsections": []
        },
        "Binary Data Services": {
            "content": "* struct -- Interpret bytes as packed binary data::\n* codecs -- Codec registry and base classes::\n\nstruct -- Interpret bytes as packed binary data\n\n* Functions and Exceptions::\n* Format Strings::\n* Applications::\n* Classes: Classes<3>.\n",
            "subsections": []
        },
        "Format Strings": {
            "content": "* Byte Order, Size, and Alignment: Byte Order Size and Alignment.\n* Format Characters::\n* Examples: Examples<2>.\n",
            "subsections": []
        },
        "Applications": {
            "content": "* Native Formats::\n* Standard Formats::\n\ncodecs -- Codec registry and base classes\n\n* Codec Base Classes::\n* Encodings and Unicode::\n* Standard Encodings::\n* Python Specific Encodings::\n* encodings.idna -- Internationalized Domain Names in Applications: encodings idna -- Internationalized Domain Names in Applications.\n* encodings.mbcs -- Windows ANSI codepage: encodings mbcs -- Windows ANSI codepage.\n* encodings.utf8sig -- UTF-8 codec with BOM signature: encodings utf8sig -- UTF-8 codec with BOM signature.\n",
            "subsections": []
        },
        "Codec Base Classes": {
            "content": "* Error Handlers::\n* Stateless Encoding and Decoding::\n* Incremental Encoding and Decoding::\n* Stream Encoding and Decoding::\n",
            "subsections": []
        },
        "Incremental Encoding and Decoding": {
            "content": "* IncrementalEncoder Objects::\n* IncrementalDecoder Objects::\n",
            "subsections": []
        },
        "Stream Encoding and Decoding": {
            "content": "* StreamWriter Objects::\n* StreamReader Objects::\n* StreamReaderWriter Objects::\n* StreamRecoder Objects::\n",
            "subsections": []
        },
        "Python Specific Encodings": {
            "content": "* Text Encodings::\n* Binary Transforms::\n* Text Transforms::\n",
            "subsections": []
        },
        "Data Types": {
            "content": "* Supported dunder names::\n* Supported sunder names::\n\ngraphlib -- Functionality to operate with graph-like structures\n\n* Exceptions: Exceptions<4>.\n",
            "subsections": []
        },
        "Available Types": {
            "content": "* Common Properties::\n* Determining if an Object is Aware or Naive::\n\ntimedelta Objects\n\n* Examples of usage; timedelta: Examples of usage timedelta.\n\ndate Objects\n\n* Examples of Usage; date: Examples of Usage date.\n\ndatetime Objects\n\n* Examples of Usage; datetime: Examples of Usage datetime.\n\ntime Objects\n\n* Examples of Usage; time: Examples of Usage time.\n\nstrftime() and strptime() Behavior\n\n* strftime() and strptime() Format Codes: strftime and strptime Format Codes.\n* Technical Detail::\n\nzoneinfo -- IANA time zone support\n\n* Using ZoneInfo::\n* Data sources::\n* The ZoneInfo class::\n* Functions: Functions<3>.\n* Globals::\n* Exceptions and warnings::\n",
            "subsections": []
        },
        "Data sources": {
            "content": "* Configuring the data sources::\n",
            "subsections": []
        },
        "Configuring the data sources": {
            "content": "* Compile-time configuration::\n* Environment configuration::\n* Runtime configuration::\n",
            "subsections": []
        },
        "The ZoneInfo class": {
            "content": "* String representations::\n* Pickle serialization::\n\ncalendar -- General calendar-related functions\n\n* Command-Line Usage::\n\ncollections -- Container datatypes\n\n* ChainMap objects::\n* Counter objects::\n* deque objects::\n* defaultdict objects::\n* namedtuple() Factory Function for Tuples with Named Fields: namedtuple Factory Function for Tuples with Named Fields.\n* OrderedDict objects::\n* UserDict objects::\n* UserList objects::\n* UserString objects::\n",
            "subsections": []
        },
        "ChainMap objects": {
            "content": "* ChainMap Examples and Recipes::\n\ndeque objects\n\n* deque Recipes::\n\ndefaultdict objects\n\n* defaultdict Examples::\n",
            "subsections": []
        },
        "OrderedDict objects": {
            "content": "* OrderedDict Examples and Recipes::\n\ncollections.abc -- Abstract Base Classes for Containers\n\n* Collections Abstract Base Classes::\n* Collections Abstract Base Classes - Detailed Descriptions::\n* Examples and Recipes::\n\nheapq -- Heap queue algorithm\n\n* Basic Examples::\n* Priority Queue Implementation Notes::\n* Theory::\n\nbisect -- Array bisection algorithm\n\n* Performance Notes::\n* Searching Sorted Lists::\n* Examples: Examples<3>.\n\nweakref -- Weak references\n\n* Weak Reference Objects::\n* Example: Example<2>.\n* Finalizer Objects::\n* Comparing finalizers with del() methods: Comparing finalizers with del methods.\n\ntypes -- Dynamic type creation and names for built-in types\n\n* Dynamic Type Creation::\n* Standard Interpreter Types::\n* Additional Utility Classes and Functions::\n* Coroutine Utility Functions::\n\npprint -- Data pretty printer\n\n* Functions: Functions<4>.\n* PrettyPrinter Objects::\n* Example: Example<3>.\n\nreprlib -- Alternate repr() implementation\n\n* Repr Objects::\n* Subclassing Repr Objects::\n\nenum -- Support for enumerations\n\n* Module Contents: Module Contents<2>.\n* Data Types: Data Types<2>.\n* Utilities and Decorators::\n* Notes::\n",
            "subsections": []
        },
        "Numeric and Mathematical Modules": {
            "content": "* numbers -- Numeric abstract base classes::\n* math -- Mathematical functions::\n* cmath -- Mathematical functions for complex numbers::\n* decimal -- Decimal fixed point and floating point arithmetic::\n* fractions -- Rational numbers::\n* random -- Generate pseudo-random numbers::\n* statistics -- Mathematical statistics functions::\n\nnumbers -- Numeric abstract base classes\n\n* The numeric tower::\n* Notes for type implementors::\n",
            "subsections": []
        },
        "Notes for type implementors": {
            "content": "* Adding More Numeric ABCs::\n* Implementing the arithmetic operations::\n\nmath -- Mathematical functions\n\n* Number-theoretic and representation functions::\n* Power and logarithmic functions::\n* Trigonometric functions::\n* Angular conversion::\n* Hyperbolic functions::\n* Special functions::\n* Constants: Constants<2>.\n\ncmath -- Mathematical functions for complex numbers\n\n* Conversions to and from polar coordinates::\n* Power and logarithmic functions: Power and logarithmic functions<2>.\n* Trigonometric functions: Trigonometric functions<2>.\n* Hyperbolic functions: Hyperbolic functions<2>.\n* Classification functions::\n* Constants: Constants<3>.\n\ndecimal -- Decimal fixed point and floating point arithmetic\n\n* Quick-start Tutorial::\n* Decimal objects::\n* Context objects::\n* Constants: Constants<4>.\n* Rounding modes::\n* Signals::\n* Floating Point Notes::\n* Working with threads::\n* Recipes::\n* Decimal FAQ::\n",
            "subsections": []
        },
        "Decimal objects": {
            "content": "* Logical operands::\n",
            "subsections": []
        },
        "Floating Point Notes": {
            "content": "* Mitigating round-off error with increased precision::\n* Special values::\n\nrandom -- Generate pseudo-random numbers\n\n* Bookkeeping functions::\n* Functions for bytes::\n* Functions for integers::\n* Functions for sequences::\n* Discrete distributions::\n* Real-valued distributions::\n* Alternative Generator::\n* Notes on Reproducibility::\n* Examples: Examples<4>.\n* Recipes: Recipes<2>.\n\nstatistics -- Mathematical statistics functions\n\n* Averages and measures of central location::\n* Measures of spread::\n* Statistics for relations between two inputs::\n* Function details::\n* Exceptions: Exceptions<5>.\n* NormalDist objects::\n* Examples and Recipes: Examples and Recipes<2>.\n",
            "subsections": []
        },
        "Examples and Recipes": {
            "content": "* Supporting a variable number of context managers::\n* Catching exceptions from enter methods::\n* Cleaning up in an enter implementation::\n* Replacing any use of try-finally and flag variables::\n* Using a context manager as a function decorator::\n",
            "subsections": []
        },
        "Functional Programming Modules": {
            "content": "* itertools -- Functions creating iterators for efficient looping::\n* functools -- Higher-order functions and operations on callable objects::\n* operator -- Standard operators as functions::\n\nitertools -- Functions creating iterators for efficient looping\n\n* Itertool Functions::\n* Itertools Recipes::\n\nfunctools -- Higher-order functions and operations on callable objects\n\n* partial Objects::\n\noperator -- Standard operators as functions\n\n* Mapping Operators to Functions::\n* In-place Operators::\n",
            "subsections": []
        },
        "File and Directory Access": {
            "content": "* pathlib -- Object-oriented filesystem paths::\n* os.path -- Common pathname manipulations: os path -- Common pathname manipulations.\n* fileinput -- Iterate over lines from multiple input streams::\n* stat -- Interpreting stat() results: stat -- Interpreting stat results.\n* filecmp -- File and Directory Comparisons::\n* tempfile -- Generate temporary files and directories::\n* glob -- Unix style pathname pattern expansion::\n* fnmatch -- Unix filename pattern matching::\n* linecache -- Random access to text lines::\n* shutil -- High-level file operations::\n\npathlib -- Object-oriented filesystem paths\n\n* Basic use::\n* Pure paths::\n* Concrete paths::\n* Correspondence to tools in the os module::\n",
            "subsections": []
        },
        "Pure paths": {
            "content": "* General properties::\n* Operators: Operators<2>.\n* Accessing individual parts::\n* Methods and properties::\n",
            "subsections": []
        },
        "Concrete paths": {
            "content": "* Methods: Methods<2>.\n\nfilecmp -- File and Directory Comparisons\n\n* The dircmp class::\n\ntempfile -- Generate temporary files and directories\n\n* Examples: Examples<5>.\n* Deprecated functions and variables::\n\nshutil -- High-level file operations\n\n* Directory and files operations::\n* Archiving operations::\n* Querying the size of the output terminal::\n",
            "subsections": []
        },
        "Directory and files operations": {
            "content": "* Platform-dependent efficient copy operations::\n* copytree example::\n* rmtree example::\n",
            "subsections": []
        },
        "Archiving operations": {
            "content": "* Archiving example::\n* Archiving example with basedir::\n",
            "subsections": []
        },
        "Data Persistence": {
            "content": "* pickle -- Python object serialization::\n* copyreg -- Register pickle support functions::\n* shelve -- Python object persistence::\n* marshal -- Internal Python object serialization::\n* dbm -- Interfaces to Unix \"databases\"::\n* sqlite3 -- DB-API 2.0 interface for SQLite databases: sqlite3 -- DB-API 2 0 interface for SQLite databases.\n\npickle -- Python object serialization\n\n* Relationship to other Python modules::\n* Data stream format::\n* Module Interface::\n* What can be pickled and unpickled?::\n* Pickling Class Instances::\n* Custom Reduction for Types, Functions, and Other Objects: Custom Reduction for Types Functions and Other Objects.\n* Out-of-band Buffers::\n* Restricting Globals::\n* Performance: Performance<2>.\n* Examples: Examples<6>.\n",
            "subsections": []
        },
        "Relationship to other Python modules": {
            "content": "* Comparison with marshal::\n* Comparison with json::\n",
            "subsections": []
        },
        "Pickling Class Instances": {
            "content": "* Persistence of External Objects::\n* Dispatch Tables::\n* Handling Stateful Objects::\n",
            "subsections": []
        },
        "Out-of-band Buffers": {
            "content": "* Provider API::\n* Consumer API::\n* Example: Example<4>.\n\ncopyreg -- Register pickle support functions\n\n* Example: Example<5>.\n\nshelve -- Python object persistence\n\n* Restrictions::\n* Example: Example<6>.\n\ndbm -- Interfaces to Unix \"databases\"\n\n* dbm.gnu -- GNU database manager: dbm gnu -- GNU database manager.\n* dbm.ndbm -- New Database Manager: dbm ndbm -- New Database Manager.\n* dbm.dumb -- Portable DBM implementation: dbm dumb -- Portable DBM implementation.\n\nsqlite3 -- DB-API 2.0 interface for SQLite databases\n\n* Tutorial::\n* Reference::\n* How-to guides::\n* Explanation::\n",
            "subsections": []
        },
        "Reference": {
            "content": ".........\n\n* Menu:\n\n* Runners::\n* Coroutines and Tasks::\n* Streams::\n* Synchronization Primitives::\n* Subprocesses::\n* Queues::\n* Exceptions: Exceptions<11>.\n* Event Loop::\n* Futures::\n* Transports and Protocols::\n* Policies::\n* Platform Support::\n* Extending::\n* High-level API Index::\n* Low-level API Index::\n* Developing with asyncio::\n",
            "subsections": []
        },
        "How-to guides": {
            "content": "* How to use placeholders to bind values in SQL queries::\n* How to adapt custom Python types to SQLite values::\n* How to convert SQLite values to custom Python types::\n* Adapter and converter recipes::\n* How to use connection shortcut methods::\n* How to use the connection context manager::\n* How to work with SQLite URIs::\n* How to create and use row factories::\n* How to handle non-UTF-8 text encodings::\n",
            "subsections": []
        },
        "How to adapt custom Python types to SQLite values": {
            "content": "* How to write adaptable objects::\n* How to register adapter callables::\n",
            "subsections": []
        },
        "Explanation": {
            "content": "* Transaction control::\n",
            "subsections": []
        },
        "Transaction control": {
            "content": "* Transaction control via the autocommit attribute::\n* Transaction control via the isolationlevel attribute::\n",
            "subsections": []
        },
        "Data Compression and Archiving": {
            "content": "* zlib -- Compression compatible with gzip::\n* gzip -- Support for gzip files::\n* bz2 -- Support for bzip2 compression::\n* lzma -- Compression using the LZMA algorithm::\n* zipfile -- Work with ZIP archives::\n* tarfile -- Read and write tar archive files::\n\ngzip -- Support for gzip files\n\n* Examples of usage::\n* Command Line Interface::\n",
            "subsections": []
        },
        "Command Line Interface": {
            "content": "* Command line options: Command line options<2>.\n\nmailbox -- Manipulate mailboxes in various formats\n\n* Mailbox objects::\n* Message objects::\n* Exceptions: Exceptions<16>.\n* Examples: Examples<22>.\n",
            "subsections": []
        },
        "Command-Line Interface": {
            "content": "* Command-line options: Command-line options<3>.\n",
            "subsections": []
        },
        "Decompression pitfalls": {
            "content": "* From file itself::\n* File System limitations::\n* Resources limitations::\n* Interruption::\n* Default behaviors of extraction::\n\ntarfile -- Read and write tar archive files\n\n* TarFile Objects::\n* TarInfo Objects::\n* Extraction filters::\n* Command-Line Interface: Command-Line Interface<2>.\n* Examples: Examples<8>.\n* Supported tar formats::\n* Unicode issues::\n",
            "subsections": []
        },
        "Extraction filters": {
            "content": "* Default named filters::\n* Filter errors::\n* Hints for further verification::\n* Supporting older Python versions::\n* Stateful extraction filter example::\n",
            "subsections": []
        },
        "File Formats": {
            "content": "* csv -- CSV File Reading and Writing::\n* configparser -- Configuration file parser::\n* tomllib -- Parse TOML files::\n* netrc -- netrc file processing::\n* plistlib -- Generate and parse Apple .plist files: plistlib -- Generate and parse Apple plist files.\n\ncsv -- CSV File Reading and Writing\n\n* Module Contents: Module Contents<3>.\n* Dialects and Formatting Parameters::\n* Reader Objects::\n* Writer Objects::\n* Examples: Examples<9>.\n\nconfigparser -- Configuration file parser\n\n* Quick Start::\n* Supported Datatypes::\n* Fallback Values::\n* Supported INI File Structure::\n* Interpolation of values::\n* Mapping Protocol Access::\n* Customizing Parser Behaviour::\n* Legacy API Examples::\n* ConfigParser Objects::\n* RawConfigParser Objects::\n* Exceptions: Exceptions<7>.\n\ntomllib -- Parse TOML files\n\n* Examples: Examples<10>.\n* Conversion Table::\n\nnetrc -- netrc file processing\n\n* netrc Objects::\n\nplistlib -- Generate and parse Apple .plist files\n\n* Examples: Examples<11>.\n",
            "subsections": []
        },
        "Cryptographic Services": {
            "content": "* hashlib -- Secure hashes and message digests::\n* hmac -- Keyed-Hashing for Message Authentication::\n* secrets -- Generate secure random numbers for managing secrets::\n\nhashlib -- Secure hashes and message digests\n\n* Hash algorithms::\n* Usage::\n* Constructors::\n* Attributes::\n* Hash Objects::\n* SHAKE variable length digests::\n* File hashing::\n* Key derivation::\n* BLAKE2::\n",
            "subsections": []
        },
        "BLAKE2": {
            "content": "* Creating hash objects::\n* Constants: Constants<5>.\n* Examples: Examples<12>.\n* Credits::\n",
            "subsections": []
        },
        "Examples": {
            "content": "........\n\n* *note Using asyncio.neweventloop() and loop.runforever(): 2fc1.\n\n* *note Using loop.calllater(): 2fc3.\n\n* Using 'loop.createconnection()' to implement *note an echo-client:\n2f20.\n\n* Using 'loop.createconnection()' to *note connect a socket: 2f27.\n\n* *note Using addreader() to watch an FD for read events: 2f28.\n\n* *note Using loop.addsignalhandler(): 2fc6.\n\n* *note Using loop.subprocessexec(): 2f6a.\n\nFile: python3.12.info,  Node: Transports<2>,  Next: Protocols<2>,  Prev: Event Loop Methods<2>,  Up: Low-level API Index\n\n5.18.1.125 Transports\n.....................\n\nAll transports implement the following methods:\n\n*note transport.close(): 2f9d.                         Close the transport.\n\n\n*note transport.isclosing(): ac4.                     Return 'True' if the transport is closing or is\nclosed.\n\n\n*note transport.getextrainfo(): 8d0.                 Request for information about the transport.\n\n\n*note transport.setprotocol(): 2fe1.                  Set a new protocol.\n\n\n*note transport.getprotocol(): 2fe2.                  Return the current protocol.\n\n\nTransports that can receive data (TCP and Unix connections, pipes, etc).\nReturned from methods like *note loop.createconnection(): 3cc, *note\nloop.createunixconnection(): 2f0e, *note loop.connectreadpipe():\n2f54, etc:\n",
            "subsections": []
        },
        "Generating tokens": {
            "content": "* How many bytes should tokens use?::\n",
            "subsections": []
        },
        "Generic Operating System Services": {
            "content": "* os -- Miscellaneous operating system interfaces::\n* io -- Core tools for working with streams::\n* time -- Time access and conversions::\n* argparse -- Parser for command-line options, arguments and sub-commands: argparse -- Parser for command-line options arguments and sub-commands.\n* getopt -- C-style parser for command line options::\n* logging -- Logging facility for Python::\n* logging.config -- Logging configuration: logging config -- Logging configuration.\n* logging.handlers -- Logging handlers: logging handlers -- Logging handlers.\n* getpass -- Portable password input::\n* curses -- Terminal handling for character-cell displays::\n* curses.textpad -- Text input widget for curses programs: curses textpad -- Text input widget for curses programs.\n* curses.ascii -- Utilities for ASCII characters: curses ascii -- Utilities for ASCII characters.\n* curses.panel -- A panel stack extension for curses: curses panel -- A panel stack extension for curses.\n* platform -- Access to underlying platform's identifying data::\n* errno -- Standard errno system symbols::\n* ctypes -- A foreign function library for Python::\n\nos -- Miscellaneous operating system interfaces\n\n* File Names, Command Line Arguments, and Environment Variables: File Names Command Line Arguments and Environment Variables.\n* Python UTF-8 Mode::\n* Process Parameters::\n* File Object Creation::\n* File Descriptor Operations::\n* Files and Directories::\n* Process Management::\n* Interface to the scheduler::\n* Miscellaneous System Information::\n* Random numbers: Random numbers<2>.\n",
            "subsections": []
        },
        "File Descriptor Operations": {
            "content": "* Querying the size of a terminal::\n* Inheritance of File Descriptors::\n",
            "subsections": []
        },
        "Files and Directories": {
            "content": "* Linux extended attributes::\n\nio -- Core tools for working with streams\n\n* Overview: Overview<2>.\n* Text Encoding::\n* High-level Module Interface::\n* Class hierarchy::\n* Performance: Performance<3>.\n",
            "subsections": []
        },
        "Overview": {
            "content": "........\n\nThis document aims to provide a gentle introduction to the *note\nipaddress: 7a. module.  It is aimed primarily at users that aren't\nalready familiar with IP networking terminology, but may also be useful\nto network engineers wanting an overview of how *note ipaddress: 7a.\nrepresents IP network addressing concepts.\n\n* Menu:\n\n* Creating Address/Network/Interface objects::\n* Inspecting Address/Network/Interface Objects::\n* Networks as lists of Addresses::\n* Comparisons: Comparisons<4>.\n* Using IP Addresses with other modules::\n* Getting more detail when instance creation fails::\n",
            "subsections": []
        },
        "Text Encoding": {
            "content": "* Opt-in EncodingWarning::\n",
            "subsections": []
        },
        "Class hierarchy": {
            "content": "* I/O Base Classes::\n* Raw File I/O::\n* Buffered Streams::\n* Text I/O: Text I/O<2>.\n",
            "subsections": []
        },
        "Performance": {
            "content": "* My program is too slow. How do I speed it up?: My program is too slow How do I speed it up?.\n* What is the most efficient way to concatenate many strings together?::\n",
            "subsections": []
        },
        "Example": {
            "content": "* Creating a parser::\n* Adding arguments::\n* Parsing arguments::\n",
            "subsections": []
        },
        "ArgumentParser objects": {
            "content": "* prog::\n* usage::\n* description::\n* epilog::\n* parents::\n* formatterclass::\n* prefixchars::\n* fromfileprefixchars::\n* argumentdefault::\n* allowabbrev::\n* conflicthandler::\n* addhelp::\n* exitonerror::\n",
            "subsections": []
        },
        "The addargument() method": {
            "content": "* name or flags::\n* action::\n* nargs::\n* const::\n* default::\n* type::\n* choices::\n* required::\n* help::\n* metavar::\n* dest::\n* Action classes::\n",
            "subsections": []
        },
        "The parseargs() method": {
            "content": "* Option value syntax::\n* Invalid arguments::\n* Arguments containing -::\n* Argument abbreviations (prefix matching): Argument abbreviations prefix matching.\n* Beyond sys.argv: Beyond sys argv.\n* The Namespace object::\n",
            "subsections": []
        },
        "Other utilities": {
            "content": "* Sub-commands::\n* FileType objects::\n* Argument groups::\n* Mutual exclusion::\n* Parser defaults::\n* Printing help::\n* Partial parsing::\n* Customizing file parsing::\n* Exiting methods::\n* Intermixed parsing::\n\nlogging -- Logging facility for Python\n\n* Logger Objects::\n* Logging Levels::\n* Handler Objects::\n* Formatter Objects::\n* Filter Objects::\n* LogRecord Objects::\n* LogRecord attributes::\n* LoggerAdapter Objects::\n* Thread Safety::\n* Module-Level Functions::\n* Module-Level Attributes::\n* Integration with the warnings module::\n\nlogging.config -- Logging configuration\n\n* Configuration functions::\n* Security considerations::\n* Configuration dictionary schema::\n* Configuration file format::\n",
            "subsections": []
        },
        "Configuration dictionary schema": {
            "content": "* Dictionary Schema Details::\n* Incremental Configuration::\n* Object connections::\n* User-defined objects::\n* Handler configuration order::\n* Access to external objects::\n* Access to internal objects::\n* Import resolution and custom importers::\n* Configuring QueueHandler and QueueListener::\n\nlogging.handlers -- Logging handlers\n\n* StreamHandler::\n* FileHandler::\n* NullHandler::\n* WatchedFileHandler::\n* BaseRotatingHandler::\n* RotatingFileHandler::\n* TimedRotatingFileHandler::\n* SocketHandler::\n* DatagramHandler::\n* SysLogHandler::\n* NTEventLogHandler::\n* SMTPHandler::\n* MemoryHandler::\n* HTTPHandler::\n* QueueHandler::\n* QueueListener::\n\ncurses -- Terminal handling for character-cell displays\n\n* Functions: Functions<6>.\n* Window Objects::\n* Constants: Constants<6>.\n\ncurses.textpad -- Text input widget for curses programs\n\n* Textbox objects::\n\ncurses.panel -- A panel stack extension for curses\n\n* Functions: Functions<7>.\n* Panel Objects::\n\nplatform --  Access to underlying platform's identifying data\n\n* Cross Platform::\n* Java Platform::\n* Windows Platform::\n* macOS Platform::\n* Unix Platforms::\n* Linux Platforms::\n\nctypes -- A foreign function library for Python\n\n* ctypes tutorial::\n* ctypes reference::\n\nctypes tutorial\n\n* Loading dynamic link libraries::\n* Accessing functions from loaded dlls::\n* Calling functions::\n* Fundamental data types::\n* Calling functions, continued: Calling functions continued.\n* Calling variadic functions::\n* Calling functions with your own custom data types::\n* Specifying the required argument types (function prototypes): Specifying the required argument types function prototypes.\n* Return types::\n* Passing pointers (or; passing parameters by reference): Passing pointers or passing parameters by reference.\n* Structures and unions::\n* Structure/union alignment and byte order::\n* Bit fields in structures and unions::\n* Arrays::\n* Pointers::\n* Type conversions::\n* Incomplete Types::\n* Callback functions::\n* Accessing values exported from dlls::\n* Surprises::\n* Variable-sized data types::\n\nctypes reference\n\n* Finding shared libraries::\n* Loading shared libraries::\n* Foreign functions::\n* Function prototypes::\n* Utility functions::\n* Data types::\n* Fundamental data types: Fundamental data types<2>.\n* Structured data types::\n* Arrays and pointers::\n",
            "subsections": []
        },
        "Concurrent Execution": {
            "content": "* threading -- Thread-based parallelism::\n* multiprocessing -- Process-based parallelism::\n* multiprocessing.sharedmemory -- Shared memory for direct access across processes: multiprocessing sharedmemory -- Shared memory for direct access across processes.\n* The concurrent package::\n* concurrent.futures -- Launching parallel tasks: concurrent futures -- Launching parallel tasks.\n* subprocess -- Subprocess management::\n* sched -- Event scheduler::\n* queue -- A synchronized queue class::\n* contextvars -- Context Variables::\n* thread -- Low-level threading API::\n\nthreading -- Thread-based parallelism\n\n* Thread-Local Data::\n* Thread Objects::\n* Lock Objects::\n* RLock Objects::\n* Condition Objects::\n* Semaphore Objects::\n* Event Objects::\n* Timer Objects::\n* Barrier Objects::\n* Using locks, conditions, and semaphores in the with statement: Using locks conditions and semaphores in the with statement.\n",
            "subsections": []
        },
        "Semaphore Objects": {
            "content": "* Semaphore Example::\n\nmultiprocessing -- Process-based parallelism\n\n* Introduction: Introduction<7>.\n* Reference: Reference<2>.\n* Programming guidelines::\n* Examples: Examples<13>.\n",
            "subsections": []
        },
        "Shared ctypes Objects": {
            "content": "* The multiprocessing.sharedctypes module: The multiprocessing sharedctypes module.\n",
            "subsections": []
        },
        "Managers": {
            "content": "* Customized managers::\n* Using a remote manager::\n",
            "subsections": []
        },
        "Proxy Objects": {
            "content": "* Cleanup::\n",
            "subsections": []
        },
        "Listeners and Clients": {
            "content": "* Address Formats::\n",
            "subsections": []
        },
        "Programming guidelines": {
            "content": "* All start methods::\n* The spawn and forkserver start methods::\n\nconcurrent.futures -- Launching parallel tasks\n\n* Executor Objects::\n* ThreadPoolExecutor::\n* ProcessPoolExecutor::\n* Future Objects::\n* Module Functions::\n* Exception classes::\n",
            "subsections": []
        },
        "ThreadPoolExecutor": {
            "content": "* ThreadPoolExecutor Example::\n",
            "subsections": []
        },
        "ProcessPoolExecutor": {
            "content": "* ProcessPoolExecutor Example::\n\nsubprocess -- Subprocess management\n\n* Using the subprocess Module::\n* Security Considerations::\n* Popen Objects::\n* Windows Popen Helpers::\n* Older high-level API::\n* Replacing Older Functions with the subprocess Module::\n* Legacy Shell Invocation Functions::\n* Notes: Notes<2>.\n",
            "subsections": []
        },
        "Using the subprocess Module": {
            "content": "* Frequently Used Arguments::\n* Popen Constructor::\n* Exceptions: Exceptions<9>.\n",
            "subsections": []
        },
        "Windows Popen Helpers": {
            "content": "* Windows Constants::\n",
            "subsections": []
        },
        "Replacing Older Functions with the subprocess Module": {
            "content": "* Replacing /bin/sh shell command substitution::\n* Replacing shell pipeline::\n* Replacing os.system(): Replacing os system.\n* Replacing the os.spawn family: Replacing the os spawn family.\n* Replacing os.popen(), os.popen2(), os.popen3(): Replacing os popen os popen2 os popen3.\n* Replacing functions from the popen2 module::\n",
            "subsections": []
        },
        "Notes": {
            "content": "* Converting an argument sequence to a string on Windows::\n* Disabling use of vfork() or posixspawn(): Disabling use of vfork or posixspawn.\n\nsched -- Event scheduler\n\n* Scheduler Objects::\n\nqueue -- A synchronized queue class\n\n* Queue Objects::\n* SimpleQueue Objects::\n\ncontextvars -- Context Variables\n\n* Context Variables::\n* Manual Context Management::\n* asyncio support::\n",
            "subsections": []
        },
        "Networking and Interprocess Communication": {
            "content": "* asyncio -- Asynchronous I/O::\n* socket -- Low-level networking interface::\n* ssl -- TLS/SSL wrapper for socket objects::\n* select -- Waiting for I/O completion::\n* selectors -- High-level I/O multiplexing::\n* signal -- Set handlers for asynchronous events::\n* mmap -- Memory-mapped file support::\n\nasyncio -- Asynchronous I/O\n\n* Runners::\n* Coroutines and Tasks::\n* Streams::\n* Synchronization Primitives::\n* Subprocesses::\n* Queues::\n* Exceptions: Exceptions<11>.\n* Event Loop::\n* Futures::\n* Transports and Protocols::\n* Policies::\n* Platform Support::\n* Extending::\n* High-level API Index::\n* Low-level API Index::\n* Developing with asyncio::\n",
            "subsections": []
        },
        "Runners": {
            "content": "* Running an asyncio Program::\n* Runner context manager::\n* Handling Keyboard Interruption::\n",
            "subsections": []
        },
        "Coroutines and Tasks": {
            "content": "* Coroutines: Coroutines<3>.\n* Awaitables::\n* Creating Tasks::\n* Task Cancellation::\n* Task Groups::\n* Sleeping::\n* Running Tasks Concurrently::\n* Eager Task Factory::\n* Shielding From Cancellation::\n* Timeouts::\n* Waiting Primitives::\n* Running in Threads::\n* Scheduling From Other Threads::\n* Introspection::\n* Task Object::\n",
            "subsections": []
        },
        "Streams": {
            "content": "* StreamReader::\n* StreamWriter::\n* Examples: Examples<14>.\n",
            "subsections": []
        },
        "Synchronization Primitives": {
            "content": "* Lock::\n* Event::\n* Condition::\n* Semaphore::\n* BoundedSemaphore::\n* Barrier::\n",
            "subsections": []
        },
        "Subprocesses": {
            "content": "............\n\n*note loop.subprocessexec(): 2f51.                    Spawn a subprocess.\n\n\n*note loop.subprocessshell(): 2f52.                   Spawn a subprocess from a shell command.\n\n",
            "subsections": []
        },
        "Interacting with Subprocesses": {
            "content": "* Subprocess and Threads::\n* Examples: Examples<15>.\n",
            "subsections": []
        },
        "Queues": {
            "content": "* Queue::\n* Priority Queue::\n* LIFO Queue::\n* Exceptions: Exceptions<10>.\n* Examples: Examples<16>.\n",
            "subsections": []
        },
        "Event Loop": {
            "content": "* Event Loop Methods::\n* Callback Handles::\n* Server Objects::\n* Event Loop Implementations::\n* Examples: Examples<17>.\n",
            "subsections": []
        },
        "Event Loop Methods": {
            "content": "* Running and stopping the loop::\n* Scheduling callbacks::\n* Scheduling delayed callbacks::\n* Creating Futures and Tasks::\n* Opening network connections::\n* Creating network servers::\n* Transferring files::\n* TLS Upgrade::\n* Watching file descriptors::\n* Working with socket objects directly::\n* DNS::\n* Working with pipes::\n* Unix signals::\n* Executing code in thread or process pools::\n* Error Handling API::\n* Enabling debug mode::\n* Running Subprocesses::\n",
            "subsections": []
        },
        "Futures": {
            "content": ".......\n\nA *note Future: a11. is a special 'low-level' awaitable object that\nrepresents an 'eventual result' of an asynchronous operation.\n",
            "subsections": []
        },
        "Transports and Protocols": {
            "content": "* Transports::\n* Protocols::\n* Examples: Examples<18>.\n",
            "subsections": []
        },
        "Transports": {
            "content": "* Transports Hierarchy::\n* Base Transport::\n* Read-only Transports::\n* Write-only Transports::\n* Datagram Transports::\n* Subprocess Transports::\n",
            "subsections": []
        },
        "Protocols": {
            "content": "* Base Protocols::\n* Base Protocol::\n* Streaming Protocols::\n* Buffered Streaming Protocols::\n* Datagram Protocols::\n* Subprocess Protocols::\n",
            "subsections": []
        },
        "Policies": {
            "content": "* Getting and Setting the Policy::\n* Policy Objects::\n* Process Watchers::\n* Custom Policies::\n",
            "subsections": []
        },
        "Platform Support": {
            "content": "* All Platforms::\n* Windows: Windows<71>.\n* macOS: macOS<44>.\n",
            "subsections": []
        },
        "Windows": {
            "content": "* Subprocess Support on Windows::\n",
            "subsections": []
        },
        "Extending": {
            "content": "* Writing a Custom Event Loop::\n* Future and Task private constructors::\n* Task lifetime support::\n",
            "subsections": []
        },
        "High-level API Index": {
            "content": "* Tasks::\n* Queues: Queues<2>.\n* Subprocesses: Subprocesses<2>.\n* Streams: Streams<2>.\n* Synchronization::\n* Exceptions: Exceptions<12>.\n",
            "subsections": []
        },
        "Low-level API Index": {
            "content": "* Obtaining the Event Loop::\n* Event Loop Methods: Event Loop Methods<2>.\n* Transports: Transports<2>.\n* Protocols: Protocols<2>.\n* Event Loop Policies::\n",
            "subsections": []
        },
        "Developing with asyncio": {
            "content": "* Debug Mode::\n* Concurrency and Multithreading::\n* Running Blocking Code::\n* Logging: Logging<3>.\n* Detect never-awaited coroutines::\n* Detect never-retrieved exceptions::\n\nsocket -- Low-level networking interface\n\n* Socket families::\n* Module contents::\n* Socket Objects::\n* Notes on socket timeouts::\n* Example: Example<8>.\n",
            "subsections": []
        },
        "Module contents": {
            "content": "* Special typing primitives::\n* Protocols: Protocols<3>.\n* ABCs for working with IO::\n* Functions and decorators::\n* Introspection helpers::\n* Constant::\n* Deprecated aliases::\n",
            "subsections": []
        },
        "Functions": {
            "content": "* Creating sockets::\n* Other functions: Other functions<2>.\n",
            "subsections": []
        },
        "Notes on socket timeouts": {
            "content": "* Timeouts and the connect method::\n* Timeouts and the accept method::\n\nssl -- TLS/SSL wrapper for socket objects\n\n* Functions, Constants, and Exceptions: Functions Constants and Exceptions.\n* SSL Sockets::\n* SSL Contexts::\n* Certificates::\n* Examples: Examples<19>.\n* Notes on non-blocking sockets::\n* Memory BIO Support: Memory BIO Support<2>.\n* SSL session::\n* Security considerations: Security considerations<2>.\n* TLS 1.3: TLS 1 3.\n",
            "subsections": []
        },
        "Functions, Constants, and Exceptions": {
            "content": "* Socket creation::\n* Context creation::\n* Exceptions: Exceptions<14>.\n* Random generation::\n* Certificate handling::\n* Constants: Constants<9>.\n",
            "subsections": []
        },
        "Certificates": {
            "content": "* Certificate chains::\n* CA certificates::\n* Combined key and certificate::\n* Self-signed certificates::\n",
            "subsections": []
        },
        "Security considerations": {
            "content": "* Best defaults::\n* Manual settings::\n* Multi-processing::\n",
            "subsections": []
        },
        "Manual settings": {
            "content": "* Verifying certificates::\n* Protocol versions::\n* Cipher selection::\n\nselect -- Waiting for I/O completion\n\n* /dev/poll Polling Objects::\n* Edge and Level Trigger Polling (epoll) Objects: Edge and Level Trigger Polling epoll Objects.\n* Polling Objects::\n* Kqueue Objects::\n* Kevent Objects::\n\nselectors -- High-level I/O multiplexing\n\n* Introduction: Introduction<8>.\n* Classes: Classes<4>.\n* Examples: Examples<20>.\n\nsignal -- Set handlers for asynchronous events\n\n* General rules::\n* Module contents: Module contents<2>.\n* Examples: Examples<21>.\n* Note on SIGPIPE::\n* Note on Signal Handlers and Exceptions::\n",
            "subsections": []
        },
        "General rules": {
            "content": "* Execution of Python signal handlers::\n* Signals and threads::\n\nmmap -- Memory-mapped file support\n\n* MADV* Constants::\n* MAP* Constants::\n",
            "subsections": []
        },
        "Internet Data Handling": {
            "content": "* email -- An email and MIME handling package::\n* json -- JSON encoder and decoder::\n* mailbox -- Manipulate mailboxes in various formats::\n* mimetypes -- Map filenames to MIME types::\n* base64 -- Base16, Base32, Base64, Base85 Data Encodings: base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n* binascii -- Convert between binary and ASCII::\n* quopri -- Encode and decode MIME quoted-printable data::\n\nemail -- An email and MIME handling package\n\n* email.message; Representing an email message: email message Representing an email message.\n* email.parser; Parsing email messages: email parser Parsing email messages.\n* email.generator; Generating MIME documents: email generator Generating MIME documents.\n* email.policy; Policy Objects: email policy Policy Objects.\n* email.errors; Exception and Defect classes: email errors Exception and Defect classes.\n* email.headerregistry; Custom Header Objects: email headerregistry Custom Header Objects.\n* email.contentmanager; Managing MIME Content: email contentmanager Managing MIME Content.\n* email; Examples: email Examples.\n* email.message.Message; Representing an email message using the compat32 API: email message Message Representing an email message using the compat32 API.\n* email.mime; Creating email and MIME objects from scratch: email mime Creating email and MIME objects from scratch.\n* email.header; Internationalized headers: email header Internationalized headers.\n* email.charset; Representing character sets: email charset Representing character sets.\n* email.encoders; Encoders: email encoders Encoders.\n* email.utils; Miscellaneous utilities: email utils Miscellaneous utilities.\n* email.iterators; Iterators: email iterators Iterators.\n\nemail.parser: Parsing email messages\n\n* FeedParser API::\n* Parser API::\n* Additional notes::\n\nemail.contentmanager: Managing MIME Content\n\n* Content Manager Instances::\n\njson -- JSON encoder and decoder\n\n* Basic Usage::\n* Encoders and Decoders::\n* Exceptions: Exceptions<15>.\n* Standard Compliance and Interoperability::\n* Command Line Interface: Command Line Interface<2>.\n",
            "subsections": []
        },
        "Standard Compliance and Interoperability": {
            "content": "* Character Encodings::\n* Infinite and NaN Number Values::\n* Repeated Names Within an Object::\n* Top-level Non-Object, Non-Array Values: Top-level Non-Object Non-Array Values.\n* Implementation Limitations::\n",
            "subsections": []
        },
        "Mailbox objects": {
            "content": "* Maildir objects::\n* mbox objects::\n* MH objects::\n* Babyl objects::\n* MMDF objects::\n",
            "subsections": []
        },
        "Message objects": {
            "content": "* MaildirMessage objects::\n* mboxMessage objects::\n* MHMessage objects::\n* BabylMessage objects::\n* MMDFMessage objects::\n\nmimetypes -- Map filenames to MIME types\n\n* MimeTypes Objects::\n\nbase64 -- Base16, Base32, Base64, Base85 Data Encodings\n\n* Security Considerations: Security Considerations<2>.\n",
            "subsections": []
        },
        "Structured Markup Processing Tools": {
            "content": "* html -- HyperText Markup Language support::\n* html.parser -- Simple HTML and XHTML parser: html parser -- Simple HTML and XHTML parser.\n* html.entities -- Definitions of HTML general entities: html entities -- Definitions of HTML general entities.\n* XML Processing Modules::\n* xml.etree.ElementTree -- The ElementTree XML API: xml etree ElementTree -- The ElementTree XML API.\n* xml.dom -- The Document Object Model API: xml dom -- The Document Object Model API.\n* xml.dom.minidom -- Minimal DOM implementation: xml dom minidom -- Minimal DOM implementation.\n* xml.dom.pulldom -- Support for building partial DOM trees: xml dom pulldom -- Support for building partial DOM trees.\n* xml.sax -- Support for SAX2 parsers: xml sax -- Support for SAX2 parsers.\n* xml.sax.handler -- Base classes for SAX handlers: xml sax handler -- Base classes for SAX handlers.\n* xml.sax.saxutils -- SAX Utilities: xml sax saxutils -- SAX Utilities.\n* xml.sax.xmlreader -- Interface for XML parsers: xml sax xmlreader -- Interface for XML parsers.\n* xml.parsers.expat -- Fast XML parsing using Expat: xml parsers expat -- Fast XML parsing using Expat.\n\nhtml.parser -- Simple HTML and XHTML parser\n\n* Example HTML Parser Application::\n* HTMLParser Methods::\n* Examples: Examples<23>.\n\nXML Processing Modules\n\n* XML vulnerabilities::\n* The defusedxml Package::\n\nxml.etree.ElementTree -- The ElementTree XML API\n\n* Tutorial: Tutorial<2>.\n* XPath support::\n* Reference: Reference<3>.\n* XInclude support::\n* Reference: Reference<4>.\n",
            "subsections": []
        },
        "Tutorial": {
            "content": "........\n",
            "subsections": []
        },
        "Objects in the DOM": {
            "content": "* DOMImplementation Objects::\n* Node Objects::\n* NodeList Objects::\n* DocumentType Objects::\n* Document Objects::\n* Element Objects: Element Objects<2>.\n* Attr Objects::\n* NamedNodeMap Objects::\n* Comment Objects::\n* Text and CDATASection Objects::\n* ProcessingInstruction Objects::\n* Exceptions: Exceptions<18>.\n",
            "subsections": []
        },
        "Conformance": {
            "content": "* Type Mapping::\n* Accessor Methods::\n\nxml.dom.minidom -- Minimal DOM implementation\n\n* DOM Objects::\n* DOM Example::\n* minidom and the DOM standard::\n\nxml.dom.pulldom -- Support for building partial DOM trees\n\n* DOMEventStream Objects::\n\nxml.sax -- Support for SAX2 parsers\n\n* SAXException Objects::\n\nxml.sax.handler -- Base classes for SAX handlers\n\n* ContentHandler Objects::\n* DTDHandler Objects::\n* EntityResolver Objects::\n* ErrorHandler Objects::\n* LexicalHandler Objects::\n\nxml.sax.xmlreader -- Interface for XML parsers\n\n* XMLReader Objects::\n* IncrementalParser Objects::\n* Locator Objects::\n* InputSource Objects::\n* The Attributes Interface::\n* The AttributesNS Interface::\n\nxml.parsers.expat -- Fast XML parsing using Expat\n\n* XMLParser Objects: XMLParser Objects<2>.\n* ExpatError Exceptions::\n* Example: Example<11>.\n* Content Model Descriptions::\n* Expat error constants::\n",
            "subsections": []
        },
        "Internet Protocols and Support": {
            "content": "* webbrowser -- Convenient web-browser controller::\n* wsgiref -- WSGI Utilities and Reference Implementation::\n* urllib -- URL handling modules::\n* urllib.request -- Extensible library for opening URLs: urllib request -- Extensible library for opening URLs.\n* urllib.response -- Response classes used by urllib: urllib response -- Response classes used by urllib.\n* urllib.parse -- Parse URLs into components: urllib parse -- Parse URLs into components.\n* urllib.error -- Exception classes raised by urllib.request: urllib error -- Exception classes raised by urllib request.\n* urllib.robotparser -- Parser for robots.txt: urllib robotparser -- Parser for robots txt.\n* http -- HTTP modules::\n* http.client -- HTTP protocol client: http client -- HTTP protocol client.\n* ftplib -- FTP protocol client::\n* poplib -- POP3 protocol client::\n* imaplib -- IMAP4 protocol client::\n* smtplib -- SMTP protocol client::\n* uuid -- UUID objects according to RFC 4122::\n* socketserver -- A framework for network servers::\n* http.server -- HTTP servers: http server -- HTTP servers.\n* http.cookies -- HTTP state management: http cookies -- HTTP state management.\n* http.cookiejar -- Cookie handling for HTTP clients: http cookiejar -- Cookie handling for HTTP clients.\n* xmlrpc -- XMLRPC server and client modules::\n* xmlrpc.client -- XML-RPC client access: xmlrpc client -- XML-RPC client access.\n* xmlrpc.server -- Basic XML-RPC servers: xmlrpc server -- Basic XML-RPC servers.\n* ipaddress -- IPv4/IPv6 manipulation library::\n\nwebbrowser -- Convenient web-browser controller\n\n* Browser Controller Objects::\n\nwsgiref -- WSGI Utilities and Reference Implementation\n\n* wsgiref.util - WSGI environment utilities: wsgiref util - WSGI environment utilities.\n* wsgiref.headers - WSGI response header tools: wsgiref headers - WSGI response header tools.\n* wsgiref.simpleserver - a simple WSGI HTTP server: wsgiref simpleserver - a simple WSGI HTTP server.\n* wsgiref.validate -- WSGI conformance checker: wsgiref validate -- WSGI conformance checker.\n* wsgiref.handlers - server/gateway base classes: wsgiref handlers - server/gateway base classes.\n* wsgiref.types - WSGI types for static type checking: wsgiref types - WSGI types for static type checking.\n* Examples: Examples<24>.\n\nurllib.request -- Extensible library for opening URLs\n\n* Request Objects::\n* OpenerDirector Objects::\n* BaseHandler Objects::\n* HTTPRedirectHandler Objects::\n* HTTPCookieProcessor Objects::\n* ProxyHandler Objects::\n* HTTPPasswordMgr Objects::\n* HTTPPasswordMgrWithPriorAuth Objects::\n* AbstractBasicAuthHandler Objects::\n* HTTPBasicAuthHandler Objects::\n* ProxyBasicAuthHandler Objects::\n* AbstractDigestAuthHandler Objects::\n* HTTPDigestAuthHandler Objects::\n* ProxyDigestAuthHandler Objects::\n* HTTPHandler Objects::\n* HTTPSHandler Objects::\n* FileHandler Objects::\n* DataHandler Objects::\n* FTPHandler Objects::\n* CacheFTPHandler Objects::\n* UnknownHandler Objects::\n* HTTPErrorProcessor Objects::\n* Examples: Examples<25>.\n* Legacy interface::\n* urllib.request Restrictions: urllib request Restrictions.\n\nurllib.parse -- Parse URLs into components\n\n* URL Parsing::\n* URL parsing security::\n* Parsing ASCII Encoded Bytes::\n* Structured Parse Results::\n* URL Quoting::\n\nhttp -- HTTP modules\n\n* HTTP status codes::\n* HTTP status category::\n* HTTP methods::\n\nhttp.client -- HTTP protocol client\n\n* HTTPConnection Objects::\n* HTTPResponse Objects::\n* Examples: Examples<26>.\n* HTTPMessage Objects::\n\nftplib -- FTP protocol client\n\n* Reference: Reference<5>.\n",
            "subsections": []
        },
        "SimpleXMLRPCServer Objects": {
            "content": "* SimpleXMLRPCServer Example::\n\nipaddress -- IPv4/IPv6 manipulation library\n\n* Convenience factory functions::\n* IP Addresses::\n* IP Network definitions::\n* Interface objects::\n* Other Module Level Functions::\n* Custom Exceptions::\n\nIP Addresses\n\n* Address objects::\n* Conversion to Strings and Integers::\n* Operators: Operators<3>.\n",
            "subsections": []
        },
        "Operators": {
            "content": "* Logical operators: Logical operators<2>.\n",
            "subsections": []
        },
        "Interface objects": {
            "content": "* Operators: Operators<5>.\n",
            "subsections": []
        },
        "Multimedia Services": {
            "content": "* wave -- Read and write WAV files::\n* colorsys -- Conversions between color systems::\n\nwave -- Read and write WAV files\n\n* Waveread Objects::\n* Wavewrite Objects::\n",
            "subsections": []
        },
        "Internationalization": {
            "content": "* gettext -- Multilingual internationalization services::\n* locale -- Internationalization services::\n\ngettext -- Multilingual internationalization services\n\n* GNU gettext API::\n* Class-based API::\n* Internationalizing your programs and modules::\n* Acknowledgements: Acknowledgements<9>.\n",
            "subsections": []
        },
        "Class-based API": {
            "content": "* The NullTranslations class::\n* The GNUTranslations class::\n* Solaris message catalog support::\n* The Catalog constructor::\n",
            "subsections": []
        },
        "Internationalizing your programs and modules": {
            "content": "* Localizing your module::\n* Localizing your application::\n* Changing languages on the fly::\n* Deferred translations::\n\nlocale -- Internationalization services\n\n* Background, details, hints, tips and caveats: Background details hints tips and caveats.\n* For extension writers and programs that embed Python::\n* Access to message catalogs::\n",
            "subsections": []
        },
        "Program Frameworks": {
            "content": "* turtle -- Turtle graphics::\n* cmd -- Support for line-oriented command interpreters::\n* shlex -- Simple lexical analysis::\n\nturtle -- Turtle graphics\n\n* Introduction: Introduction<9>.\n* Tutorial: Tutorial<3>.\n* How to...::\n* Turtle graphics reference::\n* Methods of RawTurtle/Turtle and corresponding functions::\n* Methods of TurtleScreen/Screen and corresponding functions::\n* Public classes::\n* Explanation: Explanation<2>.\n* Help and configuration::\n* turtledemo -- Demo scripts::\n* Changes since Python 2.6: Changes since Python 2 6.\n* Changes since Python 3.0: Changes since Python 3 0.\n",
            "subsections": []
        },
        "Basic drawing": {
            "content": "* Pen control::\n* The turtle's position::\n\nHow to...\n\n* Get started as quickly as possible::\n* Use the turtle module namespace::\n* Use turtle graphics in a script::\n* Use object-oriented turtle graphics::\n",
            "subsections": []
        },
        "Turtle graphics reference": {
            "content": "* Turtle methods::\n* Methods of TurtleScreen/Screen::\n",
            "subsections": []
        },
        "Methods of RawTurtle/Turtle and corresponding functions": {
            "content": "* Turtle motion::\n* Tell Turtle's state::\n* Settings for measurement::\n* Pen control: Pen control<2>.\n* Turtle state::\n* Using events::\n* Special Turtle methods::\n* Compound shapes::\n",
            "subsections": []
        },
        "Pen control": {
            "content": "Drawing state\n\n*note pendown(): 39d0. | *note pd(): 39d1. | *note down(): 39d2.\n*note penup(): 39d3. | *note pu(): 39d4. | *note up(): 39d5.\n*note pensize(): 39d6. | *note width(): 39d7.\n*note pen(): 39d8.\n*note isdown(): 39d9.\n\nColor control\n\n*note color(): 39da.\n*note pencolor(): 39db.\n*note fillcolor(): 39dc.\n\nFilling\n\n*note filling(): 39dd.\n*note beginfill(): 39de.\n*note endfill(): 39df.\n\nMore drawing control\n\n*note reset(): 39e0.\n*note clear(): 39e1.\n*note write(): 39e2.\n",
            "subsections": []
        },
        "Turtle state": {
            "content": "Visibility\n\n*note showturtle(): 39e3. | *note st(): 39e4.\n*note hideturtle(): 39e5. | *note ht(): 39e6.\n*note isvisible(): 39e7.\n\nAppearance\n\n*note shape(): 39e8.\n*note resizemode(): 39e9.\n*note shapesize(): 39ea. | *note turtlesize(): 39eb.\n*note shearfactor(): 39ec.\n*note settiltangle(): 504.\n*note tiltangle(): 505.\n*note tilt(): 39ed.\n*note shapetransform(): 39ee.\n*note getshapepoly(): 39ef.\n",
            "subsections": []
        },
        "Methods of TurtleScreen/Screen and corresponding functions": {
            "content": "* Window control::\n* Animation control::\n* Using screen events::\n* Input methods::\n* Settings and special methods::\n* Methods specific to Screen, not inherited from TurtleScreen: Methods specific to Screen not inherited from TurtleScreen.\n",
            "subsections": []
        },
        "Help and configuration": {
            "content": "* How to use help::\n* Translation of docstrings into different languages::\n* How to configure Screen and Turtles::\n\ncmd -- Support for line-oriented command interpreters\n\n* Cmd Objects::\n* Cmd Example::\n\nshlex -- Simple lexical analysis\n\n* shlex Objects::\n* Parsing Rules::\n* Improved Compatibility with Shells::\n",
            "subsections": []
        },
        "Graphical User Interfaces with Tk": {
            "content": "* tkinter -- Python interface to Tcl/Tk::\n* tkinter.colorchooser -- Color choosing dialog: tkinter colorchooser -- Color choosing dialog.\n* tkinter.font -- Tkinter font wrapper: tkinter font -- Tkinter font wrapper.\n* Tkinter Dialogs::\n* tkinter.messagebox -- Tkinter message prompts: tkinter messagebox -- Tkinter message prompts.\n* tkinter.scrolledtext -- Scrolled Text Widget: tkinter scrolledtext -- Scrolled Text Widget.\n* tkinter.dnd -- Drag and drop support: tkinter dnd -- Drag and drop support.\n* tkinter.ttk -- Tk themed widgets: tkinter ttk -- Tk themed widgets.\n* tkinter.tix -- Extension widgets for Tk: tkinter tix -- Extension widgets for Tk.\n* IDLE: IDLE<57>.\n\ntkinter -- Python interface to Tcl/Tk\n\n* Architecture::\n* Tkinter Modules::\n* Tkinter Life Preserver::\n* Threading model::\n* Handy Reference::\n* File Handlers::\n",
            "subsections": []
        },
        "Tkinter Life Preserver": {
            "content": "* A Hello World Program::\n* Important Tk Concepts::\n* Understanding How Tkinter Wraps Tcl/Tk::\n* How do I...? What option does...?::\n* Navigating the Tcl/Tk Reference Manual::\n",
            "subsections": []
        },
        "Handy Reference": {
            "content": "* Setting Options::\n* The Packer::\n* Packer Options::\n* Coupling Widget Variables::\n* The Window Manager::\n* Tk Option Data Types::\n* Bindings and Events::\n* The index Parameter::\n* Images::\n",
            "subsections": []
        },
        "Tkinter Dialogs": {
            "content": "* tkinter.simpledialog -- Standard Tkinter input dialogs: tkinter simpledialog -- Standard Tkinter input dialogs.\n* tkinter.filedialog -- File selection dialogs: tkinter filedialog -- File selection dialogs.\n* tkinter.commondialog -- Dialog window templates: tkinter commondialog -- Dialog window templates.\n\ntkinter.filedialog -- File selection dialogs\n\n* Native Load/Save Dialogs::\n\ntkinter.ttk -- Tk themed widgets\n\n* Using Ttk::\n* Ttk Widgets::\n* Widget::\n* Combobox::\n* Spinbox::\n* Notebook::\n* Progressbar::\n* Separator::\n* Sizegrip::\n* Treeview::\n* Ttk Styling::\n",
            "subsections": []
        },
        "Widget": {
            "content": "* Standard Options::\n* Scrollable Widget Options::\n* Label Options::\n* Compatibility Options::\n* Widget States::\n* ttk.Widget: ttk Widget.\n",
            "subsections": []
        },
        "Combobox": {
            "content": "* Options::\n* Virtual events::\n* ttk.Combobox: ttk Combobox.\n",
            "subsections": []
        },
        "Spinbox": {
            "content": "* Options: Options<2>.\n* Virtual events: Virtual events<2>.\n* ttk.Spinbox: ttk Spinbox.\n",
            "subsections": []
        },
        "Notebook": {
            "content": "* Options: Options<3>.\n* Tab Options::\n* Tab Identifiers::\n* Virtual Events::\n* ttk.Notebook: ttk Notebook.\n",
            "subsections": []
        },
        "Progressbar": {
            "content": "* Options: Options<4>.\n* ttk.Progressbar: ttk Progressbar.\n",
            "subsections": []
        },
        "Separator": {
            "content": "* Options: Options<5>.\n",
            "subsections": []
        },
        "Sizegrip": {
            "content": "* Platform-specific notes::\n* Bugs::\n",
            "subsections": []
        },
        "Treeview": {
            "content": "* Options: Options<6>.\n* Item Options::\n* Tag Options::\n* Column Identifiers::\n* Virtual Events: Virtual Events<2>.\n* ttk.Treeview: ttk Treeview.\n",
            "subsections": []
        },
        "Ttk Styling": {
            "content": "* Layouts::\n\ntkinter.tix -- Extension widgets for Tk\n\n* Using Tix::\n* Tix Widgets::\n* Tix Commands::\n",
            "subsections": []
        },
        "Tix Widgets": {
            "content": "* Basic Widgets::\n* File Selectors::\n* Hierarchical ListBox::\n* Tabular ListBox::\n* Manager Widgets::\n* Image Types::\n* Miscellaneous Widgets::\n* Form Geometry Manager::\n",
            "subsections": []
        },
        "IDLE": {
            "content": "An Integrated Development and Learning Environment for Python.\n*note IDLE: e8a. is a basic editor and interpreter environment\nwhich ships with the standard distribution of Python.\n\nimmutable\n\nAn object with a fixed value.  Immutable objects include numbers,\nstrings and tuples.  Such an object cannot be altered.  A new\nobject has to be created if a different value has to be stored.\nThey play an important role in places where a constant hash value\nis needed, for example as a key in a dictionary.\n\nimport path\n\nA list of locations (or *note path entries: 1d12.) that are\nsearched by the *note path based finder: 1d01. for modules to\nimport.  During import, this list of locations usually comes from\n*note sys.path: 32c, but for subpackages it may also come from the\nparent package's 'path' attribute.\n\nimporting\n\nThe process by which Python code in one module is made available to\nPython code in another module.\n\nimporter\n\nAn object that both finds and loads a module; both a *note finder:\n1cfc. and *note loader: 13e6. object.\n\ninteractive\n\nPython has an interactive interpreter which means you can enter\nstatements and expressions at the interpreter prompt, immediately\nexecute them and see their results.  Just launch 'python' with no\narguments (possibly by selecting it from your computer's main\nmenu).  It is a very powerful way to test out new ideas or inspect\nmodules and packages (remember 'help(x)').\n\ninterpreted\n\nPython is an interpreted language, as opposed to a compiled one,\nthough the distinction can be blurry because of the presence of the\nbytecode compiler.  This means that source files can be run\ndirectly without explicitly creating an executable which is then\nrun.  Interpreted languages typically have a shorter\ndevelopment/debug cycle than compiled ones, though their programs\ngenerally also run more slowly.  See also *note interactive: 4eda.\n\ninterpreter shutdown\n\nWhen asked to shut down, the Python interpreter enters a special\nphase where it gradually releases all allocated resources, such as\nmodules and various critical internal structures.  It also makes\nseveral calls to the *note garbage collector: 167e.  This can\ntrigger the execution of code in user-defined destructors or\nweakref callbacks.  Code executed during the shutdown phase can\nencounter various exceptions as the resources it relies on may not\nfunction anymore (common examples are library modules or the\nwarnings machinery).\n\nThe main reason for interpreter shutdown is that the 'main'\nmodule or the script being run has finished executing.\n\niterable\n\nAn object capable of returning its members one at a time.  Examples\nof iterables include all sequence types (such as *note list: 3dc,\n*note str: 157, and *note tuple: 4b8.) and some non-sequence types\nlike *note dict: 237, *note file objects: 1037, and objects of any\nclasses you define with an *note iter(): 1a48. method or with a\n*note getitem(): 4b9. method that implements *note sequence:\n236. semantics.\n\nIterables can be used in a *note for: 24e. loop and in many other\nplaces where a sequence is needed (*note zip(): 5c2, *note map():\n65f, ...).  When an iterable object is passed as an argument to the\nbuilt-in function *note iter(): 5ca, it returns an iterator for the\nobject.  This iterator is good for one pass over the set of values.\nWhen using iterables, it is usually not necessary to call *note\niter(): 5ca. or deal with iterator objects yourself.  The *note\nfor: 24e. statement does that automatically for you, creating a\ntemporary unnamed variable to hold the iterator for the duration of\nthe loop.  See also *note iterator: 16a9, *note sequence: 236, and\n*note generator: eda.\n\niterator\n\nAn object representing a stream of data.  Repeated calls to the\niterator's *note next(): 1141. method (or passing it to the\nbuilt-in function *note next(): 5cb.) return successive items in\nthe stream.  When no more data are available a *note StopIteration:\na40. exception is raised instead.  At this point, the iterator\nobject is exhausted and any further calls to its 'next()'\nmethod just raise *note StopIteration: a40. again.  Iterators are\nrequired to have an *note iter(): 1a48. method that returns the\niterator object itself so every iterator is also iterable and may\nbe used in most places where other iterables are accepted.  One\nnotable exception is code which attempts multiple iteration passes.\nA container object (such as a *note list: 3dc.) produces a fresh\nnew iterator each time you pass it to the *note iter(): 5ca.\nfunction or use it in a *note for: 24e. loop.  Attempting this with\nan iterator will just return the same exhausted iterator object\nused in the previous iteration pass, making it appear like an empty\ncontainer.\n\nMore information can be found in *note Iterator Types: 1e7e.\n\n'CPython implementation detail:' CPython does not consistently\napply the requirement that an iterator define *note iter():\n1a48.\n\nkey function\n\nA key function or collation function is a callable that returns a\nvalue used for sorting or ordering.  For example, *note\nlocale.strxfrm(): 3984. is used to produce a sort key that is aware\nof locale specific sort conventions.\n\nA number of tools in Python accept key functions to control how\nelements are ordered or grouped.  They include *note min(): d6f,\n*note max(): d70, *note sorted(): a12, *note list.sort(): a13,\n*note heapq.merge(): c61, *note heapq.nsmallest(): 223a, *note\nheapq.nlargest(): 2239, and *note itertools.groupby(): 242a.\n\nThere are several ways to create a key function.  For example.  the\n*note str.lower(): 154a. method can serve as a key function for\ncase insensitive sorts.  Alternatively, a key function can be built\nfrom a *note lambda: 1115. expression such as 'lambda r: (r[0],\nr[2])'.  Also, *note operator.attrgetter(): c92, *note\noperator.itemgetter(): 88f, and *note operator.methodcaller(): c93.\nare three key function constructors.  See the *note Sorting HOW TO:\n1e89. for examples of how to create and use key functions.\n\nkeyword argument\n\nSee *note argument: 154.\n\nlambda\n\nAn anonymous inline function consisting of a single *note\nexpression: 1c8d. which is evaluated when the function is called.\nThe syntax to create a lambda function is 'lambda [parameters]:\nexpression'\n",
            "subsections": []
        },
        "Menus": {
            "content": "* File menu (Shell and Editor): File menu Shell and Editor.\n* Edit menu (Shell and Editor): Edit menu Shell and Editor.\n* Format menu (Editor window only): Format menu Editor window only.\n* Run menu (Editor window only): Run menu Editor window only.\n* Shell menu (Shell window only): Shell menu Shell window only.\n* Debug menu (Shell window only): Debug menu Shell window only.\n* Options menu (Shell and Editor): Options menu Shell and Editor.\n* Window menu (Shell and Editor): Window menu Shell and Editor.\n* Help menu (Shell and Editor): Help menu Shell and Editor.\n* Context menus::\n",
            "subsections": []
        },
        "Editing and Navigation": {
            "content": "* Editor windows::\n* Key bindings::\n* Automatic indentation::\n* Search and Replace::\n* Completions::\n* Calltips::\n* Code Context::\n* Shell window::\n* Text colors::\n",
            "subsections": []
        },
        "Startup and Code Execution": {
            "content": "* Command line usage::\n* Startup failure::\n* Running user code::\n* User output in Shell::\n* Developing tkinter applications::\n* Running without a subprocess::\n",
            "subsections": []
        },
        "Help and Preferences": {
            "content": "* Help sources::\n* Setting preferences::\n* IDLE on macOS::\n* Extensions::\n",
            "subsections": []
        },
        "Development Tools": {
            "content": "* typing -- Support for type hints::\n* pydoc -- Documentation generator and online help system::\n* Python Development Mode::\n* doctest -- Test interactive Python examples::\n* unittest -- Unit testing framework::\n* unittest.mock -- mock object library: unittest mock -- mock object library.\n* unittest.mock -- getting started: unittest mock -- getting started.\n* 2to3 -- Automated Python 2 to 3 code translation::\n* test -- Regression tests package for Python::\n* test.support -- Utilities for the Python test suite: test support -- Utilities for the Python test suite.\n* test.support.sockethelper -- Utilities for socket tests: test support sockethelper -- Utilities for socket tests.\n* test.support.scripthelper -- Utilities for the Python execution tests: test support scripthelper -- Utilities for the Python execution tests.\n* test.support.bytecodehelper -- Support tools for testing correct bytecode generation: test support bytecodehelper -- Support tools for testing correct bytecode generation.\n* test.support.threadinghelper -- Utilities for threading tests: test support threadinghelper -- Utilities for threading tests.\n* test.support.oshelper -- Utilities for os tests: test support oshelper -- Utilities for os tests.\n* test.support.importhelper -- Utilities for import tests: test support importhelper -- Utilities for import tests.\n* test.support.warningshelper -- Utilities for warnings tests: test support warningshelper -- Utilities for warnings tests.\n\ntyping -- Support for type hints\n\n* Specification for the Python Type System::\n* Type aliases::\n* NewType::\n* Annotating callable objects::\n* Generics::\n* Annotating tuples::\n* The type of class objects::\n* User-defined generic types::\n* The Any type::\n* Nominal vs structural subtyping::\n* Module contents: Module contents<3>.\n* Deprecation Timeline of Major Features::\n",
            "subsections": []
        },
        "Special typing primitives": {
            "content": "* Special types::\n* Special forms::\n* Building generic types and type aliases::\n* Other special directives::\n",
            "subsections": []
        },
        "Deprecated aliases": {
            "content": "* Aliases to built-in types::\n* Aliases to types in collections::\n* Aliases to other concrete types::\n* Aliases to container ABCs in collections.abc: Aliases to container ABCs in collections abc.\n* Aliases to asynchronous ABCs in collections.abc: Aliases to asynchronous ABCs in collections abc.\n* Aliases to other ABCs in collections.abc: Aliases to other ABCs in collections abc.\n* Aliases to contextlib ABCs::\n",
            "subsections": []
        },
        "Python Development Mode": {
            "content": "* Effects of the Python Development Mode::\n* ResourceWarning Example::\n* Bad file descriptor error example::\n\ndoctest -- Test interactive Python examples\n\n* Simple Usage; Checking Examples in Docstrings: Simple Usage Checking Examples in Docstrings.\n* Simple Usage; Checking Examples in a Text File: Simple Usage Checking Examples in a Text File.\n* How It Works::\n* Basic API::\n* Unittest API::\n* Advanced API::\n* Debugging::\n* Soapbox::\n\nHow It Works\n\n* Which Docstrings Are Examined?::\n* How are Docstring Examples Recognized?::\n* What's the Execution Context?::\n* What About Exceptions?::\n* Option Flags::\n* Directives::\n* Warnings: Warnings<2>.\n",
            "subsections": []
        },
        "Advanced API": {
            "content": "* DocTest Objects::\n* Example Objects::\n* DocTestFinder objects::\n* DocTestParser objects::\n* DocTestRunner objects::\n* OutputChecker objects::\n\nunittest -- Unit testing framework\n\n* Basic example::\n* Command-Line Interface: Command-Line Interface<3>.\n* Test Discovery::\n* Organizing test code::\n* Re-using old test code::\n* Skipping tests and expected failures::\n* Distinguishing test iterations using subtests::\n* Classes and functions::\n* Class and Module Fixtures::\n* Signal Handling::\n",
            "subsections": []
        },
        "Classes and functions": {
            "content": "* Test cases::\n* Grouping tests::\n* Loading and running tests::\n",
            "subsections": []
        },
        "Loading and running tests": {
            "content": "* loadtests Protocol::\n",
            "subsections": []
        },
        "Class and Module Fixtures": {
            "content": "* setUpClass and tearDownClass::\n* setUpModule and tearDownModule::\n\nunittest.mock -- mock object library\n\n* Quick Guide::\n* The Mock Class::\n* The patchers::\n* MagicMock and magic method support::\n* Helpers::\n* Order of precedence of sideeffect, returnvalue and wraps: Order of precedence of sideeffect returnvalue and wraps.\n\nThe Mock Class\n\n* Calling::\n* Deleting Attributes::\n* Mock names and the name attribute::\n* Attaching Mocks as Attributes::\n",
            "subsections": []
        },
        "The patchers": {
            "content": "* patch::\n* patch.object: patch object.\n* patch.dict: patch dict.\n* patch.multiple: patch multiple.\n* patch methods; start and stop: patch methods start and stop.\n* patch builtins::\n* TESTPREFIX::\n* Nesting Patch Decorators::\n* Where to patch::\n* Patching Descriptors and Proxy Objects::\n",
            "subsections": []
        },
        "MagicMock and magic method support": {
            "content": "* Mocking Magic Methods::\n* Magic Mock::\n",
            "subsections": []
        },
        "Helpers": {
            "content": "* sentinel::\n* DEFAULT::\n* call::\n* createautospec::\n* ANY::\n* FILTERDIR::\n* mockopen::\n* Autospeccing::\n* Sealing mocks::\n\nunittest.mock -- getting started\n\n* Using Mock::\n* Patch Decorators::\n* Further Examples::\n",
            "subsections": []
        },
        "Using Mock": {
            "content": "* Mock Patching Methods::\n* Mock for Method Calls on an Object::\n* Mocking Classes::\n* Naming your mocks::\n* Tracking all Calls::\n* Setting Return Values and Attributes::\n* Raising exceptions with mocks::\n* Side effect functions and iterables::\n* Mocking asynchronous iterators::\n* Mocking asynchronous context manager::\n* Creating a Mock from an Existing Object::\n* Using sideeffect to return per file content::\n",
            "subsections": []
        },
        "Further Examples": {
            "content": "* Mocking chained calls::\n* Partial mocking::\n* Mocking a Generator Method::\n* Applying the same patch to every test method::\n* Mocking Unbound Methods::\n* Checking multiple calls with mock::\n* Coping with mutable arguments::\n* Nesting Patches::\n* Mocking a dictionary with MagicMock::\n* Mock subclasses and their attributes::\n* Mocking imports with patch.dict: Mocking imports with patch dict.\n* Tracking order of calls and less verbose call assertions::\n* More complex argument matching::\n\n2to3 -- Automated Python 2 to 3 code translation\n\n* Using 2to3::\n* Fixers::\n* lib2to3 -- 2to3's library::\n\ntest -- Regression tests package for Python\n\n* Writing Unit Tests for the test package::\n* Running tests using the command-line interface::\n",
            "subsections": []
        },
        "Debugging and Profiling": {
            "content": "* Audit events table::\n* bdb -- Debugger framework::\n* faulthandler -- Dump the Python traceback::\n* pdb -- The Python Debugger::\n* The Python Profilers::\n* timeit -- Measure execution time of small code snippets::\n* trace -- Trace or track Python statement execution::\n* tracemalloc -- Trace memory allocations::\n\nfaulthandler -- Dump the Python traceback\n\n* Dumping the traceback::\n* Fault handler state::\n* Dumping the tracebacks after a timeout::\n* Dumping the traceback on a user signal::\n* Issue with file descriptors::\n* Example: Example<14>.\n\npdb -- The Python Debugger\n\n* Debugger Commands::\n",
            "subsections": []
        },
        "The Python Profilers": {
            "content": "* Introduction to the profilers::\n* Instant User's Manual::\n* profile and cProfile Module Reference::\n* The Stats Class::\n* What Is Deterministic Profiling?::\n* Limitations::\n* Calibration::\n* Using a custom timer::\n\ntimeit -- Measure execution time of small code snippets\n\n* Basic Examples: Basic Examples<2>.\n* Python Interface::\n* Command-Line Interface: Command-Line Interface<4>.\n* Examples: Examples<29>.\n\ntrace -- Trace or track Python statement execution\n\n* Command-Line Usage: Command-Line Usage<3>.\n* Programmatic Interface::\n",
            "subsections": []
        },
        "Command-Line Usage": {
            "content": "* Main options::\n* Modifiers::\n* Filters::\n\ntracemalloc -- Trace memory allocations\n\n* Examples: Examples<30>.\n* API::\n",
            "subsections": []
        },
        "Pretty top": {
            "content": "* Record the current and peak size of all traced memory blocks::\n",
            "subsections": []
        },
        "API": {
            "content": "* Functions: Functions<11>.\n* DomainFilter::\n* Filter::\n* Frame::\n* Snapshot::\n* Statistic::\n* StatisticDiff::\n* Trace::\n* Traceback::\n",
            "subsections": []
        },
        "Software Packaging and Distribution": {
            "content": "* ensurepip -- Bootstrapping the pip installer::\n* venv -- Creation of virtual environments::\n* zipapp -- Manage executable Python zip archives::\n\nensurepip -- Bootstrapping the pip installer\n\n* Command line interface::\n* Module API::\n\nvenv -- Creation of virtual environments\n\n* Creating virtual environments::\n* How venvs work::\n* API: API<2>.\n* An example of extending EnvBuilder::\n\nzipapp -- Manage executable Python zip archives\n\n* Basic Example::\n* Command-Line Interface: Command-Line Interface<5>.\n* Python API::\n* Examples: Examples<31>.\n* Specifying the Interpreter::\n* Creating Standalone Applications with zipapp::\n* The Python Zip Application Archive Format::\n",
            "subsections": []
        },
        "Creating Standalone Applications with zipapp": {
            "content": "* Caveats::\n",
            "subsections": []
        },
        "Python Runtime Services": {
            "content": "* sys -- System-specific parameters and functions::\n* sys.monitoring -- Execution event monitoring: sys monitoring -- Execution event monitoring.\n* sysconfig -- Provide access to Python's configuration information::\n* builtins -- Built-in objects::\n* main -- Top-level code environment::\n* warnings -- Warning control::\n* dataclasses -- Data Classes::\n* contextlib -- Utilities for with-statement contexts::\n* abc -- Abstract Base Classes::\n* atexit -- Exit handlers::\n* traceback -- Print or retrieve a stack traceback::\n* future -- Future statement definitions::\n* gc -- Garbage Collector interface::\n* inspect -- Inspect live objects::\n* site -- Site-specific configuration hook::\n\nsys.monitoring -- Execution event monitoring\n\n* Tool identifiers::\n* Events::\n* Turning events on and off::\n* Registering callback functions::\n",
            "subsections": []
        },
        "Tool identifiers": {
            "content": "* Registering and using tools::\n",
            "subsections": []
        },
        "Events": {
            "content": "* Local events::\n* Ancillary events::\n* Other events::\n* The STOPITERATION event::\n",
            "subsections": []
        },
        "Turning events on and off": {
            "content": "* Setting events globally::\n* Per code object events::\n* Disabling events::\n",
            "subsections": []
        },
        "Registering callback functions": {
            "content": "* Callback function arguments::\n\nsysconfig -- Provide access to Python's configuration information\n\n* Configuration variables::\n* Installation paths::\n* User scheme::\n* Home scheme::\n* Prefix scheme::\n* Installation path functions::\n* Other functions: Other functions<3>.\n* Using sysconfig as a script::\n",
            "subsections": []
        },
        "User scheme": {
            "content": "* posixuser::\n* ntuser::\n* osxframeworkuser::\n",
            "subsections": []
        },
        "Home scheme": {
            "content": "* posixhome::\n",
            "subsections": []
        },
        "Prefix scheme": {
            "content": "* posixprefix::\n* nt::\n\nmain -- Top-level code environment\n\n* name == 'main'::\n* main.py in Python Packages: main py in Python Packages.\n* import main::\n\nname == 'main'\n\n* What is the \"top-level code environment\"?::\n* Idiomatic Usage::\n* Packaging Considerations::\n\nmain.py in Python Packages\n\n* Idiomatic Usage: Idiomatic Usage<2>.\n\nwarnings -- Warning control\n\n* Warning Categories::\n* The Warnings Filter::\n* Temporarily Suppressing Warnings::\n* Testing Warnings::\n* Updating Code For New Versions of Dependencies::\n* Available Functions::\n* Available Context Managers::\n",
            "subsections": []
        },
        "The Warnings Filter": {
            "content": "* Describing Warning Filters::\n* Default Warning Filter::\n* Overriding the default filter::\n\ndataclasses -- Data Classes\n\n* Module contents: Module contents<4>.\n* Post-init processing::\n* Class variables::\n* Init-only variables::\n* Frozen instances::\n* Inheritance: Inheritance<2>.\n* Re-ordering of keyword-only parameters in init(): Re-ordering of keyword-only parameters in init.\n* Default factory functions::\n* Mutable default values::\n* Descriptor-typed fields::\n\ncontextlib -- Utilities for with-statement contexts\n\n* Utilities::\n* Examples and Recipes: Examples and Recipes<3>.\n* Single use, reusable and reentrant context managers: Single use reusable and reentrant context managers.\n",
            "subsections": []
        },
        "Single use, reusable and reentrant context managers": {
            "content": "* Reentrant context managers::\n* Reusable context managers::\n\natexit -- Exit handlers\n\n* atexit Example::\n\ntraceback -- Print or retrieve a stack traceback\n\n* TracebackException Objects::\n* StackSummary Objects::\n* FrameSummary Objects::\n* Traceback Examples::\n\nfuture -- Future statement definitions\n\n* Module Contents: Module Contents<5>.\n\ninspect -- Inspect live objects\n\n* Types and members::\n* Retrieving source code::\n* Introspecting callables with the Signature object::\n* Classes and functions: Classes and functions<2>.\n* The interpreter stack::\n* Fetching attributes statically::\n* Current State of Generators, Coroutines, and Asynchronous Generators: Current State of Generators Coroutines and Asynchronous Generators.\n* Code Objects Bit Flags::\n* Buffer flags::\n* Command Line Interface: Command Line Interface<3>.\n\nsite -- Site-specific configuration hook\n\n* sitecustomize::\n* usercustomize::\n* Readline configuration::\n* Module contents: Module contents<5>.\n* Command Line Interface: Command Line Interface<4>.\n",
            "subsections": []
        },
        "Custom Python Interpreters": {
            "content": "* code -- Interpreter base classes::\n* codeop -- Compile Python code::\n\ncode -- Interpreter base classes\n\n* Interactive Interpreter Objects::\n* Interactive Console Objects::\n",
            "subsections": []
        },
        "Importing Modules": {
            "content": "* zipimport -- Import modules from Zip archives::\n* pkgutil -- Package extension utility::\n* modulefinder -- Find modules used by a script::\n* runpy -- Locating and executing Python modules::\n* importlib -- The implementation of import::\n* importlib.resources - Package resource reading, opening and access: importlib resources - Package resource reading opening and access.\n* importlib.resources.abc - Abstract base classes for resources: importlib resources abc - Abstract base classes for resources.\n* importlib.metadata - Accessing package metadata: importlib metadata - Accessing package metadata.\n* The initialization of the sys.path module search path: The initialization of the sys path module search path.\n\nzipimport -- Import modules from Zip archives\n\n* zipimporter Objects::\n* Examples: Examples<32>.\n\nmodulefinder -- Find modules used by a script\n\n* Example usage of ModuleFinder::\n\nimportlib -- The implementation of import\n\n* Introduction: Introduction<10>.\n* Functions: Functions<12>.\n* importlib.abc - Abstract base classes related to import: importlib abc - Abstract base classes related to import.\n* importlib.machinery - Importers and path hooks: importlib machinery - Importers and path hooks.\n* importlib.util - Utility code for importers: importlib util - Utility code for importers.\n* Examples: Examples<33>.\n",
            "subsections": []
        },
        "Functional API": {
            "content": "* Entry points::\n* Distribution metadata::\n* Distribution versions::\n* Distribution files::\n* Distribution requirements::\n* Mapping import to distribution packages::\n",
            "subsections": []
        },
        "The initialization of the sys.path module search path": {
            "content": "* Virtual environments: Virtual environments<2>.\n* pth files::\n* Embedded Python::\n",
            "subsections": []
        },
        "Python Language Services": {
            "content": "* ast -- Abstract Syntax Trees::\n* symtable -- Access to the compiler's symbol tables::\n* token -- Constants used with Python parse trees::\n* keyword -- Testing for Python keywords::\n* tokenize -- Tokenizer for Python source::\n* tabnanny -- Detection of ambiguous indentation::\n* pyclbr -- Python module browser support::\n* pycompile -- Compile Python source files::\n* compileall -- Byte-compile Python libraries::\n* dis -- Disassembler for Python bytecode::\n* pickletools -- Tools for pickle developers::\n\nast -- Abstract Syntax Trees\n\n* Abstract Grammar::\n* Node classes::\n* ast Helpers::\n* Compiler Flags::\n* Command-Line Usage: Command-Line Usage<4>.\n",
            "subsections": []
        },
        "Node classes": {
            "content": "* Root nodes::\n* Literals: Literals<3>.\n* Variables::\n* Expressions: Expressions<2>.\n* Statements::\n* Control flow::\n* Pattern matching::\n* Type parameters::\n* Function and class definitions::\n* Async and await::\n",
            "subsections": []
        },
        "Statements": {
            "content": "* Imports::\n\nsymtable -- Access to the compiler's symbol tables\n\n* Generating Symbol Tables::\n* Examining Symbol Tables::\n\ntokenize -- Tokenizer for Python source\n\n* Tokenizing Input::\n* Command-Line Usage: Command-Line Usage<5>.\n* Examples: Examples<34>.\n\npyclbr -- Python module browser support\n\n* Function Objects::\n* Class Objects: Class Objects<2>.\n\npycompile -- Compile Python source files\n\n* Command-Line Interface: Command-Line Interface<6>.\n\ncompileall -- Byte-compile Python libraries\n\n* Command-line use::\n* Public functions::\n\ndis -- Disassembler for Python bytecode\n\n* Command-line interface: Command-line interface<2>.\n* Bytecode analysis::\n* Analysis functions::\n* Python Bytecode Instructions::\n* Opcode collections::\n\npickletools -- Tools for pickle developers\n\n* Command line usage: Command line usage<2>.\n* Programmatic Interface: Programmatic Interface<2>.\n",
            "subsections": []
        },
        "Command line usage": {
            "content": "* Command line options: Command line options<3>.\n\nMS Windows Specific Services\n\n* msvcrt -- Useful routines from the MS VC++ runtime::\n* winreg -- Windows registry access::\n* winsound -- Sound-playing interface for Windows::\n\nmsvcrt -- Useful routines from the MS VC++ runtime\n\n* File Operations::\n* Console I/O::\n* Other Functions::\n\nwinreg -- Windows registry access\n\n* Functions: Functions<13>.\n* Constants: Constants<10>.\n* Registry Handle Objects::\n",
            "subsections": []
        },
        "Constants": {
            "content": "* HKEY* Constants::\n* Access Rights::\n* Value Types::\n",
            "subsections": []
        },
        "Access Rights": {
            "content": "* 64-bit Specific::\n",
            "subsections": []
        },
        "Unix Specific Services": {
            "content": "* posix -- The most common POSIX system calls::\n* pwd -- The password database::\n* grp -- The group database::\n* termios -- POSIX style tty control::\n* tty -- Terminal control functions::\n* pty -- Pseudo-terminal utilities::\n* fcntl -- The fcntl and ioctl system calls::\n* resource -- Resource usage information::\n* syslog -- Unix syslog library routines::\n\nposix -- The most common POSIX system calls\n\n* Large File Support::\n* Notable Module Contents::\n\ntermios -- POSIX style tty control\n\n* Example: Example<15>.\n\npty -- Pseudo-terminal utilities\n\n* Example: Example<16>.\n\nresource -- Resource usage information\n\n* Resource Limits::\n* Resource Usage::\n\nsyslog -- Unix syslog library routines\n\n* Examples: Examples<35>.\n",
            "subsections": []
        },
        "Superseded Modules": {
            "content": "* aifc -- Read and write AIFF and AIFC files::\n* audioop -- Manipulate raw audio data::\n* cgi -- Common Gateway Interface support::\n* cgitb -- Traceback manager for CGI scripts::\n* chunk -- Read IFF chunked data::\n* crypt -- Function to check Unix passwords::\n* imghdr -- Determine the type of an image::\n* mailcap -- Mailcap file handling::\n* msilib -- Read and write Microsoft Installer files::\n* nis -- Interface to Sun's NIS (Yellow Pages): nis -- Interface to Sun's NIS Yellow Pages.\n* nntplib -- NNTP protocol client::\n* optparse -- Parser for command line options::\n* ossaudiodev -- Access to OSS-compatible audio devices::\n* pipes -- Interface to shell pipelines::\n* sndhdr -- Determine type of sound file::\n* spwd -- The shadow password database::\n* sunau -- Read and write Sun AU files::\n* telnetlib -- Telnet client::\n* uu -- Encode and decode uuencode files::\n* xdrlib -- Encode and decode XDR data::\n\ncgi -- Common Gateway Interface support\n\n* Introduction: Introduction<11>.\n* Using the cgi module::\n* Higher Level Interface::\n* Functions: Functions<14>.\n* Caring about security::\n* Installing your CGI script on a Unix system::\n* Testing your CGI script::\n* Debugging CGI scripts::\n* Common problems and solutions::\n\ncrypt -- Function to check Unix passwords\n\n* Hashing Methods::\n* Module Attributes::\n* Module Functions: Module Functions<2>.\n* Examples: Examples<36>.\n\nmsilib -- Read and write Microsoft Installer files\n\n* Database Objects::\n* View Objects::\n* Summary Information Objects::\n* Record Objects::\n* Errors::\n* CAB Objects::\n* Directory Objects::\n* Features: Features<3>.\n* GUI classes::\n* Precomputed tables::\n\nnntplib -- NNTP protocol client\n\n* NNTP Objects::\n* Utility functions: Utility functions<2>.\n\nNNTP Objects\n\n* Attributes: Attributes<2>.\n* Methods: Methods<3>.\n\noptparse -- Parser for command line options\n\n* Background::\n* Tutorial: Tutorial<4>.\n* Reference Guide::\n* Option Callbacks::\n* Extending optparse::\n* Exceptions: Exceptions<19>.\n",
            "subsections": []
        },
        "Background": {
            "content": "* Enter Per-Module State::\n* Isolated Module Objects::\n* Surprising Edge Cases::\n",
            "subsections": []
        },
        "Generating help": {
            "content": "* Grouping Options::\n",
            "subsections": []
        },
        "Reference Guide": {
            "content": "* Creating the parser::\n* Populating the parser::\n* Defining options::\n* Option attributes::\n* Standard option actions::\n* Standard option types::\n* Parsing arguments: Parsing arguments<2>.\n* Querying and manipulating your option parser::\n* Conflicts between options::\n* Cleanup: Cleanup<2>.\n* Other methods::\n",
            "subsections": []
        },
        "Option Callbacks": {
            "content": "* Defining a callback option::\n* How callbacks are called::\n* Raising errors in a callback::\n* Callback example 1; trivial callback: Callback example 1 trivial callback.\n* Callback example 2; check option order: Callback example 2 check option order.\n* Callback example 3; check option order (generalized): Callback example 3 check option order generalized.\n* Callback example 4; check arbitrary condition: Callback example 4 check arbitrary condition.\n* Callback example 5; fixed arguments: Callback example 5 fixed arguments.\n* Callback example 6; variable arguments: Callback example 6 variable arguments.\n",
            "subsections": []
        },
        "Extending optparse": {
            "content": "* Adding new types::\n* Adding new actions::\n\nossaudiodev -- Access to OSS-compatible audio devices\n\n* Audio Device Objects::\n* Mixer Device Objects::\n\npipes -- Interface to shell pipelines\n\n* Template Objects::\n\nsunau -- Read and write Sun AU files\n\n* AUread Objects::\n* AUwrite Objects::\n\ntelnetlib -- Telnet client\n\n* Telnet Objects::\n* Telnet Example::\n\nxdrlib -- Encode and decode XDR data\n\n* Packer Objects::\n* Unpacker Objects::\n* Exceptions: Exceptions<20>.\n",
            "subsections": []
        },
        "Extending and Embedding the Python Interpreter": {
            "content": "* Recommended third party tools::\n* Creating extensions without third party tools::\n* Embedding the CPython runtime in a larger application::\n",
            "subsections": []
        },
        "Creating extensions without third party tools": {
            "content": "* Extending Python with C or C++::\n* Defining Extension Types; Tutorial: Defining Extension Types Tutorial.\n* Defining Extension Types; Assorted Topics: Defining Extension Types Assorted Topics.\n* Building C and C++ Extensions::\n* Building C and C++ Extensions on Windows::\n\nExtending Python with C or C++\n\n* A Simple Example::\n* Intermezzo; Errors and Exceptions: Intermezzo Errors and Exceptions.\n* Back to the Example::\n* The Module's Method Table and Initialization Function::\n* Compilation and Linkage::\n* Calling Python Functions from C::\n* Extracting Parameters in Extension Functions::\n* Keyword Parameters for Extension Functions::\n* Building Arbitrary Values::\n* Reference Counts::\n* Writing Extensions in C++::\n* Providing a C API for an Extension Module::\n",
            "subsections": []
        },
        "Reference Counts": {
            "content": "* Reference Count Details::\n\nC API Stability\n\n* Unstable C API::\n* Stable Application Binary Interface::\n* Platform Considerations::\n* Contents of Limited API::\n",
            "subsections": []
        },
        "Defining Extension Types: Tutorial": {
            "content": "* The Basics::\n* Adding data and methods to the Basic example::\n* Providing finer control over data attributes::\n* Supporting cyclic garbage collection::\n* Subclassing other types::\n",
            "subsections": []
        },
        "Defining Extension Types: Assorted Topics": {
            "content": "* Finalization and De-allocation::\n* Object Presentation::\n* Attribute Management::\n* Object Comparison::\n* Abstract Protocol Support::\n* Weak Reference Support::\n* More Suggestions::\n",
            "subsections": []
        },
        "Attribute Management": {
            "content": "* Generic Attribute Management::\n* Type-specific Attribute Management::\n\nBuilding C and C++ Extensions\n\n* Building C and C++ Extensions with setuptools::\n\nBuilding C and C++ Extensions on Windows\n\n* A Cookbook Approach::\n* Differences Between Unix and Windows::\n* Using DLLs in Practice::\n",
            "subsections": []
        },
        "Embedding the CPython runtime in a larger application": {
            "content": "* Embedding Python in Another Application::\n",
            "subsections": []
        },
        "Embedding Python in Another Application": {
            "content": "* Very High Level Embedding::\n* Beyond Very High Level Embedding; An overview: Beyond Very High Level Embedding An overview.\n* Pure Embedding::\n* Extending Embedded Python::\n* Embedding Python in C++::\n* Compiling and Linking under Unix-like systems::\n",
            "subsections": []
        },
        "Python/C API Reference Manual": {
            "content": "* Introduction: Introduction<12>.\n* C API Stability::\n* The Very High Level Layer::\n* Reference Counting::\n* Exception Handling::\n* Utilities: Utilities<2>.\n* Abstract Objects Layer::\n* Concrete Objects Layer::\n* Initialization, Finalization, and Threads: Initialization Finalization and Threads.\n* Python Initialization Configuration::\n* Memory Management::\n* Object Implementation Support::\n* API and ABI Versioning::\n",
            "subsections": []
        },
        "Objects, Types and Reference Counts": {
            "content": "* Reference Counts: Reference Counts<2>.\n* Types::\n",
            "subsections": []
        },
        "Stable Application Binary Interface": {
            "content": "* Limited C API::\n* Stable ABI::\n* Limited API Scope and Performance::\n* Limited API Caveats::\n",
            "subsections": []
        },
        "Exception Handling": {
            "content": "* Printing and clearing::\n* Raising exceptions::\n* Issuing warnings::\n* Querying the error indicator::\n* Signal Handling: Signal Handling<2>.\n* Exception Classes::\n* Exception Objects::\n* Unicode Exception Objects::\n* Recursion Control::\n* Standard Exceptions::\n* Standard Warning Categories::\n",
            "subsections": []
        },
        "Utilities": {
            "content": "* Operating System Utilities::\n* System Functions::\n* Process Control::\n* Importing Modules: Importing Modules<2>.\n* Data marshalling support::\n* Parsing arguments and building values::\n* String conversion and formatting::\n* PyHash API::\n* Reflection::\n* Codec registry and support functions::\n* Support for Perf Maps::\n",
            "subsections": []
        },
        "Parsing arguments and building values": {
            "content": "* Parsing arguments: Parsing arguments<3>.\n* Building values::\n",
            "subsections": []
        },
        "Parsing arguments": {
            "content": "* Strings and buffers::\n* Numbers: Numbers<2>.\n* Other objects::\n* API Functions::\n",
            "subsections": []
        },
        "Codec registry and support functions": {
            "content": "* Codec lookup API::\n* Registry API for Unicode encoding error handlers::\n",
            "subsections": []
        },
        "Abstract Objects Layer": {
            "content": "* Object Protocol::\n* Call Protocol::\n* Number Protocol::\n* Sequence Protocol::\n* Mapping Protocol::\n* Iterator Protocol::\n* Buffer Protocol::\n* Old Buffer Protocol::\n",
            "subsections": []
        },
        "Call Protocol": {
            "content": "* The tpcall Protocol::\n* The Vectorcall Protocol::\n* Object Calling API::\n* Call Support API::\n",
            "subsections": []
        },
        "The Vectorcall Protocol": {
            "content": "* Recursion Control: Recursion Control<2>.\n* Vectorcall Support API::\n",
            "subsections": []
        },
        "Buffer Protocol": {
            "content": "* Buffer structure::\n* Buffer request types::\n* Complex arrays::\n* Buffer-related functions::\n",
            "subsections": []
        },
        "Buffer request types": {
            "content": "* request-independent fields::\n* readonly, format: readonly format.\n* shape, strides, suboffsets: shape strides suboffsets.\n* contiguity requests::\n* compound requests::\n",
            "subsections": []
        },
        "Complex arrays": {
            "content": "* NumPy-style; shape and strides: NumPy-style shape and strides.\n* PIL-style; shape, strides and suboffsets: PIL-style shape strides and suboffsets.\n",
            "subsections": []
        },
        "Concrete Objects Layer": {
            "content": "* Fundamental Objects::\n* Numeric Objects::\n* Sequence Objects::\n* Container Objects::\n* Function Objects: Function Objects<2>.\n* Other Objects::\n",
            "subsections": []
        },
        "Fundamental Objects": {
            "content": "* Type Objects: Type Objects<2>.\n* The None Object::\n",
            "subsections": []
        },
        "Type Objects": {
            "content": "* Quick Reference::\n* PyTypeObject Definition::\n* PyObject Slots::\n* PyVarObject Slots::\n* PyTypeObject Slots::\n* Static Types::\n* Heap Types::\n",
            "subsections": []
        },
        "Numeric Objects": {
            "content": "* Integer Objects::\n* Boolean Objects::\n* Floating Point Objects::\n* Complex Number Objects::\n",
            "subsections": []
        },
        "Floating Point Objects": {
            "content": "* Pack and Unpack functions::\n",
            "subsections": []
        },
        "Pack and Unpack functions": {
            "content": "* Pack functions::\n* Unpack functions::\n",
            "subsections": []
        },
        "Complex Number Objects": {
            "content": "* Complex Numbers as C Structures::\n* Complex Numbers as Python Objects::\n",
            "subsections": []
        },
        "Sequence Objects": {
            "content": "* Bytes Objects: Bytes Objects<2>.\n* Byte Array Objects::\n* Unicode Objects and Codecs::\n* Tuple Objects::\n* Struct Sequence Objects::\n* List Objects::\n",
            "subsections": []
        },
        "Byte Array Objects": {
            "content": "* Type check macros::\n* Direct API functions::\n* Macros::\n",
            "subsections": []
        },
        "Unicode Objects and Codecs": {
            "content": "* Unicode Objects::\n* Built-in Codecs::\n* Methods and Slot Functions::\n",
            "subsections": []
        },
        "Unicode Objects": {
            "content": "* Unicode Type::\n* Unicode Character Properties::\n* Creating and accessing Unicode strings::\n* Locale Encoding::\n* File System Encoding::\n* wchart Support::\n",
            "subsections": []
        },
        "Built-in Codecs": {
            "content": "* Generic Codecs::\n* UTF-8 Codecs::\n* UTF-32 Codecs::\n* UTF-16 Codecs::\n* UTF-7 Codecs::\n* Unicode-Escape Codecs::\n* Raw-Unicode-Escape Codecs::\n* Latin-1 Codecs::\n* ASCII Codecs::\n* Character Map Codecs::\n* MBCS codecs for Windows::\n* Methods & Slots::\n",
            "subsections": []
        },
        "Container Objects": {
            "content": "* Dictionary Objects::\n* Set Objects::\n",
            "subsections": []
        },
        "Function Objects": {
            "content": "* Function Objects: Function Objects<3>.\n* Instance Method Objects::\n* Method Objects: Method Objects<2>.\n* Cell Objects::\n* Code Objects: Code Objects<2>.\n* Extra information::\n",
            "subsections": []
        },
        "Other Objects": {
            "content": "* File Objects::\n* Module Objects::\n* Iterator Objects::\n* Descriptor Objects::\n* Slice Objects::\n* MemoryView objects::\n* Weak Reference Objects: Weak Reference Objects<2>.\n* Capsules: Capsules<2>.\n* Frame Objects::\n* Generator Objects::\n* Coroutine Objects: Coroutine Objects<2>.\n* Context Variables Objects::\n* DateTime Objects: DateTime Objects<2>.\n* Objects for Type Hinting::\n",
            "subsections": []
        },
        "Module Objects": {
            "content": "* Initializing C modules::\n* Module lookup::\n",
            "subsections": []
        },
        "Initializing C modules": {
            "content": "* Single-phase initialization::\n* Multi-phase initialization::\n* Low-level module creation functions::\n* Support functions::\n",
            "subsections": []
        },
        "Slice Objects": {
            "content": "* Ellipsis Object::\n",
            "subsections": []
        },
        "Frame Objects": {
            "content": "* Internal Frames::\n",
            "subsections": []
        },
        "Initialization, Finalization, and Threads": {
            "content": "* Before Python Initialization::\n* Global configuration variables::\n* Initializing and finalizing the interpreter::\n* Process-wide parameters::\n* Thread State and the Global Interpreter Lock::\n* Sub-interpreter support::\n* Asynchronous Notifications::\n* Profiling and Tracing::\n* Advanced Debugger Support::\n* Thread Local Storage Support::\n",
            "subsections": []
        },
        "Thread State and the Global Interpreter Lock": {
            "content": "* Releasing the GIL from extension code::\n* Non-Python created threads::\n* Cautions about fork(): Cautions about fork.\n* High-level API::\n* Low-level API::\n",
            "subsections": []
        },
        "Sub-interpreter support": {
            "content": "* A Per-Interpreter GIL::\n* Bugs and caveats::\n",
            "subsections": []
        },
        "Thread Local Storage Support": {
            "content": "* Thread Specific Storage (TSS) API: Thread Specific Storage TSS API.\n* Thread Local Storage (TLS) API: Thread Local Storage TLS API.\n",
            "subsections": []
        },
        "Thread Specific Storage (TSS) API": {
            "content": "* Dynamic Allocation::\n* Methods: Methods<4>.\n",
            "subsections": []
        },
        "Python Initialization Configuration": {
            "content": "* Example: Example<17>.\n* PyWideStringList::\n* PyStatus::\n* PyPreConfig::\n* Preinitialize Python with PyPreConfig::\n* PyConfig::\n* Initialization with PyConfig::\n* Isolated Configuration::\n* Python Configuration::\n* Python Path Configuration::\n* PyRunMain(): PyRunMain.\n* PyGetArgcArgv(): PyGetArgcArgv.\n* Multi-Phase Initialization Private Provisional API::\n",
            "subsections": []
        },
        "Memory Management": {
            "content": "* Overview: Overview<4>.\n* Allocator Domains::\n* Raw Memory Interface::\n* Memory Interface::\n* Object allocators::\n* Default Memory Allocators::\n* Customize Memory Allocators::\n* Debug hooks on the Python memory allocators::\n* The pymalloc allocator::\n* tracemalloc C API::\n* Examples: Examples<37>.\n",
            "subsections": []
        },
        "The pymalloc allocator": {
            "content": "* Customize pymalloc Arena Allocator::\n",
            "subsections": []
        },
        "Object Implementation Support": {
            "content": "* Allocating Objects on the Heap::\n* Common Object Structures::\n* Type Objects: Type Objects<3>.\n* Number Object Structures::\n* Mapping Object Structures::\n* Sequence Object Structures::\n* Buffer Object Structures::\n* Async Object Structures::\n* Slot Type typedefs::\n* Examples: Examples<38>.\n* Supporting Cyclic Garbage Collection::\n",
            "subsections": []
        },
        "Common Object Structures": {
            "content": "* Base object types and macros::\n* Implementing functions and methods::\n* Accessing attributes of extension types::\n",
            "subsections": []
        },
        "Accessing attributes of extension types": {
            "content": "* Member flags::\n* Member types::\n* Defining Getters and Setters::\n",
            "subsections": []
        },
        "Quick Reference": {
            "content": "* \"tp slots\"::\n* sub-slots::\n* slot typedefs::\n",
            "subsections": []
        },
        "Supporting Cyclic Garbage Collection": {
            "content": "* Controlling the Garbage Collector State::\n* Querying Garbage Collector State::\n",
            "subsections": []
        },
        "Installing Python Modules": {
            "content": "* Key terms::\n* Basic usage::\n* How do I ...?::\n* Common installation issues::\n\nHow do I ...?\n\n* ... install pip in versions of Python prior to Python 3.4?: ... install pip in versions of Python prior to Python 3 4?.\n* ... install packages just for the current user?::\n* ... install scientific Python packages?::\n* ... work with multiple versions of Python installed in parallel?::\n",
            "subsections": []
        },
        "Common installation issues": {
            "content": "* Installing into the system Python on Linux::\n* Pip not installed::\n* Installing binary extensions::\n",
            "subsections": []
        },
        "Python HOWTOs": {
            "content": "* Porting Extension Modules to Python 3::\n* Curses Programming with Python::\n* Descriptor Guide::\n* Debugging C API extensions and CPython Internals with GDB::\n* Enum HOWTO::\n* Functional Programming HOWTO::\n* Logging HOWTO::\n* Logging Cookbook::\n* Regular Expression HOWTO::\n* Socket Programming HOWTO::\n* Sorting Techniques::\n* Unicode HOWTO::\n* HOWTO Fetch Internet Resources Using The urllib Package::\n* Argparse Tutorial::\n* An introduction to the ipaddress module::\n* Instrumenting CPython with DTrace and SystemTap::\n* Python support for the Linux perf profiler::\n* Annotations Best Practices::\n* Isolating Extension Modules::\n",
            "subsections": []
        },
        "Curses Programming with Python": {
            "content": "* What is curses?::\n* Starting and ending a curses application::\n* Windows and Pads::\n* Displaying Text::\n* User Input::\n* For More Information::\n\nWhat is curses?\n\n* The Python curses module::\n",
            "subsections": []
        },
        "Displaying Text": {
            "content": "* Attributes and Color::\n",
            "subsections": []
        },
        "Descriptor Guide": {
            "content": "* Primer::\n* Complete Practical Example::\n* Technical Tutorial::\n* Pure Python Equivalents::\n",
            "subsections": []
        },
        "Primer": {
            "content": "* Simple example; A descriptor that returns a constant: Simple example A descriptor that returns a constant.\n* Dynamic lookups::\n* Managed attributes::\n* Customized names::\n* Closing thoughts::\n",
            "subsections": []
        },
        "Complete Practical Example": {
            "content": "* Validator class::\n* Custom validators::\n* Practical application::\n",
            "subsections": []
        },
        "Technical Tutorial": {
            "content": "* Abstract::\n* Definition and introduction::\n* Descriptor protocol::\n* Overview of descriptor invocation::\n* Invocation from an instance::\n* Invocation from a class::\n* Invocation from super::\n* Summary of invocation logic::\n* Automatic name notification::\n* ORM example::\n",
            "subsections": []
        },
        "Pure Python Equivalents": {
            "content": "* Properties::\n* Functions and methods::\n* Kinds of methods::\n* Static methods::\n* Class methods::\n* Member objects and slots::\n",
            "subsections": []
        },
        "Debugging C API extensions and CPython Internals with GDB": {
            "content": "* Prerequisites::\n* Using the Debug build and Development mode::\n* Using the python-gdb extension::\n* Use with GDB commands::\n",
            "subsections": []
        },
        "Prerequisites": {
            "content": "* Setup with Python built from source::\n* Setup for Python from a Linux distro::\n",
            "subsections": []
        },
        "Using the python-gdb extension": {
            "content": "* Pretty-printers::\n* py-list::\n* py-up and py-down::\n* py-bt::\n* py-print::\n* py-locals::\n",
            "subsections": []
        },
        "Enum HOWTO": {
            "content": "* Programmatic access to enumeration members and their attributes::\n* Duplicating enum members and values::\n* Ensuring unique enumeration values::\n* Using automatic values::\n* Iteration: Iteration<2>.\n* Comparisons: Comparisons<3>.\n* Allowed members and attributes of enumerations::\n* Restricted Enum subclassing::\n* Dataclass support::\n* Pickling::\n* Functional API: Functional API<2>.\n* Derived Enumerations::\n* When to use new() vs. init(): When to use new vs init.\n* How are Enums and Flags different?::\n* Enum Cookbook::\n* Subclassing EnumType::\n",
            "subsections": []
        },
        "Derived Enumerations": {
            "content": "* IntEnum::\n* StrEnum::\n* IntFlag::\n* Flag::\n* Others: Others<2>.\n",
            "subsections": []
        },
        "When to use new() vs. init()": {
            "content": "* Finer Points::\n",
            "subsections": []
        },
        "Finer Points": {
            "content": "* Supported dunder names: Supported dunder names<2>.\n* Supported sunder names: Supported sunder names<2>.\n* Privatenames::\n* Enum member type::\n* Creating members that are mixed with other data types::\n* Boolean value of Enum classes and members::\n* Enum classes with methods::\n* Combining members of Flag::\n* Flag and IntFlag minutia::\n\nHow are Enums and Flags different?\n\n* Enum Classes::\n* Flag Classes::\n* Enum Members (aka instances): Enum Members aka instances.\n* Flag Members::\n",
            "subsections": []
        },
        "Enum Cookbook": {
            "content": "* Omitting values::\n* OrderedEnum::\n* DuplicateFreeEnum::\n* Planet::\n* TimePeriod::\n",
            "subsections": []
        },
        "Omitting values": {
            "content": "* Using auto::\n* Using object::\n* Using a descriptive string::\n* Using a custom new(): Using a custom new.\n",
            "subsections": []
        },
        "Functional Programming HOWTO": {
            "content": "* Introduction: Introduction<13>.\n* Iterators: Iterators<2>.\n* Generator expressions and list comprehensions::\n* Generators: Generators<2>.\n* Built-in functions: Built-in functions<2>.\n* The itertools module::\n* The functools module::\n* Small functions and the lambda expression::\n* Revision History and Acknowledgements::\n* References: References<2>.\n",
            "subsections": []
        },
        "Iterators": {
            "content": "* Data Types That Support Iterators::\n",
            "subsections": []
        },
        "Generators": {
            "content": "* Passing values into a generator::\n",
            "subsections": []
        },
        "The itertools module": {
            "content": "* Creating new iterators::\n* Calling functions on elements::\n* Selecting elements::\n* Combinatoric functions::\n* Grouping elements::\n",
            "subsections": []
        },
        "The functools module": {
            "content": "* The operator module::\n",
            "subsections": []
        },
        "References": {
            "content": "* General::\n* Python-specific::\n* Python documentation::\n",
            "subsections": []
        },
        "Logging HOWTO": {
            "content": "* Basic Logging Tutorial::\n* Advanced Logging Tutorial::\n* Logging Levels: Logging Levels<2>.\n* Useful Handlers::\n* Exceptions raised during logging::\n* Using arbitrary objects as messages::\n* Optimization::\n* Other resources::\n",
            "subsections": []
        },
        "Basic Logging Tutorial": {
            "content": "* When to use logging::\n* A simple example::\n* Logging to a file::\n* Logging variable data::\n* Changing the format of displayed messages::\n* Displaying the date/time in messages::\n* Next Steps::\n",
            "subsections": []
        },
        "Advanced Logging Tutorial": {
            "content": "* Logging Flow::\n* Loggers::\n* Handlers::\n* Formatters::\n* Configuring Logging::\n* What happens if no configuration is provided::\n* Configuring Logging for a Library::\n",
            "subsections": []
        },
        "Logging Levels": {
            "content": "* Custom Levels::\n",
            "subsections": []
        },
        "Logging Cookbook": {
            "content": "* Using logging in multiple modules::\n* Logging from multiple threads::\n* Multiple handlers and formatters::\n* Logging to multiple destinations::\n* Custom handling of levels::\n* Configuration server example::\n* Dealing with handlers that block::\n* Sending and receiving logging events across a network::\n* Adding contextual information to your logging output::\n* Use of contextvars::\n* Imparting contextual information in handlers::\n* Logging to a single file from multiple processes::\n* Using file rotation::\n* Use of alternative formatting styles::\n* Customizing LogRecord::\n* Subclassing QueueHandler and QueueListener- a ZeroMQ example::\n* Subclassing QueueHandler and QueueListener- a pynng example::\n* An example dictionary-based configuration::\n* Using a rotator and namer to customize log rotation processing::\n* A more elaborate multiprocessing example::\n* Inserting a BOM into messages sent to a SysLogHandler::\n* Implementing structured logging::\n* Customizing handlers with dictConfig(): Customizing handlers with dictConfig.\n* Using particular formatting styles throughout your application::\n* Configuring filters with dictConfig(): Configuring filters with dictConfig.\n* Customized exception formatting::\n* Speaking logging messages::\n* Buffering logging messages and outputting them conditionally::\n* Sending logging messages to email, with buffering: Sending logging messages to email with buffering.\n* Formatting times using UTC (GMT) via configuration: Formatting times using UTC GMT via configuration.\n* Using a context manager for selective logging::\n* A CLI application starter template::\n* A Qt GUI for logging::\n* Logging to syslog with RFC5424 support::\n* How to treat a logger like an output stream::\n* Patterns to avoid::\n* Other resources: Other resources<2>.\n",
            "subsections": []
        },
        "Sending and receiving logging events across a network": {
            "content": "* Running a logging socket listener in production::\n",
            "subsections": []
        },
        "Adding contextual information to your logging output": {
            "content": "* Using LoggerAdapters to impart contextual information::\n* Using Filters to impart contextual information::\n",
            "subsections": []
        },
        "Using LoggerAdapters to impart contextual information": {
            "content": "* Using objects other than dicts to pass contextual information::\n",
            "subsections": []
        },
        "Logging to a single file from multiple processes": {
            "content": "* Using concurrent.futures.ProcessPoolExecutor: Using concurrent futures ProcessPoolExecutor.\n* Deploying Web applications using Gunicorn and uWSGI::\n",
            "subsections": []
        },
        "Subclassing QueueHandler and QueueListener- a ZeroMQ example": {
            "content": "* Subclass QueueHandler::\n* Subclass QueueListener::\n",
            "subsections": []
        },
        "Subclassing QueueHandler and QueueListener- a pynng example": {
            "content": "* Subclass QueueListener: Subclass QueueListener<2>.\n* Subclass QueueHandler: Subclass QueueHandler<2>.\n",
            "subsections": []
        },
        "Using particular formatting styles throughout your application": {
            "content": "* Using LogRecord factories::\n* Using custom message objects::\n",
            "subsections": []
        },
        "Patterns to avoid": {
            "content": "* Opening the same log file multiple times::\n* Using loggers as attributes in a class or passing them as parameters::\n* Adding handlers other than NullHandler to a logger in a library::\n* Creating a lot of loggers::\n",
            "subsections": []
        },
        "Regular Expression HOWTO": {
            "content": "* Introduction: Introduction<14>.\n* Simple Patterns::\n* Using Regular Expressions::\n* More Pattern Power::\n* Modifying Strings::\n* Common Problems::\n* Feedback::\n",
            "subsections": []
        },
        "Simple Patterns": {
            "content": "* Matching Characters::\n* Repeating Things::\n",
            "subsections": []
        },
        "Using Regular Expressions": {
            "content": "* Compiling Regular Expressions::\n* The Backslash Plague::\n* Performing Matches::\n* Module-Level Functions: Module-Level Functions<2>.\n* Compilation Flags::\n",
            "subsections": []
        },
        "More Pattern Power": {
            "content": "* More Metacharacters::\n* Grouping::\n* Non-capturing and Named Groups::\n* Lookahead Assertions::\n",
            "subsections": []
        },
        "Modifying Strings": {
            "content": "* Splitting Strings::\n* Search and Replace: Search and Replace<2>.\n",
            "subsections": []
        },
        "Common Problems": {
            "content": "* Use String Methods::\n* match() versus search(): match versus search.\n* Greedy versus Non-Greedy::\n* Using re.VERBOSE: Using re VERBOSE.\n",
            "subsections": []
        },
        "Socket Programming HOWTO": {
            "content": "* Sockets::\n* Creating a Socket::\n* Using a Socket::\n* Disconnecting::\n* Non-blocking Sockets::\n",
            "subsections": []
        },
        "Sockets": {
            "content": ".......\n\n'await' *note loop.sockrecv(): a57.                   Receive data from the *note socket: bfd.\n\n\n'await' *note loop.sockrecvinto(): 941.              Receive data from the *note socket: bfd. into a\nbuffer.\n\n\n'await' *note loop.sockrecvfrom(): 3cf.               Receive a datagram from the *note socket: bfd.\n\n\n'await' *note loop.sockrecvfrominto(): 3d0.          Receive a datagram from the *note socket: bfd. into\na buffer.\n\n\n'await' *note loop.socksendall(): a58.                Send data to the *note socket: bfd.\n\n\n'await' *note loop.socksendto(): 3ce.                 Send a datagram via the *note socket: bfd. to the\ngiven address.\n\n\n'await' *note loop.sockconnect(): c26.                Connect the *note socket: bfd.\n\n\n'await' *note loop.sockaccept(): a59.                 Accept a *note socket: bfd. connection.\n\n\n'await' *note loop.socksendfile(): 945.               Send a file over the *note socket: bfd.\n\n\n*note loop.addreader(): 2f29.                         Start watching a file descriptor for read\navailability.\n\n\n*note loop.removereader(): 2fa7.                      Stop watching a file descriptor for read\navailability.\n\n\n*note loop.addwriter(): 2fa8.                         Start watching a file descriptor for write\navailability.\n\n\n*note loop.removewriter(): 2fa9.                      Stop watching a file descriptor for write\navailability.\n\n",
            "subsections": []
        },
        "Creating a Socket": {
            "content": "* IPC::\n\nUsing a Socket\n\n* Binary Data::\n",
            "subsections": []
        },
        "Disconnecting": {
            "content": "* When Sockets Die::\n",
            "subsections": []
        },
        "Sorting Techniques": {
            "content": "* Sorting Basics::\n* Key Functions::\n* Operator Module Functions and Partial Function Evaluation::\n* Ascending and Descending::\n* Sort Stability and Complex Sorts::\n* Decorate-Sort-Undecorate::\n* Comparison Functions::\n* Odds and Ends: Odds and Ends<2>.\n* Partial Sorts::\n",
            "subsections": []
        },
        "Unicode HOWTO": {
            "content": "* Introduction to Unicode::\n* Python's Unicode Support::\n* Reading and Writing Unicode Data::\n* Acknowledgements: Acknowledgements<10>.\n",
            "subsections": []
        },
        "Introduction to Unicode": {
            "content": "* Definitions::\n* Encodings::\n* References: References<3>.\n",
            "subsections": []
        },
        "Python's Unicode Support": {
            "content": "* The String Type::\n* Converting to Bytes::\n* Unicode Literals in Python Source Code::\n* Unicode Properties::\n* Comparing Strings::\n* Unicode Regular Expressions::\n* References: References<4>.\n",
            "subsections": []
        },
        "Reading and Writing Unicode Data": {
            "content": "* Unicode filenames::\n* Tips for Writing Unicode-aware Programs::\n* References: References<5>.\n",
            "subsections": []
        },
        "Tips for Writing Unicode-aware Programs": {
            "content": "* Converting Between File Encodings::\n* Files in an Unknown Encoding::\n\nHOWTO Fetch Internet Resources Using The urllib Package\n\n* Introduction: Introduction<15>.\n* Fetching URLs::\n* Handling Exceptions: Handling Exceptions<2>.\n* info and geturl::\n* Openers and Handlers::\n* Basic Authentication::\n* Proxies::\n* Sockets and Layers::\n* Footnotes::\n",
            "subsections": []
        },
        "Fetching URLs": {
            "content": "* Data::\n* Headers::\n",
            "subsections": []
        },
        "Handling Exceptions": {
            "content": "* URLError::\n* HTTPError::\n* Wrapping it Up::\n\nHTTPError\n\n* Error Codes::\n\nWrapping it Up\n\n* Number 1::\n* Number 2::\n",
            "subsections": []
        },
        "Argparse Tutorial": {
            "content": "* Concepts::\n* The basics::\n* Introducing Positional arguments::\n* Introducing Optional arguments::\n* Combining Positional and Optional arguments::\n* Getting a little more advanced::\n* How to translate the argparse output::\n* Conclusion::\n",
            "subsections": []
        },
        "Introducing Optional arguments": {
            "content": "* Short options::\n",
            "subsections": []
        },
        "Getting a little more advanced": {
            "content": "* Specifying ambiguous arguments::\n* Conflicting options::\n",
            "subsections": []
        },
        "An introduction to the ipaddress module": {
            "content": "* Creating Address/Network/Interface objects::\n* Inspecting Address/Network/Interface Objects::\n* Networks as lists of Addresses::\n* Comparisons: Comparisons<4>.\n* Using IP Addresses with other modules::\n* Getting more detail when instance creation fails::\n",
            "subsections": []
        },
        "Creating Address/Network/Interface objects": {
            "content": "* A Note on IP Versions::\n* IP Host Addresses::\n* Defining Networks::\n* Host Interfaces::\n",
            "subsections": []
        },
        "Instrumenting CPython with DTrace and SystemTap": {
            "content": "* Enabling the static markers::\n* Static DTrace probes::\n* Static SystemTap markers::\n* Available static markers::\n* SystemTap Tapsets::\n* Examples: Examples<39>.\n",
            "subsections": []
        },
        "Python support for the Linux perf profiler": {
            "content": "* How to enable perf profiling support::\n* How to obtain the best results::\n",
            "subsections": []
        },
        "Annotations Best Practices": {
            "content": "* 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.\n* 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.\n* Manually Un-Stringizing Stringized Annotations::\n* Best Practices For annotations In Any Python Version::\n* annotations Quirks::\n",
            "subsections": []
        },
        "Isolating Extension Modules": {
            "content": "* Who should read this::\n* Background: Background<2>.\n* Making Modules Safe with Multiple Interpreters::\n* Heap Types: Heap Types<2>.\n* Open Issues::\n",
            "subsections": []
        },
        "Making Modules Safe with Multiple Interpreters": {
            "content": "* Managing Global State::\n* Managing Per-Module State::\n* Opt-Out; Limiting to One Module Object per Process: Opt-Out Limiting to One Module Object per Process.\n* Module State Access from Functions::\n",
            "subsections": []
        },
        "Heap Types": {
            "content": "* Changing Static Types to Heap Types::\n* Defining Heap Types::\n* Garbage-Collection Protocol::\n* Module State Access from Classes::\n* Module State Access from Regular Methods::\n* Module State Access from Slot Methods, Getters and Setters: Module State Access from Slot Methods Getters and Setters.\n* Lifetime of the Module State::\n",
            "subsections": []
        },
        "Garbage-Collection Protocol": {
            "content": "* tptraverse in Python 3.8 and lower: tptraverse in Python 3 8 and lower.\n* Delegating tptraverse::\n* Defining tpdealloc::\n* Not overriding tpfree::\n* Avoiding PyObjectNew::\n",
            "subsections": []
        },
        "Open Issues": {
            "content": "* Per-Class Scope::\n* Lossless Conversion to Heap Types::\n",
            "subsections": []
        },
        "Python Frequently Asked Questions": {
            "content": "* General Python FAQ::\n* Programming FAQ::\n* Design and History FAQ::\n* Library and Extension FAQ::\n* Extending/Embedding FAQ::\n* Python on Windows FAQ::\n* Graphic User Interface FAQ::\n* \"Why is Python Installed on my Computer?\" FAQ::\n",
            "subsections": []
        },
        "General Python FAQ": {
            "content": "* General Information::\n* Python in the real world::\n",
            "subsections": []
        },
        "General Information": {
            "content": "* What is Python?::\n* What is the Python Software Foundation?::\n* Are there copyright restrictions on the use of Python?::\n* Why was Python created in the first place?::\n* What is Python good for?::\n* How does the Python version numbering scheme work?::\n* How do I obtain a copy of the Python source?::\n* How do I get documentation on Python?::\n* I've never programmed before. Is there a Python tutorial?: I've never programmed before Is there a Python tutorial?.\n* Is there a newsgroup or mailing list devoted to Python?::\n* How do I get a beta test version of Python?::\n* How do I submit bug reports and patches for Python?::\n* Are there any published articles about Python that I can reference?::\n* Are there any books on Python?::\n* Where in the world is www.python.org located?: Where in the world is www python org located?.\n* Why is it called Python?::\n* Do I have to like \"Monty Python's Flying Circus\"?::\n",
            "subsections": []
        },
        "Python in the real world": {
            "content": "* How stable is Python?::\n* How many people are using Python?::\n* Have any significant projects been done in Python?::\n* What new developments are expected for Python in the future?::\n* Is it reasonable to propose incompatible changes to Python?::\n* Is Python a good language for beginning programmers?::\n",
            "subsections": []
        },
        "Programming FAQ": {
            "content": "* General Questions::\n* Core Language::\n* Numbers and strings::\n* Performance: Performance<4>.\n* Sequences (Tuples/Lists): Sequences Tuples/Lists.\n* Objects::\n* Modules: Modules<5>.\n",
            "subsections": []
        },
        "General Questions": {
            "content": "* Is there a source code level debugger with breakpoints, single-stepping, etc.?: Is there a source code level debugger with breakpoints single-stepping etc ?.\n* Are there tools to help find bugs or perform static analysis?::\n* How can I create a stand-alone binary from a Python script?::\n* Are there coding standards or a style guide for Python programs?::\n",
            "subsections": []
        },
        "Core Language": {
            "content": "* Why am I getting an UnboundLocalError when the variable has a value?::\n* What are the rules for local and global variables in Python?::\n* Why do lambdas defined in a loop with different values all return the same result?::\n* How do I share global variables across modules?::\n* What are the \"best practices\" for using import in a module?::\n* Why are default values shared between objects?::\n* How can I pass optional or keyword parameters from one function to another?::\n* What is the difference between arguments and parameters?::\n* Why did changing list 'y' also change list 'x'?::\n* How do I write a function with output parameters (call by reference)?: How do I write a function with output parameters call by reference ?.\n* How do you make a higher order function in Python?::\n* How do I copy an object in Python?::\n* How can I find the methods or attributes of an object?::\n* How can my code discover the name of an object?::\n* What's up with the comma operator's precedence?::\n* Is there an equivalent of C's \"?;\" ternary operator?: Is there an equivalent of C's \"? \" ternary operator?.\n* Is it possible to write obfuscated one-liners in Python?::\n* What does the slash(/) in the parameter list of a function mean?: What does the slash / in the parameter list of a function mean?.\n",
            "subsections": []
        },
        "Numbers and strings": {
            "content": "* How do I specify hexadecimal and octal integers?::\n* Why does -22 // 10 return -3?::\n* How do I get int literal attribute instead of SyntaxError?::\n* How do I convert a string to a number?::\n* How do I convert a number to a string?::\n* How do I modify a string in place?::\n* How do I use strings to call functions/methods?::\n* 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?.\n* Is there a scanf() or sscanf() equivalent?: Is there a scanf or sscanf equivalent?.\n* What does 'UnicodeDecodeError' or 'UnicodeEncodeError' error mean?::\n* Can I end a raw string with an odd number of backslashes?::\n",
            "subsections": []
        },
        "Sequences (Tuples/Lists)": {
            "content": "* How do I convert between tuples and lists?::\n* What's a negative index?::\n* How do I iterate over a sequence in reverse order?::\n* How do you remove duplicates from a list?::\n* How do you remove multiple items from a list::\n* How do you make an array in Python?::\n* How do I create a multidimensional list?::\n* How do I apply a method or function to a sequence of objects?::\n* Why does atuple[i] += ['item'] raise an exception when the addition works?::\n* 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?.\n* How can I sort one list by values from another list?::\n",
            "subsections": []
        },
        "Objects": {
            "content": "* What is a class?::\n* What is a method?::\n* What is self?::\n* How do I check if an object is an instance of a given class or of a subclass of it?::\n* What is delegation?::\n* How do I call a method defined in a base class from a derived class that extends it?::\n* How can I organize my code to make it easier to change the base class?::\n* How do I create static class data and static class methods?::\n* How can I overload constructors (or methods) in Python?: How can I overload constructors or methods in Python?.\n* I try to use spam and I get an error about SomeClassNamespam.: I try to use spam and I get an error about SomeClassNamespam.\n* 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.\n* How do I get a list of all instances of a given class?::\n* Why does the result of id() appear to be not unique?: Why does the result of id appear to be not unique?.\n* When can I rely on identity tests with the is operator?::\n* How can a subclass control what data is stored in an immutable instance?::\n* How do I cache method calls?::\n",
            "subsections": []
        },
        "Design and History FAQ": {
            "content": "* Why does Python use indentation for grouping of statements?::\n* Why am I getting strange results with simple arithmetic operations?::\n* Why are floating-point calculations so inaccurate?::\n* Why are Python strings immutable?::\n* Why must 'self' be used explicitly in method definitions and calls?::\n* Why can't I use an assignment in an expression?::\n* 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 ?.\n* 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?.\n* How fast are exceptions?::\n* Why isn't there a switch or case statement in Python?::\n* Can't you emulate threads in the interpreter instead of relying on an OS-specific thread implementation?::\n* Why can't lambda expressions contain statements?::\n* Can Python be compiled to machine code, C or some other language?: Can Python be compiled to machine code C or some other language?.\n* How does Python manage memory?::\n* Why doesn't CPython use a more traditional garbage collection scheme?::\n* Why isn't all memory freed when CPython exits?::\n* Why are there separate tuple and list data types?::\n* How are lists implemented in CPython?::\n* How are dictionaries implemented in CPython?::\n* Why must dictionary keys be immutable?::\n* Why doesn't list.sort() return the sorted list?: Why doesn't list sort return the sorted list?.\n* How do you specify and enforce an interface spec in Python?::\n* Why is there no goto?::\n* Why can't raw strings (r-strings) end with a backslash?: Why can't raw strings r-strings end with a backslash?.\n* Why doesn't Python have a \"with\" statement for attribute assignments?::\n* Why don't generators support the with statement?::\n* Why are colons required for the if/while/def/class statements?::\n* Why does Python allow commas at the end of lists and tuples?::\n",
            "subsections": []
        },
        "Library and Extension FAQ": {
            "content": "* General Library Questions::\n* Common tasks::\n* Threads::\n* Input and Output: Input and Output<2>.\n* Network/Internet Programming::\n* Databases::\n* Mathematics and Numerics::\n",
            "subsections": []
        },
        "General Library Questions": {
            "content": "* How do I find a module or application to perform task X?::\n* Where is the math.py (socket.py, regex.py, etc.) source file?: Where is the math py socket py regex py etc source file?.\n* How do I make a Python script executable on Unix?::\n* Is there a curses/termcap package for Python?::\n* Is there an equivalent to C's onexit() in Python?: Is there an equivalent to C's onexit in Python?.\n* Why don't my signal handlers work?::\n",
            "subsections": []
        },
        "Common tasks": {
            "content": "* How do I test a Python program or component?::\n* How do I create documentation from doc strings?::\n* How do I get a single keypress at a time?::\n",
            "subsections": []
        },
        "Threads": {
            "content": "* How do I program using threads?::\n* None of my threads seem to run; why?: None of my threads seem to run why?.\n* How do I parcel out work among a bunch of worker threads?::\n* What kinds of global value mutation are thread-safe?::\n* Can't we get rid of the Global Interpreter Lock?::\n",
            "subsections": []
        },
        "Network/Internet Programming": {
            "content": "* What WWW tools are there for Python?::\n* How can I mimic CGI form submission (METHOD=POST)?: How can I mimic CGI form submission METHOD=POST ?.\n* What module should I use to help with generating HTML?::\n* How do I send mail from a Python script?::\n* How do I avoid blocking in the connect() method of a socket?: How do I avoid blocking in the connect method of a socket?.\n",
            "subsections": []
        },
        "Databases": {
            "content": "* Are there any interfaces to database packages in Python?::\n* How do you implement persistent objects in Python?::\n",
            "subsections": []
        },
        "Mathematics and Numerics": {
            "content": "* How do I generate random numbers in Python?::\n",
            "subsections": []
        },
        "Extending/Embedding FAQ": {
            "content": "* Can I create my own functions in C?::\n* Can I create my own functions in C++?::\n* Writing C is hard; are there any alternatives?::\n* How can I execute arbitrary Python statements from C?::\n* How can I evaluate an arbitrary Python expression from C?::\n* How do I extract C values from a Python object?::\n* How do I use PyBuildValue() to create a tuple of arbitrary length?: How do I use PyBuildValue to create a tuple of arbitrary length?.\n* How do I call an object's method from C?::\n* How do I catch the output from PyErrPrint() (or anything that prints to stdout/stderr)?: How do I catch the output from PyErrPrint or anything that prints to stdout/stderr ?.\n* How do I access a module written in Python from C?::\n* How do I interface to C++ objects from Python?::\n* I added a module using the Setup file and the make fails; why?::\n* How do I debug an extension?::\n* 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?.\n* How do I tell \"incomplete input\" from \"invalid input\"?::\n* How do I find undefined g++ symbols builtinnew or purevirtual?::\n* 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 ?.\n",
            "subsections": []
        },
        "Python on Windows FAQ": {
            "content": "* How do I run a Python program under Windows?::\n* How do I make Python scripts executable?::\n* Why does Python sometimes take so long to start?::\n* How do I make an executable from a Python script?::\n* Is a *.pyd file the same as a DLL?: Is a * pyd file the same as a DLL?.\n* How can I embed Python into a Windows application?::\n* How do I keep editors from inserting tabs into my Python source?::\n* How do I check for a keypress without blocking?::\n* 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?.\n",
            "subsections": []
        },
        "Graphic User Interface FAQ": {
            "content": "* General GUI Questions::\n* What GUI toolkits exist for Python?::\n* Tkinter questions::\n",
            "subsections": []
        },
        "Tkinter questions": {
            "content": "* How do I freeze Tkinter applications?::\n* Can I have Tk events handled while waiting for I/O?::\n* I can't get key bindings to work in Tkinter; why?: I can't get key bindings to work in Tkinter why?.\n\n\"Why is Python Installed on my Computer?\" FAQ\n\n* What is Python?: What is Python?<2>.\n* Why is Python installed on my machine?::\n* Can I delete Python?::\n",
            "subsections": []
        },
        "About these documents": {
            "content": "* Contributors to the Python Documentation::\n",
            "subsections": []
        },
        "Dealing with Bugs": {
            "content": "* Documentation bugs::\n* Using the Python issue tracker::\n* Getting started contributing to Python yourself::\n",
            "subsections": []
        },
        "History and License": {
            "content": "* History of the software::\n* Terms and conditions for accessing or otherwise using Python::\n* Licenses and Acknowledgements for Incorporated Software::\n",
            "subsections": []
        },
        "Terms and conditions for accessing or otherwise using Python": {
            "content": "* PSF LICENSE AGREEMENT FOR PYTHON 3.12.3: PSF LICENSE AGREEMENT FOR PYTHON 3 12 3.\n* BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0: BEOPEN COM LICENSE AGREEMENT FOR PYTHON 2 0.\n* CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1: CNRI LICENSE AGREEMENT FOR PYTHON 1 6 1.\n* CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2: CWI LICENSE AGREEMENT FOR PYTHON 0 9 0 THROUGH 1 2.\n* ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON 3.12.3 DOCUMENTATION: ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON 3 12 3 DOCUMENTATION.\n",
            "subsections": []
        },
        "Licenses and Acknowledgements for Incorporated Software": {
            "content": "* Mersenne Twister::\n* Sockets: Sockets<2>.\n* Asynchronous socket services::\n* Cookie management::\n* Execution tracing::\n* UUencode and UUdecode functions::\n* XML Remote Procedure Calls::\n* testepoll::\n* Select kqueue::\n* SipHash24::\n* strtod and dtoa::\n* OpenSSL: OpenSSL<2>.\n* expat::\n* libffi::\n* zlib: zlib<3>.\n* cfuhash::\n* libmpdec::\n* W3C C14N test suite::\n* Audioop::\n* asyncio: asyncio<11>.\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: What's New in Python,  Next: The Python Tutorial,  Prev: Top,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "1 What's New in Python": {
            "content": "The \"What's New in Python\" series of essays takes tours through the most\nimportant changes between major Python versions.  They are a \"must read\"\nfor anyone wishing to stay up-to-date after a new release.\n\n* Menu:\n\n* What's New In Python 3.12: What's New In Python 3 12.\n* What's New In Python 3.11: What's New In Python 3 11.\n* What's New In Python 3.10: What's New In Python 3 10.\n* What's New In Python 3.9: What's New In Python 3 9.\n* What's New In Python 3.8: What's New In Python 3 8.\n* What's New In Python 3.7: What's New In Python 3 7.\n* What's New In Python 3.6: What's New In Python 3 6.\n* What's New In Python 3.5: What's New In Python 3 5.\n* What's New In Python 3.4: What's New In Python 3 4.\n* What's New In Python 3.3: What's New In Python 3 3.\n* What's New In Python 3.2: What's New In Python 3 2.\n* What's New In Python 3.1: What's New In Python 3 1.\n* What's New In Python 3.0: What's New In Python 3 0.\n* What's New in Python 2.7: What's New in Python 2 7.\n* What's New in Python 2.6: What's New in Python 2 6.\n* What's New in Python 2.5: What's New in Python 2 5.\n* What's New in Python 2.4: What's New in Python 2 4.\n* What's New in Python 2.3: What's New in Python 2 3.\n* What's New in Python 2.2: What's New in Python 2 2.\n* What's New in Python 2.1: What's New in Python 2 1.\n* What's New in Python 2.0: What's New in Python 2 0.\n* Changelog::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: What's New In Python 3 12,  Next: What's New In Python 3 11,  Up: What's New in Python": {
            "content": "",
            "subsections": [
                {
                    "name": "1.1 What's New In Python 3.12",
                    "content": ""
                }
            ]
        },
        "Editor: Adam Turner": {
            "content": "This article explains the new features in Python 3.12, compared to 3.11.",
            "subsections": []
        },
        "Python 3.12 was released on October 2, 2023.  For full details, see the": {
            "content": "*note changelog: 136.\n\nSee also\n........\n\nPEP 693(1) - Python 3.12 Release Schedule\n\n* Menu:\n\n* Summary - Release highlights::\n* New Features::\n* New Features Related to Type Hints::\n* Other Language Changes::\n* New Modules::\n* Improved Modules::\n* Optimizations::\n* CPython bytecode changes::\n* Demos and Tools::\n* Deprecated::\n* Removed::\n* Porting to Python 3.12: Porting to Python 3 12.\n* Build Changes::\n* C API Changes::\n* Notable changes in 3.12.10: Notable changes in 3 12 10.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0693/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Summary - Release highlights,  Next: New Features,  Up: What's New In Python 3 12": {
            "content": "",
            "subsections": []
        },
        "Python 3.12 is the latest stable release of the Python programming": {
            "content": "language, with a mix of changes to the language and the standard\nlibrary.  The library changes focus on cleaning up deprecated APIs,\nusability, and correctness.  Of note, the 'distutils' package has been\nremoved from the standard library.  Filesystem support in *note os: 9c.\nand *note pathlib: 9f. has seen a number of improvements, and several\nmodules have better performance.\n\nThe language changes focus on usability, as *note f-strings: 138. have\nhad many limitations removed and 'Did you mean ...' suggestions continue\nto improve.  The new *note type parameter syntax: 139. and *note type:\n13a. statement improve ergonomics for using *note generic types: 13b.\nand *note type aliases: 13c. with static type checkers.\n",
            "subsections": []
        },
        "This article doesn't attempt to provide a complete specification of all": {
            "content": "new features, but instead tries to give a convenient overview.  For full\ndetails, you should refer to the documentation for Python 3.0, and/or\nthe many PEPs referenced in the text.  If you want to understand the\ncomplete implementation and design rationale for a particular feature,\nPEPs usually have more details than the regular documentation; but note\nthat PEPs usually are not kept up-to-date once a feature has been fully\nimplemented.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: New Features,  Next: New Features Related to Type Hints,  Prev: Summary - Release highlights,  Up: What's New In Python 3 12": {
            "content": "* Menu:\n\n* PEP 695; Type Parameter Syntax: PEP 695 Type Parameter Syntax.\n* PEP 701; Syntactic formalization of f-strings: PEP 701 Syntactic formalization of f-strings.\n* PEP 684; A Per-Interpreter GIL: PEP 684 A Per-Interpreter GIL.\n* PEP 669; Low impact monitoring for CPython: PEP 669 Low impact monitoring for CPython.\n* PEP 688; Making the buffer protocol accessible in Python: PEP 688 Making the buffer protocol accessible in Python.\n* PEP 709; Comprehension inlining: PEP 709 Comprehension inlining.\n* Improved Error Messages::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: PEP 695 Type Parameter Syntax,  Next: PEP 701 Syntactic formalization of f-strings,  Up: New Features": {
            "content": "1.1.2.1 PEP 695: Type Parameter Syntax\n......................................\n",
            "subsections": []
        },
        "Generic classes and functions under PEP 484(1) were declared using a": {
            "content": "verbose syntax that left the scope of type parameters unclear and\nrequired explicit declarations of variance.\n\nPEP 695(2) introduces a new, more compact and explicit way to create\n*note generic classes: 15d. and *note functions: 15e.:\n\ndef max[T](args: Iterable[T]) -> T:\n...\n\nclass list[T]:\ndef getitem(self, index: int, /) -> T:\n...\n\ndef append(self, element: T) -> None:\n...\n\nIn addition, the PEP introduces a new way to declare *note type aliases:\n15f. using the *note type: 13a. statement, which creates an instance of\n*note TypeAliasType: 160.:\n\ntype Point = tuple[float, float]\n\nType aliases can also be *note generic: 161.:\n\ntype Point[T] = tuple[T, T]\n\nThe new syntax allows declaring *note TypeVarTuple: 162. and *note\nParamSpec: 163. parameters, as well as *note TypeVar: 164. parameters\nwith bounds or constraints:\n\ntype IntFunc[P] = Callable[P, int]  # ParamSpec\ntype LabeledTuple[*Ts] = tuple[str, *Ts]  # TypeVarTuple\ntype HashableSequence[T: Hashable] = Sequence[T]  # TypeVar with bound\ntype IntOrStrSequence[T: (int, str)] = Sequence[T]  # TypeVar with constraints\n",
            "subsections": []
        },
        "The value of type aliases and the bound and constraints of type": {
            "content": "variables created through this syntax are evaluated only on demand (see\n*note lazy evaluation: 165.).  This means type aliases are able to refer\nto other types defined later in the file.\n",
            "subsections": []
        },
        "Type parameters declared through a type parameter list are visible": {
            "content": "within the scope of the declaration and any nested scopes, but not in\nthe outer scope.  For example, they can be used in the type annotations\nfor the methods of a generic class or in the class body.  However, they\ncannot be used in the module scope after the class is defined.  See\n*note Type parameter lists: 166. for a detailed description of the\nruntime semantics of type parameters.\n",
            "subsections": []
        },
        "In order to support these scoping semantics, a new kind of scope is": {
            "content": "introduced, the *note annotation scope: 167.  Annotation scopes behave\nfor the most part like function scopes, but interact differently with\nenclosing class scopes.  In Python 3.13, *note annotations: 168. will\nalso be evaluated in annotation scopes.\n\nSee PEP 695(3) for more details.\n\n(PEP written by Eric Traut.  Implementation by Jelle Zijlstra, Eric",
            "subsections": []
        },
        "Traut, and others in gh-103764(4).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0484/\n\n(2) https://peps.python.org/pep-0695/\n\n(3) https://peps.python.org/pep-0695/\n\n(4) https://github.com/python/cpython/issues/103764\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "1.1.2.2 PEP 701: Syntactic formalization of f-strings\n.....................................................\n\nPEP 701(1) lifts some restrictions on the usage of *note f-strings: 138.",
            "subsections": []
        },
        "Expression components inside f-strings can now be any valid Python": {
            "content": "expression, including strings reusing the same quote as the containing\nf-string, multi-line expressions, comments, backslashes, and unicode\nescape sequences.  Let's cover these in detail:\n\n* Quote reuse: in Python 3.11, reusing the same quotes as the\nenclosing f-string raises a *note SyntaxError: 146, forcing the\nuser to either use other available quotes (like using double quotes\nor triple quotes if the f-string uses single quotes).  In Python\n3.12, you can now do things like this:\n\n>>> songs = ['Take me back to Eden', 'Alkaline', 'Ascensionism']\n>>> f\"This is the playlist: {\", \".join(songs)}\"\n'This is the playlist: Take me back to Eden, Alkaline, Ascensionism'\n\nNote that before this change there was no explicit limit in how\nf-strings can be nested, but the fact that string quotes cannot be\nreused inside the expression component of f-strings made it\nimpossible to nest f-strings arbitrarily.  In fact, this is the\nmost nested f-string that could be written:\n\n>>> f\"\"\"{f'''{f'{f\"{1+1}\"}'}'''}\"\"\"\n'2'\n\nAs now f-strings can contain any valid Python expression inside\nexpression components, it is now possible to nest f-strings\narbitrarily:\n\n>>> f\"{f\"{f\"{f\"{f\"{f\"{1+1}\"}\"}\"}\"}\"}\"\n'2'\n\n* Multi-line expressions and comments: In Python 3.11, f-string\nexpressions must be defined in a single line, even if the\nexpression within the f-string could normally span multiple lines\n(like literal lists being defined over multiple lines), making them\nharder to read.  In Python 3.12 you can now define f-strings\nspanning multiple lines, and add inline comments:\n\n>>> f\"This is the playlist: {\", \".join([\n...     'Take me back to Eden',  # My, my, those eyes like fire\n...     'Alkaline',              # Not acid nor alkaline\n...     'Ascensionism'           # Take to the broken skies at last\n... ])}\"\n'This is the playlist: Take me back to Eden, Alkaline, Ascensionism'\n\n* Backslashes and unicode characters: before Python 3.12 f-string\nexpressions couldn't contain any '\\' character.  This also affected\nunicode *note escape sequences: 16a. (such as '\\N{snowman}') as\nthese contain the '\\N' part that previously could not be part of\nexpression components of f-strings.  Now, you can define\nexpressions like this:\n\n>>> print(f\"This is the playlist: {\"\\n\".join(songs)}\")\nThis is the playlist: Take me back to Eden\nAlkaline\nAscensionism\n>>> print(f\"This is the playlist: {\"\\N{BLACK HEART SUIT}\".join(songs)}\")\nThis is the playlist: Take me back to Eden???Alkaline???Ascensionism\n\nSee PEP 701(2) for more details.\n",
            "subsections": []
        },
        "As a positive side-effect of how this feature has been implemented (by": {
            "content": "parsing f-strings with the PEG parser(3)), now error messages for\nf-strings are more precise and include the exact location of the error.\nFor example, in Python 3.11, the following f-string raises a *note\nSyntaxError: 146.:\n\n>>> mystring = f\"{x z y}\" + f\"{1 + 1}\"\nFile \"<stdin>\", line 1\n(x z y)\n^^^\nSyntaxError: f-string: invalid syntax. Perhaps you forgot a comma?\n\nbut the error message doesn't include the exact location of the error\nwithin the line and also has the expression artificially surrounded by\nparentheses.  In Python 3.12, as f-strings are parsed with the PEG\nparser, error messages can be more precise and show the entire line:\n\n>>> mystring = f\"{x z y}\" + f\"{1 + 1}\"\nFile \"<stdin>\", line 1\nmystring = f\"{x z y}\" + f\"{1 + 1}\"\n^^^\nSyntaxError: invalid syntax. Perhaps you forgot a comma?\n\n(Contributed by Pablo Galindo, Batuhan Taskaya, Lysandros Nikolaou,\nCristi??n Maureira-Fredes and Marta G??mez in gh-102856(4).  PEP written\nby Pablo Galindo, Batuhan Taskaya, Lysandros Nikolaou and Marta G??mez).\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0701/\n\n(2) https://peps.python.org/pep-0701/\n\n(3) https://peps.python.org/pep-0617/\n\n(4) https://github.com/python/cpython/issues/102856\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "1.1.2.3 PEP 684: A Per-Interpreter GIL\n......................................\n\nPEP 684(1) introduces a per-interpreter *note GIL: 141, so that\nsub-interpreters may now be created with a unique GIL per interpreter.",
            "subsections": []
        },
        "This allows Python programs to take full advantage of multiple CPU": {
            "content": "cores.  This is currently only available through the C-API, though a\nPython API is anticipated for 3.13(2).\n\nUse the new *note PyNewInterpreterFromConfig(): 16c. function to create\nan interpreter with its own GIL:\n\nPyInterpreterConfig config = {\n.checkmultiinterpextensions = 1,\n.gil = PyInterpreterConfigOWNGIL,\n};\nPyThreadState *tstate = NULL;\nPyStatus status = PyNewInterpreterFromConfig(&tstate, &config);\nif (PyStatusException(status)) {\nreturn -1;\n}\n/* The new interpreter is now active in the current thread. */\n",
            "subsections": []
        },
        "For further examples how to use the C-API for sub-interpreters with a": {
            "content": "per-interpreter GIL, see Modules/xxsubinterpretersmodule.c(3).\n\n(Contributed by Eric Snow in gh-104210(4), etc.)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0684/\n\n(2) https://peps.python.org/pep-0554/\n\n(3)\nhttps://github.com/python/cpython/tree/3.12/Modules/xxsubinterpretersmodule.c\n\n(4) https://github.com/python/cpython/issues/104210\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "1.1.2.4 PEP 669: Low impact monitoring for CPython\n..................................................\n\nPEP 669(1) defines a new *note API: d4. for profilers, debuggers, and\nother tools to monitor events in CPython.  It covers a wide range of\nevents, including calls, returns, lines, exceptions, jumps, and more.",
            "subsections": []
        },
        "This means that you only pay for what you use, providing support for": {
            "content": "near-zero overhead debuggers and coverage tools.  See *note\nsys.monitoring: d4. for details.\n\n(Contributed by Mark Shannon in gh-103082(2).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0669/\n\n(2) https://github.com/python/cpython/issues/103082\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "1.1.2.5 PEP 688: Making the buffer protocol accessible in Python\n................................................................\n\nPEP 688(1) introduces a way to use the *note buffer protocol: 148. from\nPython code.  Classes that implement the *note buffer(): 16f. method\nare now usable as buffer types.\n\nThe new *note collections.abc.Buffer: 170. ABC provides a standard way\nto represent buffer objects, for example in type annotations.  The new\n*note inspect.BufferFlags: 171. enum represents the flags that can be\nused to customize buffer creation.  (Contributed by Jelle Zijlstra in\ngh-102500(2).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0688/\n\n(2) https://github.com/python/cpython/issues/102500\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: PEP 709 Comprehension inlining,  Next: Improved Error Messages,  Prev: PEP 688 Making the buffer protocol accessible in Python,  Up: New Features": {
            "content": "1.1.2.6 PEP 709: Comprehension inlining\n.......................................\n",
            "subsections": []
        },
        "Dictionary, list, and set comprehensions are now inlined, rather than": {
            "content": "creating a new single-use function object for each execution of the\ncomprehension.  This speeds up execution of a comprehension by up to two\ntimes.  See PEP 709(1) for further details.\n",
            "subsections": []
        },
        "Comprehension iteration variables remain isolated and don't overwrite a": {
            "content": "variable of the same name in the outer scope, nor are they visible after\nthe comprehension.  Inlining does result in a few visible behavior\nchanges:\n\n* There is no longer a separate frame for the comprehension in\ntracebacks, and tracing/profiling no longer shows the comprehension\nas a function call.\n\n* The *note symtable: d2. module will no longer produce child symbol\ntables for each comprehension; instead, the comprehension's locals\nwill be included in the parent function's symbol table.\n\n* Calling *note locals(): 173. inside a comprehension now includes\nvariables from outside the comprehension, and no longer includes\nthe synthetic '.0' variable for the comprehension \"argument\".\n\n* A comprehension iterating directly over 'locals()' (e.g.  '[k for k\nin locals()]') may see \"RuntimeError: dictionary changed size\nduring iteration\" when run under tracing (e.g.  code coverage\nmeasurement).  This is the same behavior already seen in e.g.  'for\nk in locals():'.  To avoid the error, first create a list of keys\nto iterate over: 'keys = list(locals()); [k for k in keys]'.\n\n(Contributed by Carl Meyer and Vladimir Matveev in PEP 709(2).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0709/\n\n(2) https://peps.python.org/pep-0709/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Improved Error Messages,  Prev: PEP 709 Comprehension inlining,  Up: New Features": {
            "content": "1.1.2.7 Improved Error Messages\n...............................\n\n* Modules from the standard library are now potentially suggested as\npart of the error messages displayed by the interpreter when a\n*note NameError: 144. is raised to the top level.  (Contributed by\nPablo Galindo in gh-98254(1).)\n\n>>> sys.versioninfo\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nNameError: name 'sys' is not defined. Did you forget to import 'sys'?\n\n* Improve the error suggestion for *note NameError: 144. exceptions\nfor instances.  Now if a *note NameError: 144. is raised in a\nmethod and the instance has an attribute that's exactly equal to\nthe name in the exception, the suggestion will include\n'self.<NAME>' instead of the closest match in the method scope.\n(Contributed by Pablo Galindo in gh-99139(2).)\n\n>>> class A:\n...    def init(self):\n...        self.blech = 1\n...\n...    def foo(self):\n...        somethin = blech\n...\n>>> A().foo()\nTraceback (most recent call last):\nFile \"<stdin>\", line 1\nsomethin = blech\n^^^^^\nNameError: name 'blech' is not defined. Did you mean: 'self.blech'?\n\n* Improve the *note SyntaxError: 146. error message when the user\ntypes 'import x from y' instead of 'from y import x'.  (Contributed\nby Pablo Galindo in gh-98931(3).)\n\n>>> import a.y.z from b.y.z\nTraceback (most recent call last):\nFile \"<stdin>\", line 1\nimport a.y.z from b.y.z\n^^^^^^^^^^^^^^^^^^^^^^^\nSyntaxError: Did you mean to use 'from ... import ...' instead?\n\n* *note ImportError: 145. exceptions raised from failed 'from\n<module> import <name>' statements now include suggestions for the\nvalue of '<name>' based on the available names in '<module>'.\n(Contributed by Pablo Galindo in gh-91058(4).)\n\n>>> from collections import chainmap\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nImportError: cannot import name 'chainmap' from 'collections'. Did you mean: 'ChainMap'?\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/98254\n\n(2) https://github.com/python/cpython/issues/99139\n\n(3) https://github.com/python/cpython/issues/98931\n\n(4) https://github.com/python/cpython/issues/91058\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: New Features Related to Type Hints,  Next: Other Language Changes,  Prev: New Features,  Up: What's New In Python 3 12": {
            "content": "This section covers major changes affecting type hints(1) and the *note\ntyping: ff. module.\n\n* Menu:\n\n* PEP 692; Using TypedDict for more precise kwargs typing: PEP 692 Using TypedDict for more precise kwargs typing.\n* PEP 698; Override Decorator for Static Typing: PEP 698 Override Decorator for Static Typing.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0484/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "1.1.3.1 PEP 692: Using 'TypedDict' for more precise 'kwargs' typing\n.....................................................................\n",
            "subsections": []
        },
        "Typing 'kwargs' in a function signature as introduced by PEP 484(1)": {
            "content": "allowed for valid annotations only in cases where all of the 'kwargs'\nwere of the same type.\n\nPEP 692(2) specifies a more precise way of typing 'kwargs' by relying\non typed dictionaries:\n\nfrom typing import TypedDict, Unpack\n\nclass Movie(TypedDict):\nname: str\nyear: int\n\ndef foo(kwargs: Unpack[Movie]): ...\n\nSee PEP 692(3) for more details.\n\n(Contributed by Franek Magiera in gh-103629(4).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0484/\n\n(2) https://peps.python.org/pep-0692/\n\n(3) https://peps.python.org/pep-0692/\n\n(4) https://github.com/python/cpython/issues/103629\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "1.1.3.2 PEP 698: Override Decorator for Static Typing\n.....................................................\n\nA new decorator *note typing.override(): 156. has been added to the\n*note typing: ff. module.  It indicates to type checkers that the method\nis intended to override a method in a superclass.  This allows type\ncheckers to catch mistakes where a method that is intended to override\nsomething in a base class does not in fact do so.\n\nExample:\n\nfrom typing import override\n\nclass Base:\ndef getcolor(self) -> str:\nreturn \"blue\"\n\nclass GoodChild(Base):\n@override  # ok: overrides Base.getcolor\ndef getcolor(self) -> str:\nreturn \"yellow\"\n\nclass BadChild(Base):\n@override  # type checker error: does not override Base.getcolor\ndef getcolour(self) -> str:\nreturn \"red\"\n\nSee PEP 698(1) for more details.\n\n(Contributed by Steven Troxler in gh-101561(2).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0698/\n\n(2) https://github.com/python/cpython/issues/101561\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Other Language Changes,  Next: New Modules,  Prev: New Features Related to Type Hints,  Up: What's New In Python 3 12": {
            "content": "* The parser now raises *note SyntaxError: 146. when parsing source\ncode containing null bytes.  (Contributed by Pablo Galindo in\ngh-96670(1).)\n\n* A backslash-character pair that is not a valid escape sequence now\ngenerates a *note SyntaxWarning: 178, instead of *note\nDeprecationWarning: 179.  For example, 're.compile(\"\\d+\\.\\d+\")' now\nemits a *note SyntaxWarning: 178. ('\"\\d\"' is an invalid escape\nsequence, use raw strings for regular expression:\n're.compile(r\"\\d+\\.\\d+\")').  In a future Python version, *note\nSyntaxError: 146. will eventually be raised, instead of *note\nSyntaxWarning: 178.  (Contributed by Victor Stinner in\ngh-98401(2).)\n\n* Octal escapes with value larger than '0o377' (ex: '\"\\477\"'),\ndeprecated in Python 3.11, now produce a *note SyntaxWarning: 178,\ninstead of *note DeprecationWarning: 179.  In a future Python\nversion they will be eventually a *note SyntaxError: 146.\n(Contributed by Victor Stinner in gh-98401(3).)\n\n* Variables used in the target part of comprehensions that are not\nstored to can now be used in assignment expressions (':=').  For\nexample, in '[(b := 1) for a, b.prop in someiter]', the assignment\nto 'b' is now allowed.  Note that assigning to variables stored to\nin the target part of comprehensions (like 'a') is still\ndisallowed, as per PEP 572(4).  (Contributed by Nikita Sobolev in\ngh-100581(5).)\n\n* Exceptions raised in a class or type's 'setname' method are no\nlonger wrapped by a *note RuntimeError: 17a.  Context information\nis added to the exception as a PEP 678(6) note.  (Contributed by\nIrit Katriel in gh-77757(7).)\n\n* When a 'try-except*' construct handles the entire *note\nExceptionGroup: 17b. and raises one other exception, that exception\nis no longer wrapped in an *note ExceptionGroup: 17b.  Also changed\nin version 3.11.4.  (Contributed by Irit Katriel in gh-103590(8).)\n\n* The Garbage Collector now runs only on the eval breaker mechanism\nof the Python bytecode evaluation loop instead of object\nallocations.  The GC can also run when *note PyErrCheckSignals():\n17c. is called so C extensions that need to run for a long time\nwithout executing any Python code also have a chance to execute the\nGC periodically.  (Contributed by Pablo Galindo in gh-97922(9).)\n\n* All builtin and extension callables expecting boolean parameters\nnow accept arguments of any type instead of just *note bool: 17d.\nand *note int: 17e.  (Contributed by Serhiy Storchaka in\ngh-60203(10).)\n\n* *note memoryview: 17f. now supports the half-float type (the \"e\"\nformat code).  (Contributed by Donghee Na and Antoine Pitrou in\ngh-90751(11).)\n\n* *note slice: 180. objects are now hashable, allowing them to be\nused as dict keys and set items.  (Contributed by Will Bradshaw,\nFurkan Onder, and Raymond Hettinger in gh-101264(12).)\n\n* *note sum(): 181. now uses Neumaier summation to improve accuracy\nand commutativity when summing floats or mixed ints and floats.\n(Contributed by Raymond Hettinger in gh-100425(13).)\n\n* *note ast.parse(): 182. now raises *note SyntaxError: 146. instead\nof *note ValueError: 183. when parsing source code containing null\nbytes.  (Contributed by Pablo Galindo in gh-96670(14).)\n\n* The extraction methods in *note tarfile: d8, and *note\nshutil.unpackarchive(): 184, have a new a 'filter' argument that\nallows limiting tar features than may be surprising or dangerous,\nsuch as creating files outside the destination directory.  See\n*note tarfile extraction filters: 185. for details.  In Python\n3.14, the default will switch to ''data''.  (Contributed by Petr\nViktorin in PEP 706(15).)\n\n* *note types.MappingProxyType: 186. instances are now hashable if\nthe underlying mapping is hashable.  (Contributed by Serhiy\nStorchaka in gh-87995(16).)\n\n* Add *note support for the perf profiler: 151. through the new\nenvironment variable *note PYTHONPERFSUPPORT: 187. and command-line\noption *note -X perf: 188, as well as the new *note\nsys.activatestacktrampoline(): 189, *note\nsys.deactivatestacktrampoline(): 18a, and *note\nsys.isstacktrampolineactive(): 18b. functions.  (Design by Pablo\nGalindo.  Contributed by Pablo Galindo and Christian Heimes with\ncontributions from Gregory P. Smith [Google] and Mark Shannon in\ngh-96123(17).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/96670\n\n(2) https://github.com/python/cpython/issues/98401\n\n(3) https://github.com/python/cpython/issues/98401\n\n(4) https://peps.python.org/pep-0572/\n\n(5) https://github.com/python/cpython/issues/100581\n\n(6) https://peps.python.org/pep-0678/\n\n(7) https://github.com/python/cpython/issues/77757\n\n(8) https://github.com/python/cpython/issues/103590\n\n(9) https://github.com/python/cpython/issues/97922\n\n(10) https://github.com/python/cpython/issues/60203\n\n(11) https://github.com/python/cpython/issues/90751\n\n(12) https://github.com/python/cpython/issues/101264\n\n(13) https://github.com/python/cpython/issues/100425\n\n(14) https://github.com/python/cpython/issues/96670\n\n(15) https://peps.python.org/pep-0706/\n\n(16) https://github.com/python/cpython/issues/87995\n\n(17) https://github.com/python/cpython/issues/96123\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: New Modules,  Next: Improved Modules,  Prev: Other Language Changes,  Up: What's New In Python 3 12": {
            "content": "* None.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Improved Modules,  Next: Optimizations,  Prev: New Modules,  Up: What's New In Python 3 12": {
            "content": "* Menu:\n\n* array::\n* asyncio::\n* calendar::\n* csv::\n* dis::\n* fractions::\n* importlib.resources: importlib resources.\n* inspect::\n* itertools::\n* math::\n* os::\n* os.path: os path.\n* pathlib::\n* pdb::\n* random::\n* shutil::\n* sqlite3::\n* statistics::\n* sys::\n* tempfile::\n* threading::\n* tkinter::\n* tokenize::\n* types::\n* typing::\n* unicodedata::\n* unittest::\n* uuid::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: array,  Next: asyncio,  Up: Improved Modules": {
            "content": "1.1.6.1 array\n.............\n\n* The *note array.array: 18f. class now supports subscripting, making\nit a *note generic type: 13b.  (Contributed by Jelle Zijlstra in\ngh-98658(1).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/98658\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: asyncio,  Next: calendar,  Prev: array,  Up: Improved Modules": {
            "content": "1.1.6.2 asyncio\n...............\n\n* The performance of writing to sockets in *note asyncio: 9. has been\nsignificantly improved.  'asyncio' now avoids unnecessary copying\nwhen writing to sockets and uses *note sendmsg(): 191. if the\nplatform supports it.  (Contributed by Kumar Aditya in\ngh-91166(1).)\n\n* Add *note asyncio.eagertaskfactory(): 192. and *note\nasyncio.createeagertaskfactory(): 193. functions to allow opting\nan event loop in to eager task execution, making some use-cases 2x\nto 5x faster.  (Contributed by Jacob Bower & Itamar Oren in\ngh-102853(2), gh-104140(3), and gh-104138(4))\n\n* On Linux, *note asyncio: 9. uses *note asyncio.PidfdChildWatcher:\n194. by default if *note os.pidfdopen(): 195. is available and\nfunctional instead of *note asyncio.ThreadedChildWatcher: 196.\n(Contributed by Kumar Aditya in gh-98024(5).)\n\n* The event loop now uses the best available child watcher for each\nplatform (*note asyncio.PidfdChildWatcher: 194. if supported and\n*note asyncio.ThreadedChildWatcher: 196. otherwise), so manually\nconfiguring a child watcher is not recommended.  (Contributed by\nKumar Aditya in gh-94597(6).)\n\n* Add 'loopfactory' parameter to *note asyncio.run(): 197. to allow\nspecifying a custom event loop factory.  (Contributed by Kumar\nAditya in gh-99388(7).)\n\n* Add C implementation of *note asyncio.currenttask(): 198. for\n4x-6x speedup.  (Contributed by Itamar Oren and Pranav Thulasiram\nBhat in gh-100344(8).)\n\n* *note asyncio.iscoroutine(): 199. now returns 'False' for\ngenerators as *note asyncio: 9. does not support legacy\ngenerator-based coroutines.  (Contributed by Kumar Aditya in\ngh-102748(9).)\n\n* *note asyncio.wait(): 19a. and *note asyncio.ascompleted(): 19b.\nnow accepts generators yielding tasks.  (Contributed by Kumar\nAditya in gh-78530(10).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/91166\n\n(2) https://github.com/python/cpython/issues/102853\n\n(3) https://github.com/python/cpython/issues/104140\n\n(4) https://github.com/python/cpython/issues/104138\n\n(5) https://github.com/python/cpython/issues/98024\n\n(6) https://github.com/python/cpython/issues/94597\n\n(7) https://github.com/python/cpython/issues/99388\n\n(8) https://github.com/python/cpython/issues/100344\n\n(9) https://github.com/python/cpython/issues/102748\n\n(10) https://github.com/python/cpython/issues/78530\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: calendar,  Next: csv,  Prev: asyncio,  Up: Improved Modules": {
            "content": "1.1.6.3 calendar\n................\n\n* Add enums *note calendar.Month: 19d. and *note calendar.Day: 19e.\ndefining months of the year and days of the week.  (Contributed by\nPrince Roshan in gh-103636(1).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/103636\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: csv,  Next: dis,  Prev: calendar,  Up: Improved Modules": {
            "content": "1.1.6.4 csv\n...........\n\n* Add *note csv.QUOTENOTNULL: 1a0. and *note csv.QUOTESTRINGS: 1a1.\nflags to provide finer grained control of 'None' and empty strings\nby *note csv.writer: 1a2. objects.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: dis,  Next: fractions,  Prev: csv,  Up: Improved Modules": {
            "content": "1.1.6.5 dis\n...........\n\n* Pseudo instruction opcodes (which are used by the compiler but do\nnot appear in executable bytecode) are now exposed in the *note\ndis: 35. module.  *note HAVEARGUMENT: 1a4. is still relevant to\nreal opcodes, but it is not useful for pseudo instructions.  Use\nthe new *note dis.hasarg: 1a5. collection instead.  (Contributed by\nIrit Katriel in gh-94216(1).)\n\n* Add the *note dis.hasexc: 1a6. collection to signify instructions\nthat set an exception handler.  (Contributed by Irit Katriel in\ngh-94216(2).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/94216\n\n(2) https://github.com/python/cpython/issues/94216\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: fractions,  Next: importlib resources,  Prev: dis,  Up: Improved Modules": {
            "content": "1.1.6.6 fractions\n.................\n\n* Objects of type *note fractions.Fraction: 1a8. now support\nfloat-style formatting.  (Contributed by Mark Dickinson in\ngh-100161(1).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/100161\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: importlib resources,  Next: inspect,  Prev: fractions,  Up: Improved Modules": {
            "content": "1.1.6.7 importlib.resources\n...........................\n\n* *note importlib.resources.asfile(): 1aa. now supports resource\ndirectories.  (Contributed by Jason R. Coombs in gh-97930(1).)\n\n* Rename first parameter of *note importlib.resources.files(): 1ab.\nto 'anchor'.  (Contributed by Jason R. Coombs in gh-100598(2).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/97930\n\n(2) https://github.com/python/cpython/issues/100598\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: inspect,  Next: itertools,  Prev: importlib resources,  Up: Improved Modules": {
            "content": "1.1.6.8 inspect\n...............\n\n* Add *note inspect.markcoroutinefunction(): 1ad. to mark sync\nfunctions that return a *note coroutine: 1ae. for use with *note\ninspect.iscoroutinefunction(): 1af.  (Contributed Carlton Gibson in\ngh-99247(1).)\n\n* Add *note inspect.getasyncgenstate(): 1b0. and *note\ninspect.getasyncgenlocals(): 1b1. for determining the current state\nof asynchronous generators.  (Contributed by Thomas Krennwallner in\ngh-79940(2).)\n\n* The performance of *note inspect.getattrstatic(): 1b2. has been\nconsiderably improved.  Most calls to the function should be at\nleast 2x faster than they were in Python 3.11, and some may be 6x\nfaster or more.  (Contributed by Alex Waygood in gh-103193(3).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/99247\n\n(2) https://github.com/python/cpython/issues/79940\n\n(3) https://github.com/python/cpython/issues/103193\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: itertools,  Next: math,  Prev: inspect,  Up: Improved Modules": {
            "content": "1.1.6.9 itertools\n.................\n\n* Add *note itertools.batched(): 1b4. for collecting into even-sized\ntuples where the last batch may be shorter than the rest.\n(Contributed by Raymond Hettinger in gh-98363(1).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/98363\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: math,  Next: os,  Prev: itertools,  Up: Improved Modules": {
            "content": "1.1.6.10 math\n.............\n\n* Add *note math.sumprod(): 1b6. for computing a sum of products.\n(Contributed by Raymond Hettinger in gh-100485(1).)\n\n* Extend *note math.nextafter(): 1b7. to include a 'steps' argument\nfor moving up or down multiple steps at a time.  (By Matthias\nGoergens, Mark Dickinson, and Raymond Hettinger in gh-94906(2).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/100485\n\n(2) https://github.com/python/cpython/issues/94906\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: os,  Next: os path,  Prev: math,  Up: Improved Modules": {
            "content": "1.1.6.11 os\n...........\n\n* Add *note os.PIDFDNONBLOCK: 1b9. to open a file descriptor for a\nprocess with *note os.pidfdopen(): 195. in non-blocking mode.\n(Contributed by Kumar Aditya in gh-93312(1).)\n\n* *note os.DirEntry: 1ba. now includes an *note\nos.DirEntry.isjunction(): 1bb. method to check if the entry is a\njunction.  (Contributed by Charles Machalow in gh-99547(2).)\n\n* Add *note os.listdrives(): 1bc, *note os.listvolumes(): 1bd. and\n*note os.listmounts(): 1be. functions on Windows for enumerating\ndrives, volumes and mount points.  (Contributed by Steve Dower in\ngh-102519(3).)\n\n* *note os.stat(): 1bf. and *note os.lstat(): 1c0. are now more\naccurate on Windows.  The 'stbirthtime' field will now be filled\nwith the creation time of the file, and 'stctime' is deprecated\nbut still contains the creation time (but in the future will return\nthe last metadata change, for consistency with other platforms).\n'stdev' may be up to 64 bits and 'stino' up to 128 bits depending\non your file system, and 'strdev' is always set to zero rather\nthan incorrect values.  Both functions may be significantly faster\non newer releases of Windows.  (Contributed by Steve Dower in\ngh-99726(4).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/93312\n\n(2) https://github.com/python/cpython/issues/99547\n\n(3) https://github.com/python/cpython/issues/102519\n\n(4) https://github.com/python/cpython/issues/99726\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: os path,  Next: pathlib,  Prev: os,  Up: Improved Modules": {
            "content": "1.1.6.12 os.path\n................\n\n* Add *note os.path.isjunction(): 1c2. to check if a given path is a\njunction.  (Contributed by Charles Machalow in gh-99547(1).)\n\n* Add *note os.path.splitroot(): 1c3. to split a path into a triad\n'(drive, root, tail)'.  (Contributed by Barney Gale in\ngh-101000(2).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/99547\n\n(2) https://github.com/python/cpython/issues/101000\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: pathlib,  Next: pdb,  Prev: os path,  Up: Improved Modules": {
            "content": "1.1.6.13 pathlib\n................\n\n* Add support for subclassing *note pathlib.PurePath: 1c5. and *note\npathlib.Path: 149, plus their Posix- and Windows-specific variants.\nSubclasses may override the *note pathlib.PurePath.withsegments():\n1c6. method to pass information between path instances.\n\n* Add *note pathlib.Path.walk(): 1c7. for walking the directory trees\nand generating all file or directory names within them, similar to\n*note os.walk(): 1c8.  (Contributed by Stanislav Zmiev in\ngh-90385(1).)\n\n* Add 'walkup' optional parameter to *note\npathlib.PurePath.relativeto(): 1c9. to allow the insertion of '..'\nentries in the result; this behavior is more consistent with *note\nos.path.relpath(): 1ca.  (Contributed by Domenico Ragusa in\ngh-84538(2).)\n\n* Add *note pathlib.Path.isjunction(): 1cb. as a proxy to *note\nos.path.isjunction(): 1c2.  (Contributed by Charles Machalow in\ngh-99547(3).)\n\n* Add 'casesensitive' optional parameter to *note\npathlib.Path.glob(): 1cc, *note pathlib.Path.rglob(): 1cd. and\n*note pathlib.PurePath.match(): 1ce. for matching the path's case\nsensitivity, allowing for more precise control over the matching\nprocess.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/90385\n\n(2) https://github.com/python/cpython/issues/84538\n\n(3) https://github.com/python/cpython/issues/99547\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: pdb,  Next: random,  Prev: pathlib,  Up: Improved Modules": {
            "content": "1.1.6.14 pdb\n............\n\n* Add convenience variables to hold values temporarily for debug\nsession and provide quick access to values like the current frame\nor the return value.  (Contributed by Tian Gao in gh-103693(1).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/103693\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: random,  Next: shutil,  Prev: pdb,  Up: Improved Modules": {
            "content": "1.1.6.15 random\n...............\n\n* Add *note random.binomialvariate(): 1d1.  (Contributed by Raymond\nHettinger in gh-81620(1).)\n\n* Add a default of 'lambd=1.0' to *note random.expovariate(): 1d2.\n(Contributed by Raymond Hettinger in gh-100234(2).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/81620\n\n(2) https://github.com/python/cpython/issues/100234\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: shutil,  Next: sqlite3,  Prev: random,  Up: Improved Modules": {
            "content": "1.1.6.16 shutil\n...............\n\n* *note shutil.makearchive(): 1d4. now passes the 'rootdir'\nargument to custom archivers which support it.  In this case it no\nlonger temporarily changes the current working directory of the\nprocess to 'rootdir' to perform archiving.  (Contributed by Serhiy\nStorchaka in gh-74696(1).)\n\n* *note shutil.rmtree(): 1d5. now accepts a new argument 'onexc'\nwhich is an error handler like 'onerror' but which expects an\nexception instance rather than a '(typ, val, tb)' triplet.\n'onerror' is deprecated.  (Contributed by Irit Katriel in\ngh-102828(2).)\n\n* *note shutil.which(): 1d6. now consults the 'PATHEXT' environment\nvariable to find matches within 'PATH' on Windows even when the\ngiven 'cmd' includes a directory component.  (Contributed by\nCharles Machalow in gh-103179(3).)\n\n*note shutil.which(): 1d6. will call\n'NeedCurrentDirectoryForExePathW' when querying for executables on\nWindows to determine if the current working directory should be\nprepended to the search path.  (Contributed by Charles Machalow in\ngh-103179(4).)\n\n*note shutil.which(): 1d6. will return a path matching the 'cmd'\nwith a component from 'PATHEXT' prior to a direct match elsewhere\nin the search path on Windows.  (Contributed by Charles Machalow in\ngh-103179(5).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/74696\n\n(2) https://github.com/python/cpython/issues/102828\n\n(3) https://github.com/python/cpython/issues/103179\n\n(4) https://github.com/python/cpython/issues/103179\n\n(5) https://github.com/python/cpython/issues/103179\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: sqlite3,  Next: statistics,  Prev: shutil,  Up: Improved Modules": {
            "content": "1.1.6.17 sqlite3\n................\n\n* Add a *note command-line interface: 14a.  (Contributed by Erlend E.\nAasland in gh-77617(1).)\n\n* Add the *note sqlite3.Connection.autocommit: 1d8. attribute to\n*note sqlite3.Connection: 1d9. and the 'autocommit' parameter to\n*note sqlite3.connect(): 1da. to control PEP 249(2)-compliant *note\ntransaction handling: 1db.  (Contributed by Erlend E. Aasland in\ngh-83638(3).)\n\n* Add 'entrypoint' keyword-only parameter to *note\nsqlite3.Connection.loadextension(): 1dc, for overriding the SQLite\nextension entry point.  (Contributed by Erlend E. Aasland in\ngh-103015(4).)\n\n* Add *note sqlite3.Connection.getconfig(): 1dd. and *note\nsqlite3.Connection.setconfig(): 1de. to *note sqlite3.Connection:\n1d9. to make configuration changes to a database connection.\n(Contributed by Erlend E. Aasland in gh-103489(5).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/77617\n\n(2) https://peps.python.org/pep-0249/\n\n(3) https://github.com/python/cpython/issues/83638\n\n(4) https://github.com/python/cpython/issues/103015\n\n(5) https://github.com/python/cpython/issues/103489\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: statistics,  Next: sys,  Prev: sqlite3,  Up: Improved Modules": {
            "content": "1.1.6.18 statistics\n...................\n\n* Extend *note statistics.correlation(): 1e0. to include as a\n'ranked' method for computing the Spearman correlation of ranked\ndata.  (Contributed by Raymond Hettinger in gh-95861(1).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/95861\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: sys,  Next: tempfile,  Prev: statistics,  Up: Improved Modules": {
            "content": "1.1.6.19 sys\n............\n\n* Add the *note sys.monitoring: d4. namespace to expose the new *note\nPEP 669: 142. monitoring API. (Contributed by Mark Shannon in\ngh-103082(1).)\n\n* Add *note sys.activatestacktrampoline(): 189. and *note\nsys.deactivatestacktrampoline(): 18a. for activating and\ndeactivating stack profiler trampolines, and *note\nsys.isstacktrampolineactive(): 18b. for querying if stack\nprofiler trampolines are active.  (Contributed by Pablo Galindo and\nChristian Heimes with contributions from Gregory P. Smith [Google]\nand Mark Shannon in gh-96123(2).)\n\n* Add *note sys.lastexc: 1e2. which holds the last unhandled\nexception that was raised (for post-mortem debugging use cases).\nDeprecate the three fields that have the same information in its\nlegacy form: *note sys.lasttype: 1e3, *note sys.lastvalue: 1e4.\nand *note sys.lasttraceback: 1e5.  (Contributed by Irit Katriel in\ngh-102778(3).)\n\n* *note sys.currentexceptions(): 1e6. now returns a mapping from\nthread-id to an exception instance, rather than to a '(typ, exc,\ntb)' tuple.  (Contributed by Irit Katriel in gh-103176(4).)\n\n* *note sys.setrecursionlimit(): 1e7. and *note\nsys.getrecursionlimit(): 1e8.  The recursion limit now applies only\nto Python code.  Builtin functions do not use the recursion limit,\nbut are protected by a different mechanism that prevents recursion\nfrom causing a virtual machine crash.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/103082\n\n(2) https://github.com/python/cpython/issues/96123\n\n(3) https://github.com/python/cpython/issues/102778\n\n(4) https://github.com/python/cpython/issues/103176\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: tempfile,  Next: threading,  Prev: sys,  Up: Improved Modules": {
            "content": "1.1.6.20 tempfile\n.................\n\n* The *note tempfile.NamedTemporaryFile: 1ea. function has a new\noptional parameter 'deleteonclose' (Contributed by Evgeny Zorin\nin gh-58451(1).)\n\n* *note tempfile.mkdtemp(): 1eb. now always returns an absolute path,\neven if the argument provided to the 'dir' parameter is a relative\npath.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/58451\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: threading,  Next: tkinter,  Prev: tempfile,  Up: Improved Modules": {
            "content": "1.1.6.21 threading\n..................\n\n* Add *note threading.settraceallthreads(): 1ee. and *note\nthreading.setprofileallthreads(): 1ef. that allow to set tracing\nand profiling functions in all running threads in addition to the\ncalling one.  (Contributed by Pablo Galindo in gh-93503(1).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/93503\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: tkinter,  Next: tokenize,  Prev: threading,  Up: Improved Modules": {
            "content": "1.1.6.22 tkinter\n................\n\n* 'tkinter.Canvas.coords()' now flattens its arguments.  It now\naccepts not only coordinates as separate arguments ('x1, y1, x2,\ny2, ...') and a sequence of coordinates ('[x1, y1, x2, y2, ...]'),\nbut also coordinates grouped in pairs ('(x1, y1), (x2, y2), ...'\nand '[(x1, y1), (x2, y2), ...]'), like 'create*()' methods.\n(Contributed by Serhiy Storchaka in gh-94473(1).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/94473\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: tokenize,  Next: types,  Prev: tkinter,  Up: Improved Modules": {
            "content": "1.1.6.23 tokenize\n.................\n\n* The *note tokenize: f6. module includes the changes introduced in\nPEP 701(1).  (Contributed by Marta G??mez Mac??as and Pablo Galindo\nin gh-102856(2).)  See *note Porting to Python 3.12: 1f2. for more\ninformation on the changes to the *note tokenize: f6. module.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0701/\n\n(2) https://github.com/python/cpython/issues/102856\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: types,  Next: typing,  Prev: tokenize,  Up: Improved Modules": {
            "content": "1.1.6.24 types\n..............\n\n* Add *note types.getoriginalbases(): 1f4. to allow for further\nintrospection of *note User-defined generic types: 1f5. when\nsubclassed.  (Contributed by James Hilton-Balfe and Alex Waygood in\ngh-101827(1).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/101827\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: typing,  Next: unicodedata,  Prev: types,  Up: Improved Modules": {
            "content": "1.1.6.25 typing\n...............\n\n* *note isinstance(): 14b. checks against *note runtime-checkable\nprotocols: 14c. now use *note inspect.getattrstatic(): 1b2. rather\nthan *note hasattr(): 1f7. to lookup whether attributes exist.\nThis means that descriptors and *note getattr(): 1f8. methods\nare no longer unexpectedly evaluated during 'isinstance()' checks\nagainst runtime-checkable protocols.  However, it may also mean\nthat some objects which used to be considered instances of a\nruntime-checkable protocol may no longer be considered instances of\nthat protocol on Python 3.12+, and vice versa.  Most users are\nunlikely to be affected by this change.  (Contributed by Alex\nWaygood in gh-102433(1).)\n\n* The members of a runtime-checkable protocol are now considered\n\"frozen\" at runtime as soon as the class has been created.\nMonkey-patching attributes onto a runtime-checkable protocol will\nstill work, but will have no impact on *note isinstance(): 14b.\nchecks comparing objects to the protocol.  For example:\n\n>>> from typing import Protocol, runtimecheckable\n>>> @runtimecheckable\n... class HasX(Protocol):\n...     x = 1\n...\n>>> class Foo: ...\n...\n>>> f = Foo()\n>>> isinstance(f, HasX)\nFalse\n>>> f.x = 1\n>>> isinstance(f, HasX)\nTrue\n>>> HasX.y = 2\n>>> isinstance(f, HasX)  # unchanged, even though HasX now also has a \"y\" attribute\nTrue\n\nThis change was made in order to speed up 'isinstance()' checks\nagainst runtime-checkable protocols.\n\n* The performance profile of *note isinstance(): 14b. checks against\n*note runtime-checkable protocols: 14c. has changed significantly.\nMost 'isinstance()' checks against protocols with only a few\nmembers should be at least 2x faster than in 3.11, and some may be\n20x faster or more.  However, 'isinstance()' checks against\nprotocols with fourteen or more members may be slower than in\nPython 3.11.  (Contributed by Alex Waygood in gh-74690(2) and\ngh-103193(3).)\n\n* All *note typing.TypedDict: 153. and *note typing.NamedTuple: 1f9.\nclasses now have the 'origbases' attribute.  (Contributed by\nAdrian Garcia Badaracco in gh-103699(4).)\n\n* Add 'frozendefault' parameter to *note\ntyping.dataclasstransform(): 1fa.  (Contributed by Erik De Bonte\nin gh-99957(5).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/102433\n\n(2) https://github.com/python/cpython/issues/74690\n\n(3) https://github.com/python/cpython/issues/103193\n\n(4) https://github.com/python/cpython/issues/103699\n\n(5) https://github.com/python/cpython/issues/99957\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: unicodedata,  Next: unittest,  Prev: typing,  Up: Improved Modules": {
            "content": "1.1.6.26 unicodedata\n....................\n\n* The Unicode database has been updated to version 15.0.0.\n(Contributed by Benjamin Peterson in gh-96734(1)).\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/96734\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: unittest,  Next: uuid,  Prev: unicodedata,  Up: Improved Modules": {
            "content": "1.1.6.27 unittest\n.................\n",
            "subsections": []
        },
        "Add a '--durations' command line option, showing the N slowest test": {
            "content": "cases:\n\npython3 -m unittest --durations=3 lib.tests.testthreading\n.....\n1.210s     testtimeout (Lib.test.testthreading.BarrierTests)\n1.003s     testdefaulttimeout (Lib.test.testthreading.BarrierTests)\n0.518s     testtimeout (Lib.test.testthreading.EventTests)\n\nRan 158 tests in 9.869s\n\nOK (skipped=3)\n\n(Contributed by Giampaolo Rodola in gh-48330(1))\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/48330\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: uuid,  Prev: unittest,  Up: Improved Modules": {
            "content": "1.1.6.28 uuid\n.............\n\n* Add a *note command-line interface: 14d.  (Contributed by Adam\nChhina in gh-88597(1).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/88597\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Optimizations,  Next: CPython bytecode changes,  Prev: Improved Modules,  Up: What's New In Python 3 12": {
            "content": "* Remove 'wstr' and 'wstrlength' members from Unicode objects.  It\nreduces object size by 8 or 16 bytes on 64bit platform.  ( PEP\n623(1)) (Contributed by Inada Naoki in gh-92536(2).)\n\n* Add experimental support for using the BOLT binary optimizer in the\nbuild process, which improves performance by 1-5%.  (Contributed by\nKevin Modzelewski in gh-90536(3) and tuned by Donghee Na in\ngh-101525(4))\n\n* Speed up the regular expression substitution (functions *note\nre.sub(): 1ff. and *note re.subn(): 200. and corresponding\n're.Pattern' methods) for replacement strings containing group\nreferences by 2-3 times.  (Contributed by Serhiy Storchaka in\ngh-91524(5).)\n\n* Speed up *note asyncio.Task: 201. creation by deferring expensive\nstring formatting.  (Contributed by Itamar Oren in gh-103793(6).)\n\n* The *note tokenize.tokenize(): 202. and *note\ntokenize.generatetokens(): 203. functions are up to 64% faster as\na side effect of the changes required to cover PEP 701(7) in the\n*note tokenize: f6. module.  (Contributed by Marta G??mez Mac??as and\nPablo Galindo in gh-102856(8).)\n\n* Speed up *note super(): 204. method calls and attribute loads via\nthe new *note LOADSUPERATTR: 205. instruction.  (Contributed by\nCarl Meyer and Vladimir Matveev in gh-103497(9).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0623/\n\n(2) https://github.com/python/cpython/issues/92536\n\n(3) https://github.com/python/cpython/issues/90536\n\n(4) https://github.com/python/cpython/issues/101525\n\n(5) https://github.com/python/cpython/issues/91524\n\n(6) https://github.com/python/cpython/issues/103793\n\n(7) https://peps.python.org/pep-0701/\n\n(8) https://github.com/python/cpython/issues/102856\n\n(9) https://github.com/python/cpython/issues/103497\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: CPython bytecode changes,  Next: Demos and Tools,  Prev: Optimizations,  Up: What's New In Python 3 12": {
            "content": "* Remove the 'LOADMETHOD' instruction.  It has been merged into\n*note LOADATTR: 207.  *note LOADATTR: 207. will now behave like\nthe old 'LOADMETHOD' instruction if the low bit of its oparg is\nset.  (Contributed by Ken Jin in gh-93429(1).)\n\n* Remove the 'JUMPIFFALSEORPOP' and 'JUMPIFTRUEORPOP'\ninstructions.  (Contributed by Irit Katriel in gh-102859(2).)\n\n* Remove the 'PRECALL' instruction.  (Contributed by Mark Shannon in\ngh-92925(3).)\n\n* Add the *note BINARYSLICE: 208. and *note STORESLICE: 209.\ninstructions.  (Contributed by Mark Shannon in gh-94163(4).)\n\n* Add the *note CALLINTRINSIC1: 20a. instructions.  (Contributed by\nMark Shannon in gh-99005(5).)\n\n* Add the *note CALLINTRINSIC2: 20b. instruction.  (Contributed by\nIrit Katriel in gh-101799(6).)\n\n* Add the *note CLEANUPTHROW: 20c. instruction.  (Contributed by\nBrandt Bucher in gh-90997(7).)\n\n* Add the 'ENDSEND' instruction.  (Contributed by Mark Shannon in\ngh-103082(8).)\n\n* Add the *note LOADFASTANDCLEAR: 20d. instruction as part of the\nimplementation of PEP 709(9).  (Contributed by Carl Meyer in\ngh-101441(10).)\n\n* Add the *note LOADFASTCHECK: 20e. instruction.  (Contributed by\nDennis Sweeney in gh-93143(11).)\n\n* Add the *note LOADFROMDICTORDEREF: 20f, *note\nLOADFROMDICTORGLOBALS: 210, and *note LOADLOCALS: 211. opcodes\nas part of the implementation of PEP 695(12).  Remove the\n'LOADCLASSDEREF' opcode, which can be replaced with *note\nLOADLOCALS: 211. plus *note LOADFROMDICTORDEREF: 20f.\n(Contributed by Jelle Zijlstra in gh-103764(13).)\n\n* Add the *note LOADSUPERATTR: 205. instruction.  (Contributed by\nCarl Meyer and Vladimir Matveev in gh-103497(14).)\n\n* Add the *note RETURNCONST: 212. instruction.  (Contributed by\nWenyang Wang in gh-101632(15).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/93429\n\n(2) https://github.com/python/cpython/issues/102859\n\n(3) https://github.com/python/cpython/issues/92925\n\n(4) https://github.com/python/cpython/issues/94163\n\n(5) https://github.com/python/cpython/issues/99005\n\n(6) https://github.com/python/cpython/issues/101799\n\n(7) https://github.com/python/cpython/issues/90997\n\n(8) https://github.com/python/cpython/issues/103082\n\n(9) https://peps.python.org/pep-0709/\n\n(10) https://github.com/python/cpython/issues/101441\n\n(11) https://github.com/python/cpython/issues/93143\n\n(12) https://peps.python.org/pep-0695/\n\n(13) https://github.com/python/cpython/issues/103764\n\n(14) https://github.com/python/cpython/issues/103497\n\n(15) https://github.com/python/cpython/issues/101632\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Demos and Tools,  Next: Deprecated,  Prev: CPython bytecode changes,  Up: What's New In Python 3 12": {
            "content": "* Remove the 'Tools/demo/' directory which contained old demo\nscripts.  A copy can be found in the old-demos project(1).\n(Contributed by Victor Stinner in gh-97681(2).)\n\n* Remove outdated example scripts of the 'Tools/scripts/' directory.\nA copy can be found in the old-demos project(3).  (Contributed by\nVictor Stinner in gh-97669(4).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/gvanrossum/old-demos\n\n(2) https://github.com/python/cpython/issues/97681\n\n(3) https://github.com/gvanrossum/old-demos\n\n(4) https://github.com/python/cpython/issues/97669\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Deprecated,  Next: Removed,  Prev: Demos and Tools,  Up: What's New In Python 3 12": {
            "content": "* *note argparse: 6.: The 'type', 'choices', and 'metavar' parameters\nof 'argparse.BooleanOptionalAction' are deprecated and will be\nremoved in 3.14.  (Contributed by Nikita Sobolev in gh-92248(1).)\n\n* *note ast: 8.: The following *note ast: 8. features have been\ndeprecated in documentation since Python 3.8, now cause a *note\nDeprecationWarning: 179. to be emitted at runtime when they are\naccessed or used, and will be removed in Python 3.14:\n\n* 'ast.Num'\n\n* 'ast.Str'\n\n* 'ast.Bytes'\n\n* 'ast.NameConstant'\n\n* 'ast.Ellipsis'\n\nUse *note ast.Constant: 215. instead.  (Contributed by Serhiy\nStorchaka in gh-90953(2).)\n\n* *note asyncio: 9.:\n\n* The child watcher classes *note asyncio.MultiLoopChildWatcher:\n216, *note asyncio.FastChildWatcher: 217, *note\nasyncio.AbstractChildWatcher: 218. and *note\nasyncio.SafeChildWatcher: 219. are deprecated and will be\nremoved in Python 3.14.  (Contributed by Kumar Aditya in\ngh-94597(3).)\n\n* *note asyncio.setchildwatcher(): 21a, *note\nasyncio.getchildwatcher(): 21b, *note\nasyncio.AbstractEventLoopPolicy.setchildwatcher(): 21c. and\n*note asyncio.AbstractEventLoopPolicy.getchildwatcher():\n21d. are deprecated and will be removed in Python 3.14.\n(Contributed by Kumar Aditya in gh-94597(4).)\n\n* The *note geteventloop(): 21e. method of the default event\nloop policy now emits a *note DeprecationWarning: 179. if\nthere is no current event loop set and it decides to create\none.  (Contributed by Serhiy Storchaka and Guido van Rossum in\ngh-100160(5).)\n\n* *note calendar: 12.: 'calendar.January' and 'calendar.February'\nconstants are deprecated and replaced by *note calendar.JANUARY:\n21f. and *note calendar.FEBRUARY: 220.  (Contributed by Prince\nRoshan in gh-103636(6).)\n\n* *note collections.abc: 1c.: Deprecated *note\ncollections.abc.ByteString: 221.  Prefer 'Sequence' or *note\ncollections.abc.Buffer: 170.  For use in typing, prefer a union,\nlike 'bytes | bytearray', or *note collections.abc.Buffer: 170.\n(Contributed by Shantanu Jain in gh-91896(7).)\n\n* *note datetime: 2e.: *note datetime.datetime: 222.'s *note\nutcnow(): 223. and *note utcfromtimestamp(): 224. are deprecated\nand will be removed in a future version.  Instead, use\ntimezone-aware objects to represent datetimes in UTC: respectively,\ncall *note now(): 225. and *note fromtimestamp(): 226. with the\n'tz' parameter set to *note datetime.UTC: 227.  (Contributed by\nPaul Ganssle in gh-103857(8).)\n\n* *note email: 37.: Deprecate the 'isdst' parameter in *note\nemail.utils.localtime(): 228.  (Contributed by Alan Williams in\ngh-72346(9).)\n\n* *note importlib.abc: 72.: Deprecated the following classes,\nscheduled for removal in Python 3.14:\n\n* 'importlib.abc.ResourceReader'\n\n* 'importlib.abc.Traversable'\n\n* 'importlib.abc.TraversableResources'\n\nUse *note importlib.resources.abc: 76. classes instead:\n\n* *note importlib.resources.abc.Traversable: 229.\n\n* *note importlib.resources.abc.TraversableResources: 22a.\n\n(Contributed by Jason R. Coombs and Hugo van Kemenade in\ngh-93963(10).)\n\n* *note itertools: 7b.: Deprecate the support for copy, deepcopy, and\npickle operations, which is undocumented, inefficient, historically\nbuggy, and inconsistent.  This will be removed in 3.14 for a\nsignificant reduction in code volume and maintenance burden.\n(Contributed by Raymond Hettinger in gh-101588(11).)\n\n* *note multiprocessing: 8f.: In Python 3.14, the default *note\nmultiprocessing: 8f. start method will change to a safer one on\nLinux, BSDs, and other non-macOS POSIX platforms where ''fork'' is\ncurrently the default (gh-84559(12)).  Adding a runtime warning\nabout this was deemed too disruptive as the majority of code is not\nexpected to care.  Use the *note getcontext(): 22b. or *note\nsetstartmethod(): 22c. APIs to explicitly specify when your code\n'requires' ''fork''.  See *note contexts and start methods: 22d.\n\n* *note pkgutil: a4.: *note pkgutil.findloader(): 22e. and *note\npkgutil.getloader(): 22f. are deprecated and will be removed in\nPython 3.14; use *note importlib.util.findspec(): 230. instead.\n(Contributed by Nikita Sobolev in gh-97850(13).)\n\n* *note pty: ac.: The module has two undocumented 'masteropen()' and\n'slaveopen()' functions that have been deprecated since Python 2\nbut only gained a proper *note DeprecationWarning: 179. in 3.12.\nRemove them in 3.14.  (Contributed by Soumendra Ganguly and Gregory\nP. Smith in gh-85984(14).)\n\n* *note os: 9c.:\n\n* The 'stctime' fields return by *note os.stat(): 1bf. and\n*note os.lstat(): 1c0. on Windows are deprecated.  In a future\nrelease, they will contain the last metadata change time,\nconsistent with other platforms.  For now, they still contain\nthe creation time, which is also available in the new\n'stbirthtime' field.  (Contributed by Steve Dower in\ngh-99726(15).)\n\n* On POSIX platforms, *note os.fork(): 231. can now raise a\n*note DeprecationWarning: 179. when it can detect being called\nfrom a multithreaded process.  There has always been a\nfundamental incompatibility with the POSIX platform when doing\nso.  Even if such code 'appeared' to work.  We added the\nwarning to to raise awareness as issues encounted by code\ndoing this are becoming more frequent.  See the *note\nos.fork(): 231. documentation for more details along with this\ndiscussion on fork being incompatible with threads(16) for\n'why' we're now surfacing this longstanding platform\ncompatibility problem to developers.\n\nWhen this warning appears due to usage of *note multiprocessing:\n8f. or *note concurrent.futures: 1f. the fix is to use a different\n*note multiprocessing: 8f. start method such as '\"spawn\"' or\n'\"forkserver\"'.\n\n* *note shutil: c0.: The 'onerror' argument of *note shutil.rmtree():\n1d5. is deprecated; use 'onexc' instead.  (Contributed by Irit\nKatriel in gh-102828(17).)\n\n* *note sqlite3: c9.:\n\n* *note default adapters and converters: 232. are now\ndeprecated.  Instead, use the *note Adapter and converter\nrecipes: 233. and tailor them to your needs.  (Contributed by\nErlend E. Aasland in gh-90016(18).)\n\n* In *note execute(): 234, *note DeprecationWarning: 179. is now\nemitted when *note named placeholders: 235. are used together\nwith parameters supplied as a *note sequence: 236. instead of\nas a *note dict: 237.  Starting from Python 3.14, using named\nplaceholders with parameters supplied as a sequence will raise\na *note ProgrammingError: 238.  (Contributed by Erlend E.\nAasland in gh-101698(19).)\n\n* *note sys: d3.: The *note sys.lasttype: 1e3, *note sys.lastvalue:\n1e4. and *note sys.lasttraceback: 1e5. fields are deprecated.  Use\n*note sys.lastexc: 1e2. instead.  (Contributed by Irit Katriel in\ngh-102778(20).)\n\n* *note tarfile: d8.: Extracting tar archives without specifying\n'filter' is deprecated until Python 3.14, when ''data'' filter will\nbecome the default.  See *note Extraction filters: 185. for\ndetails.\n\n* *note typing: ff.:\n\n* *note typing.Hashable: 239. and *note typing.Sized: 23a,\naliases for *note collections.abc.Hashable: 23b. and *note\ncollections.abc.Sized: 23c. respectively, are deprecated.\n(gh-94309(21).)\n\n* *note typing.ByteString: 23d, deprecated since Python 3.9, now\ncauses a *note DeprecationWarning: 179. to be emitted when it\nis used.  (Contributed by Alex Waygood in gh-91896(22).)\n\n* *note xml.etree.ElementTree: 120.: The module now emits *note\nDeprecationWarning: 179. when testing the truth value of an *note\nxml.etree.ElementTree.Element: 23e.  Before, the Python\nimplementation emitted *note FutureWarning: 23f, and the C\nimplementation emitted nothing.  (Contributed by Jacob Walls in\ngh-83122(23).)\n\n* The 3-arg signatures (type, value, traceback) of *note coroutine\nthrow(): 240, *note generator throw(): 241. and *note async\ngenerator throw(): 242. are deprecated and may be removed in a\nfuture version of Python.  Use the single-arg versions of these\nfunctions instead.  (Contributed by Ofey Chan in gh-89874(24).)\n\n* *note DeprecationWarning: 179. is now raised when 'package' on\na module differs from 'spec.parent' (previously it was *note\nImportWarning: 243.).  (Contributed by Brett Cannon in\ngh-65961(25).)\n\n* Setting 'package' or 'cached' on a module is deprecated,\nand will cease to be set or taken into consideration by the import\nsystem in Python 3.14.  (Contributed by Brett Cannon in\ngh-65961(26).)\n\n* The bitwise inversion operator ('~') on bool is deprecated.  It\nwill throw an error in Python 3.14.  Use 'not' for logical negation\nof bools instead.  In the rare case that you really need the\nbitwise inversion of the underlying 'int', convert to int\nexplicitly: '~int(x)'.  (Contributed by Tim Hoffmann in\ngh-103487(27).)\n\n* Accessing *note colnotab: 244. on code objects was deprecated in\nPython 3.10 via PEP 626(28), but it only got a proper *note\nDeprecationWarning: 179. in 3.12, therefore it will be removed in\n3.14.  (Contributed by Nikita Sobolev in gh-101866(29).)\n\n* Menu:\n\n* Pending Removal in Python 3.13: Pending Removal in Python 3 13.\n* Pending Removal in Python 3.14: Pending Removal in Python 3 14.\n* Pending Removal in Python 3.15: Pending Removal in Python 3 15.\n* Pending Removal in Future Versions::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/92248\n\n(2) https://github.com/python/cpython/issues/90953\n\n(3) https://github.com/python/cpython/issues/94597\n\n(4) https://github.com/python/cpython/issues/94597\n\n(5) https://github.com/python/cpython/issues/100160\n\n(6) https://github.com/python/cpython/issues/103636\n\n(7) https://github.com/python/cpython/issues/91896\n\n(8) https://github.com/python/cpython/issues/103857\n\n(9) https://github.com/python/cpython/issues/72346\n\n(10) https://github.com/python/cpython/issues/93963\n\n(11) https://github.com/python/cpython/issues/101588\n\n(12) https://github.com/python/cpython/issues/84559\n\n(13) https://github.com/python/cpython/issues/97850\n\n(14) https://github.com/python/cpython/issues/85984\n\n(15) https://github.com/python/cpython/issues/99726\n\n(16) https://discuss.python.org/t/33555\n\n(17) https://github.com/python/cpython/issues/102828\n\n(18) https://github.com/python/cpython/issues/90016\n\n(19) https://github.com/python/cpython/issues/101698\n\n(20) https://github.com/python/cpython/issues/102778\n\n(21) https://github.com/python/cpython/issues/94309\n\n(22) https://github.com/python/cpython/issues/91896\n\n(23) https://github.com/python/cpython/issues/83122\n\n(24) https://github.com/python/cpython/issues/89874\n\n(25) https://github.com/python/cpython/issues/65961\n\n(26) https://github.com/python/cpython/issues/65961\n\n(27) https://github.com/python/cpython/issues/103487\n\n(28) https://peps.python.org/pep-0626/\n\n(29) https://github.com/python/cpython/issues/101866\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Pending Removal in Python 3 13,  Next: Pending Removal in Python 3 14,  Up: Deprecated": {
            "content": "1.1.10.1 Pending Removal in Python 3.13\n.......................................\n",
            "subsections": []
        },
        "The following modules and APIs have been deprecated in earlier Python": {
            "content": "releases, and will be removed in Python 3.13.\n\nModules (see PEP 594(1)):\n\n* *note aifc: 5.\n\n* *note audioop: b.\n\n* *note cgi: 13.\n\n* *note cgitb: 14.\n\n* *note chunk: 15.\n\n* *note crypt: 26.\n\n* *note imghdr: 70.\n\n* *note mailcap: 87.\n\n* *note msilib: 8d.\n\n* *note nis: 97.\n\n* *note nntplib: 98.\n\n* *note ossaudiodev: 9e.\n\n* *note pipes: a3.\n\n* *note sndhdr: c5.\n\n* *note spwd: c8.\n\n* *note sunau: d1.\n\n* *note telnetlib: d9.\n\n* *note uu: 10a.\n\n* *note xdrlib: 11a.\n\nOther modules:\n\n* 'lib2to3', and the '2to3' program (gh-84540(2))\n\nAPIs:\n\n* 'configparser.LegacyInterpolation' (gh-90765(3))\n\n* 'locale.resetlocale()' (gh-90817(4))\n\n* 'turtle.RawTurtle.settiltangle()' (gh-50096(5))\n\n* 'unittest.findTestCases()' (gh-50096(6))\n\n* 'unittest.getTestCaseNames()' (gh-50096(7))\n\n* 'unittest.makeSuite()' (gh-50096(8))\n\n* 'unittest.TestProgram.usageExit()' (gh-67048(9))\n\n* 'webbrowser.MacOSX' (gh-86421(10))\n\n* *note classmethod: 246. descriptor chaining (gh-89519(11))\n\n* *note importlib.resources: 75. deprecated methods:\n\n* 'contents()'\n\n* 'isresource()'\n\n* 'openbinary()'\n\n* 'opentext()'\n\n* 'path()'\n\n* 'readbinary()'\n\n* 'readtext()'\n\nUse *note importlib.resources.files(): 1ab. instead.  Refer to\nimportlib-resources: Migrating from Legacy(12) (gh-106531(13))\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0594/\n\n(2) https://github.com/python/cpython/issues/84540\n\n(3) https://github.com/python/cpython/issues/90765\n\n(4) https://github.com/python/cpython/issues/90817\n\n(5) https://github.com/python/cpython/issues/50096\n\n(6) https://github.com/python/cpython/issues/50096\n\n(7) https://github.com/python/cpython/issues/50096\n\n(8) https://github.com/python/cpython/issues/50096\n\n(9) https://github.com/python/cpython/issues/67048\n\n(10) https://github.com/python/cpython/issues/86421\n\n(11) https://github.com/python/cpython/issues/89519\n\n(12)\nhttps://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy\n\n(13) https://github.com/python/cpython/issues/106531\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Pending Removal in Python 3 14,  Next: Pending Removal in Python 3 15,  Prev: Pending Removal in Python 3 13,  Up: Deprecated": {
            "content": "1.1.10.2 Pending Removal in Python 3.14\n.......................................\n",
            "subsections": []
        },
        "The following APIs have been deprecated and will be removed in Python": {
            "content": "3.15.\n\nAPIs:\n\n* *note locale.getdefaultlocale(): 249. (gh-90817(1))\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/90817\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Pending Removal in Python 3 15,  Next: Pending Removal in Future Versions,  Prev: Pending Removal in Python 3 14,  Up: Deprecated": {
            "content": "1.1.10.3 Pending Removal in Python 3.15\n.......................................\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Pending Removal in Future Versions,  Prev: Pending Removal in Python 3 15,  Up: Deprecated": {
            "content": "1.1.10.4 Pending Removal in Future Versions\n...........................................\n",
            "subsections": []
        },
        "The following APIs were deprecated in earlier Python versions and will": {
            "content": "be removed, although there is currently no date scheduled for their\nremoval.\n\n* *note array: 7.'s ''u'' format code (gh-57281(1))\n\n* *note typing.Text: 24b. (gh-92332(2))\n\n* Currently Python accepts numeric literals immediately followed by\nkeywords, for example '0in x', '1or x', '0if 1else 2'.  It allows\nconfusing and ambiguous expressions like '[0x1for x in y]' (which\ncan be interpreted as '[0x1 for x in y]' or '[0x1f or x in y]').  A\nsyntax warning is raised if the numeric literal is immediately\nfollowed by one of keywords *note and: 24c, *note else: 24d, *note\nfor: 24e, *note if: 24f, *note in: 250, *note is: 251. and *note\nor: 252.  In a future release it will be changed to a syntax error.\n(gh-87999(3))\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/57281\n\n(2) https://github.com/python/cpython/issues/92332\n\n(3) https://github.com/python/cpython/issues/87999\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Removed,  Next: Porting to Python 3 12,  Prev: Deprecated,  Up: What's New In Python 3 12": {
            "content": "* Menu:\n\n* asynchat and asyncore::\n* configparser::\n* distutils::\n* ensurepip::\n* enum::\n* ftplib::\n* gzip::\n* hashlib::\n* importlib::\n* imp::\n* io::\n* locale::\n* smtpd::\n* sqlite3: sqlite3<2>.\n* ssl::\n* unittest: unittest<2>.\n* webbrowser::\n* xml.etree.ElementTree: xml etree ElementTree.\n* zipimport::\n* Others::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: asynchat and asyncore,  Next: configparser,  Up: Removed": {
            "content": "1.1.11.1 asynchat and asyncore\n..............................\n\n* These two modules have been removed according to the schedule in\nPEP 594(1), having been deprecated in Python 3.6.  Use *note\nasyncio: 9. instead.  (Contributed by Nikita Sobolev in\ngh-96580(2).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0594/\n\n(2) https://github.com/python/cpython/issues/96580\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: configparser,  Next: distutils,  Prev: asynchat and asyncore,  Up: Removed": {
            "content": "1.1.11.2 configparser\n.....................\n\n* Several names deprecated in the *note configparser: 20. way back in\n3.2 have been removed per gh-89336(1):\n\n* *note configparser.ParsingError: 256. no longer has a\n'filename' attribute or argument.  Use the 'source' attribute\nand argument instead.\n\n* *note configparser: 20. no longer has a 'SafeConfigParser'\nclass.  Use the shorter *note ConfigParser: 257. name instead.\n\n* *note configparser.ConfigParser: 257. no longer has a 'readfp'\nmethod.  Use *note readfile(): 258. instead.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/89336\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: distutils,  Next: ensurepip,  Prev: configparser,  Up: Removed": {
            "content": "1.1.11.3 distutils\n..................\n\n* Remove the 'distutils' package.  It was deprecated in Python 3.10\nby PEP 632(1) \"Deprecate distutils module\".  For projects still\nusing 'distutils' and cannot be updated to something else, the\n'setuptools' project can be installed: it still provides\n'distutils'.  (Contributed by Victor Stinner in gh-92584(2).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0632/\n\n(2) https://github.com/python/cpython/issues/92584\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ensurepip,  Next: enum,  Prev: distutils,  Up: Removed": {
            "content": "1.1.11.4 ensurepip\n..................\n\n* Remove the bundled setuptools wheel from *note ensurepip: 50, and\nstop installing setuptools in environments created by *note venv:\n10c.\n\n'pip (>= 22.1)' does not require setuptools to be installed in the\nenvironment.  'setuptools'-based (and 'distutils'-based) packages\ncan still be used with 'pip install', since pip will provide\n'setuptools' in the build environment it uses for building a\npackage.\n\n'easyinstall', 'pkgresources', 'setuptools' and 'distutils' are\nno longer provided by default in environments created with 'venv'\nor bootstrapped with 'ensurepip', since they are part of the\n'setuptools' package.  For projects relying on these at runtime,\nthe 'setuptools' project should be declared as a dependency and\ninstalled separately (typically, using pip).\n\n(Contributed by Pradyun Gedam in gh-95299(1).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/95299\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: enum,  Next: ftplib,  Prev: ensurepip,  Up: Removed": {
            "content": "1.1.11.5 enum\n.............\n\n* Remove *note enum: 51.'s 'EnumMeta.getattr', which is no longer\nneeded for enum attribute access.  (Contributed by Ethan Furman in\ngh-95083(1).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/95083\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ftplib,  Next: gzip,  Prev: enum,  Up: Removed": {
            "content": "1.1.11.6 ftplib\n...............\n\n* Remove *note ftplib: 59.'s 'FTPTLS.sslversion' class attribute:\nuse the 'context' parameter instead.  (Contributed by Victor\nStinner in gh-94172(1).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/94172\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: gzip,  Next: hashlib,  Prev: ftplib,  Up: Removed": {
            "content": "1.1.11.7 gzip\n.............\n\n* Remove the 'filename' attribute of *note gzip: 62.'s *note\ngzip.GzipFile: 25e, deprecated since Python 2.6, use the *note\nname: 25f. attribute instead.  In write mode, the 'filename'\nattribute added ''.gz'' file extension if it was not present.\n(Contributed by Victor Stinner in gh-94196(1).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/94196\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: hashlib,  Next: importlib,  Prev: gzip,  Up: Removed": {
            "content": "1.1.11.8 hashlib\n................\n\n* Remove the pure Python implementation of *note hashlib: 63.'s *note\nhashlib.pbkdf2hmac(): 261, deprecated in Python 3.10.  Python 3.10\nand newer requires OpenSSL 1.1.1 ( PEP 644(1)): this OpenSSL\nversion provides a C implementation of *note pbkdf2hmac(): 261.\nwhich is faster.  (Contributed by Victor Stinner in gh-94199(2).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0644/\n\n(2) https://github.com/python/cpython/issues/94199\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: importlib,  Next: imp,  Prev: hashlib,  Up: Removed": {
            "content": "1.1.11.9 importlib\n..................\n\n* Many previously deprecated cleanups in *note importlib: 71. have\nnow been completed:\n\n* References to, and support for 'modulerepr()' has been\nremoved.  (Contributed by Barry Warsaw in gh-97850(1).)\n\n* 'importlib.util.setpackage', 'importlib.util.setloader' and\n'importlib.util.moduleforloader' have all been removed.\n(Contributed by Brett Cannon and Nikita Sobolev in gh-65961(2)\nand gh-97850(3).)\n\n* Support for 'findloader()' and 'findmodule()' APIs have been\nremoved.  (Contributed by Barry Warsaw in gh-98040(4).)\n\n* 'importlib.abc.Finder', 'pkgutil.ImpImporter', and\n'pkgutil.ImpLoader' have been removed.  (Contributed by Barry\nWarsaw in gh-98040(5).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/97850\n\n(2) https://github.com/python/cpython/issues/65961\n\n(3) https://github.com/python/cpython/issues/97850\n\n(4) https://github.com/python/cpython/issues/98040\n\n(5) https://github.com/python/cpython/issues/98040\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: imp,  Next: io,  Prev: importlib,  Up: Removed": {
            "content": "1.1.11.10 imp\n.............\n\n* The 'imp' module has been removed.  (Contributed by Barry Warsaw in\ngh-98040(1).)\n\nTo migrate, consult the following correspondence table:\n\nimp                                   importlib\n\n-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\n'imp.NullImporter'                    Insert 'None' into 'sys.pathimportercache'\n\n\n'imp.cachefromsource()'             *note importlib.util.cachefromsource(): 264.\n\n\n'imp.findmodule()'                   *note importlib.util.findspec(): 230.\n\n\n'imp.getmagic()'                     *note importlib.util.MAGICNUMBER: 265.\n\n\n'imp.getsuffixes()'                  *note importlib.machinery.SOURCESUFFIXES: 266, *note importlib.machinery.EXTENSIONSUFFIXES: 267, and\n*note importlib.machinery.BYTECODESUFFIXES: 268.\n\n\n'imp.gettag()'                       *note sys.implementation.cachetag: 269.\n\n\n'imp.loadmodule()'                   *note importlib.importmodule(): 26a.\n\n\n'imp.newmodule(name)'                'types.ModuleType(name)'\n\n\n'imp.reload()'                        *note importlib.reload(): 26b.\n\n\n'imp.sourcefromcache()'             *note importlib.util.sourcefromcache(): 26c.\n\n\n'imp.loadsource()'                   'See below'\n\n\nReplace 'imp.loadsource()' with:\n\nimport importlib.util\nimport importlib.machinery\n\ndef loadsource(modname, filename):\nloader = importlib.machinery.SourceFileLoader(modname, filename)\nspec = importlib.util.specfromfilelocation(modname, filename, loader=loader)\nmodule = importlib.util.modulefromspec(spec)\n# The module is always executed and not cached in sys.modules.\n# Uncomment the following line to cache the module.\n# sys.modules[module.name] = module\nloader.execmodule(module)\nreturn module\n\n* Remove 'imp' functions and attributes with no replacements:\n\n* Undocumented functions:\n\n* 'imp.initbuiltin()'\n\n* 'imp.loadcompiled()'\n\n* 'imp.loaddynamic()'\n\n* 'imp.loadpackage()'\n\n* 'imp.lockheld()', 'imp.acquirelock()', 'imp.releaselock()':\nthe locking scheme has changed in Python 3.3 to per-module\nlocks.\n\n* 'imp.findmodule()' constants: 'SEARCHERROR', 'PYSOURCE',\n'PYCOMPILED', 'CEXTENSION', 'PYRESOURCE', 'PKGDIRECTORY',\n'CBUILTIN', 'PYFROZEN', 'PYCODERESOURCE', 'IMPHOOK'.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/98040\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: io,  Next: locale,  Prev: imp,  Up: Removed": {
            "content": "1.1.11.11 io\n............\n\n* Remove *note io: 79.'s 'io.OpenWrapper' and 'pyio.OpenWrapper',\ndeprecated in Python 3.10: just use *note open(): 26e. instead.\nThe *note open(): 26e. (*note io.open(): 26f.) function is a\nbuilt-in function.  Since Python 3.10, 'pyio.open()' is also a\nstatic method.  (Contributed by Victor Stinner in gh-94169(1).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/94169\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: locale,  Next: smtpd,  Prev: io,  Up: Removed": {
            "content": "1.1.11.12 locale\n................\n\n* Remove *note locale: 81.'s 'locale.format()' function, deprecated\nin Python 3.7: use *note locale.formatstring(): 271. instead.\n(Contributed by Victor Stinner in gh-94226(1).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/94226\n\nFile: python3.12.info,  Node: smtpd,  Next: sqlite3<2>,  Prev: locale,  Up: Removed\n\n1.1.11.13 smtpd\n...............\n\n* The 'smtpd' module has been removed according to the schedule in\nPEP 594(1), having been deprecated in Python 3.4.7 and 3.5.4.  Use\naiosmtpd(2) PyPI module or any other *note asyncio: 9.-based server\ninstead.  (Contributed by Oleg Iarygin in gh-93243(3).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0594/\n\n(2) https://pypi.org/project/aiosmtpd/\n\n(3) https://github.com/python/cpython/issues/93243\n\nFile: python3.12.info,  Node: sqlite3<2>,  Next: ssl,  Prev: smtpd,  Up: Removed\n\n1.1.11.14 sqlite3\n.................\n\n* The following undocumented *note sqlite3: c9. features, deprecated\nin Python 3.10, are now removed:\n\n* 'sqlite3.enablesharedcache()'\n\n* 'sqlite3.OptimizedUnicode'\n\nIf a shared cache must be used, open the database in URI mode using\nthe 'cache=shared' query parameter.\n\nThe 'sqlite3.OptimizedUnicode' text factory has been an alias for\n*note str: 157. since Python 3.3.  Code that previously set the\ntext factory to 'OptimizedUnicode' can either use 'str' explicitly,\nor rely on the default value which is also 'str'.\n\n(Contributed by Erlend E. Aasland in gh-92548(1).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/92548\n\nFile: python3.12.info,  Node: ssl,  Next: unittest<2>,  Prev: sqlite3<2>,  Up: Removed\n\n1.1.11.15 ssl\n.............\n\n* Remove *note ssl: ca.'s 'ssl.RANDpseudobytes()' function,\ndeprecated in Python 3.6: use *note os.urandom(): 276. or *note\nssl.RANDbytes(): 277. instead.  (Contributed by Victor Stinner in\ngh-94199(1).)\n\n* Remove the 'ssl.matchhostname()' function.  It was deprecated in\nPython 3.7.  OpenSSL performs hostname matching since Python 3.7,\nPython no longer uses the 'ssl.matchhostname()' function.\n(Contributed by Victor Stinner in gh-94199(2).)\n\n* Remove the 'ssl.wrapsocket()' function, deprecated in Python 3.7:\ninstead, create a *note ssl.SSLContext: 278. object and call its\n*note ssl.SSLContext.wrapsocket: 279. method.  Any package that\nstill uses 'ssl.wrapsocket()' is broken and insecure.  The\nfunction neither sends a SNI TLS extension nor validates server\nhostname.  Code is subject to CWE-295(3): Improper Certificate\nValidation.  (Contributed by Victor Stinner in gh-94199(4).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/94199\n\n(2) https://github.com/python/cpython/issues/94199\n\n(3) https://cwe.mitre.org/data/definitions/295.html\n\n(4) https://github.com/python/cpython/issues/94199\n\nFile: python3.12.info,  Node: unittest<2>,  Next: webbrowser,  Prev: ssl,  Up: Removed\n\n1.1.11.16 unittest\n..................\n\n* Remove many long-deprecated *note unittest: 101. features:\n\n* A number of *note TestCase: 159. method aliases:\n\nDeprecated alias                 Method Name                         Deprecated in\n\n-----------------------------------------------------------------------------------------\n\n'failUnless'                     *note assertTrue(): 27b.            3.1\n\n\n'failIf'                         *note assertFalse(): 27c.           3.1\n\n\n'failUnlessEqual'                *note assertEqual(): 27d.           3.1\n\n\n'failIfEqual'                    *note assertNotEqual(): 27e.        3.1\n\n\n'failUnlessAlmostEqual'          *note assertAlmostEqual(): 27f.     3.1\n\n\n'failIfAlmostEqual'              *note assertNotAlmostEqual(): 280.  3.1\n\n\n'failUnlessRaises'               *note assertRaises(): 281.          3.1\n\n\n'assert'                        *note assertTrue(): 27b.            3.2\n\n\n'assertEquals'                   *note assertEqual(): 27d.           3.2\n\n\n'assertNotEquals'                *note assertNotEqual(): 27e.        3.2\n\n\n'assertAlmostEquals'             *note assertAlmostEqual(): 27f.     3.2\n\n\n'assertNotAlmostEquals'          *note assertNotAlmostEqual(): 280.  3.2\n\n\n'assertRegexpMatches'            *note assertRegex(): 282.           3.2\n\n\n'assertRaisesRegexp'             *note assertRaisesRegex(): 283.     3.2\n\n\n'assertNotRegexpMatches'         *note assertNotRegex(): 284.        3.5\n\n\nYou can use 'https://github.com/isidentical/teyit' to\nautomatically modernise your unit tests.\n\n* Undocumented and broken *note TestCase: 159. method\n'assertDictContainsSubset' (deprecated in Python 3.2).\n\n* Undocumented *note TestLoader.loadTestsFromModule: 285.\nparameter 'useloadtests' (deprecated and ignored since\nPython 3.2).\n\n* An alias of the *note TextTestResult: 286. class:\n'TextTestResult' (deprecated in Python 3.2).\n\n(Contributed by Serhiy Storchaka in gh-89325(1).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/89325\n\nFile: python3.12.info,  Node: webbrowser,  Next: xml etree ElementTree,  Prev: unittest<2>,  Up: Removed\n\n1.1.11.17 webbrowser\n....................\n\n* Remove support for obsolete browsers from *note webbrowser: 110.\nThe removed browsers include: Grail, Mosaic, Netscape, Galeon,\nSkipstone, Iceape, Firebird, and Firefox versions 35 and below\n(gh-102871(1)).\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/102871\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: xml etree ElementTree,  Next: zipimport,  Prev: webbrowser,  Up: Removed": {
            "content": "1.1.11.18 xml.etree.ElementTree\n...............................\n\n* Remove the 'ElementTree.Element.copy()' method of the pure Python\nimplementation, deprecated in Python 3.10, use the *note\ncopy.copy(): 289. function instead.  The C implementation of *note\nxml.etree.ElementTree: 120. has no 'copy()' method, only a\n'copy()' method.  (Contributed by Victor Stinner in\ngh-94383(1).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/94383\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: zipimport,  Next: Others,  Prev: xml etree ElementTree,  Up: Removed": {
            "content": "1.1.11.19 zipimport\n...................\n\n* Remove *note zipimport: 12c.'s 'findloader()' and 'findmodule()'\nmethods, deprecated in Python 3.10: use the 'findspec()' method\ninstead.  See PEP 451(1) for the rationale.  (Contributed by Victor\nStinner in gh-94379(2).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0451/\n\n(2) https://github.com/python/cpython/issues/94379\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Others,  Prev: zipimport,  Up: Removed": {
            "content": "1.1.11.20 Others\n................\n\n* Remove the 'suspicious' rule from the documentation 'Makefile' and\n'Doc/tools/rstlint.py', both in favor of sphinx-lint(1).\n(Contributed by Julien Palard in gh-98179(2).)\n\n* Remove the 'keyfile' and 'certfile' parameters from the *note\nftplib: 59, *note imaplib: 6f, *note poplib: a7. and *note smtplib:\nc4. modules, and the 'keyfile', 'certfile' and 'checkhostname'\nparameters from the *note http.client: 6a. module, all deprecated\nsince Python 3.6.  Use the 'context' parameter ('sslcontext' in\n*note imaplib: 6f.) instead.  (Contributed by Victor Stinner in\ngh-94172(3).)\n\n* Remove 'Jython' compatibility hacks from several stdlib modules and\ntests.  (Contributed by Nikita Sobolev in gh-99482(4).)\n\n* Remove 'usebrokenoldctypesstructuresemantics' flag from\n*note ctypes: 28. module.  (Contributed by Nikita Sobolev in\ngh-99285(5).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/sphinx-contrib/sphinx-lint\n\n(2) https://github.com/python/cpython/issues/98179\n\n(3) https://github.com/python/cpython/issues/94172\n\n(4) https://github.com/python/cpython/issues/99482\n\n(5) https://github.com/python/cpython/issues/99285\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Porting to Python 3 12,  Next: Build Changes,  Prev: Removed,  Up: What's New In Python 3 12": {
            "content": "",
            "subsections": []
        },
        "This section lists previously described changes and other bugfixes that": {
            "content": "may require changes to your code:\n\n* Classes that aren't supposed to be hashable should set 'hash =\nNone' in their definitions to indicate the fact.\n\n* String exceptions have been removed.  Attempting to use them raises\na *note TypeError: 28e.\n\n* The 'init()' method of *note collections.deque: 3a0. now clears\nany existing contents of the deque before adding elements from the\niterable.  This change makes the behavior match 'list.init()'.\n\n* *note object.init(): 47d. previously accepted arbitrary\narguments and keyword arguments, ignoring them.  In Python 2.6,\nthis is no longer allowed and will result in a *note TypeError:\n28e.  This will affect 'init()' methods that end up calling the\ncorresponding method on *note object: 8bb. (perhaps through using\n*note super(): 204.).  See bpo-1683368(1) for discussion.\n\n* The 'Decimal' constructor now accepts leading and trailing\nwhitespace when passed a string.  Previously it would raise an\n'InvalidOperation' exception.  On the other hand, the\n'createdecimal()' method of 'Context' objects now explicitly\ndisallows extra whitespace, raising a 'ConversionSyntax' exception.\n\n* Due to an implementation accident, if you passed a file path to the\nbuilt-in *note import(): 6ed. function, it would actually\nimport the specified file.  This was never intended to work,\nhowever, and the implementation now explicitly checks for this case\nand raises an *note ImportError: 145.\n\n* C API: the *note PyImportImport(): 1253. and *note\nPyImportImportModule(): 325. functions now default to absolute\nimports, not relative imports.  This will affect C extensions that\nimport other modules.\n\n* C API: extension data types that shouldn't be hashable should\ndefine their 'tphash' slot to *note PyObjectHashNotImplemented():\n121b.\n\n* The *note socket: c6. module exception *note socket.error: ece. now\ninherits from *note IOError: ecb.  Previously it wasn't a subclass\nof 'StandardError' but now it is, through *note IOError: ecb.\n(Implemented by Gregory P. Smith; bpo-1706815(2).)\n\n* The *note xmlrpclib: 128. module no longer automatically converts\n*note datetime.date: 70f. and *note datetime.time: 6a5. to the\n*note xmlrpclib.DateTime: 1238. type; the conversion semantics were\nnot necessarily correct for all applications.  Code using\n'xmlrpclib' should convert 'date' and *note time: 6a5. instances.\n(bpo-1330538(3))\n\n* (3.0-warning mode) The *note Exception: 7ff. class now warns when\naccessed using slicing or index access; having *note Exception:\n7ff. behave like a tuple is being phased out.\n\n* (3.0-warning mode) inequality comparisons between two dictionaries\nor two objects that don't implement comparison methods are reported\nas warnings.  'dict1 == dict2' still works, but 'dict1 < dict2' is\nbeing phased out.\n\nComparisons between cells, which are an implementation detail of\nPython's scoping rules, also cause warnings because such\ncomparisons are forbidden entirely in 3.0.\n\nFor applications that embed Python:\n\n* The 'PySysSetArgvEx()' function was added in Python 2.6.6, letting\napplications close a security hole when the existing\n'PySysSetArgv()' function was used.  Check whether you're calling\n'PySysSetArgv()' and carefully consider whether the application\nshould be using 'PySysSetArgvEx()' with 'updatepath' set to false.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=1683368\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=1706815\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=1330538\n\nFile: python3.12.info,  Node: Acknowledgements<2>,  Prev: Porting to Python 2 6,  Up: What's New in Python 2 6\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Changes in the Python API,  Up: Porting to Python 3 12": {
            "content": "1.1.12.1 Changes in the Python API\n..................................\n\n* More strict rules are now applied for numerical group references\nand group names in regular expressions.  Only sequence of ASCII\ndigits is now accepted as a numerical reference.  The group name in\nbytes patterns and replacement strings can now only contain ASCII\nletters and digits and underscore.  (Contributed by Serhiy\nStorchaka in gh-91760(1).)\n\n* Remove 'randrange()' functionality deprecated since Python 3.10.\nFormerly, 'randrange(10.0)' losslessly converted to\n'randrange(10)'.  Now, it raises a *note TypeError: 28e.  Also, the\nexception raised for non-integer values such as 'randrange(10.5)'\nor 'randrange('10')' has been changed from *note ValueError: 183.\nto *note TypeError: 28e.  This also prevents bugs where\n'randrange(1e25)' would silently select from a larger range than\n'randrange(1025)'.  (Originally suggested by Serhiy Storchaka\ngh-86388(2).)\n\n* *note argparse.ArgumentParser: 28f. changed encoding and error\nhandler for reading arguments from file (e.g.\n'fromfileprefixchars' option) from default text encoding (e.g.\n*note locale.getpreferredencoding(False): 290.) to *note filesystem\nencoding and error handler: 291.  Argument files should be encoded\nin UTF-8 instead of ANSI Codepage on Windows.\n\n* Remove the 'asyncore'-based 'smtpd' module deprecated in Python\n3.4.7 and 3.5.4.  A recommended replacement is the *note asyncio:\n9.-based aiosmtpd(3) PyPI module.\n\n* *note shlex.split(): 292.: Passing 'None' for 's' argument now\nraises an exception, rather than reading *note sys.stdin: 293.  The\nfeature was deprecated in Python 3.9.  (Contributed by Victor\nStinner in gh-94352(4).)\n\n* The *note os: 9c. module no longer accepts bytes-like paths, like\n*note bytearray: 294. and *note memoryview: 17f. types: only the\nexact *note bytes: 295. type is accepted for bytes strings.\n(Contributed by Victor Stinner in gh-98393(5).)\n\n* *note syslog.openlog(): 296. and *note syslog.closelog(): 297. now\nfail if used in subinterpreters.  *note syslog.syslog(): 298. may\nstill be used in subinterpreters, but now only if *note\nsyslog.openlog(): 296. has already been called in the main\ninterpreter.  These new restrictions do not apply to the main\ninterpreter, so only a very small set of users might be affected.\nThis change helps with interpreter isolation.  Furthermore, *note\nsyslog: d6. is a wrapper around process-global resources, which are\nbest managed from the main interpreter.  (Contributed by Donghee Na\nin gh-99127(6).)\n\n* The undocumented locking behavior of *note cachedproperty(): 299.\nis removed, because it locked across all instances of the class,\nleading to high lock contention.  This means that a cached property\ngetter function could now run more than once for a single instance,\nif two threads race.  For most simple cached properties (e.g.\nthose that are idempotent and simply calculate a value based on\nother attributes of the instance) this will be fine.  If\nsynchronization is needed, implement locking within the cached\nproperty getter function or around multi-threaded access points.\n\n* *note sys.currentexceptions(): 1e6. now returns a mapping from\nthread-id to an exception instance, rather than to a '(typ, exc,\ntb)' tuple.  (Contributed by Irit Katriel in gh-103176(7).)\n\n* When extracting tar files using *note tarfile: d8. or *note\nshutil.unpackarchive(): 184, pass the 'filter' argument to limit\nfeatures that may be surprising or dangerous.  See *note Extraction\nfilters: 185. for details.\n\n* The output of the *note tokenize.tokenize(): 202. and *note\ntokenize.generatetokens(): 203. functions is now changed due to\nthe changes introduced in PEP 701(8).  This means that 'STRING'\ntokens are not emitted any more for f-strings and the tokens\ndescribed in PEP 701(9) are now produced instead: 'FSTRINGSTART',\n'FSTRINGMIDDLE' and 'FSTRINGEND' are now emitted for f-string\n\"string\" parts in addition to the appropriate tokens for the\ntokenization in the expression components.  For example for the\nf-string 'f\"start {1+1} end\"' the old version of the tokenizer\nemitted:\n\n1,0-1,18:           STRING         'f\"start {1+1} end\"'\n\nwhile the new version emits:\n\n1,0-1,2:            FSTRINGSTART  'f\"'\n1,2-1,8:            FSTRINGMIDDLE 'start '\n1,8-1,9:            OP             '{'\n1,9-1,10:           NUMBER         '1'\n1,10-1,11:          OP             '+'\n1,11-1,12:          NUMBER         '1'\n1,12-1,13:          OP             '}'\n1,13-1,17:          FSTRINGMIDDLE ' end'\n1,17-1,18:          FSTRINGEND    '\"'\n\nAdditionally, there may be some minor behavioral changes as a\nconsequence of the changes required to support PEP 701(10).  Some\nof these changes include:\n\n* The 'type' attribute of the tokens emitted when tokenizing\nsome invalid Python characters such as '!' has changed from\n'ERRORTOKEN' to 'OP'.\n\n* Incomplete single-line strings now also raise *note\ntokenize.TokenError: 29a. as incomplete multiline strings do.\n\n* Some incomplete or invalid Python code now raises *note\ntokenize.TokenError: 29a. instead of returning arbitrary\n'ERRORTOKEN' tokens when tokenizing it.\n\n* Mixing tabs and spaces as indentation in the same file is not\nsupported anymore and will raise a *note TabError: 29b.\n\n* The *note threading: e7. module now expects the 'thread' module to\nhave an 'ismaininterpreter' attribute.  It is a function with no\narguments that returns 'True' if the current interpreter is the\nmain interpreter.\n\nAny library or application that provides a custom 'thread' module\nshould provide 'ismaininterpreter()'.  (See gh-112826(11).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/91760\n\n(2) https://github.com/python/cpython/issues/86388\n\n(3) https://pypi.org/project/aiosmtpd/\n\n(4) https://github.com/python/cpython/issues/94352\n\n(5) https://github.com/python/cpython/issues/98393\n\n(6) https://github.com/python/cpython/issues/99127\n\n(7) https://github.com/python/cpython/issues/103176\n\n(8) https://peps.python.org/pep-0701/\n\n(9) https://peps.python.org/pep-0701/\n\n(10) https://peps.python.org/pep-0701/\n\n(11) https://github.com/python/cpython/issues/112826\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Build Changes,  Next: C API Changes,  Prev: Porting to Python 3 12,  Up: What's New In Python 3 12": {
            "content": "* Python no longer uses 'setup.py' to build shared C extension\nmodules.  Build parameters like headers and libraries are detected\nin 'configure' script.  Extensions are built by 'Makefile'.  Most\nextensions use 'pkg-config' and fall back to manual detection.\n(Contributed by Christian Heimes in gh-93939(1).)\n\n* 'vastart()' with two parameters, like 'vastart(args, format),' is\nnow required to build Python.  'vastart()' is no longer called\nwith a single parameter.  (Contributed by Kumar Aditya in\ngh-93207(2).)\n\n* CPython now uses the ThinLTO option as the default link time\noptimization policy if the Clang compiler accepts the flag.\n(Contributed by Donghee Na in gh-89536(3).)\n\n* Add 'COMPILEALLOPTS' variable in 'Makefile' to override *note\ncompileall: 1e. options (default: '-j0') in 'make install'.  Also\nmerged the 3 'compileall' commands into a single command to build\n.pyc files for all optimization levels (0, 1, 2) at once.\n(Contributed by Victor Stinner in gh-99289(4).)\n\n* Add platform triplets for 64-bit LoongArch:\n\n* loongarch64-linux-gnusf\n\n* loongarch64-linux-gnuf32\n\n* loongarch64-linux-gnu\n\n(Contributed by Zhang Na in gh-90656(5).)\n\n* 'PYTHONFORREGEN' now require Python 3.10 or newer.\n\n* Autoconf 2.71 and aclocal 1.16.4 is now required to regenerate\n'!configure'.  (Contributed by Christian Heimes in gh-89886(6).)\n\n* Windows builds and macOS installers from python.org now use OpenSSL\n3.0.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/93939\n\n(2) https://github.com/python/cpython/issues/93207\n\n(3) https://github.com/python/cpython/issues/89536\n\n(4) https://github.com/python/cpython/issues/99289\n\n(5) https://github.com/python/cpython/issues/90656\n\n(6) https://github.com/python/cpython/issues/89886\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: C API Changes,  Next: Notable changes in 3 12 10,  Prev: Build Changes,  Up: What's New In Python 3 12": {
            "content": "* Menu:\n\n* New Features: New Features<2>.\n* Porting to Python 3.12: Porting to Python 3 12<2>.\n* Deprecated: Deprecated<2>.\n* Removed: Removed<2>.\n\nFile: python3.12.info,  Node: New Features<2>,  Next: Porting to Python 3 12<2>,  Up: C API Changes\n\n1.1.14.1 New Features\n.....................\n\n* PEP 697(1): Introduce the *note Unstable C API tier: 29f, intended\nfor low-level tools like debuggers and JIT compilers.  This API may\nchange in each minor release of CPython without deprecation\nwarnings.  Its contents are marked by the 'PyUnstable' prefix in\nnames.\n\nCode object constructors:\n\n- 'PyUnstableCodeNew()' (renamed from 'PyCodeNew')\n\n- 'PyUnstableCodeNewWithPosOnlyArgs()' (renamed from\n'PyCodeNewWithPosOnlyArgs')\n\nExtra storage for code objects ( PEP 523(2)):\n\n- 'PyUnstableEvalRequestCodeExtraIndex()' (renamed from\n'PyEvalRequestCodeExtraIndex')\n\n- 'PyUnstableCodeGetExtra()' (renamed from 'PyCodeGetExtra')\n\n- 'PyUnstableCodeSetExtra()' (renamed from 'PyCodeSetExtra')\n\nThe original names will continue to be available until the\nrespective API changes.\n\n(Contributed by Petr Viktorin in gh-101101(3).)\n\n* PEP 697(4): Add an API for extending types whose instance memory\nlayout is opaque:\n\n- *note PyTypeSpec.basicsize: 2a0. can be zero or negative to\nspecify inheriting or extending the base class size.\n\n- *note PyObjectGetTypeData(): 2a1. and *note\nPyTypeGetTypeDataSize(): 2a2. added to allow access to\nsubclass-specific instance data.\n\n- *note PyTPFLAGSITEMSATEND: 2a3. and *note\nPyObjectGetItemData(): 2a4. added to allow safely extending\ncertain variable-sized types, including *note PyTypeType:\n2a5.\n\n- *note PyRELATIVEOFFSET: 2a6. added to allow defining *note\nmembers: 2a7. in terms of a subclass-specific struct.\n\n(Contributed by Petr Viktorin in gh-103509(5).)\n\n* Add the new *note limited C API: 2a8. function *note\nPyTypeFromMetaclass(): 2a9, which generalizes the existing *note\nPyTypeFromModuleAndSpec(): 2aa. using an additional metaclass\nargument.  (Contributed by Wenzel Jakob in gh-93012(6).)\n\n* API for creating objects that can be called using *note the\nvectorcall protocol: 2ab. was added to the *note Limited API: 2ac.:\n\n* *note PyTPFLAGSHAVEVECTORCALL: 2ad.\n\n* *note PyVectorcallNARGS(): 2ae.\n\n* *note PyVectorcallCall(): 2af.\n\n* *note vectorcallfunc: 2b0.\n\nThe *note PyTPFLAGSHAVEVECTORCALL: 2ad. flag is now removed from\na class when the class's *note call(): 2b1. method is\nreassigned.  This makes vectorcall safe to use with mutable types\n(i.e.  heap types without the immutable flag, *note\nPyTPFLAGSIMMUTABLETYPE: 2b2.).  Mutable types that do not\noverride *note tpcall: 2b3. now inherit the\n'PyTPFLAGSHAVEVECTORCALL' flag.  (Contributed by Petr Viktorin\nin gh-93274(7).)\n\nThe *note PyTPFLAGSMANAGEDDICT: 2b4. and *note\nPyTPFLAGSMANAGEDWEAKREF: 2b5. flags have been added.  This\nallows extensions classes to support object 'dict' and weakrefs\nwith less bookkeeping, using less memory and with faster access.\n\n* API for performing calls using *note the vectorcall protocol: 2ab.\nwas added to the *note Limited API: 2ac.:\n\n* *note PyObjectVectorcall(): 2b6.\n\n* *note PyObjectVectorcallMethod(): 2b7.\n\n* *note PYVECTORCALLARGUMENTSOFFSET: 2b8.\n\nThis means that both the incoming and outgoing ends of the vector\ncall protocol are now available in the *note Limited API: 2ac.\n(Contributed by Wenzel Jakob in gh-98586(8).)\n\n* Add two new public functions, *note PyEvalSetProfileAllThreads():\n2b9. and *note PyEvalSetTraceAllThreads(): 2ba, that allow to set\ntracing and profiling functions in all running threads in addition\nto the calling one.  (Contributed by Pablo Galindo in gh-93503(9).)\n\n* Add new function *note PyFunctionSetVectorcall(): 2bb. to the C\nAPI which sets the vectorcall field of a given *note\nPyFunctionObject: 2bc.  (Contributed by Andrew Frost in\ngh-92257(10).)\n\n* The C API now permits registering callbacks via *note\nPyDictAddWatcher(): 2bd, *note PyDictWatch(): 2be. and related\nAPIs to be called whenever a dictionary is modified.  This is\nintended for use by optimizing interpreters, JIT compilers, or\ndebuggers.  (Contributed by Carl Meyer in gh-91052(11).)\n\n* Add *note PyTypeAddWatcher(): 2bf. and *note PyTypeWatch(): 2c0.\nAPI to register callbacks to receive notification on changes to a\ntype.  (Contributed by Carl Meyer in gh-91051(12).)\n\n* Add *note PyCodeAddWatcher(): 2c1. and *note\nPyCodeClearWatcher(): 2c2. APIs to register callbacks to receive\nnotification on creation and destruction of code objects.\n(Contributed by Itamar Oren in gh-91054(13).)\n\n* Add *note PyFrameGetVar(): 2c3. and *note PyFrameGetVarString():\n2c4. functions to get a frame variable by its name.  (Contributed\nby Victor Stinner in gh-91248(14).)\n\n* Add *note PyErrGetRaisedException(): 2c5. and *note\nPyErrSetRaisedException(): 2c6. for saving and restoring the\ncurrent exception.  These functions return and accept a single\nexception object, rather than the triple arguments of the\nnow-deprecated *note PyErrFetch(): 2c7. and *note PyErrRestore():\n2c8.  This is less error prone and a bit more efficient.\n(Contributed by Mark Shannon in gh-101578(15).)\n\n* Add 'PyErrChainExceptions1', which takes an exception instance,\nto replace the legacy-API 'PyErrChainExceptions', which is now\ndeprecated.  (Contributed by Mark Shannon in gh-101578(16).)\n\n* Add *note PyExceptionGetArgs(): 2c9. and *note\nPyExceptionSetArgs(): 2ca. as convenience functions for retrieving\nand modifying the *note args: 2cb. passed to the exception's\nconstructor.  (Contributed by Mark Shannon in gh-101578(17).)\n\n* Add *note PyErrDisplayException(): 2cc, which takes an exception\ninstance, to replace the legacy-api 'PyErrDisplay()'.\n(Contributed by Irit Katriel in gh-102755(18)).\n\n* PEP 683(19): Introduce 'Immortal Objects', which allows objects to\nbypass reference counts, and related changes to the C-API:\n\n-\n'PyIMMORTALREFCNT': The reference count that defines an object\n\nas immortal.\n\n- 'PyIsImmortal' Checks if an object has the immortal\nreference count.\n\n-\n'PyObjectHEADINIT' This will now initialize reference count to\n\n'PyIMMORTALREFCNT' when used with 'PyBUILDCORE'.\n\n-\n'SSTATEINTERNEDIMMORTAL' An identifier for interned unicode objects\n\nthat are immortal.\n\n-\n'SSTATEINTERNEDIMMORTALSTATIC' An identifier for interned unicode\n\nobjects that are immortal and static\n\n-\n'sys.getunicodeinternedsize' This returns the total number of unicode\n\nobjects that have been interned.  This is now needed for\n'refleak.py' to correctly track reference counts and\nallocated blocks\n\n(Contributed by Eddie Elizondo in gh-84436(20).)\n\n* PEP 684(21): Add the new *note PyNewInterpreterFromConfig(): 16c.\nfunction and *note PyInterpreterConfig: 2cd, which may be used to\ncreate sub-interpreters with their own GILs.  (See *note PEP 684; A\nPer-Interpreter GIL: 140. for more info.)  (Contributed by Eric\nSnow in gh-104110(22).)\n\n* In the limited C API version 3.12, *note PyINCREF(): 2ce. and\n*note PyDECREF(): 2cf. functions are now implemented as opaque\nfunction calls to hide implementation details.  (Contributed by\nVictor Stinner in gh-105387(23).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0697/\n\n(2) https://peps.python.org/pep-0523/\n\n(3) https://github.com/python/cpython/issues/101101\n\n(4) https://peps.python.org/pep-0697/\n\n(5) https://github.com/python/cpython/issues/103509\n\n(6) https://github.com/python/cpython/issues/93012\n\n(7) https://github.com/python/cpython/issues/93274\n\n(8) https://github.com/python/cpython/issues/98586\n\n(9) https://github.com/python/cpython/issues/93503\n\n(10) https://github.com/python/cpython/issues/92257\n\n(11) https://github.com/python/cpython/issues/91052\n\n(12) https://github.com/python/cpython/issues/91051\n\n(13) https://github.com/python/cpython/issues/91054\n\n(14) https://github.com/python/cpython/issues/91248\n\n(15) https://github.com/python/cpython/issues/101578\n\n(16) https://github.com/python/cpython/issues/101578\n\n(17) https://github.com/python/cpython/issues/101578\n\n(18) https://github.com/python/cpython/issues/102755\n\n(19) https://peps.python.org/pep-0683/\n\n(20) https://github.com/python/cpython/issues/84436\n\n(21) https://peps.python.org/pep-0684/\n\n(22) https://github.com/python/cpython/issues/104110\n\n(23) https://github.com/python/cpython/issues/105387\n\nFile: python3.12.info,  Node: Porting to Python 3 12<2>,  Next: Deprecated<2>,  Prev: New Features<2>,  Up: C API Changes\n\n1.1.14.2 Porting to Python 3.12\n...............................\n\n* Legacy Unicode APIs based on 'PyUNICODE*' representation has been\nremoved.  Please migrate to APIs based on UTF-8 or 'wchart*'.\n\n* Argument parsing functions like *note PyArgParseTuple(): 2d1.\ndoesn't support 'PyUNICODE*' based format (e.g.  'u', 'Z')\nanymore.  Please migrate to other formats for Unicode like 's',\n'z', 'es', and 'U'.\n\n* 'tpweaklist' for all static builtin types is always 'NULL'.  This\nis an internal-only field on 'PyTypeObject' but we're pointing out\nthe change in case someone happens to be accessing the field\ndirectly anyway.  To avoid breakage, consider using the existing\npublic C-API instead, or, if necessary, the (internal-only)\n'PyObjectGETWEAKREFSLISTPTR()' macro.\n\n* This internal-only *note PyTypeObject.tpsubclasses: 2d2. may now\nnot be a valid object pointer.  Its type was changed to void* to\nreflect this.  We mention this in case someone happens to be\naccessing the internal-only field directly.\n\nTo get a list of subclasses, call the Python method *note\nsubclasses(): 2d3. (using *note PyObjectCallMethod(): 2d4, for\nexample).\n\n* Add support of more formatting options (left aligning, octals,\nuppercase hexadecimals, 'intmaxt', 'ptrdifft', 'wchart' C\nstrings, variable width and precision) in *note\nPyUnicodeFromFormat(): 2d5. and *note PyUnicodeFromFormatV():\n2d6.  (Contributed by Serhiy Storchaka in gh-98836(1).)\n\n* An unrecognized format character in *note PyUnicodeFromFormat():\n2d5. and *note PyUnicodeFromFormatV(): 2d6. now sets a *note\nSystemError: 2d7.  In previous versions it caused all the rest of\nthe format string to be copied as-is to the result string, and any\nextra arguments discarded.  (Contributed by Serhiy Storchaka in\ngh-95781(2).)\n\n* Fix wrong sign placement in *note PyUnicodeFromFormat(): 2d5. and\n*note PyUnicodeFromFormatV(): 2d6.  (Contributed by Philip Georgi\nin gh-95504(3).)\n\n* Extension classes wanting to add a 'dict' or weak reference\nslot should use *note PyTPFLAGSMANAGEDDICT: 2b4. and *note\nPyTPFLAGSMANAGEDWEAKREF: 2b5. instead of 'tpdictoffset' and\n'tpweaklistoffset', respectively.  The use of 'tpdictoffset' and\n'tpweaklistoffset' is still supported, but does not fully support\nmultiple inheritance (gh-95589(4)), and performance may be worse.\nClasses declaring *note PyTPFLAGSMANAGEDDICT: 2b4. should call\n'PyObjectVisitManagedDict()' and 'PyObjectClearManagedDict()'\nto traverse and clear their instance's dictionaries.  To clear\nweakrefs, call *note PyObjectClearWeakRefs(): 2d8, as before.\n\n* The *note PyUnicodeFSDecoder(): 2d9. function no longer accepts\nbytes-like paths, like *note bytearray: 294. and *note memoryview:\n17f. types: only the exact *note bytes: 295. type is accepted for\nbytes strings.  (Contributed by Victor Stinner in gh-98393(5).)\n\n* The *note PyCLEAR: 2da, *note PySETREF: 2db. and *note\nPyXSETREF: 2dc. macros now only evaluate their arguments once.  If\nan argument has side effects, these side effects are no longer\nduplicated.  (Contributed by Victor Stinner in gh-98724(6).)\n\n* The interpreter's error indicator is now always normalized.  This\nmeans that *note PyErrSetObject(): 2dd, *note PyErrSetString():\n2de. and the other functions that set the error indicator now\nnormalize the exception before storing it.  (Contributed by Mark\nShannon in gh-101578(7).)\n\n* 'PyRefTotal' is no longer authoritative and only kept around for\nABI compatibility.  Note that it is an internal global and only\navailable on debug builds.  If you happen to be using it then\nyou'll need to start using 'PyGetGlobalRefTotal()'.\n\n* The following functions now select an appropriate metaclass for the\nnewly created type:\n\n* *note PyTypeFromSpec(): 2df.\n\n* *note PyTypeFromSpecWithBases(): 2e0.\n\n* *note PyTypeFromModuleAndSpec(): 2aa.\n\nCreating classes whose metaclass overrides *note tpnew: 2e1. is\ndeprecated, and in Python 3.14+ it will be disallowed.  Note that\nthese functions ignore 'tpnew' of the metaclass, possibly allowing\nincomplete initialization.\n\nNote that *note PyTypeFromMetaclass(): 2a9. (added in Python 3.12)\nalready disallows creating classes whose metaclass overrides\n'tpnew' (*note new(): 2e2. in Python).\n\nSince 'tpnew' overrides almost everything 'PyTypeFrom*' functions\ndo, the two are incompatible with each other.  The existing\nbehavior - ignoring the metaclass for several steps of type\ncreation - is unsafe in general, since (meta)classes assume that\n'tpnew' was called.  There is no simple general workaround.  One\nof the following may work for you:\n\n- If you control the metaclass, avoid using 'tpnew' in it:\n\n- If initialization can be skipped, it can be done in *note\ntpinit: 2e3. instead.\n\n- If the metaclass doesn't need to be instantiated from\nPython, set its 'tpnew' to 'NULL' using the *note\nPyTPFLAGSDISALLOWINSTANTIATION: 2e4. flag.  This makes\nit acceptable for 'PyTypeFrom*' functions.\n\n- Avoid 'PyTypeFrom*' functions: if you don't need C-specific\nfeatures (slots or setting the instance size), create types by\n*note calling: 2e5. the metaclass.\n\n- If you 'know' the 'tpnew' can be skipped safely, filter the\ndeprecation warning out using *note warnings.catchwarnings():\n2e6. from Python.\n\n* *note PyOSInputHook: 2e7. and *note PyOSReadlineFunctionPointer:\n2e8. are no longer called in *note subinterpreters: 2e9.  This is\nbecause clients generally rely on process-wide global state (since\nthese callbacks have no way of recovering extension module state).\n\nThis also avoids situations where extensions may find themselves\nrunning in a subinterpreter that they don't support (or haven't yet\nbeen loaded in).  See gh-104668(8) for more info.\n\n* *note PyLongObject: 2ea. has had its internals changed for better\nperformance.  Although the internals of *note PyLongObject: 2ea.\nare private, they are used by some extension modules.  The internal\nfields should no longer be accessed directly, instead the API\nfunctions beginning 'PyLong...' should be used instead.  Two new\n'unstable' API functions are provided for efficient access to the\nvalue of *note PyLongObject: 2ea.s which fit into a single machine\nword:\n\n* *note PyUnstableLongIsCompact(): 2eb.\n\n* *note PyUnstableLongCompactValue(): 2ec.\n\n* Custom allocators, set via *note PyMemSetAllocator(): 2ed, are now\nrequired to be thread-safe, regardless of memory domain.\nAllocators that don't have their own state, including \"hooks\", are\nnot affected.  If your custom allocator is not already thread-safe\nand you need guidance then please create a new GitHub issue and CC\n'@ericsnowcurrently'.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/98836\n\n(2) https://github.com/python/cpython/issues/95781\n\n(3) https://github.com/python/cpython/issues/95504\n\n(4) https://github.com/python/cpython/issues/95589\n\n(5) https://github.com/python/cpython/issues/98393\n\n(6) https://github.com/python/cpython/issues/98724\n\n(7) https://github.com/python/cpython/issues/101578\n\n(8) https://github.com/python/cpython/issues/104668\n\nFile: python3.12.info,  Node: Deprecated<2>,  Next: Removed<2>,  Prev: Porting to Python 3 12<2>,  Up: C API Changes\n\n1.1.14.3 Deprecated\n...................\n\n* In accordance with PEP 699(1), the 'maversiontag' field in *note\nPyDictObject: 2ef. is deprecated for extension modules.  Accessing\nthis field will generate a compiler warning at compile time.  This\nfield will be removed in Python 3.14.  (Contributed by Ramvikrams\nand Kumar Aditya in gh-101193(2).  PEP by Ken Jin.)\n\n* Deprecate global configuration variable:\n\n* *note PyDebugFlag: 2f0.: use *note PyConfig.parserdebug:\n2f1.\n\n* *note PyVerboseFlag: 2f2.: use *note PyConfig.verbose: 2f3.\n\n* *note PyQuietFlag: 2f4.: use *note PyConfig.quiet: 2f5.\n\n* *note PyInteractiveFlag: 2f6.: use *note\nPyConfig.interactive: 2f7.\n\n* *note PyInspectFlag: 2f8.: use *note PyConfig.inspect: 2f9.\n\n* *note PyOptimizeFlag: 2fa.: use *note\nPyConfig.optimizationlevel: 2fb.\n\n* *note PyNoSiteFlag: 2fc.: use *note PyConfig.siteimport:\n2fd.\n\n* *note PyBytesWarningFlag: 2fe.: use *note\nPyConfig.byteswarning: 2ff.\n\n* *note PyFrozenFlag: 300.: use *note\nPyConfig.pathconfigwarnings: 301.\n\n* *note PyIgnoreEnvironmentFlag: 302.: use *note\nPyConfig.useenvironment: 303.\n\n* *note PyDontWriteBytecodeFlag: 304.: use *note\nPyConfig.writebytecode: 305.\n\n* *note PyNoUserSiteDirectory: 306.: use *note\nPyConfig.usersitedirectory: 307.\n\n* *note PyUnbufferedStdioFlag: 308.: use *note\nPyConfig.bufferedstdio: 309.\n\n* *note PyHashRandomizationFlag: 30a.: use *note\nPyConfig.usehashseed: 30b. and *note PyConfig.hashseed:\n30c.\n\n* *note PyIsolatedFlag: 30d.: use *note PyConfig.isolated: 30e.\n\n* *note PyLegacyWindowsFSEncodingFlag: 30f.: use *note\nPyPreConfig.legacywindowsfsencoding: 310.\n\n* *note PyLegacyWindowsStdioFlag: 311.: use *note\nPyConfig.legacywindowsstdio: 312.\n\n* 'PyFileSystemDefaultEncoding': use *note\nPyConfig.filesystemencoding: 313.\n\n* 'PyHasFileSystemDefaultEncoding': use *note\nPyConfig.filesystemencoding: 313.\n\n* 'PyFileSystemDefaultEncodeErrors': use *note\nPyConfig.filesystemerrors: 314.\n\n* 'PyUTF8Mode': use *note PyPreConfig.utf8mode: 315. (see\n*note PyPreInitialize(): 316.)\n\nThe *note PyInitializeFromConfig(): 317. API should be used with\n*note PyConfig: 318. instead.  (Contributed by Victor Stinner in\ngh-77782(3).)\n\n* Creating *note immutable types: 2b2. with mutable bases is\ndeprecated and will be disabled in Python 3.14.  (gh-95388(4))\n\n* The 'structmember.h' header is deprecated, though it continues to\nbe available and there are no plans to remove it.\n\nIts contents are now available just by including 'Python.h', with a\n'Py' prefix added if it was missing:\n\n- *note PyMemberDef: 2a7, *note PyMemberGetOne(): 319. and\n*note PyMemberSetOne(): 31a.\n\n- Type macros like *note PyTINT: 31b, *note PyTDOUBLE: 31c,\netc.  (previously 'TINT', 'TDOUBLE', etc.)\n\n- The flags *note PyREADONLY: 31d. (previously 'READONLY') and\n*note PyAUDITREAD: 31e. (previously all uppercase)\n\nSeveral items are not exposed from 'Python.h':\n\n- *note TOBJECT: 31f. (use *note PyTOBJECTEX: 320.)\n\n- *note TNONE: 321. (previously undocumented, and pretty\nquirky)\n\n- The macro 'WRITERESTRICTED' which does nothing.\n\n- The macros 'RESTRICTED' and 'READRESTRICTED', equivalents of\n*note PyAUDITREAD: 31e.\n\n- In some configurations, '<stddef.h>' is not included from\n'Python.h'.  It should be included manually when using\n'offsetof()'.\n\nThe deprecated header continues to provide its original contents\nunder the original names.  Your old code can stay unchanged, unless\nthe extra include and non-namespaced macros bother you greatly.\n\n(Contributed in gh-47146(5) by Petr Viktorin, based on earlier work\nby Alexander Belopolsky and Matthias Braun.)\n\n* *note PyErrFetch(): 2c7. and *note PyErrRestore(): 2c8. are\ndeprecated.  Use *note PyErrGetRaisedException(): 2c5. and *note\nPyErrSetRaisedException(): 2c6. instead.  (Contributed by Mark\nShannon in gh-101578(6).)\n\n* 'PyErrDisplay()' is deprecated.  Use *note\nPyErrDisplayException(): 2cc. instead.  (Contributed by Irit\nKatriel in gh-102755(7)).\n\n* 'PyErrChainExceptions' is deprecated.  Use\n'PyErrChainExceptions1' instead.  (Contributed by Irit Katriel in\ngh-102192(8).)\n\n* Using *note PyTypeFromSpec(): 2df, *note\nPyTypeFromSpecWithBases(): 2e0. or *note\nPyTypeFromModuleAndSpec(): 2aa. to create a class whose metaclass\noverrides *note tpnew: 2e1. is deprecated.  Call the metaclass\ninstead.\n\n* Menu:\n\n* Pending Removal in Python 3.14: Pending Removal in Python 3 14<2>.\n* Pending Removal in Python 3.15: Pending Removal in Python 3 15<2>.\n* Pending Removal in Future Versions: Pending Removal in Future Versions<2>.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0699/\n\n(2) https://github.com/python/cpython/issues/101193\n\n(3) https://github.com/python/cpython/issues/77782\n\n(4) https://github.com/python/cpython/issues/95388\n\n(5) https://github.com/python/cpython/issues/47146\n\n(6) https://github.com/python/cpython/issues/101578\n\n(7) https://github.com/python/cpython/issues/102755\n\n(8) https://github.com/python/cpython/issues/102192\n\nFile: python3.12.info,  Node: Pending Removal in Python 3 14<2>,  Next: Pending Removal in Python 3 15<2>,  Up: Deprecated<2>\n\n1.1.14.4 Pending Removal in Python 3.14\n.......................................\n\n* The 'maversiontag' field in *note PyDictObject: 2ef. for\nextension modules ( PEP 699(1); gh-101193(2)).\n\n* Global configuration variables:\n\n* *note PyDebugFlag: 2f0.: use *note PyConfig.parserdebug:\n2f1.\n\n* *note PyVerboseFlag: 2f2.: use *note PyConfig.verbose: 2f3.\n\n* *note PyQuietFlag: 2f4.: use *note PyConfig.quiet: 2f5.\n\n* *note PyInteractiveFlag: 2f6.: use *note\nPyConfig.interactive: 2f7.\n\n* *note PyInspectFlag: 2f8.: use *note PyConfig.inspect: 2f9.\n\n* *note PyOptimizeFlag: 2fa.: use *note\nPyConfig.optimizationlevel: 2fb.\n\n* *note PyNoSiteFlag: 2fc.: use *note PyConfig.siteimport:\n2fd.\n\n* *note PyBytesWarningFlag: 2fe.: use *note\nPyConfig.byteswarning: 2ff.\n\n* *note PyFrozenFlag: 300.: use *note\nPyConfig.pathconfigwarnings: 301.\n\n* *note PyIgnoreEnvironmentFlag: 302.: use *note\nPyConfig.useenvironment: 303.\n\n* *note PyDontWriteBytecodeFlag: 304.: use *note\nPyConfig.writebytecode: 305.\n\n* *note PyNoUserSiteDirectory: 306.: use *note\nPyConfig.usersitedirectory: 307.\n\n* *note PyUnbufferedStdioFlag: 308.: use *note\nPyConfig.bufferedstdio: 309.\n\n* *note PyHashRandomizationFlag: 30a.: use *note\nPyConfig.usehashseed: 30b. and *note PyConfig.hashseed:\n30c.\n\n* *note PyIsolatedFlag: 30d.: use *note PyConfig.isolated: 30e.\n\n* *note PyLegacyWindowsFSEncodingFlag: 30f.: use *note\nPyPreConfig.legacywindowsfsencoding: 310.\n\n* *note PyLegacyWindowsStdioFlag: 311.: use *note\nPyConfig.legacywindowsstdio: 312.\n\n* 'PyFileSystemDefaultEncoding': use *note\nPyConfig.filesystemencoding: 313.\n\n* 'PyHasFileSystemDefaultEncoding': use *note\nPyConfig.filesystemencoding: 313.\n\n* 'PyFileSystemDefaultEncodeErrors': use *note\nPyConfig.filesystemerrors: 314.\n\n* 'PyUTF8Mode': use *note PyPreConfig.utf8mode: 315. (see\n*note PyPreInitialize(): 316.)\n\nThe *note PyInitializeFromConfig(): 317. API should be used with\n*note PyConfig: 318. instead.\n\n* Creating *note immutable types: 2b2. with mutable bases\n(gh-95388(3)).\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0699/\n\n(2) https://github.com/python/cpython/issues/101193\n\n(3) https://github.com/python/cpython/issues/95388\n\nFile: python3.12.info,  Node: Pending Removal in Python 3 15<2>,  Next: Pending Removal in Future Versions<2>,  Prev: Pending Removal in Python 3 14<2>,  Up: Deprecated<2>\n\n1.1.14.5 Pending Removal in Python 3.15\n.......................................\n\n* *note PyImportImportModuleNoBlock(): 324.: use *note\nPyImportImportModule(): 325.\n\n* 'PyUNICODEWIDE' type: use 'wchart'\n\n* *note PyUNICODE: 326. type: use 'wchart'\n\n* Python initialization functions:\n\n* *note PySysResetWarnOptions(): 327.: clear *note\nsys.warnoptions: 328. and 'warnings.filters'\n\n* *note PyGetExecPrefix(): 329.: get *note sys.execprefix:\n32a.\n\n* *note PyGetPath(): 32b.: get *note sys.path: 32c.\n\n* *note PyGetPrefix(): 32d.: get *note sys.prefix: 32e.\n\n* *note PyGetProgramFullPath(): 32f.: get *note sys.executable:\n330.\n\n* *note PyGetProgramName(): 331.: get *note sys.executable:\n330.\n\n* *note PyGetPythonHome(): 332.: get *note PyConfig.home: 333.\nor the *note PYTHONHOME: 334. environment variable\n\nFile: python3.12.info,  Node: Pending Removal in Future Versions<2>,  Prev: Pending Removal in Python 3 15<2>,  Up: Deprecated<2>\n\n1.1.14.6 Pending Removal in Future Versions\n...........................................\n",
            "subsections": []
        },
        "The following APIs are deprecated and will be removed, although there is": {
            "content": "currently no date scheduled for their removal.\n\n* *note PyTPFLAGSHAVEFINALIZE: 336.: unneeded since Python 3.8\n\n* *note PyErrFetch(): 2c7.: use *note PyErrGetRaisedException():\n2c5.\n\n* *note PyErrNormalizeException(): 337.: use *note\nPyErrGetRaisedException(): 2c5.\n\n* *note PyErrRestore(): 2c8.: use *note PyErrSetRaisedException():\n2c6.\n\n* *note PyModuleGetFilename(): 338.: use *note\nPyModuleGetFilenameObject(): 339.\n\n* *note PyOSAfterFork(): 33a.: use *note PyOSAfterForkChild():\n33b.\n\n* *note PySliceGetIndicesEx(): 33c.: use *note PySliceUnpack():\n33d. and *note PySliceAdjustIndices(): 33e.\n\n* 'PyUnicodeAsDecodedObject()': use *note PyCodecDecode(): 33f.\n\n* 'PyUnicodeAsDecodedUnicode()': use *note PyCodecDecode(): 33f.\n\n* 'PyUnicodeAsEncodedObject()': use *note PyCodecEncode(): 340.\n\n* 'PyUnicodeAsEncodedUnicode()': use *note PyCodecEncode(): 340.\n\n* *note PyUnicodeREADY(): 341.: unneeded since Python 3.12\n\n* 'PyErrDisplay()': use *note PyErrDisplayException(): 2cc.\n\n* 'PyErrChainExceptions()': use 'PyErrChainExceptions1'\n\n* 'PyBytesObject.obshash' member: call *note PyObjectHash(): 342.\ninstead\n\n* 'PyDictObject.maversiontag' member\n\n* Thread Local Storage (TLS) API:\n\n* *note PyThreadcreatekey(): 343.: use *note\nPyThreadtssalloc(): 344.\n\n* *note PyThreaddeletekey(): 345.: use *note\nPyThreadtssfree(): 346.\n\n* *note PyThreadsetkeyvalue(): 347.: use *note\nPyThreadtssset(): 348.\n\n* *note PyThreadgetkeyvalue(): 349.: use *note\nPyThreadtssget(): 34a.\n\n* *note PyThreaddeletekeyvalue(): 34b.: use *note\nPyThreadtssdelete(): 34c.\n\n* *note PyThreadReInitTLS(): 34d.: unneeded since Python 3.7\n\nFile: python3.12.info,  Node: Removed<2>,  Prev: Deprecated<2>,  Up: C API Changes\n\n1.1.14.7 Removed\n................\n\n* Remove the 'token.h' header file.  There was never any public\ntokenizer C API. The 'token.h' header file was only designed to be\nused by Python internals.  (Contributed by Victor Stinner in\ngh-92651(1).)\n\n* Legacy Unicode APIs have been removed.  See PEP 623(2) for detail.\n\n* 'PyUnicodeWCHARKIND'\n\n* 'PyUnicodeASUNICODE()'\n\n* 'PyUnicodeAsUnicode()'\n\n* 'PyUnicodeAsUnicodeAndSize()'\n\n* 'PyUnicodeASDATA()'\n\n* 'PyUnicodeFromUnicode()'\n\n* 'PyUnicodeGETSIZE()'\n\n* 'PyUnicodeGetSize()'\n\n* 'PyUnicodeGETDATASIZE()'\n\n* Remove the 'PyUnicodeInternImmortal()' function macro.\n(Contributed by Victor Stinner in gh-85858(3).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/92651\n\n(2) https://peps.python.org/pep-0623/\n\n(3) https://github.com/python/cpython/issues/85858\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Notable changes in 3 12 10,  Prev: C API Changes,  Up: What's New In Python 3 12": {
            "content": "* Menu:\n\n* os.path: os path<2>.\n* tarfile::\n\nFile: python3.12.info,  Node: os path<2>,  Next: tarfile,  Up: Notable changes in 3 12 10\n\n1.1.15.1 os.path\n................\n\n* The 'strict' parameter to *note os.path.realpath(): 351. accepts a\nnew value, *note os.path.ALLOWMISSING: 352.  If used, errors other\nthan *note FileNotFoundError: 353. will be re-raised; the resulting\npath can be missing but it will be free of symlinks.  (Contributed\nby Petr Viktorin for >>:cve:'2025-4517'<<.)\n\nFile: python3.12.info,  Node: tarfile,  Prev: os path<2>,  Up: Notable changes in 3 12 10\n\n1.1.15.2 tarfile\n................\n\n* *note datafilter(): 355. now normalizes symbolic link targets in\norder to avoid path traversal attacks.  (Contributed by Petr\nViktorin in gh-127987(1) and >>:cve:'2025-4138'<<.)\n\n* *note extractall(): 356. now skips fixing up directory attributes\nwhen a directory was removed or replaced by another kind of file.\n(Contributed by Petr Viktorin in gh-127987(2) and\n>>:cve:'2024-12718'<<.)\n\n* *note extract(): 357. and *note extractall(): 356. now (re-)apply\nthe extraction filter when substituting a link (hard or symbolic)\nwith a copy of another archive member, and when fixing up directory\nattributes.  The former raises a new exception, *note\nLinkFallbackError: 358.  (Contributed by Petr Viktorin for\n>>:cve:'2025-4330'<< and >>:cve:'2024-12718'<<.)\n\n* *note extract(): 357. and *note extractall(): 356. no longer\nextract rejected members when *note errorlevel(): 359. is zero.\n(Contributed by Matt Prodani and Petr Viktorin in gh-112887(3) and\n>>:cve:'2025-4435'<<.)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/127987\n\n(2) https://github.com/python/cpython/issues/127987\n\n(3) https://github.com/python/cpython/issues/112887\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": [
                {
                    "name": "1.2 What's New In Python 3.11",
                    "content": ""
                }
            ]
        },
        "Editor: Pablo Galindo Salgado": {
            "content": "This article explains the new features in Python 3.10, compared to 3.9.",
            "subsections": []
        },
        "Python 3.11 was released on October 24, 2022.  For full details, see the": {
            "content": "*note changelog: 136.\n\n* Menu:\n\n* Summary - Release highlights: Summary - Release highlights<2>.\n* New Features: New Features<3>.\n* New Features Related to Type Hints: New Features Related to Type Hints<2>.\n* Other Language Changes: Other Language Changes<2>.\n* Other CPython Implementation Changes::\n* New Modules: New Modules<2>.\n* Improved Modules: Improved Modules<2>.\n* Optimizations: Optimizations<2>.\n* Faster CPython::\n* CPython bytecode changes: CPython bytecode changes<2>.\n* Deprecated: Deprecated<3>.\n* Pending Removal in Python 3.12: Pending Removal in Python 3 12.\n* Removed: Removed<3>.\n* Porting to Python 3.11: Porting to Python 3 11.\n* Build Changes: Build Changes<2>.\n* C API Changes: C API Changes<2>.\n* Notable changes in 3.11.4: Notable changes in 3 11 4.\n* Notable changes in 3.11.5: Notable changes in 3 11 5.\n\nFile: python3.12.info,  Node: Summary - Release highlights<2>,  Next: New Features<3>,  Up: What's New In Python 3 11\n\n\n* Python 3.11 is between 10-60% faster than Python 3.10.  On average,\nwe measured a 1.25x speedup on the standard benchmark suite.  See\n*note Faster CPython: 35e. for details.\n\nNew syntax features:\n\n* *note PEP 654; Exception Groups and except*: 35f.\n\nNew built-in features:\n\n* *note PEP 678; Exceptions can be enriched with notes: 360.\n\nNew standard library modules:\n\n* PEP 680(1): *note tomllib: f7. -- Support for parsing TOML(2) in the\nStandard Library\n\nInterpreter improvements:\n\n* *note PEP 657; Fine-grained error locations in tracebacks: 361.\n\n* New *note -P: 362. command line option and *note PYTHONSAFEPATH:\n363. environment variable to *note disable automatically prepending\npotentially unsafe paths: 364. to *note sys.path: 32c.\n\nNew typing features:\n\n* *note PEP 646; Variadic generics: 365.\n\n* *note PEP 655; Marking individual TypedDict items as required or\nnot-required: 366.\n\n* *note PEP 673; Self type: 367.\n\n* *note PEP 675; Arbitrary literal string type: 368.\n\n* *note PEP 681; Data class transforms: 369.\n\nImportant deprecations, removals and restrictions:\n\n* PEP 594(3): *note Many legacy standard library modules have been\ndeprecated: 36a. and will be removed in Python 3.13\n\n* PEP 624(4): *note PyUNICODE encoder APIs have been removed: 36b.\n\n* PEP 670(5): *note Macros converted to static inline functions: 36c.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0680/\n\n(2) https://toml.io/\n\n(3) https://peps.python.org/pep-0594/\n\n(4) https://peps.python.org/pep-0624/\n\n(5) https://peps.python.org/pep-0670/\n\nFile: python3.12.info,  Node: New Features<3>,  Next: New Features Related to Type Hints<2>,  Prev: Summary - Release highlights<2>,  Up: What's New In Python 3 11\n\n\n* Menu:\n\n* PEP 657; Fine-grained error locations in tracebacks: PEP 657 Fine-grained error locations in tracebacks.\n* PEP 654; Exception Groups and except*: PEP 654 Exception Groups and except*.\n* PEP 678; Exceptions can be enriched with notes: PEP 678 Exceptions can be enriched with notes.\n* Windows py.exe launcher improvements: Windows py exe launcher improvements.\n\nFile: python3.12.info,  Node: PEP 657 Fine-grained error locations in tracebacks,  Next: PEP 654 Exception Groups and except*,  Up: New Features<3>\n\n1.2.2.1 PEP 657: Fine-grained error locations in tracebacks\n...........................................................\n",
            "subsections": []
        },
        "When printing tracebacks, the interpreter will now point to the exact": {
            "content": "expression that caused the error, instead of just the line.  For\nexample:\n\nTraceback (most recent call last):\nFile \"distance.py\", line 11, in <module>\nprint(manhattandistance(p1, p2))\n^^^^^^^^^^^^^^^^^^^^^^^^^^\nFile \"distance.py\", line 6, in manhattandistance\nreturn abs(point1.x - point2.x) + abs(point1.y - point2.y)\n^^^^^^^^^\nAttributeError: 'NoneType' object has no attribute 'x'\n",
            "subsections": []
        },
        "Previous versions of the interpreter would point to just the line,": {
            "content": "making it ambiguous which object was 'None'.  These enhanced errors can\nalso be helpful when dealing with deeply nested *note dict: 237. objects\nand multiple function calls:\n\nTraceback (most recent call last):\nFile \"query.py\", line 37, in <module>\nmagicarithmetic('foo')\nFile \"query.py\", line 18, in magicarithmetic\nreturn addcounts(x) / 25\n^^^^^^^^^^^^^\nFile \"query.py\", line 24, in addcounts\nreturn 25 + queryuser(user1) + queryuser(user2)\n^^^^^^^^^^^^^^^^^\nFile \"query.py\", line 32, in queryuser\nreturn 1 + querycount(db, response['a']['b']['c']['user'], retry=True)\n~~~~~~~~~~~~~~~~~~^^^^^\nTypeError: 'NoneType' object is not subscriptable\n\nAs well as complex arithmetic expressions:\n\nTraceback (most recent call last):\nFile \"calculation.py\", line 54, in <module>\nresult = (x / y / z) * (a / b / c)\n~~~~~~^~~\nZeroDivisionError: division by zero\n",
            "subsections": []
        },
        "Additionally, the information used by the enhanced traceback feature is": {
            "content": "made available via a general API, that can be used to correlate *note\nbytecode: 370. *note instructions: 371. with source code location.  This\ninformation can be retrieved using:\n\n- The *note codeobject.copositions(): 372. method in Python.\n\n- The *note PyCodeAddr2Location(): 373. function in the C API.\n",
            "subsections": []
        },
        "See PEP 657(1) for more details.  (Contributed by Pablo Galindo, Batuhan": {
            "content": "",
            "subsections": []
        },
        "Taskaya and Ammar Askar in bpo-43950(2).)": {
            "content": "Note: This feature requires storing column positions in *note Code\nObjects: 374, which may result in a small increase in interpreter\nmemory usage and disk usage for compiled Python files.  To avoid\nstoring the extra information and deactivate printing the extra\ntraceback information, use the *note -X nodebugranges: 188.\ncommand line option or the *note PYTHONNODEBUGRANGES: 375.\nenvironment variable.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0657/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=43950\n\nFile: python3.12.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<3>\n\n1.2.2.2 PEP 654: Exception Groups and 'except*'\n...............................................\n\nPEP 654(1) introduces language features that enable a program to raise\nand handle multiple unrelated exceptions simultaneously.  The builtin\ntypes *note ExceptionGroup: 17b. and *note BaseExceptionGroup: 377. make\nit possible to group exceptions and raise them together, and the new\n*note except*: 378. syntax generalizes *note except: 379. to match\nsubgroups of exception groups.\n\nSee PEP 654(2) for more details.\n\n(Contributed by Irit Katriel in bpo-45292(3).  PEP written by Irit",
            "subsections": []
        },
        "Katriel, Yury Selivanov and Guido van Rossum.)": {
            "content": "---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0654/\n\n(2) https://peps.python.org/pep-0654/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=45292\n\nFile: python3.12.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<3>\n\n1.2.2.3 PEP 678: Exceptions can be enriched with notes\n......................................................\n\nThe *note addnote(): 37b. method is added to *note BaseException: 37c.",
            "subsections": []
        },
        "It can be used to enrich exceptions with context information that is not": {
            "content": "available at the time when the exception is raised.  The added notes\nappear in the default traceback.\n\nSee PEP 678(1) for more details.\n\n(Contributed by Irit Katriel in bpo-45607(2).  PEP written by Zac",
            "subsections": []
        },
        "Hatfield-Dodds.)": {
            "content": "---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0678/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=45607\n\nFile: python3.12.info,  Node: Windows py exe launcher improvements,  Prev: PEP 678 Exceptions can be enriched with notes,  Up: New Features<3>\n\n1.2.2.4 Windows 'py.exe' launcher improvements\n..............................................\n\nThe copy of the *note Python Launcher for Windows: 37f. included with",
            "subsections": []
        },
        "Python 3.11 has been significantly updated.  It now supports company/tag": {
            "content": "syntax as defined in PEP 514(1) using the '-V:<COMPANY>/<TAG>' argument\ninstead of the limited '-<MAJOR>.<MINOR>'.  This allows launching\ndistributions other than 'PythonCore', the one hosted on python.org(2).\n",
            "subsections": []
        },
        "When using '-V:' selectors, either company or tag can be omitted, but": {
            "content": "all installs will be searched.  For example, '-V:OtherPython/' will\nselect the \"best\" tag registered for 'OtherPython', while '-V:3.11' or\n'-V:/3.11' will select the \"best\" distribution with tag '3.11'.\n\nWhen using the legacy '-<MAJOR>', '-<MAJOR>.<MINOR>',\n'-<MAJOR>-<BITNESS>' or '-<MAJOR>.<MINOR>-<BITNESS>' arguments, all\nexisting behaviour should be preserved from past versions, and only\nreleases from 'PythonCore' will be selected.  However, the '-64' suffix\nnow implies \"not 32-bit\" (not necessarily x86-64), as there are multiple\nsupported 64-bit platforms.  32-bit runtimes are detected by checking\nthe runtime's tag for a '-32' suffix.  All releases of Python since 3.5\nhave included this in their 32-bit builds.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0514/\n\n(2) https://www.python.org\n\nFile: python3.12.info,  Node: New Features Related to Type Hints<2>,  Next: Other Language Changes<2>,  Prev: New Features<3>,  Up: What's New In Python 3 11\n\n",
            "subsections": []
        },
        "This section covers major changes affecting PEP 484(1) type hints and": {
            "content": "the *note typing: ff. module.\n\n* Menu:\n\n* PEP 604; New Type Union Operator: PEP 604 New Type Union Operator.\n* PEP 612; Parameter Specification Variables: PEP 612 Parameter Specification Variables.\n* PEP 613; TypeAlias: PEP 613 TypeAlias.\n* PEP 647; User-Defined Type Guards: PEP 647 User-Defined Type Guards.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0484/\n\nFile: python3.12.info,  Node: PEP 604 New Type Union Operator,  Next: PEP 612 Parameter Specification Variables,  Up: New Features Related to Type Hints<3>\n\n1.3.3.1 PEP 604: New Type Union Operator\n........................................\n\nA new type union operator was introduced which enables the syntax 'X |\nY'.  This provides a cleaner way of expressing 'either type X or type Y'\ninstead of using *note typing.Union: 408, especially in type hints.\n",
            "subsections": []
        },
        "TypeVarTuple: 162, enabling parameterisation with an 'arbitrary' number": {
            "content": "of types.  In other words, a *note TypeVarTuple: 162. is a 'variadic'\ntype variable, enabling 'variadic' generics.\n",
            "subsections": []
        },
        "This enables a wide variety of use cases.  In particular, it allows the": {
            "content": "type of array-like structures in numerical computing libraries such as",
            "subsections": []
        },
        "NumPy and TensorFlow to be parameterised with the array 'shape'.  Static": {
            "content": "type checkers will now be able to catch shape-related bugs in code that\nuses these libraries.\n\nSee PEP 646(3) for more details.\n\n(Contributed by Matthew Rahtz in bpo-43224(4), with contributions by",
            "subsections": []
        },
        "Serhiy Storchaka and Jelle Zijlstra.  PEP written by Mark Mendoza,": {
            "content": "",
            "subsections": []
        },
        "Matthew Rahtz, Pradeep Kumar Srinivasan, and Vincent Siles.)": {
            "content": "---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0484/\n\n(2) https://peps.python.org/pep-0646/\n\n(3) https://peps.python.org/pep-0646/\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=43224\n\nFile: python3.12.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>\n\n1.2.3.2 PEP 655: Marking individual 'TypedDict' items as required or not-required\n.................................................................................\n\n*note Required: 385. and *note NotRequired: 386. provide a\nstraightforward way to mark whether individual items in a *note",
            "subsections": []
        },
        "TypedDict: 153. must be present.  Previously, this was only possible": {
            "content": "using inheritance.\n",
            "subsections": []
        },
        "All fields are still required by default, unless the 'total' parameter": {
            "content": "is set to 'False', in which case all fields are still not-required by\ndefault.  For example, the following specifies a 'TypedDict' with one\nrequired and one not-required key:\n\nclass Movie(TypedDict):\ntitle: str\nyear: NotRequired[int]\n\nm1: Movie = {\"title\": \"Black Panther\", \"year\": 2018}  # OK\nm2: Movie = {\"title\": \"Star Wars\"}  # OK (year is not required)\nm3: Movie = {\"year\": 2022}  # ERROR (missing required field title)\n\nThe following definition is equivalent:\n\nclass Movie(TypedDict, total=False):\ntitle: Required[str]\nyear: int\n\nSee PEP 655(1) for more details.\n\n(Contributed by David Foster and Jelle Zijlstra in bpo-47087(2).  PEP\nwritten by David Foster.)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0655/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=47087\n\nFile: python3.12.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>\n\n1.2.3.3 PEP 673: 'Self' type\n............................\n\nThe new *note Self: 388. annotation provides a simple and intuitive way\nto annotate methods that return an instance of their class.  This\nbehaves the same as the *note TypeVar: 164.-based approach specified in\nPEP 484(1), but is more concise and easier to follow.\n\nCommon use cases include alternative constructors provided as *note\nclassmethod: 246.s, and *note enter(): 389. methods that return\n'self':\n\nclass MyLock:\ndef enter(self) -> Self:\nself.lock()\nreturn self\n\n...\n\nclass MyInt:\n@classmethod\ndef fromhex(cls, s: str) -> Self:\nreturn cls(int(s, 16))\n\n...\n\n*note Self: 388. can also be used to annotate method parameters or\nattributes of the same type as their enclosing class.\n\nSee PEP 673(2) for more details.\n\n(Contributed by James Hilton-Balfe in bpo-46534(3).  PEP written by",
            "subsections": []
        },
        "Pradeep Kumar Srinivasan and James Hilton-Balfe.)": {
            "content": "---------- Footnotes ----------\n\n(1)\nhttps://peps.python.org/pep-0484/#annotating-instance-and-class-methods\n\n(2) https://peps.python.org/pep-0673/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=46534\n\nFile: python3.12.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>\n\n1.2.3.4 PEP 675: Arbitrary literal string type\n..............................................\n\nThe new *note LiteralString: 38b. annotation may be used to indicate\nthat a function parameter can be of any literal string type.  This\nallows a function to accept arbitrary literal string types, as well as\nstrings created from other literal strings.  Type checkers can then\nenforce that sensitive functions, such as those that execute SQL\nstatements or shell commands, are called only with static arguments,\nproviding protection against injection attacks.\n\nFor example, a SQL query function could be annotated as follows:\n\ndef runquery(sql: LiteralString) -> ...\n...\n\ndef caller(\narbitrarystring: str,\nquerystring: LiteralString,\ntablename: LiteralString,\n) -> None:\nrunquery(\"SELECT * FROM students\")       # ok\nrunquery(querystring)                   # ok\nrunquery(\"SELECT * FROM \" + tablename)  # ok\nrunquery(arbitrarystring)               # type checker error\nrunquery(                                # type checker error\nf\"SELECT * FROM students WHERE name = {arbitrarystring}\"\n)\n\nSee PEP 675(1) for more details.\n\n(Contributed by Jelle Zijlstra in bpo-47088(2).  PEP written by Pradeep",
            "subsections": []
        },
        "Kumar Srinivasan and Graham Bleaney.)": {
            "content": "---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0675/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=47088\n\nFile: python3.12.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>\n\n1.2.3.5 PEP 681: Data class transforms\n......................................\n\n*note dataclasstransform: 1fa. may be used to decorate a class,\nmetaclass, or a function that is itself a decorator.  The presence of\n'@dataclasstransform()' tells a static type checker that the decorated\nobject performs runtime \"magic\" that transforms a class, giving it *note\ndataclass: 38d.-like behaviors.\n\nFor example:\n\n# The createmodel decorator is defined by a library.\n@typing.dataclasstransform()\ndef createmodel(cls: Type[T]) -> Type[T]:\ncls.init = ...\ncls.eq = ...\ncls.ne = ...\nreturn cls\n\n# The createmodel decorator can now be used to create new model classes:\n@createmodel\nclass CustomerModel:\nid: int\nname: str\n\nc = CustomerModel(id=327, name=\"Eric Idle\")\n\nSee PEP 681(1) for more details.\n\n(Contributed by Jelle Zijlstra in gh-91860(2).  PEP written by Erik De",
            "subsections": []
        },
        "Bonte and Eric Traut.)": {
            "content": "---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0681/\n\n(2) https://github.com/python/cpython/issues/91860\n\nFile: python3.12.info,  Node: PEP 563 may not be the future,  Prev: PEP 681 Data class transforms,  Up: New Features Related to Type Hints<2>\n\n1.2.3.6 PEP 563 may not be the future\n.....................................\n\nPEP 563(1) Postponed Evaluation of Annotations (the 'from future\nimport annotations' *note future statement: 390.) that was originally\nplanned for release in Python 3.10 has been put on hold indefinitely.\nSee this message from the Steering Council(2) for more information.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0563/\n\n(2)\nhttps://mail.python.org/archives/list/python-dev@python.org/message/VIZEBX5EYMSYIJNDBF6DMUMZOCWHARSO/\n\nFile: python3.12.info,  Node: Other Language Changes<2>,  Next: Other CPython Implementation Changes,  Prev: New Features Related to Type Hints<2>,  Up: What's New In Python 3 11\n\n\n* Starred unpacking expressions can now be used in *note for: 24e.\nstatements.  (See bpo-46725(1) for more details.)\n\n* Asynchronous *note comprehensions: 393. are now allowed inside\ncomprehensions in *note asynchronous functions: 394.  Outer\ncomprehensions implicitly become asynchronous in this case.\n(Contributed by Serhiy Storchaka in bpo-33346(2).)\n\n* A *note TypeError: 28e. is now raised instead of an *note\nAttributeError: 395. in *note with: 396. statements and *note\ncontextlib.ExitStack.entercontext(): 397. for objects that do not\nsupport the *note context manager: 398. protocol, and in *note\nasync with: 399. statements and *note\ncontextlib.AsyncExitStack.enterasynccontext(): 39a. for objects\nnot supporting the *note asynchronous context manager: 39b.\nprotocol.  (Contributed by Serhiy Storchaka in bpo-12022(3) and\nbpo-44471(4).)\n\n* Added *note object.getstate(): 39c, which provides the default\nimplementation of the 'getstate()' method.  *note copy: 23.ing\nand *note pickle: a1.ing instances of subclasses of builtin types\n*note bytearray: 294, *note set: 39d, *note frozenset: 39e, *note\ncollections.OrderedDict: 39f, *note collections.deque: 3a0, *note\nweakref.WeakSet: 3a1, and *note datetime.tzinfo: 3a2. now copies\nand pickles instance attributes implemented as *note slots: 3a3.\nThis change has an unintended side effect: It trips up a small\nminority of existing Python projects not expecting *note\nobject.getstate(): 39c. to exist.  See the later comments on\ngh-70766(5) for discussions of what workarounds such code may need.\n(Contributed by Serhiy Storchaka in bpo-26579(6).)\n\n* Added a *note -P: 362. command line option and a *note\nPYTHONSAFEPATH: 363. environment variable, which disable the\nautomatic prepending to *note sys.path: 32c. of the script's\ndirectory when running a script, or the current directory when\nusing *note -c: 3a4. and *note -m: 3a5.  This ensures only stdlib\nand installed modules are picked up by *note import: 3a6, and\navoids unintentionally or maliciously shadowing modules with those\nin a local (and typically user-writable) directory.  (Contributed\nby Victor Stinner in gh-57684(7).)\n\n* A '\"z\"' option was added to the *note Format Specification\nMini-Language: 3a7. that coerces negative to positive zero after\nrounding to the format precision.  See PEP 682(8) for more details.\n(Contributed by John Belmonte in gh-90153(9).)\n\n* Bytes are no longer accepted on *note sys.path: 32c.  Support broke\nsometime between Python 3.2 and 3.6, with no one noticing until\nafter Python 3.10.0 was released.  In addition, bringing back\nsupport would be problematic due to interactions between *note -b:\n3a8. and *note sys.pathimportercache: 3a9. when there is a\nmixture of *note str: 157. and *note bytes: 295. keys.\n(Contributed by Thomas Grainger in gh-91181(10).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=46725\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=33346\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=12022\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=44471\n\n(5) https://github.com/python/cpython/issues/70766\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=26579\n\n(7) https://github.com/python/cpython/issues/57684\n\n(8) https://peps.python.org/pep-0682/\n\n(9) https://github.com/python/cpython/issues/90153\n\n(10) https://github.com/python/cpython/issues/91181\n\nFile: python3.12.info,  Node: Other CPython Implementation Changes,  Next: New Modules<2>,  Prev: Other Language Changes<2>,  Up: What's New In Python 3 11\n\n\n* The special methods *note complex(): 3ac. for *note complex:\n3ad. and *note bytes(): 3ae. for *note bytes: 295. are\nimplemented to support the *note typing.SupportsComplex: 3af. and\n*note typing.SupportsBytes: 3b0. protocols.  (Contributed by Mark\nDickinson and Donghee Na in bpo-24234(1).)\n\n* 'siphash13' is added as a new internal hashing algorithm.  It has\nsimilar security properties as 'siphash24', but it is slightly\nfaster for long inputs.  *note str: 157, *note bytes: 295, and some\nother types now use it as the default algorithm for *note hash():\n3b1.  PEP 552(2) *note hash-based .pyc files: 3b2. now use\n'siphash13' too.  (Contributed by Inada Naoki in bpo-29410(3).)\n\n* When an active exception is re-raised by a *note raise: 3b3.\nstatement with no parameters, the traceback attached to this\nexception is now always 'sys.excinfo()[1].traceback'.  This\nmeans that changes made to the traceback in the current *note\nexcept: 379. clause are reflected in the re-raised exception.\n(Contributed by Irit Katriel in bpo-45711(4).)\n\n* The interpreter state's representation of handled exceptions (aka\n'excinfo' or 'PyErrStackItem') now only has the 'excvalue'\nfield; 'exctype' and 'exctraceback' have been removed, as they\ncan be derived from 'excvalue'.  (Contributed by Irit Katriel in\nbpo-45711(5).)\n\n* A new *note command line option: 3b4, 'AppendPath', has been added\nfor the Windows installer.  It behaves similarly to 'PrependPath',\nbut appends the install and scripts directories instead of\nprepending them.  (Contributed by Bastian Neuburger in\nbpo-44934(6).)\n\n* The *note PyConfig.modulesearchpathsset: 3b5. field must now be\nset to '1' for initialization to use *note\nPyConfig.modulesearchpaths: 3b6. to initialize *note sys.path:\n32c.  Otherwise, initialization will recalculate the path and\nreplace any values added to 'modulesearchpaths'.\n\n* The output of the *note -help: 3b7. option now fits in 50 lines/80\ncolumns.  Information about *note Python environment variables:\n3b8. and *note -X: 188. options is now available using the\nrespective *note -help-env: 3b9. and *note -help-xoptions: 3ba.\nflags, and with the new *note -help-all: 3bb.  (Contributed by ??ric\nAraujo in bpo-46142(7).)\n\n* Converting between *note int: 17e. and *note str: 157. in bases\nother than 2 (binary), 4, 8 (octal), 16 (hexadecimal), or 32 such\nas base 10 (decimal) now raises a *note ValueError: 183. if the\nnumber of digits in string form is above a limit to avoid potential\ndenial of service attacks due to the algorithmic complexity.  This\nis a mitigation for CVE-2020-10735(8).  This limit can be\nconfigured or disabled by environment variable, command line flag,\nor *note sys: d3. APIs.  See the *note integer string conversion\nlength limitation: 3bc. documentation.  The default limit is 4300\ndigits in string form.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24234\n\n(2) https://peps.python.org/pep-0552/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=29410\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=45711\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=45711\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=44934\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=46142\n\n(8) https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-10735\n\nFile: python3.12.info,  Node: New Modules<2>,  Next: Improved Modules<2>,  Prev: Other CPython Implementation Changes,  Up: What's New In Python 3 11\n\n\n* *note tomllib: f7.: For parsing TOML(1). See PEP 680(2) for more\ndetails.  (Contributed by Taneli Hukkinen in bpo-40059(3).)\n\n* *note wsgiref.types: 117.: WSGI(4)-specific types for static type\nchecking.  (Contributed by Sebastian Rittau in bpo-42012(5).)\n\n---------- Footnotes ----------\n\n(1) https://toml.io/\n\n(2) https://peps.python.org/pep-0680/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=40059\n\n(4) https://peps.python.org/pep-3333/\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=42012\n\nFile: python3.12.info,  Node: Improved Modules<2>,  Next: Optimizations<2>,  Prev: New Modules<2>,  Up: What's New In Python 3 11\n\n\n* Menu:\n\n* asyncio: asyncio<2>.\n* contextlib::\n* dataclasses::\n* datetime::\n* enum: enum<2>.\n* fcntl::\n* fractions: fractions<2>.\n* functools::\n* hashlib: hashlib<2>.\n* IDLE and idlelib::\n* inspect: inspect<2>.\n* locale: locale<2>.\n* logging::\n* math: math<2>.\n* operator::\n* os: os<2>.\n* pathlib: pathlib<2>.\n* re::\n* shutil: shutil<2>.\n* socket::\n* sqlite3: sqlite3<3>.\n* string::\n* sys: sys<2>.\n* sysconfig::\n* tempfile: tempfile<2>.\n* threading: threading<2>.\n* time::\n* tkinter: tkinter<2>.\n* traceback::\n* typing: typing<2>.\n* unicodedata: unicodedata<2>.\n* unittest: unittest<3>.\n* venv::\n* warnings::\n* zipfile::\n\nFile: python3.12.info,  Node: asyncio<2>,  Next: contextlib,  Up: Improved Modules<2>\n\n1.2.7.1 asyncio\n...............\n\n* Added the *note TaskGroup: 3c3. class, an *note asynchronous\ncontext manager: 3c4. holding a group of tasks that will wait for\nall of them upon exit.  For new code this is recommended over using\n*note createtask(): 3c5. and *note gather(): 3c6. directly.\n(Contributed by Yury Selivanov and others in gh-90908(1).)\n\n* Added *note timeout(): 3c7, an asynchronous context manager for\nsetting a timeout on asynchronous operations.  For new code this is\nrecommended over using *note waitfor(): 3c8. directly.\n(Contributed by Andrew Svetlov in gh-90927(2).)\n\n* Added the *note Runner: 3c9. class, which exposes the machinery\nused by *note run(): 197.  (Contributed by Andrew Svetlov in\ngh-91218(3).)\n\n* Added the *note Barrier: 3ca. class to the synchronization\nprimitives in the asyncio library, and the related *note\nBrokenBarrierError: 3cb. exception.  (Contributed by Yves Duprat\nand Andrew Svetlov in gh-87518(4).)\n\n* Added keyword argument 'allerrors' to *note\nasyncio.loop.createconnection(): 3cc. so that multiple connection\nerrors can be raised as an *note ExceptionGroup: 17b.\n\n* Added the *note asyncio.StreamWriter.starttls(): 3cd. method for\nupgrading existing stream-based connections to TLS. (Contributed by\nIan Good in bpo-34975(5).)\n\n* Added raw datagram socket functions to the event loop: *note\nsocksendto(): 3ce, *note sockrecvfrom(): 3cf. and *note\nsockrecvfrominto(): 3d0.  These have implementations in *note\nSelectorEventLoop: 3d1. and *note ProactorEventLoop: 3d2.\n(Contributed by Alex Gro\"nholm in bpo-46805(6).)\n\n* Added *note cancelling(): 3d3. and *note uncancel(): 3d4. methods\nto *note Task: 201.  These are primarily intended for internal use,\nnotably by *note TaskGroup: 3c3.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/90908\n\n(2) https://github.com/python/cpython/issues/90927\n\n(3) https://github.com/python/cpython/issues/91218\n\n(4) https://github.com/python/cpython/issues/87518\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=34975\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=46805\n\nFile: python3.12.info,  Node: contextlib,  Next: dataclasses,  Prev: asyncio<2>,  Up: Improved Modules<2>\n\n1.2.7.2 contextlib\n..................\n\n* Added non parallel-safe *note chdir(): 3d7. context manager to\nchange the current working directory and then restore it on exit.\nSimple wrapper around *note chdir(): 3d8.  (Contributed by Filipe\nLa??ns in bpo-25625(1))\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25625\n\nFile: python3.12.info,  Node: dataclasses,  Next: datetime,  Prev: contextlib,  Up: Improved Modules<2>\n\n1.2.7.3 dataclasses\n...................\n\n* Change field default mutability check, allowing only defaults which\nare *note hashable: 3db. instead of any object which is not an\ninstance of *note dict: 237, *note list: 3dc. or *note set: 39d.\n(Contributed by Eric V. Smith in bpo-44674(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=44674\n\nFile: python3.12.info,  Node: datetime,  Next: enum<2>,  Prev: dataclasses,  Up: Improved Modules<2>\n\n1.2.7.4 datetime\n................\n\n* Add *note datetime.UTC: 227, a convenience alias for *note\ndatetime.timezone.utc: 3df.  (Contributed by Kabir Kwatra in\ngh-91973(1).)\n\n* *note datetime.date.fromisoformat(): 3e0, *note\ndatetime.time.fromisoformat(): 3e1. and *note\ndatetime.datetime.fromisoformat(): 3e2. can now be used to parse\nmost ISO 8601 formats (barring only those that support fractional\nhours and minutes).  (Contributed by Paul Ganssle in gh-80010(2).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/91973\n\n(2) https://github.com/python/cpython/issues/80010\n\nFile: python3.12.info,  Node: enum<2>,  Next: fcntl,  Prev: datetime,  Up: Improved Modules<2>\n\n1.2.7.5 enum\n............\n\n* Renamed 'EnumMeta' to *note EnumType: 3e5. ('EnumMeta' kept as an\nalias).\n\n* Added *note StrEnum: 3e6, with members that can be used as (and\nmust be) strings.\n\n* Added *note ReprEnum: 3e7, which only modifies the *note\nrepr(): 3e8. of members while returning their literal values\n(rather than names) for *note str(): 3e9. and *note\nformat(): 3ea. (used by *note str(): 157, *note format(): 3eb.\nand *note f-string: 138.s).\n\n* Changed *note Enum.format(): 3ec. (the default for *note\nformat(): 3eb, *note str.format(): 3ed. and *note f-string: 138.s)\nto always produce the same result as *note Enum.str(): 3ee.:\nfor enums inheriting from *note ReprEnum: 3e7. it will be the\nmember's value; for all other enums it will be the enum and member\nname (e.g.  'Color.RED').\n\n* Added a new 'boundary' class parameter to *note Flag: 3ef. enums\nand the *note FlagBoundary: 3f0. enum with its options, to control\nhow to handle out-of-range flag values.\n\n* Added the *note verify(): 3f1. enum decorator and the *note\nEnumCheck: 3f2. enum with its options, to check enum classes\nagainst several specific constraints.\n\n* Added the *note member(): 3f3. and *note nonmember(): 3f4.\ndecorators, to ensure the decorated object is/is not converted to\nan enum member.\n\n* Added the *note property(): 3f5. decorator, which works like *note\nproperty(): 3f6. except for enums.  Use this instead of *note\ntypes.DynamicClassAttribute(): 3f7.\n\n* Added the *note globalenum(): 3f8. enum decorator, which adjusts\n*note repr(): 3e8. and *note str(): 3e9. to show values as\nmembers of their module rather than the enum class.  For example,\n''re.ASCII'' for the *note ASCII: 3f9. member of *note\nre.RegexFlag: 3fa. rather than ''RegexFlag.ASCII''.\n\n* Enhanced *note Flag: 3ef. to support *note len(): 3fb, iteration\nand *note in: 250./*note not in: 3fc. on its members.  For example,\nthe following now works: 'len(AFlag(3)) == 2 and list(AFlag(3)) ==\n(AFlag.ONE, AFlag.TWO)'\n\n* Changed *note Enum: 3fd. and *note Flag: 3ef. so that members are\nnow defined before *note initsubclass(): 3fe. is called; *note\ndir(): 3ff. now includes methods, etc., from mixed-in data types.\n\n* Changed *note Flag: 3ef. to only consider primary values (power of\ntwo) canonical while composite values ('3', '6', '10', etc.)  are\nconsidered aliases; inverted flags are coerced to their positive\nequivalent.\n\nFile: python3.12.info,  Node: fcntl,  Next: fractions<2>,  Prev: enum<2>,  Up: Improved Modules<2>\n\n1.2.7.6 fcntl\n.............\n\n* On FreeBSD, the 'FDUP2FD' and 'FDUP2FDCLOEXEC' flags\nrespectively are supported, the former equals to 'dup2' usage while\nthe latter set the 'FDCLOEXEC' flag in addition.\n\nFile: python3.12.info,  Node: fractions<2>,  Next: functools,  Prev: fcntl,  Up: Improved Modules<2>\n\n1.2.7.7 fractions\n.................\n\n* Support PEP 515(1)-style initialization of *note Fraction: 1a8.\nfrom string.  (Contributed by Sergey B Kirpichev in bpo-44258(2).)\n\n* *note Fraction: 1a8. now implements an 'int' method, so that an\n'isinstance(somefraction, typing.SupportsInt)' check passes.\n(Contributed by Mark Dickinson in bpo-44547(3).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0515/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=44258\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=44547\n\nFile: python3.12.info,  Node: functools,  Next: hashlib<2>,  Prev: fractions<2>,  Up: Improved Modules<2>\n\n1.2.7.8 functools\n.................\n\n* *note functools.singledispatch(): 406. now supports *note\ntypes.UnionType: 407. and *note typing.Union: 408. as annotations\nto the dispatch argument.:\n\n>>> from functools import singledispatch\n>>> @singledispatch\n... def fun(arg, verbose=False):\n...     if verbose:\n...         print(\"Let me just say,\", end=\" \")\n...     print(arg)\n...\n>>> @fun.register\n... def (arg: int | float, verbose=False):\n...     if verbose:\n...         print(\"Strength in numbers, eh?\", end=\" \")\n...     print(arg)\n...\n>>> from typing import Union\n>>> @fun.register\n... def (arg: Union[list, set], verbose=False):\n...     if verbose:\n...         print(\"Enumerate this:\")\n...     for i, elem in enumerate(arg):\n...         print(i, elem)\n...\n\n(Contributed by Yurii Karabas in bpo-46014(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=46014\n\nFile: python3.12.info,  Node: hashlib<2>,  Next: IDLE and idlelib,  Prev: functools,  Up: Improved Modules<2>\n\n1.2.7.9 hashlib\n...............\n\n* *note hashlib.blake2b(): 40b. and *note hashlib.blake2s(): 40c. now\nprefer libb2(1) over Python's vendored copy.  (Contributed by\nChristian Heimes in bpo-47095(2).)\n\n* The internal 'sha3' module with SHA3 and SHAKE algorithms now uses\n'tinysha3' instead of the 'Keccak Code Package' to reduce code and\nbinary size.  The *note hashlib: 63. module prefers optimized SHA3\nand SHAKE implementations from OpenSSL. The change affects only\ninstallations without OpenSSL support.  (Contributed by Christian\nHeimes in bpo-47098(3).)\n\n* Add *note hashlib.filedigest(): 40d, a helper function for\nefficient hashing of files or file-like objects.  (Contributed by\nChristian Heimes in gh-89313(4).)\n\n---------- Footnotes ----------\n\n(1) https://www.blake2.net/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=47095\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=47098\n\n(4) https://github.com/python/cpython/issues/89313\n\nFile: python3.12.info,  Node: IDLE and idlelib,  Next: inspect<2>,  Prev: hashlib<2>,  Up: Improved Modules<2>\n\n1.2.7.10 IDLE and idlelib\n.........................\n\n* Apply syntax highlighting to '.pyi' files.  (Contributed by Alex\nWaygood and Terry Jan Reedy in bpo-45447(1).)\n\n* Include prompts when saving Shell with inputs and outputs.\n(Contributed by Terry Jan Reedy in gh-95191(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=45447\n\n(2) https://github.com/python/cpython/issues/95191\n\nFile: python3.12.info,  Node: inspect<2>,  Next: locale<2>,  Prev: IDLE and idlelib,  Up: Improved Modules<2>\n\n1.2.7.11 inspect\n................\n\n* Add *note getmembersstatic(): 412. to return all members without\ntriggering dynamic lookup via the descriptor protocol.\n(Contributed by Weipeng Hong in bpo-30533(1).)\n\n* Add *note ismethodwrapper(): 413. for checking if the type of an\nobject is a *note MethodWrapperType: 414.  (Contributed by Hakan\nC,elik in bpo-29418(2).)\n\n* Change the frame-related functions in the *note inspect: 78. module\nto return new *note FrameInfo: 415. and *note Traceback: 416. class\ninstances (backwards compatible with the previous *note named\ntuple: 417.-like interfaces) that includes the extended PEP 657(3)\nposition information (end line number, column and end column).  The\naffected functions are:\n\n* *note inspect.getframeinfo(): 418.\n\n* *note inspect.getouterframes(): 419.\n\n* *note inspect.getinnerframes(): 41a,\n\n* *note inspect.stack(): 41b.\n\n* *note inspect.trace(): 41c.\n\n(Contributed by Pablo Galindo in gh-88116(4).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30533\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=29418\n\n(3) https://peps.python.org/pep-0657/\n\n(4) https://github.com/python/cpython/issues/88116\n\nFile: python3.12.info,  Node: locale<2>,  Next: logging,  Prev: inspect<2>,  Up: Improved Modules<2>\n\n1.2.7.12 locale\n...............\n\n* Add *note locale.getencoding(): 41f. to get the current locale\nencoding.  It is similar to 'locale.getpreferredencoding(False)'\nbut ignores the *note Python UTF-8 Mode: 420.\n\nFile: python3.12.info,  Node: logging,  Next: math<2>,  Prev: locale<2>,  Up: Improved Modules<2>\n\n1.2.7.13 logging\n................\n\n* Added *note getLevelNamesMapping(): 423. to return a mapping from\nlogging level names (e.g.  ''CRITICAL'') to the values of their\ncorresponding *note Logging Levels: 424. (e.g.  '50', by default).\n(Contributed by Andrei Kulakovin in gh-88024(1).)\n\n* Added a *note createSocket(): 425. method to *note SysLogHandler:\n426, to match *note SocketHandler.createSocket(): 427.  It is\ncalled automatically during handler initialization and when\nemitting an event, if there is no active socket.  (Contributed by\nKirill Pinchuk in gh-88457(2).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/88024\n\n(2) https://github.com/python/cpython/issues/88457\n\nFile: python3.12.info,  Node: math<2>,  Next: operator,  Prev: logging,  Up: Improved Modules<2>\n\n1.2.7.14 math\n.............\n\n* Add *note math.exp2(): 42a.: return 2 raised to the power of x.\n(Contributed by Gideon Mitchell in bpo-45917(1).)\n\n* Add *note math.cbrt(): 42b.: return the cube root of x.\n(Contributed by Ajith Ramachandran in bpo-44357(2).)\n\n* The behaviour of two *note math.pow(): 42c. corner cases was\nchanged, for consistency with the IEEE 754 specification.  The\noperations 'math.pow(0.0, -math.inf)' and 'math.pow(-0.0,\n-math.inf)' now return 'inf'.  Previously they raised *note\nValueError: 183.  (Contributed by Mark Dickinson in bpo-44339(3).)\n\n* The *note math.nan: 42d. value is now always available.\n(Contributed by Victor Stinner in bpo-46917(4).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=45917\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=44357\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=44339\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=46917\n\nFile: python3.12.info,  Node: operator,  Next: os<2>,  Prev: math<2>,  Up: Improved Modules<2>\n\n1.2.7.15 operator\n.................\n\n* A new function 'operator.call' has been added, such that\n'operator.call(obj, *args, kwargs) == obj(*args, kwargs)'.\n(Contributed by Antony Lee in bpo-44019(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=44019\n\nFile: python3.12.info,  Node: os<2>,  Next: pathlib<2>,  Prev: operator,  Up: Improved Modules<2>\n\n1.2.7.16 os\n...........\n\n* On Windows, *note os.urandom(): 276. now uses 'BCryptGenRandom()',\ninstead of 'CryptGenRandom()' which is deprecated.  (Contributed by\nDonghee Na in bpo-44611(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=44611\n\nFile: python3.12.info,  Node: pathlib<2>,  Next: re,  Prev: os<2>,  Up: Improved Modules<2>\n\n1.2.7.17 pathlib\n................\n\n* *note glob(): 1cc. and *note rglob(): 1cd. return only directories\nif 'pattern' ends with a pathname components separator: *note sep:\n434. or *note altsep: 435.  (Contributed by Eisuke Kawasima in\nbpo-22276(1) and bpo-33392(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=22276\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=33392\n\nFile: python3.12.info,  Node: re,  Next: shutil<2>,  Prev: pathlib<2>,  Up: Improved Modules<2>\n\n1.2.7.18 re\n...........\n\n* Atomic grouping ('(?>...)') and possessive quantifiers ('*+', '++',\n'?+', '{m,n}+') are now supported in regular expressions.\n(Contributed by Jeffrey C. Jacobs and Serhiy Storchaka in\nbpo-433030(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=433030\n\nFile: python3.12.info,  Node: shutil<2>,  Next: socket,  Prev: re,  Up: Improved Modules<2>\n\n1.2.7.19 shutil\n...............\n\n* Add optional parameter 'dirfd' in *note shutil.rmtree(): 1d5.\n(Contributed by Serhiy Storchaka in bpo-46245(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=46245\n\nFile: python3.12.info,  Node: socket,  Next: sqlite3<3>,  Prev: shutil<2>,  Up: Improved Modules<2>\n\n1.2.7.20 socket\n...............\n\n* Add CAN Socket support for NetBSD. (Contributed by Thomas Klausner\nin bpo-30512(1).)\n\n* *note createconnection(): 43c. has an option to raise, in case of\nfailure to connect, an *note ExceptionGroup: 17b. containing all\nerrors instead of only raising the last error.  (Contributed by\nIrit Katriel in bpo-29980(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30512\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=29980\n\nFile: python3.12.info,  Node: sqlite3<3>,  Next: string,  Prev: socket,  Up: Improved Modules<2>\n\n1.2.7.21 sqlite3\n................\n\n* You can now disable the authorizer by passing *note None: 43f. to\n*note setauthorizer(): 440.  (Contributed by Erlend E. Aasland in\nbpo-44491(1).)\n\n* Collation name *note createcollation(): 441. can now contain any\nUnicode character.  Collation names with invalid characters now\nraise *note UnicodeEncodeError: 442. instead of *note\nsqlite3.ProgrammingError: 238.  (Contributed by Erlend E. Aasland\nin bpo-44688(2).)\n\n* *note sqlite3: c9. exceptions now include the SQLite extended error\ncode as *note sqliteerrorcode: 443. and the SQLite error name as\n*note sqliteerrorname: 444.  (Contributed by Aviv Palivoda, Daniel\nShahaf, and Erlend E. Aasland in bpo-16379(3) and bpo-24139(4).)\n\n* Add *note setlimit(): 445. and *note getlimit(): 446. to *note\nsqlite3.Connection: 1d9. for setting and getting SQLite limits by\nconnection basis.  (Contributed by Erlend E. Aasland in\nbpo-45243(5).)\n\n* *note sqlite3: c9. now sets *note sqlite3.threadsafety: 447. based\non the default threading mode the underlying SQLite library has\nbeen compiled with.  (Contributed by Erlend E. Aasland in\nbpo-45613(6).)\n\n* *note sqlite3: c9. C callbacks now use unraisable exceptions if\ncallback tracebacks are enabled.  Users can now register an *note\nunraisable hook handler: 448. to improve their debug experience.\n(Contributed by Erlend E. Aasland in bpo-45828(7).)\n\n* Fetch across rollback no longer raises *note InterfaceError: 449.\nInstead we leave it to the SQLite library to handle these cases.\n(Contributed by Erlend E. Aasland in bpo-44092(8).)\n\n* Add *note serialize(): 44a. and *note deserialize(): 44b. to *note\nsqlite3.Connection: 1d9. for serializing and deserializing\ndatabases.  (Contributed by Erlend E. Aasland in bpo-41930(9).)\n\n* Add *note createwindowfunction(): 44c. to *note\nsqlite3.Connection: 1d9. for creating aggregate window functions.\n(Contributed by Erlend E. Aasland in bpo-34916(10).)\n\n* Add *note blobopen(): 44d. to *note sqlite3.Connection: 1d9.  *note\nsqlite3.Blob: 44e. allows incremental I/O operations on blobs.\n(Contributed by Aviv Palivoda and Erlend E. Aasland in\nbpo-24905(11).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=44491\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=44688\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=16379\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=24139\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=45243\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=45613\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=45828\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=44092\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=41930\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=34916\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=24905\n\nFile: python3.12.info,  Node: string,  Next: sys<2>,  Prev: sqlite3<3>,  Up: Improved Modules<2>\n\n1.2.7.22 string\n...............\n\n* Add *note getidentifiers(): 451. and *note isvalid(): 452. to\n*note string.Template: 453, which respectively return all valid\nplaceholders, and whether any invalid placeholders are present.\n(Contributed by Ben Kehoe in gh-90465(1).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/90465\n\nFile: python3.12.info,  Node: sys<2>,  Next: sysconfig,  Prev: string,  Up: Improved Modules<2>\n\n1.2.7.23 sys\n............\n\n* *note sys.excinfo(): 456. now derives the 'type' and 'traceback'\nfields from the 'value' (the exception instance), so when an\nexception is modified while it is being handled, the changes are\nreflected in the results of subsequent calls to 'excinfo()'.\n(Contributed by Irit Katriel in bpo-45711(1).)\n\n* Add *note sys.exception(): 457. which returns the active exception\ninstance (equivalent to 'sys.excinfo()[1]').  (Contributed by Irit\nKatriel in bpo-46328(2).)\n\n* Add the *note sys.flags.safepath: 458. flag.  (Contributed by\nVictor Stinner in gh-57684(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=45711\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=46328\n\n(3) https://github.com/python/cpython/issues/57684\n\nFile: python3.12.info,  Node: sysconfig,  Next: tempfile<2>,  Prev: sys<2>,  Up: Improved Modules<2>\n\n1.2.7.24 sysconfig\n..................\n\n* Three new *note installation schemes: 45b. ('posixvenv', 'ntvenv'\nand 'venv') were added and are used when Python creates new virtual\nenvironments or when it is running from a virtual environment.  The\nfirst two schemes ('posixvenv' and 'ntvenv') are OS-specific for\nnon-Windows and Windows, the 'venv' is essentially an alias to one\nof them according to the OS Python runs on.  This is useful for\ndownstream distributors who modify *note\nsysconfig.getpreferredscheme(): 45c.  Third party code that\ncreates new virtual environments should use the new 'venv'\ninstallation scheme to determine the paths, as does *note venv:\n10c.  (Contributed by Miro Hron??ok in bpo-45413(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=45413\n\nFile: python3.12.info,  Node: tempfile<2>,  Next: threading<2>,  Prev: sysconfig,  Up: Improved Modules<2>\n\n1.2.7.25 tempfile\n.................\n\n* *note SpooledTemporaryFile: 45f. objects now fully implement the\nmethods of *note io.BufferedIOBase: 460. or *note io.TextIOBase:\n461. (depending on file mode).  This lets them work correctly with\nAPIs that expect file-like objects, such as compression modules.\n(Contributed by Carey Metcalfe in gh-70363(1).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/70363\n\nFile: python3.12.info,  Node: threading<2>,  Next: time,  Prev: tempfile<2>,  Up: Improved Modules<2>\n\n1.2.7.26 threading\n..................\n\n* On Unix, if the 'semclockwait()' function is available in the C\nlibrary (glibc 2.30 and newer), the *note threading.Lock.acquire():\n464. method now uses the monotonic clock (*note\ntime.CLOCKMONOTONIC: 465.) for the timeout, rather than using the\nsystem clock (*note time.CLOCKREALTIME: 466.), to not be affected\nby system clock changes.  (Contributed by Victor Stinner in\nbpo-41710(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=41710\n\nFile: python3.12.info,  Node: time,  Next: tkinter<2>,  Prev: threading<2>,  Up: Improved Modules<2>\n\n1.2.7.27 time\n.............\n\n* On Unix, *note time.sleep(): 469. now uses the 'clocknanosleep()'\nor 'nanosleep()' function, if available, which has a resolution of\n1 nanosecond (10^-9 seconds), rather than using 'select()' which\nhas a resolution of 1 microsecond (10^-6 seconds).  (Contributed by\nBenjamin Sz??ke and Victor Stinner in bpo-21302(1).)\n\n* On Windows 8.1 and newer, *note time.sleep(): 469. now uses a\nwaitable timer based on high-resolution timers(2) which has a\nresolution of 100 nanoseconds (10^-7 seconds).  Previously, it had\na resolution of 1 millisecond (10^-3 seconds).  (Contributed by\nBenjamin Sz??ke, Donghee Na, Eryk Sun and Victor Stinner in\nbpo-21302(3) and bpo-45429(4).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=21302\n\n(2)\nhttps://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/high-resolution-timers\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=21302\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=45429\n\nFile: python3.12.info,  Node: tkinter<2>,  Next: traceback,  Prev: time,  Up: Improved Modules<2>\n\n1.2.7.28 tkinter\n................\n\n* Added method 'infopatchlevel()' which returns the exact version of\nthe Tcl library as a named tuple similar to *note sys.versioninfo:\n46c.  (Contributed by Serhiy Storchaka in gh-91827(1).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/91827\n\nFile: python3.12.info,  Node: traceback,  Next: typing<2>,  Prev: tkinter<2>,  Up: Improved Modules<2>\n\n1.2.7.29 traceback\n..................\n\n* Add *note traceback.StackSummary.formatframesummary(): 46f. to\nallow users to override which frames appear in the traceback, and\nhow they are formatted.  (Contributed by Ammar Askar in\nbpo-44569(1).)\n\n* Add *note traceback.TracebackException.print(): 470, which prints\nthe formatted *note TracebackException: 471. instance to a file.\n(Contributed by Irit Katriel in bpo-33809(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=44569\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=33809\n\nFile: python3.12.info,  Node: typing<2>,  Next: unicodedata<2>,  Prev: traceback,  Up: Improved Modules<2>\n\n1.2.7.30 typing\n...............\n\nFor major changes, see *note New Features Related to Type Hints: 380.\n\n* Add *note typing.assertnever(): 474. and *note typing.Never: 475.\n*note typing.assertnever(): 474. is useful for asking a type\nchecker to confirm that a line of code is not reachable.  At\nruntime, it raises an *note AssertionError: 476.  (Contributed by\nJelle Zijlstra in gh-90633(1).)\n\n* Add *note typing.revealtype(): 477.  This is useful for asking a\ntype checker what type it has inferred for a given expression.  At\nruntime it prints the type of the received value.  (Contributed by\nJelle Zijlstra in gh-90572(2).)\n\n* Add *note typing.asserttype(): 478.  This is useful for asking a\ntype checker to confirm that the type it has inferred for a given\nexpression matches the given type.  At runtime it simply returns\nthe received value.  (Contributed by Jelle Zijlstra in\ngh-90638(3).)\n\n* *note typing.TypedDict: 153. types can now be generic.\n(Contributed by Samodya Abeysiriwardane in gh-89026(4).)\n\n* *note NamedTuple: 1f9. types can now be generic.  (Contributed by\nSerhiy Storchaka in bpo-43923(5).)\n\n* Allow subclassing of *note typing.Any: 479.  This is useful for\navoiding type checker errors related to highly dynamic class, such\nas mocks.  (Contributed by Shantanu Jain in gh-91154(6).)\n\n* The *note typing.final(): 47a. decorator now sets the 'final'\nattributed on the decorated object.  (Contributed by Jelle Zijlstra\nin gh-90500(7).)\n\n* The *note typing.getoverloads(): 47b. function can be used for\nintrospecting the overloads of a function.  *note\ntyping.clearoverloads(): 47c. can be used to clear all registered\noverloads of a function.  (Contributed by Jelle Zijlstra in\ngh-89263(8).)\n\n* The *note init(): 47d. method of *note Protocol: 47e.\nsubclasses is now preserved.  (Contributed by Adrian Garcia\nBadarasco in gh-88970(9).)\n\n* The representation of empty tuple types ('Tuple[()]') is\nsimplified.  This affects introspection, e.g.\n'getargs(Tuple[()])' now evaluates to '()' instead of '((),)'.\n(Contributed by Serhiy Storchaka in gh-91137(10).)\n\n* Loosen runtime requirements for type annotations by removing the\ncallable check in the private 'typing.typecheck' function.\n(Contributed by Gregory Beauregard in gh-90802(11).)\n\n* *note typing.gettypehints(): 47f. now supports evaluating strings\nas forward references in *note PEP 585 generic aliases: 480.\n(Contributed by Niklas Rosenstein in gh-85542(12).)\n\n* *note typing.gettypehints(): 47f. no longer adds *note Optional:\n481. to parameters with 'None' as a default.  (Contributed by\nNikita Sobolev in gh-90353(13).)\n\n* *note typing.gettypehints(): 47f. now supports evaluating bare\nstringified *note ClassVar: 482. annotations.  (Contributed by\nGregory Beauregard in gh-90711(14).)\n\n* *note typing.notypecheck(): 483. no longer modifies external\nclasses and functions.  It also now correctly marks classmethods as\nnot to be type checked.  (Contributed by Nikita Sobolev in\ngh-90729(15).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/90633\n\n(2) https://github.com/python/cpython/issues/90572\n\n(3) https://github.com/python/cpython/issues/90638\n\n(4) https://github.com/python/cpython/issues/89026\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=43923\n\n(6) https://github.com/python/cpython/issues/91154\n\n(7) https://github.com/python/cpython/issues/90500\n\n(8) https://github.com/python/cpython/issues/89263\n\n(9) https://github.com/python/cpython/issues/88970\n\n(10) https://github.com/python/cpython/issues/91137\n\n(11) https://github.com/python/cpython/issues/90802\n\n(12) https://github.com/python/cpython/issues/85542\n\n(13) https://github.com/python/cpython/issues/90353\n\n(14) https://github.com/python/cpython/issues/90711\n\n(15) https://github.com/python/cpython/issues/90729\n\nFile: python3.12.info,  Node: unicodedata<2>,  Next: unittest<3>,  Prev: typing<2>,  Up: Improved Modules<2>\n\n1.2.7.31 unicodedata\n....................\n\n* The Unicode database has been updated to version 14.0.0.\n(Contributed by Benjamin Peterson in bpo-45190(1)).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=45190\n\nFile: python3.12.info,  Node: unittest<3>,  Next: venv,  Prev: unicodedata<2>,  Up: Improved Modules<2>\n\n1.2.7.32 unittest\n.................\n\n* Added methods *note enterContext(): 488. and *note\nenterClassContext(): 489. of class *note TestCase: 159, method\n*note enterAsyncContext(): 48a. of class *note\nIsolatedAsyncioTestCase: 48b. and function *note\nunittest.enterModuleContext(): 48c.  (Contributed by Serhiy\nStorchaka in bpo-45046(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=45046\n\nFile: python3.12.info,  Node: venv,  Next: warnings,  Prev: unittest<3>,  Up: Improved Modules<2>\n\n1.2.7.33 venv\n.............\n\n* When new Python virtual environments are created, the 'venv' *note\nsysconfig installation scheme: 45b. is used to determine the paths\ninside the environment.  When Python runs in a virtual environment,\nthe same installation scheme is the default.  That means that\ndownstream distributors can change the default sysconfig install\nscheme without changing behavior of virtual environments.  Third\nparty code that also creates new virtual environments should do the\nsame.  (Contributed by Miro Hron??ok in bpo-45413(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=45413\n\nFile: python3.12.info,  Node: warnings,  Next: zipfile,  Prev: venv,  Up: Improved Modules<2>\n\n1.2.7.34 warnings\n.................\n\n* *note warnings.catchwarnings(): 2e6. now accepts arguments for\n*note warnings.simplefilter(): 491, providing a more concise way to\nlocally ignore warnings or convert them to errors.  (Contributed by\nZac Hatfield-Dodds in bpo-47074(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=47074\n\nFile: python3.12.info,  Node: zipfile,  Prev: warnings,  Up: Improved Modules<2>\n\n1.2.7.35 zipfile\n................\n\n* Added support for specifying member name encoding for reading\nmetadata in a *note ZipFile: 494.'s directory and file headers.\n(Contributed by Stephen J. Turnbull and Serhiy Storchaka in\nbpo-28080(1).)\n\n* Added *note ZipFile.mkdir(): 495. for creating new directories\ninside ZIP archives.  (Contributed by Sam Ezeh in gh-49083(2).)\n\n* Added *note stem: 496, *note suffix: 497. and *note suffixes: 498.\nto *note zipfile.Path: 499.  (Contributed by Miguel Brito in\ngh-88261(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28080\n\n(2) https://github.com/python/cpython/issues/49083\n\n(3) https://github.com/python/cpython/issues/88261\n\nFile: python3.12.info,  Node: Optimizations<2>,  Next: Faster CPython,  Prev: Improved Modules<2>,  Up: What's New In Python 3 11\n\n\nThis section covers specific optimizations independent of the *note\nFaster CPython: 35e. project, which is covered in its own section.\n\n* The compiler now optimizes simple *note printf-style % formatting:\n49c. on string literals containing only the format codes '%s', '%r'\nand '%a' and makes it as fast as a corresponding *note f-string:\n138. expression.  (Contributed by Serhiy Storchaka in\nbpo-28307(1).)\n\n* Integer division ('//') is better tuned for optimization by\ncompilers.  It is now around 20% faster on x86-64 when dividing an\n*note int: 17e. by a value smaller than '230'.  (Contributed by\nGregory P. Smith and Tim Peters in gh-90564(2).)\n\n* *note sum(): 181. is now nearly 30% faster for integers smaller\nthan '230'.  (Contributed by Stefan Behnel in gh-68264(3).)\n\n* Resizing lists is streamlined for the common case, speeding up\n'list.append()' by ???15% and simple *note list comprehension: 49d.s\nby up to 20-30% (Contributed by Dennis Sweeney in gh-91165(4).)\n\n* Dictionaries don't store hash values when all keys are Unicode\nobjects, decreasing *note dict: 237. size.  For example,\n'sys.getsizeof(dict.fromkeys(\"abcdefg\"))' is reduced from 352 bytes\nto 272 bytes (23% smaller) on 64-bit platforms.  (Contributed by\nInada Naoki in bpo-46845(5).)\n\n* Using *note asyncio.DatagramProtocol: 49e. is now orders of\nmagnitude faster when transferring large files over UDP, with\nspeeds over 100 times higher for a ???60 MiB file.  (Contributed by\nmsoxzw in gh-91487(6).)\n\n* *note math: 89. functions *note comb(): 49f. and *note perm(): 4a0.\nare now ???10 times faster for large arguments (with a larger speedup\nfor larger 'k').  (Contributed by Serhiy Storchaka in\nbpo-37295(7).)\n\n* The *note statistics: cc. functions *note mean(): 4a1, *note\nvariance(): 4a2. and *note stdev(): 4a3. now consume iterators in\none pass rather than converting them to a *note list: 3dc. first.\nThis is twice as fast and can save substantial memory.\n(Contributed by Raymond Hettinger in gh-90415(8).)\n\n* *note unicodedata.normalize(): 4a4. now normalizes pure-ASCII\nstrings in constant time.  (Contributed by Donghee Na in\nbpo-44987(9).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28307\n\n(2) https://github.com/python/cpython/issues/90564\n\n(3) https://github.com/python/cpython/issues/68264\n\n(4) https://github.com/python/cpython/issues/91165\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=46845\n\n(6) https://github.com/python/cpython/issues/91487\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=37295\n\n(8) https://github.com/python/cpython/issues/90415\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=44987\n\nFile: python3.12.info,  Node: Faster CPython,  Next: CPython bytecode changes<2>,  Prev: Optimizations<2>,  Up: What's New In Python 3 11\n\n\nCPython 3.11 is an average of 25% faster(1) than CPython 3.10 as\nmeasured with the pyperformance(2) benchmark suite, when compiled with\nGCC on Ubuntu Linux.  Depending on your workload, the overall speedup\ncould be 10-60%.\n\nThis project focuses on two major areas in Python: *note Faster Startup:\n4a6. and *note Faster Runtime: 4a7.  Optimizations not covered by this\nproject are listed separately under *note Optimizations: 49b.\n\n* Menu:\n\n* Faster Startup::\n* Faster Runtime::\n* Misc::\n* FAQ::\n* About::\n\n---------- Footnotes ----------\n\n(1) https://github.com/faster-cpython/ideas#published-results\n\n(2) https://github.com/python/pyperformance\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Faster Startup,  Next: Faster Runtime,  Up: Faster CPython": {
            "content": "1.2.9.1 Faster Startup\n......................\n\n* Menu:\n\n* Frozen imports / Static code objects::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Frozen imports / Static code objects,  Up: Faster Startup": {
            "content": "1.2.9.2 Frozen imports / Static code objects\n............................................\n\nPython caches *note bytecode: 370. in the *note pycache: 4ab.\ndirectory to speed up module loading.\n\nPreviously in 3.10, Python module execution looked like this:\n\nRead pycache -> Unmarshal -> Heap allocated code object -> Evaluate\n",
            "subsections": []
        },
        "In Python 3.11, the core modules essential for Python startup are": {
            "content": "\"frozen\".  This means that their *note Code Objects: 374. (and bytecode)\nare statically allocated by the interpreter.  This reduces the steps in\nmodule execution process to:\n\nStatically allocated code object -> Evaluate\n\nInterpreter startup is now 10-15% faster in Python 3.11.  This has a big\nimpact for short-running programs using Python.\n\n(Contributed by Eric Snow, Guido van Rossum and Kumar Aditya in many\nissues.)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Faster Runtime,  Next: Misc,  Prev: Faster Startup,  Up: Faster CPython": {
            "content": "1.2.9.3 Faster Runtime\n......................\n\n* Menu:\n\n* Cheaper, lazy Python frames: Cheaper lazy Python frames.\n* Inlined Python function calls::\n* PEP 659; Specializing Adaptive Interpreter: PEP 659 Specializing Adaptive Interpreter.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Cheaper lazy Python frames,  Next: Inlined Python function calls,  Up: Faster Runtime": {
            "content": "1.2.9.4 Cheaper, lazy Python frames\n...................................\n",
            "subsections": []
        },
        "Python frames, holding execution information, are created whenever": {
            "content": "",
            "subsections": []
        },
        "Python calls a Python function.  The following are new frame": {
            "content": "optimizations:\n\n- Streamlined the frame creation process.\n\n- Avoided memory allocation by generously re-using frame space on the\nC stack.\n\n- Streamlined the internal frame struct to contain only essential\ninformation.  Frames previously held extra debugging and memory\nmanagement information.\n\nOld-style *note frame objects: 4af. are now created only when requested\nby debuggers or by Python introspection functions such as *note\nsys.getframe(): 4b0. and *note inspect.currentframe(): 4b1.  For most\nuser code, no frame objects are created at all.  As a result, nearly all\nPython functions calls have sped up significantly.  We measured a 3-7%\nspeedup in pyperformance.\n\n(Contributed by Mark Shannon in bpo-44590(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=44590\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Inlined Python function calls,  Next: PEP 659 Specializing Adaptive Interpreter,  Prev: Cheaper lazy Python frames,  Up: Faster Runtime": {
            "content": "1.2.9.5 Inlined Python function calls\n.....................................\n",
            "subsections": []
        },
        "During a Python function call, Python will call an evaluating C function": {
            "content": "to interpret that function's code.  This effectively limits pure Python\nrecursion to what's safe for the C stack.\n",
            "subsections": []
        },
        "In 3.11, when CPython detects Python code calling another Python": {
            "content": "function, it sets up a new frame, and \"jumps\" to the new code inside the\nnew frame.  This avoids calling the C interpreting function altogether.\n",
            "subsections": []
        },
        "Most Python function calls now consume no C stack space, speeding them": {
            "content": "up.  In simple recursive functions like fibonacci or factorial, we\nobserved a 1.7x speedup.  This also means recursive functions can\nrecurse significantly deeper (if the user increases the recursion limit\nwith *note sys.setrecursionlimit(): 1e7.).  We measured a 1-3%\nimprovement in pyperformance.\n\n(Contributed by Pablo Galindo and Mark Shannon in bpo-45256(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=45256\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: PEP 659 Specializing Adaptive Interpreter,  Prev: Inlined Python function calls,  Up: Faster Runtime": {
            "content": "1.2.9.6 PEP 659: Specializing Adaptive Interpreter\n..................................................\n\nPEP 659(1) is one of the key parts of the Faster CPython project.  The\ngeneral idea is that while Python is a dynamic language, most code has\nregions where objects and types rarely change.  This concept is known as\n'type stability'.\n",
            "subsections": []
        },
        "At runtime, Python will try to look for common patterns and type": {
            "content": "stability in the executing code.  Python will then replace the current\noperation with a more specialized one.  This specialized operation uses\nfast paths available only to those use cases/types, which generally\noutperform their generic counterparts.  This also brings in another\nconcept called 'inline caching', where Python caches the results of\nexpensive operations directly in the *note bytecode: 370.\n",
            "subsections": []
        },
        "The specializer will also combine certain common instruction pairs into": {
            "content": "one superinstruction, reducing the overhead during execution.\n\nPython will only specialize when it sees code that is \"hot\" (executed\nmultiple times).  This prevents Python from wasting time on run-once\ncode.  Python can also de-specialize when code is too dynamic or when\nthe use changes.  Specialization is attempted periodically, and\nspecialization attempts are not too expensive, allowing specialization\nto adapt to new circumstances.\n\n(PEP written by Mark Shannon, with ideas inspired by Stefan Brunthaler.",
            "subsections": []
        },
        "See PEP 659(2) for more information.  Implementation by Mark Shannon and": {
            "content": "",
            "subsections": []
        },
        "Brandt Bucher, with additional help from Irit Katriel and Dennis": {
            "content": "",
            "subsections": []
        },
        "Sweeney.)": {
            "content": "Operation           Form                     Specialization                                              Operation speedup (up   Contributor(s)\nto)\n\n---------------------------------------------------------------------------------------------------------------------------------------------------------\n\nBinary operations   'x + x'                  Binary add, multiply and subtract for common types such     10%                     Mark Shannon, Donghee\nas *note int: 17e, *note float: 4b7. and *note str: 157.                            Na, Brandt Bucher,\n'x - x'                  take custom fast paths for their underlying types.                                  Dennis Sweeney\n\n'x * x'\n\n\nSubscript           'a[i]'                   Subscripting container types such as *note list: 3dc,       10-25%                  Irit Katriel, Mark\n*note tuple: 4b8. and *note dict: 237. directly index the                           Shannon\nunderlying data structures.\n\nSubscripting custom *note getitem(): 4b9. is also\ninlined similar to\n*note Inlined Python function calls: 4b2.\n\n\nStore subscript     'a[i] = z'               Similar to subscripting specialization above.               10-25%                  Dennis Sweeney\n\n\nCalls               'f(arg)'                 Calls to common builtin (C) functions and types such as     20%                     Mark Shannon, Ken Jin\n*note len(): 3fb. and *note str: 157. directly call their\n'C(arg)'                 underlying C version.  This avoids going through the\ninternal calling convention.\n\n",
            "subsections": []
        },
        "Load global         'print'                  The object's index in the globals/builtins namespace is     (3)                     Mark Shannon": {
            "content": "variable                                     cached.  Loading globals and builtins require zero\n'len'                    namespace lookups.\n\n",
            "subsections": []
        },
        "Load attribute      'o.attr'                 Similar to loading global variables.  The attribute's       (4)                     Mark Shannon": {
            "content": "index inside the class/object's namespace is cached.  In\nmost cases, attribute loading will require zero namespace\nlookups.\n\n\nLoad methods for    'o.meth()'               The actual address of the method is cached.  Method         10-20%                  Ken Jin, Mark Shannon\ncall                                         loading now has no namespace lookups - even for classes\nwith long inheritance chains.\n\n\nStore attribute     'o.attr = z'             Similar to load attribute optimization.                     2% in pyperformance     Mark Shannon\n\n\nUnpack Sequence     '*seq'                   Specialized for common containers such as                   8%                      Brandt Bucher\n*note list: 3dc. and *note tuple: 4b8.  Avoids internal\ncalling convention.\n\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0659/\n\n(2) https://peps.python.org/pep-0659/\n\n(3) A similar optimization already existed since Python 3.8.  3.11\nspecializes for more forms and reduces some overhead.\n\n(4) A similar optimization already existed since Python 3.10.  3.11\nspecializes for more forms.  Furthermore, all attribute loads should be\nsped up by bpo-45947\n(https://bugs.python.org/issue?@action=redirect&bpo=45947).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Misc,  Next: FAQ,  Prev: Faster Runtime,  Up: Faster CPython": {
            "content": "1.2.9.7 Misc\n............\n\n* Objects now require less memory due to lazily created object\nnamespaces.  Their namespace dictionaries now also share keys more\nfreely.  (Contributed Mark Shannon in bpo-45340(1) and\nbpo-40116(2).)\n\n* \"Zero-cost\" exceptions are implemented, eliminating the cost of\n*note try: 4bc. statements when no exception is raised.\n(Contributed by Mark Shannon in bpo-40222(3).)\n\n* A more concise representation of exceptions in the interpreter\nreduced the time required for catching an exception by about 10%.\n(Contributed by Irit Katriel in bpo-45711(4).)\n\n* *note re: b4.'s regular expression matching engine has been\npartially refactored, and now uses computed gotos (or \"threaded\ncode\") on supported platforms.  As a result, Python 3.11 executes\nthe pyperformance regular expression benchmarks(5) up to 10% faster\nthan Python 3.10.  (Contributed by Brandt Bucher in gh-91404(6).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=45340\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=40116\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=40222\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=45711\n\n(5) https://pyperformance.readthedocs.io/benchmarks.html#regex-dna\n\n(6) https://github.com/python/cpython/issues/91404\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: FAQ,  Next: About,  Prev: Misc,  Up: Faster CPython": {
            "content": "1.2.9.8 FAQ\n...........\n\n* Menu:\n\n* How should I write my code to utilize these speedups?::\n* Will CPython 3.11 use more memory?: Will CPython 3 11 use more memory?.\n* I don't see any speedups in my workload. Why?: I don't see any speedups in my workload Why?.\n* Is there a JIT compiler?::\n\nFile: python3.12.info,  Node: How should I write my code to utilize these speedups?,  Next: Will CPython 3 11 use more memory?,  Up: FAQ\n\n1.2.9.9 How should I write my code to utilize these speedups?\n.............................................................\n",
            "subsections": []
        },
        "Write Pythonic code that follows common best practices; you don't have": {
            "content": "to change your code.  The Faster CPython project optimizes for common\ncode patterns we observe.\n\nFile: python3.12.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\n\n1.2.9.10 Will CPython 3.11 use more memory?\n...........................................\n\nMaybe not; we don't expect memory use to exceed 20% higher than 3.10.",
            "subsections": []
        },
        "This is offset by memory optimizations for frame objects and object": {
            "content": "dictionaries as mentioned above.\n\nFile: python3.12.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\n\n1.2.9.11 I don't see any speedups in my workload. Why?\n......................................................\n",
            "subsections": []
        },
        "Certain code won't have noticeable benefits.  If your code spends most": {
            "content": "of its time on I/O operations, or already does most of its computation\nin a C extension library like NumPy, there won't be significant\nspeedups.  This project currently benefits pure-Python workloads the\nmost.\n",
            "subsections": []
        },
        "Furthermore, the pyperformance figures are a geometric mean.  Even": {
            "content": "within the pyperformance benchmarks, certain benchmarks have slowed down\nslightly, while others have sped up by nearly 2x!\n\nFile: python3.12.info,  Node: Is there a JIT compiler?,  Prev: I don't see any speedups in my workload Why?,  Up: FAQ\n\n1.2.9.12 Is there a JIT compiler?\n.................................\n\nNo.  We're still exploring other optimizations.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: About,  Prev: FAQ,  Up: Faster CPython": {
            "content": "1.2.9.13 About\n..............\n\nFaster CPython explores optimizations for *note CPython: 4c9.  The main\nteam is funded by Microsoft to work on this full-time.  Pablo Galindo\nSalgado is also funded by Bloomberg LP to work on the project part-time.\nFinally, many contributors are volunteers from the community.\n\nFile: python3.12.info,  Node: CPython bytecode changes<2>,  Next: Deprecated<3>,  Prev: Faster CPython,  Up: What's New In Python 3 11\n\n",
            "subsections": []
        },
        "The bytecode now contains inline cache entries, which take the form of": {
            "content": "the newly-added *note CACHE: 4cc. instructions.  Many opcodes expect to\nbe followed by an exact number of caches, and instruct the interpreter\nto skip over them at runtime.  Populated caches can look like arbitrary\ninstructions, so great care should be taken when reading or modifying\nraw, adaptive bytecode containing quickened data.\n\n* Menu:\n\n* New opcodes::\n* Replaced opcodes::\n* Changed/removed opcodes::\n\nFile: python3.12.info,  Node: New opcodes,  Next: Replaced opcodes,  Up: CPython bytecode changes<2>\n\n1.2.10.1 New opcodes\n....................\n\n* 'ASYNCGENWRAP', *note RETURNGENERATOR: 4cf. and *note SEND: 4d0,\nused in generators and co-routines.\n\n* *note COPYFREEVARS: 4d1, which avoids needing special caller-side\ncode for closures.\n\n* *note JUMPBACKWARDNOINTERRUPT: 4d2, for use in certain loops\nwhere handling interrupts is undesirable.\n\n* *note MAKECELL: 4d3, to create *note Cell Objects: 4d4.\n\n* *note CHECKEGMATCH: 4d5. and 'PREPRERAISESTAR', to handle the\n*note new exception groups and except*: 35f. added in PEP 654(1).\n\n* *note PUSHEXCINFO: 4d6, for use in exception handlers.\n\n* *note RESUME: 4d7, a no-op, for internal tracing, debugging and\noptimization checks.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0654/\n\nFile: python3.12.info,  Node: Replaced opcodes,  Next: Changed/removed opcodes,  Prev: New opcodes,  Up: CPython bytecode changes<2>\n\n1.2.10.2 Replaced opcodes\n.........................\n",
            "subsections": []
        },
        "Replaced Opcode(s)                       New Opcode(s)                            Notes": {
            "content": "--------------------------------------------------------------------------------------------------------------------------------\n\n'BINARY*'                          *note BINARYOP: 4da.                    Replaced all numeric binary/in-place\n'INPLACE*'                                                                  opcodes with a single opcode\n\n\n'CALLFUNCTION'                          *note CALL: 4db.                    Decouples argument shifting for methods\n'CALLFUNCTIONKW'                       'KWNAMES'                          from handling of keyword arguments; allows\n'CALLMETHOD'                            'PRECALL'                           better specialization of calls\n*note PUSHNULL: 4dc.\n\n\n'DUPTOP'                                *note COPY: 4dd.                    Stack manipulation instructions\n'DUPTOPTWO'                            *note SWAP: 4de.\n'ROTTWO'\n'ROTTHREE'\n'ROTFOUR'\n'ROTN'\n\n'JUMPIFNOTEXCMATCH'                  *note CHECKEXCMATCH: 4df.         Now performs check but doesn't jump\n\n\n'JUMPABSOLUTE'                          *note JUMPBACKWARD: 4e0.           See (1); 'TRUE', 'FALSE', 'NONE' and\n'POPJUMPIFFALSE'                      'POPJUMPBACKWARDIF*'            'NOTNONE' variants for each direction\n'POPJUMPIFTRUE'                       'POPJUMPFORWARDIF*'\n\n\n'SETUPWITH'                        *note BEFOREWITH: 4e1.                  *note with: 396. block setup\n'SETUPASYNCWITH'\n\n---------- Footnotes ----------\n\n(1) All jump opcodes are now relative, including the existing\n'JUMPIFTRUEORPOP' and 'JUMPIFFALSEORPOP'.  The argument is now\nan offset from the current instruction rather than an absolute location.\n\nFile: python3.12.info,  Node: Changed/removed opcodes,  Prev: Replaced opcodes,  Up: CPython bytecode changes<2>\n\n1.2.10.3 Changed/removed opcodes\n................................\n\n* Changed *note MATCHCLASS: 4e6. and *note MATCHKEYS: 4e7. to no\nlonger push an additional boolean value to indicate\nsuccess/failure.  Instead, 'None' is pushed on failure in place of\nthe tuple of extracted values.\n\n* Changed opcodes that work with exceptions to reflect them now being\nrepresented as one item on the stack instead of three (see\ngh-89874(1)).\n\n* Removed 'COPYDICTWITHOUTKEYS', 'GENSTART', 'POPBLOCK',\n'SETUPFINALLY' and 'YIELDFROM'.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/89874\n\nFile: python3.12.info,  Node: Deprecated<3>,  Next: Pending Removal in Python 3 12,  Prev: CPython bytecode changes<2>,  Up: What's New In Python 3 11\n\n\nThis section lists Python APIs that have been deprecated in Python 3.11.\n\nDeprecated C APIs are *note listed separately: 4eb.\n* Menu:\n\n* Language/Builtins::\n* Modules::\n* Standard Library::\n\nFile: python3.12.info,  Node: Language/Builtins,  Next: Modules,  Up: Deprecated<3>\n\n1.2.11.1 Language/Builtins\n..........................\n\n* Chaining *note classmethod: 246. descriptors (introduced in\nbpo-19072(1)) is now deprecated.  It can no longer be used to wrap\nother descriptors such as *note property: 3f6.  The core design of\nthis feature was flawed and caused a number of downstream problems.\nTo \"pass-through\" a *note classmethod: 246, consider using the\n'wrapped' attribute that was added in Python 3.10.\n(Contributed by Raymond Hettinger in gh-89519(2).)\n\n* Octal escapes in string and bytes literals with values larger than\n'0o377' (255 in decimal) now produce a *note DeprecationWarning:\n179.  In a future Python version, they will raise a *note\nSyntaxWarning: 178. and eventually a *note SyntaxError: 146.\n(Contributed by Serhiy Storchaka in gh-81548(3).)\n\n* The delegation of *note int(): 17e. to *note trunc(): 4ef. is\nnow deprecated.  Calling 'int(a)' when 'type(a)' implements\n'trunc()' but not *note int(): 4f0. or *note index():\n4f1. now raises a *note DeprecationWarning: 179.  (Contributed by\nZackery Spytz in bpo-44977(4).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=19072\n\n(2) https://github.com/python/cpython/issues/89519\n\n(3) https://github.com/python/cpython/issues/81548\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=44977\n\nFile: python3.12.info,  Node: Modules,  Next: Standard Library,  Prev: Language/Builtins,  Up: Deprecated<3>\n\n1.2.11.2 Modules\n................\n\n* PEP 594(1) led to the deprecations of the following modules slated\nfor removal in Python 3.13:\n\n*note aifc: 5.            *note chunk: 15.          *note msilib: 8d.         *note pipes: a3.          *note telnetlib: d9.\n\n\n*note audioop: b.         *note crypt: 26.          *note nis: 97.            *note sndhdr: c5.         *note uu: 10a.\n\n\n*note cgi: 13.            *note imghdr: 70.         *note nntplib: 98.        *note spwd: c8.           *note xdrlib: 11a.\n\n\n*note cgitb: 14.          *note mailcap: 87.        *note ossaudiodev: 9e.    *note sunau: d1.\n\n\n(Contributed by Brett Cannon in bpo-47061(2) and Victor Stinner in\ngh-68966(3).)\n\n* The 'asynchat', 'asyncore' and 'smtpd' modules have been deprecated\nsince at least Python 3.6.  Their documentation and deprecation\nwarnings have now been updated to note they will be removed in\nPython 3.12.  (Contributed by Hugo van Kemenade in bpo-47022(4).)\n\n* The *note lib2to3: 7f. package and *note 2to3: 4f4. tool are now\ndeprecated and may not be able to parse Python 3.10 or newer.  See\nPEP 617(5), introducing the new PEG parser, for details.\n(Contributed by Victor Stinner in bpo-40360(6).)\n\n* Undocumented modules 'srecompile', 'sreconstants' and 'sreparse'\nare now deprecated.  (Contributed by Serhiy Storchaka in\nbpo-47152(7).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0594/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=47061\n\n(3) https://github.com/python/cpython/issues/68966\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=47022\n\n(5) https://peps.python.org/pep-0617/\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=40360\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=47152\n\nFile: python3.12.info,  Node: Standard Library,  Prev: Modules,  Up: Deprecated<3>\n\n1.2.11.3 Standard Library\n.........................\n\n* The following have been deprecated in *note configparser: 20. since\nPython 3.2.  Their deprecation warnings have now been updated to\nnote they will be removed in Python 3.12:\n\n* the 'configparser.SafeConfigParser' class\n\n* the 'configparser.ParsingError.filename' property\n\n* the 'configparser.RawConfigParser.readfp()' method\n\n(Contributed by Hugo van Kemenade in bpo-45173(1).)\n\n* 'configparser.LegacyInterpolation' has been deprecated in the\ndocstring since Python 3.2, and is not listed in the *note\nconfigparser: 20. documentation.  It now emits a *note\nDeprecationWarning: 179. and will be removed in Python 3.13.  Use\n*note configparser.BasicInterpolation: 4f7. or *note\nconfigparser.ExtendedInterpolation: 4f8. instead.  (Contributed by\nHugo van Kemenade in bpo-46607(2).)\n\n* The older set of *note importlib.resources: 75. functions were\ndeprecated in favor of the replacements added in Python 3.9 and\nwill be removed in a future Python version, due to not supporting\nresources located within package subdirectories:\n\n* *note importlib.resources.contents(): 4f9.\n\n* *note importlib.resources.isresource(): 4fa.\n\n* *note importlib.resources.openbinary(): 4fb.\n\n* *note importlib.resources.opentext(): 4fc.\n\n* *note importlib.resources.readbinary(): 4fd.\n\n* *note importlib.resources.readtext(): 4fe.\n\n* *note importlib.resources.path(): 4ff.\n\n* The *note locale.getdefaultlocale(): 249. function is deprecated\nand will be removed in Python 3.15.  Use *note locale.setlocale():\n500, *note locale.getpreferredencoding(False): 290. and *note\nlocale.getlocale(): 501. functions instead.  (Contributed by Victor\nStinner in gh-90817(3).)\n\n* The *note locale.resetlocale(): 502. function is deprecated and\nwill be removed in Python 3.13.  Use\n'locale.setlocale(locale.LCALL, \"\")' instead.  (Contributed by\nVictor Stinner in gh-90817(4).)\n\n* Stricter rules will now be applied for numerical group references\nand group names in *note regular expressions: 503.  Only sequences\nof ASCII digits will now be accepted as a numerical reference, and\nthe group name in *note bytes: 295. patterns and replacement\nstrings can only contain ASCII letters, digits and underscores.\nFor now, a deprecation warning is raised for syntax violating these\nrules.  (Contributed by Serhiy Storchaka in gh-91760(5).)\n\n* In the *note re: b4. module, the 're.template()' function and the\ncorresponding 're.TEMPLATE' and 're.T' flags are deprecated, as\nthey were undocumented and lacked an obvious purpose.  They will be\nremoved in Python 3.13.  (Contributed by Serhiy Storchaka and Miro\nHron??ok in gh-92728(6).)\n\n* *note turtle.settiltangle(): 504. has been deprecated since Python\n3.1; it now emits a deprecation warning and will be removed in\nPython 3.13.  Use *note turtle.tiltangle(): 505. instead (it was\nearlier incorrectly marked as deprecated, and its docstring is now\ncorrected).  (Contributed by Hugo van Kemenade in bpo-45837(7).)\n\n* *note typing.Text: 24b, which exists solely to provide\ncompatibility support between Python 2 and Python 3 code, is now\ndeprecated.  Its removal is currently unplanned, but users are\nencouraged to use *note str: 157. instead wherever possible.\n(Contributed by Alex Waygood in gh-92332(8).)\n\n* The keyword argument syntax for constructing *note\ntyping.TypedDict: 153. types is now deprecated.  Support will be\nremoved in Python 3.13.  (Contributed by Jingchen Ye in\ngh-90224(9).)\n\n* 'webbrowser.MacOSX' is deprecated and will be removed in Python\n3.13.  It is untested, undocumented, and not used by *note\nwebbrowser: 110. itself.  (Contributed by Donghee Na in\nbpo-42255(10).)\n\n* The behavior of returning a value from a *note TestCase: 159. and\n*note IsolatedAsyncioTestCase: 48b. test methods (other than the\ndefault 'None' value) is now deprecated.\n\n* Deprecated the following not-formally-documented *note unittest:\n101. functions, scheduled for removal in Python 3.13:\n\n* 'unittest.findTestCases()'\n\n* 'unittest.makeSuite()'\n\n* 'unittest.getTestCaseNames()'\n\nUse *note TestLoader: 506. methods instead:\n\n* *note unittest.TestLoader.loadTestsFromModule(): 285.\n\n* *note unittest.TestLoader.loadTestsFromTestCase(): 507.\n\n* *note unittest.TestLoader.getTestCaseNames(): 508.\n\n(Contributed by Erlend E. Aasland in bpo-5846(11).)\n\n* 'unittest.TestProgram.usageExit()' is marked deprecated, to be\nremoved in 3.13.  (Contributed by Carlos Dam??zio in gh-67048(12).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=45173\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=46607\n\n(3) https://github.com/python/cpython/issues/90817\n\n(4) https://github.com/python/cpython/issues/90817\n\n(5) https://github.com/python/cpython/issues/91760\n\n(6) https://github.com/python/cpython/issues/92728\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=45837\n\n(8) https://github.com/python/cpython/issues/92332\n\n(9) https://github.com/python/cpython/issues/90224\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=42255\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=5846\n\n(12) https://github.com/python/cpython/issues/67048\n\nFile: python3.12.info,  Node: Pending Removal in Python 3 12,  Next: Removed<3>,  Prev: Deprecated<3>,  Up: What's New In Python 3 11\n\n",
            "subsections": []
        },
        "The following Python APIs have been deprecated in earlier Python": {
            "content": "releases, and will be removed in Python 3.12.\n\nC APIs pending removal are *note listed separately: 50c.\n\n* The 'asynchat' module\n\n* The 'asyncore' module\n\n* The *note entire distutils package: 50d.\n\n* The 'imp' module\n\n* The *note typing.io: 50e. namespace\n\n* The *note typing.re: 50f. namespace\n\n* 'cgi.log()'\n\n* 'importlib.findloader()'\n\n* 'importlib.abc.Loader.modulerepr()'\n\n* 'importlib.abc.MetaPathFinder.findmodule()'\n\n* 'importlib.abc.PathEntryFinder.findloader()'\n\n* 'importlib.abc.PathEntryFinder.findmodule()'\n\n* 'importlib.machinery.BuiltinImporter.findmodule()'\n\n* 'importlib.machinery.BuiltinLoader.modulerepr()'\n\n* 'importlib.machinery.FileFinder.findloader()'\n\n* 'importlib.machinery.FileFinder.findmodule()'\n\n* 'importlib.machinery.FrozenImporter.findmodule()'\n\n* 'importlib.machinery.FrozenLoader.modulerepr()'\n\n* 'importlib.machinery.PathFinder.findmodule()'\n\n* 'importlib.machinery.WindowsRegistryFinder.findmodule()'\n\n* 'importlib.util.moduleforloader()'\n\n* 'importlib.util.setloaderwrapper()'\n\n* 'importlib.util.setpackagewrapper()'\n\n* 'pkgutil.ImpImporter'\n\n* 'pkgutil.ImpLoader'\n\n* 'pathlib.Path.linkto()'\n\n* 'sqlite3.enablesharedcache()'\n\n* 'sqlite3.OptimizedUnicode()'\n\n* 'PYTHONTHREADDEBUG' environment variable\n\n* The following deprecated aliases in *note unittest: 101.:\n\nDeprecated alias                 Method Name                         Deprecated in\n\n-----------------------------------------------------------------------------------------\n\n'failUnless'                     *note assertTrue(): 27b.            3.1\n\n\n'failIf'                         *note assertFalse(): 27c.           3.1\n\n\n'failUnlessEqual'                *note assertEqual(): 27d.           3.1\n\n\n'failIfEqual'                    *note assertNotEqual(): 27e.        3.1\n\n\n'failUnlessAlmostEqual'          *note assertAlmostEqual(): 27f.     3.1\n\n\n'failIfAlmostEqual'              *note assertNotAlmostEqual(): 280.  3.1\n\n\n'failUnlessRaises'               *note assertRaises(): 281.          3.1\n\n\n'assert'                        *note assertTrue(): 27b.            3.2\n\n\n'assertEquals'                   *note assertEqual(): 27d.           3.2\n\n\n'assertNotEquals'                *note assertNotEqual(): 27e.        3.2\n\n\n'assertAlmostEquals'             *note assertAlmostEqual(): 27f.     3.2\n\n\n'assertNotAlmostEquals'          *note assertNotAlmostEqual(): 280.  3.2\n\n\n'assertRegexpMatches'            *note assertRegex(): 282.           3.2\n\n\n'assertRaisesRegexp'             *note assertRaisesRegex(): 283.     3.2\n\n\n'assertNotRegexpMatches'         *note assertNotRegex(): 284.        3.5\n\n\nFile: python3.12.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\n\n\nThis section lists Python APIs that have been removed in Python 3.11.\n\nRemoved C APIs are *note listed separately: 513.\n\n* Removed the '@asyncio.coroutine()' *note decorator: 514. enabling\nlegacy generator-based coroutines to be compatible with *note\nasync: 515. / *note await: 516. code.  The function has been\ndeprecated since Python 3.8 and the removal was initially scheduled\nfor Python 3.10.  Use *note async def: 394. instead.  (Contributed\nby Illia Volochii in bpo-43216(1).)\n\n* Removed 'asyncio.coroutines.CoroWrapper' used for wrapping legacy\ngenerator-based coroutine objects in the debug mode.  (Contributed\nby Illia Volochii in bpo-43216(2).)\n\n* Due to significant security concerns, the 'reuseaddress' parameter\nof *note asyncio.loop.createdatagramendpoint(): 517, disabled in\nPython 3.9, is now entirely removed.  This is because of the\nbehavior of the socket option 'SOREUSEADDR' in UDP. (Contributed\nby Hugo van Kemenade in bpo-45129(3).)\n\n* Removed the 'binhex' module, deprecated in Python 3.9.  Also\nremoved the related, similarly-deprecated *note binascii: e.\nfunctions:\n\n* 'binascii.a2bhqx()'\n\n* 'binascii.b2ahqx()'\n\n* 'binascii.rlecodehqx()'\n\n* 'binascii.rldecodehqx()'\n\nThe *note binascii.crchqx(): 518. function remains available.\n\n(Contributed by Victor Stinner in bpo-45085(4).)\n\n* Removed the 'distutils' 'bdistmsi' command deprecated in Python\n3.9.  Use 'bdistwheel' (wheel packages) instead.  (Contributed by\nHugo van Kemenade in bpo-45124(5).)\n\n* Removed the *note getitem(): 4b9. methods of *note\nxml.dom.pulldom.DOMEventStream: 519, *note\nwsgiref.util.FileWrapper: 51a. and *note fileinput.FileInput: 51b,\ndeprecated since Python 3.9.  (Contributed by Hugo van Kemenade in\nbpo-45132(6).)\n\n* Removed the deprecated *note gettext: 5e. functions 'lgettext()',\n'ldgettext()', 'lngettext()' and 'ldngettext()'.  Also removed the\n'bindtextdomaincodeset()' function, the\n'NullTranslations.outputcharset()' and\n'NullTranslations.setoutputcharset()' methods, and the 'codeset'\nparameter of 'translation()' and 'install()', since they are only\nused for the 'l*gettext()' functions.  (Contributed by Donghee Na\nand Serhiy Storchaka in bpo-44235(7).)\n\n* Removed from the *note inspect: 78. module:\n\n* The 'getargspec()' function, deprecated since Python 3.0; use\n*note inspect.signature(): 51c. or *note\ninspect.getfullargspec(): 51d. instead.\n\n* The 'formatargspec()' function, deprecated since Python 3.5;\nuse the *note inspect.signature(): 51c. function or the *note\ninspect.Signature: 51e. object directly.\n\n* The undocumented 'Signature.frombuiltin()' and\n'Signature.fromfunction()' methods, deprecated since Python\n3.5; use the *note Signature.fromcallable(): 51f. method\ninstead.\n\n(Contributed by Hugo van Kemenade in bpo-45320(8).)\n\n* Removed the *note classgetitem(): 520. method from *note\npathlib.PurePath: 1c5, because it was not used and added by mistake\nin previous versions.  (Contributed by Nikita Sobolev in\nbpo-46483(9).)\n\n* Removed the 'MailmanProxy' class in the 'smtpd' module, as it is\nunusable without the external 'mailman' package.  (Contributed by\nDonghee Na in bpo-35800(10).)\n\n* Removed the deprecated 'split()' method of 'tkinter.TkappType'.\n(Contributed by Erlend E. Aasland in bpo-38371(11).)\n\n* Removed namespace package support from *note unittest: 101.\ndiscovery.  It was introduced in Python 3.4 but has been broken\nsince Python 3.7.  (Contributed by Inada Naoki in bpo-23882(12).)\n\n* Removed the undocumented private 'float.setformat()' method,\npreviously known as 'float.setformat()' in Python 3.7.  Its\ndocstring said: \"You probably don't want to use this function.  It\nexists mainly to be used in Python's test suite.\" (Contributed by\nVictor Stinner in bpo-46852(13).)\n\n* The '--experimental-isolated-subinterpreters' configure flag (and\ncorresponding 'EXPERIMENTALISOLATEDSUBINTERPRETERS' macro) have\nbeen removed.\n\n* Pynche(14) -- The Pythonically Natural Color and Hue Editor -- has\nbeen moved out of 'Tools/scripts' and is being developed\nindependently(15) from the Python source tree.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43216\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=43216\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=45129\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=45085\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=45124\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=45132\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=44235\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=45320\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=46483\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=35800\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=38371\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=23882\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=46852\n\n(14) https://pypi.org/project/pynche/\n\n(15) https://gitlab.com/warsaw/pynche/-/tree/main\n\nFile: python3.12.info,  Node: Porting to Python 3 11,  Next: Build Changes<2>,  Prev: Removed<3>,  Up: What's New In Python 3 11\n\n",
            "subsections": []
        },
        "This section lists previously described changes and other bugfixes in": {
            "content": "the Python API that may require changes to your Python code.\n\nPorting notes for the C API are *note listed separately: 524.\n\n* *note open(): 26e, *note io.open(): 26f, *note codecs.open(): 525.\nand *note fileinput.FileInput: 51b. no longer accept ''U''\n(\"universal newline\") in the file mode.  In Python 3, \"universal\nnewline\" mode is used by default whenever a file is opened in text\nmode, and the ''U'' flag has been deprecated since Python 3.3.  The\n*note newline parameter: 526. to these functions controls how\nuniversal newlines work.  (Contributed by Victor Stinner in\nbpo-37330(1).)\n\n* *note ast.AST: 527. node positions are now validated when provided\nto *note compile(): 528. and other related functions.  If invalid\npositions are detected, a *note ValueError: 183. will be raised.\n(Contributed by Pablo Galindo in gh-93351(2))\n\n* Prohibited passing non-*note concurrent.futures.ThreadPoolExecutor:\n529. executors to *note asyncio.loop.setdefaultexecutor(): 52a.\nfollowing a deprecation in Python 3.8.  (Contributed by Illia\nVolochii in bpo-43234(3).)\n\n* *note calendar: 12.: The *note calendar.LocaleTextCalendar: 52b.\nand *note calendar.LocaleHTMLCalendar: 52c. classes now use *note\nlocale.getlocale(): 501, instead of using *note\nlocale.getdefaultlocale(): 249, if no locale is specified.\n(Contributed by Victor Stinner in bpo-46659(4).)\n\n* The *note pdb: a0. module now reads the '.pdbrc' configuration file\nwith the ''UTF-8'' encoding.  (Contributed by Srinivas Reddy\nThatiparthy (?????????????????????????????? ?????????????????? ???????????????????????????) in bpo-41137(5).)\n\n* The 'population' parameter of *note random.sample(): 52d. must be a\nsequence, and automatic conversion of *note set: 39d.s to *note\nlist: 3dc.s is no longer supported.  Also, if the sample size is\nlarger than the population size, a *note ValueError: 183. is\nraised.  (Contributed by Raymond Hettinger in bpo-40465(6).)\n\n* The 'random' optional parameter of *note random.shuffle(): 52e. was\nremoved.  It was previously an arbitrary random function to use for\nthe shuffle; now, *note random.random(): 52f. (its previous\ndefault) will always be used.\n\n* In *note re: b4. *note Regular Expression Syntax: 503, global\ninline flags (e.g.  '(?i)') can now only be used at the start of\nregular expressions.  Using them elsewhere has been deprecated\nsince Python 3.6.  (Contributed by Serhiy Storchaka in\nbpo-47066(7).)\n\n* In the *note re: b4. module, several long-standing bugs where fixed\nthat, in rare cases, could cause capture groups to get the wrong\nresult.  Therefore, this could change the captured output in these\ncases.  (Contributed by Ma Lin in bpo-35859(8).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=37330\n\n(2) https://github.com/python/cpython/issues/93351\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=43234\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=46659\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=41137\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=40465\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=47066\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=35859\n\nFile: python3.12.info,  Node: Build Changes<2>,  Next: C API Changes<2>,  Prev: Porting to Python 3 11,  Up: What's New In Python 3 11\n\n\n* CPython now has PEP 11(1) Tier 3 support(2) for cross compiling to\nthe WebAssembly(3) platforms Emscripten(4)\n('wasm32-unknown-emscripten', i.e.  Python in the browser) and\nWebAssembly System Interface (WASI)(5) ('wasm32-unknown-wasi').\nThe effort is inspired by previous work like Pyodide(6).  These\nplatforms provide a limited subset of POSIX APIs; Python standard\nlibraries features and modules related to networking, processes,\nthreading, signals, mmap, and users/groups are not available or\ndon't work.  (Emscripten contributed by Christian Heimes and Ethan\nSmith in gh-84461(7) and WASI contributed by Christian Heimes in\ngh-90473(8); platforms promoted in gh-95085(9))\n\n* Building CPython now requires:\n\n* A C11(10) compiler and standard library.  Optional C11\nfeatures(11) are not required.  (Contributed by Victor Stinner\nin bpo-46656(12), bpo-45440(13) and bpo-46640(14).)\n\n* Support for IEEE 754(15) floating point numbers.  (Contributed\nby Victor Stinner in bpo-46917(16).)\n\n* The 'PyNONAN' macro has been removed.  Since CPython now requires\nIEEE 754 floats, NaN values are always available.  (Contributed by\nVictor Stinner in bpo-46656(17).)\n\n* The *note tkinter: ea. package now requires Tcl/Tk(18) version\n8.5.12 or newer.  (Contributed by Serhiy Storchaka in\nbpo-46996(19).)\n\n* Build dependencies, compiler flags, and linker flags for most\nstdlib extension modules are now detected by 'configure'.  libffi,\nlibnsl, libsqlite3, zlib, bzip2, liblzma, libcrypt, Tcl/Tk, and\nuuid flags are detected by pkg-config(20) (when available).  *note\ntkinter: ea. now requires a pkg-config command to detect\ndevelopment settings for Tcl/Tk(21) headers and libraries.\n(Contributed by Christian Heimes and Erlend Egeberg Aasland in\nbpo-45847(22), bpo-45747(23), and bpo-45763(24).)\n\n* libpython is no longer linked against libcrypt.  (Contributed by\nMike Gilbert in bpo-45433(25).)\n\n* CPython can now be built with the ThinLTO(26) option via passing\n'thin' to *note -with-lto: 532, i.e.  '--with-lto=thin'.\n(Contributed by Donghee Na and Brett Holman in bpo-44340(27).)\n\n* Freelists for object structs can now be disabled.  A new\n'configure' option *note -without-freelists: 533. can be used to\ndisable all freelists except empty tuple singleton.  (Contributed\nby Christian Heimes in bpo-45522(28).)\n\n* 'Modules/Setup' and 'Modules/makesetup' have been improved and tied\nup.  Extension modules can now be built through 'makesetup'.  All\nexcept some test modules can be linked statically into a main\nbinary or library.  (Contributed by Brett Cannon and Christian\nHeimes in bpo-45548(29), bpo-45570(30), bpo-45571(31), and\nbpo-43974(32).)\n\nNote: Use the environment variables 'TCLTKCFLAGS' and\n'TCLTKLIBS' to manually specify the location of Tcl/Tk\nheaders and libraries.  The 'configure' options\n'--with-tcltk-includes' and '--with-tcltk-libs' have been\nremoved.\n\nOn RHEL 7 and CentOS 7 the development packages do not provide\n'tcl.pc' and 'tk.pc'; use 'TCLTKLIBS=\"-ltk8.5 -ltkstub8.5\n-ltcl8.5\"'.  The directory 'Misc/rhel7' contains '.pc' files\nand instructions on how to build Python with RHEL 7's and\nCentOS 7's Tcl/Tk and OpenSSL.\n\n* CPython will now use 30-bit digits by default for the Python *note\nint: 17e. implementation.  Previously, the default was to use\n30-bit digits on platforms with 'SIZEOFVOIDP >= 8', and 15-bit\ndigits otherwise.  It's still possible to explicitly request use of\n15-bit digits via either the *note -enable-big-digits: 534. option\nto the configure script or (for Windows) the 'PYLONGBITSINDIGIT'\nvariable in 'PC/pyconfig.h', but this option may be removed at some\npoint in the future.  (Contributed by Mark Dickinson in\nbpo-45569(33).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0011/\n\n(2) https://peps.python.org/pep-0011/#tier-3\n\n(3) https://webassembly.org/\n\n(4) https://emscripten.org/\n\n(5) https://wasi.dev/\n\n(6) https://pyodide.org/\n\n(7) https://github.com/python/cpython/issues/84461\n\n(8) https://github.com/python/cpython/issues/90473\n\n(9) https://github.com/python/cpython/issues/95085\n\n(10) https://en.cppreference.com/w/c/11\n\n(11)\nhttps://en.wikipedia.org/wiki/C11(Cstandardrevision)#Optionalfeatures\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=46656\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=45440\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=46640\n\n(15) https://en.wikipedia.org/wiki/IEEE754\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=46917\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=46656\n\n(18) https://www.tcl.tk\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=46996\n\n(20) https://www.freedesktop.org/wiki/Software/pkg-config/\n\n(21) https://www.tcl.tk\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=45847\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=45747\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=45763\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=45433\n\n(26) https://clang.llvm.org/docs/ThinLTO.html\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=44340\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=45522\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=45548\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=45570\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=45571\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=43974\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=45569\n\nFile: python3.12.info,  Node: C API Changes<2>,  Next: Notable changes in 3 11 4,  Prev: Build Changes<2>,  Up: What's New In Python 3 11\n\n\n* Menu:\n\n* New Features: New Features<4>.\n* Porting to Python 3.11: Porting to Python 3 11<2>.\n* Deprecated: Deprecated<4>.\n* Pending Removal in Python 3.12: Pending Removal in Python 3 12<2>.\n* Removed: Removed<4>.\n\nFile: python3.12.info,  Node: New Features<4>,  Next: Porting to Python 3 11<2>,  Up: C API Changes<2>\n\n1.2.16.1 New Features\n.....................\n\n* Add a new *note PyTypeGetName(): 539. function to get type's short\nname.  (Contributed by Hai Shi in bpo-42035(1).)\n\n* Add a new *note PyTypeGetQualName(): 53a. function to get type's\nqualified name.  (Contributed by Hai Shi in bpo-42035(2).)\n\n* Add new *note PyThreadStateEnterTracing(): 53b. and *note\nPyThreadStateLeaveTracing(): 53c. functions to the limited C API\nto suspend and resume tracing and profiling.  (Contributed by\nVictor Stinner in bpo-43760(3).)\n\n* Added the *note PyVersion: 53d. constant which bears the same\nvalue as *note PYVERSIONHEX: 53e.  (Contributed by Gabriele N.\nTornetta in bpo-43931(4).)\n\n* *note Pybuffer: 53f. and APIs are now part of the limited API and\nthe stable ABI:\n\n* *note PyObjectCheckBuffer(): 540.\n\n* *note PyObjectGetBuffer(): 541.\n\n* *note PyBufferGetPointer(): 542.\n\n* *note PyBufferSizeFromFormat(): 543.\n\n* *note PyBufferToContiguous(): 544.\n\n* *note PyBufferFromContiguous(): 545.\n\n* *note PyObjectCopyData(): 546.\n\n* *note PyBufferIsContiguous(): 547.\n\n* *note PyBufferFillContiguousStrides(): 548.\n\n* *note PyBufferFillInfo(): 549.\n\n* *note PyBufferRelease(): 54a.\n\n* *note PyMemoryViewFromBuffer(): 54b.\n\n* *note bfgetbuffer: 54c. and *note bfreleasebuffer: 54d. type\nslots\n\n(Contributed by Christian Heimes in bpo-45459(5).)\n\n* Added the *note PyTypeGetModuleByDef(): 54e. function, used to get\nthe module in which a method was defined, in cases where this\ninformation is not available directly (via *note PyCMethod: 54f.).\n(Contributed by Petr Viktorin in bpo-46613(6).)\n\n* Add new functions to pack and unpack C double (serialize and\ndeserialize): *note PyFloatPack2(): 550, *note PyFloatPack4():\n551, *note PyFloatPack8(): 552, *note PyFloatUnpack2(): 553,\n*note PyFloatUnpack4(): 554. and *note PyFloatUnpack8(): 555.\n(Contributed by Victor Stinner in bpo-46906(7).)\n\n* Add new functions to get frame object attributes: *note\nPyFrameGetBuiltins(): 556, *note PyFrameGetGenerator(): 557,\n*note PyFrameGetGlobals(): 558, *note PyFrameGetLasti(): 559.\n\n* Added two new functions to get and set the active exception\ninstance: *note PyErrGetHandledException(): 55a. and *note\nPyErrSetHandledException(): 55b.  These are alternatives to *note\nPyErrSetExcInfo(): 55c. and *note PyErrGetExcInfo(): 55d. which\nwork with the legacy 3-tuple representation of exceptions.\n(Contributed by Irit Katriel in bpo-46343(8).)\n\n* Added the *note PyConfig.safepath: 55e. member.  (Contributed by\nVictor Stinner in gh-57684(9).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42035\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=42035\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=43760\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=43931\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=45459\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=46613\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=46906\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=46343\n\n(9) https://github.com/python/cpython/issues/57684\n\nFile: python3.12.info,  Node: Porting to Python 3 11<2>,  Next: Deprecated<4>,  Prev: New Features<4>,  Up: C API Changes<2>\n\n1.2.16.2 Porting to Python 3.11\n...............................\n\n* Some macros have been converted to static inline functions to avoid\nmacro pitfalls(1).  The change should be mostly transparent to\nusers, as the replacement functions will cast their arguments to\nthe expected types to avoid compiler warnings due to static type\nchecks.  However, when the limited C API is set to >=3.11, these\ncasts are not done, and callers will need to cast arguments to\ntheir expected types.  See PEP 670(2) for more details.\n(Contributed by Victor Stinner and Erlend E. Aasland in\ngh-89653(3).)\n\n* *note PyErrSetExcInfo(): 55c. no longer uses the 'type' and\n'traceback' arguments, the interpreter now derives those values\nfrom the exception instance (the 'value' argument).  The function\nstill steals references of all three arguments.  (Contributed by\nIrit Katriel in bpo-45711(4).)\n\n* *note PyErrGetExcInfo(): 55d. now derives the 'type' and\n'traceback' fields of the result from the exception instance (the\n'value' field).  (Contributed by Irit Katriel in bpo-45711(5).)\n\n* *note frozen: 560. has a new 'ispackage' field to indicate\nwhether or not the frozen module is a package.  Previously, a\nnegative value in the 'size' field was the indicator.  Now only\nnon-negative values be used for 'size'.  (Contributed by Kumar\nAditya in bpo-46608(6).)\n\n* *note PyFrameEvalFunction(): 561. now takes 'PyInterpreterFrame*'\nas its second parameter, instead of 'PyFrameObject*'.  See PEP\n523(7) for more details of how to use this function pointer type.\n\n* 'PyCodeNew()' and 'PyCodeNewWithPosOnlyArgs()' now take an\nadditional 'exceptiontable' argument.  Using these functions\nshould be avoided, if at all possible.  To get a custom code\nobject: create a code object using the compiler, then get a\nmodified version with the 'replace' method.\n\n* *note PyCodeObject: 562. no longer has the 'cocode',\n'covarnames', 'cocellvars' and 'cofreevars' fields.  Instead,\nuse *note PyCodeGetCode(): 563, *note PyCodeGetVarnames(): 564,\n*note PyCodeGetCellvars(): 565. and *note PyCodeGetFreevars():\n566. respectively to access them via the C API. (Contributed by\nBrandt Bucher in bpo-46841(8) and Ken Jin in gh-92154(9) and\ngh-94936(10).)\n\n* The old trashcan macros\n('PyTRASHCANSAFEBEGIN'/'PyTRASHCANSAFEEND') are now\ndeprecated.  They should be replaced by the new macros\n'PyTRASHCANBEGIN' and 'PyTRASHCANEND'.\n\nA tpdealloc function that has the old macros, such as:\n\nstatic void\nmytypedealloc(mytype *p)\n{\nPyObjectGCUnTrack(p);\nPyTRASHCANSAFEBEGIN(p);\n...\nPyTRASHCANSAFEEND\n}\n\nshould migrate to the new macros as follows:\n\nstatic void\nmytypedealloc(mytype *p)\n{\nPyObjectGCUnTrack(p);\nPyTRASHCANBEGIN(p, mytypedealloc)\n...\nPyTRASHCANEND\n}\n\nNote that 'PyTRASHCANBEGIN' has a second argument which should be\nthe deallocation function it is in.\n\nTo support older Python versions in the same codebase, you can\ndefine the following macros and use them throughout the code\n(credit: these were copied from the 'mypy' codebase):\n\n#if PYVERSIONHEX >= 0x03080000\n#  define CPyTRASHCANBEGIN(op, dealloc) PyTRASHCANBEGIN(op, dealloc)\n#  define CPyTRASHCANEND(op) PyTRASHCANEND\n#else\n#  define CPyTRASHCANBEGIN(op, dealloc) PyTRASHCANSAFEBEGIN(op)\n#  define CPyTRASHCANEND(op) PyTRASHCANSAFEEND(op)\n#endif\n\n* The *note PyTypeReady(): 567. function now raises an error if a\ntype is defined with the *note PyTPFLAGSHAVEGC: 568. flag set\nbut has no traverse function (*note PyTypeObject.tptraverse:\n569.).  (Contributed by Victor Stinner in bpo-44263(11).)\n\n* Heap types with the *note PyTPFLAGSIMMUTABLETYPE: 2b2. flag can\nnow inherit the PEP 590(12) vectorcall protocol.  Previously, this\nwas only possible for *note static types: 56a.  (Contributed by\nErlend E. Aasland in bpo-43908(13))\n\n* Since *note PyTYPE(): 56b. is changed to a inline static function,\n'PyTYPE(obj) = newtype' must be replaced with 'PySETTYPE(obj,\nnewtype)': see the *note PySETTYPE(): 56c. function (available\nsince Python 3.9).  For backward compatibility, this macro can be\nused:\n\n#if PYVERSIONHEX < 0x030900A4 && !defined(PySETTYPE)\nstatic inline void PySETTYPE(PyObject *ob, PyTypeObject *type)\n{ ob->obtype = type; }\n#define PySETTYPE(ob, type) PySETTYPE((PyObject*)(ob), type)\n#endif\n\n(Contributed by Victor Stinner in bpo-39573(14).)\n\n* Since *note PySIZE(): 56d. is changed to a inline static function,\n'PySIZE(obj) = newsize' must be replaced with 'PySETSIZE(obj,\nnewsize)': see the *note PySETSIZE(): 56e. function (available\nsince Python 3.9).  For backward compatibility, this macro can be\nused:\n\n#if PYVERSIONHEX < 0x030900A4 && !defined(PySETSIZE)\nstatic inline void PySETSIZE(PyVarObject *ob, Pyssizet size)\n{ ob->obsize = size; }\n#define PySETSIZE(ob, size) PySETSIZE((PyVarObject*)(ob), size)\n#endif\n\n(Contributed by Victor Stinner in bpo-39573(15).)\n\n* '<Python.h>' no longer includes the header files '<stdlib.h>',\n'<stdio.h>', '<errno.h>' and '<string.h>' when the 'PyLIMITEDAPI'\nmacro is set to '0x030b0000' (Python 3.11) or higher.  C extensions\nshould explicitly include the header files after '#include\n<Python.h>'.  (Contributed by Victor Stinner in bpo-45434(16).)\n\n* The non-limited API files 'cellobject.h', 'classobject.h',\n'code.h', 'context.h', 'funcobject.h', 'genobject.h' and\n'longintrepr.h' have been moved to the 'Include/cpython' directory.\nMoreover, the 'eval.h' header file was removed.  These files must\nnot be included directly, as they are already included in\n'Python.h': *note Include Files: 56f.  If they have been included\ndirectly, consider including 'Python.h' instead.  (Contributed by\nVictor Stinner in bpo-35134(17).)\n\n* The 'PyUnicodeCHECKINTERNED()' macro has been excluded from the\nlimited C API. It was never usable there, because it used internal\nstructures which are not available in the limited C API.\n(Contributed by Victor Stinner in bpo-46007(18).)\n\n* The following frame functions and type are now directly available\nwith '#include <Python.h>', it's no longer needed to add '#include\n<frameobject.h>':\n\n* *note PyFrameCheck(): 570.\n\n* *note PyFrameGetBack(): 571.\n\n* *note PyFrameGetBuiltins(): 556.\n\n* *note PyFrameGetGenerator(): 557.\n\n* *note PyFrameGetGlobals(): 558.\n\n* *note PyFrameGetLasti(): 559.\n\n* *note PyFrameGetLocals(): 572.\n\n* *note PyFrameType: 573.\n\n(Contributed by Victor Stinner in gh-93937(19).)\n\n* The *note PyFrameObject: 575. structure members have been removed\nfrom the public C API.\n\nWhile the documentation notes that the *note PyFrameObject: 575.\nfields are subject to change at any time, they have been stable for\na long time and were used in several popular extensions.\n\nIn Python 3.11, the frame struct was reorganized to allow\nperformance optimizations.  Some fields were removed entirely, as\nthey were details of the old implementation.\n\n*note PyFrameObject: 575. fields:\n\n* 'fback': use *note PyFrameGetBack(): 571.\n\n* 'fblockstack': removed.\n\n* 'fbuiltins': use *note PyFrameGetBuiltins(): 556.\n\n* 'fcode': use *note PyFrameGetCode(): 576.\n\n* 'fgen': use *note PyFrameGetGenerator(): 557.\n\n* 'fglobals': use *note PyFrameGetGlobals(): 558.\n\n* 'fiblock': removed.\n\n* 'flasti': use *note PyFrameGetLasti(): 559.  Code using\n'flasti' with 'PyCodeAddr2Line()' should use *note\nPyFrameGetLineNumber(): 577. instead; it may be faster.\n\n* 'flineno': use *note PyFrameGetLineNumber(): 577.\n\n* 'flocals': use *note PyFrameGetLocals(): 572.\n\n* 'fstackdepth': removed.\n\n* 'fstate': no public API (renamed to 'fframe.fstate').\n\n* 'ftrace': no public API.\n\n* 'ftracelines': use 'PyObjectGetAttrString((PyObject*)frame,\n\"ftracelines\")'.\n\n* 'ftraceopcodes': use\n'PyObjectGetAttrString((PyObject*)frame, \"ftraceopcodes\")'.\n\n* 'flocalsplus': no public API (renamed to\n'fframe.localsplus').\n\n* 'fvaluestack': removed.\n\nThe Python frame object is now created lazily.  A side effect is\nthat the *note fback: 578. member must not be accessed directly,\nsince its value is now also computed lazily.  The *note\nPyFrameGetBack(): 571. function must be called instead.\n\nDebuggers that accessed the *note flocals: 579. directly 'must'\ncall *note PyFrameGetLocals(): 572. instead.  They no longer need\nto call 'PyFrameFastToLocalsWithError()' or\n'PyFrameLocalsToFast()', in fact they should not call those\nfunctions.  The necessary updating of the frame is now managed by\nthe virtual machine.\n\nCode defining 'PyFrameGetCode()' on Python 3.8 and older:\n\n#if PYVERSIONHEX < 0x030900B1\nstatic inline PyCodeObject* PyFrameGetCode(PyFrameObject *frame)\n{\nPyINCREF(frame->fcode);\nreturn frame->fcode;\n}\n#endif\n\nCode defining 'PyFrameGetBack()' on Python 3.8 and older:\n\n#if PYVERSIONHEX < 0x030900B1\nstatic inline PyFrameObject* PyFrameGetBack(PyFrameObject *frame)\n{\nPyXINCREF(frame->fback);\nreturn frame->fback;\n}\n#endif\n\nOr use the pythoncapicompat project(20) to get these two functions\non older Python versions.\n\n* Changes of the *note PyThreadState: 57a. structure members:\n\n* 'frame': removed, use *note PyThreadStateGetFrame(): 57b.\n(function added to Python 3.9 by bpo-40429(21)).  Warning: the\nfunction returns a *note strong reference: 57c, need to call\n*note PyXDECREF(): 57d.\n\n* 'tracing': changed, use *note PyThreadStateEnterTracing():\n53b. and *note PyThreadStateLeaveTracing(): 53c. (functions\nadded to Python 3.11 by bpo-43760(22)).\n\n* 'recursiondepth': removed, use '(tstate->recursionlimit -\ntstate->recursionremaining)' instead.\n\n* 'stackcheckcounter': removed.\n\nCode defining 'PyThreadStateGetFrame()' on Python 3.8 and older:\n\n#if PYVERSIONHEX < 0x030900B1\nstatic inline PyFrameObject* PyThreadStateGetFrame(PyThreadState *tstate)\n{\nPyXINCREF(tstate->frame);\nreturn tstate->frame;\n}\n#endif\n\nCode defining 'PyThreadStateEnterTracing()' and\n'PyThreadStateLeaveTracing()' on Python 3.10 and older:\n\n#if PYVERSIONHEX < 0x030B00A2\nstatic inline void PyThreadStateEnterTracing(PyThreadState *tstate)\n{\ntstate->tracing++;\n#if PYVERSIONHEX >= 0x030A00A1\ntstate->cframe->usetracing = 0;\n#else\ntstate->usetracing = 0;\n#endif\n}\n\nstatic inline void PyThreadStateLeaveTracing(PyThreadState *tstate)\n{\nint usetracing = (tstate->ctracefunc != NULL || tstate->cprofilefunc != NULL);\ntstate->tracing--;\n#if PYVERSIONHEX >= 0x030A00A1\ntstate->cframe->usetracing = usetracing;\n#else\ntstate->usetracing = usetracing;\n#endif\n}\n#endif\n\nOr use the pythoncapi-compat project(23) to get these functions on\nold Python functions.\n\n* Distributors are encouraged to build Python with the optimized\nBlake2 library libb2(24).\n\n* The *note PyConfig.modulesearchpathsset: 3b5. field must now be\nset to 1 for initialization to use *note\nPyConfig.modulesearchpaths: 3b6. to initialize *note sys.path:\n32c.  Otherwise, initialization will recalculate the path and\nreplace any values added to 'modulesearchpaths'.\n\n* *note PyConfigRead(): 57e. no longer calculates the initial search\npath, and will not fill any values into *note\nPyConfig.modulesearchpaths: 3b6.  To calculate default paths and\nthen modify them, finish initialization and use *note\nPySysGetObject(): 57f. to retrieve *note sys.path: 32c. as a\nPython list object and modify it directly.\n\n---------- Footnotes ----------\n\n(1) https://gcc.gnu.org/onlinedocs/cpp/Macro-Pitfalls.html\n\n(2) https://peps.python.org/pep-0670/\n\n(3) https://github.com/python/cpython/issues/89653\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=45711\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=45711\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=46608\n\n(7) https://peps.python.org/pep-0523/\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=46841\n\n(9) https://github.com/python/cpython/issues/92154\n\n(10) https://github.com/python/cpython/issues/94936\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=44263\n\n(12) https://peps.python.org/pep-0590/\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=43908\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=39573\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=39573\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=45434\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=35134\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=46007\n\n(19) https://github.com/python/cpython/issues/93937\n\n(20) https://github.com/python/pythoncapi-compat\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=40429\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=43760\n\n(23) https://github.com/python/pythoncapi-compat\n\n(24) https://www.blake2.net/\n\nFile: python3.12.info,  Node: Deprecated<4>,  Next: Pending Removal in Python 3 12<2>,  Prev: Porting to Python 3 11<2>,  Up: C API Changes<2>\n\n1.2.16.3 Deprecated\n...................\n\n* Deprecate the following functions to configure the Python\ninitialization:\n\n* 'PySysAddWarnOptionUnicode()'\n\n* 'PySysAddWarnOption()'\n\n* 'PySysAddXOption()'\n\n* 'PySysHasWarnOptions()'\n\n* 'PySysSetArgvEx()'\n\n* 'PySysSetArgv()'\n\n* 'PySysSetPath()'\n\n* 'PySetPath()'\n\n* 'PySetProgramName()'\n\n* 'PySetPythonHome()'\n\n* 'PySetStandardStreamEncoding()'\n\n* 'PySetProgramFullPath()'\n\nUse the new *note PyConfig: 318. API of the *note Python\nInitialization Configuration: 581. instead ( PEP 587(1)).\n(Contributed by Victor Stinner in gh-88279(2).)\n\n* Deprecate the 'obshash' member of the *note PyBytesObject: 582.\nUse *note PyObjectHash(): 342. instead.  (Contributed by Inada\nNaoki in bpo-46864(3).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0587/\n\n(2) https://github.com/python/cpython/issues/88279\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=46864\n\nFile: python3.12.info,  Node: Pending Removal in Python 3 12<2>,  Next: Removed<4>,  Prev: Deprecated<4>,  Up: C API Changes<2>\n\n1.2.16.4 Pending Removal in Python 3.12\n.......................................\n",
            "subsections": []
        },
        "The following C APIs have been deprecated in earlier Python releases,": {
            "content": "and will be removed in Python 3.12.\n\n* 'PyUnicodeASDATA()'\n\n* 'PyUnicodeASUNICODE()'\n\n* 'PyUnicodeAsUnicodeAndSize()'\n\n* 'PyUnicodeAsUnicode()'\n\n* 'PyUnicodeFromUnicode()'\n\n* 'PyUnicodeGETDATASIZE()'\n\n* 'PyUnicodeGETSIZE()'\n\n* 'PyUnicodeGetSize()'\n\n* 'PyUnicodeISCOMPACT()'\n\n* 'PyUnicodeISREADY()'\n\n* *note PyUnicodeREADY(): 341.\n\n* 'PyUnicodeWSTRLENGTH()'\n\n* 'PyUnicodeAsUnicode()'\n\n* 'PyUnicodeWCHARKIND'\n\n* *note PyUnicodeObject: 584.\n\n* 'PyUnicodeInternImmortal()'\n\nFile: python3.12.info,  Node: Removed<4>,  Prev: Pending Removal in Python 3 12<2>,  Up: C API Changes<2>\n\n1.2.16.5 Removed\n................\n\n* 'PyFrameBlockSetup()' and 'PyFrameBlockPop()' have been removed.\n(Contributed by Mark Shannon in bpo-40222(1).)\n\n* Remove the following math macros using the 'errno' variable:\n\n* 'PyADJUSTERANGE1()'\n\n* 'PyADJUSTERANGE2()'\n\n* 'PyOVERFLOWED()'\n\n* 'PySETERANGEIFOVERFLOW()'\n\n* 'PySETERRNOONMATHERROR()'\n\n(Contributed by Victor Stinner in bpo-45412(2).)\n\n* Remove 'PyUNICODECOPY()' and 'PyUNICODEFILL()' macros,\ndeprecated since Python 3.3.  Use 'PyUnicodeCopyCharacters()' or\n'memcpy()' ('wchart*' string), and 'PyUnicodeFill()' functions\ninstead.  (Contributed by Victor Stinner in bpo-41123(3).)\n\n* Remove the 'pystrhex.h' header file.  It only contains private\nfunctions.  C extensions should only include the main '<Python.h>'\nheader file.  (Contributed by Victor Stinner in bpo-45434(4).)\n\n* Remove the 'PyFORCEDOUBLE()' macro.  It was used by the\n'PyISINFINITY()' macro.  (Contributed by Victor Stinner in\nbpo-45440(5).)\n\n* The following items are no longer available when *note\nPyLIMITEDAPI: 586. is defined:\n\n* *note PyMarshalWriteLongToFile(): 587.\n\n* *note PyMarshalWriteObjectToFile(): 588.\n\n* *note PyMarshalReadObjectFromString(): 589.\n\n* *note PyMarshalWriteObjectToString(): 58a.\n\n* the 'PyMARSHALVERSION' macro\n\nThese are not part of the *note limited API: 58b.\n\n(Contributed by Victor Stinner in bpo-45474(6).)\n\n* Exclude *note PyWeakrefGETOBJECT(): 58c. from the limited C API.\nIt never worked since the 'PyWeakReference' structure is opaque in\nthe limited C API. (Contributed by Victor Stinner in bpo-35134(7).)\n\n* Remove the 'PyHeapTypeGETMEMBERS()' macro.  It was exposed in the\npublic C API by mistake, it must only be used by Python internally.\nUse the 'PyTypeObject.tpmembers' member instead.  (Contributed by\nVictor Stinner in bpo-40170(8).)\n\n* Remove the 'HAVEPYSET53BITPRECISION' macro (moved to the\ninternal C API). (Contributed by Victor Stinner in bpo-45412(9).)\n\n* Remove the *note PyUNICODE: 326. encoder APIs, as they have been\ndeprecated since Python 3.3, are little used and are inefficient\nrelative to the recommended alternatives.\n\nThe removed functions are:\n\n* 'PyUnicodeEncode()'\n\n* 'PyUnicodeEncodeASCII()'\n\n* 'PyUnicodeEncodeLatin1()'\n\n* 'PyUnicodeEncodeUTF7()'\n\n* 'PyUnicodeEncodeUTF8()'\n\n* 'PyUnicodeEncodeUTF16()'\n\n* 'PyUnicodeEncodeUTF32()'\n\n* 'PyUnicodeEncodeUnicodeEscape()'\n\n* 'PyUnicodeEncodeRawUnicodeEscape()'\n\n* 'PyUnicodeEncodeCharmap()'\n\n* 'PyUnicodeTranslateCharmap()'\n\n* 'PyUnicodeEncodeDecimal()'\n\n* 'PyUnicodeTransformDecimalToASCII()'\n\nSee PEP 624(10) for details and migration guidance(11).\n(Contributed by Inada Naoki in bpo-44029(12).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40222\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=45412\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=41123\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=45434\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=45440\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=45474\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=35134\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=40170\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=45412\n\n(10) https://peps.python.org/pep-0624/\n\n(11) https://peps.python.org/pep-0624/#alternative-apis\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=44029\n\nFile: python3.12.info,  Node: Notable changes in 3 11 4,  Next: Notable changes in 3 11 5,  Prev: C API Changes<2>,  Up: What's New In Python 3 11\n\n\n* Menu:\n\n* tarfile: tarfile<2>.\n\nFile: python3.12.info,  Node: tarfile<2>,  Up: Notable changes in 3 11 4\n\n1.2.17.1 tarfile\n................\n\n* The extraction methods in *note tarfile: d8, and *note\nshutil.unpackarchive(): 184, have a new a 'filter' argument that\nallows limiting tar features than may be surprising or dangerous,\nsuch as creating files outside the destination directory.  See\n*note Extraction filters: 185. for details.  In Python 3.12, use\nwithout the 'filter' argument will show a *note DeprecationWarning:\n179.  In Python 3.14, the default will switch to ''data''.\n(Contributed by Petr Viktorin in PEP 706(1).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0706/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Notable changes in 3 11 5,  Prev: Notable changes in 3 11 4,  Up: What's New In Python 3 11": {
            "content": "* Menu:\n\n* OpenSSL::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: OpenSSL,  Up: Notable changes in 3 11 5": {
            "content": "1.2.18.1 OpenSSL\n................\n\n* Windows builds and macOS installers from python.org now use OpenSSL\n3.0.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": [
                {
                    "name": "1.3 What's New In Python 3.10",
                    "content": ""
                }
            ]
        },
        "Python 3.10 was released on October 4, 2021.  For full details, see the": {
            "content": "*note changelog: 136.\n\n* Menu:\n\n* Summary - Release highlights: Summary - Release highlights<3>.\n* New Features: New Features<5>.\n* New Features Related to Type Hints: New Features Related to Type Hints<3>.\n* Other Language Changes: Other Language Changes<3>.\n* New Modules: New Modules<3>.\n* Improved Modules: Improved Modules<3>.\n* Optimizations: Optimizations<3>.\n* Deprecated: Deprecated<5>.\n* Removed: Removed<5>.\n* Porting to Python 3.10: Porting to Python 3 10.\n* CPython bytecode changes: CPython bytecode changes<3>.\n* Build Changes: Build Changes<3>.\n* C API Changes: C API Changes<3>.\n* Notable security feature in 3.10.7: Notable security feature in 3 10 7.\n* Notable security feature in 3.10.8: Notable security feature in 3 10 8.\n* Notable changes in 3.10.12: Notable changes in 3 10 12.\n\nFile: python3.12.info,  Node: Summary - Release highlights<3>,  Next: New Features<5>,  Up: What's New In Python 3 10\n\n\nNew syntax features:\n\n* PEP 634(1), Structural Pattern Matching: Specification\n\n* PEP 635(2), Structural Pattern Matching: Motivation and Rationale\n\n* PEP 636(3), Structural Pattern Matching: Tutorial\n\n* bpo-12782(4), Parenthesized context managers are now officially\nallowed.\n\nNew features in the standard library:\n\n* PEP 618(5), Add Optional Length-Checking To zip.\n\nInterpreter improvements:\n\n* PEP 626(6), Precise line numbers for debugging and other tools.\n\nNew typing features:\n\n* PEP 604(7), Allow writing union types as X | Y\n\n* PEP 612(8), Parameter Specification Variables\n\n* PEP 613(9), Explicit Type Aliases\n\n* PEP 647(10), User-Defined Type Guards\n\nImportant deprecations, removals or restrictions:\n\n* PEP 644(11), Require OpenSSL 1.1.1 or newer\n\n* PEP 632(12), Deprecate distutils module.\n\n* PEP 623(13), Deprecate and prepare for the removal of the wstr\nmember in PyUnicodeObject.\n\n* PEP 624(14), Remove PyUNICODE encoder APIs\n\n* PEP 597(15), Add optional EncodingWarning\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0634/\n\n(2) https://peps.python.org/pep-0635/\n\n(3) https://peps.python.org/pep-0636/\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=12782\n\n(5) https://peps.python.org/pep-0618/\n\n(6) https://peps.python.org/pep-0626/\n\n(7) https://peps.python.org/pep-0604/\n\n(8) https://peps.python.org/pep-0612/\n\n(9) https://peps.python.org/pep-0613/\n\n(10) https://peps.python.org/pep-0647/\n\n(11) https://peps.python.org/pep-0644/\n\n(12) https://peps.python.org/pep-0632/\n\n(13) https://peps.python.org/pep-0623/\n\n(14) https://peps.python.org/pep-0624/\n\n(15) https://peps.python.org/pep-0597/\n\nFile: python3.12.info,  Node: New Features<5>,  Next: New Features Related to Type Hints<3>,  Prev: Summary - Release highlights<3>,  Up: What's New In Python 3 10\n\n\n* Menu:\n\n* Parenthesized context managers::\n* Better error messages::\n* PEP 626; Precise line numbers for debugging and other tools: PEP 626 Precise line numbers for debugging and other tools.\n* PEP 634; Structural Pattern Matching: PEP 634 Structural Pattern Matching.\n* Optional EncodingWarning and encoding=\"locale\" option::\n\nFile: python3.12.info,  Node: Parenthesized context managers,  Next: Better error messages,  Up: New Features<5>\n\n1.3.2.1 Parenthesized context managers\n......................................\n",
            "subsections": []
        },
        "Using enclosing parentheses for continuation across multiple lines in": {
            "content": "context managers is now supported.  This allows formatting a long\ncollection of context managers in multiple lines in a similar way as it\nwas previously possible with import statements.  For instance, all these\nexamples are now valid:\n\nwith (CtxManager() as example):\n...\n\nwith (\nCtxManager1(),\nCtxManager2()\n):\n...\n\nwith (CtxManager1() as example,\nCtxManager2()):\n...\n\nwith (CtxManager1(),\nCtxManager2() as example):\n...\n\nwith (\nCtxManager1() as example1,\nCtxManager2() as example2\n):\n...\n\nit is also possible to use a trailing comma at the end of the enclosed\ngroup:\n\nwith (\nCtxManager1() as example1,\nCtxManager2() as example2,\nCtxManager3() as example3,\n):\n...\n",
            "subsections": []
        },
        "This new syntax uses the non LL(1) capacities of the new parser.  Check": {
            "content": "PEP 617(1) for more details.\n\n(Contributed by Guido van Rossum, Pablo Galindo and Lysandros Nikolaou\nin bpo-12782(2) and bpo-40334(3).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0617/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=12782\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=40334\n\nFile: python3.12.info,  Node: Better error messages,  Next: PEP 626 Precise line numbers for debugging and other tools,  Prev: Parenthesized context managers,  Up: New Features<5>\n\n1.3.2.2 Better error messages\n.............................\n\n* Menu:\n\n* SyntaxErrors::\n* IndentationErrors::\n* AttributeErrors::\n* NameErrors::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: SyntaxErrors,  Next: IndentationErrors,  Up: Better error messages": {
            "content": "1.3.2.3 SyntaxErrors\n....................\n",
            "subsections": []
        },
        "When parsing code that contains unclosed parentheses or brackets the": {
            "content": "interpreter now includes the location of the unclosed bracket of\nparentheses instead of displaying 'SyntaxError: unexpected EOF while\nparsing' or pointing to some incorrect location.  For instance, consider\nthe following code (notice the unclosed '{'):\n\nexpected = {9: 1, 18: 2, 19: 2, 27: 3, 28: 3, 29: 3, 36: 4, 37: 4,\n38: 4, 39: 4, 45: 5, 46: 5, 47: 5, 48: 5, 49: 5, 54: 6,\nsomeothercode = foo()\n",
            "subsections": []
        },
        "Previous versions of the interpreter reported confusing places as the": {
            "content": "location of the syntax error:\n\nFile \"example.py\", line 3\nsomeothercode = foo()\n^\nSyntaxError: invalid syntax\n\nbut in Python 3.10 a more informative error is emitted:\n\nFile \"example.py\", line 1\nexpected = {9: 1, 18: 2, 19: 2, 27: 3, 28: 3, 29: 3, 36: 4, 37: 4,\n^\nSyntaxError: '{' was never closed\n",
            "subsections": []
        },
        "In a similar way, errors involving unclosed string literals (single and": {
            "content": "triple quoted) now point to the start of the string instead of reporting\nEOF/EOL.\n",
            "subsections": []
        },
        "These improvements are inspired by previous work in the PyPy": {
            "content": "interpreter.\n\n(Contributed by Pablo Galindo in bpo-42864(1) and Batuhan Taskaya in\nbpo-40176(2).)\n\n*note SyntaxError: 146. exceptions raised by the interpreter will now\nhighlight the full error range of the expression that constitutes the\nsyntax error itself, instead of just where the problem is detected.  In\nthis way, instead of displaying (before Python 3.10):\n\n>>> foo(x, z for z in range(10), t, w)\nFile \"<stdin>\", line 1\nfoo(x, z for z in range(10), t, w)\n^\nSyntaxError: Generator expression must be parenthesized\n\nnow Python 3.10 will display the exception as:\n\n>>> foo(x, z for z in range(10), t, w)\nFile \"<stdin>\", line 1\nfoo(x, z for z in range(10), t, w)\n^^^^^^^^^^^^^^^^^^^^\nSyntaxError: Generator expression must be parenthesized\n\nThis improvement was contributed by Pablo Galindo in bpo-43914(3).\n\nA considerable amount of new specialized messages for *note SyntaxError:\n146. exceptions have been incorporated.  Some of the most notable ones\nare as follows:\n\n* Missing ':' before blocks:\n\n>>> if rocket.position > eventhorizon\nFile \"<stdin>\", line 1\nif rocket.position > eventhorizon\n^\nSyntaxError: expected ':'\n\n(Contributed by Pablo Galindo in bpo-42997(4).)\n\n* Unparenthesised tuples in comprehensions targets:\n\n>>> {x,y for x,y in zip('abcd', '1234')}\nFile \"<stdin>\", line 1\n{x,y for x,y in zip('abcd', '1234')}\n^\nSyntaxError: did you forget parentheses around the comprehension target?\n\n(Contributed by Pablo Galindo in bpo-43017(5).)\n\n* Missing commas in collection literals and between expressions:\n\n>>> items = {\n... x: 1,\n... y: 2\n... z: 3,\nFile \"<stdin>\", line 3\ny: 2\n^\nSyntaxError: invalid syntax. Perhaps you forgot a comma?\n\n(Contributed by Pablo Galindo in bpo-43822(6).)\n\n* Multiple Exception types without parentheses:\n\n>>> try:\n...     builddysonsphere()\n... except NotEnoughScienceError, NotEnoughResourcesError:\nFile \"<stdin>\", line 3\nexcept NotEnoughScienceError, NotEnoughResourcesError:\n^\nSyntaxError: multiple exception types must be parenthesized\n\n(Contributed by Pablo Galindo in bpo-43149(7).)\n\n* Missing ':' and values in dictionary literals:\n\n>>> values = {\n... x: 1,\n... y: 2,\n... z:\n... }\nFile \"<stdin>\", line 4\nz:\n^\nSyntaxError: expression expected after dictionary key and ':'\n\n>>> values = {x:1, y:2, z w:3}\nFile \"<stdin>\", line 1\nvalues = {x:1, y:2, z w:3}\n^\nSyntaxError: ':' expected after dictionary key\n\n(Contributed by Pablo Galindo in bpo-43823(8).)\n\n* 'try' blocks without 'except' or 'finally' blocks:\n\n>>> try:\n...     x = 2\n... something = 3\nFile \"<stdin>\", line 3\nsomething  = 3\n^^^^^^^^^\nSyntaxError: expected 'except' or 'finally' block\n\n(Contributed by Pablo Galindo in bpo-44305(9).)\n\n* Usage of '=' instead of '==' in comparisons:\n\n>>> if rocket.position = eventhorizon:\nFile \"<stdin>\", line 1\nif rocket.position = eventhorizon:\n^\nSyntaxError: cannot assign to attribute here. Maybe you meant '==' instead of '='?\n\n(Contributed by Pablo Galindo in bpo-43797(10).)\n\n* Usage of '*' in f-strings:\n\n>>> f\"Black holes {*allblackholes} and revelations\"\nFile \"<stdin>\", line 1\n(*allblackholes)\n^\nSyntaxError: f-string: cannot use starred expression here\n\n(Contributed by Pablo Galindo in bpo-41064(11).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42864\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=40176\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=43914\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=42997\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=43017\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=43822\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=43149\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=43823\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=44305\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=43797\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=41064\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: IndentationErrors,  Next: AttributeErrors,  Prev: SyntaxErrors,  Up: Better error messages": {
            "content": "1.3.2.4 IndentationErrors\n.........................\n\nMany *note IndentationError: 59a. exceptions now have more context\nregarding what kind of block was expecting an indentation, including the\nlocation of the statement:\n\n>>> def foo():\n...    if lel:\n...    x = 2\nFile \"<stdin>\", line 3\nx = 2\n^\nIndentationError: expected an indented block after 'if' statement in line 2\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: AttributeErrors,  Next: NameErrors,  Prev: IndentationErrors,  Up: Better error messages": {
            "content": "1.3.2.5 AttributeErrors\n.......................\n\nWhen printing *note AttributeError: 395, 'PyErrDisplay()' will offer\nsuggestions of similar attribute names in the object that the exception\nwas raised from:\n\n>>> collections.namedtoplo\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nAttributeError: module 'collections' has no attribute 'namedtoplo'. Did you mean: namedtuple?\n\n(Contributed by Pablo Galindo in bpo-38530(1).)\n\nWarning: Notice this won't work if 'PyErrDisplay()' is not called\nto display the error which can happen if some other custom error\ndisplay function is used.  This is a common scenario in some REPLs\nlike IPython.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38530\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: NameErrors,  Prev: AttributeErrors,  Up: Better error messages": {
            "content": "1.3.2.6 NameErrors\n..................\n\nWhen printing *note NameError: 144. raised by the interpreter,\n'PyErrDisplay()' will offer suggestions of similar variable names in\nthe function that the exception was raised from:\n\n>>> schwarzschildblackhole = None\n>>> schwarschildblackhole\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nNameError: name 'schwarschildblackhole' is not defined. Did you mean: schwarzschildblackhole?\n\n(Contributed by Pablo Galindo in bpo-38530(1).)\n\nWarning: Notice this won't work if 'PyErrDisplay()' is not called\nto display the error, which can happen if some other custom error\ndisplay function is used.  This is a common scenario in some REPLs\nlike IPython.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38530\n\nFile: python3.12.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<5>\n\n1.3.2.7 PEP 626: Precise line numbers for debugging and other tools\n...................................................................\n\nPEP 626 brings more precise and reliable line numbers for debugging,\nprofiling and coverage tools.  Tracing events, with the correct line\nnumber, are generated for all lines of code executed and only for lines\nof code that are executed.\n\nThe *note flineno: 59e. attribute of frame objects will always contain\nthe expected line number.\n\nThe *note colnotab: 244. attribute of *note code objects: 59f. is\ndeprecated and will be removed in 3.12.  Code that needs to convert from\noffset to line number should use the new *note colines(): 5a0. method\ninstead.\n\nFile: python3.12.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<5>\n\n1.3.2.8 PEP 634: Structural Pattern Matching\n............................................\n",
            "subsections": []
        },
        "Structural pattern matching has been added in the form of a 'match": {
            "content": "statement' and 'case statements' of patterns with associated actions.",
            "subsections": []
        },
        "Patterns consist of sequences, mappings, primitive data types as well as": {
            "content": "class instances.  Pattern matching enables programs to extract\ninformation from complex data types, branch on the structure of data,\nand apply specific actions based on different forms of data.\n\n* Menu:\n\n* Syntax and operations::\n* Declarative approach::\n* Simple pattern; match to a literal: Simple pattern match to a literal.\n* Patterns with a literal and variable::\n* Patterns and classes::\n* Nested patterns::\n* Complex patterns and the wildcard::\n* Guard::\n* Other Key Features::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Syntax and operations,  Next: Declarative approach,  Up: PEP 634 Structural Pattern Matching": {
            "content": "1.3.2.9 Syntax and operations\n.............................\n\nThe generic syntax of pattern matching is:\n\nmatch subject:\ncase <pattern1>:\n<action1>\ncase <pattern2>:\n<action2>\ncase <pattern3>:\n<action3>\ncase :\n<actionwildcard>\n\nA match statement takes an expression and compares its value to\nsuccessive patterns given as one or more case blocks.  Specifically,\npattern matching operates by:\n\n1. using data with type and shape (the 'subject')\n\n2. evaluating the 'subject' in the 'match' statement\n\n3. comparing the subject with each pattern in a 'case' statement from\ntop to bottom until a match is confirmed.\n\n4. executing the action associated with the pattern of the confirmed\nmatch\n\n5. If an exact match is not confirmed, the last case, a wildcard '',\nif provided, will be used as the matching case.  If an exact match\nis not confirmed and a wildcard case does not exist, the entire\nmatch block is a no-op.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Declarative approach,  Next: Simple pattern match to a literal,  Prev: Syntax and operations,  Up: PEP 634 Structural Pattern Matching": {
            "content": "1.3.2.10 Declarative approach\n.............................\n",
            "subsections": []
        },
        "Readers may be aware of pattern matching through the simple example of": {
            "content": "matching a subject (data object) to a literal (pattern) with the switch\nstatement found in C, Java or JavaScript (and many other languages).",
            "subsections": []
        },
        "Often the switch statement is used for comparison of an": {
            "content": "object/expression with case statements containing literals.\n",
            "subsections": []
        },
        "More powerful examples of pattern matching can be found in languages": {
            "content": "such as Scala and Elixir.  With structural pattern matching, the\napproach is \"declarative\" and explicitly states the conditions (the\npatterns) for data to match.\n\nWhile an \"imperative\" series of instructions using nested \"if\"\nstatements could be used to accomplish something similar to structural\npattern matching, it is less clear than the \"declarative\" approach.\nInstead the \"declarative\" approach states the conditions to meet for a\nmatch and is more readable through its explicit patterns.  While\nstructural pattern matching can be used in its simplest form comparing a\nvariable to a literal in a case statement, its true value for Python\nlies in its handling of the subject's type and shape.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Simple pattern match to a literal,  Next: Patterns with a literal and variable,  Prev: Declarative approach,  Up: PEP 634 Structural Pattern Matching": {
            "content": "1.3.2.11 Simple pattern: match to a literal\n...........................................\n",
            "subsections": []
        },
        "Let's look at this example as pattern matching in its simplest form: a": {
            "content": "value, the subject, being matched to several literals, the patterns.  In\nthe example below, 'status' is the subject of the match statement.  The\npatterns are each of the case statements, where literals represent\nrequest status codes.  The associated action to the case is executed\nafter a match:\n\ndef httperror(status):\nmatch status:\ncase 400:\nreturn \"Bad request\"\ncase 404:\nreturn \"Not found\"\ncase 418:\nreturn \"I'm a teapot\"\ncase :\nreturn \"Something's wrong with the internet\"\n\nIf the above function is passed a 'status' of 418, \"I'm a teapot\" is\nreturned.  If the above function is passed a 'status' of 500, the case\nstatement with '' will match as a wildcard, and \"Something's wrong with\nthe internet\" is returned.  Note the last block: the variable name, '',\nacts as a 'wildcard' and insures the subject will always match.  The use\nof '' is optional.\n\nYou can combine several literals in a single pattern using '|' (\"or\"):\n\ncase 401 | 403 | 404:\nreturn \"Not allowed\"\n\n* Menu:\n\n* Behavior without the wildcard::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Behavior without the wildcard,  Up: Simple pattern match to a literal": {
            "content": "1.3.2.12 Behavior without the wildcard\n......................................\n",
            "subsections": []
        },
        "If we modify the above example by removing the last case block, the": {
            "content": "example becomes:\n\ndef httperror(status):\nmatch status:\ncase 400:\nreturn \"Bad request\"\ncase 404:\nreturn \"Not found\"\ncase 418:\nreturn \"I'm a teapot\"\n",
            "subsections": []
        },
        "Without the use of '' in a case statement, a match may not exist.  If": {
            "content": "no match exists, the behavior is a no-op.  For example, if 'status' of\n500 is passed, a no-op occurs.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "1.3.2.13 Patterns with a literal and variable\n.............................................\n",
            "subsections": []
        },
        "Patterns can look like unpacking assignments, and a pattern may be used": {
            "content": "to bind variables.  In this example, a data point can be unpacked to its\nx-coordinate and y-coordinate:\n\n# point is an (x, y) tuple\nmatch point:\ncase (0, 0):\nprint(\"Origin\")\ncase (0, y):\nprint(f\"Y={y}\")\ncase (x, 0):\nprint(f\"X={x}\")\ncase (x, y):\nprint(f\"X={x}, Y={y}\")\ncase :\nraise ValueError(\"Not a point\")\n",
            "subsections": []
        },
        "The first pattern has two literals, '(0, 0)', and may be thought of as": {
            "content": "an extension of the literal pattern shown above.  The next two patterns\ncombine a literal and a variable, and the variable 'binds' a value from\nthe subject ('point').  The fourth pattern captures two values, which\nmakes it conceptually similar to the unpacking assignment '(x, y) =\npoint'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Patterns and classes,  Next: Nested patterns,  Prev: Patterns with a literal and variable,  Up: PEP 634 Structural Pattern Matching": {
            "content": "1.3.2.14 Patterns and classes\n.............................\n",
            "subsections": []
        },
        "If you are using classes to structure your data, you can use as a": {
            "content": "pattern the class name followed by an argument list resembling a\nconstructor.  This pattern has the ability to capture class attributes\ninto variables:\n\nclass Point:\nx: int\ny: int\n\ndef location(point):\nmatch point:\ncase Point(x=0, y=0):\nprint(\"Origin is the point's location.\")\ncase Point(x=0, y=y):\nprint(f\"Y={y} and the point is on the y-axis.\")\ncase Point(x=x, y=0):\nprint(f\"X={x} and the point is on the x-axis.\")\ncase Point():\nprint(\"The point is located somewhere else on the plane.\")\ncase :\nprint(\"Not a point\")\n\n* Menu:\n\n* Patterns with positional parameters::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Patterns with positional parameters,  Up: Patterns and classes": {
            "content": "1.3.2.15 Patterns with positional parameters\n............................................\n",
            "subsections": []
        },
        "You can use positional parameters with some builtin classes that provide": {
            "content": "an ordering for their attributes (e.g.  dataclasses).  You can also\ndefine a specific position for attributes in patterns by setting the\n'matchargs' special attribute in your classes.  If it's set to\n(\"x\", \"y\"), the following patterns are all equivalent (and all bind the\n'y' attribute to the 'var' variable):\n\nPoint(1, var)\nPoint(1, y=var)\nPoint(x=1, y=var)\nPoint(y=var, x=1)\n\nA recommended way to read patterns is to look at them as an extended\nform of what you would put on the left of an assignment, to understand\nwhich variables would be set to what.  Only the standalone names (like\n'var' above) are assigned to by a match statement.  Dotted names (like\n'foo.bar'), attribute names (the 'x=' and 'y=' above) or class names\n(recognized by the \"(...)\" next to them like 'Point' above) are never\nassigned to.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Nested patterns,  Next: Complex patterns and the wildcard,  Prev: Patterns and classes,  Up: PEP 634 Structural Pattern Matching": {
            "content": "1.3.2.16 Nested patterns\n........................\n",
            "subsections": []
        },
        "Patterns can be arbitrarily nested.  For example, if our data is a short": {
            "content": "list of points, it could be matched like this:\n\nmatch points:\ncase []:\nprint(\"No points in the list.\")\ncase [Point(0, 0)]:\nprint(\"The origin is the only point in the list.\")\ncase [Point(x, y)]:\nprint(f\"A single point {x}, {y} is in the list.\")\ncase [Point(0, y1), Point(0, y2)]:\nprint(f\"Two points on the Y axis at {y1}, {y2} are in the list.\")\ncase :\nprint(\"Something else is found in the list.\")\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Complex patterns and the wildcard,  Next: Guard,  Prev: Nested patterns,  Up: PEP 634 Structural Pattern Matching": {
            "content": "1.3.2.17 Complex patterns and the wildcard\n..........................................\n",
            "subsections": []
        },
        "To this point, the examples have used '' alone in the last case": {
            "content": "statement.  A wildcard can be used in more complex patterns, such as\n'('error', code, )'.  For example:\n\nmatch testvariable:\ncase ('warning', code, 40):\nprint(\"A warning has been received.\")\ncase ('error', code, ):\nprint(f\"An error {code} occurred.\")\n",
            "subsections": []
        },
        "In the above case, 'testvariable' will match for ('error', code, 100)": {
            "content": "and ('error', code, 800).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Guard,  Next: Other Key Features,  Prev: Complex patterns and the wildcard,  Up: PEP 634 Structural Pattern Matching": {
            "content": "1.3.2.18 Guard\n..............\n\nWe can add an 'if' clause to a pattern, known as a \"guard\".  If the\nguard is false, 'match' goes on to try the next case block.  Note that\nvalue capture happens before the guard is evaluated:\n\nmatch point:\ncase Point(x, y) if x == y:\nprint(f\"The point is located on the diagonal Y=X at {x}.\")\ncase Point(x, y):\nprint(f\"Point is not on the diagonal.\")\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Other Key Features,  Prev: Guard,  Up: PEP 634 Structural Pattern Matching": {
            "content": "1.3.2.19 Other Key Features\n...........................\n\nSeveral other key features:\n\n- Like unpacking assignments, tuple and list patterns have exactly\nthe same meaning and actually match arbitrary sequences.\nTechnically, the subject must be a sequence.  Therefore, an\nimportant exception is that patterns don't match iterators.  Also,\nto prevent a common mistake, sequence patterns don't match strings.\n\n- Sequence patterns support wildcards: '[x, y, *rest]' and '(x, y,\n*rest)' work similar to wildcards in unpacking assignments.  The\nname after '*' may also be '', so '(x, y, *)' matches a sequence\nof at least two items without binding the remaining items.\n\n- Mapping patterns: '{\"bandwidth\": b, \"latency\": l}' captures the\n'\"bandwidth\"' and '\"latency\"' values from a dict.  Unlike sequence\npatterns, extra keys are ignored.  A wildcard 'rest' is also\nsupported.  (But '' would be redundant, so is not allowed.)\n\n- Subpatterns may be captured using the 'as' keyword:\n\ncase (Point(x1, y1), Point(x2, y2) as p2): ...\n\nThis binds x1, y1, x2, y2 like you would expect without the 'as'\nclause, and p2 to the entire second item of the subject.\n\n- Most literals are compared by equality.  However, the singletons\n'True', 'False' and 'None' are compared by identity.\n\n- Named constants may be used in patterns.  These named constants\nmust be dotted names to prevent the constant from being interpreted\nas a capture variable:\n\nfrom enum import Enum\nclass Color(Enum):\nRED = 0\nGREEN = 1\nBLUE = 2\n\ncolor = Color.GREEN\nmatch color:\ncase Color.RED:\nprint(\"I see red!\")\ncase Color.GREEN:\nprint(\"Grass is green\")\ncase Color.BLUE:\nprint(\"I'm feeling the blues :(\")\n",
            "subsections": []
        },
        "For the full specification see PEP 634(1).  Motivation and rationale are": {
            "content": "in PEP 635(2), and a longer tutorial is in PEP 636(3).\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0634/\n\n(2) https://peps.python.org/pep-0635/\n\n(3) https://peps.python.org/pep-0636/\n\nFile: python3.12.info,  Node: Optional EncodingWarning and encoding=\"locale\" option,  Prev: PEP 634 Structural Pattern Matching,  Up: New Features<5>\n\n1.3.2.20 Optional 'EncodingWarning' and 'encoding=\"locale\"' option\n..................................................................\n\nThe default encoding of 'TextIOWrapper' and *note open(): 26e. is\nplatform and locale dependent.  Since UTF-8 is used on most Unix\nplatforms, omitting 'encoding' option when opening UTF-8 files (e.g.\nJSON, YAML, TOML, Markdown) is a very common bug.  For example:\n\n# BUG: \"rb\" mode or encoding=\"utf-8\" should be used.\nwith open(\"data.json\") as f:\ndata = json.load(f)\n",
            "subsections": []
        },
        "To find this type of bug, an optional 'EncodingWarning' is added.  It is": {
            "content": "emitted when *note sys.flags.warndefaultencoding: 458. is true and\nlocale-specific default encoding is used.\n\n'-X warndefaultencoding' option and *note PYTHONWARNDEFAULTENCODING:\n5af. are added to enable the warning.\n\nSee *note Text Encoding: 5b0. for more information.\n\nFile: python3.12.info,  Node: New Features Related to Type Hints<3>,  Next: Other Language Changes<3>,  Prev: New Features<5>,  Up: What's New In Python 3 10\n\n",
            "subsections": []
        },
        "In previous versions of Python, to apply a type hint for functions": {
            "content": "accepting arguments of multiple types, *note typing.Union: 408. was\nused:\n\ndef square(number: Union[int, float]) -> Union[int, float]:\nreturn number  2\n\nType hints can now be written in a more succinct manner:\n\ndef square(number: int | float) -> int | float:\nreturn number  2\n\nThis new syntax is also accepted as the second argument to *note\nisinstance(): 14b. and *note issubclass(): 5b4.:\n\n>>> isinstance(1, int | str)\nTrue\n\nSee *note Union Type: 5b5. and PEP 604(1) for more details.\n\n(Contributed by Maggie Moss and Philippe Prados in bpo-41428(2), with\nadditions by Yurii Karabas and Serhiy Storchaka in bpo-44490(3).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0604/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=41428\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=44490\n\nFile: python3.12.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>\n\n1.3.3.2 PEP 612: Parameter Specification Variables\n..................................................\n",
            "subsections": []
        },
        "Two new options to improve the information provided to static type": {
            "content": "checkers for PEP 484(1)'s 'Callable' have been added to the *note\ntyping: ff. module.\n",
            "subsections": []
        },
        "The first is the parameter specification variable.  They are used to": {
            "content": "forward the parameter types of one callable to another callable - a\npattern commonly found in higher order functions and decorators.\nExamples of usage can be found in *note typing.ParamSpec: 163.",
            "subsections": []
        },
        "Previously, there was no easy way to type annotate dependency of": {
            "content": "parameter types in such a precise manner.\n",
            "subsections": []
        },
        "The second option is the new 'Concatenate' operator.  It's used in": {
            "content": "conjunction with parameter specification variables to type annotate a\nhigher order callable which adds or removes parameters of another\ncallable.  Examples of usage can be found in *note typing.Concatenate:\n5b7.\n\nSee *note typing.Callable: 5b8, *note typing.ParamSpec: 163, *note\ntyping.Concatenate: 5b7, *note typing.ParamSpecArgs: 5b9, *note\ntyping.ParamSpecKwargs: 5ba, and PEP 612(2) for more details.\n\n(Contributed by Ken Jin in bpo-41559(3), with minor enhancements by",
            "subsections": []
        },
        "Jelle Zijlstra in bpo-43783(4).  PEP written by Mark Mendoza.)": {
            "content": "---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0484/\n\n(2) https://peps.python.org/pep-0612/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=41559\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=43783\n\nFile: python3.12.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>\n\n1.3.3.3 PEP 613: TypeAlias\n..........................\n\nPEP 484(1) introduced the concept of type aliases, only requiring them\nto be top-level unannotated assignments.  This simplicity sometimes made\nit difficult for type checkers to distinguish between type aliases and\nordinary assignments, especially when forward references or invalid\ntypes were involved.  Compare:\n\nStrCache = 'Cache[str]'  # a type alias\nLOGPREFIX = 'LOG[DEBUG]'  # a module constant\n\nNow the *note typing: ff. module has a special value 'TypeAlias' which\nlets you declare type aliases more explicitly:\n\nStrCache: TypeAlias = 'Cache[str]'  # a type alias\nLOGPREFIX = 'LOG[DEBUG]'  # a module constant\n\nSee PEP 613(2) for more details.\n\n(Contributed by Mikhail Golubev in bpo-41923(3).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0484/\n\n(2) https://peps.python.org/pep-0613/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=41923\n\nFile: python3.12.info,  Node: PEP 647 User-Defined Type Guards,  Prev: PEP 613 TypeAlias,  Up: New Features Related to Type Hints<3>\n\n1.3.3.4 PEP 647: User-Defined Type Guards\n.........................................\n\n'TypeGuard' has been added to the *note typing: ff. module to annotate\ntype guard functions and improve information provided to static type\ncheckers during type narrowing.  For more information, please see\n'TypeGuard''s documentation, and PEP 647(1).\n\n(Contributed by Ken Jin and Guido van Rossum in bpo-43766(2).  PEP\nwritten by Eric Traut.)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0647/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=43766\n\nFile: python3.12.info,  Node: Other Language Changes<3>,  Next: New Modules<3>,  Prev: New Features Related to Type Hints<3>,  Up: What's New In Python 3 10\n\n\n* The *note int: 17e. type has a new method *note int.bitcount():\n5be, returning the number of ones in the binary expansion of a\ngiven integer, also known as the population count.  (Contributed by\nNiklas Fiekas in bpo-29882(1).)\n\n* The views returned by *note dict.keys(): 5bf, *note dict.values():\n5c0. and *note dict.items(): 5c1. now all have a 'mapping'\nattribute that gives a *note types.MappingProxyType: 186. object\nwrapping the original dictionary.  (Contributed by Dennis Sweeney\nin bpo-40890(2).)\n\n* PEP 618(3): The *note zip(): 5c2. function now has an optional\n'strict' flag, used to require that all the iterables have an equal\nlength.\n\n* Builtin and extension functions that take integer arguments no\nlonger accept *note Decimal: 5c3.s, *note Fraction: 1a8.s and other\nobjects that can be converted to integers only with a loss (e.g.\nthat have the *note int(): 4f0. method but do not have the\n*note index(): 4f1. method).  (Contributed by Serhiy Storchaka\nin bpo-37999(4).)\n\n* If *note object.ipow(): 5c4. returns *note NotImplemented: 5c5,\nthe operator will correctly fall back to *note object.pow():\n5c6. and *note object.rpow(): 5c7. as expected.  (Contributed\nby Alex Shkop in bpo-38302(5).)\n\n* Assignment expressions can now be used unparenthesized within set\nliterals and set comprehensions, as well as in sequence indexes\n(but not slices).\n\n* Functions have a new 'builtins' attribute which is used to look\nfor builtin symbols when a function is executed, instead of looking\ninto 'globals['builtins']'.  The attribute is initialized\nfrom 'globals[\"builtins\"]' if it exists, else from the\ncurrent builtins.  (Contributed by Mark Shannon in bpo-42990(6).)\n\n* Two new builtin functions - *note aiter(): 5c8. and *note anext():\n5c9. have been added to provide asynchronous counterparts to *note\niter(): 5ca. and *note next(): 5cb, respectively.  (Contributed by\nJoshua Bronson, Daniel Pope, and Justin Wang in bpo-31861(7).)\n\n* Static methods (*note @staticmethod: 5cc.) and class methods (*note\n@classmethod: 246.) now inherit the method attributes\n('module', 'name', 'qualname', 'doc',\n'annotations') and have a new 'wrapped' attribute.\nMoreover, static methods are now callable as regular functions.\n(Contributed by Victor Stinner in bpo-43682(8).)\n\n* Annotations for complex targets (everything beside 'simple name'\ntargets defined by PEP 526(9)) no longer cause any runtime effects\nwith 'from future import annotations'.  (Contributed by Batuhan\nTaskaya in bpo-42737(10).)\n\n* Class and module objects now lazy-create empty annotations dicts on\ndemand.  The annotations dicts are stored in the object's\n'dict' for backwards compatibility.  This improves the best\npractices for working with 'annotations'; for more information,\nplease see *note Annotations Best Practices: 5cd.  (Contributed by\nLarry Hastings in bpo-43901(11).)\n\n* Annotations consist of 'yield', 'yield from', 'await' or named\nexpressions are now forbidden under 'from future import\nannotations' due to their side effects.  (Contributed by Batuhan\nTaskaya in bpo-42725(12).)\n\n* Usage of unbound variables, 'super()' and other expressions that\nmight alter the processing of symbol table as annotations are now\nrendered effectless under 'from future import annotations'.\n(Contributed by Batuhan Taskaya in bpo-42725(13).)\n\n* Hashes of NaN values of both *note float: 4b7. type and *note\ndecimal.Decimal: 5c3. type now depend on object identity.\nFormerly, they always hashed to '0' even though NaN values are not\nequal to one another.  This caused potentially quadratic runtime\nbehavior due to excessive hash collisions when creating\ndictionaries and sets containing multiple NaNs.  (Contributed by\nRaymond Hettinger in bpo-43475(14).)\n\n* A *note SyntaxError: 146. (instead of a *note NameError: 144.) will\nbe raised when deleting the *note debug: 5ce. constant.\n(Contributed by Donghee Na in bpo-45000(15).)\n\n* *note SyntaxError: 146. exceptions now have 'endlineno' and\n'endoffset' attributes.  They will be 'None' if not determined.\n(Contributed by Pablo Galindo in bpo-43914(16).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=29882\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=40890\n\n(3) https://peps.python.org/pep-0618/\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=37999\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=38302\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=42990\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=31861\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=43682\n\n(9) https://peps.python.org/pep-0526/\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=42737\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=43901\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=42725\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=42725\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=43475\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=45000\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=43914\n\nFile: python3.12.info,  Node: New Modules<3>,  Next: Improved Modules<3>,  Prev: Other Language Changes<3>,  Up: What's New In Python 3 10\n\n\n* None.\n\nFile: python3.12.info,  Node: Improved Modules<3>,  Next: Optimizations<3>,  Prev: New Modules<3>,  Up: What's New In Python 3 10\n\n\n* Menu:\n\n* asyncio: asyncio<3>.\n* argparse::\n* array: array<2>.\n* asynchat, asyncore, smtpd: asynchat asyncore smtpd.\n* base64::\n* bdb::\n* bisect::\n* codecs::\n* collections.abc: collections abc.\n* contextlib: contextlib<2>.\n* curses::\n* dataclasses: dataclasses<2>.\n* distutils: distutils<2>.\n* doctest::\n* encodings::\n* enum: enum<3>.\n* fileinput::\n* faulthandler::\n* gc::\n* glob::\n* hashlib: hashlib<3>.\n* hmac::\n* IDLE and idlelib: IDLE and idlelib<2>.\n* importlib.metadata: importlib metadata.\n* inspect: inspect<3>.\n* itertools: itertools<2>.\n* linecache::\n* os: os<3>.\n* os.path: os path<3>.\n* pathlib: pathlib<3>.\n* platform::\n* pprint::\n* pycompile::\n* pyclbr::\n* shelve::\n* statistics: statistics<2>.\n* site::\n* socket: socket<2>.\n* ssl: ssl<2>.\n* sqlite3: sqlite3<4>.\n* sys: sys<3>.\n* thread::\n* threading: threading<3>.\n* traceback: traceback<2>.\n* types: types<2>.\n* typing: typing<3>.\n* unittest: unittest<4>.\n* urllib.parse: urllib parse.\n* xml::\n* zipimport: zipimport<2>.\n\nFile: python3.12.info,  Node: asyncio<3>,  Next: argparse,  Up: Improved Modules<3>\n\n1.3.6.1 asyncio\n...............\n",
            "subsections": []
        },
        "Add missing 'connectacceptedsocket()' method.  (Contributed by Alex": {
            "content": "Gro\"nholm in bpo-41332(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=41332\n\nFile: python3.12.info,  Node: argparse,  Next: array<2>,  Prev: asyncio<3>,  Up: Improved Modules<3>\n\n1.3.6.2 argparse\n................\n\nMisleading phrase \"optional arguments\" was replaced with \"options\" in\nargparse help.  Some tests might require adaptation if they rely on\nexact output match.  (Contributed by Raymond Hettinger in bpo-9694(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=9694\n\nFile: python3.12.info,  Node: array<2>,  Next: asynchat asyncore smtpd,  Prev: argparse,  Up: Improved Modules<3>\n\n1.3.6.3 array\n.............\n\nThe *note index(): 5d4. method of *note array.array: 18f. now has\noptional 'start' and 'stop' parameters.  (Contributed by Anders",
            "subsections": []
        },
        "Lorentsen and Zackery Spytz in bpo-31956(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31956\n\nFile: python3.12.info,  Node: asynchat asyncore smtpd,  Next: base64,  Prev: array<2>,  Up: Improved Modules<3>\n\n1.3.6.4 asynchat, asyncore, smtpd\n.................................\n",
            "subsections": []
        },
        "These modules have been marked as deprecated in their module": {
            "content": "documentation since Python 3.6.  An import-time *note",
            "subsections": []
        },
        "DeprecationWarning: 179. has now been added to all three of these": {
            "content": "modules.\n\nFile: python3.12.info,  Node: base64,  Next: bdb,  Prev: asynchat asyncore smtpd,  Up: Improved Modules<3>\n\n1.3.6.5 base64\n..............\n\nAdd *note base64.b32hexencode(): 5d7. and *note base64.b32hexdecode():\n5d8. to support the Base32 Encoding with Extended Hex Alphabet.\n\nFile: python3.12.info,  Node: bdb,  Next: bisect,  Prev: base64,  Up: Improved Modules<3>\n\n1.3.6.6 bdb\n...........\n",
            "subsections": []
        },
        "Add 'clearBreakpoints()' to reset all set breakpoints.  (Contributed by": {
            "content": "",
            "subsections": []
        },
        "Irit Katriel in bpo-24160(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24160\n\nFile: python3.12.info,  Node: bisect,  Next: codecs,  Prev: bdb,  Up: Improved Modules<3>\n\n1.3.6.7 bisect\n..............\n",
            "subsections": []
        },
        "Added the possibility of providing a 'key' function to the APIs in the": {
            "content": "*note bisect: f. module.  (Contributed by Raymond Hettinger in\nbpo-4356(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=4356\n\nFile: python3.12.info,  Node: codecs,  Next: collections abc,  Prev: bisect,  Up: Improved Modules<3>\n\n1.3.6.8 codecs\n..............\n\nAdd a *note codecs.unregister(): 5dc. function to unregister a codec\nsearch function.  (Contributed by Hai Shi in bpo-41842(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=41842\n\nFile: python3.12.info,  Node: collections abc,  Next: contextlib<2>,  Prev: codecs,  Up: Improved Modules<3>\n\n1.3.6.9 collections.abc\n.......................\n\nThe 'args' of the *note parameterized generic: 480. for *note\ncollections.abc.Callable: 5de. are now consistent with *note\ntyping.Callable: 5b8.  *note collections.abc.Callable: 5de. generic now\nflattens type parameters, similar to what *note typing.Callable: 5b8.\ncurrently does.  This means that 'collections.abc.Callable[[int, str],\nstr]' will have 'args' of '(int, str, str)'; previously this was\n'([int, str], str)'.  To allow this change, *note types.GenericAlias:\n5df. can now be subclassed, and a subclass will be returned when\nsubscripting the *note collections.abc.Callable: 5de. type.  Note that a\n*note TypeError: 28e. may be raised for invalid forms of parameterizing\n*note collections.abc.Callable: 5de. which may have passed silently in",
            "subsections": []
        },
        "Python 3.9.  (Contributed by Ken Jin in bpo-42195(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42195\n\nFile: python3.12.info,  Node: contextlib<2>,  Next: curses,  Prev: collections abc,  Up: Improved Modules<3>\n\n1.3.6.10 contextlib\n...................\n\nAdd a *note contextlib.aclosing(): 5e1. context manager to safely close\nasync generators and objects representing asynchronously released\nresources.  (Contributed by Joongi Kim and John Belmonte in\nbpo-41229(1).)\n\nAdd asynchronous context manager support to *note\ncontextlib.nullcontext(): 5e2.  (Contributed by Tom Gringauz in\nbpo-41543(2).)\n",
            "subsections": []
        },
        "Add 'AsyncContextDecorator', for supporting usage of async context": {
            "content": "managers as decorators.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=41229\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=41543\n\nFile: python3.12.info,  Node: curses,  Next: dataclasses<2>,  Prev: contextlib<2>,  Up: Improved Modules<3>\n\n1.3.6.11 curses\n...............\n",
            "subsections": []
        },
        "The extended color functions added in ncurses 6.1 will be used": {
            "content": "transparently by *note curses.colorcontent(): 5e4, *note\ncurses.initcolor(): 5e5, *note curses.initpair(): 5e6, and *note\ncurses.paircontent(): 5e7.  A new function, *note\ncurses.hasextendedcolorsupport(): 5e8, indicates whether extended\ncolor support is provided by the underlying ncurses library.\n(Contributed by Jeffrey Kintscher and Hans Petter Jansson in\nbpo-36982(1).)\n\nThe 'BUTTON5*' constants are now exposed in the *note curses: 29.\nmodule if they are provided by the underlying curses library.\n(Contributed by Zackery Spytz in bpo-39273(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36982\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=39273\n\nFile: python3.12.info,  Node: dataclasses<2>,  Next: distutils<2>,  Prev: curses,  Up: Improved Modules<3>\n\n1.3.6.12 dataclasses\n....................\n\n* Menu:\n\n* slots::\n* Keyword-only fields::\n\nFile: python3.12.info,  Node: slots,  Next: Keyword-only fields,  Up: dataclasses<2>\n\n1.3.6.13 slots\n..................\n\nAdded 'slots' parameter in *note dataclasses.dataclass(): 38d.\ndecorator.  (Contributed by Yurii Karabas in bpo-42269(1))\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42269\n\nFile: python3.12.info,  Node: Keyword-only fields,  Prev: slots,  Up: dataclasses<2>\n\n1.3.6.14 Keyword-only fields\n............................\n\ndataclasses now supports fields that are keyword-only in the generated\ninit method.  There are a number of ways of specifying keyword-only\nfields.\n\nYou can say that every field is keyword-only:\n\nfrom dataclasses import dataclass\n\n@dataclass(kwonly=True)\nclass Birthday:\nname: str\nbirthday: datetime.date\n",
            "subsections": []
        },
        "Both 'name' and 'birthday' are keyword-only parameters to the generated": {
            "content": "init method.\n\nYou can specify keyword-only on a per-field basis:\n\nfrom dataclasses import dataclass, field\n\n@dataclass\nclass Birthday:\nname: str\nbirthday: datetime.date = field(kwonly=True)\n",
            "subsections": []
        },
        "Here only 'birthday' is keyword-only.  If you set 'kwonly' on": {
            "content": "individual fields, be aware that there are rules about re-ordering\nfields due to keyword-only fields needing to follow non-keyword-only\nfields.  See the full dataclasses documentation for details.\n",
            "subsections": []
        },
        "You can also specify that all fields following a KWONLY marker are": {
            "content": "keyword-only.  This will probably be the most common usage:\n\nfrom dataclasses import dataclass, KWONLY\n\n@dataclass\nclass Point:\nx: float\ny: float\n: KWONLY\nz: float = 0.0\nt: float = 0.0\n",
            "subsections": []
        },
        "Here, 'z' and 't' are keyword-only parameters, while 'x' and 'y' are": {
            "content": "not.  (Contributed by Eric V. Smith in bpo-43532(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43532\n\nFile: python3.12.info,  Node: distutils<2>,  Next: doctest,  Prev: dataclasses<2>,  Up: Improved Modules<3>\n\n1.3.6.15 distutils\n..................\n",
            "subsections": []
        },
        "The entire 'distutils' package is deprecated, to be removed in Python": {
            "content": "3.12.  Its functionality for specifying package builds has already been\ncompletely replaced by third-party packages 'setuptools' and\n'packaging', and most other commonly used APIs are available elsewhere\nin the standard library (such as *note platform: a5, *note shutil: c0,\n*note subprocess: d0. or *note sysconfig: d5.).  There are no plans to\nmigrate any other functionality from 'distutils', and applications that\nare using other functions should plan to make private copies of the\ncode.  Refer to PEP 632(1) for discussion.\n\nThe 'bdistwininst' command deprecated in Python 3.8 has been removed.",
            "subsections": []
        },
        "The 'bdistwheel' command is now recommended to distribute binary": {
            "content": "packages on Windows.  (Contributed by Victor Stinner in bpo-42802(2).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0632/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=42802\n\nFile: python3.12.info,  Node: doctest,  Next: encodings,  Prev: distutils<2>,  Up: Improved Modules<3>\n\n1.3.6.16 doctest\n................\n",
            "subsections": []
        },
        "When a module does not define 'loader', fall back to": {
            "content": "'spec.loader'.  (Contributed by Brett Cannon in bpo-42133(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42133\n\nFile: python3.12.info,  Node: socket<2>,  Next: ssl<2>,  Prev: site,  Up: Improved Modules<3>\n\n1.3.6.40 socket\n...............\n\nThe exception *note socket.timeout: 629. is now an alias of *note",
            "subsections": []
        },
        "Ethan Furman in bpo-40066(1).)": {
            "content": "Add *note enum.StrEnum: 3e6. for enums where all members are strings.\n(Contributed by Ethan Furman in bpo-41816(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40066\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=41816\n\nFile: python3.12.info,  Node: fileinput,  Next: faulthandler,  Prev: enum<3>,  Up: Improved Modules<3>\n\n1.3.6.19 fileinput\n..................\n\nAdd 'encoding' and 'errors' parameters in *note fileinput.input(): 5f2.\nand *note fileinput.FileInput: 51b.  (Contributed by Inada Naoki in\nbpo-43712(1).)\n\n*note fileinput.hookcompressed(): 5f3. now returns 'TextIOWrapper'\nobject when 'mode' is \"r\" and file is compressed, like uncompressed\nfiles.  (Contributed by Inada Naoki in bpo-5758(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43712\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=5758\n\nFile: python3.12.info,  Node: faulthandler,  Next: gc,  Prev: fileinput,  Up: Improved Modules<3>\n\n1.3.6.20 faulthandler\n.....................\n\nThe *note faulthandler: 53. module now detects if a fatal error occurs\nduring a garbage collector collection.  (Contributed by Victor Stinner\nin bpo-44466(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=44466\n\nFile: python3.12.info,  Node: gc,  Next: glob,  Prev: faulthandler,  Up: Improved Modules<3>\n\n1.3.6.21 gc\n...........\n\nAdd audit hooks for *note gc.getobjects(): 5f6, *note\ngc.getreferrers(): 5f7. and *note gc.getreferents(): 5f8.\n(Contributed by Pablo Galindo in bpo-43439(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43439\n\nFile: python3.12.info,  Node: glob,  Next: hashlib<3>,  Prev: gc,  Up: Improved Modules<3>\n\n1.3.6.22 glob\n.............\n\nAdd the 'rootdir' and 'dirfd' parameters in *note glob(): 5fa. and\n*note iglob(): 5fb. which allow to specify the root directory for\nsearching.  (Contributed by Serhiy Storchaka in bpo-38144(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38144\n\nFile: python3.12.info,  Node: hashlib<3>,  Next: hmac,  Prev: glob,  Up: Improved Modules<3>\n\n1.3.6.23 hashlib\n................\n",
            "subsections": []
        },
        "The hashlib module requires OpenSSL 1.1.1 or newer.  (Contributed by": {
            "content": "",
            "subsections": []
        },
        "Christian Heimes in PEP 644(1) and bpo-43669(2).)": {
            "content": "",
            "subsections": []
        },
        "Rearrange the settings dialog.  Split the General tab into Windows and": {
            "content": "",
            "subsections": []
        },
        "Shell/Ed tabs.  Move help sources, which extend the Help menu, to the": {
            "content": "",
            "subsections": []
        },
        "Extensions tab.  Make space for new options and shorten the dialog.  The": {
            "content": "latter makes the dialog better fit small screens.  (Contributed by Terry",
            "subsections": []
        },
        "Jan Reedy in bpo-40468(2).)  Move the indent space setting from the Font": {
            "content": "tab to the new Windows tab.  (Contributed by Mark Roseman and Terry Jan",
            "subsections": []
        },
        "Reedy in bpo-33962(3).)": {
            "content": "The changes above were backported to a 3.9 maintenance release.\n\nAdd a Shell sidebar.  Move the primary prompt ('>>>') to the sidebar.",
            "subsections": []
        },
        "Add secondary prompts ('...') to the sidebar.  Left click and optional": {
            "content": "drag selects one or more lines of text, as with the editor line number\nsidebar.  Right click after selecting text lines displays a context menu\nwith 'copy with prompts'.  This zips together prompts from the sidebar\nwith lines from the selected text.  This option also appears on the\ncontext menu for the text.  (Contributed by Tal Einat in bpo-37903(4).)\n",
            "subsections": []
        },
        "Use spaces instead of tabs to indent interactive code.  This makes": {
            "content": "interactive code entries 'look right'.  Making this feasible was a major\nmotivation for adding the shell sidebar.  (Contributed by Terry Jan",
            "subsections": []
        },
        "Reedy in bpo-37892(5).)": {
            "content": "Highlight the new *note soft keywords: 600. *note match: 601, *note\ncase: 601, and *note : 602. in pattern-matching statements.  However,\nthis highlighting is not perfect and will be incorrect in some rare\ncases, including some ''-s in 'case' patterns.  (Contributed by Tal",
            "subsections": []
        },
        "Einat in bpo-44010(6).)": {
            "content": "New in 3.10 maintenance releases.\n",
            "subsections": []
        },
        "Apply syntax highlighting to '.pyi' files.  (Contributed by Alex Waygood": {
            "content": "and Terry Jan Reedy in bpo-45447(7).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=4603\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=38944\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=37765\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=43008\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=40468\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=33962\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=45447\n\nFile: python3.12.info,  Node: imaplib,  Next: importlib<2>,  Prev: IDLE and idlelib<3>,  Up: Improved Modules<4>\n\n1.4.6.14 imaplib\n................\n\n*note IMAP4: 71e. and *note IMAP4SSL: 71f. now have an optional\n'timeout' parameter for their constructors.  Also, the *note open():\n720. method now has an optional 'timeout' parameter with this change.\nThe overridden methods of *note IMAP4SSL: 71f. and *note IMAP4stream:\n721. were applied to this change.  (Contributed by Donghee Na in\nbpo-38615(1).)\n\n*note imaplib.IMAP4.unselect(): 722. is added.  *note\nimaplib.IMAP4.unselect(): 722. frees server's resources associated with\nthe selected mailbox and returns the server to the authenticated state.\nThis command performs the same actions as *note imaplib.IMAP4.close():\n723, except that no messages are permanently removed from the currently\nselected mailbox.  (Contributed by Donghee Na in bpo-40375(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38615\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=40375\n\nFile: python3.12.info,  Node: importlib<2>,  Next: inspect<4>,  Prev: imaplib,  Up: Improved Modules<4>\n\n1.4.6.15 importlib\n..................\n\nTo improve consistency with import statements, *note\nimportlib.util.resolvename(): 725. now raises *note ImportError: 145.\ninstead of *note ValueError: 183. for invalid relative import attempts.\n(Contributed by Ngalim Siregar in bpo-37444(1).)\n",
            "subsections": []
        },
        "Include prompts when saving Shell with inputs and outputs.  (Contributed": {
            "content": "by Terry Jan Reedy in gh-95191(8).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43008\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=40468\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=33962\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=37903\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=37892\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=44010\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=45447\n\n(8) https://github.com/python/cpython/issues/95191\n\nFile: python3.12.info,  Node: importlib metadata,  Next: inspect<3>,  Prev: IDLE and idlelib<2>,  Up: Improved Modules<3>\n\n1.3.6.26 importlib.metadata\n...........................\n\nFeature parity with 'importlibmetadata' 4.6 (history(1)).\n\n*note importlib.metadata entry points: 604. now provide a nicer\nexperience for selecting entry points by group and name through a new\n'importlib.metadata.EntryPoints' class.  See the Compatibility Note in\nthe docs for more info on the deprecation and usage.\n",
            "subsections": []
        },
        "Added 'importlib.metadata.packagesdistributions()' for resolving": {
            "content": "top-level Python modules and packages to their\n'importlib.metadata.Distribution'.\n\n---------- Footnotes ----------\n\n(1) https://importlib-metadata.readthedocs.io/en/latest/history.html\n\nFile: python3.12.info,  Node: inspect<3>,  Next: itertools<2>,  Prev: importlib metadata,  Up: Improved Modules<3>\n\n1.3.6.27 inspect\n................\n",
            "subsections": []
        },
        "Peixing Xin in bpo-41440(1).)": {
            "content": "Add a new function *note os.eventfd(): 60c. and related helpers to wrap\nthe 'eventfd2' syscall on Linux.  (Contributed by Christian Heimes in\nbpo-41001(2).)\n\nAdd *note os.splice(): 60d. that allows to move data between two file\ndescriptors without copying between kernel address space and user\naddress space, where one of the file descriptors must refer to a pipe.\n(Contributed by Pablo Galindo in bpo-41625(3).)\n\nAdd *note OEVTONLY: 60e, *note OFSYNC: 60f, *note OSYMLINK: 610. and\n*note ONOFOLLOWANY: 611. for macOS. (Contributed by Donghee Na in\nbpo-43106(4).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=41440\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=41001\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=41625\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=43106\n\nFile: python3.12.info,  Node: os path<3>,  Next: pathlib<3>,  Prev: os<3>,  Up: Improved Modules<3>\n\n1.3.6.31 os.path\n................\n\n*note os.path.realpath(): 351. now accepts a 'strict' keyword-only\nargument.  When set to 'True', *note OSError: 613. is raised if a path\ndoesn't exist or a symlink loop is encountered.  (Contributed by Barney",
            "subsections": []
        },
        "Gale in bpo-43757(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43757\n\nFile: python3.12.info,  Node: pathlib<3>,  Next: platform,  Prev: os path<3>,  Up: Improved Modules<3>\n\n1.3.6.32 pathlib\n................\n\nAdd slice support to *note PurePath.parents: 615.  (Contributed by",
            "subsections": []
        },
        "Joshua Cannon in bpo-35498(1).)": {
            "content": "Add negative indexing support to *note PurePath.parents: 615.\n(Contributed by Yaroslav Pankovych in bpo-21041(2).)\n\nAdd *note Path.hardlinkto: 616. method that supersedes 'linkto()'.\nThe new method has the same argument order as *note symlinkto(): 617.\n(Contributed by Barney Gale in bpo-39950(3).)\n\n*note pathlib.Path.stat(): 618. and *note chmod(): 619. now accept a\n'followsymlinks' keyword-only argument for consistency with\ncorresponding functions in the *note os: 9c. module.  (Contributed by",
            "subsections": []
        },
        "Barney Gale in bpo-39906(4).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=35498\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=21041\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=39950\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=39906\n\nFile: python3.12.info,  Node: platform,  Next: pprint,  Prev: pathlib<3>,  Up: Improved Modules<3>\n\n1.3.6.33 platform\n.................\n\nAdd *note platform.freedesktoposrelease(): 61b. to retrieve operation\nsystem identification from freedesktop.org os-release(1) standard file.\n(Contributed by Christian Heimes in bpo-28468(2).)\n\n---------- Footnotes ----------\n\n(1) https://www.freedesktop.org/software/systemd/man/os-release.html\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=28468\n\nFile: python3.12.info,  Node: pprint,  Next: pycompile,  Prev: platform,  Up: Improved Modules<3>\n\n1.3.6.34 pprint\n...............\n\n*note pprint.pprint(): 61d. now accepts a new 'underscorenumbers'\nkeyword argument.  (Contributed by sblondon in bpo-42914(1).)\n\n*note pprint: a9. can now pretty-print *note dataclasses.dataclass: 38d.\ninstances.  (Contributed by Lewis Gaul in bpo-43080(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42914\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=43080\n\nFile: python3.12.info,  Node: pycompile,  Next: pyclbr,  Prev: pprint,  Up: Improved Modules<3>\n\n1.3.6.35 pycompile\n...................\n\nAdd '--quiet' option to command-line interface of *note pycompile: ae.\n(Contributed by Gregory Schevchenko in bpo-38731(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38731\n\nFile: python3.12.info,  Node: pyclbr,  Next: shelve,  Prev: pycompile,  Up: Improved Modules<3>\n\n1.3.6.36 pyclbr\n...............\n",
            "subsections": []
        },
        "Add an 'endlineno' attribute to the 'Function' and 'Class' objects in": {
            "content": "the tree returned by *note pyclbr.readmodule(): 620. and *note\npyclbr.readmoduleex(): 621.  It matches the existing (start) 'lineno'.\n(Contributed by Aviral Srivastava in bpo-38307(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38307\n\nFile: python3.12.info,  Node: shelve,  Next: statistics<2>,  Prev: pyclbr,  Up: Improved Modules<3>\n\n1.3.6.37 shelve\n...............\n\nThe *note shelve: be. module now uses *note pickle.DEFAULTPROTOCOL:\n623. by default instead of *note pickle: a1. protocol '3' when creating\nshelves.  (Contributed by Zackery Spytz in bpo-34204(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=34204\n\nFile: python3.12.info,  Node: statistics<2>,  Next: site,  Prev: shelve,  Up: Improved Modules<3>\n\n1.3.6.38 statistics\n...................\n\nAdd *note covariance(): 625, Pearson's *note correlation(): 1e0, and\nsimple *note linearregression(): 626. functions.  (Contributed by\nTymoteusz Wo??od??ko in bpo-38490(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38490\n\nFile: python3.12.info,  Node: site,  Next: socket<2>,  Prev: statistics<2>,  Up: Improved Modules<3>\n\n1.3.6.39 site\n.............\n",
            "subsections": []
        },
        "TimeoutError: 62a.  (Contributed by Christian Heimes in bpo-42413(1).)": {
            "content": "",
            "subsections": []
        },
        "Add option to create MPTCP sockets with 'IPPROTOMPTCP' (Contributed by": {
            "content": "",
            "subsections": []
        },
        "Rui Cunha in bpo-43571(2).)": {
            "content": "",
            "subsections": []
        },
        "Add 'IPRECVTOS' option to receive the type of service (ToS) or DSCP/ECN": {
            "content": "fields (Contributed by Georg Sauthoff in bpo-44077(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42413\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=43571\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=44077\n\nFile: python3.12.info,  Node: ssl<2>,  Next: sqlite3<4>,  Prev: socket<2>,  Up: Improved Modules<3>\n\n1.3.6.41 ssl\n............\n",
            "subsections": []
        },
        "The ssl module requires OpenSSL 1.1.1 or newer.  (Contributed by": {
            "content": "",
            "subsections": []
        },
        "The ssl module has preliminary support for OpenSSL 3.0.0 and new option": {
            "content": "*note OPIGNOREUNEXPECTEDEOF: 62c.  (Contributed by Christian Heimes\nin bpo-38820(3), bpo-43794(4), bpo-43788(5), bpo-43791(6), bpo-43799(7),\nbpo-43920(8), bpo-43789(9), and bpo-43811(10).)\n",
            "subsections": []
        },
        "Deprecated function and use of deprecated constants now result in a": {
            "content": "*note DeprecationWarning: 179.  *note ssl.SSLContext.options: 62d. has\n*note OPNOSSLv2: 62e. and *note OPNOSSLv3: 62f. set by default and\ntherefore cannot warn about setting the flag again.  The *note\ndeprecation section: 630. has a list of deprecated features.\n(Contributed by Christian Heimes in bpo-43880(11).)\n",
            "subsections": []
        },
        "The ssl module now has more secure default settings.  Ciphers without": {
            "content": "forward secrecy or SHA-1 MAC are disabled by default.  Security level 2\nprohibits weak RSA, DH, and ECC keys with less than 112 bits of\nsecurity.  *note SSLContext: 278. defaults to minimum protocol version\nTLS 1.2.  Settings are based on Hynek Schlawack's research.\n(Contributed by Christian Heimes in bpo-43998(12).)\n",
            "subsections": []
        },
        "The deprecated protocols SSL 3.0, TLS 1.0, and TLS 1.1 are no longer": {
            "content": "officially supported.  Python does not block them actively.  However",
            "subsections": []
        },
        "OpenSSL build options, distro configurations, vendor patches, and cipher": {
            "content": "suites may prevent a successful handshake.\n\nAdd a 'timeout' parameter to the *note ssl.getservercertificate():\n631. function.  (Contributed by Zackery Spytz in bpo-31870(13).)\n\nThe ssl module uses heap-types and multi-phase initialization.\n(Contributed by Christian Heimes in bpo-42333(14).)\n\nA new verify flag *note VERIFYX509PARTIALCHAIN: 632. has been added.\n(Contributed by l0x in bpo-40849(15).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0644/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=43669\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=38820\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=43794\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=43788\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=43791\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=43799\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=43920\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=43789\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=43811\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=43880\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=43998\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=31870\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=42333\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=40849\n\nFile: python3.12.info,  Node: sqlite3<4>,  Next: sys<3>,  Prev: ssl<2>,  Up: Improved Modules<3>\n\n1.3.6.42 sqlite3\n................\n\nAdd audit events for 'connect/handle()', *note enableloadextension():\n634, and *note loadextension(): 1dc.  (Contributed by Erlend E. Aasland\nin bpo-43762(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43762\n\nFile: python3.12.info,  Node: sys<3>,  Next: thread,  Prev: sqlite3<4>,  Up: Improved Modules<3>\n\n1.3.6.43 sys\n............\n\nAdd *note sys.origargv: 636. attribute: the list of the original\ncommand line arguments passed to the Python executable.  (Contributed by",
            "subsections": []
        },
        "Victor Stinner in bpo-23427(1).)": {
            "content": "Add *note sys.stdlibmodulenames: 637, containing the list of the\nstandard library module names.  (Contributed by Victor Stinner in\nbpo-42955(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23427\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=42955\n\nFile: python3.12.info,  Node: thread,  Next: threading<3>,  Prev: sys<3>,  Up: Improved Modules<3>\n\n1.3.6.44 thread\n................\n\n*note thread.interruptmain(): 639. now takes an optional signal number\nto simulate (the default is still *note signal.SIGINT: 63a.).\n(Contributed by Antoine Pitrou in bpo-43356(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43356\n\nFile: python3.12.info,  Node: threading<3>,  Next: traceback<2>,  Prev: thread,  Up: Improved Modules<3>\n\n1.3.6.45 threading\n..................\n\nAdd *note threading.gettrace(): 63c. and *note threading.getprofile():\n63d. to retrieve the functions set by *note threading.settrace(): 63e.\nand *note threading.setprofile(): 63f. respectively.  (Contributed by",
            "subsections": []
        },
        "Mario Corchero in bpo-42251(1).)": {
            "content": "Add *note threading.excepthook: 640. to allow retrieving the\noriginal value of *note threading.excepthook(): 641. in case it is set\nto a broken or a different value.  (Contributed by Mario Corchero in\nbpo-42308(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42251\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=42308\n\nFile: python3.12.info,  Node: traceback<2>,  Next: types<2>,  Prev: threading<3>,  Up: Improved Modules<3>\n\n1.3.6.46 traceback\n..................\n\nThe *note formatexception(): 643, *note formatexceptiononly(): 644,\nand *note printexception(): 645. functions can now take an exception\nobject as a positional-only argument.  (Contributed by Zackery Spytz and",
            "subsections": []
        },
        "Matthias Bussonnier in bpo-26389(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26389\n\nFile: python3.12.info,  Node: types<2>,  Next: typing<3>,  Prev: traceback<2>,  Up: Improved Modules<3>\n\n1.3.6.47 types\n..............\n\nReintroduce the *note types.EllipsisType: 647, *note types.NoneType:\n648. and *note types.NotImplementedType: 649. classes, providing a new\nset of types readily interpretable by type checkers.  (Contributed by",
            "subsections": []
        },
        "Bas van Beek in bpo-41810(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=41810\n\nFile: python3.12.info,  Node: typing<3>,  Next: unittest<4>,  Prev: types<2>,  Up: Improved Modules<3>\n\n1.3.6.48 typing\n...............\n\nFor major changes, see *note New Features Related to Type Hints: 5b1.\n\nThe behavior of *note typing.Literal: 64b. was changed to conform with\nPEP 586(1) and to match the behavior of static type checkers specified\nin the PEP.\n\n1. 'Literal' now de-duplicates parameters.\n\n2. Equality comparisons between 'Literal' objects are now order\nindependent.\n\n3. 'Literal' comparisons now respect types.  For example, 'Literal[0]\n== Literal[False]' previously evaluated to 'True'.  It is now\n'False'.  To support this change, the internally used type cache\nnow supports differentiating types.\n\n4. 'Literal' objects will now raise a *note TypeError: 28e. exception\nduring equality comparisons if any of their parameters are not\n*note hashable: 3db.  Note that declaring 'Literal' with unhashable\nparameters will not throw an error:\n\n>>> from typing import Literal\n>>> Literal[{0}]\n>>> Literal[{0}] == Literal[{False}]\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nTypeError: unhashable type: 'set'\n\n(Contributed by Yurii Karabas in bpo-42345(2).)\n\nAdd new function *note typing.istypeddict(): 64c. to introspect if an\nannotation is a *note typing.TypedDict: 153.  (Contributed by Patrick",
            "subsections": []
        },
        "Reader in bpo-41792(3).)": {
            "content": "",
            "subsections": []
        },
        "Subclasses of 'typing.Protocol' which only have data variables declared": {
            "content": "will now raise a 'TypeError' when checked with 'isinstance' unless they\nare decorated with 'runtimecheckable()'.  Previously, these checks\npassed silently.  Users should decorate their subclasses with the\n'runtimecheckable()' decorator if they want runtime protocols.\n(Contributed by Yurii Karabas in bpo-38908(4).)\n",
            "subsections": []
        },
        "Importing from the 'typing.io' and 'typing.re' submodules will now emit": {
            "content": "*note DeprecationWarning: 179.  These submodules have been deprecated\nsince Python 3.8 and will be removed in a future version of Python.",
            "subsections": []
        },
        "Anything belonging to those submodules should be imported directly from": {
            "content": "*note typing: ff. instead.  (Contributed by Sebastian Rittau in\nbpo-38291(5).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0586/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=42345\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=41792\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=38908\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=38291\n\nFile: python3.12.info,  Node: unittest<4>,  Next: urllib parse,  Prev: typing<3>,  Up: Improved Modules<3>\n\n1.3.6.49 unittest\n.................\n\nAdd new method *note assertNoLogs(): 64e. to complement the existing\n*note assertLogs(): 64f.  (Contributed by Kit Yan Choi in bpo-39385(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39385\n\nFile: python3.12.info,  Node: urllib parse,  Next: xml,  Prev: unittest<4>,  Up: Improved Modules<3>\n\n1.3.6.50 urllib.parse\n.....................\n\nPython versions earlier than Python 3.10 allowed using both ';' and '&'\nas query parameter separators in *note urllib.parse.parseqs(): 651. and\n*note urllib.parse.parseqsl(): 652.  Due to security concerns, and to\nconform with newer W3C recommendations, this has been changed to allow\nonly a single separator key, with '&' as the default.  This change also\naffects *note cgi.parse(): 653. and *note cgi.parsemultipart(): 654. as\nthey use the affected functions internally.  For more details, please\nsee their respective documentation.  (Contributed by Adam Goldschmidt,",
            "subsections": []
        },
        "Senthil Kumaran and Ken Jin in bpo-42967(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42967\n",
            "subsections": []
        },
        "The presence of newline or tab characters in parts of a URL allows for": {
            "content": "some forms of attacks.  Following the WHATWG specification that updates\nRFC 3986, ASCII newline '\\n', '\\r' and tab '\\t' characters are stripped\nfrom the URL by the parser *note urllib.parse(): 105. preventing such\nattacks.  The removal characters are controlled by a new module level\nvariable 'urllib.parse.UNSAFEURLBYTESTOREMOVE'.  (See gh-88048(2))\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/87451\n\n(2) https://github.com/python/cpython/issues/88048\n",
            "subsections": []
        },
        "Cheong in bpo-14678(3).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0451/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=42131\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=14678\n\nFile: python3.12.info,  Node: Optimizations<3>,  Next: Deprecated<5>,  Prev: Improved Modules<3>,  Up: What's New In Python 3 10\n\n\n* Constructors *note str(): 157, *note bytes(): 295. and *note\nbytearray(): 294. are now faster (around 30-40% for small objects).\n(Contributed by Serhiy Storchaka in bpo-41334(1).)\n\n* The *note runpy: b9. module now imports fewer modules.  The\n'python3 -m module-name' command startup time is 1.4x faster in\naverage.  On Linux, 'python3 -I -m module-name' imports 69 modules\non Python 3.9, whereas it only imports 51 modules (-18) on Python\n3.10.  (Contributed by Victor Stinner in bpo-41006(2) and\nbpo-41718(3).)\n\n* The 'LOADATTR' instruction now uses new \"per opcode cache\"\nmechanism.  It is about 36% faster now for regular attributes and\n44% faster for slots.  (Contributed by Pablo Galindo and Yury\nSelivanov in bpo-42093(4) and Guido van Rossum in bpo-42927(5),\nbased on ideas implemented originally in PyPy and MicroPython.)\n\n* When building Python with *note -enable-optimizations: 65d. now\n'-fno-semantic-interposition' is added to both the compile and link\nline.  This speeds builds of the Python interpreter created with\n*note -enable-shared: 65e. with 'gcc' by up to 30%.  See this\narticle(6) for more details.  (Contributed by Victor Stinner and\nPablo Galindo in bpo-38980(7).)\n\n* Use a new output buffer management code for *note bz2: 11. / *note\nlzma: 85. / *note zlib: 12d. modules, and add '.readall()' function\nto 'compression.DecompressReader' class.  bz2 decompression is now\n1.09x ~ 1.17x faster, lzma decompression 1.20x ~ 1.32x faster,\n'GzipFile.read(-1)' 1.11x ~ 1.18x faster.  (Contributed by Ma Lin,\nreviewed by Gregory P. Smith, in bpo-41486(8))\n\n* When using stringized annotations, annotations dicts for functions\nare no longer created when the function is created.  Instead, they\nare stored as a tuple of strings, and the function object lazily\nconverts this into the annotations dict on demand.  This\noptimization cuts the CPU time needed to define an annotated\nfunction by half.  (Contributed by Yurii Karabas and Inada Naoki in\nbpo-42202(9).)\n\n* Substring search functions such as 'str1 in str2' and\n'str2.find(str1)' now sometimes use Crochemore & Perrin's \"Two-Way\"\nstring searching algorithm to avoid quadratic behavior on long\nstrings.  (Contributed by Dennis Sweeney in bpo-41972(10))\n\n* Add micro-optimizations to 'PyTypeLookup()' to improve type\nattribute cache lookup performance in the common case of cache\nhits.  This makes the interpreter 1.04 times faster on average.\n(Contributed by Dino Viehland in bpo-43452(11).)\n\n* The following built-in functions now support the faster PEP 590(12)\nvectorcall calling convention: *note map(): 65f, *note filter():\n660, *note reversed(): 661, *note bool(): 17d. and *note float():\n4b7.  (Contributed by Donghee Na and Jeroen Demeyer in\nbpo-43575(13), bpo-43287(14), bpo-41922(15), bpo-41873(16) and\nbpo-41870(17).)\n\n* 'BZ2File' performance is improved by removing internal 'RLock'.\nThis makes 'BZ2File' thread unsafe in the face of multiple\nsimultaneous readers or writers, just like its equivalent classes\nin *note gzip: 62. and *note lzma: 85. have always been.\n(Contributed by Inada Naoki in bpo-43785(18).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=41334\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=41006\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=41718\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=42093\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=42927\n\n(6)\nhttps://developers.redhat.com/blog/2020/06/25/red-hat-enterprise-linux-8-2-brings-faster-python-3-8-run-speeds/\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=38980\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=41486\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=42202\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=41972\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=43452\n\n(12) https://peps.python.org/pep-0590/\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=43575\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=43287\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=41922\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=41873\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=41870\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=43785\n\nFile: python3.12.info,  Node: Deprecated<5>,  Next: Removed<5>,  Prev: Optimizations<3>,  Up: What's New In Python 3 10\n\n\n* Currently Python accepts numeric literals immediately followed by\nkeywords, for example '0in x', '1or x', '0if 1else 2'.  It allows\nconfusing and ambiguous expressions like '[0x1for x in y]' (which\ncan be interpreted as '[0x1 for x in y]' or '[0x1f or x in y]').\nStarting in this release, a deprecation warning is raised if the\nnumeric literal is immediately followed by one of keywords *note\nand: 24c, *note else: 24d, *note for: 24e, *note if: 24f, *note in:\n250, *note is: 251. and *note or: 252.  In future releases it will\nbe changed to syntax warning, and finally to syntax error.\n(Contributed by Serhiy Storchaka in bpo-43833(1).)\n\n* Starting in this release, there will be a concerted effort to begin\ncleaning up old import semantics that were kept for Python 2.7\ncompatibility.  Specifically, 'findloader()'/'findmodule()'\n(superseded by 'findspec()'), *note loadmodule(): 663.\n(superseded by *note execmodule(): 664.), 'modulerepr()' (which\nthe import system takes care of for you), the 'package'\nattribute (superseded by 'spec.parent'), the 'loader'\nattribute (superseded by 'spec.loader'), and the 'cached'\nattribute (superseded by 'spec.cached') will slowly be removed\n(as well as other classes and methods in *note importlib: 71.).\n*note ImportWarning: 243. and/or *note DeprecationWarning: 179.\nwill be raised as appropriate to help identify code which needs\nupdating during this transition.\n\n* The entire 'distutils' namespace is deprecated, to be removed in\nPython 3.12.  Refer to the *note module changes: 50d. section for\nmore information.\n\n* Non-integer arguments to *note random.randrange(): 665. are\ndeprecated.  The *note ValueError: 183. is deprecated in favor of a\n*note TypeError: 28e.  (Contributed by Serhiy Storchaka and Raymond\nHettinger in bpo-37319(2).)\n\n* The various 'loadmodule()' methods of *note importlib: 71. have\nbeen documented as deprecated since Python 3.6, but will now also\ntrigger a *note DeprecationWarning: 179.  Use *note execmodule():\n664. instead.  (Contributed by Brett Cannon in bpo-26131(3).)\n\n* 'zimport.zipimporter.loadmodule()' has been deprecated in\npreference for *note execmodule(): 65a.  (Contributed by Brett\nCannon in bpo-26131(4).)\n\n* The use of *note loadmodule(): 663. by the import system now\ntriggers an *note ImportWarning: 243. as *note execmodule(): 664.\nis preferred.  (Contributed by Brett Cannon in bpo-26131(5).)\n\n* The use of 'importlib.abc.MetaPathFinder.findmodule()' and\n'importlib.abc.PathEntryFinder.findmodule()' by the import system\nnow trigger an *note ImportWarning: 243. as *note\nimportlib.abc.MetaPathFinder.findspec(): 666. and *note\nimportlib.abc.PathEntryFinder.findspec(): 667. are preferred,\nrespectively.  You can use *note importlib.util.specfromloader():\n668. to help in porting.  (Contributed by Brett Cannon in\nbpo-42134(6).)\n\n* The use of 'importlib.abc.PathEntryFinder.findloader()' by the\nimport system now triggers an *note ImportWarning: 243. as *note\nimportlib.abc.PathEntryFinder.findspec(): 667. is preferred.  You\ncan use *note importlib.util.specfromloader(): 668. to help in\nporting.  (Contributed by Brett Cannon in bpo-43672(7).)\n\n* The various implementations of\n'importlib.abc.MetaPathFinder.findmodule()' (\n'importlib.machinery.BuiltinImporter.findmodule()',\n'importlib.machinery.FrozenImporter.findmodule()',\n'importlib.machinery.WindowsRegistryFinder.findmodule()',\n'importlib.machinery.PathFinder.findmodule()',\n'importlib.abc.MetaPathFinder.findmodule()' ),\n'importlib.abc.PathEntryFinder.findmodule()' (\n'importlib.machinery.FileFinder.findmodule()' ), and\n'importlib.abc.PathEntryFinder.findloader()' (\n'importlib.machinery.FileFinder.findloader()' ) now raise *note\nDeprecationWarning: 179. and are slated for removal in Python 3.12\n(previously they were documented as deprecated in Python 3.4).\n(Contributed by Brett Cannon in bpo-42135(8).)\n\n* 'importlib.abc.Finder' is deprecated (including its sole method,\n'findmodule()').  Both *note importlib.abc.MetaPathFinder: 669.\nand *note importlib.abc.PathEntryFinder: 66a. no longer inherit\nfrom the class.  Users should inherit from one of these two classes\nas appropriate instead.  (Contributed by Brett Cannon in\nbpo-42135(9).)\n\n* The deprecations of 'imp', 'importlib.findloader()',\n'importlib.util.setpackagewrapper()',\n'importlib.util.setloaderwrapper()',\n'importlib.util.moduleforloader()', 'pkgutil.ImpImporter', and\n'pkgutil.ImpLoader' have all been updated to list Python 3.12 as\nthe slated version of removal (they began raising *note\nDeprecationWarning: 179. in previous versions of Python).\n(Contributed by Brett Cannon in bpo-43720(10).)\n\n* The import system now uses the 'spec' attribute on modules\nbefore falling back on 'modulerepr()' for a module's 'repr()'\nmethod.  Removal of the use of 'modulerepr()' is scheduled for\nPython 3.12.  (Contributed by Brett Cannon in bpo-42137(11).)\n\n* 'importlib.abc.Loader.modulerepr()',\n'importlib.machinery.FrozenLoader.modulerepr()', and\n'importlib.machinery.BuiltinLoader.modulerepr()' are deprecated\nand slated for removal in Python 3.12.  (Contributed by Brett\nCannon in bpo-42136(12).)\n\n* 'sqlite3.OptimizedUnicode' has been undocumented and obsolete since\nPython 3.3, when it was made an alias to *note str: 157.  It is now\ndeprecated, scheduled for removal in Python 3.12.  (Contributed by\nErlend E. Aasland in bpo-42264(13).)\n\n* The undocumented built-in function 'sqlite3.enablesharedcache' is\nnow deprecated, scheduled for removal in Python 3.12.  Its use is\nstrongly discouraged by the SQLite3 documentation.  See the SQLite3\ndocs(14) for more details.  If a shared cache must be used, open\nthe database in URI mode using the 'cache=shared' query parameter.\n(Contributed by Erlend E. Aasland in bpo-24464(15).)\n\n* The following 'threading' methods are now deprecated:\n\n* 'threading.currentThread' => *note threading.currentthread():\n66b.\n\n* 'threading.activeCount' => *note threading.activecount():\n66c.\n\n* 'threading.Condition.notifyAll' => *note\nthreading.Condition.notifyall(): 66d.\n\n* 'threading.Event.isSet' => *note threading.Event.isset():\n66e.\n\n* 'threading.Thread.setName' => *note threading.Thread.name:\n66f.\n\n* 'threading.thread.getName' => *note threading.Thread.name:\n66f.\n\n* 'threading.Thread.isDaemon' => *note threading.Thread.daemon:\n670.\n\n* 'threading.Thread.setDaemon' => *note threading.Thread.daemon:\n670.\n\n(Contributed by Jelle Zijlstra in gh-87889(16).)\n\n* 'pathlib.Path.linkto()' is deprecated and slated for removal in\nPython 3.12.  Use *note pathlib.Path.hardlinkto(): 616. instead.\n(Contributed by Barney Gale in bpo-39950(17).)\n\n* 'cgi.log()' is deprecated and slated for removal in Python 3.12.\n(Contributed by Inada Naoki in bpo-41139(18).)\n\n* The following *note ssl: ca. features have been deprecated since\nPython 3.6, Python 3.7, or OpenSSL 1.1.0 and will be removed in\n3.11:\n\n* *note OPNOSSLv2: 62e, *note OPNOSSLv3: 62f, *note\nOPNOTLSv1: 671, *note OPNOTLSv11: 672, *note\nOPNOTLSv12: 673, and *note OPNOTLSv13: 674. are replaced\nby 'sslSSLContext.minimumversion' and\n'sslSSLContext.maximumversion'.\n\n* 'PROTOCOLSSLv2', *note PROTOCOLSSLv3: 675, *note\nPROTOCOLSSLv23: 676, *note PROTOCOLTLSv1: 677, *note\nPROTOCOLTLSv11: 678, *note PROTOCOLTLSv12: 679, and *note\nPROTOCOLTLS: 67a. are deprecated in favor of *note\nPROTOCOLTLSCLIENT: 67b. and *note PROTOCOLTLSSERVER: 67c.\n\n* 'wrapsocket()' is replaced by *note\nssl.SSLContext.wrapsocket(): 279.\n\n* 'matchhostname()'\n\n* 'RANDpseudobytes()', 'RANDegd()'\n\n* NPN features like *note ssl.SSLSocket.selectednpnprotocol():\n67d. and *note ssl.SSLContext.setnpnprotocols(): 67e. are\nreplaced by ALPN.\n\n* The threading debug ('PYTHONTHREADDEBUG' environment variable) is\ndeprecated in Python 3.10 and will be removed in Python 3.12.  This\nfeature requires a *note debug build of Python: 67f.  (Contributed\nby Victor Stinner in bpo-44584(19).)\n\n* Importing from the 'typing.io' and 'typing.re' submodules will now\nemit *note DeprecationWarning: 179.  These submodules will be\nremoved in a future version of Python.  Anything belonging to these\nsubmodules should be imported directly from *note typing: ff.\ninstead.  (Contributed by Sebastian Rittau in bpo-38291(20).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43833\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=37319\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=26131\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=26131\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=26131\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=42134\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=43672\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=42135\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=42135\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=43720\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=42137\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=42136\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=42264\n\n(14) https://sqlite.org/c3ref/enablesharedcache.html\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=24464\n\n(16) https://github.com/python/cpython/issues/87889\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=39950\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=41139\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=44584\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=38291\n\nFile: python3.12.info,  Node: Removed<5>,  Next: Porting to Python 3 10,  Prev: Deprecated<5>,  Up: What's New In Python 3 10\n\n\n* Removed special methods 'int', 'float', 'floordiv',\n'mod', 'divmod', 'rfloordiv', 'rmod' and\n'rdivmod' of the *note complex: 3ad. class.  They always raised\na *note TypeError: 28e.  (Contributed by Serhiy Storchaka in\nbpo-41974(1).)\n\n* The 'ParserBase.error()' method from the private and undocumented\n'markupbase' module has been removed.  *note\nhtml.parser.HTMLParser: 682. is the only subclass of 'ParserBase'\nand its 'error()' implementation was already removed in Python 3.5.\n(Contributed by Berker Peksag in bpo-31844(2).)\n\n* Removed the 'unicodedata.ucnhashCAPI' attribute which was an\ninternal PyCapsule object.  The related private\n'PyUnicodeNameCAPI' structure was moved to the internal C API.\n(Contributed by Victor Stinner in bpo-42157(3).)\n\n* Removed the 'parser' module, which was deprecated in 3.9 due to the\nswitch to the new PEG parser, as well as all the C source and\nheader files that were only being used by the old parser, including\n'node.h', 'parser.h', 'graminit.h' and 'grammar.h'.\n\n* Removed the Public C API functions\n'PyParserSimpleParseStringFlags',\n'PyParserSimpleParseStringFlagsFilename',\n'PyParserSimpleParseFileFlags' and 'PyNodeCompile' that were\ndeprecated in 3.9 due to the switch to the new PEG parser.\n\n* Removed the 'formatter' module, which was deprecated in Python 3.4.\nIt is somewhat obsolete, little used, and not tested.  It was\noriginally scheduled to be removed in Python 3.6, but such removals\nwere delayed until after Python 2.7 EOL. Existing users should copy\nwhatever classes they use into their code.  (Contributed by Donghee\nNa and Terry J. Reedy in bpo-42299(4).)\n\n* Removed the 'PyModuleGetWarningsModule()' function that was\nuseless now due to the 'warnings' module was converted to a\nbuiltin module in 2.6.  (Contributed by Hai Shi in bpo-42599(5).)\n\n* Remove deprecated aliases to *note Collections Abstract Base\nClasses: 683. from the *note collections: 1b. module.  (Contributed\nby Victor Stinner in bpo-37324(6).)\n\n* The 'loop' parameter has been removed from most of *note asyncio:\n9.'s *note high-level API: 684. following deprecation in Python\n3.8.  The motivation behind this change is multifold:\n\n1. This simplifies the high-level API.\n\n2. The functions in the high-level API have been implicitly\ngetting the current thread's running event loop since Python\n3.7.  There isn't a need to pass the event loop to the API in\nmost normal use cases.\n\n3. Event loop passing is error-prone especially when dealing with\nloops running in different threads.\n\nNote that the low-level API will still accept 'loop'.  See *note\nChanges in the Python API: 685. for examples of how to replace\nexisting code.\n\n(Contributed by Yurii Karabas, Andrew Svetlov, Yury Selivanov and\nKyle Stanley in bpo-42392(7).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=41974\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31844\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=42157\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=42299\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=42599\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=37324\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=42392\n\nFile: python3.12.info,  Node: Porting to Python 3 10,  Next: CPython bytecode changes<3>,  Prev: Removed<5>,  Up: What's New In Python 3 10\n\n",
            "subsections": []
        },
        "The Stable ABI (Application Binary Interface) for extension modules or": {
            "content": "embedding Python is now explicitly defined.  *note C API Stability: 2ac.\ndescribes C API and ABI stability guarantees along with best practices\nfor using the Stable ABI.\n\n(Contributed by Petr Viktorin in PEP 652(1) and bpo-43795(2).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0652/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=43795\n\nFile: python3.12.info,  Node: New Features<6>,  Next: Porting to Python 3 10<2>,  Prev: PEP 652 Maintaining the Stable ABI,  Up: C API Changes<3>\n\n1.3.13.2 New Features\n.....................\n\n* The result of *note PyNumberIndex(): 6a1. now always has exact\ntype *note int: 17e.  Previously, the result could have been an\ninstance of a subclass of 'int'.  (Contributed by Serhiy Storchaka\nin bpo-40792(1).)\n\n* Add a new *note origargv: 6a2. member to the *note PyConfig: 318.\nstructure: the list of the original command line arguments passed\nto the Python executable.  (Contributed by Victor Stinner in\nbpo-23427(2).)\n\n* The *note PyDateTimeDATEGETTZINFO(): 6a3. and *note\nPyDateTimeTIMEGETTZINFO(): 6a4. macros have been added for\naccessing the 'tzinfo' attributes of *note datetime.datetime: 222.\nand *note datetime.time: 6a5. objects.  (Contributed by Zackery\nSpytz in bpo-30155(3).)\n\n* Add a *note PyCodecUnregister(): 6a6. function to unregister a\ncodec search function.  (Contributed by Hai Shi in bpo-41842(4).)\n\n* The *note PyIterSend(): 6a7. function was added to allow sending\nvalue into iterator without raising 'StopIteration' exception.\n(Contributed by Vladimir Matveev in bpo-41756(5).)\n\n* Add *note PyUnicodeAsUTF8AndSize(): 6a8. to the limited C API.\n(Contributed by Alex Gaynor in bpo-41784(6).)\n\n* Add *note PyModuleAddObjectRef(): 6a9. function: similar to *note\nPyModuleAddObject(): 6aa. but don't steal a reference to the value\non success.  (Contributed by Victor Stinner in bpo-1635741(7).)\n\n* Add *note PyNewRef(): 6ab. and *note PyXNewRef(): 6ac. functions\nto increment the reference count of an object and return the\nobject.  (Contributed by Victor Stinner in bpo-42262(8).)\n\n* The *note PyTypeFromSpecWithBases(): 2e0. and *note\nPyTypeFromModuleAndSpec(): 2aa. functions now accept a single\nclass as the 'bases' argument.  (Contributed by Serhiy Storchaka in\nbpo-42423(9).)\n\n* The *note PyTypeFromModuleAndSpec(): 2aa. function now accepts\nNULL 'tpdoc' slot.  (Contributed by Hai Shi in bpo-41832(10).)\n\n* The *note PyTypeGetSlot(): 6ad. function can accept *note static\ntypes: 56a.  (Contributed by Hai Shi and Petr Viktorin in\nbpo-41073(11).)\n\n* Add a new *note PySetCheckExact(): 6ae. function to the C-API to\ncheck if an object is an instance of *note set: 39d. but not an\ninstance of a subtype.  (Contributed by Pablo Galindo in\nbpo-43277(12).)\n\n* Add *note PyErrSetInterruptEx(): 6af. which allows passing a\nsignal number to simulate.  (Contributed by Antoine Pitrou in\nbpo-43356(13).)\n\n* The limited C API is now supported if *note Python is built in\ndebug mode: 67f. (if the 'PyDEBUG' macro is defined).  In the\nlimited C API, the *note PyINCREF(): 2ce. and *note PyDECREF():\n2cf. functions are now implemented as opaque function calls, rather\nthan accessing directly the *note PyObject.obrefcnt: 6b0. member,\nif Python is built in debug mode and the 'PyLIMITEDAPI' macro\ntargets Python 3.10 or newer.  It became possible to support the\nlimited C API in debug mode because the *note PyObject: 6b1.\nstructure is the same in release and debug mode since Python 3.8\n(see bpo-36465(14)).\n\nThe limited C API is still not supported in the *note\n-with-trace-refs: 6b2. special build ('PyTRACEREFS' macro).\n(Contributed by Victor Stinner in bpo-43688(15).)\n\n* Add the *note PyIs(x, y): 6b3. function to test if the 'x' object\nis the 'y' object, the same as 'x is y' in Python.  Add also the\n*note PyIsNone(): 6b4, *note PyIsTrue(): 6b5, *note PyIsFalse():\n6b6. functions to test if an object is, respectively, the 'None'\nsingleton, the 'True' singleton or the 'False' singleton.\n(Contributed by Victor Stinner in bpo-43753(16).)\n\n* Add new functions to control the garbage collector from C code:\n*note PyGCEnable(): 6b7, *note PyGCDisable(): 6b8, *note\nPyGCIsEnabled(): 6b9.  These functions allow to activate,\ndeactivate and query the state of the garbage collector from C code\nwithout having to import the *note gc: 5b. module.\n\n* Add a new *note PyTPFLAGSDISALLOWINSTANTIATION: 2e4. type flag\nto disallow creating type instances.  (Contributed by Victor\nStinner in bpo-43916(17).)\n\n* Add a new *note PyTPFLAGSIMMUTABLETYPE: 2b2. type flag for\ncreating immutable type objects: type attributes cannot be set nor\ndeleted.  (Contributed by Victor Stinner and Erlend E. Aasland in\nbpo-43908(18).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40792\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=23427\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=30155\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=41842\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=41756\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=41784\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=42262\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=42423\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=41832\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=41073\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=43277\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=43356\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=36465\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=43688\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=43753\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=43916\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=43908\n\nFile: python3.12.info,  Node: Porting to Python 3 10<2>,  Next: Deprecated<6>,  Prev: New Features<6>,  Up: C API Changes<3>\n\n1.3.13.3 Porting to Python 3.10\n...............................\n\n* The 'PYSSIZETCLEAN' macro must now be defined to use *note\nPyArgParseTuple(): 2d1. and *note PyBuildValue(): 6bb. formats\nwhich use '#': 'es#', 'et#', 's#', 'u#', 'y#', 'z#', 'U#' and 'Z#'.\nSee *note Parsing arguments and building values: 6bc. and PEP\n353(1).  (Contributed by Victor Stinner in bpo-40943(2).)\n\n* Since *note PyREFCNT(): 6bd. is changed to the inline static\nfunction, 'PyREFCNT(obj) = newrefcnt' must be replaced with\n'PySETREFCNT(obj, newrefcnt)': see *note PySETREFCNT(): 6be.\n(available since Python 3.9).  For backward compatibility, this\nmacro can be used:\n\n#if PYVERSIONHEX < 0x030900A4\n#  define PySETREFCNT(obj, refcnt) ((PyREFCNT(obj) = (refcnt)), (void)0)\n#endif\n\n(Contributed by Victor Stinner in bpo-39573(3).)\n\n* Calling *note PyDictGetItem(): 6bf. without *note GIL: 6c0. held\nhad been allowed for historical reason.  It is no longer allowed.\n(Contributed by Victor Stinner in bpo-40839(4).)\n\n* 'PyUnicodeFromUnicode(NULL, size)' and\n'PyUnicodeFromStringAndSize(NULL, size)' raise\n'DeprecationWarning' now.  Use *note PyUnicodeNew(): 6c1. to\nallocate Unicode object without initial data.  (Contributed by\nInada Naoki in bpo-36346(5).)\n\n* The private 'PyUnicodeNameCAPI' structure of the PyCapsule API\n'unicodedata.ucnhashCAPI' has been moved to the internal C API.\n(Contributed by Victor Stinner in bpo-42157(6).)\n\n* *note PyGetPath(): 32b, *note PyGetPrefix(): 32d, *note\nPyGetExecPrefix(): 329, *note PyGetProgramFullPath(): 32f, *note\nPyGetPythonHome(): 332. and *note PyGetProgramName(): 331.\nfunctions now return 'NULL' if called before *note PyInitialize():\n6c2. (before Python is initialized).  Use the new *note Python\nInitialization Configuration: 581. API to get the *note Python Path\nConfiguration: 6c3.  (Contributed by Victor Stinner in\nbpo-42260(7).)\n\n* *note PyListSETITEM(): 6c4, *note PyTupleSETITEM(): 6c5. and\n*note PyCellSET(): 6c6. macros can no longer be used as l-value or\nr-value.  For example, 'x = PyListSETITEM(a, b, c)' and\n'PyListSETITEM(a, b, c) = x' now fail with a compiler error.  It\nprevents bugs like 'if (PyListSETITEM (a, b, c) < 0) ...' test.\n(Contributed by Zackery Spytz and Victor Stinner in bpo-30459(8).)\n\n* The non-limited API files 'odictobject.h', 'parserinterface.h',\n'picklebufobject.h', 'pyarena.h', 'pyctype.h', 'pydebug.h',\n'pyfpe.h', and 'pytime.h' have been moved to the 'Include/cpython'\ndirectory.  These files must not be included directly, as they are\nalready included in 'Python.h'; see *note Include Files: 56f.  If\nthey have been included directly, consider including 'Python.h'\ninstead.  (Contributed by Nicholas Sim in bpo-35134(9).)\n\n* Use the *note PyTPFLAGSIMMUTABLETYPE: 2b2. type flag to create\nimmutable type objects.  Do not rely on *note PyTPFLAGSHEAPTYPE:\n6c7. to decide if a type object is mutable or not; check if *note\nPyTPFLAGSIMMUTABLETYPE: 2b2. is set instead.  (Contributed by\nVictor Stinner and Erlend E. Aasland in bpo-43908(10).)\n\n* The undocumented function 'PyFrozenMain' has been removed from the\nlimited API. The function is mainly useful for custom builds of\nPython.  (Contributed by Petr Viktorin in bpo-26241(11).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0353/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=40943\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=39573\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=40839\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=36346\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=42157\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=42260\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=30459\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=35134\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=43908\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=26241\n\nFile: python3.12.info,  Node: Deprecated<6>,  Next: Removed<6>,  Prev: Porting to Python 3 10<2>,  Up: C API Changes<3>\n\n1.3.13.4 Deprecated\n...................\n\n* The 'PyUnicodeInternImmortal()' function is now deprecated and\nwill be removed in Python 3.12: use *note\nPyUnicodeInternInPlace(): 6c9. instead.  (Contributed by Victor\nStinner in bpo-41692(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=41692\n\nFile: python3.12.info,  Node: Removed<6>,  Prev: Deprecated<6>,  Up: C API Changes<3>\n\n1.3.13.5 Removed\n................\n\n* Removed 'PyUNICODEstr*' functions manipulating 'PyUNICODE*'\nstrings.  (Contributed by Inada Naoki in bpo-41123(1).)\n\n* 'PyUNICODEstrlen': use *note PyUnicodeGetLength(): 6cb. or\n*note PyUnicodeGETLENGTH: 6cc.\n\n* 'PyUNICODEstrcat': use *note PyUnicodeCopyCharacters():\n6cd. or *note PyUnicodeFromFormat(): 2d5.\n\n* 'PyUNICODEstrcpy', 'PyUNICODEstrncpy': use *note\nPyUnicodeCopyCharacters(): 6cd. or *note\nPyUnicodeSubstring(): 6ce.\n\n* 'PyUNICODEstrcmp': use *note PyUnicodeCompare(): 6cf.\n\n* 'PyUNICODEstrncmp': use *note PyUnicodeTailmatch(): 6d0.\n\n* 'PyUNICODEstrchr', 'PyUNICODEstrrchr': use *note\nPyUnicodeFindChar(): 6d1.\n\n* Removed 'PyUnicodeGetMax()'.  Please migrate to new ( PEP 393(2))\nAPIs.  (Contributed by Inada Naoki in bpo-41103(3).)\n\n* Removed 'PyLongFromUnicode()'.  Please migrate to *note\nPyLongFromUnicodeObject(): 6d2.  (Contributed by Inada Naoki in\nbpo-41103(4).)\n\n* Removed 'PyUnicodeAsUnicodeCopy()'.  Please use *note\nPyUnicodeAsUCS4Copy(): 6d3. or *note PyUnicodeAsWideCharString():\n6d4. (Contributed by Inada Naoki in bpo-41103(5).)\n\n* Removed 'PyCheckRecursionLimit' variable: it has been replaced by\n'ceval.recursionlimit' of the *note PyInterpreterState: 6d5.\nstructure.  (Contributed by Victor Stinner in bpo-41834(6).)\n\n* Removed undocumented macros 'PyALLOWRECURSION' and\n'PyENDALLOWRECURSION' and the 'recursioncritical' field of the\n*note PyInterpreterState: 6d5. structure.  (Contributed by Serhiy\nStorchaka in bpo-41936(7).)\n\n* Removed the undocumented 'PyOSInitInterrupts()' function.\nInitializing Python already implicitly installs signal handlers:\nsee *note PyConfig.installsignalhandlers: 6d6.  (Contributed by\nVictor Stinner in bpo-41713(8).)\n\n* Remove the 'PyASTValidate()' function.  It is no longer possible\nto build a AST object ('modty' type) with the public C API. The\nfunction was already excluded from the limited C API ( PEP 384(9)).\n(Contributed by Victor Stinner in bpo-43244(10).)\n\n* Remove the 'symtable.h' header file and the undocumented functions:\n\n* 'PySTGetScope()'\n\n* 'PySymtableBuild()'\n\n* 'PySymtableBuildObject()'\n\n* 'PySymtableFree()'\n\n* 'PySymtableString()'\n\n* 'PySymtableStringObject()'\n\nThe 'PySymtableString()' function was part the stable ABI by\nmistake but it could not be used, because the 'symtable.h' header\nfile was excluded from the limited C API.\n\nUse Python *note symtable: d2. module instead.  (Contributed by\nVictor Stinner in bpo-43244(11).)\n\n* Remove *note PyOSReadlineFunctionPointer(): 2e8. from the limited\nC API headers and from 'python3.dll', the library that provides the\nstable ABI on Windows.  Since the function takes a 'FILE*'\nargument, its ABI stability cannot be guaranteed.  (Contributed by\nPetr Viktorin in bpo-43868(12).)\n\n* Remove 'ast.h', 'asdl.h', and 'Python-ast.h' header files.  These\nfunctions were undocumented and excluded from the limited C API.\nMost names defined by these header files were not prefixed by 'Py'\nand so could create names conflicts.  For example, 'Python-ast.h'\ndefined a 'Yield' macro which was conflict with the 'Yield' name\nused by the Windows '<winbase.h>' header.  Use the Python *note\nast: 8. module instead.  (Contributed by Victor Stinner in\nbpo-43244(13).)\n\n* Remove the compiler and parser functions using 'struct mod' type,\nbecause the public AST C API was removed:\n\n* 'PyASTCompile()'\n\n* 'PyASTCompileEx()'\n\n* 'PyASTCompileObject()'\n\n* 'PyFutureFromAST()'\n\n* 'PyFutureFromASTObject()'\n\n* 'PyParserASTFromFile()'\n\n* 'PyParserASTFromFileObject()'\n\n* 'PyParserASTFromFilename()'\n\n* 'PyParserASTFromString()'\n\n* 'PyParserASTFromStringObject()'\n\nThese functions were undocumented and excluded from the limited C\nAPI. (Contributed by Victor Stinner in bpo-43244(14).)\n\n* Remove the 'pyarena.h' header file with functions:\n\n* 'PyArenaNew()'\n\n* 'PyArenaFree()'\n\n* 'PyArenaMalloc()'\n\n* 'PyArenaAddPyObject()'\n\nThese functions were undocumented, excluded from the limited C API,\nand were only used internally by the compiler.  (Contributed by\nVictor Stinner in bpo-43244(15).)\n\n* The 'PyThreadState.usetracing' member has been removed to optimize\nPython.  (Contributed by Mark Shannon in bpo-43760(16).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=41123\n\n(2) https://peps.python.org/pep-0393/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=41103\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=41103\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=41103\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=41834\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=41936\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=41713\n\n(9) https://peps.python.org/pep-0384/\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=43244\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=43244\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=43868\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=43244\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=43244\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=43244\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=43760\n\nFile: python3.12.info,  Node: Notable security feature in 3 10 7,  Next: Notable security feature in 3 10 8,  Prev: C API Changes<3>,  Up: What's New In Python 3 10\n\n\nConverting between *note int: 17e. and *note str: 157. in bases other\nthan 2 (binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10\n(decimal) now raises a *note ValueError: 183. if the number of digits in\nstring form is above a limit to avoid potential denial of service\nattacks due to the algorithmic complexity.  This is a mitigation for\nCVE-2020-10735(1).  This limit can be configured or disabled by\nenvironment variable, command line flag, or *note sys: d3. APIs.  See\nthe *note integer string conversion length limitation: 3bc.\ndocumentation.  The default limit is 4300 digits in string form.\n\n---------- Footnotes ----------\n\n(1) https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-10735\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "The deprecated 'mailcap' module now refuses to inject unsafe text": {
            "content": "(filenames, MIME types, parameters) into shell commands.  Instead of\nusing such text, it will warn and act as if a match was not found (or\nfor test commands, as if the test failed).  (Contributed by Petr",
            "subsections": []
        },
        "Viktorin in gh-98966(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/98966\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Notable changes in 3 10 12,  Prev: Notable security feature in 3 10 8,  Up: What's New In Python 3 10": {
            "content": "* Menu:\n\n* tarfile: tarfile<3>.\n\nFile: python3.12.info,  Node: tarfile<3>,  Up: Notable changes in 3 10 12\n\n1.3.16.1 tarfile\n................\n\n* The extraction methods in *note tarfile: d8, and *note\nshutil.unpackarchive(): 184, have a new a 'filter' argument that\nallows limiting tar features than may be surprising or dangerous,\nsuch as creating files outside the destination directory.  See\n*note Extraction filters: 185. for details.  In Python 3.12, use\nwithout the 'filter' argument will show a *note DeprecationWarning:\n179.  In Python 3.14, the default will switch to ''data''.\n(Contributed by Petr Viktorin in PEP 706(1).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0706/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": [
                {
                    "name": "1.4 What's New In Python 3.9",
                    "content": "Editor: ??ukasz Langa\n\nThis 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": {
            "content": "*note changelog: 136.\n\nSee also\n........\n\nPEP 596(1) - Python 3.9 Release Schedule\n\n* Menu:\n\n* Summary - Release highlights: Summary - Release highlights<4>.\n* You should check for DeprecationWarning in your code::\n* New Features: New Features<7>.\n* Other Language Changes: Other Language Changes<4>.\n* New Modules: New Modules<4>.\n* Improved Modules: Improved Modules<4>.\n* Optimizations: Optimizations<4>.\n* Deprecated: Deprecated<7>.\n* Removed: Removed<7>.\n* Porting to Python 3.9: Porting to Python 3 9.\n* Build Changes: Build Changes<4>.\n* C API Changes: C API Changes<4>.\n* Notable changes in Python 3.9.1: Notable changes in Python 3 9 1.\n* Notable changes in Python 3.9.2: Notable changes in Python 3 9 2.\n* Notable changes in Python 3.9.3: Notable changes in Python 3 9 3.\n* Notable changes in Python 3.9.5: Notable changes in Python 3 9 5.\n* Notable security feature in 3.9.14: Notable security feature in 3 9 14.\n* Notable changes in 3.9.17: Notable changes in 3 9 17.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0596/\n\nFile: python3.12.info,  Node: Summary - Release highlights<4>,  Next: You should check for DeprecationWarning in your code,  Up: What's New In Python 3 9\n\n\nNew syntax features:\n\n* PEP 584(1), union operators added to 'dict';\n\n* PEP 585(2), type hinting generics in standard collections;\n\n* PEP 614(3), relaxed grammar restrictions on decorators.\n\nNew built-in features:\n\n* PEP 616(4), string methods to remove prefixes and suffixes.\n\nNew features in the standard library:\n\n* PEP 593(5), flexible function and variable annotations;\n\n* *note os.pidfdopen(): 195. added that allows process management\nwithout races and signals.\n\nInterpreter improvements:\n\n* PEP 573(6), fast access to module state from methods of C extension\ntypes;\n\n* PEP 617(7), CPython now uses a new parser based on PEG;\n\n* a number of Python builtins (range, tuple, set, frozenset, list,\ndict) are now sped up using PEP 590(8) vectorcall;\n\n* garbage collection does not block on resurrected objects;\n\n* a number of Python modules ('abc', *note audioop: b, 'bz2',\n'codecs', 'contextvars', 'crypt', 'functools', 'json',\n'locale', *note math: 89, *note operator: 9a, *note resource: b7,\n*note time: e8, 'weakref') now use multiphase initialization as\ndefined by PEP 489;\n\n* a number of standard library modules (*note audioop: b, *note ast:\n8, *note grp: 61, 'hashlib', *note pwd: ad, 'posixsubprocess',\n*note random: b3, *note select: bc, *note struct: cf, *note\ntermios: db, *note zlib: 12d.) are now using the stable ABI defined\nby PEP 384.\n\nNew library modules:\n\n* PEP 615(9), the IANA Time Zone Database is now present in the\nstandard library in the *note zoneinfo: 12e. module;\n\n* an implementation of a topological sort of a graph is now provided\nin the new *note graphlib: 60. module.\n\nRelease process changes:\n\n* PEP 602(10), CPython adopts an annual release cycle.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0584/\n\n(2) https://peps.python.org/pep-0585/\n\n(3) https://peps.python.org/pep-0614/\n\n(4) https://peps.python.org/pep-0616/\n\n(5) https://peps.python.org/pep-0593/\n\n(6) https://peps.python.org/pep-0573/\n\n(7) https://peps.python.org/pep-0617/\n\n(8) https://peps.python.org/pep-0590/\n\n(9) https://peps.python.org/pep-0615/\n\n(10) https://peps.python.org/pep-0602/\n\nFile: python3.12.info,  Node: You should check for DeprecationWarning in your code,  Next: New Features<7>,  Prev: Summary - Release highlights<4>,  Up: What's New In Python 3 9\n\n",
            "subsections": []
        },
        "When Python 2.7 was still supported, a lot of functionality in Python 3": {
            "content": "was kept for backward compatibility with Python 2.7.  With the end of",
            "subsections": []
        },
        "Python 2 support, these backward compatibility layers have been removed,": {
            "content": "or will be removed soon.  Most of them emitted a *note",
            "subsections": []
        },
        "DeprecationWarning: 179. warning for several years.  For example, using": {
            "content": "'collections.Mapping' instead of 'collections.abc.Mapping' emits a *note\nDeprecationWarning: 179. since Python 3.3, released in 2012.\n\nTest your application with the *note -W: 6df. 'default' command-line\noption to see *note DeprecationWarning: 179. and *note\nPendingDeprecationWarning: 6e0, or even with *note -W: 6df. 'error' to\ntreat them as errors.  *note Warnings Filter: 6e1. can be used to ignore\nwarnings from third-party code.\n",
            "subsections": []
        },
        "Python 3.9 is the last version providing those Python 2 backward": {
            "content": "compatibility layers, to give more time to Python projects maintainers\nto organize the removal of the Python 2 support and add support for\nPython 3.9.\n\nAliases to *note Abstract Base Classes: 683. in the *note collections:\n1b. module, like 'collections.Mapping' alias to *note\ncollections.abc.Mapping: 6e2, are kept for one last release for backward\ncompatibility.  They will be removed from Python 3.10.\n\nMore generally, try to run your tests in the *note Python Development",
            "subsections": []
        },
        "Mode: 6e3. which helps to prepare your code to make it compatible with": {
            "content": "the next Python version.\n",
            "subsections": []
        },
        "Note: a number of pre-existing deprecations were removed in this version": {
            "content": "of Python as well.  Consult the *note Removed: 6e4. section.\n\nFile: python3.12.info,  Node: New Features<7>,  Next: Other Language Changes<4>,  Prev: You should check for DeprecationWarning in your code,  Up: What's New In Python 3 9\n\n\n* Menu:\n\n* Dictionary Merge & Update Operators::\n* New String Methods to Remove Prefixes and Suffixes::\n* Type Hinting Generics in Standard Collections::\n* New Parser::\n\nFile: python3.12.info,  Node: Dictionary Merge & Update Operators,  Next: New String Methods to Remove Prefixes and Suffixes,  Up: New Features<7>\n\n1.4.3.1 Dictionary Merge & Update Operators\n...........................................\n\nMerge ('|') and update ('|=') operators have been added to the built-in\n*note dict: 237. class.  Those complement the existing 'dict.update' and\n'{d1, d2}' methods of merging dictionaries.\n\nExample:\n\n>>> x = {\"key1\": \"value1 from x\", \"key2\": \"value2 from x\"}\n>>> y = {\"key2\": \"value2 from y\", \"key3\": \"value3 from y\"}\n>>> x | y\n{'key1': 'value1 from x', 'key2': 'value2 from y', 'key3': 'value3 from y'}\n>>> y | x\n{'key2': 'value2 from x', 'key3': 'value3 from y', 'key1': 'value1 from x'}\n",
            "subsections": []
        },
        "See PEP 584(1) for a full description.  (Contributed by Brandt Bucher in": {
            "content": "bpo-36144(2).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0584/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=36144\n\nFile: python3.12.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<7>\n\n1.4.3.2 New String Methods to Remove Prefixes and Suffixes\n..........................................................\n\n*note str.removeprefix(prefix): 6e8. and *note str.removesuffix(suffix):\n6e9. have been added to easily remove an unneeded prefix or a suffix\nfrom a string.  Corresponding 'bytes', 'bytearray', and\n'collections.UserString' methods have also been added.  See PEP 616(1)\nfor a full description.  (Contributed by Dennis Sweeney in\nbpo-39939(2).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0616/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=39939\n\nFile: python3.12.info,  Node: Type Hinting Generics in Standard Collections,  Next: New Parser,  Prev: New String Methods to Remove Prefixes and Suffixes,  Up: New Features<7>\n\n1.4.3.3 Type Hinting Generics in Standard Collections\n.....................................................\n",
            "subsections": []
        },
        "In type annotations you can now use built-in collection types such as": {
            "content": "'list' and 'dict' as generic types instead of importing the\ncorresponding capitalized types (e.g.  'List' or 'Dict') from 'typing'.",
            "subsections": []
        },
        "Some other types in the standard library are also now generic, for": {
            "content": "example 'queue.Queue'.\n\nExample:\n\ndef greetall(names: list[str]) -> None:\nfor name in names:\nprint(\"Hello\", name)\n",
            "subsections": []
        },
        "See PEP 585(1) for more details.  (Contributed by Guido van Rossum,": {
            "content": "Ethan Smith, and Batuhan Ta??kaya in bpo-39481(2).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0585/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=39481\n\nFile: python3.12.info,  Node: New Parser,  Prev: Type Hinting Generics in Standard Collections,  Up: New Features<7>\n\n1.4.3.4 New Parser\n..................\n",
            "subsections": []
        },
        "Python 3.9 uses a new parser, based on PEG(1) instead of LL(1)(2).  The": {
            "content": "new parser's performance is roughly comparable to that of the old\nparser, but the PEG formalism is more flexible than LL(1) when it comes\nto designing new language features.  We'll start using this flexibility\nin Python 3.10 and later.\n\nThe *note ast: 8. module uses the new parser and produces the same AST\nas the old parser.\n",
            "subsections": []
        },
        "In Python 3.10, the old parser will be deleted and so will all": {
            "content": "functionality that depends on it (primarily the 'parser' module, which\nhas long been deprecated).  In Python 3.9 'only', you can switch back to\nthe LL(1) parser using a command line switch ('-X oldparser') or an\nenvironment variable ('PYTHONOLDPARSER=1').\n",
            "subsections": []
        },
        "See PEP 617(3) for more details.  (Contributed by Guido van Rossum,": {
            "content": "",
            "subsections": []
        },
        "Pablo Galindo and Lysandros Nikolaou in bpo-40334(4).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Parsingexpressiongrammar\n\n(2) https://en.wikipedia.org/wiki/LLparser\n\n(3) https://peps.python.org/pep-0617/\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=40334\n\nFile: python3.12.info,  Node: Other Language Changes<4>,  Next: New Modules<4>,  Prev: New Features<7>,  Up: What's New In Python 3 9\n\n\n* *note import(): 6ed. now raises *note ImportError: 145. instead\nof *note ValueError: 183, which used to occur when a relative\nimport went past its top-level package.  (Contributed by Ngalim\nSiregar in bpo-37444(1).)\n\n* Python now gets the absolute path of the script filename specified\non the command line (ex: 'python3 script.py'): the 'file'\nattribute of the *note main: 1. module became an absolute path,\nrather than a relative path.  These paths now remain valid after\nthe current directory is changed by *note os.chdir(): 3d8.  As a\nside effect, the traceback also displays the absolute path for\n*note main: 1. module frames in this case.  (Contributed by\nVictor Stinner in bpo-20443(2).)\n\n* In the *note Python Development Mode: 6e3. and in *note debug\nbuild: 67f, the 'encoding' and 'errors' arguments are now checked\nfor string encoding and decoding operations.  Examples: *note\nopen(): 26e, *note str.encode(): 6ee. and *note bytes.decode():\n6ef.\n\nBy default, for best performance, the 'errors' argument is only\nchecked at the first encoding/decoding error and the 'encoding'\nargument is sometimes ignored for empty strings.  (Contributed by\nVictor Stinner in bpo-37388(3).)\n\n* '\"\".replace(\"\", s, n)' now returns 's' instead of an empty string\nfor all non-zero 'n'.  It is now consistent with '\"\".replace(\"\",\ns)'.  There are similar changes for *note bytes: 295. and *note\nbytearray: 294. objects.  (Contributed by Serhiy Storchaka in\nbpo-28029(4).)\n\n* Any valid expression can now be used as a *note decorator: 514.\nPreviously, the grammar was much more restrictive.  See PEP 614(5)\nfor details.  (Contributed by Brandt Bucher in bpo-39702(6).)\n\n* Improved help for the *note typing: ff. module.  Docstrings are now\nshown for all special forms and special generic aliases (like\n'Union' and 'List').  Using *note help(): 6f0. with generic alias\nlike 'List[int]' will show the help for the correspondent concrete\ntype ('list' in this case).  (Contributed by Serhiy Storchaka in\nbpo-40257(7).)\n\n* Parallel running of *note aclose(): 6f1. / *note asend(): 6f2. /\n*note athrow(): 242. is now prohibited, and 'agrunning' now\nreflects the actual running status of the async generator.\n(Contributed by Yury Selivanov in bpo-30773(8).)\n\n* Unexpected errors in calling the 'iter' method are no longer\nmasked by 'TypeError' in the *note in: 250. operator and functions\n*note contains(): 6f3, *note indexOf(): 6f4. and *note countOf():\n6f5. of the *note operator: 9a. module.  (Contributed by Serhiy\nStorchaka in bpo-40824(9).)\n\n* Unparenthesized lambda expressions can no longer be the expression\npart in an 'if' clause in comprehensions and generator expressions.\nSee bpo-41848(10) and bpo-43755(11) for details.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=37444\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=20443\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=37388\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=28029\n\n(5) https://peps.python.org/pep-0614/\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=39702\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=40257\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=30773\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=40824\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=41848\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=43755\n\nFile: python3.12.info,  Node: New Modules<4>,  Next: Improved Modules<4>,  Prev: Other Language Changes<4>,  Up: What's New In Python 3 9\n\n\n* Menu:\n\n* zoneinfo::\n* graphlib::\n\nFile: python3.12.info,  Node: zoneinfo,  Next: graphlib,  Up: New Modules<4>\n\n1.4.5.1 zoneinfo\n................\n\nThe *note zoneinfo: 12e. module brings support for the IANA time zone\ndatabase to the standard library.  It adds *note zoneinfo.ZoneInfo: 6f8,\na concrete *note datetime.tzinfo: 3a2. implementation backed by the\nsystem's time zone data.\n\nExample:\n\n>>> from zoneinfo import ZoneInfo\n>>> from datetime import datetime, timedelta\n\n>>> # Daylight saving time\n>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo(\"America/LosAngeles\"))\n>>> print(dt)\n2020-10-31 12:00:00-07:00\n>>> dt.tzname()\n'PDT'\n\n>>> # Standard time\n>>> dt += timedelta(days=7)\n>>> print(dt)\n2020-11-07 12:00:00-08:00\n>>> print(dt.tzname())\nPST\n",
            "subsections": []
        },
        "As a fall-back source of data for platforms that don't ship the IANA": {
            "content": "database, the tzdata(1) module was released as a first-party package -\ndistributed via PyPI and maintained by the CPython core team.\n\nSee also\n........\n\nPEP 615(2) - Support for the IANA Time Zone Database in the Standard Library\n\nPEP written and implemented by Paul Ganssle\n\n---------- Footnotes ----------\n\n(1) https://pypi.org/project/tzdata/\n\n(2) https://peps.python.org/pep-0615/\n\nFile: python3.12.info,  Node: graphlib,  Prev: zoneinfo,  Up: New Modules<4>\n\n1.4.5.2 graphlib\n................\n\nA new module, *note graphlib: 60, was added that contains the *note\ngraphlib.TopologicalSorter: 6fa. class to offer functionality to perform\ntopological sorting of graphs.  (Contributed by Pablo Galindo, Tim",
            "subsections": []
        },
        "Peters and Larry Hastings in bpo-17005(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=17005\n\nFile: python3.12.info,  Node: Improved Modules<4>,  Next: Optimizations<4>,  Prev: New Modules<4>,  Up: What's New In Python 3 9\n\n\n* Menu:\n\n* ast::\n* asyncio: asyncio<4>.\n* compileall::\n* concurrent.futures: concurrent futures.\n* curses: curses<2>.\n* datetime: datetime<2>.\n* distutils: distutils<3>.\n* fcntl: fcntl<2>.\n* ftplib: ftplib<2>.\n* gc: gc<2>.\n* hashlib: hashlib<4>.\n* http::\n* IDLE and idlelib: IDLE and idlelib<3>.\n* imaplib::\n* importlib: importlib<2>.\n* inspect: inspect<4>.\n* ipaddress::\n* math: math<3>.\n* multiprocessing::\n* nntplib::\n* os: os<4>.\n* pathlib: pathlib<4>.\n* pdb: pdb<2>.\n* poplib::\n* pprint: pprint<2>.\n* pydoc::\n* random: random<2>.\n* signal::\n* smtplib::\n* socket: socket<3>.\n* time: time<2>.\n* sys: sys<4>.\n* tracemalloc::\n* typing: typing<4>.\n* unicodedata: unicodedata<3>.\n* venv: venv<2>.\n* xml: xml<2>.\n\nFile: python3.12.info,  Node: ast,  Next: asyncio<4>,  Up: Improved Modules<4>\n\n1.4.6.1 ast\n...........\n\nAdded the 'indent' option to *note dump(): 6fd. which allows it to\nproduce a multiline indented output.  (Contributed by Serhiy Storchaka\nin bpo-37995(1).)\n\nAdded *note ast.unparse(): 6fe. as a function in the *note ast: 8.\nmodule that can be used to unparse an *note ast.AST: 527. object and\nproduce a string with code that would produce an equivalent *note\nast.AST: 527. object when parsed.  (Contributed by Pablo Galindo and",
            "subsections": []
        },
        "Batuhan Taskaya in bpo-38870(2).)": {
            "content": "",
            "subsections": []
        },
        "Added docstrings to AST nodes that contains the ASDL signature used to": {
            "content": "construct that node.  (Contributed by Batuhan Taskaya in bpo-39638(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=37995\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=38870\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=39638\n\nFile: python3.12.info,  Node: asyncio<4>,  Next: compileall,  Prev: ast,  Up: Improved Modules<4>\n\n1.4.6.2 asyncio\n...............\n",
            "subsections": []
        },
        "Due to significant security concerns, the 'reuseaddress' parameter of": {
            "content": "*note asyncio.loop.createdatagramendpoint(): 517. is no longer\nsupported.  This is because of the behavior of the socket option\n'SOREUSEADDR' in UDP. For more details, see the documentation for\n'loop.createdatagramendpoint()'.  (Contributed by Kyle Stanley,",
            "subsections": []
        },
        "Antoine Pitrou, and Yury Selivanov in bpo-37228(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=37228\n",
            "subsections": []
        },
        "Michael in bpo-37404(6).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=37228\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=34037\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=38692\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=32309\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=32751\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=37404\n\nFile: python3.12.info,  Node: compileall,  Next: concurrent futures,  Prev: asyncio<4>,  Up: Improved Modules<4>\n\n1.4.6.3 compileall\n..................\n\nAdded new possibility to use hardlinks for duplicated '.pyc' files:\n'hardlinkdupes' parameter and -hardlink-dupes command line option.\n(Contributed by Lum??r 'Frenzy' Balhar in bpo-40495(1).)\n\nAdded new options for path manipulation in resulting '.pyc' files:\n'stripdir', 'prependdir', 'limitsldest' parameters and -s, -p, -e\ncommand line options.  Added the possibility to specify the option for\nan optimization level multiple times.  (Contributed by Lum??r 'Frenzy'",
            "subsections": []
        },
        "Balhar in bpo-38112(2).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40495\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=38112\n\nFile: python3.12.info,  Node: concurrent futures,  Next: curses<2>,  Prev: compileall,  Up: Improved Modules<4>\n\n1.4.6.4 concurrent.futures\n..........................\n\nAdded a new 'cancelfutures' parameter to *note\nconcurrent.futures.Executor.shutdown(): 706. that cancels all pending\nfutures which have not started running, instead of waiting for them to\ncomplete before shutting down the executor.  (Contributed by Kyle",
            "subsections": []
        },
        "Stanley in bpo-39349(1).)": {
            "content": "Removed daemon threads from *note ThreadPoolExecutor: 529. and *note",
            "subsections": []
        },
        "ProcessPoolExecutor: 707.  This improves compatibility with": {
            "content": "subinterpreters and predictability in their shutdown processes.\n(Contributed by Kyle Stanley in bpo-39812(2).)\n\nWorkers in *note ProcessPoolExecutor: 707. are now spawned on demand,\nonly when there are no available idle workers to reuse.  This optimizes\nstartup overhead and reduces the amount of lost CPU time to idle\nworkers.  (Contributed by Kyle Stanley in bpo-39207(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39349\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=39812\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=39207\n\nFile: python3.12.info,  Node: curses<2>,  Next: datetime<2>,  Prev: concurrent futures,  Up: Improved Modules<4>\n\n1.4.6.5 curses\n..............\n\nAdded *note curses.getescdelay(): 709, *note curses.setescdelay():\n70a, *note curses.gettabsize(): 70b, and *note curses.settabsize():\n70c. functions.  (Contributed by Anthony Sottile in bpo-38312(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38312\n\nFile: python3.12.info,  Node: datetime<2>,  Next: distutils<3>,  Prev: curses<2>,  Up: Improved Modules<4>\n\n1.4.6.6 datetime\n................\n\nThe *note isocalendar(): 70e. of *note datetime.date: 70f. and *note\nisocalendar(): 710. of *note datetime.datetime: 222. methods now returns\na *note namedtuple(): 711. instead of a *note tuple: 4b8.  (Contributed\nby Donghee Na in bpo-24416(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24416\n\nFile: python3.12.info,  Node: distutils<3>,  Next: fcntl<2>,  Prev: datetime<2>,  Up: Improved Modules<4>\n\n1.4.6.7 distutils\n.................\n\nThe 'upload' command now creates SHA2-256 and Blake2b-256 hash digests.",
            "subsections": []
        },
        "It skips MD5 on platforms that block MD5 digest.  (Contributed by": {
            "content": "",
            "subsections": []
        },
        "Christian Heimes in bpo-40698(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40698\n\nFile: python3.12.info,  Node: fcntl<2>,  Next: ftplib<2>,  Prev: distutils<3>,  Up: Improved Modules<4>\n\n1.4.6.8 fcntl\n.............\n\nAdded constants 'FOFDGETLK', 'FOFDSETLK' and 'FOFDSETLKW'.\n(Contributed by Donghee Na in bpo-38602(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38602\n\nFile: python3.12.info,  Node: ftplib<2>,  Next: gc<2>,  Prev: fcntl<2>,  Up: Improved Modules<4>\n\n1.4.6.9 ftplib\n..............\n\n*note FTP: 715. and *note FTPTLS: 716. now raise a *note ValueError:\n183. if the given timeout for their constructor is zero to prevent the\ncreation of a non-blocking socket.  (Contributed by Donghee Na in\nbpo-39259(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39259\n\nFile: python3.12.info,  Node: gc<2>,  Next: hashlib<4>,  Prev: ftplib<2>,  Up: Improved Modules<4>\n\n1.4.6.10 gc\n...........\n",
            "subsections": []
        },
        "When the garbage collector makes a collection in which some objects": {
            "content": "resurrect (they are reachable from outside the isolated cycles after the\nfinalizers have been executed), do not block the collection of all\nobjects that are still unreachable.  (Contributed by Pablo Galindo and",
            "subsections": []
        },
        "Tim Peters in bpo-38379(1).)": {
            "content": "Added a new function *note gc.isfinalized(): 718. to check if an object\nhas been finalized by the garbage collector.  (Contributed by Pablo",
            "subsections": []
        },
        "Galindo in bpo-39322(2).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38379\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=39322\n\nFile: python3.12.info,  Node: hashlib<4>,  Next: http,  Prev: gc<2>,  Up: Improved Modules<4>\n\n1.4.6.11 hashlib\n................\n\nThe *note hashlib: 63. module can now use SHA3 hashes and SHAKE XOF from",
            "subsections": []
        },
        "OpenSSL when available.  (Contributed by Christian Heimes in": {
            "content": "bpo-37630(1).)\n",
            "subsections": []
        },
        "Builtin hash modules can now be disabled with './configure": {
            "content": "--without-builtin-hashlib-hashes' or selectively enabled with e.g.\n'./configure --with-builtin-hashlib-hashes=sha3,blake2' to force use of",
            "subsections": []
        },
        "OpenSSL based implementation.  (Contributed by Christian Heimes in": {
            "content": "bpo-40479(2))\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=37630\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=40479\n\nFile: python3.12.info,  Node: http,  Next: IDLE and idlelib<3>,  Prev: hashlib<4>,  Up: Improved Modules<4>\n\n1.4.6.12 http\n.............\n\nHTTP status codes '103 EARLYHINTS', '418 IMATEAPOT' and '425\nTOOEARLY' are added to *note http.HTTPStatus: 71b.  (Contributed by",
            "subsections": []
        },
        "Donghee Na in bpo-39509(1) and Ross Rhodes in bpo-39507(2).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39509\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=39507\n\nFile: python3.12.info,  Node: IDLE and idlelib<3>,  Next: imaplib,  Prev: http,  Up: Improved Modules<4>\n\n1.4.6.13 IDLE and idlelib\n.........................\n",
            "subsections": []
        },
        "Added option to toggle cursor blink off.  (Contributed by Zackery Spytz": {
            "content": "in bpo-4603(1).)\n",
            "subsections": []
        },
        "Escape key now closes IDLE completion windows.  (Contributed by Johnny": {
            "content": "",
            "subsections": []
        },
        "Najera in bpo-38944(2).)": {
            "content": "Added keywords to module name completion list.  (Contributed by Terry J.",
            "subsections": []
        },
        "Reedy in bpo-37765(3).)": {
            "content": "",
            "subsections": []
        },
        "New in 3.9 maintenance releases": {
            "content": "Make IDLE invoke *note sys.excepthook(): 5ff. (when started without\n'-n').  User hooks were previously ignored.  (Contributed by Ken Hilton\nin bpo-43008(4).)\n\nThe changes above have been backported to 3.8 maintenance releases.\n",
            "subsections": []
        },
        "Jan Reedy in bpo-40468(5).)  Move the indent space setting from the Font": {
            "content": "tab to the new Windows tab.  (Contributed by Mark Roseman and Terry Jan",
            "subsections": []
        },
        "Reedy in bpo-33962(6).)": {
            "content": "",
            "subsections": []
        },
        "Import loaders which publish immutable module objects can now publish": {
            "content": "immutable packages in addition to individual modules.  (Contributed by",
            "subsections": []
        },
        "Dino Viehland in bpo-39336(2).)": {
            "content": "Added *note importlib.resources.files(): 1ab. function with support for\nsubdirectories in package data, matching backport in\n'importlibresources' version 1.5.  (Contributed by Jason R. Coombs in\nbpo-39791(3).)\n\nRefreshed 'importlib.metadata' from 'importlibmetadata' version 1.6.1.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=37444\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=39336\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=39791\n\nFile: python3.12.info,  Node: inspect<4>,  Next: ipaddress,  Prev: importlib<2>,  Up: Improved Modules<4>\n\n1.4.6.16 inspect\n................\n\n*note inspect.BoundArguments.arguments: 727. is changed from\n'OrderedDict' to regular dict.  (Contributed by Inada Naoki in\nbpo-36350(1) and bpo-39775(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36350\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=39775\n\nFile: python3.12.info,  Node: ipaddress,  Next: math<3>,  Prev: inspect<4>,  Up: Improved Modules<4>\n\n1.4.6.17 ipaddress\n..................\n\n*note ipaddress: 7a. now supports IPv6 Scoped Addresses (IPv6 address\nwith suffix '%<scopeid>').\n\nScoped IPv6 addresses can be parsed using *note ipaddress.IPv6Address:\n729.  If present, scope zone ID is available through the *note scopeid:\n72a. attribute.  (Contributed by Oleksandr Pavliuk in bpo-34788(1).)\n\nStarting with Python 3.9.5 the *note ipaddress: 7a. module no longer\naccepts any leading zeros in IPv4 address strings.  (Contributed by\nChristian Heimes in bpo-36384(2)).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=34788\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=36384\n\nFile: python3.12.info,  Node: math<3>,  Next: multiprocessing,  Prev: ipaddress,  Up: Improved Modules<4>\n\n1.4.6.18 math\n.............\n\nExpanded the *note math.gcd(): 72c. function to handle multiple\narguments.  Formerly, it only supported two arguments.  (Contributed by",
            "subsections": []
        },
        "Serhiy Storchaka in bpo-39648(1).)": {
            "content": "Added *note math.lcm(): 72d.: return the least common multiple of\nspecified arguments.  (Contributed by Mark Dickinson, Ananthakrishnan\nand Serhiy Storchaka in bpo-39479(2) and bpo-39648(3).)\n\nAdded *note math.nextafter(): 1b7.: return the next floating-point value\nafter 'x' towards 'y'.  (Contributed by Victor Stinner in bpo-39288(4).)\n\nAdded *note math.ulp(): 72e.: return the value of the least significant\nbit of a float.  (Contributed by Victor Stinner in bpo-39310(5).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39648\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=39479\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=39648\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=39288\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=39310\n\nFile: python3.12.info,  Node: multiprocessing,  Next: nntplib,  Prev: math<3>,  Up: Improved Modules<4>\n\n1.4.6.19 multiprocessing\n........................\n\nThe *note multiprocessing.SimpleQueue: 730. class has a new *note\nclose(): 731. method to explicitly close the queue.  (Contributed by",
            "subsections": []
        },
        "Victor Stinner in bpo-30966(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30966\n\nFile: python3.12.info,  Node: nntplib,  Next: os<4>,  Prev: multiprocessing,  Up: Improved Modules<4>\n\n1.4.6.20 nntplib\n................\n\n*note NNTP: 733. and *note NNTPSSL: 734. now raise a *note ValueError:\n183. if the given timeout for their constructor is zero to prevent the\ncreation of a non-blocking socket.  (Contributed by Donghee Na in\nbpo-39259(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39259\n\nFile: python3.12.info,  Node: os<4>,  Next: pathlib<4>,  Prev: nntplib,  Up: Improved Modules<4>\n\n1.4.6.21 os\n...........\n\nAdded *note CLDKILLED: 736. and *note CLDSTOPPED: 737. for 'sicode'.\n(Contributed by Donghee Na in bpo-38493(1).)\n\nExposed the Linux-specific *note os.pidfdopen(): 195. (bpo-38692(2))\nand *note os.PPIDFD: 738. (bpo-38713(3)) for process management with\nfile descriptors.\n\nThe *note os.unsetenv(): 739. function is now also available on Windows.\n(Contributed by Victor Stinner in bpo-39413(4).)\n\nThe *note os.putenv(): 73a. and *note os.unsetenv(): 739. functions are\nnow always available.  (Contributed by Victor Stinner in bpo-39395(5).)\n\nAdded *note os.waitstatustoexitcode(): 73b. function: convert a wait\nstatus to an exit code.  (Contributed by Victor Stinner in\nbpo-40094(6).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38493\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=38692\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=38713\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=39413\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=39395\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=40094\n\nFile: python3.12.info,  Node: pathlib<4>,  Next: pdb<2>,  Prev: os<4>,  Up: Improved Modules<4>\n\n1.4.6.22 pathlib\n................\n\nAdded *note pathlib.Path.readlink(): 73d. which acts similarly to *note\nos.readlink(): 73e.  (Contributed by Girts Folkmanis in bpo-30618(1))\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30618\n\nFile: python3.12.info,  Node: pdb<2>,  Next: poplib,  Prev: pathlib<4>,  Up: Improved Modules<4>\n\n1.4.6.23 pdb\n............\n\nOn Windows now *note Pdb: 740. supports '~/.pdbrc'.  (Contributed by Tim",
            "subsections": []
        },
        "Hopper and Dan Lidral-Porter in bpo-20523(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=20523\n\nFile: python3.12.info,  Node: poplib,  Next: pprint<2>,  Prev: pdb<2>,  Up: Improved Modules<4>\n\n1.4.6.24 poplib\n...............\n\n*note POP3: 742. and *note POP3SSL: 743. now raise a *note ValueError:\n183. if the given timeout for their constructor is zero to prevent the\ncreation of a non-blocking socket.  (Contributed by Donghee Na in\nbpo-39259(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39259\n\nFile: python3.12.info,  Node: pprint<2>,  Next: pydoc,  Prev: poplib,  Up: Improved Modules<4>\n\n1.4.6.25 pprint\n...............\n\n*note pprint: a9. can now pretty-print *note types.SimpleNamespace: 745.\n(Contributed by Carl Bordum Hansen in bpo-37376(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=37376\n\nFile: python3.12.info,  Node: pydoc,  Next: random<2>,  Prev: pprint<2>,  Up: Improved Modules<4>\n\n1.4.6.26 pydoc\n..............\n",
            "subsections": []
        },
        "The documentation string is now shown not only for class, function,": {
            "content": "method etc, but for any object that has its own 'doc' attribute.\n(Contributed by Serhiy Storchaka in bpo-40257(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40257\n\nFile: python3.12.info,  Node: random<2>,  Next: signal,  Prev: pydoc,  Up: Improved Modules<4>\n\n1.4.6.27 random\n...............\n\nAdded a new 'random.Random.randbytes' method: generate random bytes.\n(Contributed by Victor Stinner in bpo-40286(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40286\n\nFile: python3.12.info,  Node: signal,  Next: smtplib,  Prev: random<2>,  Up: Improved Modules<4>\n\n1.4.6.28 signal\n...............\n\nExposed the Linux-specific *note signal.pidfdsendsignal(): 749. for\nsending to signals to a process using a file descriptor instead of a\npid.  (bpo-38712(1))\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38712\n\nFile: python3.12.info,  Node: smtplib,  Next: socket<3>,  Prev: signal,  Up: Improved Modules<4>\n\n1.4.6.29 smtplib\n................\n\n*note SMTP: 74b. and *note SMTPSSL: 74c. now raise a *note ValueError:\n183. if the given timeout for their constructor is zero to prevent the\ncreation of a non-blocking socket.  (Contributed by Donghee Na in\nbpo-39259(1).)\n\n*note LMTP: 74d. constructor now has an optional 'timeout' parameter.\n(Contributed by Donghee Na in bpo-39329(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39259\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=39329\n\nFile: python3.12.info,  Node: socket<3>,  Next: time<2>,  Prev: smtplib,  Up: Improved Modules<4>\n\n1.4.6.30 socket\n...............\n\nThe *note socket: c6. module now exports the *note CANRAWJOINFILTERS:\n74f. constant on Linux 4.1 and greater.  (Contributed by Stefan",
            "subsections": []
        },
        "Tatschner and Zackery Spytz in bpo-25780(1).)": {
            "content": "The socket module now supports the *note CANJ1939: 750. protocol on\nplatforms that support it.  (Contributed by Karl Ding in bpo-40291(2).)\n\nThe socket module now has the *note socket.sendfds(): 751. and *note\nsocket.recvfds(): 752. functions.  (Contributed by Joannah Nanjekye,",
            "subsections": []
        },
        "Shinya Okano and Victor Stinner in bpo-28724(3).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25780\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=40291\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=28724\n\nFile: python3.12.info,  Node: time<2>,  Next: sys<4>,  Prev: socket<3>,  Up: Improved Modules<4>\n\n1.4.6.31 time\n.............\n\nOn AIX, *note threadtime(): 754. is now implemented with\n'threadcputime()' which has nanosecond resolution, rather than\n'clockgettime(CLOCKTHREADCPUTIMEID)' which has a resolution of 10\nmilliseconds.  (Contributed by Batuhan Taskaya in bpo-40192(1))\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40192\n\nFile: python3.12.info,  Node: sys<4>,  Next: tracemalloc,  Prev: time<2>,  Up: Improved Modules<4>\n\n1.4.6.32 sys\n............\n\nAdded a new *note sys.platlibdir: 756. attribute: name of the\nplatform-specific library directory.  It is used to build the path of\nstandard library and the paths of installed extension modules.  It is\nequal to '\"lib\"' on most platforms.  On Fedora and SuSE, it is equal to\n'\"lib64\"' on 64-bit platforms.  (Contributed by Jan Mat??jek, Mat??j Cepl,",
            "subsections": []
        },
        "Charalampos Stratakis and Victor Stinner in bpo-1294959(1).)": {
            "content": "Previously, *note sys.stderr: 757. was block-buffered when\nnon-interactive.  Now 'stderr' defaults to always being line-buffered.\n(Contributed by Jendrik Seipp in bpo-13601(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=1294959\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=13601\n\nFile: python3.12.info,  Node: tracemalloc,  Next: typing<4>,  Prev: sys<4>,  Up: Improved Modules<4>\n\n1.4.6.33 tracemalloc\n....................\n\nAdded *note tracemalloc.resetpeak(): 759. to set the peak size of\ntraced memory blocks to the current size, to measure the peak of\nspecific pieces of code.  (Contributed by Huon Wilson in bpo-40630(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40630\n\nFile: python3.12.info,  Node: typing<4>,  Next: unicodedata<3>,  Prev: tracemalloc,  Up: Improved Modules<4>\n\n1.4.6.34 typing\n...............\n\nPEP 593(1) introduced an *note typing.Annotated: 75b. type to decorate\nexisting types with context-specific metadata and new 'includeextras'\nparameter to *note typing.gettypehints(): 47f. to access the metadata\nat runtime.  (Contributed by Till Varoquaux and Konstantin Kashin.)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0593/\n\nFile: python3.12.info,  Node: unicodedata<3>,  Next: venv<2>,  Prev: typing<4>,  Up: Improved Modules<4>\n\n1.4.6.35 unicodedata\n....................\n\nThe Unicode database has been updated to version 13.0.0.\n(bpo-39926(1)).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39926\n\nFile: python3.12.info,  Node: venv<2>,  Next: xml<2>,  Prev: unicodedata<3>,  Up: Improved Modules<4>\n\n1.4.6.36 venv\n.............\n\nThe activation scripts provided by *note venv: 10c. now all specify\ntheir prompt customization consistently by always using the value\nspecified by 'VENVPROMPT'.  Previously some scripts unconditionally\nused 'VENVPROMPT', others only if it happened to be set (which was\nthe default case), and one used 'VENVNAME' instead.  (Contributed\nby Brett Cannon in bpo-37663(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=37663\n\nFile: python3.12.info,  Node: xml<2>,  Prev: venv<2>,  Up: Improved Modules<4>\n\n1.4.6.37 xml\n............\n",
            "subsections": []
        },
        "White space characters within attributes are now preserved when": {
            "content": "serializing *note xml.etree.ElementTree: 120. to XML file.  EOLNs are no\nlonger normalized to \"n\".  This is the result of discussion about how to\ninterpret section 2.11 of XML spec.  (Contributed by Mefistotelis in\nbpo-39011(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39011\n\nFile: python3.12.info,  Node: Optimizations<4>,  Next: Deprecated<7>,  Prev: Improved Modules<4>,  Up: What's New In Python 3 9\n\n\n* Optimized the idiom for assignment a temporary variable in\ncomprehensions.  Now 'for y in [expr]' in comprehensions is as fast\nas a simple assignment 'y = expr'.  For example:\n\nsums = [s for s in [0] for x in data for s in [s + x]]\n\nUnlike the ':=' operator this idiom does not leak a variable to the\nouter scope.\n\n(Contributed by Serhiy Storchaka in bpo-32856(1).)\n\n* Optimized signal handling in multithreaded applications.  If a\nthread different than the main thread gets a signal, the bytecode\nevaluation loop is no longer interrupted at each bytecode\ninstruction to check for pending signals which cannot be handled.\nOnly the main thread of the main interpreter can handle signals.\n\nPreviously, the bytecode evaluation loop was interrupted at each\ninstruction until the main thread handles signals.  (Contributed by\nVictor Stinner in bpo-40010(2).)\n\n* Optimized the *note subprocess: d0. module on FreeBSD using\n'closefrom()'.  (Contributed by Ed Maste, Conrad Meyer, Kyle Evans,\nKubilay Kocak and Victor Stinner in bpo-38061(3).)\n\n* *note PyLongFromDouble(): 760. is now up to 1.87x faster for\nvalues that fit into long.  (Contributed by Sergey Fedoseev in\nbpo-37986(4).)\n\n* A number of Python builtins (*note range: 761, *note tuple: 4b8,\n*note set: 39d, *note frozenset: 39e, *note list: 3dc, *note dict:\n237.) are now sped up by using PEP 590(5) vectorcall protocol.\n(Contributed by Donghee Na, Mark Shannon, Jeroen Demeyer and Petr\nViktorin in bpo-37207(6).)\n\n* Optimized 'differenceupdate()' for the case when the other set is\nmuch larger than the base set.  (Suggested by Evgeny Kapun with\ncode contributed by Michele Orr?? in bpo-8425(7).)\n\n* Python's small object allocator ('obmalloc.c') now allows (no more\nthan) one empty arena to remain available for immediate reuse,\nwithout returning it to the OS. This prevents thrashing in simple\nloops where an arena could be created and destroyed anew on each\niteration.  (Contributed by Tim Peters in bpo-37257(8).)\n\n* *note floor division: 762. of float operation now has a better\nperformance.  Also the message of *note ZeroDivisionError: 763. for\nthis operation is updated.  (Contributed by Donghee Na in\nbpo-39434(9).)\n\n* Decoding short ASCII strings with UTF-8 and ascii codecs is now\nabout 15% faster.  (Contributed by Inada Naoki in bpo-37348(10).)\n",
            "subsections": []
        },
        "Here's a summary of performance improvements from Python 3.4 through": {
            "content": "Python 3.9:\n\nPython version                       3.4     3.5     3.6     3.7     3.8    3.9\n--------------                       ---     ---     ---     ---     ---    ---\n\nVariable and attribute read access:\nreadlocal                       7.1     7.1     5.4     5.1     3.9    3.9\nreadnonlocal                    7.1     8.1     5.8     5.4     4.4    4.5\nreadglobal                     15.5    19.0    14.3    13.6     7.6    7.8\nreadbuiltin                    21.1    21.6    18.5    19.0     7.5    7.8\nreadclassvarfromclass        25.6    26.5    20.7    19.5    18.4   17.9\nreadclassvarfrominstance     22.8    23.5    18.8    17.1    16.4   16.9\nreadinstancevar                32.4    33.1    28.0    26.3    25.4   25.3\nreadinstancevarslots          27.8    31.3    20.8    20.8    20.2   20.5\nreadnamedtuple                 73.8    57.5    45.0    46.8    18.4   18.7\nreadboundmethod                37.6    37.9    29.6    26.9    27.7   41.1\n\nVariable and attribute write access:\nwritelocal                      8.7     9.3     5.5     5.3     4.3    4.3\nwritenonlocal                  10.5    11.1     5.6     5.5     4.7    4.8\nwriteglobal                    19.7    21.2    18.0    18.0    15.8   16.7\nwriteclassvar                  92.9    96.0   104.6   102.1    39.2   39.8\nwriteinstancevar               44.6    45.8    40.0    38.9    35.5   37.4\nwriteinstancevarslots         35.6    36.1    27.3    26.6    25.7   25.8\n\nData structure read access:\nreadlist                       24.2    24.5    20.8    20.8    19.0   19.5\nreaddeque                      24.7    25.5    20.2    20.6    19.8   20.2\nreaddict                       24.3    25.7    22.3    23.0    21.0   22.4\nreadstrdict                    22.6    24.3    19.5    21.2    18.9   21.5\n\nData structure write access:\nwritelist                      27.1    28.5    22.5    21.6    20.0   20.0\nwritedeque                     28.7    30.1    22.7    21.8    23.5   21.7\nwritedict                      31.4    33.3    29.3    29.2    24.7   25.4\nwritestrdict                   28.4    29.9    27.5    25.2    23.1   24.5\n\nStack (or queue) operations:\nlistappendpop                 93.4   112.7    75.4    74.2    50.8   50.6\ndequeappendpop                43.5    57.0    49.4    49.2    42.5   44.2\ndequeappendpopleft            43.7    57.3    49.7    49.7    42.8   46.4\n\nTiming loop:\nloopoverhead                    0.5     0.6     0.4     0.3     0.3    0.3\n",
            "subsections": []
        },
        "These results were generated from the variable access benchmark script": {
            "content": "at: 'Tools/scripts/varaccessbenchmark.py'.  The benchmark script\ndisplays timings in nanoseconds.  The benchmarks were measured on an\nIntel?? Core??? i7-4960HQ processor(11) running the macOS 64-bit builds\nfound at python.org(12).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32856\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=40010\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=38061\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=37986\n\n(5) https://peps.python.org/pep-0590/\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=37207\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=8425\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=37257\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=39434\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=37348\n\n(11)\nhttps://ark.intel.com/content/www/us/en/ark/products/76088/intel-core-i7-4960hq-processor-6m-cache-up-to-3-80-ghz.html\n\n(12) https://www.python.org/downloads/macos/\n\nFile: python3.12.info,  Node: Deprecated<7>,  Next: Removed<7>,  Prev: Optimizations<4>,  Up: What's New In Python 3 9\n\n\n* The distutils 'bdistmsi' command is now deprecated, use\n'bdistwheel' (wheel packages) instead.  (Contributed by Hugo van\nKemenade in bpo-39586(1).)\n\n* Currently *note math.factorial(): 765. accepts *note float: 4b7.\ninstances with non-negative integer values (like '5.0').  It raises\na *note ValueError: 183. for non-integral and negative floats.  It\nis now deprecated.  In future Python versions it will raise a *note\nTypeError: 28e. for all floats.  (Contributed by Serhiy Storchaka\nin bpo-37315(2).)\n\n* The 'parser' and 'symbol' modules are deprecated and will be\nremoved in future versions of Python.  For the majority of use\ncases, users can leverage the Abstract Syntax Tree (AST) generation\nand compilation stage, using the *note ast: 8. module.\n\n* The Public C API functions 'PyParserSimpleParseStringFlags()',\n'PyParserSimpleParseStringFlagsFilename()',\n'PyParserSimpleParseFileFlags()' and 'PyNodeCompile()' are\ndeprecated and will be removed in Python 3.10 together with the old\nparser.\n\n* Using *note NotImplemented: 5c5. in a boolean context has been\ndeprecated, as it is almost exclusively the result of incorrect\nrich comparator implementations.  It will be made a *note\nTypeError: 28e. in a future version of Python.  (Contributed by\nJosh Rosenberg in bpo-35712(3).)\n\n* The *note random: b3. module currently accepts any hashable type as\na possible seed value.  Unfortunately, some of those types are not\nguaranteed to have a deterministic hash value.  After Python 3.9,\nthe module will restrict its seeds to *note None: 43f, *note int:\n17e, *note float: 4b7, *note str: 157, *note bytes: 295, and *note\nbytearray: 294.\n\n* Opening the *note GzipFile: 25e. file for writing without\nspecifying the 'mode' argument is deprecated.  In future Python\nversions it will always be opened for reading by default.  Specify\nthe 'mode' argument for opening it for writing and silencing a\nwarning.  (Contributed by Serhiy Storchaka in bpo-28286(4).)\n\n* Deprecated the 'split()' method of 'tkinter.TkappType' in favour\nof the 'splitlist()' method which has more consistent and\npredicable behavior.  (Contributed by Serhiy Storchaka in\nbpo-38371(5).)\n\n* The explicit passing of coroutine objects to *note asyncio.wait():\n19a. has been deprecated and will be removed in version 3.11.\n(Contributed by Yury Selivanov and Kyle Stanley in bpo-34790(6).)\n\n* binhex4 and hexbin4 standards are now deprecated.  The 'binhex'\nmodule and the following *note binascii: e. functions are now\ndeprecated:\n\n* 'b2ahqx()', 'a2bhqx()'\n\n* 'rlecodehqx()', 'rledecodehqx()'\n\n(Contributed by Victor Stinner in bpo-39353(7).)\n\n* *note ast: 8. classes 'slice', 'Index' and 'ExtSlice' are\nconsidered deprecated and will be removed in future Python\nversions.  'value' itself should be used instead of 'Index(value)'.\n'Tuple(slices, Load())' should be used instead of\n'ExtSlice(slices)'.  (Contributed by Serhiy Storchaka in\nbpo-34822(8).)\n\n* *note ast: 8. classes 'Suite', 'Param', 'AugLoad' and 'AugStore'\nare considered deprecated and will be removed in future Python\nversions.  They were not generated by the parser and not accepted\nby the code generator in Python 3.  (Contributed by Batuhan Taskaya\nin bpo-39639(9) and bpo-39969(10) and Serhiy Storchaka in\nbpo-39988(11).)\n\n* The 'PyEvalInitThreads()' and 'PyEvalThreadsInitialized()'\nfunctions are now deprecated and will be removed in Python 3.11.\nCalling 'PyEvalInitThreads()' now does nothing.  The *note GIL:\n6c0. is initialized by *note PyInitialize(): 6c2. since Python\n3.7.  (Contributed by Victor Stinner in bpo-39877(12).)\n\n* Passing 'None' as the first argument to the *note shlex.split():\n292. function has been deprecated.  (Contributed by Zackery Spytz\nin bpo-33262(13).)\n\n* 'smtpd.MailmanProxy()' is now deprecated as it is unusable without\nan external module, 'mailman'.  (Contributed by Samuel Colvin in\nbpo-35800(14).)\n\n* The *note lib2to3: 7f. module now emits a *note\nPendingDeprecationWarning: 6e0.  Python 3.9 switched to a PEG\nparser (see PEP 617(15)), and Python 3.10 may include new language\nsyntax that is not parsable by lib2to3's LL(1) parser.  The\n'lib2to3' module may be removed from the standard library in a\nfuture Python version.  Consider third-party alternatives such as\nLibCST(16) or parso(17).  (Contributed by Carl Meyer in\nbpo-40360(18).)\n\n* The 'random' parameter of *note random.shuffle(): 52e. has been\ndeprecated.  (Contributed by Raymond Hettinger in bpo-40465(19))\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39586\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=37315\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=35712\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=28286\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=38371\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=34790\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=39353\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=34822\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=39639\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=39969\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=39988\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=39877\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=33262\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=35800\n\n(15) https://peps.python.org/pep-0617/\n\n(16) https://libcst.readthedocs.io/\n\n(17) https://parso.readthedocs.io/\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=40360\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=40465\n\nFile: python3.12.info,  Node: Removed<7>,  Next: Porting to Python 3 9,  Prev: Deprecated<7>,  Up: What's New In Python 3 9\n\n\n* The erroneous version at 'unittest.mock.version' has been\nremoved.\n\n* *note nntplib.NNTP: 733.: 'xpath()' and 'xgtitle()' methods have\nbeen removed.  These methods are deprecated since Python 3.3.\nGenerally, these extensions are not supported or not enabled by\nNNTP server administrators.  For 'xgtitle()', please use *note\nnntplib.NNTP.descriptions(): 767. or *note\nnntplib.NNTP.description(): 768. instead.  (Contributed by Donghee\nNa in bpo-39366(1).)\n\n* *note array.array: 18f.: 'tostring()' and 'fromstring()' methods\nhave been removed.  They were aliases to 'tobytes()' and\n'frombytes()', deprecated since Python 3.2.  (Contributed by Victor\nStinner in bpo-38916(2).)\n\n* The undocumented 'sys.callstats()' function has been removed.\nSince Python 3.7, it was deprecated and always returned *note None:\n43f.  It required a special build option 'CALLPROFILE' which was\nalready removed in Python 3.7.  (Contributed by Victor Stinner in\nbpo-37414(3).)\n\n* The 'sys.getcheckinterval()' and 'sys.setcheckinterval()' functions\nhave been removed.  They were deprecated since Python 3.2.  Use\n*note sys.getswitchinterval(): 769. and *note\nsys.setswitchinterval(): 76a. instead.  (Contributed by Victor\nStinner in bpo-37392(4).)\n\n* The C function 'PyImportCleanup()' has been removed.  It was\ndocumented as: \"Empty the module table.  For internal use only.\"\n(Contributed by Victor Stinner in bpo-36710(5).)\n\n* 'dummythread' and 'dummythreading' modules have been removed.\nThese modules were deprecated since Python 3.7 which requires\nthreading support.  (Contributed by Victor Stinner in\nbpo-37312(6).)\n\n* 'aifc.openfp()' alias to 'aifc.open()', 'sunau.openfp()' alias to\n'sunau.open()', and 'wave.openfp()' alias to *note wave.open():\n76b. have been removed.  They were deprecated since Python 3.7.\n(Contributed by Victor Stinner in bpo-37320(7).)\n\n* The 'isAlive()' method of *note threading.Thread: 76c. has been\nremoved.  It was deprecated since Python 3.8.  Use *note\nisalive(): 76d. instead.  (Contributed by Donghee Na in\nbpo-37804(8).)\n\n* Methods 'getchildren()' and 'getiterator()' of classes *note\nElementTree: 76e. and *note Element: 23e. in the *note ElementTree:\n120. module have been removed.  They were deprecated in Python 3.2.\nUse 'iter(x)' or 'list(x)' instead of 'x.getchildren()' and\n'x.iter()' or 'list(x.iter())' instead of 'x.getiterator()'.\n(Contributed by Serhiy Storchaka in bpo-36543(9).)\n\n* The old *note plistlib: a6. API has been removed, it was deprecated\nsince Python 3.4.  Use the *note load(): 76f, *note loads(): 770,\n*note dump(): 771, and *note dumps(): 772. functions.\nAdditionally, the 'usebuiltintypes' parameter was removed,\nstandard *note bytes: 295. objects are always used instead.\n(Contributed by Jon Janzen in bpo-36409(10).)\n\n* The C function 'PyGenNeedsFinalizing' has been removed.  It was\nnot documented, tested, or used anywhere within CPython after the\nimplementation of PEP 442(11).  Patch by Joannah Nanjekye.\n(Contributed by Joannah Nanjekye in bpo-15088(12))\n\n* 'base64.encodestring()' and 'base64.decodestring()', aliases\ndeprecated since Python 3.1, have been removed: use *note\nbase64.encodebytes(): 773. and *note base64.decodebytes(): 774.\ninstead.  (Contributed by Victor Stinner in bpo-39351(13).)\n\n* 'fractions.gcd()' function has been removed, it was deprecated\nsince Python 3.5 (bpo-22486(14)): use *note math.gcd(): 72c.\ninstead.  (Contributed by Victor Stinner in bpo-39350(15).)\n\n* The 'buffering' parameter of *note bz2.BZ2File: 775. has been\nremoved.  Since Python 3.0, it was ignored and using it emitted a\n*note DeprecationWarning: 179.  Pass an open file object to control\nhow the file is opened.  (Contributed by Victor Stinner in\nbpo-39357(16).)\n\n* The 'encoding' parameter of *note json.loads(): 776. has been\nremoved.  As of Python 3.1, it was deprecated and ignored; using it\nhas emitted a *note DeprecationWarning: 179. since Python 3.8.\n(Contributed by Inada Naoki in bpo-39377(17))\n\n* 'with (await asyncio.lock):' and 'with (yield from asyncio.lock):'\nstatements are not longer supported, use 'async with lock' instead.\nThe same is correct for 'asyncio.Condition' and\n'asyncio.Semaphore'.  (Contributed by Andrew Svetlov in\nbpo-34793(18).)\n\n* The 'sys.getcounts()' function, the '-X showalloccount' command\nline option and the 'showalloccount' field of the C structure\n*note PyConfig: 318. have been removed.  They required a special\nPython build by defining 'COUNTALLOCS' macro.  (Contributed by\nVictor Stinner in bpo-39489(19).)\n\n* The 'fieldtypes' attribute of the *note typing.NamedTuple: 1f9.\nclass has been removed.  It was deprecated since Python 3.8.  Use\nthe 'annotations' attribute instead.  (Contributed by Serhiy\nStorchaka in bpo-40182(20).)\n\n* The 'symtable.SymbolTable.hasexec()' method has been removed.  It\nwas deprecated since 2006, and only returning 'False' when it's\ncalled.  (Contributed by Batuhan Taskaya in bpo-40208(21))\n\n* The 'asyncio.Task.currenttask()' and 'asyncio.Task.alltasks()'\nhave been removed.  They were deprecated since Python 3.7 and you\ncan use *note asyncio.currenttask(): 198. and *note\nasyncio.alltasks(): 777. instead.  (Contributed by Re'mi Lapeyre in\nbpo-40967(22))\n\n* The 'unescape()' method in the *note html.parser.HTMLParser: 682.\nclass has been removed (it was deprecated since Python 3.4).  *note\nhtml.unescape(): 778. should be used for converting character\nreferences to the corresponding unicode characters.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39366\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=38916\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=37414\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=37392\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=36710\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=37312\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=37320\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=37804\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=36543\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=36409\n\n(11) https://peps.python.org/pep-0442/\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=15088\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=39351\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=22486\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=39350\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=39357\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=39377\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=34793\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=39489\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=40182\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=40208\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=40967\n\nFile: python3.12.info,  Node: Porting to Python 3 9,  Next: Build Changes<4>,  Prev: Removed<7>,  Up: What's New In Python 3 9\n\n",
            "subsections": []
        },
        "As of 3.9.1, Python now fully supports building and running on macOS": {
            "content": "11.0 (Big Sur) and on Apple Silicon Macs (based on the 'ARM64'\narchitecture).  A new universal build variant, 'universal2', is now\navailable to natively support both 'ARM64' and 'Intel 64' in one set of\nexecutables.  Binaries can also now be built on current versions of\nmacOS to be deployed on a range of older macOS versions (tested to 10.9)\nwhile making some newer OS functions and options conditionally available\nbased on the operating system version in use at runtime (\"weaklinking\").\n\n(Contributed by Ronald Oussoren and Lawrence D'Anna in bpo-41100(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=41100\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "* Menu:\n\n* collections.abc: collections abc<2>.\n* urllib.parse: urllib parse<2>.\n\nFile: python3.12.info,  Node: collections abc<2>,  Next: urllib parse<2>,  Up: Notable changes in Python 3 9 2\n\n1.4.14.1 collections.abc\n........................\n\n*note collections.abc.Callable: 5de. generic now flattens type\nparameters, similar to what *note typing.Callable: 5b8. currently does.\nThis means that 'collections.abc.Callable[[int, str], str]' will have\n'args' of '(int, str, str)'; previously this was '([int, str],\nstr)'.  To allow this change, *note types.GenericAlias: 5df. can now be\nsubclassed, and a subclass will be returned when subscripting the *note\ncollections.abc.Callable: 5de. type.  Code which accesses the arguments\nvia *note typing.getargs(): 68a. or 'args' need to account for this\nchange.  A *note DeprecationWarning: 179. may be emitted for invalid\nforms of parameterizing *note collections.abc.Callable: 5de. which may\nhave passed silently in Python 3.9.1.  This *note DeprecationWarning:\n179. will become a *note TypeError: 28e. in Python 3.10.  (Contributed\nby Ken Jin in bpo-42195(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42195\n\nFile: python3.12.info,  Node: urllib parse<2>,  Prev: collections abc<2>,  Up: Notable changes in Python 3 9 2\n\n1.4.14.2 urllib.parse\n.....................\n\nEarlier Python versions allowed using both ';' and '&' as query\nparameter separators in *note urllib.parse.parseqs(): 651. and *note\nurllib.parse.parseqsl(): 652.  Due to security concerns, and to conform\nwith newer W3C recommendations, this has been changed to allow only a\nsingle separator key, with '&' as the default.  This change also affects\n*note cgi.parse(): 653. and *note cgi.parsemultipart(): 654. as they\nuse the affected functions internally.  For more details, please see\ntheir respective documentation.  (Contributed by Adam Goldschmidt,",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "A security fix alters the *note ftplib.FTP: 715. behavior to not trust\nthe IPv4 address sent from the remote server when setting up a passive\ndata channel.  We reuse the ftp server IP address instead.  For unusual\ncode requiring the old behavior, set a 'trustserverpasvipv4address'\nattribute on your FTP instance to 'True'.  (See gh-87451(1))\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/87451\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "* Menu:\n\n* urllib.parse: urllib parse<3>.\n\nFile: python3.12.info,  Node: urllib parse<3>,  Up: Notable changes in Python 3 9 5\n\n1.4.16.1 urllib.parse\n.....................\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "Converting between *note int: 17e. and *note str: 157. in bases other\nthan 2 (binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10\n(decimal) now raises a *note ValueError: 183. if the number of digits in\nstring form is above a limit to avoid potential denial of service\nattacks due to the algorithmic complexity.  This is a mitigation for\nCVE-2020-10735(1).  This limit can be configured or disabled by\nenvironment variable, command line flag, or *note sys: d3. APIs.  See\nthe *note integer string conversion length limitation: 3bc.\ndocumentation.  The default limit is 4300 digits in string form.\n\n---------- Footnotes ----------\n\n(1) https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-10735\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Notable changes in 3 9 17,  Prev: Notable security feature in 3 9 14,  Up: What's New In Python 3 9": {
            "content": "* Menu:\n\n* tarfile: tarfile<4>.\n\nFile: python3.12.info,  Node: tarfile<4>,  Up: Notable changes in 3 9 17\n\n1.4.18.1 tarfile\n................\n\n* The extraction methods in *note tarfile: d8, and *note\nshutil.unpackarchive(): 184, have a new a 'filter' argument that\nallows limiting tar features than may be surprising or dangerous,\nsuch as creating files outside the destination directory.  See\n*note Extraction filters: 185. for details.  In Python 3.12, use\nwithout the 'filter' argument will show a *note DeprecationWarning:\n179.  In Python 3.14, the default will switch to ''data''.\n(Contributed by Petr Viktorin in PEP 706(1).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0706/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": [
                {
                    "name": "1.5 What's New In Python 3.8",
                    "content": ""
                }
            ]
        },
        "Editor: Raymond Hettinger": {
            "content": "This article explains the new features in Python 3.8, compared to 3.7.",
            "subsections": []
        },
        "Python 3.8 was released on October 14, 2019.  For full details, see the": {
            "content": "*note changelog: 136.\n\n* Menu:\n\n* Summary - Release highlights: Summary - Release highlights<5>.\n* New Features: New Features<9>.\n* Other Language Changes: Other Language Changes<5>.\n* New Modules: New Modules<5>.\n* Improved Modules: Improved Modules<5>.\n* Optimizations: Optimizations<5>.\n* Build and C API Changes::\n* Deprecated: Deprecated<8>.\n* API and Feature Removals::\n* Porting to Python 3.8: Porting to Python 3 8.\n* Notable changes in Python 3.8.1: Notable changes in Python 3 8 1.\n* Notable changes in Python 3.8.2: Notable changes in Python 3 8 2.\n* Notable changes in Python 3.8.3: Notable changes in Python 3 8 3.\n* Notable changes in Python 3.8.8: Notable changes in Python 3 8 8.\n* Notable changes in Python 3.8.9: Notable changes in Python 3 8 9.\n* Notable changes in Python 3.8.10: Notable changes in Python 3 8 10.\n* Notable changes in Python 3.8.10: Notable changes in Python 3 8 10<2>.\n* Notable changes in Python 3.8.12: Notable changes in Python 3 8 12.\n* Notable security feature in 3.8.14: Notable security feature in 3 8 14.\n* Notable changes in 3.8.17: Notable changes in 3 8 17.\n\nFile: python3.12.info,  Node: Summary - Release highlights<5>,  Next: New Features<9>,  Up: What's New In Python 3 8\n\n\nFile: python3.12.info,  Node: New Features<9>,  Next: Other Language Changes<5>,  Prev: Summary - Release highlights<5>,  Up: What's New In Python 3 8\n\n\n* Menu:\n\n* Assignment expressions::\n* Positional-only parameters::\n* Parallel filesystem cache for compiled bytecode files::\n* Debug build uses the same ABI as release build::\n* f-strings support = for self-documenting expressions and debugging::\n* PEP 578; Python Runtime Audit Hooks: PEP 578 Python Runtime Audit Hooks.\n* PEP 587; Python Initialization Configuration: PEP 587 Python Initialization Configuration.\n* PEP 590; Vectorcall; a fast calling protocol for CPython: PEP 590 Vectorcall a fast calling protocol for CPython.\n* Pickle protocol 5 with out-of-band data buffers::\n\nFile: python3.12.info,  Node: Assignment expressions,  Next: Positional-only parameters,  Up: New Features<9>\n\n1.5.2.1 Assignment expressions\n..............................\n\nThere is new syntax ':=' that assigns values to variables as part of a\nlarger expression.  It is affectionately known as \"the walrus operator\"\ndue to its resemblance to the eyes and tusks of a walrus(1).\n\nIn this example, the assignment expression helps avoid calling *note\nlen(): 3fb. twice:\n\nif (n := len(a)) > 10:\nprint(f\"List is too long ({n} elements, expected <= 10)\")\n\nA similar benefit arises during regular expression matching where match\nobjects are needed twice, once to test whether a match occurred and\nanother to extract a subgroup:\n\ndiscount = 0.0\nif (mo := re.search(r'(\\d+)% discount', advertisement)):\ndiscount = float(mo.group(1)) / 100.0\n",
            "subsections": []
        },
        "The operator is also useful with while-loops that compute a value to": {
            "content": "test loop termination and then need that same value again in the body of\nthe loop:\n\n# Loop over fixed length blocks\nwhile (block := f.read(256)) != '':\nprocess(block)\n",
            "subsections": []
        },
        "Another motivating use case arises in list comprehensions where a value": {
            "content": "computed in a filtering condition is also needed in the expression body:\n\n[cleanname.title() for name in names\nif (cleanname := normalize('NFC', name)) in allowednames]\n",
            "subsections": []
        },
        "Try to limit use of the walrus operator to clean cases that reduce": {
            "content": "complexity and improve readability.\n\nSee PEP 572(2) for a full description.\n\n(Contributed by Emily Morehouse in bpo-35224(3).)\n\n---------- Footnotes ----------\n\n(1)\nhttps://en.wikipedia.org/wiki/Walrus#/media/File:PacificWalrus-Bull(8247646168).jpg\n\n(2) https://peps.python.org/pep-0572/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=35224\n\nFile: python3.12.info,  Node: Positional-only parameters,  Next: Parallel filesystem cache for compiled bytecode files,  Prev: Assignment expressions,  Up: New Features<9>\n\n1.5.2.2 Positional-only parameters\n..................................\n",
            "subsections": []
        },
        "There is a new function parameter syntax '/' to indicate that some": {
            "content": "function parameters must be specified positionally and cannot be used as\nkeyword arguments.  This is the same notation shown by 'help()' for C\nfunctions annotated with Larry Hastings' Argument Clinic(1) tool.\n",
            "subsections": []
        },
        "In the following example, parameters 'a' and 'b' are positional-only,": {
            "content": "while 'c' or 'd' can be positional or keyword, and 'e' or 'f' are\nrequired to be keywords:\n\ndef f(a, b, /, c, d, *, e, f):\nprint(a, b, c, d, e, f)\n\nThe following is a valid call:\n\nf(10, 20, 30, d=40, e=50, f=60)\n\nHowever, these are invalid calls:\n\nf(10, b=20, c=30, d=40, e=50, f=60)   # b cannot be a keyword argument\nf(10, 20, 30, 40, 50, f=60)           # e must be a keyword argument\n",
            "subsections": []
        },
        "One use case for this notation is that it allows pure Python functions": {
            "content": "to fully emulate behaviors of existing C coded functions.  For example,\nthe built-in *note divmod(): 7c5. function does not accept keyword\narguments:\n\ndef divmod(a, b, /):\n\"Emulate the built in divmod() function\"\nreturn (a // b, a % b)\n",
            "subsections": []
        },
        "Another use case is to preclude keyword arguments when the parameter": {
            "content": "name is not helpful.  For example, the builtin *note len(): 3fb.\nfunction has the signature 'len(obj, /)'.  This precludes awkward calls\nsuch as:\n\nlen(obj='hello')  # The \"obj\" keyword argument impairs readability\n\nA further benefit of marking a parameter as positional-only is that it\nallows the parameter name to be changed in the future without risk of\nbreaking client code.  For example, in the *note statistics: cc. module,\nthe parameter name 'dist' may be changed in the future.  This was made\npossible with the following function specification:\n\ndef quantiles(dist, /, *, n=4, method='exclusive')\n...\n",
            "subsections": []
        },
        "Since the parameters to the left of '/' are not exposed as possible": {
            "content": "keywords, the parameters names remain available for use in 'kwargs':\n\n>>> def f(a, b, /, kwargs):\n...     print(a, b, kwargs)\n...\n>>> f(10, 20, a=1, b=2, c=3)         # a and b are used in two ways\n10 20 {'a': 1, 'b': 2, 'c': 3}\n",
            "subsections": []
        },
        "This greatly simplifies the implementation of functions and methods that": {
            "content": "need to accept arbitrary keyword arguments.  For example, here is an\nexcerpt from code in the *note collections: 1b. module:\n\nclass Counter(dict):\n\ndef init(self, iterable=None, /, kwds):\n# Note \"iterable\" is a possible keyword argument\n\nSee PEP 570(2) for a full description.\n\n(Contributed by Pablo Galindo in bpo-36540(3).)\n\n---------- Footnotes ----------\n\n(1) https://devguide.python.org/development-tools/clinic/\n\n(2) https://peps.python.org/pep-0570/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=36540\n\nFile: python3.12.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<9>\n\n1.5.2.3 Parallel filesystem cache for compiled bytecode files\n.............................................................\n\nThe new *note PYTHONPYCACHEPREFIX: 7c7. setting (also available as *note\n-X: 188. 'pycacheprefix') configures the implicit bytecode cache to use\na separate parallel filesystem tree, rather than the default\n'pycache' subdirectories within each source directory.\n\nThe location of the cache is reported in *note sys.pycacheprefix: 7c8.\n(*note None: 43f. indicates the default location in 'pycache'\nsubdirectories).\n\n(Contributed by Carl Meyer in bpo-33499(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33499\n\nFile: python3.12.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<9>\n\n1.5.2.4 Debug build uses the same ABI as release build\n......................................................\n",
            "subsections": []
        },
        "Python now uses the same ABI whether it's built in release or debug": {
            "content": "mode.  On Unix, when Python is built in debug mode, it is now possible\nto load C extensions built in release mode and C extensions built using\nthe stable ABI.\n\nRelease builds and *note debug builds: 67f. are now ABI compatible:\ndefining the 'PyDEBUG' macro no longer implies the 'PyTRACEREFS'\nmacro, which introduces the only ABI incompatibility.  The\n'PyTRACEREFS' macro, which adds the 'sys.getobjects()' function and\nthe *note PYTHONDUMPREFS: 7ca. environment variable, can be set using\nthe new *note ./configure -with-trace-refs: 6b2. build option.\n(Contributed by Victor Stinner in bpo-36465(1).)\n",
            "subsections": []
        },
        "On Unix, C extensions are no longer linked to libpython except on": {
            "content": "",
            "subsections": []
        },
        "Android and Cygwin.  It is now possible for a statically linked Python": {
            "content": "to load a C extension built using a shared library Python.  (Contributed\nby Victor Stinner in bpo-21536(2).)\n",
            "subsections": []
        },
        "On Unix, when Python is built in debug mode, import now also looks for C": {
            "content": "extensions compiled in release mode and for C extensions compiled with\nthe stable ABI. (Contributed by Victor Stinner in bpo-36722(3).)\n",
            "subsections": []
        },
        "To embed Python into an application, a new '--embed' option must be": {
            "content": "passed to 'python3-config --libs --embed' to get '-lpython3.8' (link the\napplication to libpython).  To support both 3.8 and older, try\n'python3-config --libs --embed' first and fallback to 'python3-config\n--libs' (without '--embed') if the previous command fails.\n",
            "subsections": []
        },
        "Add a pkg-config 'python-3.8-embed' module to embed Python into an": {
            "content": "application: 'pkg-config python-3.8-embed --libs' includes\n'-lpython3.8'.  To support both 3.8 and older, try 'pkg-config\npython-X.Y-embed --libs' first and fallback to 'pkg-config python-X.Y\n--libs' (without '--embed') if the previous command fails (replace 'X.Y'\nwith the Python version).\n",
            "subsections": []
        },
        "On the other hand, 'pkg-config python3.8 --libs' no longer contains": {
            "content": "'-lpython3.8'.  C extensions must not be linked to libpython (except on",
            "subsections": []
        },
        "Android and Cygwin, whose cases are handled by the script); this change": {
            "content": "is backward incompatible on purpose.  (Contributed by Victor Stinner in\nbpo-36721(4).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36465\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=21536\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=36722\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=36721\n\nFile: python3.12.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<9>\n\n1.5.2.5 f-strings support '=' for self-documenting expressions and debugging\n............................................................................\n\nAdded an '=' specifier to *note f-string: 138.s.  An f-string such as\n'f'{expr=}'' will expand to the text of the expression, an equal sign,\nthen the representation of the evaluated expression.  For example:\n\n>>> user = 'ericidle'\n>>> membersince = date(1975, 7, 31)\n>>> f'{user=} {membersince=}'\n\"user='ericidle' membersince=datetime.date(1975, 7, 31)\"\n\nThe usual *note f-string format specifiers: 7cd. allow more control over\nhow the result of the expression is displayed:\n\n>>> delta = date.today() - membersince\n>>> f'{user=!s}  {delta.days=:,d}'\n'user=ericidle  delta.days=16,075'\n\nThe '=' specifier will display the whole expression so that calculations\ncan be shown:\n\n>>> print(f'{theta=}  {cos(radians(theta))=:.3f}')\ntheta=30  cos(radians(theta))=0.866\n\n(Contributed by Eric V. Smith and Larry Hastings in bpo-36817(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36817\n\nFile: python3.12.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<9>\n\n1.5.2.6 PEP 578: Python Runtime Audit Hooks\n...........................................\n",
            "subsections": []
        },
        "The PEP adds an Audit Hook and Verified Open Hook.  Both are available": {
            "content": "from Python and native code, allowing applications and frameworks\nwritten in pure Python code to take advantage of extra notifications,\nwhile also allowing embedders or system administrators to deploy builds\nof Python where auditing is always enabled.\n\nSee PEP 578(1) for full details.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0578/\n\nFile: python3.12.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<9>\n\n1.5.2.7 PEP 587: Python Initialization Configuration\n....................................................\n",
            "subsections": []
        },
        "The PEP 587(1) adds a new C API to configure the Python Initialization": {
            "content": "providing finer control on the whole configuration and better error\nreporting.\n\nNew structures:\n\n* *note PyConfig: 318.\n\n* *note PyPreConfig: 7d0.\n\n* *note PyStatus: 7d1.\n\n* *note PyWideStringList: 7d2.\n\nNew functions:\n\n* *note PyConfigClear(): 7d3.\n\n* *note PyConfigInitIsolatedConfig(): 7d4.\n\n* *note PyConfigInitPythonConfig(): 7d5.\n\n* *note PyConfigRead(): 57e.\n\n* *note PyConfigSetArgv(): 7d6.\n\n* *note PyConfigSetBytesArgv(): 7d7.\n\n* *note PyConfigSetBytesString(): 7d8.\n\n* *note PyConfigSetString(): 7d9.\n\n* *note PyPreConfigInitIsolatedConfig(): 7da.\n\n* *note PyPreConfigInitPythonConfig(): 7db.\n\n* *note PyStatusError(): 7dc.\n\n* *note PyStatusException(): 7dd.\n\n* *note PyStatusExit(): 7de.\n\n* *note PyStatusIsError(): 7df.\n\n* *note PyStatusIsExit(): 7e0.\n\n* *note PyStatusNoMemory(): 7e1.\n\n* *note PyStatusOk(): 7e2.\n\n* *note PyWideStringListAppend(): 7e3.\n\n* *note PyWideStringListInsert(): 7e4.\n\n* *note PyBytesMain(): 7e5.\n\n* *note PyExitStatusException(): 7e6.\n\n* *note PyInitializeFromConfig(): 317.\n\n* *note PyPreInitialize(): 316.\n\n* *note PyPreInitializeFromArgs(): 7e7.\n\n* *note PyPreInitializeFromBytesArgs(): 7e8.\n\n* *note PyRunMain(): 7e9.\n\nThis PEP also adds 'PyRuntimeState.preconfig' (*note PyPreConfig: 7d0.\ntype) and 'PyInterpreterState.config' (*note PyConfig: 318. type) fields\nto these internal structures.  'PyInterpreterState.config' becomes the\nnew reference configuration, replacing global configuration variables\nand other private variables.\n\nSee *note Python Initialization Configuration: 581. for the\ndocumentation.\n\nSee PEP 587(2) for a full description.\n\n(Contributed by Victor Stinner in bpo-36763(3).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0587/\n\n(2) https://peps.python.org/pep-0587/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=36763\n\nFile: python3.12.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<9>\n\n1.5.2.8 PEP 590: Vectorcall: a fast calling protocol for CPython\n................................................................\n\n*note The Vectorcall Protocol: 2ab. is added to the Python/C API. It is\nmeant to formalize existing optimizations which were already done for\nvarious classes.  Any *note static type: 56a. implementing a callable\ncan use this protocol.\n",
            "subsections": []
        },
        "This is currently provisional.  The aim is to make it fully public in": {
            "content": "Python 3.9.\n\nSee PEP 590(1) for a full description.\n\n(Contributed by Jeroen Demeyer, Mark Shannon and Petr Viktorin in\nbpo-36974(2).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0590/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=36974\n\nFile: python3.12.info,  Node: Pickle protocol 5 with out-of-band data buffers,  Prev: PEP 590 Vectorcall a fast calling protocol for CPython,  Up: New Features<9>\n\n1.5.2.9 Pickle protocol 5 with out-of-band data buffers\n.......................................................\n\nWhen *note pickle: a1. is used to transfer large data between Python\nprocesses in order to take advantage of multi-core or multi-machine\nprocessing, it is important to optimize the transfer by reducing memory\ncopies, and possibly by applying custom techniques such as\ndata-dependent compression.\n\nThe *note pickle: a1. protocol 5 introduces support for out-of-band\nbuffers where PEP 3118(1)-compatible data can be transmitted separately\nfrom the main pickle stream, at the discretion of the communication\nlayer.\n\nSee PEP 574(2) for a full description.\n\n(Contributed by Antoine Pitrou in bpo-36785(3).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3118/\n\n(2) https://peps.python.org/pep-0574/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=36785\n\nFile: python3.12.info,  Node: Other Language Changes<5>,  Next: New Modules<5>,  Prev: New Features<9>,  Up: What's New In Python 3 8\n\n\n* A *note continue: 7ed. statement was illegal in the *note finally:\n7ee. clause due to a problem with the implementation.  In Python\n3.8 this restriction was lifted.  (Contributed by Serhiy Storchaka\nin bpo-32489(1).)\n\n* The *note bool: 17d, *note int: 17e, and *note fractions.Fraction:\n1a8. types now have an *note asintegerratio(): 7ef. method like\nthat found in *note float: 4b7. and *note decimal.Decimal: 5c3.\nThis minor API extension makes it possible to write 'numerator,\ndenominator = x.asintegerratio()' and have it work across\nmultiple numeric types.  (Contributed by Lisa Roach in bpo-33073(2)\nand Raymond Hettinger in bpo-37819(3).)\n\n* Constructors of *note int: 17e, *note float: 4b7. and *note\ncomplex: 3ad. will now use the *note index(): 4f1. special\nmethod, if available and the corresponding method *note int():\n4f0, *note float(): 7f0. or *note complex(): 3ac. is not\navailable.  (Contributed by Serhiy Storchaka in bpo-20092(4).)\n\n* Added support of '\\N{NAME}' escapes in *note regular expressions:\nb4.:\n\n>>> notice = 'Copyright (C) 2019'\n>>> copyrightyearpattern = re.compile(r'\\N{copyright sign}\\s*(\\d{4})')\n>>> int(copyrightyearpattern.search(notice).group(1))\n2019\n\n(Contributed by Jonathan Eunice and Serhiy Storchaka in\nbpo-30688(5).)\n\n* Dict and dictviews are now iterable in reversed insertion order\nusing *note reversed(): 661.  (Contributed by Re'mi Lapeyre in\nbpo-33462(6).)\n\n* The syntax allowed for keyword names in function calls was further\nrestricted.  In particular, 'f((keyword)=arg)' is no longer\nallowed.  It was never intended to permit more than a bare name on\nthe left-hand side of a keyword argument assignment term.\n(Contributed by Benjamin Peterson in bpo-34641(7).)\n\n* Generalized iterable unpacking in *note yield: 7f1. and *note\nreturn: 7f2. statements no longer requires enclosing parentheses.\nThis brings the 'yield' and 'return' syntax into better agreement\nwith normal assignment syntax:\n\n>>> def parse(family):\nlastname, *members = family.split()\nreturn lastname.upper(), *members\n\n>>> parse('simpsons homer marge bart lisa maggie')\n('SIMPSONS', 'homer', 'marge', 'bart', 'lisa', 'maggie')\n\n(Contributed by David Cuthbert and Jordan Chapman in bpo-32117(8).)\n\n* When a comma is missed in code such as '[(10, 20) (30, 40)]', the\ncompiler displays a *note SyntaxWarning: 178. with a helpful\nsuggestion.  This improves on just having a *note TypeError: 28e.\nindicating that the first tuple was not callable.  (Contributed by\nSerhiy Storchaka in bpo-15248(9).)\n\n* Arithmetic operations between subclasses of *note datetime.date:\n70f. or *note datetime.datetime: 222. and *note datetime.timedelta:\n7f3. objects now return an instance of the subclass, rather than\nthe base class.  This also affects the return type of operations\nwhose implementation (directly or indirectly) uses *note\ndatetime.timedelta: 7f3. arithmetic, such as *note astimezone():\n7f4.  (Contributed by Paul Ganssle in bpo-32417(10).)\n\n* When the Python interpreter is interrupted by Ctrl-C (SIGINT) and\nthe resulting *note KeyboardInterrupt: 7f5. exception is not\ncaught, the Python process now exits via a SIGINT signal or with\nthe correct exit code such that the calling process can detect that\nit died due to a Ctrl-C. Shells on POSIX and Windows use this to\nproperly terminate scripts in interactive sessions.  (Contributed\nby Google via Gregory P. Smith in bpo-1054041(11).)\n\n* Some advanced styles of programming require updating the *note\ntypes.CodeType: 7f6. object for an existing function.  Since code\nobjects are immutable, a new code object needs to be created, one\nthat is modeled on the existing code object.  With 19 parameters,\nthis was somewhat tedious.  Now, the new 'replace()' method makes\nit possible to create a clone with a few altered parameters.\n\nHere's an example that alters the *note statistics.mean(): 4a1.\nfunction to prevent the 'data' parameter from being used as a\nkeyword argument:\n\n>>> from statistics import mean\n>>> mean(data=[10, 20, 90])\n40\n>>> mean.code = mean.code.replace(coposonlyargcount=1)\n>>> mean(data=[10, 20, 90])\nTraceback (most recent call last):\n...\nTypeError: mean() got some positional-only arguments passed as keyword arguments: 'data'\n\n(Contributed by Victor Stinner in bpo-37032(12).)\n\n* For integers, the three-argument form of the *note pow(): 7f7.\nfunction now permits the exponent to be negative in the case where\nthe base is relatively prime to the modulus.  It then computes a\nmodular inverse to the base when the exponent is '-1', and a\nsuitable power of that inverse for other negative exponents.  For\nexample, to compute the modular multiplicative inverse(13) of 38\nmodulo 137, write:\n\n>>> pow(38, -1, 137)\n119\n>>> 119 * 38 % 137\n1\n\nModular inverses arise in the solution of linear Diophantine\nequations(14).  For example, to find integer solutions for '4258???? +\n147???? = 369', first rewrite as '4258???? ??? 369 (mod 147)' then solve:\n\n>>> x = 369 * pow(4258, -1, 147) % 147\n>>> y = (4258 * x - 369) // -147\n>>> 4258 * x + 147 * y\n369\n\n(Contributed by Mark Dickinson in bpo-36027(15).)\n\n* Dict comprehensions have been synced-up with dict literals so that\nthe key is computed first and the value second:\n\n>>> # Dict comprehension\n>>> cast = {input('role? '): input('actor? ') for i in range(2)}\nrole? King Arthur\nactor? Chapman\nrole? Black Knight\nactor? Cleese\n\n>>> # Dict literal\n>>> cast = {input('role? '): input('actor? ')}\nrole? Sir Robin\nactor? Eric Idle\n\nThe guaranteed execution order is helpful with assignment\nexpressions because variables assigned in the key expression will\nbe available in the value expression:\n\n>>> names = ['Martin von Lo\"wis', '??ukasz Langa', 'Walter Do\"rwald']\n>>> {(n := normalize('NFC', name)).casefold() : n for name in names}\n{'martin von lo\"wis': 'Martin von Lo\"wis',\n'??ukasz langa': '??ukasz Langa',\n'walter do\"rwald': 'Walter Do\"rwald'}\n\n(Contributed by Jo\"rn Heissler in bpo-35224(16).)\n\n* The *note object.reduce(): 7f8. method can now return a tuple\nfrom two to six elements long.  Formerly, five was the limit.  The\nnew, optional sixth element is a callable with a '(obj, state)'\nsignature.  This allows the direct control over the state-updating\nbehavior of a specific object.  If not 'None', this callable will\nhave priority over the object's 'setstate()' method.\n(Contributed by Pierre Glaser and Olivier Grisel in bpo-35900(17).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32489\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=33073\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=37819\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=20092\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=30688\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=33462\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=34641\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=32117\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=15248\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=32417\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=1054041\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=37032\n\n(13) https://en.wikipedia.org/wiki/Modularmultiplicativeinverse\n\n(14) https://en.wikipedia.org/wiki/Diophantineequation\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=36027\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=35224\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=35900\n\nFile: python3.12.info,  Node: New Modules<5>,  Next: Improved Modules<5>,  Prev: Other Language Changes<5>,  Up: What's New In Python 3 8\n\n\n* The new *note importlib.metadata: 74. module provides (provisional)\nsupport for reading metadata from third-party packages.  For\nexample, it can extract an installed package's version number, list\nof entry points, and more:\n\n>>> # Note following example requires that the popular \"requests\"\n>>> # package has been installed.\n>>>\n>>> from importlib.metadata import version, requires, files\n>>> version('requests')\n'2.22.0'\n>>> list(requires('requests'))\n['chardet (<3.1.0,>=3.0.2)']\n>>> list(files('requests'))[:5]\n[PackagePath('requests-2.22.0.dist-info/INSTALLER'),\nPackagePath('requests-2.22.0.dist-info/LICENSE'),\nPackagePath('requests-2.22.0.dist-info/METADATA'),\nPackagePath('requests-2.22.0.dist-info/RECORD'),\nPackagePath('requests-2.22.0.dist-info/WHEEL')]\n\n(Contributed by Barry Warsaw and Jason R. Coombs in bpo-34632(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=34632\n\nFile: python3.12.info,  Node: Improved Modules<5>,  Next: Optimizations<5>,  Prev: New Modules<5>,  Up: What's New In Python 3 8\n\n\n* Menu:\n\n* ast: ast<2>.\n* asyncio: asyncio<5>.\n* builtins::\n* collections::\n* cProfile::\n* csv: csv<2>.\n* curses: curses<3>.\n* ctypes::\n* datetime: datetime<3>.\n* functools: functools<2>.\n* gc: gc<3>.\n* gettext::\n* gzip: gzip<2>.\n* IDLE and idlelib: IDLE and idlelib<4>.\n* inspect: inspect<5>.\n* io: io<2>.\n* itertools: itertools<3>.\n* json.tool: json tool.\n* logging: logging<2>.\n* math: math<4>.\n* mmap::\n* multiprocessing: multiprocessing<2>.\n* os: os<5>.\n* os.path: os path<4>.\n* pathlib: pathlib<5>.\n* pickle::\n* plistlib::\n* pprint: pprint<3>.\n* pycompile: pycompile<2>.\n* shlex::\n* shutil: shutil<3>.\n* socket: socket<4>.\n* ssl: ssl<3>.\n* statistics: statistics<3>.\n* sys: sys<5>.\n* tarfile: tarfile<5>.\n* threading: threading<4>.\n* tokenize: tokenize<2>.\n* tkinter: tkinter<3>.\n* time: time<3>.\n* typing: typing<6>.\n* unicodedata: unicodedata<4>.\n* unittest: unittest<5>.\n* venv: venv<3>.\n* weakref::\n* xml: xml<3>.\n* xmlrpc::\n\nFile: python3.12.info,  Node: ast<2>,  Next: asyncio<5>,  Up: Improved Modules<5>\n\n1.5.5.1 ast\n...........\n\nAST nodes now have 'endlineno' and 'endcoloffset' attributes, which\ngive the precise location of the end of the node.  (This only applies to\nnodes that have 'lineno' and 'coloffset' attributes.)\n\nNew function *note ast.getsourcesegment(): 7fc. returns the source\ncode for a specific AST node.\n\n(Contributed by Ivan Levkivskyi in bpo-33416(1).)\n\nThe *note ast.parse(): 182. function has some new flags:\n\n* 'typecomments=True' causes it to return the text of PEP 484(2) and\nPEP 526(3) type comments associated with certain AST nodes;\n\n* 'mode='functype'' can be used to parse PEP 484(4) \"signature type\ncomments\" (returned for function definition AST nodes);\n\n* 'featureversion=(3, N)' allows specifying an earlier Python 3\nversion.  For example, 'featureversion=(3, 4)' will treat *note\nasync: 515. and *note await: 516. as non-reserved words.\n\n(Contributed by Guido van Rossum in bpo-35766(5).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33416\n\n(2) https://peps.python.org/pep-0484/\n\n(3) https://peps.python.org/pep-0526/\n\n(4) https://peps.python.org/pep-0484/\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=35766\n\nFile: python3.12.info,  Node: asyncio<5>,  Next: builtins,  Prev: ast<2>,  Up: Improved Modules<5>\n\n1.5.5.2 asyncio\n...............\n\n*note asyncio.run(): 197. has graduated from the provisional to stable\nAPI. This function can be used to execute a *note coroutine: 1ae. and\nreturn the result while automatically managing the event loop.  For\nexample:\n\nimport asyncio\n\nasync def main():\nawait asyncio.sleep(0)\nreturn 42\n\nasyncio.run(main())\n\nThis is 'roughly' equivalent to:\n\nimport asyncio\n\nasync def main():\nawait asyncio.sleep(0)\nreturn 42\n\nloop = asyncio.neweventloop()\nasyncio.seteventloop(loop)\ntry:\nloop.rununtilcomplete(main())\nfinally:\nasyncio.seteventloop(None)\nloop.close()\n\nThe actual implementation is significantly more complex.  Thus, *note\nasyncio.run(): 197. should be the preferred way of running asyncio\nprograms.\n\n(Contributed by Yury Selivanov in bpo-32314(1).)\n",
            "subsections": []
        },
        "Running 'python -m asyncio' launches a natively async REPL. This allows": {
            "content": "rapid experimentation with code that has a top-level *note await: 516.",
            "subsections": []
        },
        "There is no longer a need to directly call 'asyncio.run()' which would": {
            "content": "spawn a new event loop on every invocation:\n\n$ python -m asyncio\nasyncio REPL 3.8.0\nUse \"await\" directly instead of \"asyncio.run()\".\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> import asyncio\n>>> await asyncio.sleep(10, result='hello')\nhello\n\n(Contributed by Yury Selivanov in bpo-37028(2).)\n\nThe exception *note asyncio.CancelledError: 7fe. now inherits from *note\nBaseException: 37c. rather than *note Exception: 7ff. and no longer\ninherits from *note concurrent.futures.CancelledError: 800.\n(Contributed by Yury Selivanov in bpo-32528(3).)\n\nOn Windows, the default event loop is now *note ProactorEventLoop: 3d2.\n(Contributed by Victor Stinner in bpo-34687(4).)\n\n*note ProactorEventLoop: 3d2. now also supports UDP. (Contributed by",
            "subsections": []
        },
        "Adam Meily and Andrew Svetlov in bpo-29883(5).)": {
            "content": "*note ProactorEventLoop: 3d2. can now be interrupted by *note\nKeyboardInterrupt: 7f5. (\"CTRL+C\").  (Contributed by Vladimir Matveev in\nbpo-23057(6).)\n\nAdded *note asyncio.Task.getcoro(): 801. for getting the wrapped\ncoroutine within an *note asyncio.Task: 201.  (Contributed by Alex\nGro\"nholm in bpo-36999(7).)\n",
            "subsections": []
        },
        "Asyncio tasks can now be named, either by passing the 'name' keyword": {
            "content": "argument to *note asyncio.createtask(): 3c5. or the *note\ncreatetask(): 802. event loop method, or by calling the *note\nsetname(): 803. method on the task object.  The task name is visible in\nthe 'repr()' output of *note asyncio.Task: 201. and can also be\nretrieved using the *note getname(): 804. method.  (Contributed by Alex\nGro\"nholm in bpo-34270(8).)\n\nAdded support for Happy Eyeballs(9) to *note\nasyncio.loop.createconnection(): 3cc.  To specify the behavior, two new\nparameters have been added: 'happyeyeballsdelay' and 'interleave'.",
            "subsections": []
        },
        "The Happy Eyeballs algorithm improves responsiveness in applications": {
            "content": "that support IPv4 and IPv6 by attempting to simultaneously connect using\nboth.  (Contributed by twisteroid ambassador in bpo-33530(10).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32314\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=37028\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=32528\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=34687\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=29883\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=23057\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=36999\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=34270\n\n(9) https://en.wikipedia.org/wiki/HappyEyeballs\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=33530\n\nFile: python3.12.info,  Node: builtins,  Next: collections,  Prev: asyncio<5>,  Up: Improved Modules<5>\n\n1.5.5.3 builtins\n................\n\nThe *note compile(): 528. built-in has been improved to accept the\n'ast.PyCFALLOWTOPLEVELAWAIT' flag.  With this new flag passed, *note\ncompile(): 528. will allow top-level 'await', 'async for' and 'async\nwith' constructs that are usually considered invalid syntax.",
            "subsections": []
        },
        "Asynchronous code object marked with the 'COCOROUTINE' flag may then be": {
            "content": "returned.  (Contributed by Matthias Bussonnier in bpo-34616(1))\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=34616\n\nFile: python3.12.info,  Node: collections,  Next: cProfile,  Prev: builtins,  Up: Improved Modules<5>\n\n1.5.5.4 collections\n...................\n\nThe *note asdict(): 807. method for *note collections.namedtuple():\n711. now returns a *note dict: 237. instead of a *note\ncollections.OrderedDict: 39f.  This works because regular dicts have\nguaranteed ordering since Python 3.7.  If the extra features of\n'OrderedDict' are required, the suggested remediation is to cast the\nresult to the desired type: 'OrderedDict(nt.asdict())'.  (Contributed\nby Raymond Hettinger in bpo-35864(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=35864\n\nFile: python3.12.info,  Node: cProfile,  Next: csv<2>,  Prev: collections,  Up: Improved Modules<5>\n\n1.5.5.5 cProfile\n................\n\nThe *note cProfile.Profile: 809. class can now be used as a context\nmanager.  Profile a block of code by running:\n\nimport cProfile\n\nwith cProfile.Profile() as profiler:\n# code to be profiled\n...\n\n(Contributed by Scott Sanderson in bpo-29235(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=29235\n\nFile: python3.12.info,  Node: csv<2>,  Next: curses<3>,  Prev: cProfile,  Up: Improved Modules<5>\n\n1.5.5.6 csv\n...........\n\nThe *note csv.DictReader: 80b. now returns instances of *note dict: 237.\ninstead of a *note collections.OrderedDict: 39f.  The tool is now faster\nand uses less memory while still preserving the field order.\n(Contributed by Michael Selik in bpo-34003(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=34003\n\nFile: python3.12.info,  Node: curses<3>,  Next: ctypes,  Prev: csv<2>,  Up: Improved Modules<5>\n\n1.5.5.7 curses\n..............\n",
            "subsections": []
        },
        "Added a new variable holding structured version information for the": {
            "content": "underlying ncurses library: *note ncursesversion: 80d.  (Contributed by",
            "subsections": []
        },
        "Serhiy Storchaka in bpo-31680(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31680\n\nFile: python3.12.info,  Node: ctypes,  Next: datetime<3>,  Prev: curses<3>,  Up: Improved Modules<5>\n\n1.5.5.8 ctypes\n..............\n\nOn Windows, *note CDLL: 80f. and subclasses now accept a 'winmode'\nparameter to specify flags for the underlying 'LoadLibraryEx' call.  The\ndefault flags are set to only load DLL dependencies from trusted\nlocations, including the path where the DLL is stored (if a full or\npartial path is used to load the initial DLL) and paths added by *note\nadddlldirectory(): 810.  (Contributed by Steve Dower in bpo-36085(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36085\n\nFile: python3.12.info,  Node: datetime<3>,  Next: functools<2>,  Prev: ctypes,  Up: Improved Modules<5>\n\n1.5.5.9 datetime\n................\n\nAdded new alternate constructors *note datetime.date.fromisocalendar():\n812. and *note datetime.datetime.fromisocalendar(): 813, which construct\n*note date: 70f. and *note datetime: 222. objects respectively from ISO\nyear, week number, and weekday; these are the inverse of each class's\n'isocalendar' method.  (Contributed by Paul Ganssle in bpo-36004(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36004\n\nFile: python3.12.info,  Node: functools<2>,  Next: gc<3>,  Prev: datetime<3>,  Up: Improved Modules<5>\n\n1.5.5.10 functools\n..................\n\n*note functools.lrucache(): 815. can now be used as a straight\ndecorator rather than as a function returning a decorator.  So both of\nthese are now supported:\n\n@lrucache\ndef f(x):\n...\n\n@lrucache(maxsize=256)\ndef f(x):\n...\n\n(Contributed by Raymond Hettinger in bpo-36772(1).)\n\nAdded a new *note functools.cachedproperty(): 299. decorator, for\ncomputed properties cached for the life of the instance.\n\nimport functools\nimport statistics\n\nclass Dataset:\ndef init(self, sequenceofnumbers):\nself.data = sequenceofnumbers\n\n@functools.cachedproperty\ndef variance(self):\nreturn statistics.variance(self.data)\n\n(Contributed by Carl Meyer in bpo-21145(2))\n\nAdded a new *note functools.singledispatchmethod(): 816. decorator that\nconverts methods into *note generic functions: 817. using *note single\ndispatch: 818.:\n\nfrom functools import singledispatchmethod\nfrom contextlib import suppress\n\nclass TaskManager:\n\ndef init(self, tasks):\nself.tasks = list(tasks)\n\n@singledispatchmethod\ndef discard(self, value):\nwith suppress(ValueError):\nself.tasks.remove(value)\n\n@discard.register(list)\ndef (self, tasks):\ntargets = set(tasks)\nself.tasks = [x for x in self.tasks if x not in targets]\n\n(Contributed by Ethan Smith in bpo-32380(3))\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36772\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=21145\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=32380\n\nFile: python3.12.info,  Node: gc<3>,  Next: gettext,  Prev: functools<2>,  Up: Improved Modules<5>\n\n1.5.5.11 gc\n...........\n\n*note getobjects(): 5f6. can now receive an optional 'generation'\nparameter indicating a generation to get objects from.  (Contributed by",
            "subsections": []
        },
        "Pablo Galindo in bpo-36016(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36016\n\nFile: python3.12.info,  Node: gettext,  Next: gzip<2>,  Prev: gc<3>,  Up: Improved Modules<5>\n\n1.5.5.12 gettext\n................\n\nAdded *note pgettext(): 81b. and its variants.  (Contributed by Franz\nGlasner, ??ric Araujo, and Cheryl Sabella in bpo-2504(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=2504\n\nFile: python3.12.info,  Node: gzip<2>,  Next: IDLE and idlelib<4>,  Prev: gettext,  Up: Improved Modules<5>\n\n1.5.5.13 gzip\n.............\n\nAdded the 'mtime' parameter to *note gzip.compress(): 81d. for\nreproducible output.  (Contributed by Guo Ci Teo in bpo-34898(1).)\n\nA *note BadGzipFile: 81e. exception is now raised instead of *note\nOSError: 613. for certain types of invalid or corrupt gzip files.\n(Contributed by Filip Gruszczy??ski, Michele Orr??, and Zackery Spytz in\nbpo-6584(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=34898\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=6584\n\nFile: python3.12.info,  Node: IDLE and idlelib<4>,  Next: inspect<5>,  Prev: gzip<2>,  Up: Improved Modules<5>\n\n1.5.5.14 IDLE and idlelib\n.........................\n",
            "subsections": []
        },
        "Output over N lines (50 by default) is squeezed down to a button.  N can": {
            "content": "be changed in the PyShell section of the General page of the Settings\ndialog.  Fewer, but possibly extra long, lines can be squeezed by right\nclicking on the output.  Squeezed output can be expanded in place by\ndouble-clicking the button or into the clipboard or a separate window by\nright-clicking the button.  (Contributed by Tal Einat in\nbpo-1529353(11).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24225\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=15786\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=1612262\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=27099\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=13802\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=31860\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=33642\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=33768\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=33679\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=33656\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=1529353\n\nFile: python3.12.info,  Node: importlib<5>,  Next: inspect<6>,  Prev: idlelib and IDLE<2>,  Up: Improved Modules<7>\n\n1.7.5.20 importlib\n..................\n\nImport now raises the new exception *note ModuleNotFoundError: 981.\n(subclass of *note ImportError: 145.) when it cannot find a module.",
            "subsections": []
        },
        "They also re-appear in the box for the next customized run.  One can": {
            "content": "also suppress the normal Shell main module restart.  (Contributed by",
            "subsections": []
        },
        "Cheryl Sabella, Terry Jan Reedy, and others in bpo-5680(2) and": {
            "content": "bpo-37627(3).)\n",
            "subsections": []
        },
        "Added optional line numbers for IDLE editor windows.  Windows open": {
            "content": "without line numbers unless set otherwise in the General tab of the\nconfiguration dialog.  Line numbers for an existing window are shown and\nhidden in the Options menu.  (Contributed by Tal Einat and Saimadhav",
            "subsections": []
        },
        "Heblikar in bpo-17535(4).)": {
            "content": "OS native encoding is now used for converting between Python strings and",
            "subsections": []
        },
        "Tcl objects.  This allows IDLE to work with emoji and other non-BMP": {
            "content": "characters.  These characters can be displayed or copied and pasted to\nor from the clipboard.  Converting strings from Tcl to Python and back\nnow never fails.  (Many people worked on this for eight years but the\nproblem was finally solved by Serhiy Storchaka in bpo-13153(5).)\n\nNew in 3.8.1:\n",
            "subsections": []
        },
        "Add option to toggle cursor blink off.  (Contributed by Zackery Spytz in": {
            "content": "bpo-4603(6).)\n",
            "subsections": []
        },
        "Najera in bpo-38944(7).)": {
            "content": "The changes above have been backported to 3.7 maintenance releases.\n\nAdd keywords to module name completion list.  (Contributed by Terry J.",
            "subsections": []
        },
        "Reedy in bpo-37765(8).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=1529353\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=5680\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=37627\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=17535\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=13153\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=4603\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=38944\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=37765\n\nFile: python3.12.info,  Node: inspect<5>,  Next: io<2>,  Prev: IDLE and idlelib<4>,  Up: Improved Modules<5>\n\n1.5.5.15 inspect\n................\n\nThe *note inspect.getdoc(): 821. function can now find docstrings for\n'slots' if that attribute is a *note dict: 237. where the values are\ndocstrings.  This provides documentation options similar to what we\nalready have for *note property(): 3f6, *note classmethod(): 246, and\n*note staticmethod(): 5cc.:\n\nclass AudioClip:\nslots = {'bitrate': 'expressed in kilohertz to one decimal place',\n'duration': 'in seconds, rounded up to an integer'}\ndef init(self, bitrate, duration):\nself.bitrate = round(bitrate / 1000.0, 1)\nself.duration = ceil(duration)\n\n(Contributed by Raymond Hettinger in bpo-36326(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36326\n\nFile: python3.12.info,  Node: io<2>,  Next: itertools<3>,  Prev: inspect<5>,  Up: Improved Modules<5>\n\n1.5.5.16 io\n...........\n\nIn development mode (*note -X: 188. 'env') and in *note debug build:\n67f, the *note io.IOBase: 823. finalizer now logs the exception if the\n'close()' method fails.  The exception is ignored silently by default in\nrelease build.  (Contributed by Victor Stinner in bpo-18748(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=18748\n\nFile: python3.12.info,  Node: itertools<3>,  Next: json tool,  Prev: io<2>,  Up: Improved Modules<5>\n\n1.5.5.17 itertools\n..................\n\nThe *note itertools.accumulate(): 825. function added an option\n'initial' keyword argument to specify an initial value:\n\n>>> from itertools import accumulate\n>>> list(accumulate([10, 5, 30, 15], initial=1000))\n[1000, 1010, 1015, 1045, 1060]\n\n(Contributed by Lisa Roach in bpo-34659(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=34659\n\nFile: python3.12.info,  Node: json tool,  Next: logging<2>,  Prev: itertools<3>,  Up: Improved Modules<5>\n\n1.5.5.18 json.tool\n..................\n",
            "subsections": []
        },
        "Add option '--json-lines' to parse every input line as a separate JSON": {
            "content": "object.  (Contributed by Weipeng Hong in bpo-31553(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31553\n\nFile: python3.12.info,  Node: logging<2>,  Next: math<4>,  Prev: json tool,  Up: Improved Modules<5>\n\n1.5.5.19 logging\n................\n\nAdded a 'force' keyword argument to *note logging.basicConfig(): 828.",
            "subsections": []
        },
        "When set to true, any existing handlers attached to the root logger are": {
            "content": "removed and closed before carrying out the configuration specified by\nthe other arguments.\n",
            "subsections": []
        },
        "This solves a long-standing problem.  Once a logger or 'basicConfig()'": {
            "content": "had been called, subsequent calls to 'basicConfig()' were silently\nignored.  This made it difficult to update, experiment with, or teach\nthe various logging configuration options using the interactive prompt\nor a Jupyter notebook.\n\n(Suggested by Raymond Hettinger, implemented by Donghee Na, and reviewed\nby Vinay Sajip in bpo-33897(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33897\n\nFile: python3.12.info,  Node: math<4>,  Next: mmap,  Prev: logging<2>,  Up: Improved Modules<5>\n\n1.5.5.20 math\n.............\n\nAdded new function *note math.dist(): 82a. for computing Euclidean\ndistance between two points.  (Contributed by Raymond Hettinger in\nbpo-33089(1).)\n\nExpanded the *note math.hypot(): 82b. function to handle multiple\ndimensions.  Formerly, it only supported the 2-D case.  (Contributed by",
            "subsections": []
        },
        "Raymond Hettinger in bpo-33089(2).)": {
            "content": "Added new function, *note math.prod(): 82c, as analogous function to\n*note sum(): 181. that returns the product of a 'start' value (default:\n1) times an iterable of numbers:\n\n>>> prior = 0.8\n>>> likelihoods = [0.625, 0.84, 0.30]\n>>> math.prod(likelihoods, start=prior)\n0.126\n\n(Contributed by Pablo Galindo in bpo-35606(3).)\n\nAdded two new combinatoric functions *note math.perm(): 4a0. and *note\nmath.comb(): 49f.:\n\n>>> math.perm(10, 3)    # Permutations of 10 things taken 3 at a time\n720\n>>> math.comb(10, 3)    # Combinations of 10 things taken 3 at a time\n120\n\n(Contributed by Yash Aggarwal, Keller Fuchs, Serhiy Storchaka, and",
            "subsections": []
        },
        "Raymond Hettinger in bpo-37128(4), bpo-37178(5), and bpo-35431(6).)": {
            "content": "Added a new function *note math.isqrt(): 82d. for computing accurate\ninteger square roots without conversion to floating point.  The new\nfunction supports arbitrarily large integers.  It is faster than\n'floor(sqrt(n))' but slower than *note math.sqrt(): 82e.:\n\n>>> r = 650320427\n>>> s = r  2\n>>> isqrt(s - 1)         # correct\n650320426\n>>> floor(sqrt(s - 1))   # incorrect\n650320427\n\n(Contributed by Mark Dickinson in bpo-36887(7).)\n\nThe function *note math.factorial(): 765. no longer accepts arguments\nthat are not int-like.  (Contributed by Pablo Galindo in bpo-33083(8).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33089\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=33089\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=35606\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=37128\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=37178\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=35431\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=36887\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=33083\n\nFile: python3.12.info,  Node: mmap,  Next: multiprocessing<2>,  Prev: math<4>,  Up: Improved Modules<5>\n\n1.5.5.21 mmap\n.............\n\nThe *note mmap.mmap: 830. class now has an *note madvise(): 831. method\nto access the 'madvise()' system call.  (Contributed by Zackery Spytz in\nbpo-32941(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32941\n\nFile: python3.12.info,  Node: multiprocessing<2>,  Next: os<5>,  Prev: mmap,  Up: Improved Modules<5>\n\n1.5.5.22 multiprocessing\n........................\n\nAdded new *note multiprocessing.sharedmemory: 94. module.  (Contributed\nby Davin Potts in bpo-35813(1).)\n",
            "subsections": []
        },
        "On macOS, the 'spawn' start method is now used by default.  (Contributed": {
            "content": "by Victor Stinner in bpo-33725(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=35813\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=33725\n\nFile: python3.12.info,  Node: os<5>,  Next: os path<4>,  Prev: multiprocessing<2>,  Up: Improved Modules<5>\n\n1.5.5.23 os\n...........\n\nAdded new function *note adddlldirectory(): 810. on Windows for\nproviding additional search paths for native dependencies when importing\nextension modules or loading DLLs using *note ctypes: 28.  (Contributed\nby Steve Dower in bpo-36085(1).)\n\nA new *note os.memfdcreate(): 834. function was added to wrap the\n'memfdcreate()' syscall.  (Contributed by Zackery Spytz and Christian",
            "subsections": []
        },
        "Heimes in bpo-26836(2).)": {
            "content": "",
            "subsections": []
        },
        "On Windows, much of the manual logic for handling reparse points": {
            "content": "(including symlinks and directory junctions) has been delegated to the\noperating system.  Specifically, *note os.stat(): 1bf. will now traverse\nanything supported by the operating system, while *note os.lstat(): 1c0.\nwill only open reparse points that identify as \"name surrogates\" while\nothers are opened as for *note os.stat(): 1bf.  In all cases,\n'statresult.stmode' will only have 'SIFLNK' set for symbolic links\nand not other kinds of reparse points.  To identify other kinds of\nreparse point, check the new 'statresult.streparsetag' attribute.\n\nOn Windows, *note os.readlink(): 73e. is now able to read directory\njunctions.  Note that *note islink(): 835. will return 'False' for\ndirectory junctions, and so code that checks 'islink' first will\ncontinue to treat junctions as directories, while code that handles\nerrors from *note os.readlink(): 73e. may now treat junctions as links.\n\n(Contributed by Steve Dower in bpo-37834(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36085\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=26836\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=37834\n\nFile: python3.12.info,  Node: os path<4>,  Next: pathlib<5>,  Prev: os<5>,  Up: Improved Modules<5>\n\n1.5.5.24 os.path\n................\n\n*note os.path: 9d. functions that return a boolean result like *note\nexists(): 837, *note lexists(): 838, *note isdir(): 839, *note isfile():\n83a, *note islink(): 835, and *note ismount(): 83b. now return 'False'\ninstead of raising *note ValueError: 183. or its subclasses *note\nUnicodeEncodeError: 442. and *note UnicodeDecodeError: 83c. for paths\nthat contain characters or bytes unrepresentable at the OS level.\n(Contributed by Serhiy Storchaka in bpo-33721(1).)\n\n*note expanduser(): 83d. on Windows now prefers the 'USERPROFILE'\nenvironment variable and does not use 'HOME', which is not normally set\nfor regular user accounts.  (Contributed by Anthony Sottile in\nbpo-36264(2).)\n\n*note isdir(): 839. on Windows no longer returns 'True' for a link to a\nnon-existent directory.\n\n*note realpath(): 351. on Windows now resolves reparse points, including\nsymlinks and directory junctions.\n\n(Contributed by Steve Dower in bpo-37834(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33721\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=36264\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=37834\n\nFile: python3.12.info,  Node: pathlib<5>,  Next: pickle,  Prev: os path<4>,  Up: Improved Modules<5>\n\n1.5.5.25 pathlib\n................\n\n*note pathlib.Path: 149. methods that return a boolean result like *note\nexists(): 83f, *note isdir(): 840, *note isfile(): 841, *note\nismount(): 842, *note issymlink(): 843, *note isblockdevice(): 844,\n*note ischardevice(): 845, *note isfifo(): 846, *note issocket():\n847. now return 'False' instead of raising *note ValueError: 183. or its\nsubclass *note UnicodeEncodeError: 442. for paths that contain\ncharacters unrepresentable at the OS level.  (Contributed by Serhiy",
            "subsections": []
        },
        "Storchaka in bpo-33721(1).)": {
            "content": "",
            "subsections": []
        },
        "Added 'pathlib.Path.linkto()' which creates a hard link pointing to a": {
            "content": "path.  (Contributed by Joannah Nanjekye in bpo-26978(2)) Note that\n'linkto' was deprecated in 3.10 and removed in 3.12 in favor of a\n'hardlinkto' method added in 3.10 which matches the semantics of the\nexisting 'symlinkto' method.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33721\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=26978\n\nFile: python3.12.info,  Node: pickle,  Next: plistlib,  Prev: pathlib<5>,  Up: Improved Modules<5>\n\n1.5.5.26 pickle\n...............\n\n*note pickle: a1. extensions subclassing the C-optimized *note Pickler:\n849. can now override the pickling logic of functions and classes by\ndefining the special *note reduceroverride(): 84a. method.\n(Contributed by Pierre Glaser and Olivier Grisel in bpo-35900(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=35900\n\nFile: python3.12.info,  Node: plistlib,  Next: pprint<3>,  Prev: pickle,  Up: Improved Modules<5>\n\n1.5.5.27 plistlib\n.................\n\nAdded new *note plistlib.UID: 84c. and enabled support for reading and\nwriting NSKeyedArchiver-encoded binary plists.  (Contributed by Jon",
            "subsections": []
        },
        "Janzen in bpo-26707(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26707\n\nFile: python3.12.info,  Node: pprint<3>,  Next: pycompile<2>,  Prev: plistlib,  Up: Improved Modules<5>\n\n1.5.5.28 pprint\n...............\n\nThe *note pprint: a9. module added a 'sortdicts' parameter to several\nfunctions.  By default, those functions continue to sort dictionaries\nbefore rendering or printing.  However, if 'sortdicts' is set to false,\nthe dictionaries retain the order that keys were inserted.  This can be\nuseful for comparison to JSON inputs during debugging.\n\nIn addition, there is a convenience new function, *note pprint.pp():\n84e. that is like *note pprint.pprint(): 61d. but with 'sortdicts'\ndefaulting to 'False':\n\n>>> from pprint import pprint, pp\n>>> d = dict(source='input.txt', operation='filter', destination='output.txt')\n>>> pp(d, width=40)                  # Original order\n{'source': 'input.txt',\n'operation': 'filter',\n'destination': 'output.txt'}\n>>> pprint(d, width=40)              # Keys sorted alphabetically\n{'destination': 'output.txt',\n'operation': 'filter',\n'source': 'input.txt'}\n\n(Contributed by Re'mi Lapeyre in bpo-30670(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30670\n\nFile: python3.12.info,  Node: pycompile<2>,  Next: shlex,  Prev: pprint<3>,  Up: Improved Modules<5>\n\n1.5.5.29 pycompile\n...................\n\n*note pycompile.compile(): 850. now supports silent mode.  (Contributed\nby Joannah Nanjekye in bpo-22640(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=22640\n\nFile: python3.12.info,  Node: shlex,  Next: shutil<3>,  Prev: pycompile<2>,  Up: Improved Modules<5>\n\n1.5.5.30 shlex\n..............\n\nThe new *note shlex.join(): 852. function acts as the inverse of *note\nshlex.split(): 292.  (Contributed by Bo Bayles in bpo-32102(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32102\n\nFile: python3.12.info,  Node: shutil<3>,  Next: socket<4>,  Prev: shlex,  Up: Improved Modules<5>\n\n1.5.5.31 shutil\n...............\n\n*note shutil.copytree(): 854. now accepts a new 'dirsexistok' keyword\nargument.  (Contributed by Josh Bronson in bpo-20849(1).)\n\n*note shutil.makearchive(): 1d4. now defaults to the modern pax\n(POSIX.1-2001) format for new archives to improve portability and\nstandards conformance, inherited from the corresponding change to the\n*note tarfile: d8. module.  (Contributed by C.A.M. Gerlach in\nbpo-30661(2).)\n\n*note shutil.rmtree(): 1d5. on Windows now removes directory junctions\nwithout recursively removing their contents first.  (Contributed by",
            "subsections": []
        },
        "Steve Dower in bpo-37834(3).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=20849\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=30661\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=37834\n\nFile: python3.12.info,  Node: socket<4>,  Next: ssl<3>,  Prev: shutil<3>,  Up: Improved Modules<5>\n\n1.5.5.32 socket\n...............\n\nAdded *note createserver(): 856. and *note hasdualstackipv6(): 857.\nconvenience functions to automate the necessary tasks usually involved\nwhen creating a server socket, including accepting both IPv4 and IPv6\nconnections on the same socket.  (Contributed by Giampaolo Rodola` in\nbpo-17561(1).)\n\nThe *note socket.ifnameindex(): 858, *note socket.ifnametoindex():\n859, and *note socket.ifindextoname(): 85a. functions have been\nimplemented on Windows.  (Contributed by Zackery Spytz in bpo-37007(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=17561\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=37007\n\nFile: python3.12.info,  Node: ssl<3>,  Next: statistics<3>,  Prev: socket<4>,  Up: Improved Modules<5>\n\n1.5.5.33 ssl\n............\n\nAdded *note posthandshakeauth: 85c. to enable and *note\nverifyclientposthandshake(): 85d. to initiate TLS 1.3 post-handshake\nauthentication.  (Contributed by Christian Heimes in bpo-34670(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=34670\n\nFile: python3.12.info,  Node: statistics<3>,  Next: sys<5>,  Prev: ssl<3>,  Up: Improved Modules<5>\n\n1.5.5.34 statistics\n...................\n\nAdded *note statistics.fmean(): 85f. as a faster, floating point variant\nof *note statistics.mean(): 4a1.  (Contributed by Raymond Hettinger and",
            "subsections": []
        },
        "Steven D'Aprano in bpo-35904(1).)": {
            "content": "Added *note statistics.geometricmean(): 860. (Contributed by Raymond",
            "subsections": []
        },
        "Hettinger in bpo-27181(2).)": {
            "content": "Added *note statistics.multimode(): 861. that returns a list of the most\ncommon values.  (Contributed by Raymond Hettinger in bpo-35892(3).)\n\nAdded *note statistics.quantiles(): 862. that divides data or a\ndistribution in to equiprobable intervals (e.g.  quartiles, deciles, or\npercentiles).  (Contributed by Raymond Hettinger in bpo-36546(4).)\n\nAdded *note statistics.NormalDist: 863, a tool for creating and\nmanipulating normal distributions of a random variable.  (Contributed by",
            "subsections": []
        },
        "Raymond Hettinger in bpo-36018(5).)": {
            "content": ">>> temperaturefeb = NormalDist.fromsamples([4, 12, -3, 2, 7, 14])\n>>> temperaturefeb.mean\n6.0\n>>> temperaturefeb.stdev\n6.356099432828281\n\n>>> temperaturefeb.cdf(3)            # Chance of being under 3 degrees\n0.3184678262814532\n>>> # Relative chance of being 7 degrees versus 10 degrees\n>>> temperaturefeb.pdf(7) / temperaturefeb.pdf(10)\n1.2039930378537762\n\n>>> elnin~o = NormalDist(4, 2.5)\n>>> temperaturefeb += elnin~o        # Add in a climate effect\n>>> temperaturefeb\nNormalDist(mu=10.0, sigma=6.830080526611674)\n\n>>> temperaturefeb * (9/5) + 32      # Convert to Fahrenheit\nNormalDist(mu=50.0, sigma=12.294144947901014)\n>>> temperaturefeb.samples(3)        # Generate random samples\n[7.672102882379219, 12.000027119750287, 4.647488369766392]\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=35904\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=27181\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=35892\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=36546\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=36018\n\nFile: python3.12.info,  Node: sys<5>,  Next: tarfile<5>,  Prev: statistics<3>,  Up: Improved Modules<5>\n\n1.5.5.35 sys\n............\n\nAdd new *note sys.unraisablehook(): 448. function which can be\noverridden to control how \"unraisable exceptions\" are handled.  It is\ncalled when an exception has occurred but there is no way for Python to\nhandle it.  For example, when a destructor raises an exception or during\ngarbage collection (*note gc.collect(): 865.).  (Contributed by Victor",
            "subsections": []
        },
        "Stinner in bpo-36829(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36829\n\nFile: python3.12.info,  Node: tarfile<5>,  Next: threading<4>,  Prev: sys<5>,  Up: Improved Modules<5>\n\n1.5.5.36 tarfile\n................\n\nThe *note tarfile: d8. module now defaults to the modern pax\n(POSIX.1-2001) format for new archives, instead of the previous\nGNU-specific one.  This improves cross-platform portability with a\nconsistent encoding (UTF-8) in a standardized and extensible format, and\noffers several other benefits.  (Contributed by C.A.M. Gerlach in\nbpo-36268(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36268\n\nFile: python3.12.info,  Node: threading<4>,  Next: tokenize<2>,  Prev: tarfile<5>,  Up: Improved Modules<5>\n\n1.5.5.37 threading\n..................\n\nAdd a new *note threading.excepthook(): 641. function which handles\nuncaught *note threading.Thread.run(): 868. exception.  It can be\noverridden to control how uncaught *note threading.Thread.run(): 868.\nexceptions are handled.  (Contributed by Victor Stinner in\nbpo-1230540(1).)\n\nAdd a new *note threading.getnativeid(): 869. function and a *note\nnativeid: 86a. attribute to the *note threading.Thread: 76c. class.",
            "subsections": []
        },
        "These return the native integral Thread ID of the current thread": {
            "content": "assigned by the kernel.  This feature is only available on certain\nplatforms, see *note getnativeid: 869. for more information.\n(Contributed by Jake Tesler in bpo-36084(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=1230540\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=36084\n\nFile: python3.12.info,  Node: tokenize<2>,  Next: tkinter<3>,  Prev: threading<4>,  Up: Improved Modules<5>\n\n1.5.5.38 tokenize\n.................\n\nThe *note tokenize: f6. module now implicitly emits a 'NEWLINE' token\nwhen provided with input that does not have a trailing new line.  This\nbehavior now matches what the C tokenizer does internally.  (Contributed\nby Ammar Askar in bpo-33899(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33899\n\nFile: python3.12.info,  Node: tkinter<3>,  Next: time<3>,  Prev: tokenize<2>,  Up: Improved Modules<5>\n\n1.5.5.39 tkinter\n................\n",
            "subsections": []
        },
        "Added methods 'selectionfrom()', 'selectionpresent()',": {
            "content": "'selectionrange()' and 'selectionto()' in the 'tkinter.Spinbox' class.\n(Contributed by Juliette Monsel in bpo-34829(1).)\n",
            "subsections": []
        },
        "Added method 'moveto()' in the 'tkinter.Canvas' class.  (Contributed by": {
            "content": "",
            "subsections": []
        },
        "Juliette Monsel in bpo-23831(2).)": {
            "content": "",
            "subsections": []
        },
        "The 'tkinter.PhotoImage' class now has 'transparencyget()' and": {
            "content": "'transparencyset()' methods.  (Contributed by Zackery Spytz in\nbpo-25451(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=34829\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=23831\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=25451\n\nFile: python3.12.info,  Node: time<3>,  Next: typing<6>,  Prev: tkinter<3>,  Up: Improved Modules<5>\n\n1.5.5.40 time\n.............\n\nAdded new clock *note CLOCKUPTIMERAW: 86e. for macOS 10.12.\n(Contributed by Joannah Nanjekye in bpo-35702(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=35702\n\nFile: python3.12.info,  Node: typing<6>,  Next: unicodedata<4>,  Prev: time<3>,  Up: Improved Modules<5>\n\n1.5.5.41 typing\n...............\n\nThe *note typing: ff. module incorporates several new features:\n\n* A dictionary type with per-key types.  See PEP 589(1) and *note\ntyping.TypedDict: 153.  TypedDict uses only string keys.  By\ndefault, every key is required to be present.  Specify\n\"total=False\" to allow keys to be optional:\n\nclass Location(TypedDict, total=False):\nlatlong: tuple\ngridsquare: str\nxycoordinate: tuple\n\n* Literal types.  See PEP 586(2) and *note typing.Literal: 64b.\nLiteral types indicate that a parameter or return value is\nconstrained to one or more specific literal values:\n\ndef getstatus(port: int) -> Literal['connected', 'disconnected']:\n...\n\n* \"Final\" variables, functions, methods and classes.  See PEP 591(3),\n*note typing.Final: 870. and *note typing.final(): 47a.  The final\nqualifier instructs a static type checker to restrict subclassing,\noverriding, or reassignment:\n\npi: Final[float] = 3.1415926536\n\n* Protocol definitions.  See PEP 544(4), *note typing.Protocol: 47e.\nand *note typing.runtimecheckable(): 14c.  Simple ABCs like *note\ntyping.SupportsInt: 871. are now 'Protocol' subclasses.\n\n* New protocol class *note typing.SupportsIndex: 872.\n\n* New functions *note typing.getorigin(): 873. and *note\ntyping.getargs(): 68a.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0589/\n\n(2) https://peps.python.org/pep-0586/\n\n(3) https://peps.python.org/pep-0591/\n\n(4) https://peps.python.org/pep-0544/\n\nFile: python3.12.info,  Node: unicodedata<4>,  Next: unittest<5>,  Prev: typing<6>,  Up: Improved Modules<5>\n\n1.5.5.42 unicodedata\n....................\n\nThe *note unicodedata: 100. module has been upgraded to use the Unicode\n12.1.0(1) release.\n\nNew function *note isnormalized(): 875. can be used to verify a string\nis in a specific normal form, often much faster than by actually\nnormalizing the string.  (Contributed by Max Belanger, David Euresti,\nand Greg Price in bpo-32285(2) and bpo-37966(3)).\n\n---------- Footnotes ----------\n\n(1) https://blog.unicode.org/2019/05/unicode-12-1-en.html\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32285\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=37966\n\nFile: python3.12.info,  Node: unittest<5>,  Next: venv<3>,  Prev: unicodedata<4>,  Up: Improved Modules<5>\n\n1.5.5.43 unittest\n.................\n\nAdded *note AsyncMock: 877. to support an asynchronous version of *note",
            "subsections": []
        },
        "Mock: 878.  Appropriate new assert functions for testing have been added": {
            "content": "as well.  (Contributed by Lisa Roach in bpo-26467(1)).\n\nAdded *note addModuleCleanup(): 879. and *note addClassCleanup(): 87a.\nto unittest to support cleanups for 'setUpModule()' and *note\nsetUpClass(): 87b.  (Contributed by Lisa Roach in bpo-24412(2).)\n",
            "subsections": []
        },
        "Several mock assert functions now also print a list of actual calls upon": {
            "content": "failure.  (Contributed by Petter Strandmark in bpo-35047(3).)\n\n*note unittest: 101. module gained support for coroutines to be used as\ntest cases with *note unittest.IsolatedAsyncioTestCase: 48b.\n(Contributed by Andrew Svetlov in bpo-32972(4).)\n\nExample:\n\nimport unittest\n\n\nclass TestRequest(unittest.IsolatedAsyncioTestCase):\n\nasync def asyncSetUp(self):\nself.connection = await AsyncConnection()\n\nasync def testget(self):\nresponse = await self.connection.get(\"https://example.com\")\nself.assertEqual(response.statuscode, 200)\n\nasync def asyncTearDown(self):\nawait self.connection.close()\n\n\nif name == \"main\":\nunittest.main()\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26467\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=24412\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=35047\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=32972\n\nFile: python3.12.info,  Node: venv<3>,  Next: weakref,  Prev: unittest<5>,  Up: Improved Modules<5>\n\n1.5.5.44 venv\n.............\n\n*note venv: 10c. now includes an 'Activate.ps1' script on all platforms\nfor activating virtual environments under PowerShell Core 6.1.\n(Contributed by Brett Cannon in bpo-32718(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32718\n\nFile: python3.12.info,  Node: weakref,  Next: xml<3>,  Prev: venv<3>,  Up: Improved Modules<5>\n\n1.5.5.45 weakref\n................\n\nThe proxy objects returned by *note weakref.proxy(): 87e. now support\nthe matrix multiplication operators '@' and '@=' in addition to the\nother numeric operators.  (Contributed by Mark Dickinson in\nbpo-36669(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36669\n\nFile: python3.12.info,  Node: xml<3>,  Next: xmlrpc,  Prev: weakref,  Up: Improved Modules<5>\n\n1.5.5.46 xml\n............\n\nAs mitigation against DTD and external entity retrieval, the *note\nxml.dom.minidom: 11d. and *note xml.sax: 124. modules no longer process\nexternal entities by default.  (Contributed by Christian Heimes in\nbpo-17239(1).)\n\nThe '.find*()' methods in the *note xml.etree.ElementTree: 120. module\nsupport wildcard searches like '{*}tag' which ignores the namespace and\n'{namespace}*' which returns all tags in the given namespace.\n(Contributed by Stefan Behnel in bpo-28238(2).)\n\nThe *note xml.etree.ElementTree: 120. module provides a new function\n'-xml.etree.ElementTree.canonicalize()' that implements C14N 2.0.\n(Contributed by Stefan Behnel in bpo-13611(3).)\n\nThe target object of *note xml.etree.ElementTree.XMLParser: 880. can\nreceive namespace declaration events through the new callback methods\n'startns()' and 'endns()'.  Additionally, the *note\nxml.etree.ElementTree.TreeBuilder: 881. target can be configured to\nprocess events about comments and processing instructions to include\nthem in the generated tree.  (Contributed by Stefan Behnel in\nbpo-36676(4) and bpo-36673(5).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=17239\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=28238\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=13611\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=36676\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=36673\n\nFile: python3.12.info,  Node: xmlrpc,  Prev: xml<3>,  Up: Improved Modules<5>\n\n1.5.5.47 xmlrpc\n...............\n\n*note xmlrpc.client.ServerProxy: 883. now supports an optional 'headers'\nkeyword argument for a sequence of HTTP headers to be sent with each\nrequest.  Among other things, this makes it possible to upgrade from\ndefault basic authentication to faster session authentication.\n(Contributed by Ce'dric Krier in bpo-35153(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=35153\n\nFile: python3.12.info,  Node: Optimizations<5>,  Next: Build and C API Changes,  Prev: Improved Modules<5>,  Up: What's New In Python 3 8\n\n\n* The *note subprocess: d0. module can now use the *note\nos.posixspawn(): 885. function in some cases for better\nperformance.  Currently, it is only used on macOS and Linux (using\nglibc 2.24 or newer) if all these conditions are met:\n\n* 'closefds' is false;\n\n* 'preexecfn', 'passfds', 'cwd' and 'startnewsession'\nparameters are not set;\n\n* the 'executable' path contains a directory.\n\n(Contributed by Joannah Nanjekye and Victor Stinner in\nbpo-35537(1).)\n\n* *note shutil.copyfile(): 886, *note shutil.copy(): 887, *note\nshutil.copy2(): 888, *note shutil.copytree(): 854. and *note\nshutil.move(): 889. use platform-specific \"fast-copy\" syscalls on\nLinux and macOS in order to copy the file more efficiently.\n\"fast-copy\" means that the copying operation occurs within the\nkernel, avoiding the use of userspace buffers in Python as in\n\"'outfd.write(infd.read())'\".  On Windows *note shutil.copyfile():\n886. uses a bigger default buffer size (1 MiB instead of 16 KiB)\nand a *note memoryview(): 17f.-based variant of *note\nshutil.copyfileobj(): 88a. is used.  The speedup for copying a 512\nMiB file within the same partition is about +26% on Linux, +50% on\nmacOS and +40% on Windows.  Also, much less CPU cycles are\nconsumed.  See *note Platform-dependent efficient copy operations:\n88b. section.  (Contributed by Giampaolo Rodola` in bpo-33671(2).)\n\n* *note shutil.copytree(): 854. uses *note os.scandir(): 88c.\nfunction and all copy functions depending from it use cached *note\nos.stat(): 1bf. values.  The speedup for copying a directory with\n8000 files is around +9% on Linux, +20% on Windows and +30% on a\nWindows SMB share.  Also the number of *note os.stat(): 1bf.\nsyscalls is reduced by 38% making *note shutil.copytree(): 854.\nespecially faster on network filesystems.  (Contributed by\nGiampaolo Rodola` in bpo-33695(3).)\n\n* The default protocol in the *note pickle: a1. module is now\nProtocol 4, first introduced in Python 3.4.  It offers better\nperformance and smaller size compared to Protocol 3 available since\nPython 3.0.\n\n* Removed one *note Pyssizet: 88d. member from 'PyGCHead'.  All GC\ntracked objects (e.g.  tuple, list, dict) size is reduced 4 or 8\nbytes.  (Contributed by Inada Naoki in bpo-33597(4).)\n\n* *note uuid.UUID: 88e. now uses 'slots' to reduce its memory\nfootprint.  (Contributed by Wouter Bolsterlee and Tal Einat in\nbpo-30977(5))\n\n* Improved performance of *note operator.itemgetter(): 88f. by 33%.\nOptimized argument handling and added a fast path for the common\ncase of a single non-negative integer index into a tuple (which is\nthe typical use case in the standard library).  (Contributed by\nRaymond Hettinger in bpo-35664(6).)\n\n* Sped-up field lookups in *note collections.namedtuple(): 711.  They\nare now more than two times faster, making them the fastest form of\ninstance variable lookup in Python.  (Contributed by Raymond\nHettinger, Pablo Galindo, and Joe Jevnik, Serhiy Storchaka in\nbpo-32492(7).)\n\n* The *note list: 3dc. constructor does not overallocate the internal\nitem buffer if the input iterable has a known length (the input\nimplements 'len').  This makes the created list 12% smaller on\naverage.  (Contributed by Raymond Hettinger and Pablo Galindo in\nbpo-33234(8).)\n\n* Doubled the speed of class variable writes.  When a non-dunder\nattribute was updated, there was an unnecessary call to update\nslots.  (Contributed by Stefan Behnel, Pablo Galindo Salgado,\nRaymond Hettinger, Neil Schemenauer, and Serhiy Storchaka in\nbpo-36012(9).)\n\n* Reduced an overhead of converting arguments passed to many builtin\nfunctions and methods.  This sped up calling some simple builtin\nfunctions and methods up to 20-50%.  (Contributed by Serhiy\nStorchaka in bpo-23867(10), bpo-35582(11) and bpo-36127(12).)\n\n* 'LOADGLOBAL' instruction now uses new \"per opcode cache\"\nmechanism.  It is about 40% faster now.  (Contributed by Yury\nSelivanov and Inada Naoki in bpo-26219(13).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=35537\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=33671\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=33695\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=33597\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=30977\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=35664\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=32492\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=33234\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=36012\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=23867\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=35582\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=36127\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=26219\n\nFile: python3.12.info,  Node: Build and C API Changes,  Next: Deprecated<8>,  Prev: Optimizations<5>,  Up: What's New In Python 3 8\n\n\n* Default *note sys.abiflags: 891. became an empty string: the 'm'\nflag for pymalloc became useless (builds with and without pymalloc\nare ABI compatible) and so has been removed.  (Contributed by\nVictor Stinner in bpo-36707(1).)\n\nExample of changes:\n\n* Only 'python3.8' program is installed, 'python3.8m' program is\ngone.\n\n* Only 'python3.8-config' script is installed,\n'python3.8m-config' script is gone.\n\n* The 'm' flag has been removed from the suffix of dynamic\nlibrary filenames: extension modules in the standard library\nas well as those produced and installed by third-party\npackages, like those downloaded from PyPI. On Linux, for\nexample, the Python 3.7 suffix\n'.cpython-37m-x8664-linux-gnu.so' became\n'.cpython-38-x8664-linux-gnu.so' in Python 3.8.\n\n* The header files have been reorganized to better separate the\ndifferent kinds of APIs:\n\n* 'Include/*.h' should be the portable public stable C API.\n\n* 'Include/cpython/*.h' should be the unstable C API specific to\nCPython; public API, with some private API prefixed by 'Py'\nor 'PY'.\n\n* 'Include/internal/*.h' is the private internal C API very\nspecific to CPython.  This API comes with no backward\ncompatibility warranty and should not be used outside CPython.\nIt is only exposed for very specific needs like debuggers and\nprofiles which has to access to CPython internals without\ncalling functions.  This API is now installed by 'make\ninstall'.\n\n(Contributed by Victor Stinner in bpo-35134(2) and bpo-35081(3),\nwork initiated by Eric Snow in Python 3.7.)\n\n* Some macros have been converted to static inline functions:\nparameter types and return type are well defined, they don't have\nissues specific to macros, variables have a local scopes.\nExamples:\n\n* *note PyINCREF(): 2ce, *note PyDECREF(): 2cf.\n\n* *note PyXINCREF(): 892, *note PyXDECREF(): 57d.\n\n* 'PyObjectINIT()', 'PyObjectINITVAR()'\n\n* Private functions: 'PyObjectGCTRACK()',\n'PyObjectGCUNTRACK()', 'PyDealloc()'\n\n(Contributed by Victor Stinner in bpo-35059(4).)\n\n* The 'PyByteArrayInit()' and 'PyByteArrayFini()' functions have\nbeen removed.  They did nothing since Python 2.7.4 and Python\n3.2.0, were excluded from the limited API (stable ABI), and were\nnot documented.  (Contributed by Victor Stinner in bpo-35713(5).)\n\n* The result of 'PyExceptionClassName()' is now of type 'const char\n*' rather of 'char *'.  (Contributed by Serhiy Storchaka in\nbpo-33818(6).)\n\n* The duality of 'Modules/Setup.dist' and 'Modules/Setup' has been\nremoved.  Previously, when updating the CPython source tree, one\nhad to manually copy 'Modules/Setup.dist' (inside the source tree)\nto 'Modules/Setup' (inside the build tree) in order to reflect any\nchanges upstream.  This was of a small benefit to packagers at the\nexpense of a frequent annoyance to developers following CPython\ndevelopment, as forgetting to copy the file could produce build\nfailures.\n\nNow the build system always reads from 'Modules/Setup' inside the\nsource tree.  People who want to customize that file are encouraged\nto maintain their changes in a git fork of CPython or as patch\nfiles, as they would do for any other change to the source tree.\n\n(Contributed by Antoine Pitrou in bpo-32430(7).)\n\n* Functions that convert Python number to C integer like *note\nPyLongAsLong(): 893. and argument parsing functions like *note\nPyArgParseTuple(): 2d1. with integer converting format units like\n''i'' will now use the *note index(): 4f1. special method\ninstead of *note int(): 4f0, if available.  The deprecation\nwarning will be emitted for objects with the 'int()' method but\nwithout the 'index()' method (like *note Decimal: 5c3. and\n*note Fraction: 1a8.).  *note PyNumberCheck(): 894. will now\nreturn '1' for objects implementing 'index()'.  *note\nPyNumberLong(): 895, *note PyNumberFloat(): 896. and *note\nPyFloatAsDouble(): 897. also now use the 'index()' method if\navailable.  (Contributed by Serhiy Storchaka in bpo-36048(8) and\nbpo-20092(9).)\n\n* Heap-allocated type objects will now increase their reference count\nin *note PyObjectInit(): 898. (and its parallel macro\n'PyObjectINIT') instead of in *note PyTypeGenericAlloc(): 899.\nTypes that modify instance allocation or deallocation may need to\nbe adjusted.  (Contributed by Eddie Elizondo in bpo-35810(10).)\n\n* The new function 'PyCodeNewWithPosOnlyArgs()' allows to create\ncode objects like 'PyCodeNew()', but with an extra\n'posonlyargcount' parameter for indicating the number of\npositional-only arguments.  (Contributed by Pablo Galindo in\nbpo-37221(11).)\n\n* 'PySetPath()' now sets *note sys.executable: 330. to the program\nfull path (*note PyGetProgramFullPath(): 32f.) rather than to the\nprogram name (*note PyGetProgramName(): 331.).  (Contributed by\nVictor Stinner in bpo-38234(12).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36707\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=35134\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=35081\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=35059\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=35713\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=33818\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=32430\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=36048\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=20092\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=35810\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=37221\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=38234\n\nFile: python3.12.info,  Node: Deprecated<8>,  Next: API and Feature Removals,  Prev: Build and C API Changes,  Up: What's New In Python 3 8\n\n\n* The distutils 'bdistwininst' command is now deprecated, use\n'bdistwheel' (wheel packages) instead.  (Contributed by Victor\nStinner in bpo-37481(1).)\n\n* Deprecated methods 'getchildren()' and 'getiterator()' in the *note\nElementTree: 120. module now emit a *note DeprecationWarning: 179.\ninstead of *note PendingDeprecationWarning: 6e0.  They will be\nremoved in Python 3.9.  (Contributed by Serhiy Storchaka in\nbpo-29209(2).)\n\n* Passing an object that is not an instance of *note\nconcurrent.futures.ThreadPoolExecutor: 529. to *note\nloop.setdefaultexecutor(): 52a. is deprecated and will be\nprohibited in Python 3.9.  (Contributed by Elvis Pranskevichus in\nbpo-34075(3).)\n\n* The *note getitem(): 4b9. methods of *note\nxml.dom.pulldom.DOMEventStream: 519, *note\nwsgiref.util.FileWrapper: 51a. and *note fileinput.FileInput: 51b.\nhave been deprecated.\n\nImplementations of these methods have been ignoring their 'index'\nparameter, and returning the next item instead.  (Contributed by\nBerker Peksag in bpo-9372(4).)\n\n* The *note typing.NamedTuple: 1f9. class has deprecated the\n'fieldtypes' attribute in favor of the 'annotations'\nattribute which has the same information.  (Contributed by Raymond\nHettinger in bpo-36320(5).)\n\n* *note ast: 8. classes 'Num', 'Str', 'Bytes', 'NameConstant' and\n'Ellipsis' are considered deprecated and will be removed in future\nPython versions.  *note Constant: 215. should be used instead.\n(Contributed by Serhiy Storchaka in bpo-32892(6).)\n\n* *note ast.NodeVisitor: 89b. methods 'visitNum()', 'visitStr()',\n'visitBytes()', 'visitNameConstant()' and 'visitEllipsis()' are\ndeprecated now and will not be called in future Python versions.\nAdd the *note visitConstant(): 89c. method to handle all constant\nnodes.  (Contributed by Serhiy Storchaka in bpo-36917(7).)\n\n* The 'asyncio.coroutine()' *note decorator: 514. is deprecated and\nwill be removed in version 3.10.  Instead of '@asyncio.coroutine',\nuse *note async def: 394. instead.  (Contributed by Andrew Svetlov\nin bpo-36921(8).)\n\n* In *note asyncio: 9, the explicit passing of a 'loop' argument has\nbeen deprecated and will be removed in version 3.10 for the\nfollowing: *note asyncio.sleep(): 89d, *note asyncio.gather(): 3c6,\n*note asyncio.shield(): 89e, *note asyncio.waitfor(): 3c8, *note\nasyncio.wait(): 19a, *note asyncio.ascompleted(): 19b, *note\nasyncio.Task: 201, *note asyncio.Lock: 89f, *note asyncio.Event:\n8a0, *note asyncio.Condition: 8a1, *note asyncio.Semaphore: 8a2,\n*note asyncio.BoundedSemaphore: 8a3, *note asyncio.Queue: 8a4,\n*note asyncio.createsubprocessexec(): 8a5, and *note\nasyncio.createsubprocessshell(): 8a6.\n\n* The explicit passing of coroutine objects to *note asyncio.wait():\n19a. has been deprecated and will be removed in version 3.11.\n(Contributed by Yury Selivanov in bpo-34790(9).)\n\n* The following functions and methods are deprecated in the *note\ngettext: 5e. module: 'lgettext()', 'ldgettext()', 'lngettext()' and\n'ldngettext()'.  They return encoded bytes, and it's possible that\nyou will get unexpected Unicode-related exceptions if there are\nencoding problems with the translated strings.  It's much better to\nuse alternatives which return Unicode strings in Python 3.  These\nfunctions have been broken for a long time.\n\nFunction 'bindtextdomaincodeset()', methods 'outputcharset()'\nand 'setoutputcharset()', and the 'codeset' parameter of\nfunctions *note translation(): 8a7. and *note install(): 8a8. are\nalso deprecated, since they are only used for the 'l*gettext()'\nfunctions.  (Contributed by Serhiy Storchaka in bpo-33710(10).)\n\n* The 'isAlive()' method of *note threading.Thread: 76c. has been\ndeprecated.  (Contributed by Donghee Na in bpo-35283(11).)\n\n* Many builtin and extension functions that take integer arguments\nwill now emit a deprecation warning for *note Decimal: 5c3.s, *note\nFraction: 1a8.s and any other objects that can be converted to\nintegers only with a loss (e.g.  that have the *note int():\n4f0. method but do not have the *note index(): 4f1. method).\nIn future version they will be errors.  (Contributed by Serhiy\nStorchaka in bpo-36048(12).)\n\n* Deprecated passing the following arguments as keyword arguments:\n\n- 'func' in *note functools.partialmethod(): 8a9, *note\nweakref.finalize(): 8aa, *note profile.Profile.runcall(): 8ab,\n'cProfile.Profile.runcall()', *note bdb.Bdb.runcall(): 8ac,\n*note trace.Trace.runfunc(): 8ad. and *note curses.wrapper():\n8ae.\n\n- 'function' in *note unittest.TestCase.addCleanup(): 8af.\n\n- 'fn' in the *note submit(): 8b0. method of *note\nconcurrent.futures.ThreadPoolExecutor: 529. and *note\nconcurrent.futures.ProcessPoolExecutor: 707.\n\n- 'callback' in *note contextlib.ExitStack.callback(): 8b1,\n'contextlib.AsyncExitStack.callback()' and *note\ncontextlib.AsyncExitStack.pushasynccallback(): 8b2.\n\n- 'c' and 'typeid' in the 'create()' method of\n'multiprocessing.managers.Server' and\n'multiprocessing.managers.SharedMemoryServer'.\n\n- 'obj' in *note weakref.finalize(): 8aa.\n\nIn future releases of Python, they will be *note positional-only:\n8b3.  (Contributed by Serhiy Storchaka in bpo-36492(13).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=37481\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=29209\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=34075\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=9372\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=36320\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=32892\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=36917\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=36921\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=34790\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=33710\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=35283\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=36048\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=36492\n\nFile: python3.12.info,  Node: API and Feature Removals,  Next: Porting to Python 3 8,  Prev: Deprecated<8>,  Up: What's New In Python 3 8\n\n\nThe following features and APIs have been removed from Python 3.8:\n\n* Starting with Python 3.3, importing ABCs from *note collections:\n1b. was deprecated, and importing should be done from *note\ncollections.abc: 1c.  Being able to import from collections was\nmarked for removal in 3.8, but has been delayed to 3.9.  (See\nbpo-36952(1).)\n\n* The 'macpath' module, deprecated in Python 3.7, has been removed.\n(Contributed by Victor Stinner in bpo-35471(2).)\n\n* The function 'platform.popen()' has been removed, after having been\ndeprecated since Python 3.3: use *note os.popen(): 8b5. instead.\n(Contributed by Victor Stinner in bpo-35345(3).)\n\n* The function 'time.clock()' has been removed, after having been\ndeprecated since Python 3.3: use *note time.perfcounter(): 8b6. or\n*note time.processtime(): 8b7. instead, depending on your\nrequirements, to have well-defined behavior.  (Contributed by\nMatthias Bussonnier in bpo-36895(4).)\n\n* The 'pyvenv' script has been removed in favor of 'python3.8 -m\nvenv' to help eliminate confusion as to what Python interpreter the\n'pyvenv' script is tied to.  (Contributed by Brett Cannon in\nbpo-25427(5).)\n\n* 'parseqs', 'parseqsl', and 'escape' are removed from the *note\ncgi: 13. module.  They are deprecated in Python 3.2 or older.  They\nshould be imported from the 'urllib.parse' and 'html' modules\ninstead.\n\n* 'filemode' function is removed from the *note tarfile: d8. module.\nIt is not documented and deprecated since Python 3.3.\n\n* The *note XMLParser: 880. constructor no longer accepts the 'html'\nargument.  It never had an effect and was deprecated in Python 3.4.\nAll other parameters are now *note keyword-only: 8b8.  (Contributed\nby Serhiy Storchaka in bpo-29209(6).)\n\n* Removed the 'doctype()' method of *note XMLParser: 880.\n(Contributed by Serhiy Storchaka in bpo-29209(7).)\n\n* \"unicodeinternal\" codec is removed.  (Contributed by Inada Naoki\nin bpo-36297(8).)\n\n* The 'Cache' and 'Statement' objects of the *note sqlite3: c9.\nmodule are not exposed to the user.  (Contributed by Aviv Palivoda\nin bpo-30262(9).)\n\n* The 'bufsize' keyword argument of *note fileinput.input(): 5f2. and\n*note fileinput.FileInput(): 51b. which was ignored and deprecated\nsince Python 3.6 has been removed.  bpo-36952(10) (Contributed by\nMatthias Bussonnier.)\n\n* The functions 'sys.setcoroutinewrapper()' and\n'sys.getcoroutinewrapper()' deprecated in Python 3.7 have been\nremoved; bpo-36933(11) (Contributed by Matthias Bussonnier.)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36952\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=35471\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=35345\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=36895\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=25427\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=29209\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=29209\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=36297\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=30262\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=36952\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=36933\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "Hettinger in bpo-35884(1).)": {
            "content": "Here's a summary of performance improvements since Python 3.3:\n\nPython version                       3.3     3.4     3.5     3.6     3.7     3.8\n--------------                       ---     ---     ---     ---     ---     ---\n\nVariable and attribute read access:\nreadlocal                       4.0     7.1     7.1     5.4     5.1     3.9\nreadnonlocal                    5.3     7.1     8.1     5.8     5.4     4.4\nreadglobal                     13.3    15.5    19.0    14.3    13.6     7.6\nreadbuiltin                    20.0    21.1    21.6    18.5    19.0     7.5\nreadclassvarfromclass        20.5    25.6    26.5    20.7    19.5    18.4\nreadclassvarfrominstance     18.5    22.8    23.5    18.8    17.1    16.4\nreadinstancevar                26.8    32.4    33.1    28.0    26.3    25.4\nreadinstancevarslots          23.7    27.8    31.3    20.8    20.8    20.2\nreadnamedtuple                 68.5    73.8    57.5    45.0    46.8    18.4\nreadboundmethod                29.8    37.6    37.9    29.6    26.9    27.7\n\nVariable and attribute write access:\nwritelocal                      4.6     8.7     9.3     5.5     5.3     4.3\nwritenonlocal                   7.3    10.5    11.1     5.6     5.5     4.7\nwriteglobal                    15.9    19.7    21.2    18.0    18.0    15.8\nwriteclassvar                  81.9    92.9    96.0   104.6   102.1    39.2\nwriteinstancevar               36.4    44.6    45.8    40.0    38.9    35.5\nwriteinstancevarslots         28.7    35.6    36.1    27.3    26.6    25.7\n\nData structure read access:\nreadlist                       19.2    24.2    24.5    20.8    20.8    19.0\nreaddeque                      19.9    24.7    25.5    20.2    20.6    19.8\nreaddict                       19.7    24.3    25.7    22.3    23.0    21.0\nreadstrdict                    17.9    22.6    24.3    19.5    21.2    18.9\n\nData structure write access:\nwritelist                      21.2    27.1    28.5    22.5    21.6    20.0\nwritedeque                     23.8    28.7    30.1    22.7    21.8    23.5\nwritedict                      25.9    31.4    33.3    29.3    29.2    24.7\nwritestrdict                   22.9    28.4    29.9    27.5    25.2    23.1\n\nStack (or queue) operations:\nlistappendpop                144.2    93.4   112.7    75.4    74.2    50.8\ndequeappendpop                30.4    43.5    57.0    49.4    49.2    42.5\ndequeappendpopleft            30.8    43.7    57.3    49.7    49.7    42.8\n\nTiming loop:\nloopoverhead                    0.3     0.5     0.6     0.4     0.3     0.3\n\nThe benchmarks were measured on an Intel?? Core??? i7-4960HQ processor(2)\nrunning the macOS 64-bit builds found at python.org(3).  The benchmark\nscript displays timings in nanoseconds.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=35884\n\n(2)\nhttps://ark.intel.com/content/www/us/en/ark/products/76088/intel-core-i7-4960hq-processor-6m-cache-up-to-3-80-ghz.html\n\n(3) https://www.python.org/downloads/macos/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "Fixed a regression with the 'ignore' callback of *note\nshutil.copytree(): 854.  The argument types are now str and List[str]\nagain.  (Contributed by Manuel Barkhau and Giampaolo Rodola in\ngh-83571(1).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/83571\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "The constant values of future flags in the *note future: 0. module\nare updated in order to prevent collision with compiler flags.",
            "subsections": []
        },
        "Previously 'PyCFALLOWTOPLEVELAWAIT' was clashing with": {
            "content": "'COFUTUREDIVISION'.  (Contributed by Batuhan Taskaya in gh-83743(1))\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/83743\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "Earlier Python versions allowed using both ';' and '&' as query\nparameter separators in *note urllib.parse.parseqs(): 651. and *note\nurllib.parse.parseqsl(): 652.  Due to security concerns, and to conform\nwith newer W3C recommendations, this has been changed to allow only a\nsingle separator key, with '&' as the default.  This change also affects\n*note cgi.parse(): 653. and *note cgi.parsemultipart(): 654. as they\nuse the affected functions internally.  For more details, please see\ntheir respective documentation.  (Contributed by Adam Goldschmidt,",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "A security fix alters the *note ftplib.FTP: 715. behavior to not trust\nthe IPv4 address sent from the remote server when setting up a passive\ndata channel.  We reuse the ftp server IP address instead.  For unusual\ncode requiring the old behavior, set a 'trustserverpasvipv4address'\nattribute on your FTP instance to 'True'.  (See gh-87451(1))\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/87451\n\nFile: python3.12.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\n\n\n* Menu:\n\n* macOS 11.0 (Big Sur) and Apple Silicon Mac support: macOS 11 0 Big Sur and Apple Silicon Mac support<2>.\n\nFile: python3.12.info,  Node: macOS 11 0 Big Sur and Apple Silicon Mac support<2>,  Up: Notable changes in Python 3 8 10\n\n1.5.16.1 macOS 11.0 (Big Sur) and Apple Silicon Mac support\n...........................................................\n",
            "subsections": []
        },
        "As of 3.8.10, Python now supports building and running on macOS 11 (Big": {
            "content": "",
            "subsections": []
        },
        "Sur) and on Apple Silicon Macs (based on the 'ARM64' architecture).  A": {
            "content": "new universal build variant, 'universal2', is now available to natively\nsupport both 'ARM64' and 'Intel 64' in one set of executables.  Note\nthat support for \"weaklinking\", building binaries targeted for newer\nversions of macOS that will also run correctly on older versions by\ntesting at runtime for missing features, is not included in this\nbackport from Python 3.9; to support a range of macOS versions, continue\nto target for and build on the oldest version in the range.\n\n(Originally contributed by Ronald Oussoren and Lawrence D'Anna in\ngh-85272(1), with fixes by FX Coudert and Eli Rykoff, and backported to\n3.8 by Maxime Be'langer and Ned Deily)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/85272\n\nFile: python3.12.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\n\n\n* Menu:\n\n* urllib.parse: urllib parse<4>.\n\nFile: python3.12.info,  Node: urllib parse<4>,  Up: Notable changes in Python 3 8 10<2>\n\n1.5.17.1 urllib.parse\n.....................\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "Converting between *note int: 17e. and *note str: 157. in bases other\nthan 2 (binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10\n(decimal) now raises a *note ValueError: 183. if the number of digits in\nstring form is above a limit to avoid potential denial of service\nattacks due to the algorithmic complexity.  This is a mitigation for\nCVE-2020-10735(1).  This limit can be configured or disabled by\nenvironment variable, command line flag, or *note sys: d3. APIs.  See\nthe *note integer string conversion length limitation: 3bc.\ndocumentation.  The default limit is 4300 digits in string form.\n\n---------- Footnotes ----------\n\n(1) https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-10735\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Notable changes in 3 8 17,  Prev: Notable security feature in 3 8 14,  Up: What's New In Python 3 8": {
            "content": "* Menu:\n\n* tarfile: tarfile<6>.\n\nFile: python3.12.info,  Node: tarfile<6>,  Up: Notable changes in 3 8 17\n\n1.5.20.1 tarfile\n................\n\n* The extraction methods in *note tarfile: d8, and *note\nshutil.unpackarchive(): 184, have a new a 'filter' argument that\nallows limiting tar features than may be surprising or dangerous,\nsuch as creating files outside the destination directory.  See\n*note Extraction filters: 185. for details.  In Python 3.12, use\nwithout the 'filter' argument will show a *note DeprecationWarning:\n179.  In Python 3.14, the default will switch to ''data''.\n(Contributed by Petr Viktorin in PEP 706(1).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0706/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": [
                {
                    "name": "1.6 What's New In Python 3.7",
                    "content": "Editor: Elvis Pranskevichus <<elvis@magic.io>>\n\nThis 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": {
            "content": "*note changelog: 136.\n\n* Menu:\n\n* Summary - Release Highlights::\n* New Features: New Features<10>.\n* Other Language Changes: Other Language Changes<6>.\n* New Modules: New Modules<6>.\n* Improved Modules: Improved Modules<6>.\n* C API Changes: C API Changes<5>.\n* Build Changes: Build Changes<5>.\n* Optimizations: Optimizations<6>.\n* Other CPython Implementation Changes: Other CPython Implementation Changes<2>.\n* Deprecated Python Behavior::\n* Deprecated Python modules, functions and methods: Deprecated Python modules functions and methods.\n* Deprecated functions and types of the C API::\n* Platform Support Removals::\n* API and Feature Removals: API and Feature Removals<2>.\n* Module Removals::\n* Windows-only Changes::\n* Porting to Python 3.7: Porting to Python 3 7.\n* Notable changes in Python 3.7.1: Notable changes in Python 3 7 1.\n* Notable changes in Python 3.7.2: Notable changes in Python 3 7 2.\n* Notable changes in Python 3.7.6: Notable changes in Python 3 7 6.\n* Notable changes in Python 3.7.10: Notable changes in Python 3 7 10.\n* Notable changes in Python 3.7.11: Notable changes in Python 3 7 11.\n* Notable security feature in 3.7.14: Notable security feature in 3 7 14.\n\nFile: python3.12.info,  Node: Summary - Release Highlights,  Next: New Features<10>,  Up: What's New In Python 3 7\n\n\nNew syntax features:\n\n* *note PEP 563: 8f4, postponed evaluation of type annotations.\n\nBackwards incompatible syntax changes:\n\n* *note async: 515. and *note await: 516. are now reserved keywords.\n\nNew library modules:\n\n* *note contextvars: 22.: *note PEP 567 - Context Variables: 8f5.\n\n* *note dataclasses: 2d.: *note PEP 557 - Data Classes: 8f6.\n\n* *note importlib.resources: 8f7.\n\nNew built-in features:\n\n* *note PEP 553: 8f8, the new *note breakpoint(): 8f9. function.\n\nPython data model improvements:\n\n* *note PEP 562: 8fa, customization of access to module attributes.\n\n* *note PEP 560: 8fb, core support for typing module and generic\ntypes.\n\n* the insertion-order preservation nature of *note dict: 8fc. objects\nhas been declared(1) to be an official part of the Python language\nspec.\n\nSignificant improvements in the standard library:\n\n* The *note asyncio: 9. module has received new features, significant\n*note usability and performance improvements: 8fd.\n\n* The *note time: e8. module gained support for *note functions with\nnanosecond resolution: 8fe.\n\nCPython implementation improvements:\n\n* Avoiding the use of ASCII as a default text encoding:\n\n* *note PEP 538: 8ff, legacy C locale coercion\n\n* *note PEP 540: 900, forced UTF-8 runtime mode\n\n* *note PEP 552: 901, deterministic .pycs\n\n* *note New Python Development Mode: 902.\n\n* *note PEP 565: 903, improved *note DeprecationWarning: 179.\nhandling\n\nC API improvements:\n\n* *note PEP 539: 904, new C API for thread-local storage\n\nDocumentation improvements:\n\n* *note PEP 545: 905, Python documentation translations\n\n* New documentation translations: Japanese(2), French(3), and\nKorean(4).\n\nThis release features notable performance improvements in many areas.\nThe *note Optimizations: 906. section lists them in detail.\n",
            "subsections": []
        },
        "For a list of changes that may affect compatibility with previous Python": {
            "content": "releases please refer to the *note Porting to Python 3.7: 907. section.\n\n---------- Footnotes ----------\n\n(1)\nhttps://mail.python.org/pipermail/python-dev/2017-December/151283.html\n\n(2) https://docs.python.org/ja/\n\n(3) https://docs.python.org/fr/\n\n(4) https://docs.python.org/ko/\n\nFile: python3.12.info,  Node: New Features<10>,  Next: Other Language Changes<6>,  Prev: Summary - Release Highlights,  Up: What's New In Python 3 7\n\n\n* Menu:\n\n* PEP 563; Postponed Evaluation of Annotations: PEP 563 Postponed Evaluation of Annotations.\n* PEP 538; Legacy C Locale Coercion: PEP 538 Legacy C Locale Coercion.\n* PEP 540; Forced UTF-8 Runtime Mode: PEP 540 Forced UTF-8 Runtime Mode.\n* PEP 553; Built-in breakpoint(): PEP 553 Built-in breakpoint.\n* PEP 539; New C API for Thread-Local Storage: PEP 539 New C API for Thread-Local Storage.\n* PEP 562; Customization of Access to Module Attributes: PEP 562 Customization of Access to Module Attributes.\n* PEP 564; New Time Functions With Nanosecond Resolution: PEP 564 New Time Functions With Nanosecond Resolution.\n* PEP 565; Show DeprecationWarning in main: PEP 565 Show DeprecationWarning in main.\n* PEP 560; Core Support for typing module and Generic Types: PEP 560 Core Support for typing module and Generic Types.\n* PEP 552; Hash-based .pyc Files: PEP 552 Hash-based pyc Files.\n* PEP 545; Python Documentation Translations: PEP 545 Python Documentation Translations.\n* Python Development Mode (-X dev): Python Development Mode -X dev.\n\nFile: python3.12.info,  Node: PEP 563 Postponed Evaluation of Annotations,  Next: PEP 538 Legacy C Locale Coercion,  Up: New Features<10>\n\n1.6.2.1 PEP 563: Postponed Evaluation of Annotations\n....................................................\n",
            "subsections": []
        },
        "The advent of type hints in Python uncovered two glaring usability": {
            "content": "issues with the functionality of annotations added in PEP 3107(1) and\nrefined further in PEP 526(2):\n\n* annotations could only use names which were already available in\nthe current scope, in other words they didn't support forward\nreferences of any kind; and\n\n* annotating source code had adverse effects on startup time of\nPython programs.\n",
            "subsections": []
        },
        "Both of these issues are fixed by postponing the evaluation of": {
            "content": "annotations.  Instead of compiling code which executes expressions in\nannotations at their definition time, the compiler stores the annotation\nin a string form equivalent to the AST of the expression in question.\nIf needed, annotations can be resolved at runtime using *note\ntyping.gettypehints(): 47f.  In the common case where this is not\nrequired, the annotations are cheaper to store (since short strings are\ninterned by the interpreter) and make startup time faster.\n",
            "subsections": []
        },
        "Usability-wise, annotations now support forward references, making the": {
            "content": "following syntax valid:\n\nclass C:\n@classmethod\ndef fromstring(cls, source: str) -> C:\n...\n\ndef validateb(self, obj: B) -> bool:\n...\n\nclass B:\n...\n",
            "subsections": []
        },
        "Since this change breaks compatibility, the new behavior needs to be": {
            "content": "enabled on a per-module basis in Python 3.7 using a *note future: 0.\nimport:\n\nfrom future import annotations\n\nIt will become the default in Python 3.10.\n\nSee also\n........\n\nPEP 563(3) - Postponed evaluation of annotations\n\nPEP written and implemented by ??ukasz Langa.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3107/\n\n(2) https://peps.python.org/pep-0526/\n\n(3) https://peps.python.org/pep-0563/\n\nFile: python3.12.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<10>\n\n1.6.2.2 PEP 538: Legacy C Locale Coercion\n.........................................\n",
            "subsections": []
        },
        "An ongoing challenge within the Python 3 series has been determining a": {
            "content": "sensible default strategy for handling the \"7-bit ASCII\" text encoding\nassumption currently implied by the use of the default C or POSIX locale\non non-Windows platforms.\n\nPEP 538(1) updates the default interpreter command line interface to\nautomatically coerce that locale to an available UTF-8 based locale as\ndescribed in the documentation of the new *note PYTHONCOERCECLOCALE:\n90b. environment variable.  Automatically setting 'LCCTYPE' this way\nmeans that both the core interpreter and locale-aware C extensions (such\nas *note readline: b5.) will assume the use of UTF-8 as the default text\nencoding, rather than ASCII.\n",
            "subsections": []
        },
        "The platform support definition in PEP 11(2) has also been updated to": {
            "content": "limit full text handling support to suitably configured non-ASCII based\nlocales.\n\nAs part of this change, the default error handler for *note stdin: 293.\nand *note stdout: 90c. is now 'surrogateescape' (rather than 'strict')\nwhen using any of the defined coercion target locales (currently\n'C.UTF-8', 'C.utf8', and 'UTF-8').  The default error handler for *note\nstderr: 757. continues to be 'backslashreplace', regardless of locale.\n",
            "subsections": []
        },
        "Locale coercion is silent by default, but to assist in debugging": {
            "content": "potentially locale related integration problems, explicit warnings\n(emitted directly on *note stderr: 757.) can be requested by setting\n'PYTHONCOERCECLOCALE=warn'.  This setting will also cause the Python\nruntime to emit a warning if the legacy C locale remains active when the\ncore interpreter is initialized.\n",
            "subsections": []
        },
        "While PEP 538(3)'s locale coercion has the benefit of also affecting": {
            "content": "extension modules (such as GNU 'readline'), as well as child processes\n(including those running non-Python applications and older versions of",
            "subsections": []
        },
        "Python), it has the downside of requiring that a suitable target locale": {
            "content": "be present on the running system.  To better handle the case where no\nsuitable target locale is available (as occurs on RHEL/CentOS 7, for\nexample), Python 3.7 also implements *note PEP 540; Forced UTF-8 Runtime\nMode: 900.\n\nSee also\n........\n\nPEP 538(4) - Coercing the legacy C locale to a UTF-8 based locale\n\nPEP written and implemented by Nick Coghlan.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0538/\n\n(2) https://peps.python.org/pep-0011/\n\n(3) https://peps.python.org/pep-0538/\n\n(4) https://peps.python.org/pep-0538/\n\nFile: python3.12.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<10>\n\n1.6.2.3 PEP 540: Forced UTF-8 Runtime Mode\n..........................................\n\nThe new *note -X: 188. 'utf8' command line option and *note PYTHONUTF8:\n90e. environment variable can be used to enable the *note Python UTF-8\nMode: 420.\n",
            "subsections": []
        },
        "When in UTF-8 mode, CPython ignores the locale settings, and uses the": {
            "content": "UTF-8 encoding by default.  The error handlers for *note sys.stdin: 293.\nand *note sys.stdout: 90c. streams are set to 'surrogateescape'.\n",
            "subsections": []
        },
        "The forced UTF-8 mode can be used to change the text handling behavior": {
            "content": "in an embedded Python interpreter without changing the locale settings\nof an embedding application.\n",
            "subsections": []
        },
        "While PEP 540(1)'s UTF-8 mode has the benefit of working regardless of": {
            "content": "which locales are available on the running system, it has the downside\nof having no effect on extension modules (such as GNU 'readline'), child\nprocesses running non-Python applications, and child processes running\nolder versions of Python.  To reduce the risk of corrupting text data\nwhen communicating with such components, Python 3.7 also implements\n*note PEP 540; Forced UTF-8 Runtime Mode: 900.).\n",
            "subsections": []
        },
        "The UTF-8 mode is enabled by default when the locale is 'C' or 'POSIX',": {
            "content": "and the PEP 538(2) locale coercion feature fails to change it to a UTF-8\nbased alternative (whether that failure is due to\n'PYTHONCOERCECLOCALE=0' being set, 'LCALL' being set, or the lack of a\nsuitable target locale).\n\nSee also\n........\n\nPEP 540(3) - Add a new UTF-8 mode\n\nPEP written and implemented by Victor Stinner\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0540/\n\n(2) https://peps.python.org/pep-0538/\n\n(3) https://peps.python.org/pep-0540/\n\nFile: python3.12.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<10>\n\n1.6.2.4 PEP 553: Built-in 'breakpoint()'\n........................................\n\nPython 3.7 includes the new built-in *note breakpoint(): 8f9. function\nas an easy and consistent way to enter the Python debugger.\n\nBuilt-in 'breakpoint()' calls *note sys.breakpointhook(): 910.  By\ndefault, the latter imports *note pdb: a0. and then calls\n'pdb.settrace()', but by binding 'sys.breakpointhook()' to the function\nof your choosing, 'breakpoint()' can enter any debugger.  Additionally,\nthe environment variable *note PYTHONBREAKPOINT: 911. can be set to the\ncallable of your debugger of choice.  Set 'PYTHONBREAKPOINT=0' to\ncompletely disable built-in 'breakpoint()'.\n\nSee also\n........\n\nPEP 553(1) - Built-in breakpoint()\n\nPEP written and implemented by Barry Warsaw\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0553/\n\nFile: python3.12.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<10>\n\n1.6.2.5 PEP 539: New C API for Thread-Local Storage\n...................................................\n",
            "subsections": []
        },
        "While Python provides a C API for thread-local storage support; the": {
            "content": "existing *note Thread Local Storage (TLS) API: 913. has used int to\nrepresent TLS keys across all platforms.  This has not generally been a\nproblem for officially support platforms, but that is neither\nPOSIX-compliant, nor portable in any practical sense.\n\nPEP 539(1) changes this by providing a new *note Thread Specific Storage\n(TSS) API: 914. to CPython which supersedes use of the existing TLS API\nwithin the CPython interpreter, while deprecating the existing API. The\nTSS API uses a new type *note Pytsst: 915. instead of int to represent\nTSS keys-an opaque type the definition of which may depend on the\nunderlying TLS implementation.  Therefore, this will allow to build\nCPython on platforms where the native TLS key is defined in a way that\ncannot be safely cast to int.\n",
            "subsections": []
        },
        "Note that on platforms where the native TLS key is defined in a way that": {
            "content": "cannot be safely cast to int, all functions of the existing TLS API will\nbe no-op and immediately return failure.  This indicates clearly that\nthe old API is not supported on platforms where it cannot be used\nreliably, and that no effort will be made to add such support.\n\nSee also\n........\n\nPEP 539(2) - A New C-API for Thread-Local Storage in CPython\n\nPEP written by Erik M. Bray; implementation by Masayuki Yamamoto.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0539/\n\n(2) https://peps.python.org/pep-0539/\n\nFile: python3.12.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<10>\n\n1.6.2.6 PEP 562: Customization of Access to Module Attributes\n.............................................................\n",
            "subsections": []
        },
        "Python 3.7 allows defining 'getattr()' on modules and will call it": {
            "content": "whenever a module attribute is otherwise not found.  Defining\n'dir()' on modules is now also allowed.\n\nA typical example of where this may be useful is module attribute\ndeprecation and lazy loading.\n\nSee also\n........\n\nPEP 562(1) - Module 'getattr' and 'dir'\n\nPEP written and implemented by Ivan Levkivskyi\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0562/\n\nFile: python3.12.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<10>\n\n1.6.2.7 PEP 564: New Time Functions With Nanosecond Resolution\n..............................................................\n",
            "subsections": []
        },
        "The resolution of clocks in modern systems can exceed the limited": {
            "content": "precision of a floating point number returned by the *note time.time():\n918. function and its variants.  To avoid loss of precision, PEP 564(1)\nadds six new \"nanosecond\" variants of the existing timer functions to\nthe *note time: e8. module:\n\n* *note time.clockgettimens(): 919.\n\n* *note time.clocksettimens(): 91a.\n\n* *note time.monotonicns(): 91b.\n\n* *note time.perfcounterns(): 91c.\n\n* *note time.processtimens(): 91d.\n\n* *note time.timens(): 91e.\n\nThe new functions return the number of nanoseconds as an integer value.\n\nMeasurements(2) show that on Linux and Windows the resolution of *note\ntime.timens(): 91e. is approximately 3 times better than that of *note\ntime.time(): 918.\n\nSee also\n........\n\nPEP 564(3) - Add new time functions with nanosecond resolution\n\nPEP written and implemented by Victor Stinner\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0564/\n\n(2)\nhttps://peps.python.org/pep-0564/#annex-clocks-resolution-in-python\n\n(3) https://peps.python.org/pep-0564/\n\nFile: python3.12.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<10>\n\n1.6.2.8 PEP 565: Show DeprecationWarning in 'main'\n......................................................\n\nThe default handling of *note DeprecationWarning: 179. has been changed\nsuch that these warnings are once more shown by default, but only when\nthe code triggering them is running directly in the *note main: 1.\nmodule.  As a result, developers of single file scripts and those using",
            "subsections": []
        },
        "Python interactively should once again start seeing deprecation warnings": {
            "content": "for the APIs they use, but deprecation warnings triggered by imported\napplication, library and framework modules will continue to be hidden by\ndefault.\n",
            "subsections": []
        },
        "As a result of this change, the standard library now allows developers": {
            "content": "to choose between three different deprecation warning behaviours:\n\n* *note FutureWarning: 23f.: always displayed by default, recommended\nfor warnings intended to be seen by application end users (e.g.\nfor deprecated application configuration settings).\n\n* *note DeprecationWarning: 179.: displayed by default only in *note\nmain: 1. and when running tests, recommended for warnings\nintended to be seen by other Python developers where a version\nupgrade may result in changed behaviour or an error.\n\n* *note PendingDeprecationWarning: 6e0.: displayed by default only\nwhen running tests, intended for cases where a future version\nupgrade will change the warning category to *note\nDeprecationWarning: 179. or *note FutureWarning: 23f.\n\nPreviously both *note DeprecationWarning: 179. and *note",
            "subsections": []
        },
        "PendingDeprecationWarning: 6e0. were only visible when running tests,": {
            "content": "which meant that developers primarily writing single file scripts or\nusing Python interactively could be surprised by breaking changes in the\nAPIs they used.\n\nSee also\n........\n\nPEP 565(1) - Show DeprecationWarning in 'main'\n\nPEP written and implemented by Nick Coghlan\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0565/\n\nFile: python3.12.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<10>\n\n1.6.2.9 PEP 560: Core Support for 'typing' module and Generic Types\n...................................................................\n",
            "subsections": []
        },
        "Initially PEP 484(1) was designed in such way that it would not": {
            "content": "introduce 'any' changes to the core CPython interpreter.  Now type hints\nand the *note typing: ff. module are extensively used by the community,\nso this restriction is removed.  The PEP introduces two special methods\n'classgetitem()' and 'mroentries', these methods are now used\nby most classes and special constructs in *note typing: ff.  As a\nresult, the speed of various operations with types increased up to 7\ntimes, the generic types can be used without metaclass conflicts, and\nseveral long standing bugs in *note typing: ff. module are fixed.\n\nSee also\n........\n\nPEP 560(2) - Core support for typing module and generic types\n\nPEP written and implemented by Ivan Levkivskyi\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0484/\n\n(2) https://peps.python.org/pep-0560/\n\nFile: python3.12.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<10>\n\n1.6.2.10 PEP 552: Hash-based .pyc Files\n.......................................\n",
            "subsections": []
        },
        "Python has traditionally checked the up-to-dateness of bytecode cache": {
            "content": "files (i.e., '.pyc' files) by comparing the source metadata\n(last-modified timestamp and size) with source metadata saved in the\ncache file header when it was generated.  While effective, this\ninvalidation method has its drawbacks.  When filesystem timestamps are\ntoo coarse, Python can miss source updates, leading to user confusion.",
            "subsections": []
        },
        "Additionally, having a timestamp in the cache file is problematic for": {
            "content": "build reproducibility(1) and content-based build systems.\n\nPEP 552(2) extends the pyc format to allow the hash of the source file\nto be used for invalidation instead of the source timestamp.  Such\n'.pyc' files are called \"hash-based\".  By default, Python still uses\ntimestamp-based invalidation and does not generate hash-based '.pyc'\nfiles at runtime.  Hash-based '.pyc' files may be generated with *note\npycompile: ae. or *note compileall: 1e.\n\nHash-based '.pyc' files come in two variants: checked and unchecked.",
            "subsections": []
        },
        "Python validates checked hash-based '.pyc' files against the": {
            "content": "corresponding source files at runtime but doesn't do so for unchecked\nhash-based pycs.  Unchecked hash-based '.pyc' files are a useful\nperformance optimization for environments where a system external to",
            "subsections": []
        },
        "Python (e.g., the build system) is responsible for keeping '.pyc' files": {
            "content": "up-to-date.\n\nSee *note Cached bytecode invalidation: 3b2. for more information.\n\nSee also\n........\n\nPEP 552(3) - Deterministic pycs\n\nPEP written and implemented by Benjamin Peterson\n\n---------- Footnotes ----------\n\n(1) https://reproducible-builds.org/\n\n(2) https://peps.python.org/pep-0552/\n\n(3) https://peps.python.org/pep-0552/\n\nFile: python3.12.info,  Node: PEP 545 Python Documentation Translations,  Next: Python Development Mode -X dev,  Prev: PEP 552 Hash-based pyc Files,  Up: New Features<10>\n\n1.6.2.11 PEP 545: Python Documentation Translations\n...................................................\n\nPEP 545(1) describes the process of creating and maintaining Python\ndocumentation translations.\n\nThree new translations have been added:\n\n- Japanese: 'https://docs.python.org/ja/'\n\n- French: 'https://docs.python.org/fr/'\n\n- Korean: 'https://docs.python.org/ko/'\n\nSee also\n........\n\nPEP 545(2) - Python Documentation Translations\n\nPEP written and implemented by Julien Palard, Inada Naoki, and\nVictor Stinner.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0545/\n\n(2) https://peps.python.org/pep-0545/\n\nFile: python3.12.info,  Node: Python Development Mode -X dev,  Prev: PEP 545 Python Documentation Translations,  Up: New Features<10>\n\n1.6.2.12 Python Development Mode (-X dev)\n.........................................\n\nThe new *note -X: 188. 'dev' command line option or the new *note\nPYTHONDEVMODE: 924. environment variable can be used to enable *note",
            "subsections": []
        },
        "Python Development Mode: 6e3.  When in development mode, Python performs": {
            "content": "additional runtime checks that are too expensive to be enabled by\ndefault.  See *note Python Development Mode: 6e3. documentation for the\nfull description.\n\nFile: python3.12.info,  Node: Other Language Changes<6>,  Next: New Modules<6>,  Prev: New Features<10>,  Up: What's New In Python 3 7\n\n\n* An *note await: 516. expression and comprehensions containing an\n*note async for: 8e0. clause were illegal in the expressions in\n*note formatted string literals: 7cd. due to a problem with the\nimplementation.  In Python 3.7 this restriction was lifted.\n\n* More than 255 arguments can now be passed to a function, and a\nfunction can now have more than 255 parameters.  (Contributed by\nSerhiy Storchaka in bpo-12844(1) and bpo-18896(2).)\n\n* *note bytes.fromhex(): 926. and *note bytearray.fromhex(): 927. now\nignore all ASCII whitespace, not only spaces.  (Contributed by\nRobert Xiao in bpo-28927(3).)\n\n* *note str: 157, *note bytes: 295, and *note bytearray: 294. gained\nsupport for the new *note isascii(): 928. method, which can be used\nto test if a string or bytes contain only the ASCII characters.\n(Contributed by INADA Naoki in bpo-32677(4).)\n\n* *note ImportError: 145. now displays module name and module\n'file' path when 'from ... import ...' fails.  (Contributed by\nMatthias Bussonnier in bpo-29546(5).)\n\n* Circular imports involving absolute imports with binding a\nsubmodule to a name are now supported.  (Contributed by Serhiy\nStorchaka in bpo-30024(6).)\n\n* 'object.format(x, '')' is now equivalent to 'str(x)' rather\nthan 'format(str(self), '')'.  (Contributed by Serhiy Storchaka in\nbpo-28974(7).)\n\n* In order to better support dynamic creation of stack traces, *note\ntypes.TracebackType: 929. can now be instantiated from Python code,\nand the *note tbnext: 92a. attribute on *note tracebacks: 92b. is\nnow writable.  (Contributed by Nathaniel J. Smith in bpo-30579(8).)\n\n* When using the *note -m: 3a5. switch, 'sys.path[0]' is now eagerly\nexpanded to the full starting directory path, rather than being\nleft as the empty directory (which allows imports from the\n'current' working directory at the time when an import occurs)\n(Contributed by Nick Coghlan in bpo-33053(9).)\n\n* The new *note -X: 188. 'importtime' option or the *note\nPYTHONPROFILEIMPORTTIME: 92c. environment variable can be used to\nshow the timing of each module import.  (Contributed by Inada Naoki\nin bpo-31415(10).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=12844\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=18896\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=28927\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=32677\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=29546\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=30024\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=28974\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=30579\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=33053\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=31415\n\nFile: python3.12.info,  Node: New Modules<6>,  Next: Improved Modules<6>,  Prev: Other Language Changes<6>,  Up: What's New In Python 3 7\n\n\n* Menu:\n\n* contextvars::\n* dataclasses: dataclasses<3>.\n* importlib.resources: importlib resources<2>.\n\nFile: python3.12.info,  Node: contextvars,  Next: dataclasses<3>,  Up: New Modules<6>\n\n1.6.4.1 contextvars\n...................\n\nThe new *note contextvars: 22. module and a set of *note new C APIs:\n92f. introduce support for 'context variables'.  Context variables are\nconceptually similar to thread-local variables.  Unlike TLS, context\nvariables support asynchronous code correctly.\n\nThe *note asyncio: 9. and *note decimal: 33. modules have been updated\nto use and support context variables out of the box.  Particularly the\nactive decimal context is now stored in a context variable, which allows\ndecimal operations to work with the correct context in asynchronous\ncode.\n\nSee also\n........\n\nPEP 567(1) - Context Variables\n\nPEP written and implemented by Yury Selivanov\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0567/\n\nFile: python3.12.info,  Node: dataclasses<3>,  Next: importlib resources<2>,  Prev: contextvars,  Up: New Modules<6>\n\n1.6.4.2 dataclasses\n...................\n\nThe new *note dataclass(): 38d. decorator provides a way to declare\n'data classes'.  A data class describes its attributes using class\nvariable annotations.  Its constructor and other magic methods, such as\n*note repr(): 3e8, *note eq(): 931, and *note hash(): 932.\nare generated automatically.\n\nExample:\n\n@dataclass\nclass Point:\nx: float\ny: float\nz: float = 0.0\n\np = Point(1.5, 2.5)\nprint(p)   # produces \"Point(x=1.5, y=2.5, z=0.0)\"\n\nSee also\n........\n\nPEP 557(1) - Data Classes\n\nPEP written and implemented by Eric V. Smith\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0557/\n\nFile: python3.12.info,  Node: importlib resources<2>,  Prev: dataclasses<3>,  Up: New Modules<6>\n\n1.6.4.3 importlib.resources\n...........................\n\nThe new *note importlib.resources: 75. module provides several new APIs\nand one new ABC for access to, opening, and reading 'resources' inside\npackages.  Resources are roughly similar to files inside packages, but\nthey needn't be actual files on the physical file system.  Module\nloaders can provide a 'getresourcereader()' function which returns a\n*note importlib.abc.ResourceReader: 934. instance to support this new\nAPI. Built-in file path loaders and zip file loaders both support this.\n\nContributed by Barry Warsaw and Brett Cannon in bpo-32248(1).\n\nSee also\n........\n\nimportlibresources(2) - a PyPI backport for earlier Python versions.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32248\n\n(2) https://importlib-resources.readthedocs.io/en/latest/\n\nFile: python3.12.info,  Node: Improved Modules<6>,  Next: C API Changes<5>,  Prev: New Modules<6>,  Up: What's New In Python 3 7\n\n\n* Menu:\n\n* argparse: argparse<2>.\n* asyncio: asyncio<6>.\n* binascii::\n* calendar: calendar<2>.\n* collections: collections<2>.\n* compileall: compileall<2>.\n* concurrent.futures: concurrent futures<2>.\n* contextlib: contextlib<3>.\n* cProfile: cProfile<2>.\n* crypt::\n* datetime: datetime<4>.\n* dbm::\n* decimal::\n* dis: dis<2>.\n* distutils: distutils<4>.\n* enum: enum<4>.\n* functools: functools<3>.\n* gc: gc<4>.\n* hmac: hmac<2>.\n* http.client: http client.\n* http.server: http server.\n* idlelib and IDLE::\n* importlib: importlib<3>.\n* io: io<3>.\n* ipaddress: ipaddress<2>.\n* itertools: itertools<4>.\n* locale: locale<3>.\n* logging: logging<3>.\n* math: math<5>.\n* mimetypes::\n* msilib::\n* multiprocessing: multiprocessing<3>.\n* os: os<6>.\n* pathlib: pathlib<6>.\n* pdb: pdb<3>.\n* pycompile: pycompile<3>.\n* pydoc: pydoc<2>.\n* queue::\n* re: re<2>.\n* signal: signal<2>.\n* socket: socket<5>.\n* socketserver::\n* sqlite3: sqlite3<5>.\n* ssl: ssl<4>.\n* string: string<2>.\n* subprocess::\n* sys: sys<6>.\n* time: time<4>.\n* tkinter: tkinter<4>.\n* tracemalloc: tracemalloc<2>.\n* types: types<3>.\n* unicodedata: unicodedata<5>.\n* unittest: unittest<6>.\n* unittest.mock: unittest mock.\n* urllib.parse: urllib parse<5>.\n* uu::\n* uuid: uuid<2>.\n* warnings: warnings<2>.\n* xml: xml<4>.\n* xml.etree: xml etree.\n* xmlrpc.server: xmlrpc server.\n* zipapp::\n* zipfile: zipfile<2>.\n\nFile: python3.12.info,  Node: argparse<2>,  Next: asyncio<6>,  Up: Improved Modules<6>\n\n1.6.5.1 argparse\n................\n\nThe new *note ArgumentParser.parseintermixedargs(): 937. method allows\nintermixing options and positional arguments.  (Contributed by paul.j3\nin bpo-14191(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=14191\n\nFile: python3.12.info,  Node: asyncio<6>,  Next: binascii,  Prev: argparse<2>,  Up: Improved Modules<6>\n\n1.6.5.2 asyncio\n...............\n\nThe *note asyncio: 9. module has received many new features, usability\nand *note performance improvements: 939.  Notable changes include:\n\n* The new *note provisional: 93a. *note asyncio.run(): 197. function\ncan be used to run a coroutine from synchronous code by\nautomatically creating and destroying the event loop.  (Contributed\nby Yury Selivanov in bpo-32314(1).)\n\n* asyncio gained support for *note contextvars: 22.  *note\nloop.callsoon(): 93b, *note loop.callsoonthreadsafe(): 93c,\n*note loop.calllater(): 93d, *note loop.callat(): 93e, and *note\nFuture.adddonecallback(): 93f. have a new optional keyword-only\n'context' parameter.  *note Tasks: 201. now track their context\nautomatically.  See PEP 567(2) for more details.  (Contributed by\nYury Selivanov in bpo-32436(3).)\n\n* The new *note asyncio.createtask(): 3c5. function has been added\nas a shortcut to 'asyncio.geteventloop().createtask()'.\n(Contributed by Andrew Svetlov in bpo-32311(4).)\n\n* The new *note loop.starttls(): 940. method can be used to upgrade\nan existing connection to TLS. (Contributed by Yury Selivanov in\nbpo-23749(5).)\n\n* The new *note loop.sockrecvinto(): 941. method allows reading\ndata from a socket directly into a provided buffer making it\npossible to reduce data copies.  (Contributed by Antoine Pitrou in\nbpo-31819(6).)\n\n* The new *note asyncio.currenttask(): 198. function returns the\ncurrently running *note Task: 201. instance, and the new *note\nasyncio.alltasks(): 777. function returns a set of all existing\n'Task' instances in a given loop.  The 'Task.currenttask()' and\n'Task.alltasks()' methods have been deprecated.  (Contributed by\nAndrew Svetlov in bpo-32250(7).)\n\n* The new 'provisional' *note BufferedProtocol: 8d1. class allows\nimplementing streaming protocols with manual control over the\nreceive buffer.  (Contributed by Yury Selivanov in bpo-32251(8).)\n\n* The new *note asyncio.getrunningloop(): 942. function returns the\ncurrently running loop, and raises a *note RuntimeError: 17a. if no\nloop is running.  This is in contrast with *note\nasyncio.geteventloop(): 21e, which will 'create' a new event loop\nif none is running.  (Contributed by Yury Selivanov in\nbpo-32269(9).)\n\n* The new *note StreamWriter.waitclosed(): 943. coroutine method\nallows waiting until the stream writer is closed.  The new *note\nStreamWriter.isclosing(): 944. method can be used to determine if\nthe writer is closing.  (Contributed by Andrew Svetlov in\nbpo-32391(10).)\n\n* The new *note loop.socksendfile(): 945. coroutine method allows\nsending files using *note os.sendfile: 946. when possible.\n(Contributed by Andrew Svetlov in bpo-32410(11).)\n\n* The new *note Future.getloop(): 947. and 'Task.getloop()' methods\nreturn the instance of the loop on which a task or a future were\ncreated.  *note Server.getloop(): 948. allows doing the same for\n*note asyncio.Server: 949. objects.  (Contributed by Yury Selivanov\nin bpo-32415(12) and Srinivas Reddy Thatiparthy in bpo-32418(13).)\n\n* It is now possible to control how instances of *note\nasyncio.Server: 949. begin serving.  Previously, the server would\nstart serving immediately when created.  The new 'startserving'\nkeyword argument to *note loop.createserver(): 94a. and *note\nloop.createunixserver(): 94b, as well as *note\nServer.startserving(): 94c, and *note Server.serveforever(): 94d.\ncan be used to decouple server instantiation and serving.  The new\n*note Server.isserving(): 94e. method returns 'True' if the server\nis serving.  *note Server: 949. objects are now asynchronous\ncontext managers:\n\nsrv = await loop.createserver(...)\n\nasync with srv:\n# some code\n\n# At this point, srv is closed and no longer accepts new connections.\n\n(Contributed by Yury Selivanov in bpo-32662(14).)\n\n* Callback objects returned by *note loop.calllater(): 93d. gained\nthe new *note when(): 94f. method which returns an absolute\nscheduled callback timestamp.  (Contributed by Andrew Svetlov in\nbpo-32741(15).)\n\n* The *note loop.createdatagramendpoint(): 517. method gained\nsupport for Unix sockets.  (Contributed by Quentin Dawans in\nbpo-31245(16).)\n\n* The *note asyncio.openconnection(): 950, *note\nasyncio.startserver(): 951. functions, *note\nloop.createconnection(): 3cc, *note loop.createserver(): 94a,\n*note loop.createacceptedsocket(): 952. methods and their\ncorresponding UNIX socket variants now accept the\n'sslhandshaketimeout' keyword argument.  (Contributed by Neil\nAspinall in bpo-29970(17).)\n\n* The new *note Handle.cancelled(): 953. method returns 'True' if the\ncallback was cancelled.  (Contributed by Marat Sharafutdinov in\nbpo-31943(18).)\n\n* The asyncio source has been converted to use the *note async:\n515./*note await: 516. syntax.  (Contributed by Andrew Svetlov in\nbpo-32193(19).)\n\n* The new *note ReadTransport.isreading(): 954. method can be used\nto determine the reading state of the transport.  Additionally,\ncalls to *note ReadTransport.resumereading(): 955. and *note\nReadTransport.pausereading(): 956. are now idempotent.\n(Contributed by Yury Selivanov in bpo-32356(20).)\n\n* Loop methods which accept socket paths now support passing *note\npath-like objects: 957.  (Contributed by Yury Selivanov in\nbpo-32066(21).)\n\n* In *note asyncio: 9. TCP sockets on Linux are now created with\n'TCPNODELAY' flag set by default.  (Contributed by Yury Selivanov\nand Victor Stinner in bpo-27456(22).)\n\n* Exceptions occurring in cancelled tasks are no longer logged.\n(Contributed by Yury Selivanov in bpo-30508(23).)\n\n* New 'WindowsSelectorEventLoopPolicy' and\n'WindowsProactorEventLoopPolicy' classes.  (Contributed by Yury\nSelivanov in bpo-33792(24).)\n\nSeveral 'asyncio' APIs have been *note deprecated: 958.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32314\n\n(2) https://peps.python.org/pep-0567/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=32436\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=32311\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=23749\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=31819\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=32250\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=32251\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=32269\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=32391\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=32410\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=32415\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=32418\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=32662\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=32741\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=31245\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=29970\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=31943\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=32193\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=32356\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=32066\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=27456\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=30508\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=33792\n\nFile: python3.12.info,  Node: binascii,  Next: calendar<2>,  Prev: asyncio<6>,  Up: Improved Modules<6>\n\n1.6.5.3 binascii\n................\n\nThe *note b2auu(): 95a. function now accepts an optional 'backtick'\nkeyword argument.  When it's true, zeros are represented by ''`''\ninstead of spaces.  (Contributed by Xiang Zhang in bpo-30103(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30103\n\nFile: python3.12.info,  Node: calendar<2>,  Next: collections<2>,  Prev: binascii,  Up: Improved Modules<6>\n\n1.6.5.4 calendar\n................\n\nThe *note HTMLCalendar: 95c. class has new class attributes which ease\nthe customization of CSS classes in the produced HTML calendar.\n(Contributed by Oz Tiram in bpo-30095(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30095\n\nFile: python3.12.info,  Node: collections<2>,  Next: compileall<2>,  Prev: calendar<2>,  Up: Improved Modules<6>\n\n1.6.5.5 collections\n...................\n\n'collections.namedtuple()' now supports default values.  (Contributed by",
            "subsections": []
        },
        "Raymond Hettinger in bpo-32320(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32320\n\nFile: python3.12.info,  Node: compileall<2>,  Next: concurrent futures<2>,  Prev: collections<2>,  Up: Improved Modules<6>\n\n1.6.5.6 compileall\n..................\n\n*note compileall.compiledir(): 95f. learned the new 'invalidationmode'\nparameter, which can be used to enable *note hash-based .pyc\ninvalidation: 901.  The invalidation mode can also be specified on the\ncommand line using the new '--invalidation-mode' argument.  (Contributed\nby Benjamin Peterson in bpo-31650(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31650\n\nFile: python3.12.info,  Node: concurrent futures<2>,  Next: contextlib<3>,  Prev: compileall<2>,  Up: Improved Modules<6>\n\n1.6.5.7 concurrent.futures\n..........................\n\n*note ProcessPoolExecutor: 707. and *note ThreadPoolExecutor: 529. now\nsupport the new 'initializer' and 'initargs' constructor arguments.\n(Contributed by Antoine Pitrou in bpo-21423(1).)\n\nThe *note ProcessPoolExecutor: 707. can now take the multiprocessing\ncontext via the new 'mpcontext' argument.  (Contributed by Thomas",
            "subsections": []
        },
        "Moreau in bpo-31540(2).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=21423\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31540\n\nFile: python3.12.info,  Node: contextlib<3>,  Next: cProfile<2>,  Prev: concurrent futures<2>,  Up: Improved Modules<6>\n\n1.6.5.8 contextlib\n..................\n\nThe new *note nullcontext(): 5e2. is a simpler and faster no-op context\nmanager than *note ExitStack: 962.  (Contributed by Jesse-Bakker in\nbpo-10049(1).)\n\nThe new *note asynccontextmanager(): 963, *note\nAbstractAsyncContextManager: 964, and *note AsyncExitStack: 965. have\nbeen added to complement their synchronous counterparts.  (Contributed\nby Jelle Zijlstra in bpo-29679(2) and bpo-30241(3), and by Alexander",
            "subsections": []
        },
        "Mohr and Ilya Kulakov in bpo-29302(4).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=10049\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=29679\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=30241\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=29302\n\nFile: python3.12.info,  Node: cProfile<2>,  Next: crypt,  Prev: contextlib<3>,  Up: Improved Modules<6>\n\n1.6.5.9 cProfile\n................\n\nThe *note cProfile: 25. command line now accepts '-m modulename' as an\nalternative to script path.  (Contributed by Sanyam Khurana in\nbpo-21862(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=21862\n\nFile: python3.12.info,  Node: crypt,  Next: datetime<4>,  Prev: cProfile<2>,  Up: Improved Modules<6>\n\n1.6.5.10 crypt\n..............\n\nThe *note crypt: 26. module now supports the Blowfish hashing method.\n(Contributed by Serhiy Storchaka in bpo-31664(1).)\n\nThe *note mksalt(): 968. function now allows specifying the number of\nrounds for hashing.  (Contributed by Serhiy Storchaka in bpo-31702(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31664\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31702\n\nFile: python3.12.info,  Node: datetime<4>,  Next: dbm,  Prev: crypt,  Up: Improved Modules<6>\n\n1.6.5.11 datetime\n.................\n\nThe new *note datetime.fromisoformat(): 3e2. method constructs a *note\ndatetime: 222. object from a string in one of the formats output by\n*note datetime.isoformat(): 96a.  (Contributed by Paul Ganssle in\nbpo-15873(1).)\n\nThe *note tzinfo: 3a2. class now supports sub-minute offsets.\n(Contributed by Alexander Belopolsky in bpo-5288(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=15873\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=5288\n\nFile: python3.12.info,  Node: dbm,  Next: decimal,  Prev: datetime<4>,  Up: Improved Modules<6>\n\n1.6.5.12 dbm\n............\n\n*note dbm.dumb: 30. now supports reading read-only files and no longer\nwrites the index file when it is not changed.\n\nFile: python3.12.info,  Node: decimal,  Next: dis<2>,  Prev: dbm,  Up: Improved Modules<6>\n\n1.6.5.13 decimal\n................\n\nThe *note decimal: 33. module now uses *note context variables: 8f5. to\nstore the decimal context.  (Contributed by Yury Selivanov in\nbpo-32630(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32630\n\nFile: python3.12.info,  Node: dis<2>,  Next: distutils<4>,  Prev: decimal,  Up: Improved Modules<6>\n\n1.6.5.14 dis\n............\n\nThe *note dis(): 96e. function is now able to disassemble nested code\nobjects (the code of comprehensions, generator expressions and nested\nfunctions, and the code used for building nested classes).  The maximum\ndepth of disassembly recursion is controlled by the new 'depth'\nparameter.  (Contributed by Serhiy Storchaka in bpo-11822(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=11822\n\nFile: python3.12.info,  Node: distutils<4>,  Next: enum<4>,  Prev: dis<2>,  Up: Improved Modules<6>\n\n1.6.5.15 distutils\n..................\n\n'README.rst' is now included in the list of distutils standard READMEs\nand therefore included in source distributions.  (Contributed by Ryan",
            "subsections": []
        },
        "Gonzalez in bpo-11913(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=11913\n\nFile: python3.12.info,  Node: enum<4>,  Next: functools<3>,  Prev: distutils<4>,  Up: Improved Modules<6>\n\n1.6.5.16 enum\n.............\n\nThe *note Enum: 3fd. learned the new 'ignore' class property, which\nallows listing the names of properties which should not become enum\nmembers.  (Contributed by Ethan Furman in bpo-31801(1).)\n",
            "subsections": []
        },
        "In Python 3.8, attempting to check for non-Enum objects in 'Enum'": {
            "content": "classes will raise a *note TypeError: 28e. (e.g.  '1 in Color');\nsimilarly, attempting to check for non-Flag objects in a 'Flag' member\nwill raise *note TypeError: 28e. (e.g.  '1 in Perm.RW'); currently, both\noperations return *note False: 971. instead.  (Contributed by Ethan",
            "subsections": []
        },
        "With this parameter, the server serves the specified directory, by": {
            "content": "default it uses the current working directory.  (Contributed by Ste'phane",
            "subsections": []
        },
        "Wirtel and Julien Palard in bpo-28707(2).)": {
            "content": "The new *note ThreadingHTTPServer: 97e. class uses threads to handle\nrequests using 'ThreadingMixin'.  It is used when 'http.server' is run\nwith '-m'.  (Contributed by Julien Palard in bpo-31639(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=29654\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=28707\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=31639\n\nFile: python3.12.info,  Node: idlelib and IDLE,  Next: importlib<3>,  Prev: http server,  Up: Improved Modules<6>\n\n1.6.5.22 idlelib and IDLE\n.........................\n",
            "subsections": []
        },
        "Multiple fixes for autocompletion.  (Contributed by Louie Lu in": {
            "content": "bpo-15786(2).)\n\nNew in 3.6.3:\n",
            "subsections": []
        },
        "Module Browser (on the File menu, formerly called Class Browser), now": {
            "content": "displays nested functions and classes in addition to top-level functions\nand classes.  (Contributed by Guilherme Polo, Cheryl Sabella, and Terry",
            "subsections": []
        },
        "Jan Reedy in bpo-1612262(2).)": {
            "content": "",
            "subsections": []
        },
        "The Settings dialog (Options, Configure IDLE) has been partly rewritten": {
            "content": "to improve both appearance and function.  (Contributed by Cheryl Sabella\nand Terry Jan Reedy in multiple issues.)\n\nNew in 3.6.4:\n",
            "subsections": []
        },
        "The font sample now includes a selection of non-Latin characters so that": {
            "content": "users can better see the effect of selecting a particular font.\n(Contributed by Terry Jan Reedy in bpo-13802(5).)  The sample can be\nedited to include other characters.  (Contributed by Serhiy Storchaka in\nbpo-31860(6).)\n\nNew in 3.6.6:\n",
            "subsections": []
        },
        "The IDLE features formerly implemented as extensions have been": {
            "content": "reimplemented as normal features.  Their settings have been moved from\nthe Extensions tab to other dialog tabs.  (Contributed by Charles",
            "subsections": []
        },
        "Wohlganger and Terry Jan Reedy in bpo-27099(5).)": {
            "content": "",
            "subsections": []
        },
        "Editor code context option revised.  Box displays all context lines up": {
            "content": "to maxlines.  Clicking on a context line jumps the editor to that line.",
            "subsections": []
        },
        "Context colors for custom themes is added to Highlights tab of Settings": {
            "content": "dialog.  (Contributed by Cheryl Sabella and Terry Jan Reedy in\nbpo-33642(7), bpo-33768(8), and bpo-33679(9).)\n",
            "subsections": []
        },
        "On Windows, a new API call tells Windows that tk scales for DPI. On": {
            "content": "Windows 8.1+ or 10, with DPI compatibility properties of the Python\nbinary unchanged, and a monitor resolution greater than 96 DPI, this\nshould make text and lines sharper.  It should otherwise have no effect.\n(Contributed by Terry Jan Reedy in bpo-33656(10).)\n\nNew in 3.6.7:\n",
            "subsections": []
        },
        "They re-appear in the box for the next customized run.  One can also": {
            "content": "suppress the normal Shell main module restart.  (Contributed by Cheryl",
            "subsections": []
        },
        "Sabella, Terry Jan Reedy, and others in bpo-5680(11) and bpo-37627(12).)": {
            "content": "New in 3.7.5:\n",
            "subsections": []
        },
        "Add optional line numbers for IDLE editor windows.  Windows open without": {
            "content": "line numbers unless set otherwise in the General tab of the\nconfiguration dialog.  Line numbers for an existing window are shown and\nhidden in the Options menu.  (Contributed by Tal Einat and Saimadhav",
            "subsections": []
        },
        "Heblikar in bpo-17535(13).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=15786\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=1612262\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=13802\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=31860\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=27099\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=33642\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=33768\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=33679\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=33656\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=1529353\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=5680\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=37627\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=17535\n\nFile: python3.12.info,  Node: importlib<3>,  Next: io<3>,  Prev: idlelib and IDLE,  Up: Improved Modules<6>\n\n1.6.5.23 importlib\n..................\n\nThe *note importlib.abc.ResourceReader: 934. ABC was introduced to\nsupport the loading of resources from packages.  See also *note\nimportlib.resources: 8f7.  (Contributed by Barry Warsaw, Brett Cannon in\nbpo-32248(1).)\n\n*note importlib.reload(): 26b. now raises *note ModuleNotFoundError:\n981. if the module lacks a spec.  (Contributed by Garvit Khatri in\nbpo-29851(2).)\n\n'importlib.findspec()' now raises *note ModuleNotFoundError: 981.\ninstead of *note AttributeError: 395. if the specified parent module is\nnot a package (i.e.  lacks a 'path' attribute).  (Contributed by",
            "subsections": []
        },
        "Milan Oberkirch in bpo-30436(3).)": {
            "content": "",
            "subsections": []
        },
        "The new 'importlib.sourcehash()' can be used to compute the hash of the": {
            "content": "passed source.  A *note hash-based .pyc file: 901. embeds the value\nreturned by this function.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32248\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=29851\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=30436\n\nFile: python3.12.info,  Node: io<3>,  Next: ipaddress<2>,  Prev: importlib<3>,  Up: Improved Modules<6>\n\n1.6.5.24 io\n...........\n\nThe new *note TextIOWrapper.reconfigure(): 983. method can be used to\nreconfigure the text stream with the new settings.  (Contributed by",
            "subsections": []
        },
        "Antoine Pitrou in bpo-30526(1) and INADA Naoki in bpo-15216(2).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30526\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=15216\n\nFile: python3.12.info,  Node: ipaddress<2>,  Next: itertools<4>,  Prev: io<3>,  Up: Improved Modules<6>\n\n1.6.5.25 ipaddress\n..................\n\nThe new 'subnetof()' and 'supernetof()' methods of *note\nipaddress.IPv6Network: 985. and *note ipaddress.IPv4Network: 986. can be\nused for network containment tests.  (Contributed by Michel Albert and",
            "subsections": []
        },
        "Cheryl Sabella in bpo-20825(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=20825\n\nFile: python3.12.info,  Node: itertools<4>,  Next: locale<3>,  Prev: ipaddress<2>,  Up: Improved Modules<6>\n\n1.6.5.26 itertools\n..................\n\n*note itertools.islice(): 988. now accepts *note integer-like objects:\n4f1. as start, stop, and slice arguments.  (Contributed by Will Roberts\nin bpo-30537(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30537\n\nFile: python3.12.info,  Node: locale<3>,  Next: logging<3>,  Prev: itertools<4>,  Up: Improved Modules<6>\n\n1.6.5.27 locale\n...............\n\nThe new 'monetary' argument to *note locale.formatstring(): 271. can be\nused to make the conversion use monetary thousands separators and\ngrouping strings.  (Contributed by Garvit in bpo-10379(1).)\n\nThe *note locale.getpreferredencoding(): 290. function now always\nreturns ''UTF-8'' on Android or when in the *note forced UTF-8 mode:\n900.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=10379\n\nFile: python3.12.info,  Node: logging<3>,  Next: math<5>,  Prev: locale<3>,  Up: Improved Modules<6>\n\n1.6.5.28 logging\n................\n\n*note Logger: 98b. instances can now be pickled.  (Contributed by Vinay",
            "subsections": []
        },
        "Sajip in bpo-30520(1).)": {
            "content": "The new *note StreamHandler.setStream(): 98c. method can be used to\nreplace the logger stream after handler creation.  (Contributed by Vinay",
            "subsections": []
        },
        "Sajip in bpo-30522(2).)": {
            "content": "",
            "subsections": []
        },
        "It is now possible to specify keyword arguments to handler constructors": {
            "content": "in configuration passed to *note logging.config.fileConfig(): 98d.\n(Contributed by Preston Landers in bpo-31080(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30520\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=30522\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=31080\n\nFile: python3.12.info,  Node: math<5>,  Next: mimetypes,  Prev: logging<3>,  Up: Improved Modules<6>\n\n1.6.5.29 math\n.............\n\nThe new *note math.remainder(): 98f. function implements the IEEE\n754-style remainder operation.  (Contributed by Mark Dickinson in\nbpo-29962(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=29962\n\nFile: python3.12.info,  Node: mimetypes,  Next: msilib,  Prev: math<5>,  Up: Improved Modules<6>\n\n1.6.5.30 mimetypes\n..................\n",
            "subsections": []
        },
        "The MIME type of .bmp has been changed from ''image/x-ms-bmp'' to": {
            "content": "''image/bmp''.  (Contributed by Nitish Chandra in bpo-22589(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=22589\n\nFile: python3.12.info,  Node: msilib,  Next: multiprocessing<3>,  Prev: mimetypes,  Up: Improved Modules<6>\n\n1.6.5.31 msilib\n...............\n\nThe new *note Database.Close(): 992. method can be used to close the MSI\ndatabase.  (Contributed by Berker Peksag in bpo-20486(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=20486\n\nFile: python3.12.info,  Node: multiprocessing<3>,  Next: os<6>,  Prev: msilib,  Up: Improved Modules<6>\n\n1.6.5.32 multiprocessing\n........................\n\nThe new *note Process.close(): 994. method explicitly closes the process\nobject and releases all resources associated with it.  *note ValueError:\n183. is raised if the underlying process is still running.  (Contributed\nby Antoine Pitrou in bpo-30596(1).)\n\nThe new *note Process.kill(): 995. method can be used to terminate the\nprocess using the 'SIGKILL' signal on Unix.  (Contributed by Vitor",
            "subsections": []
        },
        "Pereira in bpo-30794(2).)": {
            "content": "Non-daemonic threads created by *note Process: 996. are now joined on\nprocess exit.  (Contributed by Antoine Pitrou in bpo-18966(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30596\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=30794\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=18966\n\nFile: python3.12.info,  Node: os<6>,  Next: pathlib<6>,  Prev: multiprocessing<3>,  Up: Improved Modules<6>\n\n1.6.5.33 os\n...........\n\n*note os.fwalk(): 998. now accepts the 'path' argument as *note bytes:\n295.  (Contributed by Serhiy Storchaka in bpo-28682(1).)\n\n*note os.scandir(): 88c. gained support for *note file descriptors: 999.\n(Contributed by Serhiy Storchaka in bpo-25996(2).)\n\nThe new *note registeratfork(): 99a. function allows registering",
            "subsections": []
        },
        "Python callbacks to be executed at process fork.  (Contributed by": {
            "content": "",
            "subsections": []
        },
        "Antoine Pitrou in bpo-16500(3).)": {
            "content": "Added *note os.preadv(): 99b. (combine the functionality of *note\nos.readv(): 99c. and *note os.pread(): 99d.) and *note os.pwritev():\n99e. functions (combine the functionality of *note os.writev(): 99f. and\n*note os.pwrite(): 9a0.).  (Contributed by Pablo Galindo in\nbpo-31368(4).)\n\nThe mode argument of *note os.makedirs(): 9a1. no longer affects the\nfile permission bits of newly created intermediate-level directories.\n(Contributed by Serhiy Storchaka in bpo-19930(5).)\n\n*note os.dup2(): 9a2. now returns the new file descriptor.  Previously,\n'None' was always returned.  (Contributed by Benjamin Peterson in\nbpo-32441(6).)\n\nThe structure returned by *note os.stat(): 1bf. now contains the *note\nstfstype: 9a3. attribute on Solaris and its derivatives.  (Contributed\nby Jes??s Cea Avi??n in bpo-32659(7).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28682\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=25996\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=16500\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=31368\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=19930\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=32441\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=32659\n\nFile: python3.12.info,  Node: pathlib<6>,  Next: pdb<3>,  Prev: os<6>,  Up: Improved Modules<6>\n\n1.6.5.34 pathlib\n................\n\nThe new *note Path.ismount(): 842. method is now available on POSIX\nsystems and can be used to determine whether a path is a mount point.\n(Contributed by Cooper Ry Lees in bpo-30897(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30897\n\nFile: python3.12.info,  Node: pdb<3>,  Next: pycompile<3>,  Prev: pathlib<6>,  Up: Improved Modules<6>\n\n1.6.5.35 pdb\n............\n\n*note pdb.settrace(): 9a6. now takes an optional 'header' keyword-only\nargument.  If given, it is printed to the console just before debugging\nbegins.  (Contributed by Barry Warsaw in bpo-31389(1).)\n\n*note pdb: a0. command line now accepts '-m modulename' as an\nalternative to script file.  (Contributed by Mario Corchero in\nbpo-32206(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31389\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32206\n\nFile: python3.12.info,  Node: pycompile<3>,  Next: pydoc<2>,  Prev: pdb<3>,  Up: Improved Modules<6>\n\n1.6.5.36 pycompile\n...................\n\n*note pycompile.compile(): 850. - and by extension, *note compileall:\n1e. - now respects the 'SOURCEDATEEPOCH' environment variable by\nunconditionally creating '.pyc' files for hash-based validation.  This\nallows for guaranteeing reproducible builds(1) of '.pyc' files when they\nare created eagerly.  (Contributed by Bernhard M. Wiedemann in\nbpo-29708(2).)\n\n---------- Footnotes ----------\n\n(1) https://reproducible-builds.org/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=29708\n\nFile: python3.12.info,  Node: pydoc<2>,  Next: queue,  Prev: pycompile<3>,  Up: Improved Modules<6>\n\n1.6.5.37 pydoc\n..............\n",
            "subsections": []
        },
        "The pydoc server can now bind to an arbitrary hostname specified by the": {
            "content": "new '-n' command-line argument.  (Contributed by Feanil Patel in\nbpo-31128(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31128\n\nFile: python3.12.info,  Node: queue,  Next: re<2>,  Prev: pydoc<2>,  Up: Improved Modules<6>\n\n1.6.5.38 queue\n..............\n\nThe new *note SimpleQueue: 9aa. class is an unbounded FIFO queue.\n(Contributed by Antoine Pitrou in bpo-14976(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=14976\n\nFile: python3.12.info,  Node: re<2>,  Next: signal<2>,  Prev: queue,  Up: Improved Modules<6>\n\n1.6.5.39 re\n...........\n\nThe flags *note re.ASCII: 3f9, *note re.LOCALE: 9ac. and *note\nre.UNICODE: 9ad. can be set within the scope of a group.  (Contributed\nby Serhiy Storchaka in bpo-31690(1).)\n\n*note re.split(): 9ae. now supports splitting on a pattern like 'r'\\b'',\n''^$'' or '(?=-)' that matches an empty string.  (Contributed by Serhiy",
            "subsections": []
        },
        "Storchaka in bpo-25054(2).)": {
            "content": "Regular expressions compiled with the *note re.LOCALE: 9ac. flag no\nlonger depend on the locale at compile time.  Locale settings are\napplied only when the compiled regular expression is used.  (Contributed\nby Serhiy Storchaka in bpo-30215(3).)\n\n*note FutureWarning: 23f. is now emitted if a regular expression\ncontains character set constructs that will change semantically in the\nfuture, such as nested sets and set operations.  (Contributed by Serhiy",
            "subsections": []
        },
        "Storchaka in bpo-30349(4).)": {
            "content": "",
            "subsections": []
        },
        "Compiled regular expression and match objects can now be copied using": {
            "content": "*note copy.copy(): 289. and *note copy.deepcopy(): 9af.  (Contributed by",
            "subsections": []
        },
        "Serhiy Storchaka in bpo-10076(5).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31690\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=25054\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=30215\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=30349\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=10076\n\nFile: python3.12.info,  Node: signal<2>,  Next: socket<5>,  Prev: re<2>,  Up: Improved Modules<6>\n\n1.6.5.40 signal\n...............\n\nThe new 'warnonfullbuffer' argument to the *note\nsignal.setwakeupfd(): 9b1. function makes it possible to specify\nwhether Python prints a warning on stderr when the wakeup buffer\noverflows.  (Contributed by Nathaniel J. Smith in bpo-30050(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30050\n\nFile: python3.12.info,  Node: socket<5>,  Next: socketserver,  Prev: signal<2>,  Up: Improved Modules<6>\n\n1.6.5.41 socket\n...............\n\nThe new *note socket.getblocking(): 9b3. method returns 'True' if the\nsocket is in blocking mode and 'False' otherwise.  (Contributed by Yury",
            "subsections": []
        },
        "Selivanov in bpo-32373(1).)": {
            "content": "The new *note socket.close(): 9b4. function closes the passed socket\nfile descriptor.  This function should be used instead of *note\nos.close(): 9b5. for better compatibility across platforms.\n(Contributed by Christian Heimes in bpo-32454(2).)\n\nThe *note socket: c6. module now exposes the 'socket.TCPCONGESTION'\n(Linux 2.6.13), 'socket.TCPUSERTIMEOUT' (Linux 2.6.37), and\n'socket.TCPNOTSENTLOWAT' (Linux 3.12) constants.  (Contributed by Omar",
            "subsections": []
        },
        "Sandoval in bpo-26273(3) and Nathaniel J. Smith in bpo-29728(4).)": {
            "content": "Support for *note socket.AFVSOCK: 9b6. sockets has been added to allow\ncommunication between virtual machines and their hosts.  (Contributed by",
            "subsections": []
        },
        "Cathy Avery in bpo-27584(5).)": {
            "content": "",
            "subsections": []
        },
        "Sockets now auto-detect family, type and protocol from file descriptor": {
            "content": "by default.  (Contributed by Christian Heimes in bpo-28134(6).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32373\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32454\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=26273\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=29728\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=27584\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=28134\n\nFile: python3.12.info,  Node: socketserver,  Next: sqlite3<5>,  Prev: socket<5>,  Up: Improved Modules<6>\n\n1.6.5.42 socketserver\n.....................\n\n'socketserver.ThreadingMixIn.serverclose()' now waits until all\nnon-daemon threads complete.  'socketserver.ForkingMixIn.serverclose()'\nnow waits until all child processes complete.\n",
            "subsections": []
        },
        "Add a new 'socketserver.ForkingMixIn.blockonclose' class attribute to": {
            "content": "*note socketserver.ForkingMixIn: 9b8. and *note\nsocketserver.ThreadingMixIn: 9b9. classes.  Set the class attribute to\n'False' to get the pre-3.7 behaviour.\n\nFile: python3.12.info,  Node: sqlite3<5>,  Next: ssl<4>,  Prev: socketserver,  Up: Improved Modules<6>\n\n1.6.5.43 sqlite3\n................\n\n*note sqlite3.Connection: 1d9. now exposes the *note backup(): 9bb.\nmethod when the underlying SQLite library is at version 3.6.11 or\nhigher.  (Contributed by Lele Gaifax in bpo-27645(1).)\n\nThe 'database' argument of *note sqlite3.connect(): 1da. now accepts any\n*note path-like object: 957, instead of just a string.  (Contributed by",
            "subsections": []
        },
        "Anders Lorentsen in bpo-31843(2).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27645\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31843\n\nFile: python3.12.info,  Node: ssl<4>,  Next: string<2>,  Prev: sqlite3<5>,  Up: Improved Modules<6>\n\n1.6.5.44 ssl\n............\n\nThe *note ssl: ca. module now uses OpenSSL's builtin API instead of\n'matchhostname()' to check a host name or an IP address.  Values are\nvalidated during TLS handshake.  Any certificate validation error\nincluding failing the host name check now raises *note\nSSLCertVerificationError: 9bd. and aborts the handshake with a proper\nTLS Alert message.  The new exception contains additional information.\nHost name validation can be customized with *note\nSSLContext.hostnamecheckscommonname: 9be.  (Contributed by Christian",
            "subsections": []
        },
        "Heimes in bpo-31399(1).)": {
            "content": "Note: The improved host name check requires a 'libssl'\nimplementation compatible with OpenSSL 1.0.2 or 1.1.  Consequently,\nOpenSSL 0.9.8 and 1.0.1 are no longer supported (see *note Platform\nSupport Removals: 9bf. for more details).  The ssl module is mostly\ncompatible with LibreSSL 2.7.2 and newer.\n\nThe 'ssl' module no longer sends IP addresses in SNI TLS extension.\n(Contributed by Christian Heimes in bpo-32185(2).)\n\n'matchhostname()' no longer supports partial wildcards like\n'www*.example.org'.  (Contributed by Mandeep Singh in bpo-23033(3) and",
            "subsections": []
        },
        "Christian Heimes in bpo-31399(4).)": {
            "content": "",
            "subsections": []
        },
        "The default cipher suite selection of the 'ssl' module now uses a": {
            "content": "blacklist approach rather than a hard-coded whitelist.  Python no longer\nre-enables ciphers that have been blocked by OpenSSL security updates.\nDefault cipher suite selection can be configured at compile time.\n(Contributed by Christian Heimes in bpo-31429(5).)\n",
            "subsections": []
        },
        "Validation of server certificates containing internationalized domain": {
            "content": "names (IDNs) is now supported.  As part of this change, the *note\nSSLSocket.serverhostname: 9c0. attribute now stores the expected\nhostname in A-label form ('\"xn--pythn-mua.org\"'), rather than the\nU-label form ('\"pytho\"n.org\"').  (Contributed by Nathaniel J. Smith and",
            "subsections": []
        },
        "Christian Heimes in bpo-28414(6).)": {
            "content": "",
            "subsections": []
        },
        "The 'ssl' module has preliminary and experimental support for TLS 1.3": {
            "content": "and OpenSSL 1.1.1.  At the time of Python 3.7.0 release, OpenSSL 1.1.1\nis still under development and TLS 1.3 hasn't been finalized yet.  The\nTLS 1.3 handshake and protocol behaves slightly differently than TLS 1.2\nand earlier, see *note TLS 1.3: 9c1.  (Contributed by Christian Heimes\nin bpo-32947(7), bpo-20995(8), bpo-29136(9), bpo-30622(10) and\nbpo-33618(11))\n\n*note SSLSocket: 703. and *note SSLObject: 9c2. no longer have a public\nconstructor.  Direct instantiation was never a documented and supported\nfeature.  Instances must be created with *note SSLContext: 278. methods\n*note wrapsocket(): 279. and *note wrapbio(): 9c3.  (Contributed by",
            "subsections": []
        },
        "Christian Heimes in bpo-32951(12))": {
            "content": "",
            "subsections": []
        },
        "OpenSSL 1.1 APIs for setting the minimum and maximum TLS protocol": {
            "content": "version are available as *note SSLContext.minimumversion: 9c4. and\n*note SSLContext.maximumversion: 9c5.  Supported protocols are\nindicated by several new flags, such as *note HASTLSv11: 9c6.\n(Contributed by Christian Heimes in bpo-32609(13).)\n\nAdded *note ssl.SSLContext.posthandshakeauth: 85c. to enable and *note\nssl.SSLSocket.verifyclientposthandshake(): 85d. to initiate TLS 1.3\npost-handshake authentication.  (Contributed by Christian Heimes in\ngh-78851(14).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31399\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32185\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=23033\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=31399\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=31429\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=28414\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=32947\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=20995\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=29136\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=30622\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=33618\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=32951\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=32609\n\n(14) https://github.com/python/cpython/issues/78851\n\nFile: python3.12.info,  Node: string<2>,  Next: subprocess,  Prev: ssl<4>,  Up: Improved Modules<6>\n\n1.6.5.45 string\n...............\n\n*note string.Template: 453. now lets you to optionally modify the\nregular expression pattern for braced placeholders and non-braced\nplaceholders separately.  (Contributed by Barry Warsaw in\nbpo-1198569(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=1198569\n\nFile: python3.12.info,  Node: subprocess,  Next: sys<6>,  Prev: string<2>,  Up: Improved Modules<6>\n\n1.6.5.46 subprocess\n...................\n\nThe *note subprocess.run(): 9c9. function accepts the new\n'captureoutput' keyword argument.  When true, stdout and stderr will be\ncaptured.  This is equivalent to passing *note subprocess.PIPE: 9ca. as\n'stdout' and 'stderr' arguments.  (Contributed by Bo Bayles in\nbpo-32102(1).)\n\nThe 'subprocess.run' function and the *note subprocess.Popen: 8c3.\nconstructor now accept the 'text' keyword argument as an alias to\n'universalnewlines'.  (Contributed by Andrew Clegg in bpo-31756(2).)\n",
            "subsections": []
        },
        "On Windows the default for 'closefds' was changed from 'False' to": {
            "content": "'True' when redirecting the standard handles.  It's now possible to set\n'closefds' to true when redirecting the standard handles.  See *note\nsubprocess.Popen: 8c3.  This means that 'closefds' now defaults to\n'True' on all supported platforms.  (Contributed by Segev Finer in\nbpo-19764(3).)\n\nThe subprocess module is now more graceful when handling *note\nKeyboardInterrupt: 7f5. during *note subprocess.call(): 9cb, *note\nsubprocess.run(): 9c9, or in a *note Popen: 8c3. context manager.  It\nnow waits a short amount of time for the child to exit, before\ncontinuing the handling of the 'KeyboardInterrupt' exception.\n(Contributed by Gregory P. Smith in bpo-25942(4).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32102\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31756\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=19764\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=25942\n\nFile: python3.12.info,  Node: sys<6>,  Next: time<4>,  Prev: subprocess,  Up: Improved Modules<6>\n\n1.6.5.47 sys\n............\n\nThe new *note sys.breakpointhook(): 910. hook function is called by the\nbuilt-in *note breakpoint(): 8f9.  (Contributed by Barry Warsaw in\nbpo-31353(1).)\n\nOn Android, the new *note sys.getandroidapilevel(): 9cd. returns the\nbuild-time Android API version.  (Contributed by Victor Stinner in\nbpo-28740(2).)\n\nThe new *note sys.getcoroutineorigintrackingdepth(): 9ce. function\nreturns the current coroutine origin tracking depth, as set by the new\n*note sys.setcoroutineorigintrackingdepth(): 9cf.  *note asyncio: 9.\nhas been converted to use this new API instead of the deprecated\n'sys.setcoroutinewrapper()'.  (Contributed by Nathaniel J. Smith in\nbpo-32591(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31353\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=28740\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=32591\n\nFile: python3.12.info,  Node: time<4>,  Next: tkinter<4>,  Prev: sys<6>,  Up: Improved Modules<6>\n\n1.6.5.48 time\n.............\n\nPEP 564(1) adds six new functions with nanosecond resolution to the\n*note time: e8. module:\n\n* *note time.clockgettimens(): 919.\n\n* *note time.clocksettimens(): 91a.\n\n* *note time.monotonicns(): 91b.\n\n* *note time.perfcounterns(): 91c.\n\n* *note time.processtimens(): 91d.\n\n* *note time.timens(): 91e.\n\nNew clock identifiers have been added:\n\n* *note time.CLOCKBOOTTIME: 9d1. (Linux): Identical to *note\ntime.CLOCKMONOTONIC: 465, except it also includes any time that\nthe system is suspended.\n\n* *note time.CLOCKPROF: 9d2. (FreeBSD, NetBSD and OpenBSD):\nHigh-resolution per-process CPU timer.\n\n* *note time.CLOCKUPTIME: 9d3. (FreeBSD, OpenBSD): Time whose\nabsolute value is the time the system has been running and not\nsuspended, providing accurate uptime measurement.\n\nThe new *note time.threadtime(): 754. and *note time.threadtimens():\n9d4. functions can be used to get per-thread CPU time measurements.\n(Contributed by Antoine Pitrou in bpo-32025(2).)\n\nThe new *note time.pthreadgetcpuclockid(): 9d5. function returns the\nclock ID of the thread-specific CPU-time clock.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0564/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32025\n\nFile: python3.12.info,  Node: tkinter<4>,  Next: tracemalloc<2>,  Prev: time<4>,  Up: Improved Modules<6>\n\n1.6.5.49 tkinter\n................\n\nThe new *note tkinter.ttk.Spinbox: 9d7. class is now available.\n(Contributed by Alan Moore in bpo-32585(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32585\n\nFile: python3.12.info,  Node: tracemalloc<2>,  Next: types<3>,  Prev: tkinter<4>,  Up: Improved Modules<6>\n\n1.6.5.50 tracemalloc\n....................\n\n*note tracemalloc.Traceback: 9d9. behaves more like regular tracebacks,\nsorting the frames from oldest to most recent.  *note",
            "subsections": []
        },
        "Traceback.format(): 9da. now accepts negative 'limit', truncating the": {
            "content": "result to the 'abs(limit)' oldest frames.  To get the old behaviour, use\nthe new 'mostrecentfirst' argument to 'Traceback.format()'.\n(Contributed by Jesse Bakker in bpo-32121(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32121\n\nFile: python3.12.info,  Node: types<3>,  Next: unicodedata<5>,  Prev: tracemalloc<2>,  Up: Improved Modules<6>\n\n1.6.5.51 types\n..............\n\nThe new *note WrapperDescriptorType: 9dc, *note MethodWrapperType: 414,\n*note MethodDescriptorType: 9dd, and *note ClassMethodDescriptorType:\n9de. classes are now available.  (Contributed by Manuel Krebber and",
            "subsections": []
        },
        "Guido van Rossum in bpo-29377(1), and Serhiy Storchaka in bpo-32265(2).)": {
            "content": "The new *note types.resolvebases(): 9df. function resolves MRO entries\ndynamically as specified by PEP 560(3).  (Contributed by Ivan Levkivskyi\nin bpo-32717(4).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=29377\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32265\n\n(3) https://peps.python.org/pep-0560/\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=32717\n\nFile: python3.12.info,  Node: unicodedata<5>,  Next: unittest<6>,  Prev: types<3>,  Up: Improved Modules<6>\n\n1.6.5.52 unicodedata\n....................\n\nThe internal *note unicodedata: 100. database has been upgraded to use",
            "subsections": []
        },
        "Unicode 11(1).  (Contributed by Benjamin Peterson.)": {
            "content": "---------- Footnotes ----------\n\n(1) https://www.unicode.org/versions/Unicode11.0.0/\n\nFile: python3.12.info,  Node: unittest<6>,  Next: unittest mock,  Prev: unicodedata<5>,  Up: Improved Modules<6>\n\n1.6.5.53 unittest\n.................\n",
            "subsections": []
        },
        "The new '-k' command-line option allows filtering tests by a name": {
            "content": "substring or a Unix shell-like pattern.  For example, 'python -m\nunittest -k foo' runs 'footests.SomeTest.testsomething',\n'bartests.SomeTest.testfoo', but not\n'bartests.FooTest.testsomething'.  (Contributed by Jonas Haag in\nbpo-32071(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32071\n\nFile: python3.12.info,  Node: unittest mock,  Next: urllib parse<5>,  Prev: unittest<6>,  Up: Improved Modules<6>\n\n1.6.5.54 unittest.mock\n......................\n\nThe *note sentinel: 9e3. attributes now preserve their identity when\nthey are *note copied: 23. or *note pickled: a1.  (Contributed by Serhiy",
            "subsections": []
        },
        "Storchaka in bpo-20804(1).)": {
            "content": "The new *note seal(): 9e4. function allows sealing *note Mock: 878.\ninstances, which will disallow further creation of attribute mocks.  The\nseal is applied recursively to all attributes that are themselves mocks.\n(Contributed by Mario Corchero in bpo-30541(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=20804\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=30541\n\nFile: python3.12.info,  Node: urllib parse<5>,  Next: uu,  Prev: unittest mock,  Up: Improved Modules<6>\n\n1.6.5.55 urllib.parse\n.....................\n\n*note urllib.parse.quote(): 9e6. has been updated from RFC 2396(1) to\nRFC 3986(2), adding '~' to the set of characters that are never quoted\nby default.  (Contributed by Christian Theune and Ratnadeep Debnath in\nbpo-16285(3).)\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc2396.html\n\n(2) https://datatracker.ietf.org/doc/html/rfc3986.html\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=16285\n\nFile: python3.12.info,  Node: uu,  Next: uuid<2>,  Prev: urllib parse<5>,  Up: Improved Modules<6>\n\n1.6.5.56 uu\n...........\n\nThe *note uu.encode(): 9e8. function now accepts an optional 'backtick'\nkeyword argument.  When it's true, zeros are represented by ''`''\ninstead of spaces.  (Contributed by Xiang Zhang in bpo-30103(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30103\n\nFile: python3.12.info,  Node: uuid<2>,  Next: warnings<2>,  Prev: uu,  Up: Improved Modules<6>\n\n1.6.5.57 uuid\n.............\n\nThe new *note UUID.issafe: 9ea. attribute relays information from the\nplatform about whether generated UUIDs are generated with a\nmultiprocessing-safe method.  (Contributed by Barry Warsaw in\nbpo-22807(1).)\n\n*note uuid.getnode(): 9eb. now prefers universally administered MAC\naddresses over locally administered MAC addresses.  This makes a better\nguarantee for global uniqueness of UUIDs returned from *note\nuuid.uuid1(): 9ec.  If only locally administered MAC addresses are\navailable, the first such one found is returned.  (Contributed by Barry",
            "subsections": []
        },
        "Warsaw in bpo-32107(2).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=22807\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32107\n\nFile: python3.12.info,  Node: warnings<2>,  Next: xml<4>,  Prev: uuid<2>,  Up: Improved Modules<6>\n\n1.6.5.58 warnings\n.................\n",
            "subsections": []
        },
        "The initialization of the default warnings filters has changed as": {
            "content": "follows:\n\n* warnings enabled via command line options (including those for\n*note -b: 3a8. and the new CPython-specific *note -X: 188. 'dev'\noption) are always passed to the warnings machinery via the *note\nsys.warnoptions: 328. attribute.\n\n* warnings filters enabled via the command line or the environment\nnow have the following order of precedence:\n\n* the 'BytesWarning' filter for *note -b: 3a8. (or '-bb')\n\n* any filters specified with the *note -W: 6df. option\n\n* any filters specified with the *note PYTHONWARNINGS: 9ee.\nenvironment variable\n\n* any other CPython specific filters (e.g.  the 'default' filter\nadded for the new '-X dev' mode)\n\n* any implicit filters defined directly by the warnings\nmachinery\n\n* in *note CPython debug builds: 67f, all warnings are now displayed\nby default (the implicit filter list is empty)\n\n(Contributed by Nick Coghlan and Victor Stinner in bpo-20361(1),\nbpo-32043(2), and bpo-32230(3).)\n",
            "subsections": []
        },
        "Deprecation warnings are once again shown by default in single-file": {
            "content": "scripts and at the interactive prompt.  See *note PEP 565; Show",
            "subsections": []
        },
        "DeprecationWarning in main: 903. for details.  (Contributed by Nick": {
            "content": "",
            "subsections": []
        },
        "Coghlan in bpo-31975(4).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=20361\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32043\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=32230\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=31975\n\nFile: python3.12.info,  Node: xml<4>,  Next: xml etree,  Prev: warnings<2>,  Up: Improved Modules<6>\n\n1.6.5.59 xml\n............\n\nAs mitigation against DTD and external entity retrieval, the *note\nxml.dom.minidom: 11d. and *note xml.sax: 124. modules no longer process\nexternal entities by default.  (Contributed by Christian Heimes in\ngh-61441(1).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/61441\n\nFile: python3.12.info,  Node: xml etree,  Next: xmlrpc server,  Prev: xml<4>,  Up: Improved Modules<6>\n\n1.6.5.60 xml.etree\n..................\n\n*note ElementPath: 9f1. predicates in the 'find()' methods can now\ncompare text of the current node with '[. = \"text\"]', not only text in\nchildren.  Predicates also allow adding spaces for better readability.\n(Contributed by Stefan Behnel in bpo-31648(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31648\n\nFile: python3.12.info,  Node: xmlrpc server,  Next: zipapp,  Prev: xml etree,  Up: Improved Modules<6>\n\n1.6.5.61 xmlrpc.server\n......................\n\n'SimpleXMLRPCDispatcher.registerfunction' can now be used as a\ndecorator.  (Contributed by Xiang Zhang in bpo-7769(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=7769\n\nFile: python3.12.info,  Node: zipapp,  Next: zipfile<2>,  Prev: xmlrpc server,  Up: Improved Modules<6>\n\n1.6.5.62 zipapp\n...............\n\nFunction *note createarchive(): 9f4. now accepts an optional 'filter'\nargument to allow the user to select which files should be included in\nthe archive.  (Contributed by Irmen de Jong in bpo-31072(1).)\n\nFunction *note createarchive(): 9f4. now accepts an optional\n'compressed' argument to generate a compressed archive.  A command line\noption '--compress' has also been added to support compression.\n(Contributed by Zhiming Wang in bpo-31638(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31072\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31638\n\nFile: python3.12.info,  Node: zipfile<2>,  Prev: zipapp,  Up: Improved Modules<6>\n\n1.6.5.63 zipfile\n................\n\n*note ZipFile: 494. now accepts the new 'compresslevel' parameter to\ncontrol the compression level.  (Contributed by Bo Bayles in\nbpo-21417(1).)\n",
            "subsections": []
        },
        "Subdirectories in archives created by 'ZipFile' are now stored in": {
            "content": "alphabetical order.  (Contributed by Bernhard M. Wiedemann in\nbpo-30693(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=21417\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=30693\n\nFile: python3.12.info,  Node: C API Changes<5>,  Next: Build Changes<5>,  Prev: Improved Modules<6>,  Up: What's New In Python 3 7\n\n\nA new API for thread-local storage has been implemented.  See *note PEP\n539; New C API for Thread-Local Storage: 904. for an overview and *note\nThread Specific Storage (TSS) API: 914. for a complete reference.\n(Contributed by Masayuki Yamamoto in bpo-25658(1).)\n\nThe new *note context variables: 8f5. functionality exposes a number of\n*note new C APIs: 92f.\n\nThe new *note PyImportGetModule(): 9f7. function returns the previously\nimported module with the given name.  (Contributed by Eric Snow in\nbpo-28411(2).)\n\nThe new *note PyRETURNRICHCOMPARE: 9f8. macro eases writing rich\ncomparison functions.  (Contributed by Petr Victorin in bpo-23699(3).)\n\nThe new *note PyUNREACHABLE: 9f9. macro can be used to mark unreachable\ncode paths.  (Contributed by Barry Warsaw in bpo-31338(4).)\n\nThe *note tracemalloc: fa. now exposes a C API through the new *note\nPyTraceMallocTrack(): 9fa. and *note PyTraceMallocUntrack(): 9fb.\nfunctions.  (Contributed by Victor Stinner in bpo-30054(5).)\n",
            "subsections": []
        },
        "The new 'importfindloadstart()' and 'importfindloaddone()'": {
            "content": "static markers can be used to trace module imports.  (Contributed by",
            "subsections": []
        },
        "Christian Heimes in bpo-31574(6).)": {
            "content": "The fields 'name' and 'doc' of structures *note PyMemberDef: 2a7, *note\nPyGetSetDef: 9fc, *note PyStructSequenceField: 9fd, *note",
            "subsections": []
        },
        "PyStructSequenceDesc: 9fe, and 'wrapperbase' are now of type 'const": {
            "content": "char *' rather of 'char *'.  (Contributed by Serhiy Storchaka in\nbpo-28761(7).)\n\nThe result of *note PyUnicodeAsUTF8AndSize(): 6a8. and *note\nPyUnicodeAsUTF8(): 9ff. is now of type 'const char *' rather of 'char\n*'.  (Contributed by Serhiy Storchaka in bpo-28769(8).)\n\nThe result of *note PyMappingKeys(): a00, *note PyMappingValues():\na01. and *note PyMappingItems(): a02. is now always a list, rather than\na list or a tuple.  (Contributed by Oren Milman in bpo-28280(9).)\n\nAdded functions *note PySliceUnpack(): 33d. and *note",
            "subsections": []
        },
        "PySliceAdjustIndices(): 33e.  (Contributed by Serhiy Storchaka in": {
            "content": "bpo-27867(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27867\n\nFile: python3.12.info,  Node: CPython bytecode changes<6>,  Next: Windows-only Changes<2>,  Prev: Changes in the C API<4>,  Up: Porting to Python 3 7\n\n1.6.17.4 CPython bytecode changes\n.................................\n\nThere are two new opcodes: *note LOADMETHOD: a65. and 'CALLMETHOD'.\n(Contributed by Yury Selivanov and INADA Naoki in bpo-26110(1).)\n",
            "subsections": []
        },
        "Pitrou in bpo-16500(11).)": {
            "content": "",
            "subsections": []
        },
        "The 'PyExcRecursionErrorInst' singleton that was part of the public API": {
            "content": "has been removed as its members being never cleared may cause a segfault\nduring finalization of the interpreter.  (Contributed by Xavier de Gaye\nin bpo-22898(1) and bpo-30697(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=22898\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=30697\n",
            "subsections": []
        },
        "The type of results of 'PyThreadstartnewthread()' and": {
            "content": "'PyThreadgetthreadident()', and the 'id' parameter of *note\nPyThreadStateSetAsyncExc(): a08. changed from long to unsigned long.\n(Contributed by Serhiy Storchaka in bpo-6532(15).)\n\n*note PyUnicodeAsWideCharString(): 6d4. now raises a *note ValueError:\n183. if the second argument is 'NULL' and the wchart* string contains\nnull characters.  (Contributed by Serhiy Storchaka in bpo-30708(16).)\n",
            "subsections": []
        },
        "Changes to the startup sequence and the management of dynamic memory": {
            "content": "allocators mean that the long documented requirement to call *note",
            "subsections": []
        },
        "PyInitialize(): 6c2. before calling most C API functions is now relied": {
            "content": "on more heavily, and failing to abide by it may lead to segfaults in\nembedding applications.  See the *note Porting to Python 3.7: 907.\nsection in this document and the *note Before Python Initialization:\na09. section in the C API documentation for more details.\n\nThe new *note PyInterpreterStateGetID(): a0a. returns the unique ID for\na given interpreter.  (Contributed by Eric Snow in bpo-29102(17).)\n\n*note PyDecodeLocale(): a0b, *note PyEncodeLocale(): a0c. now use the\nUTF-8 encoding when the *note UTF-8 mode: 900. is enabled.  (Contributed\nby Victor Stinner in bpo-29240(18).)\n\n*note PyUnicodeDecodeLocaleAndSize(): a0d. and *note",
            "subsections": []
        },
        "PyUnicodeEncodeLocale(): a0e. now use the current locale encoding for": {
            "content": "'surrogateescape' error handler.  (Contributed by Victor Stinner in\nbpo-29240(19).)\n\nThe 'start' and 'end' parameters of *note PyUnicodeFindChar(): 6d1. are\nnow adjusted to behave like string slices.  (Contributed by Xiang Zhang\nin bpo-28822(20).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25658\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=28411\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=23699\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=31338\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=30054\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=31574\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=28761\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=28769\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=28280\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=27867\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=16500\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=22898\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=30697\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=10381\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=6532\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=30708\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=29102\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=29240\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=29240\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=28822\n\nFile: python3.12.info,  Node: Build Changes<5>,  Next: Optimizations<6>,  Prev: C API Changes<5>,  Up: What's New In Python 3 7\n\n\nSupport for building '--without-threads' has been removed.  The *note\nthreading: e7. module is now always available.  (Contributed by Antoine\nPitrou in bpo-31370(1).).\n\nA full copy of libffi is no longer bundled for use when building the\n*note ctypes: 28. module on non-OSX UNIX platforms.  An installed copy\nof libffi is now required when building 'ctypes' on such platforms.\n(Contributed by Zachary Ware in bpo-27979(2).)\n",
            "subsections": []
        },
        "The Windows build process no longer depends on Subversion to pull in": {
            "content": "external sources, a Python script is used to download zipfiles from",
            "subsections": []
        },
        "GitHub instead.  If Python 3.6 is not found on the system (via 'py": {
            "content": "-3.6'), NuGet is used to download a copy of 32-bit Python for this\npurpose.  (Contributed by Zachary Ware in bpo-30450(3).)\n\nThe *note ssl: ca. module requires OpenSSL 1.0.2 or 1.1 compatible\nlibssl.  OpenSSL 1.0.1 has reached end of lifetime on 2016-12-31 and is\nno longer supported.  LibreSSL is temporarily not supported as well.",
            "subsections": []
        },
        "LibreSSL releases up to version 2.6.4 are missing required OpenSSL 1.0.2": {
            "content": "APIs.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31370\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=27979\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=30450\n\nFile: python3.12.info,  Node: Optimizations<6>,  Next: Other CPython Implementation Changes<2>,  Prev: Build Changes<5>,  Up: What's New In Python 3 7\n\n",
            "subsections": []
        },
        "The overhead of calling many methods of various standard library classes": {
            "content": "implemented in C has been significantly reduced by porting more code to\nuse the 'METHFASTCALL' convention.  (Contributed by Victor Stinner in\nbpo-29300(1), bpo-29507(2), bpo-29452(3), and bpo-29286(4).)\n\nVarious optimizations have reduced Python startup time by 10% on Linux\nand up to 30% on macOS. (Contributed by Victor Stinner, INADA Naoki in\nbpo-29585(5), and Ivan Levkivskyi in bpo-31333(6).)\n\nMethod calls are now up to 20% faster due to the bytecode changes which\navoid creating bound method instances.  (Contributed by Yury Selivanov\nand INADA Naoki in bpo-26110(7).)  The *note asyncio: 9. module received\na number of notable optimizations for commonly used functions:\n\n* The *note asyncio.geteventloop(): 21e. function has been\nreimplemented in C to make it up to 15 times faster.  (Contributed\nby Yury Selivanov in bpo-32296(8).)\n\n* *note asyncio.Future: a11. callback management has been optimized.\n(Contributed by Yury Selivanov in bpo-32348(9).)\n\n* *note asyncio.gather(): 3c6. is now up to 15% faster.  (Contributed\nby Yury Selivanov in bpo-32355(10).)\n\n* *note asyncio.sleep(): 89d. is now up to 2 times faster when the\n'delay' argument is zero or negative.  (Contributed by Andrew\nSvetlov in bpo-32351(11).)\n\n* The performance overhead of asyncio debug mode has been reduced.\n(Contributed by Antoine Pitrou in bpo-31970(12).)\n\nAs a result of *note PEP 560 work: 8fb, the import time of *note typing:\nff. has been reduced by a factor of 7, and many typing operations are\nnow faster.  (Contributed by Ivan Levkivskyi in bpo-32226(13).)\n\n*note sorted(): a12. and *note list.sort(): a13. have been optimized for\ncommon cases to be up to 40-75% faster.  (Contributed by Elliot",
            "subsections": []
        },
        "Gorokhovsky in bpo-28685(14).)": {
            "content": "*note dict.copy(): a14. is now up to 5.5 times faster.  (Contributed by",
            "subsections": []
        },
        "Yury Selivanov in bpo-31179(15).)": {
            "content": "*note hasattr(): 1f7. and *note getattr(): a15. are now about 4 times\nfaster when 'name' is not found and 'obj' does not override *note\nobject.getattr(): 1f8. or *note object.getattribute(): a16.\n(Contributed by INADA Naoki in bpo-32544(16).)\n\nSearching for certain Unicode characters (like Ukrainian capital \"??\") in\na string was up to 25 times slower than searching for other characters.",
            "subsections": []
        },
        "It is now only 3 times slower in the worst case.  (Contributed by Serhiy": {
            "content": "",
            "subsections": []
        },
        "Storchaka in bpo-24821(17).)": {
            "content": "The *note collections.namedtuple(): 711. factory has been reimplemented\nto make the creation of named tuples 4 to 6 times faster.  (Contributed\nby Jelle Zijlstra with further improvements by INADA Naoki, Serhiy",
            "subsections": []
        },
        "Storchaka, and Raymond Hettinger in bpo-28638(18).)": {
            "content": "'date.fromordinal()' and 'date.fromtimestamp()' are now up to 30% faster\nin the common case.  (Contributed by Paul Ganssle in bpo-32403(19).)\n\nThe *note os.fwalk(): 998. function is now up to 2 times faster thanks\nto the use of *note os.scandir(): 88c.  (Contributed by Serhiy Storchaka\nin bpo-25996(20).)\n\nThe speed of the *note shutil.rmtree(): 1d5. function has been improved\nby 20-40% thanks to the use of the *note os.scandir(): 88c. function.\n(Contributed by Serhiy Storchaka in bpo-28564(21).)\n\nOptimized case-insensitive matching and searching of *note regular\nexpressions: b4.  Searching some patterns can now be up to 20 times\nfaster.  (Contributed by Serhiy Storchaka in bpo-30285(22).)\n\n*note re.compile(): a17. now converts 'flags' parameter to int object if\nit is 'RegexFlag'.  It is now as fast as Python 3.5, and faster than\nPython 3.6 by about 10% depending on the pattern.  (Contributed by INADA",
            "subsections": []
        },
        "Naoki in bpo-31671(23).)": {
            "content": "The *note modify(): a18. methods of classes *note\nselectors.EpollSelector: a19, *note selectors.PollSelector: a1a. and\n*note selectors.DevpollSelector: a1b. may be around 10% faster under\nheavy loads.  (Contributed by Giampaolo Rodola' in bpo-30014(24))\n",
            "subsections": []
        },
        "Constant folding has been moved from the peephole optimizer to the new": {
            "content": "AST optimizer, which is able perform optimizations more consistently.\n(Contributed by Eugene Toder and INADA Naoki in bpo-29469(25) and\nbpo-11549(26).)\n\nMost functions and methods in *note abc: 4. have been rewritten in C.\nThis makes creation of abstract base classes, and calling *note\nisinstance(): 14b. and *note issubclass(): 5b4. on them 1.5x faster.\nThis also reduces Python start-up time by up to 10%.  (Contributed by",
            "subsections": []
        },
        "Ivan Levkivskyi and INADA Naoki in bpo-31333(27))": {
            "content": "Significant speed improvements to alternate constructors for *note\ndatetime.date: 70f. and *note datetime.datetime: 222. by using fast-path\nconstructors when not constructing subclasses.  (Contributed by Paul",
            "subsections": []
        },
        "Ganssle in bpo-32403(28))": {
            "content": "The speed of comparison of *note array.array: 18f. instances has been\nimproved considerably in certain cases.  It is now from 10x to 70x\nfaster when comparing arrays holding values of the same integer type.\n(Contributed by Adrian Wielgosik in bpo-24700(29).)\n\nThe *note math.erf(): a1c. and *note math.erfc(): a1d. functions now use\nthe (faster) C library implementation on most platforms.  (Contributed\nby Serhiy Storchaka in bpo-26121(30).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=29300\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=29507\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=29452\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=29286\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=29585\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=31333\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=26110\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=32296\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=32348\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=32355\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=32351\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=31970\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=32226\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=28685\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=31179\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=32544\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=24821\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=28638\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=32403\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=25996\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=28564\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=30285\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=31671\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=30014\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=29469\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=11549\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=31333\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=32403\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=24700\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=26121\n\nFile: python3.12.info,  Node: Other CPython Implementation Changes<2>,  Next: Deprecated Python Behavior,  Prev: Optimizations<6>,  Up: What's New In Python 3 7\n\n\n* Trace hooks may now opt out of receiving the 'line' and opt into\nreceiving the 'opcode' events from the interpreter by setting the\ncorresponding new *note ftracelines: a1f. and *note\nftraceopcodes: a20. attributes on the frame being traced.\n(Contributed by Nick Coghlan in bpo-31344(1).)\n\n* Fixed some consistency problems with namespace package module\nattributes.  Namespace module objects now have an 'file' that\nis set to 'None' (previously unset), and their 'spec.origin' is\nalso set to 'None' (previously the string '\"namespace\"').  See\nbpo-32305(2).  Also, the namespace module object's\n'spec.loader' is set to the same value as 'loader'\n(previously, the former was set to 'None').  See bpo-32303(3).\n\n* The *note locals(): 173. dictionary now displays in the lexical\norder that variables were defined.  Previously, the order was\nundefined.  (Contributed by Raymond Hettinger in bpo-32690(4).)\n\n* The 'distutils' 'upload' command no longer tries to change CR\nend-of-line characters to CRLF. This fixes a corruption issue with\nsdists that ended with a byte equivalent to CR. (Contributed by Bo\nBayles in bpo-32304(5).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31344\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32305\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=32303\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=32690\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=32304\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "Yield expressions (both 'yield' and 'yield from' clauses) are now": {
            "content": "deprecated in comprehensions and generator expressions (aside from the\niterable expression in the leftmost 'for' clause).  This ensures that\ncomprehensions always immediately return a container of the appropriate\ntype (rather than potentially returning a *note generator iterator: a22.\nobject), while generator expressions won't attempt to interleave their\nimplicit output with the output from any explicit yield expressions.  In\nPython 3.7, such expressions emit *note DeprecationWarning: 179. when\ncompiled, in Python 3.8 this will be a *note SyntaxError: 146.\n(Contributed by Serhiy Storchaka in bpo-10544(1).)\n\nReturning a subclass of *note complex: 3ad. from *note\nobject.complex(): 3ac. is deprecated and will be an error in future\nPython versions.  This makes 'complex()' consistent with *note\nobject.int(): 4f0. and *note object.float(): 7f0.  (Contributed\nby Serhiy Storchaka in bpo-28894(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=10544\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=28894\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "* Menu:\n\n* aifc::\n* asyncio: asyncio<7>.\n* collections: collections<3>.\n* dbm: dbm<2>.\n* enum: enum<5>.\n* gettext: gettext<2>.\n* importlib: importlib<4>.\n* locale: locale<4>.\n* macpath::\n* threading: threading<5>.\n* socket: socket<6>.\n* ssl: ssl<5>.\n* sunau::\n* sys: sys<7>.\n* wave::\n\nFile: python3.12.info,  Node: aifc,  Next: asyncio<7>,  Up: Deprecated Python modules functions and methods\n\n1.6.11.1 aifc\n.............\n\n'aifc.openfp()' has been deprecated and will be removed in Python 3.9.\nUse *note aifc.open(): a25. instead.  (Contributed by Brian Curtin in\nbpo-31985(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31985\n\nFile: python3.12.info,  Node: asyncio<7>,  Next: collections<3>,  Prev: aifc,  Up: Deprecated Python modules functions and methods\n\n1.6.11.2 asyncio\n................\n\nSupport for directly 'await'-ing instances of *note asyncio.Lock: 89f.\nand other asyncio synchronization primitives has been deprecated.  An\nasynchronous context manager must be used in order to acquire and\nrelease the synchronization resource.  (Contributed by Andrew Svetlov in\nbpo-32253(1).)\n",
            "subsections": []
        },
        "The 'asyncio.Task.currenttask()' and 'asyncio.Task.alltasks()' methods": {
            "content": "have been deprecated.  (Contributed by Andrew Svetlov in bpo-32250(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32253\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32250\n\nFile: python3.12.info,  Node: collections<3>,  Next: dbm<2>,  Prev: asyncio<7>,  Up: Deprecated Python modules functions and methods\n\n1.6.11.3 collections\n....................\n\nIn Python 3.8, the abstract base classes in *note collections.abc: 1c.\nwill no longer be exposed in the regular *note collections: 1b. module.",
            "subsections": []
        },
        "This will help create a clearer distinction between the concrete classes": {
            "content": "and the abstract base classes.  (Contributed by Serhiy Storchaka in\nbpo-25988(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25988\n\nFile: python3.12.info,  Node: dbm<2>,  Next: enum<5>,  Prev: collections<3>,  Up: Deprecated Python modules functions and methods\n\n1.6.11.4 dbm\n............\n\n*note dbm.dumb: 30. now supports reading read-only files and no longer\nwrites the index file when it is not changed.  A deprecation warning is\nnow emitted if the index file is missing and recreated in the ''r'' and\n''w'' modes (this will be an error in future Python releases).\n(Contributed by Serhiy Storchaka in bpo-28847(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28847\n\nFile: python3.12.info,  Node: enum<5>,  Next: gettext<2>,  Prev: dbm<2>,  Up: Deprecated Python modules functions and methods\n\n1.6.11.5 enum\n.............\n",
            "subsections": []
        },
        "Furman in bpo-33217(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33217\n\nFile: python3.12.info,  Node: gettext<2>,  Next: importlib<4>,  Prev: enum<5>,  Up: Deprecated Python modules functions and methods\n\n1.6.11.6 gettext\n................\n\nUsing non-integer value for selecting a plural form in *note gettext:\n5e. is now deprecated.  It never correctly worked.  (Contributed by",
            "subsections": []
        },
        "Serhiy Storchaka in bpo-28692(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28692\n\nFile: python3.12.info,  Node: importlib<4>,  Next: locale<4>,  Prev: gettext<2>,  Up: Deprecated Python modules functions and methods\n\n1.6.11.7 importlib\n..................\n\nMethods 'MetaPathFinder.findmodule()' (replaced by *note",
            "subsections": []
        },
        "MetaPathFinder.findspec(): 666.) and 'PathEntryFinder.findloader()'": {
            "content": "(replaced by *note PathEntryFinder.findspec(): 667.) both deprecated in\nPython 3.4 now emit *note DeprecationWarning: 179.  (Contributed by",
            "subsections": []
        },
        "Matthias Bussonnier in bpo-29576(1).)": {
            "content": "The *note importlib.abc.ResourceLoader: a2c. ABC has been deprecated in\nfavour of *note importlib.abc.ResourceReader: 934.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=29576\n\nFile: python3.12.info,  Node: locale<4>,  Next: macpath,  Prev: importlib<4>,  Up: Deprecated Python modules functions and methods\n\n1.6.11.8 locale\n...............\n\n'locale.format()' has been deprecated, use *note locale.formatstring():\n271. instead.  (Contributed by Garvit in bpo-10379(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=10379\n\nFile: python3.12.info,  Node: macpath,  Next: threading<5>,  Prev: locale<4>,  Up: Deprecated Python modules functions and methods\n\n1.6.11.9 macpath\n................\n\nThe 'macpath' is now deprecated and will be removed in Python 3.8.\n(Contributed by Chi Hsuan Yen in bpo-9850(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=9850\n\nFile: python3.12.info,  Node: threading<5>,  Next: socket<6>,  Prev: macpath,  Up: Deprecated Python modules functions and methods\n\n1.6.11.10 threading\n...................\n\n'dummythreading' and 'dummythread' have been deprecated.  It is no\nlonger possible to build Python with threading disabled.  Use *note\nthreading: e7. instead.  (Contributed by Antoine Pitrou in\nbpo-31370(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31370\n\nFile: python3.12.info,  Node: socket<6>,  Next: ssl<5>,  Prev: threading<5>,  Up: Deprecated Python modules functions and methods\n\n1.6.11.11 socket\n................\n\nThe silent argument value truncation in *note socket.htons(): 68b. and\n*note socket.ntohs(): 68c. has been deprecated.  In future versions of",
            "subsections": []
        },
        "Python, if the passed argument is larger than 16 bits, an exception will": {
            "content": "be raised.  (Contributed by Oren Milman in bpo-28332(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28332\n\nFile: python3.12.info,  Node: ssl<5>,  Next: sunau,  Prev: socket<6>,  Up: Deprecated Python modules functions and methods\n\n1.6.11.12 ssl\n.............\n\n'ssl.wrapsocket()' is deprecated.  Use *note\nssl.SSLContext.wrapsocket(): 279. instead.  (Contributed by Christian",
            "subsections": []
        },
        "Heimes in bpo-28124(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28124\n\nFile: python3.12.info,  Node: sunau,  Next: sys<7>,  Prev: ssl<5>,  Up: Deprecated Python modules functions and methods\n\n1.6.11.13 sunau\n...............\n\n'sunau.openfp()' has been deprecated and will be removed in Python 3.9.\nUse *note sunau.open(): a33. instead.  (Contributed by Brian Curtin in\nbpo-31985(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31985\n\nFile: python3.12.info,  Node: sys<7>,  Next: wave,  Prev: sunau,  Up: Deprecated Python modules functions and methods\n\n1.6.11.14 sys\n.............\n",
            "subsections": []
        },
        "Deprecated 'sys.setcoroutinewrapper()' and": {
            "content": "'sys.getcoroutinewrapper()'.\n",
            "subsections": []
        },
        "The undocumented 'sys.callstats()' function has been deprecated and will": {
            "content": "be removed in a future Python version.  (Contributed by Victor Stinner\nin bpo-28799(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28799\n\nFile: python3.12.info,  Node: wave,  Prev: sys<7>,  Up: Deprecated Python modules functions and methods\n\n1.6.11.15 wave\n..............\n\n'wave.openfp()' has been deprecated and will be removed in Python 3.9.\nUse *note wave.open(): 76b. instead.  (Contributed by Brian Curtin in\nbpo-31985(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31985\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "Function *note PySliceGetIndicesEx(): 33c. is deprecated and replaced\nwith a macro if 'PyLIMITEDAPI' is not set or set to a value in the\nrange between '0x03050400' and '0x03060000' (not inclusive), or is\n'0x03060100' or higher.  (Contributed by Serhiy Storchaka in\nbpo-27867(1).)\n\n*note PyOSAfterFork(): 33a. has been deprecated.  Use *note\nPyOSBeforeFork(): a03, *note PyOSAfterForkParent(): a04. or *note",
            "subsections": []
        },
        "PyOSAfterForkChild(): 33b. instead.  (Contributed by Antoine Pitrou in": {
            "content": "bpo-16500(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27867\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=16500\n\nFile: python3.12.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\n\n\n* FreeBSD 9 and older are no longer officially supported.\n\n* For full Unicode support, including within extension modules, *nix\nplatforms are now expected to provide at least one of 'C.UTF-8'\n(full locale), 'C.utf8' (full locale) or 'UTF-8' ('LCCTYPE'-only\nlocale) as an alternative to the legacy 'ASCII'-based 'C' locale.\n\n* OpenSSL 0.9.8 and 1.0.1 are no longer supported, which means\nbuilding CPython 3.7 with SSL/TLS support on older platforms still\nusing these versions requires custom build options that link to a\nmore recent version of OpenSSL.\n\nNotably, this issue affects the Debian 8 (aka \"jessie\") and Ubuntu\n14.04 (aka \"Trusty\") LTS Linux distributions, as they still use\nOpenSSL 1.0.1 by default.\n\nDebian 9 (\"stretch\") and Ubuntu 16.04 (\"xenial\"), as well as recent\nreleases of other LTS Linux releases (e.g.  RHEL/CentOS 7.5, SLES\n12-SP3), use OpenSSL 1.0.2 or later, and remain supported in the\ndefault build configuration.\n\nCPython's own CI configuration file(1) provides an example of using\nthe SSL compatibility testing infrastructure(2) in CPython's test\nsuite to build and link against OpenSSL 1.1.0 rather than an\noutdated system provided OpenSSL.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/blob/v3.7.13/.travis.yml\n\n(2)\nhttps://github.com/python/cpython/tree/3.12/Tools/ssl/multissltests.py\n\nFile: python3.12.info,  Node: API and Feature Removals<2>,  Next: Module Removals,  Prev: Platform Support Removals,  Up: What's New In Python 3 7\n\n\nThe following features and APIs have been removed from Python 3.7:\n\n* The 'os.statfloattimes()' function has been removed.  It was\nintroduced in Python 2.3 for backward compatibility with Python\n2.2, and was deprecated since Python 3.1.\n\n* Unknown escapes consisting of ''\\'' and an ASCII letter in\nreplacement templates for *note re.sub(): 1ff. were deprecated in\nPython 3.5, and will now cause an error.\n\n* Removed support of the 'exclude' argument in *note\ntarfile.TarFile.add(): a39.  It was deprecated in Python 2.7 and\n3.2.  Use the 'filter' argument instead.\n\n* The 'ntpath.splitunc()' function was deprecated in Python 3.1, and\nhas now been removed.  Use *note splitdrive(): a3a. instead.\n\n* *note collections.namedtuple(): 711. no longer supports the\n'verbose' parameter or 'source' attribute which showed the\ngenerated source code for the named tuple class.  This was part of\nan optimization designed to speed-up class creation.  (Contributed\nby Jelle Zijlstra with further improvements by INADA Naoki, Serhiy\nStorchaka, and Raymond Hettinger in bpo-28638(1).)\n\n* Functions *note bool(): 17d, *note float(): 4b7, *note list(): 3dc.\nand *note tuple(): 4b8. no longer take keyword arguments.  The\nfirst argument of *note int(): 17e. can now be passed only as\npositional argument.\n\n* Removed previously deprecated in Python 2.4 classes 'Plist', 'Dict'\nand 'InternalDict' in the *note plistlib: a6. module.  Dict values\nin the result of functions 'readPlist()' and 'readPlistFromBytes()'\nare now normal dicts.  You no longer can use attribute access to\naccess items of these dictionaries.\n\n* The 'asyncio.windowsutils.socketpair()' function has been removed.\nUse the *note socket.socketpair(): a3b. function instead, it is\navailable on all platforms since Python 3.5.\n'asyncio.windowsutils.socketpair' was just an alias to\n'socket.socketpair' on Python 3.5 and newer.\n\n* *note asyncio: 9. no longer exports the *note selectors: bd. and\n'overlapped' modules as 'asyncio.selectors' and\n'asyncio.overlapped'.  Replace 'from asyncio import selectors'\nwith 'import selectors'.\n\n* Direct instantiation of *note ssl.SSLSocket: 703. and *note\nssl.SSLObject: 9c2. objects is now prohibited.  The constructors\nwere never documented, tested, or designed as public constructors.\nUsers were supposed to use 'ssl.wrapsocket()' or *note\nssl.SSLContext: 278.  (Contributed by Christian Heimes in\nbpo-32951(2).)\n\n* The unused 'distutils' 'installmisc' command has been removed.\n(Contributed by Eric N. Vander Weele in bpo-29218(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28638\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32951\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=29218\n\nFile: python3.12.info,  Node: Module Removals,  Next: Windows-only Changes,  Prev: API and Feature Removals<2>,  Up: What's New In Python 3 7\n\n",
            "subsections": []
        },
        "The 'fpectl' module has been removed.  It was never enabled by default,": {
            "content": "never worked correctly on x86-64, and it changed the Python ABI in ways\nthat caused unexpected breakage of C extensions.  (Contributed by",
            "subsections": []
        },
        "Nathaniel J. Smith in bpo-29137(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=29137\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Windows-only Changes,  Next: Porting to Python 3 7,  Prev: Module Removals,  Up: What's New In Python 3 7": {
            "content": "The python launcher, (py.exe), can accept 32 & 64 bit specifiers\n'without' having to specify a minor version as well.  So 'py -3-32' and\n'py -3-64' become valid as well as 'py -3.7-32', also the -'m'-64 and\n-'m.n'-64 forms are now accepted to force 64 bit python even if 32 bit\nwould have otherwise been used.  If the specified version is not\navailable py.exe will error exit.  (Contributed by Steve Barnes in\nbpo-30291(1).)\n",
            "subsections": []
        },
        "The launcher can be run as 'py -0' to produce a list of the installed": {
            "content": "pythons, 'with default marked with an asterisk'.  Running 'py -0p' will\ninclude the paths.  If py is run with a version specifier that cannot be\nmatched it will also print the 'short form' list of available\nspecifiers.  (Contributed by Steve Barnes in bpo-30362(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30291\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=30362\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "The 'STOREANNOTATION' opcode has been removed.  (Contributed by Mark": {
            "content": "",
            "subsections": []
        },
        "Shannon in bpo-32550(2).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26110\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32550\n\nFile: python3.12.info,  Node: Windows-only Changes<2>,  Next: Other CPython implementation changes,  Prev: CPython bytecode changes<6>,  Up: Porting to Python 3 7\n\n1.6.17.5 Windows-only Changes\n.............................\n\nThe file used to override *note sys.path: 32c. is now called\n'<python-executable>.pth' instead of ''sys.path''.  See *note Finding\nmodules: a67. for more information.  (Contributed by Steve Dower in\nbpo-28137(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28137\n\nFile: python3.12.info,  Node: Other CPython implementation changes,  Prev: Windows-only Changes<2>,  Up: Porting to Python 3 7\n\n1.6.17.6 Other CPython implementation changes\n.............................................\n",
            "subsections": []
        },
        "In preparation for potential future changes to the public CPython": {
            "content": "runtime initialization API (see PEP 432(1) for an initial, but somewhat\noutdated, draft), CPython's internal startup and configuration\nmanagement logic has been significantly refactored.  While these updates\nare intended to be entirely transparent to both embedding applications\nand users of the regular CPython CLI, they're being mentioned here as\nthe refactoring changes the internal order of various operations during\ninterpreter startup, and hence may uncover previously latent defects,\neither in embedding applications, or in CPython itself.  (Initially\ncontributed by Nick Coghlan and Eric Snow as part of bpo-22257(2), and\nfurther updated by Nick, Eric, and Victor Stinner in a number of other\nissues).  Some known details affected:\n\n* *note PySysAddWarnOptionUnicode(): a69. is not currently usable by\nembedding applications due to the requirement to create a Unicode\nobject prior to calling 'PyInitialize'.  Use *note\nPySysAddWarnOption(): a6a. instead.\n\n* warnings filters added by an embedding application with *note\nPySysAddWarnOption(): a6a. should now more consistently take\nprecedence over the default filters set by the interpreter\n",
            "subsections": []
        },
        "Due to changes in the way the default warnings filters are configured,": {
            "content": "setting *note PyBytesWarningFlag: 2fe. to a value greater than one is\nno longer sufficient to both emit *note BytesWarning: a6b. messages and\nhave them converted to exceptions.  Instead, the flag must be set (to\ncause the warnings to be emitted in the first place), and an explicit\n'error::BytesWarning' warnings filter added to convert them to\nexceptions.\n",
            "subsections": []
        },
        "Due to a change in the way docstrings are handled by the compiler, the": {
            "content": "implicit 'return None' in a function body consisting solely of a\ndocstring is now marked as occurring on the same line as the docstring,\nnot on the function's header line.\n",
            "subsections": []
        },
        "The current exception state has been moved from the frame object to the": {
            "content": "co-routine.  This simplified the interpreter and fixed a couple of\nobscure bugs caused by having swap exception state when entering or\nexiting a generator.  (Contributed by Mark Shannon in bpo-25612(3).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0432/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=22257\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=25612\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "Starting in 3.7.1, *note PyInitialize(): 6c2. now consistently reads\nand respects all of the same environment settings as *note PyMain():\na6d. (in earlier Python versions, it respected an ill-defined subset of\nthose environment variables, while in Python 3.7.0 it didn't read any of\nthem due to bpo-34247(1)).  If this behavior is unwanted, set *note\nPyIgnoreEnvironmentFlag: 302. to 1 before calling *note\nPyInitialize(): 6c2.\n\nIn 3.7.1 the C API for Context Variables *note was updated: a6e. to use\n*note PyObject: 6b1. pointers.  See also bpo-34762(2).\n\nIn 3.7.1 the *note tokenize: f6. module now implicitly emits a 'NEWLINE'\ntoken when provided with input that does not have a trailing new line.\nThis behavior now matches what the C tokenizer does internally.\n(Contributed by Ammar Askar in bpo-33899(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=34247\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=34762\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=33899\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "In 3.7.2, *note venv: 10c. on Windows no longer copies the original\nbinaries, but creates redirector scripts named 'python.exe' and\n'pythonw.exe' instead.  This resolves a long standing issue where all\nvirtual environments would have to be upgraded or recreated with each",
            "subsections": []
        },
        "Python update.  However, note that this release will still require": {
            "content": "recreation of virtual environments in order to get the new scripts.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "Earlier Python versions allowed using both ';' and '&' as query\nparameter separators in *note urllib.parse.parseqs(): 651. and *note\nurllib.parse.parseqsl(): 652.  Due to security concerns, and to conform\nwith newer W3C recommendations, this has been changed to allow only a\nsingle separator key, with '&' as the default.  This change also affects\n*note cgi.parse(): 653. and *note cgi.parsemultipart(): 654. as they\nuse the affected functions internally.  For more details, please see\ntheir respective documentation.  (Contributed by Adam Goldschmidt,",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "A security fix alters the *note ftplib.FTP: 715. behavior to not trust\nthe IPv4 address sent from the remote server when setting up a passive\ndata channel.  We reuse the ftp server IP address instead.  For unusual\ncode requiring the old behavior, set a 'trustserverpasvipv4address'\nattribute on your FTP instance to 'True'.  (See gh-87451(1))\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "Converting between *note int: 17e. and *note str: 157. in bases other\nthan 2 (binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10\n(decimal) now raises a *note ValueError: 183. if the number of digits in\nstring form is above a limit to avoid potential denial of service\nattacks due to the algorithmic complexity.  This is a mitigation for\nCVE-2020-10735(1).  This limit can be configured or disabled by\nenvironment variable, command line flag, or *note sys: d3. APIs.  See\nthe *note integer string conversion length limitation: 3bc.\ndocumentation.  The default limit is 4300 digits in string form.\n\n---------- Footnotes ----------\n\n(1) https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-10735\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": [
                {
                    "name": "1.7 What's New In Python 3.6",
                    "content": "Editors: Elvis Pranskevichus <<elvis@magic.io>>, Yury Selivanov\n<<yury@magic.io>>\n\nThis article explains the new features in Python 3.6, compared to 3.5.\nPython 3.6 was released on December 23, 2016.  ??See the changelog(1) for\na full list of changes.\n\nSee also\n........\n\nPEP 494(2) - Python 3.6 Release Schedule\n\n* Menu:\n\n* Summary - Release highlights: Summary - Release highlights<6>.\n* New Features: New Features<11>.\n* Other Language Changes: Other Language Changes<7>.\n* New Modules: New Modules<7>.\n* Improved Modules: Improved Modules<7>.\n* Optimizations: Optimizations<7>.\n* Build and C API Changes: Build and C API Changes<2>.\n* Other Improvements::\n* Deprecated: Deprecated<9>.\n* Removed: Removed<9>.\n* Porting to Python 3.6: Porting to Python 3 6.\n* Notable changes in Python 3.6.2: Notable changes in Python 3 6 2.\n* Notable changes in Python 3.6.4: Notable changes in Python 3 6 4.\n* Notable changes in Python 3.6.5: Notable changes in Python 3 6 5.\n* Notable changes in Python 3.6.7: Notable changes in Python 3 6 7.\n* Notable changes in Python 3.6.10: Notable changes in Python 3 6 10.\n* Notable changes in Python 3.6.13: Notable changes in Python 3 6 13.\n* Notable changes in Python 3.6.14: Notable changes in Python 3 6 14.\n\n---------- Footnotes ----------\n\n(1) https://docs.python.org/3.6/whatsnew/changelog.html\n\n(2) https://peps.python.org/pep-0494/\n\nFile: python3.12.info,  Node: Summary - Release highlights<6>,  Next: New Features<11>,  Up: What's New In Python 3 6\n\n\nNew syntax features:\n\n* *note PEP 498: a77, formatted string literals.\n\n* *note PEP 515: a78, underscores in numeric literals.\n\n* *note PEP 526: a79, syntax for variable annotations.\n\n* *note PEP 525: a7a, asynchronous generators.\n\n* *note PEP 530: a7b.: asynchronous comprehensions.\n\nNew library modules:\n\n* *note secrets: bb.: *note PEP 506 - Adding A Secrets Module To The\nStandard Library: a7c.\n\nCPython implementation improvements:\n\n* The *note dict: 8fc. type has been reimplemented to use a *note\nmore compact representation: a7d. based on a proposal by Raymond\nHettinger(1) and similar to the PyPy dict implementation(2).  This\nresulted in dictionaries using 20% to 25% less memory when compared\nto Python 3.5.\n\n* Customization of class creation has been simplified with the *note\nnew protocol: a7e.\n\n* The class attribute definition order is *note now preserved: a7f.\n\n* The order of elements in 'kwargs' now *note corresponds to the\norder: a80. in which keyword arguments were passed to the function.\n\n* DTrace and SystemTap *note probing support: a81. has been added.\n\n* The new *note PYTHONMALLOC: a82. environment variable can now be\nused to debug the interpreter memory allocation and access errors.\n\nSignificant improvements in the standard library:\n\n* The *note asyncio: 9. module has received new features, significant\nusability and performance improvements, and a fair amount of bug\nfixes.  Starting with Python 3.6 the 'asyncio' module is no longer\nprovisional and its API is considered stable.\n\n* A new *note file system path protocol: a83. has been implemented to\nsupport *note path-like objects: 957.  All standard library\nfunctions operating on paths have been updated to work with the new\nprotocol.\n\n* The *note datetime: 2e. module has gained support for *note Local\nTime Disambiguation: a84.\n\n* The *note typing: ff. module received a number of *note\nimprovements: a85.\n\n* The *note tracemalloc: fa. module has been significantly reworked\nand is now used to provide better output for *note ResourceWarning:\na86. as well as provide better diagnostics for memory allocation\nerrors.  See the *note PYTHONMALLOC section: a82. for more\ninformation.\n\nSecurity improvements:\n\n* The new *note secrets: bb. module has been added to simplify the\ngeneration of cryptographically strong pseudo-random numbers\nsuitable for managing secrets such as account authentication,\ntokens, and similar.\n\n* On Linux, *note os.urandom(): 276. now blocks until the system\nurandom entropy pool is initialized to increase the security.  See\nthe PEP 524(3) for the rationale.\n\n* The *note hashlib: 63. and *note ssl: ca. modules now support\nOpenSSL 1.1.0.\n\n* The default settings and feature set of the *note ssl: ca. module\nhave been improved.\n\n* The *note hashlib: 63. module received support for the BLAKE2,\nSHA-3 and SHAKE hash algorithms and the *note scrypt(): a87. key\nderivation function.\n\nWindows improvements:\n\n* *note PEP 528: a88. and *note PEP 529: a89, Windows filesystem and\nconsole encoding changed to UTF-8.\n\n* The 'py.exe' launcher, when used interactively, no longer prefers\nPython 2 over Python 3 when the user doesn't specify a version (via\ncommand line arguments or a config file).  Handling of shebang\nlines remains unchanged - \"python\" refers to Python 2 in that case.\n\n* 'python.exe' and 'pythonw.exe' have been marked as long-path aware,\nwhich means that the 260 character path limit may no longer apply.\nSee *note removing the MAXPATH limitation: a8a. for details.\n\n* A '.pth' file can be added to force isolated mode and fully\nspecify all search paths to avoid registry and environment lookup.\nSee *note the documentation: a67. for more information.\n\n* A 'python36.zip' file now works as a landmark to infer *note\nPYTHONHOME: 334.  See *note the documentation: a67. for more\ninformation.\n\n---------- Footnotes ----------\n\n(1)\nhttps://mail.python.org/pipermail/python-dev/2012-December/123028.html\n\n(2)\nhttps://morepypy.blogspot.com/2015/01/faster-more-memory-efficient-and-more.html\n\n(3) https://peps.python.org/pep-0524/\n\nFile: python3.12.info,  Node: New Features<11>,  Next: Other Language Changes<7>,  Prev: Summary - Release highlights<6>,  Up: What's New In Python 3 6\n\n\n* Menu:\n\n* PEP 498; Formatted string literals: PEP 498 Formatted string literals.\n* PEP 526; Syntax for variable annotations: PEP 526 Syntax for variable annotations.\n* PEP 515; Underscores in Numeric Literals: PEP 515 Underscores in Numeric Literals.\n* PEP 525; Asynchronous Generators: PEP 525 Asynchronous Generators.\n* PEP 530; Asynchronous Comprehensions: PEP 530 Asynchronous Comprehensions.\n* PEP 487; Simpler customization of class creation: PEP 487 Simpler customization of class creation.\n* PEP 487; Descriptor Protocol Enhancements: PEP 487 Descriptor Protocol Enhancements.\n* PEP 519; Adding a file system path protocol: PEP 519 Adding a file system path protocol.\n* PEP 495; Local Time Disambiguation: PEP 495 Local Time Disambiguation.\n* PEP 529; Change Windows filesystem encoding to UTF-8: PEP 529 Change Windows filesystem encoding to UTF-8.\n* PEP 528; Change Windows console encoding to UTF-8: PEP 528 Change Windows console encoding to UTF-8.\n* PEP 520; Preserving Class Attribute Definition Order: PEP 520 Preserving Class Attribute Definition Order.\n* PEP 468; Preserving Keyword Argument Order: PEP 468 Preserving Keyword Argument Order.\n* New dict implementation::\n* PEP 523; Adding a frame evaluation API to CPython: PEP 523 Adding a frame evaluation API to CPython.\n* PYTHONMALLOC environment variable::\n* DTrace and SystemTap probing support::\n\nFile: python3.12.info,  Node: PEP 498 Formatted string literals,  Next: PEP 526 Syntax for variable annotations,  Up: New Features<11>\n\n1.7.2.1 PEP 498: Formatted string literals\n..........................................\n\nPEP 498(1) introduces a new kind of string literals: 'f-strings', or\n*note formatted string literals: 7cd.\n"
                }
            ]
        },
        "Formatted string literals are prefixed with ''f'' and are similar to the": {
            "content": "format strings accepted by *note str.format(): 3ed.  They contain\nreplacement fields surrounded by curly braces.  The replacement fields\nare expressions, which are evaluated at run time, and then formatted\nusing the *note format(): 3eb. protocol:\n\n>>> name = \"Fred\"\n>>> f\"He said his name is {name}.\"\n'He said his name is Fred.'\n>>> width = 10\n>>> precision = 4\n>>> value = decimal.Decimal(\"12.34567\")\n>>> f\"result: {value:{width}.{precision}}\"  # nested fields\n'result:      12.35'\n\nSee also\n........\n\nPEP 498(2) - Literal String Interpolation.\n\nPEP written and implemented by Eric V. Smith.\n\n*note Feature documentation: 7cd.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0498/\n\n(2) https://peps.python.org/pep-0498/\n\nFile: python3.12.info,  Node: PEP 526 Syntax for variable annotations,  Next: PEP 515 Underscores in Numeric Literals,  Prev: PEP 498 Formatted string literals,  Up: New Features<11>\n\n1.7.2.2 PEP 526: Syntax for variable annotations\n................................................\n\nPEP 484(1) introduced the standard for type annotations of function\nparameters, a.k.a.  type hints.  This PEP adds syntax to Python for\nannotating the types of variables including class variables and instance\nvariables:\n\nprimes: List[int] = []\n\ncaptain: str  # Note: no initial value!\n\nclass Starship:\nstats: Dict[str, int] = {}\n",
            "subsections": []
        },
        "Just as for function annotations, the Python interpreter does not attach": {
            "content": "any particular meaning to variable annotations and only stores them in\nthe 'annotations' attribute of a class or module.\n",
            "subsections": []
        },
        "In contrast to variable declarations in statically typed languages, the": {
            "content": "goal of annotation syntax is to provide an easy way to specify\nstructured type metadata for third party tools and libraries via the\nabstract syntax tree and the 'annotations' attribute.\n\nSee also\n........\n\nPEP 526(2) - Syntax for variable annotations.\n\nPEP written by Ryan Gonzalez, Philip House, Ivan Levkivskyi, Lisa\nRoach, and Guido van Rossum.  Implemented by Ivan Levkivskyi.\n",
            "subsections": []
        },
        "Tools that use or will use the new syntax: mypy(3), pytype(4), PyCharm,": {
            "content": "etc.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0484/\n\n(2) https://peps.python.org/pep-0526/\n\n(3) https://www.mypy-lang.org/\n\n(4) https://github.com/google/pytype\n\nFile: python3.12.info,  Node: PEP 515 Underscores in Numeric Literals,  Next: PEP 525 Asynchronous Generators,  Prev: PEP 526 Syntax for variable annotations,  Up: New Features<11>\n\n1.7.2.3 PEP 515: Underscores in Numeric Literals\n................................................\n\nPEP 515(1) adds the ability to use underscores in numeric literals for\nimproved readability.  For example:\n\n>>> 1000000000000000\n1000000000000000\n>>> 0xFFFFFFFF\n4294967295\n",
            "subsections": []
        },
        "Single underscores are allowed between digits and after any base": {
            "content": "specifier.  Leading, trailing, or multiple underscores in a row are not\nallowed.\n\nThe *note string formatting: 3a7. language also now has support for the\n'''' option to signal the use of an underscore for a thousands\nseparator for floating point presentation types and for integer\npresentation type ''d''.  For integer presentation types ''b'', ''o'',\n''x'', and ''X'', underscores will be inserted every 4 digits:\n\n>>> '{:}'.format(1000000)\n'1000000'\n>>> '{:x}'.format(0xFFFFFFFF)\n'ffffffff'\n\nSee also\n........\n\nPEP 515(2) - Underscores in Numeric Literals\n\nPEP written by Georg Brandl and Serhiy Storchaka.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0515/\n\n(2) https://peps.python.org/pep-0515/\n\nFile: python3.12.info,  Node: PEP 525 Asynchronous Generators,  Next: PEP 530 Asynchronous Comprehensions,  Prev: PEP 515 Underscores in Numeric Literals,  Up: New Features<11>\n\n1.7.2.4 PEP 525: Asynchronous Generators\n........................................\n\nPEP 492(1) introduced support for native coroutines and 'async' /\n'await' syntax to Python 3.5.  A notable limitation of the Python 3.5\nimplementation is that it was not possible to use 'await' and 'yield' in\nthe same function body.  In Python 3.6 this restriction has been lifted,\nmaking it possible to define 'asynchronous generators':\n\nasync def ticker(delay, to):\n\"\"\"Yield numbers from 0 to *to* every *delay* seconds.\"\"\"\nfor i in range(to):\nyield i\nawait asyncio.sleep(delay)\n\nThe new syntax allows for faster and more concise code.\n\nSee also\n........\n\nPEP 525(2) - Asynchronous Generators\n\nPEP written and implemented by Yury Selivanov.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0492/\n\n(2) https://peps.python.org/pep-0525/\n\nFile: python3.12.info,  Node: PEP 530 Asynchronous Comprehensions,  Next: PEP 487 Simpler customization of class creation,  Prev: PEP 525 Asynchronous Generators,  Up: New Features<11>\n\n1.7.2.5 PEP 530: Asynchronous Comprehensions\n............................................\n\nPEP 530(1) adds support for using 'async for' in list, set, dict\ncomprehensions and generator expressions:\n\nresult = [i async for i in aiter() if i % 2]\n",
            "subsections": []
        },
        "Additionally, 'await' expressions are supported in all kinds of": {
            "content": "comprehensions:\n\nresult = [await fun() for fun in funcs if await condition()]\n\nSee also\n........\n\nPEP 530(2) - Asynchronous Comprehensions\n\nPEP written and implemented by Yury Selivanov.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0530/\n\n(2) https://peps.python.org/pep-0530/\n\nFile: python3.12.info,  Node: PEP 487 Simpler customization of class creation,  Next: PEP 487 Descriptor Protocol Enhancements,  Prev: PEP 530 Asynchronous Comprehensions,  Up: New Features<11>\n\n1.7.2.6 PEP 487: Simpler customization of class creation\n........................................................\n",
            "subsections": []
        },
        "It is now possible to customize subclass creation without using a": {
            "content": "metaclass.  The new 'initsubclass' classmethod will be called on\nthe base class whenever a new subclass is created:\n\nclass PluginBase:\nsubclasses = []\n\ndef initsubclass(cls, kwargs):\nsuper().initsubclass(kwargs)\ncls.subclasses.append(cls)\n\nclass Plugin1(PluginBase):\npass\n\nclass Plugin2(PluginBase):\npass\n\nIn order to allow zero-argument *note super(): 204. calls to work\ncorrectly from *note initsubclass(): 3fe. implementations, custom\nmetaclasses must ensure that the new 'classcell' namespace entry is\npropagated to 'type.new' (as described in *note Creating the class\nobject: a93.).\n\nSee also\n........\n\nPEP 487(1) - Simpler customization of class creation\n\nPEP written and implemented by Martin Teichmann.\n\n*note Feature documentation: a94.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0487/\n\nFile: python3.12.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<11>\n\n1.7.2.7 PEP 487: Descriptor Protocol Enhancements\n.................................................\n\nPEP 487(1) extends the descriptor protocol to include the new optional\n*note setname(): a97. method.  Whenever a new class is defined, the\nnew method will be called on all descriptors included in the definition,\nproviding them with a reference to the class being defined and the name\ngiven to the descriptor within the class namespace.  In other words,\ninstances of descriptors can now know the attribute name of the\ndescriptor in the owner class:\n\nclass IntField:\ndef get(self, instance, owner):\nreturn instance.dict[self.name]\n\ndef set(self, instance, value):\nif not isinstance(value, int):\nraise ValueError(f'expecting integer in {self.name}')\ninstance.dict[self.name] = value\n\n# this is the new initializer:\ndef setname(self, owner, name):\nself.name = name\n\nclass Model:\nintfield = IntField()\n\nSee also\n........\n\nPEP 487(2) - Simpler customization of class creation\n\nPEP written and implemented by Martin Teichmann.\n\n*note Feature documentation: a98.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0487/\n\n(2) https://peps.python.org/pep-0487/\n\nFile: python3.12.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<11>\n\n1.7.2.8 PEP 519: Adding a file system path protocol\n...................................................\n\nFile system paths have historically been represented as *note str: 157.\nor *note bytes: 295. objects.  This has led to people who write code\nwhich operate on file system paths to assume that such objects are only\none of those two types (an *note int: 17e. representing a file\ndescriptor does not count as that is not a file path).  Unfortunately\nthat assumption prevents alternative object representations of file\nsystem paths like *note pathlib: 9f. from working with pre-existing\ncode, including Python's standard library.\n\nTo fix this situation, a new interface represented by *note os.PathLike:\na9a. has been defined.  By implementing the *note fspath(): a9b.\nmethod, an object signals that it represents a path.  An object can then\nprovide a low-level representation of a file system path as a *note str:\n157. or *note bytes: 295. object.  This means an object is considered\n*note path-like: 957. if it implements *note os.PathLike: a9a. or is a\n*note str: 157. or *note bytes: 295. object which represents a file\nsystem path.  Code can use *note os.fspath(): a9c, *note os.fsdecode():\na9d, or *note os.fsencode(): a9e. to explicitly get a *note str: 157.\nand/or *note bytes: 295. representation of a path-like object.\n\nThe built-in *note open(): 26e. function has been updated to accept\n*note os.PathLike: a9a. objects, as have all relevant functions in the\n*note os: 9c. and *note os.path: 9d. modules, and most other functions\nand classes in the standard library.  The *note os.DirEntry: 1ba. class\nand relevant classes in *note pathlib: 9f. have also been updated to\nimplement *note os.PathLike: a9a.\n",
            "subsections": []
        },
        "The hope is that updating the fundamental functions for operating on": {
            "content": "file system paths will lead to third-party code to implicitly support\nall *note path-like objects: 957. without any code changes, or at least\nvery minimal ones (e.g.  calling *note os.fspath(): a9c. at the\nbeginning of code before operating on a path-like object).\n\nHere are some examples of how the new interface allows for *note\npathlib.Path: 149. to be used more easily and transparently with\npre-existing code:\n\n>>> import pathlib\n>>> with open(pathlib.Path(\"README\")) as f:\n...     contents = f.read()\n...\n>>> import os.path\n>>> os.path.splitext(pathlib.Path(\"somefile.txt\"))\n('somefile', '.txt')\n>>> os.path.join(\"/a/b\", pathlib.Path(\"c\"))\n'/a/b/c'\n>>> import os\n>>> os.fspath(pathlib.Path(\"somefile.txt\"))\n'somefile.txt'\n\n(Implemented by Brett Cannon, Ethan Furman, Dusty Phillips, and Jelle",
            "subsections": []
        },
        "Zijlstra.)": {
            "content": "See also\n........\n\nPEP 519(1) - Adding a file system path protocol\n\nPEP written by Brett Cannon and Koos Zevenhoven.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0519/\n\nFile: python3.12.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<11>\n\n1.7.2.9 PEP 495: Local Time Disambiguation\n..........................................\n",
            "subsections": []
        },
        "In most world locations, there have been and will be times when local": {
            "content": "clocks are moved back.  In those times, intervals are introduced in\nwhich local clocks show the same time twice in the same day.  In these\nsituations, the information displayed on a local clock (or stored in a",
            "subsections": []
        },
        "Python datetime instance) is insufficient to identify a particular": {
            "content": "moment in time.\n\nPEP 495(1) adds the new 'fold' attribute to instances of *note\ndatetime.datetime: 222. and *note datetime.time: 6a5. classes to\ndifferentiate between two moments in time for which local times are the\nsame:\n\n>>> u0 = datetime(2016, 11, 6, 4, tzinfo=timezone.utc)\n>>> for i in range(4):\n...     u = u0 + i*HOUR\n...     t = u.astimezone(Eastern)\n...     print(u.time(), 'UTC =', t.time(), t.tzname(), t.fold)\n...\n04:00:00 UTC = 00:00:00 EDT 0\n05:00:00 UTC = 01:00:00 EDT 0\n06:00:00 UTC = 01:00:00 EST 1\n07:00:00 UTC = 02:00:00 EST 0\n\nThe values of the *note fold: aa0. attribute have the value '0' for all\ninstances except those that represent the second (chronologically)\nmoment in time in an ambiguous case.\n\nSee also\n........\n\nPEP 495(2) - Local Time Disambiguation\n\nPEP written by Alexander Belopolsky and Tim Peters, implementation\nby Alexander Belopolsky.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0495/\n\n(2) https://peps.python.org/pep-0495/\n\nFile: python3.12.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<11>\n\n1.7.2.10 PEP 529: Change Windows filesystem encoding to UTF-8\n.............................................................\n",
            "subsections": []
        },
        "Representing filesystem paths is best performed with str (Unicode)": {
            "content": "rather than bytes.  However, there are some situations where using bytes\nis sufficient and correct.\n",
            "subsections": []
        },
        "Prior to Python 3.6, data loss could result when using bytes paths on": {
            "content": "",
            "subsections": []
        },
        "Windows.  With this change, using bytes to represent paths is now": {
            "content": "supported on Windows, provided those bytes are encoded with the encoding\nreturned by *note sys.getfilesystemencoding(): aa2, which now defaults\nto ''utf-8''.\n\nApplications that do not use str to represent paths should use *note\nos.fsencode(): a9e. and *note os.fsdecode(): a9d. to ensure their bytes\nare correctly encoded.  To revert to the previous behaviour, set *note\nPYTHONLEGACYWINDOWSFSENCODING: aa3. or call *note\nsys.enablelegacywindowsfsencoding(): aa4.\n",
            "subsections": []
        },
        "See PEP 529(1) for more information and discussion of code modifications": {
            "content": "that may be required.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0529/\n\nFile: python3.12.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<11>\n\n1.7.2.11 PEP 528: Change Windows console encoding to UTF-8\n..........................................................\n",
            "subsections": []
        },
        "The default console on Windows will now accept all Unicode characters": {
            "content": "and provide correctly read str objects to Python code.  'sys.stdin',\n'sys.stdout' and 'sys.stderr' now default to utf-8 encoding.\n",
            "subsections": []
        },
        "This change only applies when using an interactive console, and not when": {
            "content": "redirecting files or pipes.  To revert to the previous behaviour for\ninteractive console use, set *note PYTHONLEGACYWINDOWSSTDIO: aa6.\n\nSee also\n........\n\nPEP 528(1) - Change Windows console encoding to UTF-8\n\nPEP written and implemented by Steve Dower.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0528/\n\nFile: python3.12.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<11>\n\n1.7.2.12 PEP 520: Preserving Class Attribute Definition Order\n.............................................................\n",
            "subsections": []
        },
        "Attributes in a class definition body have a natural ordering: the same": {
            "content": "order in which the names appear in the source.  This order is now\npreserved in the new class's *note dict: aa8. attribute.\n",
            "subsections": []
        },
        "Also, the effective default class 'execution' namespace (returned from": {
            "content": "*note type.prepare(): aa9.) is now an insertion-order-preserving\nmapping.\n\nSee also\n........\n\nPEP 520(1) - Preserving Class Attribute Definition Order\n\nPEP written and implemented by Eric Snow.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0520/\n\nFile: python3.12.info,  Node: PEP 468 Preserving Keyword Argument Order,  Next: New dict implementation,  Prev: PEP 520 Preserving Class Attribute Definition Order,  Up: New Features<11>\n\n1.7.2.13 PEP 468: Preserving Keyword Argument Order\n...................................................\n\n'kwargs' in a function signature is now guaranteed to be an\ninsertion-order-preserving mapping.\n\nSee also\n........\n\nPEP 468(1) - Preserving Keyword Argument Order\n\nPEP written and implemented by Eric Snow.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0468/\n\nFile: python3.12.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<11>\n\n1.7.2.14 New dict implementation\n................................\n\nThe *note dict: 8fc. type now uses a \"compact\" representation based on a\nproposal by Raymond Hettinger(1) which was first implemented by PyPy(2).\nThe memory usage of the new *note dict(): 237. is between 20% and 25%\nsmaller compared to Python 3.5.\n",
            "subsections": []
        },
        "The order-preserving aspect of this new implementation is considered an": {
            "content": "implementation detail and should not be relied upon (this may change in\nthe future, but it is desired to have this new dict implementation in\nthe language for a few releases before changing the language spec to\nmandate order-preserving semantics for all current and future Python\nimplementations; this also helps preserve backwards-compatibility with\nolder versions of the language where random iteration order is still in\neffect, e.g.  Python 3.5).\n\n(Contributed by INADA Naoki in bpo-27350(3).  Idea originally suggested\nby Raymond Hettinger(4).)\n\n---------- Footnotes ----------\n\n(1)\nhttps://mail.python.org/pipermail/python-dev/2012-December/123028.html\n\n(2)\nhttps://morepypy.blogspot.com/2015/01/faster-more-memory-efficient-and-more.html\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=27350\n\n(4)\nhttps://mail.python.org/pipermail/python-dev/2012-December/123028.html\n\nFile: python3.12.info,  Node: PEP 523 Adding a frame evaluation API to CPython,  Next: PYTHONMALLOC environment variable,  Prev: New dict implementation,  Up: New Features<11>\n\n1.7.2.15 PEP 523: Adding a frame evaluation API to CPython\n..........................................................\n",
            "subsections": []
        },
        "While Python provides extensive support to customize how code executes,": {
            "content": "one place it has not done so is in the evaluation of frame objects.  If\nyou wanted some way to intercept frame evaluation in Python there really\nwasn't any way without directly manipulating function pointers for\ndefined functions.\n\nPEP 523(1) changes this by providing an API to make frame evaluation\npluggable at the C level.  This will allow for tools such as debuggers\nand JITs to intercept frame evaluation before the execution of Python\ncode begins.  This enables the use of alternative evaluation\nimplementations for Python code, tracking frame evaluation, etc.\n",
            "subsections": []
        },
        "This API is not part of the limited C API and is marked as private to": {
            "content": "signal that usage of this API is expected to be limited and only\napplicable to very select, low-level use-cases.  Semantics of the API\nwill change with Python as necessary.\n\nSee also\n........\n\nPEP 523(2) - Adding a frame evaluation API to CPython\n\nPEP written by Brett Cannon and Dino Viehland.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0523/\n\n(2) https://peps.python.org/pep-0523/\n\nFile: python3.12.info,  Node: PYTHONMALLOC environment variable,  Next: DTrace and SystemTap probing support,  Prev: PEP 523 Adding a frame evaluation API to CPython,  Up: New Features<11>\n\n1.7.2.16 PYTHONMALLOC environment variable\n..........................................\n\nThe new *note PYTHONMALLOC: aaf. environment variable allows setting the\nPython memory allocators and installing debug hooks.\n",
            "subsections": []
        },
        "It is now possible to install debug hooks on Python memory allocators on": {
            "content": "Python compiled in release mode using 'PYTHONMALLOC=debug'.  Effects of\ndebug hooks:\n\n* Newly allocated memory is filled with the byte '0xCB'\n\n* Freed memory is filled with the byte '0xDB'\n\n* Detect violations of the Python memory allocator API. For example,\n*note PyObjectFree(): ab0. called on a memory block allocated by\n*note PyMemMalloc(): ab1.\n\n* Detect writes before the start of a buffer (buffer underflows)\n\n* Detect writes after the end of a buffer (buffer overflows)\n\n* Check that the *note GIL: 141. is held when allocator functions of\n*note PYMEMDOMAINOBJ: ab2. (ex: *note PyObjectMalloc(): ab3.)\nand *note PYMEMDOMAINMEM: ab4. (ex: *note PyMemMalloc(): ab1.)\ndomains are called.\n\nChecking if the GIL is held is also a new feature of Python 3.6.\n\nSee the *note PyMemSetupDebugHooks(): ab5. function for debug hooks on\nPython memory allocators.\n",
            "subsections": []
        },
        "It is now also possible to force the usage of the 'malloc()' allocator": {
            "content": "of the C library for all Python memory allocations using\n'PYTHONMALLOC=malloc'.  This is helpful when using external memory\ndebuggers like Valgrind on a Python compiled in release mode.\n\nOn error, the debug hooks on Python memory allocators now use the *note\ntracemalloc: fa. module to get the traceback where a memory block was\nallocated.\n",
            "subsections": []
        },
        "Example of fatal error on buffer overflow using 'python3.6 -X": {
            "content": "tracemalloc=5' (store 5 frames in traces):\n\nDebug memory block at address p=0x7fbcd41666f8: API 'o'\n4 bytes originally requested\nThe 7 pad bytes at p-7 are FORBIDDENBYTE, as expected.\nThe 8 pad bytes at tail=0x7fbcd41666fc are not all FORBIDDENBYTE (0xfb):\nat tail+0: 0x02 * OUCH\nat tail+1: 0xfb\nat tail+2: 0xfb\nat tail+3: 0xfb\nat tail+4: 0xfb\nat tail+5: 0xfb\nat tail+6: 0xfb\nat tail+7: 0xfb\nThe block was made by call #1233329 to debug malloc/realloc.\nData at p: 1a 2b 30 00\n\nMemory block allocated at (most recent call first):\nFile \"test/testbytes.py\", line 323\nFile \"unittest/case.py\", line 600\nFile \"unittest/case.py\", line 648\nFile \"unittest/suite.py\", line 122\nFile \"unittest/suite.py\", line 84\n\nFatal Python error: bad trailing pad byte\n\nCurrent thread 0x00007fbcdbd32700 (most recent call first):\nFile \"test/testbytes.py\", line 323 in testhex\nFile \"unittest/case.py\", line 600 in run\nFile \"unittest/case.py\", line 648 in call\nFile \"unittest/suite.py\", line 122 in run\nFile \"unittest/suite.py\", line 84 in call\nFile \"unittest/suite.py\", line 122 in run\nFile \"unittest/suite.py\", line 84 in call\n...\n\n(Contributed by Victor Stinner in bpo-26516(1) and bpo-26564(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26516\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=26564\n\nFile: python3.12.info,  Node: DTrace and SystemTap probing support,  Prev: PYTHONMALLOC environment variable,  Up: New Features<11>\n\n1.7.2.17 DTrace and SystemTap probing support\n.............................................\n",
            "subsections": []
        },
        "Python can now be built '--with-dtrace' which enables static markers for": {
            "content": "the following events in the interpreter:\n\n* function call/return\n\n* garbage collection started/finished\n\n* line of code executed.\n",
            "subsections": []
        },
        "This can be used to instrument running interpreters in production,": {
            "content": "without the need to recompile specific *note debug builds: 67f. or\nproviding application-specific profiling/debugging code.\n\nMore details in *note Instrumenting CPython with DTrace and SystemTap:\nab7.\n",
            "subsections": []
        },
        "The current implementation is tested on Linux and macOS. Additional": {
            "content": "markers may be added in the future.\n\n(Contributed by ??ukasz Langa in bpo-21590(1), based on patches by Jes??s\nCea Avi??n, David Malcolm, and Nikhil Benesch.)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=21590\n\nFile: python3.12.info,  Node: Other Language Changes<7>,  Next: New Modules<7>,  Prev: New Features<11>,  Up: What's New In Python 3 6\n\n\nSome smaller changes made to the core Python language are:\n\n* A 'global' or 'nonlocal' statement must now textually appear before\nthe first use of the affected name in the same scope.  Previously\nthis was a *note SyntaxWarning: 178.\n\n* It is now possible to set a *note special method: ab9. to 'None' to\nindicate that the corresponding operation is not available.  For\nexample, if a class sets 'iter()' to 'None', the class is not\niterable.  (Contributed by Andrew Barnert and Ivan Levkivskyi in\nbpo-25958(1).)\n\n* Long sequences of repeated traceback lines are now abbreviated as\n'\"[Previous line repeated {count} more times]\"' (see *note\ntraceback: aba. for an example).  (Contributed by Emanuel Barry in\nbpo-26823(2).)\n\n* Import now raises the new exception *note ModuleNotFoundError: 981.\n(subclass of *note ImportError: 145.) when it cannot find a module.\nCode that currently checks for ImportError (in try-except) will\nstill work.  (Contributed by Eric Snow in bpo-15767(3).)\n\n* Class methods relying on zero-argument 'super()' will now work\ncorrectly when called from metaclass methods during class creation.\n(Contributed by Martin Teichmann in bpo-23722(4).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25958\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=26823\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=15767\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=23722\n\nFile: python3.12.info,  Node: New Modules<7>,  Next: Improved Modules<7>,  Prev: Other Language Changes<7>,  Up: What's New In Python 3 6\n\n\n* Menu:\n\n* secrets::\n\nFile: python3.12.info,  Node: secrets,  Up: New Modules<7>\n\n1.7.4.1 secrets\n...............\n\nThe main purpose of the new *note secrets: bb. module is to provide an\nobvious way to reliably generate cryptographically strong pseudo-random\nvalues suitable for managing secrets, such as account authentication,\ntokens, and similar.\n\nWarning: Note that the pseudo-random generators in the *note\nrandom: b3. module should 'NOT' be used for security purposes.  Use\n*note secrets: bb. on Python 3.6+ and *note os.urandom(): 276. on\nPython 3.5 and earlier.\n\nSee also\n........\n\nPEP 506(1) - Adding A Secrets Module To The Standard Library\n\nPEP written and implemented by Steven D'Aprano.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0506/\n\nFile: python3.12.info,  Node: Improved Modules<7>,  Next: Optimizations<7>,  Prev: New Modules<7>,  Up: What's New In Python 3 6\n\n\n* Menu:\n\n* array: array<3>.\n* ast: ast<3>.\n* asyncio: asyncio<8>.\n* binascii: binascii<2>.\n* cmath::\n* collections: collections<4>.\n* concurrent.futures: concurrent futures<3>.\n* contextlib: contextlib<4>.\n* datetime: datetime<5>.\n* decimal: decimal<2>.\n* distutils: distutils<5>.\n* email::\n* encodings: encodings<2>.\n* enum: enum<6>.\n* faulthandler: faulthandler<2>.\n* fileinput: fileinput<2>.\n* hashlib: hashlib<5>.\n* http.client: http client<2>.\n* idlelib and IDLE: idlelib and IDLE<2>.\n* importlib: importlib<5>.\n* inspect: inspect<6>.\n* json::\n* logging: logging<4>.\n* math: math<6>.\n* multiprocessing: multiprocessing<4>.\n* os: os<7>.\n* pathlib: pathlib<7>.\n* pdb: pdb<4>.\n* pickle: pickle<2>.\n* pickletools::\n* pydoc: pydoc<3>.\n* random: random<3>.\n* re: re<3>.\n* readline::\n* rlcompleter::\n* shlex: shlex<2>.\n* site: site<2>.\n* sqlite3: sqlite3<6>.\n* socket: socket<7>.\n* socketserver: socketserver<2>.\n* ssl: ssl<6>.\n* statistics: statistics<4>.\n* struct::\n* subprocess: subprocess<2>.\n* sys: sys<8>.\n* telnetlib::\n* time: time<5>.\n* timeit::\n* tkinter: tkinter<5>.\n* traceback: traceback<3>.\n* tracemalloc: tracemalloc<3>.\n* typing: typing<7>.\n* unicodedata: unicodedata<6>.\n* unittest.mock: unittest mock<2>.\n* urllib.request: urllib request.\n* urllib.robotparser: urllib robotparser.\n* venv: venv<4>.\n* warnings: warnings<3>.\n* winreg::\n* winsound::\n* xmlrpc.client: xmlrpc client.\n* zipfile: zipfile<3>.\n* zlib::\n\nFile: python3.12.info,  Node: array<3>,  Next: ast<3>,  Up: Improved Modules<7>\n\n1.7.5.1 array\n.............\n\nExhausted iterators of *note array.array: 18f. will now stay exhausted\neven if the iterated array is extended.  This is consistent with the\nbehavior of other mutable sequences.\n\nContributed by Serhiy Storchaka in bpo-26492(1).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26492\n\nFile: python3.12.info,  Node: ast<3>,  Next: asyncio<8>,  Prev: array<3>,  Up: Improved Modules<7>\n\n1.7.5.2 ast\n...........\n\nThe new *note ast.Constant: 215. AST node has been added.  It can be\nused by external AST optimizers for the purposes of constant folding.\n\nContributed by Victor Stinner in bpo-26146(1).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26146\n\nFile: python3.12.info,  Node: asyncio<8>,  Next: binascii<2>,  Prev: ast<3>,  Up: Improved Modules<7>\n\n1.7.5.3 asyncio\n...............\n",
            "subsections": []
        },
        "Starting with Python 3.6 the 'asyncio' module is no longer provisional": {
            "content": "and its API is considered stable.\n\nNotable changes in the *note asyncio: 9. module since Python 3.5.0 (all\nbackported to 3.5.x due to the provisional status):\n\n* The *note geteventloop(): 21e. function has been changed to\nalways return the currently running loop when called from\ncoroutines and callbacks.  (Contributed by Yury Selivanov in\nbpo-28613(1).)\n\n* The *note ensurefuture(): ac1. function and all functions that use\nit, such as *note loop.rununtilcomplete(): ac2, now accept all\nkinds of *note awaitable objects: ac3.  (Contributed by Yury\nSelivanov.)\n\n* New *note runcoroutinethreadsafe(): 68e. function to submit\ncoroutines to event loops from other threads.  (Contributed by\nVincent Michel.)\n\n* New *note Transport.isclosing(): ac4. method to check if the\ntransport is closing or closed.  (Contributed by Yury Selivanov.)\n\n* The *note loop.createserver(): 94a. method can now accept a list\nof hosts.  (Contributed by Yann Sionneau.)\n\n* New *note loop.createfuture(): ac5. method to create Future\nobjects.  This allows alternative event loop implementations, such\nas uvloop(2), to provide a faster *note asyncio.Future: a11.\nimplementation.  (Contributed by Yury Selivanov in bpo-27041(3).)\n\n* New *note loop.getexceptionhandler(): ac6. method to get the\ncurrent exception handler.  (Contributed by Yury Selivanov in\nbpo-27040(4).)\n\n* New *note StreamReader.readuntil(): ac7. method to read data from\nthe stream until a separator bytes sequence appears.  (Contributed\nby Mark Korenberg.)\n\n* The performance of *note StreamReader.readexactly(): ac8. has been\nimproved.  (Contributed by Mark Korenberg in bpo-28370(5).)\n\n* The *note loop.getaddrinfo(): a5a. method is optimized to avoid\ncalling the system 'getaddrinfo' function if the address is already\nresolved.  (Contributed by A. Jesse Jiryu Davis.)\n\n* The *note loop.stop(): ac9. method has been changed to stop the\nloop immediately after the current iteration.  Any new callbacks\nscheduled as a result of the last iteration will be discarded.\n(Contributed by Guido van Rossum in bpo-25593(6).)\n\n* 'Future.setexception' will now raise *note TypeError: 28e. when\npassed an instance of the *note StopIteration: a40. exception.\n(Contributed by Chris Angelico in bpo-26221(7).)\n\n* New *note loop.connectacceptedsocket(): 952. method to be used by\nservers that accept connections outside of asyncio, but that use\nasyncio to handle them.  (Contributed by Jim Fulton in\nbpo-27392(8).)\n\n* 'TCPNODELAY' flag is now set for all TCP transports by default.\n(Contributed by Yury Selivanov in bpo-27456(9).)\n\n* New *note loop.shutdownasyncgens(): aca. to properly close pending\nasynchronous generators before closing the loop.  (Contributed by\nYury Selivanov in bpo-28003(10).)\n\n* *note Future: a11. and *note Task: 201. classes now have an\noptimized C implementation which makes asyncio code up to 30%\nfaster.  (Contributed by Yury Selivanov and INADA Naoki in\nbpo-26081(11) and bpo-28544(12).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28613\n\n(2) https://github.com/MagicStack/uvloop\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=27041\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=27040\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=28370\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=25593\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=26221\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=27392\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=27456\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=28003\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=26081\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=28544\n\nFile: python3.12.info,  Node: binascii<2>,  Next: cmath,  Prev: asyncio<8>,  Up: Improved Modules<7>\n\n1.7.5.4 binascii\n................\n\nThe *note b2abase64(): acc. function now accepts an optional 'newline'\nkeyword argument to control whether the newline character is appended to\nthe return value.  (Contributed by Victor Stinner in bpo-25357(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25357\n\nFile: python3.12.info,  Node: cmath,  Next: collections<4>,  Prev: binascii<2>,  Up: Improved Modules<7>\n\n1.7.5.5 cmath\n.............\n\nThe new *note cmath.tau: ace. ('??') constant has been added.\n(Contributed by Lisa Roach in bpo-12345(1), see PEP 628(2) for details.)\n\nNew constants: *note cmath.inf: acf. and *note cmath.nan: ad0. to match\n*note math.inf: ad1. and *note math.nan: 42d, and also *note cmath.infj:\nad2. and *note cmath.nanj: ad3. to match the format used by complex\nrepr.  (Contributed by Mark Dickinson in bpo-23229(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=12345\n\n(2) https://peps.python.org/pep-0628/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=23229\n\nFile: python3.12.info,  Node: collections<4>,  Next: concurrent futures<3>,  Prev: cmath,  Up: Improved Modules<7>\n\n1.7.5.6 collections\n...................\n\nThe new *note Collection: ad5. abstract base class has been added to\nrepresent sized iterable container classes.  (Contributed by Ivan",
            "subsections": []
        },
        "Levkivskyi, docs by Neil Girdhar in bpo-27598(1).)": {
            "content": "The new *note Reversible: ad6. abstract base class represents iterable\nclasses that also provide the 'reversed()' method.  (Contributed by",
            "subsections": []
        },
        "Ivan Levkivskyi in bpo-25987(2).)": {
            "content": "The new *note AsyncGenerator: ad7. abstract base class represents\nasynchronous generators.  (Contributed by Yury Selivanov in\nbpo-28720(3).)\n\nThe *note namedtuple(): 711. function now accepts an optional keyword\nargument 'module', which, when specified, is used for the 'module'\nattribute of the returned named tuple class.  (Contributed by Raymond",
            "subsections": []
        },
        "Hettinger in bpo-17941(4).)": {
            "content": "The 'verbose' and 'rename' arguments for *note namedtuple(): 711. are\nnow keyword-only.  (Contributed by Raymond Hettinger in bpo-25628(5).)\n\nRecursive *note collections.deque: 3a0. instances can now be pickled.\n(Contributed by Serhiy Storchaka in bpo-26482(6).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27598\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=25987\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=28720\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=17941\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=25628\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=26482\n\nFile: python3.12.info,  Node: concurrent futures<3>,  Next: contextlib<4>,  Prev: collections<4>,  Up: Improved Modules<7>\n\n1.7.5.7 concurrent.futures\n..........................\n\nThe *note ThreadPoolExecutor: 529. class constructor now accepts an\noptional 'threadnameprefix' argument to make it possible to customize\nthe names of the threads created by the pool.  (Contributed by Gregory\nP.  Smith in bpo-27664(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27664\n\nFile: python3.12.info,  Node: contextlib<4>,  Next: datetime<5>,  Prev: concurrent futures<3>,  Up: Improved Modules<7>\n\n1.7.5.8 contextlib\n..................\n\nThe *note contextlib.AbstractContextManager: ada. class has been added\nto provide an abstract base class for context managers.  It provides a\nsensible default implementation for 'enter()' which returns 'self'\nand leaves 'exit()' an abstract method.  A matching class has been\nadded to the *note typing: ff. module as *note typing.ContextManager:\nadb.  (Contributed by Brett Cannon in bpo-25609(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25609\n\nFile: python3.12.info,  Node: datetime<5>,  Next: decimal<2>,  Prev: contextlib<4>,  Up: Improved Modules<7>\n\n1.7.5.9 datetime\n................\n\nThe *note datetime: 222. and *note time: 6a5. classes have the new\n'fold' attribute used to disambiguate local time when necessary.  Many\nfunctions in the *note datetime: 2e. have been updated to support local\ntime disambiguation.  See *note Local Time Disambiguation: a84. section\nfor more information.  (Contributed by Alexander Belopolsky in\nbpo-24773(1).)\n\nThe *note datetime.strftime(): add. and *note date.strftime(): ade.\nmethods now support ISO 8601 date directives '%G', '%u' and '%V'.\n(Contributed by Ashley Anderson in bpo-12006(2).)\n\nThe *note datetime.isoformat(): 96a. function now accepts an optional\n'timespec' argument that specifies the number of additional components\nof the time value to include.  (Contributed by Alessandro Cucci and",
            "subsections": []
        },
        "Alexander Belopolsky in bpo-19475(3).)": {
            "content": "The *note datetime.combine(): adf. now accepts an optional 'tzinfo'\nargument.  (Contributed by Alexander Belopolsky in bpo-27661(4).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24773\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=12006\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=19475\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=27661\n\nFile: python3.12.info,  Node: decimal<2>,  Next: distutils<5>,  Prev: datetime<5>,  Up: Improved Modules<7>\n\n1.7.5.10 decimal\n................\n\nNew *note Decimal.asintegerratio(): ae1. method that returns a pair\n'(n, d)' of integers that represent the given *note Decimal: 5c3.\ninstance as a fraction, in lowest terms and with a positive denominator:\n\n>>> Decimal('-3.14').asintegerratio()\n(-157, 50)\n\n(Contributed by Stefan Krah amd Mark Dickinson in bpo-25928(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25928\n\nFile: python3.12.info,  Node: distutils<5>,  Next: email,  Prev: decimal<2>,  Up: Improved Modules<7>\n\n1.7.5.11 distutils\n..................\n",
            "subsections": []
        },
        "The 'defaultformat' attribute has been removed from": {
            "content": "'distutils.command.sdist.sdist' and the 'formats' attribute defaults to\n'['gztar']'.  Although not anticipated, any code relying on the presence\nof 'defaultformat' may need to be adapted.  See bpo-27819(1) for more\ndetails.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27819\n\nFile: python3.12.info,  Node: email,  Next: encodings<2>,  Prev: distutils<5>,  Up: Improved Modules<7>\n\n1.7.5.12 email\n..............\n",
            "subsections": []
        },
        "The new email API, enabled via the 'policy' keyword to various": {
            "content": "constructors, is no longer provisional.  The *note email: 37.\ndocumentation has been reorganized and rewritten to focus on the new\nAPI, while retaining the old documentation for the legacy API.\n(Contributed by R. David Murray in bpo-24277(1).)\n\nThe *note email.mime: 41. classes now all accept an optional 'policy'\nkeyword.  (Contributed by Berker Peksag in bpo-27331(2).)\n\nThe *note DecodedGenerator: ae4. now supports the 'policy' keyword.\n\nThere is a new *note policy: 4b. attribute, *note messagefactory: ae5,\nthat controls what class is used by default when the parser creates new\nmessage objects.  For the *note email.policy.compat32: ae6. policy this\nis *note Message: ae7, for the new policies it is *note EmailMessage:\nae8.  (Contributed by R. David Murray in bpo-20476(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24277\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=27331\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=20476\n\nFile: python3.12.info,  Node: encodings<2>,  Next: enum<6>,  Prev: email,  Up: Improved Modules<7>\n\n1.7.5.13 encodings\n..................\n",
            "subsections": []
        },
        "On Windows, added the ''oem'' encoding to use 'CPOEMCP', and the": {
            "content": "''ansi'' alias for the existing ''mbcs'' encoding, which uses the\n'CPACP' code page.  (Contributed by Steve Dower in bpo-27959(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27959\n\nFile: python3.12.info,  Node: enum<6>,  Next: faulthandler<2>,  Prev: encodings<2>,  Up: Improved Modules<7>\n\n1.7.5.14 enum\n.............\n\nTwo new enumeration base classes have been added to the *note enum: 51.\nmodule: *note Flag: 3ef. and 'IntFlags'.  Both are used to define\nconstants that can be combined using the bitwise operators.\n(Contributed by Ethan Furman in bpo-23591(1).)\n",
            "subsections": []
        },
        "Many standard library modules have been updated to use the 'IntFlags'": {
            "content": "class for their constants.\n\nThe new *note enum.auto: aeb. value can be used to assign values to enum\nmembers automatically:\n\n>>> from enum import Enum, auto\n>>> class Color(Enum):\n...     red = auto()\n...     blue = auto()\n...     green = auto()\n...\n>>> list(Color)\n[<Color.red: 1>, <Color.blue: 2>, <Color.green: 3>]\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23591\n\nFile: python3.12.info,  Node: faulthandler<2>,  Next: fileinput<2>,  Prev: enum<6>,  Up: Improved Modules<7>\n\n1.7.5.15 faulthandler\n.....................\n\nOn Windows, the *note faulthandler: 53. module now installs a handler\nfor Windows exceptions: see *note faulthandler.enable(): aed.\n(Contributed by Victor Stinner in bpo-23848(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23848\n\nFile: python3.12.info,  Node: fileinput<2>,  Next: hashlib<5>,  Prev: faulthandler<2>,  Up: Improved Modules<7>\n\n1.7.5.16 fileinput\n..................\n\n*note hookencoded(): aef. now supports the 'errors' argument.\n(Contributed by Joseph Hackman in bpo-25788(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25788\n\nFile: python3.12.info,  Node: hashlib<5>,  Next: http client<2>,  Prev: fileinput<2>,  Up: Improved Modules<7>\n\n1.7.5.17 hashlib\n................\n\n*note hashlib: 63. supports OpenSSL 1.1.0.  The minimum recommend\nversion is 1.0.2.  (Contributed by Christian Heimes in bpo-26470(1).)\n\nBLAKE2 hash functions were added to the module.  *note blake2b(): 40b.\nand *note blake2s(): 40c. are always available and support the full\nfeature set of BLAKE2.  (Contributed by Christian Heimes in bpo-26798(2)\nbased on code by Dmitry Chestnykh and Samuel Neves.  Documentation\nwritten by Dmitry Chestnykh.)\n\nThe SHA-3 hash functions *note sha3224(): af1, *note sha3256(): af2,\n*note sha3384(): af3, *note sha3512(): af4, and SHAKE hash functions\n*note shake128(): af5. and *note shake256(): af6. were added.\n(Contributed by Christian Heimes in bpo-16113(3).  Keccak Code Package\nby Guido Bertoni, Joan Daemen, Michae\"l Peeters, Gilles Van Assche, and",
            "subsections": []
        },
        "Ronny Van Keer.)": {
            "content": "The password-based key derivation function *note scrypt(): a87. is now\navailable with OpenSSL 1.1.0 and newer.  (Contributed by Christian",
            "subsections": []
        },
        "Heimes in bpo-27928(4).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26470\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=26798\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=16113\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=27928\n\nFile: python3.12.info,  Node: http client<2>,  Next: idlelib and IDLE<2>,  Prev: hashlib<5>,  Up: Improved Modules<7>\n\n1.7.5.18 http.client\n....................\n\n*note HTTPConnection.request(): af8. and *note endheaders(): af9. both\nnow support chunked encoding request bodies.  (Contributed by Demian",
            "subsections": []
        },
        "Brecht and Rolf Krahl in bpo-12319(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=12319\n\nFile: python3.12.info,  Node: idlelib and IDLE<2>,  Next: importlib<5>,  Prev: http client<2>,  Up: Improved Modules<7>\n\n1.7.5.19 idlelib and IDLE\n.........................\n",
            "subsections": []
        },
        "The idlelib package is being modernized and refactored to make IDLE look": {
            "content": "and work better and to make the code easier to understand, test, and\nimprove.  Part of making IDLE look better, especially on Linux and Mac,\nis using ttk widgets, mostly in the dialogs.  As a result, IDLE no\nlonger runs with tcl/tk 8.4.  It now requires tcl/tk 8.5 or 8.6.  We\nrecommend running the latest release of either.\n\n'Modernizing' includes renaming and consolidation of idlelib modules.",
            "subsections": []
        },
        "The renaming of files with partial uppercase names is similar to the": {
            "content": "renaming of, for instance, Tkinter and TkFont to tkinter and\ntkinter.font in 3.0.  As a result, imports of idlelib files that worked\nin 3.5 will usually not work in 3.6.  At least a module name change will\nbe needed (see idlelib/README.txt), sometimes more.  (Name changes\ncontributed by Al Swiegart and Terry Reedy in bpo-24225(1).  Most\nidlelib patches since have been and will be part of the process.)\n",
            "subsections": []
        },
        "In compensation, the eventual result with be that some idlelib classes": {
            "content": "will be easier to use, with better APIs and docstrings explaining them.\nAdditional useful information will be added to idlelib when available.\n\nNew in 3.6.2:\n",
            "subsections": []
        },
        "Jan Reedy in bpo-1612262(3).)": {
            "content": "",
            "subsections": []
        },
        "Wohlganger and Terry Jan Reedy in bpo-27099(4).)": {
            "content": "",
            "subsections": []
        },
        "Code that current checks for 'ImportError' (in try-except) will still": {
            "content": "work.  (Contributed by Eric Snow in bpo-15767(1).)\n\n*note importlib.util.LazyLoader: afc. now calls *note createmodule():\nafd. on the wrapped loader, removing the restriction that *note\nimportlib.machinery.BuiltinImporter: afe. and *note\nimportlib.machinery.ExtensionFileLoader: aff. couldn't be used with\n*note importlib.util.LazyLoader: afc.\n\n*note importlib.util.cachefromsource(): 264, *note\nimportlib.util.sourcefromcache(): 26c, and *note\nimportlib.util.specfromfilelocation(): b00. now accept a *note\npath-like object: 957.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=15767\n\nFile: python3.12.info,  Node: inspect<6>,  Next: json,  Prev: importlib<5>,  Up: Improved Modules<7>\n\n1.7.5.21 inspect\n................\n\nThe *note inspect.signature(): 51c. function now reports the implicit\n'.0' parameters generated by the compiler for comprehension and\ngenerator expression scopes as if they were positional-only parameters\ncalled 'implicit0'.  (Contributed by Jelle Zijlstra in bpo-19611(1).)\n",
            "subsections": []
        },
        "To reduce code churn when upgrading from Python 2.7 and the legacy": {
            "content": "'inspect.getargspec()' API, the previously documented deprecation of\n*note inspect.getfullargspec(): 51d. has been reversed.  While this\nfunction is convenient for single/source Python 2/3 code bases, the\nricher *note inspect.signature(): 51c. interface remains the recommended\napproach for new code.  (Contributed by Nick Coghlan in bpo-27172(2))\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=19611\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=27172\n\nFile: python3.12.info,  Node: json,  Next: logging<4>,  Prev: inspect<6>,  Up: Improved Modules<7>\n\n1.7.5.22 json\n.............\n\n*note json.load(): b03. and *note json.loads(): 776. now support binary\ninput.  Encoded JSON should be represented using either UTF-8, UTF-16,\nor UTF-32.  (Contributed by Serhiy Storchaka in bpo-17909(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=17909\n\nFile: python3.12.info,  Node: logging<4>,  Next: math<6>,  Prev: json,  Up: Improved Modules<7>\n\n1.7.5.23 logging\n................\n\nThe new *note WatchedFileHandler.reopenIfNeeded(): b05. method has been\nadded to add the ability to check if the log file needs to be reopened.\n(Contributed by Marian Horban in bpo-24884(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24884\n\nFile: python3.12.info,  Node: math<6>,  Next: multiprocessing<4>,  Prev: logging<4>,  Up: Improved Modules<7>\n\n1.7.5.24 math\n.............\n\nThe tau ('??') constant has been added to the *note math: 89. and *note\ncmath: 16. modules.  (Contributed by Lisa Roach in bpo-12345(1), see PEP\n628(2) for details.)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=12345\n\n(2) https://peps.python.org/pep-0628/\n\nFile: python3.12.info,  Node: multiprocessing<4>,  Next: os<7>,  Prev: math<6>,  Up: Improved Modules<7>\n\n1.7.5.25 multiprocessing\n........................\n\n*note Proxy Objects: b08. returned by *note multiprocessing.Manager():\nb09. can now be nested.  (Contributed by Davin Potts in bpo-6766(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=6766\n\nFile: python3.12.info,  Node: os<7>,  Next: pathlib<7>,  Prev: multiprocessing<4>,  Up: Improved Modules<7>\n\n1.7.5.26 os\n...........\n\nSee the summary of *note PEP 519: a83. for details on how the *note os:\n9c. and *note os.path: 9d. modules now support *note path-like objects:\n957.\n\n*note scandir(): 88c. now supports *note bytes: 295. paths on Windows.\n\nA new *note close(): b0b. method allows explicitly closing a *note\nscandir(): 88c. iterator.  The *note scandir(): 88c. iterator now\nsupports the *note context manager: 398. protocol.  If a 'scandir()'\niterator is neither exhausted nor explicitly closed a *note",
            "subsections": []
        },
        "ResourceWarning: a86. will be emitted in its destructor.  (Contributed": {
            "content": "by Serhiy Storchaka in bpo-25994(1).)\n\nOn Linux, *note os.urandom(): 276. now blocks until the system urandom\nentropy pool is initialized to increase the security.  See the PEP\n524(2) for the rationale.\n",
            "subsections": []
        },
        "The Linux 'getrandom()' syscall (get random bytes) is now exposed as the": {
            "content": "new *note os.getrandom(): b0c. function.  (Contributed by Victor",
            "subsections": []
        },
        "Stinner, part of the PEP 524(3))": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25994\n\n(2) https://peps.python.org/pep-0524/\n\n(3) https://peps.python.org/pep-0524/\n\nFile: python3.12.info,  Node: pathlib<7>,  Next: pdb<4>,  Prev: os<7>,  Up: Improved Modules<7>\n\n1.7.5.27 pathlib\n................\n\n*note pathlib: 9f. now supports *note path-like objects: 957.\n(Contributed by Brett Cannon in bpo-27186(1).)\n\nSee the summary of *note PEP 519: a83. for details.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27186\n\nFile: python3.12.info,  Node: pdb<4>,  Next: pickle<2>,  Prev: pathlib<7>,  Up: Improved Modules<7>\n\n1.7.5.28 pdb\n............\n\nThe *note Pdb: 740. class constructor has a new optional 'readrc'\nargument to control whether '.pdbrc' files should be read.\n\nFile: python3.12.info,  Node: pickle<2>,  Next: pickletools,  Prev: pdb<4>,  Up: Improved Modules<7>\n\n1.7.5.29 pickle\n...............\n",
            "subsections": []
        },
        "Objects that need 'new' called with keyword arguments can now be": {
            "content": "pickled using *note pickle protocols: b10. older than protocol version\n4.  Protocol version 4 already supports this case.  (Contributed by",
            "subsections": []
        },
        "Serhiy Storchaka in bpo-24164(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24164\n\nFile: python3.12.info,  Node: pickletools,  Next: pydoc<3>,  Prev: pickle<2>,  Up: Improved Modules<7>\n\n1.7.5.30 pickletools\n....................\n\n*note pickletools.dis(): b12. now outputs the implicit memo index for\nthe 'MEMOIZE' opcode.  (Contributed by Serhiy Storchaka in\nbpo-25382(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25382\n\nFile: python3.12.info,  Node: pydoc<3>,  Next: random<3>,  Prev: pickletools,  Up: Improved Modules<7>\n\n1.7.5.31 pydoc\n..............\n\nThe *note pydoc: b0. module has learned to respect the 'MANPAGER'\nenvironment variable.  (Contributed by Matthias Klose in bpo-8637(1).)\n\n*note help(): 6f0. and *note pydoc: b0. can now list named tuple fields\nin the order they were defined rather than alphabetically.  (Contributed\nby Raymond Hettinger in bpo-24879(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=8637\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=24879\n\nFile: python3.12.info,  Node: random<3>,  Next: re<3>,  Prev: pydoc<3>,  Up: Improved Modules<7>\n\n1.7.5.32 random\n...............\n\nThe new *note choices(): b15. function returns a list of elements of\nspecified size from the given population with optional weights.\n(Contributed by Raymond Hettinger in bpo-18844(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=18844\n\nFile: python3.12.info,  Node: re<3>,  Next: readline,  Prev: random<3>,  Up: Improved Modules<7>\n\n1.7.5.33 re\n...........\n\nAdded support of modifier spans in regular expressions.  Examples:\n''(?i:p)ython'' matches ''python'' and ''Python'', but not ''PYTHON'';\n''(?i)g(?-i:v)r'' matches ''GvR'' and ''gvr'', but not ''GVR''.\n(Contributed by Serhiy Storchaka in bpo-433028(1).)\n",
            "subsections": []
        },
        "Match object groups can be accessed by 'getitem', which is": {
            "content": "equivalent to 'group()'.  So 'mo['name']' is now equivalent to\n'mo.group('name')'.  (Contributed by Eric Smith in bpo-24454(2).)\n\n*note Match: b17. objects now support *note index-like objects: 4f1. as\ngroup indices.  (Contributed by Jeroen Demeyer and Xiang Zhang in\nbpo-27177(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=433028\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=24454\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=27177\n\nFile: python3.12.info,  Node: readline,  Next: rlcompleter,  Prev: re<3>,  Up: Improved Modules<7>\n\n1.7.5.34 readline\n.................\n\nAdded *note setautohistory(): b19. to enable or disable automatic\naddition of input to the history list.  (Contributed by Tyler Crompton\nin bpo-26870(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26870\n\nFile: python3.12.info,  Node: rlcompleter,  Next: shlex<2>,  Prev: readline,  Up: Improved Modules<7>\n\n1.7.5.35 rlcompleter\n....................\n",
            "subsections": []
        },
        "Private and special attribute names now are omitted unless the prefix": {
            "content": "starts with underscores.  A space or a colon is added after some\ncompleted keywords.  (Contributed by Serhiy Storchaka in bpo-25011(1)\nand bpo-25209(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25011\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=25209\n\nFile: python3.12.info,  Node: shlex<2>,  Next: site<2>,  Prev: rlcompleter,  Up: Improved Modules<7>\n\n1.7.5.36 shlex\n..............\n\nThe *note shlex: b1c. has much *note improved shell compatibility: b1d.\nthrough the new 'punctuationchars' argument to control which characters\nare treated as punctuation.  (Contributed by Vinay Sajip in\nbpo-1521950(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=1521950\n\nFile: python3.12.info,  Node: site<2>,  Next: sqlite3<6>,  Prev: shlex<2>,  Up: Improved Modules<7>\n\n1.7.5.37 site\n.............\n\nWhen specifying paths to add to *note sys.path: 32c. in a '.pth' file,\nyou may now specify file paths on top of directories (e.g.  zip files).\n(Contributed by Wolfgang Langner in bpo-26587(1)).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26587\n\nFile: python3.12.info,  Node: sqlite3<6>,  Next: socket<7>,  Prev: site<2>,  Up: Improved Modules<7>\n\n1.7.5.38 sqlite3\n................\n\n*note sqlite3.Cursor.lastrowid: b20. now supports the 'REPLACE'\nstatement.  (Contributed by Alex LordThorsen in bpo-16864(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=16864\n\nFile: python3.12.info,  Node: socket<7>,  Next: socketserver<2>,  Prev: sqlite3<6>,  Up: Improved Modules<7>\n\n1.7.5.39 socket\n...............\n\nThe *note ioctl(): b22. function now supports the *note\nSIOLOOPBACKFASTPATH: b23. control code.  (Contributed by Daniel",
            "subsections": []
        },
        "Stokes in bpo-26536(1).)": {
            "content": "The *note getsockopt(): b24. constants 'SODOMAIN', 'SOPROTOCOL',\n'SOPEERSEC', and 'SOPASSSEC' are now supported.  (Contributed by",
            "subsections": []
        },
        "Christian Heimes in bpo-26907(2).)": {
            "content": "The *note setsockopt(): b25. now supports the 'setsockopt(level,\noptname, None, optlen: int)' form.  (Contributed by Christian Heimes in\nbpo-27744(3).)\n\nThe socket module now supports the address family *note AFALG: b26. to\ninterface with Linux Kernel crypto API. 'ALG*', 'SOLALG' and *note\nsendmsgafalg(): b27. were added.  (Contributed by Christian Heimes in\nbpo-27744(4) with support from Victor Stinner.)\n\nNew Linux constants 'TCPUSERTIMEOUT' and 'TCPCONGESTION' were added.\n(Contributed by Omar Sandoval, bpo-26273(5)).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26536\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=26907\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=27744\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=27744\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=26273\n\nFile: python3.12.info,  Node: socketserver<2>,  Next: ssl<6>,  Prev: socket<7>,  Up: Improved Modules<7>\n\n1.7.5.40 socketserver\n.....................\n\nServers based on the *note socketserver: c7. module, including those\ndefined in *note http.server: 6d, *note xmlrpc.server: 129. and *note\nwsgiref.simpleserver: 116, now support the *note context manager: 398.\nprotocol.  (Contributed by Aviv Palivoda in bpo-26404(1).)\n\nThe 'wfile' attribute of *note StreamRequestHandler: b29. classes now\nimplements the *note io.BufferedIOBase: 460. writable interface.  In\nparticular, calling *note write(): b2a. is now guaranteed to send the\ndata in full.  (Contributed by Martin Panter in bpo-26721(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26404\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=26721\n\nFile: python3.12.info,  Node: ssl<6>,  Next: statistics<4>,  Prev: socketserver<2>,  Up: Improved Modules<7>\n\n1.7.5.41 ssl\n............\n\n*note ssl: ca. supports OpenSSL 1.1.0.  The minimum recommend version is\n1.0.2.  (Contributed by Christian Heimes in bpo-26470(1).)\n\n3DES has been removed from the default cipher suites and ChaCha20",
            "subsections": []
        },
        "Poly1305 cipher suites have been added.  (Contributed by Christian": {
            "content": "",
            "subsections": []
        },
        "Heimes in bpo-27850(2) and bpo-27766(3).)": {
            "content": "*note SSLContext: 278. has better default configuration for options and\nciphers.  (Contributed by Christian Heimes in bpo-28043(4).)\n\nSSL session can be copied from one client-side connection to another\nwith the new *note SSLSession: b2c. class.  TLS session resumption can\nspeed up the initial handshake, reduce latency and improve performance\n(Contributed by Christian Heimes in bpo-19500(5) based on a draft by",
            "subsections": []
        },
        "Alex Warhawk.)": {
            "content": "The new *note getciphers(): b2d. method can be used to get a list of\nenabled ciphers in order of cipher priority.\n\nAll constants and flags have been converted to *note IntEnum: b2e. and\n'IntFlags'.  (Contributed by Christian Heimes in bpo-28025(6).)\n\nServer and client-side specific TLS protocols for *note SSLContext: 278.\nwere added.  (Contributed by Christian Heimes in bpo-28085(7).)\n\nAdded *note ssl.SSLContext.posthandshakeauth: 85c. to enable and *note\nssl.SSLSocket.verifyclientposthandshake(): 85d. to initiate TLS 1.3\npost-handshake authentication.  (Contributed by Christian Heimes in\ngh-78851(8).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26470\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=27850\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=27766\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=28043\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=19500\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=28025\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=28085\n\n(8) https://github.com/python/cpython/issues/78851\n\nFile: python3.12.info,  Node: statistics<4>,  Next: struct,  Prev: ssl<6>,  Up: Improved Modules<7>\n\n1.7.5.42 statistics\n...................\n\nA new *note harmonicmean(): b30. function has been added.  (Contributed\nby Steven D'Aprano in bpo-27181(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27181\n\nFile: python3.12.info,  Node: struct,  Next: subprocess<2>,  Prev: statistics<4>,  Up: Improved Modules<7>\n\n1.7.5.43 struct\n...............\n\n*note struct: cf. now supports IEEE 754 half-precision floats via the\n''e'' format specifier.  (Contributed by Eli Stevens, Mark Dickinson in\nbpo-11734(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=11734\n\nFile: python3.12.info,  Node: subprocess<2>,  Next: sys<8>,  Prev: struct,  Up: Improved Modules<7>\n\n1.7.5.44 subprocess\n...................\n\n*note subprocess.Popen: 8c3. destructor now emits a *note\nResourceWarning: a86. warning if the child process is still running.",
            "subsections": []
        },
        "Use the context manager protocol ('with proc: ...') or explicitly call": {
            "content": "the *note wait(): b33. method to read the exit status of the child\nprocess.  (Contributed by Victor Stinner in bpo-26741(1).)\n\nThe *note subprocess.Popen: 8c3. constructor and all functions that pass\narguments through to it now accept 'encoding' and 'errors' arguments.",
            "subsections": []
        },
        "Specifying either of these will enable text mode for the 'stdin',": {
            "content": "'stdout' and 'stderr' streams.  (Contributed by Steve Dower in\nbpo-6135(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26741\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=6135\n\nFile: python3.12.info,  Node: sys<8>,  Next: telnetlib,  Prev: subprocess<2>,  Up: Improved Modules<7>\n\n1.7.5.45 sys\n............\n\nThe new *note getfilesystemencodeerrors(): b35. function returns the\nname of the error mode used to convert between Unicode filenames and\nbytes filenames.  (Contributed by Steve Dower in bpo-27781(1).)\n\nOn Windows the return value of the *note getwindowsversion(): b36.\nfunction now includes the 'platformversion' field which contains the\naccurate major version, minor version and build number of the current\noperating system, rather than the version that is being emulated for the\nprocess (Contributed by Steve Dower in bpo-27932(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27781\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=27932\n\nFile: python3.12.info,  Node: telnetlib,  Next: time<5>,  Prev: sys<8>,  Up: Improved Modules<7>\n\n1.7.5.46 telnetlib\n..................\n\n*note Telnet: b38. is now a context manager (contributed by Ste'phane\nWirtel in bpo-25485(1)).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25485\n\nFile: python3.12.info,  Node: time<5>,  Next: timeit,  Prev: telnetlib,  Up: Improved Modules<7>\n\n1.7.5.47 time\n.............\n\nThe *note structtime: b3a. attributes 'tmgmtoff' and 'tmzone' are now\navailable on all platforms.\n\nFile: python3.12.info,  Node: timeit,  Next: tkinter<5>,  Prev: time<5>,  Up: Improved Modules<7>\n\n1.7.5.48 timeit\n...............\n\nThe new *note Timer.autorange(): b3c. convenience method has been added\nto call *note Timer.timeit(): b3d. repeatedly so that the total run time\nis greater or equal to 200 milliseconds.  (Contributed by Steven\nD'Aprano in bpo-6422(1).)\n\n*note timeit: e9. now warns when there is substantial (4x) variance\nbetween best and worst times.  (Contributed by Serhiy Storchaka in\nbpo-23552(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=6422\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=23552\n\nFile: python3.12.info,  Node: tkinter<5>,  Next: traceback<3>,  Prev: timeit,  Up: Improved Modules<7>\n\n1.7.5.49 tkinter\n................\n",
            "subsections": []
        },
        "Added methods 'traceadd()', 'traceremove()' and 'traceinfo()' in the": {
            "content": "'tkinter.Variable' class.  They replace old methods 'tracevariable()',\n'trace()', 'tracevdelete()' and 'tracevinfo()' that use obsolete Tcl\ncommands and might not work in future versions of Tcl.  (Contributed by\nSerhiy Storchaka in bpo-22115(1)).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=22115\n\nFile: python3.12.info,  Node: traceback<3>,  Next: tracemalloc<3>,  Prev: tkinter<5>,  Up: Improved Modules<7>\n\n1.7.5.50 traceback\n..................\n",
            "subsections": []
        },
        "Both the traceback module and the interpreter's builtin exception": {
            "content": "display now abbreviate long sequences of repeated lines in tracebacks as\nshown in the following example:\n\n>>> def f(): f()\n...\n>>> f()\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nFile \"<stdin>\", line 1, in f\nFile \"<stdin>\", line 1, in f\nFile \"<stdin>\", line 1, in f\n[Previous line repeated 995 more times]\nRecursionError: maximum recursion depth exceeded\n\n(Contributed by Emanuel Barry in bpo-26823(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26823\n\nFile: python3.12.info,  Node: tracemalloc<3>,  Next: typing<7>,  Prev: traceback<3>,  Up: Improved Modules<7>\n\n1.7.5.51 tracemalloc\n....................\n\nThe *note tracemalloc: fa. module now supports tracing memory\nallocations in multiple different address spaces.\n\nThe new *note DomainFilter: b41. filter class has been added to filter\nblock traces by their address space (domain).\n\n(Contributed by Victor Stinner in bpo-26588(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26588\n\nFile: python3.12.info,  Node: typing<7>,  Next: unicodedata<6>,  Prev: tracemalloc<3>,  Up: Improved Modules<7>\n\n1.7.5.52 typing\n...............\n\nSince the *note typing: ff. module is *note provisional: 93a, all\nchanges introduced in Python 3.6 have also been backported to Python\n3.5.x.\n\nThe *note typing: ff. module has a much improved support for generic\ntype aliases.  For example 'Dict[str, Tuple[S, T]]' is now a valid type\nannotation.  (Contributed by Guido van Rossum in Github #195(1).)\n\nThe *note typing.ContextManager: adb. class has been added for\nrepresenting *note contextlib.AbstractContextManager: ada.  (Contributed\nby Brett Cannon in bpo-25609(2).)\n\nThe *note typing.Collection: b43. class has been added for representing\n*note collections.abc.Collection: ad5.  (Contributed by Ivan Levkivskyi\nin bpo-27598(3).)\n\nThe *note typing.ClassVar: 482. type construct has been added to mark\nclass variables.  As introduced in PEP 526(4), a variable annotation\nwrapped in ClassVar indicates that a given attribute is intended to be\nused as a class variable and should not be set on instances of that\nclass.  (Contributed by Ivan Levkivskyi in Github #280(5).)\n\nA new *note TYPECHECKING: b44. constant that is assumed to be 'True' by\nthe static type checkers, but is 'False' at runtime.  (Contributed by\nGuido van Rossum in Github #230(6).)\n\nA new *note NewType(): b45. helper function has been added to create\nlightweight distinct types for annotations:\n\nfrom typing import NewType\n\nUserId = NewType('UserId', int)\nsomeid = UserId(524313)\n",
            "subsections": []
        },
        "The static type checker will treat the new type as if it were a subclass": {
            "content": "of the original type.  This is useful in helping catch logical errors:\n\ndef getusername(userid: UserId) -> str:\n...\n\n# passes type checking\nusera = getusername(UserId(42351))\n\n# fails type checking; an int is not a UserId\nuserb = getusername(-1)\n",
            "subsections": []
        },
        "If a HTTP request has a file or iterable body (other than a bytes": {
            "content": "object) but no 'Content-Length' header, rather than throwing an error,\n'AbstractHTTPHandler' now falls back to use chunked transfer encoding.\n(Contributed by Demian Brecht and Rolf Krahl in bpo-12319(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=12319\n\nFile: python3.12.info,  Node: urllib robotparser,  Next: venv<4>,  Prev: urllib request,  Up: Improved Modules<7>\n\n1.7.5.56 urllib.robotparser\n...........................\n\n*note RobotFileParser: b4d. now supports the 'Crawl-delay' and\n'Request-rate' extensions.  (Contributed by Nikolay Bogoychev in\nbpo-16099(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=16099\n\nFile: python3.12.info,  Node: venv<4>,  Next: warnings<3>,  Prev: urllib robotparser,  Up: Improved Modules<7>\n\n1.7.5.57 venv\n.............\n\n*note venv: 10c. accepts a new parameter '--prompt'.  This parameter\nprovides an alternative prefix for the virtual environment.  (Proposed\nby ??ukasz Balcerzak and ported to 3.6 by Ste'phane Wirtel in\nbpo-22829(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=22829\n\nFile: python3.12.info,  Node: warnings<3>,  Next: winreg,  Prev: venv<4>,  Up: Improved Modules<7>\n\n1.7.5.58 warnings\n.................\n\nA new optional 'source' parameter has been added to the *note\nwarnings.warnexplicit(): b50. function: the destroyed object which\nemitted a *note ResourceWarning: a86.  A 'source' attribute has also\nbeen added to 'warnings.WarningMessage' (contributed by Victor Stinner\nin bpo-26568(1) and bpo-26567(2)).\n\nWhen a *note ResourceWarning: a86. warning is logged, the *note\ntracemalloc: fa. module is now used to try to retrieve the traceback\nwhere the destroyed object was allocated.\n\nExample with the script 'example.py':\n\nimport warnings\n\ndef func():\nreturn open(file)\n\nf = func()\nf = None\n\nOutput of the command 'python3.6 -Wd -X tracemalloc=5 example.py':\n\nexample.py:7: ResourceWarning: unclosed file <io.TextIOWrapper name='example.py' mode='r' encoding='UTF-8'>\nf = None\nObject allocated at (most recent call first):\nFile \"example.py\", lineno 4\nreturn open(file)\nFile \"example.py\", lineno 6\nf = func()\n\nThe \"Object allocated at\" traceback is new and is only displayed if\n*note tracemalloc: fa. is tracing Python memory allocations and if the\n*note warnings: 10d. module was already imported.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26568\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=26567\n\nFile: python3.12.info,  Node: winreg,  Next: winsound,  Prev: warnings<3>,  Up: Improved Modules<7>\n\n1.7.5.59 winreg\n...............\n\nAdded the 64-bit integer type *note REGQWORD: b52.  (Contributed by",
            "subsections": []
        },
        "Clement Rouault in bpo-23026(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23026\n\nFile: python3.12.info,  Node: winsound,  Next: xmlrpc client,  Prev: winreg,  Up: Improved Modules<7>\n\n1.7.5.60 winsound\n.................\n\nAllowed keyword arguments to be passed to *note Beep: b54, *note\nMessageBeep: b55, and *note PlaySound: b56. (bpo-27982(1)).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27982\n\nFile: python3.12.info,  Node: xmlrpc client,  Next: zipfile<3>,  Prev: winsound,  Up: Improved Modules<7>\n\n1.7.5.61 xmlrpc.client\n......................\n\nThe *note xmlrpc.client: 128. module now supports unmarshalling\nadditional data types used by the Apache XML-RPC implementation for\nnumerics and 'None'.  (Contributed by Serhiy Storchaka in bpo-26885(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26885\n\nFile: python3.12.info,  Node: zipfile<3>,  Next: zlib,  Prev: xmlrpc client,  Up: Improved Modules<7>\n\n1.7.5.62 zipfile\n................\n\nA new *note ZipInfo.fromfile(): b59. class method allows making a *note\nZipInfo: b5a. instance from a filesystem file.  A new *note\nZipInfo.isdir(): b5b. method can be used to check if the *note ZipInfo:\nb5a. instance represents a directory.  (Contributed by Thomas Kluyver in\nbpo-26039(1).)\n\nThe *note ZipFile.open(): b5c. method can now be used to write data into\na ZIP file, as well as for extracting data.  (Contributed by Thomas",
            "subsections": []
        },
        "Kluyver in bpo-26039(2).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26039\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=26039\n\nFile: python3.12.info,  Node: zlib,  Prev: zipfile<3>,  Up: Improved Modules<7>\n\n1.7.5.63 zlib\n.............\n\nThe *note compress(): b5e. and *note decompress(): b5f. functions now\naccept keyword arguments.  (Contributed by Aviv Palivoda in bpo-26243(1)\nand Xiang Zhang in bpo-16764(2) respectively.)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26243\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=16764\n\nFile: python3.12.info,  Node: Optimizations<7>,  Next: Build and C API Changes<2>,  Prev: Improved Modules<7>,  Up: What's New In Python 3 6\n\n\n* The Python interpreter now uses a 16-bit wordcode instead of\nbytecode which made a number of opcode optimizations possible.\n(Contributed by Demur Rumed with input and reviews from Serhiy\nStorchaka and Victor Stinner in bpo-26647(1) and bpo-28050(2).)\n\n* The *note asyncio.Future: a11. class now has an optimized C\nimplementation.  (Contributed by Yury Selivanov and INADA Naoki in\nbpo-26081(3).)\n\n* The *note asyncio.Task: 201. class now has an optimized C\nimplementation.  (Contributed by Yury Selivanov in bpo-28544(4).)\n\n* Various implementation improvements in the *note typing: ff. module\n(such as caching of generic types) allow up to 30 times performance\nimprovements and reduced memory footprint.\n\n* The ASCII decoder is now up to 60 times as fast for error handlers\n'surrogateescape', 'ignore' and 'replace' (Contributed by Victor\nStinner in bpo-24870(5)).\n\n* The ASCII and the Latin1 encoders are now up to 3 times as fast for\nthe error handler 'surrogateescape' (Contributed by Victor Stinner\nin bpo-25227(6)).\n\n* The UTF-8 encoder is now up to 75 times as fast for error handlers\n'ignore', 'replace', 'surrogateescape', 'surrogatepass'\n(Contributed by Victor Stinner in bpo-25267(7)).\n\n* The UTF-8 decoder is now up to 15 times as fast for error handlers\n'ignore', 'replace' and 'surrogateescape' (Contributed by Victor\nStinner in bpo-25301(8)).\n\n* 'bytes % args' is now up to 2 times faster.  (Contributed by Victor\nStinner in bpo-25349(9)).\n\n* 'bytearray % args' is now between 2.5 and 5 times faster.\n(Contributed by Victor Stinner in bpo-25399(10)).\n\n* Optimize *note bytes.fromhex(): 926. and *note bytearray.fromhex():\n927.: they are now between 2x and 3.5x faster.  (Contributed by\nVictor Stinner in bpo-25401(11)).\n\n* Optimize 'bytes.replace(b'', b'.')' and 'bytearray.replace(b'',\nb'.')': up to 80% faster.  (Contributed by Josh Snider in\nbpo-26574(12)).\n\n* Allocator functions of the *note PyMemMalloc(): ab1. domain (*note\nPYMEMDOMAINMEM: ab4.) now use the *note pymalloc memory\nallocator: b61. instead of 'malloc()' function of the C library.\nThe pymalloc allocator is optimized for objects smaller or equal to\n512 bytes with a short lifetime, and use 'malloc()' for larger\nmemory blocks.  (Contributed by Victor Stinner in bpo-26249(13)).\n\n* *note pickle.load(): b62. and *note pickle.loads(): b63. are now up\nto 10% faster when deserializing many small objects (Contributed by\nVictor Stinner in bpo-27056(14)).\n\n* Passing *note keyword arguments: b64. to a function has an overhead\nin comparison with passing *note positional arguments: b65.  Now in\nextension functions implemented with using Argument Clinic this\noverhead is significantly decreased.  (Contributed by Serhiy\nStorchaka in bpo-27574(15)).\n\n* Optimized *note glob(): 5fa. and *note iglob(): 5fb. functions in\nthe *note glob: 5f. module; they are now about 3-6 times faster.\n(Contributed by Serhiy Storchaka in bpo-25596(16)).\n\n* Optimized globbing in *note pathlib: 9f. by using *note\nos.scandir(): 88c.; it is now about 1.5-4 times faster.\n(Contributed by Serhiy Storchaka in bpo-26032(17)).\n\n* *note xml.etree.ElementTree: 120. parsing, iteration and deepcopy\nperformance has been significantly improved.  (Contributed by\nSerhiy Storchaka in bpo-25638(18), bpo-25873(19), and\nbpo-25869(20).)\n\n* Creation of *note fractions.Fraction: 1a8. instances from floats\nand decimals is now 2 to 3 times faster.  (Contributed by Serhiy\nStorchaka in bpo-25971(21).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26647\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=28050\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=26081\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=28544\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=24870\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=25227\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=25267\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=25301\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=25349\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=25399\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=25401\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=26574\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=26249\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=27056\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=27574\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=25596\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=26032\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=25638\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=25873\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=25869\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=25971\n\nFile: python3.12.info,  Node: Build and C API Changes<2>,  Next: Other Improvements,  Prev: Optimizations<7>,  Up: What's New In Python 3 6\n\n\n* Python now requires some C99 support in the toolchain to build.\nMost notably, Python now uses standard integer types and macros in\nplace of custom macros like 'PYLONGLONG'.  For more information,\nsee PEP 7(1) and bpo-17884(2).\n\n* Cross-compiling CPython with the Android NDK and the Android API\nlevel set to 21 (Android 5.0 Lollipop) or greater runs\nsuccessfully.  While Android is not yet a supported platform, the\nPython test suite runs on the Android emulator with only about 16\ntests failures.  See the Android meta-issue bpo-26865(3).\n\n* The '--enable-optimizations' configure flag has been added.\nTurning it on will activate expensive optimizations like PGO.\n(Original patch by Alecsandru Patrascu of Intel in bpo-26359(4).)\n\n* The *note GIL: 141. must now be held when allocator functions of\n*note PYMEMDOMAINOBJ: ab2. (ex: *note PyObjectMalloc(): ab3.)\nand *note PYMEMDOMAINMEM: ab4. (ex: *note PyMemMalloc(): ab1.)\ndomains are called.\n\n* New *note PyFinalizeEx(): b67. API which indicates if flushing\nbuffered data failed.  (Contributed by Martin Panter in\nbpo-5319(5).)\n\n* *note PyArgParseTupleAndKeywords(): b68. now supports *note\npositional-only parameters: 8b3.  Positional-only parameters are\ndefined by empty names.  (Contributed by Serhiy Storchaka in\nbpo-26282(6)).\n\n* 'PyTracebackPrint' method now abbreviates long sequences of\nrepeated lines as '\"[Previous line repeated {count} more times]\"'.\n(Contributed by Emanuel Barry in bpo-26823(7).)\n\n* The new *note PyErrSetImportErrorSubclass(): b69. function allows\nfor specifying a subclass of *note ImportError: 145. to raise.\n(Contributed by Eric Snow in bpo-15767(8).)\n\n* The new *note PyErrResourceWarning(): b6a. function can be used to\ngenerate a *note ResourceWarning: a86. providing the source of the\nresource allocation.  (Contributed by Victor Stinner in\nbpo-26567(9).)\n\n* The new *note PyOSFSPath(): b6b. function returns the file system\nrepresentation of a *note path-like object: 957.  (Contributed by\nBrett Cannon in bpo-27186(10).)\n\n* The *note PyUnicodeFSConverter(): b6c. and *note\nPyUnicodeFSDecoder(): 2d9. functions will now accept *note\npath-like objects: 957.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0007/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=17884\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=26865\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=26359\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=5319\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=26282\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=26823\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=15767\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=26567\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=27186\n\nFile: python3.12.info,  Node: Other Improvements,  Next: Deprecated<9>,  Prev: Build and C API Changes<2>,  Up: What's New In Python 3 6\n\n\n* When *note -version: b6e. (short form: *note -V: b6f.) is supplied\ntwice, Python prints *note sys.version: b70. for detailed\ninformation.\n\n$ ./python -VV\nPython 3.6.0b4+ (3.6:223967b49e49+, Nov 21 2016, 20:55:04)\n[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]\n\nFile: python3.12.info,  Node: Deprecated<9>,  Next: Removed<9>,  Prev: Other Improvements,  Up: What's New In Python 3 6\n\n\n* Menu:\n\n* New Keywords::\n* Deprecated Python behavior::\n* Deprecated Python modules, functions and methods: Deprecated Python modules functions and methods<2>.\n* xml: xml<5>.\n* Deprecated functions and types of the C API: Deprecated functions and types of the C API<2>.\n* Deprecated Build Options::\n\nFile: python3.12.info,  Node: New Keywords,  Next: Deprecated Python behavior,  Up: Deprecated<9>\n\n1.7.9.1 New Keywords\n....................\n\n'async' and 'await' are not recommended to be used as variable, class,\nfunction or module names.  Introduced by PEP 492(1) in Python 3.5, they\nwill become proper keywords in Python 3.7.  Starting in Python 3.6, the\nuse of 'async' or 'await' as names will generate a *note\nDeprecationWarning: 179.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0492/\n\nFile: python3.12.info,  Node: Deprecated Python behavior,  Next: Deprecated Python modules functions and methods<2>,  Prev: New Keywords,  Up: Deprecated<9>\n\n1.7.9.2 Deprecated Python behavior\n..................................\n\nRaising the *note StopIteration: a40. exception inside a generator will\nnow generate a *note DeprecationWarning: 179, and will trigger a *note\nRuntimeError: 17a. in Python 3.7.  See *note PEP 479; Change\nStopIteration handling inside generators: b74. for details.\n",
            "subsections": []
        },
        "The 'aiter()' method is now expected to return an asynchronous": {
            "content": "iterator directly instead of returning an awaitable as previously.\nDoing the former will trigger a *note DeprecationWarning: 179.  Backward\ncompatibility will be removed in Python 3.7.  (Contributed by Yury",
            "subsections": []
        },
        "Selivanov in bpo-27243(1).)": {
            "content": "A backslash-character pair that is not a valid escape sequence now\ngenerates a *note DeprecationWarning: 179.  Although this will\neventually become a *note SyntaxError: 146, that will not be for several",
            "subsections": []
        },
        "Python releases.  (Contributed by Emanuel Barry in bpo-27364(2).)": {
            "content": "",
            "subsections": []
        },
        "When performing a relative import, falling back on 'name' and": {
            "content": "'path' from the calling module when 'spec' or 'package' are\nnot defined now raises an *note ImportWarning: 243.  (Contributed by",
            "subsections": []
        },
        "Rose Ames in bpo-25791(3).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27243\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=27364\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=25791\n\nFile: python3.12.info,  Node: Deprecated Python modules functions and methods<2>,  Next: xml<5>,  Prev: Deprecated Python behavior,  Up: Deprecated<9>\n\n1.7.9.3 Deprecated Python modules, functions and methods\n........................................................\n\n* Menu:\n\n* asynchat::\n* asyncore::\n* dbm: dbm<3>.\n* distutils: distutils<6>.\n* grp::\n* importlib: importlib<6>.\n* os: os<8>.\n* re: re<4>.\n* ssl: ssl<7>.\n* tkinter: tkinter<6>.\n* venv: venv<5>.\n\nFile: python3.12.info,  Node: asynchat,  Next: asyncore,  Up: Deprecated Python modules functions and methods<2>\n\n1.7.9.4 asynchat\n................\n\nThe 'asynchat' has been deprecated in favor of *note asyncio: 9.\n(Contributed by Mariatta in bpo-25002(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25002\n\nFile: python3.12.info,  Node: asyncore,  Next: dbm<3>,  Prev: asynchat,  Up: Deprecated Python modules functions and methods<2>\n\n1.7.9.5 asyncore\n................\n\nThe 'asyncore' has been deprecated in favor of *note asyncio: 9.\n(Contributed by Mariatta in bpo-25002(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25002\n\nFile: python3.12.info,  Node: dbm<3>,  Next: distutils<6>,  Prev: asyncore,  Up: Deprecated Python modules functions and methods<2>\n\n1.7.9.6 dbm\n...........\n\nUnlike other *note dbm: 2f. implementations, the *note dbm.dumb: 30.\nmodule creates databases with the ''rw'' mode and allows modifying the\ndatabase opened with the ''r'' mode.  This behavior is now deprecated\nand will be removed in 3.8.  (Contributed by Serhiy Storchaka in\nbpo-21708(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=21708\n\nFile: python3.12.info,  Node: distutils<6>,  Next: grp,  Prev: dbm<3>,  Up: Deprecated Python modules functions and methods<2>\n\n1.7.9.7 distutils\n.................\n",
            "subsections": []
        },
        "The undocumented 'extrapath' argument to the 'distutils.Distribution'": {
            "content": "constructor is now considered deprecated and will raise a warning if\nset.  Support for this parameter will be removed in a future Python\nrelease.  See bpo-27919(1) for details.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27919\n\nFile: python3.12.info,  Node: grp,  Next: importlib<6>,  Prev: distutils<6>,  Up: Deprecated Python modules functions and methods<2>\n\n1.7.9.8 grp\n...........\n\nThe support of non-integer arguments in *note getgrgid(): b7b. has been\ndeprecated.  (Contributed by Serhiy Storchaka in bpo-26129(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26129\n\nFile: python3.12.info,  Node: importlib<6>,  Next: os<8>,  Prev: grp,  Up: Deprecated Python modules functions and methods<2>\n\n1.7.9.9 importlib\n.................\n\nThe *note importlib.machinery.SourceFileLoader.loadmodule(): b7d. and\n*note importlib.machinery.SourcelessFileLoader.loadmodule(): b7e.\nmethods are now deprecated.  They were the only remaining\nimplementations of *note importlib.abc.Loader.loadmodule(): 663. in\n*note importlib: 71. that had not been deprecated in previous versions\nof Python in favour of *note importlib.abc.Loader.execmodule(): 664.\n\nThe *note importlib.machinery.WindowsRegistryFinder: b7f. class is now\ndeprecated.  As of 3.6.0, it is still added to *note sys.metapath: b80.\nby default (on Windows), but this may change in future releases.\n\nFile: python3.12.info,  Node: os<8>,  Next: re<4>,  Prev: importlib<6>,  Up: Deprecated Python modules functions and methods<2>\n\n1.7.9.10 os\n...........\n\nUndocumented support of general *note bytes-like objects: b82. as paths\nin *note os: 9c. functions, *note compile(): 528. and similar functions\nis now deprecated.  (Contributed by Serhiy Storchaka in bpo-25791(1) and\nbpo-26754(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25791\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=26754\n\nFile: python3.12.info,  Node: re<4>,  Next: ssl<7>,  Prev: os<8>,  Up: Deprecated Python modules functions and methods<2>\n\n1.7.9.11 re\n...........\n\nSupport for inline flags '(?letters)' in the middle of the regular\nexpression has been deprecated and will be removed in a future Python\nversion.  Flags at the start of a regular expression are still allowed.\n(Contributed by Serhiy Storchaka in bpo-22493(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=22493\n\nFile: python3.12.info,  Node: ssl<7>,  Next: tkinter<6>,  Prev: re<4>,  Up: Deprecated Python modules functions and methods<2>\n\n1.7.9.12 ssl\n............\n\nOpenSSL 0.9.8, 1.0.0 and 1.0.1 are deprecated and no longer supported.\nIn the future the *note ssl: ca. module will require at least OpenSSL\n1.0.2 or 1.1.0.\n\nSSL-related arguments like 'certfile', 'keyfile' and 'checkhostname' in\n*note ftplib: 59, *note http.client: 6a, *note imaplib: 6f, *note\npoplib: a7, and *note smtplib: c4. have been deprecated in favor of\n'context'.  (Contributed by Christian Heimes in bpo-28022(1).)\n\nA couple of protocols and functions of the *note ssl: ca. module are now\ndeprecated.  Some features will no longer be available in future\nversions of OpenSSL. Other features are deprecated in favor of a\ndifferent API. (Contributed by Christian Heimes in bpo-28022(2) and\nbpo-26470(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28022\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=28022\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=26470\n\nFile: python3.12.info,  Node: tkinter<6>,  Next: venv<5>,  Prev: ssl<7>,  Up: Deprecated Python modules functions and methods<2>\n\n1.7.9.13 tkinter\n................\n\nThe *note tkinter.tix: f3. module is now deprecated.  *note tkinter: ea.\nusers should use *note tkinter.ttk: f4. instead.\n\nFile: python3.12.info,  Node: venv<5>,  Prev: tkinter<6>,  Up: Deprecated Python modules functions and methods<2>\n\n1.7.9.14 venv\n.............\n\nThe 'pyvenv' script has been deprecated in favour of 'python3 -m venv'.",
            "subsections": []
        },
        "This prevents confusion as to what Python interpreter 'pyvenv' is": {
            "content": "connected to and thus what Python interpreter will be used by the\nvirtual environment.  (Contributed by Brett Cannon in bpo-25154(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25154\n\nFile: python3.12.info,  Node: xml<5>,  Next: Deprecated functions and types of the C API<2>,  Prev: Deprecated Python modules functions and methods<2>,  Up: Deprecated<9>\n\n1.7.9.15 xml\n............\n\n* As mitigation against DTD and external entity retrieval, the *note\nxml.dom.minidom: 11d. and *note xml.sax: 124. modules no longer\nprocess external entities by default.  (Contributed by Christian\nHeimes in gh-61441(1).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/61441\n\nFile: python3.12.info,  Node: Deprecated functions and types of the C API<2>,  Next: Deprecated Build Options,  Prev: xml<5>,  Up: Deprecated<9>\n\n1.7.9.16 Deprecated functions and types of the C API\n....................................................\n",
            "subsections": []
        },
        "Undocumented functions 'PyUnicodeAsEncodedObject()',": {
            "content": "'PyUnicodeAsDecodedObject()', 'PyUnicodeAsEncodedUnicode()' and\n'PyUnicodeAsDecodedUnicode()' are deprecated now.  Use the *note\ngeneric codec based API: b8a. instead.\n\nFile: python3.12.info,  Node: Deprecated Build Options,  Prev: Deprecated functions and types of the C API<2>,  Up: Deprecated<9>\n\n1.7.9.17 Deprecated Build Options\n.................................\n",
            "subsections": []
        },
        "The '--with-system-ffi' configure flag is now on by default on non-macOS": {
            "content": "UNIX platforms.  It may be disabled by using '--without-system-ffi', but\nusing the flag is deprecated and will not be accepted in Python 3.7.\nmacOS is unaffected by this change.  Note that many OS distributors\nalready use the '--with-system-ffi' flag when building their system\nPython.\n\nFile: python3.12.info,  Node: Removed<9>,  Next: Porting to Python 3 6,  Prev: Deprecated<9>,  Up: What's New In Python 3 6\n\n\n* Menu:\n\n* API and Feature Removals: API and Feature Removals<3>.\n\nFile: python3.12.info,  Node: API and Feature Removals<3>,  Up: Removed<9>\n\n1.7.10.1 API and Feature Removals\n.................................\n\n* Unknown escapes consisting of ''\\'' and an ASCII letter in regular\nexpressions will now cause an error.  In replacement templates for\n*note re.sub(): 1ff. they are still allowed, but deprecated.  The\n*note re.LOCALE: 9ac. flag can now only be used with binary\npatterns.\n\n* 'inspect.getmoduleinfo()' was removed (was deprecated since CPython\n3.3).  *note inspect.getmodulename(): b8e. should be used for\nobtaining the module name for a given path.  (Contributed by Yury\nSelivanov in bpo-13248(1).)\n\n* 'traceback.Ignore' class and 'traceback.usage',\n'traceback.modname', 'traceback.fullmodname',\n'traceback.findlinesfromcode', 'traceback.findlines',\n'traceback.findstrings', 'traceback.findexecutablelines' methods\nwere removed from the *note traceback: f9. module.  They were\nundocumented methods deprecated since Python 3.2 and equivalent\nfunctionality is available from private methods.\n\n* The 'tkmenuBar()' and 'tkbindForTraversal()' dummy methods in\n*note tkinter: ea. widget classes were removed (corresponding Tk\ncommands were obsolete since Tk 4.0).\n\n* The *note open(): b5c. method of the *note zipfile.ZipFile: 494.\nclass no longer supports the ''U'' mode (was deprecated since\nPython 3.4).  Use *note io.TextIOWrapper: b8f. for reading\ncompressed text files in *note universal newlines: b90. mode.\n\n* The undocumented 'IN', 'CDROM', 'DLFCN', 'TYPES', 'CDIO', and\n'STROPTS' modules have been removed.  They had been available in\nthe platform specific 'Lib/plat-*/' directories, but were\nchronically out of date, inconsistently available across platforms,\nand unmaintained.  The script that created these modules is still\navailable in the source distribution at Tools/scripts/h2py.py(2).\n\n* The deprecated 'asynchat.fifo' class has been removed.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=13248\n\n(2)\nhttps://github.com/python/cpython/blob/v3.6.15/Tools/scripts/h2py.py\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "* Menu:\n\n* New make regen-all build target::\n* Removal of make touch build target::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: New make regen-all build target,  Next: Removal of make touch build target,  Up: Notable changes in Python 3 6 2": {
            "content": "1.7.12.1 New 'make regen-all' build target\n..........................................\n",
            "subsections": []
        },
        "To simplify cross-compilation, and to ensure that CPython can reliably": {
            "content": "be compiled without requiring an existing version of Python to already\nbe available, the autotools-based build system no longer attempts to\nimplicitly recompile generated files based on file modification times.\n",
            "subsections": []
        },
        "Instead, a new 'make regen-all' command has been added to force": {
            "content": "regeneration of these files when desired (e.g.  after an initial version\nof Python has already been built based on the pregenerated versions).\n",
            "subsections": []
        },
        "More selective regeneration targets are also defined - see": {
            "content": "Makefile.pre.in(1) for details.\n\n(Contributed by Victor Stinner in bpo-23404(2).)\n\nNew in version 2.7.14.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Makefile.pre.in\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=23404\n\nFile: python3.12.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\n\n1.14.15.10 Removal of 'make touch' build target\n...............................................\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Removal of make touch build target,  Prev: New make regen-all build target,  Up: Notable changes in Python 3 6 2": {
            "content": "1.7.12.2 Removal of 'make touch' build target\n.............................................\n",
            "subsections": []
        },
        "The 'make touch' build target previously used to request implicit": {
            "content": "regeneration of generated files by updating their modification times has\nbeen removed.\n\nIt has been replaced by the new 'make regen-all' target.\n\n(Contributed by Victor Stinner in bpo-23404(1).)\n\nChanged in version 2.7.14.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23404\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "The *note locale.localeconv(): a44. function now sets temporarily the\n'LCCTYPE' locale to the 'LCNUMERIC' locale in some cases.\n(Contributed by Victor Stinner in bpo-31900(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31900\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "*note xml.dom.minidom: 11d. and *note xml.sax: 124. modules no longer\nprocess external entities by default.  See also gh-61441(1).\n\nIn 3.6.7 the *note tokenize: f6. module now implicitly emits a 'NEWLINE'\ntoken when provided with input that does not have a trailing new line.\nThis behavior now matches what the C tokenizer does internally.\n(Contributed by Ammar Askar in bpo-33899(2).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/61441\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=33899\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "Earlier Python versions allowed using both ';' and '&' as query\nparameter separators in *note urllib.parse.parseqs(): 651. and *note\nurllib.parse.parseqsl(): 652.  Due to security concerns, and to conform\nwith newer W3C recommendations, this has been changed to allow only a\nsingle separator key, with '&' as the default.  This change also affects\n*note cgi.parse(): 653. and *note cgi.parsemultipart(): 654. as they\nuse the affected functions internally.  For more details, please see\ntheir respective documentation.  (Contributed by Adam Goldschmidt,",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "A security fix alters the *note ftplib.FTP: 715. behavior to not trust\nthe IPv4 address sent from the remote server when setting up a passive\ndata channel.  We reuse the ftp server IP address instead.  For unusual\ncode requiring the old behavior, set a 'trustserverpasvipv4address'\nattribute on your FTP instance to 'True'.  (See gh-87451(1))\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": [
                {
                    "name": "1.8 What's New In Python 3.5",
                    "content": "Editors: Elvis Pranskevichus <<elvis@magic.io>>, Yury Selivanov\n<<yury@magic.io>>\n\nThis article explains the new features in Python 3.5, compared to 3.4.\nPython 3.5 was released on September 13, 2015.  ??See the changelog(1)\nfor a full list of changes.\n\nSee also\n........\n\nPEP 478(2) - Python 3.5 Release Schedule\n\n* Menu:\n\n* Summary - Release highlights: Summary - Release highlights<7>.\n* New Features: New Features<12>.\n* Other Language Changes: Other Language Changes<8>.\n* New Modules: New Modules<8>.\n* Improved Modules: Improved Modules<8>.\n* Other module-level changes::\n* Optimizations: Optimizations<8>.\n* Build and C API Changes: Build and C API Changes<3>.\n* Deprecated: Deprecated<10>.\n* Removed: Removed<10>.\n* Porting to Python 3.5: Porting to Python 3 5.\n* Notable changes in Python 3.5.4: Notable changes in Python 3 5 4.\n\n---------- Footnotes ----------\n\n(1) https://docs.python.org/3.5/whatsnew/changelog.html\n\n(2) https://peps.python.org/pep-0478/\n\nFile: python3.12.info,  Node: Summary - Release highlights<7>,  Next: New Features<12>,  Up: What's New In Python 3 5\n\n\nNew syntax features:\n\n* *note PEP 492: bbd, coroutines with async and await syntax.\n\n* *note PEP 465: bbe, a new matrix multiplication operator: 'a @ b'.\n\n* *note PEP 448: bbf, additional unpacking generalizations.\n\nNew library modules:\n\n* *note typing: ff.: *note PEP 484 - Type Hints: bc0.\n\n* *note zipapp: 12a.: *note PEP 441 Improving Python ZIP Application\nSupport: bc1.\n\nNew built-in features:\n\n* 'bytes % args', 'bytearray % args': *note PEP 461: bc2. - Adding\n'%' formatting to bytes and bytearray.\n\n* New *note bytes.hex(): bc3, *note bytearray.hex(): bc4. and *note\nmemoryview.hex(): bc5. methods.  (Contributed by Arnon Yaari in\nbpo-9951(1).)\n\n* *note memoryview: 17f. now supports tuple indexing (including\nmulti-dimensional).  (Contributed by Antoine Pitrou in\nbpo-23632(2).)\n\n* Generators have a new 'giyieldfrom' attribute, which returns the\nobject being iterated by 'yield from' expressions.  (Contributed by\nBenno Leslie and Yury Selivanov in bpo-24450(3).)\n\n* A new *note RecursionError: bc6. exception is now raised when\nmaximum recursion depth is reached.  (Contributed by Georg Brandl\nin bpo-19235(4).)\n\nCPython implementation improvements:\n\n* When the 'LCTYPE' locale is the POSIX locale ('C' locale), *note\nsys.stdin: 293. and *note sys.stdout: 90c. now use the\n'surrogateescape' error handler, instead of the 'strict' error\nhandler.  (Contributed by Victor Stinner in bpo-19977(5).)\n\n* '.pyo' files are no longer used and have been replaced by a more\nflexible scheme that includes the optimization level explicitly in\n'.pyc' name.  (See *note PEP 488 overview: bc7.)\n\n* Builtin and extension modules are now initialized in a multi-phase\nprocess, which is similar to how Python modules are loaded.  (See\n*note PEP 489 overview: bc8.)\n\nSignificant improvements in the standard library:\n\n* *note collections.OrderedDict: 39f. is now *note implemented in C:\nbc9, which makes it 4 to 100 times faster.\n\n* The *note ssl: ca. module gained *note support for Memory BIO: bca,\nwhich decouples SSL protocol handling from network IO.\n\n* The new *note os.scandir(): 88c. function provides a *note better\nand significantly faster way: bcb. of directory traversal.\n\n* *note functools.lrucache(): 815. has been mostly *note\nreimplemented in C: bcc, yielding much better performance.\n\n* The new *note subprocess.run(): 9c9. function provides a *note\nstreamlined way to run subprocesses: bcd.\n\n* The *note traceback: f9. module has been significantly *note\nenhanced: bce. for improved performance and developer convenience.\n\nSecurity improvements:\n\n* SSLv3 is now disabled throughout the standard library.  It can\nstill be enabled by instantiating a *note ssl.SSLContext: 278.\nmanually.  (See bpo-22638(6) for more details; this change was\nbackported to CPython 3.4 and 2.7.)\n\n* HTTP cookie parsing is now stricter, in order to protect against\npotential injection attacks.  (Contributed by Antoine Pitrou in\nbpo-22796(7).)\n\nWindows improvements:\n\n* A new installer for Windows has replaced the old MSI. See *note\nUsing Python on Windows: 8dc. for more information.\n\n* Windows builds now use Microsoft Visual C++ 14.0, and extension\nmodules should use the same.\n"
                }
            ]
        },
        "Please read on for a comprehensive list of user-facing changes,": {
            "content": "including many other smaller improvements, CPython optimizations,\ndeprecations, and potential porting issues.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0453/\n\n(2) https://peps.python.org/pep-0446/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=16499\n\n(4) https://peps.python.org/pep-0451/\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=16475\n\n(6) https://peps.python.org/pep-3156/\n\n(7) https://peps.python.org/pep-0453/\n\n(8) https://peps.python.org/pep-0435/\n\n(9) https://peps.python.org/pep-0428/\n\n(10) https://peps.python.org/pep-3156/\n\n(11) https://peps.python.org/pep-0450/\n\n(12) https://peps.python.org/pep-0454/\n\n(13) https://peps.python.org/pep-0443/\n\n(14) https://peps.python.org/pep-3154/\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=8713\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=18891\n\n(17) https://peps.python.org/pep-0456/\n\n(18) https://peps.python.org/pep-0446/\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=16499\n\n(20) https://en.wikipedia.org/wiki/PBKDF2\n\n(21) https://peps.python.org/pep-0442/\n\n(22) https://peps.python.org/pep-0442/\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=18214\n\n(24) https://peps.python.org/pep-0445/\n\n(25) https://peps.python.org/pep-0436/\n\nFile: python3.12.info,  Node: New Features<13>,  Next: New Modules<9>,  Prev: Summary - Release Highlights<2>,  Up: What's New In Python 3 4\n\n\n* Menu:\n\n* PEP 453; Explicit Bootstrapping of PIP in Python Installations: PEP 453 Explicit Bootstrapping of PIP in Python Installations.\n* PEP 446; Newly Created File Descriptors Are Non-Inheritable: PEP 446 Newly Created File Descriptors Are Non-Inheritable.\n* Improvements to Codec Handling::\n* PEP 451; A ModuleSpec Type for the Import System: PEP 451 A ModuleSpec Type for the Import System.\n* Other Language Changes: Other Language Changes<9>.\n\nFile: python3.12.info,  Node: PEP 453 Explicit Bootstrapping of PIP in Python Installations,  Next: PEP 446 Newly Created File Descriptors Are Non-Inheritable,  Up: New Features<13>\n\n1.9.2.1 PEP 453: Explicit Bootstrapping of PIP in Python Installations\n......................................................................\n\n* Menu:\n\n* Bootstrapping pip By Default::\n* Documentation Changes::\n",
            "subsections": []
        },
        "Similarly to asynchronous iteration, there is a new syntax for": {
            "content": "asynchronous context managers.  The following script:\n\nimport asyncio\n\nasync def coro(name, lock):\nprint('coro {}: waiting for lock'.format(name))\nasync with lock:\nprint('coro {}: holding the lock'.format(name))\nawait asyncio.sleep(1)\nprint('coro {}: releasing the lock'.format(name))\n\nloop = asyncio.geteventloop()\nlock = asyncio.Lock()\ncoros = asyncio.gather(coro(1, lock), coro(2, lock))\ntry:\nloop.rununtilcomplete(coros)\nfinally:\nloop.close()\n\nwill output:\n\ncoro 2: waiting for lock\ncoro 2: holding the lock\ncoro 1: waiting for lock\ncoro 2: releasing the lock\ncoro 1: holding the lock\ncoro 1: releasing the lock\n\nNote that both *note async for: 8e0. and *note async with: 399. can only\nbe used inside a coroutine function declared with *note async def: 394.\n",
            "subsections": []
        },
        "Coroutine functions are intended to be run inside a compatible event": {
            "content": "loop, such as the *note asyncio loop: bd3.\n\nNote:\nChanged in version 3.5.2: Starting with CPython 3.5.2, 'aiter'\ncan directly return *note asynchronous iterators: bd4.  Returning\nan *note awaitable: ac3. object will result in a *note\nPendingDeprecationWarning: 6e0.\n\nSee more details in the *note Asynchronous Iterators: bd5.\ndocumentation section.\n\nSee also\n........\n\nPEP 492(2) - Coroutines with async and await syntax\n\nPEP written and implemented by Yury Selivanov.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0492/\n\n(2) https://peps.python.org/pep-0492/\n\nFile: python3.12.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<12>\n\n1.8.2.2 PEP 465 - A dedicated infix operator for matrix multiplication\n......................................................................\n\nPEP 465(1) adds the '@' infix operator for matrix multiplication.",
            "subsections": []
        },
        "Currently, no builtin Python types implement the new operator, however,": {
            "content": "it can be implemented by defining 'matmul()', 'rmatmul()', and\n'imatmul()' for regular, reflected, and in-place matrix\nmultiplication.  The semantics of these methods is similar to that of\nmethods defining other infix arithmetic operators.\n",
            "subsections": []
        },
        "Matrix multiplication is a notably common operation in many fields of": {
            "content": "mathematics, science, engineering, and the addition of '@' allows\nwriting cleaner code:\n\nS = (H @ beta - r).T @ inv(H @ V @ H.T) @ (H @ beta - r)\n\ninstead of:\n\nS = dot((dot(H, beta) - r).T,\ndot(inv(dot(dot(H, V), H.T)), dot(H, beta) - r))\n\nNumPy 1.10 has support for the new operator:\n\n>>> import numpy\n\n>>> x = numpy.ones(3)\n>>> x\narray([ 1., 1., 1.])\n\n>>> m = numpy.eye(3)\n>>> m\narray([[ 1., 0., 0.],\n[ 0., 1., 0.],\n[ 0., 0., 1.]])\n\n>>> x @ m\narray([ 1., 1., 1.])\n\nSee also\n........\n\nPEP 465(2) - A dedicated infix operator for matrix multiplication\n\nPEP written by Nathaniel J. Smith; implemented by Benjamin\nPeterson.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0465/\n\n(2) https://peps.python.org/pep-0465/\n\nFile: python3.12.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<12>\n\n1.8.2.3 PEP 448 - Additional Unpacking Generalizations\n......................................................\n\nPEP 448(1) extends the allowed uses of the '*' iterable unpacking\noperator and '' dictionary unpacking operator.  It is now possible to\nuse an arbitrary number of unpackings in *note function calls: bd8.:\n\n>>> print(*[1], *[2], 3, *[4, 5])\n1 2 3 4 5\n\n>>> def fn(a, b, c, d):\n...     print(a, b, c, d)\n...\n\n>>> fn({'a': 1, 'c': 3}, {'b': 2, 'd': 4})\n1 2 3 4\n",
            "subsections": []
        },
        "Similarly, tuple, list, set, and dictionary displays allow multiple": {
            "content": "unpackings (see *note Expression lists: bd9. and *note Dictionary\ndisplays: bda.):\n\n>>> *range(4), 4\n(0, 1, 2, 3, 4)\n\n>>> [*range(4), 4]\n[0, 1, 2, 3, 4]\n\n>>> {*range(4), 4, *(5, 6, 7)}\n{0, 1, 2, 3, 4, 5, 6, 7}\n\n>>> {'x': 1, {'y': 2}}\n{'x': 1, 'y': 2}\n\nSee also\n........\n\nPEP 448(2) - Additional Unpacking Generalizations\n\nPEP written by Joshua Landau; implemented by Neil Girdhar, Thomas\nWouters, and Joshua Landau.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0448/\n\n(2) https://peps.python.org/pep-0448/\n\nFile: python3.12.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<12>\n\n1.8.2.4 PEP 461 - percent formatting support for bytes and bytearray\n....................................................................\n\nPEP 461(1) adds support for the '%' *note interpolation operator: bdc.\nto *note bytes: 295. and *note bytearray: 294.\n",
            "subsections": []
        },
        "While interpolation is usually thought of as a string operation, there": {
            "content": "are cases where interpolation on 'bytes' or 'bytearrays' makes sense,\nand the work needed to make up for this missing functionality detracts\nfrom the overall readability of the code.  This issue is particularly\nimportant when dealing with wire format protocols, which are often a\nmixture of binary and ASCII compatible text.\n\nExamples:\n\n>>> b'Hello %b!' % b'World'\nb'Hello World!'\n\n>>> b'x=%i y=%f' % (1, 2.5)\nb'x=1 y=2.500000'\n\nUnicode is not allowed for '%b', but it is accepted by '%a' (equivalent\nof 'repr(obj).encode('ascii', 'backslashreplace')'):\n\n>>> b'Hello %b!' % 'World'\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nTypeError: %b requires bytes, or an object that implements bytes, not 'str'\n\n>>> b'price: %a' % '10???'\nb\"price: '10\\\\u20ac'\"\n\nNote that '%s' and '%r' conversion types, although supported, should\nonly be used in codebases that need compatibility with Python 2.\n\nSee also\n........\n\nPEP 461(2) - Adding % formatting to bytes and bytearray\n\nPEP written by Ethan Furman; implemented by Neil Schemenauer and\nEthan Furman.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0461/\n\n(2) https://peps.python.org/pep-0461/\n\nFile: python3.12.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<12>\n\n1.8.2.5 PEP 484 - Type Hints\n............................\n",
            "subsections": []
        },
        "Function annotation syntax has been a Python feature since version 3.0 (": {
            "content": "PEP 3107(1)), however the semantics of annotations has been left\nundefined.\n",
            "subsections": []
        },
        "Experience has shown that the majority of function annotation uses were": {
            "content": "to provide type hints to function parameters and return values.  It\nbecame evident that it would be beneficial for Python users, if the\nstandard library included the base definitions and tools for type\nannotations.\n\nPEP 484(2) introduces a *note provisional module: 93a. to provide these\nstandard definitions and tools, along with some conventions for\nsituations where annotations are not available.\n",
            "subsections": []
        },
        "For example, here is a simple function whose argument and return type": {
            "content": "are declared in the annotations:\n\ndef greeting(name: str) -> str:\nreturn 'Hello ' + name\n",
            "subsections": []
        },
        "While these annotations are available at runtime through the usual": {
            "content": "'annotations' attribute, 'no automatic type checking happens at\nruntime'.  Instead, it is assumed that a separate off-line type checker\n(e.g.  mypy(3)) will be used for on-demand source code analysis.\n",
            "subsections": []
        },
        "The type system supports unions, generic types, and a special type named": {
            "content": "*note Any: 479. which is consistent with (i.e.  assignable to and from)\nall types.\n\nSee also\n........\n\n* *note typing: ff. module documentation\n\n*\nPEP 484(4) - Type Hints\n\nPEP written by Guido van Rossum, Jukka Lehtosalo, and ??ukasz\nLanga; implemented by Guido van Rossum.\n\n*\nPEP 483(5) - The Theory of Type Hints\n\nPEP written by Guido van Rossum\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3107/\n\n(2) https://peps.python.org/pep-0484/\n\n(3) https://mypy-lang.org\n\n(4) https://peps.python.org/pep-0484/\n\n(5) https://peps.python.org/pep-0483/\n\nFile: python3.12.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<12>\n\n1.8.2.6 PEP 471 - os.scandir() function - a better and faster directory iterator\n................................................................................\n\nPEP 471(1) adds a new directory iteration function, *note os.scandir():\n88c, to the standard library.  Additionally, *note os.walk(): 1c8. is\nnow implemented using 'scandir', which makes it 3 to 5 times faster on\nPOSIX systems and 7 to 20 times faster on Windows systems.  This is\nlargely achieved by greatly reducing the number of calls to *note\nos.stat(): 1bf. required to walk a directory tree.\n",
            "subsections": []
        },
        "Additionally, 'scandir' returns an iterator, as opposed to returning a": {
            "content": "list of file names, which improves memory efficiency when iterating over\nvery large directories.\n\nThe following example shows a simple use of *note os.scandir(): 88c. to\ndisplay all the files (excluding directories) in the given 'path' that\ndon't start with ''.''.  The *note entry.isfile(): bdf. call will\ngenerally not make an additional system call:\n\nfor entry in os.scandir(path):\nif not entry.name.startswith('.') and entry.isfile():\nprint(entry.name)\n\nSee also\n........\n\nPEP 471(2) - os.scandir() function - a better and faster directory iterator\n\nPEP written and implemented by Ben Hoyt with the help of Victor\nStinner.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0471/\n\n(2) https://peps.python.org/pep-0471/\n\nFile: python3.12.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<12>\n\n1.8.2.7 PEP 475: Retry system calls failing with EINTR\n......................................................\n\nAn *note errno.EINTR: be2. error code is returned whenever a system\ncall, that is waiting for I/O, is interrupted by a signal.  Previously,\nPython would raise *note InterruptedError: be3. in such cases.  This\nmeant that, when writing a Python application, the developer had two\nchoices:\n\n1. Ignore the 'InterruptedError'.\n\n2. Handle the 'InterruptedError' and attempt to restart the\ninterrupted system call at every call site.\n",
            "subsections": []
        },
        "The first option makes an application fail intermittently.  The second": {
            "content": "option adds a large amount of boilerplate that makes the code nearly\nunreadable.  Compare:\n\nprint(\"Hello World\")\n\nand:\n\nwhile True:\ntry:\nprint(\"Hello World\")\nbreak\nexcept InterruptedError:\ncontinue\n\nPEP 475(1) implements automatic retry of system calls on 'EINTR'.  This\nremoves the burden of dealing with 'EINTR' or *note InterruptedError:\nbe3. in user code in most situations and makes Python programs,\nincluding the standard library, more robust.  Note that the system call\nis only retried if the signal handler does not raise an exception.\n",
            "subsections": []
        },
        "Below is a list of functions which are now retried when interrupted by a": {
            "content": "signal:\n\n* *note open(): 26e. and *note io.open(): 26f.;\n\n* functions of the *note faulthandler: 53. module;\n\n* *note os: 9c. functions: *note fchdir(): be4, *note fchmod(): be5,\n*note fchown(): be6, *note fdatasync(): be7, *note fstat(): be8,\n*note fstatvfs(): be9, *note fsync(): bea, *note ftruncate(): beb,\n*note mkfifo(): bec, *note mknod(): bed, *note open(): bee, *note\nposixfadvise(): bef, *note posixfallocate(): bf0, *note pread():\n99d, *note pwrite(): 9a0, *note read(): bf1, *note readv(): 99c,\n*note sendfile(): 946, *note wait3(): bf2, *note wait4(): bf3,\n*note wait(): bf4, *note waitid(): bf5, *note waitpid(): bf6, *note\nwrite(): bf7, *note writev(): 99f.;\n\n* special cases: *note os.close(): 9b5. and *note os.dup2(): 9a2. now\nignore *note EINTR: be2. errors; the syscall is not retried (see\nthe PEP for the rationale);\n\n* *note select: bc. functions: *note devpoll.poll(): bf8, *note\nepoll.poll(): bf9, *note kqueue.control(): bfa, *note poll.poll():\nbfb, *note select(): bfc.;\n\n* methods of the *note socket: bfd. class: *note accept(): bfe, *note\nconnect(): bff. (except for non-blocking sockets), *note recv():\nc00, *note recvfrom(): c01, *note recvmsg(): c02, *note send():\nc03, *note sendall(): c04, *note sendmsg(): 191, *note sendto():\nc05.;\n\n* *note signal.sigtimedwait(): c06. and *note signal.sigwaitinfo():\nc07.;\n\n* *note time.sleep(): 469.\n\nSee also\n........\n\nPEP 475(2) - Retry system calls failing with EINTR\n\nPEP and implementation written by Charles-Franc,ois Natali and\nVictor Stinner, with the help of Antoine Pitrou (the French\nconnection).\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0475/\n\n(2) https://peps.python.org/pep-0475/\n\nFile: python3.12.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<12>\n\n1.8.2.8 PEP 479: Change StopIteration handling inside generators\n................................................................\n\nThe interaction of generators and *note StopIteration: a40. in Python\n3.4 and earlier was sometimes surprising, and could conceal obscure\nbugs.  Previously, 'StopIteration' raised accidentally inside a\ngenerator function was interpreted as the end of the iteration by the\nloop construct driving the generator.\n\nPEP 479(1) changes the behavior of generators: when a 'StopIteration'\nexception is raised inside a generator, it is replaced with a *note",
            "subsections": []
        },
        "RuntimeError: 17a. before it exits the generator frame.  The main goal": {
            "content": "of this change is to ease debugging in the situation where an unguarded\n*note next(): 5cb. call raises 'StopIteration' and causes the iteration\ncontrolled by the generator to terminate silently.  This is particularly\npernicious in combination with the 'yield from' construct.\n",
            "subsections": []
        },
        "This is a backwards incompatible change, so to enable the new behavior,": {
            "content": "a *note future: c09. import is necessary:\n\n>>> from future import generatorstop\n\n>>> def gen():\n...     next(iter([]))\n...     yield\n...\n>>> next(gen())\nTraceback (most recent call last):\nFile \"<stdin>\", line 2, in gen\nStopIteration\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nRuntimeError: generator raised StopIteration\n\nWithout a 'future' import, a *note PendingDeprecationWarning: 6e0.\nwill be raised whenever a *note StopIteration: a40. exception is raised\ninside a generator.\n\nSee also\n........\n\nPEP 479(2) - Change StopIteration handling inside generators\n\nPEP written by Chris Angelico and Guido van Rossum.  Implemented by\nChris Angelico, Yury Selivanov and Nick Coghlan.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0479/\n\n(2) https://peps.python.org/pep-0479/\n\nFile: python3.12.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<12>\n\n1.8.2.9 PEP 485: A function for testing approximate equality\n............................................................\n\nPEP 485(1) adds the *note math.isclose(): c0c. and *note\ncmath.isclose(): c0d. functions which tell whether two values are\napproximately equal or \"close\" to each other.  Whether or not two values\nare considered close is determined according to given absolute and\nrelative tolerances.  Relative tolerance is the maximum allowed\ndifference between 'isclose' arguments, relative to the larger absolute\nvalue:\n\n>>> import math\n>>> a = 5.0\n>>> b = 4.99998\n>>> math.isclose(a, b, reltol=1e-5)\nTrue\n>>> math.isclose(a, b, reltol=1e-6)\nFalse\n",
            "subsections": []
        },
        "It is also possible to compare two values using absolute tolerance,": {
            "content": "which must be a non-negative value:\n\n>>> import math\n>>> a = 5.0\n>>> b = 4.99998\n>>> math.isclose(a, b, abstol=0.00003)\nTrue\n>>> math.isclose(a, b, abstol=0.00001)\nFalse\n\nSee also\n........\n\nPEP 485(2) - A function for testing approximate equality\n\nPEP written by Christopher Barker; implemented by Chris Barker and\nTal Einat.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0485/\n\n(2) https://peps.python.org/pep-0485/\n\nFile: python3.12.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<12>\n\n1.8.2.10 PEP 486: Make the Python Launcher aware of virtual environments\n........................................................................\n\nPEP 486(1) makes the Windows launcher (see PEP 397(2)) aware of an\nactive virtual environment.  When the default interpreter would be used\nand the 'VIRTUALENV' environment variable is set, the interpreter in\nthe virtual environment will be used.\n\nSee also\n........\n\nPEP 486(3) - Make the Python Launcher aware of virtual environments\n\nPEP written and implemented by Paul Moore.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0486/\n\n(2) https://peps.python.org/pep-0397/\n\n(3) https://peps.python.org/pep-0486/\n\nFile: python3.12.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<12>\n\n1.8.2.11 PEP 488: Elimination of PYO files\n..........................................\n\nPEP 488(1) does away with the concept of '.pyo' files.  This means that\n'.pyc' files represent both unoptimized and optimized bytecode.  To\nprevent the need to constantly regenerate bytecode files, '.pyc' files\nnow have an optional 'opt-' tag in their name when the bytecode is\noptimized.  This has the side-effect of no more bytecode file name\nclashes when running under either *note -O: c11. or *note -OO: c12.\nConsequently, bytecode files generated from *note -O: c11, and *note\n-OO: c12. may now exist simultaneously.  *note\nimportlib.util.cachefromsource(): 264. has an updated API to help with\nthis change.\n\nSee also\n........\n\nPEP 488(2) - Elimination of PYO files\n\nPEP written and implemented by Brett Cannon.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0488/\n\n(2) https://peps.python.org/pep-0488/\n\nFile: python3.12.info,  Node: PEP 489 Multi-phase extension module initialization,  Prev: PEP 488 Elimination of PYO files,  Up: New Features<12>\n\n1.8.2.12 PEP 489: Multi-phase extension module initialization\n.............................................................\n\nPEP 489(1) updates extension module initialization to take advantage of\nthe two step module loading mechanism introduced by PEP 451(2) in Python\n3.4.\n",
            "subsections": []
        },
        "This change brings the import semantics of extension modules that opt-in": {
            "content": "to using the new mechanism much closer to those of Python source and\nbytecode modules, including the ability to use any valid identifier as a\nmodule name, rather than being restricted to ASCII.\n\nSee also\n........\n\nPEP 489(3) - Multi-phase extension module initialization\n\nPEP written by Petr Viktorin, Stefan Behnel, and Nick Coghlan;\nimplemented by Petr Viktorin.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0489/\n\n(2) https://peps.python.org/pep-0451/\n\n(3) https://peps.python.org/pep-0489/\n\nFile: python3.12.info,  Node: Other Language Changes<8>,  Next: New Modules<8>,  Prev: New Features<12>,  Up: What's New In Python 3 5\n\n\nSome smaller changes made to the core Python language are:\n\n* Added the '\"namereplace\"' error handlers.  The '\"backslashreplace\"'\nerror handlers now work with decoding and translating.\n(Contributed by Serhiy Storchaka in bpo-19676(1) and bpo-22286(2).)\n\n* The *note -b: 3a8. option now affects comparisons of *note bytes:\n295. with *note int: 17e.  (Contributed by Serhiy Storchaka in\nbpo-23681(3).)\n\n* New Kazakh 'kz1048' and Tajik 'koi8t' *note codecs: c15.\n(Contributed by Serhiy Storchaka in bpo-22682(4) and bpo-22681(5).)\n\n* Property docstrings are now writable.  This is especially useful\nfor *note collections.namedtuple(): 711. docstrings.  (Contributed\nby Berker Peksag in bpo-24064(6).)\n\n* Circular imports involving relative imports are now supported.\n(Contributed by Brett Cannon and Antoine Pitrou in bpo-17636(7).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=19676\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=22286\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=23681\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=22682\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=22681\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=24064\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=17636\n\nFile: python3.12.info,  Node: New Modules<8>,  Next: Improved Modules<8>,  Prev: Other Language Changes<8>,  Up: What's New In Python 3 5\n\n\n* Menu:\n\n* typing: typing<8>.\n* zipapp: zipapp<2>.\n\nFile: python3.12.info,  Node: typing<8>,  Next: zipapp<2>,  Up: New Modules<8>\n\n1.8.4.1 typing\n..............\n\nThe new *note typing: ff. *note provisional: 93a. module provides\nstandard definitions and tools for function type annotations.  See *note\nType Hints: bc0. for more information.\n\nFile: python3.12.info,  Node: zipapp<2>,  Prev: typing<8>,  Up: New Modules<8>\n\n1.8.4.2 zipapp\n..............\n\nThe new *note zipapp: 12a. module (specified in PEP 441(1)) provides an\nAPI and command line tool for creating executable Python Zip",
            "subsections": []
        },
        "Applications, which were introduced in Python 2.6 in bpo-1739468(2), but": {
            "content": "which were not well publicized, either at the time or since.\n",
            "subsections": []
        },
        "With the new module, bundling your application is as simple as putting": {
            "content": "all the files, including a 'main.py' file, into a directory 'myapp'\nand running:\n\n$ python -m zipapp myapp\n$ python myapp.pyz\n",
            "subsections": []
        },
        "The module implementation has been contributed by Paul Moore in": {
            "content": "bpo-23491(3).\n\nSee also\n........\n\nPEP 441(4) - Improving Python ZIP Application Support\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0441/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=1739468\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=23491\n\n(4) https://peps.python.org/pep-0441/\n\nFile: python3.12.info,  Node: Improved Modules<8>,  Next: Other module-level changes,  Prev: New Modules<8>,  Up: What's New In Python 3 5\n\n\n* Menu:\n\n* argparse: argparse<3>.\n* asyncio: asyncio<9>.\n* bz2::\n* cgi::\n* cmath: cmath<2>.\n* code::\n* collections: collections<5>.\n* collections.abc: collections abc<3>.\n* compileall: compileall<3>.\n* concurrent.futures: concurrent futures<4>.\n* configparser: configparser<2>.\n* contextlib: contextlib<5>.\n* csv: csv<3>.\n* curses: curses<4>.\n* dbm: dbm<4>.\n* difflib::\n* distutils: distutils<7>.\n* doctest: doctest<2>.\n* email: email<2>.\n* enum: enum<7>.\n* faulthandler: faulthandler<3>.\n* functools: functools<4>.\n* glob: glob<2>.\n* gzip: gzip<3>.\n* heapq::\n* http: http<2>.\n* http.client: http client<3>.\n* idlelib and IDLE: idlelib and IDLE<3>.\n* imaplib: imaplib<2>.\n* imghdr::\n* importlib: importlib<7>.\n* inspect: inspect<7>.\n* io: io<4>.\n* ipaddress: ipaddress<3>.\n* json: json<2>.\n* linecache: linecache<2>.\n* locale: locale<5>.\n* logging: logging<5>.\n* lzma::\n* math: math<7>.\n* multiprocessing: multiprocessing<5>.\n* operator: operator<2>.\n* os: os<9>.\n* pathlib: pathlib<8>.\n* pickle: pickle<3>.\n* poplib: poplib<2>.\n* re: re<5>.\n* readline: readline<2>.\n* selectors::\n* shutil: shutil<4>.\n* signal: signal<3>.\n* smtpd: smtpd<2>.\n* smtplib: smtplib<2>.\n* sndhdr::\n* socket: socket<8>.\n* ssl: ssl<8>.\n* sqlite3: sqlite3<7>.\n* subprocess: subprocess<3>.\n* sys: sys<9>.\n* sysconfig: sysconfig<2>.\n* tarfile: tarfile<7>.\n* threading: threading<6>.\n* time: time<6>.\n* timeit: timeit<2>.\n* tkinter: tkinter<7>.\n* traceback: traceback<4>.\n* types: types<4>.\n* unicodedata: unicodedata<7>.\n* unittest: unittest<7>.\n* unittest.mock: unittest mock<3>.\n* urllib::\n* wsgiref::\n* xmlrpc: xmlrpc<2>.\n* xml.sax: xml sax.\n* zipfile: zipfile<4>.\n\nFile: python3.12.info,  Node: argparse<3>,  Next: asyncio<9>,  Up: Improved Modules<8>\n\n1.8.5.1 argparse\n................\n\nThe *note ArgumentParser: 28f. class now allows disabling *note\nabbreviated usage: c1b. of long options by setting *note allowabbrev:\nc1c. to 'False'.  (Contributed by Jonathan Paugh, Steven Bethard, paul\nj3 and Daniel Eriksson in bpo-14910(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=14910\n\nFile: python3.12.info,  Node: asyncio<9>,  Next: bz2,  Prev: argparse<3>,  Up: Improved Modules<8>\n\n1.8.5.2 asyncio\n...............\n\nSince the *note asyncio: 9. module is *note provisional: 93a, all\nchanges introduced in Python 3.5 have also been backported to Python\n3.4.x.\n\nNotable changes in the *note asyncio: 9. module since Python 3.4.0:\n\n* New debugging APIs: *note loop.setdebug(): c1e. and *note\nloop.getdebug(): c1f. methods.  (Contributed by Victor Stinner.)\n\n* The proactor event loop now supports SSL. (Contributed by Antoine\nPitrou and Victor Stinner in bpo-22560(1).)\n\n* A new *note loop.isclosed(): c20. method to check if the event\nloop is closed.  (Contributed by Victor Stinner in bpo-21326(2).)\n\n* A new *note loop.createtask(): 802. to conveniently create and\nschedule a new *note Task: 201. for a coroutine.  The 'createtask'\nmethod is also used by all asyncio functions that wrap coroutines\ninto tasks, such as *note asyncio.wait(): 19a, *note\nasyncio.gather(): 3c6, etc.  (Contributed by Victor Stinner.)\n\n* A new *note transport.getwritebufferlimits(): c21. method to\ninquire for 'high-' and 'low-' water limits of the flow control.\n(Contributed by Victor Stinner.)\n\n* The 'async()' function is deprecated in favor of *note\nensurefuture(): ac1.  (Contributed by Yury Selivanov.)\n\n* New *note loop.settaskfactory(): c22. and *note\nloop.gettaskfactory(): c23. methods to customize the task factory\nthat *note loop.createtask(): 802. method uses.  (Contributed by\nYury Selivanov.)\n\n* New *note Queue.join(): c24. and *note Queue.taskdone(): c25.\nqueue methods.  (Contributed by Victor Stinner.)\n\n* The 'JoinableQueue' class was removed, in favor of the *note\nasyncio.Queue: 8a4. class.  (Contributed by Victor Stinner.)\n\nUpdates in 3.5.1:\n\n* The *note ensurefuture(): ac1. function and all functions that use\nit, such as *note loop.rununtilcomplete(): ac2, now accept all\nkinds of *note awaitable objects: ac3.  (Contributed by Yury\nSelivanov.)\n\n* New *note runcoroutinethreadsafe(): 68e. function to submit\ncoroutines to event loops from other threads.  (Contributed by\nVincent Michel.)\n\n* New *note Transport.isclosing(): ac4. method to check if the\ntransport is closing or closed.  (Contributed by Yury Selivanov.)\n\n* The *note loop.createserver(): 94a. method can now accept a list\nof hosts.  (Contributed by Yann Sionneau.)\n\nUpdates in 3.5.2:\n\n* New *note loop.createfuture(): ac5. method to create Future\nobjects.  This allows alternative event loop implementations, such\nas uvloop(3), to provide a faster *note asyncio.Future: a11.\nimplementation.  (Contributed by Yury Selivanov.)\n\n* New *note loop.getexceptionhandler(): ac6. method to get the\ncurrent exception handler.  (Contributed by Yury Selivanov.)\n\n* New *note StreamReader.readuntil(): ac7. method to read data from\nthe stream until a separator bytes sequence appears.  (Contributed\nby Mark Korenberg.)\n\n* The *note loop.createconnection(): 3cc. and *note\nloop.createserver(): 94a. methods are optimized to avoid calling\nthe system 'getaddrinfo' function if the address is already\nresolved.  (Contributed by A. Jesse Jiryu Davis.)\n\n* The *note loop.sockconnect(sock, address): c26. no longer requires\nthe 'address' to be resolved prior to the call.  (Contributed by A.\nJesse Jiryu Davis.)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=22560\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=21326\n\n(3) https://github.com/MagicStack/uvloop\n\nFile: python3.12.info,  Node: bz2,  Next: cgi,  Prev: asyncio<9>,  Up: Improved Modules<8>\n\n1.8.5.3 bz2\n...........\n\nThe *note BZ2Decompressor.decompress: c28. method now accepts an\noptional 'maxlength' argument to limit the maximum size of decompressed\ndata.  (Contributed by Nikolaus Rath in bpo-15955(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=15955\n\nFile: python3.12.info,  Node: cgi,  Next: cmath<2>,  Prev: bz2,  Up: Improved Modules<8>\n\n1.8.5.4 cgi\n...........\n\nThe 'FieldStorage' class now supports the *note context manager: 398.\nprotocol.  (Contributed by Berker Peksag in bpo-20289(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=20289\n\nFile: python3.12.info,  Node: cmath<2>,  Next: code,  Prev: cgi,  Up: Improved Modules<8>\n\n1.8.5.5 cmath\n.............\n\nA new function *note isclose(): c0d. provides a way to test for\napproximate equality.  (Contributed by Chris Barker and Tal Einat in\nbpo-24270(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24270\n\nFile: python3.12.info,  Node: code,  Next: collections<5>,  Prev: cmath<2>,  Up: Improved Modules<8>\n\n1.8.5.6 code\n............\n\nThe *note InteractiveInterpreter.showtraceback(): c2c. method now prints\nthe full chained traceback, just like the interactive interpreter.\n(Contributed by Claudiu Popa in bpo-17442(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=17442\n\nFile: python3.12.info,  Node: collections<5>,  Next: collections abc<3>,  Prev: code,  Up: Improved Modules<8>\n\n1.8.5.7 collections\n...................\n\nThe *note OrderedDict: 39f. class is now implemented in C, which makes\nit 4 to 100 times faster.  (Contributed by Eric Snow in bpo-16991(1).)\n\n'OrderedDict.items()', 'OrderedDict.keys()', 'OrderedDict.values()'\nviews now support *note reversed(): 661. iteration.  (Contributed by",
            "subsections": []
        },
        "Serhiy Storchaka in bpo-19505(2).)": {
            "content": "The *note deque: 3a0. class now defines *note index(): c2e, *note\ninsert(): c2f, and *note copy(): c30, and supports the '+' and '*'\noperators.  This allows deques to be recognized as a *note\nMutableSequence: c31. and improves their substitutability for lists.\n(Contributed by Raymond Hettinger in bpo-23704(3).)\n\nDocstrings produced by *note namedtuple(): 711. can now be updated:\n\nPoint = namedtuple('Point', ['x', 'y'])\nPoint.doc += ': Cartesian coordinate'\nPoint.x.doc = 'abscissa'\nPoint.y.doc = 'ordinate'\n\n(Contributed by Berker Peksag in bpo-24064(4).)\n\nThe *note UserString: c32. class now implements the 'getnewargs()',\n'rmod()', *note casefold(): c33, *note formatmap(): c34, *note\nisprintable(): c35, and *note maketrans(): c36. methods to match the\ncorresponding methods of *note str: 157.  (Contributed by Joe Jevnik in\nbpo-22189(5).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=16991\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=19505\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=23704\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=24064\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=22189\n\nFile: python3.12.info,  Node: collections abc<3>,  Next: compileall<3>,  Prev: collections<5>,  Up: Improved Modules<8>\n\n1.8.5.8 collections.abc\n.......................\n",
            "subsections": []
        },
        "The 'Sequence.index()' method now accepts 'start' and 'stop' arguments": {
            "content": "to match the corresponding methods of *note tuple: 4b8, *note list: 3dc,\netc.  (Contributed by Devin Jeanpierre in bpo-23086(1).)\n\nA new *note Generator: c38. abstract base class.  (Contributed by Stefan",
            "subsections": []
        },
        "Behnel in bpo-24018(2).)": {
            "content": "New *note Awaitable: c39, *note Coroutine: c3a, *note AsyncIterator:\nc3b, and *note AsyncIterable: c3c. abstract base classes.  (Contributed\nby Yury Selivanov in bpo-24184(3).)\n",
            "subsections": []
        },
        "For earlier Python versions, a backport of the new ABCs is available in": {
            "content": "an external PyPI package(4).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23086\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=24018\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=24184\n\n(4) https://pypi.org/project/backportsabc\n\nFile: python3.12.info,  Node: compileall<3>,  Next: concurrent futures<4>,  Prev: collections abc<3>,  Up: Improved Modules<8>\n\n1.8.5.9 compileall\n..................\n\nA new *note compileall: 1e. option, '-j N', allows running 'N' workers\nsimultaneously to perform parallel bytecode compilation.  The *note\ncompiledir(): 95f. function has a corresponding 'workers' parameter.\n(Contributed by Claudiu Popa in bpo-16104(1).)\n",
            "subsections": []
        },
        "Another new option, '-r', allows controlling the maximum recursion level": {
            "content": "for subdirectories.  (Contributed by Claudiu Popa in bpo-19628(2).)\n",
            "subsections": []
        },
        "The '-q' command line option can now be specified more than once, in": {
            "content": "which case all output, including errors, will be suppressed.  The\ncorresponding 'quiet' parameter in *note compiledir(): 95f, *note\ncompilefile(): c3e, and *note compilepath(): c3f. can now accept an\ninteger value indicating the level of output suppression.  (Contributed\nby Thomas Kluyver in bpo-21338(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=16104\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=19628\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=21338\n\nFile: python3.12.info,  Node: concurrent futures<4>,  Next: configparser<2>,  Prev: compileall<3>,  Up: Improved Modules<8>\n\n1.8.5.10 concurrent.futures\n...........................\n\nThe *note Executor.map(): c41. method now accepts a 'chunksize' argument\nto allow batching of tasks to improve performance when *note",
            "subsections": []
        },
        "ProcessPoolExecutor(): 707. is used.  (Contributed by Dan O'Reilly in": {
            "content": "bpo-11271(1).)\n\nThe number of workers in the *note ThreadPoolExecutor: 529. constructor\nis optional now.  The default value is 5 times the number of CPUs.\n(Contributed by Claudiu Popa in bpo-21527(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=11271\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=21527\n\nFile: python3.12.info,  Node: configparser<2>,  Next: contextlib<5>,  Prev: concurrent futures<4>,  Up: Improved Modules<8>\n\n1.8.5.11 configparser\n.....................\n\n*note configparser: 20. now provides a way to customize the conversion\nof values by specifying a dictionary of converters in the *note",
            "subsections": []
        },
        "ConfigParser: 257. constructor, or by defining them as methods in": {
            "content": "'ConfigParser' subclasses.  Converters defined in a parser instance are\ninherited by its section proxies.\n\nExample:\n\n>>> import configparser\n>>> conv = {}\n>>> conv['list'] = lambda v: [e.strip() for e in v.split() if e.strip()]\n>>> cfg = configparser.ConfigParser(converters=conv)\n>>> cfg.readstring(\"\"\"\n... [s]\n... list = a b c d e f g\n... \"\"\")\n>>> cfg.get('s', 'list')\n'a b c d e f g'\n>>> cfg.getlist('s', 'list')\n['a', 'b', 'c', 'd', 'e', 'f', 'g']\n>>> section = cfg['s']\n>>> section.getlist('list')\n['a', 'b', 'c', 'd', 'e', 'f', 'g']\n\n(Contributed by ??ukasz Langa in bpo-18159(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=18159\n\nFile: python3.12.info,  Node: contextlib<5>,  Next: csv<3>,  Prev: configparser<2>,  Up: Improved Modules<8>\n\n1.8.5.12 contextlib\n...................\n\nThe new *note redirectstderr(): c44. *note context manager: 398.\n(similar to *note redirectstdout(): c45.) makes it easier for utility\nscripts to handle inflexible APIs that write their output to *note\nsys.stderr: 757. and don't provide any options to redirect it:\n\n>>> import contextlib, io, logging\n>>> f = io.StringIO()\n>>> with contextlib.redirectstderr(f):\n...     logging.warning('warning')\n...\n>>> f.getvalue()\n'WARNING:root:warning\\n'\n\n(Contributed by Berker Peksag in bpo-22389(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=22389\n\nFile: python3.12.info,  Node: csv<3>,  Next: curses<4>,  Prev: contextlib<5>,  Up: Improved Modules<8>\n\n1.8.5.13 csv\n............\n\nThe *note writerow(): c47. method now supports arbitrary iterables, not\njust sequences.  (Contributed by Serhiy Storchaka in bpo-23171(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23171\n\nFile: python3.12.info,  Node: curses<4>,  Next: dbm<4>,  Prev: csv<3>,  Up: Improved Modules<8>\n\n1.8.5.14 curses\n...............\n\nThe new *note updatelinescols(): c49. function updates the 'LINES' and\n'COLS' module variables.  This is useful for detecting manual screen\nresizing.  (Contributed by Arnon Yaari in bpo-4254(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=4254\n\nFile: python3.12.info,  Node: dbm<4>,  Next: difflib,  Prev: curses<4>,  Up: Improved Modules<8>\n\n1.8.5.15 dbm\n............\n\n*note dumb.open: 8c8. always creates a new database when the flag has\nthe value '\"n\"'.  (Contributed by Claudiu Popa in bpo-18039(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=18039\n\nFile: python3.12.info,  Node: difflib,  Next: distutils<7>,  Prev: dbm<4>,  Up: Improved Modules<8>\n\n1.8.5.16 difflib\n................\n\nThe charset of HTML documents generated by *note HtmlDiff.makefile():\nc4c. can now be customized by using a new 'charset' keyword-only\nargument.  The default charset of HTML document changed from\n'\"ISO-8859-1\"' to '\"utf-8\"'.  (Contributed by Berker Peksag in\nbpo-2052(1).)\n\nThe *note diffbytes(): c4d. function can now compare lists of byte\nstrings.  This fixes a regression from Python 2.  (Contributed by Terry\nJ. Reedy and Greg Ward in bpo-17445(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=2052\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=17445\n\nFile: python3.12.info,  Node: distutils<7>,  Next: doctest<2>,  Prev: difflib,  Up: Improved Modules<8>\n\n1.8.5.17 distutils\n..................\n",
            "subsections": []
        },
        "Both the 'build' and 'buildext' commands now accept a '-j' option to": {
            "content": "enable parallel building of extension modules.  (Contributed by Antoine",
            "subsections": []
        },
        "Pitrou in bpo-5309(1).)": {
            "content": "",
            "subsections": []
        },
        "The 'distutils' module now supports 'xz' compression, and can be enabled": {
            "content": "by passing 'xztar' as an argument to 'bdist --format'.  (Contributed by",
            "subsections": []
        },
        "Serhiy Storchaka in bpo-16314(2).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=5309\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=16314\n\nFile: python3.12.info,  Node: doctest<2>,  Next: email<2>,  Prev: distutils<7>,  Up: Improved Modules<8>\n\n1.8.5.18 doctest\n................\n\nThe *note DocTestSuite(): c50. function returns an empty *note\nunittest.TestSuite: c51. if 'module' contains no docstrings, instead of\nraising *note ValueError: 183.  (Contributed by Glenn Jones in\nbpo-15916(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=15916\n\nFile: python3.12.info,  Node: email<2>,  Next: enum<7>,  Prev: doctest<2>,  Up: Improved Modules<8>\n\n1.8.5.19 email\n..............\n\nA new policy option *note Policy.manglefrom: c53. controls whether or\nnot lines that start with '\"From \"' in email bodies are prefixed with a\n'\">\"' character by generators.  The default is 'True' for *note\ncompat32: ae6. and 'False' for all other policies.  (Contributed by",
            "subsections": []
        },
        "Milan Oberkirch in bpo-20098(1).)": {
            "content": "A new *note Message.getcontentdisposition(): c54. method provides easy\naccess to a canonical value for the 'Content-Disposition' header.\n(Contributed by Abhilash Raj in bpo-21083(2).)\n\nA new policy option *note EmailPolicy.utf8: c55. can be set to 'True' to\nencode email headers using the UTF-8 charset instead of using encoded\nwords.  This allows 'Messages' to be formatted according to RFC 6532(3)\nand used with an SMTP server that supports the RFC 6531(4) 'SMTPUTF8'\nextension.  (Contributed by R. David Murray in bpo-24211(5).)\n\nThe *note mime.text.MIMEText: c56. constructor now accepts a *note\ncharset.Charset: c57. instance.  (Contributed by Claude Paroz and Berker",
            "subsections": []
        },
        "Peksag in bpo-16324(6).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=20098\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=21083\n\n(3) https://datatracker.ietf.org/doc/html/rfc6532.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc6531.html\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=24211\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=16324\n\nFile: python3.12.info,  Node: enum<7>,  Next: faulthandler<3>,  Prev: email<2>,  Up: Improved Modules<8>\n\n1.8.5.20 enum\n.............\n\nThe *note Enum: 3fd. callable has a new parameter 'start' to specify the\ninitial number of enum values if only 'names' are provided:\n\n>>> Animal = enum.Enum('Animal', 'cat dog', start=10)\n>>> Animal.cat\n<Animal.cat: 10>\n>>> Animal.dog\n<Animal.dog: 11>\n\n(Contributed by Ethan Furman in bpo-21706(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=21706\n\nFile: python3.12.info,  Node: faulthandler<3>,  Next: functools<4>,  Prev: enum<7>,  Up: Improved Modules<8>\n\n1.8.5.21 faulthandler\n.....................\n\nThe *note enable(): aed, *note register(): c5a, *note dumptraceback():\nc5b. and *note dumptracebacklater(): c5c. functions now accept file\ndescriptors in addition to file-like objects.  (Contributed by Wei Wu in\nbpo-23566(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23566\n\nFile: python3.12.info,  Node: functools<4>,  Next: glob<2>,  Prev: faulthandler<3>,  Up: Improved Modules<8>\n\n1.8.5.22 functools\n..................\n\nMost of the *note lrucache(): 815. machinery is now implemented in C,\nmaking it significantly faster.  (Contributed by Matt Joiner, Alexey",
            "subsections": []
        },
        "Kachayev, and Serhiy Storchaka in bpo-14373(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=14373\n\nFile: python3.12.info,  Node: glob<2>,  Next: gzip<3>,  Prev: functools<4>,  Up: Improved Modules<8>\n\n1.8.5.23 glob\n.............\n\nThe *note iglob(): 5fb. and *note glob(): 5fa. functions now support\nrecursive search in subdirectories, using the '\"\"' pattern.\n(Contributed by Serhiy Storchaka in bpo-13968(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=13968\n\nFile: python3.12.info,  Node: gzip<3>,  Next: heapq,  Prev: glob<2>,  Up: Improved Modules<8>\n\n1.8.5.24 gzip\n.............\n\nThe 'mode' argument of the *note GzipFile: 25e. constructor now accepts\n'\"x\"' to request exclusive creation.  (Contributed by Tim Heaney in\nbpo-19222(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=19222\n\nFile: python3.12.info,  Node: heapq,  Next: http<2>,  Prev: gzip<3>,  Up: Improved Modules<8>\n\n1.8.5.25 heapq\n..............\n\nElement comparison in *note merge(): c61. can now be customized by\npassing a *note key function: c62. in a new optional 'key' keyword\nargument, and a new optional 'reverse' keyword argument can be used to\nreverse element comparison:\n\n>>> import heapq\n>>> a = ['9', '777', '55555']\n>>> b = ['88', '6666']\n>>> list(heapq.merge(a, b, key=len))\n['9', '88', '777', '6666', '55555']\n>>> list(heapq.merge(reversed(a), reversed(b), key=len, reverse=True))\n['55555', '6666', '777', '88', '9']\n\n(Contributed by Raymond Hettinger in bpo-13742(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=13742\n\nFile: python3.12.info,  Node: http<2>,  Next: http client<3>,  Prev: heapq,  Up: Improved Modules<8>\n\n1.8.5.26 http\n.............\n\nA new *note HTTPStatus: 71b. enum that defines a set of HTTP status\ncodes, reason phrases and long descriptions written in English.\n(Contributed by Demian Brecht in bpo-21793(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=21793\n\nFile: python3.12.info,  Node: http client<3>,  Next: idlelib and IDLE<3>,  Prev: http<2>,  Up: Improved Modules<8>\n\n1.8.5.27 http.client\n....................\n\n*note HTTPConnection.getresponse(): c65. now raises a *note",
            "subsections": []
        },
        "RemoteDisconnected: c66. exception when a remote server connection is": {
            "content": "closed unexpectedly.  Additionally, if a *note ConnectionError: c67. (of\nwhich 'RemoteDisconnected' is a subclass) is raised, the client socket\nis now closed automatically, and will reconnect on the next request:\n\nimport http.client\nconn = http.client.HTTPConnection('www.python.org')\nfor retries in range(3):\ntry:\nconn.request('GET', '/')\nresp = conn.getresponse()\nexcept http.client.RemoteDisconnected:\npass\n\n(Contributed by Martin Panter in bpo-3566(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=3566\n\nFile: python3.12.info,  Node: idlelib and IDLE<3>,  Next: imaplib<2>,  Prev: http client<3>,  Up: Improved Modules<8>\n\n1.8.5.28 idlelib and IDLE\n.........................\n",
            "subsections": []
        },
        "Since idlelib implements the IDLE shell and editor and is not intended": {
            "content": "for import by other programs, it gets improvements with every release.",
            "subsections": []
        },
        "See 'Lib/idlelib/NEWS.txt' for a cumulative list of changes since 3.4.0,": {
            "content": "as well as changes made in future 3.5.x releases.  This file is also\navailable from the IDLE Help ??? About IDLE dialog.\n\nFile: python3.12.info,  Node: imaplib<2>,  Next: imghdr,  Prev: idlelib and IDLE<3>,  Up: Improved Modules<8>\n\n1.8.5.29 imaplib\n................\n\nThe *note IMAP4: 71e. class now supports the *note context manager: 398.\nprotocol.  When used in a *note with: 396. statement, the IMAP4 'LOGOUT'\ncommand will be called automatically at the end of the block.\n(Contributed by Tarek Ziade' and Serhiy Storchaka in bpo-4972(1).)\n\nThe *note imaplib: 6f. module now supports RFC 5161(2) (ENABLE\nExtension) and RFC 6855(3) (UTF-8 Support) via the *note IMAP4.enable():\nc6a. method.  A new *note IMAP4.utf8enabled: c6b. attribute tracks\nwhether or not RFC 6855(4) support is enabled.  (Contributed by Milan",
            "subsections": []
        },
        "Oberkirch, R. David Murray, and Maciej Szulik in bpo-21800(5).)": {
            "content": "The *note imaplib: 6f. module now automatically encodes non-ASCII string\nusernames and passwords using UTF-8, as recommended by the RFCs.\n(Contributed by Milan Oberkirch in bpo-21800(6).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=4972\n\n(2) https://datatracker.ietf.org/doc/html/rfc5161.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc6855.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc6855.html\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=21800\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=21800\n\nFile: python3.12.info,  Node: imghdr,  Next: importlib<7>,  Prev: imaplib<2>,  Up: Improved Modules<8>\n\n1.8.5.30 imghdr\n...............\n\nThe *note what(): c6d. function now recognizes the OpenEXR(1) format\n(contributed by Martin Vignali and Claudiu Popa in bpo-20295(2)), and\nthe WebP(3) format (contributed by Fabrice Aneche and Claudiu Popa in\nbpo-20197(4).)\n\n---------- Footnotes ----------\n\n(1) https://www.openexr.com\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=20295\n\n(3) https://en.wikipedia.org/wiki/WebP\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=20197\n\nFile: python3.12.info,  Node: importlib<7>,  Next: inspect<7>,  Prev: imghdr,  Up: Improved Modules<8>\n\n1.8.5.31 importlib\n..................\n\nThe *note util.LazyLoader: afc. class allows for lazy loading of modules\nin applications where startup time is important.  (Contributed by Brett",
            "subsections": []
        },
        "Cannon in bpo-17621(1).)": {
            "content": "The *note abc.InspectLoader.sourcetocode(): c6f. method is now a\nstatic method.  This makes it easier to initialize a module object with\ncode compiled from a string by running 'exec(code, module.dict)'.\n(Contributed by Brett Cannon in bpo-21156(2).)\n\nThe new *note util.modulefromspec(): c70. function is now the\npreferred way to create a new module.  As opposed to creating a *note\ntypes.ModuleType: c71. instance directly, this new function will set the\nvarious import-controlled attributes based on the passed-in spec object.\n(Contributed by Brett Cannon in bpo-20383(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=17621\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=21156\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=20383\n\nFile: python3.12.info,  Node: inspect<7>,  Next: io<4>,  Prev: importlib<7>,  Up: Improved Modules<8>\n\n1.8.5.32 inspect\n................\n\nBoth the *note Signature: 51e. and *note Parameter: c73. classes are now\npicklable and hashable.  (Contributed by Yury Selivanov in bpo-20726(1)\nand bpo-20334(2).)\n\nA new *note BoundArguments.applydefaults(): c74. method provides a way\nto set default values for missing arguments:\n\n>>> def foo(a, b='ham', *args): pass\n>>> ba = inspect.signature(foo).bind('spam')\n>>> ba.applydefaults()\n>>> ba.arguments\nOrderedDict([('a', 'spam'), ('b', 'ham'), ('args', ())])\n\n(Contributed by Yury Selivanov in bpo-24190(3).)\n\nA new class method *note Signature.fromcallable(): 51f. makes\nsubclassing of *note Signature: 51e. easier.  (Contributed by Yury",
            "subsections": []
        },
        "Selivanov and Eric Snow in bpo-17373(4).)": {
            "content": "The *note signature(): 51c. function now accepts a 'followwrapped'\noptional keyword argument, which, when set to 'False', disables\nautomatic following of 'wrapped' links.  (Contributed by Yury",
            "subsections": []
        },
        "Selivanov in bpo-20691(5).)": {
            "content": "A set of new functions to inspect *note coroutine functions: bd1. and\n*note coroutine objects: 1ae. has been added: *note iscoroutine(): c75,\n*note iscoroutinefunction(): 1af, *note isawaitable(): c76, *note\ngetcoroutinelocals(): c77, and *note getcoroutinestate(): c78.\n(Contributed by Yury Selivanov in bpo-24017(6) and bpo-24400(7).)\n\nThe *note stack(): 41b, *note trace(): 41c, *note getouterframes(): 419,\nand *note getinnerframes(): 41a. functions now return a list of named\ntuples.  (Contributed by Daniel Shahaf in bpo-16808(8).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=20726\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=20334\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=24190\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=17373\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=20691\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=24017\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=24400\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=16808\n\nFile: python3.12.info,  Node: io<4>,  Next: ipaddress<3>,  Prev: inspect<7>,  Up: Improved Modules<8>\n\n1.8.5.33 io\n...........\n\nA new *note BufferedIOBase.readinto1(): c7a. method, that uses at most\none call to the underlying raw stream's *note RawIOBase.read(): c7b. or\n*note RawIOBase.readinto(): c7c. methods.  (Contributed by Nikolaus Rath\nin bpo-20578(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=20578\n\nFile: python3.12.info,  Node: ipaddress<3>,  Next: json<2>,  Prev: io<4>,  Up: Improved Modules<8>\n\n1.8.5.34 ipaddress\n..................\n\nBoth the *note IPv4Network: 986. and *note IPv6Network: 985. classes now\naccept an '(address, netmask)' tuple argument, so as to easily construct\nnetwork objects from existing addresses:\n\n>>> import ipaddress\n>>> ipaddress.IPv4Network(('127.0.0.0', 8))\nIPv4Network('127.0.0.0/8')\n>>> ipaddress.IPv4Network(('127.0.0.0', '255.0.0.0'))\nIPv4Network('127.0.0.0/8')\n\n(Contributed by Peter Moody and Antoine Pitrou in bpo-16531(1).)\n\nA new 'reversepointer' attribute for the *note IPv4Network: 986. and\n*note IPv6Network: 985. classes returns the name of the reverse DNS PTR\nrecord:\n\n>>> import ipaddress\n>>> addr = ipaddress.IPv4Address('127.0.0.1')\n>>> addr.reversepointer\n'1.0.0.127.in-addr.arpa'\n>>> addr6 = ipaddress.IPv6Address('::1')\n>>> addr6.reversepointer\n'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'\n\n(Contributed by Leon Weber in bpo-20480(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=16531\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=20480\n\nFile: python3.12.info,  Node: json<2>,  Next: linecache<2>,  Prev: ipaddress<3>,  Up: Improved Modules<8>\n\n1.8.5.35 json\n.............\n\nThe *note json.tool: 7d. command line interface now preserves the order\nof keys in JSON objects passed in input.  The new '--sort-keys' option\ncan be used to sort the keys alphabetically.  (Contributed by Berker",
            "subsections": []
        },
        "Peksag in bpo-21650(1).)": {
            "content": "JSON decoder now raises *note JSONDecodeError: c7f. instead of *note\nValueError: 183. to provide better context information about the error.\n(Contributed by Serhiy Storchaka in bpo-19361(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=21650\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=19361\n\nFile: python3.12.info,  Node: linecache<2>,  Next: locale<5>,  Prev: json<2>,  Up: Improved Modules<8>\n\n1.8.5.36 linecache\n..................\n\nA new *note lazycache(): c81. function can be used to capture\ninformation about a non-file-based module to permit getting its lines\nlater via *note getline(): c82.  This avoids doing I/O until a line is\nactually needed, without having to carry the module globals around\nindefinitely.  (Contributed by Robert Collins in bpo-17911(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=17911\n\nFile: python3.12.info,  Node: locale<5>,  Next: logging<5>,  Prev: linecache<2>,  Up: Improved Modules<8>\n\n1.8.5.37 locale\n...............\n\nA new *note delocalize(): c84. function can be used to convert a string\ninto a normalized number string, taking the 'LCNUMERIC' settings into\naccount:\n\n>>> import locale\n>>> locale.setlocale(locale.LCNUMERIC, 'deDE.UTF-8')\n'deDE.UTF-8'\n>>> locale.delocalize('1.234,56')\n'1234.56'\n>>> locale.setlocale(locale.LCNUMERIC, 'enUS.UTF-8')\n'enUS.UTF-8'\n>>> locale.delocalize('1,234.56')\n'1234.56'\n\n(Contributed by Ce'dric Krier in bpo-13918(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=13918\n\nFile: python3.12.info,  Node: logging<5>,  Next: lzma,  Prev: locale<5>,  Up: Improved Modules<8>\n\n1.8.5.38 logging\n................\n\nAll logging methods (*note Logger: 98b. *note log(): c86, *note\nexception(): c87, *note critical(): c88, *note debug(): c89, etc.), now\naccept exception instances as an 'excinfo' argument, in addition to\nboolean values and exception tuples:\n\n>>> import logging\n>>> try:\n...     1/0\n... except ZeroDivisionError as ex:\n...     logging.error('exception', excinfo=ex)\nERROR:root:exception\n\n(Contributed by Yury Selivanov in bpo-20537(1).)\n\nThe *note handlers.HTTPHandler: c8a. class now accepts an optional *note\nssl.SSLContext: 278. instance to configure SSL settings used in an HTTP\nconnection.  (Contributed by Alex Gaynor in bpo-22788(2).)\n\nThe *note handlers.QueueListener: c8b. class now takes a\n'respecthandlerlevel' keyword argument which, if set to 'True', will\npass messages to handlers taking handler levels into account.\n(Contributed by Vinay Sajip.)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=20537\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=22788\n\nFile: python3.12.info,  Node: lzma,  Next: math<7>,  Prev: logging<5>,  Up: Improved Modules<8>\n\n1.8.5.39 lzma\n.............\n\nThe *note LZMADecompressor.decompress(): c8d. method now accepts an\noptional 'maxlength' argument to limit the maximum size of decompressed\ndata.  (Contributed by Martin Panter in bpo-15955(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=15955\n\nFile: python3.12.info,  Node: math<7>,  Next: multiprocessing<5>,  Prev: lzma,  Up: Improved Modules<8>\n\n1.8.5.40 math\n.............\n\nTwo new constants have been added to the *note math: 89. module: *note\ninf: ad1. and *note nan: 42d.  (Contributed by Mark Dickinson in\nbpo-23185(1).)\n\nA new function *note isclose(): c0c. provides a way to test for\napproximate equality.  (Contributed by Chris Barker and Tal Einat in\nbpo-24270(2).)\n\nA new *note gcd(): 72c. function has been added.  The 'fractions.gcd()'\nfunction is now deprecated.  (Contributed by Mark Dickinson and Serhiy",
            "subsections": []
        },
        "Storchaka in bpo-22486(3).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23185\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=24270\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=22486\n\nFile: python3.12.info,  Node: multiprocessing<5>,  Next: operator<2>,  Prev: math<7>,  Up: Improved Modules<8>\n\n1.8.5.41 multiprocessing\n........................\n\n*note sharedctypes.synchronized(): c90. objects now support the *note\ncontext manager: 398. protocol.  (Contributed by Charles-Franc,ois Natali\nin bpo-21565(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=21565\n\nFile: python3.12.info,  Node: operator<2>,  Next: os<9>,  Prev: multiprocessing<5>,  Up: Improved Modules<8>\n\n1.8.5.42 operator\n.................\n\n*note attrgetter(): c92, *note itemgetter(): 88f, and *note\nmethodcaller(): c93. objects now support pickling.  (Contributed by Josh",
            "subsections": []
        },
        "Rosenberg and Serhiy Storchaka in bpo-22955(1).)": {
            "content": "New *note matmul(): c94. and *note imatmul(): c95. functions to perform\nmatrix multiplication.  (Contributed by Benjamin Peterson in\nbpo-21176(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=22955\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=21176\n\nFile: python3.12.info,  Node: os<9>,  Next: pathlib<8>,  Prev: operator<2>,  Up: Improved Modules<8>\n\n1.8.5.43 os\n...........\n\nThe new *note scandir(): 88c. function returning an iterator of *note\nDirEntry: 1ba. objects has been added.  If possible, *note scandir():\n88c. extracts file attributes while scanning a directory, removing the\nneed to perform subsequent system calls to determine file type or\nattributes, which may significantly improve performance.  (Contributed\nby Ben Hoyt with the help of Victor Stinner in bpo-22524(1).)\n\nOn Windows, a new *note statresult.stfileattributes: c97. attribute\nis now available.  It corresponds to the 'dwFileAttributes' member of\nthe 'BYHANDLEFILEINFORMATION' structure returned by\n'GetFileInformationByHandle()'.  (Contributed by Ben Hoyt in\nbpo-21719(2).)\n\nThe *note urandom(): 276. function now uses the 'getrandom()' syscall on",
            "subsections": []
        },
        "Linux 3.17 or newer, and 'getentropy()' on OpenBSD 5.6 and newer,": {
            "content": "removing the need to use '/dev/urandom' and avoiding failures due to\npotential file descriptor exhaustion.  (Contributed by Victor Stinner in\nbpo-22181(3).)\n\nNew *note getblocking(): c98. and *note setblocking(): c99. functions\nallow getting and setting a file descriptor's blocking mode (*note\nONONBLOCK: c9a.)  (Contributed by Victor Stinner in bpo-22054(4).)\n\nThe *note truncate(): c9b. and *note ftruncate(): beb. functions are now\nsupported on Windows.  (Contributed by Steve Dower in bpo-23668(5).)\n\nThere is a new *note os.path.commonpath(): c9c. function returning the\nlongest common sub-path of each passed pathname.  Unlike the *note\nos.path.commonprefix(): c9d. function, it always returns a valid path:\n\n>>> os.path.commonprefix(['/usr/lib', '/usr/local/lib'])\n'/usr/l'\n\n>>> os.path.commonpath(['/usr/lib', '/usr/local/lib'])\n'/usr'\n\n(Contributed by Rafik Draoui and Serhiy Storchaka in bpo-10395(6).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=22524\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=21719\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=22181\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=22054\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=23668\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=10395\n\nFile: python3.12.info,  Node: pathlib<8>,  Next: pickle<3>,  Prev: os<9>,  Up: Improved Modules<8>\n\n1.8.5.44 pathlib\n................\n\nThe new *note Path.samefile(): c9f. method can be used to check whether\nthe path points to the same file as another path, which can be either\nanother *note Path: 149. object, or a string:\n\n>>> import pathlib\n>>> p1 = pathlib.Path('/etc/hosts')\n>>> p2 = pathlib.Path('/etc/../etc/hosts')\n>>> p1.samefile(p2)\nTrue\n\n(Contributed by Vajrasky Kok and Antoine Pitrou in bpo-19775(1).)\n\nThe *note Path.mkdir(): ca0. method now accepts a new optional\n'existok' argument to match 'mkdir -p' and *note os.makedirs(): 9a1.\nfunctionality.  (Contributed by Berker Peksag in bpo-21539(2).)\n\nThere is a new *note Path.expanduser(): ca1. method to expand '~' and\n'~user' prefixes.  (Contributed by Serhiy Storchaka and Claudiu Popa in\nbpo-19776(3).)\n\nA new *note Path.home(): ca2. class method can be used to get a *note\nPath: 149. instance representing the user's home directory.\n(Contributed by Victor Salgado and Mayank Tripathi in bpo-19777(4).)\n\nNew *note Path.writetext(): ca3, *note Path.readtext(): ca4, *note\nPath.writebytes(): ca5, *note Path.readbytes(): ca6. methods to\nsimplify read/write operations on files.\n",
            "subsections": []
        },
        "The following code snippet will create or rewrite existing file": {
            "content": "'~/spam42':\n\n>>> import pathlib\n>>> p = pathlib.Path('~/spam42')\n>>> p.expanduser().writetext('ham')\n3\n\n(Contributed by Christopher Welborn in bpo-20218(5).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=19775\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=21539\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=19776\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=19777\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=20218\n\nFile: python3.12.info,  Node: pickle<3>,  Next: poplib<2>,  Prev: pathlib<8>,  Up: Improved Modules<8>\n\n1.8.5.45 pickle\n...............\n",
            "subsections": []
        },
        "Nested objects, such as unbound methods or nested classes, can now be": {
            "content": "pickled using *note pickle protocols: b10. older than protocol version\n4.  Protocol version 4 already supports these cases.  (Contributed by",
            "subsections": []
        },
        "Serhiy Storchaka in bpo-23611(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23611\n\nFile: python3.12.info,  Node: poplib<2>,  Next: re<5>,  Prev: pickle<3>,  Up: Improved Modules<8>\n\n1.8.5.46 poplib\n...............\n\nA new *note POP3.utf8(): ca9. command enables RFC 6856(1)\n(Internationalized Email) support, if a POP server supports it.\n(Contributed by Milan OberKirch in bpo-21804(2).)\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc6856.html\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=21804\n\nFile: python3.12.info,  Node: re<5>,  Next: readline<2>,  Prev: poplib<2>,  Up: Improved Modules<8>\n\n1.8.5.47 re\n...........\n",
            "subsections": []
        },
        "References and conditional references to groups with fixed length are": {
            "content": "now allowed in lookbehind assertions:\n\n>>> import re\n>>> pat = re.compile(r'(a|b).(?<=\\1)c')\n>>> pat.match('aac')\n<sre.SREMatch object; span=(0, 3), match='aac'>\n>>> pat.match('bbc')\n<sre.SREMatch object; span=(0, 3), match='bbc'>\n\n(Contributed by Serhiy Storchaka in bpo-9179(1).)\n",
            "subsections": []
        },
        "The number of capturing groups in regular expressions is no longer": {
            "content": "limited to 100.  (Contributed by Serhiy Storchaka in bpo-22437(2).)\n\nThe *note sub(): 1ff. and *note subn(): 200. functions now replace\nunmatched groups with empty strings instead of raising an exception.\n(Contributed by Serhiy Storchaka in bpo-1519638(3).)\n\nThe *note re.error: cab. exceptions have new attributes, *note msg: cac,\n*note pattern: cad, *note pos: cae, *note lineno: caf, and *note colno:\ncb0, that provide better context information about the error:\n\n>>> re.compile(\"\"\"\n...     (?x)\n...     .++\n... \"\"\")\nTraceback (most recent call last):\n...\nsreconstants.error: multiple repeat at position 16 (line 3, column 7)\n\n(Contributed by Serhiy Storchaka in bpo-22578(4).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=9179\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=22437\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=1519638\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=22578\n\nFile: python3.12.info,  Node: readline<2>,  Next: selectors,  Prev: re<5>,  Up: Improved Modules<8>\n\n1.8.5.48 readline\n.................\n\nA new *note appendhistoryfile(): cb2. function can be used to append\nthe specified number of trailing elements in history to the given file.\n(Contributed by Bruno Cauet in bpo-22940(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=22940\n\nFile: python3.12.info,  Node: selectors,  Next: shutil<4>,  Prev: readline<2>,  Up: Improved Modules<8>\n\n1.8.5.49 selectors\n..................\n\nThe new *note DevpollSelector: a1b. supports efficient '/dev/poll'\npolling on Solaris.  (Contributed by Giampaolo Rodola' in bpo-18931(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=18931\n\nFile: python3.12.info,  Node: shutil<4>,  Next: signal<3>,  Prev: selectors,  Up: Improved Modules<8>\n\n1.8.5.50 shutil\n...............\n\nThe *note move(): 889. function now accepts a 'copyfunction' argument,\nallowing, for example, the *note copy(): 887. function to be used\ninstead of the default *note copy2(): 888. if there is a need to ignore\nfile metadata when moving.  (Contributed by Claudiu Popa in\nbpo-19840(1).)\n\nThe *note makearchive(): 1d4. function now supports the 'xztar' format.\n(Contributed by Serhiy Storchaka in bpo-5411(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=19840\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=5411\n\nFile: python3.12.info,  Node: signal<3>,  Next: smtpd<2>,  Prev: shutil<4>,  Up: Improved Modules<8>\n\n1.8.5.51 signal\n...............\n\nOn Windows, the *note setwakeupfd(): 9b1. function now also supports\nsocket handles.  (Contributed by Victor Stinner in bpo-22018(1).)\n\nVarious 'SIG*' constants in the *note signal: c1. module have been\nconverted into *note Enums: 51.  This allows meaningful names to be\nprinted during debugging, instead of integer \"magic numbers\".\n(Contributed by Giampaolo Rodola' in bpo-21076(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=22018\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=21076\n\nFile: python3.12.info,  Node: smtpd<2>,  Next: smtplib<2>,  Prev: signal<3>,  Up: Improved Modules<8>\n\n1.8.5.52 smtpd\n..............\n",
            "subsections": []
        },
        "Both the 'SMTPServer' and 'SMTPChannel' classes now accept a": {
            "content": "'decodedata' keyword argument to determine if the 'DATA' portion of the\nSMTP transaction is decoded using the '\"utf-8\"' codec or is instead\nprovided to the 'SMTPServer.processmessage()' method as a byte string.",
            "subsections": []
        },
        "The default is 'True' for backward compatibility reasons, but will": {
            "content": "change to 'False' in Python 3.6.  If 'decodedata' is set to 'False',\nthe 'processmessage' method must be prepared to accept keyword\narguments.  (Contributed by Maciej Szulik in bpo-19662(1).)\n",
            "subsections": []
        },
        "The 'SMTPServer' class now advertises the '8BITMIME' extension ( RFC": {
            "content": "6152(2)) if 'decodedata' has been set 'True'.  If the client specifies\n'BODY=8BITMIME' on the 'MAIL' command, it is passed to\n'SMTPServer.processmessage()' via the 'mailoptions' keyword.\n(Contributed by Milan Oberkirch and R. David Murray in bpo-21795(3).)\n",
            "subsections": []
        },
        "The 'SMTPServer' class now also supports the 'SMTPUTF8' extension ( RFC": {
            "content": "6531(4): Internationalized Email).  If the client specified 'SMTPUTF8\nBODY=8BITMIME' on the 'MAIL' command, they are passed to\n'SMTPServer.processmessage()' via the 'mailoptions' keyword.  It is\nthe responsibility of the 'processmessage' method to correctly handle\nthe 'SMTPUTF8' data.  (Contributed by Milan Oberkirch in bpo-21725(5).)\n",
            "subsections": []
        },
        "It is now possible to provide, directly or via name resolution, IPv6": {
            "content": "addresses in the 'SMTPServer' constructor, and have it successfully\nconnect.  (Contributed by Milan Oberkirch in bpo-14758(6).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=19662\n\n(2) https://datatracker.ietf.org/doc/html/rfc6152.html\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=21795\n\n(4) https://datatracker.ietf.org/doc/html/rfc6531.html\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=21725\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=14758\n\nFile: python3.12.info,  Node: smtplib<2>,  Next: sndhdr,  Prev: smtpd<2>,  Up: Improved Modules<8>\n\n1.8.5.53 smtplib\n................\n\nA new *note SMTP.auth(): cb8. method provides a convenient way to\nimplement custom authentication mechanisms.  (Contributed by Milan",
            "subsections": []
        },
        "Oberkirch in bpo-15014(1).)": {
            "content": "The *note SMTP.setdebuglevel(): cb9. method now accepts an additional\ndebuglevel (2), which enables timestamps in debug messages.\n(Contributed by Gavin Chappell and Maciej Szulik in bpo-16914(2).)\n\nBoth the *note SMTP.sendmail(): cba. and *note SMTP.sendmessage(): cbb.\nmethods now support RFC 6531(3) (SMTPUTF8).  (Contributed by Milan",
            "subsections": []
        },
        "Oberkirch and R. David Murray in bpo-22027(4).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=15014\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=16914\n\n(3) https://datatracker.ietf.org/doc/html/rfc6531.html\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=22027\n\nFile: python3.12.info,  Node: sndhdr,  Next: socket<8>,  Prev: smtplib<2>,  Up: Improved Modules<8>\n\n1.8.5.54 sndhdr\n...............\n\nThe *note what(): cbd. and *note whathdr(): cbe. functions now return a\n*note namedtuple(): 711.  (Contributed by Claudiu Popa in bpo-18615(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=18615\n\nFile: python3.12.info,  Node: socket<8>,  Next: ssl<8>,  Prev: sndhdr,  Up: Improved Modules<8>\n\n1.8.5.55 socket\n...............\n",
            "subsections": []
        },
        "Functions with timeouts now use a monotonic clock, instead of a system": {
            "content": "clock.  (Contributed by Victor Stinner in bpo-22043(1).)\n\nA new *note socket.sendfile(): cc0. method allows sending a file over a\nsocket by using the high-performance *note os.sendfile(): 946. function\non UNIX, resulting in uploads being from 2 to 3 times faster than when\nusing plain *note socket.send(): c03.  (Contributed by Giampaolo Rodola'\nin bpo-17552(2).)\n\nThe *note socket.sendall(): c04. method no longer resets the socket\ntimeout every time bytes are received or sent.  The socket timeout is\nnow the maximum total duration to send all data.  (Contributed by Victor",
            "subsections": []
        },
        "Stinner in bpo-23853(3).)": {
            "content": "The 'backlog' argument of the *note socket.listen(): cc1. method is now\noptional.  By default it is set to *note SOMAXCONN: cc2. or to '128',\nwhichever is less.  (Contributed by Charles-Franc,ois Natali in\nbpo-21455(4).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=22043\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=17552\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=23853\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=21455\n\nFile: python3.12.info,  Node: ssl<8>,  Next: sqlite3<7>,  Prev: socket<8>,  Up: Improved Modules<8>\n\n1.8.5.56 ssl\n............\n\n* Menu:\n\n* Memory BIO Support::\n* Application-Layer Protocol Negotiation Support::\n* Other Changes::\n\nFile: python3.12.info,  Node: Memory BIO Support,  Next: Application-Layer Protocol Negotiation Support,  Up: ssl<8>\n\n1.8.5.57 Memory BIO Support\n...........................\n\n(Contributed by Geert Jansen in bpo-21965(1).)\n\nThe new *note SSLObject: 9c2. class has been added to provide SSL\nprotocol support for cases when the network I/O capabilities of *note\nSSLSocket: 703. are not necessary or are suboptimal.  'SSLObject'\nrepresents an SSL protocol instance, but does not implement any network\nI/O methods, and instead provides a memory buffer interface.  The new\n*note MemoryBIO: cc5. class can be used to pass data between Python and\nan SSL protocol instance.\n",
            "subsections": []
        },
        "The memory BIO SSL support is primarily intended to be used in": {
            "content": "frameworks implementing asynchronous I/O for which *note SSLSocket:\n703.'s readiness model (\"select/poll\") is inefficient.\n\nA new *note SSLContext.wrapbio(): 9c3. method can be used to create a\nnew 'SSLObject' instance.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=21965\n\nFile: python3.12.info,  Node: Application-Layer Protocol Negotiation Support,  Next: Other Changes,  Prev: Memory BIO Support,  Up: ssl<8>\n\n1.8.5.58 Application-Layer Protocol Negotiation Support\n.......................................................\n\n(Contributed by Benjamin Peterson in bpo-20188(1).)\n\nWhere OpenSSL support is present, the *note ssl: ca. module now\nimplements the 'Application-Layer Protocol Negotiation' TLS extension as\ndescribed in RFC 7301(2).\n\nThe new *note SSLContext.setalpnprotocols(): cc7. can be used to\nspecify which protocols a socket should advertise during the TLS\nhandshake.\n\nThe new *note SSLSocket.selectedalpnprotocol(): cc8. returns the\nprotocol that was selected during the TLS handshake.  The *note\nHASALPN: cc9. flag indicates whether ALPN support is present.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=20188\n\n(2) https://datatracker.ietf.org/doc/html/rfc7301.html\n\nFile: python3.12.info,  Node: Other Changes,  Prev: Application-Layer Protocol Negotiation Support,  Up: ssl<8>\n\n1.8.5.59 Other Changes\n......................\n\nThere is a new *note SSLSocket.version(): ccb. method to query the\nactual protocol version in use.  (Contributed by Antoine Pitrou in\nbpo-20421(1).)\n\nThe *note SSLSocket: 703. class now implements a 'SSLSocket.sendfile()'\nmethod.  (Contributed by Giampaolo Rodola' in bpo-17552(2).)\n\nThe 'SSLSocket.send()' method now raises either the *note\nssl.SSLWantReadError: ccc. or *note ssl.SSLWantWriteError: ccd.\nexception on a non-blocking socket if the operation would block.",
            "subsections": []
        },
        "Previously, it would return '0'.  (Contributed by Nikolaus Rath in": {
            "content": "bpo-20951(3).)\n\nThe *note certtimetoseconds(): cce. function now interprets the input\ntime as UTC and not as local time, per RFC 5280(4).  Additionally, the\nreturn value is always an *note int: 17e.  (Contributed by Akira Li in\nbpo-19940(5).)\n\nNew 'SSLObject.sharedciphers()' and *note SSLSocket.sharedciphers():\nccf. methods return the list of ciphers sent by the client during the\nhandshake.  (Contributed by Benjamin Peterson in bpo-23186(6).)\n\nThe *note SSLSocket.dohandshake(): cd0, *note SSLSocket.read(): cd1,\n'SSLSocket.shutdown()', and *note SSLSocket.write(): cd2. methods of the\n*note SSLSocket: 703. class no longer reset the socket timeout every\ntime bytes are received or sent.  The socket timeout is now the maximum\ntotal duration of the method.  (Contributed by Victor Stinner in\nbpo-23853(7).)\n\nThe 'matchhostname()' function now supports matching of IP addresses.\n(Contributed by Antoine Pitrou in bpo-23239(8).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=20421\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=17552\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=20951\n\n(4) https://datatracker.ietf.org/doc/html/rfc5280.html\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=19940\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=23186\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=23853\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=23239\n\nFile: python3.12.info,  Node: sqlite3<7>,  Next: subprocess<3>,  Prev: ssl<8>,  Up: Improved Modules<8>\n\n1.8.5.60 sqlite3\n................\n\nThe *note Row: cd4. class now fully supports the sequence protocol, in\nparticular *note reversed(): 661. iteration and slice indexing.\n(Contributed by Claudiu Popa in bpo-10203(1); by Lucas Sinclair, Jessica",
            "subsections": []
        },
        "McKellar, and Serhiy Storchaka in bpo-13583(2).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=10203\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=13583\n\nFile: python3.12.info,  Node: subprocess<3>,  Next: sys<9>,  Prev: sqlite3<7>,  Up: Improved Modules<8>\n\n1.8.5.61 subprocess\n...................\n\nThe new *note run(): 9c9. function has been added.  It runs the\nspecified command and returns a *note CompletedProcess: cd6. object,\nwhich describes a finished process.  The new API is more consistent and\nis the recommended approach to invoking subprocesses in Python code that\ndoes not need to maintain compatibility with earlier Python versions.\n(Contributed by Thomas Kluyver in bpo-23342(1).)\n\nExamples:\n\n>>> subprocess.run([\"ls\", \"-l\"])  # doesn't capture output\nCompletedProcess(args=['ls', '-l'], returncode=0)\n\n>>> subprocess.run(\"exit 1\", shell=True, check=True)\nTraceback (most recent call last):\n...\nsubprocess.CalledProcessError: Command 'exit 1' returned non-zero exit status 1\n\n>>> subprocess.run([\"ls\", \"-l\", \"/dev/null\"], stdout=subprocess.PIPE)\nCompletedProcess(args=['ls', '-l', '/dev/null'], returncode=0,\nstdout=b'crw-rw-rw- 1 root root 1, 3 Jan 23 16:23 /dev/null\\n')\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23342\n\nFile: python3.12.info,  Node: sys<9>,  Next: sysconfig<2>,  Prev: subprocess<3>,  Up: Improved Modules<8>\n\n1.8.5.62 sys\n............\n\nA new 'setcoroutinewrapper()' function allows setting a global hook\nthat will be called whenever a *note coroutine object: 1ae. is created\nby an *note async def: 394. function.  A corresponding\n'getcoroutinewrapper()' can be used to obtain a currently set wrapper.\nBoth functions are *note provisional: 93a, and are intended for\ndebugging purposes only.  (Contributed by Yury Selivanov in\nbpo-24017(1).)\n\nA new *note isfinalizing(): 8c0. function can be used to check if the\nPython interpreter is *note shutting down: cd8.  (Contributed by Antoine",
            "subsections": []
        },
        "Pitrou in bpo-22696(2).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24017\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=22696\n\nFile: python3.12.info,  Node: sysconfig<2>,  Next: tarfile<7>,  Prev: sys<9>,  Up: Improved Modules<8>\n\n1.8.5.63 sysconfig\n..................\n",
            "subsections": []
        },
        "The name of the user scripts directory on Windows now includes the first": {
            "content": "two components of the Python version.  (Contributed by Paul Moore in\nbpo-23437(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23437\n\nFile: python3.12.info,  Node: tarfile<7>,  Next: threading<6>,  Prev: sysconfig<2>,  Up: Improved Modules<8>\n\n1.8.5.64 tarfile\n................\n\nThe 'mode' argument of the *note open(): cdb. function now accepts '\"x\"'\nto request exclusive creation.  (Contributed by Berker Peksag in\nbpo-21717(1).)\n\nThe *note TarFile.extractall(): 356. and *note TarFile.extract(): 357.\nmethods now take a keyword argument 'numericowner'.  If set to 'True',\nthe extracted files and directories will be owned by the numeric 'uid'\nand 'gid' from the tarfile.  If set to 'False' (the default, and the\nbehavior in versions prior to 3.5), they will be owned by the named user\nand group in the tarfile.  (Contributed by Michael Vogt and Eric Smith\nin bpo-23193(2).)\n\nThe *note TarFile.list(): cdc. now accepts an optional 'members' keyword\nargument that can be set to a subset of the list returned by *note",
            "subsections": []
        },
        "TarFile.getmembers(): cdd.  (Contributed by Serhiy Storchaka in": {
            "content": "bpo-21549(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=21717\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=23193\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=21549\n\nFile: python3.12.info,  Node: threading<6>,  Next: time<6>,  Prev: tarfile<7>,  Up: Improved Modules<8>\n\n1.8.5.65 threading\n..................\n\nBoth the *note Lock.acquire(): 464. and *note RLock.acquire(): cdf.\nmethods now use a monotonic clock for timeout management.  (Contributed\nby Victor Stinner in bpo-22043(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=22043\n\nFile: python3.12.info,  Node: time<6>,  Next: timeit<2>,  Prev: threading<6>,  Up: Improved Modules<8>\n\n1.8.5.66 time\n.............\n\nThe *note monotonic(): ce1. function is now always available.\n(Contributed by Victor Stinner in bpo-22043(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=22043\n\nFile: python3.12.info,  Node: timeit<2>,  Next: tkinter<7>,  Prev: time<6>,  Up: Improved Modules<8>\n\n1.8.5.67 timeit\n...............\n\nA new command line option '-u' or '--unit=U' can be used to specify the\ntime unit for the timer output.  Supported options are 'usec', 'msec',\nor 'sec'.  (Contributed by Julian Gindi in bpo-18983(1).)\n\nThe *note timeit(): ce3. function has a new 'globals' parameter for\nspecifying the namespace in which the code will be running.\n(Contributed by Ben Roberts in bpo-2527(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=18983\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=2527\n\nFile: python3.12.info,  Node: tkinter<7>,  Next: traceback<4>,  Prev: timeit<2>,  Up: Improved Modules<8>\n\n1.8.5.68 tkinter\n................\n",
            "subsections": []
        },
        "The 'tkinter.fix' module used for setting up the Tcl/Tk environment on": {
            "content": "Windows has been replaced by a private function in the *note tkinter:\n3. module which makes no permanent changes to environment variables.\n(Contributed by Zachary Ware in bpo-20035(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=20035\n\nFile: python3.12.info,  Node: traceback<4>,  Next: types<4>,  Prev: tkinter<7>,  Up: Improved Modules<8>\n\n1.8.5.69 traceback\n..................\n\nNew *note walkstack(): ce6. and *note walktb(): ce7. functions to\nconveniently traverse frame and *note traceback objects: 92b.\n(Contributed by Robert Collins in bpo-17911(1).)\n\nNew lightweight classes: *note TracebackException: 471, *note\nStackSummary: ce8, and *note FrameSummary: ce9.  (Contributed by Robert",
            "subsections": []
        },
        "Collins in bpo-17911(2).)": {
            "content": "Both the *note printtb(): cea. and *note printstack(): ceb. functions\nnow support negative values for the 'limit' argument.  (Contributed by",
            "subsections": []
        },
        "Dmitry Kazakov in bpo-22619(3).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=17911\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=17911\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=22619\n\nFile: python3.12.info,  Node: types<4>,  Next: unicodedata<7>,  Prev: traceback<4>,  Up: Improved Modules<8>\n\n1.8.5.70 types\n..............\n\nA new *note coroutine(): ced. function to transform *note generator:\na22. and *note generator-like: c38. objects into *note awaitables: ac3.\n(Contributed by Yury Selivanov in bpo-24017(1).)\n\nA new type called *note CoroutineType: cee, which is used for *note\ncoroutine: 1ae. objects created by *note async def: 394. functions.\n(Contributed by Yury Selivanov in bpo-24400(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24017\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=24400\n\nFile: python3.12.info,  Node: unicodedata<7>,  Next: unittest<7>,  Prev: types<4>,  Up: Improved Modules<8>\n\n1.8.5.71 unicodedata\n....................\n\nThe *note unicodedata: 100. module now uses data from Unicode 8.0.0(1).\n\n---------- Footnotes ----------\n\n(1) https://unicode.org/versions/Unicode8.0.0/\n\nFile: python3.12.info,  Node: unittest<7>,  Next: unittest mock<3>,  Prev: unicodedata<7>,  Up: Improved Modules<8>\n\n1.8.5.72 unittest\n.................\n\nThe *note TestLoader.loadTestsFromModule(): 285. method now accepts a\nkeyword-only argument 'pattern' which is passed to 'loadtests' as the\nthird argument.  Found packages are now checked for 'loadtests'\nregardless of whether their path matches 'pattern', because it is\nimpossible for a package name to match the default pattern.\n(Contributed by Robert Collins and Barry A. Warsaw in bpo-16662(1).)\n\nUnittest discovery errors now are exposed in the *note\nTestLoader.errors: cf1. attribute of the *note TestLoader: 506.\ninstance.  (Contributed by Robert Collins in bpo-19746(2).)\n\nA new command line option '--locals' to show local variables in\ntracebacks.  (Contributed by Robert Collins in bpo-22936(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=16662\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=19746\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=22936\n\nFile: python3.12.info,  Node: unittest mock<3>,  Next: urllib,  Prev: unittest<7>,  Up: Improved Modules<8>\n\n1.8.5.73 unittest.mock\n......................\n\nThe *note Mock: 878. class has the following improvements:\n\n* The class constructor has a new 'unsafe' parameter, which causes\nmock objects to raise *note AttributeError: 395. on attribute names\nstarting with '\"assert\"'.  (Contributed by Kushal Das in\nbpo-21238(1).)\n\n* A new *note Mock.assertnotcalled(): cf3. method to check if the\nmock object was called.  (Contributed by Kushal Das in\nbpo-21262(2).)\n\nThe *note MagicMock: cf4. class now supports 'truediv()',\n'divmod()' and 'matmul()' operators.  (Contributed by Johannes\nBaiter in bpo-20968(3), and H??kan Lo\"vdahl in bpo-23581(4) and\nbpo-23568(5).)\n\nIt is no longer necessary to explicitly pass 'create=True' to the *note\npatch(): cf5. function when patching builtin names.  (Contributed by",
            "subsections": []
        },
        "Kushal Das in bpo-17660(6).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=21238\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=21262\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=20968\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=23581\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=23568\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=17660\n\nFile: python3.12.info,  Node: urllib,  Next: wsgiref,  Prev: unittest mock<3>,  Up: Improved Modules<8>\n\n1.8.5.74 urllib\n...............\n\nA new *note request.HTTPPasswordMgrWithPriorAuth: cf7. class allows HTTP",
            "subsections": []
        },
        "Basic Authentication credentials to be managed so as to eliminate": {
            "content": "unnecessary '401' response handling, or to unconditionally send\ncredentials on the first request in order to communicate with servers\nthat return a '404' response instead of a '401' if the 'Authorization'\nheader is not sent.  (Contributed by Matej Cepl in bpo-19494(1) and",
            "subsections": []
        },
        "Akshit Khurana in bpo-7159(2).)": {
            "content": "A new 'quotevia' argument for the *note parse.urlencode(): cf8.\nfunction provides a way to control the encoding of query parts if\nneeded.  (Contributed by Samwyse and Arnon Yaari in bpo-13866(3).)\n\nThe *note request.urlopen(): cf9. function accepts an *note\nssl.SSLContext: 278. object as a 'context' argument, which will be used\nfor the HTTPS connection.  (Contributed by Alex Gaynor in bpo-22366(4).)\n\nThe *note parse.urljoin(): cfa. was updated to use the RFC 3986(5)\nsemantics for the resolution of relative URLs, rather than RFC 1808(6)\nand RFC 2396(7).  (Contributed by Demian Brecht and Senthil Kumaran in\nbpo-22118(8).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=19494\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=7159\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=13866\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=22366\n\n(5) https://datatracker.ietf.org/doc/html/rfc3986.html\n\n(6) https://datatracker.ietf.org/doc/html/rfc1808.html\n\n(7) https://datatracker.ietf.org/doc/html/rfc2396.html\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=22118\n\nFile: python3.12.info,  Node: wsgiref,  Next: xmlrpc<2>,  Prev: urllib,  Up: Improved Modules<8>\n\n1.8.5.75 wsgiref\n................\n\nThe 'headers' argument of the *note headers.Headers: cfc. class\nconstructor is now optional.  (Contributed by Pablo Torres Navarrete and",
            "subsections": []
        },
        "SilentGhost in bpo-5800(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=5800\n\nFile: python3.12.info,  Node: xmlrpc<2>,  Next: xml sax,  Prev: wsgiref,  Up: Improved Modules<8>\n\n1.8.5.76 xmlrpc\n...............\n\nThe *note client.ServerProxy: 883. class now supports the *note context\nmanager: 398. protocol.  (Contributed by Claudiu Popa in bpo-20627(1).)\n\nThe *note client.ServerProxy: 883. constructor now accepts an optional\n*note ssl.SSLContext: 278. instance.  (Contributed by Alex Gaynor in\nbpo-22960(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=20627\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=22960\n\nFile: python3.12.info,  Node: xml sax,  Next: zipfile<4>,  Prev: xmlrpc<2>,  Up: Improved Modules<8>\n\n1.8.5.77 xml.sax\n................\n\nSAX parsers now support a character stream of the *note\nxmlreader.InputSource: cff. object.  (Contributed by Serhiy Storchaka in\nbpo-2175(1).)\n\n*note parseString(): d00. now accepts a *note str: 157. instance.\n(Contributed by Serhiy Storchaka in bpo-10590(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=2175\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=10590\n\nFile: python3.12.info,  Node: zipfile<4>,  Prev: xml sax,  Up: Improved Modules<8>\n\n1.8.5.78 zipfile\n................\n\nZIP output can now be written to unseekable streams.  (Contributed by",
            "subsections": []
        },
        "Serhiy Storchaka in bpo-23252(1).)": {
            "content": "The 'mode' argument of *note ZipFile.open(): b5c. method now accepts\n'\"x\"' to request exclusive creation.  (Contributed by Serhiy Storchaka\nin bpo-21717(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23252\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=21717\n\nFile: python3.12.info,  Node: Other module-level changes,  Next: Optimizations<8>,  Prev: Improved Modules<8>,  Up: What's New In Python 3 5\n\n\nMany functions in the *note mmap: 8b, *note ossaudiodev: 9e, *note\nsocket: c6, *note ssl: ca, and *note codecs: 19. modules now accept\nwritable *note bytes-like objects: b82.  (Contributed by Serhiy",
            "subsections": []
        },
        "Storchaka in bpo-23001(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23001\n\nFile: python3.12.info,  Node: Optimizations<8>,  Next: Build and C API Changes<3>,  Prev: Other module-level changes,  Up: What's New In Python 3 5\n\n\nThe *note os.walk(): 1c8. function has been sped up by 3 to 5 times on\nPOSIX systems, and by 7 to 20 times on Windows.  This was done using the\nnew *note os.scandir(): 88c. function, which exposes file information\nfrom the underlying 'readdir' or 'FindFirstFile'/'FindNextFile' system\ncalls.  (Contributed by Ben Hoyt with help from Victor Stinner in\nbpo-23605(1).)\n",
            "subsections": []
        },
        "Construction of 'bytes(int)' (filled by zero bytes) is faster and uses": {
            "content": "less memory for large objects.  'calloc()' is used instead of 'malloc()'\nto allocate memory for these objects.  (Contributed by Victor Stinner in\nbpo-21233(2).)\n\nSome operations on *note ipaddress: 7a. *note IPv4Network: 986. and\n*note IPv6Network: 985. have been massively sped up, such as *note\nsubnets(): d04, *note supernet(): d05, *note summarizeaddressrange():\nd06, *note collapseaddresses(): d07.  The speed up can range from 3 to\n15 times.  (Contributed by Antoine Pitrou, Michel Albert, and Markus in\nbpo-21486(3), bpo-21487(4), bpo-20826(5), bpo-23266(6).)\n\nPickling of *note ipaddress: 7a. objects was optimized to produce\nsignificantly smaller output.  (Contributed by Serhiy Storchaka in\nbpo-23133(7).)\n\nMany operations on *note io.BytesIO: d08. are now 50% to 100% faster.\n(Contributed by Serhiy Storchaka in bpo-15381(8) and David Wilson in\nbpo-22003(9).)\n\nThe *note marshal.dumps(): d09. function is now faster: 65-85% with\nversions 3 and 4, 20-25% with versions 0 to 2 on typical data, and up to\n5 times in best cases.  (Contributed by Serhiy Storchaka in\nbpo-20416(10) and bpo-23344(11).)\n",
            "subsections": []
        },
        "The UTF-32 encoder is now 3 to 7 times faster.  (Contributed by Serhiy": {
            "content": "",
            "subsections": []
        },
        "Storchaka in bpo-15027(12).)": {
            "content": "Regular expressions are now parsed up to 10% faster.  (Contributed by",
            "subsections": []
        },
        "Serhiy Storchaka in bpo-19380(13).)": {
            "content": "The *note json.dumps(): b9d. function was optimized to run with\n'ensureascii=False' as fast as with 'ensureascii=True'.  (Contributed\nby Naoki Inada in bpo-23206(14).)\n\nThe *note PyObjectIsInstance(): d0a. and *note PyObjectIsSubclass():\nd0b. functions have been sped up in the common case that the second\nargument has *note type: ba0. as its metaclass.  (Contributed Georg",
            "subsections": []
        },
        "Brandl by in bpo-22540(15).)": {
            "content": "Method caching was slightly improved, yielding up to 5% performance\nimprovement in some benchmarks.  (Contributed by Antoine Pitrou in\nbpo-22847(16).)\n\nObjects from the *note random: b3. module now use 50% less memory on\n64-bit builds.  (Contributed by Serhiy Storchaka in bpo-23488(17).)\n\nThe *note property(): 3f6. getter calls are up to 25% faster.\n(Contributed by Joe Jevnik in bpo-23910(18).)\n\nInstantiation of *note fractions.Fraction: 1a8. is now up to 30% faster.\n(Contributed by Stefan Behnel in bpo-22464(19).)\n\nString methods *note find(): d0c, *note rfind(): d0d, *note split():\nd0e, *note partition(): d0f. and the *note in: 250. string operator are\nnow significantly faster for searching 1-character substrings.\n(Contributed by Serhiy Storchaka in bpo-23573(20).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23605\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=21233\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=21486\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=21487\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=20826\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=23266\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=23133\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=15381\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=22003\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=20416\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=23344\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=15027\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=19380\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=23206\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=22540\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=22847\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=23488\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=23910\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=22464\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=23573\n\nFile: python3.12.info,  Node: Build and C API Changes<3>,  Next: Deprecated<10>,  Prev: Optimizations<8>,  Up: What's New In Python 3 5\n\n\nNew 'calloc' functions were added:\n\n* *note PyMemRawCalloc(): d11,\n\n* *note PyMemCalloc(): d12,\n\n* *note PyObjectCalloc(): d13.\n\n(Contributed by Victor Stinner in bpo-21233(1).)\n\nNew encoding/decoding helper functions:\n\n* *note PyDecodeLocale(): a0b. (replaced 'Pychar2wchar()'),\n\n* *note PyEncodeLocale(): a0c. (replaced 'Pywchar2char()').\n\n(Contributed by Victor Stinner in bpo-18395(2).)\n\nA new *note PyCodecNameReplaceErrors(): d14. function to replace the\nunicode encode error with '\\N{...}' escapes.  (Contributed by Serhiy",
            "subsections": []
        },
        "Storchaka in bpo-19676(3).)": {
            "content": "A new *note PyErrFormatV(): d15. function similar to *note",
            "subsections": []
        },
        "PyErrFormat(): d16, but accepts a 'valist' argument.  (Contributed by": {
            "content": "",
            "subsections": []
        },
        "Antoine Pitrou in bpo-18711(4).)": {
            "content": "A new 'PyExcRecursionError' exception.  (Contributed by Georg Brandl in\nbpo-19235(5).)\n\nNew *note PyModuleFromDefAndSpec(): d17, *note\nPyModuleFromDefAndSpec2(): d18, and *note PyModuleExecDef(): d19.\nfunctions introduced by PEP 489(6) - multi-phase extension module\ninitialization.  (Contributed by Petr Viktorin in bpo-24268(7).)\n\nNew *note PyNumberMatrixMultiply(): d1a. and *note",
            "subsections": []
        },
        "PyNumberInPlaceMatrixMultiply(): d1b. functions to perform matrix": {
            "content": "multiplication.  (Contributed by Benjamin Peterson in bpo-21176(8).  See\nalso PEP 465(9) for details.)\n\nThe *note PyTypeObject.tpfinalize: 8db. slot is now part of the stable\nABI.\n\nWindows builds now require Microsoft Visual C++ 14.0, which is available\nas part of Visual Studio 2015(10).\n",
            "subsections": []
        },
        "Extension modules now include a platform information tag in their": {
            "content": "filename on some platforms (the tag is optional, and CPython will import\nextensions without it, although if the tag is present and mismatched,\nthe extension won't be loaded):\n\n* On Linux, extension module filenames end with\n'.cpython-<major><minor>m-<architecture>-<os>.pyd':\n\n* '<major>' is the major number of the Python version; for\nPython 3.5 this is '3'.\n\n* '<minor>' is the minor number of the Python version; for\nPython 3.5 this is '5'.\n\n* '<architecture>' is the hardware architecture the extension\nmodule was built to run on.  It's most commonly either 'i386'\nfor 32-bit Intel platforms or 'x8664' for 64-bit Intel (and\nAMD) platforms.\n\n* '<os>' is always 'linux-gnu', except for extensions built to\ntalk to the 32-bit ABI on 64-bit platforms, in which case it\nis 'linux-gnu32' (and '<architecture>' will be 'x8664').\n\n* On Windows, extension module filenames end with\n'<debug>.cp<major><minor>-<platform>.pyd':\n\n* '<major>' is the major number of the Python version; for\nPython 3.5 this is '3'.\n\n* '<minor>' is the minor number of the Python version; for\nPython 3.5 this is '5'.\n\n* '<platform>' is the platform the extension module was built\nfor, either 'win32' for Win32, 'winamd64' for Win64,\n'winia64' for Windows Itanium 64, and 'winarm' for Windows\non ARM.\n\n* If built in debug mode, '<debug>' will be 'd', otherwise it\nwill be blank.\n\n* On OS X platforms, extension module filenames now end with\n'-darwin.so'.\n\n* On all other platforms, extension module filenames are the same as\nthey were with Python 3.4.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=21233\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=18395\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=19676\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=18711\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=19235\n\n(6) https://peps.python.org/pep-0489/\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=24268\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=21176\n\n(9) https://peps.python.org/pep-0465/\n\n(10)\nhttps://visualstudio.microsoft.com/en/vs/older-downloads/#visual-studio-2015-and-other-products\n\nFile: python3.12.info,  Node: Deprecated<10>,  Next: Removed<10>,  Prev: Build and C API Changes<3>,  Up: What's New In Python 3 5\n\n\n* Menu:\n\n* New Keywords: New Keywords<2>.\n* Deprecated Python Behavior: Deprecated Python Behavior<2>.\n* Unsupported Operating Systems::\n* Deprecated Python modules, functions and methods: Deprecated Python modules functions and methods<3>.\n\nFile: python3.12.info,  Node: New Keywords<2>,  Next: Deprecated Python Behavior<2>,  Up: Deprecated<10>\n\n1.8.9.1 New Keywords\n....................\n\n'async' and 'await' are not recommended to be used as variable, class,\nfunction or module names.  Introduced by PEP 492(1) in Python 3.5, they\nwill become proper keywords in Python 3.7.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0492/\n\nFile: python3.12.info,  Node: Deprecated Python Behavior<2>,  Next: Unsupported Operating Systems,  Prev: New Keywords<2>,  Up: Deprecated<10>\n\n1.8.9.2 Deprecated Python Behavior\n..................................\n\nRaising the *note StopIteration: a40. exception inside a generator will\nnow generate a silent *note PendingDeprecationWarning: 6e0, which will\nbecome a non-silent deprecation warning in Python 3.6 and will trigger a\n*note RuntimeError: 17a. in Python 3.7.  See *note PEP 479; Change\nStopIteration handling inside generators: b74. for details.\n\nFile: python3.12.info,  Node: Unsupported Operating Systems,  Next: Deprecated Python modules functions and methods<3>,  Prev: Deprecated Python Behavior<2>,  Up: Deprecated<10>\n\n1.8.9.3 Unsupported Operating Systems\n.....................................\n",
            "subsections": []
        },
        "Windows XP is no longer supported by Microsoft, thus, per PEP 11(1),": {
            "content": "CPython 3.5 is no longer officially supported on this OS.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0011/\n\nFile: python3.12.info,  Node: Deprecated Python modules functions and methods<3>,  Prev: Unsupported Operating Systems,  Up: Deprecated<10>\n\n1.8.9.4 Deprecated Python modules, functions and methods\n........................................................\n",
            "subsections": []
        },
        "The 'formatter' module has now graduated to full deprecation and is": {
            "content": "still slated for removal in Python 3.6.\n\nThe 'asyncio.async()' function is deprecated in favor of *note\nensurefuture(): ac1.\n",
            "subsections": []
        },
        "The 'smtpd' module has in the past always decoded the DATA portion of": {
            "content": "email messages using the 'utf-8' codec.  This can now be controlled by\nthe new 'decodedata' keyword to 'SMTPServer'.  The default value is\n'True', but this default is deprecated.  Specify the 'decodedata'\nkeyword with an appropriate value to avoid the deprecation warning.\n\nDirectly assigning values to the *note key: a47, *note value: a48. and\n*note codedvalue: a49. of *note http.cookies.Morsel: a4a. objects is\ndeprecated.  Use the *note set(): a4b. method instead.  In addition, the\nundocumented 'LegalChars' parameter of *note set(): a4b. is deprecated,\nand is now ignored.\n\nPassing a format string as keyword argument 'formatstring' to the *note\nformat(): a46. method of the *note string.Formatter: d21. class has been\ndeprecated.  (Contributed by Serhiy Storchaka in bpo-23671(1).)\n",
            "subsections": []
        },
        "The 'platform.dist()' and 'platform.linuxdistribution()' functions are": {
            "content": "now deprecated.  Linux distributions use too many different ways of\ndescribing themselves, so the functionality is left to a package.\n(Contributed by Vajrasky Kok and Berker Peksag in bpo-1322(2).)\n",
            "subsections": []
        },
        "The previously undocumented 'fromfunction' and 'frombuiltin' methods": {
            "content": "of *note inspect.Signature: 51e. are deprecated.  Use the new *note",
            "subsections": []
        },
        "Signature.fromcallable(): 51f. method instead.  (Contributed by Yury": {
            "content": "",
            "subsections": []
        },
        "Selivanov in bpo-24248(3).)": {
            "content": "",
            "subsections": []
        },
        "The 'inspect.getargspec()' function is deprecated and scheduled to be": {
            "content": "removed in Python 3.6.  (See bpo-20438(4) for details.)\n\nThe *note inspect: 78. *note getfullargspec(): 51d, *note getcallargs():\nd22, and 'formatargspec()' functions are deprecated in favor of the\n*note inspect.signature(): 51c. API. (Contributed by Yury Selivanov in\nbpo-20438(5).)\n\n*note getargvalues(): d23. and *note formatargvalues(): d24. functions\nwere inadvertently marked as deprecated with the release of Python\n3.5.0.\n\nUse of *note re.LOCALE: 9ac. flag with str patterns or *note re.ASCII:\n3f9. is now deprecated.  (Contributed by Serhiy Storchaka in\nbpo-22407(6).)\n\nUse of unrecognized special sequences consisting of ''\\'' and an ASCII\nletter in regular expression patterns and replacement patterns now\nraises a deprecation warning and will be forbidden in Python 3.6.\n(Contributed by Serhiy Storchaka in bpo-23622(7).)\n",
            "subsections": []
        },
        "The undocumented and unofficial 'useloadtests' default argument of the": {
            "content": "*note unittest.TestLoader.loadTestsFromModule(): 285. method now is\ndeprecated and ignored.  (Contributed by Robert Collins and Barry A.",
            "subsections": []
        },
        "Warsaw in bpo-16662(8).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23671\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=1322\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=24248\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=20438\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=20438\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=22407\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=23622\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=16662\n\nFile: python3.12.info,  Node: Removed<10>,  Next: Porting to Python 3 5,  Prev: Deprecated<10>,  Up: What's New In Python 3 5\n\n\n* Menu:\n\n* API and Feature Removals: API and Feature Removals<4>.\n\nFile: python3.12.info,  Node: API and Feature Removals<4>,  Up: Removed<10>\n\n1.8.10.1 API and Feature Removals\n.................................\n",
            "subsections": []
        },
        "The following obsolete and previously deprecated APIs and features have": {
            "content": "been removed:\n\n* The unmaintained 'Misc/TextMate' and 'Misc/vim' directories have\nbeen removed (see the devguide(1) for suggestions on what to use\ninstead).\n\n* The 'SO' makefile macro is removed (it was replaced by the\n'SHLIBSUFFIX' and 'EXTSUFFIX' macros) (bpo-16754(2)).\n\n* The 'PyThreadState.tickcounter' field has been removed; its value\nhas been meaningless since Python 3.2, when the \"new GIL\" was\nintroduced (bpo-19199(3)).\n\n* 'PyLoader' and 'PyPycLoader' have been removed from *note\nimportlib: 71.  (Contributed by Taras Lyapun in bpo-15641(4).)\n\n* The 'strict' argument to *note HTTPConnection: 97a. and *note\nHTTPSConnection: 97b. has been removed.  HTTP 0.9-style \"Simple\nResponses\" are no longer supported.\n\n* The deprecated *note urllib.request.Request: e4b. getter and setter\nmethods 'adddata', 'hasdata', 'getdata', 'gettype', 'gethost',\n'getselector', 'setproxy', 'getoriginreqhost', and\n'isunverifiable' have been removed (use direct attribute access\ninstead).\n\n* Support for loading the deprecated 'TYPEINT64' has been removed\nfrom *note marshal: 88.  (Contributed by Dan Riti in bpo-15480(5).)\n\n* *note inspect.Signature: 51e.: positional-only parameters are now\nrequired to have a valid name.\n\n* *note object.format(): 3ea. no longer accepts non-empty format\nstrings, it now raises a *note TypeError: 28e. instead.  Using a\nnon-empty string has been deprecated since Python 3.2.  This change\nhas been made to prevent a situation where previously working (but\nincorrect) code would start failing if an object gained a\nformat method, which means that your code may now raise a *note\nTypeError: 28e. if you are using an ''s'' format code with objects\nthat do not have a format method that handles it.  See\nbpo-7994(6) for background.\n\n* 'difflib.SequenceMatcher.isbjunk()' and\n'difflib.SequenceMatcher.isbpopular()' were deprecated in 3.2, and\nhave now been removed: use 'x in sm.bjunk' and 'x in sm.bpopular',\nwhere 'sm' is a *note SequenceMatcher: e8e. object (bpo-13248(7)).\n\n---------- Footnotes ----------\n\n(1) https://devguide.python.org\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=16754\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=19199\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=15641\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=15480\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=7994\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=13248\n\nFile: python3.12.info,  Node: Code Cleanups,  Prev: API and Feature Removals<5>,  Up: Removed<11>\n\n1.9.7.3 Code Cleanups\n.....................\n\n* The unused and undocumented internal 'Scanner' class has been\nremoved from the *note pydoc: b0. module.\n\n* The private and effectively unused 'gestalt' module has been\nremoved, along with the private *note platform: a5. functions\n'macverlookup', 'macvergstalt', and 'bcd2str', which would\nonly have ever been called on badly broken OSX systems (see\nbpo-18393(1)).\n\n* The hardcoded copies of certain *note stat: cb. constants that were\nincluded in the *note tarfile: d8. module namespace have been\nremoved.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=18393\n\nFile: python3.12.info,  Node: Porting to Python 3 4,  Next: Changed in 3 4 3,  Prev: Removed<11>,  Up: What's New In Python 3 4\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Notable changes in Python 3 5 4,  Prev: Porting to Python 3 5,  Up: What's New In Python 3 5": {
            "content": "* Menu:\n\n* New make regen-all build target: New make regen-all build target<2>.\n* Removal of make touch build target: Removal of make touch build target<2>.\n\nFile: python3.12.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\n\n1.8.12.1 New 'make regen-all' build target\n..........................................\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": [
                {
                    "name": "1.9 What's New In Python 3.4",
                    "content": "Author: R. David Murray <<rdmurray@bitdance.com>> (Editor)\n\nThis 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": {
            "content": "changelog(1).\n\nSee also\n........\n\nPEP 429(2) - Python 3.4 Release Schedule\n\n* Menu:\n\n* Summary - Release Highlights: Summary - Release Highlights<2>.\n* New Features: New Features<13>.\n* New Modules: New Modules<9>.\n* Improved Modules: Improved Modules<9>.\n* CPython Implementation Changes::\n* Deprecated: Deprecated<11>.\n* Removed: Removed<11>.\n* Porting to Python 3.4: Porting to Python 3 4.\n* Changed in 3.4.3: Changed in 3 4 3.\n\n---------- Footnotes ----------\n\n(1) https://docs.python.org/3.4/whatsnew/changelog.html\n\n(2) https://peps.python.org/pep-0429/\n\nFile: python3.12.info,  Node: Summary - Release Highlights<2>,  Next: New Features<13>,  Up: What's New In Python 3 4\n\n\nNew syntax features:\n\n* No new syntax features were added in Python 3.4.\n\nOther new features:\n\n* *note pip should always be available: d3c. ( PEP 453(1)).\n\n* *note Newly created file descriptors are non-inheritable: d3d. (\nPEP 446(2)).\n\n* command line option for *note isolated mode: d3e. (bpo-16499(3)).\n\n* *note improvements in the handling of codecs: d3f. that are not\ntext encodings (multiple issues).\n\n* *note A ModuleSpec Type: d40. for the Import System ( PEP 451(4)).\n(Affects importer authors.)\n\n* The *note marshal: 88. format has been made *note more compact and\nefficient: d41. (bpo-16475(5)).\n\nNew library modules:\n\n* *note asyncio: 9.: *note New provisional API for asynchronous IO:\nd42. ( PEP 3156(6)).\n\n* *note ensurepip: 50.: *note Bootstrapping the pip installer: d43. (\nPEP 453(7)).\n\n* *note enum: 51.: *note Support for enumeration types: d44. ( PEP\n435(8)).\n\n* *note pathlib: 9f.: *note Object-oriented filesystem paths: d45. (\nPEP 428(9)).\n\n* *note selectors: bd.: *note High-level and efficient I/O\nmultiplexing: d46, built upon the *note select: bc. module\nprimitives (part of PEP 3156(10)).\n\n* *note statistics: cc.: A basic *note numerically stable statistics\nlibrary: d47. ( PEP 450(11)).\n\n* *note tracemalloc: fa.: *note Trace Python memory allocations: d48.\n( PEP 454(12)).\n\nSignificantly improved library modules:\n\n* *note Single-dispatch generic functions: d49. in *note functools:\n5a. ( PEP 443(13)).\n\n* New *note pickle: a1. *note protocol 4: d4a. ( PEP 3154(14)).\n\n* *note multiprocessing: 8f. now has *note an option to avoid using\nos.fork on Unix: d4b. (bpo-8713(15)).\n\n* *note email: 37. has a new submodule, *note contentmanager: 39, and\na new *note Message: ae7. subclass ('EmailMessage') that *note\nsimplify MIME handling: d4c. (bpo-18891(16)).\n\n* The *note inspect: 78. and *note pydoc: b0. modules are now capable\nof correct introspection of a much wider variety of callable\nobjects, which improves the output of the Python *note help(): 6f0.\nsystem.\n\n* The *note ipaddress: 7a. module API has been declared stable\n\nSecurity improvements:\n\n* *note Secure and interchangeable hash algorithm: d4d. ( PEP\n456(17)).\n\n* *note Make newly created file descriptors non-inheritable: d3d. (\nPEP 446(18)) to avoid leaking file descriptors to child processes.\n\n* New command line option for *note isolated mode: d3e,\n(bpo-16499(19)).\n\n* *note multiprocessing: 8f. now has *note an option to avoid using\nos.fork on Unix: d4b.  'spawn' and 'forkserver' are more secure\nbecause they avoid sharing data with child processes.\n\n* *note multiprocessing: 8f. child processes on Windows no longer\ninherit all of the parent's inheritable handles, only the necessary\nones.\n\n* A new *note hashlib.pbkdf2hmac(): 261. function provides the\nPKCS#5 password-based key derivation function 2(20).\n\n* *note TLSv1.1 and TLSv1.2 support: d4e. for *note ssl: ca.\n\n* *note Retrieving certificates from the Windows system cert store\nsupport: d4f. for *note ssl: ca.\n\n* *note Server-side SNI (Server Name Indication) support: d50. for\n*note ssl: ca.\n\n* The *note ssl.SSLContext: 278. class has a *note lot of\nimprovements: d51.\n\n* All modules in the standard library that support SSL now support\nserver certificate verification, including hostname matching\n('ssl.matchhostname()') and CRLs (Certificate Revocation lists,\nsee *note ssl.SSLContext.loadverifylocations(): d52.).\n\nCPython implementation improvements:\n\n* *note Safe object finalization: d53. ( PEP 442(21)).\n\n* Leveraging PEP 442(22), in most cases *note module globals are no\nlonger set to None during finalization: d53. (bpo-18214(23)).\n\n* *note Configurable memory allocators: d54. ( PEP 445(24)).\n\n* *note Argument Clinic: d55. ( PEP 436(25)).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Bootstrapping pip By Default,  Next: Documentation Changes,  Up: PEP 453 Explicit Bootstrapping of PIP in Python Installations": {
            "content": "1.9.2.2 Bootstrapping pip By Default\n....................................\n\nThe new *note ensurepip: 50. module (defined in PEP 453(1)) provides a\nstandard cross-platform mechanism to bootstrap the pip installer into",
            "subsections": []
        },
        "Python installations and virtual environments.  The version of 'pip'": {
            "content": "included with Python 3.4.0 is 'pip' 1.5.4, and future 3.4.x maintenance\nreleases will update the bundled version to the latest version of 'pip'\nthat is available at the time of creating the release candidate.\n",
            "subsections": []
        },
        "By default, the commands 'pipX' and 'pipX.Y' will be installed on all": {
            "content": "platforms (where X.Y stands for the version of the Python installation),\nalong with the 'pip' Python package and its dependencies.  On Windows\nand in virtual environments on all platforms, the unversioned 'pip'\ncommand will also be installed.  On other platforms, the system wide\nunversioned 'pip' command typically refers to the separately installed\nPython 2 version.\n\nThe 'pyvenv' command line utility and the *note venv: 10c. module make\nuse of the *note ensurepip: 50. module to make 'pip' readily available\nin virtual environments.  When using the command line utility, 'pip' is\ninstalled by default, while when using the *note venv: 10c. module *note\nAPI: d59. installation of 'pip' must be requested explicitly.\n\nFor CPython *note source builds on POSIX systems: d5a, the 'make\ninstall' and 'make altinstall' commands bootstrap 'pip' by default.",
            "subsections": []
        },
        "This behaviour can be controlled through configure options, and": {
            "content": "overridden through Makefile options.\n",
            "subsections": []
        },
        "On Windows and Mac OS X, the CPython installers now default to": {
            "content": "installing 'pip' along with CPython itself (users may opt out of\ninstalling it during the installation process).  Window users will need\nto opt in to the automatic 'PATH' modifications to have 'pip' available\nfrom the command line by default, otherwise it can still be accessed\nthrough the Python launcher for Windows as 'py -m pip'.\n",
            "subsections": []
        },
        "As discussed in the PEP(2), platform packagers may choose not to install": {
            "content": "these commands by default, as long as, when invoked, they provide clear\nand simple directions on how to install them on that platform (usually\nusing the system package manager).\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0453/\n\n(2)\nhttps://peps.python.org/pep-0477/#disabling-ensurepip-by-downstream-distributors\n\nFile: python3.12.info,  Node: Documentation Changes<2>,  Prev: Bootstrapping pip By Default<2>,  Up: PEP 477 Backport ensurepip PEP 453 to Python 2 7\n\n1.14.15.6 Documentation Changes\n...............................\n\nAs part of this change, the *note Installing Python Modules: d5c. and\ndistributing-index sections of the documentation have been completely\nredesigned as short getting started and FAQ documents.  Most packaging\ndocumentation has now been moved out to the Python Packaging Authority\nmaintained Python Packaging User Guide(1) and the documentation of the\nindividual projects.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Documentation Changes,  Prev: Bootstrapping pip By Default,  Up: PEP 453 Explicit Bootstrapping of PIP in Python Installations": {
            "content": "1.9.2.3 Documentation Changes\n.............................\n\nAs part of this change, the *note Installing Python Modules: d5c. and\ndistributing-index sections of the documentation have been completely\nredesigned as short getting started and FAQ documents.  Most packaging\ndocumentation has now been moved out to the Python Packaging Authority\nmaintained Python Packaging User Guide(1) and the documentation of the\nindividual projects.\n",
            "subsections": []
        },
        "However, as this migration is currently still incomplete, the legacy": {
            "content": "versions of those guides remaining available as *note Building C and C++\nExtensions with setuptools: d5d. and *note Building C and C++ Extensions\nwith setuptools: d5e.\n\nSee also\n........\n\nPEP 453(2) - Explicit bootstrapping of pip in Python installations\n\nPEP written by Donald Stufft and Nick Coghlan, implemented by\nDonald Stufft, Nick Coghlan, Martin von Lo\"wis and Ned Deily.\n\n---------- Footnotes ----------\n\n(1) https://packaging.python.org\n\n(2) https://peps.python.org/pep-0453/\n\nFile: python3.12.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\n\n1.14.15.7 PEP 476: Enabling certificate verification by default for stdlib http clients\n.......................................................................................\n\nPEP 476(1) updated *note httplib: 69. and modules which use it, such as\n*note urllib2: 106. and *note xmlrpclib: 128, to now verify that the\nserver presents a certificate which is signed by a Certificate Authority\nin the platform trust store and whose hostname matches the hostname\nbeing requested by default, significantly improving security for many\napplications.  This change was made in the Python 2.7.9 release.\n",
            "subsections": []
        },
        "However, there are occasions when inheritance is desired.  To support": {
            "content": "these cases, the following new functions and methods are available:\n\n* *note os.getinheritable(): d61, *note os.setinheritable(): d62.\n\n* *note os.gethandleinheritable(): d63, *note\nos.sethandleinheritable(): d64.\n\n* *note socket.socket.getinheritable(): d65, *note\nsocket.socket.setinheritable(): d66.\n\nSee also\n........\n\nPEP 446(2) - Make newly created file descriptors non-inheritable\n\nPEP written and implemented by Victor Stinner.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0446/\n\n(2) https://peps.python.org/pep-0446/\n\nFile: python3.12.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<13>\n\n1.9.2.5 Improvements to Codec Handling\n......................................\n\nSince it was first introduced, the *note codecs: 19. module has always\nbeen intended to operate as a type-neutral dynamic encoding and decoding\nsystem.  However, its close coupling with the Python text model,\nespecially the type restricted convenience methods on the builtin *note\nstr: 157, *note bytes: 295. and *note bytearray: 294. types, has\nhistorically obscured that fact.\n\nAs a key step in clarifying the situation, the *note codecs.encode():\nd68. and *note codecs.decode(): d69. convenience functions are now\nproperly documented in Python 2.7, 3.3 and 3.4.  These functions have\nexisted in the *note codecs: 19. module (and have been covered by the\nregression test suite) since Python 2.4, but were previously only\ndiscoverable through runtime introspection.\n\nUnlike the convenience methods on *note str: 157, *note bytes: 295. and\n*note bytearray: 294, the *note codecs: 19. convenience functions\nsupport arbitrary codecs in both Python 2 and Python 3, rather than\nbeing limited to Unicode text encodings (in Python 3) or 'basestring'\n<-> 'basestring' conversions (in Python 2).\n",
            "subsections": []
        },
        "In Python 3.4, the interpreter is able to identify the known non-text": {
            "content": "encodings provided in the standard library and direct users towards\nthese general purpose convenience functions when appropriate:\n\n>>> b\"abcdef\".decode(\"hex\")\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nLookupError: 'hex' is not a text encoding; use codecs.decode() to handle arbitrary codecs\n\n>>> \"hello\".encode(\"rot13\")\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nLookupError: 'rot13' is not a text encoding; use codecs.encode() to handle arbitrary codecs\n\n>>> open(\"foo.txt\", encoding=\"hex\")\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nLookupError: 'hex' is not a text encoding; use codecs.open() to handle arbitrary codecs\n",
            "subsections": []
        },
        "In a related change, whenever it is feasible without breaking backwards": {
            "content": "compatibility, exceptions raised during encoding and decoding operations\nare wrapped in a chained exception of the same type that mentions the\nname of the codec responsible for producing the error:\n\n>>> import codecs\n\n>>> codecs.decode(b\"abcdefgh\", \"hex\")\nTraceback (most recent call last):\nFile \"/usr/lib/python3.4/encodings/hexcodec.py\", line 20, in hexdecode\nreturn (binascii.a2bhex(input), len(input))\nbinascii.Error: Non-hexadecimal digit found\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nbinascii.Error: decoding with 'hex' codec failed (Error: Non-hexadecimal digit found)\n\n>>> codecs.encode(\"hello\", \"bz2\")\nTraceback (most recent call last):\nFile \"/usr/lib/python3.4/encodings/bz2codec.py\", line 17, in bz2encode\nreturn (bz2.compress(input), len(input))\nFile \"/usr/lib/python3.4/bz2.py\", line 498, in compress\nreturn comp.compress(data) + comp.flush()\nTypeError: 'str' does not support the buffer interface\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nTypeError: encoding with 'bz2' codec failed (TypeError: 'str' does not support the buffer interface)\n",
            "subsections": []
        },
        "Finally, as the examples above show, these improvements have permitted": {
            "content": "the restoration of the convenience aliases for the non-Unicode codecs\nthat were themselves restored in Python 3.2.  This means that encoding\nbinary data to and from its hexadecimal representation (for example) can\nnow be written as:\n\n>>> from codecs import encode, decode\n>>> encode(b\"hello\", \"hex\")\nb'68656c6c6f'\n>>> decode(b\"68656c6c6f\", \"hex\")\nb'hello'\n",
            "subsections": []
        },
        "The binary and text transforms provided in the standard library are": {
            "content": "detailed in *note Binary Transforms: d6a. and *note Text Transforms:\nd6b.\n\n(Contributed by Nick Coghlan in bpo-7475(1), bpo-17827(2), bpo-17828(3)\nand bpo-19619(4).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=7475\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=17827\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=17828\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=19619\n\nFile: python3.12.info,  Node: PEP 451 A ModuleSpec Type for the Import System,  Next: Other Language Changes<9>,  Prev: Improvements to Codec Handling,  Up: New Features<13>\n\n1.9.2.6 PEP 451: A ModuleSpec Type for the Import System\n........................................................\n\nPEP 451(1) provides an encapsulation of the information about a module\nthat the import machinery will use to load it (that is, a module\nspecification).  This helps simplify both the import implementation and\nseveral import-related APIs.  The change is also a stepping stone for\nseveral future import-related improvements(2).\n\nThe public-facing changes from the PEP are entirely backward-compatible.",
            "subsections": []
        },
        "Furthermore, they should be transparent to everyone but importer": {
            "content": "authors.  Key finder and loader methods have been deprecated, but they\nwill continue working.  New importers should use the new methods\ndescribed in the PEP. Existing importers should be updated to implement\nthe new methods.  See the *note Deprecated: d6d. section for a list of\nmethods that should be replaced and their replacements.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0451/\n\n(2)\nhttps://mail.python.org/pipermail/python-dev/2013-November/130111.html\n\nFile: python3.12.info,  Node: Other Language Changes<9>,  Prev: PEP 451 A ModuleSpec Type for the Import System,  Up: New Features<13>\n\n1.9.2.7 Other Language Changes\n..............................\n\nSome smaller changes made to the core Python language are:\n\n* Unicode database updated to UCD version 6.3.\n\n* *note min(): d6f. and *note max(): d70. now accept a 'default'\nkeyword-only argument that can be used to specify the value they\nreturn if the iterable they are evaluating has no elements.\n(Contributed by Julian Berman in bpo-18111(1).)\n\n* Module objects are now *note weakly referenceable: d71.\n\n* Module 'file' attributes (and related values) should now always\ncontain absolute paths by default, with the sole exception of\n'main.file' when a script has been executed directly using\na relative path.  (Contributed by Brett Cannon in bpo-18416(2).)\n\n* All the UTF-* codecs (except UTF-7) now reject surrogates during\nboth encoding and decoding unless the 'surrogatepass' error handler\nis used, with the exception of the UTF-16 decoder (which accepts\nvalid surrogate pairs) and the UTF-16 encoder (which produces them\nwhile encoding non-BMP characters).  (Contributed by Victor\nStinner, Kang-Hao (Kenny) Lu and Serhiy Storchaka in bpo-12892(3).)\n\n* New German EBCDIC *note codec: c15. 'cp273'.  (Contributed by\nMichael Bierenfeld and Andrew Kuchling in bpo-1097797(4).)\n\n* New Ukrainian *note codec: c15. 'cp1125'.  (Contributed by Serhiy\nStorchaka in bpo-19668(5).)\n\n* *note bytes: 295.join() and *note bytearray: 294.join() now accept\narbitrary buffer objects as arguments.  (Contributed by Antoine\nPitrou in bpo-15958(6).)\n\n* The *note int: 17e. constructor now accepts any object that has an\n'index' method for its 'base' argument.  (Contributed by Mark\nDickinson in bpo-16772(7).)\n\n* Frame objects now have a *note clear(): d72. method that clears all\nreferences to local variables from the frame.  (Contributed by\nAntoine Pitrou in bpo-17934(8).)\n\n* *note memoryview: 17f. is now registered as a *note Sequence: 1c,\nand supports the *note reversed(): 661. builtin.  (Contributed by\nNick Coghlan and Claudiu Popa in bpo-18690(9) and bpo-19078(10).)\n\n* Signatures reported by *note help(): 6f0. have been modified and\nimproved in several cases as a result of the introduction of\nArgument Clinic and other changes to the *note inspect: 78. and\n*note pydoc: b0. modules.\n\n* *note lengthhint(): d73. is now part of the formal language\nspecification (see PEP 424(11)).  (Contributed by Armin Ronacher in\nbpo-16148(12).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=18111\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=18416\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=12892\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=1097797\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=19668\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=15958\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=16772\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=17934\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=18690\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=19078\n\n(11) https://peps.python.org/pep-0424/\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=16148\n\nFile: python3.12.info,  Node: New Modules<9>,  Next: Improved Modules<9>,  Prev: New Features<13>,  Up: What's New In Python 3 4\n\n\n* Menu:\n\n* asyncio: asyncio<10>.\n* ensurepip: ensurepip<2>.\n* enum: enum<8>.\n* pathlib: pathlib<9>.\n* selectors: selectors<2>.\n* statistics: statistics<5>.\n* tracemalloc: tracemalloc<4>.\n\nFile: python3.12.info,  Node: asyncio<10>,  Next: ensurepip<2>,  Up: New Modules<9>\n\n1.9.3.1 asyncio\n...............\n\nThe new *note asyncio: 9. module (defined in PEP 3156(1)) provides a\nstandard pluggable event loop model for Python, providing solid\nasynchronous IO support in the standard library, and making it easier\nfor other event loop implementations to interoperate with the standard\nlibrary and each other.\n\nFor Python 3.4, this module is considered a *note provisional API: 93a.\n\nSee also\n........\n\nPEP 3156(2) - Asynchronous IO Support Rebooted: the \"asyncio\" Module\n\nPEP written and implementation led by Guido van Rossum.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3156/\n\n(2) https://peps.python.org/pep-3156/\n\nFile: python3.12.info,  Node: ensurepip<2>,  Next: enum<8>,  Prev: asyncio<10>,  Up: New Modules<9>\n\n1.9.3.2 ensurepip\n.................\n\nThe new *note ensurepip: 50. module is the primary infrastructure for\nthe PEP 453(1) implementation.  In the normal course of events end users\nwill not need to interact with this module, but it can be used to\nmanually bootstrap 'pip' if the automated bootstrapping into an\ninstallation or virtual environment was declined.\n\n*note ensurepip: 50. includes a bundled copy of 'pip', up-to-date as of\nthe first release candidate of the release of CPython with which it\nships (this applies to both maintenance releases and feature releases).\n'ensurepip' does not access the internet.  If the installation has\ninternet access, after 'ensurepip' is run the bundled 'pip' can be used\nto upgrade 'pip' to a more recent release than the bundled one.  (Note\nthat such an upgraded version of 'pip' is considered to be a separately\ninstalled package and will not be removed if Python is uninstalled.)\n",
            "subsections": []
        },
        "The module is named 'ensure'pip because if called when 'pip' is already": {
            "content": "installed, it does nothing.  It also has an '--upgrade' option that will\ncause it to install the bundled copy of 'pip' if the existing installed\nversion of 'pip' is older than the bundled copy.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0453/\n\nFile: python3.12.info,  Node: enum<8>,  Next: pathlib<9>,  Prev: ensurepip<2>,  Up: New Modules<9>\n\n1.9.3.3 enum\n............\n\nThe new *note enum: 51. module (defined in PEP 435(1)) provides a\nstandard implementation of enumeration types, allowing other modules\n(such as *note socket: c6.) to provide more informative error messages\nand better debugging support by replacing opaque integer constants with\nbackwards compatible enumeration values.\n\nSee also\n........\n\nPEP 435(2) - Adding an Enum type to the Python standard library\n\nPEP written by Barry Warsaw, Eli Bendersky and Ethan Furman,\nimplemented by Ethan Furman.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0435/\n\n(2) https://peps.python.org/pep-0435/\n\nFile: python3.12.info,  Node: pathlib<9>,  Next: selectors<2>,  Prev: enum<8>,  Up: New Modules<9>\n\n1.9.3.4 pathlib\n...............\n\nThe new *note pathlib: 9f. module offers classes representing filesystem\npaths with semantics appropriate for different operating systems.  Path\nclasses are divided between 'pure paths', which provide purely\ncomputational operations without I/O, and 'concrete paths', which\ninherit from pure paths but also provide I/O operations.\n\nFor Python 3.4, this module is considered a *note provisional API: 93a.\n\nSee also\n........\n\nPEP 428(1) - The pathlib module - object-oriented filesystem paths\n\nPEP written and implemented by Antoine Pitrou.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0428/\n\nFile: python3.12.info,  Node: selectors<2>,  Next: statistics<5>,  Prev: pathlib<9>,  Up: New Modules<9>\n\n1.9.3.5 selectors\n.................\n\nThe new *note selectors: bd. module (created as part of implementing PEP\n3156(1)) allows high-level and efficient I/O multiplexing, built upon\nthe *note select: bc. module primitives.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3156/\n\nFile: python3.12.info,  Node: statistics<5>,  Next: tracemalloc<4>,  Prev: selectors<2>,  Up: New Modules<9>\n\n1.9.3.6 statistics\n..................\n\nThe new *note statistics: cc. module (defined in PEP 450(1)) offers some\ncore statistics functionality directly in the standard library.  This\nmodule supports calculation of the mean, median, mode, variance and\nstandard deviation of a data series.\n\nSee also\n........\n\nPEP 450(2) - Adding A Statistics Module To The Standard Library\n\nPEP written and implemented by Steven D'Aprano\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0450/\n\n(2) https://peps.python.org/pep-0450/\n\nFile: python3.12.info,  Node: tracemalloc<4>,  Prev: statistics<5>,  Up: New Modules<9>\n\n1.9.3.7 tracemalloc\n...................\n\nThe new *note tracemalloc: fa. module (defined in PEP 454(1)) is a debug\ntool to trace memory blocks allocated by Python.  It provides the\nfollowing information:\n\n* Trace where an object was allocated\n\n* Statistics on allocated memory blocks per filename and per line\nnumber: total size, number and average size of allocated memory\nblocks\n\n* Compute the differences between two snapshots to detect memory\nleaks\n\nSee also\n........\n\nPEP 454(2) - Add a new tracemalloc module to trace Python memory allocations\n\nPEP written and implemented by Victor Stinner\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0454/\n\n(2) https://peps.python.org/pep-0454/\n\nFile: python3.12.info,  Node: Improved Modules<9>,  Next: CPython Implementation Changes,  Prev: New Modules<9>,  Up: What's New In Python 3 4\n\n\n* Menu:\n\n* abc::\n* aifc: aifc<2>.\n* argparse: argparse<4>.\n* audioop::\n* base64: base64<2>.\n* collections: collections<6>.\n* colorsys::\n* contextlib: contextlib<6>.\n* dbm: dbm<5>.\n* dis: dis<3>.\n* doctest: doctest<3>.\n* email: email<3>.\n* filecmp::\n* functools: functools<5>.\n* gc: gc<5>.\n* glob: glob<3>.\n* hashlib: hashlib<6>.\n* hmac: hmac<3>.\n* html::\n* http: http<3>.\n* idlelib and IDLE: idlelib and IDLE<4>.\n* importlib: importlib<8>.\n* inspect: inspect<8>.\n* ipaddress: ipaddress<4>.\n* logging: logging<6>.\n* marshal::\n* mmap: mmap<2>.\n* multiprocessing: multiprocessing<6>.\n* operator: operator<3>.\n* os: os<10>.\n* pdb: pdb<5>.\n* pickle: pickle<4>.\n* plistlib: plistlib<2>.\n* poplib: poplib<3>.\n* pprint: pprint<4>.\n* pty::\n* pydoc: pydoc<4>.\n* re: re<6>.\n* resource::\n* select::\n* shelve: shelve<2>.\n* shutil: shutil<5>.\n* smtpd: smtpd<3>.\n* smtplib: smtplib<3>.\n* socket: socket<9>.\n* sqlite3: sqlite3<8>.\n* ssl: ssl<9>.\n* stat::\n* struct: struct<2>.\n* subprocess: subprocess<4>.\n* sunau: sunau<2>.\n* sys: sys<10>.\n* tarfile: tarfile<8>.\n* textwrap::\n* threading: threading<7>.\n* traceback: traceback<5>.\n* types: types<5>.\n* urllib: urllib<2>.\n* unittest: unittest<8>.\n* venv: venv<6>.\n* wave: wave<2>.\n* weakref: weakref<2>.\n* xml.etree: xml etree<2>.\n* zipfile: zipfile<5>.\n\nFile: python3.12.info,  Node: abc,  Next: aifc<2>,  Up: Improved Modules<9>\n\n1.9.4.1 abc\n...........\n\nNew function *note abc.getcachetoken(): d7e. can be used to know when\nto invalidate caches that are affected by changes in the object graph.\n(Contributed by ??ukasz Langa in bpo-16832(1).)\n\nNew class *note ABC: d7f. has *note ABCMeta: d80. as its meta class.",
            "subsections": []
        },
        "Using 'ABC' as a base class has essentially the same effect as": {
            "content": "specifying 'metaclass=abc.ABCMeta', but is simpler to type and easier to\nread.  (Contributed by Bruno Dupuis in bpo-16049(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=16832\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=16049\n\nFile: python3.12.info,  Node: aifc<2>,  Next: argparse<4>,  Prev: abc,  Up: Improved Modules<9>\n\n1.9.4.2 aifc\n............\n\nThe *note getparams(): d82. method now returns a namedtuple rather than\na plain tuple.  (Contributed by Claudiu Popa in bpo-17818(1).)\n\n*note aifc.open(): a25. now supports the context management protocol:\nwhen used in a *note with: 396. block, the *note close(): d83. method of\nthe returned object will be called automatically at the end of the\nblock.  (Contributed by Serhiy Storchacha in bpo-16486(2).)\n\nThe *note writeframesraw(): d84. and *note writeframes(): d85. methods\nnow accept any *note bytes-like object: b82.  (Contributed by Serhiy",
            "subsections": []
        },
        "Storchaka in bpo-8311(3).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=17818\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=16486\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=8311\n\nFile: python3.12.info,  Node: argparse<4>,  Next: audioop,  Prev: aifc<2>,  Up: Improved Modules<9>\n\n1.9.4.3 argparse\n................\n\nThe *note FileType: d87. class now accepts 'encoding' and 'errors'\narguments, which are passed through to *note open(): 26e.  (Contributed\nby Lucas Maystre in bpo-11175(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=11175\n\nFile: python3.12.info,  Node: audioop,  Next: base64<2>,  Prev: argparse<4>,  Up: Improved Modules<9>\n\n1.9.4.4 audioop\n...............\n\n*note audioop: b. now supports 24-bit samples.  (Contributed by Serhiy",
            "subsections": []
        },
        "Storchaka in bpo-12866(1).)": {
            "content": "New *note byteswap(): d89. function converts big-endian samples to\nlittle-endian and vice versa.  (Contributed by Serhiy Storchaka in\nbpo-19641(2).)\n\nAll *note audioop: b. functions now accept any *note bytes-like object:\nb82.  Strings are not accepted: they didn't work before, now they raise\nan error right away.  (Contributed by Serhiy Storchaka in bpo-16685(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=12866\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=19641\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=16685\n\nFile: python3.12.info,  Node: base64<2>,  Next: collections<6>,  Prev: audioop,  Up: Improved Modules<9>\n\n1.9.4.5 base64\n..............\n\nThe encoding and decoding functions in *note base64: c. now accept any\n*note bytes-like object: b82. in cases where it previously required a\n*note bytes: 295. or *note bytearray: 294. instance.  (Contributed by",
            "subsections": []
        },
        "Nick Coghlan in bpo-17839(1).)": {
            "content": "New functions *note a85encode(): d8b, *note a85decode(): d8c, *note\nb85encode(): d8d, and *note b85decode(): d8e. provide the ability to\nencode and decode binary data from and to 'Ascii85' and the\ngit/mercurial 'Base85' formats, respectively.  The 'a85' functions have\noptions that can be used to make them compatible with the variants of\nthe 'Ascii85' encoding, including the Adobe variant.  (Contributed by",
            "subsections": []
        },
        "Martin Morrison, the Mercurial project, Serhiy Storchaka, and Antoine": {
            "content": "",
            "subsections": []
        },
        "Pitrou in bpo-17618(2).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=17839\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=17618\n\nFile: python3.12.info,  Node: collections<6>,  Next: colorsys,  Prev: base64<2>,  Up: Improved Modules<9>\n\n1.9.4.6 collections\n...................\n\nThe *note ChainMap.newchild(): d90. method now accepts an 'm' argument\nspecifying the child map to add to the chain.  This allows an existing\nmapping and/or a custom mapping type to be used for the child.\n(Contributed by Vinay Sajip in bpo-16613(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=16613\n\nFile: python3.12.info,  Node: colorsys,  Next: contextlib<6>,  Prev: collections<6>,  Up: Improved Modules<9>\n\n1.9.4.7 colorsys\n................\n",
            "subsections": []
        },
        "The number of digits in the coefficients for the RGB -- YIQ conversions": {
            "content": "have been expanded so that they match the FCC NTSC versions.  The change\nin results should be less than 1% and may better match results found\nelsewhere.  (Contributed by Brian Landers and Serhiy Storchaka in\nbpo-14323(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=14323\n\nFile: python3.12.info,  Node: contextlib<6>,  Next: dbm<5>,  Prev: colorsys,  Up: Improved Modules<9>\n\n1.9.4.8 contextlib\n..................\n\nThe new *note contextlib.suppress: d93. context manager helps to clarify\nthe intent of code that deliberately suppresses exceptions from a single\nstatement.  (Contributed by Raymond Hettinger in bpo-15806(1) and Zero",
            "subsections": []
        },
        "Piraeus in bpo-19266(2).)": {
            "content": "The new *note contextlib.redirectstdout(): c45. context manager makes\nit easier for utility scripts to handle inflexible APIs that write their\noutput to *note sys.stdout: 90c. and don't provide any options to\nredirect it.  Using the context manager, the *note sys.stdout: 90c.\noutput can be redirected to any other stream or, in conjunction with\n*note io.StringIO: d94, to a string.  The latter can be especially\nuseful, for example, to capture output from a function that was written\nto implement a command line interface.  It is recommended only for\nutility scripts because it affects the global state of *note sys.stdout:\n90c.  (Contributed by Raymond Hettinger in bpo-15805(3).)\n\nThe *note contextlib: 21. documentation has also been updated to include\na *note discussion: d95. of the differences between single use, reusable\nand reentrant context managers.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=15806\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=19266\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=15805\n\nFile: python3.12.info,  Node: dbm<5>,  Next: dis<3>,  Prev: contextlib<6>,  Up: Improved Modules<9>\n\n1.9.4.9 dbm\n...........\n\n*note dbm.open(): d97. objects now support the context management\nprotocol.  When used in a *note with: 396. statement, the 'close' method\nof the database object will be called automatically at the end of the\nblock.  (Contributed by Claudiu Popa and Nick Coghlan in bpo-19282(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=19282\n\nFile: python3.12.info,  Node: dis<3>,  Next: doctest<3>,  Prev: dbm<5>,  Up: Improved Modules<9>\n\n1.9.4.10 dis\n............\n\nFunctions *note showcode(): d99, *note dis(): 96e, *note distb(): d9a,\nand *note disassemble(): d9b. now accept a keyword-only 'file' argument\nthat controls where they write their output.\n\nThe *note dis: 35. module is now built around an *note Instruction: d9c.\nclass that provides object oriented access to the details of each\nindividual bytecode operation.\n\nA new method, *note getinstructions(): d9d, provides an iterator that\nemits the Instruction stream for a given piece of Python code.  Thus it\nis now possible to write a program that inspects and manipulates a\nbytecode object in ways different from those provided by the *note dis:\n35. module itself.  For example:\n\n>>> import dis\n>>> for instr in dis.getinstructions(lambda x: x + 1):\n...     print(instr.opname)\nLOADFAST\nLOADCONST\nBINARYADD\nRETURNVALUE\n\nThe various display tools in the *note dis: 35. module have been\nrewritten to use these new components.\n\nIn addition, a new application-friendly class *note Bytecode: d9e.\nprovides an object-oriented API for inspecting bytecode in both in\nhuman-readable form and for iterating over instructions.  The *note",
            "subsections": []
        },
        "Bytecode: d9e. constructor takes the same arguments that": {
            "content": "'getinstruction()' does (plus an optional 'currentoffset'), and the\nresulting object can be iterated to produce *note Instruction: d9c.\nobjects.  But it also has a *note dis: d9f. method, equivalent to\ncalling *note dis: 96e. on the constructor argument, but returned as a\nmulti-line string:\n\n>>> bytecode = dis.Bytecode(lambda x: x + 1, currentoffset=3)\n>>> for instr in bytecode:\n...     print('{} ({})'.format(instr.opname, instr.opcode))\nLOADFAST (124)\nLOADCONST (100)\nBINARYADD (23)\nRETURNVALUE (83)\n>>> bytecode.dis().splitlines()\n['  1           0 LOADFAST                0 (x)',\n'      -->     3 LOADCONST               1 (1)',\n'              6 BINARYADD',\n'              7 RETURNVALUE']\n\n*note Bytecode: d9e. also has a class method, *note fromtraceback():\nda0, that provides the ability to manipulate a traceback (that is,\n'print(Bytecode.fromtraceback(tb).dis())' is equivalent to\n'distb(tb)').\n\n(Contributed by Nick Coghlan, Ryan Kelly and Thomas Kluyver in\nbpo-11816(1) and Claudiu Popa in bpo-17916(2).)\n\nNew function *note stackeffect(): da1. computes the effect on the",
            "subsections": []
        },
        "Python stack of a given opcode and argument, information that is not": {
            "content": "otherwise available.  (Contributed by Larry Hastings in bpo-19722(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=11816\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=17916\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=19722\n\nFile: python3.12.info,  Node: doctest<3>,  Next: email<3>,  Prev: dis<3>,  Up: Improved Modules<9>\n\n1.9.4.11 doctest\n................\n\nA new *note option flag: da3, *note FAILFAST: da4, halts test running\nas soon as the first failure is detected.  (Contributed by R. David",
            "subsections": []
        },
        "Murray and Daniel Urban in bpo-16522(1).)": {
            "content": "The *note doctest: 36. command line interface now uses *note argparse:\n6, and has two new options, '-o' and '-f'.  '-o' allows *note doctest\noptions: da3. to be specified on the command line, and '-f' is a\nshorthand for '-o FAILFAST' (to parallel the similar option supported\nby the *note unittest: 101. CLI). (Contributed by R. David Murray in\nbpo-11390(2).)\n\n*note doctest: 36. will now find doctests in extension module 'doc'\nstrings.  (Contributed by Zachary Ware in bpo-3158(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=16522\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=11390\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=3158\n\nFile: python3.12.info,  Node: email<3>,  Next: filecmp,  Prev: doctest<3>,  Up: Improved Modules<9>\n\n1.9.4.12 email\n..............\n\n*note asstring(): da6. now accepts a 'policy' argument to override the\ndefault policy of the message when generating a string representation of\nit.  This means that 'asstring' can now be used in more circumstances,\ninstead of having to create and use a *note generator: 3c. in order to\npass formatting parameters to its 'flatten' method.  (Contributed by R.",
            "subsections": []
        },
        "David Murray in bpo-18600(1).)": {
            "content": "New method *note asbytes(): da7. added to produce a bytes\nrepresentation of the message in a fashion similar to how 'asstring'\nproduces a string representation.  It does not accept the 'maxheaderlen'\nargument, but does accept the 'unixfrom' and 'policy' arguments.  The\n*note Message: ae7. *note bytes(): da8. method calls it, meaning\nthat 'bytes(mymsg)' will now produce the intuitive result: a bytes\nobject containing the fully formatted message.  (Contributed by R. David",
            "subsections": []
        },
        "Murray in bpo-18600(2).)": {
            "content": "The *note Message.setparam(): da9. message now accepts a 'replace'\nkeyword argument.  When specified, the associated header will be updated\nwithout changing its location in the list of headers.  For backward\ncompatibility, the default is 'False'.  (Contributed by R. David Murray\nin bpo-18891(3).)  A pair of new subclasses of *note Message: ae7. have\nbeen added (*note EmailMessage: ae8. and *note MIMEPart: daa.), along\nwith a new sub-module, *note contentmanager: 39. and a new *note policy:\n4b. attribute *note contentmanager: dab.  All documentation is\ncurrently in the new module, which is being added as part of email's new\n*note provisional API: 93a.  These classes provide a number of new\nmethods that make extracting content from and inserting content into\nemail messages much easier.  For details, see the *note contentmanager:\n39. documentation and the *note email; Examples: dac.  These API\nadditions complete the bulk of the work that was planned as part of the\nemail6 project.  The currently provisional API is scheduled to become\nfinal in Python 3.5 (possibly with a few minor additions in the area of\nerror handling).  (Contributed by R. David Murray in bpo-18891(4).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=18600\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=18600\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=18891\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=18891\n\nFile: python3.12.info,  Node: filecmp,  Next: functools<5>,  Prev: email<3>,  Up: Improved Modules<9>\n\n1.9.4.13 filecmp\n................\n\nA new *note clearcache(): dae. function provides the ability to clear\nthe *note filecmp: 55. comparison cache, which uses *note os.stat():\n1bf. information to determine if the file has changed since the last\ncompare.  This can be used, for example, if the file might have been\nchanged and re-checked in less time than the resolution of a particular\nfilesystem's file modification time field.  (Contributed by Mark Levitt\nin bpo-18149(1).)\n\nNew module attribute *note DEFAULTIGNORES: daf. provides the list of\ndirectories that are used as the default value for the 'ignore'\nparameter of the *note dircmp(): db0. function.  (Contributed by Eli",
            "subsections": []
        },
        "Bendersky in bpo-15442(2).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=18149\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=15442\n\nFile: python3.12.info,  Node: functools<5>,  Next: gc<5>,  Prev: filecmp,  Up: Improved Modules<9>\n\n1.9.4.14 functools\n..................\n\nThe new *note partialmethod(): 8a9. descriptor brings partial argument\napplication to descriptors, just as *note partial(): d31. provides for\nnormal callables.  The new descriptor also makes it easier to get\narbitrary callables (including *note partial(): d31. instances) to\nbehave like normal instance methods when included in a class definition.\n(Contributed by Alon Horev and Nick Coghlan in bpo-4331(1).)  The new\n*note singledispatch(): 406. decorator brings support for\nsingle-dispatch generic functions to the Python standard library.  Where\nobject oriented programming focuses on grouping multiple operations on a\ncommon set of data into a class, a generic function focuses on grouping\nmultiple implementations of an operation that allows it to work with\n'different' kinds of data.\n\nSee also\n........\n\nPEP 443(2) - Single-dispatch generic functions\n\nPEP written and implemented by ??ukasz Langa.\n\n*note totalordering(): db2. now supports a return value of *note\nNotImplemented: 5c5. from the underlying comparison function.\n(Contributed by Katie Miller in bpo-10042(3).)\n\nA pure-python version of the *note partial(): d31. function is now in\nthe stdlib; in CPython it is overridden by the C accelerated version,\nbut it is available for other implementations to use.  (Contributed by",
            "subsections": []
        },
        "Brian Thorne in bpo-12428(4).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=4331\n\n(2) https://peps.python.org/pep-0443/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=10042\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=12428\n\nFile: python3.12.info,  Node: gc<5>,  Next: glob<3>,  Prev: functools<5>,  Up: Improved Modules<9>\n\n1.9.4.15 gc\n...........\n\nNew function *note getstats(): db4. returns a list of three\nper-generation dictionaries containing the collections statistics since\ninterpreter startup.  (Contributed by Antoine Pitrou in bpo-16351(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=16351\n\nFile: python3.12.info,  Node: glob<3>,  Next: hashlib<6>,  Prev: gc<5>,  Up: Improved Modules<9>\n\n1.9.4.16 glob\n.............\n\nA new function *note escape(): db6. provides a way to escape special\ncharacters in a filename so that they do not become part of the globbing\nexpansion but are instead matched literally.  (Contributed by Serhiy",
            "subsections": []
        },
        "Storchaka in bpo-8402(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=8402\n\nFile: python3.12.info,  Node: hashlib<6>,  Next: hmac<3>,  Prev: glob<3>,  Up: Improved Modules<9>\n\n1.9.4.17 hashlib\n................\n\nA new *note hashlib.pbkdf2hmac(): 261. function provides the PKCS#5\npassword-based key derivation function 2(1).  (Contributed by Christian",
            "subsections": []
        },
        "Heimes in bpo-18582(2).)": {
            "content": "The *note name: db8. attribute of *note hashlib: 63. hash objects is now\na formally supported interface.  It has always existed in CPython's\n*note hashlib: 63. (although it did not return lower case names for all\nsupported hashes), but it was not a public interface and so some other",
            "subsections": []
        },
        "Python implementations have not previously supported it.  (Contributed": {
            "content": "by Jason R. Coombs in bpo-18532(3).)\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/PBKDF2\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=18582\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=18532\n\nFile: python3.12.info,  Node: hmac<3>,  Next: html,  Prev: hashlib<6>,  Up: Improved Modules<9>\n\n1.9.4.18 hmac\n.............\n\n*note hmac: 65. now accepts 'bytearray' as well as 'bytes' for the 'key'\nargument to the *note new(): 8d3. function, and the 'msg' parameter to\nboth the *note new(): 8d3. function and the *note update(): dba. method\nnow accepts any type supported by the *note hashlib: 63. module.\n(Contributed by Jonas Borgstro\"m in bpo-18240(1).)\n\nThe 'digestmod' argument to the *note hmac.new(): 8d3. function may now\nbe any hash digest name recognized by *note hashlib: 63.  In addition,\nthe current behavior in which the value of 'digestmod' defaults to 'MD5'\nis deprecated: in a future version of Python there will be no default\nvalue.  (Contributed by Christian Heimes in bpo-17276(2).)\n\nWith the addition of *note blocksize: dbb. and *note name: dbc.\nattributes (and the formal documentation of the *note digestsize: dbd.\nattribute), the *note hmac: 65. module now conforms fully to the PEP\n247(3) API. (Contributed by Christian Heimes in bpo-18775(4).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=18240\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=17276\n\n(3) https://peps.python.org/pep-0247/\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=18775\n\nFile: python3.12.info,  Node: html,  Next: http<3>,  Prev: hmac<3>,  Up: Improved Modules<9>\n\n1.9.4.19 html\n.............\n\nNew function *note unescape(): 778. function converts HTML5 character\nreferences to the corresponding Unicode characters.  (Contributed by",
            "subsections": []
        },
        "Ezio Melotti in bpo-2927(1).)": {
            "content": "*note HTMLParser: 682. accepts a new keyword argument 'convertcharrefs'\nthat, when 'True', automatically converts all character references.  For\nbackward-compatibility, its value defaults to 'False', but it will\nchange to 'True' in a future version of Python, so you are invited to\nset it explicitly and update your code to use this new feature.\n(Contributed by Ezio Melotti in bpo-13633(2).)\n\nThe 'strict' argument of *note HTMLParser: 682. is now deprecated.\n(Contributed by Ezio Melotti in bpo-15114(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=2927\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=13633\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=15114\n\nFile: python3.12.info,  Node: http<3>,  Next: idlelib and IDLE<4>,  Prev: html,  Up: Improved Modules<9>\n\n1.9.4.20 http\n.............\n\n*note senderror(): dc0. now accepts an optional additional 'explain'\nparameter which can be used to provide an extended error description,\noverriding the hardcoded default if there is one.  This extended error\ndescription will be formatted using the 'errormessageformat' attribute\nand sent as the body of the error response.  (Contributed by Karl Cow in\nbpo-12921(1).)\n\nThe *note http.server: 6d. *note command line interface: dc1. now has a\n'-b/--bind' option that causes the server to listen on a specific\naddress.  (Contributed by Malte Swart in bpo-17764(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=12921\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=17764\n\nFile: python3.12.info,  Node: idlelib and IDLE<4>,  Next: importlib<8>,  Prev: http<3>,  Up: Improved Modules<9>\n\n1.9.4.21 idlelib and IDLE\n.........................\n",
            "subsections": []
        },
        "See 'Lib/idlelib/NEWS.txt' for a cumulative list of changes since 3.3.0,": {
            "content": "as well as changes made in future 3.4.x releases.  This file is also\navailable from the IDLE Help ??? About IDLE dialog.\n\nFile: python3.12.info,  Node: importlib<8>,  Next: inspect<8>,  Prev: idlelib and IDLE<4>,  Up: Improved Modules<9>\n\n1.9.4.22 importlib\n..................\n\nThe *note InspectLoader: dc4. ABC defines a new method, *note\nsourcetocode(): c6f. that accepts source data and a path and returns a\ncode object.  The default implementation is equivalent to 'compile(data,\npath, 'exec', dontinherit=True)'.  (Contributed by Eric Snow and Brett",
            "subsections": []
        },
        "Cannon in bpo-15627(1).)": {
            "content": "*note InspectLoader: dc4. also now has a default implementation for the\n*note getcode(): dc5. method.  However, it will normally be desirable\nto override the default implementation for performance reasons.\n(Contributed by Brett Cannon in bpo-18072(2).)\n\nThe *note reload(): 26b. function has been moved from 'imp' to *note\nimportlib: 71. as part of the 'imp' module deprecation.  (Contributed by",
            "subsections": []
        },
        "Berker Peksag in bpo-18193(3).)": {
            "content": "*note importlib.util: 77. now has a *note MAGICNUMBER: 265. attribute\nproviding access to the bytecode version number.  This replaces the\n'getmagic()' function in the deprecated 'imp' module.  (Contributed by",
            "subsections": []
        },
        "Brett Cannon in bpo-18192(4).)": {
            "content": "New *note importlib.util: 77. functions *note cachefromsource(): 264.\nand *note sourcefromcache(): 26c. replace the same-named functions in\nthe deprecated 'imp' module.  (Contributed by Brett Cannon in\nbpo-18194(5).)\n\nThe *note importlib: 71. bootstrap *note NamespaceLoader: dc6. now\nconforms to the *note InspectLoader: dc4. ABC, which means that 'runpy'\nand 'python -m' can now be used with namespace packages.  (Contributed\nby Brett Cannon in bpo-18058(6).)\n\n*note importlib.util: 77. has a new function *note decodesource(): dc7.\nthat decodes source from bytes using universal newline processing.  This\nis useful for implementing *note InspectLoader.getsource(): dc8.\nmethods.\n\n*note importlib.machinery.ExtensionFileLoader: aff. now has a *note\ngetfilename(): dc9. method.  This was inadvertently omitted in the\noriginal implementation.  (Contributed by Eric Snow in bpo-19152(7).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=15627\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=18072\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=18193\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=18192\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=18194\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=18058\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=19152\n\nFile: python3.12.info,  Node: inspect<8>,  Next: ipaddress<4>,  Prev: importlib<8>,  Up: Improved Modules<9>\n\n1.9.4.23 inspect\n................\n\nThe *note inspect: 78. module now offers a basic *note command line\ninterface: dcb. to quickly display source code and other information for\nmodules, classes and functions.  (Contributed by Claudiu Popa and Nick",
            "subsections": []
        },
        "Coghlan in bpo-18626(1).)": {
            "content": "*note unwrap(): dcc. makes it easy to unravel wrapper function chains\ncreated by *note functools.wraps(): dcd. (and any other API that sets\nthe 'wrapped' attribute on a wrapper function).  (Contributed by",
            "subsections": []
        },
        "Daniel Urban, Aaron Iles and Nick Coghlan in bpo-13266(2).)": {
            "content": "As part of the implementation of the new *note enum: 51. module, the\n*note inspect: 78. module now has substantially better support for\ncustom 'dir' methods and dynamic class attributes provided through\nmetaclasses.  (Contributed by Ethan Furman in bpo-18929(3) and\nbpo-19030(4).)\n\n*note getfullargspec(): 51d. and 'getargspec()' now use the *note\nsignature(): 51c. API. This allows them to support a much broader range\nof callables, including those with 'signature' attributes, those\nwith metadata provided by argument clinic, *note functools.partial():\nd31. objects and more.  Note that, unlike *note signature(): 51c, these\nfunctions still ignore 'wrapped' attributes, and report the already\nbound first argument for bound methods, so it is still necessary to\nupdate your code to use *note signature(): 51c. directly if those\nfeatures are desired.  (Contributed by Yury Selivanov in bpo-17481(5).)\n\n*note signature(): 51c. now supports duck types of CPython functions,\nwhich adds support for functions compiled with Cython.  (Contributed by",
            "subsections": []
        },
        "Stefan Behnel and Yury Selivanov in bpo-17159(6).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=18626\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=13266\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=18929\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=19030\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=17481\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=17159\n\nFile: python3.12.info,  Node: ipaddress<4>,  Next: logging<6>,  Prev: inspect<8>,  Up: Improved Modules<9>\n\n1.9.4.24 ipaddress\n..................\n\n*note ipaddress: 7a. was added to the standard library in Python 3.3 as\na *note provisional API: 93a.  With the release of Python 3.4, this\nqualification has been removed: *note ipaddress: 7a. is now considered a\nstable API, covered by the normal standard library requirements to\nmaintain backwards compatibility.\n\nA new *note isglobal: dcf. property is 'True' if an address is globally\nrouteable.  (Contributed by Peter Moody in bpo-17400(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=17400\n\nFile: python3.12.info,  Node: logging<6>,  Next: marshal,  Prev: ipaddress<4>,  Up: Improved Modules<9>\n\n1.9.4.25 logging\n................\n\nThe *note TimedRotatingFileHandler: dd1. has a new 'atTime' parameter\nthat can be used to specify the time of day when rollover should happen.\n(Contributed by Ronald Oussoren in bpo-9556(1).)\n\n*note SocketHandler: dd2. and *note DatagramHandler: dd3. now support",
            "subsections": []
        },
        "Unix domain sockets (by setting 'port' to 'None').  (Contributed by": {
            "content": "",
            "subsections": []
        },
        "Vinay Sajip in commit ce46195b56a9.)": {
            "content": "*note fileConfig(): 98d. now accepts a *note\nconfigparser.RawConfigParser: dd4. subclass instance for the 'fname'\nparameter.  This facilitates using a configuration file when logging\nconfiguration is just a part of the overall application configuration,\nor where the application modifies the configuration before passing it to\n*note fileConfig(): 98d.  (Contributed by Vinay Sajip in bpo-16110(2).)\n\nLogging configuration data received from a socket via the *note\nlogging.config.listen(): dd5. function can now be validated before being\nprocessed by supplying a verification function as the argument to the\nnew 'verify' keyword argument.  (Contributed by Vinay Sajip in\nbpo-15452(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=9556\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=16110\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=15452\n\nFile: python3.12.info,  Node: marshal,  Next: mmap<2>,  Prev: logging<6>,  Up: Improved Modules<9>\n\n1.9.4.26 marshal\n................\n\nThe default *note marshal: 88. version has been bumped to 3.  The code\nimplementing the new version restores the Python2 behavior of recording\nonly one copy of interned strings and preserving the interning on\ndeserialization, and extends this \"one copy\" ability to any object type\n(including handling recursive references).  This reduces both the size\nof '.pyc' files and the amount of memory a module occupies in memory\nwhen it is loaded from a '.pyc' (or '.pyo') file.  (Contributed by\nKristj??n Valur J??nsson in bpo-16475(1), with additional speedups by",
            "subsections": []
        },
        "Antoine Pitrou in bpo-19219(2).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=16475\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=19219\n\nFile: python3.12.info,  Node: mmap<2>,  Next: multiprocessing<6>,  Prev: marshal,  Up: Improved Modules<9>\n\n1.9.4.27 mmap\n.............\n\nmmap objects are now *note weakly referenceable: d71.  (Contributed by",
            "subsections": []
        },
        "Valerie Lambert in bpo-4885(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=4885\n\nFile: python3.12.info,  Node: multiprocessing<6>,  Next: operator<3>,  Prev: mmap<2>,  Up: Improved Modules<9>\n\n1.9.4.28 multiprocessing\n........................\n\nOn Unix two new *note start methods: 22d, 'spawn' and 'forkserver', have\nbeen added for starting processes using *note multiprocessing: 8f.",
            "subsections": []
        },
        "These make the mixing of processes with threads more robust, and the": {
            "content": "'spawn' method matches the semantics that multiprocessing has always\nused on Windows.  New function *note getallstartmethods(): dd9.\nreports all start methods available on the platform, *note\ngetstartmethod(): dda. reports the current start method, and *note\nsetstartmethod(): 22c. sets the start method.  (Contributed by Richard",
            "subsections": []
        },
        "Oudkerk in bpo-8713(1).)": {
            "content": "*note multiprocessing: 8f. also now has the concept of a 'context',\nwhich determines how child processes are created.  New function *note\ngetcontext(): 22b. returns a context that uses a specified start\nmethod.  It has the same API as the *note multiprocessing: 8f. module\nitself, so you can use it to create *note Pool: ddb.s and other objects\nthat will operate within that context.  This allows a framework and an\napplication or different parts of the same application to use\nmultiprocessing without interfering with each other.  (Contributed by",
            "subsections": []
        },
        "Richard Oudkerk in bpo-18999(2).)": {
            "content": "",
            "subsections": []
        },
        "Except when using the old 'fork' start method, child processes no longer": {
            "content": "inherit unneeded handles/file descriptors from their parents (part of\nbpo-8713(3)).\n\n*note multiprocessing: 8f. now relies on *note runpy: b9. (which\nimplements the '-m' switch) to initialise 'main' appropriately in\nchild processes when using the 'spawn' or 'forkserver' start methods.",
            "subsections": []
        },
        "This resolves some edge cases where combining multiprocessing, the '-m'": {
            "content": "command line switch, and explicit relative imports could cause obscure\nfailures in child processes.  (Contributed by Nick Coghlan in\nbpo-19946(4).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=8713\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=18999\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=8713\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=19946\n\nFile: python3.12.info,  Node: operator<3>,  Next: os<10>,  Prev: multiprocessing<6>,  Up: Improved Modules<9>\n\n1.9.4.29 operator\n.................\n\nNew function *note lengthhint(): ddd. provides an implementation of the\nspecification for how the *note lengthhint(): d73. special method\nshould be used, as part of the PEP 424(1) formal specification of this\nlanguage feature.  (Contributed by Armin Ronacher in bpo-16148(2).)\n\nThere is now a pure-python version of the *note operator: 9a. module\navailable for reference and for use by alternate implementations of",
            "subsections": []
        },
        "Python.  (Contributed by Zachary Ware in bpo-16694(3).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0424/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=16148\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=16694\n\nFile: python3.12.info,  Node: os<10>,  Next: pdb<5>,  Prev: operator<3>,  Up: Improved Modules<9>\n\n1.9.4.30 os\n...........\n\nThere are new functions to get and set the *note inheritable flag: d60.\nof a file descriptor (*note os.getinheritable(): d61, *note\nos.setinheritable(): d62.) or a Windows handle (*note\nos.gethandleinheritable(): d63, *note os.sethandleinheritable():\nd64.).\n\nNew function *note cpucount(): 60b. reports the number of CPUs\navailable on the platform on which Python is running (or 'None' if the\ncount can't be determined).  The *note multiprocessing.cpucount(): ddf.\nfunction is now implemented in terms of this function).  (Contributed by",
            "subsections": []
        },
        "Trent Nelson, Yogesh Chaudhari, Victor Stinner, and Charles-Franc,ois": {
            "content": "",
            "subsections": []
        },
        "Natali in bpo-17914(1).)": {
            "content": "*note os.path.samestat(): de0. is now available on the Windows platform\n(and the *note os.path.samefile(): de1. implementation is now shared\nbetween Unix and Windows).  (Contributed by Brian Curtin in\nbpo-11939(2).)\n\n*note os.path.ismount(): 83b. now recognizes volumes mounted below a\ndrive root on Windows.  (Contributed by Tim Golden in bpo-9035(3).)\n\n*note os.open(): bee. supports two new flags on platforms that provide\nthem, *note OPATH: de2. (un-opened file descriptor), and *note\nOTMPFILE: de3. (unnamed temporary file; as of 3.4.0 release available\nonly on Linux systems with a kernel version of 3.11 or newer that have\nuapi headers).  (Contributed by Christian Heimes in bpo-18673(4) and",
            "subsections": []
        },
        "Benjamin Peterson, respectively.)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=17914\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=11939\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=9035\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=18673\n\nFile: python3.12.info,  Node: pdb<5>,  Next: pickle<4>,  Prev: os<10>,  Up: Improved Modules<9>\n\n1.9.4.31 pdb\n............\n\n*note pdb: a0. has been enhanced to handle generators, *note yield: 7f1,\nand 'yield from' in a more useful fashion.  This is especially helpful\nwhen debugging *note asyncio: 9. based programs.  (Contributed by Andrew",
            "subsections": []
        },
        "Svetlov and Xavier de Gaye in bpo-16596(1).)": {
            "content": "The 'print' command has been removed from *note pdb: a0, restoring\naccess to the Python *note print(): de5. function from the pdb command\nline.  Python2's 'pdb' did not have a 'print' command; instead, entering\n'print' executed the 'print' statement.  In Python3 'print' was\nmistakenly made an alias for the pdb *note p: de6. command.  'p',\nhowever, prints the 'repr' of its argument, not the 'str' like the",
            "subsections": []
        },
        "Python2 'print' command did.  Worse, the Python3 'pdb print' command": {
            "content": "shadowed the Python3 'print' function, making it inaccessible at the\n'pdb' prompt.  (Contributed by Connor Osborn in bpo-18764(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=16596\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=18764\n\nFile: python3.12.info,  Node: pickle<4>,  Next: plistlib<2>,  Prev: pdb<5>,  Up: Improved Modules<9>\n\n1.9.4.32 pickle\n...............\n\n*note pickle: a1. now supports (but does not use by default) a new\npickle protocol, protocol 4.  This new protocol addresses a number of\nissues that were present in previous protocols, such as the\nserialization of nested classes, very large strings and containers, and\nclasses whose 'new()' method takes keyword-only arguments.  It also\nprovides some efficiency improvements.\n\nSee also\n........\n\nPEP 3154(1) - Pickle protocol 4\n\nPEP written by Antoine Pitrou and implemented by Alexandre\nVassalotti.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3154/\n\nFile: python3.12.info,  Node: plistlib<2>,  Next: poplib<3>,  Prev: pickle<4>,  Up: Improved Modules<9>\n\n1.9.4.33 plistlib\n.................\n\n*note plistlib: a6. now has an API that is similar to the standard\npattern for stdlib serialization protocols, with new *note load(): 76f,\n*note dump(): 771, *note loads(): 770, and *note dumps(): 772.\nfunctions.  (The older API is now deprecated.)  In addition to the\nalready supported XML plist format (*note FMTXML: de9.), it also now\nsupports the binary plist format (*note FMTBINARY: dea.).  (Contributed\nby Ronald Oussoren and others in bpo-14455(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=14455\n\nFile: python3.12.info,  Node: poplib<3>,  Next: pprint<4>,  Prev: plistlib<2>,  Up: Improved Modules<9>\n\n1.9.4.34 poplib\n...............\n\nTwo new methods have been added to *note poplib: a7.: *note capa(): dec,\nwhich returns the list of capabilities advertised by the POP server, and\n*note stls(): ded, which switches a clear-text POP3 session into an\nencrypted POP3 session if the POP server supports it.  (Contributed by",
            "subsections": []
        },
        "Lorenzo Catucci in bpo-4473(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=4473\n\nFile: python3.12.info,  Node: pprint<4>,  Next: pty,  Prev: poplib<3>,  Up: Improved Modules<9>\n\n1.9.4.35 pprint\n...............\n\nThe *note pprint: a9. module's *note PrettyPrinter: def. class and its\n*note pformat(): df0, and *note pprint(): 61d. functions have a new\noption, 'compact', that controls how the output is formatted.  Currently\nsetting 'compact' to 'True' means that sequences will be printed with as\nmany sequence elements as will fit within 'width' on each (indented)\nline.  (Contributed by Serhiy Storchaka in bpo-19132(1).)\n",
            "subsections": []
        },
        "Long strings are now wrapped using Python's normal line continuation": {
            "content": "syntax.  (Contributed by Antoine Pitrou in bpo-17150(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=19132\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=17150\n\nFile: python3.12.info,  Node: pty,  Next: pydoc<4>,  Prev: pprint<4>,  Up: Improved Modules<9>\n\n1.9.4.36 pty\n............\n\n*note pty.spawn(): df2. now returns the status value from *note\nos.waitpid(): bf6. on the child process, instead of 'None'.\n(Contributed by Gregory P. Smith.)\n\nFile: python3.12.info,  Node: pydoc<4>,  Next: re<6>,  Prev: pty,  Up: Improved Modules<9>\n\n1.9.4.37 pydoc\n..............\n\nThe *note pydoc: b0. module is now based directly on the *note\ninspect.signature(): 51c. introspection API, allowing it to provide\nsignature information for a wider variety of callable objects.  This\nchange also means that 'wrapped' attributes are now taken into\naccount when displaying help information.  (Contributed by Larry",
            "subsections": []
        },
        "Hastings in bpo-19674(1).)": {
            "content": "The *note pydoc: b0. module no longer displays the 'self' parameter for\nalready bound methods.  Instead, it aims to always display the exact\ncurrent signature of the supplied callable.  (Contributed by Larry",
            "subsections": []
        },
        "Hastings in bpo-20710(2).)": {
            "content": "In addition to the changes that have been made to *note pydoc: b0.\ndirectly, its handling of custom 'dir' methods and various\ndescriptor behaviours has also been improved substantially by the\nunderlying changes in the *note inspect: 78. module.\n\nAs the *note help(): 6f0. builtin is based on *note pydoc: b0, the above\nchanges also affect the behaviour of *note help(): 6f0.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=19674\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=20710\n\nFile: python3.12.info,  Node: re<6>,  Next: resource,  Prev: pydoc<4>,  Up: Improved Modules<9>\n\n1.9.4.38 re\n...........\n\nNew *note fullmatch(): df5. function and 'regex.fullmatch()' method\nanchor the pattern at both ends of the string to match.  This provides a\nway to be explicit about the goal of the match, which avoids a class of\nsubtle bugs where '$' characters get lost during code changes or the\naddition of alternatives to an existing regular expression.\n(Contributed by Matthew Barnett in bpo-16203(1).)\n\nThe repr of *note regex objects: df6. now includes the pattern and the\nflags; the repr of *note match objects: df7. now includes the start,\nend, and the part of the string that matched.  (Contributed by Hugo",
            "subsections": []
        },
        "Lopes Tavares and Serhiy Storchaka in bpo-13592(2) and bpo-17087(3).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=16203\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=13592\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=17087\n\nFile: python3.12.info,  Node: resource,  Next: select,  Prev: re<6>,  Up: Improved Modules<9>\n\n1.9.4.39 resource\n.................\n\nNew *note prlimit(): df9. function, available on Linux platforms with a\nkernel version of 2.6.36 or later and glibc of 2.13 or later, provides\nthe ability to query or set the resource limits for processes other than\nthe one making the call.  (Contributed by Christian Heimes in\nbpo-16595(1).)\n",
            "subsections": []
        },
        "On Linux kernel version 2.6.36 or later, there are also some new Linux": {
            "content": "specific constants: *note RLIMITMSGQUEUE: dfa, *note RLIMITNICE: dfb,\n*note RLIMITRTPRIO: dfc, *note RLIMITRTTIME: dfd, and *note\nRLIMITSIGPENDING: dfe.  (Contributed by Christian Heimes in\nbpo-19324(2).)\n",
            "subsections": []
        },
        "On FreeBSD version 9 and later, there some new FreeBSD specific": {
            "content": "constants: *note RLIMITSBSIZE: dff, *note RLIMITSWAP: e00, and *note\nRLIMITNPTS: e01.  (Contributed by Claudiu Popa in bpo-19343(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=16595\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=19324\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=19343\n\nFile: python3.12.info,  Node: select,  Next: shelve<2>,  Prev: resource,  Up: Improved Modules<9>\n\n1.9.4.40 select\n...............\n\n*note epoll: e03. objects now support the context management protocol.\nWhen used in a *note with: 396. statement, the *note close(): e04.\nmethod will be called automatically at the end of the block.\n(Contributed by Serhiy Storchaka in bpo-16488(1).)\n\n*note devpoll: e05. objects now have *note fileno(): e06. and *note\nclose(): e07. methods, as well as a new attribute *note closed: e08.\n(Contributed by Victor Stinner in bpo-18794(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=16488\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=18794\n\nFile: python3.12.info,  Node: shelve<2>,  Next: shutil<5>,  Prev: select,  Up: Improved Modules<9>\n\n1.9.4.41 shelve\n...............\n\n*note Shelf: e0a. instances may now be used in *note with: 396.\nstatements, and will be automatically closed at the end of the 'with'\nblock.  (Contributed by Filip Gruszczy??ski in bpo-13896(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=13896\n\nFile: python3.12.info,  Node: shutil<5>,  Next: smtpd<3>,  Prev: shelve<2>,  Up: Improved Modules<9>\n\n1.9.4.42 shutil\n...............\n\n*note copyfile(): 886. now raises a specific *note Error: e0c. subclass,\n*note SameFileError: e0d, when the source and destination are the same\nfile, which allows an application to take appropriate action on this\nspecific error.  (Contributed by Atsuo Ishimoto and Hynek Schlawack in\nbpo-1492704(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=1492704\n\nFile: python3.12.info,  Node: smtpd<3>,  Next: smtplib<3>,  Prev: shutil<5>,  Up: Improved Modules<9>\n\n1.9.4.43 smtpd\n..............\n",
            "subsections": []
        },
        "The 'SMTPServer' and 'SMTPChannel' classes now accept a 'map' keyword": {
            "content": "argument which, if specified, is passed in to 'asynchat.asyncchat' as\nits 'map' argument.  This allows an application to avoid affecting the\nglobal socket map.  (Contributed by Vinay Sajip in bpo-11959(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=11959\n\nFile: python3.12.info,  Node: smtplib<3>,  Next: socket<9>,  Prev: smtpd<3>,  Up: Improved Modules<9>\n\n1.9.4.44 smtplib\n................\n\n*note SMTPException: e10. is now a subclass of *note OSError: 613, which\nallows both socket level errors and SMTP protocol level errors to be\ncaught in one try/except statement by code that only cares whether or\nnot an error occurred.  (Contributed by Ned Jackson Lovely in\nbpo-2118(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=2118\n\nFile: python3.12.info,  Node: socket<9>,  Next: sqlite3<8>,  Prev: smtplib<3>,  Up: Improved Modules<9>\n\n1.9.4.45 socket\n...............\n\nThe socket module now supports the *note CANBCM: e12. protocol on\nplatforms that support it.  (Contributed by Brian Thorne in\nbpo-15359(1).)\n\nSocket objects have new methods to get or set their *note inheritable\nflag: d60, *note getinheritable(): d65. and *note setinheritable():\nd66.\n\nThe 'socket.AF*' and 'socket.SOCK*' constants are now enumeration\nvalues using the new *note enum: 51. module.  This allows meaningful\nnames to be printed during debugging, instead of integer \"magic\nnumbers\".\n\nThe *note AFLINK: e13. constant is now available on BSD and OSX.\n\n*note inetpton(): 783. and *note inetntop(): e14. are now supported on",
            "subsections": []
        },
        "Windows.  (Contributed by Atsuo Ishimoto in bpo-7171(2).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=15359\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=7171\n\nFile: python3.12.info,  Node: sqlite3<8>,  Next: ssl<9>,  Prev: socket<9>,  Up: Improved Modules<9>\n\n1.9.4.46 sqlite3\n................\n\nA new boolean parameter to the *note connect(): 1da. function, 'uri',\ncan be used to indicate that the 'database' parameter is a 'uri' (see\nthe SQLite URI documentation(1)).  (Contributed by poq in bpo-13773(2).)\n\n---------- Footnotes ----------\n\n(1) https://www.sqlite.org/uri.html\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=13773\n\nFile: python3.12.info,  Node: ssl<9>,  Next: stat,  Prev: sqlite3<8>,  Up: Improved Modules<9>\n\n1.9.4.47 ssl\n............\n\n*note PROTOCOLTLSv11: 678. and *note PROTOCOLTLSv12: 679. (TLSv1.1\nand TLSv1.2 support) have been added; support for these protocols is\nonly available if Python is linked with OpenSSL 1.0.1 or later.\n(Contributed by Michele Orr?? and Antoine Pitrou in bpo-16692(1).)  New\nfunction *note createdefaultcontext(): e17. provides a standard way to\nobtain an *note SSLContext: 278. whose settings are intended to be a\nreasonable balance between compatibility and security.  These settings\nare more stringent than the defaults provided by the *note SSLContext:\n278. constructor, and may be adjusted in the future, without prior\ndeprecation, if best-practice security requirements change.  The new\nrecommended best practice for using stdlib libraries that support SSL is\nto use *note createdefaultcontext(): e17. to obtain an *note\nSSLContext: 278. object, modify it if needed, and then pass it as the\n'context' argument of the appropriate stdlib API. (Contributed by",
            "subsections": []
        },
        "Christian Heimes in bpo-19689(2).)": {
            "content": "*note SSLContext: 278. method *note loadverifylocations(): d52.\naccepts a new optional argument 'cadata', which can be used to provide\nPEM or DER encoded certificates directly via strings or bytes,\nrespectively.  (Contributed by Christian Heimes in bpo-18138(3).)\n\nNew function *note getdefaultverifypaths(): e18. returns a named\ntuple of the paths and environment variables that the *note\nsetdefaultverifypaths(): e19. method uses to set OpenSSL's default\n'cafile' and 'capath'.  This can be an aid in debugging default\nverification issues.  (Contributed by Christian Heimes in bpo-18143(4).)\n\n*note SSLContext: 278. has a new method, *note certstorestats(): e1a,\nthat reports the number of loaded 'X.509' certs, 'X.509 CA' certs, and\ncertificate revocation lists ('crl's), as well as a *note\ngetcacerts(): e1b. method that returns a list of the loaded 'CA'\ncertificates.  (Contributed by Christian Heimes in bpo-18147(5).)\n\nIf OpenSSL 0.9.8 or later is available, *note SSLContext: 278. has a new\nattribute *note verifyflags: e1c. that can be used to control the\ncertificate verification process by setting it to some combination of\nthe new constants *note VERIFYDEFAULT: e1d, *note\nVERIFYCRLCHECKLEAF: e1e, *note VERIFYCRLCHECKCHAIN: e1f, or *note\nVERIFYX509STRICT: e20.  OpenSSL does not do any CRL verification by\ndefault.  (Contributed by Christien Heimes in bpo-8813(6).)\n\nNew *note SSLContext: 278. method *note loaddefaultcerts(): e21. loads\na set of default \"certificate authority\" (CA) certificates from default\nlocations, which vary according to the platform.  It can be used to load\nboth TLS web server authentication certificates ('purpose='*note\nSERVERAUTH: e22.) for a client to use to verify a server, and\ncertificates for a server to use in verifying client certificates\n('purpose='*note CLIENTAUTH: e23.).  (Contributed by Christian Heimes\nin bpo-19292(7).)  Two new windows-only functions, *note\nenumcertificates(): e24. and *note enumcrls(): e25. provide the\nability to retrieve certificates, certificate information, and CRLs from\nthe Windows cert store.  (Contributed by Christian Heimes in\nbpo-17134(8).)  Support for server-side SNI (Server Name Indication)\nusing the new *note ssl.SSLContext.setservernamecallback(): e26.\nmethod.  (Contributed by Daniel Black in bpo-8109(9).)\n\nThe dictionary returned by *note SSLSocket.getpeercert(): e27. contains\nadditional 'X509v3' extension items: 'crlDistributionPoints',\n'calIssuers', and 'OCSP' URIs.  (Contributed by Christian Heimes in\nbpo-18379(10).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=16692\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=19689\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=18138\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=18143\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=18147\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=8813\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=19292\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=17134\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=8109\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=18379\n\nFile: python3.12.info,  Node: stat,  Next: struct<2>,  Prev: ssl<9>,  Up: Improved Modules<9>\n\n1.9.4.48 stat\n.............\n\nThe *note stat: cb. module is now backed by a C implementation in\n'stat'.  A C implementation is required as most of the values aren't\nstandardized and are platform-dependent.  (Contributed by Christian",
            "subsections": []
        },
        "Heimes in bpo-11016(1).)": {
            "content": "The module supports new *note STMODE: e29. flags, *note SIFDOOR: e2a,\n*note SIFPORT: e2b, and *note SIFWHT: e2c.  (Contributed by Christian",
            "subsections": []
        },
        "Hiemes in bpo-11016(2).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=11016\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=11016\n\nFile: python3.12.info,  Node: struct<2>,  Next: subprocess<4>,  Prev: stat,  Up: Improved Modules<9>\n\n1.9.4.49 struct\n...............\n\nNew function *note iterunpack: e2e. and a new *note\nstruct.Struct.iterunpack(): e2f. method on compiled formats provide\nstreamed unpacking of a buffer containing repeated instances of a given\nformat of data.  (Contributed by Antoine Pitrou in bpo-17804(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=17804\n\nFile: python3.12.info,  Node: subprocess<4>,  Next: sunau<2>,  Prev: struct<2>,  Up: Improved Modules<9>\n\n1.9.4.50 subprocess\n...................\n\n*note checkoutput(): e31. now accepts an 'input' argument that can be\nused to provide the contents of 'stdin' for the command that is run.\n(Contributed by Zack Weinberg in bpo-16624(1).)\n\n'getstatus()' and *note getstatusoutput(): e32. now work on Windows.",
            "subsections": []
        },
        "This change was actually inadvertently made in 3.3.4.  (Contributed by": {
            "content": "",
            "subsections": []
        },
        "Tim Golden in bpo-10197(2).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=16624\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=10197\n\nFile: python3.12.info,  Node: sunau<2>,  Next: sys<10>,  Prev: subprocess<4>,  Up: Improved Modules<9>\n\n1.9.4.51 sunau\n..............\n",
            "subsections": []
        },
        "The 'getparams()' method now returns a namedtuple rather than a plain": {
            "content": "tuple.  (Contributed by Claudiu Popa in bpo-17487(1).)\n\n*note wave.open(): 76b. now supports the context management protocol.\n(Contributed by Claudiu Popa in bpo-17616(2).)\n\n*note wave: 10e. can now *note write output to unseekable files: e5e.\n(Contributed by David Jones, Guilherme Polo, and Serhiy Storchaka in\nbpo-5202(3).)\n\nThe *note writeframesraw(): e5f. and *note writeframes(): e60. methods\nnow accept any *note bytes-like object: b82.  (Contributed by Serhiy",
            "subsections": []
        },
        "Serhiy Storchaka in bpo-19261(3).)": {
            "content": "The *note writeframesraw(): e35. and *note writeframes(): e36. methods\nnow accept any *note bytes-like object: b82.  (Contributed by Serhiy",
            "subsections": []
        },
        "Storchaka in bpo-8311(4).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=17487\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=17616\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=5202\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=8311\n\nFile: python3.12.info,  Node: weakref<2>,  Next: xml etree<2>,  Prev: wave<2>,  Up: Improved Modules<9>\n\n1.9.4.62 weakref\n................\n\nNew *note WeakMethod: e62. class simulates weak references to bound\nmethods.  (Contributed by Antoine Pitrou in bpo-14631(1).)\n\nNew *note finalize: 8aa. class makes it possible to register a callback\nto be invoked when an object is garbage collected, without needing to\ncarefully manage the lifecycle of the weak reference itself.\n(Contributed by Richard Oudkerk in bpo-15528(2).)\n\nThe callback, if any, associated with a *note ref: e63. is now exposed\nvia the *note callback: e64. attribute.  (Contributed by Mark",
            "subsections": []
        },
        "Antoine Pitrou in bpo-13390(1).)": {
            "content": "When the Python interpreter starts in *note interactive mode: e39, it\nchecks for an *note interactivehook: e3a. attribute on the *note\nsys: d3. module.  If the attribute exists, its value is called with no\narguments just before interactive mode is started.  The check is made\nafter the *note PYTHONSTARTUP: e3b. file is read, so it can be set\nthere.  The *note site: c2. module *note sets it: e3c. to a function\nthat enables tab completion and history saving (in '~/.python-history')\nif the platform supports *note readline: b5.  If you do not want this\n(new) behavior, you can override it in *note PYTHONSTARTUP: e3b, *note\nsitecustomize: c3, or *note usercustomize: 109. by deleting this\nattribute from *note sys: d3. (or setting it to some other callable).\n(Contributed by ??ric Araujo and Antoine Pitrou in bpo-5845(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=13390\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=5845\n\nFile: python3.12.info,  Node: tarfile<8>,  Next: textwrap,  Prev: sys<10>,  Up: Improved Modules<9>\n\n1.9.4.53 tarfile\n................\n\nThe *note tarfile: d8. module now supports a simple *note Command-Line",
            "subsections": []
        },
        "Interface: e3e. when called as a script directly or via '-m'.  This can": {
            "content": "be used to create and extract tarfile archives.  (Contributed by Berker",
            "subsections": []
        },
        "Peksag in bpo-13477(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=13477\n\nFile: python3.12.info,  Node: textwrap,  Next: threading<7>,  Prev: tarfile<8>,  Up: Improved Modules<9>\n\n1.9.4.54 textwrap\n.................\n\nThe *note TextWrapper: e40. class has two new attributes/constructor\narguments: *note maxlines: e41, which limits the number of lines in the\noutput, and *note placeholder: e42, which is a string that will appear\nat the end of the output if it has been truncated because of\n'maxlines'.  Building on these capabilities, a new convenience function\n*note shorten(): e43. collapses all of the whitespace in the input to\nsingle spaces and produces a single line of a given 'width' that ends\nwith the 'placeholder' (by default, '[...]').  (Contributed by Antoine",
            "subsections": []
        },
        "Pitrou and Serhiy Storchaka in bpo-18585(1) and bpo-18725(2).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=18585\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=18725\n\nFile: python3.12.info,  Node: threading<7>,  Next: traceback<5>,  Prev: textwrap,  Up: Improved Modules<9>\n\n1.9.4.55 threading\n..................\n\nThe *note Thread: 76c. object representing the main thread can be\nobtained from the new *note mainthread(): e45. function.  In normal\nconditions this will be the thread from which the Python interpreter was\nstarted.  (Contributed by Andrew Svetlov in bpo-18882(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=18882\n\nFile: python3.12.info,  Node: traceback<5>,  Next: types<5>,  Prev: threading<7>,  Up: Improved Modules<9>\n\n1.9.4.56 traceback\n..................\n\nA new *note traceback.clearframes(): e47. function takes a traceback\nobject and clears the local variables in all of the frames it\nreferences, reducing the amount of memory consumed.  (Contributed by",
            "subsections": []
        },
        "Andrew Kuchling in bpo-1565525(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=1565525\n\nFile: python3.12.info,  Node: types<5>,  Next: urllib<2>,  Prev: traceback<5>,  Up: Improved Modules<9>\n\n1.9.4.57 types\n..............\n\nA new *note DynamicClassAttribute(): 3f7. descriptor provides a way to\ndefine an attribute that acts normally when looked up through an\ninstance object, but which is routed to the 'class' 'getattr' when\nlooked up through the class.  This allows one to have properties active\non a class, and have virtual attributes on the class with the same name\n(see 'Enum' for an example).  (Contributed by Ethan Furman in\nbpo-19030(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=19030\n\nFile: python3.12.info,  Node: urllib<2>,  Next: unittest<8>,  Prev: types<5>,  Up: Improved Modules<9>\n\n1.9.4.58 urllib\n...............\n\n*note urllib.request: 106. now supports 'data:' URLs via the *note\nDataHandler: e4a. class.  (Contributed by Mathias Panzenbo\"ck in\nbpo-16423(1).)\n\nThe http method that will be used by a *note Request: e4b. class can now\nbe specified by setting a *note method: e4c. class attribute on the\nsubclass.  (Contributed by Jason R Coombs in bpo-18978(2).)\n\n*note Request: e4b. objects are now reusable: if the *note fullurl:\ne4d. or *note data: e4e. attributes are modified, all relevant internal\nproperties are updated.  This means, for example, that it is now\npossible to use the same *note Request: e4b. object in more than one\n*note OpenerDirector.open(): e4f. call with different 'data' arguments,\nor to modify a *note Request: e4b.'s 'url' rather than recomputing it\nfrom scratch.  There is also a new *note removeheader(): e50. method\nthat can be used to remove headers from a *note Request: e4b.\n(Contributed by Alexey Kachayev in bpo-16464(3), Daniel Wozniak in\nbpo-17485(4), and Damien Brecht and Senthil Kumaran in bpo-17272(5).)\n\n*note HTTPError: e51. objects now have a *note headers: e52. attribute\nthat provides access to the HTTP response headers associated with the\nerror.  (Contributed by Berker Peksag in bpo-15701(6).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=16423\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=18978\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=16464\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=17485\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=17272\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=15701\n\nFile: python3.12.info,  Node: unittest<8>,  Next: venv<6>,  Prev: urllib<2>,  Up: Improved Modules<9>\n\n1.9.4.59 unittest\n.................\n\nThe *note TestCase: 159. class has a new method, *note subTest(): e54,\nthat produces a context manager whose *note with: 396. block becomes a\n\"sub-test\".  This context manager allows a test method to dynamically\ngenerate subtests by, say, calling the 'subTest' context manager inside\na loop.  A single test method can thereby produce an indefinite number\nof separately identified and separately counted tests, all of which will\nrun even if one or more of them fail.  For example:\n\nclass NumbersTest(unittest.TestCase):\ndef testeven(self):\nfor i in range(6):\nwith self.subTest(i=i):\nself.assertEqual(i % 2, 0)\n\nwill result in six subtests, each identified in the unittest verbose\noutput with a label consisting of the variable name 'i' and a particular\nvalue for that variable ('i=0', 'i=1', etc).  See *note Distinguishing\ntest iterations using subtests: e55. for the full version of this\nexample.  (Contributed by Antoine Pitrou in bpo-16997(1).)\n\n*note unittest.main(): e56. now accepts an iterable of test names for\n'defaultTest', where previously it only accepted a single test name as a\nstring.  (Contributed by Jyrki Pulliainen in bpo-15132(2).)\n\nIf *note SkipTest: e57. is raised during test discovery (that is, at the\nmodule level in the test file), it is now reported as a skip instead of\nan error.  (Contributed by Zach Ware in bpo-16935(3).)\n\n*note discover(): e58. now sorts the discovered files to provide\nconsistent test ordering.  (Contributed by Martin Melin and Jeff Ramnani\nin bpo-16709(4).)\n\n*note TestSuite: c51. now drops references to tests as soon as the test\nhas been run, if the test is successful.  On Python interpreters that do\ngarbage collection, this allows the tests to be garbage collected if\nnothing else is holding a reference to the test.  It is possible to\noverride this behavior by creating a *note TestSuite: c51. subclass that\ndefines a custom 'removeTestAtIndex' method.  (Contributed by Tom",
            "subsections": []
        },
        "Wardill, Matt McClure, and Andrew Svetlov in bpo-11798(5).)": {
            "content": "A new test assertion context-manager, *note assertLogs(): 64f, will\nensure that a given block of code emits a log message using the *note\nlogging: 82. module.  By default the message can come from any logger\nand have a priority of 'INFO' or higher, but both the logger name and an\nalternative minimum logging level may be specified.  The object returned\nby the context manager can be queried for the *note LogRecord: e59.s\nand/or formatted messages that were logged.  (Contributed by Antoine",
            "subsections": []
        },
        "Pitrou in bpo-18937(6).)": {
            "content": "",
            "subsections": []
        },
        "Test discovery now works with namespace packages (Contributed by Claudiu": {
            "content": "",
            "subsections": []
        },
        "Popa in bpo-17457(7).)": {
            "content": "*note unittest.mock: 102. objects now inspect their specification\nsignatures when matching calls, which means an argument can now be\nmatched by either position or name, instead of only by position.\n(Contributed by Antoine Pitrou in bpo-17015(8).)\n\n'mockopen()' objects now have 'readline' and 'readlines' methods.\n(Contributed by Toshio Kuratomi in bpo-17467(9).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=16997\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=15132\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=16935\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=16709\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=11798\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=18937\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=17457\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=17015\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=17467\n\nFile: python3.12.info,  Node: venv<6>,  Next: wave<2>,  Prev: unittest<8>,  Up: Improved Modules<9>\n\n1.9.4.60 venv\n.............\n\n*note venv: 10c. now includes activation scripts for the 'csh' and\n'fish' shells.  (Contributed by Andrew Svetlov in bpo-15417(1).)\n\n*note EnvBuilder: e5b. and the *note create(): e5c. convenience function\ntake a new keyword argument 'withpip', which defaults to 'False', that\ncontrols whether or not *note EnvBuilder: e5b. ensures that 'pip' is\ninstalled in the virtual environment.  (Contributed by Nick Coghlan in\nbpo-19552(2) as part of the PEP 453(3) implementation.)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=15417\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=19552\n\n(3) https://peps.python.org/pep-0453/\n\nFile: python3.12.info,  Node: wave<2>,  Next: weakref<2>,  Prev: venv<6>,  Up: Improved Modules<9>\n\n1.9.4.61 wave\n.............\n",
            "subsections": []
        },
        "Dickinson in bpo-17643(3).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=14631\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=15528\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=17643\n\nFile: python3.12.info,  Node: xml etree<2>,  Next: zipfile<5>,  Prev: weakref<2>,  Up: Improved Modules<9>\n\n1.9.4.63 xml.etree\n..................\n\nA new parser, *note XMLPullParser: e66, allows a non-blocking\napplications to parse XML documents.  An example can be seen at *note",
            "subsections": []
        },
        "Pull API for non-blocking parsing: e67.  (Contributed by Antoine Pitrou": {
            "content": "in bpo-17741(1).)\n\nThe *note xml.etree.ElementTree: 120. *note tostring(): e68. and *note\ntostringlist(): e69. functions, and the *note ElementTree: 76e. *note\nwrite(): e6a. method, now have a 'shortemptyelements' *note\nkeyword-only parameter: 8b8. providing control over whether elements\nwith no content are written in abbreviated ('<tag />') or expanded\n('<tag></tag>') form.  (Contributed by Ariel Poliak and Serhiy Storchaka\nin bpo-14377(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=17741\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=14377\n\nFile: python3.12.info,  Node: zipfile<5>,  Prev: xml etree<2>,  Up: Improved Modules<9>\n\n1.9.4.64 zipfile\n................\n\nThe *note writepy(): e6c. method of the *note PyZipFile: e6d. class has\na new 'filterfunc' option that can be used to control which directories\nand files are added to the archive.  For example, this could be used to\nexclude test files from the archive.  (Contributed by Christian Tismer\nin bpo-19274(1).)\n\nThe 'allowZip64' parameter to *note ZipFile: 494. and 'PyZipfile' is now\n'True' by default.  (Contributed by William Mallard in bpo-17201(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=19274\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=17201\n\nFile: python3.12.info,  Node: CPython Implementation Changes,  Next: Deprecated<11>,  Prev: Improved Modules<9>,  Up: What's New In Python 3 4\n\n\n* Menu:\n\n* PEP 445; Customization of CPython Memory Allocators: PEP 445 Customization of CPython Memory Allocators.\n* PEP 442; Safe Object Finalization: PEP 442 Safe Object Finalization.\n* PEP 456; Secure and Interchangeable Hash Algorithm: PEP 456 Secure and Interchangeable Hash Algorithm.\n* PEP 436; Argument Clinic: PEP 436 Argument Clinic.\n* Other Build and C API Changes::\n* Other Improvements: Other Improvements<2>.\n* Significant Optimizations::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: PEP 445 Customization of CPython Memory Allocators,  Next: PEP 442 Safe Object Finalization,  Up: CPython Implementation Changes": {
            "content": "1.9.5.1 PEP 445: Customization of CPython Memory Allocators\n...........................................................\n\nPEP 445(1) adds new C level interfaces to customize memory allocation in\nthe CPython interpreter.\n\nSee also\n........\n\nPEP 445(2) - Add new APIs to customize Python memory allocators\n\nPEP written and implemented by Victor Stinner.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0445/\n\n(2) https://peps.python.org/pep-0445/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "1.9.5.2 PEP 442: Safe Object Finalization\n.........................................\n\nPEP 442(1) removes the current limitations and quirks of object\nfinalization in CPython.  With it, objects with 'del()' methods, as\nwell as generators with *note finally: 7ee. clauses, can be finalized\nwhen they are part of a reference cycle.\n",
            "subsections": []
        },
        "As part of this change, module globals are no longer forcibly set to": {
            "content": "*note None: 43f. during interpreter shutdown in most cases, instead\nrelying on the normal operation of the cyclic garbage collector.  This\navoids a whole class of interpreter-shutdown-time errors, usually\ninvolving 'del' methods, that have plagued Python since the cyclic\nGC was first introduced.\n\nSee also\n........\n\nPEP 442(2) - Safe object finalization\n\nPEP written and implemented by Antoine Pitrou.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0442/\n\n(2) https://peps.python.org/pep-0442/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: PEP 456 Secure and Interchangeable Hash Algorithm,  Next: PEP 436 Argument Clinic,  Prev: PEP 442 Safe Object Finalization,  Up: CPython Implementation Changes": {
            "content": "1.9.5.3 PEP 456: Secure and Interchangeable Hash Algorithm\n..........................................................\n\nPEP 456(1) follows up on earlier security fix work done on Python's hash\nalgorithm to address certain DOS attacks to which public facing APIs\nbacked by dictionary lookups may be subject.  (See bpo-14621(2) for the\nstart of the current round of improvements.)  The PEP unifies CPython's\nhash code to make it easier for a packager to substitute a different\nhash algorithm, and switches Python's default implementation to a",
            "subsections": []
        },
        "SipHash implementation on platforms that have a 64 bit data type.  Any": {
            "content": "performance differences in comparison with the older FNV algorithm are\ntrivial.\n\nThe PEP adds additional fields to the *note sys.hashinfo: e72. named\ntuple to describe the hash algorithm in use by the currently executing\nbinary.  Otherwise, the PEP does not alter any existing CPython APIs.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0456/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=14621\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "1.9.5.4 PEP 436: Argument Clinic\n................................\n\n\"Argument Clinic\" ( PEP 436(1)) is now part of the CPython build process\nand can be used to simplify the process of defining and maintaining\naccurate signatures for builtins and standard library extension modules\nimplemented in C.\n",
            "subsections": []
        },
        "Some standard library extension modules have been converted to use": {
            "content": "Argument Clinic in Python 3.4, and *note pydoc: b0. and *note inspect:\n78. have been updated accordingly.\n",
            "subsections": []
        },
        "It is expected that signature metadata for programmatic introspection": {
            "content": "will be added to additional callables implemented in C as part of Python\n3.4 maintenance releases.\n\nNote: The Argument Clinic PEP is not fully up to date with the\nstate of the implementation.  This has been deemed acceptable by\nthe release manager and core development team in this case, as\nArgument Clinic will not be made available as a public API for\nthird party use in Python 3.4.\n\nSee also\n........\n\nPEP 436(2) - The Argument Clinic DSL\n\nPEP written and implemented by Larry Hastings.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0436/\n\n(2) https://peps.python.org/pep-0436/\n\nFile: python3.12.info,  Node: Other Build and C API Changes,  Next: Other Improvements<2>,  Prev: PEP 436 Argument Clinic,  Up: CPython Implementation Changes\n\n1.9.5.5 Other Build and C API Changes\n.....................................\n\n* The new *note PyTypeGetSlot(): 6ad. function has been added to the\nstable ABI, allowing retrieval of function pointers from named type\nslots when using the limited API. (Contributed by Martin von Lo\"wis\nin bpo-17162(1).)\n\n* The new *note PySetStandardStreamEncoding(): e75.\npre-initialization API allows applications embedding the CPython\ninterpreter to reliably force a particular encoding and error\nhandler for the standard streams.  (Contributed by Bastien Montagne\nand Nick Coghlan in bpo-16129(2).)\n\n* Most Python C APIs that don't mutate string arguments are now\ncorrectly marked as accepting 'const char *' rather than 'char *'.\n(Contributed by Serhiy Storchaka in bpo-1772673(3).)\n\n* A new shell version of 'python-config' can be used even when a\npython interpreter is not available (for example, in cross\ncompilation scenarios).\n\n* *note PyUnicodeFromFormat(): 2d5. now supports width and precision\nspecifications for '%s', '%A', '%U', '%V', '%S', and '%R'.\n(Contributed by Ysj Ray and Victor Stinner in bpo-7330(4).)\n\n* New function *note PyStructSequenceInitType2(): e76. supplements\nthe existing *note PyStructSequenceInitType(): e77. function.  The\ndifference is that it returns '0' on success and '-1' on failure.\n\n* The CPython source can now be compiled using the address sanity\nchecking features of recent versions of GCC and clang: the false\nalarms in the small object allocator have been silenced.\n(Contributed by Dhiru Kholia in bpo-18596(5).)\n\n* The Windows build now uses Address Space Layout Randomization(6)\nand Data Execution Prevention(7).  (Contributed by Christian Heimes\nin bpo-16632(8).)\n\n* New function *note PyObjectLengthHint(): e78. is the C API\nequivalent of *note operator.lengthhint(): ddd.  (Contributed by\nArmin Ronacher in bpo-16148(9).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=17162\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=16129\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=1772673\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=7330\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=18596\n\n(6) https://en.wikipedia.org/wiki/Addressspacelayoutrandomization\n\n(7) https://en.wikipedia.org/wiki/DataExecutionPrevention\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=16632\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=16148\n\nFile: python3.12.info,  Node: Other Improvements<2>,  Next: Significant Optimizations,  Prev: Other Build and C API Changes,  Up: CPython Implementation Changes\n\n1.9.5.6 Other Improvements\n..........................\n\n* The *note python: e7b. command has a new *note option: e7c, '-I',\nwhich causes it to run in \"isolated mode\", which means that *note\nsys.path: 32c. contains neither the script's directory nor the\nuser's 'site-packages' directory, and all 'PYTHON*' environment\nvariables are ignored (it implies both '-s' and '-E').  Other\nrestrictions may also be applied in the future, with the goal being\nto isolate the execution of a script from the user's environment.\nThis is appropriate, for example, when Python is used to run a\nsystem script.  On most POSIX systems it can and should be used in\nthe '#!' line of system scripts.  (Contributed by Christian Heimes\nin bpo-16499(1).)\n\n* Tab-completion is now enabled by default in the interactive\ninterpreter on systems that support *note readline: b5.  History is\nalso enabled by default, and is written to (and read from) the file\n'~/.python-history'.  (Contributed by Antoine Pitrou and ??ric\nAraujo in bpo-5845(2).)\n\n* Invoking the Python interpreter with '--version' now outputs the\nversion to standard output instead of standard error\n(bpo-18338(3)).  Similar changes were made to *note argparse: 6.\n(bpo-18920(4)) and other modules that have script-like invocation\ncapabilities (bpo-18922(5)).\n\n* The CPython Windows installer now adds '.py' to the 'PATHEXT'\nvariable when extensions are registered, allowing users to run a\npython script at the windows command prompt by just typing its name\nwithout the '.py' extension.  (Contributed by Paul Moore in\nbpo-18569(6).)\n\n* A new 'make' target coverage-report(7) will build python, run the\ntest suite, and generate an HTML coverage report for the C codebase\nusing 'gcov' and lcov(8).\n\n* The '-R' option to the *note python regression test suite: e7d. now\nalso checks for memory allocation leaks, using *note\nsys.getallocatedblocks(): e38.  (Contributed by Antoine Pitrou in\nbpo-13390(9).)\n\n* 'python -m' now works with namespace packages.\n\n* The *note stat: cb. module is now implemented in C, which means it\ngets the values for its constants from the C header files, instead\nof having the values hard-coded in the python module as was\npreviously the case.\n\n* Loading multiple python modules from a single OS module ('.so',\n'.dll') now works correctly (previously it silently returned the\nfirst python module in the file).  (Contributed by V??clav ??milauer\nin bpo-16421(10).)\n\n* A new opcode, 'LOADCLASSDEREF', has been added to fix a bug in the\nloading of free variables in class bodies that could be triggered\nby certain uses of *note prepare: aa9.  (Contributed by\nBenjamin Peterson in bpo-17853(11).)\n\n* A number of MemoryError-related crashes were identified and fixed\nby Victor Stinner using his PEP 445(12)-based 'pyfailmalloc' tool\n(bpo-18408(13), bpo-18520(14)).\n\n* The 'pyvenv' command now accepts a '--copies' option to use copies\nrather than symlinks even on systems where symlinks are the\ndefault.  (Contributed by Vinay Sajip in bpo-18807(15).)\n\n* The 'pyvenv' command also accepts a '--without-pip' option to\nsuppress the otherwise-automatic bootstrapping of pip into the\nvirtual environment.  (Contributed by Nick Coghlan in bpo-19552(16)\nas part of the PEP 453(17) implementation.)\n\n* The encoding name is now optional in the value set for the *note\nPYTHONIOENCODING: e7e. environment variable.  This makes it\npossible to set just the error handler, without changing the\ndefault encoding.  (Contributed by Serhiy Storchaka in\nbpo-18818(18).)\n\n* The *note bz2: 11, *note lzma: 85, and *note gzip: 62. module\n'open' functions now support 'x' (exclusive creation) mode.\n(Contributed by Tim Heaney and Vajrasky Kok in bpo-19201(19),\nbpo-19222(20), and bpo-19223(21).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=16499\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=5845\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=18338\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=18920\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=18922\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=18569\n\n(7)\nhttps://devguide.python.org/coverage/#measuring-coverage-of-c-code-with-gcov-and-lcov\n\n(8) https://ltp.sourceforge.net/coverage/lcov.php\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=13390\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=16421\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=17853\n\n(12) https://peps.python.org/pep-0445/\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=18408\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=18520\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=18807\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=19552\n\n(17) https://peps.python.org/pep-0453/\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=18818\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=19201\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=19222\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=19223\n\nFile: python3.12.info,  Node: Significant Optimizations,  Prev: Other Improvements<2>,  Up: CPython Implementation Changes\n\n1.9.5.7 Significant Optimizations\n.................................\n\n* The UTF-32 decoder is now 3x to 4x faster.  (Contributed by Serhiy\nStorchaka in bpo-14625(1).)\n\n* The cost of hash collisions for sets is now reduced.  Each hash\ntable probe now checks a series of consecutive, adjacent key/hash\npairs before continuing to make random probes through the hash\ntable.  This exploits cache locality to make collision resolution\nless expensive.  The collision resolution scheme can be described\nas a hybrid of linear probing and open addressing.  The number of\nadditional linear probes defaults to nine.  This can be changed at\ncompile-time by defining LINEARPROBES to be any value.  Set\nLINEARPROBES=0 to turn-off linear probing entirely.  (Contributed\nby Raymond Hettinger in bpo-18771(2).)\n\n* The interpreter starts about 30% faster.  A couple of measures lead\nto the speedup.  The interpreter loads fewer modules on startup,\ne.g.  the *note re: b4, *note collections: 1b. and *note locale:\n81. modules and their dependencies are no longer imported by\ndefault.  The marshal module has been improved to load compiled\nPython code faster.  (Contributed by Antoine Pitrou, Christian\nHeimes and Victor Stinner in bpo-19219(3), bpo-19218(4),\nbpo-19209(5), bpo-19205(6) and bpo-9548(7).)\n\n* *note bz2.BZ2File: 775. is now as fast or faster than the Python2\nversion for most cases.  *note lzma.LZMAFile: e80. has also been\noptimized.  (Contributed by Serhiy Storchaka and Nadeem Vawda in\nbpo-16034(8).)\n\n* *note random.getrandbits(): e81. is 20%-40% faster for small\nintegers (the most common use case).  (Contributed by Serhiy\nStorchaka in bpo-16674(9).)\n\n* By taking advantage of the new storage format for strings, pickling\nof strings is now significantly faster.  (Contributed by Victor\nStinner and Antoine Pitrou in bpo-15596(10).)\n\n* A performance issue in 'io.FileIO.readall()' has been solved.  This\nparticularly affects Windows, and significantly speeds up the case\nof piping significant amounts of data through *note subprocess: d0.\n(Contributed by Richard Oudkerk in bpo-15758(11).)\n\n* *note html.escape(): e82. is now 10x faster.  (Contributed by Matt\nBryant in bpo-18020(12).)\n\n* On Windows, the native 'VirtualAlloc' is now used instead of the\nCRT 'malloc' in 'obmalloc'.  Artificial benchmarks show about a 3%\nmemory savings.\n\n* *note os.urandom(): 276. now uses a lazily opened persistent file\ndescriptor so as to avoid using many file descriptors when run in\nparallel from multiple threads.  (Contributed by Antoine Pitrou in\nbpo-18756(13).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=14625\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=18771\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=19219\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=19218\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=19209\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=19205\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=9548\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=16034\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=16674\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=15596\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=15758\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=18020\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=18756\n\nFile: python3.12.info,  Node: Deprecated<11>,  Next: Removed<11>,  Prev: CPython Implementation Changes,  Up: What's New In Python 3 4\n\n",
            "subsections": []
        },
        "This section covers various APIs and other features that have been": {
            "content": "deprecated in Python 3.4, and will be removed in Python 3.5 or later.",
            "subsections": []
        },
        "In most (but not all) cases, using the deprecated APIs will produce a": {
            "content": "*note DeprecationWarning: 179. when the interpreter is run with\ndeprecation warnings enabled (for example, by using '-Wd').\n\n* Menu:\n\n* Deprecations in the Python API::\n* Deprecated Features::\n\nFile: python3.12.info,  Node: Deprecations in the Python API,  Next: Deprecated Features,  Up: Deprecated<11>\n\n1.9.6.1 Deprecations in the Python API\n......................................\n\n* As mentioned in *note PEP 451; A ModuleSpec Type for the Import\nSystem: d40, a number of *note importlib: 71. methods and functions\nare deprecated: 'importlib.findloader()' is replaced by *note\nimportlib.util.findspec(): 230.;\n'importlib.machinery.PathFinder.findmodule()' is replaced by *note\nimportlib.machinery.PathFinder.findspec(): e85.;\n'importlib.abc.MetaPathFinder.findmodule()' is replaced by *note\nimportlib.abc.MetaPathFinder.findspec(): 666.;\n'importlib.abc.PathEntryFinder.findloader()' and 'findmodule()'\nare replaced by *note importlib.abc.PathEntryFinder.findspec():\n667.; all of the 'XXXLoader' ABC 'loadmodule' methods\n('importlib.abc.Loader.loadmodule()',\n'importlib.abc.InspectLoader.loadmodule()',\n'importlib.abc.FileLoader.loadmodule()',\n'importlib.abc.SourceLoader.loadmodule()') should no longer be\nimplemented, instead loaders should implement an 'execmodule'\nmethod (*note importlib.abc.Loader.execmodule(): 664, *note\nimportlib.abc.InspectLoader.execmodule(): e86. *note\nimportlib.abc.SourceLoader.execmodule(): e87.) and let the import\nsystem take care of the rest; and\n'importlib.abc.Loader.modulerepr()',\n'importlib.util.moduleforloader()',\n'importlib.util.setloader()', and 'importlib.util.setpackage()'\nare no longer needed because their functions are now handled\nautomatically by the import system.\n\n* The 'imp' module is pending deprecation.  To keep compatibility\nwith Python 2/3 code bases, the module's removal is currently not\nscheduled.\n\n* The 'formatter' module is pending deprecation and is slated for\nremoval in Python 3.6.\n\n* 'MD5' as the default 'digestmod' for the *note hmac.new(): 8d3.\nfunction is deprecated.  Python 3.6 will require an explicit digest\nname or constructor as 'digestmod' argument.\n\n* The internal 'Netrc' class in the *note ftplib: 59. module has been\ndocumented as deprecated in its docstring for quite some time.  It\nnow emits a *note DeprecationWarning: 179. and will be removed\ncompletely in Python 3.5.\n\n* The undocumented 'endtime' argument to *note\nsubprocess.Popen.wait(): b33. should not have been exposed and is\nhopefully not in use; it is deprecated and will mostly likely be\nremoved in Python 3.5.\n\n* The 'strict' argument of *note HTMLParser: 682. is deprecated.\n\n* The *note plistlib: a6. 'readPlist()', 'writePlist()',\n'readPlistFromBytes()', and 'writePlistToBytes()' functions are\ndeprecated in favor of the corresponding new functions *note\nload(): 76f, *note dump(): 771, *note loads(): 770, and *note\ndumps(): 772.  'Data()' is deprecated in favor of just using the\n*note bytes: 295. constructor.\n\n* The *note sysconfig: d5. key 'SO' is deprecated, it has been\nreplaced by 'EXTSUFFIX'.\n\n* The 'U' mode accepted by various 'open' functions is deprecated.\nIn Python3 it does not do anything useful, and should be replaced\nby appropriate uses of *note io.TextIOWrapper: b8f. (if needed) and\nits 'newline' argument.\n\n* The 'parser' argument of *note xml.etree.ElementTree.iterparse():\ne88. has been deprecated, as has the 'html' argument of *note\nXMLParser(): 880.  To prepare for the removal of the latter, all\narguments to 'XMLParser' should be passed by keyword.\n\nFile: python3.12.info,  Node: Deprecated Features,  Prev: Deprecations in the Python API,  Up: Deprecated<11>\n\n1.9.6.2 Deprecated Features\n...........................\n\n* Running *note IDLE: e8a. with the '-n' flag (no subprocess) is\ndeprecated.  However, the feature will not be removed until\nbpo-18823(1) is resolved.\n\n* The site module adding a \"site-python\" directory to sys.path, if it\nexists, is deprecated (bpo-19375(2)).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=18823\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=19375\n\nFile: python3.12.info,  Node: Removed<11>,  Next: Porting to Python 3 4,  Prev: Deprecated<11>,  Up: What's New In Python 3 4\n\n\n* Menu:\n\n* Operating Systems No Longer Supported::\n* API and Feature Removals: API and Feature Removals<5>.\n* Code Cleanups::\n\nFile: python3.12.info,  Node: Operating Systems No Longer Supported,  Next: API and Feature Removals<5>,  Up: Removed<11>\n\n1.9.7.1 Operating Systems No Longer Supported\n.............................................\n",
            "subsections": []
        },
        "Support for the following operating systems has been removed from the": {
            "content": "source and build tools:\n\n* OS/2 (bpo-16135(1)).\n\n* Windows 2000 (changeset e52df05b496a).\n\n* Windows systems where 'COMSPEC' points to 'command.com'\n(bpo-14470(2)).\n\n* VMS (bpo-16136(3)).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=16135\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=14470\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=16136\n\nFile: python3.12.info,  Node: API and Feature Removals<5>,  Next: Code Cleanups,  Prev: Operating Systems No Longer Supported,  Up: Removed<11>\n\n1.9.7.2 API and Feature Removals\n................................\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Changed in 3 4 3,  Prev: Porting to Python 3 4,  Up: What's New In Python 3 4": {
            "content": "* Menu:\n\n* PEP 476; Enabling certificate verification by default for stdlib http clients: PEP 476 Enabling certificate verification by default for stdlib http clients.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: PEP 476 Enabling certificate verification by default for stdlib http clients,  Up: Changed in 3 4 3": {
            "content": "1.9.9.1 PEP 476: Enabling certificate verification by default for stdlib http clients\n.....................................................................................\n\n*note http.client: 6a. and modules which use it, such as *note\nurllib.request: 106. and *note xmlrpc.client: 128, will now verify that\nthe server presents a certificate which is signed by a CA in the\nplatform trust store and whose hostname matches the hostname being\nrequested by default, significantly improving security for many\napplications.\n",
            "subsections": []
        },
        "For applications which require the old previous behavior, they can pass": {
            "content": "an alternate context:\n\nimport urllib2\nimport ssl\n\n# This disables all verification\ncontext = ssl.createunverifiedcontext()\n\n# This allows using a specific certificate for the host, which doesn't need\n# to be in the trust store\ncontext = ssl.createdefaultcontext(cafile=\"/path/to/file.crt\")\n\nurllib2.urlopen(\"https://invalid-cert\", context=context)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0476/\n\nFile: python3.12.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\n\n1.14.15.8 PEP 493: HTTPS verification migration tools for Python 2.7\n....................................................................\n\nPEP 493(1) provides additional migration tools to support a more\nincremental infrastructure upgrade process for environments containing\napplications and services relying on the historically permissive\nprocessing of server certificates when establishing client HTTPS\nconnections.  These additions were made in the Python 2.7.12 release.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": [
                {
                    "name": "1.10 What's New In Python 3.3",
                    "content": "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": {
            "content": "the changelog(1).\n\nSee also\n........\n\nPEP 398(2) - Python 3.3 Release Schedule\n\n* Menu:\n\n* Summary - Release highlights: Summary - Release highlights<8>.\n* PEP 405; Virtual Environments: PEP 405 Virtual Environments.\n* PEP 420; Implicit Namespace Packages: PEP 420 Implicit Namespace Packages.\n* PEP 3118; New memoryview implementation and buffer protocol documentation: PEP 3118 New memoryview implementation and buffer protocol documentation.\n* PEP 393; Flexible String Representation: PEP 393 Flexible String Representation.\n* PEP 397; Python Launcher for Windows: PEP 397 Python Launcher for Windows.\n* PEP 3151; Reworking the OS and IO exception hierarchy: PEP 3151 Reworking the OS and IO exception hierarchy.\n* PEP 380; Syntax for Delegating to a Subgenerator: PEP 380 Syntax for Delegating to a Subgenerator.\n* PEP 409; Suppressing exception context: PEP 409 Suppressing exception context.\n* PEP 414; Explicit Unicode literals: PEP 414 Explicit Unicode literals.\n* PEP 3155; Qualified name for classes and functions: PEP 3155 Qualified name for classes and functions.\n* PEP 412; Key-Sharing Dictionary: PEP 412 Key-Sharing Dictionary.\n* PEP 362; Function Signature Object: PEP 362 Function Signature Object.\n* PEP 421; Adding sys.implementation: PEP 421 Adding sys implementation.\n* Using importlib as the Implementation of Import::\n* Other Language Changes: Other Language Changes<10>.\n* A Finer-Grained Import Lock::\n* Builtin functions and types::\n* New Modules: New Modules<10>.\n* Improved Modules: Improved Modules<10>.\n* Optimizations: Optimizations<9>.\n* Build and C API Changes: Build and C API Changes<4>.\n* Deprecated: Deprecated<12>.\n* Porting to Python 3.3: Porting to Python 3 3.\n\n---------- Footnotes ----------\n\n(1) https://docs.python.org/3.3/whatsnew/changelog.html\n\n(2) https://peps.python.org/pep-0398/\n\nFile: python3.12.info,  Node: Summary - Release highlights<8>,  Next: PEP 405 Virtual Environments,  Up: What's New In Python 3 3\n\n\nNew syntax features:\n\n* New 'yield from' expression for *note generator delegation: eb2.\n\n* The 'u'unicode'' syntax is accepted again for *note str: 157.\nobjects.\n\nNew library modules:\n\n* *note faulthandler: 53. (helps debugging low-level crashes)\n\n* *note ipaddress: 7a. (high-level objects representing IP addresses\nand masks)\n\n* *note lzma: 85. (compress data using the XZ / LZMA algorithm)\n\n* *note unittest.mock: 102. (replace parts of your system under test\nwith mock objects)\n\n* *note venv: 10c. (Python *note virtual environments: eb3, as in the\npopular 'virtualenv' package)\n\nNew built-in features:\n\n* Reworked *note I/O exception hierarchy: eb4.\n\nImplementation improvements:\n\n* Rewritten *note import machinery: eb5. based on *note importlib:\n71.\n\n* More compact *note unicode strings: eb6.\n\n* More compact *note attribute dictionaries: eb7.\n\nSignificantly Improved Library Modules:\n\n* C Accelerator for the *note decimal: eb8. module.\n\n* Better unicode handling in the *note email: eb9. module (*note\nprovisional: eba.).\n\nSecurity improvements:\n\n* Hash randomization is switched on by default.\n\nPlease read on for a comprehensive list of user-facing changes.\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "Virtual environments help create separate Python setups while sharing a": {
            "content": "system-wide base install, for ease of maintenance.  Virtual environments\nhave their own set of private site packages (i.e.  locally installed\nlibraries), and are optionally segregated from the system-wide site\npackages.  Their concept and implementation are inspired by the popular\n'virtualenv' third-party package, but benefit from tighter integration\nwith the interpreter core.\n\nThis PEP adds the *note venv: 10c. module for programmatic access, and\nthe 'pyvenv' script for command-line access and administration.  The",
            "subsections": []
        },
        "Python interpreter checks for a 'pyvenv.cfg', file whose existence": {
            "content": "signals the base of a virtual environment's directory tree.\n\nSee also\n........\n\nPEP 405(1) - Python Virtual Environments\n\nPEP written by Carl Meyer; implementation by Carl Meyer and Vinay\nSajip\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0405/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "Native support for package directories that don't require 'init.py'": {
            "content": "marker files and can automatically span multiple path segments (inspired\nby various third party approaches to namespace packages, as described in\nPEP 420(1))\n\nSee also\n........\n\nPEP 420(2) - Implicit Namespace Packages\n\nPEP written by Eric V. Smith; implementation by Eric V. Smith and\nBarry Warsaw\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0420/\n\n(2) https://peps.python.org/pep-0420/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "The implementation of PEP 3118(1) has been significantly improved.\n",
            "subsections": []
        },
        "The new memoryview implementation comprehensively fixes all ownership": {
            "content": "and lifetime issues of dynamically allocated fields in the Pybuffer\nstruct that led to multiple crash reports.  Additionally, several\nfunctions that crashed or returned incorrect results for non-contiguous\nor multi-dimensional input have been fixed.\n",
            "subsections": []
        },
        "The memoryview object now has a PEP-3118 compliant getbufferproc() that": {
            "content": "checks the consumer's request type.  Many new features have been added,\nmost of them work in full generality for non-contiguous arrays and\narrays with suboffsets.\n",
            "subsections": []
        },
        "The documentation has been updated, clearly spelling out": {
            "content": "responsibilities for both exporters and consumers.  Buffer request flags\nare grouped into basic and compound flags.  The memory layout of\nnon-contiguous and multi-dimensional NumPy-style arrays is explained.\n\n* Menu:\n\n* Features::\n* API changes::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3118/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Features,  Next: API changes,  Up: PEP 3118 New memoryview implementation and buffer protocol documentation": {
            "content": "1.10.4.1 Features\n.................\n\n* All native single character format specifiers in struct module\nsyntax (optionally prefixed with '@') are now supported.\n\n* With some restrictions, the cast() method allows changing of format\nand shape of C-contiguous arrays.\n\n* Multi-dimensional list representations are supported for any array\ntype.\n\n* Multi-dimensional comparisons are supported for any array type.\n\n* One-dimensional memoryviews of hashable (read-only) types with\nformats B, b or c are now hashable.  (Contributed by Antoine Pitrou\nin bpo-13411(1).)\n\n* Arbitrary slicing of any 1-D arrays type is supported.  For\nexample, it is now possible to reverse a memoryview in 'O'(1) by\nusing a negative step.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=13411\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: API changes,  Prev: Features,  Up: PEP 3118 New memoryview implementation and buffer protocol documentation": {
            "content": "1.10.4.2 API changes\n....................\n\n* The maximum number of dimensions is officially limited to 64.\n\n* The representation of empty shape, strides and suboffsets is now an\nempty tuple instead of 'None'.\n\n* Accessing a memoryview element with format 'B' (unsigned bytes) now\nreturns an integer (in accordance with the struct module syntax).\nFor returning a bytes object the view must be cast to 'c' first.\n\n* memoryview comparisons now use the logical structure of the\noperands and compare all array elements by value.  All format\nstrings in struct module syntax are supported.  Views with\nunrecognised format strings are still permitted, but will always\ncompare as unequal, regardless of view contents.\n\n* For further changes see *note Build and C API Changes: ec1. and\n*note Porting C code: ec2.\n\n(Contributed by Stefan Krah in bpo-10181(1).)\n\nSee also\n........\n\nPEP 3118(2) - Revising the Buffer Protocol\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=10181\n\n(2) https://peps.python.org/pep-3118/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "The Unicode string type is changed to support multiple internal": {
            "content": "representations, depending on the character with the largest Unicode\nordinal (1, 2, or 4 bytes) in the represented string.  This allows a\nspace-efficient representation in common cases, but gives access to full\nUCS-4 on all systems.  For compatibility with existing APIs, several\nrepresentations may exist in parallel; over time, this compatibility\nshould be phased out.\n\nOn the Python side, there should be no downside to this change.\n",
            "subsections": []
        },
        "On the C API side, PEP 393(1) is fully backward compatible.  The legacy": {
            "content": "API should remain available at least five years.  Applications using the\nlegacy API will not fully benefit of the memory reduction, or - worse -\nmay use a bit more memory, because Python may have to maintain two\nversions of each string (in the legacy format and in the new efficient\nstorage).\n\n* Menu:\n\n* Functionality::\n* Performance and resource usage::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0393/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Functionality,  Next: Performance and resource usage,  Up: PEP 393 Flexible String Representation": {
            "content": "1.10.5.1 Functionality\n......................\n\nChanges introduced by PEP 393(1) are the following:\n\n* Python now always supports the full range of Unicode code points,\nincluding non-BMP ones (i.e.  from 'U+0000' to 'U+10FFFF').  The\ndistinction between narrow and wide builds no longer exists and\nPython now behaves like a wide build, even under Windows.\n\n* With the death of narrow builds, the problems specific to narrow\nbuilds have also been fixed, for example:\n\n* *note len(): 3fb. now always returns 1 for non-BMP characters,\nso 'len('\\U0010FFFF') == 1';\n\n* surrogate pairs are not recombined in string literals, so\n''\\uDBFF\\uDFFF' != '\\U0010FFFF'';\n\n* indexing or slicing non-BMP characters returns the expected\nvalue, so ''\\U0010FFFF'[0]' now returns ''\\U0010FFFF'' and not\n''\\uDBFF'';\n\n* all other functions in the standard library now correctly\nhandle non-BMP code points.\n\n* The value of *note sys.maxunicode: ec5. is now always '1114111'\n('0x10FFFF' in hexadecimal).  The 'PyUnicodeGetMax()' function\nstill returns either '0xFFFF' or '0x10FFFF' for backward\ncompatibility, and it should not be used with the new Unicode API\n(see bpo-13054(2)).\n\n* The './configure' flag '--with-wide-unicode' has been removed.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0393/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=13054\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Performance and resource usage,  Prev: Functionality,  Up: PEP 393 Flexible String Representation": {
            "content": "1.10.5.2 Performance and resource usage\n.......................................\n",
            "subsections": []
        },
        "The storage of Unicode strings now depends on the highest code point in": {
            "content": "the string:\n\n* pure ASCII and Latin1 strings ('U+0000-U+00FF') use 1 byte per code\npoint;\n\n* BMP strings ('U+0000-U+FFFF') use 2 bytes per code point;\n\n* non-BMP strings ('U+10000-U+10FFFF') use 4 bytes per code point.\n",
            "subsections": []
        },
        "The net effect is that for most applications, memory usage of string": {
            "content": "storage should decrease significantly - especially compared to former\nwide unicode builds - as, in many cases, strings will be pure ASCII even\nin international contexts (because many strings store non-human language\ndata, such as XML fragments, HTTP headers, JSON-encoded data, etc.).  We\nalso hope that it will, for the same reasons, increase CPU cache\nefficiency on non-trivial applications.  The memory usage of Python 3.3\nis two to three times smaller than Python 3.2, and a little bit better\nthan Python 2.7, on a Django benchmark (see the PEP for details).\n\nSee also\n........\n\nPEP 393(1) - Flexible String Representation\n\nPEP written by Martin von Lo\"wis; implementation by Torsten Becker\nand Martin von Lo\"wis.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0393/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "The Python 3.3 Windows installer now includes a 'py' launcher": {
            "content": "application that can be used to launch Python applications in a version\nindependent fashion.\n\nThis launcher is invoked implicitly when double-clicking '*.py' files.",
            "subsections": []
        },
        "If only a single Python version is installed on the system, that version": {
            "content": "will be used to run the file.  If multiple versions are installed, the\nmost recent version is used by default, but this can be overridden by\nincluding a Unix-style \"shebang line\" in the Python script.\n",
            "subsections": []
        },
        "The launcher can also be used explicitly from the command line as the": {
            "content": "'py' application.  Running 'py' follows the same version selection rules\nas implicitly launching scripts, but a more specific version can be\nselected by passing appropriate arguments (such as '-3' to request",
            "subsections": []
        },
        "Python 3 when Python 2 is also installed, or '-2.6' to specifically": {
            "content": "request an earlier Python version when a more recent version is\ninstalled).\n",
            "subsections": []
        },
        "In addition to the launcher, the Windows installer now includes an": {
            "content": "option to add the newly installed Python to the system PATH.\n(Contributed by Brian Curtin in bpo-3561(1).)\n\nSee also\n........\n\nPEP 397(2) - Python Launcher for Windows\n\nPEP written by Mark Hammond and Martin v.  Lo\"wis; implementation by\nVinay Sajip.\n\nLauncher documentation: *note Python Launcher for Windows: 37f.\n\nInstaller PATH modification: *note Finding the Python executable: ec9.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=3561\n\n(2) https://peps.python.org/pep-0397/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "The hierarchy of exceptions raised by operating system errors is now": {
            "content": "both simplified and finer-grained.\n",
            "subsections": []
        },
        "You don't have to worry anymore about choosing the appropriate exception": {
            "content": "type between *note OSError: 613, *note IOError: ecb, *note\nEnvironmentError: ecc, *note WindowsError: ecd, 'mmap.error', *note\nsocket.error: ece. or *note select.error: ecf.  All these exception\ntypes are now only one: *note OSError: 613.  The other names are kept as\naliases for compatibility reasons.\n",
            "subsections": []
        },
        "Also, it is now easier to catch a specific error condition.  Instead of": {
            "content": "inspecting the 'errno' attribute (or 'args[0]') for a particular\nconstant from the *note errno: 52. module, you can catch the adequate\n*note OSError: 613. subclass.  The available subclasses are the\nfollowing:\n\n* *note BlockingIOError: ed0.\n\n* *note ChildProcessError: ed1.\n\n* *note ConnectionError: c67.\n\n* *note FileExistsError: e97.\n\n* *note FileNotFoundError: 353.\n\n* *note InterruptedError: be3.\n\n* *note IsADirectoryError: ed2.\n\n* *note NotADirectoryError: ed3.\n\n* *note PermissionError: b9a.\n\n* *note ProcessLookupError: ed4.\n\n* *note TimeoutError: 62a.\n\nAnd the *note ConnectionError: c67. itself has finer-grained subclasses:\n\n* *note BrokenPipeError: ed5.\n\n* *note ConnectionAbortedError: ed6.\n\n* *note ConnectionRefusedError: ed7.\n\n* *note ConnectionResetError: ed8.\n\nThanks to the new exceptions, common usages of the *note errno: 52. can\nnow be avoided.  For example, the following code written for Python 3.2:\n\nfrom errno import ENOENT, EACCES, EPERM\n\ntry:\nwith open(\"document.txt\") as f:\ncontent = f.read()\nexcept IOError as err:\nif err.errno == ENOENT:\nprint(\"document.txt file is missing\")\nelif err.errno in (EACCES, EPERM):\nprint(\"You are not allowed to read document.txt\")\nelse:\nraise\n\ncan now be written without the *note errno: 52. import and without\nmanual inspection of exception attributes:\n\ntry:\nwith open(\"document.txt\") as f:\ncontent = f.read()\nexcept FileNotFoundError:\nprint(\"document.txt file is missing\")\nexcept PermissionError:\nprint(\"You are not allowed to read document.txt\")\n\nSee also\n........\n\nPEP 3151(1) - Reworking the OS and IO Exception Hierarchy\n\nPEP written and implemented by Antoine Pitrou\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3151/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "PEP 380 adds the 'yield from' expression, allowing a *note generator:\neda. to delegate part of its operations to another generator.  This\nallows a section of code containing *note yield: 7f1. to be factored out\nand placed in another generator.  Additionally, the subgenerator is\nallowed to return with a value, and the value is made available to the\ndelegating generator.\n",
            "subsections": []
        },
        "While designed primarily for use in delegating to a subgenerator, the": {
            "content": "'yield from' expression actually allows delegation to arbitrary\nsubiterators.\n",
            "subsections": []
        },
        "For simple iterators, 'yield from iterable' is essentially just a": {
            "content": "shortened form of 'for item in iterable: yield item':\n\n>>> def g(x):\n...     yield from range(x, 0, -1)\n...     yield from range(x)\n...\n>>> list(g(5))\n[5, 4, 3, 2, 1, 0, 1, 2, 3, 4]\n",
            "subsections": []
        },
        "However, unlike an ordinary loop, 'yield from' allows subgenerators to": {
            "content": "receive sent and thrown values directly from the calling scope, and\nreturn a final value to the outer generator:\n\n>>> def accumulate():\n...     tally = 0\n...     while 1:\n...         next = yield\n...         if next is None:\n...             return tally\n...         tally += next\n...\n>>> def gathertallies(tallies):\n...     while 1:\n...         tally = yield from accumulate()\n...         tallies.append(tally)\n...\n>>> tallies = []\n>>> acc = gathertallies(tallies)\n>>> next(acc)  # Ensure the accumulator is ready to accept values\n>>> for i in range(4):\n...     acc.send(i)\n...\n>>> acc.send(None)  # Finish the first tally\n>>> for i in range(5):\n...     acc.send(i)\n...\n>>> acc.send(None)  # Finish the second tally\n>>> tallies\n[6, 10]\n",
            "subsections": []
        },
        "The main principle driving this change is to allow even generators that": {
            "content": "are designed to be used with the 'send' and 'throw' methods to be split\ninto multiple subgenerators as easily as a single large function can be\nsplit into multiple subfunctions.\n\nSee also\n........\n\nPEP 380(1) - Syntax for Delegating to a Subgenerator\n\nPEP written by Greg Ewing; implementation by Greg Ewing, integrated\ninto 3.3 by Renaud Blanch, Ryan Kelly and Nick Coghlan;\ndocumentation by Zbigniew J??drzejewski-Szmek and Nick Coghlan\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0380/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "PEP 409 introduces new syntax that allows the display of the chained\nexception context to be disabled.  This allows cleaner error messages in\napplications that convert between exception types:\n\n>>> class D:\n...     def init(self, extra):\n...         self.extraattributes = extra\n...     def getattr(self, attr):\n...         try:\n...             return self.extraattributes[attr]\n...         except KeyError:\n...             raise AttributeError(attr) from None\n...\n>>> D({}).x\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nFile \"<stdin>\", line 8, in getattr\nAttributeError: x\n",
            "subsections": []
        },
        "Without the 'from None' suffix to suppress the cause, the original": {
            "content": "exception would be displayed by default:\n\n>>> class C:\n...     def init(self, extra):\n...         self.extraattributes = extra\n...     def getattr(self, attr):\n...         try:\n...             return self.extraattributes[attr]\n...         except KeyError:\n...             raise AttributeError(attr)\n...\n>>> C({}).x\nTraceback (most recent call last):\nFile \"<stdin>\", line 6, in getattr\nKeyError: 'x'\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nFile \"<stdin>\", line 8, in getattr\nAttributeError: x\n",
            "subsections": []
        },
        "No debugging capability is lost, as the original exception context": {
            "content": "remains available if needed (for example, if an intervening library has\nincorrectly suppressed valuable underlying details):\n\n>>> try:\n...     D({}).x\n... except AttributeError as exc:\n...     print(repr(exc.context))\n...\nKeyError('x',)\n\nSee also\n........\n\nPEP 409(1) - Suppressing exception context\n\nPEP written by Ethan Furman; implemented by Ethan Furman and Nick\nCoghlan.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0409/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "To ease the transition from Python 2 for Unicode aware Python": {
            "content": "applications that make heavy use of Unicode literals, Python 3.3 once\nagain supports the \"'u'\" prefix for string literals.  This prefix has no\nsemantic significance in Python 3, it is provided solely to reduce the\nnumber of purely mechanical changes in migrating to Python 3, making it\neasier for developers to focus on the more significant semantic changes\n(such as the stricter default separation of binary and text data).\n\nSee also\n........\n\nPEP 414(1) - Explicit Unicode literals\n\nPEP written by Armin Ronacher.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0414/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "Functions and class objects have a new 'qualname' attribute": {
            "content": "representing the \"path\" from the module top-level to their definition.",
            "subsections": []
        },
        "For global functions and classes, this is the same as 'name'.  For": {
            "content": "other functions and classes, it provides better information about where\nthey were actually defined, and how they might be accessible from the\nglobal scope.\n\nExample with (non-bound) methods:\n\n>>> class C:\n...     def meth(self):\n...         pass\n...\n>>> C.meth.name\n'meth'\n>>> C.meth.qualname\n'C.meth'\n\nExample with nested classes:\n\n>>> class C:\n...     class D:\n...         def meth(self):\n...             pass\n...\n>>> C.D.name\n'D'\n>>> C.D.qualname\n'C.D'\n>>> C.D.meth.name\n'meth'\n>>> C.D.meth.qualname\n'C.D.meth'\n\nExample with nested functions:\n\n>>> def outer():\n...     def inner():\n...         pass\n...     return inner\n...\n>>> outer().name\n'inner'\n>>> outer().qualname\n'outer.<locals>.inner'\n",
            "subsections": []
        },
        "The string representation of those objects is also changed to include": {
            "content": "the new, more precise information:\n\n>>> str(C.D)\n\"<class 'main.C.D'>\"\n>>> str(C.D.meth)\n'<function C.D.meth at 0x7f46b9fe31e0>'\n\nSee also\n........\n\nPEP 3155(1) - Qualified name for classes and functions\n\nPEP written and implemented by Antoine Pitrou.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3155/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "Dictionaries used for the storage of objects' attributes are now able to": {
            "content": "share part of their internal storage between each other (namely, the\npart which stores the keys and their respective hashes).  This reduces\nthe memory consumption of programs creating many instances of\nnon-builtin types.\n\nSee also\n........\n\nPEP 412(1) - Key-Sharing Dictionary\n\nPEP written and implemented by Mark Shannon.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0412/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "A new function *note inspect.signature(): 51c. makes introspection of\npython callables easy and straightforward.  A broad range of callables\nis supported: python functions, decorated or not, classes, and *note\nfunctools.partial(): d31. objects.  New classes *note inspect.Signature:\n51e, *note inspect.Parameter: c73. and *note inspect.BoundArguments:\nee0. hold information about the call signatures, such as, annotations,\ndefault values, parameters kinds, and bound arguments, which\nconsiderably simplifies writing decorators and any code that validates\nor amends calling signatures or arguments.\n\nSee also\n........\n\nPEP 362(1): - Function Signature Object\n\nPEP written by Brett Cannon, Yury Selivanov, Larry Hastings, Jiwon\nSeo; implemented by Yury Selivanov.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0362/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "A new attribute on the *note sys: d3. module exposes details specific to\nthe implementation of the currently running interpreter.  The initial\nset of attributes on *note sys.implementation: 269. are 'name',\n'version', 'hexversion', and 'cachetag'.\n",
            "subsections": []
        },
        "The intention of 'sys.implementation' is to consolidate into one": {
            "content": "namespace the implementation-specific data used by the standard library.",
            "subsections": []
        },
        "This allows different Python implementations to share a single standard": {
            "content": "library code base much more easily.  In its initial state,\n'sys.implementation' holds only a small portion of the\nimplementation-specific data.  Over time that ratio will shift in order\nto make the standard library more portable.\n",
            "subsections": []
        },
        "One example of improved standard library portability is 'cachetag'.  As": {
            "content": "of Python 3.3, 'sys.implementation.cachetag' is used by *note\nimportlib: 71. to support PEP 3147(1) compliance.  Any Python\nimplementation that uses 'importlib' for its built-in import system may\nuse 'cachetag' to control the caching behavior for modules.\n\n* Menu:\n\n* SimpleNamespace::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3147/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: SimpleNamespace,  Up: PEP 421 Adding sys implementation": {
            "content": "1.10.14.1 SimpleNamespace\n.........................\n",
            "subsections": []
        },
        "The implementation of 'sys.implementation' also introduces a new type to": {
            "content": "Python: *note types.SimpleNamespace: 745.  In contrast to a\nmapping-based namespace, like *note dict: 237, 'SimpleNamespace' is\nattribute-based, like *note object: 8bb.  However, unlike 'object',\n'SimpleNamespace' instances are writable.  This means that you can add,\nremove, and modify the namespace through normal attribute access.\n\nSee also\n........\n\nPEP 421(1) - Adding sys.implementation\n\nPEP written and implemented by Eric Snow.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0421/\n\nFile: python3.12.info,  Node: Using importlib as the Implementation of Import,  Next: Other Language Changes<10>,  Prev: PEP 421 Adding sys implementation,  Up: What's New In Python 3 3\n\n\nbpo-2377(1) - Replace import w/ importlib.import bpo-13959(2) -",
            "subsections": []
        },
        "Re-implement parts of 'imp' in pure Python bpo-14605(3) - Make import": {
            "content": "machinery explicit bpo-14646(4) - Require loaders set loader and\npackage\n\nThe *note import(): 6ed. function is now powered by *note\nimportlib.import(): ee4.  This work leads to the completion of\n\"phase 2\" of PEP 302(5).  There are multiple benefits to this change.",
            "subsections": []
        },
        "First, it has allowed for more of the machinery powering import to be": {
            "content": "exposed instead of being implicit and hidden within the C code.  It also\nprovides a single implementation for all Python VMs supporting Python\n3.3 to use, helping to end any VM-specific deviations in import\nsemantics.  And finally it eases the maintenance of import, allowing for\nfuture growth to occur.\n\nFor the common user, there should be no visible change in semantics.",
            "subsections": []
        },
        "For those whose code currently manipulates import or calls import": {
            "content": "programmatically, the code changes that might possibly be required are\ncovered in the *note Porting Python code: ee5. section of this document.\n\n* Menu:\n\n* New APIs::\n* Visible Changes::\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=2377\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=13959\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=14605\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=14646\n\n(5) https://peps.python.org/pep-0302/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: New APIs,  Next: Visible Changes,  Up: Using importlib as the Implementation of Import": {
            "content": "1.10.15.1 New APIs\n..................\n",
            "subsections": []
        },
        "One of the large benefits of this work is the exposure of what goes into": {
            "content": "making the import statement work.  That means the various importers that\nwere once implicit are now fully exposed as part of the *note importlib:\n71. package.\n\nThe abstract base classes defined in *note importlib.abc: 72. have been\nexpanded to properly delineate between *note meta path finders: ee7. and\n*note path entry finders: ee8. by introducing *note\nimportlib.abc.MetaPathFinder: 669. and *note\nimportlib.abc.PathEntryFinder: 66a, respectively.  The old ABC of\n'importlib.abc.Finder' is now only provided for backwards-compatibility\nand does not enforce any method requirements.\n\nIn terms of finders, *note importlib.machinery.FileFinder: ee9. exposes\nthe mechanism used to search for source and bytecode files of a module.\nPreviously this class was an implicit member of *note sys.pathhooks:\ne9b.\n\nFor loaders, the new abstract base class *note importlib.abc.FileLoader:\neea. helps write a loader that uses the file system as the storage\nmechanism for a module's code.  The loader for source files (*note\nimportlib.machinery.SourceFileLoader: eeb.), sourceless bytecode files\n(*note importlib.machinery.SourcelessFileLoader: eec.), and extension\nmodules (*note importlib.machinery.ExtensionFileLoader: aff.) are now\navailable for direct use.\n\n*note ImportError: 145. now has 'name' and 'path' attributes which are\nset when there is relevant data to provide.  The message for failed\nimports will also provide the full name of the module now instead of\njust the tail end of the module's name.\n\nThe *note importlib.invalidatecaches(): a56. function will now call the\nmethod with the same name on all finders cached in *note\nsys.pathimportercache: 3a9. to help clean up any stored state as\nnecessary.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Visible Changes,  Prev: New APIs,  Up: Using importlib as the Implementation of Import": {
            "content": "1.10.15.2 Visible Changes\n.........................\n\nFor potential required changes to code, see the *note Porting Python\ncode: ee5. section.\n\nBeyond the expanse of what *note importlib: 71. now exposes, there are\nother visible changes to import.  The biggest is that *note\nsys.metapath: b80. and *note sys.pathhooks: e9b. now store all of the\nmeta path finders and path entry hooks used by import.  Previously the\nfinders were implicit and hidden within the C code of import instead of\nbeing directly exposed.  This means that one can now easily remove or\nchange the order of the various finders to fit one's needs.\n",
            "subsections": []
        },
        "Another change is that all modules have a 'loader' attribute,": {
            "content": "storing the loader used to create the module.  PEP 302(1) has been\nupdated to make this attribute mandatory for loaders to implement, so in\nthe future once 3rd-party loaders have been updated people will be able\nto rely on the existence of the attribute.  Until such time, though,\nimport is setting the module post-load.\n",
            "subsections": []
        },
        "Loaders are also now expected to set the 'package' attribute from": {
            "content": "PEP 366(2).  Once again, import itself is already setting this on all\nloaders from *note importlib: 71. and import itself is setting the\nattribute post-load.\n\n'None' is now inserted into *note sys.pathimportercache: 3a9. when no\nfinder can be found on *note sys.pathhooks: e9b.  Since\n'imp.NullImporter' is not directly exposed on *note sys.pathhooks: e9b.\nit could no longer be relied upon to always be available to use as a\nvalue representing no finder found.\n",
            "subsections": []
        },
        "All other changes relate to semantic changes which should be taken into": {
            "content": "consideration when updating code for Python 3.3, and thus should be read\nabout in the *note Porting Python code: ee5. section of this document.\n\n(Implementation by Brett Cannon)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0302/\n\n(2) https://peps.python.org/pep-0366/\n\nFile: python3.12.info,  Node: Other Language Changes<10>,  Next: A Finer-Grained Import Lock,  Prev: Using importlib as the Implementation of Import,  Up: What's New In Python 3 3\n\n\nSome smaller changes made to the core Python language are:\n\n* Added support for Unicode name aliases and named sequences.  Both\n*note unicodedata.lookup(): eef. and ''\\N{...}'' now resolve name\naliases, and *note unicodedata.lookup(): eef. resolves named\nsequences too.\n\n(Contributed by Ezio Melotti in bpo-12753(1).)\n\n* Unicode database updated to UCD version 6.1.0\n\n* Equality comparisons on *note range(): 761. objects now return a\nresult reflecting the equality of the underlying sequences\ngenerated by those range objects.  (bpo-13201(2))\n\n* The 'count()', 'find()', 'rfind()', 'index()' and 'rindex()'\nmethods of *note bytes: 295. and *note bytearray: 294. objects now\naccept an integer between 0 and 255 as their first argument.\n\n(Contributed by Petri Lehtinen in bpo-12170(3).)\n\n* The 'rjust()', 'ljust()', and 'center()' methods of *note bytes:\n295. and *note bytearray: 294. now accept a *note bytearray: 294.\nfor the 'fill' argument.  (Contributed by Petri Lehtinen in\nbpo-12380(4).)\n\n* New methods have been added to *note list: 3dc. and *note\nbytearray: 294.: 'copy()' and 'clear()' (bpo-10516(5)).\nConsequently, *note MutableSequence: c31. now also defines a\n'clear()' method (bpo-11388(6)).\n\n* Raw bytes literals can now be written 'rb\"...\"' as well as\n'br\"...\"'.\n\n(Contributed by Antoine Pitrou in bpo-13748(7).)\n\n* *note dict.setdefault(): ef0. now does only one lookup for the\ngiven key, making it atomic when used with built-in types.\n\n(Contributed by Filip Gruszczy??ski in bpo-13521(8).)\n\n* The error messages produced when a function call does not match the\nfunction signature have been significantly improved.\n\n(Contributed by Benjamin Peterson.)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=12753\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=13201\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=12170\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=12380\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=10516\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=11388\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=13748\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=13521\n\nFile: python3.12.info,  Node: A Finer-Grained Import Lock,  Next: Builtin functions and types,  Prev: Other Language Changes<10>,  Up: What's New In Python 3 3\n\n\nPrevious versions of CPython have always relied on a global import lock.",
            "subsections": []
        },
        "This led to unexpected annoyances, such as deadlocks when importing a": {
            "content": "module would trigger code execution in a different thread as a\nside-effect.  Clumsy workarounds were sometimes employed, such as the\n*note PyImportImportModuleNoBlock(): 324. C API function.\n",
            "subsections": []
        },
        "In Python 3.3, importing a module takes a per-module lock.  This": {
            "content": "correctly serializes importation of a given module from multiple threads\n(preventing the exposure of incompletely initialized modules), while\neliminating the aforementioned annoyances.\n\n(Contributed by Antoine Pitrou in bpo-9260(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=9260\n\nFile: python3.12.info,  Node: Builtin functions and types,  Next: New Modules<10>,  Prev: A Finer-Grained Import Lock,  Up: What's New In Python 3 3\n\n\n* *note open(): 26e. gets a new 'opener' parameter: the underlying\nfile descriptor for the file object is then obtained by calling\n'opener' with ('file', 'flags').  It can be used to use custom\nflags like *note os.OCLOEXEC: ef3. for example.  The ''x'' mode\nwas added: open for exclusive creation, failing if the file already\nexists.\n\n* *note print(): de5.: added the 'flush' keyword argument.  If the\n'flush' keyword argument is true, the stream is forcibly flushed.\n\n* *note hash(): 3b1.: hash randomization is enabled by default, see\n*note object.hash(): 932. and *note PYTHONHASHSEED: ef4.\n\n* The *note str: 157. type gets a new *note casefold(): c33. method:\nreturn a casefolded copy of the string, casefolded strings may be\nused for caseless matching.  For example, ''ss'.casefold()' returns\n''ss''.\n\n* The sequence documentation has been substantially rewritten to\nbetter explain the binary/text sequence distinction and to provide\nspecific documentation sections for the individual builtin sequence\ntypes (bpo-4966(1)).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=4966\n\nFile: python3.12.info,  Node: New Modules<10>,  Next: Improved Modules<10>,  Prev: Builtin functions and types,  Up: What's New In Python 3 3\n\n\n* Menu:\n\n* faulthandler: faulthandler<4>.\n* ipaddress: ipaddress<5>.\n* lzma: lzma<2>.\n\nFile: python3.12.info,  Node: faulthandler<4>,  Next: ipaddress<5>,  Up: New Modules<10>\n\n1.10.19.1 faulthandler\n......................\n\nThis new debug module *note faulthandler: 53. contains functions to dump",
            "subsections": []
        },
        "Python tracebacks explicitly, on a fault (a crash like a segmentation": {
            "content": "fault), after a timeout, or on a user signal.  Call *note\nfaulthandler.enable(): aed. to install fault handlers for the 'SIGSEGV',\n'SIGFPE', 'SIGABRT', 'SIGBUS', and 'SIGILL' signals.  You can also\nenable them at startup by setting the *note PYTHONFAULTHANDLER: ef7.\nenvironment variable or by using *note -X: 188. 'faulthandler' command\nline option.\n\nExample of a segmentation fault on Linux:\n\n$ python -q -X faulthandler\n>>> import ctypes\n>>> ctypes.stringat(0)\nFatal Python error: Segmentation fault\n\nCurrent thread 0x00007fb899f39700:\nFile \"/home/python/cpython/Lib/ctypes/init.py\", line 486 in stringat\nFile \"<stdin>\", line 1 in <module>\nSegmentation fault\n\nFile: python3.12.info,  Node: ipaddress<5>,  Next: lzma<2>,  Prev: faulthandler<4>,  Up: New Modules<10>\n\n1.10.19.2 ipaddress\n...................\n\nThe new *note ipaddress: 7a. module provides tools for creating and\nmanipulating objects representing IPv4 and IPv6 addresses, networks and\ninterfaces (i.e.  an IP address associated with a specific IP subnet).\n\n(Contributed by Google and Peter Moody in PEP 3144(1).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3144/\n\nFile: python3.12.info,  Node: lzma<2>,  Prev: ipaddress<5>,  Up: New Modules<10>\n\n1.10.19.3 lzma\n..............\n\nThe newly added *note lzma: 85. module provides data compression and\ndecompression using the LZMA algorithm, including support for the '.xz'\nand '.lzma' file formats.\n\n(Contributed by Nadeem Vawda and Per ??yvind Karlsen in bpo-6715(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=6715\n\nFile: python3.12.info,  Node: Improved Modules<10>,  Next: Optimizations<9>,  Prev: New Modules<10>,  Up: What's New In Python 3 3\n\n\n* Menu:\n\n* abc: abc<2>.\n* array: array<4>.\n* base64: base64<3>.\n* binascii: binascii<3>.\n* bz2: bz2<2>.\n* codecs: codecs<2>.\n* collections: collections<7>.\n* contextlib: contextlib<7>.\n* crypt: crypt<2>.\n* curses: curses<5>.\n* datetime: datetime<6>.\n* decimal: decimal<3>.\n* email: email<4>.\n* ftplib: ftplib<3>.\n* functools: functools<6>.\n* gc: gc<6>.\n* hmac: hmac<4>.\n* http: http<4>.\n* html: html<2>.\n* imaplib: imaplib<3>.\n* inspect: inspect<9>.\n* io: io<5>.\n* itertools: itertools<5>.\n* logging: logging<7>.\n* math: math<8>.\n* mmap: mmap<3>.\n* multiprocessing: multiprocessing<7>.\n* nntplib: nntplib<2>.\n* os: os<11>.\n* pdb: pdb<6>.\n* pickle: pickle<5>.\n* pydoc: pydoc<5>.\n* re: re<7>.\n* sched::\n* select: select<2>.\n* shlex: shlex<3>.\n* shutil: shutil<6>.\n* signal: signal<4>.\n* smtpd: smtpd<4>.\n* smtplib: smtplib<4>.\n* socket: socket<10>.\n* socketserver: socketserver<3>.\n* sqlite3: sqlite3<9>.\n* ssl: ssl<10>.\n* stat: stat<2>.\n* struct: struct<3>.\n* subprocess: subprocess<5>.\n* sys: sys<11>.\n* tarfile: tarfile<9>.\n* tempfile: tempfile<3>.\n* textwrap: textwrap<2>.\n* threading: threading<8>.\n* time: time<7>.\n* types: types<6>.\n* unittest: unittest<9>.\n* urllib: urllib<3>.\n* webbrowser: webbrowser<2>.\n* xml.etree.ElementTree: xml etree ElementTree<2>.\n* zlib: zlib<2>.\n\nFile: python3.12.info,  Node: abc<2>,  Next: array<4>,  Up: Improved Modules<10>\n\n1.10.20.1 abc\n.............\n",
            "subsections": []
        },
        "Improved support for abstract base classes containing descriptors": {
            "content": "composed with abstract methods.  The recommended approach to declaring\nabstract descriptors is now to provide 'isabstractmethod' as a\ndynamically updated property.  The built-in descriptors have been\nupdated accordingly.\n\n* *note abc.abstractproperty: efc. has been deprecated, use *note\nproperty: 3f6. with *note abc.abstractmethod(): efd. instead.\n\n* *note abc.abstractclassmethod: efe. has been deprecated, use *note\nclassmethod: 246. with *note abc.abstractmethod(): efd. instead.\n\n* *note abc.abstractstaticmethod: eff. has been deprecated, use *note\nstaticmethod: 5cc. with *note abc.abstractmethod(): efd. instead.\n\n(Contributed by Darren Dale in bpo-11610(1).)\n\n*note abc.ABCMeta.register(): f00. now returns the registered subclass,\nwhich means it can now be used as a class decorator (bpo-10868(2)).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=11610\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=10868\n\nFile: python3.12.info,  Node: array<4>,  Next: base64<3>,  Prev: abc<2>,  Up: Improved Modules<10>\n\n1.10.20.2 array\n...............\n\nThe *note array: 7. module supports the long long type using 'q' and 'Q'\ntype codes.\n\n(Contributed by Oren Tirosh and Hirokazu Yamamoto in bpo-1172711(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=1172711\n\nFile: python3.12.info,  Node: base64<3>,  Next: binascii<3>,  Prev: array<4>,  Up: Improved Modules<10>\n\n1.10.20.3 base64\n................\n\nASCII-only Unicode strings are now accepted by the decoding functions of\nthe *note base64: c. modern interface.  For example,\n'base64.b64decode('YWJj')' returns 'b'abc''.  (Contributed by Catalin",
            "subsections": []
        },
        "Iacob in bpo-13641(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=13641\n\nFile: python3.12.info,  Node: binascii<3>,  Next: bz2<2>,  Prev: base64<3>,  Up: Improved Modules<10>\n\n1.10.20.4 binascii\n..................\n",
            "subsections": []
        },
        "In addition to the binary objects they normally accept, the 'a2b'": {
            "content": "functions now all also accept ASCII-only strings as input.  (Contributed\nby Antoine Pitrou in bpo-13637(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=13637\n\nFile: python3.12.info,  Node: bz2<2>,  Next: codecs<2>,  Prev: binascii<3>,  Up: Improved Modules<10>\n\n1.10.20.5 bz2\n.............\n\nThe *note bz2: 11. module has been rewritten from scratch.  In the\nprocess, several new features have been added:\n\n* New *note bz2.open(): f05. function: open a bzip2-compressed file\nin binary or text mode.\n\n* *note bz2.BZ2File: 775. can now read from and write to arbitrary\nfile-like objects, by means of its constructor's 'fileobj'\nargument.\n\n(Contributed by Nadeem Vawda in bpo-5863(1).)\n\n* *note bz2.BZ2File: 775. and *note bz2.decompress(): f06. can now\ndecompress multi-stream inputs (such as those produced by the\n'pbzip2' tool).  *note bz2.BZ2File: 775. can now also be used to\ncreate this type of file, using the ''a'' (append) mode.\n\n(Contributed by Nir Aides in bpo-1625(2).)\n\n* *note bz2.BZ2File: 775. now implements all of the *note\nio.BufferedIOBase: 460. API, except for the 'detach()' and\n'truncate()' methods.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=5863\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=1625\n\nFile: python3.12.info,  Node: codecs<2>,  Next: collections<7>,  Prev: bz2<2>,  Up: Improved Modules<10>\n\n1.10.20.6 codecs\n................\n\nThe *note mbcs: 4e. codec has been rewritten to handle correctly\n'replace' and 'ignore' error handlers on all Windows versions.  The\n*note mbcs: 4e. codec now supports all error handlers, instead of only\n'replace' to encode and 'ignore' to decode.\n\nA new Windows-only codec has been added: 'cp65001' (bpo-13216(1)).  It\nis the Windows code page 65001 (Windows UTF-8, 'CPUTF8').  For example,\nit is used by 'sys.stdout' if the console output code page is set to\ncp65001 (e.g., using 'chcp 65001' command).\n",
            "subsections": []
        },
        "Multibyte CJK decoders now resynchronize faster.  They only ignore the": {
            "content": "first byte of an invalid byte sequence.  For example,\n'b'\\xff\\n'.decode('gb2312', 'replace')' now returns a '\\n' after the\nreplacement character.\n\n(bpo-12016(2))\n",
            "subsections": []
        },
        "Incremental CJK codec encoders are no longer reset at each call to their": {
            "content": "encode() methods.  For example:\n\n>>> import codecs\n>>> encoder = codecs.getincrementalencoder('hz')('strict')\n>>> b''.join(encoder.encode(x) for x in '\\u52ff\\u65bd\\u65bc\\u4eba\\u3002 Bye.')\nb'~{NpJ)l6HK!#~} Bye.'\n\nThis example gives 'b'~{Np~}~{J)~}~{l6~}~{HK~}~{!#~} Bye.'' with older\nPython versions.\n\n(bpo-12100(3))\n\nThe 'unicodeinternal' codec has been deprecated.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=13216\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=12016\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=12100\n\nFile: python3.12.info,  Node: collections<7>,  Next: contextlib<7>,  Prev: codecs<2>,  Up: Improved Modules<10>\n\n1.10.20.7 collections\n.....................\n\nAddition of a new *note ChainMap: a62. class to allow treating a number\nof mappings as a single unit.  (Written by Raymond Hettinger for\nbpo-11089(1), made public in bpo-11297(2).)\n\nThe abstract base classes have been moved in a new *note\ncollections.abc: 1c. module, to better differentiate between the\nabstract and the concrete collections classes.  Aliases for ABCs are\nstill present in the *note collections: 1b. module to preserve existing\nimports.  (bpo-11085(3))\n\nThe *note Counter: f09. class now supports the unary '+' and '-'\noperators, as well as the in-place operators '+=', '-=', '|=', and '&='.\n(Contributed by Raymond Hettinger in bpo-13121(4).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=11089\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=11297\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=11085\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=13121\n\nFile: python3.12.info,  Node: contextlib<7>,  Next: crypt<2>,  Prev: collections<7>,  Up: Improved Modules<10>\n\n1.10.20.8 contextlib\n....................\n\n*note ExitStack: 962. now provides a solid foundation for programmatic\nmanipulation of context managers and similar cleanup functionality.",
            "subsections": []
        },
        "Unlike the previous 'contextlib.nested' API (which was deprecated and": {
            "content": "removed), the new API is designed to work correctly regardless of\nwhether context managers acquire their resources in their 'init'\nmethod (for example, file objects) or in their 'enter' method (for\nexample, synchronisation objects from the *note threading: e7. module).\n\n(bpo-13585(1))\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=13585\n\nFile: python3.12.info,  Node: crypt<2>,  Next: curses<5>,  Prev: contextlib<7>,  Up: Improved Modules<10>\n\n1.10.20.9 crypt\n...............\n\nAddition of salt and modular crypt format (hashing method) and the *note\nmksalt(): 968. function to the *note crypt: 26. module.\n\n(bpo-10924(1))\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=10924\n\nFile: python3.12.info,  Node: curses<5>,  Next: datetime<6>,  Prev: crypt<2>,  Up: Improved Modules<10>\n\n1.10.20.10 curses\n.................\n\n* If the *note curses: 29. module is linked to the ncursesw library,\nuse Unicode functions when Unicode strings or characters are passed\n(e.g.  'waddwstr()'), and bytes functions otherwise (e.g.\n'waddstr()').\n\n* Use the locale encoding instead of 'utf-8' to encode Unicode\nstrings.\n\n* 'curses.window' has a new *note curses.window.encoding: f0d.\nattribute.\n\n* The 'curses.window' class has a new *note getwch(): f0e. method to\nget a wide character\n\n* The *note curses: 29. module has a new *note ungetwch(): f0f.\nfunction to push a wide character so the next *note getwch(): f0e.\nwill return it\n\n(Contributed by In~igo Serna in bpo-6755(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=6755\n\nFile: python3.12.info,  Node: datetime<6>,  Next: decimal<3>,  Prev: curses<5>,  Up: Improved Modules<10>\n\n1.10.20.11 datetime\n...................\n\n* Equality comparisons between naive and aware *note datetime: 222.\ninstances now return *note False: 971. instead of raising *note\nTypeError: 28e. (bpo-15006(1)).\n\n* New *note datetime.datetime.timestamp(): f11. method: Return POSIX\ntimestamp corresponding to the *note datetime: 222. instance.\n\n* The *note datetime.datetime.strftime(): add. method supports\nformatting years older than 1000.\n\n* The *note datetime.datetime.astimezone(): 7f4. method can now be\ncalled without arguments to convert datetime instance to the system\ntimezone.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=15006\n\nFile: python3.12.info,  Node: decimal<3>,  Next: email<4>,  Prev: datetime<6>,  Up: Improved Modules<10>\n\n1.10.20.12 decimal\n..................\n\nbpo-7652(1) - integrate fast native decimal arithmetic.\n\nC-module and libmpdec written by Stefan Krah.\n",
            "subsections": []
        },
        "The new C version of the decimal module integrates the high speed": {
            "content": "libmpdec library for arbitrary precision correctly rounded decimal\nfloating point arithmetic.  libmpdec conforms to IBM's General Decimal\nArithmetic Specification.\n",
            "subsections": []
        },
        "Performance gains range from 10x for database applications to 100x for": {
            "content": "numerically intensive applications.  These numbers are expected gains\nfor standard precisions used in decimal floating point arithmetic.\nSince the precision is user configurable, the exact figures may vary.",
            "subsections": []
        },
        "For example, in integer bignum arithmetic the differences can be": {
            "content": "significantly higher.\n",
            "subsections": []
        },
        "The following table is meant as an illustration.  Benchmarks are": {
            "content": "available at 'https://www.bytereef.org/mpdecimal/quickstart.html'.\n\ndecimal.py        decimal           speedup\n\n---------------------------------------------------------------------\n\npi            42.02s            0.345s             120x\n\n\ntelco         172.19s           5.68s              30x\n\n\npsycopg       3.57s             0.29s              12x\n\n\n* Menu:\n\n* Features: Features<2>.\n* API changes: API changes<2>.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=7652\n\nFile: python3.12.info,  Node: Features<2>,  Next: API changes<2>,  Up: decimal<3>\n\n1.10.20.13 Features\n...................\n\n* The *note FloatOperation: f14. signal optionally enables stricter\nsemantics for mixing floats and Decimals.\n\n* If Python is compiled without threads, the C version automatically\ndisables the expensive thread local context machinery.  In this\ncase, the variable *note HAVETHREADS: f15. is set to 'False'.\n\nFile: python3.12.info,  Node: API changes<2>,  Prev: Features<2>,  Up: decimal<3>\n\n1.10.20.14 API changes\n......................\n\n* The C module has the following context limits, depending on the\nmachine architecture:\n\n32-bit               64-bit\n\n---------------------------------------------------------------------------\n\n'MAXPREC'              '425000000'          '999999999999999999'\n\n\n'MAXEMAX'              '425000000'          '999999999999999999'\n\n\n'MINEMIN'              '-425000000'         '-999999999999999999'\n\n\n* In the context templates (*note DefaultContext: f17, *note\nBasicContext: f18. and *note ExtendedContext: f19.) the magnitude\nof 'Emax' and 'Emin' has changed to '999999'.\n\n* The *note Decimal: 5c3. constructor in decimal.py does not observe\nthe context limits and converts values with arbitrary exponents or\nprecision exactly.  Since the C version has internal limits, the\nfollowing scheme is used: If possible, values are converted\nexactly, otherwise *note InvalidOperation: f1a. is raised and the\nresult is NaN. In the latter case it is always possible to use\n*note createdecimal(): f1b. in order to obtain a rounded or\ninexact value.\n\n* The power function in decimal.py is always correctly rounded.  In\nthe C version, it is defined in terms of the correctly rounded\n*note exp(): f1c. and *note ln(): f1d. functions, but the final\nresult is only \"almost always correctly rounded\".\n\n* In the C version, the context dictionary containing the signals is\na *note MutableMapping: f1e.  For speed reasons, 'flags' and\n'traps' always refer to the same *note MutableMapping: f1e. that\nthe context was initialized with.  If a new signal dictionary is\nassigned, 'flags' and 'traps' are updated with the new values, but\nthey do not reference the RHS dictionary.\n\n* Pickling a *note Context: f1f. produces a different output in order\nto have a common interchange format for the Python and C versions.\n\n* The order of arguments in the *note Context: f1f. constructor has\nbeen changed to match the order displayed by *note repr(): 5f0.\n\n* The 'watchexp' parameter in the *note quantize(): f20. method is\ndeprecated.\n\nFile: python3.12.info,  Node: email<4>,  Next: ftplib<3>,  Prev: decimal<3>,  Up: Improved Modules<10>\n\n1.10.20.15 email\n................\n\n* Menu:\n\n* Policy Framework::\n* Provisional Policy with New Header API::\n* Other API Changes::\n\nFile: python3.12.info,  Node: Policy Framework,  Next: Provisional Policy with New Header API,  Up: email<4>\n\n1.10.20.16 Policy Framework\n...........................\n\nThe email package now has a *note policy: 4b. framework.  A *note",
            "subsections": []
        },
        "Policy: f23. is an object with several methods and properties that": {
            "content": "control how the email package behaves.  The primary policy for Python\n3.3 is the *note Compat32: f24. policy, which provides backward\ncompatibility with the email package in Python 3.2.  A 'policy' can be\nspecified when an email message is parsed by a *note parser: 4a, or when\na *note Message: ae7. object is created, or when an email is serialized\nusing a *note generator: 3c.  Unless overridden, a policy passed to a\n'parser' is inherited by all the 'Message' object and sub-objects\ncreated by the 'parser'.  By default a 'generator' will use the policy\nof the 'Message' object it is serializing.  The default policy is *note\ncompat32: ae6.\n\nThe minimum set of controls implemented by all 'policy' objects are:\n\nmaxlinelength     The maximum length, excluding the linesep character(s),\nindividual lines may have when a 'Message' is serialized.\nDefaults to 78.\n\n\nlinesep             The character used to separate individual lines when a\n'Message' is serialized.  Defaults to '\\n'.\n\n\nctetype            '7bit' or '8bit'.  '8bit' applies only to a 'Bytes'\n'generator', and means that non-ASCII may be used where\nallowed by the protocol (or where it exists in the\noriginal input).\n\n\nraiseondefect     Causes a 'parser' to raise error when defects are\nencountered instead of adding them to the 'Message'\nobject's 'defects' list.\n\n\nA new policy instance, with new settings, is created using the *note\nclone(): f25. method of policy objects.  'clone' takes any of the above\ncontrols as keyword arguments.  Any control not specified in the call\nretains its default value.  Thus you can create a policy that uses\n'\\r\\n' linesep characters like this:\n\nmypolicy = compat32.clone(linesep='\\r\\n')\n",
            "subsections": []
        },
        "Policies can be used to make the generation of messages in the format": {
            "content": "needed by your application simpler.  Instead of having to remember to\nspecify 'linesep='\\r\\n'' in all the places you call a 'generator', you\ncan specify it once, when you set the policy used by the 'parser' or the\n'Message', whichever your program uses to create 'Message' objects.  On\nthe other hand, if you need to generate messages in multiple forms, you\ncan still specify the parameters in the appropriate 'generator' call.",
            "subsections": []
        },
        "Or you can have custom policy instances for your different cases, and": {
            "content": "pass those in when you create the 'generator'.\n\nFile: python3.12.info,  Node: Provisional Policy with New Header API,  Next: Other API Changes,  Prev: Policy Framework,  Up: email<4>\n\n1.10.20.17 Provisional Policy with New Header API\n.................................................\n",
            "subsections": []
        },
        "While the policy framework is worthwhile all by itself, the main": {
            "content": "motivation for introducing it is to allow the creation of new policies\nthat implement new features for the email package in a way that\nmaintains backward compatibility for those who do not use the new\npolicies.  Because the new policies introduce a new API, we are\nreleasing them in Python 3.3 as a *note provisional policy: eba.",
            "subsections": []
        },
        "Backwards incompatible changes (up to and including removal of the code)": {
            "content": "may occur if deemed necessary by the core developers.\n\nThe new policies are instances of *note EmailPolicy: f27, and add the\nfollowing additional controls:\n\nrefoldsource       Controls whether or not headers parsed by a\n*note parser: 4a. are refolded by the\n*note generator: 3c.  It can be 'none', 'long', or 'all'.\nThe default is 'long', which means that source headers\nwith a line longer than 'maxlinelength' get refolded.\n'none' means no line get refolded, and 'all' means that\nall lines get refolded.\n\n\nheaderfactory      A callable that take a 'name' and 'value' and produces a\ncustom header object.\n\n",
            "subsections": []
        },
        "The 'headerfactory' is the key to the new features provided by the new": {
            "content": "policies.  When one of the new policies is used, any header retrieved\nfrom a 'Message' object is an object produced by the 'headerfactory',\nand any time you set a header on a 'Message' it becomes an object\nproduced by 'headerfactory'.  All such header objects have a 'name'\nattribute equal to the header name.  Address and Date headers have\nadditional attributes that give you access to the parsed data of the\nheader.  This means you can now do things like this:\n\n>>> m = Message(policy=SMTP)\n>>> m['To'] = '??ric <foo@example.com>'\n>>> m['to']\n'??ric <foo@example.com>'\n>>> m['to'].addresses\n(Address(displayname='??ric', username='foo', domain='example.com'),)\n>>> m['to'].addresses[0].username\n'foo'\n>>> m['to'].addresses[0].displayname\n'??ric'\n>>> m['Date'] = email.utils.localtime()\n>>> m['Date'].datetime\ndatetime.datetime(2012, 5, 25, 21, 39, 24, 465484, tzinfo=datetime.timezone(datetime.timedelta(-1, 72000), 'EDT'))\n>>> m['Date']\n'Fri, 25 May 2012 21:44:27 -0400'\n>>> print(m)\nTo: =?utf-8?q?=C3=89ric?= <foo@example.com>\nDate: Fri, 25 May 2012 21:44:27 -0400\n",
            "subsections": []
        },
        "You will note that the unicode display name is automatically encoded as": {
            "content": "'utf-8' when the message is serialized, but that when the header is\naccessed directly, you get the unicode version.  This eliminates any\nneed to deal with the *note email.header: 3d. *note decodeheader():\nf28. or *note makeheader(): f29. functions.\n\nYou can also create addresses from parts:\n\n>>> m['cc'] = [Group('pals', [Address('Bob', 'bob', 'example.com'),\n...                           Address('Sally', 'sally', 'example.com')]),\n...            Address('Bonzo', addrspec='bonz@laugh.com')]\n>>> print(m)\nTo: =?utf-8?q?=C3=89ric?= <foo@example.com>\nDate: Fri, 25 May 2012 21:44:27 -0400\ncc: pals: Bob <bob@example.com>, Sally <sally@example.com>;, Bonzo <bonz@laugh.com>\n\nDecoding to unicode is done automatically:\n\n>>> m2 = messagefromstring(str(m))\n>>> m2['to']\n'??ric <foo@example.com>'\n",
            "subsections": []
        },
        "When you parse a message, you can use the 'addresses' and 'groups'": {
            "content": "attributes of the header objects to access the groups and individual\naddresses:\n\n>>> m2['cc'].addresses\n(Address(displayname='Bob', username='bob', domain='example.com'), Address(displayname='Sally', username='sally', domain='example.com'), Address(displayname='Bonzo', username='bonz', domain='laugh.com'))\n>>> m2['cc'].groups\n(Group(displayname='pals', addresses=(Address(displayname='Bob', username='bob', domain='example.com'), Address(displayname='Sally', username='sally', domain='example.com')), Group(displayname=None, addresses=(Address(displayname='Bonzo', username='bonz', domain='laugh.com'),))\n",
            "subsections": []
        },
        "In summary, if you use one of the new policies, header manipulation": {
            "content": "works the way it ought to: your application works with unicode strings,\nand the email package transparently encodes and decodes the unicode to\nand from the RFC standard Content Transfer Encodings.\n\nFile: python3.12.info,  Node: Other API Changes,  Prev: Provisional Policy with New Header API,  Up: email<4>\n\n1.10.20.18 Other API Changes\n............................\n\nNew *note BytesHeaderParser: f2b, added to the *note parser: 4a. module\nto complement *note HeaderParser: f2c. and complete the Bytes API.\n\nNew utility functions:\n\n* *note formatdatetime(): f2d.: given a *note datetime: 222, produce\na string formatted for use in an email header.\n\n* *note parsedatetodatetime(): f2e.: given a date string from an\nemail header, convert it into an aware *note datetime: 222, or a\nnaive *note datetime: 222. if the offset is '-0000'.\n\n* *note localtime(): 228.: With no argument, returns the current\nlocal time as an aware *note datetime: 222. using the local *note\ntimezone: f2f.  Given an aware *note datetime: 222, converts it\ninto an aware *note datetime: 222. using the local *note timezone:\nf2f.\n\nFile: python3.12.info,  Node: ftplib<3>,  Next: functools<6>,  Prev: email<4>,  Up: Improved Modules<10>\n\n1.10.20.19 ftplib\n.................\n\n* *note ftplib.FTP: 715. now accepts a 'sourceaddress' keyword\nargument to specify the '(host, port)' to use as the source address\nin the bind call when creating the outgoing socket.  (Contributed\nby Giampaolo Rodola` in bpo-8594(1).)\n\n* The *note FTPTLS: 716. class now provides a new *note ccc(): f31.\nfunction to revert control channel back to plaintext.  This can be\nuseful to take advantage of firewalls that know how to handle NAT\nwith non-secure FTP without opening fixed ports.  (Contributed by\nGiampaolo Rodola` in bpo-12139(2).)\n\n* Added *note ftplib.FTP.mlsd(): f32. method which provides a\nparsable directory listing format and deprecates *note\nftplib.FTP.nlst(): f33. and *note ftplib.FTP.dir(): f34.\n(Contributed by Giampaolo Rodola` in bpo-11072(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=8594\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=12139\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=11072\n\nFile: python3.12.info,  Node: functools<6>,  Next: gc<6>,  Prev: ftplib<3>,  Up: Improved Modules<10>\n\n1.10.20.20 functools\n....................\n\nThe *note functools.lrucache(): 815. decorator now accepts a 'typed'\nkeyword argument (that defaults to 'False' to ensure that it caches\nvalues of different types that compare equal in separate cache slots.\n(Contributed by Raymond Hettinger in bpo-13227(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=13227\n\nFile: python3.12.info,  Node: gc<6>,  Next: hmac<4>,  Prev: functools<6>,  Up: Improved Modules<10>\n\n1.10.20.21 gc\n.............\n",
            "subsections": []
        },
        "It is now possible to register callbacks invoked by the garbage": {
            "content": "collector before and after collection using the new *note callbacks:\nf37. list.\n\nFile: python3.12.info,  Node: hmac<4>,  Next: http<4>,  Prev: gc<6>,  Up: Improved Modules<10>\n\n1.10.20.22 hmac\n...............\n\nA new *note comparedigest(): f39. function has been added to prevent\nside channel attacks on digests through timing analysis.  (Contributed\nby Nick Coghlan and Christian Heimes in bpo-15061(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=15061\n\nFile: python3.12.info,  Node: http<4>,  Next: html<2>,  Prev: hmac<4>,  Up: Improved Modules<10>\n\n1.10.20.23 http\n...............\n\n*note http.server.BaseHTTPRequestHandler: f3b. now buffers the headers\nand writes them all at once when *note endheaders(): f3c. is called.  A\nnew method *note flushheaders(): f3d. can be used to directly manage\nwhen the accumulated headers are sent.  (Contributed by Andrew Schaaf in\nbpo-3709(1).)\n\n*note http.server: 6d. now produces valid 'HTML 4.01 strict' output.\n(Contributed by Ezio Melotti in bpo-13295(2).)\n\n*note http.client.HTTPResponse: f3e. now has a *note readinto(): f3f.\nmethod, which means it can be used as an *note io.RawIOBase: f40. class.\n(Contributed by John Kuhn in bpo-13464(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=3709\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=13295\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=13464\n\nFile: python3.12.info,  Node: html<2>,  Next: imaplib<3>,  Prev: http<4>,  Up: Improved Modules<10>\n\n1.10.20.24 html\n...............\n\n*note html.parser.HTMLParser: 682. is now able to parse broken markup\nwithout raising errors, therefore the 'strict' argument of the\nconstructor and the 'HTMLParseError' exception are now deprecated.  The\nability to parse broken markup is the result of a number of bug fixes\nthat are also available on the latest bug fix releases of Python\n2.7/3.2.  (Contributed by Ezio Melotti in bpo-15114(1), and\nbpo-14538(2), bpo-13993(3), bpo-13960(4), bpo-13358(5), bpo-1745761(6),\nbpo-755670(7), bpo-13357(8), bpo-12629(9), bpo-1200313(10),\nbpo-670664(11), bpo-13273(12), bpo-12888(13), bpo-7311(14).)\n\nA new *note html5: f42. dictionary that maps HTML5 named character\nreferences to the equivalent Unicode character(s) (e.g.  'html5['gt;']\n== '>'') has been added to the *note html.entities: 67. module.  The\ndictionary is now also used by *note HTMLParser: 682.  (Contributed by",
            "subsections": []
        },
        "Ezio Melotti in bpo-11113(15) and bpo-15156(16).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=15114\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=14538\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=13993\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=13960\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=13358\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=1745761\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=755670\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=13357\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=12629\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=1200313\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=670664\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=13273\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=12888\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=7311\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=11113\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=15156\n\nFile: python3.12.info,  Node: imaplib<3>,  Next: inspect<9>,  Prev: html<2>,  Up: Improved Modules<10>\n\n1.10.20.25 imaplib\n..................\n\nThe *note IMAP4SSL: 71f. constructor now accepts an SSLContext\nparameter to control parameters of the secure channel.\n\n(Contributed by Sijin Joseph in bpo-8808(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=8808\n\nFile: python3.12.info,  Node: inspect<9>,  Next: io<5>,  Prev: imaplib<3>,  Up: Improved Modules<10>\n\n1.10.20.26 inspect\n..................\n\nA new *note getclosurevars(): f45. function has been added.  This\nfunction reports the current binding of all names referenced from the\nfunction body and where those names were resolved, making it easier to\nverify correct internal state when testing code that relies on stateful\nclosures.\n\n(Contributed by Meador Inge and Nick Coghlan in bpo-13062(1).)\n\nA new *note getgeneratorlocals(): f46. function has been added.  This\nfunction reports the current binding of local variables in the\ngenerator's stack frame, making it easier to verify correct internal\nstate when testing generators.\n\n(Contributed by Meador Inge in bpo-15153(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=13062\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=15153\n\nFile: python3.12.info,  Node: io<5>,  Next: itertools<5>,  Prev: inspect<9>,  Up: Improved Modules<10>\n\n1.10.20.27 io\n.............\n\nThe *note open(): 26f. function has a new ''x'' mode that can be used to\nexclusively create a new file, and raise a *note FileExistsError: e97.\nif the file already exists.  It is based on the C11 'x' mode to fopen().\n\n(Contributed by David Townshend in bpo-12760(1).)\n\nThe constructor of the *note TextIOWrapper: b8f. class has a new\n'writethrough' optional argument.  If 'writethrough' is 'True', calls\nto 'write()' are guaranteed not to be buffered: any data written on the\n*note TextIOWrapper: b8f. object is immediately handled to its\nunderlying binary buffer.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=12760\n\nFile: python3.12.info,  Node: itertools<5>,  Next: logging<7>,  Prev: io<5>,  Up: Improved Modules<10>\n\n1.10.20.28 itertools\n....................\n\n*note accumulate(): 825. now takes an optional 'func' argument for\nproviding a user-supplied binary function.\n\nFile: python3.12.info,  Node: logging<7>,  Next: math<8>,  Prev: itertools<5>,  Up: Improved Modules<10>\n\n1.10.20.29 logging\n..................\n\nThe *note basicConfig(): 828. function now supports an optional\n'handlers' argument taking an iterable of handlers to be added to the\nroot logger.\n\nA class level attribute 'appendnul' has been added to *note",
            "subsections": []
        },
        "SysLogHandler: 426. to allow control of the appending of the 'NUL'": {
            "content": "('\\000') byte to syslog records, since for some daemons it is required\nwhile for others it is passed through to the log.\n\nFile: python3.12.info,  Node: math<8>,  Next: mmap<3>,  Prev: logging<7>,  Up: Improved Modules<10>\n\n1.10.20.30 math\n...............\n\nThe *note math: 89. module has a new function, *note log2(): f4b, which\nreturns the base-2 logarithm of 'x'.\n\n(Written by Mark Dickinson in bpo-11888(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=11888\n\nFile: python3.12.info,  Node: mmap<3>,  Next: multiprocessing<7>,  Prev: math<8>,  Up: Improved Modules<10>\n\n1.10.20.31 mmap\n...............\n\nThe *note read(): f4d. method is now more compatible with other\nfile-like objects: if the argument is omitted or specified as 'None', it\nreturns the bytes from the current file position to the end of the\nmapping.  (Contributed by Petri Lehtinen in bpo-12021(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=12021\n\nFile: python3.12.info,  Node: multiprocessing<7>,  Next: nntplib<2>,  Prev: mmap<3>,  Up: Improved Modules<10>\n\n1.10.20.32 multiprocessing\n..........................\n\nThe new *note multiprocessing.connection.wait(): f4f. function allows\npolling multiple objects (such as connections, sockets and pipes) with a\ntimeout.  (Contributed by Richard Oudkerk in bpo-12328(1).)\n\n'multiprocessing.Connection' objects can now be transferred over\nmultiprocessing connections.  (Contributed by Richard Oudkerk in\nbpo-4892(2).)\n\n*note multiprocessing.Process: 996. now accepts a 'daemon' keyword\nargument to override the default behavior of inheriting the 'daemon'\nflag from the parent process (bpo-6064(3)).\n\nNew attribute *note multiprocessing.Process.sentinel: f50. allows a\nprogram to wait on multiple *note Process: 996. objects at one time\nusing the appropriate OS primitives (for example, *note select: bc. on\nposix systems).\n\nNew methods *note multiprocessing.pool.Pool.starmap(): f51. and *note\nstarmapasync(): f52. provide *note itertools.starmap(): f53.\nequivalents to the existing *note multiprocessing.pool.Pool.map(): f54.\nand *note mapasync(): f55. functions.  (Contributed by Hynek Schlawack\nin bpo-12708(4).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=12328\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=4892\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=6064\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=12708\n\nFile: python3.12.info,  Node: nntplib<2>,  Next: os<11>,  Prev: multiprocessing<7>,  Up: Improved Modules<10>\n\n1.10.20.33 nntplib\n..................\n\nThe *note nntplib.NNTP: 733. class now supports the context management\nprotocol to unconditionally consume *note socket.error: ece. exceptions\nand to close the NNTP connection when done:\n\n>>> from nntplib import NNTP\n>>> with NNTP('news.gmane.org') as n:\n...     n.group('gmane.comp.python.committers')\n...\n('211 1755 1 1755 gmane.comp.python.committers', 1755, 1, 1755, 'gmane.comp.python.committers')\n>>>\n\n(Contributed by Giampaolo Rodola` in bpo-9795(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=9795\n\nFile: python3.12.info,  Node: os<11>,  Next: pdb<6>,  Prev: nntplib<2>,  Up: Improved Modules<10>\n\n1.10.20.34 os\n.............\n\n* The *note os: 9c. module has a new *note pipe2(): f58. function\nthat makes it possible to create a pipe with *note OCLOEXEC: ef3.\nor *note ONONBLOCK: c9a. flags set atomically.  This is especially\nuseful to avoid race conditions in multi-threaded programs.\n\n* The *note os: 9c. module has a new *note sendfile(): 946. function\nwhich provides an efficient \"zero-copy\" way for copying data from\none file (or socket) descriptor to another.  The phrase \"zero-copy\"\nrefers to the fact that all of the copying of data between the two\ndescriptors is done entirely by the kernel, with no copying of data\ninto userspace buffers.  *note sendfile(): 946. can be used to\nefficiently copy data from a file on disk to a network socket, e.g.\nfor downloading a file.\n\n(Patch submitted by Ross Lagerwall and Giampaolo Rodola` in\nbpo-10882(1).)\n\n* To avoid race conditions like symlink attacks and issues with\ntemporary files and directories, it is more reliable (and also\nfaster) to manipulate file descriptors instead of file names.\nPython 3.3 enhances existing functions and introduces new functions\nto work on file descriptors (bpo-4761(2), bpo-10755(3) and\nbpo-14626(4)).\n\n- The *note os: 9c. module has a new *note fwalk(): 998.\nfunction similar to *note walk(): 1c8. except that it also\nyields file descriptors referring to the directories visited.\nThis is especially useful to avoid symlink races.\n\n- The following functions get new optional 'dirfd' (*note paths\nrelative to directory descriptors: f59.) and/or\n'followsymlinks' (*note not following symlinks: f5a.): *note\naccess(): f5b, *note chflags(): f5c, *note chmod(): f5d, *note\nchown(): f5e, *note link(): f5f, *note lstat(): 1c0, *note\nmkdir(): f60, *note mkfifo(): bec, *note mknod(): bed, *note\nopen(): bee, *note readlink(): 73e, *note remove(): f61, *note\nrename(): f62, *note replace(): f63, *note rmdir(): f64, *note\nstat(): 1bf, *note symlink(): f65, *note unlink(): f66, *note\nutime(): f67.  Platform support for using these parameters can\nbe checked via the sets *note os.supportsdirfd: f68. and\n'os.supportsfollowssymlinks'.\n\n- The following functions now support a file descriptor for\ntheir path argument: *note chdir(): 3d8, *note chmod(): f5d,\n*note chown(): f5e, *note execve(): f69, *note listdir(): f6a,\n*note pathconf(): f6b, *note exists(): 837, *note stat(): 1bf,\n*note statvfs(): f6c, *note utime(): f67.  Platform support\nfor this can be checked via the *note os.supportsfd: f6d.\nset.\n\n* *note access(): f5b. accepts an 'effectiveids' keyword argument to\nturn on using the effective uid/gid rather than the real uid/gid in\nthe access check.  Platform support for this can be checked via the\n*note supportseffectiveids: f6e. set.\n\n* The *note os: 9c. module has two new functions: *note\ngetpriority(): f6f. and *note setpriority(): f70.  They can be used\nto get or set process niceness/priority in a fashion similar to\n*note os.nice(): f71. but extended to all processes instead of just\nthe current one.\n\n(Patch submitted by Giampaolo Rodola` in bpo-10784(5).)\n\n* The new *note os.replace(): f63. function allows cross-platform\nrenaming of a file with overwriting the destination.  With *note\nos.rename(): f62, an existing destination file is overwritten under\nPOSIX, but raises an error under Windows.  (Contributed by Antoine\nPitrou in bpo-8828(6).)\n\n* The stat family of functions (*note stat(): 1bf, *note fstat():\nbe8, and *note lstat(): 1c0.) now support reading a file's\ntimestamps with nanosecond precision.  Symmetrically, *note\nutime(): f67. can now write file timestamps with nanosecond\nprecision.  (Contributed by Larry Hastings in bpo-14127(7).)\n\n* The new *note os.getterminalsize(): f72. function queries the\nsize of the terminal attached to a file descriptor.  See also *note\nshutil.getterminalsize(): f73.  (Contributed by Zbigniew\nJ??drzejewski-Szmek in bpo-13609(8).)\n\n* New functions to support Linux extended attributes (bpo-12720(9)):\n*note getxattr(): f74, *note listxattr(): f75, *note removexattr():\nf76, *note setxattr(): f77.\n\n* New interface to the scheduler.  These functions control how a\nprocess is allocated CPU time by the operating system.  New\nfunctions: *note schedgetprioritymax(): f78, *note\nschedgetprioritymin(): f79, *note schedgetaffinity(): f7a,\n*note schedgetparam(): f7b, *note schedgetscheduler(): f7c, *note\nschedrrgetinterval(): f7d, *note schedsetaffinity(): f7e, *note\nschedsetparam(): f7f, *note schedsetscheduler(): f80, *note\nschedyield(): f81,\n\n* New functions to control the file system:\n\n* *note posixfadvise(): bef.: Announces an intention to access\ndata in a specific pattern thus allowing the kernel to make\noptimizations.\n\n* *note posixfallocate(): bf0.: Ensures that enough disk space\nis allocated for a file.\n\n* *note sync(): f82.: Force write of everything to disk.\n\n* Additional new posix functions:\n\n* *note lockf(): f83.: Apply, test or remove a POSIX lock on an\nopen file descriptor.\n\n* *note pread(): 99d.: Read from a file descriptor at an offset,\nthe file offset remains unchanged.\n\n* *note pwrite(): 9a0.: Write to a file descriptor from an\noffset, leaving the file offset unchanged.\n\n* *note readv(): 99c.: Read from a file descriptor into a number\nof writable buffers.\n\n* *note truncate(): c9b.: Truncate the file corresponding to\n'path', so that it is at most 'length' bytes in size.\n\n* *note waitid(): bf5.: Wait for the completion of one or more\nchild processes.\n\n* *note writev(): 99f.: Write the contents of 'buffers' to a\nfile descriptor, where 'buffers' is an arbitrary sequence of\nbuffers.\n\n* *note getgrouplist(): f84. (bpo-9344(10)): Return list of\ngroup ids that specified user belongs to.\n\n* *note times(): f85. and *note uname(): f86.: Return type changed\nfrom a tuple to a tuple-like object with named attributes.\n\n* Some platforms now support additional constants for the *note\nlseek(): f87. function, such as 'os.SEEKHOLE' and 'os.SEEKDATA'.\n\n* New constants *note RTLDLAZY: f88, *note RTLDNOW: f89, *note\nRTLDGLOBAL: f8a, *note RTLDLOCAL: f8b, *note RTLDNODELETE: f8c,\n*note RTLDNOLOAD: f8d, and *note RTLDDEEPBIND: f8e. are available\non platforms that support them.  These are for use with the *note\nsys.setdlopenflags(): f8f. function, and supersede the similar\nconstants defined in *note ctypes: 28. and 'DLFCN'.  (Contributed\nby Victor Stinner in bpo-13226(11).)\n\n* *note os.symlink(): f65. now accepts (and ignores) the\n'targetisdirectory' keyword argument on non-Windows platforms, to\nease cross-platform support.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=10882\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=4761\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=10755\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=14626\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=10784\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=8828\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=14127\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=13609\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=12720\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=9344\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=13226\n\nFile: python3.12.info,  Node: pdb<6>,  Next: pickle<5>,  Prev: os<11>,  Up: Improved Modules<10>\n\n1.10.20.35 pdb\n..............\n",
            "subsections": []
        },
        "Tab-completion is now available not only for command names, but also": {
            "content": "their arguments.  For example, for the 'break' command, function and\nfile names are completed.\n\n(Contributed by Georg Brandl in bpo-14210(1))\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=14210\n\nFile: python3.12.info,  Node: pickle<5>,  Next: pydoc<5>,  Prev: pdb<6>,  Up: Improved Modules<10>\n\n1.10.20.36 pickle\n.................\n\n*note pickle.Pickler: 849. objects now have an optional *note\ndispatchtable: f92. attribute allowing per-pickler reduction functions\nto be set.\n\n(Contributed by Richard Oudkerk in bpo-14166(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=14166\n\nFile: python3.12.info,  Node: pydoc<5>,  Next: re<7>,  Prev: pickle<5>,  Up: Improved Modules<10>\n\n1.10.20.37 pydoc\n................\n\nThe Tk GUI and the 'serve()' function have been removed from the *note\npydoc: b0. module: 'pydoc -g' and 'serve()' have been deprecated in\nPython 3.2.\n\nFile: python3.12.info,  Node: re<7>,  Next: sched,  Prev: pydoc<5>,  Up: Improved Modules<10>\n\n1.10.20.38 re\n.............\n\n*note str: 157. regular expressions now support '\\u' and '\\U' escapes.\n\n(Contributed by Serhiy Storchaka in bpo-3665(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=3665\n\nFile: python3.12.info,  Node: sched,  Next: select<2>,  Prev: re<7>,  Up: Improved Modules<10>\n\n1.10.20.39 sched\n................\n\n* *note run(): f96. now accepts a 'blocking' parameter which when set\nto false makes the method execute the scheduled events due to\nexpire soonest (if any) and then return immediately.  This is\nuseful in case you want to use the *note scheduler: f97. in\nnon-blocking applications.  (Contributed by Giampaolo Rodola` in\nbpo-13449(1).)\n\n* *note scheduler: f97. class can now be safely used in\nmulti-threaded environments.  (Contributed by Josiah Carlson and\nGiampaolo Rodola` in bpo-8684(2).)\n\n* 'timefunc' and 'delayfunct' parameters of *note scheduler: f97.\nclass constructor are now optional and defaults to *note\ntime.time(): 918. and *note time.sleep(): 469. respectively.\n(Contributed by Chris Clark in bpo-13245(3).)\n\n* *note enter(): f98. and *note enterabs(): f99. 'argument' parameter\nis now optional.  (Contributed by Chris Clark in bpo-13245(4).)\n\n* *note enter(): f98. and *note enterabs(): f99. now accept a\n'kwargs' parameter.  (Contributed by Chris Clark in bpo-13245(5).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=13449\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=8684\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=13245\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=13245\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=13245\n\nFile: python3.12.info,  Node: select<2>,  Next: shlex<3>,  Prev: sched,  Up: Improved Modules<10>\n\n1.10.20.40 select\n.................\n\nSolaris and derivative platforms have a new class *note select.devpoll:\ne05. for high performance asynchronous sockets via '/dev/poll'.\n(Contributed by Jes??s Cea Avi??n in bpo-6397(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=6397\n\nFile: python3.12.info,  Node: shlex<3>,  Next: shutil<6>,  Prev: select<2>,  Up: Improved Modules<10>\n\n1.10.20.41 shlex\n................\n\nThe previously undocumented helper function 'quote' from the *note\npipes: a3. modules has been moved to the *note shlex: bf. module and\ndocumented.  *note quote(): f9c. properly escapes all characters in a\nstring that might be otherwise given special meaning by the shell.\n\nFile: python3.12.info,  Node: shutil<6>,  Next: signal<4>,  Prev: shlex<3>,  Up: Improved Modules<10>\n\n1.10.20.42 shutil\n.................\n\n* New functions:\n\n* *note diskusage(): f9e.: provides total, used and free disk\nspace statistics.  (Contributed by Giampaolo Rodola` in\nbpo-12442(1).)\n\n* *note chown(): f9f.: allows one to change user and/or group of\nthe given path also specifying the user/group names and not\nonly their numeric ids.  (Contributed by Sandro Tosi in\nbpo-12191(2).)\n\n* *note shutil.getterminalsize(): f73.: returns the size of\nthe terminal window to which the interpreter is attached.\n(Contributed by Zbigniew J??drzejewski-Szmek in bpo-13609(3).)\n\n* *note copy2(): 888. and *note copystat(): fa0. now preserve file\ntimestamps with nanosecond precision on platforms that support it.\nThey also preserve file \"extended attributes\" on Linux.\n(Contributed by Larry Hastings in bpo-14127(4) and bpo-15238(5).)\n\n* Several functions now take an optional 'symlinks' argument: when\nthat parameter is true, symlinks aren't dereferenced and the\noperation instead acts on the symlink itself (or creates one, if\nrelevant).  (Contributed by Hynek Schlawack in bpo-12715(6).)\n\n* When copying files to a different file system, *note move(): 889.\nnow handles symlinks the way the posix 'mv' command does,\nrecreating the symlink rather than copying the target file\ncontents.  (Contributed by Jonathan Niehof in bpo-9993(7).)  *note\nmove(): 889. now also returns the 'dst' argument as its result.\n\n* *note rmtree(): 1d5. is now resistant to symlink attacks on\nplatforms which support the new 'dirfd' parameter in *note\nos.open(): bee. and *note os.unlink(): f66.  (Contributed by Martin\nvon Lo\"wis and Hynek Schlawack in bpo-4489(8).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=12442\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=12191\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=13609\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=14127\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=15238\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=12715\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=9993\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=4489\n\nFile: python3.12.info,  Node: signal<4>,  Next: smtpd<4>,  Prev: shutil<6>,  Up: Improved Modules<10>\n\n1.10.20.43 signal\n.................\n\n* The *note signal: c1. module has new functions:\n\n* *note pthreadsigmask(): fa2.: fetch and/or change the signal\nmask of the calling thread (Contributed by Jean-Paul Calderone\nin bpo-8407(1));\n\n* *note pthreadkill(): fa3.: send a signal to a thread;\n\n* *note sigpending(): fa4.: examine pending functions;\n\n* *note sigwait(): fa5.: wait a signal;\n\n* *note sigwaitinfo(): c07.: wait for a signal, returning\ndetailed information about it;\n\n* *note sigtimedwait(): c06.: like *note sigwaitinfo(): c07. but\nwith a timeout.\n\n* The signal handler writes the signal number as a single byte\ninstead of a nul byte into the wakeup file descriptor.  So it is\npossible to wait more than one signal and know which signals were\nraised.\n\n* *note signal.signal(): fa6. and *note signal.siginterrupt(): fa7.\nraise an OSError, instead of a RuntimeError: OSError has an errno\nattribute.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=8407\n\nFile: python3.12.info,  Node: smtpd<4>,  Next: smtplib<4>,  Prev: signal<4>,  Up: Improved Modules<10>\n\n1.10.20.44 smtpd\n................\n",
            "subsections": []
        },
        "The 'smtpd' module now supports RFC 5321(1) (extended SMTP) and RFC": {
            "content": "1870(2) (size extension).  Per the standard, these extensions are\nenabled if and only if the client initiates the session with an 'EHLO'\ncommand.\n\n(Initial 'ELHO' support by Alberto Trevino.  Size extension by Juhana",
            "subsections": []
        },
        "Jauhiainen.  Substantial additional work on the patch contributed by": {
            "content": "Michele Orr?? and Dan Boswell.  bpo-8739(3))\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc5321.html\n\n(2) https://datatracker.ietf.org/doc/html/rfc1870.html\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=8739\n\nFile: python3.12.info,  Node: smtplib<4>,  Next: socket<10>,  Prev: smtpd<4>,  Up: Improved Modules<10>\n\n1.10.20.45 smtplib\n..................\n\nThe *note SMTP: 74b, *note SMTPSSL: 74c, and *note LMTP: 74d. classes\nnow accept a 'sourceaddress' keyword argument to specify the '(host,\nport)' to use as the source address in the bind call when creating the\noutgoing socket.  (Contributed by Paulo Scardine in bpo-11281(1).)\n\n*note SMTP: 74b. now supports the context management protocol, allowing\nan 'SMTP' instance to be used in a 'with' statement.  (Contributed by\nGiampaolo Rodola` in bpo-11289(2).)\n\nThe *note SMTPSSL: 74c. constructor and the *note starttls(): faa.\nmethod now accept an SSLContext parameter to control parameters of the\nsecure channel.  (Contributed by Kasun Herath in bpo-8809(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=11281\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=11289\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=8809\n\nFile: python3.12.info,  Node: socket<10>,  Next: socketserver<3>,  Prev: smtplib<4>,  Up: Improved Modules<10>\n\n1.10.20.46 socket\n.................\n\n* The *note socket: bfd. class now exposes additional methods to\nprocess ancillary data when supported by the underlying platform:\n\n* *note sendmsg(): 191.\n\n* *note recvmsg(): c02.\n\n* *note recvmsginto(): fac.\n\n(Contributed by David Watson in bpo-6560(1), based on an earlier\npatch by Heiko Wundram)\n\n* The *note socket: bfd. class now supports the PFCAN protocol\nfamily ('https://en.wikipedia.org/wiki/Socketcan'), on Linux\n('https://lwn.net/Articles/253425').\n\n(Contributed by Matthias Fuchs, updated by Tiago Gonc,alves in\nbpo-10141(2).)\n\n* The *note socket: bfd. class now supports the PFRDS protocol\nfamily ('https://en.wikipedia.org/wiki/ReliableDatagramSockets'\nand https://oss.oracle.com/projects/rds(3)).\n\n* The *note socket: bfd. class now supports the 'PFSYSTEM' protocol\nfamily on OS X. (Contributed by Michael Goderbauer in\nbpo-13777(4).)\n\n* New function *note sethostname(): fad. allows the hostname to be\nset on Unix systems if the calling process has sufficient\nprivileges.  (Contributed by Ross Lagerwall in bpo-10866(5).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=6560\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=10141\n\n(3)\nhttps://web.archive.org/web/20130115155505/https://oss.oracle.com/projects/rds/\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=13777\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=10866\n\nFile: python3.12.info,  Node: socketserver<3>,  Next: sqlite3<9>,  Prev: socket<10>,  Up: Improved Modules<10>\n\n1.10.20.47 socketserver\n.......................\n\n*note BaseServer: faf. now has an overridable method *note\nserviceactions(): fb0. that is called by the *note serveforever():\nfb1. method in the service loop.  *note ForkingMixIn: 9b8. now uses this\nto clean up zombie child processes.  (Contributed by Justin Warkentin in\nbpo-11109(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=11109\n\nFile: python3.12.info,  Node: sqlite3<9>,  Next: ssl<10>,  Prev: socketserver<3>,  Up: Improved Modules<10>\n\n1.10.20.48 sqlite3\n..................\n\nNew *note sqlite3.Connection: 1d9. method *note settracecallback():\nfb3. can be used to capture a trace of all sql commands processed by\nsqlite.  (Contributed by Torsten Landschoff in bpo-11688(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=11688\n\nFile: python3.12.info,  Node: ssl<10>,  Next: stat<2>,  Prev: sqlite3<9>,  Up: Improved Modules<10>\n\n1.10.20.49 ssl\n..............\n\n* The *note ssl: ca. module has two new random generation functions:\n\n* *note RANDbytes(): 277.: generate cryptographically strong\npseudo-random bytes.\n\n* 'RANDpseudobytes()': generate pseudo-random bytes.\n\n(Contributed by Victor Stinner in bpo-12049(1).)\n\n* The *note ssl: ca. module now exposes a finer-grained exception\nhierarchy in order to make it easier to inspect the various kinds\nof errors.  (Contributed by Antoine Pitrou in bpo-11183(2).)\n\n* *note loadcertchain(): fb5. now accepts a 'password' argument to\nbe used if the private key is encrypted.  (Contributed by Adam\nSimpkins in bpo-12803(3).)\n\n* Diffie-Hellman key exchange, both regular and Elliptic Curve-based,\nis now supported through the *note loaddhparams(): fb6. and *note\nsetecdhcurve(): fb7. methods.  (Contributed by Antoine Pitrou in\nbpo-13626(4) and bpo-13627(5).)\n\n* SSL sockets have a new *note getchannelbinding(): fb8. method\nallowing the implementation of certain authentication mechanisms\nsuch as SCRAM-SHA-1-PLUS. (Contributed by Jacek Konieczny in\nbpo-12551(6).)\n\n* You can query the SSL compression algorithm used by an SSL socket,\nthanks to its new *note compression(): fb9. method.  The new\nattribute *note OPNOCOMPRESSION: fba. can be used to disable\ncompression.  (Contributed by Antoine Pitrou in bpo-13634(7).)\n\n* Support has been added for the Next Protocol Negotiation extension\nusing the *note ssl.SSLContext.setnpnprotocols(): 67e. method.\n(Contributed by Colin Marc in bpo-14204(8).)\n\n* SSL errors can now be introspected more easily thanks to *note\nlibrary: fbb. and *note reason: fbc. attributes.  (Contributed by\nAntoine Pitrou in bpo-14837(9).)\n\n* The *note getservercertificate(): 631. function now supports\nIPv6.  (Contributed by Charles-Franc,ois Natali in bpo-11811(10).)\n\n* New attribute *note OPCIPHERSERVERPREFERENCE: fbd. allows\nsetting SSLv3 server sockets to use the server's cipher ordering\npreference rather than the client's (bpo-13635(11)).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=12049\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=11183\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=12803\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=13626\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=13627\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=12551\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=13634\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=14204\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=14837\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=11811\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=13635\n\nFile: python3.12.info,  Node: stat<2>,  Next: struct<3>,  Prev: ssl<10>,  Up: Improved Modules<10>\n\n1.10.20.50 stat\n...............\n\nThe undocumented tarfile.filemode function has been moved to *note\nstat.filemode(): fbf.  It can be used to convert a file's mode to a\nstring of the form '-rwxrwxrwx'.\n\n(Contributed by Giampaolo Rodola` in bpo-14807(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=14807\n\nFile: python3.12.info,  Node: struct<3>,  Next: subprocess<5>,  Prev: stat<2>,  Up: Improved Modules<10>\n\n1.10.20.51 struct\n.................\n\nThe *note struct: cf. module now supports 'ssizet' and 'sizet' via the\nnew codes 'n' and 'N', respectively.  (Contributed by Antoine Pitrou in\nbpo-3163(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=3163\n\nFile: python3.12.info,  Node: subprocess<5>,  Next: sys<11>,  Prev: struct<3>,  Up: Improved Modules<10>\n\n1.10.20.52 subprocess\n.....................\n\nCommand strings can now be bytes objects on posix platforms.\n(Contributed by Victor Stinner in bpo-8513(1).)\n\nA new constant *note DEVNULL: fc2. allows suppressing output in a\nplatform-independent fashion.  (Contributed by Ross Lagerwall in\nbpo-5870(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=8513\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=5870\n\nFile: python3.12.info,  Node: sys<11>,  Next: tarfile<9>,  Prev: subprocess<5>,  Up: Improved Modules<10>\n\n1.10.20.53 sys\n..............\n\nThe *note sys: d3. module has a new *note threadinfo: fc4. *note named\ntuple: 417. holding information about the thread implementation\n(bpo-11223(1)).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=11223\n\nFile: python3.12.info,  Node: tarfile<9>,  Next: tempfile<3>,  Prev: sys<11>,  Up: Improved Modules<10>\n\n1.10.20.54 tarfile\n..................\n\n*note tarfile: d8. now supports 'lzma' encoding via the *note lzma: 85.\nmodule.  (Contributed by Lars Gusta\"bel in bpo-5689(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=5689\n\nFile: python3.12.info,  Node: tempfile<3>,  Next: textwrap<2>,  Prev: tarfile<9>,  Up: Improved Modules<10>\n\n1.10.20.55 tempfile\n...................\n\n*note tempfile.SpooledTemporaryFile: 45f.'s 'truncate()' method now\naccepts a 'size' parameter.  (Contributed by Ryan Kelly in bpo-9957(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=9957\n\nFile: python3.12.info,  Node: textwrap<2>,  Next: threading<8>,  Prev: tempfile<3>,  Up: Improved Modules<10>\n\n1.10.20.56 textwrap\n...................\n\nThe *note textwrap: e6. module has a new *note indent(): fc8. that makes\nit straightforward to add a common prefix to selected lines in a block\nof text (bpo-13857(1)).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=13857\n\nFile: python3.12.info,  Node: threading<8>,  Next: time<7>,  Prev: textwrap<2>,  Up: Improved Modules<10>\n\n1.10.20.57 threading\n....................\n\n*note threading.Condition: fca, *note threading.Semaphore: fcb, *note\nthreading.BoundedSemaphore: fcc, *note threading.Event: fcd, and *note\nthreading.Timer: fce, all of which used to be factory functions\nreturning a class instance, are now classes and may be subclassed.\n(Contributed by ??ric Araujo in bpo-10968(1).)\n\nThe *note threading.Thread: 76c. constructor now accepts a 'daemon'\nkeyword argument to override the default behavior of inheriting the\n'daemon' flag value from the parent thread (bpo-6064(2)).\n",
            "subsections": []
        },
        "The formerly private function 'thread.getident' is now available as": {
            "content": "the public function *note threading.getident(): fcf.  This eliminates\nseveral cases of direct access to the 'thread' module in the stdlib.",
            "subsections": []
        },
        "Third party code that used 'thread.getident' should likewise be": {
            "content": "changed to use the new public interface.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=10968\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=6064\n\nFile: python3.12.info,  Node: time<7>,  Next: types<6>,  Prev: threading<8>,  Up: Improved Modules<10>\n\n1.10.20.58 time\n...............\n\nThe PEP 418(1) added new functions to the *note time: e8. module:\n\n* *note getclockinfo(): fd1.: Get information on a clock.\n\n* *note monotonic(): ce1.: Monotonic clock (cannot go backward), not\naffected by system clock updates.\n\n* *note perfcounter(): 8b6.: Performance counter with the highest\navailable resolution to measure a short duration.\n\n* *note processtime(): 8b7.: Sum of the system and user CPU time of\nthe current process.\n\nOther new functions:\n\n* *note clockgetres(): fd2, *note clockgettime(): fd3. and *note\nclocksettime(): fd4. functions with 'CLOCKXXX' constants.\n(Contributed by Victor Stinner in bpo-10278(2).)\n\nTo improve cross platform consistency, *note sleep(): 469. now raises a\n*note ValueError: 183. when passed a negative sleep value.  Previously\nthis was an error on posix, but produced an infinite sleep on Windows.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0418/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=10278\n\nFile: python3.12.info,  Node: types<6>,  Next: unittest<9>,  Prev: time<7>,  Up: Improved Modules<10>\n\n1.10.20.59 types\n................\n\nAdd a new *note types.MappingProxyType: 186. class: Read-only proxy of a\nmapping.  (bpo-14386(1))\n\nThe new functions *note types.newclass(): fd6. and *note\ntypes.prepareclass(): fd7. provide support for PEP 3115(2) compliant\ndynamic type creation.  (bpo-14588(3))\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=14386\n\n(2) https://peps.python.org/pep-3115/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=14588\n\nFile: python3.12.info,  Node: unittest<9>,  Next: urllib<3>,  Prev: types<6>,  Up: Improved Modules<10>\n\n1.10.20.60 unittest\n...................\n\n*note assertRaises(): 281, *note assertRaisesRegex(): 283, *note\nassertWarns(): fd9, and *note assertWarnsRegex(): fda. now accept a\nkeyword argument 'msg' when used as context managers.  (Contributed by",
            "subsections": []
        },
        "Ezio Melotti and Winston Ewert in bpo-10775(1).)": {
            "content": "*note unittest.TestCase.run(): fdb. now returns the *note TestResult:\nfdc. object.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=10775\n\nFile: python3.12.info,  Node: urllib<3>,  Next: webbrowser<2>,  Prev: unittest<9>,  Up: Improved Modules<10>\n\n1.10.20.61 urllib\n.................\n\nThe *note Request: e4b. class, now accepts a 'method' argument used by\n*note getmethod(): fde. to determine what HTTP method should be used.\nFor example, this will send a ''HEAD'' request:\n\n>>> urlopen(Request('https://www.python.org', method='HEAD'))\n\n(bpo-1673007(1))\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=1673007\n\nFile: python3.12.info,  Node: webbrowser<2>,  Next: xml etree ElementTree<2>,  Prev: urllib<3>,  Up: Improved Modules<10>\n\n1.10.20.62 webbrowser\n.....................\n\nThe *note webbrowser: 110. module supports more \"browsers\": Google",
            "subsections": []
        },
        "Chrome (named 'chrome', 'chromium', 'chrome-browser' or": {
            "content": "'chromium-browser' depending on the version and operating system), and\nthe generic launchers 'xdg-open', from the FreeDesktop.org project, and\n'gvfs-open', which is the default URI handler for GNOME 3.  (The former\ncontributed by Arnaud Calmettes in bpo-13620(1), the latter by Matthias",
            "subsections": []
        },
        "Klose in bpo-14493(2).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=13620\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=14493\n\nFile: python3.12.info,  Node: xml etree ElementTree<2>,  Next: zlib<2>,  Prev: webbrowser<2>,  Up: Improved Modules<10>\n\n1.10.20.63 xml.etree.ElementTree\n................................\n\nThe *note xml.etree.ElementTree: 120. module now imports its C\naccelerator by default; there is no longer a need to explicitly import\n'xml.etree.cElementTree' (this module stays for backwards compatibility,\nbut is now deprecated).  In addition, the 'iter' family of methods of\n*note Element: 23e. has been optimized (rewritten in C). The module's\ndocumentation has also been greatly improved with added examples and a\nmore detailed reference.\n\nFile: python3.12.info,  Node: zlib<2>,  Prev: xml etree ElementTree<2>,  Up: Improved Modules<10>\n\n1.10.20.64 zlib\n...............\n\nNew attribute *note zlib.Decompress.eof: fe2. makes it possible to\ndistinguish between a properly formed compressed stream and an\nincomplete or truncated one.  (Contributed by Nadeem Vawda in\nbpo-12646(1).)\n\nNew attribute *note zlib.ZLIBRUNTIMEVERSION: fe3. reports the version\nstring of the underlying 'zlib' library that is loaded at runtime.\n(Contributed by Torsten Landschoff in bpo-12306(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=12646\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=12306\n\nFile: python3.12.info,  Node: Optimizations<9>,  Next: Build and C API Changes<4>,  Prev: Improved Modules<10>,  Up: What's New In Python 3 3\n\n\nMajor performance enhancements have been added:\n\n* Thanks to PEP 393(1), some operations on Unicode strings have been\noptimized:\n\n* the memory footprint is divided by 2 to 4 depending on the\ntext\n\n* encode an ASCII string to UTF-8 doesn't need to encode\ncharacters anymore, the UTF-8 representation is shared with\nthe ASCII representation\n\n* the UTF-8 encoder has been optimized\n\n* repeating a single ASCII letter and getting a substring of an\nASCII string is 4 times faster\n\n* UTF-8 is now 2x to 4x faster.  UTF-16 encoding is now up to 10x\nfaster.\n\n(Contributed by Serhiy Storchaka, bpo-14624(2), bpo-14738(3) and\nbpo-15026(4).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0393/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=14624\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=14738\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=15026\n\nFile: python3.12.info,  Node: Build and C API Changes<4>,  Next: Deprecated<12>,  Prev: Optimizations<9>,  Up: What's New In Python 3 3\n\n\nChanges to Python's build process and to the C API include:\n\n* New PEP 3118(1) related function:\n\n* *note PyMemoryViewFromMemory(): fe5.\n\n* PEP 393(2) added new Unicode types, macros and functions:\n\n* High-level API:\n\n* *note PyUnicodeCopyCharacters(): 6cd.\n\n* *note PyUnicodeFindChar(): 6d1.\n\n* *note PyUnicodeGetLength(): 6cb, *note\nPyUnicodeGETLENGTH: 6cc.\n\n* *note PyUnicodeNew(): 6c1.\n\n* *note PyUnicodeSubstring(): 6ce.\n\n* *note PyUnicodeReadChar(): fe6, *note\nPyUnicodeWriteChar(): fe7.\n\n* Low-level API:\n\n* *note PyUCS1: fe8, *note PyUCS2: fe9, *note PyUCS4:\nfea. types\n\n* *note PyASCIIObject: feb. and *note\nPyCompactUnicodeObject: fec. structures\n\n* *note PyUnicodeREADY: 341.\n\n* *note PyUnicodeFromKindAndData(): fed.\n\n* *note PyUnicodeAsUCS4(): fee, *note\nPyUnicodeAsUCS4Copy(): 6d3.\n\n* *note PyUnicodeDATA: fef, *note PyUnicode1BYTEDATA:\nff0, *note PyUnicode2BYTEDATA: ff1, *note\nPyUnicode4BYTEDATA: ff2.\n\n* *note PyUnicodeKIND: ff3. with 'PyUnicodeKind' enum:\n'PyUnicodeWCHARKIND', *note PyUnicode1BYTEKIND: ff4,\n*note PyUnicode2BYTEKIND: ff5, *note\nPyUnicode4BYTEKIND: ff6.\n\n* *note PyUnicodeREAD: ff7, *note PyUnicodeREADCHAR:\nff8, *note PyUnicodeWRITE: ff9.\n\n* *note PyUnicodeMAXCHARVALUE: ffa.\n\n* *note PyArgParseTuple: 2d1. now accepts a *note bytearray: 294.\nfor the 'c' format (bpo-12380(3)).\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3118/\n\n(2) https://peps.python.org/pep-0393/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=12380\n\nFile: python3.12.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\n\n\n* Menu:\n\n* Unsupported Operating Systems: Unsupported Operating Systems<2>.\n* Deprecated Python modules, functions and methods: Deprecated Python modules functions and methods<4>.\n* Deprecated functions and types of the C API: Deprecated functions and types of the C API<3>.\n* Deprecated features::\n\nFile: python3.12.info,  Node: Unsupported Operating Systems<2>,  Next: Deprecated Python modules functions and methods<4>,  Up: Deprecated<12>\n\n1.10.23.1 Unsupported Operating Systems\n.......................................\n\nOS/2 and VMS are no longer supported due to the lack of a maintainer.\n",
            "subsections": []
        },
        "Windows 2000 and Windows platforms which set 'COMSPEC' to 'command.com'": {
            "content": "are no longer supported due to maintenance burden.\n\nOSF support, which was deprecated in 3.2, has been completely removed.\n\nFile: python3.12.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>\n\n1.10.23.2 Deprecated Python modules, functions and methods\n..........................................................\n\n* Passing a non-empty string to 'object.format()' is deprecated,\nand will produce a *note TypeError: 28e. in Python 3.4\n(bpo-9856(1)).\n\n* The 'unicodeinternal' codec has been deprecated because of the PEP\n393(2), use UTF-8, UTF-16 ('utf-16-le' or 'utf-16-be'), or UTF-32\n('utf-32-le' or 'utf-32-be')\n\n* *note ftplib.FTP.nlst(): f33. and *note ftplib.FTP.dir(): f34.: use\n*note ftplib.FTP.mlsd(): f32.\n\n* 'platform.popen()': use the *note subprocess: d0. module.  Check\nespecially the *note Replacing Older Functions with the subprocess\nModule: ffe. section (bpo-11377(3)).\n\n* bpo-13374(4): The Windows bytes API has been deprecated in the\n*note os: 9c. module.  Use Unicode filenames, instead of bytes\nfilenames, to not depend on the ANSI code page anymore and to\nsupport any filename.\n\n* bpo-13988(5): The 'xml.etree.cElementTree' module is deprecated.\nThe accelerator is used automatically whenever available.\n\n* The behaviour of 'time.clock()' depends on the platform: use the\nnew *note time.perfcounter(): 8b6. or *note time.processtime():\n8b7. function instead, depending on your requirements, to have a\nwell defined behaviour.\n\n* The 'os.statfloattimes()' function is deprecated.\n\n* *note abc: 4. module:\n\n* *note abc.abstractproperty: efc. has been deprecated, use\n*note property: 3f6. with *note abc.abstractmethod(): efd.\ninstead.\n\n* *note abc.abstractclassmethod: efe. has been deprecated, use\n*note classmethod: 246. with *note abc.abstractmethod(): efd.\ninstead.\n\n* *note abc.abstractstaticmethod: eff. has been deprecated, use\n*note staticmethod: 5cc. with *note abc.abstractmethod(): efd.\ninstead.\n\n* *note importlib: 71. package:\n\n* *note importlib.abc.SourceLoader.pathmtime(): fff. is now\ndeprecated in favour of *note\nimportlib.abc.SourceLoader.pathstats(): 1000. as bytecode\nfiles now store both the modification time and size of the\nsource file the bytecode file was compiled from.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=9856\n\n(2) https://peps.python.org/pep-0393/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=11377\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=13374\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=13988\n\nFile: python3.12.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>\n\n1.10.23.3 Deprecated functions and types of the C API\n.....................................................\n\nThe *note PyUNICODE: 326. has been deprecated by PEP 393(1) and will be\nremoved in Python 4.  All functions using this type are deprecated:\n\nUnicode functions and methods using *note PyUNICODE: 326. and *note\nPyUNICODE: 326.* types:\n\n* 'PyUnicodeFromUnicode': use *note PyUnicodeFromWideChar(): 1002.\nor *note PyUnicodeFromKindAndData(): fed.\n\n* 'PyUnicodeASUNICODE', 'PyUnicodeAsUnicode()',\n'PyUnicodeAsUnicodeAndSize()': use *note\nPyUnicodeAsWideCharString(): 6d4.\n\n* 'PyUnicodeASDATA': use *note PyUnicodeDATA: fef. with *note\nPyUnicodeREAD: ff7. and *note PyUnicodeWRITE: ff9.\n\n* 'PyUnicodeGETSIZE', 'PyUnicodeGetSize()': use *note\nPyUnicodeGETLENGTH: 6cc. or *note PyUnicodeGetLength(): 6cb.\n\n* 'PyUnicodeGETDATASIZE': use 'PyUnicodeGETLENGTH(str) *\nPyUnicodeKIND(str)' (only work on ready strings)\n\n* 'PyUnicodeAsUnicodeCopy()': use *note PyUnicodeAsUCS4Copy(): 6d3.\nor *note PyUnicodeAsWideCharString(): 6d4.\n\n* 'PyUnicodeGetMax()'\n\nFunctions and macros manipulating PyUNICODE* strings:\n\n* 'PyUNICODEstrlen()': use *note PyUnicodeGetLength(): 6cb. or\n*note PyUnicodeGETLENGTH: 6cc.\n\n* 'PyUNICODEstrcat()': use *note PyUnicodeCopyCharacters(): 6cd.\nor *note PyUnicodeFromFormat(): 2d5.\n\n* 'PyUNICODEstrcpy()', 'PyUNICODEstrncpy()', 'PyUNICODECOPY()':\nuse *note PyUnicodeCopyCharacters(): 6cd. or *note\nPyUnicodeSubstring(): 6ce.\n\n* 'PyUNICODEstrcmp()': use *note PyUnicodeCompare(): 6cf.\n\n* 'PyUNICODEstrncmp()': use *note PyUnicodeTailmatch(): 6d0.\n\n* 'PyUNICODEstrchr()', 'PyUNICODEstrrchr()': use *note\nPyUnicodeFindChar(): 6d1.\n\n* 'PyUNICODEFILL()': use *note PyUnicodeFill(): 1003.\n\n* 'PyUNICODEMATCH'\n\nEncoders:\n\n* 'PyUnicodeEncode()': use 'PyUnicodeAsEncodedObject()'\n\n* 'PyUnicodeEncodeUTF7()'\n\n* 'PyUnicodeEncodeUTF8()': use *note PyUnicodeAsUTF8(): 9ff. or\n*note PyUnicodeAsUTF8String(): 1004.\n\n* 'PyUnicodeEncodeUTF32()'\n\n* 'PyUnicodeEncodeUTF16()'\n\n* 'PyUnicodeEncodeUnicodeEscape()' use *note\nPyUnicodeAsUnicodeEscapeString(): 1005.\n\n* 'PyUnicodeEncodeRawUnicodeEscape()' use *note\nPyUnicodeAsRawUnicodeEscapeString(): 1006.\n\n* 'PyUnicodeEncodeLatin1()': use *note PyUnicodeAsLatin1String():\n1007.\n\n* 'PyUnicodeEncodeASCII()': use *note PyUnicodeAsASCIIString():\n1008.\n\n* 'PyUnicodeEncodeCharmap()'\n\n* 'PyUnicodeTranslateCharmap()'\n\n* 'PyUnicodeEncodeMBCS()': use *note PyUnicodeAsMBCSString(): 1009.\nor *note PyUnicodeEncodeCodePage(): 100a. (with 'CPACP'\ncodepage)\n\n* 'PyUnicodeEncodeDecimal()', 'PyUnicodeTransformDecimalToASCII()'\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0393/\n\nFile: python3.12.info,  Node: Deprecated features,  Prev: Deprecated functions and types of the C API<3>,  Up: Deprecated<12>\n\n1.10.23.4 Deprecated features\n.............................\n\nThe *note array: 7. module's ''u'' format code is now deprecated and\nwill be removed in Python 4 together with the rest of the (*note\nPyUNICODE: 326.) API.\n\nFile: python3.12.info,  Node: Porting to Python 3 3,  Prev: Deprecated<12>,  Up: What's New In Python 3 3\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Porting Python code,  Next: Porting C code,  Up: Porting to Python 3 3": {
            "content": "1.10.24.1 Porting Python code\n.............................\n\n* Hash randomization is enabled by default.  Set the *note\nPYTHONHASHSEED: ef4. environment variable to '0' to disable hash\nrandomization.  See also the *note object.hash(): 932. method.\n\n* bpo-12326(1): On Linux, sys.platform doesn't contain the major\nversion anymore.  It is now always 'linux', instead of 'linux2' or\n'linux3' depending on the Linux version used to build Python.\nReplace sys.platform == 'linux2' with\nsys.platform.startswith('linux'), or directly sys.platform ==\n'linux' if you don't need to support older Python versions.\n\n* bpo-13847(2), bpo-14180(3): *note time: e8. and *note datetime:\n2e.: *note OverflowError: 68d. is now raised instead of *note\nValueError: 183. if a timestamp is out of range.  *note OSError:\n613. is now raised if C functions 'gmtime()' or 'localtime()'\nfailed.\n\n* The default finders used by import now utilize a cache of what is\ncontained within a specific directory.  If you create a Python\nsource file or sourceless bytecode file, make sure to call *note\nimportlib.invalidatecaches(): a56. to clear out the cache for the\nfinders to notice the new file.\n\n* *note ImportError: 145. now uses the full name of the module that\nwas attempted to be imported.  Doctests that check ImportErrors'\nmessage will need to be updated to use the full name of the module\ninstead of just the tail of the name.\n\n* The 'index' argument to *note import(): 6ed. now defaults to 0\ninstead of -1 and no longer support negative values.  It was an\noversight when PEP 328(4) was implemented that the default value\nremained -1.  If you need to continue to perform a relative import\nfollowed by an absolute import, then perform the relative import\nusing an index of 1, followed by another import using an index of\n0.  It is preferred, though, that you use *note\nimportlib.importmodule(): 26a. rather than call *note\nimport(): 6ed. directly.\n\n* *note import(): 6ed. no longer allows one to use an index value\nother than 0 for top-level modules.  E.g.  'import('sys',\nlevel=1)' is now an error.\n\n* Because *note sys.metapath: b80. and *note sys.pathhooks: e9b.\nnow have finders on them by default, you will most likely want to\nuse 'list.insert()' instead of 'list.append()' to add to those\nlists.\n\n* Because 'None' is now inserted into *note sys.pathimportercache:\n3a9, if you are clearing out entries in the dictionary of paths\nthat do not have a finder, you will need to remove keys paired with\nvalues of 'None' 'and' 'imp.NullImporter' to be\nbackwards-compatible.  This will lead to extra overhead on older\nversions of Python that re-insert 'None' into *note\nsys.pathimportercache: 3a9. where it represents the use of\nimplicit finders, but semantically it should not change anything.\n\n* 'importlib.abc.Finder' no longer specifies a 'findmodule()'\nabstract method that must be implemented.  If you were relying on\nsubclasses to implement that method, make sure to check for the\nmethod's existence first.  You will probably want to check for\n'findloader()' first, though, in the case of working with *note\npath entry finders: ee8.\n\n* *note pkgutil: a4. has been converted to use *note importlib: 71.\ninternally.  This eliminates many edge cases where the old\nbehaviour of the PEP 302(5) import emulation failed to match the\nbehaviour of the real import system.  The import emulation itself\nis still present, but is now deprecated.  The *note\npkgutil.iterimporters(): 100e. and *note pkgutil.walkpackages():\na45. functions special case the standard import hooks so they are\nstill supported even though they do not provide the non-standard\n'itermodules()' method.\n\n* A longstanding RFC-compliance bug (bpo-1079(6)) in the parsing done\nby *note email.header.decodeheader(): f28. has been fixed.  Code\nthat uses the standard idiom to convert encoded headers into\nunicode ('str(makeheader(decodeheader(h))') will see no change,\nbut code that looks at the individual tuples returned by\ndecodeheader will see that whitespace that precedes or follows\n'ASCII' sections is now included in the 'ASCII' section.  Code that\nbuilds headers using 'makeheader' should also continue to work\nwithout change, since 'makeheader' continues to add whitespace\nbetween 'ASCII' and non-'ASCII' sections if it is not already\npresent in the input strings.\n\n* *note email.utils.formataddr(): 100f. now does the correct content\ntransfer encoding when passed non-'ASCII' display names.  Any code\nthat depended on the previous buggy behavior that preserved the\nnon-'ASCII' unicode in the formatted output string will need to be\nchanged (bpo-1690608(7)).\n\n* *note poplib.POP3.quit(): 1010. may now raise protocol errors like\nall other 'poplib' methods.  Code that assumes 'quit' does not\nraise *note poplib.errorproto: 1011. errors may need to be changed\nif errors on 'quit' are encountered by a particular application\n(bpo-11291(8)).\n\n* The 'strict' argument to *note email.parser.Parser: 1012,\ndeprecated since Python 2.4, has finally been removed.\n\n* The deprecated method 'unittest.TestCase.assertSameElements' has\nbeen removed.\n\n* The deprecated variable 'time.accept2dyear' has been removed.\n\n* The deprecated 'Context.clamp' attribute has been removed from the\n*note decimal: 33. module.  It was previously replaced by the\npublic attribute 'clamp'.  (See bpo-8540(9).)\n\n* The undocumented internal helper class 'SSLFakeFile' has been\nremoved from *note smtplib: c4, since its functionality has long\nbeen provided directly by *note socket.socket.makefile(): 1013.\n\n* Passing a negative value to *note time.sleep(): 469. on Windows now\nraises an error instead of sleeping forever.  It has always raised\nan error on posix.\n\n* The 'ast.version' constant has been removed.  If you need to\nmake decisions affected by the AST version, use *note\nsys.versioninfo: 46c. to make the decision.\n\n* Code that used to work around the fact that the *note threading:\ne7. module used factory functions by subclassing the private\nclasses will need to change to subclass the now-public classes.\n\n* The undocumented debugging machinery in the threading module has\nbeen removed, simplifying the code.  This should have no effect on\nproduction code, but is mentioned here in case any application\ndebug frameworks were interacting with it (bpo-13550(10)).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=12326\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=13847\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=14180\n\n(4) https://peps.python.org/pep-0328/\n\n(5) https://peps.python.org/pep-0302/\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=1079\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=1690608\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=11291\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=8540\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=13550\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Porting C code,  Next: Building C extensions,  Prev: Porting Python code,  Up: Porting to Python 3 3": {
            "content": "1.10.24.2 Porting C code\n........................\n\n* In the course of changes to the buffer API the undocumented\n'smalltable' member of the *note Pybuffer: 53f. structure has been\nremoved and the layout of the 'PyMemoryViewObject' has changed.\n\nAll extensions relying on the relevant parts in 'memoryobject.h' or\n'object.h' must be rebuilt.\n\n* Due to *note PEP 393: eb6, the *note PyUNICODE: 326. type and all\nfunctions using this type are deprecated (but will stay available\nfor at least five years).  If you were using low-level Unicode APIs\nto construct and access unicode objects and you want to benefit of\nthe memory footprint reduction provided by PEP 393(1), you have to\nconvert your code to the new *note Unicode API: 1014.\n\nHowever, if you only have been using high-level functions such as\n*note PyUnicodeConcat(): 1015, *note PyUnicodeJoin(): 1016. or\n*note PyUnicodeFromFormat(): 2d5, your code will automatically\ntake advantage of the new unicode representations.\n\n* *note PyImportGetMagicNumber(): 1017. now returns '-1' upon\nfailure.\n\n* As a negative value for the 'level' argument to *note import():\n6ed. is no longer valid, the same now holds for *note\nPyImportImportModuleLevel(): 1018.  This also means that the value\nof 'level' used by *note PyImportImportModuleEx(): 1019. is now\n'0' instead of '-1'.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0393/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Building C extensions,  Next: Command Line Switch Changes,  Prev: Porting C code,  Up: Porting to Python 3 3": {
            "content": "1.10.24.3 Building C extensions\n...............................\n\n* The range of possible file names for C extensions has been\nnarrowed.  Very rarely used spellings have been suppressed: under\nPOSIX, files named 'xxxmodule.so', 'xxxmodule.abi3.so' and\n'xxxmodule.cpython-*.so' are no longer recognized as implementing\nthe 'xxx' module.  If you had been generating such files, you have\nto switch to the other spellings (i.e., remove the 'module' string\nfrom the file names).\n\n(implemented in bpo-14040(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=14040\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Command Line Switch Changes,  Prev: Building C extensions,  Up: Porting to Python 3 3": {
            "content": "1.10.24.4 Command Line Switch Changes\n.....................................\n\n* The -Q command-line flag and related artifacts have been removed.\nCode checking sys.flags.divisionwarning will need updating.\n\n(bpo-10998(1), contributed by ??ric Araujo.)\n\n* When 'python' is started with *note -S: 101c, 'import site' will no\nlonger add site-specific paths to the module search paths.  In\nprevious versions, it did.\n\n(bpo-11591(2), contributed by Carl Meyer with editions by ??ric\nAraujo.)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=10998\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=11591\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": [
                {
                    "name": "1.11 What's New In Python 3.2",
                    "content": ""
                }
            ]
        },
        "Author: Raymond Hettinger": {
            "content": "Contact: <python at rcn dot com>\n\n*note Descriptors: 1c78. let objects customize attribute lookup,\nstorage, and deletion.\n\nThis guide has four major sections:\n\n1. The \"primer\" gives a basic overview, moving gently from simple\nexamples, adding one feature at a time.  Start here if you're new\nto descriptors.\n\n2. The second section shows a complete, practical descriptor example.\nIf you already know the basics, start there.\n\n3. The third section provides a more technical tutorial that goes into\nthe detailed mechanics of how descriptors work.  Most people don't\nneed this level of detail.\n\n4. The last section has pure Python equivalents for built-in\ndescriptors that are written in C. Read this if you're curious\nabout how functions turn into bound methods or about the\nimplementation of common tools like *note classmethod(): 246, *note\nstaticmethod(): 5cc, *note property(): 3f6, and *note slots:\n3a3.\n\n* Menu:\n\n* Primer::\n* Complete Practical Example::\n* Technical Tutorial::\n* Pure Python Equivalents::\n",
            "subsections": []
        },
        "Python 3.2 was released on February 20, 2011.  It focuses on a few": {
            "content": "highlights and gives a few examples.  For full details, see the\nMisc/NEWS(1) file.\n\nSee also\n........\n\nPEP 392(2) - Python 3.2 Release Schedule\n\n* Menu:\n\n* PEP 384; Defining a Stable ABI: PEP 384 Defining a Stable ABI.\n* PEP 389; Argparse Command Line Parsing Module: PEP 389 Argparse Command Line Parsing Module.\n* PEP 391; Dictionary Based Configuration for Logging: PEP 391 Dictionary Based Configuration for Logging.\n* PEP 3148; The concurrent.futures module: PEP 3148 The concurrent futures module.\n* PEP 3147; PYC Repository Directories: PEP 3147 PYC Repository Directories.\n* PEP 3149; ABI Version Tagged .so Files: PEP 3149 ABI Version Tagged so Files.\n* PEP 3333; Python Web Server Gateway Interface v1.0.1: PEP 3333 Python Web Server Gateway Interface v1 0 1.\n* Other Language Changes: Other Language Changes<11>.\n* New, Improved, and Deprecated Modules: New Improved and Deprecated Modules.\n* Multi-threading::\n* Optimizations: Optimizations<10>.\n* Unicode::\n* Codecs::\n* Documentation::\n* IDLE::\n* Code Repository::\n* Build and C API Changes: Build and C API Changes<5>.\n* Porting to Python 3.2: Porting to Python 3 2.\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/blob/076ca6c3c8df3030307e548d9be792ce3c1c6eea/Misc/NEWS\n\n(2) https://peps.python.org/pep-0392/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: PEP 384 Defining a Stable ABI,  Next: PEP 389 Argparse Command Line Parsing Module,  Up: What's New In Python 3 2": {
            "content": "",
            "subsections": []
        },
        "In the past, extension modules built for one Python version were often": {
            "content": "not usable with other Python versions.  Particularly on Windows, every\nfeature release of Python required rebuilding all extension modules that\none wanted to use.  This requirement was the result of the free access\nto Python interpreter internals that extension modules could use.\n",
            "subsections": []
        },
        "With Python 3.2, an alternative approach becomes available: extension": {
            "content": "modules which restrict themselves to a limited API (by defining",
            "subsections": []
        },
        "PyLIMITEDAPI) cannot use many of the internals, but are constrained to": {
            "content": "a set of API functions that are promised to be stable for several\nreleases.  As a consequence, extension modules built for 3.2 in that\nmode will also work with 3.3, 3.4, and so on.  Extension modules that\nmake use of details of memory structures can still be built, but will\nneed to be recompiled for every feature release.\n\nSee also\n........\n\nPEP 384(1) - Defining a Stable ABI\n\nPEP written by Martin von Lo\"wis.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0384/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "A new module for command line parsing, *note argparse: 6, was introduced\nto overcome the limitations of *note optparse: 9b. which did not provide\nsupport for positional arguments (not just options), subcommands,\nrequired options and other common patterns of specifying and validating\noptions.\n",
            "subsections": []
        },
        "This module has already had widespread success in the community as a": {
            "content": "third-party module.  Being more fully featured than its predecessor, the\n*note argparse: 6. module is now the preferred module for command-line\nprocessing.  The older module is still being kept available because of\nthe substantial amount of legacy code that depends on it.\n",
            "subsections": []
        },
        "Here's an annotated example parser showing features like limiting": {
            "content": "results to a set of choices, specifying a 'metavar' in the help screen,\nvalidating that one or more positional arguments is present, and making\na required option:\n\nimport argparse\nparser = argparse.ArgumentParser(\ndescription = 'Manage servers',         # main description for help\nepilog = 'Tested on Solaris and Linux') # displayed after help\nparser.addargument('action',                       # argument name\nchoices = ['deploy', 'start', 'stop'],  # three allowed values\nhelp = 'action on each target')         # help msg\nparser.addargument('targets',\nmetavar = 'HOSTNAME',                   # var name used in help msg\nnargs = '+',                            # require one or more targets\nhelp = 'url for target machines')       # help msg explanation\nparser.addargument('-u', '--user',                 # -u or --user option\nrequired = True,                        # make it a required argument\nhelp = 'login as user')\n\nExample of calling the parser on a command string:\n\n>>> cmd = 'deploy sneezy.example.com sleepy.example.com -u skycaptain'\n>>> result = parser.parseargs(cmd.split())\n>>> result.action\n'deploy'\n>>> result.targets\n['sneezy.example.com', 'sleepy.example.com']\n>>> result.user\n'skycaptain'\n\nExample of the parser's automatically generated help:\n\n>>> parser.parseargs('-h'.split())\n\nusage: managecloud.py [-h] -u USER\n{deploy,start,stop} HOSTNAME [HOSTNAME ...]\n\nManage servers\n\npositional arguments:\n{deploy,start,stop}   action on each target\nHOSTNAME              url for target machines\n\noptional arguments:\n-h, --help            show this help message and exit\n-u USER, --user USER  login as user\n\nTested on Solaris and Linux\n\nAn especially nice *note argparse: 6. feature is the ability to define\nsubparsers, each with their own argument patterns and help displays:\n\nimport argparse\nparser = argparse.ArgumentParser(prog='HELM')\nsubparsers = parser.addsubparsers()\n\nparserl = subparsers.addparser('launch', help='Launch Control')   # first subgroup\nparserl.addargument('-m', '--missiles', action='storetrue')\nparserl.addargument('-t', '--torpedos', action='storetrue')\n\nparserm = subparsers.addparser('move', help='Move Vessel',        # second subgroup\naliases=('steer', 'turn'))         # equivalent names\nparserm.addargument('-c', '--course', type=int, required=True)\nparserm.addargument('-s', '--speed', type=int, default=0)\n\n$ ./helm.py --help                         # top level help (launch and move)\n$ ./helm.py launch --help                  # help for launch options\n$ ./helm.py launch --missiles              # set missiles=True and torpedos=False\n$ ./helm.py steer --course 180 --speed 5   # set movement parameters\n\nSee also\n........\n\nPEP 389(1) - New Command Line Parsing Module\n\nPEP written by Steven Bethard.\n\n*note Upgrading optparse code: 1021. for details on the differences from\n*note optparse: 9b.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0389/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "The *note logging: 82. module provided two kinds of configuration, one\nstyle with function calls for each option or another style driven by an\nexternal file saved in a *note configparser: 20. format.  Those options\ndid not provide the flexibility to create configurations from JSON or\nYAML files, nor did they support incremental configuration, which is\nneeded for specifying logger options from a command line.\n\nTo support a more flexible style, the module now offers *note\nlogging.config.dictConfig(): 1023. for specifying logging configuration\nwith plain Python dictionaries.  The configuration options include\nformatters, handlers, filters, and loggers.  Here's a working example of\na configuration dictionary:\n\n{\"version\": 1,\n\"formatters\": {\"brief\": {\"format\": \"%(levelname)-8s: %(name)-15s: %(message)s\"},\n\"full\": {\"format\": \"%(asctime)s %(name)-15s %(levelname)-8s %(message)s\"}\n},\n\"handlers\": {\"console\": {\n\"class\": \"logging.StreamHandler\",\n\"formatter\": \"brief\",\n\"level\": \"INFO\",\n\"stream\": \"ext://sys.stdout\"},\n\"consolepriority\": {\n\"class\": \"logging.StreamHandler\",\n\"formatter\": \"full\",\n\"level\": \"ERROR\",\n\"stream\": \"ext://sys.stderr\"}\n},\n\"root\": {\"level\": \"DEBUG\", \"handlers\": [\"console\", \"consolepriority\"]}}\n",
            "subsections": []
        },
        "If that dictionary is stored in a file called 'conf.json', it can be": {
            "content": "loaded and called with code like this:\n\n>>> import json, logging.config\n>>> with open('conf.json') as f:\n...     conf = json.load(f)\n...\n>>> logging.config.dictConfig(conf)\n>>> logging.info(\"Transaction completed normally\")\nINFO    : root           : Transaction completed normally\n>>> logging.critical(\"Abnormal termination\")\n2011-02-17 11:14:36,694 root            CRITICAL Abnormal termination\n\nSee also\n........\n\nPEP 391(1) - Dictionary Based Configuration for Logging\n\nPEP written by Vinay Sajip.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0391/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "Code for creating and managing concurrency is being collected in a new": {
            "content": "top-level namespace, 'concurrent'.  Its first member is a 'futures'\npackage which provides a uniform high-level interface for managing\nthreads and processes.\n\nThe design for *note concurrent.futures: 1f. was inspired by the\n'java.util.concurrent' package.  In that model, a running call and its\nresult are represented by a *note Future: 1025. object that abstracts\nfeatures common to threads, processes, and remote procedure calls.  That\nobject supports status checks (running or done), timeouts,\ncancellations, adding callbacks, and access to results or exceptions.\n",
            "subsections": []
        },
        "The primary offering of the new module is a pair of executor classes for": {
            "content": "launching and managing calls.  The goal of the executors is to make it\neasier to use existing tools for making parallel calls.  They save the\neffort needed to setup a pool of resources, launch the calls, create a\nresults queue, add time-out handling, and limit the total number of\nthreads, processes, or remote procedure calls.\n",
            "subsections": []
        },
        "Ideally, each application should share a single executor across multiple": {
            "content": "components so that process and thread limits can be centrally managed.",
            "subsections": []
        },
        "This solves the design challenge that arises when each component has its": {
            "content": "own competing strategy for resource management.\n\nBoth classes share a common interface with three methods: *note\nsubmit(): 8b0. for scheduling a callable and returning a *note Future:\n1025. object; *note map(): c41. for scheduling many asynchronous calls\nat a time, and *note shutdown(): 706. for freeing resources.  The class\nis a *note context manager: 398. and can be used in a *note with: 396.\nstatement to assure that resources are automatically released when\ncurrently pending futures are done executing.\n\nA simple of example of *note ThreadPoolExecutor: 529. is a launch of\nfour parallel threads for copying files:\n\nimport concurrent.futures, shutil\nwith concurrent.futures.ThreadPoolExecutor(maxworkers=4) as e:\ne.submit(shutil.copy, 'src1.txt', 'dest1.txt')\ne.submit(shutil.copy, 'src2.txt', 'dest2.txt')\ne.submit(shutil.copy, 'src3.txt', 'dest3.txt')\ne.submit(shutil.copy, 'src3.txt', 'dest4.txt')\n\nSee also\n........\n\nPEP 3148(1) - Futures - Execute Computations Asynchronously\n\nPEP written by Brian Quinlan.\n\n*note Code for Threaded Parallel URL reads: 1026, an example using\nthreads to fetch multiple web pages in parallel.\n\n*note Code for computing prime numbers in parallel: 1027, an example\ndemonstrating *note ProcessPoolExecutor: 707.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3148/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "Python's scheme for caching bytecode in '.pyc' files did not work well": {
            "content": "in environments with multiple Python interpreters.  If one interpreter\nencountered a cached file created by another interpreter, it would\nrecompile the source and overwrite the cached file, thus losing the\nbenefits of caching.\n\nThe issue of \"pyc fights\" has become more pronounced as it has become\ncommonplace for Linux distributions to ship with multiple versions of",
            "subsections": []
        },
        "Python.  These conflicts also arise with CPython alternatives such as": {
            "content": "Unladen Swallow.\n",
            "subsections": []
        },
        "To solve this problem, Python's import machinery has been extended to": {
            "content": "use distinct filenames for each interpreter.  Instead of Python 3.2 and",
            "subsections": []
        },
        "Python 3.3 and Unladen Swallow each competing for a file called": {
            "content": "\"mymodule.pyc\", they will now look for \"mymodule.cpython-32.pyc\",\n\"mymodule.cpython-33.pyc\", and \"mymodule.unladen10.pyc\".  And to prevent\nall of these new files from cluttering source directories, the 'pyc'\nfiles are now collected in a \"pycache\" directory stored under the\npackage directory.\n",
            "subsections": []
        },
        "Aside from the filenames and target directories, the new scheme has a": {
            "content": "few aspects that are visible to the programmer:\n\n* Imported modules now have a *note cached: 1029. attribute which\nstores the name of the actual file that was imported:\n\n>>> import collections\n>>> collections.cached\n'c:/py32/lib/pycache/collections.cpython-32.pyc'\n\n* The tag that is unique to each interpreter is accessible from the\n'imp' module:\n\n>>> import imp\n>>> imp.gettag()\n'cpython-32'\n\n* Scripts that try to deduce source filename from the imported file\nnow need to be smarter.  It is no longer sufficient to simply strip\nthe \"c\" from a \".pyc\" filename.  Instead, use the new functions in\nthe 'imp' module:\n\n>>> imp.sourcefromcache('c:/py32/lib/pycache/collections.cpython-32.pyc')\n'c:/py32/lib/collections.py'\n>>> imp.cachefromsource('c:/py32/lib/collections.py')\n'c:/py32/lib/pycache/collections.cpython-32.pyc'\n\n* The *note pycompile: ae. and *note compileall: 1e. modules have\nbeen updated to reflect the new naming convention and target\ndirectory.  The command-line invocation of 'compileall' has new\noptions: '-i' for specifying a list of files and directories to\ncompile and '-b' which causes bytecode files to be written to their\nlegacy location rather than 'pycache'.\n\n* The *note importlib.abc: 72. module has been updated with new *note\nabstract base classes: 102a. for loading bytecode files.  The\nobsolete ABCs, 'PyLoader' and 'PyPycLoader', have been deprecated\n(instructions on how to stay Python 3.1 compatible are included\nwith the documentation).\n\nSee also\n........\n\nPEP 3147(1) - PYC Repository Directories\n\nPEP written by Barry Warsaw.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3147/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "The PYC repository directory allows multiple bytecode cache files to be": {
            "content": "co-located.  This PEP implements a similar mechanism for shared object\nfiles by giving them a common directory and distinct names for each\nversion.\n\nThe common directory is \"pyshared\" and the file names are made distinct\nby identifying the Python implementation (such as CPython, PyPy, Jython,\netc.), the major and minor version numbers, and optional build flags\n(such as \"d\" for debug, \"m\" for pymalloc, \"u\" for wide-unicode).  For an\narbitrary package \"foo\", you may see these files when the distribution\npackage is installed:\n\n/usr/share/pyshared/foo.cpython-32m.so\n/usr/share/pyshared/foo.cpython-33md.so\n\nIn Python itself, the tags are accessible from functions in the *note\nsysconfig: d5. module:\n\n>>> import sysconfig\n>>> sysconfig.getconfigvar('SOABI')       # find the version tag\n'cpython-32mu'\n>>> sysconfig.getconfigvar('EXTSUFFIX')  # find the full filename extension\n'.cpython-32mu.so'\n\nSee also\n........\n\nPEP 3149(1) - ABI Version Tagged .so Files\n\nPEP written by Barry Warsaw.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3149/\n\nFile: python3.12.info,  Node: PEP 3333 Python Web Server Gateway Interface v1 0 1,  Next: Other Language Changes<11>,  Prev: PEP 3149 ABI Version Tagged so Files,  Up: What's New In Python 3 2\n\n",
            "subsections": []
        },
        "This informational PEP clarifies how bytes/text issues are to be handled": {
            "content": "by the WSGI protocol.  The challenge is that string handling in Python 3\nis most conveniently handled with the *note str: 157. type even though\nthe HTTP protocol is itself bytes oriented.\n",
            "subsections": []
        },
        "The PEP differentiates so-called 'native strings' that are used for": {
            "content": "request/response headers and metadata versus 'byte strings' which are\nused for the bodies of requests and responses.\n\nThe 'native strings' are always of type *note str: 157. but are\nrestricted to code points between 'U+0000' through 'U+00FF' which are\ntranslatable to bytes using 'Latin-1' encoding.  These strings are used\nfor the keys and values in the environment dictionary and for response\nheaders and statuses in the 'startresponse()' function.  They must\nfollow RFC 2616(1) with respect to encoding.  That is, they must either\nbe 'ISO-8859-1' characters or use RFC 2047(2) MIME encoding.\n",
            "subsections": []
        },
        "For developers porting WSGI applications from Python 2, here are the": {
            "content": "salient points:\n\n* If the app already used strings for headers in Python 2, no change\nis needed.\n\n* If instead, the app encoded output headers or decoded input\nheaders, then the headers will need to be re-encoded to Latin-1.\nFor example, an output header encoded in utf-8 was using\n'h.encode('utf-8')' now needs to convert from bytes to native\nstrings using 'h.encode('utf-8').decode('latin-1')'.\n\n* Values yielded by an application or sent using the 'write()' method\nmust be byte strings.  The 'startresponse()' function and environ\nmust use native strings.  The two cannot be mixed.\n",
            "subsections": []
        },
        "For server implementers writing CGI-to-WSGI pathways or other CGI-style": {
            "content": "protocols, the users must to be able access the environment using native\nstrings even though the underlying platform may have a different\nconvention.  To bridge this gap, the *note wsgiref: 113. module has a\nnew function, *note wsgiref.handlers.readenviron(): 102d. for\ntranscoding CGI variables from *note os.environ: 102e. into native\nstrings and returning a new dictionary.\n\nSee also\n........\n\nPEP 3333(3) - Python Web Server Gateway Interface v1.0.1\n\nPEP written by Phillip Eby.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc2616.html\n\n(2) https://datatracker.ietf.org/doc/html/rfc2047.html\n\n(3) https://peps.python.org/pep-3333/\n\nFile: python3.12.info,  Node: Other Language Changes<11>,  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\n\n\nSome smaller changes made to the core Python language are:\n\n* String formatting for *note format(): 3eb. and *note str.format():\n3ed. gained new capabilities for the format character '#'.\nPreviously, for integers in binary, octal, or hexadecimal, it\ncaused the output to be prefixed with '0b', '0o', or '0x'\nrespectively.  Now it can also handle floats, complex, and Decimal,\ncausing the output to always have a decimal point even when no\ndigits follow it.\n\n>>> format(20, '#o')\n'0o24'\n>>> format(12.34, '#5.0f')\n'  12.'\n\n(Suggested by Mark Dickinson and implemented by Eric Smith in\nbpo-7094(1).)\n\n* There is also a new *note str.formatmap(): c34. method that\nextends the capabilities of the existing *note str.format(): 3ed.\nmethod by accepting arbitrary *note mapping: 1030. objects.  This\nnew method makes it possible to use string formatting with any of\nPython's many dictionary-like objects such as *note defaultdict:\n1031, *note Shelf: e0a, *note ConfigParser: 257, or *note dbm: 2f.\nIt is also useful with custom *note dict: 237. subclasses that\nnormalize keys before look-up or that supply a 'missing()'\nmethod for unknown keys:\n\n>>> import shelve\n>>> d = shelve.open('tmp.shl')\n>>> 'The {projectname} status is {status} as of {date}'.formatmap(d)\n'The testing project status is green as of February 15, 2011'\n\n>>> class LowerCasedDict(dict):\n...     def getitem(self, key):\n...         return dict.getitem(self, key.lower())\n...\n>>> lcd = LowerCasedDict(part='widgets', quantity=10)\n>>> 'There are {QUANTITY} {Part} in stock'.formatmap(lcd)\n'There are 10 widgets in stock'\n\n>>> class PlaceholderDict(dict):\n...     def missing(self, key):\n...         return '<{}>'.format(key)\n...\n>>> 'Hello {name}, welcome to {location}'.formatmap(PlaceholderDict())\n'Hello <name>, welcome to <location>'\n\n(Suggested by Raymond Hettinger and implemented by Eric Smith in\nbpo-6081(2).)\n\n* The interpreter can now be started with a quiet option, '-q', to\nprevent the copyright and version information from being displayed\nin the interactive mode.  The option can be introspected using the\n*note sys.flags: 458. attribute:\n\n$ python -q\n>>> sys.flags\nsys.flags(debug=0, divisionwarning=0, inspect=0, interactive=0,\noptimize=0, dontwritebytecode=0, nousersite=0, nosite=0,\nignoreenvironment=0, verbose=0, byteswarning=0, quiet=1)\n\n(Contributed by Marcin Wojdyr in bpo-1772833(3)).\n\n* The *note hasattr(): 1f7. function works by calling *note\ngetattr(): a15. and detecting whether an exception is raised.  This\ntechnique allows it to detect methods created dynamically by *note\ngetattr(): 1f8. or *note getattribute(): a16. which would\notherwise be absent from the class dictionary.  Formerly, 'hasattr'\nwould catch any exception, possibly masking genuine errors.  Now,\n'hasattr' has been tightened to only catch *note AttributeError:\n395. and let other exceptions pass through:\n\n>>> class A:\n...     @property\n...     def f(self):\n...         return 1 // 0\n...\n>>> a = A()\n>>> hasattr(a, 'f')\nTraceback (most recent call last):\n...\nZeroDivisionError: integer division or modulo by zero\n\n(Discovered by Yury Selivanov and fixed by Benjamin Peterson;\nbpo-9666(4).)\n\n* The *note str(): 157. of a float or complex number is now the same\nas its *note repr(): 5f0.  Previously, the *note str(): 157. form\nwas shorter but that just caused confusion and is no longer needed\nnow that the shortest possible *note repr(): 5f0. is displayed by\ndefault:\n\n>>> import math\n>>> repr(math.pi)\n'3.141592653589793'\n>>> str(math.pi)\n'3.141592653589793'\n\n(Proposed and implemented by Mark Dickinson; bpo-9337(5).)\n\n* *note memoryview: 17f. objects now have a *note release(): 1032.\nmethod and they also now support the context management protocol.\nThis allows timely release of any resources that were acquired when\nrequesting a buffer from the original object.\n\n>>> with memoryview(b'abcdefgh') as v:\n...     print(v.tolist())\n[97, 98, 99, 100, 101, 102, 103, 104]\n\n(Added by Antoine Pitrou; bpo-9757(6).)\n\n* Previously it was illegal to delete a name from the local namespace\nif it occurs as a free variable in a nested block:\n\ndef outer(x):\ndef inner():\nreturn x\ninner()\ndel x\n\nThis is now allowed.  Remember that the target of an *note except:\n379. clause is cleared, so this code which used to work with Python\n2.6, raised a *note SyntaxError: 146. with Python 3.1 and now works\nagain:\n\ndef f():\ndef printerror():\nprint(e)\ntry:\nsomething\nexcept Exception as e:\nprinterror()\n# implicit \"del e\" here\n\n(See bpo-4617(7).)\n\n* *note Struct sequence types: 1033. are now subclasses of tuple.\nThis means that C structures like those returned by *note\nos.stat(): 1bf, *note time.gmtime(): 1034, and *note\nsys.versioninfo: 46c. now work like a *note named tuple: 417. and\nnow work with functions and methods that expect a tuple as an\nargument.  This is a big step forward in making the C structures as\nflexible as their pure Python counterparts:\n\n>>> import sys\n>>> isinstance(sys.versioninfo, tuple)\nTrue\n>>> 'Version %d.%d.%d %s(%d)' % sys.versioninfo\n'Version 3.2.0 final(0)'\n\n(Suggested by Arfrever Frehtes Taifersar Arahesis and implemented\nby Benjamin Peterson in bpo-8413(8).)\n\n* Warnings are now easier to control using the *note PYTHONWARNINGS:\n9ee. environment variable as an alternative to using '-W' at the\ncommand line:\n\n$ export PYTHONWARNINGS='ignore::RuntimeWarning::,once::UnicodeWarning::'\n\n(Suggested by Barry Warsaw and implemented by Philip Jenvey in\nbpo-7301(9).)\n\n* A new warning category, *note ResourceWarning: a86, has been added.\nIt is emitted when potential issues with resource consumption or\ncleanup are detected.  It is silenced by default in normal release\nbuilds but can be enabled through the means provided by the *note\nwarnings: 10d. module, or on the command line.\n\nA *note ResourceWarning: a86. is issued at interpreter shutdown if\nthe *note gc.garbage: 1035. list isn't empty, and if *note\ngc.DEBUGUNCOLLECTABLE: 1036. is set, all uncollectable objects are\nprinted.  This is meant to make the programmer aware that their\ncode contains object finalization issues.\n\nA *note ResourceWarning: a86. is also issued when a *note file\nobject: 1037. is destroyed without having been explicitly closed.\nWhile the deallocator for such object ensures it closes the\nunderlying operating system resource (usually, a file descriptor),\nthe delay in deallocating the object could produce various issues,\nespecially under Windows.  Here is an example of enabling the\nwarning from the command line:\n\n$ python -q -Wdefault\n>>> f = open(\"foo\", \"wb\")\n>>> del f\nmain:1: ResourceWarning: unclosed file <io.BufferedWriter name='foo'>\n\n(Added by Antoine Pitrou and Georg Brandl in bpo-10093(10) and\nbpo-477863(11).)\n\n* *note range: 761. objects now support 'index' and 'count' methods.\nThis is part of an effort to make more objects fully implement the\n*note collections.Sequence: 1038. *note abstract base class: 102a.\nAs a result, the language will have a more uniform API. In\naddition, *note range: 761. objects now support slicing and\nnegative indices, even with values larger than *note sys.maxsize:\n1039.  This makes 'range' more interoperable with lists:\n\n>>> range(0, 100, 2).count(10)\n1\n>>> range(0, 100, 2).index(10)\n5\n>>> range(0, 100, 2)[5]\n10\n>>> range(0, 100, 2)[0:5]\nrange(0, 10, 2)\n\n(Contributed by Daniel Stutzbach in bpo-9213(12), by Alexander\nBelopolsky in bpo-2690(13), and by Nick Coghlan in bpo-10889(14).)\n\n* The *note callable(): 103a. builtin function from Py2.x was\nresurrected.  It provides a concise, readable alternative to using\nan *note abstract base class: 102a. in an expression like\n'isinstance(x, collections.Callable)':\n\n>>> callable(max)\nTrue\n>>> callable(20)\nFalse\n\n(See bpo-10518(15).)\n\n* Python's import mechanism can now load modules installed in\ndirectories with non-ASCII characters in the path name.  This\nsolved an aggravating problem with home directories for users with\nnon-ASCII characters in their usernames.\n\n(Required extensive work by Victor Stinner in bpo-9425(16).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=7094\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=6081\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=1772833\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=9666\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=9337\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=9757\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=4617\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=8413\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=7301\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=10093\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=477863\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=9213\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=2690\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=10889\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=10518\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=9425\n\nFile: python3.12.info,  Node: New Improved and Deprecated Modules,  Next: Multi-threading,  Prev: Other Language Changes<11>,  Up: What's New In Python 3 2\n\n",
            "subsections": []
        },
        "Python's standard library has undergone significant maintenance efforts": {
            "content": "and quality improvements.\n\nThe biggest news for Python 3.2 is that the *note email: 37. package,\n*note mailbox: 86. module, and *note nntplib: 98. modules now work\ncorrectly with the bytes/text model in Python 3.  For the first time,\nthere is correct handling of messages with mixed encodings.\n",
            "subsections": []
        },
        "Throughout the standard library, there has been more careful attention": {
            "content": "to encodings and text versus bytes issues.  In particular, interactions\nwith the operating system are now better able to exchange non-ASCII data\nusing the Windows MBCS encoding, locale-aware encodings, or UTF-8.\n",
            "subsections": []
        },
        "Another significant win is the addition of substantially better support": {
            "content": "for 'SSL' connections and security certificates.\n\nIn addition, more classes now implement a *note context manager: 398. to\nsupport convenient and reliable resource clean-up using a *note with:\n396. statement.\n\n* Menu:\n\n* email: email<5>.\n* elementtree::\n* functools: functools<7>.\n* itertools: itertools<6>.\n* collections: collections<8>.\n* threading: threading<9>.\n* datetime and time::\n* math: math<9>.\n* abc: abc<3>.\n* io: io<6>.\n* reprlib::\n* logging: logging<8>.\n* csv: csv<4>.\n* contextlib: contextlib<8>.\n* decimal and fractions::\n* ftp::\n* popen::\n* select: select<3>.\n* gzip and zipfile::\n* tarfile: tarfile<10>.\n* hashlib: hashlib<7>.\n* ast: ast<4>.\n* os: os<12>.\n* shutil: shutil<7>.\n* sqlite3: sqlite3<10>.\n* html: html<3>.\n* socket: socket<11>.\n* ssl: ssl<11>.\n* nntp::\n* certificates::\n* imaplib: imaplib<4>.\n* http.client: http client<4>.\n* unittest: unittest<10>.\n* random: random<4>.\n* poplib: poplib<4>.\n* asyncore: asyncore<2>.\n* tempfile: tempfile<4>.\n* inspect: inspect<10>.\n* pydoc: pydoc<6>.\n* dis: dis<4>.\n* dbm: dbm<6>.\n* ctypes: ctypes<2>.\n* site: site<3>.\n* sysconfig: sysconfig<3>.\n* pdb: pdb<7>.\n* configparser: configparser<3>.\n* urllib.parse: urllib parse<6>.\n* mailbox::\n* turtledemo::\n\nFile: python3.12.info,  Node: email<5>,  Next: elementtree,  Up: New Improved and Deprecated Modules\n\n1.11.9.1 email\n..............\n\nThe usability of the *note email: 37. package in Python 3 has been\nmostly fixed by the extensive efforts of R. David Murray.  The problem\nwas that emails are typically read and stored in the form of *note\nbytes: 295. rather than *note str: 157. text, and they may contain\nmultiple encodings within a single email.  So, the email package had to\nbe extended to parse and generate email messages in bytes format.\n\n* New functions *note messagefrombytes(): 103d. and *note\nmessagefrombinaryfile(): 103e, and new classes *note\nBytesFeedParser: 103f. and *note BytesParser: 1040. allow binary\nmessage data to be parsed into model objects.\n\n* Given bytes input to the model, *note getpayload(): 1041. will by\ndefault decode a message body that has a\n'Content-Transfer-Encoding' of '8bit' using the charset specified\nin the MIME headers and return the resulting string.\n\n* Given bytes input to the model, *note Generator: 1042. will convert\nmessage bodies that have a 'Content-Transfer-Encoding' of '8bit' to\ninstead have a '7bit' 'Content-Transfer-Encoding'.\n\nHeaders with unencoded non-ASCII bytes are deemed to be RFC\n2047(1)-encoded using the 'unknown-8bit' character set.\n\n* A new class *note BytesGenerator: 1043. produces bytes as output,\npreserving any unchanged non-ASCII data that was present in the\ninput used to build the model, including message bodies with a\n'Content-Transfer-Encoding' of '8bit'.\n\n* The *note smtplib: c4. *note SMTP: 74b. class now accepts a byte\nstring for the 'msg' argument to the *note sendmail(): cba. method,\nand a new method, *note sendmessage(): cbb. accepts a *note\nMessage: ae7. object and can optionally obtain the 'fromaddr' and\n'toaddrs' addresses directly from the object.\n\n(Proposed and implemented by R. David Murray, bpo-4661(2) and\nbpo-10321(3).)\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc2047.html\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=4661\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=10321\n\nFile: python3.12.info,  Node: elementtree,  Next: functools<7>,  Prev: email<5>,  Up: New Improved and Deprecated Modules\n\n1.11.9.2 elementtree\n....................\n\nThe *note xml.etree.ElementTree: 120. package and its\n'xml.etree.cElementTree' counterpart have been updated to version 1.3.\n\nSeveral new and useful functions and methods have been added:\n\n* *note xml.etree.ElementTree.fromstringlist(): 1045. which builds an\nXML document from a sequence of fragments\n\n* *note xml.etree.ElementTree.registernamespace(): 1046. for\nregistering a global namespace prefix\n\n* *note xml.etree.ElementTree.tostringlist(): e69. for string\nrepresentation including all sublists\n\n* *note xml.etree.ElementTree.Element.extend(): 1047. for appending a\nsequence of zero or more elements\n\n* *note xml.etree.ElementTree.Element.iterfind(): 1048. searches an\nelement and subelements\n\n* *note xml.etree.ElementTree.Element.itertext(): 1049. creates a\ntext iterator over an element and its subelements\n\n* *note xml.etree.ElementTree.TreeBuilder.end(): 104a. closes the\ncurrent element\n\n* *note xml.etree.ElementTree.TreeBuilder.doctype(): 8ca. handles a\ndoctype declaration\n\nTwo methods have been deprecated:\n\n* 'xml.etree.ElementTree.getchildren()' use 'list(elem)' instead.\n\n* 'xml.etree.ElementTree.getiterator()' use 'Element.iter' instead.\n",
            "subsections": []
        },
        "For details of the update, see Introducing ElementTree(1) on Fredrik": {
            "content": "Lundh's website.\n\n(Contributed by Florent Xicluna and Fredrik Lundh, bpo-6472(2).)\n\n---------- Footnotes ----------\n\n(1)\nhttps://web.archive.org/web/20200703234532/http://effbot.org/zone/elementtree-13-intro.htm\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=6472\n\nFile: python3.12.info,  Node: functools<7>,  Next: itertools<6>,  Prev: elementtree,  Up: New Improved and Deprecated Modules\n\n1.11.9.3 functools\n..................\n\n* The *note functools: 5a. module includes a new decorator for\ncaching function calls.  *note functools.lrucache(): 815. can save\nrepeated queries to an external resource whenever the results are\nexpected to be the same.\n\nFor example, adding a caching decorator to a database query\nfunction can save database accesses for popular searches:\n\n>>> import functools\n>>> @functools.lrucache(maxsize=300)\n... def getphonenumber(name):\n...     c = conn.cursor()\n...     c.execute('SELECT phonenumber FROM phonelist WHERE name=?', (name,))\n...     return c.fetchone()[0]\n\n>>> for name in userrequests:\n...     getphonenumber(name)        # cached lookup\n\nTo help with choosing an effective cache size, the wrapped function\nis instrumented for tracking cache statistics:\n\n>>> getphonenumber.cacheinfo()\nCacheInfo(hits=4805, misses=980, maxsize=300, currsize=300)\n\nIf the phonelist table gets updated, the outdated contents of the\ncache can be cleared with:\n\n>>> getphonenumber.cacheclear()\n\n(Contributed by Raymond Hettinger and incorporating design ideas\nfrom Jim Baker, Miki Tebeka, and Nick Coghlan; see recipe\n498245(1), recipe 577479(2), bpo-10586(3), and bpo-10593(4).)\n\n* The *note functools.wraps(): dcd. decorator now adds a\n'wrapped' attribute pointing to the original callable function.\nThis allows wrapped functions to be introspected.  It also copies\n*note annotations: 104c. if defined.  And now it also\ngracefully skips over missing attributes such as *note doc:\n104d. which might not be defined for the wrapped callable.\n\nIn the above example, the cache can be removed by recovering the\noriginal function:\n\n>>> getphonenumber = getphonenumber.wrapped    # uncached function\n\n(By Nick Coghlan and Terrence Cole; bpo-9567(5), bpo-3445(6), and\nbpo-8814(7).)\n\n* To help write classes with rich comparison methods, a new decorator\n*note functools.totalordering(): db2. will use existing equality\nand inequality methods to fill in the remaining methods.\n\nFor example, supplying 'eq' and 'lt' will enable *note\ntotalordering(): db2. to fill-in 'le', 'gt' and 'ge':\n\n@totalordering\nclass Student:\ndef eq(self, other):\nreturn ((self.lastname.lower(), self.firstname.lower()) ==\n(other.lastname.lower(), other.firstname.lower()))\n\ndef lt(self, other):\nreturn ((self.lastname.lower(), self.firstname.lower()) <\n(other.lastname.lower(), other.firstname.lower()))\n\nWith the 'totalordering' decorator, the remaining comparison\nmethods are filled in automatically.\n\n(Contributed by Raymond Hettinger.)\n\n* To aid in porting programs from Python 2, the *note\nfunctools.cmptokey(): 104e. function converts an old-style\ncomparison function to modern *note key function: c62.:\n\n>>> # locale-aware sort order\n>>> sorted(iterable, key=cmptokey(locale.strcoll))\n\nFor sorting examples and a brief sorting tutorial, see the Sorting\nHowTo(8) tutorial.\n\n(Contributed by Raymond Hettinger.)\n\n---------- Footnotes ----------\n\n(1) https://code.activestate.com/recipes/498245/\n\n(2) https://code.activestate.com/recipes/577479/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=10586\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=10593\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=9567\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=3445\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=8814\n\n(8) https://wiki.python.org/moin/HowTo/Sorting/\n\nFile: python3.12.info,  Node: itertools<6>,  Next: collections<8>,  Prev: functools<7>,  Up: New Improved and Deprecated Modules\n\n1.11.9.4 itertools\n..................\n\n* The *note itertools: 7b. module has a new *note accumulate(): 825.\nfunction modeled on APL's 'scan' operator and Numpy's 'accumulate'\nfunction:\n\n>>> from itertools import accumulate\n>>> list(accumulate([8, 2, 50]))\n[8, 10, 60]\n\n>>> probdist = [0.1, 0.4, 0.2, 0.3]\n>>> list(accumulate(probdist))      # cumulative probability distribution\n[0.1, 0.5, 0.7, 1.0]\n\nFor an example using *note accumulate(): 825, see the *note\nexamples for the random module: 1050.\n\n(Contributed by Raymond Hettinger and incorporating design\nsuggestions from Mark Dickinson.)\n\nFile: python3.12.info,  Node: collections<8>,  Next: threading<9>,  Prev: itertools<6>,  Up: New Improved and Deprecated Modules\n\n1.11.9.5 collections\n....................\n\n* The *note collections.Counter: f09. class now has two forms of\nin-place subtraction, the existing '-=' operator for saturating\nsubtraction(1) and the new *note subtract(): 1052. method for\nregular subtraction.  The former is suitable for multisets(2) which\nonly have positive counts, and the latter is more suitable for use\ncases that allow negative counts:\n\n>>> from collections import Counter\n>>> tally = Counter(dogs=5, cats=3)\n>>> tally -= Counter(dogs=2, cats=8)    # saturating subtraction\n>>> tally\nCounter({'dogs': 3})\n\n>>> tally = Counter(dogs=5, cats=3)\n>>> tally.subtract(dogs=2, cats=8)      # regular subtraction\n>>> tally\nCounter({'dogs': 3, 'cats': -5})\n\n(Contributed by Raymond Hettinger.)\n\n* The *note collections.OrderedDict: 39f. class has a new method\n*note movetoend(): 1053. which takes an existing key and moves it\nto either the first or last position in the ordered sequence.\n\nThe default is to move an item to the last position.  This is\nequivalent of renewing an entry with 'od[k] = od.pop(k)'.\n\nA fast move-to-end operation is useful for resequencing entries.\nFor example, an ordered dictionary can be used to track order of\naccess by aging entries from the oldest to the most recently\naccessed.\n\n>>> from collections import OrderedDict\n>>> d = OrderedDict.fromkeys(['a', 'b', 'X', 'd', 'e'])\n>>> list(d)\n['a', 'b', 'X', 'd', 'e']\n>>> d.movetoend('X')\n>>> list(d)\n['a', 'b', 'd', 'e', 'X']\n\n(Contributed by Raymond Hettinger.)\n\n* The *note collections.deque: 3a0. class grew two new methods *note\ncount(): 1054. and *note reverse(): 1055. that make them more\nsubstitutable for *note list: 3dc. objects:\n\n>>> from collections import deque\n>>> d = deque('simsalabim')\n>>> d.count('s')\n2\n>>> d.reverse()\n>>> d\ndeque(['m', 'i', 'b', 'a', 'l', 'a', 's', 'm', 'i', 's'])\n\n(Contributed by Raymond Hettinger.)\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Saturationarithmetic\n\n(2) https://en.wikipedia.org/wiki/Multiset\n\nFile: python3.12.info,  Node: threading<9>,  Next: datetime and time,  Prev: collections<8>,  Up: New Improved and Deprecated Modules\n\n1.11.9.6 threading\n..................\n\nThe *note threading: e7. module has a new *note Barrier: 1057.\nsynchronization class for making multiple threads wait until all of them\nhave reached a common barrier point.  Barriers are useful for making\nsure that a task with multiple preconditions does not run until all of\nthe predecessor tasks are complete.\n",
            "subsections": []
        },
        "Barriers can work with an arbitrary number of threads.  This is a": {
            "content": "generalization of a Rendezvous(1) which is defined for only two threads.\n\nImplemented as a two-phase cyclic barrier, *note Barrier: 1057. objects\nare suitable for use in loops.  The separate 'filling' and 'draining'\nphases assure that all threads get released (drained) before any one of\nthem can loop back and re-enter the barrier.  The barrier fully resets\nafter each cycle.\n\nExample of using barriers:\n\nfrom threading import Barrier, Thread\n\ndef getvotes(site):\nballots = conductelection(site)\nallpollsclosed.wait()        # do not count until all polls are closed\ntotals = summarize(ballots)\npublish(site, totals)\n\nallpollsclosed = Barrier(len(sites))\nfor site in sites:\nThread(target=getvotes, args=(site,)).start()\n",
            "subsections": []
        },
        "In this example, the barrier enforces a rule that votes cannot be": {
            "content": "counted at any polling site until all polls are closed.  Notice how a\nsolution with a barrier is similar to one with *note\nthreading.Thread.join(): 1058, but the threads stay alive and continue\nto do work (summarizing ballots) after the barrier point is crossed.\n",
            "subsections": []
        },
        "If any of the predecessor tasks can hang or be delayed, a barrier can be": {
            "content": "created with an optional 'timeout' parameter.  Then if the timeout\nperiod elapses before all the predecessor tasks reach the barrier point,\nall waiting threads are released and a *note BrokenBarrierError: 1059.\nexception is raised:\n\ndef getvotes(site):\nballots = conductelection(site)\ntry:\nallpollsclosed.wait(timeout=midnight - time.now())\nexcept BrokenBarrierError:\nlockbox = sealballots(ballots)\nqueue.put(lockbox)\nelse:\ntotals = summarize(ballots)\npublish(site, totals)\n",
            "subsections": []
        },
        "In this example, the barrier enforces a more robust rule.  If some": {
            "content": "election sites do not finish before midnight, the barrier times-out and\nthe ballots are sealed and deposited in a queue for later handling.\n",
            "subsections": []
        },
        "See Barrier Synchronization Patterns(2) for more examples of how": {
            "content": "barriers can be used in parallel computing.  Also, there is a simple but\nthorough explanation of barriers in The Little Book of Semaphores(3),\n'section 3.6'.\n\n(Contributed by Kristj??n Valur J??nsson with an API review by Jeffrey",
            "subsections": []
        },
        "Yasskin in bpo-8777(4).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Synchronousrendezvous\n\n(2)\nhttps://osl.cs.illinois.edu/media/papers/karmani-2009-barriersynchronizationpattern.pdf\n\n(3) https://greenteapress.com/semaphores/LittleBookOfSemaphores.pdf\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=8777\n\nFile: python3.12.info,  Node: datetime and time,  Next: math<9>,  Prev: threading<9>,  Up: New Improved and Deprecated Modules\n\n1.11.9.7 datetime and time\n..........................\n\n* The *note datetime: 2e. module has a new type *note timezone: f2f.\nthat implements the *note tzinfo: 3a2. interface by returning a\nfixed UTC offset and timezone name.  This makes it easier to create\ntimezone-aware datetime objects:\n\n>>> from datetime import datetime, timezone\n\n>>> datetime.now(timezone.utc)\ndatetime.datetime(2010, 12, 8, 21, 4, 2, 923754, tzinfo=datetime.timezone.utc)\n\n>>> datetime.strptime(\"01/01/2000 12:00 +0000\", \"%m/%d/%Y %H:%M %z\")\ndatetime.datetime(2000, 1, 1, 12, 0, tzinfo=datetime.timezone.utc)\n\n* Also, *note timedelta: 7f3. objects can now be multiplied by *note\nfloat: 4b7. and divided by *note float: 4b7. and *note int: 17e.\nobjects.  And *note timedelta: 7f3. objects can now divide one\nanother.\n\n* The *note datetime.date.strftime(): ade. method is no longer\nrestricted to years after 1900.  The new supported year range is\nfrom 1000 to 9999 inclusive.\n\n* Whenever a two-digit year is used in a time tuple, the\ninterpretation has been governed by 'time.accept2dyear'.  The\ndefault is 'True' which means that for a two-digit year, the\ncentury is guessed according to the POSIX rules governing the '%y'\nstrptime format.\n\nStarting with Py3.2, use of the century guessing heuristic will\nemit a *note DeprecationWarning: 179.  Instead, it is recommended\nthat 'time.accept2dyear' be set to 'False' so that large date\nranges can be used without guesswork:\n\n>>> import time, warnings\n>>> warnings.resetwarnings()      # remove the default warning filters\n\n>>> time.accept2dyear = True      # guess whether 11 means 11 or 2011\n>>> time.asctime((11, 1, 1, 12, 34, 56, 4, 1, 0))\nWarning (from warnings module):\n...\nDeprecationWarning: Century info guessed for a 2-digit year.\n'Fri Jan  1 12:34:56 2011'\n\n>>> time.accept2dyear = False     # use the full range of allowable dates\n>>> time.asctime((11, 1, 1, 12, 34, 56, 4, 1, 0))\n'Fri Jan  1 12:34:56 11'\n\nSeveral functions now have significantly expanded date ranges.\nWhen 'time.accept2dyear' is false, the *note time.asctime(): 105b.\nfunction will accept any year that fits in a C int, while the *note\ntime.mktime(): 105c. and *note time.strftime(): 105d. functions\nwill accept the full range supported by the corresponding operating\nsystem functions.\n\n(Contributed by Alexander Belopolsky and Victor Stinner in\nbpo-1289118(1), bpo-5094(2), bpo-6641(3), bpo-2706(4), bpo-1777412(5),\nbpo-8013(6), and bpo-10827(7).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=1289118\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=5094\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=6641\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=2706\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=1777412\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=8013\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=10827\n\nFile: python3.12.info,  Node: math<9>,  Next: abc<3>,  Prev: datetime and time,  Up: New Improved and Deprecated Modules\n\n1.11.9.8 math\n.............\n\nThe *note math: 89. module has been updated with six new functions\ninspired by the C99 standard.\n\nThe *note isfinite(): 105f. function provides a reliable and fast way to\ndetect special values.  It returns 'True' for regular numbers and\n'False' for 'Nan' or 'Infinity':\n\n>>> from math import isfinite\n>>> [isfinite(x) for x in (123, 4.56, float('Nan'), float('Inf'))]\n[True, True, False, False]\n\nThe *note expm1(): 1060. function computes 'ex-1' for small values of\n'x' without incurring the loss of precision that usually accompanies the\nsubtraction of nearly equal quantities:\n\n>>> from math import expm1\n>>> expm1(0.013671875)   # more accurate way to compute ex-1 for a small x\n0.013765762467652909\n\nThe *note erf(): a1c. function computes a probability integral or\nGaussian error function(1).  The complementary error function, *note\nerfc(): a1d, is '1 - erf(x)':\n\n>>> from math import erf, erfc, sqrt\n>>> erf(1.0/sqrt(2.0))   # portion of normal distribution within 1 standard deviation\n0.682689492137086\n>>> erfc(1.0/sqrt(2.0))  # portion of normal distribution outside 1 standard deviation\n0.31731050786291404\n>>> erf(1.0/sqrt(2.0)) + erfc(1.0/sqrt(2.0))\n1.0\n\nThe *note gamma(): 1061. function is a continuous extension of the\nfactorial function.  See 'https://en.wikipedia.org/wiki/Gammafunction'\nfor details.  Because the function is related to factorials, it grows\nlarge even for small values of 'x', so there is also a *note lgamma():\n1062. function for computing the natural logarithm of the gamma\nfunction:\n\n>>> from math import gamma, lgamma\n>>> gamma(7.0)           # six factorial\n720.0\n>>> lgamma(801.0)        # log(800 factorial)\n4551.950730698041\n\n(Contributed by Mark Dickinson.)\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Errorfunction\n\nFile: python3.12.info,  Node: abc<3>,  Next: io<6>,  Prev: math<9>,  Up: New Improved and Deprecated Modules\n\n1.11.9.9 abc\n............\n\nThe *note abc: 4. module now supports *note abstractclassmethod(): efe.\nand *note abstractstaticmethod(): eff.\n\nThese tools make it possible to define an *note abstract base class:\n102a. that requires a particular *note classmethod(): 246. or *note\nstaticmethod(): 5cc. to be implemented:\n\nclass Temperature(metaclass=abc.ABCMeta):\n@abc.abstractclassmethod\ndef fromfahrenheit(cls, t):\n...\n@abc.abstractclassmethod\ndef fromcelsius(cls, t):\n...\n\n(Patch submitted by Daniel Urban; bpo-5867(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=5867\n\nFile: python3.12.info,  Node: io<6>,  Next: reprlib,  Prev: abc<3>,  Up: New Improved and Deprecated Modules\n\n1.11.9.10 io\n............\n\nThe *note io.BytesIO: d08. has a new method, *note getbuffer(): 1065,\nwhich provides functionality similar to *note memoryview(): 17f.  It\ncreates an editable view of the data without making a copy.  The\nbuffer's random access and support for slice notation are well-suited to\nin-place editing:\n\n>>> RECLEN, LOCSTART, LOCLEN = 34, 7, 11\n\n>>> def changelocation(buffer, recordnumber, location):\n...     start = recordnumber * RECLEN + LOCSTART\n...     buffer[start: start+LOCLEN] = location\n\n>>> import io\n\n>>> bytestream = io.BytesIO(\n...     b'G3805  storeroom  Main chassis    '\n...     b'X7899  shipping   Reserve cog     '\n...     b'L6988  receiving  Primary sprocket'\n... )\n>>> buffer = bytestream.getbuffer()\n>>> changelocation(buffer, 1, b'warehouse  ')\n>>> changelocation(buffer, 0, b'showroom   ')\n>>> print(bytestream.getvalue())\nb'G3805  showroom   Main chassis    '\nb'X7899  warehouse  Reserve cog     '\nb'L6988  receiving  Primary sprocket'\n\n(Contributed by Antoine Pitrou in bpo-5506(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=5506\n\nFile: python3.12.info,  Node: reprlib,  Next: logging<8>,  Prev: io<6>,  Up: New Improved and Deprecated Modules\n\n1.11.9.11 reprlib\n.................\n\nWhen writing a *note repr(): 3e8. method for a custom container, it\nis easy to forget to handle the case where a member refers back to the\ncontainer itself.  Python's builtin objects such as *note list: 3dc. and\n*note set: 39d. handle self-reference by displaying \"...\" in the recursive\npart of the representation string.\n\nTo help write such *note repr(): 3e8. methods, the *note reprlib:\nb6. module has a new decorator, *note recursiverepr(): 1067, for\ndetecting recursive calls to 'repr()' and substituting a placeholder\nstring instead:\n\n>>> class MyList(list):\n...     @recursiverepr()\n...     def repr(self):\n...         return '<' + '|'.join(map(repr, self)) + '>'\n...\n>>> m = MyList('abc')\n>>> m.append(m)\n>>> m.append('x')\n>>> print(m)\n<'a'|'b'|'c'|...|'x'>\n\n(Contributed by Raymond Hettinger in bpo-9826(1) and bpo-9840(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=9826\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=9840\n\nFile: python3.12.info,  Node: logging<8>,  Next: csv<4>,  Prev: reprlib,  Up: New Improved and Deprecated Modules\n\n1.11.9.12 logging\n.................\n\nIn addition to dictionary-based configuration described above, the *note\nlogging: 82. package has many other improvements.\n\nThe logging documentation has been augmented by a *note basic tutorial:\n1069, an *note advanced tutorial: 106a, and a *note cookbook: 106b. of\nlogging recipes.  These documents are the fastest way to learn about\nlogging.\n\nThe *note logging.basicConfig(): 828. set-up function gained a 'style'\nargument to support three different types of string formatting.  It\ndefaults to \"%\" for traditional %-formatting, can be set to \"{\" for the\nnew *note str.format(): 3ed. style, or can be set to \"$\" for the\nshell-style formatting provided by *note string.Template: 453.  The\nfollowing three configurations are equivalent:\n\n>>> from logging import basicConfig\n>>> basicConfig(style='%', format=\"%(name)s -> %(levelname)s: %(message)s\")\n>>> basicConfig(style='{', format=\"{name} -> {levelname} {message}\")\n>>> basicConfig(style='$', format=\"$name -> $levelname: $message\")\n",
            "subsections": []
        },
        "If no configuration is set-up before a logging event occurs, there is": {
            "content": "now a default configuration using a *note StreamHandler: 106c. directed\nto *note sys.stderr: 757. for events of 'WARNING' level or higher.",
            "subsections": []
        },
        "Formerly, an event occurring before a configuration was set-up would": {
            "content": "either raise an exception or silently drop the event depending on the\nvalue of *note logging.raiseExceptions: 106d.  The new default handler\nis stored in *note logging.lastResort: 106e.\n\nThe use of filters has been simplified.  Instead of creating a *note",
            "subsections": []
        },
        "Filter: 106f. object, the predicate can be any Python callable that": {
            "content": "returns 'True' or 'False'.\n",
            "subsections": []
        },
        "There were a number of other improvements that add flexibility and": {
            "content": "simplify configuration.  See the module documentation for a full listing\nof changes in Python 3.2.\n\nFile: python3.12.info,  Node: csv<4>,  Next: contextlib<8>,  Prev: logging<8>,  Up: New Improved and Deprecated Modules\n\n1.11.9.13 csv\n.............\n\nThe *note csv: 27. module now supports a new dialect, *note\nunixdialect: 1071, which applies quoting for all fields and a\ntraditional Unix style with ''\\n'' as the line terminator.  The\nregistered dialect name is 'unix'.\n\nThe *note csv.DictWriter: 1072. has a new method, *note writeheader():\n1073. for writing-out an initial row to document the field names:\n\n>>> import csv, sys\n>>> w = csv.DictWriter(sys.stdout, ['name', 'dept'], dialect='unix')\n>>> w.writeheader()\n\"name\",\"dept\"\n>>> w.writerows([\n...     {'name': 'tom', 'dept': 'accounting'},\n...     {'name': 'susan', 'dept': 'Salesl'}])\n\"tom\",\"accounting\"\n\"susan\",\"sales\"\n\n(New dialect suggested by Jay Talbot in bpo-5975(1), and the new method\nsuggested by Ed Abraham in bpo-1537721(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=5975\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=1537721\n\nFile: python3.12.info,  Node: contextlib<8>,  Next: decimal and fractions,  Prev: csv<4>,  Up: New Improved and Deprecated Modules\n\n1.11.9.14 contextlib\n....................\n\nThere is a new and slightly mind-blowing tool *note ContextDecorator:\n1075. that is helpful for creating a *note context manager: 398. that\ndoes double duty as a function decorator.\n\nAs a convenience, this new functionality is used by *note\ncontextmanager(): 1076. so that no extra effort is needed to support\nboth roles.\n",
            "subsections": []
        },
        "The basic idea is that both context managers and function decorators can": {
            "content": "be used for pre-action and post-action wrappers.  Context managers wrap\na group of statements using a *note with: 396. statement, and function\ndecorators wrap a group of statements enclosed in a function.  So,\noccasionally there is a need to write a pre-action or post-action\nwrapper that can be used in either role.\n",
            "subsections": []
        },
        "For example, it is sometimes useful to wrap functions or groups of": {
            "content": "statements with a logger that can track the time of entry and time of\nexit.  Rather than writing both a function decorator and a context\nmanager for the task, inheriting from *note ContextDecorator: 1075.\nprovides both capabilities in a single definition:\n\nfrom contextlib import ContextDecorator\nimport logging\n\nlogging.basicConfig(level=logging.INFO)\n\nclass trackentryandexit(ContextDecorator):\ndef init(self, name):\nself.name = name\n\ndef enter(self):\nlogging.info('Entering: %s', self.name)\n\ndef exit(self, exctype, exc, exctb):\nlogging.info('Exiting: %s', self.name)\n\nInstances of this class can be used as both a context manager:\n\nwith trackentryandexit('widget loader'):\nprint('Some time consuming activity goes here')\nloadwidget()\n\nAnd also as a function decorator:\n\n@trackentryandexit('widget loader')\ndef activity():\nprint('Some time consuming activity goes here')\nloadwidget()\n",
            "subsections": []
        },
        "Trying to fulfill two roles at once places some limitations on the": {
            "content": "technique.  Context managers normally have the flexibility to return an\nargument usable by a *note with: 396. statement, but there is no\nparallel for function decorators.\n",
            "subsections": []
        },
        "In the above example, there is not a clean way for the": {
            "content": "'trackentryandexit' context manager to return a logging instance for\nuse in the body of enclosed statements.\n\n(Contributed by Michael Foord in bpo-9110(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=9110\n\nFile: python3.12.info,  Node: decimal and fractions,  Next: ftp,  Prev: contextlib<8>,  Up: New Improved and Deprecated Modules\n\n1.11.9.15 decimal and fractions\n...............................\n",
            "subsections": []
        },
        "Mark Dickinson crafted an elegant and efficient scheme for assuring that": {
            "content": "different numeric datatypes will have the same hash value whenever their\nactual values are equal (bpo-8188(1)):\n\nassert hash(Fraction(3, 2)) == hash(1.5) == \\\nhash(Decimal(\"1.5\")) == hash(complex(1.5, 0))\n\nSome of the hashing details are exposed through a new attribute, *note\nsys.hashinfo: e72, which describes the bit width of the hash value, the\nprime modulus, the hash values for 'infinity' and 'nan', and the\nmultiplier used for the imaginary part of a number:\n\n>>> sys.hashinfo\nsys.hashinfo(width=64, modulus=2305843009213693951, inf=314159, nan=0, imag=1000003)\n",
            "subsections": []
        },
        "An early decision to limit the interoperability of various numeric types": {
            "content": "has been relaxed.  It is still unsupported (and ill-advised) to have\nimplicit mixing in arithmetic expressions such as 'Decimal('1.1') +\nfloat('1.1')' because the latter loses information in the process of\nconstructing the binary float.  However, since existing floating point\nvalue can be converted losslessly to either a decimal or rational\nrepresentation, it makes sense to add them to the constructor and to\nsupport mixed-type comparisons.\n\n* The *note decimal.Decimal: 5c3. constructor now accepts *note\nfloat: 4b7. objects directly so there in no longer a need to use\nthe *note fromfloat(): 1078. method (bpo-8257(2)).\n\n* Mixed type comparisons are now fully supported so that *note\nDecimal: 5c3. objects can be directly compared with *note float:\n4b7. and *note fractions.Fraction: 1a8. (bpo-2531(3) and\nbpo-8188(4)).\n\nSimilar changes were made to *note fractions.Fraction: 1a8. so that the\n*note fromfloat(): 1079. and *note fromdecimal(): 107a. methods are no\nlonger needed (bpo-8294(5)):\n\n>>> from decimal import Decimal\n>>> from fractions import Fraction\n>>> Decimal(1.1)\nDecimal('1.100000000000000088817841970012523233890533447265625')\n>>> Fraction(1.1)\nFraction(2476979795053773, 2251799813685248)\n\nAnother useful change for the *note decimal: 33. module is that the\n'Context.clamp' attribute is now public.  This is useful in creating\ncontexts that correspond to the decimal interchange formats specified in\nIEEE 754 (see bpo-8540(6)).\n\n(Contributed by Mark Dickinson and Raymond Hettinger.)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=8188\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=8257\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=2531\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=8188\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=8294\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=8540\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ftp,  Next: popen,  Prev: decimal and fractions,  Up: New Improved and Deprecated Modules": {
            "content": "1.11.9.16 ftp\n.............\n\nThe *note ftplib.FTP: 715. class now supports the context management\nprotocol to unconditionally consume *note socket.error: ece. exceptions\nand to close the FTP connection when done:\n\n>>> from ftplib import FTP\n>>> with FTP(\"ftp1.at.proftpd.org\") as ftp:\nftp.login()\nftp.dir()\n\n'230 Anonymous login ok, restrictions apply.'\ndr-xr-xr-x   9 ftp      ftp           154 May  6 10:43 .\ndr-xr-xr-x   9 ftp      ftp           154 May  6 10:43 ..\ndr-xr-xr-x   5 ftp      ftp          4096 May  6 10:43 CentOS\ndr-xr-xr-x   3 ftp      ftp            18 Jul 10  2008 Fedora\n\nOther file-like objects such as *note mmap.mmap: 830. and *note\nfileinput.input(): 5f2. also grew auto-closing context managers:\n\nwith fileinput.input(files=('log1.txt', 'log2.txt')) as f:\nfor line in f:\nprocess(line)\n\n(Contributed by Tarek Ziade' and Giampaolo Rodola` in bpo-4972(1), and by",
            "subsections": []
        },
        "Georg Brandl in bpo-8046(2) and bpo-1286(3).)": {
            "content": "The *note FTPTLS: 716. class now accepts a 'context' parameter, which\nis a *note ssl.SSLContext: 278. object allowing bundling SSL\nconfiguration options, certificates and private keys into a single\n(potentially long-lived) structure.\n\n(Contributed by Giampaolo Rodola`; bpo-8806(4).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=4972\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=8046\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=1286\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=8806\n\nFile: python3.12.info,  Node: popen,  Next: select<3>,  Prev: ftp,  Up: New Improved and Deprecated Modules\n\n1.11.9.17 popen\n...............\n\nThe *note os.popen(): 8b5. and *note subprocess.Popen(): 8c3. functions\nnow support *note with: 396. statements for auto-closing of the file\ndescriptors.\n\n(Contributed by Antoine Pitrou and Brian Curtin in bpo-7461(1) and\nbpo-10554(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=7461\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=10554\n\nFile: python3.12.info,  Node: select<3>,  Next: gzip and zipfile,  Prev: popen,  Up: New Improved and Deprecated Modules\n\n1.11.9.18 select\n................\n\nThe *note select: bc. module now exposes a new, constant attribute,\n*note PIPEBUF: 107e, which gives the minimum number of bytes which are\nguaranteed not to block when *note select.select(): bfc. says a pipe is\nready for writing.\n\n>>> import select\n>>> select.PIPEBUF\n512\n\n(Available on Unix systems.  Patch by Se'bastien Sable' in bpo-9862(1))\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=9862\n\nFile: python3.12.info,  Node: gzip and zipfile,  Next: tarfile<10>,  Prev: select<3>,  Up: New Improved and Deprecated Modules\n\n1.11.9.19 gzip and zipfile\n..........................\n\n*note gzip.GzipFile: 25e. now implements the *note io.BufferedIOBase:\n460. *note abstract base class: 102a. (except for 'truncate()').  It\nalso has a *note peek(): 1080. method and supports unseekable as well as\nzero-padded file objects.\n\nThe *note gzip: 62. module also gains the *note compress(): 81d. and\n*note decompress(): 1081. functions for easier in-memory compression and\ndecompression.  Keep in mind that text needs to be encoded as *note\nbytes: 295. before compressing and decompressing:\n\n>>> import gzip\n>>> s = 'Three shall be the number thou shalt count, '\n>>> s += 'and the number of the counting shall be three'\n>>> b = s.encode()                        # convert to utf-8\n>>> len(b)\n89\n>>> c = gzip.compress(b)\n>>> len(c)\n77\n>>> gzip.decompress(c).decode()[:42]      # decompress and convert to text\n'Three shall be the number thou shalt count'\n\n(Contributed by Anand B. Pillai in bpo-3488(1); and by Antoine Pitrou,",
            "subsections": []
        },
        "Nir Aides and Brian Curtin in bpo-9962(2), bpo-1675951(3), bpo-7471(4)": {
            "content": "and bpo-2846(5).)\n\nAlso, the *note zipfile.ZipExtFile: b5c. class was reworked internally\nto represent files stored inside an archive.  The new implementation is\nsignificantly faster and can be wrapped in an *note io.BufferedReader:\n1082. object for more speedups.  It also solves an issue where\ninterleaved calls to 'read' and 'readline' gave the wrong results.\n\n(Patch submitted by Nir Aides in bpo-7610(6).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=3488\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=9962\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=1675951\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=7471\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=2846\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=7610\n\nFile: python3.12.info,  Node: tarfile<10>,  Next: hashlib<7>,  Prev: gzip and zipfile,  Up: New Improved and Deprecated Modules\n\n1.11.9.20 tarfile\n.................\n\nThe *note TarFile: 1084. class can now be used as a context manager.  In\naddition, its *note add(): a39. method has a new option, 'filter', that\ncontrols which files are added to the archive and allows the file\nmetadata to be edited.\n",
            "subsections": []
        },
        "The new 'filter' option replaces the older, less flexible 'exclude'": {
            "content": "parameter which is now deprecated.  If specified, the optional 'filter'\nparameter needs to be a *note keyword argument: b64.  The user-supplied\nfilter function accepts a *note TarInfo: 1085. object and returns an\nupdated *note TarInfo: 1085. object, or if it wants the file to be\nexcluded, the function can return 'None':\n\n>>> import tarfile, glob\n\n>>> def myfilter(tarinfo):\n...     if tarinfo.isfile():             # only save real files\n...         tarinfo.uname = 'monty'      # redact the user name\n...         return tarinfo\n\n>>> with tarfile.open(name='myarchive.tar.gz', mode='w:gz') as tf:\n...     for filename in glob.glob('*.txt'):\n...         tf.add(filename, filter=myfilter)\n...     tf.list()\n-rw-r--r-- monty/501        902 2011-01-26 17:59:11 annotations.txt\n-rw-r--r-- monty/501        123 2011-01-26 17:59:11 generalquestions.txt\n-rw-r--r-- monty/501       3514 2011-01-26 17:59:11 prion.txt\n-rw-r--r-- monty/501        124 2011-01-26 17:59:11 pytodo.txt\n-rw-r--r-- monty/501       1399 2011-01-26 17:59:11 semaphorenotes.txt\n\n(Proposed by Tarek Ziade' and implemented by Lars Gusta\"bel in\nbpo-6856(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=6856\n\nFile: python3.12.info,  Node: hashlib<7>,  Next: ast<4>,  Prev: tarfile<10>,  Up: New Improved and Deprecated Modules\n\n1.11.9.21 hashlib\n.................\n\nThe *note hashlib: 63. module has two new constant attributes listing\nthe hashing algorithms guaranteed to be present in all implementations\nand those available on the current implementation:\n\n>>> import hashlib\n\n>>> hashlib.algorithmsguaranteed\n{'sha1', 'sha224', 'sha384', 'sha256', 'sha512', 'md5'}\n\n>>> hashlib.algorithmsavailable\n{'md2', 'SHA256', 'SHA512', 'dsaWithSHA', 'mdc2', 'SHA224', 'MD4', 'sha256',\n'sha512', 'ripemd160', 'SHA1', 'MDC2', 'SHA', 'SHA384', 'MD2',\n'ecdsa-with-SHA1','md4', 'md5', 'sha1', 'DSA-SHA', 'sha224',\n'dsaEncryption', 'DSA', 'RIPEMD160', 'sha', 'MD5', 'sha384'}\n\n(Suggested by Carl Chenet in bpo-7418(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=7418\n\nFile: python3.12.info,  Node: ast<4>,  Next: os<12>,  Prev: hashlib<7>,  Up: New Improved and Deprecated Modules\n\n1.11.9.22 ast\n.............\n\nThe *note ast: 8. module has a wonderful a general-purpose tool for\nsafely evaluating expression strings using the Python literal syntax.\nThe *note ast.literaleval(): a5e. function serves as a secure\nalternative to the builtin *note eval(): 690. function which is easily\nabused.  Python 3.2 adds *note bytes: 295. and *note set: 39d. literals\nto the list of supported types: strings, bytes, numbers, tuples, lists,\ndicts, sets, booleans, and 'None'.\n\n>>> from ast import literaleval\n\n>>> request = \"{'req': 3, 'func': 'pow', 'args': (2, 0.5)}\"\n>>> literaleval(request)\n{'args': (2, 0.5), 'req': 3, 'func': 'pow'}\n\n>>> request = \"os.system('do something harmful')\"\n>>> literaleval(request)\nTraceback (most recent call last):\n...\nValueError: malformed node or string: <ast.Call object at 0x101739a10>\n\n(Implemented by Benjamin Peterson and Georg Brandl.)\n\nFile: python3.12.info,  Node: os<12>,  Next: shutil<7>,  Prev: ast<4>,  Up: New Improved and Deprecated Modules\n\n1.11.9.23 os\n............\n",
            "subsections": []
        },
        "Different operating systems use various encodings for filenames and": {
            "content": "environment variables.  The *note os: 9c. module provides two new\nfunctions, *note fsencode(): a9e. and *note fsdecode(): a9d, for\nencoding and decoding filenames:\n\n>>> import os\n>>> filename = 'Sehenswu\"rdigkeiten'\n>>> os.fsencode(filename)\nb'Sehensw\\xc3\\xbcrdigkeiten'\n",
            "subsections": []
        },
        "Some operating systems allow direct access to encoded bytes in the": {
            "content": "environment.  If so, the *note os.supportsbytesenviron: 1089. constant\nwill be true.\n",
            "subsections": []
        },
        "For direct access to encoded environment variables (if available), use": {
            "content": "the new *note os.getenvb(): 108a. function or use *note os.environb:\n108b. which is a bytes version of *note os.environ: 102e.\n\n(Contributed by Victor Stinner.)\n\nFile: python3.12.info,  Node: shutil<7>,  Next: sqlite3<10>,  Prev: os<12>,  Up: New Improved and Deprecated Modules\n\n1.11.9.24 shutil\n................\n\nThe *note shutil.copytree(): 854. function has two new options:\n\n* 'ignoredanglingsymlinks': when 'symlinks=False' so that the\nfunction copies a file pointed to by a symlink, not the symlink\nitself.  This option will silence the error raised if the file\ndoesn't exist.\n\n* 'copyfunction': is a callable that will be used to copy files.\n*note shutil.copy2(): 888. is used by default.\n\n(Contributed by Tarek Ziade'.)\n\nIn addition, the *note shutil: c0. module now supports *note archiving\noperations: 108d. for zipfiles, uncompressed tarfiles, gzipped tarfiles,\nand bzipped tarfiles.  And there are functions for registering\nadditional archiving file formats (such as xz compressed tarfiles or\ncustom formats).\n\nThe principal functions are *note makearchive(): 1d4. and *note\nunpackarchive(): 184.  By default, both operate on the current\ndirectory (which can be set by *note os.chdir(): 3d8.) and on any\nsub-directories.  The archive filename needs to be specified with a full\npathname.  The archiving step is non-destructive (the original files are\nleft unchanged).\n\n>>> import shutil, pprint\n\n>>> os.chdir('mydata')  # change to the source directory\n>>> f = shutil.makearchive('/var/backup/mydata',\n...                         'zip')      # archive the current directory\n>>> f                                   # show the name of archive\n'/var/backup/mydata.zip'\n>>> os.chdir('tmp')                     # change to an unpacking\n>>> shutil.unpackarchive('/var/backup/mydata.zip')  # recover the data\n\n>>> pprint.pprint(shutil.getarchiveformats())  # display known formats\n[('bztar', \"bzip2'ed tar-file\"),\n('gztar', \"gzip'ed tar-file\"),\n('tar', 'uncompressed tar file'),\n('zip', 'ZIP file')]\n\n>>> shutil.registerarchiveformat(     # register a new archive format\n...     name='xz',\n...     function=xz.compress,           # callable archiving function\n...     extraargs=[('level', 8)],      # arguments to the function\n...     description='xz compression'\n... )\n\n(Contributed by Tarek Ziade'.)\n\nFile: python3.12.info,  Node: sqlite3<10>,  Next: html<3>,  Prev: shutil<7>,  Up: New Improved and Deprecated Modules\n\n1.11.9.25 sqlite3\n.................\n\nThe *note sqlite3: c9. module was updated to pysqlite version 2.6.0.  It\nhas two new capabilities.\n\n* The 'sqlite3.Connection.intransit' attribute is true if there is\nan active transaction for uncommitted changes.\n\n* The *note sqlite3.Connection.enableloadextension(): 634. and\n*note sqlite3.Connection.loadextension(): 1dc. methods allows you\nto load SQLite extensions from \".so\" files.  One well-known\nextension is the fulltext-search extension distributed with SQLite.\n\n(Contributed by R. David Murray and Shashwat Anand; bpo-8845(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=8845\n\nFile: python3.12.info,  Node: html<3>,  Next: socket<11>,  Prev: sqlite3<10>,  Up: New Improved and Deprecated Modules\n\n1.11.9.26 html\n..............\n\nA new *note html: 66. module was introduced with only a single function,\n*note escape(): e82, which is used for escaping reserved characters from\nHTML markup:\n\n>>> import html\n>>> html.escape('x > 2 && x < 7')\n'x &gt; 2 &amp;&amp; x &lt; 7'\n\nFile: python3.12.info,  Node: socket<11>,  Next: ssl<11>,  Prev: html<3>,  Up: New Improved and Deprecated Modules\n\n1.11.9.27 socket\n................\n\nThe *note socket: c6. module has two new improvements.\n\n* Socket objects now have a *note detach(): 1091. method which puts\nthe socket into closed state without actually closing the\nunderlying file descriptor.  The latter can then be reused for\nother purposes.  (Added by Antoine Pitrou; bpo-8524(1).)\n\n* *note socket.createconnection(): 43c. now supports the context\nmanagement protocol to unconditionally consume *note socket.error:\nece. exceptions and to close the socket when done.  (Contributed by\nGiampaolo Rodola`; bpo-9794(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=8524\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=9794\n\nFile: python3.12.info,  Node: ssl<11>,  Next: nntp,  Prev: socket<11>,  Up: New Improved and Deprecated Modules\n\n1.11.9.28 ssl\n.............\n\nThe *note ssl: ca. module added a number of features to satisfy common\nrequirements for secure (encrypted, authenticated) internet connections:\n\n* A new class, *note SSLContext: 278, serves as a container for\npersistent SSL data, such as protocol settings, certificates,\nprivate keys, and various other options.  It includes a *note\nwrapsocket(): 279. for creating an SSL socket from an SSL context.\n\n* A new function, 'ssl.matchhostname()', supports server identity\nverification for higher-level protocols by implementing the rules\nof HTTPS (from RFC 2818(1)) which are also suitable for other\nprotocols.\n\n* The *note ssl.wrapsocket(): 279. constructor function now takes a\n'ciphers' argument.  The 'ciphers' string lists the allowed\nencryption algorithms using the format described in the OpenSSL\ndocumentation(2).\n\n* When linked against recent versions of OpenSSL, the *note ssl: ca.\nmodule now supports the Server Name Indication extension to the TLS\nprotocol, allowing multiple \"virtual hosts\" using different\ncertificates on a single IP port.  This extension is only supported\nin client mode, and is activated by passing the 'serverhostname'\nargument to *note ssl.SSLContext.wrapsocket(): 279.\n\n* Various options have been added to the *note ssl: ca. module, such\nas *note OPNOSSLv2: 62e. which disables the insecure and obsolete\nSSLv2 protocol.\n\n* The extension now loads all the OpenSSL ciphers and digest\nalgorithms.  If some SSL certificates cannot be verified, they are\nreported as an \"unknown algorithm\" error.\n\n* The version of OpenSSL being used is now accessible using the\nmodule attributes *note ssl.OPENSSLVERSION: 1093. (a string),\n*note ssl.OPENSSLVERSIONINFO: 1094. (a 5-tuple), and *note\nssl.OPENSSLVERSIONNUMBER: 1095. (an integer).\n\n(Contributed by Antoine Pitrou in bpo-8850(3), bpo-1589(4), bpo-8322(5),\nbpo-5639(6), bpo-4870(7), bpo-8484(8), and bpo-8321(9).)\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc2818.html\n\n(2)\nhttps://www.openssl.org/docs/man1.0.2/man1/ciphers.html#CIPHER-LIST-FORMAT\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=8850\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=1589\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=8322\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=5639\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=4870\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=8484\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=8321\n\nFile: python3.12.info,  Node: nntp,  Next: certificates,  Prev: ssl<11>,  Up: New Improved and Deprecated Modules\n\n1.11.9.29 nntp\n..............\n\nThe *note nntplib: 98. module has a revamped implementation with better\nbytes and text semantics as well as more practical APIs.  These\nimprovements break compatibility with the nntplib version in Python 3.1,\nwhich was partly dysfunctional in itself.\n\nSupport for secure connections through both implicit (using *note\nnntplib.NNTPSSL: 734.) and explicit (using *note\nnntplib.NNTP.starttls(): 1097.) TLS has also been added.\n\n(Contributed by Antoine Pitrou in bpo-9360(1) and Andrew Vant in\nbpo-1926(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=9360\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=1926\n\nFile: python3.12.info,  Node: certificates,  Next: imaplib<4>,  Prev: nntp,  Up: New Improved and Deprecated Modules\n\n1.11.9.30 certificates\n......................\n\n*note http.client.HTTPSConnection: 97b, *note\nurllib.request.HTTPSHandler: 1099. and *note urllib.request.urlopen():\ncf9. now take optional arguments to allow for server certificate\nchecking against a set of Certificate Authorities, as recommended in\npublic uses of HTTPS.\n\n(Added by Antoine Pitrou, bpo-9003(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=9003\n\nFile: python3.12.info,  Node: imaplib<4>,  Next: http client<4>,  Prev: certificates,  Up: New Improved and Deprecated Modules\n\n1.11.9.31 imaplib\n.................\n",
            "subsections": []
        },
        "Support for explicit TLS on standard IMAP4 connections has been added": {
            "content": "through the new *note imaplib.IMAP4.starttls: 109b. method.\n\n(Contributed by Lorenzo M. Catucci and Antoine Pitrou, bpo-4471(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=4471\n\nFile: python3.12.info,  Node: http client<4>,  Next: unittest<10>,  Prev: imaplib<4>,  Up: New Improved and Deprecated Modules\n\n1.11.9.32 http.client\n.....................\n\nThere were a number of small API improvements in the *note http.client:\n6a. module.  The old-style HTTP 0.9 simple responses are no longer\nsupported and the 'strict' parameter is deprecated in all classes.\n\nThe *note HTTPConnection: 97a. and *note HTTPSConnection: 97b. classes\nnow have a 'sourceaddress' parameter for a (host, port) tuple\nindicating where the HTTP connection is made from.\n",
            "subsections": []
        },
        "Support for certificate checking and HTTPS virtual hosts were added to": {
            "content": "*note HTTPSConnection: 97b.\n\nThe *note request(): af8. method on connection objects allowed an\noptional 'body' argument so that a *note file object: 1037. could be\nused to supply the content of the request.  Conveniently, the 'body'\nargument now also accepts an *note iterable: 109d. object so long as it\nincludes an explicit 'Content-Length' header.  This extended interface\nis much more flexible than before.\n",
            "subsections": []
        },
        "To establish an HTTPS connection through a proxy server, there is a new": {
            "content": "*note settunnel(): 109e. method that sets the host and port for HTTP\nConnect tunneling.\n\nTo match the behavior of *note http.server: 6d, the HTTP client library\nnow also encodes headers with ISO-8859-1 (Latin-1) encoding.  It was\nalready doing that for incoming headers, so now the behavior is\nconsistent for both incoming and outgoing traffic.  (See work by Armin",
            "subsections": []
        },
        "Ronacher in bpo-10980(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=10980\n\nFile: python3.12.info,  Node: unittest<10>,  Next: random<4>,  Prev: http client<4>,  Up: New Improved and Deprecated Modules\n\n1.11.9.33 unittest\n..................\n",
            "subsections": []
        },
        "The unittest module has a number of improvements supporting test": {
            "content": "discovery for packages, easier experimentation at the interactive\nprompt, new testcase methods, improved diagnostic messages for test\nfailures, and better method names.\n\n* The command-line call 'python -m unittest' can now accept file\npaths instead of module names for running specific tests\n(bpo-10620(1)).  The new test discovery can find tests within\npackages, locating any test importable from the top-level\ndirectory.  The top-level directory can be specified with the '-t'\noption, a pattern for matching files with '-p', and a directory to\nstart discovery with '-s':\n\n$ python -m unittest discover -s myprojdir -p test.py\n\n(Contributed by Michael Foord.)\n\n* Experimentation at the interactive prompt is now easier because the\n*note unittest.TestCase: 159. class can now be instantiated without\narguments:\n\n>>> from unittest import TestCase\n>>> TestCase().assertEqual(pow(2, 3), 8)\n\n(Contributed by Michael Foord.)\n\n* The *note unittest: 101. module has two new methods, *note\nassertWarns(): fd9. and *note assertWarnsRegex(): fda. to verify\nthat a given warning type is triggered by the code under test:\n\nwith self.assertWarns(DeprecationWarning):\nlegacyfunction('XYZ')\n\n(Contributed by Antoine Pitrou, bpo-9754(2).)\n\nAnother new method, *note assertCountEqual(): 10a0. is used to\ncompare two iterables to determine if their element counts are\nequal (whether the same elements are present with the same number\nof occurrences regardless of order):\n\ndef testanagram(self):\nself.assertCountEqual('algorithm', 'logarithm')\n\n(Contributed by Raymond Hettinger.)\n\n* A principal feature of the unittest module is an effort to produce\nmeaningful diagnostics when a test fails.  When possible, the\nfailure is recorded along with a diff of the output.  This is\nespecially helpful for analyzing log files of failed test runs.\nHowever, since diffs can sometime be voluminous, there is a new\n*note maxDiff: 10a1. attribute that sets maximum length of diffs\ndisplayed.\n\n* In addition, the method names in the module have undergone a number\nof clean-ups.\n\nFor example, *note assertRegex(): 282. is the new name for\n'assertRegexpMatches()' which was misnamed because the test uses\n*note re.search(): 10a2, not *note re.match(): 10a3.  Other methods\nusing regular expressions are now named using short form \"Regex\" in\npreference to \"Regexp\" - this matches the names used in other\nunittest implementations, matches Python's old name for the *note\nre: b4. module, and it has unambiguous camel-casing.\n\n(Contributed by Raymond Hettinger and implemented by Ezio Melotti.)\n\n* To improve consistency, some long-standing method aliases are being\ndeprecated in favor of the preferred names:\n\nOld Name                            Preferred Name\n\n-----------------------------------------------------------------------\n\n'assert()'                         *note assertTrue(): 27b.\n\n\n'assertEquals()'                    *note assertEqual(): 27d.\n\n\n'assertNotEquals()'                 *note assertNotEqual(): 27e.\n\n\n'assertAlmostEquals()'              *note assertAlmostEqual(): 27f.\n\n\n'assertNotAlmostEquals()'           *note assertNotAlmostEqual(): 280.\n\n\nLikewise, the 'TestCase.fail*' methods deprecated in Python 3.1 are\nexpected to be removed in Python 3.3.\n\n(Contributed by Ezio Melotti; bpo-9424(3).)\n\n* The 'assertDictContainsSubset()' method was deprecated because it\nwas misimplemented with the arguments in the wrong order.  This\ncreated hard-to-debug optical illusions where tests like\n'TestCase().assertDictContainsSubset({'a':1, 'b':2}, {'a':1})'\nwould fail.\n\n(Contributed by Raymond Hettinger.)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=10620\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=9754\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=9424\n\nFile: python3.12.info,  Node: random<4>,  Next: poplib<4>,  Prev: unittest<10>,  Up: New Improved and Deprecated Modules\n\n1.11.9.34 random\n................\n\nThe integer methods in the *note random: b3. module now do a better job\nof producing uniform distributions.  Previously, they computed\nselections with 'int(n*random())' which had a slight bias whenever 'n'\nwas not a power of two.  Now, multiple selections are made from a range\nup to the next power of two and a selection is kept only when it falls\nwithin the range '0 <= x < n'.  The functions and methods affected are\n*note randrange(): 665, *note randint(): 10a5, *note choice(): 10a6,\n*note shuffle(): 52e. and *note sample(): 52d.\n\n(Contributed by Raymond Hettinger; bpo-9025(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=9025\n\nFile: python3.12.info,  Node: poplib<4>,  Next: asyncore<2>,  Prev: random<4>,  Up: New Improved and Deprecated Modules\n\n1.11.9.35 poplib\n................\n\n*note POP3SSL: 743. class now accepts a 'context' parameter, which is a\n*note ssl.SSLContext: 278. object allowing bundling SSL configuration\noptions, certificates and private keys into a single (potentially\nlong-lived) structure.\n\n(Contributed by Giampaolo Rodola`; bpo-8807(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=8807\n\nFile: python3.12.info,  Node: asyncore<2>,  Next: tempfile<4>,  Prev: poplib<4>,  Up: New Improved and Deprecated Modules\n\n1.11.9.36 asyncore\n..................\n\n'asyncore.dispatcher' now provides a 'handleaccepted()' method\nreturning a '(sock, addr)' pair which is called when a connection has\nactually been established with a new remote endpoint.  This is supposed\nto be used as a replacement for old 'handleaccept()' and avoids the\nuser to call 'accept()' directly.\n\n(Contributed by Giampaolo Rodola`; bpo-6706(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=6706\n\nFile: python3.12.info,  Node: tempfile<4>,  Next: inspect<10>,  Prev: asyncore<2>,  Up: New Improved and Deprecated Modules\n\n1.11.9.37 tempfile\n..................\n\nThe *note tempfile: da. module has a new context manager, *note",
            "subsections": []
        },
        "TemporaryDirectory: 10aa. which provides easy deterministic cleanup of": {
            "content": "temporary directories:\n\nwith tempfile.TemporaryDirectory() as tmpdirname:\nprint('created temporary dir:', tmpdirname)\n\n(Contributed by Neil Schemenauer and Nick Coghlan; bpo-5178(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=5178\n\nFile: python3.12.info,  Node: inspect<10>,  Next: pydoc<6>,  Prev: tempfile<4>,  Up: New Improved and Deprecated Modules\n\n1.11.9.38 inspect\n.................\n\n* The *note inspect: 78. module has a new function *note\ngetgeneratorstate(): 10ac. to easily identify the current state of\na generator-iterator:\n\n>>> from inspect import getgeneratorstate\n>>> def gen():\n...     yield 'demo'\n...\n>>> g = gen()\n>>> getgeneratorstate(g)\n'GENCREATED'\n>>> next(g)\n'demo'\n>>> getgeneratorstate(g)\n'GENSUSPENDED'\n>>> next(g, None)\n>>> getgeneratorstate(g)\n'GENCLOSED'\n\n(Contributed by Rodolpho Eckhardt and Nick Coghlan, bpo-10220(1).)\n\n* To support lookups without the possibility of activating a dynamic\nattribute, the *note inspect: 78. module has a new function, *note\ngetattrstatic(): 1b2.  Unlike *note hasattr(): 1f7, this is a true\nread-only search, guaranteed not to change state while it is\nsearching:\n\n>>> class A:\n...     @property\n...     def f(self):\n...         print('Running')\n...         return 10\n...\n>>> a = A()\n>>> getattr(a, 'f')\nRunning\n10\n>>> inspect.getattrstatic(a, 'f')\n<property object at 0x1022bd788>\n\n(Contributed by Michael Foord.)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=10220\n\nFile: python3.12.info,  Node: pydoc<6>,  Next: dis<4>,  Prev: inspect<10>,  Up: New Improved and Deprecated Modules\n\n1.11.9.39 pydoc\n...............\n\nThe *note pydoc: b0. module now provides a much-improved web server\ninterface, as well as a new command-line option '-b' to automatically\nopen a browser window to display that server:\n\n$ pydoc3.2 -b\n\n(Contributed by Ron Adam; bpo-2001(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=2001\n\nFile: python3.12.info,  Node: dis<4>,  Next: dbm<6>,  Prev: pydoc<6>,  Up: New Improved and Deprecated Modules\n\n1.11.9.40 dis\n.............\n\nThe *note dis: 35. module gained two new functions for inspecting code,\n*note codeinfo(): 10af. and *note showcode(): d99.  Both provide\ndetailed code object information for the supplied function, method,\nsource code string or code object.  The former returns a string and the\nlatter prints it:\n\n>>> import dis, random\n>>> dis.showcode(random.choice)\nName:              choice\nFilename:          /Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/random.py\nArgument count:    2\nKw-only arguments: 0\nNumber of locals:  3\nStack size:        11\nFlags:             OPTIMIZED, NEWLOCALS, NOFREE\nConstants:\n0: 'Choose a random element from a non-empty sequence.'\n1: 'Cannot choose from an empty sequence'\nNames:\n0: randbelow\n1: len\n2: ValueError\n3: IndexError\nVariable names:\n0: self\n1: seq\n2: i\n\nIn addition, the *note dis(): 96e. function now accepts string arguments\nso that the common idiom 'dis(compile(s, '', 'eval'))' can be shortened\nto 'dis(s)':\n\n>>> dis('3*x+1 if x%2==1 else x//2')\n1           0 LOADNAME                0 (x)\n3 LOADCONST               0 (2)\n6 BINARYMODULO\n7 LOADCONST               1 (1)\n10 COMPAREOP               2 (==)\n13 POPJUMPIFFALSE       28\n16 LOADCONST               2 (3)\n19 LOADNAME                0 (x)\n22 BINARYMULTIPLY\n23 LOADCONST               1 (1)\n26 BINARYADD\n27 RETURNVALUE\n>>   28 LOADNAME                0 (x)\n31 LOADCONST               0 (2)\n34 BINARYFLOORDIVIDE\n35 RETURNVALUE\n",
            "subsections": []
        },
        "Taken together, these improvements make it easier to explore how CPython": {
            "content": "is implemented and to see for yourself what the language syntax does\nunder-the-hood.\n\n(Contributed by Nick Coghlan in bpo-9147(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=9147\n\nFile: python3.12.info,  Node: dbm<6>,  Next: ctypes<2>,  Prev: dis<4>,  Up: New Improved and Deprecated Modules\n\n1.11.9.41 dbm\n.............\n\nAll database modules now support the 'get()' and 'setdefault()' methods.\n\n(Suggested by Ray Allen in bpo-9523(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=9523\n\nFile: python3.12.info,  Node: ctypes<2>,  Next: site<3>,  Prev: dbm<6>,  Up: New Improved and Deprecated Modules\n\n1.11.9.42 ctypes\n................\n\nA new type, *note ctypes.cssizet: 10b2. represents the C 'ssizet'\ndatatype.\n\nFile: python3.12.info,  Node: site<3>,  Next: sysconfig<3>,  Prev: ctypes<2>,  Up: New Improved and Deprecated Modules\n\n1.11.9.43 site\n..............\n\nThe *note site: c2. module has three new functions useful for reporting\non the details of a given Python installation.\n\n* *note getsitepackages(): 10b4. lists all global site-packages\ndirectories.\n\n* *note getuserbase(): 10b5. reports on the user's base directory\nwhere data can be stored.\n\n* *note getusersitepackages(): 10b6. reveals the user-specific\nsite-packages directory path.\n\n>>> import site\n>>> site.getsitepackages()\n['/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages',\n'/Library/Frameworks/Python.framework/Versions/3.2/lib/site-python',\n'/Library/Python/3.2/site-packages']\n>>> site.getuserbase()\n'/Users/raymondhettinger/Library/Python/3.2'\n>>> site.getusersitepackages()\n'/Users/raymondhettinger/Library/Python/3.2/lib/python/site-packages'\n",
            "subsections": []
        },
        "Conveniently, some of site's functionality is accessible directly from": {
            "content": "the command-line:\n\n$ python -m site --user-base\n/Users/raymondhettinger/.local\n$ python -m site --user-site\n/Users/raymondhettinger/.local/lib/python3.2/site-packages\n\n(Contributed by Tarek Ziade' in bpo-6693(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=6693\n\nFile: python3.12.info,  Node: sysconfig<3>,  Next: pdb<7>,  Prev: site<3>,  Up: New Improved and Deprecated Modules\n\n1.11.9.44 sysconfig\n...................\n\nThe new *note sysconfig: d5. module makes it straightforward to discover\ninstallation paths and configuration variables that vary across\nplatforms and installations.\n",
            "subsections": []
        },
        "The module offers access simple access functions for platform and": {
            "content": "version information:\n\n* *note getplatform(): 10b8. returning values like 'linux-i586' or\n'macosx-10.6-ppc'.\n\n* *note getpythonversion(): 10b9. returns a Python version string\nsuch as \"3.2\".\n",
            "subsections": []
        },
        "It also provides access to the paths and variables corresponding to one": {
            "content": "of seven named schemes used by 'distutils'.  Those include\n'posixprefix', 'posixhome', 'posixuser', 'nt', 'ntuser', 'os2',\n'os2home':\n\n* *note getpaths(): 10ba. makes a dictionary containing installation\npaths for the current installation scheme.\n\n* *note getconfigvars(): ea3. returns a dictionary of platform\nspecific variables.\n\nThere is also a convenient command-line interface:\n\nC:\\Python32>python -m sysconfig\nPlatform: \"win32\"\nPython version: \"3.2\"\nCurrent installation scheme: \"nt\"\n\nPaths:\ndata = \"C:\\Python32\"\ninclude = \"C:\\Python32\\Include\"\nplatinclude = \"C:\\Python32\\Include\"\nplatlib = \"C:\\Python32\\Lib\\site-packages\"\nplatstdlib = \"C:\\Python32\\Lib\"\npurelib = \"C:\\Python32\\Lib\\site-packages\"\nscripts = \"C:\\Python32\\Scripts\"\nstdlib = \"C:\\Python32\\Lib\"\n\nVariables:\nBINDIR = \"C:\\Python32\"\nBINLIBDEST = \"C:\\Python32\\Lib\"\nEXE = \".exe\"\nINCLUDEPY = \"C:\\Python32\\Include\"\nLIBDEST = \"C:\\Python32\\Lib\"\nSO = \".pyd\"\nVERSION = \"32\"\nabiflags = \"\"\nbase = \"C:\\Python32\"\nexecprefix = \"C:\\Python32\"\nplatbase = \"C:\\Python32\"\nprefix = \"C:\\Python32\"\nprojectbase = \"C:\\Python32\"\npyversion = \"3.2\"\npyversionnodot = \"32\"\npyversionshort = \"3.2\"\nsrcdir = \"C:\\Python32\"\nuserbase = \"C:\\Documents and Settings\\Raymond\\Application Data\\Python\"\n\n(Moved out of Distutils by Tarek Ziade'.)\n\nFile: python3.12.info,  Node: pdb<7>,  Next: configparser<3>,  Prev: sysconfig<3>,  Up: New Improved and Deprecated Modules\n\n1.11.9.45 pdb\n.............\n\nThe *note pdb: a0. debugger module gained a number of usability\nimprovements:\n\n* 'pdb.py' now has a '-c' option that executes commands as given in a\n'.pdbrc' script file.\n\n* A '.pdbrc' script file can contain 'continue' and 'next' commands\nthat continue debugging.\n\n* The *note Pdb: 740. class constructor now accepts a 'nosigint'\nargument.\n\n* New commands: 'l(list)', 'll(long list)' and 'source' for listing\nsource code.\n\n* New commands: 'display' and 'undisplay' for showing or hiding the\nvalue of an expression if it has changed.\n\n* New command: 'interact' for starting an interactive interpreter\ncontaining the global and local names found in the current scope.\n\n* Breakpoints can be cleared by breakpoint number.\n\n(Contributed by Georg Brandl, Antonio Cuni and Ilya Sandler.)\n\nFile: python3.12.info,  Node: configparser<3>,  Next: urllib parse<6>,  Prev: pdb<7>,  Up: New Improved and Deprecated Modules\n\n1.11.9.46 configparser\n......................\n\nThe *note configparser: 20. module was modified to improve usability and\npredictability of the default parser and its supported INI syntax.  The\nold 'ConfigParser' class was removed in favor of 'SafeConfigParser'\nwhich has in turn been renamed to *note ConfigParser: 257.  Support for\ninline comments is now turned off by default and section or option\nduplicates are not allowed in a single configuration source.\n\nConfig parsers gained a new API based on the mapping protocol:\n\n>>> parser = ConfigParser()\n>>> parser.readstring(\"\"\"\n... [DEFAULT]\n... location = upper left\n... visible = yes\n... editable = no\n... color = blue\n...\n... [main]\n... title = Main Menu\n... color = green\n...\n... [options]\n... title = Options\n... \"\"\")\n>>> parser['main']['color']\n'green'\n>>> parser['main']['editable']\n'no'\n>>> section = parser['options']\n>>> section['title']\n'Options'\n>>> section['title'] = 'Options (editable: %(editable)s)'\n>>> section['title']\n'Options (editable: no)'\n",
            "subsections": []
        },
        "The new API is implemented on top of the classical API, so custom parser": {
            "content": "subclasses should be able to use it without modifications.\n\nThe INI file structure accepted by config parsers can now be customized.",
            "subsections": []
        },
        "Users can specify alternative option/value delimiters and comment": {
            "content": "prefixes, change the name of the 'DEFAULT' section or switch the\ninterpolation syntax.\n",
            "subsections": []
        },
        "There is support for pluggable interpolation including an additional": {
            "content": "interpolation handler *note ExtendedInterpolation: 4f8.:\n\n>>> parser = ConfigParser(interpolation=ExtendedInterpolation())\n>>> parser.readdict({'buildout': {'directory': '/home/ambv/zope9'},\n...                   'custom': {'prefix': '/usr/local'}})\n>>> parser.readstring(\"\"\"\n... [buildout]\n... parts =\n...   zope9\n...   instance\n... find-links =\n...   ${buildout:directory}/downloads/dist\n...\n... [zope9]\n... recipe = plone.recipe.zope9install\n... location = /opt/zope\n...\n... [instance]\n... recipe = plone.recipe.zope9instance\n... zope9-location = ${zope9:location}\n... zope-conf = ${custom:prefix}/etc/zope.conf\n... \"\"\")\n>>> parser['buildout']['find-links']\n'\\n/home/ambv/zope9/downloads/dist'\n>>> parser['instance']['zope-conf']\n'/usr/local/etc/zope.conf'\n>>> instance = parser['instance']\n>>> instance['zope-conf']\n'/usr/local/etc/zope.conf'\n>>> instance['zope9-location']\n'/opt/zope'\n\nA number of smaller features were also introduced, like support for\nspecifying encoding in read operations, specifying fallback values for\nget-functions, or reading directly from dictionaries and strings.\n\n(All changes contributed by ??ukasz Langa.)\n\nFile: python3.12.info,  Node: urllib parse<6>,  Next: mailbox,  Prev: configparser<3>,  Up: New Improved and Deprecated Modules\n\n1.11.9.47 urllib.parse\n......................\n\nA number of usability improvements were made for the *note urllib.parse:\n105. module.\n\nThe *note urlparse(): b96. function now supports IPv6(1) addresses as\ndescribed in RFC 2732(2):\n\n>>> import urllib.parse\n>>> urllib.parse.urlparse('http://[dead:beef:cafe:5417:affe:8FA3:deaf:feed]/foo/')\nParseResult(scheme='http',\nnetloc='[dead:beef:cafe:5417:affe:8FA3:deaf:feed]',\npath='/foo/',\nparams='',\nquery='',\nfragment='')\n\nThe *note urldefrag(): 10be. function now returns a *note named tuple:\n417.:\n\n>>> r = urllib.parse.urldefrag('http://python.org/about/#target')\n>>> r\nDefragResult(url='http://python.org/about/', fragment='target')\n>>> r[0]\n'http://python.org/about/'\n>>> r.fragment\n'target'\n\nAnd, the *note urlencode(): cf8. function is now much more flexible,\naccepting either a string or bytes type for the 'query' argument.  If it\nis a string, then the 'safe', 'encoding', and 'error' parameters are\nsent to *note quoteplus(): 10bf. for encoding:\n\n>>> urllib.parse.urlencode([\n...      ('type', 'telenovela'),\n...      ('name', '??D??nde Est?? Elisa?')],\n...      encoding='latin-1')\n'type=telenovela&name=%BFD%F3nde+Est%E1+Elisa%3F'\n\nAs detailed in *note Parsing ASCII Encoded Bytes: 10c0, all the *note\nurllib.parse: 105. functions now accept ASCII-encoded byte strings as\ninput, so long as they are not mixed with regular strings.  If\nASCII-encoded byte strings are given as parameters, the return types\nwill also be an ASCII-encoded byte strings:\n\n>>> urllib.parse.urlparse(b'http://www.python.org:80/about/')\nParseResultBytes(scheme=b'http', netloc=b'www.python.org:80',\npath=b'/about/', params=b'', query=b'', fragment=b'')\n\n(Work by Nick Coghlan, Dan Mahn, and Senthil Kumaran in bpo-2987(3),\nbpo-5468(4), and bpo-9873(5).)\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/IPv6\n\n(2) https://datatracker.ietf.org/doc/html/rfc2732.html\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=2987\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=5468\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=9873\n\nFile: python3.12.info,  Node: mailbox,  Next: turtledemo,  Prev: urllib parse<6>,  Up: New Improved and Deprecated Modules\n\n1.11.9.48 mailbox\n.................\n\nThanks to a concerted effort by R. David Murray, the *note mailbox: 86.\nmodule has been fixed for Python 3.2.  The challenge was that mailbox\nhad been originally designed with a text interface, but email messages\nare best represented with *note bytes: 295. because various parts of a\nmessage may have different encodings.\n\nThe solution harnessed the *note email: 37. package's binary support for\nparsing arbitrary email messages.  In addition, the solution required a\nnumber of API changes.\n\nAs expected, the *note add(): 10c2. method for *note mailbox.Mailbox:\n10c3. objects now accepts binary input.\n\n*note StringIO: d94. and text file input are deprecated.  Also, string\ninput will fail early if non-ASCII characters are used.  Previously it\nwould fail when the email was processed in a later step.\n\nThere is also support for binary output.  The *note getfile(): 10c4.\nmethod now returns a file in the binary mode (where it used to\nincorrectly set the file to text-mode).  There is also a new *note\ngetbytes(): 10c5. method that returns a *note bytes: 295.\nrepresentation of a message corresponding to a given 'key'.\n\nIt is still possible to get non-binary output using the old API's *note\ngetstring(): 10c6. method, but that approach is not very useful.\nInstead, it is best to extract messages from a *note Message: 10c7.\nobject or to load them from binary input.\n\n(Contributed by R. David Murray, with efforts from Steffen Daode",
            "subsections": []
        },
        "Nurpmeso and an initial patch by Victor Stinner in bpo-9124(1).)": {
            "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=9124\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: turtledemo,  Prev: mailbox,  Up: New Improved and Deprecated Modules": {
            "content": "1.11.9.49 turtledemo\n....................\n\nThe demonstration code for the *note turtle: fc. module was moved from\nthe 'Demo' directory to main library.  It includes over a dozen sample\nscripts with lively displays.  Being on *note sys.path: 32c, it can now\nbe run directly from the command-line:\n\n$ python -m turtledemo\n\n(Moved from the Demo directory by Alexander Belopolsky in bpo-10199(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=10199\n\nFile: python3.12.info,  Node: Multi-threading,  Next: Optimizations<10>,  Prev: New Improved and Deprecated Modules,  Up: What's New In Python 3 2\n\n\n* The mechanism for serializing execution of concurrently running\nPython threads (generally known as the *note GIL: 6c0. or Global\nInterpreter Lock) has been rewritten.  Among the objectives were\nmore predictable switching intervals and reduced overhead due to\nlock contention and the number of ensuing system calls.  The notion\nof a \"check interval\" to allow thread switches has been abandoned\nand replaced by an absolute duration expressed in seconds.  This\nparameter is tunable through *note sys.setswitchinterval(): 76a.\nIt currently defaults to 5 milliseconds.\n\nAdditional details about the implementation can be read from a\npython-dev mailing-list message(1) (however, \"priority requests\" as\nexposed in this message have not been kept for inclusion).\n\n(Contributed by Antoine Pitrou.)\n\n* Regular and recursive locks now accept an optional 'timeout'\nargument to their *note acquire(): 464. method.  (Contributed by\nAntoine Pitrou; bpo-7316(2).)\n\n* Similarly, *note threading.Semaphore.acquire(): 10ca. also gained a\n'timeout' argument.  (Contributed by Torsten Landschoff;\nbpo-850728(3).)\n\n* Regular and recursive lock acquisitions can now be interrupted by\nsignals on platforms using Pthreads.  This means that Python\nprograms that deadlock while acquiring locks can be successfully\nkilled by repeatedly sending SIGINT to the process (by pressing\n'Ctrl+C' in most shells).  (Contributed by Reid Kleckner;\nbpo-8844(4).)\n\n---------- Footnotes ----------\n\n(1)\nhttps://mail.python.org/pipermail/python-dev/2009-October/093321.html\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=7316\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=850728\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=8844\n\nFile: python3.12.info,  Node: Optimizations<10>,  Next: Unicode,  Prev: Multi-threading,  Up: What's New In Python 3 2\n\n\nA number of small performance enhancements have been added:\n\n* Python's peephole optimizer now recognizes patterns such 'x in {1,\n2, 3}' as being a test for membership in a set of constants.  The\noptimizer recasts the *note set: 39d. as a *note frozenset: 39e.\nand stores the pre-built constant.\n\nNow that the speed penalty is gone, it is practical to start\nwriting membership tests using set-notation.  This style is both\nsemantically clear and operationally fast:\n\nextension = name.rpartition('.')[2]\nif extension in {'xml', 'html', 'xhtml', 'css'}:\nhandle(name)\n\n(Patch and additional tests contributed by Dave Malcolm;\nbpo-6690(1)).\n\n* Serializing and unserializing data using the *note pickle: a1.\nmodule is now several times faster.\n\n(Contributed by Alexandre Vassalotti, Antoine Pitrou and the\nUnladen Swallow team in bpo-9410(2) and bpo-3873(3).)\n\n* The Timsort algorithm(4) used in *note list.sort(): a13. and *note\nsorted(): a12. now runs faster and uses less memory when called\nwith a *note key function: c62.  Previously, every element of a\nlist was wrapped with a temporary object that remembered the key\nvalue associated with each element.  Now, two arrays of keys and\nvalues are sorted in parallel.  This saves the memory consumed by\nthe sort wrappers, and it saves time lost to delegating\ncomparisons.\n\n(Patch by Daniel Stutzbach in bpo-9915(5).)\n\n* JSON decoding performance is improved and memory consumption is\nreduced whenever the same string is repeated for multiple keys.\nAlso, JSON encoding now uses the C speedups when the 'sortkeys'\nargument is true.\n\n(Contributed by Antoine Pitrou in bpo-7451(6) and by Raymond\nHettinger and Antoine Pitrou in bpo-10314(7).)\n\n* Recursive locks (created with the *note threading.RLock(): 10cc.\nAPI) now benefit from a C implementation which makes them as fast\nas regular locks, and between 10x and 15x faster than their\nprevious pure Python implementation.\n\n(Contributed by Antoine Pitrou; bpo-3001(8).)\n\n* The fast-search algorithm in stringlib is now used by the *note\nsplit(): d0e, *note rsplit(): 10cd, *note splitlines(): 10ce. and\n*note replace(): 10cf. methods on *note bytes: 295, *note\nbytearray: 294. and *note str: 157. objects.  Likewise, the\nalgorithm is also used by *note rfind(): d0d, *note rindex(): 10d0,\n*note rsplit(): 10cd. and *note rpartition(): 10d1.\n\n(Patch by Florent Xicluna in bpo-7622(9) and bpo-7462(10).)\n\n* Integer to string conversions now work two \"digits\" at a time,\nreducing the number of division and modulo operations.\n\n(bpo-6713(11) by Gawain Bolton, Mark Dickinson, and Victor\nStinner.)\n",
            "subsections": []
        },
        "There were several other minor optimizations.  Set differencing now runs": {
            "content": "faster when one operand is much larger than the other (patch by Andress",
            "subsections": []
        },
        "Bennetts in bpo-8685(12)).  The 'array.repeat()' method has a faster": {
            "content": "implementation (bpo-1569291(13) by Alexander Belopolsky).  The *note",
            "subsections": []
        },
        "BaseHTTPRequestHandler: f3b. has more efficient buffering (bpo-3709(14)": {
            "content": "by Andrew Schaaf).  The *note operator.attrgetter(): c92. function has\nbeen sped-up (bpo-10160(15) by Christos Georgiou).  And *note",
            "subsections": []
        },
        "ConfigParser: 257. loads multi-line arguments a bit faster (bpo-7113(16)": {
            "content": "by ??ukasz Langa).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=6690\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=9410\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=3873\n\n(4) https://en.wikipedia.org/wiki/Timsort\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=9915\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=7451\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=10314\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=3001\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=7622\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=7462\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=6713\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=8685\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=1569291\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=3709\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=10160\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=7113\n\nFile: python3.12.info,  Node: Unicode,  Next: Codecs,  Prev: Optimizations<10>,  Up: What's New In Python 3 2\n\n",
            "subsections": []
        },
        "Python has been updated to Unicode 6.0.0(1).  The update to the standard": {
            "content": "adds over 2,000 new characters including emoji(2) symbols which are\nimportant for mobile phones.\n",
            "subsections": []
        },
        "In addition, the updated standard has altered the character properties": {
            "content": "for two Kannada characters (U+0CF1, U+0CF2) and one New Tai Lue numeric\ncharacter (U+19DA), making the former eligible for use in identifiers\nwhile disqualifying the latter.  For more information, see Unicode\nCharacter Database Changes(3).\n\n---------- Footnotes ----------\n\n(1) https://unicode.org/versions/Unicode6.0.0/\n\n(2) https://en.wikipedia.org/wiki/Emoji\n\n(3) https://www.unicode.org/versions/Unicode6.0.0/#DatabaseChanges\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Codecs,  Next: Documentation,  Prev: Unicode,  Up: What's New In Python 3 2": {
            "content": "Support was added for 'cp720' Arabic DOS encoding (bpo-1616979(1)).\n\nMBCS encoding no longer ignores the error handler argument.  In the\ndefault strict mode, it raises an *note UnicodeDecodeError: 83c. when it\nencounters an undecodable byte sequence and an *note UnicodeEncodeError:\n442. for an unencodable character.\n",
            "subsections": []
        },
        "The MBCS codec supports ''strict'' and ''ignore'' error handlers for": {
            "content": "decoding, and ''strict'' and ''replace'' for encoding.\n",
            "subsections": []
        },
        "To emulate Python3.1 MBCS encoding, select the ''ignore'' handler for": {
            "content": "decoding and the ''replace'' handler for encoding.\n",
            "subsections": []
        },
        "On Mac OS X, Python decodes command line arguments with ''utf-8'' rather": {
            "content": "than the locale encoding.\n\nBy default, *note tarfile: d8. uses ''utf-8'' encoding on Windows\n(instead of ''mbcs'') and the ''surrogateescape'' error handler on all\noperating systems.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=1616979\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Documentation,  Next: IDLE,  Prev: Codecs,  Up: What's New In Python 3 2": {
            "content": "The documentation continues to be improved.\n\n* A table of quick links has been added to the top of lengthy\nsections such as *note Built-in Functions: 10d5.  In the case of\n*note itertools: 7b, the links are accompanied by tables of\ncheatsheet-style summaries to provide an overview and memory jog\nwithout having to read all of the docs.\n\n* In some cases, the pure Python source code can be a helpful adjunct\nto the documentation, so now many modules now feature quick links\nto the latest version of the source code.  For example, the *note\nfunctools: 5a. module documentation has a quick link at the top\nlabeled:\n\n'Source code' Lib/functools.py(1).\n\n(Contributed by Raymond Hettinger; see rationale(2).)\n\n* The docs now contain more examples and recipes.  In particular,\n*note re: b4. module has an extensive section, *note Regular\nExpression Examples: 10d6.  Likewise, the *note itertools: 7b.\nmodule continues to be updated with new *note Itertools Recipes:\n10d7.\n\n* The *note datetime: 2e. module now has an auxiliary implementation\nin pure Python.  No functionality was changed.  This just provides\nan easier-to-read alternate implementation.\n\n(Contributed by Alexander Belopolsky in bpo-9528(3).)\n\n* The unmaintained 'Demo' directory has been removed.  Some demos\nwere integrated into the documentation, some were moved to the\n'Tools/demo' directory, and others were removed altogether.\n\n(Contributed by Georg Brandl in bpo-7962(4).)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/functools.py\n\n(2)\nhttps://rhettinger.wordpress.com/2011/01/28/open-your-source-more/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=9528\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=7962\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: IDLE,  Next: Code Repository,  Prev: Documentation,  Up: What's New In Python 3 2": {
            "content": "* The format menu now has an option to clean source files by\nstripping trailing whitespace.\n\n(Contributed by Raymond Hettinger; bpo-5150(1).)\n\n* IDLE on Mac OS X now works with both Carbon AquaTk and Cocoa\nAquaTk.\n\n(Contributed by Kevin Walzer, Ned Deily, and Ronald Oussoren;\nbpo-6075(2).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=5150\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=6075\n\nFile: python3.12.info,  Node: Code Repository,  Next: Build and C API Changes<5>,  Prev: IDLE,  Up: What's New In Python 3 2\n\n",
            "subsections": []
        },
        "In addition to the existing Subversion code repository at": {
            "content": "'https://svn.python.org' there is now a Mercurial(1) repository at\n'https://hg.python.org/'.\n",
            "subsections": []
        },
        "After the 3.2 release, there are plans to switch to Mercurial as the": {
            "content": "primary repository.  This distributed version control system should make\nit easier for members of the community to create and share external\nchangesets.  See PEP 385(2) for details.\n",
            "subsections": []
        },
        "To learn to use the new version control system, see the Quick Start(3)": {
            "content": "or the Guide to Mercurial Workflows(4).\n\n---------- Footnotes ----------\n\n(1) https://www.mercurial-scm.org/\n\n(2) https://peps.python.org/pep-0385/\n\n(3) https://www.mercurial-scm.org/wiki/QuickStart\n\n(4) https://www.mercurial-scm.org/guide\n\nFile: python3.12.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\n\n\nChanges to Python's build process and to the C API include:\n\n* The 'idle', 'pydoc' and '2to3' scripts are now installed with a\nversion-specific suffix on 'make altinstall' (bpo-10679(1)).\n\n* The C functions that access the Unicode Database now accept and\nreturn characters from the full Unicode range, even on narrow\nunicode builds (PyUNICODETOLOWER, PyUNICODEISDECIMAL, and\nothers).  A visible difference in Python is that *note\nunicodedata.numeric(): 10db. now returns the correct value for\nlarge code points, and *note repr(): 5f0. may consider more\ncharacters as printable.\n\n(Reported by Bupjoe Lee and fixed by Amaury Forgeot D'Arc;\nbpo-5127(2).)\n\n* Computed gotos are now enabled by default on supported compilers\n(which are detected by the configure script).  They can still be\ndisabled selectively by specifying '--without-computed-gotos'.\n\n(Contributed by Antoine Pitrou; bpo-9203(3).)\n\n* The option '--with-wctype-functions' was removed.  The built-in\nunicode database is now used for all functions.\n\n(Contributed by Amaury Forgeot D'Arc; bpo-9210(4).)\n\n* Hash values are now values of a new type, *note Pyhasht: 10dc,\nwhich is defined to be the same size as a pointer.  Previously they\nwere of type long, which on some 64-bit operating systems is still\nonly 32 bits long.  As a result of this fix, *note set: 39d. and\n*note dict: 237. can now hold more than '232' entries on builds\nwith 64-bit pointers (previously, they could grow to that size but\ntheir performance degraded catastrophically).\n\n(Suggested by Raymond Hettinger and implemented by Benjamin\nPeterson; bpo-9778(5).)\n\n* A new macro 'PyVACOPY' copies the state of the variable argument\nlist.  It is equivalent to C99 'vacopy' but available on all\nPython platforms (bpo-2443(6)).\n\n* A new C API function 'PySysSetArgvEx()' allows an embedded\ninterpreter to set *note sys.argv: 10dd. without also modifying\n*note sys.path: 32c. (bpo-5753(7)).\n\n* 'PyEvalCallObject()' is now only available in macro form.  The\nfunction declaration, which was kept for backwards compatibility\nreasons, is now removed - the macro was introduced in 1997\n(bpo-8276(8)).\n\n* There is a new function *note PyLongAsLongLongAndOverflow(): 10de.\nwhich is analogous to *note PyLongAsLongAndOverflow(): 10df.  They\nboth serve to convert Python *note int: 17e. into a native\nfixed-width type while providing detection of cases where the\nconversion won't fit (bpo-7767(9)).\n\n* The *note PyUnicodeCompareWithASCIIString(): 10e0. function now\nreturns 'not equal' if the Python string is 'NUL' terminated.\n\n* There is a new function *note PyErrNewExceptionWithDoc(): 10e1.\nthat is like *note PyErrNewException(): 10e2. but allows a\ndocstring to be specified.  This lets C exceptions have the same\nself-documenting capabilities as their pure Python counterparts\n(bpo-7033(10)).\n\n* When compiled with the '--with-valgrind' option, the pymalloc\nallocator will be automatically disabled when running under\nValgrind.  This gives improved memory leak detection when running\nunder Valgrind, while taking advantage of pymalloc at other times\n(bpo-2422(11)).\n\n* Removed the 'O?' format from the 'PyArgParse' functions.  The\nformat is no longer used and it had never been documented\n(bpo-8837(12)).\n",
            "subsections": []
        },
        "There were a number of other small changes to the C-API. See the": {
            "content": "Misc/NEWS(13) file for a complete list.\n",
            "subsections": []
        },
        "Also, there were a number of updates to the Mac OS X build, see": {
            "content": "",
            "subsections": []
        },
        "Mac/BuildScript/README.txt(14) for details.  For users running a": {
            "content": "32/64-bit build, there is a known problem with the default Tcl/Tk on Mac\nOS X 10.6.  Accordingly, we recommend installing an updated alternative\nsuch as ActiveState Tcl/Tk 8.5.9(15).  See\n'https://www.python.org/download/mac/tcltk/' for additional details.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=10679\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=5127\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=9203\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=9210\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=9778\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=2443\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=5753\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=8276\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=7767\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=7033\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=2422\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=8837\n\n(13) https://github.com/python/cpython/blob/v3.2.6/Misc/NEWS\n\n(14)\nhttps://github.com/python/cpython/blob/v3.2.6/Mac/BuildScript/README.txt\n\n(15)\nhttps://web.archive.org/web/20101208191259/https://www.activestate.com/activetcl/downloads\n\nFile: python3.12.info,  Node: Porting to Python 3 2,  Prev: Build and C API Changes<5>,  Up: What's New In Python 3 2\n\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": [
                {
                    "name": "1.12 What's New In Python 3.1",
                    "content": ""
                }
            ]
        },
        "File: python3.12.info,  Node: PEP 372 Ordered Dictionaries,  Next: PEP 378 Format Specifier for Thousands Separator,  Up: What's New In Python 3 1": {
            "content": "",
            "subsections": []
        },
        "Regular Python dictionaries iterate over key/value pairs in arbitrary": {
            "content": "order.  Over the years, a number of authors have written alternative\nimplementations that remember the order that the keys were originally\ninserted.  Based on the experiences from those implementations, 2.7\nintroduces a new *note OrderedDict: 39f. class in the *note collections:\n1b. module.\n\nThe *note OrderedDict: 39f. API provides the same interface as regular\ndictionaries but iterates over keys and values in a guaranteed order\ndepending on when a key was first inserted:\n\n>>> from collections import OrderedDict\n>>> d = OrderedDict([('first', 1),\n...                  ('second', 2),\n...                  ('third', 3)])\n>>> d.items()\n[('first', 1), ('second', 2), ('third', 3)]\n",
            "subsections": []
        },
        "The OrderedDict API is substantially the same as regular dictionaries": {
            "content": "but will iterate over keys and values in a guaranteed order depending on\nwhen a key was first inserted.  If a new entry overwrites an existing\nentry, the original insertion position is left unchanged.  Deleting an\nentry and reinserting it will move it to the end.\n",
            "subsections": []
        },
        "The standard library now supports use of ordered dictionaries in several": {
            "content": "modules.\n\n* The *note ConfigParser: 20. module uses them by default, meaning\nthat configuration files can now be read, modified, and then\nwritten back in their original order.\n\n* The *note asdict(): 807. method for *note\ncollections.namedtuple(): 711. now returns an ordered dictionary\nwith the values appearing in the same order as the underlying tuple\nindices.\n\n* The *note json: 7c. module's *note JSONDecoder: b9f. class\nconstructor was extended with an 'objectpairshook' parameter to\nallow 'OrderedDict' instances to be built by the decoder.  Support\nwas also added for third-party tools like PyYAML(1).\n\nSee also\n........\n\nPEP 372(2) - Adding an ordered dictionary to collections\n\nPEP written by Armin Ronacher and Raymond Hettinger; implemented by\nRaymond Hettinger.\n\n---------- Footnotes ----------\n\n(1) https://pyyaml.org/\n\n(2) https://peps.python.org/pep-0372/\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "Since an ordered dictionary remembers its insertion order, it can be": {
            "content": "used in conjunction with sorting to make a sorted dictionary:\n\n>>> # regular unsorted dictionary\n>>> d = {'banana': 3, 'apple':4, 'pear': 1, 'orange': 2}\n\n>>> # dictionary sorted by key\n>>> OrderedDict(sorted(d.items(), key=lambda t: t[0]))\nOrderedDict([('apple', 4), ('banana', 3), ('orange', 2), ('pear', 1)])\n\n>>> # dictionary sorted by value\n>>> OrderedDict(sorted(d.items(), key=lambda t: t[1]))\nOrderedDict([('pear', 1), ('orange', 2), ('banana', 3), ('apple', 4)])\n\n>>> # dictionary sorted by length of the key string\n>>> OrderedDict(sorted(d.items(), key=lambda t: len(t[0])))\nOrderedDict([('pear', 1), ('apple', 4), ('orange', 2), ('banana', 3)])\n",
            "subsections": []
        },
        "The new sorted dictionaries maintain their sort order when entries are": {
            "content": "deleted.  But when new keys are added, the keys are appended to the end\nand the sort is not maintained.\n\n---------- Footnotes ----------\n\n(1) https://pyyaml.org/\n\n(2) https://peps.python.org/pep-0372/\n\nFile: python3.12.info,  Node: PEP 378 Format Specifier for Thousands Separator,  Next: Other Language Changes<12>,  Prev: PEP 372 Ordered Dictionaries,  Up: What's New In Python 3 1\n\n\nThe built-in *note format(): 3eb. function and the *note str.format():\n3ed. method use a mini-language that now includes a simple, non-locale\naware way to format a number with a thousands separator.  That provides\na way to humanize a program's output, improving its professional\nappearance and readability:\n\n>>> format(1234567, ',d')\n'1,234,567'\n>>> format(1234567.89, ',.2f')\n'1,234,567.89'\n>>> format(12345.6 + 8901234.12j, ',f')\n'12,345.600000+8,901,234.120000j'\n>>> format(Decimal('1234567.89'), ',f')\n'1,234,567.89'\n\nThe supported types are *note int: 17e, *note float: 4b7, *note complex:\n3ad. and *note decimal.Decimal: 5c3.\n",
            "subsections": []
        },
        "Discussions are underway about how to specify alternative separators": {
            "content": "like dots, spaces, apostrophes, or underscores.  Locale-aware\napplications should use the existing 'n' format specifier which already\nhas some support for thousands separators.\n\nSee also\n........\n\nPEP 378(1) - Format Specifier for Thousands Separator\n\nPEP written by Raymond Hettinger and implemented by Eric Smith and\nMark Dickinson.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0378/\n\nFile: python3.12.info,  Node: Other Language Changes<12>,  Next: New Improved and Deprecated Modules<2>,  Prev: PEP 378 Format Specifier for Thousands Separator,  Up: What's New In Python 3 1\n\n\nSome smaller changes made to the core Python language are:\n\n* Directories and zip archives containing a 'main.py' file can\nnow be executed directly by passing their name to the interpreter.\nThe directory/zipfile is automatically inserted as the first entry\nin sys.path.  (Suggestion and initial patch by Andy Chu; revised\npatch by Phillip J. Eby and Nick Coghlan; bpo-1739468(1).)\n\n* The *note int(): 17e. type gained a 'bitlength' method that\nreturns the number of bits necessary to represent its argument in\nbinary:\n\n>>> n = 37\n>>> bin(37)\n'0b100101'\n>>> n.bitlength()\n6\n>>> n = 2123-1\n>>> n.bitlength()\n123\n>>> (n+1).bitlength()\n124\n\n(Contributed by Fredrik Johansson, Victor Stinner, Raymond\nHettinger, and Mark Dickinson; bpo-3439(2).)\n\n* The fields in *note format(): 3eb. strings can now be automatically\nnumbered:\n\n>>> 'Sir {} of {}'.format('Gallahad', 'Camelot')\n'Sir Gallahad of Camelot'\n\nFormerly, the string would have required numbered fields such as:\n''Sir {0} of {1}''.\n\n(Contributed by Eric Smith; bpo-5237(3).)\n\n* The 'string.maketrans()' function is deprecated and is replaced by\nnew static methods, *note bytes.maketrans(): 10ed. and *note\nbytearray.maketrans(): 10ee.  This change solves the confusion\naround which types were supported by the *note string: cd. module.\nNow, *note str: 157, *note bytes: 295, and *note bytearray: 294.\neach have their own 'maketrans' and 'translate' methods with\nintermediate translation tables of the appropriate type.\n\n(Contributed by Georg Brandl; bpo-5675(4).)\n\n* The syntax of the *note with: 396. statement now allows multiple\ncontext managers in a single statement:\n\n>>> with open('mylog.txt') as infile, open('a.out', 'w') as outfile:\n...     for line in infile:\n...         if '<critical>' in line:\n...             outfile.write(line)\n\nWith the new syntax, the 'contextlib.nested()' function is no\nlonger needed and is now deprecated.\n\n(Contributed by Georg Brandl and Mattias Bra\"ndstro\"m; appspot issue\n53094(5).)\n\n* 'round(x, n)' now returns an integer if 'x' is an integer.\nPreviously it returned a float:\n\n>>> round(1123, -2)\n1100\n\n(Contributed by Mark Dickinson; bpo-4707(6).)\n\n* Python now uses David Gay's algorithm for finding the shortest\nfloating point representation that doesn't change its value.  This\nshould help mitigate some of the confusion surrounding binary\nfloating point numbers.\n\nThe significance is easily seen with a number like '1.1' which does\nnot have an exact equivalent in binary floating point.  Since there\nis no exact equivalent, an expression like 'float('1.1')' evaluates\nto the nearest representable value which is '0x1.199999999999ap+0'\nin hex or '1.100000000000000088817841970012523233890533447265625'\nin decimal.  That nearest value was and still is used in subsequent\nfloating point calculations.\n\nWhat is new is how the number gets displayed.  Formerly, Python\nused a simple approach.  The value of 'repr(1.1)' was computed as\n'format(1.1, '.17g')' which evaluated to ''1.1000000000000001''.\nThe advantage of using 17 digits was that it relied on IEEE-754\nguarantees to assure that 'eval(repr(1.1))' would round-trip\nexactly to its original value.  The disadvantage is that many\npeople found the output to be confusing (mistaking intrinsic\nlimitations of binary floating point representation as being a\nproblem with Python itself).\n\nThe new algorithm for 'repr(1.1)' is smarter and returns ''1.1''.\nEffectively, it searches all equivalent string representations\n(ones that get stored with the same underlying float value) and\nreturns the shortest representation.\n\nThe new algorithm tends to emit cleaner representations when\npossible, but it does not change the underlying values.  So, it is\nstill the case that '1.1 + 2.2 != 3.3' even though the\nrepresentations may suggest otherwise.\n\nThe new algorithm depends on certain features in the underlying\nfloating point implementation.  If the required features are not\nfound, the old algorithm will continue to be used.  Also, the text\npickle protocols assure cross-platform portability by using the old\nalgorithm.\n\n(Contributed by Eric Smith and Mark Dickinson; bpo-1580(7))\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=1739468\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=3439\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=5237\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=5675\n\n(5) https://codereview.appspot.com/53094\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=4707\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=1580\n\nFile: python3.12.info,  Node: New Improved and Deprecated Modules<2>,  Next: Optimizations<11>,  Prev: Other Language Changes<12>,  Up: What's New In Python 3 1\n\n\n* Added a *note collections.Counter: f09. class to support convenient\ncounting of unique items in a sequence or iterable:\n\n>>> Counter(['red', 'blue', 'red', 'green', 'blue', 'blue'])\nCounter({'blue': 3, 'red': 2, 'green': 1})\n\n(Contributed by Raymond Hettinger; bpo-1696199(1).)\n\n* Added a new module, *note tkinter.ttk: f4. for access to the Tk\nthemed widget set.  The basic idea of ttk is to separate, to the\nextent possible, the code implementing a widget's behavior from the\ncode implementing its appearance.\n\n(Contributed by Guilherme Polo; bpo-2983(2).)\n\n* The *note gzip.GzipFile: 25e. and *note bz2.BZ2File: 775. classes\nnow support the context management protocol:\n\n>>> # Automatically close file after writing\n>>> with gzip.GzipFile(filename, \"wb\") as f:\n...     f.write(b\"xxx\")\n\n(Contributed by Antoine Pitrou.)\n\n* The *note decimal: 33. module now supports methods for creating a\ndecimal object from a binary *note float: 4b7.  The conversion is\nexact but can sometimes be surprising:\n\n>>> Decimal.fromfloat(1.1)\nDecimal('1.100000000000000088817841970012523233890533447265625')\n\nThe long decimal result shows the actual binary fraction being\nstored for '1.1'.  The fraction has many digits because '1.1'\ncannot be exactly represented in binary.\n\n(Contributed by Raymond Hettinger and Mark Dickinson.)\n\n* The *note itertools: 7b. module grew two new functions.  The *note\nitertools.combinationswithreplacement(): 10fa. function is one of\nfour for generating combinatorics including permutations and\nCartesian products.  The *note itertools.compress(): 10fb. function\nmimics its namesake from APL. Also, the existing *note\nitertools.count(): 10fc. function now has an optional 'step'\nargument and can accept any type of counting sequence including\n*note fractions.Fraction: 1a8. and *note decimal.Decimal: 5c3.:\n\n>>> [p+q for p,q in combinationswithreplacement('LOVE', 2)]\n['LL', 'LO', 'LV', 'LE', 'OO', 'OV', 'OE', 'VV', 'VE', 'EE']\n\n>>> list(compress(data=range(10), selectors=[0,0,1,1,0,1,0,1,0,0]))\n[2, 3, 5, 7]\n\n>>> c = count(start=Fraction(1,2), step=Fraction(1,6))\n>>> [next(c), next(c), next(c), next(c)]\n[Fraction(1, 2), Fraction(2, 3), Fraction(5, 6), Fraction(1, 1)]\n\n(Contributed by Raymond Hettinger.)\n\n* *note collections.namedtuple(): 711. now supports a keyword\nargument 'rename' which lets invalid fieldnames be automatically\nconverted to positional names in the form 0, 1, etc.  This is\nuseful when the field names are being created by an external source\nsuch as a CSV header, SQL field list, or user input:\n\n>>> query = input()\nSELECT region, dept, count(*) FROM main GROUPBY region, dept\n\n>>> cursor.execute(query)\n>>> queryfields = [desc[0] for desc in cursor.description]\n>>> UserQuery = namedtuple('UserQuery', queryfields, rename=True)\n>>> pprint.pprint([UserQuery(*row) for row in cursor])\n[UserQuery(region='South', dept='Shipping', 2=185),\nUserQuery(region='North', dept='Accounting', 2=37),\nUserQuery(region='West', dept='Sales', 2=419)]\n\n(Contributed by Raymond Hettinger; bpo-1818(3).)\n\n* The *note re.sub(): 1ff, *note re.subn(): 200. and *note\nre.split(): 9ae. functions now accept a flags parameter.\n\n(Contributed by Gregory Smith.)\n\n* The *note logging: 82. module now implements a simple *note\nlogging.NullHandler: 10fd. class for applications that are not\nusing logging but are calling library code that does.  Setting-up a\nnull handler will suppress spurious warnings such as \"No handlers\ncould be found for logger foo\":\n\n>>> h = logging.NullHandler()\n>>> logging.getLogger(\"foo\").addHandler(h)\n\n(Contributed by Vinay Sajip; bpo-4384(4)).\n\n* The *note runpy: b9. module which supports the '-m' command line\nswitch now supports the execution of packages by looking for and\nexecuting a 'main' submodule when a package name is supplied.\n\n(Contributed by Andi Vajda; bpo-4195(5).)\n\n* The *note pdb: a0. module can now access and display source code\nloaded via *note zipimport: 12c. (or any other conformant PEP\n302(6) loader).\n\n(Contributed by Alexander Belopolsky; bpo-4201(7).)\n\n* *note functools.partial: d31. objects can now be pickled.\n\n(Suggested by Antoine Pitrou and Jesse Noller.  Implemented by Jack\nDiederich; bpo-5228(8).)\n\n* Add *note pydoc: b0. help topics for symbols so that 'help('@')'\nworks as expected in the interactive environment.\n\n(Contributed by David Laban; bpo-4739(9).)\n\n* The *note unittest: 101. module now supports skipping individual\ntests or classes of tests.  And it supports marking a test as an\nexpected failure, a test that is known to be broken, but shouldn't\nbe counted as a failure on a TestResult:\n\nclass TestGizmo(unittest.TestCase):\n\n@unittest.skipUnless(sys.platform.startswith(\"win\"), \"requires Windows\")\ndef testgizmoonwindows(self):\n...\n\n@unittest.expectedFailure\ndef testgimzowithoutrequiredlibrary(self):\n...\n\nAlso, tests for exceptions have been builtout to work with context\nmanagers using the *note with: 396. statement:\n\ndef testdivisionbyzero(self):\nwith self.assertRaises(ZeroDivisionError):\nx / 0\n\nIn addition, several new assertion methods were added including\n*note assertSetEqual(): 10fe, *note assertDictEqual(): 10ff,\n'assertDictContainsSubset()', *note assertListEqual(): 1100, *note\nassertTupleEqual(): 1101, *note assertSequenceEqual(): 1102, *note\nassertRaisesRegexp(): 283, *note assertIsNone(): 1103, and *note\nassertIsNotNone(): 1104.\n\n(Contributed by Benjamin Peterson and Antoine Pitrou.)\n\n* The *note io: 79. module has three new constants for the *note\nseek(): 1105. method: *note SEEKSET: 1106, *note SEEKCUR: 1107,\nand *note SEEKEND: 1108.\n\n* The *note sys.versioninfo: 46c. tuple is now a named tuple:\n\n>>> sys.versioninfo\nsys.versioninfo(major=3, minor=1, micro=0, releaselevel='alpha', serial=2)\n\n(Contributed by Ross Light; bpo-4285(10).)\n\n* The *note nntplib: 98. and *note imaplib: 6f. modules now support\nIPv6.\n\n(Contributed by Derek Morr; bpo-1655(11) and bpo-1664(12).)\n\n* The *note pickle: a1. module has been adapted for better\ninteroperability with Python 2.x when used with protocol 2 or\nlower.  The reorganization of the standard library changed the\nformal reference for many objects.  For example, 'builtin.set'\nin Python 2 is called 'builtins.set' in Python 3.  This change\nconfounded efforts to share data between different versions of\nPython.  But now when protocol 2 or lower is selected, the pickler\nwill automatically use the old Python 2 names for both loading and\ndumping.  This remapping is turned-on by default but can be\ndisabled with the 'fiximports' option:\n\n>>> s = {1, 2, 3}\n>>> pickle.dumps(s, protocol=0)\nb'cbuiltin\\nset\\np0\\n((lp1\\nL1L\\naL2L\\naL3L\\natp2\\nRp3\\n.'\n>>> pickle.dumps(s, protocol=0, fiximports=False)\nb'cbuiltins\\nset\\np0\\n((lp1\\nL1L\\naL2L\\naL3L\\natp2\\nRp3\\n.'\n\nAn unfortunate but unavoidable side-effect of this change is that\nprotocol 2 pickles produced by Python 3.1 won't be readable with\nPython 3.0.  The latest pickle protocol, protocol 3, should be used\nwhen migrating data between Python 3.x implementations, as it\ndoesn't attempt to remain compatible with Python 2.x.\n\n(Contributed by Alexandre Vassalotti and Antoine Pitrou,\nbpo-6137(13).)\n\n* A new module, *note importlib: 71. was added.  It provides a\ncomplete, portable, pure Python reference implementation of the\n*note import: 3a6. statement and its counterpart, the *note\nimport(): 6ed. function.  It represents a substantial step\nforward in documenting and defining the actions that take place\nduring imports.\n\n(Contributed by Brett Cannon.)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=1696199\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=2983\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=1818\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=4384\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=4195\n\n(6) https://peps.python.org/pep-0302/\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=4201\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=5228\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=4739\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=4285\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=1655\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=1664\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=6137\n\nFile: python3.12.info,  Node: Optimizations<11>,  Next: IDLE<2>,  Prev: New Improved and Deprecated Modules<2>,  Up: What's New In Python 3 1\n\n\nMajor performance enhancements have been added:\n\n* The new I/O library (as defined in PEP 3116(1)) was mostly written\nin Python and quickly proved to be a problematic bottleneck in\nPython 3.0.  In Python 3.1, the I/O library has been entirely\nrewritten in C and is 2 to 20 times faster depending on the task at\nhand.  The pure Python version is still available for\nexperimentation purposes through the 'pyio' module.\n\n(Contributed by Amaury Forgeot d'Arc and Antoine Pitrou.)\n\n* Added a heuristic so that tuples and dicts containing only\nuntrackable objects are not tracked by the garbage collector.  This\ncan reduce the size of collections and therefore the garbage\ncollection overhead on long-running programs, depending on their\nparticular use of datatypes.\n\n(Contributed by Antoine Pitrou, bpo-4688(2).)\n\n* Enabling a configure option named '--with-computed-gotos' on\ncompilers that support it (notably: gcc, SunPro, icc), the bytecode\nevaluation loop is compiled with a new dispatch mechanism which\ngives speedups of up to 20%, depending on the system, the compiler,\nand the benchmark.\n\n(Contributed by Antoine Pitrou along with a number of other\nparticipants, bpo-4753(3)).\n\n* The decoding of UTF-8, UTF-16 and LATIN-1 is now two to four times\nfaster.\n\n(Contributed by Antoine Pitrou and Amaury Forgeot d'Arc,\nbpo-4868(4).)\n\n* The *note json: 7c. module now has a C extension to substantially\nimprove its performance.  In addition, the API was modified so that\njson works only with *note str: 157, not with *note bytes: 295.\nThat change makes the module closely match the JSON\nspecification(5) which is defined in terms of Unicode.\n\n(Contributed by Bob Ippolito and converted to Py3.1 by Antoine\nPitrou and Benjamin Peterson; bpo-4136(6).)\n\n* Unpickling now interns the attribute names of pickled objects.\nThis saves memory and allows pickles to be smaller.\n\n(Contributed by Jake McGuire and Antoine Pitrou; bpo-5084(7).)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3116/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=4688\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=4753\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=4868\n\n(5) https://json.org/\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=4136\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=5084\n\nFile: python3.12.info,  Node: IDLE<2>,  Next: Build and C API Changes<6>,  Prev: Optimizations<11>,  Up: What's New In Python 3 1\n\n\n* IDLE's format menu now provides an option to strip trailing\nwhitespace from a source file.\n\n(Contributed by Roger D. Serwy; bpo-5150(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=5150\n\nFile: python3.12.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\n\n\nChanges to Python's build process and to the C API include:\n\n* Integers are now stored internally either in base '215' or in\nbase '230', the base being determined at build time.  Previously,\nthey were always stored in base '215'.  Using base '230' gives\nsignificant performance improvements on 64-bit machines, but\nbenchmark results on 32-bit machines have been mixed.  Therefore,\nthe default is to use base '230' on 64-bit machines and base\n'215' on 32-bit machines; on Unix, there's a new configure option\n'--enable-big-digits' that can be used to override this default.\n\nApart from the performance improvements this change should be\ninvisible to end users, with one exception: for testing and\ndebugging purposes there's a new *note sys.intinfo: 110c. that\nprovides information about the internal format, giving the number\nof bits per digit and the size in bytes of the C type used to store\neach digit:\n\n>>> import sys\n>>> sys.intinfo\nsys.intinfo(bitsperdigit=30, sizeofdigit=4)\n\n(Contributed by Mark Dickinson; bpo-4258(1).)\n\n* The *note PyLongAsUnsignedLongLong(): 110d. function now handles a\nnegative 'pylong' by raising *note OverflowError: 68d. instead of\n*note TypeError: 28e.\n\n(Contributed by Mark Dickinson and Lisandro Dalcrin; bpo-5175(2).)\n\n* Deprecated 'PyNumberInt()'.  Use *note PyNumberLong(): 895.\ninstead.\n\n(Contributed by Mark Dickinson; bpo-4910(3).)\n\n* Added a new *note PyOSstringtodouble(): 110e. function to\nreplace the deprecated functions 'PyOSasciistrtod()' and\n'PyOSasciiatof()'.\n\n(Contributed by Mark Dickinson; bpo-5914(4).)\n\n* Added *note PyCapsule: 10eb. as a replacement for the 'PyCObject'\nAPI. The principal difference is that the new type has a well\ndefined interface for passing typing safety information and a less\ncomplicated signature for calling a destructor.  The old type had a\nproblematic API and is now deprecated.\n\n(Contributed by Larry Hastings; bpo-5630(5).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=4258\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=5175\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=4910\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=5914\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=5630\n\nFile: python3.12.info,  Node: Porting to Python 3 1,  Prev: Build and C API Changes<6>,  Up: What's New In Python 3 1\n\n",
            "subsections": []
        },
        "2.718281828459045": {
            "content": "* The automatic name remapping in the pickle module for protocol 2 or\nlower can make Python 3.1 pickles unreadable in Python 3.0.  One\nsolution is to use protocol 3.  Another solution is to set the\n'fiximports' option to 'False'.  See the discussion above for more\ndetails.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": [
                {
                    "name": "1.13 What's New In Python 3.0",
                    "content": ""
                }
            ]
        },
        "Author: Guido van Rossum": {
            "content": "This article explains the new features in Python 3.0, compared to 2.6.\nPython 3.0, also known as \"Python 3000\" or \"Py3K\", is the first ever\n'intentionally backwards incompatible' Python release.  Python 3.0 was\nreleased on December 3, 2008.  There are more changes than in a typical\nrelease, and more that are important for all Python users.",
            "subsections": []
        },
        "Nevertheless, after digesting the changes, you'll find that Python": {
            "content": "really hasn't changed all that much - by and large, we're mostly fixing\nwell-known annoyances and warts, and removing a lot of old cruft.\n",
            "subsections": []
        },
        "Due to time constraints this document is not as complete as it should": {
            "content": "have been.  As always for a new release, the 'Misc/NEWS' file in the\nsource distribution contains a wealth of detailed information about\nevery small thing that was changed.\n\n* Menu:\n\n* Common Stumbling Blocks::\n* Overview Of Syntax Changes::\n* Changes Already Present In Python 2.6: Changes Already Present In Python 2 6.\n* Library Changes::\n* PEP 3101; A New Approach To String Formatting: PEP 3101 A New Approach To String Formatting.\n* Changes To Exceptions::\n* Miscellaneous Other Changes::\n* Build and C API Changes: Build and C API Changes<7>.\n* Performance::\n* Porting To Python 3.0: Porting To Python 3 0.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Common Stumbling Blocks,  Next: Overview Of Syntax Changes,  Up: What's New In Python 3 0": {
            "content": "",
            "subsections": []
        },
        "This section lists those few changes that are most likely to trip you up": {
            "content": "if you're used to Python 2.5.\n\n* Menu:\n\n* Print Is A Function::\n* Views And Iterators Instead Of Lists::\n* Ordering Comparisons::\n* Integers::\n* Text Vs. Data Instead Of Unicode Vs. 8-bit: Text Vs Data Instead Of Unicode Vs 8-bit.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Print Is A Function,  Next: Views And Iterators Instead Of Lists,  Up: Common Stumbling Blocks": {
            "content": "1.13.1.1 Print Is A Function\n............................\n\nThe 'print' statement has been replaced with a *note print(): de5.\nfunction, with keyword arguments to replace most of the special syntax\nof the old 'print' statement ( PEP 3105(1)).  Examples:\n\nOld: print \"The answer is\", 2*2\nNew: print(\"The answer is\", 2*2)\n\nOld: print x,           # Trailing comma suppresses newline\nNew: print(x, end=\" \")  # Appends a space instead of a newline\n\nOld: print              # Prints a newline\nNew: print()            # You must call the function!\n\nOld: print >>sys.stderr, \"fatal error\"\nNew: print(\"fatal error\", file=sys.stderr)\n\nOld: print (x, y)       # prints repr((x, y))\nNew: print((x, y))      # Not the same as print(x, y)!\n\nYou can also customize the separator between items, e.g.:\n\nprint(\"There are <\", 232, \"> possibilities!\", sep=\"\")\n\nwhich produces:\n\nThere are <4294967296> possibilities!\n\nNote:\n\n* The *note print(): de5. function doesn't support the \"softspace\"\nfeature of the old 'print' statement.  For example, in Python 2.x,\n'print \"A\\n\", \"B\"' would write '\"A\\nB\\n\"'; but in Python 3.0,\n'print(\"A\\n\", \"B\")' writes '\"A\\n B\\n\"'.\n\n* Initially, you'll be finding yourself typing the old 'print x' a\nlot in interactive mode.  Time to retrain your fingers to type\n'print(x)' instead!\n\n* When using the '2to3' source-to-source conversion tool, all 'print'\nstatements are automatically converted to *note print(): de5.\nfunction calls, so this is mostly a non-issue for larger projects.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3105/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Views And Iterators Instead Of Lists,  Next: Ordering Comparisons,  Prev: Print Is A Function,  Up: Common Stumbling Blocks": {
            "content": "1.13.1.2 Views And Iterators Instead Of Lists\n.............................................\n\nSome well-known APIs no longer return lists:\n\n* *note dict: 237. methods *note dict.keys(): 5bf, *note\ndict.items(): 5c1. and *note dict.values(): 5c0. return \"views\"\ninstead of lists.  For example, this no longer works: 'k =\nd.keys(); k.sort()'.  Use 'k = sorted(d)' instead (this works in\nPython 2.5 too and is just as efficient).\n\n* Also, the 'dict.iterkeys()', 'dict.iteritems()' and\n'dict.itervalues()' methods are no longer supported.\n\n* *note map(): 65f. and *note filter(): 660. return iterators.  If\nyou really need a list and the input sequences are all of equal\nlength, a quick fix is to wrap *note map(): 65f. in *note list():\n3dc, e.g.  'list(map(...))', but a better fix is often to use a\nlist comprehension (especially when the original code uses *note\nlambda: 1115.), or rewriting the code so it doesn't need a list at\nall.  Particularly tricky is *note map(): 65f. invoked for the side\neffects of the function; the correct transformation is to use a\nregular *note for: 24e. loop (since creating a list would just be\nwasteful).\n\nIf the input sequences are not of equal length, *note map(): 65f.\nwill stop at the termination of the shortest of the sequences.  For\nfull compatibility with *note map(): 65f. from Python 2.x, also\nwrap the sequences in *note itertools.ziplongest(): 1116, e.g.\n'map(func, *sequences)' becomes 'list(map(func,\nitertools.ziplongest(*sequences)))'.\n\n* *note range(): 761. now behaves like 'xrange()' used to behave,\nexcept it works with values of arbitrary size.  The latter no\nlonger exists.\n\n* *note zip(): 5c2. now returns an iterator.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Ordering Comparisons,  Next: Integers,  Prev: Views And Iterators Instead Of Lists,  Up: Common Stumbling Blocks": {
            "content": "1.13.1.3 Ordering Comparisons\n.............................\n\nPython 3.0 has simplified the rules for ordering comparisons:\n\n* The ordering comparison operators ('<', '<=', '>=', '>') raise a\nTypeError exception when the operands don't have a meaningful\nnatural ordering.  Thus, expressions like '1 < ''', '0 > None' or\n'len <= len' are no longer valid, and e.g.  'None < None' raises\n*note TypeError: 28e. instead of returning 'False'.  A corollary is\nthat sorting a heterogeneous list no longer makes sense - all the\nelements must be comparable to each other.  Note that this does not\napply to the '==' and '!=' operators: objects of different\nincomparable types always compare unequal to each other.\n\n* 'builtin.sorted()' and *note list.sort(): a13. no longer accept the\n'cmp' argument providing a comparison function.  Use the 'key'\nargument instead.  N.B. the 'key' and 'reverse' arguments are now\n\"keyword-only\".\n\n* The 'cmp()' function should be treated as gone, and the 'cmp()'\nspecial method is no longer supported.  Use 'lt()' for sorting,\n'eq()' with 'hash()', and other rich comparisons as needed.\n(If you really need the 'cmp()' functionality, you could use the\nexpression '(a > b) - (a < b)' as the equivalent for 'cmp(a, b)'.)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Integers,  Next: Text Vs Data Instead Of Unicode Vs 8-bit,  Prev: Ordering Comparisons,  Up: Common Stumbling Blocks": {
            "content": "1.13.1.4 Integers\n.................\n\n* PEP 237(1): Essentially, 'long' renamed to *note int: 17e.  That\nis, there is only one built-in integral type, named *note int:\n17e.; but it behaves mostly like the old 'long' type.\n\n* PEP 238(2): An expression like '1/2' returns a float.  Use '1//2'\nto get the truncating behavior.  (The latter syntax has existed for\nyears, at least since Python 2.2.)\n\n* The 'sys.maxint' constant was removed, since there is no longer a\nlimit to the value of integers.  However, *note sys.maxsize: 1039.\ncan be used as an integer larger than any practical list or string\nindex.  It conforms to the implementation's \"natural\" integer size\nand is typically the same as 'sys.maxint' in previous releases on\nthe same platform (assuming the same build options).\n\n* The *note repr(): 5f0. of a long integer doesn't include the\ntrailing 'L' anymore, so code that unconditionally strips that\ncharacter will chop off the last digit instead.  (Use *note str():\n157. instead.)\n\n* Octal literals are no longer of the form '0720'; use '0o720'\ninstead.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0237/\n\n(2) https://peps.python.org/pep-0238/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Text Vs Data Instead Of Unicode Vs 8-bit,  Prev: Integers,  Up: Common Stumbling Blocks": {
            "content": "1.13.1.5 Text Vs. Data Instead Of Unicode Vs. 8-bit\n...................................................\n",
            "subsections": []
        },
        "Everything you thought you knew about binary data and Unicode has": {
            "content": "changed.\n\n* Python 3.0 uses the concepts of 'text' and (binary) 'data' instead\nof Unicode strings and 8-bit strings.  All text is Unicode; however\n'encoded' Unicode is represented as binary data.  The type used to\nhold text is *note str: 157, the type used to hold data is *note\nbytes: 295.  The biggest difference with the 2.x situation is that\nany attempt to mix text and data in Python 3.0 raises *note\nTypeError: 28e, whereas if you were to mix Unicode and 8-bit\nstrings in Python 2.x, it would work if the 8-bit string happened\nto contain only 7-bit (ASCII) bytes, but you would get *note\nUnicodeDecodeError: 83c. if it contained non-ASCII values.  This\nvalue-specific behavior has caused numerous sad faces over the\nyears.\n\n* As a consequence of this change in philosophy, pretty much all code\nthat uses Unicode, encodings or binary data most likely has to\nchange.  The change is for the better, as in the 2.x world there\nwere numerous bugs having to do with mixing encoded and unencoded\ntext.  To be prepared in Python 2.x, start using 'unicode' for all\nunencoded text, and *note str: 157. for binary or encoded data\nonly.  Then the '2to3' tool will do most of the work for you.\n\n* You can no longer use 'u\"...\"' literals for Unicode text.  However,\nyou must use 'b\"...\"' literals for binary data.\n\n* As the *note str: 157. and *note bytes: 295. types cannot be mixed,\nyou must always explicitly convert between them.  Use *note\nstr.encode(): 6ee. to go from *note str: 157. to *note bytes: 295,\nand *note bytes.decode(): 6ef. to go from *note bytes: 295. to\n*note str: 157.  You can also use 'bytes(s, encoding=...)' and\n'str(b, encoding=...)', respectively.\n\n* Like *note str: 157, the *note bytes: 295. type is immutable.\nThere is a separate 'mutable' type to hold buffered binary data,\n*note bytearray: 294.  Nearly all APIs that accept *note bytes:\n295. also accept *note bytearray: 294.  The mutable API is based on\n'collections.MutableSequence'.\n\n* All backslashes in raw string literals are interpreted literally.\nThis means that ''\\U'' and ''\\u'' escapes in raw strings are not\ntreated specially.  For example, 'r'\\u20ac'' is a string of 6\ncharacters in Python 3.0, whereas in 2.6, 'ur'\\u20ac'' was the\nsingle \"euro\" character.  (Of course, this change only affects raw\nstring literals; the euro character is ''\\u20ac'' in Python 3.0.)\n\n* The built-in 'basestring' abstract type was removed.  Use *note\nstr: 157. instead.  The *note str: 157. and *note bytes: 295. types\ndon't have functionality enough in common to warrant a shared base\nclass.  The '2to3' tool (see below) replaces every occurrence of\n'basestring' with *note str: 157.\n\n* Files opened as text files (still the default mode for *note\nopen(): 26e.) always use an encoding to map between strings (in\nmemory) and bytes (on disk).  Binary files (opened with a 'b' in\nthe mode argument) always use bytes in memory.  This means that if\na file is opened using an incorrect mode or encoding, I/O will\nlikely fail loudly, instead of silently producing incorrect data.\nIt also means that even Unix users will have to specify the correct\nmode (text or binary) when opening a file.  There is a\nplatform-dependent default encoding, which on Unixy platforms can\nbe set with the 'LANG' environment variable (and sometimes also\nwith some other platform-specific locale-related environment\nvariables).  In many cases, but not all, the system default is\nUTF-8; you should never count on this default.  Any application\nreading or writing more than pure ASCII text should probably have a\nway to override the encoding.  There is no longer any need for\nusing the encoding-aware streams in the *note codecs: 19. module.\n\n* The initial values of *note sys.stdin: 293, *note sys.stdout: 90c.\nand *note sys.stderr: 757. are now unicode-only text files (i.e.,\nthey are instances of *note io.TextIOBase: 461.).  To read and\nwrite bytes data with these streams, you need to use their *note\nio.TextIOBase.buffer: 111a. attribute.\n\n* Filenames are passed to and returned from APIs as (Unicode)\nstrings.  This can present platform-specific problems because on\nsome platforms filenames are arbitrary byte strings.  (On the other\nhand, on Windows filenames are natively stored as Unicode.)  As a\nwork-around, most APIs (e.g.  *note open(): 26e. and many functions\nin the *note os: 9c. module) that take filenames accept *note\nbytes: 295. objects as well as strings, and a few APIs have a way\nto ask for a *note bytes: 295. return value.  Thus, *note\nos.listdir(): f6a. returns a list of *note bytes: 295. instances if\nthe argument is a *note bytes: 295. instance, and *note\nos.getcwdb(): 8c2. returns the current working directory as a *note\nbytes: 295. instance.  Note that when *note os.listdir(): f6a.\nreturns a list of strings, filenames that cannot be decoded\nproperly are omitted rather than raising *note UnicodeError: 111b.\n\n* Some system APIs like *note os.environ: 102e. and *note sys.argv:\n10dd. can also present problems when the bytes made available by\nthe system is not interpretable using the default encoding.\nSetting the 'LANG' variable and rerunning the program is probably\nthe best approach.\n\n* PEP 3138(1): The *note repr(): 5f0. of a string no longer escapes\nnon-ASCII characters.  It still escapes control characters and code\npoints with non-printable status in the Unicode standard, however.\n\n* PEP 3120(2): The default source encoding is now UTF-8.\n\n* PEP 3131(3): Non-ASCII letters are now allowed in identifiers.\n(However, the standard library remains ASCII-only with the\nexception of contributor names in comments.)\n\n* The 'StringIO' and 'cStringIO' modules are gone.  Instead, import\nthe *note io: 79. module and use *note io.StringIO: d94. or *note\nio.BytesIO: d08. for text and data respectively.\n\n* See also the *note Unicode HOWTO: 111c, which was updated for\nPython 3.0.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3138/\n\n(2) https://peps.python.org/pep-3120/\n\n(3) https://peps.python.org/pep-3131/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "This section gives a brief overview of every 'syntactic' change in": {
            "content": "Python 3.0.\n\n* Menu:\n\n* New Syntax::\n* Changed Syntax::\n* Removed Syntax::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: New Syntax,  Next: Changed Syntax,  Up: Overview Of Syntax Changes": {
            "content": "1.13.2.1 New Syntax\n...................\n\n* PEP 3107(1): Function argument and return value annotations.  This\nprovides a standardized way of annotating a function's parameters\nand return value.  There are no semantics attached to such\nannotations except that they can be introspected at runtime using\nthe 'annotations' attribute.  The intent is to encourage\nexperimentation through metaclasses, decorators or frameworks.\n\n* PEP 3102(2): Keyword-only arguments.  Named parameters occurring\nafter '*args' in the parameter list 'must' be specified using\nkeyword syntax in the call.  You can also use a bare '*' in the\nparameter list to indicate that you don't accept a variable-length\nargument list, but you do have keyword-only arguments.\n\n* Keyword arguments are allowed after the list of base classes in a\nclass definition.  This is used by the new convention for\nspecifying a metaclass (see next section), but can be used for\nother purposes as well, as long as the metaclass supports it.\n\n* PEP 3104(3): *note nonlocal: 111f. statement.  Using 'nonlocal x'\nyou can now assign directly to a variable in an outer (but\nnon-global) scope.  'nonlocal' is a new reserved word.\n\n* PEP 3132(4): Extended Iterable Unpacking.  You can now write things\nlike 'a, b, *rest = somesequence'.  And even '*rest, a = stuff'.\nThe 'rest' object is always a (possibly empty) list; the right-hand\nside may be any iterable.  Example:\n\n(a, *rest, b) = range(5)\n\nThis sets 'a' to '0', 'b' to '4', and 'rest' to '[1, 2, 3]'.\n\n* Dictionary comprehensions: '{k: v for k, v in stuff}' means the\nsame thing as 'dict(stuff)' but is more flexible.  (This is PEP\n274(5) vindicated.  :-)\n\n* Set literals, e.g.  '{1, 2}'.  Note that '{}' is an empty\ndictionary; use 'set()' for an empty set.  Set comprehensions are\nalso supported; e.g., '{x for x in stuff}' means the same thing as\n'set(stuff)' but is more flexible.\n\n* New octal literals, e.g.  '0o720' (already in 2.6).  The old octal\nliterals ('0720') are gone.\n\n* New binary literals, e.g.  '0b1010' (already in 2.6), and there is\na new corresponding built-in function, *note bin(): 1120.\n\n* Bytes literals are introduced with a leading 'b' or 'B', and there\nis a new corresponding built-in function, *note bytes(): 295.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3107/\n\n(2) https://peps.python.org/pep-3102/\n\n(3) https://peps.python.org/pep-3104/\n\n(4) https://peps.python.org/pep-3132/\n\n(5) https://peps.python.org/pep-0274/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Changed Syntax,  Next: Removed Syntax,  Prev: New Syntax,  Up: Overview Of Syntax Changes": {
            "content": "1.13.2.2 Changed Syntax\n.......................\n\n* PEP 3109(1) and PEP 3134(2): new *note raise: 3b3. statement\nsyntax: 'raise [EXPR [from EXPR]]'.  See below.\n\n* 'as' and *note with: 396. are now reserved words.  (Since 2.6,\nactually.)\n\n* 'True', 'False', and 'None' are reserved words.  (2.6 partially\nenforced the restrictions on 'None' already.)\n\n* Change from *note except: 379. 'exc', 'var' to 'except' 'exc' 'as'\n'var'.  See PEP 3110(3).\n\n* PEP 3115(4): New Metaclass Syntax.  Instead of:\n\nclass C:\nmetaclass = M\n...\n\nyou must now use:\n\nclass C(metaclass=M):\n...\n\nThe module-global 'metaclass' variable is no longer supported.\n(It was a crutch to make it easier to default to new-style classes\nwithout deriving every class from *note object: 8bb.)\n\n* List comprehensions no longer support the syntactic form '[... for\nVAR in ITEM1, ITEM2, ...]'.  Use '[... for VAR in (ITEM1, ITEM2,\n...)]' instead.  Also note that list comprehensions have different\nsemantics: they are closer to syntactic sugar for a generator\nexpression inside a *note list(): 3dc. constructor, and in\nparticular the loop control variables are no longer leaked into the\nsurrounding scope.\n\n* The 'ellipsis' ('...') can be used as an atomic expression\nanywhere.  (Previously it was only allowed in slices.)  Also, it\n'must' now be spelled as '...'.  (Previously it could also be\nspelled as '. . .', by a mere accident of the grammar.)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3109/\n\n(2) https://peps.python.org/pep-3134/\n\n(3) https://peps.python.org/pep-3110/\n\n(4) https://peps.python.org/pep-3115/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Removed Syntax,  Prev: Changed Syntax,  Up: Overview Of Syntax Changes": {
            "content": "1.13.2.3 Removed Syntax\n.......................\n\n* PEP 3113(1): Tuple parameter unpacking removed.  You can no longer\nwrite 'def foo(a, (b, c)): ...'.  Use 'def foo(a, bc): b, c = bc'\ninstead.\n\n* Removed backticks (use *note repr(): 5f0. instead).\n\n* Removed '<>' (use '!=' instead).\n\n* Removed keyword: *note exec(): 691. is no longer a keyword; it\nremains as a function.  (Fortunately the function syntax was also\naccepted in 2.x.)  Also note that *note exec(): 691. no longer\ntakes a stream argument; instead of 'exec(f)' you can use\n'exec(f.read())'.\n\n* Integer literals no longer support a trailing 'l' or 'L'.\n\n* String literals no longer support a leading 'u' or 'U'.\n\n* The *note from: 1123. 'module' *note import: 3a6. '*' syntax is\nonly allowed at the module level, no longer inside functions.\n\n* The only acceptable syntax for relative imports is 'from .[MODULE]\nimport NAME'.  All *note import: 3a6. forms not starting with '.'\nare interpreted as absolute imports.  ( PEP 328(2))\n\n* Classic classes are gone.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3113/\n\n(2) https://peps.python.org/pep-0328/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "Since many users presumably make the jump straight from Python 2.5 to": {
            "content": "",
            "subsections": []
        },
        "Python 3.0, this section reminds the reader of new features that were": {
            "content": "originally designed for Python 3.0 but that were back-ported to Python\n2.6.  The corresponding sections in *note What's New in Python 2.6:\n1125. should be consulted for longer descriptions.\n\n* *note PEP 343; The 'with' statement: 1126.  The *note with: 396.\nstatement is now a standard feature and no longer needs to be\nimported from the *note future: 0.  Also check out *note\nWriting Context Managers: 1127. and *note The contextlib module:\n1128.\n\n* *note PEP 366; Explicit Relative Imports From a Main Module: 1129.\nThis enhances the usefulness of the *note -m: 3a5. option when the\nreferenced module lives in a package.\n\n* *note PEP 370; Per-user site-packages Directory: 112a.\n\n* *note PEP 371; The multiprocessing Package: 112b.\n\n* *note PEP 3101; Advanced String Formatting: 112c.  Note: the 2.6\ndescription mentions the *note format(): 3eb. method for both 8-bit\nand Unicode strings.  In 3.0, only the *note str: 157. type (text\nstrings with Unicode support) supports this method; the *note\nbytes: 295. type does not.  The plan is to eventually make this the\nonly API for string formatting, and to start deprecating the '%'\noperator in Python 3.1.\n\n* *note PEP 3105; print As a Function: 112d.  This is now a standard\nfeature and no longer needs to be imported from *note future:\n0.  More details were given above.\n\n* *note PEP 3110; Exception-Handling Changes: 112e.  The *note\nexcept: 379. 'exc' 'as' 'var' syntax is now standard and 'except'\n'exc', 'var' is no longer supported.  (Of course, the 'as' 'var'\npart is still optional.)\n\n* *note PEP 3112; Byte Literals: 112f.  The 'b\"...\"' string literal\nnotation (and its variants like 'b'...'', 'b\"\"\"...\"\"\"', and\n'br\"...\"') now produces a literal of type *note bytes: 295.\n\n* *note PEP 3116; New I/O Library: 1130.  The *note io: 79. module is\nnow the standard way of doing file I/O. The built-in *note open():\n26e. function is now an alias for *note io.open(): 26f. and has\nadditional keyword arguments 'encoding', 'errors', 'newline' and\n'closefd'.  Also note that an invalid 'mode' argument now raises\n*note ValueError: 183, not *note IOError: ecb.  The binary file\nobject underlying a text file object can be accessed as 'f.buffer'\n(but beware that the text object maintains a buffer of itself in\norder to speed up the encoding and decoding operations).\n\n* *note PEP 3118; Revised Buffer Protocol: 1131.  The old builtin\n'buffer()' is now really gone; the new builtin *note memoryview():\n17f. provides (mostly) similar functionality.\n\n* *note PEP 3119; Abstract Base Classes: 1132.  The *note abc: 4.\nmodule and the ABCs defined in the *note collections: 1b. module\nplays a somewhat more prominent role in the language now, and\nbuilt-in collection types like *note dict: 237. and *note list:\n3dc. conform to the 'collections.MutableMapping' and\n'collections.MutableSequence' ABCs, respectively.\n\n* *note PEP 3127; Integer Literal Support and Syntax: 1133.  As\nmentioned above, the new octal literal notation is the only one\nsupported, and binary literals have been added.\n\n* *note PEP 3129; Class Decorators: 1134.\n\n* *note PEP 3141; A Type Hierarchy for Numbers: 1135.  The *note\nnumbers: 99. module is another new use of ABCs, defining Python's\n\"numeric tower\".  Also note the new *note fractions: 58. module\nwhich implements *note numbers.Rational: 1136.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "Due to time constraints, this document does not exhaustively cover the": {
            "content": "very extensive changes to the standard library.  PEP 3108(1) is the\nreference for the major changes to the library.  Here's a capsule\nreview:\n\n* Many old modules were removed.  Some, like 'gopherlib' (no longer\nused) and 'md5' (replaced by *note hashlib: 63.), were already\ndeprecated by PEP 4(2).  Others were removed as a result of the\nremoval of support for various platforms such as Irix, BeOS and Mac\nOS 9 (see PEP 11(3)).  Some modules were also selected for removal\nin Python 3.0 due to lack of use or because a better replacement\nexists.  See PEP 3108(4) for an exhaustive list.\n\n* The 'bsddb3' package was removed because its presence in the core\nstandard library has proved over time to be a particular burden for\nthe core developers due to testing instability and Berkeley DB's\nrelease schedule.  However, the package is alive and well,\nexternally maintained at\n'https://www.jcea.es/programacion/pybsddb.htm'.\n\n* Some modules were renamed because their old name disobeyed PEP\n8(5), or for various other reasons.  Here's the list:\n\nOld Name                    New Name\n\n--------------------------------------------------------\n\nwinreg                     winreg\n\n\nConfigParser                configparser\n\n\ncopyreg                    copyreg\n\n\nQueue                       queue\n\n\nSocketServer                socketserver\n\n\nmarkupbase                  markupbase\n\n\nrepr                        reprlib\n\n\ntest.testsupport           test.support\n\n\n* A common pattern in Python 2.x is to have one version of a module\nimplemented in pure Python, with an optional accelerated version\nimplemented as a C extension; for example, *note pickle: a1. and\n'cPickle'.  This places the burden of importing the accelerated\nversion and falling back on the pure Python version on each user of\nthese modules.  In Python 3.0, the accelerated versions are\nconsidered implementation details of the pure Python versions.\nUsers should always import the standard version, which attempts to\nimport the accelerated version and falls back to the pure Python\nversion.  The *note pickle: a1. / 'cPickle' pair received this\ntreatment.  The *note profile: aa. module is on the list for 3.1.\nThe 'StringIO' module has been turned into a class in the *note io:\n79. module.\n\n* Some related modules have been grouped into packages, and usually\nthe submodule names have been simplified.  The resulting new\npackages are:\n\n* *note dbm: 2f. ('anydbm', 'dbhash', 'dbm', 'dumbdbm', 'gdbm',\n'whichdb').\n\n* *note html: 66. ('HTMLParser', 'htmlentitydefs').\n\n* *note http: 69. ('httplib', 'BaseHTTPServer', 'CGIHTTPServer',\n'SimpleHTTPServer', 'Cookie', 'cookielib').\n\n* *note tkinter: ea. (all 'Tkinter'-related modules except *note\nturtle: fc.).  The target audience of *note turtle: fc.\ndoesn't really care about *note tkinter: ea.  Also note that\nas of Python 2.6, the functionality of *note turtle: fc. has\nbeen greatly enhanced.\n\n* *note urllib: 103. ('urllib', 'urllib2', 'urlparse',\n'robotparse').\n\n* 'xmlrpc' ('xmlrpclib', 'DocXMLRPCServer',\n'SimpleXMLRPCServer').\n",
            "subsections": []
        },
        "Some other changes to standard library modules, not covered by PEP": {
            "content": "3108(6):\n\n* Killed 'sets'.  Use the built-in *note set(): 39d. class.\n\n* Cleanup of the *note sys: d3. module: removed 'sys.exitfunc()',\n'sys.excclear()', 'sys.exctype', 'sys.excvalue',\n'sys.exctraceback'.  (Note that *note sys.lasttype: 1e3. etc.\nremain.)\n\n* Cleanup of the *note array.array: 18f. type: the 'read()' and\n'write()' methods are gone; use 'fromfile()' and 'tofile()'\ninstead.  Also, the ''c'' typecode for array is gone - use either\n''b'' for bytes or ''u'' for Unicode characters.\n\n* Cleanup of the *note operator: 9a. module: removed\n'sequenceIncludes()' and 'isCallable()'.\n\n* Cleanup of the 'thread' module: 'acquirelock()' and\n'releaselock()' are gone; use *note acquire(): 464. and *note\nrelease(): 1138. instead.\n\n* Cleanup of the *note random: b3. module: removed the 'jumpahead()'\nAPI.\n\n* The 'new' module is gone.\n\n* The functions 'os.tmpnam()', 'os.tempnam()' and 'os.tmpfile()' have\nbeen removed in favor of the *note tempfile: da. module.\n\n* The *note tokenize: f6. module has been changed to work with bytes.\nThe main entry point is now *note tokenize.tokenize(): 202, instead\nof generatetokens.\n\n* 'string.letters' and its friends ('string.lowercase' and\n'string.uppercase') are gone.  Use *note string.asciiletters:\n1139. etc.  instead.  (The reason for the removal is that\n'string.letters' and friends had locale-specific behavior, which is\na bad idea for such attractively named global \"constants\".)\n\n* Renamed module 'builtin' to *note builtins: 10. (removing the\nunderscores, adding an 's').  The 'builtins' variable found in\nmost global namespaces is unchanged.  To modify a builtin, you\nshould use *note builtins: 10, not 'builtins'!\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3108/\n\n(2) https://peps.python.org/pep-0004/\n\n(3) https://peps.python.org/pep-0011/\n\n(4) https://peps.python.org/pep-3108/\n\n(5) https://peps.python.org/pep-0008/\n\n(6) https://peps.python.org/pep-3108/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "'PEP 3101': A New Approach To String Formatting\n\n* A new system for built-in string formatting operations replaces the\n'%' string formatting operator.  (However, the '%' operator is\nstill supported; it will be deprecated in Python 3.1 and removed\nfrom the language at some later time.)  Read PEP 3101(1) for the\nfull scoop.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3101/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "The APIs for raising and catching exception have been cleaned up and new": {
            "content": "powerful features added:\n\n* PEP 352(1): All exceptions must be derived (directly or indirectly)\nfrom *note BaseException: 37c.  This is the root of the exception\nhierarchy.  This is not new as a recommendation, but the\n'requirement' to inherit from *note BaseException: 37c. is new.\n(Python 2.6 still allowed classic classes to be raised, and placed\nno restriction on what you can catch.)  As a consequence, string\nexceptions are finally truly and utterly dead.\n\n* Almost all exceptions should actually derive from *note Exception:\n7ff.; *note BaseException: 37c. should only be used as a base class\nfor exceptions that should only be handled at the top level, such\nas *note SystemExit: b97. or *note KeyboardInterrupt: 7f5.  The\nrecommended idiom for handling all exceptions except for this\nlatter category is to use *note except: 379. *note Exception: 7ff.\n\n* 'StandardError' was removed.\n\n* Exceptions no longer behave as sequences.  Use the 'args' attribute\ninstead.\n\n* PEP 3109(2): Raising exceptions.  You must now use 'raise\nEXCEPTION(ARGS)' instead of 'raise EXCEPTION, ARGS'.  Additionally,\nyou can no longer explicitly specify a traceback; instead, if you\n'have' to do this, you can assign directly to the *note\ntraceback: 113c. attribute (see below).\n\n* PEP 3110(3): Catching exceptions.  You must now use 'except\nSOMEEXCEPTION as VARIABLE' instead of 'except SOMEEXCEPTION,\nVARIABLE'.  Moreover, the 'variable' is explicitly deleted when the\n*note except: 379. block is left.\n\n* PEP 3134(4): Exception chaining.  There are two cases: implicit\nchaining and explicit chaining.  Implicit chaining happens when an\nexception is raised in an *note except: 379. or *note finally: 7ee.\nhandler block.  This usually happens due to a bug in the handler\nblock; we call this a 'secondary' exception.  In this case, the\noriginal exception (that was being handled) is saved as the *note\ncontext: 113d. attribute of the secondary exception.  Explicit\nchaining is invoked with this syntax:\n\nraise SecondaryException() from primaryexception\n\n(where 'primaryexception' is any expression that produces an\nexception object, probably an exception that was previously\ncaught).  In this case, the primary exception is stored on the\n*note cause: 113e. attribute of the secondary exception.  The\ntraceback printed when an unhandled exception occurs walks the\nchain of 'cause' and *note context: 113d. attributes and\nprints a separate traceback for each component of the chain, with\nthe primary exception at the top.  (Java users may recognize this\nbehavior.)\n\n* PEP 3134(5): Exception objects now store their traceback as the\n*note traceback: 113c. attribute.  This means that an exception\nobject now contains all the information pertaining to an exception,\nand there are fewer reasons to use *note sys.excinfo(): 456.\n(though the latter is not removed).\n\n* A few exception messages are improved when Windows fails to load an\nextension module.  For example, 'error code 193' is now '%1 is not\na valid Win32 application'.  Strings now deal with non-English\nlocales.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0352/\n\n(2) https://peps.python.org/pep-3109/\n\n(3) https://peps.python.org/pep-3110/\n\n(4) https://peps.python.org/pep-3134/\n\n(5) https://peps.python.org/pep-3134/\n\nFile: python3.12.info,  Node: Miscellaneous Other Changes,  Next: Build and C API Changes<7>,  Prev: Changes To Exceptions,  Up: What's New In Python 3 0\n\n\n* Menu:\n\n* Operators And Special Methods::\n* Builtins::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Operators And Special Methods,  Next: Builtins,  Up: Miscellaneous Other Changes": {
            "content": "1.13.7.1 Operators And Special Methods\n......................................\n\n* '!=' now returns the opposite of '==', unless '==' returns *note\nNotImplemented: 5c5.\n\n* The concept of \"unbound methods\" has been removed from the\nlanguage.  When referencing a method as a class attribute, you now\nget a plain function object.\n\n* 'getslice()', 'setslice()' and 'delslice()' were\nkilled.  The syntax 'a[i:j]' now translates to\n'a.getitem(slice(i, j))' (or 'setitem()' or\n'delitem()', when used as an assignment or deletion target,\nrespectively).\n\n* PEP 3114(1): the standard *note next(): 5cb. method has been\nrenamed to *note next(): 1141.\n\n* The 'oct()' and 'hex()' special methods are removed - *note\noct(): 1142. and *note hex(): 1143. use 'index()' now to\nconvert the argument to an integer.\n\n* Removed support for 'members' and 'methods'.\n\n* The function attributes named 'funcX' have been renamed to use the\n'X' form, freeing up these names in the function attribute\nnamespace for user-defined attributes.  To wit, 'funcclosure',\n'funccode', 'funcdefaults', 'funcdict', 'funcdoc',\n'funcglobals', 'funcname' were renamed to *note closure:\n1144, *note code: 1145, *note defaults: 1146, *note\ndict: 1147, *note doc: 104d, *note globals: 1148, *note\nname: 1149, respectively.\n\n* 'nonzero()' is now *note bool(): 114a.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3114/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Builtins,  Prev: Operators And Special Methods,  Up: Miscellaneous Other Changes": {
            "content": "1.13.7.2 Builtins\n.................\n\n* PEP 3135(1): New *note super(): 204.  You can now invoke *note\nsuper(): 204. without arguments and (assuming this is in a regular\ninstance method defined inside a *note class: 114c. statement) the\nright class and instance will automatically be chosen.  With\narguments, the behavior of *note super(): 204. is unchanged.\n\n* PEP 3111(2): 'rawinput()' was renamed to *note input(): 114d.\nThat is, the new *note input(): 114d. function reads a line from\n*note sys.stdin: 293. and returns it with the trailing newline\nstripped.  It raises *note EOFError: 114e. if the input is\nterminated prematurely.  To get the old behavior of *note input():\n114d, use 'eval(input())'.\n\n* A new built-in function *note next(): 5cb. was added to call the\n*note next(): 1141. method on an object.\n\n* The *note round(): 114f. function rounding strategy and return type\nhave changed.  Exact halfway cases are now rounded to the nearest\neven result instead of away from zero.  (For example, 'round(2.5)'\nnow returns '2' rather than '3'.)  'round(x[, n])' now delegates to\n'x.round([n])' instead of always returning a float.  It\ngenerally returns an integer when called with a single argument and\na value of the same type as 'x' when called with two arguments.\n\n* Moved 'intern()' to *note sys.intern(): 1150.\n\n* Removed: 'apply()'.  Instead of 'apply(f, args)' use 'f(*args)'.\n\n* Removed *note callable(): 103a.  Instead of 'callable(f)' you can\nuse 'isinstance(f, collections.Callable)'.  The\n'operator.isCallable()' function is also gone.\n\n* Removed 'coerce()'.  This function no longer serves a purpose now\nthat classic classes are gone.\n\n* Removed 'execfile()'.  Instead of 'execfile(fn)' use\n'exec(open(fn).read())'.\n\n* Removed the 'file' type.  Use *note open(): 26e.  There are now\nseveral different kinds of streams that open can return in the\n*note io: 79. module.\n\n* Removed 'reduce()'.  Use *note functools.reduce(): 1151. if you\nreally need it; however, 99 percent of the time an explicit *note\nfor: 24e. loop is more readable.\n\n* Removed 'reload()'.  Use 'imp.reload()'.\n\n* Removed.  'dict.haskey()' - use the *note in: 250. operator\ninstead.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3135/\n\n(2) https://peps.python.org/pep-3111/\n\nFile: python3.12.info,  Node: Build and C API Changes<7>,  Next: Performance,  Prev: Miscellaneous Other Changes,  Up: What's New In Python 3 0\n\n",
            "subsections": []
        },
        "Due to time constraints, here is a 'very' incomplete list of changes to": {
            "content": "the C API.\n\n* Support for several platforms was dropped, including but not\nlimited to Mac OS 9, BeOS, RISCOS, Irix, and Tru64.\n\n* PEP 3118(1): New Buffer API.\n\n* PEP 3121(2): Extension Module Initialization & Finalization.\n\n* PEP 3123(3): Making *note PyObjectHEAD: 1153. conform to standard\nC.\n\n* No more C API support for restricted execution.\n\n* 'PyNumberCoerce()', 'PyNumberCoerceEx()', 'PyMemberGet()', and\n'PyMemberSet()' C APIs are removed.\n\n* New C API *note PyImportImportModuleNoBlock(): 324, works like\n*note PyImportImportModule(): 325. but won't block on the import\nlock (returning an error instead).\n\n* Renamed the boolean conversion C-level slot and method:\n'nbnonzero' is now 'nbbool'.\n\n* Removed 'METHOLDARGS' and 'WITHCYCLEGC' from the C API.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3118/\n\n(2) https://peps.python.org/pep-3121/\n\n(3) https://peps.python.org/pep-3123/\n\nFile: python3.12.info,  Node: Performance,  Next: Porting To Python 3 0,  Prev: Build and C API Changes<7>,  Up: What's New In Python 3 0\n\n",
            "subsections": []
        },
        "The net result of the 3.0 generalizations is that Python 3.0 runs the": {
            "content": "pystone benchmark around 10% slower than Python 2.5.  Most likely the\nbiggest cause is the removal of special-casing for small integers.\nThere's room for improvement, but it will happen after 3.0 is released!\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Porting To Python 3 0,  Prev: Performance,  Up: What's New In Python 3 0": {
            "content": "",
            "subsections": []
        },
        "For porting existing Python 2.5 or 2.6 source code to Python 3.0, the": {
            "content": "best strategy is the following:\n\n0. (Prerequisite:) Start with excellent test coverage.\n\n1. Port to Python 2.6.  This should be no more work than the average\nport from Python 2.x to Python 2.(x+1).  Make sure all your tests\npass.\n\n2. (Still using 2.6:) Turn on the '-3' command line switch.  This\nenables warnings about features that will be removed (or change) in\n3.0.  Run your test suite again, and fix code that you get warnings\nabout until there are no warnings left, and all your tests still\npass.\n\n3. Run the '2to3' source-to-source translator over your source code\ntree.  (See *note 2to3 -- Automated Python 2 to 3 code translation:\n4f4. for more on this tool.)  Run the result of the translation\nunder Python 3.0.  Manually fix up any remaining issues, fixing\nproblems until all tests pass again.\n",
            "subsections": []
        },
        "It is not recommended to try to write source code that runs unchanged": {
            "content": "under both Python 2.6 and 3.0; you'd have to use a very contorted coding\nstyle, e.g.  avoiding 'print' statements, metaclasses, and much more.",
            "subsections": []
        },
        "If you are maintaining a library that needs to support both Python 2.6": {
            "content": "and Python 3.0, the best approach is to modify step 3 above by editing\nthe 2.6 version of the source code and running the '2to3' translator\nagain, rather than editing the 3.0 version of the source code.\n\nFor porting C extensions to Python 3.0, please see *note Porting\nExtension Modules to Python 3: 1156.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": [
                {
                    "name": "1.14 What's New in Python 2.7",
                    "content": ""
                }
            ]
        },
        "Author: A.M. Kuchling (amk at amk.ca)": {
            "content": "",
            "subsections": []
        },
        "This article explains the new features in Python 2.7.  Python 2.7 was": {
            "content": "released on July 3, 2010.\n",
            "subsections": []
        },
        "Numeric handling has been improved in many ways, for both floating-point": {
            "content": "numbers and for the *note Decimal: 5c3. class.  There are some useful\nadditions to the standard library, such as a greatly enhanced *note\nunittest: 101. module, the *note argparse: 6. module for parsing\ncommand-line options, convenient *note OrderedDict: 39f. and *note\nCounter: f09. classes in the *note collections: 1b. module, and many\nother improvements.\n",
            "subsections": []
        },
        "Python 2.7 is planned to be the last of the 2.x releases, so we worked": {
            "content": "on making it a good release for the long term.  To help with porting to",
            "subsections": []
        },
        "Python 3, several new features from the Python 3.x series have been": {
            "content": "included in 2.7.\n",
            "subsections": []
        },
        "This article doesn't attempt to provide a complete specification of the": {
            "content": "new features, but instead provides a convenient overview.  For full\ndetails, you should refer to the documentation for Python 2.2, such as\nthe Python Library Reference(1) and the Python Reference Manual(2).  If\nyou want to understand the complete implementation and design rationale\nfor a change, refer to the PEP for a particular new feature.\n\n---------- Footnotes ----------\n\n(1) https://docs.python.org/2.2/lib/lib.html\n\n(2) https://docs.python.org/2.2/ref/ref.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The Future for Python 2 x,  Next: Changes to the Handling of Deprecation Warnings,  Up: What's New in Python 2 7": {
            "content": "",
            "subsections": []
        },
        "Python 2.7 is the last major release in the 2.x series, as the Python": {
            "content": "maintainers have shifted the focus of their new feature development\nefforts to the Python 3.x series.  This means that while Python 2\ncontinues to receive bug fixes, and to be updated to build correctly on\nnew hardware and versions of supported operated systems, there will be\nno new full feature releases for the language or standard library.\n",
            "subsections": []
        },
        "However, while there is a large common subset between Python 2.7 and": {
            "content": "",
            "subsections": []
        },
        "Python 3, and many of the changes involved in migrating to that common": {
            "content": "subset, or directly to Python 3, can be safely automated, some other\nchanges (notably those associated with Unicode handling) may require\ncareful consideration, and preferably robust automated regression test\nsuites, to migrate effectively.\n",
            "subsections": []
        },
        "This means that Python 2.7 will remain in place for a long time,": {
            "content": "providing a stable and supported base platform for production systems\nthat have not yet been ported to Python 3.  The full expected lifecycle\nof the Python 2.7 series is detailed in PEP 373(1).\n\nSome key consequences of the long-term significance of 2.7 are:\n\n* As noted above, the 2.7 release has a much longer period of\nmaintenance when compared to earlier 2.x versions.  Python 2.7 is\ncurrently expected to remain supported by the core development team\n(receiving security updates and other bug fixes) until at least\n2020 (10 years after its initial release, compared to the more\ntypical support period of 18-24 months).\n\n* As the Python 2.7 standard library ages, making effective use of\nthe Python Package Index (either directly or via a redistributor)\nbecomes more important for Python 2 users.  In addition to a wide\nvariety of third party packages for various tasks, the available\npackages include backports of new modules and features from the\nPython 3 standard library that are compatible with Python 2, as\nwell as various tools and libraries that can make it easier to\nmigrate to Python 3.  The Python Packaging User Guide(2) provides\nguidance on downloading and installing software from the Python\nPackage Index.\n\n* While the preferred approach to enhancing Python 2 is now the\npublication of new packages on the Python Package Index, this\napproach doesn't necessarily work in all cases, especially those\nrelated to network security.  In exceptional cases that cannot be\nhandled adequately by publishing new or updated packages on PyPI,\nthe Python Enhancement Proposal process may be used to make the\ncase for adding new features directly to the Python 2 standard\nlibrary.  Any such additions, and the maintenance releases where\nthey were added, will be noted in the *note New Features Added to\nPython 2.7 Maintenance Releases: 115b. section below.\n",
            "subsections": []
        },
        "For projects wishing to migrate from Python 2 to Python 3, or for": {
            "content": "library and framework developers wishing to support users on both Python\n2 and Python 3, there are a variety of tools and guides available to\nhelp decide on a suitable approach and manage some of the technical\ndetails involved.  The recommended starting point is the pyporting-howto\nHOWTO guide.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0373/\n\n(2) https://packaging.python.org\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "For Python 2.7, a policy decision was made to silence warnings only of": {
            "content": "interest to developers by default.  *note DeprecationWarning: 179. and\nits descendants are now ignored unless otherwise requested, preventing\nusers from seeing warnings triggered by an application.  This change was\nalso made in the branch that became Python 3.2.  (Discussed on\nstdlib-sig and carried out in bpo-7319(1).)\n\nIn previous releases, *note DeprecationWarning: 179. messages were\nenabled by default, providing Python developers with a clear indication\nof where their code may break in a future major version of Python.\n",
            "subsections": []
        },
        "However, there are increasingly many users of Python-based applications": {
            "content": "who are not directly involved in the development of those applications.\n*note DeprecationWarning: 179. messages are irrelevant to such users,\nmaking them worry about an application that's actually working correctly\nand burdening application developers with responding to these concerns.\n\nYou can re-enable display of *note DeprecationWarning: 179. messages by\nrunning Python with the *note -Wdefault: 6df. (short form: *note -Wd:\n6df.) switch, or by setting the *note PYTHONWARNINGS: 9ee. environment\nvariable to '\"default\"' (or '\"d\"') before running Python.  Python code\ncan also re-enable them by calling 'warnings.simplefilter('default')'.\n",
            "subsections": []
        },
        "The 'unittest' module also automatically reenables deprecation warnings": {
            "content": "when running tests.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=7319\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "Much as Python 2.6 incorporated features from Python 3.0, version 2.7": {
            "content": "incorporates some of the new features in Python 3.1.  The 2.x series\ncontinues to provide tools for migrating to the 3.x series.\n\nA partial list of 3.1 features that were backported to 2.7:\n\n* The syntax for set literals ('{1,2,3}' is a mutable set).\n\n* Dictionary and set comprehensions ('{i: i*2 for i in range(3)}').\n\n* Multiple context managers in a single *note with: 396. statement.\n\n* A new version of the *note io: 79. library, rewritten in C for\nperformance.\n\n* The ordered-dictionary type described in *note PEP 372; Adding an\nOrdered Dictionary to collections: 115e.\n\n* The new '\",\"' format specifier described in *note PEP 378; Format\nSpecifier for Thousands Separator: 115f.\n\n* The *note memoryview: 17f. object.\n\n* A small subset of the *note importlib: 71. module, *note described\nbelow: 1160.\n\n* The *note repr(): 5f0. of a float 'x' is shorter in many cases:\nit's now based on the shortest decimal string that's guaranteed to\nround back to 'x'.  As in previous versions of Python, it's\nguaranteed that 'float(repr(x))' recovers 'x'.\n\n* Float-to-string and string-to-float conversions are correctly\nrounded.  The *note round(): 114f. function is also now correctly\nrounded.\n\n* The *note PyCapsule: 10eb. type, used to provide a C API for\nextension modules.\n\n* The *note PyLongAsLongAndOverflow(): 10df. C API function.\n\nOther new Python3-mode warnings include:\n\n* 'operator.isCallable()' and 'operator.sequenceIncludes()', which\nare not supported in 3.x, now trigger warnings.\n\n* The '-3' switch now automatically enables the '-Qwarn' switch that\ncauses warnings about using classic division with integers and long\nintegers.\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "If a new entry overwrites an existing entry, the original insertion": {
            "content": "position is left unchanged:\n\n>>> d['second'] = 4\n>>> d.items()\n[('first', 1), ('second', 4), ('third', 3)]\n\nDeleting an entry and reinserting it will move it to the end:\n\n>>> del d['second']\n>>> d['second'] = 5\n>>> d.items()\n[('first', 1), ('third', 3), ('second', 5)]\n\nThe *note popitem(): 1162. method has an optional 'last' argument that\ndefaults to 'True'.  If 'last' is true, the most recently added key is\nreturned and removed; if it's false, the oldest key is selected:\n\n>>> od = OrderedDict([(x,0) for x in range(20)])\n>>> od.popitem()\n(19, 0)\n>>> od.popitem()\n(18, 0)\n>>> od.popitem(last=False)\n(0, 0)\n>>> od.popitem(last=False)\n(1, 0)\n",
            "subsections": []
        },
        "Comparing two ordered dictionaries checks both the keys and values, and": {
            "content": "requires that the insertion order was the same:\n\n>>> od1 = OrderedDict([('first', 1),\n...                    ('second', 2),\n...                    ('third', 3)])\n>>> od2 = OrderedDict([('third', 3),\n...                    ('first', 1),\n...                    ('second', 2)])\n>>> od1 == od2\nFalse\n>>> # Move 'third' key to the end\n>>> del od2['third']; od2['third'] = 3\n>>> od1 == od2\nTrue\n\nComparing an *note OrderedDict: 39f. with a regular dictionary ignores\nthe insertion order and just compares the keys and values.\n\nHow does the *note OrderedDict: 39f. work?  It maintains a doubly linked\nlist of keys, appending new keys to the list as they're inserted.  A\nsecondary dictionary maps keys to their corresponding list node, so\ndeletion doesn't have to traverse the entire linked list and therefore\nremains 'O'(1).\n",
            "subsections": []
        },
        "To make program output more readable, it can be useful to add separators": {
            "content": "to large numbers, rendering them as 18,446,744,073,709,551,616 instead\nof 18446744073709551616.\n\nThe fully general solution for doing this is the *note locale: 81.\nmodule, which can use different separators (\",\" in North America, \".\" in\nEurope) and different grouping sizes, but *note locale: 81. is\ncomplicated to use and unsuitable for multi-threaded applications where\ndifferent threads are producing output for different locales.\n",
            "subsections": []
        },
        "Therefore, a simple comma-grouping mechanism has been added to the": {
            "content": "mini-language used by the *note str.format(): 3ed. method.  When\nformatting a floating-point number, simply include a comma between the\nwidth and the precision:\n\n>>> '{:20,.2f}'.format(18446744073709551616.0)\n'18,446,744,073,709,551,616.00'\n\nWhen formatting an integer, include the comma after the width:\n\n>>> '{:20,d}'.format(18446744073709551616)\n'18,446,744,073,709,551,616'\n",
            "subsections": []
        },
        "This mechanism is not adaptable at all; commas are always used as the": {
            "content": "separator and the grouping is always into three-digit groups.  The\ncomma-formatting mechanism isn't as general as the *note locale: 81.\nmodule, but it's easier to use.\n\nSee also\n........\n\nPEP 378(1) - Format Specifier for Thousands Separator\n\nPEP written by Raymond Hettinger; implemented by Eric Smith.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0378/\n\nFile: python3.12.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\n\n\nThe *note argparse: 6. module for parsing command-line arguments was\nadded as a more powerful replacement for the *note optparse: 9b. module.\n",
            "subsections": []
        },
        "This means Python now supports three different modules for parsing": {
            "content": "command-line arguments: *note getopt: 5c, *note optparse: 9b, and *note\nargparse: 6.  The *note getopt: 5c. module closely resembles the C\nlibrary's 'getopt()' function, so it remains useful if you're writing a\nPython prototype that will eventually be rewritten in C. *note optparse:\n9b. becomes redundant, but there are no plans to remove it because there\nare many scripts still using it, and there's no automated way to update\nthese scripts.  (Making the *note argparse: 6. API consistent with *note\noptparse: 9b.'s interface was discussed but rejected as too messy and\ndifficult.)\n",
            "subsections": []
        },
        "In short, if you're writing a new script and don't need to worry about": {
            "content": "compatibility with earlier versions of Python, use *note argparse: 6.\ninstead of *note optparse: 9b.\n\nHere's an example:\n\nimport argparse\n\nparser = argparse.ArgumentParser(description='Command-line example.')\n\n# Add optional switches\nparser.addargument('-v', action='storetrue', dest='isverbose',\nhelp='produce verbose output')\nparser.addargument('-o', action='store', dest='output',\nmetavar='FILE',\nhelp='direct output to FILE instead of stdout')\nparser.addargument('-C', action='store', type=int, dest='context',\nmetavar='NUM', default=0,\nhelp='display NUM lines of added context')\n\n# Allow any number of additional arguments.\nparser.addargument(nargs='*', action='store', dest='inputs',\nhelp='input filenames (default is stdin)')\n\nargs = parser.parseargs()\nprint args.dict\n",
            "subsections": []
        },
        "Unless you override it, '-h' and '--help' switches are automatically": {
            "content": "added, and produce neatly formatted output:\n\n-> ./python.exe argparse-example.py --help\nusage: argparse-example.py [-h] [-v] [-o FILE] [-C NUM] [inputs [inputs ...]]\n\nCommand-line example.\n\npositional arguments:\ninputs      input filenames (default is stdin)\n\noptional arguments:\n-h, --help  show this help message and exit\n-v          produce verbose output\n-o FILE     direct output to FILE instead of stdout\n-C NUM      display NUM lines of added context\n\nAs with *note optparse: 9b, the command-line switches and arguments are\nreturned as an object with attributes named by the 'dest' parameters:\n\n-> ./python.exe argparse-example.py -v\n{'output': None,\n'isverbose': True,\n'context': 0,\n'inputs': []}\n\n-> ./python.exe argparse-example.py -v -o /tmp/output -C 4 file1 file2\n{'output': '/tmp/output',\n'isverbose': True,\n'context': 4,\n'inputs': ['file1', 'file2']}\n\n*note argparse: 6. has much fancier validation than *note optparse: 9b.;\nyou can specify an exact number of arguments as an integer, 0 or more\narguments by passing ''*'', 1 or more by passing ''+'', or an optional\nargument with ''?''.  A top-level parser can contain sub-parsers to\ndefine subcommands that have different sets of switches, as in 'svn\ncommit', 'svn checkout', etc.  You can specify an argument's type as\n*note FileType: d87, which will automatically open files for you and\nunderstands that ''-'' means standard input or output.\n\nSee also\n........\n\n*note argparse: 6. documentation\n\nThe documentation page of the argparse module.\n\n*note Upgrading optparse code: 1021.\n\nPart of the Python documentation, describing how to convert code\nthat uses *note optparse: 9b.\n\nPEP 389(1) - argparse - New Command Line Parsing Module\n\nPEP written and implemented by Steven Bethard.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0389/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "The *note logging: 82. module is very flexible; applications can define\na tree of logging subsystems, and each logger in this tree can filter\nout certain messages, format them differently, and direct messages to a\nvarying number of handlers.\n",
            "subsections": []
        },
        "All this flexibility can require a lot of configuration.  You can write": {
            "content": "",
            "subsections": []
        },
        "Python statements to create objects and set their properties, but a": {
            "content": "complex set-up requires verbose but boring code.  *note logging: 82.\nalso supports a *note fileConfig(): 98d. function that parses a file,\nbut the file format doesn't support configuring filters, and it's\nmessier to generate programmatically.\n\nPython 2.7 adds a *note dictConfig(): 1023. function that uses a\ndictionary to configure logging.  There are many ways to produce a\ndictionary from different sources: construct one with code; parse a file\ncontaining JSON; or use a YAML parsing library if one is installed.  For\nmore information see *note Configuration functions: 1166.\n",
            "subsections": []
        },
        "The following example configures two loggers, the root logger and a": {
            "content": "logger named \"network\".  Messages sent to the root logger will be sent\nto the system log using the syslog protocol, and messages to the\n\"network\" logger will be written to a 'network.log' file that will be\nrotated once the log reaches 1MB.\n\nimport logging\nimport logging.config\n\nconfigdict = {\n'version': 1,    # Configuration schema in use; must be 1 for now\n'formatters': {\n'standard': {\n'format': ('%(asctime)s %(name)-15s '\n'%(levelname)-8s %(message)s')}},\n\n'handlers': {'netlog': {'backupCount': 10,\n'class': 'logging.handlers.RotatingFileHandler',\n'filename': '/logs/network.log',\n'formatter': 'standard',\n'level': 'INFO',\n'maxBytes': 1000000},\n'syslog': {'class': 'logging.handlers.SysLogHandler',\n'formatter': 'standard',\n'level': 'ERROR'}},\n\n# Specify all the subordinate loggers\n'loggers': {\n'network': {\n'handlers': ['netlog']\n}\n},\n# Specify properties of the root logger\n'root': {\n'handlers': ['syslog']\n},\n}\n\n# Set up configuration\nlogging.config.dictConfig(configdict)\n\n# As an example, log two error messages\nlogger = logging.getLogger('/')\nlogger.error('Database not found')\n\nnetlogger = logging.getLogger('network')\nnetlogger.error('Connection failed')\n\nThree smaller enhancements to the *note logging: 82. module, all\nimplemented by Vinay Sajip, are:\n\n* The *note SysLogHandler: 426. class now supports syslogging over\nTCP. The constructor has a 'socktype' parameter giving the type of\nsocket to use, either *note socket.SOCKDGRAM: 1167. for UDP or\n*note socket.SOCKSTREAM: 1168. for TCP. The default protocol\nremains UDP.\n\n* *note Logger: 98b. instances gained a *note getChild(): 1169.\nmethod that retrieves a descendant logger using a relative path.\nFor example, once you retrieve a logger by doing 'log =\ngetLogger('app')', calling 'log.getChild('network.listen')' is\nequivalent to 'getLogger('app.network.listen')'.\n\n* The *note LoggerAdapter: 116a. class gained an *note\nisEnabledFor(): 116b. method that takes a 'level' and returns\nwhether the underlying logger would process a message of that level\nof importance.\n\nSee also\n........\n\nPEP 391(1) - Dictionary-Based Configuration For Logging\n\nPEP written and implemented by Vinay Sajip.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0391/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "The dictionary methods *note keys(): 5bf, *note values(): 5c0, and *note\nitems(): 5c1. are different in Python 3.x.  They return an object called\na 'view' instead of a fully materialized list.\n\nIt's not possible to change the return values of *note keys(): 5bf,\n*note values(): 5c0, and *note items(): 5c1. in Python 2.7 because too\nmuch code would break.  Instead the 3.x versions were added under the\nnew names 'viewkeys()', 'viewvalues()', and 'viewitems()'.\n\n>>> d = dict((i*10, chr(65+i)) for i in range(26))\n>>> d\n{0: 'A', 130: 'N', 10: 'B', 140: 'O', 20: ..., 250: 'Z'}\n>>> d.viewkeys()\ndictkeys([0, 130, 10, 140, 20, 150, 30, ..., 250])\n",
            "subsections": []
        },
        "Views can be iterated over, but the key and item views also behave like": {
            "content": "sets.  The '&' operator performs intersection, and '|' performs a union:\n\n>>> d1 = dict((i*10, chr(65+i)) for i in range(26))\n>>> d2 = dict((i.5, i) for i in range(1000))\n>>> d1.viewkeys() & d2.viewkeys()\nset([0.0, 10.0, 20.0, 30.0])\n>>> d1.viewkeys() | range(0, 30)\nset([0, 1, 130, 3, 4, 5, 6, ..., 120, 250])\n",
            "subsections": []
        },
        "The view keeps track of the dictionary and its contents change as the": {
            "content": "dictionary is modified:\n\n>>> vk = d.viewkeys()\n>>> vk\ndictkeys([0, 130, 10, ..., 250])\n>>> d[260] = '&'\n>>> vk\ndictkeys([0, 130, 260, 10, ..., 250])\n",
            "subsections": []
        },
        "However, note that you can't add or remove keys while you're iterating": {
            "content": "over the view:\n\n>>> for k in vk:\n...     d[k*2] = k\n...\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nRuntimeError: dictionary changed size during iteration\n",
            "subsections": []
        },
        "You can use the view methods in Python 2.x code, and the 2to3 converter": {
            "content": "will change them to the standard *note keys(): 5bf, *note values(): 5c0,\nand *note items(): 5c1. methods.\n\nSee also\n........\n\nPEP 3106(1) - Revamping dict.keys(), .values() and .items()\n\nPEP written by Guido van Rossum.  Backported to 2.7 by Alexandre\nVassalotti; bpo-1967(2).\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3106/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=1967\n\nFile: python3.12.info,  Node: PEP 3137 The memoryview Object,  Next: Other Language Changes<13>,  Prev: PEP 3106 Dictionary Views,  Up: What's New in Python 2 7\n\n\nThe *note memoryview: 17f. object provides a view of another object's\nmemory content that matches the *note bytes: 295. type's interface.\n\n>>> import string\n>>> m = memoryview(string.letters)\n>>> m\n<memory at 0x37f850>\n>>> len(m)           # Returns length of underlying object\n52\n>>> m[0], m[25], m[26]   # Indexing returns one byte\n('a', 'z', 'A')\n>>> m2 = m[0:26]         # Slicing returns another memoryview\n>>> m2\n<memory at 0x37f080>\n",
            "subsections": []
        },
        "The content of the view can be converted to a string of bytes or a list": {
            "content": "of integers:\n\n>>> m2.tobytes()\n'abcdefghijklmnopqrstuvwxyz'\n>>> m2.tolist()\n[97, 98, 99, 100, 101, 102, 103, ... 121, 122]\n>>>\n\n*note memoryview: 17f. objects allow modifying the underlying object if\nit's a mutable object.\n\n>>> m2[0] = 75\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nTypeError: cannot modify read-only memory\n>>> b = bytearray(string.letters)  # Creating a mutable object\n>>> b\nbytearray(b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')\n>>> mb = memoryview(b)\n>>> mb[0] = '*'         # Assign to view, changing the bytearray.\n>>> b[0:5]              # The bytearray has been changed.\nbytearray(b'*bcde')\n>>>\n\nSee also\n........\n\nPEP 3137(1) - Immutable Bytes and Mutable Buffer\n\nPEP written by Guido van Rossum.  Implemented by Travis Oliphant,\nAntoine Pitrou and others.  Backported to 2.7 by Antoine Pitrou;\nbpo-2396(2).\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3137/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=2396\n\nFile: python3.12.info,  Node: Other Language Changes<13>,  Next: New and Improved Modules,  Prev: PEP 3137 The memoryview Object,  Up: What's New in Python 2 7\n\n\nSome smaller changes made to the core Python language are:\n\n* The syntax for set literals has been backported from Python 3.x.\nCurly brackets are used to surround the contents of the resulting\nmutable set; set literals are distinguished from dictionaries by\nnot containing colons and values.  '{}' continues to represent an\nempty dictionary; use 'set()' for an empty set.\n\n>>> {1, 2, 3, 4, 5}\nset([1, 2, 3, 4, 5])\n>>> set() # empty set\nset([])\n>>> {}    # empty dict\n{}\n\nBackported by Alexandre Vassalotti; bpo-2335(1).\n\n* Dictionary and set comprehensions are another feature backported\nfrom 3.x, generalizing list/generator comprehensions to use the\nliteral syntax for sets and dictionaries.\n\n>>> {x: x*x for x in range(6)}\n{0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25}\n>>> {('a'*x) for x in range(6)}\nset(['', 'a', 'aa', 'aaa', 'aaaa', 'aaaaa'])\n\nBackported by Alexandre Vassalotti; bpo-2333(2).\n\n* The *note with: 396. statement can now use multiple context\nmanagers in one statement.  Context managers are processed from\nleft to right and each one is treated as beginning a new 'with'\nstatement.  This means that:\n\nwith A() as a, B() as b:\n... suite of statements ...\n\nis equivalent to:\n\nwith A() as a:\nwith B() as b:\n... suite of statements ...\n\nThe 'contextlib.nested()' function provides a very similar\nfunction, so it's no longer necessary and has been deprecated.\n\n(Proposed in 'https://codereview.appspot.com/53094'; implemented by\nGeorg Brandl.)\n\n* Conversions between floating-point numbers and strings are now\ncorrectly rounded on most platforms.  These conversions occur in\nmany different places: *note str(): 157. on floats and complex\nnumbers; the *note float: 4b7. and *note complex: 3ad.\nconstructors; numeric formatting; serializing and deserializing\nfloats and complex numbers using the *note marshal: 88, *note\npickle: a1. and *note json: 7c. modules; parsing of float and\nimaginary literals in Python code; and *note Decimal: 5c3.-to-float\nconversion.\n\nRelated to this, the *note repr(): 5f0. of a floating-point number\n'x' now returns a result based on the shortest decimal string\nthat's guaranteed to round back to 'x' under correct rounding (with\nround-half-to-even rounding mode).  Previously it gave a string\nbased on rounding x to 17 decimal digits.\n\nThe rounding library responsible for this improvement works on\nWindows and on Unix platforms using the gcc, icc, or suncc\ncompilers.  There may be a small number of platforms where correct\noperation of this code cannot be guaranteed, so the code is not\nused on such systems.  You can find out which code is being used by\nchecking *note sys.floatreprstyle: 116f, which will be 'short' if\nthe new code is in use and 'legacy' if it isn't.\n\nImplemented by Eric Smith and Mark Dickinson, using David Gay's\n'dtoa.c' library; bpo-7117(3).\n\n* Conversions from long integers and regular integers to floating\npoint now round differently, returning the floating-point number\nclosest to the number.  This doesn't matter for small integers that\ncan be converted exactly, but for large numbers that will\nunavoidably lose precision, Python 2.7 now approximates more\nclosely.  For example, Python 2.6 computed the following:\n\n>>> n = 295147905179352891391\n>>> float(n)\n2.9514790517935283e+20\n>>> n - long(float(n))\n65535L\n\nPython 2.7's floating-point result is larger, but much closer to\nthe true value:\n\n>>> n = 295147905179352891391\n>>> float(n)\n2.9514790517935289e+20\n>>> n - long(float(n))\n-1L\n\n(Implemented by Mark Dickinson; bpo-3166(4).)\n\nInteger division is also more accurate in its rounding behaviours.\n(Also implemented by Mark Dickinson; bpo-1811(5).)\n\n* Implicit coercion for complex numbers has been removed; the\ninterpreter will no longer ever attempt to call a 'coerce()'\nmethod on complex objects.  (Removed by Meador Inge and Mark\nDickinson; bpo-5211(6).)\n\n* The *note str.format(): 3ed. method now supports automatic\nnumbering of the replacement fields.  This makes using *note\nstr.format(): 3ed. more closely resemble using '%s' formatting:\n\n>>> '{}:{}:{}'.format(2009, 04, 'Sunday')\n'2009:4:Sunday'\n>>> '{}:{}:{day}'.format(2009, 4, day='Sunday')\n'2009:4:Sunday'\n\nThe auto-numbering takes the fields from left to right, so the\nfirst '{...}' specifier will use the first argument to *note\nstr.format(): 3ed, the next specifier will use the next argument,\nand so on.  You can't mix auto-numbering and explicit numbering -\neither number all of your specifier fields or none of them - but\nyou can mix auto-numbering and named fields, as in the second\nexample above.  (Contributed by Eric Smith; bpo-5237(7).)\n\nComplex numbers now correctly support usage with *note format():\n3eb, and default to being right-aligned.  Specifying a precision or\ncomma-separation applies to both the real and imaginary parts of\nthe number, but a specified field width and alignment is applied to\nthe whole of the resulting '1.5+3j' output.  (Contributed by Eric\nSmith; bpo-1588(8) and bpo-7988(9).)\n\nThe 'F' format code now always formats its output using uppercase\ncharacters, so it will now produce 'INF' and 'NAN'.  (Contributed\nby Eric Smith; bpo-3382(10).)\n\nA low-level change: the *note object.format(): 3ea. method now\ntriggers a *note PendingDeprecationWarning: 6e0. if it's passed a\nformat string, because the 'format()' method for *note object:\n8bb. converts the object to a string representation and formats\nthat.  Previously the method silently applied the format string to\nthe string representation, but that could hide mistakes in Python\ncode.  If you're supplying formatting information such as an\nalignment or precision, presumably you're expecting the formatting\nto be applied in some object-specific way.  (Fixed by Eric Smith;\nbpo-7994(11).)\n\n* The *note int(): 17e. and 'long()' types gained a 'bitlength'\nmethod that returns the number of bits necessary to represent its\nargument in binary:\n\n>>> n = 37\n>>> bin(n)\n'0b100101'\n>>> n.bitlength()\n6\n>>> n = 2123-1\n>>> n.bitlength()\n123\n>>> (n+1).bitlength()\n124\n\n(Contributed by Fredrik Johansson and Victor Stinner;\nbpo-3439(12).)\n\n* The *note import: 3a6. statement will no longer try an absolute\nimport if a relative import (e.g.  'from .os import sep') fails.\nThis fixes a bug, but could possibly break certain 'import'\nstatements that were only working by accident.  (Fixed by Meador\nInge; bpo-7902(13).)\n\n* It's now possible for a subclass of the built-in 'unicode' type to\noverride the 'unicode()' method.  (Implemented by Victor\nStinner; bpo-1583863(14).)\n\n* The *note bytearray: 294. type's *note translate(): 1170. method\nnow accepts 'None' as its first argument.  (Fixed by Georg Brandl;\nbpo-4759(15).)\n\n* When using *note @classmethod: 246. and *note @staticmethod: 5cc.\nto wrap methods as class or static methods, the wrapper object now\nexposes the wrapped function as their *note func: 1171.\nattribute.  (Contributed by Amaury Forgeot d'Arc, after a\nsuggestion by George Sakkis; bpo-5982(16).)\n\n* When a restricted set of attributes were set using 'slots',\ndeleting an unset attribute would not raise *note AttributeError:\n395. as you would expect.  Fixed by Benjamin Peterson;\nbpo-7604(17).)\n\n* Two new encodings are now supported: \"cp720\", used primarily for\nArabic text; and \"cp858\", a variant of CP 850 that adds the euro\nsymbol.  (CP720 contributed by Alexander Belchenko and Amaury\nForgeot d'Arc in bpo-1616979(18); CP858 contributed by Tim Hatch in\nbpo-8016(19).)\n\n* The 'file' object will now set the 'filename' attribute on the\n*note IOError: ecb. exception when trying to open a directory on\nPOSIX platforms (noted by Jan Kaliszewski; bpo-4764(20)), and now\nexplicitly checks for and forbids writing to read-only file objects\ninstead of trusting the C library to catch and report the error\n(fixed by Stefan Krah; bpo-5677(21)).\n\n* The Python tokenizer now translates line endings itself, so the\n*note compile(): 528. built-in function now accepts code using any\nline-ending convention.  Additionally, it no longer requires that\nthe code end in a newline.\n\n* Extra parentheses in function definitions are illegal in Python\n3.x, meaning that you get a syntax error from 'def f((x)): pass'.\nIn Python3-warning mode, Python 2.7 will now warn about this odd\nusage.  (Noted by James Lingard; bpo-7362(22).)\n\n* It's now possible to create weak references to old-style class\nobjects.  New-style classes were always weak-referenceable.  (Fixed\nby Antoine Pitrou; bpo-8268(23).)\n\n* When a module object is garbage-collected, the module's dictionary\nis now only cleared if no one else is holding a reference to the\ndictionary (bpo-7140(24)).\n\n* Menu:\n\n* Interpreter Changes::\n* Optimizations: Optimizations<12>.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=2335\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=2333\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=7117\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=3166\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=1811\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=5211\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=5237\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=1588\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=7988\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=3382\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=7994\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=3439\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=7902\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=1583863\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=4759\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=5982\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=7604\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=1616979\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=8016\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=4764\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=5677\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=7362\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=8268\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=7140\n\nFile: python3.12.info,  Node: Interpreter Changes,  Next: Optimizations<12>,  Up: Other Language Changes<13>\n\n1.14.10.1 Interpreter Changes\n.............................\n\nA new environment variable, *note PYTHONWARNINGS: 9ee, allows\ncontrolling warnings.  It should be set to a string containing warning\nsettings, equivalent to those used with the *note -W: 6df. switch,\nseparated by commas.  (Contributed by Brian Curtin; bpo-7301(1).)\n",
            "subsections": []
        },
        "For example, the following setting will print warnings every time they": {
            "content": "occur, but turn warnings from the *note Cookie: 6c. module into an\nerror.  (The exact syntax for setting an environment variable varies\nacross operating systems and shells.)\n\nexport PYTHONWARNINGS=all,error:::Cookie:0\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=7301\n\nFile: python3.12.info,  Node: Optimizations<12>,  Prev: Interpreter Changes,  Up: Other Language Changes<13>\n\n1.14.10.2 Optimizations\n.......................\n\nSeveral performance enhancements have been added:\n\n* A new opcode was added to perform the initial setup for *note with:\n396. statements, looking up the *note enter(): 389. and *note\nexit(): 1175. methods.  (Contributed by Benjamin Peterson.)\n\n* The garbage collector now performs better for one common usage\npattern: when many objects are being allocated without deallocating\nany of them.  This would previously take quadratic time for garbage\ncollection, but now the number of full garbage collections is\nreduced as the number of objects on the heap grows.  The new logic\nonly performs a full garbage collection pass when the middle\ngeneration has been collected 10 times and when the number of\nsurvivor objects from the middle generation exceeds 10% of the\nnumber of objects in the oldest generation.  (Suggested by Martin\nvon Lo\"wis and implemented by Antoine Pitrou; bpo-4074(1).)\n\n* The garbage collector tries to avoid tracking simple containers\nwhich can't be part of a cycle.  In Python 2.7, this is now true\nfor tuples and dicts containing atomic types (such as ints,\nstrings, etc.).  Transitively, a dict containing tuples of atomic\ntypes won't be tracked either.  This helps reduce the cost of each\ngarbage collection by decreasing the number of objects to be\nconsidered and traversed by the collector.  (Contributed by Antoine\nPitrou; bpo-4688(2).)\n\n* Long integers are now stored internally either in base '215' or\nin base '230', the base being determined at build time.\nPreviously, they were always stored in base '215'.  Using base\n'230' gives significant performance improvements on 64-bit\nmachines, but benchmark results on 32-bit machines have been mixed.\nTherefore, the default is to use base '230' on 64-bit machines\nand base '215' on 32-bit machines; on Unix, there's a new\nconfigure option '--enable-big-digits' that can be used to override\nthis default.\n\nApart from the performance improvements this change should be\ninvisible to end users, with one exception: for testing and\ndebugging purposes there's a new structseq 'sys.longinfo' that\nprovides information about the internal format, giving the number\nof bits per digit and the size in bytes of the C type used to store\neach digit:\n\n>>> import sys\n>>> sys.longinfo\nsys.longinfo(bitsperdigit=30, sizeofdigit=4)\n\n(Contributed by Mark Dickinson; bpo-4258(3).)\n\nAnother set of changes made long objects a few bytes smaller: 2\nbytes smaller on 32-bit systems and 6 bytes on 64-bit.\n(Contributed by Mark Dickinson; bpo-5260(4).)\n\n* The division algorithm for long integers has been made faster by\ntightening the inner loop, doing shifts instead of multiplications,\nand fixing an unnecessary extra iteration.  Various benchmarks show\nspeedups of between 50% and 150% for long integer divisions and\nmodulo operations.  (Contributed by Mark Dickinson; bpo-5512(5).)\nBitwise operations are also significantly faster (initial patch by\nGregory Smith; bpo-1087418(6)).\n\n* The implementation of '%' checks for the left-side operand being a\nPython string and special-cases it; this results in a 1-3%\nperformance increase for applications that frequently use '%' with\nstrings, such as templating libraries.  (Implemented by Collin\nWinter; bpo-5176(7).)\n\n* List comprehensions with an 'if' condition are compiled into faster\nbytecode.  (Patch by Antoine Pitrou, back-ported to 2.7 by Jeffrey\nYasskin; bpo-4715(8).)\n\n* Converting an integer or long integer to a decimal string was made\nfaster by special-casing base 10 instead of using a generalized\nconversion function that supports arbitrary bases.  (Patch by\nGawain Bolton; bpo-6713(9).)\n\n* The 'split()', 'replace()', 'rindex()', 'rpartition()', and\n'rsplit()' methods of string-like types (strings, Unicode strings,\nand *note bytearray: 294. objects) now use a fast reverse-search\nalgorithm instead of a character-by-character scan.  This is\nsometimes faster by a factor of 10.  (Added by Florent Xicluna;\nbpo-7462(10) and bpo-7622(11).)\n\n* The *note pickle: a1. and 'cPickle' modules now automatically\nintern the strings used for attribute names, reducing memory usage\nof the objects resulting from unpickling.  (Contributed by Jake\nMcGuire; bpo-5084(12).)\n\n* The 'cPickle' module now special-cases dictionaries, nearly halving\nthe time required to pickle them.  (Contributed by Collin Winter;\nbpo-5670(13).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=4074\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=4688\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=4258\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=5260\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=5512\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=1087418\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=5176\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=4715\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=6713\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=7462\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=7622\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=5084\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=5670\n\nFile: python3.12.info,  Node: New and Improved Modules,  Next: Build and C API Changes<8>,  Prev: Other Language Changes<13>,  Up: What's New in Python 2 7\n\n",
            "subsections": []
        },
        "As in every release, Python's standard library received a number of": {
            "content": "enhancements and bug fixes.  Here's a partial list of the most notable\nchanges, sorted alphabetically by module name.  Consult the 'Misc/NEWS'\nfile in the source tree for a more complete list of changes, or look\nthrough the Subversion logs for all the details.\n\n* The 'asyncore' and 'asynchat' modules are being actively maintained\nagain, and a number of patches and bugfixes were applied.\n(Maintained by Josiah Carlson; see bpo-1736190(1) for one patch.)\n\n* The 'bsddb' module also has a new maintainer, Jes??s Cea Avi??n, and\nthe package is now available as a standalone package.  The web page\nfor the package is www.jcea.es/programacion/pybsddb.htm(2).  The\nplan is to remove the package from the standard library in Python\n3.0, because its pace of releases is much more frequent than\nPython's.\n\nThe 'bsddb.dbshelve' module now uses the highest pickling protocol\navailable, instead of restricting itself to protocol 1.\n(Contributed by W. Barnes.)\n\n* The *note cgi: 13. module will now read variables from the query\nstring of an HTTP POST request.  This makes it possible to use form\nactions with URLs that include query strings such as\n\"/cgi-bin/add.py?category=1\".  (Contributed by Alexandre Fiori and\nNubis; bpo-1817(3).)\n\nThe 'parseqs()' and 'parseqsl()' functions have been relocated\nfrom the *note cgi: 13. module to the *note urlparse: 105. module.\nThe versions still available in the 'cgi' module will trigger *note\nPendingDeprecationWarning: 6e0. messages in 2.6 (bpo-600362(4)).\n\n* The *note cmath: 16. module underwent extensive revision,\ncontributed by Mark Dickinson and Christian Heimes.  Five new\nfunctions were added:\n\n* 'polar()' converts a complex number to polar form, returning\nthe modulus and argument of the complex number.\n\n* 'rect()' does the opposite, turning a modulus, argument pair\nback into the corresponding complex number.\n\n* 'phase()' returns the argument (also called the angle) of a\ncomplex number.\n\n* 'isnan()' returns True if either the real or imaginary part of\nits argument is a NaN.\n\n* 'isinf()' returns True if either the real or imaginary part of\nits argument is infinite.\n\nThe revisions also improved the numerical soundness of the *note\ncmath: 16. module.  For all functions, the real and imaginary parts\nof the results are accurate to within a few units of least\nprecision (ulps) whenever possible.  See bpo-1381(5) for the\ndetails.  The branch cuts for 'asinh()', 'atanh()': and 'atan()'\nhave also been corrected.\n\nThe tests for the module have been greatly expanded; nearly 2000\nnew test cases exercise the algebraic functions.\n\nOn IEEE 754 platforms, the *note cmath: 16. module now handles IEEE\n754 special values and floating-point exceptions in a manner\nconsistent with Annex 'G' of the C99 standard.\n\n* A new data type in the *note collections: 1b. module:\n'namedtuple(typename, fieldnames)' is a factory function that\ncreates subclasses of the standard tuple whose fields are\naccessible by name as well as index.  For example:\n\n>>> vartype = collections.namedtuple('variable',\n...             'id name type size')\n>>> # Names are separated by spaces or commas.\n>>> # 'id, name, type, size' would also work.\n>>> vartype.fields\n('id', 'name', 'type', 'size')\n\n>>> var = vartype(1, 'frequency', 'int', 4)\n>>> print var[0], var.id    # Equivalent\n1 1\n>>> print var[2], var.type  # Equivalent\nint int\n>>> var.asdict()\n{'size': 4, 'type': 'int', 'id': 1, 'name': 'frequency'}\n>>> v2 = var.replace(name='amplitude')\n>>> v2\nvariable(id=1, name='amplitude', type='int', size=4)\n\nSeveral places in the standard library that returned tuples have\nbeen modified to return 'namedtuple()' instances.  For example, the\n'Decimal.astuple()' method now returns a named tuple with 'sign',\n'digits', and 'exponent' fields.\n\n(Contributed by Raymond Hettinger.)\n\n* Another change to the *note collections: 1b. module is that the\n'deque' type now supports an optional 'maxlen' parameter; if\nsupplied, the deque's size will be restricted to no more than\n'maxlen' items.  Adding more items to a full deque causes old items\nto be discarded.\n\n>>> from collections import deque\n>>> dq=deque(maxlen=3)\n>>> dq\ndeque([], maxlen=3)\n>>> dq.append(1); dq.append(2); dq.append(3)\n>>> dq\ndeque([1, 2, 3], maxlen=3)\n>>> dq.append(4)\n>>> dq\ndeque([2, 3, 4], maxlen=3)\n\n(Contributed by Raymond Hettinger.)\n\n* The *note Cookie: 6c. module's *note Morsel: a4a. objects now\nsupport an *note httponly: 1225. attribute.  In some browsers.\ncookies with this attribute set cannot be accessed or manipulated\nby JavaScript code.  (Contributed by Arvin Schnell;\nbpo-1638033(6).)\n\n* A new window method in the *note curses: 29. module, 'chgat()',\nchanges the display attributes for a certain number of characters\non a single line.  (Contributed by Fabian Kreutz.)\n\n# Boldface text starting at y=0,x=21\n# and affecting the rest of the line.\nstdscr.chgat(0, 21, curses.ABOLD)\n\nThe 'Textbox' class in the *note curses.textpad: 2c. module now\nsupports editing in insert mode as well as overwrite mode.  Insert\nmode is enabled by supplying a true value for the 'insertmode'\nparameter when creating the 'Textbox' instance.\n\n* The *note datetime: 2e. module's 'strftime()' methods now support a\n'%f' format code that expands to the number of microseconds in the\nobject, zero-padded on the left to six places.  (Contributed by\nSkip Montanaro; bpo-1158(7).)\n\n* The *note decimal: 33. module was updated to version 1.66 of the\nGeneral Decimal Specification(8).  New features include some\nmethods for some basic mathematical functions such as 'exp()' and\n'log10()':\n\n>>> Decimal(1).exp()\nDecimal(\"2.718281828459045235360287471\")\n>>> Decimal(\"2.7182818\").ln()\nDecimal(\"0.9999999895305022877376682436\")\n>>> Decimal(1000).log10()\nDecimal(\"3\")\n\nThe 'astuple()' method of 'Decimal' objects now returns a named\ntuple with 'sign', 'digits', and 'exponent' fields.\n\n(Implemented by Facundo Batista and Mark Dickinson.  Named tuple\nsupport added by Raymond Hettinger.)\n\n* The *note difflib: 34. module's 'SequenceMatcher' class now returns\nnamed tuples representing matches, with 'a', 'b', and 'size'\nattributes.  (Contributed by Raymond Hettinger.)\n\n* An optional 'timeout' parameter, specifying a timeout measured in\nseconds, was added to the *note ftplib.FTP: 715. class constructor\nas well as the 'connect()' method.  (Added by Facundo Batista.)\nAlso, the 'FTP' class's 'storbinary()' and 'storlines()' now take\nan optional 'callback' parameter that will be called with each\nblock of data after the data has been sent.  (Contributed by Phil\nSchwartz; bpo-1221598(9).)\n\n* The 'reduce()' built-in function is also available in the *note\nfunctools: 5a. module.  In Python 3.0, the builtin has been dropped\nand 'reduce()' is only available from *note functools: 5a.;\ncurrently there are no plans to drop the builtin in the 2.x series.\n(Patched by Christian Heimes; bpo-1739906(10).)\n\n* When possible, the *note getpass: 5d. module will now use\n'/dev/tty' to print a prompt message and read the password, falling\nback to standard error and standard input.  If the password may be\nechoed to the terminal, a warning is printed before the prompt is\ndisplayed.  (Contributed by Gregory P. Smith.)\n\n* The *note glob.glob(): 5fa. function can now return Unicode\nfilenames if a Unicode path was used and Unicode filenames are\nmatched within the directory.  (bpo-1001604(11))\n\n* A new function in the *note heapq: 64. module, 'merge(iter1, iter2,\n...)', takes any number of iterables returning data in sorted\norder, and returns a new generator that returns the contents of all\nthe iterators, also in sorted order.  For example:\n\n>>> list(heapq.merge([1, 3, 5, 9], [2, 8, 16]))\n[1, 2, 3, 5, 8, 9, 16]\n\nAnother new function, 'heappushpop(heap, item)', pushes 'item' onto\n'heap', then pops off and returns the smallest item.  This is more\nefficient than making a call to 'heappush()' and then 'heappop()'.\n\n*note heapq: 64. is now implemented to only use less-than\ncomparison, instead of the less-than-or-equal comparison it\npreviously used.  This makes *note heapq: 64.'s usage of a type\nmatch the *note list.sort(): a13. method.  (Contributed by Raymond\nHettinger.)\n\n* An optional 'timeout' parameter, specifying a timeout measured in\nseconds, was added to the *note httplib.HTTPConnection: 97a. and\n*note HTTPSConnection: 97b. class constructors.  (Added by Facundo\nBatista.)\n\n* Most of the *note inspect: 78. module's functions, such as\n'getmoduleinfo()' and 'getargs()', now return named tuples.  In\naddition to behaving like tuples, the elements of the return value\ncan also be accessed as attributes.  (Contributed by Raymond\nHettinger.)\n\nSome new functions in the module include 'isgenerator()',\n'isgeneratorfunction()', and 'isabstract()'.\n\n* The *note itertools: 7b. module gained several new functions.\n\n'iziplongest(iter1, iter2, ...[, fillvalue])' makes tuples from\neach of the elements; if some of the iterables are shorter than\nothers, the missing values are set to 'fillvalue'.  For example:\n\n>>> tuple(itertools.iziplongest([1,2,3], [1,2,3,4,5]))\n((1, 1), (2, 2), (3, 3), (None, 4), (None, 5))\n\n'product(iter1, iter2, ..., [repeat=N])' returns the Cartesian\nproduct of the supplied iterables, a set of tuples containing every\npossible combination of the elements returned from each iterable.\n\n>>> list(itertools.product([1,2,3], [4,5,6]))\n[(1, 4), (1, 5), (1, 6),\n(2, 4), (2, 5), (2, 6),\n(3, 4), (3, 5), (3, 6)]\n\nThe optional 'repeat' keyword argument is used for taking the\nproduct of an iterable or a set of iterables with themselves,\nrepeated 'N' times.  With a single iterable argument, 'N'-tuples\nare returned:\n\n>>> list(itertools.product([1,2], repeat=3))\n[(1, 1, 1), (1, 1, 2), (1, 2, 1), (1, 2, 2),\n(2, 1, 1), (2, 1, 2), (2, 2, 1), (2, 2, 2)]\n\nWith two iterables, '2N'-tuples are returned.\n\n>>> list(itertools.product([1,2], [3,4], repeat=2))\n[(1, 3, 1, 3), (1, 3, 1, 4), (1, 3, 2, 3), (1, 3, 2, 4),\n(1, 4, 1, 3), (1, 4, 1, 4), (1, 4, 2, 3), (1, 4, 2, 4),\n(2, 3, 1, 3), (2, 3, 1, 4), (2, 3, 2, 3), (2, 3, 2, 4),\n(2, 4, 1, 3), (2, 4, 1, 4), (2, 4, 2, 3), (2, 4, 2, 4)]\n\n'combinations(iterable, r)' returns sub-sequences of length 'r'\nfrom the elements of 'iterable'.\n\n>>> list(itertools.combinations('123', 2))\n[('1', '2'), ('1', '3'), ('2', '3')]\n>>> list(itertools.combinations('123', 3))\n[('1', '2', '3')]\n>>> list(itertools.combinations('1234', 3))\n[('1', '2', '3'), ('1', '2', '4'),\n('1', '3', '4'), ('2', '3', '4')]\n\n'permutations(iter[, r])' returns all the permutations of length\n'r' of the iterable's elements.  If 'r' is not specified, it will\ndefault to the number of elements produced by the iterable.\n\n>>> list(itertools.permutations([1,2,3,4], 2))\n[(1, 2), (1, 3), (1, 4),\n(2, 1), (2, 3), (2, 4),\n(3, 1), (3, 2), (3, 4),\n(4, 1), (4, 2), (4, 3)]\n\n'itertools.chain(*iterables)' is an existing function in *note\nitertools: 7b. that gained a new constructor in Python 2.6.\n'itertools.chain.fromiterable(iterable)' takes a single iterable\nthat should return other iterables.  'chain()' will then return all\nthe elements of the first iterable, then all the elements of the\nsecond, and so on.\n\n>>> list(itertools.chain.fromiterable([[1,2,3], [4,5,6]]))\n[1, 2, 3, 4, 5, 6]\n\n(All contributed by Raymond Hettinger.)\n\n* The *note logging: 82. module's 'FileHandler' class and its\nsubclasses 'WatchedFileHandler', 'RotatingFileHandler', and\n'TimedRotatingFileHandler' now have an optional 'delay' parameter\nto their constructors.  If 'delay' is true, opening of the log file\nis deferred until the first 'emit()' call is made.  (Contributed by\nVinay Sajip.)\n\n'TimedRotatingFileHandler' also has a 'utc' constructor parameter.\nIf the argument is true, UTC time will be used in determining when\nmidnight occurs and in generating filenames; otherwise local time\nwill be used.\n\n* Several new functions were added to the *note math: 89. module:\n\n* *note isinf(): 1226. and *note isnan(): 1227. determine\nwhether a given float is a (positive or negative) infinity or\na NaN (Not a Number), respectively.\n\n* *note copysign(): 1228. copies the sign bit of an IEEE 754\nnumber, returning the absolute value of 'x' combined with the\nsign bit of 'y'.  For example, 'math.copysign(1, -0.0)'\nreturns -1.0.  (Contributed by Christian Heimes.)\n\n* *note factorial(): 765. computes the factorial of a number.\n(Contributed by Raymond Hettinger; bpo-2138(12).)\n\n* *note fsum(): 1229. adds up the stream of numbers from an\niterable, and is careful to avoid loss of precision through\nusing partial sums.  (Contributed by Jean Brouwers, Raymond\nHettinger, and Mark Dickinson; bpo-2819(13).)\n\n* *note acosh(): 122a, *note asinh(): 122b. and *note atanh():\n122c. compute the inverse hyperbolic functions.\n\n* *note log1p(): 122d. returns the natural logarithm of '1+x'\n(base 'e').\n\n* 'trunc()' rounds a number toward zero, returning the closest\n'Integral' that's between the function's argument and zero.\nAdded as part of the backport of *note PEP 3141's type\nhierarchy for numbers: 1135.\n\n* The *note math: 89. module has been improved to give more\nconsistent behaviour across platforms, especially with respect to\nhandling of floating-point exceptions and IEEE 754 special values.\n\nWhenever possible, the module follows the recommendations of the\nC99 standard about 754's special values.  For example, 'sqrt(-1.)'\nshould now give a *note ValueError: 183. across almost all\nplatforms, while 'sqrt(float('NaN'))' should return a NaN on all\nIEEE 754 platforms.  Where Annex 'F' of the C99 standard recommends\nsignaling 'divide-by-zero' or 'invalid', Python will raise *note\nValueError: 183.  Where Annex 'F' of the C99 standard recommends\nsignaling 'overflow', Python will raise *note OverflowError: 68d.\n(See bpo-711019(14) and bpo-1640(15).)\n\n(Contributed by Christian Heimes and Mark Dickinson.)\n\n* *note mmap: 830. objects now have a 'rfind()' method that searches\nfor a substring beginning at the end of the string and searching\nbackwards.  The 'find()' method also gained an 'end' parameter\ngiving an index at which to stop searching.  (Contributed by John\nLenton.)\n\n* The *note operator: 9a. module gained a 'methodcaller()' function\nthat takes a name and an optional set of arguments, returning a\ncallable that will call the named function on any arguments passed\nto it.  For example:\n\n>>> # Equivalent to lambda s: s.replace('old', 'new')\n>>> replacer = operator.methodcaller('replace', 'old', 'new')\n>>> replacer('old wine in old bottles')\n'new wine in new bottles'\n\n(Contributed by Georg Brandl, after a suggestion by Gregory\nPetrosyan.)\n\nThe 'attrgetter()' function now accepts dotted names and performs\nthe corresponding attribute lookups:\n\n>>> instname = operator.attrgetter(\n...        'class.name')\n>>> instname('')\n'str'\n>>> instname(help)\n'Helper'\n\n(Contributed by Georg Brandl, after a suggestion by Barry Warsaw.)\n\n* The *note os: 9c. module now wraps several new system calls.\n'fchmod(fd, mode)' and 'fchown(fd, uid, gid)' change the mode and\nownership of an opened file, and 'lchmod(path, mode)' changes the\nmode of a symlink.  (Contributed by Georg Brandl and Christian\nHeimes.)\n\n'chflags()' and 'lchflags()' are wrappers for the corresponding\nsystem calls (where they're available), changing the flags set on a\nfile.  Constants for the flag values are defined in the *note stat:\ncb. module; some possible values include 'UFIMMUTABLE' to signal\nthe file may not be changed and 'UFAPPEND' to indicate that data\ncan only be appended to the file.  (Contributed by M. Levinson.)\n\n'os.closerange(low, high)' efficiently closes all file descriptors\nfrom 'low' to 'high', ignoring any errors and not including 'high'\nitself.  This function is now used by the *note subprocess: d0.\nmodule to make starting processes faster.  (Contributed by Georg\nBrandl; bpo-1663329(16).)\n\n* The 'os.environ' object's 'clear()' method will now unset the\nenvironment variables using *note os.unsetenv(): 739. in addition\nto clearing the object's keys.  (Contributed by Martin Horcicka;\nbpo-1181(17).)\n\n* The *note os.walk(): 1c8. function now has a 'followlinks'\nparameter.  If set to True, it will follow symlinks pointing to\ndirectories and visit the directory's contents.  For backward\ncompatibility, the parameter's default value is false.  Note that\nthe function can fall into an infinite recursion if there's a\nsymlink that points to a parent directory.  (bpo-1273829(18))\n\n* In the *note os.path: 9d. module, the 'splitext()' function has\nbeen changed to not split on leading period characters.  This\nproduces better results when operating on Unix's dot-files.  For\nexample, 'os.path.splitext('.ipython')' now returns '('.ipython',\n'')' instead of '('', '.ipython')'.  (bpo-1115886(19))\n\nA new function, 'os.path.relpath(path, start='.')', returns a\nrelative path from the 'start' path, if it's supplied, or from the\ncurrent working directory to the destination 'path'.  (Contributed\nby Richard Barran; bpo-1339796(20).)\n\nOn Windows, *note os.path.expandvars(): 122e. will now expand\nenvironment variables given in the form \"%var%\", and \"~user\" will\nbe expanded into the user's home directory path.  (Contributed by\nJosiah Carlson; bpo-957650(21).)\n\n* The Python debugger provided by the *note pdb: a0. module gained a\nnew command: \"run\" restarts the Python program being debugged and\ncan optionally take new command-line arguments for the program.\n(Contributed by Rocky Bernstein; bpo-1393667(22).)\n\n* The *note pdb.postmortem(): 122f. function, used to begin\ndebugging a traceback, will now use the traceback returned by *note\nsys.excinfo(): 456. if no traceback is supplied.  (Contributed by\nFacundo Batista; bpo-1106316(23).)\n\n* The *note pickletools: a2. module now has an 'optimize()' function\nthat takes a string containing a pickle and removes some unused\nopcodes, returning a shorter pickle that contains the same data\nstructure.  (Contributed by Raymond Hettinger.)\n\n* A 'getdata()' function was added to the *note pkgutil: a4. module\nthat returns the contents of resource files included with an\ninstalled Python package.  For example:\n\n>>> import pkgutil\n>>> print pkgutil.getdata('test', 'exceptionhierarchy.txt')\nBaseException\n+-- SystemExit\n+-- KeyboardInterrupt\n+-- GeneratorExit\n+-- Exception\n+-- StopIteration\n+-- StandardError\n...\n\n(Contributed by Paul Moore; bpo-2439(24).)\n\n* The 'pyexpat' module's 'Parser' objects now allow setting their\n'buffersize' attribute to change the size of the buffer used to\nhold character data.  (Contributed by Achim Gaedke; bpo-1137(25).)\n\n* The 'Queue' module now provides queue variants that retrieve\nentries in different orders.  The 'PriorityQueue' class stores\nqueued items in a heap and retrieves them in priority order, and\n'LifoQueue' retrieves the most recently added entries first,\nmeaning that it behaves like a stack.  (Contributed by Raymond\nHettinger.)\n\n* The *note random: b3. module's 'Random' objects can now be pickled\non a 32-bit system and unpickled on a 64-bit system, and vice\nversa.  Unfortunately, this change also means that Python 2.6's\n'Random' objects can't be unpickled correctly on earlier versions\nof Python.  (Contributed by Shawn Ligocki; bpo-1727780(26).)\n\nThe new 'triangular(low, high, mode)' function returns random\nnumbers following a triangular distribution.  The returned values\nare between 'low' and 'high', not including 'high' itself, and with\n'mode' as the most frequently occurring value in the distribution.\n(Contributed by Wladmir van der Laan and Raymond Hettinger;\nbpo-1681432(27).)\n\n* Long regular expression searches carried out by the *note re: b4.\nmodule will check for signals being delivered, so time-consuming\nsearches can now be interrupted.  (Contributed by Josh Hoyt and\nRalf Schmitt; bpo-846388(28).)\n\nThe regular expression module is implemented by compiling bytecodes\nfor a tiny regex-specific virtual machine.  Untrusted code could\ncreate malicious strings of bytecode directly and cause crashes, so\nPython 2.6 includes a verifier for the regex bytecode.\n(Contributed by Guido van Rossum from work for Google App Engine;\nbpo-3487(29).)\n\n* The *note rlcompleter: b8. module's 'Completer.complete()' method\nwill now ignore exceptions triggered while evaluating a name.\n(Fixed by Lorenz Quack; bpo-2250(30).)\n\n* The *note sched: ba. module's 'scheduler' instances now have a\nread-only *note queue: b1. attribute that returns the contents of\nthe scheduler's queue, represented as a list of named tuples with\nthe fields '(time, priority, action, argument)'.  (Contributed by\nRaymond Hettinger; bpo-1861(31).)\n\n* The *note select: bc. module now has wrapper functions for the\nLinux 'epoll()' and BSD 'kqueue()' system calls.  'modify()' method\nwas added to the existing 'poll' objects; 'pollobj.modify(fd,\neventmask)' takes a file descriptor or file object and an event\nmask, modifying the recorded event mask for that file.\n(Contributed by Christian Heimes; bpo-1657(32).)\n\n* The *note shutil.copytree(): 854. function now has an optional\n'ignore' argument that takes a callable object.  This callable will\nreceive each directory path and a list of the directory's contents,\nand returns a list of names that will be ignored, not copied.\n\nThe *note shutil: c0. module also provides an 'ignorepatterns()'\nfunction for use with this new parameter.  'ignorepatterns()'\ntakes an arbitrary number of glob-style patterns and returns a\ncallable that will ignore any files and directories that match any\nof these patterns.  The following example copies a directory tree,\nbut skips both '.svn' directories and Emacs backup files, which\nhave names ending with '~':\n\nshutil.copytree('Doc/library', '/tmp/library',\nignore=shutil.ignorepatterns('*~', '.svn'))\n\n(Contributed by Tarek Ziade'; bpo-2663(33).)\n\n* Integrating signal handling with GUI handling event loops like\nthose used by Tkinter or GTk+ has long been a problem; most\nsoftware ends up polling, waking up every fraction of a second to\ncheck if any GUI events have occurred.  The *note signal: c1.\nmodule can now make this more efficient.  Calling\n'signal.setwakeupfd(fd)' sets a file descriptor to be used; when\na signal is received, a byte is written to that file descriptor.\nThere's also a C-level function, *note PySignalSetWakeupFd():\n1230, for setting the descriptor.\n\nEvent loops will use this by opening a pipe to create two\ndescriptors, one for reading and one for writing.  The writable\ndescriptor will be passed to 'setwakeupfd()', and the readable\ndescriptor will be added to the list of descriptors monitored by\nthe event loop via 'select()' or 'poll()'.  On receiving a signal,\na byte will be written and the main event loop will be woken up,\navoiding the need to poll.\n\n(Contributed by Adam Olsen; bpo-1583(34).)\n\nThe 'siginterrupt()' function is now available from Python code,\nand allows changing whether signals can interrupt system calls or\nnot.  (Contributed by Ralf Schmitt.)\n\nThe 'setitimer()' and 'getitimer()' functions have also been added\n(where they're available).  'setitimer()' allows setting interval\ntimers that will cause a signal to be delivered to the process\nafter a specified time, measured in wall-clock time, consumed\nprocess time, or combined process+system time.  (Contributed by\nGuilherme Polo; bpo-2240(35).)\n\n* The *note smtplib: c4. module now supports SMTP over SSL thanks to\nthe addition of the 'SMTPSSL' class.  This class supports an\ninterface identical to the existing 'SMTP' class.  (Contributed by\nMonty Taylor.)  Both class constructors also have an optional\n'timeout' parameter that specifies a timeout for the initial\nconnection attempt, measured in seconds.  (Contributed by Facundo\nBatista.)\n\nAn implementation of the LMTP protocol ( RFC 2033(36)) was also\nadded to the module.  LMTP is used in place of SMTP when\ntransferring e-mail between agents that don't manage a mail queue.\n(LMTP implemented by Leif Hedstrom; bpo-957003(37).)\n\n'SMTP.starttls()' now complies with RFC 3207(38) and forgets any\nknowledge obtained from the server not obtained from the TLS\nnegotiation itself.  (Patch contributed by Bill Fenner;\nbpo-829951(39).)\n\n* The *note socket: c6. module now supports TIPC\n('https://tipc.sourceforge.net/'), a high-performance non-IP-based\nprotocol designed for use in clustered environments.  TIPC\naddresses are 4- or 5-tuples.  (Contributed by Alberto Bertogli;\nbpo-1646(40).)\n\nA new function, 'createconnection()', takes an address and\nconnects to it using an optional timeout value, returning the\nconnected socket object.  This function also looks up the address's\ntype and connects to it using IPv4 or IPv6 as appropriate.\nChanging your code to use 'createconnection()' instead of\n'socket(socket.AFINET, ...)' may be all that's required to make\nyour code work with IPv6.\n\n* The base classes in the *note SocketServer: c7. module now support\ncalling a *note handletimeout(): 1199. method after a span of\ninactivity specified by the server's *note timeout: 1198.\nattribute.  (Contributed by Michael Pomraning.)  The *note\nserveforever(): fb1. method now takes an optional poll interval\nmeasured in seconds, controlling how often the server will check\nfor a shutdown request.  (Contributed by Pedro Werneck and Jeffrey\nYasskin; bpo-742598(41), bpo-1193577(42).)\n\n* The *note sqlite3: c9. module, maintained by Gerhard Ha\"ring, has\nbeen updated from version 2.3.2 in Python 2.5 to version 2.4.1.\n\n* The *note struct: cf. module now supports the C99 Bool type, using\nthe format character ''?''.  (Contributed by David Remahl.)\n\n* The *note Popen: 8c3. objects provided by the *note subprocess: d0.\nmodule now have *note terminate(): 1231, *note kill(): 1232, and\n*note sendsignal(): 1233. methods.  On Windows, 'sendsignal()'\nonly supports the *note SIGTERM: 1234. signal, and all these\nmethods are aliases for the Win32 API function\n'TerminateProcess()'.  (Contributed by Christian Heimes.)\n\n* A new variable in the *note sys: d3. module, 'floatinfo', is an\nobject containing information derived from the 'float.h' file about\nthe platform's floating-point support.  Attributes of this object\ninclude 'mantdig' (number of digits in the mantissa), 'epsilon'\n(smallest difference between 1.0 and the next largest value\nrepresentable), and several others.  (Contributed by Christian\nHeimes; bpo-1534(43).)\n\nAnother new variable, 'dontwritebytecode', controls whether\nPython writes any '.pyc' or '.pyo' files on importing a module.  If\nthis variable is true, the compiled files are not written.  The\nvariable is initially set on start-up by supplying the *note -B:\n1222. switch to the Python interpreter, or by setting the *note\nPYTHONDONTWRITEBYTECODE: 1223. environment variable before running\nthe interpreter.  Python code can subsequently change the value of\nthis variable to control whether bytecode files are written or not.\n(Contributed by Neal Norwitz and Georg Brandl.)\n\nInformation about the command-line arguments supplied to the Python\ninterpreter is available by reading attributes of a named tuple\navailable as 'sys.flags'.  For example, the 'verbose' attribute is\ntrue if Python was executed in verbose mode, 'debug' is true in\ndebugging mode, etc.  These attributes are all read-only.\n(Contributed by Christian Heimes.)\n\nA new function, 'getsizeof()', takes a Python object and returns\nthe amount of memory used by the object, measured in bytes.\nBuilt-in objects return correct results; third-party extensions may\nnot, but can define a 'sizeof()' method to return the object's\nsize.  (Contributed by Robert Schuppenies; bpo-2898(44).)\n\nIt's now possible to determine the current profiler and tracer\nfunctions by calling *note sys.getprofile(): 1235. and *note\nsys.gettrace(): 1236.  (Contributed by Georg Brandl; bpo-1648(45).)\n\n* The *note tarfile: d8. module now supports POSIX.1-2001 (pax)\ntarfiles in addition to the POSIX.1-1988 (ustar) and GNU tar\nformats that were already supported.  The default format is GNU\ntar; specify the 'format' parameter to open a file using a\ndifferent format:\n\ntar = tarfile.open(\"output.tar\", \"w\",\nformat=tarfile.PAXFORMAT)\n\nThe new 'encoding' and 'errors' parameters specify an encoding and\nan error handling scheme for character conversions.  ''strict'',\n''ignore'', and ''replace'' are the three standard ways Python can\nhandle errors,; ''utf-8'' is a special value that replaces bad\ncharacters with their UTF-8 representation.  (Character conversions\noccur because the PAX format supports Unicode filenames, defaulting\nto UTF-8 encoding.)\n\nThe 'TarFile.add()' method now accepts an 'exclude' argument that's\na function that can be used to exclude certain filenames from an\narchive.  The function must take a filename and return true if the\nfile should be excluded or false if it should be archived.  The\nfunction is applied to both the name initially passed to 'add()'\nand to the names of files in recursively added directories.\n\n(All changes contributed by Lars Gusta\"bel).\n\n* An optional 'timeout' parameter was added to the *note\ntelnetlib.Telnet: b38. class constructor, specifying a timeout\nmeasured in seconds.  (Added by Facundo Batista.)\n\n* The *note tempfile.NamedTemporaryFile: 1ea. class usually deletes\nthe temporary file it created when the file is closed.  This\nbehaviour can now be changed by passing 'delete=False' to the\nconstructor.  (Contributed by Damien Miller; bpo-1537850(46).)\n\nA new class, 'SpooledTemporaryFile', behaves like a temporary file\nbut stores its data in memory until a maximum size is exceeded.  On\nreaching that limit, the contents will be written to an on-disk\ntemporary file.  (Contributed by Dustin J. Mitchell.)\n\nThe 'NamedTemporaryFile' and 'SpooledTemporaryFile' classes both\nwork as context managers, so you can write 'with\ntempfile.NamedTemporaryFile() as tmp: ...'.  (Contributed by\nAlexander Belopolsky; bpo-2021(47).)\n\n* The *note test.testsupport: de. module gained a number of context\nmanagers useful for writing tests.  *note EnvironmentVarGuard():\n1237. is a context manager that temporarily changes environment\nvariables and automatically restores them to their old values.\n\nAnother context manager, 'TransientResource', can surround calls to\nresources that may or may not be available; it will catch and\nignore a specified list of exceptions.  For example, a network test\nmay ignore certain failures when connecting to an external web\nsite:\n\nwith testsupport.TransientResource(IOError,\nerrno=errno.ETIMEDOUT):\nf = urllib.urlopen('https://sf.net')\n...\n\nFinally, 'checkwarnings()' resets the 'warning' module's warning\nfilters and returns an object that will record all warning messages\ntriggered (bpo-3781(48)):\n\nwith testsupport.checkwarnings() as wrec:\nwarnings.simplefilter(\"always\")\n# ... code that triggers a warning ...\nassert str(wrec.message) == \"function is outdated\"\nassert len(wrec.warnings) == 1, \"Multiple warnings raised\"\n\n(Contributed by Brett Cannon.)\n\n* The *note textwrap: e6. module can now preserve existing whitespace\nat the beginnings and ends of the newly created lines by specifying\n'dropwhitespace=False' as an argument:\n\n>>> S = \"\"\"This  sentence  has a bunch   of\n...   extra   whitespace.\"\"\"\n>>> print textwrap.fill(S, width=15)\nThis  sentence\nhas a bunch\nof    extra\nwhitespace.\n>>> print textwrap.fill(S, dropwhitespace=False, width=15)\nThis  sentence\nhas a bunch\nof    extra\nwhitespace.\n>>>\n\n(Contributed by Dwayne Bailey; bpo-1581073(49).)\n\n* The *note threading: e7. module API is being changed to use\nproperties such as 'daemon' instead of 'setDaemon()' and\n'isDaemon()' methods, and some methods have been renamed to use\nunderscores instead of camel-case; for example, the 'activeCount()'\nmethod is renamed to 'activecount()'.  Both the 2.6 and 3.0\nversions of the module support the same properties and renamed\nmethods, but don't remove the old methods.  No date has been set\nfor the deprecation of the old APIs in Python 3.x; the old APIs\nwon't be removed in any 2.x version.  (Carried out by several\npeople, most notably Benjamin Peterson.)\n\nThe *note threading: e7. module's 'Thread' objects gained an\n'ident' property that returns the thread's identifier, a nonzero\ninteger.  (Contributed by Gregory P. Smith; bpo-2871(50).)\n\n* The *note timeit: e9. module now accepts callables as well as\nstrings for the statement being timed and for the setup code.  Two\nconvenience functions were added for creating 'Timer' instances:\n'repeat(stmt, setup, time, repeat, number)' and 'timeit(stmt,\nsetup, time, number)' create an instance and call the corresponding\nmethod.  (Contributed by Erik Demaine; bpo-1533909(51).)\n\n* The 'Tkinter' module now accepts lists and tuples for options,\nseparating the elements by spaces before passing the resulting\nvalue to Tcl/Tk.  (Contributed by Guilherme Polo; bpo-2906(52).)\n\n* The *note turtle: fc. module for turtle graphics was greatly\nenhanced by Gregor Lingl.  New features in the module include:\n\n* Better animation of turtle movement and rotation.\n\n* Control over turtle movement using the new 'delay()',\n'tracer()', and 'speed()' methods.\n\n* The ability to set new shapes for the turtle, and to define a\nnew coordinate system.\n\n* Turtles now have an 'undo()' method that can roll back\nactions.\n\n* Simple support for reacting to input events such as mouse and\nkeyboard activity, making it possible to write simple games.\n\n* A 'turtle.cfg' file can be used to customize the starting\nappearance of the turtle's screen.\n\n* The module's docstrings can be replaced by new docstrings that\nhave been translated into another language.\n\n(bpo-1513695(53))\n\n* An optional 'timeout' parameter was added to the *note\nurllib.urlopen: cf9. function and the 'urllib.ftpwrapper' class\nconstructor, as well as the *note urllib2.urlopen: cf9. function.\nThe parameter specifies a timeout measured in seconds.  For\nexample:\n\n>>> u = urllib2.urlopen(\"http://slow.example.com\",\ntimeout=3)\nTraceback (most recent call last):\n...\nurllib2.URLError: <urlopen error timed out>\n>>>\n\n(Added by Facundo Batista.)\n\n* The Unicode database provided by the *note unicodedata: 100. module\nhas been updated to version 5.1.0.  (Updated by Martin von Lo\"wis;\nbpo-3811(54).)\n\n* The *note warnings: 10d. module's 'formatwarning()' and\n'showwarning()' gained an optional 'line' argument that can be used\nto supply the line of source code.  (Added as part of\nbpo-1631171(55), which re-implemented part of the *note warnings:\n10d. module in C code.)\n\nA new function, 'catchwarnings()', is a context manager intended\nfor testing purposes that lets you temporarily modify the warning\nfilters and then restore their original values (bpo-3781(56)).\n\n* The XML-RPC *note SimpleXMLRPCServer: 129. and *note\nDocXMLRPCServer: 129. classes can now be prevented from immediately\nopening and binding to their socket by passing 'False' as the\n'bindandactivate' constructor parameter.  This can be used to\nmodify the instance's 'allowreuseaddress' attribute before\ncalling the 'serverbind()' and 'serveractivate()' methods to open\nthe socket and begin listening for connections.  (Contributed by\nPeter Parente; bpo-1599845(57).)\n\n'SimpleXMLRPCServer' also has a 'sendtracebackheader' attribute;\nif true, the exception and formatted traceback are returned as HTTP\nheaders \"X-Exception\" and \"X-Traceback\".  This feature is for\ndebugging purposes only and should not be used on production\nservers because the tracebacks might reveal passwords or other\nsensitive information.  (Contributed by Alan McIntyre as part of\nhis project for Google's Summer of Code 2007.)\n\n* The *note xmlrpclib: 128. module no longer automatically converts\n*note datetime.date: 70f. and *note datetime.time: 6a5. to the\n*note xmlrpclib.DateTime: 1238. type; the conversion semantics were\nnot necessarily correct for all applications.  Code using\n'xmlrpclib' should convert 'date' and *note time: 6a5. instances.\n(bpo-1330538(58)) The code can also handle dates before 1900\n(contributed by Ralf Schmitt; bpo-2014(59)) and 64-bit integers\nrepresented by using '<i8>' in XML-RPC responses (contributed by\nRiku Lindblad; bpo-2985(60)).\n\n* The *note zipfile: 12b. module's 'ZipFile' class now has\n'extract()' and 'extractall()' methods that will unpack a single\nfile or all the files in the archive to the current directory, or\nto a specified directory:\n\nz = zipfile.ZipFile('python-251.zip')\n\n# Unpack a single file, writing it relative\n# to the /tmp directory.\nz.extract('Python/sysmodule.c', '/tmp')\n\n# Unpack all the files in the archive.\nz.extractall()\n\n(Contributed by Alan McIntyre; bpo-467924(61).)\n\nThe *note open(): 26e, 'read()' and 'extract()' methods can now\ntake either a filename or a 'ZipInfo' object.  This is useful when\nan archive accidentally contains a duplicated filename.\n(Contributed by Graham Horler; bpo-1775025(62).)\n\nFinally, *note zipfile: 12b. now supports using Unicode filenames\nfor archived files.  (Contributed by Alexey Borzenkov;\nbpo-1734346(63).)\n\n* Menu:\n\n* The ast module::\n* The futurebuiltins module::\n* The json module; JavaScript Object Notation: The json module JavaScript Object Notation.\n* The plistlib module; A Property-List Parser: The plistlib module A Property-List Parser.\n* ctypes Enhancements::\n* Improved SSL Support::\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=1736190\n\n(2) https://www.jcea.es/programacion/pybsddb.htm\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=1817\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=600362\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=1381\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=1638033\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=1158\n\n(8) https://speleotrove.com/decimal/decarith.html\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=1221598\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=1739906\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=1001604\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=2138\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=2819\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=711019\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=1640\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=1663329\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=1181\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=1273829\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=1115886\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=1339796\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=957650\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=1393667\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=1106316\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=2439\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=1137\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=1727780\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=1681432\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=846388\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=3487\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=2250\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=1861\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=1657\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=2663\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=1583\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=2240\n\n(36) https://datatracker.ietf.org/doc/html/rfc2033.html\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=957003\n\n(38) https://datatracker.ietf.org/doc/html/rfc3207.html\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=829951\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=1646\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=742598\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=1193577\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=1534\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=2898\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=1648\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=1537850\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=2021\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=3781\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=1581073\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=2871\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=1533909\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=2906\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=1513695\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=3811\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=1631171\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=3781\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=1599845\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=1330538\n\n(59) https://bugs.python.org/issue?@action=redirect&bpo=2014\n\n(60) https://bugs.python.org/issue?@action=redirect&bpo=2985\n\n(61) https://bugs.python.org/issue?@action=redirect&bpo=467924\n\n(62) https://bugs.python.org/issue?@action=redirect&bpo=1775025\n\n(63) https://bugs.python.org/issue?@action=redirect&bpo=1734346\n\nFile: python3.12.info,  Node: The ast module,  Next: The futurebuiltins module,  Up: New and Improved Modules<2>\n\n1.15.18.1 The 'ast' module\n..........................\n\nThe *note ast: 8. module provides an Abstract Syntax Tree representation\nof Python code, and Armin Ronacher contributed a set of helper functions\nthat perform a variety of common tasks.  These will be useful for HTML\ntemplating packages, code analyzers, and similar tools that process\nPython code.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: New module importlib,  Next: New module sysconfig,  Up: New and Improved Modules": {
            "content": "1.14.11.1 New module: importlib\n...............................\n\nPython 3.1 includes the *note importlib: 71. package, a\nre-implementation of the logic underlying Python's *note import: 3a6.\nstatement.  *note importlib: 71. is useful for implementors of Python\ninterpreters and to users who wish to write new importers that can\nparticipate in the import process.  Python 2.7 doesn't contain the\ncomplete *note importlib: 71. package, but instead has a tiny subset\nthat contains a single function, *note importmodule(): 26a.\n\n'importmodule(name, package=None)' imports a module.  'name' is a\nstring containing the module or package's name.  It's possible to do\nrelative imports by providing a string that begins with a '.' character,\nsuch as '..utils.errors'.  For relative imports, the 'package' argument\nmust be provided and is the name of the package that will be used as the\nanchor for the relative import.  *note importmodule(): 26a. both\ninserts the imported module into 'sys.modules' and returns the module\nobject.\n\nHere are some examples:\n\n>>> from importlib import importmodule\n>>> anydbm = importmodule('anydbm')  # Standard absolute import\n>>> anydbm\n<module 'anydbm' from '/p/python/Lib/anydbm.py'>\n>>> # Relative import\n>>> fileutil = importmodule('..fileutil', 'distutils.command')\n>>> fileutil\n<module 'distutils.fileutil' from '/python/Lib/distutils/fileutil.pyc'>\n\n*note importlib: 71. was implemented by Brett Cannon and introduced in\nPython 3.1.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: New module sysconfig,  Next: ttk Themed Widgets for Tk,  Prev: New module importlib,  Up: New and Improved Modules": {
            "content": "1.14.11.2 New module: sysconfig\n...............................\n\nThe *note sysconfig: d5. module has been pulled out of the Distutils\npackage, becoming a new top-level module in its own right.  *note\nsysconfig: d5. provides functions for getting information about Python's\nbuild process: compiler switches, installation paths, the platform name,\nand whether Python is running from its source directory.\n\nSome of the functions in the module are:\n\n* *note getconfigvar(): ea2. returns variables from Python's\nMakefile and the 'pyconfig.h' file.\n\n* *note getconfigvars(): ea3. returns a dictionary containing all\nof the configuration variables.\n\n* *note getpath(): 11a6. returns the configured path for a\nparticular type of module: the standard library, site-specific\nmodules, platform-specific modules, etc.\n\n* *note ispythonbuild(): 11a7. returns true if you're running a\nbinary from a Python source tree, and false otherwise.\n\nConsult the *note sysconfig: d5. documentation for more details and for\na complete list of functions.\n\nThe Distutils package and *note sysconfig: d5. are now maintained by",
            "subsections": []
        },
        "Tarek Ziade', who has also started a Distutils2 package (source": {
            "content": "repository at 'https://hg.python.org/distutils2/') for developing a\nnext-generation version of Distutils.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ttk Themed Widgets for Tk,  Next: Updated module unittest,  Prev: New module sysconfig,  Up: New and Improved Modules": {
            "content": "1.14.11.3 ttk: Themed Widgets for Tk\n....................................\n",
            "subsections": []
        },
        "Tcl/Tk 8.5 includes a set of themed widgets that re-implement basic Tk": {
            "content": "widgets but have a more customizable appearance and can therefore more\nclosely resemble the native platform's widgets.  This widget set was\noriginally called Tile, but was renamed to Ttk (for \"themed Tk\") on\nbeing added to Tcl/Tck release 8.5.\n\nTo learn more, read the *note ttk: f4. module documentation.  You may\nalso wish to read the Tcl/Tk manual page describing the Ttk theme\nengine, available at\n'https://www.tcl.tk/man/tcl8.5/TkCmd/ttkintro.html'.  Some screenshots\nof the Python/Ttk code in use are at\n'https://code.google.com/archive/p/python-ttk/wikis/Screenshots.wiki'.\n\nThe *note tkinter.ttk: f4. module was written by Guilherme Polo and\nadded in bpo-2983(1).  An alternate version called 'Tile.py', written by",
            "subsections": []
        },
        "Martin Franklin and maintained by Kevin Walzer, was proposed for": {
            "content": "inclusion in bpo-2618(2), but the authors argued that Guilherme Polo's\nwork was more comprehensive.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=2983\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=2618\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Updated module unittest,  Next: Updated module ElementTree 1 3,  Prev: ttk Themed Widgets for Tk,  Up: New and Improved Modules": {
            "content": "1.14.11.4 Updated module: unittest\n..................................\n\nThe *note unittest: 101. module was greatly enhanced; many new features\nwere added.  Most of these features were implemented by Michael Foord,\nunless otherwise noted.  The enhanced version of the module is\ndownloadable separately for use with Python versions 2.4 to 2.6,\npackaged as the 'unittest2' package, from\n'https://pypi.org/project/unittest2'.\n",
            "subsections": []
        },
        "When used from the command line, the module can automatically discover": {
            "content": "tests.  It's not as fancy as py.test(1) or nose(2), but provides a\nsimple way to run tests kept within a set of package directories.  For\nexample, the following command will search the 'test/' subdirectory for\nany importable test files named 'test*.py':\n\npython -m unittest discover -s test\n\nConsult the *note unittest: 101. module documentation for more details.\n(Developed in bpo-6001(3).)\n\nThe *note main(): e56. function supports some other new options:\n\n* *note -b: 11ab. or '--buffer' will buffer the standard output and\nstandard error streams during each test.  If the test passes, any\nresulting output will be discarded; on failure, the buffered output\nwill be displayed.\n\n* *note -c: 11ac. or '--catch' will cause the control-C interrupt to\nbe handled more gracefully.  Instead of interrupting the test\nprocess immediately, the currently running test will be completed\nand then the partial results up to the interruption will be\nreported.  If you're impatient, a second press of control-C will\ncause an immediate interruption.\n\nThis control-C handler tries to avoid causing problems when the\ncode being tested or the tests being run have defined a signal\nhandler of their own, by noticing that a signal handler was already\nset and calling it.  If this doesn't work for you, there's a *note\nremoveHandler(): 11ad. decorator that can be used to mark tests\nthat should have the control-C handling disabled.\n\n* *note -f: 11ae. or '--failfast' makes test execution stop\nimmediately when a test fails instead of continuing to execute\nfurther tests.  (Suggested by Cliff Dyer and implemented by Michael\nFoord; bpo-8074(4).)\n",
            "subsections": []
        },
        "The progress messages now show 'x' for expected failures and 'u' for": {
            "content": "unexpected successes when run in verbose mode.  (Contributed by Benjamin",
            "subsections": []
        },
        "Peterson.)": {
            "content": "Test cases can raise the *note SkipTest: e57. exception to skip a test\n(bpo-1034053(5)).\n\nThe error messages for *note assertEqual(): 27d, *note assertTrue():\n27b, and *note assertFalse(): 27c. failures now provide more\ninformation.  If you set the *note longMessage: 11af. attribute of your\n*note TestCase: 159. classes to true, both the standard error message\nand any additional message you provide will be printed for failures.\n(Added by Michael Foord; bpo-5663(6).)\n\nThe *note assertRaises(): 281. method now returns a context handler when\ncalled without providing a callable object to run.  For example, you can\nwrite this:\n\nwith self.assertRaises(KeyError):\n{}['foo']\n\n(Implemented by Antoine Pitrou; bpo-4444(7).)\n\nModule- and class-level setup and teardown fixtures are now supported.\nModules can contain 'setUpModule()' and 'tearDownModule()' functions.\nClasses can have *note setUpClass(): 87b. and *note tearDownClass():\n11b0. methods that must be defined as class methods (using\n'@classmethod' or equivalent).  These functions and methods are invoked\nwhen the test runner switches to a test case in a different module or\nclass.\n\nThe methods *note addCleanup(): 8af. and *note doCleanups(): 11b1. were\nadded.  *note addCleanup(): 8af. lets you add cleanup functions that\nwill be called unconditionally (after *note setUp(): 11b2. if *note\nsetUp(): 11b2. fails, otherwise after *note tearDown(): 11b3.).  This\nallows for much simpler resource allocation and deallocation during\ntests (bpo-5679(8)).\n\nA number of new methods were added that provide more specialized tests.",
            "subsections": []
        },
        "Many of these methods were written by Google engineers for use in their": {
            "content": "test suites; Gregory P. Smith, Michael Foord, and GvR worked on merging\nthem into Python's version of *note unittest: 101.\n\n* *note assertIsNone(): 1103. and *note assertIsNotNone(): 1104. take\none expression and verify that the result is or is not 'None'.\n\n* *note assertIs(): 11b4. and *note assertIsNot(): 11b5. take two\nvalues and check whether the two values evaluate to the same object\nor not.  (Added by Michael Foord; bpo-2578(9).)\n\n* *note assertIsInstance(): 11b6. and *note assertNotIsInstance():\n11b7. check whether the resulting object is an instance of a\nparticular class, or of one of a tuple of classes.  (Added by Georg\nBrandl; bpo-7031(10).)\n\n* *note assertGreater(): 11b8, *note assertGreaterEqual(): 11b9,\n*note assertLess(): 11ba, and *note assertLessEqual(): 11bb.\ncompare two quantities.\n\n* *note assertMultiLineEqual(): 11bc. compares two strings, and if\nthey're not equal, displays a helpful comparison that highlights\nthe differences in the two strings.  This comparison is now used by\ndefault when Unicode strings are compared with *note assertEqual():\n27d.\n\n* *note assertRegexpMatches(): 282. and *note\nassertNotRegexpMatches(): 284. checks whether the first argument is\na string matching or not matching the regular expression provided\nas the second argument (bpo-8038(11)).\n\n* *note assertRaisesRegexp(): 283. checks whether a particular\nexception is raised, and then also checks that the string\nrepresentation of the exception matches the provided regular\nexpression.\n\n* *note assertIn(): 11bd. and *note assertNotIn(): 11be. tests\nwhether 'first' is or is not in 'second'.\n\n* *note assertItemsEqual(): 10a0. tests whether two provided\nsequences contain the same elements.\n\n* *note assertSetEqual(): 10fe. compares whether two sets are equal,\nand only reports the differences between the sets in case of error.\n\n* Similarly, *note assertListEqual(): 1100. and *note\nassertTupleEqual(): 1101. compare the specified types and explain\nany differences without necessarily printing their full values;\nthese methods are now used by default when comparing lists and\ntuples using *note assertEqual(): 27d.  More generally, *note\nassertSequenceEqual(): 1102. compares two sequences and can\noptionally check whether both sequences are of a particular type.\n\n* *note assertDictEqual(): 10ff. compares two dictionaries and\nreports the differences; it's now used by default when you compare\ntwo dictionaries using *note assertEqual(): 27d.\n'assertDictContainsSubset()' checks whether all of the key/value\npairs in 'first' are found in 'second'.\n\n* *note assertAlmostEqual(): 27f. and *note assertNotAlmostEqual():\n280. test whether 'first' and 'second' are approximately equal.\nThis method can either round their difference to an optionally\nspecified number of 'places' (the default is 7) and compare it to\nzero, or require the difference to be smaller than a supplied\n'delta' value.\n\n* *note loadTestsFromName(): 11bf. properly honors the *note\nsuiteClass: 11c0. attribute of the *note TestLoader: 506.  (Fixed\nby Mark Roddy; bpo-6866(12).)\n\n* A new hook lets you extend the *note assertEqual(): 27d. method to\nhandle new data types.  The *note addTypeEqualityFunc(): 11c1.\nmethod takes a type object and a function.  The function will be\nused when both of the objects being compared are of the specified\ntype.  This function should compare the two objects and raise an\nexception if they don't match; it's a good idea for the function to\nprovide additional information about why the two objects aren't\nmatching, much as the new sequence comparison methods do.\n\n*note unittest.main(): e56. now takes an optional 'exit' argument.  If\nfalse, *note main(): e56. doesn't call *note sys.exit(): 11c2, allowing\n*note main(): e56. to be used from the interactive interpreter.\n(Contributed by J. Pablo Fern??ndez; bpo-3379(13).)\n\n*note TestResult: fdc. has new *note startTestRun(): 11c3. and *note\nstopTestRun(): 11c4. methods that are called immediately before and\nafter a test run.  (Contributed by Robert Collins; bpo-5728(14).)\n",
            "subsections": []
        },
        "With all these changes, the 'unittest.py' was becoming awkwardly large,": {
            "content": "so the module was turned into a package and the code split into several\nfiles (by Benjamin Peterson).  This doesn't affect how the module is\nimported or used.\n\nSee also\n........\n\n'https://web.archive.org/web/20210619163128/http://www.voidspace.org.uk/python/articles/unittest2.shtml'\n\nDescribes the new features, how to use them, and the rationale for\nvarious design decisions.  (By Michael Foord.)\n\n---------- Footnotes ----------\n\n(1) https://pytest.org\n\n(2) https://nose.readthedocs.io/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=6001\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=8074\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=1034053\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=5663\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=4444\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=5679\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=2578\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=7031\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=8038\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=6866\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=3379\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=5728\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Updated module ElementTree 1 3,  Prev: Updated module unittest,  Up: New and Improved Modules": {
            "content": "1.14.11.5 Updated module: ElementTree 1.3\n.........................................\n",
            "subsections": []
        },
        "The version of the ElementTree library included with Python was updated": {
            "content": "to version 1.3.  Some of the new features are:\n\n* The various parsing functions now take a 'parser' keyword argument\ngiving an *note XMLParser: 880. instance that will be used.  This\nmakes it possible to override the file's internal encoding:\n\np = ET.XMLParser(encoding='utf-8')\nt = ET.XML(\"\"\"<root/>\"\"\", parser=p)\n\nErrors in parsing XML now raise a *note ParseError: 10f0.\nexception, whose instances have a 'position' attribute containing a\n('line', 'column') tuple giving the location of the problem.\n\n* ElementTree's code for converting trees to a string has been\nsignificantly reworked, making it roughly twice as fast in many\ncases.  The *note ElementTree.write(): e6a. and 'Element.write()'\nmethods now have a 'method' parameter that can be \"xml\" (the\ndefault), \"html\", or \"text\".  HTML mode will output empty elements\nas '<empty></empty>' instead of '<empty/>', and text mode will skip\nover elements and only output the text chunks.  If you set the\n*note tag: 11c7. attribute of an element to 'None' but leave its\nchildren in place, the element will be omitted when the tree is\nwritten out, so you don't need to do more extensive rearrangement\nto remove a single element.\n\nNamespace handling has also been improved.  All 'xmlns:<whatever>'\ndeclarations are now output on the root element, not scattered\nthroughout the resulting XML. You can set the default namespace for\na tree by setting the 'defaultnamespace' attribute and can\nregister new prefixes with *note registernamespace(): 1046.  In\nXML mode, you can use the true/false 'xmldeclaration' parameter to\nsuppress the XML declaration.\n\n* New *note Element: 23e. method: *note extend(): 1047. appends the\nitems from a sequence to the element's children.  Elements\nthemselves behave like sequences, so it's easy to move children\nfrom one element to another:\n\nfrom xml.etree import ElementTree as ET\n\nt = ET.XML(\"\"\"<list>\n<item>1</item> <item>2</item>  <item>3</item>\n</list>\"\"\")\nnew = ET.XML('<root/>')\nnew.extend(t)\n\n# Outputs <root><item>1</item>...</root>\nprint ET.tostring(new)\n\n* New *note Element: 23e. method: *note iter(): 11c8. yields the\nchildren of the element as a generator.  It's also possible to\nwrite 'for child in elem:' to loop over an element's children.  The\nexisting method 'getiterator()' is now deprecated, as is\n'getchildren()' which constructs and returns a list of children.\n\n* New *note Element: 23e. method: *note itertext(): 1049. yields all\nchunks of text that are descendants of the element.  For example:\n\nt = ET.XML(\"\"\"<list>\n<item>1</item> <item>2</item>  <item>3</item>\n</list>\"\"\")\n\n# Outputs ['\\n  ', '1', ' ', '2', '  ', '3', '\\n']\nprint list(t.itertext())\n\n* Deprecated: using an element as a Boolean (i.e., 'if elem:') would\nreturn true if the element had any children, or false if there were\nno children.  This behaviour is confusing - 'None' is false, but so\nis a childless element?  - so it will now trigger a *note\nFutureWarning: 23f.  In your code, you should be explicit: write\n'len(elem) != 0' if you're interested in the number of children, or\n'elem is not None'.\n",
            "subsections": []
        },
        "Fredrik Lundh develops ElementTree and produced the 1.3 version; you can": {
            "content": "read his article describing 1.3 at\n'https://web.archive.org/web/20200703234532/http://effbot.org/zone/elementtree-13-intro.htm'.",
            "subsections": []
        },
        "Florent Xicluna updated the version included with Python, after": {
            "content": "discussions on python-dev and in bpo-6472(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=6472\n\nFile: python3.12.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\n\n\nChanges to Python's build process and to the C API include:\n\n* The latest release of the GNU Debugger, GDB 7, can be scripted\nusing Python(1).  When you begin debugging an executable program P,\nGDB will look for a file named 'P-gdb.py' and automatically read\nit.  Dave Malcolm contributed a 'python-gdb.py' that adds a number\nof commands useful when debugging Python itself.  For example,\n'py-up' and 'py-down' go up or down one Python stack frame, which\nusually corresponds to several C stack frames.  'py-print' prints\nthe value of a Python variable, and 'py-bt' prints the Python stack\ntrace.  (Added as a result of bpo-8032(2).)\n\n* If you use the '.gdbinit' file provided with Python, the \"pyo\"\nmacro in the 2.7 version now works correctly when the thread being\ndebugged doesn't hold the GIL; the macro now acquires it before\nprinting.  (Contributed by Victor Stinner; bpo-3632(3).)\n\n* *note PyAddPendingCall(): 7a5. is now thread-safe, letting any\nworker thread submit notifications to the main Python thread.  This\nis particularly useful for asynchronous IO operations.\n(Contributed by Kristj??n Valur J??nsson; bpo-4293(4).)\n\n* New function: *note PyCodeNewEmpty(): 11ca. creates an empty code\nobject; only the filename, function name, and first line number are\nrequired.  This is useful for extension modules that are attempting\nto construct a more useful traceback stack.  Previously such\nextensions needed to call 'PyCodeNew()', which had many more\narguments.  (Added by Jeffrey Yasskin.)\n\n* New function: *note PyErrNewExceptionWithDoc(): 10e1. creates a\nnew exception class, just as the existing *note\nPyErrNewException(): 10e2. does, but takes an extra 'char *'\nargument containing the docstring for the new exception class.\n(Added by 'lekma' on the Python bug tracker; bpo-7033(5).)\n\n* New function: *note PyFrameGetLineNumber(): 577. takes a frame\nobject and returns the line number that the frame is currently\nexecuting.  Previously code would need to get the index of the\nbytecode instruction currently executing, and then look up the line\nnumber corresponding to that address.  (Added by Jeffrey Yasskin.)\n\n* New functions: *note PyLongAsLongAndOverflow(): 10df. and *note\nPyLongAsLongLongAndOverflow(): 10de. approximates a Python long\ninteger as a C long or long long.  If the number is too large to\nfit into the output type, an 'overflow' flag is set and returned to\nthe caller.  (Contributed by Case Van Horsen; bpo-7528(6) and\nbpo-7767(7).)\n\n* New function: stemming from the rewrite of string-to-float\nconversion, a new *note PyOSstringtodouble(): 110e. function was\nadded.  The old 'PyOSasciistrtod()' and 'PyOSasciiatof()'\nfunctions are now deprecated.\n\n* New function: *note PySysSetArgvEx(): 11cb. sets the value of\n'sys.argv' and can optionally update 'sys.path' to include the\ndirectory containing the script named by 'sys.argv[0]' depending on\nthe value of an 'updatepath' parameter.\n\nThis function was added to close a security hole for applications\nthat embed Python.  The old function, *note PySysSetArgv(): 11cc,\nwould always update 'sys.path', and sometimes it would add the\ncurrent directory.  This meant that, if you ran an application\nembedding Python in a directory controlled by someone else,\nattackers could put a Trojan-horse module in the directory (say, a\nfile named 'os.py') that your application would then import and\nrun.\n\nIf you maintain a C/C++ application that embeds Python, check\nwhether you're calling *note PySysSetArgv(): 11cc. and carefully\nconsider whether the application should be using *note\nPySysSetArgvEx(): 11cb. with 'updatepath' set to false.\n\nSecurity issue reported as CVE-2008-5983(8); discussed in\nbpo-5753(9), and fixed by Antoine Pitrou.\n\n* New macros: the Python header files now define the following\nmacros: 'PyISALNUM', 'PyISALPHA', 'PyISDIGIT', 'PyISLOWER',\n'PyISSPACE', 'PyISUPPER', 'PyISXDIGIT', 'PyTOLOWER', and\n'PyTOUPPER'.  All of these functions are analogous to the C\nstandard macros for classifying characters, but ignore the current\nlocale setting, because in several places Python needs to analyze\ncharacters in a locale-independent way.  (Added by Eric Smith;\nbpo-5793(10).)\n\n* Removed function: 'PyEvalCallObject()' is now only available as a\nmacro.  A function version was being kept around to preserve ABI\nlinking compatibility, but that was in 1997; it can certainly be\ndeleted by now.  (Removed by Antoine Pitrou; bpo-8276(11).)\n\n* New format codes: the 'PyStringFromFormat()',\n'PyStringFromFormatV()', and *note PyErrFormat(): d16. functions\nnow accept '%lld' and '%llu' format codes for displaying C's long\nlong types.  (Contributed by Mark Dickinson; bpo-7228(12).)\n\n* The complicated interaction between threads and process forking has\nbeen changed.  Previously, the child process created by *note\nos.fork(): 231. might fail because the child is created with only a\nsingle thread running, the thread performing the *note os.fork():\n231.  If other threads were holding a lock, such as Python's import\nlock, when the fork was performed, the lock would still be marked\nas \"held\" in the new process.  But in the child process nothing\nwould ever release the lock, since the other threads weren't\nreplicated, and the child process would no longer be able to\nperform imports.\n\nPython 2.7 acquires the import lock before performing an *note\nos.fork(): 231, and will also clean up any locks created using the\n*note threading: e7. module.  C extension modules that have\ninternal locks, or that call 'fork()' themselves, will not benefit\nfrom this clean-up.\n\n(Fixed by Thomas Wouters; bpo-1590864(13).)\n\n* The *note PyFinalize(): 11cd. function now calls the internal\n'threading.shutdown()' function; this prevents some exceptions\nfrom being raised when an interpreter shuts down.  (Patch by Adam\nOlsen; bpo-1722344(14).)\n\n* When using the *note PyMemberDef: 2a7. structure to define\nattributes of a type, Python will no longer let you try to delete\nor set a 'TSTRINGINPLACE' attribute.\n\n* Global symbols defined by the *note ctypes: 28. module are now\nprefixed with 'Py', or with 'ctypes'.  (Implemented by Thomas\nHeller; bpo-3102(15).)\n\n* New configure option: the '--with-system-expat' switch allows\nbuilding the *note pyexpat: 121. module to use the system Expat\nlibrary.  (Contributed by Arfrever Frehtes Taifersar Arahesis;\nbpo-7609(16).)\n\n* New configure option: the '--with-valgrind' option will now disable\nthe pymalloc allocator, which is difficult for the Valgrind\nmemory-error detector to analyze correctly.  Valgrind will\ntherefore be better at detecting memory leaks and overruns.\n(Contributed by James Henstridge; bpo-2422(17).)\n\n* New configure option: you can now supply an empty string to\n'--with-dbmliborder=' in order to disable all of the various DBM\nmodules.  (Added by Arfrever Frehtes Taifersar Arahesis;\nbpo-6491(18).)\n\n* The 'configure' script now checks for floating-point rounding bugs\non certain 32-bit Intel chips and defines a 'X87DOUBLEROUNDING'\npreprocessor definition.  No code currently uses this definition,\nbut it's available if anyone wishes to use it.  (Added by Mark\nDickinson; bpo-2937(19).)\n\n'configure' also now sets a 'LDCXXSHARED' Makefile variable for\nsupporting C++ linking.  (Contributed by Arfrever Frehtes Taifersar\nArahesis; bpo-1222585(20).)\n\n* The build process now creates the necessary files for pkg-config\nsupport.  (Contributed by Clinton Roy; bpo-3585(21).)\n\n* The build process now supports Subversion 1.7.  (Contributed by\nArfrever Frehtes Taifersar Arahesis; bpo-6094(22).)\n\n* Menu:\n\n* Capsules::\n* Port-Specific Changes; Windows: Port-Specific Changes Windows.\n* Port-Specific Changes; Mac OS X: Port-Specific Changes Mac OS X.\n* Port-Specific Changes; FreeBSD: Port-Specific Changes FreeBSD.\n\n---------- Footnotes ----------\n\n(1)\nhttps://web.archive.org/web/20110715084810/http://sourceware.org/gdb/current/onlinedocs/gdb/Python.html\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=8032\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=3632\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=4293\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=7033\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=7528\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=7767\n\n(8) https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-5983\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=5753\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=5793\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=8276\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=7228\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=1590864\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=1722344\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=3102\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=7609\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=2422\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=6491\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=2937\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=1222585\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=3585\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=6094\n\nFile: python3.12.info,  Node: Capsules,  Next: Port-Specific Changes Windows,  Up: Build and C API Changes<8>\n\n1.14.12.1 Capsules\n..................\n\nPython 3.1 adds a new C datatype, *note PyCapsule: 10eb, for providing a\nC API to an extension module.  A capsule is essentially the holder of a\nC 'void *' pointer, and is made available as a module attribute; for\nexample, the *note socket: c6. module's API is exposed as 'socket.CAPI',\nand *note unicodedata: 100. exposes 'ucnhashCAPI'.  Other extensions\ncan import the module, access its dictionary to get the capsule object,\nand then get the 'void *' pointer, which will usually point to an array\nof pointers to the module's various API functions.\n",
            "subsections": []
        },
        "There is an existing data type already used for this, 'PyCObject', but": {
            "content": "it doesn't provide type safety.  Evil code written in pure Python could\ncause a segmentation fault by taking a 'PyCObject' from module A and\nsomehow substituting it for the 'PyCObject' in module B. Capsules know\ntheir own name, and getting the pointer requires providing the name:\n\nvoid *vtable;\n\nif (!PyCapsuleIsValid(capsule, \"mymodule.CAPI\") {\nPyErrSetString(PyExcValueError, \"argument type invalid\");\nreturn NULL;\n}\n\nvtable = PyCapsuleGetPointer(capsule, \"mymodule.CAPI\");\n",
            "subsections": []
        },
        "You are assured that 'vtable' points to whatever you're expecting.  If a": {
            "content": "different capsule was passed in, *note PyCapsuleIsValid(): 11d0. would\ndetect the mismatched name and return false.  Refer to *note Providing a\nC API for an Extension Module: 11d1. for more information on using these\nobjects.\n",
            "subsections": []
        },
        "Python 2.7 now uses capsules internally to provide various": {
            "content": "extension-module APIs, but the 'PyCObjectAsVoidPtr()' was modified to\nhandle capsules, preserving compile-time compatibility with the\n'PyCObject' interface.  Use of 'PyCObjectAsVoidPtr()' will signal a\n*note PendingDeprecationWarning: 6e0, which is silent by default.\n",
            "subsections": []
        },
        "Implemented in Python 3.1 and backported to 2.7 by Larry Hastings;": {
            "content": "discussed in bpo-5630(1).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=5630\n\nFile: python3.12.info,  Node: Port-Specific Changes Windows,  Next: Port-Specific Changes Mac OS X,  Prev: Capsules,  Up: Build and C API Changes<8>\n\n1.14.12.2 Port-Specific Changes: Windows\n........................................\n\n* The *note msvcrt: 8e. module now contains some constants from the\n'crtassem.h' header file: *note CRTASSEMBLYVERSION: 11d3, *note\nVCASSEMBLYPUBLICKEYTOKEN: 11d4, and *note\nLIBRARIESASSEMBLYNAMEPREFIX: 11d5.  (Contributed by David\nCournapeau; bpo-4365(1).)\n\n* The *note winreg: 111. module for accessing the registry now\nimplements the *note CreateKeyEx(): 11d6. and *note DeleteKeyEx():\n11d7. functions, extended versions of previously supported\nfunctions that take several extra arguments.  The *note\nDisableReflectionKey(): 11d8, *note EnableReflectionKey(): 11d9,\nand *note QueryReflectionKey(): 11da. were also tested and\ndocumented.  (Implemented by Brian Curtin: bpo-7347(2).)\n\n* The new 'beginthreadex()' API is used to start threads, and the\nnative thread-local storage functions are now used.  (Contributed\nby Kristj??n Valur J??nsson; bpo-3582(3).)\n\n* The *note os.kill(): 11db. function now works on Windows.  The\nsignal value can be the constants *note CTRLCEVENT: 11dc, *note\nCTRLBREAKEVENT: 11dd, or any integer.  The first two constants\nwill send 'Control-C' and 'Control-Break' keystroke events to\nsubprocesses; any other value will use the 'TerminateProcess()'\nAPI.  (Contributed by Miki Tebeka; bpo-1220212(4).)\n\n* The *note os.listdir(): f6a. function now correctly fails for an\nempty path.  (Fixed by Hirokazu Yamamoto; bpo-5913(5).)\n\n* The *note mimetypes: 8a. module will now read the MIME database\nfrom the Windows registry when initializing.  (Patch by Gabriel\nGenellina; bpo-4969(6).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=4365\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=7347\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=3582\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=1220212\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=5913\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=4969\n\nFile: python3.12.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>\n\n1.14.12.3 Port-Specific Changes: Mac OS X\n.........................................\n\n* The path '/Library/Python/2.7/site-packages' is now appended to\n'sys.path', in order to share added packages between the system\ninstallation and a user-installed copy of the same version.\n(Changed by Ronald Oussoren; bpo-4865(1).)\n\nChanged in version 2.7.13: As of 2.7.13, this change was removed.\n'/Library/Python/2.7/site-packages', the site-packages directory\nused by the Apple-supplied system Python 2.7 is no longer appended\nto 'sys.path' for user-installed Pythons such as from the\npython.org installers.  As of macOS 10.12, Apple changed how the\nsystem site-packages directory is configured, which could cause\ninstallation of pip components, like setuptools, to fail.  Packages\ninstalled for the system Python will no longer be shared with\nuser-installed Pythons.  (bpo-28440(2))\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=4865\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=28440\n\nFile: python3.12.info,  Node: Port-Specific Changes FreeBSD,  Prev: Port-Specific Changes Mac OS X,  Up: Build and C API Changes<8>\n\n1.14.12.4 Port-Specific Changes: FreeBSD\n........................................\n\n* FreeBSD 7.1's 'SOSETFIB' constant, used with the *note socket():\nbfd. methods *note getsockopt(): b24./*note setsockopt(): b25. to\nselect an alternate routing table, is now available in the *note\nsocket: c6. module.  (Added by Kyle VanderBeek; bpo-8235(1).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=8235\n\nFile: python3.12.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\n\n\n* Two benchmark scripts, 'iobench' and 'ccbench', were added to the\n'Tools' directory.  'iobench' measures the speed of the built-in\nfile I/O objects returned by *note open(): 26e. while performing\nvarious operations, and 'ccbench' is a concurrency benchmark that\ntries to measure computing throughput, thread switching latency,\nand IO processing bandwidth when performing several tasks using a\nvarying number of threads.\n\n* The 'Tools/i18n/msgfmt.py' script now understands plural forms in\n'.po' files.  (Fixed by Martin von Lo\"wis; bpo-5464(1).)\n\n* When importing a module from a '.pyc' or '.pyo' file with an\nexisting '.py' counterpart, the *note cofilename: 11e1. attributes\nof the resulting code objects are overwritten when the original\nfilename is obsolete.  This can happen if the file has been\nrenamed, moved, or is accessed through different paths.  (Patch by\nZiga Seilnacht and Jean-Paul Calderone; bpo-1180193(2).)\n\n* The 'regrtest.py' script now takes a '--randseed=' switch that\ntakes an integer that will be used as the random seed for the '-r'\noption that executes tests in random order.  The '-r' option also\nreports the seed that was used (Added by Collin Winter.)\n\n* Another 'regrtest.py' switch is '-j', which takes an integer\nspecifying how many tests run in parallel.  This allows reducing\nthe total runtime on multi-core machines.  This option is\ncompatible with several other options, including the '-R' switch\nwhich is known to produce long runtimes.  (Added by Antoine Pitrou,\nbpo-6152(3).)  This can also be used with a new '-F' switch that\nruns selected tests in a loop until they fail.  (Added by Antoine\nPitrou; bpo-7312(4).)\n\n* When executed as a script, the 'pycompile.py' module now accepts\n''-'' as an argument, which will read standard input for the list\nof filenames to be compiled.  (Contributed by Piotr O??arowski;\nbpo-8233(5).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=5464\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=1180193\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=6152\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=7312\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=8233\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "New features may be added to Python 2.7 maintenance releases when the": {
            "content": "situation genuinely calls for it.  Any such additions must go through\nthe Python Enhancement Proposal process, and make a compelling case for\nwhy they can't be adequately addressed by either adding the new feature\nsolely to Python 3, or else by publishing it on the Python Package\nIndex.\n",
            "subsections": []
        },
        "In addition to the specific proposals listed below, there is a general": {
            "content": "exemption allowing new '-3' warnings to be added in any Python 2.7\nmaintenance release.\n\n* Menu:\n\n* Two new environment variables for debug mode::\n* PEP 434; IDLE Enhancement Exception for All Branches: PEP 434 IDLE Enhancement Exception for All Branches.\n* PEP 466; Network Security Enhancements for Python 2.7: PEP 466 Network Security Enhancements for Python 2 7.\n* PEP 477; Backport ensurepip (PEP 453) to Python 2.7: PEP 477 Backport ensurepip PEP 453 to Python 2 7.\n* PEP 476; Enabling certificate verification by default for stdlib http clients: PEP 476 Enabling certificate verification by default for stdlib http clients<2>.\n* PEP 493; HTTPS verification migration tools for Python 2.7: PEP 493 HTTPS verification migration tools for Python 2 7.\n* New make regen-all build target: New make regen-all build target<3>.\n* Removal of make touch build target: Removal of make touch build target<3>.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "1.14.15.1 Two new environment variables for debug mode\n......................................................\n\nIn debug mode, the '[xxx refs]' statistic is not written by default, the\n'PYTHONSHOWREFCOUNT' environment variable now must also be set.\n(Contributed by Victor Stinner; bpo-31733(1).)\n",
            "subsections": []
        },
        "When Python is compiled with 'COUNTALLOC' defined, allocation counts": {
            "content": "are no longer dumped by default anymore: the 'PYTHONSHOWALLOCCOUNT'\nenvironment variable must now also be set.  Moreover, allocation counts\nare now dumped into stderr, rather than stdout.  (Contributed by Victor",
            "subsections": []
        },
        "Stinner; bpo-31692(2).)": {
            "content": "New in version 2.7.15.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31733\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31692\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "1.14.15.2 PEP 434: IDLE Enhancement Exception for All Branches\n..............................................................\n\nPEP 434(1) describes a general exemption for changes made to the IDLE\ndevelopment environment shipped along with Python.  This exemption makes\nit possible for the IDLE developers to provide a more consistent user\nexperience across all supported versions of Python 2 and 3.\n",
            "subsections": []
        },
        "For details of any IDLE changes, refer to the NEWS file for the specific": {
            "content": "release.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0434/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "1.14.15.3 PEP 466: Network Security Enhancements for Python 2.7\n...............................................................\n\nPEP 466(1) describes a number of network security enhancement proposals\nthat have been approved for inclusion in Python 2.7 maintenance\nreleases, with the first of those changes appearing in the Python 2.7.7\nrelease.\n\nPEP 466(2) related features added in Python 2.7.7:\n\n* *note hmac.comparedigest(): f39. was backported from Python 3 to\nmake a timing attack resistant comparison operation available to\nPython 2 applications.  (Contributed by Alex Gaynor; bpo-21306(3).)\n\n* OpenSSL 1.0.1g was upgraded in the official Windows installers\npublished on python.org.  (Contributed by Zachary Ware;\nbpo-21462(4).)\n\nPEP 466(5) related features added in Python 2.7.8:\n\n* *note hashlib.pbkdf2hmac(): 261. was backported from Python 3 to\nmake a hashing algorithm suitable for secure password storage\nbroadly available to Python 2 applications.  (Contributed by Alex\nGaynor; bpo-21304(6).)\n\n* OpenSSL 1.0.1h was upgraded for the official Windows installers\npublished on python.org.  (contributed by Zachary Ware in\nbpo-21671(7) for CVE-2014-0224)\n\nPEP 466(8) related features added in Python 2.7.9:\n\n* Most of Python 3.4's *note ssl: ca. module was backported.  This\nmeans *note ssl: ca. now supports Server Name Indication, TLS1.x\nsettings, access to the platform certificate store, the *note\nSSLContext: 278. class, and other features.  (Contributed by Alex\nGaynor and David Reid; bpo-21308(9).)\n\nRefer to the \"Version added: 2.7.9\" notes in the module\ndocumentation for specific details.\n\n* *note os.urandom(): 276. was changed to cache a file descriptor to\n'/dev/urandom' instead of reopening '/dev/urandom' on every call.\n(Contributed by Alex Gaynor; bpo-21305(10).)\n\n* *note hashlib.algorithmsguaranteed: 11e7. and *note\nhashlib.algorithmsavailable: 11e8. were backported from Python 3\nto make it easier for Python 2 applications to select the strongest\navailable hash algorithm.  (Contributed by Alex Gaynor in\nbpo-21307(11))\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0466/\n\n(2) https://peps.python.org/pep-0466/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=21306\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=21462\n\n(5) https://peps.python.org/pep-0466/\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=21304\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=21671\n\n(8) https://peps.python.org/pep-0466/\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=21308\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=21305\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=21307\n\nFile: python3.12.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\n\n1.14.15.4 PEP 477: Backport ensurepip (PEP 453) to Python 2.7\n.............................................................\n\nPEP 477(1) approves the inclusion of the PEP 453(2) ensurepip module and\nthe improved documentation that was enabled by it in the Python 2.7\nmaintenance releases, appearing first in the Python 2.7.9 release.\n\n* Menu:\n\n* Bootstrapping pip By Default: Bootstrapping pip By Default<2>.\n* Documentation Changes: Documentation Changes<2>.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0477/\n\n(2) https://peps.python.org/pep-0453/\n\nFile: python3.12.info,  Node: Bootstrapping pip By Default<2>,  Next: Documentation Changes<2>,  Up: PEP 477 Backport ensurepip PEP 453 to Python 2 7\n\n1.14.15.5 Bootstrapping pip By Default\n......................................\n\nThe new *note ensurepip: 50. module (defined in PEP 453(1)) provides a\nstandard cross-platform mechanism to bootstrap the pip installer into",
            "subsections": []
        },
        "Python installations.  The version of 'pip' included with Python 2.7.9": {
            "content": "is 'pip' 1.5.6, and future 2.7.x maintenance releases will update the\nbundled version to the latest version of 'pip' that is available at the\ntime of creating the release candidate.\n",
            "subsections": []
        },
        "By default, the commands 'pip', 'pipX' and 'pipX.Y' will be installed on": {
            "content": "all platforms (where X.Y stands for the version of the Python\ninstallation), along with the 'pip' Python package and its dependencies.\n\nFor CPython *note source builds on POSIX systems: d5a, the 'make\ninstall' and 'make altinstall' commands do not bootstrap 'pip' by\ndefault.  This behaviour can be controlled through configure options,\nand overridden through Makefile options.\n",
            "subsections": []
        },
        "These tools are intended for use in cases where affected applications": {
            "content": "and services can't be modified to explicitly pass a more permissive SSL\ncontext when establishing the connection.\n",
            "subsections": []
        },
        "For applications and services which can't be modified at all, the new": {
            "content": "'PYTHONHTTPSVERIFY' environment variable may be set to '0' to revert an\nentire Python process back to the default permissive behaviour of Python\n2.7.8 and earlier.\n",
            "subsections": []
        },
        "For cases where the connection establishment code can't be modified, but": {
            "content": "the overall application can be, the new\n'ssl.httpsverifycertificates()' function can be used to adjust the\ndefault behaviour at runtime.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0493/\n\nFile: python3.12.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\n\n1.14.15.9 New 'make regen-all' build target\n...........................................\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Acknowledgements,  Prev: New Features Added to Python 2 7 Maintenance Releases,  Up: What's New in Python 2 7": {
            "content": "",
            "subsections": []
        },
        "The author would like to thank the following people for offering": {
            "content": "suggestions, corrections and assistance with various drafts of this\narticle: Ian Bicking, Nick Coghlan, Nick Efford, Raymond Hettinger, Jim",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": [
                {
                    "name": "1.15 What's New in Python 2.6",
                    "content": ""
                }
            ]
        },
        "This article explains the new features in Python 2.6, released on": {
            "content": "October 1, 2008.  The release schedule is described in PEP 361(1).\n",
            "subsections": []
        },
        "The major theme of Python 2.6 is preparing the migration path to Python": {
            "content": "3.0, a major redesign of the language.  Whenever possible, Python 2.6\nincorporates new features and syntax from 3.0 while remaining compatible\nwith existing code by not removing older features or syntax.  When it's\nnot possible to do that, Python 2.6 tries to do what it can, adding\ncompatibility functions in a 'futurebuiltins' module and a '-3' switch\nto warn about usages that will become unsupported in 3.0.\n",
            "subsections": []
        },
        "Some significant new packages have been added to the standard library,": {
            "content": "such as the *note multiprocessing: 8f. and *note json: 7c. modules, but\nthere aren't many new features that aren't related to Python 3.0 in some\nway.\n",
            "subsections": []
        },
        "Python 2.6 also sees a number of improvements and bugfixes throughout": {
            "content": "the source.  A search through the change logs finds there were 259\npatches applied and 612 bugs fixed between Python 2.5 and 2.6.  Both\nfigures are likely to be underestimates.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 0,  Next: Changes to the Development Process,  Up: What's New in Python 2 6": {
            "content": "",
            "subsections": []
        },
        "The development cycle for Python versions 2.6 and 3.0 was synchronized,": {
            "content": "with the alpha and beta releases for both versions being made on the\nsame days.  The development of 3.0 has influenced many features in 2.6.\n",
            "subsections": []
        },
        "Python 3.0 is a far-ranging redesign of Python that breaks compatibility": {
            "content": "with the 2.x series.  This means that existing Python code will need\nsome conversion in order to run on Python 3.0.  However, not all the\nchanges in 3.0 necessarily break compatibility.  In cases where new\nfeatures won't cause existing code to break, they've been backported to\n2.6 and are described in this document in the appropriate place.  Some\nof the 3.0-derived features are:\n\n* A 'complex()' method for converting objects to a complex\nnumber.\n\n* Alternate syntax for catching exceptions: 'except TypeError as\nexc'.\n\n* The addition of *note functools.reduce(): 1151. as a synonym for\nthe built-in 'reduce()' function.\n",
            "subsections": []
        },
        "Python 3.0 adds several new built-in functions and changes the semantics": {
            "content": "of some existing builtins.  Functions that are new in 3.0 such as *note\nbin(): 1120. have simply been added to Python 2.6, but existing builtins\nhaven't been changed; instead, the 'futurebuiltins' module has versions\nwith the new 3.0 semantics.  Code written to be compatible with 3.0 can\ndo 'from futurebuiltins import hex, map' as necessary.\n\nA new command-line switch, '-3', enables warnings about features that\nwill be removed in Python 3.0.  You can run code with this switch to see\nhow much work will be necessary to port code to 3.0.  The value of this\nswitch is available to Python code as the boolean variable\n'sys.py3kwarning', and to C extension code as 'PyPy3kWarningFlag'.\n\nSee also\n........\n",
            "subsections": []
        },
        "The 3'xxx' series of PEPs, which contains proposals for Python 3.0.  PEP": {
            "content": "3000(1) describes the development process for Python 3.0.  Start with\nPEP 3100(2) that describes the general goals for Python 3.0, and then\nexplore the higher-numbered PEPs that propose specific features.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3000/\n\n(2) https://peps.python.org/pep-3100/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "While 2.6 was being developed, the Python development process underwent": {
            "content": "two significant changes: we switched from SourceForge's issue tracker to\na customized Roundup installation, and the documentation was converted\nfrom LaTeX to reStructuredText.\n\n* Menu:\n\n* New Issue Tracker; Roundup: New Issue Tracker Roundup.\n* New Documentation Format; reStructuredText Using Sphinx: New Documentation Format reStructuredText Using Sphinx.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: New Issue Tracker Roundup,  Next: New Documentation Format reStructuredText Using Sphinx,  Up: Changes to the Development Process": {
            "content": "1.15.2.1 New Issue Tracker: Roundup\n...................................\n",
            "subsections": []
        },
        "For a long time, the Python developers had been growing increasingly": {
            "content": "annoyed by SourceForge's bug tracker.  SourceForge's hosted solution\ndoesn't permit much customization; for example, it wasn't possible to\ncustomize the life cycle of issues.\n",
            "subsections": []
        },
        "The infrastructure committee of the Python Software Foundation therefore": {
            "content": "posted a call for issue trackers, asking volunteers to set up different\nproducts and import some of the bugs and patches from SourceForge.  Four\ndifferent trackers were examined: Jira(1), Launchpad(2), Roundup(3), and",
            "subsections": []
        },
        "Trac(4).  The committee eventually settled on Jira and Roundup as the": {
            "content": "two candidates.  Jira is a commercial product that offers no-cost hosted\ninstances to free-software projects; Roundup is an open-source project\nthat requires volunteers to administer it and a server to host it.\n",
            "subsections": []
        },
        "After posting a call for volunteers, a new Roundup installation was set": {
            "content": "up at 'https://bugs.python.org'.  One installation of Roundup can host\nmultiple trackers, and this server now also hosts issue trackers for",
            "subsections": []
        },
        "Jython and for the Python web site.  It will surely find other uses in": {
            "content": "the future.  Where possible, this edition of \"What's New in Python\"\nlinks to the bug/patch item for each change.\n",
            "subsections": []
        },
        "Hosting of the Python bug tracker is kindly provided by Upfront": {
            "content": "Systems(5) of Stellenbosch, South Africa.  Martin von Lo\"wis put a lot of\neffort into importing existing bugs and patches from SourceForge; his\nscripts for this import operation are at\n'https://svn.python.org/view/tracker/importer/' and may be useful to\nother projects wishing to move from SourceForge to Roundup.\n\nSee also\n........\n\n'https://bugs.python.org'\n\nThe Python bug tracker.\n\n'https://bugs.jython.org':\n\nThe Jython bug tracker.\n\n'https://roundup.sourceforge.io/'\n\nRoundup downloads and documentation.\n\n'https://svn.python.org/view/tracker/importer/'\n\nMartin von Lo\"wis's conversion scripts.\n\n---------- Footnotes ----------\n\n(1) https://www.atlassian.com/software/jira/\n\n(2) https://launchpad.net/\n\n(3) https://roundup.sourceforge.io/\n\n(4) https://trac.edgewall.org/\n\n(5) https://upfrontsoftware.co.za\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: New Documentation Format reStructuredText Using Sphinx,  Prev: New Issue Tracker Roundup,  Up: Changes to the Development Process": {
            "content": "1.15.2.2 New Documentation Format: reStructuredText Using Sphinx\n................................................................\n",
            "subsections": []
        },
        "The Python documentation was written using LaTeX since the project": {
            "content": "started around 1989.  In the 1980s and early 1990s, most documentation\nwas printed out for later study, not viewed online.  LaTeX was widely\nused because it provided attractive printed output while remaining\nstraightforward to write once the basic rules of the markup were\nlearned.\n",
            "subsections": []
        },
        "Today LaTeX is still used for writing publications destined for": {
            "content": "printing, but the landscape for programming tools has shifted.  We no\nlonger print out reams of documentation; instead, we browse through it\nonline and HTML has become the most important format to support.",
            "subsections": []
        },
        "Unfortunately, converting LaTeX to HTML is fairly complicated and Fred": {
            "content": "L.  Drake Jr., the long-time Python documentation editor, spent a lot of\ntime maintaining the conversion process.  Occasionally people would\nsuggest converting the documentation into SGML and later XML, but\nperforming a good conversion is a major task and no one ever committed\nthe time required to finish the job.\n",
            "subsections": []
        },
        "During the 2.6 development cycle, Georg Brandl put a lot of effort into": {
            "content": "building a new toolchain for processing the documentation.  The\nresulting package is called Sphinx, and is available from\n'https://www.sphinx-doc.org/'.\n",
            "subsections": []
        },
        "Sphinx concentrates on HTML output, producing attractively styled and": {
            "content": "modern HTML; printed output is still supported through conversion to",
            "subsections": []
        },
        "LaTeX. The input format is reStructuredText, a markup syntax supporting": {
            "content": "custom extensions and directives that is commonly used in the Python\ncommunity.\n",
            "subsections": []
        },
        "Sphinx is a standalone package that can be used for writing, and almost": {
            "content": "two dozen other projects (listed on the Sphinx web site(1)) have adopted\nSphinx as their documentation tool.\n\nSee also\n........\n",
            "subsections": []
        },
        "Documenting Python(2)": {
            "content": "Describes how to write for Python's documentation.\n",
            "subsections": []
        },
        "Sphinx(3)": {
            "content": "Documentation and code for the Sphinx toolchain.\n",
            "subsections": []
        },
        "Docutils(4)": {
            "content": "The underlying reStructuredText parser and toolset.\n\n---------- Footnotes ----------\n\n(1) https://www.sphinx-doc.org/en/master/examples.html\n\n(2) https://devguide.python.org/documenting/\n\n(3) https://www.sphinx-doc.org/\n\n(4) https://docutils.sourceforge.io\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "The previous version, Python 2.5, added the '*note with: 396.' statement\nas an optional feature, to be enabled by a 'from future import\nwithstatement' directive.  In 2.6 the statement no longer needs to be\nspecially enabled; this means that 'with' is now always a keyword.  The\nrest of this section is a copy of the corresponding section from the\n\"What's New in Python 2.5\" document; if you're familiar with the\n''with'' statement from Python 2.5, you can skip this section.\n\nThe '*note with: 396.' statement clarifies code that previously would\nuse 'try...finally' blocks to ensure that clean-up code is executed.  In\nthis section, I'll discuss the statement as it will commonly be used.",
            "subsections": []
        },
        "In the next section, I'll examine the implementation details and show": {
            "content": "how to write objects for use with this statement.\n\nThe '*note with: 396.' statement is a new control-flow structure whose\nbasic structure is:\n\nwith expression [as variable]:\nwith-block\n",
            "subsections": []
        },
        "The expression is evaluated, and it should result in an object that": {
            "content": "supports the context management protocol (that is, has *note\nenter(): 389. and *note exit(): 1175. methods.\n\nThe object's *note enter(): 389. is called before 'with-block' is\nexecuted and therefore can run set-up code.  It also may return a value\nthat is bound to the name 'variable', if given.  (Note carefully that\n'variable' is 'not' assigned the result of 'expression'.)\n\nAfter execution of the 'with-block' is finished, the object's *note\nexit(): 1175. method is called, even if the block raised an\nexception, and can therefore run clean-up code.\n",
            "subsections": []
        },
        "Some standard Python objects now support the context management protocol": {
            "content": "and can be used with the '*note with: 396.' statement.  File objects are\none example:\n\nwith open('/etc/passwd', 'r') as f:\nfor line in f:\nprint line\n... more processing code ...\n",
            "subsections": []
        },
        "After this statement has executed, the file object in 'f' will have been": {
            "content": "automatically closed, even if the *note for: 24e. loop raised an\nexception part-way through the block.\n\nNote: In this case, 'f' is the same object created by *note open():\n26e, because *note enter(): 389. returns 'self'.\n\nThe *note threading: e7. module's locks and condition variables also\nsupport the '*note with: 396.' statement:\n\nlock = threading.Lock()\nwith lock:\n# Critical section of code\n...\n",
            "subsections": []
        },
        "The lock is acquired before the block is executed and always released": {
            "content": "once the block is complete.\n\nThe new 'localcontext()' function in the *note decimal: 33. module makes\nit easy to save and restore the current decimal context, which\nencapsulates the desired precision and rounding characteristics for\ncomputations:\n\nfrom decimal import Decimal, Context, localcontext\n\n# Displays with default precision of 28 digits\nv = Decimal('578')\nprint v.sqrt()\n\nwith localcontext(Context(prec=16)):\n# All code in this block uses a precision of 16 digits.\n# The original context is restored on exiting the block.\nprint v.sqrt()\n\n* Menu:\n\n* Writing Context Managers: Writing Context Managers<2>.\n* The contextlib module: The contextlib module<2>.\n\nFile: python3.12.info,  Node: Writing Context Managers<2>,  Next: The contextlib module<2>,  Up: PEP 343 The 'with' statement<2>\n\n1.16.8.1 Writing Context Managers\n.................................\n\nUnder the hood, the '*note with: 396.' statement is fairly complicated.",
            "subsections": []
        },
        "File: python3.12.info,  Node: Writing Context Managers,  Next: The contextlib module,  Up: PEP 343 The 'with' statement": {
            "content": "1.15.3.1 Writing Context Managers\n.................................\n\nUnder the hood, the '*note with: 396.' statement is fairly complicated.",
            "subsections": []
        },
        "Most people will only use ''with'' in company with existing objects and": {
            "content": "don't need to know these details, so you can skip the rest of this\nsection if you like.  Authors of new objects will need to understand the\ndetails of the underlying implementation and should keep reading.\n\nA high-level explanation of the context management protocol is:\n\n* The expression is evaluated and should result in an object called a\n\"context manager\".  The context manager must have *note\nenter(): 389. and *note exit(): 1175. methods.\n\n* The context manager's *note enter(): 389. method is called.\nThe value returned is assigned to 'VAR'. If no ''as VAR'' clause is\npresent, the value is simply discarded.\n\n* The code in 'BLOCK' is executed.\n\n* If 'BLOCK' raises an exception, the 'exit(type, value,\ntraceback)' is called with the exception details, the same values\nreturned by *note sys.excinfo(): 456.  The method's return value\ncontrols whether the exception is re-raised: any false value\nre-raises the exception, and 'True' will result in suppressing it.\nYou'll only rarely want to suppress the exception, because if you\ndo the author of the code containing the '*note with: 396.'\nstatement will never realize anything went wrong.\n\n* If 'BLOCK' didn't raise an exception, the *note exit(): 1175.\nmethod is still called, but 'type', 'value', and 'traceback' are\nall 'None'.\n",
            "subsections": []
        },
        "Let's think through an example.  I won't present detailed code but will": {
            "content": "only sketch the methods necessary for a database that supports\ntransactions.\n\n(For people unfamiliar with database terminology: a set of changes to\nthe database are grouped into a transaction.  Transactions can be either\ncommitted, meaning that all the changes are written into the database,\nor rolled back, meaning that the changes are all discarded and the\ndatabase is unchanged.  See any database textbook for more information.)\n",
            "subsections": []
        },
        "Let's assume there's an object representing a database connection.  Our": {
            "content": "goal will be to let the user write code like this:\n\ndbconnection = DatabaseConnection()\nwith dbconnection as cursor:\ncursor.execute('insert into ...')\ncursor.execute('delete from ...')\n# ... more operations ...\n",
            "subsections": []
        },
        "The transaction should be committed if the code in the block runs": {
            "content": "flawlessly or rolled back if there's an exception.  Here's the basic\ninterface for 'DatabaseConnection' that I'll assume:\n\nclass DatabaseConnection:\n# Database interface\ndef cursor (self):\n\"Returns a cursor object and starts a new transaction\"\ndef commit (self):\n\"Commits current transaction\"\ndef rollback (self):\n\"Rolls back current transaction\"\n\nThe *note enter(): 389. method is pretty easy, having only to start\na new transaction.  For this application the resulting cursor object\nwould be a useful result, so the method will return it.  The user can\nthen add 'as cursor' to their '*note with: 396.' statement to bind the\ncursor to a variable name.\n\nclass DatabaseConnection:\n...\ndef enter (self):\n# Code to start a new transaction\ncursor = self.cursor()\nreturn cursor\n\nThe *note exit(): 1175. method is the most complicated because it's\nwhere most of the work has to be done.  The method has to check if an\nexception occurred.  If there was no exception, the transaction is\ncommitted.  The transaction is rolled back if there was an exception.\n",
            "subsections": []
        },
        "In the code below, execution will just fall off the end of the function,": {
            "content": "returning the default value of 'None'.  'None' is false, so the\nexception will be re-raised automatically.  If you wished, you could be\nmore explicit and add a *note return: 7f2. statement at the marked\nlocation.\n\nclass DatabaseConnection:\n...\ndef exit (self, type, value, tb):\nif tb is None:\n# No exception, so commit\nself.commit()\nelse:\n# Exception occurred, so rollback.\nself.rollback()\n# return False\n\nFile: python3.12.info,  Node: The contextlib module<2>,  Prev: Writing Context Managers<2>,  Up: PEP 343 The 'with' statement<2>\n\n1.16.8.2 The contextlib module\n..............................\n\nThe new *note contextlib: 21. module provides some functions and a\ndecorator that are useful for writing objects for use with the '*note\nwith: 396.' statement.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The contextlib module,  Prev: Writing Context Managers,  Up: PEP 343 The 'with' statement": {
            "content": "1.15.3.2 The contextlib module\n..............................\n\nThe *note contextlib: 21. module provides some functions and a decorator\nthat are useful when writing objects for use with the '*note with: 396.'\nstatement.\n",
            "subsections": []
        },
        "The decorator is called 'contextmanager()', and lets you write a single": {
            "content": "generator function instead of defining a new class.  The generator\nshould yield exactly one value.  The code up to the *note yield: 7f1.\nwill be executed as the *note enter(): 389. method, and the value\nyielded will be the method's return value that will get bound to the\nvariable in the '*note with: 396.' statement's 'as' clause, if any.  The\ncode after the *note yield: 7f1. will be executed in the *note\nexit(): 1175. method.  Any exception raised in the block will be\nraised by the 'yield' statement.\n",
            "subsections": []
        },
        "Using this decorator, our database example from the previous section": {
            "content": "could be written as:\n\nfrom contextlib import contextmanager\n\n@contextmanager\ndef dbtransaction(connection):\ncursor = connection.cursor()\ntry:\nyield cursor\nexcept:\nconnection.rollback()\nraise\nelse:\nconnection.commit()\n\ndb = DatabaseConnection()\nwith dbtransaction(db) as cursor:\n...\n\nThe *note contextlib: 21. module also has a 'nested(mgr1, mgr2, ...)'\nfunction that combines a number of context managers so you don't need to\nwrite nested '*note with: 396.' statements.  In this example, the single\n''with'' statement both starts a database transaction and acquires a\nthread lock:\n\nlock = threading.Lock()\nwith nested (dbtransaction(db), lock) as (cursor, locked):\n...\n",
            "subsections": []
        },
        "Finally, the 'closing()' function returns its argument so that it can be": {
            "content": "bound to a variable, and calls the argument's '.close()' method at the\nend of the block.\n\nimport urllib, sys\nfrom contextlib import closing\n\nwith closing(urllib.urlopen('http://www.yahoo.com')) as f:\nfor line in f:\nsys.stdout.write(line)\n\nSee also\n........\n\nPEP 343(1) - The \"with\" statement\n\nPEP written by Guido van Rossum and Nick Coghlan; implemented by\nMike Bland, Guido van Rossum, and Neal Norwitz.  The PEP shows the\ncode generated for a '*note with: 396.' statement, which can be\nhelpful in learning how the statement works.\n\nThe documentation for the *note contextlib: 21. module.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0343/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "Python's *note -m: 3a5. switch allows running a module as a script.",
            "subsections": []
        },
        "When you ran a module that was located inside a package, relative": {
            "content": "imports didn't work correctly.\n\nThe fix for Python 2.6 adds a *note package: e94. attribute to\nmodules.  When this attribute is present, relative imports will be\nrelative to the value of this attribute instead of the *note name:\n11fd. attribute.\n\nPEP 302-style importers can then set *note package: e94. as\nnecessary.  The *note runpy: b9. module that implements the *note -m:\n3a5. switch now does this, so relative imports will now work correctly\nin scripts running from inside a package.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "When you run Python, the module search path 'sys.path' usually includes": {
            "content": "a directory whose path ends in '\"site-packages\"'.  This directory is\nintended to hold locally installed packages available to all users using\na machine or a particular site installation.\n\nPython 2.6 introduces a convention for user-specific site directories.\nThe directory varies depending on the platform:\n\n* Unix and Mac OS X: '~/.local/'\n\n* Windows: '%APPDATA%/Python'\n",
            "subsections": []
        },
        "Within this directory, there will be version-specific subdirectories,": {
            "content": "such as 'lib/python2.6/site-packages' on Unix/Mac OS and\n'Python26/site-packages' on Windows.\n",
            "subsections": []
        },
        "If you don't like the default directory, it can be overridden by an": {
            "content": "environment variable.  *note PYTHONUSERBASE: 11ff. sets the root\ndirectory used for all Python versions supporting this feature.  On",
            "subsections": []
        },
        "Windows, the directory for application-specific data can be changed by": {
            "content": "setting the 'APPDATA' environment variable.  You can also modify the\n'site.py' file for your Python installation.\n\nThe feature can be disabled entirely by running Python with the *note\n-s: 1200. option or setting the *note PYTHONNOUSERSITE: 1201.\nenvironment variable.\n\nSee also\n........\n\nPEP 370(1) - Per-user 'site-packages' Directory\n\nPEP written and implemented by Christian Heimes.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0370/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "The new *note multiprocessing: 8f. package lets Python programs create\nnew processes that will perform a computation and return a result to the\nparent.  The parent and child processes can communicate using queues and\npipes, synchronize their operations using locks and semaphores, and can\nshare simple arrays of data.\n\nThe *note multiprocessing: 8f. module started out as an exact emulation\nof the *note threading: e7. module using processes instead of threads.",
            "subsections": []
        },
        "That goal was discarded along the path to Python 2.6, but the general": {
            "content": "approach of the module is still similar.  The fundamental class is the\n'Process', which is passed a callable object and a collection of\narguments.  The 'start()' method sets the callable running in a\nsubprocess, after which you can call the 'isalive()' method to check\nwhether the subprocess is still running and the 'join()' method to wait\nfor the process to exit.\n\nHere's a simple example where the subprocess will calculate a factorial.",
            "subsections": []
        },
        "The function doing the calculation is written strangely so that it takes": {
            "content": "significantly longer when the input argument is a multiple of 4.\n\nimport time\nfrom multiprocessing import Process, Queue\n\n\ndef factorial(queue, N):\n\"Compute a factorial.\"\n# If N is a multiple of 4, this function will take much longer.\nif (N % 4) == 0:\ntime.sleep(.05 * N/4)\n\n# Calculate the result\nfact = 1L\nfor i in range(1, N+1):\nfact = fact * i\n\n# Put the result on the queue\nqueue.put(fact)\n\nif name == 'main':\nqueue = Queue()\n\nN = 5\n\np = Process(target=factorial, args=(queue, N))\np.start()\np.join()\n\nresult = queue.get()\nprint 'Factorial', N, '=', result\n\nA *note Queue: 1203. is used to communicate the result of the factorial.\nThe *note Queue: 1203. object is stored in a global variable.  The child\nprocess will use the value of the variable when the child was created;\nbecause it's a *note Queue: 1203, parent and child can use the object to\ncommunicate.  (If the parent were to change the value of the global\nvariable, the child's value would be unaffected, and vice versa.)\n",
            "subsections": []
        },
        "Two other classes, 'Pool' and 'Manager', provide higher-level": {
            "content": "interfaces.  'Pool' will create a fixed number of worker processes, and\nrequests can then be distributed to the workers by calling 'apply()' or\n'applyasync()' to add a single request, and *note map(): 65f. or\n'mapasync()' to add a number of requests.  The following code uses a\n'Pool' to spread requests across 5 worker processes and retrieve a list\nof results:\n\nfrom multiprocessing import Pool\n\ndef factorial(N, dictionary):\n\"Compute a factorial.\"\n...\np = Pool(5)\nresult = p.map(factorial, range(1, 1000, 10))\nfor v in result:\nprint v\n\nThis produces the following output:\n\n1\n39916800\n51090942171709440000\n8222838654177922817725562880000000\n33452526613163807108170062053440751665152000000000\n...\n",
            "subsections": []
        },
        "The other high-level interface, the 'Manager' class, creates a separate": {
            "content": "server process that can hold master copies of Python data structures.",
            "subsections": []
        },
        "Other processes can then access and modify these data structures using": {
            "content": "proxy objects.  The following example creates a shared dictionary by\ncalling the *note dict(): 237. method; the worker processes then insert\nvalues into the dictionary.  (Locking is not done for you automatically,\nwhich doesn't matter in this example.  'Manager''s methods also include\n'Lock()', 'RLock()', and 'Semaphore()' to create shared locks.)\n\nimport time\nfrom multiprocessing import Pool, Manager\n\ndef factorial(N, dictionary):\n\"Compute a factorial.\"\n# Calculate the result\nfact = 1L\nfor i in range(1, N+1):\nfact = fact * i\n\n# Store result in dictionary\ndictionary[N] = fact\n\nif name == 'main':\np = Pool(5)\nmgr = Manager()\nd = mgr.dict()         # Create shared dictionary\n\n# Run tasks using the pool\nfor N in range(1, 1000, 10):\np.applyasync(factorial, (N, d))\n\n# Mark pool as closed -- no more tasks can be added.\np.close()\n\n# Wait for tasks to exit\np.join()\n\n# Output results\nfor k, v in sorted(d.items()):\nprint k, v\n\nThis will produce the output:\n\n1 1\n11 39916800\n21 51090942171709440000\n31 8222838654177922817725562880000000\n41 33452526613163807108170062053440751665152000000000\n51 15511187532873822802242430164693032110632597200169861120000...\n\nSee also\n........\n\nThe documentation for the *note multiprocessing: 8f. module.\n\nPEP 371(1) - Addition of the multiprocessing package\n\nPEP written by Jesse Noller and Richard Oudkerk; implemented by\nRichard Oudkerk and Jesse Noller.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0371/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "In Python 3.0, the '%' operator is supplemented by a more powerful\nstring formatting method, *note format(): 3eb.  Support for the *note\nstr.format(): 3ed. method has been backported to Python 2.6.\n",
            "subsections": []
        },
        "In 2.6, both 8-bit and Unicode strings have a '.format()' method that": {
            "content": "treats the string as a template and takes the arguments to be formatted.\nThe formatting template uses curly brackets ('{', '}') as special\ncharacters:\n\n>>> # Substitute positional argument 0 into the string.\n>>> \"User ID: {0}\".format(\"root\")\n'User ID: root'\n>>> # Use the named keyword arguments\n>>> \"User ID: {uid}   Last seen: {lastlogin}\".format(\n...    uid=\"root\",\n...    lastlogin = \"5 Mar 2008 07:20\")\n'User ID: root   Last seen: 5 Mar 2008 07:20'\n\nCurly brackets can be escaped by doubling them:\n\n>>> \"Empty dict: {{}}\".format()\n\"Empty dict: {}\"\n",
            "subsections": []
        },
        "Field names can be integers indicating positional arguments, such as": {
            "content": "'{0}', '{1}', etc.  or names of keyword arguments.  You can also supply\ncompound field names that read attributes or access dictionary keys:\n\n>>> import sys\n>>> print 'Platform: {0.platform}\\nPython version: {0.version}'.format(sys)\nPlatform: darwin\nPython version: 2.6a1+ (trunk:61261M, Mar  5 2008, 20:29:41)\n[GCC 4.0.1 (Apple Computer, Inc. build 5367)]'\n\n>>> import mimetypes\n>>> 'Content-type: {0[.mp4]}'.format(mimetypes.typesmap)\n'Content-type: video/mp4'\n\nNote that when using dictionary-style notation such as '[.mp4]', you\ndon't need to put any quotation marks around the string; it will look up\nthe value using '.mp4' as the key.  Strings beginning with a number will\nbe converted to an integer.  You can't write more complicated\nexpressions inside a format string.\n",
            "subsections": []
        },
        "So far we've shown how to specify which field to substitute into the": {
            "content": "resulting string.  The precise formatting used is also controllable by\nadding a colon followed by a format specifier.  For example:\n\n>>> # Field 0: left justify, pad to 15 characters\n>>> # Field 1: right justify, pad to 6 characters\n>>> fmt = '{0:15} ${1:>6}'\n>>> fmt.format('Registration', 35)\n'Registration    $    35'\n>>> fmt.format('Tutorial', 50)\n'Tutorial        $    50'\n>>> fmt.format('Banquet', 125)\n'Banquet         $   125'\n\nFormat specifiers can reference other fields through nesting:\n\n>>> fmt = '{0:{1}}'\n>>> width = 15\n>>> fmt.format('Invoice #1234', width)\n'Invoice #1234  '\n>>> width = 35\n>>> fmt.format('Invoice #1234', width)\n'Invoice #1234                      '\n\nThe alignment of a field within the desired width can be specified:\n",
            "subsections": []
        },
        "Character            Effect": {
            "content": "----------------------------------------------------------------------\n\n< (default)          Left-align\n\n\n>                    Right-align\n\n\n^                    Center\n\n\n=                    (For numeric types only) Pad after the sign.\n\n",
            "subsections": []
        },
        "Format specifiers can also include a presentation type, which controls": {
            "content": "how the value is formatted.  For example, floating-point numbers can be\nformatted as a general number or in exponential notation:\n\n>>> '{0:g}'.format(3.75)\n'3.75'\n>>> '{0:e}'.format(3.75)\n'3.750000e+00'\n\nA variety of presentation types are available.  Consult the 2.6\ndocumentation for a *note complete list: 1205.; here's a sample:\n\n'b'       Binary.  Outputs the number in base 2.\n\n\n'c'       Character.  Converts the integer to the corresponding Unicode character\nbefore printing.\n\n\n'd'       Decimal Integer.  Outputs the number in base 10.\n\n\n'o'       Octal format.  Outputs the number in base 8.\n\n\n'x'       Hex format.  Outputs the number in base 16, using lower-case letters for\nthe digits above 9.\n\n\n'e'       Exponent notation.  Prints the number in scientific notation using the\nletter 'e' to indicate the exponent.\n\n\n'g'       General format.  This prints the number as a fixed-point number, unless\nthe number is too large, in which case it switches to 'e' exponent\nnotation.\n\n\n'n'       Number.  This is the same as 'g' (for floats) or 'd' (for integers),\nexcept that it uses the current locale setting to insert the appropriate\nnumber separator characters.\n\n\n'%'       Percentage.  Multiplies the number by 100 and displays in fixed ('f')\nformat, followed by a percent sign.\n\n",
            "subsections": []
        },
        "Classes and types can define a 'format()' method to control how": {
            "content": "they're formatted.  It receives a single argument, the format specifier:\n\ndef format(self, formatspec):\nif isinstance(formatspec, unicode):\nreturn unicode(str(self))\nelse:\nreturn str(self)\n\nThere's also a *note format(): 3eb. builtin that will format a single\nvalue.  It calls the type's 'format()' method with the provided\nspecifier:\n\n>>> format(75.6564, '.2f')\n'75.66'\n\nSee also\n........\n\n*note Format String Syntax: 1205.\n\nThe reference documentation for format fields.\n\nPEP 3101(1) - Advanced String Formatting\n\nPEP written by Talin.  Implemented by Eric Smith.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3101/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "The 'print' statement becomes the *note print(): de5. function in Python\n3.0.  Making *note print(): de5. a function makes it possible to replace\nthe function by doing 'def print(...)' or importing a new function from\nsomewhere else.\n",
            "subsections": []
        },
        "Python 2.6 has a 'future' import that removes 'print' as language": {
            "content": "syntax, letting you use the functional form instead.  For example:\n\n>>> from future import printfunction\n>>> print('# of entries', len(dictionary), file=sys.stderr)\n\nThe signature of the new function is:\n\ndef print(*args, sep=' ', end='\\n', file=None)\n\nThe parameters are:\n\n* 'args': positional arguments whose values will be printed out.\n\n* 'sep': the separator, which will be printed between arguments.\n\n* 'end': the ending text, which will be printed after all of the\narguments have been output.\n\n* 'file': the file object to which the output will be sent.\n\nSee also\n........\n\nPEP 3105(1) - Make print a function\n\nPEP written by Georg Brandl.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3105/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "One error that Python programmers occasionally make is writing the": {
            "content": "following code:\n\ntry:\n...\nexcept TypeError, ValueError:  # Wrong!\n...\n\nThe author is probably trying to catch both *note TypeError: 28e. and\n*note ValueError: 183. exceptions, but this code actually does something\ndifferent: it will catch *note TypeError: 28e. and bind the resulting\nexception object to the local name '\"ValueError\"'.  The *note",
            "subsections": []
        },
        "ValueError: 183. exception will not be caught at all.  The correct code": {
            "content": "specifies a tuple of exceptions:\n\ntry:\n...\nexcept (TypeError, ValueError):\n...\n",
            "subsections": []
        },
        "This error happens because the use of the comma here is ambiguous: does": {
            "content": "it indicate two different nodes in the parse tree, or a single node\nthat's a tuple?\n",
            "subsections": []
        },
        "Python 3.0 makes this unambiguous by replacing the comma with the word": {
            "content": "\"as\".  To catch an exception and store the exception object in the\nvariable 'exc', you must write:\n\ntry:\n...\nexcept TypeError as exc:\n...\n\nPython 3.0 will only support the use of \"as\", and therefore interprets\nthe first example as catching two different exceptions.  Python 2.6\nsupports both the comma and \"as\", so existing code will continue to\nwork.  We therefore suggest using \"as\" when writing new Python code that\nwill only be executed with 2.6.\n\nSee also\n........\n\nPEP 3110(1) - Catching Exceptions in Python 3000\n\nPEP written and implemented by Collin Winter.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3110/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "Python 3.0 adopts Unicode as the language's fundamental string type and": {
            "content": "denotes 8-bit literals differently, either as 'b'string'' or using a\n*note bytes: 295. constructor.  For future compatibility, Python 2.6\nadds *note bytes: 295. as a synonym for the *note str: 157. type, and it\nalso supports the 'b''' notation.\n\nThe 2.6 *note str: 157. differs from 3.0's *note bytes: 295. type in\nvarious ways; most notably, the constructor is completely different.  In\n3.0, 'bytes([65, 66, 67])' is 3 elements long, containing the bytes\nrepresenting 'ABC'; in 2.6, 'bytes([65, 66, 67])' returns the 12-byte\nstring representing the *note str(): 157. of the list.\n\nThe primary use of *note bytes: 295. in 2.6 will be to write tests of\nobject type such as 'isinstance(x, bytes)'.  This will help the 2to3\nconverter, which can't tell whether 2.x code intends strings to contain\neither characters or 8-bit bytes; you can now use either *note bytes:\n295. or *note str: 157. to represent your intention exactly, and the\nresulting code will also be correct in Python 3.0.\n",
            "subsections": []
        },
        "There's also a 'future' import that causes all string literals to": {
            "content": "become Unicode strings.  This means that '\\u' escape sequences can be\nused to include Unicode characters:\n\nfrom future import unicodeliterals\n\ns = ('\\u751f\\u3080\\u304e\\u3000\\u751f\\u3054'\n'\\u3081\\u3000\\u751f\\u305f\\u307e\\u3054')\n\nprint len(s)               # 12 Unicode characters\n",
            "subsections": []
        },
        "At the C level, Python 3.0 will rename the existing 8-bit string type,": {
            "content": "called 'PyStringObject' in Python 2.x, to *note PyBytesObject: 582.\nPython 2.6 uses '#define' to support using the names *note\nPyBytesObject(): 582, *note PyBytesCheck(): 1209, *note",
            "subsections": []
        },
        "PyBytesFromStringAndSize(): 120a, and all the other functions and": {
            "content": "macros used with strings.\n\nInstances of the *note bytes: 295. type are immutable just as strings\nare.  A new *note bytearray: 294. type stores a mutable sequence of\nbytes:\n\n>>> bytearray([65, 66, 67])\nbytearray(b'ABC')\n>>> b = bytearray(u'\\u21ef\\u3244', 'utf-8')\n>>> b\nbytearray(b'\\xe2\\x87\\xaf\\xe3\\x89\\x84')\n>>> b[0] = '\\xe3'\n>>> b\nbytearray(b'\\xe3\\x87\\xaf\\xe3\\x89\\x84')\n>>> unicode(str(b), 'utf-8')\nu'\\u31ef \\u3244'\n",
            "subsections": []
        },
        "Byte arrays support most of the methods of string types, such as": {
            "content": "'startswith()'/'endswith()', 'find()'/'rfind()', and some of the methods\nof lists, such as 'append()', 'pop()', and 'reverse()'.\n\n>>> b = bytearray('ABC')\n>>> b.append('d')\n>>> b.append(ord('e'))\n>>> b\nbytearray(b'ABCde')\n\nThere's also a corresponding C API, with *note PyByteArrayFromObject():\n120b, *note PyByteArrayFromStringAndSize(): 120c, and various other\nfunctions.\n\nSee also\n........\n\nPEP 3112(1) - Bytes literals in Python 3000\n\nPEP written by Jason Orendorff; backported to 2.6 by Christian\nHeimes.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3112/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "Python's built-in file objects support a number of methods, but": {
            "content": "file-like objects don't necessarily support all of them.  Objects that\nimitate files usually support 'read()' and 'write()', but they may not\nsupport *note readline(): b5, for example.  Python 3.0 introduces a\nlayered I/O library in the *note io: 79. module that separates buffering\nand text-handling features from the fundamental read and write\noperations.\n\nThere are three levels of abstract base classes provided by the *note\nio: 79. module:\n\n* 'RawIOBase' defines raw I/O operations: 'read()', 'readinto()',\n'write()', 'seek()', 'tell()', 'truncate()', and 'close()'.  Most\nof the methods of this class will often map to a single system\ncall.  There are also 'readable()', 'writable()', and 'seekable()'\nmethods for determining what operations a given object will allow.\n\nPython 3.0 has concrete implementations of this class for files and\nsockets, but Python 2.6 hasn't restructured its file and socket\nobjects in this way.\n\n* 'BufferedIOBase' is an abstract base class that buffers data in\nmemory to reduce the number of system calls used, making I/O\nprocessing more efficient.  It supports all of the methods of\n'RawIOBase', and adds a 'raw' attribute holding the underlying raw\nobject.\n\nThere are five concrete classes implementing this ABC.\n'BufferedWriter' and 'BufferedReader' are for objects that support\nwrite-only or read-only usage that have a 'seek()' method for\nrandom access.  'BufferedRandom' objects support read and write\naccess upon the same underlying stream, and 'BufferedRWPair' is for\nobjects such as TTYs that have both read and write operations\nacting upon unconnected streams of data.  The 'BytesIO' class\nsupports reading, writing, and seeking over an in-memory buffer.\n\n* 'TextIOBase': Provides functions for reading and writing strings\n(remember, strings will be Unicode in Python 3.0), and supporting\n*note universal newlines: b90.  'TextIOBase' defines the *note\nreadline(): b5. method and supports iteration upon objects.\n\nThere are two concrete implementations.  'TextIOWrapper' wraps a\nbuffered I/O object, supporting all of the methods for text I/O and\nadding a 'buffer' attribute for access to the underlying object.\n'StringIO' simply buffers everything in memory without ever writing\nanything to disk.\n\n(In Python 2.6, *note io.StringIO: d94. is implemented in pure\nPython, so it's pretty slow.  You should therefore stick with the\nexisting 'StringIO' module or 'cStringIO' for now.  At some point\nPython 3.0's *note io: 79. module will be rewritten into C for\nspeed, and perhaps the C implementation will be backported to the\n2.x releases.)\n",
            "subsections": []
        },
        "In Python 2.6, the underlying implementations haven't been restructured": {
            "content": "to build on top of the *note io: 79. module's classes.  The module is\nbeing provided to make it easier to write code that's forward-compatible\nwith 3.0, and to save developers the effort of writing their own\nimplementations of buffering and text I/O.\n\nSee also\n........\n\nPEP 3116(1) - New I/O\n\nPEP written by Daniel Stutzbach, Mike Verdone, and Guido van\nRossum.  Code by Guido van Rossum, Georg Brandl, Walter Doerwald,\nJeremy Hylton, Martin von Lo\"wis, Tony Lownds, and others.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3116/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "The buffer protocol is a C-level API that lets Python types exchange": {
            "content": "pointers into their internal representations.  A memory-mapped file can\nbe viewed as a buffer of characters, for example, and this lets another\nmodule such as *note re: b4. treat memory-mapped files as a string of\ncharacters to be searched.\n",
            "subsections": []
        },
        "The primary users of the buffer protocol are numeric-processing packages": {
            "content": "such as NumPy, which expose the internal representation of arrays so\nthat callers can write data directly into an array instead of going\nthrough a slower API. This PEP updates the buffer protocol in light of\nexperience from NumPy development, adding a number of new features such\nas indicating the shape of an array or locking a memory region.\n",
            "subsections": []
        },
        "The most important new C API function is 'PyObjectGetBuffer(PyObject": {
            "content": "*obj, Pybuffer *view, int flags)', which takes an object and a set of\nflags, and fills in the 'Pybuffer' structure with information about the\nobject's memory representation.  Objects can use this operation to lock\nmemory in place while an external caller could be modifying the\ncontents, so there's a corresponding 'PyBufferRelease(Pybuffer *view)'\nto indicate that the external caller is done.\n\nThe 'flags' argument to *note PyObjectGetBuffer(): 541. specifies\nconstraints upon the memory returned.  Some examples are:\n\n* *note PyBUFWRITABLE: 120f. indicates that the memory must be\nwritable.\n\n* 'PyBUFLOCK' requests a read-only or exclusive lock on the memory.\n\n* *note PyBUFCCONTIGUOUS: 1210. and *note PyBUFFCONTIGUOUS: 1211.\nrequests a C-contiguous (last dimension varies the fastest) or\nFortran-contiguous (first dimension varies the fastest) array\nlayout.\n\nTwo new argument codes for *note PyArgParseTuple(): 2d1, 's*' and 'z*',\nreturn locked buffer objects for a parameter.\n\nSee also\n........\n\nPEP 3118(1) - Revising the buffer protocol\n\nPEP written by Travis Oliphant and Carl Banks; implemented by\nTravis Oliphant.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3118/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "Some object-oriented languages such as Java support interfaces,": {
            "content": "declaring that a class has a given set of methods or supports a given\naccess protocol.  Abstract Base Classes (or ABCs) are an equivalent\nfeature for Python.  The ABC support consists of an *note abc: 4. module\ncontaining a metaclass called 'ABCMeta', special handling of this\nmetaclass by the *note isinstance(): 14b. and *note issubclass(): 5b4.\nbuiltins, and a collection of basic ABCs that the Python developers\nthink will be widely useful.  Future versions of Python will probably\nadd more ABCs.\n",
            "subsections": []
        },
        "Let's say you have a particular class and wish to know whether it": {
            "content": "supports dictionary-style access.  The phrase \"dictionary-style\" is\nvague, however.  It probably means that accessing items with 'obj[1]'\nworks.  Does it imply that setting items with 'obj[2] = value' works?",
            "subsections": []
        },
        "Or that the object will have 'keys()', 'values()', and 'items()'": {
            "content": "methods?  What about the iterative variants such as 'iterkeys()'?  *note\ncopy(): 23. and 'update()'?  Iterating over the object with *note\niter(): 5ca.?\n\nThe Python 2.6 *note collections: 1b. module includes a number of\ndifferent ABCs that represent these distinctions.  'Iterable' indicates\nthat a class defines 'iter()', and 'Container' means the class\ndefines a 'contains()' method and therefore supports 'x in y'\nexpressions.  The basic dictionary interface of getting items, setting\nitems, and 'keys()', 'values()', and 'items()', is defined by the\n'MutableMapping' ABC.\n",
            "subsections": []
        },
        "You can derive your own classes from a particular ABC to indicate they": {
            "content": "support that ABC's interface:\n\nimport collections\n\nclass Storage(collections.MutableMapping):\n...\n",
            "subsections": []
        },
        "Alternatively, you could write the class without deriving from the": {
            "content": "desired ABC and instead register the class by calling the ABC's\n'register()' method:\n\nimport collections\n\nclass Storage:\n...\n\ncollections.MutableMapping.register(Storage)\n\nFor classes that you write, deriving from the ABC is probably clearer.",
            "subsections": []
        },
        "The 'register()' method is useful when you've written a new ABC that can": {
            "content": "describe an existing type or class, or if you want to declare that some\nthird-party class implements an ABC. For example, if you defined a\n'PrintableType' ABC, it's legal to do:\n\n# Register Python's types\nPrintableType.register(int)\nPrintableType.register(float)\nPrintableType.register(str)\n",
            "subsections": []
        },
        "Classes should obey the semantics specified by an ABC, but Python can't": {
            "content": "check this; it's up to the class author to understand the ABC's\nrequirements and to implement the code accordingly.\n",
            "subsections": []
        },
        "To check whether an object supports a particular interface, you can now": {
            "content": "write:\n\ndef func(d):\nif not isinstance(d, collections.MutableMapping):\nraise ValueError(\"Mapping object expected, not %r\" % d)\n",
            "subsections": []
        },
        "Don't feel that you must now begin writing lots of checks as in the": {
            "content": "above example.  Python has a strong tradition of duck-typing, where\nexplicit type-checking is never done and code simply calls methods on an\nobject, trusting that those methods will be there and raising an\nexception if they aren't.  Be judicious in checking for ABCs and only do\nit where it's absolutely necessary.\n",
            "subsections": []
        },
        "You can write your own ABCs by using 'abc.ABCMeta' as the metaclass in a": {
            "content": "class definition:\n\nfrom abc import ABCMeta, abstractmethod\n\nclass Drawable():\nmetaclass = ABCMeta\n\n@abstractmethod\ndef draw(self, x, y, scale=1.0):\npass\n\ndef drawdoubled(self, x, y):\nself.draw(x, y, scale=2.0)\n\n\nclass Square(Drawable):\ndef draw(self, x, y, scale):\n...\n",
            "subsections": []
        },
        "In the 'Drawable' ABC above, the 'drawdoubled()' method renders the": {
            "content": "object at twice its size and can be implemented in terms of other\nmethods described in 'Drawable'.  Classes implementing this ABC\ntherefore don't need to provide their own implementation of\n'drawdoubled()', though they can do so.  An implementation of 'draw()'\nis necessary, though; the ABC can't provide a useful generic\nimplementation.\n\nYou can apply the '@abstractmethod' decorator to methods such as\n'draw()' that must be implemented; Python will then raise an exception\nfor classes that don't define the method.  Note that the exception is\nonly raised when you actually try to create an instance of a subclass\nlacking the method:\n\n>>> class Circle(Drawable):\n...     pass\n...\n>>> c = Circle()\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nTypeError: Can't instantiate abstract class Circle with abstract methods draw\n>>>\n\nAbstract data attributes can be declared using the '@abstractproperty'\ndecorator:\n\nfrom abc import abstractproperty\n...\n\n@abstractproperty\ndef readonly(self):\nreturn self.x\n\nSubclasses must then define a 'readonly()' property.\n\nSee also\n........\n\nPEP 3119(1) - Introducing Abstract Base Classes\n\nPEP written by Guido van Rossum and Talin.  Implemented by Guido\nvan Rossum.  Backported to 2.6 by Benjamin Aranguren, with Alex\nMartelli.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3119/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "Python 3.0 changes the syntax for octal (base-8) integer literals,": {
            "content": "prefixing them with \"0o\" or \"0O\" instead of a leading zero, and adds\nsupport for binary (base-2) integer literals, signalled by a \"0b\" or\n\"0B\" prefix.\n",
            "subsections": []
        },
        "Python 2.6 doesn't drop support for a leading 0 signalling an octal": {
            "content": "number, but it does add support for \"0o\" and \"0b\":\n\n>>> 0o21, 2*8 + 1\n(17, 17)\n>>> 0b101111\n47\n\nThe *note oct(): 1142. builtin still returns numbers prefixed with a\nleading zero, and a new *note bin(): 1120. builtin returns the binary\nrepresentation for a number:\n\n>>> oct(42)\n'052'\n>>> futurebuiltins.oct(42)\n'0o52'\n>>> bin(173)\n'0b10101101'\n\nThe *note int(): 17e. and 'long()' builtins will now accept the \"0o\" and\n\"0b\" prefixes when base-8 or base-2 are requested, or when the 'base'\nargument is zero (signalling that the base used should be determined\nfrom the string):\n\n>>> int ('0o52', 0)\n42\n>>> int('1101', 2)\n13\n>>> int('0b1101', 2)\n13\n>>> int('0b1101', 0)\n13\n\nSee also\n........\n\nPEP 3127(1) - Integer Literal Support and Syntax\n\nPEP written by Patrick Maupin; backported to 2.6 by Eric Smith.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3127/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "Decorators have been extended from functions to classes.  It's now legal": {
            "content": "to write:\n\n@foo\n@bar\nclass A:\npass\n\nThis is equivalent to:\n\nclass A:\npass\n\nA = foo(bar(A))\n\nSee also\n........\n\nPEP 3129(1) - Class Decorators\n\nPEP written by Collin Winter.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3129/\n\nFile: python3.12.info,  Node: PEP 3141 A Type Hierarchy for Numbers,  Next: Other Language Changes<14>,  Prev: PEP 3129 Class Decorators,  Up: What's New in Python 2 6\n\n",
            "subsections": []
        },
        "Python 3.0 adds several abstract base classes for numeric types inspired": {
            "content": "by Scheme's numeric tower.  These classes were backported to 2.6 as the\n*note numbers: 99. module.\n",
            "subsections": []
        },
        "The most general ABC is 'Number'.  It defines no operations at all, and": {
            "content": "only exists to allow checking if an object is a number by doing\n'isinstance(obj, Number)'.\n\n'Complex' is a subclass of 'Number'.  Complex numbers can undergo the\nbasic operations of addition, subtraction, multiplication, division, and\nexponentiation, and you can retrieve the real and imaginary parts and\nobtain a number's conjugate.  Python's built-in complex type is an\nimplementation of 'Complex'.\n\n'Real' further derives from 'Complex', and adds operations that only\nwork on real numbers: 'floor()', 'trunc()', rounding, taking the\nremainder mod N, floor division, and comparisons.\n\n'Rational' numbers derive from 'Real', have 'numerator' and\n'denominator' properties, and can be converted to floats.  Python 2.6\nadds a simple rational-number class, 'Fraction', in the *note fractions:\n58. module.  (It's called 'Fraction' instead of 'Rational' to avoid a\nname clash with *note numbers.Rational: 1136.)\n\n'Integral' numbers derive from 'Rational', and can be shifted left and\nright with '<<' and '>>', combined using bitwise operations such as '&'\nand '|', and can be used as array indexes and slice boundaries.\n\nIn Python 3.0, the PEP slightly redefines the existing builtins *note\nround(): 114f, *note math.floor(): 1216, *note math.ceil(): 1217, and\nadds a new one, *note math.trunc(): 1218, that's been backported to\nPython 2.6.  *note math.trunc(): 1218. rounds toward zero, returning the\nclosest 'Integral' that's between the function's argument and zero.\n\nSee also\n........\n\nPEP 3141(1) - A Type Hierarchy for Numbers\n\nPEP written by Jeffrey Yasskin.\n\nScheme's numerical tower(2), from the Guile manual.\n\nScheme's number datatypes(3) from the R5RS Scheme specification.\n\n* Menu:\n\n* The fractions Module::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3141/\n\n(2)\nhttps://www.gnu.org/software/guile/manual/htmlnode/Numerical-Tower.html#Numerical-Tower\n\n(3)\nhttps://conservatory.scheme.org/schemers/Documents/Standards/R5RS/HTML/r5rs-Z-H-9.html#%sec6.2\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The fractions Module,  Up: PEP 3141 A Type Hierarchy for Numbers": {
            "content": "1.15.16.1 The 'fractions' Module\n................................\n\nTo fill out the hierarchy of numeric types, the *note fractions: 58.\nmodule provides a rational-number class.  Rational numbers store their\nvalues as a numerator and denominator forming a fraction, and can\nexactly represent numbers such as '2/3' that floating-point numbers can\nonly approximate.\n",
            "subsections": []
        },
        "The 'Fraction' constructor takes two 'Integral' values that will be the": {
            "content": "numerator and denominator of the resulting fraction.\n\n>>> from fractions import Fraction\n>>> a = Fraction(2, 3)\n>>> b = Fraction(2, 5)\n>>> float(a), float(b)\n(0.66666666666666663, 0.40000000000000002)\n>>> a+b\nFraction(16, 15)\n>>> a/b\nFraction(5, 3)\n",
            "subsections": []
        },
        "For converting floating-point numbers to rationals, the float type now": {
            "content": "has an 'asintegerratio()' method that returns the numerator and\ndenominator for a fraction that evaluates to the same floating-point\nvalue:\n\n>>> (2.5) .asintegerratio()\n(5, 2)\n>>> (3.1415) .asintegerratio()\n(7074029114692207L, 2251799813685248L)\n>>> (1./3) .asintegerratio()\n(6004799503160661L, 18014398509481984L)\n",
            "subsections": []
        },
        "Note that values that can only be approximated by floating-point": {
            "content": "numbers, such as 1./3, are not simplified to the number being\napproximated; the fraction attempts to match the floating-point value\n'exactly'.\n\nThe *note fractions: 58. module is based upon an implementation by",
            "subsections": []
        },
        "Sjoerd Mullender that was in Python's 'Demo/classes/' directory for a": {
            "content": "long time.  This implementation was significantly updated by Jeffrey\nYasskin.\n\nFile: python3.12.info,  Node: Other Language Changes<14>,  Next: New and Improved Modules<2>,  Prev: PEP 3141 A Type Hierarchy for Numbers,  Up: What's New in Python 2 6\n\n\nSome smaller changes made to the core Python language are:\n\n* Directories and zip archives containing a 'main.py' file can\nnow be executed directly by passing their name to the interpreter.\nThe directory or zip archive is automatically inserted as the first\nentry in sys.path.  (Suggestion and initial patch by Andy Chu,\nsubsequently revised by Phillip J. Eby and Nick Coghlan;\nbpo-1739468(1).)\n\n* The *note hasattr(): 1f7. function was catching and ignoring all\nerrors, under the assumption that they meant a 'getattr()'\nmethod was failing somehow and the return value of *note hasattr():\n1f7. would therefore be 'False'.  This logic shouldn't be applied\nto *note KeyboardInterrupt: 7f5. and *note SystemExit: b97,\nhowever; Python 2.6 will no longer discard such exceptions when\n*note hasattr(): 1f7. encounters them.  (Fixed by Benjamin\nPeterson; bpo-2196(2).)\n\n* When calling a function using the '' syntax to provide keyword\narguments, you are no longer required to use a Python dictionary;\nany mapping will now work:\n\n>>> def f(kw):\n...    print sorted(kw)\n...\n>>> ud=UserDict.UserDict()\n>>> ud['a'] = 1\n>>> ud['b'] = 'string'\n>>> f(ud)\n['a', 'b']\n\n(Contributed by Alexander Belopolsky; bpo-1686487(3).)\n\nIt's also become legal to provide keyword arguments after a '*args'\nargument to a function call.\n\n>>> def f(*args, kw):\n...     print args, kw\n...\n>>> f(1,2,3, *(4,5,6), keyword=13)\n(1, 2, 3, 4, 5, 6) {'keyword': 13}\n\nPreviously this would have been a syntax error.  (Contributed by\nAmaury Forgeot d'Arc; bpo-3473(4).)\n\n* A new builtin, 'next(iterator, [default])' returns the next item\nfrom the specified iterator.  If the 'default' argument is\nsupplied, it will be returned if 'iterator' has been exhausted;\notherwise, the *note StopIteration: a40. exception will be raised.\n(Backported in bpo-2719(5).)\n\n* Tuples now have 'index()' and 'count()' methods matching the list\ntype's 'index()' and 'count()' methods:\n\n>>> t = (0,1,2,3,4,0,1,2)\n>>> t.index(3)\n3\n>>> t.count(0)\n2\n\n(Contributed by Raymond Hettinger)\n\n* The built-in types now have improved support for extended slicing\nsyntax, accepting various combinations of '(start, stop, step)'.\nPreviously, the support was partial and certain corner cases\nwouldn't work.  (Implemented by Thomas Wouters.)\n\n* Properties now have three attributes, 'getter', 'setter' and\n'deleter', that are decorators providing useful shortcuts for\nadding a getter, setter or deleter function to an existing\nproperty.  You would use them like this:\n\nclass C(object):\n@property\ndef x(self):\nreturn self.x\n\n@x.setter\ndef x(self, value):\nself.x = value\n\n@x.deleter\ndef x(self):\ndel self.x\n\nclass D(C):\n@C.x.getter\ndef x(self):\nreturn self.x * 2\n\n@x.setter\ndef x(self, value):\nself.x = value / 2\n\n* Several methods of the built-in set types now accept multiple\niterables: 'intersection()', 'intersectionupdate()', 'union()',\n'update()', 'difference()' and 'differenceupdate()'.\n\n>>> s=set('1234567890')\n>>> s.intersection('abc123', 'cdf246')  # Intersection between all inputs\nset(['2'])\n>>> s.difference('246', '789')\nset(['1', '0', '3', '5'])\n\n(Contributed by Raymond Hettinger.)\n\n* Many floating-point features were added.  The *note float(): 4b7.\nfunction will now turn the string 'nan' into an IEEE 754 Not A\nNumber value, and '+inf' and '-inf' into positive or negative\ninfinity.  This works on any platform with IEEE 754 semantics.\n(Contributed by Christian Heimes; bpo-1635(6).)\n\nOther functions in the *note math: 89. module, 'isinf()' and\n'isnan()', return true if their floating-point argument is infinite\nor Not A Number.  (bpo-1640(7))\n\nConversion functions were added to convert floating-point numbers\ninto hexadecimal strings (bpo-3008(8)).  These functions convert\nfloats to and from a string representation without introducing\nrounding errors from the conversion between decimal and binary.\nFloats have a *note hex(): 1143. method that returns a string\nrepresentation, and the 'float.fromhex()' method converts a string\nback into a number:\n\n>>> a = 3.75\n>>> a.hex()\n'0x1.e000000000000p+1'\n>>> float.fromhex('0x1.e000000000000p+1')\n3.75\n>>> b=1./3\n>>> b.hex()\n'0x1.5555555555555p-2'\n\n* A numerical nicety: when creating a complex number from two floats\non systems that support signed zeros (-0 and +0), the *note\ncomplex(): 3ad. constructor will now preserve the sign of the zero.\n(Fixed by Mark T. Dickinson; bpo-1507(9).)\n\n* Classes that inherit a 'hash()' method from a parent class can\nset 'hash = None' to indicate that the class isn't hashable.\nThis will make 'hash(obj)' raise a *note TypeError: 28e. and the\nclass will not be indicated as implementing the 'Hashable' ABC.\n\nYou should do this when you've defined a 'cmp()' or 'eq()'\nmethod that compares objects by their value rather than by\nidentity.  All objects have a default hash method that uses\n'id(obj)' as the hash value.  There's no tidy way to remove the\n'hash()' method inherited from a parent class, so assigning\n'None' was implemented as an override.  At the C level, extensions\ncan set 'tphash' to *note PyObjectHashNotImplemented(): 121b.\n(Fixed by Nick Coghlan and Amaury Forgeot d'Arc; bpo-2235(10).)\n\n* The *note GeneratorExit: 121c. exception now subclasses *note\nBaseException: 37c. instead of *note Exception: 7ff.  This means\nthat an exception handler that does 'except Exception:' will not\ninadvertently catch *note GeneratorExit: 121c.  (Contributed by\nChad Austin; bpo-1537(11).)\n\n* Generator objects now have a 'gicode' attribute that refers to the\noriginal code object backing the generator.  (Contributed by Collin\nWinter; bpo-1473257(12).)\n\n* The *note compile(): 528. built-in function now accepts keyword\narguments as well as positional parameters.  (Contributed by Thomas\nWouters; bpo-1444529(13).)\n\n* The *note complex(): 3ad. constructor now accepts strings\ncontaining parenthesized complex numbers, meaning that\n'complex(repr(cplx))' will now round-trip values.  For example,\n'complex('(3+4j)')' now returns the value (3+4j).\n(bpo-1491866(14))\n\n* The string 'translate()' method now accepts 'None' as the\ntranslation table parameter, which is treated as the identity\ntransformation.  This makes it easier to carry out operations that\nonly delete characters.  (Contributed by Bengt Richter and\nimplemented by Raymond Hettinger; bpo-1193128(15).)\n\n* The built-in *note dir(): 3ff. function now checks for a\n'dir()' method on the objects it receives.  This method must\nreturn a list of strings containing the names of valid attributes\nfor the object, and lets the object control the value that *note\ndir(): 3ff. produces.  Objects that have 'getattr()' or\n'getattribute()' methods can use this to advertise\npseudo-attributes they will honor.  (bpo-1591665(16))\n\n* Instance method objects have new attributes for the object and\nfunction comprising the method; the new synonym for 'imself' is\n*note self: 121d, and 'imfunc' is also available as *note\nfunc: 1171.  The old names are still supported in Python 2.6,\nbut are gone in 3.0.\n\n* An obscure change: when you use the *note locals(): 173. function\ninside a *note class: 114c. statement, the resulting dictionary no\nlonger returns free variables.  (Free variables, in this case, are\nvariables referenced in the 'class' statement that aren't\nattributes of the class.)\n\n* Menu:\n\n* Optimizations: Optimizations<13>.\n* Interpreter Changes: Interpreter Changes<2>.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=1739468\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=2196\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=1686487\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=3473\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=2719\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=1635\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=1640\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=3008\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=1507\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=2235\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=1537\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=1473257\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=1444529\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=1491866\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=1193128\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=1591665\n\nFile: python3.12.info,  Node: Optimizations<13>,  Next: Interpreter Changes<2>,  Up: Other Language Changes<14>\n\n1.15.17.1 Optimizations\n.......................\n\n* The *note warnings: 10d. module has been rewritten in C. This makes\nit possible to invoke warnings from the parser, and may also make\nthe interpreter's startup faster.  (Contributed by Neal Norwitz and\nBrett Cannon; bpo-1631171(1).)\n\n* Type objects now have a cache of methods that can reduce the work\nrequired to find the correct method implementation for a particular\nclass; once cached, the interpreter doesn't need to traverse base\nclasses to figure out the right method to call.  The cache is\ncleared if a base class or the class itself is modified, so the\ncache should remain correct even in the face of Python's dynamic\nnature.  (Original optimization implemented by Armin Rigo, updated\nfor Python 2.6 by Kevin Jacobs; bpo-1700288(2).)\n\nBy default, this change is only applied to types that are included\nwith the Python core.  Extension modules may not necessarily be\ncompatible with this cache, so they must explicitly add\n'PyTPFLAGSHAVEVERSIONTAG' to the module's 'tpflags' field to\nenable the method cache.  (To be compatible with the method cache,\nthe extension module's code must not directly access and modify the\n'tpdict' member of any of the types it implements.  Most modules\ndon't do this, but it's impossible for the Python interpreter to\ndetermine that.  See bpo-1878(3) for some discussion.)\n\n* Function calls that use keyword arguments are significantly faster\nby doing a quick pointer comparison, usually saving the time of a\nfull string comparison.  (Contributed by Raymond Hettinger, after\nan initial implementation by Antoine Pitrou; bpo-1819(4).)\n\n* All of the functions in the *note struct: cf. module have been\nrewritten in C, thanks to work at the Need For Speed sprint.\n(Contributed by Raymond Hettinger.)\n\n* Some of the standard built-in types now set a bit in their type\nobjects.  This speeds up checking whether an object is a subclass\nof one of these types.  (Contributed by Neal Norwitz.)\n\n* Unicode strings now use faster code for detecting whitespace and\nline breaks; this speeds up the 'split()' method by about 25% and\n'splitlines()' by 35%.  (Contributed by Antoine Pitrou.)  Memory\nusage is reduced by using pymalloc for the Unicode string's data.\n\n* The 'with' statement now stores the *note exit(): 1175. method\non the stack, producing a small speedup.  (Implemented by Jeffrey\nYasskin.)\n\n* To reduce memory usage, the garbage collector will now clear\ninternal free lists when garbage-collecting the highest generation\nof objects.  This may return memory to the operating system sooner.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=1631171\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=1700288\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=1878\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=1819\n\nFile: python3.12.info,  Node: Interpreter Changes<2>,  Prev: Optimizations<13>,  Up: Other Language Changes<14>\n\n1.15.17.2 Interpreter Changes\n.............................\n",
            "subsections": []
        },
        "Two command-line options have been reserved for use by other Python": {
            "content": "implementations.  The *note -J: 1221. switch has been reserved for use\nby Jython for Jython-specific options, such as switches that are passed\nto the underlying JVM. *note -X: 188. has been reserved for options\nspecific to a particular implementation of Python such as CPython,",
            "subsections": []
        },
        "Jython, or IronPython.  If either option is used with Python 2.6, the": {
            "content": "interpreter will report that the option isn't currently used.\n",
            "subsections": []
        },
        "Python can now be prevented from writing '.pyc' or '.pyo' files by": {
            "content": "supplying the *note -B: 1222. switch to the Python interpreter, or by\nsetting the *note PYTHONDONTWRITEBYTECODE: 1223. environment variable\nbefore running the interpreter.  This setting is available to Python\nprograms as the 'sys.dontwritebytecode' variable, and Python code can\nchange the value to modify the interpreter's behaviour.  (Contributed by",
            "subsections": []
        },
        "Neal Norwitz and Georg Brandl.)": {
            "content": "",
            "subsections": []
        },
        "The encoding used for standard input, output, and standard error can be": {
            "content": "specified by setting the *note PYTHONIOENCODING: e7e. environment\nvariable before running the interpreter.  The value should be a string\nin the form '<encoding>' or '<encoding>:<errorhandler>'.  The 'encoding'\npart specifies the encoding's name, e.g.  'utf-8' or 'latin-1'; the\noptional 'errorhandler' part specifies what to do with characters that\ncan't be handled by the encoding, and should be one of \"error\",\n\"ignore\", or \"replace\".  (Contributed by Martin von Lo\"wis.)\n\nFile: python3.12.info,  Node: New and Improved Modules<2>,  Next: Deprecations and Removals,  Prev: Other Language Changes<14>,  Up: What's New in Python 2 6\n\n",
            "subsections": []
        },
        "The 'parse()' function takes an expression and returns an AST. The": {
            "content": "'dump()' function outputs a representation of a tree, suitable for\ndebugging:\n\nimport ast\n\nt = ast.parse(\"\"\"\nd = {}\nfor i in 'abcdefghijklm':\nd[i + i] = ord(i) - ord('a') + 1\nprint d\n\"\"\")\nprint ast.dump(t)\n\nThis outputs a deeply nested tree:\n\nModule(body=[\nAssign(targets=[\nName(id='d', ctx=Store())\n], value=Dict(keys=[], values=[]))\nFor(target=Name(id='i', ctx=Store()),\niter=Str(s='abcdefghijklm'), body=[\nAssign(targets=[\nSubscript(value=\nName(id='d', ctx=Load()),\nslice=\nIndex(value=\nBinOp(left=Name(id='i', ctx=Load()), op=Add(),\nright=Name(id='i', ctx=Load()))), ctx=Store())\n], value=\nBinOp(left=\nBinOp(left=\nCall(func=\nName(id='ord', ctx=Load()), args=[\nName(id='i', ctx=Load())\n], keywords=[], starargs=None, kwargs=None),\nop=Sub(), right=Call(func=\nName(id='ord', ctx=Load()), args=[\nStr(s='a')\n], keywords=[], starargs=None, kwargs=None)),\nop=Add(), right=Num(n=1)))\n], orelse=[])\nPrint(dest=None, values=[\nName(id='d', ctx=Load())\n], nl=True)\n])\n",
            "subsections": []
        },
        "The 'literaleval()' method takes a string or an AST representing a": {
            "content": "literal expression, parses and evaluates it, and returns the resulting\nvalue.  A literal expression is a Python expression containing only\nstrings, numbers, dictionaries, etc.  but no statements or function\ncalls.  If you need to evaluate an expression but cannot accept the\nsecurity risk of using an *note eval(): 690. call, 'literaleval()' will\nhandle it safely:\n\n>>> literal = '(\"a\", \"b\", {2:4, 3:8, 1:2})'\n>>> print ast.literaleval(literal)\n('a', 'b', {1: 2, 2: 4, 3: 8})\n>>> print ast.literaleval('\"a\" + \"b\"')\nTraceback (most recent call last):\n...\nValueError: malformed string\n",
            "subsections": []
        },
        "The module also includes 'NodeVisitor' and 'NodeTransformer' classes for": {
            "content": "traversing and modifying an AST, and functions for common\ntransformations such as changing line numbers.\n\nFile: python3.12.info,  Node: The futurebuiltins module,  Next: The json module JavaScript Object Notation,  Prev: The ast module,  Up: New and Improved Modules<2>\n\n1.15.18.2 The 'futurebuiltins' module\n......................................\n",
            "subsections": []
        },
        "Python 3.0 makes many changes to the repertoire of built-in functions,": {
            "content": "and most of the changes can't be introduced in the Python 2.x series\nbecause they would break compatibility.  The 'futurebuiltins' module\nprovides versions of these built-in functions that can be imported when\nwriting 3.0-compatible code.\n\nThe functions in this module currently include:\n\n* 'ascii(obj)': equivalent to *note repr(): 5f0.  In Python 3.0,\n*note repr(): 5f0. will return a Unicode string, while *note\nascii(): 123b. will return a pure ASCII bytestring.\n\n* 'filter(predicate, iterable)', 'map(func, iterable1, ...)': the 3.0\nversions return iterators, unlike the 2.x builtins which return\nlists.\n\n* 'hex(value)', 'oct(value)': instead of calling the 'hex()' or\n'oct()' methods, these versions will call the 'index()'\nmethod and convert the result to hexadecimal or octal.  *note\noct(): 1142. will use the new '0o' notation for its result.\n\nFile: python3.12.info,  Node: The json module JavaScript Object Notation,  Next: The plistlib module A Property-List Parser,  Prev: The futurebuiltins module,  Up: New and Improved Modules<2>\n\n1.15.18.3 The 'json' module: JavaScript Object Notation\n.......................................................\n\nThe new *note json: 7c. module supports the encoding and decoding of",
            "subsections": []
        },
        "Python types in JSON (Javascript Object Notation).  JSON is a": {
            "content": "lightweight interchange format often used in web applications.  For more\ninformation about JSON, see 'http://www.json.org'.\n\n*note json: 7c. comes with support for decoding and encoding most\nbuilt-in Python types.  The following example encodes and decodes a\ndictionary:\n\n>>> import json\n>>> data = {\"spam\": \"foo\", \"parrot\": 42}\n>>> injson = json.dumps(data) # Encode the data\n>>> injson\n'{\"parrot\": 42, \"spam\": \"foo\"}'\n>>> json.loads(injson) # Decode into a Python object\n{\"spam\": \"foo\", \"parrot\": 42}\n",
            "subsections": []
        },
        "It's also possible to write your own decoders and encoders to support": {
            "content": "more types.  Pretty-printing of the JSON strings is also supported.\n\n*note json: 7c. (originally called simplejson) was written by Bob\nIppolito.\n\nFile: python3.12.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>\n\n1.15.18.4 The 'plistlib' module: A Property-List Parser\n.......................................................\n",
            "subsections": []
        },
        "The '.plist' format is commonly used on Mac OS X to store basic data": {
            "content": "types (numbers, strings, lists, and dictionaries) by serializing them\ninto an XML-based format.  It resembles the XML-RPC serialization of\ndata types.\n",
            "subsections": []
        },
        "Despite being primarily used on Mac OS X, the format has nothing": {
            "content": "",
            "subsections": []
        },
        "Mac-specific about it and the Python implementation works on any": {
            "content": "platform that Python supports, so the *note plistlib: a6. module has\nbeen promoted to the standard library.\n\nUsing the module is simple:\n\nimport sys\nimport plistlib\nimport datetime\n\n# Create data structure\ndatastruct = dict(lastAccessed=datetime.datetime.now(),\nversion=1,\ncategories=('Personal','Shared','Private'))\n\n# Create string containing XML.\npliststr = plistlib.writePlistToString(datastruct)\nnewstruct = plistlib.readPlistFromString(pliststr)\nprint datastruct\nprint newstruct\n\n# Write data structure to a file and read it back.\nplistlib.writePlist(datastruct, '/tmp/customizations.plist')\nnewstruct = plistlib.readPlist('/tmp/customizations.plist')\n\n# read/writePlist accepts file-like objects as well as paths.\nplistlib.writePlist(datastruct, sys.stdout)\n\nFile: python3.12.info,  Node: ctypes Enhancements,  Next: Improved SSL Support,  Prev: The plistlib module A Property-List Parser,  Up: New and Improved Modules<2>\n\n1.15.18.5 ctypes Enhancements\n.............................\n\nThomas Heller continued to maintain and enhance the *note ctypes: 28.\nmodule.\n\n*note ctypes: 28. now supports a 'cbool' datatype that represents the\nC99 'bool' type.  (Contributed by David Remahl; bpo-1649190(1).)\n\nThe *note ctypes: 28. string, buffer and array types have improved\nsupport for extended slicing syntax, where various combinations of\n'(start, stop, step)' are supplied.  (Implemented by Thomas Wouters.)\n\nAll *note ctypes: 28. data types now support 'frombuffer()' and\n'frombuffercopy()' methods that create a ctypes instance based on a\nprovided buffer object.  'frombuffercopy()' copies the contents of the\nobject, while 'frombuffer()' will share the same memory area.\n\nA new calling convention tells *note ctypes: 28. to clear the 'errno' or\nWin32 LastError variables at the outset of each wrapped call.\n(Implemented by Thomas Heller; bpo-1798(2).)\n\nYou can now retrieve the Unix 'errno' variable after a function call.\nWhen creating a wrapped function, you can supply 'useerrno=True' as a\nkeyword parameter to the 'DLL()' function and then call the module-level\nmethods 'seterrno()' and 'geterrno()' to set and retrieve the error\nvalue.\n",
            "subsections": []
        },
        "The Win32 LastError variable is similarly supported by the 'DLL()',": {
            "content": "'OleDLL()', and 'WinDLL()' functions.  You supply 'uselasterror=True'\nas a keyword parameter and then call the module-level methods\n'setlasterror()' and 'getlasterror()'.\n",
            "subsections": []
        },
        "The 'byref()' function, used to retrieve a pointer to a ctypes instance,": {
            "content": "now has an optional 'offset' parameter that is a byte count that will be\nadded to the returned pointer.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=1649190\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=1798\n\nFile: python3.12.info,  Node: Improved SSL Support,  Prev: ctypes Enhancements,  Up: New and Improved Modules<2>\n\n1.15.18.6 Improved SSL Support\n..............................\n",
            "subsections": []
        },
        "Bill Janssen made extensive improvements to Python 2.6's support for the": {
            "content": "Secure Sockets Layer by adding a new module, *note ssl: ca, that's built\natop the OpenSSL(1) library.  This new module provides more control over\nthe protocol negotiated, the X.509 certificates used, and has better\nsupport for writing SSL servers (as opposed to clients) in Python.  The\nexisting SSL support in the *note socket: c6. module hasn't been removed\nand continues to work, though it will be removed in Python 3.0.\n",
            "subsections": []
        },
        "To use the new module, you must first create a TCP connection in the": {
            "content": "usual way and then pass it to the 'ssl.wrapsocket()' function.  It's\npossible to specify whether a certificate is required, and to obtain\ncertificate info by calling the 'getpeercert()' method.\n\nSee also\n........\n\nThe documentation for the *note ssl: ca. module.\n\n---------- Footnotes ----------\n\n(1) https://www.openssl.org/\n\nFile: python3.12.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\n\n\n* String exceptions have been removed.  Attempting to use them raises\na *note TypeError: 28e.\n\n* Changes to the *note Exception: 7ff. interface as dictated by PEP\n352(1) continue to be made.  For 2.6, the 'message' attribute is\nbeing deprecated in favor of the *note args: 2cb. attribute.\n\n* (3.0-warning mode) Python 3.0 will feature a reorganized standard\nlibrary that will drop many outdated modules and rename others.\nPython 2.6 running in 3.0-warning mode will warn about these\nmodules when they are imported.\n\nThe list of deprecated modules is: 'audiodev', 'bgenlocations',\n'buildtools', 'bundlebuilder', 'Canvas', 'compiler', 'dircache',\n'dl', 'fpformat', 'gensuitemodule', 'ihooks', 'imageop', 'imgfile',\n'linuxaudiodev', 'mhlib', 'mimetools', 'multifile', 'new', 'pure',\n'statvfs', 'sunaudiodev', 'test.testall', and 'toaiff'.\n\n* The 'gopherlib' module has been removed.\n\n* The 'MimeWriter' module and 'mimify' module have been deprecated;\nuse the *note email: 37. package instead.\n\n* The 'md5' module has been deprecated; use the *note hashlib: 63.\nmodule instead.\n\n* The 'posixfile' module has been deprecated; *note fcntl.lockf():\n1241. provides better locking.\n\n* The 'popen2' module has been deprecated; use the *note subprocess:\nd0. module.\n\n* The 'rgbimg' module has been removed.\n\n* The 'sets' module has been deprecated; it's better to use the\nbuilt-in *note set: 39d. and *note frozenset: 39e. types.\n\n* The 'sha' module has been deprecated; use the *note hashlib: 63.\nmodule instead.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0352/\n\nFile: python3.12.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\n\n\nChanges to Python's build process and to the C API include:\n\n* Python now must be compiled with C89 compilers (after 19 years!).\nThis means that the Python source tree has dropped its own\nimplementations of 'memmove()' and 'strerror()', which are in the\nC89 standard library.\n\n* Python 2.6 can be built with Microsoft Visual Studio 2008 (version\n9.0), and this is the new default compiler.  See the 'PCbuild'\ndirectory for the build files.  (Implemented by Christian Heimes.)\n\n* On Mac OS X, Python 2.6 can be compiled as a 4-way universal build.\nThe 'configure' script can take a\n'--with-universal-archs=[32-bit|64-bit|all]' switch, controlling\nwhether the binaries are built for 32-bit architectures (x86,\nPowerPC), 64-bit (x86-64 and PPC-64), or both.  (Contributed by\nRonald Oussoren.)\n\n* A new function added in Python 2.6.6, 'PySysSetArgvEx()', sets the\nvalue of 'sys.argv' and can optionally update 'sys.path' to include\nthe directory containing the script named by 'sys.argv[0]'\ndepending on the value of an 'updatepath' parameter.\n\nThis function was added to close a security hole for applications\nthat embed Python.  The old function, 'PySysSetArgv()', would\nalways update 'sys.path', and sometimes it would add the current\ndirectory.  This meant that, if you ran an application embedding\nPython in a directory controlled by someone else, attackers could\nput a Trojan-horse module in the directory (say, a file named\n'os.py') that your application would then import and run.\n\nIf you maintain a C/C++ application that embeds Python, check\nwhether you're calling 'PySysSetArgv()' and carefully consider\nwhether the application should be using 'PySysSetArgvEx()' with\n'updatepath' set to false.  Note that using this function will\nbreak compatibility with Python versions 2.6.5 and earlier; if you\nhave to continue working with earlier versions, you can leave the\ncall to 'PySysSetArgv()' alone and call\n'PyRunSimpleString(\"sys.path.pop(0)\\n\")' afterwards to discard the\nfirst 'sys.path' component.\n\nSecurity issue reported as CVE-2008-5983(1); discussed in\ngh-50003(2), and fixed by Antoine Pitrou.\n\n* The BerkeleyDB module now has a C API object, available as\n'bsddb.db.api'.  This object can be used by other C extensions that\nwish to use the 'bsddb' module for their own purposes.\n(Contributed by Duncan Grisby.)\n\n* The new buffer interface, previously described in *note the PEP\n3118 section: 120e, adds *note PyObjectGetBuffer(): 541. and *note\nPyBufferRelease(): 54a, as well as a few other functions.\n\n* Python's use of the C stdio library is now thread-safe, or at least\nas thread-safe as the underlying library is.  A long-standing\npotential bug occurred if one thread closed a file object while\nanother thread was reading from or writing to the object.  In 2.6\nfile objects have a reference count, manipulated by the\n'PyFileIncUseCount()' and 'PyFileDecUseCount()' functions.  File\nobjects can't be closed unless the reference count is zero.\n'PyFileIncUseCount()' should be called while the GIL is still\nheld, before carrying out an I/O operation using the 'FILE *'\npointer, and 'PyFileDecUseCount()' should be called immediately\nafter the GIL is re-acquired.  (Contributed by Antoine Pitrou and\nGregory P. Smith.)\n\n* Importing modules simultaneously in two different threads no longer\ndeadlocks; it will now raise an *note ImportError: 145.  A new API\nfunction, *note PyImportImportModuleNoBlock(): 324, will look for\na module in 'sys.modules' first, then try to import it after\nacquiring an import lock.  If the import lock is held by another\nthread, an *note ImportError: 145. is raised.  (Contributed by\nChristian Heimes.)\n\n* Several functions return information about the platform's\nfloating-point support.  *note PyFloatGetMax(): 1243. returns the\nmaximum representable floating point value, and *note\nPyFloatGetMin(): 1244. returns the minimum positive value.  *note\nPyFloatGetInfo(): 1245. returns an object containing more\ninformation from the 'float.h' file, such as '\"mantdig\"' (number\nof digits in the mantissa), '\"epsilon\"' (smallest difference\nbetween 1.0 and the next largest value representable), and several\nothers.  (Contributed by Christian Heimes; bpo-1534(3).)\n\n* C functions and methods that use *note PyComplexAsCComplex():\n1246. will now accept arguments that have a 'complex()' method.\nIn particular, the functions in the *note cmath: 16. module will\nnow accept objects with this method.  This is a backport of a\nPython 3.0 change.  (Contributed by Mark Dickinson;\nbpo-1675423(4).)\n\n* Python's C API now includes two functions for case-insensitive\nstring comparisons, 'PyOSstricmp(char*, char*)' and\n'PyOSstrnicmp(char*, char*, Pyssizet)'.  (Contributed by\nChristian Heimes; bpo-1635(5).)\n\n* Many C extensions define their own little macro for adding integers\nand strings to the module's dictionary in the 'init*' function.\nPython 2.6 finally defines standard macros for adding values to a\nmodule, *note PyModuleAddStringMacro: 1247. and *note\nPyModuleAddIntMacro(): 1248.  (Contributed by Christian Heimes.)\n\n* Some macros were renamed in both 3.0 and 2.6 to make it clearer\nthat they are macros, not functions.  'PySize()' became *note\nPySIZE(): 56d, 'PyType()' became *note PyTYPE(): 56b, and\n'PyRefcnt()' became *note PyREFCNT(): 6bd.  The mixed-case macros\nare still available in Python 2.6 for backward compatibility.\n(bpo-1629(6))\n\n* Distutils now places C extensions it builds in a different\ndirectory when running on a debug version of Python.  (Contributed\nby Collin Winter; bpo-1530959(7).)\n\n* Several basic data types, such as integers and strings, maintain\ninternal free lists of objects that can be re-used.  The data\nstructures for these free lists now follow a naming convention: the\nvariable is always named 'freelist', the counter is always named\n'numfree', and a macro 'Py<typename>MAXFREELIST' is always\ndefined.\n\n* A new Makefile target, \"make patchcheck\", prepares the Python\nsource tree for making a patch: it fixes trailing whitespace in all\nmodified '.py' files, checks whether the documentation has been\nchanged, and reports whether the 'Misc/ACKS' and 'Misc/NEWS' files\nhave been updated.  (Contributed by Brett Cannon.)\n\nAnother new target, \"make profile-opt\", compiles a Python binary\nusing GCC's profile-guided optimization.  It compiles Python with\nprofiling enabled, runs the test suite to obtain a set of profiling\nresults, and then compiles using these results for optimization.\n(Contributed by Gregory P. Smith.)\n\n* Menu:\n\n* Port-Specific Changes; Windows: Port-Specific Changes Windows<2>.\n* Port-Specific Changes; Mac OS X: Port-Specific Changes Mac OS X<2>.\n* Port-Specific Changes; IRIX: Port-Specific Changes IRIX.\n\n---------- Footnotes ----------\n\n(1) http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-5983\n\n(2) https://github.com/python/cpython/issues/50003\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=1534\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=1675423\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=1635\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=1629\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=1530959\n\nFile: python3.12.info,  Node: Port-Specific Changes Windows<2>,  Next: Port-Specific Changes Mac OS X<2>,  Up: Build and C API Changes<9>\n\n1.15.20.1 Port-Specific Changes: Windows\n........................................\n\n* The support for Windows 95, 98, ME and NT4 has been dropped.\nPython 2.6 requires at least Windows 2000 SP4.\n\n* The new default compiler on Windows is Visual Studio 2008 (version\n9.0).  The build directories for Visual Studio 2003 (version 7.1)\nand 2005 (version 8.0) were moved into the PC/ directory.  The new\n'PCbuild' directory supports cross compilation for X64, debug\nbuilds and Profile Guided Optimization (PGO). PGO builds are\nroughly 10% faster than normal builds.  (Contributed by Christian\nHeimes with help from Amaury Forgeot d'Arc and Martin von Lo\"wis.)\n\n* The *note msvcrt: 8e. module now supports both the normal and wide\nchar variants of the console I/O API. The *note getwch(): 124a.\nfunction reads a keypress and returns a Unicode value, as does the\n*note getwche(): 124b. function.  The *note putwch(): 124c.\nfunction takes a Unicode character and writes it to the console.\n(Contributed by Christian Heimes.)\n\n* *note os.path.expandvars(): 122e. will now expand environment\nvariables in the form \"%var%\", and \"~user\" will be expanded into\nthe user's home directory path.  (Contributed by Josiah Carlson;\nbpo-957650(1).)\n\n* The *note socket: c6. module's socket objects now have an *note\nioctl(): b22. method that provides a limited interface to the\n'WSAIoctl()' system interface.\n\n* The *note winreg: 111. module now has a function, *note\nExpandEnvironmentStrings(): 124d, that expands environment variable\nreferences such as '%NAME%' in an input string.  The handle objects\nprovided by this module now support the context protocol, so they\ncan be used in *note with: 396. statements.  (Contributed by\nChristian Heimes.)\n\n*note winreg: 111. also has better support for x64 systems,\nexposing the *note DisableReflectionKey(): 11d8, *note\nEnableReflectionKey(): 11d9, and *note QueryReflectionKey(): 11da.\nfunctions, which enable and disable registry reflection for 32-bit\nprocesses running on 64-bit systems.  (bpo-1753245(2))\n\n* The *note msilib: 8d. module's 'Record' object gained *note\nGetInteger(): 124e. and *note GetString(): 124f. methods that\nreturn field values as an integer or a string.  (Contributed by\nFloris Bruynooghe; bpo-2125(3).)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=957650\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=1753245\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=2125\n\nFile: python3.12.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>\n\n1.15.20.2 Port-Specific Changes: Mac OS X\n.........................................\n\n* When compiling a framework build of Python, you can now specify the\nframework name to be used by providing the '--with-framework-name='\noption to the 'configure' script.\n\n* The 'macfs' module has been removed.  This in turn required the\n'macostools.touched()' function to be removed because it depended\non the 'macfs' module.  (bpo-1490190(1))\n\n* Many other Mac OS modules have been deprecated and will be removed\nin Python 3.0: 'builtinSuites', 'aepack', 'aetools', 'aetypes',\n'applesingle', 'appletrawmain', 'appletrunner', 'argvemulator',\n'Audiomac', 'autoGIL', 'Carbon', 'cfmfile', 'CodeWarrior',\n'ColorPicker', 'EasyDialogs', 'Explorer', 'Finder', 'FrameWork',\n'findertools', 'ic', 'icglue', 'icopen', 'macerrors', 'MacOS',\n'macfs', 'macostools', 'macresource', 'MiniAEFrame', 'Nav',\n'Netscape', 'OSATerminology', 'pimp', 'PixMapWrapper', 'StdSuites',\n'SystemEvents', 'Terminal', and 'terminalcommand'.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=1490190\n\nFile: python3.12.info,  Node: Port-Specific Changes IRIX,  Prev: Port-Specific Changes Mac OS X<2>,  Up: Build and C API Changes<9>\n\n1.15.20.3 Port-Specific Changes: IRIX\n.....................................\n\nA number of old IRIX-specific modules were deprecated and will be\nremoved in Python 3.0: 'al' and 'AL', 'cd', 'cddb', 'cdplayer', 'CL' and\n'cl', 'DEVICE', 'ERRNO', 'FILE', 'FL' and 'fl', 'flp', 'fm', 'GET',\n'GLWS', 'GL' and 'gl', 'IN', 'IOCTL', 'jpeg', 'panelparser', 'readcd',\n'SV' and 'sv', 'torgb', 'videoreader', and 'WAIT'.\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "Jewett, Kent Johnson, Chris Lambacher, Martin Michlmayr, Antoine Pitrou,": {
            "content": "Brian Warner.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": [
                {
                    "name": "1.16 What's New in Python 2.5",
                    "content": ""
                }
            ]
        },
        "Author: A.M. Kuchling": {
            "content": "* Menu:\n\n* Introduction: Introduction<2>.\n* PEP 227; Nested Scopes: PEP 227 Nested Scopes<2>.\n* PEP 236; future Directives: PEP 236 future Directives.\n* PEP 207; Rich Comparisons: PEP 207 Rich Comparisons.\n* PEP 230; Warning Framework: PEP 230 Warning Framework.\n* PEP 229; New Build System: PEP 229 New Build System.\n* PEP 205; Weak References: PEP 205 Weak References.\n* PEP 232; Function Attributes: PEP 232 Function Attributes.\n* PEP 235; Importing Modules on Case-Insensitive Platforms: PEP 235 Importing Modules on Case-Insensitive Platforms.\n* PEP 217; Interactive Display Hook: PEP 217 Interactive Display Hook.\n* PEP 208; New Coercion Model: PEP 208 New Coercion Model.\n* PEP 241; Metadata in Python Packages: PEP 241 Metadata in Python Packages.\n* New and Improved Modules: New and Improved Modules<4>.\n* Other Changes and Fixes: Other Changes and Fixes<4>.\n* Acknowledgements: Acknowledgements<7>.\n\nFile: python3.12.info,  Node: Introduction<2>,  Next: PEP 227 Nested Scopes<2>,  Up: What's New in Python 2 1\n\n",
            "subsections": []
        },
        "This article explains the new features in Python 2.5.  The final release": {
            "content": "of Python 2.5 is scheduled for August 2006; PEP 356(1) describes the\nplanned release schedule.  Python 2.5 was released on September 19,\n2006.\n",
            "subsections": []
        },
        "The changes in Python 2.5 are an interesting mix of language and library": {
            "content": "improvements.  The library enhancements will be more important to",
            "subsections": []
        },
        "Python's user community, I think, because several widely useful packages": {
            "content": "were added.  New modules include ElementTree for XML processing\n('xml.etree'), the SQLite database module ('sqlite'), and the *note\nctypes: 28. module for calling C functions.\n",
            "subsections": []
        },
        "The language changes are of middling significance.  Some pleasant new": {
            "content": "features were added, but most of them aren't features that you'll use\nevery day.  Conditional expressions were finally added to the language\nusing a novel syntax; see section *note PEP 308; Conditional\nExpressions: 1258.  The new '*note with: 396.' statement will make\nwriting cleanup code easier (section *note PEP 343; The 'with'\nstatement: 1259.).  Values can now be passed into generators (section\n*note PEP 342; New Generator Features: 125a.).  Imports are now visible\nas either absolute or relative (section *note PEP 328; Absolute and",
            "subsections": []
        },
        "Relative Imports: 125b.).  Some corner cases of exception handling are": {
            "content": "handled better (section *note PEP 341; Unified try/except/finally:\n125c.).  All these improvements are worthwhile, but they're improvements\nto one specific language feature or another; none of them are broad\nmodifications to Python's semantics.\n",
            "subsections": []
        },
        "As well as the language and library additions, other improvements and": {
            "content": "bugfixes were made throughout the source tree.  A search through the SVN\nchange logs finds there were 353 patches applied and 458 bugs fixed\nbetween Python 2.4 and 2.5.  (Both figures are likely to be\nunderestimates.)\n",
            "subsections": []
        },
        "This article doesn't try to be a complete specification of the new": {
            "content": "features; instead changes are briefly introduced using helpful examples.",
            "subsections": []
        },
        "For full details, you should always refer to the documentation for": {
            "content": "",
            "subsections": []
        },
        "Python 2.5 at 'https://docs.python.org'.  If you want to understand the": {
            "content": "complete implementation and design rationale, refer to the PEP for a\nparticular new feature.\n",
            "subsections": []
        },
        "Comments, suggestions, and error reports for this document are welcome;": {
            "content": "please e-mail them to the author or open a bug in the Python bug\ntracker.\n\n* Menu:\n\n* PEP 308; Conditional Expressions: PEP 308 Conditional Expressions.\n* PEP 309; Partial Function Application: PEP 309 Partial Function Application.\n* PEP 314; Metadata for Python Software Packages v1.1: PEP 314 Metadata for Python Software Packages v1 1.\n* PEP 328; Absolute and Relative Imports: PEP 328 Absolute and Relative Imports.\n* PEP 338; Executing Modules as Scripts: PEP 338 Executing Modules as Scripts.\n* PEP 341; Unified try/except/finally: PEP 341 Unified try/except/finally.\n* PEP 342; New Generator Features: PEP 342 New Generator Features.\n* PEP 343; The 'with' statement: PEP 343 The 'with' statement<2>.\n* PEP 352; Exceptions as New-Style Classes: PEP 352 Exceptions as New-Style Classes.\n* PEP 353; Using ssizet as the index type: PEP 353 Using ssizet as the index type.\n* PEP 357; The 'index' method: PEP 357 The 'index' method.\n* Other Language Changes: Other Language Changes<15>.\n* New, Improved, and Removed Modules: New Improved and Removed Modules.\n* Build and C API Changes: Build and C API Changes<10>.\n* Porting to Python 2.5: Porting to Python 2 5.\n* Acknowledgements: Acknowledgements<3>.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0356/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: PEP 308 Conditional Expressions,  Next: PEP 309 Partial Function Application,  Up: What's New in Python 2 5": {
            "content": "",
            "subsections": []
        },
        "For a long time, people have been requesting a way to write conditional": {
            "content": "expressions, which are expressions that return value A or value B\ndepending on whether a Boolean value is true or false.  A conditional\nexpression lets you write a single assignment statement that has the\nsame effect as the following:\n\nif condition:\nx = truevalue\nelse:\nx = falsevalue\n",
            "subsections": []
        },
        "There have been endless tedious discussions of syntax on both python-dev": {
            "content": "and comp.lang.python.  A vote was even held that found the majority of\nvoters wanted conditional expressions in some form, but there was no\nsyntax that was preferred by a clear majority.  Candidates included C's\n'cond ? truev : falsev', 'if cond then truev else falsev', and 16\nother variations.\n\nGuido van Rossum eventually chose a surprising syntax:\n\nx = truevalue if condition else falsevalue\n",
            "subsections": []
        },
        "Evaluation is still lazy as in existing Boolean expressions, so the": {
            "content": "order of evaluation jumps around a bit.  The 'condition' expression in\nthe middle is evaluated first, and the 'truevalue' expression is\nevaluated only if the condition was true.  Similarly, the 'falsevalue'\nexpression is only evaluated when the condition is false.\n",
            "subsections": []
        },
        "This syntax may seem strange and backwards; why does the condition go in": {
            "content": "the 'middle' of the expression, and not in the front as in C's 'c ? x :\ny'?  The decision was checked by applying the new syntax to the modules\nin the standard library and seeing how the resulting code read.  In many\ncases where a conditional expression is used, one value seems to be the\n'common case' and one value is an 'exceptional case', used only on rarer\noccasions when the condition isn't met.  The conditional syntax makes\nthis pattern a bit more obvious:\n\ncontents = ((doc + '\\n') if doc else '')\n\nI read the above statement as meaning \"here 'contents' is usually\nassigned a value of 'doc+'\\n''; sometimes 'doc' is empty, in which\nspecial case an empty string is returned.\" I doubt I will use\nconditional expressions very often where there isn't a clear common and\nuncommon case.\n",
            "subsections": []
        },
        "There was some discussion of whether the language should require": {
            "content": "surrounding conditional expressions with parentheses.  The decision was\nmade to 'not' require parentheses in the Python language's grammar, but\nas a matter of style I think you should always use them.  Consider these\ntwo statements:\n\n# First version -- no parens\nlevel = 1 if logging else 0\n\n# Second version -- with parens\nlevel = (1 if logging else 0)\n",
            "subsections": []
        },
        "In the first version, I think a reader's eye might group the statement": {
            "content": "into 'level = 1', 'if logging', 'else 0', and think that the condition\ndecides whether the assignment to 'level' is performed.  The second\nversion reads better, in my opinion, because it makes it clear that the\nassignment is always performed and the choice is being made between two\nvalues.\n",
            "subsections": []
        },
        "Another reason for including the brackets: a few odd combinations of": {
            "content": "list comprehensions and lambdas could look like incorrect conditional\nexpressions.  See PEP 308(1) for some examples.  If you put parentheses\naround your conditional expressions, you won't run into this case.\n\nSee also\n........\n\nPEP 308(2) - Conditional Expressions\n\nPEP written by Guido van Rossum and Raymond D. Hettinger;\nimplemented by Thomas Wouters.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0308/\n\n(2) https://peps.python.org/pep-0308/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "The *note functools: 5a. module is intended to contain tools for\nfunctional-style programming.\n",
            "subsections": []
        },
        "One useful tool in this module is the 'partial()' function.  For": {
            "content": "programs written in a functional style, you'll sometimes want to\nconstruct variants of existing functions that have some of the\nparameters filled in.  Consider a Python function 'f(a, b, c)'; you\ncould create a new function 'g(b, c)' that was equivalent to 'f(1, b,\nc)'.  This is called \"partial function application\".\n\n'partial()' takes the arguments '(function, arg1, arg2, ...\nkwarg1=value1, kwarg2=value2)'.  The resulting object is callable, so\nyou can just call it to invoke 'function' with the filled-in arguments.\n\nHere's a small but realistic example:\n\nimport functools\n\ndef log (message, subsystem):\n\"Write the contents of 'message' to the specified subsystem.\"\nprint '%s: %s' % (subsystem, message)\n...\n\nserverlog = functools.partial(log, subsystem='server')\nserverlog('Unable to open socket')\n",
            "subsections": []
        },
        "Here's another example, from a program that uses PyGTK. Here a": {
            "content": "context-sensitive pop-up menu is being constructed dynamically.  The\ncallback provided for the menu option is a partially applied version of\nthe 'openitem()' method, where the first argument has been provided.\n\n...\nclass Application:\ndef openitem(self, path):\n...\ndef init (self):\nopenfunc = functools.partial(self.openitem, itempath)\npopupmenu.append( (\"Open\", openfunc, 1) )\n\nAnother function in the *note functools: 5a. module is the\n'updatewrapper(wrapper, wrapped)' function that helps you write\nwell-behaved decorators.  'updatewrapper()' copies the name, module,\nand docstring attribute to a wrapper function so that tracebacks inside\nthe wrapped function are easier to understand.  For example, you might\nwrite:\n\ndef mydecorator(f):\ndef wrapper(*args, kwds):\nprint 'Calling decorated function'\nreturn f(*args, kwds)\nfunctools.updatewrapper(wrapper, f)\nreturn wrapper\n\n'wraps()' is a decorator that can be used inside your own decorators to\ncopy the wrapped function's information.  An alternate version of the\nprevious example would be:\n\ndef mydecorator(f):\n@functools.wraps(f)\ndef wrapper(*args, kwds):\nprint 'Calling decorated function'\nreturn f(*args, kwds)\nreturn wrapper\n\nSee also\n........\n\nPEP 309(1) - Partial Function Application\n\nPEP proposed and written by Peter Harris; implemented by Hye-Shik\nChang and Nick Coghlan, with adaptations by Raymond Hettinger.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0309/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "Some simple dependency support was added to Distutils.  The 'setup()'": {
            "content": "function now has 'requires', 'provides', and 'obsoletes' keyword\nparameters.  When you build a source distribution using the 'sdist'\ncommand, the dependency information will be recorded in the 'PKG-INFO'\nfile.\n",
            "subsections": []
        },
        "Another new keyword parameter is 'downloadurl', which should be set to": {
            "content": "a URL for the package's source code.  This means it's now possible to\nlook up an entry in the package index, determine the dependencies for a\npackage, and download the required packages.\n\nVERSION = '1.0'\nsetup(name='PyPackage',\nversion=VERSION,\nrequires=['numarray', 'zlib (>=1.1.4)'],\nobsoletes=['OldPackage']\ndownloadurl=('http://www.example.com/pypackage/dist/pkg-%s.tar.gz'\n% VERSION),\n)\n",
            "subsections": []
        },
        "Another new enhancement to the Python package index at": {
            "content": "'https://pypi.org' is storing source and binary archives for a package.",
            "subsections": []
        },
        "The new 'upload' Distutils command will upload a package to the": {
            "content": "repository.\n",
            "subsections": []
        },
        "Before a package can be uploaded, you must be able to build a": {
            "content": "distribution using the 'sdist' Distutils command.  Once that works, you\ncan run 'python setup.py upload' to add your package to the PyPI\narchive.  Optionally you can GPG-sign the package by supplying the\n'--sign' and '--identity' options.\n\nPackage uploading was implemented by Martin von Lo\"wis and Richard Jones.\n\nSee also\n........\n\nPEP 314(1) - Metadata for Python Software Packages v1.1\n\nPEP proposed and written by A.M. Kuchling, Richard Jones, and Fred\nDrake; implemented by Richard Jones and Fred Drake.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0314/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "The simpler part of PEP 328(1) was implemented in Python 2.4:\nparentheses could now be used to enclose the names imported from a\nmodule using the 'from ... import ...' statement, making it easier to\nimport many different names.\n",
            "subsections": []
        },
        "The more complicated part has been implemented in Python 2.5: importing": {
            "content": "a module can be specified to use absolute or package-relative imports.",
            "subsections": []
        },
        "The plan is to move toward making absolute imports the default in future": {
            "content": "versions of Python.\n\nLet's say you have a package directory like this:\n\npkg/\npkg/init.py\npkg/main.py\npkg/string.py\n",
            "subsections": []
        },
        "This defines a package named 'pkg' containing the 'pkg.main' and": {
            "content": "'pkg.string' submodules.\n",
            "subsections": []
        },
        "Consider the code in the 'main.py' module.  What happens if it executes": {
            "content": "the statement 'import string'?  In Python 2.4 and earlier, it will first\nlook in the package's directory to perform a relative import, finds\n'pkg/string.py', imports the contents of that file as the 'pkg.string'\nmodule, and that module is bound to the name 'string' in the 'pkg.main'\nmodule's namespace.\n",
            "subsections": []
        },
        "That's fine if 'pkg.string' was what you wanted.  But what if you wanted": {
            "content": "Python's standard *note string: cd. module?  There's no clean way to\nignore 'pkg.string' and look for the standard module; generally you had\nto look at the contents of 'sys.modules', which is slightly unclean.",
            "subsections": []
        },
        "Holger Krekel's 'py.std' package provides a tidier way to perform": {
            "content": "imports from the standard library, 'import py; py.std.string.join()',\nbut that package isn't available on all Python installations.\n",
            "subsections": []
        },
        "Reading code which relies on relative imports is also less clear,": {
            "content": "because a reader may be confused about which module, *note string: cd.\nor 'pkg.string', is intended to be used.  Python users soon learned not\nto duplicate the names of standard library modules in the names of their\npackages' submodules, but you can't protect against having your\nsubmodule's name being used for a new module added in a future version\nof Python.\n\nIn Python 2.5, you can switch *note import: 3a6.'s behaviour to absolute\nimports using a 'from future import absoluteimport' directive.",
            "subsections": []
        },
        "This absolute-import behaviour will become the default in a future": {
            "content": "version (probably Python 2.7).  Once absolute imports are the default,\n'import string' will always find the standard library's version.  It's\nsuggested that users should begin using absolute imports as much as\npossible, so it's preferable to begin writing 'from pkg import string'\nin your code.\n",
            "subsections": []
        },
        "Relative imports are still possible by adding a leading period to the": {
            "content": "module name when using the 'from ... import' form:\n\n# Import names from pkg.string\nfrom .string import name1, name2\n# Import pkg.string\nfrom . import string\n\nThis imports the *note string: cd. module relative to the current\npackage, so in 'pkg.main' this will import 'name1' and 'name2' from\n'pkg.string'.  Additional leading periods perform the relative import\nstarting from the parent of the current package.  For example, code in\nthe 'A.B.C' module can do:\n\nfrom . import D                 # Imports A.B.D\nfrom .. import E                # Imports A.E\nfrom ..F import G               # Imports A.F.G\n",
            "subsections": []
        },
        "Leading periods cannot be used with the 'import modname' form of the": {
            "content": "import statement, only the 'from ... import' form.\n\nSee also\n........\n\nPEP 328(2) - Imports: Multi-Line and Absolute/Relative\n\nPEP written by Aahz; implemented by Thomas Wouters.\n\n'https://pylib.readthedocs.io/'\n\nThe py library by Holger Krekel, which contains the 'py.std'\npackage.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0328/\n\n(2) https://peps.python.org/pep-0328/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "The *note -m: 3a5. switch added in Python 2.4 to execute a module as a\nscript gained a few more abilities.  Instead of being implemented in C\ncode inside the Python interpreter, the switch now uses an\nimplementation in a new module, *note runpy: b9.\n\nThe *note runpy: b9. module implements a more sophisticated import\nmechanism so that it's now possible to run modules in a package such as\n'pychecker.checker'.  The module also supports alternative import\nmechanisms such as the *note zipimport: 12c. module.  This means you can\nadd a .zip archive's path to 'sys.path' and then use the *note -m: 3a5.\nswitch to execute code from the archive.\n\nSee also\n........\n\nPEP 338(1) - Executing modules as scripts\n\nPEP written and implemented by Nick Coghlan.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0338/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "Until Python 2.5, the *note try: 4bc. statement came in two flavours.\nYou could use a *note finally: 7ee. block to ensure that code is always\nexecuted, or one or more *note except: 379. blocks to catch specific\nexceptions.  You couldn't combine both 'except' blocks and a 'finally'\nblock, because generating the right bytecode for the combined version\nwas complicated and it wasn't clear what the semantics of the combined\nstatement should be.\n",
            "subsections": []
        },
        "Guido van Rossum spent some time working with Java, which does support": {
            "content": "the equivalent of combining *note except: 379. blocks and a *note\nfinally: 7ee. block, and this clarified what the statement should mean.\nIn Python 2.5, you can now write:\n\ntry:\nblock-1 ...\nexcept Exception1:\nhandler-1 ...\nexcept Exception2:\nhandler-2 ...\nelse:\nelse-block\nfinally:\nfinal-block\n",
            "subsections": []
        },
        "The code in 'block-1' is executed.  If the code raises an exception, the": {
            "content": "various *note except: 379. blocks are tested: if the exception is of\nclass 'Exception1', 'handler-1' is executed; otherwise if it's of class\n'Exception2', 'handler-2' is executed, and so forth.  If no exception is\nraised, the 'else-block' is executed.\n",
            "subsections": []
        },
        "No matter what happened previously, the 'final-block' is executed once": {
            "content": "the code block is complete and any raised exceptions handled.  Even if\nthere's an error in an exception handler or the 'else-block' and a new\nexception is raised, the code in the 'final-block' is still run.\n\nSee also\n........\n\nPEP 341(1) - Unifying try-except and try-finally\n\nPEP written by Georg Brandl; implementation by Thomas Lee.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0341/\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "Python 2.5 adds a simple way to pass values 'into' a generator.  As": {
            "content": "introduced in Python 2.3, generators only produce output; once a\ngenerator's code was invoked to create an iterator, there was no way to\npass any new information into the function when its execution is\nresumed.  Sometimes the ability to pass in some information would be\nuseful.  Hackish solutions to this include making the generator's code\nlook at a global variable and then changing the global variable's value,\nor passing in some mutable object that callers then modify.\n\nTo refresh your memory of basic generators, here's a simple example:\n\ndef counter (maximum):\ni = 0\nwhile i < maximum:\nyield i\ni += 1\n",
            "subsections": []
        },
        "When you call 'counter(10)', the result is an iterator that returns the": {
            "content": "values from 0 up to 9.  On encountering the *note yield: 7f1. statement,\nthe iterator returns the provided value and suspends the function's\nexecution, preserving the local variables.  Execution resumes on the\nfollowing call to the iterator's *note next(): 5cb. method, picking up\nafter the 'yield' statement.\n\nIn Python 2.3, *note yield: 7f1. was a statement; it didn't return any\nvalue.  In 2.5, 'yield' is now an expression, returning a value that can\nbe assigned to a variable or otherwise operated on:\n\nval = (yield i)\n\nI recommend that you always put parentheses around a *note yield: 7f1.\nexpression when you're doing something with the returned value, as in\nthe above example.  The parentheses aren't always necessary, but it's\neasier to always add them instead of having to remember when they're\nneeded.\n\n( PEP 342(1) explains the exact rules, which are that a *note yield:\n7f1.-expression must always be parenthesized except when it occurs at\nthe top-level expression on the right-hand side of an assignment.  This\nmeans you can write 'val = yield i' but have to use parentheses when\nthere's an operation, as in 'val = (yield i) + 12'.)\n\nValues are sent into a generator by calling its 'send(value)' method.\nThe generator's code is then resumed and the *note yield: 7f1.\nexpression returns the specified 'value'.  If the regular *note next():\n5cb. method is called, the 'yield' returns *note None: 43f.\n",
            "subsections": []
        },
        "Here's the previous example, modified to allow changing the value of the": {
            "content": "internal counter.\n\ndef counter (maximum):\ni = 0\nwhile i < maximum:\nval = (yield i)\n# If value provided, change counter\nif val is not None:\ni = val\nelse:\ni += 1\n\nAnd here's an example of changing the counter:\n\n>>> it = counter(10)\n>>> print it.next()\n0\n>>> print it.next()\n1\n>>> print it.send(8)\n8\n>>> print it.next()\n9\n>>> print it.next()\nTraceback (most recent call last):\nFile \"t.py\", line 15, in ?\nprint it.next()\nStopIteration\n\n*note yield: 7f1. will usually return *note None: 43f, so you should\nalways check for this case.  Don't just use its value in expressions\nunless you're sure that the 'send()' method will be the only method used\nto resume your generator function.\n\nIn addition to 'send()', there are two other new methods on generators:\n\n* 'throw(type, value=None, traceback=None)' is used to raise an\nexception inside the generator; the exception is raised by the\n*note yield: 7f1. expression where the generator's execution is\npaused.\n\n* 'close()' raises a new *note GeneratorExit: 121c. exception inside\nthe generator to terminate the iteration.  On receiving this\nexception, the generator's code must either raise *note\nGeneratorExit: 121c. or *note StopIteration: a40.  Catching the\n*note GeneratorExit: 121c. exception and returning a value is\nillegal and will trigger a *note RuntimeError: 17a.; if the\nfunction raises some other exception, that exception is propagated\nto the caller.  'close()' will also be called by Python's garbage\ncollector when the generator is garbage-collected.\n\nIf you need to run cleanup code when a *note GeneratorExit: 121c.\noccurs, I suggest using a 'try: ... finally:' suite instead of\ncatching *note GeneratorExit: 121c.\n",
            "subsections": []
        },
        "The cumulative effect of these changes is to turn generators from": {
            "content": "one-way producers of information into both producers and consumers.\n",
            "subsections": []
        },
        "Generators also become 'coroutines', a more generalized form of": {
            "content": "subroutines.  Subroutines are entered at one point and exited at another\npoint (the top of the function, and a 'return' statement), but\ncoroutines can be entered, exited, and resumed at many different points\n(the 'yield' statements).\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0342/\n\nFile: python3.12.info,  Node: Built-in functions<2>,  Next: The itertools module,  Prev: Generators<2>,  Up: Functional Programming HOWTO\n\n",
            "subsections": []
        },
        "The addition of the 'close()' method has one side effect that isn't": {
            "content": "obvious.  'close()' is called when a generator is garbage-collected, so\nthis means the generator's code gets one last chance to run before the\ngenerator is destroyed.  This last chance means that 'try...finally'\nstatements in generators can now be guaranteed to work; the *note\nfinally: 7ee. clause will now always get a chance to run.  The syntactic\nrestriction that you couldn't mix *note yield: 7f1. statements with a\n'try...finally' suite has therefore been removed.  This seems like a\nminor bit of language trivia, but using generators and 'try...finally'\nis actually necessary in order to implement the *note with: 396.\nstatement described by PEP 343(2).  I'll look at this new statement in\nthe following section.\n",
            "subsections": []
        },
        "Another even more esoteric effect of this change: previously, the": {
            "content": "'giframe' attribute of a generator was always a frame object.  It's now\npossible for 'giframe' to be 'None' once the generator has been\nexhausted.\n\nSee also\n........\n\nPEP 342(3) - Coroutines via Enhanced Generators\n\nPEP written by Guido van Rossum and Phillip J. Eby; implemented by\nPhillip J. Eby.  Includes examples of some fancier uses of\ngenerators as coroutines.\n\nEarlier versions of these features were proposed in PEP 288(4) by\nRaymond Hettinger and PEP 325(5) by Samuele Pedroni.\n\n'https://en.wikipedia.org/wiki/Coroutine'\n\nThe Wikipedia entry for coroutines.\n\n'https://web.archive.org/web/20160321211320/http://www.sidhe.org/~dan/blog/archives/000178.html'\n\nAn explanation of coroutines from a Perl point of view, written by\nDan Sugalski.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0342/\n\n(2) https://peps.python.org/pep-0343/\n\n(3) https://peps.python.org/pep-0342/\n\n(4) https://peps.python.org/pep-0288/\n\n(5) https://peps.python.org/pep-0325/\n\nFile: python3.12.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\n\n\nThe '*note with: 396.' statement clarifies code that previously would\nuse 'try...finally' blocks to ensure that clean-up code is executed.  In\nthis section, I'll discuss the statement as it will commonly be used.",
            "subsections": []
        },
        "To enable the statement in Python 2.5, you need to add the following": {
            "content": "directive to your module:\n\nfrom future import withstatement\n\nThe statement will always be enabled in Python 2.6.\n",
            "subsections": []
        },
        "Our database example from the previous section could be written using": {
            "content": "this decorator as:\n\nfrom contextlib import contextmanager\n\n@contextmanager\ndef dbtransaction (connection):\ncursor = connection.cursor()\ntry:\nyield cursor\nexcept:\nconnection.rollback()\nraise\nelse:\nconnection.commit()\n\ndb = DatabaseConnection()\nwith dbtransaction(db) as cursor:\n...\n\nThe *note contextlib: 21. module also has a 'nested(mgr1, mgr2, ...)'\nfunction that combines a number of context managers so you don't need to\nwrite nested '*note with: 396.' statements.  In this example, the single\n''with'' statement both starts a database transaction and acquires a\nthread lock:\n\nlock = threading.Lock()\nwith nested (dbtransaction(db), lock) as (cursor, locked):\n...\n",
            "subsections": []
        },
        "Finally, the 'closing(object)' function returns 'object' so that it can": {
            "content": "be bound to a variable, and calls 'object.close' at the end of the\nblock.\n\nimport urllib, sys\nfrom contextlib import closing\n\nwith closing(urllib.urlopen('http://www.yahoo.com')) as f:\nfor line in f:\nsys.stdout.write(line)\n\nSee also\n........\n\nPEP 343(1) - The \"with\" statement\n\nPEP written by Guido van Rossum and Nick Coghlan; implemented by\nMike Bland, Guido van Rossum, and Neal Norwitz.  The PEP shows the\ncode generated for a '*note with: 396.' statement, which can be\nhelpful in learning how the statement works.\n\nThe documentation for the *note contextlib: 21. module.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0343/\n\nFile: python3.12.info,  Node: PEP 352 Exceptions as New-Style Classes,  Next: PEP 353 Using ssizet as the index type,  Prev: PEP 343 The 'with' statement<2>,  Up: What's New in Python 2 5\n\n",
            "subsections": []
        },
        "Exception classes can now be new-style classes, not just classic": {
            "content": "classes, and the built-in *note Exception: 7ff. class and all the\nstandard built-in exceptions (*note NameError: 144, *note ValueError:\n183, etc.)  are now new-style classes.\n",
            "subsections": []
        },
        "The inheritance hierarchy for exceptions has been rearranged a bit.  In": {
            "content": "2.5, the inheritance relationships are:\n\nBaseException       # New in Python 2.5\n|- KeyboardInterrupt\n|- SystemExit\n|- Exception\n|- (all other current built-in exceptions)\n",
            "subsections": []
        },
        "This rearrangement was done because people often want to catch all": {
            "content": "exceptions that indicate program errors.  *note KeyboardInterrupt: 7f5.\nand *note SystemExit: b97. aren't errors, though, and usually represent\nan explicit action such as the user hitting 'Control-C' or code calling\n*note sys.exit(): 11c2.  A bare 'except:' will catch all exceptions, so\nyou commonly need to list *note KeyboardInterrupt: 7f5. and *note\nSystemExit: b97. in order to re-raise them.  The usual pattern is:\n\ntry:\n...\nexcept (KeyboardInterrupt, SystemExit):\nraise\nexcept:\n# Log error...\n# Continue running program...\n",
            "subsections": []
        },
        "In Python 2.5, you can now write 'except Exception' to achieve the same": {
            "content": "result, catching all the exceptions that usually indicate errors but\nleaving *note KeyboardInterrupt: 7f5. and *note SystemExit: b97. alone.\nAs in previous versions, a bare 'except:' still catches all exceptions.\n",
            "subsections": []
        },
        "The goal for Python 3.0 is to require any class raised as an exception": {
            "content": "to derive from *note BaseException: 37c. or some descendant of *note",
            "subsections": []
        },
        "BaseException: 37c, and future releases in the Python 2.x series may": {
            "content": "begin to enforce this constraint.  Therefore, I suggest you begin making\nall your exception classes derive from *note Exception: 7ff. now.  It's\nbeen suggested that the bare 'except:' form should be removed in Python\n3.0, but Guido van Rossum hasn't decided whether to do this or not.\n\nRaising of strings as exceptions, as in the statement 'raise \"Error\noccurred\"', is deprecated in Python 2.5 and will trigger a warning.  The\naim is to be able to remove the string-exception feature in a few\nreleases.\n\nSee also\n........\n\nPEP 352(1) - Required Superclass for Exceptions\n\nPEP written by Brett Cannon and Guido van Rossum; implemented by\nBrett Cannon.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0352/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: PEP 353 Using ssizet 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": {
            "content": "A wide-ranging change to Python's C API, using a new *note Pyssizet:\n88d. type definition instead of int, will permit the interpreter to\nhandle more data on 64-bit platforms.  This change doesn't affect\nPython's capacity on 32-bit platforms.\n",
            "subsections": []
        },
        "Various pieces of the Python interpreter used C's int type to store": {
            "content": "sizes or counts; for example, the number of items in a list or tuple\nwere stored in an int.  The C compilers for most 64-bit platforms still\ndefine int as a 32-bit type, so that meant that lists could only hold up\nto '231 - 1' = 2147483647 items.  (There are actually a few different\nprogramming models that 64-bit C compilers can use - see\n'https://unix.org/version2/whatsnew/lp64wp.html' for a discussion - but\nthe most commonly available model leaves int as 32 bits.)\n\nA limit of 2147483647 items doesn't really matter on a 32-bit platform\nbecause you'll run out of memory before hitting the length limit.  Each\nlist item requires space for a pointer, which is 4 bytes, plus space for\na *note PyObject: 6b1. representing the item.  2147483647*4 is already\nmore bytes than a 32-bit address space can contain.\n\nIt's possible to address that much memory on a 64-bit platform, however.",
            "subsections": []
        },
        "The pointers for a list that size would only require 16 GiB of space, so": {
            "content": "it's not unreasonable that Python programmers might construct lists that\nlarge.  Therefore, the Python interpreter had to be changed to use some\ntype other than int, and this will be a 64-bit type on 64-bit platforms.",
            "subsections": []
        },
        "The change will cause incompatibilities on 64-bit machines, so it was": {
            "content": "deemed worth making the transition now, while the number of 64-bit users\nis still relatively small.  (In 5 or 10 years, we may 'all' be on 64-bit\nmachines, and the transition would be more painful then.)\n\nThis change most strongly affects authors of C extension modules.",
            "subsections": []
        },
        "Python strings and container types such as lists and tuples now use": {
            "content": "*note Pyssizet: 88d. to store their size.  Functions such as *note\nPyListSize(): 1270. now return *note Pyssizet: 88d.  Code in\nextension modules may therefore need to have some variables changed to\n*note Pyssizet: 88d.\n\nThe *note PyArgParseTuple(): 2d1. and *note PyBuildValue(): 6bb.\nfunctions have a new conversion code, 'n', for *note Pyssizet: 88d.\n*note PyArgParseTuple(): 2d1.'s 's#' and 't#' still output int by\ndefault, but you can define the macro 'PYSSIZETCLEAN' before\nincluding 'Python.h' to make them return *note Pyssizet: 88d.\n\nPEP 353(1) has a section on conversion guidelines that extension authors\nshould read to learn about supporting 64-bit platforms.\n\nSee also\n........\n\nPEP 353(2) - Using ssizet as the index type\n\nPEP written and implemented by Martin von Lo\"wis.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0353/\n\n(2) https://peps.python.org/pep-0353/\n\nFile: python3.12.info,  Node: PEP 357 The 'index' method,  Next: Other Language Changes<15>,  Prev: PEP 353 Using ssizet as the index type,  Up: What's New in Python 2 5\n\n",
            "subsections": []
        },
        "The NumPy developers had a problem that could only be solved by adding a": {
            "content": "new special method, 'index()'.  When using slice notation, as in\n'[start:stop:step]', the values of the 'start', 'stop', and 'step'\nindexes must all be either integers or long integers.  NumPy defines a\nvariety of specialized integer types corresponding to unsigned and\nsigned integers of 8, 16, 32, and 64 bits, but there was no way to\nsignal that these types could be used as slice indexes.\n",
            "subsections": []
        },
        "Slicing can't just use the existing 'int()' method because that": {
            "content": "method is also used to implement coercion to integers.  If slicing used\n'int()', floating-point numbers would also become legal slice\nindexes and that's clearly an undesirable behaviour.\n",
            "subsections": []
        },
        "Instead, a new special method called 'index()' was added.  It takes": {
            "content": "no arguments and returns an integer giving the slice index to use.  For\nexample:\n\nclass C:\ndef index (self):\nreturn self.value\n",
            "subsections": []
        },
        "The return value must be either a Python integer or long integer.  The": {
            "content": "interpreter will check that the type returned is correct, and raises a\n*note TypeError: 28e. if this requirement isn't met.\n\nA corresponding *note nbindex: 1273. slot was added to the C-level\n*note PyNumberMethods: 1274. structure to let C extensions implement\nthis protocol.  'PyNumberIndex(obj)' can be used in extension code to\ncall the 'index()' function and retrieve its result.\n\nSee also\n........\n\nPEP 357(1) - Allowing Any Object to be Used for Slicing\n\nPEP written and implemented by Travis Oliphant.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0357/\n\nFile: python3.12.info,  Node: Other Language Changes<15>,  Next: New Improved and Removed Modules,  Prev: PEP 357 The 'index' method,  Up: What's New in Python 2 5\n\n",
            "subsections": []
        },
        "Here are all of the changes that Python 2.5 makes to the core Python": {
            "content": "language.\n\n* The *note dict: 237. type has a new hook for letting subclasses\nprovide a default value when a key isn't contained in the\ndictionary.  When a key isn't found, the dictionary's\n'missing(key)' method will be called.  This hook is used to\nimplement the new 'defaultdict' class in the *note collections: 1b.\nmodule.  The following example defines a dictionary that returns\nzero for any missing key:\n\nclass zerodict (dict):\ndef missing (self, key):\nreturn 0\n\nd = zerodict({1:1, 2:2})\nprint d[1], d[2]   # Prints 1, 2\nprint d[3], d[4]   # Prints 0, 0\n\n* Both 8-bit and Unicode strings have new 'partition(sep)' and\n'rpartition(sep)' methods that simplify a common use case.\n\nThe 'find(S)' method is often used to get an index which is then\nused to slice the string and obtain the pieces that are before and\nafter the separator.  'partition(sep)' condenses this pattern into\na single method call that returns a 3-tuple containing the\nsubstring before the separator, the separator itself, and the\nsubstring after the separator.  If the separator isn't found, the\nfirst element of the tuple is the entire string and the other two\nelements are empty.  'rpartition(sep)' also returns a 3-tuple but\nstarts searching from the end of the string; the 'r' stands for\n'reverse'.\n\nSome examples:\n\n>>> ('http://www.python.org').partition('://')\n('http', '://', 'www.python.org')\n>>> ('file:/usr/share/doc/index.html').partition('://')\n('file:/usr/share/doc/index.html', '', '')\n>>> (u'Subject: a quick question').partition(':')\n(u'Subject', u':', u' a quick question')\n>>> 'www.python.org'.rpartition('.')\n('www.python', '.', 'org')\n>>> 'www.python.org'.rpartition(':')\n('', '', 'www.python.org')\n\n(Implemented by Fredrik Lundh following a suggestion by Raymond\nHettinger.)\n\n* The 'startswith()' and 'endswith()' methods of string types now\naccept tuples of strings to check for.\n\ndef isimagefile (filename):\nreturn filename.endswith(('.gif', '.jpg', '.tiff'))\n\n(Implemented by Georg Brandl following a suggestion by Tom Lynn.)\n\n* The *note min(): d6f. and *note max(): d70. built-in functions\ngained a 'key' keyword parameter analogous to the 'key' argument\nfor 'sort()'.  This parameter supplies a function that takes a\nsingle argument and is called for every value in the list; *note\nmin(): d6f./*note max(): d70. will return the element with the\nsmallest/largest return value from this function.  For example, to\nfind the longest string in a list, you can do:\n\nL = ['medium', 'longest', 'short']\n# Prints 'longest'\nprint max(L, key=len)\n# Prints 'short', because lexicographically 'short' has the largest value\nprint max(L)\n\n(Contributed by Steven Bethard and Raymond Hettinger.)\n\n* Two new built-in functions, *note any(): 1277. and *note all():\n1278, evaluate whether an iterator contains any true or false\nvalues.  *note any(): 1277. returns *note True: a53. if any value\nreturned by the iterator is true; otherwise it will return *note\nFalse: 971.  *note all(): 1278. returns *note True: a53. only if\nall of the values returned by the iterator evaluate as true.\n(Suggested by Guido van Rossum, and implemented by Raymond\nHettinger.)\n\n* The result of a class's 'hash()' method can now be either a\nlong integer or a regular integer.  If a long integer is returned,\nthe hash of that value is taken.  In earlier versions the hash\nvalue was required to be a regular integer, but in 2.5 the *note\nid(): 1279. built-in was changed to always return non-negative\nnumbers, and users often seem to use 'id(self)' in 'hash()'\nmethods (though this is discouraged).\n\n* ASCII is now the default encoding for modules.  It's now a syntax\nerror if a module contains string literals with 8-bit characters\nbut doesn't have an encoding declaration.  In Python 2.4 this\ntriggered a warning, not a syntax error.  See PEP 263(1) for how to\ndeclare a module's encoding; for example, you might add a line like\nthis near the top of the source file:\n\n# -*- coding: latin1 -*-\n\n* A new warning, *note UnicodeWarning: 127a, is triggered when you\nattempt to compare a Unicode string and an 8-bit string that can't\nbe converted to Unicode using the default ASCII encoding.  The\nresult of the comparison is false:\n\n>>> chr(128) == unichr(128)   # Can't convert chr(128) to Unicode\nmain:1: UnicodeWarning: Unicode equal comparison failed\nto convert both arguments to Unicode - interpreting them\nas being unequal\nFalse\n>>> chr(127) == unichr(127)   # chr(127) can be converted\nTrue\n\nPreviously this would raise a *note UnicodeDecodeError: 83c.\nexception, but in 2.5 this could result in puzzling problems when\naccessing a dictionary.  If you looked up 'unichr(128)' and\n'chr(128)' was being used as a key, you'd get a *note\nUnicodeDecodeError: 83c. exception.  Other changes in 2.5 resulted\nin this exception being raised instead of suppressed by the code in\n'dictobject.c' that implements dictionaries.\n\nRaising an exception for such a comparison is strictly correct, but\nthe change might have broken code, so instead *note UnicodeWarning:\n127a. was introduced.\n\n(Implemented by Marc-Andre' Lemburg.)\n\n* One error that Python programmers sometimes make is forgetting to\ninclude an 'init.py' module in a package directory.  Debugging\nthis mistake can be confusing, and usually requires running Python\nwith the *note -v: 127b. switch to log all the paths searched.  In\nPython 2.5, a new *note ImportWarning: 243. warning is triggered\nwhen an import would have picked up a directory as a package but no\n'init.py' was found.  This warning is silently ignored by\ndefault; provide the *note -Wd: 6df. option when running the Python\nexecutable to display the warning message.  (Implemented by Thomas\nWouters.)\n\n* The list of base classes in a class definition can now be empty.\nAs an example, this is now legal:\n\nclass C():\npass\n\n(Implemented by Brett Cannon.)\n\n* Menu:\n\n* Interactive Interpreter Changes::\n* Optimizations: Optimizations<14>.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0263/\n\nFile: python3.12.info,  Node: Interactive Interpreter Changes,  Next: Optimizations<14>,  Up: Other Language Changes<15>\n\n1.16.12.1 Interactive Interpreter Changes\n.........................................\n",
            "subsections": []
        },
        "In the interactive interpreter, 'quit' and 'exit' have long been strings": {
            "content": "so that new users get a somewhat helpful message when they try to quit:\n\n>>> quit\n'Use Ctrl-D (i.e. EOF) to exit.'\n",
            "subsections": []
        },
        "In Python 2.5, 'quit' and 'exit' are now objects that still produce": {
            "content": "string representations of themselves, but are also callable.  Newbies\nwho try 'quit()' or 'exit()' will now exit the interpreter as they\nexpect.  (Implemented by Georg Brandl.)\n\nThe Python executable now accepts the standard long options *note -help:\n3b7. and *note -version: b6e.; on Windows, it also accepts the *note /?:\n127e. option for displaying a help message.  (Implemented by Georg",
            "subsections": []
        },
        "Brandl.)": {
            "content": "File: python3.12.info,  Node: Optimizations<14>,  Prev: Interactive Interpreter Changes,  Up: Other Language Changes<15>\n\n1.16.12.2 Optimizations\n.......................\n",
            "subsections": []
        },
        "Several of the optimizations were developed at the NeedForSpeed sprint,": {
            "content": "an event held in Reykjavik, Iceland, from May 21-28 2006.  The sprint\nfocused on speed enhancements to the CPython implementation and was\nfunded by EWT LLC with local support from CCP Games.  Those\noptimizations added at this sprint are specially marked in the following\nlist.\n\n* When they were introduced in Python 2.4, the built-in *note set:\n39d. and *note frozenset: 39e. types were built on top of Python's\ndictionary type.  In 2.5 the internal data structure has been\ncustomized for implementing sets, and as a result sets will use a\nthird less memory and are somewhat faster.  (Implemented by Raymond\nHettinger.)\n\n* The speed of some Unicode operations, such as finding substrings,\nstring splitting, and character map encoding and decoding, has been\nimproved.  (Substring search and splitting improvements were added\nby Fredrik Lundh and Andrew Dalke at the NeedForSpeed sprint.\nCharacter maps were improved by Walter Do\"rwald and Martin von\nLo\"wis.)\n\n* The 'long(str, base)' function is now faster on long digit strings\nbecause fewer intermediate results are calculated.  The peak is for\nstrings of around 800-1000 digits where the function is 6 times\nfaster.  (Contributed by Alan McIntyre and committed at the\nNeedForSpeed sprint.)\n\n* It's now illegal to mix iterating over a file with 'for line in\nfile' and calling the file object's 'read()'/*note readline():\nb5./'readlines()' methods.  Iteration uses an internal buffer and\nthe 'read*()' methods don't use that buffer.  Instead they would\nreturn the data following the buffer, causing the data to appear\nout of order.  Mixing iteration and these methods will now trigger\na *note ValueError: 183. from the 'read*()' method.  (Implemented\nby Thomas Wouters.)\n\n* The *note struct: cf. module now compiles structure format strings\ninto an internal representation and caches this representation,\nyielding a 20% speedup.  (Contributed by Bob Ippolito at the\nNeedForSpeed sprint.)\n\n* The *note re: b4. module got a 1 or 2% speedup by switching to\nPython's allocator functions instead of the system's 'malloc()' and\n'free()'.  (Contributed by Jack Diederich at the NeedForSpeed\nsprint.)\n\n* The code generator's peephole optimizer now performs simple\nconstant folding in expressions.  If you write something like 'a =\n2+3', the code generator will do the arithmetic and produce code\ncorresponding to 'a = 5'.  (Proposed and implemented by Raymond\nHettinger.)\n\n* Function calls are now faster because code objects now keep the\nmost recently finished frame (a \"zombie frame\") in an internal\nfield of the code object, reusing it the next time the code object\nis invoked.  (Original patch by Michael Hudson, modified by Armin\nRigo and Richard Jones; committed at the NeedForSpeed sprint.)\nFrame objects are also slightly smaller, which may improve cache\nlocality and reduce memory usage a bit.  (Contributed by Neal\nNorwitz.)\n\n* Python's built-in exceptions are now new-style classes, a change\nthat speeds up instantiation considerably.  Exception handling in\nPython 2.5 is therefore about 30% faster than in 2.4.  (Contributed\nby Richard Jones, Georg Brandl and Sean Reifschneider at the\nNeedForSpeed sprint.)\n\n* Importing now caches the paths tried, recording whether they exist\nor not so that the interpreter makes fewer 'open()' and 'stat()'\ncalls on startup.  (Contributed by Martin von Lo\"wis and Georg\nBrandl.)\n\nFile: python3.12.info,  Node: New Improved and Removed Modules,  Next: Build and C API Changes<10>,  Prev: Other Language Changes<15>,  Up: What's New in Python 2 5\n\n",
            "subsections": []
        },
        "The standard library received many enhancements and bug fixes in Python": {
            "content": "2.5.  Here's a partial list of the most notable changes, sorted\nalphabetically by module name.  Consult the 'Misc/NEWS' file in the\nsource tree for a more complete list of changes, or look through the SVN\nlogs for all the details.\n\n* The *note audioop: b. module now supports the a-LAW encoding, and\nthe code for u-LAW encoding has been improved.  (Contributed by\nLars Immisch.)\n\n* The *note codecs: 19. module gained support for incremental codecs.\nThe 'codec.lookup()' function now returns a 'CodecInfo' instance\ninstead of a tuple.  'CodecInfo' instances behave like a 4-tuple to\npreserve backward compatibility but also have the attributes\n'encode', 'decode', 'incrementalencoder', 'incrementaldecoder',\n'streamwriter', and 'streamreader'.  Incremental codecs can receive\ninput and produce output in multiple chunks; the output is the same\nas if the entire input was fed to the non-incremental codec.  See\nthe *note codecs: 19. module documentation for details.  (Designed\nand implemented by Walter Do\"rwald.)\n\n* The *note collections: 1b. module gained a new type, 'defaultdict',\nthat subclasses the standard *note dict: 237. type.  The new type\nmostly behaves like a dictionary but constructs a default value\nwhen a key isn't present, automatically adding it to the dictionary\nfor the requested key value.\n\nThe first argument to 'defaultdict''s constructor is a factory\nfunction that gets called whenever a key is requested but not\nfound.  This factory function receives no arguments, so you can use\nbuilt-in type constructors such as *note list(): 3dc. or *note\nint(): 17e.  For example, you can make an index of words based on\ntheir initial letter like this:\n\nwords = \"\"\"Nel mezzo del cammin di nostra vita\nmi ritrovai per una selva oscura\nche la diritta via era smarrita\"\"\".lower().split()\n\nindex = defaultdict(list)\n\nfor w in words:\ninitletter = w[0]\nindex[initletter].append(w)\n\nPrinting 'index' results in the following output:\n\ndefaultdict(<type 'list'>, {'c': ['cammin', 'che'], 'e': ['era'],\n'd': ['del', 'di', 'diritta'], 'm': ['mezzo', 'mi'],\n'l': ['la'], 'o': ['oscura'], 'n': ['nel', 'nostra'],\n'p': ['per'], 's': ['selva', 'smarrita'],\n'r': ['ritrovai'], 'u': ['una'], 'v': ['vita', 'via']}\n\n(Contributed by Guido van Rossum.)\n\n* The 'deque' double-ended queue type supplied by the *note\ncollections: 1b. module now has a 'remove(value)' method that\nremoves the first occurrence of 'value' in the queue, raising *note\nValueError: 183. if the value isn't found.  (Contributed by Raymond\nHettinger.)\n\n* New module: The *note contextlib: 21. module contains helper\nfunctions for use with the new '*note with: 396.' statement.  See\nsection *note The contextlib module: 126a. for more about this\nmodule.\n\n* New module: The *note cProfile: 25. module is a C implementation of\nthe existing *note profile: aa. module that has much lower\noverhead.  The module's interface is the same as *note profile:\naa.: you run 'cProfile.run('main()')' to profile a function, can\nsave profile data to a file, etc.  It's not yet known if the\nHotshot profiler, which is also written in C but doesn't match the\n*note profile: aa. module's interface, will continue to be\nmaintained in future versions of Python.  (Contributed by Armin\nRigo.)\n\nAlso, the *note pstats: ab. module for analyzing the data measured\nby the profiler now supports directing the output to any file\nobject by supplying a 'stream' argument to the 'Stats' constructor.\n(Contributed by Skip Montanaro.)\n\n* The *note csv: 27. module, which parses files in comma-separated\nvalue format, received several enhancements and a number of\nbugfixes.  You can now set the maximum size in bytes of a field by\ncalling the 'csv.fieldsizelimit(newlimit)' function; omitting\nthe 'newlimit' argument will return the currently set limit.  The\n'reader' class now has a 'linenum' attribute that counts the\nnumber of physical lines read from the source; records can span\nmultiple physical lines, so 'linenum' is not the same as the\nnumber of records read.\n\nThe CSV parser is now stricter about multi-line quoted fields.\nPreviously, if a line ended within a quoted field without a\nterminating newline character, a newline would be inserted into the\nreturned field.  This behavior caused problems when reading files\nthat contained carriage return characters within fields, so the\ncode was changed to return the field without inserting newlines.\nAs a consequence, if newlines embedded within fields are important,\nthe input should be split into lines in a manner that preserves the\nnewline characters.\n\n(Contributed by Skip Montanaro and Andrew McNamara.)\n\n* The *note datetime: 222. class in the *note datetime: 2e. module\nnow has a 'strptime(string, format)' method for parsing date\nstrings, contributed by Josh Spoerri.  It uses the same format\ncharacters as *note time.strptime(): 1283. and *note\ntime.strftime(): 105d.:\n\nfrom datetime import datetime\n\nts = datetime.strptime('10:13:15 2006-03-07',\n'%H:%M:%S %Y-%m-%d')\n\n* The 'SequenceMatcher.getmatchingblocks()' method in the *note\ndifflib: 34. module now guarantees to return a minimal list of\nblocks describing matching subsequences.  Previously, the algorithm\nwould occasionally break a block of matching elements into two list\nentries.  (Enhancement by Tim Peters.)\n\n* The *note doctest: 36. module gained a 'SKIP' option that keeps an\nexample from being executed at all.  This is intended for code\nsnippets that are usage examples intended for the reader and aren't\nactually test cases.\n\nAn 'encoding' parameter was added to the 'testfile()' function and\nthe 'DocFileSuite' class to specify the file's encoding.  This\nmakes it easier to use non-ASCII characters in tests contained\nwithin a docstring.  (Contributed by Bjorn Tillenius.)\n\n* The *note email: 37. package has been updated to version 4.0.\n(Contributed by Barry Warsaw.)\n\n* The *note fileinput: 56. module was made more flexible.  Unicode\nfilenames are now supported, and a 'mode' parameter that defaults\nto '\"r\"' was added to the *note input(): 114d. function to allow\nopening files in binary or *note universal newlines: b90. mode.\nAnother new parameter, 'openhook', lets you use a function other\nthan *note open(): 26e. to open the input files.  Once you're\niterating over the set of files, the 'FileInput' object's new *note\nfileno(): 1284. returns the file descriptor for the currently\nopened file.  (Contributed by Georg Brandl.)\n\n* In the *note gc: 5b. module, the new 'getcount()' function returns\na 3-tuple containing the current collection counts for the three GC\ngenerations.  This is accounting information for the garbage\ncollector; when these counts reach a specified threshold, a garbage\ncollection sweep will be made.  The existing *note gc.collect():\n865. function now takes an optional 'generation' argument of 0, 1,\nor 2 to specify which generation to collect.  (Contributed by Barry\nWarsaw.)\n\n* The 'nsmallest()' and 'nlargest()' functions in the *note heapq:\n64. module now support a 'key' keyword parameter similar to the one\nprovided by the *note min(): d6f./*note max(): d70. functions and\nthe 'sort()' methods.  For example:\n\n>>> import heapq\n>>> L = [\"short\", 'medium', 'longest', 'longer still']\n>>> heapq.nsmallest(2, L)  # Return two lowest elements, lexicographically\n['longer still', 'longest']\n>>> heapq.nsmallest(2, L, key=len)   # Return two shortest elements\n['short', 'medium']\n\n(Contributed by Raymond Hettinger.)\n\n* The *note itertools.islice(): 988. function now accepts 'None' for\nthe start and step arguments.  This makes it more compatible with\nthe attributes of slice objects, so that you can now write the\nfollowing:\n\ns = slice(5)     # Create slice object\nitertools.islice(iterable, s.start, s.stop, s.step)\n\n(Contributed by Raymond Hettinger.)\n\n* The *note format(): 3eb. function in the *note locale: 81. module\nhas been modified and two new functions were added,\n'formatstring()' and 'currency()'.\n\nThe *note format(): 3eb. function's 'val' parameter could\npreviously be a string as long as no more than one %char specifier\nappeared; now the parameter must be exactly one %char specifier\nwith no surrounding text.  An optional 'monetary' parameter was\nalso added which, if 'True', will use the locale's rules for\nformatting currency in placing a separator between groups of three\ndigits.\n\nTo format strings with multiple %char specifiers, use the new\n'formatstring()' function that works like *note format(): 3eb. but\nalso supports mixing %char specifiers with arbitrary text.\n\nA new 'currency()' function was also added that formats a number\naccording to the current locale's settings.\n\n(Contributed by Georg Brandl.)\n\n* The *note mailbox: 86. module underwent a massive rewrite to add\nthe capability to modify mailboxes in addition to reading them.  A\nnew set of classes that include 'mbox', 'MH', and 'Maildir' are\nused to read mailboxes, and have an 'add(message)' method to add\nmessages, 'remove(key)' to remove messages, and 'lock()'/'unlock()'\nto lock/unlock the mailbox.  The following example converts a\nmaildir-format mailbox into an mbox-format one:\n\nimport mailbox\n\n# 'factory=None' uses email.Message.Message as the class representing\n# individual messages.\nsrc = mailbox.Maildir('maildir', factory=None)\ndest = mailbox.mbox('/tmp/mbox')\n\nfor msg in src:\ndest.add(msg)\n\n(Contributed by Gregory K. Johnson.  Funding was provided by\nGoogle's 2005 Summer of Code.)\n\n* New module: the *note msilib: 8d. module allows creating Microsoft\nInstaller '.msi' files and CAB files.  Some support for reading the\n'.msi' database is also included.  (Contributed by Martin von\nLo\"wis.)\n\n* The *note nis: 97. module now supports accessing domains other than\nthe system default domain by supplying a 'domain' argument to the\n*note nis.match(): 1285. and *note nis.maps(): 1286. functions.\n(Contributed by Ben Bell.)\n\n* The *note operator: 9a. module's 'itemgetter()' and 'attrgetter()'\nfunctions now support multiple fields.  A call such as\n'operator.attrgetter('a', 'b')' will return a function that\nretrieves the 'a' and 'b' attributes.  Combining this new feature\nwith the 'sort()' method's 'key' parameter lets you easily sort\nlists using multiple fields.  (Contributed by Raymond Hettinger.)\n\n* The *note optparse: 9b. module was updated to version 1.5.1 of the\nOptik library.  The 'OptionParser' class gained an 'epilog'\nattribute, a string that will be printed after the help message,\nand a 'destroy()' method to break reference cycles created by the\nobject.  (Contributed by Greg Ward.)\n\n* The *note os: 9c. module underwent several changes.  The\n'statfloattimes' variable now defaults to true, meaning that\n*note os.stat(): 1bf. will now return time values as floats.  (This\ndoesn't necessarily mean that *note os.stat(): 1bf. will return\ntimes that are precise to fractions of a second; not all systems\nsupport such precision.)\n\nConstants named *note os.SEEKSET: 1106, *note os.SEEKCUR: 1107,\nand *note os.SEEKEND: 1108. have been added; these are the\nparameters to the *note os.lseek(): f87. function.  Two new\nconstants for locking are *note os.OSHLOCK: 1287. and *note\nos.OEXLOCK: 1288.\n\nTwo new functions, 'wait3()' and 'wait4()', were added.  They're\nsimilar the 'waitpid()' function which waits for a child process to\nexit and returns a tuple of the process ID and its exit status, but\n'wait3()' and 'wait4()' return additional information.  'wait3()'\ndoesn't take a process ID as input, so it waits for any child\nprocess to exit and returns a 3-tuple of 'process-id',\n'exit-status', 'resource-usage' as returned from the *note\nresource.getrusage(): 1289. function.  'wait4(pid)' does take a\nprocess ID. (Contributed by Chad J. Schroeder.)\n\nOn FreeBSD, the *note os.stat(): 1bf. function now returns times\nwith nanosecond resolution, and the returned object now has\n'stgen' and 'stbirthtime'.  The 'stflags' attribute is also\navailable, if the platform supports it.  (Contributed by Antti\nLouko and Diego Petten??.)\n\n* The Python debugger provided by the *note pdb: a0. module can now\nstore lists of commands to execute when a breakpoint is reached and\nexecution stops.  Once breakpoint #1 has been created, enter\n'commands 1' and enter a series of commands to be executed,\nfinishing the list with 'end'.  The command list can include\ncommands that resume execution, such as 'continue' or 'next'.\n(Contributed by Gre'goire Dooms.)\n\n* The *note pickle: a1. and 'cPickle' modules no longer accept a\nreturn value of 'None' from the *note reduce(): 7f8. method;\nthe method must return a tuple of arguments instead.  The ability\nto return 'None' was deprecated in Python 2.4, so this completes\nthe removal of the feature.\n\n* The *note pkgutil: a4. module, containing various utility functions\nfor finding packages, was enhanced to support PEP 302(1)'s import\nhooks and now also works for packages stored in ZIP-format\narchives.  (Contributed by Phillip J. Eby.)\n\n* The pybench benchmark suite by Marc-Andre' Lemburg is now included\nin the 'Tools/pybench' directory.  The pybench suite is an\nimprovement on the commonly used 'pystone.py' program because\npybench provides a more detailed measurement of the interpreter's\nspeed.  It times particular operations such as function calls,\ntuple slicing, method lookups, and numeric operations, instead of\nperforming many different operations and reducing the result to a\nsingle number as 'pystone.py' does.\n\n* The 'pyexpat' module now uses version 2.0 of the Expat parser.\n(Contributed by Trent Mick.)\n\n* The *note Queue: 1203. class provided by the 'Queue' module gained\ntwo new methods.  'join()' blocks until all items in the queue have\nbeen retrieved and all processing work on the items have been\ncompleted.  Worker threads call the other new method,\n'taskdone()', to signal that processing for an item has been\ncompleted.  (Contributed by Raymond Hettinger.)\n\n* The old 'regex' and 'regsub' modules, which have been deprecated\never since Python 2.0, have finally been deleted.  Other deleted\nmodules: 'statcache', 'tzparse', 'whrandom'.\n\n* Also deleted: the 'lib-old' directory, which includes ancient\nmodules such as 'dircmp' and 'ni', was removed.  'lib-old' wasn't\non the default 'sys.path', so unless your programs explicitly added\nthe directory to 'sys.path', this removal shouldn't affect your\ncode.\n\n* The *note rlcompleter: b8. module is no longer dependent on\nimporting the *note readline: b5. module and therefore now works on\nnon-Unix platforms.  (Patch from Robert Kiendl.)\n\n* The *note SimpleXMLRPCServer: 129. and *note DocXMLRPCServer: 129.\nclasses now have a 'rpcpaths' attribute that constrains XML-RPC\noperations to a limited set of URL paths; the default is to allow\nonly ''/'' and ''/RPC2''.  Setting 'rpcpaths' to 'None' or an\nempty tuple disables this path checking.\n\n* The *note socket: c6. module now supports 'AFNETLINK' sockets on\nLinux, thanks to a patch from Philippe Biondi.  Netlink sockets are\na Linux-specific mechanism for communications between a user-space\nprocess and kernel code; an introductory article about them is at\n'https://www.linuxjournal.com/article/7356'.  In Python code,\nnetlink addresses are represented as a tuple of 2 integers, '(pid,\ngroupmask)'.\n\nTwo new methods on socket objects, 'recvinto(buffer)' and\n'recvfrominto(buffer)', store the received data in an object that\nsupports the buffer protocol instead of returning the data as a\nstring.  This means you can put the data directly into an array or\na memory-mapped file.\n\nSocket objects also gained 'getfamily()', 'gettype()', and\n'getproto()' accessor methods to retrieve the family, type, and\nprotocol values for the socket.\n\n* New module: the *note spwd: c8. module provides functions for\naccessing the shadow password database on systems that support\nshadow passwords.\n\n* The *note struct: cf. is now faster because it compiles format\nstrings into 'Struct' objects with 'pack()' and 'unpack()' methods.\nThis is similar to how the *note re: b4. module lets you create\ncompiled regular expression objects.  You can still use the\nmodule-level 'pack()' and 'unpack()' functions; they'll create\n'Struct' objects and cache them.  Or you can use 'Struct' instances\ndirectly:\n\ns = struct.Struct('ih3s')\n\ndata = s.pack(1972, 187, 'abc')\nyear, number, name = s.unpack(data)\n\nYou can also pack and unpack data to and from buffer objects\ndirectly using the 'packinto(buffer, offset, v1, v2, ...)' and\n'unpackfrom(buffer, offset)' methods.  This lets you store data\ndirectly into an array or a memory-mapped file.\n\n('Struct' objects were implemented by Bob Ippolito at the\nNeedForSpeed sprint.  Support for buffer objects was added by\nMartin Blais, also at the NeedForSpeed sprint.)\n\n* The Python developers switched from CVS to Subversion during the\n2.5 development process.  Information about the exact build version\nis available as the 'sys.subversion' variable, a 3-tuple of\n'(interpreter-name, branch-name, revision-range)'.  For example, at\nthe time of writing my copy of 2.5 was reporting '('CPython',\n'trunk', '45313:45315')'.\n\nThis information is also available to C extensions via the *note\nPyGetBuildInfo(): 128a. function that returns a string of build\ninformation like this: '\"trunk:45355:45356M, Apr 13 2006,\n07:42:19\"'.  (Contributed by Barry Warsaw.)\n\n* Another new function, *note sys.currentframes(): 128b, returns\nthe current stack frames for all running threads as a dictionary\nmapping thread identifiers to the topmost stack frame currently\nactive in that thread at the time the function is called.\n(Contributed by Tim Peters.)\n\n* The 'TarFile' class in the *note tarfile: d8. module now has an\n'extractall()' method that extracts all members from the archive\ninto the current working directory.  It's also possible to set a\ndifferent directory as the extraction target, and to unpack only a\nsubset of the archive's members.\n\nThe compression used for a tarfile opened in stream mode can now be\nautodetected using the mode ''r|*''.  (Contributed by Lars\nGusta\"bel.)\n\n* The *note threading: e7. module now lets you set the stack size\nused when new threads are created.  The 'stacksize([*size*])'\nfunction returns the currently configured stack size, and supplying\nthe optional 'size' parameter sets a new value.  Not all platforms\nsupport changing the stack size, but Windows, POSIX threading, and\nOS/2 all do.  (Contributed by Andrew MacIntyre.)\n\n* The *note unicodedata: 100. module has been updated to use version\n4.1.0 of the Unicode character database.  Version 3.2.0 is required\nby some specifications, so it's still available as *note\nunicodedata.ucd320: 128c.\n\n* New module: the *note uuid: 10b. module generates universally\nunique identifiers (UUIDs) according to RFC 4122(2).  The RFC\ndefines several different UUID versions that are generated from a\nstarting string, from system properties, or purely randomly.  This\nmodule contains a 'UUID' class and functions named 'uuid1()',\n'uuid3()', 'uuid4()', and 'uuid5()' to generate different versions\nof UUID. (Version 2 UUIDs are not specified in RFC 4122(3) and are\nnot supported by this module.)\n\n>>> import uuid\n>>> # make a UUID based on the host ID and current time\n>>> uuid.uuid1()\nUUID('a8098c1a-f86e-11da-bd1a-00112444be1e')\n\n>>> # make a UUID using an MD5 hash of a namespace UUID and a name\n>>> uuid.uuid3(uuid.NAMESPACEDNS, 'python.org')\nUUID('6fa459ea-ee8a-3ca4-894e-db77e160355e')\n\n>>> # make a random UUID\n>>> uuid.uuid4()\nUUID('16fd2706-8baf-433b-82eb-8c7fada847da')\n\n>>> # make a UUID using a SHA-1 hash of a namespace UUID and a name\n>>> uuid.uuid5(uuid.NAMESPACEDNS, 'python.org')\nUUID('886313e1-3b8a-5372-9b90-0c9aee199e5d')\n\n(Contributed by Ka-Ping Yee.)\n\n* The *note weakref: 10f. module's 'WeakKeyDictionary' and\n'WeakValueDictionary' types gained new methods for iterating over\nthe weak references contained in the dictionary.  'iterkeyrefs()'\nand 'keyrefs()' methods were added to 'WeakKeyDictionary', and\n'itervaluerefs()' and 'valuerefs()' were added to\n'WeakValueDictionary'.  (Contributed by Fred L. Drake, Jr.)\n\n* The *note webbrowser: 110. module received a number of\nenhancements.  It's now usable as a script with 'python -m\nwebbrowser', taking a URL as the argument; there are a number of\nswitches to control the behaviour ('-n' for a new browser window,\n'-t' for a new tab).  New module-level functions, 'opennew()' and\n'opennewtab()', were added to support this.  The module's *note\nopen(): 26e. function supports an additional feature, an\n'autoraise' parameter that signals whether to raise the open window\nwhen possible.  A number of additional browsers were added to the\nsupported list such as Firefox, Opera, Konqueror, and elinks.\n(Contributed by Oleg Broytmann and Georg Brandl.)\n\n* The *note xmlrpclib: 128. module now supports returning *note\ndatetime: 222. objects for the XML-RPC date type.  Supply\n'usedatetime=True' to the *note loads(): 128d. function or the\n'Unmarshaller' class to enable this feature.  (Contributed by Skip\nMontanaro.)\n\n* The *note zipfile: 12b. module now supports the ZIP64 version of\nthe format, meaning that a .zip archive can now be larger than 4\nGiB and can contain individual files larger than 4 GiB.\n(Contributed by Ronald Oussoren.)\n\n* The *note zlib: 12d. module's 'Compress' and 'Decompress' objects\nnow support a *note copy(): 23. method that makes a copy of the\nobject's internal state and returns a new 'Compress' or\n'Decompress' object.  (Contributed by Chris AtLee.)\n\n* Menu:\n\n* The ctypes package::\n* The ElementTree package::\n* The hashlib package::\n* The sqlite3 package::\n* The wsgiref package::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0302/\n\n(2) https://datatracker.ietf.org/doc/html/rfc4122.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc4122.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The ctypes package,  Next: The ElementTree package,  Up: New Improved and Removed Modules": {
            "content": "1.16.13.1 The ctypes package\n............................\n\nThe *note ctypes: 28. package, written by Thomas Heller, has been added\nto the standard library.  *note ctypes: 28. lets you call arbitrary\nfunctions in shared libraries or DLLs.  Long-time users may remember the\n'dl' module, which provides functions for loading shared libraries and\ncalling functions in them.  The *note ctypes: 28. package is much\nfancier.\n",
            "subsections": []
        },
        "To load a shared library or DLL, you must create an instance of the": {
            "content": "'CDLL' class and provide the name or path of the shared library or DLL.",
            "subsections": []
        },
        "Once that's done, you can call arbitrary functions by accessing them as": {
            "content": "attributes of the 'CDLL' object.\n\nimport ctypes\n\nlibc = ctypes.CDLL('libc.so.6')\nresult = libc.printf(\"Line of output\\n\")\n",
            "subsections": []
        },
        "Type constructors for the various C types are provided: 'cint()',": {
            "content": "'cfloat()', 'cdouble()', 'ccharp()' (equivalent to char*), and so\nforth.  Unlike Python's types, the C versions are all mutable; you can\nassign to their 'value' attribute to change the wrapped value.  Python\nintegers and strings will be automatically converted to the\ncorresponding C types, but for other types you must call the correct\ntype constructor.  (And I mean 'must'; getting it wrong will often\nresult in the interpreter crashing with a segmentation fault.)\n",
            "subsections": []
        },
        "You shouldn't use 'ccharp()' with a Python string when the C function": {
            "content": "will be modifying the memory area, because Python strings are supposed\nto be immutable; breaking this rule will cause puzzling bugs.  When you\nneed a modifiable memory area, use 'createstringbuffer()':\n\ns = \"this is a string\"\nbuf = ctypes.createstringbuffer(s)\nlibc.strfry(buf)\n\nC functions are assumed to return integers, but you can set the\n'restype' attribute of the function object to change this:\n\n>>> libc.atof('2.71828')\n-1783957616\n>>> libc.atof.restype = ctypes.cdouble\n>>> libc.atof('2.71828')\n2.71828\n\n*note ctypes: 28. also provides a wrapper for Python's C API as the\n'ctypes.pythonapi' object.  This object does 'not' release the global\ninterpreter lock before calling a function, because the lock must be\nheld when calling into the interpreter's code.  There's a 'pyobject()'\ntype constructor that will create a *note PyObject: 6b1.* pointer.  A\nsimple usage:\n\nimport ctypes\n\nd = {}\nctypes.pythonapi.PyObjectSetItem(ctypes.pyobject(d),\nctypes.pyobject(\"abc\"),  ctypes.pyobject(1))\n# d is now {'abc', 1}.\n",
            "subsections": []
        },
        "Don't forget to use 'pyobject()'; if it's omitted you end up with a": {
            "content": "segmentation fault.\n\n*note ctypes: 28. has been around for a while, but people still write\nand distribution hand-coded extension modules because you can't rely on\n*note ctypes: 28. being present.  Perhaps developers will begin to write\nPython wrappers atop a library accessed through *note ctypes: 28.\ninstead of extension modules, now that *note ctypes: 28. is included\nwith core Python.\n\nSee also\n........\n\n'https://web.archive.org/web/20180410025338/http://starship.python.net/crew/theller/ctypes/'\n\nThe pre-stdlib ctypes web page, with a tutorial, reference, and\nFAQ.\n\nThe documentation for the *note ctypes: 28. module.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The ElementTree package,  Next: The hashlib package,  Prev: The ctypes package,  Up: New Improved and Removed Modules": {
            "content": "1.16.13.2 The ElementTree package\n.................................\n\nA subset of Fredrik Lundh's ElementTree library for processing XML has\nbeen added to the standard library as 'xml.etree'.  The available\nmodules are 'ElementTree', 'ElementPath', and 'ElementInclude' from",
            "subsections": []
        },
        "ElementTree 1.2.6.  The 'cElementTree' accelerator module is also": {
            "content": "included.\n",
            "subsections": []
        },
        "The rest of this section will provide a brief overview of using": {
            "content": "",
            "subsections": []
        },
        "ElementTree.  Full documentation for ElementTree is available at": {
            "content": "'https://web.archive.org/web/20201124024954/http://effbot.org/zone/element-index.htm'.\n",
            "subsections": []
        },
        "ElementTree represents an XML document as a tree of element nodes.  The": {
            "content": "text content of the document is stored as the 'text' and 'tail'\nattributes of (This is one of the major differences between ElementTree\nand the Document Object Model; in the DOM there are many different types\nof node, including 'TextNode'.)\n",
            "subsections": []
        },
        "The most commonly used parsing function is 'parse()', that takes either": {
            "content": "a string (assumed to contain a filename) or a file-like object and\nreturns an 'ElementTree' instance:\n\nfrom xml.etree import ElementTree as ET\n\ntree = ET.parse('ex-1.xml')\n\nfeed = urllib.urlopen(\n'http://planet.python.org/rss10.xml')\ntree = ET.parse(feed)\n",
            "subsections": []
        },
        "Once you have an 'ElementTree' instance, you can call its 'getroot()'": {
            "content": "method to get the root 'Element' node.\n",
            "subsections": []
        },
        "There's also an 'XML()' function that takes a string literal and returns": {
            "content": "an 'Element' node (not an 'ElementTree').  This function provides a tidy\nway to incorporate XML fragments, approaching the convenience of an XML\nliteral:\n\nsvg = ET.XML(\"\"\"<svg width=\"10px\" version=\"1.0\">\n</svg>\"\"\")\nsvg.set('height', '320px')\nsvg.append(elem1)\n",
            "subsections": []
        },
        "Each XML element supports some dictionary-like and some list-like access": {
            "content": "methods.  Dictionary-like operations are used to access attribute\nvalues, and list-like operations are used to access child nodes.\n",
            "subsections": []
        },
        "Operation                           Result": {
            "content": "---------------------------------------------------------------------------------------\n\n'date2 = date1 + timedelta'         'date2' will be 'timedelta.days' days after\n'date1'.  (1)\n\n\n'date2 = date1 - timedelta'         Computes 'date2' such that 'date2 + timedelta ==\ndate1'.  (2)\n\n\n'timedelta = date1 - date2'         (3)\n\n\n'date1 == date2'               Equality comparison.  (4)\n'date1 != date2'\n\n'date1 < date2'                Order comparison.  (5)\n'date1 > date2'\n'date1 <= date2'\n'date1 >= date2'\n\nNotes:\n\n1. 'date2' is moved forward in time if 'timedelta.days > 0', or\nbackward if 'timedelta.days < 0'.  Afterward 'date2 - date1 ==\ntimedelta.days'.  'timedelta.seconds' and 'timedelta.microseconds'\nare ignored.  *note OverflowError: 68d. is raised if 'date2.year'\nwould be smaller than *note MINYEAR: 2136. or larger than *note\nMAXYEAR: 2137.\n\n2. 'timedelta.seconds' and 'timedelta.microseconds' are ignored.\n\n3. This is exact, and cannot overflow.  timedelta.seconds and\ntimedelta.microseconds are 0, and date2 + timedelta == date1 after.\n\n4. *note date: 70f. objects are equal if they represent the same date.\n\n5. 'date1' is considered less than 'date2' when 'date1' precedes\n'date2' in time.  In other words, 'date1 < date2' if and only if\n'date1.toordinal() < date2.toordinal()'.\n\nIn Boolean contexts, all *note date: 70f. objects are considered to be\ntrue.\n\nInstance methods:\n\n-- Method: date.replace (year=self.year, month=self.month,\nday=self.day)\n\nReturn a date with the same value, except for those parameters\ngiven new values by whichever keyword arguments are specified.\n\nExample:\n\n>>> from datetime import date\n>>> d = date(2002, 12, 31)\n>>> d.replace(day=26)\ndatetime.date(2002, 12, 26)\n\n-- Method: date.timetuple ()\n\nReturn a *note time.structtime: b3a. such as returned by *note\ntime.localtime(): 1353.\n\nThe hours, minutes and seconds are 0, and the DST flag is -1.\n\n'd.timetuple()' is equivalent to:\n\ntime.structtime((d.year, d.month, d.day, 0, 0, 0, d.weekday(), yday, -1))\n\nwhere 'yday = d.toordinal() - date(d.year, 1, 1).toordinal() + 1'\nis the day number within the current year starting with '1' for\nJanuary 1st.\n\n-- Method: date.toordinal ()\n\nReturn the proleptic Gregorian ordinal of the date, where January 1\nof year 1 has ordinal 1.  For any *note date: 70f. object 'd',\n'date.fromordinal(d.toordinal()) == d'.\n\n-- Method: date.weekday ()\n\nReturn the day of the week as an integer, where Monday is 0 and\nSunday is 6.  For example, 'date(2002, 12, 4).weekday() == 2', a\nWednesday.  See also *note isoweekday(): 215c.\n\n-- Method: date.isoweekday ()\n\nReturn the day of the week as an integer, where Monday is 1 and\nSunday is 7.  For example, 'date(2002, 12, 4).isoweekday() == 3', a\nWednesday.  See also *note weekday(): 215b, *note isocalendar():\n70e.\n\n-- Method: date.isocalendar ()\n\nReturn a *note named tuple: 417. object with three components:\n'year', 'week' and 'weekday'.\n\nThe ISO calendar is a widely used variant of the Gregorian\ncalendar.  (2)\n\nThe ISO year consists of 52 or 53 full weeks, and where a week\nstarts on a Monday and ends on a Sunday.  The first week of an ISO\nyear is the first (Gregorian) calendar week of a year containing a\nThursday.  This is called week number 1, and the ISO year of that\nThursday is the same as its Gregorian year.\n\nFor example, 2004 begins on a Thursday, so the first week of ISO\nyear 2004 begins on Monday, 29 Dec 2003 and ends on Sunday, 4 Jan\n2004:\n\n>>> from datetime import date\n>>> date(2003, 12, 29).isocalendar()\ndatetime.IsoCalendarDate(year=2004, week=1, weekday=1)\n>>> date(2004, 1, 4).isocalendar()\ndatetime.IsoCalendarDate(year=2004, week=1, weekday=7)\n\nChanged in version 3.9: Result changed from a tuple to a *note\nnamed tuple: 417.\n\n-- Method: date.isoformat ()\n\nReturn a string representing the date in ISO 8601 format,\n'YYYY-MM-DD':\n\n>>> from datetime import date\n>>> date(2002, 12, 4).isoformat()\n'2002-12-04'\n\n-- Method: date.str ()\n\nFor a date 'd', 'str(d)' is equivalent to 'd.isoformat()'.\n\n-- Method: date.ctime ()\n\nReturn a string representing the date:\n\n>>> from datetime import date\n>>> date(2002, 12, 4).ctime()\n'Wed Dec  4 00:00:00 2002'\n\n'd.ctime()' is equivalent to:\n\ntime.ctime(time.mktime(d.timetuple()))\n\non platforms where the native C 'ctime()' function (which *note\ntime.ctime(): 2160. invokes, but which *note date.ctime(): 215f.\ndoes not invoke) conforms to the C standard.\n\n-- Method: date.strftime (format)\n\nReturn a string representing the date, controlled by an explicit\nformat string.  Format codes referring to hours, minutes or seconds\nwill see 0 values.  See also *note strftime() and strptime()\nBehavior: 1523. and *note date.isoformat(): 215d.\n\n-- Method: date.format (format)\n\nSame as *note date.strftime(): ade.  This makes it possible to\nspecify a format string for a *note date: 70f. object in *note\nformatted string literals: 7cd. and when using *note str.format():\n3ed.  See also *note strftime() and strptime() Behavior: 1523. and\n*note date.isoformat(): 215d.\n\n* Menu:\n\n* Examples of Usage; date: Examples of Usage date.\n\n---------- Footnotes ----------\n\n(1) This matches the definition of the \"proleptic Gregorian\" calendar\nin Dershowitz and Reingold's book 'Calendrical Calculations', where it's\nthe base calendar for all computations.  See the book for algorithms for\nconverting between proleptic Gregorian ordinals and many other calendar\nsystems.\n\n(2) See R. H. van Gent's guide to the mathematics of the ISO 8601\ncalendar\n(https://web.archive.org/web/20220531051136/https://webspace.science.uu.nl/~gent0113/calendar/isocalendar.htm)\nfor a good explanation.\n",
            "subsections": []
        },
        "Comments and processing instructions are also represented as 'Element'": {
            "content": "nodes.  To check if a node is a comment or processing instructions:\n\nif elem.tag is ET.Comment:\n...\nelif elem.tag is ET.ProcessingInstruction:\n...\n",
            "subsections": []
        },
        "To generate XML output, you should call the 'ElementTree.write()'": {
            "content": "method.  Like 'parse()', it can take either a string or a file-like\nobject:\n\n# Encoding is US-ASCII\ntree.write('output.xml')\n\n# Encoding is UTF-8\nf = open('output.xml', 'w')\ntree.write(f, encoding='utf-8')\n\n(Caution: the default encoding used for output is ASCII. For general XML\nwork, where an element's name may contain arbitrary Unicode characters,\nASCII isn't a very useful encoding because it will raise an exception if\nan element's name contains any characters with values greater than 127.",
            "subsections": []
        },
        "Therefore, it's best to specify a different encoding such as UTF-8 that": {
            "content": "can handle any Unicode character.)\n",
            "subsections": []
        },
        "This section is only a partial description of the ElementTree": {
            "content": "interfaces.  Please read the package's official documentation for more\ndetails.\n\nSee also\n........\n\n'https://web.archive.org/web/20201124024954/http://effbot.org/zone/element-index.htm'\n\nOfficial documentation for ElementTree.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The hashlib package,  Next: The sqlite3 package,  Prev: The ElementTree package,  Up: New Improved and Removed Modules": {
            "content": "1.16.13.3 The hashlib package\n.............................\n\nA new *note hashlib: 63. module, written by Gregory P. Smith, has been\nadded to replace the 'md5' and 'sha' modules.  *note hashlib: 63. adds\nsupport for additional secure hashes (SHA-224, SHA-256, SHA-384, and\nSHA-512).  When available, the module uses OpenSSL for fast platform\noptimized implementations of algorithms.\n",
            "subsections": []
        },
        "The old 'md5' and 'sha' modules still exist as wrappers around hashlib": {
            "content": "to preserve backwards compatibility.  The new module's interface is very\nclose to that of the old modules, but not identical.  The most\nsignificant difference is that the constructor functions for creating\nnew hashing objects are named differently.\n\n# Old versions\nh = md5.md5()\nh = md5.new()\n\n# New version\nh = hashlib.md5()\n\n# Old versions\nh = sha.sha()\nh = sha.new()\n\n# New version\nh = hashlib.sha1()\n\n# Hash that weren't previously available\nh = hashlib.sha224()\nh = hashlib.sha256()\nh = hashlib.sha384()\nh = hashlib.sha512()\n\n# Alternative form\nh = hashlib.new('md5')          # Provide algorithm as a string\n\nOnce a hash object has been created, its methods are the same as before:\n'update(string)' hashes the specified string into the current digest\nstate, 'digest()' and 'hexdigest()' return the digest value as a binary\nstring or a string of hex digits, and *note copy(): 23. returns a new\nhashing object with the same digest state.\n\nSee also\n........\n\nThe documentation for the *note hashlib: 63. module.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The sqlite3 package,  Next: The wsgiref package,  Prev: The hashlib package,  Up: New Improved and Removed Modules": {
            "content": "1.16.13.4 The sqlite3 package\n.............................\n",
            "subsections": []
        },
        "The pysqlite module ('https://www.pysqlite.org'), a wrapper for the": {
            "content": "SQLite embedded database, has been added to the standard library under\nthe package name *note sqlite3: c9.\n\nSQLite is a C library that provides a lightweight disk-based database\nthat doesn't require a separate server process and allows accessing the\ndatabase using a nonstandard variant of the SQL query language.  Some\napplications can use SQLite for internal data storage.  It's also\npossible to prototype an application using SQLite and then port the code\nto a larger database such as PostgreSQL or Oracle.\n\npysqlite was written by Gerhard Ha\"ring and provides a SQL interface\ncompliant with the DB-API 2.0 specification described by PEP 249(1).\n",
            "subsections": []
        },
        "If you're compiling the Python source yourself, note that the source": {
            "content": "tree doesn't include the SQLite code, only the wrapper module.  You'll\nneed to have the SQLite libraries and headers installed before compiling",
            "subsections": []
        },
        "Python, and the build process will compile the module when the necessary": {
            "content": "headers are available.\n",
            "subsections": []
        },
        "To use the module, you must first create a 'Connection' object that": {
            "content": "represents the database.  Here the data will be stored in the\n'/tmp/example' file:\n\nconn = sqlite3.connect('/tmp/example')\n",
            "subsections": []
        },
        "You can also supply the special name ':memory:' to create a database in": {
            "content": "RAM.\n",
            "subsections": []
        },
        "Once you have a 'Connection', you can create a 'Cursor' object and call": {
            "content": "its 'execute()' method to perform SQL commands:\n\nc = conn.cursor()\n\n# Create table\nc.execute('''create table stocks\n(date text, trans text, symbol text,\nqty real, price real)''')\n\n# Insert a row of data\nc.execute(\"\"\"insert into stocks\nvalues ('2006-01-05','BUY','RHAT',100,35.14)\"\"\")\n",
            "subsections": []
        },
        "Usually your SQL operations will need to use values from Python": {
            "content": "variables.  You shouldn't assemble your query using Python's string\noperations because doing so is insecure; it makes your program\nvulnerable to an SQL injection attack.\n\nInstead, use the DB-API's parameter substitution.  Put '?' as a\nplaceholder wherever you want to use a value, and then provide a tuple\nof values as the second argument to the cursor's 'execute()' method.\n(Other database modules may use a different placeholder, such as '%s' or\n':1'.)  For example:\n\n# Never do this -- insecure!\nsymbol = 'IBM'\nc.execute(\"... where symbol = '%s'\" % symbol)\n\n# Do this instead\nt = (symbol,)\nc.execute('select * from stocks where symbol=?', t)\n\n# Larger example\nfor t in (('2006-03-28', 'BUY', 'IBM', 1000, 45.00),\n('2006-04-05', 'BUY', 'MSOFT', 1000, 72.00),\n('2006-04-06', 'SELL', 'IBM', 500, 53.00),\n):\nc.execute('insert into stocks values (?,?,?,?,?)', t)\n",
            "subsections": []
        },
        "To retrieve data after executing a SELECT statement, you can either": {
            "content": "treat the cursor as an iterator, call the cursor's 'fetchone()' method\nto retrieve a single matching row, or call 'fetchall()' to get a list of\nthe matching rows.\n\nThis example uses the iterator form:\n\n>>> c = conn.cursor()\n>>> c.execute('select * from stocks order by price')\n>>> for row in c:\n...    print row\n...\n(u'2006-01-05', u'BUY', u'RHAT', 100, 35.140000000000001)\n(u'2006-03-28', u'BUY', u'IBM', 1000, 45.0)\n(u'2006-04-06', u'SELL', u'IBM', 500, 53.0)\n(u'2006-04-05', u'BUY', u'MSOFT', 1000, 72.0)\n>>>\n",
            "subsections": []
        },
        "For more information about the SQL dialect supported by SQLite, see": {
            "content": "'https://www.sqlite.org'.\n\nSee also\n........\n\n'https://www.pysqlite.org'\n\nThe pysqlite web page.\n\n'https://www.sqlite.org'\n\nThe SQLite web page; the documentation describes the syntax and the\navailable data types for the supported SQL dialect.\n\nThe documentation for the *note sqlite3: c9. module.\n\nPEP 249(2) - Database API Specification 2.0\n\nPEP written by Marc-Andre' Lemburg.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0249/\n\n(2) https://peps.python.org/pep-0249/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The wsgiref package,  Prev: The sqlite3 package,  Up: New Improved and Removed Modules": {
            "content": "1.16.13.5 The wsgiref package\n.............................\n",
            "subsections": []
        },
        "The Web Server Gateway Interface (WSGI) v1.0 defines a standard": {
            "content": "interface between web servers and Python web applications and is\ndescribed in PEP 333(1).  The *note wsgiref: 113. package is a reference\nimplementation of the WSGI specification.\n",
            "subsections": []
        },
        "The package includes a basic HTTP server that will run a WSGI": {
            "content": "application; this server is useful for debugging but isn't intended for\nproduction use.  Setting up a server takes only a few lines of code:\n\nfrom wsgiref import simpleserver\n\nwsgiapp = ...\n\nhost = ''\nport = 8000\nhttpd = simpleserver.makeserver(host, port, wsgiapp)\nhttpd.serveforever()\n\nSee also\n........\n\n'https://web.archive.org/web/20160331090247/http://wsgi.readthedocs.org/en/latest/'\n\nA central web site for WSGI-related resources.\n\nPEP 333(2) - Python Web Server Gateway Interface v1.0\n\nPEP written by Phillip J. Eby.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0333/\n\n(2) https://peps.python.org/pep-0333/\n\nFile: python3.12.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\n\n\nChanges to Python's build process and to the C API include:\n\n* The Python source tree was converted from CVS to Subversion, in a\ncomplex migration procedure that was supervised and flawlessly\ncarried out by Martin von Lo\"wis.  The procedure was developed as\nPEP 347(1).\n\n* Coverity, a company that markets a source code analysis tool called\nPrevent, provided the results of their examination of the Python\nsource code.  The analysis found about 60 bugs that were quickly\nfixed.  Many of the bugs were refcounting problems, often occurring\nin error-handling code.  See 'https://scan.coverity.com' for the\nstatistics.\n\n* The largest change to the C API came from PEP 353(2), which\nmodifies the interpreter to use a *note Pyssizet: 88d. type\ndefinition instead of int.  See the earlier section *note PEP 353;\nUsing ssizet as the index type: 126e. for a discussion of this\nchange.\n\n* The design of the bytecode compiler has changed a great deal, no\nlonger generating bytecode by traversing the parse tree.  Instead\nthe parse tree is converted to an abstract syntax tree (or AST),\nand it is the abstract syntax tree that's traversed to produce the\nbytecode.\n\nIt's possible for Python code to obtain AST objects by using the\n*note compile(): 528. built-in and specifying 'ast.PyCFONLYAST'\nas the value of the 'flags' parameter:\n\nfrom ast import PyCFONLYAST\nast = compile(\"\"\"a=0\nfor i in range(10):\na += i\n\"\"\", \"<string>\", 'exec', PyCFONLYAST)\n\nassignment = ast.body[0]\nforloop = ast.body[1]\n\nNo official documentation has been written for the AST code yet,\nbut PEP 339(3) discusses the design.  To start learning about the\ncode, read the definition of the various AST nodes in\n'Parser/Python.asdl'.  A Python script reads this file and\ngenerates a set of C structure definitions in\n'Include/Python-ast.h'.  The 'PyParserASTFromString()' and\n'PyParserASTFromFile()', defined in 'Include/pythonrun.h', take\nPython source as input and return the root of an AST representing\nthe contents.  This AST can then be turned into a code object by\n'PyASTCompile()'.  For more information, read the source code, and\nthen ask questions on python-dev.\n\nThe AST code was developed under Jeremy Hylton's management, and\nimplemented by (in alphabetical order) Brett Cannon, Nick Coghlan,\nGrant Edwards, John Ehresman, Kurt Kaiser, Neal Norwitz, Tim\nPeters, Armin Rigo, and Neil Schemenauer, plus the participants in\na number of AST sprints at conferences such as PyCon.\n\n* Evan Jones's patch to obmalloc, first described in a talk at PyCon\nDC 2005, was applied.  Python 2.4 allocated small objects in\n256K-sized arenas, but never freed arenas.  With this patch, Python\nwill free arenas when they're empty.  The net effect is that on\nsome platforms, when you allocate many objects, Python's memory\nusage may actually drop when you delete them and the memory may be\nreturned to the operating system.  (Implemented by Evan Jones, and\nreworked by Tim Peters.)\n\nNote that this change means extension modules must be more careful\nwhen allocating memory.  Python's API has many different functions\nfor allocating memory that are grouped into families.  For example,\n*note PyMemMalloc(): ab1, *note PyMemRealloc(): eab, and *note\nPyMemFree(): 129a. are one family that allocates raw memory, while\n*note PyObjectMalloc(): ab3, *note PyObjectRealloc(): 129b, and\n*note PyObjectFree(): ab0. are another family that's supposed to\nbe used for creating Python objects.\n\nPreviously these different families all reduced to the platform's\n'malloc()' and 'free()' functions.  This meant it didn't matter if\nyou got things wrong and allocated memory with the 'PyMem' function\nbut freed it with the 'PyObject' function.  With 2.5's changes to\nobmalloc, these families now do different things and mismatches\nwill probably result in a segfault.  You should carefully test your\nC extension modules with Python 2.5.\n\n* The built-in set types now have an official C API. Call *note\nPySetNew(): 129c. and *note PyFrozenSetNew(): 129d. to create a\nnew set, *note PySetAdd(): 129e. and *note PySetDiscard(): 129f.\nto add and remove elements, and *note PySetContains(): 12a0. and\n*note PySetSize(): 12a1. to examine the set's state.  (Contributed\nby Raymond Hettinger.)\n\n* C code can now obtain information about the exact revision of the\nPython interpreter by calling the *note PyGetBuildInfo(): 128a.\nfunction that returns a string of build information like this:\n'\"trunk:45355:45356M, Apr 13 2006, 07:42:19\"'.  (Contributed by\nBarry Warsaw.)\n\n* Two new macros can be used to indicate C functions that are local\nto the current file so that a faster calling convention can be\nused.  'PyLOCAL(type)' declares the function as returning a value\nof the specified 'type' and uses a fast-calling qualifier.\n'PyLOCALINLINE(type)' does the same thing and also requests the\nfunction be inlined.  If macro 'PYLOCALAGGRESSIVE' is defined\nbefore 'python.h' is included, a set of more aggressive\noptimizations are enabled for the module; you should benchmark the\nresults to find out if these optimizations actually make the code\nfaster.  (Contributed by Fredrik Lundh at the NeedForSpeed sprint.)\n\n* 'PyErrNewException(name, base, dict)' can now accept a tuple of\nbase classes as its 'base' argument.  (Contributed by Georg\nBrandl.)\n\n* The 'PyErrWarn()' function for issuing warnings is now deprecated\nin favour of 'PyErrWarnEx(category, message, stacklevel)' which\nlets you specify the number of stack frames separating this\nfunction and the caller.  A 'stacklevel' of 1 is the function\ncalling *note PyErrWarnEx(): 12a2, 2 is the function above that,\nand so forth.  (Added by Neal Norwitz.)\n\n* The CPython interpreter is still written in C, but the code can now\nbe compiled with a C++ compiler without errors.  (Implemented by\nAnthony Baxter, Martin von Lo\"wis, Skip Montanaro.)\n\n* The 'PyRangeNew()' function was removed.  It was never documented,\nnever used in the core code, and had dangerously lax error\nchecking.  In the unlikely case that your extensions were using it,\nyou can replace it by something like the following:\n\nrange = PyObjectCallFunction((PyObject*) &PyRangeType, \"lll\",\nstart, stop, step);\n\n* Menu:\n\n* Port-Specific Changes::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0347/\n\n(2) https://peps.python.org/pep-0353/\n\n(3) https://peps.python.org/pep-0339/\n\nFile: python3.12.info,  Node: Port-Specific Changes,  Up: Build and C API Changes<10>\n\n1.16.14.1 Port-Specific Changes\n...............................\n\n* MacOS X (10.3 and higher): dynamic loading of modules now uses the\n'dlopen()' function instead of MacOS-specific functions.\n\n* MacOS X: an '--enable-universalsdk' switch was added to the\n'configure' script that compiles the interpreter as a universal\nbinary able to run on both PowerPC and Intel processors.\n(Contributed by Ronald Oussoren; bpo-2573(1).)\n\n* Windows: '.dll' is no longer supported as a filename extension for\nextension modules.  '.pyd' is now the only filename extension that\nwill be searched for.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=2573\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "This section lists previously described changes that may require changes": {
            "content": "to your code:\n\n* *note yield: 7f1. is now always a keyword; if it's used as a\nvariable name in your code, a different name must be chosen.\n\n* For strings 'X' and 'Y', 'X in Y' now works if 'X' is more than one\ncharacter long.\n\n* The *note int(): 17e. type constructor will now return a long\ninteger instead of raising an *note OverflowError: 68d. when a\nstring or floating-point number is too large to fit into an\ninteger.\n\n* If you have Unicode strings that contain 8-bit characters, you must\ndeclare the file's encoding (UTF-8, Latin-1, or whatever) by adding\na comment to the top of the file.  See section *note PEP 263;\nSource Code Encodings: 12de. for more information.\n\n* Calling Tcl methods through 'tkinter' no longer returns only\nstrings.  Instead, if Tcl returns other objects those objects are\nconverted to their Python equivalent, if one exists, or wrapped\nwith a 'tkinter.TclObj' object if no Python equivalent exists.\n\n* Large octal and hex literals such as '0xffffffff' now trigger a\n*note FutureWarning: 23f.  Currently they're stored as 32-bit\nnumbers and result in a negative value, but in Python 2.4 they'll\nbecome positive long integers.\n\nThere are a few ways to fix this warning.  If you really need a\npositive number, just add an 'L' to the end of the literal.  If\nyou're trying to get a 32-bit integer with low bits set and have\npreviously used an expression such as '~(1 << 31)', it's probably\nclearest to start with all bits set and clear the desired upper\nbits.  For example, to clear just the top bit (bit 31), you could\nwrite '0xffffffffL &~(1L<<31)'.\n\n* You can no longer disable assertions by assigning to 'debug'.\n\n* The Distutils 'setup()' function has gained various new keyword\narguments such as 'depends'.  Old versions of the Distutils will\nabort if passed unknown keywords.  A solution is to check for the\npresence of the new 'getdistutiloptions()' function in your\n'setup.py' and only uses the new keywords with a version of the\nDistutils that supports them:\n\nfrom distutils import core\n\nkw = {'sources': 'foo.c', ...}\nif hasattr(core, 'getdistutiloptions'):\nkw['depends'] = ['foo.h']\next = Extension(kw)\n\n* Using 'None' as a variable name will now result in a *note\nSyntaxWarning: 178. warning.\n\n* Names of extension types defined by the modules included with\nPython now contain the module and a ''.'' in front of the type\nname.\n\nFile: python3.12.info,  Node: Acknowledgements<5>,  Prev: Porting to Python 2 3,  Up: What's New in Python 2 3\n\n",
            "subsections": []
        },
        "Raymond Hettinger, Ralf W. Grosse-Kunstleve, Kent Johnson, Iain Lowe,": {
            "content": "Martin von Lo\"wis, Fredrik Lundh, Andrew McNamara, Skip Montanaro,",
            "subsections": []
        },
        "Gustavo Niemeyer, Paul Prescod, James Pryor, Mike Rovner, Scott Weikart,": {
            "content": "Barry Warsaw, Thomas Wouters.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": [
                {
                    "name": "1.17 What's New in Python 2.4",
                    "content": ""
                }
            ]
        },
        "This article explains the new features in Python 2.4.1, released on": {
            "content": "March 30, 2005.\n",
            "subsections": []
        },
        "Python 2.4 is a medium-sized release.  It doesn't introduce as many": {
            "content": "changes as the radical Python 2.2, but introduces more features than the\nconservative 2.3 release.  The most significant new language features\nare function decorators and generator expressions; most other changes\nare to the standard library.\n",
            "subsections": []
        },
        "According to the CVS change logs, there were 481 patches applied and 502": {
            "content": "bugs fixed between Python 2.3 and 2.4.  Both figures are likely to be\nunderestimates.\n",
            "subsections": []
        },
        "This article doesn't attempt to provide a complete specification of": {
            "content": "every single new feature, but instead provides a brief introduction to\neach feature.  For full details, you should refer to the documentation\nfor Python 2.4, such as the Python Library Reference and the Python",
            "subsections": []
        },
        "Reference Manual.  Often you will be referred to the PEP for a": {
            "content": "particular new feature for explanations of the implementation and design\nrationale.\n\n* Menu:\n\n* PEP 218; Built-In Set Objects: PEP 218 Built-In Set Objects.\n* PEP 237; Unifying Long Integers and Integers: PEP 237 Unifying Long Integers and Integers.\n* PEP 289; Generator Expressions: PEP 289 Generator Expressions.\n* PEP 292; Simpler String Substitutions: PEP 292 Simpler String Substitutions.\n* PEP 318; Decorators for Functions and Methods: PEP 318 Decorators for Functions and Methods.\n* PEP 322; Reverse Iteration: PEP 322 Reverse Iteration.\n* PEP 324; New subprocess Module: PEP 324 New subprocess Module.\n* PEP 327; Decimal Data Type: PEP 327 Decimal Data Type.\n* PEP 328; Multi-line Imports: PEP 328 Multi-line Imports.\n* PEP 331; Locale-Independent Float/String Conversions: PEP 331 Locale-Independent Float/String Conversions.\n* Other Language Changes: Other Language Changes<16>.\n* New, Improved, and Deprecated Modules: New Improved and Deprecated Modules<3>.\n* Build and C API Changes: Build and C API Changes<11>.\n* Porting to Python 2.4: Porting to Python 2 4.\n* Acknowledgements: Acknowledgements<4>.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: PEP 218 Built-In Set Objects,  Next: PEP 237 Unifying Long Integers and Integers,  Up: What's New in Python 2 4": {
            "content": "",
            "subsections": []
        },
        "Python 2.3 introduced the 'sets' module.  C implementations of set data": {
            "content": "types have now been added to the Python core as two new built-in types,\n'set(iterable)' and 'frozenset(iterable)'.  They provide high speed\noperations for membership testing, for eliminating duplicates from\nsequences, and for mathematical operations like unions, intersections,\ndifferences, and symmetric differences.\n\n>>> a = set('abracadabra')              # form a set from a string\n>>> 'z' in a                            # fast membership testing\nFalse\n>>> a                                   # unique letters in a\nset(['a', 'r', 'b', 'c', 'd'])\n>>> ''.join(a)                          # convert back into a string\n'arbcd'\n\n>>> b = set('alacazam')                 # form a second set\n>>> a - b                               # letters in a but not in b\nset(['r', 'd', 'b'])\n>>> a | b                               # letters in either a or b\nset(['a', 'c', 'r', 'd', 'b', 'm', 'z', 'l'])\n>>> a & b                               # letters in both a and b\nset(['a', 'c'])\n>>> a ^ b                               # letters in a or b but not both\nset(['r', 'd', 'b', 'm', 'z', 'l'])\n\n>>> a.add('z')                          # add a new element\n>>> a.update('wxy')                     # add multiple new elements\n>>> a\nset(['a', 'c', 'b', 'd', 'r', 'w', 'y', 'x', 'z'])\n>>> a.remove('x')                       # take one element out\n>>> a\nset(['a', 'c', 'b', 'd', 'r', 'w', 'y', 'z'])\n\nThe *note frozenset(): 39e. type is an immutable version of *note set():\n39d.  Since it is immutable and hashable, it may be used as a dictionary\nkey or as a member of another set.\n",
            "subsections": []
        },
        "The 'sets' module remains in the standard library, and may be useful if": {
            "content": "you wish to subclass the 'Set' or 'ImmutableSet' classes.  There are\ncurrently no plans to deprecate the module.\n\nSee also\n........\n\nPEP 218(1) - Adding a Built-In Set Object Type\n\nOriginally proposed by Greg Wilson and ultimately implemented by\nRaymond Hettinger.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0218/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "The lengthy transition process for this PEP, begun in Python 2.2, takes": {
            "content": "another step forward in Python 2.4.  In 2.3, certain integer operations\nthat would behave differently after int/long unification triggered *note",
            "subsections": []
        },
        "FutureWarning: 23f. warnings and returned values limited to 32 or 64": {
            "content": "bits (depending on your platform).  In 2.4, these expressions no longer\nproduce a warning and instead produce a different result that's usually\na long integer.\n",
            "subsections": []
        },
        "The problematic expressions are primarily left shifts and lengthy": {
            "content": "hexadecimal and octal constants.  For example, '2 << 32' results in a\nwarning in 2.3, evaluating to 0 on 32-bit platforms.  In Python 2.4,\nthis expression now returns the correct answer, 8589934592.\n\nSee also\n........\n\nPEP 237(1) - Unifying Long Integers and Integers\n\nOriginal PEP written by Moshe Zadka and GvR. The changes for 2.4\nwere implemented by Kalle Svensson.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0237/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "The iterator feature introduced in Python 2.2 and the *note itertools:\n7b. module make it easier to write programs that loop through large data\nsets without having the entire data set in memory at one time.  List\ncomprehensions don't fit into this picture very well because they\nproduce a Python list object containing all of the items.  This\nunavoidably pulls all of the objects into memory, which can be a problem\nif your data set is very large.  When trying to write a functionally\nstyled program, it would be natural to write something like:\n\nlinks = [link for link in getalllinks() if not link.followed]\nfor link in links:\n...\n\ninstead of\n\nfor link in getalllinks():\nif link.followed:\ncontinue\n...\n",
            "subsections": []
        },
        "The first form is more concise and perhaps more readable, but if you're": {
            "content": "dealing with a large number of link objects you'd have to write the\nsecond form to avoid having all link objects in memory at the same time.\n",
            "subsections": []
        },
        "Generator expressions work similarly to list comprehensions but don't": {
            "content": "materialize the entire list; instead they create a generator that will\nreturn elements one by one.  The above example could be written as:\n\nlinks = (link for link in getalllinks() if not link.followed)\nfor link in links:\n...\n",
            "subsections": []
        },
        "Generator expressions always have to be written inside parentheses, as": {
            "content": "in the above example.  The parentheses signalling a function call also\ncount, so if you want to create an iterator that will be immediately\npassed to a function you could write:\n\nprint sum(obj.count for obj in listallobjects())\n",
            "subsections": []
        },
        "Generator expressions differ from list comprehensions in various small": {
            "content": "ways.  Most notably, the loop variable ('obj' in the above example) is\nnot accessible outside of the generator expression.  List comprehensions\nleave the variable assigned to its last value; future versions of Python\nwill change this, making list comprehensions match generator expressions\nin this respect.\n\nSee also\n........\n\nPEP 289(1) - Generator Expressions\n\nProposed by Raymond Hettinger and implemented by Jiwon Seo with\nearly efforts steered by Hye-Shik Chang.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0289/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "Some new classes in the standard library provide an alternative": {
            "content": "mechanism for substituting variables into strings; this style of\nsubstitution may be better for applications where untrained users need\nto edit templates.\n\nThe usual way of substituting variables by name is the '%' operator:\n\n>>> '%(page)i: %(title)s' % {'page':2, 'title': 'The Best of Times'}\n'2: The Best of Times'\n",
            "subsections": []
        },
        "When writing the template string, it can be easy to forget the 'i' or": {
            "content": "'s' after the closing parenthesis.  This isn't a big problem if the\ntemplate is in a Python module, because you run the code, get an\n\"Unsupported format character\" *note ValueError: 183, and fix the\nproblem.  However, consider an application such as Mailman where\ntemplate strings or translations are being edited by users who aren't\naware of the Python language.  The format string's syntax is complicated\nto explain to such users, and if they make a mistake, it's difficult to\nprovide helpful feedback to them.\n\nPEP 292 adds a 'Template' class to the *note string: cd. module that\nuses '$' to indicate a substitution:\n\n>>> import string\n>>> t = string.Template('$page: $title')\n>>> t.substitute({'page':2, 'title': 'The Best of Times'})\n'2: The Best of Times'\n",
            "subsections": []
        },
        "If a key is missing from the dictionary, the 'substitute()' method will": {
            "content": "raise a *note KeyError: 8cf.  There's also a 'safesubstitute()' method\nthat ignores missing keys:\n\n>>> t = string.Template('$page: $title')\n>>> t.safesubstitute({'page':3})\n'3: $title'\n\nSee also\n........\n\nPEP 292(1) - Simpler String Substitutions\n\nWritten and implemented by Barry Warsaw.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0292/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "Python 2.2 extended Python's object model by adding static methods and": {
            "content": "class methods, but it didn't extend Python's syntax to provide any new\nway of defining static or class methods.  Instead, you had to write a\n*note def: 12af. statement in the usual way, and pass the resulting\nmethod to a *note staticmethod(): 5cc. or *note classmethod(): 246.\nfunction that would wrap up the function as a method of the new type.\nYour code would look like this:\n\nclass C:\ndef meth (cls):\n...\n\nmeth = classmethod(meth)   # Rebind name to wrapped-up class method\n",
            "subsections": []
        },
        "If the method was very long, it would be easy to miss or forget the": {
            "content": "*note classmethod(): 246. invocation after the function body.\n",
            "subsections": []
        },
        "The intention was always to add some syntax to make such definitions": {
            "content": "more readable, but at the time of 2.2's release a good syntax was not\nobvious.  Today a good syntax 'still' isn't obvious but users are asking\nfor easier access to the feature; a new syntactic feature has been added\nto meet this need.\n\nThe new feature is called \"function decorators\".  The name comes from\nthe idea that *note classmethod(): 246, *note staticmethod(): 5cc, and\nfriends are storing additional information on a function object; they're\n'decorating' functions with more details.\n\nThe notation borrows from Java and uses the ''@'' character as an\nindicator.  Using the new syntax, the example above would be written:\n\nclass C:\n\n@classmethod\ndef meth (cls):\n...\n\nThe '@classmethod' is shorthand for the 'meth=classmethod(meth)'\nassignment.  More generally, if you have the following:\n\n@A\n@B\n@C\ndef f ():\n...\n\nIt's equivalent to the following pre-decorator code:\n\ndef f(): ...\nf = A(B(C(f)))\n",
            "subsections": []
        },
        "Decorators must come on the line before a function definition, one": {
            "content": "decorator per line, and can't be on the same line as the def statement,\nmeaning that '@A def f(): ...' is illegal.  You can only decorate\nfunction definitions, either at the module level or inside a class; you\ncan't decorate class definitions.\n\nA decorator is just a function that takes the function to be decorated\nas an argument and returns either the same function or some new object.",
            "subsections": []
        },
        "The return value of the decorator need not be callable (though it": {
            "content": "typically is), unless further decorators will be applied to the result.",
            "subsections": []
        },
        "It's easy to write your own decorators.  The following simple example": {
            "content": "just sets an attribute on the function object:\n\n>>> def deco(func):\n...    func.attr = 'decorated'\n...    return func\n...\n>>> @deco\n... def f(): pass\n...\n>>> f\n<function f at 0x402ef0d4>\n>>> f.attr\n'decorated'\n>>>\n",
            "subsections": []
        },
        "As a slightly more realistic example, the following decorator checks": {
            "content": "that the supplied argument is an integer:\n\ndef requireint (func):\ndef wrapper (arg):\nassert isinstance(arg, int)\nreturn func(arg)\n\nreturn wrapper\n\n@requireint\ndef p1 (arg):\nprint arg\n\n@requireint\ndef p2(arg):\nprint arg*2\n",
            "subsections": []
        },
        "An example in PEP 318(1) contains a fancier version of this idea that": {
            "content": "lets you both specify the required type and check the returned type.\n",
            "subsections": []
        },
        "Decorator functions can take arguments.  If arguments are supplied, your": {
            "content": "decorator function is called with only those arguments and must return a\nnew decorator function; this function must take a single function and\nreturn a function, as previously described.  In other words, '@A @B\n@C(args)' becomes:\n\ndef f(): ...\ndeco = C(args)\nf = A(B(deco(f)))\n",
            "subsections": []
        },
        "Getting this right can be slightly brain-bending, but it's not too": {
            "content": "difficult.\n\nA small related change makes the *note funcname: 1149. attribute of\nfunctions writable.  This attribute is used to display function names in\ntracebacks, so decorators should change the name of any new function\nthat's constructed and returned.\n\nSee also\n........\n\nPEP 318(2) - Decorators for Functions, Methods and Classes\n\nWritten by Kevin D. Smith, Jim Jewett, and Skip Montanaro.  Several\npeople wrote patches implementing function decorators, but the one\nthat was actually checked in was patch #979728, written by Mark\nRussell.\n\n'https://wiki.python.org/moin/PythonDecoratorLibrary'\n\nThis Wiki page contains several examples of decorators.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0318/\n\n(2) https://peps.python.org/pep-0318/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "A new built-in function, 'reversed(seq)', takes a sequence and returns\nan iterator that loops over the elements of the sequence in reverse\norder.\n\n>>> for i in reversed(xrange(1,4)):\n...    print i\n...\n3\n2\n1\n\nCompared to extended slicing, such as 'range(1,4)[::-1]', *note\nreversed(): 661. is easier to read, runs faster, and uses substantially\nless memory.\n\nNote that *note reversed(): 661. only accepts sequences, not arbitrary\niterators.  If you want to reverse an iterator, first convert it to a\nlist with *note list(): 3dc.\n\n>>> input = open('/etc/passwd', 'r')\n>>> for line in reversed(list(input)):\n...   print line\n...\nroot:*:0:0:System Administrator:/var/root:/bin/tcsh\n...\n\nSee also\n........\n\nPEP 322(1) - Reverse Iteration\n\nWritten and implemented by Raymond Hettinger.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0322/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "The standard library provides a number of ways to execute a subprocess,": {
            "content": "offering different features and different levels of complexity.\n'os.system(command)' is easy to use, but slow (it runs a shell process\nwhich executes the command) and dangerous (you have to be careful about\nescaping the shell's metacharacters).  The 'popen2' module offers\nclasses that can capture standard output and standard error from the\nsubprocess, but the naming is confusing.  The *note subprocess: d0.\nmodule cleans this up, providing a unified interface that offers all the\nfeatures you might need.\n\nInstead of 'popen2''s collection of classes, *note subprocess: d0.\ncontains a single class called *note subprocess.Popen: 8c3. whose\nconstructor supports a number of different keyword arguments.\n\nclass Popen(args, bufsize=0, executable=None,\nstdin=None, stdout=None, stderr=None,\npreexecfn=None, closefds=False, shell=False,\ncwd=None, env=None, universalnewlines=False,\nstartupinfo=None, creationflags=0):\n\n'args' is commonly a sequence of strings that will be the arguments to\nthe program executed as the subprocess.  (If the 'shell' argument is\ntrue, 'args' can be a string which will then be passed on to the shell\nfor interpretation, just as *note os.system(): 12b2. does.)\n\n'stdin', 'stdout', and 'stderr' specify what the subprocess's input,\noutput, and error streams will be.  You can provide a file object or a\nfile descriptor, or you can use the constant 'subprocess.PIPE' to create\na pipe between the subprocess and the parent.\n\nThe constructor has a number of handy options:\n\n* 'closefds' requests that all file descriptors be closed before\nrunning the subprocess.\n\n* 'cwd' specifies the working directory in which the subprocess will\nbe executed (defaulting to whatever the parent's working directory\nis).\n\n* 'env' is a dictionary specifying environment variables.\n\n* 'preexecfn' is a function that gets called before the child is\nstarted.\n\n* 'universalnewlines' opens the child's input and output using\nPython's *note universal newlines: b90. feature.\n",
            "subsections": []
        },
        "Once you've created the 'Popen' instance, you can call its 'wait()'": {
            "content": "method to pause until the subprocess has exited, 'poll()' to check if\nit's exited without pausing, or 'communicate(data)' to send the string\n'data' to the subprocess's standard input.  'communicate(data)' then\nreads any data that the subprocess has sent to its standard output or\nstandard error, returning a tuple '(stdoutdata, stderrdata)'.\n\n'call()' is a shortcut that passes its arguments along to the 'Popen'\nconstructor, waits for the command to complete, and returns the status\ncode of the subprocess.  It can serve as a safer analog to *note\nos.system(): 12b2.:\n\nsts = subprocess.call(['dpkg', '-i', '/tmp/new-package.deb'])\nif sts == 0:\n# Success\n...\nelse:\n# dpkg returned an error\n...\n",
            "subsections": []
        },
        "The command is invoked without use of the shell.  If you really do want": {
            "content": "to use the shell, you can add 'shell=True' as a keyword argument and\nprovide a string instead of a sequence:\n\nsts = subprocess.call('dpkg -i /tmp/new-package.deb', shell=True)\n",
            "subsections": []
        },
        "The PEP takes various examples of shell and Python code and shows how": {
            "content": "they'd be translated into Python code that uses *note subprocess: d0.\nReading this section of the PEP is highly recommended.\n\nSee also\n........\n\nPEP 324(1) - subprocess - New process module\n\nWritten and implemented by Peter ??strand, with assistance from\nFredrik Lundh and others.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0324/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "Python has always supported floating-point (FP) numbers, based on the": {
            "content": "underlying C double type, as a data type.  However, while most\nprogramming languages provide a floating-point type, many people (even\nprogrammers) are unaware that floating-point numbers don't represent\ncertain decimal fractions accurately.  The new 'Decimal' type can\nrepresent these fractions accurately, up to a user-specified precision\nlimit.\n\n* Menu:\n\n* Why is Decimal needed?::\n* The Decimal type::\n* The Context type::\n\nFile: python3.12.info,  Node: Why is Decimal needed?,  Next: The Decimal type,  Up: PEP 327 Decimal Data Type\n\n1.17.8.1 Why is Decimal needed?\n...............................\n",
            "subsections": []
        },
        "The limitations arise from the representation used for floating-point": {
            "content": "numbers.  FP numbers are made up of three components:\n\n* The sign, which is positive or negative.\n\n* The mantissa, which is a single-digit binary number followed by a\nfractional part.  For example, '1.01' in base-2 notation is '1 +\n0/2 + 1/4', or 1.25 in decimal notation.\n\n* The exponent, which tells where the decimal point is located in the\nnumber represented.\n",
            "subsections": []
        },
        "For example, the number 1.25 has positive sign, a mantissa value of 1.01": {
            "content": "(in binary), and an exponent of 0 (the decimal point doesn't need to be\nshifted).  The number 5 has the same sign and mantissa, but the exponent\nis 2 because the mantissa is multiplied by 4 (2 to the power of the\nexponent 2); 1.25 * 4 equals 5.\n",
            "subsections": []
        },
        "Modern systems usually provide floating-point support that conforms to a": {
            "content": "standard called IEEE 754.  C's double type is usually implemented as a\n64-bit IEEE 754 number, which uses 52 bits of space for the mantissa.\nThis means that numbers can only be specified to 52 bits of precision.",
            "subsections": []
        },
        "If you're trying to represent numbers whose expansion repeats endlessly,": {
            "content": "the expansion is cut off after 52 bits.  Unfortunately, most software\nneeds to produce output in base 10, and common fractions in base 10 are\noften repeating decimals in binary.  For example, 1.1 decimal is binary\n'1.0001100110011 ...'; .1 = 1/16 + 1/32 + 1/256 plus an infinite number\nof additional terms.  IEEE 754 has to chop off that infinitely repeated\ndecimal after 52 digits, so the representation is slightly inaccurate.\n\nSometimes you can see this inaccuracy when the number is printed:\n\n>>> 1.1\n1.1000000000000001\n",
            "subsections": []
        },
        "The inaccuracy isn't always visible when you print the number because": {
            "content": "the FP-to-decimal-string conversion is provided by the C library, and\nmost C libraries try to produce sensible output.  Even if it's not\ndisplayed, however, the inaccuracy is still there and subsequent\noperations can magnify the error.\n",
            "subsections": []
        },
        "For many applications this doesn't matter.  If I'm plotting points and": {
            "content": "displaying them on my monitor, the difference between 1.1 and\n1.1000000000000001 is too small to be visible.  Reports often limit\noutput to a certain number of decimal places, and if you round the\nnumber to two or three or even eight decimal places, the error is never\napparent.  However, for applications where it does matter, it's a lot of\nwork to implement your own custom arithmetic routines.\n\nHence, the 'Decimal' type was created.\n\nFile: python3.12.info,  Node: The Decimal type,  Next: The Context type,  Prev: Why is Decimal needed?,  Up: PEP 327 Decimal Data Type\n\n1.17.8.2 The 'Decimal' type\n...........................\n\nA new module, *note decimal: 33, was added to Python's standard library.",
            "subsections": []
        },
        "It contains two classes, 'Decimal' and 'Context'.  'Decimal' instances": {
            "content": "represent numbers, and 'Context' instances are used to wrap up various\nsettings such as the precision and default rounding mode.\n\n'Decimal' instances are immutable, like regular Python integers and FP\nnumbers; once it's been created, you can't change the value an instance\nrepresents.  'Decimal' instances can be created from integers or\nstrings:\n\n>>> import decimal\n>>> decimal.Decimal(1972)\nDecimal(\"1972\")\n>>> decimal.Decimal(\"1.1\")\nDecimal(\"1.1\")\n",
            "subsections": []
        },
        "You can also provide tuples containing the sign, the mantissa": {
            "content": "represented as a tuple of decimal digits, and the exponent:\n\n>>> decimal.Decimal((1, (1, 4, 7, 5), -2))\nDecimal(\"-14.75\")\n",
            "subsections": []
        },
        "Cautionary note: the sign bit is a Boolean value, so 0 is positive and 1": {
            "content": "is negative.\n",
            "subsections": []
        },
        "Converting from floating-point numbers poses a bit of a problem: should": {
            "content": "the FP number representing 1.1 turn into the decimal number for exactly\n1.1, or for 1.1 plus whatever inaccuracies are introduced?  The decision\nwas to dodge the issue and leave such a conversion out of the API.",
            "subsections": []
        },
        "Instead, you should convert the floating-point number into a string": {
            "content": "using the desired precision and pass the string to the 'Decimal'\nconstructor:\n\n>>> f = 1.1\n>>> decimal.Decimal(str(f))\nDecimal(\"1.1\")\n>>> decimal.Decimal('%.12f' % f)\nDecimal(\"1.100000000000\")\n",
            "subsections": []
        },
        "Once you have 'Decimal' instances, you can perform the usual": {
            "content": "mathematical operations on them.  One limitation: exponentiation\nrequires an integer exponent:\n\n>>> a = decimal.Decimal('35.72')\n>>> b = decimal.Decimal('1.73')\n>>> a+b\nDecimal(\"37.45\")\n>>> a-b\nDecimal(\"33.99\")\n>>> a*b\nDecimal(\"61.7956\")\n>>> a/b\nDecimal(\"20.64739884393063583815028902\")\n>>> a  2\nDecimal(\"1275.9184\")\n>>> ab\nTraceback (most recent call last):\n...\ndecimal.InvalidOperation: x  (non-integer)\n",
            "subsections": []
        },
        "You can combine 'Decimal' instances with integers, but not with": {
            "content": "floating-point numbers:\n\n>>> a + 4\nDecimal(\"39.72\")\n>>> a + 4.5\nTraceback (most recent call last):\n...\nTypeError: You can interact Decimal only with int, long or Decimal data types.\n>>>\n\n'Decimal' numbers can be used with the *note math: 89. and *note cmath:\n16. modules, but note that they'll be immediately converted to\nfloating-point numbers before the operation is performed, resulting in a\npossible loss of precision and accuracy.  You'll also get back a regular\nfloating-point number and not a 'Decimal'.\n\n>>> import math, cmath\n>>> d = decimal.Decimal('123456789012.345')\n>>> math.sqrt(d)\n351364.18288201344\n>>> cmath.sqrt(-d)\n351364.18288201344j\n\n'Decimal' instances have a 'sqrt()' method that returns a 'Decimal', but\nif you need other things such as trigonometric functions you'll have to\nimplement them.\n\n>>> d.sqrt()\nDecimal(\"351364.1828820134592177245001\")\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The Context type,  Prev: The Decimal type,  Up: PEP 327 Decimal Data Type": {
            "content": "1.17.8.3 The 'Context' type\n...........................\n",
            "subsections": []
        },
        "Instances of the 'Context' class encapsulate several settings for": {
            "content": "decimal operations:\n\n* 'prec' is the precision, the number of decimal places.\n\n* 'rounding' specifies the rounding mode.  The *note decimal: 33.\nmodule has constants for the various possibilities: 'ROUNDDOWN',\n'ROUNDCEILING', 'ROUNDHALFEVEN', and various others.\n\n* 'traps' is a dictionary specifying what happens on encountering\ncertain error conditions: either an exception is raised or a value\nis returned.  Some examples of error conditions are division by\nzero, loss of precision, and overflow.\n",
            "subsections": []
        },
        "There's a thread-local default context available by calling": {
            "content": "'getcontext()'; you can change the properties of this context to alter\nthe default precision, rounding, or trap handling.  The following\nexample shows the effect of changing the precision of the default\ncontext:\n\n>>> decimal.getcontext().prec\n28\n>>> decimal.Decimal(1) / decimal.Decimal(7)\nDecimal(\"0.1428571428571428571428571429\")\n>>> decimal.getcontext().prec = 9\n>>> decimal.Decimal(1) / decimal.Decimal(7)\nDecimal(\"0.142857143\")\n",
            "subsections": []
        },
        "The default action for error conditions is selectable; the module can": {
            "content": "either return a special value such as infinity or not-a-number, or\nexceptions can be raised:\n\n>>> decimal.Decimal(1) / decimal.Decimal(0)\nTraceback (most recent call last):\n...\ndecimal.DivisionByZero: x / 0\n>>> decimal.getcontext().traps[decimal.DivisionByZero] = False\n>>> decimal.Decimal(1) / decimal.Decimal(0)\nDecimal(\"Infinity\")\n>>>\n",
            "subsections": []
        },
        "The 'Context' instance also has various methods for formatting numbers": {
            "content": "such as 'toengstring()' and 'toscistring()'.\n\nFor more information, see the documentation for the *note decimal: 33.\nmodule, which includes a quick-start tutorial and a reference.\n\nSee also\n........\n\nPEP 327(1) - Decimal Data Type\n\nWritten by Facundo Batista and implemented by Facundo Batista, Eric\nPrice, Raymond Hettinger, Aahz, and Tim Peters.\n\n'http://www.lahey.com/float.htm'\n\nThe article uses Fortran code to illustrate many of the problems\nthat floating-point inaccuracy can cause.\n\n'http://speleotrove.com/decimal/'\n\nA description of a decimal-based representation.  This\nrepresentation is being proposed as a standard, and underlies the\nnew Python decimal type.  Much of this material was written by Mike\nCowlishaw, designer of the Rexx language.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0327/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "One language change is a small syntactic tweak aimed at making it easier": {
            "content": "to import many names from a module.  In a 'from module import names'\nstatement, 'names' is a sequence of names separated by commas.  If the\nsequence is very long, you can either write multiple imports from the\nsame module, or you can use backslashes to escape the line endings like\nthis:\n\nfrom SimpleXMLRPCServer import SimpleXMLRPCServer,\\\nSimpleXMLRPCRequestHandler,\\\nCGIXMLRPCRequestHandler,\\\nresolvedottedattribute\n",
            "subsections": []
        },
        "The syntactic change in Python 2.4 simply allows putting the names": {
            "content": "within parentheses.  Python ignores newlines within a parenthesized\nexpression, so the backslashes are no longer needed:\n\nfrom SimpleXMLRPCServer import (SimpleXMLRPCServer,\nSimpleXMLRPCRequestHandler,\nCGIXMLRPCRequestHandler,\nresolvedottedattribute)\n\nThe PEP also proposes that all *note import: 3a6. statements be absolute\nimports, with a leading '.' character to indicate a relative import.",
            "subsections": []
        },
        "This part of the PEP was not implemented for Python 2.4, but was": {
            "content": "completed for Python 2.5.\n\nSee also\n........\n\nPEP 328(1) - Imports: Multi-Line and Absolute/Relative\n\nWritten by Aahz.  Multi-line imports were implemented by Dima\nDorfman.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0328/\n\nFile: python3.12.info,  Node: PEP 331 Locale-Independent Float/String Conversions,  Next: Other Language Changes<16>,  Prev: PEP 328 Multi-line Imports,  Up: What's New in Python 2 4\n\n\nThe *note locale: 81. modules lets Python software select various\nconversions and display conventions that are localized to a particular\ncountry or language.  However, the module was careful to not change the\nnumeric locale because various functions in Python's implementation\nrequired that the numeric locale remain set to the ''C'' locale.  Often\nthis was because the code was using the C library's 'atof()' function.\n",
            "subsections": []
        },
        "Not setting the numeric locale caused trouble for extensions that used": {
            "content": "third-party C libraries, however, because they wouldn't have the correct\nlocale set.  The motivating example was GTK+, whose user interface\nwidgets weren't displaying numbers in the current locale.\n",
            "subsections": []
        },
        "The solution described in the PEP is to add three new functions to the": {
            "content": "",
            "subsections": []
        },
        "Python API that perform ASCII-only conversions, ignoring the locale": {
            "content": "setting:\n\n* 'PyOSasciistrtod(str, ptr)' and 'PyOSasciiatof(str, ptr)' both\nconvert a string to a C double.\n\n* 'PyOSasciiformatd(buffer, buflen, format, d)' converts a double\nto an ASCII string.\n",
            "subsections": []
        },
        "The code for these functions came from the GLib library": {
            "content": "('https://developer-old.gnome.org/glib/2.26/'), whose developers kindly\nrelicensed the relevant functions and donated them to the Python\nSoftware Foundation.  The *note locale: 81. module can now change the\nnumeric locale, letting extensions such as GTK+ produce the correct\nresults.\n\nSee also\n........\n\nPEP 331(1) - Locale-Independent Float/String Conversions\n\nWritten by Christian R. Reis, and implemented by Gustavo Carneiro.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0331/\n\nFile: python3.12.info,  Node: Other Language Changes<16>,  Next: New Improved and Deprecated Modules<3>,  Prev: PEP 331 Locale-Independent Float/String Conversions,  Up: What's New in Python 2 4\n\n",
            "subsections": []
        },
        "Here are all of the changes that Python 2.4 makes to the core Python": {
            "content": "language.\n\n* Decorators for functions and methods were added ( PEP 318(1)).\n\n* Built-in *note set(): 39d. and *note frozenset(): 39e. types were\nadded ( PEP 218(2)).  Other new built-ins include the\n'reversed(seq)' function ( PEP 322(3)).\n\n* Generator expressions were added ( PEP 289(4)).\n\n* Certain numeric expressions no longer return values restricted to\n32 or 64 bits ( PEP 237(5)).\n\n* You can now put parentheses around the list of names in a 'from\nmodule import names' statement ( PEP 328(6)).\n\n* The *note dict.update(): 12ba. method now accepts the same argument\nforms as the *note dict: 237. constructor.  This includes any\nmapping, any iterable of key/value pairs, and keyword arguments.\n(Contributed by Raymond Hettinger.)\n\n* The string methods 'ljust()', 'rjust()', and 'center()' now take an\noptional argument for specifying a fill character other than a\nspace.  (Contributed by Raymond Hettinger.)\n\n* Strings also gained an 'rsplit()' method that works like the\n'split()' method but splits from the end of the string.\n(Contributed by Sean Reifschneider.)\n\n>>> 'www.python.org'.split('.', 1)\n['www', 'python.org']\n'www.python.org'.rsplit('.', 1)\n['www.python', 'org']\n\n* Three keyword parameters, 'cmp', 'key', and 'reverse', were added\nto the 'sort()' method of lists.  These parameters make some common\nusages of 'sort()' simpler.  All of these parameters are optional.\n\nFor the 'cmp' parameter, the value should be a comparison function\nthat takes two parameters and returns -1, 0, or +1 depending on how\nthe parameters compare.  This function will then be used to sort\nthe list.  Previously this was the only parameter that could be\nprovided to 'sort()'.\n\n'key' should be a single-parameter function that takes a list\nelement and returns a comparison key for the element.  The list is\nthen sorted using the comparison keys.  The following example sorts\na list case-insensitively:\n\n>>> L = ['A', 'b', 'c', 'D']\n>>> L.sort()                 # Case-sensitive sort\n>>> L\n['A', 'D', 'b', 'c']\n>>> # Using 'key' parameter to sort list\n>>> L.sort(key=lambda x: x.lower())\n>>> L\n['A', 'b', 'c', 'D']\n>>> # Old-fashioned way\n>>> L.sort(cmp=lambda x,y: cmp(x.lower(), y.lower()))\n>>> L\n['A', 'b', 'c', 'D']\n\nThe last example, which uses the 'cmp' parameter, is the old way to\nperform a case-insensitive sort.  It works but is slower than using\na 'key' parameter.  Using 'key' calls 'lower()' method once for\neach element in the list while using 'cmp' will call it twice for\neach comparison, so using 'key' saves on invocations of the\n'lower()' method.\n\nFor simple key functions and comparison functions, it is often\npossible to avoid a *note lambda: 1115. expression by using an\nunbound method instead.  For example, the above case-insensitive\nsort is best written as:\n\n>>> L.sort(key=str.lower)\n>>> L\n['A', 'b', 'c', 'D']\n\nFinally, the 'reverse' parameter takes a Boolean value.  If the\nvalue is true, the list will be sorted into reverse order.  Instead\nof 'L.sort(); L.reverse()', you can now write\n'L.sort(reverse=True)'.\n\nThe results of sorting are now guaranteed to be stable.  This means\nthat two entries with equal keys will be returned in the same order\nas they were input.  For example, you can sort a list of people by\nname, and then sort the list by age, resulting in a list sorted by\nage where people with the same age are in name-sorted order.\n\n(All changes to 'sort()' contributed by Raymond Hettinger.)\n\n* There is a new built-in function 'sorted(iterable)' that works like\nthe in-place *note list.sort(): a13. method but can be used in\nexpressions.  The differences are:\n\n* the input may be any iterable;\n\n* a newly formed copy is sorted, leaving the original intact; and\n\n* the expression returns the new sorted copy\n\n>>> L = [9,7,8,3,2,4,1,6,5]\n>>> [10+i for i in sorted(L)]       # usable in a list comprehension\n[11, 12, 13, 14, 15, 16, 17, 18, 19]\n>>> L                               # original is left unchanged\n[9,7,8,3,2,4,1,6,5]\n>>> sorted('Monty Python')          # any iterable may be an input\n[' ', 'M', 'P', 'h', 'n', 'n', 'o', 'o', 't', 't', 'y', 'y']\n\n>>> # List the contents of a dict sorted by key values\n>>> colormap = dict(red=1, blue=2, green=3, black=4, yellow=5)\n>>> for k, v in sorted(colormap.iteritems()):\n...     print k, v\n...\nblack 4\nblue 2\ngreen 3\nred 1\nyellow 5\n\n(Contributed by Raymond Hettinger.)\n\n* Integer operations will no longer trigger an 'OverflowWarning'.\nThe 'OverflowWarning' warning will disappear in Python 2.5.\n\n* The interpreter gained a new switch, *note -m: 3a5, that takes a\nname, searches for the corresponding module on 'sys.path', and runs\nthe module as a script.  For example, you can now run the Python\nprofiler with 'python -m profile'.  (Contributed by Nick Coghlan.)\n\n* The 'eval(expr, globals, locals)' and 'execfile(filename, globals,\nlocals)' functions and the 'exec' statement now accept any mapping\ntype for the 'locals' parameter.  Previously this had to be a\nregular Python dictionary.  (Contributed by Raymond Hettinger.)\n\n* The *note zip(): 5c2. built-in function and 'itertools.izip()' now\nreturn an empty list if called with no arguments.  Previously they\nraised a *note TypeError: 28e. exception.  This makes them more\nsuitable for use with variable length argument lists:\n\n>>> def transpose(array):\n...    return zip(*array)\n...\n>>> transpose([(1,2,3), (4,5,6)])\n[(1, 4), (2, 5), (3, 6)]\n>>> transpose([])\n[]\n\n(Contributed by Raymond Hettinger.)\n\n* Encountering a failure while importing a module no longer leaves a\npartially initialized module object in 'sys.modules'.  The\nincomplete module object left behind would fool further imports of\nthe same module into succeeding, leading to confusing errors.\n(Fixed by Tim Peters.)\n\n* *note None: 43f. is now a constant; code that binds a new value to\nthe name 'None' is now a syntax error.  (Contributed by Raymond\nHettinger.)\n\n* Menu:\n\n* Optimizations: Optimizations<15>.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0318/\n\n(2) https://peps.python.org/pep-0218/\n\n(3) https://peps.python.org/pep-0322/\n\n(4) https://peps.python.org/pep-0289/\n\n(5) https://peps.python.org/pep-0237/\n\n(6) https://peps.python.org/pep-0328/\n\nFile: python3.12.info,  Node: Optimizations<15>,  Up: Other Language Changes<16>\n\n1.17.11.1 Optimizations\n.......................\n\n* The inner loops for list and tuple slicing were optimized and now\nrun about one-third faster.  The inner loops for dictionaries were\nalso optimized, resulting in performance boosts for 'keys()',\n'values()', 'items()', 'iterkeys()', 'itervalues()', and\n'iteritems()'.  (Contributed by Raymond Hettinger.)\n\n* The machinery for growing and shrinking lists was optimized for\nspeed and for space efficiency.  Appending and popping from lists\nnow runs faster due to more efficient code paths and less frequent\nuse of the underlying system 'realloc()'.  List comprehensions also\nbenefit.  'list.extend()' was also optimized and no longer converts\nits argument into a temporary list before extending the base list.\n(Contributed by Raymond Hettinger.)\n\n* *note list(): 3dc, *note tuple(): 4b8, *note map(): 65f, *note\nfilter(): 660, and *note zip(): 5c2. now run several times faster\nwith non-sequence arguments that supply a 'len()' method.\n(Contributed by Raymond Hettinger.)\n\n* The methods 'list.getitem()', 'dict.getitem()', and\n'dict.contains()' are now implemented as 'methoddescriptor'\nobjects rather than 'wrapperdescriptor' objects.  This form of\naccess doubles their performance and makes them more suitable for\nuse as arguments to functionals: 'map(mydict.getitem,\nkeylist)'.  (Contributed by Raymond Hettinger.)\n\n* Added a new opcode, 'LISTAPPEND', that simplifies the generated\nbytecode for list comprehensions and speeds them up by about a\nthird.  (Contributed by Raymond Hettinger.)\n\n* The peephole bytecode optimizer has been improved to produce\nshorter, faster bytecode; remarkably, the resulting bytecode is\nmore readable.  (Enhanced by Raymond Hettinger.)\n\n* String concatenations in statements of the form 's = s + \"abc\"' and\n's += \"abc\"' are now performed more efficiently in certain\ncircumstances.  This optimization won't be present in other Python\nimplementations such as Jython, so you shouldn't rely on it; using\nthe 'join()' method of strings is still recommended when you want\nto efficiently glue a large number of strings together.\n(Contributed by Armin Rigo.)\n",
            "subsections": []
        },
        "The net result of the 2.4 optimizations is that Python 2.4 runs the": {
            "content": "pystone benchmark around 5% faster than Python 2.3 and 35% faster than",
            "subsections": []
        },
        "Python 2.2.  (pystone is not a particularly good benchmark, but it's the": {
            "content": "most commonly used measurement of Python's performance.  Your own\napplications may show greater or smaller benefits from Python 2.4.)\n\nFile: python3.12.info,  Node: New Improved and Deprecated Modules<3>,  Next: Build and C API Changes<11>,  Prev: Other Language Changes<16>,  Up: What's New in Python 2 4\n\n",
            "subsections": []
        },
        "As usual, Python's standard library received a number of enhancements": {
            "content": "and bug fixes.  Here's a partial list of the most notable changes,\nsorted alphabetically by module name.  Consult the 'Misc/NEWS' file in\nthe source tree for a more complete list of changes, or look through the\nCVS logs for all the details.\n\n* The *note array: 7. module now supports arrays of Unicode\ncharacters using the ''u'' format character.  Arrays also now\nsupport using the '+=' assignment operator to add another array's\ncontents, and the '*=' assignment operator to repeat an array.\n(Contributed by Jason Orendorff.)\n\n* The 'bsddb' module has been replaced by version 4.1.6 of the\nPyBSDDB(1) package, providing a more complete interface to the\ntransactional features of the BerkeleyDB library.\n\nThe old version of the module has been renamed to 'bsddb185' and is\nno longer built automatically; you'll have to edit 'Modules/Setup'\nto enable it.  Note that the new 'bsddb' package is intended to be\ncompatible with the old module, so be sure to file bugs if you\ndiscover any incompatibilities.  When upgrading to Python 2.3, if\nthe new interpreter is compiled with a new version of the\nunderlying BerkeleyDB library, you will almost certainly have to\nconvert your database files to the new version.  You can do this\nfairly easily with the new scripts 'db2pickle.py' and\n'pickle2db.py' which you will find in the distribution's\n'Tools/scripts' directory.  If you've already been using the\nPyBSDDB package and importing it as 'bsddb3', you will have to\nchange your 'import' statements to import it as 'bsddb'.\n\n* The new *note bz2: 11. module is an interface to the bz2 data\ncompression library.  bz2-compressed data is usually smaller than\ncorresponding *note zlib: 12d.-compressed data.  (Contributed by\nGustavo Niemeyer.)\n\n* A set of standard date/time types has been added in the new *note\ndatetime: 2e. module.  See the following section for more details.\n\n* The Distutils 'Extension' class now supports an extra constructor\nargument named 'depends' for listing additional source files that\nan extension depends on.  This lets Distutils recompile the module\nif any of the dependency files are modified.  For example, if\n'sampmodule.c' includes the header file 'sample.h', you would\ncreate the 'Extension' object like this:\n\next = Extension(\"samp\",\nsources=[\"sampmodule.c\"],\ndepends=[\"sample.h\"])\n\nModifying 'sample.h' would then cause the module to be recompiled.\n(Contributed by Jeremy Hylton.)\n\n* Other minor changes to Distutils: it now checks for the *note CC:\n130d, *note CFLAGS: 130e, 'CPP', *note LDFLAGS: 130f, and *note\nCPPFLAGS: 1310. environment variables, using them to override the\nsettings in Python's configuration (contributed by Robert Weber).\n\n* Previously the *note doctest: 36. module would only search the\ndocstrings of public methods and functions for test cases, but it\nnow also examines private ones as well.  The *note DocTestSuite():\nc50. function creates a *note unittest.TestSuite: c51. object from\na set of *note doctest: 36. tests.\n\n* The new 'gc.getreferents(object)' function returns a list of all\nthe objects referenced by 'object'.\n\n* The *note getopt: 5c. module gained a new function, *note\ngnugetopt(): 1311, that supports the same arguments as the\nexisting *note getopt(): 1312. function but uses GNU-style scanning\nmode.  The existing *note getopt(): 1312. stops processing options\nas soon as a non-option argument is encountered, but in GNU-style\nmode processing continues, meaning that options and arguments can\nbe mixed.  For example:\n\n>>> getopt.getopt(['-f', 'filename', 'output', '-v'], 'f:v')\n([('-f', 'filename')], ['output', '-v'])\n>>> getopt.gnugetopt(['-f', 'filename', 'output', '-v'], 'f:v')\n([('-f', 'filename'), ('-v', '')], ['output'])\n\n(Contributed by Peter ??strand.)\n\n* The *note grp: 61, *note pwd: ad, and *note resource: b7. modules\nnow return enhanced tuples:\n\n>>> import grp\n>>> g = grp.getgrnam('amk')\n>>> g.grname, g.grgid\n('amk', 500)\n\n* The *note gzip: 62. module can now handle files exceeding 2 GiB.\n\n* The new *note heapq: 64. module contains an implementation of a\nheap queue algorithm.  A heap is an array-like data structure that\nkeeps items in a partially sorted order such that, for every index\n'k', 'heap[k] <= heap[2*k+1]' and 'heap[k] <= heap[2*k+2]'.  This\nmakes it quick to remove the smallest item, and inserting a new\nitem while maintaining the heap property is 'O'(log 'n').  (See\n'https://xlinux.nist.gov/dads//HTML/priorityque.html' for more\ninformation about the priority queue data structure.)\n\nThe *note heapq: 64. module provides *note heappush(): 1313. and\n*note heappop(): 1314. functions for adding and removing items\nwhile maintaining the heap property on top of some other mutable\nPython sequence type.  Here's an example that uses a Python list:\n\n>>> import heapq\n>>> heap = []\n>>> for item in [3, 7, 5, 11, 1]:\n...    heapq.heappush(heap, item)\n...\n>>> heap\n[1, 3, 5, 11, 7]\n>>> heapq.heappop(heap)\n1\n>>> heapq.heappop(heap)\n3\n>>> heap\n[5, 7, 11]\n\n(Contributed by Kevin O'Connor.)\n\n* The IDLE integrated development environment has been updated using\nthe code from the IDLEfork project\n('https://idlefork.sourceforge.net').  The most notable feature is\nthat the code being developed is now executed in a subprocess,\nmeaning that there's no longer any need for manual 'reload()'\noperations.  IDLE's core code has been incorporated into the\nstandard library as the *note idlelib: 6e. package.\n\n* The *note imaplib: 6f. module now supports IMAP over SSL.\n(Contributed by Piers Lauder and Tino Lange.)\n\n* The *note itertools: 7b. contains a number of useful functions for\nuse with iterators, inspired by various functions provided by the\nML and Haskell languages.  For example,\n'itertools.ifilter(predicate, iterator)' returns all elements in\nthe iterator for which the function 'predicate()' returns *note\nTrue: a53, and 'itertools.repeat(obj, N)' returns 'obj' 'N' times.\nThere are a number of other functions in the module; see the\npackage's reference documentation for details.  (Contributed by\nRaymond Hettinger.)\n\n* Two new functions in the *note math: 89. module, 'degrees(rads)'\nand 'radians(degs)', convert between radians and degrees.  Other\nfunctions in the *note math: 89. module such as *note math.sin():\n1315. and *note math.cos(): 1316. have always required input values\nmeasured in radians.  Also, an optional 'base' argument was added\nto *note math.log(): 1317. to make it easier to compute logarithms\nfor bases other than 'e' and '10'.  (Contributed by Raymond\nHettinger.)\n\n* Several new POSIX functions ('getpgid()', 'killpg()', 'lchown()',\n'loadavg()', 'major()', 'makedev()', 'minor()', and 'mknod()') were\nadded to the *note posix: a8. module that underlies the *note os:\n9c. module.  (Contributed by Gustavo Niemeyer, Geert Jansen, and\nDenis S. Otkidach.)\n\n* In the *note os: 9c. module, the '*stat()' family of functions can\nnow report fractions of a second in a timestamp.  Such time stamps\nare represented as floats, similar to the value returned by *note\ntime.time(): 918.\n\nDuring testing, it was found that some applications will break if\ntime stamps are floats.  For compatibility, when using the tuple\ninterface of the *note statresult: 1318. time stamps will be\nrepresented as integers.  When using named fields (a feature first\nintroduced in Python 2.2), time stamps are still represented as\nintegers, unless 'os.statfloattimes()' is invoked to enable float\nreturn values:\n\n>>> os.stat(\"/tmp\").stmtime\n1034791200\n>>> os.statfloattimes(True)\n>>> os.stat(\"/tmp\").stmtime\n1034791200.6335014\n\nIn Python 2.4, the default will change to always returning floats.\n\nApplication developers should enable this feature only if all their\nlibraries work properly when confronted with floating point time\nstamps, or if they use the tuple API. If used, the feature should\nbe activated on an application level instead of trying to enable it\non a per-use basis.\n\n* The *note optparse: 9b. module contains a new parser for\ncommand-line arguments that can convert option values to a\nparticular Python type and will automatically generate a usage\nmessage.  See the following section for more details.\n\n* The old and never-documented 'linuxaudiodev' module has been\ndeprecated, and a new version named *note ossaudiodev: 9e. has been\nadded.  The module was renamed because the OSS sound drivers can be\nused on platforms other than Linux, and the interface has also been\ntidied and brought up to date in various ways.  (Contributed by\nGreg Ward and Nicholas FitzRoy-Dale.)\n\n* The new *note platform: a5. module contains a number of functions\nthat try to determine various properties of the platform you're\nrunning on.  There are functions for getting the architecture, CPU\ntype, the Windows OS version, and even the Linux distribution\nversion.  (Contributed by Marc-Andre' Lemburg.)\n\n* The parser objects provided by the *note pyexpat: 121. module can\nnow optionally buffer character data, resulting in fewer calls to\nyour character data handler and therefore faster performance.\nSetting the parser object's *note buffertext: 1319. attribute to\n*note True: a53. will enable buffering.\n\n* The 'sample(population, k)' function was added to the *note random:\nb3. module.  'population' is a sequence or 'xrange' object\ncontaining the elements of a population, and *note sample(): 52d.\nchooses 'k' elements from the population without replacing chosen\nelements.  'k' can be any value up to 'len(population)'.  For\nexample:\n\n>>> days = ['Mo', 'Tu', 'We', 'Th', 'Fr', 'St', 'Sn']\n>>> random.sample(days, 3)      # Choose 3 elements\n['St', 'Sn', 'Th']\n>>> random.sample(days, 7)      # Choose 7 elements\n['Tu', 'Th', 'Mo', 'We', 'St', 'Fr', 'Sn']\n>>> random.sample(days, 7)      # Choose 7 again\n['We', 'Mo', 'Sn', 'Fr', 'Tu', 'St', 'Th']\n>>> random.sample(days, 8)      # Can't choose eight\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in ?\nFile \"random.py\", line 414, in sample\nraise ValueError, \"sample larger than population\"\nValueError: sample larger than population\n>>> random.sample(xrange(1,10000,2), 10)   # Choose ten odd nos. under 10000\n[3407, 3805, 1505, 7023, 2401, 2267, 9733, 3151, 8083, 9195]\n\nThe *note random: b3. module now uses a new algorithm, the Mersenne\nTwister, implemented in C. It's faster and more extensively studied\nthan the previous algorithm.\n\n(All changes contributed by Raymond Hettinger.)\n\n* The *note readline: b5. module also gained a number of new\nfunctions: *note gethistoryitem(): 131a, *note\ngetcurrenthistorylength(): 131b, and *note redisplay(): 131c.\n\n* The 'rexec' and 'Bastion' modules have been declared dead, and\nattempts to import them will fail with a *note RuntimeError: 17a.\nNew-style classes provide new ways to break out of the restricted\nexecution environment provided by 'rexec', and no one has interest\nin fixing them or time to do so.  If you have applications using\n'rexec', rewrite them to use something else.\n\n(Sticking with Python 2.2 or 2.1 will not make your applications\nany safer because there are known bugs in the 'rexec' module in\nthose versions.  To repeat: if you're using 'rexec', stop using it\nimmediately.)\n\n* The 'rotor' module has been deprecated because the algorithm it\nuses for encryption is not believed to be secure.  If you need\nencryption, use one of the several AES Python modules that are\navailable separately.\n\n* The *note shutil: c0. module gained a 'move(src, dest)' function\nthat recursively moves a file or directory to a new location.\n\n* Support for more advanced POSIX signal handling was added to the\n*note signal: c1. but then removed again as it proved impossible to\nmake it work reliably across platforms.\n\n* The *note socket: c6. module now supports timeouts.  You can call\nthe 'settimeout(t)' method on a socket object to set a timeout of\n't' seconds.  Subsequent socket operations that take longer than\n't' seconds to complete will abort and raise a *note\nsocket.timeout: 629. exception.\n\nThe original timeout implementation was by Tim O'Malley.  Michael\nGilfix integrated it into the Python *note socket: c6. module and\nshepherded it through a lengthy review.  After the code was checked\nin, Guido van Rossum rewrote parts of it.  (This is a good example\nof a collaborative development process in action.)\n\n* On Windows, the *note socket: c6. module now ships with Secure\nSockets Layer (SSL) support.\n\n* The value of the C 'PYTHONAPIVERSION' macro is now exposed at the\nPython level as 'sys.apiversion'.  The current exception can be\ncleared by calling the new 'sys.excclear()' function.\n\n* The new *note tarfile: d8. module allows reading from and writing\nto 'tar'-format archive files.  (Contributed by Lars Gusta\"bel.)\n\n* The new *note textwrap: e6. module contains functions for wrapping\nstrings containing paragraphs of text.  The 'wrap(text, width)'\nfunction takes a string and returns a list containing the text\nsplit into lines of no more than the chosen width.  The 'fill(text,\nwidth)' function returns a single string, reformatted to fit into\nlines no longer than the chosen width.  (As you can guess, *note\nfill(): 131d. is built on top of *note wrap(): 131e.  For example:\n\n>>> import textwrap\n>>> paragraph = \"Not a whit, we defy augury: ... more text ...\"\n>>> textwrap.wrap(paragraph, 60)\n[\"Not a whit, we defy augury: there's a special providence in\",\n\"the fall of a sparrow. If it be now, 'tis not to come; if it\",\n...]\n>>> print textwrap.fill(paragraph, 35)\nNot a whit, we defy augury: there's\na special providence in the fall of\na sparrow. If it be now, 'tis not\nto come; if it be not to come, it\nwill be now; if it be not now, yet\nit will come: the readiness is all.\n>>>\n\nThe module also contains a *note TextWrapper: e40. class that\nactually implements the text wrapping strategy.  Both the *note\nTextWrapper: e40. class and the *note wrap(): 131e. and *note\nfill(): 131d. functions support a number of additional keyword\narguments for fine-tuning the formatting; consult the module's\ndocumentation for details.  (Contributed by Greg Ward.)\n\n* The 'thread' and *note threading: e7. modules now have companion\nmodules, 'dummythread' and 'dummythreading', that provide a\ndo-nothing implementation of the 'thread' module's interface for\nplatforms where threads are not supported.  The intention is to\nsimplify thread-aware modules (ones that 'don't' rely on threads to\nrun) by putting the following code at the top:\n\ntry:\nimport threading as threading\nexcept ImportError:\nimport dummythreading as threading\n\nIn this example, 'threading' is used as the module name to make it\nclear that the module being used is not necessarily the actual\n*note threading: e7. module.  Code can call functions and use\nclasses in 'threading' whether or not threads are supported,\navoiding an *note if: 24f. statement and making the code slightly\nclearer.  This module will not magically make multithreaded code\nrun without threads; code that waits for another thread to return\nor to do something will simply hang forever.\n\n* The *note time: e8. module's *note strptime(): 1283. function has\nlong been an annoyance because it uses the platform C library's\n*note strptime(): 1283. implementation, and different platforms\nsometimes have odd bugs.  Brett Cannon contributed a portable\nimplementation that's written in pure Python and should behave\nidentically on all platforms.\n\n* The new *note timeit: e9. module helps measure how long snippets of\nPython code take to execute.  The 'timeit.py' file can be run\ndirectly from the command line, or the module's *note Timer: 131f.\nclass can be imported and used directly.  Here's a short example\nthat figures out whether it's faster to convert an 8-bit string to\nUnicode by appending an empty Unicode string to it or by using the\n'unicode()' function:\n\nimport timeit\n\ntimer1 = timeit.Timer('unicode(\"abc\")')\ntimer2 = timeit.Timer('\"abc\" + u\"\"')\n\n# Run three trials\nprint timer1.repeat(repeat=3, number=100000)\nprint timer2.repeat(repeat=3, number=100000)\n\n# On my laptop this outputs:\n# [0.36831796169281006, 0.37441694736480713, 0.35304892063140869]\n# [0.17574405670166016, 0.18193507194519043, 0.17565798759460449]\n\n* The 'Tix' module has received various bug fixes and updates for the\ncurrent version of the Tix package.\n\n* The 'Tkinter' module now works with a thread-enabled version of\nTcl.  Tcl's threading model requires that widgets only be accessed\nfrom the thread in which they're created; accesses from another\nthread can cause Tcl to panic.  For certain Tcl interfaces,\n'Tkinter' will now automatically avoid this when a widget is\naccessed from a different thread by marshalling a command, passing\nit to the correct thread, and waiting for the results.  Other\ninterfaces can't be handled automatically but 'Tkinter' will now\nraise an exception on such an access so that you can at least find\nout about the problem.  See\n'https://mail.python.org/pipermail/python-dev/2002-December/031107.html'\nfor a more detailed explanation of this change.  (Implemented by\nMartin von Lo\"wis.)\n\n* Calling Tcl methods through 'tkinter' no longer returns only\nstrings.  Instead, if Tcl returns other objects those objects are\nconverted to their Python equivalent, if one exists, or wrapped\nwith a 'tkinter.TclObj' object if no Python equivalent exists.\nThis behavior can be controlled through the 'wantobjects()' method\nof 'tkapp' objects.\n\nWhen using 'tkinter' through the 'Tkinter' module (as most Tkinter\napplications will), this feature is always activated.  It should\nnot cause compatibility problems, since Tkinter would always\nconvert string results to Python types where possible.\n\nIf any incompatibilities are found, the old behavior can be\nrestored by setting the 'wantobjects' variable in the 'Tkinter'\nmodule to false before creating the first 'tkapp' object.\n\nimport Tkinter\nTkinter.wantobjects = 0\n\nAny breakage caused by this change should be reported as a bug.\n\n* The 'UserDict' module has a new 'DictMixin' class which defines all\ndictionary methods for classes that already have a minimum mapping\ninterface.  This greatly simplifies writing classes that need to be\nsubstitutable for dictionaries, such as the classes in the *note\nshelve: be. module.\n\nAdding the mix-in as a superclass provides the full dictionary\ninterface whenever the class defines *note getitem(): 4b9,\n*note setitem(): 1320, *note delitem(): 1321, and 'keys()'.\nFor example:\n\n>>> import UserDict\n>>> class SeqDict(UserDict.DictMixin):\n...     \"\"\"Dictionary lookalike implemented with lists.\"\"\"\n...     def init(self):\n...         self.keylist = []\n...         self.valuelist = []\n...     def getitem(self, key):\n...         try:\n...             i = self.keylist.index(key)\n...         except ValueError:\n...             raise KeyError\n...         return self.valuelist[i]\n...     def setitem(self, key, value):\n...         try:\n...             i = self.keylist.index(key)\n...             self.valuelist[i] = value\n...         except ValueError:\n...             self.keylist.append(key)\n...             self.valuelist.append(value)\n...     def delitem(self, key):\n...         try:\n...             i = self.keylist.index(key)\n...         except ValueError:\n...             raise KeyError\n...         self.keylist.pop(i)\n...         self.valuelist.pop(i)\n...     def keys(self):\n...         return list(self.keylist)\n...\n>>> s = SeqDict()\n>>> dir(s)      # See that other dictionary methods are implemented\n['cmp', 'contains', 'delitem', 'doc', 'getitem',\n'init', 'iter', 'len', 'module', 'repr',\n'setitem', 'clear', 'get', 'haskey', 'items', 'iteritems',\n'iterkeys', 'itervalues', 'keylist', 'keys', 'pop', 'popitem',\n'setdefault', 'update', 'valuelist', 'values']\n\n(Contributed by Raymond Hettinger.)\n\n* The DOM implementation in *note xml.dom.minidom: 11d. can now\ngenerate XML output in a particular encoding by providing an\noptional encoding argument to the *note toxml(): 1322. and *note\ntoprettyxml(): 1323. methods of DOM nodes.\n\n* The 'xmlrpclib' module now supports an XML-RPC extension for\nhandling nil data values such as Python's 'None'.  Nil values are\nalways supported on unmarshalling an XML-RPC response.  To generate\nrequests containing 'None', you must supply a true value for the\n'allownone' parameter when creating a 'Marshaller' instance.\n\n* The new 'DocXMLRPCServer' module allows writing self-documenting\nXML-RPC servers.  Run it in demo mode (as a program) to see it in\naction.  Pointing the web browser to the RPC server produces\npydoc-style documentation; pointing xmlrpclib to the server allows\ninvoking the actual methods.  (Contributed by Brian Quinlan.)\n\n* Support for internationalized domain names (RFCs 3454, 3490, 3491,\nand 3492) has been added.  The \"idna\" encoding can be used to\nconvert between a Unicode domain name and the ASCII-compatible\nencoding (ACE) of that name.\n\n>{}>{}> u\"www.Alliancefranc,aise.nu\".encode(\"idna\")\n'www.xn--alliancefranaise-npb.nu'\n\nThe *note socket: c6. module has also been extended to\ntransparently convert Unicode hostnames to the ACE version before\npassing them to the C library.  Modules that deal with hostnames\nsuch as 'httplib' and *note ftplib: 59.) also support Unicode host\nnames; 'httplib' also sends HTTP 'Host' headers using the ACE\nversion of the domain name.  *note urllib: 103. supports Unicode\nURLs with non-ASCII host names as long as the 'path' part of the\nURL is ASCII only.\n\nTo implement this change, the *note stringprep: ce. module, the\n'mkstringprep' tool and the 'punycode' encoding have been added.\n\n* Menu:\n\n* Date/Time Type::\n* The optparse Module::\n\n---------- Footnotes ----------\n\n(1) https://pybsddb.sourceforge.net\n\nFile: python3.12.info,  Node: Date/Time Type,  Next: The optparse Module,  Up: New Improved and Deprecated Modules<4>\n\n1.18.17.1 Date/Time Type\n........................\n",
            "subsections": []
        },
        "In order to store cookies across sessions, two implementations of cookie": {
            "content": "jars are provided: one that stores cookies in the Netscape format so\napplications can use the Mozilla or Lynx cookie files, and one that\nstores cookies in the same format as the Perl libwww library.\n\n*note urllib2: 106. has been changed to interact with *note cookielib:\n6b.: 'HTTPCookieProcessor' manages a cookie jar that is used when\naccessing URLs.\n\nThis module was contributed by John J. Lee.\n\nFile: python3.12.info,  Node: doctest<4>,  Prev: cookielib,  Up: New Improved and Deprecated Modules<3>\n\n1.17.12.2 doctest\n.................\n\nThe *note doctest: 36. module underwent considerable refactoring thanks\nto Edward Loper and Tim Peters.  Testing can still be as simple as\nrunning *note doctest.testmod(): 12c2, but the refactorings allow\ncustomizing the module's operation in various ways\n",
            "subsections": []
        },
        "The new 'DocTestFinder' class extracts the tests from a given object's": {
            "content": "docstrings:\n\ndef f (x, y):\n\"\"\">>> f(2,2)\n4\n>>> f(3,2)\n6\n\"\"\"\nreturn x*y\n\nfinder = doctest.DocTestFinder()\n\n# Get list of DocTest instances\ntests = finder.find(f)\n",
            "subsections": []
        },
        "The new 'DocTestRunner' class then runs individual tests and can produce": {
            "content": "a summary of the results:\n\nrunner = doctest.DocTestRunner()\nfor t in tests:\ntried, failed = runner.run(t)\n\nrunner.summarize(verbose=1)\n\nThe above example produces the following output:\n\n1 items passed all tests:\n2 tests in f\n2 tests in 1 items.\n2 passed and 0 failed.\nTest passed.\n\n'DocTestRunner' uses an instance of the 'OutputChecker' class to compare\nthe expected output with the actual output.  This class takes a number\nof different flags that customize its behaviour; ambitious users can\nalso write a completely new subclass of 'OutputChecker'.\n",
            "subsections": []
        },
        "The default output checker provides a number of handy features.  For": {
            "content": "example, with the *note doctest.ELLIPSIS: 12c3. option flag, an ellipsis\n('...') in the expected output matches any substring, making it easier\nto accommodate outputs that vary in minor ways:\n\ndef o (n):\n\"\"\">>> o(1)\n<main.C instance at 0x...>\n>>>\n\"\"\"\n\nAnother special string, '<BLANKLINE>', matches a blank line:\n\ndef p (n):\n\"\"\">>> p(1)\n<BLANKLINE>\n>>>\n\"\"\"\n",
            "subsections": []
        },
        "Another new capability is producing a diff-style display of the output": {
            "content": "by specifying the *note doctest.REPORTUDIFF: 12c4. (unified diffs),\n*note doctest.REPORTCDIFF: 12c5. (context diffs), or *note\ndoctest.REPORTNDIFF: 12c6. (delta-style) option flags.  For example:\n\ndef g (n):\n\"\"\">>> g(4)\nhere\nis\na\nlengthy\n>>>\"\"\"\nL = 'here is a rather lengthy list of words'.split()\nfor word in L[:n]:\nprint word\n\nRunning the above function's tests with *note doctest.REPORTUDIFF:\n12c4. specified, you get the following output:\n\n\nFile \"t.py\", line 15, in g\nFailed example:\ng(4)\nDifferences (unified diff with -expected +actual):\n@@ -2,3 +2,3 @@\nis\na\n-lengthy",
            "subsections": []
        },
        "+rather": {
            "content": "File: python3.12.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\n\n\nSome of the changes to Python's build process and to the C API are:\n\n* Three new convenience macros were added for common return values\nfrom extension functions: *note PyRETURNNONE: 12c8, *note\nPyRETURNTRUE: 12c9, and *note PyRETURNFALSE: 12ca.\n(Contributed by Brett Cannon.)\n\n* Another new macro, *note PyCLEAR: 2da, decreases the reference\ncount of 'obj' and sets 'obj' to the null pointer.  (Contributed by\nJim Fulton.)\n\n* A new function, 'PyTuplePack(N, obj1, obj2, ..., objN)',\nconstructs tuples from a variable length argument list of Python\nobjects.  (Contributed by Raymond Hettinger.)\n\n* A new function, 'PyDictContains(d, k)', implements fast dictionary\nlookups without masking exceptions raised during the look-up\nprocess.  (Contributed by Raymond Hettinger.)\n\n* The PyISNAN(X) macro returns 1 if its float or double argument\n'X' is a NaN. (Contributed by Tim Peters.)\n\n* C code can avoid unnecessary locking by using the new\n'PyEvalThreadsInitialized()' function to tell if any thread\noperations have been performed.  If this function returns false, no\nlock operations are needed.  (Contributed by Nick Coghlan.)\n\n* A new function, *note PyArgVaParseTupleAndKeywords(): 12cb, is the\nsame as *note PyArgParseTupleAndKeywords(): b68. but takes a\n'valist' instead of a number of arguments.  (Contributed by Greg\nChapman.)\n\n* A new method flag, *note METHCOEXIST: 12cc, allows a function\ndefined in slots to co-exist with a *note PyCFunction: 12cd. having\nthe same name.  This can halve the access time for a method such as\n'set.contains()'.  (Contributed by Raymond Hettinger.)\n\n* Python can now be built with additional profiling for the\ninterpreter itself, intended as an aid to people developing the\nPython core.  Providing '--enable-profiling' to the 'configure'\nscript will let you profile the interpreter with 'gprof', and\nproviding the '--with-tsc' switch enables profiling using the\nPentium's Time-Stamp-Counter register.  Note that the '--with-tsc'\nswitch is slightly misnamed, because the profiling feature also\nworks on the PowerPC platform, though that processor architecture\ndoesn't call that register \"the TSC register\".  (Contributed by\nJeremy Hylton.)\n\n* The 'tracebackobject' type has been renamed to 'PyTracebackObject'.\n\n* Menu:\n\n* Port-Specific Changes: Port-Specific Changes<2>.\n\nFile: python3.12.info,  Node: Port-Specific Changes<2>,  Up: Build and C API Changes<11>\n\n1.17.13.1 Port-Specific Changes\n...............................\n\n* The Windows port now builds under MSVC++ 7.1 as well as version 6.\n(Contributed by Martin von Lo\"wis.)\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "Brian Hurt, Hamish Lawson, Fredrik Lundh, Sean Reifschneider, Sadruddin": {
            "content": "Rejeb.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": [
                {
                    "name": "1.18 What's New in Python 2.3",
                    "content": ""
                }
            ]
        },
        "This article explains the new features in Python 2.3.  Python 2.3 was": {
            "content": "released on July 29, 2003.\n",
            "subsections": []
        },
        "The main themes for Python 2.3 are polishing some of the features added": {
            "content": "in 2.2, adding various small but useful enhancements to the core\nlanguage, and expanding the standard library.  The new object model\nintroduced in the previous version has benefited from 18 months of\nbugfixes and from optimization efforts that have improved the\nperformance of new-style classes.  A few new built-in functions have\nbeen added such as *note sum(): 181. and *note enumerate(): 12d5.  The\n*note in: 250. operator can now be used for substring searches (e.g.\n'\"ab\" in \"abc\"' returns *note True: a53.).\n",
            "subsections": []
        },
        "Some of the many new library features include Boolean, set, heap, and": {
            "content": "date/time data types, the ability to import modules from ZIP-format\narchives, metadata support for the long-awaited Python catalog, an\nupdated version of IDLE, and modules for logging messages, wrapping\ntext, parsing CSV files, processing command-line options, using\nBerkeleyDB databases... the list of new and enhanced modules is lengthy.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: PEP 218 A Standard Set Datatype,  Next: PEP 255 Simple Generators,  Up: What's New in Python 2 3": {
            "content": "",
            "subsections": []
        },
        "The new 'sets' module contains an implementation of a set datatype.  The": {
            "content": "'Set' class is for mutable sets, sets that can have members added and\nremoved.  The 'ImmutableSet' class is for sets that can't be modified,\nand instances of 'ImmutableSet' can therefore be used as dictionary\nkeys.  Sets are built on top of dictionaries, so the elements within a\nset must be hashable.\n\nHere's a simple example:\n\n>>> import sets\n>>> S = sets.Set([1,2,3])\n>>> S\nSet([1, 2, 3])\n>>> 1 in S\nTrue\n>>> 0 in S\nFalse\n>>> S.add(5)\n>>> S.remove(3)\n>>> S\nSet([1, 2, 5])\n>>>\n\nThe union and intersection of sets can be computed with the *note\nunion(): 12d7. and *note intersection(): 12d8. methods; an alternative\nnotation uses the bitwise operators '&' and '|'.  Mutable sets also have\nin-place versions of these methods, 'unionupdate()' and *note\nintersectionupdate(): 12d9.\n\n>>> S1 = sets.Set([1,2,3])\n>>> S2 = sets.Set([4,5,6])\n>>> S1.union(S2)\nSet([1, 2, 3, 4, 5, 6])\n>>> S1 | S2                  # Alternative notation\nSet([1, 2, 3, 4, 5, 6])\n>>> S1.intersection(S2)\nSet([])\n>>> S1 & S2                  # Alternative notation\nSet([])\n>>> S1.unionupdate(S2)\n>>> S1\nSet([1, 2, 3, 4, 5, 6])\n>>>\n",
            "subsections": []
        },
        "It's also possible to take the symmetric difference of two sets.  This": {
            "content": "is the set of all elements in the union that aren't in the intersection.",
            "subsections": []
        },
        "Another way of putting it is that the symmetric difference contains all": {
            "content": "elements that are in exactly one set.  Again, there's an alternative\nnotation ('^'), and an in-place version with the ungainly name *note\nsymmetricdifferenceupdate(): 12da.\n\n>>> S1 = sets.Set([1,2,3,4])\n>>> S2 = sets.Set([3,4,5,6])\n>>> S1.symmetricdifference(S2)\nSet([1, 2, 5, 6])\n>>> S1 ^ S2\nSet([1, 2, 5, 6])\n>>>\n",
            "subsections": []
        },
        "There are also 'issubset()' and 'issuperset()' methods for checking": {
            "content": "whether one set is a subset or superset of another:\n\n>>> S1 = sets.Set([1,2,3])\n>>> S2 = sets.Set([2,3])\n>>> S2.issubset(S1)\nTrue\n>>> S1.issubset(S2)\nFalse\n>>> S1.issuperset(S2)\nTrue\n>>>\n\nSee also\n........\n\nPEP 218(1) - Adding a Built-In Set Object Type\n\nPEP written by Greg V. Wilson.  Implemented by Greg V. Wilson, Alex\nMartelli, and GvR.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0218/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "In Python 2.2, generators were added as an optional feature, to be": {
            "content": "enabled by a 'from future import generators' directive.  In 2.3\ngenerators no longer need to be specially enabled, and are now always\npresent; this means that *note yield: 7f1. is now always a keyword.  The\nrest of this section is a copy of the description of generators from the\n\"What's New in Python 2.2\" document; if you read it back when Python 2.2\ncame out, you can skip the rest of this section.\n\nYou're doubtless familiar with how function calls work in Python or C.",
            "subsections": []
        },
        "When you call a function, it gets a private namespace where its local": {
            "content": "variables are created.  When the function reaches a *note return: 7f2.\nstatement, the local variables are destroyed and the resulting value is\nreturned to the caller.  A later call to the same function will get a\nfresh new set of local variables.  But, what if the local variables\nweren't thrown away on exiting a function?  What if you could later\nresume the function where it left off?  This is what generators provide;\nthey can be thought of as resumable functions.\n\nHere's the simplest example of a generator function:\n\ndef generateints(N):\nfor i in range(N):\nyield i\n\nA new keyword, *note yield: 7f1, was introduced for generators.  Any\nfunction containing a 'yield' statement is a generator function; this is\ndetected by Python's bytecode compiler which compiles the function\nspecially as a result.  Because a new keyword was introduced, generators\nmust be explicitly enabled in a module by including a 'from future\nimport generators' statement near the top of the module's source code.\nIn Python 2.3 this statement will become unnecessary.\n",
            "subsections": []
        },
        "When you call a generator function, it doesn't return a single value;": {
            "content": "instead it returns a generator object that supports the iterator\nprotocol.  On executing the 'yield' expression, the generator outputs\nthe value of 'i', similar to a 'return' statement.  The big difference\nbetween 'yield' and a 'return' statement is that on reaching a 'yield'\nthe generator's state of execution is suspended and local variables are\npreserved.  On the next call to the generator's *note next(): 1a49.\nmethod, the function will resume executing.\n\nHere's a sample usage of the 'generateints()' generator:\n\n>>> gen = generateints(3)\n>>> gen\n<generator object generateints at ...>\n>>> next(gen)\n0\n>>> next(gen)\n1\n>>> next(gen)\n2\n>>> next(gen)\nTraceback (most recent call last):\nFile \"stdin\", line 1, in <module>\nFile \"stdin\", line 2, in generateints\nStopIteration\n\nYou could equally write 'for i in generateints(5)', or 'a, b, c =\ngenerateints(3)'.\n",
            "subsections": []
        },
        "The big difference between 'yield' and a 'return' statement is that on": {
            "content": "reaching a 'yield' the generator's state of execution is suspended and\nlocal variables are preserved.  On the next call to the generator's\n'next()' method, the function will resume executing immediately after\nthe 'yield' statement.  (For complicated reasons, the 'yield' statement\nisn't allowed inside the 'try' block of a *note try: 4bc....*note finally:\n7ee. statement; read PEP 255(1) for a full explanation of the\ninteraction between 'yield' and exceptions.)\n\nHere's a sample usage of the 'generateints()' generator:\n\n>>> gen = generateints(3)\n>>> gen\n<generator object at 0x8117f90>\n>>> gen.next()\n0\n>>> gen.next()\n1\n>>> gen.next()\n2\n>>> gen.next()\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in ?\nFile \"<stdin>\", line 2, in generateints\nStopIteration\n\nYou could equally write 'for i in generateints(5)', or 'a,b,c =\ngenerateints(3)'.\n\nInside a generator function, the *note return: 7f2. statement can only\nbe used without a value, and signals the end of the procession of\nvalues; afterwards the generator cannot return any further values.\n'return' with a value, such as 'return 5', is a syntax error inside a\ngenerator function.  The end of the generator's results can also be\nindicated by raising *note StopIteration: a40. manually, or by just\nletting the flow of execution fall off the bottom of the function.\n",
            "subsections": []
        },
        "You could achieve the effect of generators manually by writing your own": {
            "content": "class and storing all the local variables of the generator as instance\nvariables.  For example, returning a list of integers could be done by\nsetting 'self.count' to 0, and having the *note next(): 1141. method\nincrement 'self.count' and return it.  However, for a moderately\ncomplicated generator, writing a corresponding class can be much\nmessier.\n",
            "subsections": []
        },
        "Two other examples in 'Lib/test/testgenerators.py' produce solutions": {
            "content": "for the N-Queens problem (placing $N$ queens on an $NxN$ chess board so\nthat no queen threatens another) and the Knight's Tour (a route that\ntakes a knight to every square of an $NxN$ chessboard without visiting\nany square twice).\n",
            "subsections": []
        },
        "The idea of generators comes from other programming languages,": {
            "content": "especially Icon ('https://www2.cs.arizona.edu/icon/'), where the idea of\ngenerators is central.  In Icon, every expression and function call\nbehaves like a generator.  One example from \"An Overview of the Icon\nProgramming Language\" at\n'https://www2.cs.arizona.edu/icon/docs/ipd266.htm' gives an idea of what\nthis looks like:\n\nsentence := \"Store it in the neighboring harbor\"\nif (i := find(\"or\", sentence)) > 5 then write(i)\n",
            "subsections": []
        },
        "In Icon the 'find()' function returns the indexes at which the substring": {
            "content": "\"or\" is found: 3, 23, 33.  In the *note if: 24f. statement, 'i' is first\nassigned a value of 3, but 3 is less than 5, so the comparison fails,\nand Icon retries it with the second value of 23.  23 is greater than 5,\nso the comparison now succeeds, and the code prints the value 23 to the\nscreen.\n",
            "subsections": []
        },
        "Python doesn't go nearly as far as Icon in adopting generators as a": {
            "content": "central concept.  Generators are considered a new part of the core",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "Python source files can now be declared as being in different character": {
            "content": "set encodings.  Encodings are declared by including a specially\nformatted comment in the first or second line of the source file.  For\nexample, a UTF-8 file can be declared with:\n\n#!/usr/bin/env python\n# -*- coding: UTF-8 -*-\n",
            "subsections": []
        },
        "Without such an encoding declaration, the default encoding used is 7-bit": {
            "content": "ASCII. Executing or importing modules that contain string literals with\n8-bit characters and have no encoding declaration will result in a *note",
            "subsections": []
        },
        "DeprecationWarning: 179. being signalled by Python 2.3; in 2.4 this will": {
            "content": "be a syntax error.\n",
            "subsections": []
        },
        "The encoding declaration only affects Unicode string literals, which": {
            "content": "will be converted to Unicode using the specified encoding.  Note that",
            "subsections": []
        },
        "Python identifiers are still restricted to ASCII characters, so you": {
            "content": "can't have variable names that use characters outside of the usual\nalphanumerics.\n\nSee also\n........\n\nPEP 263(1) - Defining Python Source Code Encodings\n\nWritten by Marc-Andre' Lemburg and Martin von Lo\"wis; implemented by\nSuzuki Hisao and Martin von Lo\"wis.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0263/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "The new *note zipimport: 12c. module adds support for importing modules\nfrom a ZIP-format archive.  You don't need to import the module\nexplicitly; it will be automatically imported if a ZIP archive's\nfilename is added to 'sys.path'.  For example:\n\namk@nyman:~/src/python$ unzip -l /tmp/example.zip\nArchive:  /tmp/example.zip\nLength     Date   Time    Name\n--------    ----   ----    ----\n8467  11-26-02 22:30   jwzthreading.py\n--------                   -------\n8467                   1 file\namk@nyman:~/src/python$ ./python\nPython 2.3 (#1, Aug 1 2003, 19:54:32)\n>>> import sys\n>>> sys.path.insert(0, '/tmp/example.zip')  # Add .zip file to front of path\n>>> import jwzthreading\n>>> jwzthreading.file\n'/tmp/example.zip/jwzthreading.py'\n>>>\n",
            "subsections": []
        },
        "An entry in 'sys.path' can now be the filename of a ZIP archive.  The": {
            "content": "ZIP archive can contain any kind of files, but only files named '*.py',\n'*.pyc', or '*.pyo' can be imported.  If an archive only contains '*.py'\nfiles, Python will not attempt to modify the archive by adding the\ncorresponding '*.pyc' file, meaning that if a ZIP archive doesn't\ncontain '*.pyc' files, importing may be rather slow.\n\nA path within the archive can also be specified to only import from a\nsubdirectory; for example, the path '/tmp/example.zip/lib/' would only\nimport from the 'lib/' subdirectory within the archive.\n\nSee also\n........\n\nPEP 273(1) - Import Modules from Zip Archives\n\nWritten by James C. Ahlstrom, who also provided an implementation.\nPython 2.3 follows the specification in PEP 273(2), but uses an\nimplementation written by Just van Rossum that uses the import\nhooks described in PEP 302(3).  See section *note PEP 302; New\nImport Hooks: 12e0. for a description of the new import hooks.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0273/\n\n(2) https://peps.python.org/pep-0273/\n\n(3) https://peps.python.org/pep-0302/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "On Windows NT, 2000, and XP, the system stores file names as Unicode": {
            "content": "strings.  Traditionally, Python has represented file names as byte\nstrings, which is inadequate because it renders some file names\ninaccessible.\n",
            "subsections": []
        },
        "Python now allows using arbitrary Unicode strings (within the": {
            "content": "limitations of the file system) for all functions that expect file\nnames, most notably the *note open(): 26e. built-in function.  If a\nUnicode string is passed to *note os.listdir(): f6a, Python now returns\na list of Unicode strings.  A new function, 'os.getcwdu()', returns the\ncurrent directory as a Unicode string.\n",
            "subsections": []
        },
        "Byte strings still work as file names, and on Windows Python will": {
            "content": "transparently convert them to Unicode using the 'mbcs' encoding.\n",
            "subsections": []
        },
        "Other systems also allow Unicode strings as file names but convert them": {
            "content": "to byte strings before passing them to the system, which can cause a\n*note UnicodeError: 111b. to be raised.  Applications can test whether\narbitrary Unicode strings are supported as file names by checking *note\nos.path.supportsunicodefilenames: 12e2, a Boolean value.\n\nUnder MacOS, *note os.listdir(): f6a. may now return Unicode filenames.\n\nSee also\n........\n\nPEP 277(1) - Unicode file name support for Windows NT\n\nWritten by Neil Hodgson; implemented by Neil Hodgson, Martin von\nLo\"wis, and Mark Hammond.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0277/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "The three major operating systems used today are Microsoft Windows,": {
            "content": "",
            "subsections": []
        },
        "Apple's Macintosh OS, and the various Unix derivatives.  A minor": {
            "content": "irritation of cross-platform work is that these three platforms all use\ndifferent characters to mark the ends of lines in text files.  Unix uses\nthe linefeed (ASCII character 10), MacOS uses the carriage return (ASCII\ncharacter 13), and Windows uses a two-character sequence of a carriage\nreturn plus a newline.\n",
            "subsections": []
        },
        "Python's file objects can now support end of line conventions other than": {
            "content": "the one followed by the platform on which Python is running.  Opening a\nfile with the mode ''U'' or ''rU'' will open a file for reading in *note\nuniversal newlines: b90. mode.  All three line ending conventions will\nbe translated to a ''\\n'' in the strings returned by the various file\nmethods such as 'read()' and 'readline()'.\n",
            "subsections": []
        },
        "Universal newline support is also used when importing modules and when": {
            "content": "executing a file with the 'execfile()' function.  This means that Python\nmodules can be shared between all three operating systems without\nneeding to convert the line-endings.\n",
            "subsections": []
        },
        "This feature can be disabled when compiling Python by specifying the": {
            "content": "'--without-universal-newlines' switch when running Python's 'configure'\nscript.\n\nSee also\n........\n\nPEP 278(1) - Universal Newline Support\n\nWritten and implemented by Jack Jansen.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0278/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "A new built-in function, *note enumerate(): 12d5, will make certain\nloops a bit clearer.  'enumerate(thing)', where 'thing' is either an\niterator or a sequence, returns an iterator that will return '(0,\nthing[0])', '(1, thing[1])', '(2, thing[2])', and so forth.\n\nA common idiom to change every element of a list looks like this:\n\nfor i in range(len(L)):\nitem = L[i]\n# ... compute some result based on item ...\nL[i] = result\n\nThis can be rewritten using *note enumerate(): 12d5. as:\n\nfor i, item in enumerate(L):\n# ... compute some result based on item ...\nL[i] = result\n\nSee also\n........\n\nPEP 279(1) - The enumerate() built-in function\n\nWritten and implemented by Raymond D. Hettinger.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0279/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "A standard package for writing logs, *note logging: 82, has been added\nto Python 2.3.  It provides a powerful and flexible mechanism for\ngenerating logging output which can then be filtered and processed in\nvarious ways.  A configuration file written in a standard format can be\nused to control the logging behavior of a program.  Python includes\nhandlers that will write log records to standard error or to a file or\nsocket, send them to the system log, or even e-mail them to a particular\naddress; of course, it's also possible to write your own handler\nclasses.\n\nThe *note Logger: 98b. class is the primary class.  Most application\ncode will deal with one or more *note Logger: 98b. objects, each one\nused by a particular subsystem of the application.  Each *note Logger:\n98b. is identified by a name, and names are organized into a hierarchy\nusing '.' as the component separator.  For example, you might have *note",
            "subsections": []
        },
        "Logger: 98b. instances named 'server', 'server.auth' and": {
            "content": "'server.network'.  The latter two instances are below 'server' in the\nhierarchy.  This means that if you turn up the verbosity for 'server' or\ndirect 'server' messages to a different handler, the changes will also\napply to records logged to 'server.auth' and 'server.network'.  There's\nalso a root *note Logger: 98b. that's the parent of all other loggers.\n\nFor simple uses, the *note logging: 82. package contains some\nconvenience functions that always use the root log:\n\nimport logging\n\nlogging.debug('Debugging information')\nlogging.info('Informational message')\nlogging.warning('Warning:config file %s not found', 'server.conf')\nlogging.error('Error occurred')\nlogging.critical('Critical error -- shutting down')\n\nThis produces the following output:\n\nWARNING:root:Warning:config file server.conf not found\nERROR:root:Error occurred\nCRITICAL:root:Critical error -- shutting down\n",
            "subsections": []
        },
        "In the default configuration, informational and debugging messages are": {
            "content": "suppressed and the output is sent to standard error.  You can enable the\ndisplay of informational and debugging messages by calling the *note\nsetLevel(): 12e7. method on the root logger.\n\nNotice the *note warning(): 12e8. call's use of string formatting\noperators; all of the functions for logging messages take the arguments\n'(msg, arg1, arg2, ...)' and log the string resulting from 'msg % (arg1,\narg2, ...)'.\n\nThere's also an *note exception(): 12e9. function that records the most\nrecent traceback.  Any of the other functions will also record the\ntraceback if you specify a true value for the keyword argument\n'excinfo'.\n\ndef f():\ntry:    1/0\nexcept: logging.exception('Problem recorded')\n\nf()\n\nThis produces the following output:\n\nERROR:root:Problem recorded\nTraceback (most recent call last):\nFile \"t.py\", line 6, in f\n1/0\nZeroDivisionError: integer division or modulo by zero\n",
            "subsections": []
        },
        "Slightly more advanced programs will use a logger other than the root": {
            "content": "logger.  The 'getLogger(name)' function is used to get a particular log,\ncreating it if it doesn't exist yet.  'getLogger(None)' returns the root\nlogger.\n\nlog = logging.getLogger('server')\n...\nlog.info('Listening on port %i', port)\n...\nlog.critical('Disk full')\n...\n",
            "subsections": []
        },
        "Log records are usually propagated up the hierarchy, so a message logged": {
            "content": "to 'server.auth' is also seen by 'server' and 'root', but a *note\nLogger: 98b. can prevent this by setting its *note propagate: 12ea.\nattribute to *note False: 971.\n\nThere are more classes provided by the *note logging: 82. package that\ncan be customized.  When a *note Logger: 98b. instance is told to log a\nmessage, it creates a *note LogRecord: e59. instance that is sent to any\nnumber of different *note Handler: 12eb. instances.  Loggers and\nhandlers can also have an attached list of filters, and each filter can\ncause the *note LogRecord: e59. to be ignored or can modify the record\nbefore passing it along.  When they're finally output, *note LogRecord:\ne59. instances are converted to text by a *note Formatter: 12ec. class.",
            "subsections": []
        },
        "All of these classes can be replaced by your own specially written": {
            "content": "classes.\n\nWith all of these features the *note logging: 82. package should provide\nenough flexibility for even the most complicated applications.  This is\nonly an incomplete overview of its features, so please see the package's\nreference documentation for all of the details.  Reading PEP 282(1) will\nalso be helpful.\n\nSee also\n........\n\nPEP 282(2) - A Logging System\n\nWritten by Vinay Sajip and Trent Mick; implemented by Vinay Sajip.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0282/\n\n(2) https://peps.python.org/pep-0282/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "A Boolean type was added to Python 2.3.  Two new constants were added to\nthe 'builtin' module, *note True: a53. and *note False: 971.  (*note\nTrue: a53. and *note False: 971. constants were added to the built-ins\nin Python 2.2.1, but the 2.2.1 versions are simply set to integer values\nof 1 and 0 and aren't a different type.)\n\nThe type object for this new type is named *note bool: 17d.; the\nconstructor for it takes any Python value and converts it to *note True:\na53. or *note False: 971.\n\n>>> bool(1)\nTrue\n>>> bool(0)\nFalse\n>>> bool([])\nFalse\n>>> bool( (1,) )\nTrue\n",
            "subsections": []
        },
        "Most of the standard library modules and built-in functions have been": {
            "content": "changed to return Booleans.\n\n>>> obj = []\n>>> hasattr(obj, 'append')\nTrue\n>>> isinstance(obj, list)\nTrue\n>>> isinstance(obj, tuple)\nFalse\n",
            "subsections": []
        },
        "Python's Booleans were added with the primary goal of making code": {
            "content": "clearer.  For example, if you're reading a function and encounter the\nstatement 'return 1', you might wonder whether the '1' represents a",
            "subsections": []
        },
        "Boolean truth value, an index, or a coefficient that multiplies some": {
            "content": "other quantity.  If the statement is 'return True', however, the meaning\nof the return value is quite clear.\n\nPython's Booleans were 'not' added for the sake of strict type-checking.\nA very strict language such as Pascal would also prevent you performing\narithmetic with Booleans, and would require that the expression in an\n*note if: 24f. statement always evaluate to a Boolean result.  Python is\nnot this strict and never will be, as PEP 285(1) explicitly says.  This\nmeans you can still use any expression in an 'if' statement, even ones\nthat evaluate to a list or tuple or some random object.  The Boolean\ntype is a subclass of the *note int: 17e. class so that arithmetic using\na Boolean still works.\n\n>>> True + 1\n2\n>>> False + 1\n1\n>>> False * 75\n0\n>>> True * 75\n75\n\nTo sum up *note True: a53. and *note False: 971. in a sentence: they're\nalternative ways to spell the integer values 1 and 0, with the single\ndifference that *note str(): 157. and *note repr(): 5f0. return the\nstrings ''True'' and ''False'' instead of ''1'' and ''0''.\n\nSee also\n........\n\nPEP 285(2) - Adding a bool type\n\nWritten and implemented by GvR.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0285/\n\n(2) https://peps.python.org/pep-0285/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "When encoding a Unicode string into a byte string, unencodable": {
            "content": "characters may be encountered.  So far, Python has allowed specifying\nthe error processing as either \"strict\" (raising *note UnicodeError:\n111b.), \"ignore\" (skipping the character), or \"replace\" (using a\nquestion mark in the output string), with \"strict\" being the default\nbehavior.  It may be desirable to specify alternative processing of such\nerrors, such as inserting an XML character reference or HTML entity\nreference into the converted string.\n",
            "subsections": []
        },
        "Python now has a flexible framework to add different processing": {
            "content": "strategies.  New error handlers can be added with *note\ncodecs.registererror(): 12f0, and codecs then can access the error\nhandler with *note codecs.lookuperror(): 12f1.  An equivalent C API has\nbeen added for codecs written in C. The error handler gets the necessary\nstate information such as the string being converted, the position in\nthe string where the error was detected, and the target encoding.  The\nhandler can then either raise an exception or return a replacement\nstring.\n",
            "subsections": []
        },
        "Two additional error handlers have been implemented using this": {
            "content": "framework: \"backslashreplace\" uses Python backslash quoting to represent\nunencodable characters and \"xmlcharrefreplace\" emits XML character\nreferences.\n\nSee also\n........\n\nPEP 293(1) - Codec Error Handling Callbacks\n\nWritten and implemented by Walter Do\"rwald.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0293/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "Support for the long-requested Python catalog makes its first appearance": {
            "content": "in 2.3.\n\nThe heart of the catalog is the new Distutils 'register' command.",
            "subsections": []
        },
        "Running 'python setup.py register' will collect the metadata describing": {
            "content": "a package, such as its name, version, maintainer, description, &c., and\nsend it to a central catalog server.  The resulting catalog is available\nfrom 'https://pypi.org'.\n",
            "subsections": []
        },
        "To make the catalog a bit more useful, a new optional 'classifiers'": {
            "content": "keyword argument has been added to the Distutils 'setup()' function.  A\nlist of Trove(1)-style strings can be supplied to help classify the\nsoftware.\n",
            "subsections": []
        },
        "Here's an example 'setup.py' with classifiers, written to be compatible": {
            "content": "with older versions of the Distutils:\n\nfrom distutils import core\nkw = {'name': \"Quixote\",\n'version': \"0.5.1\",\n'description': \"A highly Pythonic Web application framework\",\n# ...\n}\n\nif (hasattr(core, 'setupkeywords') and\n'classifiers' in core.setupkeywords):\nkw['classifiers'] = \\\n['Topic :: Internet :: WWW/HTTP :: Dynamic Content',\n'Environment :: No Input/Output (Daemon)',\n'Intended Audience :: Developers'],\n\ncore.setup(kw)\n",
            "subsections": []
        },
        "The full list of classifiers can be obtained by running 'python setup.py": {
            "content": "register --list-classifiers'.\n\nSee also\n........\n\nPEP 301(2) - Package Index and Metadata for Distutils\n\nWritten and implemented by Richard Jones.\n\n---------- Footnotes ----------\n\n(1) http://catb.org/~esr/trove/\n\n(2) https://peps.python.org/pep-0301/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "While it's been possible to write custom import hooks ever since the": {
            "content": "'ihooks' module was introduced in Python 1.3, no one has ever been\nreally happy with it because writing new import hooks is difficult and\nmessy.  There have been various proposed alternatives such as the\n'imputil' and 'iu' modules, but none of them has ever gained much\nacceptance, and none of them were easily usable from C code.\n\nPEP 302(1) borrows ideas from its predecessors, especially from Gordon\nMcMillan's 'iu' module.  Three new items are added to the *note sys: d3.\nmodule:\n\n* 'sys.pathhooks' is a list of callable objects; most often they'll\nbe classes.  Each callable takes a string containing a path and\neither returns an importer object that will handle imports from\nthis path or raises an *note ImportError: 145. exception if it\ncan't handle this path.\n\n* 'sys.pathimportercache' caches importer objects for each path, so\n'sys.pathhooks' will only need to be traversed once for each path.\n\n* 'sys.metapath' is a list of importer objects that will be\ntraversed before 'sys.path' is checked.  This list is initially\nempty, but user code can add objects to it.  Additional built-in\nand frozen modules can be imported by an object added to this list.\n",
            "subsections": []
        },
        "Importer objects must have a single method, 'findmodule(fullname,": {
            "content": "path=None)'.  'fullname' will be a module or package name, e.g.\n'string' or 'distutils.core'.  'findmodule()' must return a loader\nobject that has a single method, 'loadmodule(fullname)', that creates\nand returns the corresponding module object.\n",
            "subsections": []
        },
        "Pseudo-code for Python's new import logic, therefore, looks something": {
            "content": "like this (simplified a bit; see PEP 302(2) for the full details):\n\nfor mp in sys.metapath:\nloader = mp(fullname)\nif loader is not None:\n<module> = loader.loadmodule(fullname)\n\nfor path in sys.path:\nfor hook in sys.pathhooks:\ntry:\nimporter = hook(path)\nexcept ImportError:\n# ImportError, so try the other path hooks\npass\nelse:\nloader = importer.findmodule(fullname)\n<module> = loader.loadmodule(fullname)\n\n# Not found!\nraise ImportError\n\nSee also\n........\n\nPEP 302(3) - New Import Hooks\n\nWritten by Just van Rossum and Paul Moore.  Implemented by Just van\nRossum.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0302/\n\n(2) https://peps.python.org/pep-0302/\n\n(3) https://peps.python.org/pep-0302/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "Comma-separated files are a format frequently used for exporting data": {
            "content": "from databases and spreadsheets.  Python 2.3 adds a parser for\ncomma-separated files.\n\nComma-separated format is deceptively simple at first glance:\n\nCosts,150,200,3.95\n\nRead a line and call 'line.split(',')': what could be simpler?  But toss\nin string data that can contain commas, and things get more complicated:\n\n\"Costs\",150,200,3.95,\"Includes taxes, shipping, and sundry items\"\n\nA big ugly regular expression can parse this, but using the new *note\ncsv: 27. package is much simpler:\n\nimport csv\n\ninput = open('datafile', 'rb')\nreader = csv.reader(input)\nfor line in reader:\nprint line\n\nThe *note reader(): 12f7. function takes a number of different options.",
            "subsections": []
        },
        "The field separator isn't limited to the comma and can be changed to any": {
            "content": "character, and so can the quoting and line-ending characters.\n",
            "subsections": []
        },
        "Different dialects of comma-separated files can be defined and": {
            "content": "registered; currently there are two dialects, both used by Microsoft\nExcel.  A separate *note csv.writer: 1a2. class will generate\ncomma-separated files from a succession of tuples or lists, quoting\nstrings that contain the delimiter.\n\nSee also\n........\n\nPEP 305(1) - CSV File API\n\nWritten and implemented by Kevin Altis, Dave Cole, Andrew McNamara,\nSkip Montanaro, Cliff Wells.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0305/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: PEP 307 Pickle Enhancements,  Next: Extended Slices,  Prev: PEP 305 Comma-separated Files,  Up: What's New in Python 2 3": {
            "content": "The *note pickle: a1. and 'cPickle' modules received some attention\nduring the 2.3 development cycle.  In 2.2, new-style classes could be\npickled without difficulty, but they weren't pickled very compactly; PEP\n307(1) quotes a trivial example where a new-style class results in a\npickled string three times longer than that for a classic class.\n\nThe solution was to invent a new pickle protocol.  The *note\npickle.dumps(): 12fa. function has supported a text-or-binary flag for a\nlong time.  In 2.3, this flag is redefined from a Boolean to an integer:\n0 is the old text-mode pickle format, 1 is the old binary format, and\nnow 2 is a new 2.3-specific format.  A new constant, *note\npickle.HIGHESTPROTOCOL: 12fb, can be used to select the fanciest\nprotocol available.\n\nUnpickling is no longer considered a safe operation.  2.2's *note\npickle: a1. provided hooks for trying to prevent unsafe classes from\nbeing unpickled (specifically, a 'safeforunpickling' attribute),\nbut none of this code was ever audited and therefore it's all been\nripped out in 2.3.  You should not unpickle untrusted data in any\nversion of Python.\n",
            "subsections": []
        },
        "To reduce the pickling overhead for new-style classes, a new interface": {
            "content": "for customizing pickling was added using three special methods: *note\ngetstate(): 39c, *note setstate(): 12fc, and *note\ngetnewargs(): 12fd.  Consult PEP 307(2) for the full semantics of\nthese methods.\n",
            "subsections": []
        },
        "As a way to compress pickles yet further, it's now possible to use": {
            "content": "integer codes instead of long strings to identify pickled classes.  The",
            "subsections": []
        },
        "Python Software Foundation will maintain a list of standardized codes;": {
            "content": "there's also a range of codes for private use.  Currently no codes have\nbeen specified.\n\nSee also\n........\n\nPEP 307(3) - Extensions to the pickle protocol\n\nWritten and implemented by Guido van Rossum and Tim Peters.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0307/\n\n(2) https://peps.python.org/pep-0307/\n\n(3) https://peps.python.org/pep-0307/\n\nFile: python3.12.info,  Node: Extended Slices,  Next: Other Language Changes<17>,  Prev: PEP 307 Pickle Enhancements,  Up: What's New in Python 2 3\n\n",
            "subsections": []
        },
        "Ever since Python 1.4, the slicing syntax has supported an optional": {
            "content": "third \"step\" or \"stride\" argument.  For example, these are all legal\nPython syntax: 'L[1:10:2]', 'L[:-1:1]', 'L[::-1]'.  This was added to",
            "subsections": []
        },
        "Python at the request of the developers of Numerical Python, which uses": {
            "content": "the third argument extensively.  However, Python's built-in list, tuple,\nand string sequence types have never supported this feature, raising a\n*note TypeError: 28e. if you tried it.  Michael Hudson contributed a\npatch to fix this shortcoming.\n",
            "subsections": []
        },
        "For example, you can now easily extract the elements of a list that have": {
            "content": "even indexes:\n\n>>> L = range(10)\n>>> L[::2]\n[0, 2, 4, 6, 8]\n",
            "subsections": []
        },
        "Negative values also work to make a copy of the same list in reverse": {
            "content": "order:\n\n>>> L[::-1]\n[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n\nThis also works for tuples, arrays, and strings:\n\n>>> s='abcd'\n>>> s[::2]\n'ac'\n>>> s[::-1]\n'dcba'\n",
            "subsections": []
        },
        "If you have a mutable sequence such as a list or an array you can assign": {
            "content": "to or delete an extended slice, but there are some differences between\nassignment to extended and regular slices.  Assignment to a regular\nslice can be used to change the length of the sequence:\n\n>>> a = range(3)\n>>> a\n[0, 1, 2]\n>>> a[1:3] = [4, 5, 6]\n>>> a\n[0, 4, 5, 6]\n",
            "subsections": []
        },
        "Extended slices aren't this flexible.  When assigning to an extended": {
            "content": "slice, the list on the right hand side of the statement must contain the\nsame number of items as the slice it is replacing:\n\n>>> a = range(4)\n>>> a\n[0, 1, 2, 3]\n>>> a[::2]\n[0, 2]\n>>> a[::2] = [0, -1]\n>>> a\n[0, 1, -1, 3]\n>>> a[::2] = [0,1,2]\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in ?\nValueError: attempt to assign sequence of size 3 to extended slice of size 2\n\nDeletion is more straightforward:\n\n>>> a = range(4)\n>>> a\n[0, 1, 2, 3]\n>>> a[::2]\n[0, 2]\n>>> del a[::2]\n>>> a\n[1, 3]\n\nOne can also now pass slice objects to the *note getitem(): 4b9.\nmethods of the built-in sequences:\n\n>>> range(10).getitem(slice(0, 5, 2))\n[0, 2, 4]\n\nOr use slice objects directly in subscripts:\n\n>>> range(10)[slice(0, 5, 2)]\n[0, 2, 4]\n",
            "subsections": []
        },
        "To simplify implementing sequences that support extended slicing, slice": {
            "content": "objects now have a method 'indices(length)' which, given the length of a\nsequence, returns a '(start, stop, step)' tuple that can be passed\ndirectly to *note range(): 761.  'indices()' handles omitted and\nout-of-bounds indices in a manner consistent with regular slices (and\nthis innocuous phrase hides a welter of confusing details!).  The method\nis intended to be used like this:\n\nclass FakeSeq:\n...\ndef calcitem(self, i):\n...\ndef getitem(self, item):\nif isinstance(item, slice):\nindices = item.indices(len(self))\nreturn FakeSeq([self.calcitem(i) for i in range(*indices)])\nelse:\nreturn self.calcitem(i)\n\nFrom this example you can also see that the built-in *note slice: 180.\nobject is now the type object for the slice type, and is no longer a\nfunction.  This is consistent with Python 2.2, where *note int: 17e,\n*note str: 157, etc., underwent the same change.\n\nFile: python3.12.info,  Node: Other Language Changes<17>,  Next: New Improved and Deprecated Modules<4>,  Prev: Extended Slices,  Up: What's New in Python 2 3\n\n",
            "subsections": []
        },
        "Here are all of the changes that Python 2.3 makes to the core Python": {
            "content": "language.\n\n* The *note yield: 7f1. statement is now always a keyword, as\ndescribed in section *note PEP 255; Simple Generators: 12dc. of\nthis document.\n\n* A new built-in function *note enumerate(): 12d5. was added, as\ndescribed in section *note PEP 279; enumerate(): 12e5. of this\ndocument.\n\n* Two new constants, *note True: a53. and *note False: 971. were\nadded along with the built-in *note bool: 17d. type, as described\nin section *note PEP 285; A Boolean Type: 12ee. of this document.\n\n* The *note int(): 17e. type constructor will now return a long\ninteger instead of raising an *note OverflowError: 68d. when a\nstring or floating-point number is too large to fit into an\ninteger.  This can lead to the paradoxical result that\n'isinstance(int(expression), int)' is false, but that seems\nunlikely to cause problems in practice.\n\n* Built-in types now support the extended slicing syntax, as\ndescribed in section *note Extended Slices: 12ff. of this document.\n\n* A new built-in function, 'sum(iterable, start=0)', adds up the\nnumeric items in the iterable object and returns their sum.  *note\nsum(): 181. only accepts numbers, meaning that you can't use it to\nconcatenate a bunch of strings.  (Contributed by Alex Martelli.)\n\n* 'list.insert(pos, value)' used to insert 'value' at the front of\nthe list when 'pos' was negative.  The behaviour has now been\nchanged to be consistent with slice indexing, so when 'pos' is -1\nthe value will be inserted before the last element, and so forth.\n\n* 'list.index(value)', which searches for 'value' within the list and\nreturns its index, now takes optional 'start' and 'stop' arguments\nto limit the search to only part of the list.\n\n* Dictionaries have a new method, 'pop(key[, *default*])', that\nreturns the value corresponding to 'key' and removes that key/value\npair from the dictionary.  If the requested key isn't present in\nthe dictionary, 'default' is returned if it's specified and *note\nKeyError: 8cf. raised if it isn't.\n\n>>> d = {1:2}\n>>> d\n{1: 2}\n>>> d.pop(4)\nTraceback (most recent call last):\nFile \"stdin\", line 1, in ?\nKeyError: 4\n>>> d.pop(1)\n2\n>>> d.pop(1)\nTraceback (most recent call last):\nFile \"stdin\", line 1, in ?\nKeyError: 'pop(): dictionary is empty'\n>>> d\n{}\n>>>\n\nThere's also a new class method, 'dict.fromkeys(iterable, value)',\nthat creates a dictionary with keys taken from the supplied\niterator 'iterable' and all values set to 'value', defaulting to\n'None'.\n\n(Patches contributed by Raymond Hettinger.)\n\nAlso, the *note dict(): 237. constructor now accepts keyword\narguments to simplify creating small dictionaries:\n\n>>> dict(red=1, blue=2, green=3, black=4)\n{'blue': 2, 'black': 4, 'green': 3, 'red': 1}\n\n(Contributed by Just van Rossum.)\n\n* The *note assert: 78a. statement no longer checks the 'debug'\nflag, so you can no longer disable assertions by assigning to\n'debug'.  Running Python with the *note -O: c11. switch will\nstill generate code that doesn't execute any assertions.\n\n* Most type objects are now callable, so you can use them to create\nnew objects such as functions, classes, and modules.  (This means\nthat the 'new' module can be deprecated in a future Python version,\nbecause you can now use the type objects available in the *note\ntypes: fe. module.)  For example, you can create a new module\nobject with the following code:\n\n>>> import types\n>>> m = types.ModuleType('abc','docstring')\n>>> m\n<module 'abc' (built-in)>\n>>> m.doc\n'docstring'\n\n* A new warning, *note PendingDeprecationWarning: 6e0. was added to\nindicate features which are in the process of being deprecated.\nThe warning will 'not' be printed by default.  To check for use of\nfeatures that will be deprecated in the future, supply *note\n-Walways;;PendingDeprecationWarning;;: 6df. on the command line or\nuse *note warnings.filterwarnings(): 1301.\n\n* The process of deprecating string-based exceptions, as in 'raise\n\"Error occurred\"', has begun.  Raising a string will now trigger\n*note PendingDeprecationWarning: 6e0.\n\n* Using 'None' as a variable name will now result in a *note\nSyntaxWarning: 178. warning.  In a future version of Python, 'None'\nmay finally become a keyword.\n\n* The 'xreadlines()' method of file objects, introduced in Python\n2.1, is no longer necessary because files now behave as their own\niterator.  'xreadlines()' was originally introduced as a faster way\nto loop over all the lines in a file, but now you can simply write\n'for line in fileobj'.  File objects also have a new read-only\n'encoding' attribute that gives the encoding used by the file;\nUnicode strings written to the file will be automatically converted\nto bytes using the given encoding.\n\n* The method resolution order used by new-style classes has changed,\nthough you'll only notice the difference if you have a really\ncomplicated inheritance hierarchy.  Classic classes are unaffected\nby this change.  Python 2.2 originally used a topological sort of a\nclass's ancestors, but 2.3 now uses the C3 algorithm as described\nin the paper \"A Monotonic Superclass Linearization for Dylan\"(1).\nTo understand the motivation for this change, read Michele\nSimionato's article \"Python 2.3 Method Resolution Order\"(2), or\nread the thread on python-dev starting with the message at\n'https://mail.python.org/pipermail/python-dev/2002-October/029035.html'.\nSamuele Pedroni first pointed out the problem and also implemented\nthe fix by coding the C3 algorithm.\n\n* Python runs multithreaded programs by switching between threads\nafter executing N bytecodes.  The default value for N has been\nincreased from 10 to 100 bytecodes, speeding up single-threaded\napplications by reducing the switching overhead.  Some\nmultithreaded applications may suffer slower response time, but\nthat's easily fixed by setting the limit back to a lower number\nusing 'sys.setcheckinterval(N)'.  The limit can be retrieved with\nthe new 'sys.getcheckinterval()' function.\n\n* One minor but far-reaching change is that the names of extension\ntypes defined by the modules included with Python now contain the\nmodule and a ''.'' in front of the type name.  For example, in\nPython 2.2, if you created a socket and printed its 'class',\nyou'd get this output:\n\n>>> s = socket.socket()\n>>> s.class\n<type 'socket'>\n\nIn 2.3, you get this:\n\n>>> s.class\n<type 'socket.socket'>\n\n* One of the noted incompatibilities between old- and new-style\nclasses has been removed: you can now assign to the *note name:\n1302. and *note bases: 1303. attributes of new-style classes.\nThere are some restrictions on what can be assigned to *note\nbases: 1303. along the lines of those relating to assigning to\nan instance's *note class: 1304. attribute.\n\n* Menu:\n\n* String Changes::\n* Optimizations: Optimizations<16>.\n\n---------- Footnotes ----------\n\n(1) https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.19.3910\n\n(2) http://www.phyast.pitt.edu/~micheles/mro.html\n\nFile: python3.12.info,  Node: String Changes,  Next: Optimizations<16>,  Up: Other Language Changes<17>\n\n1.18.16.1 String Changes\n........................\n\n* The *note in: 250. operator now works differently for strings.\nPreviously, when evaluating 'X in Y' where 'X' and 'Y' are strings,\n'X' could only be a single character.  That's now changed; 'X' can\nbe a string of any length, and 'X in Y' will return *note True:\na53. if 'X' is a substring of 'Y'. If 'X' is the empty string, the\nresult is always *note True: a53.\n\n>>> 'ab' in 'abcd'\nTrue\n>>> 'ad' in 'abcd'\nFalse\n>>> '' in 'abcd'\nTrue\n\nNote that this doesn't tell you where the substring starts; if you\nneed that information, use the *note find(): d0c. string method.\n\n* The *note strip(): 1306, *note lstrip(): 1307, and *note rstrip():\n1308. string methods now have an optional argument for specifying\nthe characters to strip.  The default is still to remove all\nwhitespace characters:\n\n>>> '   abc '.strip()\n'abc'\n>>> '><><abc<><><>'.strip('<>')\n'abc'\n>>> '><><abc<><><>\\n'.strip('<>')\n'abc<><><>\\n'\n>>> u'\\u4000\\u4001abc\\u4000'.strip(u'\\u4000')\nu'\\u4001abc'\n>>>\n\n(Suggested by Simon Brunning and implemented by Walter Do\"rwald.)\n\n* The *note startswith(): d2f. and *note endswith(): d30. string\nmethods now accept negative numbers for the 'start' and 'end'\nparameters.\n\n* Another new string method is *note zfill(): 1309, originally a\nfunction in the *note string: cd. module.  *note zfill(): 1309.\npads a numeric string with zeros on the left until it's the\nspecified width.  Note that the '%' operator is still more flexible\nand powerful than *note zfill(): 1309.\n\n>>> '45'.zfill(4)\n'0045'\n>>> '12345'.zfill(4)\n'12345'\n>>> 'goofy'.zfill(6)\n'0goofy'\n\n(Contributed by Walter Do\"rwald.)\n\n* A new type object, 'basestring', has been added.  Both 8-bit\nstrings and Unicode strings inherit from this type, so\n'isinstance(obj, basestring)' will return *note True: a53. for\neither kind of string.  It's a completely abstract type, so you\ncan't create 'basestring' instances.\n\n* Interned strings are no longer immortal and will now be\ngarbage-collected in the usual way when the only reference to them\nis from the internal dictionary of interned strings.  (Implemented\nby Oren Tirosh.)\n\nFile: python3.12.info,  Node: Optimizations<16>,  Prev: String Changes,  Up: Other Language Changes<17>\n\n1.18.16.2 Optimizations\n.......................\n\n* The creation of new-style class instances has been made much\nfaster; they're now faster than classic classes!\n\n* The *note sort(): a13. method of list objects has been extensively\nrewritten by Tim Peters, and the implementation is significantly\nfaster.\n\n* Multiplication of large long integers is now much faster thanks to\nan implementation of Karatsuba multiplication, an algorithm that\nscales better than the 'O'('n'^2) required for the grade-school\nmultiplication algorithm.  (Original patch by Christopher A. Craig,\nand significantly reworked by Tim Peters.)\n\n* The 'SETLINENO' opcode is now gone.  This may provide a small\nspeed increase, depending on your compiler's idiosyncrasies.  See\nsection *note Other Changes and Fixes: 130b. for a longer\nexplanation.  (Removed by Michael Hudson.)\n\n* 'xrange()' objects now have their own iterator, making 'for i in\nxrange(n)' slightly faster than 'for i in range(n)'.  (Patch by\nRaymond Hettinger.)\n\n* A number of small rearrangements have been made in various hotspots\nto improve performance, such as inlining a function or removing\nsome code.  (Implemented mostly by GvR, but lots of people have\ncontributed single changes.)\n",
            "subsections": []
        },
        "The net result of the 2.3 optimizations is that Python 2.3 runs the": {
            "content": "pystone benchmark around 25% faster than Python 2.2.\n\nFile: python3.12.info,  Node: New Improved and Deprecated Modules<4>,  Next: Pymalloc A Specialized Object Allocator,  Prev: Other Language Changes<17>,  Up: What's New in Python 2 3\n\n",
            "subsections": []
        },
        "Date and time types suitable for expressing timestamps were added as the": {
            "content": "*note datetime: 2e. module.  The types don't support different calendars\nor many fancy features, and just stick to the basics of representing\ntime.\n\nThe three primary types are: *note date: 70f, representing a day, month,\nand year; *note time: 6a5, consisting of hour, minute, and second; and\n*note datetime: 222, which contains all the attributes of both *note\ndate: 70f. and *note time: 6a5.  There's also a *note timedelta: 7f3.\nclass representing differences between two points in time, and time zone\nlogic is implemented by classes inheriting from the abstract *note\ntzinfo: 3a2. class.\n\nYou can create instances of *note date: 70f. and *note time: 6a5. by\neither supplying keyword arguments to the appropriate constructor, e.g.\n'datetime.date(year=1972, month=10, day=15)', or by using one of a\nnumber of class methods.  For example, the *note today(): 1325. class\nmethod returns the current local date.\n\nOnce created, instances of the date/time classes are all immutable.",
            "subsections": []
        },
        "There are a number of methods for producing formatted strings from": {
            "content": "objects:\n\n>>> import datetime\n>>> now = datetime.datetime.now()\n>>> now.isoformat()\n'2002-12-30T21:27:03.994956'\n>>> now.ctime()  # Only available on date, datetime\n'Mon Dec 30 21:27:03 2002'\n>>> now.strftime('%Y %d %b')\n'2002 30 Dec'\n\nThe *note replace(): 1326. method allows modifying one or more fields of\na *note date: 70f. or *note datetime: 222. instance, returning a new\ninstance:\n\n>>> d = datetime.datetime.now()\n>>> d\ndatetime.datetime(2002, 12, 30, 22, 15, 38, 827738)\n>>> d.replace(year=2001, hour = 12)\ndatetime.datetime(2001, 12, 30, 12, 15, 38, 827738)\n>>>\n",
            "subsections": []
        },
        "Instances can be compared, hashed, and converted to strings (the result": {
            "content": "is the same as that of *note isoformat(): 96a.).  *note date: 70f. and\n*note datetime: 222. instances can be subtracted from each other, and\nadded to *note timedelta: 7f3. instances.  The largest missing feature\nis that there's no standard library support for parsing strings and\ngetting back a *note date: 70f. or *note datetime: 222.\n\nFor more information, refer to the module's reference documentation.\n(Contributed by Tim Peters.)\n\nFile: python3.12.info,  Node: The optparse Module,  Prev: Date/Time Type,  Up: New Improved and Deprecated Modules<4>\n\n1.18.17.2 The optparse Module\n.............................\n\nThe *note getopt: 5c. module provides simple parsing of command-line\narguments.  The new *note optparse: 9b. module (originally named Optik)\nprovides more elaborate command-line parsing that follows the Unix\nconventions, automatically creates the output for '--help', and can\nperform different actions for different options.\n\nYou start by creating an instance of *note OptionParser: 1328. and\ntelling it what your program's options are.\n\nimport sys\nfrom optparse import OptionParser\n\nop = OptionParser()\nop.addoption('-i', '--input',\naction='store', type='string', dest='input',\nhelp='set input filename')\nop.addoption('-l', '--length',\naction='store', type='int', dest='length',\nhelp='set maximum length of output')\n\nParsing a command line is then done by calling the *note parseargs():\n1329. method.\n\noptions, args = op.parseargs(sys.argv[1:])\nprint options\nprint args\n",
            "subsections": []
        },
        "This returns an object containing all of the option values, and a list": {
            "content": "of strings containing the remaining arguments.\n",
            "subsections": []
        },
        "Invoking the script with the various arguments now works as you'd expect": {
            "content": "it to.  Note that the length argument is automatically converted to an\ninteger.\n\n$ ./python opt.py -i data arg1\n<Values at 0x400cad4c: {'input': 'data', 'length': None}>\n['arg1']\n$ ./python opt.py --input=data --length=4\n<Values at 0x400cad2c: {'input': 'data', 'length': 4}>\n[]\n$\n\nThe help message is automatically generated for you:\n\n$ ./python opt.py --help\nusage: opt.py [options]\n\noptions:\n-h, --help            show this help message and exit\n-iINPUT, --input=INPUT\nset input filename\n-lLENGTH, --length=LENGTH\nset maximum length of output\n$\n\nSee the module's documentation for more details.\n",
            "subsections": []
        },
        "Optik was written by Greg Ward, with suggestions from the readers of the": {
            "content": "Getopt SIG.\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "Pymalloc, a specialized object allocator written by Vladimir Marangozov,": {
            "content": "was a feature added to Python 2.1.  Pymalloc is intended to be faster\nthan the system 'malloc()' and to have less memory overhead for\nallocation patterns typical of Python programs.  The allocator uses C's\n'malloc()' function to get large pools of memory and then fulfills\nsmaller memory requests from these pools.\n",
            "subsections": []
        },
        "In 2.1 and 2.2, pymalloc was an experimental feature and wasn't enabled": {
            "content": "by default; you had to explicitly enable it when compiling Python by\nproviding the '--with-pymalloc' option to the 'configure' script.  In\n2.3, pymalloc has had further enhancements and is now enabled by\ndefault; you'll have to supply '--without-pymalloc' to disable it.\n",
            "subsections": []
        },
        "This change is transparent to code written in Python; however, pymalloc": {
            "content": "may expose bugs in C extensions.  Authors of C extension modules should\ntest their code with pymalloc enabled, because some incorrect code may\ncause core dumps at runtime.\n",
            "subsections": []
        },
        "There's one particularly common error that causes problems.  There are a": {
            "content": "number of memory allocation functions in Python's C API that have\npreviously just been aliases for the C library's 'malloc()' and\n'free()', meaning that if you accidentally called mismatched functions\nthe error wouldn't be noticeable.  When the object allocator is enabled,\nthese functions aren't aliases of 'malloc()' and 'free()' any more, and\ncalling the wrong function to free memory may get you a core dump.  For\nexample, if memory was allocated using *note PyObjectMalloc(): ab3, it\nhas to be freed using *note PyObjectFree(): ab0, not 'free()'.  A few\nmodules included with Python fell afoul of this and had to be fixed;\ndoubtless there are more third-party modules that will have the same\nproblem.\n",
            "subsections": []
        },
        "As part of this change, the confusing multiple interfaces for allocating": {
            "content": "memory have been consolidated down into two API families.  Memory\nallocated with one family must not be manipulated with functions from\nthe other family.  There is one family for allocating chunks of memory\nand another family of functions specifically for allocating Python\nobjects.\n\n* To allocate and free an undistinguished chunk of memory use the\n\"raw memory\" family: *note PyMemMalloc(): ab1, *note\nPyMemRealloc(): eab, and *note PyMemFree(): 129a.\n\n* The \"object memory\" family is the interface to the pymalloc\nfacility described above and is biased towards a large number of\n\"small\" allocations: *note PyObjectMalloc(): ab3, *note\nPyObjectRealloc(): 129b, and *note PyObjectFree(): ab0.\n\n* To allocate and free Python objects, use the \"object\" family *note\nPyObjectNew: 7a9, *note PyObjectNewVar: 7aa, and *note\nPyObjectDel(): 132c.\n",
            "subsections": []
        },
        "Thanks to lots of work by Tim Peters, pymalloc in 2.3 also provides": {
            "content": "debugging features to catch memory overwrites and doubled frees in both\nextension modules and in the interpreter itself.  To enable this\nsupport, compile a debugging version of the Python interpreter by\nrunning 'configure' with '--with-pydebug'.\n",
            "subsections": []
        },
        "To aid extension writers, a header file 'Misc/pymemcompat.h' is": {
            "content": "distributed with the source to Python 2.3 that allows Python extensions\nto use the 2.3 interfaces to memory allocation while compiling against\nany version of Python since 1.5.2.  You would copy the file from",
            "subsections": []
        },
        "Python's source distribution and bundle it with the source of your": {
            "content": "extension.\n\nSee also\n........\n\n'https://hg.python.org/cpython/file/default/Objects/obmalloc.c'\n\nFor the full details of the pymalloc implementation, see the\ncomments at the top of the file 'Objects/obmalloc.c' in the Python\nsource code.  The above link points to the file within the\npython.org SVN browser.\n\nFile: python3.12.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\n\n\nChanges to Python's build process and to the C API include:\n\n* The cycle detection implementation used by the garbage collection\nhas proven to be stable, so it's now been made mandatory.  You can\nno longer compile Python without it, and the '--with-cycle-gc'\nswitch to 'configure' has been removed.\n\n* Python can now optionally be built as a shared library\n('libpython2.3.so') by supplying '--enable-shared' when running\nPython's 'configure' script.  (Contributed by Ondrej Palkovsky.)\n\n* The 'DLEXPORT' and 'DLIMPORT' macros are now deprecated.\nInitialization functions for Python extension modules should now be\ndeclared using the new macro *note PyMODINITFUNC: 132e, while the\nPython core will generally use the 'PyAPIFUNC' and 'PyAPIDATA'\nmacros.\n\n* The interpreter can be compiled without any docstrings for the\nbuilt-in functions and modules by supplying '--without-doc-strings'\nto the 'configure' script.  This makes the Python executable about\n10% smaller, but will also mean that you can't get help for\nPython's built-ins.  (Contributed by Gustavo Niemeyer.)\n\n* The 'PyArgNoArgs()' macro is now deprecated, and code that uses it\nshould be changed.  For Python 2.2 and later, the method definition\ntable can specify the *note METHNOARGS: 132f. flag, signalling\nthat there are no arguments, and the argument checking can then be\nremoved.  If compatibility with pre-2.2 versions of Python is\nimportant, the code could use 'PyArgParseTuple(args, \"\")' instead,\nbut this will be slower than using *note METHNOARGS: 132f.\n\n* *note PyArgParseTuple(): 2d1. accepts new format characters for\nvarious sizes of unsigned integers: 'B' for unsigned char, 'H' for\nunsigned short int, 'I' for unsigned int, and 'K' for unsigned long\nlong.\n\n* A new function, 'PyObjectDelItemString(mapping, char *key)' was\nadded as shorthand for 'PyObjectDelItem(mapping,\nPyStringNew(key))'.\n\n* File objects now manage their internal string buffer differently,\nincreasing it exponentially when needed.  This results in the\nbenchmark tests in 'Lib/test/testbufio.py' speeding up\nconsiderably (from 57 seconds to 1.7 seconds, according to one\nmeasurement).\n\n* It's now possible to define class and static methods for a C\nextension type by setting either the *note METHCLASS: 1330. or\n*note METHSTATIC: 1331. flags in a method's *note PyMethodDef:\n1332. structure.\n\n* Python now includes a copy of the Expat XML parser's source code,\nremoving any dependence on a system version or local installation\nof Expat.\n\n* If you dynamically allocate type objects in your extension, you\nshould be aware of a change in the rules relating to the\n'module' and *note name: 1302. attributes.  In summary, you\nwill want to ensure the type's dictionary contains a ''module''\nkey; making the module name the part of the type name leading up to\nthe final period will no longer have the desired effect.  For more\ndetail, read the API reference documentation or the source.\n\n* Menu:\n\n* Port-Specific Changes: Port-Specific Changes<3>.\n\nFile: python3.12.info,  Node: Port-Specific Changes<3>,  Up: Build and C API Changes<12>\n\n1.18.19.1 Port-Specific Changes\n...............................\n",
            "subsections": []
        },
        "Support for a port to IBM's OS/2 using the EMX runtime environment was": {
            "content": "merged into the main Python source tree.  EMX is a POSIX emulation layer\nover the OS/2 system APIs.  The Python port for EMX tries to support all\nthe POSIX-like capability exposed by the EMX runtime, and mostly\nsucceeds; 'fork()' and *note fcntl(): 54. are restricted by the\nlimitations of the underlying emulation layer.  The standard OS/2 port,\nwhich uses IBM's Visual Age compiler, also gained support for\ncase-sensitive import semantics as part of the integration of the EMX\nport into CVS. (Contributed by Andrew MacIntyre.)\n",
            "subsections": []
        },
        "On MacOS, most toolbox modules have been weaklinked to improve backward": {
            "content": "compatibility.  This means that modules will no longer fail to load if a\nsingle routine is missing on the current OS version.  Instead calling\nthe missing routine will raise an exception.  (Contributed by Jack",
            "subsections": []
        },
        "Jansen.)": {
            "content": "",
            "subsections": []
        },
        "The RPM spec files, found in the 'Misc/RPM/' directory in the Python": {
            "content": "source distribution, were updated for 2.3.  (Contributed by Sean",
            "subsections": []
        },
        "Reifschneider.)": {
            "content": "",
            "subsections": []
        },
        "Other new platforms now supported by Python include AtheOS": {
            "content": "('http://www.atheos.cx/'), GNU/Hurd, and OpenVMS.\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "As usual, there were a bunch of other improvements and bugfixes": {
            "content": "scattered throughout the source tree.  A search through the CVS change\nlogs finds there were 523 patches applied and 514 bugs fixed between\nPython 2.2 and 2.3.  Both figures are likely to be underestimates.\n\nSome of the more notable changes are:\n\n* If the *note PYTHONINSPECT: 1335. environment variable is set, the\nPython interpreter will enter the interactive prompt after running\na Python program, as if Python had been invoked with the *note -i:\n1336. option.  The environment variable can be set before running\nthe Python interpreter, or it can be set by the Python program as\npart of its execution.\n\n* The 'regrtest.py' script now provides a way to allow \"all resources\nexcept 'foo'.\" A resource name passed to the '-u' option can now be\nprefixed with a hyphen (''-'') to mean \"remove this resource.\" For\nexample, the option ''-uall,-bsddb'' could be used to enable the\nuse of all resources except 'bsddb'.\n\n* The tools used to build the documentation now work under Cygwin as\nwell as Unix.\n\n* The 'SETLINENO' opcode has been removed.  Back in the mists of\ntime, this opcode was needed to produce line numbers in tracebacks\nand support trace functions (for, e.g., *note pdb: a0.).  Since\nPython 1.5, the line numbers in tracebacks have been computed using\na different mechanism that works with \"python -O\".  For Python 2.3\nMichael Hudson implemented a similar scheme to determine when to\ncall the trace function, removing the need for 'SETLINENO'\nentirely.\n\nIt would be difficult to detect any resulting difference from\nPython code, apart from a slight speed up when Python is run\nwithout *note -O: c11.\n\nC extensions that access the *note flineno: 59e. field of frame\nobjects should instead call 'PyCodeAddr2Line(f->fcode,\nf->flasti)'.  This will have the added effect of making the code\nwork as desired under \"python -O\" in earlier versions of Python.\n\nA nifty new feature is that trace functions can now assign to the\n*note flineno: 59e. attribute of frame objects, changing the line\nthat will be executed next.  A 'jump' command has been added to the\n*note pdb: a0. debugger taking advantage of this new feature.\n(Implemented by Richie Hindle.)\n\nFile: python3.12.info,  Node: Porting to Python 2 3,  Next: Acknowledgements<5>,  Prev: Other Changes and Fixes<2>,  Up: What's New in Python 2 3\n\n",
            "subsections": []
        },
        "Andrew Dalke, Scott David Daniels, Fred L. Drake, Jr., David Fraser,": {
            "content": "",
            "subsections": []
        },
        "Kelly Gerber, Raymond Hettinger, Michael Hudson, Chris Lambert, Detlef": {
            "content": "Lannert, Martin von Lo\"wis, Andrew MacIntyre, Lalo Martins, Chad Netzer,",
            "subsections": []
        },
        "Gustavo Niemeyer, Neal Norwitz, Hans Nowak, Chris Reedy, Francesco": {
            "content": "",
            "subsections": []
        },
        "Ricciardi, Vinay Sajip, Neil Schemenauer, Roman Suzi, Jason Tishler,": {
            "content": "Just van Rossum.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": [
                {
                    "name": "1.19 What's New in Python 2.2",
                    "content": ""
                }
            ]
        },
        "File: python3.12.info,  Node: Introduction,  Next: PEPs 252 and 253 Type and Class Changes,  Up: What's New in Python 2 2": {
            "content": "",
            "subsections": []
        },
        "This article explains the new features in Python 2.2.2, released on": {
            "content": "",
            "subsections": []
        },
        "October 14, 2002.  Python 2.2.2 is a bugfix release of Python 2.2,": {
            "content": "originally released on December 21, 2001.\n\nPython 2.2 can be thought of as the \"cleanup release\".  There are some\nfeatures such as generators and iterators that are completely new, but\nmost of the changes, significant and far-reaching though they may be,\nare aimed at cleaning up irregularities and dark corners of the language\ndesign.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: PEPs 252 and 253 Type and Class Changes,  Next: PEP 234 Iterators,  Prev: Introduction,  Up: What's New in Python 2 2": {
            "content": "",
            "subsections": []
        },
        "The largest and most far-reaching changes in Python 2.2 are to Python's": {
            "content": "model of objects and classes.  The changes should be backward\ncompatible, so it's likely that your code will continue to run\nunchanged, but the changes provide some amazing new capabilities.",
            "subsections": []
        },
        "Before beginning this, the longest and most complicated section of this": {
            "content": "article, I'll provide an overview of the changes and offer some\ncomments.\n\nA long time ago I wrote a web page listing flaws in Python's design.",
            "subsections": []
        },
        "One of the most significant flaws was that it's impossible to subclass": {
            "content": "",
            "subsections": []
        },
        "Python types implemented in C. In particular, it's not possible to": {
            "content": "subclass built-in types, so you can't just subclass, say, lists in order\nto add a single useful method to them.  The 'UserList' module provides a\nclass that supports all of the methods of lists and that can be\nsubclassed further, but there's lots of C code that expects a regular\nPython list and won't accept a *note UserList: 133e. instance.\n",
            "subsections": []
        },
        "Python 2.2 fixes this, and in the process adds some exciting new": {
            "content": "capabilities.  A brief summary:\n\n* You can subclass built-in types such as lists and even integers,\nand your subclasses should work in every place that requires the\noriginal type.\n\n* It's now possible to define static and class methods, in addition\nto the instance methods available in previous versions of Python.\n\n* It's also possible to automatically call methods on accessing or\nsetting an instance attribute by using a new mechanism called\n'properties'.  Many uses of *note getattr(): 1f8. can be\nrewritten to use properties instead, making the resulting code\nsimpler and faster.  As a small side benefit, attributes can now\nhave docstrings, too.\n\n* The list of legal attributes for an instance can be limited to a\nparticular set using 'slots', making it possible to safeguard\nagainst typos and perhaps make more optimizations possible in\nfuture versions of Python.\n",
            "subsections": []
        },
        "Some users have voiced concern about all these changes.  Sure, they say,": {
            "content": "the new features are neat and lend themselves to all sorts of tricks\nthat weren't possible in previous versions of Python, but they also make\nthe language more complicated.  Some people have said that they've\nalways recommended Python for its simplicity, and feel that its\nsimplicity is being lost.\n",
            "subsections": []
        },
        "Personally, I think there's no need to worry.  Many of the new features": {
            "content": "are quite esoteric, and you can write a lot of Python code without ever\nneeded to be aware of them.  Writing a simple class is no more difficult\nthan it ever was, so you don't need to bother learning or teaching them\nunless they're actually needed.  Some very complicated tasks that were\npreviously only possible from C will now be possible in pure Python, and\nto my mind that's all for the better.\n\nI'm not going to attempt to cover every single corner case and small\nchange that were required to make the new features work.  Instead this\nsection will paint only the broad strokes.  See section *note Related\nLinks: 133f, \"Related Links\", for further sources of information about\nPython 2.2's new object model.\n\n* Menu:\n\n* Old and New Classes::\n* Descriptors::\n* Multiple Inheritance; The Diamond Rule: Multiple Inheritance The Diamond Rule.\n* Attribute Access::\n* Related Links::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Old and New Classes,  Next: Descriptors,  Up: PEPs 252 and 253 Type and Class Changes": {
            "content": "1.19.2.1 Old and New Classes\n............................\n\nFirst, you should know that Python 2.2 really has two kinds of classes:\nclassic or old-style classes, and new-style classes.  The old-style\nclass model is exactly the same as the class model in earlier versions\nof Python.  All the new features described in this section apply only to\nnew-style classes.  This divergence isn't intended to last forever;\neventually old-style classes will be dropped, possibly in Python 3.0.\n\nSo how do you define a new-style class?  You do it by subclassing an\nexisting new-style class.  Most of Python's built-in types, such as\nintegers, lists, dictionaries, and even files, are new-style classes\nnow.  A new-style class named *note object: 8bb, the base class for all\nbuilt-in types, has also been added so if no built-in type is suitable,\nyou can just subclass *note object: 8bb.:\n\nclass C(object):\ndef init (self):\n...\n...\n\nThis means that *note class: 114c. statements that don't have any base\nclasses are always classic classes in Python 2.2.  (Actually you can\nalso change this by setting a module-level variable named\n'metaclass' -- see PEP 253(1) for the details -- but it's easier to\njust subclass *note object: 8bb.)\n",
            "subsections": []
        },
        "The type objects for the built-in types are available as built-ins,": {
            "content": "named using a clever trick.  Python has always had built-in functions\nnamed *note int(): 17e, *note float(): 4b7, and *note str(): 157.  In\n2.2, they aren't functions any more, but type objects that behave as\nfactories when called.\n\n>>> int\n<type 'int'>\n>>> int('123')\n123\n\nTo make the set of types complete, new type objects such as *note\ndict(): 237. and 'file()' have been added.  Here's a more interesting\nexample, adding a 'lock()' method to file objects:\n\nclass LockableFile(file):\ndef lock (self, operation, length=0, start=0, whence=0):\nimport fcntl\nreturn fcntl.lockf(self.fileno(), operation,\nlength, start, whence)\n",
            "subsections": []
        },
        "The now-obsolete 'posixfile' module contained a class that emulated all": {
            "content": "of a file object's methods and also added a 'lock()' method, but this\nclass couldn't be passed to internal functions that expected a built-in\nfile, something which is possible with our new 'LockableFile'.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0253/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Descriptors,  Next: Multiple Inheritance The Diamond Rule,  Prev: Old and New Classes,  Up: PEPs 252 and 253 Type and Class Changes": {
            "content": "1.19.2.2 Descriptors\n....................\n",
            "subsections": []
        },
        "In previous versions of Python, there was no consistent way to discover": {
            "content": "what attributes and methods were supported by an object.  There were\nsome informal conventions, such as defining 'members' and\n'methods' attributes that were lists of names, but often the author\nof an extension type or a class wouldn't bother to define them.  You\ncould fall back on inspecting the *note dict: aa8. of an object, but\nwhen class inheritance or an arbitrary 'getattr()' hook were in use\nthis could still be inaccurate.\n",
            "subsections": []
        },
        "The one big idea underlying the new class model is that an API for": {
            "content": "describing the attributes of an object using 'descriptors' has been\nformalized.  Descriptors specify the value of an attribute, stating\nwhether it's a method or a field.  With the descriptor API, static\nmethods and class methods become possible, as well as more exotic\nconstructs.\n",
            "subsections": []
        },
        "Attribute descriptors are objects that live inside class objects, and": {
            "content": "have a few attributes of their own:\n\n* *note name: 1302. is the attribute's name.\n\n* 'doc' is the attribute's docstring.\n\n* 'get(object)' is a method that retrieves the attribute value\nfrom 'object'.\n\n* 'set(object, value)' sets the attribute on 'object' to 'value'.\n\n* 'delete(object, value)' deletes the 'value' attribute of\n'object'.\n",
            "subsections": []
        },
        "For example, when you write 'obj.x', the steps that Python actually": {
            "content": "performs are:\n\ndescriptor = obj.class.x\ndescriptor.get(obj)\n",
            "subsections": []
        },
        "For methods, 'descriptor.get()' returns a temporary object that's": {
            "content": "callable, and wraps up the instance and the method to be called on it.",
            "subsections": []
        },
        "This is also why static methods and class methods are now possible; they": {
            "content": "have descriptors that wrap up just the method, or the method and the\nclass.  As a brief explanation of these new kinds of methods, static\nmethods aren't passed the instance, and therefore resemble regular\nfunctions.  Class methods are passed the class of the object, but not\nthe object itself.  Static and class methods are defined like this:\n\nclass C(object):\ndef f(arg1, arg2):\n...\nf = staticmethod(f)\n\ndef g(cls, arg1, arg2):\n...\ng = classmethod(g)\n\nThe *note staticmethod(): 5cc. function takes the function 'f()', and\nreturns it wrapped up in a descriptor so it can be stored in the class\nobject.  You might expect there to be special syntax for creating such\nmethods ('def static f', 'defstatic f()', or something like that) but no\nsuch syntax has been defined yet; that's been left for future versions\nof Python.\n",
            "subsections": []
        },
        "More new features, such as slots and properties, are also implemented as": {
            "content": "new kinds of descriptors, and it's not difficult to write a descriptor\nclass that does something novel.  For example, it would be possible to\nwrite a descriptor class that made it possible to write Eiffel-style\npreconditions and postconditions for a method.  A class that used this\nfeature might be defined like this:\n\nfrom eiffel import eiffelmethod\n\nclass C(object):\ndef f(self, arg1, arg2):\n# The actual function\n...\ndef pref(self):\n# Check preconditions\n...\ndef postf(self):\n# Check postconditions\n...\n\nf = eiffelmethod(f, pref, postf)\n",
            "subsections": []
        },
        "Note that a person using the new 'eiffelmethod()' doesn't have to": {
            "content": "understand anything about descriptors.  This is why I think the new\nfeatures don't increase the basic complexity of the language.  There\nwill be a few wizards who need to know about it in order to write\n'eiffelmethod()' or the ZODB or whatever, but most users will just write\ncode on top of the resulting libraries and ignore the implementation\ndetails.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Multiple Inheritance The Diamond Rule,  Next: Attribute Access,  Prev: Descriptors,  Up: PEPs 252 and 253 Type and Class Changes": {
            "content": "1.19.2.3 Multiple Inheritance: The Diamond Rule\n...............................................\n",
            "subsections": []
        },
        "Multiple inheritance has also been made more useful through changing the": {
            "content": "rules under which names are resolved.  Consider this set of classes\n(diagram taken from PEP 253(1) by Guido van Rossum):\n\nclass A:\n^ ^  def save(self): ...\n/   \\\n/     \\\n/       \\\n/         \\\nclass B     class C:\n^         ^  def save(self): ...\n\\       /\n\\     /\n\\   /\n\\ /\nclass D\n",
            "subsections": []
        },
        "The lookup rule for classic classes is simple but not very smart; the": {
            "content": "base classes are searched depth-first, going from left to right.  A\nreference to 'D.save()' will search the classes 'D', 'B', and then 'A',\nwhere 'save()' would be found and returned.  'C.save()' would never be\nfound at all.  This is bad, because if 'C''s 'save()' method is saving\nsome internal state specific to 'C', not calling it will result in that\nstate never getting saved.\n",
            "subsections": []
        },
        "New-style classes follow a different algorithm that's a bit more": {
            "content": "complicated to explain, but does the right thing in this situation.\n(Note that Python 2.3 changes this algorithm to one that produces the\nsame results in most cases, but produces more useful results for really\ncomplicated inheritance graphs.)\n\n1. List all the base classes, following the classic lookup rule and\ninclude a class multiple times if it's visited repeatedly.  In the\nabove example, the list of visited classes is ['D', 'B', 'A', 'C',\n'A'].\n\n2. Scan the list for duplicated classes.  If any are found, remove all\nbut one occurrence, leaving the 'last' one in the list.  In the\nabove example, the list becomes ['D', 'B', 'C', 'A'] after dropping\nduplicates.\n",
            "subsections": []
        },
        "Following this rule, referring to 'D.save()' will return 'C.save()',": {
            "content": "which is the behaviour we're after.  This lookup rule is the same as the\none followed by Common Lisp.  A new built-in function, *note super():\n204, provides a way to get at a class's superclasses without having to\nreimplement Python's algorithm.  The most commonly used form will be\n'super(class, obj)', which returns a bound superclass object (not the\nactual class object).  This form will be used in methods to call a\nmethod in the superclass; for example, 'D''s 'save()' method would look\nlike this:\n\nclass D (B,C):\ndef save (self):\n# Call superclass .save()\nsuper(D, self).save()\n# Save D's private information here\n...\n\n*note super(): 204. can also return unbound superclass objects when\ncalled as 'super(class)' or 'super(class1, class2)', but this probably\nwon't often be useful.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0253/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Attribute Access,  Next: Related Links,  Prev: Multiple Inheritance The Diamond Rule,  Up: PEPs 252 and 253 Type and Class Changes": {
            "content": "1.19.2.4 Attribute Access\n.........................\n\nA fair number of sophisticated Python classes define hooks for attribute\naccess using *note getattr(): 1f8.; most commonly this is done for\nconvenience, to make code more readable by automatically mapping an\nattribute access such as 'obj.parent' into a method call such as\n'obj.getparent'.  Python 2.2 adds some new ways of controlling\nattribute access.\n",
            "subsections": []
        },
        "First, 'getattr(attrname)' is still supported by new-style classes,": {
            "content": "and nothing about it has changed.  As before, it will be called when an\nattempt is made to access 'obj.foo' and no attribute named 'foo' is\nfound in the instance's dictionary.\n",
            "subsections": []
        },
        "New-style classes also support a new method,": {
            "content": "'getattribute(attrname)'.  The difference between the two methods\nis that *note getattribute(): a16. is 'always' called whenever any\nattribute is accessed, while the old *note getattr(): 1f8. is only\ncalled if 'foo' isn't found in the instance's dictionary.\n",
            "subsections": []
        },
        "However, Python 2.2's support for 'properties' will often be a simpler": {
            "content": "way to trap attribute references.  Writing a 'getattr()' method is\ncomplicated because to avoid recursion you can't use regular attribute\naccesses inside them, and instead have to mess around with the contents\nof *note dict: aa8.  *note getattr(): 1f8. methods also end up\nbeing called by Python when it checks for other methods such as *note\nrepr(): 3e8. or 'coerce()', and so have to be written with this\nin mind.  Finally, calling a function on every attribute access results\nin a sizable performance loss.\n\n*note property: 3f6. is a new built-in type that packages up three\nfunctions that get, set, or delete an attribute, and a docstring.  For\nexample, if you want to define a 'size' attribute that's computed, but\nalso settable, you could write:\n\nclass C(object):\ndef getsize (self):\nresult = ... computation ...\nreturn result\ndef setsize (self, size):\n... compute something based on the size\nand set internal state appropriately ...\n\n# Define a property.  The 'delete this attribute'\n# method is defined as None, so the attribute\n# can't be deleted.\nsize = property(getsize, setsize,\nNone,\n\"Storage size of this instance\")\n",
            "subsections": []
        },
        "That is certainly clearer and easier to write than a pair of": {
            "content": "'getattr()'/'setattr()' methods that check for the 'size'\nattribute and handle it specially while retrieving all other attributes\nfrom the instance's *note dict: aa8.  Accesses to 'size' are also\nthe only ones which have to perform the work of calling a function, so\nreferences to other attributes run at their usual speed.\n",
            "subsections": []
        },
        "Finally, it's possible to constrain the list of attributes that can be": {
            "content": "referenced on an object using the new *note slots: 1344. class\nattribute.  Python objects are usually very dynamic; at any time it's\npossible to define a new attribute on an instance by just doing\n'obj.newattr=1'.  A new-style class can define a class attribute named\n*note slots: 1344. to limit the legal attributes to a particular set\nof names.  An example will make this clear:\n\n>>> class C(object):\n...     slots = ('template', 'name')\n...\n>>> obj = C()\n>>> print obj.template\nNone\n>>> obj.template = 'Test'\n>>> print obj.template\nTest\n>>> obj.newattr = None\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in ?\nAttributeError: 'C' object has no attribute 'newattr'\n\nNote how you get an *note AttributeError: 395. on the attempt to assign\nto an attribute not listed in *note slots: 1344.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Related Links,  Prev: Attribute Access,  Up: PEPs 252 and 253 Type and Class Changes": {
            "content": "1.19.2.5 Related Links\n......................\n",
            "subsections": []
        },
        "This section has just been a quick overview of the new features, giving": {
            "content": "enough of an explanation to start you programming, but many details have\nbeen simplified or ignored.  Where should you go to get a more complete\npicture?\n\nThe *note Descriptor Guide: 1346. is a lengthy tutorial introduction to\nthe descriptor features, written by Guido van Rossum.  If my description\nhas whetted your appetite, go read this tutorial next, because it goes\ninto much more detail about the new features while still remaining quite\neasy to read.\n",
            "subsections": []
        },
        "Next, there are two relevant PEPs, PEP 252(1) and PEP 253(2).  PEP": {
            "content": "252(3) is titled \"Making Types Look More Like Classes\", and covers the\ndescriptor API. PEP 253(4) is titled \"Subtyping Built-in Types\", and\ndescribes the changes to type objects that make it possible to subtype\nbuilt-in objects.  PEP 253(5) is the more complicated PEP of the two,\nand at a few points the necessary explanations of types and meta-types\nmay cause your head to explode.  Both PEPs were written and implemented\nby Guido van Rossum, with substantial assistance from the rest of the\nZope Corp.  team.\n",
            "subsections": []
        },
        "Finally, there's the ultimate authority: the source code.  Most of the": {
            "content": "machinery for the type handling is in 'Objects/typeobject.c', but you\nshould only resort to it after all other avenues have been exhausted,\nincluding posting a question to python-list or python-dev.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0252/\n\n(2) https://peps.python.org/pep-0253/\n\n(3) https://peps.python.org/pep-0252/\n\n(4) https://peps.python.org/pep-0253/\n\n(5) https://peps.python.org/pep-0253/\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "Another significant addition to 2.2 is an iteration interface at both": {
            "content": "the C and Python levels.  Objects can define how they can be looped over\nby callers.\n",
            "subsections": []
        },
        "In Python versions up to 2.1, the usual way to make 'for item in obj'": {
            "content": "work is to define a *note getitem(): 4b9. method that looks\nsomething like this:\n\ndef getitem(self, index):\nreturn <next item>\n\n*note getitem(): 4b9. is more properly used to define an indexing\noperation on an object so that you can write 'obj[5]' to retrieve the\nsixth element.  It's a bit misleading when you're using this only to\nsupport *note for: 24e. loops.  Consider some file-like object that\nwants to be looped over; the 'index' parameter is essentially\nmeaningless, as the class probably assumes that a series of *note\ngetitem(): 4b9. calls will be made with 'index' incrementing by one\neach time.  In other words, the presence of the *note getitem():\n4b9. method doesn't mean that using 'file[5]' to randomly access the\nsixth element will work, though it really should.\n\nIn Python 2.2, iteration can be implemented separately, and *note\ngetitem(): 4b9. methods can be limited to classes that really do\nsupport random access.  The basic idea of iterators is simple.  A new\nbuilt-in function, 'iter(obj)' or 'iter(C, sentinel)', is used to get an\niterator.  'iter(obj)' returns an iterator for the object 'obj', while\n'iter(C, sentinel)' returns an iterator that will invoke the callable\nobject 'C' until it returns 'sentinel' to signal that the iterator is\ndone.\n",
            "subsections": []
        },
        "Python classes can define an 'iter()' method, which should create": {
            "content": "and return a new iterator for the object; if the object is its own\niterator, this method can just return 'self'.  In particular, iterators\nwill usually be their own iterators.  Extension types implemented in C\ncan implement a *note tpiter: 1348. function in order to return an\niterator, and extension types that want to behave as iterators can\ndefine a *note tpiternext: 1349. function.\n\nSo, after all this, what do iterators actually do?  They have one\nrequired method, *note next(): 5cb, which takes no arguments and returns\nthe next value.  When there are no more values to be returned, calling\n*note next(): 5cb. should raise the *note StopIteration: a40. exception.\n\n>>> L = [1,2,3]\n>>> i = iter(L)\n>>> print i\n<iterator object at 0x8116870>\n>>> i.next()\n1\n>>> i.next()\n2\n>>> i.next()\n3\n>>> i.next()\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in ?\nStopIteration\n>>>\n\nIn 2.2, Python's *note for: 24e. statement no longer expects a sequence;\nit expects something for which *note iter(): 5ca. will return an\niterator.  For backward compatibility and convenience, an iterator is\nautomatically constructed for sequences that don't implement\n'iter()' or a *note tpiter: 1348. slot, so 'for i in [1,2,3]' will\nstill work.  Wherever the Python interpreter loops over a sequence, it's\nbeen changed to use the iterator protocol.  This means you can do things\nlike this:\n\n>>> L = [1,2,3]\n>>> i = iter(L)\n>>> a,b,c = i\n>>> a,b,c\n(1, 2, 3)\n\nIterator support has been added to some of Python's basic types.\nCalling *note iter(): 5ca. on a dictionary will return an iterator which\nloops over its keys:\n\n>>> m = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6,\n...      'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12}\n>>> for key in m: print key, m[key]\n...\nMar 3\nFeb 2\nAug 8\nSep 9\nMay 5\nJun 6\nJul 7\nJan 1\nApr 4\nNov 11\nDec 12\nOct 10\n",
            "subsections": []
        },
        "That's just the default behaviour.  If you want to iterate over keys,": {
            "content": "values, or key/value pairs, you can explicitly call the 'iterkeys()',\n'itervalues()', or 'iteritems()' methods to get an appropriate iterator.\nIn a minor related change, the *note in: 250. operator now works on\ndictionaries, so 'key in dict' is now equivalent to 'dict.haskey(key)'.\n\nFiles also provide an iterator, which calls the *note readline(): b5.\nmethod until there are no more lines in the file.  This means you can\nnow read each line of a file using code like this:\n\nfor line in file:\n# do something for each line\n...\n",
            "subsections": []
        },
        "Note that you can only go forward in an iterator; there's no way to get": {
            "content": "the previous element, reset the iterator, or make a copy of it.",
            "subsections": []
        },
        "Generators are another new feature, one that interacts with the": {
            "content": "introduction of iterators.\n\nYou're doubtless familiar with how function calls work in Python or C.",
            "subsections": []
        },
        "Python language, but learning or using them isn't compulsory; if they": {
            "content": "don't solve any problems that you have, feel free to ignore them.  One\nnovel feature of Python's interface as compared to Icon's is that a\ngenerator's state is represented as a concrete object (the iterator)\nthat can be passed around to other functions or stored in a data\nstructure.\n\nSee also\n........\n\nPEP 255(2) - Simple Generators\n\nWritten by Neil Schemenauer, Tim Peters, Magnus Lie Hetland.\nImplemented mostly by Neil Schemenauer and Tim Peters, with other\nfixes from the Python Labs crew.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0255/\n\n(2) https://peps.python.org/pep-0255/\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "In recent versions, the distinction between regular integers, which are": {
            "content": "32-bit values on most machines, and long integers, which can be of\narbitrary size, was becoming an annoyance.  For example, on platforms\nthat support files larger than '232' bytes, the 'tell()' method of\nfile objects has to return a long integer.  However, there were various\nbits of Python that expected plain integers and would raise an error if\na long integer was provided instead.  For example, in Python 1.5, only\nregular integers could be used as a slice index, and ''abc'[1L:]' would\nraise a *note TypeError: 28e. exception with the message 'slice index\nmust be int'.\n\nPython 2.2 will shift values from short to long integers as required.",
            "subsections": []
        },
        "The 'L' suffix is no longer needed to indicate a long integer literal,": {
            "content": "as now the compiler will choose the appropriate type.  (Using the 'L'\nsuffix will be discouraged in future 2.x versions of Python, triggering\na warning in Python 2.4, and probably dropped in Python 3.0.)  Many\noperations that used to raise an *note OverflowError: 68d. will now\nreturn a long integer as their result.  For example:\n\n>>> 1234567890123\n1234567890123L\n>>> 2  64\n18446744073709551616L\n",
            "subsections": []
        },
        "In most cases, integers and long integers will now be treated": {
            "content": "identically.  You can still distinguish them with the *note type(): ba0.\nbuilt-in function, but that's rarely needed.\n\nSee also\n........\n\nPEP 237(1) - Unifying Long Integers and Integers\n\nWritten by Moshe Zadka and Guido van Rossum.  Implemented mostly by\nGuido van Rossum.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0237/\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "The most controversial change in Python 2.2 heralds the start of an": {
            "content": "effort to fix an old design flaw that's been in Python from the\nbeginning.  Currently Python's division operator, '/', behaves like C's\ndivision operator when presented with two integer arguments: it returns\nan integer result that's truncated down when there would be a fractional\npart.  For example, '3/2' is 1, not 1.5, and '(-1)/2' is -1, not -0.5.",
            "subsections": []
        },
        "This means that the results of division can vary unexpectedly depending": {
            "content": "on the type of the two operands and because Python is dynamically typed,\nit can be difficult to determine the possible types of the operands.\n\n(The controversy is over whether this is 'really' a design flaw, and\nwhether it's worth breaking existing code to fix this.  It's caused\nendless discussions on python-dev, and in July 2001 erupted into a storm\nof acidly sarcastic postings on 'comp.lang.python'.  I won't argue for\neither side here and will stick to describing what's implemented in 2.2.",
            "subsections": []
        },
        "Read PEP 238(1) for a summary of arguments and counter-arguments.)": {
            "content": "",
            "subsections": []
        },
        "Because this change might break code, it's being introduced very": {
            "content": "gradually.  Python 2.2 begins the transition, but the switch won't be\ncomplete until Python 3.0.\n\nFirst, I'll borrow some terminology from PEP 238(2).  \"True division\" is\nthe division that most non-programmers are familiar with: 3/2 is 1.5,\n1/4 is 0.25, and so forth.  \"Floor division\" is what Python's '/'\noperator currently does when given integer operands; the result is the\nfloor of the value returned by true division.  \"Classic division\" is the\ncurrent mixed behaviour of '/'; it returns the result of floor division\nwhen the operands are integers, and returns the result of true division\nwhen one of the operands is a floating-point number.\n\nHere are the changes 2.2 introduces:\n\n* A new operator, '//', is the floor division operator.  (Yes, we\nknow it looks like C++'s comment symbol.)  '//' 'always' performs\nfloor division no matter what the types of its operands are, so '1\n// 2' is 0 and '1.0 // 2.0' is also 0.0.\n\n'//' is always available in Python 2.2; you don't need to enable it\nusing a 'future' statement.\n\n* By including a 'from future import division' in a module, the\n'/' operator will be changed to return the result of true division,\nso '1/2' is 0.5.  Without the 'future' statement, '/' still\nmeans classic division.  The default meaning of '/' will not change\nuntil Python 3.0.\n\n* Classes can define methods called *note truediv(): 134d. and\n*note floordiv(): 134e. to overload the two division operators.\nAt the C level, there are also slots in the *note PyNumberMethods:\n1274. structure so extension types can define the two operators.\n\n* Python 2.2 supports some command-line arguments for testing whether\ncode will work with the changed division semantics.  Running python\nwith '-Q warn' will cause a warning to be issued whenever division\nis applied to two integers.  You can use this to find code that's\naffected by the change and fix it.  By default, Python 2.2 will\nsimply perform classic division without a warning; the warning will\nbe turned on by default in Python 2.3.\n\nSee also\n........\n\nPEP 238(3) - Changing the Division Operator\n\nWritten by Moshe Zadka and Guido van Rossum.  Implemented by Guido\nvan Rossum..\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0238/\n\n(2) https://peps.python.org/pep-0238/\n\n(3) https://peps.python.org/pep-0238/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Unicode Changes,  Next: PEP 227 Nested Scopes,  Prev: PEP 238 Changing the Division Operator,  Up: What's New in Python 2 2": {
            "content": "",
            "subsections": []
        },
        "Python's Unicode support has been enhanced a bit in 2.2.  Unicode": {
            "content": "strings are usually stored as UCS-2, as 16-bit unsigned integers.",
            "subsections": []
        },
        "Python 2.2 can also be compiled to use UCS-4, 32-bit unsigned integers,": {
            "content": "as its internal encoding by supplying '--enable-unicode=ucs4' to the\nconfigure script.  (It's also possible to specify '--disable-unicode' to\ncompletely disable Unicode support.)\n\nWhen built to use UCS-4 (a \"wide Python\"), the interpreter can natively\nhandle Unicode characters from U+000000 to U+110000, so the range of\nlegal values for the 'unichr()' function is expanded accordingly.  Using\nan interpreter compiled to use UCS-2 (a \"narrow Python\"), values greater\nthan 65535 will still cause 'unichr()' to raise a *note ValueError: 183.\nexception.  This is all described in PEP 261(1), \"Support for 'wide'\nUnicode characters\"; consult it for further details.\n",
            "subsections": []
        },
        "Another change is simpler to explain.  Since their introduction, Unicode": {
            "content": "strings have supported an 'encode()' method to convert the string to a\nselected encoding such as UTF-8 or Latin-1.  A symmetric\n'decode([*encoding*])' method has been added to 8-bit strings (though\nnot to Unicode strings) in 2.2.  'decode()' assumes that the string is\nin the specified encoding and decodes it, returning whatever is returned\nby the codec.\n",
            "subsections": []
        },
        "Using this new feature, codecs have been added for tasks not directly": {
            "content": "related to Unicode.  For example, codecs have been added for\nuu-encoding, MIME's base64 encoding, and compression with the *note\nzlib: 12d. module:\n\n>>> s = \"\"\"Here is a lengthy piece of redundant, overly verbose,\n... and repetitive text.\n... \"\"\"\n>>> data = s.encode('zlib')\n>>> data\n'x\\x9c\\r\\xc9\\xc1\\r\\x80 \\x10\\x04\\xc0?Ul...'\n>>> data.decode('zlib')\n'Here is a lengthy piece of redundant, overly verbose,\\nand repetitive text.\\n'\n>>> print s.encode('uu')\nbegin 666 <data>\nM2&5R92!I<R!A(&QE;F=T:'D@<&EE8V4@;V8@<F5D=6YD86YT+\"!O=F5R;'D@\n>=F5R8F]S92P*86YD(')E<&5T:71I=F4@=&5X=\"X*\n\nend\n>>> \"sheesh\".encode('rot-13')\n'furrfu'\n",
            "subsections": []
        },
        "To convert a class instance to Unicode, a 'unicode()' method can be": {
            "content": "defined by a class, analogous to 'str()'.\n\n'encode()', 'decode()', and 'unicode()' were implemented by",
            "subsections": []
        },
        "Marc-Andre' Lemburg.  The changes to support using UCS-4 internally were": {
            "content": "implemented by Fredrik Lundh and Martin von Lo\"wis.\n\nSee also\n........\n\nPEP 261(2) - Support for 'wide' Unicode characters\n\nWritten by Paul Prescod.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0261/\n\n(2) https://peps.python.org/pep-0261/\n\nFile: python3.12.info,  Node: PEP 227 Nested Scopes,  Next: New and Improved Modules<3>,  Prev: Unicode Changes,  Up: What's New in Python 2 2\n\n",
            "subsections": []
        },
        "In Python 2.1, statically nested scopes were added as an optional": {
            "content": "feature, to be enabled by a 'from future import nestedscopes'\ndirective.  In 2.2 nested scopes no longer need to be specially enabled,\nand are now always present.  The rest of this section is a copy of the\ndescription of nested scopes from my \"What's New in Python 2.1\"\ndocument; if you read it when 2.1 came out, you can skip the rest of\nthis section.\n",
            "subsections": []
        },
        "The largest change introduced in Python 2.1, and made complete in 2.2,": {
            "content": "is to Python's scoping rules.  In Python 2.0, at any given time there\nare at most three namespaces used to look up variable names: local,\nmodule-level, and the built-in namespace.  This often surprised people\nbecause it didn't match their intuitive expectations.  For example, a\nnested recursive function definition doesn't work:\n\ndef f():\n...\ndef g(value):\n...\nreturn g(value-1) + 1\n...\n\nThe function 'g()' will always raise a *note NameError: 144. exception,\nbecause the binding of the name 'g' isn't in either its local namespace\nor in the module-level namespace.  This isn't much of a problem in\npractice (how often do you recursively define interior functions like\nthis?), but this also made using the *note lambda: 1115. expression\nclumsier, and this was a problem in practice.  In code which uses\n'lambda' you can often find local variables being copied by passing them\nas the default values of arguments.\n\ndef find(self, name):\n\"Return list of any entries equal to 'name'\"\nL = filter(lambda x, name=name: x == name,\nself.listattribute)\nreturn L\n",
            "subsections": []
        },
        "The readability of Python code written in a strongly functional style": {
            "content": "suffers greatly as a result.\n",
            "subsections": []
        },
        "The most significant change to Python 2.2 is that static scoping has": {
            "content": "been added to the language to fix this problem.  As a first effect, the\n'name=name' default argument is now unnecessary in the above example.",
            "subsections": []
        },
        "Put simply, when a given variable name is not assigned a value within a": {
            "content": "function (by an assignment, or the *note def: 12af, *note class: 114c,\nor *note import: 3a6. statements), references to the variable will be\nlooked up in the local namespace of the enclosing scope.  A more\ndetailed explanation of the rules, and a dissection of the\nimplementation, can be found in the PEP.\n",
            "subsections": []
        },
        "This change may cause some compatibility problems for code where the": {
            "content": "same variable name is used both at the module level and as a local\nvariable within a function that contains further function definitions.",
            "subsections": []
        },
        "This seems rather unlikely though, since such code would have been": {
            "content": "pretty confusing to read in the first place.\n\nOne side effect of the change is that the 'from module import *' and\n'exec' statements have been made illegal inside a function scope under\ncertain conditions.  The Python reference manual has said all along that\n'from module import *' is only legal at the top level of a module, but\nthe CPython interpreter has never enforced this before.  As part of the\nimplementation of nested scopes, the compiler which turns Python source\ninto bytecodes has to generate different code to access variables in a\ncontaining scope.  'from module import *' and 'exec' make it impossible\nfor the compiler to figure this out, because they add names to the local\nnamespace that are unknowable at compile time.  Therefore, if a function\ncontains function definitions or *note lambda: 1115. expressions with\nfree variables, the compiler will flag this by raising a *note\nSyntaxError: 146. exception.\n\nTo make the preceding explanation a bit clearer, here's an example:\n\nx = 1\ndef f():\n# The next line is a syntax error\nexec 'x=2'\ndef g():\nreturn x\n",
            "subsections": []
        },
        "Line 4 containing the 'exec' statement is a syntax error, since 'exec'": {
            "content": "would define a new local variable named 'x' whose value should be\naccessed by 'g()'.\n",
            "subsections": []
        },
        "This shouldn't be much of a limitation, since 'exec' is rarely used in": {
            "content": "most Python code (and when it is used, it's often a sign of a poor\ndesign anyway).\n",
            "subsections": []
        },
        "Some of the changes only affect people who deal with the Python": {
            "content": "interpreter at the C level because they're writing Python extension\nmodules, embedding the interpreter, or just hacking on the interpreter\nitself.  If you only write Python code, none of the changes described\nhere will affect you very much.\n\n* Profiling and tracing functions can now be implemented in C, which\ncan operate at much higher speeds than Python-based functions and\nshould reduce the overhead of profiling and tracing.  This will be\nof interest to authors of development environments for Python.  Two\nnew C functions were added to Python's API, *note\nPyEvalSetProfile(): 1357. and *note PyEvalSetTrace(): 1358.  The\nexisting *note sys.setprofile(): 1359. and *note sys.settrace():\n135a. functions still exist, and have simply been changed to use\nthe new C-level interface.  (Contributed by Fred L. Drake, Jr.)\n\n* Another low-level API, primarily of interest to implementors of\nPython debuggers and development tools, was added.  *note\nPyInterpreterStateHead(): 135b. and *note\nPyInterpreterStateNext(): 135c. let a caller walk through all the\nexisting interpreter objects; *note\nPyInterpreterStateThreadHead(): 135d. and *note\nPyThreadStateNext(): 135e. allow looping over all the thread\nstates for a given interpreter.  (Contributed by David Beazley.)\n\n* The C-level interface to the garbage collector has been changed to\nmake it easier to write extension types that support garbage\ncollection and to debug misuses of the functions.  Various\nfunctions have slightly different semantics, so a bunch of\nfunctions had to be renamed.  Extensions that use the old API will\nstill compile but will 'not' participate in garbage collection, so\nupdating them for 2.2 should be considered fairly high priority.\n\nTo upgrade an extension module to the new API, perform the\nfollowing steps:\n\n* Rename 'PyTPFLAGSGC' to *note PyTPFLAGSHAVEGC: 568.\n\n*\nUse *note PyObjectGCNew(): 8d7. or *note PyObjectGCNewVar(): 8d8. to allocate\n\nobjects, and *note PyObjectGCDel(): 135f. to deallocate\nthem.\n\n* Rename 'PyObjectGCInit()' to *note PyObjectGCTrack(): 1360. and\n'PyObjectGCFini()' to *note PyObjectGCUnTrack(): 1361.\n\n* Remove 'PyGCHEADSIZE' from object size calculations.\n\n* Remove calls to 'PyObjectASGC()' and 'PyObjectFROMGC()'.\n\n* A new 'et' format sequence was added to *note PyArgParseTuple():\n2d1.; 'et' takes both a parameter and an encoding name, and\nconverts the parameter to the given encoding if the parameter turns\nout to be a Unicode string, or leaves it alone if it's an 8-bit\nstring, assuming it to already be in the desired encoding.  This\ndiffers from the 'es' format character, which assumes that 8-bit\nstrings are in Python's default ASCII encoding and converts them to\nthe specified new encoding.  (Contributed by M.-A. Lemburg, and\nused for the MBCS support on Windows described in the following\nsection.)\n\n* A different argument parsing function, *note PyArgUnpackTuple():\n1362, has been added that's simpler and presumably faster.  Instead\nof specifying a format string, the caller simply gives the minimum\nand maximum number of arguments expected, and a set of pointers to\n*note PyObject: 6b1.* variables that will be filled in with\nargument values.\n\n* Two new flags *note METHNOARGS: 132f. and *note METHO: 1363. are\navailable in method definition tables to simplify implementation of\nmethods with no arguments or a single untyped argument.  Calling\nsuch methods is more efficient than calling a corresponding method\nthat uses *note METHVARARGS: 1364.  Also, the old 'METHOLDARGS'\nstyle of writing C methods is now officially deprecated.\n\n* Two new wrapper functions, *note PyOSsnprintf(): 1365. and *note\nPyOSvsnprintf(): 1366. were added to provide cross-platform\nimplementations for the relatively new 'snprintf()' and\n'vsnprintf()' C lib APIs.  In contrast to the standard 'sprintf()'\nand 'vsprintf()' functions, the Python versions check the bounds of\nthe buffer used to protect against buffer overruns.  (Contributed\nby M.-A. Lemburg.)\n\n* The *note PyTupleResize(): 1367. function has lost an unused\nparameter, so now it takes 2 parameters instead of 3.  The third\nargument was never used, and can simply be discarded when porting\ncode from earlier versions to Python 2.2.\n\nFile: python3.12.info,  Node: Other Changes and Fixes<3>,  Next: Acknowledgements<6>,  Prev: Interpreter Changes and Fixes,  Up: What's New in Python 2 2\n\n",
            "subsections": []
        },
        "As usual there were a bunch of other improvements and bugfixes scattered": {
            "content": "throughout the source tree.  A search through the CVS change logs finds\nthere were 527 patches applied and 683 bugs fixed between Python 2.1 and\n2.2; 2.2.1 applied 139 patches and fixed 143 bugs; 2.2.2 applied 106\npatches and fixed 82 bugs.  These figures are likely to be\nunderestimates.\n\nSome of the more notable changes are:\n\n* The code for the MacOS port for Python, maintained by Jack Jansen,\nis now kept in the main Python CVS tree, and many changes have been\nmade to support MacOS X.\n\nThe most significant change is the ability to build Python as a\nframework, enabled by supplying the '--enable-framework' option to\nthe configure script when compiling Python.  According to Jack\nJansen, \"This installs a self-contained Python installation plus\nthe OS X framework \"glue\" into\n'/Library/Frameworks/Python.framework' (or another location of\nchoice).  For now there is little immediate added benefit to this\n(actually, there is the disadvantage that you have to change your\nPATH to be able to find Python), but it is the basis for creating a\nfull-blown Python application, porting the MacPython IDE, possibly\nusing Python as a standard OSA scripting language and much more.\"\n\nMost of the MacPython toolbox modules, which interface to MacOS\nAPIs such as windowing, QuickTime, scripting, etc.  have been\nported to OS X, but they've been left commented out in 'setup.py'.\nPeople who want to experiment with these modules can uncomment them\nmanually.\n\n* Keyword arguments passed to built-in functions that don't take them\nnow cause a *note TypeError: 28e. exception to be raised, with the\nmessage \"'function' takes no keyword arguments\".\n\n* Weak references, added in Python 2.1 as an extension module, are\nnow part of the core because they're used in the implementation of\nnew-style classes.  The *note ReferenceError: 1369. exception has\ntherefore moved from the *note weakref: 10f. module to become a\nbuilt-in exception.\n\n* A new script, 'Tools/scripts/cleanfuture.py' by Tim Peters,\nautomatically removes obsolete 'future' statements from Python\nsource code.\n\n* An additional 'flags' argument has been added to the built-in\nfunction *note compile(): 528, so the behaviour of 'future'\nstatements can now be correctly observed in simulated shells, such\nas those presented by IDLE and other development environments.\nThis is described in PEP 264(1).  (Contributed by Michael Hudson.)\n\n* The new license introduced with Python 1.6 wasn't GPL-compatible.\nThis is fixed by some minor textual changes to the 2.2 license, so\nit's now legal to embed Python inside a GPLed program again.  Note\nthat Python itself is not GPLed, but instead is under a license\nthat's essentially equivalent to the BSD license, same as it always\nwas.  The license changes were also applied to the Python 2.0.1 and\n2.1.1 releases.\n\n* When presented with a Unicode filename on Windows, Python will now\nconvert it to an MBCS encoded string, as used by the Microsoft file\nAPIs.  As MBCS is explicitly used by the file APIs, Python's choice\nof ASCII as the default encoding turns out to be an annoyance.  On\nUnix, the locale's character set is used if\n'locale.nllanginfo(CODESET)' is available.  (Windows support was\ncontributed by Mark Hammond with assistance from Marc-Andre'\nLemburg.  Unix support was added by Martin von Lo\"wis.)\n\n* Large file support is now enabled on Windows.  (Contributed by Tim\nPeters.)\n\n* The 'Tools/scripts/ftpmirror.py' script now parses a '.netrc' file,\nif you have one.  (Contributed by Mike Romberg.)\n\n* Some features of the object returned by the 'xrange()' function are\nnow deprecated, and trigger warnings when they're accessed; they'll\ndisappear in Python 2.3.  'xrange' objects tried to pretend they\nwere full sequence types by supporting slicing, sequence\nmultiplication, and the *note in: 250. operator, but these features\nwere rarely used and therefore buggy.  The 'tolist()' method and\nthe 'start', 'stop', and 'step' attributes are also being\ndeprecated.  At the C level, the fourth argument to the\n'PyRangeNew()' function, 'repeat', has also been deprecated.\n\n* There were a bunch of patches to the dictionary implementation,\nmostly to fix potential core dumps if a dictionary contains objects\nthat sneakily changed their hash value, or mutated the dictionary\nthey were contained in.  For a while python-dev fell into a gentle\nrhythm of Michael Hudson finding a case that dumped core, Tim\nPeters fixing the bug, Michael finding another case, and round and\nround it went.\n\n* On Windows, Python can now be compiled with Borland C thanks to a\nnumber of patches contributed by Stephen Hansen, though the result\nisn't fully functional yet.  (But this 'is' progress...)\n\n* Another Windows enhancement: Wise Solutions generously offered\nPythonLabs use of their InstallerMaster 8.1 system.  Earlier\nPythonLabs Windows installers used Wise 5.0a, which was beginning\nto show its age.  (Packaged up by Tim Peters.)\n\n* Files ending in '.pyw' can now be imported on Windows.  '.pyw' is a\nWindows-only thing, used to indicate that a script needs to be run\nusing PYTHONW.EXE instead of PYTHON.EXE in order to prevent a DOS\nconsole from popping up to display the output.  This patch makes it\npossible to import such scripts, in case they're also usable as\nmodules.  (Implemented by David Bolen.)\n\n* On platforms where Python uses the C 'dlopen()' function to load\nextension modules, it's now possible to set the flags used by\n'dlopen()' using the *note sys.getdlopenflags(): 136a. and *note\nsys.setdlopenflags(): f8f. functions.  (Contributed by Bram Stolk.)\n\n* The *note pow(): 7f7. built-in function no longer supports 3\narguments when floating-point numbers are supplied.  'pow(x, y, z)'\nreturns '(xy) % z', but this is never useful for floating point\nnumbers, and the final result varies unpredictably depending on the\nplatform.  A call such as 'pow(2.0, 8.0, 7.0)' will now raise a\n*note TypeError: 28e. exception.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0264/\n\nFile: python3.12.info,  Node: Acknowledgements<6>,  Prev: Other Changes and Fixes<3>,  Up: What's New in Python 2 2\n\n",
            "subsections": []
        },
        "Carel Fellinger, David Goodger, Mark Hammond, Stephen Hansen, Michael": {
            "content": "Hudson, Jack Jansen, Marc-Andre' Lemburg, Martin von Lo\"wis, Fredrik",
            "subsections": []
        },
        "Lundh, Michael McLay, Nick Mathewson, Paul Moore, Gustavo Niemeyer, Don": {
            "content": "O'Donnell, Joonas Paalasma, Tim Peters, Jens Quade, Tom Reinhardt, Neil\nSchemenauer, Guido van Rossum, Greg Ward, Edward Welbourne.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": [
                {
                    "name": "1.20 What's New in Python 2.1",
                    "content": ""
                }
            ]
        },
        "This article explains the new features in Python 2.1.  While there": {
            "content": "aren't as many changes in 2.1 as there were in Python 2.0, there are\nstill some pleasant surprises in store.  2.1 is the first release to be\nsteered through the use of Python Enhancement Proposals, or PEPs, so\nmost of the sizable changes have accompanying PEPs that provide more\ncomplete documentation and a design rationale for the change.  This\narticle doesn't attempt to document the new features completely, but\nsimply provides an overview of the new features for Python programmers.",
            "subsections": []
        },
        "Refer to the Python 2.1 documentation, or to the specific PEP, for more": {
            "content": "details about any new feature that particularly interests you.\n",
            "subsections": []
        },
        "One recent goal of the Python development team has been to accelerate": {
            "content": "the pace of new releases, with a new release coming every 6 to 9 months.\n2.1 is the first release to come out at this faster pace, with the first\nalpha appearing in January, 3 months after the final version of 2.0 was\nreleased.\n\nThe final release of Python 2.1 was made on April 17, 2001.\n\nFile: python3.12.info,  Node: PEP 227 Nested Scopes<2>,  Next: PEP 236 future Directives,  Prev: Introduction<2>,  Up: What's New in Python 2 1\n\n",
            "subsections": []
        },
        "The largest change in Python 2.1 is to Python's scoping rules.  In": {
            "content": "",
            "subsections": []
        },
        "Python 2.0, at any given time there are at most three namespaces used to": {
            "content": "look up variable names: local, module-level, and the built-in namespace.",
            "subsections": []
        },
        "This often surprised people because it didn't match their intuitive": {
            "content": "expectations.  For example, a nested recursive function definition\ndoesn't work:\n\ndef f():\n...\ndef g(value):\n...\nreturn g(value-1) + 1\n...\n\nThe function 'g()' will always raise a *note NameError: 144. exception,\nbecause the binding of the name 'g' isn't in either its local namespace\nor in the module-level namespace.  This isn't much of a problem in\npractice (how often do you recursively define interior functions like\nthis?), but this also made using the *note lambda: 1115. expression\nclumsier, and this was a problem in practice.  In code which uses *note\nlambda: 1115. you can often find local variables being copied by passing\nthem as the default values of arguments.\n\ndef find(self, name):\n\"Return list of any entries equal to 'name'\"\nL = filter(lambda x, name=name: x == name,\nself.listattribute)\nreturn L\n",
            "subsections": []
        },
        "The most significant change to Python 2.1 is that static scoping has": {
            "content": "been added to the language to fix this problem.  As a first effect, the\n'name=name' default argument is now unnecessary in the above example.",
            "subsections": []
        },
        "Compatibility concerns have led to nested scopes being introduced": {
            "content": "gradually; in Python 2.1, they aren't enabled by default, but can be\nturned on within a module by using a future statement as described in\nPEP 236(1).  (See the following section for further discussion of PEP\n236(2).)  In Python 2.2, nested scopes will become the default and there\nwill be no way to turn them off, but users will have had all of 2.1's\nlifetime to fix any breakage resulting from their introduction.\n\nSee also\n........\n\nPEP 227(3) - Statically Nested Scopes\n\nWritten and implemented by Jeremy Hylton.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0236/\n\n(2) https://peps.python.org/pep-0236/\n\n(3) https://peps.python.org/pep-0227/\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "The reaction to nested scopes was widespread concern about the dangers": {
            "content": "of breaking code with the 2.1 release, and it was strong enough to make\nthe Pythoneers take a more conservative approach.  This approach\nconsists of introducing a convention for enabling optional functionality\nin release N that will become compulsory in release N+1.\n",
            "subsections": []
        },
        "The syntax uses a 'from...import' statement using the reserved module": {
            "content": "name *note future: 0.  Nested scopes can be enabled by the following\nstatement:\n\nfrom future import nestedscopes\n\nWhile it looks like a normal *note import: 3a6. statement, it's not;\nthere are strict rules on where such a future statement can be put.",
            "subsections": []
        },
        "They can only be at the top of a module, and must precede any Python": {
            "content": "code or regular 'import' statements.  This is because such statements\ncan affect how the Python bytecode compiler parses code and generates\nbytecode, so they must precede any statement that will result in\nbytecodes being produced.\n\nSee also\n........\n\nPEP 236(1) - Back to the *note future: 0.\n\nWritten by Tim Peters, and primarily implemented by Jeremy Hylton.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0236/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: PEP 207 Rich Comparisons,  Next: PEP 230 Warning Framework,  Prev: PEP 236 future Directives,  Up: What's New in Python 2 1": {
            "content": "",
            "subsections": []
        },
        "In earlier versions, Python's support for implementing comparisons on": {
            "content": "user-defined classes and extension types was quite simple.  Classes\ncould implement a 'cmp()' method that was given two instances of a\nclass, and could only return 0 if they were equal or +1 or -1 if they\nweren't; the method couldn't raise an exception or return anything other\nthan a Boolean value.  Users of Numeric Python often found this model\ntoo weak and restrictive, because in the number-crunching programs that\nnumeric Python is used for, it would be more useful to be able to\nperform elementwise comparisons of two matrices, returning a matrix\ncontaining the results of a given comparison for each element.  If the\ntwo matrices are of different sizes, then the compare has to be able to\nraise an exception to signal the error.\n",
            "subsections": []
        },
        "In Python 2.1, rich comparisons were added in order to support this": {
            "content": "need.  Python classes can now individually overload each of the '<',\n'<=', '>', '>=', '==', and '!=' operations.  The new magic method names\nare:\n",
            "subsections": []
        },
        "Operation       Method name": {
            "content": "---------------------------------------------\n\n'<'             *note lt(): 1180.\n\n\n'<='            *note le(): 1181.\n\n\n'>'             *note gt(): 1182.\n\n\n'>='            *note ge(): 1183.\n\n\n'=='            *note eq(): 931.\n\n\n'!='            *note ne(): 1372.\n\n\n(The magic methods are named after the corresponding Fortran operators\n'.LT.'.  '.LE.', &c.  Numeric programmers are almost certainly quite\nfamiliar with these names and will find them easy to remember.)\n",
            "subsections": []
        },
        "Each of these magic methods is of the form 'method(self, other)', where": {
            "content": "'self' will be the object on the left-hand side of the operator, while\n'other' will be the object on the right-hand side.  For example, the\nexpression 'A < B' will cause 'A.lt(B)' to be called.\n",
            "subsections": []
        },
        "Each of these magic methods can return anything at all: a Boolean, a": {
            "content": "matrix, a list, or any other Python object.  Alternatively they can\nraise an exception if the comparison is impossible, inconsistent, or\notherwise meaningless.\n",
            "subsections": []
        },
        "The built-in 'cmp(A,B)' function can use the rich comparison machinery,": {
            "content": "and now accepts an optional argument specifying which comparison\noperation to use; this is given as one of the strings '\"<\"', '\"<=\"',\n'\">\"', '\">=\"', '\"==\"', or '\"!=\"'.  If called without the optional third\nargument, 'cmp()' will only return -1, 0, or +1 as in previous versions\nof Python; otherwise it will call the appropriate method and can return\nany Python object.\n",
            "subsections": []
        },
        "There are also corresponding changes of interest to C programmers;": {
            "content": "there's a new slot 'tprichcmp' in type objects and an API for\nperforming a given rich comparison.  I won't cover the C API here, but\nwill refer you to PEP 207(1), or to 2.1's C API documentation, for the\nfull list of related functions.\n\nSee also\n........\n\nPEP 207(2) - Rich Comparisons\n\nWritten by Guido van Rossum, heavily based on earlier work by David\nAscher, and implemented by Guido van Rossum.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0207/\n\n(2) https://peps.python.org/pep-0207/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "Over its 10 years of existence, Python has accumulated a certain number": {
            "content": "of obsolete modules and features along the way.  It's difficult to know\nwhen a feature is safe to remove, since there's no way of knowing how\nmuch code uses it -- perhaps no programs depend on the feature, or\nperhaps many do.  To enable removing old features in a more structured\nway, a warning framework was added.  When the Python developers want to\nget rid of a feature, it will first trigger a warning in the next\nversion of Python.  The following Python version can then drop the\nfeature, and users will have had a full release cycle to remove uses of\nthe old feature.\n",
            "subsections": []
        },
        "Python 2.1 adds the warning framework to be used in this scheme.  It": {
            "content": "adds a *note warnings: 10d. module that provide functions to issue\nwarnings, and to filter out warnings that you don't want to be\ndisplayed.  Third-party modules can also use this framework to deprecate\nold features that they no longer wish to support.\n",
            "subsections": []
        },
        "For example, in Python 2.1 the 'regex' module is deprecated, so": {
            "content": "importing it causes a warning to be printed:\n\n>>> import regex\nmain:1: DeprecationWarning: the regex module\nis deprecated; please use the re module\n>>>\n\nWarnings can be issued by calling the *note warnings.warn(): 1374.\nfunction:\n\nwarnings.warn(\"feature X no longer supported\")\n",
            "subsections": []
        },
        "The first parameter is the warning message; an additional optional": {
            "content": "parameters can be used to specify a particular warning category.\n",
            "subsections": []
        },
        "Filters can be added to disable certain warnings; a regular expression": {
            "content": "pattern can be applied to the message or to the module name in order to\nsuppress a warning.  For example, you may have a program that uses the\n'regex' module and not want to spare the time to convert it to use the\n*note re: b4. module right now.  The warning can be suppressed by\ncalling\n\nimport warnings\nwarnings.filterwarnings(action = 'ignore',\nmessage='.*regex module is deprecated',\ncategory=DeprecationWarning,\nmodule = 'main')\n\nThis adds a filter that will apply only to warnings of the class *note\nDeprecationWarning: 179. triggered in the *note main: 1. module, and\napplies a regular expression to only match the message about the 'regex'\nmodule being deprecated, and will cause such warnings to be ignored.",
            "subsections": []
        },
        "Warnings can also be printed only once, printed every time the offending": {
            "content": "code is executed, or turned into exceptions that will cause the program\nto stop (unless the exceptions are caught in the usual way, of course).\n",
            "subsections": []
        },
        "Functions were also added to Python's C API for issuing warnings; refer": {
            "content": "to PEP 230 or to Python's API documentation for the details.\n\nSee also\n........\n\nPEP 5(1) - Guidelines for Language Evolution\n\nWritten by Paul Prescod, to specify procedures to be followed when\nremoving old features from Python.  The policy described in this\nPEP hasn't been officially adopted, but the eventual policy\nprobably won't be too different from Prescod's proposal.\n\nPEP 230(2) - Warning Framework\n\nWritten and implemented by Guido van Rossum.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0005/\n\n(2) https://peps.python.org/pep-0230/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "When compiling Python, the user had to go in and edit the": {
            "content": "'Modules/Setup' file in order to enable various additional modules; the\ndefault set is relatively small and limited to modules that compile on\nmost Unix platforms.  This means that on Unix platforms with many more\nfeatures, most notably Linux, Python installations often don't contain\nall useful modules they could.\n",
            "subsections": []
        },
        "Python 2.0 added the Distutils, a set of modules for distributing and": {
            "content": "installing extensions.  In Python 2.1, the Distutils are used to compile\nmuch of the standard library of extension modules, autodetecting which\nones are supported on the current machine.  It's hoped that this will\nmake Python installations easier and more featureful.\n",
            "subsections": []
        },
        "Instead of having to edit the 'Modules/Setup' file in order to enable": {
            "content": "modules, a 'setup.py' script in the top directory of the Python source\ndistribution is run at build time, and attempts to discover which\nmodules can be enabled by examining the modules and header files on the\nsystem.  If a module is configured in 'Modules/Setup', the 'setup.py'\nscript won't attempt to compile that module and will defer to the\n'Modules/Setup' file's contents.  This provides a way to specific any\nstrange command-line flags or libraries that are required for a specific\nplatform.\n",
            "subsections": []
        },
        "In another far-reaching change to the build mechanism, Neil Schemenauer": {
            "content": "restructured things so Python now uses a single makefile that isn't\nrecursive, instead of makefiles in the top directory and in each of the\n'Python/', 'Parser/', 'Objects/', and 'Modules/' subdirectories.  This\nmakes building Python faster and also makes hacking the Makefiles\nclearer and simpler.\n\nSee also\n........\n\nPEP 229(1) - Using Distutils to Build Python\n\nWritten and implemented by A.M. Kuchling.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0229/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "Weak references, available through the *note weakref: 10f. module, are a\nminor but useful new data type in the Python programmer's toolbox.\n",
            "subsections": []
        },
        "Storing a reference to an object (say, in a dictionary or a list) has": {
            "content": "the side effect of keeping that object alive forever.  There are a few\nspecific cases where this behaviour is undesirable, object caches being\nthe most common one, and another being circular references in data\nstructures such as trees.\n",
            "subsections": []
        },
        "For example, consider a memoizing function that caches the results of": {
            "content": "another function 'f(x)' by storing the function's argument and its\nresult in a dictionary:\n\ncache = {}\ndef memoize(x):\nif cache.haskey(x):\nreturn cache[x]\n\nretval = f(x)\n\n# Cache the returned object\ncache[x] = retval\n\nreturn retval\n",
            "subsections": []
        },
        "This version works for simple things such as integers, but it has a side": {
            "content": "effect; the 'cache' dictionary holds a reference to the return values,\nso they'll never be deallocated until the Python process exits and\ncleans up.  This isn't very noticeable for integers, but if 'f()'\nreturns an object, or a data structure that takes up a lot of memory,\nthis can be a problem.\n",
            "subsections": []
        },
        "Weak references provide a way to implement a cache that won't keep": {
            "content": "objects alive beyond their time.  If an object is only accessible\nthrough weak references, the object will be deallocated and the weak\nreferences will now indicate that the object it referred to no longer\nexists.  A weak reference to an object 'obj' is created by calling 'wr =\nweakref.ref(obj)'.  The object being referred to is returned by calling\nthe weak reference as if it were a function: 'wr()'.  It will return the\nreferenced object, or 'None' if the object no longer exists.\n",
            "subsections": []
        },
        "This makes it possible to write a 'memoize()' function whose cache": {
            "content": "doesn't keep objects alive, by storing weak references in the cache.\n\ncache = {}\ndef memoize(x):\nif cache.haskey(x):\nobj = cache[x]()\n# If weak reference object still exists,\n# return it\nif obj is not None: return obj\n\nretval = f(x)\n\n# Cache a weak reference\ncache[x] = weakref.ref(retval)\n\nreturn retval\n\nThe *note weakref: 10f. module also allows creating proxy objects which\nbehave like weak references -- an object referenced only by proxy objects\nis deallocated - but instead of requiring an explicit call to retrieve\nthe object, the proxy transparently forwards all operations to the\nobject as long as the object still exists.  If the object is\ndeallocated, attempting to use a proxy will cause a\n'weakref.ReferenceError' exception to be raised.\n\nproxy = weakref.proxy(obj)\nproxy.attr   # Equivalent to obj.attr\nproxy.meth() # Equivalent to obj.meth()\ndel obj\nproxy.attr   # raises weakref.ReferenceError\n\nSee also\n........\n\nPEP 205(1) - Weak References\n\nWritten and implemented by Fred L. Drake, Jr.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0205/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "In Python 2.1, functions can now have arbitrary information attached to": {
            "content": "them.  People were often using docstrings to hold information about\nfunctions and methods, because the *note doc: 104d. attribute was\nthe only way of attaching any information to a function.  For example,\nin the Zope web application server, functions are marked as safe for\npublic access by having a docstring, and in John Aycock's SPARK parsing\nframework, docstrings hold parts of the BNF grammar to be parsed.  This\noverloading is unfortunate, since docstrings are really intended to hold\na function's documentation; for example, it means you can't properly\ndocument functions intended for private use in Zope.\n",
            "subsections": []
        },
        "Arbitrary attributes can now be set and retrieved on functions using the": {
            "content": "regular Python syntax:\n\ndef f(): pass\n\nf.publish = 1\nf.secure = 1\nf.grammar = \"A ::= B (C D)*\"\n",
            "subsections": []
        },
        "The dictionary containing attributes can be accessed as the function's": {
            "content": "*note dict: aa8.  Unlike the *note dict: aa8. attribute of class\ninstances, in functions you can actually assign a new dictionary to\n*note dict: aa8, though the new value is restricted to a regular",
            "subsections": []
        },
        "Python dictionary; you 'can't' be tricky and set it to a 'UserDict'": {
            "content": "instance, or any other random object that behaves like a mapping.\n\nSee also\n........\n\nPEP 232(1) - Function Attributes\n\nWritten and implemented by Barry Warsaw.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0232/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "Some operating systems have filesystems that are case-insensitive, MacOS": {
            "content": "and Windows being the primary examples; on these systems, it's\nimpossible to distinguish the filenames 'FILE.PY' and 'file.py', even\nthough they do store the file's name in its original case (they're\ncase-preserving, too).\n\nIn Python 2.1, the *note import: 3a6. statement will work to simulate\ncase-sensitivity on case-insensitive platforms.  Python will now search\nfor the first case-sensitive match by default, raising an *note",
            "subsections": []
        },
        "ImportError: 145. if no such file is found, so 'import file' will not": {
            "content": "import a module named 'FILE.PY'.  Case-insensitive matching can be\nrequested by setting the *note PYTHONCASEOK: 77d. environment variable\nbefore starting the Python interpreter.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "When using the Python interpreter interactively, the output of commands": {
            "content": "is displayed using the built-in *note repr(): 5f0. function.  In Python\n2.1, the variable *note sys.displayhook(): 137a. can be set to a\ncallable object which will be called instead of *note repr(): 5f0.  For\nexample, you can set it to a special pretty-printing function:\n\n>>> # Create a recursive data structure\n... L = [1,2,3]\n>>> L.append(L)\n>>> L # Show Python's default output\n[1, 2, 3, [...]]\n>>> # Use pprint.pprint() as the display function\n... import sys, pprint\n>>> sys.displayhook = pprint.pprint\n>>> L\n[1, 2, 3,  <Recursion on list with id=135143996>]\n>>>\n\nSee also\n........\n\nPEP 217(1) - Display Hook for Interactive Use\n\nWritten and implemented by Moshe Zadka.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0217/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "How numeric coercion is done at the C level was significantly modified.",
            "subsections": []
        },
        "This will only affect the authors of C extensions to Python, allowing": {
            "content": "them more flexibility in writing extension types that support numeric\noperations.\n",
            "subsections": []
        },
        "Extension types can now set the type flag 'PyTPFLAGSCHECKTYPES' in": {
            "content": "their 'PyTypeObject' structure to indicate that they support the new\ncoercion model.  In such extension types, the numeric slot functions can\nno longer assume that they'll be passed two arguments of the same type;\ninstead they may be passed two arguments of differing types, and can\nthen perform their own internal coercion.  If the slot function is\npassed a type it can't handle, it can indicate the failure by returning\na reference to the 'PyNotImplemented' singleton value.  The numeric\nfunctions of the other type will then be tried, and perhaps they can\nhandle the operation; if the other type also returns\n'PyNotImplemented', then a *note TypeError: 28e. will be raised.",
            "subsections": []
        },
        "Numeric methods written in Python can also return 'PyNotImplemented',": {
            "content": "causing the interpreter to act as if the method did not exist (perhaps\nraising a *note TypeError: 28e, perhaps trying another object's numeric\nmethods).\n\nSee also\n........\n\nPEP 208(1) - Reworking the Coercion Model\n\nWritten and implemented by Neil Schemenauer, heavily based upon\nearlier work by Marc-Andre' Lemburg.  Read this to understand the\nfine points of how numeric operations will now be processed at the\nC level.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0208/\n\nFile: python3.12.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\n\n\nA common complaint from Python users is that there's no single catalog\nof all the Python modules in existence.  T. Middleton's Vaults of",
            "subsections": []
        },
        "Parnassus at 'www.vex.net/parnassus/' (retired in February 2009,": {
            "content": "available in the Internet Archive Wayback Machine(1)) was the largest\ncatalog of Python modules, but registering software at the Vaults is\noptional, and many people did not bother.\n",
            "subsections": []
        },
        "As a first small step toward fixing the problem, Python software": {
            "content": "packaged using the Distutils 'sdist' command will include a file named\n'PKG-INFO' containing information about the package such as its name,\nversion, and author (metadata, in cataloguing terminology).  PEP 241(2)\ncontains the full list of fields that can be present in the 'PKG-INFO'\nfile.  As people began to package their software using Python 2.1, more\nand more packages will include metadata, making it possible to build\nautomated cataloguing systems and experiment with them.  With the result\nexperience, perhaps it'll be possible to design a really good catalog\nand then build support for it into Python 2.2.  For example, the\nDistutils 'sdist' and 'bdist*' commands could support an 'upload'\noption that would automatically upload your package to a catalog server.\n",
            "subsections": []
        },
        "You can start creating packages containing 'PKG-INFO' even if you're not": {
            "content": "using Python 2.1, since a new release of the Distutils will be made for\nusers of earlier Python versions.  Version 1.0.2 of the Distutils\nincludes the changes described in PEP 241(3), as well as various\nbugfixes and enhancements.  It will be available from the Distutils SIG\nat 'https://www.python.org/community/sigs/current/distutils-sig/'.\n\nSee also\n........\n\nPEP 241(4) - Metadata for Python Software Packages\n\nWritten and implemented by A.M. Kuchling.\n\nPEP 243(5) - Module Repository Upload Mechanism\n\nWritten by Sean Reifschneider, this draft PEP describes a proposed\nmechanism for uploading Python packages to a central server.\n\n---------- Footnotes ----------\n\n(1)\nhttps://web.archive.org/web/20090130140102/http://www.vex.net/parnassus/\n\n(2) https://peps.python.org/pep-0241/\n\n(3) https://peps.python.org/pep-0241/\n\n(4) https://peps.python.org/pep-0241/\n\n(5) https://peps.python.org/pep-0243/\n\nFile: python3.12.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\n\n\n* Ka-Ping Yee contributed two new modules: 'inspect.py', a module for\ngetting information about live Python code, and 'pydoc.py', a\nmodule for interactively converting docstrings to HTML or text.  As\na bonus, 'Tools/scripts/pydoc', which is now automatically\ninstalled, uses 'pydoc.py' to display documentation given a Python\nmodule, package, or class name.  For example, 'pydoc xml.dom'\ndisplays the following:\n\nPython Library Documentation: package xml.dom in xml\n\nNAME\nxml.dom - W3C Document Object Model implementation for Python.\n\nFILE\n/usr/local/lib/python2.1/xml/dom/init.pyc\n\nDESCRIPTION\nThe Python mapping of the Document Object Model is documented in the\nPython Library Reference in the section on the xml.dom package.\n\nThis package contains the following modules:\n...\n\n'pydoc' also includes a Tk-based interactive help browser.  'pydoc'\nquickly becomes addictive; try it out!\n\n* Two different modules for unit testing were added to the standard\nlibrary.  The *note doctest: 36. module, contributed by Tim Peters,\nprovides a testing framework based on running embedded examples in\ndocstrings and comparing the results against the expected output.\nPyUnit, contributed by Steve Purcell, is a unit testing framework\ninspired by JUnit, which was in turn an adaptation of Kent Beck's\nSmalltalk testing framework.  See 'https://pyunit.sourceforge.net/'\nfor more information about PyUnit.\n\n* The *note difflib: 34. module contains a class, *note\nSequenceMatcher: e8e, which compares two sequences and computes the\nchanges required to transform one sequence into the other.  For\nexample, this module can be used to write a tool similar to the\nUnix 'diff' program, and in fact the sample program\n'Tools/scripts/ndiff.py' demonstrates how to write such a script.\n\n* *note curses.panel: 2b, a wrapper for the panel library, part of\nncurses and of SYSV curses, was contributed by Thomas Gellekum.\nThe panel library provides windows with the additional feature of\ndepth.  Windows can be moved higher or lower in the depth ordering,\nand the panel library figures out where panels overlap and which\nsections are visible.\n\n* The PyXML package has gone through a few releases since Python 2.0,\nand Python 2.1 includes an updated version of the *note xml: 11b.\npackage.  Some of the noteworthy changes include support for Expat\n1.2 and later versions, the ability for Expat parsers to handle\nfiles in any encoding supported by Python, and various bugfixes for\nSAX, DOM, and the 'minidom' module.\n\n* Ping also contributed another hook for handling uncaught\nexceptions.  *note sys.excepthook(): 5ff. can be set to a callable\nobject.  When an exception isn't caught by any *note try:\n4bc....*note except: 379. blocks, the exception will be passed to\n*note sys.excepthook(): 5ff, which can then do whatever it likes.\nAt the Ninth Python Conference, Ping demonstrated an application\nfor this hook: printing an extended traceback that not only lists\nthe stack frames, but also lists the function arguments and the\nlocal variables for each frame.\n\n* Various functions in the *note time: e8. module, such as *note\nasctime(): 105b. and *note localtime(): 1353, require a floating\npoint argument containing the time in seconds since the epoch.  The\nmost common use of these functions is to work with the current\ntime, so the floating point argument has been made optional; when a\nvalue isn't provided, the current time will be used.  For example,\nlog file entries usually need a string containing the current time;\nin Python 2.1, 'time.asctime()' can be used, instead of the\nlengthier 'time.asctime(time.localtime(time.time()))' that was\npreviously required.\n\nThis change was proposed and implemented by Thomas Wouters.\n\n* The *note ftplib: 59. module now defaults to retrieving files in\npassive mode, because passive mode is more likely to work from\nbehind a firewall.  This request came from the Debian bug tracking\nsystem, since other Debian packages use *note ftplib: 59. to\nretrieve files and then don't work from behind a firewall.  It's\ndeemed unlikely that this will cause problems for anyone, because\nNetscape defaults to passive mode and few people complain, but if\npassive mode is unsuitable for your application or network setup,\ncall 'setpasv(0)' on FTP objects to disable passive mode.\n\n* Support for raw socket access has been added to the *note socket:\nc6. module, contributed by Grant Edwards.\n\n* The *note pstats: ab. module now contains a simple interactive\nstatistics browser for displaying timing profiles for Python\nprograms, invoked when the module is run as a script.  Contributed\nby Eric S. Raymond.\n\n* A new implementation-dependent function, 'sys.getframe([depth])',\nhas been added to return a given frame object from the current call\nstack.  *note sys.getframe(): 4b0. returns the frame at the top of\nthe call stack; if the optional integer argument 'depth' is\nsupplied, the function returns the frame that is 'depth' calls\nbelow the top of the stack.  For example, 'sys.getframe(1)'\nreturns the caller's frame object.\n\nThis function is only present in CPython, not in Jython or the .NET\nimplementation.  Use it for debugging, and resist the temptation to\nput it into production code.\n\nFile: python3.12.info,  Node: Other Changes and Fixes<4>,  Next: Acknowledgements<7>,  Prev: New and Improved Modules<4>,  Up: What's New in Python 2 1\n\n",
            "subsections": []
        },
        "There were relatively few smaller changes made in Python 2.1 due to the": {
            "content": "shorter release cycle.  A search through the CVS change logs turns up\n117 patches applied, and 136 bugs fixed; both figures are likely to be\nunderestimates.  Some of the more notable changes are:\n\n* A specialized object allocator is now optionally available, that\nshould be faster than the system 'malloc()' and have less memory\noverhead.  The allocator uses C's 'malloc()' function to get large\npools of memory, and then fulfills smaller memory requests from\nthese pools.  It can be enabled by providing the '--with-pymalloc'\noption to the 'configure' script; see 'Objects/obmalloc.c' for the\nimplementation details.\n\nAuthors of C extension modules should test their code with the\nobject allocator enabled, because some incorrect code may break,\ncausing core dumps at runtime.  There are a bunch of memory\nallocation functions in Python's C API that have previously been\njust aliases for the C library's 'malloc()' and 'free()', meaning\nthat if you accidentally called mismatched functions, the error\nwouldn't be noticeable.  When the object allocator is enabled,\nthese functions aren't aliases of 'malloc()' and 'free()' any more,\nand calling the wrong function to free memory will get you a core\ndump.  For example, if memory was allocated using *note PyMemNew:\n137f, it has to be freed using *note PyMemDel(): 1380, not\n'free()'.  A few modules included with Python fell afoul of this\nand had to be fixed; doubtless there are more third-party modules\nthat will have the same problem.\n\nThe object allocator was contributed by Vladimir Marangozov.\n\n* The speed of line-oriented file I/O has been improved because\npeople often complain about its lack of speed, and because it's\noften been used as a na??ve benchmark.  The *note readline(): b5.\nmethod of file objects has therefore been rewritten to be much\nfaster.  The exact amount of the speedup will vary from platform to\nplatform depending on how slow the C library's 'getc()' was, but is\naround 66%, and potentially much faster on some particular\noperating systems.  Tim Peters did much of the benchmarking and\ncoding for this change, motivated by a discussion in\ncomp.lang.python.\n\nA new module and method for file objects was also added,\ncontributed by Jeff Epler.  The new method, 'xreadlines()', is\nsimilar to the existing 'xrange()' built-in.  'xreadlines()'\nreturns an opaque sequence object that only supports being iterated\nover, reading a line on every iteration but not reading the entire\nfile into memory as the existing 'readlines()' method does.  You'd\nuse it like this:\n\nfor line in sys.stdin.xreadlines():\n# ... do something for each line ...\n...\n\nFor a fuller discussion of the line I/O changes, see the python-dev\nsummary for January 1-15, 2001 at\n'https://mail.python.org/pipermail/python-dev/2001-January/'.\n\n* A new method, *note popitem(): 1381, was added to dictionaries to\nenable destructively iterating through the contents of a\ndictionary; this can be faster for large dictionaries because\nthere's no need to construct a list containing all the keys or\nvalues.  'D.popitem()' removes a random '(key, value)' pair from\nthe dictionary 'D' and returns it as a 2-tuple.  This was\nimplemented mostly by Tim Peters and Guido van Rossum, after a\nsuggestion and preliminary patch by Moshe Zadka.\n\n* Modules can now control which names are imported when 'from module\nimport *' is used, by defining an 'all' attribute containing a\nlist of names that will be imported.  One common complaint is that\nif the module imports other modules such as *note sys: d3. or *note\nstring: cd, 'from module import *' will add them to the importing\nmodule's namespace.  To fix this, simply list the public names in\n'all':\n\n# List public names\nall = ['Database', 'open']\n\nA stricter version of this patch was first suggested and\nimplemented by Ben Wolfson, but after some python-dev discussion, a\nweaker final version was checked in.\n\n* Applying *note repr(): 5f0. to strings previously used octal\nescapes for non-printable characters; for example, a newline was\n''\\012''.  This was a vestigial trace of Python's C ancestry, but\ntoday octal is of very little practical use.  Ka-Ping Yee suggested\nusing hex escapes instead of octal ones, and using the '\\n', '\\t',\n'\\r' escapes for the appropriate characters, and implemented this\nnew formatting.\n\n* Syntax errors detected at compile-time can now raise exceptions\ncontaining the filename and line number of the error, a pleasant\nside effect of the compiler reorganization done by Jeremy Hylton.\n\n* C extensions which import other modules have been changed to use\n*note PyImportImportModule(): 325, which means that they will use\nany import hooks that have been installed.  This is also encouraged\nfor third-party extensions that need to import some other module\nfrom C code.\n\n* The size of the Unicode character database was shrunk by another\n340K thanks to Fredrik Lundh.\n\n* Some new ports were contributed: MacOS X (by Steven Majewski),\nCygwin (by Jason Tishler); RISCOS (by Dietmar Schwertberger);\nUnixware 7 (by Billy G. Allie).\n",
            "subsections": []
        },
        "And there's the usual list of minor bugfixes, minor memory leaks,": {
            "content": "docstring edits, and other tweaks, too lengthy to be worth itemizing;\nsee the CVS logs for the full details if you want them.\n\nFile: python3.12.info,  Node: Acknowledgements<7>,  Prev: Other Changes and Fixes<4>,  Up: What's New in Python 2 1\n\n",
            "subsections": []
        },
        "Goodger, Jay Graves, Michael Hudson, Marc-Andre' Lemburg, Fredrik Lundh,": {
            "content": "Neil Schemenauer, Thomas Wouters.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": [
                {
                    "name": "1.21 What's New in Python 2.0",
                    "content": ""
                }
            ]
        },
        "Author: A.M. Kuchling and Moshe Zadka": {
            "content": "* Menu:\n\n* Introduction: Introduction<3>.\n* What About Python 1.6?: What About Python 1 6?.\n* New Development Process::\n* Unicode: Unicode<2>.\n* List Comprehensions::\n* Augmented Assignment::\n* String Methods::\n* Garbage Collection of Cycles::\n* Other Core Changes::\n* Porting to 2.0: Porting to 2 0.\n* Extending/Embedding Changes::\n* Distutils; Making Modules Easy to Install: Distutils Making Modules Easy to Install.\n* XML Modules::\n* Module changes::\n* New modules::\n* IDLE Improvements::\n* Deleted and Deprecated Modules::\n* Acknowledgements: Acknowledgements<8>.\n\nFile: python3.12.info,  Node: Introduction<3>,  Next: What About Python 1 6?,  Up: What's New in Python 2 0\n\n\nA new release of Python, version 2.0, was released on October 16, 2000.",
            "subsections": []
        },
        "This article covers the exciting new features in 2.0, highlights some": {
            "content": "other useful changes, and points out a few incompatible changes that may\nrequire rewriting code.\n",
            "subsections": []
        },
        "Python's development never completely stops between releases, and a": {
            "content": "steady flow of bug fixes and improvements are always being submitted.  A\nhost of minor fixes, a few optimizations, additional docstrings, and\nbetter error messages went into 2.0; to list them all would be\nimpossible, but they're certainly significant.  Consult the publicly\navailable CVS logs if you want to see the full list.  This progress is\ndue to the five developers working for PythonLabs are now getting paid\nto spend their days fixing bugs, and also due to the improved\ncommunication resulting from moving to SourceForge.\n\nFile: python3.12.info,  Node: What About Python 1 6?,  Next: New Development Process,  Prev: Introduction<3>,  Up: What's New in Python 2 0\n\n",
            "subsections": []
        },
        "Python 1.6 can be thought of as the Contractual Obligations Python": {
            "content": "release.  After the core development team left CNRI in May 2000, CNRI\nrequested that a 1.6 release be created, containing all the work on",
            "subsections": []
        },
        "Python that had been performed at CNRI. Python 1.6 therefore represents": {
            "content": "the state of the CVS tree as of May 2000, with the most significant new\nfeature being Unicode support.  Development continued after May, of\ncourse, so the 1.6 tree received a few fixes to ensure that it's\nforward-compatible with Python 2.0.  1.6 is therefore part of Python's\nevolution, and not a side branch.\n\nSo, should you take much interest in Python 1.6?  Probably not.  The\n1.6final and 2.0beta1 releases were made on the same day (September 5,\n2000), the plan being to finalize Python 2.0 within a month or so.  If\nyou have applications to maintain, there seems little point in breaking\nthings by moving to 1.6, fixing them, and then having another round of\nbreakage within a month by moving to 2.0; you're better off just going\nstraight to 2.0.  Most of the really interesting features described in\nthis document are only in 2.0, because a lot of work was done between\nMay and September.\n\nFile: python3.12.info,  Node: New Development Process,  Next: Unicode<2>,  Prev: What About Python 1 6?,  Up: What's New in Python 2 0\n\n",
            "subsections": []
        },
        "The most important change in Python 2.0 may not be to the code at all,": {
            "content": "but to how Python is developed: in May 2000 the Python developers began\nusing the tools made available by SourceForge for storing source code,\ntracking bug reports, and managing the queue of patch submissions.  To\nreport bugs or submit patches for Python 2.0, use the bug tracking and\npatch manager tools available from Python's project page, located at\n'https://sourceforge.net/projects/python/'.\n",
            "subsections": []
        },
        "The most important of the services now hosted at SourceForge is the": {
            "content": "",
            "subsections": []
        },
        "Python CVS tree, the version-controlled repository containing the source": {
            "content": "code for Python.  Previously, there were roughly 7 or so people who had\nwrite access to the CVS tree, and all patches had to be inspected and\nchecked in by one of the people on this short list.  Obviously, this\nwasn't very scalable.  By moving the CVS tree to SourceForge, it became\npossible to grant write access to more people; as of September 2000\nthere were 27 people able to check in changes, a fourfold increase.",
            "subsections": []
        },
        "This makes possible large-scale changes that wouldn't be attempted if": {
            "content": "they'd have to be filtered through the small group of core developers.",
            "subsections": []
        },
        "For example, one day Peter Schneider-Kamp took it into his head to drop": {
            "content": "K&R C compatibility and convert the C source for Python to ANSI C. After\ngetting approval on the python-dev mailing list, he launched into a\nflurry of checkins that lasted about a week, other developers joined in\nto help, and the job was done.  If there were only 5 people with write\naccess, probably that task would have been viewed as \"nice, but not\nworth the time and effort needed\" and it would never have gotten done.\n",
            "subsections": []
        },
        "The shift to using SourceForge's services has resulted in a remarkable": {
            "content": "increase in the speed of development.  Patches now get submitted,\ncommented on, revised by people other than the original submitter, and\nbounced back and forth between people until the patch is deemed worth\nchecking in.  Bugs are tracked in one central location and can be\nassigned to a specific person for fixing, and we can count the number of\nopen bugs to measure progress.  This didn't come without a cost:\ndevelopers now have more e-mail to deal with, more mailing lists to\nfollow, and special tools had to be written for the new environment.",
            "subsections": []
        },
        "For example, SourceForge sends default patch and bug notification e-mail": {
            "content": "messages that are completely unhelpful, so Ka-Ping Yee wrote an HTML\nscreen-scraper that sends more useful messages.\n",
            "subsections": []
        },
        "The ease of adding code caused a few initial growing pains, such as code": {
            "content": "was checked in before it was ready or without getting clear agreement\nfrom the developer group.  The approval process that has emerged is\nsomewhat similar to that used by the Apache group.  Developers can vote\n+1, +0, -0, or -1 on a patch; +1 and -1 denote acceptance or rejection,\nwhile +0 and -0 mean the developer is mostly indifferent to the change,\nthough with a slight positive or negative slant.  The most significant\nchange from the Apache model is that the voting is essentially advisory,\nletting Guido van Rossum, who has Benevolent Dictator For Life status,\nknow what the general opinion is.  He can still ignore the result of a\nvote, and approve or reject a change even if the community disagrees\nwith him.\n",
            "subsections": []
        },
        "Producing an actual patch is the last step in adding a new feature, and": {
            "content": "is usually easy compared to the earlier task of coming up with a good\ndesign.  Discussions of new features can often explode into lengthy\nmailing list threads, making the discussion hard to follow, and no one\ncan read every posting to python-dev.  Therefore, a relatively formal\nprocess has been set up to write Python Enhancement Proposals (PEPs),\nmodelled on the internet RFC process.  PEPs are draft documents that\ndescribe a proposed new feature, and are continually revised until the\ncommunity reaches a consensus, either accepting or rejecting the\nproposal.  Quoting from the introduction to PEP 1(1), \"PEP Purpose and\nGuidelines\":\n\nPEP stands for Python Enhancement Proposal.  A PEP is a design\ndocument providing information to the Python community, or\ndescribing a new feature for Python.  The PEP should provide a\nconcise technical specification of the feature and a rationale for\nthe feature.\n\nWe intend PEPs to be the primary mechanisms for proposing new\nfeatures, for collecting community input on an issue, and for\ndocumenting the design decisions that have gone into Python.  The\nPEP author is responsible for building consensus within the\ncommunity and documenting dissenting opinions.\n",
            "subsections": []
        },
        "Read the rest of PEP 1(2) for the details of the PEP editorial process,": {
            "content": "style, and format.  PEPs are kept in the Python CVS tree on SourceForge,\nthough they're not part of the Python 2.0 distribution, and are also\navailable in HTML form from 'https://peps.python.org/'.  As of September\n2000, there are 25 PEPs, ranging from PEP 201(3), \"Lockstep Iteration\",\nto PEP 225, \"Elementwise/Objectwise Operators\".\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0001/\n\n(2) https://peps.python.org/pep-0001/\n\n(3) https://peps.python.org/pep-0201/\n\nFile: python3.12.info,  Node: Unicode<2>,  Next: List Comprehensions,  Prev: New Development Process,  Up: What's New in Python 2 0\n\n\nThe largest new feature in Python 2.0 is a new fundamental data type:",
            "subsections": []
        },
        "Unicode strings.  Unicode uses 16-bit numbers to represent characters": {
            "content": "instead of the 8-bit number used by ASCII, meaning that 65,536 distinct\ncharacters can be supported.\n",
            "subsections": []
        },
        "The final interface for Unicode support was arrived at through countless": {
            "content": "often-stormy discussions on the python-dev mailing list, and mostly\nimplemented by Marc-Andre' Lemburg, based on a Unicode string type\nimplementation by Fredrik Lundh.  A detailed explanation of the\ninterface was written up as PEP 100(1), \"Python Unicode Integration\".",
            "subsections": []
        },
        "This article will simply cover the most significant points about the": {
            "content": "Unicode interfaces.\n\nIn Python source code, Unicode strings are written as 'u\"string\"'.",
            "subsections": []
        },
        "Arbitrary Unicode characters can be written using a new escape sequence,": {
            "content": "'\\uHHHH', where 'HHHH' is a 4-digit hexadecimal number from 0000 to\nFFFF.  The existing '\\xHH' escape sequence can also be used, and octal\nescapes can be used for characters up to U+01FF, which is represented by\n'\\777'.\n",
            "subsections": []
        },
        "Unicode strings, just like regular strings, are an immutable sequence": {
            "content": "type.  They can be indexed and sliced, but not modified in place.\nUnicode strings have an 'encode( [encoding] )' method that returns an\n8-bit string in the desired encoding.  Encodings are named by strings,\nsuch as ''ascii'', ''utf-8'', ''iso-8859-1'', or whatever.  A codec API\nis defined for implementing and registering new encodings that are then\navailable throughout a Python program.  If an encoding isn't specified,\nthe default encoding is usually 7-bit ASCII, though it can be changed\nfor your Python installation by calling the\n'sys.setdefaultencoding(encoding)' function in a customized version of\n'site.py'.\n",
            "subsections": []
        },
        "Combining 8-bit and Unicode strings always coerces to Unicode, using the": {
            "content": "default ASCII encoding; the result of ''a' + u'bc'' is 'u'abc''.\n",
            "subsections": []
        },
        "New built-in functions have been added, and existing built-ins modified": {
            "content": "to support Unicode:\n\n* 'unichr(ch)' returns a Unicode string 1 character long, containing\nthe character 'ch'.\n\n* 'ord(u)', where 'u' is a 1-character regular or Unicode string,\nreturns the number of the character as an integer.\n\n* 'unicode(string [, encoding] [, errors] )' creates a Unicode string\nfrom an 8-bit string.  'encoding' is a string naming the encoding\nto use.  The 'errors' parameter specifies the treatment of\ncharacters that are invalid for the current encoding; passing\n''strict'' as the value causes an exception to be raised on any\nencoding error, while ''ignore'' causes errors to be silently\nignored and ''replace'' uses U+FFFD, the official replacement\ncharacter, in case of any problems.\n\n* The 'exec' statement, and various built-ins such as 'eval()',\n'getattr()', and 'setattr()' will also accept Unicode strings as\nwell as regular strings.  (It's possible that the process of fixing\nthis missed some built-ins; if you find a built-in function that\naccepts strings but doesn't accept Unicode strings at all, please\nreport it as a bug.)\n\nA new module, *note unicodedata: 100, provides an interface to Unicode\ncharacter properties.  For example, 'unicodedata.category(u'A')' returns\nthe 2-character string 'Lu', the 'L' denoting it's a letter, and 'u'\nmeaning that it's uppercase.  'unicodedata.bidirectional(u'\\u0660')'\nreturns 'AN', meaning that U+0660 is an Arabic number.\n\nThe *note codecs: 19. module contains functions to look up existing\nencodings and register new ones.  Unless you want to implement a new\nencoding, you'll most often use the 'codecs.lookup(encoding)' function,\nwhich returns a 4-element tuple: '(encodefunc, decodefunc,\nstreamreader, streamwriter)'.\n\n* 'encodefunc' is a function that takes a Unicode string, and\nreturns a 2-tuple '(string, length)'.  'string' is an 8-bit string\ncontaining a portion (perhaps all) of the Unicode string converted\ninto the given encoding, and 'length' tells you how much of the\nUnicode string was converted.\n\n* 'decodefunc' is the opposite of 'encodefunc', taking an 8-bit\nstring and returning a 2-tuple '(ustring, length)', consisting of\nthe resulting Unicode string 'ustring' and the integer 'length'\ntelling how much of the 8-bit string was consumed.\n\n* 'streamreader' is a class that supports decoding input from a\nstream.  'streamreader(fileobj)' returns an object that supports\nthe 'read()', 'readline()', and 'readlines()' methods.  These\nmethods will all translate from the given encoding and return\nUnicode strings.\n\n* 'streamwriter', similarly, is a class that supports encoding\noutput to a stream.  'streamwriter(fileobj)' returns an object\nthat supports the 'write()' and 'writelines()' methods.  These\nmethods expect Unicode strings, translating them to the given\nencoding on output.\n",
            "subsections": []
        },
        "For example, the following code writes a Unicode string into a file,": {
            "content": "encoding it as UTF-8:\n\nimport codecs\n\nunistr = u'\\u0660\\u2000ab ...'\n\n(UTF8encode, UTF8decode,\nUTF8streamreader, UTF8streamwriter) = codecs.lookup('UTF-8')\n\noutput = UTF8streamwriter( open( '/tmp/output', 'wb') )\noutput.write( unistr )\noutput.close()\n\nThe following code would then read UTF-8 input from the file:\n\ninput = UTF8streamreader( open( '/tmp/output', 'rb') )\nprint repr(input.read())\ninput.close()\n\nUnicode-aware regular expressions are available through the *note re:\nb4. module, which has a new underlying implementation called SRE written\nby Fredrik Lundh of Secret Labs AB.\n\nA '-U' command line option was added which causes the Python compiler to\ninterpret all string literals as Unicode string literals.  This is\nintended to be used in testing and future-proofing your Python code,\nsince some future version of Python may drop support for 8-bit strings\nand provide only Unicode strings.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0100/\n\nFile: python3.12.info,  Node: List Comprehensions,  Next: Augmented Assignment,  Prev: Unicode<2>,  Up: What's New in Python 2 0\n\n",
            "subsections": []
        },
        "Lists are a workhorse data type in Python, and many programs manipulate": {
            "content": "a list at some point.  Two common operations on lists are to loop over\nthem, and either pick out the elements that meet a certain criterion, or\napply some function to each element.  For example, given a list of\nstrings, you might want to pull out all the strings containing a given\nsubstring, or strip off trailing whitespace from each line.\n\nThe existing *note map(): 65f. and *note filter(): 660. functions can be\nused for this purpose, but they require a function as one of their\narguments.  This is fine if there's an existing built-in function that\ncan be passed directly, but if there isn't, you have to create a little\nfunction to do the required work, and Python's scoping rules make the\nresult ugly if the little function needs additional information.  Take\nthe first example in the previous paragraph, finding all the strings in\nthe list containing a given substring.  You could write the following to\ndo it:\n\n# Given the list L, make a list of all strings\n# containing the substring S.\nsublist = filter( lambda s, substring=S:\nstring.find(s, substring) != -1,\nL)\n",
            "subsections": []
        },
        "Because of Python's scoping rules, a default argument is used so that": {
            "content": "the anonymous function created by the *note lambda: 1115. expression\nknows what substring is being searched for.  List comprehensions make\nthis cleaner:\n\nsublist = [ s for s in L if string.find(s, S) != -1 ]\n\nList comprehensions have the form:\n\n[ expression for expr in sequence1\nfor expr2 in sequence2 ...\nfor exprN in sequenceN\nif condition ]\n",
            "subsections": []
        },
        "The 'for'...'in' clauses contain the sequences to be iterated over.  The": {
            "content": "sequences do not have to be the same length, because they are 'not'\niterated over in parallel, but from left to right; this is explained\nmore clearly in the following paragraphs.  The elements of the generated\nlist will be the successive values of 'expression'.  The final 'if'\nclause is optional; if present, 'expression' is only evaluated and added\nto the result if 'condition' is true.\n",
            "subsections": []
        },
        "To make the semantics very clear, a list comprehension is equivalent to": {
            "content": "the following Python code:\n\nfor expr1 in sequence1:\nfor expr2 in sequence2:\n...\nfor exprN in sequenceN:\nif (condition):\n# Append the value of\n# the expression to the\n# resulting list.\n",
            "subsections": []
        },
        "This means that when there are multiple 'for'...'in' clauses, the": {
            "content": "resulting list will be equal to the product of the lengths of all the\nsequences.  If you have two lists of length 3, the output list is 9\nelements long:\n\nseq1 = 'abc'\nseq2 = (1,2,3)\n>>> [ (x,y) for x in seq1 for y in seq2]\n[('a', 1), ('a', 2), ('a', 3), ('b', 1), ('b', 2), ('b', 3), ('c', 1),\n('c', 2), ('c', 3)]\n",
            "subsections": []
        },
        "To avoid introducing an ambiguity into Python's grammar, if 'expression'": {
            "content": "is creating a tuple, it must be surrounded with parentheses.  The first\nlist comprehension below is a syntax error, while the second one is\ncorrect:\n\n# Syntax error\n[x, y for x in seq1 for y in seq2]\n# Correct\n[(x, y) for x in seq1 for y in seq2]\n\nFile: python3.12.info,  Node: Generators<2>,  Next: Built-in functions<2>,  Prev: Generator expressions and list comprehensions,  Up: Functional Programming HOWTO\n\n",
            "subsections": []
        },
        "The idea of list comprehensions originally comes from the functional": {
            "content": "programming language Haskell ('https://www.haskell.org').  Greg Ewing\nargued most effectively for adding them to Python and wrote the initial\nlist comprehension patch, which was then discussed for a seemingly\nendless time on the python-dev mailing list and kept up-to-date by Skip\nMontanaro.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Augmented Assignment,  Next: String Methods,  Prev: List Comprehensions,  Up: What's New in Python 2 0": {
            "content": "",
            "subsections": []
        },
        "Augmented assignment operators, another long-requested feature, have": {
            "content": "been added to Python 2.0.  Augmented assignment operators include '+=',\n'-=', '*=', and so forth.  For example, the statement 'a += 2'\nincrements the value of the variable 'a' by 2, equivalent to the\nslightly lengthier 'a = a + 2'.\n\nThe full list of supported assignment operators is '+=', '-=', '*=',\n'/=', '%=', '=', '&=', '|=', '^=', '>>=', and '<<='.  Python classes\ncan override the augmented assignment operators by defining methods\nnamed 'iadd()', 'isub()', etc.  For example, the following\n'Number' class stores a number and supports using += to create a new\ninstance with an incremented value.\n\nclass Number:\ndef init(self, value):\nself.value = value\ndef iadd(self, increment):\nreturn Number( self.value + increment)\n\nn = Number(5)\nn += 3\nprint n.value\n",
            "subsections": []
        },
        "The 'iadd()' special method is called with the value of the": {
            "content": "increment, and should return a new instance with an appropriately\nmodified value; this return value is bound as the new value of the\nvariable on the left-hand side.\n",
            "subsections": []
        },
        "Augmented assignment operators were first introduced in the C": {
            "content": "programming language, and most C-derived languages, such as 'awk', C++,",
            "subsections": []
        },
        "Java, Perl, and PHP also support them.  The augmented assignment patch": {
            "content": "was implemented by Thomas Wouters.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: String Methods,  Next: Garbage Collection of Cycles,  Prev: Augmented Assignment,  Up: What's New in Python 2 0": {
            "content": "Until now string-manipulation functionality was in the *note string: cd.\nmodule, which was usually a front-end for the 'strop' module written in\nC. The addition of Unicode posed a difficulty for the 'strop' module,\nbecause the functions would all need to be rewritten in order to accept\neither 8-bit or Unicode strings.  For functions such as\n'string.replace()', which takes 3 string arguments, that means eight\npossible permutations, and correspondingly complicated code.\n",
            "subsections": []
        },
        "Instead, Python 2.0 pushes the problem onto the string type, making": {
            "content": "string manipulation functionality available through methods on both\n8-bit strings and Unicode strings.\n\n>>> 'andrew'.capitalize()\n'Andrew'\n>>> 'hostname'.replace('os', 'linux')\n'hlinuxtname'\n>>> 'moshe'.find('sh')\n2\n",
            "subsections": []
        },
        "One thing that hasn't changed, a noteworthy April Fools' joke": {
            "content": "notwithstanding, is that Python strings are immutable.  Thus, the string\nmethods return new strings, and do not modify the string on which they\noperate.\n\nThe old *note string: cd. module is still around for backwards\ncompatibility, but it mostly acts as a front-end to the new string\nmethods.\n",
            "subsections": []
        },
        "Two methods which have no parallel in pre-2.0 versions, although they": {
            "content": "did exist in JPython for quite some time, are 'startswith()' and\n'endswith()'.  's.startswith(t)' is equivalent to 's[:len(t)] == t',\nwhile 's.endswith(t)' is equivalent to 's[-len(t):] == t'.\n",
            "subsections": []
        },
        "One other method which deserves special mention is 'join()'.  The": {
            "content": "'join()' method of a string receives one parameter, a sequence of\nstrings, and is equivalent to the 'string.join()' function from the old\n*note string: cd. module, with the arguments reversed.  In other words,\n's.join(seq)' is equivalent to the old 'string.join(seq, s)'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Garbage Collection of Cycles,  Next: Other Core Changes,  Prev: String Methods,  Up: What's New in Python 2 0": {
            "content": "",
            "subsections": []
        },
        "The C implementation of Python uses reference counting to implement": {
            "content": "garbage collection.  Every Python object maintains a count of the number\nof references pointing to itself, and adjusts the count as references\nare created or destroyed.  Once the reference count reaches zero, the\nobject is no longer accessible, since you need to have a reference to an\nobject to access it, and if the count is zero, no references exist any\nlonger.\n",
            "subsections": []
        },
        "Reference counting has some pleasant properties: it's easy to understand": {
            "content": "and implement, and the resulting implementation is portable, fairly\nfast, and reacts well with other libraries that implement their own\nmemory handling schemes.  The major problem with reference counting is\nthat it sometimes doesn't realise that objects are no longer accessible,\nresulting in a memory leak.  This happens when there are cycles of\nreferences.\n",
            "subsections": []
        },
        "Consider the simplest possible cycle, a class instance which has a": {
            "content": "reference to itself:\n\ninstance = SomeClass()\ninstance.myself = instance\n",
            "subsections": []
        },
        "After the above two lines of code have been executed, the reference": {
            "content": "count of 'instance' is 2; one reference is from the variable named\n''instance'', and the other is from the 'myself' attribute of the\ninstance.\n\nIf the next line of code is 'del instance', what happens?  The reference\ncount of 'instance' is decreased by 1, so it has a reference count of 1;\nthe reference in the 'myself' attribute still exists.  Yet the instance\nis no longer accessible through Python code, and it could be deleted.",
            "subsections": []
        },
        "Several objects can participate in a cycle if they have references to": {
            "content": "each other, causing all of the objects to be leaked.\n",
            "subsections": []
        },
        "Python 2.0 fixes this problem by periodically executing a cycle": {
            "content": "detection algorithm which looks for inaccessible cycles and deletes the\nobjects involved.  A new *note gc: 5b. module provides functions to\nperform a garbage collection, obtain debugging statistics, and tuning\nthe collector's parameters.\n",
            "subsections": []
        },
        "Running the cycle detection algorithm takes some time, and therefore": {
            "content": "will result in some additional overhead.  It is hoped that after we've\ngotten experience with the cycle collection from using 2.0, Python 2.1\nwill be able to minimize the overhead with careful tuning.  It's not yet\nobvious how much performance is lost, because benchmarking this is\ntricky and depends crucially on how often the program creates and\ndestroys objects.  The detection of cycles can be disabled when Python\nis compiled, if you can't afford even a tiny speed penalty or suspect\nthat the cycle collection is buggy, by specifying the\n'--without-cycle-gc' switch when running the 'configure' script.\n",
            "subsections": []
        },
        "Several people tackled this problem and contributed to a solution.  An": {
            "content": "early implementation of the cycle detection approach was written by Toby",
            "subsections": []
        },
        "Kelsey.  The current algorithm was suggested by Eric Tiedemann during a": {
            "content": "visit to CNRI, and Guido van Rossum and Neil Schemenauer wrote two\ndifferent implementations, which were later integrated by Neil.  Lots of\nother people offered suggestions along the way; the March 2000 archives\nof the python-dev mailing list contain most of the relevant discussion,\nespecially in the threads titled \"Reference cycle collection for Python\"\nand \"Finalization again\".\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Other Core Changes,  Next: Porting to 2 0,  Prev: Garbage Collection of Cycles,  Up: What's New in Python 2 0": {
            "content": "",
            "subsections": []
        },
        "Various minor changes have been made to Python's syntax and built-in": {
            "content": "functions.  None of the changes are very far-reaching, but they're handy\nconveniences.\n\n* Menu:\n\n* Minor Language Changes::\n* Changes to Built-in Functions::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Minor Language Changes,  Next: Changes to Built-in Functions,  Up: Other Core Changes": {
            "content": "1.21.9.1 Minor Language Changes\n...............................\n\nA new syntax makes it more convenient to call a given function with a\ntuple of arguments and/or a dictionary of keyword arguments.  In Python\n1.5 and earlier, you'd use the 'apply()' built-in function: 'apply(f,\nargs, kw)' calls the function 'f()' with the argument tuple 'args' and\nthe keyword arguments in the dictionary 'kw'.  'apply()' is the same in\n2.0, but thanks to a patch from Greg Ewing, 'f(*args, kw)' is a\nshorter and clearer way to achieve the same effect.  This syntax is\nsymmetrical with the syntax for defining functions:\n\ndef f(*args, kw):\n# args is a tuple of positional args,\n# kw is a dictionary of keyword args\n...\n",
            "subsections": []
        },
        "The 'print' statement can now have its output directed to a file-like": {
            "content": "object by following the 'print' with '>> file', similar to the\nredirection operator in Unix shells.  Previously you'd either have to\nuse the 'write()' method of the file-like object, which lacks the\nconvenience and simplicity of 'print', or you could assign a new value\nto 'sys.stdout' and then restore the old value.  For sending output to\nstandard error, it's much easier to write this:\n\nprint >> sys.stderr, \"Warning: action field not supplied\"\n",
            "subsections": []
        },
        "Modules can now be renamed on importing them, using the syntax 'import": {
            "content": "module as name' or 'from module import name as othername'.  The patch\nwas submitted by Thomas Wouters.\n\nA new format style is available when using the '%' operator; '%r' will\ninsert the *note repr(): 5f0. of its argument.  This was also added from\nsymmetry considerations, this time for symmetry with the existing '%s'\nformat style, which inserts the *note str(): 157. of its argument.  For\nexample, ''%r %s' % ('abc', 'abc')' returns a string containing ''abc'\nabc'.\n",
            "subsections": []
        },
        "Previously there was no way to implement a class that overrode Python's": {
            "content": "built-in *note in: 250. operator and implemented a custom version.  'obj\nin seq' returns true if 'obj' is present in the sequence 'seq'; Python\ncomputes this by simply trying every index of the sequence until either\n'obj' is found or an *note IndexError: 138f. is encountered.  Moshe",
            "subsections": []
        },
        "Zadka contributed a patch which adds a 'contains()' magic method for": {
            "content": "providing a custom implementation for 'in'.  Additionally, new built-in\nobjects written in C can define what 'in' means for them via a new slot\nin the sequence protocol.\n",
            "subsections": []
        },
        "Earlier versions of Python used a recursive algorithm for deleting": {
            "content": "objects.  Deeply nested data structures could cause the interpreter to\nfill up the C stack and crash; Christian Tismer rewrote the deletion\nlogic to fix this problem.  On a related note, comparing recursive\nobjects recursed infinitely and crashed; Jeremy Hylton rewrote the code\nto no longer crash, producing a useful result instead.  For example,\nafter this code:\n\na = []\nb = []\na.append(a)\nb.append(b)\n\nThe comparison 'a==b' returns true, because the two recursive data\nstructures are isomorphic.  See the thread \"trashcan and PR#7\" in the",
            "subsections": []
        },
        "April 2000 archives of the python-dev mailing list for the discussion": {
            "content": "leading up to this implementation, and some useful relevant links.  Note\nthat comparisons can now also raise exceptions.  In earlier versions of",
            "subsections": []
        },
        "Python, a comparison operation such as 'cmp(a,b)' would always produce": {
            "content": "an answer, even if a user-defined 'cmp()' method encountered an\nerror, since the resulting exception would simply be silently swallowed.\n",
            "subsections": []
        },
        "Work has been done on porting Python to 64-bit Windows on the Itanium": {
            "content": "processor, mostly by Trent Mick of ActiveState.  (Confusingly,\n'sys.platform' is still ''win32'' on Win64 because it seems that for\nease of porting, MS Visual C++ treats code as 32 bit on Itanium.)",
            "subsections": []
        },
        "PythonWin also supports Windows CE; see the Python CE page at": {
            "content": "'https://pythonce.sourceforge.net/' for more information.\n",
            "subsections": []
        },
        "Another new platform is Darwin/MacOS X; initial support for it is in": {
            "content": "Python 2.0.  Dynamic loading works, if you specify \"configure -with-dyld\n-with-suffix=.x\".  Consult the README in the Python source distribution\nfor more instructions.\n",
            "subsections": []
        },
        "An attempt has been made to alleviate one of Python's warts, the": {
            "content": "often-confusing *note NameError: 144. exception when code refers to a\nlocal variable before the variable has been assigned a value.  For\nexample, the following code raises an exception on the 'print' statement\nin both 1.5.2 and 2.0; in 1.5.2 a *note NameError: 144. exception is\nraised, while 2.0 raises a new *note UnboundLocalError: 1390. exception.\n*note UnboundLocalError: 1390. is a subclass of *note NameError: 144, so\nany existing code that expects *note NameError: 144. to be raised should\nstill work.\n\ndef f():\nprint \"i=\",i\ni = i + 1\nf()\n\nTwo new exceptions, *note TabError: 29b. and *note IndentationError:\n59a, have been introduced.  They're both subclasses of *note",
            "subsections": []
        },
        "SyntaxError: 146, and are raised when Python code is found to be": {
            "content": "improperly indented.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Changes to Built-in Functions,  Prev: Minor Language Changes,  Up: Other Core Changes": {
            "content": "1.21.9.2 Changes to Built-in Functions\n......................................\n\nA new built-in, 'zip(seq1, seq2, ...)', has been added.  *note zip():\n5c2. returns a list of tuples where each tuple contains the i-th element\nfrom each of the argument sequences.  The difference between *note\nzip(): 5c2. and 'map(None, seq1, seq2)' is that *note map(): 65f. pads\nthe sequences with 'None' if the sequences aren't all of the same\nlength, while *note zip(): 5c2. truncates the returned list to the\nlength of the shortest argument sequence.\n\nThe *note int(): 17e. and 'long()' functions now accept an optional\n\"base\" parameter when the first argument is a string.  'int('123', 10)'\nreturns 123, while 'int('123', 16)' returns 291.  'int(123, 16)' raises\na *note TypeError: 28e. exception with the message \"can't convert\nnon-string with explicit base\".\n\nA new variable holding more detailed version information has been added\nto the *note sys: d3. module.  'sys.versioninfo' is a tuple '(major,\nminor, micro, level, serial)' For example, in a hypothetical 2.0.1beta1,\n'sys.versioninfo' would be '(2, 0, 1, 'beta', 1)'.  'level' is a string\nsuch as '\"alpha\"', '\"beta\"', or '\"final\"' for a final release.\n",
            "subsections": []
        },
        "Dictionaries have an odd new method, 'setdefault(key, default)', which": {
            "content": "behaves similarly to the existing 'get()' method.  However, if the key\nis missing, 'setdefault()' both returns the value of 'default' as\n'get()' would do, and also inserts it into the dictionary as the value\nfor 'key'.  Thus, the following lines of code:\n\nif dict.haskey( key ): return dict[key]\nelse:\ndict[key] = []\nreturn dict[key]\n\ncan be reduced to a single 'return dict.setdefault(key, [])' statement.\n",
            "subsections": []
        },
        "The interpreter sets a maximum recursion depth in order to catch runaway": {
            "content": "recursion before filling the C stack and causing a core dump or GPF..",
            "subsections": []
        },
        "Previously this limit was fixed when you compiled Python, but in 2.0 the": {
            "content": "maximum recursion depth can be read and modified using *note\nsys.getrecursionlimit(): 1e8. and *note sys.setrecursionlimit(): 1e7.",
            "subsections": []
        },
        "The default value is 1000, and a rough maximum value for a given": {
            "content": "platform can be found by running a new script,\n'Misc/findrecursionlimit.py'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Porting to 2 0,  Next: Extending/Embedding Changes,  Prev: Other Core Changes,  Up: What's New in Python 2 0": {
            "content": "",
            "subsections": []
        },
        "New Python releases try hard to be compatible with previous releases,": {
            "content": "and the record has been pretty good.  However, some changes are\nconsidered useful enough, usually because they fix initial design\ndecisions that turned out to be actively mistaken, that breaking\nbackward compatibility can't always be avoided.  This section lists the\nchanges in Python 2.0 that may cause old Python code to break.\n",
            "subsections": []
        },
        "The change which will probably break the most code is tightening up the": {
            "content": "arguments accepted by some methods.  Some methods would take multiple\narguments and treat them as a tuple, particularly various list methods\nsuch as 'append()' and 'insert()'.  In earlier versions of Python, if\n'L' is a list, 'L.append( 1,2 )' appends the tuple '(1,2)' to the list.\nIn Python 2.0 this causes a *note TypeError: 28e. exception to be\nraised, with the message: 'append requires exactly 1 argument; 2 given'.",
            "subsections": []
        },
        "The fix is to simply add an extra set of parentheses to pass both values": {
            "content": "as a tuple: 'L.append( (1,2) )'.\n",
            "subsections": []
        },
        "The earlier versions of these methods were more forgiving because they": {
            "content": "used an old function in Python's C interface to parse their arguments;\n2.0 modernizes them to use *note PyArgParseTuple(): 2d1, the current\nargument parsing function, which provides more helpful error messages\nand treats multi-argument calls as errors.  If you absolutely must use\n2.0 but can't fix your code, you can edit 'Objects/listobject.c' and\ndefine the preprocessor symbol 'NOSTRICTLISTAPPEND' to preserve the\nold behaviour; this isn't recommended.\n\nSome of the functions in the *note socket: c6. module are still\nforgiving in this way.  For example, 'socket.connect( ('hostname', 25)\n)' is the correct form, passing a tuple representing an IP address, but\n'socket.connect('hostname', 25)' also works.  *note socket.connectex:\n1393. and *note socket.bind: 1394. are similarly easy-going.  2.0alpha1\ntightened these functions up, but because the documentation actually\nused the erroneous multiple argument form, many people wrote code which\nwould break with the stricter checking.  GvR backed out the changes in\nthe face of public reaction, so for the *note socket: c6. module, the\ndocumentation was fixed and the multiple argument form is simply marked\nas deprecated; it 'will' be tightened up again in a future Python\nversion.\n\nThe '\\x' escape in string literals now takes exactly 2 hex digits.",
            "subsections": []
        },
        "Previously it would consume all the hex digits following the 'x' and": {
            "content": "take the lowest 8 bits of the result, so '\\x123456' was equivalent to\n'\\x56'.\n\nThe *note AttributeError: 395. and *note NameError: 144. exceptions have\na more friendly error message, whose text will be something like ''Spam'\ninstance has no attribute 'eggs'' or 'name 'eggs' is not defined'.",
            "subsections": []
        },
        "Previously the error message was just the missing attribute name 'eggs',": {
            "content": "and code written to take advantage of this fact will break in 2.0.\n",
            "subsections": []
        },
        "Some work has been done to make integers and long integers a bit more": {
            "content": "interchangeable.  In 1.5.2, large-file support was added for Solaris, to\nallow reading files larger than 2 GiB; this made the 'tell()' method of\nfile objects return a long integer instead of a regular integer.  Some\ncode would subtract two file offsets and attempt to use the result to\nmultiply a sequence or slice a string, but this raised a *note",
            "subsections": []
        },
        "TypeError: 28e.  In 2.0, long integers can be used to multiply or slice": {
            "content": "a sequence, and it'll behave as you'd intuitively expect it to; '3L *\n'abc'' produces 'abcabcabc', and '(0,1,2,3)[2L:4L]' produces (2,3).",
            "subsections": []
        },
        "Long integers can also be used in various contexts where previously only": {
            "content": "integers were accepted, such as in the 'seek()' method of file objects,\nand in the formats supported by the '%' operator ('%d', '%i', '%x',\netc.).  For example, '\"%d\" % 2L64' will produce the string\n'18446744073709551616'.\n\nThe subtlest long integer change of all is that the *note str(): 157. of\na long integer no longer has a trailing 'L' character, though *note\nrepr(): 5f0. still includes it.  The 'L' annoyed many people who wanted\nto print long integers that looked just like regular integers, since\nthey had to go out of their way to chop off the character.  This is no\nlonger a problem in 2.0, but code which does 'str(longval)[:-1]' and\nassumes the 'L' is there, will now lose the final digit.\n\nTaking the *note repr(): 5f0. of a float now uses a different formatting\nprecision than *note str(): 157.  *note repr(): 5f0. uses '%.17g' format\nstring for C's 'sprintf()', while *note str(): 157. uses '%.12g' as\nbefore.  The effect is that *note repr(): 5f0. may occasionally show\nmore decimal places than *note str(): 157, for certain numbers.  For\nexample, the number 8.1 can't be represented exactly in binary, so\n'repr(8.1)' is ''8.0999999999999996'', while str(8.1) is ''8.1''.\n",
            "subsections": []
        },
        "The '-X' command-line option, which turned all standard exceptions into": {
            "content": "strings instead of classes, has been removed; the standard exceptions\nwill now always be classes.  The 'exceptions' module containing the\nstandard exceptions was translated from Python to a built-in C module,\nwritten by Barry Warsaw and Fredrik Lundh.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "Some of the changes are under the covers, and will only be apparent to": {
            "content": "people writing C extension modules or embedding a Python interpreter in\na larger application.  If you aren't dealing with Python's C API, you\ncan safely skip this section.\n",
            "subsections": []
        },
        "The version number of the Python C API was incremented, so C extensions": {
            "content": "compiled for 1.5.2 must be recompiled in order to work with 2.0.  On",
            "subsections": []
        },
        "Windows, it's not possible for Python 2.0 to import a third party": {
            "content": "extension built for Python 1.5.x due to how Windows DLLs work, so Python\nwill raise an exception and the import will fail.\n",
            "subsections": []
        },
        "Users of Jim Fulton's ExtensionClass module will be pleased to find out": {
            "content": "that hooks have been added so that ExtensionClasses are now supported by\n*note isinstance(): 14b. and *note issubclass(): 5b4.  This means you no\nlonger have to remember to write code such as 'if type(obj) ==\nmyExtensionClass', but can use the more natural 'if isinstance(obj,\nmyExtensionClass)'.\n\nThe 'Python/importdl.c' file, which was a mass of #ifdefs to support\ndynamic loading on many different platforms, was cleaned up and\nreorganised by Greg Stein.  'importdl.c' is now quite small, and\nplatform-specific code has been moved into a bunch of\n'Python/dynload*.c' files.  Another cleanup: there were also a number\nof 'my*.h' files in the Include/ directory that held various portability\nhacks; they've been merged into a single file, 'Include/pyport.h'.\n",
            "subsections": []
        },
        "Vladimir Marangozov's long-awaited malloc restructuring was completed,": {
            "content": "to make it easy to have the Python interpreter use a custom allocator\ninstead of C's standard 'malloc()'.  For documentation, read the\ncomments in 'Include/pymem.h' and 'Include/objimpl.h'.  For the lengthy\ndiscussions during which the interface was hammered out, see the web\narchives of the 'patches' and 'python-dev' lists at python.org.\n",
            "subsections": []
        },
        "Recent versions of the GUSI development environment for MacOS support": {
            "content": "POSIX threads.  Therefore, Python's POSIX threading support now works on\nthe Macintosh.  Threading support using the user-space GNU 'pth' library\nwas also contributed.\n",
            "subsections": []
        },
        "Threading support on Windows was enhanced, too.  Windows supports thread": {
            "content": "locks that use kernel objects only in case of contention; in the common\ncase when there's no contention, they use simpler functions which are an\norder of magnitude faster.  A threaded version of Python 1.5.2 on NT is\ntwice as slow as an unthreaded version; with the 2.0 changes, the\ndifference is only 10%.  These improvements were contributed by Yakov\nMarkovitch.\n",
            "subsections": []
        },
        "Python 2.0's source now uses only ANSI C prototypes, so compiling Python": {
            "content": "now requires an ANSI C compiler, and can no longer be done using a\ncompiler that only supports K&R C.\n",
            "subsections": []
        },
        "Previously the Python virtual machine used 16-bit numbers in its": {
            "content": "bytecode, limiting the size of source files.  In particular, this\naffected the maximum size of literal lists and dictionaries in Python\nsource; occasionally people who are generating Python code would run\ninto this limit.  A patch by Charles G. Waldman raises the limit from\n'216' to '232'.\n",
            "subsections": []
        },
        "Three new convenience functions intended for adding constants to a": {
            "content": "module's dictionary at module initialization time were added: *note\nPyModuleAddObject(): 6aa, *note PyModuleAddIntConstant(): 1396, and\n*note PyModuleAddStringConstant(): 1397.  Each of these functions takes\na module object, a null-terminated C string containing the name to be\nadded, and a third argument for the value to be assigned to the name.",
            "subsections": []
        },
        "This third argument is, respectively, a Python object, a C long, or a C": {
            "content": "string.\n\nA wrapper API was added for Unix-style signal handlers.  *note\nPyOSgetsig(): 1398. gets a signal handler and *note PyOSsetsig():\n1399. will set a new handler.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Distutils Making Modules Easy to Install,  Next: XML Modules,  Prev: Extending/Embedding Changes,  Up: What's New in Python 2 0": {
            "content": "",
            "subsections": []
        },
        "Before Python 2.0, installing modules was a tedious affair - there was": {
            "content": "no way to figure out automatically where Python is installed, or what\ncompiler options to use for extension modules.  Software authors had to\ngo through an arduous ritual of editing Makefiles and configuration\nfiles, which only really work on Unix and leave Windows and MacOS\nunsupported.  Python users faced wildly differing installation\ninstructions which varied between different extension packages, which\nmade administering a Python installation something of a chore.\n",
            "subsections": []
        },
        "The SIG for distribution utilities, shepherded by Greg Ward, has created": {
            "content": "the Distutils, a system to make package installation much easier.  They\nform the 'distutils' package, a new part of Python's standard library.",
            "subsections": []
        },
        "In the best case, installing a Python module from source will require": {
            "content": "the same steps: first you simply mean unpack the tarball or zip archive,\nand the run \"'python setup.py install'\".  The platform will be\nautomatically detected, the compiler will be recognized, C extension\nmodules will be compiled, and the distribution installed into the proper\ndirectory.  Optional command-line arguments provide more control over\nthe installation process, the distutils package offers many places to\noverride defaults - separating the build from the install, building or\ninstalling in non-default directories, and more.\n\nIn order to use the Distutils, you need to write a 'setup.py' script.",
            "subsections": []
        },
        "For the simple case, when the software contains only .py files, a": {
            "content": "minimal 'setup.py' can be just a few lines long:\n\nfrom distutils.core import setup\nsetup (name = \"foo\", version = \"1.0\",\npymodules = [\"module1\", \"module2\"])\n",
            "subsections": []
        },
        "The 'setup.py' file isn't much more complicated if the software consists": {
            "content": "of a few packages:\n\nfrom distutils.core import setup\nsetup (name = \"foo\", version = \"1.0\",\npackages = [\"package\", \"package.subpackage\"])\n\nA C extension can be the most complicated case; here's an example taken\nfrom the PyXML package:\n\nfrom distutils.core import setup, Extension\n\nexpatextension = Extension('xml.parsers.pyexpat',\ndefinemacros = [('XMLNS', None)],\nincludedirs = [ 'extensions/expat/xmltok',\n'extensions/expat/xmlparse' ],\nsources = [ 'extensions/pyexpat.c',\n'extensions/expat/xmltok/xmltok.c',\n'extensions/expat/xmltok/xmlrole.c', ]\n)\nsetup (name = \"PyXML\", version = \"0.5.4\",\nextmodules =[ expatextension ] )\n",
            "subsections": []
        },
        "The Distutils can also take care of creating source and binary": {
            "content": "distributions.  The \"sdist\" command, run by \"'python setup.py sdist'',\nbuilds a source distribution such as 'foo-1.0.tar.gz'.  Adding new\ncommands isn't difficult, \"bdistrpm\" and \"bdistwininst\" commands have\nalready been contributed to create an RPM distribution and a Windows\ninstaller for the software, respectively.  Commands to create other\ndistribution formats such as Debian packages and Solaris '.pkg' files\nare in various stages of development.\n",
            "subsections": []
        },
        "All this is documented in a new manual, 'Distributing Python Modules',": {
            "content": "that joins the basic set of Python documentation.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: XML Modules,  Next: Module changes,  Prev: Distutils Making Modules Easy to Install,  Up: What's New in Python 2 0": {
            "content": "",
            "subsections": []
        },
        "Python 1.5.2 included a simple XML parser in the form of the 'xmllib'": {
            "content": "module, contributed by Sjoerd Mullender.  Since 1.5.2's release, two\ndifferent interfaces for processing XML have become common: SAX2\n(version 2 of the Simple API for XML) provides an event-driven interface\nwith some similarities to 'xmllib', and the DOM (Document Object Model)\nprovides a tree-based interface, transforming an XML document into a\ntree of nodes that can be traversed and modified.  Python 2.0 includes a\nSAX2 interface and a stripped-down DOM interface as part of the *note\nxml: 11b. package.  Here we will give a brief overview of these new\ninterfaces; consult the Python documentation or the source code for\ncomplete details.  The Python XML SIG is also working on improved\ndocumentation.\n\n* Menu:\n\n* SAX2 Support::\n* DOM Support::\n* Relationship to PyXML::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: SAX2 Support,  Next: DOM Support,  Up: XML Modules": {
            "content": "1.21.13.1 SAX2 Support\n......................\n\nSAX defines an event-driven interface for parsing XML. To use SAX, you\nmust write a SAX handler class.  Handler classes inherit from various\nclasses provided by SAX, and override various methods that will then be\ncalled by the XML parser.  For example, the *note startElement(): 139d.\nand *note endElement(): 139e. methods are called for every starting and\nend tag encountered by the parser, the *note characters(): 139f. method\nis called for every chunk of character data, and so forth.\n",
            "subsections": []
        },
        "The advantage of the event-driven approach is that the whole document": {
            "content": "doesn't have to be resident in memory at any one time, which matters if\nyou are processing really huge documents.  However, writing the SAX\nhandler class can get very complicated if you're trying to modify the\ndocument structure in some elaborate way.\n",
            "subsections": []
        },
        "For example, this little example program defines a handler that prints a": {
            "content": "message for every starting and ending tag, and then parses the file\n'hamlet.xml' using it:\n\nfrom xml import sax\n\nclass SimpleHandler(sax.ContentHandler):\ndef startElement(self, name, attrs):\nprint 'Start of element:', name, attrs.keys()\n\ndef endElement(self, name):\nprint 'End of element:', name\n\n# Create a parser object\nparser = sax.makeparser()\n\n# Tell it what handler to use\nhandler = SimpleHandler()\nparser.setContentHandler( handler )\n\n# Parse a file!\nparser.parse( 'hamlet.xml' )\n",
            "subsections": []
        },
        "For more information, consult the Python documentation, or the XML HOWTO": {
            "content": "at 'https://pyxml.sourceforge.net/topics/howto/xml-howto.html'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: DOM Support,  Next: Relationship to PyXML,  Prev: SAX2 Support,  Up: XML Modules": {
            "content": "1.21.13.2 DOM Support\n.....................\n",
            "subsections": []
        },
        "The Document Object Model is a tree-based representation for an XML": {
            "content": "document.  A top-level 'Document' instance is the root of the tree, and\nhas a single child which is the top-level 'Element' instance.  This\n'Element' has children nodes representing character data and any\nsub-elements, which may have further children of their own, and so\nforth.  Using the DOM you can traverse the resulting tree any way you\nlike, access element and attribute values, insert and delete nodes, and\nconvert the tree back into XML.\n",
            "subsections": []
        },
        "The DOM is useful for modifying XML documents, because you can create a": {
            "content": "DOM tree, modify it by adding new nodes or rearranging subtrees, and\nthen produce a new XML document as output.  You can also construct a DOM\ntree manually and convert it to XML, which can be a more flexible way of\nproducing XML output than simply writing '<tag1>'...'</tag1>' to a file.\n\nThe DOM implementation included with Python lives in the *note\nxml.dom.minidom: 11d. module.  It's a lightweight implementation of the",
            "subsections": []
        },
        "Level 1 DOM with support for XML namespaces.  The 'parse()' and": {
            "content": "'parseString()' convenience functions are provided for generating a DOM\ntree:\n\nfrom xml.dom import minidom\ndoc = minidom.parse('hamlet.xml')\n\n'doc' is a 'Document' instance.  'Document', like all the other DOM\nclasses such as 'Element' and 'Text', is a subclass of the 'Node' base\nclass.  All the nodes in a DOM tree therefore support certain common\nmethods, such as 'toxml()' which returns a string containing the XML\nrepresentation of the node and its children.  Each class also has\nspecial methods of its own; for example, 'Element' and 'Document'\ninstances have a method to find all child elements with a given tag\nname.  Continuing from the previous 2-line example:\n\nperslist = doc.getElementsByTagName( 'PERSONA' )\nprint perslist[0].toxml()\nprint perslist[1].toxml()\n\nFor the 'Hamlet' XML file, the above few lines output:\n\n<PERSONA>CLAUDIUS, king of Denmark. </PERSONA>\n<PERSONA>HAMLET, son to the late, and nephew to the present king.</PERSONA>\n",
            "subsections": []
        },
        "The root element of the document is available as 'doc.documentElement',": {
            "content": "and its children can be easily modified by deleting, adding, or removing\nnodes:\n\nroot = doc.documentElement\n\n# Remove the first child\nroot.removeChild( root.childNodes[0] )\n\n# Move the new first child to the end\nroot.appendChild( root.childNodes[0] )\n\n# Insert the new first child (originally,\n# the third child) before the 20th child.\nroot.insertBefore( root.childNodes[0], root.childNodes[20] )\n",
            "subsections": []
        },
        "Again, I will refer you to the Python documentation for a complete": {
            "content": "listing of the different 'Node' classes and their various methods.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Relationship to PyXML,  Prev: DOM Support,  Up: XML Modules": {
            "content": "1.21.13.3 Relationship to PyXML\n...............................\n",
            "subsections": []
        },
        "The XML Special Interest Group has been working on XML-related Python": {
            "content": "code for a while.  Its code distribution, called PyXML, is available\nfrom the SIG's web pages at\n'https://www.python.org/community/sigs/current/xml-sig'.  The PyXML\ndistribution also used the package name 'xml'.  If you've written\nprograms that used PyXML, you're probably wondering about its\ncompatibility with the 2.0 *note xml: 11b. package.\n\nThe answer is that Python 2.0's *note xml: 11b. package isn't compatible\nwith PyXML, but can be made compatible by installing a recent version",
            "subsections": []
        },
        "PyXML. Many applications can get by with the XML support that is": {
            "content": "included with Python 2.0, but more complicated applications will require\nthat the full PyXML package will be installed.  When installed, PyXML\nversions 0.6.0 or greater will replace the *note xml: 11b. package\nshipped with Python, and will be a strict superset of the standard\npackage, adding a bunch of additional features.  Some of the additional\nfeatures in PyXML include:\n\n* 4DOM, a full DOM implementation from FourThought, Inc.\n\n* The xmlproc validating parser, written by Lars Marius Garshol.\n\n* The 'sgmlop' parser accelerator module, written by Fredrik Lundh.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Module changes,  Next: New modules,  Prev: XML Modules,  Up: What's New in Python 2 0": {
            "content": "",
            "subsections": []
        },
        "Lots of improvements and bugfixes were made to Python's extensive": {
            "content": "standard library; some of the affected modules include *note readline:\nb5, *note ConfigParser: 20, *note cgi: 13, *note calendar: 12, *note\nposix: a8, *note readline: b5, 'xmllib', *note aifc: 5, *note chunk: 15.\n*note wave: 10e, *note random: b3, *note shelve: be, and *note nntplib:\n98.  Consult the CVS logs for the exact patch-by-patch details.\n\nBrian Gallew contributed OpenSSL support for the *note socket: c6.\nmodule.  OpenSSL is an implementation of the Secure Socket Layer, which\nencrypts the data being sent over a socket.  When compiling Python, you\ncan edit 'Modules/Setup' to include SSL support, which adds an\nadditional function to the *note socket: c6. module: 'socket.ssl(socket,\nkeyfile, certfile)', which takes a socket object and returns an SSL\nsocket.  The *note httplib: 69. and *note urllib: 103. modules were also\nchanged to support 'https://' URLs, though no one has implemented FTP or\nSMTP over SSL.\n\nThe *note httplib: 69. module has been rewritten by Greg Stein to\nsupport HTTP/1.1.\n",
            "subsections": []
        },
        "Backward compatibility with the 1.5 version of 'httplib' is provided,": {
            "content": "though using HTTP/1.1 features such as pipelining will require rewriting\ncode to use a different set of interfaces.\n",
            "subsections": []
        },
        "The 'Tkinter' module now supports Tcl/Tk version 8.1, 8.2, or 8.3, and": {
            "content": "support for the older 7.x versions has been dropped.  The Tkinter module\nnow supports displaying Unicode strings in Tk widgets.  Also, Fredrik",
            "subsections": []
        },
        "Lundh contributed an optimization which makes operations like": {
            "content": "'createline' and 'createpolygon' much faster, especially when using\nlots of coordinates.\n\nThe *note curses: 29. module has been greatly extended, starting from",
            "subsections": []
        },
        "Oliver Andrich's enhanced version, to provide many additional functions": {
            "content": "from ncurses and SYSV curses, such as colour, alternative character set\nsupport, pads, and mouse support.  This means the module is no longer\ncompatible with operating systems that only have BSD curses, but there\ndon't seem to be any currently maintained OSes that fall into this\ncategory.\n",
            "subsections": []
        },
        "As mentioned in the earlier discussion of 2.0's Unicode support, the": {
            "content": "underlying implementation of the regular expressions provided by the\n*note re: b4. module has been changed.  SRE, a new regular expression\nengine written by Fredrik Lundh and partially funded by Hewlett Packard,\nsupports matching against both 8-bit strings and Unicode strings.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: New modules,  Next: IDLE Improvements,  Prev: Module changes,  Up: What's New in Python 2 0": {
            "content": "A number of new modules were added.  We'll simply list them with brief\ndescriptions; consult the 2.0 documentation for the details of a\nparticular module.\n\n* *note atexit: a.: For registering functions to be called before the\nPython interpreter exits.  Code that currently sets 'sys.exitfunc'\ndirectly should be changed to use the *note atexit: a. module\ninstead, importing *note atexit: a. and calling *note\natexit.register(): 689. with the function to be called on exit.\n(Contributed by Skip Montanaro.)\n\n* *note codecs: 19, 'encodings', *note unicodedata: 100.: Added as\npart of the new Unicode support.\n\n* *note filecmp: 55.: Supersedes the old 'cmp', 'cmpcache' and\n'dircmp' modules, which have now become deprecated.  (Contributed\nby Gordon MacMillan and Moshe Zadka.)\n\n* *note gettext: 5e.: This module provides internationalization\n(I18N) and localization (L10N) support for Python programs by\nproviding an interface to the GNU gettext message catalog library.\n(Integrated by Barry Warsaw, from separate contributions by Martin\nvon Lo\"wis, Peter Funk, and James Henstridge.)\n\n* 'linuxaudiodev': Support for the '/dev/audio' device on Linux, a\ntwin to the existing 'sunaudiodev' module.  (Contributed by Peter\nBosch, with fixes by Jeremy Hylton.)\n\n* *note mmap: 8b.: An interface to memory-mapped files on both\nWindows and Unix.  A file's contents can be mapped directly into\nmemory, at which point it behaves like a mutable string, so its\ncontents can be read and modified.  They can even be passed to\nfunctions that expect ordinary strings, such as the *note re: b4.\nmodule.  (Contributed by Sam Rushing, with some extensions by A.M.\nKuchling.)\n\n* 'pyexpat': An interface to the Expat XML parser.  (Contributed by\nPaul Prescod.)\n\n* *note robotparser: 108.: Parse a 'robots.txt' file, which is used\nfor writing web spiders that politely avoid certain areas of a web\nsite.  The parser accepts the contents of a 'robots.txt' file,\nbuilds a set of rules from it, and can then answer questions about\nthe fetchability of a given URL. (Contributed by Skip Montanaro.)\n\n* *note tabnanny: d7.: A module/script to check Python source code\nfor ambiguous indentation.  (Contributed by Tim Peters.)\n\n* 'UserString': A base class useful for deriving objects that behave\nlike strings.\n\n* *note webbrowser: 110.: A module that provides a platform\nindependent way to launch a web browser on a specific URL. For each\nplatform, various browsers are tried in a specific order.  The user\ncan alter which browser is launched by setting the 'BROWSER'\nenvironment variable.  (Originally inspired by Eric S. Raymond's\npatch to *note urllib: 103. which added similar functionality, but\nthe final module comes from code originally implemented by Fred\nDrake as 'Tools/idle/BrowserControl.py', and adapted for the\nstandard library by Fred.)\n\n* *note winreg: 111.: An interface to the Windows registry.\n'winreg' is an adaptation of functions that have been part of\nPythonWin since 1995, but has now been added to the core\ndistribution, and enhanced to support Unicode.  'winreg' was\nwritten by Bill Tutt and Mark Hammond.\n\n* *note zipfile: 12b.: A module for reading and writing ZIP-format\narchives.  These are archives produced by 'PKZIP' on DOS/Windows or\n'zip' on Unix, not to be confused with 'gzip'-format files (which\nare supported by the *note gzip: 62. module) (Contributed by James\nC. Ahlstrom.)\n\n* 'imputil': A module that provides a simpler way for writing\ncustomized import hooks, in comparison to the existing 'ihooks'\nmodule.  (Implemented by Greg Stein, with much discussion on\npython-dev along the way.)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: IDLE Improvements,  Next: Deleted and Deprecated Modules,  Prev: New modules,  Up: What's New in Python 2 0": {
            "content": "IDLE is the official Python cross-platform IDE, written using Tkinter.",
            "subsections": []
        },
        "Python 2.0 includes IDLE 0.6, which adds a number of new features and": {
            "content": "improvements.  A partial list:\n\n* UI improvements and optimizations, especially in the area of syntax\nhighlighting and auto-indentation.\n\n* The class browser now shows more information, such as the top level\nfunctions in a module.\n\n* Tab width is now a user settable option.  When opening an existing\nPython file, IDLE automatically detects the indentation\nconventions, and adapts.\n\n* There is now support for calling browsers on various platforms,\nused to open the Python documentation in a browser.\n\n* IDLE now has a command line, which is largely similar to the\nvanilla Python interpreter.\n\n* Call tips were added in many places.\n\n* IDLE can now be installed as a package.\n\n* In the editor window, there is now a line/column bar at the bottom.\n\n* Three new keystroke commands: Check module ('Alt-F5'), Import\nmodule ('F5') and Run script ('Ctrl-F5').\n\nFile: python3.12.info,  Node: Deleted and Deprecated Modules,  Next: Acknowledgements<8>,  Prev: IDLE Improvements,  Up: What's New in Python 2 0\n\n\nA few modules have been dropped because they're obsolete, or because\nthere are now better ways to do the same thing.  The 'stdwin' module is\ngone; it was for a platform-independent windowing toolkit that's no\nlonger developed.\n\nA number of modules have been moved to the 'lib-old' subdirectory:\n'cmp', 'cmpcache', 'dircmp', 'dump', 'find', 'grep', 'packmail', 'poly',\n'util', 'whatsound', 'zmod'.  If you have code which relies on a module\nthat's been moved to 'lib-old', you can simply add that directory to\n'sys.path' to get them back, but you're encouraged to update any code\nthat uses these modules.\n\nFile: python3.12.info,  Node: Acknowledgements<8>,  Prev: Deleted and Deprecated Modules,  Up: What's New in Python 2 0\n\n",
            "subsections": []
        },
        "The authors would like to thank the following people for offering": {
            "content": "suggestions on various drafts of this article: David Bolen, Mark",
            "subsections": []
        },
        "Hammond, Gregg Hauser, Jeremy Hylton, Fredrik Lundh, Detlef Lannert,": {
            "content": "",
            "subsections": []
        },
        "Aahz Maruch, Skip Montanaro, Vladimir Marangozov, Tobias Polzin, Guido": {
            "content": "van Rossum, Neil Schemenauer, and Russ Schmidt.\n\nThe \"Changelog\" is an HTML version of the file built(1) from the\ncontents of the Misc/NEWS.d(2) directory tree, which contains 'all'\nnontrivial changes to Python for the current version.\n\n---------- Footnotes ----------\n\n(1) https://pypi.org/project/blurb\n\n(2) https://github.com/python/cpython/tree/3.12/Misc/NEWS.d\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Changelog,  Prev: What's New in Python 2 0,  Up: What's New in Python": {
            "content": "",
            "subsections": [
                {
                    "name": "1.22 Changelog",
                    "content": "* Menu:\n\n* Python 3.12.3 final: Python 3 12 3 final.\n* Python 3.12.2 final: Python 3 12 2 final.\n* Python 3.12.1 final: Python 3 12 1 final.\n* Python 3.12.0 final: Python 3 12 0 final.\n* Python 3.12.0 release candidate 3: Python 3 12 0 release candidate 3.\n* Python 3.12.0 release candidate 2: Python 3 12 0 release candidate 2.\n* Python 3.12.0 release candidate 1: Python 3 12 0 release candidate 1.\n* Python 3.12.0 beta 4: Python 3 12 0 beta 4.\n* Python 3.12.0 beta 3: Python 3 12 0 beta 3.\n* Python 3.12.0 beta 2: Python 3 12 0 beta 2.\n* Python 3.12.0 beta 1: Python 3 12 0 beta 1.\n* Python 3.12.0 alpha 7: Python 3 12 0 alpha 7.\n* Python 3.12.0 alpha 6: Python 3 12 0 alpha 6.\n* Python 3.12.0 alpha 5: Python 3 12 0 alpha 5.\n* Python 3.12.0 alpha 4: Python 3 12 0 alpha 4.\n* Python 3.12.0 alpha 3: Python 3 12 0 alpha 3.\n* Python 3.12.0 alpha 2: Python 3 12 0 alpha 2.\n* Python 3.12.0 alpha 1: Python 3 12 0 alpha 1.\n* Python 3.11.0 beta 1: Python 3 11 0 beta 1.\n* Python 3.11.0 alpha 7: Python 3 11 0 alpha 7.\n* Python 3.11.0 alpha 6: Python 3 11 0 alpha 6.\n* Python 3.11.0 alpha 5: Python 3 11 0 alpha 5.\n* Python 3.11.0 alpha 4: Python 3 11 0 alpha 4.\n* Python 3.11.0 alpha 3: Python 3 11 0 alpha 3.\n* Python 3.11.0 alpha 2: Python 3 11 0 alpha 2.\n* Python 3.11.0 alpha 1: Python 3 11 0 alpha 1.\n* Python 3.10.0 beta 1: Python 3 10 0 beta 1.\n* Python 3.10.0 alpha 7: Python 3 10 0 alpha 7.\n* Python 3.10.0 alpha 6: Python 3 10 0 alpha 6.\n* Python 3.10.0 alpha 5: Python 3 10 0 alpha 5.\n* Python 3.10.0 alpha 4: Python 3 10 0 alpha 4.\n* Python 3.10.0 alpha 3: Python 3 10 0 alpha 3.\n* Python 3.10.0 alpha 2: Python 3 10 0 alpha 2.\n* Python 3.10.0 alpha 1: Python 3 10 0 alpha 1.\n* Python 3.9.0 beta 1: Python 3 9 0 beta 1.\n* Python 3.9.0 alpha 6: Python 3 9 0 alpha 6.\n* Python 3.9.0 alpha 5: Python 3 9 0 alpha 5.\n* Python 3.9.0 alpha 4: Python 3 9 0 alpha 4.\n* Python 3.9.0 alpha 3: Python 3 9 0 alpha 3.\n* Python 3.9.0 alpha 2: Python 3 9 0 alpha 2.\n* Python 3.9.0 alpha 1: Python 3 9 0 alpha 1.\n* Python 3.8.0 beta 1: Python 3 8 0 beta 1.\n* Python 3.8.0 alpha 4: Python 3 8 0 alpha 4.\n* Python 3.8.0 alpha 3: Python 3 8 0 alpha 3.\n* Python 3.8.0 alpha 2: Python 3 8 0 alpha 2.\n* Python 3.8.0 alpha 1: Python 3 8 0 alpha 1.\n* Python 3.7.0 final: Python 3 7 0 final.\n* Python 3.7.0 release candidate 1: Python 3 7 0 release candidate 1.\n* Python 3.7.0 beta 5: Python 3 7 0 beta 5.\n* Python 3.7.0 beta 4: Python 3 7 0 beta 4.\n* Python 3.7.0 beta 3: Python 3 7 0 beta 3.\n* Python 3.7.0 beta 2: Python 3 7 0 beta 2.\n* Python 3.7.0 beta 1: Python 3 7 0 beta 1.\n* Python 3.7.0 alpha 4: Python 3 7 0 alpha 4.\n* Python 3.7.0 alpha 3: Python 3 7 0 alpha 3.\n* Python 3.7.0 alpha 2: Python 3 7 0 alpha 2.\n* Python 3.7.0 alpha 1: Python 3 7 0 alpha 1.\n* Python 3.6.6 final: Python 3 6 6 final.\n* Python 3.6.6 release candidate 1: Python 3 6 6 release candidate 1.\n* Python 3.6.5 final: Python 3 6 5 final.\n* Python 3.6.5 release candidate 1: Python 3 6 5 release candidate 1.\n* Python 3.6.4 final: Python 3 6 4 final.\n* Python 3.6.4 release candidate 1: Python 3 6 4 release candidate 1.\n* Python 3.6.3 final: Python 3 6 3 final.\n* Python 3.6.3 release candidate 1: Python 3 6 3 release candidate 1.\n* Python 3.6.2 final: Python 3 6 2 final.\n* Python 3.6.2 release candidate 2: Python 3 6 2 release candidate 2.\n* Python 3.6.2 release candidate 1: Python 3 6 2 release candidate 1.\n* Python 3.6.1 final: Python 3 6 1 final.\n* Python 3.6.1 release candidate 1: Python 3 6 1 release candidate 1.\n* Python 3.6.0 final: Python 3 6 0 final.\n* Python 3.6.0 release candidate 2: Python 3 6 0 release candidate 2.\n* Python 3.6.0 release candidate 1: Python 3 6 0 release candidate 1.\n* Python 3.6.0 beta 4: Python 3 6 0 beta 4.\n* Python 3.6.0 beta 3: Python 3 6 0 beta 3.\n* Python 3.6.0 beta 2: Python 3 6 0 beta 2.\n* Python 3.6.0 beta 1: Python 3 6 0 beta 1.\n* Python 3.6.0 alpha 4: Python 3 6 0 alpha 4.\n* Python 3.6.0 alpha 3: Python 3 6 0 alpha 3.\n* Python 3.6.0 alpha 2: Python 3 6 0 alpha 2.\n* Python 3.6.0 alpha 1: Python 3 6 0 alpha 1.\n* Python 3.5.5 final: Python 3 5 5 final.\n* Python 3.5.5 release candidate 1: Python 3 5 5 release candidate 1.\n* Python 3.5.4 final: Python 3 5 4 final.\n* Python 3.5.4 release candidate 1: Python 3 5 4 release candidate 1.\n* Python 3.5.3 final: Python 3 5 3 final.\n* Python 3.5.3 release candidate 1: Python 3 5 3 release candidate 1.\n* Python 3.5.2 final: Python 3 5 2 final.\n* Python 3.5.2 release candidate 1: Python 3 5 2 release candidate 1.\n* Python 3.5.1 final: Python 3 5 1 final.\n* Python 3.5.1 release candidate 1: Python 3 5 1 release candidate 1.\n* Python 3.5.0 final: Python 3 5 0 final.\n* Python 3.5.0 release candidate 4: Python 3 5 0 release candidate 4.\n* Python 3.5.0 release candidate 3: Python 3 5 0 release candidate 3.\n* Python 3.5.0 release candidate 2: Python 3 5 0 release candidate 2.\n* Python 3.5.0 release candidate 1: Python 3 5 0 release candidate 1.\n* Python 3.5.0 beta 4: Python 3 5 0 beta 4.\n* Python 3.5.0 beta 3: Python 3 5 0 beta 3.\n* Python 3.5.0 beta 2: Python 3 5 0 beta 2.\n* Python 3.5.0 beta 1: Python 3 5 0 beta 1.\n* Python 3.5.0 alpha 4: Python 3 5 0 alpha 4.\n* Python 3.5.0 alpha 3: Python 3 5 0 alpha 3.\n* Python 3.5.0 alpha 2: Python 3 5 0 alpha 2.\n* Python 3.5.0 alpha 1: Python 3 5 0 alpha 1.\n"
                }
            ]
        },
        "File: python3.12.info,  Node: Python 3 12 3 final,  Next: Python 3 12 2 final,  Up: Changelog": {
            "content": "'Release date: 2024-04-09'\n\n* Menu:\n\n* Security::\n* Core and Builtins::\n* Library::\n* Documentation: Documentation<2>.\n* Tests::\n* Build::\n* Windows::\n* IDLE: IDLE<3>.\n* Tools/Demos::\n* C API::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Security,  Next: Core and Builtins,  Up: Python 3 12 3 final": {
            "content": "1.22.1.1 Security\n.................\n\n- gh-115398(1): Allow controlling Expat >=2.6.0 reparse deferral\n(CVE-2023-52425) by adding five new methods:\n\n* *note xml.etree.ElementTree.XMLParser.flush(): 13ab.\n\n* *note xml.etree.ElementTree.XMLPullParser.flush(): 13ac.\n\n* *note xml.parsers.expat.xmlparser.GetReparseDeferralEnabled():\n13ad.\n\n* *note xml.parsers.expat.xmlparser.SetReparseDeferralEnabled():\n13ae.\n\n* 'xml.sax.expatreader.ExpatParser.flush()'\n\n- gh-115399(2): Update bundled libexpat to 2.6.0\n\n- gh-115243(3): Fix possible crashes in *note\ncollections.deque.index(): c2e. when the deque is concurrently\nmodified.\n\n- gh-114572(4): *note ssl.SSLContext.certstorestats(): e1a. and\n*note ssl.SSLContext.getcacerts(): e1b. now correctly lock access\nto the certificate store, when the *note ssl.SSLContext: 278. is\nshared across multiple threads.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/115398\n\n(2) https://github.com/python/cpython/issues/115399\n\n(3) https://github.com/python/cpython/issues/115243\n\n(4) https://github.com/python/cpython/issues/114572\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Core and Builtins,  Next: Library,  Prev: Security,  Up: Python 3 12 3 final": {
            "content": "1.22.1.2 Core and Builtins\n..........................\n\n- gh-109120(1): Added handle of incorrect star expressions, e.g 'f(3,\n*)'.  Patch by Grigoryev Semyon\n\n- gh-99108(2): Updated the *note hashlib: 63. built-in HACL*\nproject(3) C code from upstream that we use for many\nimplementations when they are not present via OpenSSL in a given\nbuild.  This also avoids the rare potential for a C symbol name one\ndefinition rule linking issue.\n\n- gh-116735(4): For 'INSTRUMENTEDCALLFUNCTIONEX', set 'arg0' to\n'sys.monitoring.MISSING' instead of 'None' for *note CALL: 13b0.\nevent.\n\n- gh-113964(5): Starting new threads and process creation through\n*note os.fork(): 231. are now only prevented once all non-daemon\nthreads exit.\n\n- gh-116604(6): Respect the status of the garbage collector when\nindirect calls are made via *note PyErrCheckSignals(): 17c. and\nthe evaluation breaker.  Patch by Pablo Galindo\n\n- gh-116626(7): Ensure 'INSTRUMENTEDCALLFUNCTIONEX' always emits\n*note CALL: 13b0.\n\n- gh-116296(8): Fix possible refleak in 'object.reduce()'\ninternal error handling.\n\n- gh-116034(9): Fix location of the error on a failed assertion.\n\n- gh-115823(10): Properly calculate error ranges in the parser when\nraising *note SyntaxError: 146. exceptions caused by invalid byte\nsequences.  Patch by Pablo Galindo\n\n- gh-112087(11): For an empty reverse iterator for list will be\nreduced to *note reversed(): 661.  Patch by Donghee Na.\n\n- gh-115154(12): Fix a bug that was causing the *note\ntokenize.untokenize(): 13b1. function to handle unicode named\nliterals incorrectly.  Patch by Pablo Galindo\n\n- gh-114828(13): Fix compilation crashes in uncommon code examples\nusing *note super(): 204. inside a comprehension in a class body.\n\n- gh-115011(14): Setters for members with an unsigned integer type\nnow support the same range of valid values for objects that has a\n*note index(): 4f1. method as for *note int: 17e.\n\n- gh-112215(15): Change the C recursion limits to more closely\nreflect the underlying platform limits.\n\n- gh-96497(16): Fix incorrect resolution of mangled class variables\nused in assignment expressions in comprehensions.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/109120\n\n(2) https://github.com/python/cpython/issues/99108\n\n(3) https://github.com/hacl-star/hacl-star\n\n(4) https://github.com/python/cpython/issues/116735\n\n(5) https://github.com/python/cpython/issues/113964\n\n(6) https://github.com/python/cpython/issues/116604\n\n(7) https://github.com/python/cpython/issues/116626\n\n(8) https://github.com/python/cpython/issues/116296\n\n(9) https://github.com/python/cpython/issues/116034\n\n(10) https://github.com/python/cpython/issues/115823\n\n(11) https://github.com/python/cpython/issues/112087\n\n(12) https://github.com/python/cpython/issues/115154\n\n(13) https://github.com/python/cpython/issues/114828\n\n(14) https://github.com/python/cpython/issues/115011\n\n(15) https://github.com/python/cpython/issues/112215\n\n(16) https://github.com/python/cpython/issues/96497\n\nFile: python3.12.info,  Node: Library,  Next: Documentation<2>,  Prev: Core and Builtins,  Up: Python 3 12 3 final\n\n1.22.1.3 Library\n................\n\n- gh-117467(1): Preserve mailbox ownership when rewriting in\n'mailbox.mbox.flush()'.  Patch by Tony Mountifield.\n\n- gh-117310(2): Fixed an unlikely early & extra 'PyDECREF' triggered\ncrash in *note ssl: ca. when creating a new 'ssl.SSLContext' if\nCPython was built implausibly such that the default cipher list is\nempty 'or' the SSL library it was linked against reports a failure\nfrom its C 'SSLCTXsetcipherlist()' API.\n\n- gh-117178(3): Fix regression in lazy loading of self-referential\nmodules, introduced in gh-114781(4).\n\n- gh-117084(5): Fix *note zipfile: 12b. extraction for directory\nentries with the name containing backslashes on Windows.\n\n- gh-117110(6): Fix a bug that prevents subclasses of *note\ntyping.Any: 479. to be instantiated with arguments.  Patch by Chris\nFu.\n\n- gh-90872(7): On Windows, *note subprocess.Popen.wait(): b33. no\nlonger calls 'WaitForSingleObject()' with a negative timeout: pass\n'0' ms if the timeout is negative.  Patch by Victor Stinner.\n\n- gh-116957(8): configparser: Don't leave ConfigParser values in an\ninvalid state (stored as a list instead of a str) after an earlier\nread raised DuplicateSectionError or DuplicateOptionError.\n\n- gh-90095(9): Ignore empty lines and comments in '.pdbrc'\n\n- gh-116764(10): Restore support of 'None' and other false values in\n*note urllib.parse: 105. functions *note parseqs(): 651. and *note\nparseqsl(): 652.  Also, they now raise a TypeError for non-zero\nintegers and non-empty sequences.\n\n- gh-116811(11): In 'PathFinder.invalidatecaches', delegate to\n'MetadataPathFinder.invalidatecaches'.\n\n- gh-116600(12): Fix *note repr(): 5f0. for global *note Flag: 3ef.\nmembers.\n\n- gh-116484(13): Change automatically generated 'tkinter.Checkbutton'\nwidget names to avoid collisions with automatically generated\n'tkinter.ttk.Checkbutton' widget names within the same parent\nwidget.\n\n- gh-116401(14): Fix blocking *note os.fwalk(): 998. and *note\nshutil.rmtree(): 1d5. on opening named pipe.\n\n- gh-116143(15): Fix a race in pydoc 'startserver', eliminating a\nwindow in which 'startserver' can return a thread that is\n\"serving\" but without a 'docserver' set.\n\n- gh-116325(16): *note typing: ff.: raise *note SyntaxError: 146.\ninstead of *note AttributeError: 395. on forward references as\nempty strings.\n\n- gh-90535(17): Fix support of 'interval' values > 1 in\n'logging.TimedRotatingFileHandler' for 'when='MIDNIGHT'' and\n'when='Wx''.\n\n- gh-115978(18): Disable preadv(), readv(), pwritev(), and writev()\non WASI.\n\nUnder wasmtime for WASI 0.2, these functions don't pass testposix\n('https://github.com/bytecodealliance/wasmtime/issues/7830').\n\n- gh-88352(19): Fix the computation of the next rollover time in the\n'logging.TimedRotatingFileHandler' handler.  'computeRollover()'\nnow always returns a timestamp larger than the specified time and\nworks correctly during the DST change.  'doRollover()' no longer\noverwrite the already rolled over file, saving from data loss when\nrun at midnight or during repeated time at the DST change.\n\n- gh-87115(20): Set 'main.spec' to 'None' when running a\nscript with *note pdb: a0.\n\n- gh-76511(21): Fix UnicodeEncodeError in 'email.Message.asstring()'\nthat results when a message that claims to be in the ascii\ncharacter set actually has non-ascii characters.  Non-ascii\ncharacters are now replaced with the U+FFFD replacement character,\nlike in the 'replace' error handler.\n\n- gh-116040(22): [Enum] fix by-value calls when second value is\nfalsey; e.g.  Cardinal(1, 0)\n\n- gh-75988(23): Fixed *note unittest.mock.createautospec(): 13b3. to\npass the call through to the wrapped object to return the real\nresult.\n\n- gh-115881(24): Fix issue where *note ast.parse(): 182. would\nincorrectly flag conditional context managers (such as 'with (x()\nif y else z()): ...') as invalid syntax if 'featureversion=(3, 8)'\nwas passed.  This reverts changes to the grammar made as part of\ngh-94949(25).\n\n- gh-115886(26): Fix silent truncation of the name with an embedded\nnull character in *note multiprocessing.sharedmemory.SharedMemory:\n13b4.\n\n- gh-115809(27): Improve algorithm for computing which rolled-over\nlog files to delete in 'logging.TimedRotatingFileHandler'.  It is\nnow reliable for handlers without 'namer' and with arbitrary\ndeterministic 'namer' that leaves the datetime part in the file\nname unmodified.\n\n- gh-74668(28): *note urllib.parse: 105. functions *note parseqs():\n651. and *note parseqsl(): 652. now support bytes arguments\ncontaining raw and percent-encoded non-ASCII data.\n\n- gh-67044(29): *note csv.writer(): 1a2. now always quotes or escapes\n''\\r'' and ''\\n'', regardless of 'lineterminator' value.\n\n- gh-115712(30): *note csv.writer(): 1a2. now quotes empty fields if\ndelimiter is a space and skipinitialspace is true and raises\nexception if quoting is not possible.\n\n- gh-112364(31): Fixed *note ast.unparse(): 6fe. to handle\nformatspec with '\"', ''' or '\\\\'.  Patched by Frank Hoffmann.\n\n- gh-111358(32): Fix a bug in\n'asyncio.BaseEventLoop.shutdowndefaultexecutor()' to ensure the\ntimeout passed to the coroutine behaves as expected.\n\n- gh-115618(33): Fix improper decreasing the reference count for\n'None' argument in *note property: 3f6. methods *note getter():\n13b5, *note setter(): 13b6. and *note deleter(): 13b7.\n\n- gh-115570(34): A *note DeprecationWarning: 179. is no longer\nomitted on access to the 'doc' attributes of the deprecated\n'typing.io' and 'typing.re' pseudo-modules.\n\n- gh-112006(35): Fix *note inspect.unwrap(): dcc. for types with the\n'wrapper' data descriptor.\n\n- gh-101293(36): Support callables with the 'call()' method and\ntypes with 'new()' and 'init()' methods set to class\nmethods, static methods, bound methods, partial functions, and\nother types of methods and descriptors in *note\ninspect.Signature.fromcallable(): 51f.\n\n- gh-115392(37): Fix a bug in *note doctest: 36. where incorrect line\nnumbers would be reported for decorated functions.\n\n- gh-114563(38): Fix several *note format(): 3eb. bugs when using the\nC implementation of *note Decimal: 5c3.: * memory leak in some rare\ncases when using the 'z' format option (coerce negative 0) *\nincorrect output when applying the 'z' format option to type 'F'\n(fixed-point with capital 'NAN' / 'INF') * incorrect output when\napplying the '#' format option (alternate form)\n\n- gh-115197(39): 'urllib.request' no longer resolves the hostname\nbefore checking it against the system's proxy bypass list on macOS\nand Windows.\n\n- gh-115165(40): Most exceptions are now ignored when attempting to\nset the 'origclass' attribute on objects returned when calling\n*note typing: ff. generic aliases (including generic aliases\ncreated using *note typing.Annotated: 75b.).  Previously only *note\nAttributeError: 395. was ignored.  Patch by Dave Shawley.\n\n- gh-115133(41): Fix tests for *note XMLPullParser: e66. with Expat\n2.6.0.\n\n- gh-115059(42): 'io.BufferedRandom.read1()' now flushes the\nunderlying write buffer.\n\n- gh-79382(43): Trailing '' no longer allows to match files and\nnon-existing paths in recursive *note glob(): 5fa.\n\n- gh-114071(44): Support tuple subclasses using auto() for enum\nmember value.\n\n- gh-114763(45): Protect modules loaded with *note\nimportlib.util.LazyLoader: afc. from race conditions when multiple\nthreads try to access attributes before the loading is complete.\n\n- gh-97959(46): Fix rendering class methods, bound methods, method\nand function aliases in *note pydoc: b0.  Class methods no longer\nhave \"method of builtins.type instance\" note.  Corresponding notes\nare now added for class and unbound methods.  Method and function\naliases now have references to the module or the class where the\norigin was defined if it differs from the current.  Bound methods\nare now listed in the static methods section.  Methods of builtin\nclasses are now supported as well as methods of Python classes.\n\n- gh-112281(47): Allow creating *note union of types: 5b5. for *note\ntyping.Annotated: 75b. with unhashable metadata.\n\n- gh-111775(48): Fix\n'importlib.resources.simple.ResourceHandle.open()' for text mode,\nadded missed 'stream' argument.\n\n- gh-90095(49): Make .pdbrc and -c work with any valid pdb commands.\n\n- gh-107155(50): Fix incorrect output of 'help(x)' where 'x' is a\n*note lambda: 1115. function, which has an 'annotations'\ndictionary attribute with a '\"return\"' key.\n\n- gh-105866(51): Fixed 'getslots' bug which caused error when\ndefining dataclasses with slots and a weakrefslot.\n\n- gh-60346(52): Fix ArgumentParser inconsistent with\nparseknownargs.\n\n- gh-100985(53): Update HTTPSConnection to consistently wrap IPv6\nAddresses when using a proxy.\n\n- gh-100884(54): email: fix misfolding of comma in address-lists over\nmultiple lines in combination with unicode encoding.\n\n- gh-95782(55): Fix 'io.BufferedReader.tell()',\n'io.BufferedReader.seek()', 'pyio.BufferedReader.tell()',\n'io.BufferedRandom.tell()', 'io.BufferedRandom.seek()' and\n'pyio.BufferedRandom.tell()' being able to return negative\noffsets.\n\n- gh-96310(56): Fix a traceback in *note argparse: 6. when all\noptions in a mutually exclusive group are suppressed.\n\n- gh-93205(57): Fixed a bug in *note\nlogging.handlers.TimedRotatingFileHandler: dd1. where multiple\nrotating handler instances pointing to files with the same name but\ndifferent extensions would conflict and not delete the correct\nfiles.\n\n- bpo-44865(58): Add missing call to localization function in *note\nargparse: 6.\n\n- bpo-43952(59): Fix *note\nmultiprocessing.connection.Listener.accept(): 13b8. to accept empty\nbytes as authkey.  Not accepting empty bytes as key causes it to\nhang indefinitely.\n\n- bpo-42125(60): linecache: get module name from 'spec' if\navailable.  This allows getting source code for the 'main'\nmodule when a custom loader is used.\n\n- gh-66543(61): Make *note mimetypes.guesstype(): 13b9. properly\nparsing of URLs with only a host name, URLs containing fragment or\nquery, and filenames with only a UNC sharepoint on Windows.  Based\non patch by Dong-hee Na.\n\n- bpo-33775(62): Add 'default' and 'version' help text for\nlocalization in argparse.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/117467\n\n(2) https://github.com/python/cpython/issues/117310\n\n(3) https://github.com/python/cpython/issues/117178\n\n(4) https://github.com/python/cpython/issues/114781\n\n(5) https://github.com/python/cpython/issues/117084\n\n(6) https://github.com/python/cpython/issues/117110\n\n(7) https://github.com/python/cpython/issues/90872\n\n(8) https://github.com/python/cpython/issues/116957\n\n(9) https://github.com/python/cpython/issues/90095\n\n(10) https://github.com/python/cpython/issues/116764\n\n(11) https://github.com/python/cpython/issues/116811\n\n(12) https://github.com/python/cpython/issues/116600\n\n(13) https://github.com/python/cpython/issues/116484\n\n(14) https://github.com/python/cpython/issues/116401\n\n(15) https://github.com/python/cpython/issues/116143\n\n(16) https://github.com/python/cpython/issues/116325\n\n(17) https://github.com/python/cpython/issues/90535\n\n(18) https://github.com/python/cpython/issues/115978\n\n(19) https://github.com/python/cpython/issues/88352\n\n(20) https://github.com/python/cpython/issues/87115\n\n(21) https://github.com/python/cpython/issues/76511\n\n(22) https://github.com/python/cpython/issues/116040\n\n(23) https://github.com/python/cpython/issues/75988\n\n(24) https://github.com/python/cpython/issues/115881\n\n(25) https://github.com/python/cpython/issues/94949\n\n(26) https://github.com/python/cpython/issues/115886\n\n(27) https://github.com/python/cpython/issues/115809\n\n(28) https://github.com/python/cpython/issues/74668\n\n(29) https://github.com/python/cpython/issues/67044\n\n(30) https://github.com/python/cpython/issues/115712\n\n(31) https://github.com/python/cpython/issues/112364\n\n(32) https://github.com/python/cpython/issues/111358\n\n(33) https://github.com/python/cpython/issues/115618\n\n(34) https://github.com/python/cpython/issues/115570\n\n(35) https://github.com/python/cpython/issues/112006\n\n(36) https://github.com/python/cpython/issues/101293\n\n(37) https://github.com/python/cpython/issues/115392\n\n(38) https://github.com/python/cpython/issues/114563\n\n(39) https://github.com/python/cpython/issues/115197\n\n(40) https://github.com/python/cpython/issues/115165\n\n(41) https://github.com/python/cpython/issues/115133\n\n(42) https://github.com/python/cpython/issues/115059\n\n(43) https://github.com/python/cpython/issues/79382\n\n(44) https://github.com/python/cpython/issues/114071\n\n(45) https://github.com/python/cpython/issues/114763\n\n(46) https://github.com/python/cpython/issues/97959\n\n(47) https://github.com/python/cpython/issues/112281\n\n(48) https://github.com/python/cpython/issues/111775\n\n(49) https://github.com/python/cpython/issues/90095\n\n(50) https://github.com/python/cpython/issues/107155\n\n(51) https://github.com/python/cpython/issues/105866\n\n(52) https://github.com/python/cpython/issues/60346\n\n(53) https://github.com/python/cpython/issues/100985\n\n(54) https://github.com/python/cpython/issues/100884\n\n(55) https://github.com/python/cpython/issues/95782\n\n(56) https://github.com/python/cpython/issues/96310\n\n(57) https://github.com/python/cpython/issues/93205\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=44865\n\n(59) https://bugs.python.org/issue?@action=redirect&bpo=43952\n\n(60) https://bugs.python.org/issue?@action=redirect&bpo=42125\n\n(61) https://github.com/python/cpython/issues/66543\n\n(62) https://bugs.python.org/issue?@action=redirect&bpo=33775\n\nFile: python3.12.info,  Node: Documentation<2>,  Next: Tests,  Prev: Library,  Up: Python 3 12 3 final\n\n1.22.1.4 Documentation\n......................\n\n- gh-115399(1): Document CVE-2023-52425 of Expat <2.6.0 under \"XML\nvulnerabilities\".\n\n- gh-115233(2): Fix an example for *note LoggerAdapter: 116a. in the\nLogging Cookbook.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/115399\n\n(2) https://github.com/python/cpython/issues/115233\n\nFile: python3.12.info,  Node: Tests,  Next: Build,  Prev: Documentation<2>,  Up: Python 3 12 3 final\n\n1.22.1.5 Tests\n..............\n\n- gh-83434(1): Disable JUnit XML output ('--junit-xml=FILE' command\nline option) in regrtest when hunting for reference leaks ('-R'\noption).  Patch by Victor Stinner.\n\n- gh-117187(2): Fix XML tests for vanilla Expat <2.6.0.\n\n- gh-116333(3): Tests of TLS related things (error codes, etc) were\nupdated to be more lenient about specific error message strings and\nbehaviors as seen in the BoringSSL and AWS-LC forks of OpenSSL.\n\n- gh-115979(4): Update testimportlib so that it passes under WASI\nSDK 21.\n\n- gh-112536(5): Add -tsan to test.regrtest for running TSAN tests in\nreasonable execution times.  Patch by Donghee Na.\n\n- gh-116307(6): Added import helper 'isolatedmodules' as\n'CleanImport' does not remove modules imported during the context.\nUse it in importlib.resources tests to avoid leaving 'mod' around\nto impede importlib.metadata tests.\n\n- gh-115720(7): Leak tests ('-R', '--huntrleaks') now show a summary\nof the number of leaks found in each iteration.\n\n- gh-115122(8): Add '--bisect' option to regrtest test runner: run\nfailed tests with 'test.bisectcmd' to identify failing tests.\nPatch by Victor Stinner.\n\n- gh-115596(9): Fix 'ProgramPriorityTests' in 'testos' permanently\nchanging the process priority.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/83434\n\n(2) https://github.com/python/cpython/issues/117187\n\n(3) https://github.com/python/cpython/issues/116333\n\n(4) https://github.com/python/cpython/issues/115979\n\n(5) https://github.com/python/cpython/issues/112536\n\n(6) https://github.com/python/cpython/issues/116307\n\n(7) https://github.com/python/cpython/issues/115720\n\n(8) https://github.com/python/cpython/issues/115122\n\n(9) https://github.com/python/cpython/issues/115596\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Build,  Next: Windows,  Prev: Tests,  Up: Python 3 12 3 final": {
            "content": "1.22.1.6 Build\n..............\n\n- gh-116313(1): Get WASI builds to work under wasmtime 18 w/ WASI\n0.2/preview2 primitives.\n\n- gh-116117(2): Backport 'libb2''s PR #42 to fix compiling CPython on\n32-bit Windows with 'clang-cl'.\n\n- gh-115167(3): Avoid vendoring 'vcruntime140threads.dll' when\nbuilding with Visual Studio 2022 version 17.8.\n\n- gh-112536(4): Add support for thread sanitizer (TSAN)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/116313\n\n(2) https://github.com/python/cpython/issues/116117\n\n(3) https://github.com/python/cpython/issues/115167\n\n(4) https://github.com/python/cpython/issues/112536\n\nFile: python3.12.info,  Node: Windows,  Next: IDLE<3>,  Prev: Build,  Up: Python 3 12 3 final\n\n1.22.1.7 Windows\n................\n\n- gh-117267(1): Ensure 'DirEntry.stat().stctime' behaves\nconsistently with *note os.stat(): 1bf. during the deprecation\nperiod of 'stctime' by containing the same value as\n'stbirthtime'.  After the deprecation period, 'stctime' will be\nthe metadata change time (or unavailable through 'DirEntry'), and\nonly 'stbirthtime' will contain the creation time.\n\n- gh-116773(2): Fix instances of '<overlapped.Overlapped object at\n0xXXX> still has pending operation at deallocation, the process may\ncrash'.\n\n- gh-91227(3): Fix the asyncio ProactorEventLoop implementation so\nthat sending a datagram to an address that is not listening does\nnot prevent receiving any more datagrams.\n\n- gh-115554(4): The installer now has more strict rules about\nupdating the *note Python Launcher for Windows: 37f.  In general,\nmost users only have a single launcher installed and will see no\ndifference.  When multiple launchers have been installed, the\noption to install the launcher is disabled until all but one have\nbeen removed.  Downgrading the launcher (which was never allowed)\nis now more obviously blocked.\n\n- gh-115543(5): *note Python Launcher for Windows: 37f. can now\ndetect Python 3.13 when installed from the Microsoft Store, and\nwill install Python 3.12 by default when 'PYLAUNCHERALLOWINSTALL'\nis set.\n\n- gh-115049(6): Fixes 'py.exe' launcher failing when run as users\nwithout user profiles.\n\n- gh-115009(7): Update Windows installer to use SQLite 3.45.1.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/117267\n\n(2) https://github.com/python/cpython/issues/116773\n\n(3) https://github.com/python/cpython/issues/91227\n\n(4) https://github.com/python/cpython/issues/115554\n\n(5) https://github.com/python/cpython/issues/115543\n\n(6) https://github.com/python/cpython/issues/115049\n\n(7) https://github.com/python/cpython/issues/115009\n\nFile: python3.12.info,  Node: IDLE<3>,  Next: Tools/Demos,  Prev: Windows,  Up: Python 3 12 3 final\n\n1.22.1.8 IDLE\n.............\n\n- gh-88516(1): On macOS show a proxy icon in the title bar of editor\nwindows to match platform behaviour.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/88516\n\nFile: python3.12.info,  Node: Tools/Demos,  Next: C API,  Prev: IDLE<3>,  Up: Python 3 12 3 final\n\n1.22.1.9 Tools/Demos\n....................\n\n- gh-113516(1): Don't set 'LDSHARED' when building for WASI.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/113516\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: C API,  Prev: Tools/Demos,  Up: Python 3 12 3 final": {
            "content": "1.22.1.10 C API\n...............\n\n- gh-117021(1): Fix integer overflow in 'PyLongAsPid()' on\nnon-Windows 64-bit platforms.\n\n- gh-116869(2): Make the C API compatible with\n'-Werror=declaration-after-statement' compiler flag again.  Patch\nby Victor Stinner.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/117021\n\n(2) https://github.com/python/cpython/issues/116869\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 12 2 final,  Next: Python 3 12 1 final,  Prev: Python 3 12 3 final,  Up: Changelog": {
            "content": "'Release date: 2024-02-06'\n\n* Menu:\n\n* Security: Security<2>.\n* Core and Builtins: Core and Builtins<2>.\n* Library: Library<2>.\n* Documentation: Documentation<3>.\n* Tests: Tests<2>.\n* Build: Build<2>.\n* Windows: Windows<2>.\n* macOS::\n* IDLE: IDLE<4>.\n* Tools/Demos: Tools/Demos<2>.\n\nFile: python3.12.info,  Node: Security<2>,  Next: Core and Builtins<2>,  Up: Python 3 12 2 final\n\n1.22.2.1 Security\n.................\n\n- gh-113659(1): Skip '.pth' files with names starting with a dot or\nhidden file attribute.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/113659\n\nFile: python3.12.info,  Node: Core and Builtins<2>,  Next: Library<2>,  Prev: Security<2>,  Up: Python 3 12 2 final\n\n1.22.2.2 Core and Builtins\n..........................\n\n- gh-114887(1): Changed socket type validation in *note\ncreatedatagramendpoint(): 517. to accept all non-stream sockets.\nThis fixes a regression in compatibility with raw sockets.\n\n- gh-114388(2): Fix a *note RuntimeWarning: 8c9. emitted when assign\nan integer-like value that is not an instance of *note int: 17e. to\nan attribute that corresponds to a C struct member of *note type:\n13c4. TUINT and TULONG. Fix a double *note RuntimeWarning: 8c9.\nemitted when assign a negative integer value to an attribute that\ncorresponds to a C struct member of type TUINT.\n\n- gh-113703(3): Fix a regression in the *note codeop: 1a. module that\nwas causing it to incorrectly identify incomplete f-strings.  Patch\nby Pablo Galindo\n\n- gh-89811(4): Check for a valid 'tpversiontag' before performing\nbytecode specializations that rely on this value being usable.\n\n- gh-113602(5): Fix an error that was causing the parser to try to\noverwrite existing errors and crashing in the process.  Patch by\nPablo Galindo\n\n- gh-113297(6): Fix segfault in the compiler on with statement with\n19 context managers.\n\n- gh-106905(7): Use per AST-parser state rather than global state to\ntrack recursion depth within the AST parser to prevent potential\nrace condition due to simultaneous parsing.\n\nThe issue primarily showed up in 3.11 by multithreaded users of\n*note ast.parse(): 182.  In 3.12 a change to when garbage\ncollection can be triggered prevented the race condition from\noccurring.\n\n- gh-112943(8): Correctly compute end column offsets for multiline\ntokens in the *note tokenize: f6. module.  Patch by Pablo Galindo\n\n- gh-112716(9): Fix SystemError in the 'import' statement and in\n'reduce()' methods of builtin types when 'builtins' is not\na dict.\n\n- gh-94606(10): Fix UnicodeEncodeError when\n'email.message.getpayload()' reads a message with a Unicode\nsurrogate character and the message content is not well-formed for\nsurrogateescape encoding.  Patch by Sidney Markowitz.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/114887\n\n(2) https://github.com/python/cpython/issues/114388\n\n(3) https://github.com/python/cpython/issues/113703\n\n(4) https://github.com/python/cpython/issues/89811\n\n(5) https://github.com/python/cpython/issues/113602\n\n(6) https://github.com/python/cpython/issues/113297\n\n(7) https://github.com/python/cpython/issues/106905\n\n(8) https://github.com/python/cpython/issues/112943\n\n(9) https://github.com/python/cpython/issues/112716\n\n(10) https://github.com/python/cpython/issues/94606\n\nFile: python3.12.info,  Node: Library<2>,  Next: Documentation<3>,  Prev: Core and Builtins<2>,  Up: Python 3 12 2 final\n\n1.22.2.3 Library\n................\n\n- gh-114965(1): Update bundled pip to 24.0\n\n- gh-114959(2): *note tarfile: d8. no longer ignores errors when\ntrying to extract a directory on top of a file.\n\n- gh-109475(3): Fix support of explicit option value \"-\" in *note\nargparse: 6. (e.g.  '--option=--').\n\n- gh-110190(4): Fix ctypes structs with array on Windows ARM64\nplatform by setting 'MAXSTRUCTSIZE' to 32 in stgdict.  Patch by\nDiego Russo\n\n- gh-113280(5): Fix a leak of open socket in rare cases when error\noccurred in *note ssl.SSLSocket: 703. creation.\n\n- gh-77749(6): *note email.policy.EmailPolicy.fold(): 13c6. now\nalways encodes non-ASCII characters in headers if *note utf8: c55.\nis false.\n\n- gh-114492(7): Make the result of *note termios.tcgetattr(): 13c7.\nreproducible on Alpine Linux.  Previously it could leave a random\ngarbage in some fields.\n\n- gh-113267(8): Revert changes in gh-106584(9) which made calls of\n'TestResult' methods 'startTest()' and 'stopTest()' unbalanced.\n\n- gh-75128(10): Ignore an *note OSError: 613. in\n'asyncio.BaseEventLoop.createserver()' when IPv6 is available but\nthe interface cannot actually support it.\n\n- gh-114257(11): Dismiss the 'FileNotFound' error in *note\nctypes.util.findlibrary(): ba2. and just return 'None' on Linux.\n\n- gh-114328(12): The *note tty.setcbreak(): 13c8. and new *note\ntty.cfmakecbreak(): 13c9. no longer clears the terminal input ICRLF\nflag.  This fixes a regression introduced in 3.12 that no longer\nmatched how OSes define cbreak mode in their 'stty(1)' manual\npages.\n\n- gh-101438(13): Avoid reference cycle in ElementTree.iterparse.  The\niterator returned by 'ElementTree.iterparse' may hold on to a file\ndescriptor.  The reference cycle prevented prompt clean-up of the\nfile descriptor if the returned iterator was not exhausted.\n\n- gh-104522(14): *note OSError: 613. raised when run a subprocess now\nonly has 'filename' attribute set to 'cwd' if the error was caused\nby a failed attempt to change the current directory.\n\n- gh-114149(15): Enum: correctly handle tuple subclasses in custom\n'new'.\n\n- gh-109534(16): Fix a reference leak in\n'asyncio.selectorevents.BaseSelectorEventLoop' when SSL handshakes\nfail.  Patch contributed by Jamie Phan.\n\n- gh-114077(17): Fix possible *note OverflowError: 68d. in *note\nsocket.socket.sendfile(): cc0. when pass 'count' larger than 2 GiB\non 32-bit platform.\n\n- gh-114014(18): Fixed a bug in *note fractions.Fraction: 1a8. where\nan invalid string using 'd' in the decimals part creates a\ndifferent error compared to other invalid letters/characters.\nPatch by Jeremiah Gabriel Pascual.\n\n- gh-113951(19): Fix the behavior of 'tagunbind()' methods of\n'tkinter.Text' and 'tkinter.Canvas' classes with three arguments.\nPreviously, 'widget.tagunbind(tag, sequence, funcid)' destroyed\nthe current binding for 'sequence', leaving 'sequence' unbound, and\ndeleted the 'funcid' command.  Now it removes only 'funcid' from\nthe binding for 'sequence', keeping other commands, and deletes the\n'funcid' command.  It leaves 'sequence' unbound only if 'funcid'\nwas the last bound command.\n\n- gh-113877(20): Fix *note tkinter: ea. method 'winfopathname()' on\n64-bit Windows.\n\n- gh-113661(21): unittest runner: Don't exit 5 if tests were skipped.\nThe intention of exiting 5 was to detect issues where the test\nsuite wasn't discovered at all.  If we skipped tests, it was\ncorrectly discovered.\n\n- gh-113781(22): Silence unraisable AttributeError when warnings are\nemitted during Python finalization.\n\n- gh-112932(23): Restore the ability for *note zipfile: 12b. to\n'extractall' from zip files with a \"/\" directory entry in them as\nis commonly added to zips by some wiki or bug tracker data\nexporters.\n\n- gh-113594(24): Fix *note UnicodeEncodeError: 442. in *note email:\n37. when re-fold lines that contain unknown-8bit encoded part\nfollowed by non-unknown-8bit encoded part.\n\n- gh-113538(25): In 'asyncio.StreamReaderProtocol.connectionmade()',\nthere is callback that logs an error if the task wrapping the\n\"connected callback\" fails.  This callback would itself fail if the\ntask was cancelled.  Prevent this by checking whether the task was\ncancelled first.  If so, close the transport but don't log an\nerror.\n\n- gh-85567(26): Fix resource warnings for unclosed files in *note\npickle: a1. and *note pickletools: a2. command line interfaces.\n\n- gh-101225(27): Increase the backlog for *note\nmultiprocessing.connection.Listener: 13ca. objects created by\n'multiprocessing.manager' and 'multiprocessing.resourcesharer' to\nsignificantly reduce the risk of getting a connection refused error\nwhen creating a *note multiprocessing.connection.Connection: 13cb.\nto them.\n\n- gh-113543(28): Make sure that 'webbrowser.MacOSXOSAScript' sends\n'webbrowser.open' audit event.\n\n- gh-113028(29): When a second reference to a string appears in the\ninput to *note pickle: a1, and the Python implementation is in use,\nwe are guaranteed that a single copy gets pickled and a single\nobject is shared when reloaded.  Previously, in protocol 0, when a\nstring contained certain characters (e.g.  newline) it resulted in\nduplicate objects.\n\n- gh-113421(30): Fix multiprocessing logger for '%(filename)s'.\n\n- gh-111784(31): Fix segfaults in the 'elementtree' module.  Fix\nfirst segfault during deallocation of 'elementtree.XMLParser'\ninstances by keeping strong reference to 'pyexpat' module in module\nstate for capsule lifetime.  Fix second segfault which happens in\nthe same deallocation process by keeping strong reference to\n'elementtree' module in 'XMLParser' structure for 'elementtree'\nmodule lifetime.\n\n- gh-113407(32): Fix import of *note unittest.mock: 102. when CPython\nis built without docstrings.\n\n- gh-113320(33): Fix regression in Python 3.12 where *note Protocol:\n47e. classes that were not marked as *note runtime-checkable: 14c.\nwould be unnecessarily introspected, potentially causing exceptions\nto be raised if the protocol had problematic members.  Patch by\nAlex Waygood.\n\n- gh-113358(34): Fix rendering tracebacks for exceptions with a\nbroken 'getattr'.\n\n- gh-113214(35): Fix an 'AttributeError' during asyncio SSL protocol\naborts in SSL-over-SSL scenarios.\n\n- gh-113246(36): Update bundled pip to 23.3.2.\n\n- gh-113199(37): Make 'http.client.HTTPResponse.read1' and\n'http.client.HTTPResponse.readline' close IO after reading all data\nwhen content length is known.  Patch by Illia Volochii.\n\n- gh-113188(38): Fix *note shutil.copymode(): 13cc. and *note\nshutil.copystat(): fa0. on Windows.  Previously they worked\ndifferenly if 'dst' is a symbolic link: they modified the\npermission bits of 'dst' itself rather than the file it points to\nif 'followsymlinks' is true or 'src' is not a symbolic link, and\ndid not modify the permission bits if 'followsymlinks' is false\nand 'src' is a symbolic link.\n\n- gh-61648(39): Detect line numbers of properties in doctests.\n\n- gh-112559(40): *note signal.signal(): fa6. and *note\nsignal.getsignal(): 13cd. no longer call 'repr' on callable\nhandlers.  *note asyncio.run(): 197. and *note\nasyncio.Runner.run(): 13ce. no longer call 'repr' on the task\nresults.  Patch by Yilei Yang.\n\n- gh-110190(41): Fix ctypes structs with array on PPC64LE platform by\nsetting 'MAXSTRUCTSIZE' to 64 in stgdict.  Patch by Diego Russo.\n\n- gh-79429(42): Ignore FileNotFoundError when remove a temporary\ndirectory in the multiprocessing finalizer.\n\n- gh-81194(43): Fix a crash in *note socket.ifindextoname(): 85a.\nwith specific value (UINTMAX). Fix an integer overflow in *note\nsocket.ifindextoname(): 85a. on 64-bit non-Windows platforms.\n\n- gh-112343(44): Improve handling of pdb convenience variables to\navoid replacing string contents.\n\n- gh-111615(45): Fix a regression caused by a fix to gh-93162(46)\nwhereby you couldn't configure a 'QueueHandler' without specifying\nhandlers.\n\n- gh-111049(47): Fix crash during garbage collection of the *note\nio.BytesIO: d08. buffer object.\n\n- gh-110345(48): Show the Tcl/Tk patchlevel (rather than version) in\n'tkinter.test()'.\n\n- gh-109858(49): Protect *note zipfile: 12b. from \"quoted-overlap\"\nzipbomb.  It now raises BadZipFile when try to read an entry that\noverlaps with other entry or central directory.\n\n- gh-114440(50): On Windows, closing the connection writer when\ncleaning up a broken *note multiprocessing.Queue: 13cf. queue is\nnow done for all queues, rather than only in *note\nconcurrent.futures: 1f. manager thread.  This can prevent a\ndeadlock when a 'multiprocessing' worker process terminates without\ncleaning up.  This completes the backport of patches by Victor\nStinner and Serhiy Storchaka.\n\n- gh-38807(51): Fix race condition in *note trace: f8.  Instead of\nchecking if a directory exists and creating it, directly call *note\nos.makedirs(): 9a1. with the kwarg 'existok=True'.\n\n- gh-75705(52): Set unixfrom envelope in *note mailbox.mbox: 13d0.\nand *note mailbox.MMDF: 13d1.\n\n- gh-106233(53): Fix stacklevel in 'InvalidTZPathWarning' during\n*note zoneinfo: 12e. module import.\n\n- gh-105102(54): Allow *note ctypes.Union: 13d2. to be nested in\n*note ctypes.Structure: 13d3. when the system endianness is the\nopposite of the classes.\n\n- gh-104282(55): Fix null pointer dereference in\n'lzma.decodefilterproperties()' due to improper handling of BCJ\nfilters with properties of zero length.  Patch by Radislav\nChugunov.\n\n- gh-102512(56): When *note os.fork(): 231. is called from a foreign\nthread (aka 'DummyThread'), the type of the thread in a child\nprocess is changed to 'MainThread'.  Also changed its name and\ndaemonic status, it can be now joined.\n\n- bpo-35928(57): *note io.TextIOWrapper: b8f. now correctly handles\nthe decoding buffer after 'read()' and 'write()'.\n\n- bpo-26791(58): *note shutil.move(): 889. now moves a symlink into a\ndirectory when that directory is the target of the symlink.  This\nprovides the same behavior as the mv shell command.  The previous\nbehavior raised an exception.  Patch by Jeffrey Kintscher.\n\n- bpo-36959(59): Fix some error messages for invalid ISO format\nstring combinations in 'strptime()' that referred to directives not\ncontained in the format string.  Patch by Gordon P. Hemsley.\n\n- bpo-18060(60): Fixed a class inheritance issue that can cause\nsegfaults when deriving two or more levels of subclasses from a\nbase class of Structure or Union.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/114965\n\n(2) https://github.com/python/cpython/issues/114959\n\n(3) https://github.com/python/cpython/issues/109475\n\n(4) https://github.com/python/cpython/issues/110190\n\n(5) https://github.com/python/cpython/issues/113280\n\n(6) https://github.com/python/cpython/issues/77749\n\n(7) https://github.com/python/cpython/issues/114492\n\n(8) https://github.com/python/cpython/issues/113267\n\n(9) https://github.com/python/cpython/issues/106584\n\n(10) https://github.com/python/cpython/issues/75128\n\n(11) https://github.com/python/cpython/issues/114257\n\n(12) https://github.com/python/cpython/issues/114328\n\n(13) https://github.com/python/cpython/issues/101438\n\n(14) https://github.com/python/cpython/issues/104522\n\n(15) https://github.com/python/cpython/issues/114149\n\n(16) https://github.com/python/cpython/issues/109534\n\n(17) https://github.com/python/cpython/issues/114077\n\n(18) https://github.com/python/cpython/issues/114014\n\n(19) https://github.com/python/cpython/issues/113951\n\n(20) https://github.com/python/cpython/issues/113877\n\n(21) https://github.com/python/cpython/issues/113661\n\n(22) https://github.com/python/cpython/issues/113781\n\n(23) https://github.com/python/cpython/issues/112932\n\n(24) https://github.com/python/cpython/issues/113594\n\n(25) https://github.com/python/cpython/issues/113538\n\n(26) https://github.com/python/cpython/issues/85567\n\n(27) https://github.com/python/cpython/issues/101225\n\n(28) https://github.com/python/cpython/issues/113543\n\n(29) https://github.com/python/cpython/issues/113028\n\n(30) https://github.com/python/cpython/issues/113421\n\n(31) https://github.com/python/cpython/issues/111784\n\n(32) https://github.com/python/cpython/issues/113407\n\n(33) https://github.com/python/cpython/issues/113320\n\n(34) https://github.com/python/cpython/issues/113358\n\n(35) https://github.com/python/cpython/issues/113214\n\n(36) https://github.com/python/cpython/issues/113246\n\n(37) https://github.com/python/cpython/issues/113199\n\n(38) https://github.com/python/cpython/issues/113188\n\n(39) https://github.com/python/cpython/issues/61648\n\n(40) https://github.com/python/cpython/issues/112559\n\n(41) https://github.com/python/cpython/issues/110190\n\n(42) https://github.com/python/cpython/issues/79429\n\n(43) https://github.com/python/cpython/issues/81194\n\n(44) https://github.com/python/cpython/issues/112343\n\n(45) https://github.com/python/cpython/issues/111615\n\n(46) https://github.com/python/cpython/issues/93162\n\n(47) https://github.com/python/cpython/issues/111049\n\n(48) https://github.com/python/cpython/issues/110345\n\n(49) https://github.com/python/cpython/issues/109858\n\n(50) https://github.com/python/cpython/issues/114440\n\n(51) https://github.com/python/cpython/issues/38807\n\n(52) https://github.com/python/cpython/issues/75705\n\n(53) https://github.com/python/cpython/issues/106233\n\n(54) https://github.com/python/cpython/issues/105102\n\n(55) https://github.com/python/cpython/issues/104282\n\n(56) https://github.com/python/cpython/issues/102512\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=35928\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=26791\n\n(59) https://bugs.python.org/issue?@action=redirect&bpo=36959\n\n(60) https://bugs.python.org/issue?@action=redirect&bpo=18060\n\nFile: python3.12.info,  Node: Documentation<3>,  Next: Tests<2>,  Prev: Library<2>,  Up: Python 3 12 2 final\n\n1.22.2.4 Documentation\n......................\n\n- gh-110746(1): Improved markup for valid options/values for methods\nttk.treeview.column and ttk.treeview.heading, and for Layouts.\n\n- gh-95649(2): Document that the *note asyncio: 9. module contains\ncode taken from v0.16.0 of the uvloop project(3), as well as the\nrequired MIT licensing information.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/110746\n\n(2) https://github.com/python/cpython/issues/95649\n\n(3) https://github.com/MagicStack/uvloop/tree/v0.16.0\n\nFile: python3.12.info,  Node: Tests<2>,  Next: Build<2>,  Prev: Documentation<3>,  Up: Python 3 12 2 final\n\n1.22.2.5 Tests\n..............\n\n- gh-109980(1): Fix 'testtarfilevstar' in 'testshutil' for macOS,\nwhere system tar can include more information in the archive than\n*note shutil.makearchive: 1d4.\n\n- gh-105089(2): Fix\n'test.testzipfile.testcore.TestWithDirectory.testcreatedirectorywithwrite'\ntest in AIX by doing a bitwise AND of 0xFFFF on mode , so that it\nwill be in sync with 'zinfo.externalattr'\n\n- bpo-40648(3): Test modes that file can get with chmod() on Windows.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/109980\n\n(2) https://github.com/python/cpython/issues/105089\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=40648\n\nFile: python3.12.info,  Node: Build<2>,  Next: Windows<2>,  Prev: Tests<2>,  Up: Python 3 12 2 final\n\n1.22.2.6 Build\n..............\n\n- gh-112305(1): Fixed the 'check-clean-src' step performed on out of\ntree builds to detect errant '$(srcdir)/Python/frozenmodules/*.h'\nfiles and recommend appropriate source tree cleanup steps to get a\nworking build again.\n\n- gh-112867(2): Fix the build for the case that\nWITHPYMALLOCRADIXTREE=0 set.\n\n- bpo-11102(3): The *note os.major(): 13d7, *note os.makedev(): 13d8,\nand *note os.minor(): 13d9. functions are now available on HP-UX\nv3.\n\n- bpo-36351(4): Do not set ipv6type when cross-compiling.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/112305\n\n(2) https://github.com/python/cpython/issues/112867\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=11102\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=36351\n\nFile: python3.12.info,  Node: Windows<2>,  Next: macOS,  Prev: Build<2>,  Up: Python 3 12 2 final\n\n1.22.2.7 Windows\n................\n\n- gh-109991(1): Update Windows build to use OpenSSL 3.0.13.\n\n- gh-111239(2): Update Windows builds to use zlib v1.3.1.\n\n- gh-100107(3): The 'py.exe' launcher will no longer attempt to run\nthe Microsoft Store redirector when launching a script containing a\n'/usr/bin/env' shebang\n\n- gh-114096(4): Process privileges that are activated for creating\ndirectory junctions are now restored afterwards, avoiding behaviour\nchanges in other parts of the program.\n\n- gh-111877(5): *note os.stat(): 1bf. calls were returning incorrect\ntime values for files that could not be accessed directly.\n\n- gh-113009(6): *note multiprocessing: 8f.: On Windows, fix a race\ncondition in 'Process.terminate()': no longer set the 'returncode'\nattribute to always call 'WaitForSingleObject()' in\n'Process.wait()'.  Previously, sometimes the process was still\nrunning after 'TerminateProcess()' even if 'GetExitCodeProcess()'\nis not 'STILLACTIVE'.  Patch by Victor Stinner.\n\n- gh-87868(7): Correctly sort and remove duplicate environment\nvariables in 'winapi.CreateProcess()'.\n\n- bpo-37308(8): Fix mojibake in *note mmap.mmap: 830. when using a\nnon-ASCII 'tagname' argument on Windows.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/109991\n\n(2) https://github.com/python/cpython/issues/111239\n\n(3) https://github.com/python/cpython/issues/100107\n\n(4) https://github.com/python/cpython/issues/114096\n\n(5) https://github.com/python/cpython/issues/111877\n\n(6) https://github.com/python/cpython/issues/113009\n\n(7) https://github.com/python/cpython/issues/87868\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=37308\n\nFile: python3.12.info,  Node: macOS,  Next: IDLE<4>,  Prev: Windows<2>,  Up: Python 3 12 2 final\n\n1.22.2.8 macOS\n..............\n\n- gh-115009(1): Update macOS installer to use SQLite 3.45.1.\n\n- gh-109991(2): Update macOS installer to use OpenSSL 3.0.13.\n\n- gh-110459(3): Running 'configure ... --with-openssl-rpath=X/Y/Z' no\nlonger fails to detect OpenSSL on macOS.\n\n- gh-74573(4): Document that *note dbm.ndbm: 32. can silently corrupt\nDBM files on updates when exceeding undocumented platform limits,\nand can crash (segmentation fault) when reading such a corrupted\nfile.  (FB8919203)\n\n- gh-65701(5): The 'freeze' tool doesn't work with framework builds\nof Python.  Document this and bail out early when running the tool\nwith such a build.\n\n- gh-108269(6): Set 'CFBundleAllowMixedLocalizations' to true in the\nInfo.plist for the framework, embedded Python.app and IDLE.app with\nframework installs on macOS. This allows applications to pick up\nthe user's preferred locale when that's different from english.\n\n- gh-102362(7): Make sure the result of 'sysconfig.getplaform()'\nincludes at least a major and minor versions, even if\n'MACOSXDEPLOYMENTTARGET' is set to only a major version during\nbuild to match the format expected by pip.\n\n- gh-110017(8): Disable a signal handling stress test on macOS due to\na bug in macOS (FB13453490).\n\n- gh-110820(9): Make sure the preprocessor definitions for\n'ALIGNOFMAXALIGNT', 'SIZEOFLONGDOUBLE' and\n'HAVEGCCASMFORX64' are correct for Universal 2 builds on macOS.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/115009\n\n(2) https://github.com/python/cpython/issues/109991\n\n(3) https://github.com/python/cpython/issues/110459\n\n(4) https://github.com/python/cpython/issues/74573\n\n(5) https://github.com/python/cpython/issues/65701\n\n(6) https://github.com/python/cpython/issues/108269\n\n(7) https://github.com/python/cpython/issues/102362\n\n(8) https://github.com/python/cpython/issues/110017\n\n(9) https://github.com/python/cpython/issues/110820\n\nFile: python3.12.info,  Node: IDLE<4>,  Next: Tools/Demos<2>,  Prev: macOS,  Up: Python 3 12 2 final\n\n1.22.2.9 IDLE\n.............\n\n- gh-96905(1): In idlelib code, stop redefining built-ins 'dict' and\n'object'.\n\n- gh-72284(2): Improve the lists of features, editor key bindings,\nand shell key bingings in the IDLE doc.\n\n- gh-113903(3): Fix rare failure of test.testidle, in\ntestconfigdialog.\n\n- gh-113729(4): Fix the \"Help -> IDLE Doc\" menu bug in 3.11.7 and\n3.12.1.\n\n- gh-113269(5): Fix testeditor hang on macOS Catalina.\n\n- gh-112898(6): Fix processing unsaved files when quitting IDLE on\nmacOS.\n\n- gh-103820(7): Revise IDLE bindings so that events from mouse button\n4/5 on non-X11 windowing systems (i.e.  Win32 and Aqua) are not\nmistaken for scrolling.\n\n- bpo-13586(8): Enter the selected text when opening the \"Replace\"\ndialog.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/96905\n\n(2) https://github.com/python/cpython/issues/72284\n\n(3) https://github.com/python/cpython/issues/113903\n\n(4) https://github.com/python/cpython/issues/113729\n\n(5) https://github.com/python/cpython/issues/113269\n\n(6) https://github.com/python/cpython/issues/112898\n\n(7) https://github.com/python/cpython/issues/103820\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=13586\n\nFile: python3.12.info,  Node: Tools/Demos<2>,  Prev: IDLE<4>,  Up: Python 3 12 2 final\n\n1.22.2.10 Tools/Demos\n.....................\n\n- gh-109991(1): Update GitHub CI workflows to use OpenSSL 3.0.13 and\nmultissltests to use 1.1.1w, 3.0.13, 3.1.5, and 3.2.1.\n\n- gh-115015(2): Fix a bug in Argument Clinic that generated incorrect\ncode for methods with no parameters that use the *note METHMETHOD\n| METHFASTCALL | METHKEYWORDS: 13de. calling convention.  Only\nthe positional parameter count was checked; any keyword argument\npassed would be silently accepted.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/109991\n\n(2) https://github.com/python/cpython/issues/115015\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 12 1 final,  Next: Python 3 12 0 final,  Prev: Python 3 12 2 final,  Up: Changelog": {
            "content": "'Release date: 2023-12-07'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<3>.\n* Library: Library<3>.\n* Documentation: Documentation<4>.\n* Tests: Tests<3>.\n* Build: Build<3>.\n* Windows: Windows<3>.\n* macOS: macOS<2>.\n* IDLE: IDLE<5>.\n* C API: C API<2>.\n\nFile: python3.12.info,  Node: Core and Builtins<3>,  Next: Library<3>,  Up: Python 3 12 1 final\n\n1.22.3.1 Core and Builtins\n..........................\n\n- gh-112125(1): Fix None.ne(None) returning NotImplemented\ninstead of False\n\n- gh-112625(2): Fixes a bug where a bytearray object could be cleared\nwhile iterating over an argument in the 'bytearray.join()' method\nthat could result in reading memory after it was freed.\n\n- gh-105967(3): Workaround a bug in Apple's macOS platform zlib\nlibrary where *note zlib.crc32(): 13e1. and *note binascii.crc32():\n13e2. could produce incorrect results on multi-gigabyte inputs.\nIncluding when using *note zipfile: 12b. on zips containing large\ndata.\n\n- gh-112356(4): Stopped erroneously deleting a 'LOADNULL' bytecode\ninstruction when optimized twice.\n\n- gh-111058(5): Change coro.crframe/gen.giframe to return 'None'\nafter the coroutine/generator has been closed.  This fixes a bug\nwhere *note getcoroutinestate(): c78. and *note\ngetgeneratorstate(): 10ac. return the wrong state for a closed\ncoroutine/generator.\n\n- gh-112388(6): Fix an error that was causing the parser to try to\noverwrite tokenizer errors.  Patch by pablo Galindo\n\n- gh-112387(7): Fix error positions for decoded strings with\nbackwards tokenize errors.  Patch by Pablo Galindo\n\n- gh-112367(8): Avoid undefined behaviour when using the perf\ntrampolines by not freeing the code arenas until shutdown.  Patch\nby Pablo Galindo\n\n- gh-112243(9): Don't include comments in f-string debug expressions.\nPatch by Pablo Galindo\n\n- gh-112266(10): Change docstrings of *note dict: aa8. and\n'weakref'.\n\n- gh-111654(11): Fix runtime crash when some error happens in opcode\n'LOADFROMDICTORDEREF'.\n\n- gh-109181(12): Speed up 'Traceback' object creation by lazily\ncompute the line number.  Patch by Pablo Galindo\n\n- gh-102388(13): Fix a bug where 'iso2022jp3' and 'iso2022jp2004'\ncodecs read out of bounds\n\n- gh-111366(14): Fix an issue in the *note codeop: 1a. that was\ncausing *note SyntaxError: 146. exceptions raised in the presence\nof invalid syntax to not contain precise error messages.  Patch by\nPablo Galindo\n\n- gh-111380(15): Fix a bug that was causing *note SyntaxWarning: 178.\nto appear twice when parsing if invalid syntax is encountered\nlater.  Patch by Pablo galindo\n\n- gh-94438(16): Fix a regression that prevented jumping across 'is\nNone' and 'is not None' when debugging.  Patch by Savannah\nOstrowski.\n\n- gh-110938(17): Fix error messages for indented blocks with\nfunctions and classes with generic type parameters.  Patch by Pablo\nGalindo\n\n- gh-109894(18): Fixed crash due to improperly initialized static\n*note MemoryError: 13e3. in subinterpreter.\n\n- gh-110782(19): Fix crash when *note typing.TypeVar: 164. is\nconstructed with a keyword argument.  Patch by Jelle Zijlstra.\n\n- gh-110696(20): Fix incorrect error message for invalid argument\nunpacking.  Patch by Pablo Galindo\n\n- gh-110543(21): Fix regression in Python 3.12 where\n'types.CodeType.replace()' would produce a broken code object if\ncalled on a module or class code object that contains a\ncomprehension.  Patch by Jelle Zijlstra.\n\n- gh-110514(22): Add 'PYTHROW' to *note sys.setprofile(): 1359.\nevents\n\n- gh-110455(23): Guard 'assert(tstate->threadid > 0)' with '#ifndef\nHAVEPTHREADSTUBS'.  This allows for for pydebug builds to work\nunder WASI which (currently) lacks thread support.\n\n- gh-110259(24): Correctly identify the format spec in f-strings\n(with single or triple quotes) that have multiple lines in the\nexpression part and include a formatting spec.  Patch by Pablo\nGalindo\n\n- gh-110237(25): Fix missing error checks for calls to\n'PyListAppend' in 'PyEvalMatchClass'.\n\n- gh-109889(26): Fix the compiler's redundant NOP detection algorithm\nto skip over NOPs with no line number when looking for the next\ninstruction's lineno.\n\n- gh-109853(27): 'sys.path[0]' is now set correctly for\nsubinterpreters.\n\n- gh-105716(28): Subinterpreters now correctly handle the case where\nthey have threads running in the background.  Before, such threads\nwould interfere with cleaning up and destroying them, as well as\nprevent running another script.\n\n- gh-109793(29): The main thread no longer exits prematurely when a\nsubinterpreter is cleaned up during runtime finalization.  The bug\nwas a problem particularly because, when triggered, the Python\nprocess would always return with a 0 exitcode, even if it failed.\n\n- gh-109596(30): Fix some tokens in the grammar that were incorrectly\nmarked as soft keywords.  Also fix some repeated rule names and\nensure that repeated rules are not allowed.  Patch by Pablo Galindo\n\n- gh-109351(31): Fix crash when compiling an invalid AST involving a\nnamed (walrus) expression.\n\n- gh-109216(32): Fix possible memory leak in *note BUILDMAP: 13e4.\n\n- gh-109207(33): Fix a SystemError in 'repr' of symtable entry\nobject.\n\n- gh-109179(34): Fix bug where the C traceback display drops notes\nfrom *note SyntaxError: 146.\n\n- gh-109052(35): Use the base opcode when comparing code objects to\navoid interference from instrumentation\n\n- gh-88943(36): Improve syntax error for non-ASCII character that\nfollows a numerical literal.  It now points on the invalid\nnon-ASCII character, not on the valid numerical literal.\n\n- gh-106931(37): Statically allocated string objects are now interned\nglobally instead of per-interpreter.  This fixes a situation where\nsuch a string would only be interned in a single interpreter.\nNormal string objects are unaffected.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/112125\n\n(2) https://github.com/python/cpython/issues/112625\n\n(3) https://github.com/python/cpython/issues/105967\n\n(4) https://github.com/python/cpython/issues/112356\n\n(5) https://github.com/python/cpython/issues/111058\n\n(6) https://github.com/python/cpython/issues/112388\n\n(7) https://github.com/python/cpython/issues/112387\n\n(8) https://github.com/python/cpython/issues/112367\n\n(9) https://github.com/python/cpython/issues/112243\n\n(10) https://github.com/python/cpython/issues/112266\n\n(11) https://github.com/python/cpython/issues/111654\n\n(12) https://github.com/python/cpython/issues/109181\n\n(13) https://github.com/python/cpython/issues/102388\n\n(14) https://github.com/python/cpython/issues/111366\n\n(15) https://github.com/python/cpython/issues/111380\n\n(16) https://github.com/python/cpython/issues/94438\n\n(17) https://github.com/python/cpython/issues/110938\n\n(18) https://github.com/python/cpython/issues/109894\n\n(19) https://github.com/python/cpython/issues/110782\n\n(20) https://github.com/python/cpython/issues/110696\n\n(21) https://github.com/python/cpython/issues/110543\n\n(22) https://github.com/python/cpython/issues/110514\n\n(23) https://github.com/python/cpython/issues/110455\n\n(24) https://github.com/python/cpython/issues/110259\n\n(25) https://github.com/python/cpython/issues/110237\n\n(26) https://github.com/python/cpython/issues/109889\n\n(27) https://github.com/python/cpython/issues/109853\n\n(28) https://github.com/python/cpython/issues/105716\n\n(29) https://github.com/python/cpython/issues/109793\n\n(30) https://github.com/python/cpython/issues/109596\n\n(31) https://github.com/python/cpython/issues/109351\n\n(32) https://github.com/python/cpython/issues/109216\n\n(33) https://github.com/python/cpython/issues/109207\n\n(34) https://github.com/python/cpython/issues/109179\n\n(35) https://github.com/python/cpython/issues/109052\n\n(36) https://github.com/python/cpython/issues/88943\n\n(37) https://github.com/python/cpython/issues/106931\n\nFile: python3.12.info,  Node: Library<3>,  Next: Documentation<4>,  Prev: Core and Builtins<3>,  Up: Python 3 12 1 final\n\n1.22.3.2 Library\n................\n\n- gh-79325(1): Fix an infinite recursion error in *note\ntempfile.TemporaryDirectory(): 10aa. cleanup on Windows.\n\n- gh-112645(2): Remove deprecation error on passing 'onerror' to\n*note shutil.rmtree(): 1d5.\n\n- gh-112618(3): Fix a caching bug relating to *note typing.Annotated:\n75b.  'Annotated[str, True]' is no longer identical to\n'Annotated[str, 1]'.\n\n- gh-112334(4): Fixed a performance regression in 3.12's *note\nsubprocess: d0. on Linux where it would no longer use the fast-path\n'vfork()' system call when it should have due to a logic bug,\ninstead always falling back to the safe but slower 'fork()'.\n\nAlso fixed a related 3.12 security regression: If a value of\n'extragroups=[]' was passed to *note subprocess.Popen: 8c3. or\nrelated APIs, the underlying 'setgroups(0, NULL)' system call to\nclear the groups list would not be made in the child process prior\nto 'exec()'.  This has been assigned CVE-2023-6507.\n\nThis was identified via code inspection in the process of fixing\nthe first bug.\n\n- gh-110190(5): Fix ctypes structs with array on Arm platform by\nsetting 'MAXSTRUCTSIZE' to 32 in stgdict.  Patch by Diego Russo.\n\n- gh-112578(6): Fix a spurious *note RuntimeWarning: 8c9. when\nexecuting the *note zipfile: 12b. module.\n\n- gh-112509(7): Fix edge cases that could cause a key to be present\nin both the 'requiredkeys' and 'optionalkeys' attributes\nof a *note typing.TypedDict: 153.  Patch by Jelle Zijlstra.\n\n- gh-112414(8): Fix regression in Python 3.12 where calling *note\nrepr(): 5f0. on a module that had been imported using a custom\n*note loader: 13e6. could fail with *note AttributeError: 395.\nPatch by Alex Waygood.\n\n- gh-112358(9): Revert change to *note struct.Struct: 13e7.\ninitialization that broke some cases of subclassing.\n\n- gh-94722(10): Fix bug where comparison between instances of *note\nDocTest: 13e8. fails if one of them has 'None' as its lineno.\n\n- gh-112105(11): Make *note readline.setcompleterdelims(): 13e9.\nwork with libedit\n\n- gh-111942(12): Fix SystemError in the TextIOWrapper constructor\nwith non-encodable \"errors\" argument in non-debug mode.\n\n- gh-109538(13): Issue warning message instead of having *note\nRuntimeError: 17a. be displayed when event loop has already been\nclosed at 'StreamWriter.del()'.\n\n- gh-111942(14): Fix crashes in *note io.TextIOWrapper.reconfigure():\n983. when pass invalid arguments, e.g.  non-string encoding.\n\n- gh-111460(15): *note curses: 29.: restore wide character support\n(including *note curses.ungetwch(): f0f. and *note getwch():\nf0e.) on macOS, which was unavailable due to a regression in Python\n3.12.\n\n- gh-103791(16): *note contextlib.suppress: d93. now supports\nsuppressing exceptions raised as part of a *note\nBaseExceptionGroup: 377, in addition to the recent support for\n*note ExceptionGroup: 17b.\n\n- gh-111804(17): Remove posix.fallocate() under WASI as the\nunderlying posixfallocate() is not available in WASI preview2.\n\n- gh-111841(18): Fix truncating arguments on an embedded null\ncharacter in *note os.putenv(): 73a. and *note os.unsetenv(): 739.\non Windows.\n\n- gh-111541(19): Fix *note doctest: 36. for *note SyntaxError: 146.\nnot-builtin subclasses.\n\n- gh-110894(20): Call loop exception handler for exceptions in\n'clientconnectedcb' of *note asyncio.startserver(): 951. so that\napplications can handle it.  Patch by Kumar Aditya.\n\n- gh-111531(21): Fix reference leaks in 'bindclass()' and\n'bindall()' methods of *note tkinter: ea. widgets.\n\n- gh-111356(22): Added *note io.textencoding(): 13ea, *note\nio.DEFAULTBUFFERSIZE: 13eb, and *note\nio.IncrementalNewlineDecoder: 13ec. to 'io.all'.\n\n- gh-111342(23): Fixed typo in *note math.sumprod(): 1b6.\n\n- gh-68166(24): Remove mention of not supported \"vsapi\" element type\nin *note tkinter.ttk.Style.elementcreate(): 13ed.  Add tests for\n'elementcreate()' and other 'ttk.Style' methods.  Add examples for\n'elementcreate()' in the documentation.\n\n- gh-75666(25): Fix the behavior of *note tkinter: ea. widget's\n'unbind()' method with two arguments.  Previously,\n'widget.unbind(sequence, funcid)' destroyed the current binding for\n'sequence', leaving 'sequence' unbound, and deleted the 'funcid'\ncommand.  Now it removes only 'funcid' from the binding for\n'sequence', keeping other commands, and deletes the 'funcid'\ncommand.  It leaves 'sequence' unbound only if 'funcid' was the\nlast bound command.\n\n- gh-79033(26): Another attempt at fixing *note\nasyncio.Server.waitclosed(): 13ee.  It now blocks until both\nconditions are true: the server is closed, 'and' there are no more\nactive connections.  (This means that in some cases where in 3.12.0\nthis function would 'incorrectly' have returned immediately, it\nwill now block; in particular, when there are no active connections\nbut the server hasn't been closed yet.)\n\n- gh-111295(27): Fix *note time: e8. not checking for errors when\ninitializing.\n\n- gh-111253(28): Add error checking during 'socket' module init.\n\n- gh-111251(29): Fix 'blake2' not checking for errors when\ninitializing.\n\n- gh-111174(30): Fix crash in *note io.BytesIO.getbuffer(): 1065.\ncalled repeatedly for empty BytesIO.\n\n- gh-111187(31): Postpone removal version for\nlocale.getdefaultlocale() to Python 3.15.\n\n- gh-111159(32): Fix *note doctest: 36. output comparison for\nexceptions with notes.\n\n- gh-110910(33): Fix invalid state handling in *note\nasyncio.TaskGroup: 3c3. and *note asyncio.Timeout: 13ef.  They now\nraise proper RuntimeError if they are improperly used and are left\nin consistent state after this.\n\n- gh-111092(34): Make turtledemo run without default root enabled.\n\n- gh-110488(35): Fix a couple of issues in *note\npathlib.PurePath.withname(): 13f0.: a single dot was incorrectly\nconsidered a valid name, and in 'PureWindowsPath', a name with an\nNTFS alternate data stream, like 'a:b', was incorrectly considered\ninvalid.\n\n- gh-110392(36): Fix *note tty.setraw(): 13f1. and *note\ntty.setcbreak(): 13c8.: previously they returned partially modified\nlist of the original tty attributes.  *note tty.cfmakeraw(): 13f2.\nand *note tty.cfmakecbreak(): 13c9. now make a copy of the list of\nspecial characters before modifying it.\n\n- gh-110590(37): Fix a bug in 'sre.compile()' where *note TypeError:\n28e. would be overwritten by *note OverflowError: 68d. when the\n'code' argument was a list of non-ints.\n\n- gh-65052(38): Prevent *note pdb: a0. from crashing when trying to\ndisplay undisplayable objects\n\n- gh-110519(39): Deprecation warning about non-integer number in\n*note gettext: 5e. now alwais refers to the line in the user code\nwhere gettext function or method is used.  Previously it could\nrefer to a line in 'gettext' code.\n\n- gh-110395(40): Ensure that *note select.kqueue(): 13f3. objects\ncorrectly appear as closed in forked children, to prevent\noperations on an invalid file descriptor.\n\n- gh-110378(41): *note contextmanager(): 1076. and *note\nasynccontextmanager(): 963. context managers now close an invalid\nunderlying generator object that yields more then one value.\n\n- gh-110365(42): Fix *note termios.tcsetattr(): 13f4. bug that was\noverwritting existing errors during parsing integers from 'term'\nlist.\n\n- gh-109653(43): Fix a Python 3.12 regression in the import time of\n*note random: b3.  Patch by Alex Waygood.\n\n- gh-110196(44): Add 'reduce' method to 'IPv6Address' in order to\nkeep 'scopeid'\n\n- gh-110036(45): On Windows, multiprocessing 'Popen.terminate()' now\ncatchs *note PermissionError: b9a. and get the process exit code.\nIf the process is still running, raise again the *note\nPermissionError: b9a.  Otherwise, the process terminated as\nexpected: store its exit code.  Patch by Victor Stinner.\n\n- gh-110038(46): Fixed an issue that caused 'KqueueSelector.select()'\nto not return all the ready events in some cases when a file\ndescriptor is registered for both read and write.\n\n- gh-109631(47): *note re: b4. functions such as *note re.findall():\nea1, *note re.split(): 9ae, *note re.search(): 10a2. and *note\nre.sub(): 1ff. which perform short repeated matches can now be\ninterrupted by user.\n\n- gh-109747(48): Improve errors for unsupported look-behind patterns.\nNow re.error is raised instead of OverflowError or RuntimeError for\ntoo large width of look-behind pattern.\n\n- gh-109818(49): Fix *note reprlib.recursiverepr(): 1067. not\ncopying 'typeparams' from decorated function.\n\n- gh-109047(50): *note concurrent.futures: 1f.: The 'executor manager\nthread' now catches exceptions when adding an item to the 'call\nqueue'.  During Python finalization, creating a new thread can now\nraise *note RuntimeError: 17a.  Catch the exception and call\n'terminatebroken()' in this case.  Patch by Victor Stinner.\n\n- gh-109782(51): Ensure the signature of *note os.path.isdir(): 839.\nis identical on all platforms.  Patch by Amin Alaee.\n\n- gh-109590(52): *note shutil.which(): 1d6. will prefer files with an\nextension in 'PATHEXT' if the given mode includes 'os.XOK' on\nwin32.  If no 'PATHEXT' match is found, a file without an extension\nin 'PATHEXT' can be returned.  This change will have *note\nshutil.which(): 1d6. act more similarly to previous behavior in\nPython 3.11.\n\n- gh-109786(53): Fix possible reference leaks and crash when re-enter\nthe 'next()' method of *note itertools.pairwise: 608.\n\n- gh-109593(54): Avoid deadlocking on a reentrant call to the\nmultiprocessing resource tracker.  Such a reentrant call, though\nunlikely, can happen if a GC pass invokes the finalizer for a\nmultiprocessing object such as SemLock.\n\n- gh-109613(55): Fix *note os.stat(): 1bf. and *note\nos.DirEntry.stat(): 13f5.: check for exceptions.  Previously, on\nPython built in debug mode, these functions could trigger a fatal\nPython error (and abort the process) when a function succeeded with\nan exception set.  Patch by Victor Stinner.\n\n- gh-109375(56): The *note pdb: a0. 'alias' command now prevents\nregistering aliases without arguments.\n\n- gh-107219(57): Fix a race condition in 'concurrent.futures'.  When\na process in the process pool was terminated abruptly (while the\nfuture was running or pending), close the connection write end.  If\nthe call queue is blocked on sending bytes to a worker process,\nclosing the connection write end interrupts the send, so the queue\ncan be closed.  Patch by Victor Stinner.\n\n- gh-50644(58): Attempts to pickle or create a shallow or deep copy\nof *note codecs: 19. streams now raise a TypeError.  Previously,\ncopying failed with a RecursionError, while pickling produced wrong\nresults that eventually caused unpickling to fail with a\nRecursionError.\n\n- gh-108987(59): Fix *note thread.startnewthread(): 13f6. race\ncondition.  If a thread is created during Python finalization, the\nnewly spawned thread now exits immediately instead of trying to\naccess freed memory and lead to a crash.  Patch by Victor Stinner.\n\n- gh-108791(60): Improved error handling in *note pdb: a0. command\nline interface, making it produce more concise error messages.\n\n- gh-105829(61): Fix concurrent.futures.ProcessPoolExecutor deadlock\n\n- gh-106584(62): Fix exit code for 'unittest' if all tests are\nskipped.  Patch by Egor Eliseev.\n\n- gh-102956(63): Fix returning of empty byte strings after seek in\nzipfile module\n\n- gh-84867(64): *note unittest.TestLoader: 506. no longer loads test\ncases from exact *note unittest.TestCase: 159. and *note\nunittest.FunctionTestCase: 13f7. classes.\n\n- gh-91133(65): Fix a bug in *note tempfile.TemporaryDirectory: 10aa.\ncleanup, which now no longer dereferences symlinks when working\naround file system permission errors.\n\n- gh-73561(66): Omit the interface scope from an IPv6 address when\nused as Host header by *note http.client: 6a.\n\n- gh-86826(67): 'zipinfo' now supports the full range of values in\nthe TZ string determined by RFC 8536 and detects all invalid\nformats.  Both Python and C implementations now raise exceptions of\nthe same type on invalid data.\n\n- bpo-43153(68): On Windows, 'tempfile.TemporaryDirectory' previously\nmasked a 'PermissionError' with 'NotADirectoryError' during\ndirectory cleanup.  It now correctly raises 'PermissionError' if\nerrors are not ignored.  Patch by Andrei Kulakov and Ken Jin.\n\n- bpo-35332(69): The *note shutil.rmtree(): 1d5. function now ignores\nerrors when calling *note os.close(): 9b5. when 'ignoreerrors' is\n'True', and *note os.close(): 9b5. no longer retried after error.\n\n- bpo-41422(70): Fixed memory leaks of *note pickle.Pickler: 849. and\n*note pickle.Unpickler: 13f8. involving cyclic references via the\ninternal memo mapping.\n\n- bpo-40262(71): The 'ssl.SSLSocket.recvinto()' method no longer\nrequires the 'buffer' argument to implement 'len' and supports\nbuffers with arbitrary item size.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/79325\n\n(2) https://github.com/python/cpython/issues/112645\n\n(3) https://github.com/python/cpython/issues/112618\n\n(4) https://github.com/python/cpython/issues/112334\n\n(5) https://github.com/python/cpython/issues/110190\n\n(6) https://github.com/python/cpython/issues/112578\n\n(7) https://github.com/python/cpython/issues/112509\n\n(8) https://github.com/python/cpython/issues/112414\n\n(9) https://github.com/python/cpython/issues/112358\n\n(10) https://github.com/python/cpython/issues/94722\n\n(11) https://github.com/python/cpython/issues/112105\n\n(12) https://github.com/python/cpython/issues/111942\n\n(13) https://github.com/python/cpython/issues/109538\n\n(14) https://github.com/python/cpython/issues/111942\n\n(15) https://github.com/python/cpython/issues/111460\n\n(16) https://github.com/python/cpython/issues/103791\n\n(17) https://github.com/python/cpython/issues/111804\n\n(18) https://github.com/python/cpython/issues/111841\n\n(19) https://github.com/python/cpython/issues/111541\n\n(20) https://github.com/python/cpython/issues/110894\n\n(21) https://github.com/python/cpython/issues/111531\n\n(22) https://github.com/python/cpython/issues/111356\n\n(23) https://github.com/python/cpython/issues/111342\n\n(24) https://github.com/python/cpython/issues/68166\n\n(25) https://github.com/python/cpython/issues/75666\n\n(26) https://github.com/python/cpython/issues/79033\n\n(27) https://github.com/python/cpython/issues/111295\n\n(28) https://github.com/python/cpython/issues/111253\n\n(29) https://github.com/python/cpython/issues/111251\n\n(30) https://github.com/python/cpython/issues/111174\n\n(31) https://github.com/python/cpython/issues/111187\n\n(32) https://github.com/python/cpython/issues/111159\n\n(33) https://github.com/python/cpython/issues/110910\n\n(34) https://github.com/python/cpython/issues/111092\n\n(35) https://github.com/python/cpython/issues/110488\n\n(36) https://github.com/python/cpython/issues/110392\n\n(37) https://github.com/python/cpython/issues/110590\n\n(38) https://github.com/python/cpython/issues/65052\n\n(39) https://github.com/python/cpython/issues/110519\n\n(40) https://github.com/python/cpython/issues/110395\n\n(41) https://github.com/python/cpython/issues/110378\n\n(42) https://github.com/python/cpython/issues/110365\n\n(43) https://github.com/python/cpython/issues/109653\n\n(44) https://github.com/python/cpython/issues/110196\n\n(45) https://github.com/python/cpython/issues/110036\n\n(46) https://github.com/python/cpython/issues/110038\n\n(47) https://github.com/python/cpython/issues/109631\n\n(48) https://github.com/python/cpython/issues/109747\n\n(49) https://github.com/python/cpython/issues/109818\n\n(50) https://github.com/python/cpython/issues/109047\n\n(51) https://github.com/python/cpython/issues/109782\n\n(52) https://github.com/python/cpython/issues/109590\n\n(53) https://github.com/python/cpython/issues/109786\n\n(54) https://github.com/python/cpython/issues/109593\n\n(55) https://github.com/python/cpython/issues/109613\n\n(56) https://github.com/python/cpython/issues/109375\n\n(57) https://github.com/python/cpython/issues/107219\n\n(58) https://github.com/python/cpython/issues/50644\n\n(59) https://github.com/python/cpython/issues/108987\n\n(60) https://github.com/python/cpython/issues/108791\n\n(61) https://github.com/python/cpython/issues/105829\n\n(62) https://github.com/python/cpython/issues/106584\n\n(63) https://github.com/python/cpython/issues/102956\n\n(64) https://github.com/python/cpython/issues/84867\n\n(65) https://github.com/python/cpython/issues/91133\n\n(66) https://github.com/python/cpython/issues/73561\n\n(67) https://github.com/python/cpython/issues/86826\n\n(68) https://bugs.python.org/issue?@action=redirect&bpo=43153\n\n(69) https://bugs.python.org/issue?@action=redirect&bpo=35332\n\n(70) https://bugs.python.org/issue?@action=redirect&bpo=41422\n\n(71) https://bugs.python.org/issue?@action=redirect&bpo=40262\n\nFile: python3.12.info,  Node: Documentation<4>,  Next: Tests<3>,  Prev: Library<3>,  Up: Python 3 12 1 final\n\n1.22.3.3 Documentation\n......................\n\n- gh-111699(1): Relocate 'smtpd' deprecation notice to its own\nsection rather than under 'locale' in What's New in Python 3.12\ndocument\n\n- gh-108826(2): *note dis: 35. module command-line interface is now\nmentioned in documentation.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/111699\n\n(2) https://github.com/python/cpython/issues/108826\n\nFile: python3.12.info,  Node: Tests<3>,  Next: Build<3>,  Prev: Documentation<4>,  Up: Python 3 12 1 final\n\n1.22.3.4 Tests\n..............\n\n- gh-112769(1): The tests now correctly compare zlib version when\n*note zlib.ZLIBRUNTIMEVERSION: fe3. contains non-integer\nsuffixes.  For example zlib-ng defines the version as\n'1.3.0.zlib-ng'.\n\n- gh-110367(2): Make regrtest '--verbose3' option compatible with\n'--huntrleaks -jN' options.  The './python -m test -j1 -R 3:3\n--verbose3' command now works as expected.  Patch by Victor\nStinner.\n\n- gh-111165(3): Remove no longer used functions 'rununittest()' and\n'rundoctest()' from the *note test.support: de. module.\n\n- gh-110932(4): Fix regrtest if the 'SOURCEDATEEPOCH' environment\nvariable is defined: use the variable value as the random seed.\nPatch by Victor Stinner.\n\n- gh-110995(5): testgdb: Fix detection of gdb built without Python\nscripting support.  Patch by Victor Stinner.\n\n- gh-110918(6): Test case matching patterns specified by options\n'--match', '--ignore', '--matchfile' and '--ignorefile' are now\ntested in the order of specification, and the last match determines\nwhether the test case be run or ignored.\n\n- gh-110647(7): Fix teststressmodifyinghandlers() of testsignal.\nPatch by Victor Stinner.\n\n- gh-103053(8): Fix testtools.testfreeze on FreeBSD: run \"make\ndistclean\" instead of \"make clean\" in the copied source directory\nto remove also the \"python\" program.  Patch by Victor Stinner.\n\n- gh-110167(9): Fix a deadlock in testsocket when server fails with\na timeout but the client is still running in its thread.  Don't\nhold a lock to call cleanup functions in doCleanups().  One of the\ncleanup function waits until the client completes, whereas the\nclient could deadlock if it called addCleanup() in such situation.\nPatch by Victor Stinner.\n\n- gh-110388(10): Add tests for *note tty: fb.\n\n- gh-81002(11): Add tests for *note termios: db.\n\n- gh-110267(12): Add tests for pickling and copying PyStructSequence\nobjects.  Patched by Xuehai Pan.\n\n- gh-110031(13): Skip testthreading tests using thread+fork if\nPython is built with Address Sanitizer (ASAN). Patch by Victor\nStinner.\n\n- gh-110088(14): Fix testasyncio timeouts: don't measure the maximum\nduration, a test should not measure a CI performance.  Only measure\nthe minimum duration when a task has a timeout or delay.  Add\n'CLOCKRES' to 'testasyncio.utils'.  Patch by Victor Stinner.\n\n- gh-109974(15): Fix race conditions in testthreading lock tests.\nWait until a condition is met rather than using *note time.sleep():\n469. with a hardcoded number of seconds.  Patch by Victor Stinner.\n\n- gh-110033(16): Fix 'testinterprocesssignal()' of 'testsignal'.\nMake sure that the 'subprocess.Popen' object is deleted before the\ntest raising an exception in a signal handler.  Otherwise,\n'Popen.del()' can get the exception which is logged as\n'Exception ignored in: ...' and the test fails.  Patch by Victor\nStinner.\n\n- gh-109594(17): Fix testtimeout() of\ntestconcurrentfutures.testwait.  Remove the future which may or\nmay not complete depending if it takes longer than the timeout ot\nnot.  Keep the second future which does not complete before wait()\ntimeout.  Patch by Victor Stinner.\n\n- gh-109972(18): Split testgdb.py file into a testgdb package made\nof multiple tests, so tests can now be run in parallel.  Patch by\nVictor Stinner.\n\n- gh-103053(19): Skip testfreezesimplescript() of\ntesttools.testfreeze if Python is built with './configure\n--enable-optimizations', which means with Profile Guided\nOptimization (PGO): it just makes the test too slow.  The freeze\ntool is tested by many other CIs with other (faster) compiler\nflags.  Patch by Victor Stinner.\n\n- gh-109580(20): Skip 'testperfprofiler' if Python is built with\nASAN, MSAN or UBSAN sanitizer.  Python does crash randomly in this\ntest on such build.  Patch by Victor Stinner.\n\n- gh-104736(21): Fix testgdb on Python built with LLVM clang 16 on\nLinux ppc64le (ex: Fedora 38).  Search patterns in gdb \"bt\" command\noutput to detect when gdb fails to retrieve the traceback.  For\nexample, skip a test if 'Backtrace stopped: frame did not save the\nPC' is found.  Patch by Victor Stinner.\n\n- gh-108927(22): Fixed order dependence in running tests in the same\nprocess when a test that has submodules (e.g.  testimportlib)\nfollows a test that imports its submodule (e.g.\ntestimportlib.util) and precedes a test (e.g.  testunittest or\ntestcompileall) that uses that submodule.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/112769\n\n(2) https://github.com/python/cpython/issues/110367\n\n(3) https://github.com/python/cpython/issues/111165\n\n(4) https://github.com/python/cpython/issues/110932\n\n(5) https://github.com/python/cpython/issues/110995\n\n(6) https://github.com/python/cpython/issues/110918\n\n(7) https://github.com/python/cpython/issues/110647\n\n(8) https://github.com/python/cpython/issues/103053\n\n(9) https://github.com/python/cpython/issues/110167\n\n(10) https://github.com/python/cpython/issues/110388\n\n(11) https://github.com/python/cpython/issues/81002\n\n(12) https://github.com/python/cpython/issues/110267\n\n(13) https://github.com/python/cpython/issues/110031\n\n(14) https://github.com/python/cpython/issues/110088\n\n(15) https://github.com/python/cpython/issues/109974\n\n(16) https://github.com/python/cpython/issues/110033\n\n(17) https://github.com/python/cpython/issues/109594\n\n(18) https://github.com/python/cpython/issues/109972\n\n(19) https://github.com/python/cpython/issues/103053\n\n(20) https://github.com/python/cpython/issues/109580\n\n(21) https://github.com/python/cpython/issues/104736\n\n(22) https://github.com/python/cpython/issues/108927\n\nFile: python3.12.info,  Node: Build<3>,  Next: Windows<3>,  Prev: Tests<3>,  Up: Python 3 12 1 final\n\n1.22.3.5 Build\n..............\n\n- gh-112088(1): Add 'Tools/build/regen-configure.sh' script to\nregenerate the 'configure' with an Ubuntu container image.  The\n'quay.io/tiran/cpythonautoconf:271' container image\n(tiran/cpythonautoconf(2)) is no longer used.  Patch by Victor\nStinner.\n\n- gh-111046(3): For wasi-threads, memory is now exported to fix\ncompatibility issues with some wasm runtimes.\n\n- gh-103053(4): \"make check-clean-src\" now also checks if the\n\"python\" program is found in the source directory: fail with an\nerror if it does exist.  Patch by Victor Stinner.\n\n- gh-109191(5): Fix compile error when building with recent versions\nof libedit.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/112088\n\n(2) https://github.com/tiran/cpythonautoconf\n\n(3) https://github.com/python/cpython/issues/111046\n\n(4) https://github.com/python/cpython/issues/103053\n\n(5) https://github.com/python/cpython/issues/109191\n\nFile: python3.12.info,  Node: Windows<3>,  Next: macOS<2>,  Prev: Build<3>,  Up: Python 3 12 1 final\n\n1.22.3.6 Windows\n................\n\n- gh-111856(1): Fixes *note fstat(): be8. on file systems that do not\nsupport file ID requests.  This includes FAT32 and exFAT.\n\n- gh-111293(2): Fix *note os.DirEntry.inode: 13fd. dropping higher 64\nbits of a file id on some filesystems on Windows.\n\n- gh-110913(3): WindowsConsoleIO now correctly chunks large buffers\nwithout splitting up UTF-8 sequences.\n\n- gh-110437(4): Allows overriding the source of VC redistributables\nso that releases can be guaranteed to never downgrade between\nupdates.\n\n- gh-109286(5): Update Windows installer to use SQLite 3.43.1.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/111856\n\n(2) https://github.com/python/cpython/issues/111293\n\n(3) https://github.com/python/cpython/issues/110913\n\n(4) https://github.com/python/cpython/issues/110437\n\n(5) https://github.com/python/cpython/issues/109286\n\nFile: python3.12.info,  Node: macOS<2>,  Next: IDLE<5>,  Prev: Windows<3>,  Up: Python 3 12 1 final\n\n1.22.3.7 macOS\n..............\n\n- gh-109981(1): Use '/dev/fd' on macOS to determine the number of\nopen files in 'test.support.oshelper.fdcount' to avoid a crash\nwith \"guarded\" file descriptors when probing for open files.\n\n- gh-110950(2): Update macOS installer to include an upstream Tcl/Tk\nfix for the 'Secure coding is not enabled for restorable state!'\nwarning encountered in Tkinter on macOS 14 Sonoma.\n\n- gh-111015(3): Ensure that IDLE.app and Python Launcher.app are\ninstalled with appropriate permissions on macOS builds.\n\n- gh-109286(4): Update macOS installer to use SQLite 3.43.1.\n\n- gh-71383(5): Update macOS installer to include an upstream Tcl/Tk\nfix for the 'ttk::ThemeChanged' error encountered in Tkinter.\n\n- gh-92603(6): Update macOS installer to include a fix accepted by\nupstream Tcl/Tk for a crash encountered after the first *note\ntkinter.Tk(): 13ff. instance is destroyed.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/109981\n\n(2) https://github.com/python/cpython/issues/110950\n\n(3) https://github.com/python/cpython/issues/111015\n\n(4) https://github.com/python/cpython/issues/109286\n\n(5) https://github.com/python/cpython/issues/71383\n\n(6) https://github.com/python/cpython/issues/92603\n\nFile: python3.12.info,  Node: IDLE<5>,  Next: C API<2>,  Prev: macOS<2>,  Up: Python 3 12 1 final\n\n1.22.3.8 IDLE\n.............\n\n- bpo-35668(1): Add docstrings to the IDLE debugger module.  Fix two\nbugs: initialize Idb.botframe (should be in Bdb); in\nIdb.inrpccode, check whether prevframe is None before trying to\nuse it.  Greatly expand testdebugger.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=35668\n\nFile: python3.12.info,  Node: C API<2>,  Prev: IDLE<5>,  Up: Python 3 12 1 final\n\n1.22.3.9 C API\n..............\n\n- gh-106560(1): Fix redundant declarations in the public C API.\nDeclare PyBoolType and PyLongType only once.  Patch by Victor\nStinner.\n\n- gh-112438(2): Fix support of format units \"es\", \"et\", \"es#\", and\n\"et#\" in nested tuples in *note PyArgParseTuple(): 2d1.-like\nfunctions.\n\n- gh-109521(3): *note PyImportGetImporter(): 1402. now sets\nRuntimeError if it fails to get *note sys.pathhooks: e9b. or *note\nsys.pathimportercache: 3a9. or they are not list and dict\ncorrespondingly.  Previously it could return NULL without setting\nerror in obscure cases, crash or raise SystemError if these\nattributes have wrong type.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/106560\n\n(2) https://github.com/python/cpython/issues/112438\n\n(3) https://github.com/python/cpython/issues/109521\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 12 0 final,  Next: Python 3 12 0 release candidate 3,  Prev: Python 3 12 1 final,  Up: Changelog": {
            "content": "'Release date: 2023-10-02'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<4>.\n* Library: Library<4>.\n* Documentation: Documentation<5>.\n* Windows: Windows<4>.\n* macOS: macOS<3>.\n* Tools/Demos: Tools/Demos<3>.\n\nFile: python3.12.info,  Node: Core and Builtins<4>,  Next: Library<4>,  Up: Python 3 12 0 final\n\n1.22.4.1 Core and Builtins\n..........................\n\n- gh-109823(1): Fix bug where compiler does not adjust labels when\nremoving an empty basic block which is a jump target.\n\n- gh-109719(2): Fix missing jump target labels when compiler reorders\ncold/warm blocks.\n\n- gh-109627(3): Fix bug where the compiler does not assign a new jump\ntarget label to a duplicated small exit block.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/109823\n\n(2) https://github.com/python/cpython/issues/109719\n\n(3) https://github.com/python/cpython/issues/109627\n\nFile: python3.12.info,  Node: Library<4>,  Next: Documentation<5>,  Prev: Core and Builtins<4>,  Up: Python 3 12 0 final\n\n1.22.4.2 Library\n................\n\n- gh-110045(1): Update the *note symtable: d2. module to support the\nnew scopes introduced by PEP 695(2).\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/110045\n\n(2) https://peps.python.org/pep-0695/\n\nFile: python3.12.info,  Node: Documentation<5>,  Next: Windows<4>,  Prev: Library<4>,  Up: Python 3 12 0 final\n\n1.22.4.3 Documentation\n......................\n\n- gh-109209(1): The minimum Sphinx version required for the\ndocumentation is now 4.2.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/109209\n\nFile: python3.12.info,  Node: Windows<4>,  Next: macOS<3>,  Prev: Documentation<5>,  Up: Python 3 12 0 final\n\n1.22.4.4 Windows\n................\n\n- gh-109991(1): Update Windows build to use OpenSSL 3.0.11.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/109991\n\nFile: python3.12.info,  Node: macOS<3>,  Next: Tools/Demos<3>,  Prev: Windows<4>,  Up: Python 3 12 0 final\n\n1.22.4.5 macOS\n..............\n\n- gh-109991(1): Update macOS installer to use OpenSSL 3.0.11.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/109991\n\nFile: python3.12.info,  Node: Tools/Demos<3>,  Prev: macOS<3>,  Up: Python 3 12 0 final\n\n1.22.4.6 Tools/Demos\n....................\n\n- gh-109991(1): Update GitHub CI workflows to use OpenSSL 3.0.11 and\nmultissltests to use 1.1.1w, 3.0.11, and 3.1.3.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/109991\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 12 0 release candidate 3,  Next: Python 3 12 0 release candidate 2,  Prev: Python 3 12 0 final,  Up: Changelog": {
            "content": "'Release date: 2023-09-18'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<5>.\n* Library: Library<5>.\n* Documentation: Documentation<6>.\n* Tests: Tests<4>.\n* Build: Build<4>.\n\nFile: python3.12.info,  Node: Core and Builtins<5>,  Next: Library<5>,  Up: Python 3 12 0 release candidate 3\n\n1.22.5.1 Core and Builtins\n..........................\n\n- gh-109496(1): On a Python built in debug mode, *note PyDECREF():\n2cf. now calls 'PyNegativeRefcount()' if the object is a dangling\npointer to deallocated memory: memory filled with '0xDD' \"dead\nbyte\" by the debug hook on memory allocators.  The fix is to check\nthe reference count 'before' checking for 'PyIsImmortal()'.\nPatch by Victor Stinner.\n\n- gh-109371(2): Deopted instructions correctly for tool\ninitialization and modified the incorrect assertion in\ninstrumentation, when a previous tool already sets INSTRUCTION\nevents\n\n- gh-105658(3): Fix bug where the line trace of an except block\nending with a conditional includes an excess event with the line of\nthe conditional expression.\n\n- gh-109219(4): Fix compiling type param scopes that use a name which\nis also free in an inner scope.\n\n- gh-109341(5): Fix crash when compiling an invalid AST involving a\n*note ast.TypeAlias: 140c.\n\n- gh-109195(6): Fix source location for the 'LOAD*' instruction\npreceding a 'LOADSUPERATTR' to load the 'super' global (or\nshadowing variable) so that it encompasses only the name 'super'\nand not the following parentheses.\n\n- gh-109118(7): Disallow nested scopes (lambdas, generator\nexpressions, and comprehensions) within PEP 695 annotation scopes\nthat are nested within classes.\n\n- gh-109114(8): Relax the detection of the error message for invalid\nlambdas inside f-strings to not search for arbitrary replacement\nfields to avoid false positives.  Patch by Pablo Galindo\n\n- gh-109118(9): Fix interpreter crash when a NameError is raised\ninside the type parameters of a generic class.\n\n- gh-108976(10): Fix crash that occurs after de-instrumenting a code\nobject in a monitoring callback.\n\n- gh-108732(11): Make iteration variables of module- and class-scoped\ncomprehensions visible to pdb and other tools that use\n'frame.flocals' again.\n\n- gh-108959(12): Fix caret placement for error locations for\nsubscript and binary operations that involve non-semantic\nparentheses and spaces.  Patch by Pablo Galindo\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/109496\n\n(2) https://github.com/python/cpython/issues/109371\n\n(3) https://github.com/python/cpython/issues/105658\n\n(4) https://github.com/python/cpython/issues/109219\n\n(5) https://github.com/python/cpython/issues/109341\n\n(6) https://github.com/python/cpython/issues/109195\n\n(7) https://github.com/python/cpython/issues/109118\n\n(8) https://github.com/python/cpython/issues/109114\n\n(9) https://github.com/python/cpython/issues/109118\n\n(10) https://github.com/python/cpython/issues/108976\n\n(11) https://github.com/python/cpython/issues/108732\n\n(12) https://github.com/python/cpython/issues/108959\n\nFile: python3.12.info,  Node: Library<5>,  Next: Documentation<6>,  Prev: Core and Builtins<5>,  Up: Python 3 12 0 release candidate 3\n\n1.22.5.2 Library\n................\n\n- gh-108682(1): Enum: require 'names=()' or 'type=...' to create an\nempty enum using the functional syntax.\n\n- gh-108843(2): Fix an issue in *note ast.unparse(): 6fe. when\nunparsing f-strings containing many quote types.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/108682\n\n(2) https://github.com/python/cpython/issues/108843\n\nFile: python3.12.info,  Node: Documentation<6>,  Next: Tests<4>,  Prev: Library<5>,  Up: Python 3 12 0 release candidate 3\n\n1.22.5.3 Documentation\n......................\n\n- gh-102823(1): Document the return type of 'x // y' when 'x' and 'y'\nhave type *note float: 4b7.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/102823\n\nFile: python3.12.info,  Node: Tests<4>,  Next: Build<4>,  Prev: Documentation<6>,  Up: Python 3 12 0 release candidate 3\n\n1.22.5.4 Tests\n..............\n\n- gh-109396(1): Fix 'testsocket.testhmacsha1()' in FIPS mode.  Use\na longer key: FIPS mode requires at least of at least 112 bits.\nThe previous key was only 32 bits.  Patch by Victor Stinner.\n\n- gh-104736(2): Fix testgdb on Python built with LLVM clang 16 on\nLinux ppc64le (ex: Fedora 38).  Search patterns in gdb \"bt\" command\noutput to detect when gdb fails to retrieve the traceback.  For\nexample, skip a test if 'Backtrace stopped: frame did not save the\nPC' is found.  Patch by Victor Stinner.\n\n- gh-109237(3): Fix 'testsite.testunderpthbasic()' when the\nworking directory contains at least one non-ASCII character: encode\nthe '.pth' file to UTF-8 and enable the UTF-8 Mode to use UTF-8\nfor the child process stdout.  Patch by Victor Stinner.\n\n- gh-109230(4): Fix 'testpyexpat.testexception()': it can now be\nrun from a directory different than Python source code directory.\nBefore, the test failed in this case.  Skip the test if\nModules/pyexpat.c source is not available.  Skip also the test on\nPython implementations other than CPython.  Patch by Victor\nStinner.\n\n- gh-109015(5): Fix testasyncio, testimaplib and testsocket tests\non FreeBSD if the TCP blackhole is enabled ('sysctl\nnet.inet.tcp.blackhole').  Skip the few tests which failed with\n'ETIMEDOUT' which such non standard configuration.  Currently, the\nFreeBSD GCP image enables TCP and UDP blackhole(6) ('sysctl\nnet.inet.tcp.blackhole=2' and 'sysctl net.inet.udp.blackhole=1').\nPatch by Victor Stinner.\n\n- gh-91960(7): Skip 'testgdb' if gdb is unable to retrieve Python\nframe objects: if a frame is '<optimized out>'.  When Python is\nbuilt with \"clang -Og\", gdb can fail to retrive the 'frame'\nparameter of 'PyEvalEvalFrameDefault()'.  In this case, tests\nlike 'pybt()' are likely to fail.  Without getting access to\nPython frames, 'python-gdb.py' is mostly clueless on retrieving the\nPython traceback.  Moreover, 'testgdb' is no longer skipped on\nmacOS if Python is built with Clang.  Patch by Victor Stinner.\n\n- gh-108962(8): Skip 'testtempfile.testflags()' if 'chflags()'\nfails with \"OSError: [Errno 45] Operation not supported\" (ex: on\nFreeBSD 13).  Patch by Victor Stinner.\n\n- gh-108851(9): Fix 'testtomllib' recursion tests for WASI\nbuildbots: reduce the recursion limit and compute the maximum\nnested array/dict depending on the current available recursion\nlimit.  Patch by Victor Stinner.\n\n- gh-108851(10): Add 'getrecursionavailable()' and\n'getrecursiondepth()' functions to the *note test.support: de.\nmodule.  Patch by Victor Stinner.\n\n- gh-108834(11): Add '--fail-rerun option' option to regrtest: if a\ntest failed when then passed when rerun in verbose mode, exit the\nprocess with exit code 2 (error), instead of exit code 0 (success).\nPatch by Victor Stinner.\n\n- gh-108834(12): Rename regrtest '--verbose2' option ('-w') to\n'--rerun'.  Keep '--verbose2' as a deprecated alias.  Patch by\nVictor Stinner.\n\n- gh-108834(13): When regrtest reruns failed tests in verbose mode\n('./python -m test --rerun'), tests are now rerun in fresh worker\nprocesses rather than being executed in the main process.  If a\ntest does crash or is killed by a timeout, the main process can\ndetect and handle the killed worker process.  Tests are rerun in\nparallel if the '-jN' option is used to run tests in parallel.\nPatch by Victor Stinner.\n\n- gh-103186(14): Suppress and assert expected RuntimeWarnings in\ntestsyssettrace.py\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/109396\n\n(2) https://github.com/python/cpython/issues/104736\n\n(3) https://github.com/python/cpython/issues/109237\n\n(4) https://github.com/python/cpython/issues/109230\n\n(5) https://github.com/python/cpython/issues/109015\n\n(6) https://reviews.freebsd.org/D41751\n\n(7) https://github.com/python/cpython/issues/91960\n\n(8) https://github.com/python/cpython/issues/108962\n\n(9) https://github.com/python/cpython/issues/108851\n\n(10) https://github.com/python/cpython/issues/108851\n\n(11) https://github.com/python/cpython/issues/108834\n\n(12) https://github.com/python/cpython/issues/108834\n\n(13) https://github.com/python/cpython/issues/108834\n\n(14) https://github.com/python/cpython/issues/103186\n\nFile: python3.12.info,  Node: Build<4>,  Prev: Tests<4>,  Up: Python 3 12 0 release candidate 3\n\n1.22.5.5 Build\n..............\n\n- gh-108740(1): Fix a race condition in 'make regen-all'.  The\n'deepfreeze.c' source and files generated by Argument Clinic are\nnow generated or updated before generating \"global objects\".\nPreviously, some identifiers may miss depending on the order in\nwhich these files were generated.  Patch by Victor Stinner.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/108740\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 12 0 release candidate 2,  Next: Python 3 12 0 release candidate 1,  Prev: Python 3 12 0 release candidate 3,  Up: Changelog": {
            "content": "'Release date: 2023-09-05'\n\n* Menu:\n\n* Security: Security<3>.\n* Core and Builtins: Core and Builtins<6>.\n* Library: Library<6>.\n* Documentation: Documentation<7>.\n* Tests: Tests<5>.\n* Build: Build<5>.\n* Windows: Windows<5>.\n* macOS: macOS<4>.\n* Tools/Demos: Tools/Demos<4>.\n* C API: C API<3>.\n\nFile: python3.12.info,  Node: Security<3>,  Next: Core and Builtins<6>,  Up: Python 3 12 0 release candidate 2\n\n1.22.6.1 Security\n.................\n\n- gh-108310(1): Fixed an issue where instances of *note\nssl.SSLSocket: 703. were vulnerable to a bypass of the TLS\nhandshake and included protections (like certificate verification)\nand treating sent unencrypted data as if it were post-handshake TLS\nencrypted data.  Security issue reported as CVE-2023-40217(2) by\nAapo Oksman.  Patch by Gregory P. Smith.\n\n- gh-107774(3): PEP 669 specifies that\n'sys.monitoring.registercallback' will generate an audit event.\nPre-releases of Python 3.12 did not generate the audit event.  This\nis now fixed.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/108310\n\n(2) https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-40217\n\n(3) https://github.com/python/cpython/issues/107774\n\nFile: python3.12.info,  Node: Core and Builtins<6>,  Next: Library<6>,  Prev: Security<3>,  Up: Python 3 12 0 release candidate 2\n\n1.22.6.2 Core and Builtins\n..........................\n\n- gh-108520(1): Fix\n'multiprocessing.synchronize.SemLock.setstate()' to properly\ninitialize 'multiprocessing.synchronize.SemLock.isforkctx'.\nThis fixes a regression when passing a SemLock accross nested\nprocesses.\n\nRename 'multiprocessing.synchronize.SemLock.isforkctx' to\n'multiprocessing.synchronize.SemLock.isforkctx' to avoid\nexposing it as public API.\n\n- gh-108654(2): Restore locals shadowed by an inlined comprehension\nif the comprehension raises an exception.\n\n- gh-108487(3): Change an assert that would cause a spurious crash in\na devious case that should only trigger deoptimization.\n\n- gh-106176(4): Use a 'WeakValueDictionary' to track the lists\ncontaining the modules each thread is currently importing.  This\nhelps avoid a reference leak from keeping the list around longer\nthan necessary.  Weakrefs are used as GC can't interrupt the\ncleanup.\n\n- gh-107901(5): Fix missing line number on *note JUMPBACKWARD: 4e0.\nat the end of a for loop.\n\n- gh-108390(6): Raise an exception when setting a non-local event\n('RAISE', 'EXCEPTIONHANDLED', etc.)  in\n'sys.monitoring.setlocalevents'.\n\nFixes crash when tracing in recursive calls to Python classes.\n\n- gh-91051(7): Fix abort / segfault when using all eight type watcher\nslots, on platforms where 'char' is signed by default.\n\n- gh-107724(8): In pre-release versions of 3.12, up to rc1, the\nsys.monitoring callback function for the 'PYTHROW' event was\nmissing the third, exception argument.  That is now fixed.\n\n- gh-107080(9): Trace refs builds ('--with-trace-refs') were crashing\nwhen used with isolated subinterpreters.  The problematic global\nstate has been isolated to each interpreter.  Other fixing the\ncrashes, this change does not affect users.\n\n- gh-77377(10): Ensure that multiprocessing synchronization objects\ncreated in a fork context are not sent to a different process\ncreated in a spawn context.  This changes a segfault into an\nactionable RuntimeError in the parent process.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/108520\n\n(2) https://github.com/python/cpython/issues/108654\n\n(3) https://github.com/python/cpython/issues/108487\n\n(4) https://github.com/python/cpython/issues/106176\n\n(5) https://github.com/python/cpython/issues/107901\n\n(6) https://github.com/python/cpython/issues/108390\n\n(7) https://github.com/python/cpython/issues/91051\n\n(8) https://github.com/python/cpython/issues/107724\n\n(9) https://github.com/python/cpython/issues/107080\n\n(10) https://github.com/python/cpython/issues/77377\n\nFile: python3.12.info,  Node: Library<6>,  Next: Documentation<7>,  Prev: Core and Builtins<6>,  Up: Python 3 12 0 release candidate 2\n\n1.22.6.3 Library\n................\n\n- gh-108469(1): *note ast.unparse(): 6fe. now supports new *note\nf-string: 138. syntax introduced in Python 3.12.  Note that the\n*note f-string: 138. quotes are reselected for simplicity under the\nnew syntax.  (Patch by Steven Sun)\n\n- gh-108682(2): Enum: raise *note TypeError: 28e. if\n'super().new()' is called from a custom 'new'.\n\n- gh-108295(3): Fix crashes related to use of weakrefs on *note\ntyping.TypeVar: 164.\n\n- gh-64662(4): Fix support for virtual tables in *note\nsqlite3.Connection.iterdump(): 1415.  Patch by Aviv Palivoda.\n\n- gh-108111(5): Fix a regression introduced in gh-101251(6) for 3.12,\nresulting in an incorrect offset calculation in\n'gzip.GzipFile.seek()'.\n\n- gh-105736(7): Harmonized the pure Python version of *note\nOrderedDict: 39f. with the C version.  Now, both versions set up\ntheir internal state in 'new'.  Formerly, the pure Python\nversion did the set up in 'init'.\n\n- gh-108083(8): Fix bugs in the constructor of *note\nsqlite3.Connection: 1d9. and *note sqlite3.Connection.close():\n1416. where exceptions could be leaked.  Patch by Erlend E.\nAasland.\n\n- gh-107963(9): Fix *note multiprocessing.setforkserverpreload():\n1417. to check the given list of modules names.  Patch by Donghee\nNa.\n\n- gh-106242(10): Fixes *note os.path.normpath(): 1191. to handle\nembedded null characters without truncating the path.\n\n- gh-107913(11): Fix possible losses of 'errno' and 'winerror' values\nin *note OSError: 613. exceptions if they were cleared or modified\nby the cleanup code before creating the exception object.\n\n- gh-107845(12): *note tarfile.datafilter(): 355. now takes the\nlocation of symlinks into account when determining their target, so\nit will no longer reject some valid tarballs with\n'LinkOutsideDestinationError'.\n\n- gh-107805(13): Fix signatures of module-level generated functions\nin *note turtle: fc.\n\n- gh-107715(14): Fix *note doctest.DocTestFinder.find(): 1418. in\npresence of class names with special characters.  Patch by Gertjan\nvan Zwieten.\n\n- gh-100814(15): Passing a callable object as an option value to a\nTkinter image now raises the expected TclError instead of an\nAttributeError.\n\n- gh-106684(16): Close *note asyncio.StreamWriter: 1419. when it is\nnot closed by application leading to memory leaks.  Patch by Kumar\nAditya.\n\n- gh-107396(17): tarfiles; Fixed use before assignment of\nself.exception for gzip decompression\n\n- gh-106052(18): *note re: b4. module: fix the matching of possessive\nquantifiers in the case of a subpattern containing backtracking.\n\n- gh-100061(19): Fix a bug that causes wrong matches for regular\nexpressions with possessive qualifier.\n\n- gh-99203(20): Restore following CPython <= 3.10.5 behavior of *note\nshutil.makearchive(): 1d4.: do not create an empty archive if\n'rootdir' is not a directory, and, in that case, raise *note\nFileNotFoundError: 353. or *note NotADirectoryError: ed3.\nregardless of 'format' choice.  Beyond the brought-back behavior,\nthe function may now also raise these exceptions in 'dryrun' mode.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/108469\n\n(2) https://github.com/python/cpython/issues/108682\n\n(3) https://github.com/python/cpython/issues/108295\n\n(4) https://github.com/python/cpython/issues/64662\n\n(5) https://github.com/python/cpython/issues/108111\n\n(6) https://github.com/python/cpython/issues/101251\n\n(7) https://github.com/python/cpython/issues/105736\n\n(8) https://github.com/python/cpython/issues/108083\n\n(9) https://github.com/python/cpython/issues/107963\n\n(10) https://github.com/python/cpython/issues/106242\n\n(11) https://github.com/python/cpython/issues/107913\n\n(12) https://github.com/python/cpython/issues/107845\n\n(13) https://github.com/python/cpython/issues/107805\n\n(14) https://github.com/python/cpython/issues/107715\n\n(15) https://github.com/python/cpython/issues/100814\n\n(16) https://github.com/python/cpython/issues/106684\n\n(17) https://github.com/python/cpython/issues/107396\n\n(18) https://github.com/python/cpython/issues/106052\n\n(19) https://github.com/python/cpython/issues/100061\n\n(20) https://github.com/python/cpython/issues/99203\n\nFile: python3.12.info,  Node: Documentation<7>,  Next: Tests<5>,  Prev: Library<6>,  Up: Python 3 12 0 release candidate 2\n\n1.22.6.4 Documentation\n......................\n\n- gh-105052(1): Update 'timeit' doc to specify that time in seconds\nis just the default.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/105052\n\nFile: python3.12.info,  Node: Tests<5>,  Next: Build<5>,  Prev: Documentation<7>,  Up: Python 3 12 0 release candidate 2\n\n1.22.6.5 Tests\n..............\n\n- gh-89392(1): Removed support of 'testmain()' function in tests.\nThey now always use normal unittest test runner.\n\n- gh-108388(2): Convert testconcurrentfutures to a package of 7\nsub-tests.  Patch by Victor Stinner.\n\n- gh-108388(3): Split testmultiprocessingfork,\ntestmultiprocessingforkserver and testmultiprocessingspawn into\ntest packages.  Each package is made of 4 sub-tests: processes,\nthreads, manager and misc.  It allows running more tests in\nparallel and so reduce the total test duration.  Patch by Victor\nStinner.\n\n- gh-105776(4): Fix testcppext when the C compiler command\n'-std=c11' option: remove '-std=' options from the compiler\ncommand.  Patch by Victor Stinner.\n\n- gh-107178(5): Add the C API test for functions in the Mapping\nProtocol, the Sequence Protocol and some functions in the Object\nProtocol.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/89392\n\n(2) https://github.com/python/cpython/issues/108388\n\n(3) https://github.com/python/cpython/issues/108388\n\n(4) https://github.com/python/cpython/issues/105776\n\n(5) https://github.com/python/cpython/issues/107178\n\nFile: python3.12.info,  Node: Build<5>,  Next: Windows<5>,  Prev: Tests<5>,  Up: Python 3 12 0 release candidate 2\n\n1.22.6.6 Build\n..............\n\n- gh-63760(1): Fix Solaris build: no longer redefine the\n'gethostname()' function.  Solaris defines the function since 2005.\nPatch by Victor Stinner, original patch by Jakub Kul??k.\n\n- gh-107814(2): When calling 'findpython.bat' with '-q' it did not\nproperly silence the output of nuget.  That is now fixed.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/63760\n\n(2) https://github.com/python/cpython/issues/107814\n\nFile: python3.12.info,  Node: Windows<5>,  Next: macOS<4>,  Prev: Build<5>,  Up: Python 3 12 0 release candidate 2\n\n1.22.6.7 Windows\n................\n\n- gh-107565(1): Update Windows build to use OpenSSL 3.0.10.\n\n- gh-106242(2): Fixes *note realpath(): 351. to behave consistently\nwhen passed a path containing an embedded null character on\nWindows.  In strict mode, it now raises *note OSError: 613. instead\nof the unexpected *note ValueError: 183, and in non-strict mode\nwill make the path absolute.\n\n- gh-106844(3): Fix integer overflow and truncating by the null\ncharacter in 'winapi.LCMapStringEx()' which affects\n'ntpath.normcase()'.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/107565\n\n(2) https://github.com/python/cpython/issues/106242\n\n(3) https://github.com/python/cpython/issues/106844\n\nFile: python3.12.info,  Node: macOS<4>,  Next: Tools/Demos<4>,  Prev: Windows<5>,  Up: Python 3 12 0 release candidate 2\n\n1.22.6.8 macOS\n..............\n\n- gh-107565(1): Update macOS installer to use OpenSSL 3.0.10.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/107565\n\nFile: python3.12.info,  Node: Tools/Demos<4>,  Next: C API<3>,  Prev: macOS<4>,  Up: Python 3 12 0 release candidate 2\n\n1.22.6.9 Tools/Demos\n....................\n\n- gh-107565(1): Update multissltests and GitHub CI workflows to use\nOpenSSL 1.1.1v, 3.0.10, and 3.1.2.\n\n- gh-95065(2): Argument Clinic now supports overriding automatically\ngenerated signature by using directive '@textsignature'.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/107565\n\n(2) https://github.com/python/cpython/issues/95065\n\nFile: python3.12.info,  Node: C API<3>,  Prev: Tools/Demos<4>,  Up: Python 3 12 0 release candidate 2\n\n1.22.6.10 C API\n...............\n\n- gh-107916(1): C API functions *note\nPyErrSetFromErrnoWithFilename(): 1421, *note\nPyErrSetExcFromWindowsErrWithFilename(): 1422. and *note\nPyErrSetFromWindowsErrWithFilename(): 1423. save now the error\ncode before calling *note PyUnicodeDecodeFSDefault(): 1424.\n\n- gh-107915(2): Such C API functions as 'PyErrSetString()',\n'PyErrFormat()', 'PyErrSetFromErrnoWithFilename()' and many\nothers no longer crash or ignore errors if it failed to format the\nerror message or decode the filename.  Instead, they keep a\ncorresponding error.\n\n- gh-107810(3): Improve *note DeprecationWarning: 179. for uses of\n*note PyTypeSpec: 1425. with metaclasses that have custom\n'tpnew'.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/107916\n\n(2) https://github.com/python/cpython/issues/107915\n\n(3) https://github.com/python/cpython/issues/107810\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 12 0 release candidate 1,  Next: Python 3 12 0 beta 4,  Prev: Python 3 12 0 release candidate 2,  Up: Changelog": {
            "content": "'Release date: 2023-08-05'\n\n* Menu:\n\n* Security: Security<4>.\n* Core and Builtins: Core and Builtins<7>.\n* Library: Library<7>.\n* Documentation: Documentation<8>.\n* Tests: Tests<6>.\n* Build: Build<6>.\n* Windows: Windows<6>.\n* macOS: macOS<5>.\n* Tools/Demos: Tools/Demos<5>.\n* C API: C API<4>.\n\nFile: python3.12.info,  Node: Security<4>,  Next: Core and Builtins<7>,  Up: Python 3 12 0 release candidate 1\n\n1.22.7.1 Security\n.................\n\n- gh-102988(1): Reverted the *note email.utils: 4c. security\nimprovement change released in 3.12beta4 that unintentionally\ncaused *note email.utils.getaddresses: 1428. to fail to parse email\naddresses with a comma in the quoted name field.  See gh-106669(2).\n\n- gh-102509(3): Start initializing 'obdigit' during creation of\n*note PyLongObject: 2ea. objects.  Patch by Illia Volochii.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/102988\n\n(2) https://github.com/python/cpython/issues/106669\n\n(3) https://github.com/python/cpython/issues/102509\n\nFile: python3.12.info,  Node: Core and Builtins<7>,  Next: Library<7>,  Prev: Security<4>,  Up: Python 3 12 0 release candidate 1\n\n1.22.7.2 Core and Builtins\n..........................\n\n- gh-107263(1): Increase C recursion limit for functions other than\nthe main interpreter from 800 to 1500.  This should allow functions\nlike 'list.repr' and 'json.dumps' to handle all the inputs that\nthey could prior to 3.12\n\n- gh-104432(2): Fix potential unaligned memory access on C APIs\ninvolving returned sequences of 'char *' pointers within the *note\ngrp: 61. and *note socket: c6. modules.  These were revealed using\na '-fsaniziter=alignment' build on ARM macOS. Patch by Christopher\nChavez.\n\n- gh-106898(3): Add the exception as the third argument to 'PYUNIND'\ncallbacks in 'sys.monitoring'.  This makes the 'PYUNWIND' callback\nconsistent with the other exception hanlding callbacks.\n\n- gh-106895(4): Raise a 'ValueError' when a monitoring callback\nfuntion returns 'DISABLE' for events that cannot be disabled\nlocally.\n\n- gh-106897(5): Add a 'RERAISE' event to 'sys.monitoring', which\noccurs when an exception is reraised, either explicitly by a plain\n'raise' statement, or implicitly in an 'except' or 'finally' block.\n\n- gh-104621(6): Unsupported modules now always fail to be imported.\n\n- gh-106917(7): Fix classmethod-style *note super(): 204. method\ncalls (i.e., where the second argument to *note super(): 204, or\nthe implied second argument drawn from 'self/cls' in the case of\nzero-arg super, is a type) when the target of the call is not a\nclassmethod.\n\n- gh-105699(8): Python no longer crashes due an infrequent race when\ninitialzing per-interpreter interned strings.  The crash would\nmanifest when the interpreter was finalized.\n\n- gh-105699(9): Python no longer crashes due to an infrequent race in\nsetting 'PyFileSystemDefaultEncoding' and\n'PyFileSystemDefaultEncodeErrors' (both deprecated), when\nsimultaneously initializing two isolated subinterpreters.  Now they\nare only set during runtime initialization.\n\n- gh-106092(10): Fix a segmentation fault caused by a use-after-free\nbug in 'framedealloc' when the trashcan delays the deallocation of\na 'PyFrameObject'.\n\n- gh-106719(11): No longer suppress arbitrary errors in the\n'annotations' getter and setter in the type and module types.\n\n- gh-106723(12): Propagate 'frozenmodules' to multiprocessing\nspawned process interpreters.\n\n- gh-105235(13): Prevent out-of-bounds memory access during\n'mmap.find()' calls.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/107263\n\n(2) https://github.com/python/cpython/issues/104432\n\n(3) https://github.com/python/cpython/issues/106898\n\n(4) https://github.com/python/cpython/issues/106895\n\n(5) https://github.com/python/cpython/issues/106897\n\n(6) https://github.com/python/cpython/issues/104621\n\n(7) https://github.com/python/cpython/issues/106917\n\n(8) https://github.com/python/cpython/issues/105699\n\n(9) https://github.com/python/cpython/issues/105699\n\n(10) https://github.com/python/cpython/issues/106092\n\n(11) https://github.com/python/cpython/issues/106719\n\n(12) https://github.com/python/cpython/issues/106723\n\n(13) https://github.com/python/cpython/issues/105235\n\nFile: python3.12.info,  Node: Library<7>,  Next: Documentation<8>,  Prev: Core and Builtins<7>,  Up: Python 3 12 0 release candidate 1\n\n1.22.7.3 Library\n................\n\n- gh-107077(1): Seems that in some conditions, OpenSSL will return\n'SSLERRORSYSCALL' instead of 'SSLERRORSSL' when a certification\nverification has failed, but the error parameters will still\ncontain 'ERRLIBSSL' and 'SSLRCERTIFICATEVERIFYFAILED'.  We\nare now detecting this situation and raising the appropiate\n'ssl.SSLCertVerificationError'.  Patch by Pablo Galindo\n\n- gh-107576(2): Fix *note types.getoriginalbases(): 1f4. to only\nreturn 'origbases' if it is present on 'cls' directly.  Patch\nby James Hilton-Balfe.\n\n- gh-46376(3): Prevent memory leak and use-after-free when using\npointers to pointers with ctypes\n\n- gh-62519(4): Make *note gettext.pgettext(): 81b. search plural\ndefinitions when translation is not found.\n\n- gh-83006(5): Document behavior of *note shutil.diskusage(): f9e.\nfor non-mounted filesystems on Unix.\n\n- gh-106186(6): Do not report 'MultipartInvariantViolationDefect'\ndefect when the *note email.parser.Parser: 1012. class is used to\nparse emails with 'headersonly=True'.\n\n- gh-105002(7): Fix invalid result from 'PurePath.relativeto()'\nmethod when attempting to walk a \"'..'\" segment in 'other' with\n'walkup' enabled.  A *note ValueError: 183. exception is now\nraised in this case.\n\n- gh-106831(8): Fix potential missing 'NULL' check of\n'd2iSSLSESSION' result in 'ssl.c'.\n\n- gh-106774(9): Update the bundled copy of pip to version 23.2.1.\n\n- gh-106752(10): Fixed several bugs in zipfile.Path, including: in\n'Path.match', Windows separators are no longer honored (and never\nwere meant to be); Fixed 'name'/'suffix'/'suffixes'/'stem'\noperations when no filename is present and the Path is not at the\nroot of the zipfile; Reworked glob for performance and more correct\nmatching behavior.\n\n- gh-106602(11): Add copy and deepcopy in *note enum: 51.\n\n- gh-106530(12): Revert a change to *note colorsys.rgbtohls():\n142b. that caused division by zero for certain almost-white inputs.\nPatch by Terry Jan Reedy.\n\n- gh-106403(13): Instances of *note typing.TypeVar: 164, *note\ntyping.ParamSpec: 163, *note typing.ParamSpecArgs: 5b9, *note\ntyping.ParamSpecKwargs: 5ba, and *note typing.TypeVarTuple: 162.\nonce again support weak references, fixing a regression introduced\nin Python 3.12.0 beta 1.  Patch by Jelle Zijlstra.\n\n- gh-106350(14): Detect possible memory allocation failure in the\nlibtommath function 'mpinit()' used by the 'tkinter' module.\n\n- gh-106263(15): Fix crash when calling 'repr' with a manually\nconstructed SignalDict object.  Patch by Charlie Zhao.\n\n- gh-105626(16): Change the default return value of *note\nhttp.client.HTTPConnection.getproxyresponseheaders(): 142c. to\nbe 'None' and not '{}'.\n\n- bpo-18319(17): Ensure 'gettext(msg)' retrieve translations even if\na plural form exists.  In other words: 'gettext(msg) ==\nngettext(msg, '', 1)'.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/107077\n\n(2) https://github.com/python/cpython/issues/107576\n\n(3) https://github.com/python/cpython/issues/46376\n\n(4) https://github.com/python/cpython/issues/62519\n\n(5) https://github.com/python/cpython/issues/83006\n\n(6) https://github.com/python/cpython/issues/106186\n\n(7) https://github.com/python/cpython/issues/105002\n\n(8) https://github.com/python/cpython/issues/106831\n\n(9) https://github.com/python/cpython/issues/106774\n\n(10) https://github.com/python/cpython/issues/106752\n\n(11) https://github.com/python/cpython/issues/106602\n\n(12) https://github.com/python/cpython/issues/106530\n\n(13) https://github.com/python/cpython/issues/106403\n\n(14) https://github.com/python/cpython/issues/106350\n\n(15) https://github.com/python/cpython/issues/106263\n\n(16) https://github.com/python/cpython/issues/105626\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=18319\n\nFile: python3.12.info,  Node: Documentation<8>,  Next: Tests<6>,  Prev: Library<7>,  Up: Python 3 12 0 release candidate 1\n\n1.22.7.4 Documentation\n......................\n\n- gh-107305(1): Add documentation for *note PyInterpreterConfig: 2cd.\nand *note PyNewInterpreterFromConfig(): 16c.  Also clarify some of\nthe nearby docs relative to per-interpreter GIL.\n\n- gh-107008(2): Document the *note curses: 29. module variables *note\nLINES: 142e. and *note COLS: 142f.\n\n- gh-106948(3): Add a number of standard external names to\n'nitpickignore'.\n\n- gh-54738(4): Add documentation on how to localize the *note\nargparse: 6. module.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/107305\n\n(2) https://github.com/python/cpython/issues/107008\n\n(3) https://github.com/python/cpython/issues/106948\n\n(4) https://github.com/python/cpython/issues/54738\n\nFile: python3.12.info,  Node: Tests<6>,  Next: Build<6>,  Prev: Documentation<8>,  Up: Python 3 12 0 release candidate 1\n\n1.22.7.5 Tests\n..............\n\n- gh-107237(1): 'testlogging': Fix 'testudpreconnection()' by\nincreasing the timeout from 100 ms to 5 minutes (LONGTIMEOUT).\nPatch by Victor Stinner.\n\n- gh-106714(2): testcapi: Fix testnoFatalErrorinfiniteloop() to\nno longer write a coredump, by using\ntest.support.SuppressCrashReport.  Patch by Victor Stinner.\n\n- gh-104090(3): Avoid creating a reference to the test object in\n*note collectedDurations(): 1431.\n\n- gh-106752(4): Moved tests for 'zipfile.Path' into\n'Lib/test/testzipfile/path'.  Made 'zipfile.path' a package.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/107237\n\n(2) https://github.com/python/cpython/issues/106714\n\n(3) https://github.com/python/cpython/issues/104090\n\n(4) https://github.com/python/cpython/issues/106752\n\nFile: python3.12.info,  Node: Build<6>,  Next: Windows<6>,  Prev: Tests<6>,  Up: Python 3 12 0 release candidate 1\n\n1.22.7.6 Build\n..............\n\n- gh-106881(1): Check for 'linux/limits.h' before including it in\n'Modules/posixmodule.c'.\n\n- gh-106962(2): Detect MPI compilers in 'configure'.\n\n- gh-101538(3): Add experimental wasi-threads support.  Patch by\nTakashi Yamamoto.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/106881\n\n(2) https://github.com/python/cpython/issues/106962\n\n(3) https://github.com/python/cpython/issues/101538\n\nFile: python3.12.info,  Node: Windows<6>,  Next: macOS<5>,  Prev: Build<6>,  Up: Python 3 12 0 release candidate 1\n\n1.22.7.7 Windows\n................\n\n- gh-99079(1): Update Windows build to use OpenSSL 3.0.9\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/99079\n\nFile: python3.12.info,  Node: macOS<5>,  Next: Tools/Demos<5>,  Prev: Windows<6>,  Up: Python 3 12 0 release candidate 1\n\n1.22.7.8 macOS\n..............\n\n- gh-99079(1): Update macOS installer to use OpenSSL 3.0.9.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/99079\n\nFile: python3.12.info,  Node: Tools/Demos<5>,  Next: C API<4>,  Prev: macOS<5>,  Up: Python 3 12 0 release candidate 1\n\n1.22.7.9 Tools/Demos\n....................\n\n- gh-106970(1): Fix bugs in the Argument Clinic 'destination <name>\nclear' command; the destination buffers would never be cleared, and\nthe 'destination' directive parser would simply continue to the\nfault handler after processing the command.  Patch by Erlend E.\nAasland.\n\n- gh-103186(2): 'freeze' now fetches 'CONFIGARGS' from the original\nCPython instance the Makefile uses to call utility scripts.  Patch\nby Ijtaba Hussain.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/106970\n\n(2) https://github.com/python/cpython/issues/103186\n\nFile: python3.12.info,  Node: C API<4>,  Prev: Tools/Demos<5>,  Up: Python 3 12 0 release candidate 1\n\n1.22.7.10 C API\n...............\n\n- gh-107226(1): *note PyModuleAddObjectRef(): 6a9. is now only\navailable in the limited API version 3.10 or later.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/107226\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 12 0 beta 4,  Next: Python 3 12 0 beta 3,  Prev: Python 3 12 0 release candidate 1,  Up: Changelog": {
            "content": "'Release date: 2023-07-11'\n\n* Menu:\n\n* Security: Security<5>.\n* Core and Builtins: Core and Builtins<8>.\n* Library: Library<8>.\n* Documentation: Documentation<9>.\n* Tests: Tests<7>.\n* Build: Build<7>.\n* Tools/Demos: Tools/Demos<6>.\n* C API: C API<5>.\n\nFile: python3.12.info,  Node: Security<5>,  Next: Core and Builtins<8>,  Up: Python 3 12 0 beta 4\n\n1.22.8.1 Security\n.................\n\n- gh-102988(1): CVE-2023-27043: Prevent *note\nemail.utils.parseaddr(): 1439. and *note\nemail.utils.getaddresses(): 1428. from returning the realname\nportion of an invalid RFC2822 email header in the email address\nportion of the 2-tuple returned after being parsed by\n'email.parseaddr.AddressList'.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/102988\n\nFile: python3.12.info,  Node: Core and Builtins<8>,  Next: Library<8>,  Prev: Security<5>,  Up: Python 3 12 0 beta 4\n\n1.22.8.2 Core and Builtins\n..........................\n\n- gh-106396(1): When the format specification of an f-string\nexpression is empty, the parser now generates an empty *note\nast.JoinedStr: 143b. node for it instead of an one-element *note\nast.JoinedStr: 143b. with an empty string *note ast.Constant: 215.\n\n- gh-106145(2): Make 'endlineno' and 'endcoloffset' required on\n'typeparam' ast nodes.\n\n- gh-105979(3): Fix crash in 'imp.getfrozenobject()' due to\nimproper exception handling.\n\n- gh-98931(4): Ensure custom *note SyntaxError: 146. error messages\nare raised for invalid imports with multiple targets.  Patch by\nPablo Galindo\n\n- gh-105908(5): Fixed bug where gh-99111(6) breaks future import\n'barryasFLUFL' in the Python REPL.\n\n- gh-105340(7): Include the comprehension iteration variable in\n'locals()' inside a module- or class-scope comprehension.\n\n- gh-105486(8): Change the repr of 'ParamSpec' list of args in\n'types.GenericAlias'.\n\n- gh-101006(9): Improve error handling when read *note marshal: 88.\ndata.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/106396\n\n(2) https://github.com/python/cpython/issues/106145\n\n(3) https://github.com/python/cpython/issues/105979\n\n(4) https://github.com/python/cpython/issues/98931\n\n(5) https://github.com/python/cpython/issues/105908\n\n(6) https://github.com/python/cpython/issues/99111\n\n(7) https://github.com/python/cpython/issues/105340\n\n(8) https://github.com/python/cpython/issues/105486\n\n(9) https://github.com/python/cpython/issues/101006\n\nFile: python3.12.info,  Node: Library<8>,  Next: Documentation<9>,  Prev: Core and Builtins<8>,  Up: Python 3 12 0 beta 4\n\n1.22.8.3 Library\n................\n\n- gh-106524(1): Fix crash in 'sre.template()' with templates\ncontaining invalid group indices.\n\n- gh-106510(2): Improve debug output for atomic groups in regular\nexpressions.\n\n- gh-106503(3): Fix ref cycle in 'asyncio.SelectorSocketTransport'\nby removing 'writeready' in 'close'.\n\n- gh-105497(4): Fix flag mask inversion when unnamed flags exist.\n\n- gh-90876(5): Prevent 'multiprocessing.spawn' from failing to\n'import' in environments where 'sys.executable' is 'None'.  This\nregressed in 3.11 with the addition of support for path-like\nobjects in multiprocessing.\n\n- gh-106292(6): Check for an instance-dict cached value in the\n'get()' method of *note functools.cachedproperty(): 299.  This\nbetter matches the pre-3.12 behavior and improves compatibility for\nusers subclassing *note functools.cachedproperty(): 299. and\nadding a 'set()' method.\n\n- gh-106330(7): Fix incorrect matching of empty paths in *note\npathlib.PurePath.match(): 1ce.  This bug was introduced in Python\n3.12.0 beta 1.\n\n- gh-102541(8): Make pydoc.doc catch bad module ImportError when\noutput stream is not None.\n\n- gh-106152(9): Added PYTHROW event hook for *note cProfile: 25. for\ngenerators\n\n- gh-106075(10): Added 'asyncio.taskgroups.all' to\n'asyncio.all' for export in star imports.\n\n- gh-105987(11): Fix crash due to improper reference counting in\n*note asyncio: 9. eager task factory internal routines.\n\n- gh-105974(12): Fix bug where a *note typing.Protocol: 47e. class\nthat had one or more non-callable members would raise *note\nTypeError: 28e. when *note issubclass(): 5b4. was called against\nit, even if it defined a custom 'subclasshook' method.  The\nbehaviour in Python 3.11 and lower - which has now been restored -\nwas not to raise *note TypeError: 28e. in these situations if a\ncustom 'subclasshook' method was defined.  Patch by Alex\nWaygood.\n\n- gh-96145(13): Reverted addition of 'json.AttrDict'.\n\n- gh-105497(14): Fix flag inversion when alias/mask members exist.\n\n- gh-104554(15): Add RTSPS scheme support in urllib.parse\n\n- gh-94777(16): Fix hanging *note multiprocessing: 8f.\n'ProcessPoolExecutor' when a child process crashes while data is\nbeing written in the call queue.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/106524\n\n(2) https://github.com/python/cpython/issues/106510\n\n(3) https://github.com/python/cpython/issues/106503\n\n(4) https://github.com/python/cpython/issues/105497\n\n(5) https://github.com/python/cpython/issues/90876\n\n(6) https://github.com/python/cpython/issues/106292\n\n(7) https://github.com/python/cpython/issues/106330\n\n(8) https://github.com/python/cpython/issues/102541\n\n(9) https://github.com/python/cpython/issues/106152\n\n(10) https://github.com/python/cpython/issues/106075\n\n(11) https://github.com/python/cpython/issues/105987\n\n(12) https://github.com/python/cpython/issues/105974\n\n(13) https://github.com/python/cpython/issues/96145\n\n(14) https://github.com/python/cpython/issues/105497\n\n(15) https://github.com/python/cpython/issues/104554\n\n(16) https://github.com/python/cpython/issues/94777\n\nFile: python3.12.info,  Node: Documentation<9>,  Next: Tests<7>,  Prev: Library<8>,  Up: Python 3 12 0 beta 4\n\n1.22.8.4 Documentation\n......................\n\n- gh-106232(1): Make timeit doc command lines compatible with Windows\nby using double quotes for arguments.  This works on linux and\nmacOS also.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/106232\n\nFile: python3.12.info,  Node: Tests<7>,  Next: Build<7>,  Prev: Documentation<9>,  Up: Python 3 12 0 beta 4\n\n1.22.8.5 Tests\n..............\n\n- gh-101634(1): When running the Python test suite with '-jN' option,\nif a worker stdout cannot be decoded from the locale encoding\nreport a failed testn so the exitcode is non-zero.  Patch by Victor\nStinner.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/101634\n\nFile: python3.12.info,  Node: Build<7>,  Next: Tools/Demos<6>,  Prev: Tests<7>,  Up: Python 3 12 0 beta 4\n\n1.22.8.6 Build\n..............\n\n- gh-106118(1): Fix compilation for platforms without 'OCLOEXEC'.\nThe issue was introduced with Python 3.12b1 in gh-103295(2).  Patch\nby Erlend Aasland.\n\n- gh-104692(3): Include 'commoninstall' as a prerequisite for\n'bininstall'\n\nThis ensures that 'commoninstall' is completed before 'bininstall'\nis started when parallel builds are used ('make -j install'), and\nso the 'python3' symlink is only installed after all standard\nlibrary modules are installed.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/106118\n\n(2) https://github.com/python/cpython/issues/103295\n\n(3) https://github.com/python/cpython/issues/104692\n\nFile: python3.12.info,  Node: Tools/Demos<6>,  Next: C API<5>,  Prev: Build<7>,  Up: Python 3 12 0 beta 4\n\n1.22.8.7 Tools/Demos\n....................\n\n- gh-106359(1): Argument Clinic now explicitly forbids \"kwarg splats\"\nin function calls used as annotations.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/106359\n\nFile: python3.12.info,  Node: C API<5>,  Prev: Tools/Demos<6>,  Up: Python 3 12 0 beta 4\n\n1.22.8.8 C API\n..............\n\n- gh-105227(1): The new *note PyTypeGetDict(): 1442. provides the\ndictionary for the given type object that is normally exposed by\n'cls.dict'.  Normally it's sufficient to use *note tpdict:\n1443, but for the static builtin types 'tpdict' is now always\n'NULL'.  'PyTypeGetDict()' provides the correct dict object\ninstead.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/105227\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 12 0 beta 3,  Next: Python 3 12 0 beta 2,  Prev: Python 3 12 0 beta 4,  Up: Changelog": {
            "content": "'Release date: 2023-06-19'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<9>.\n* Library: Library<9>.\n* Tests: Tests<8>.\n* Windows: Windows<7>.\n* C API: C API<6>.\n\nFile: python3.12.info,  Node: Core and Builtins<9>,  Next: Library<9>,  Up: Python 3 12 0 beta 3\n\n1.22.9.1 Core and Builtins\n..........................\n\n- gh-105840(1): Fix possible crashes when specializing function calls\nwith too many 'defaults'.\n\n- gh-105831(2): Fix an f-string bug, where using a debug expression\n(the '=' sign) that appears in the last line of a file results to\nthe debug buffer that holds the expression text being one character\ntoo small.\n\n- gh-105800(3): Correctly issue *note SyntaxWarning: 178. in\nf-strings if invalid sequences are used.  Patch by Pablo Galindo\n\n- gh-105587(4): The runtime can't guarantee that immortal objects\nwill not be mutated by Extensions.  Thus, this modifies\nPyStaticObjectCheckRefcnt to warn instead of asserting.\n\n- gh-105564(5): Don't include artificil newlines in the 'line'\nattribute of tokens in the APIs of the *note tokenize: f6. module.\nPatch by Pablo Galindo\n\n- gh-105549(6): Tokenize separately 'NUMBER' and 'NAME' tokens that\nare not ambiguous.  Patch by Pablo Galindo.\n\n- gh-105588(7): Fix an issue that could result in crashes when\ncompiling malformed *note ast: 8. nodes.\n\n- gh-105375(8): Fix bugs in the *note builtins: 10. module where\nexceptions could end up being overwritten.\n\n- gh-105375(9): Fix bug in the compiler where an exception could end\nup being overwritten.\n\n- gh-105375(10): Improve error handling in\n'PyUnicodeBuildEncodingMap()' where an exception could end up\nbeing overwritten.\n\n- gh-105435(11): Fix spurious newline character if file ends on a\ncomment without a newline.  Patch by Pablo Galindo\n\n- gh-105390(12): Correctly raise *note tokenize.TokenError: 29a.\nexceptions instead of *note SyntaxError: 146. for tokenize errors\nsuch as incomplete input.  Patch by Pablo Galindo\n\n- gh-104812(13): The \"pending call\" machinery now works for all\ninterpreters, not just the main interpreter, and runs in all\nthreads, not just the main thread.  Some calls are still only done\nin the main thread, ergo in the main interpreter.  This change does\nnot affect signal handling nor the existing public C-API\n('PyAddPendingCall()'), which both still only target the main\nthread.  The new functionality is meant strictly for internal use\nfor now, since consequences of its use are not well understood yet\noutside some very restricted cases.  This change brings the\ncapability in line with the intention when the state was made\nper-interpreter several years ago.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/105840\n\n(2) https://github.com/python/cpython/issues/105831\n\n(3) https://github.com/python/cpython/issues/105800\n\n(4) https://github.com/python/cpython/issues/105587\n\n(5) https://github.com/python/cpython/issues/105564\n\n(6) https://github.com/python/cpython/issues/105549\n\n(7) https://github.com/python/cpython/issues/105588\n\n(8) https://github.com/python/cpython/issues/105375\n\n(9) https://github.com/python/cpython/issues/105375\n\n(10) https://github.com/python/cpython/issues/105375\n\n(11) https://github.com/python/cpython/issues/105435\n\n(12) https://github.com/python/cpython/issues/105390\n\n(13) https://github.com/python/cpython/issues/104812\n\nFile: python3.12.info,  Node: Library<9>,  Next: Tests<8>,  Prev: Core and Builtins<9>,  Up: Python 3 12 0 beta 3\n\n1.22.9.2 Library\n................\n\n- gh-105808(1): Fix a regression introduced in gh-101251(2) for 3.12,\ncausing 'gzip.GzipFile.flush()' to not flush the compressor (nor\npass along the 'zipmode' argument).\n\n- gh-104799(3): Enable *note ast.unparse(): 6fe. to unparse function\nand class definitions created without the new 'typeparams' field\nfrom PEP 695(4).  Patch by Jelle Zijlstra.\n\n- gh-105745(5): Fix 'webbrowser.Konqueror.open' method.\n\n- gh-105375(6): Fix a bug in 'UnpicklerSetInputStream()' where an\nexception could end up being overwritten in case of failure.\n\n- gh-105375(7): Fix bugs in *note sys: d3. where exceptions could end\nup being overwritten because of deferred error handling.\n\n- gh-105605(8): Harden 'pyexpat' error handling during module\ninitialisation to prevent exceptions from possibly being\noverwritten, and objects from being dereferenced twice.\n\n- gh-105375(9): Fix bug in *note decimal: 33. where an exception\ncould end up being overwritten.\n\n- gh-105375(10): Fix bugs in 'datetime' where exceptions could be\noverwritten in case of module initialisation failure.\n\n- gh-105375(11): Fix bugs in 'ssl' initialisation which could lead\nto leaked references and overwritten exceptions.\n\n- gh-105375(12): Fix a bug in *note array.array: 18f. where an\nexception could end up being overwritten.\n\n- gh-105375(13): Fix bugs in 'ctypes' where exceptions could end up\nbeing overwritten.\n\n- gh-105375(14): Fix a bug in the *note posix: a8. module where an\nexception could be overwritten.\n\n- gh-105375(15): Fix bugs in 'elementtree' where exceptions could be\noverwritten.\n\n- gh-105375(16): Fix bugs in *note zoneinfo: 12e. where exceptions\ncould be overwritten.\n\n- gh-105375(17): Fix bugs in *note errno: 52. where exceptions could\nbe overwritten.\n\n- gh-105375(18): Fix bugs in *note pickle: a1. where exceptions could\nbe overwritten.\n\n- gh-105375(19): Fix a bug in *note sqlite3: c9. where an exception\ncould be overwritten in the *note collation: 441. callback.\n\n- gh-105332(20): Revert pickling method from by-name back to\nby-value.\n\n- gh-104310(21): In the beta 1 release we added a utility function\nfor extension module authors, to use when testing their module for\nsupport in multiple interpreters or under a per-interpreter GIL.\nThe name of that function has changed from\n'allowingallextensions' to\n'incompatibleextensionmodulerestrictions'.  The default for the\n\"disablecheck\" argument has change from 'True' to 'False', to\nbetter match the new function name.\n\n- gh-104996(22): Improve performance of *note pathlib.PurePath: 1c5.\ninitialisation by deferring joining of paths when multiple\narguments are given.\n\n- gh-102541(23): Hide traceback in *note help(): 6f0. prompt, when\nimport failed.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/105808\n\n(2) https://github.com/python/cpython/issues/101251\n\n(3) https://github.com/python/cpython/issues/104799\n\n(4) https://peps.python.org/pep-0695/\n\n(5) https://github.com/python/cpython/issues/105745\n\n(6) https://github.com/python/cpython/issues/105375\n\n(7) https://github.com/python/cpython/issues/105375\n\n(8) https://github.com/python/cpython/issues/105605\n\n(9) https://github.com/python/cpython/issues/105375\n\n(10) https://github.com/python/cpython/issues/105375\n\n(11) https://github.com/python/cpython/issues/105375\n\n(12) https://github.com/python/cpython/issues/105375\n\n(13) https://github.com/python/cpython/issues/105375\n\n(14) https://github.com/python/cpython/issues/105375\n\n(15) https://github.com/python/cpython/issues/105375\n\n(16) https://github.com/python/cpython/issues/105375\n\n(17) https://github.com/python/cpython/issues/105375\n\n(18) https://github.com/python/cpython/issues/105375\n\n(19) https://github.com/python/cpython/issues/105375\n\n(20) https://github.com/python/cpython/issues/105332\n\n(21) https://github.com/python/cpython/issues/104310\n\n(22) https://github.com/python/cpython/issues/104996\n\n(23) https://github.com/python/cpython/issues/102541\n\nFile: python3.12.info,  Node: Tests<8>,  Next: Windows<7>,  Prev: Library<9>,  Up: Python 3 12 0 beta 3\n\n1.22.9.3 Tests\n..............\n\n- gh-105084(1): When the Python build is configured\n'--with-wheel-pkg-dir', tests requiring the 'setuptools' and\n'wheel' wheels will search for the wheels in 'WHEELPKGDIR'.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/105084\n\nFile: python3.12.info,  Node: Windows<7>,  Next: C API<6>,  Prev: Tests<8>,  Up: Python 3 12 0 beta 3\n\n1.22.9.4 Windows\n................\n\n- gh-105436(1): Ensure that an empty environment block is terminated\nby two null characters, as is required by Windows.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/105436\n\nFile: python3.12.info,  Node: C API<6>,  Prev: Windows<7>,  Up: Python 3 12 0 beta 3\n\n1.22.9.5 C API\n..............\n\n- gh-105375(1): Fix a bug in *note PyErrWarnExplicit(): 144a. where\nan exception could end up being overwritten if the API failed\ninternally.\n\n- gh-105603(2): We've renamed the new (in 3.12)\n'PyInterpreterConfig.owngil' to 'PyInterpreterConfig.gil' and\nchanged the meaning of the value from \"bool\" to an integer with\nsupported values of 'PyInterpreterConfigDEFAULTGIL',\n'PyInterpreterConfigSHAREDGIL', and\n'PyInterpreterConfigOWNGIL'.  The default is \"shared\".\n\n- gh-105387(3): In the limited C API version 3.12, *note PyINCREF():\n2ce. and *note PyDECREF(): 2cf. functions are now implemented as\nopaque function calls to hide implementation details.  Patch by\nVictor Stinner.\n\n- gh-103968(4): *note PyTypeFromMetaclass(): 2a9. now allows\nmetaclasses with 'tpnew' set to 'NULL'.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/105375\n\n(2) https://github.com/python/cpython/issues/105603\n\n(3) https://github.com/python/cpython/issues/105387\n\n(4) https://github.com/python/cpython/issues/103968\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 12 0 beta 2,  Next: Python 3 12 0 beta 1,  Prev: Python 3 12 0 beta 3,  Up: Changelog": {
            "content": "'Release date: 2023-06-06'\n\n* Menu:\n\n* Security: Security<6>.\n* Core and Builtins: Core and Builtins<10>.\n* Library: Library<10>.\n* Documentation: Documentation<10>.\n* Build: Build<8>.\n* Windows: Windows<8>.\n* macOS: macOS<6>.\n* IDLE: IDLE<6>.\n* C API: C API<7>.\n\nFile: python3.12.info,  Node: Security<6>,  Next: Core and Builtins<10>,  Up: Python 3 12 0 beta 2\n\n1.22.10.1 Security\n..................\n\n- gh-103142(1): The version of OpenSSL used in our binary builds has\nbeen upgraded to 1.1.1u to address several CVEs.\n\n- gh-99108(2): Refresh our new HACL* built-in *note hashlib: 63. code\nfrom upstream.  Built-in SHA2 should be faster and an issue with\nSHA3 on 32-bit platforms is fixed.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/103142\n\n(2) https://github.com/python/cpython/issues/99108\n\nFile: python3.12.info,  Node: Core and Builtins<10>,  Next: Library<10>,  Prev: Security<6>,  Up: Python 3 12 0 beta 2\n\n1.22.10.2 Core and Builtins\n...........................\n\n- gh-105259(1): Don't include newline character for trailing\n'NEWLINE' tokens emitted in the *note tokenize: f6. module.  Patch\nby Pablo Galindo\n\n- gh-105324(2): Fix the main function of the *note tokenize: f6.\nmodule when reading from 'sys.stdin'.  Patch by Pablo Galindo\n\n- gh-98963(3): Restore the ability for a subclass of *note property:\n3f6. to define 'slots' or otherwise be dict-less by ignoring\nfailures to set a docstring on such a class.  This behavior had\nregressed in 3.12beta1.  An *note AttributeError: 395. where there\nhad not previously been one was disruptive to existing code.\n\n- gh-105194(4): Do not escape with backslashes f-string format\nspecifiers.  Patch by Pablo Galindo\n\n- gh-105162(5): Fixed bug in generator.close()/throw() where an inner\niterator would be ignored when the outer iterator was instrumented.\n\n- gh-105164(6): Ensure annotations are set up correctly if the only\nannotation in a block is within a *note match: 601. block.  Patch\nby Jelle Zijlstra.\n\n- gh-104799(7): Attributes of *note ast: 8. nodes that are lists now\ndefault to the empty list if omitted.  This means that some code\nthat previously raised *note TypeError: 28e. when the AST node was\nused will now proceed with the empty list instead.  Patch by Jelle\nZijlstra.\n\n- gh-105035(8): Fix *note super(): 204. calls on types with custom\n'tpgetattro' implementation (e.g.  meta-types.)\n\n- gh-105017(9): Show CRLF lines in the tokenize string attribute in\nboth NL and NEWLINE tokens.  Patch by Marta G??mez.\n\n- gh-105013(10): Fix handling of multiline parenthesized lambdas in\n*note inspect.getsource(): 144e.  Patch by Pablo Galindo\n\n- gh-105017(11): Do not include an additional final 'NL' token when\nparsing files having CRLF lines.  Patch by Marta G??mez.\n\n- gh-104976(12): Ensure that trailing 'DEDENT' 'tokenize.TokenInfo'\nobjects emitted by the *note tokenize: f6. module are reported as\nin Python 3.11.  Patch by Pablo Galindo\n\n- gh-104972(13): Ensure that the 'line' attribute in\n'tokenize.TokenInfo' objects in the *note tokenize: f6. module are\nalways correct.  Patch by Pablo Galindo\n\n- gh-104955(14): Fix signature for the new *note\nreleasebuffer(): 144f. slot.  Patch by Jelle Zijlstra.\n\n- gh-104690(15): Starting new threads and process creation through\n*note os.fork(): 231. during interpreter shutdown (such as from\n*note atexit: a. handlers) is no longer supported.  It can lead to\nrace condition between the main Python runtime thread freeing\nthread states while internal *note threading: e7. routines are\ntrying to allocate and use the state of just created threads.  Or\nforked children trying to use the mid-shutdown runtime and thread\nstate in the child process.\n\n- gh-104879(16): Fix crash when accessing the 'module' attribute\nof type aliases defined outside a module.  Patch by Jelle Zijlstra.\n\n- gh-104825(17): Tokens emitted by the *note tokenize: f6. module do\nnot include an implicit '\\n' character in the 'line' attribute\nanymore.  Patch by Pablo Galindo\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/105259\n\n(2) https://github.com/python/cpython/issues/105324\n\n(3) https://github.com/python/cpython/issues/98963\n\n(4) https://github.com/python/cpython/issues/105194\n\n(5) https://github.com/python/cpython/issues/105162\n\n(6) https://github.com/python/cpython/issues/105164\n\n(7) https://github.com/python/cpython/issues/104799\n\n(8) https://github.com/python/cpython/issues/105035\n\n(9) https://github.com/python/cpython/issues/105017\n\n(10) https://github.com/python/cpython/issues/105013\n\n(11) https://github.com/python/cpython/issues/105017\n\n(12) https://github.com/python/cpython/issues/104976\n\n(13) https://github.com/python/cpython/issues/104972\n\n(14) https://github.com/python/cpython/issues/104955\n\n(15) https://github.com/python/cpython/issues/104690\n\n(16) https://github.com/python/cpython/issues/104879\n\n(17) https://github.com/python/cpython/issues/104825\n\nFile: python3.12.info,  Node: Library<10>,  Next: Documentation<10>,  Prev: Core and Builtins<10>,  Up: Python 3 12 0 beta 2\n\n1.22.10.3 Library\n.................\n\n- gh-105280(1): Fix bug where 'isinstance([],\ncollections.abc.Mapping)' could evaluate to 'True' if garbage\ncollection happened at the wrong time.  The bug was caused by\nchanges to the implementation of *note typing.Protocol: 47e. in\nPython 3.12.\n\n- gh-105239(2): Fix longstanding bug where 'issubclass(object,\ntyping.Protocol)' would evaluate to 'True' in some edge cases.\nPatch by Alex Waygood.\n\n- gh-105080(3): Fixed inconsistent signature on derived classes for\n*note inspect.signature(): 51c.\n\n- gh-105144(4): Fix a recent regression in the *note typing: ff.\nmodule.  The regression meant that doing 'class Foo(X,\ntyping.Protocol)', where 'X' was a class that had *note\nabc.ABCMeta: d80. as its metaclass, would then cause subsequent\n'isinstance(1, X)' calls to erroneously raise *note TypeError: 28e.\nPatch by Alex Waygood.\n\n- gh-105113(5): Improve performance of *note\npathlib.PurePath.match(): 1ce. by compiling an *note re.Pattern:\n1451. object for the entire pattern.\n\n- gh-101588(6): Deprecate undocumented copy/deepcopy/pickle support\nfor itertools.\n\n- gh-103631(7): Fix\n'pathlib.PurePosixPath(pathlib.PureWindowsPath(...))' not\nconverting path separators to restore 3.11 compatible behavior.\n\n- gh-104947(8): Make comparisons between *note\npathlib.PureWindowsPath: 1452. objects consistent across Windows\nand Posix to match 3.11 behavior.\n\n- gh-104935(9): Fix bugs with the interaction between *note\ntyping.runtimecheckable(): 14c. and *note typing.Generic: 1453.\nthat were introduced by the PEP 695(10) implementation.  Patch by\nJelle Zijlstra.\n\n- gh-104874(11): Document the 'name' and 'supertype'\nattributes of *note typing.NewType: b45.  Patch by Jelle Zijlstra.\n\n- gh-104799(12): Adjust the location of the (see PEP 695(13))\n'typeparams' field on *note ast.ClassDef: 1454, *note\nast.AsyncFunctionDef: 1455, and *note ast.FunctionDef: 1456. to\nbetter preserve backward compatibility.  Patch by Jelle Zijlstra\n\n- gh-104797(14): Allow *note typing.Protocol: 47e. classes to inherit\nfrom *note collections.abc.Buffer: 170.  Patch by Jelle Zijlstra.\n\n- gh-104372(15): On Linux where *note subprocess: d0. can use the\n'vfork()' syscall for faster spawning, prevent the parent process\nfrom blocking other threads by dropping the GIL while it waits for\nthe vfork'ed child process 'exec()' outcome.  This prevents\nspawning a binary from a slow filesystem from blocking the rest of\nthe application.\n\n- gh-99108(16): We now release the GIL around built-in *note hashlib:\n63. computations of reasonable size for the SHA families and MD5\nhash functions, matching what our OpenSSL backed hash computations\nalready does.\n\n- gh-104399(17): Prepare the 'tkinter' module for building with Tcl\n9.0 and future libtommath by replacing usage of deprecated\nfunctions 'mptounsignedbinn()' and 'mpunsignedbinsize()'\nwhen necessary.\n\n- gh-102024(18): Reduce calls of 'idlesemaphore.release()' in\n'concurrent.futures.thread.worker()'.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/105280\n\n(2) https://github.com/python/cpython/issues/105239\n\n(3) https://github.com/python/cpython/issues/105080\n\n(4) https://github.com/python/cpython/issues/105144\n\n(5) https://github.com/python/cpython/issues/105113\n\n(6) https://github.com/python/cpython/issues/101588\n\n(7) https://github.com/python/cpython/issues/103631\n\n(8) https://github.com/python/cpython/issues/104947\n\n(9) https://github.com/python/cpython/issues/104935\n\n(10) https://peps.python.org/pep-0695/\n\n(11) https://github.com/python/cpython/issues/104874\n\n(12) https://github.com/python/cpython/issues/104799\n\n(13) https://peps.python.org/pep-0695/\n\n(14) https://github.com/python/cpython/issues/104797\n\n(15) https://github.com/python/cpython/issues/104372\n\n(16) https://github.com/python/cpython/issues/99108\n\n(17) https://github.com/python/cpython/issues/104399\n\n(18) https://github.com/python/cpython/issues/102024\n\nFile: python3.12.info,  Node: Documentation<10>,  Next: Build<8>,  Prev: Library<10>,  Up: Python 3 12 0 beta 2\n\n1.22.10.4 Documentation\n.......................\n\n- gh-89455(1): Add missing documentation for the 'maxgroupdepth'\nand 'maxgroupwidth' parameters and the 'exceptions' attribute of\nthe *note traceback.TracebackException: 471. class.\n\n- gh-89412(2): Add missing documentation for the 'endlineno' and\n'endoffset' attributes of the *note traceback.TracebackException:\n471. class.\n\n- gh-104943(3): Remove mentions of old Python versions in *note\ntyping.NamedTuple: 1f9.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/89455\n\n(2) https://github.com/python/cpython/issues/89412\n\n(3) https://github.com/python/cpython/issues/104943\n\nFile: python3.12.info,  Node: Build<8>,  Next: Windows<8>,  Prev: Documentation<10>,  Up: Python 3 12 0 beta 2\n\n1.22.10.5 Build\n...............\n\n- gh-90005(1): Fix a regression in 'configure' where we could end up\nunintentionally linking with 'libbsd'.\n\n- gh-89886(2): Autoconf 2.71 and aclocal 1.16.4 is now required to\nregenerate '!configure'.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/90005\n\n(2) https://github.com/python/cpython/issues/89886\n\nFile: python3.12.info,  Node: Windows<8>,  Next: macOS<6>,  Prev: Build<8>,  Up: Python 3 12 0 beta 2\n\n1.22.10.6 Windows\n.................\n\n- gh-105146(1): Updated the links at the end of the installer to\npoint to Discourse rather than the mailing lists.\n\n- gh-103646(2): When installed from the Microsoft Store, 'pip' no\nlonger defaults to per-user installs.  However, as the install\ndirectory is unwritable, it should automatically decide to do a\nper-user install anyway.  This should resolve issues when 'pip' is\npassed an option that conflicts with '--user'.\n\n- gh-88745(3): Improve performance of *note shutil.copy2(): 888. by\nusing the operating system's 'CopyFile2' function.  This may result\nin subtle changes to metadata copied along with some files,\nbringing them in line with normal OS behavior.\n\n- gh-104820(4): Fixes *note stat(): 1bf. and related functions on\nfile systems that do not support file ID requests.  This includes\nFAT32 and exFAT.\n\n- gh-104803(5): Add *note os.path.isdevdrive(): 145a. to detect\nwhether a path is on a Windows Dev Drive.  Returns 'False' on\nplatforms that do not support Dev Drive, and is absent on\nnon-Windows platforms.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/105146\n\n(2) https://github.com/python/cpython/issues/103646\n\n(3) https://github.com/python/cpython/issues/88745\n\n(4) https://github.com/python/cpython/issues/104820\n\n(5) https://github.com/python/cpython/issues/104803\n\nFile: python3.12.info,  Node: macOS<6>,  Next: IDLE<6>,  Prev: Windows<8>,  Up: Python 3 12 0 beta 2\n\n1.22.10.7 macOS\n...............\n\n- gh-103142(1): Update macOS installer to use OpenSSL 1.1.1u.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/103142\n\nFile: python3.12.info,  Node: IDLE<6>,  Next: C API<7>,  Prev: macOS<6>,  Up: Python 3 12 0 beta 2\n\n1.22.10.8 IDLE\n..............\n\n- gh-104719(1): Remove IDLE's modification of tokenize.tabsize and\ntest other uses of tokenize data and methods.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/104719\n\nFile: python3.12.info,  Node: C API<7>,  Prev: IDLE<6>,  Up: Python 3 12 0 beta 2\n\n1.22.10.9 C API\n...............\n\n- gh-105115(1): 'PyTypeObject.tpbases' (and 'tpmro') for builtin\nstatic types are now shared by all interpreters, whereas in\n3.12-beta1 they were stored on 'PyInterpreterState'.  Also note\nthat now the tuples are immortal objects.\n\n- gh-105071(2): Add 'PyUnstableExcPrepReraiseStar' to the unstable\nC api to expose the implementation of *note except*: 378.\n\n- gh-104668(3): Don't call *note PyOSInputHook: 2e7. or *note\nPyOSReadlineFunctionPointer: 2e8. in subinterpreters, since it's\ngenerally difficult to avoid using global state in their registered\ncallbacks.  This also avoids situations where extensions may find\nthemselves running in a subinterpreter they don't support (or\nhaven't yet been loaded in).\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/105115\n\n(2) https://github.com/python/cpython/issues/105071\n\n(3) https://github.com/python/cpython/issues/104668\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 12 0 beta 1,  Next: Python 3 12 0 alpha 7,  Prev: Python 3 12 0 beta 2,  Up: Changelog": {
            "content": "'Release date: 2023-05-22'\n\n* Menu:\n\n* Security: Security<7>.\n* Core and Builtins: Core and Builtins<11>.\n* Library: Library<11>.\n* Documentation: Documentation<11>.\n* Tests: Tests<9>.\n* Build: Build<9>.\n* Windows: Windows<9>.\n* macOS: macOS<7>.\n* IDLE: IDLE<7>.\n* Tools/Demos: Tools/Demos<7>.\n* C API: C API<8>.\n\nFile: python3.12.info,  Node: Security<7>,  Next: Core and Builtins<11>,  Up: Python 3 12 0 beta 1\n\n1.22.11.1 Security\n..................\n\n- gh-99889(1): Fixed a security in flaw in *note uu.decode(): 1460.\nthat could allow for directory traversal based on the input if no\n'outfile' was specified.\n\n- gh-104049(2): Do not expose the local on-disk location in directory\nindexes produced by 'http.client.SimpleHTTPRequestHandler'.\n\n- gh-99108(3): Upgrade built-in *note hashlib: 63. SHA3\nimplementation to a verified implementation from the 'HACL*'\nproject.  Used when OpenSSL is not present or lacks SHA3.\n\n- gh-102153(4): *note urllib.parse.urlsplit(): b95. now strips\nleading C0 control and space characters following the specification\nfor URLs defined by WHATWG in response to CVE-2023-24329.  Patch by\nIllia Volochii.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/99889\n\n(2) https://github.com/python/cpython/issues/104049\n\n(3) https://github.com/python/cpython/issues/99108\n\n(4) https://github.com/python/cpython/issues/102153\n\nFile: python3.12.info,  Node: Core and Builtins<11>,  Next: Library<11>,  Prev: Security<7>,  Up: Python 3 12 0 beta 1\n\n1.22.11.2 Core and Builtins\n...........................\n\n- gh-102856(1): Implement PEP 701 changes in the *note tokenize: f6.\nmodule.  Patch by Marta G??mez Mac??as and Pablo Galindo Salgado\n\n- gh-104615(2): Fix wrong ordering of assignments in code like 'a, a\n= x, y'.  Contributed by Carl Meyer.\n\n- gh-104572(3): Improve syntax error message for invalid constructs\nin PEP 695(4) contexts and in annotations when 'from future\nimport annotations' is active.\n\n- gh-104482(5): Fix three error handling bugs in ast.c's validation\nof pattern matching statements.\n\n- gh-102818(6): Do not add a frame to the traceback in the\n'sys.setprofile' and 'sys.settrace' trampoline functions.  This\nensures that frames are not duplicated if an exception is raised in\nthe callback function, and ensures that frames are not omitted if a\nC callback is used and that does not add the frame.\n\n- gh-104405(7): Fix an issue where some *note bytecode: 370.\ninstructions could ignore PEP 523(8) when \"inlining\" calls.\n\n- gh-103082(9): Change behavior of 'sys.monitoring.events.LINE'\nevents in 'sys.monitoring': Line events now occur when a new line\nis reached dynamically, instead of using a static approximation, as\nbefore.  This makes the behavior very similar to that of \"line\"\nevents in 'sys.settrace'.  This should ease porting of tools from\n3.11 to 3.12.\n\n- gh-104263(10): Fix 'float(\"nan\")' to produce a quiet NaN on\nplatforms (like MIPS) where the meaning of the signalling / quiet\nbit is inverted from its usual meaning.  Also introduce a new macro\n'PyINFINITY' matching C99's 'INFINITY', and refactor internals to\nrely on C99's 'NAN' and 'INFINITY' macros instead of hard-coding\nbit patterns for infinities and NaNs.  Thanks Sebastian Berg.\n\n- gh-99113(11): Multi-phase init extension modules may now indicate\nthat they support running in subinterpreters that have their own\nGIL. This is done by using 'PyMODPERINTERPRETERGILSUPPORTED'\nas the value for the 'Pymodmultipleinterpreters' module def\nslot.  Otherwise the module, by default, cannot be imported in such\nsubinterpreters.  (This does not affect the main interpreter or\nsubinterpreters that do not have their own GIL.) In addition to the\nisolation that multi-phase init already normally requires, support\nfor per-interpreter GIL involves one additional constraint:\nthread-safety.  If the module has external (linked) dependencies\nand those libraries have any state that isn't thread-safe then the\nmodule must do the additional work to add thread-safety.  This\nshould be an uncommon case.\n\n- gh-99113(12): The GIL is now (optionally) per-interpreter.  This is\nthe fundamental change for PEP 684.  This is all made possible by\nvirtue of the isolated state of each interpreter in the process.\nThe behavior of the main interpreter remains unchanged.  Likewise,\ninterpreters created using 'PyNewInterpreter()' are not affected.\nTo get an interpreter with its own GIL, call\n'PyNewInterpreterFromConfig()'.\n\n- gh-104108(13): Multi-phase init extension modules may now indicate\nwhether or not they actually support multiple interpreters.  By\ndefault such modules are expected to support use in multiple\ninterpreters.  In the uncommon case that one does not, it may use\nthe new 'Pymodmultipleinterpreters' module def slot.  A value of\n'0' means the module does not support them.  '1' means it does.\nThe default is '1'.\n\n- gh-104142(14): Fix an issue where *note list: 3dc. or *note tuple:\n4b8. repetition could fail to respect PEP 683(15).\n\n- gh-104078(16): Improve the performance of *note\nPyObjectHasAttrString(): 1462.\n\n- gh-104066(17): Improve the performance of *note hasattr(): 1f7. for\nmodule objects with a missing attribute.\n\n- gh-104028(18): Reduce object creation while calling callback\nfunction from gc.  Patch by Donghee Na.\n\n- gh-104018(19): Disallow the \"z\" format specifier in %-format of\nbytes objects.\n\n- gh-102213(20): Fix performance loss when accessing an object's\nattributes with 'getattr' defined.\n\n- gh-103895(21): Improve handling of edge cases in showing\n'Exception.notes'.  Ensures that the messages always end with a\nnewline and that string/bytes are not exploded over multiple lines.\nPatch by Carey Metcalfe.\n\n- gh-103907(22): Don't modify the refcounts of known immortal objects\n(*note True: a53, *note False: 971, and *note None: 43f.) in the\nmain interpreter loop.\n\n- gh-103899(23): Provide a helpful hint in the *note TypeError: 28e.\nmessage when accidentally calling a *note module: 1463. object that\nhas a callable attribute of the same name (such as *note dis.dis():\n96e. or *note datetime.datetime: 222.).\n\n- gh-103845(24): Remove both line and instruction instrumentation\nbefore adding new ones for monitoring, to avoid newly added\ninstrumentation being removed immediately.\n\n- gh-103763(25): Implement PEP 695(26), adding syntactic support for\ngeneric classes, generic functions, and type aliases.\n\nA new 'type X = ...' syntax is added for type aliases, which\nresolves at runtime to an instance of the new class\n'typing.TypeAliasType'.  The value is lazily evaluated and is\naccessible through the '.value' attribute.  This is implemented\nas a new AST node 'ast.TypeAlias'.\n\nNew syntax ('class X[T]: ...', 'def func[T](): ...') is added for\ndefining generic functions and classes.  This is implemented as a\nnew 'typeparams' attribute on the AST nodes for classes and\nfunctions.  This node holds instances of the new AST classes\n'ast.TypeVar', 'ast.ParamSpec', and 'ast.TypeVarTuple'.\n\n'typing.TypeVar', 'typing.ParamSpec', 'typing.ParamSpecArgs',\n'typing.ParamSpecKwargs', 'typing.TypeVarTuple', and\n'typing.Generic' are now implemented in C rather than Python.\n\nThere are new bytecode instructions 'LOADLOCALS',\n'LOADCLASSDICTORGLOBAL', and 'LOADCLASSDICTORDEREF' to\nsupport correct resolution of names in class namespaces.\n\nPatch by Eric Traut, Larry Hastings, and Jelle Zijlstra.\n\n- gh-103801(27): Adds three minor linting fixes to the wasm module\ncaught that were caught by ruff.\n\n- gh-103793(28): Optimized asyncio Task creation by deferring\nexpensive string formatting (task name generation) from Task\ncreation to the first time 'getname' is called.  This makes\nasyncio benchmarks up to 5% faster.\n\n- gh-102310(29): Change the error range for invalid bytes literals.\n\n- gh-103590(30): Do not wrap a single exception raised from a\n'try-except*' construct in an *note ExceptionGroup: 17b.\n\n- gh-103650(31): Change the perf map format to remove the '0x' prefix\nfrom the addresses\n\n- gh-102856(32): Implement the required C tokenizer changes for PEP\n701.  Patch by Pablo Galindo Salgado, Lysandros Nikolaou, Batuhan\nTaskaya, Marta G??mez Mac??as and sunmy2019.\n\n- gh-100530(33): Clarify the error message raised when the called\npart of a class pattern isn't actually a class.\n\n- gh-101517(34): Fix bug in line numbers of instructions emitted for\n*note except*: 378.\n\n- gh-103492(35): Clarify *note SyntaxWarning: 178. with literal 'is'\ncomparison by specifying which literal is problematic, since\ncomparisons using 'is' with e.g.  None and bool literals are\nidiomatic.\n\n- gh-87729(36): Add *note LOADSUPERATTR: 205. (and a specialization\nfor 'super().method()') to speed up 'super().method()' and\n'super().attr'.  This makes 'super().method()' roughly 2.3x faster\nand brings it within 20% of the performance of a simple method\ncall.  Patch by Vladimir Matveev and Carl Meyer.\n\n- gh-103488(37): Change the internal offset distinguishing yield and\nreturn target addresses, so that the instruction pointer is correct\nfor exception handling and other stack unwinding.\n\n- gh-82012(38): The bitwise inversion operator ('~') on bool is\ndeprecated.  It returns the bitwise inversion of the underlying\n'int' representation such that 'bool(~True) == True', which can be\nconfusing.  Use 'not' for logical negation of bools.  In the rare\ncase that you really need the bitwise inversion of the underlying\n'int', convert to int explicitly '~int(x)'.\n\n- gh-77757(39): Exceptions raised in a typeobject's 'setname'\nmethod are no longer wrapped by a *note RuntimeError: 17a.  Context\ninformation is added to the exception as a PEP 678(40) note.\n\n- gh-103333(41): *note AttributeError: 395. now retains the 'name'\nattribute when pickled and unpickled.\n\n- gh-103242(42): Migrate *note setecdhcurve(): fb7. method not to\nuse deprecated OpenSSL APIs.  Patch by Donghee Na.\n\n- gh-103323(43): We've replaced our use of\n'PyRuntime.tstatecurrent' with a thread-local variable.  This is\na fairly low-level implementation detail, and there should be no\nchange in behavior.\n\n- gh-84436(44): The implementation of PEP-683 which adds Immortal\nObjects by using a fixed reference count that skips reference\ncounting to make objects truly immutable.\n\n- gh-102700(45): Allow built-in modules to be submodules.  This\nallows submodules to be statically linked into a CPython binary.\n\n- gh-103082(46): Implement PEP 669(47) Low Impact Monitoring for\nCPython.\n\n- gh-88691(48): Reduce the number of inline *note CACHE: 4cc. entries\nfor *note CALL: 4db.\n\n- gh-102500(49): Make the buffer protocol accessible in Python code\nusing the new 'buffer' and 'releasebuffer' magic methods.\nSee PEP 688(50) for details.  Patch by Jelle Zijlstra.\n\n- gh-97933(51): PEP 709(52): inline list, dict and set comprehensions\nto improve performance and reduce bytecode size.\n\n- gh-99184(53): Bypass instance attribute access of 'name' in\n'repr' of *note weakref.ref: e63.\n\n- gh-98003(54): Complex function calls are now faster and consume no\nC stack space.\n\n- bpo-39610(55): 'len()' for 0-dimensional *note memoryview: 17f.\nobjects (such as 'memoryview(ctypes.cuint8(42))') now raises a\n*note TypeError: 28e.  Previously this returned '1', which was not\nconsistent with 'mem0d[0]' raising an *note IndexError: 138f.\n\n- bpo-31821(56): Fix 'pausereading()' to work when called from\n'connectionmade()' in *note asyncio: 9.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/102856\n\n(2) https://github.com/python/cpython/issues/104615\n\n(3) https://github.com/python/cpython/issues/104572\n\n(4) https://peps.python.org/pep-0695/\n\n(5) https://github.com/python/cpython/issues/104482\n\n(6) https://github.com/python/cpython/issues/102818\n\n(7) https://github.com/python/cpython/issues/104405\n\n(8) https://peps.python.org/pep-0523/\n\n(9) https://github.com/python/cpython/issues/103082\n\n(10) https://github.com/python/cpython/issues/104263\n\n(11) https://github.com/python/cpython/issues/99113\n\n(12) https://github.com/python/cpython/issues/99113\n\n(13) https://github.com/python/cpython/issues/104108\n\n(14) https://github.com/python/cpython/issues/104142\n\n(15) https://peps.python.org/pep-0683/\n\n(16) https://github.com/python/cpython/issues/104078\n\n(17) https://github.com/python/cpython/issues/104066\n\n(18) https://github.com/python/cpython/issues/104028\n\n(19) https://github.com/python/cpython/issues/104018\n\n(20) https://github.com/python/cpython/issues/102213\n\n(21) https://github.com/python/cpython/issues/103895\n\n(22) https://github.com/python/cpython/issues/103907\n\n(23) https://github.com/python/cpython/issues/103899\n\n(24) https://github.com/python/cpython/issues/103845\n\n(25) https://github.com/python/cpython/issues/103763\n\n(26) https://peps.python.org/pep-0695/\n\n(27) https://github.com/python/cpython/issues/103801\n\n(28) https://github.com/python/cpython/issues/103793\n\n(29) https://github.com/python/cpython/issues/102310\n\n(30) https://github.com/python/cpython/issues/103590\n\n(31) https://github.com/python/cpython/issues/103650\n\n(32) https://github.com/python/cpython/issues/102856\n\n(33) https://github.com/python/cpython/issues/100530\n\n(34) https://github.com/python/cpython/issues/101517\n\n(35) https://github.com/python/cpython/issues/103492\n\n(36) https://github.com/python/cpython/issues/87729\n\n(37) https://github.com/python/cpython/issues/103488\n\n(38) https://github.com/python/cpython/issues/82012\n\n(39) https://github.com/python/cpython/issues/77757\n\n(40) https://peps.python.org/pep-0678/\n\n(41) https://github.com/python/cpython/issues/103333\n\n(42) https://github.com/python/cpython/issues/103242\n\n(43) https://github.com/python/cpython/issues/103323\n\n(44) https://github.com/python/cpython/issues/84436\n\n(45) https://github.com/python/cpython/issues/102700\n\n(46) https://github.com/python/cpython/issues/103082\n\n(47) https://peps.python.org/pep-0669/\n\n(48) https://github.com/python/cpython/issues/88691\n\n(49) https://github.com/python/cpython/issues/102500\n\n(50) https://peps.python.org/pep-0688/\n\n(51) https://github.com/python/cpython/issues/97933\n\n(52) https://peps.python.org/pep-0709/\n\n(53) https://github.com/python/cpython/issues/99184\n\n(54) https://github.com/python/cpython/issues/98003\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=39610\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=31821\n\nFile: python3.12.info,  Node: Library<11>,  Next: Documentation<11>,  Prev: Core and Builtins<11>,  Up: Python 3 12 0 beta 1\n\n1.22.11.3 Library\n.................\n\n- gh-104600(1): *note functools.updatewrapper(): e99. now sets the\n'typeparams' attribute (added by PEP 695(2)).\n\n- gh-104340(3): When an 'asyncio' pipe protocol loses its connection\ndue to an error, and the caller doesn't await 'waitclosed()' on\nthe corresponding 'StreamWriter', don't log a warning about an\nexception that was never retrieved.  After all, according to the\n'StreamWriter.close()' docs, the 'waitclosed()' call is optional\n(\"not mandatory\").\n\n- gh-104555(4): Fix issue where an *note issubclass(): 5b4. check\ncomparing a class 'X' against a *note runtime-checkable protocol:\n14c. 'Y' with non-callable members would not cause *note TypeError:\n28e. to be raised if an *note isinstance(): 14b. call had\npreviously been made comparing an instance of 'X' to 'Y'.  This\nissue was present in edge cases on Python 3.11, but became more\nprominent in 3.12 due to some unrelated changes that were made to\nruntime-checkable protocols.  Patch by Alex Waygood.\n\n- gh-104372(5): Refactored the 'posixsubprocess' internals to avoid\nPython C API usage between fork and exec when marking 'passfds='\nfile descriptors inheritable.\n\n- gh-104484(6): Added 'casesensitive' argument to *note\npathlib.PurePath.match(): 1ce.\n\n- gh-75367(7): Fix data descriptor detection in *note\ninspect.getattrstatic(): 1b2.\n\n- gh-104536(8): Fix a race condition in the internal\n'multiprocessing.process' cleanup logic that could manifest as an\nunintended 'AttributeError' when calling 'process.close()'.\n\n- gh-103857(9): Update datetime deprecations' stracktrace to point to\nthe calling line\n\n- gh-101520(10): Move the core functionality of the 'tracemalloc'\nmodule in the 'Python/' folder, leaving just the module wrapper in\n'Modules/'.\n\n- gh-104392(11): Remove undocumented and unused 'paramspectvars'\nattribute from some classes in *note typing: ff.\n\n- gh-102613(12): Fix issue where *note pathlib.Path.glob(): 1cc.\nraised *note RecursionError: bc6. when walking deep directory\ntrees.\n\n- gh-103000(13): Improve performance of *note dataclasses.asdict():\n1465. for the common case where 'dictfactory' is 'dict'.  Patch by\nDavid C Ellis.\n\n- gh-104301(14): Allow leading whitespace in disambiguated statements\nin *note pdb: a0.\n\n- gh-104139(15): Teach 'urllib.parse.unsplit()' to retain the '\"//\"'\nwhen assembling 'itms-services://?action=generate-bugs' style Apple\nPlatform Deployment(16) URLs.\n\n- gh-104307(17): *note socket.getnameinfo(): 1466. now releases the\nGIL while contacting the DNS server\n\n- gh-104310(18): Users may now use\n'importlib.util.allowingallextensions()' (a context manager) to\ntemporarily disable the strict compatibility checks for importing\nextension modules in subinterpreters.\n\n- gh-87695(19): Fix issue where *note pathlib.Path.glob(): 1cc.\nraised *note OSError: 613. when it encountered a symlink to an\noverly long path.\n\n- gh-104265(20): Prevent possible crash by disallowing instantiation\nof the 'csv.Reader' and 'csv.Writer' types.  The regression was\nintroduced in 3.10.0a4 with PR 23224 (bpo-14935(21)).  Patch by\nRadislav Chugunov.\n\n- gh-102613(22): Improve performance of *note pathlib.Path.glob():\n1cc. when expanding recursive wildcards (\"''\") by merging\nadjacent wildcards and de-duplicating results only when necessary.\n\n- gh-65772(23): Remove unneeded comments and code in turtle.py.\n\n- gh-90208(24): Fixed issue where *note pathlib.Path.glob(): 1cc.\nreturned incomplete results when it encountered a *note\nPermissionError: b9a.  This method now suppresses all *note\nOSError: 613. exceptions, except those raised from calling *note\nisdir(): 840. on the top-level path.\n\n- gh-104144(25): Optimize *note asyncio.TaskGroup: 3c3. when using\n*note asyncio.eagertaskfactory(): 192.  Skip scheduling a done\ncallback if a TaskGroup task completes eagerly.\n\n- gh-104144(26): Optimize *note asyncio.gather(): 3c6. when using\n*note asyncio.eagertaskfactory(): 192. to complete eagerly if all\nfututres completed eagerly.  Avoid scheduling done callbacks for\nfutures that complete eagerly.\n\n- gh-104114(27): Fix issue where *note pathlib.Path.glob(): 1cc.\nreturns paths using the case of non-wildcard segments for\ncorresponding path segments, rather than the real filesystem case.\n\n- gh-104104(28): Improve performance of *note pathlib.Path.glob():\n1cc. by using *note re.IGNORECASE: 1467. to implement\ncase-insensitive matching.\n\n- gh-104102(29): Improve performance of *note pathlib.Path.glob():\n1cc. when evaluating patterns that contain ''../'' segments.\n\n- gh-103822(30): Update the return type of 'weekday' to the newly\nadded Day attribute\n\n- gh-103629(31): Update the 'repr' of *note typing.Unpack: 1468.\naccording to PEP 692(32).\n\n- gh-103963(33): Make *note dis: 35. display the names of the args\nfor 'CALLINTRINSIC*'.\n\n- gh-104035(34): Do not ignore user-defined 'getstate' and\n'setstate' methods for slotted frozen dataclasses.\n\n- gh-103987(35): In *note mmap: 8b, fix several bugs that could lead\nto access to memory-mapped files after they have been invalidated.\n\n- gh-103977(36): Improve import time of *note platform: a5. module.\n\n- gh-88773(37): Added *note turtle.teleport(): 1469. to the *note\nturtle: fc. module to move a turtle to a new point without tracing\na line, visible or invisible.  Patch by Liam Gersten.\n\n- gh-103935(38): Use *note io.opencode(): 146a. for files to be\nexecuted instead of raw *note open(): 26e.\n\n- gh-68968(39): Fixed garbled output of *note assertEqual(): 27d.\nwhen an input lacks final newline.\n\n- gh-100370(40): Fix potential *note OverflowError: 68d. in *note\nsqlite3.Connection.blobopen(): 44d. for 32-bit builds.  Patch by\nErlend E. Aasland.\n\n- gh-102628(41): Substitute CTRL-D with CTRL-Z in *note sqlite3: c9.\nCLI banner when running on Windows.\n\n- gh-103636(42): Module-level attributes 'January' and 'February' are\ndeprecated from *note calendar: 12.\n\n- gh-103583(43): Isolate 'multibytecodec' and codecs extension\nmodules.  Patches by Erlend E. Aasland.\n\n- gh-103848(44): Add checks to ensure that '[' bracketed ']' hosts\nfound by *note urllib.parse.urlsplit(): b95. are of IPv6 or\nIPvFuture format.\n\n- gh-103872(45): Update the bundled copy of pip to version 23.1.2.\n\n- gh-99944(46): Make *note dis: 35. display the value of oparg of\n*note KWNAMES: 146b.\n\n- gh-74940(47): The C.UTF-8 locale is no longer converted to\nenUS.UTF-8, enabling the use of UTF-8 encoding on systems which\nhave no locales installed.\n\n- gh-103861(48): Fix 'zipfile.Zipfile' creating invalid zip files\nwhen 'forcezip64' was used to add files to them.  Patch by Carey\nMetcalfe.\n\n- gh-103857(49): Deprecated *note datetime.datetime.utcnow(): 223.\nand *note datetime.datetime.utcfromtimestamp(): 224.  (Patch by\nPaul Ganssle)\n\n- gh-103839(50): Avoid compilation error due to tommath.h not being\nfound when building Tkinter against Tcl 8.7 built with bundled\nlibtommath.\n\n- gh-103791(51): *note contextlib.suppress: d93. now supports\nsuppressing exceptions raised as part of an *note ExceptionGroup:\n17b.  If other exceptions exist on the group, they are re-raised in\na group that does not contain the suppressed exceptions.\n\n- gh-90750(52): Use *note datetime.datetime.fromisocalendar(): 813.\nin the implementation of *note datetime.datetime.strptime(): 146c,\nwhich should now accept only valid ISO dates.  (Patch by Paul\nGanssle)\n\n- gh-103685(53): Prepare 'tkinter.Menu.index()' for Tk 8.7 so that it\ndoes not raise 'TclError: expected integer but got \"\"' when it\nshould return 'None'.\n\n- gh-81403(54): *note urllib.request.CacheFTPHandler: 146d. no longer\nraises 'URLError' if a cached FTP instance is reused.  ftplib's\nendtransfer method calls voidresp to drain the connection to handle\nFTP instance reuse properly.\n\n- gh-103699(55): Add 'origbases' to non-generic TypedDicts,\ncall-based TypedDicts, and call-based NamedTuples.  Other\nTypedDicts and NamedTuples already had the attribute.\n\n- gh-103693(56): Add convenience variable feature to *note pdb: a0.\n\n- gh-92248(57): Deprecate 'type', 'choices', and 'metavar' parameters\nof 'argparse.BooleanOptionalAction'.\n\n- gh-89415(58): Add *note socket: c6. constants for source-specific\nmulticast.  Patch by Reese Hyde.\n\n- gh-103673(59): *note socketserver: c7. gains\n'ForkingUnixStreamServer' and 'ForkingUnixDatagramServer' classes.\nPatch by Jay Berry.\n\n- gh-103636(60): Added Enum for months and days in the calendar\nmodule.\n\n- gh-84976(61): Create a new 'Lib/pydatetime.py' file that defines\nthe Python version of the 'datetime' module, and make 'datetime'\nimport the contents of the new library only if the C implementation\nis missing.  Currently, the full Python implementation is defined\nand then deleted if the C implementation is not available, slowing\ndown 'import datetime' unnecessarily.\n\n- gh-103596(62): Attributes/methods are no longer shadowed by\nsame-named enum members, although they may be shadowed by\nenum.property's.\n\n- gh-103584(63): Updated 'importlib.metadata' with changes from\n'importlibmetadata' 5.2 through 6.5.0, including: Support\n'installed-files.txt' for 'Distribution.files' when present.\n'PackageMetadata' now stipulates an additional 'get' method\nallowing for easy querying of metadata keys that may not be\npresent.  'packagesdistributions' now honors packages and modules\nwith Python modules that not '.py' sources (e.g.  '.pyc', '.so').\nExpand protocol for 'PackageMetadata.getall' to match the upstream\nimplementation of 'email.message.Message.getall' in\npython/typeshed#9620.  Deprecated use of 'Distribution' without\ndefining abstract methods.  Deprecated expectation that\n'PackageMetadata.getitem' will return 'None' for missing keys.\nIn the future, it will raise a 'KeyError'.\n\n- gh-103578(64): Fixed a bug where *note pdb: a0. crashes when\nreading source file with different encoding by replacing *note\nio.open(): 26f. with *note io.opencode(): 146a.  The new method\nwould also call into the hook set by *note\nPyFileSetOpenCodeHook(): 146e.\n\n- gh-103556(65): Now creating *note inspect.Signature: 51e. objects\nwith positional-only parameter with a default followed by a\npositional-or-keyword parameter without one is impossible.\n\n- gh-103559(66): Update the bundled copy of pip to version 23.1.1.\n\n- gh-103548(67): Improve performance of *note\npathlib.Path.absolute(): 146f. and *note cwd(): 1470. by joining\npaths only when necessary.  Also improve performance of *note\npathlib.PurePath.isabsolute(): 1471. on Posix by skipping path\nparsing and normalization.\n\n- gh-103538(68): Remove 'tkinter' module code guarded by definition\nof the 'TKAQUA' macro which was only needed for Tk 8.4.7 or\nearlier and was never actually defined by any build system or\ndocumented for manual use.\n\n- gh-103533(69): Update *note cProfile: 25. to use PEP 669 API\n\n- gh-103525(70): Fix misleading exception message when mixed 'str'\nand 'bytes' arguments are supplied to *note pathlib.PurePath: 1c5.\nand *note Path: 149.\n\n- gh-103489(71): Add *note getconfig(): 1dd. and *note setconfig():\n1de. to *note Connection: 1d9. to make configuration changes to a\ndatabase connection.  Patch by Erlend E. Aasland.\n\n- gh-103365(72): Set default Flag boundary to 'STRICT' and fix\nbitwise operations.\n\n- gh-103472(73): Avoid a potential *note ResourceWarning: a86. in\n*note http.client.HTTPConnection: 97a. by closing the proxy /\ntunnel's CONNECT response explicitly.\n\n- gh-103462(74): Fixed an issue with using *note writelines(): 1472.\nin *note asyncio: 9. to send very large payloads that exceed the\namount of data that can be written in one call to *note\nsocket.socket.send(): c03. or *note socket.socket.sendmsg(): 191,\nresulting in the remaining buffer being left unwritten.\n\n- gh-103449(75): Fix a bug in doc string generation in *note\ndataclasses.dataclass(): 38d.\n\n- gh-103092(76): Isolate 'collections' (apply PEP 687(77)).  Patch\nby Erlend E. Aasland.\n\n- gh-103357(78): Added support for *note logging.Formatter: 12ec.\n'defaults' parameter to *note logging.config.dictConfig(): 1023.\nand *note logging.config.fileConfig(): 98d.  Patch by Bar Harel.\n\n- gh-103092(79): Adapt the *note winreg: 111. extension module to PEP\n687(80).\n\n- gh-74690(81): The performance of *note isinstance(): 14b. checks\nagainst *note runtime-checkable protocols: 14c. has been\nconsiderably improved for protocols that only have a few members.\nTo achieve this improvement, several internal implementation\ndetails of the *note typing: ff. module have been refactored,\nincluding 'typing.ProtocolMeta.instancecheck',\n'typing.iscallablemembersonly', and\n'typing.getprotocolattrs'.  Patches by Alex Waygood.\n\n- gh-74690(82): The members of a runtime-checkable protocol are now\nconsidered \"frozen\" at runtime as soon as the class has been\ncreated.  See *note \"What's new in Python 3.12\": 1ed. for more\ndetails.\n\n- gh-103256(83): Fixed a bug that caused *note hmac: 65. to raise an\nexception when the requested hash algorithm was not available in\nOpenSSL despite being available separately as part of 'hashlib'\nitself.  It now falls back properly to the built-in.  This could\nhappen when, for example, your OpenSSL does not include SHA3\nsupport and you want to compute 'hmac.digest(b'K', b'M',\n'sha3256')'.\n\n- gh-102778(84): Support 'sys.lastexc' in *note idlelib: 6e.\n\n- gh-103285(85): Improve performance of *note\nast.getsourcesegment(): 7fc.\n\n- gh-103225(86): Fix a bug in *note pdb: a0. when displaying line\nnumbers of module-level source code.\n\n- gh-103092(87): Adapt the *note msvcrt: 8e. extension module to PEP\n687(88).\n\n- gh-103092(89): Adapt the *note winsound: 112. extension module to\nPEP 687(90).\n\n- gh-93910(91): Remove deprecation of enum 'memmber.member' access.\n\n- gh-102978(92): Fixes *note unittest.mock.patch(): cf5. not\nenforcing function signatures for methods decorated with\n'@classmethod' or '@staticmethod' when patch is called with\n'autospec=True'.\n\n- gh-103092(93): Isolate 'socket' (apply PEP 687(94)).  Patch by\nErlend E. Aasland.\n\n- gh-100479(95): Add *note pathlib.PurePath.withsegments(): 1c6,\nwhich creates a path object from arguments.  This method is called\nwhenever a derivative path is created, such as from *note\npathlib.PurePath.parent: 1473.  Subclasses may override this method\nto share information between path objects.\n\n- gh-103220(96): Fix issue where *note os.path.join(): 1474. added a\nslash when joining onto an incomplete UNC drive with a trailing\nslash on Windows.\n\n- gh-103204(97): Fixes *note http.server: 6d. accepting HTTP requests\nwith HTTP version numbers preceded by '+', or '-', or with\ndigit-separating '' characters.  The length of the version numbers\nis also constrained.\n\n- gh-75586(98): Fix various Windows-specific issues with\n'shutil.which'.\n\n- gh-103193(99): Improve performance of *note\ninspect.getattrstatic(): 1b2.  Patch by Alex Waygood.\n\n- gh-103176(100): *note sys.currentexceptions(): 1e6. now returns a\nmapping from thread-id to an exception instance, rather than to a\n'(typ, exc, tb)' tuple.\n\n- gh-103143(101): Polish the help messages and docstrings of *note\npdb: a0.\n\n- gh-103015(102): Add 'entrypoint' keyword-only parameter to *note\nsqlite3.Connection.loadextension(): 1dc, for overriding the SQLite\nextension entry point.  Patch by Erlend E. Aasland.\n\n- gh-103000(103): Improve performance of *note dataclasses.astuple():\n1475. and *note dataclasses.asdict(): 1465. in cases where the\ncontents are common Python types.\n\n- gh-102953(104): The extraction methods in *note tarfile: d8, and\n*note shutil.unpackarchive(): 184, have a new a 'filter' argument\nthat allows limiting tar features than may be surprising or\ndangerous, such as creating files outside the destination\ndirectory.  See *note Extraction filters: 185. for details.\n\n- gh-97696(105): Implemented an eager task factory in asyncio.  When\nused as a task factory on an event loop, it performs eager\nexecution of coroutines.  Coroutines that are able to complete\nsynchronously (e.g.  return or raise without blocking) are returned\nimmediately as a finished task, and the task is never scheduled to\nthe event loop.  If the coroutine blocks, the (pending) task is\nscheduled and returned.\n\n- gh-81079(106): Add 'casesensitive' keyword-only argument to *note\npathlib.Path.glob(): 1cc. and *note rglob(): 1cd.\n\n- gh-101819(107): Isolate the *note io: 79. extension module by\napplying PEP 687(108).  Patch by Kumar Aditya, Victor Stinner, and\nErlend E. Aasland.\n\n- gh-91896(109): Deprecate *note collections.abc.ByteString: 221.\n\n- gh-101362(110): Speed up *note pathlib.Path: 149. construction by\nomitting the path anchor from the internal list of path parts.\n\n- gh-102114(111): Functions in the *note dis: 35. module that accept\na source code string as argument now print a more concise traceback\nwhen the string contains a syntax or indentation error.\n\n- gh-62432(112): The *note unittest: 101. runner will now exit with\nstatus code 5 if no tests were run.  It is common for test runner\nmisconfiguration to fail to find any tests, this should be an\nerror.\n\n- gh-78079(113): Fix incorrect normalization of UNC device path\nroots, and partial UNC share path roots, in *note pathlib.PurePath:\n1c5.  Pathlib no longer appends a trailing slash to such paths.\n\n- gh-85984(114): Add *note tty.cfmakeraw(): 13f2. and *note\ntty.cfmakecbreak(): 13c9. to *note tty: fb. and modernize, the\nbehavior of *note tty.setraw(): 13f1. and *note tty.setcbreak():\n13c8. to use POSIX.1-2017 Chapter 11 \"General Terminal Interface\"\nflag masks by default.\n\n- gh-101688(115): Implement *note types.getoriginalbases(): 1f4. to\nprovide further introspection for types.\n\n- gh-101640(116): *note argparse.ArgumentParser: 28f. now catches\nerrors when writing messages, such as when *note sys.stderr: 757.\nis 'None'.  Patch by Oleg Iarygin.\n\n- gh-83861(117): Fix datetime.astimezone method return value when\ninvoked on a naive datetime instance that represents local time\nfalling in a timezone transition gap.  PEP 495 requires that\ninstances with fold=1 produce earlier times than those with fold=0\nin this case.\n\n- gh-89550(118): Decrease execution time of some *note gzip: 62. file\nwrites by 15% by adding more appropriate buffering.\n\n- gh-95299(119): Remove the bundled setuptools wheel from\n'ensurepip', and stop installing setuptools in environments created\nby 'venv'.\n\n- gh-99353(120): Respect the *note http.client.HTTPConnection: 97a.\n'.debuglevel' flag in 'urllib.request.AbstractHTTPHandler' when its\nconstructor parameter 'debuglevel' is not set.  And do the same for\n'*HTTPS*'.\n\n- gh-98040(121): Remove the long-deprecated 'imp' module.\n\n- gh-97850(122): Deprecate *note pkgutil.findloader(): 22e. and\n*note pkgutil.getloader(): 22f. in favor of *note\nimportlib.util.findspec(): 230.\n\n- gh-94473(123): Flatten arguments in 'tkinter.Canvas.coords()'.  It\nnow accepts not only 'x1, y1, x2, y2, ...' and '[x1, y1, x2, y2,\n...]', but also '(x1, y1), (x2, y2), ...' and '[(x1, y1), (x2, y2),\n...]'.\n\n- gh-98040(124): Remove more deprecated importlib APIs:\n'findloader()', 'findmodule()', 'importlib.abc.Finder',\n'pkgutil.ImpImporter', 'pkgutil.ImpLoader'.\n\n- gh-96522(125): Fix potential deadlock in pty.spawn()\n\n- gh-96534(126): Support divert(4) added in FreeBSD 14.\n\n- gh-87474(127): Fix potential file descriptor leaks in *note\nsubprocess.Popen: 8c3.\n\n- gh-94906(128): Support multiple steps in *note math.nextafter():\n1b7.  Patch by Shantanu Jain and Matthias Gorgens.\n\n- gh-51574(129): Make *note tempfile.mkdtemp(): 1eb. return absolute\npaths when its 'dir' parameter is relative.\n\n- gh-94518(130): Convert private 'posixsubprocess.forkexec()' to\nuse Argument Clinic.\n\n- gh-92184(131): When creating zip files using *note zipfile: 12b,\n'os.altsep', if not 'None', will always be treated as a path\nseparator even when it is not '/'.  Patch by Carey Metcalfe.\n\n- bpo-46797(132): Deprecation warnings are now emitted for 'ast.Num',\n'ast.Bytes', 'ast.Str', 'ast.NameConstant' and 'ast.Ellipsis'.\nThese have been documented as deprecated since Python 3.8, and will\nbe removed in Python 3.14.\n\n- bpo-44844(133): Enables *note webbrowser: 110. to detect and launch\nMicrosoft Edge browser.\n\n- bpo-45606(134): Fixed the bug in *note pathlib.Path.glob(): 1cc. -\npreviously a dangling symlink would not be found by this method\nwhen the pattern is an exact match, but would be found when the\npattern contains a wildcard or the recursive wildcard ('').  With\nthis change, a dangling symlink will be found in both cases.\n\n- bpo-23041(135): Add *note QUOTESTRINGS: 1a1. and *note\nQUOTENOTNULL: 1a0. to the suite of *note csv: 27. module quoting\nstyles.\n\n- bpo-24964(136): Added *note\nhttp.client.HTTPConnection.getproxyresponseheaders(): 142c. that\nprovides access to the HTTP headers on a proxy server response to\nthe 'CONNECT' request.\n\n- bpo-17258(137): *note multiprocessing: 8f. now supports stronger\nHMAC algorithms for inter-process connection authentication rather\nthan only HMAC-MD5.\n\n- bpo-39744(138): Make *note\nasyncio.subprocess.Process.communicate(): 1476. close the\nsubprocess's stdin even when called with 'input=None'.\n\n- bpo-22708(139): http.client CONNECT method tunnel improvements: Use\nHTTP 1.1 protocol; send a matching Host: header with CONNECT, if\none is not provided; convert IDN domain names to Punycode.  Patch\nby Michael Handler.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/104600\n\n(2) https://peps.python.org/pep-0695/\n\n(3) https://github.com/python/cpython/issues/104340\n\n(4) https://github.com/python/cpython/issues/104555\n\n(5) https://github.com/python/cpython/issues/104372\n\n(6) https://github.com/python/cpython/issues/104484\n\n(7) https://github.com/python/cpython/issues/75367\n\n(8) https://github.com/python/cpython/issues/104536\n\n(9) https://github.com/python/cpython/issues/103857\n\n(10) https://github.com/python/cpython/issues/101520\n\n(11) https://github.com/python/cpython/issues/104392\n\n(12) https://github.com/python/cpython/issues/102613\n\n(13) https://github.com/python/cpython/issues/103000\n\n(14) https://github.com/python/cpython/issues/104301\n\n(15) https://github.com/python/cpython/issues/104139\n\n(16)\nhttps://support.apple.com/en-gb/guide/deployment/depce7cefc4d/web\n\n(17) https://github.com/python/cpython/issues/104307\n\n(18) https://github.com/python/cpython/issues/104310\n\n(19) https://github.com/python/cpython/issues/87695\n\n(20) https://github.com/python/cpython/issues/104265\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=14935\n\n(22) https://github.com/python/cpython/issues/102613\n\n(23) https://github.com/python/cpython/issues/65772\n\n(24) https://github.com/python/cpython/issues/90208\n\n(25) https://github.com/python/cpython/issues/104144\n\n(26) https://github.com/python/cpython/issues/104144\n\n(27) https://github.com/python/cpython/issues/104114\n\n(28) https://github.com/python/cpython/issues/104104\n\n(29) https://github.com/python/cpython/issues/104102\n\n(30) https://github.com/python/cpython/issues/103822\n\n(31) https://github.com/python/cpython/issues/103629\n\n(32) https://peps.python.org/pep-0692/\n\n(33) https://github.com/python/cpython/issues/103963\n\n(34) https://github.com/python/cpython/issues/104035\n\n(35) https://github.com/python/cpython/issues/103987\n\n(36) https://github.com/python/cpython/issues/103977\n\n(37) https://github.com/python/cpython/issues/88773\n\n(38) https://github.com/python/cpython/issues/103935\n\n(39) https://github.com/python/cpython/issues/68968\n\n(40) https://github.com/python/cpython/issues/100370\n\n(41) https://github.com/python/cpython/issues/102628\n\n(42) https://github.com/python/cpython/issues/103636\n\n(43) https://github.com/python/cpython/issues/103583\n\n(44) https://github.com/python/cpython/issues/103848\n\n(45) https://github.com/python/cpython/issues/103872\n\n(46) https://github.com/python/cpython/issues/99944\n\n(47) https://github.com/python/cpython/issues/74940\n\n(48) https://github.com/python/cpython/issues/103861\n\n(49) https://github.com/python/cpython/issues/103857\n\n(50) https://github.com/python/cpython/issues/103839\n\n(51) https://github.com/python/cpython/issues/103791\n\n(52) https://github.com/python/cpython/issues/90750\n\n(53) https://github.com/python/cpython/issues/103685\n\n(54) https://github.com/python/cpython/issues/81403\n\n(55) https://github.com/python/cpython/issues/103699\n\n(56) https://github.com/python/cpython/issues/103693\n\n(57) https://github.com/python/cpython/issues/92248\n\n(58) https://github.com/python/cpython/issues/89415\n\n(59) https://github.com/python/cpython/issues/103673\n\n(60) https://github.com/python/cpython/issues/103636\n\n(61) https://github.com/python/cpython/issues/84976\n\n(62) https://github.com/python/cpython/issues/103596\n\n(63) https://github.com/python/cpython/issues/103584\n\n(64) https://github.com/python/cpython/issues/103578\n\n(65) https://github.com/python/cpython/issues/103556\n\n(66) https://github.com/python/cpython/issues/103559\n\n(67) https://github.com/python/cpython/issues/103548\n\n(68) https://github.com/python/cpython/issues/103538\n\n(69) https://github.com/python/cpython/issues/103533\n\n(70) https://github.com/python/cpython/issues/103525\n\n(71) https://github.com/python/cpython/issues/103489\n\n(72) https://github.com/python/cpython/issues/103365\n\n(73) https://github.com/python/cpython/issues/103472\n\n(74) https://github.com/python/cpython/issues/103462\n\n(75) https://github.com/python/cpython/issues/103449\n\n(76) https://github.com/python/cpython/issues/103092\n\n(77) https://peps.python.org/pep-0687/\n\n(78) https://github.com/python/cpython/issues/103357\n\n(79) https://github.com/python/cpython/issues/103092\n\n(80) https://peps.python.org/pep-0687/\n\n(81) https://github.com/python/cpython/issues/74690\n\n(82) https://github.com/python/cpython/issues/74690\n\n(83) https://github.com/python/cpython/issues/103256\n\n(84) https://github.com/python/cpython/issues/102778\n\n(85) https://github.com/python/cpython/issues/103285\n\n(86) https://github.com/python/cpython/issues/103225\n\n(87) https://github.com/python/cpython/issues/103092\n\n(88) https://peps.python.org/pep-0687/\n\n(89) https://github.com/python/cpython/issues/103092\n\n(90) https://peps.python.org/pep-0687/\n\n(91) https://github.com/python/cpython/issues/93910\n\n(92) https://github.com/python/cpython/issues/102978\n\n(93) https://github.com/python/cpython/issues/103092\n\n(94) https://peps.python.org/pep-0687/\n\n(95) https://github.com/python/cpython/issues/100479\n\n(96) https://github.com/python/cpython/issues/103220\n\n(97) https://github.com/python/cpython/issues/103204\n\n(98) https://github.com/python/cpython/issues/75586\n\n(99) https://github.com/python/cpython/issues/103193\n\n(100) https://github.com/python/cpython/issues/103176\n\n(101) https://github.com/python/cpython/issues/103143\n\n(102) https://github.com/python/cpython/issues/103015\n\n(103) https://github.com/python/cpython/issues/103000\n\n(104) https://github.com/python/cpython/issues/102953\n\n(105) https://github.com/python/cpython/issues/97696\n\n(106) https://github.com/python/cpython/issues/81079\n\n(107) https://github.com/python/cpython/issues/101819\n\n(108) https://peps.python.org/pep-0687/\n\n(109) https://github.com/python/cpython/issues/91896\n\n(110) https://github.com/python/cpython/issues/101362\n\n(111) https://github.com/python/cpython/issues/102114\n\n(112) https://github.com/python/cpython/issues/62432\n\n(113) https://github.com/python/cpython/issues/78079\n\n(114) https://github.com/python/cpython/issues/85984\n\n(115) https://github.com/python/cpython/issues/101688\n\n(116) https://github.com/python/cpython/issues/101640\n\n(117) https://github.com/python/cpython/issues/83861\n\n(118) https://github.com/python/cpython/issues/89550\n\n(119) https://github.com/python/cpython/issues/95299\n\n(120) https://github.com/python/cpython/issues/99353\n\n(121) https://github.com/python/cpython/issues/98040\n\n(122) https://github.com/python/cpython/issues/97850\n\n(123) https://github.com/python/cpython/issues/94473\n\n(124) https://github.com/python/cpython/issues/98040\n\n(125) https://github.com/python/cpython/issues/96522\n\n(126) https://github.com/python/cpython/issues/96534\n\n(127) https://github.com/python/cpython/issues/87474\n\n(128) https://github.com/python/cpython/issues/94906\n\n(129) https://github.com/python/cpython/issues/51574\n\n(130) https://github.com/python/cpython/issues/94518\n\n(131) https://github.com/python/cpython/issues/92184\n\n(132) https://bugs.python.org/issue?@action=redirect&bpo=46797\n\n(133) https://bugs.python.org/issue?@action=redirect&bpo=44844\n\n(134) https://bugs.python.org/issue?@action=redirect&bpo=45606\n\n(135) https://bugs.python.org/issue?@action=redirect&bpo=23041\n\n(136) https://bugs.python.org/issue?@action=redirect&bpo=24964\n\n(137) https://bugs.python.org/issue?@action=redirect&bpo=17258\n\n(138) https://bugs.python.org/issue?@action=redirect&bpo=39744\n\n(139) https://bugs.python.org/issue?@action=redirect&bpo=22708\n\nFile: python3.12.info,  Node: Documentation<11>,  Next: Tests<9>,  Prev: Library<11>,  Up: Python 3 12 0 beta 1\n\n1.22.11.4 Documentation\n.......................\n\n- gh-67056(1): Document that the effect of registering or\nunregistering an *note atexit: a. cleanup function from within a\nregistered cleanup function is undefined.\n\n- gh-103629(2): Mention the new way of typing 'kwargs' with\n'Unpack' and 'TypedDict' introduced in PEP 692(3).\n\n- gh-48241(4): Clarifying documentation about the url parameter to\nurllib.request.urlopen and urllib.request.Request needing to be\nencoded properly.\n\n- gh-86094(5): Add support for Unicode Path Extra Field in ZipFile.\nPatch by Yeojin Kim and Andrea Giudiceandrea\n\n- gh-99202(6): Fix extension type from documentation for compiling in\nC++20 mode\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/67056\n\n(2) https://github.com/python/cpython/issues/103629\n\n(3) https://peps.python.org/pep-0692/\n\n(4) https://github.com/python/cpython/issues/48241\n\n(5) https://github.com/python/cpython/issues/86094\n\n(6) https://github.com/python/cpython/issues/99202\n\nFile: python3.12.info,  Node: Tests<9>,  Next: Build<9>,  Prev: Documentation<11>,  Up: Python 3 12 0 beta 1\n\n1.22.11.5 Tests\n...............\n\n- gh-104494(1): Update 'testpackconfigurein' and\n'testplaceconfigurein' for changes to error message formatting\nin Tk 8.7.\n\n- gh-104461(2): Run testconfigurescreen on X11 only, since the\n'DISPLAY' environment variable and '-screen' option for toplevels\nare not useful on Tk for Win32 or Aqua.\n\n- gh-86275(3): Added property-based tests to the *note zoneinfo: 12e.\ntests, along with stubs for the 'hypothesis' interface.  (Patch by\nPaul Ganssle)\n\n- gh-103329(4): Regression tests for the behaviour of\n'unittest.mock.PropertyMock' were added.\n\n- gh-102795(5): fix use of poll in testepoll's testcontrolandwait\n\n- gh-75729(6): Fix the *note os.spawn*: 1479. tests failing on\nWindows when the working directory or interpreter path contains\nspaces.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/104494\n\n(2) https://github.com/python/cpython/issues/104461\n\n(3) https://github.com/python/cpython/issues/86275\n\n(4) https://github.com/python/cpython/issues/103329\n\n(5) https://github.com/python/cpython/issues/102795\n\n(6) https://github.com/python/cpython/issues/75729\n\nFile: python3.12.info,  Node: Build<9>,  Next: Windows<9>,  Prev: Tests<9>,  Up: Python 3 12 0 beta 1\n\n1.22.11.6 Build\n...............\n\n- gh-101282(1): BOLT optimization is now applied to the libpython\nshared library if building a shared library.  BOLT instrumentation\nand application settings can now be influenced via the\n'BOLTINSTRUMENTFLAGS' and 'BOLTAPPLYFLAGS' configure variables.\n\n- gh-99017(2): 'PYTHONFORREGEN' now require Python 3.10 or newer.\n\n- gh-104490(3): Define '.PHONY' / virtual make targets consistently\nand properly.\n\n- gh-104106(4): Add gcc fallback of mkfifoat/mknodat for macOS. Patch\nby Donghee Na.\n\n- gh-103532(5): The 'TKINTERPROTECTLOADTK' macro is no longer\ndefined or used in the 'tkinter' module.  It was previously only\ndefined when building against Tk 8.4.13 and older, but Tk older\nthan 8.5.12 has been unsupported since gh-91152(6).\n\n- gh-99069(7): Extended workaround defining 'staticassert' when\nmissing from the libc headers to all clang and gcc builds.  In\nparticular, this fixes building on macOS <= 10.10.\n\n- gh-100220(8): Changed the default value of the 'SHELL' Makefile\nvariable from '/bin/sh' to '/bin/sh -e' to ensure that complex\nrecipes correctly fail after an error.  Previously, 'make install'\ncould fail to install some files and yet return a successful\nresult.\n\n- gh-90656(9): Add platform triplets for 64-bit LoongArch:\n\n* loongarch64-linux-gnusf\n\n* loongarch64-linux-gnuf32\n\n* loongarch64-linux-gnu\n\nPatch by Zhang Na.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/101282\n\n(2) https://github.com/python/cpython/issues/99017\n\n(3) https://github.com/python/cpython/issues/104490\n\n(4) https://github.com/python/cpython/issues/104106\n\n(5) https://github.com/python/cpython/issues/103532\n\n(6) https://github.com/python/cpython/issues/91152\n\n(7) https://github.com/python/cpython/issues/99069\n\n(8) https://github.com/python/cpython/issues/100220\n\n(9) https://github.com/python/cpython/issues/90656\n\nFile: python3.12.info,  Node: Windows<9>,  Next: macOS<7>,  Prev: Build<9>,  Up: Python 3 12 0 beta 1\n\n1.22.11.7 Windows\n.................\n\n- gh-104623(1): Update Windows installer to use SQLite 3.42.0.\n\n- gh-82814(2): Fix a potential '[Errno 13] Permission denied' when\nusing *note shutil.copystat(): fa0. within Windows Subsystem for\nLinux (WSL) on a mounted filesystem by adding 'errno.EACCES' to the\nlist of ignored errors within the internal implementation.\n\n- gh-103088(3): Fix virtual environment 'activate' script having\nincorrect line endings for Cygwin.\n\n- gh-103088(4): Fixes venvs not working in bash on Windows across\ndifferent disks\n\n- gh-102997(5): Update Windows installer to use SQLite 3.41.2.\n\n- gh-88013(6): Fixed a bug where *note TypeError: 28e. was raised\nwhen calling 'ntpath.realpath()' with a bytes parameter in some\ncases.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/104623\n\n(2) https://github.com/python/cpython/issues/82814\n\n(3) https://github.com/python/cpython/issues/103088\n\n(4) https://github.com/python/cpython/issues/103088\n\n(5) https://github.com/python/cpython/issues/102997\n\n(6) https://github.com/python/cpython/issues/88013\n\nFile: python3.12.info,  Node: macOS<7>,  Next: IDLE<7>,  Prev: Windows<9>,  Up: Python 3 12 0 beta 1\n\n1.22.11.8 macOS\n...............\n\n- gh-99834(1): Update macOS installer to Tcl/Tk 8.6.13.\n\n- gh-104623(2): Update macOS installer to SQLite 3.42.0.\n\n- gh-103545(3): Add 'os.PRIODARWINTHREAD',\n'os.PRIODARWINPROCESS', 'os.PRIODARWINBG' and\n'os.PRIODARWINNONUI'.  These can be used with 'os.setpriority' to\nrun the process at a lower priority and make use of the efficiency\ncores on Apple Silicon systems.\n\n- gh-104180(4): Support reading SOCKS proxy configuration from macOS\nSystem Configuration.  Patch by Sam Schott.\n\n- gh-60436(5): update curses textbox to additionally handle backspace\nusing the 'curses.ascii.DEL' key press.\n\n- gh-102997(6): Update macOS installer to SQLite 3.41.2.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/99834\n\n(2) https://github.com/python/cpython/issues/104623\n\n(3) https://github.com/python/cpython/issues/103545\n\n(4) https://github.com/python/cpython/issues/104180\n\n(5) https://github.com/python/cpython/issues/60436\n\n(6) https://github.com/python/cpython/issues/102997\n\nFile: python3.12.info,  Node: IDLE<7>,  Next: Tools/Demos<7>,  Prev: macOS<7>,  Up: Python 3 12 0 beta 1\n\n1.22.11.9 IDLE\n..............\n\n- gh-104499(1): Fix completions for Tk Aqua 8.7 (currently blank).\n\n- gh-104496(2): About prints both tcl and tk versions if different\n(expected someday).\n\n- gh-88496(3): Fix IDLE test hang on macOS.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/104499\n\n(2) https://github.com/python/cpython/issues/104496\n\n(3) https://github.com/python/cpython/issues/88496\n\nFile: python3.12.info,  Node: Tools/Demos<7>,  Next: C API<8>,  Prev: IDLE<7>,  Up: Python 3 12 0 beta 1\n\n1.22.11.10 Tools/Demos\n......................\n\n- gh-104389(1): Argument Clinic C converters now accept the 'unused'\nkeyword, for wrapping a parameter with *note PyUNUSED: 147f.\nPatch by Erlend E. Aasland.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/104389\n\nFile: python3.12.info,  Node: C API<8>,  Prev: Tools/Demos<7>,  Up: Python 3 12 0 beta 1\n\n1.22.11.11 C API\n................\n\n- gh-101291(1): Added unstable C API for extracting the value of\n\"compact\" integers: *note PyUnstableLongIsCompact(): 2eb. and\n*note PyUnstableLongCompactValue(): 2ec.\n\n- gh-104109(2): We've added 'PyNewInterpreterFromConfig()' and\n'PyInterpreterConfig' to the public C-API (but not the stable ABI;\nnot yet at least).  The new function may be used to create a new\ninterpreter with various features configured.  The function was\nadded to support PEP 684 (per-interpreter GIL).\n\n- gh-103968(3): *note PyTypeFromSpec(): 2df. and its variants now\nallow creating classes whose metaclass overrides *note tpnew: 2e1.\nThe 'tpnew' is ignored.  This behavior is deprecated and will be\ndisallowed in 3.14+.  The new *note PyTypeFromMetaclass(): 2a9.\nalready disallows it.\n\n- gh-103743(4): Add *note PyUnstableObjectGCNewWithExtraData():\n1481. function that can be used to allocate additional memory after\nan object for data not managed by Python.\n\n- gh-103295(5): Introduced *note PyUnstableWritePerfMapEntry():\n1482, *note PyUnstablePerfMapStateInit(): 1483. and *note\nPyUnstablePerfMapStateFini(): 1484.  These allow extension\nmodules (JIT compilers in particular) to write to perf-map files in\na thread safe manner.  The *note Python support for the Linux perf\nprofiler: 1485. also uses these APIs to write entries in the\nperf-map file.\n\n- gh-103509(6): Added C API for extending types whose instance memory\nlayout is opaque: *note PyTypeSpec.basicsize: 2a0. can now be zero\nor negative, *note PyObjectGetTypeData(): 2a1. can be used to get\nsubclass-specific data, and *note PyTPFLAGSITEMSATEND: 2a3. can\nbe used to safely extend variable-size objects.  See PEP 697(7) for\ndetails.\n\n- gh-103091(8): Add a new C-API function to eagerly assign a version\ntag to a PyTypeObject: 'PyUnstableTypeAssignVersionTag()'.\n\n- gh-101408(9): *note PyObjectGCResize: 1486. should calculate\npreheader size if needed.  Patch by Donghee Na.\n\n- gh-98836(10): Add support of more formatting options (left\naligning, octals, uppercase hexadecimals, 'intmaxt', 'ptrdifft',\n'wchart' C strings, variable width and precision) in *note\nPyUnicodeFromFormat(): 2d5. and *note PyUnicodeFromFormatV():\n2d6.\n\n- gh-96803(11): Add unstable C-API functions to get the code object,\nlasti and line number from the internal 'PyInterpreterFrame' in\nthe limited API. The functions are:\n\n* 'PyCodeObject * PyUnstableInterpreterFrameGetCode(struct\nPyInterpreterFrame *frame)'\n\n* 'int PyUnstableInterpreterFrameGetLasti(struct\nPyInterpreterFrame *frame)'\n\n* 'int PyUnstableInterpreterFrameGetLine(struct\nPyInterpreterFrame *frame)'\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/101291\n\n(2) https://github.com/python/cpython/issues/104109\n\n(3) https://github.com/python/cpython/issues/103968\n\n(4) https://github.com/python/cpython/issues/103743\n\n(5) https://github.com/python/cpython/issues/103295\n\n(6) https://github.com/python/cpython/issues/103509\n\n(7) https://peps.python.org/pep-0697/\n\n(8) https://github.com/python/cpython/issues/103091\n\n(9) https://github.com/python/cpython/issues/101408\n\n(10) https://github.com/python/cpython/issues/98836\n\n(11) https://github.com/python/cpython/issues/96803\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 12 0 alpha 7,  Next: Python 3 12 0 alpha 6,  Prev: Python 3 12 0 beta 1,  Up: Changelog": {
            "content": "'Release date: 2023-04-04'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<12>.\n* Library: Library<12>.\n* Documentation: Documentation<12>.\n* Tests: Tests<10>.\n* Build: Build<10>.\n* Windows: Windows<10>.\n* Tools/Demos: Tools/Demos<8>.\n* C API: C API<9>.\n\nFile: python3.12.info,  Node: Core and Builtins<12>,  Next: Library<12>,  Up: Python 3 12 0 alpha 7\n\n1.22.12.1 Core and Builtins\n...........................\n\n- gh-102192(1): Deprecated 'PyErrChainExceptions' in favour of\n'PyErrChainExceptions1'.\n\n- gh-89987(2): Reduce the number of inline *note CACHE: 4cc. entries\nfor *note BINARYSUBSCR: 1489.\n\n- gh-102859(3): Removed 'JUMPIFFALSEORPOP' and\n'JUMPIFTRUEORPOP' instructions.\n\n- gh-101975(4): Fixed 'stacktop' value on tracing entries to avoid\ncorruption on garbage collection.\n\n- gh-102778(5): Add *note sys.lastexc: 1e2. and deprecate *note\nsys.lasttype: 1e3, *note sys.lastvalue: 1e4. and *note\nsys.lasttraceback: 1e5, which hold the same information in its\nlegacy form.\n\n- gh-100982(6): Replace all occurrences of 'COMPAREANDBRANCH' with\n*note COMPAREOP: 78b.\n\n- gh-102701(7): Fix overflow when creating very large dict.\n\n- gh-102755(8): Add *note PyErrDisplayException(): 2cc. which takes\njust an exception instance, to replace the legacy 'PyErrDisplay()'\nwhich takes the '(typ, exc, tb)' triplet.\n\n- gh-102594(9): Add note to exception raised in 'PyErrSetObject'\nwhen normalization fails.\n\n- gh-90997(10): Shrink the number of inline *note CACHE: 4cc. entries\nused by *note LOADGLOBAL: 148a.\n\n- gh-102491(11): Improve import time of 'platform' by removing\nIronPython version parsing.  The IronPython version parsing was not\nfunctional (see\n'https://github.com/IronLanguages/ironpython3/issues/1667').\n\n- gh-101291(12): Rearrage bits in first field (after header) of\nPyLongObject.  * Bits 0 and 1: 1 - sign.  I.e.  0 for positive\nnumbers, 1 for zero and 2 for negative numbers.  * Bit 2 reserved\n(probably for the immortal bit) * Bits 3+ the unsigned size.\n\nThis makes a few operations slightly more efficient, and will\nenable a more compact and faster 2s-complement representation of\nmost ints in future.\n\n- gh-102397(13): Fix segfault from race condition in signal handling\nduring garbage collection.  Patch by Kumar Aditya.\n\n- gh-102406(14): *note codecs: 19. encoding/decoding errors now get\nthe context information (which operation and which codecs) attached\nas PEP 678(15) notes instead of through chaining a new instance of\nthe exception.\n\n- gh-102281(16): Fix potential nullptr dereference and use of\nuninitialized memory in fileutils.  Patch by Max Bachmann.\n\n- gh-102300(17): Reuse operands with refcount of 1 in float\nspecializations of BINARYOP.\n\n- gh-102213(18): Fix performance loss when accessing an object's\nattributes with 'getattr' defined.\n\n- gh-102255(19): Improve build support for the Xbox.  Patch by Max\nBachmann.\n\n- gh-102027(20): Fix SSE2 and SSE3 detection in 'blake2' internal\nmodule.  Patch by Max Bachmann.\n\n- gh-101865(21): Deprecate 'colnotab' in code objects, schedule it\nfor removal in Python 3.14\n\n- bpo-1635741(22): Adapt 'pickle' to PEP 687(23).  Patch by Mohamed\nKoubaa and Erlend Aasland.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/102192\n\n(2) https://github.com/python/cpython/issues/89987\n\n(3) https://github.com/python/cpython/issues/102859\n\n(4) https://github.com/python/cpython/issues/101975\n\n(5) https://github.com/python/cpython/issues/102778\n\n(6) https://github.com/python/cpython/issues/100982\n\n(7) https://github.com/python/cpython/issues/102701\n\n(8) https://github.com/python/cpython/issues/102755\n\n(9) https://github.com/python/cpython/issues/102594\n\n(10) https://github.com/python/cpython/issues/90997\n\n(11) https://github.com/python/cpython/issues/102491\n\n(12) https://github.com/python/cpython/issues/101291\n\n(13) https://github.com/python/cpython/issues/102397\n\n(14) https://github.com/python/cpython/issues/102406\n\n(15) https://peps.python.org/pep-0678/\n\n(16) https://github.com/python/cpython/issues/102281\n\n(17) https://github.com/python/cpython/issues/102300\n\n(18) https://github.com/python/cpython/issues/102213\n\n(19) https://github.com/python/cpython/issues/102255\n\n(20) https://github.com/python/cpython/issues/102027\n\n(21) https://github.com/python/cpython/issues/101865\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(23) https://peps.python.org/pep-0687/\n\nFile: python3.12.info,  Node: Library<12>,  Next: Documentation<12>,  Prev: Core and Builtins<12>,  Up: Python 3 12 0 alpha 7\n\n1.22.12.2 Library\n.................\n\n- gh-103085(1): Pure python *note locale.getencoding(): 41f. will not\nwarn deprecation.\n\n- gh-103068(2): It's no longer possible to register conditional\nbreakpoints in *note Pdb: 740. that raise *note SyntaxError: 146.\nPatch by Tian Gao.\n\n- gh-102549(3): Don't ignore exceptions in member type creation.\n\n- gh-103056(4): Ensure final 'generatenextvalue' is a\n'staticmethod'.\n\n- gh-103046(5): Display current line label correctly in *note dis:\n35. when 'showcaches' is False and 'lasti' points to a CACHE\nentry.\n\n- gh-102433(6): *note isinstance(): 14b. checks against *note\nruntime-checkable protocols: 14c. now use *note\ninspect.getattrstatic(): 1b2. rather than *note hasattr(): 1f7. to\nlookup whether attributes exist.  This means that descriptors and\n*note getattr(): 1f8. methods are no longer unexpectedly\nevaluated during 'isinstance()' checks against runtime-checkable\nprotocols.  However, it may also mean that some objects which used\nto be considered instances of a runtime-checkable protocol may no\nlonger be considered instances of that protocol on Python 3.12+,\nand vice versa.  Most users are unlikely to be affected by this\nchange.  Patch by Alex Waygood.\n\n- gh-103023(7): It's no longer possible to register expressions to\ndisplay in *note Pdb: 740. that raise *note SyntaxError: 146.\nPatch by Tian Gao.\n\n- gh-102947(8): Improve traceback when *note dataclasses.fields():\n148c. is called on a non-dataclass.  Patch by Alex Waygood\n\n- gh-102780(9): The *note asyncio.Timeout: 13ef. context manager now\nworks reliably even when performing cleanup due to task\ncancellation.  Previously it could raise a *note CancelledError:\n7fe. instead of an *note TimeoutError: 148d. in such cases.\n\n- gh-102871(10): Remove support for obsolete browsers from *note\nwebbrowser: 110.  Removed browsers include Grail, Mosaic, Netscape,\nGaleon, Skipstone, Iceape, Firebird, and Firefox versions 35 and\nbelow.\n\n- gh-102839(11): Improve performance of *note math.log(): 1317.\narguments handling by removing the argument clinic.\n\n- gh-102828(12): Add the 'onexc' arg to *note shutil.rmtree(): 1d5,\nwhich is like 'onerror' but expects an exception instance rather\nthan an excinfo tuple.  Deprecate 'onerror'.\n\n- gh-88965(13): typing: Fix a bug relating to substitution in custom\nclasses generic over a *note ParamSpec: 163.  Previously, if the\n'ParamSpec' was substituted with a parameters list that itself\ncontained a *note TypeVar: 164, the 'TypeVar' in the parameters\nlist could not be subsequently substituted.  This is now fixed.\n\nPatch by Nikita Sobolev.\n\n- gh-76846(14): Fix issue where 'new()' and 'init()' methods\nof *note pathlib.PurePath: 1c5. and *note Path: 149. subclasses\nwere not called in some circumstances.\n\n- gh-78530(15): *note asyncio.wait(): 19a. now accepts generators\nyielding tasks.  Patch by Kumar Aditya.\n\n- gh-102748(16): *note asyncio.iscoroutine(): 199. now returns\n'False' for generators as *note asyncio: 9. does not support legacy\ngenerator-based coroutines.  Patch by Kumar Aditya.\n\n- gh-102670(17): Optimized fmean(), correlation(), covariance(), and\nlinearregression() using the new math.sumprod() function.\n\n- gh-102615(18): Typing: Improve the 'repr' of generic aliases for\nclasses generic over a *note ParamSpec: 163.  (Use square brackets\nto represent a parameter list.)\n\n- gh-100112(19): *note asyncio.Task.getcoro(): 801. now always\nreturns a coroutine when wrapping an awaitable object.  Patch by\nKumar Aditya.\n\n- gh-102578(20): Speed up setting or deleting mutable attributes on\nnon-dataclass subclasses of frozen dataclasses.  Due to the\nimplementation of 'setattr' and 'delattr' for frozen\ndataclasses, this previously had a time complexity of 'O'('n').  It\nnow has a time complexity of 'O'(1).\n\n- gh-102519(21): Add *note os.listdrives(): 1bc, *note\nos.listvolumes(): 1bd. and *note os.listmounts(): 1be. functions on\nWindows for enumerating drives, volumes and mount points\n\n- gh-74468(22): Attribute name of the extracted *note tarfile: d8.\nfile object now holds filename of itself rather than of the archive\nit is contained in.  Patch by Oleg Iarygin.\n\n- gh-102378(23): Private helper method\n'inspect.signaturestripnonpythonsyntax' will no longer strip\n'/' from the input string.\n\n- gh-79940(24): Add *note inspect.getasyncgenstate(): 1b0. and *note\ninspect.getasyncgenlocals(): 1b1.  Patch by Thomas Krennwallner.\n\n- gh-102103(25): Add 'module' argument to *note\ndataclasses.makedataclass(): 148e. and make classes produced by it\npickleable.\n\n- gh-102069(26): Fix 'weakref' descriptor generation for custom\ndataclasses.\n\n- gh-102038(27): Skip a 'stat' in *note site: c2. if we have already\nfound a 'pyvenv.cfg'\n\n- gh-98886(28): Fix issues when defining dataclasses that have fields\nwith specific underscore names that aren't clearly reserved by\n*note dataclasses: 2d.\n\n- gh-101673(29): Fix a *note pdb: a0. bug where 'll' clears the\nchanges to local variables.\n\n- gh-101313(30): Added -h and -help arguments to the webbrowser CLI\n\n- gh-100372(31): *note ssl.SSLContext.loadverifylocations(): d52.\nno longer incorrectly accepts some cases of trailing data when\nparsing DER.\n\n- gh-89727(32): Fix pathlib.Path.walk RecursionError on deep\ndirectory trees by rewriting it using iteration instead of\nrecursion.\n\n- gh-100131(33): Added an optional 'delete' keyword argument to *note\ntempfile.TemporaryDirectory: 10aa.\n\n- gh-48330(34): Added '--durations' command line option, showing the\nN slowest test cases.  *note unittest.TextTestRunner: 148f. and\n*note unittest.TextTestResult: 286. constructors accept a new\n'durations' keyword argument.  Subclasses should take this into\naccount or accept 'kwargs'.  Added *note\nunittest.TestResult.addDuration(): 1490. method and *note\nunittest.TestResult.collectedDurations: 1431. attribute.\n\n(Contributed by Giampaolo Rodola)\n\n- gh-98169(35): Fix *note dataclasses.astuple(): 1475. crash when\n*note collections.defaultdict: 1031. is present in the attributes.\n\n- gh-96931(36): Fix incorrect results from *note\nssl.SSLSocket.sharedciphers(): ccf.\n\n- gh-95495(37): When built against OpenSSL 3.0, the *note ssl: ca.\nmodule had a bug where it reported unauthenticated EOFs (i.e.\nwithout closenotify) as a clean TLS-level EOF. It now raises *note\nSSLEOFError: 1491, matching the behavior in previous versions of\nOpenSSL. The *note options: 62d. attribute on *note SSLContext:\n278. also no longer includes *note OPIGNOREUNEXPECTEDEOF: 62c.\nby default.  This option may be set to specify the previous OpenSSL\n3.0 behavior.\n\n- gh-94684(38): Now *note uuid.uuid3(): 1492. and *note uuid.uuid5():\n1493. functions support *note bytes: 295. objects as their 'name'\nargument.\n\n- gh-94440(39): Fix a 'concurrent.futures.process' bug where\n'ProcessPoolExecutor' shutdown could hang after a future has been\nquickly submitted and canceled.\n\n- gh-72346(40): Added deprecation warning to 'isdst' parameter of\n*note email.utils.localtime(): 228.\n\n- bpo-36305(41): Fix handling of Windows filenames that resemble\ndrives, such as './a:b', in *note pathlib: 9f.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/103085\n\n(2) https://github.com/python/cpython/issues/103068\n\n(3) https://github.com/python/cpython/issues/102549\n\n(4) https://github.com/python/cpython/issues/103056\n\n(5) https://github.com/python/cpython/issues/103046\n\n(6) https://github.com/python/cpython/issues/102433\n\n(7) https://github.com/python/cpython/issues/103023\n\n(8) https://github.com/python/cpython/issues/102947\n\n(9) https://github.com/python/cpython/issues/102780\n\n(10) https://github.com/python/cpython/issues/102871\n\n(11) https://github.com/python/cpython/issues/102839\n\n(12) https://github.com/python/cpython/issues/102828\n\n(13) https://github.com/python/cpython/issues/88965\n\n(14) https://github.com/python/cpython/issues/76846\n\n(15) https://github.com/python/cpython/issues/78530\n\n(16) https://github.com/python/cpython/issues/102748\n\n(17) https://github.com/python/cpython/issues/102670\n\n(18) https://github.com/python/cpython/issues/102615\n\n(19) https://github.com/python/cpython/issues/100112\n\n(20) https://github.com/python/cpython/issues/102578\n\n(21) https://github.com/python/cpython/issues/102519\n\n(22) https://github.com/python/cpython/issues/74468\n\n(23) https://github.com/python/cpython/issues/102378\n\n(24) https://github.com/python/cpython/issues/79940\n\n(25) https://github.com/python/cpython/issues/102103\n\n(26) https://github.com/python/cpython/issues/102069\n\n(27) https://github.com/python/cpython/issues/102038\n\n(28) https://github.com/python/cpython/issues/98886\n\n(29) https://github.com/python/cpython/issues/101673\n\n(30) https://github.com/python/cpython/issues/101313\n\n(31) https://github.com/python/cpython/issues/100372\n\n(32) https://github.com/python/cpython/issues/89727\n\n(33) https://github.com/python/cpython/issues/100131\n\n(34) https://github.com/python/cpython/issues/48330\n\n(35) https://github.com/python/cpython/issues/98169\n\n(36) https://github.com/python/cpython/issues/96931\n\n(37) https://github.com/python/cpython/issues/95495\n\n(38) https://github.com/python/cpython/issues/94684\n\n(39) https://github.com/python/cpython/issues/94440\n\n(40) https://github.com/python/cpython/issues/72346\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=36305\n\nFile: python3.12.info,  Node: Documentation<12>,  Next: Tests<10>,  Prev: Library<12>,  Up: Python 3 12 0 alpha 7\n\n1.22.12.3 Documentation\n.......................\n\n- gh-103112(1): Add docstring to *note\nhttp.client.HTTPResponse.read(): 1495. to fix 'pydoc' output.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/103112\n\nFile: python3.12.info,  Node: Tests<10>,  Next: Build<10>,  Prev: Documentation<12>,  Up: Python 3 12 0 alpha 7\n\n1.22.12.4 Tests\n...............\n\n- gh-102980(1): Improve test coverage on *note pdb: a0.\n\n- gh-102537(2): Adjust the error handling strategy in\n'testzoneinfo.TzPathTest.pythontzpathcontext'.  Patch by Paul\nGanssle.\n\n- gh-101377(3): Improved testlocalecalendarformatweekday of\ncalendar.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/102980\n\n(2) https://github.com/python/cpython/issues/102537\n\n(3) https://github.com/python/cpython/issues/101377\n\nFile: python3.12.info,  Node: Build<10>,  Next: Windows<10>,  Prev: Tests<10>,  Up: Python 3 12 0 alpha 7\n\n1.22.12.5 Build\n...............\n\n- gh-102973(1): Add a dev container (along with accompanying\nDockerfile) for development purposes.\n\n- gh-102711(2): Fix '-Wstrict-prototypes' compiler warnings.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/102973\n\n(2) https://github.com/python/cpython/issues/102711\n\nFile: python3.12.info,  Node: Windows<10>,  Next: Tools/Demos<8>,  Prev: Build<10>,  Up: Python 3 12 0 alpha 7\n\n1.22.12.6 Windows\n.................\n\n- gh-102690(1): Update *note webbrowser: 110. to fall back to\nMicrosoft Edge instead of Internet Explorer.\n\n- gh-99726(2): Improves correctness of stat results for Windows, and\nuses faster API when available\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/102690\n\n(2) https://github.com/python/cpython/issues/99726\n\nFile: python3.12.info,  Node: Tools/Demos<8>,  Next: C API<9>,  Prev: Windows<10>,  Up: Python 3 12 0 alpha 7\n\n1.22.12.7 Tools/Demos\n.....................\n\n- gh-102809(1): 'Misc/gdbinit' was removed.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/102809\n\nFile: python3.12.info,  Node: C API<9>,  Prev: Tools/Demos<8>,  Up: Python 3 12 0 alpha 7\n\n1.22.12.8 C API\n...............\n\n- gh-102013(1): Add a new (unstable) C-API function for iterating\nover GC'able objects using a callback: 'PyUnstableVisitObjects'.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/102013\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 12 0 alpha 6,  Next: Python 3 12 0 alpha 5,  Prev: Python 3 12 0 alpha 7,  Up: Changelog": {
            "content": "'Release date: 2023-03-07'\n\n* Menu:\n\n* Security: Security<8>.\n* Core and Builtins: Core and Builtins<13>.\n* Library: Library<13>.\n* Documentation: Documentation<13>.\n* Tests: Tests<11>.\n* Build: Build<11>.\n* Windows: Windows<11>.\n* macOS: macOS<8>.\n* C API: C API<10>.\n\nFile: python3.12.info,  Node: Security<8>,  Next: Core and Builtins<13>,  Up: Python 3 12 0 alpha 6\n\n1.22.13.1 Security\n..................\n\n- gh-99108(1): Replace builtin hashlib implementations of MD5 and\nSHA1 with verified ones from the HACL* project.\n\n- gh-101727(2): Updated the OpenSSL version used in Windows and macOS\nbinary release builds to 1.1.1t to address CVE-2023-0286,\nCVE-2022-4303, and CVE-2022-4303 per the OpenSSL 2023-02-07\nsecurity advisory(3).\n\n- gh-99108(4): Replace the builtin *note hashlib: 63. implementations\nof SHA2-384 and SHA2-512 originally from LibTomCrypt with formally\nverified, side-channel resistant code from the HACL*(5) project.\nThe builtins remain a fallback only used when OpenSSL does not\nprovide them.\n\n- gh-101283(6): *note subprocess.Popen: 8c3. now uses a safer\napproach to find 'cmd.exe' when launching with 'shell=True'.  Patch\nby Eryk Sun, based on a patch by Oleg Iarygin.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/99108\n\n(2) https://github.com/python/cpython/issues/101727\n\n(3) https://www.openssl.org/news/secadv/20230207.txt\n\n(4) https://github.com/python/cpython/issues/99108\n\n(5) https://github.com/hacl-star/hacl-star/\n\n(6) https://github.com/python/cpython/issues/101283\n\nFile: python3.12.info,  Node: Core and Builtins<13>,  Next: Library<13>,  Prev: Security<8>,  Up: Python 3 12 0 alpha 6\n\n1.22.13.2 Core and Builtins\n...........................\n\n- gh-102493(1): Fix regression in semantics of normalisation in\n'PyErrSetObject'.\n\n- gh-102416(2): Do not memoize incorrectly automatically generated\nloop rules in the parser.  Patch by Pablo Galindo.\n\n- gh-102356(3): Fix a bug that caused a crash when deallocating\ndeeply nested filter objects.  Patch by Marta G??mez Mac??as.\n\n- gh-102336(4): Cleanup Windows 7 specific special handling.  Patch\nby Max Bachmann.\n\n- gh-102250(5): Fixed a segfault occurring when the interpreter calls\na 'bool' method that raises.\n\n- gh-102126(6): Fix deadlock at shutdown when clearing thread states\nif any finalizer tries to acquire the runtime head lock.  Patch by\nKumar Aditya.\n\n- gh-102027(7): Use 'GetCurrentProcessId' on Windows when 'getpid' is\nunavailable.  Patch by Max Bachmann.\n\n- gh-102056(8): Fix error handling bugs in interpreter's exception\nprinting code, which could cause a crash on infinite recursion.\n\n- gh-100982(9): Restrict the scope of the 'FORITERRANGE'\ninstruction to the scope of the original *note FORITER: 149e.\ninstruction, to allow instrumentation.\n\n- gh-101967(10): Fix possible segfault in\n'positionalonlypassedaskeyword' function, when new list\ncreated.\n\n- gh-101952(11): Fix possible segfault in 'BUILDSET' opcode, when\nnew set created.\n\n- gh-74895(12): *note socket.getaddrinfo: 149f. no longer raises\n*note OverflowError: 68d. for *note int: 17e. 'port' values outside\nof the C long range.  Out of range values are left up to the\nunderlying string based C library API to report.  A *note\nsocket.gaierror: 14a0. 'SAISERVICE' may occur instead, or no error\nat all as not all platform C libraries generate an error.\n\n- gh-101799(13): Add *note CALLINTRINSIC2: 20b. and use it instead\nof 'PREPRERAISESTAR'.\n\n- gh-101857(14): Fix xattr support detection on Linux systems by\nwidening the check to linux, not just glibc.  This fixes support\nfor musl.\n\n- gh-84783(15): Make the slice object hashable.  Patch by Will\nBradshaw and Furkan Onder.\n\n- gh-87849(16): Change the 'SEND' instruction to leave the receiver\non the stack.  This allows the specialized form of 'SEND' to skip\nthe chain of C calls and jump directly to the 'RESUME' in the\ngenerator or coroutine.\n\n- gh-101765(17): Fix SystemError / segmentation fault in iter\n'reduce' when internal access of 'builtins.dict' keys\nmutates the iter object.\n\n- gh-101430(18): Update *note tracemalloc: fa. to handle presize of\nobject properly.  Patch by Donghee Na.\n\n- gh-101696(19): Invalidate type version tag in\n'PyStaticTypeDealloc' for static types, avoiding bug where a\nfalse cache hit could crash the interpreter.  Patch by Kumar\nAditya.\n\n- gh-101632(20): Adds a new *note RETURNCONST: 212. instruction.\n\n- gh-100719(21): Remove gicode field from generator (and coroutine\nand async generator) objects as it is redundant.  The frame already\nincludes a reference to the code object.\n\n- gh-98627(22): When an interpreter is configured to check (and only\nthen), importing an extension module will now fail when the\nextension does not support multiple interpreters (i.e.  doesn't\nimplement PEP 489 multi-phase init).  This does not apply to the\nmain interpreter, nor to subinterpreters created with\n'PyNewInterpreter()'.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/102493\n\n(2) https://github.com/python/cpython/issues/102416\n\n(3) https://github.com/python/cpython/issues/102356\n\n(4) https://github.com/python/cpython/issues/102336\n\n(5) https://github.com/python/cpython/issues/102250\n\n(6) https://github.com/python/cpython/issues/102126\n\n(7) https://github.com/python/cpython/issues/102027\n\n(8) https://github.com/python/cpython/issues/102056\n\n(9) https://github.com/python/cpython/issues/100982\n\n(10) https://github.com/python/cpython/issues/101967\n\n(11) https://github.com/python/cpython/issues/101952\n\n(12) https://github.com/python/cpython/issues/74895\n\n(13) https://github.com/python/cpython/issues/101799\n\n(14) https://github.com/python/cpython/issues/101857\n\n(15) https://github.com/python/cpython/issues/84783\n\n(16) https://github.com/python/cpython/issues/87849\n\n(17) https://github.com/python/cpython/issues/101765\n\n(18) https://github.com/python/cpython/issues/101430\n\n(19) https://github.com/python/cpython/issues/101696\n\n(20) https://github.com/python/cpython/issues/101632\n\n(21) https://github.com/python/cpython/issues/100719\n\n(22) https://github.com/python/cpython/issues/98627\n\nFile: python3.12.info,  Node: Library<13>,  Next: Documentation<13>,  Prev: Core and Builtins<13>,  Up: Python 3 12 0 alpha 6\n\n1.22.13.3 Library\n.................\n\n- gh-102302(1): Micro-optimise hashing of *note inspect.Parameter:\nc73, reducing the time it takes to hash an instance by around 40%.\n\n- gh-101979(2): Fix a bug where parentheses in the 'metavar' argument\nto *note argparse.ArgumentParser.addargument(): 14a2. were\ndropped.  Patch by Yeojin Kim.\n\n- gh-91038(3): *note platform.platform(): 14a3. now has boolean\ndefault arguments.\n\n- gh-81652(4): Add *note mmap.MAPALIGNEDSUPER: 14a4. FreeBSD and\n*note mmap.MAPCONCEAL: 14a5. OpenBSD constants to *note mmap: 8b.\nPatch by Yeojin Kim.\n\n- gh-102179(5): Fix *note os.dup2(): 9a2. error message for negative\nfds.\n\n- gh-101961(6): For the binary mode, 'fileinput.hookcompressed()'\ndoesn't set the 'encoding' value even if the value is 'None'.\nPatch by Gihwan Kim.\n\n- gh-101936(7): The default value of 'fp' becomes *note io.BytesIO:\nd08. if *note HTTPError: e51. is initialized without a designated\n'fp' parameter.  Patch by Long Vo.\n\n- gh-101566(8): In zipfile, sync Path with zipp 3.14(9), including\nfix for extractall on the underlying zipfile after being wrapped in\n'Path'.\n\n- gh-97930(10): Apply changes from importlibresources 5.12(11),\nincluding fix for 'MultiplexedPath' to support directories in\nmultiple namespaces (python/importlibresources#265).\n\n- gh-101997(12): Upgrade pip wheel bundled with ensurepip (pip\n23.0.1)\n\n- gh-99108(13): The built-in extension modules for *note hashlib: 63.\nSHA2 algorithms, used when OpenSSL does not provide them, now live\nin a single internal 'sha2' module instead of separate 'sha256'\nand 'sha512' modules.\n\n- gh-101892(14): Callable iterators no longer raise *note\nSystemError: 2d7. when the callable object exhausts the iterator\nbut forgets to either return a sentinel value or raise *note\nStopIteration: a40.\n\n- gh-87634(15): Remove locking behavior from *note\nfunctools.cachedproperty(): 299.\n\n- gh-97786(16): Fix potential undefined behaviour in corner cases of\nfloating-point-to-time conversions.\n\n- gh-101517(17): Fixed bug where *note bdb: d. looks up the source\nline with *note linecache: 80. with a 'lineno=None', which causes\nit to fail with an unhandled exception.\n\n- gh-101773(18): Optimize *note fractions.Fraction: 1a8. for small\ncomponents.  The private argument 'normalize' of the *note\nfractions.Fraction: 1a8. constructor has been removed.\n\n- gh-101693(19): In *note sqlite3.Cursor.execute(): 234, *note\nDeprecationWarning: 179. is now emitted when *note named\nplaceholders: 235. are used together with parameters supplied as a\n*note sequence: 236. instead of as a *note dict: 237.  Starting\nfrom Python 3.14, using named placeholders with parameters supplied\nas a sequence will raise a *note ProgrammingError: 238.  Patch by\nErlend E. Aasland.\n\n- gh-101446(20): Change repr of *note collections.OrderedDict: 39f.\nto use regular dictionary formating instead of pairs of keys and\nvalues.\n\n- gh-101362(21): Speed up *note pathlib.PurePath: 1c5. construction\nby handling arguments more uniformly.  When a *note pathlib.Path:\n149. argument is supplied, we use its string representation rather\nthan joining its parts with *note os.path.join(): 1474.\n\n- gh-101362(22): Speed up *note pathlib.PurePath: 1c5. construction\nby calling *note os.path.join(): 1474. only when two or more\narguments are given.\n\n- gh-101362(23): Speed up *note pathlib.Path: 149. construction by\nrunning the path flavour compatibility check only when pathlib is\nimported.\n\n- gh-85984(24): Refactored the implementation of *note pty.fork():\n14a6. to use *note os.logintty(): 14a7.\n\nA *note DeprecationWarning: 179. is now raised by\n'pty.masteropen()' and 'pty.slaveopen()'.  They were undocumented\nand deprecated long long ago in the docstring in favor of *note\npty.openpty(): 14a8.\n\n- gh-101561(25): Add a new decorator *note typing.override(): 156.\nSee PEP 698(26) for details.  Patch by Steven Troxler.\n\n- gh-63301(27): Set exit code when *note tabnanny: d7. CLI exits on\nerror.\n\n- gh-101360(28): Fix anchor matching in\n'pathlib.PureWindowsPath.match()'.  Path and pattern anchors are\nnow matched with *note fnmatch: 57, just like other path parts.\nThis allows patterns such as '\"*:/Users/*\"' to be matched.\n\n- gh-101277(29): Remove global state from *note itertools: 7b. module\n( PEP 687(30)).  Patches by Erlend E. Aasland.\n\n- gh-100809(31): Fix handling of drive-relative paths (like 'C:' and\n'C:foo') in *note pathlib.Path.absolute(): 146f.  This method now\nuses the OS API to retrieve the correct current working directory\nfor the drive.\n\n- gh-99138(32): Apply PEP 687(33) to *note zoneinfo: 12e.  Patch by\nErlend E. Aasland.\n\n- gh-96764(34): *note asyncio.waitfor(): 3c8. now uses *note\nasyncio.timeout(): 3c7. as its underlying implementation.  Patch by\nKumar Aditya.\n\n- gh-88233(35): Correctly preserve \"extra\" fields in 'zipfile'\nregardless of their ordering relative to a zip64 \"extra.\"\n\n- bpo-23224(36): Fix segfaults when creating *note\nlzma.LZMADecompressor: 14a9. and *note bz2.BZ2Decompressor: 14aa.\nobjects without calling 'init()', and fix leakage of locks and\ninternal buffers when calling the 'init()' methods of *note\nlzma.LZMADecompressor: 14a9, *note lzma.LZMACompressor: 14ab, *note\nbz2.BZ2Compressor: 14ac, and *note bz2.BZ2Decompressor: 14aa.\nobjects multiple times.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/102302\n\n(2) https://github.com/python/cpython/issues/101979\n\n(3) https://github.com/python/cpython/issues/91038\n\n(4) https://github.com/python/cpython/issues/81652\n\n(5) https://github.com/python/cpython/issues/102179\n\n(6) https://github.com/python/cpython/issues/101961\n\n(7) https://github.com/python/cpython/issues/101936\n\n(8) https://github.com/python/cpython/issues/101566\n\n(9) https://zipp.readthedocs.io/en/latest/history.html#v3-14-0\n\n(10) https://github.com/python/cpython/issues/97930\n\n(11)\nhttps://importlib-resources.readthedocs.io/en/latest/history.html#v5-12-0\n\n(12) https://github.com/python/cpython/issues/101997\n\n(13) https://github.com/python/cpython/issues/99108\n\n(14) https://github.com/python/cpython/issues/101892\n\n(15) https://github.com/python/cpython/issues/87634\n\n(16) https://github.com/python/cpython/issues/97786\n\n(17) https://github.com/python/cpython/issues/101517\n\n(18) https://github.com/python/cpython/issues/101773\n\n(19) https://github.com/python/cpython/issues/101693\n\n(20) https://github.com/python/cpython/issues/101446\n\n(21) https://github.com/python/cpython/issues/101362\n\n(22) https://github.com/python/cpython/issues/101362\n\n(23) https://github.com/python/cpython/issues/101362\n\n(24) https://github.com/python/cpython/issues/85984\n\n(25) https://github.com/python/cpython/issues/101561\n\n(26) https://peps.python.org/pep-0698/\n\n(27) https://github.com/python/cpython/issues/63301\n\n(28) https://github.com/python/cpython/issues/101360\n\n(29) https://github.com/python/cpython/issues/101277\n\n(30) https://peps.python.org/pep-0687/\n\n(31) https://github.com/python/cpython/issues/100809\n\n(32) https://github.com/python/cpython/issues/99138\n\n(33) https://peps.python.org/pep-0687/\n\n(34) https://github.com/python/cpython/issues/96764\n\n(35) https://github.com/python/cpython/issues/88233\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=23224\n\nFile: python3.12.info,  Node: Documentation<13>,  Next: Tests<11>,  Prev: Library<13>,  Up: Python 3 12 0 alpha 6\n\n1.22.13.4 Documentation\n.......................\n\n- gh-85417(1): Update *note cmath: 16. documentation to clarify\nbehaviour on branch cuts.\n\n- gh-97725(2): Fix *note asyncio.Task.printstack(): 14ae.\ndescription for 'file=None'.  Patch by Oleg Iarygin.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/85417\n\n(2) https://github.com/python/cpython/issues/97725\n\nFile: python3.12.info,  Node: Tests<11>,  Next: Build<11>,  Prev: Documentation<13>,  Up: Python 3 12 0 alpha 6\n\n1.22.13.5 Tests\n...............\n\n- gh-102019(1): Fix deadlock on shutdown if\n'testcurrent{exception,frames}' fails.  Patch by Jacob Bower.\n\n- gh-85984(2): Utilize new \"winsize\" functions from termios in pty\ntests.\n\n- gh-89792(3): 'testtools' now copies up to 10x less source data to\na temporary directory during the 'freeze' test by ignoring git\nmetadata and other artifacts.  It also limits its python build\nparallelism based on os.cpucount instead of hard coding it as 8\ncores.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/102019\n\n(2) https://github.com/python/cpython/issues/85984\n\n(3) https://github.com/python/cpython/issues/89792\n\nFile: python3.12.info,  Node: Build<11>,  Next: Windows<11>,  Prev: Tests<11>,  Up: Python 3 12 0 alpha 6\n\n1.22.13.6 Build\n...............\n\n- gh-99942(1): On Android, in a static build, python-config in embed\nmode no longer incorrectly reports a library to link to.\n\n- gh-99942(2): On Android, python.pc now correctly reports the\nlibrary to link to, the same as python-config.sh.\n\n- gh-100221(3): Fix creating install directories in 'make\nsharedinstall' if they exist outside 'DESTDIR' already.\n\n- gh-96821(4): Explicitly mark C extension modules that need defined\nsigned integer overflow, and add a configure option *note\n-with-strict-overflow: 14b1.  Patch by Matthias Go\"rgens and\nShantanu Jain.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/99942\n\n(2) https://github.com/python/cpython/issues/99942\n\n(3) https://github.com/python/cpython/issues/100221\n\n(4) https://github.com/python/cpython/issues/96821\n\nFile: python3.12.info,  Node: Windows<11>,  Next: macOS<8>,  Prev: Build<11>,  Up: Python 3 12 0 alpha 6\n\n1.22.13.7 Windows\n.................\n\n- gh-102344(1): Implement 'winreg.QueryValue' using 'QueryValueEx'\nand 'winreg.SetValue' using 'SetValueEx'.  Patch by Max Bachmann.\n\n- gh-101881(2): Handle read and write operations on non-blocking\npipes properly on Windows.\n\n- gh-101881(3): Add support for the os.getblocking() and\nos.setblocking() functions on Windows.\n\n- gh-101849(4): Ensures installer will correctly upgrade existing\n'py.exe' launcher installs.\n\n- gh-101763(5): Updates copy of libffi bundled with Windows installs\nto 3.4.4.\n\n- gh-101759(6): Update Windows installer to SQLite 3.40.1.\n\n- gh-101614(7): Correctly handle extensions built against debug\nbinaries that reference 'python3d.dll'.\n\n- gh-101196(8): The functions 'os.path.isdir', 'os.path.isfile',\n'os.path.islink' and 'os.path.exists' are now 13% to 28% faster on\nWindows, by making fewer Win32 API calls.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/102344\n\n(2) https://github.com/python/cpython/issues/101881\n\n(3) https://github.com/python/cpython/issues/101881\n\n(4) https://github.com/python/cpython/issues/101849\n\n(5) https://github.com/python/cpython/issues/101763\n\n(6) https://github.com/python/cpython/issues/101759\n\n(7) https://github.com/python/cpython/issues/101614\n\n(8) https://github.com/python/cpython/issues/101196\n\nFile: python3.12.info,  Node: macOS<8>,  Next: C API<10>,  Prev: Windows<11>,  Up: Python 3 12 0 alpha 6\n\n1.22.13.8 macOS\n...............\n\n- gh-101759(1): Update macOS installer to SQLite 3.40.1.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/101759\n\nFile: python3.12.info,  Node: C API<10>,  Prev: macOS<8>,  Up: Python 3 12 0 alpha 6\n\n1.22.13.9 C API\n...............\n\n- gh-101907(1): Removes use of non-standard C++ extension in public\nheader files.\n\n- gh-99293(2): Document that the PyTPFLAGSVALIDVERSIONTAG is an\ninternal feature, should not be used, and will be removed.\n\n- gh-101578(3): Add *note PyErrGetRaisedException(): 2c5. and *note\nPyErrSetRaisedException(): 2c6. for saving and restoring the\ncurrent exception.  These functions return and accept a single\nexception object, rather than the triple arguments of the\nnow-deprecated *note PyErrFetch(): 2c7. and *note PyErrRestore():\n2c8.  This is less error prone and a bit more efficient.\n\nAdd *note PyExceptionGetArgs(): 2c9. and *note\nPyExceptionSetArgs(): 2ca. as convenience functions for retrieving\nand modifying the *note args: 2cb. passed to the exception's\nconstructor.\n\n- gh-91744(4): Introduced the 'Unstable C API tier', marking APi that\nis allowed to change in minor releases without a deprecation\nperiod.  See PEP 689(5) for details.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/101907\n\n(2) https://github.com/python/cpython/issues/99293\n\n(3) https://github.com/python/cpython/issues/101578\n\n(4) https://github.com/python/cpython/issues/91744\n\n(5) https://peps.python.org/pep-0689/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 12 0 alpha 5,  Next: Python 3 12 0 alpha 4,  Prev: Python 3 12 0 alpha 6,  Up: Changelog": {
            "content": "'Release date: 2023-02-07'\n\n* Menu:\n\n* Security: Security<9>.\n* Core and Builtins: Core and Builtins<14>.\n* Library: Library<14>.\n* Documentation: Documentation<14>.\n* Tests: Tests<12>.\n* Build: Build<12>.\n* Windows: Windows<12>.\n\nFile: python3.12.info,  Node: Security<9>,  Next: Core and Builtins<14>,  Up: Python 3 12 0 alpha 5\n\n1.22.14.1 Security\n..................\n\n- gh-99108(1): Replace the builtin *note hashlib: 63. implementations\nof SHA2-224 and SHA2-256 originally from LibTomCrypt with formally\nverified, side-channel resistant code from the HACL*(2) project.\nThe builtins remain a fallback only used when OpenSSL does not\nprovide them.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/99108\n\n(2) https://github.com/hacl-star/hacl-star/\n\nFile: python3.12.info,  Node: Core and Builtins<14>,  Next: Library<14>,  Prev: Security<9>,  Up: Python 3 12 0 alpha 5\n\n1.22.14.2 Core and Builtins\n...........................\n\n- gh-92173(1): Fix the 'defs' and 'kwdefs' arguments to *note\nPyEvalEvalCodeEx(): 14b8. and a reference leak in that function.\n\n- gh-59956(2): The GILState API is now partially compatible with\nsubinterpreters.  Previously, 'PyThreadStateGET()' and\n'PyGILStateGetThisThreadState()' would get out of sync, causing\ninconsistent behavior and crashes.\n\n- gh-101400(3): Fix wrong lineno in exception message on *note\ncontinue: 7ed. or *note break: 8de. which are not in a loop.  Patch\nby Donghee Na.\n\n- gh-101372(4): Fix *note isnormalized(): 875. to properly handle\nthe UCD 3.2.0 cases.  Patch by Donghee Na.\n\n- gh-101266(5): Fix *note sys.getsizeof(): 14b9. reporting for *note\nint: 17e. subclasses.\n\n- gh-101291(6): Refactor the 'PyLongObject' struct into a normal\nPython object header and a 'PyLongValue' struct.\n\n- gh-101046(7): Fix a possible memory leak in the parser when raising\n*note MemoryError: 13e3.  Patch by Pablo Galindo\n\n- gh-101037(8): Fix potential memory underallocation issue for\ninstances of *note int: 17e. subclasses with value zero.\n\n- gh-100762(9): Record the (virtual) exception block depth in the\noparg of *note YIELDVALUE: 14ba.  Use this to avoid the expensive\n'throw()' when closing generators (and coroutines) that can be\nclosed trivially.\n\n- gh-100982(10): Adds a new 'COMPAREANDBRANCH' instruction.  This\nis a bit more efficient when performing a comparison immediately\nfollowed by a branch, and restores the design intent of PEP 659\nthat specializations are local to a single instruction.\n\n- gh-100942(11): Fixed segfault in property.getter/setter/deleter\nthat occurred when a property subclass overrode the 'new'\nmethod to return a non-property instance.\n\n- gh-100923(12): Remove the 'mask' cache entry for the *note\nCOMPAREOP: 78b. instruction and embed the mask into the oparg.\n\n- gh-100892(13): Fix race while iterating over thread states in\nclearing *note threading.local: 14bb.  Patch by Kumar Aditya.\n\n- gh-91351(14): Fix a case where re-entrant imports could corrupt the\nimport deadlock detection code and cause a *note KeyError: 8cf. to\nbe raised out of 'importlib/bootstrap'.  In addition to the\nstraightforward cases, this could also happen when garbage\ncollection leads to a warning being emitted - as happens when it\ncollects an open socket or file)\n\n- gh-100726(15): Optimize construction of 'range' object for medium\nsize integers.\n\n- gh-100712(16): Added option to build cpython with specialization\ndisabled, by setting 'ENABLESPECIALIZATION=False' in 'opcode',\nfollowed by 'make regen-all'.\n\n- bpo-32780(17): Inter-field padding is now inserted into the PEP3118\nformat strings obtained from *note ctypes.Structure: 13d3. objects,\nreflecting their true representation in memory.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/92173\n\n(2) https://github.com/python/cpython/issues/59956\n\n(3) https://github.com/python/cpython/issues/101400\n\n(4) https://github.com/python/cpython/issues/101372\n\n(5) https://github.com/python/cpython/issues/101266\n\n(6) https://github.com/python/cpython/issues/101291\n\n(7) https://github.com/python/cpython/issues/101046\n\n(8) https://github.com/python/cpython/issues/101037\n\n(9) https://github.com/python/cpython/issues/100762\n\n(10) https://github.com/python/cpython/issues/100982\n\n(11) https://github.com/python/cpython/issues/100942\n\n(12) https://github.com/python/cpython/issues/100923\n\n(13) https://github.com/python/cpython/issues/100892\n\n(14) https://github.com/python/cpython/issues/91351\n\n(15) https://github.com/python/cpython/issues/100726\n\n(16) https://github.com/python/cpython/issues/100712\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=32780\n\nFile: python3.12.info,  Node: Library<14>,  Next: Documentation<14>,  Prev: Core and Builtins<14>,  Up: Python 3 12 0 alpha 5\n\n1.22.14.3 Library\n.................\n\n- gh-101541(1): [Enum] - fix psuedo-flag creation\n\n- gh-101570(2): Upgrade pip wheel bundled with ensurepip (pip 23.0)\n\n- gh-101323(3): Fix a bug where errors where not thrown by\nzlib.ZlibDecompressor if encountered during decompressing.\n\n- gh-101317(4): Add 'sslshutdowntimeout' parameter for *note\nasyncio.StreamWriter.starttls(): 3cd.\n\n- gh-101326(5): Fix regression when passing 'None' as second or third\nargument to 'FutureIter.throw'.\n\n- gh-92123(6): Adapt the 'elementtree' extension module to\nmulti-phase init ( PEP 489(7)).  Patches by Erlend E. Aasland.\n\n- gh-100795(8): Avoid potential unexpected 'freeaddrinfo' call\n(double free) in *note socket: c6. when when a libc 'getaddrinfo()'\nimplementation leaves garbage in an output pointer when returning\nan error.  Original patch by Sergey G. Brester.\n\n- gh-101143(9): Remove unused references to *note TimerHandle: 14bd.\nin 'asyncio.baseevents.BaseEventLoop.addcallback'.\n\n- gh-101144(10): Make *note zipfile.Path.open(): 14be. and *note\nzipfile.Path.readtext(): 14bf. also accept 'encoding' as a\npositional argument.  This was the behavior in Python 3.9 and\nearlier.  3.10 introduced a regression where supplying it as a\npositional argument would lead to a *note TypeError: 28e.\n\n- gh-94518(11): Group-related variables of 'posixsubprocess' module\nare renamed to stress that supplimentary group affinity is added to\na fork, not replace the inherited ones.  Patch by Oleg Iarygin.\n\n- gh-101015(12): Fix *note typing.gettypehints(): 47f. on\n''*tuple[...]'' and '*tuple[...]'.  It must not drop the 'Unpack'\npart.\n\n- gh-101000(13): Add *note os.path.splitroot(): 1c3, which splits a\npath into a 3-item tuple '(drive, root, tail)'.  This new function\nis used by *note pathlib: 9f. to improve the performance of path\nconstruction by up to a third.\n\n- gh-100573(14): Fix a Windows *note asyncio: 9. bug with named pipes\nwhere a client doing 'os.stat()' on the pipe would cause an error\nin the server that disabled serving future requests.\n\n- gh-39615(15): *note warnings.warn(): 1374. now has the ability to\nskip stack frames based on code filename prefix rather than only a\nnumeric 'stacklevel' via the new 'skipfileprefixes' keyword\nargument.\n\n- gh-100750(16): pass encoding kwarg to subprocess in platform\n\n- gh-100160(17): Emit a deprecation warning in\n'asyncio.DefaultEventLoopPolicy.geteventloop()' if there is no\ncurrent event loop set and it decides to create one.\n\n- gh-96290(18): Fix handling of partial and invalid UNC drives in\n'ntpath.splitdrive()', and in 'ntpath.normpath()' on non-Windows\nsystems.  Paths such as '\\server' and '\\' are now considered by\n'splitdrive()' to contain only a drive, and consequently are not\nmodified by 'normpath()' on non-Windows systems.  The behaviour of\n'normpath()' on Windows systems is unaffected, as native OS APIs\nare used.  Patch by Eryk Sun, with contributions by Barney Gale.\n\n- gh-99952(19): Fix a reference undercounting issue in *note\nctypes.Structure: 13d3. with 'fromparam()' results larger than a C\npointer.\n\n- gh-67790(20): Add float-style formatting support for *note\nfractions.Fraction: 1a8. instances.\n\n- gh-99266(21): Preserve more detailed error messages in *note\nctypes: 28.\n\n- gh-86682(22): Ensure runtime-created collections have the correct\nmodule name using the newly added (internal) *note\nsys.getframemodulename(): 14c0.\n\n- gh-88597(23): *note uuid: 10b. now has a command line interface.\nTry 'python -m uuid -h'.\n\n- gh-60580(24): 'ctypes.wintypes.BYTE' definition changed from *note\ncbyte: 14c1. to *note cubyte: 14c2. to match Windows SDK. Patch\nby Anatoly Techtonik and Oleg Iarygin.\n\n- gh-94518(25): 'posixsubprocess' now initializes all UID and GID\nvariables using a reserved '-1' value instead of a separate flag.\nPatch by Oleg Iarygin.\n\n- bpo-38941(26): The *note xml.etree.ElementTree: 120. module now\nemits *note DeprecationWarning: 179. when testing the truth value\nof an *note xml.etree.ElementTree.Element: 23e.  Before, the Python\nimplementation emitted *note FutureWarning: 23f, and the C\nimplementation emitted nothing.\n\n- bpo-40077(27): Convert 'elementtree' types to heap types.  Patch by\nErlend E. Aasland.\n\n- bpo-29847(28): Fix a bug where *note pathlib.Path: 149. accepted\nand ignored keyword arguments.  Patch provided by Yurii Karabas.\n\n- gh-77772(29): *note ctypes.CDLL: 80f, *note ctypes.OleDLL: 14c3,\n*note ctypes.WinDLL: 14c4, and *note ctypes.PyDLL: 14c5. now accept\n*note path-like objects: 957. as their 'name' argument.  Patch by\nRobert Hoelzl.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/101541\n\n(2) https://github.com/python/cpython/issues/101570\n\n(3) https://github.com/python/cpython/issues/101323\n\n(4) https://github.com/python/cpython/issues/101317\n\n(5) https://github.com/python/cpython/issues/101326\n\n(6) https://github.com/python/cpython/issues/92123\n\n(7) https://peps.python.org/pep-0489/\n\n(8) https://github.com/python/cpython/issues/100795\n\n(9) https://github.com/python/cpython/issues/101143\n\n(10) https://github.com/python/cpython/issues/101144\n\n(11) https://github.com/python/cpython/issues/94518\n\n(12) https://github.com/python/cpython/issues/101015\n\n(13) https://github.com/python/cpython/issues/101000\n\n(14) https://github.com/python/cpython/issues/100573\n\n(15) https://github.com/python/cpython/issues/39615\n\n(16) https://github.com/python/cpython/issues/100750\n\n(17) https://github.com/python/cpython/issues/100160\n\n(18) https://github.com/python/cpython/issues/96290\n\n(19) https://github.com/python/cpython/issues/99952\n\n(20) https://github.com/python/cpython/issues/67790\n\n(21) https://github.com/python/cpython/issues/99266\n\n(22) https://github.com/python/cpython/issues/86682\n\n(23) https://github.com/python/cpython/issues/88597\n\n(24) https://github.com/python/cpython/issues/60580\n\n(25) https://github.com/python/cpython/issues/94518\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=38941\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=40077\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=29847\n\n(29) https://github.com/python/cpython/issues/77772\n\nFile: python3.12.info,  Node: Documentation<14>,  Next: Tests<12>,  Prev: Library<14>,  Up: Python 3 12 0 alpha 5\n\n1.22.14.4 Documentation\n.......................\n\n- gh-88324(1): Reword *note subprocess: d0. to emphasize default\nbehavior of 'stdin', 'stdout', and 'stderr' arguments.  Remove\ninaccurate statement about child file handle inheritance.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/88324\n\nFile: python3.12.info,  Node: Tests<12>,  Next: Build<12>,  Prev: Documentation<14>,  Up: Python 3 12 0 alpha 5\n\n1.22.14.5 Tests\n...............\n\n- gh-101334(1): 'testtarfile' has been updated to pass when run as a\nhigh UID.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/101334\n\nFile: python3.12.info,  Node: Build<12>,  Next: Windows<12>,  Prev: Tests<12>,  Up: Python 3 12 0 alpha 5\n\n1.22.14.6 Build\n...............\n\n- gh-101282(1): Update BOLT configration not to use depreacted usage\nof '--split functions'.  Patch by Donghee Na.\n\n- gh-101522(2): Allow overriding Windows dependencies versions and\npaths using MSBuild properties.\n\n- gh-77532(3): Minor fixes to allow building with\n'PlatformToolset=ClangCL' on Windows.\n\n- gh-101152(4): In accordance with PEP 699(5), the 'maversiontag'\nfield in *note PyDictObject: 2ef. is deprecated for extension\nmodules.  Accessing this field will generate a compiler warning at\ncompile time.  This field will be removed in Python 3.14.\n\n- gh-100340(6): Allows -Wno-int-conversion for wasm-sdk 17 and\nonwards, thus enables building WASI builds once against the latest\nsdk.\n\n- gh-101060(7): Conditionally add '-fno-reorder-blocks-and-partition'\nin configure.  Effectively fixes '--enable-bolt' when using Clang,\nas this appears to be a GCC-only flag.\n\n- gh-98705(8): 'bool' is defined in AIX system header files which\nbreaks the build in AIX, so undefine it.\n\n- gh-98636(9): Fix a regression in detecting 'gdbmcompat' library\nfor the 'gdbm' module build.\n\n- gh-96305(10): 'aixsupport' now uses a simple code to get platform\ndetails rather than the now non-existent 'bootsubprocess' during\nbootstrap.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/101282\n\n(2) https://github.com/python/cpython/issues/101522\n\n(3) https://github.com/python/cpython/issues/77532\n\n(4) https://github.com/python/cpython/issues/101152\n\n(5) https://peps.python.org/pep-0699/\n\n(6) https://github.com/python/cpython/issues/100340\n\n(7) https://github.com/python/cpython/issues/101060\n\n(8) https://github.com/python/cpython/issues/98705\n\n(9) https://github.com/python/cpython/issues/98636\n\n(10) https://github.com/python/cpython/issues/96305\n\nFile: python3.12.info,  Node: Windows<12>,  Prev: Build<12>,  Up: Python 3 12 0 alpha 5\n\n1.22.14.7 Windows\n.................\n\n- gh-101543(1): Ensure the install path in the registry is only used\nwhen the standard library hasn't been located in any other way.\n\n- gh-101467(2): The 'py.exe' launcher now correctly filters when only\na single runtime is installed.  It also correctly handles prefix\nmatches on tags so that '-3.1' does not match '3.11', but would\nstill match '3.1-32'.\n\n- gh-99834(3): Updates bundled copy of Tcl/Tk to 8.6.13.0\n\n- gh-101135(4): Restore ability to launch older 32-bit versions from\nthe 'py.exe' launcher when both 32-bit and 64-bit installs of the\nsame version are available.\n\n- gh-82052(5): Fixed an issue where writing more than 32K of Unicode\noutput to the console screen in one go can result in mojibake.\n\n- gh-100320(6): Ensures the 'PythonPath' registry key from an install\nis used when launching from a different copy of Python that relies\non an existing install to provide a copy of its modules and\nstandard library.\n\n- gh-100247(7): Restores support for the 'py.exe' launcher finding\nshebang commands in its configuration file using the full command\nname.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/101543\n\n(2) https://github.com/python/cpython/issues/101467\n\n(3) https://github.com/python/cpython/issues/99834\n\n(4) https://github.com/python/cpython/issues/101135\n\n(5) https://github.com/python/cpython/issues/82052\n\n(6) https://github.com/python/cpython/issues/100320\n\n(7) https://github.com/python/cpython/issues/100247\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 12 0 alpha 4,  Next: Python 3 12 0 alpha 3,  Prev: Python 3 12 0 alpha 5,  Up: Changelog": {
            "content": "'Release date: 2023-01-10'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<15>.\n* Library: Library<15>.\n* Documentation: Documentation<15>.\n* Tests: Tests<13>.\n* Build: Build<13>.\n* Windows: Windows<13>.\n* macOS: macOS<9>.\n* Tools/Demos: Tools/Demos<9>.\n* C API: C API<11>.\n\nFile: python3.12.info,  Node: Core and Builtins<15>,  Next: Library<15>,  Up: Python 3 12 0 alpha 4\n\n1.22.15.1 Core and Builtins\n...........................\n\n- gh-100776(1): Fix misleading default value in *note input():\n114d.'s 'textsignature'.\n\n- gh-99005(2): Remove 'UNARYPOSITIVE', 'ASYNCGENWRAP' and\n'LISTTOTUPLE', replacing them with intrinsics.\n\n- gh-99005(3): Add new *note CALLINTRINSIC1: 20a. instruction.\nRemove 'IMPORTSTAR', 'PRINTEXPR' and 'STOPITERATIONERROR',\nreplacing them with the *note CALLINTRINSIC1: 20a. instruction.\n\n- gh-100288(4): Remove the LOADATTRMETHODWITHDICT specialized\ninstruction.  Stats show it is not useful.\n\n- gh-100720(5): Added 'PyFrameNumSlotsForCodeObject', which returns\nthe number of slots needed in a frame for a given code object.\n\n- gh-100719(6): Removed the conplaincellvars field from the code\nobject, as it is redundant.\n\n- gh-100637(7): Fix 'int.sizeof()' calculation to include the 1\nelement obdigit array for 0 and False.\n\n- gh-100649(8): Update the nativethreadid field of PyThreadState\nafter fork.\n\n- gh-100126(9): Fix an issue where \"incomplete\" frames could be\nbriefly visible to C code while other frames are being torn down,\npossibly resulting in corruption or hard crashes of the interpreter\nwhile running finalizers.\n\n- gh-87447(10): Fix *note SyntaxError: 146. on comprehension rebind\nchecking with names that are not actually redefined.\n\nNow reassigning 'b' in '[(b := 1) for a, b.prop in someiter]' is\nallowed.  Reassigning 'a' is still disallowed as per PEP 572(11).\n\n- gh-100268(12): Add *note int.isinteger(): 14cc. to improve duck\ntype compatibility between *note int: 17e. and *note float: 4b7.\n\n- gh-100425(13): Improve the accuracy of 'sum()' with compensated\nsummation.\n\n- gh-100374(14): Fix incorrect result and delay in *note\nsocket.getfqdn(): 14cd.  Patch by Dominic Socular.\n\n- gh-100357(15): Convert 'vars', 'dir', 'next', 'getattr', and 'iter'\nto argument clinic.\n\n- gh-100117(16): Improve the output of *note codeobject.colines():\n5a0. by emitting only one entry for each line range.\n\n- gh-90043(17): Handle NaNs when specializing *note COMPAREOP: 78b.\nfor *note float: 4b7. values.\n\n- gh-100222(18): Redefine the 'PyCODEUNIT' typedef as a union to\ndescribe its layout to the C compiler, avoiding type punning and\nimproving clarity.\n\n- gh-99955(19): Internal compiler functions (in compile.c) now\nconsistently return -1 on error and 0 on success.\n\n- gh-100188(20): The 'BINARYSUBSCRLISTINT' and\n'BINARYSUBSCRTUPLEINT' instructions are no longer used for\nnegative integers because those instructions always miss when\nencountering negative integers.\n\n- gh-99110(21): Initialize frame->previous in frameobject.c to fix a\nsegmentation fault when accessing frames created by\n'PyFrameNew()'.\n\n- gh-94155(22): Improved the hashing algorithm for code objects,\nmitigating some hash collisions.\n\n- gh-99540(23): 'None' now hashes to a constant value.  This is not a\nrequirements change.\n\n- gh-100143(24): When built with '--enable-pystats', stats collection\nis now off by default.  To enable it early at startup, pass the\n'-Xpystats' flag.  Stats are now always dumped, even if switched\noff.\n\n- gh-100146(25): Improve 'BUILDLIST' opcode so that it works\nsimilarly to the 'BUILDTUPLE' opcode, by stealing references from\nthe stack rather than repeatedly using stack operations to set list\nelements.  Implementation details are in a new private API\n'PyListFromArraySteal()'.\n\n- gh-100110(26): Specialize 'FORITER' for tuples.\n\n- gh-100050(27): Honor existing errors obtained when searching for\nmismatching parentheses in the tokenizer.  Patch by Pablo Galindo\n\n- gh-92216(28): Improve the performance of *note hasattr(): 1f7. for\ntype objects with a missing attribute.\n\n- gh-99582(29): Freeze *note zipimport: 12c. module into\n'bootstrappython'.\n\n- gh-99554(30): Pack debugging location tables more efficiently\nduring bytecode compilation.\n\n- gh-98522(31): Add an internal version number to code objects, to\ngive better versioning of inner functions and comprehensions, and\nthus better specialization of those functions.  This change is\ninvisible to both Python and C extensions.\n\n- gh-94603(32): Improve performance of 'list.pop' for small lists.\n\n- gh-89051(33): Add *note ssl.OPLEGACYSERVERCONNECT: 14ce.\n\n- bpo-32782(34): 'ctypes' arrays of length 0 now report a correct\nitemsize when a 'memoryview' is constructed from them, rather than\nalways giving a value of 0.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/100776\n\n(2) https://github.com/python/cpython/issues/99005\n\n(3) https://github.com/python/cpython/issues/99005\n\n(4) https://github.com/python/cpython/issues/100288\n\n(5) https://github.com/python/cpython/issues/100720\n\n(6) https://github.com/python/cpython/issues/100719\n\n(7) https://github.com/python/cpython/issues/100637\n\n(8) https://github.com/python/cpython/issues/100649\n\n(9) https://github.com/python/cpython/issues/100126\n\n(10) https://github.com/python/cpython/issues/87447\n\n(11) https://peps.python.org/pep-0572/\n\n(12) https://github.com/python/cpython/issues/100268\n\n(13) https://github.com/python/cpython/issues/100425\n\n(14) https://github.com/python/cpython/issues/100374\n\n(15) https://github.com/python/cpython/issues/100357\n\n(16) https://github.com/python/cpython/issues/100117\n\n(17) https://github.com/python/cpython/issues/90043\n\n(18) https://github.com/python/cpython/issues/100222\n\n(19) https://github.com/python/cpython/issues/99955\n\n(20) https://github.com/python/cpython/issues/100188\n\n(21) https://github.com/python/cpython/issues/99110\n\n(22) https://github.com/python/cpython/issues/94155\n\n(23) https://github.com/python/cpython/issues/99540\n\n(24) https://github.com/python/cpython/issues/100143\n\n(25) https://github.com/python/cpython/issues/100146\n\n(26) https://github.com/python/cpython/issues/100110\n\n(27) https://github.com/python/cpython/issues/100050\n\n(28) https://github.com/python/cpython/issues/92216\n\n(29) https://github.com/python/cpython/issues/99582\n\n(30) https://github.com/python/cpython/issues/99554\n\n(31) https://github.com/python/cpython/issues/98522\n\n(32) https://github.com/python/cpython/issues/94603\n\n(33) https://github.com/python/cpython/issues/89051\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=32782\n\nFile: python3.12.info,  Node: Library<15>,  Next: Documentation<15>,  Prev: Core and Builtins<15>,  Up: Python 3 12 0 alpha 4\n\n1.22.15.2 Library\n.................\n\n- gh-100833(1): Speed up *note math.fsum(): 1229. by removing\ndefensive 'volatile' qualifiers.\n\n- gh-100805(2): Modify *note random.choice(): 10a6. implementation to\nonce again work with NumPy arrays.\n\n- gh-100813(3): Add 'socket.IPPKTINFO' constant.\n\n- gh-100792(4): Make *note email.message.Message.contains():\n14d0. twice as fast.\n\n- gh-91851(5): Microoptimizations for *note\nfractions.Fraction.round(): 14d1, *note\nfractions.Fraction.ceil(): 14d2. and *note\nfractions.Fraction.floor(): 14d3.\n\n- gh-90104(6): Avoid RecursionError on 'repr' if a dataclass field\ndefinition has a cyclic reference.\n\n- gh-100689(7): Fix crash in 'pyexpat' by statically allocating\n'PyExpatCAPI' capsule.\n\n- gh-100740(8): Fix 'unittest.mock.Mock' not respecting the spec for\nattribute names prefixed with 'assert'.\n\n- gh-91219(9): Change 'SimpleHTTPRequestHandler' to support\nsubclassing to provide a different set of index file names instead\nof using 'init' parameters.\n\n- gh-100690(10): 'Mock' objects which are not unsafe will now raise\nan 'AttributeError' when accessing an attribute that matches the\nname of an assertion but without the prefix 'assert', e.g.\naccessing 'calledonce' instead of 'assertcalledonce'.  This is\nin addition to this already happening for accessing attributes with\nprefixes 'assert', 'assret', 'asert', 'aseert', and 'assrt'.\n\n- gh-89727(11): Simplify and optimize *note os.walk(): 1c8. by using\n*note isinstance(): 14b. checks to check the top of the stack.\n\n- gh-100485(12): Add math.sumprod() to compute the sum of products.\n\n- gh-86508(13): Fix *note asyncio.openconnection(): 950. to skip\nbinding to local addresses of different family.  Patch by Kumar\nAditya.\n\n- gh-97930(14): 'importlib.resources.files' now accepts a module as\nan anchor instead of only accepting packages.  If a module is\npassed, resources are resolved adjacent to that module (in the same\npackage or at the package root).  The parameter was renamed from\n'package' to 'anchor' with a compatibility shim for those passing\nby keyword.  Additionally, the new 'anchor' parameter is now\noptional and will default to the caller's module.\n\n- gh-100585(15): Fixed a bug where importlib.resources.asfile was\nleaving file pointers open\n\n- gh-100562(16): Improve performance of *note\npathlib.Path.absolute(): 146f. by nearly 2x.  This comes at the\ncost of a performance regression in *note pathlib.Path.cwd(): 1470,\nwhich is generally used less frequently in user code.\n\n- gh-100519(17): Small simplification of\n'http.cookiejar.effrequesthost()' that improves readability and\nbetter matches the RFC wording.\n\n- gh-100287(18): Fix the interaction of *note unittest.mock.seal():\n9e4. with *note unittest.mock.AsyncMock: 877.\n\n- gh-100488(19): Add 'Fraction.isinteger()' to check whether a *note\nfractions.Fraction: 1a8. is an integer.  This improves duck type\ncompatibility with *note float: 4b7. and *note int: 17e.\n\n- gh-100474(20): *note http.server: 6d. now checks that an index page\nis actually a regular file before trying to serve it.  This avoids\nissues with directories named 'index.html'.\n\n- gh-100363(21): Speed up *note asyncio.getrunningloop(): 942. by\nremoving redundant 'getpid' checks.  Patch by Kumar Aditya.\n\n- gh-78878(22): Fix crash when creating an instance of\n'ctypes.CField'.\n\n- gh-100348(23): Fix ref cycle in 'asyncio.SelectorSocketTransport'\nby removing 'readreadycb' in 'close'.\n\n- gh-100344(24): Provide C implementation for *note\nasyncio.currenttask(): 198. for a 4x-6x speedup.\n\n- gh-100272(25): Fix JSON serialization of OrderedDict.  It now\npreserves the order of keys.\n\n- gh-83076(26): Instantiation of 'Mock()' and 'AsyncMock()' is now\n3.8x faster.\n\n- gh-100234(27): Set a default value of 1.0 for the 'lambd' parameter\nin random.expovariate().\n\n- gh-100228(28): A *note DeprecationWarning: 179. may be raised when\n*note os.fork(): 231. or *note os.forkpty(): 14d4. is called from\nmulti-threaded processes.  Forking with threads is unsafe and can\ncause deadlocks, crashes and subtle problems.  Lack of a warning\ndoes not indicate that the fork call was actually safe, as Python\nmay not be aware of all threads.\n\n- gh-100039(29): Improve signatures for enums and flags.\n\n- gh-100133(30): Fix regression in *note asyncio: 9. where a\nsubprocess would sometimes lose data received from pipe.\n\n- bpo-44592(31): Fixes inconsistent handling of case sensitivity of\n'extrasaction' arg in *note csv.DictWriter: 1072.\n\n- gh-100098(32): Fix 'tuple' subclasses being cast to 'tuple' when\nused as enum values.\n\n- gh-85432(33): Rename the 'fmt' parameter of the pure-Python\nimplementation of *note datetime.time.strftime(): 14d5. to\n'format'.  Rename the 't' parameter of *note\ndatetime.datetime.fromtimestamp(): 226. to 'timestamp'.  These\nchanges mean the parameter names in the pure-Python implementation\nnow match the parameter names in the C implementation.  Patch by\nAlex Waygood.\n\n- gh-98778(34): Update *note HTTPError: e51. to be initialized\nproperly, even if the 'fp' is 'None'.  Patch by Donghee Na.\n\n- gh-99925(35): Unify error messages in JSON serialization between\n'json.dumps(float('nan'), allownan=False)' and\n'json.dumps(float('nan'), allownan=False, indent=<SOMETHING>)'.\nNow both include the representation of the value that could not be\nserialized.\n\n- gh-89727(36): Fix issue with *note os.walk(): 1c8. where a *note\nRecursionError: bc6. would occur on deep directory structures by\nadjusting the implementation of *note os.walk(): 1c8. to be\niterative instead of recursive.\n\n- gh-94943(37): Add *note Dataclass support: 14d6. to the *note Enum:\n3fd. *note repr(): 14d7.  When inheriting from a *note\ndataclass: 38d, only show the field names in the value section of\nthe member *note repr(): 5f0, and not the dataclass' class name.\n\n- gh-83035(38): Fix *note inspect.getsource(): 144e. handling of\ndecorator calls with nested parentheses.\n\n- gh-99576(39): Fix '.save()' method for 'LWPCookieJar' and\n'MozillaCookieJar': saved file was not truncated on repeated save.\n\n- gh-94912(40): Add *note inspect.markcoroutinefunction(): 1ad.\ndecorator which manually marks a function as a coroutine for the\nbenefit of 'iscoroutinefunction()'.\n\n- gh-99509(41): Add PEP 585(42) support for\n'multiprocessing.queues.Queue'.\n\n- gh-99482(43): Remove 'Jython' partial compatibility code from\nseveral stdlib modules.\n\n- gh-99433(44): Fix *note doctest: 36. failure on *note\ntypes.MethodWrapperType: 414. in modules.\n\n- gh-85267(45): Several improvements to *note inspect.signature():\n51c.'s handling of 'textsignature'.  - Fixes a case where *note\ninspect.signature(): 51c. dropped parameters - Fixes a case where\n*note inspect.signature(): 51c. raised *note tokenize.TokenError:\n29a. - Allows *note inspect.signature(): 51c. to understand\ndefaults involving binary operations of constants - *note\ninspect.signature(): 51c. is documented as only raising *note\nTypeError: 28e. or *note ValueError: 183, but sometimes raised\n*note RuntimeError: 17a.  These cases now raise *note ValueError:\n183. - Removed a dead code path\n\n- gh-91166(46): *note asyncio: 9. is optimized to avoid excessive\ncopying when writing to socket and use *note sendmsg(): 191. if the\nplatform supports it.  Patch by Kumar Aditya.\n\n- gh-98030(47): Add missing TCP socket options from Linux:\n'TCPMD5SIG', 'TCPTHINLINEARTIMEOUTS', 'TCPTHINDUPACK',\n'TCPREPAIR', 'TCPREPAIRQUEUE', 'TCPQUEUESEQ',\n'TCPREPAIROPTIONS', 'TCPTIMESTAMP', 'TCPCCINFO',\n'TCPSAVESYN', 'TCPSAVEDSYN', 'TCPREPAIRWINDOW',\n'TCPFASTOPENCONNECT', 'TCPULP', 'TCPMD5SIGEXT',\n'TCPFASTOPENKEY', 'TCPFASTOPENNOCOOKIE',\n'TCPZEROCOPYRECEIVE', 'TCPINQ', 'TCPTXDELAY'.\n\n- gh-88500(48): Reduced the memory usage of *note\nurllib.parse.unquote(): 14d8. and *note\nurllib.parse.unquotetobytes(): 14d9. on large values.\n\n- gh-96127(49): 'inspect.signature' was raising 'TypeError' on call\nwith mock objects.  Now it correctly returns '(*args, kwargs)' as\ninfered signature.\n\n- gh-95882(50): Fix a 3.11 regression in *note asynccontextmanager():\n963, which caused it to propagate exceptions with incorrect\ntracebacks and fix a 3.11 regression in *note contextmanager():\n1076, which caused it to propagate exceptions with incorrect\ntracebacks for *note StopIteration: a40.\n\n- gh-78707(51): Deprecate passing more than one positional argument\nto *note pathlib.PurePath.relativeto(): 1c9. and *note\nisrelativeto(): 14da.\n\n- gh-92122(52): Fix reStructuredText syntax errors in docstrings in\nthe *note enum: 51. module.\n\n- gh-91851(53): Optimize the *note Fraction: 1a8. arithmetics for\nsmall components.\n\n- bpo-24132(54): Make *note pathlib.PurePath: 1c5. and *note Path:\n149. subclassable (private to start).  Previously, attempting to\ninstantiate a subclass resulted in an *note AttributeError: 395.\nbeing raised.  Patch by Barney Gale.\n\n- bpo-40447(55): Accept *note os.PathLike: a9a. (such as *note\npathlib.Path: 149.) in the 'stripdir' arguments of *note\ncompileall.compilefile(): c3e. and *note compileall.compiledir():\n95f.\n\n- bpo-36880(56): Fix a reference counting issue when a *note ctypes:\n28. callback with return type *note pyobject: 14db. returns\n'None', which could cause crashes.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/100833\n\n(2) https://github.com/python/cpython/issues/100805\n\n(3) https://github.com/python/cpython/issues/100813\n\n(4) https://github.com/python/cpython/issues/100792\n\n(5) https://github.com/python/cpython/issues/91851\n\n(6) https://github.com/python/cpython/issues/90104\n\n(7) https://github.com/python/cpython/issues/100689\n\n(8) https://github.com/python/cpython/issues/100740\n\n(9) https://github.com/python/cpython/issues/91219\n\n(10) https://github.com/python/cpython/issues/100690\n\n(11) https://github.com/python/cpython/issues/89727\n\n(12) https://github.com/python/cpython/issues/100485\n\n(13) https://github.com/python/cpython/issues/86508\n\n(14) https://github.com/python/cpython/issues/97930\n\n(15) https://github.com/python/cpython/issues/100585\n\n(16) https://github.com/python/cpython/issues/100562\n\n(17) https://github.com/python/cpython/issues/100519\n\n(18) https://github.com/python/cpython/issues/100287\n\n(19) https://github.com/python/cpython/issues/100488\n\n(20) https://github.com/python/cpython/issues/100474\n\n(21) https://github.com/python/cpython/issues/100363\n\n(22) https://github.com/python/cpython/issues/78878\n\n(23) https://github.com/python/cpython/issues/100348\n\n(24) https://github.com/python/cpython/issues/100344\n\n(25) https://github.com/python/cpython/issues/100272\n\n(26) https://github.com/python/cpython/issues/83076\n\n(27) https://github.com/python/cpython/issues/100234\n\n(28) https://github.com/python/cpython/issues/100228\n\n(29) https://github.com/python/cpython/issues/100039\n\n(30) https://github.com/python/cpython/issues/100133\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=44592\n\n(32) https://github.com/python/cpython/issues/100098\n\n(33) https://github.com/python/cpython/issues/85432\n\n(34) https://github.com/python/cpython/issues/98778\n\n(35) https://github.com/python/cpython/issues/99925\n\n(36) https://github.com/python/cpython/issues/89727\n\n(37) https://github.com/python/cpython/issues/94943\n\n(38) https://github.com/python/cpython/issues/83035\n\n(39) https://github.com/python/cpython/issues/99576\n\n(40) https://github.com/python/cpython/issues/94912\n\n(41) https://github.com/python/cpython/issues/99509\n\n(42) https://peps.python.org/pep-0585/\n\n(43) https://github.com/python/cpython/issues/99482\n\n(44) https://github.com/python/cpython/issues/99433\n\n(45) https://github.com/python/cpython/issues/85267\n\n(46) https://github.com/python/cpython/issues/91166\n\n(47) https://github.com/python/cpython/issues/98030\n\n(48) https://github.com/python/cpython/issues/88500\n\n(49) https://github.com/python/cpython/issues/96127\n\n(50) https://github.com/python/cpython/issues/95882\n\n(51) https://github.com/python/cpython/issues/78707\n\n(52) https://github.com/python/cpython/issues/92122\n\n(53) https://github.com/python/cpython/issues/91851\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=24132\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=40447\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=36880\n\nFile: python3.12.info,  Node: Documentation<15>,  Next: Tests<13>,  Prev: Library<15>,  Up: Python 3 12 0 alpha 4\n\n1.22.15.3 Documentation\n.......................\n\n- gh-100616(1): Document existing 'attr' parameter to *note\ncurses.window.vline(): 14dd. function in *note curses: 29.\n\n- gh-100472(2): Remove claim in documentation that the 'stripdir',\n'prependdir' and 'limitsldest' parameters of *note\ncompileall.compiledir(): 95f. and *note compileall.compilefile():\nc3e. could be *note bytes: 295.\n\n- bpo-25377(3): Clarify use of octal format of mode argument in\nhelp(os.chmod) as well as help(os.fchmod)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/100616\n\n(2) https://github.com/python/cpython/issues/100472\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=25377\n\nFile: python3.12.info,  Node: Tests<13>,  Next: Build<13>,  Prev: Documentation<15>,  Up: Python 3 12 0 alpha 4\n\n1.22.15.4 Tests\n...............\n\n- gh-100454(1): Start running SSL tests with OpenSSL 3.1.0-beta1.\n\n- gh-100086(2): The Python test runner (libregrtest) now logs Python\nbuild information like \"debug\" vs \"release\" build, or LTO and PGO\noptimizations.  Patch by Victor Stinner.\n\n- gh-93018(3): Make two tests forgiving towards host system libexpat\nwith backported security fixes applied.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/100454\n\n(2) https://github.com/python/cpython/issues/100086\n\n(3) https://github.com/python/cpython/issues/93018\n\nFile: python3.12.info,  Node: Build<13>,  Next: Windows<13>,  Prev: Tests<13>,  Up: Python 3 12 0 alpha 4\n\n1.22.15.5 Build\n...............\n\n- gh-100540(1): Removed the '--with-system-ffi' 'configure' option;\n'libffi' must now always be supplied by the system on all\nnon-Windows platforms.  The option has had no effect on non-Darwin\nplatforms for several releases, and in 3.11 only had the\nnon-obvious effect of invoking 'pkg-config' to find 'libffi' and\nnever setting '-DUSINGAPPLEOSLIBFFI'.  Now on Darwin platforms\n'configure' will first check for the OS 'libffi' and then fall back\nto the same processing as other platforms if it is not found.\n\n- gh-88267(2): Avoid exporting Python symbols in linked Windows\napplications when the core is built as static.\n\n- bpo-41916(3): Allow override of accvcxxthread so that cross\ncompiled python can set -pthread for CXX.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/100540\n\n(2) https://github.com/python/cpython/issues/88267\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=41916\n\nFile: python3.12.info,  Node: Windows<13>,  Next: macOS<9>,  Prev: Build<13>,  Up: Python 3 12 0 alpha 4\n\n1.22.15.6 Windows\n.................\n\n- gh-100180(1): Update Windows installer to OpenSSL 1.1.1s\n\n- gh-99191(2): Use 'MSVCLANG >= 202002L' instead of less-precise\n'MSCVER >=1929' to more accurately test for C++20 support in\n'PC/wmimodule.cpp'.\n\n- gh-79218(3): Define 'MSWIN64' for Mingw-w64 64bit, fix cython\ncompilation failure.\n\n- gh-99941(4): Ensure that *note asyncio.Protocol.datareceived():\n14e1. receives an immutable *note bytes: 295. object (as\ndocumented), instead of *note bytearray: 294.\n\n- bpo-43984(5): *note winreg.SetValueEx(): 14e2. now leaves the\ntarget value untouched in the case of conversion errors.\nPreviously, '-1' would be written in case of such errors.\n\n- bpo-34816(6): 'hasattr(ctypes.windll, 'nonexistant')' now returns\n'False' instead of raising *note OSError: 613.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/100180\n\n(2) https://github.com/python/cpython/issues/99191\n\n(3) https://github.com/python/cpython/issues/79218\n\n(4) https://github.com/python/cpython/issues/99941\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=43984\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=34816\n\nFile: python3.12.info,  Node: macOS<9>,  Next: Tools/Demos<9>,  Prev: Windows<13>,  Up: Python 3 12 0 alpha 4\n\n1.22.15.7 macOS\n...............\n\n- gh-100180(1): Update macOS installer to OpenSSL 1.1.1s\n\n- gh-100540(2): Removed obsolete 'dlfcn.h' shim from the 'ctypes'\nextension module, which has not been necessary since Mac OS X 10.2.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/100180\n\n(2) https://github.com/python/cpython/issues/100540\n\nFile: python3.12.info,  Node: Tools/Demos<9>,  Next: C API<11>,  Prev: macOS<9>,  Up: Python 3 12 0 alpha 4\n\n1.22.15.8 Tools/Demos\n.....................\n\n- bpo-45256(1): Fix a bug that caused an *note AttributeError: 395.\nto be raised in 'python-gdb.py' when 'py-locals' is used without a\nframe.\n\n- gh-100342(2): Add missing 'NULL' check for possible allocation\nfailure in '*args' parsing in Argument Clinic.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=45256\n\n(2) https://github.com/python/cpython/issues/100342\n\nFile: python3.12.info,  Node: C API<11>,  Prev: Tools/Demos<9>,  Up: Python 3 12 0 alpha 4\n\n1.22.15.9 C API\n...............\n\n- gh-99947(1): Raising SystemError on import will now have its cause\nbe set to the original unexpected exception.\n\n- gh-99240(2): In argument parsing, after deallocating newly\nallocated memory, reset its pointer to NULL.\n\n- gh-98724(3): The *note PyCLEAR: 2da, *note PySETREF: 2db. and\n*note PyXSETREF: 2dc. macros now only evaluate their arguments\nonce.  If an argument has side effects, these side effects are no\nlonger duplicated.  Patch by Victor Stinner.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/99947\n\n(2) https://github.com/python/cpython/issues/99240\n\n(3) https://github.com/python/cpython/issues/98724\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 12 0 alpha 3,  Next: Python 3 12 0 alpha 2,  Prev: Python 3 12 0 alpha 4,  Up: Changelog": {
            "content": "'Release date: 2022-12-06'\n\n* Menu:\n\n* Security: Security<10>.\n* Core and Builtins: Core and Builtins<16>.\n* Library: Library<16>.\n* Documentation: Documentation<16>.\n* Tests: Tests<14>.\n* Build: Build<14>.\n* Windows: Windows<14>.\n* macOS: macOS<10>.\n* Tools/Demos: Tools/Demos<10>.\n* C API: C API<12>.\n\nFile: python3.12.info,  Node: Security<10>,  Next: Core and Builtins<16>,  Up: Python 3 12 0 alpha 3\n\n1.22.16.1 Security\n..................\n\n- gh-100001(1): 'python -m http.server' no longer allows terminal\ncontrol characters sent within a garbage request to be printed to\nthe stderr server log.\n\nThis is done by changing the *note http.server: 6d.\n'BaseHTTPRequestHandler' '.logmessage' method to replace control\ncharacters with a '\\xHH' hex escape before printing.\n\n- gh-87604(2): Avoid publishing list of active per-interpreter audit\nhooks via the *note gc: 5b. module\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/100001\n\n(2) https://github.com/python/cpython/issues/87604\n\nFile: python3.12.info,  Node: Core and Builtins<16>,  Next: Library<16>,  Prev: Security<10>,  Up: Python 3 12 0 alpha 3\n\n1.22.16.2 Core and Builtins\n...........................\n\n- gh-99891(1): Fix a bug in the tokenizer that could cause infinite\nrecursion when showing syntax warnings that happen in the first\nline of the source.  Patch by Pablo Galindo\n\n- gh-91054(2): Add *note PyCodeAddWatcher(): 2c1. and *note\nPyCodeClearWatcher(): 2c2. APIs to register callbacks to receive\nnotification on creation and destruction of code objects.\n\n- gh-99729(3): Fix an issue that could cause frames to be visible to\nPython code as they are being torn down, possibly leading to memory\ncorruption or hard crashes of the interpreter.\n\n- gh-99708(4): Fix bug where compiler crashes on an if expression\nwith an empty body block.\n\n- gh-99578(5): Fix a reference bug in 'imp.createbuiltin()' after\nthe creation of the first sub-interpreter for modules 'builtins'\nand 'sys'.  Patch by Victor Stinner.\n\n- gh-99581(6): Fixed a bug that was causing a buffer overflow if the\ntokenizer copies a line missing the newline caracter from a file\nthat is as long as the available tokenizer buffer.  Patch by Pablo\ngalindo\n\n- gh-99553(7): Fix bug where an *note ExceptionGroup: 17b. subclass\ncan wrap a *note BaseException: 37c.\n\n- gh-99547(8): Add a function to os.path to check if a path is a\njunction: isjunction.  Add similar functionality to pathlib.Path as\nisjunction.\n\n- gh-99370(9): Fix zip path for venv created from a non-installed\npython on POSIX platforms.\n\n- gh-99377(10): Add audit events for thread creation and clear\noperations.\n\n- gh-98686(11): Remove the 'BINARYOPGENERIC' and\n'COMPAREOPGENERIC' \"specializations\".\n\n- gh-99298(12): Remove the remaining error paths for attribute\nspecializations, and refuse to specialize attribute accesses on\ntypes that haven't had *note PyTypeReady(): 567. called on them\nyet.\n\n- gh-99127(13): Allow some features of *note syslog: d6. to the main\ninterpreter only.  Patch by Donghee Na.\n\n- gh-91053(14): Optimizing interpreters and JIT compilers may need to\ninvalidate internal metadata when functions are modified.  This\nchange adds the ability to provide a callback that will be invoked\neach time a function is created, modified, or destroyed.\n\n- gh-90994(15): Improve error messages when there's a syntax error\nwith call arguments.  The following three cases are covered: - No\nvalue is assigned to a named argument, eg 'foo(a=)'.  - A value is\nassigned to a star argument, eg 'foo(*args=[0])'.  - A value is\nassigned to a double-star keyword argument, eg 'foo(kwarg={'a':\n0})'.\n\n- bpo-45026(16): Optimize the *note range: 761. object iterator.  It\nis now smaller, faster iteration of ranges containing large\nnumbers.  Smaller pickles, faster unpickling.\n\n- bpo-31718(17): Raise *note ValueError: 183. instead of *note\nSystemError: 2d7. when methods of uninitialized *note\nio.IncrementalNewlineDecoder: 13ec. objects are called.  Patch by\nOren Milman.\n\n- bpo-38031(18): Fix a possible assertion failure in *note io.FileIO:\n1186. when the opener returns an invalid file descriptor.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/99891\n\n(2) https://github.com/python/cpython/issues/91054\n\n(3) https://github.com/python/cpython/issues/99729\n\n(4) https://github.com/python/cpython/issues/99708\n\n(5) https://github.com/python/cpython/issues/99578\n\n(6) https://github.com/python/cpython/issues/99581\n\n(7) https://github.com/python/cpython/issues/99553\n\n(8) https://github.com/python/cpython/issues/99547\n\n(9) https://github.com/python/cpython/issues/99370\n\n(10) https://github.com/python/cpython/issues/99377\n\n(11) https://github.com/python/cpython/issues/98686\n\n(12) https://github.com/python/cpython/issues/99298\n\n(13) https://github.com/python/cpython/issues/99127\n\n(14) https://github.com/python/cpython/issues/91053\n\n(15) https://github.com/python/cpython/issues/90994\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=45026\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=31718\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=38031\n\nFile: python3.12.info,  Node: Library<16>,  Next: Documentation<16>,  Prev: Core and Builtins<16>,  Up: Python 3 12 0 alpha 3\n\n1.22.16.3 Library\n.................\n\n- gh-100001(1): Also escape s in the http.server\nBaseHTTPRequestHandler.logmessage so that it is technically\npossible to parse the line and reconstruct what the original data\nwas.  Without this a xHH is ambiguious as to if it is a hex\nreplacement we put in or the characters r\"x\" came through in the\noriginal request line.\n\n- gh-99957(2): Add 'frozendefault' parameter to *note\ntyping.dataclasstransform(): 1fa.\n\n- gh-79033(3): Fix *note asyncio.Server.waitclosed(): 13ee. to\nactually do what the docs promise - wait for all existing\nconnections to complete, after closing the server.\n\n- gh-51524(4): Fix bug when calling trace.CoverageResults with valid\ninfile.\n\n- gh-99645(5): Fix a bug in handling class cleanups in *note\nunittest.TestCase: 159.  Now 'addClassCleanup()' uses separate\nlists for different 'TestCase' subclasses, and 'doClassCleanups()'\nonly cleans up the particular class.\n\n- gh-99508(6): Fix 'TypeError' in\n'Lib/importlib/bootstrapexternal.py' while calling\n'imp.sourcehash()'.\n\n- gh-66285(7): Fix *note asyncio: 9. to not share event loop and\nsignal wakeupfd in forked processes.  Patch by Kumar Aditya.\n\n- gh-97001(8): Release the GIL when calling termios APIs to avoid\nblocking threads.\n\n- gh-92647(9): Use final status of an enum to determine lookup or\ncreation branch of functional API.\n\n- gh-99388(10): Add 'loopfactory' parameter to *note asyncio.run():\n197. to allow specifying a custom event loop factory.  Patch by\nKumar Aditya.\n\n- gh-99341(11): Fix *note ast.incrementlineno(): 14ea. to also cover\n'ast.TypeIgnore' when changing line numbers.\n\n- gh-99382(12): Check the number of arguments in substitution in user\ngenerics containing a *note TypeVarTuple: 162. and one or more\n*note TypeVar: 164.\n\n- gh-99379(13): Fix substitution of *note ParamSpec: 163. followed by\n*note TypeVarTuple: 162. in generic aliases.\n\n- gh-99344(14): Fix substitution of *note TypeVarTuple: 162. and\n*note ParamSpec: 163. together in user generics.\n\n- gh-99284(15): Remove 'usebrokenoldctypesstructuresemantics'\nold untested and undocumented hack from *note ctypes: 28.\n\n- gh-99201(16): Fix *note IndexError: 138f. when initializing the\nconfig variables on Windows if 'HAVEDYNAMICLOADING' is not set.\n\n- gh-99240(17): Fix double-free bug in Argument Clinic\n'strconverter' by extracting memory clean up to a new\n'postparsing' section.\n\n- gh-64490(18): Fix refcount error when arguments are packed to tuple\nin Argument Clinic.\n\n- gh-99029(19): *note pathlib.PurePath.relativeto(): 1c9. now treats\nnaked Windows drive paths as relative.  This brings its behaviour\nin line with other parts of pathlib.\n\n- gh-98253(20): The implementation of the typing module is now more\nresilient to reference leaks in binary extension modules.\n\nPreviously, a reference leak in a typed C API-based extension\nmodule could leak internals of the typing module, which could in\nturn introduce leaks in essentially any other package with typed\nfunction signatures.  Although the typing package is not the\noriginal source of the problem, such non-local dependences\nexacerbate debugging of large-scale projects, and the\nimplementation was therefore changed to reduce harm by providing\nbetter isolation.\n\n- gh-98458(21): Fix infinite loop in unittest when a self-referencing\nchained exception is raised\n\n- gh-93453(22): *note asyncio.geteventloop(): 21e. and many other\n*note asyncio: 9. functions like *note asyncio.ensurefuture():\nac1, *note asyncio.shield(): 89e. or *note asyncio.gather(): 3c6,\nand also the 'geteventloop()' method of\n'asyncio.BaseDefaultEventLoopPolicy' now raise a *note\nRuntimeError: 17a. if called when there is no running event loop\nand the current event loop was not set.  Previously they implicitly\ncreated and set a new current event loop.  *note\nDeprecationWarning: 179. is no longer emitted if there is no\nrunning event loop but the current event loop was set.\n\n- gh-97966(23): On 'unameresult', restored expectation that\n'fields' and 'asdict' would include all six properties including\n'processor'.\n\n- gh-98248(24): Provide informative error messages in *note\nstruct.pack(): 10ef. when its integral arguments are not in range.\n\n- gh-98108(25): 'zipfile.Path' is now pickleable if its\ninitialization parameters were pickleable (e.g.  for file system\npaths).\n\n- gh-98098(26): Created packages from zipfile and testzipfile\nmodules, separating 'zipfile.Path' functionality.\n\n- gh-82836(27): Fix *note isprivate: 14eb. properties in the *note\nipaddress: 7a. module.  Previously non-private networks (0.0.0.0/0)\nwould return True from this method; now they correctly return\nFalse.\n\n- gh-96828(28): Add an *note OPENABLEKTLS: 14ec. option for\nenabling the use of the kernel TLS (kTLS). Patch by Illia Volochii.\n\n- gh-88863(29): To avoid apparent memory leaks when *note\nasyncio.openconnection(): 950. raises, break reference cycles\ngenerated by local exception and future instances (which has\nexception instance as its member var).  Patch by Dong Uk, Kang.\n\n- gh-91078(30): 'TarFile.next()' now returns 'None' when called on an\nempty tarfile.\n\n- bpo-47220(31): Document the optional 'callback' parameter of\n'WeakMethod'.  Patch by Ge'ry Ogam.\n\n- bpo-44817(32): Ignore WinError 53 (ERRORBADNETPATH), 65\n(ERRORNETWORKACCESSDENIED) and 161 (ERRORBADPATHNAME) when\nusing ntpath.realpath().\n\n- bpo-41260(33): Rename the 'fmt' parameter of the pure Python\nimplementation of *note datetime.date.strftime(): ade. to 'format'.\n\n- bpo-15999(34): All built-in functions now accept arguments of any\ntype instead of just 'bool' and 'int' for boolean parameters.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/100001\n\n(2) https://github.com/python/cpython/issues/99957\n\n(3) https://github.com/python/cpython/issues/79033\n\n(4) https://github.com/python/cpython/issues/51524\n\n(5) https://github.com/python/cpython/issues/99645\n\n(6) https://github.com/python/cpython/issues/99508\n\n(7) https://github.com/python/cpython/issues/66285\n\n(8) https://github.com/python/cpython/issues/97001\n\n(9) https://github.com/python/cpython/issues/92647\n\n(10) https://github.com/python/cpython/issues/99388\n\n(11) https://github.com/python/cpython/issues/99341\n\n(12) https://github.com/python/cpython/issues/99382\n\n(13) https://github.com/python/cpython/issues/99379\n\n(14) https://github.com/python/cpython/issues/99344\n\n(15) https://github.com/python/cpython/issues/99284\n\n(16) https://github.com/python/cpython/issues/99201\n\n(17) https://github.com/python/cpython/issues/99240\n\n(18) https://github.com/python/cpython/issues/64490\n\n(19) https://github.com/python/cpython/issues/99029\n\n(20) https://github.com/python/cpython/issues/98253\n\n(21) https://github.com/python/cpython/issues/98458\n\n(22) https://github.com/python/cpython/issues/93453\n\n(23) https://github.com/python/cpython/issues/97966\n\n(24) https://github.com/python/cpython/issues/98248\n\n(25) https://github.com/python/cpython/issues/98108\n\n(26) https://github.com/python/cpython/issues/98098\n\n(27) https://github.com/python/cpython/issues/82836\n\n(28) https://github.com/python/cpython/issues/96828\n\n(29) https://github.com/python/cpython/issues/88863\n\n(30) https://github.com/python/cpython/issues/91078\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=47220\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=44817\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=41260\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=15999\n\nFile: python3.12.info,  Node: Documentation<16>,  Next: Tests<14>,  Prev: Library<16>,  Up: Python 3 12 0 alpha 3\n\n1.22.16.4 Documentation\n.......................\n\n- gh-99931(1): Use sphinxext-opengraph(2) to generate OpenGraph\nmetadata(3).\n\n- gh-89682(4): Reworded docstring of the default 'contains' to\nclarify that it returns a *note bool: 17d.\n\n- gh-88330(5): Improved the description of what a resource is in\nimportlib.resources docs.\n\n- gh-92892(6): Document that calling variadic functions with ctypes\nrequires special care on macOS/arm64 (and possibly other\nplatforms).\n\n- bpo-41825(7): Restructured the documentation for the *note\nos.wait*: bf4. family of functions, and improved the docs for *note\nos.waitid(): bf5. with more explanation of the possible argument\nconstants.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/99931\n\n(2) https://sphinxext-opengraph.readthedocs.io/\n\n(3) https://ogp.me/\n\n(4) https://github.com/python/cpython/issues/89682\n\n(5) https://github.com/python/cpython/issues/88330\n\n(6) https://github.com/python/cpython/issues/92892\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=41825\n\nFile: python3.12.info,  Node: Tests<14>,  Next: Build<14>,  Prev: Documentation<16>,  Up: Python 3 12 0 alpha 3\n\n1.22.16.5 Tests\n...............\n\n- gh-99892(1): Skip testnormalization() of testunicodedata if it\nfails to download NormalizationTest.txt file from pythontest.net.\nPatch by Victor Stinner.\n\n- gh-99934(2): Correct testmarsh on (32 bit) x86: testdeterministic\nsets was failing.\n\n- gh-99741(3): We've implemented multi-phase init (PEP 489/630/687)\nfor the internal (for testing) xxsubinterpreters module.\n\n- gh-99659(4): Optional big memory tests in 'testsqlite3' now catch\nthe correct 'sqlite.DataError' exception type in case of too large\nstrings and/or blobs passed.\n\n- gh-99593(5): Cover the Unicode C API with tests.\n\n- gh-96002(6): Add functional test for Argument Clinic.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/99892\n\n(2) https://github.com/python/cpython/issues/99934\n\n(3) https://github.com/python/cpython/issues/99741\n\n(4) https://github.com/python/cpython/issues/99659\n\n(5) https://github.com/python/cpython/issues/99593\n\n(6) https://github.com/python/cpython/issues/96002\n\nFile: python3.12.info,  Node: Build<14>,  Next: Windows<14>,  Prev: Tests<14>,  Up: Python 3 12 0 alpha 3\n\n1.22.16.6 Build\n...............\n\n- gh-99086(1): Fix '-Wimplicit-int', '-Wstrict-prototypes', and\n'-Wimplicit-function-declaration' compiler warnings in 'configure'\nchecks.\n\n- gh-99337(2): Fix a compilation issue with GCC 12 on macOS.\n\n- gh-99289(3): Add a 'COMPILEALLOPTS' variable in Makefile to\noverride *note compileall: 1e. options (default: '-j0') in 'make\ninstall'.  Also merged the 'compileall' commands into a single\ncommand building .pyc files for the all optimization levels (0, 1,\n2) at once.  Patch by Victor Stinner.\n\n- gh-98872(4): Fix a possible fd leak in 'Programs/freezemodule.c'\nintroduced in Python 3.11.\n\n- gh-88226(5): Always define 'TARGET*' labels in 'Python/ceval.c',\neven if 'USECOMPUTEDGOTOS' is disabled.  This allows breakpoints\nto be set at those labels in (for instance) 'gdb'.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/99086\n\n(2) https://github.com/python/cpython/issues/99337\n\n(3) https://github.com/python/cpython/issues/99289\n\n(4) https://github.com/python/cpython/issues/98872\n\n(5) https://github.com/python/cpython/issues/88226\n\nFile: python3.12.info,  Node: Windows<14>,  Next: macOS<10>,  Prev: Build<14>,  Up: Python 3 12 0 alpha 3\n\n1.22.16.7 Windows\n.................\n\n- gh-99345(1): Use faster initialization functions to detect install\nlocation for Windows Store package\n\n- gh-98629(2): Fix initialization of *note sys.version: b70. and\n'sys.git' on Windows\n\n- gh-99442(3): Fix handling in *note Python Launcher for Windows:\n37f. when 'argv[0]' does not include a file extension.\n\n- bpo-40882(4): Fix a memory leak in *note\nmultiprocessing.sharedmemory.SharedMemory: 13b4. on Windows.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/99345\n\n(2) https://github.com/python/cpython/issues/98629\n\n(3) https://github.com/python/cpython/issues/99442\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=40882\n\nFile: python3.12.info,  Node: macOS<10>,  Next: Tools/Demos<10>,  Prev: Windows<14>,  Up: Python 3 12 0 alpha 3\n\n1.22.16.8 macOS\n...............\n\n- gh-87235(1): On macOS 'python3 /dev/fd/9 9</path/to/script.py'\nfailed for any script longer than a couple of bytes.\n\n- gh-98940(2): Fix 'Mac/Extras.install.py' file filter bug.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/87235\n\n(2) https://github.com/python/cpython/issues/98940\n\nFile: python3.12.info,  Node: Tools/Demos<10>,  Next: C API<12>,  Prev: macOS<10>,  Up: Python 3 12 0 alpha 3\n\n1.22.16.9 Tools/Demos\n.....................\n\n- gh-64490(1): Argument Clinic varargs bugfixes\n\n* Fix out-of-bounds error in\n'PyArgUnpackKeywordsWithVararg()'.\n\n* Fix incorrect check which allowed more than one varargs in\nclinic.py.\n\n* Fix miscalculation of 'noptargs' in generated code.\n\n* Do not generate 'noptargs' when there is a vararg argument and\nno optional argument.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/64490\n\nFile: python3.12.info,  Node: C API<12>,  Prev: Tools/Demos<10>,  Up: Python 3 12 0 alpha 3\n\n1.22.16.10 C API\n................\n\n- gh-98680(1): 'PyBUF*' constants were marked as part of Limited API\nof Python 3.11+.  These were available in 3.11.0 with *note\nPyLIMITEDAPI: 586. defined for 3.11, and are necessary to use the\nbuffer API.\n\n- gh-99612(2): Fix *note PyUnicodeDecodeUTF8Stateful(): 14f4. for\nASCII-only data: '*consumed' was not set.\n\n- gh-47146(3): The 'structmember.h' header is deprecated.  Its\nnon-deprecated contents are now available just by including\n'Python.h', with a 'Py' prefix added if it was missing.\n(Deprecated contents are *note TOBJECT: 31f, *note TNONE: 321,\nand no-op flags.)  Patch by Petr Viktorin, based on earlier work by\nAlexander Belopolsky and Matthias Braun.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/98680\n\n(2) https://github.com/python/cpython/issues/99612\n\n(3) https://github.com/python/cpython/issues/47146\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 12 0 alpha 2,  Next: Python 3 12 0 alpha 1,  Prev: Python 3 12 0 alpha 3,  Up: Changelog": {
            "content": "'Release date: 2022-11-14'\n\n* Menu:\n\n* Security: Security<11>.\n* Core and Builtins: Core and Builtins<17>.\n* Library: Library<17>.\n* Documentation: Documentation<17>.\n* Tests: Tests<15>.\n* Build: Build<15>.\n* Windows: Windows<15>.\n* macOS: macOS<11>.\n* C API: C API<13>.\n\nFile: python3.12.info,  Node: Security<11>,  Next: Core and Builtins<17>,  Up: Python 3 12 0 alpha 2\n\n1.22.17.1 Security\n..................\n\n- gh-98433(1): The IDNA codec decoder used on DNS hostnames by *note\nsocket: c6. or *note asyncio: 9. related name resolution functions\nno longer involves a quadratic algorithm.  This prevents a\npotential CPU denial of service if an out-of-spec excessive length\nhostname involving bidirectional characters were decoded.  Some\nprotocols such as *note urllib: 103. http '3XX' redirects\npotentially allow for an attacker to supply such a name.\n\nIndividual labels within an IDNA encoded DNS name will now raise an\nerror early during IDNA decoding if they are longer than 1024\nunicode characters given that each decoded DNS label must be 63 or\nfewer characters and the entire decoded DNS name is limited to 255.\nOnly an application presenting a hostname or label consisting\nprimarily of RFC 3454(2) section 3.1 \"Nothing\" characters to be\nremoved would run into of this new limit.  See also RFC 5894(3)\nsection 6 and RFC 3491(4).\n\n- gh-98739(5): Update bundled libexpat to 2.5.0\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/98433\n\n(2) https://datatracker.ietf.org/doc/html/rfc3454.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc5894.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc3491.html\n\n(5) https://github.com/python/cpython/issues/98739\n\nFile: python3.12.info,  Node: Core and Builtins<17>,  Next: Library<17>,  Prev: Security<11>,  Up: Python 3 12 0 alpha 2\n\n1.22.17.2 Core and Builtins\n...........................\n\n- gh-81057(1): The docs clearly say that 'PyImportInittab', *note\nPyImportAppendInittab(): 14f8, and *note PyImportExtendInittab():\n14f9. should not be used after *note PyInitialize(): 6c2. has been\ncalled.  We now enforce this for the two functions.  Additionally,\nthe runtime now uses an internal copy of 'PyImportInittab', to\nguard against modification.\n\n- gh-99298(2): Fix an issue that could potentially cause incorrect\nerror handling for some bytecode instructions.\n\n- gh-99254(3): The compiler now removes all unused constants from\ncode objects (except the first one, which may be a docstring).\n\n- gh-99205(4): Fix an issue that prevented *note PyThreadState: 57a.\nand *note PyInterpreterState: 6d5. memory from being freed\nproperly.\n\n- gh-81057(5): The 18 global C variables holding the state of the\nallocators have been moved to 'PyRuntimeState'.  This is a\nstrictly internal change with no change in behavior.\n\n- gh-99181(6): Fix failure in *note except*: 378. with unhashable\nexceptions.\n\n- gh-99204(7): Fix calculation of 'sys.baseexecutable' when inside\na POSIX virtual environment using copies of the python binary when\nthe base installation does not provide the executable name used by\nthe venv.  Calculation will fall back to alternative names\n(\"python<MAJOR>\", \"python<MAJOR>.<MINOR>\").\n\n- gh-96055(8): Update *note faulthandler: 53. to emit an error\nmessage with the proper unexpected signal number.  Patch by Donghee\nNa.\n\n- gh-99153(9): Fix location of *note SyntaxError: 146. for a *note\ntry: 4bc. block with both *note except: 379. and *note except*:\n378.\n\n- gh-98686(10): Merge the adaptive opcode logic into each\ninstruction's unquickened variant, and merge the logic in\n'EXTENDEDARGQUICK' into *note EXTENDEDARG: 14fa.  With these\nchanges, the quickening that happens at code object creation is now\nonly responsible for initializing warmup counters and inserting\nsuperinstructions.\n\n- gh-99103(11): Fix the error reporting positions of specialized\ntraceback anchors when the source line contains Unicode characters.\n\n- gh-99139(12): Improve the error suggestion for *note NameError:\n144. exceptions for instances.  Now if a *note NameError: 144. is\nraised in a method and the instance has an attribute that's exactly\nequal to the name in the exception, the suggestion will include\n'self.<NAME>' instead of the closest match in the method scope.\nPatch by Pablo Galindo\n\n- gh-98401(13): Octal escapes with value larger than '0o377' (ex:\n'\"\\477\"'), deprecated in Python 3.11, now produce a *note\nSyntaxWarning: 178, instead of *note DeprecationWarning: 179.  In a\nfuture Python version they will be eventually a *note SyntaxError:\n146.  Patch by Victor Stinner.\n\n- gh-98401(14): A backslash-character pair that is not a valid escape\nsequence now generates a *note SyntaxWarning: 178, instead of *note\nDeprecationWarning: 179.  For example, 're.compile(\"\\d+\\.\\d+\")' now\nemits a *note SyntaxWarning: 178. ('\"\\d\"' is an invalid escape\nsequence), use raw strings for regular expression:\n're.compile(r\"\\d+\\.\\d+\")'.  In a future Python version, *note\nSyntaxError: 146. will eventually be raised, instead of *note\nSyntaxWarning: 178.  Patch by Victor Stinner.\n\n- gh-96793(15): Handle StopIteration and StopAsyncIteration raised in\ngenerator or coroutines in the bytecode, rather than in wrapping C\ncode.\n\n- gh-98931(16): Improve the *note SyntaxError: 146. error message\nwhen the user types 'import x from y' instead of 'from y import x'.\nPatch by Pablo Galindo\n\n- gh-98852(17): Fix subscription of type aliases containing bare\ngeneric types or types like *note TypeVar: 164.: for example\n'tuple[A, T][int]' and 'tuple[TypeVar, T][int]', where 'A' is a\ngeneric type, and 'T' is a type variable.\n\n- gh-98925(18): Lower the recursion depth for marshal on WASI to\nsupport (in-development) wasmtime 2.0.\n\n- gh-98783(19): Fix multiple crashes in debug mode when 'str'\nsubclasses are used instead of 'str' itself.\n\n- gh-98811(20): Use complete source locations to simplify detection\nof 'future' imports which are not at the beginning of the file.\nAlso corrects the offset in the exception raised in one case, which\nwas off by one and impeded highlighting.\n\n- gh-96793(21): Add specialization of *note FORITER: 149e. for\ngenerators.  Saves multiple layers of dispatch and checking to get\nfrom the *note FORITER: 149e. instruction in the caller to the\n*note RESUME: 4d7. in the generator.\n\n- gh-98762(22): Fix source locations of *note match: 601.\nsub-patterns.\n\n- gh-98586(23): Added the methods *note PyObjectVectorcall(): 2b6.\nand *note PyObjectVectorcallMethod(): 2b7. to the *note Limited\nAPI: 2ac. along with the auxiliary macro constant *note\nPYVECTORCALLARGUMENTSOFFSET: 2b8.\n\nThe availability of these functions enables more efficient PEP\n590(24) vector calls from binary extension modules that avoid\nargument boxing/unboxing overheads.\n\n- gh-99257(25): Fix an issue where member descriptors (such as those\nfor *note slots: 1344.) could behave incorrectly or crash\ninstead of raising a *note TypeError: 28e. when accessed via an\ninstance of an invalid type.\n\n- gh-93143(26): Rather than changing 'cocode', the interpreter will\nnow display a *note RuntimeWarning: 8c9. and assign *note None:\n43f. to any fast locals that are left unbound after jumps or *note\ndel: 14fb. statements executed while tracing.\n\n- gh-96421(27): When calling into Python code from C code, through\n*note PyEvalEvalFrameEx(): ea5. or a related C-API function, a\nshim frame in inserted into the call stack.  This occurs in the\n'PyEvalEvalFrameDefault()' function.  The extra frame should be\ninvisible to all Python and most C extensions, but out-of-process\nprofilers and debuggers need to be aware of it.  These shim frames\ncan be detected by checking 'frame->owner ==\nFRAMEOWNEDBYCSTACK'.\n\nExtensions implementing their own interpreters using PEP 523 need\nto be aware of this shim frame and the changes to the semantics of\n*note RETURNVALUE: 14fc, *note YIELDVALUE: 14ba, and *note\nRETURNGENERATOR: 4cf, which now clear the frame.\n\n- gh-98415(28): Fix detection of MAC addresses for *note uuid: 10b.\non certain OSs.  Patch by Chaim Sanders\n\n- gh-98686(29): Quicken all code objects, and specialize adaptive\nbytecode instructions more aggressively.\n\n- gh-92119(30): Print exception class name instead of its string\nrepresentation when raising errors from *note ctypes: 28. calls.\n\n- gh-91058(31): *note ImportError: 145. raised from failed 'from\n<module> import <name>' now include suggestions for the value of\n'<name>' based on the available names in '<module>'.  Patch by\nPablo Galindo\n\n- gh-96793(32): The *note FORITER: 149e. now leaves the iterator on\nthe stack on termination of the loop.  This is to assist\nspecialization of loops for generators.\n\n- gh-90716(33): Add pylong.py module.  It includes asymptotically\nfaster algorithms that can be used for operations on integers with\nmany digits.  It is used by longobject.c to speed up some\noperations.\n\n- gh-95389(34): Expose *note ETHPALL: 14fd. and some of the *note\nETHERTYPE* constants: 14fe. in *note socket: c6.  Patch by Noam\nCohen.\n\n- gh-93696(35): Allow *note pdb: a0. to locate source for frozen\nmodules in the standard library.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/81057\n\n(2) https://github.com/python/cpython/issues/99298\n\n(3) https://github.com/python/cpython/issues/99254\n\n(4) https://github.com/python/cpython/issues/99205\n\n(5) https://github.com/python/cpython/issues/81057\n\n(6) https://github.com/python/cpython/issues/99181\n\n(7) https://github.com/python/cpython/issues/99204\n\n(8) https://github.com/python/cpython/issues/96055\n\n(9) https://github.com/python/cpython/issues/99153\n\n(10) https://github.com/python/cpython/issues/98686\n\n(11) https://github.com/python/cpython/issues/99103\n\n(12) https://github.com/python/cpython/issues/99139\n\n(13) https://github.com/python/cpython/issues/98401\n\n(14) https://github.com/python/cpython/issues/98401\n\n(15) https://github.com/python/cpython/issues/96793\n\n(16) https://github.com/python/cpython/issues/98931\n\n(17) https://github.com/python/cpython/issues/98852\n\n(18) https://github.com/python/cpython/issues/98925\n\n(19) https://github.com/python/cpython/issues/98783\n\n(20) https://github.com/python/cpython/issues/98811\n\n(21) https://github.com/python/cpython/issues/96793\n\n(22) https://github.com/python/cpython/issues/98762\n\n(23) https://github.com/python/cpython/issues/98586\n\n(24) https://peps.python.org/pep-0590/\n\n(25) https://github.com/python/cpython/issues/99257\n\n(26) https://github.com/python/cpython/issues/93143\n\n(27) https://github.com/python/cpython/issues/96421\n\n(28) https://github.com/python/cpython/issues/98415\n\n(29) https://github.com/python/cpython/issues/98686\n\n(30) https://github.com/python/cpython/issues/92119\n\n(31) https://github.com/python/cpython/issues/91058\n\n(32) https://github.com/python/cpython/issues/96793\n\n(33) https://github.com/python/cpython/issues/90716\n\n(34) https://github.com/python/cpython/issues/95389\n\n(35) https://github.com/python/cpython/issues/93696\n\nFile: python3.12.info,  Node: Library<17>,  Next: Documentation<17>,  Prev: Core and Builtins<17>,  Up: Python 3 12 0 alpha 2\n\n1.22.17.3 Library\n.................\n\n- gh-99418(1): Fix bug in *note urllib.parse.urlparse(): b96. that\ncauses URL schemes that begin with a digit, a plus sign, or a minus\nsign to be parsed incorrectly.\n\n- gh-94597(2): Deprecate *note asyncio.AbstractChildWatcher: 218. to\nbe removed in Python 3.14.  Patch by Kumar Aditya.\n\n- gh-99305(3): Improve performance of *note secrets.tokenhex():\n1500.\n\n- gh-74044(4): Fixed bug where *note inspect.signature(): 51c.\nreported incorrect arguments for decorated methods.\n\n- gh-99275(5): Fix 'SystemError' in *note ctypes: 28. when exception\nwas not set during 'initsubclass'.\n\n- gh-99277(6): Remove older version of\n'SSLProtocolTransport.getwritebufferlimits' in\n'asyncio.sslproto'\n\n- gh-99248(7): fix negative numbers failing in verify()\n\n- gh-99155(8): Fix *note statistics.NormalDist: 863. pickle with '0'\nand '1' protocols.\n\n- gh-93464(9): 'enum.auto()' is now correctly activated when combined\nwith other assignment values.  E.g.  'ONE = auto(), 'some text''\nwill now evaluate as '(1, 'some text')'.\n\n- gh-99134(10): Update the bundled copy of pip to version 22.3.1.\n\n- gh-92584(11): Remove the 'distutils' package.  It was deprecated in\nPython 3.10 by PEP 632(12) \"Deprecate distutils module\".  For\nprojects still using 'distutils' and cannot be updated to something\nelse, the 'setuptools' project can be installed: it still provides\n'distutils'.  Patch by Victor Stinner.\n\n- gh-98999(13): Now 'pyio' is consistent with 'io' in raising\n'ValueError' when executing methods over closed buffers.\n\n- gh-83004(14): Clean up refleak on failed module initialisation in\n'zoneinfo'\n\n- gh-83004(15): Clean up refleaks on failed module initialisation in\n'pickle'\n\n- gh-83004(16): Clean up refleak on failed module initialisation in\n'io'.\n\n- gh-98897(17): Fix memory leak in *note math.dist(): 82a. when both\npoints don't have the same dimension.  Patch by Kumar Aditya.\n\n- gh-98878(18): Use the frame bound builtins when offering a name\nsuggestion in *note traceback: f9. to prevent crashing when\n'builtins' is not a dict.\n\n- gh-98139(19): In 'importlib.bootstrap', enhance namespace package\nrepr to '<module 'x' (namespace) from ['path']>'.\n\n- gh-90352(20): Fix 'SelectorDatagramTransport' to inherit from\n*note DatagramTransport: 1501. in *note asyncio: 9.  Patch by Kumar\nAditya.\n\n- gh-98793(21): Fix argument typechecks in 'overlapped.WSAConnect()'\nand 'overlapped.Overlapped.WSASendTo()' functions.\n\n- gh-98744(22): Prevent crashing in *note traceback: f9. when\nretrieving the byte-offset for some source files that contain\ncertain unicode characters.\n\n- gh-98740(23): Fix internal error in the *note re: b4. module which\nin very rare circumstances prevented compilation of a regular\nexpression containing a *note conditional expression: 1502. without\nthe \"else\" branch.\n\n- gh-98703(24): Fix *note asyncio.StreamWriter.drain(): 1503. to call\n'protocol.connectionlost' callback only once on Windows.\n\n- gh-98624(25): Add a mutex to unittest.mock.NonCallableMock to\nprotect concurrent access to mock attributes.\n\n- gh-98658(26): The *note array.array: 18f. class now supports\nsubscripting, making it a *note generic type: 13b.\n\n- gh-98284(27): Improved *note TypeError: 28e. message for undefined\nabstract methods of a *note abc.ABC: d7f. instance.  The names of\nthe missing methods are surrounded by single-quotes to highlight\nthem.\n\n- gh-96151(28): Allow 'BUILTINS' to be a valid field name for frozen\ndataclasses.\n\n- gh-98086(29): Make sure 'patch.dict()' can be applied on async\nfunctions.\n\n- gh-72719(30): Remove modules 'asyncore' and 'asynchat', which were\ndeprecated by PEP 594(31).\n\n- gh-96192(32): Fix handling of 'bytes' *note path-like objects: 957.\nin 'os.ismount()'.\n\n- gh-94172(33): *note ftplib: 59.: Remove the 'FTPTLS.sslversion'\nclass attribute: use the 'context' parameter instead.  Patch by\nVictor Stinner\n\n- gh-94172(34): Remove the 'keyfile' and 'certfile' parameters from\nthe *note ftplib: 59, *note imaplib: 6f, *note poplib: a7. and\n*note smtplib: c4. modules, and the 'keyfile', 'certfile' and\n'checkhostname' parameters from the *note http.client: 6a. module,\nall deprecated since Python 3.6.  Use the 'context' parameter\n('sslcontext' in *note imaplib: 6f.) instead.  Patch by Victor\nStinner.\n\n- gh-83638(35): Add the *note autocommit: 1d8. attribute to *note\nsqlite3.Connection: 1d9. and the 'autocommit' parameter to *note\nsqlite3.connect(): 1da. to control PEP 249(36)-compliant *note\ntransaction handling: 1db.  Patch by Erlend E. Aasland.\n\n- gh-92452(37): Fixed a race condition that could cause *note\nsysconfig.getconfigvar(): ea2. to incorrectly return *note None:\n43f. in multi-threaded programs.\n\n- gh-91803(38): Fix an error when using a method of objects mocked\nwith *note unittest.mock.createautospec(): 13b3. after it was\nsealed with *note unittest.mock.seal(): 9e4. function.\n\n- bpo-38523(39): *note shutil.copytree(): 854. now applies the\n'ignoredanglingsymlinks' argument recursively.\n\n- bpo-40358(40): Add walkup argument in *note\npathlib.PurePath.relativeto(): 1c9.\n\n- bpo-36267(41): Fix IndexError in *note argparse.ArgumentParser:\n28f. when a 'storetrue' action is given an explicit argument.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/99418\n\n(2) https://github.com/python/cpython/issues/94597\n\n(3) https://github.com/python/cpython/issues/99305\n\n(4) https://github.com/python/cpython/issues/74044\n\n(5) https://github.com/python/cpython/issues/99275\n\n(6) https://github.com/python/cpython/issues/99277\n\n(7) https://github.com/python/cpython/issues/99248\n\n(8) https://github.com/python/cpython/issues/99155\n\n(9) https://github.com/python/cpython/issues/93464\n\n(10) https://github.com/python/cpython/issues/99134\n\n(11) https://github.com/python/cpython/issues/92584\n\n(12) https://peps.python.org/pep-0632/\n\n(13) https://github.com/python/cpython/issues/98999\n\n(14) https://github.com/python/cpython/issues/83004\n\n(15) https://github.com/python/cpython/issues/83004\n\n(16) https://github.com/python/cpython/issues/83004\n\n(17) https://github.com/python/cpython/issues/98897\n\n(18) https://github.com/python/cpython/issues/98878\n\n(19) https://github.com/python/cpython/issues/98139\n\n(20) https://github.com/python/cpython/issues/90352\n\n(21) https://github.com/python/cpython/issues/98793\n\n(22) https://github.com/python/cpython/issues/98744\n\n(23) https://github.com/python/cpython/issues/98740\n\n(24) https://github.com/python/cpython/issues/98703\n\n(25) https://github.com/python/cpython/issues/98624\n\n(26) https://github.com/python/cpython/issues/98658\n\n(27) https://github.com/python/cpython/issues/98284\n\n(28) https://github.com/python/cpython/issues/96151\n\n(29) https://github.com/python/cpython/issues/98086\n\n(30) https://github.com/python/cpython/issues/72719\n\n(31) https://peps.python.org/pep-0594/\n\n(32) https://github.com/python/cpython/issues/96192\n\n(33) https://github.com/python/cpython/issues/94172\n\n(34) https://github.com/python/cpython/issues/94172\n\n(35) https://github.com/python/cpython/issues/83638\n\n(36) https://peps.python.org/pep-0249/\n\n(37) https://github.com/python/cpython/issues/92452\n\n(38) https://github.com/python/cpython/issues/91803\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=38523\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=40358\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=36267\n\nFile: python3.12.info,  Node: Documentation<17>,  Next: Tests<15>,  Prev: Library<17>,  Up: Python 3 12 0 alpha 2\n\n1.22.17.4 Documentation\n.......................\n\n- gh-98832(1): Changes wording of docstring for *note\npathlib.Path.iterdir(): 1505.\n\n- gh-97966(2): Update uname docs to clarify the special nature of the\nplatform attribute and to indicate when it became late-bound.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/98832\n\n(2) https://github.com/python/cpython/issues/97966\n\nFile: python3.12.info,  Node: Tests<15>,  Next: Build<15>,  Prev: Documentation<17>,  Up: Python 3 12 0 alpha 2\n\n1.22.17.5 Tests\n...............\n\n- gh-98903(1): The Python test suite now fails wit exit code 4 if no\ntests ran.  It should help detecting typos in test names and test\nmethods.\n\n- gh-98713(2): Fix a bug in the *note typing: ff. tests where a test\nrelying on CPython-specific implementation details was not\ndecorated with '@cpythononly' and was not skipped on other\nimplementations.\n\n- gh-87390(3): Add tests for star-unpacking with PEP 646, and some\nother miscellaneous PEP 646 tests.\n\n- gh-96853(4): Added explicit coverage of 'PyInitialize' (and hence\n'PyInitializeEx') back to the embedding tests (all other embedding\ntests migrated to 'PyInitializeFromConfig' in Python 3.11)\n\n- bpo-34272(5): Some C API tests were moved into the new\nLib/test/testcapi/ directory.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/98903\n\n(2) https://github.com/python/cpython/issues/98713\n\n(3) https://github.com/python/cpython/issues/87390\n\n(4) https://github.com/python/cpython/issues/96853\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=34272\n\nFile: python3.12.info,  Node: Build<15>,  Next: Windows<15>,  Prev: Tests<15>,  Up: Python 3 12 0 alpha 2\n\n1.22.17.6 Build\n...............\n\n- gh-99086(1): Fix '-Wimplicit-int' compiler warning in 'configure'\ncheck for 'PTHREADSCOPESYSTEM'.\n\n- gh-99016(2): Fix build with 'PYTHONFORREGEN=python3.8'.\n\n- gh-97731(3): Specify the full path to the source location for 'make\ndocclean' (needed for cross-builds).\n\n- gh-98949(4): Drop unused build dependency on 'readelf'.\n\n- gh-98989(5): Use 'python3.11', if available, for regeneration and\nfreezing.\n\n- gh-98831(6): Add new tooling, in 'Tools/casesgenerator', to\ngenerate the interpreter switch statement from a list of opcode\ndefinitions.  This only affects adding, modifying or removing\ninstruction definitions.  The instruction definitions now live in\n'Python/bytecodes.c', in the form of a custom DSL (under\ndevelopment)(7).  The tooling reads this file and writes\n'Python/generatedcases.c.h', which is then included by\n'Python/ceval.c' to provide most of the cases of the main\ninterpreter switch.\n\n- gh-98817(8): Remove PCbuild/lib.pyproj: it's not used for anything,\nis only a minor convenience for Visual Studio users (who probably\nmostly don't even know about it), and it takes a lot of maintenance\neffort to keep updated.\n\n- gh-98776(9): Fix 'make regen-test-levenshtein' for out-of-tree\nbuilds.\n\n- gh-98707(10): Don't use vendored 'libmpdec' headers if *note\n-with-system-libmpdec: 1508. is passed to 'configure'.  Don't use\nvendored 'libexpat' headers if *note -with-system-expat: 1509. is\npassed to 'configure'.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/99086\n\n(2) https://github.com/python/cpython/issues/99016\n\n(3) https://github.com/python/cpython/issues/97731\n\n(4) https://github.com/python/cpython/issues/98949\n\n(5) https://github.com/python/cpython/issues/98989\n\n(6) https://github.com/python/cpython/issues/98831\n\n(7)\nhttps://github.com/faster-cpython/ideas/blob/main/3.12/interpreterdefinition.md\n\n(8) https://github.com/python/cpython/issues/98817\n\n(9) https://github.com/python/cpython/issues/98776\n\n(10) https://github.com/python/cpython/issues/98707\n\nFile: python3.12.info,  Node: Windows<15>,  Next: macOS<11>,  Prev: Build<15>,  Up: Python 3 12 0 alpha 2\n\n1.22.17.7 Windows\n.................\n\n- gh-98689(1): Update Windows builds to zlib v1.2.13.  v1.2.12 has\nCVE-2022-37434, but the vulnerable 'inflateGetHeader' API is not\nused by Python.\n\n- gh-98790(2): Assumes that a missing 'DLLs' directory means that\nstandard extension modules are in the executable's directory.\n\n- gh-98745(3): Update 'py.exe' launcher to install 3.11 by default\nand 3.12 on request.\n\n- gh-98692(4): Fix the *note Python Launcher for Windows: 37f.\nignoring unrecognized shebang lines instead of treating them as\nlocal paths\n\n- gh-94328(5): Update Windows installer to use SQLite 3.39.4.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/98689\n\n(2) https://github.com/python/cpython/issues/98790\n\n(3) https://github.com/python/cpython/issues/98745\n\n(4) https://github.com/python/cpython/issues/98692\n\n(5) https://github.com/python/cpython/issues/94328\n\nFile: python3.12.info,  Node: macOS<11>,  Next: C API<13>,  Prev: Windows<15>,  Up: Python 3 12 0 alpha 2\n\n1.22.17.8 macOS\n...............\n\n- gh-94328(1): Update macOS installer to SQLite 3.39.4.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/94328\n\nFile: python3.12.info,  Node: C API<13>,  Prev: macOS<11>,  Up: Python 3 12 0 alpha 2\n\n1.22.17.9 C API\n...............\n\n- gh-98724(1): The *note PyCLEAR: 2da, *note PySETREF: 2db. and\n*note PyXSETREF: 2dc. macros now only evaluate their argument\nonce.  If the argument has side effects, these side effects are no\nlonger duplicated.  Patch by Victor Stinner.\n\n- gh-98978(2): Fix use-after-free in 'PySetPythonHome(NULL)',\n'PySetProgramName(NULL)' and 'PySetProgramFullPath(NULL)'\nfunction calls.  Issue reported by Benedikt Reinartz.  Patch by\nVictor Stinner.\n\n- gh-98410(3): Add 'getbufferproc' and 'releasebufferproc' to the\nstable API.\n\n- gh-98610(4): Some configurable capabilities of sub-interpreters\nhave changed.  They always allow subprocesses (*note subprocess:\nd0.) now, whereas before subprocesses could be optionally\ndisallowed for a sub-interpreter.  Instead 'os.exec()' can now be\ndisallowed.  Disallowing daemon threads is now supported.\nDisallowing all threads is still allowed, but is never done by\ndefault.  Note that the optional restrictions are only available\nthrough 'PyNewInterpreterFromConfig()', which isn't a public API.\nThey do not affect the main interpreter, nor *note\nPyNewInterpreter(): 150d.\n\n- gh-98608(5): A 'PyInterpreterConfig' has been added and\n'PyNewInterpreter()' has been renamed to\n'PyNewInterpreterFromConfig()'.  The \"isolatedsubinterpreters\"\nargument is now a granular config that captures the previous\nbehavior.  Note that this is all \"private\" API.\n\n- gh-96853(6): 'PyInitializeEx' now correctly calls 'PyConfigClear'\nafter initializing the interpreter (the omission didn't cause a\nmemory leak only because none of the dynamically allocated config\nfields are populated by the wrapper function)\n\n- gh-91248(7): Add *note PyFrameGetVar(): 2c3. and *note\nPyFrameGetVarString(): 2c4. functions to get a frame variable by\nits name.  Patch by Victor Stinner.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/98724\n\n(2) https://github.com/python/cpython/issues/98978\n\n(3) https://github.com/python/cpython/issues/98410\n\n(4) https://github.com/python/cpython/issues/98610\n\n(5) https://github.com/python/cpython/issues/98608\n\n(6) https://github.com/python/cpython/issues/96853\n\n(7) https://github.com/python/cpython/issues/91248\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 12 0 alpha 1,  Next: Python 3 11 0 beta 1,  Prev: Python 3 12 0 alpha 2,  Up: Changelog": {
            "content": "'Release date: 2022-10-25'\n\n* Menu:\n\n* Security: Security<12>.\n* Core and Builtins: Core and Builtins<18>.\n* Library: Library<18>.\n* Documentation: Documentation<18>.\n* Tests: Tests<16>.\n* Build: Build<16>.\n* Windows: Windows<16>.\n* macOS: macOS<12>.\n* IDLE: IDLE<8>.\n* Tools/Demos: Tools/Demos<11>.\n* C API: C API<14>.\n\nFile: python3.12.info,  Node: Security<12>,  Next: Core and Builtins<18>,  Up: Python 3 12 0 alpha 1\n\n1.22.18.1 Security\n..................\n\n- gh-97616(1): Fix multiplying a list by an integer ('list *= int'):\ndetect the integer overflow when the new allocated length is close\nto the maximum size.  Issue reported by Jordan Limor.  Patch by\nVictor Stinner.\n\n- gh-97514(2): On Linux the *note multiprocessing: 8f. module returns\nto using filesystem backed unix domain sockets for communication\nwith the 'forkserver' process instead of the Linux abstract socket\nnamespace.  Only code that chooses to use the *note \"forkserver\"\nstart method: 22d. is affected.\n\nAbstract sockets have no permissions and could allow any user on\nthe system in the same network namespace(3) (often the whole\nsystem) to inject code into the multiprocessing 'forkserver'\nprocess.  This was a potential privilege escalation.  Filesystem\nbased socket permissions restrict this to the 'forkserver' process\nuser as was the default in Python 3.8 and earlier.\n\nThis prevents Linux CVE-2022-42919(4).\n\n- gh-87389(5): *note http.server: 6d.: Fix an open redirection\nvulnerability in the HTTP server when an URI path starts with '//'.\nVulnerability discovered, and initial fix proposed, by Hamza Avvan.\n\n- gh-79096(6): LWPCookieJar and MozillaCookieJar create files with\nfile mode 600 instead of 644 (Microsoft Windows is not affected)\n\n- gh-92888(7): Fix 'memoryview' use after free when accessing the\nbacking buffer in certain cases.\n\n- gh-68966(8): The deprecated mailcap module now refuses to inject\nunsafe text (filenames, MIME types, parameters) into shell\ncommands.  Instead of using such text, it will warn and act as if a\nmatch was not found (or for test commands, as if the test failed).\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/97616\n\n(2) https://github.com/python/cpython/issues/97514\n\n(3) https://man7.org/linux/man-pages/man7/networknamespaces.7.html\n\n(4) https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-42919\n\n(5) https://github.com/python/cpython/issues/87389\n\n(6) https://github.com/python/cpython/issues/79096\n\n(7) https://github.com/python/cpython/issues/92888\n\n(8) https://github.com/python/cpython/issues/68966\n\nFile: python3.12.info,  Node: Core and Builtins<18>,  Next: Library<18>,  Prev: Security<12>,  Up: Python 3 12 0 alpha 1\n\n1.22.18.2 Core and Builtins\n...........................\n\n- gh-98374(1): Suppress ImportError for invalid query for help()\ncommand.  Patch by Donghee Na.\n\n- gh-98461(2): Fix source location in bytecode for list, set and dict\ncomprehensions as well as generator expressions.\n\n- gh-98354(3): Added unicode check for 'name' attribute of 'spec'\nargument passed in 'imp.createbuiltin()' function.\n\n- gh-98398(4): Fix source location of 'assert' bytecodes.\n\n- gh-98390(5): Fix location of sub-expressions of boolean\nexpressions, by reducing their scope to that of the sub-expression.\n\n- gh-98254(6): Modules from the standard library are now potentially\nsuggested as part of the error messages displayed by the\ninterpreter when an *note NameError: 144. is raised to the top\nlevel.  Patch by Pablo Galindo\n\n- gh-97997(7): Add running column offset to the tokenizer state to\navoid calculating AST column information with pointer arithmetic.\n\n- gh-97973(8): Modify the tokenizer to return all necessary\ninformation the parser needs to set location information in the AST\nnodes, so that the parser does not have to calculate those doing\npointer arithmetic.\n\n- gh-96078(9): *note os.schedyield(): f81. now release the GIL while\ncalling schedyield(2).  Patch by Donghee Na.\n\n- gh-97955(10): Migrate *note zoneinfo: 12e. to Argument Clinic.\n\n- gh-97912(11): The compiler now avoids quadratic behavior when\nfinding which instructions should use the *note LOADFASTCHECK:\n20e. opcode.\n\n- gh-97002(12): Fix an issue where several frame objects could be\nbacked by the same interpreter frame, possibly leading to corrupted\nmemory and hard crashes of the interpreter.\n\n- gh-97943(13): Bugfix: *note PyFunctionGetAnnotations(): 1511.\nshould return a borrowed reference.  It was returning a new\nreference.\n\n- gh-97922(14): The Garbage Collector now runs only on the eval\nbreaker mechanism of the Python bytecode evaluation loop instead on\nobject allocations.  The GC can also run when *note\nPyErrCheckSignals(): 17c. is called so C extensions that need to\nrun for a long time without executing any Python code also have a\nchance to execute the GC periodically.\n\n- gh-65961(15): When 'package' is different than\n'spec.parent', raise a 'DeprecationWarning' instead of\n'ImportWarning'.\n\nAlso remove 'importlib.util.setpackage()' which was scheduled for\nremoval.\n\n- gh-97850(16): Long deprecated, 'modulerepr()' should now be\ncompletely eradicated.\n\n- gh-86298(17): In cases where 'warnings.warnexplicit()' consults\nthe module's loader, an 'DeprecationWarning' is issued when\n'm.loader' differs from 'm.spec.loader'.\n\n- gh-97779(18): Ensure that all Python frame objects are backed by\n\"complete\" frames.\n\n- gh-91052(19): Add API for subscribing to modification events on\nselected dictionaries.\n\n- gh-97752(20): Fix possible data corruption or crashes when\naccessing the 'fback' member of newly-created generator or\ncoroutine frames.\n\n- gh-97591(21): Fixed a missing incref/decref pair in\n'Exception.setstate()'.  Patch by Ofey Chan.\n\n- gh-97670(22): Remove the 'sys.getdxp()' function and the\n'Tools/scripts/analyzedxp.py' script.  DXP stands for \"dynamic\nexecution pairs\".  They were related to 'DYNAMICEXECUTIONPROFILE'\nand 'DXPAIRS' macros which have been removed in Python 3.11.\nPython can now be built with *note ./configure -enable-pystats:\n1512. to gather statistics on Python opcodes.  Patch by Victor\nStinner.\n\n- gh-94526(23): Fix the Python path configuration used to initialized\n*note sys.path: 32c. at Python startup.  Paths are no longer\nencoded to UTF-8/strict to avoid encoding errors if it contains\nsurrogate characters (bytes paths are decoded with the\nsurrogateescape error handler).  Patch by Victor Stinner.\n\n- gh-96670(24): The parser now raises *note SyntaxError: 146. when\nparsing source code containing null bytes.  Patch by Pablo Galindo\n\n- gh-96975(25): Fix a crash occurring when *note PyEvalGetFrame():\n1513. is called while the topmost Python frame is in a\npartially-initialized state.\n\n- gh-96848(26): Fix command line parsing: reject *note -X\nintmaxstrdigits: 188. option with no value (invalid) when the\n*note PYTHONINTMAXSTRDIGITS: 1514. environment variable is set to a\nvalid limit.  Patch by Victor Stinner.\n\n- gh-95921(27): Fix overly-broad source position information for\nchained comparisons used as branching conditions.\n\n- gh-96821(28): Fix undefined behaviour in 'audioop.c'.\n\n- gh-96821(29): Fix undefined behaviour in 'testcapimodule.c'.\n\n- gh-95778(30): When *note ValueError: 183. is raised if an integer\nis larger than the limit, mention the *note\nsys.setintmaxstrdigits(): 1515. function in the error message.\nPatch by Victor Stinner.\n\n- gh-96387(31): At Python exit, sometimes a thread holding the GIL\ncan wait forever for a thread (usually a daemon thread) which\nrequested to drop the GIL, whereas the thread already exited.  To\nfix the race condition, the thread which requested the GIL drop now\nresets its request before exiting.  Issue discovered and analyzed\nby Mingliang ZHAO. Patch by Victor Stinner.\n\n- gh-96864(32): Fix a possible assertion failure, fatal error, or\n*note SystemError: 2d7. if a line tracing event raises an exception\nwhile opcode tracing is enabled.\n\n- gh-95778(33): The 'PyLongFromString' function was refactored to\nmake it more maintainable and extensible.\n\n- gh-96678(34): Fix undefined behaviour in C code of null pointer\narithmetic.\n\n- gh-96754(35): Make sure that all frame objects created are created\nfrom valid interpreter frames.  Prevents the possibility of invalid\nframes in backtraces and signal handlers.\n\n- gh-90997(36): Improve the performance of reading and writing inline\nbytecode caches on some platforms.\n\n- gh-96751(37): Remove dead code from 'CALLFUNCTIONEX' opcode.\n\n- gh-90751(38): *note memoryview: 17f. now supports half-floats.\nPatch by Donghee Na and Antoine Pitrou.\n\n- gh-96678(39): Fix case of undefined behavior in ceval.c\n\n- gh-64373(40): Convert 'functools' to argument clinic.\n\n- gh-96641(41): Do not expose 'KeyWrapper' in 'functools'.\n\n- gh-96636(42): Ensure that tracing, 'sys.setrace()', is turned on\nimmediately.  In pre-release versions of 3.11, some tracing events\nmight have been lost when turning on tracing in a 'del' method\nor interrupt.\n\n- gh-96572(43): Fix use after free in trace refs build mode.  Patch\nby Kumar Aditya.\n\n- gh-96611(44): When loading a file with invalid UTF-8 inside a\nmulti-line string, a correct SyntaxError is emitted.\n\n- gh-96612(45): Make sure that incomplete frames do not show up in\ntracemalloc traces.\n\n- gh-90230(46): Fix compiler warnings and test failures when building\nwith '--enable-pystats'.\n\n- gh-96587(47): Correctly raise 'SyntaxError' on exception groups (\nPEP 654(48)) on python versions prior to 3.11\n\n- gh-96569(49): Remove two cases of undefined behavoir, by adding\nNULL checks.\n\n- gh-96582(50): Fix possible 'NULL' pointer dereference in\n'PyThreadCurrentFrames'.  Patch by Kumar Aditya.\n\n- gh-91079(51): Separate Python recursion checking from C recursion\nchecking which reduces the chance of C stack overflow and allows\nthe recursion limit to be increased safely.\n\n- gh-93911(52): Fix an issue that could prevent *note LOADATTR: 207.\nfrom specializing properly when accessing properties.\n\n- gh-96348(53): Emit a DeprecationWarning when *note throw(): 241,\n*note throw(): 240. or *note athrow(): 242. are called with more\nthan one argument.\n\n- gh-95196(54): Disable incorrect pickling of the C implemented\nclassmethod descriptors.\n\n- gh-96364(55): Fix text signatures of 'list.getitem' and\n'dict.getitem'.\n\n- gh-96352(56): Fix *note AttributeError: 395. missing 'name' and\n'obj' attributes in *note object.getattribute(): a16.  Patch by\nPhilip Georgi.\n\n- gh-93554(57): Change the jump opcodes so that all conditional jumps\nare forward jumps.  Backward jumps are converted by the assembler\ninto a conditional forward jump whose target is the fallthrough\nblock (and with a reversed condition), followed by an unconditional\nbackward jump.  For example:\n\n'POPJUMPIFTRUE BACKWARDTARGET' becomes 'POPJUMPIFFALSE\nNEXTBLOCK; JUMP BACKWARDTARGET'.\n\nAll the directed conditional jump opcodes were removed:\n'POPJUMPFORWARDIFTRUE', 'POPJUMPBACKWARDIFTRUE',\n'POPJUMPFORWARDIFFALSE', 'POPJUMPBACKWARDIFFALSE',\n'POPJUMPFORWARDIFNONE', 'POPJUMPBACKWARDIFNONE',\n'POPJUMPFORWARDIFNOTNONE', 'POPJUMPBACKWARDIFNOTNONE'.\n\nThe corresponding opcodes without direction are no longer\npseudo-instructions, and they implement the forward conditional\njumps.\n\n- gh-96268(58): Loading a file with invalid UTF-8 will now report the\nbroken character at the correct location.\n\n- gh-96237(59): The internal field 'PyInterpreterFrame.ffunc' is\nrenamed to 'PyInterpreterFrame.ffuncobj' and may be any object.\nThe 'fglobals' and 'fbuiltin' fields may hold junk values.\n\nIt is safest to treat the 'PyInterpreterFrame' struct as opaque.\n\n- gh-96187(60): Fixed a bug that caused 'PyCodeGetExtra' to return\ngarbage for negative indexes.  Patch by Pablo Galindo\n\n- gh-96143(61): Add a new '-X perf' Python command line option as\nwell as *note sys.activatestacktrampoline(): 189. and *note\nsys.deactivatestacktrampoline(): 18a. function in the *note sys:\nd3. module that allows to set/unset the interpreter in a way that\nthe Linux 'perf' profiler can detect Python calls.  The new *note\nsys.isstacktrampolineactive(): 18b. function allows to query the\nstate of the perf trampoline.  Design by Pablo Galindo.  Patch by\nPablo Galindo and Christian Heimes with contributions from Gregory\nP. Smith [Google] and Mark Shannon.\n\n- gh-96071(62): Fix a deadlock in *note PyGILStateEnsure(): 8bf.\nwhen allocating new thread state.  Patch by Kumar Aditya.\n\n- gh-96046(63): *note PyTypeReady(): 567. now initializes\n'htcachedkeys' and performs additional checks to ensure that type\nobjects are properly configured.  This avoids crashes in 3rd party\npackages that don't use regular API to create new types.\n\n- gh-96005(64): On WASI *note ENOTCAPABLE: 1516. is now mapped to\n*note PermissionError: b9a.  The *note errno: 52. modules exposes\nthe new error number.  'getpath.py' now ignores *note\nPermissionError: b9a. when it cannot open landmark files\n'pybuilddir.txt' and 'pyenv.cfg'.\n\n- gh-93678(65): Added test a harness for direct unit tests of the\ncompiler's optimization stage.  The\n'testinternalcapi.optimizecfg()' function runs the optimiser on a\nsequence of instructions.  The 'CfgOptimizationTestCase' class in\n'test.support' has utilities for invoking the optimizer and\nchecking the output.\n\n- gh-95245(66): Reduces the size of a \"simple\" Python object from 8\nto 6 words by moving the weakreflist pointer into the pre-header\ndirectly before the object's dict/values pointer.\n\n- gh-90997(67): Compile virtual *note try: 4bc./*note except: 379.\nblocks to handle exceptions raised during *note close(): 1517. or\n*note throw(): 241. calls through a suspended frame.\n\n- gh-95977(68): Optimized calling *note get(): 1518. with\nvectorcall.  Patch by Kumar Aditya.\n\n- gh-91210(69): Improve error message when a parameter without a\ndefault value follows one with a default value, and show the same\nmessage, even when the non-default/default sequence is preceded by\npositional-only parameters.\n\n- gh-95922(70): Fixed bug where the compiler's\n'eliminateemptybasicblocks' function ignores the last block of\nthe code unit.\n\n- gh-95818(71): Skip over incomplete frames in *note\nPyThreadStateGetFrame(): 57b.\n\n- gh-95876(72): Fix format string in\n'PyPegenraiseerrorknownlocation' that can lead to memory\ncorruption on some 64bit systems.  The function was building a\ntuple with 'i' (int) instead of 'n' (Pyssizet) for Pyssizet\narguments.\n\n- gh-95605(73): Fix misleading contents of error message when\nconverting an all-whitespace string to *note float: 4b7.\n\n- gh-95150(74): Update code object hashing and equality to consider\nall debugging and exception handling tables.  This fixes an issue\nwhere certain non-identical code objects could be \"deduplicated\"\nduring compilation.\n\n- gh-91146(75): Reduce allocation size of *note list: 3dc. from *note\nstr.split(): d0e. and *note str.rsplit(): 10cd.  Patch by Donghee\nNa and Inada Naoki.\n\n- gh-87092(76): Create a 'jump target label' abstraction in the\ncompiler so that the compiler's codegen stage does not work\ndirectly with basic blocks.  This prepares the code for changes to\nthe underlying CFG generation mechanism.\n\n- gh-95355(77): 'PyPegenParserNew' now properly detects token\nmemory allocation errors.  Patch by Honglin Zhu.\n\n- gh-90081(78): Run Python code in tracer/profiler function at full\nspeed.  Fixes slowdown in earlier versions of 3.11.\n\n- gh-95324(79): Emit a warning in debug mode if an object does not\ncall *note PyObjectGCUnTrack(): 1361. before deallocation.  Patch\nby Pablo Galindo.\n\n- gh-95245(80): Merge managed dict and values pointer into a single\ntagged pointer to save one word in the pre-header.\n\n- gh-93678(81): Add cfgbuilder struct and refactor the relevant code\nso that a cfg can be constructed without an instance of the\ncompiler struct.\n\n- gh-95185(82): Prevented crashes in the AST constructor when\ncompiling some absurdly long expressions like '\"+0\"*1000000'.\n*note RecursionError: bc6. is now raised instead.  Patch by Pablo\nGalindo\n\n- gh-93351(83): *note ast.AST: 527. node positions are now validated\nwhen provided to *note compile(): 528. and other related functions.\nIf invalid positions are detected, a *note ValueError: 183. will be\nraised.\n\n- gh-94438(84): Fix an issue that caused extended opcode arguments\nand some conditional pops to be ignored when calculating valid jump\ntargets for assignments to the 'flineno' attribute of frame\nobjects.  In some cases, this could cause inconsistent internal\nstate, resulting in a hard crash of the interpreter.\n\n- gh-95060(85): Undocumented 'PyCodeAddr2Location' function now\nproperly returns when 'addrq' argument is less than zero.\n\n- gh-95113(86): Replace all 'EXTENDEDARGQUICK' instructions with\nbasic *note EXTENDEDARG: 14fa. instructions in unquickened code.\nConsumers of non-adaptive bytecode should be able to handle\nextended arguments the same way they were handled in CPython 3.10\nand older.\n\n- gh-91409(87): Fix incorrect source location info caused by certain\noptimizations in the bytecode compiler.\n\n- gh-95023(88): Implement *note os.setns(): 1519. and *note\nos.unshare(): 151a. for Linux.  Patch by Noam Cohen.\n\n- gh-94036(89): Fix incorrect source location info for some\nmulti-line attribute accesses and method calls.\n\n- gh-94938(90): Fix error detection in some builtin functions when\nkeyword argument name is an instance of a str subclass with\noverloaded 'eq' and 'hash'.  Previously it could cause\nSystemError or other undesired behavior.\n\n- gh-94996(91): *note ast.parse(): 182. will no longer parse function\ndefinitions with positional-only params when passed\n'featureversion' less than '(3, 8)'.  Patch by Shantanu Jain.\n\n- gh-94739(92): Allow jumping within, out of, and across exception\nhandlers in the debugger.\n\n- gh-94949(93): *note ast.parse(): 182. will no longer parse\nparenthesized context managers when passed 'featureversion' less\nthan '(3, 9)'.  Patch by Shantanu Jain.\n\n- gh-94947(94): *note ast.parse(): 182. will no longer parse\nassignment expressions when passed 'featureversion' less than '(3,\n8)'.  Patch by Shantanu Jain.\n\n- gh-91256(95): Ensures the program name is known for help text\nduring interpreter startup.\n\n- gh-94869(96): Fix the column offsets for some expressions in\nmulti-line f-strings *note ast: 8. nodes.  Patch by Pablo Galindo.\n\n- gh-94893(97): Fix an issue where frame object manipulations could\ncorrupt inline bytecode caches.\n\n- gh-94822(98): Fix an issue where lookups of metaclass descriptors\nmay be ignored when an identically-named attribute also exists on\nthe class itself.\n\n- gh-91153(99): Fix an issue where a *note bytearray: 294. item\nassignment could crash if it's resized by the new value's\n'index()' method.\n\n- gh-90699(100): Fix reference counting bug in 'bool.repr()'.\nPatch by Kumar Aditya.\n\n- gh-94694(101): Fix an issue that could cause code with multi-line\nmethod lookups to have misleading or incorrect column offset\ninformation.  In some cases (when compiling a hand-built AST) this\ncould have resulted in a hard crash of the interpreter.\n\n- gh-93252(102): Fix an issue that caused internal frames to outlive\nfailed Python function calls, possibly resulting in memory leaks or\nhard interpreter crashes.\n\n- gh-94215(103): Fix an issue where exceptions raised by line-tracing\nevents would cause frames to be left in an invalid state, possibly\nresulting in a hard crash of the interpreter.\n\n- gh-92228(104): Disable the compiler's inline-small-exit-blocks\noptimization for exit blocks that are associated with source code\nlines.  This fixes a bug where the debugger cannot tell where an\nexception handler ends and the following code block begins.\n\n- gh-94485(105): Line number of a module's 'RESUME' instruction is\nset to 0 as specified in PEP 626(106).\n\n- gh-94438(107): Account for instructions that can push NULL to the\nstack when setting line number in a frame.  Prevents some\n(unlikely) crashes.\n\n- gh-91719(108): Reload 'opcode' when raising 'unknown opcode error'\nin the interpreter main loop, for C compilers to generate\ndispatching code independently.\n\n- gh-94329(109): Compile and run code with unpacking of extremely\nlarge sequences (1000s of elements).  Such code failed to compile.\nIt now compiles and runs correctly.\n\n- gh-94360(110): Fixed a tokenizer crash when reading encoded files\nwith syntax errors from 'stdin' with non utf-8 encoded text.  Patch\nby Pablo Galindo\n\n- gh-88116(111): Fix an issue when reading line numbers from code\nobjects if the encoded line numbers are close to 'INTMIN'.  Patch\nby Pablo Galindo\n\n- gh-94262(112): Don't create frame objects for incomplete frames.\nPrevents the creation of generators and closures from being\nobservable to Python and C extensions, restoring the behavior of\n3.10 and earlier.\n\n- gh-94192(113): Fix error for dictionary literals with invalid\nexpression as value.\n\n- gh-87995(114): *note types.MappingProxyType: 186. instances are now\nhashable if the underlying mapping is hashable.\n\n- gh-93883(115): Revise the display strategy of traceback enhanced\nerror locations.  The indicators are only shown when the location\ndoesn't span the whole line.\n\n- gh-94163(116): Add *note BINARYSLICE: 208. and *note STORESLICE:\n209. instructions for more efficient handling and better\nspecialization of slicing operations, where the slice is explicit\nin the source code.\n\n- gh-94021(117): Fix unreachable code warning in\n'Python/specialize.c'.\n\n- gh-93911(118): Specialize 'LOADATTR' for objects with custom\n'getattribute'.\n\n- gh-93955(119): Improve performance of attribute lookups on objects\nwith custom 'getattribute' and 'getattr'.  Patch by Ken\nJin.\n\n- gh-93911(120): Specialize 'LOADATTR' for 'property()' attributes.\n\n- gh-93678(121): Refactor compiler optimisation code so that it no\nlonger needs the 'struct assembler' and 'struct compiler' passed\naround.  Instead, each function takes the CFG and other data that\nit actually needs.  This will make it possible to test this code\ndirectly.\n\n- gh-93841(122): When built with '-enable-pystats',\n'sys.statson()', 'sys.statsoff()', 'sys.statsclear()' and\n'sys.statsdump()' functions have been added to enable gathering\nstats for parts of programs.\n\n- gh-93516(123): Store offset of first traceable instruction in code\nobject to avoid having to recompute it for each instruction when\ntracing.\n\n- gh-93516(124): Lazily create a table mapping bytecode offsets to\nline numbers to speed up calculation of line numbers when tracing.\n\n- gh-89828(125): *note types.GenericAlias: 5df. no longer relays the\n'class' attribute.  For example, 'isinstance(list[int], type)'\nno longer returns 'True'.\n\n- gh-93678(126): Refactor the compiler to reduce boilerplate and\nrepetition.\n\n- gh-93671(127): Fix some exponential backtrace case happening with\ndeeply nested sequence patterns in match statements.  Patch by\nPablo Galindo\n\n- gh-93662(128): Make sure that the end column offsets are correct in\nmulti-line method calls.  Previously, the end column could precede\nthe column offset.\n\n- gh-93461(129): *note importlib.invalidatecaches(): a56. now drops\nentries from *note sys.pathimportercache: 3a9. with a relative\npath as name.  This solves a caching issue when a process changes\nits current working directory.\n\n'FileFinder' no longer inserts a dot in the path, e.g.\n'/egg/./spam' is now '/egg/spam'.\n\n- gh-93621(130): Change order of bytecode instructions emitted for\n*note with: 396. and *note async with: 399. to reduce the number of\nentries in the exception table.\n\n- gh-93533(131): Reduce the size of the inline cache for\n'LOADMETHOD' by 2 bytes.\n\n- gh-93444(132): Removed redundant fields from the compiler's\nbasicblock struct: 'bnofallthrough', 'bexit', 'breturn'.  They\ncan be easily calculated from the opcode of the last instruction of\nthe block.\n\n- gh-93429(133): 'LOADMETHOD' instruction has been removed.  It was\nmerged back into 'LOADATTR'.\n\n- gh-93418(134): Fixed an assert where an f-string has an equal sign\n'=' following an expression, but there's no trailing brace.  For\nexample, f\"{i=\".\n\n- gh-93382(135): Cache the result of *note PyCodeGetCode(): 563.\nfunction to restore the 'O'(1) lookup of the 'cocode' attribute.\n\n- gh-93359(136): Ensure that custom *note ast: 8. nodes without\nexplicit end positions can be compiled.  Patch by Pablo Galindo.\n\n- gh-93356(137): Code for exception handlers is emitted at the end of\nthe code unit's bytecode.  This avoids one jump when no exception\nis raised.\n\n- gh-93354(138): Use exponential backoff for specialization counters\nin the interpreter.  Can reduce the number of failed\nspecializations significantly and avoid slowdown for those parts of\na program that are not suitable for specialization.\n\n- gh-93283(139): Improve error message for invalid syntax of\nconversion character in f-string expressions.\n\n- gh-93345(140): Fix a crash in substitution of a 'TypeVar' in nested\ngeneric alias after 'TypeVarTuple'.\n\n- gh-93223(141): When a bytecode instruction jumps to an\nunconditional jump instruction, the first instruction can often be\noptimized to target the unconditional jump's target directly.  For\ntracing reasons, this would previously only occur if both\ninstructions have the same line number.  This also now occurs if\nthe unconditional jump is artificial, i.e., if it has no associated\nline number.\n\n- gh-84694(142): The '--experimental-isolated-subinterpreters'\nconfigure option and 'EXPERIMENTALISOLATEDSUBINTERPRETERS' macro\nhave been removed.\n\n- gh-91924(143): Fix 'lltrace' debug feature if the stdout\nencoding is not UTF-8.  Patch by Victor Stinner.\n\n- gh-93040(144): Wraps unused parameters in 'Objects/obmalloc.c' with\n'PyUNUSED'.\n\n- gh-93143(145): Avoid 'NULL' checks for uninitialized local\nvariables by determining at compile time which variables must be\ninitialized.\n\n- gh-93061(146): Backward jumps after 'async for' loops are no longer\ngiven dubious line numbers.\n\n- gh-93065(147): Fix contextvars HAMT implementation to handle\niteration over deep trees.\n\nThe bug was discovered and fixed by Eli Libman.  See\nMagicStack/immutables#84(148) for more details.\n\n- gh-93012(149): Added the new function *note PyTypeFromMetaclass():\n2a9, which generalizes the existing *note\nPyTypeFromModuleAndSpec(): 2aa. using an additional metaclass\nargument.  This is useful for language binding tools, where it can\nbe used to intercept type-related operations like subclassing or\nstatic attribute access by specifying a metaclass with custom\nslots.\n\nImportantly, *note PyTypeFromMetaclass(): 2a9. is available in the\nLimited API, which provides a path towards migrating more binding\ntools onto the Stable ABI.\n\n- gh-93021(150): Fix the 'textsignature' for 'get()' methods\nimplemented in C. Patch by Jelle Zijlstra.\n\n- gh-89914(151): The operand of the 'YIELDVALUE' instruction is set\nto the stack depth.  This is done to help frame handling on 'yield'\nand may assist debuggers.\n\n- gh-92955(152): Fix memory leak in code object's lines and positions\niterators as they were not finalized at exit.  Patch by Kumar\nAditya.\n\n- gh-92930(153): Fixed a crash in 'pickle.c' from mutating\ncollections during 'reduce' or 'persistentid'.\n\n- gh-90690(154): The PRECALL instruction has been removed.  It\noffered only a small advantage for specialization and is not needed\nin the vast majority of cases.\n\n- gh-92914(155): Always round the allocated size for lists up to the\nnearest even number.\n\n- gh-92858(156): Improve error message for some suites with syntax\nerror before ':'\n\n- gh-90473(157): Decrease default recursion limit on WASI to address\nlimited call stack size.\n\n- gh-92804(158): Fix memory leak in 'memoryview' iterator as it was\nnot finalized at exit.  Patch by Kumar Aditya.\n\n- gh-92777(159): Specialize 'LOADMETHOD' for objects with lazy\ndictionaries.  Patch by Ken Jin.\n\n- gh-92658(160): Add support for connecting and binding to Hyper-V\nsockets on Windows Hyper-V hosts and guests.\n\n- gh-92236(161): Remove spurious \"LINE\" event when starting a\ngenerator or coroutine, visible tracing functions implemented in C.\n\n- gh-91102(162): 'warnings.warnexplicit()' is ported to Argument\nClinic.\n\n- gh-92619(163): Make the compiler duplicate an exit block only if\nnone of its instructions have a lineno (previously only the first\ninstruction in the block was checked, leading to unnecessarily\nduplicated blocks).\n\n- gh-88750(164): The deprecated debug build only 'PYTHONTHREADDEBUG'\nenvironment variable no longer does anything.\n\n- gh-92261(165): Fix hang when trying to iterate over a\n'typing.Union'.\n\n- gh-91432(166): Specialized the *note FORITER: 149e. opcode using\nthe PEP 659 machinery\n\n- gh-91399(167): Removed duplicate '{0, 0, 0, 0, 0, 0}' entry in\n'Objects/unicodetypedb.h'.\n\n- gh-91578(168): Updates the error message for abstract class.\n\n- bpo-47091(169): Improve performance of repetition of *note list:\n3dc. and *note tuple: 4b8. by using 'memcpy' to copy data and\nperforming the reference increments in one step.\n\n- bpo-46142(170): Make '--help' output shorter by moving some info to\nthe new '--help-env' and '--help-xoptions' command-line options.\nAlso add '--help-all' option to print complete usage.\n\n- bpo-42316(171): Document some places where an assignment expression\nneeds parentheses.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/98374\n\n(2) https://github.com/python/cpython/issues/98461\n\n(3) https://github.com/python/cpython/issues/98354\n\n(4) https://github.com/python/cpython/issues/98398\n\n(5) https://github.com/python/cpython/issues/98390\n\n(6) https://github.com/python/cpython/issues/98254\n\n(7) https://github.com/python/cpython/issues/97997\n\n(8) https://github.com/python/cpython/issues/97973\n\n(9) https://github.com/python/cpython/issues/96078\n\n(10) https://github.com/python/cpython/issues/97955\n\n(11) https://github.com/python/cpython/issues/97912\n\n(12) https://github.com/python/cpython/issues/97002\n\n(13) https://github.com/python/cpython/issues/97943\n\n(14) https://github.com/python/cpython/issues/97922\n\n(15) https://github.com/python/cpython/issues/65961\n\n(16) https://github.com/python/cpython/issues/97850\n\n(17) https://github.com/python/cpython/issues/86298\n\n(18) https://github.com/python/cpython/issues/97779\n\n(19) https://github.com/python/cpython/issues/91052\n\n(20) https://github.com/python/cpython/issues/97752\n\n(21) https://github.com/python/cpython/issues/97591\n\n(22) https://github.com/python/cpython/issues/97670\n\n(23) https://github.com/python/cpython/issues/94526\n\n(24) https://github.com/python/cpython/issues/96670\n\n(25) https://github.com/python/cpython/issues/96975\n\n(26) https://github.com/python/cpython/issues/96848\n\n(27) https://github.com/python/cpython/issues/95921\n\n(28) https://github.com/python/cpython/issues/96821\n\n(29) https://github.com/python/cpython/issues/96821\n\n(30) https://github.com/python/cpython/issues/95778\n\n(31) https://github.com/python/cpython/issues/96387\n\n(32) https://github.com/python/cpython/issues/96864\n\n(33) https://github.com/python/cpython/issues/95778\n\n(34) https://github.com/python/cpython/issues/96678\n\n(35) https://github.com/python/cpython/issues/96754\n\n(36) https://github.com/python/cpython/issues/90997\n\n(37) https://github.com/python/cpython/issues/96751\n\n(38) https://github.com/python/cpython/issues/90751\n\n(39) https://github.com/python/cpython/issues/96678\n\n(40) https://github.com/python/cpython/issues/64373\n\n(41) https://github.com/python/cpython/issues/96641\n\n(42) https://github.com/python/cpython/issues/96636\n\n(43) https://github.com/python/cpython/issues/96572\n\n(44) https://github.com/python/cpython/issues/96611\n\n(45) https://github.com/python/cpython/issues/96612\n\n(46) https://github.com/python/cpython/issues/90230\n\n(47) https://github.com/python/cpython/issues/96587\n\n(48) https://peps.python.org/pep-0654/\n\n(49) https://github.com/python/cpython/issues/96569\n\n(50) https://github.com/python/cpython/issues/96582\n\n(51) https://github.com/python/cpython/issues/91079\n\n(52) https://github.com/python/cpython/issues/93911\n\n(53) https://github.com/python/cpython/issues/96348\n\n(54) https://github.com/python/cpython/issues/95196\n\n(55) https://github.com/python/cpython/issues/96364\n\n(56) https://github.com/python/cpython/issues/96352\n\n(57) https://github.com/python/cpython/issues/93554\n\n(58) https://github.com/python/cpython/issues/96268\n\n(59) https://github.com/python/cpython/issues/96237\n\n(60) https://github.com/python/cpython/issues/96187\n\n(61) https://github.com/python/cpython/issues/96143\n\n(62) https://github.com/python/cpython/issues/96071\n\n(63) https://github.com/python/cpython/issues/96046\n\n(64) https://github.com/python/cpython/issues/96005\n\n(65) https://github.com/python/cpython/issues/93678\n\n(66) https://github.com/python/cpython/issues/95245\n\n(67) https://github.com/python/cpython/issues/90997\n\n(68) https://github.com/python/cpython/issues/95977\n\n(69) https://github.com/python/cpython/issues/91210\n\n(70) https://github.com/python/cpython/issues/95922\n\n(71) https://github.com/python/cpython/issues/95818\n\n(72) https://github.com/python/cpython/issues/95876\n\n(73) https://github.com/python/cpython/issues/95605\n\n(74) https://github.com/python/cpython/issues/95150\n\n(75) https://github.com/python/cpython/issues/91146\n\n(76) https://github.com/python/cpython/issues/87092\n\n(77) https://github.com/python/cpython/issues/95355\n\n(78) https://github.com/python/cpython/issues/90081\n\n(79) https://github.com/python/cpython/issues/95324\n\n(80) https://github.com/python/cpython/issues/95245\n\n(81) https://github.com/python/cpython/issues/93678\n\n(82) https://github.com/python/cpython/issues/95185\n\n(83) https://github.com/python/cpython/issues/93351\n\n(84) https://github.com/python/cpython/issues/94438\n\n(85) https://github.com/python/cpython/issues/95060\n\n(86) https://github.com/python/cpython/issues/95113\n\n(87) https://github.com/python/cpython/issues/91409\n\n(88) https://github.com/python/cpython/issues/95023\n\n(89) https://github.com/python/cpython/issues/94036\n\n(90) https://github.com/python/cpython/issues/94938\n\n(91) https://github.com/python/cpython/issues/94996\n\n(92) https://github.com/python/cpython/issues/94739\n\n(93) https://github.com/python/cpython/issues/94949\n\n(94) https://github.com/python/cpython/issues/94947\n\n(95) https://github.com/python/cpython/issues/91256\n\n(96) https://github.com/python/cpython/issues/94869\n\n(97) https://github.com/python/cpython/issues/94893\n\n(98) https://github.com/python/cpython/issues/94822\n\n(99) https://github.com/python/cpython/issues/91153\n\n(100) https://github.com/python/cpython/issues/90699\n\n(101) https://github.com/python/cpython/issues/94694\n\n(102) https://github.com/python/cpython/issues/93252\n\n(103) https://github.com/python/cpython/issues/94215\n\n(104) https://github.com/python/cpython/issues/92228\n\n(105) https://github.com/python/cpython/issues/94485\n\n(106) https://peps.python.org/pep-0626/\n\n(107) https://github.com/python/cpython/issues/94438\n\n(108) https://github.com/python/cpython/issues/91719\n\n(109) https://github.com/python/cpython/issues/94329\n\n(110) https://github.com/python/cpython/issues/94360\n\n(111) https://github.com/python/cpython/issues/88116\n\n(112) https://github.com/python/cpython/issues/94262\n\n(113) https://github.com/python/cpython/issues/94192\n\n(114) https://github.com/python/cpython/issues/87995\n\n(115) https://github.com/python/cpython/issues/93883\n\n(116) https://github.com/python/cpython/issues/94163\n\n(117) https://github.com/python/cpython/issues/94021\n\n(118) https://github.com/python/cpython/issues/93911\n\n(119) https://github.com/python/cpython/issues/93955\n\n(120) https://github.com/python/cpython/issues/93911\n\n(121) https://github.com/python/cpython/issues/93678\n\n(122) https://github.com/python/cpython/issues/93841\n\n(123) https://github.com/python/cpython/issues/93516\n\n(124) https://github.com/python/cpython/issues/93516\n\n(125) https://github.com/python/cpython/issues/89828\n\n(126) https://github.com/python/cpython/issues/93678\n\n(127) https://github.com/python/cpython/issues/93671\n\n(128) https://github.com/python/cpython/issues/93662\n\n(129) https://github.com/python/cpython/issues/93461\n\n(130) https://github.com/python/cpython/issues/93621\n\n(131) https://github.com/python/cpython/issues/93533\n\n(132) https://github.com/python/cpython/issues/93444\n\n(133) https://github.com/python/cpython/issues/93429\n\n(134) https://github.com/python/cpython/issues/93418\n\n(135) https://github.com/python/cpython/issues/93382\n\n(136) https://github.com/python/cpython/issues/93359\n\n(137) https://github.com/python/cpython/issues/93356\n\n(138) https://github.com/python/cpython/issues/93354\n\n(139) https://github.com/python/cpython/issues/93283\n\n(140) https://github.com/python/cpython/issues/93345\n\n(141) https://github.com/python/cpython/issues/93223\n\n(142) https://github.com/python/cpython/issues/84694\n\n(143) https://github.com/python/cpython/issues/91924\n\n(144) https://github.com/python/cpython/issues/93040\n\n(145) https://github.com/python/cpython/issues/93143\n\n(146) https://github.com/python/cpython/issues/93061\n\n(147) https://github.com/python/cpython/issues/93065\n\n(148) https://github.com/MagicStack/immutables/issues/84\n\n(149) https://github.com/python/cpython/issues/93012\n\n(150) https://github.com/python/cpython/issues/93021\n\n(151) https://github.com/python/cpython/issues/89914\n\n(152) https://github.com/python/cpython/issues/92955\n\n(153) https://github.com/python/cpython/issues/92930\n\n(154) https://github.com/python/cpython/issues/90690\n\n(155) https://github.com/python/cpython/issues/92914\n\n(156) https://github.com/python/cpython/issues/92858\n\n(157) https://github.com/python/cpython/issues/90473\n\n(158) https://github.com/python/cpython/issues/92804\n\n(159) https://github.com/python/cpython/issues/92777\n\n(160) https://github.com/python/cpython/issues/92658\n\n(161) https://github.com/python/cpython/issues/92236\n\n(162) https://github.com/python/cpython/issues/91102\n\n(163) https://github.com/python/cpython/issues/92619\n\n(164) https://github.com/python/cpython/issues/88750\n\n(165) https://github.com/python/cpython/issues/92261\n\n(166) https://github.com/python/cpython/issues/91432\n\n(167) https://github.com/python/cpython/issues/91399\n\n(168) https://github.com/python/cpython/issues/91578\n\n(169) https://bugs.python.org/issue?@action=redirect&bpo=47091\n\n(170) https://bugs.python.org/issue?@action=redirect&bpo=46142\n\n(171) https://bugs.python.org/issue?@action=redirect&bpo=42316\n\nFile: python3.12.info,  Node: Library<18>,  Next: Documentation<18>,  Prev: Core and Builtins<18>,  Up: Python 3 12 0 alpha 1\n\n1.22.18.3 Library\n.................\n\n- gh-89237(1): Fix hang on Windows in 'subprocess.waitclosed()' in\n*note asyncio: 9. with *note ProactorEventLoop: 3d2.  Patch by\nKumar Aditya.\n\n- gh-97928(2): 'tkinter.Text.count()' raises now an exception for\noptions starting with \"-\" instead of silently ignoring them.\n\n- gh-98393(3): The *note os: 9c. module no longer accepts bytes-like\npaths, like *note bytearray: 294. and *note memoryview: 17f. types:\nonly the exact *note bytes: 295. type is accepted for bytes\nstrings.  Patch by Victor Stinner.\n\n- gh-98363(4): Added itertools.batched() to batch data into lists of\na given length with the last list possibly being shorter than the\nothers.\n\n- gh-98331(5): Update the bundled copies of pip and setuptools to\nversions 22.3 and 65.5.0 respectively.\n\n- gh-98307(6): A *note createSocket(): 425. method was added to *note\nSysLogHandler: 426.\n\n- gh-96035(7): Fix bug in *note urllib.parse.urlparse(): b96. that\ncauses certain port numbers containing whitespace, underscores,\nplus and minus signs, or non-ASCII digits to be incorrectly\naccepted.\n\n- gh-98257(8): Make *note sys.setprofile(): 1359. and *note\nsys.settrace(): 135a. functions reentrant.  They can no long fail\nwith: 'RuntimeError(\"Cannot install a trace function while another\ntrace function is being installed\")'.  Patch by Victor Stinner.\n\n- gh-98251(9): Allow *note venv: 10c. to pass along 'PYTHON*'\nvariables to 'ensurepip' and 'pip' when they do not impact path\nresolution\n\n- gh-94597(10): Deprecated *note\nasyncio.AbstractEventLoopPolicy.getchildwatcher(): 21d. and *note\nasyncio.AbstractEventLoopPolicy.setchildwatcher(): 21c. methods\nto be removed in Python 3.14.  Patch by Kumar Aditya.\n\n- gh-98178(11): On macOS, fix a crash in *note syslog.syslog(): 298.\nin multi-threaded applications.  On macOS, the libc 'syslog()'\nfunction is not thread-safe, so *note syslog.syslog(): 298. no\nlonger releases the GIL to call it.  Patch by Victor Stinner.\n\n- gh-44098(12): Release the GIL when creating *note mmap.mmap: 830.\nobjects on Unix.\n\n- gh-87730(13): Wrap network errors consistently in urllib FTP\nsupport, so the test suite doesn't fail when a network is available\nbut the public internet is not reachable.\n\n- gh-94597(14): The child watcher classes *note\nMultiLoopChildWatcher: 216, *note FastChildWatcher: 217. and *note\nSafeChildWatcher: 219. are deprecated and will be removed in Python\n3.14.  Patch by Kumar Aditya.\n\n- gh-98023(15): Change default child watcher to *note\nPidfdChildWatcher: 194. on Linux systems which supports it.  Patch\nby Kumar Aditya.\n\n- gh-90985(16): Earlier in 3.11 we deprecated\n'asyncio.Task.cancel(\"message\")'.  We realized we were too harsh,\nand have undeprecated it.\n\n- gh-65961(17): Do not rely solely on 'cached' on modules; code\nwill also support 'spec.cached'.\n\n- gh-97646(18): Replace deprecated 'application/javascript' with\n'text/javascript' in *note mimetypes: 8a.  See RFC 9239(19).  Patch\nby Noam Cohen.\n\n- gh-97930(20): Apply changes from importlibresources 5.8 and 5.9:\n'Traversable.joinpath' provides a concrete implementation.\n'asfile' now supports directories of resources.\n\n- gh-97850(21): Remove deprecated 'importlib.util.setloader()' and\n'importlib.util.moduleforloader()' from *note importlib.util: 77.\n\n- gh-97837(22): Change deprecate warning message in *note unittest:\n101. from\n\n'It is deprecated to return a value!=None'\n\nto\n\n'It is deprecated to return a value that is not None from a test\ncase'\n\n- gh-97825(23): Fixes *note AttributeError: 395. when *note\nsubprocess.checkoutput(): e31. is used with argument 'input=None'\nand either of the arguments 'encoding' or 'errors' are used.\n\n- gh-97008(24): *note NameError: 144. and *note AttributeError: 395.\nspelling suggestions provided since gh-82711(25) are now also\nemitted by the pure Python *note traceback: f9. module.  Tests for\nthose suggestions now exercise both implementations to ensure they\nare equivalent.  Patch by Carl Friedrich Bolz-Tereick and ??ukasz\nLanga.\n\n- gh-97799(26): 'dataclass' now uses *note inspect.getannotations():\n606. to examine the annotations on class objects.\n\n- gh-97781(27): Removed deprecated interfaces in 'importlib.metadata'\n(entry points accessed as dictionary, implicit dictionary\nconstruction of sequence of 'EntryPoint' objects, mutablility of\n'EntryPoints' result, access of entry point by index).\n'entrypoints' now has a simpler, more straightforward API\n(returning 'EntryPoints').\n\n- gh-96827(28): Avoid spurious tracebacks from *note asyncio: 9. when\ndefault executor cleanup is delayed until after the event loop is\nclosed (e.g.  as the result of a keyboard interrupt).\n\n- gh-95534(29): 'gzip.GzipFile.read()' reads 10% faster.\n\n- gh-97592(30): Avoid a crash in the C version of *note\nasyncio.Future.removedonecallback(): 151c. when an evil argument\nis passed.\n\n- gh-97639(31): Remove 'tokenize.NL' check from *note tabnanny: d7.\n\n- gh-97545(32): Make Semaphore run faster.\n\n- gh-73588(33): Fix generation of the default name of\n'tkinter.Checkbutton'.  Previously, checkbuttons in different\nparent widgets could have the same short name and share the same\nstate if arguments \"name\" and \"variable\" are not specified.  Now\nthey are globally unique.\n\n- gh-96865(34): fix Flag to use boundary CONFORM\n\nThis restores previous Flag behavior of allowing flags with\nnon-sequential values to be combined; e.g.\n\nclass Skip(Flag): TWO = 2 EIGHT = 8\n\nSkip.TWO | Skip.EIGHT -> <Skip.TWO|EIGHT: 10>\n\n- gh-97005(35): Update bundled libexpat to 2.4.9\n\n- gh-85760(36): Fix race condition in *note asyncio: 9. where *note\nprocessexited(): 151d. called before the *note\npipedatareceived(): 151e. leading to inconsistent output.  Patch\nby Kumar Aditya.\n\n- gh-96704(37): Pass the correct 'contextvars.Context' when a\n'asyncio' exception handler is called on behalf of a task or\ncallback handle.  This adds a new 'Task' method, 'getcontext', and\nalso a new 'Handle' method with the same name.  If this method is\nnot found on a task object (perhaps because it is a third-party\nlibrary that does not yet provide this method), the context\nprevailing at the time the exception handler is called is used.\n\n- gh-96819(38): Fixed check in 'multiprocessing.resourcetracker'\nthat guarantees that the length of a write to a pipe is not greater\nthan 'PIPEBUF'.\n\n- gh-95865(39): Reduce *note urllib.parse.quotefrombytes(): 151f.\nmemory use on large values.\n\nContributed by Dennis Sweeney.\n\n- gh-96741(40): Corrected type annotation for dataclass attribute\n'pstats.FunctionProfile.ncalls' to be 'str'.\n\n- gh-96734(41): Update *note unicodedata: 100. database to Unicode\n15.0.0.\n\n- gh-96735(42): Fix undefined behaviour in *note struct.unpack():\n1520.\n\n- gh-46412(43): Improve performance of 'bool(db)' for large ndb/gdb\ndatabases.  Previously this would call 'len(db)' which would\niterate over all keys - the answer (empty or not) is known after\nthe first key.\n\n- gh-96652(44): Fix the faulthandler implementation of\n'faulthandler.register(signal, chain=True)' if the 'sigaction()'\nfunction is not available: don't call the previous signal handler\nif it's NULL. Patch by Victor Stinner.\n\n- gh-68163(45): Correct conversion of *note numbers.Rational: 1136.'s\nto *note float: 4b7.\n\n- gh-96538(46): Speed up 'bisect.bisect()' functions by taking\nadvantage of type-stability.\n\n- gh-96465(47): Fraction hashes are now cached.\n\n- gh-96079(48): In *note typing: ff, fix missing field 'name' and\nincorrect 'module' in AnnotatedAlias.\n\n- gh-96415(49): Remove 'types.cellfactory' from module namespace.\n\n- gh-95987(50): Fix 'repr' of 'Any' subclasses.\n\n- gh-96388(51): Work around missing socket functions in *note socket:\nbfd.'s 'repr'.\n\n- gh-96385(52): Fix 'TypeVarTuple.typingpreparesubst'.\n'TypeError' was not raised when using more than one 'TypeVarTuple',\nlike '[*T, *V]' in type alias substitutions.\n\n- gh-96142(53): Add 'matchargs', 'kwonly', 'slots', and\n'weakrefslot' to 'DataclassParams'.\n\n- gh-96073(54): In *note inspect: 78, fix overeager replacement of\n\"'typing.'\" in formatting annotations.\n\n- gh-89258(55): Added a *note getChildren(): 1521. method to *note\nlogging.Logger: 98b, to get the immediate child loggers of a\nlogger.\n\n- gh-96346(56): Use double caching for compiled RE patterns.\n\n- gh-96349(57): Fixed a minor performance regression in\n'threading.Event.init()'\n\n- gh-90467(58): Fix 'asyncio.streams.StreamReaderProtocol' to keep a\nstrong reference to the created task, so that it's not garbage\ncollected\n\n- gh-96172(59): Fix a bug in 'unicodedata': 'eastasianwidth' used\nto return the wrong value for unassigned characters; and for yet\nunassigned, but reserved characters.\n\n- gh-96159(60): Fix a performance regression in logging\nTimedRotatingFileHandler.  Only check for special files when the\nrollover time has passed.\n\n- gh-96175(61): Fix unused 'localName' parameter in the 'Attr' class\nin *note xml.dom.minidom: 11d.\n\n- gh-96145(62): Add AttrDict to JSON module for use with objecthook.\n\n- gh-96052(63): Fix handling compiler warnings (SyntaxWarning and\nDeprecationWarning) in *note codeop.compilecommand(): 1522. when\nchecking for incomplete input.  Previously it emitted warnings and\nraised a SyntaxError.  Now it always returns 'None' for incomplete\ninput without emitting any warnings.\n\n- gh-96125(64): Fix incorrect condition that causes\n'sys.threadinfo.name' to be wrong on pthread platforms.\n\n- gh-96019(65): Fix a bug in the 'makeunicodedata.py' script leading\nto about 13 KiB of space saving in the 'unicodedata' module,\nspecifically the character decomposition data.\n\n- gh-95463(66): Remove an incompatible change from bpo-28080(67) that\ncaused a regression that ignored the utf8 in 'ZipInfo.flagbits'.\nPatch by Pablo Galindo.\n\n- gh-69142(68): Add '%:z' strftime format code (generates tzoffset\nwith colons as separator), see *note strftime() and strptime()\nBehavior: 1523.\n\n- gh-95899(69): Fix *note asyncio.Runner: 3c9. to call *note\nasyncio.seteventloop(): 1524. only once to avoid calling *note\nattachloop(): 1525. multiple times on child watchers.  Patch by\nKumar Aditya.\n\n- gh-95736(70): Fix *note unittest.IsolatedAsyncioTestCase: 48b. to\nset event loop before calling setup functions.  Patch by Kumar\nAditya.\n\n- gh-95865(71): Speed up *note urllib.parse.quotefrombytes(): 151f.\nby replacing a list comprehension with 'map()'.\n\n- gh-95861(72): Add support for computing Spearman's correlation\ncoefficient to the existing statistics.correlation() function.\n\n- gh-95804(73): Fix 'logging' shutdown handler so it respects\n'MemoryHandler.flushOnClose'.\n\n- gh-95704(74): When a task catches *note asyncio.CancelledError:\n7fe. and raises some other error, the other error should generally\nnot silently be suppressed.\n\n- gh-95149(75): The *note HTTPStatus: 71b. enum offers a couple of\nproperties to indicate the HTTP status category e.g.\n'HTTPStatus.OK.issuccess'.\n\n- gh-95609(76): Update bundled pip to 22.2.2.\n\n- gh-95289(77): Fix *note asyncio.TaskGroup: 3c3. to propagate\nexception when *note asyncio.CancelledError: 7fe. was replaced with\nanother exception by a context manger.  Patch by Kumar Aditya and\nGuido van Rossum.\n\n- gh-94909(78): Fix incorrect joining of relative Windows paths with\ndrives in *note pathlib.PurePath: 1c5. initializer.\n\n- gh-95385(79): Faster 'json.dumps()' when sorting of keys is not\nrequested (default).\n\n- gh-83901(80): Improve *note Signature.bind: 1526. error message for\nmissing keyword-only arguments.\n\n- gh-95339(81): Update bundled pip to 22.2.1.\n\n- gh-95045(82): Fix GC crash when deallocating 'lsprof.Profiler' by\nuntracking it before calling any callbacks.  Patch by Kumar Aditya.\n\n- gh-95231(83): Fail gracefully if *note EPERM: 1527. or *note\nENOSYS: 1528. is raised when loading *note crypt: 26. methods.\nThis may happen when trying to load 'MD5' on a Linux kernel with\nFIPS (Federal Information Processing Standard) enabled.\n\n- gh-95097(84): Fix *note asyncio.run(): 197. for *note asyncio.Task:\n201. implementations without *note uncancel(): 3d4. method.  Patch\nby Kumar Aditya.\n\n- gh-95087(85): Fix IndexError in parsing invalid date in the *note\nemail: 37. module.\n\n- gh-95199(86): Upgrade bundled setuptools to 63.2.0.\n\n- gh-95194(87): Upgrade bundled pip to 22.2.\n\n- gh-93899(88): Fix check for existence of *note os.EFDCLOEXEC:\n1529, *note os.EFDNONBLOCK: 152a. and *note os.EFDSEMAPHORE:\n152b. flags on older kernel versions where these flags are not\npresent.  Patch by Kumar Aditya.\n\n- gh-95166(89): Fix *note concurrent.futures.Executor.map(): c41. to\ncancel the currently waiting on future on an error - e.g.\nTimeoutError or KeyboardInterrupt.\n\n- gh-95132(90): Fix a *note sqlite3: c9. regression where '*args' and\n'kwds' were incorrectly relayed from *note connect(): 1da. to the\n*note Connection: 1d9. factory.  The regression was introduced in\n3.11a1 with PR 24421 (gh-85128(91)).  Patch by Erlend E. Aasland.\n\n- gh-93157(92): Fix *note fileinput: 56. module didn't support\n'errors' option when 'inplace' is true.\n\n- gh-91212(93): Fixed flickering of the turtle window when the tracer\nis turned off.  Patch by Shin-myoung-serp.\n\n- gh-95077(94): Add deprecation warning for enum 'member.member'\naccess (e.g.  'Color.RED.BLUE').  Remove 'EnumMeta.getattr'.\n\n- gh-95109(95): Ensure that timeouts scheduled with *note\nasyncio.Timeout: 13ef. that have already expired are delivered\npromptly.\n\n- gh-95105(96): 'wsgiref.types.InputStream.iter()' should return\n'Iterator[bytes]', not 'Iterable[bytes]'.  Patch by Shantanu Jain.\n\n- gh-95066(97): Replaced assert with exception in *note ast.parse():\n182, when 'featureversion' has an invalid major version.  Patch by\nShantanu Jain.\n\n- gh-77617(98): Add *note sqlite3: c9. *note command-line interface:\n14a.  Patch by Erlend Aasland.\n\n- gh-95005(99): Replace PyAccu with PyUnicodeWriter in JSON encoder\nand StringIO and remove the PyAccu implementation.\n\n- gh-90085(100): Remove '-c/--clock' and '-t/--time' CLI options of\n*note timeit: e9.  The options had been deprecated since Python 3.3\nand the functionality was removed in Python 3.7.  Patch by Shantanu\nJain.\n\n- gh-94857(101): Fix refleak in 'io.TextIOWrapper.reconfigure'.\nPatch by Kumar Aditya.\n\n- gh-94821(102): Fix binding of unix socket to empty address on Linux\nto use an available address from the abstract namespace, instead of\n\"0\".\n\n- gh-94736(103): Fix crash when deallocating an instance of a\nsubclass of 'multiprocessing.SemLock'.  Patch by Kumar Aditya.\n\n- gh-81620(104): Add random.binomialvariate().\n\n- gh-74116(105): Allow *note asyncio.StreamWriter.drain(): 1503. to\nbe awaited concurrently by multiple tasks.  Patch by Kumar Aditya.\n\n- gh-87822(106): When called with 'capturelocals=True', the *note\ntraceback: f9. module functions swallow exceptions raised from\ncalls to 'repr()' on local variables of frames.  This is in order\nto prioritize the original exception over rendering errors.  An\nindication of the failure is printed in place of the missing value.\n(Patch by Simon-Martin Schroeder).\n\n- gh-88050(107): Fix *note asyncio: 9. subprocess transport to kill\nprocess cleanly when process is blocked and avoid 'RuntimeError'\nwhen loop is closed.  Patch by Kumar Aditya.\n\n- gh-94637(108): 'SSLContext.setdefaultverifypaths()' now releases\nthe GIL around 'SSLCTXsetdefaultverifypaths' call.  The\nfunction call performs I/O and CPU intensive work.\n\n- gh-94309(109): Deprecate aliases *note typing.Hashable: 239. and\n*note typing.Sized: 23a.\n\n- gh-92546(110): An undocumented 'python -m pprint' benchmark is\nmoved into 'pprint' suite of pyperformance.  Patch by Oleg Iarygin.\n\n- gh-94607(111): Fix subclassing complex generics with type variables\nin *note typing: ff.  Previously an error message saying 'Some type\nvariables ... are not listed in Generic[...]' was shown.  *note\ntyping: ff. no longer populates 'parameters' with the\n'parameters' of a Python class.\n\n- gh-94619(112): Remove the long-deprecated 'modulerepr()' from\n*note importlib: 71.\n\n- gh-93910(113): The ability to access the other values of an enum on\nan enum (e.g.  'Color.RED.BLUE') has been restored in order to fix\na performance regression.\n\n- gh-93896(114): Fix *note asyncio.run(): 197. and *note\nunittest.IsolatedAsyncioTestCase: 48b. to always the set event loop\nas it was done in Python 3.10 and earlier.  Patch by Kumar Aditya.\n\n- gh-94343(115): Allow setting the attributes of 'reprlib.Repr'\nduring object initialization\n\n- gh-94382(116): Port static types of 'multiprocessing' module to\nheap types.  Patch by Kumar Aditya.\n\n- gh-78724(117): Fix crash in *note struct.Struct: 13e7. when it was\nnot completely initialized by initializing it in *note new():\n2e2.  Patch by Kumar Aditya.\n\n- gh-94510(118): Re-entrant calls to *note sys.setprofile(): 1359.\nand *note sys.settrace(): 135a. now raise *note RuntimeError: 17a.\nPatch by Pablo Galindo.\n\n- gh-92336(119): Fix bug where *note linecache.getline(): c82. fails\non bad files with *note UnicodeDecodeError: 83c. or *note\nSyntaxError: 146.  It now returns an empty string as per the\ndocumentation.\n\n- gh-94398(120): Once a *note asyncio.TaskGroup: 3c3. has started\nshutting down (i.e., at least one task has failed and the task\ngroup has started cancelling the remaining tasks), it should not be\npossible to add new tasks to the task group.\n\n- gh-94383(121): 'xml.etree': Remove the 'ElementTree.Element.copy()'\nmethod of the pure Python implementation, deprecated in Python\n3.10, use the *note copy.copy(): 289. function instead.  The C\nimplementation of 'xml.etree' has no 'copy()' method, only a\n'copy()' method.  Patch by Victor Stinner.\n\n- gh-94379(122): *note zipimport: 12c.: Remove 'findloader()' and\n'findmodule()' methods, deprecated in Python 3.10: use the\n'findspec()' method instead.  See PEP 451(123) for the rationale.\nPatch by Victor Stinner.\n\n- gh-94352(124): *note shlex.split(): 292.: Passing 'None' for 's'\nargument now raises an exception, rather than reading *note\nsys.stdin: 293.  The feature was deprecated in Python 3.9.  Patch\nby Victor Stinner.\n\n- gh-94318(125): Strip trailing spaces in *note pydoc: b0. text\noutput.\n\n- gh-89988(126): Fix memory leak in *note pickle.Pickler: 849. when\nlooking up 'dispatchtable'.  Patch by Kumar Aditya.\n\n- gh-90016(127): Deprecate *note sqlite3: c9. *note default adapters\nand converters: 232.  Patch by Erlend E. Aasland.\n\n- gh-94254(128): Fixed types of *note struct: cf. module to be\nimmutable.  Patch by Kumar Aditya.\n\n- gh-93259(129): Now raise 'ValueError' when 'None' or an empty\nstring are passed to 'Distribution.fromname' (and other callers).\n\n- gh-74696(130): *note shutil.makearchive(): 1d4. now passes the\n'rootdir' argument to custom archivers which support it.\n\n- gh-94216(131): The *note dis: 35. module now has the opcodes for\npseudo instructions (those which are used by the compiler during\ncode generation but then removed or replaced by real opcodes before\nthe final bytecode is emitted).\n\n- gh-93096(132): Removed undocumented 'python -m codecs'.  Use\n'python -m unittest test.testcodecs.EncodedFileTest' instead.\n\n- gh-94207(133): Made 'struct.Struct' GC-tracked in order to fix a\nreference leak in the 'struct' module.\n\n- gh-93096(134): Removed undocumented '-t' argument of 'python -m\nbase64'.  Use 'python -m unittest\ntest.testbase64.LegacyBase64TestCase.testencodebytes' instead.\n\n- gh-94226(135): Remove the 'locale.format()' function, deprecated in\nPython 3.7: use *note locale.formatstring(): 271. instead.  Patch\nby Victor Stinner.\n\n- gh-94199(136): Remove the 'ssl.matchhostname()' function.  The\n'ssl.matchhostname()' was deprecated in Python 3.7.  OpenSSL\nperforms hostname matching since Python 3.7, Python no longer uses\nthe 'ssl.matchhostname()' function.  Patch by Victor Stinner.\n\n- gh-94214(137): Document the 'context' object used in the\n'venv.EnvBuilder' class, and add the new environment's library path\nto it.\n\n- gh-94199(138): Remove the 'ssl.wrapsocket()' function, deprecated\nin Python 3.7: instead, create a *note ssl.SSLContext: 278. object\nand call its *note ssl.SSLContext.wrapsocket: 279. method.  Any\npackage that still uses 'ssl.wrapsocket()' is broken and insecure.\nThe function neither sends a SNI TLS extension nor validates server\nhostname.  Code is subject to CWE-295(139): Improper Certificate\nValidation.  Patch by Victor Stinner.\n\n- gh-94199(140): Remove the 'ssl.RANDpseudobytes()' function,\ndeprecated in Python 3.6: use *note os.urandom(): 276. or *note\nssl.RANDbytes(): 277. instead.  Patch by Victor Stinner.\n\n- gh-94199(141): *note hashlib: 63.: Remove the pure Python\nimplementation of *note hashlib.pbkdf2hmac(): 261, deprecated in\nPython 3.10.  Python 3.10 and newer requires OpenSSL 1.1.1 ( PEP\n644(142)): this OpenSSL version provides a C implementation of\n*note pbkdf2hmac(): 261. which is faster.  Patch by Victor\nStinner.\n\n- gh-94196(143): *note gzip: 62.: Remove the 'filename' attribute of\n*note gzip.GzipFile: 25e, deprecated since Python 2.6, use the\n*note name: 25f. attribute instead.  In write mode, the 'filename'\nattribute added ''.gz'' file extension if it was not present.\nPatch by Victor Stinner.\n\n- gh-94182(144): run the *note asyncio.PidfdChildWatcher: 194. on the\nrunning loop, this allows event loops to run subprocesses when\nthere is no default event loop running on the main thread\n\n- gh-94169(145): Remove 'io.OpenWrapper' and 'pyio.OpenWrapper',\ndeprecated in Python 3.10: just use *note open(): 26e. instead.\nThe *note open(): 26e. (*note io.open(): 26f.) function is a\nbuilt-in function.  Since Python 3.10, 'pyio.open()' is also a\nstatic method.  Patch by Victor Stinner.\n\n- gh-91742(146): Fix *note pdb: a0. crash after jump caused by a null\npointer dereference.  Patch by Kumar Aditya.\n\n- gh-94101(147): Manual instantiation of *note ssl.SSLSession: b2c.\nobjects is no longer allowed as it lead to misconfigured instances\nthat crashed the interpreter when attributes where accessed on\nthem.\n\n- gh-84753(148): *note inspect.iscoroutinefunction(): 1af, *note\ninspect.isgeneratorfunction(): 152c, and *note\ninspect.isasyncgenfunction(): 152d. now properly return 'True' for\nduck-typed function-like objects like instances of *note\nunittest.mock.AsyncMock: 877.\n\nThis makes *note inspect.iscoroutinefunction(): 1af. consistent\nwith the behavior of 'asyncio.iscoroutinefunction()'.  Patch by\nMehdi ABAAKOUK.\n\n- gh-94028(149): Fix a regression in the *note sqlite3: c9. where\nstatement objects were not properly cleared and reset after use in\ncursor iters.  The regression was introduced by PR 27884 in Python\n3.11a1.  Patch by Erlend E. Aasland.\n\n- gh-93973(150): Add keyword argument 'allerrors' to\n'asyncio.createconnection' so that multiple connection errors can\nbe raised as an 'ExceptionGroup'.\n\n- gh-93963(151): Officially deprecate from 'importlib.abc' classes\nmoved to 'importlib.resources.abc'.\n\n- gh-93858(152): Prevent error when activating venv in nested fish\ninstances.\n\n- gh-93820(153): Pickle *note enum.Flag: 3ef. by name.\n\n- gh-93847(154): Fix repr of enum of generic aliases.\n\n- gh-91404(155): Revert the *note re: b4. memory leak when a match is\nterminated by a signal or memory allocation failure as the\nimplemented fix caused a major performance regression.\n\n- gh-83499(156): Fix double closing of file description in *note\ntempfile: da.\n\n- gh-93820(157): Fixed a regression when *note copy.copy(): 289.-ing\n*note enum.Flag: 3ef. with multiple flag members.\n\n- gh-79512(158): Fixed names and 'module' value of *note weakref:\n10f. classes *note ReferenceType: 152e, *note ProxyType: 152f,\n*note CallableProxyType: 1530.  It makes them pickleable.\n\n- gh-91389(159): Fix an issue where *note dis: 35. utilities could\nreport missing or incorrect position information in the presence of\n'CACHE' entries.\n\n- gh-93626(160): Set 'future.annotations' to have a 'None'\nmandatoryRelease to indicate that it is currently 'TBD'.\n\n- gh-90473(161): Emscripten and WASI have no home directory and\ncannot provide PEP 370(162) user site directory.\n\n- gh-90494(163): *note copy.copy(): 289. and *note copy.deepcopy():\n9af. now always raise a TypeError if 'reduce()' returns a tuple\nwith length 6 instead of silently ignore the 6th item or produce\nincorrect result.\n\n- gh-90549(164): Fix a multiprocessing bug where a global named\nresource (such as a semaphore) could leak when a child process is\nspawned (as opposed to forked).\n\n- gh-93521(165): Fixed a case where dataclasses would try to add\n'weakref' into the 'slots' for a dataclass that specified\n'weakrefslot=True' when it was already defined in one of its\nbases.  This resulted in a 'TypeError' upon the new class being\ncreated.\n\n- gh-79579(166): *note sqlite3: c9. now correctly detects DML queries\nwith leading comments.  Patch by Erlend E. Aasland.\n\n- gh-93421(167): Update *note sqlite3.Cursor.rowcount: 1531. when a\nDML statement has run to completion.  This fixes the row count for\nSQL queries like 'UPDATE ... RETURNING'.  Patch by Erlend E.\nAasland.\n\n- gh-93475(168): Expose 'FICLONE' and 'FICLONERANGE' constants in\n*note fcntl: 54.  Patch by Illia Volochii.\n\n- gh-93370(169): Deprecate *note sqlite3.version: 1532. and *note\nsqlite3.versioninfo: 1533.\n\n- gh-91810(170): Suppress writing an XML declaration in open files in\n'ElementTree.write()' with 'encoding='unicode'' and\n'xmldeclaration=None'.\n\n- gh-91162(171): Support splitting of unpacked arbitrary-length tuple\nover 'TypeVar' and 'TypeVarTuple' parameters.  For example:\n\n* 'A[T, *Ts][*tuple[int, ...]]' -> 'A[int, *tuple[int, ...]]'\n\n* 'A[*Ts, T][*tuple[int, ...]]' -> 'A[*tuple[int, ...], int]'\n\n- gh-93353(172): Fix the *note importlib.resources.asfile(): 1aa.\ncontext manager to remove the temporary file if destroyed late\nduring Python finalization: keep a local reference to the *note\nos.remove(): f61. function.  Patch by Victor Stinner.\n\n- gh-83658(173): Make 'multiprocessing.Pool' raise an exception if\n'maxtasksperchild' is not 'None' or a positive int.\n\n- gh-93312(174): Add *note os.PIDFDNONBLOCK: 1b9. flag to open a\nfile descriptor for a process with *note os.pidfdopen(): 195. in\nnon-blocking mode.  Patch by Kumar Aditya.\n\n- gh-88123(175): Implement Enum contains that returns True or\nFalse to replace the deprecated behaviour that would sometimes\nraise a TypeError.\n\n- gh-93297(176): Make asyncio task groups prevent child tasks from\nbeing GCed\n\n- gh-85308(177): Changed *note argparse.ArgumentParser: 28f. to use\n*note filesystem encoding and error handler: 291. instead of\ndefault text encoding to read arguments from file (e.g.\n'fromfileprefixchars' option).  This change affects Windows;\nargument file should be encoded with UTF-8 instead of ANSI\nCodepage.\n\n- gh-93156(178): Accessing the *note pathlib.PurePath.parents: 615.\nsequence of an absolute path using negative index values produced\nincorrect results.\n\n- gh-93162(179): Add the ability for *note\nlogging.config.dictConfig(): 1023. to usefully configure *note\nQueueHandler: 1534. and *note QueueListener: c8b. as a pair, and\nadd *note logging.getHandlerByName(): 1535. and *note\nlogging.getHandlerNames(): 1536. APIs to allow access to handlers\nby name.\n\n- gh-93243(180): The 'smtpd' module was removed per the schedule in\nPEP 594(181).\n\n- gh-92886(182): Replace 'assert' statements with 'raise\nAssertionError()' in 'BaseHandler' so that the tested behaviour is\nmaintained running with optimizations '(-O)'.\n\n- gh-90155(183): Fix broken *note asyncio.Semaphore: 8a2. when\nacquire is cancelled.\n\n- gh-90817(184): The *note locale.resetlocale(): 502. function is\ndeprecated and will be removed in Python 3.13.  Use\n'locale.setlocale(locale.LCALL, \"\")' instead.  Patch by Victor\nStinner.\n\n- gh-91513(185): Added 'taskName' attribute to *note logging: 82.\nmodule for use with *note asyncio: 9. tasks.\n\n- gh-74696(186): *note shutil.makearchive(): 1d4. no longer\ntemporarily changes the current working directory during creation\nof standard '.zip' or tar archives.\n\n- gh-92728(187): The 're.template()' function and the corresponding\n're.TEMPLATE' and 're.T' flags are restored after they were removed\nin 3.11.0b1, but they are now deprecated, so they might be removed\nfrom Python 3.13.\n\n- gh-93033(188): Search in some strings (platform dependent i.e\n[U+0xFFFF, U+0x0100] on Windows or [U+0xFFFFFFFF, U+0x00010000] on\nLinux 64-bit) are now up to 10 times faster.\n\n- gh-89973(189): Fix *note re.error: cab. raised in *note fnmatch:\n57. if the pattern contains a character range with upper bound\nlower than lower bound (e.g.  '[c-a]').  Now such ranges are\ninterpreted as empty ranges.\n\n- gh-93044(190): No longer convert the database argument of *note\nsqlite3.connect(): 1da. to bytes before passing it to the factory.\n\n- gh-93010(191): In a very special case, the email package tried to\nappend the nonexistent 'InvalidHeaderError' to the defect list.  It\nshould have been 'InvalidHeaderDefect'.\n\n- gh-92986(192): Fix *note ast.unparse(): 6fe. when\n'ImportFrom.level' is None\n\n- gh-92932(193): Now *note dis(): 96e. and *note getinstructions():\nd9d. handle operand values for instructions prefixed by\n'EXTENDEDARGQUICK'.  Patch by Sam Gross and Donghee Na.\n\n- gh-92675(194): Fix 'venv.ensuredirectories()' to accept *note\npathlib.Path: 149. arguments in addition to *note str: 157. paths.\nPatch by David Foster.\n\n- gh-87901(195): Removed the 'encoding' argument from *note\nos.popen(): 8b5. that was added in 3.11b1.\n\n- gh-91922(196): Fix function 'sqlite.connect()' and the\n'sqlite.Connection' constructor on non-UTF-8 locales.  Also, they\nnow support bytes paths non-decodable with the current FS encoding.\n\n- gh-92869(197): Added *note ctimet: 1537. to *note ctypes: 28,\nwhich has the same size as the 'timet' type in C.\n\n- gh-92839(198): Fixed crash resulting from calling bisect.insort()\nor bisect.insortleft() with the key argument not equal to None.\n\n- gh-90473(199): *note subprocess: d0. now fails early on Emscripten\nand WASI platforms to work around missing *note os.pipe(): 1538. on\nWASI.\n\n- gh-89325(200): Removed many old deprecated *note unittest: 101.\nfeatures: *note TestCase: 159. method aliases, undocumented and\nbroken *note TestCase: 159. method 'assertDictContainsSubset',\nundocumented *note TestLoader.loadTestsFromModule: 285. parameter\n'useloadtests', and an underscored alias of the *note\nTextTestResult: 286. class.\n\n- gh-92734(201): Allow multi-element reprs emitted by *note reprlib:\nb6. to be pretty-printed using configurable indentation.\n\n- gh-92671(202): Fixed *note ast.unparse(): 6fe. for empty tuples in\nthe assignment target context.\n\n- gh-91581(203): *note utcfromtimestamp(): 224. no longer attempts to\nresolve 'fold' in the pure Python implementation, since the fold is\nnever 1 in UTC. In addition to being slightly faster in the common\ncase, this also prevents some errors when the timestamp is close to\n*note datetime.min: 1539.  Patch by Paul Ganssle.\n\n- gh-86388(204): Removed randrange() functionality deprecated since\nPython 3.10.  Formerly, randrange(10.0) losslessly converted to\nrandrange(10).  Now, it raises a TypeError.  Also, the exception\nraised for non-integral values such as randrange(10.5) or\nrandrange('10') has been changed from ValueError to TypeError.\n\n- gh-90385(205): Add *note pathlib.Path.walk(): 1c7. as an\nalternative to *note os.walk(): 1c8.\n\n- gh-92550(206): Fix *note pathlib.Path.rglob(): 1cd. for empty\npattern.\n\n- gh-92591(207): Allow *note logging: 82. filters to return a *note\nlogging.LogRecord: e59. instance so that filters attached to *note\nlogging.Handler: 12eb.s can enrich records without side effects on\nother handlers.\n\n- gh-92445(208): Fix a bug in *note argparse: 6. where 'nargs=\"*\"'\nwould raise an error instead of returning an empty list when 0\narguments were supplied if choice was also defined in\n'parser.addargument'.\n\n- gh-92547(209): Remove undocumented *note sqlite3: c9. features\ndeprecated in Python 3.10:\n\n* 'sqlite3.enablesharedcache()'\n\n* 'sqlite3.OptimizedUnicode'\n\nPatch by Erlend E. Aasland.\n\n- gh-92530(210): Fix an issue that occurred after interrupting *note\nthreading.Condition.notify(): 153a.\n\n- gh-92531(211): The statistics.mediangrouped() function now always\nreturn a float.  Formerly, it did not convert the input type when\nfor sequences of length one.\n\n- gh-84131(212): The *note pathlib.Path: 149. deprecated method\n'linkto' has been removed.  Use 3.10's *note hardlinkto(): 616.\nmethod instead as its semantics are consistent with that of *note\nsymlinkto(): 617.\n\n- gh-89336(213): Removed *note configparser: 20. module APIs: the\n'SafeConfigParser' class alias, the 'ParsingError.filename'\nproperty and parameter, and the 'ConfigParser.readfp' method, all\nof which were deprecated since Python 3.2.\n\n- gh-92391(214): Add *note classgetitem(): 520. to *note\ncsv.DictReader: 80b. and *note csv.DictWriter: 1072, allowing them\nto be parameterized at runtime.  Patch by Marc Mueller.\n\n- gh-91968(215): Add 'SORTABLE' and 'SOUSERCOOKIE' constants to\n*note socket: c6.\n\n- gh-91810(216): *note ElementTree: 76e. method *note write(): e6a.\nand function *note tostring(): e68. now use the text file's\nencoding (\"UTF-8\" if not available) instead of locale encoding in\nXML declaration when 'encoding=\"unicode\"' is specified.\n\n- gh-81790(217): *note os.path.splitdrive(): a3a. now understands DOS\ndevice paths with UNC links (beginning '\\\\?\\UNC\\').  Contributed by\nBarney Gale.\n\n- gh-91760(218): Apply more strict rules for numerical group\nreferences and group names in regular expressions.  Only sequence\nof ASCII digits is now accepted as a numerical reference.  The\ngroup name in bytes patterns and replacement strings can now only\ncontain ASCII letters and digits and underscore.\n\n- gh-90622(219): Worker processes for *note\nconcurrent.futures.ProcessPoolExecutor: 707. are no longer spawned\non demand (a feature added in 3.9) when the multiprocessing context\nstart method is '\"fork\"' as that can lead to deadlocks in the child\nprocesses due to a fork happening while threads are running.\n\n- gh-91577(220): Move imports in 'SharedMemory' methods to module\nlevel so that they can be executed late in python finalization.\n\n- gh-91581(221): Remove an unhandled error case in the C\nimplementation of calls to *note datetime.fromtimestamp: 226. with\nno time zone (i.e.  getting a local time from an epoch timestamp).\nThis should have no user-facing effect other than giving a possibly\nmore accurate error message when called with timestamps that fall\non 10000-01-01 in the local time.  Patch by Paul Ganssle.\n\n- gh-91539(222): Improve performance of\n'urllib.request.getproxiesenvironment' when there are many\nenvironment variables\n\n- gh-91524(223): Speed up the regular expression substitution\n(functions *note re.sub(): 1ff. and *note re.subn(): 200. and\ncorresponding *note re.Pattern: 1451. methods) for replacement\nstrings containing group references by 2-3 times.\n\n- gh-91447(224): Fix findtext in the xml module to only give an empty\nstring when the text attribute is set to None.\n\n- gh-91456(225): Deprecate current default auto() behavior: In 3.13\nthe default will be for for auto() to always return the largest\nmember value incremented by 1, and to raise if incompatible value\ntypes are used.\n\n- bpo-47231(226): Fixed an issue with inconsistent trailing slashes\nin tarfile longname directories.\n\n- bpo-39064(227): *note zipfile.ZipFile: 494. now raises *note\nzipfile.BadZipFile: 153b. instead of 'ValueError' when reading a\ncorrupt zip file in which the central directory offset is negative.\n\n- bpo-41287(228): Fix handling of the 'doc' argument in subclasses of\n*note property(): 3f6.\n\n- gh-90005(229): *note ctypes: 28. dependency 'libffi' is now\ndetected with 'pkg-config'.\n\n- bpo-32547(230): The constructors for *note DictWriter: 1072. and\n*note DictReader: 80b. now coerce the 'fieldnames' argument to a\n*note list: 3dc. if it is an iterator.\n\n- bpo-35540(231): Fix *note dataclasses.asdict(): 1465. crash when\n*note collections.defaultdict: 1031. is present in the attributes.\n\n- bpo-47063(232): Add an indexpages parameter to support using\nnon-default index page names.\n\n- bpo-47025(233): Drop support for *note bytes: 295. on *note\nsys.path: 32c.\n\n- bpo-46951(234): Order the contents of zipapp archives, to make\nbuilds more reproducible.\n\n- bpo-42777(235): Implement *note pathlib.Path.ismount(): 842. for\nWindows paths.\n\n- bpo-46755(236): In 'QueueHandler', clear 'stackinfo' from\n'LogRecord' to prevent stack trace from being written twice.\n\n- bpo-45393(237): Fix the formatting for 'await x' and 'not x' in the\noperator precedence table when using the *note help(): 6f0. system.\n\n- bpo-46642(238): Improve error message when trying to subclass an\ninstance of *note typing.TypeVar: 164, *note typing.ParamSpec: 163,\n*note typing.TypeVarTuple: 162, etc.  Based on patch by Gregory\nBeauregard.\n\n- bpo-46364(239): Restrict use of sockets instead of pipes for stdin\nof subprocesses created by *note asyncio: 9. to AIX platform only.\n\n- bpo-28249(240): Set *note doctest.DocTest.lineno: 153c. to 'None'\nwhen object does not have 'doc'.\n\n- bpo-46197(241): Fix *note ensurepip: 50. environment isolation for\nsubprocess running 'pip'.\n\n- bpo-45924(242): Fix *note asyncio: 9. incorrect traceback when\nfuture's exception is raised multiple times.  Patch by Kumar\nAditya.\n\n- bpo-45046(243): Add support of context managers in *note unittest:\n101.: methods *note enterContext(): 488. and *note\nenterClassContext(): 489. of class *note TestCase: 159, method\n*note enterAsyncContext(): 48a. of class *note\nIsolatedAsyncioTestCase: 48b. and function *note\nunittest.enterModuleContext(): 48c.\n\n- bpo-44173(244): Enable fast seeking of uncompressed unencrypted\n'zipfile.ZipExtFile'\n\n- bpo-42627(245): Fix incorrect parsing of Windows registry proxy\nsettings\n\n- bpo-42047(246): Add *note threading.getnativeid(): 869. support\nfor DragonFly BSD. Patch by David Carlier.\n\n- bpo-14243(247): The *note tempfile.NamedTemporaryFile: 1ea.\nfunction has a new optional parameter 'deleteonclose'\n\n- bpo-41246(248): Give the same callback function for when the\noverlapped operation is done to the functions 'recv', 'recvinto',\n'recvfrom', 'sendto', 'send' and 'sendfile' inside 'IocpProactor'.\n\n- bpo-39264(249): Fixed 'collections.UserDict.get()' to not call\n'missing()' when a value is not found.  This matches the\nbehavior of *note dict: 237.  Patch by Bar Harel.\n\n- bpo-38693(250): *note importlib: 71. now uses f-strings internally\ninstead of 'str.format'.\n\n- bpo-38267(251): Add 'timeout' parameter to *note\nasyncio.loop.shutdowndefaultexecutor(): 700.  The default value\nis 'None', which means the executor will be given an unlimited\namount of time.  When called from *note asyncio.Runner: 3c9. or\n*note asyncio.run(): 197, the default timeout is 5 minutes.\n\n- bpo-34828(252): *note sqlite3.Connection.iterdump(): 1415. now\nhandles databases that use 'AUTOINCREMENT' in one or more tables.\n\n- bpo-32990(253): Support reading wave files with the\n'WAVEFORMATEXTENSIBLE' format in the *note wave: 10e. module.\n\n- bpo-26253(254): Allow adjustable compression level for tarfile\nstreams in *note tarfile.open(): cdb.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/89237\n\n(2) https://github.com/python/cpython/issues/97928\n\n(3) https://github.com/python/cpython/issues/98393\n\n(4) https://github.com/python/cpython/issues/98363\n\n(5) https://github.com/python/cpython/issues/98331\n\n(6) https://github.com/python/cpython/issues/98307\n\n(7) https://github.com/python/cpython/issues/96035\n\n(8) https://github.com/python/cpython/issues/98257\n\n(9) https://github.com/python/cpython/issues/98251\n\n(10) https://github.com/python/cpython/issues/94597\n\n(11) https://github.com/python/cpython/issues/98178\n\n(12) https://github.com/python/cpython/issues/44098\n\n(13) https://github.com/python/cpython/issues/87730\n\n(14) https://github.com/python/cpython/issues/94597\n\n(15) https://github.com/python/cpython/issues/98023\n\n(16) https://github.com/python/cpython/issues/90985\n\n(17) https://github.com/python/cpython/issues/65961\n\n(18) https://github.com/python/cpython/issues/97646\n\n(19) https://datatracker.ietf.org/doc/html/rfc9239.html\n\n(20) https://github.com/python/cpython/issues/97930\n\n(21) https://github.com/python/cpython/issues/97850\n\n(22) https://github.com/python/cpython/issues/97837\n\n(23) https://github.com/python/cpython/issues/97825\n\n(24) https://github.com/python/cpython/issues/97008\n\n(25) https://github.com/python/cpython/issues/82711\n\n(26) https://github.com/python/cpython/issues/97799\n\n(27) https://github.com/python/cpython/issues/97781\n\n(28) https://github.com/python/cpython/issues/96827\n\n(29) https://github.com/python/cpython/issues/95534\n\n(30) https://github.com/python/cpython/issues/97592\n\n(31) https://github.com/python/cpython/issues/97639\n\n(32) https://github.com/python/cpython/issues/97545\n\n(33) https://github.com/python/cpython/issues/73588\n\n(34) https://github.com/python/cpython/issues/96865\n\n(35) https://github.com/python/cpython/issues/97005\n\n(36) https://github.com/python/cpython/issues/85760\n\n(37) https://github.com/python/cpython/issues/96704\n\n(38) https://github.com/python/cpython/issues/96819\n\n(39) https://github.com/python/cpython/issues/95865\n\n(40) https://github.com/python/cpython/issues/96741\n\n(41) https://github.com/python/cpython/issues/96734\n\n(42) https://github.com/python/cpython/issues/96735\n\n(43) https://github.com/python/cpython/issues/46412\n\n(44) https://github.com/python/cpython/issues/96652\n\n(45) https://github.com/python/cpython/issues/68163\n\n(46) https://github.com/python/cpython/issues/96538\n\n(47) https://github.com/python/cpython/issues/96465\n\n(48) https://github.com/python/cpython/issues/96079\n\n(49) https://github.com/python/cpython/issues/96415\n\n(50) https://github.com/python/cpython/issues/95987\n\n(51) https://github.com/python/cpython/issues/96388\n\n(52) https://github.com/python/cpython/issues/96385\n\n(53) https://github.com/python/cpython/issues/96142\n\n(54) https://github.com/python/cpython/issues/96073\n\n(55) https://github.com/python/cpython/issues/89258\n\n(56) https://github.com/python/cpython/issues/96346\n\n(57) https://github.com/python/cpython/issues/96349\n\n(58) https://github.com/python/cpython/issues/90467\n\n(59) https://github.com/python/cpython/issues/96172\n\n(60) https://github.com/python/cpython/issues/96159\n\n(61) https://github.com/python/cpython/issues/96175\n\n(62) https://github.com/python/cpython/issues/96145\n\n(63) https://github.com/python/cpython/issues/96052\n\n(64) https://github.com/python/cpython/issues/96125\n\n(65) https://github.com/python/cpython/issues/96019\n\n(66) https://github.com/python/cpython/issues/95463\n\n(67) https://bugs.python.org/issue?@action=redirect&bpo=28080\n\n(68) https://github.com/python/cpython/issues/69142\n\n(69) https://github.com/python/cpython/issues/95899\n\n(70) https://github.com/python/cpython/issues/95736\n\n(71) https://github.com/python/cpython/issues/95865\n\n(72) https://github.com/python/cpython/issues/95861\n\n(73) https://github.com/python/cpython/issues/95804\n\n(74) https://github.com/python/cpython/issues/95704\n\n(75) https://github.com/python/cpython/issues/95149\n\n(76) https://github.com/python/cpython/issues/95609\n\n(77) https://github.com/python/cpython/issues/95289\n\n(78) https://github.com/python/cpython/issues/94909\n\n(79) https://github.com/python/cpython/issues/95385\n\n(80) https://github.com/python/cpython/issues/83901\n\n(81) https://github.com/python/cpython/issues/95339\n\n(82) https://github.com/python/cpython/issues/95045\n\n(83) https://github.com/python/cpython/issues/95231\n\n(84) https://github.com/python/cpython/issues/95097\n\n(85) https://github.com/python/cpython/issues/95087\n\n(86) https://github.com/python/cpython/issues/95199\n\n(87) https://github.com/python/cpython/issues/95194\n\n(88) https://github.com/python/cpython/issues/93899\n\n(89) https://github.com/python/cpython/issues/95166\n\n(90) https://github.com/python/cpython/issues/95132\n\n(91) https://github.com/python/cpython/issues/85128\n\n(92) https://github.com/python/cpython/issues/93157\n\n(93) https://github.com/python/cpython/issues/91212\n\n(94) https://github.com/python/cpython/issues/95077\n\n(95) https://github.com/python/cpython/issues/95109\n\n(96) https://github.com/python/cpython/issues/95105\n\n(97) https://github.com/python/cpython/issues/95066\n\n(98) https://github.com/python/cpython/issues/77617\n\n(99) https://github.com/python/cpython/issues/95005\n\n(100) https://github.com/python/cpython/issues/90085\n\n(101) https://github.com/python/cpython/issues/94857\n\n(102) https://github.com/python/cpython/issues/94821\n\n(103) https://github.com/python/cpython/issues/94736\n\n(104) https://github.com/python/cpython/issues/81620\n\n(105) https://github.com/python/cpython/issues/74116\n\n(106) https://github.com/python/cpython/issues/87822\n\n(107) https://github.com/python/cpython/issues/88050\n\n(108) https://github.com/python/cpython/issues/94637\n\n(109) https://github.com/python/cpython/issues/94309\n\n(110) https://github.com/python/cpython/issues/92546\n\n(111) https://github.com/python/cpython/issues/94607\n\n(112) https://github.com/python/cpython/issues/94619\n\n(113) https://github.com/python/cpython/issues/93910\n\n(114) https://github.com/python/cpython/issues/93896\n\n(115) https://github.com/python/cpython/issues/94343\n\n(116) https://github.com/python/cpython/issues/94382\n\n(117) https://github.com/python/cpython/issues/78724\n\n(118) https://github.com/python/cpython/issues/94510\n\n(119) https://github.com/python/cpython/issues/92336\n\n(120) https://github.com/python/cpython/issues/94398\n\n(121) https://github.com/python/cpython/issues/94383\n\n(122) https://github.com/python/cpython/issues/94379\n\n(123) https://peps.python.org/pep-0451/\n\n(124) https://github.com/python/cpython/issues/94352\n\n(125) https://github.com/python/cpython/issues/94318\n\n(126) https://github.com/python/cpython/issues/89988\n\n(127) https://github.com/python/cpython/issues/90016\n\n(128) https://github.com/python/cpython/issues/94254\n\n(129) https://github.com/python/cpython/issues/93259\n\n(130) https://github.com/python/cpython/issues/74696\n\n(131) https://github.com/python/cpython/issues/94216\n\n(132) https://github.com/python/cpython/issues/93096\n\n(133) https://github.com/python/cpython/issues/94207\n\n(134) https://github.com/python/cpython/issues/93096\n\n(135) https://github.com/python/cpython/issues/94226\n\n(136) https://github.com/python/cpython/issues/94199\n\n(137) https://github.com/python/cpython/issues/94214\n\n(138) https://github.com/python/cpython/issues/94199\n\n(139) https://cwe.mitre.org/data/definitions/295.html\n\n(140) https://github.com/python/cpython/issues/94199\n\n(141) https://github.com/python/cpython/issues/94199\n\n(142) https://peps.python.org/pep-0644/\n\n(143) https://github.com/python/cpython/issues/94196\n\n(144) https://github.com/python/cpython/issues/94182\n\n(145) https://github.com/python/cpython/issues/94169\n\n(146) https://github.com/python/cpython/issues/91742\n\n(147) https://github.com/python/cpython/issues/94101\n\n(148) https://github.com/python/cpython/issues/84753\n\n(149) https://github.com/python/cpython/issues/94028\n\n(150) https://github.com/python/cpython/issues/93973\n\n(151) https://github.com/python/cpython/issues/93963\n\n(152) https://github.com/python/cpython/issues/93858\n\n(153) https://github.com/python/cpython/issues/93820\n\n(154) https://github.com/python/cpython/issues/93847\n\n(155) https://github.com/python/cpython/issues/91404\n\n(156) https://github.com/python/cpython/issues/83499\n\n(157) https://github.com/python/cpython/issues/93820\n\n(158) https://github.com/python/cpython/issues/79512\n\n(159) https://github.com/python/cpython/issues/91389\n\n(160) https://github.com/python/cpython/issues/93626\n\n(161) https://github.com/python/cpython/issues/90473\n\n(162) https://peps.python.org/pep-0370/\n\n(163) https://github.com/python/cpython/issues/90494\n\n(164) https://github.com/python/cpython/issues/90549\n\n(165) https://github.com/python/cpython/issues/93521\n\n(166) https://github.com/python/cpython/issues/79579\n\n(167) https://github.com/python/cpython/issues/93421\n\n(168) https://github.com/python/cpython/issues/93475\n\n(169) https://github.com/python/cpython/issues/93370\n\n(170) https://github.com/python/cpython/issues/91810\n\n(171) https://github.com/python/cpython/issues/91162\n\n(172) https://github.com/python/cpython/issues/93353\n\n(173) https://github.com/python/cpython/issues/83658\n\n(174) https://github.com/python/cpython/issues/93312\n\n(175) https://github.com/python/cpython/issues/88123\n\n(176) https://github.com/python/cpython/issues/93297\n\n(177) https://github.com/python/cpython/issues/85308\n\n(178) https://github.com/python/cpython/issues/93156\n\n(179) https://github.com/python/cpython/issues/93162\n\n(180) https://github.com/python/cpython/issues/93243\n\n(181) https://peps.python.org/pep-0594/\n\n(182) https://github.com/python/cpython/issues/92886\n\n(183) https://github.com/python/cpython/issues/90155\n\n(184) https://github.com/python/cpython/issues/90817\n\n(185) https://github.com/python/cpython/issues/91513\n\n(186) https://github.com/python/cpython/issues/74696\n\n(187) https://github.com/python/cpython/issues/92728\n\n(188) https://github.com/python/cpython/issues/93033\n\n(189) https://github.com/python/cpython/issues/89973\n\n(190) https://github.com/python/cpython/issues/93044\n\n(191) https://github.com/python/cpython/issues/93010\n\n(192) https://github.com/python/cpython/issues/92986\n\n(193) https://github.com/python/cpython/issues/92932\n\n(194) https://github.com/python/cpython/issues/92675\n\n(195) https://github.com/python/cpython/issues/87901\n\n(196) https://github.com/python/cpython/issues/91922\n\n(197) https://github.com/python/cpython/issues/92869\n\n(198) https://github.com/python/cpython/issues/92839\n\n(199) https://github.com/python/cpython/issues/90473\n\n(200) https://github.com/python/cpython/issues/89325\n\n(201) https://github.com/python/cpython/issues/92734\n\n(202) https://github.com/python/cpython/issues/92671\n\n(203) https://github.com/python/cpython/issues/91581\n\n(204) https://github.com/python/cpython/issues/86388\n\n(205) https://github.com/python/cpython/issues/90385\n\n(206) https://github.com/python/cpython/issues/92550\n\n(207) https://github.com/python/cpython/issues/92591\n\n(208) https://github.com/python/cpython/issues/92445\n\n(209) https://github.com/python/cpython/issues/92547\n\n(210) https://github.com/python/cpython/issues/92530\n\n(211) https://github.com/python/cpython/issues/92531\n\n(212) https://github.com/python/cpython/issues/84131\n\n(213) https://github.com/python/cpython/issues/89336\n\n(214) https://github.com/python/cpython/issues/92391\n\n(215) https://github.com/python/cpython/issues/91968\n\n(216) https://github.com/python/cpython/issues/91810\n\n(217) https://github.com/python/cpython/issues/81790\n\n(218) https://github.com/python/cpython/issues/91760\n\n(219) https://github.com/python/cpython/issues/90622\n\n(220) https://github.com/python/cpython/issues/91577\n\n(221) https://github.com/python/cpython/issues/91581\n\n(222) https://github.com/python/cpython/issues/91539\n\n(223) https://github.com/python/cpython/issues/91524\n\n(224) https://github.com/python/cpython/issues/91447\n\n(225) https://github.com/python/cpython/issues/91456\n\n(226) https://bugs.python.org/issue?@action=redirect&bpo=47231\n\n(227) https://bugs.python.org/issue?@action=redirect&bpo=39064\n\n(228) https://bugs.python.org/issue?@action=redirect&bpo=41287\n\n(229) https://github.com/python/cpython/issues/90005\n\n(230) https://bugs.python.org/issue?@action=redirect&bpo=32547\n\n(231) https://bugs.python.org/issue?@action=redirect&bpo=35540\n\n(232) https://bugs.python.org/issue?@action=redirect&bpo=47063\n\n(233) https://bugs.python.org/issue?@action=redirect&bpo=47025\n\n(234) https://bugs.python.org/issue?@action=redirect&bpo=46951\n\n(235) https://bugs.python.org/issue?@action=redirect&bpo=42777\n\n(236) https://bugs.python.org/issue?@action=redirect&bpo=46755\n\n(237) https://bugs.python.org/issue?@action=redirect&bpo=45393\n\n(238) https://bugs.python.org/issue?@action=redirect&bpo=46642\n\n(239) https://bugs.python.org/issue?@action=redirect&bpo=46364\n\n(240) https://bugs.python.org/issue?@action=redirect&bpo=28249\n\n(241) https://bugs.python.org/issue?@action=redirect&bpo=46197\n\n(242) https://bugs.python.org/issue?@action=redirect&bpo=45924\n\n(243) https://bugs.python.org/issue?@action=redirect&bpo=45046\n\n(244) https://bugs.python.org/issue?@action=redirect&bpo=44173\n\n(245) https://bugs.python.org/issue?@action=redirect&bpo=42627\n\n(246) https://bugs.python.org/issue?@action=redirect&bpo=42047\n\n(247) https://bugs.python.org/issue?@action=redirect&bpo=14243\n\n(248) https://bugs.python.org/issue?@action=redirect&bpo=41246\n\n(249) https://bugs.python.org/issue?@action=redirect&bpo=39264\n\n(250) https://bugs.python.org/issue?@action=redirect&bpo=38693\n\n(251) https://bugs.python.org/issue?@action=redirect&bpo=38267\n\n(252) https://bugs.python.org/issue?@action=redirect&bpo=34828\n\n(253) https://bugs.python.org/issue?@action=redirect&bpo=32990\n\n(254) https://bugs.python.org/issue?@action=redirect&bpo=26253\n\nFile: python3.12.info,  Node: Documentation<18>,  Next: Tests<16>,  Prev: Library<18>,  Up: Python 3 12 0 alpha 1\n\n1.22.18.4 Documentation\n.......................\n\n- gh-85525(1): Remove extra row\n\n- gh-86404(2): Deprecated tools 'make suspicious' and 'rstlint.py'\nare now removed.  They have been replaced by spinx-lint(3).\n\n- gh-97741(4): Fix '!' in c domain ref target syntax via a 'conf.py'\npatch, so it works as intended to disable ref target resolution.\n\n- gh-96432(5): Fraction literals now support whitespace around the\nforward slash, 'Fraction('2 / 3')'.\n\n- gh-96098(6): Improve discoverability of the higher level\nconcurrent.futures module by providing clearer links from the lower\nlevel threading and multiprocessing modules.\n\n- gh-95957(7): What's New 3.11 now has instructions for how to\nprovide compiler and linker flags for Tcl/Tk and OpenSSL on RHEL 7\nand CentOS 7.\n\n- gh-95588(8): Clarified the conflicting advice given in the *note\nast: 8. documentation about *note ast.literaleval(): a5e. being\n\"safe\" for use on untrusted input while at the same time warning\nthat it can crash the process.  The latter statement is true and is\ndeemed unfixable without a large amount of work unsuitable for a\nbugfix.  So we keep the warning and no longer claim that\n'literaleval' is safe.\n\n- gh-91207(9): Fix stylesheet not working in Windows CHM htmlhelp\ndocs and add warning that they are deprecated.  Contributed by\nC.A.M. Gerlach.\n\n- gh-95454(10): Replaced incorrectly written true/false values in\ndocumentiation.  Patch by Robert O'Shea\n\n- gh-95451(11): Update library documentation with *note availability\ninformation: 153e. on WebAssembly platforms 'wasm32-emscripten' and\n'wasm32-wasi'.\n\n- gh-95415(12): Use consistent syntax for platform availability.  The\ndirective now supports a content body and emits a warning when it\nencounters an unknown platform.\n\n- gh-94321(13): Document the PEP 246(14) style protocol type *note\nsqlite3.PrepareProtocol: 153f.\n\n- gh-86128(15): Document a limitation in ThreadPoolExecutor where its\nexit handler is executed before any handlers in atexit.\n\n- gh-61162(16): Clarify *note sqlite3: c9. behavior when *note How to\nuse the connection context manager: 1540.\n\n- gh-87260(17): Align *note sqlite3: c9. argument specs with the\nactual implementation.\n\n- gh-86986(18): The minimum Sphinx version required to build the\ndocumentation is now 3.2.\n\n- gh-88831(19): Augmented documentation of asyncio.createtask().\nClarified the need to keep strong references to tasks and added a\ncode snippet detailing how to do this.\n\n- gh-86438(20): Clarify that *note -W: 6df. and *note PYTHONWARNINGS:\n9ee. are matched literally and case-insensitively, rather than as\nregular expressions, in *note warnings: 10d.\n\n- gh-93031(21): Update tutorial introduction output to use 3.10+\nSyntaxError invalid range.\n\n- gh-92240(22): Added release dates for \"What's New in Python 3.X\"\nfor 3.0, 3.1, 3.2, 3.8 and 3.10\n\n- bpo-47161(23): Document that *note pathlib.PurePath: 1c5. does not\ncollapse initial double slashes because they denote UNC paths.\n\n- bpo-40838(24): Document that *note inspect.getdoc(): 821, *note\ninspect.getmodule(): 1541, and *note inspect.getsourcefile(): 1542.\nmight return 'None'.\n\n- bpo-43689(25): The 'Differ' documentation now also mentions other\nwhitespace characters, which make it harder to understand the diff\noutput.\n\n- bpo-38056(26): Overhaul the *note Error Handlers: 1543.\ndocumentation in *note codecs: 19.\n\n- bpo-13553(27): Document tkinter.Tk args.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/85525\n\n(2) https://github.com/python/cpython/issues/86404\n\n(3) https://pypi.org/project/sphinx-lint/\n\n(4) https://github.com/python/cpython/issues/97741\n\n(5) https://github.com/python/cpython/issues/96432\n\n(6) https://github.com/python/cpython/issues/96098\n\n(7) https://github.com/python/cpython/issues/95957\n\n(8) https://github.com/python/cpython/issues/95588\n\n(9) https://github.com/python/cpython/issues/91207\n\n(10) https://github.com/python/cpython/issues/95454\n\n(11) https://github.com/python/cpython/issues/95451\n\n(12) https://github.com/python/cpython/issues/95415\n\n(13) https://github.com/python/cpython/issues/94321\n\n(14) https://peps.python.org/pep-0246/\n\n(15) https://github.com/python/cpython/issues/86128\n\n(16) https://github.com/python/cpython/issues/61162\n\n(17) https://github.com/python/cpython/issues/87260\n\n(18) https://github.com/python/cpython/issues/86986\n\n(19) https://github.com/python/cpython/issues/88831\n\n(20) https://github.com/python/cpython/issues/86438\n\n(21) https://github.com/python/cpython/issues/93031\n\n(22) https://github.com/python/cpython/issues/92240\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=47161\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=40838\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=43689\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=38056\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=13553\n\nFile: python3.12.info,  Node: Tests<16>,  Next: Build<16>,  Prev: Documentation<18>,  Up: Python 3 12 0 alpha 1\n\n1.22.18.5 Tests\n...............\n\n- gh-95027(1): On Windows, when the Python test suite is run with the\n'-jN' option, the ANSI code page is now used as the encoding for\nthe stdout temporary file, rather than using UTF-8 which can lead\nto decoding errors.  Patch by Victor Stinner.\n\n- gh-96624(2): Fixed the failure of repeated runs of\n'test.testunittest' caused by side effects in\n'testdottedbutmodulenotloaded'.\n\n- gh-95243(3): Mitigate the inherent race condition from using\nfindunusedport() in testSockName() by trying to find an unused\nport a few times before failing.  Patch by Ross Burton.\n\n- gh-95573(4): Lib/test/testasyncio/testssl.py(5) exposed a bug in\nthe macOS kernel where intense concurrent load on non-blocking\nsockets occasionally causes *note errno.ENOBUFS: 1545. (\"No buffer\nspace available\") to be emitted.  FB11063974 filed with Apple, in\nthe mean time as a workaround buffer size used in tests on macOS is\ndecreased to avoid intermittent failures.  Patch by Fantix King.\n\n- gh-95280(6): Fix problem with 'testssl' 'testgetciphers' on\nsystems that require perfect forward secrecy (PFS) ciphers.\n\n- gh-95212(7): Make multiprocessing test case\n'testsharedmemoryrecreate' parallel-safe.\n\n- gh-95218(8): Move tests for importlib.resources into\ntestimportlib.resources.\n\n- gh-93963(9): Updated tests to use preferred location for\n'importlib.resources' ABCs.\n\n- gh-94675(10): Add a regression test for *note re: b4. exponentional\nslowdown when using rjsmin.\n\n- gh-91330(11): Added more tests for *note dataclasses: 2d. to cover\nbehavior with data descriptor-based fields.\n\n- gh-94208(12): 'testssl' is now checking for supported TLS version\nand protocols in more tests.\n\n- gh-94315(13): Tests now check for DAC override capability instead\nof relying on *note os.geteuid(): 1546.\n\n- gh-54781(14): Rename testtk to testtkinter, and rename\ntestttkguionly to testttk.  Patch by Victor Stinner.\n\n- gh-93839(15): Move 'Lib/ctypes/test/' to 'Lib/test/testctypes/'.\nPatch by Victor Stinner.\n\n- gh-93951(16): In testbdb.StateTestCase.testskip, avoid including\nauxiliary importers.\n\n- gh-93957(17): Provide nicer error reporting from subprocesses in\ntestvenv.EnsurePipTest.testwithpip.\n\n- gh-93884(18): Add test cases for *note PyNumberToBase(): 1547.\nthat take a large number or a non-int object as parameter.\n\n- gh-93852(19): testasyncio, testlogging, testsocket and\ntestsocketserver now create AFUNIX domains in the current\ndirectory to no longer fail with 'OSError(\"AFUNIX path too long\")'\nif the temporary directory (the 'TMPDIR' environment variable) is\ntoo long.  Patch by Victor Stinner.\n\n- gh-93353(20): regrtest now checks if a test leaks temporary files\nor directories if run with -jN option.  Patch by Victor Stinner.\n\n- gh-84461(21): 'runtests.py' now handles cross compiling env vars\ncorrectly and pass 'HOSTRUNNER' to regression tests.\n\n- gh-93616(22): 'testmodulefinder' now creates a temporary directory\nin 'ModuleFinderTest.setUp()' instead of module scope.\n\n- gh-93575(23): Fix issue with testunicode testraiseMemError.  The\ntest case now use 'test.support.calcobjsize' to calculate size of\nPyUnicode structs.  *note sys.getsizeof(): 14b9. may return\ndifferent size when string has UTF-8 memory.\n\n- gh-90473(24): WASI does not have a 'chmod(2)' syscall.  *note\nos.chmod(): f5d. is now a dummy function on WASI. Skip all tests\nthat depend on working *note os.chmod(): f5d.\n\n- gh-90473(25): Skip tests on WASI that require symlinks with\nabsolute paths.\n\n- gh-57539(26): Increase calendar test coverage for\n'calendar.LocaleTextCalendar.formatweekday()'.\n\n- gh-90473(27): Skip symlink tests on WASI. wasmtime uses\n'openat2(2)' with 'RESOLVEBENEATH' flag, which prevents symlinks\nwith absolute paths.\n\n- gh-89858(28): Fix 'testembed' for out-of-tree builds.  Patch by\nKumar Aditya.\n\n- gh-92886(29): Fixing tests that fail when running with\noptimizations ('-O') in 'testimaplib.py'.\n\n- gh-92886(30): Fixing tests that fail when running with\noptimizations ('-O') in 'testzipimport.py'\n\n- gh-92886(31): Fixing tests that fail when running with\noptimizations ('-O') in 'testpycompile.py'\n\n- gh-92886(32): Fixing tests that fail when running with\noptimizations ('-O') in 'testsyssettrace.py'.\n\n- gh-92886(33): Fixing tests that fail when running with\noptimizations ('-O') in 'testmultiprocessing.py'\n\n- gh-92670(34): Skip\n'testshutil.TestCopy.testcopyfilenonexistentdir' test on AIX as\nthe test uses a trailing slash to force the OS consider the path as\na directory, but on AIX the trailing slash has no effect and is\nconsidered as a file.\n\n- gh-92514(35): Remove unused 'test.support.BasicTestRunner'.  Patch\nby Jelle Zijlstra.\n\n- bpo-47016(36): Create a GitHub Actions workflow for verifying\nbundled pip and setuptools.  Patch by Illia Volochii and Adam\nTurner.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/95027\n\n(2) https://github.com/python/cpython/issues/96624\n\n(3) https://github.com/python/cpython/issues/95243\n\n(4) https://github.com/python/cpython/issues/95573\n\n(5)\nhttps://github.com/python/cpython/tree/3.12/Lib/test/testasyncio/testssl.py\n\n(6) https://github.com/python/cpython/issues/95280\n\n(7) https://github.com/python/cpython/issues/95212\n\n(8) https://github.com/python/cpython/issues/95218\n\n(9) https://github.com/python/cpython/issues/93963\n\n(10) https://github.com/python/cpython/issues/94675\n\n(11) https://github.com/python/cpython/issues/91330\n\n(12) https://github.com/python/cpython/issues/94208\n\n(13) https://github.com/python/cpython/issues/94315\n\n(14) https://github.com/python/cpython/issues/54781\n\n(15) https://github.com/python/cpython/issues/93839\n\n(16) https://github.com/python/cpython/issues/93951\n\n(17) https://github.com/python/cpython/issues/93957\n\n(18) https://github.com/python/cpython/issues/93884\n\n(19) https://github.com/python/cpython/issues/93852\n\n(20) https://github.com/python/cpython/issues/93353\n\n(21) https://github.com/python/cpython/issues/84461\n\n(22) https://github.com/python/cpython/issues/93616\n\n(23) https://github.com/python/cpython/issues/93575\n\n(24) https://github.com/python/cpython/issues/90473\n\n(25) https://github.com/python/cpython/issues/90473\n\n(26) https://github.com/python/cpython/issues/57539\n\n(27) https://github.com/python/cpython/issues/90473\n\n(28) https://github.com/python/cpython/issues/89858\n\n(29) https://github.com/python/cpython/issues/92886\n\n(30) https://github.com/python/cpython/issues/92886\n\n(31) https://github.com/python/cpython/issues/92886\n\n(32) https://github.com/python/cpython/issues/92886\n\n(33) https://github.com/python/cpython/issues/92886\n\n(34) https://github.com/python/cpython/issues/92670\n\n(35) https://github.com/python/cpython/issues/92514\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=47016\n\nFile: python3.12.info,  Node: Build<16>,  Next: Windows<16>,  Prev: Tests<16>,  Up: Python 3 12 0 alpha 1\n\n1.22.18.6 Build\n...............\n\n- gh-96761(1): Fix the build process of clang compiler for\n'bootstrappython' if LTO optimization is applied.  Patch by\nMatthias Go\"rgens and Donghee Na.\n\n- gh-96883(2): 'wasm32-emscripten' builds for browsers now include\n*note concurrent.futures: 1f. for *note asyncio: 9. and *note\nunittest.mock: 102.\n\n- gh-85936(3): CPython now uses the ThinLTO option as the default\npolicy if the Clang compiler accepts the flag.  Patch by Donghee\nNa.\n\n- gh-96729(4): Ensure that Windows releases built with\n'Tools\\msi\\buildrelease.bat' are upgradable to and from official\nPython releases.\n\n- gh-96269(5): Shared module targets now depend on new 'MODULEDEPS'\nvariable, which includes 'EXPORTSYMS'.  This fixes a build order\nissue on unsupported AIX platform.\n\n- gh-84461(6): 'wasm32-emscripten' platform no longer builds *note\nresource: b7. module, *note getresuid(): 118d, *note getresgid():\n118c, and their setters.  The APIs are stubs and not functional.\n\n- gh-95973(7): Add a new '--with-dsymutil' configure option to link\ndebug information in macOS. Patch by Pablo Galindo.\n\n- gh-90536(8): Use the BOLT post-link optimizer to improve\nperformance, particularly on medium-to-large applications.\n\n- gh-93744(9): Remove the 'configure --with-cxx-main' build option:\nit didn't work for many years.  Remove the 'MAINCC' variable from\n'configure' and 'Makefile'.  Patch by Victor Stinner.\n\n- gh-94801(10): Fix a regression in 'configure' script that caused\nsome header checks to ignore custom 'CPPFLAGS'.  The regression was\nintroduced in gh-94802(11).\n\n- gh-95145(12): wasm32-wasi builds no longer depend on WASIX's\npthread stubs.  Python now has its own stubbed pthread API.\n\n- gh-95174(13): Python now detects missing 'dup' function in WASI and\nworks around some missing *note errno: 52, *note select: bc, and\n*note socket: c6. constants.\n\n- gh-95174(14): Python now skips missing *note socket: c6. functions\nand methods on WASI. WASI can only create sockets from existing fd\n/ accept and has no netdb.\n\n- gh-95085(15): Platforms 'wasm32-unknown-emscripten' and\n'wasm32-unknown-wasi' have been promoted to PEP 11(16) tier 3\nplatform support.\n\n- gh-94847(17): Fixed 'decimal' module build issue on GCC when\ncompiling with LTO and pydebug.  Debug builds no longer force\ninlining of functions.\n\n- gh-94841(18): Fix the possible performance regression of *note\nPyObjectFree(): ab0. compiled with MSVC version 1932.\n\n- gh-94801(19): 'configure' now uses custom flags like 'ZLIBCFLAGS'\nand 'ZLIBLIBS' when searching for headers and libraries.\n\n- gh-94773(20): 'deepfreeze.py' now supports code object with\nfrozensets that contain incompatible, unsortable types.\n\n- gh-94682(21): Build and test with OpenSSL 1.1.1q\n\n- gh-90005(22): Dependencies of *note readline: b5. and *note curses:\n29. module are now detected in 'configure' script with\n'pkg-config'.  Only 'ncurses' / 'ncursesw' are detected\nautomatically.  The old 'curses' library is not configured\nautomatically.  Workaround for missing 'termcap' or 'tinfo' library\nhas been removed.\n\n- gh-90005(23): Fix building 'ctypes' extension without\n'pkg-config'.\n\n- gh-90005(24): 'dbm' module dependencies are now detected by\nconfigure.\n\n- gh-94404(25): 'makesetup' now works around an issue with sed on\nmacOS and uses correct CFLAGS for object files that end up in a\nshared extension.  Module CFLAGS are used before\nPYSTDMODULECFLAGS to avoid clashes with system headers.\n\n- gh-93939(26): C extension modules are now built by 'configure' and\n'make' instead of 'distutils' and 'setup.py'.\n\n- gh-93939(27): The '2to3', 'idle', and 'pydoc' scripts are now\ngenerated and installed by 'Makefile' instead of 'setup.py'.\n\n- gh-94280(28): Updated pegen regeneration script on Windows to find\nand use Python 3.9 or higher.  Prior to this, pegen regeneration\nalready required 3.9 or higher, but the script may have used lower\nversions of Python.\n\n- gh-93584(29): Address race condition in 'Makefile' when installing\na PGO build.  All 'test' and 'install' targets now depend on 'all'\ntarget.\n\n- gh-93491(30): 'configure' now detects and reports PEP 11(31)\nsupport tiers.\n\n- gh-69093(32): Fix 'Modules/Setup.stdlib.in' rule for 'sqlite3'\nextension.\n\n- gh-93207(33): 'vastart()' with two parameters, like\n'vastart(args, format),' is now required to build Python.\n'vastart()' is no longer called with a single parameter.  Patch by\nKumar Aditya.\n\n- gh-93202(34): Python now always use the '%zu' and '%zd' printf\nformats to format a 'sizet' or 'Pyssizet' number.  Building\nPython 3.12 requires a C11 compiler, so these printf formats are\nnow always supported.  Patch by Victor Stinner.\n\n- gh-90473(35): Disable pymalloc and increase stack size on\n'wasm32-wasi'.\n\n- bpo-34449(36): Drop invalid compiler switch '-fPIC' for HP aCC on\nHP-UX. Patch by Michael Osipov.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/96761\n\n(2) https://github.com/python/cpython/issues/96883\n\n(3) https://github.com/python/cpython/issues/85936\n\n(4) https://github.com/python/cpython/issues/96729\n\n(5) https://github.com/python/cpython/issues/96269\n\n(6) https://github.com/python/cpython/issues/84461\n\n(7) https://github.com/python/cpython/issues/95973\n\n(8) https://github.com/python/cpython/issues/90536\n\n(9) https://github.com/python/cpython/issues/93744\n\n(10) https://github.com/python/cpython/issues/94801\n\n(11) https://github.com/python/cpython/issues/94802\n\n(12) https://github.com/python/cpython/issues/95145\n\n(13) https://github.com/python/cpython/issues/95174\n\n(14) https://github.com/python/cpython/issues/95174\n\n(15) https://github.com/python/cpython/issues/95085\n\n(16) https://peps.python.org/pep-0011/\n\n(17) https://github.com/python/cpython/issues/94847\n\n(18) https://github.com/python/cpython/issues/94841\n\n(19) https://github.com/python/cpython/issues/94801\n\n(20) https://github.com/python/cpython/issues/94773\n\n(21) https://github.com/python/cpython/issues/94682\n\n(22) https://github.com/python/cpython/issues/90005\n\n(23) https://github.com/python/cpython/issues/90005\n\n(24) https://github.com/python/cpython/issues/90005\n\n(25) https://github.com/python/cpython/issues/94404\n\n(26) https://github.com/python/cpython/issues/93939\n\n(27) https://github.com/python/cpython/issues/93939\n\n(28) https://github.com/python/cpython/issues/94280\n\n(29) https://github.com/python/cpython/issues/93584\n\n(30) https://github.com/python/cpython/issues/93491\n\n(31) https://peps.python.org/pep-0011/\n\n(32) https://github.com/python/cpython/issues/69093\n\n(33) https://github.com/python/cpython/issues/93207\n\n(34) https://github.com/python/cpython/issues/93202\n\n(35) https://github.com/python/cpython/issues/90473\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=34449\n\nFile: python3.12.info,  Node: Windows<16>,  Next: macOS<12>,  Prev: Build<16>,  Up: Python 3 12 0 alpha 1\n\n1.22.18.7 Windows\n.................\n\n- gh-98360(1): Fixes *note multiprocessing: 8f. spawning child\nprocesses on Windows from a virtual environment to ensure that\nchild processes that also use *note multiprocessing: 8f. to spawn\nmore children will recognize that they are in a virtual\nenvironment.\n\n- gh-98414(2): Fix 'py.exe' launcher handling of '-V:<COMPANY>/'\noption when default preferences have been set in environment\nvariables or configuration files.\n\n- gh-97728(3): Fix possible crashes caused by the use of\nuninitialized variables when pass invalid arguments in *note\nos.system(): 12b2. on Windows and in Windows-specific modules (like\n'winreg').\n\n- gh-90989(4): Made *note Python Launcher for Windows: 37f. install\nper-user by default (unless an all users install already exists),\nand clarify some text in the installer.\n\n- gh-97649(5): The 'Tools' directory is no longer installed on\nWindows\n\n- gh-96965(6): Update libffi to 3.4.3\n\n- gh-96577(7): Fixes a potential buffer overrun in *note msilib: 8d.\n\n- gh-96559(8): Fixes the Windows launcher not using the compatible\ninterpretation of default tags found in configuration files when no\ntag was passed to the command.\n\n- gh-94781(9): Fix 'pcbuild.proj' to clean previous instances of\noutput files in 'Python\\deepfreeze' and 'Python\\frozenmodules'\ndirectories on Windows.  Patch by Charlie Zhao.\n\n- gh-89545(10): Updates *note platform: a5. code getting the Windows\nversion to use native Windows Management Instrumentation (WMI)\nqueries to determine OS version, type, and architecture.\n\n- gh-95733(11): Make certain requirements of the Windows Store\npackage optional to allow installing on earlier updates of Windows.\n\n- gh-95656(12): Enable the *note enableloadextension(): 634. *note\nsqlite3: c9. API.\n\n- gh-95587(13): Fixes some issues where the Windows installer would\nincorrectly detect certain features of an existing install when\nupgrading.\n\n- gh-94399(14): Restores the behaviour of *note Python Launcher for\nWindows: 37f. for '/usr/bin/env' shebang lines, which will now\nsearch 'PATH' for an executable matching the given command.  If\nnone is found, the usual search process is used.\n\n- gh-95445(15): Fixes the unsuccessful removal of the HTML document\ndirectory when uninstalling with Windows msi.\n\n- gh-95359(16): Fix *note Python Launcher for Windows: 37f. handling\nof 'py.ini' commands (it was incorrectly expecting a 'py' prefix\non keys) and crashes when reading per-user configuration file.\n\n- gh-95285(17): Fix *note Python Launcher for Windows: 37f. handling\nof command lines where it is only passed a short executable name.\n\n- gh-90844(18): Allow virtual environments to correctly launch when\nthey have spaces in the path.\n\n- gh-94772(19): Fix incorrect handling of shebang lines in py.exe\nlauncher\n\n- gh-94018(20): *note zipfile: 12b. will now remove trailing spaces\nfrom path components when extracting files on Windows.\n\n- gh-93824(21): Drag and drop of files onto Python files in Windows\nExplorer has been enabled for Windows ARM64.\n\n- gh-43414(22): *note os.getterminalsize(): f72. now attempts to\nread the size from any provided handle, rather than only supporting\nfile descriptors 0, 1 and 2.\n\n- gh-92817(23): Ensures that 'py.exe' will prefer an active virtual\nenvironment over default tags specified with environment variables\nor through a 'py.ini' file.\n\n- gh-92984(24): Explicitly disable incremental linking for non-Debug\nbuilds\n\n- gh-92841(25): *note asyncio: 9. no longer throws 'RuntimeError:\nEvent loop is closed' on interpreter exit after asynchronous socket\nactivity.  Patch by Oleg Iarygin.\n\n- bpo-46907(26): Update Windows installer to use SQLite 3.38.4.\n\n- gh-91061(27): Accept os.PathLike for the argument to\nwinsound.PlaySound\n\n- bpo-42658(28): Support native Windows case-insensitive path\ncomparisons by using 'LCMapStringEx' instead of *note str.lower():\n154a. in 'ntpath.normcase()'.  Add 'LCMapStringEx' to the 'winapi'\nmodule.\n\n- bpo-38704(29): Prevent installation on unsupported Windows\nversions.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/98360\n\n(2) https://github.com/python/cpython/issues/98414\n\n(3) https://github.com/python/cpython/issues/97728\n\n(4) https://github.com/python/cpython/issues/90989\n\n(5) https://github.com/python/cpython/issues/97649\n\n(6) https://github.com/python/cpython/issues/96965\n\n(7) https://github.com/python/cpython/issues/96577\n\n(8) https://github.com/python/cpython/issues/96559\n\n(9) https://github.com/python/cpython/issues/94781\n\n(10) https://github.com/python/cpython/issues/89545\n\n(11) https://github.com/python/cpython/issues/95733\n\n(12) https://github.com/python/cpython/issues/95656\n\n(13) https://github.com/python/cpython/issues/95587\n\n(14) https://github.com/python/cpython/issues/94399\n\n(15) https://github.com/python/cpython/issues/95445\n\n(16) https://github.com/python/cpython/issues/95359\n\n(17) https://github.com/python/cpython/issues/95285\n\n(18) https://github.com/python/cpython/issues/90844\n\n(19) https://github.com/python/cpython/issues/94772\n\n(20) https://github.com/python/cpython/issues/94018\n\n(21) https://github.com/python/cpython/issues/93824\n\n(22) https://github.com/python/cpython/issues/43414\n\n(23) https://github.com/python/cpython/issues/92817\n\n(24) https://github.com/python/cpython/issues/92984\n\n(25) https://github.com/python/cpython/issues/92841\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=46907\n\n(27) https://github.com/python/cpython/issues/91061\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=42658\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=38704\n\nFile: python3.12.info,  Node: macOS<12>,  Next: IDLE<8>,  Prev: Windows<16>,  Up: Python 3 12 0 alpha 1\n\n1.22.18.8 macOS\n...............\n\n- gh-97897(1): The macOS 13 SDK includes support for the 'mkfifoat'\nand 'mknodat' system calls.  Using the 'dirfd' option with either\n*note os.mkfifo(): bec. or *note os.mknod(): bed. could result in a\nsegfault if cpython is built with the macOS 13 SDK but run on an\nearlier version of macOS. Prevent this by adding runtime support\nfor detection of these system calls (\"weaklinking\") as is done for\nother newer syscalls on macOS.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/97897\n\nFile: python3.12.info,  Node: IDLE<8>,  Next: Tools/Demos<11>,  Prev: macOS<12>,  Up: Python 3 12 0 alpha 1\n\n1.22.18.9 IDLE\n..............\n\n- gh-97527(1): Fix a bug in the previous bugfix that caused IDLE to\nnot start when run with 3.10.8, 3.12.0a1, and at least Microsoft\nPython 3.10.2288.0 installed without the Lib/test package.  3.11.0\nwas never affected.\n\n- gh-65802(2): Document handling of extensions in Save As dialogs.\n\n- gh-95191(3): Include prompts when saving Shell (interactive input\nand output).\n\n- gh-95511(4): Fix the Shell context menu copy-with-prompts bug of\ncopying an extra line when one selects whole lines.\n\n- gh-95471(5): In the Edit menu, move 'Select All' and add a new\nseparator.\n\n- gh-95411(6): Enable using IDLE's module browser with .pyw files.\n\n- gh-89610(7): Add .pyi as a recognized extension for IDLE on macOS.\nThis allows opening stub files by double clicking on them in the\nFinder.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/97527\n\n(2) https://github.com/python/cpython/issues/65802\n\n(3) https://github.com/python/cpython/issues/95191\n\n(4) https://github.com/python/cpython/issues/95511\n\n(5) https://github.com/python/cpython/issues/95471\n\n(6) https://github.com/python/cpython/issues/95411\n\n(7) https://github.com/python/cpython/issues/89610\n\nFile: python3.12.info,  Node: Tools/Demos<11>,  Next: C API<14>,  Prev: IDLE<8>,  Up: Python 3 12 0 alpha 1\n\n1.22.18.10 Tools/Demos\n......................\n\n- gh-68686(1): Remove ptags and eptags scripts.\n\n- gh-97681(2): Remove the 'Tools/demo/' directory which contained old\ndemo scripts.  A copy can be found in the old-demos project(3).\nPatch by Victor Stinner.\n\n- gh-97669(4): Remove outdated example scripts of the\n'Tools/scripts/' directory.  A copy can be found in the old-demos\nproject(5).  Patch by Victor Stinner.\n\n- gh-95853(6): The 'wasmbuild.py' script now pre-builds Emscripten\nports, checks for broken EMSDK versions, and warns about pkg-config\nenv vars.\n\n- gh-95853(7): The new tool 'Tools/wasm/wasmbuilder.py' automates\nconfigure, compile, and test steps for building CPython on\nWebAssembly platforms.\n\n- gh-95731(8): Fix handling of module docstrings in\n'Tools/i18n/pygettext.py'.\n\n- gh-93939(9): Add script 'Tools/scripts/checkmodules.py' to check\nand validate builtin and shared extension modules.  The script also\nhandles 'Modules/Setup' and will eventually replace 'setup.py'.\n\n- gh-94538(10): Fix Argument Clinic output to custom file\ndestinations.  Patch by Erlend E. Aasland.\n\n- gh-94430(11): Allow parameters named 'module' and 'self' with\ncustom C names in Argument Clinic.  Patch by Erlend E. Aasland\n\n- gh-86087(12): The 'Tools/scripts/parseentities.py' script used to\nparse HTML4 entities has been removed.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/68686\n\n(2) https://github.com/python/cpython/issues/97681\n\n(3) https://github.com/gvanrossum/old-demos\n\n(4) https://github.com/python/cpython/issues/97669\n\n(5) https://github.com/gvanrossum/old-demos\n\n(6) https://github.com/python/cpython/issues/95853\n\n(7) https://github.com/python/cpython/issues/95853\n\n(8) https://github.com/python/cpython/issues/95731\n\n(9) https://github.com/python/cpython/issues/93939\n\n(10) https://github.com/python/cpython/issues/94538\n\n(11) https://github.com/python/cpython/issues/94430\n\n(12) https://github.com/python/cpython/issues/86087\n\nFile: python3.12.info,  Node: C API<14>,  Prev: Tools/Demos<11>,  Up: Python 3 12 0 alpha 1\n\n1.22.18.11 C API\n................\n\n- gh-98393(1): The *note PyUnicodeFSDecoder(): 2d9. function no\nlonger accepts bytes-like paths, like *note bytearray: 294. and\n*note memoryview: 17f. types: only the exact *note bytes: 295. type\nis accepted for bytes strings.  Patch by Victor Stinner.\n\n- gh-91051(2): Add *note PyTypeWatch(): 2c0. and related APIs to\nallow callbacks on *note PyTypeModified(): 154f.\n\n- gh-95756(3): Lazily create and cache 'co' attributes for better\nperformance for code getters.\n\n- gh-96512(4): Configuration for the *note integer string conversion\nlength limitation: 3bc. now lives in the PyConfig C API struct.\n\n- gh-95589(5): Extensions classes that set 'tpdictoffset' and\n'tpweaklistoffset' lose the support for multiple inheritance, but\nare now safe.  Extension classes should use *note\nPyTPFLAGSMANAGEDDICT: 2b4. and *note PyTPFLAGSMANAGEDWEAKREF:\n2b5. instead.\n\n- gh-95781(6): An unrecognized format character in *note\nPyUnicodeFromFormat(): 2d5. and *note PyUnicodeFromFormatV():\n2d6. now sets a *note SystemError: 2d7.  In previous versions it\ncaused all the rest of the format string to be copied as-is to the\nresult string, and any extra arguments discarded.\n\n- gh-92678(7): Restore the 3.10 behavior for multiple inheritance of\nC extension classes that store their dictionary at the end of the\nstruct.\n\n- gh-92678(8): Support C extensions using managed dictionaries by\nsetting the 'PyTPFLAGSMANAGEDDICT' flag.\n\n- gh-93274(9): API for implementing vectorcall (*note\nPyTPFLAGSHAVEVECTORCALL: 2ad, *note PyVectorcallNARGS(): 2ae.\nand *note PyVectorcallCall(): 2af.) was added to the limited API\nand stable ABI.\n\n- gh-95504(10): Fix sign placement when specifying width or precision\nin *note PyUnicodeFromFormat(): 2d5. and *note\nPyUnicodeFromFormatV(): 2d6.  Patch by Philip Georgi.\n\n- gh-93012(11): The *note PyTPFLAGSHAVEVECTORCALL: 2ad. flag is\nnow removed from a class when the class's *note call(): 2b1.\nmethod is reassigned.  This makes vectorcall safe to use with\nmutable types (i.e.  heap types without the 'immutable' flag).\nMutable types that do not override *note tpcall: 2b3. now inherit\nthe *note PyTPFLAGSHAVEVECTORCALL: 2ad. flag.\n\n- gh-95388(12): Creating *note immutable types: 2b2. with mutable\nbases is deprecated and is planned to be disabled in Python 3.14.\n\n- gh-92678(13): Adds unstable C-API functions\n'PyObjectVisitManagedDict' and 'PyObjectClearManagedDict' to\nallow C extensions to allow the VM to manage their object's\ndictionaries.\n\n- gh-94936(14): Added *note PyCodeGetVarnames(): 564, *note\nPyCodeGetCellvars(): 565. and *note PyCodeGetFreevars(): 566. for\naccessing 'covarnames', 'cocellvars' and 'cofreevars'\nrespectively via the C API.\n\n- gh-94930(15): Fix 'SystemError' raised when *note\nPyArgParseTupleAndKeywords(): b68. is used with '#' in '(...)' but\nwithout 'PYSSIZETCLEAN' defined.\n\n- gh-94731(16): Python again uses C-style casts for most casting\noperations when compiled with C++.  This may trigger compiler\nwarnings, if they are enabled with e.g.  '-Wold-style-cast' or\n'-Wzero-as-null-pointer-constant' options for 'g++'.\n\n- gh-93937(17): The following frame functions and type are now\ndirectly available with '#include <Python.h>', it's no longer\nneeded to add '#include <frameobject.h>':\n\n* *note PyFrameCheck(): 570.\n\n* *note PyFrameGetBack(): 571.\n\n* *note PyFrameGetBuiltins(): 556.\n\n* *note PyFrameGetGenerator(): 557.\n\n* *note PyFrameGetGlobals(): 558.\n\n* *note PyFrameGetLasti(): 559.\n\n* *note PyFrameGetLocals(): 572.\n\n* *note PyFrameType: 573.\n\nPatch by Victor Stinner.\n\n- gh-91321(18): Fix the compatibility of the Python C API with C++\nolder than C++11.  Patch by Victor Stinner.\n\n- gh-91731(19): Avoid defining the 'staticassert' when compiling\nwith C++ 11, where this is a keyword and redefining it can lead to\nundefined behavior.  Patch by Pablo Galindo\n\n- gh-89546(20): *note PyTypeFromMetaclass(): 2a9. (and other\n'PyTypeFrom*' functions) now check that offsets and the base\nclass's *note tpbasicsize: 7ab. fit in the new class's\n'tpbasicsize'.\n\n- gh-93503(21): Add two new public functions to the public C-API,\n*note PyEvalSetProfileAllThreads(): 2b9. and *note\nPyEvalSetTraceAllThreads(): 2ba, that allow to set tracing and\nprofiling functions in all running threads in addition to the\ncalling one.  Also, two analogous functions to the *note threading:\ne7. module (*note threading.setprofileallthreads(): 1ef. and\n*note threading.settraceallthreads(): 1ee.) that allow to do the\nsame from Python.  Patch by Pablo Galindo\n\n- gh-93442(22): Add C++ overloads for PyCASTimpl() to handle\n0/NULL. This will allow C++ extensions that pass 0 or NULL to\nmacros using PyCAST() to continue to compile.\n\n- gh-93466(23): Slot IDs in PyTypeSpec may not be repeated.  The\ndocumentation was updated to mention this.  For some cases of\nrepeated slots, PyTypeFromSpec and related functions will now\nraise an exception.\n\n- gh-92898(24): Fix C++ compiler warnings when casting function\narguments to 'PyObject*'.  Patch by Serge Guelton.\n\n- gh-93103(25): Deprecate global configuration variables, like *note\nPyIgnoreEnvironmentFlag: 302, in the documentation: the *note\nPyInitializeFromConfig(): 317. API should be instead.  Patch by\nVictor Stinner.\n\n- gh-77782(26): Deprecate global configuration variable like *note\nPyIgnoreEnvironmentFlag: 302.: the *note\nPyInitializeFromConfig(): 317. API should be instead.  Patch by\nVictor Stinner.\n\n- gh-92913(27): Ensures changes to *note\nPyConfig.modulesearchpaths: 3b6. are ignored unless *note\nPyConfig.modulesearchpathsset: 3b5. is set\n\n- gh-92781(28): Avoid mixing declarations and code in the C API to\nfix the compiler warning: \"ISO C90 forbids mixed declarations and\ncode\" [-Werror=declaration-after-statement].  Patch by Victor\nStinner.\n\n- gh-92651(29): Remove the 'token.h' header file.  There was never\nany public tokenizer C API. The 'token.h' header file was only\ndesigned to be used by Python internals.  Patch by Victor Stinner.\n\n- gh-92536(30): Remove legacy Unicode APIs based on 'PyUNICODE*'.\n\n- gh-85858(31): Remove the 'PyUnicodeInternImmortal()' function and\nthe 'SSTATEINTERNEDIMMORTAL' macro.  Patch by Victor Stinner.\n\n- gh-92193(32): Add new function *note PyFunctionSetVectorcall():\n2bb. to the C API which sets the vectorcall field of a given *note\nPyFunctionObject: 2bc.\n\nWarning: extensions using this API must preserve the behavior of\nthe unaltered function!\n\n- gh-59121(33): Fixed an assert that prevented 'PyRunInteractiveOne'\nfrom providing tracebacks when parsing from the provided FD.\n\n- bpo-45383(34): The *note PyTypeFromSpec(): 2df. API will now find\nand use a metaclass based on the provided bases.  An error will be\nraised if there is a metaclass conflict.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/98393\n\n(2) https://github.com/python/cpython/issues/91051\n\n(3) https://github.com/python/cpython/issues/95756\n\n(4) https://github.com/python/cpython/issues/96512\n\n(5) https://github.com/python/cpython/issues/95589\n\n(6) https://github.com/python/cpython/issues/95781\n\n(7) https://github.com/python/cpython/issues/92678\n\n(8) https://github.com/python/cpython/issues/92678\n\n(9) https://github.com/python/cpython/issues/93274\n\n(10) https://github.com/python/cpython/issues/95504\n\n(11) https://github.com/python/cpython/issues/93012\n\n(12) https://github.com/python/cpython/issues/95388\n\n(13) https://github.com/python/cpython/issues/92678\n\n(14) https://github.com/python/cpython/issues/94936\n\n(15) https://github.com/python/cpython/issues/94930\n\n(16) https://github.com/python/cpython/issues/94731\n\n(17) https://github.com/python/cpython/issues/93937\n\n(18) https://github.com/python/cpython/issues/91321\n\n(19) https://github.com/python/cpython/issues/91731\n\n(20) https://github.com/python/cpython/issues/89546\n\n(21) https://github.com/python/cpython/issues/93503\n\n(22) https://github.com/python/cpython/issues/93442\n\n(23) https://github.com/python/cpython/issues/93466\n\n(24) https://github.com/python/cpython/issues/92898\n\n(25) https://github.com/python/cpython/issues/93103\n\n(26) https://github.com/python/cpython/issues/77782\n\n(27) https://github.com/python/cpython/issues/92913\n\n(28) https://github.com/python/cpython/issues/92781\n\n(29) https://github.com/python/cpython/issues/92651\n\n(30) https://github.com/python/cpython/issues/92536\n\n(31) https://github.com/python/cpython/issues/85858\n\n(32) https://github.com/python/cpython/issues/92193\n\n(33) https://github.com/python/cpython/issues/59121\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=45383\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 11 0 beta 1,  Next: Python 3 11 0 alpha 7,  Prev: Python 3 12 0 alpha 1,  Up: Changelog": {
            "content": "'Release date: 2022-05-06'\n\n* Menu:\n\n* Security: Security<13>.\n* Core and Builtins: Core and Builtins<19>.\n* Library: Library<19>.\n* Documentation: Documentation<19>.\n* Tests: Tests<17>.\n* Build: Build<17>.\n* Windows: Windows<17>.\n* macOS: macOS<13>.\n* Tools/Demos: Tools/Demos<12>.\n* C API: C API<15>.\n\nFile: python3.12.info,  Node: Security<13>,  Next: Core and Builtins<19>,  Up: Python 3 11 0 beta 1\n\n1.22.19.1 Security\n..................\n\n- gh-57684(1): Add the *note -P: 362. command line option and the\n*note PYTHONSAFEPATH: 363. environment variable to not prepend a\npotentially unsafe path to *note sys.path: 32c.  Patch by Victor\nStinner.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/57684\n\nFile: python3.12.info,  Node: Core and Builtins<19>,  Next: Library<19>,  Prev: Security<13>,  Up: Python 3 11 0 beta 1\n\n1.22.19.2 Core and Builtins\n...........................\n\n- gh-89519(1): Chaining classmethod descriptors (introduced in\nbpo-19072(2)) is deprecated.  It can no longer be used to wrap\nother descriptors such as property().  The core design of this\nfeature was flawed, and it caused a number of downstream problems.\n\n- gh-92345(3): 'pymainrunpython()' now imports 'readline' and\n'rlcompleter' before sys.path is extended to include the current\nworking directory of an interactive interpreter.  Non-interactive\ninterpreters are not affected.\n\n- bpo-43857(4): Improve the *note AttributeError: 395. message when\ndeleting a missing attribute.  Patch by Ge'ry Ogam.\n\n- gh-92245(5): Make sure that PEP 523 is respected in all cases.  In\n3.11a7, specialization may have prevented Python-to-Python calls\nrespecting PEP 523.\n\n- gh-92203(6): Add a closure keyword-only parameter to exec().  It\ncan only be specified when exec-ing a code object that uses free\nvariables.  When specified, it must be a tuple, with exactly the\nnumber of cell variables referenced by the code object.  closure\nhas a default value of None, and it must be None if the code object\ndoesn't refer to any free variables.\n\n- gh-91173(7): Disable frozen modules in debug builds.  Patch by\nKumar Aditya.\n\n- gh-92114(8): Improve error message when subscript a type with\n'classgetitem' set to 'None'.\n\n- gh-92112(9): Fix crash triggered by an evil custom 'mro()' on a\nmetaclass.\n\n- gh-92063(10): The 'PRECALLMETHODDESCRIPTORFASTWITHKEYWORDS'\ninstruction now ensures methods are called only on objects of the\ncorrect type.\n\n- gh-92031(11): Deoptimize statically allocated code objects during\n'PyFINALIZE()' so that future 'PyCodeQuicken' calls always start\nwith unquickened code.\n\n- gh-92036(12): Fix a crash in subinterpreters related to the garbage\ncollector.  When a subinterpreter is deleted, untrack all objects\ntracked by its GC. To prevent a crash in deallocator functions\nexpecting objects to be tracked by the GC, leak a strong reference\nto these objects on purpose, so they are never deleted and their\ndeallocator functions are not called.  Patch by Victor Stinner.\n\n- gh-92032(13): The interpreter can now autocomplete soft keywords,\nas of now 'match', 'case', and '' (wildcard pattern) from PEP\n634(14).\n\n- gh-87999(15): The warning emitted by the Python parser for a\nnumeric literal immediately followed by keyword has been changed\nfrom deprecation warning to syntax warning.\n\n- gh-91869(16): Fix an issue where specialized opcodes with extended\narguments could produce incorrect tracing output or lead to\nassertion failures.\n\n- gh-91603(17): Speed up *note types.UnionType: 407. instantiation.\nBased on patch provided by Yurii Karabas.\n\n- gh-89373(18): If Python is built in debug mode, Python now ensures\nthat deallocator functions leave the current exception unchanged.\nPatch by Victor Stinner.\n\n- gh-91632(19): Fix a minor memory leak at exit: release the memory\nof the 'genericaliasiterator' type.  Patch by Donghee Na.\n\n- gh-81548(20): Octal escapes with value larger than '0o377' now\nproduce a *note DeprecationWarning: 179.  In a future Python\nversion they will be a *note SyntaxWarning: 178. and eventually a\n*note SyntaxError: 146.\n\n- bpo-43950(21): Use a single compact table for line starts, ends and\ncolumn offsets.  Reduces memory consumption for location info by\nhalf\n\n- gh-91102(22): Use Argument Clinic for 'EncodingMap'.  Patch by Oleg\nIarygin.\n\n- gh-91636(23): Fixed a crash in a garbage-collection edge-case, in\nwhich a 'PyFunctionType.tpclear' function could leave a python\nfunction object in an inconsistent state.\n\n- gh-91603(24): Speed up *note isinstance(): 14b. and *note\nissubclass(): 5b4. checks for *note types.UnionType: 407.  Patch by\nYurii Karabas.\n\n- gh-91625(25): Fixed a bug in which adaptive opcodes ignored any\npreceding 'EXTENDEDARG's on specialization failure.\n\n- gh-78607(26): The LLTRACE special build now looks for the name\n'lltrace' defined in module globals, rather than the name\n'ltrace', which had been introduced as a typo.\n\n- gh-91576(27): Speed up iteration of ascii strings by 50%.  Patch by\nKumar Aditya.\n\n- gh-89279(28): Improve interpreter performance on Windows by\ninlining a few specific macros.\n\n- gh-91502(29): Add a new 'PyFrameIsEntryFrame()' API function, to\ncheck if a *note PyFrameObject: 575. is an entry frame.  Patch by\nPablo Galindo.\n\n- gh-91266(30): Refactor the 'bytearray' strip methods 'strip',\n'lstrip' and 'rstrip' to use a common implementation.\n\n- gh-91479(31): Replaced the 'note' field of *note BaseException:\n37c. (added in an earlier version of 3.11) with the final design of\nPEP 678(32).  Namely, *note BaseException: 37c. gets an\n'addnote()' method, and its 'notes' field is created when\nnecessary.\n\n- gh-46055(33): Speed up right shift of negative integers, by\nremoving unnecessary creation of temporaries.  Original patch by\nXinhang Xu, reworked by Mark Dickinson.\n\n- gh-91462(34): Make the interpreter's low-level tracing (lltrace)\nfeature output more readable by displaying opcode names (rather\nthan just numbers), and by displaying stack contents before each\nopcode.\n\n- gh-89455(35): Fixed an uninitialized bool value in the traceback\nprinting code path that was introduced by the initial bpo-45292(36)\nexception groups work.\n\n- gh-91421(37): Fix a potential integer overflow in PyDecodeUTF8Ex.\n\n- gh-91428(38): Add 'static const char *const PyOpcodeOpName[256] =\n{...};' to 'opcode.h' for debug builds to assist in debugging the\nPython interpreter.  It is now more convenient to make various\nforms of debugging output more human-readable by including opcode\nnames rather than just the corresponding decimal digits.\n\n- bpo-47120(39): Make *note POPJUMPIFTRUE: 1553, *note\nPOPJUMPIFFALSE: 1554, *note POPJUMPIFNONE: 1555. and *note\nPOPJUMPIFNOTNONE: 1556. virtual, mapping to new relative jump\nopcodes.\n\n- bpo-45317(40): Add internal documentation explaining design of new\n(for 3.11) frame stack.\n\n- bpo-47197(41): ctypes used to mishandle 'void' return types, so\nthat for instance a function declared like 'ctypes.CFUNCTYPE(None,\nctypes.cint)' would be called with signature 'int f(int)' instead\nof 'void f(int)'.  Wasm targets require function pointers to be\ncalled with the correct signatures so this led to crashes.  The\nproblem is now fixed.\n\n- bpo-47120(42): Make opcodes 'JUMPIFTRUEORPOP' and\n'JUMPIFFALSEORPOP' relative rather than absolute.\n\n- bpo-47177(43): Replace the 'flasti' member of the internal\n'PyInterpreterFrame' structure with a 'previnstr' pointer, which\nreduces overhead in the main interpreter loop.  The??'flasti'\nattribute of Python-layer frame objects is preserved for\nbackward-compatibility.\n\n- bpo-46961(44): Integer mod/remainder operations, including the\nthree-argument form of *note pow(): 7f7, now consistently return\nints from the global small integer cache when applicable.\n\n- bpo-46962(45): Classes and functions that unconditionally declared\ntheir docstrings ignoring the '--without-doc-strings' compilation\nflag no longer do so.\n\nThe classes affected are 'ctypes.UnionType', *note\npickle.PickleBuffer: 1557, 'testcapi.RecursingInfinitelyError', and\n*note types.GenericAlias: 5df.\n\nThe functions affected are 24 methods in *note ctypes: 28.\n\nPatch by Oleg Iarygin.\n\n- bpo-46942(46): Use Argument Clinic for the *note types.MethodType:\n1558. constructor.  Patch by Oleg Iarygin.\n\n- bpo-46764(47): Fix wrapping bound methods with @classmethod\n\n- bpo-43464(48): Optimize 'set.intersection()' for non-set arguments.\n\n- bpo-46721(49): Optimize 'set.issuperset()' for non-set argument.\n\n- bpo-46509(50): Add type-specialized versions of the 'PyDECREF()',\nand use them for 'float', 'int', 'str', 'bool', and 'None' to avoid\npointer-chasing at runtime where types are known at C compile time.\n\n- bpo-46045(51): Do not use POSIX semaphores on NetBSD\n\n- bpo-36819(52): Fix crashes in built-in encoders with error handlers\nthat return position less or equal than the starting position of\nnon-encodable characters.\n\n- bpo-34093(53): 'marshal.dumps()' uses 'FLAGREF' for all interned\nstrings.  This makes output more deterministic and helps\nreproducible build.\n\n- bpo-26579(54): Added 'object.getstate' which provides the\ndefault implementation of the 'getstate()' method.\n\nCopying and pickling instances of subclasses of builtin types\nbytearray, set, frozenset, collections.OrderedDict,\ncollections.deque, weakref.WeakSet, and datetime.tzinfo now copies\nand pickles instance attributes implemented as slots.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/89519\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=19072\n\n(3) https://github.com/python/cpython/issues/92345\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=43857\n\n(5) https://github.com/python/cpython/issues/92245\n\n(6) https://github.com/python/cpython/issues/92203\n\n(7) https://github.com/python/cpython/issues/91173\n\n(8) https://github.com/python/cpython/issues/92114\n\n(9) https://github.com/python/cpython/issues/92112\n\n(10) https://github.com/python/cpython/issues/92063\n\n(11) https://github.com/python/cpython/issues/92031\n\n(12) https://github.com/python/cpython/issues/92036\n\n(13) https://github.com/python/cpython/issues/92032\n\n(14) https://peps.python.org/pep-0634/\n\n(15) https://github.com/python/cpython/issues/87999\n\n(16) https://github.com/python/cpython/issues/91869\n\n(17) https://github.com/python/cpython/issues/91603\n\n(18) https://github.com/python/cpython/issues/89373\n\n(19) https://github.com/python/cpython/issues/91632\n\n(20) https://github.com/python/cpython/issues/81548\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=43950\n\n(22) https://github.com/python/cpython/issues/91102\n\n(23) https://github.com/python/cpython/issues/91636\n\n(24) https://github.com/python/cpython/issues/91603\n\n(25) https://github.com/python/cpython/issues/91625\n\n(26) https://github.com/python/cpython/issues/78607\n\n(27) https://github.com/python/cpython/issues/91576\n\n(28) https://github.com/python/cpython/issues/89279\n\n(29) https://github.com/python/cpython/issues/91502\n\n(30) https://github.com/python/cpython/issues/91266\n\n(31) https://github.com/python/cpython/issues/91479\n\n(32) https://peps.python.org/pep-0678/\n\n(33) https://github.com/python/cpython/issues/46055\n\n(34) https://github.com/python/cpython/issues/91462\n\n(35) https://github.com/python/cpython/issues/89455\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=45292\n\n(37) https://github.com/python/cpython/issues/91421\n\n(38) https://github.com/python/cpython/issues/91428\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=47120\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=45317\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=47197\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=47120\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=47177\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=46961\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=46962\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=46942\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=46764\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=43464\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=46721\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=46509\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=46045\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=36819\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=34093\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=26579\n\nFile: python3.12.info,  Node: Library<19>,  Next: Documentation<19>,  Prev: Core and Builtins<19>,  Up: Python 3 11 0 beta 1\n\n1.22.19.3 Library\n.................\n\n- gh-87901(1): Add the 'encoding' parameter to *note os.popen(): 8b5.\n\n- gh-90997(2): Fix an issue where *note dis: 35. utilities may\ninterpret populated inline cache entries as valid instructions.\n\n- gh-92332(3): Deprecate *note typing.Text: 24b. (removal of the\nclass is currently not planned).  Patch by Alex Waygood.\n\n- Deprecate nested classes in enum definitions becoming members - in\n3.13 they will be normal classes; add 'member' and 'nonmember'\nfunctions to allow control over results now.\n\n- gh-92356(4): Fixed a performance regression in ctypes function\ncalls.\n\n- gh-90997(5): Show the actual named values stored in inline caches\nwhen 'showcaches=True' is passed to *note dis: 35. utilities.\n\n- gh-92301(6): Prefer 'closerange()' to iterating over procfs for\nfile descriptor closing in *note subprocess: d0. for better\nperformance.\n\n- gh-67248(7): Sort the miscellaneous topics in Cmd.dohelp()\n\n- gh-92210(8): Port 'socket.init' to Argument Clinic.  Patch by\nCinder.\n\n- gh-80010(9): Add support for generalized ISO 8601 parsing to *note\ndatetime.datetime.fromisoformat(): 3e2, *note\ndatetime.date.fromisoformat(): 3e0. and *note\ndatetime.time.fromisoformat(): 3e1.  Patch by Paul Ganssle.\n\n- gh-92118(10): Fix a 3.11 regression in *note contextmanager():\n1076, which caused it to propagate exceptions with incorrect\ntracebacks.\n\n- gh-90887(11): Adding 'COPYFILESTAT', 'COPYFILEACL' and\n'COPYFILEXATTR' constants for 'os.fcopyfile()' available in macOs.\n\n- gh-91215(12): For @dataclass, add weakrefslot.  Default is False.\nIf True, and if slots=True, add a slot named \"weakref\", which\nwill allow instances to be weakref'd.  Contributed by Eric V. Smith\n\n- gh-85984(13): New function os.logintty() for Unix.\n\n- gh-92128(14): Add *note classgetitem(): 520. to *note\nlogging.LoggerAdapter: 116a. and *note logging.StreamHandler: 106c,\nallowing them to be parameterized at runtime.  Patch by Alex\nWaygood.\n\n- gh-92049(15): Forbid pickling constants 're.constants.SUCCESS'\netc.  Previously, pickling did not fail, but the result could not\nbe unpickled.\n\n- gh-92062(16): *note inspect.Parameter: c73. now raises *note\nValueError: 183. if 'name' is a keyword, in addition to the\nexisting check that it is an identifier.\n\n- gh-87390(17): Add an 'unpacked' attribute to *note\ntypes.GenericAlias: 5df.  Patch by Jelle Zijlstra.\n\n- gh-88089(18): Add support for generic *note typing.NamedTuple: 1f9.\n\n- gh-91996(19): New http.HTTPMethod enum to represent all the\navailable HTTP request methods in a convenient way\n\n- gh-91984(20): Modified test strings in testargparse.py to not\ncontain trailing spaces before end of line.\n\n- gh-91952(21): Add 'encoding=\"locale\"' support to\n'TextIOWrapper.reconfigure()'.\n\n- gh-91954(22): Add 'encoding' and 'errors' arguments to *note\nsubprocess.getoutput(): 155a. and *note\nsubprocess.getstatusoutput(): e32.\n\n- bpo-47029(23): Always close the read end of the pipe used by *note\nmultiprocessing.Queue: 13cf. 'after' the last write of buffered\ndata to the write end of the pipe to avoid *note BrokenPipeError:\ned5. at garbage collection and at *note\nmultiprocessing.Queue.close(): 155b. calls.  Patch by Ge'ry Ogam.\n\n- gh-91928(24): Add 'datetime.UTC' alias for 'datetime.timezone.utc'.\n\nPatch by Kabir Kwatra.\n\n- gh-68966(25): The *note mailcap: 87. module is now deprecated and\nwill be removed in Python 3.13.  See PEP 594(26) for the rationale\nand the *note mimetypes: 8a. module for an alternative.  Patch by\nVictor Stinner.\n\n- gh-91401(27): Provide a way to disable *note subprocess: d0. use of\n'vfork()' just in case it is ever needed and document the existing\nmechanism for 'posixspawn()'.\n\n- gh-64783(28): Fix *note signal.NSIG: 155c. value on FreeBSD to\naccept signal numbers greater than 32, like 'signal.SIGRTMIN' and\n'signal.SIGRTMAX'.  Patch by Victor Stinner.\n\n- gh-91910(29): Add missing f prefix to f-strings in error messages\nfrom the *note multiprocessing: 8f. and *note asyncio: 9. modules.\n\n- gh-91860(30): Add *note typing.dataclasstransform(): 1fa,\nimplementing PEP 681(31).  Patch by Jelle Zijlstra.\n\n- gh-91832(32): Add 'required' attribute to *note argparse.Action:\n155d. repr output.\n\n- gh-91827(33): In the *note tkinter: ea. module add method\n'infopatchlevel()' which returns the exact version of the Tcl\nlibrary as a named tuple similar to *note sys.versioninfo: 46c.\n\n- gh-84461(34): Add *note -enable-wasm-pthreads: 155e. to enable\npthreads support for WASM builds.  'Emscripten/node' no longer has\nthreading enabled by default.  Include additional file systems.\n\n- gh-91821(35): Fix unstable 'testfromtuple' test in\n'testdecimal.py'.\n\n- gh-91217(36): Deprecate the xdrlib module.\n\n- gh-91217(37): Deprecate the uu module.\n\n- gh-91760(38): More strict rules will be applied for numerical group\nreferences and group names in regular expressions.  For now, a\ndeprecation warning is emitted for group references and group names\nwhich will be errors in future Python versions.\n\n- gh-84461(39): Add provisional *note sys.emscripteninfo: 155f.\nnamed tuple with build-time and run-time information about\nEmscripten platform.\n\n- gh-90623(40): *note signal.raisesignal(): 1560. and *note\nos.kill(): 11db. now check immediately for pending signals.  Patch\nby Victor Stinner.\n\n- gh-91734(41): Fix OSS audio support on Solaris.\n\n- gh-90633(42): Include the passed value in the exception thrown by\n*note typing.assertnever(): 474.  Patch by Jelle Zijlstra.\n\n- gh-91700(43): Compilation of regular expression containing a\nconditional expression '(?(group)...)' now raises an appropriate\n*note re.error: cab. if the group number refers to not defined\ngroup.  Previously an internal RuntimeError was raised.\n\n- gh-91231(44): Add an optional keyword 'shutdowntimeout' parameter\nto the 'multiprocessing.BaseManager' constructor.  Kill the process\nif terminate() takes longer than the timeout.  Patch by Victor\nStinner.\n\n- gh-91621(45): Fix *note typing.gettypehints(): 47f. for *note\ncollections.abc.Callable: 5de.  Patch by Shantanu Jain.\n\n- gh-90568(46): Parsing '\\N' escapes of Unicode Named Character\nSequences in a *note regular expression: b4. raises now *note\nre.error: cab. instead of 'TypeError'.\n\n- gh-91670(47): Remove deprecated 'SO' config variable in *note\nsysconfig: d5.\n\n- gh-91217(48): Deprecate the telnetlib module.\n\n- gh-91217(49): Deprecate the sunau module.\n\n- gh-91217(50): Deprecate the spwd module.\n\n- gh-91217(51): Deprecate the sndhdr module, as well as inline needed\nfunctionality for 'email.mime.MIMEAudio'.\n\n- gh-91616(52): *note re: b4. module, fix *note fullmatch(): 1561.\nmismatch when using Atomic Grouping or Possessive Quantifiers.\n\n- gh-91217(53): Deprecate the 'pipes' module.\n\n- gh-91217(54): Deprecate the ossaudiodev module.\n\n- bpo-47256(55): *note re: b4. module, limit the maximum capturing\ngroup to 1,073,741,823 in 64-bit build, this increases the depth of\nbacktracking.\n\n- gh-91217(56): Deprecate the nis module.\n\n- gh-91595(57): Fix the comparison of character and integer inside\n'Tools.gdb.libpython.writerepr()'.  Patch by Yu Liu.\n\n- gh-74166(58): Add option to raise all errors from *note\ncreateconnection(): 43c. in an *note ExceptionGroup: 17b. when it\nfails to create a connection.  The default remains to raise only\nthe last error that had occurred when multiple addresses were\ntried.\n\n- gh-91487(59): Optimize asyncio UDP speed, over 100 times faster\nwhen transferring a large file.\n\n- gh-91575(60): Update case-insensitive matching in the *note re: b4.\nmodule to the latest Unicode version.\n\n- gh-90622(61): In 'concurrent.futures.process.ProcessPoolExecutor'\ndisallow the \"fork\" multiprocessing start method when the new\n'maxtasksperchild' feature is used as the mix of threads+fork\ncan hang the child processes.  Default to using the safe \"spawn\"\nstart method in that circumstance if no 'mpcontext' was supplied.\n\n- gh-89022(62): In *note sqlite3: c9, 'SQLITEMISUSE' result codes\nare now mapped to *note InterfaceError: 449. instead of *note\nProgrammingError: 238.  Also, more accurate exceptions are raised\nwhen binding parameters fail.  Patch by Erlend E. Aasland.\n\n- gh-91526(63): Stop calling 'os.deviceencoding(file.fileno())' in\n'TextIOWrapper'.  It was complex, never documented, and didn't work\nfor most cases.  (Patch by Inada Naoki.)\n\n- gh-88116(64): Change the frame-related functions in the *note\ninspect: 78. module to return a regular object (that is backwards\ncompatible with the old tuple-like interface) that include the\nextended PEP 657(65) position information (end line number, column\nand end column).  The affected functions are: *note\ninspect.getframeinfo(): 418, *note inspect.getouterframes(): 419,\n*note inspect.getinnerframes(): 41a, *note inspect.stack(): 41b.\nand *note inspect.trace(): 41c.  Patch by Pablo Galindo.\n\n- gh-69093(66): Add indexing and slicing support to *note\nsqlite3.Blob: 44e.  Patch by Aviv Palivoda and Erlend E. Aasland.\n\n- gh-69093(67): Add *note context manager: 398. support to *note\nsqlite3.Blob: 44e.  Patch by Aviv Palivoda and Erlend E. Aasland.\n\n- gh-91217(68): Deprecate nntplib.\n\n- gh-91217(69): Deprecate msilib.\n\n- gh-91404(70): Improve the performance of *note re: b4. matching by\nusing computed gotos (or \"threaded code\") on supported platforms\nand removing expensive pointer indirections.\n\n- gh-91217(71): Deprecate the imghdr module.\n\n- gh-91217(72): Deprecate the crypt module.\n\n- gh-91276(73): Make space for longer opcodes in *note dis: 35.\noutput.\n\n- bpo-47000(74): Make 'TextIOWrapper' uses locale encoding when\n'encoding=\"locale\"' is specified even in UTF-8 mode.\n\n- gh-91230(75): *note warnings.catchwarnings(): 2e6. now accepts\narguments for *note warnings.simplefilter(): 491, providing a more\nconcise way to locally ignore warnings or convert them to errors.\n\n- gh-91217(76): Deprecate the chunk module.\n\n- Add the 'TCPCONNECTIONINFO' option (available on macOS) to *note\nsocket: c6.\n\n- bpo-47260(77): Fix 'os.closerange()' potentially being a no-op in a\nLinux seccomp sandbox.\n\n- bpo-47087(78): Implement 'typing.Required' and 'typing.NotRequired'\n( PEP 655(79)).  Patch by David Foster and Jelle Zijlstra.\n\n- bpo-47061(80): Deprecate cgi and cgitb.\n\n- bpo-47061(81): Deprecate audioop.\n\n- bpo-47000(82): Add *note locale.getencoding(): 41f. to get the\ncurrent locale encoding.  It is similar to\n'locale.getpreferredencoding(False)' but ignores the *note Python\nUTF-8 Mode: 420.\n\n- bpo-42012(83): Add *note wsgiref.types: 117, containing\nWSGI-specific types for static type checking.\n\n- bpo-47227(84): Suppress expression chaining for more *note re: b4.\nparsing errors.\n\n- bpo-47211(85): Remove undocumented and never working function\n're.template()' and flag 're.TEMPLATE'.  This was later reverted in\n3.11.0b2 and deprecated instead.\n\n- bpo-47135(86): *note decimal.localcontext(): 1562. now accepts\ncontext attributes via keyword arguments\n\n- bpo-43323(87): Fix errors in the *note email: 37. module if the\ncharset itself contains undecodable/unencodable characters.\n\n- bpo-46841(88): Disassembly of quickened code.\n\n- bpo-46681(89): Forward gzip.compress() compresslevel to zlib.\n\n- bpo-45100(90): Add *note typing.getoverloads(): 47b. and *note\ntyping.clearoverloads(): 47c.  Patch by Jelle Zijlstra.\n\n- bpo-44807(91): *note typing.Protocol: 47e. no longer silently\nreplaces 'init()' methods defined on subclasses.  Patch by\nAdrian Garcia Badaracco.\n\n- bpo-46787(92): Fix *note concurrent.futures.ProcessPoolExecutor:\n707. exception memory leak\n\n- bpo-46720(93): Add support for path-like objects to *note\nmultiprocessing.setexecutable(): 1563. for Windows to be on a par\nwith Unix-like systems.  Patch by Ge'ry Ogam.\n\n- bpo-46696(94): Add 'SOINCOMINGCPU' constant to *note socket: c6.\n\n- bpo-46053(95): Fix OSS audio support on NetBSD.\n\n- bpo-45639(96): 'image/avif' and 'image/webp' were added to *note\nmimetypes: 8a.\n\n- bpo-46285(97): Add command-line option '-p'/'--protocol' to module\n*note http.server: 6d. which specifies the HTTP version to which\nthe server is conformant (HTTP/1.1 conformant servers can now be\nrun from the command-line interface of module *note http.server:\n6d.).  Patch by Ge'ry Ogam.\n\n- bpo-44791(98): Accept ellipsis as the last argument of *note\ntyping.Concatenate: 5b7.\n\n- bpo-46547(99): Remove variables leaking into 'pydoc.Helper' class\nnamespace.\n\n- bpo-46415(100): Fix ipaddress.ip{address,interface,network}\nraising TypeError instead of ValueError if given invalid tuple as\naddress parameter.\n\n- bpo-46075(101): 'CookieJar' with 'DefaultCookiePolicy' now can\nprocess cookies from localhost with domain=localhost explicitly\nspecified in Set-Cookie header.\n\n- bpo-45995(102): Add a \"z\" option to the string formatting\nspecification that coerces negative zero floating-point values to\npositive zero after rounding to the format precision.  Contributed\nby John Belmonte.\n\n- bpo-26175(103): Fully implement the *note io.BufferedIOBase: 460.\nor *note io.TextIOBase: 461. interface for *note\ntempfile.SpooledTemporaryFile: 45f. objects.  This lets them work\ncorrectly with higher-level layers (like compression modules).\nPatch by Carey Metcalfe.\n\n- bpo-45138(104): Fix a regression in the *note sqlite3: c9. trace\ncallback where bound parameters were not expanded in the passed\nstatement string.  The regression was introduced in Python 3.10 by\nbpo-40318(105).  Patch by Erlend E. Aasland.\n\n- bpo-44863(106): Allow *note TypedDict: 153. subclasses to also\ninclude *note Generic: 1453. as a base class in class based syntax.\nThereby allowing the user to define a generic 'TypedDict', just\nlike a user-defined generic but with 'TypedDict' semantics.\n\n- bpo-44587(107): Fix BooleanOptionalAction to not automatically add\na default string.  If a default string is desired, use a formatter\nto add it.\n\n- bpo-43827(108): All positional-or-keyword parameters to\n'ABCMeta.new' are now positional-only to avoid conflicts with\nkeyword arguments to be passed to 'initsubclass()'.\n\n- bpo-43218(109): Prevent creation of a venv whose path contains the\nPATH separator.  This could affect the usage of the activate\nscript.  Patch by Dustin Rodrigues.\n\n- bpo-38435(110): Add a 'processgroup' parameter to *note\nsubprocess.Popen: 8c3. to help move more things off of the unsafe\n'preexecfn' parameter.\n\n- bpo-42066(111): Fix cookies getting sorted in\n'CookieJar.iter()' which is an extra behavior and not mentioned\nin RFC 2965 or Netscape cookie protocol.  Now the cookies in\n'CookieJar' follows the order of the 'Set-Cookie' header.  Patch by\nIman Kermani.\n\n- bpo-40617(112): Add *note createwindowfunction(): 44c. to *note\nsqlite3.Connection: 1d9. for creating aggregate window functions.\nPatch by Erlend E. Aasland.\n\n- bpo-40676(113): Convert *note csv: 27. to use Argument Clinic for\n*note csv.fieldsizelimit(): 1564, *note csv.getdialect(): 1565,\n*note csv.unregisterdialect(): 1566. and *note\ncsv.listdialects(): 1567.\n\n- bpo-39716(114): Raise an 'ArgumentError' when the same subparser\nname is added twice to an 'argparse.ArgumentParser'.  This is\nconsistent with the (default) behavior when the same option string\nis added twice to an 'ArgumentParser'.\n\n- bpo-36073(115): Raise *note ProgrammingError: 238. instead of\nsegfaulting on recursive usage of cursors in *note sqlite3: c9.\nconverters.  Patch by Sergey Fedoseev.\n\n- bpo-34975(116): Adds a 'starttls()' method to 'StreamWriter',\nwhich upgrades the connection with TLS using the given *note\nSSLContext: 278.\n\n- bpo-22276(117): *note Path: 149. methods *note glob(): 1cc. and\n*note rglob(): 1cd. return only directories if 'pattern' ends with\na pathname components separator ('/' or *note sep: 434.).  Patch by\nEisuke Kawashima.\n\n- bpo-24905(118): Add *note blobopen(): 44d. to *note\nsqlite3.Connection: 1d9.  *note sqlite3.Blob: 44e. allows\nincremental I/O operations on blobs.  Patch by Aviv Palivoda and\nErlend E. Aasland.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/87901\n\n(2) https://github.com/python/cpython/issues/90997\n\n(3) https://github.com/python/cpython/issues/92332\n\n(4) https://github.com/python/cpython/issues/92356\n\n(5) https://github.com/python/cpython/issues/90997\n\n(6) https://github.com/python/cpython/issues/92301\n\n(7) https://github.com/python/cpython/issues/67248\n\n(8) https://github.com/python/cpython/issues/92210\n\n(9) https://github.com/python/cpython/issues/80010\n\n(10) https://github.com/python/cpython/issues/92118\n\n(11) https://github.com/python/cpython/issues/90887\n\n(12) https://github.com/python/cpython/issues/91215\n\n(13) https://github.com/python/cpython/issues/85984\n\n(14) https://github.com/python/cpython/issues/92128\n\n(15) https://github.com/python/cpython/issues/92049\n\n(16) https://github.com/python/cpython/issues/92062\n\n(17) https://github.com/python/cpython/issues/87390\n\n(18) https://github.com/python/cpython/issues/88089\n\n(19) https://github.com/python/cpython/issues/91996\n\n(20) https://github.com/python/cpython/issues/91984\n\n(21) https://github.com/python/cpython/issues/91952\n\n(22) https://github.com/python/cpython/issues/91954\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=47029\n\n(24) https://github.com/python/cpython/issues/91928\n\n(25) https://github.com/python/cpython/issues/68966\n\n(26) https://peps.python.org/pep-0594/\n\n(27) https://github.com/python/cpython/issues/91401\n\n(28) https://github.com/python/cpython/issues/64783\n\n(29) https://github.com/python/cpython/issues/91910\n\n(30) https://github.com/python/cpython/issues/91860\n\n(31) https://peps.python.org/pep-0681/\n\n(32) https://github.com/python/cpython/issues/91832\n\n(33) https://github.com/python/cpython/issues/91827\n\n(34) https://github.com/python/cpython/issues/84461\n\n(35) https://github.com/python/cpython/issues/91821\n\n(36) https://github.com/python/cpython/issues/91217\n\n(37) https://github.com/python/cpython/issues/91217\n\n(38) https://github.com/python/cpython/issues/91760\n\n(39) https://github.com/python/cpython/issues/84461\n\n(40) https://github.com/python/cpython/issues/90623\n\n(41) https://github.com/python/cpython/issues/91734\n\n(42) https://github.com/python/cpython/issues/90633\n\n(43) https://github.com/python/cpython/issues/91700\n\n(44) https://github.com/python/cpython/issues/91231\n\n(45) https://github.com/python/cpython/issues/91621\n\n(46) https://github.com/python/cpython/issues/90568\n\n(47) https://github.com/python/cpython/issues/91670\n\n(48) https://github.com/python/cpython/issues/91217\n\n(49) https://github.com/python/cpython/issues/91217\n\n(50) https://github.com/python/cpython/issues/91217\n\n(51) https://github.com/python/cpython/issues/91217\n\n(52) https://github.com/python/cpython/issues/91616\n\n(53) https://github.com/python/cpython/issues/91217\n\n(54) https://github.com/python/cpython/issues/91217\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=47256\n\n(56) https://github.com/python/cpython/issues/91217\n\n(57) https://github.com/python/cpython/issues/91595\n\n(58) https://github.com/python/cpython/issues/74166\n\n(59) https://github.com/python/cpython/issues/91487\n\n(60) https://github.com/python/cpython/issues/91575\n\n(61) https://github.com/python/cpython/issues/90622\n\n(62) https://github.com/python/cpython/issues/89022\n\n(63) https://github.com/python/cpython/issues/91526\n\n(64) https://github.com/python/cpython/issues/88116\n\n(65) https://peps.python.org/pep-0657/\n\n(66) https://github.com/python/cpython/issues/69093\n\n(67) https://github.com/python/cpython/issues/69093\n\n(68) https://github.com/python/cpython/issues/91217\n\n(69) https://github.com/python/cpython/issues/91217\n\n(70) https://github.com/python/cpython/issues/91404\n\n(71) https://github.com/python/cpython/issues/91217\n\n(72) https://github.com/python/cpython/issues/91217\n\n(73) https://github.com/python/cpython/issues/91276\n\n(74) https://bugs.python.org/issue?@action=redirect&bpo=47000\n\n(75) https://github.com/python/cpython/issues/91230\n\n(76) https://github.com/python/cpython/issues/91217\n\n(77) https://bugs.python.org/issue?@action=redirect&bpo=47260\n\n(78) https://bugs.python.org/issue?@action=redirect&bpo=47087\n\n(79) https://peps.python.org/pep-0655/\n\n(80) https://bugs.python.org/issue?@action=redirect&bpo=47061\n\n(81) https://bugs.python.org/issue?@action=redirect&bpo=47061\n\n(82) https://bugs.python.org/issue?@action=redirect&bpo=47000\n\n(83) https://bugs.python.org/issue?@action=redirect&bpo=42012\n\n(84) https://bugs.python.org/issue?@action=redirect&bpo=47227\n\n(85) https://bugs.python.org/issue?@action=redirect&bpo=47211\n\n(86) https://bugs.python.org/issue?@action=redirect&bpo=47135\n\n(87) https://bugs.python.org/issue?@action=redirect&bpo=43323\n\n(88) https://bugs.python.org/issue?@action=redirect&bpo=46841\n\n(89) https://bugs.python.org/issue?@action=redirect&bpo=46681\n\n(90) https://bugs.python.org/issue?@action=redirect&bpo=45100\n\n(91) https://bugs.python.org/issue?@action=redirect&bpo=44807\n\n(92) https://bugs.python.org/issue?@action=redirect&bpo=46787\n\n(93) https://bugs.python.org/issue?@action=redirect&bpo=46720\n\n(94) https://bugs.python.org/issue?@action=redirect&bpo=46696\n\n(95) https://bugs.python.org/issue?@action=redirect&bpo=46053\n\n(96) https://bugs.python.org/issue?@action=redirect&bpo=45639\n\n(97) https://bugs.python.org/issue?@action=redirect&bpo=46285\n\n(98) https://bugs.python.org/issue?@action=redirect&bpo=44791\n\n(99) https://bugs.python.org/issue?@action=redirect&bpo=46547\n\n(100) https://bugs.python.org/issue?@action=redirect&bpo=46415\n\n(101) https://bugs.python.org/issue?@action=redirect&bpo=46075\n\n(102) https://bugs.python.org/issue?@action=redirect&bpo=45995\n\n(103) https://bugs.python.org/issue?@action=redirect&bpo=26175\n\n(104) https://bugs.python.org/issue?@action=redirect&bpo=45138\n\n(105) https://bugs.python.org/issue?@action=redirect&bpo=40318\n\n(106) https://bugs.python.org/issue?@action=redirect&bpo=44863\n\n(107) https://bugs.python.org/issue?@action=redirect&bpo=44587\n\n(108) https://bugs.python.org/issue?@action=redirect&bpo=43827\n\n(109) https://bugs.python.org/issue?@action=redirect&bpo=43218\n\n(110) https://bugs.python.org/issue?@action=redirect&bpo=38435\n\n(111) https://bugs.python.org/issue?@action=redirect&bpo=42066\n\n(112) https://bugs.python.org/issue?@action=redirect&bpo=40617\n\n(113) https://bugs.python.org/issue?@action=redirect&bpo=40676\n\n(114) https://bugs.python.org/issue?@action=redirect&bpo=39716\n\n(115) https://bugs.python.org/issue?@action=redirect&bpo=36073\n\n(116) https://bugs.python.org/issue?@action=redirect&bpo=34975\n\n(117) https://bugs.python.org/issue?@action=redirect&bpo=22276\n\n(118) https://bugs.python.org/issue?@action=redirect&bpo=24905\n\nFile: python3.12.info,  Node: Documentation<19>,  Next: Tests<17>,  Prev: Library<19>,  Up: Python 3 11 0 beta 1\n\n1.22.19.4 Documentation\n.......................\n\n- gh-91888(1): Add a new 'gh' role to the documentation to link to\nGitHub issues.\n\n- gh-91783(2): Document security issues concerning the use of the\nfunction *note shutil.unpackarchive(): 184.\n\n- gh-91547(3): Remove \"Undocumented modules\" page.\n\n- gh-91298(4): In 'importlib.resources.abc', refined the\ndocumentation of the Traversable Protocol, applying changes from\nimportlibresources 5.7.1.\n\n- bpo-44347(5): Clarify the meaning of 'dirsexistok', a kwarg of\n*note shutil.copytree(): 854.\n\n- bpo-36329(6): Remove 'make -C Doc serve' in favour of 'make -C Doc\nhtmlview'\n\n- bpo-47189(7): Add a What's New in Python 3.11 entry for the Faster\nCPython project.  Documentation by Ken Jin and Kumar Aditya.\n\n- bpo-38668(8): Update the introduction to documentation for *note\nos.path: 9d. to remove warnings that became irrelevant after the\nimplementations of PEP 383(9) and PEP 529(10).\n\n- bpo-47115(11): The documentation now lists which members of C\nstructs are part of the *note Limited API/Stable ABI: 2ac.\n\n- bpo-46962(12): All docstrings in code snippets are now wrapped into\n*note PyDocSTR: 1569. to follow the guideline of PEP 7's\nDocumentation Strings paragraph(13).  Patch by Oleg Iarygin.\n\n- bpo-26792(14): Improve the docstrings of *note runpy.runmodule():\n156a. and *note runpy.runpath(): 1193.  Original patch by Andrew\nBrezovsky.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/91888\n\n(2) https://github.com/python/cpython/issues/91783\n\n(3) https://github.com/python/cpython/issues/91547\n\n(4) https://github.com/python/cpython/issues/91298\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=44347\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=36329\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=47189\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=38668\n\n(9) https://peps.python.org/pep-0383/\n\n(10) https://peps.python.org/pep-0529/\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=47115\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=46962\n\n(13) https://www.python.org/dev/peps/pep-0007/#documentation-strings\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=26792\n\nFile: python3.12.info,  Node: Tests<17>,  Next: Build<17>,  Prev: Documentation<19>,  Up: Python 3 11 0 beta 1\n\n1.22.19.5 Tests\n...............\n\n- gh-92169(1): Use 'warningshelper.importdeprecated()' to import\ndeprecated modules uniformly in tests.  Patch by Hugo van Kemenade.\n\n- gh-84461(2): When multiprocessing is enabled, libregrtest can now\nuse a Python executable other than 'sys.executable' via the\n'--python' flag.\n\n- gh-91904(3): Fix initialization of 'PYTHONREGRTESTUNICODEGUARD'\nwhich prevented running regression tests on non-UTF-8 locale.\n\n- gh-91752(4): Added @requireszlib to\ntest.testtools.testfreeze.TestFreeze.\n\n- gh-91607(5): Fix 'testconcurrentfutures' to test the correct\nmultiprocessing start method context in several cases where the\ntest logic mixed this up.\n\n- bpo-40280(6): Threading tests are now skipped on WASM targets\nwithout pthread support.\n\n- bpo-47109(7): Test for 'ctypes.macholib.dyld',\n'ctypes.macholib.dylib', and 'ctypes.macholib.framework' are\nbrought from manual pre-*note unittest: 101. times to 'ctypes.test'\nlocation and structure.  Patch by Oleg Iarygin.\n\n- bpo-29890(8): Add tests for *note ipaddress.IPv4Interface: 156c.\nand *note ipaddress.IPv6Interface: 156d. construction with tuple\narguments.  Original patch and tests by louisom.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/92169\n\n(2) https://github.com/python/cpython/issues/84461\n\n(3) https://github.com/python/cpython/issues/91904\n\n(4) https://github.com/python/cpython/issues/91752\n\n(5) https://github.com/python/cpython/issues/91607\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=40280\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=47109\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=29890\n\nFile: python3.12.info,  Node: Build<17>,  Next: Windows<17>,  Prev: Tests<17>,  Up: Python 3 11 0 beta 1\n\n1.22.19.6 Build\n...............\n\n- gh-89452(1): gdbm-compat is now preferred over ndbm if both are\navailable on the system.  This allows avoiding the problematic\nndbm.h on macOS.\n\n- gh-91731(2): Python is now built with '-std=c11' compiler option,\nrather than '-std=c99'.  Patch by Victor Stinner.\n\n- bpo-47152(3): Add script and make target for generating\n'sreconstants.h'.\n\n- bpo-47103(4): Windows 'PGInstrument' builds now copy a required DLL\ninto the output directory, making it easier to run the profile\nstage of a PGO build.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/89452\n\n(2) https://github.com/python/cpython/issues/91731\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=47152\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=47103\n\nFile: python3.12.info,  Node: Windows<17>,  Next: macOS<13>,  Prev: Build<17>,  Up: Python 3 11 0 beta 1\n\n1.22.19.7 Windows\n.................\n\n- bpo-46907(1): Update Windows installer to use SQLite 3.38.3.\n\n- bpo-47239(2): Fixed -list and -list-paths output for *note Python\nLauncher for Windows: 37f. when used in an active virtual\nenvironment.\n\n- bpo-46907(3): Update Windows installer to use SQLite 3.38.2.\n\n- bpo-46785(4): Fix race condition between *note os.stat(): 1bf. and\nunlinking a file on Windows, by using errors codes returned by\n'FindFirstFileW()' when appropriate in 'win32xstatimpl'.\n\n- bpo-40859(5): Update Windows build to use xz-5.2.5\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=46907\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=47239\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=46907\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=46785\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=40859\n\nFile: python3.12.info,  Node: macOS<13>,  Next: Tools/Demos<12>,  Prev: Windows<17>,  Up: Python 3 11 0 beta 1\n\n1.22.19.8 macOS\n...............\n\n- bpo-46907(1): Update macOS installer to SQLite 3.38.4.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=46907\n\nFile: python3.12.info,  Node: Tools/Demos<12>,  Next: C API<15>,  Prev: macOS<13>,  Up: Python 3 11 0 beta 1\n\n1.22.19.9 Tools/Demos\n.....................\n\n- gh-91583(1): Fix regression in the code generated by Argument\nClinic for functions with the 'definingclass' parameter.\n\n- gh-91575(2): Add script 'Tools/scripts/generaterecasefix.py' and\nthe make target 'regen-re' for generating additional data for\ncase-insensitive matching according to the current Unicode version.\n\n- gh-91551(3): Remove the ancient Pynche color editor.  It has moved\nto 'https://gitlab.com/warsaw/pynche'\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/91583\n\n(2) https://github.com/python/cpython/issues/91575\n\n(3) https://github.com/python/cpython/issues/91551\n\nFile: python3.12.info,  Node: C API<15>,  Prev: Tools/Demos<12>,  Up: Python 3 11 0 beta 1\n\n1.22.19.10 C API\n................\n\n- gh-88279(1): Deprecate the C functions: *note PySysSetArgv():\n11cc, *note PySysSetArgvEx(): 11cb, *note PySysSetPath(): 1573.\nPatch by Victor Stinner.\n\n- gh-92154(2): Added the *note PyCodeGetCode(): 563. function.  This\nfunction does the equivalent of the Python code\n'getattr(codeobject, 'cocode')'.\n\n- gh-92173(3): Fix the 'closure' argument to *note\nPyEvalEvalCodeEx(): 14b8.\n\n- gh-91320(4): Fix C++ compiler warnings about \"old-style cast\" ('g++\n-Wold-style-cast') in the Python C API. Use C++\n'reinterpretcast<>' and 'staticcast<>' casts when the Python C\nAPI is used in C++.  Patch by Victor Stinner.\n\n- gh-80527(5): Mark functions as deprecated by PEP 623(6):\n'PyUnicodeASDATA()', 'PyUnicodeASUNICODE()',\n'PyUnicodeGETDATASIZE()', 'PyUnicodeGETSIZE()'.  Patch by\nVictor Stinner.\n\n- gh-91768(7): *note PyREFCNT(): 6bd, *note PyTYPE(): 56b, *note\nPySIZE(): 56d. and *note PyISTYPE(): 1574. functions argument\ntype is now 'PyObject*', rather than 'const PyObject*'.  Patch by\nVictor Stinner.\n\n- gh-91020(8): Add 'PyBytesType.tpalloc' to initialize\n'PyBytesObject.obshash' for bytes subclasses.\n\n- bpo-40421(9): Add 'PyFrameGetLasti' C-API function to access frame\nobject's 'flasti' attribute safely from C code.\n\n- bpo-35134(10): Remove the 'Include/code.h' header file.  C\nextensions should only include the main '<Python.h>' header file.\nPatch by Victor Stinner.\n\n- bpo-47169(11): *note PyOSCheckStack(): 1575. is now exported in\nthe Stable ABI on Windows.\n\n- bpo-47169(12): 'PyThreadgetthreadnativeid()' is excluded from\nthe stable ABI on platforms where it doesn't exist (like Solaris).\n\n- bpo-46343(13): Added *note PyErrGetHandledException(): 55a. and\n*note PyErrSetHandledException(): 55b. as simpler alternatives to\n*note PyErrGetExcInfo(): 55d. and *note PyErrSetExcInfo(): 55c.\n\nThey are included in the stable ABI.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/88279\n\n(2) https://github.com/python/cpython/issues/92154\n\n(3) https://github.com/python/cpython/issues/92173\n\n(4) https://github.com/python/cpython/issues/91320\n\n(5) https://github.com/python/cpython/issues/80527\n\n(6) https://peps.python.org/pep-0623/\n\n(7) https://github.com/python/cpython/issues/91768\n\n(8) https://github.com/python/cpython/issues/91020\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=40421\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=35134\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=47169\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=47169\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=46343\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 11 0 alpha 7,  Next: Python 3 11 0 alpha 6,  Prev: Python 3 11 0 beta 1,  Up: Changelog": {
            "content": "'Release date: 2022-04-05'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<20>.\n* Library: Library<20>.\n* Documentation: Documentation<20>.\n* Tests: Tests<18>.\n* Build: Build<18>.\n* Windows: Windows<18>.\n* macOS: macOS<14>.\n* Tools/Demos: Tools/Demos<13>.\n* C API: C API<16>.\n\nFile: python3.12.info,  Node: Core and Builtins<20>,  Next: Library<20>,  Up: Python 3 11 0 alpha 7\n\n1.22.20.1 Core and Builtins\n...........................\n\n- bpo-47212(1): Raise *note IndentationError: 59a. instead of *note\nSyntaxError: 146. for a bare 'except' with no following indent.\nImprove *note SyntaxError: 146. locations for an un-parenthesized\ngenerator used as arguments.  Patch by Matthieu Dartiailh.\n\n- bpo-47186(2): Replace 'JUMPIFNOTEGMATCH' by *note\nCHECKEGMATCH: 4d5. + jump.\n\n- bpo-47176(3): Emscripten builds cannot handle signals in the usual\nway due to platform limitations.  Python can now handle signals.\nTo use, set Module.PyEmscriptenSignalBuffer to be a single byte\nSharedArrayBuffer and set PyEMSCRIPTENSIGNALHANDLING to 1.\nWriting a number into the SharedArrayBuffer will cause the\ncorresponding signal to be raised into the Python thread.\n\n- bpo-47186(4): Replace 'JUMPIFNOTEXCMATCH' by *note\nCHECKEXCMATCH: 4df. + jump.\n\n- bpo-47120(5): Replace the absolute jump opcode *note\nJUMPNOINTERRUPT: 1578. by the relative *note\nJUMPBACKWARDNOINTERRUPT: 4d2.\n\n- bpo-46841(6): Avoid unnecessary allocations when comparing code\nobjects.\n\n- bpo-47182(7): Fix a crash when using a named unicode character like\n'\"\\N{digit nine}\"' after the main interpreter has been initialized\na second time.\n\n- bpo-47162(8): WebAssembly cannot deal with bad function pointer\ncasts (different count or types of arguments).  Python can now use\ncall trampolines to mitigate the problem.  Define\n'PYCALLTRAMPOLINE' to enable call trampolines.\n\n- bpo-46775(9): Some Windows system error codes(>= 10000) are now\nmapped into the correct errno and may now raise a subclass of *note\nOSError: 613.  Patch by Donghee Na.\n\n- bpo-47129(10): Improve error messages in f-string syntax errors\nconcerning empty expressions.\n\n- bpo-47117(11): Fix a crash if we fail to decode characters in\ninteractive mode if the tokenizer buffers are uninitialized.  Patch\nby Pablo Galindo.\n\n- bpo-47127(12): Speed up calls to c functions with keyword arguments\nby 25% with specialization.  Patch by Kumar Aditya.\n\n- bpo-47120(13): Replaced 'JUMPABSOLUTE' by the relative jump *note\nJUMPBACKWARD: 4e0.\n\n- bpo-42197(14): 'PyFrameFastToLocalsWithError()' and\n'PyFrameLocalsToFast()' are no longer called during profiling nor\ntracing.  C code can access the 'flocals' attribute of *note\nPyFrameObject: 575. by calling *note PyFrameGetLocals(): 572.\n\n- bpo-47070(15): Improve performance of 'arrayinplacerepeat' by\nreducing the number of invocations of 'memcpy'.  Refactor the\n'repeat' and inplace 'repeat' methods of 'array', 'bytes',\n'bytearray' and 'unicodeobject' to use the common\n'PyBytesRepeat'.\n\n- bpo-47053(16): Reduce de-optimization in the specialized\n'BINARYOPINPLACEADDUNICODE' opcode.\n\n- bpo-47045(17): Remove the 'fstate' field from the\nPyInterpreterFrame struct.  Add the 'owner' field to the\nPyInterpreterFrame struct to make ownership explicit to simplify\nclearing and deallocing frames and generators.\n\n- bpo-46968(18): Check for the existence of the \"sys/auxv.h\" header\nin *note faulthandler: 53. to avoid compilation problems in systems\nwhere this header doesn't exist.  Patch by Pablo Galindo\n\n- bpo-46329(19): Use low bit of 'LOADGLOBAL' to indicate whether to\npush a 'NULL' before the global.  Helps streamline the call\nsequence a bit.\n\n- bpo-46841(20): Quicken bytecode in-place by storing it as part of\nthe corresponding 'PyCodeObject'.\n\n- bpo-47012(21): Speed up iteration of *note bytes: 295. and *note\nbytearray: 294. by 30%.  Patch by Kumar Aditya.\n\n- bpo-47009(22): Improved the performance of 'list.append()' and list\ncomprehensions by optimizing for the common case, where no resize\nis needed.  Patch by Dennis Sweeney.\n\n- bpo-47005(23): Improve performance of 'bytearrayrepeat' and\n'bytearrayirepeat' by reducing the number of invocations of\n'memcpy'.\n\n- bpo-46829(24): Deprecate passing a message into *note\nasyncio.Future.cancel(): 1579. and *note asyncio.Task.cancel():\n157a.\n\n- bpo-46993(25): Speed up *note bytearray: 294. creation from *note\nlist: 3dc. and *note tuple: 4b8. by 40%.  Patch by Kumar Aditya.\n\n- bpo-39829(26): Removed the 'len()' call when initializing a\nlist and moved initializing to 'listextend'.  Patch by Jeremiah\nPascual.\n\n- bpo-46944(27): Speed up throwing exception in generator with *note\nMETHFASTCALL: 157b. calling convention.  Patch by Kumar Aditya.\n\n- bpo-46841(28): Modify *note STORESUBSCR: 157c. to use an inline\ncache entry (rather than its oparg) as an adaptive counter.\n\n- bpo-46841(29): Use inline caching for 'PRECALL' and *note CALL:\n4db, and remove the internal machinery for managing the (now\nunused) non-inline caches.\n\n- bpo-46881(30): Statically allocate and initialize the latin1\ncharacters.\n\n- bpo-46838(31): Improve syntax errors for incorrect function\ndefinitions.  Patch by Pablo Galindo\n\n- bpo-43721(32): Fix docstrings of *note getter: 13b5, *note setter:\n13b6, and *note deleter: 13b7. to clarify that they create a new\ncopy of the property.\n\n- bpo-43224(33): Make grammar changes required for PEP 646.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=47212\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=47186\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=47176\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=47186\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=47120\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=46841\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=47182\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=47162\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=46775\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=47129\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=47117\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=47127\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=47120\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=42197\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=47070\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=47053\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=47045\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=46968\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=46329\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=46841\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=47012\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=47009\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=47005\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=46829\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=46993\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=39829\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=46944\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=46841\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=46841\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=46881\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=46838\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=43721\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=43224\n\nFile: python3.12.info,  Node: Library<20>,  Next: Documentation<20>,  Prev: Core and Builtins<20>,  Up: Python 3 11 0 alpha 7\n\n1.22.20.2 Library\n.................\n\n- bpo-47208(1): Allow vendors to override 'CTYPESMAXARGCOUNT'.\n\n- bpo-23689(2): *note re: b4. module: fix memory leak when a match is\nterminated by a signal or memory allocation failure.  Patch by Ma\nLin.\n\n- bpo-47167(3): Allow overriding a future compliance check in *note\nasyncio.Task: 201.\n\n- bpo-47151(4): When subprocess tries to use vfork, it now falls back\nto fork if vfork returns an error.  This allows use in situations\nwhere vfork isn't allowed by the OS kernel.\n\n- bpo-47152(5): Convert the *note re: b4. module into a package.\nDeprecate modules 'srecompile', 'sreconstants' and 'sreparse'.\n\n- bpo-4833(6): Add 'ZipFile.mkdir()'\n\n- bpo-27929(7): Fix *note asyncio.loop.sockconnect(): c26. to only\nresolve names for *note socket.AFINET: 157e. or *note\nsocket.AFINET6: 157f. families.  Resolution may not make sense for\nother families, like 'socket.AFBLUETOOTH' and *note\nsocket.AFUNIX: 1580.\n\n- bpo-14265(8): Adds the fully qualified test name to unittest output\n\n- bpo-47061(9): Deprecate the aifc module.\n\n- bpo-39622(10): Handle Ctrl+C in asyncio programs to interrupt the\nmain task.\n\n- bpo-47101(11): *note hashlib.algorithmsavailable: 11e8. now lists\nonly algorithms that are provided by activated crypto providers on\nOpenSSL 3.0.  Legacy algorithms are not listed unless the legacy\nprovider has been loaded into the default OSSL context.\n\n- bpo-47099(12): All 'URLError' exception messages raised in *note\nurllib.request.URLopener: 1581. now contain a colon between 'ftp\nerror' and the rest of the message.  Previously, 'openftp()'\nmissed the colon.  Patch by Oleg Iarygin.\n\n- bpo-47099(13): Exception chaining is changed from\n'Exception.withtraceback()'/*note sys.excinfo(): 456. to PEP\n3134(14).  Patch by Oleg Iarygin.\n\n- bpo-47095(15): *note hashlib: 63.'s internal 'blake2' module now\nprefers 'libb2' from 'https://www.blake2.net/' over Python's\nvendored copy of blake2.\n\n- bpo-47098(16): The Keccak Code Package for *note hashlib: 63.'s\ninternal 'sha3' module has been replaced with tinysha3.  The\nmodule is used as fallback when Python is built without OpenSSL.\n\n- bpo-47088(17): Implement *note typing.LiteralString: 38b, part of\nPEP 675(18).  Patch by Jelle Zijlstra.\n\n- bpo-42885(19): Optimize *note re.search(): 10a2, *note re.split():\n9ae, *note re.findall(): ea1, *note re.finditer(): 1354. and *note\nre.sub(): 1ff. for regular expressions starting with '\\A' or '^'.\n\n- bpo-23691(20): Protect the *note re.finditer(): 1354. iterator from\nre-entering.\n\n- bpo-47067(21): Optimize calling 'GenericAlias' objects by using PEP\n590(22) 'vectorcall' and by replacing 'PyObjectSetAttrString' with\n'PyObjectSetAttr'.\n\n- bpo-28080(23): Add the 'metadataencoding' parameter in the *note\nzipfile.ZipFile: 494. constructor and the '--metadata-encoding'\noption in the *note zipfile: 12b. CLI to allow reading zipfiles\nusing non-standard codecs to encode the filenames within the\narchive.\n\n- bpo-47000(24): Make *note io.textencoding(): 13ea. returns \"utf-8\"\nwhen UTF-8 mode is enabled.\n\n- bpo-42369(25): Fix thread safety of 'zipfile.SharedFile.tell()' to\navoid a \"zipfile.BadZipFile: Bad CRC-32 for file\" exception when\nreading a 'ZipFile' from multiple threads.\n\n- bpo-38256(26): Fix *note binascii.crc32(): 13e2. when it is\ncompiled to use zlib'c crc32 to work properly on inputs 4+GiB in\nlength instead of returning the wrong result.  The workaround prior\nto this was to always feed the function data in increments smaller\nthan 4GiB or to just call the zlib module function.\n\nWe also have *note binascii.crc32(): 13e2. release the GIL when\ncomputing on larger inputs as *note zlib.crc32(): 13e1. and *note\nhashlib: 63. do.\n\nThis also boosts performance on Windows as it now uses the zlib\ncrc32 implementation for *note binascii.crc32(): 13e2. for a 2-3x\nspeedup.\n\nThat the stdlib has a crc32 API in two modules is a known\nhistorical oddity.  This moves us closer to a single implementation\nbehind them.\n\n- bpo-47066(27): Global inline flags (e.g.  '(?i)') can now only be\nused at the start of the regular expressions.  Using them not at\nthe start of expression was deprecated since Python 3.6.\n\n- bpo-39394(28): A warning about inline flags not at the start of the\nregular expression now contains the position of the flag.\n\n- bpo-433030(29): Add support of atomic grouping ('(?>...)') and\npossessive quantifiers ('*+', '++', '?+', '{m,n}+') in *note\nregular expressions: b4.\n\n- bpo-47062(30): Implement *note asyncio.Runner: 3c9. context\nmanager.\n\n- bpo-46382(31): *note dataclass(): 38d. 'slots=True' now correctly\nomits slots already defined in base classes.  Patch by Arie\nBovenberg.\n\n- bpo-47057(32): Use FASTCALL convention for 'FutureIter.throw()'\n\n- bpo-47061(33): Deprecate the various modules listed by PEP 594(34):\n\naifc, asynchat, asyncore, audioop, cgi, cgitb, chunk, crypt,\nimghdr, msilib, nntplib, nis, ossaudiodev, pipes, smtpd, sndhdr,\nspwd, sunau, telnetlib, uu, xdrlib\n\n- bpo-34790(35): Remove passing coroutine objects to *note\nasyncio.wait(): 19a.\n\n- bpo-47039(36): Normalize 'repr()' of asyncio future and task\nobjects.\n\n- bpo-2604(37): Fix bug where doctests using globals would fail when\nrun multiple times.\n\n- bpo-45150(38): Add *note hashlib.filedigest(): 40d. helper for\nefficient hashing of file object.\n\n- bpo-34861(39): Made cumtime the default sorting key for cProfile\n\n- bpo-45997(40): Fix *note asyncio.Semaphore: 8a2. re-aquiring FIFO\norder.\n\n- bpo-47022(41): The 'asynchat', 'asyncore' and 'smtpd' modules have\nbeen deprecated since at least Python 3.6.  Their documentation and\ndeprecation warnings and have now been updated to note they will\nremoved in Python 3.12 ( PEP 594(42)).\n\n- bpo-43253(43): Fix a crash when closing transports where the\nunderlying socket handle is already invalid on the Proactor event\nloop.\n\n- bpo-40280(44): *note select.select(): bfc. now passes 'NULL' to\n'select' for each empty fdset.\n\n- bpo-47004(45): Apply bugfixes from importlibmetadata 4.11.3,\nincluding bugfix for EntryPoint.extras, which was returning match\nobjects and not the extras strings.\n\n- bpo-46998(46): Allow subclassing of *note typing.Any: 479.  Patch\nby Shantanu Jain.\n\n- bpo-46995(47): Deprecate missing *note asyncio.Task.setname():\n803. for third-party task implementations, schedule making it\nmandatory in Python 3.13.\n\n- bpo-46994(48): Accept explicit contextvars.Context in *note\nasyncio.createtask(): 3c5. and *note asyncio.loop.createtask():\n802.\n\n- bpo-46981(49): 'typing.getargs(typing.Tuple[()])' now returns '()'\ninstead of '((),)'.\n\n- bpo-46968(50): Add 'os.sysconfnames['SCMINSIGSTKSZ']'.\n\n- bpo-46985(51): Upgrade pip wheel bundled with ensurepip (pip\n22.0.4)\n\n- bpo-46968(52): *note faulthandler: 53.: On Linux 5.14 and newer,\ndynamically determine size of signal handler stack size CPython\nallocates using 'getauxval(ATMINSIGSTKSZ)'.  This changes allows\nfor Python extension's request to Linux kernel to use AMXTILE\ninstruction set on Sapphire Rapids Xeon processor to succeed,\nunblocking use of the ISA in frameworks.\n\n- bpo-46917(53): The *note math.nan: 42d. value is now always\navailable.  Patch by Victor Stinner.\n\n- bpo-46955(54): Expose 'asyncio.baseevents.Server' as *note\nasyncio.Server: 949.  Patch by Stefan Zabka.\n\n- bpo-23325(55): The *note signal: c1. module no longer assumes that\n*note SIGIGN: 1582. and *note SIGDFL: 1583. are small int\nsingletons.\n\n- bpo-46932(56): Update bundled libexpat to 2.4.7\n\n- bpo-46933(57): The *note pwd: ad. module is now optional.  *note\nos.path.expanduser(): 83d. returns the path when the *note pwd: ad.\nmodule is not available.\n\n- bpo-40059(58): PEP 680(59), the *note tomllib: f7. module.  Adds\nsupport for parsing TOML.\n\n- bpo-464471(60): *note asyncio.timeout(): 3c7. and *note\nasyncio.timeoutat(): 1584. context managers added.  Patch by Tin\nTvrtkovi?? and Andrew Svetlov.\n\n- bpo-46805(61): Added raw datagram socket functions for asyncio:\n'socksendto()', 'sockrecvfrom()' and 'sockrecvfrominto()'.\n\n- bpo-46644(62): No longer require valid typeforms to be callable.\nThis allows *note typing.Annotated: 75b. to wrap *note\ntyping.ParamSpecArgs: 5b9. and 'dataclasses.InitVar'.  Patch by\nGregory Beauregard.\n\n- bpo-46581(63): Brings 'ParamSpec' propagation for 'GenericAlias' in\nline with 'Concatenate' (and others).\n\n- bpo-45413(64): Define 'posixvenv' and 'ntvenv' *note sysconfig\ninstallation schemes: 45b. to be used for bootstrapping new virtual\nenvironments.  Add 'venv' sysconfig installation scheme to get the\nappropriate one of the above.  The schemes are identical to the\npre-existing 'posixprefix' and 'nt' install schemes.  The *note\nvenv: 10c. module now uses the 'venv' scheme to create new virtual\nenvironments instead of hardcoding the paths depending only on the\nplatform.  Downstream Python distributors customizing the\n'posixprefix' or 'nt' install scheme in a way that is not\ncompatible with the install scheme used in virtual environments are\nencouraged not to customize the 'venv' schemes.  When Python itself\nruns in a virtual environment, *note\nsysconfig.getdefaultscheme(): 1585. and *note\nsysconfig.getpreferredscheme(): 45c. with 'key=\"prefix\"' returns\n'venv'.\n\n- bpo-43224(65): Implement support for PEP 646 in typing.py.\n\n- bpo-43224(66): Allow unpacking types.GenericAlias objects, e.g.\n'*tuple[int, str]'.\n\n- bpo-46557(67): Warnings captured by the logging module are now\nlogged without a format string to prevent systems that group logs\nby the msg argument from grouping captured warnings together.\n\n- bpo-41370(68): *note typing.gettypehints(): 47f. now supports\nevaluating strings as forward references in *note PEP 585 generic\naliases: 480.\n\n- bpo-46607(69): Add *note DeprecationWarning: 179. to\n'LegacyInterpolation', deprecated in the docstring since Python\n3.2.  Will be removed in Python 3.13.  Use 'BasicInterpolation' or\n'ExtendedInterpolation' instead.\n\n- bpo-26120(70): *note pydoc: b0. now excludes future imports\nfrom the module's data items.\n\n- bpo-46480(71): Add *note typing.asserttype(): 478.  Patch by Jelle\nZijlstra.\n\n- bpo-46421(72): Fix a unittest issue where if the command was\ninvoked as 'python -m unittest' and the filename(s) began with a\ndot (.), a 'ValueError' is returned.\n\n- bpo-46245(73): Add optional parameter 'dirfd' in *note\nshutil.rmtree(): 1d5.\n\n- bpo-22859(74): 'usageExit()' is marked deprecated, to be removed in\n3.13.\n\n- bpo-46170(75): Improve the error message when you try to subclass\nan instance of *note typing.NewType: b45.\n\n- bpo-40296(76): Fix supporting generic aliases in *note pydoc: b0.\n\n- bpo-20392(77): Fix inconsistency with uppercase file extensions in\n'MimeTypes.guesstype()'.  Patch by Kumar Aditya.\n\n- bpo-46030(78): Add 'LOCALCREDS', 'LOCALCREDSPERSISTENT' and\n'SCMCREDS2' FreeBSD constants to the socket module.\n\n- bpo-44439(79): Fix '.write()' method of a member file in 'ZipFile',\nwhen the input data is an object that supports the buffer protocol,\nthe file length may be wrong.\n\n- bpo-45171(80): Fix handling of the 'stacklevel' argument to logging\nfunctions in the *note logging: 82. module so that it is consistent\nacross all logging functions and, as advertised, similar to the\n'stacklevel' argument used in *note warn(): 1374.\n\n- bpo-24959(81): Fix bug where *note unittest: 101. sometimes drops\nframes from tracebacks of exceptions raised in tests.\n\n- bpo-44859(82): Raise more accurate and PEP 249(83) compatible\nexceptions in *note sqlite3: c9.\n\n* Raise *note InterfaceError: 449. instead of *note\nProgrammingError: 238. for 'SQLITEMISUSE' errors.\n\n* Don't overwrite *note BufferError: 1586. with *note\nValueError: 183. when conversion to BLOB fails.\n\n* Raise *note ProgrammingError: 238. instead of *note Warning:\n1587. if user tries to *note execute(): 234. more than one SQL\nstatement.\n\n* Raise *note ProgrammingError: 238. instead of *note\nValueError: 183. if an SQL query contains null characters.\n\n- bpo-44493(84): Add missing terminated NUL in sockaddrun's length\n\nThis was potentially observable when using non-abstract AFUNIX\ndatagram sockets to processes written in another programming\nlanguage.\n\n- bpo-41930(85): Add *note serialize(): 44a. and *note deserialize():\n44b. support to *note sqlite3: c9.  Patch by Erlend E. Aasland.\n\n- bpo-33178(86): Added *note ctypes.BigEndianUnion: 1588. and *note\nctypes.LittleEndianUnion: 1589. classes, as originally documented\nin the library docs but not yet implemented.\n\n- bpo-43352(87): Add an Barrier object in synchronization primitives\nof 'asyncio' Lib in order to be consistant with Barrier from\n'threading' and 'multiprocessing' libs*\n\n- bpo-35859(88): *note re: b4. module, fix a few bugs about capturing\ngroup.  In rare cases, capturing group gets an incorrect string.\nPatch by Ma Lin.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=47208\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=23689\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=47167\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=47151\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=47152\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=4833\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=27929\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=14265\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=47061\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=39622\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=47101\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=47099\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=47099\n\n(14) https://peps.python.org/pep-3134/\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=47095\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=47098\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=47088\n\n(18) https://peps.python.org/pep-0675/\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=42885\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=23691\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=47067\n\n(22) https://peps.python.org/pep-0590/\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=28080\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=47000\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=42369\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=38256\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=47066\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=39394\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=433030\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=47062\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=46382\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=47057\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=47061\n\n(34) https://peps.python.org/pep-0594/\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=34790\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=47039\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=2604\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=45150\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=34861\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=45997\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=47022\n\n(42) https://peps.python.org/pep-0594/\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=43253\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=40280\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=47004\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=46998\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=46995\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=46994\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=46981\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=46968\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=46985\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=46968\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=46917\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=46955\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=23325\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=46932\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=46933\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=40059\n\n(59) https://peps.python.org/pep-0680/\n\n(60) https://bugs.python.org/issue?@action=redirect&bpo=464471\n\n(61) https://bugs.python.org/issue?@action=redirect&bpo=46805\n\n(62) https://bugs.python.org/issue?@action=redirect&bpo=46644\n\n(63) https://bugs.python.org/issue?@action=redirect&bpo=46581\n\n(64) https://bugs.python.org/issue?@action=redirect&bpo=45413\n\n(65) https://bugs.python.org/issue?@action=redirect&bpo=43224\n\n(66) https://bugs.python.org/issue?@action=redirect&bpo=43224\n\n(67) https://bugs.python.org/issue?@action=redirect&bpo=46557\n\n(68) https://bugs.python.org/issue?@action=redirect&bpo=41370\n\n(69) https://bugs.python.org/issue?@action=redirect&bpo=46607\n\n(70) https://bugs.python.org/issue?@action=redirect&bpo=26120\n\n(71) https://bugs.python.org/issue?@action=redirect&bpo=46480\n\n(72) https://bugs.python.org/issue?@action=redirect&bpo=46421\n\n(73) https://bugs.python.org/issue?@action=redirect&bpo=46245\n\n(74) https://bugs.python.org/issue?@action=redirect&bpo=22859\n\n(75) https://bugs.python.org/issue?@action=redirect&bpo=46170\n\n(76) https://bugs.python.org/issue?@action=redirect&bpo=40296\n\n(77) https://bugs.python.org/issue?@action=redirect&bpo=20392\n\n(78) https://bugs.python.org/issue?@action=redirect&bpo=46030\n\n(79) https://bugs.python.org/issue?@action=redirect&bpo=44439\n\n(80) https://bugs.python.org/issue?@action=redirect&bpo=45171\n\n(81) https://bugs.python.org/issue?@action=redirect&bpo=24959\n\n(82) https://bugs.python.org/issue?@action=redirect&bpo=44859\n\n(83) https://peps.python.org/pep-0249/\n\n(84) https://bugs.python.org/issue?@action=redirect&bpo=44493\n\n(85) https://bugs.python.org/issue?@action=redirect&bpo=41930\n\n(86) https://bugs.python.org/issue?@action=redirect&bpo=33178\n\n(87) https://bugs.python.org/issue?@action=redirect&bpo=43352\n\n(88) https://bugs.python.org/issue?@action=redirect&bpo=35859\n\nFile: python3.12.info,  Node: Documentation<20>,  Next: Tests<18>,  Prev: Library<20>,  Up: Python 3 11 0 alpha 7\n\n1.22.20.3 Documentation\n.......................\n\n- bpo-45099(1): Document internal *note asyncio: 9. API.\n\n- bpo-47126(2): Update PEP URLs to PEP 676(3)'s new canonical form.\n\n- bpo-47040(4): Clarified the old Python versions compatiblity note\nof *note binascii.crc32(): 13e2. / *note zlib.adler32(): 158b. /\n*note zlib.crc32(): 13e1. functions.\n\n- bpo-46033(5): Clarify 'for' statement execution in its doc.\n\n- bpo-45790(6): Adjust inaccurate phrasing in *note Defining\nExtension Types; Tutorial: 158c. about the 'obbase' field and the\nmacros used to access its contents.\n\n- bpo-42340(7): Document that in some circumstances *note\nKeyboardInterrupt: 7f5. may cause the code to enter an inconsistent\nstate.  Provided a sample workaround to avoid it if needed.\n\n- bpo-41233(8): Link the errnos referenced in\n'Doc/library/exceptions.rst' to their respective section in\n'Doc/library/errno.rst', and vice versa.  Previously this was only\ndone for EINTR and InterruptedError.  Patch by Yan \"yyyyyyyan\"\nOrestes.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=45099\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=47126\n\n(3) https://peps.python.org/pep-0676/\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=47040\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=46033\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=45790\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=42340\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=41233\n\nFile: python3.12.info,  Node: Tests<18>,  Next: Build<18>,  Prev: Documentation<20>,  Up: Python 3 11 0 alpha 7\n\n1.22.20.4 Tests\n...............\n\n- bpo-47205(1): Skip test for *note schedgetaffinity(): f7a. and\n*note schedsetaffinity(): f7e. error case on FreeBSD.\n\n- bpo-46126(2): Restore 'descriptions' when running tests internally.\n\n- bpo-47104(3): Rewrite *note asyncio.tothread(): 701. tests to use\n*note unittest.IsolatedAsyncioTestCase: 48b.\n\n- bpo-40280(4): The test suite is now passing on the Emscripten\nplatform.  All fork, socket, and subprocess-based tests are\nskipped.\n\n- bpo-47037(5): Skip 'strftime(\"%4Y\")' feature test on Windows.  It\ncan cause an assertion error in debug builds.\n\n- bpo-46587(6): Skip tests if platform's 'strftime' does not support\nnon-portable glibc extensions.\n\n- bpo-47015(7): A test case for *note os.sendfile(): 946. is\nconverted from deprecated 'asyncore' (see PEP 594(8)) to *note\nasyncio: 9.  Patch by Oleg Iarygin.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=47205\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=46126\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=47104\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=40280\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=47037\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=46587\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=47015\n\n(8) https://peps.python.org/pep-0594/\n\nFile: python3.12.info,  Node: Build<18>,  Next: Windows<18>,  Prev: Tests<18>,  Up: Python 3 11 0 alpha 7\n\n1.22.20.5 Build\n...............\n\n- bpo-40280(1): Add configure option *note\n-enable-wasm-dynamic-linking: 158f. to enable 'dlopen' and\nMAINMODULE / SIDEMODULE on 'wasm32-emscripten'.\n\n- bpo-46023(2): 'makesetup' now detects and skips all duplicated\nmodule definitions.  The first entry wins.\n\n- bpo-40280(3): Add SOABI 'wasm32-emscripten' for Emscripten and\n'wasm32-wasi' for WASI on 32bit WASM as well as 'wasm64' counter\nparts.\n\n- bpo-47032(4): Ensure Windows install builds fail correctly with a\nnon-zero exit code when part of the build fails.\n\n- bpo-47024(5): Update OpenSSL to 1.1.1n for macOS installers and all\nWindows builds.\n\n- bpo-46996(6): The *note tkinter: ea. package now requires Tcl/Tk\nversion 8.5.12 or newer.\n\n- bpo-46973(7): Add 'regen-configure' make target to regenerate\nconfigure script with Christian's container image\n'quay.io/tiran/cpythonautoconf:269'.\n\n- bpo-46917(8): Building Python now requires support of IEEE 754\nfloating point numbers.  Patch by Victor Stinner.\n\n- bpo-45774(9): 'configure' now verifies that all SQLite C APIs\nneeded for the *note sqlite3: c9. extension module are found.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40280\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=46023\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=40280\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=47032\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=47024\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=46996\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=46973\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=46917\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=45774\n\nFile: python3.12.info,  Node: Windows<18>,  Next: macOS<14>,  Prev: Build<18>,  Up: Python 3 11 0 alpha 7\n\n1.22.20.6 Windows\n.................\n\n- bpo-47194(1): Update 'zlib' to v1.2.12 to resolve CVE-2018-25032.\n\n- bpo-47171(2): Enables installing the 'py.exe' launcher on Windows\nARM64.\n\n- bpo-46566(3): Upgraded *note Python Launcher for Windows: 37f. to\nsupport a new '-V:company/tag' argument for full PEP 514(4) support\nand to detect ARM64 installs.  The '-64' suffix on arguments is\ndeprecated, but still selects any non-32-bit install.  Setting\n'PYLAUNCHERALLOWINSTALL' and specifying a version that is not\ninstalled will attempt to install the requested version from the\nMicrosoft Store.\n\n- bpo-47086(5): The installer for Windows now includes documentation\nas loose HTML files rather than a single compiled '.chm' file.\n\n- bpo-46907(6): Update Windows installer to use SQLite 3.38.1.\n\n- bpo-44549(7): Update bzip2 to 1.0.8 in Windows builds to mitigate\nCVE-2016-3189 and CVE-2019-12900\n\n- bpo-46948(8): Prevent CVE-2022-26488 by ensuring the Add to PATH\noption in the Windows installer uses the correct path when being\nrepaired.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=47194\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=47171\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=46566\n\n(4) https://peps.python.org/pep-0514/\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=47086\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=46907\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=44549\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=46948\n\nFile: python3.12.info,  Node: macOS<14>,  Next: Tools/Demos<13>,  Prev: Windows<18>,  Up: Python 3 11 0 alpha 7\n\n1.22.20.7 macOS\n...............\n\n- bpo-46890(1): Fix a regression in the setting of\n'sys.baseexecutable' in framework builds, and thereby fix a\nregression in *note venv: 10c. virtual environments with such\nbuilds.\n\n- bpo-46907(2): Update macOS installer to SQLite 3.38.1.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=46890\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=46907\n\nFile: python3.12.info,  Node: Tools/Demos<13>,  Next: C API<16>,  Prev: macOS<14>,  Up: Python 3 11 0 alpha 7\n\n1.22.20.8 Tools/Demos\n.....................\n\n- bpo-40280(1): Replace Emscripten's limited shell with Katie Bell's\nbrowser-ui REPL from python-wasm project.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40280\n\nFile: python3.12.info,  Node: C API<16>,  Prev: Tools/Demos<13>,  Up: Python 3 11 0 alpha 7\n\n1.22.20.9 C API\n...............\n\n- bpo-40421(1): Add 'PyFrameGetBuiltins', 'PyFrameGetGenerator' and\n'PyFrameGetGlobals' C-API functions to access frame object\nattributes safely from C code.\n\n- bpo-46850(2): Move the private 'PyFrameEvalFunction' type, and\nprivate 'PyInterpreterStateGetEvalFrameFunc()' and\n'PyInterpreterStateSetEvalFrameFunc()' functions to the internal\nC API. The 'PyFrameEvalFunction' callback function type now uses\nthe 'PyInterpreterFrame' type which is part of the internal C API.\nPatch by Victor Stinner.\n\n- bpo-46850(3): Move the private undocumented\n'PyEvalEvalFrameDefault()' function to the internal C API. The\nfunction now uses the 'PyInterpreterFrame' type which is part of\nthe internal C API. Patch by Victor Stinner.\n\n- bpo-46850(4): Remove the private undocumented function\n'PyEvalCallTracing()' from the C API. Call the public *note\nsys.calltracing(): 1594. function instead.  Patch by Victor\nStinner.\n\n- bpo-46850(5): Remove the private undocumented function\n'PyEvalGetCoroutineOriginTrackingDepth()' from the C API. Call\nthe public *note sys.getcoroutineorigintrackingdepth(): 9ce.\nfunction instead.  Patch by Victor Stinner.\n\n- bpo-46850(6): Remove the following private undocumented functions\nfrom the C API:\n\n* 'PyEvalGetAsyncGenFirstiter()'\n\n* 'PyEvalGetAsyncGenFinalizer()'\n\n* 'PyEvalSetAsyncGenFirstiter()'\n\n* 'PyEvalSetAsyncGenFinalizer()'\n\nCall the public *note sys.getasyncgenhooks(): 1595. and *note\nsys.setasyncgenhooks(): 1596. functions instead.  Patch by Victor\nStinner.\n\n- bpo-46987(7): Remove private functions 'PySysGetObjectId()' and\n'PySysSetObjectId()'.  Patch by Donghee Na.\n\n- bpo-46906(8): Add new functions to pack and unpack C double\n(serialize and deserialize): *note PyFloatPack2(): 550, *note\nPyFloatPack4(): 551, *note PyFloatPack8(): 552, *note\nPyFloatUnpack2(): 553, *note PyFloatUnpack4(): 554. and *note\nPyFloatUnpack8(): 555.  Patch by Victor Stinner.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40421\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=46850\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=46850\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=46850\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=46850\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=46850\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=46987\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=46906\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 11 0 alpha 6,  Next: Python 3 11 0 alpha 5,  Prev: Python 3 11 0 alpha 7,  Up: Changelog": {
            "content": "'Release date: 2022-03-07'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<21>.\n* Library: Library<21>.\n* Documentation: Documentation<21>.\n* Tests: Tests<19>.\n* Build: Build<19>.\n* Windows: Windows<19>.\n* IDLE: IDLE<9>.\n* C API: C API<17>.\n\nFile: python3.12.info,  Node: Core and Builtins<21>,  Next: Library<21>,  Up: Python 3 11 0 alpha 6\n\n1.22.21.1 Core and Builtins\n...........................\n\n- bpo-46940(1): Avoid overriding *note AttributeError: 395. metadata\ninformation for nested attribute access calls.  Patch by Pablo\nGalindo.\n\n- bpo-46927(2): Include the type's name in the error message for\nsubscripting non-generic types.\n\n- bpo-46921(3): Support vectorcall for 'super()'.  Patch by Ken Jin.\n\n- bpo-46841(4): Fix incorrect handling of inline cache entries when\nspecializing *note BINARYOP: 4da.\n\n- bpo-46841(5): Use an oparg to simplify the construction of helpful\nerror messages in *note GETAWAITABLE: 1599.\n\n- bpo-46903(6): Make sure that str subclasses can be used as\nattribute names for instances with virtual dictionaries.  Fixes\nregression in 3.11alpha\n\n- bpo-46841(7): Add more detailed specialization failure stats for\n*note COMPAREOP: 78b. followed by *note EXTENDEDARG: 14fa.\n\n- bpo-46891(8): Fix bug introduced during 3.11alpha where subclasses\nof 'types.ModuleType' with 'slots' were not initialized\ncorrectly, resulting in an interpreter crash.\n\n- bpo-46841(9): Use inline caching for *note LOADATTR: 207, *note\nLOADMETHOD: a65, and *note STOREATTR: 159a.\n\n- bpo-46841(10): Use inline cache for *note BINARYSUBSCR: 1489.\n\n- bpo-46841(11): Use inline caching for *note COMPAREOP: 78b.\n\n- bpo-46864(12): Deprecate 'PyBytesObject.obshash'.  It will be\nremoved in Python 3.13.\n\n- bpo-46841(13): Use inline caching for *note UNPACKSEQUENCE: 159b.\n\n- bpo-46845(14): Reduces dict size by removing hash value from hash\ntable when all inserted keys are Unicode.  For example,\n'sys.getsizeof(dict.fromkeys(\"abcdefg\"))' becomes 272 bytes from\n352 bytes on 64bit platform.\n\n- bpo-46841(15): Use inline cache for *note LOADGLOBAL: 148a.\n\n- bpo-46852(16): Rename the private undocumented\n'float.setformat()' method to 'float.setformat()' to fix a\ntypo introduced in Python 3.7.  The method is only used by\ntestfloat.  Patch by Victor Stinner.\n\n- bpo-46852(17): Remove the undocumented private\n'float.setformat()' method, previously known as\n'float.setformat()' in Python 3.7.  Its docstring said: \"You\nprobably don't want to use this function.  It exists mainly to be\nused in Python's test suite.\" Patch by Victor Stinner.\n\n- bpo-40116(18): Fix regression that dict.update(other) may don't\nrespect iterate order of other when other is key sharing dict.\n\n- bpo-46712(19): Share global string identifiers in deep-frozen\nmodules.\n\n- bpo-46430(20): Fix memory leak in interned strings of deep-frozen\nmodules.\n\n- bpo-46841(21): Store *note BINARYOP: 4da. caches inline using a\nnew *note CACHE: 4cc. instruction.\n\n- bpo-45107(22): Specialize 'LOADMETHOD' for instances with a dict.\n\n- bpo-44337(23): Reduce the memory usage of specialized *note\nLOADATTR: 207. and *note STOREATTR: 159a. instructions.\n\n- bpo-46729(24): Add number of sub-exceptions to\n'BaseException.str()'.\n\n- bpo-45885(25): Don't un-adapt *note COMPAREOP: 78b. when\ncollecting specialization stats.\n\n- bpo-46329(26): Fix specialization stats gathering for 'PRECALL'\ninstructions.\n\n- bpo-46794(27): Bump up the libexpat version into 2.4.6\n\n- bpo-46823(28): Implement a specialized combined opcode\n'LOADFASTLOADATTRINSTANCEVALUE'.  Patch by Dennis Sweeney.\n\n- bpo-46820(29): Fix parsing a numeric literal immediately (without\nspaces) followed by \"not in\" keywords, like in '1not in x'.  Now\nthe parser only emits a warning, not a syntax error.\n\n- bpo-46329(30): Move 'KWNAMES' before 'PRECALL' instruction in call\nsequence.  Change 'operand' of 'CALL' to match 'PRECALL' for easier\nspecialization.\n\n- bpo-46808(31): Remove the 'NEXTBLOCK' macro from compile.c, and\nmake the compiler automatically generate implicit blocks when they\nare needed.\n\n- bpo-46329(32): Add 'PUSHNULL' instruction.  This is used as a\nprefix when evaluating a callable, so that the stack has the same\nshape for methods and other calls.  'PRECALLFUNCTION' and\n'PRECALLMETHOD' are merged into a single 'PRECALL' instruction.\n\nThere is no change in semantics.\n\n- bpo-46762(33): Fix an assert failure in debug builds when a '<',\n'>', or '=' is the last character in an f-string that's missing a\nclosing right brace.\n\n- bpo-46730(34): Message of AttributeError caused by getting, setting\nor deleting a property without the corresponding function now\nmentions that the attribute is in fact a property and also\nspecifies type of the class that it belongs to.\n\n- bpo-46724(35): Make sure that all backwards jumps use the\n'JUMPABSOLUTE' instruction, rather than 'JUMPFORWARD' with an\nargument of '(232)+offset'.\n\n- bpo-46732(36): Correct the docstring for the *note bool():\n114a. method.  Patch by Jelle Zijlstra.\n\n- bpo-46072(37): Add more detailed specialization failure statistics\nfor *note BINARYOP: 4da.\n\n- bpo-46707(38): Avoid potential exponential backtracking when\nproducing some syntax errors involving lots of brackets.  Patch by\nPablo Galindo.\n\n- bpo-46323(39): *note ctypes: 28. now allocates memory on the stack\ninstead of on the heap to pass arguments while calling a Python\ncallback function.  Patch by Donghee Na.\n\n- bpo-45923(40): Add a quickened form of *note RESUME: 4d7. that\nskips quickening checks.\n\n- bpo-46702(41): Specialize *note UNPACKSEQUENCE: 159b. for *note\ntuple: 4b8. and *note list: 3dc. unpackings.\n\n- bpo-46072(42): Opcode pair stats are now gathered with\n'--enable-pystats'.  Defining 'DYNAMICEXECUTIONPROFILE' or\n'DXPAIRS' no longer has any effect.\n\n- bpo-46675(43): Allow more than 16 items in a split dict before it\nis combined.  The limit is now 254.\n\n- bpo-40479(44): Add a missing call to 'vaend()' in\n'Modules/hashopenssl.c'.\n\n- bpo-46323(45): Use *note PyObjectVectorcall(): 2b6. while calling\nctypes callback function.  Patch by Donghee Na.\n\n- bpo-46615(46): When iterating over sets internally in\n'setobject.c', acquire strong references to the resulting items\nfrom the set.  This prevents crashes in corner-cases of various set\noperations where the set gets mutated.\n\n- bpo-45828(47): The bytecode compiler now attempts to apply runtime\nstack manipulations at compile-time (whenever it is feasible to do\nso).\n\n- bpo-30496(48): Fixed a minor portability issue in the\nimplementation of *note PyLongFromLong(): 159c, and added a fast\npath for single-digit integers to *note PyLongFromLongLong():\n159d.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=46940\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=46927\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=46921\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=46841\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=46841\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=46903\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=46841\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=46891\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=46841\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=46841\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=46841\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=46864\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=46841\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=46845\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=46841\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=46852\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=46852\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=40116\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=46712\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=46430\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=46841\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=45107\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=44337\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=46729\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=45885\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=46329\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=46794\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=46823\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=46820\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=46329\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=46808\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=46329\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=46762\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=46730\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=46724\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=46732\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=46072\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=46707\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=46323\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=45923\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=46702\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=46072\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=46675\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=40479\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=46323\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=46615\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=45828\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=30496\n\nFile: python3.12.info,  Node: Library<21>,  Next: Documentation<21>,  Prev: Core and Builtins<21>,  Up: Python 3 11 0 alpha 6\n\n1.22.21.2 Library\n.................\n\n- bpo-25707(1): Fixed a file leak in *note\nxml.etree.ElementTree.iterparse(): e88. when the iterator is not\nexhausted.  Patch by Jacob Walls.\n\n- bpo-46877(2): Export *note unittest.doModuleCleanups(): 159f. in\n*note unittest: 101.  Patch by Kumar Aditya.\n\n- bpo-46848(3): For performance, use the optimized string-searching\nimplementations from *note find(): 15a0. and *note rfind(): 15a1.\nfor 'find()' and 'rfind()'.\n\n- bpo-46736(4): *note SimpleHTTPRequestHandler: 97d. now uses HTML5\ngrammar.  Patch by Donghee Na.\n\n- bpo-44886(5): Inherit asyncio proactor datagram transport from\n*note asyncio.DatagramTransport: 1501.\n\n- bpo-46827(6): Support UDP sockets in *note\nasyncio.loop.sockconnect(): c26. for selector-based event loops.\nPatch by Thomas Grainger.\n\n- bpo-46811(7): Make test suite support Expat >=2.4.5\n\n- bpo-46252(8): Raise *note TypeError: 28e. if *note ssl.SSLSocket:\n703. is passed to transport-based APIs.\n\n- bpo-46784(9): Fix libexpat symbols collisions with user dynamically\nloaded or statically linked libexpat in embedded Python.\n\n- bpo-46786(10): The HTML serialisation in xml.etree.ElementTree now\nwrites 'embed', 'source', 'track' and 'wbr' as empty tags, as\ndefined in HTML 5.\n\n- bpo-39327(11): *note shutil.rmtree(): 1d5. can now work with\nVirtualBox shared folders when running from the guest\noperating-system.\n\n- bpo-45390(12): Propagate *note asyncio.CancelledError: 7fe. message\nfrom inner task to outer awaiter.\n\n- bpo-46756(13): Fix a bug in *note\nurllib.request.HTTPPasswordMgr.finduserpassword(): 15a2. and\n*note\nurllib.request.HTTPPasswordMgrWithPriorAuth.isauthenticated():\n15a3. which allowed to bypass authorization.  For example, access\nto URI 'example.org/foobar' was allowed if the user was authorized\nfor URI 'example.org/foo'.\n\n- bpo-46737(14): *note random.gauss(): 15a4. and *note\nrandom.normalvariate(): 15a5. now have default arguments.\n\n- bpo-46752(15): Add task groups to asyncio (structured concurrency,\ninspired by Trio's nurseries).  This also introduces a change to\ntask cancellation, where a cancelled task can't be cancelled again\nuntil it calls .uncancel().\n\n- bpo-46724(16): Fix *note dis: 35. behavior on negative jump\noffsets.\n\n- bpo-46333(17): The 'repr()' method of *note typing.ForwardRef:\n15a6. now includes the 'module' parameter of *note\ntyping.ForwardRef: 15a6. when it is set.\n\n- bpo-46643(18): In *note typing.gettypehints(): 47f, support\nevaluating stringified 'ParamSpecArgs' and 'ParamSpecKwargs'\nannotations.  Patch by Gregory Beauregard.\n\n- bpo-45863(19): When the *note tarfile: d8. module creates a pax\nformat archive, it will put an integer representation of timestamps\nin the ustar header (if possible) for the benefit of older\nunarchivers, in addition to the existing full-precision timestamps\nin the pax extended header.\n\n- bpo-46066(20): Deprecate kwargs-based syntax for *note\ntyping.TypedDict: 153. definitions.  It had confusing semantics\nwhen specifying totality, and was largely unused.  Patch by\nJingchen Ye.\n\n- bpo-46676(21): Make *note typing.ParamSpec: 163. args and kwargs\nequal to themselves.  Patch by Gregory Beauregard.\n\n- bpo-46323(22): 'ctypes.CFUNCTYPE()' and 'ctypes.WINFUNCTYPE()' now\nfail to create the type if its 'argtypes' member contains too\nmany arguments.  Previously, the error was only raised when calling\na function.  Patch by Victor Stinner.\n\n- bpo-46672(23): Fix 'NameError' in *note asyncio.gather(): 3c6. when\ninitial type check fails.\n\n- bpo-46659(24): The *note calendar.LocaleTextCalendar: 52b. and\n*note calendar.LocaleHTMLCalendar: 52c. classes now use *note\nlocale.getlocale(): 501, instead of using *note\nlocale.getdefaultlocale(): 249, if no locale is specified.  Patch\nby Victor Stinner.\n\n- bpo-46659(25): The *note locale.getdefaultlocale(): 249. function\nis deprecated and will be removed in Python 3.13.  Use *note\nlocale.setlocale(): 500, *note locale.getpreferredencoding(False):\n290. and *note locale.getlocale(): 501. functions instead.  Patch\nby Victor Stinner.\n\n- bpo-46655(26): In *note typing.gettypehints(): 47f, support\nevaluating bare stringified 'TypeAlias' annotations.  Patch by\nGregory Beauregard.\n\n- bpo-45948(27): Fixed a discrepancy in the C implementation of the\n*note xml.etree.ElementTree: 120. module.  Now, instantiating an\n*note xml.etree.ElementTree.XMLParser: 880. with a 'target=None'\nkeyword provides a default *note xml.etree.ElementTree.TreeBuilder:\n881. target as the Python implementation does.\n\n- bpo-46626(28): Expose Linux's 'IPBINDADDRESSNOPORT' option in\n*note socket: c6.\n\n- bpo-46521(29): Fix a bug in the *note codeop: 1a. module that was\nincorrectly identifying invalid code involving string quotes as\nvalid code.\n\n- bpo-46571(30): Improve *note typing.notypecheck(): 483.\n\nNow it does not modify external classes and functions.  We also now\ncorrectly mark classmethods as not to be type checked.\n\n- bpo-46400(31): expat: Update libexpat from 2.4.1 to 2.4.4\n\n- bpo-46556(32): Deprecate undocumented support for using a *note\npathlib.Path: 149. object as a context manager.\n\n- bpo-46534(33): Implement PEP 673(34) *note typing.Self: 388.  Patch\nby James Hilton-Balfe.\n\n- bpo-46522(35): Make various module 'getattr' AttributeErrors\nmore closely match a typical AttributeError\n\n- bpo-46475(36): Add *note typing.Never: 475. and *note\ntyping.assertnever(): 474.  Patch by Jelle Zijlstra.\n\n- bpo-46333(37): The 'eq()' and 'hash()' methods of *note\ntyping.ForwardRef: 15a6. now honor the 'module' parameter of *note\ntyping.ForwardRef: 15a6.  Forward references from different modules\nare now differentiated.\n\n- bpo-46246(38): Add missing 'slots' to\n'importlib.metadata.DeprecatedList'.  Patch by Arie Bovenberg.\n\n- bpo-46232(39): The *note ssl: ca. module now handles certificates\nwith bit strings in DN correctly.\n\n- bpo-46195(40): *note typing.gettypehints(): 47f. no longer adds\n'Optional' to parameters with 'None' as a default.  This aligns to\nchanges to PEP 484 in 'https://github.com/python/peps/pull/689'\n\n- bpo-31369(41): Add *note RegexFlag: 3fa. to 're.all' and\ndocumented it.  Add 'NOFLAG' to indicate no flags being set.\n\n- bpo-45898(42): *note ctypes: 28. no longer defines 'ffitype*'\nsymbols in 'cfield.c'.  The symbols have been provided by libffi\nfor over a decade.\n\n- bpo-44953(43): Calling 'operator.itemgetter' objects and\n'operator.attrgetter' objects is now faster due to use of the\nvectorcall calling convention.\n\n- bpo-44289(44): Fix an issue with *note istarfile(): 15a7. method\nwhen using 'fileobj' argument: position in the 'fileobj' was\nadvanced forward which made it unreadable with *note\ntarfile.TarFile.open(): 15a8.\n\n- bpo-44011(45): Reimplement SSL/TLS support in asyncio, borrow the\nimplementation from uvloop library.\n\n- bpo-41086(46): Make the *note configparser.ConfigParser: 257.\nconstructor raise *note TypeError: 28e. if the 'interpolation'\nparameter is not of type 'configparser.Interpolation'\n\n- bpo-29418(47): Implement *note inspect.ismethodwrapper(): 413. and\nfix *note inspect.isroutine(): 15a9. for cases where methodwrapper\nis given.  Patch by Hakan C,elik.\n\n- bpo-14156(48): argparse.FileType now supports an argument of '-' in\nbinary mode, returning the .buffer attribute of\nsys.stdin/sys.stdout as appropriate.  Modes including 'x' and 'a'\nare treated equivalently to 'w' when argument is '-'.  Patch\ncontributed by Josh Rosenberg\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25707\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=46877\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=46848\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=46736\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=44886\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=46827\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=46811\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=46252\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=46784\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=46786\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=39327\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=45390\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=46756\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=46737\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=46752\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=46724\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=46333\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=46643\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=45863\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=46066\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=46676\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=46323\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=46672\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=46659\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=46659\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=46655\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=45948\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=46626\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=46521\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=46571\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=46400\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=46556\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=46534\n\n(34) https://peps.python.org/pep-0673/\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=46522\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=46475\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=46333\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=46246\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=46232\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=46195\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=31369\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=45898\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=44953\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=44289\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=44011\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=41086\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=29418\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=14156\n\nFile: python3.12.info,  Node: Documentation<21>,  Next: Tests<19>,  Prev: Library<21>,  Up: Python 3 11 0 alpha 6\n\n1.22.21.3 Documentation\n.......................\n\n- bpo-42238(1): 'Doc/tools/rstlint.py' has moved to its own\nrepository and is now packaged on PyPI as 'sphinx-lint'.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42238\n\nFile: python3.12.info,  Node: Tests<19>,  Next: Build<19>,  Prev: Documentation<21>,  Up: Python 3 11 0 alpha 6\n\n1.22.21.4 Tests\n...............\n\n- bpo-46913(1): Fix testfaulthandler.testsigfpe() if Python is\nbuilt with undefined behavior sanitizer (UBSAN): disable UBSAN on\nthe faulthandlersigfpe() function.  Patch by Victor Stinner.\n\n- bpo-46760(2): Remove bytecode offsets from expected values in\ntest.testdis module.  Reduces the obstacles to modifying the VM or\ncompiler.\n\n- bpo-46708(3): Prevent default asyncio event loop policy\nmodification warning after 'testasyncio' execution.\n\n- bpo-46678(4): The function 'makelegacypyc' in\n'Lib/test/support/importhelper.py' no longer fails when\n'PYTHONPYCACHEPREFIX' is set to a directory on a different device\nfrom where tempfiles are stored.\n\n- bpo-46623(5): Skip testpair() and testspeech128() of testzlib on\ns390x since they fail if zlib uses the s390x hardware accelerator.\nPatch by Victor Stinner.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=46913\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=46760\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=46708\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=46678\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=46623\n\nFile: python3.12.info,  Node: Build<19>,  Next: Windows<19>,  Prev: Tests<19>,  Up: Python 3 11 0 alpha 6\n\n1.22.21.5 Build\n...............\n\n- bpo-46860(1): Respect '--with-suffix' when building on\ncase-insensitive file systems.\n\n- bpo-46656(2): Building Python now requires a C11 compiler.\nOptional C11 features are not required.  Patch by Victor Stinner.\n\n- bpo-46656(3): Building Python now requires support for floating\npoint Not-a-Number (NaN): remove the 'PyNONAN' macro.  Patch by\nVictor Stinner.\n\n- bpo-46640(4): Building Python now requires a C99 '<math.h>' header\nfile providing a 'NAN' constant, or the 'builtinnan()' built-in\nfunction.  Patch by Victor Stinner.\n\n- bpo-46608(5): Exclude marshalled-frozen data if deep-freezing to\nsave 300 KB disk space.  This includes adding a new 'ispackage'\nfield to *note frozen: 560.  Patch by Kumar Aditya.\n\n- bpo-40280(6): Fix wasm32-emscripten test failures and platform\nissues.  - Disable syscalls that are not supported or don't work,\ne.g.  wait, getrusage, prlimit, mkfifo, mknod, setres[gu]id,\nsetgroups.  - Use fdcount to cound open fds.  - Add more checks\nfor subprocess and fork.  - Add workarounds for missing\nmultiprocessing and failing socket.accept().  - Enable bzip2.  -\nDisable large file support.  - Disable signal.alarm.\n\n- bpo-46430(7): Intern strings in deep-frozen modules.  Patch by\nKumar Aditya.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=46860\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=46656\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=46656\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=46640\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=46608\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=40280\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=46430\n\nFile: python3.12.info,  Node: Windows<19>,  Next: IDLE<9>,  Prev: Build<19>,  Up: Python 3 11 0 alpha 6\n\n1.22.21.6 Windows\n.................\n\n- bpo-46744(1): The default all users install directory for ARM64 is\nnow under the native 'Program Files' folder, rather than 'Program\nFiles (Arm)' which is intended for ARM (32-bit) files.\n\n- bpo-46567(2): Adds Tcl and Tk support for Windows ARM64.  This also\nadds IDLE to the installation.\n\n- bpo-46638(3): Ensures registry virtualization is consistently\ndisabled.  For 3.10 and earlier, it remains enabled (some registry\nwrites are protected), while for 3.11 and later it is disabled\n(registry modifications affect all applications).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=46744\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=46567\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=46638\n\nFile: python3.12.info,  Node: IDLE<9>,  Next: C API<17>,  Prev: Windows<19>,  Up: Python 3 11 0 alpha 6\n\n1.22.21.7 IDLE\n..............\n\n- bpo-46630(1): Make query dialogs on Windows start with a cursor in\nthe entry box.\n\n- bpo-45447(2): Apply IDLE syntax highlighting to '.pyi' files.\nPatch by Alex Waygood and Terry Jan Reedy.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=46630\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=45447\n\nFile: python3.12.info,  Node: C API<17>,  Prev: IDLE<9>,  Up: Python 3 11 0 alpha 6\n\n1.22.21.8 C API\n...............\n\n- bpo-46748(1): Python's public headers no longer import\n'<stdbool.h>', leaving code that embedd/extends Python free to\ndefine 'bool', 'true' and 'false'.\n\n- bpo-46836(2): Move the *note PyFrameObject: 575. type definition\n('struct frame') to the internal C API 'pycoreframe.h' header\nfile.  Patch by Victor Stinner.\n\n- bpo-45459(3): Rename 'Include/buffer.h' header file to\n'Include/pybuffer.h' to avoid conflits with projects having an\nexisting 'buffer.h' header file.  Patch by Victor Stinner.\n\n- bpo-45412(4): Remove the 'HAVEPYSET53BITPRECISION' macro (moved\nto the internal C API). Patch by Victor Stinner.\n\n- bpo-46613(5): Added function *note PyTypeGetModuleByDef(): 54e,\nwhich allows accesss to module state when a method's defining class\nis not available.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=46748\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=46836\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=45459\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=45412\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=46613\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 11 0 alpha 5,  Next: Python 3 11 0 alpha 4,  Prev: Python 3 11 0 alpha 6,  Up: Changelog": {
            "content": "'Release date: 2022-02-03'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<22>.\n* Library: Library<22>.\n* Documentation: Documentation<22>.\n* Tests: Tests<20>.\n* Build: Build<20>.\n* Windows: Windows<20>.\n* macOS: macOS<15>.\n* IDLE: IDLE<10>.\n* C API: C API<18>.\n\nFile: python3.12.info,  Node: Core and Builtins<22>,  Next: Library<22>,  Up: Python 3 11 0 alpha 5\n\n1.22.22.1 Core and Builtins\n...........................\n\n- bpo-45773(1): Remove two invalid \"peephole\" optimizations from the\nbytecode compiler.\n\n- bpo-46564(2): Do not create frame objects when creating *note\nsuper: 204. object.  Patch by Kumar Aditya.\n\n- bpo-45885(3): Added more fined-grained specialization failure stats\nregarding the 'COMPAREOP' bytecode.\n\n- bpo-44977(4): The delegation of *note int(): 17e. to 'trunc()'\nis now deprecated.  Calling 'int(a)' when 'type(a)' implements\n'trunc()' but not 'int()' or 'index()' now raises a\n*note DeprecationWarning: 179.\n\n- bpo-46458(5): Reorder code emitted by the compiler for a *note try:\n4bc.-*note except: 379. block so that the *note else: 24d. block's\ncode immediately follows the *note try: 4bc. body (without a jump).\nThis is more optimal for the happy path.\n\n- bpo-46527(6): Allow passing 'iterable' as a keyword argument to\n*note enumerate(): 12d5. again.  Patch by Jelle Zijlstra.\n\n- bpo-46528(7): Replace several stack manipulation instructions\n('DUPTOP', 'DUPTOPTWO', 'ROTTWO', 'ROTTHREE', 'ROTFOUR', and\n'ROTN') with new *note COPY: 4dd. and *note SWAP: 4de.\ninstructions.\n\n- bpo-46329(8): Use two or three bytecodes to implement most calls.\n\nCalls without named arguments are implemented as a sequence of two\ninstructions: 'PRECALL; CALL'.  Calls with named arguments are\nimplemented as a sequence of three instructions: 'PRECALL;\nKWNAMES; CALL'.  There are two different 'PRECALL' instructions:\n'PRECALLFUNTION' and 'PRECALLMETHOD'.  The latter pairs with\n'LOADMETHOD'.\n\nThis partition into pre-call and call allows better specialization,\nand thus better performance ultimately.\n\nThere is no change in semantics.\n\n- bpo-46503(9): Fix an assert when parsing some invalid N escape\nsequences in f-strings.\n\n- bpo-46431(10): Improve error message on invalid calls to\n'BaseExceptionGroup.new()'.\n\n- bpo-46476(11): Fix memory leak in code objects generated by\ndeepfreeze.  Patch by Kumar Aditya.\n\n- bpo-46481(12): Speed up calls to 'weakref.ref.call()' by using\nthe PEP 590(13) 'vectorcall' calling convention.  Patch by Donghee\nNa.\n\n- bpo-46417(14): Fix a race condition on setting a type 'bases'\nattribute: the internal function 'addsubclass()' now gets the\n'PyTypeObject.tpsubclasses' member after calling *note\nPyWeakrefNewRef(): 15b2. which can trigger a garbage collection\nwhich can indirectly modify 'PyTypeObject.tpsubclasses'.  Patch by\nVictor Stinner.\n\n- bpo-46417(15): 'python -X showrefcount' now shows the total\nreference count after clearing and destroyed the main Python\ninterpreter.  Previously, it was shown before.  Patch by Victor\nStinner.\n\n- bpo-43683(16): Add ASYNCGENWRAP opcode to wrap the value to be\nyielded in async generators.  Removes the need to special case\nasync generators in the 'YIELDVALUE' instruction.\n\n- bpo-46407(17): Optimize some modulo operations in\n'Objects/longobject.c'.  Patch by Jeremiah Vivian.\n\n- bpo-46409(18): Add new 'RETURNGENERATOR' bytecode to make\ngenerators.  Simplifies calling Python functions in the VM, as they\nno longer any need to special case generator functions.\n\nAlso add 'JUMPNOINTERRUPT' bytecode that acts like\n'JUMPABSOLUTE', but does not check for interrupts.\n\n- bpo-46406(19): The integer division '//' implementation has been\noptimized to better let the compiler understand its constraints.\nIt can be 20% faster on the amd64 platform when dividing an int by\na value smaller than '230'.\n\n- bpo-46383(20): Fix invalid signature of 'zoneinfo''s 'modulefree'\nfunction to resolve a crash on wasm32-emscripten platform.\n\n- bpo-46361(21): Ensure that \"small\" integers created by *note\nint.frombytes(): 15b3. and *note decimal.Decimal: 5c3. are\nproperly cached.\n\n- bpo-46161(22): Fix the class building error when the arguments are\nconstants and CALLFUNCTIONEX is used.\n\n- bpo-46028(23): Fixes calculation of 'sys.baseexecutable' when\ninside a virtual environment that uses symlinks with different\nbinary names than the base environment provides.\n\n- bpo-46091(24): Correctly calculate indentation levels for lines\nwith whitespace character that are ended by line continuation\ncharacters.  Patch by Pablo Galindo\n\n- bpo-30512(25): Add CAN Socket support for NetBSD.\n\n- bpo-46045(26): Do not use POSIX semaphores on NetBSD\n\n- bpo-44024(27): Improve the *note TypeError: 28e. message for\nnon-string second arguments passed to the built-in functions *note\ngetattr(): a15. and *note hasattr(): 1f7.  Patch by Ge'ry Ogam.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=45773\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=46564\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=45885\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=44977\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=46458\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=46527\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=46528\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=46329\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=46503\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=46431\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=46476\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=46481\n\n(13) https://peps.python.org/pep-0590/\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=46417\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=46417\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=43683\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=46407\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=46409\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=46406\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=46383\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=46361\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=46161\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=46028\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=46091\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=30512\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=46045\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=44024\n\nFile: python3.12.info,  Node: Library<22>,  Next: Documentation<22>,  Prev: Core and Builtins<22>,  Up: Python 3 11 0 alpha 5\n\n1.22.22.2 Library\n.................\n\n- bpo-46624(1): Restore support for non-integer arguments of *note\nrandom.randrange(): 665. and *note random.randint(): 10a5.\n\n- bpo-46591(2): Make the IDLE doc URL on the About IDLE dialog\nclickable.\n\n- bpo-46565(3): Remove loop variables that are leaking into modules'\nnamespaces.\n\n- bpo-46553(4): In *note typing.gettypehints(): 47f, support\nevaluating bare stringified 'ClassVar' annotations.  Patch by\nGregory Beauregard.\n\n- bpo-46544(5): Don't leak 'x' & 'uspace' intermediate vars in *note\ntextwrap.TextWrapper: e40.\n\n- bpo-46487(6): Add the 'getwritebufferlimits' method to\n'asyncio.transports.WriteTransport' and to the SSL transport.\n\n- bpo-45173(7): Note the configparser deprecations will be removed in\nPython 3.12.\n\n- bpo-45162(8): The deprecated *note unittest: 101. APIs removed in\n3.11a1 have been temporarily restored to be removed in 3.12 while\ncleanups in external projects go in.\n\n- bpo-46539(9): In *note typing.gettypehints(): 47f, support\nevaluating stringified 'ClassVar' and 'Final' annotations inside\n'Annotated'.  Patch by Gregory Beauregard.\n\n- bpo-46510(10): Add missing test for *note types.TracebackType: 929.\nand *note types.FrameType: 15b5.  Calculate them directly from the\ncaught exception without calling *note sys.excinfo(): 456.\n\n- bpo-46491(11): Allow *note typing.Annotated: 75b. to wrap *note\ntyping.Final: 870. and *note typing.ClassVar: 482.  Patch by\nGregory Beauregard.\n\n- bpo-46483(12): Remove *note classgetitem(): 520. from *note\npathlib.PurePath: 1c5. as this class was not supposed to be\ngeneric.\n\n- bpo-46436(13): Fix command-line option '-d'/'--directory' in module\n*note http.server: 6d. which is ignored when combined with\ncommand-line option '--cgi'.  Patch by Ge'ry Ogam.\n\n- bpo-41403(14): Make 'mock.patch()' raise a *note TypeError: 28e.\nwith a relevant error message on invalid arg.  Previously it\nallowed a cryptic *note AttributeError: 395. to escape.\n\n- bpo-46474(15): In 'importlib.metadata.EntryPoint.pattern', avoid\npotential REDoS by limiting ambiguity in consecutive whitespace.\n\n- bpo-46474(16): Removed private method from\n'importlib.metadata.Path'.  Sync with importlibmetadata 4.10.0.\n\n- bpo-46470(17): Remove unused branch from\n'typing.removedupsflatten'\n\n- bpo-46469(18): *note asyncio: 9. generic classes now return *note\ntypes.GenericAlias: 5df. in 'classgetitem' instead of the same\nclass.\n\n- bpo-41906(19): Support passing filter instances in the 'filters'\nvalues of 'handlers' and 'loggers' in the dictionary passed to\n*note logging.config.dictConfig(): 1023.\n\n- bpo-46422(20): Use 'dis.Positions' in 'dis.Instruction' instead of\na regular 'tuple'.\n\n- bpo-46434(21): *note pdb: a0. now gracefully handles 'help' when\n'doc' is missing, for example when run with pregenerated\noptimized '.pyc' files.\n\n- bpo-43869(22): Python uses the same time Epoch on all platforms.\nAdd an explicit unit test to ensure that it's the case.  Patch by\nVictor Stinner.\n\n- bpo-46414(23): Add *note typing.revealtype(): 477.  Patch by Jelle\nZijlstra.\n\n- bpo-40280(24): *note subprocess: d0. now imports Windows-specific\nimports when 'msvcrt' module is available, and POSIX-specific\nimports on all other platforms.  This gives a clean exception when\n'posixsubprocess' is not available (e.g.  Emscripten browser\ntarget).\n\n- bpo-40066(25): 'IntEnum', 'IntFlag', and 'StrEnum' use the mixed-in\ntype for their 'str()' and 'format()' output.\n\n- bpo-46316(26): Optimize *note pathlib.Path.iterdir(): 1505. by\nremoving an unnecessary check for special entries.\n\n- bpo-29688(27): Document *note pathlib.Path.absolute(): 146f. (which\nhas always existed).\n\n- bpo-43012(28): The pathlib module's obsolete and internal\n'Accessor' class has been removed to prepare the terrain for\nupcoming enhancements to the module.\n\n- bpo-46258(29): Speed up *note math.isqrt(): 82d. for small positive\nintegers by replacing two division steps with a lookup table.\n\n- bpo-46242(30): Improve error message when creating a new *note\nenum.Enum: 3fd. type subclassing an existing 'Enum' with\n'membernames' using 'enum.Enum.call()'.\n\n- bpo-43118(31): Fix a bug in *note inspect.signature(): 51c. that\nwas causing it to fail on some subclasses of classes with a\n'textsignature' referencing module globals.  Patch by Weipeng\nHong.\n\n- bpo-26552(32): Fixed case where failing *note\nasyncio.ensurefuture(): ac1. did not close the coroutine.  Patch\nby Kumar Aditya.\n\n- bpo-21987(33): Fix an issue with *note tarfile.TarFile.getmember():\n15b6. getting a directory name with a trailing slash.\n\n- bpo-46124(34): Update *note zoneinfo: 12e. to rely on\nimportlib.resources traversable API.\n\n- bpo-46103(35): Now *note inspect.getmembers(): 15b7. only gets\n'bases' attribute from class type.  Patch by Weipeng Hong.\n\n- bpo-46080(36): Fix exception in argparse help text generation if a\n'argparse.BooleanOptionalAction' argument's default is\n'argparse.SUPPRESS' and it has 'help' specified.  Patch by Felix\nFontein.\n\n- bpo-44791(37): Fix substitution of *note ParamSpec: 163. in *note\nConcatenate: 5b7. with different parameter expressions.\nSubstitution with a list of types returns now a tuple of types.\nSubstitution with 'Concatenate' returns now a 'Concatenate' with\nconcatenated lists of arguments.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=46624\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=46591\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=46565\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=46553\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=46544\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=46487\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=45173\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=45162\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=46539\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=46510\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=46491\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=46483\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=46436\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=41403\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=46474\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=46474\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=46470\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=46469\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=41906\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=46422\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=46434\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=43869\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=46414\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=40280\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=40066\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=46316\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=29688\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=43012\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=46258\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=46242\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=43118\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=26552\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=21987\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=46124\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=46103\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=46080\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=44791\n\nFile: python3.12.info,  Node: Documentation<22>,  Next: Tests<20>,  Prev: Library<22>,  Up: Python 3 11 0 alpha 5\n\n1.22.22.3 Documentation\n.......................\n\n- bpo-46463(1): Fixes 'escape4chm.py' script used when building the\nCHM documentation file\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=46463\n\nFile: python3.12.info,  Node: Tests<20>,  Next: Build<20>,  Prev: Documentation<22>,  Up: Python 3 11 0 alpha 5\n\n1.22.22.4 Tests\n...............\n\n- bpo-43478(1): Mocks can no longer be provided as the specs for\nother Mocks.  As a result, an already-mocked object cannot be\npassed to 'mock.Mock()'.  This can uncover bugs in tests since\nthese Mock-derived Mocks will always pass certain tests (e.g.\nisinstance) and builtin assert functions (e.g.\nassertcalledoncewith) will unconditionally pass.\n\n- bpo-46616(2): Ensures 'testimportlib.testwindows' cleans up\nregistry keys after completion.\n\n- bpo-44359(3): testftplib now silently ignores socket errors to\nprevent logging unhandled threading exceptions.  Patch by Victor\nStinner.\n\n- bpo-46600(4): Fix testgdb.testpycfunction() for Python built with\n'clang -Og'.  Tolerate inlined functions in the gdb traceback.\nPatch by Victor Stinner.\n\n- bpo-46542(5): Fix a Python crash in testlib2to3 when using Python\nbuilt in debug mode: limit the recursion limit.  Patch by Victor\nStinner.\n\n- bpo-46576(6): testpeggenerator now disables compiler optimization\nwhen testing compilation of its own C extensions to significantly\nspeed up the testing on non-debug builds of CPython.\n\n- bpo-46542(7): Fix 'testjson' tests checking for *note\nRecursionError: bc6.: modify these tests to use\n'support.infiniterecursion()'.  Patch by Victor Stinner.\n\n- bpo-13886(8): Skip testbuiltin PTY tests on non-ASCII characters\nif the readline module is loaded.  The readline module changes\ninput() behavior, but testbuiltin is not intented to test the\nreadline module.  Patch by Victor Stinner.\n\n- bpo-40280(9): Add 'test.support.requiresfork()' decorators to mark\ntests that require a working *note os.fork(): 231.\n\n- bpo-40280(10): Add 'test.support.requiressubprocess()' decorator\nto mark tests which require working *note subprocess: d0. module or\n'os.spawn*'.  The wasm32-emscripten platform has no support for\nprocesses.\n\n- bpo-46126(11): Disable 'descriptions' when running tests\ninternally.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43478\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=46616\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=44359\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=46600\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=46542\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=46576\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=46542\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=13886\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=40280\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=40280\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=46126\n\nFile: python3.12.info,  Node: Build<20>,  Next: Windows<20>,  Prev: Tests<20>,  Up: Python 3 11 0 alpha 5\n\n1.22.22.5 Build\n...............\n\n- bpo-46602(1): Tidied up configure.ac so that conftest.c is\ntruncated rather than appended.  This assists in the case where the\n'rm' of conftest.c fails to happen between tests.  Downstream\nissues such as a clobbered SOABI can result.\n\n- bpo-46600(2): Fix the test checking if the C compiler supports\n'-Og' option in the './configure' script to also use '-Og' on clang\nwhich supports it.  Patch by Victor Stinner.\n\n- bpo-38472(3): Fix GCC detection in setup.py when cross-compiling.\nThe C compiler is now run with LCALL=C. Previously, the detection\nfailed with a German locale.\n\n- bpo-46513(4): 'configure' no longer uses 'ACCCHARUNSIGNED' macro\nand 'pyconfig.h' no longer defines reserved symbol\n'CHARUNSIGNED'.\n\n- bpo-46471(5): Use global singletons for single byte bytes objects\nin deepfreeze.\n\n- bpo-46443(6): Deepfreeze now uses cached small integers as it saves\nsome space for common small integers.\n\n- bpo-46429(7): Merge all deep-frozen files into one for space\nsavings.  Patch by Kumar Aditya.\n\n- bpo-45569(8): The build now defaults to using 30-bit digits for\nPython integers.  Previously either 15-bit or 30-bit digits would\nbe selected, depending on the platform.  15-bit digits may still be\nselected using the '--enable-big-digits=15' option to the\n'configure' script, or by defining 'PYLONGBITSINDIGIT' in\n'pyconfig.h'.\n\n- bpo-45925(9): Update Windows installer to use SQLite 3.37.2.\n\n- bpo-43112(10): Detect musl libc as a separate SOABI (tagged as\n'linux-musl').\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=46602\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=46600\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=38472\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=46513\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=46471\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=46443\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=46429\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=45569\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=45925\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=43112\n\nFile: python3.12.info,  Node: Windows<20>,  Next: macOS<15>,  Prev: Build<20>,  Up: Python 3 11 0 alpha 5\n\n1.22.22.6 Windows\n.................\n\n- bpo-33125(1): The traditional EXE/MSI based installer for Windows\nis now available for ARM64\n\n- bpo-46362(2): os.path.abspath(\"C:CON\") is now fixed to return\n\"\\.CON\", not the same path.  The regression was true of all legacy\nDOS devices such as COM1, LPT1, or NUL.\n\n- bpo-44934(3): The installer now offers a command-line only option\nto add the installation directory to the end of 'PATH' instead of\nat the start.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33125\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=46362\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=44934\n\nFile: python3.12.info,  Node: macOS<15>,  Next: IDLE<10>,  Prev: Windows<20>,  Up: Python 3 11 0 alpha 5\n\n1.22.22.7 macOS\n...............\n\n- bpo-45925(1): Update macOS installer to SQLite 3.37.2.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=45925\n\nFile: python3.12.info,  Node: IDLE<10>,  Next: C API<18>,  Prev: macOS<15>,  Up: Python 3 11 0 alpha 5\n\n1.22.22.8 IDLE\n..............\n\n- bpo-45296(1): Clarify close, quit, and exit in IDLE. In the File\nmenu, 'Close' and 'Exit' are now 'Close Window' (the current one)\nand 'Exit' is now 'Exit IDLE' (by closing all windows).  In Shell,\n'quit()' and 'exit()' mean 'close Shell'.  If there are no other\nwindows, this also exits IDLE.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=45296\n\nFile: python3.12.info,  Node: C API<18>,  Prev: IDLE<10>,  Up: Python 3 11 0 alpha 5\n\n1.22.22.9 C API\n...............\n\n- bpo-40170(1): Remove the 'PyHeapTypeGETMEMBERS()' macro.  It was\nexposed in the public C API by mistake, it must only be used by\nPython internally.  Use the 'PyTypeObject.tpmembers' member\ninstead.  Patch by Victor Stinner.\n\n- bpo-40170(2): Move PyGetAllocatedBlocks() and\nPyObjectDebugMallocStats() private functions to the internal C\nAPI. Patch by Victor Stinner.\n\n- bpo-46433(3): The internal function PyTypeGetModuleByDef now\ncorrectly handles inheritance patterns involving static types.\n\n- bpo-45459(4): *note Pybuffer: 53f. and various 'Pybuffer' related\nfunctions are now part of the limited API and stable ABI.\n\n- bpo-14916(5): Fixed bug in the tokenizer that prevented\n'PyRunInteractiveOne' from parsing from the provided FD.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40170\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=40170\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=46433\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=45459\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=14916\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 11 0 alpha 4,  Next: Python 3 11 0 alpha 3,  Prev: Python 3 11 0 alpha 5,  Up: Changelog": {
            "content": "'Release date: 2022-01-13'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<23>.\n* Library: Library<23>.\n* Documentation: Documentation<23>.\n* Tests: Tests<21>.\n* Build: Build<21>.\n* Windows: Windows<21>.\n* macOS: macOS<16>.\n* C API: C API<19>.\n\nFile: python3.12.info,  Node: Core and Builtins<23>,  Next: Library<23>,  Up: Python 3 11 0 alpha 4\n\n1.22.23.1 Core and Builtins\n...........................\n\n- bpo-46070(1): *note PyEndInterpreter(): 15c1. now explicitly\nuntracks all objects currently tracked by the GC. Previously, if an\nobject was used later by another interpreter, calling *note\nPyObjectGCUnTrack(): 1361. on the object crashed if the previous\nor the next object of the 'PyGCHead' structure became a dangling\npointer.  Patch by Victor Stinner.\n\n- bpo-46347(2): Fix memory leak in PyEvalEvalCodeEx.\n\n- bpo-46339(3): Fix a crash in the parser when retrieving the error\ntext for multi-line f-strings expressions that do not start in the\nfirst line of the string.  Patch by Pablo Galindo\n\n- bpo-46331(4): Do not set line number of instruction storing\ndoc-string.  Fixes regression introduced in 3.11 alpha.\n\n- bpo-46314(5): Remove spurious \"call\" event when creating a lambda\nfunction that was accidentally introduced in 3.11a4.\n\n- bpo-46289(6): ASDL declaration of 'FormattedValue' has changed to\nreflect 'conversion' field is not optional.\n\n- bpo-46297(7): Fixed an interpreter crash on bootup with multiple\nPythonPaths set in the Windows registry.  Patch by Derzsi D??niel.\n\n- bpo-46237(8): Fix the line number of tokenizer errors inside\nf-strings.  Patch by Pablo Galindo.\n\n- bpo-46263(9): We always expect the \"usefrozenmodules\" config to\nbe set, now that getpath.c was rewritten in pure Python and the\nlogic improved.\n\n- bpo-46006(10): Fix a regression when a type method like\n'init()' is modified in a subinterpreter.  Fix a regression in\n'PyUnicodeEqualToASCIIId()' and type 'updateslot()'.  Revert the\nchange which made the Unicode dictionary of interned strings\ncompatible with subinterpreters: the internal interned dictionary\nis shared again by all interpreters.  Patch by Victor Stinner.\n\n- bpo-45923(11): Add RESUME opcode.  This is a logical no-op.  It is\nemitted by the compiler anywhere a Python function can be entered.\nIt is used by the interpreter to perform tracing and optimizer\nchecks.\n\n- bpo-46208(12): Fix the regression of os.path.normpath(\"A/../../B\")\nnot returning expected \"../B\" but \"B\".\n\n- bpo-46240(13): Correct the error message for unclosed parentheses\nwhen the tokenizer doesn't reach the end of the source when the\nerror is reported.  Patch by Pablo Galindo\n\n- bpo-46009(14): Remove the 'GENSTART' opcode.\n\n- bpo-46235(15): Certain sequence multiplication operations like '[0]\n* 1000' are now faster due to reference-counting optimizations.\nPatch by Dennis Sweeney.\n\n- bpo-46221(16): 'PREPRERAISESTAR' no longer pushes 'lasti' to the\nstack.\n\n- bpo-46202(17): Remove 'POPEXCEPTANDRERAISE' and replace it by an\nequivalent sequence of other opcodes.\n\n- bpo-46085(18): Fix iterator cache mechanism of 'OrderedDict'.\n\n- bpo-46055(19): Speed up shifting operation involving integers less\nthan 'PyLongBASE'.  Patch by Xinhang Xu.\n\n- bpo-46110(20): Add a maximum recursion check to the PEG parser to\navoid stack overflow.  Patch by Pablo Galindo\n\n- bpo-46107(21): Fix bug where 'ExceptionGroup.split()' and\n'ExceptionGroup.subgroup()' did not copy the exception group's\n'note' field to the parts.\n\n- bpo-45711(22): The interpreter state's representation of handled\nexceptions (a.k.a excinfo, or PyErrStackItem) now has only the\n'excvalue' field, 'exctype' and 'exctraceback' have been removed\nas their values can be derived from 'excvalue'.\n\n- bpo-44525(23): Replace the four call bytecode instructions which\none pre-call instruction and two call instructions.\n\nRemoves 'CALLFUNCTION', 'CALLFUNCTIONKW', 'CALLMETHOD' and\n'CALLMETHODKW'.\n\nAdds 'CALLNOKW' and 'CALLKW' call instructions, and\n'PRECALLMETHOD' prefix for pairing with 'LOADMETHOD'.\n\n- bpo-46039(24): Remove the 'YIELDFROM' instruction and replace it\nwith the 'SEND' instruction which performs the same operation, but\nwithout the loop.\n\n- bpo-45635(25): The code called from 'PyErrDisplay()' was\nrefactored to improve error handling.  It now exits immediately\nupon an unrecoverable error.\n\n- bpo-46054(26): Fix parser error when parsing non-utf8 characters in\nsource files.  Patch by Pablo Galindo.\n\n- bpo-46042(27): Improve the location of the caret in *note\nSyntaxError: 146. exceptions emitted by the symbol table.  Patch by\nPablo Galindo.\n\n- bpo-46049(28): Ensure '.pth' files work as intended on platforms\nother than Windows.\n\n- bpo-46048(29): Fixes parsing of '.pth' files on startup so that\nsingle-character paths are correctly read.\n\n- bpo-37971(30): Fix a bug where the line numbers given in a\ntraceback when a decorator application raised an exception were\nwrong.\n\n- bpo-46031(31): Add *note POPJUMPIFNOTNONE: 1556. and *note\nPOPJUMPIFNONE: 1555. opcodes to speed up conditional jumps.\n\n- bpo-45654(32): Deepfreeze *note runpy: b9, patch by Kumar Aditya.\n\n- bpo-46025(33): Fix a crash in the *note atexit: a. module involving\nfunctions that unregister themselves before raising exceptions.\nPatch by Pablo Galindo.\n\n- bpo-46000(34): Improve compatibility of the *note curses: 29.\nmodule with NetBSD curses.\n\n- bpo-44525(35): Specialize the CALLFUNCTION instruction for calls\nto builtin types with a single argument.  Speeds up 'range(x)',\n'list(x)', and specifically 'type(obj)'.\n\n- bpo-42918(36): Fix bug where the built-in *note compile(): 528.\nfunction did not always raise a *note SyntaxError: 146. when passed\nmultiple statements in 'single' mode.  Patch by Weipeng Hong.\n\n- bpo-45953(37): The main interpreter in PyRuntimeState.interpreters\nis now statically allocated (as part of PyRuntime).  Likewise for\nthe initial thread state of each interpreter.  This means less\nallocation during runtime init, as well as better memory locality\nfor these key state objects.\n\n- bpo-45292(38): Complete the PEP 654(39) implementation: add\n'except*'.\n\n- bpo-43413(40): Revert changes in 'set.init'.  Subclass of *note\nset: 39d. needs to define a 'init()' method if it defines a\n'new()' method with additional keyword parameters.\n\n- bpo-43931(41): Added the *note PyVersion: 53d. constant which\nbears the same value as *note PYVERSIONHEX: 53e.  Patch by\nGabriele N. Tornetta.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=46070\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=46347\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=46339\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=46331\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=46314\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=46289\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=46297\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=46237\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=46263\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=46006\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=45923\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=46208\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=46240\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=46009\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=46235\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=46221\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=46202\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=46085\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=46055\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=46110\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=46107\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=45711\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=44525\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=46039\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=45635\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=46054\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=46042\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=46049\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=46048\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=37971\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=46031\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=45654\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=46025\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=46000\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=44525\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=42918\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=45953\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=45292\n\n(39) https://peps.python.org/pep-0654/\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=43413\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=43931\n\nFile: python3.12.info,  Node: Library<23>,  Next: Documentation<23>,  Prev: Core and Builtins<23>,  Up: Python 3 11 0 alpha 4\n\n1.22.23.2 Library\n.................\n\n- bpo-46342(1): The '@typing.final' decorator now sets the\n'final' attribute on the decorated object to allow runtime\nintrospection.  Patch by Jelle Zijlstra.\n\n- bpo-46328(2): Added the *note sys.exception(): 457. method which\nreturns the active exception instance.\n\n- bpo-46307(3): Add *note string.Template.isvalid(): 452. and *note\nstring.Template.getidentifiers(): 451. methods.\n\n- bpo-46306(4): Assume that *note types.CodeType: 7f6. always has\n'types.CodeType.cofirstlineno' in *note doctest: 36.\n\n- bpo-40479(5): Fix *note hashlib: 63. 'usedforsecurity' option to\nwork correctly with OpenSSL 3.0.0 in FIPS mode.\n\n- bpo-46070(6): Fix possible segfault when importing the *note\nasyncio: 9. module from different sub-interpreters in parallel.\nPatch by Erlend E. Aasland.\n\n- bpo-46244(7): Removed 'slots' from *note typing.ParamSpec: 163.\nand *note typing.TypeVar: 164.  They served no purpose.  Patch by\nArie Bovenberg.\n\n- bpo-46278(8): Reflect 'context' argument in\n'AbstractEventLoop.call*()' methods.  Loop implementations already\nsupport it.\n\n- bpo-46269(9): Remove special-casing of 'new' in *note\nenum.Enum.dir(): 15c3.\n\n- bpo-46266(10): Improve day constants in *note calendar: 12.\n\nNow all constants ('MONDAY' ... 'SUNDAY') are documented, tested, and\nadded to 'all'.\n\n- bpo-46257(11): Optimized the mean, variance, and stdev functions in\nthe statistics module.  If the input is an iterator, it is consumed\nin a single pass rather than eating memory by conversion to a list.\nThe single pass algorithm is about twice as fast as the previous\ntwo pass code.\n\n- bpo-41011(12): Added two new variables to 'pyvenv.cfg' which is\ngenerated by *note venv: 10c. module: 'executable' for the\nexecutable and 'command' for the command line used to create the\nenvironment.\n\n- bpo-46239(13): Improve error message when importing\n'asyncio.windowsevents' on non-Windows.\n\n- bpo-46238(14): Reuse 'winapi' constants in\n'asyncio.windowsevents'.\n\n- bpo-46222(15): Adding 'SFNOCACHE' sendfile constant for FreeBSD\nfor the posixmodule.\n\n- bpo-37295(16): Add fast path for '0 <= k <= n <= 67' for *note\nmath.comb(): 49f.\n\n- bpo-46176(17): Adding the 'MAPSTACK' constant for the mmap module.\n\n- bpo-43424(18): Deprecate 'webbrowser.MacOSXOSAScript.name' and use\n'name' instead.\n\n- bpo-45321(19): Added missing error codes to module\n'xml.parsers.expat.errors'.\n\n- bpo-46125(20): Refactor tests to test traversable API directly.\nIncludes changes from importlib 5.4.0.\n\n- bpo-46118(21): Moved importlib.resources and its related\nfunctionality to a package.\n\n- bpo-37578(22): Add 'includehidden' parameter to *note glob(): 5fa.\nand *note iglob(): 5fb. to match hidden files and directories when\nusing special characters like '*', '', '?' and '[]'.\n\n- bpo-20369(23): *note concurrent.futures.wait(): 15c4. no longer\nblocks forever when given duplicate Futures.  Patch by Kumar\nAditya.\n\n- bpo-46105(24): Honor spec when generating requirement specs with\nurls and extras (importlibmetadata 4.8.3).\n\n- bpo-44893(25): EntryPoint objects are no longer tuples.\nRecommended means to access is by attribute ('.name', '.group') or\naccessor ('.load()').  Access by index is deprecated and will raise\ndeprecation warning.\n\n- bpo-22815(26): Print unexpected successes together with failures\nand errors in summary in *note unittest.TextTestResult: 286.\n\n- bpo-22047(27): Calling 'addargumentgroup()' on an argument group\nis deprecated.  Calling 'addargumentgroup()' or\n'addmutuallyexclusivegroup()' on a mutually exclusive group is\ndeprecated.\n\nThese features were never supported and do not always work\ncorrectly.  The functions exist on the API by accident through\ninheritance and will be removed in the future.\n\n- bpo-26952(28): *note argparse: 6. raises *note ValueError: 183.\nwith clear message when trying to render usage for an empty\nmutually exclusive group.  Previously it raised a cryptic *note\nIndexError: 138f.\n\n- bpo-45615(29): Functions in the *note traceback: f9. module raise\n*note TypeError: 28e. rather than *note AttributeError: 395. when\nan exception argument is not of type *note BaseException: 37c.\n\n- bpo-16594(30): Add allow allowreuseport flag in socketserver.\n\n- bpo-27718(31): Fix help for the *note signal: c1. module.  Some\nfunctions (e.g.  'signal()' and 'getsignal()') were omitted.\n\n- bpo-46032(32): The 'registry()' method of *note\nfunctools.singledispatch(): 406. functions checks now the first\nargument or the first parameter annotation and raises a TypeError\nif it is not supported.  Previously unsupported \"types\" were\nignored (e.g.  'typing.List[int]') or caused an error at calling\ntime (e.g.  'list[int]').\n\n- bpo-46014(33): Add ability to use 'typing.Union' and\n'types.UnionType' as dispatch argument to\n'functools.singledispatch'.  Patch provided by Yurii Karabas.\n\n- bpo-27062(34): Add 'all' to *note inspect: 78, patch by Kumar\nAditya.\n\n- bpo-46018(35): Ensure that *note math.expm1(): 1060. does not raise\non underflow.\n\n- bpo-46016(36): Adding 'FDUP2FD' and 'FDUP2FDCLOEXEC' constants\nfrom FreeBSD into the fcntl module.\n\n- bpo-45755(37): *note typing: ff. generic aliases now reveal the\nclass attributes of the original generic class when passed to\n'dir()'.  This was the behavior up to Python 3.6, but was changed\nin 3.7-3.9.\n\n- bpo-45874(38): The empty query string, consisting of no query\narguments, is now handled correctly in 'urllib.parse.parseqsl'.\nThis caused problems before when strict parsing was enabled.\n\n- bpo-44674(39): Change how dataclasses disallows mutable default\nvalues.  It used to use a list of known types (list, dict, set).\nNow it disallows unhashable objects to be defaults.  It's using\nunhashability as a proxy for mutability.  Patch by Eric V. Smith,\nidea by Raymond Hettinger.\n\n- bpo-23882(40): Remove namespace package (PEP 420) support from\nunittest discovery.  It was introduced in Python 3.4 but has been\nbroken since Python 3.7.\n\n- bpo-25066(41): Added a 'repr()' method to *note\nmultiprocessing.Event: 15c5. objects, patch by Kumar Aditya.\n\n- bpo-45643(42): Added *note signal.SIGSTKFLT: 15c6. on platforms\nwhere this signal is defined.\n\n- bpo-44092(43): Fetch across rollback no longer raises *note\nInterfaceError: 449.  Instead we leave it to the SQLite library to\nhandle these cases.  Patch by Erlend E. Aasland.\n\n- bpo-42413(44): Replace 'concurrent.futures.TimeoutError' and\n'asyncio.TimeoutError' with builtin *note TimeoutError: 62a, keep\nthese names as deprecated aliases.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=46342\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=46328\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=46307\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=46306\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=40479\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=46070\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=46244\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=46278\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=46269\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=46266\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=46257\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=41011\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=46239\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=46238\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=46222\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=37295\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=46176\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=43424\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=45321\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=46125\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=46118\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=37578\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=20369\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=46105\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=44893\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=22815\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=22047\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=26952\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=45615\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=16594\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=27718\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=46032\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=46014\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=27062\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=46018\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=46016\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=45755\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=45874\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=44674\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=23882\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=25066\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=45643\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=44092\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=42413\n\nFile: python3.12.info,  Node: Documentation<23>,  Next: Tests<21>,  Prev: Library<23>,  Up: Python 3 11 0 alpha 4\n\n1.22.23.3 Documentation\n.......................\n\n- bpo-46196(1): Document method *note cmd.Cmd.columnize(): 15c8.\n\n- bpo-46120(2): State that '|' is preferred for readability over\n'Union' in the *note typing: ff. docs.\n\n- bpo-46109(3): Extracted 'importlib.resources' and\n'importlib.resources.abc' documentation into separate files.\n\n- bpo-19737(4): Update the documentation for the *note globals():\n15c9. function.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=46196\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=46120\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=46109\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=19737\n\nFile: python3.12.info,  Node: Tests<21>,  Next: Build<21>,  Prev: Documentation<23>,  Up: Python 3 11 0 alpha 4\n\n1.22.23.4 Tests\n...............\n\n- bpo-46296(1): Add a test case for *note enum: 51. with 'useargs\n== True' and 'membertype == object'.\n\n- bpo-46205(2): Fix hang in runtestmp due to race condition\n\n- bpo-46263(3): Fix testcapi on FreeBSD 14-dev: instruct jemalloc to\nnot fill freed memory with junk byte.\n\n- bpo-46262(4): Cover 'ValueError' path in tests for\n'enum.Flag.missing()'.\n\n- bpo-46150(5): Now 'fakename' in\n'testpathlib.PosixPathTest.testexpanduser' is checked to be\nnon-existent.\n\n- bpo-46129(6): Rewrite 'asyncio.locks' tests with *note\nunittest.IsolatedAsyncioTestCase: 48b. usage.\n\n- bpo-23819(7): Fixed *note asyncio: 9. tests in python optimized\nmode.  Patch by Kumar Aditya.\n\n- bpo-46114(8): Fix test case for OpenSSL 3.0.1 version.  OpenSSL 3.0\nuses '0xMNN00PP0L'.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=46296\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=46205\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=46263\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=46262\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=46150\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=46129\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=23819\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=46114\n\nFile: python3.12.info,  Node: Build<21>,  Next: Windows<21>,  Prev: Tests<21>,  Up: Python 3 11 0 alpha 4\n\n1.22.23.5 Build\n...............\n\n- bpo-44133(1): When Python is configured with *note\n-without-static-libpython: 69c, the Python static library\n(libpython.a) is no longer built.  Patch by Victor Stinner.\n\n- bpo-44133(2): When Python is built without *note -enable-shared:\n65e, the 'python' program is now linked to object files, rather\nthan being linked to the Python static library (libpython.a), to\nmake sure that all symbols are exported.  Previously, the linker\nomitted some symbols like the 'PyFrozenMain()' function.  Patch by\nVictor Stinner.\n\n- bpo-40280(3): The 'configure' script has a new option\n'--with-emscripten-target' to select browser or node as Emscripten\nbuild target.\n\n- bpo-46315(4): Added and fixed '#ifdef HAVEFEATURE' checks for\nfunctionality that is not available on WASI platform.\n\n- bpo-45723(5): Fixed a regression in 'configure' check for *note\nselect.epoll(): e03.\n\n- bpo-46263(6): 'configure' no longer sets 'MULTIARCH' on FreeBSD\nplatforms.\n\n- bpo-46106(7): Updated OpenSSL to 1.1.1m in Windows builds, macOS\ninstaller builds, and CI. Patch by Kumar Aditya.\n\n- bpo-46088(8): Automatically detect or install bootstrap Python\nruntime when building from Visual Studio.\n\n- bpo-46072(9): Add a -with-pystats configure option to turn on\ninternal statistics gathering.\n\n- bpo-40280(10): A new directory 'Tools/wasm' contains\nWebAssembly-related helpers like 'config.site' override for\nwasm32-emscripten, wasm assets generator to bundle the stdlib, and\na README.\n\n- bpo-46023(11): 'makesetup' no longer builds extensions that have\nbeen marked as 'disabled'.  This allows users to disable modules in\n'Modules/Setup.local'.\n\n- bpo-45949(12): Use pure Python 'freezemodule' for all but\nimportlib bootstrap files.  '--with-freeze-module' 'configure'\noption is no longer needed for cross builds.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=44133\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=44133\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=40280\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=46315\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=45723\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=46263\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=46106\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=46088\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=46072\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=40280\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=46023\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=45949\n\nFile: python3.12.info,  Node: Windows<21>,  Next: macOS<16>,  Prev: Build<21>,  Up: Python 3 11 0 alpha 4\n\n1.22.23.6 Windows\n.................\n\n- bpo-46217(1): Removed parameter that is unsupported on Windows 8.1\nand early Windows 10 and may have caused build or runtime failures.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=46217\n\nFile: python3.12.info,  Node: macOS<16>,  Next: C API<19>,  Prev: Windows<21>,  Up: Python 3 11 0 alpha 4\n\n1.22.23.7 macOS\n...............\n\n- bpo-40477(1): The Python Launcher app for macOS now properly\nlaunches scripts and, if necessary, the Terminal app when running\non recent macOS releases.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40477\n\nFile: python3.12.info,  Node: C API<19>,  Prev: macOS<16>,  Up: Python 3 11 0 alpha 4\n\n1.22.23.8 C API\n...............\n\n- bpo-46236(1): Fix a bug in *note PyFunctionGetAnnotations(): 1511.\nthat caused it to return a 'tuple' instead of a 'dict'.\n\n- bpo-46140(2): *note PyBufferGetPointer(): 542, *note\nPyBufferFromContiguous(): 545, *note PyBufferToContiguous(): 544.\nand *note PyMemoryViewFromBuffer(): 54b. now take buffer info by\n'const Pybuffer *' instead of 'Pybuffer *', as they do not need\nmutability.  *note PyBufferFromContiguous(): 545. also now takes\nthe source buffer as 'const void *', and similarly *note\nPyBufferGetPointer(): 542. takes the strides as 'const Pyssizet\n*'.\n\n- bpo-45855(3): Document that the 'noblock' argument to *note\nPyCapsuleImport(): 15cf. is a no-op now.\n\n- bpo-45855(4): Replaced deprecated usage of *note\nPyImportImportModuleNoBlock(): 324. with *note\nPyImportImportModule(): 325. in stdlib modules.  Patch by Kumar\nAditya.\n\n- bpo-46007(5): The 'PyUnicodeCHECKINTERNED()' macro has been\nexcluded from the limited C API. It was never usable there, because\nit used internal structures which are not available in the limited\nC API. Patch by Victor Stinner.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=46236\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=46140\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=45855\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=45855\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=46007\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 11 0 alpha 3,  Next: Python 3 11 0 alpha 2,  Prev: Python 3 11 0 alpha 4,  Up: Changelog": {
            "content": "'Release date: 2021-12-08'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<24>.\n* Library: Library<24>.\n* Documentation: Documentation<24>.\n* Tests: Tests<22>.\n* Build: Build<22>.\n* Windows: Windows<22>.\n* macOS: macOS<17>.\n* C API: C API<20>.\n\nFile: python3.12.info,  Node: Core and Builtins<24>,  Next: Library<24>,  Up: Python 3 11 0 alpha 3\n\n1.22.24.1 Core and Builtins\n...........................\n\n- bpo-46009(1): Restore behavior from 3.9 and earlier when sending\nnon-None to newly started generator.  In 3.9 this did not affect\nthe state of the generator.  In 3.10.0 and 3.10.1\n'genfunc().send(0)' is equivalent to\n'genfunc().throw(TypeError(...)' which exhausts the generator.  In\n3.10.2 onward, the behavior has been reverted to that of 3.9.\n\n- bpo-46004(2): Fix the *note SyntaxError: 146. location for errors\ninvolving for loops with invalid targets.  Patch by Pablo Galindo\n\n- bpo-45711(3): 'PyErrChainStackItem()' no longer normalizes\n'excinfo' (including setting the traceback on the exception\ninstance) because 'excinfo' is always normalized.\n\n- bpo-45607(4): The 'note' field was added to *note\nBaseException: 37c.  It is 'None' by default but can be set to a\nstring which is added to the exception's traceback.\n\n- bpo-45947(5): Place pointers to dict and values immediately before\nGC header.  This reduces number of dependent memory loads to access\neither dict or values from 3 to 1.\n\n- bpo-45915(6): 'isvalidfd' now uses faster 'fcntl(fd, FGETFD)' on\nLinux, macOS, and Windows.\n\n- bpo-44530(7): Reverts a change to the 'code.new' *note audit\nevent: 15d2. from an earlier prerelease.\n\n- bpo-42268(8): Fail the configure step if the selected compiler\ndoesn't support memory sanitizer.  Patch by Pablo Galindo\n\n- bpo-45711(9): The three values of 'excinfo' are now always\nconsistent with each other.  In particular, the 'type' and\n'traceback' fields are now derived from the exception instance.\nThis impacts the return values of *note sys.excinfo(): 456. and\n*note PyErrGetExcInfo(): 55d. if the exception instance is\nmodified while the exception is handled, as well as *note\nPyErrSetExcInfo(): 55c, which now ignores the 'type' and\n'traceback' arguments provided to it.\n\n- bpo-45727(10): Refine the custom syntax error that suggests that a\ncomma may be missing to trigger only when the expressions are\ndetected between parentheses or brackets.  Patch by Pablo Galindo\n\n- bpo-45885(11): Specialized the 'COMPAREOP' opcode using the PEP\n659 machinery.\n\n- bpo-45786(12): Allocate space for the interpreter frame in the\nframe object, to avoid an additional allocation when the frame\nobject outlives the frame activation.\n\n- bpo-45614(13): Fix *note traceback: f9. display for exceptions with\ninvalid module name.\n\n- bpo-45813(14): Fix crash when calling coro.crframe.clear() after\ncoroutine has been freed.\n\n- bpo-45811(15): Improve the tokenizer errors when encountering\ninvisible control characters in the parser.  Patch by Pablo Galindo\n\n- bpo-45848(16): Allow the parser to obtain error lines directly from\nencoded files.  Patch by Pablo Galindo\n\n- bpo-45709(17): Restore behavior from 3.10 when tracing an exception\nraised within a with statement.\n\n- bpo-44525(18): Adds new *note COPYFREEVARS: 4d1. opcode, to make\ncopying of free variables from function to frame explicit.  Helps\noptimization of calls to Python function.\n\n- bpo-45829(19): Specialize *note BINARYSUBSCR: 1489. for classes\nwith a 'getitem' method implemented in Python\n\n- bpo-45826(20): Fixed a crash when calling '.withtraceback(None)'\non 'NameError'.  This occurs internally in\n'unittest.TestCase.assertRaises()'.\n\n- bpo-45822(21): Fixed a bug in the parser that was causing it to not\nrespect PEP 263(22) coding cookies when no flags are provided.\nPatch by Pablo Galindo\n\n- bpo-45820(23): Fix a segfault when the parser fails without reading\nany input.  Patch by Pablo Galindo\n\n- bpo-45636(24): Simplify the implementation of *note BINARYOP: 4da.\nby indexing into an array of function pointers (rather than\nswitching on the oparg).\n\n- bpo-42540(25): Fix crash when *note os.fork(): 231. is called with\nan active non-default memory allocator.\n\n- bpo-45738(26): Fix computation of error location for invalid\ncontinuation characters in the parser.  Patch by Pablo Galindo.\n\n- bpo-45636(27): Remove an existing \"fast path\" for old-style string\nformatting, since it no longer appears to have any measurable\nimpact.\n\n- bpo-45753(28): Make recursion checks a bit more efficient by\ntracking amount of calls left before overflow.\n\n- bpo-45773(29): Fix a compiler hang when attempting to optimize\ncertain jump patterns.\n\n- bpo-45764(30): The parser now gives a better error message when\nleaving out the opening parenthesis '(' after a 'def'-statement:\n\n>>> def f:\nFile \"<stdin>\", line 1\ndef f:\n^\nSyntaxError: expected '('\n\n- bpo-45609(31): Specialized the 'STORESUBSCR' opcode using the PEP\n659 machinery.\n\n- bpo-45636(32): Replace all numeric 'BINARY*' and 'INPLACE*'\ninstructions with a single *note BINARYOP: 4da. implementation.\n\n- bpo-45582(33): Path calculation (known as 'getpath') has been\nreimplemented as a frozen Python module.  This should have no\nvisible impact, but may affect calculation of all paths referenced\nin *note sys: d3. and *note sysconfig: d5.\n\n- bpo-45450(34): Improve the syntax error message for parenthesized\narguments.  Patch by Pablo Galindo.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=46009\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=46004\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=45711\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=45607\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=45947\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=45915\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=44530\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=42268\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=45711\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=45727\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=45885\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=45786\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=45614\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=45813\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=45811\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=45848\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=45709\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=44525\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=45829\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=45826\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=45822\n\n(22) https://peps.python.org/pep-0263/\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=45820\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=45636\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=42540\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=45738\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=45636\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=45753\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=45773\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=45764\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=45609\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=45636\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=45582\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=45450\n\nFile: python3.12.info,  Node: Library<24>,  Next: Documentation<24>,  Prev: Core and Builtins<24>,  Up: Python 3 11 0 alpha 3\n\n1.22.24.2 Library\n.................\n\n- bpo-27946(1): Fix possible crash when getting an attribute of *note\nxml.etree.ElementTree.Element: 23e. simultaneously with replacing\nthe 'attrib' dict.\n\n- bpo-45711(2): Make *note asyncio: 9. normalize exceptions as soon\nas they are captured with *note PyErrFetch(): 2c7, and before they\nare stored as an excinfo triplet.  This brings *note asyncio: 9.\nin line with the rest of the codebase, where an excinfo triplet is\nalways normalized.\n\n- bpo-23819(3): Replaced asserts with exceptions in asyncio, patch by\nKumar Aditya.\n\n- bpo-13236(4): *note unittest.TextTestResult: 286. and *note\nunittest.TextTestRunner: 148f. flush now the output stream more\noften.\n\n- bpo-45917(5): Added *note math.exp2(): 42a.:, which returns 2\nraised to the power of x.\n\n- bpo-37658(6): Fix issue when on certain conditions\n'asyncio.waitfor()' may allow a coroutine to complete\nsuccessfully, but fail to return the result, potentially causing\nmemory leaks or other issues.\n\n- bpo-45876(7): Improve the accuracy of stdev() and pstdev() in the\nstatistics module.  When the inputs are floats or fractions, the\noutput is a correctly rounded float\n\n- bpo-44649(8): Handle dataclass(slots=True) with a field that has\ndefault a default value, but for which init=False.\n\n- bpo-45803(9): Added missing kwonly parameter to\ndataclasses.makedataclass().\n\n- bpo-45837(10): The 'turtle.RawTurtle.settiltangle()' is deprecated\nsince Python 3.1, it now emits a deprecation warning and will be\nremoved in Python 3.13.\n\nUse 'turtle.RawTurtle.tiltangle()' instead.\n\n'turtle.RawTurtle.tiltangle()' was earlier incorrectly marked as\ndeprecated, its docstring has been corrected.\n\nPatch by Hugo van Kemenade.\n\n- bpo-45831(11): *note faulthandler: 53. can now write ASCII-only\nstrings (like filenames and function names) with a single write()\nsyscall when dumping a traceback.  It reduces the risk of getting\nan unreadable dump when two threads or two processes dump a\ntraceback to the same file (like stderr) at the same time.  Patch\nby Victor Stinner.\n\n- bpo-45828(12): 'sqlite' C callbacks now use unraisable exceptions\nif callback tracebacks are enabled.  Patch by Erlend E. Aasland.\n\n- bpo-41735(13): Fix thread lock in 'zlib.Decompress.flush()' method\nbefore 'PyObjectGetBuffer'.\n\n- bpo-45235(14): Reverted an argparse bugfix that caused regression\nin the handling of default arguments for subparsers.  This\nprevented leaf level arguments from taking precedence over root\nlevel arguments.\n\n- bpo-45754(15): Fix a regression in Python 3.11a1 and 3.11a2 where\n*note sqlite3: c9. incorrectly would use 'SQLITELIMITLENGTH' when\nchecking SQL statement lengths.  Now, 'SQLITELIMITSQLLENGTH' is\nused.  Patch by Erlend E. Aasland.\n\n- bpo-45766(16): Added 'proportional' option to *note\nstatistics.linearregression(): 626.\n\n- bpo-45765(17): In importlib.metadata, fix distribution discovery\nfor an empty path.\n\n- bpo-45757(18): Fix bug where *note dis: 35. produced an incorrect\noparg when *note EXTENDEDARG: 14fa. is followed by an opcode that\ndoes not use its argument.\n\n- bpo-45644(19): In-place JSON file formatting using 'python3 -m\njson.tool infile infile' now works correctly, previously it left\nthe file empty.  Patch by Chris Wesseling.\n\n- bpo-45703(20): When a namespace package is imported before another\nmodule from the same namespace is created/installed in a different\n*note sys.path: 32c. location while the program is running, calling\nthe *note importlib.invalidatecaches(): a56. function will now\nalso guarantee the new module is noticed.\n\n- bpo-45535(21): Improve output of 'dir()' with Enums.\n\n- bpo-45664(22): Fix *note types.resolvebases(): 9df. and *note\ntypes.newclass(): fd6. for *note types.GenericAlias: 5df. instance\nas a base.\n\n- bpo-45663(23): Fix *note dataclasses.isdataclass(): 15d4. for\ndataclasses which are subclasses of *note types.GenericAlias: 5df.\n\n- bpo-45662(24): Fix the repr of 'dataclasses.InitVar' with a type\nalias to the built-in class, e.g.  'InitVar[list[int]]'.\n\n- bpo-43137(25): Launch GNOME web browsers via gio tool instead of\nobsolete gvfs-open\n\n- bpo-45429(26): On Windows, *note time.sleep(): 469. now uses a\nwaitable timer which supports high-resolution timers.  Patch by\nDonghee Na and Eryk Sun.\n\n- bpo-37295(27): Optimize *note math.comb(): 49f. and *note\nmath.perm(): 4a0.\n\n- bpo-45514(28): Deprecated legacy functions in *note\nimportlib.resources: 75.\n\n- bpo-45507(29): Add tests for truncated/missing trailers in\ngzip.decompress implementation.\n\n- bpo-45359(30): Implement PEP 585(31) for *note\ngraphlib.TopologicalSorter: 6fa.\n\n- bpo-44733(32): Add 'maxtasksperchild' to *note\nconcurrent.futures.ProcessPoolExecutor: 707.  This allows users to\nspecify the maximum number of tasks a single process should execute\nbefore the process needs to be restarted.\n\n- bpo-28806(33): Improve netrc library.  netrc file no longer needs\nto contain all tokens.  And if the login name is anonymous,\nsecurity check is no longer need.\n\n- bpo-43498(34): Avoid a possible '\"RuntimeError: dictionary changed\nsize during iteration\"' when adjusting the process count of\n'ProcessPoolExecutor'.\n\n- bpo-42158(35): Add MIME types for N-quads, N-triples, Notation3 and\nTriG to 'mimetypes'.\n\n- bpo-30533(36): Add *note inspect.getmembersstatic(): 412. , it\nreturn all members without triggering dynamic lookup via the\ndescriptor protocol.  Patch by Weipeng Hong.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27946\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=45711\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=23819\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=13236\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=45917\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=37658\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=45876\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=44649\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=45803\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=45837\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=45831\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=45828\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=41735\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=45235\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=45754\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=45766\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=45765\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=45757\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=45644\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=45703\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=45535\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=45664\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=45663\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=45662\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=43137\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=45429\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=37295\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=45514\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=45507\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=45359\n\n(31) https://peps.python.org/pep-0585/\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=44733\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=28806\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=43498\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=42158\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=30533\n\nFile: python3.12.info,  Node: Documentation<24>,  Next: Tests<22>,  Prev: Library<24>,  Up: Python 3 11 0 alpha 3\n\n1.22.24.3 Documentation\n.......................\n\n- bpo-42238(1): 'make -C Doc suspicious' will be removed soon in\nfavor of 'make -C Doc check', mark it as deprecated.\n\n- bpo-45840(2): Improve cross-references in the documentation for the\ndata model.\n\n- bpo-45640(3): Properly marked-up grammar tokens in the\ndocumentation are now clickable and take you to the definition of a\ngiven piece of grammar.  Patch by Arthur Milchior.\n\n- bpo-45788(4): Link doc for sys.prefix to sysconfig doc on\ninstallation paths.\n\n- bpo-45772(5): 'socket.socket' documentation is corrected to a class\nfrom a function.\n\n- bpo-45392(6): Update the docstring of the *note type: ba0. built-in\nto remove a redundant line and to mention keyword arguments for the\nconstructor.\n\n- bpo-45250(7): Update the documentation to note that CPython does\nnot consistently require iterators to define 'iter'.\n\n- bpo-25381(8): In the extending chapter of the extending doc, update\na paragraph about the global variables containing exception\ninformation.\n\n- bpo-43905(9): Expanded *note astuple(): 1475. and *note asdict():\n1465. docs, warning about deepcopy being applied and providing a\nworkaround.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42238\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=45840\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=45640\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=45788\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=45772\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=45392\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=45250\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=25381\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=43905\n\nFile: python3.12.info,  Node: Tests<22>,  Next: Build<22>,  Prev: Documentation<24>,  Up: Python 3 11 0 alpha 3\n\n1.22.24.4 Tests\n...............\n\n- bpo-45695(1): Out-of-tree builds with a read-only source directory\nare now tested by CI.\n\n- bpo-19460(2): Add new Test for\n'Lib/email/mime/nonmultipart.py::MIMENonMultipart'.\n\n- bpo-45835(3): Fix race condition in testqueue tests with multiple\n\"feeder\" threads.\n\n- bpo-45783(4): The test for the freeze tool now handles file moves\nand deletions.\n\n- bpo-45745(5): Remove the '--findleaks' command line option of\nregrtest: use the '--fail-env-changed' option instead.  Since\nPython 3.7, it was a deprecated alias to the '--fail-env-changed'\noption.\n\n- bpo-45701(6): Add tests with 'tuple' type with *note\nfunctools.lrucache(): 815. to 'testfunctools'.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=45695\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=19460\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=45835\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=45783\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=45745\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=45701\n\nFile: python3.12.info,  Node: Build<22>,  Next: Windows<22>,  Prev: Tests<22>,  Up: Python 3 11 0 alpha 3\n\n1.22.24.5 Build\n...............\n\n- bpo-44035(1): CI now verifies that autoconf files have been\nregenerated with a current and unpatched autoconf package.\n\n- bpo-45950(2): The build system now uses a 'bootstrappython'\ninterpreter for freezing and deepfreezing again.  To speed up build\nprocess the build tools 'bootstrappython' and 'freezemodule'\nare no longer build with LTO.\n\n- bpo-45881(3): The 'configure' script now accepts\n'--with-build-python' and '--with-freeze-module' options to make\ncross compiling easier.\n\n- bpo-40280(4): Emscripten platform now uses '.wasm' suffix by\ndefault.\n\n- bpo-40280(5): Disable unusable core extension modules on\nWASM/Emscripten targets.\n\n- bpo-40280(6): 'configure' now checks for socket 'shutdown'\nfunction.  The check makes it possible to disable 'SYSshutdown'\nwith 'accvfuncshutdown=no' in CONFIGSITE.\n\n- bpo-40280(7): 'configure' now checks for functions 'fork1, getegid,\ngeteuid, getgid, getppid, getuid, opendir, pipe, system, wait,\nttyname'.\n\n- bpo-33393(8): Update 'config.guess' to 2021-06-03 and 'config.sub'\nto 2021-08-14.  'Makefile' now has an 'update-config' target to\nmake updating more convenient.\n\n- bpo-45866(9): 'make regen-all' now produces the same output when\nrun from a directory other than the source tree: when building\nPython out of the source tree.  pegen now strips directory of the\n\"generated by pygen from <FILENAME>\" header Patch by Victor\nStinner.\n\n- bpo-40280(10): 'configure' now accepts machine 'wasm32' or 'wasm64'\nand OS 'wasi' or 'emscripten' for cross building, e.g.\n'wasm32-unknown-emscripten', 'wasm32-wasi', or\n'wasm32-unknown-wasi'.\n\n- bpo-41498(11): Python now compiles on platforms without 'sigsett'.\nSeveral functions in *note signal: c1. are not available when\n'sigsett' is missing.\n\nBased on patch by Roman Yurchak for pyodide.\n\n- bpo-45881(12): 'setup.py' now uses 'CC' from environment first to\ndiscover multiarch and cross compile paths.\n\n- bpo-45886(13): The 'freezemodule' program path can now be\noverridden on the command line, e.g.  'make\nFREEZEMODULE=../x8664/Program/freezemodule'.\n\n- bpo-45873(14): Get rid of the 'bootstrappython' build step.  The\ndeepfreeze.py script is now run using '$(PYTHONFORREGEN)' which\ncan be Python 3.7 or newer (on Windows, 3.8 or newer).\n\n- bpo-45847(15): Port builtin hashlib extensions to 'PYSTDLIBMOD'\nmacro and 'addext()'.\n\n- bpo-45723(16): Add 'autoconf' helpers for saving and restoring\nenvironment variables:\n\n* 'SAVEENV': Save '$CFLAGS', '$LDFLAGS', '$LIBS', and\n'$CPPFLAGS'.\n\n* 'RESTOREENV': Restore '$CFLAGS', '$LDFLAGS', '$LIBS', and\n'$CPPFLAGS'.\n\n* 'WITHSAVEENV([SCRIPT])': Run 'SCRIPT' wrapped with\n'SAVEENV' and 'RESTOREENV'.\n\nPatch by Erlend E. Aasland.\n\n- bpo-45573(17): Mandatory core modules, that are required to\nbootstrap Python, are now in 'Modules/Setup.bootstrap'.\n\n- bpo-45573(18): 'configure' now creates 'Modules/Setup.stdlib' with\nconditionally enabled/disabled extension module lines.  The file is\nnot used, yet.\n\n- bpo-45573(19): 'configure' now uses a unified format to set state,\ncompiler flags, and linker flags in Makefile.  The new macro\n'PYSTDLIBMOD' sets three variables that are consumed by\n'Modules/Setup' and 'setup.py'.\n\n- bpo-45816(20): Python now supports building with Visual Studio 2022\n(MSVC v143, VS Version 17.0).  Patch by Jeremiah Vivian.\n\n- bpo-45800(21): Settings for 'pyexpat' C extension are now detected\nby 'configure'.  The bundled 'expat' library is built in\n'Makefile'.\n\n- bpo-45798(22): Settings for *note decimal: 33. internal C extension\nare now detected by 'configure'.  The bundled 'libmpdec' library is\nbuilt in 'Makefile'.\n\n- bpo-45723(23): 'configure' has a new option '--with-pkg-config' to\ndisable or require pkg-config.\n\n- bpo-45774(24): The build dependencies for *note sqlite3: c9. are\nnow detected by 'configure' and 'pkg-config'.  Patch by Erlend E.\nAasland.\n\n- bpo-45763(25): The build dependencies for *note zlib: 12d, *note\nbz2: 11, and *note lzma: 85. are now detected by 'configure'.\n\n- bpo-45747(26): gdbm and dbm build dependencies are now detected by\n'configure'.\n\n- bpo-45743(27): On macOS, the build system no longer passes\n'searchpathsfirst' to the linker.  The flag has been the default\nsince Xcode 4 / macOS 10.6.\n\n- bpo-45723(28): 'configure.ac' is now compatible with autoconf 2.71.\nDeprecated checks 'STDCHEADERS' and 'ACHEADERTIME' have been\nremoved.\n\n- bpo-45723(29): 'configure' now prints a warning when pkg-config is\nmissing.\n\n- bpo-45731(30): 'configure --enable-loadable-sqlite-extensions' is\nnow handled by new 'PYSQLITEENABLELOADEXTENSION' macro instead\nof logic in setup.py.\n\n- bpo-45723(31): configure.ac now uses custom helper macros and\n'ACCACHECHECK' to simplify and speed up configure runs.\n\n- bpo-45696(32): Skip the marshal step for frozen modules by\ngenerating C code that produces a set of ready-to-use code objects.\nThis speeds up startup time by another 10% or more.\n\n- bpo-45561(33): Run smelly.py tool from $(srcdir).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=44035\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=45950\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=45881\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=40280\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=40280\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=40280\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=40280\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=33393\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=45866\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=40280\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=41498\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=45881\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=45886\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=45873\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=45847\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=45723\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=45573\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=45573\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=45573\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=45816\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=45800\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=45798\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=45723\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=45774\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=45763\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=45747\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=45743\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=45723\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=45723\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=45731\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=45723\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=45696\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=45561\n\nFile: python3.12.info,  Node: Windows<22>,  Next: macOS<17>,  Prev: Build<22>,  Up: Python 3 11 0 alpha 3\n\n1.22.24.6 Windows\n.................\n\n- bpo-46105(1): Fixed calculation of *note sys.path: 32c. in a venv\non Windows.\n\n- bpo-45901(2): When installed through the Microsoft Store and set as\nthe default app for '*.py' files, command line arguments will now\nbe passed to Python when invoking a script without explicitly\nlaunching Python (that is, 'script.py args' rather than 'python\nscript.py args').\n\n- bpo-45616(3): Fix Python Launcher's ability to distinguish between\nversions 3.1 and 3.10 when either one is explicitly requested.\nPreviously, 3.1 would be used if 3.10 was requested but not\ninstalled, and 3.10 would be used if 3.1 was requested but 3.10 was\ninstalled.\n\n- bpo-45850(4): Implement changes to build with deep-frozen modules\non Windows.  Note that we now require Python 3.10 as the\n\"bootstrap\" or \"host\" Python.\n\n- bpo-45732(5): Updates bundled Tcl/Tk to 8.6.12.\n\n- bpo-45720(6): Internal reference to 'shlwapi.dll' was dropped to\nhelp improve startup time.  This DLL will no longer be loaded at\nthe start of every Python process.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=46105\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=45901\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=45616\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=45850\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=45732\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=45720\n\nFile: python3.12.info,  Node: macOS<17>,  Next: C API<20>,  Prev: Windows<22>,  Up: Python 3 11 0 alpha 3\n\n1.22.24.7 macOS\n...............\n\n- bpo-45732(1): Update python.org macOS installer to use Tcl/Tk\n8.6.12.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=45732\n\nFile: python3.12.info,  Node: C API<20>,  Prev: macOS<17>,  Up: Python 3 11 0 alpha 3\n\n1.22.24.8 C API\n...............\n\n- bpo-39026(1): Fix Python.h to build C extensions with Xcode: remove\na relative include from 'Include/cpython/pystate.h'.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39026\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 11 0 alpha 2,  Next: Python 3 11 0 alpha 1,  Prev: Python 3 11 0 alpha 3,  Up: Changelog": {
            "content": "'Release date: 2021-11-05'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<25>.\n* Library: Library<25>.\n* Documentation: Documentation<25>.\n* Tests: Tests<23>.\n* Build: Build<23>.\n* Windows: Windows<23>.\n* macOS: macOS<18>.\n* IDLE: IDLE<11>.\n* C API: C API<21>.\n\nFile: python3.12.info,  Node: Core and Builtins<25>,  Next: Library<25>,  Up: Python 3 11 0 alpha 2\n\n1.22.25.1 Core and Builtins\n...........................\n\n- bpo-45716(1): Improve the *note SyntaxError: 146. message when\nusing 'True', 'None' or 'False' as keywords in a function call.\nPatch by Pablo Galindo.\n\n- bpo-45688(2): *note sys.stdlibmodulenames: 637. now contains the\nmacOS-specific module 'scproxy'.\n\n- bpo-45379(3): Clarify *note ImportError: 145. message when we try\nto explicitly import a frozen module but frozen modules are\ndisabled.\n\n- bpo-44525(4): Specialize simple calls to Python functions (no\nstarargs, keyowrd dict, or closure)\n\n- bpo-45530(5): Cases of sorting using tuples as keys may now be\nsignificantly faster in some cases.  Patch by Tim Peters.\n\nThe order of the result may differ from earlier releases if the\ntuple elements don't define a total ordering (see *note Value\ncomparisons: 15dd. for information on total ordering).  It's\ngenerally true that the result of sorting simply isn't well-defined\nin the absence of a total ordering on list elements.\n\n- bpo-45526(6): In obmalloc, set ADDRESSBITS to not ignore any bits\n(ignored 16 before).  That is safer in the case that the kernel\ngives user-space virtual addresses that span a range greater than\n48 bits.\n\n- bpo-30570(7): Fixed a crash in 'issubclass()' from infinite\nrecursion when searching pathological 'bases' tuples.\n\n- bpo-45521(8): Fix a bug in the obmalloc radix tree code.  On 64-bit\nmachines, the bug causes the tree to hold 46-bits of virtual\naddresses, rather than the intended 48-bits.\n\n- bpo-45494(9): Fix parser crash when reporting errors involving\ninvalid continuation characters.  Patch by Pablo Galindo.\n\n- bpo-45445(10): Python now fails to initialize if it finds an\ninvalid *note -X: 188. option in the command line.  Patch by Pablo\nGalindo.\n\n- bpo-45340(11): Object attributes are held in an array instead of a\ndictionary.  An object's dictionary are created lazily, only when\nneeded.  Reduces the memory consumption of a typical Python object\nby about 30%.  Patch by Mark Shannon.\n\n- bpo-45408(12): Fix a crash in the parser when reporting tokenizer\nerrors that occur at the same time unclosed parentheses are\ndetected.  Patch by Pablo Galindo.\n\n- bpo-29410(13): Add SipHash13 for string hash algorithm and use it\nby default.\n\n- bpo-45385(14): Fix reference leak from descrcheck.  Patch by\nDonghee Na.\n\n- bpo-45367(15): Specialized the 'BINARYMULTIPLY' opcode to\n'BINARYMULTIPLYINT' and 'BINARYMULTIPLYFLOAT' using the PEP 659\nmachinery.\n\n- bpo-21736(16): Frozen stdlib modules now have 'file' to the .py\nfile they would otherwise be loaded from, if possible.  For\npackages, 'path' now has the correct entry instead of being an\nempty list, which allows unfrozen submodules to be imported.  These\nare set only if the stdlib directory is known when the runtime is\ninitialized.  Note that the file at 'file' is not guaranteed to\nexist.  None of this affects non-stdlib frozen modules nor, for\nnow, frozen modules imported using 'PyImportImportFrozenModule()'.\nAlso, at the moment 'cofilename' is not updated for the module.\n\n- bpo-45020(17): For frozen stdlib modules, record the original\nmodule name as 'module.spec.loaderstate.origname'.  If the\nvalue is different than 'module.spec.name' then the module was\ndefined as an alias in Tools/scripts/freezemodules.py.  If it is\n'None' then the module comes from a source file outside the stdlib.\n\n- bpo-45324(18): In FrozenImporter.findspec(), we now preserve the\ninformation needed in execmodule() to load the module.  This\nchange mostly impacts internal details, rather than changing the\nimporter's behavior.\n\n- bpo-45292(19): Implement PEP 654(20).  Add *note ExceptionGroup:\n17b. and *note BaseExceptionGroup: 377.  Update traceback display\ncode.\n\n- bpo-40116(21): Change to the implementation of split dictionaries.\nClasses where the instances differ either in the exact set of\nattributes, or in the order in which those attributes are set, can\nstill share keys.  This should have no observable effect on users\nof Python or the C-API. Patch by Mark Shannon.\n\n- bpo-44050(22): Extensions that indicate they use global state (by\nsetting 'msize' to -1) can again be used in multiple interpreters.\nThis reverts to behavior of Python 3.8.\n\n- bpo-44525(23): Setup initial specialization infrastructure for the\n'CALLFUNCTION' opcode.  Implemented initial specializations for C\nfunction calls:\n\n* 'CALLFUNCTIONBUILTINO' for 'METHO' flag.\n\n* 'CALLFUNCTIONBUILTINFAST' for 'METHFASTCALL' flag without\nkeywords.\n\n* 'CALLFUNCTIONLEN' for 'len(o)'.\n\n* 'CALLFUNCTIONISINSTANCE' for 'isinstance(o, t)'.\n\n- bpo-44511(24): Improve the generated bytecode for class and mapping\npatterns.\n\n- bpo-43706(25): Speed up calls to 'enumerate()' by using the PEP\n590(26) 'vectorcall' calling convention.  Patch by Donghee Na.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=45716\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=45688\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=45379\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=44525\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=45530\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=45526\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=30570\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=45521\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=45494\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=45445\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=45340\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=45408\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=29410\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=45385\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=45367\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=21736\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=45020\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=45324\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=45292\n\n(20) https://peps.python.org/pep-0654/\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=40116\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=44050\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=44525\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=44511\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=43706\n\n(26) https://peps.python.org/pep-0590/\n\nFile: python3.12.info,  Node: Library<25>,  Next: Documentation<25>,  Prev: Core and Builtins<25>,  Up: Python 3 11 0 alpha 2\n\n1.22.25.2 Library\n.................\n\n- bpo-45679(1): Fix caching of multi-value *note typing.Literal: 64b.\n'Literal[True, 2]' is no longer equal to 'Literal[1, 2]'.\n\n- bpo-42064(2): Convert *note sqlite3: c9. to multi-phase\ninitialisation (PEP 489).  Patches by Erlend E. Aasland.\n\n- bpo-45438(3): Fix typing.Signature string representation for\ngeneric builtin types.\n\n- bpo-45613(4): *note sqlite3: c9. now sets *note\nsqlite3.threadsafety: 447. based on the default threading mode the\nunderlying SQLite library has been compiled with.  Patch by Erlend\nE. Aasland.\n\n- bpo-45574(5): Fix warning about 'printescape' being unused.\n\n- bpo-45581(6): *note sqlite3.connect(): 1da. now correctly raises\n*note MemoryError: 13e3. if the underlying SQLite API signals\nmemory error.  Patch by Erlend E. Aasland.\n\n- bpo-45557(7): pprint.pprint() now handles underscorenumbers\ncorrectly.  Previously it was always setting it to False.\n\n- bpo-44019(8): Add *note operator.call(): 15df. to\n'operator.all'.  Patch by Kreusada.\n\n- bpo-42174(9): *note shutil.getterminalsize(): f73. now falls back\nto sane values if the column or line count are 0.\n\n- bpo-35673(10): Improve the introspectability of the 'loader'\nattribute for namespace packages.  *note\nimportlib.machinery.NamespaceLoader: dc6. is now public, and\nimplements the *note importlib.abc.InspectLoader: dc4. interface.\n'NamespaceLoader' is kept for backward compatibility.\n\n- bpo-45515(11): Add references to *note zoneinfo: 12e. in the *note\ndatetime: 2e. documentation, mostly replacing outdated references\nto 'dateutil.tz'.  Change by Paul Ganssle.\n\n- bpo-45475(12): Reverted optimization of iterating *note\ngzip.GzipFile: 25e, *note bz2.BZ2File: 775, and *note\nlzma.LZMAFile: e80. (see bpo-43787(13)) because it caused\nregression when user iterate them without having reference of them.\nPatch by Inada Naoki.\n\n- bpo-45489(14): Update *note ForwardRef: 15a6. to support '|'\noperator.  Patch by Donghee Na.\n\n- bpo-42222(15): Removed deprecated support for float arguments in\n'randrange()'.\n\n- bpo-45428(16): Fix a regression in pycompile when reading\nfilenames from standard input.\n\n- bpo-45467(17): Fix incremental decoder and stream reader in the\n\"raw-unicode-escape\" codec.  Previously they failed if the escape\nsequence was split.\n\n- bpo-45461(18): Fix incremental decoder and stream reader in the\n\"unicode-escape\" codec.  Previously they failed if the escape\nsequence was split.\n\n- bpo-45239(19): Fixed *note email.utils.parsedatetz(): 15e0.\ncrashing with *note UnboundLocalError: 1390. on certain invalid\ninput instead of returning 'None'.  Patch by Ben Hoyt.\n\n- bpo-45417(20): Fix quadratic behaviour in the enum module: Creation\nof enum classes with a lot of entries was quadratic.\n\n- bpo-45249(21): Fix the behaviour of *note traceback.printexc():\n15e1. when displaying the caret when the 'endoffset' in the\nexception is set to 0.  Patch by Pablo Galindo\n\n- bpo-45416(22): Fix use of *note asyncio.Condition: 8a1. with\nexplicit *note asyncio.Lock: 89f. objects, which was a regression\ndue to removal of explicit loop arguments.  Patch by Joongi Kim.\n\n- bpo-20028(23): Empty escapechar/quotechar is not allowed when\ninitializing *note csv.Dialect: 15e2.  Patch by Vajrasky Kok and\nDonghee Na.\n\n- bpo-44904(24): Fix bug in the *note doctest: 36. module that caused\nit to fail if a docstring included an example with a 'classmethod'\n'property'.  Patch by Alex Waygood.\n\n- bpo-45406(25): Make *note inspect.getmodule(): 1541. catch\n'FileNotFoundError' raised by 'inspect.getabsfile()', and return\n'None' to indicate that the module could not be determined.\n\n- bpo-45411(26): Add extensions for files containing subtitles - .srt\n& .vtt - to the mimetypes.py module.\n\n- bpo-10716(27): Migrated pydoc to HTML5 (without changing the look\nof it).  Side effect is to update xmlrpc's 'ServerHTMLDoc' which\nnow uses the CSS too.  cgitb now relies less on pydoc (as it can't\nuse the CSS file).\n\n- bpo-27580(28): Add support of null characters in *note csv: 27.\n\n- bpo-45262(29): Prevent use-after-free in asyncio.  Make sure the\ncached running loop holder gets cleared on dealloc to prevent\nuse-after-free in getrunningloop\n\n- bpo-45386(30): Make *note xmlrpc.client: 128. more robust to C\nruntimes where the underlying C 'strftime' function results in a\n'ValueError' when testing for year formatting options.\n\n- bpo-20028(31): Improve error message of *note csv.Dialect: 15e2.\nwhen initializing.  Patch by Vajrasky Kok and Donghee Na.\n\n- bpo-45343(32): Update bundled pip to 21.2.4 and setuptools to\n58.1.0\n\n- bpo-45328(33): Fixed *note http.client.HTTPConnection: 97a. to work\nproperly in OSs that don't support the 'TCPNODELAY' socket option.\n\n- bpo-45243(34): Add *note setlimit(): 445. and *note getlimit():\n446. to *note sqlite3.Connection: 1d9. for setting and getting\nSQLite limits by connection basis.  Patch by Erlend E. Aasland.\n\n- bpo-45320(35): Removed from the *note inspect: 78. module:\n\n*\nthe 'getargspec' function, deprecated since Python 3.0;\n\nuse *note inspect.signature(): 51c. or *note\ninspect.getfullargspec(): 51d. instead.\n\n* the 'formatargspec' function, deprecated since Python 3.5; use\nthe *note inspect.signature(): 51c. function and 'Signature'\nobject directly.\n\n* the undocumented 'Signature.frombuiltin' and\n'Signature.fromfunction' functions, deprecated since Python\n3.5; use the *note Signature.fromcallable(): 51f. method\ninstead.\n\nPatch by Hugo van Kemenade.\n\n- bpo-45192(36): Fix the 'tempfile.inferreturntype' function so\nthat the 'dir' argument of the *note tempfile: da. functions\naccepts an object implementing the 'os.PathLike' protocol.\n\nPatch by Kyungmin Lee.\n\n- bpo-45160(37): When tracing a tkinter variable used by a ttk\nOptionMenu, callbacks are no longer made twice.\n\n- bpo-25625(38): Added non parallel-safe *note chdir(): 3d7. context\nmanager to change the current working directory and then restore it\non exit.  Simple wrapper around *note chdir(): 3d8.\n\n- bpo-24139(39): Add support for SQLite extended result codes in\n*note sqlite3.Error: 15e3.  Patch by Erlend E. Aasland.\n\n- bpo-24444(40): Fixed an error raised in *note argparse: 6. help\ndisplay when help for an option is set to 1+ blank spaces or when\n'choices' arg is an empty container.\n\n- bpo-44547(41): Implement 'Fraction.int', so that a *note\nfractions.Fraction: 1a8. instance 'f' passes an 'isinstance(f,\ntyping.SupportsInt)' check.\n\n- bpo-40321(42): Adds support for HTTP 308 redirects to *note urllib:\n103.  See RFC 7538(43) for details.  Patch by Jochem\nSchulenklopper.\n\n- bpo-41374(44): Ensure that 'socket.TCP*' constants are exposed on\nCygwin 3.1.6 and greater.\n\n- bpo-35970(45): Add help flag to the base64 module's command line\ninterface.  Patch contributed by Robert Kuska.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=45679\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=42064\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=45438\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=45613\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=45574\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=45581\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=45557\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=44019\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=42174\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=35673\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=45515\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=45475\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=43787\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=45489\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=42222\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=45428\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=45467\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=45461\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=45239\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=45417\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=45249\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=45416\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=20028\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=44904\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=45406\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=45411\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=10716\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=27580\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=45262\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=45386\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=20028\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=45343\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=45328\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=45243\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=45320\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=45192\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=45160\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=25625\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=24139\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=24444\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=44547\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=40321\n\n(43) https://datatracker.ietf.org/doc/html/rfc7538.html\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=41374\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=35970\n\nFile: python3.12.info,  Node: Documentation<25>,  Next: Tests<23>,  Prev: Library<25>,  Up: Python 3 11 0 alpha 2\n\n1.22.25.3 Documentation\n.......................\n\n- bpo-45726(1): Improve documentation for *note\nfunctools.singledispatch(): 406. and *note\nfunctools.singledispatchmethod: 816.\n\n- bpo-45680(2): Amend the docs on 'GenericAlias' objects to clarify\nthat non-container classes can also implement 'classgetitem'.\nPatch contributed by Alex Waygood.\n\n- bpo-45618(3): Update Sphinx version used to build the documentation\nto 4.2.0.  Patch by Maciej Olko.\n\n- bpo-45655(4): Add a new \"relevant PEPs\" section to the top of the\ndocumentation for the 'typing' module.  Patch by Alex Waygood.\n\n- bpo-45604(5): Add 'level' argument to\n'multiprocessing.logtostderr' function docs.\n\n- bpo-45516(6): Add protocol description to the *note\nimportlib.abc.TraversableResources: 15e5. documentation.\n\n- bpo-45464(7): Mention in the documentation of *note Built-in\nExceptions: 15e6. that inheriting from multiple exception types in\na single subclass is not recommended due to possible memory layout\nincompatibility.\n\n- bpo-45449(8): Add note about PEP 585(9) in *note collections.abc:\n1c.\n\n- bpo-45516(10): Add protocol description to the *note\nimportlib.abc.Traversable: 15e7. documentation.\n\n- bpo-20692(11): Add Programming FAQ entry explaining that int\nliteral attribute access requires either a space after or\nparentheses around the literal.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=45726\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=45680\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=45618\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=45655\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=45604\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=45516\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=45464\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=45449\n\n(9) https://peps.python.org/pep-0585/\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=45516\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=20692\n\nFile: python3.12.info,  Node: Tests<23>,  Next: Build<23>,  Prev: Documentation<25>,  Up: Python 3 11 0 alpha 2\n\n1.22.25.4 Tests\n...............\n\n- bpo-45678(1): Add tests for scenarios in which *note\nfunctools.singledispatchmethod: 816. is stacked on top of a method\nthat has already been wrapped by two other decorators.  Patch by\nAlex Waygood.\n\n- bpo-45578(2): Add tests for *note dis.distb(): d9a.\n\n- bpo-45678(3): Add tests to ensure that\n'functools.singledispatchmethod' correctly wraps the attributes of\nthe target function.\n\n- bpo-45668(4): PGO tests now pass when Python is built without test\nextension modules.\n\n- bpo-45577(5): Add subtests for all 'pickle' protocols in\n'testzoneinfo'.\n\n- bpo-45566(6): Fix 'testfrozenpickle' in 'testdataclasses' to\ncheck all 'pickle' versions.\n\n- bpo-43592(7): 'test.libregrtest' now raises the soft resource limit\nfor the maximum number of file descriptors when the default is too\nlow for our test suite as was often the case on macOS.\n\n- bpo-39679(8): Add more test cases for\n'@functools.singledispatchmethod' when combined with '@classmethod'\nor '@staticmethod'.\n\n- bpo-45410(9): When libregrtest spawns a worker process, stderr is\nnow written into stdout to keep messages order.  Use a single pipe\nfor stdout and stderr, rather than two pipes.  Previously, messages\nwere out of order which made analysis of buildbot logs harder Patch\nby Victor Stinner.\n\n- bpo-45402(10): Fix testtools.testsundry() when Python is built\nout of tree: fix how the freezemodules.py tool locates the\nfreezemodule program.  Patch by Victor Stinner.\n\n- bpo-45403(11): Fix testsys.teststdlibdir() when Python is built\noutside the source tree: compare normalized paths.  Patch by Victor\nStinner.\n\n- bpo-45400(12): Fix\ntestnameerrorsuggestionsdonottriggerfortoomanylocals() of\ntestexceptions if a directory name contains \"a1\" (like\n\"Python-3.11.0a1\"): use a stricter regular expression.  Patch by\nVictor Stinner.\n\n- bpo-10572(13): Rename *note sqlite3: c9. tests from 'testsqlite'\nto 'testsqlite3', and relocate them to 'Lib/test/testsqlite3'.\nPatch by Erlend E. Aasland.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=45678\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=45578\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=45678\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=45668\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=45577\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=45566\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=43592\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=39679\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=45410\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=45402\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=45403\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=45400\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=10572\n\nFile: python3.12.info,  Node: Build<23>,  Next: Windows<23>,  Prev: Tests<23>,  Up: Python 3 11 0 alpha 2\n\n1.22.25.5 Build\n...............\n\n- bpo-43158(1): 'setup.py' now uses values from configure script to\nbuild the 'uuid' extension module.  Configure now detects\nutil-linux's 'libuuid', too.\n\n- bpo-45666(2): Fix warning of 'swprintf' and '%s' usage in\n'testembed.c'\n\n- bpo-45548(3): 'Modules/Setup' and 'Modules/makesetup' have been\nimproved.  The 'Setup' file now contains working rules for all\nextensions.  Outdated comments have been removed.  Rules defined by\n'makesetup' track dependencies correctly.\n\n- bpo-45548(4): The *note math: 89. and *note cmath: 16.\nimplementation now require a C99 compatible 'libm' and no longer\nship with workarounds for missing acosh, asinh, atanh, expm1, and\nlog1p functions.\n\n- bpo-45595(5): 'setup.py' and 'makesetup' now track build\ndependencies on all Python header files and module specific header\nfiles.\n\n- bpo-45571(6): 'Modules/Setup' now use 'PYCFLAGSNODIST' instead of\n'PYCFLAGS' to compile shared modules.\n\n- bpo-45570(7): 'pyexpat' and 'elementtree' no longer define\nobsolete macros 'HAVEEXPATCONFIGH' and 'USEPYEXPATCAPI'.\n'XMLPOORENTROPY' is now defined in 'expatconfig.h'.\n\n- bpo-43974(8): 'setup.py' no longer defines 'PyBUILDCOREMODULE'.\nInstead every module, that uses the internal API, defines the\nmacro.\n\n- bpo-45548(9): Fill in missing entries in Modules/Setup.\n\n- bpo-45532(10): Update *note sys.version: b70. to use 'main' as\nfallback information.  Patch by Jeong YunWon.\n\n- bpo-45536(11): The 'configure' script now checks whether OpenSSL\nheaders and libraries provide required APIs.  Most common APIs are\nverified.  The check detects outdated or missing OpenSSL. Failures\ndo not stop configure.\n\n- bpo-45221(12): Fixed regression in handling of 'LDFLAGS' and\n'CPPFLAGS' options where 'argparse.parseknownargs()' could\ninterpret an option as one of the built-in command line argument,\nfor example '-h' for help.\n\n- bpo-45440(13): Building Python now requires a C99 '<math.h>' header\nfile providing the following functions: 'copysign()', 'hypot()',\n'isfinite()', 'isinf()', 'isnan()', 'round()'.  Patch by Victor\nStinner.\n\n- bpo-45405(14): Prevent 'internal configure error' when running\n'configure' with recent versions of non-Apple clang.  Patch by\nDavid Bohman.\n\n- bpo-45433(15): Avoid linking libpython with libcrypt.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43158\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=45666\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=45548\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=45548\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=45595\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=45571\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=45570\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=43974\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=45548\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=45532\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=45536\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=45221\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=45440\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=45405\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=45433\n\nFile: python3.12.info,  Node: Windows<23>,  Next: macOS<18>,  Prev: Build<23>,  Up: Python 3 11 0 alpha 2\n\n1.22.25.6 Windows\n.................\n\n- bpo-43652(1): Update Tcl/Tk to 8.6.11, actually this time.  The\nprevious update incorrectly included 8.6.10.\n\n- bpo-45337(2): venv now warns when the created environment may need\nto be accessed at a different path, due to redirections, links or\njunctions.  It also now correctly installs or upgrades components\nwhen the alternate path is required.\n\n- bpo-43851(3): Build SQLite 'SQLITEOMITAUTOINIT' on Windows.\nPatch by Erlend E. Aasland.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43652\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=45337\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=43851\n\nFile: python3.12.info,  Node: macOS<18>,  Next: IDLE<11>,  Prev: Windows<23>,  Up: Python 3 11 0 alpha 2\n\n1.22.25.7 macOS\n...............\n\n- bpo-44828(1): Avoid tkinter file dialog failure on macOS 12\nMonterey when using the Tk 8.6.11 provided by python.org macOS\ninstallers.  Patch by Marc Culler of the Tk project.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=44828\n\nFile: python3.12.info,  Node: IDLE<11>,  Next: C API<21>,  Prev: macOS<18>,  Up: Python 3 11 0 alpha 2\n\n1.22.25.8 IDLE\n..............\n\n- bpo-45495(1): Add context keywords 'case' and 'match' to\ncompletions list.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=45495\n\nFile: python3.12.info,  Node: C API<21>,  Prev: IDLE<11>,  Up: Python 3 11 0 alpha 2\n\n1.22.25.9 C API\n...............\n\n- bpo-29103(1): *note PyTypeFromSpec*: 2aa. now copies the class\nname from the spec to a buffer owned by the class, so the original\ncan be safely deallocated.  Patch by Petr Viktorin.\n\n- bpo-45522(2): The internal freelists for frame, float, list, dict,\nasync generators, and context objects can now be disabled.\n\n- bpo-35134(3): Exclude *note PyWeakrefGETOBJECT(): 58c. from the\nlimited C API. It never worked since the 'PyWeakReference'\nstructure is opaque in the limited C API.\n\n- bpo-35081(4): Move the 'interpreteridobject.h' header file from\n'Include/' to 'Include/internal/'.  It only provides private\nfunctions.  Patch by Victor Stinner.\n\n- bpo-35134(5): The non-limited API files 'cellobject.h',\n'classobject.h', 'context.h', 'funcobject.h', 'genobject.h' and\n'longintrepr.h' have been moved to the 'Include/cpython' directory.\nMoreover, the 'eval.h' header file was removed.  These files must\nnot be included directly, as they are already included in\n'Python.h': *note Include Files: 56f.  If they have been included\ndirectly, consider including 'Python.h' instead.  Patch by Victor\nStinner.\n\n- bpo-45474(6): The following items are no longer available when\n'PyLIMITEDAPI' is defined:\n\n* *note PyMarshalWriteLongToFile(): 587.\n\n* *note PyMarshalWriteObjectToFile(): 588.\n\n* *note PyMarshalReadObjectFromString(): 589.\n\n* *note PyMarshalWriteObjectToString(): 58a.\n\n* the 'PyMARSHALVERSION' macro\n\nThese are not part of the *note limited API: 58b.\n\nPatch by Victor Stinner.\n\n- bpo-45434(7): Remove the 'pystrhex.h' header file.  It only\ncontains private functions.  C extensions should only include the\nmain '<Python.h>' header file.  Patch by Victor Stinner.\n\n- bpo-45440(8): Remove the 'PyFORCEDOUBLE()' macro.  It was used by\nthe 'PyISINFINITY()' macro.  Patch by Victor Stinner.\n\n- bpo-45434(9): '<Python.h>' no longer includes the header files\n'<stdlib.h>', '<stdio.h>', '<errno.h>' and '<string.h>' when the\n'PyLIMITEDAPI' macro is set to '0x030b0000' (Python 3.11) or\nhigher.  C extensions should explicitly include the header files\nafter '#include <Python.h>'.  Patch by Victor Stinner.\n\n- bpo-41123(10): Remove 'PyUNICODECOPY()' and 'PyUNICODEFILL()'\nmacros, deprecated since Python 3.3.  Use\n'PyUnicodeCopyCharacters()' or 'memcpy()' ('wchart*' string), and\n'PyUnicodeFill()' functions instead.  Patch by Victor Stinner.\n\n- bpo-45412(11): Remove the following math macros using the 'errno'\nvariable:\n\n* 'PyADJUSTERANGE1()'\n\n* 'PyADJUSTERANGE2()'\n\n* 'PyOVERFLOWED()'\n\n* 'PySETERANGEIFOVERFLOW()'\n\n* 'PySETERRNOONMATHERROR()'\n\nPatch by Victor Stinner.\n\n- bpo-45395(12): Custom frozen modules (the array set to\n'PyImportFrozenModules') are now treated as additions, rather than\nreplacing all the default frozen modules.  Frozen stdlib modules\ncan still be disabled by setting the \"code\" field of the custom\narray entry to NULL.\n\n- bpo-43760(13): Add new *note PyThreadStateEnterTracing(): 53b, and\n*note PyThreadStateLeaveTracing(): 53c. functions to the limited C\nAPI to suspend and resume tracing and profiling.  Patch by Victor\nStinner.\n\n- bpo-44220(14): *note PyStructSequenceUnnamedField: 7a6. is added\nto the Stable ABI.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=29103\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=45522\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=35134\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=35081\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=35134\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=45474\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=45434\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=45440\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=45434\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=41123\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=45412\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=45395\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=43760\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=44220\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 11 0 alpha 1,  Next: Python 3 10 0 beta 1,  Prev: Python 3 11 0 alpha 2,  Up: Changelog": {
            "content": "'Release date: 2021-10-05'\n\n* Menu:\n\n* Security: Security<14>.\n* Core and Builtins: Core and Builtins<26>.\n* Library: Library<26>.\n* Documentation: Documentation<26>.\n* Tests: Tests<24>.\n* Build: Build<24>.\n* Windows: Windows<24>.\n* macOS: macOS<19>.\n* IDLE: IDLE<12>.\n* Tools/Demos: Tools/Demos<14>.\n* C API: C API<22>.\n\nFile: python3.12.info,  Node: Security<14>,  Next: Core and Builtins<26>,  Up: Python 3 11 0 alpha 1\n\n1.22.26.1 Security\n..................\n\n- bpo-42278(1): Replaced usage of *note tempfile.mktemp(): 15f0. with\n*note TemporaryDirectory: 10aa. to avoid a potential race\ncondition.\n\n- bpo-44600(2): Fix incorrect line numbers while tracing some failed\npatterns in *note match: 601. statements.  Patch by Charles\nBurkland.\n\n- bpo-41180(3): Add auditing events to the *note marshal: 88. module,\nand stop raising 'code.init' events for every unmarshalled code\nobject.  Directly instantiated code objects will continue to raise\nan event, and audit event handlers should inspect or collect the\nraw marshal data.  This reduces a significant performance overhead\nwhen loading from '.pyc' files.\n\n- bpo-44394(4): Update the vendored copy of libexpat to 2.4.1 (from\n2.2.8) to get the fix for the CVE-2013-0340 \"Billion Laughs\"\nvulnerability.  This copy is most used on Windows and macOS.\n\n- bpo-43124(5): Made the internal 'putcmd' function in *note smtplib:\nc4. sanitize input for presence of '\\r' and '\\n' characters to\navoid (unlikely) command injection.\n\n- bpo-44022(6): *note http.client: 6a. now avoids infinitely reading\npotential HTTP headers after a '100 Continue' status response from\nthe server.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42278\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=44600\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=41180\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=44394\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=43124\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=44022\n\nFile: python3.12.info,  Node: Core and Builtins<26>,  Next: Library<26>,  Prev: Security<14>,  Up: Python 3 11 0 alpha 1\n\n1.22.26.2 Core and Builtins\n...........................\n\n- bpo-43760(1): The number of hardware branches per instruction\ndispatch is reduced from two to one by adding a special instruction\nfor tracing.  Patch by Mark Shannon.\n\n- bpo-45061(2): Add a deallocator to the bool type to detect refcount\nbugs in C extensions which call PyDECREF(PyTrue) or\nPyDECREF(PyFalse) by mistake.  Detect also refcount bugs when the\nempty tuple singleton or the Unicode empty string singleton is\ndestroyed by mistake.  Patch by Victor Stinner.\n\n- bpo-24076(3): sum() was further optimised for summing up single\ndigit integers.\n\n- bpo-45190(4): Update Unicode databases to Unicode 14.0.0.\n\n- bpo-45167(5): Fix deepcopying of *note types.GenericAlias: 5df.\nobjects.\n\n- bpo-45155(6): *note int.tobytes(): 15f2. and *note\nint.frombytes(): 15b3. now take a default value of '\"big\"' for the\n'byteorder' argument.  *note int.tobytes(): 15f2. also takes a\ndefault value of '1' for the 'length' argument.\n\n- bpo-44219(7): Release the GIL while performing 'isatty' system\ncalls on arbitrary file descriptors.  In particular, this affects\n*note os.isatty(): 15f3, *note os.deviceencoding(): 15f4. and\n*note io.TextIOWrapper: b8f.  By extension, *note io.open(): 26f.\nin text mode is also affected.  This change solves a deadlock in\n*note os.isatty(): 15f3.  Patch by Vincent Michel in bpo-44219(8).\n\n- bpo-44959(9): Added fallback to extension modules with '.sl' suffix\non HP-UX\n\n- bpo-45121(10): Fix issue where 'Protocol.init' raises\n'RecursionError' when it's called directly or via 'super()'.  Patch\nprovided by Yurii Karabas.\n\n- bpo-44348(11): The deallocator function of the *note BaseException:\n37c. type now uses the trashcan mechanism to prevent stack\noverflow.  For example, when a *note RecursionError: bc6. instance\nis raised, it can be linked to another RecursionError through the\n'context' attribute or the 'traceback' attribute, and then\na chain of exceptions is created.  When the chain is destroyed,\nnested deallocator function calls can crash with a stack overflow\nif the chain is too long compared to the available stack memory.\nPatch by Victor Stinner.\n\n- bpo-45123(12): Fix PyAiterCheck to only check for the anext\npresence (not for aiter).  Rename PyAiterCheck to\nPyAIterCheck, PyObjectGetAiter -> PyObjectGetAIter.\n\n- bpo-1514420(13): Interpreter no longer attempts to open files with\nnames in angle brackets (like \"<string>\" or \"<stdin>\") when\nformatting an exception.\n\n- bpo-41031(14): Match C and Python code formatting of unprintable\nexceptions and exceptions in the *note main: 1. module.\n\n- bpo-37330(15): *note open(): 26e, *note io.open(): 26f, *note\ncodecs.open(): 525. and *note fileinput.FileInput: 51b. no longer\naccept ''U'' (\"universal newline\") in the file mode.  This flag was\ndeprecated since Python 3.3.  Patch by Victor Stinner.\n\n- bpo-45083(16): When the interpreter renders an exception, its name\nnow has a complete qualname.  Previously only the class name was\nconcatenated to the module name, which sometimes resulted in an\nincorrect full name being displayed.\n\n(This issue impacted only the C code exception rendering, the *note\ntraceback: f9. module was using qualname already).\n\n- bpo-34561(17): List sorting now uses the merge-ordering strategy\nfrom Munro and Wild's 'powersort()'.  Unlike the former strategy,\nthis is provably near-optimal in the entropy of the distribution of\nrun lengths.  Most uses of 'list.sort()' probably won't see a\nsignificant time difference, but may see significant improvements\nin cases where the former strategy was exceptionally poor.\nHowever, as these are all fast linear-time approximations to a\nproblem that's inherently at best quadratic-time to solve truly\noptimally, it's also possible to contrive cases where the former\nstrategy did better.\n\n- bpo-45056(18): Compiler now removes trailing unused constants from\ncoconsts.\n\n- bpo-45020(19): Add a new command line option, \"-X\nfrozenmodules=[on|off]\" to opt out of (or into) using optional\nfrozen modules.  This defaults to \"on\" (or \"off\" if it's running\nout of the source tree).\n\n- bpo-45012(20): In *note posix: a8, release GIL during 'stat()',\n'lstat()', and 'fstatat()' syscalls made by *note\nos.DirEntry.stat(): 13f5.  Patch by Stanis??aw Skonieczny.\n\n- bpo-45018(21): Fixed pickling of range iterators that iterated for\nover '232' times.\n\n- bpo-45000(22): A *note SyntaxError: 146. is now raised when trying\nto delete *note debug: 5ce.  Patch by Donghee Na.\n\n- bpo-44963(23): Implement 'send()' and 'throw()' methods for\n'anextawaitable' objects.  Patch by Pablo Galindo.\n\n- bpo-44962(24): Fix a race in WeakKeyDictionary, WeakValueDictionary\nand WeakSet when two threads attempt to commit the last pending\nremoval.  This fixes asyncio.createtask and fixes a data loss in\nasyncio.run where shutdownasyncgens is not run\n\n- bpo-24234(25): Implement the 'bytes()' special method on the\n*note bytes: 295. type, so a bytes object 'b' passes an\n'isinstance(b, typing.SupportsBytes)' check.\n\n- bpo-24234(26): Implement the 'complex()' special method on the\n*note complex: 3ad. type, so a complex number 'z' passes an\n'isinstance(z, typing.SupportsComplex)' check.\n\n- bpo-44954(27): Fixed a corner case bug where the result of\n'float.fromhex('0x.8p-1074')' was rounded the wrong way.\n\n- bpo-44947(28): Refine the syntax error for trailing commas in\nimport statements.  Patch by Pablo Galindo.\n\n- bpo-44945(29): Specialize the BINARYADD instruction using the PEP\n659 machinery.  Adds five new instructions:\n\n* BINARYADDADAPTIVE\n\n* BINARYADDFLOAT\n\n* BINARYADDINT\n\n* BINARYADDUNICODE\n\n* BINARYADDUNICODEINPLACEFAST\n\n- bpo-44929(30): Fix some edge cases of 'enum.Flag' string\nrepresentation in the REPL. Patch by Pablo Galindo.\n\n- bpo-44914(31): Class version tags are no longer recycled.\n\nThis means that a version tag serves as a unique identifier for the\nstate of a class.  We rely on this for effective specialization of\nthe LOADATTR and other instructions.\n\n- bpo-44698(32): Restore behaviour of complex exponentiation with\ninteger-valued exponent of type *note float: 4b7. or *note complex:\n3ad.\n\n- bpo-44895(33): A debug variable 'PYTHONDUMPREFSFILE' is added for\ncreating a dump file which is generated by *note -with-trace-refs:\n6b2.  Patch by Donghee Na.\n\n- bpo-44900(34): Add five superinstructions for PEP 659 quickening:\n\n* LOADFAST LOADFAST\n\n* STOREFAST LOADFAST\n\n* LOADFAST LOADCONST\n\n* LOADCONST LOADFAST\n\n* STOREFAST STOREFAST\n\n- bpo-44889(35): Initial implementation of adaptive specialization of\n'LOADMETHOD'.  The following specialized forms were added:\n\n* 'LOADMETHODCACHED'\n\n* 'LOADMETHODMODULE'\n\n* 'LOADMETHODCLASS'\n\n- bpo-44890(36): Specialization stats are always collected in debug\nbuilds.\n\n- bpo-44885(37): Correct the ast locations of f-strings with format\nspecs and repeated expressions.  Patch by Pablo Galindo\n\n- bpo-44878(38): Remove the loop from the bytecode interpreter.  All\ninstructions end with a DISPATCH macro, so the loop is now\nredundant.\n\n- bpo-44878(39): Remove switch statement for interpreter loop when\nusing computed gotos.  This makes sure that we only have one\ndispatch table in the interpreter.\n\n- bpo-44874(40): Deprecate the old trashcan macros\n('PyTRASHCANSAFEBEGIN'/'PyTRASHCANSAFEEND').  They should be\nreplaced by the new macros 'PyTRASHCANBEGIN' and\n'PyTRASHCANEND'.\n\n- bpo-44872(41): Use new trashcan macros (PyTRASHCANBEGIN/END) in\nframeobject.c instead of the old ones (PyTRASHCANSAFEBEGIN/END).\n\n- bpo-33930(42): Fix segmentation fault with deep recursion when\ncleaning method objects.  Patch by Augusto Goulart and Pablo\nGalindo.\n\n- bpo-25782(43): Fix bug where 'PyErrSetObject' hangs when the\ncurrent exception has a cycle in its context chain.\n\n- bpo-44856(44): Fix reference leaks in the error paths of\n'updatebases()' and 'buildclass'.  Patch by Pablo Galindo.\n\n- bpo-44826(45): Initial implementation of adaptive specialization of\nSTOREATTR\n\nThree specialized forms of STOREATTR are added:\n\n* STOREATTRSLOT\n\n* STOREATTRSPLITKEYS\n\n* STOREATTRWITHHINT\n\n- bpo-44838(46): Fixed a bug that was causing the parser to raise an\nincorrect custom *note SyntaxError: 146. for invalid 'if'\nexpressions.  Patch by Pablo Galindo.\n\n- bpo-44821(47): Create instance dictionaries (dict) eagerly, to\nimprove regularity of object layout and assist specialization.\n\n- bpo-44792(48): Improve syntax errors for if expressions.  Patch by\nMiguel Brito\n\n- bpo-34013(49): Generalize the invalid legacy statement custom error\nmessage (like the one generated when \"print\" is called without\nparentheses) to include more generic expressions.  Patch by Pablo\nGalindo\n\n- bpo-44732(50): Rename 'types.Union' to 'types.UnionType'.\n\n- bpo-44725(51): Expose specialization stats in python via\n'opcode.getspecializationstats()'.\n\n- bpo-44717(52): Improve AttributeError on circular imports of\nsubmodules.\n\n- bpo-44698(53): Fix undefined behaviour in complex object\nexponentiation.\n\n- bpo-44653(54): Support *note typing: ff. types in parameter\nsubstitution in the union type.\n\n- bpo-44676(55): Add ability to serialise 'types.Union' objects.\nPatch provided by Yurii Karabas.\n\n- bpo-44633(56): Parameter substitution of the union type with wrong\ntypes now raises 'TypeError' instead of returning *note\nNotImplemented: 5c5.\n\n- bpo-44661(57): Update 'propertydescrset' to use vectorcall if\npossible.  Patch by Donghee Na.\n\n- bpo-44662(58): Add 'module' to 'types.Union'.  This also fixes\n'types.Union' issues with 'typing.Annotated'.  Patch provided by\nYurii Karabas.\n\n- bpo-44655(59): Include the name of the type in unset slots\nattribute errors.  Patch by Pablo Galindo\n\n- bpo-44655(60): Don't include a missing attribute with the same name\nas the failing one when offering suggestions for missing\nattributes.  Patch by Pablo Galindo\n\n- bpo-44646(61): Fix the hash of the union type: it no longer depends\non the order of arguments.\n\n- bpo-44636(62): Collapse union of equal types.  E.g.  the result of\n'int | int' is now 'int'.  Fix comparison of the union type with\nnon-hashable objects.  E.g.  'int | str == {}' no longer raises a\nTypeError.\n\n- bpo-44611(63): On Windows, *note os.urandom(): 276.: uses\nBCryptGenRandom API instead of CryptGenRandom API which is\ndeprecated from Microsoft Windows API. Patch by Donghee Na.\n\n- bpo-44635(64): Convert 'None' to 'type(None)' in the union type\nconstructor.\n\n- bpo-26280(65): Implement adaptive specialization for BINARYSUBSCR\n\nThree specialized forms of BINARYSUBSCR are added:\n\n* BINARYSUBSCRLISTINT\n\n* BINARYSUBSCRTUPLEINT\n\n* BINARYSUBSCRDICT\n\n- bpo-44589(66): Mapping patterns in 'match' statements with two or\nmore equal literal keys will now raise a *note SyntaxError: 146. at\ncompile-time.\n\n- bpo-44606(67): Fix 'instancecheck' and 'subclasscheck' for\nthe union type.\n\n- bpo-42073(68): The '@classmethod' decorator can now wrap other\nclassmethod-like descriptors.\n\n- bpo-41972(69): Tuned the string-searching algorithm of fastsearch.h\nto have a shorter inner loop for most cases.\n\n- bpo-44590(70): All necessary data for executing a Python function\n(local variables, stack, etc) is now kept in a per-thread stack.\nFrame objects are lazily allocated on demand.  This increases\nperformance by about 7% on the standard benchmark suite.\nIntrospection and debugging are unaffected as frame objects are\nalways available when needed.  Patch by Mark Shannon.\n\n- bpo-44584(71): The threading debug ('PYTHONTHREADDEBUG' environment\nvariable) is deprecated in Python 3.10 and will be removed in\nPython 3.12.  This feature requires a debug build of Python.  Patch\nby Victor Stinner.\n\n- bpo-43895(72): An obsolete internal cache of shared object file\nhandles added in 1995 that attempted, but did not guarantee, that a\n.so would not be dlopen'ed twice to work around flaws in mid-1990s\nposix-ish operating systems has been removed from dynloadshlib.c.\n\n- bpo-44490(73): *note typing: ff. now searches for type parameters\nin 'types.Union' objects.  'gettypehints' will also properly\nresolve annotations with nested 'types.Union' objects.  Patch\nprovided by Yurii Karabas.\n\n- bpo-43950(74): Code objects can now provide the column information\nfor instructions when available.  This is levaraged during\ntraceback printing to show the expressions responsible for errors.\n\nContributed by Pablo Galindo, Batuhan Taskaya and Ammar Askar as\npart of PEP 657(75).\n\n- bpo-44562(76): Remove uses of *note PyObjectGCDel(): 135f. in\nerror path when initializing *note types.GenericAlias: 5df.\n\n- bpo-41486(77): Fix a memory consumption and copying performance\nregression in earlier 3.10 beta releases if someone used an output\nbuffer larger than 4GiB with zlib.decompress on input data that\nexpands that large.\n\n- bpo-43908(78): Heap types with the *note PyTPFLAGSIMMUTABLETYPE:\n2b2. flag can now inherit the PEP 590(79) vectorcall protocol.\nPreviously, this was only possible for *note static types: 56a.\nPatch by Erlend E. Aasland.\n\n- bpo-44553(80): Implement GC methods for 'types.Union' to break\nreference cycles and prevent memory leaks.\n\n- bpo-44490(81): Add 'parameters' attribute and 'getitem'\noperator to 'types.Union'.  Patch provided by Yurii Karabas.\n\n- bpo-44523(82): Remove the pass-through for *note hash(): 3b1. of\n*note weakref.proxy: 87e. objects to prevent unintended\nconsequences when the original referred object dies while the proxy\nis part of a hashable object.  Patch by Pablo Galindo.\n\n- bpo-44483(83): Fix a crash in 'types.Union' objects when creating a\nunion of an object with bad 'module' field.\n\n- bpo-44486(84): Modules will always have a dictionary, even when\ncreated by 'types.ModuleType.new()'\n\n- bpo-44472(85): Fix ltrace functionality when exceptions are raised.\nPatch by Pablo Galindo\n\n- bpo-12022(86): A *note TypeError: 28e. is now raised instead of an\n*note AttributeError: 395. in *note with: 396. and *note async\nwith: 399. statements for objects which do not support the *note\ncontext manager: 398. or *note asynchronous context manager: 39b.\nprotocols correspondingly.\n\n- bpo-44297(87): Make sure that the line number is set when entering\na comprehension scope.  Ensures that backtraces inclusing generator\nexpressions show the correct line number.\n\n- bpo-44456(88): Improve the syntax error when mixing positional and\nkeyword patterns.  Patch by Pablo Galindo.\n\n- bpo-44409(89): Fix error location information for tokenizer errors\nraised on initialization of the tokenizer.  Patch by Pablo Galindo.\n\n- bpo-44396(90): Fix a possible crash in the tokenizer when raising\nsyntax errors for unclosed strings.  Patch by Pablo Galindo.\n\n- bpo-44376(91): Exact integer exponentiation (like 'i2' or 'pow(i,\n2)') with a small exponent is much faster, due to reducing overhead\nin such cases.\n\n- bpo-44313(92): Directly imported objects and modules (through\nimport and from import statements) don't generate\n'LOADMETHOD'/'CALLMETHOD' for directly accessed objects on their\nnamespace.  They now use the regular 'LOADATTR'/'CALLFUNCTION'.\n\n- bpo-44338(93): Implement adaptive specialization for LOADGLOBAL\n\nTwo specialized forms of LOADGLOBAL are added:\n\n* LOADGLOBALMODULE\n\n* LOADGLOBALBUILTIN\n\n- bpo-44368(94): Improve syntax errors for invalid \"as\" targets.\nPatch by Pablo Galindo\n\n- bpo-44349(95): Fix an edge case when displaying text from files\nwith encoding in syntax errors.  Patch by Pablo Galindo.\n\n- bpo-44337(96): Initial implementation of adaptive specialization of\nLOADATTR\n\nFour specialized forms of LOADATTR are added:\n\n* LOADATTRSLOT\n\n* LOADATTRSPLITKEYS\n\n* LOADATTRWITHHINT\n\n* LOADATTRMODULE\n\n- bpo-44335(97): Fix a regression when identifying incorrect\ncharacters in syntax errors.  Patch by Pablo Galindo\n\n- bpo-43693(98): Computation of the offsets of cell variables is done\nin the compiler instead of at runtime.  This reduces the overhead\nof handling cell and free variables, especially in the case where a\nvariable is both an argument and cell variable.\n\n- bpo-44317(99): Improve tokenizer error with improved locations.\nPatch by Pablo Galindo.\n\n- bpo-44304(100): Fix a crash in the *note sqlite3: c9. module that\nhappened when the garbage collector clears 'sqlite.Statement'\nobjects.  Patch by Pablo Galindo\n\n- bpo-44305(101): Improve error message for 'try' blocks without\n'except' or 'finally' blocks.  Patch by Pablo Galindo.\n\n- bpo-43413(102): Constructors of subclasses of some builtin classes\n(e.g.  *note tuple: 4b8, *note list: 3dc, *note frozenset: 39e.) no\nlonger accept arbitrary keyword arguments.  [reverted in 3.11a4]\nSubclass of *note set: 39d. can now define a 'new()' method\nwith additional keyword parameters without overriding also\n'init()'.\n\n- bpo-43667(103): Improve Unicode support in non-UTF locales on\nOracle Solaris.  This issue does not affect other Solaris systems.\n\n- bpo-43693(104): A new opcode MAKECELL has been added that\neffectively moves some of the work done on function entry into the\ncompiler and into the eval loop.  In addition to creating the\nrequired cell objects, the new opcode converts relevant arguments\n(and other locals) to cell variables on function entry.\n\n- bpo-44232(105): Fix a regression in *note type(): ba0. when a\nmetaclass raises an exception.  The C function 'typenew()' must\nproperly report the exception when a metaclass constructor raises\nan exception and the winner class is not the metaclass.  Patch by\nVictor Stinner.\n\n- bpo-44201(106): Avoid side effects of checking for specialized\nsyntax errors in the REPL that was causing it to ask for extra\ntokens after a syntax error had been detected.  Patch by Pablo\nGalindo\n\n- bpo-43693(107): 'PyCodeObject' gained 'cofastlocalnames' and\n'cofastlocalkinds' as the authoritative source of fast locals\ninfo.  Marshaled code objects have changed accordingly.\n\n- bpo-44184(108): Fix a crash at Python exit when a deallocator\nfunction removes the last strong reference to a heap type.  Patch\nby Victor Stinner.\n\n- bpo-44187(109): Implement quickening in the interpreter.  This\noffers no advantages as yet, but is an enabler of future\noptimizations.  See PEP 659 for full explanation.\n\n- bpo-44180(110): The parser doesn't report generic syntax errors\nthat happen in a position further away that the one it reached in\nthe first pass.  Patch by Pablo Galindo\n\n- bpo-44168(111): Fix error message in the parser involving keyword\narguments with invalid expressions.  Patch by Pablo Galindo\n\n- bpo-44156(112): String caches in 'compile.c' are now subinterpreter\ncompatible.\n\n- bpo-44143(113): Fixed a crash in the parser that manifest when\nraising tokenizer errors when an existing exception was present.\nPatch by Pablo Galindo.\n\n- bpo-44032(114): Move 'fast' locals and other variables from the\nframe object to a per-thread datastack.\n\n- bpo-44114(115): Fix incorrect dictkeysreversed and\ndictitemsreversed function signatures in C code, which broke\nwebassembly builds.\n\n- bpo-44110(116): Improve 'str.getitem()' error message\n\n- bpo-26110(117): Add 'CALLMETHODKW' opcode to speed up method\ncalls with keyword arguments.  Idea originated from PyPy.  A side\neffect is executing 'CALLMETHOD' is now branchless in the\nevaluation loop.\n\n- bpo-28307(118): Compiler now optimizes simple C-style formatting\nwith literal format containing only format codes %s, %r and %a by\nconverting them to f-string expressions.\n\n- bpo-43149(119): Correct the syntax error message regarding multiple\nexception types to not refer to \"exception groups\".  Patch by Pablo\nGalindo\n\n- bpo-43822(120): The parser will prioritize tokenizer errors over\ncustom syntax errors when raising exceptions.  Patch by Pablo\nGalindo.\n\n- bpo-40222(121): \"Zero cost\" exception handling.\n\n* Uses a lookup table to determine how to handle exceptions.\n\n* Removes SETUPFINALLY and POPTOP block instructions,\neliminating the runtime overhead of try statements.\n\n* Reduces the size of the frame object by about 60%.\n\nPatch by Mark Shannon\n\n- bpo-43918(122): Document the signature and 'default' argument in\nthe docstring of the new 'anext' builtin.\n\n- bpo-43833(123): Emit a deprecation warning if the numeric literal\nis immediately followed by one of keywords: and, else, for, if, in,\nis, or.  Raise a syntax error with more informative message if it\nis immediately followed by other keyword or identifier.\n\n- bpo-43879(124): Add nativethreadid to PyThreadState.  Patch by\nGabriele N. Tornetta.\n\n- bpo-43693(125): Compute cell offsets relative to locals in\ncompiler.  Allows the interpreter to treats locals and cells a\nsingle array, which is slightly more efficient.  Also make the\nLOADCLOSURE opcode an alias for LOADFAST. Preserving LOADCLOSURE\nhelps keep bytecode a bit more readable.\n\n- bpo-17792(126): More accurate error messages for access of unbound\nlocals or free vars.\n\n- bpo-28146(127): Fix a confusing error message in *note\nstr.format(): 3ed.\n\n- bpo-11105(128): When compiling *note ast.AST: 527. objects with\nrecursive references through *note compile(): 528, the interpreter\ndoesn't crash anymore instead it raises a *note RecursionError:\nbc6.\n\n- bpo-39091(129): Fix crash when using passing a non-exception to a\ngenerator's 'throw()' method.  Patch by Noah Oxer\n\n- bpo-33346(130): Asynchronous comprehensions are now allowed inside\ncomprehensions in asynchronous functions.  Outer comprehensions\nimplicitly become asynchronous.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43760\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=45061\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=24076\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=45190\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=45167\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=45155\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=44219\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=44219\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=44959\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=45121\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=44348\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=45123\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=1514420\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=41031\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=37330\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=45083\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=34561\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=45056\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=45020\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=45012\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=45018\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=45000\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=44963\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=44962\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=24234\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=24234\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=44954\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=44947\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=44945\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=44929\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=44914\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=44698\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=44895\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=44900\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=44889\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=44890\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=44885\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=44878\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=44878\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=44874\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=44872\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=33930\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=25782\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=44856\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=44826\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=44838\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=44821\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=44792\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=34013\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=44732\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=44725\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=44717\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=44698\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=44653\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=44676\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=44633\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=44661\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=44662\n\n(59) https://bugs.python.org/issue?@action=redirect&bpo=44655\n\n(60) https://bugs.python.org/issue?@action=redirect&bpo=44655\n\n(61) https://bugs.python.org/issue?@action=redirect&bpo=44646\n\n(62) https://bugs.python.org/issue?@action=redirect&bpo=44636\n\n(63) https://bugs.python.org/issue?@action=redirect&bpo=44611\n\n(64) https://bugs.python.org/issue?@action=redirect&bpo=44635\n\n(65) https://bugs.python.org/issue?@action=redirect&bpo=26280\n\n(66) https://bugs.python.org/issue?@action=redirect&bpo=44589\n\n(67) https://bugs.python.org/issue?@action=redirect&bpo=44606\n\n(68) https://bugs.python.org/issue?@action=redirect&bpo=42073\n\n(69) https://bugs.python.org/issue?@action=redirect&bpo=41972\n\n(70) https://bugs.python.org/issue?@action=redirect&bpo=44590\n\n(71) https://bugs.python.org/issue?@action=redirect&bpo=44584\n\n(72) https://bugs.python.org/issue?@action=redirect&bpo=43895\n\n(73) https://bugs.python.org/issue?@action=redirect&bpo=44490\n\n(74) https://bugs.python.org/issue?@action=redirect&bpo=43950\n\n(75) https://peps.python.org/pep-0657/\n\n(76) https://bugs.python.org/issue?@action=redirect&bpo=44562\n\n(77) https://bugs.python.org/issue?@action=redirect&bpo=41486\n\n(78) https://bugs.python.org/issue?@action=redirect&bpo=43908\n\n(79) https://peps.python.org/pep-0590/\n\n(80) https://bugs.python.org/issue?@action=redirect&bpo=44553\n\n(81) https://bugs.python.org/issue?@action=redirect&bpo=44490\n\n(82) https://bugs.python.org/issue?@action=redirect&bpo=44523\n\n(83) https://bugs.python.org/issue?@action=redirect&bpo=44483\n\n(84) https://bugs.python.org/issue?@action=redirect&bpo=44486\n\n(85) https://bugs.python.org/issue?@action=redirect&bpo=44472\n\n(86) https://bugs.python.org/issue?@action=redirect&bpo=12022\n\n(87) https://bugs.python.org/issue?@action=redirect&bpo=44297\n\n(88) https://bugs.python.org/issue?@action=redirect&bpo=44456\n\n(89) https://bugs.python.org/issue?@action=redirect&bpo=44409\n\n(90) https://bugs.python.org/issue?@action=redirect&bpo=44396\n\n(91) https://bugs.python.org/issue?@action=redirect&bpo=44376\n\n(92) https://bugs.python.org/issue?@action=redirect&bpo=44313\n\n(93) https://bugs.python.org/issue?@action=redirect&bpo=44338\n\n(94) https://bugs.python.org/issue?@action=redirect&bpo=44368\n\n(95) https://bugs.python.org/issue?@action=redirect&bpo=44349\n\n(96) https://bugs.python.org/issue?@action=redirect&bpo=44337\n\n(97) https://bugs.python.org/issue?@action=redirect&bpo=44335\n\n(98) https://bugs.python.org/issue?@action=redirect&bpo=43693\n\n(99) https://bugs.python.org/issue?@action=redirect&bpo=44317\n\n(100) https://bugs.python.org/issue?@action=redirect&bpo=44304\n\n(101) https://bugs.python.org/issue?@action=redirect&bpo=44305\n\n(102) https://bugs.python.org/issue?@action=redirect&bpo=43413\n\n(103) https://bugs.python.org/issue?@action=redirect&bpo=43667\n\n(104) https://bugs.python.org/issue?@action=redirect&bpo=43693\n\n(105) https://bugs.python.org/issue?@action=redirect&bpo=44232\n\n(106) https://bugs.python.org/issue?@action=redirect&bpo=44201\n\n(107) https://bugs.python.org/issue?@action=redirect&bpo=43693\n\n(108) https://bugs.python.org/issue?@action=redirect&bpo=44184\n\n(109) https://bugs.python.org/issue?@action=redirect&bpo=44187\n\n(110) https://bugs.python.org/issue?@action=redirect&bpo=44180\n\n(111) https://bugs.python.org/issue?@action=redirect&bpo=44168\n\n(112) https://bugs.python.org/issue?@action=redirect&bpo=44156\n\n(113) https://bugs.python.org/issue?@action=redirect&bpo=44143\n\n(114) https://bugs.python.org/issue?@action=redirect&bpo=44032\n\n(115) https://bugs.python.org/issue?@action=redirect&bpo=44114\n\n(116) https://bugs.python.org/issue?@action=redirect&bpo=44110\n\n(117) https://bugs.python.org/issue?@action=redirect&bpo=26110\n\n(118) https://bugs.python.org/issue?@action=redirect&bpo=28307\n\n(119) https://bugs.python.org/issue?@action=redirect&bpo=43149\n\n(120) https://bugs.python.org/issue?@action=redirect&bpo=43822\n\n(121) https://bugs.python.org/issue?@action=redirect&bpo=40222\n\n(122) https://bugs.python.org/issue?@action=redirect&bpo=43918\n\n(123) https://bugs.python.org/issue?@action=redirect&bpo=43833\n\n(124) https://bugs.python.org/issue?@action=redirect&bpo=43879\n\n(125) https://bugs.python.org/issue?@action=redirect&bpo=43693\n\n(126) https://bugs.python.org/issue?@action=redirect&bpo=17792\n\n(127) https://bugs.python.org/issue?@action=redirect&bpo=28146\n\n(128) https://bugs.python.org/issue?@action=redirect&bpo=11105\n\n(129) https://bugs.python.org/issue?@action=redirect&bpo=39091\n\n(130) https://bugs.python.org/issue?@action=redirect&bpo=33346\n\nFile: python3.12.info,  Node: Library<26>,  Next: Documentation<26>,  Prev: Core and Builtins<26>,  Up: Python 3 11 0 alpha 1\n\n1.22.26.3 Library\n.................\n\n- bpo-45371(1): Fix clang rpath issue in 'distutils'.  The\nUnixCCompiler now uses correct clang option to add a runtime\nlibrary directory (rpath) to a shared library.\n\n- bpo-45329(2): Fix freed memory access in 'pyexpat.xmlparser' when\nbuilding it with an installed expat library <= 2.2.0.\n\n- bpo-41710(3): On Unix, if the 'semclockwait()' function is\navailable in the C library (glibc 2.30 and newer), the *note\nthreading.Lock.acquire(): 464. method now uses the monotonic clock\n(*note time.CLOCKMONOTONIC: 465.) for the timeout, rather than\nusing the system clock (*note time.CLOCKREALTIME: 466.), to not be\naffected by system clock changes.  Patch by Victor Stinner.\n\n- bpo-1596321(4): Fix the 'threading.shutdown()' function when the\n*note threading: e7. module was imported first from a thread\ndifferent than the main thread: no longer log an error at Python\nexit.\n\n- bpo-45274(5): Fix a race condition in the *note Thread.join():\n1058. method of the *note threading: e7. module.  If the function\nis interrupted by a signal and the signal handler raises an\nexception, make sure that the thread remains in a consistent state\nto prevent a deadlock.  Patch by Victor Stinner.\n\n- bpo-21302(6): In Unix operating systems, *note time.sleep(): 469.\nnow uses the 'nanosleep()' function, if 'clocknanosleep()' is not\navailable but 'nanosleep()' is available.  'nanosleep()' allows to\nsleep with nanosecond precision.\n\n- bpo-21302(7): On Windows, *note time.sleep(): 469. now uses a\nwaitable timer which has a resolution of 100 nanoseconds (10^-7\nseconds).  Previously, it had a resolution of 1 millisecond (10^-3\nseconds).  Patch by Benjamin Sz??ke and Victor Stinner.\n\n- bpo-45238(8): Fix 'unittest.IsolatedAsyncioTestCase.debug()': it\nruns now asynchronous methods and callbacks.\n\n- bpo-36674(9): *note unittest.TestCase.debug(): 15f6. raises now a\n*note unittest.SkipTest: e57. if the class or the test method are\ndecorated with the skipping decorator.\n\n- bpo-45235(10): Fix an issue where argparse would not preserve\nvalues in a provided namespace when using a subparser with\ndefaults.\n\n- bpo-45183(11): Have zipimport.zipimporter.findspec() not raise an\nexception when the underlying zip file has been deleted and the\ninternal cache has been reset via invalidatecache().\n\n- bpo-45234(12): Fixed a regression in *note copyfile(): 886, *note\ncopy(): 887, *note copy2(): 888. raising *note FileNotFoundError:\n353. when source is a directory, which should raise *note\nIsADirectoryError: ed2.\n\n- bpo-45228(13): Fix stack buffer overflow in parsing J1939 network\naddress.\n\n- bpo-45225(14): use map function instead of genexpr in capwords.\n\n- bpo-42135(15): Fix typo: 'importlib.findloader' is really slated\nfor removal in Python 3.12 not 3.10, like the others in PR 25169.\n\nPatch by Hugo van Kemenade.\n\n- bpo-20524(16): Improves error messages on '.format()' operation for\n'str', 'float', 'int', and 'complex'.  New format now shows the\nproblematic pattern and the object type.\n\n- bpo-45168(17): Change *note dis.dis(): 96e. output to omit op arg\nvalues that cannot be resolved due to 'coconsts', 'conames' etc\nnot being provided.  Previously the oparg itself was repeated in\nthe value field, which is not useful and can be confusing.\n\n- bpo-21302(18): In Unix operating systems, *note time.sleep(): 469.\nnow uses the 'clocknanosleep()' function, if available, which\nallows to sleep for an interval specified with nanosecond\nprecision.\n\n- bpo-45173(19): Remove from the *note configparser: 20. module: the\n'SafeConfigParser' class, the 'filename' property of the *note\nParsingError: 256. class, the 'readfp()' method of the *note\nConfigParser: 257. class, deprecated since Python 3.2.\n\nPatch by Hugo van Kemenade.\n\n- bpo-44987(20): Pure ASCII strings are now normalized in constant\ntime by *note unicodedata.normalize(): 4a4.  Patch by Donghee Na.\n\n- bpo-35474(21): Calling *note mimetypes.guessallextensions():\n15f7. with 'strict=False' no longer affects the result of the\nfollowing call with 'strict=True'.  Also, mutating the returned\nlist no longer affects the global state.\n\n- bpo-45166(22): *note typing.gettypehints(): 47f. now works with\n*note Final: 870. wrapped in *note ForwardRef: 15a6.\n\n- bpo-45162(23): Remove many old deprecated *note unittest: 101.\nfeatures:\n\n* \"'fail*'\" and \"'assert*'\" aliases of *note TestCase: 159.\nmethods.\n\n* Broken from start *note TestCase: 159. method\n'assertDictContainsSubset()'.\n\n* Ignored '<unittest.TestLoader.loadTestsFromModule>\nTestLoader.loadTestsFromModule()' parameter 'useloadtests'.\n\n* Old alias 'TextTestResult' of *note TextTestResult: 286.\n\n- bpo-38371(24): Remove the deprecated 'split()' method of\n'tkinter.TkappType'.  Patch by Erlend E. Aasland.\n\n- bpo-20499(25): Improve the speed and accuracy of\nstatistics.pvariance().\n\n- bpo-45132(26): Remove *note getitem(): 4b9. methods of *note\nxml.dom.pulldom.DOMEventStream: 519, *note\nwsgiref.util.FileWrapper: 51a. and *note fileinput.FileInput: 51b,\ndeprecated since Python 3.9.\n\nPatch by Hugo van Kemenade.\n\n- bpo-45129(27): Due to significant security concerns, the\n'reuseaddress' parameter of *note\nasyncio.loop.createdatagramendpoint(): 517, disabled in Python\n3.9, is now entirely removed.  This is because of the behavior of\nthe socket option 'SOREUSEADDR' in UDP.\n\nPatch by Hugo van Kemenade.\n\n- bpo-45124(28): The 'bdistmsi' command, deprecated in Python 3.9,\nis now removed.\n\nUse 'bdistwheel' (wheel packages) instead.\n\nPatch by Hugo van Kemenade.\n\n- bpo-30856(29): *note unittest.TestResult: fdc. methods *note\naddFailure(): 15f8, *note addError(): 15f9, *note addSkip(): 15fa.\nand *note addSubTest(): 15fb. are now called immediately after\nraising an exception in test or finishing a subtest.  Previously\nthey were called only after finishing the test clean up.\n\n- bpo-45034(30): Changes how error is formatted for 'struct.pack'\nwith ''H'' and ''h'' modes and too large / small numbers.  Now it\nshows the actual numeric limits, while previously it was showing\narithmetic expressions.\n\n- bpo-25894(31): *note unittest: 101. now always reports skipped and\nfailed subtests separately: separate characters in default mode and\nseparate lines in verbose mode.  Also the test description is now\noutput for errors in test method, class and module cleanups.\n\n- bpo-45081(32): Fix issue when dataclasses that inherit from\n'typing.Protocol' subclasses have wrong 'init'.  Patch provided\nby Yurii Karabas.\n\n- bpo-45085(33): The 'binhex' module, deprecated in Python 3.9, is\nnow removed.  The following *note binascii: e. functions,\ndeprecated in Python 3.9, are now also removed:\n\n* 'a2bhqx()', 'b2ahqx()';\n\n* 'rlecodehqx()', 'rledecodehqx()'.\n\nThe *note binascii.crchqx(): 518. function remains available.\n\nPatch by Victor Stinner.\n\n- bpo-40360(34): The *note lib2to3: 7f. package is now deprecated and\nmay not be able to parse Python 3.10 or newer.  See the PEP 617(35)\n(New PEG parser for CPython).  Patch by Victor Stinner.\n\n- bpo-45075(36): Rename 'traceback.StackSummary.formatframe()' to\n*note traceback.StackSummary.formatframesummary(): 46f.  This\nmethod was added for 3.11 so it was not released yet.\n\nUpdated code and docs to better distinguish frame and FrameSummary.\n\n- bpo-31299(37): Add option to completely drop frames from a\ntraceback by returning 'None' from a 'formatframe()' override.\n\n- bpo-41620(38): *note run(): fdb. now always return a *note\nTestResult: fdc. instance.  Previously it returned 'None' if the\ntest class or method was decorated with a skipping decorator.\n\n- bpo-45021(39): Fix a potential deadlock at shutdown of forked\nchildren when using *note concurrent.futures: 1f. module\n\n- bpo-43913(40): Fix bugs in cleaning up classes and modules in *note\nunittest: 101.:\n\n* Functions registered with *note addModuleCleanup(): 879. were\nnot called unless the user defines 'tearDownModule()' in their\ntest module.\n\n* Functions registered with *note addClassCleanup(): 87a. were\nnot called if 'tearDownClass' is set to 'None'.\n\n* Buffering in *note TestResult: fdc. did not work with\nfunctions registered with 'addClassCleanup()' and\n'addModuleCleanup()'.\n\n* Errors in functions registered with 'addClassCleanup()' and\n'addModuleCleanup()' were not handled correctly in buffered\nand debug modes.\n\n* Errors in 'setUpModule()' and functions registered with\n'addModuleCleanup()' were reported in wrong order.\n\n* And several lesser bugs.\n\n- bpo-45030(41): Fix integer overflow in pickling and copying the\nrange iterator.\n\n- bpo-45001(42): Made email date parsing more robust against\nmalformed input, namely a whitespace-only 'Date:' header.  Patch by\nWouter Bolsterlee.\n\n- bpo-45010(43): Remove support of special method 'div' in *note\nunittest.mock: 102.  It is not used in Python 3.\n\n- bpo-39218(44): Improve accuracy of variance calculations by using\n'x*x' instead of 'x2'.\n\n- bpo-43613(45): Improve the speed of *note gzip.compress(): 81d. and\n*note gzip.decompress(): 1081. by compressing and decompressing at\nonce in memory instead of in a streamed fashion.\n\n- bpo-37596(46): Ensure that *note set: 39d. and *note frozenset:\n39e. objects are always *note marshalled: 88. reproducibly.\n\n- bpo-44019(47): A new function 'operator.call' has been added, such\nthat 'operator.call(obj, *args, kwargs) == obj(*args, kwargs)'.\n\n- bpo-42255(48): 'webbrowser.MacOSX' is deprecated and will be\nremoved in Python 3.13.  It is untested and undocumented and also\nnot used by webbrowser itself.  Patch by Donghee Na.\n\n- bpo-44955(49): Method *note stopTestRun(): 11c4. is now always\ncalled in pair with method *note startTestRun(): 11c3. for *note\nTestResult: fdc. objects implicitly created in *note run(): fdb.\nPreviously it was not called for test methods and classes decorated\nwith a skipping decorator.\n\n- bpo-39039(50): tarfile.open raises *note ReadError: 15fc. when a\nzlib error occurs during file extraction.\n\n- bpo-44935(51): *note subprocess: d0. on Solaris now also uses *note\nos.posixspawn(): 885. for better performance.\n\n- bpo-44911(52): *note IsolatedAsyncioTestCase: 48b. will no longer\nthrow an exception while cancelling leaked tasks.  Patch by Bar\nHarel.\n\n- bpo-41322(53): Added 'DeprecationWarning' for tests and async tests\nthat return a value!=None (as this may indicate an improperly\nwritten test, for example a test written as a generator function).\n\n- bpo-44524(54): Make exception message more useful when subclass\nfrom typing special form alias.  Patch provided by Yurii Karabas.\n\n- bpo-38956(55): 'argparse.BooleanOptionalAction''s default value is\nno longer printed twice when used with *note\nargparse.ArgumentDefaultsHelpFormatter: 15fd.\n\n- bpo-44860(56): Fix the 'posixuser' scheme in *note sysconfig: d5.\nto not depend on *note sys.platlibdir: 756.\n\n- bpo-44859(57): Improve error handling in *note sqlite3: c9. and\nraise more accurate exceptions.\n\n* *note MemoryError: 13e3. is now raised instead of *note\nsqlite3.Warning: 1587. when memory is not enough for encoding\na statement to UTF-8 in 'Connection.call()' and\n'Cursor.execute()'.\n\n* 'UnicodEncodeError' is now raised instead of *note\nsqlite3.Warning: 1587. when the statement contains surrogate\ncharacters in 'Connection.call()' and 'Cursor.execute()'.\n\n* *note TypeError: 28e. is now raised instead of *note\nValueError: 183. for non-string script argument in\n'Cursor.executescript()'.\n\n* *note ValueError: 183. is now raised for script containing the\nnull character instead of truncating it in\n'Cursor.executescript()'.\n\n* Correctly handle exceptions raised when getting boolean value\nof the result of the progress handler.\n\n* Add many tests covering different corner cases.\n\n- bpo-44581(58): Upgrade bundled pip to 21.2.3 and setuptools to\n57.4.0\n\n- bpo-44849(59): Fix the *note os.setinheritable(): d62. function on\nFreeBSD 14 for file descriptor opened with the *note OPATH: de2.\nflag: ignore the *note EBADF: 77c. error on 'ioctl()', fallback on\nthe 'fcntl()' implementation.  Patch by Victor Stinner.\n\n- bpo-44605(60): The @functools.totalordering() decorator now works\nwith metaclasses.\n\n- bpo-44524(61): Fixed an issue wherein the 'name' and\n'qualname' attributes of subscribed specialforms could be\n'None'.\n\n- bpo-44839(62): *note MemoryError: 13e3. raised in user-defined\nfunctions will now produce a 'MemoryError' in *note sqlite3: c9.\n*note OverflowError: 68d. will now be converted to *note DataError:\n15fe.  Previously *note OperationalError: 15ff. was produced in\nthese cases.\n\n- bpo-44822(63): *note sqlite3: c9. user-defined functions and\naggregators returning *note strings: 157. with embedded NUL\ncharacters are no longer truncated.  Patch by Erlend E. Aasland.\n\n- bpo-44801(64): Ensure that the *note ParamSpec: 163. variable in\nCallable can only be substituted with a parameters expression (a\nlist of types, an ellipsis, ParamSpec or Concatenate).\n\n- bpo-44806(65): Non-protocol subclasses of *note typing.Protocol:\n47e. ignore now the 'init' method inherited from protocol base\nclasses.\n\n- bpo-27275(66): *note collections.OrderedDict.popitem(): 1162. and\n'collections.OrderedDict.pop()' no longer call 'getitem' and\n'delitem' methods of the OrderedDict subclasses.\n\n- bpo-44793(67): Fix checking the number of arguments when subscribe\na generic type with 'ParamSpec' parameter.\n\n- bpo-44784(68): In importlib.metadata tests, override warnings\nbehavior under expected DeprecationWarnings (importlibmetadata\n4.6.3).\n\n- bpo-44667(69): The *note tokenize.tokenize(): 202. doesn't\nincorrectly generate a 'NEWLINE' token if the source doesn't end\nwith a new line character but the last line is a comment, as the\nfunction is already generating a 'NL' token.  Patch by Pablo\nGalindo\n\n- bpo-44771(70): Added 'importlib.simple' module implementing\nadapters from a low-level resources reader interface to a\n'TraversableResources' interface.  Legacy API ('path', 'contents',\n...) is now supported entirely by the '.files()' API with a\ncompatibility shim supplied for resource loaders without that\nfunctionality.  Feature parity with 'importlibresources' 5.2.\n\n- bpo-44752(71): 'rcompleter' does not call *note getattr(): a15. on\n*note property: 3f6. objects to avoid the side-effect of evaluating\nthe corresponding method.\n\n- bpo-44747(72): Refactor usage of 'sys.getframe' in 'typing'\nmodule.  Patch provided by Yurii Karabas.\n\n- bpo-42378(73): Fixes the issue with log file being overwritten when\n*note logging.FileHandler: 1600. is used in *note atexit: a. with\n'filemode' set to ''w''.  Note this will cause the message in\n'atexit' not being logged if the log stream is already closed due\nto shutdown of logging.\n\n- bpo-44720(74): 'weakref.proxy' objects referencing non-iterators\nnow raise 'TypeError' rather than dereferencing the null\n'tpiternext' slot and crashing.\n\n- bpo-44704(75): The implementation of 'collections.abc.Set.hash()'\nnow matches that of 'frozenset.hash()'.\n\n- bpo-44666(76): Fixed issue in *note compileall.compilefile(): c3e.\nwhen 'sys.stdout' is redirected.  Patch by Stefan Ho\"lzl.\n\n- bpo-44688(77): *note sqlite3.Connection.createcollation(): 441.\nnow accepts non-ASCII collation names.  Patch by Erlend E. Aasland.\n\n- bpo-44690(78): Adopt 'binacii.a2bbase64''s strict mode in\n'base64.b64decode'.\n\n- bpo-42854(79): Fixed a bug in the 'ssl' module that was throwing\n*note OverflowError: 68d. when using 'ssl.SSLSocket.write()' and\n'ssl.SSLSocket.read()' for a big value of the 'len' parameter.\nPatch by Pablo Galindo\n\n- bpo-44686(80): Replace 'unittest.mock.importer' with\n'pkgutil.resolvename'.\n\n- bpo-44353(81): Make 'NewType.call' faster by implementing it in\nC. Patch provided by Yurii Karabas.\n\n- bpo-44682(82): Change the *note pdb: a0. 'commands' directive to\ndisallow setting commands for an invalid breakpoint and to display\nan appropriate error.\n\n- bpo-44353(83): Refactor 'typing.NewType' from function into\ncallable class.  Patch provided by Yurii Karabas.\n\n- bpo-44678(84): Added a separate error message for discontinuous\npadding in 'binascii.a2bbase64' strict mode.\n\n- bpo-44524(85): Add missing 'name' and 'qualname' attributes\nto 'typing' module classes.  Patch provided by Yurii Karabas.\n\n- bpo-40897(86): Give priority to using the current class constructor\nin *note inspect.signature(): 51c.  Patch by Weipeng Hong.\n\n- bpo-44638(87): Add a reference to the zipp project and hint as to\nhow to use it.\n\n- bpo-44648(88): Fixed wrong error being thrown by *note\ninspect.getsource(): 144e. when examining a class in the\ninteractive session.  Instead of *note TypeError: 28e, it should be\n*note OSError: 613. with appropriate error message.\n\n- bpo-44608(89): Fix memory leak in 'tkinter.flatten()' if it is\ncalled with a sequence or set, but not list or tuple.\n\n- bpo-44594(90): Fix an edge case of 'ExitStack' and 'AsyncExitStack'\nexception chaining.  They will now match 'with' block behavior when\n'context' is explicitly set to 'None' when the exception is in\nflight.\n\n- bpo-42799(91): In *note fnmatch: 57, the cache size for compiled\nregex patterns (*note functools.lrucache(): 815.) was bumped up\nfrom 256 to 32768, affecting functions: *note fnmatch.fnmatch():\n1601, *note fnmatch.fnmatchcase(): 1602, *note fnmatch.filter():\n1603.\n\n- bpo-41928(92): Update *note shutil.copyfile(): 886. to raise *note\nFileNotFoundError: 353. instead of confusing *note\nIsADirectoryError: ed2. when a path ending with a 'os.path.sep'\ndoes not exist; *note shutil.copy(): 887. and *note shutil.copy2():\n888. are also affected.\n\n- bpo-44569(93): Added the 'StackSummary.formatframe()' function in\n*note traceback: f9.  This allows users to customize the way\nindividual lines are formatted in tracebacks without\nre-implementing logic to handle recursive tracebacks.\n\n- bpo-44566(94): handle StopIteration subclass raised from\n@contextlib.contextmanager generator\n\n- bpo-44558(95): Make the implementation consistency of *note\nindexOf(): 6f4. between C and Python versions.  Patch by Donghee\nNa.\n\n- bpo-41249(96): Fixes 'TypedDict' to work with\n'typing.gettypehints()' and postponed evaluation of annotations\nacross modules.\n\n- bpo-44554(97): Refactor argument processing in 'pdb.main()' to\nsimplify detection of errors in input loading and clarify behavior\naround module or script invocation.\n\n- bpo-34798(98): Break up paragraph about *note pprint.PrettyPrinter:\ndef. construction parameters to make it easier to read.\n\n- bpo-44539(99): Added support for recognizing JPEG files without\nJFIF or Exif markers.\n\n- bpo-44461(100): Fix bug with *note pdb: a0.'s handling of import\nerror due to a package which does not have a 'main' module\n\n- bpo-43625(101): Fix a bug in the detection of CSV file headers by\n*note csv.Sniffer.hasheader(): 1604. and improve documentation of\nsame.\n\n- bpo-44516(102): Update vendored pip to 21.1.3\n\n- bpo-42892(103): Fixed an exception thrown while parsing a malformed\nmultipart email by *note email.message.EmailMessage: ae8.\n\n- bpo-44468(104): *note typing.gettypehints(): 47f. now finds\nannotations in classes and base classes with unexpected\n'module'.  Previously, it skipped those MRO elements.\n\n- bpo-44491(105): Allow clearing the *note sqlite3: c9. authorizer\ncallback by passing *note None: 43f. to *note setauthorizer():\n440.  Patch by Erlend E. Aasland.\n\n- bpo-43977(106): Set the proper *note PyTPFLAGSMAPPING: 1605. and\n*note PyTPFLAGSSEQUENCE: 1606. flags for subclasses created\nbefore a parent has been registered as a *note\ncollections.abc.Mapping: 6e2. or *note collections.abc.Sequence:\n1038.\n\n- bpo-44482(107): Fix very unlikely resource leak in *note glob: 5f.\nin alternate Python implementations.\n\n- bpo-44466(108): The *note faulthandler: 53. module now detects if a\nfatal error occurs during a garbage collector collection.  Patch by\nVictor Stinner.\n\n- bpo-44471(109): A *note TypeError: 28e. is now raised instead of an\n*note AttributeError: 395. in *note\ncontextlib.ExitStack.entercontext(): 397. and *note\ncontextlib.AsyncExitStack.enterasynccontext(): 39a. for objects\nwhich do not support the *note context manager: 398. or *note\nasynchronous context manager: 39b. protocols correspondingly.\n\n- bpo-44404(110): *note tkinter: ea.'s 'after()' method now supports\ncallables without the 'name' attribute.\n\n- bpo-41546(111): Make *note pprint: a9. (like the builtin 'print')\nnot attempt to write to 'stdout' when it is 'None'.\n\n- bpo-44458(112): 'BUFFERBLOCKSIZE' is now declared static, to\navoid linking collisions when bz2, lmza or zlib are statically\nlinked.\n\n- bpo-44464(113): Remove exception for flake8 in deprecated\nimportlib.metadata interfaces.  Sync with importlibmetadata 4.6.\n\n- bpo-44446(114): Take into account that 'lineno' might be 'None' in\n*note traceback.FrameSummary: ce9.\n\n- bpo-44439(115): Fix in 'bz2.BZ2File.write()' /\n'lzma.LZMAFile.write()' methods, when the input data is an object\nthat supports the buffer protocol, the file length may be wrong.\n\n- bpo-44434(116): thread.startnewthread() no longer calls\nPyThreadexitthread() explicitly at the thread exit, the call was\nredundant.  On Linux with the glibc, pthreadexit() aborts the\nwhole process if dlopen() fails to open libgccs.so file (ex:\nEMFILE error).  Patch by Victor Stinner.\n\n- bpo-42972(117): The thread.RLock type now fully implement the GC\nprotocol: add a traverse function and the *note PyTPFLAGSHAVEGC:\n568. flag.  Patch by Victor Stinner.\n\n- bpo-44422(118): The *note threading.enumerate(): 1607. function now\nuses a reentrant lock to prevent a hang on reentrant call.  Patch\nby Victor Stinner.\n\n- bpo-38291(119): Importing typing.io or typing.re now prints a\n'DeprecationWarning'.\n\n- bpo-37880(120): argparse actions storeconst and appendconst each\nreceive a default value of None when the 'const' kwarg is not\nprovided.  Previously, this raised a *note TypeError: 28e.\n\n- bpo-44389(121): Fix deprecation of *note ssl.OPNOTLSv13: 674.\n\n- bpo-27827(122): 'pathlib.PureWindowsPath.isreserved()' now\nidentifies a greater range of reserved filenames, including those\nwith trailing spaces or colons.\n\n- bpo-44395(123): Fix 'asstring()' to pass unixfrom properly.  Patch\nby Donghee Na.\n\n- bpo-34266(124): Handle exceptions from parsing the arg of *note\npdb: a0.'s run/restart command.\n\n- bpo-44362(125): Improve *note ssl: ca. module's deprecation\nmessages, error reporting, and documentation for deprecations.\n\n- bpo-44342(126): [Enum] Change pickling from by-value to by-name.\n\n- bpo-44356(127): [Enum] Allow multiple data-type mixins if they are\nall the same.\n\n- bpo-44351(128): Restore back 'parsemakefile()' in\n'distutils.sysconfig' because it behaves differently than the\nsimilar implementation in *note sysconfig: d5.\n\n- bpo-35800(129): 'smtpd.MailmanProxy' is now removed as it is\nunusable without an external module, 'mailman'.  Patch by Donghee\nNa.\n\n- bpo-44357(130): Added a function that returns cube root of the\ngiven number *note math.cbrt(): 42b.\n\n- bpo-44339(131): Change 'math.pow(??0.0, -math.inf)' to return 'inf'\ninstead of raising 'ValueError'.  This brings the special-case\nhandling of 'math.pow' into compliance with the IEEE 754 standard.\n\n- bpo-44242(132): Remove missing flag check from Enum creation and\nmove into a 'verify' decorator.\n\n- bpo-44246(133): In 'importlib.metadata', restore compatibility in\nthe result from 'Distribution.entrypoints' ('EntryPoints') to\nhonor expectations in older implementations and issuing deprecation\nwarnings for these cases: A. 'EntryPoints' objects are once again\nmutable, allowing for 'sort()' and other list-based mutation\noperations.  Avoid deprecation warnings by casting to a mutable\nsequence (e.g.  'list(dist.entrypoints).sort()').  B.\n'EntryPoints' results once again allow for access by index.  To\navoid deprecation warnings, cast the result to a Sequence first\n(e.g.  'tuple(dist.entrypoints)[0]').\n\n- bpo-44246(134): In importlib.metadata.entrypoints, de-duplication\nof distributions no longer requires loading the full metadata for\nPathDistribution objects, improving entry point loading performance\nby ~10x.\n\n- bpo-43858(135): Added a function that returns a copy of a dict of\nlogging levels: *note logging.getLevelNamesMapping(): 423.\n\n- bpo-44260(136): The *note random.Random: 1608. constructor no\nlonger reads system entropy without need.\n\n- bpo-44254(137): On Mac, give turtledemo button text a color that\nworks on both light or dark background.  Programmers cannot control\nthe latter.\n\n- bpo-44258(138): Support PEP 515 for Fraction's initialization from\nstring.\n\n- bpo-44235(139): Remove deprecated functions in the *note gettext:\n5e.  Patch by Donghee Na.\n\n- bpo-38693(140): Prefer f-strings to '.format' in\nimportlib.resources.\n\n- bpo-33693(141): Importlib.metadata now prefers f-strings to\n.format.\n\n- bpo-44241(142): Incorporate minor tweaks from importlibmetadata\n4.1: SimplePath protocol, support for Metadata 2.2.\n\n- bpo-43216(143): Remove the '@asyncio.coroutine' *note decorator:\n514. enabling legacy generator-based coroutines to be compatible\nwith async/await code; remove 'asyncio.coroutines.CoroWrapper' used\nfor wrapping legacy coroutine objects in the debug mode.  The\ndecorator has been deprecated since Python 3.8 and the removal was\ninitially scheduled for Python 3.10.  Patch by Illia Volochii.\n\n- bpo-44210(144): Make importlib.metadata.meta.PackageMetadata\npublic.\n\n- bpo-43643(145): Declare readers.MultiplexedPath.name as a property\nper the spec.\n\n- bpo-27334(146): The *note sqlite3: c9. context manager now performs\na rollback (thus releasing the database lock) if commit failed.\nPatch by Luca Citi and Erlend E. Aasland.\n\n- bpo-4928(147): Documented existing behavior on POSIX:\nNamedTemporaryFiles are not deleted when creating process is killed\nwith SIGKILL\n\n- bpo-44154(148): Optimize *note fractions.Fraction: 1a8. pickling\nfor large components.\n\n- bpo-33433(149): For IPv4 mapped IPv6 addresses ( RFC 4291(150)\nSection 2.5.5.2), the *note ipaddress.IPv6Address.isprivate: 1609.\ncheck is deferred to the mapped IPv4 address.  This solves a bug\nwhere public mapped IPv4 addresses were considered private by the\nIPv6 check.\n\n- bpo-44150(151): Add optional 'weights' argument to\nstatistics.fmean().\n\n- bpo-44142(152): *note ast.unparse(): 6fe. will now drop the\nredundant parentheses when tuples used as assignment targets (e.g\nin for loops).\n\n- bpo-44145(153): *note hmac: 65. computations were not releasing the\nGIL while calling the OpenSSL 'HMACUpdate' C API (a new feature in\n3.9).  This unintentionally prevented parallel computation as other\n*note hashlib: 63. algorithms support.\n\n- bpo-44095(154): *note zipfile.Path: 499. now supports *note\nzipfile.Path.stem: 496, *note zipfile.Path.suffixes: 498, and *note\nzipfile.Path.suffix: 497. attributes.\n\n- bpo-44077(155): It's now possible to receive the type of service\n(ToS), a.k.a.  differentiated services (DS), a.k.a.  differentiated\nservices code point (DSCP) and explicit congestion notification\n(ECN) IP header fields with 'socket.IPRECVTOS'.\n\n- bpo-37788(156): Fix a reference leak when a Thread object is never\njoined.\n\n- bpo-38908(157): Subclasses of 'typing.Protocol' which only have\ndata variables declared will now raise a 'TypeError' when checked\nwith 'isinstance' unless they are decorated with\n'runtimecheckable()'.  Previously, these checks passed silently.\nPatch provided by Yurii Karabas.\n\n- bpo-44098(158): 'typing.ParamSpec' will no longer be found in the\n'parameters' of most *note typing: ff. generics except in valid\nuse locations specified by PEP 612(159).  This prevents incorrect\nusage like 'typing.List[P][int]'.  This change means incorrect\nusage which may have passed silently in 3.10 beta 1 and earlier\nwill now error.\n\n- bpo-44089(160): Allow subclassing 'csv.Error' in 3.10 (it was\nallowed in 3.9 and earlier but was disallowed in early versions of\n3.10).\n\n- bpo-44081(161): *note ast.unparse(): 6fe. now doesn't use redundant\nspaces to separate 'lambda' and the ':' if there are no parameters.\n\n- bpo-44061(162): Fix regression in previous release when calling\n*note pkgutil.itermodules(): ba3. with a list of *note\npathlib.Path: 149. objects\n\n- bpo-44059(163): Register the SerenityOS Browser in the *note\nwebbrowser: 110. module.\n\n- bpo-36515(164): The *note hashlib: 63. module no longer does\nunaligned memory accesses when compiled for ARM platforms.\n\n- bpo-40465(165): Remove random module features deprecated in Python\n3.9.\n\n- bpo-44018(166): random.seed() no longer mutates bytearray inputs.\n\n- bpo-38352(167): Add 'IO', 'BinaryIO', 'TextIO', 'Match', and\n'Pattern' to 'typing.all'.  Patch by Jelle Zijlstra.\n\n- bpo-44002(168): *note urllib.parse: 105. now uses\n'functool.lrucache()' for its internal URL splitting and quoting\ncaches instead of rolling its own like its the '90s.\n\nThe undocumented internal *note urllib.parse: 105. 'Quoted' class\nAPI is now deprecated, for removal in 3.14.\n\n- bpo-43972(169): When *note http.server.SimpleHTTPRequestHandler:\n97d. sends a '301 (Moved Permanently)' for a directory path not\nending with '/', add a 'Content-Length: 0' header.  This improves\nthe behavior for certain clients.\n\n- bpo-28528(170): Fix a bug in *note pdb: a0. where 'checkline()'\nraises *note AttributeError: 395. if it is called after 'reset()'.\n\n- bpo-43853(171): Improved string handling for *note sqlite3: c9.\nuser-defined functions and aggregates:\n\n* It is now possible to pass strings with embedded null\ncharacters to UDFs\n\n* Conversion failures now correctly raise *note MemoryError:\n13e3.\n\nPatch by Erlend E. Aasland.\n\n- bpo-43666(172): AIX: 'Lib/aixsupport.getplatform()' may fail in\nan AIX WPAR. The fileset bos.rte appears to have a builddate in\nboth LPAR and WPAR so this fileset is queried rather than bos.mp64.\nTo prevent a similar situation (no builddate in ODM) a value (9988)\nsufficient for completing a build is provided.  Patch by M Felt.\n\n- bpo-43650(173): Fix *note MemoryError: 13e3. in *note\nshutil.unpackarchive(): 184. which fails inside\n'shutil.unpackzipfile()' on large files.  Patch by Igor\nBolshakov.\n\n- bpo-43612(174): *note zlib.compress(): b5e. now accepts a wbits\nparameter which allows users to compress data as a raw deflate\nblock without zlib headers and trailers in one go.  Previously this\nrequired instantiating a 'zlib.compressobj'.  It also provides a\nfaster alternative to 'gzip.compress' when wbits=31 is used.\n\n- bpo-43392(175): 'importlib.bootstrap.findandload()' now\nimplements a two-step check to avoid locking when modules have been\nalready imported and are ready.  This improves performance of\nrepeated calls to *note importlib.importmodule(): 26a. and *note\nimportlib.import(): ee4.\n\n- bpo-43318(176): Fix a bug where *note pdb: a0. does not always echo\ncleared breakpoints.\n\n- bpo-43234(177): Prohibit passing non-*note\nconcurrent.futures.ThreadPoolExecutor: 529. executors to\n'loop.setdefaultexecutor()' following a deprecation in Python\n3.8.  Patch by Illia Volochii.\n\n- bpo-43232(178): Prohibit previously deprecated potentially\ndisruptive operations on 'asyncio.trsock.TransportSocket'.  Patch\nby Illia Volochii.\n\n- bpo-30077(179): Added support for Apple's aifc/sowt\npseudo-compression\n\n- bpo-42971(180): Add definition of 'errno.EQFULL' for platforms that\ndefine this constant (such as macOS).\n\n- bpo-43086(181): Added a new optional 'strictmode' parameter to\n'binascii.a2bbase64'.  When 'scrictmode' is set to 'True', the\n'a2bbase64' function will accept only valid base64 content.  More\ndetails about what \"valid base64 content\" is, can be found in the\nfunction's documentation.\n\n- bpo-43024(182): Improve the help signature of *note\ntraceback.printexception(): 645, *note\ntraceback.formatexception(): 643. and *note\ntraceback.formatexceptiononly(): 644.\n\n- bpo-33809(183): Add the *note traceback.TracebackException.print():\n470. method which prints the formatted exception information.\n\n- bpo-42862(184): *note sqlite3: c9. now utilizes *note\nfunctools.lrucache(): 815. to implement the connection statement\ncache.  As a small optimisation, the default statement cache size\nhas been increased from 100 to 128.  Patch by Erlend E. Aasland.\n\n- bpo-41818(185): Soumendra Ganguly: add termios.tcgetwinsize(),\ntermios.tcsetwinsize().\n\n- bpo-40497(186): *note subprocess.checkoutput(): e31. now raises\n*note ValueError: 183. when the invalid keyword argument 'check' is\npassed by user code.  Previously such use would fail later with a\n*note TypeError: 28e.  Patch by Re'mi Lapeyre.\n\n- bpo-37449(187): 'ensurepip' now uses 'importlib.resources.files()'\ntraversable APIs\n\n- bpo-40956(188): Use Argument Clinic in *note sqlite3: c9.  Patches\nby Erlend E. Aasland.\n\n- bpo-41730(189): 'DeprecationWarning' is now raised when importing\n*note tkinter.tix: f3, which has been deprecated in documentation\nsince Python 3.6.\n\n- bpo-20684(190): Remove unused 'signaturegetboundparam' function\nfrom *note inspect: 78. - by Anthony Sottile.\n\n- bpo-41402(191): Fix *note email.message.EmailMessage.setcontent():\n160a. when called with binary data and '7bit' content transfer\nencoding.\n\n- bpo-32695(192): The 'compresslevel' and 'preset' keyword arguments\nof *note tarfile.open(): cdb. are now both documented and tested.\n\n- bpo-41137(193): Use utf-8 encoding while reading .pdbrc files.\nPatch by Srinivas Reddy Thatiparthy\n\n- bpo-24391(194): Improved reprs of *note threading: e7.\nsynchronization objects: *note Semaphore: fcb, *note\nBoundedSemaphore: fcc, *note Event: fcd. and *note Barrier: 1057.\n\n- bpo-5846(195): Deprecated the following *note unittest: 101.\nfunctions, scheduled for removal in Python 3.13:\n\n* 'findTestCases()'\n\n* 'makeSuite()'\n\n* 'getTestCaseNames()'\n\nUse *note TestLoader: 506. methods instead:\n\n* *note unittest.TestLoader.loadTestsFromModule(): 285.\n\n* *note unittest.TestLoader.loadTestsFromTestCase(): 507.\n\n* *note unittest.TestLoader.getTestCaseNames(): 508.\n\nPatch by Erlend E. Aasland.\n\n- bpo-40563(196): Support pathlike objects on dbm/shelve.  Patch by\nHakan C,elik and Henry-Joseph Aude'oud.\n\n- bpo-34990(197): Fixed a Y2k38 bug in the compileall module where it\nwould fail to compile files with a modification time after the year\n2038.\n\n- bpo-39549(198): Whereas the code for reprlib.Repr had previously\nused a hardcoded string value of '...', this PR updates it to use of\na \"fillvalue\" attribute, whose value defaults to '...' and can be\nreset in either individual reprlib.Repr instances or in subclasses\nthereof.\n\n- bpo-37022(199): *note pdb: a0. now displays exceptions from\n'repr()' with its 'p' and 'pp' commands.\n\n- bpo-38840(200): Fix 'testall' on platforms lacking a shared\nmemory implementation.\n\n- bpo-39359(201): Add one missing check that the password is a bytes\nobject for an encrypted zipfile.\n\n- bpo-38741(202): *note configparser: 20.: using ']' inside a section\nheader will no longer cut the section name short at the ']'\n\n- bpo-38415(203): Added missing behavior to *note\ncontextlib.asynccontextmanager(): 963. to match *note\ncontextlib.contextmanager(): 1076. so decorated functions can\nthemselves be decorators.\n\n- bpo-30256(204): Pass multiprocessing BaseProxy argument\n'managerowned' through AutoProxy.\n\n- bpo-27513(205): *note email.utils.getaddresses(): 1428. now accepts\n*note email.header.Header: 160b. objects along with string values.\nPatch by Zackery Spytz.\n\n- bpo-16379(206): Add SQLite error code and name to *note sqlite3:\nc9. exceptions.  Patch by Aviv Palivoda, Daniel Shahaf, and Erlend\nE. Aasland.\n\n- bpo-26228(207): pty.spawn no longer hangs on FreeBSD, macOS, and\nSolaris.\n\n- bpo-33349(208): lib2to3 now recognizes async generators everywhere.\n\n- bpo-29298(209): Fix 'TypeError' when required subparsers without\n'dest' do not receive arguments.  Patch by Anthony Sottile.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=45371\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=45329\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=41710\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=1596321\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=45274\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=21302\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=21302\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=45238\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=36674\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=45235\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=45183\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=45234\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=45228\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=45225\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=42135\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=20524\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=45168\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=21302\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=45173\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=44987\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=35474\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=45166\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=45162\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=38371\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=20499\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=45132\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=45129\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=45124\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=30856\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=45034\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=25894\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=45081\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=45085\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=40360\n\n(35) https://peps.python.org/pep-0617/\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=45075\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=31299\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=41620\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=45021\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=43913\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=45030\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=45001\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=45010\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=39218\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=43613\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=37596\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=44019\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=42255\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=44955\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=39039\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=44935\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=44911\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=41322\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=44524\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=38956\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=44860\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=44859\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=44581\n\n(59) https://bugs.python.org/issue?@action=redirect&bpo=44849\n\n(60) https://bugs.python.org/issue?@action=redirect&bpo=44605\n\n(61) https://bugs.python.org/issue?@action=redirect&bpo=44524\n\n(62) https://bugs.python.org/issue?@action=redirect&bpo=44839\n\n(63) https://bugs.python.org/issue?@action=redirect&bpo=44822\n\n(64) https://bugs.python.org/issue?@action=redirect&bpo=44801\n\n(65) https://bugs.python.org/issue?@action=redirect&bpo=44806\n\n(66) https://bugs.python.org/issue?@action=redirect&bpo=27275\n\n(67) https://bugs.python.org/issue?@action=redirect&bpo=44793\n\n(68) https://bugs.python.org/issue?@action=redirect&bpo=44784\n\n(69) https://bugs.python.org/issue?@action=redirect&bpo=44667\n\n(70) https://bugs.python.org/issue?@action=redirect&bpo=44771\n\n(71) https://bugs.python.org/issue?@action=redirect&bpo=44752\n\n(72) https://bugs.python.org/issue?@action=redirect&bpo=44747\n\n(73) https://bugs.python.org/issue?@action=redirect&bpo=42378\n\n(74) https://bugs.python.org/issue?@action=redirect&bpo=44720\n\n(75) https://bugs.python.org/issue?@action=redirect&bpo=44704\n\n(76) https://bugs.python.org/issue?@action=redirect&bpo=44666\n\n(77) https://bugs.python.org/issue?@action=redirect&bpo=44688\n\n(78) https://bugs.python.org/issue?@action=redirect&bpo=44690\n\n(79) https://bugs.python.org/issue?@action=redirect&bpo=42854\n\n(80) https://bugs.python.org/issue?@action=redirect&bpo=44686\n\n(81) https://bugs.python.org/issue?@action=redirect&bpo=44353\n\n(82) https://bugs.python.org/issue?@action=redirect&bpo=44682\n\n(83) https://bugs.python.org/issue?@action=redirect&bpo=44353\n\n(84) https://bugs.python.org/issue?@action=redirect&bpo=44678\n\n(85) https://bugs.python.org/issue?@action=redirect&bpo=44524\n\n(86) https://bugs.python.org/issue?@action=redirect&bpo=40897\n\n(87) https://bugs.python.org/issue?@action=redirect&bpo=44638\n\n(88) https://bugs.python.org/issue?@action=redirect&bpo=44648\n\n(89) https://bugs.python.org/issue?@action=redirect&bpo=44608\n\n(90) https://bugs.python.org/issue?@action=redirect&bpo=44594\n\n(91) https://bugs.python.org/issue?@action=redirect&bpo=42799\n\n(92) https://bugs.python.org/issue?@action=redirect&bpo=41928\n\n(93) https://bugs.python.org/issue?@action=redirect&bpo=44569\n\n(94) https://bugs.python.org/issue?@action=redirect&bpo=44566\n\n(95) https://bugs.python.org/issue?@action=redirect&bpo=44558\n\n(96) https://bugs.python.org/issue?@action=redirect&bpo=41249\n\n(97) https://bugs.python.org/issue?@action=redirect&bpo=44554\n\n(98) https://bugs.python.org/issue?@action=redirect&bpo=34798\n\n(99) https://bugs.python.org/issue?@action=redirect&bpo=44539\n\n(100) https://bugs.python.org/issue?@action=redirect&bpo=44461\n\n(101) https://bugs.python.org/issue?@action=redirect&bpo=43625\n\n(102) https://bugs.python.org/issue?@action=redirect&bpo=44516\n\n(103) https://bugs.python.org/issue?@action=redirect&bpo=42892\n\n(104) https://bugs.python.org/issue?@action=redirect&bpo=44468\n\n(105) https://bugs.python.org/issue?@action=redirect&bpo=44491\n\n(106) https://bugs.python.org/issue?@action=redirect&bpo=43977\n\n(107) https://bugs.python.org/issue?@action=redirect&bpo=44482\n\n(108) https://bugs.python.org/issue?@action=redirect&bpo=44466\n\n(109) https://bugs.python.org/issue?@action=redirect&bpo=44471\n\n(110) https://bugs.python.org/issue?@action=redirect&bpo=44404\n\n(111) https://bugs.python.org/issue?@action=redirect&bpo=41546\n\n(112) https://bugs.python.org/issue?@action=redirect&bpo=44458\n\n(113) https://bugs.python.org/issue?@action=redirect&bpo=44464\n\n(114) https://bugs.python.org/issue?@action=redirect&bpo=44446\n\n(115) https://bugs.python.org/issue?@action=redirect&bpo=44439\n\n(116) https://bugs.python.org/issue?@action=redirect&bpo=44434\n\n(117) https://bugs.python.org/issue?@action=redirect&bpo=42972\n\n(118) https://bugs.python.org/issue?@action=redirect&bpo=44422\n\n(119) https://bugs.python.org/issue?@action=redirect&bpo=38291\n\n(120) https://bugs.python.org/issue?@action=redirect&bpo=37880\n\n(121) https://bugs.python.org/issue?@action=redirect&bpo=44389\n\n(122) https://bugs.python.org/issue?@action=redirect&bpo=27827\n\n(123) https://bugs.python.org/issue?@action=redirect&bpo=44395\n\n(124) https://bugs.python.org/issue?@action=redirect&bpo=34266\n\n(125) https://bugs.python.org/issue?@action=redirect&bpo=44362\n\n(126) https://bugs.python.org/issue?@action=redirect&bpo=44342\n\n(127) https://bugs.python.org/issue?@action=redirect&bpo=44356\n\n(128) https://bugs.python.org/issue?@action=redirect&bpo=44351\n\n(129) https://bugs.python.org/issue?@action=redirect&bpo=35800\n\n(130) https://bugs.python.org/issue?@action=redirect&bpo=44357\n\n(131) https://bugs.python.org/issue?@action=redirect&bpo=44339\n\n(132) https://bugs.python.org/issue?@action=redirect&bpo=44242\n\n(133) https://bugs.python.org/issue?@action=redirect&bpo=44246\n\n(134) https://bugs.python.org/issue?@action=redirect&bpo=44246\n\n(135) https://bugs.python.org/issue?@action=redirect&bpo=43858\n\n(136) https://bugs.python.org/issue?@action=redirect&bpo=44260\n\n(137) https://bugs.python.org/issue?@action=redirect&bpo=44254\n\n(138) https://bugs.python.org/issue?@action=redirect&bpo=44258\n\n(139) https://bugs.python.org/issue?@action=redirect&bpo=44235\n\n(140) https://bugs.python.org/issue?@action=redirect&bpo=38693\n\n(141) https://bugs.python.org/issue?@action=redirect&bpo=33693\n\n(142) https://bugs.python.org/issue?@action=redirect&bpo=44241\n\n(143) https://bugs.python.org/issue?@action=redirect&bpo=43216\n\n(144) https://bugs.python.org/issue?@action=redirect&bpo=44210\n\n(145) https://bugs.python.org/issue?@action=redirect&bpo=43643\n\n(146) https://bugs.python.org/issue?@action=redirect&bpo=27334\n\n(147) https://bugs.python.org/issue?@action=redirect&bpo=4928\n\n(148) https://bugs.python.org/issue?@action=redirect&bpo=44154\n\n(149) https://bugs.python.org/issue?@action=redirect&bpo=33433\n\n(150) https://datatracker.ietf.org/doc/html/rfc4291.html\n\n(151) https://bugs.python.org/issue?@action=redirect&bpo=44150\n\n(152) https://bugs.python.org/issue?@action=redirect&bpo=44142\n\n(153) https://bugs.python.org/issue?@action=redirect&bpo=44145\n\n(154) https://bugs.python.org/issue?@action=redirect&bpo=44095\n\n(155) https://bugs.python.org/issue?@action=redirect&bpo=44077\n\n(156) https://bugs.python.org/issue?@action=redirect&bpo=37788\n\n(157) https://bugs.python.org/issue?@action=redirect&bpo=38908\n\n(158) https://bugs.python.org/issue?@action=redirect&bpo=44098\n\n(159) https://peps.python.org/pep-0612/\n\n(160) https://bugs.python.org/issue?@action=redirect&bpo=44089\n\n(161) https://bugs.python.org/issue?@action=redirect&bpo=44081\n\n(162) https://bugs.python.org/issue?@action=redirect&bpo=44061\n\n(163) https://bugs.python.org/issue?@action=redirect&bpo=44059\n\n(164) https://bugs.python.org/issue?@action=redirect&bpo=36515\n\n(165) https://bugs.python.org/issue?@action=redirect&bpo=40465\n\n(166) https://bugs.python.org/issue?@action=redirect&bpo=44018\n\n(167) https://bugs.python.org/issue?@action=redirect&bpo=38352\n\n(168) https://bugs.python.org/issue?@action=redirect&bpo=44002\n\n(169) https://bugs.python.org/issue?@action=redirect&bpo=43972\n\n(170) https://bugs.python.org/issue?@action=redirect&bpo=28528\n\n(171) https://bugs.python.org/issue?@action=redirect&bpo=43853\n\n(172) https://bugs.python.org/issue?@action=redirect&bpo=43666\n\n(173) https://bugs.python.org/issue?@action=redirect&bpo=43650\n\n(174) https://bugs.python.org/issue?@action=redirect&bpo=43612\n\n(175) https://bugs.python.org/issue?@action=redirect&bpo=43392\n\n(176) https://bugs.python.org/issue?@action=redirect&bpo=43318\n\n(177) https://bugs.python.org/issue?@action=redirect&bpo=43234\n\n(178) https://bugs.python.org/issue?@action=redirect&bpo=43232\n\n(179) https://bugs.python.org/issue?@action=redirect&bpo=30077\n\n(180) https://bugs.python.org/issue?@action=redirect&bpo=42971\n\n(181) https://bugs.python.org/issue?@action=redirect&bpo=43086\n\n(182) https://bugs.python.org/issue?@action=redirect&bpo=43024\n\n(183) https://bugs.python.org/issue?@action=redirect&bpo=33809\n\n(184) https://bugs.python.org/issue?@action=redirect&bpo=42862\n\n(185) https://bugs.python.org/issue?@action=redirect&bpo=41818\n\n(186) https://bugs.python.org/issue?@action=redirect&bpo=40497\n\n(187) https://bugs.python.org/issue?@action=redirect&bpo=37449\n\n(188) https://bugs.python.org/issue?@action=redirect&bpo=40956\n\n(189) https://bugs.python.org/issue?@action=redirect&bpo=41730\n\n(190) https://bugs.python.org/issue?@action=redirect&bpo=20684\n\n(191) https://bugs.python.org/issue?@action=redirect&bpo=41402\n\n(192) https://bugs.python.org/issue?@action=redirect&bpo=32695\n\n(193) https://bugs.python.org/issue?@action=redirect&bpo=41137\n\n(194) https://bugs.python.org/issue?@action=redirect&bpo=24391\n\n(195) https://bugs.python.org/issue?@action=redirect&bpo=5846\n\n(196) https://bugs.python.org/issue?@action=redirect&bpo=40563\n\n(197) https://bugs.python.org/issue?@action=redirect&bpo=34990\n\n(198) https://bugs.python.org/issue?@action=redirect&bpo=39549\n\n(199) https://bugs.python.org/issue?@action=redirect&bpo=37022\n\n(200) https://bugs.python.org/issue?@action=redirect&bpo=38840\n\n(201) https://bugs.python.org/issue?@action=redirect&bpo=39359\n\n(202) https://bugs.python.org/issue?@action=redirect&bpo=38741\n\n(203) https://bugs.python.org/issue?@action=redirect&bpo=38415\n\n(204) https://bugs.python.org/issue?@action=redirect&bpo=30256\n\n(205) https://bugs.python.org/issue?@action=redirect&bpo=27513\n\n(206) https://bugs.python.org/issue?@action=redirect&bpo=16379\n\n(207) https://bugs.python.org/issue?@action=redirect&bpo=26228\n\n(208) https://bugs.python.org/issue?@action=redirect&bpo=33349\n\n(209) https://bugs.python.org/issue?@action=redirect&bpo=29298\n\nFile: python3.12.info,  Node: Documentation<26>,  Next: Tests<24>,  Prev: Library<26>,  Up: Python 3 11 0 alpha 1\n\n1.22.26.4 Documentation\n.......................\n\n- bpo-45216(1): Remove extra documentation listing methods in\n'difflib'.  It was rendering twice in pydoc and was outdated in\nsome places.\n\n- bpo-45024(2): *note collections.abc: 1c. documentation has been\nexpanded to explicitly cover how instance and subclass checks work,\nwith additional doctest examples and an exhaustive list of ABCs\nwhich test membership purely by presence of the right *note special\nmethod: 160d.s.  Patch by Raymond Hettinger.\n\n- bpo-44957(3): Promote PEP 604 union syntax by using it where\npossible.  Also, mention 'X | Y' more prominently in section about\n'Union' and mention 'X | None' at all in section about 'Optional'.\n\n- bpo-16580(4): Added code equivalents for the *note int.tobytes():\n15f2. and *note int.frombytes(): 15b3. methods, as well as tests\nensuring that these code equivalents are valid.\n\n- bpo-44903(5): Removed the 'othergui.rst' file, any references to\nit, and the list of GUI frameworks in the FAQ. In their place I've\nadded links to the Python Wiki page on GUI frameworks(6).\n\n- bpo-33479(7): Tkinter documentation has been greatly expanded with\nnew \"Architecture\" and \"Threading model\" sections.\n\n- bpo-36700(8): *note base64: c. RFC references were updated to point\nto RFC 4648(9); a section was added to point users to the new\n\"security considerations\" section of the RFC.\n\n- bpo-44740(10): Replaced occurrences of uppercase \"Web\" and\n\"Internet\" with lowercase versions per the 2016 revised Associated\nPress Style Book.\n\n- bpo-44693(11): Update the definition of future in the glossary\nby replacing the confusing word \"pseudo-module\" with a more\naccurate description.\n\n- bpo-35183(12): Add typical examples to os.path.splitext docs\n\n- bpo-30511(13): Clarify that *note shutil.makearchive(): 1d4. is\nnot thread-safe due to reliance on changing the current working\ndirectory.\n\n- bpo-44561(14): Update of three expired hyperlinks in\nDoc/distributing/index.rst: \"Project structure\", \"Building and\npackaging the project\", and \"Uploading the project to the Python\nPackaging Index\".\n\n- bpo-44651(15): Delete entry \"coercion\" in Doc/glossary.rst for its\noutdated definition.\n\n- bpo-42958(16): Updated the docstring and docs of *note\nfilecmp.cmp(): 160e. to be more accurate and less confusing\nespecially in respect to 'shallow' arg.\n\n- bpo-44631(17): Refactored the 'repr()' code of the 'Environ' (os\nmodule).\n\n- bpo-44613(18): importlib.metadata is no longer provisional.\n\n- bpo-44558(19): Match the docstring and python implementation of\n*note countOf(): 6f5. to the behavior of its c implementation.\n\n- bpo-44544(20): List all kwargs for *note textwrap.wrap(): 131e,\n*note textwrap.fill(): 131d, and *note textwrap.shorten(): e43.\nNow, there are nav links to attributes of 'TextWrap', which makes\nnavigation much easier while minimizing duplication in the\ndocumentation.\n\n- bpo-38062(21): Clarify that atexit uses equality comparisons\ninternally.\n\n- bpo-40620(22): Convert examples in tutorial controlflow.rst section\n4.3 to be interpreter-demo style.\n\n- bpo-43066(23): Added a warning to *note zipfile: 12b. docs:\nfilename arg with a leading slash may cause archive to be\nun-openable on Windows systems.\n\n- bpo-39452(24): Rewrote 'Doc/library/main.rst'.  Broadened scope\nof the document to explicitly discuss and differentiate between\n'main.py' in packages versus the 'name == 'main''\nexpression (and the idioms that surround it).\n\n- bpo-13814(25): In the Design FAQ, answer \"Why don't generators\nsupport the with statement?\"\n\n- bpo-27752(26): Documentation of csv.Dialect is more descriptive.\n\n- bpo-44453(27): Fix documentation for the return type of *note\nsysconfig.getpath(): 11a6.\n\n- bpo-44392(28): Added a new section in the C API documentation for\ntypes used in type hinting.  Documented 'PyGenericAlias' and\n'PyGenericAliasType'.\n\n- bpo-38291(29): Mark 'typing.io' and 'typing.re' as deprecated since\nPython 3.8 in the documentation.  They were never properly\nsupported by type checkers.\n\n- bpo-44322(30): Document that SyntaxError args have a details tuple\nand that details are adjusted for errors in f-string field\nreplacement expressions.\n\n- bpo-42392(31): Document the deprecation and removal of the 'loop'\nparameter for many functions and classes in *note asyncio: 9.\n\n- bpo-44195(32): Corrected references to 'TraversableResources' in\ndocs.  There is no 'TraversableReader'.\n\n- bpo-41963(33): Document that 'ConfigParser' strips off comments\nwhen reading configuration files.\n\n- bpo-44072(34): Correct where in the numeric ABC hierarchy ''\nsupport is added, i.e., in numbers.Complex, not numbers.Integral.\n\n- bpo-43558(35): Add the remark to *note dataclasses: 2d.\ndocumentation that the 'init()' of any base class has to be\ncalled in 'postinit()', along with a code example.\n\n- bpo-44025(36): Clarify when '' in match statements is a keyword,\nand when not.\n\n- bpo-41706(37): Fix docs about how methods like 'add' are\ninvoked when evaluating operator expressions.\n\n- bpo-41621(38): Document that *note collections.defaultdict: 1031.\nparameter 'defaultfactory' defaults to None and is\npositional-only.\n\n- bpo-41576(39): document BaseException in favor of bare except\n\n- bpo-21760(40): The description for file fixed.  Patch by Furkan\nOnder\n\n- bpo-39498(41): Add a \"Security Considerations\" index which links to\nstandard library modules that have explicitly documented security\nconsiderations.\n\n- bpo-33479(42): Remove the unqualified claim that tkinter is\nthreadsafe.  It has not been true for several years and likely\nnever was.  An explanation of what is true may be added later,\nafter more discussion, and possibly after patching tkinter.c,\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=45216\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=45024\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=44957\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=16580\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=44903\n\n(6) https://wiki.python.org/moin/GuiProgramming\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=33479\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=36700\n\n(9) https://datatracker.ietf.org/doc/html/rfc4648.html\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=44740\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=44693\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=35183\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=30511\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=44561\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=44651\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=42958\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=44631\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=44613\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=44558\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=44544\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=38062\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=40620\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=43066\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=39452\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=13814\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=27752\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=44453\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=44392\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=38291\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=44322\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=42392\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=44195\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=41963\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=44072\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=43558\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=44025\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=41706\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=41621\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=41576\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=21760\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=39498\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=33479\n\nFile: python3.12.info,  Node: Tests<24>,  Next: Build<24>,  Prev: Documentation<26>,  Up: Python 3 11 0 alpha 1\n\n1.22.26.5 Tests\n...............\n\n- bpo-40173(1): Fix *note\ntest.support.importhelper.importfreshmodule(): 1610.\n\n- bpo-45280(2): Add a test case for empty *note typing.NamedTuple:\n1f9.\n\n- bpo-45269(3): Cover case when invalid 'markers' type is supplied to\n'cmakeencoder'.\n\n- bpo-45128(4): Fix 'testmultiprocessingfork' failure due to\n'testlogging' and 'sys.modules' manipulation.\n\n- bpo-45209(5): Fix 'UserWarning: resourcetracker' warning in\n'testmultiprocessing.TestSharedMemory.testsharedmemorycleanedafterprocesstermination'\n\n- bpo-45185(6): Enables 'TestEnumerations' test cases in 'testssl'\nsuite.\n\n- bpo-45195(7): Fix testreadline.testnonascii(): sometimes, the\nnewline character is not written at the end, so don't expect it in\nthe output.  Patch by Victor Stinner.\n\n- bpo-45156(8): Fixes infinite loop on *note unittest.mock.seal():\n9e4. of mocks created by 'createautospec()'.\n\n- bpo-45125(9): Improves pickling tests and docs of 'SharedMemory'\nand 'SharableList' objects.\n\n- bpo-44860(10): Update 'testsysconfig.testusersimilar()' for the\nposixuser scheme: 'platlib' doesn't use *note sys.platlibdir: 756.\nPatch by Victor Stinner.\n\n- bpo-45052(11):\n'WithProcessesTestSharedMemory.testsharedmemorybasics' test was\nignored, because 'self.assertEqual(sms.size, sms2.size)' line was\nfailing.  It is now removed and test is unskipped.\n\nThe main motivation for this line to be removed from the test is\nthat the 'size' of 'SharedMemory' is not ever guaranteed to be the\nsame.  It is decided by the platform.\n\n- bpo-44895(12): libregrtest now clears the type cache later to\nreduce the risk of false alarm when checking for reference leaks.\nPreviously, the type cache was cleared too early and libregrtest\nraised a false alarm about reference leaks under very specific\nconditions.  Patch by Irit Katriel and Victor Stinner.\n\n- bpo-45042(13): Fixes that test classes decorated with\n'@hashlibhelper.requireshashdigest' were skipped all the time.\n\n- bpo-25130(14): Add calls of *note gc.collect(): 865. in tests to\nsupport PyPy.\n\n- bpo-45011(15): Made tests relying on the 'asyncio' C extension\nmodule optional to allow running on alternative Python\nimplementations.  Patch by Serhiy Storchaka.\n\n- bpo-44949(16): Fix auto history tests of testreadline: sometimes,\nthe newline character is not written at the end, so don't expect it\nin the output.\n\n- bpo-44891(17): Tests were added to clarify *note id(): 1279. is\npreserved when 'obj * 1' is used on *note str: 157. and *note\nbytes: 295. objects.  Patch by Nikita Sobolev.\n\n- bpo-44852(18): Add ability to wholesale silence DeprecationWarnings\nwhile running the regression test suite.\n\n- bpo-40928(19): Notify users running testdecimal regression tests\non macOS of potential harmless \"malloc can't allocate region\"\nmessages spewed by testdecimal.\n\n- bpo-44734(20): Fixed floating point precision issue in turtle\ntests.\n\n- bpo-44708(21): Regression tests, when run with -w, are now\nre-running only the affected test methods instead of re-running the\nentire test file.\n\n- bpo-42095(22): Added interop tests for Apple plists: generate plist\nfiles with Python plistlib and parse with Apple plutil; and the\nother way round.\n\n- bpo-44647(23): Added a permanent Unicode-valued environment\nvariable to regression tests to ensure they handle this use case in\nthe future.  If your test environment breaks because of that,\nreport a bug to us, and temporarily set\nPYTHONREGRTESTUNICODEGUARD=0 in your test environment.\n\n- bpo-44515(24): Adjust recently added contextlib tests to avoid\nassuming the use of a refcounted GC\n\n- bpo-44287(25): Fix asyncio testpopen() of testwindowsutils by\nusing a longer timeout.  Use military grade battle-tested *note\ntest.support.SHORTTIMEOUT: 1611. timeout rather than a hardcoded\ntimeout of 10 seconds: it's 30 seconds by default, but it is made\nlonger on slow buildbots.  Patch by Victor Stinner.\n\n- bpo-44451(26): Reset 'DeprecationWarning' filters in\n'test.testimportlib.testmetadataapi.APITests.testentrypointsbyindex'\nto avoid 'StopIteration' error if 'DeprecationWarnings' are\nignored.\n\n- bpo-44363(27): Account for address sanitizer in testcapi.\ntestcapi now passes when run GCC address sanitizer.\n\n- bpo-44364(28): Add non integral tests for *note math.sqrt(): 82e.\nfunction.\n\n- bpo-43921(29): Fix testssl.testwrongcerttls13(): use\n'suppressraggedeofs=False', since 'read()' can raise *note\nssl.SSLEOFError: 1491. on Windows.  Patch by Victor Stinner.\n\n- bpo-43921(30): Fix testpharequirednocert() of testssl: catch\ntwo more EOF cases (when the 'recv()' method returns an empty\nstring).  Patch by Victor Stinner.\n\n- bpo-44131(31): Add testfrozenmain to testembed to test the\n'PyFrozenMain()' C function.  Patch by Victor Stinner.\n\n- bpo-31904(32): Ignore error string case in testfilenotexists().\n\n- bpo-42083(33): Add test to check that 'PyStructSequenceNewType'\naccepts a 'PyStructSequenceDesc' with 'doc' field set to 'NULL'.\n\n- bpo-35753(34): Fix crash in doctest when doctest parses modules\nthat include unwrappable functions by skipping those functions.\n\n- bpo-30256(35): Add test for nested queues when using\n'multiprocessing' shared objects 'AutoProxy[Queue]' inside\n'ListProxy' and 'DictProxy'\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40173\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=45280\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=45269\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=45128\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=45209\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=45185\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=45195\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=45156\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=45125\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=44860\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=45052\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=44895\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=45042\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=25130\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=45011\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=44949\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=44891\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=44852\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=40928\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=44734\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=44708\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=42095\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=44647\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=44515\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=44287\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=44451\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=44363\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=44364\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=43921\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=43921\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=44131\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=42083\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=35753\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=30256\n\nFile: python3.12.info,  Node: Build<24>,  Next: Windows<24>,  Prev: Tests<24>,  Up: Python 3 11 0 alpha 1\n\n1.22.26.6 Build\n...............\n\n- bpo-45220(1): Avoid building with the Windows 11 SDK previews\nautomatically.  This may be overridden by setting the\n'DefaultWindowsSDKVersion' environment variable before building.\n\n- bpo-45020(2): Freeze stdlib modules that are imported during\nstartup.  This provides significant performance improvements to\nstartup.  If necessary, use the previously added \"-X\nfrozenmodules=off\" commandline option to force importing the\nsource modules.\n\n- bpo-45188(3): Windows builds now regenerate frozen modules as the\nfirst part of the build.  Previously the regeneration was later in\nthe build, which would require it to be restarted if any modules\nhad changed.\n\n- bpo-45163(4): Fixes Haiku platform build.\n\n- bpo-45067(5): The ncurses function extendedcolorcontent was\nintroduced in 2017\n\n('https://invisible-island.net/ncurses/NEWS.html#index-t20170401').\nThe\n\nncurses-devel package in CentOS 7 had a older version ncurses\nresulted in compilation error.  For compiling ncurses with extended\ncolor support, we verify the version of the ncurses library >=\n20170401.\n\n- bpo-45019(6): Generate lines in relevant files for frozen modules.\nUp until now each of the files had to be edited manually.  This\nchange makes it easier to add to and modify the frozen modules.\n\n- bpo-44340(7): Add support for building with clang thin lto via\n-with-lto=thin/full.  Patch by Donghee Na and Brett Holman.\n\n- bpo-44535(8): Enable building using a Visual Studio 2022 install on\nWindows.\n\n- bpo-43298(9): Improved error message when building without a\nWindows SDK installed.\n\n- bpo-44381(10): The Windows build now accepts\n'EnableControlFlowGuard' set to 'guard' to enable CFG.\n\n- bpo-41282(11): Fix broken 'make install' that caused standard\nlibrary extension modules to be unnecessarily and incorrectly\nrebuilt during the install phase of cpython.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=45220\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=45020\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=45188\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=45163\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=45067\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=45019\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=44340\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=44535\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=43298\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=44381\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=41282\n\nFile: python3.12.info,  Node: Windows<24>,  Next: macOS<19>,  Prev: Build<24>,  Up: Python 3 11 0 alpha 1\n\n1.22.26.7 Windows\n.................\n\n- bpo-45375(1): Fixes an assertion failure due to searching for the\nstandard library in unnormalised paths.\n\n- bpo-45022(2): Update Windows release to include libffi 3.4.2\n\n- bpo-45007(3): Update to OpenSSL 1.1.1l in Windows build\n\n- bpo-44848(4): Upgrade Windows installer to use SQLite 3.36.0.\n\n- bpo-44572(5): Avoid consuming standard input in the *note platform:\na5. module\n\n- bpo-44582(6): Accelerate speed of *note mimetypes: 8a.\ninitialization using a native implementation of the registry scan.\n\n- bpo-41299(7): Fix 16 milliseconds jitter when using timeouts in\n*note threading: e7, such as with *note threading.Lock.acquire():\n464. or *note threading.Condition.wait(): 1614.\n\n- bpo-42686(8): Build *note sqlite3: c9. with math functions enabled.\nPatch by Erlend E. Aasland.\n\n- bpo-40263(9): This is a follow-on bug from\n'https://bugs.python.org/issue26903'.  Once that is applied we run\ninto an off-by-one assertion problem.  The assert was not correct.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=45375\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=45022\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=45007\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=44848\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=44572\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=44582\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=41299\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=42686\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=40263\n\nFile: python3.12.info,  Node: macOS<19>,  Next: IDLE<12>,  Prev: Windows<24>,  Up: Python 3 11 0 alpha 1\n\n1.22.26.8 macOS\n...............\n\n- bpo-45007(1): Update macOS installer builds to use OpenSSL 1.1.1l.\n\n- bpo-34602(2): When building CPython on macOS with './configure\n--with-undefined-behavior-sanitizer --with-pydebug', the stack size\nis now quadrupled to allow for the entire test suite to pass.\n\n- bpo-44848(3): Update macOS installer to use SQLite 3.36.0.\n\n- bpo-44689(4): *note ctypes.util.findlibrary(): ba2. now works\ncorrectly on macOS 11 Big Sur even if Python is built on an older\nversion of macOS. Previously, when built on older macOS systems,\n'findlibrary' was not able to find macOS system libraries when\nrunning on Big Sur due to changes in how system libraries are\nstored.\n\n- bpo-41972(5): The framework build's user header path in sysconfig\nis changed to add a 'pythonX.Y' component to match distutils's\nbehavior.\n\n- bpo-43109(6): Allow -with-lto configure option to work with\nApple-supplied Xcode or Command Line Tools.\n\n- bpo-34932(7): Add socket.TCPKEEPALIVE support for macOS. Patch by\nShane Harvey.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=45007\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=34602\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=44848\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=44689\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=41972\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=43109\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=34932\n\nFile: python3.12.info,  Node: IDLE<12>,  Next: Tools/Demos<14>,  Prev: macOS<19>,  Up: Python 3 11 0 alpha 1\n\n1.22.26.9 IDLE\n..............\n\n- bpo-45296(1): On Windows, change exit/quit message to suggest\nCtrl-D, which works, instead of <Ctrl-Z Return>, which does not\nwork in IDLE.\n\n- bpo-45193(2): Make completion boxes appear on Ubuntu again.\n\n- bpo-40128(3): Mostly fix completions on macOS when not using tcl/tk\n8.6.11 (as with 3.9).  The added updateidletask call should be\nharmless and possibly helpful otherwise.\n\n- bpo-33962(4): Move the indent space setting from the Font tab to\nthe new Windows tab.  Patch by Mark Roseman and Terry Jan Reedy.\n\n- bpo-40468(5): Split the settings dialog General tab into Windows\nand Shell/ED tabs.  Move help sources, which extend the Help menu,\nto the Extensions tab.  Make space for new options and shorten the\ndialog.  The latter makes the dialog better fit small screens.\n\n- bpo-41611(6): Avoid uncaught exceptions in\n'AutoCompleteWindow.winconfigevent()'.\n\n- bpo-41611(7): Fix IDLE sometimes freezing upon tab-completion on\nmacOS.\n\n- bpo-44010(8): Highlight the new *note match: 601. statement's *note\nsoft keywords: 600.: *note match: 601, *note case: 601, and *note\n: 602.  However, this highlighting is not perfect and will be\nincorrect in some rare cases, including some ''-s in 'case'\npatterns.\n\n- bpo-44026(9): Include interpreter's typo fix suggestions in message\nline for NameErrors and AttributeErrors.  Patch by E. Paine.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=45296\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=45193\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=40128\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=33962\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=40468\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=41611\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=41611\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=44010\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=44026\n\nFile: python3.12.info,  Node: Tools/Demos<14>,  Next: C API<22>,  Prev: IDLE<12>,  Up: Python 3 11 0 alpha 1\n\n1.22.26.10 Tools/Demos\n......................\n\n- bpo-44786(1): Fix a warning in regular expression in the c-analyzer\nscript.\n\n- bpo-44967(2): pydoc now returns a non-zero status code when a\nmodule cannot be found.\n\n- bpo-44978(3): Allow the Argument Clinic tool to handle\n'complex' special methods.\n\n- bpo-43425(4): Removed the 'test2to3' demo project that demonstrated\nusing lib2to3 to support Python 2.x and Python 3.x from a single\nsource in a distutils package.  Patch by Donghee Na\n\n- bpo-44074(5): Make patchcheck automatically detect the correct base\nbranch name (previously it was hardcoded to 'master')\n\n- bpo-20291(6): Added support for variadic positional parameters in\nArgument Clinic.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=44786\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=44967\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=44978\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=43425\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=44074\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=20291\n\nFile: python3.12.info,  Node: C API<22>,  Prev: Tools/Demos<14>,  Up: Python 3 11 0 alpha 1\n\n1.22.26.11 C API\n................\n\n- bpo-41710(1): The PyThreadacquirelocktimed() function now clamps\nthe timeout if it is too large, rather than aborting the process.\nPatch by Victor Stinner.\n\n- bpo-44687(2): 'BufferedReader.peek()' no longer raises *note\nValueError: 183. when the entire file has already been buffered.\n\n- bpo-45116(3): Add the *note PyALWAYSINLINE: 1619. macro to ask\nthe compiler to always inline a static inline function.  The\ncompiler can ignore it and decides to not inline the function.\nPatch by Victor Stinner.\n\n- bpo-45094(4): Add the *note PyNOINLINE: 161a. macro to disable\ninlining on a function.  Patch by Victor Stinner.\n\n- bpo-45061(5): Add a deallocator to the *note bool: 17d. type to\ndetect refcount bugs in C extensions which call\n'PyDECREF(PyTrue);' or 'PyDECREF(PyFalse);' by mistake.  Patch\nby Victor Stinner.\n\n- bpo-42035(6): Add a new *note PyTypeGetQualName(): 53a. function\nto get type's qualified name.\n\n- bpo-41103(7): Reverts removal of the old buffer protocol because\nthey are part of stable ABI.\n\n- bpo-44751(8): Remove 'crypt.h' include from the public 'Python.h'\nheader.\n\n- bpo-42747(9): The 'PyTPFLAGSHAVEVERSIONTAG' type flag now does\nnothing.  The 'PyTPFLAGSHAVEAMSEND' flag (which was added in\n3.10) is removed.  Both were unnecessary because it is not possible\nto have type objects with the relevant fields missing.\n\n- bpo-44530(10): Added the 'coqualname' to the 'PyCodeObject'\nstructure to propagate the qualified name from the compiler to code\nobjects.\n\nPatch by Gabriele N. Tornetta\n\n- bpo-44441(11): *note PyRunMain(): 7e9. now resets\n'PyImportInittab' to its initial value at exit.  It must be\npossible to call *note PyImportAppendInittab(): 14f8. or *note\nPyImportExtendInittab(): 14f9. at each Python initialization.\nPatch by Victor Stinner.\n\n- bpo-39947(12): Remove 4 private trashcan C API functions which were\nonly kept for the backward compatibility of the stable ABI with\nPython 3.8 and older, since the trashcan API was not usable with\nthe limited C API on Python 3.8 and older.  The trashcan API was\nexcluded from the limited C API in Python 3.9.\n\nRemoved functions:\n\n* PyTrashdepositobject()\n\n* PyTrashdestroychain()\n\n* PyTrashthreaddepositobject()\n\n* PyTrashthreaddestroychain()\n\nThe trashcan C API was never usable with the limited C API, since\nold trashcan macros accessed directly *note PyThreadState: 57a.\nmembers like 'tstate->trashdeletenesting', whereas the *note\nPyThreadState: 57a. structure is opaque in the limited C API.\n\nExclude also the 'PyTrashUNWINDLEVEL' constant from the C API.\n\nPatch by Victor Stinner.\n\n- bpo-40939(13): Removed documentation for the removed 'PyParser*' C\nAPI.\n\n- bpo-43795(14): The list in *note Contents of Limited API: 58b. now\nshows the public name *note PyFrameObject: 575. rather than\n'frame'.  The non-existing entry 'node' no longer appears in the\nlist.\n\n- bpo-44378(15): *note PyISTYPE(): 1574. no longer uses *note\nPyTYPE(): 56b. to avoid a compiler warning: no longer cast 'const\nPyObject*' to 'PyObject*'.  Patch by Victor Stinner.\n\n- bpo-39573(16): Convert the *note PyTYPE(): 56b. and *note\nPySIZE(): 56d. macros to static inline functions.  The *note\nPySETTYPE(): 56c. and *note PySETSIZE(): 56e. functions must\nnow be used to set an object type and size.  Patch by Victor\nStinner.\n\n- bpo-44263(17): The *note PyTypeReady(): 567. function now raises\nan error if a type is defined with the *note PyTPFLAGSHAVEGC:\n568. flag set but has no traverse function (*note\nPyTypeObject.tptraverse: 569.).  Patch by Victor Stinner.\n\n- bpo-43795(18): The undocumented function 'PyFrozenMain()' is\nremoved from the Limited API.\n\n- bpo-44113(19): Deprecate the following functions to configure the\nPython initialization:\n\n* 'PySysAddWarnOptionUnicode()'\n\n* 'PySysAddWarnOption()'\n\n* 'PySysAddXOption()'\n\n* 'PySysHasWarnOptions()'\n\n* 'PySetPath()'\n\n* 'PySetProgramName()'\n\n* 'PySetPythonHome()'\n\n* 'PySetStandardStreamEncoding()'\n\n* 'PySetProgramFullPath()'\n\nUse the new *note PyConfig: 318. API of the *note Python\nInitialization Configuration: 581. instead ( PEP 587(20)).\n\n- bpo-44094(21): Remove 'PyErrSetFromErrnoWithUnicodeFilename()',\n'PyErrSetFromWindowsErrWithUnicodeFilename()', and\n'PyErrSetExcFromWindowsErrWithUnicodeFilename()'.  They are not\ndocumented and have been deprecated since Python 3.3.\n\n- bpo-43795(22): *note PyCodecUnregister(): 6a6. is now properly\nexported as a function in the Windows Stable ABI DLL.\n\n- bpo-44029(23): Remove deprecated 'PyUNICODE' APIs:\n'PyUnicodeEncode', 'PyUnicodeEncodeUTF7', 'PyUnicodeEncodeUTF8',\n'PyUnicodeEncodeUTF16', 'PyUnicodeEncodeUTF32',\n'PyUnicodeEncodeLatin1', 'PyUnicodeEncodeMBCS',\n'PyUnicodeEncodeDecimal', 'PyUnicodeEncodeRawUnicodeEscape',\n'PyUnicodeEncodeCharmap', 'PyUnicodeEncodeUnicodeEscape',\n'PyUnicodeTransformDecimalToASCII', 'PyUnicodeTranslateCharmap',\n'PyUnicodeEncodeErrorCreate', 'PyUnicodeTranslateErrorCreate'.\nSee PEP 393(24) and PEP 624(25) for reference.\n\n- bpo-42035(26): Add a new *note PyTypeGetName(): 539. function to\nget type's short name.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=41710\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=44687\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=45116\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=45094\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=45061\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=42035\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=41103\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=44751\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=42747\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=44530\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=44441\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=39947\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=40939\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=43795\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=44378\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=39573\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=44263\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=43795\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=44113\n\n(20) https://peps.python.org/pep-0587/\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=44094\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=43795\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=44029\n\n(24) https://peps.python.org/pep-0393/\n\n(25) https://peps.python.org/pep-0624/\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=42035\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 10 0 beta 1,  Next: Python 3 10 0 alpha 7,  Prev: Python 3 11 0 alpha 1,  Up: Changelog": {
            "content": "'Release date: 2021-05-03'\n\n* Menu:\n\n* Security: Security<15>.\n* Core and Builtins: Core and Builtins<27>.\n* Library: Library<27>.\n* Documentation: Documentation<27>.\n* Tests: Tests<25>.\n* Build: Build<25>.\n* Windows: Windows<25>.\n* macOS: macOS<20>.\n* IDLE: IDLE<13>.\n* C API: C API<23>.\n\nFile: python3.12.info,  Node: Security<15>,  Next: Core and Builtins<27>,  Up: Python 3 10 0 beta 1\n\n1.22.27.1 Security\n..................\n\n- bpo-43434(1): Creating *note sqlite3.Connection: 1d9. objects now\nalso produces 'sqlite3.connect' and 'sqlite3.connect/handle' *note\nauditing events: 161d.  Previously these events were only produced\nby *note sqlite3.connect(): 1da. calls.  Patch by Erlend E.\nAasland.\n\n- bpo-43998(2): The *note ssl: ca. module sets more secure cipher\nsuites defaults.  Ciphers without forward secrecy and with SHA-1\nMAC are disabled by default.  Security level 2 prohibits weak RSA,\nDH, and ECC keys with less than 112 bits of security.  *note\nSSLContext: 278. defaults to minimum protocol version TLS 1.2.\nSettings are based on Hynek Schlawack's research.\n\n- bpo-43882(3): The presence of newline or tab characters in parts of\na URL could allow some forms of attacks.\n\nFollowing the controlling specification for URLs defined by WHATWG\n*note urllib.parse(): 105. now removes ASCII newlines and tabs from\nURLs, preventing such attacks.\n\n- bpo-43472(4): Ensures interpreter-level audit hooks receive the\n'cpython.PyInterpreterStateNew' event when called through the\n'xxsubinterpreters' module.\n\n- bpo-43362(5): Fix invalid free in sha3 module.  The issue was\nintroduced in 3.10.0a1.  Python 3.9 and earlier are not affected.\n\n- bpo-43762(6): Add audit events for 'sqlite3.connect/handle()',\n*note sqlite3.Connection.enableloadextension(): 634, and *note\nsqlite3.Connection.loadextension(): 1dc.  Patch by Erlend E.\nAasland.\n\n- bpo-43756(7): Add new audit event 'glob.glob/2' to incorporate the\nnew 'rootdir' and 'dirfd' arguments added to *note glob.glob():\n5fa. and *note glob.iglob(): 5fb.\n\n- bpo-36384(8): *note ipaddress: 7a. module no longer accepts any\nleading zeros in IPv4 address strings.  Leading zeros are ambiguous\nand interpreted as octal notation by some libraries.  For example\nthe legacy function *note socket.inetaton(): 782. treats leading\nzeros as octal notation.  glibc implementation of modern *note\ninetpton(): 783. does not accept any leading zeros.  For a while\nthe *note ipaddress: 7a. module used to accept ambiguous leading\nzeros.\n\n- bpo-43075(9): Fix Regular Expression Denial of Service (ReDoS)\nvulnerability in *note urllib.request.AbstractBasicAuthHandler:\n161e.  The ReDoS-vulnerable regex has quadratic worst-case\ncomplexity and it allows cause a denial of service when identifying\ncrafted invalid RFCs.  This ReDoS issue is on the client side and\nneeds remote attackers to control the HTTP server.\n\n- bpo-42800(10): Audit hooks are now fired for frame.fcode,\ntraceback.tbframe, and generator code/frame attribute access.\n\n- bpo-37363(11): Add audit events to the *note http.client: 6a.\nmodule.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43434\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=43998\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=43882\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=43472\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=43362\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=43762\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=43756\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=36384\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=43075\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=42800\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=37363\n\nFile: python3.12.info,  Node: Core and Builtins<27>,  Next: Library<27>,  Prev: Security<15>,  Up: Python 3 10 0 beta 1\n\n1.22.27.2 Core and Builtins\n...........................\n\n- bpo-43977(1): Prevent classes being both a sequence and a mapping\nwhen pattern matching.\n\n- bpo-43977(2): Use *note tpflags: 1620. on the class object to\ndetermine if the subject is a sequence or mapping when pattern\nmatching.  Avoids the need to import *note collections.abc: 1c.\nwhen pattern matching.\n\n- bpo-43892(3): Restore proper validation of complex literal value\npatterns when parsing 'match' blocks.\n\n- bpo-43933(4): Set frame.flineno to the line number of the 'with'\nkweyword when executing the call to 'exit'.\n\n- bpo-43933(5): If the current position in a frame has no line number\nthen set the flineno attribute to None, instead of -1, to conform\nto PEP 626.  This should not normally be possible, but might occur\nin some unusual circumstances.\n\n- bpo-43963(6): Importing the 'signal' module in a subinterpreter\nhas no longer side effects.\n\n- bpo-42739(7): The internal representation of line number tables is\nchanged to not use sentinels, and an explicit length parameter is\nadded to the out of process API function\n'PyLineTableInitAddressRange'.  This makes the handling of line\nnumber tables more robust in some circumstances.\n\n- bpo-43908(8): Make *note re: b4. types immutable.  Patch by Erlend\nE. Aasland.\n\n- bpo-43908(9): Make the *note array.array: 18f. type immutable.\nPatch by Erlend E. Aasland.\n\n- bpo-43901(10): Change class and module objects to lazy-create empty\nannotations dicts on demand.  The annotations dicts are stored in\nthe object's dict for backwards compatibility.\n\n- bpo-43892(11): Match patterns now use new dedicated AST nodes\n('MatchValue', 'MatchSingleton', 'MatchSequence', 'MatchStar',\n'MatchMapping', 'MatchClass') rather than reusing expression AST\nnodes.  'MatchAs' and 'MatchOr' are now defined as pattern nodes\nrather than as expression nodes.  Patch by Nick Coghlan.\n\n- bpo-42725(12): Usage of 'await'/'yield'/'yield from' and named\nexpressions within an annotation is now forbidden when PEP 563 is\nactivated.\n\n- bpo-43754(13): When performing structural pattern matching ( PEP\n634(14)), captured names are now left unbound until the 'entire'\npattern has matched successfully.\n\n- bpo-42737(15): Annotations for complex targets (everything beside\nsimple names) no longer cause any runtime effects with 'from\nfuture import annotations'.\n\n- bpo-43914(16): *note SyntaxError: 146. exceptions raised by the\ninterpreter will highlight the full error range of the expression\nthat consistutes the syntax error itself, instead of just where the\nproblem is detected.  Patch by Pablo Galindo.\n\n- bpo-38605(17): Revert making 'from future import annotations'\nthe default.  This follows the Steering Council decision to\npostpone PEP 563 changes to at least Python 3.11.  See the original\nemail for more information regarding the decision:\n'https://mail.python.org/archives/list/python-dev@python.org/thread/CLVXXPQ2T2LQ5MP2Y53VVQFCXYWQJHKZ/'.\nPatch by Pablo Galindo.\n\n- bpo-43475(18): Hashes of NaN values now depend on object identity.\nFormerly, they always hashed to 0 even though NaN values are not\nequal to one another.  Having the same hash for unequal values\ncaused pile-ups in hash tables.\n\n- bpo-43859(19): Improve the error message for *note\nIndentationError: 59a. exceptions.  Patch by Pablo Galindo\n\n- bpo-41323(20): Constant tuple folding in bytecode optimizer now\nreuses tuple in constant table.\n\n- bpo-43846(21): Data stack usage is much reduced for large literal\nand call expressions.\n\n- bpo-38530(22): When printing *note NameError: 144. raised by the\ninterpreter, 'PyErrDisplay()' will offer suggestions of similar\nvariable names in the function that the exception was raised from.\nPatch by Pablo Galindo\n\n- bpo-43823(23): Improve syntax errors for invalid dictionary\nliterals.  Patch by Pablo Galindo.\n\n- bpo-43822(24): Improve syntax errors in the parser for missing\ncommas between expressions.  Patch by Pablo Galindo.\n\n- bpo-43798(25): *note ast.alias: 1621. nodes now include source\nlocation metadata attributes e.g.  lineno, coloffset.\n\n- bpo-43797(26): Improve 'SyntaxError' error messages for invalid\ncomparisons.  Patch by Pablo Galindo.\n\n- bpo-43760(27): Move the flag for checking whether tracing is\nenabled to the C stack, from the heap.  Should speed up dispatch in\nthe interpreter.\n\n- bpo-43682(28): Static methods (*note @staticmethod: 5cc.) and class\nmethods (*note @classmethod: 246.) now inherit the method\nattributes ('module', 'name', 'qualname', 'doc',\n'annotations') and have a new 'wrapped' attribute.  Patch\nby Victor Stinner.\n\n- bpo-43751(29): Fixed a bug where 'anext(ait, default)' would\nerroneously return None.\n\n- bpo-42128(30): *note matchargs: 1622. is no longer allowed to\nbe a list.\n\n- bpo-43683(31): Add GENSTART opcode.  Marks start of generator,\nincluding async, or coroutine and handles sending values to a newly\ncreated generator or coroutine.\n\n- bpo-43105(32): Importlib now resolves relative paths when creating\nmodule spec objects from file locations.\n\n- bpo-43682(33): Static methods (*note @staticmethod: 5cc.) are now\ncallable as regular functions.  Patch by Victor Stinner.\n\n- bpo-42609(34): Prevented crashes in the AST validator and optimizer\nwhen compiling some absurdly long expressions like '\"+0\"*1000000'.\n*note RecursionError: bc6. is now raised instead.\n\n- bpo-38530(35): When printing *note AttributeError: 395,\n'PyErrDisplay()' will offer suggestions of similar attribute names\nin the object that the exception was raised from.  Patch by Pablo\nGalindo\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43977\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=43977\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=43892\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=43933\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=43933\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=43963\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=42739\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=43908\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=43908\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=43901\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=43892\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=42725\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=43754\n\n(14) https://peps.python.org/pep-0634/\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=42737\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=43914\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=38605\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=43475\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=43859\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=41323\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=43846\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=38530\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=43823\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=43822\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=43798\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=43797\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=43760\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=43682\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=43751\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=42128\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=43683\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=43105\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=43682\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=42609\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=38530\n\nFile: python3.12.info,  Node: Library<27>,  Next: Documentation<27>,  Prev: Core and Builtins<27>,  Up: Python 3 10 0 beta 1\n\n1.22.27.3 Library\n.................\n\n- bpo-44015(1): In @dataclass(), raise a TypeError if KWONLY is\nspecified more than once.\n\n- bpo-25478(2): Added a 'total()' method to collections.Counter() to\ncompute the sum of the counts.\n\n- bpo-43733(3): Change *note netrc.netrc: 1624. to use UTF-8 encoding\nbefore using locale encoding.\n\n- bpo-43979(4): Removed an unnecessary list comprehension before\nlooping from *note urllib.parse.parseqsl(): 652.  Patch by\nChristoph Zwerschke and Donghee Na.\n\n- bpo-43993(5): Update bundled pip to 21.1.1.\n\n- bpo-43957(6): [Enum] Deprecate 'TypeError' when non-member is used\nin a containment check; In 3.12 'True' or 'False' will be returned\ninstead, and containment will return 'True' if the value is either\na member of that enum or one of its members' value.\n\n- bpo-42904(7): For backwards compatibility with previous minor\nversions of Python, if *note typing.gettypehints(): 47f. receives\nno namespace dictionary arguments, *note typing.gettypehints():\n47f. will search through the global then local namespaces during\nevaluation of stringized type annotations (string forward\nreferences) inside a class.\n\n- bpo-43945(8): [Enum] Deprecate non-standard mixin format()\nbehavior: in 3.12 the enum member, not the member's value, will be\nused for format() calls.\n\n- bpo-41139(9): Deprecate undocumented 'cgi.log()' API.\n\n- bpo-43937(10): Fixed the *note turtle: fc. module working with\nnon-default root window.\n\n- bpo-43930(11): Update bundled pip to 21.1 and setuptools to 56.0.0\n\n- bpo-43907(12): Fix a bug in the pure-Python pickle implementation\nwhen using protocol 5, where bytearray instances that occur several\ntime in the pickled object graph would incorrectly unpickle into\nrepeated copies of the bytearray object.\n\n- bpo-43926(13): In 'importlib.metadata', provide a uniform interface\nto 'Description', allow for any field to be encoded with multiline\nvalues, remove continuation lines from multiline values, and add a\n'.json' property for easy access to the PEP 566 JSON-compatible\nform.  Sync with 'importlibmetadata 4.0'.\n\n- bpo-43920(14): OpenSSL 3.0.0: *note loadverifylocations(): d52.\nnow returns a consistent error message when cadata contains no\nvalid certificate.\n\n- bpo-43607(15): *note urllib: 103. can now convert Windows paths\nwith '\\\\?\\' prefixes into URL paths.\n\n- bpo-43817(16): Add *note inspect.getannotations(): 606, which\nsafely computes the annotations defined on an object.  It works\naround the quirks of accessing the annotations from various types\nof objects, and makes very few assumptions about the object passed\nin.  *note inspect.getannotations(): 606. can also correctly\nun-stringize stringized annotations.\n\n*note inspect.signature(): 51c, 'inspect.fromcallable()', and\n'inspect.fromfunction()' now call *note inspect.getannotations():\n606. to retrieve annotations.  This means *note\ninspect.signature(): 51c. and 'inspect.fromcallable()' can now\nun-stringize stringized annotations, too.\n\n- bpo-43284(17): platform.win32ver derives the windows version from\nsys.getwindowsversion().platformversion which in turn derives the\nversion from kernel32.dll (which can be of a different version than\nWindows itself).  Therefore change the platform.win32ver to\ndetermine the version using the platform module's syscmdver\nprivate function to return an accurate version.\n\n- bpo-42854(18): The *note ssl: ca. module now uses 'SSLreadex' and\n'SSLwriteex' internally.  The functions support reading and\nwriting of data larger than 2 GB. Writing zero-length data no\nlonger fails with a protocol violation error.\n\n- bpo-42333(19): Port 'ssl' extension module to multiphase\ninitialization.\n\n- bpo-43880(20): *note ssl: ca. now raises DeprecationWarning for\nOPNOSSL/TLS* options, old TLS versions, old protocols, and other\nfeatures that have been deprecated since Python 3.6, 3.7, or\nOpenSSL 1.1.0.\n\n- bpo-41559(21): PEP 612(22) is now implemented purely in Python;\nbuiltin 'types.GenericAlias' objects no longer include\n'typing.ParamSpec' in 'parameters' (with the exception of\n'collections.abc.Callable''s 'GenericAlias').  This means\npreviously invalid uses of 'ParamSpec' (such as 'list[P]') which\nworked in earlier versions of Python 3.10 alpha, will now raise\n'TypeError' during substitution.\n\n- bpo-43867(23): The *note multiprocessing: 8f. 'Server' class now\nexplicitly catches *note SystemExit: b97. and closes the client\nconnection in this case.  It happens when the\n'Server.serveclient()' method reaches the end of file (EOF).\n\n- bpo-40443(24): Remove unused imports: pyclbr no longer uses copy,\nand typing no longer uses ast.  Patch by Victor Stinner.\n\n- bpo-43820(25): Remove an unneeded copy of the namespace passed to\ndataclasses.makedataclass().\n\n- bpo-43787(26): Add 'iter()' method to *note bz2.BZ2File: 775,\n*note gzip.GzipFile: 25e, and *note lzma.LZMAFile: e80.  It makes\niterating them about 2x faster.  Patch by Inada Naoki.\n\n- bpo-43680(27): Deprecate io.OpenWrapper and pyio.OpenWrapper: use\nio.open and pyio.open instead.  Until Python 3.9, pyio.open was\nnot a static method and builtins.open was set to OpenWrapper to not\nbecome a bound method when set to a class variable.  io.open is a\nbuilt-in function whereas pyio.open is a Python function.  In\nPython 3.10, pyio.open() is now a static method, and\nbuiltins.open() is now io.open().\n\n- bpo-43680(28): The Python 'pyio.open()' function becomes a static\nmethod to behave as *note io.open(): 26f. built-in function: don't\nbecome a bound method when stored as a class variable.  It becomes\npossible since static methods are now callable in Python 3.10.\nMoreover, 'pyio.OpenWrapper()' becomes a simple alias to\n'pyio.open()'.  Patch by Victor Stinner.\n\n- bpo-41515(29): Fix *note KeyError: 8cf. raised in *note\ntyping.gettypehints(): 47f. due to synthetic modules that don't\nappear in 'sys.modules'.\n\n- bpo-43776(30): When *note subprocess.Popen: 8c3. args are provided\nas a string or as *note pathlib.Path: 149, the Popen instance repr\nnow shows the right thing.\n\n- bpo-42248(31): [Enum] ensure exceptions raised in 'missing' are\nreleased\n\n- bpo-43744(32): fix issue with enum member name matching the start\nof a private variable name\n\n- bpo-43772(33): Fixed the return value of 'TypeVar.ror'.  Patch\nby Jelle Zijlstra.\n\n- bpo-43764(34): Add matchargs parameter to @dataclass decorator to\nallow suppression of matchargs generation.\n\n- bpo-43799(35): OpenSSL 3.0.0: define 'OPENSSLAPICOMPAT' 1.1.1 to\nsuppress deprecation warnings.  Python requires OpenSSL 1.1.1 APIs.\n\n- bpo-43478(36): Mocks can no longer be used as the specs for other\nMocks.  As a result, an already-mocked object cannot have an\nattribute mocked using 'autospec=True' or be the subject of a\n'createautospec(...)' call.  This can uncover bugs in tests since\nthese Mock-derived Mocks will always pass certain tests (e.g.\n*note isinstance(): 14b.) and builtin assert functions (e.g.\nassertcalledoncewith) will unconditionally pass.\n\n- bpo-43794(37): Add *note ssl.OPIGNOREUNEXPECTEDEOF: 62c.\nconstants (OpenSSL 3.0.0)\n\n- bpo-43785(38): Improve 'bz2.BZ2File' performance by removing the\nRLock from BZ2File.  This makes BZ2File thread unsafe in the face\nof multiple simultaneous readers or writers, just like its\nequivalent classes in *note gzip: 62. and *note lzma: 85. have\nalways been.  Patch by Inada Naoki.\n\n- bpo-43789(39): OpenSSL 3.0.0: Don't call the password callback\nfunction a second time when first call has signaled an error\ncondition.\n\n- bpo-43788(40): The header files for *note ssl: ca. error codes are\nnow OpenSSL version-specific.  Exceptions will now show correct\nreason and library codes.  The 'makessldata.py' script has been\nrewritten to use OpenSSL's text file with error codes.\n\n- bpo-43766(41): Implement PEP 647(42) in the *note typing: ff.\nmodule by adding 'TypeGuard'.\n\n- bpo-25264(43): *note os.path.realpath(): 351. now accepts a\n'strict' keyword-only argument.  When set to 'True', *note OSError:\n613. is raised if a path doesn't exist or a symlink loop is\nencountered.\n\n- bpo-43780(44): In 'importlib.metadata', incorporate changes from\nimportlibmetadata 3.10: Add mtime-based caching during\ndistribution discovery.  Flagged use of dict result from\n'entrypoints()' as deprecated.\n\n- The 'P.args' and 'P.kwargs' attributes of *note typing.ParamSpec:\n163. are now instances of the new classes *note\ntyping.ParamSpecArgs: 5b9. and *note typing.ParamSpecKwargs: 5ba,\nwhich enables a more useful 'repr()'.  Patch by Jelle Zijlstra.\n\n- bpo-43731(45): Add an 'encoding' parameter 'logging.fileConfig()'.\n\n- bpo-43712(46): Add 'encoding' and 'errors' parameters to *note\nfileinput.input(): 5f2. and *note fileinput.FileInput: 51b.\n\n- bpo-38659(47): A 'simpleenum' decorator is added to the 'enum'\nmodule to convert a normal class into an Enum.  'testsimpleenum'\nadded to test simple enums against a corresponding normal Enum.\nStandard library modules updated to use 'simpleenum'.\n\n- bpo-43764(48): Fix an issue where *note matchargs: 1622.\ngeneration could fail for some *note dataclasses: 2d.\n\n- bpo-43752(49): Fix *note sqlite3: c9. regression for zero-sized\nblobs with converters, where 'b\"\"' was returned instead of 'None'.\nThe regression was introduced by PR 24723.  Patch by Erlend E.\nAasland.\n\n- bpo-43655(50): *note tkinter: ea. dialog windows are now recognized\nas dialogs by window managers on macOS and X Window.\n\n- bpo-43723(51): The following 'threading' methods are now deprecated\nand should be replaced:\n\n- 'currentThread' => *note threading.currentthread(): 66b.\n\n- 'activeCount' => *note threading.activecount(): 66c.\n\n- 'Condition.notifyAll' => *note\nthreading.Condition.notifyall(): 66d.\n\n- 'Event.isSet' => *note threading.Event.isset(): 66e.\n\n- 'Thread.setName' => *note threading.Thread.name: 66f.\n\n- 'thread.getName' => *note threading.Thread.name: 66f.\n\n- 'Thread.isDaemon' => *note threading.Thread.daemon: 670.\n\n- 'Thread.setDaemon' => *note threading.Thread.daemon: 670.\n\nPatch by Jelle Zijlstra.\n\n- bpo-2135(52): Deprecate findmodule() and findloader()\nimplementations in importlib and zipimport.\n\n- bpo-43534(53): *note turtle.textinput(): 1625. and *note\nturtle.numinput(): 1626. create now a transient window working on\nbehalf of the canvas window.\n\n- bpo-43532(54): Add the ability to specify keyword-only fields to\ndataclasses.  These fields will become keyword-only arguments to\nthe generated init.\n\n- bpo-43522(55): Fix problem with *note hostnamecheckscommonname:\n9be.  OpenSSL does not copy hostflags from 'struct SSLCTX' to\n'struct SSL'.\n\n- bpo-8978(56): Improve error message for *note tarfile.open(): cdb.\nwhen *note lzma: 85. / *note bz2: 11. are unavailable.  Patch by\nAnthony Sottile.\n\n- bpo-42967(57): Allow *note bytes: 295. 'separator' argument in\n'urllib.parse.parseqs' and 'urllib.parse.parseqsl' when parsing\n*note str: 157. query strings.  Previously, this raised a\n'TypeError'.\n\n- bpo-43296(58): Improve *note sqlite3: c9. error handling:\n'sqlite3valueblob()' errors that set 'SQLITENOMEM' now raise\n*note MemoryError: 13e3.  Patch by Erlend E. Aasland.\n\n- bpo-43312(59): New functions *note\nsysconfig.getpreferredscheme(): 45c. and *note\nsysconfig.getdefaultscheme(): 1585. are added to query a platform\nfor its preferred \"user\", \"home\", and \"prefix\" (default) scheme\nnames.\n\n- bpo-43265(60): Improve *note sqlite3.Connection.backup(): 9bb.\nerror handling.  The error message for non-existent target database\nnames is now 'unknown database <database name>' instead of 'SQL\nlogic error'.  Patch by Erlend E. Aasland.\n\n- bpo-41282(61): Install schemes in 'distutils.command.install' are\nnow loaded from *note sysconfig: d5.\n\n- bpo-41282(62): 'distutils.sysconfig' has been merged to *note\nsysconfig: d5.\n\n- bpo-43176(63): Fixed processing of a dataclass that inherits from a\nfrozen dataclass with no fields.  It is now correctly detected as\nan error.\n\n- bpo-43080(64): *note pprint: a9. now has support for *note\ndataclasses.dataclass: 38d.  Patch by Lewis Gaul.\n\n- bpo-39950(65): Add 'pathlib.Path.hardlinkto()' method that\nsupersedes 'linkto()'.  The new method has the same argument order\nas 'symlinkto()'.\n\n- bpo-42904(66): *note typing.gettypehints(): 47f. now checks the\nlocal namespace of a class when evaluating PEP 563(67) annotations\ninside said class.\n\n- bpo-42269(68): Add 'slots' parameter to 'dataclasses.dataclass'\ndecorator to automatically generate 'slots' for class.  Patch\nprovided by Yurii Karabas.\n\n- bpo-39529(69): Deprecated use of *note asyncio.geteventloop():\n21e. without running event loop.  Emit deprecation warning for\n*note asyncio: 9. functions which implicitly create a *note Future:\na11. or *note Task: 201. objects if there is no running event loop\nand no explicit 'loop' argument is passed: *note ensurefuture():\nac1, *note wrapfuture(): 1627, *note gather(): 3c6, *note\nshield(): 89e, *note ascompleted(): 19b. and constructors of *note\nFuture: a11, *note Task: 201, *note StreamReader: 1628,\n'StreamReaderProtocol'.\n\n- bpo-18369(70): Certificate and PrivateKey classes were added to the\nssl module.  Certificates and keys can now be loaded from memory\nbuffer, too.\n\n- bpo-41486(71): Use a new output buffer management code for *note\nbz2: 11. / *note lzma: 85. / *note zlib: 12d. modules, and add\n'.readall()' function to 'compression.DecompressReader' class.\nThese bring some performance improvements.  Patch by Ma Lin.\n\n- bpo-31870(72): The *note ssl.getservercertificate(): 631.\nfunction now has a 'timeout' parameter.\n\n- bpo-41735(73): Fix thread locks in zlib module may go wrong in rare\ncase.  Patch by Ma Lin.\n\n- bpo-36470(74): Fix dataclasses with 'InitVar's and *note replace():\n1629.  Patch by Claudiu Popa.\n\n- bpo-40849(75): Expose X509VFLAGPARTIALCHAIN ssl flag\n\n- bpo-35114(76): *note ssl.RANDstatus(): 162a. now returns a boolean\nvalue (as documented) instead of '1' or '0'.\n\n- bpo-39906(77): *note pathlib.Path.stat(): 618. and *note chmod():\n619. now accept a 'followsymlinks' keyword-only argument for\nconsistency with corresponding functions in the *note os: 9c.\nmodule.\n\n- bpo-39899(78): *note os.path.expanduser(): 83d. now refuses to\nguess Windows home directories if the basename of current user's\nhome directory does not match their username.\n\n*note pathlib.Path.expanduser(): ca1. and *note home(): ca2. now\nconsistently raise *note RuntimeError: 17a. exception when a home\ndirectory cannot be resolved.  Previously a *note KeyError: 8cf.\nexception could be raised on Windows when the '\"USERNAME\"'\nenvironment variable was unset.\n\n- bpo-36076(79): Added SNI support to *note\nssl.getservercertificate(): 631.\n\n- bpo-38490(80): Covariance, Pearson's correlation, and simple linear\nregression functionality was added to statistics module.  Patch by\nTymoteusz Wo??od??ko.\n\n- bpo-33731(81): Provide a locale.localize() function, which converts\na normalized number string into a locale format.\n\n- bpo-32745(82): Fix a regression in the handling of ctypes' *note\nctypes.cwcharp: 162b. type: embedded null characters would cause\na *note ValueError: 183. to be raised.  Patch by Zackery Spytz.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=44015\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=25478\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=43733\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=43979\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=43993\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=43957\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=42904\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=43945\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=41139\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=43937\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=43930\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=43907\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=43926\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=43920\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=43607\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=43817\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=43284\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=42854\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=42333\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=43880\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=41559\n\n(22) https://peps.python.org/pep-0612/\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=43867\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=40443\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=43820\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=43787\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=43680\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=43680\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=41515\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=43776\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=42248\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=43744\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=43772\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=43764\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=43799\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=43478\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=43794\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=43785\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=43789\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=43788\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=43766\n\n(42) https://peps.python.org/pep-0647/\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=25264\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=43780\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=43731\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=43712\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=38659\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=43764\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=43752\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=43655\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=43723\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=2135\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=43534\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=43532\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=43522\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=8978\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=42967\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=43296\n\n(59) https://bugs.python.org/issue?@action=redirect&bpo=43312\n\n(60) https://bugs.python.org/issue?@action=redirect&bpo=43265\n\n(61) https://bugs.python.org/issue?@action=redirect&bpo=41282\n\n(62) https://bugs.python.org/issue?@action=redirect&bpo=41282\n\n(63) https://bugs.python.org/issue?@action=redirect&bpo=43176\n\n(64) https://bugs.python.org/issue?@action=redirect&bpo=43080\n\n(65) https://bugs.python.org/issue?@action=redirect&bpo=39950\n\n(66) https://bugs.python.org/issue?@action=redirect&bpo=42904\n\n(67) https://peps.python.org/pep-0563/\n\n(68) https://bugs.python.org/issue?@action=redirect&bpo=42269\n\n(69) https://bugs.python.org/issue?@action=redirect&bpo=39529\n\n(70) https://bugs.python.org/issue?@action=redirect&bpo=18369\n\n(71) https://bugs.python.org/issue?@action=redirect&bpo=41486\n\n(72) https://bugs.python.org/issue?@action=redirect&bpo=31870\n\n(73) https://bugs.python.org/issue?@action=redirect&bpo=41735\n\n(74) https://bugs.python.org/issue?@action=redirect&bpo=36470\n\n(75) https://bugs.python.org/issue?@action=redirect&bpo=40849\n\n(76) https://bugs.python.org/issue?@action=redirect&bpo=35114\n\n(77) https://bugs.python.org/issue?@action=redirect&bpo=39906\n\n(78) https://bugs.python.org/issue?@action=redirect&bpo=39899\n\n(79) https://bugs.python.org/issue?@action=redirect&bpo=36076\n\n(80) https://bugs.python.org/issue?@action=redirect&bpo=38490\n\n(81) https://bugs.python.org/issue?@action=redirect&bpo=33731\n\n(82) https://bugs.python.org/issue?@action=redirect&bpo=32745\n\nFile: python3.12.info,  Node: Documentation<27>,  Next: Tests<25>,  Prev: Library<27>,  Up: Python 3 10 0 beta 1\n\n1.22.27.4 Documentation\n.......................\n\n- bpo-43987(1): Add \"Annotations Best Practices\" document as a new\nHOWTO.\n\n- bpo-43977(2): Document the new *note PyTPFLAGSMAPPING: 1605. and\n*note PyTPFLAGSSEQUENCE: 1606. type flags.\n\n- bpo-43959(3): The documentation on the PyContextVar C-API was\nclarified.\n\n- bpo-43938(4): Update dataclasses documentation to express that\nFrozenInstanceError is derived from AttributeError.\n\n- bpo-43778(5): Fix the Sphinx glossarysearch extension: create the\nstatic/ sub-directory if it doesn't exist.\n\n- bpo-43755(6): Update documentation to reflect that unparenthesized\nlambda expressions can no longer be the expression part in an 'if'\nclause in comprehensions and generator expressions since Python\n3.9.\n\n- bpo-43739(7): Fixing the example code in\nDoc/extending/extending.rst to declare and initialize the pmodule\nvariable to be of the right type.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43987\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=43977\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=43959\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=43938\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=43778\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=43755\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=43739\n\nFile: python3.12.info,  Node: Tests<25>,  Next: Build<25>,  Prev: Documentation<27>,  Up: Python 3 10 0 beta 1\n\n1.22.27.5 Tests\n...............\n\n- bpo-43961(1): Fix testlogging.testnamerrotatorinheritance() on\nWindows: use *note os.replace(): f63. rather than *note\nos.rename(): f62.  Patch by Victor Stinner.\n\n- bpo-43842(2): Fix a race condition in the SMTP test of\ntestlogging.  Don't close a file descriptor (socket) from a\ndifferent thread while asyncore.loop() is polling the file\ndescriptor.  Patch by Victor Stinner.\n\n- bpo-43843(3): 'test.libregrtest' now marks a test as ENVCHANGED\n(altered the execution environment) if a thread raises an exception\nbut does not catch it.  It sets a hook on *note\nthreading.excepthook(): 641.  Use '--fail-env-changed' option to\nmark the test as failed.  Patch by Victor Stinner.\n\n- bpo-43811(4): Tests multiple OpenSSL versions on GitHub Actions.\nUse ccache to speed up testing.\n\n- bpo-43791(5): OpenSSL 3.0.0: Disable testing of legacy protocols\nTLS 1.0 and 1.1.  Tests are failing with\nTLSV1ALERTINTERNALERROR.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43961\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=43842\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=43843\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=43811\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=43791\n\nFile: python3.12.info,  Node: Build<25>,  Next: Windows<25>,  Prev: Tests<25>,  Up: Python 3 10 0 beta 1\n\n1.22.27.6 Build\n...............\n\n- bpo-43567(1): Improved generated code refresh\n(AST/tokens/opcodes/keywords) on Windows.\n\n- bpo-43669(2): Implement PEP 644(3).  Python now requires OpenSSL\n1.1.1 or newer.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43567\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=43669\n\n(3) https://peps.python.org/pep-0644/\n\nFile: python3.12.info,  Node: Windows<25>,  Next: macOS<20>,  Prev: Build<25>,  Up: Python 3 10 0 beta 1\n\n1.22.27.7 Windows\n.................\n\n- bpo-35306(1): Adds additional arguments to *note os.startfile():\n1630. function.\n\n- bpo-43538(2): Avoid raising errors from *note\npathlib.Path.exists(): 83f. when passed an invalid filename.\n\n- bpo-38822(3): Fixed *note os.stat(): 1bf. failing on inaccessible\ndirectories with a trailing slash, rather than falling back to the\nparent directory's metadata.  This implicitly affected *note\nos.path.exists(): 837. and *note os.path.isdir(): 839.\n\n- bpo-26227(4): Fixed decoding of host names in *note\nsocket.gethostbyaddr(): 1631. and *note socket.gethostbynameex():\n1632.\n\n- bpo-40432(5): Updated pegen regeneration script on Windows to find\nand use Python 3.8 or higher.  Prior to this, pegen regeneration\nalready required 3.8 or higher, but the script may have used lower\nversions of Python.\n\n- bpo-43745(6): Actually updates Windows release to OpenSSL 1.1.1k.\nEarlier releases were mislabelled and actually included 1.1.1i\nagain.\n\n- bpo-43652(7): Update Tcl and Tk to 8.6.11 in Windows installer.\n\n- bpo-43492(8): Upgrade Windows installer to use SQLite 3.35.5.\n\n- bpo-30555(9): Fix 'WindowsConsoleIO' errors in the presence of fd\nredirection.  Patch by Segev Finer.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=35306\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=43538\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=38822\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=26227\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=40432\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=43745\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=43652\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=43492\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=30555\n\nFile: python3.12.info,  Node: macOS<20>,  Next: IDLE<13>,  Prev: Windows<25>,  Up: Python 3 10 0 beta 1\n\n1.22.27.8 macOS\n...............\n\n- bpo-42119(1): Fix check for macOS SDK paths when building Python.\nNarrow search to match contents of SDKs, namely only files in\n'/System/Library', '/System/IOSSupport', and '/usr' other than\n'/usr/local'.  Previously, anything under '/System' was assumed to\nbe in an SDK which causes problems with the new file system layout\nin 10.15+ where user file systems may appear to be mounted under\n'/System'.  Paths in '/Library' were also incorrectly treated as\nSDK locations.\n\n- bpo-43568(2): Drop support for MACOSXDEPLOYMENTTARGET < 10.3\n\n- bpo-44009(3): Provide \"python3.x-intel64\" executable to allow\nreliably forcing macOS universal2 framework builds to run under\nRosetta 2 Intel-64 emulation on Apple Silicon Macs.  This can be\nuseful for testing or when universal2 wheels are not yet available.\n\n- bpo-43851(4): Build SQLite with 'SQLITEOMITAUTOINIT' on macOS.\nPatch by Erlend E. Aasland.\n\n- bpo-43492(5): Update macOS installer to use SQLite 3.35.4.\n\n- bpo-42235(6): 'Mac/BuildScript/build-installer.py' will now use\n\"-enable-optimizations\" and '--with-lto' when building on macOS\n10.15 or later.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42119\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=43568\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=44009\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=43851\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=43492\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=42235\n\nFile: python3.12.info,  Node: IDLE<13>,  Next: C API<23>,  Prev: macOS<20>,  Up: Python 3 10 0 beta 1\n\n1.22.27.9 IDLE\n..............\n\n- bpo-37903(1): Add mouse actions to the shell sidebar.  Left click\nand optional drag selects one or more lines, as with the editor\nline number sidebar.  Right click after selecting raises a context\nmenu with 'copy with prompts'.  This zips together prompts from the\nsidebar with lines from the selected text.\n\n- bpo-43981(2): Fix reference leak in testsidebar and testsqueezer.\nPatches by Terry Jan Reedy and Pablo Galindo\n\n- bpo-37892(3): Indent IDLE Shell input with spaces instead of tabs\n\n- bpo-43655(4): IDLE dialog windows are now recognized as dialogs by\nwindow managers on macOS and X Window.\n\n- bpo-37903(5): IDLE's shell now shows prompts in a separate\nside-bar.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=37903\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=43981\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=37892\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=43655\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=37903\n\nFile: python3.12.info,  Node: C API<23>,  Prev: IDLE<13>,  Up: Python 3 10 0 beta 1\n\n1.22.27.10 C API\n................\n\n- bpo-43916(1): Add a new *note PyTPFLAGSDISALLOWINSTANTIATION:\n2e4. type flag to disallow creating type instances.  Patch by\nVictor Stinner.\n\n- bpo-43774(2): Remove the now unused 'PYMALLOCDEBUG' macro.  Debug\nhooks on memory allocators are now installed by default if Python\nis built in debug mode (if 'PyDEBUG' macro is defined).  Moreover,\nthey can now be used on Python build in release mode (ex: using\n'PYTHONMALLOC=debug' environment variable).\n\n- bpo-43962(3): PyInterpreterStateIDIncref() now calls\nPyInterpreterStateIDInitref() and always increments idrefcount.\nPreviously, calling xxsubinterpreters.getcurrent() could create\nan idrefcount inconsistency when a\nxxsubinterpreters.InterpreterID object was deallocated.  Patch by\nVictor Stinner.\n\n- bpo-28254(4): Add new C-API functions to control the state of the\ngarbage collector: *note PyGCEnable(): 6b7, *note PyGCDisable():\n6b8, *note PyGCIsEnabled(): 6b9, corresponding to the functions in\nthe *note gc: 5b. module.\n\n- bpo-43908(5): Introduce *note PyTPFLAGSIMMUTABLETYPE: 2b2. flag\nfor immutable type objects, and modify *note PyTypeReady(): 567.\nto set it for static types.  Patch by Erlend E. Aasland.\n\n- bpo-43795(6): *note PyMemCalloc(): d12. is now available in the\nlimited C API ('PyLIMITEDAPI').\n\n- bpo-43868(7): *note PyOSReadlineFunctionPointer(): 2e8. is no\nlonger exported by limited C API headers and by 'python3.dll' on\nWindows.  Like any function that takes 'FILE*', it is not part of\nthe stable ABI.\n\n- bpo-43795(8): Stable ABI and limited API definitions are generated\nfrom a central manifest ( PEP 652(9)).\n\n- bpo-43753(10): Add the *note PyIs(x, y): 6b3. function to test if\nthe 'x' object is the 'y' object, the same as 'x is y' in Python.\nAdd also the *note PyIsNone(): 6b4, *note PyIsTrue(): 6b5, *note\nPyIsFalse(): 6b6. functions to test if an object is, respectively,\nthe 'None' singleton, the 'True' singleton or the 'False'\nsingleton.  Patch by Victor Stinner.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43916\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=43774\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=43962\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=28254\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=43908\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=43795\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=43868\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=43795\n\n(9) https://peps.python.org/pep-0652/\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=43753\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 10 0 alpha 7,  Next: Python 3 10 0 alpha 6,  Prev: Python 3 10 0 beta 1,  Up: Changelog": {
            "content": "'Release date: 2021-04-05'\n\n* Menu:\n\n* Security: Security<16>.\n* Core and Builtins: Core and Builtins<28>.\n* Library: Library<28>.\n* Documentation: Documentation<28>.\n* Tests: Tests<26>.\n* Build: Build<26>.\n* Windows: Windows<26>.\n* IDLE: IDLE<14>.\n* C API: C API<24>.\n\nFile: python3.12.info,  Node: Security<16>,  Next: Core and Builtins<28>,  Up: Python 3 10 0 alpha 7\n\n1.22.28.1 Security\n..................\n\n- bpo-42988(1): CVE-2021-3426: Remove the 'getfile' feature of the\n*note pydoc: b0. module which could be abused to read arbitrary\nfiles on the disk (directory traversal vulnerability).  Moreover,\neven source code of Python modules can contain sensitive data like\npasswords.  Vulnerability reported by David Schwo\"rer.\n\n- bpo-43285(2): *note ftplib: 59. no longer trusts the IP address\nvalue returned from the server in response to the PASV command by\ndefault.  This prevents a malicious FTP server from using the\nresponse to probe IPv4 address and port combinations on the client\nnetwork.\n\nCode that requires the former vulnerable behavior may set a\n'trustserverpasvipv4address' attribute on their *note\nftplib.FTP: 715. instances to 'True' to re-enable it.\n\n- bpo-43439(3): Add audit hooks for *note gc.getobjects(): 5f6,\n*note gc.getreferrers(): 5f7. and *note gc.getreferents(): 5f8.\nPatch by Pablo Galindo.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42988\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=43285\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=43439\n\nFile: python3.12.info,  Node: Core and Builtins<28>,  Next: Library<28>,  Prev: Security<16>,  Up: Python 3 10 0 alpha 7\n\n1.22.28.2 Core and Builtins\n...........................\n\n- bpo-27129(1): Update CPython bytecode magic number.\n\n- bpo-43672(2): Raise ImportWarning when calling findloader().\n\n- bpo-43660(3): Fix crash that happens when replacing 'sys.stderr'\nwith a callable that can remove the object while an exception is\nbeing printed.  Patch by Pablo Galindo.\n\n- bpo-27129(4): The bytecode interpreter uses instruction, rather\nbyte, offsets internally.  This reduces the number of EXTENDEDARG\ninstructions needed and streamlines instruction dispatch a bit.\n\n- bpo-40645(5): Fix reference leak in the 'hashopenssl' extension.\nPatch by Pablo Galindo.\n\n- bpo-42134(6): Calls to findmodule() by the import system now raise\nImportWarning.\n\n- bpo-41064(7): Improve the syntax error for invalid usage of double\nstarred elements ('') in f-strings.  Patch by Pablo Galindo.\n\n- bpo-43575(8): Speed up calls to 'map()' by using the PEP 590(9)\n'vectorcall' calling convention.  Patch by Donghee Na.\n\n- bpo-42137(10): The import system now prefers using 'spec' for\n'ModuleType.repr' over 'modulerepr()'.\n\n- bpo-43452(11): Added micro-optimizations to 'PyTypeLookup()' to\nimprove cache lookup performance in the common case of cache hits.\n\n- bpo-43555(12): Report the column offset for *note SyntaxError: 146.\nfor invalid line continuation characters.  Patch by Pablo Galindo.\n\n- bpo-43517(13): Fix misdetection of circular imports when using\n'from pkg.mod import attr', which caused false positives in\nnon-trivial multi-threaded code.\n\n- bpo-43497(14): Emit SyntaxWarnings for assertions with tuple\nconstants, this is a regression introduced in python3.7\n\n- bpo-39316(15): Tracing now has correct line numbers for attribute\naccesses when the attribute is on a different line from the object.\nImproves debugging and profiling for multi-line method chains.\n\n- bpo-35883(16): Python no longer fails at startup with a fatal error\nif a command line argument contains an invalid Unicode character.\nThe *note PyDecodeLocale(): a0b. function now escapes byte\nsequences which would be decoded as Unicode characters outside the\n[U+0000; U+10ffff] range.\n\n- bpo-43410(17): Fix a bug that was causing the parser to crash when\nemitting syntax errors when reading input from stdin.  Patch by\nPablo Galindo\n\n- bpo-43406(18): Fix a possible race condition where\n'PyErrCheckSignals' tries to execute a non-Python signal handler.\n\n- bpo-42128(19): Add 'matchargs' to *note struct sequence\nobjects: 1033.  Patch by Pablo Galindo.\n\n- bpo-43390(20): CPython now sets the 'SAONSTACK' flag in\n'PyOSsetsig' for the VM's default signal handlers.  This is\nfriendlier to other in-process code that an extension module or\nembedding use could pull in (such as Golang's cgo) where tiny\nthread stacks are the norm and 'sigaltstack()' has been used to\nprovide for signal handlers.  This is a no-op change for the vast\nmajority of processes that don't use sigaltstack.\n\n- bpo-43287(21): Speed up calls to 'filter()' by using the PEP\n590(22) 'vectorcall' calling convention.  Patch by Donghee Na.\n\n- bpo-37448(23): Add a radix tree based memory map to track in-use\nobmalloc arenas.  Use to replace the old implementation of\naddressinrange().  The radix tree approach makes it easy to\nincrease pool sizes beyond the OS page size.  Boosting the pool and\narena size allows obmalloc to handle a significantly higher\npercentage of requests from its ultra-fast paths.\n\nIt also has the advantage of eliminating the memory unsanitary\nbehavior of the previous addressinrange().  The old\naddressinrange() was marked with the annotations\nPyNOSANITIZEADDRESS, PyNOSANITIZETHREAD, and\nPyNOSANITIZEMEMORY. Those annotations are no longer needed.\n\nTo disable the radix tree map, set a preprocessor flag as follows:\n'-DWITHPYMALLOCRADIXTREE=0'.\n\nCo-authored-by: Tim Peters <<tim.peters@gmail.com>>\n\n- bpo-29988(24): Only handle asynchronous exceptions and requests to\ndrop the GIL when returning from a call or on the back edges of\nloops.  Makes sure that *note exit(): 1175. is always called in\nwith statements, even for interrupts.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27129\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=43672\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=43660\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=27129\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=40645\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=42134\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=41064\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=43575\n\n(9) https://peps.python.org/pep-0590/\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=42137\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=43452\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=43555\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=43517\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=43497\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=39316\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=35883\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=43410\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=43406\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=42128\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=43390\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=43287\n\n(22) https://peps.python.org/pep-0590/\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=37448\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=29988\n\nFile: python3.12.info,  Node: Library<28>,  Next: Documentation<28>,  Prev: Core and Builtins<28>,  Up: Python 3 10 0 alpha 7\n\n1.22.28.3 Library\n.................\n\n- bpo-43720(1): Document various stdlib deprecations in imp, pkgutil,\nand importlib.util for removal in Python 3.12.\n\n- bpo-43433(2): *note xmlrpc.client.ServerProxy: 883. no longer\nignores query and fragment in the URL of the server.\n\n- bpo-31956(3): The *note index(): 5d4. method of *note array.array:\n18f. now has optional 'start' and 'stop' parameters.\n\n- bpo-40066(4): Enum: adjust 'repr()' to show only enum and member\nname (not value, nor angle brackets) and 'str()' to show only\nmember name.  Update and improve documentation to match.\n\n- bpo-42136(5): Deprecate all modulerepr() methods found in\nimportlib as their use is being phased out by Python 3.12.\n\n- bpo-35930(6): Raising an exception raised in a \"future\" instance\nwill create reference cycles.\n\n- bpo-41369(7): Finish updating the vendored libmpdec to version\n2.5.1.  Patch by Stefan Krah.\n\n- bpo-43422(8): Revert the decimal C API which was added in\nbpo-41324(9).\n\n- bpo-43577(10): Fix deadlock when using *note ssl.SSLContext: 278.\ndebug callback with *note ssl.SSLContext.snicallback(): 163a.\n\n- bpo-43571(11): It's now possible to create MPTCP sockets with\nIPPROTOMPTCP\n\n- bpo-43542(12): 'image/heic' and 'image/heif' were added to *note\nmimetypes: 8a.\n\n- bpo-40645(13): The *note hmac: 65. module now uses OpenSSL's HMAC\nimplementation when digestmod argument is a hash name or builtin\nhash function.\n\n- bpo-43510(14): Implement PEP 597(15): Add 'EncodingWarning'\nwarning, '-X warndefaultencoding' option, *note\nPYTHONWARNDEFAULTENCODING: 5af. environment variable and\n'encoding=\"locale\"' argument value.\n\n- bpo-43521(16): 'ast.unparse' can now render NaNs and empty sets.\n\n- bpo-42914(17): *note pprint.pprint(): 61d. gains a new boolean\n'underscorenumbers' optional argument to emit integers with\nthousands separated by an underscore character for improved\nreadability (for example '1000000' instead of '1000000').\n\n- bpo-41361(18): *note rotate(): 163b. calls are now slightly faster\ndue to faster argument parsing.\n\n- bpo-43423(19): 'subprocess.communicate()' no longer raises an\nIndexError when there is an empty stdout or stderr IO buffer during\na timeout on Windows.\n\n- bpo-27820(20): Fixed long-standing bug of smtplib.SMTP where doing\nAUTH LOGIN with initialresponseok=False will fail.\n\nThe cause is that SMTP.authlogin always returns a password if\nprovided with a challenge string, thus non-compliant with the\nstandard for AUTH LOGIN.\n\nAlso fixes bug with the test for smtpd.\n\n- bpo-43445(21): Add frozen modules to *note sys.stdlibmodulenames:\n637.  For example, add '\"frozenimportlib\"' and\n'\"frozenimportlibexternal\"' names.\n\n- bpo-43245(22): Add keyword arguments support to\n'ChainMap.newchild()'.\n\n- bpo-29982(23): Add optional parameter 'ignorecleanuperrors' to\n*note tempfile.TemporaryDirectory(): 10aa. and allow multiple\n'cleanup()' attempts.  Contributed by C.A.M. Gerlach.\n\n- bpo-43428(24): Include changes from importlibmetadata 3.7(25):\n\nPerformance enhancements to distribution discovery.\n\n'entrypoints' only returns unique distributions.\n\nIntroduces new 'EntryPoints' object for containing a set of entry\npoints with convenience methods for selecting entry points by group\nor name.  'entrypoints' now returns this object if selection\nparameters are supplied but continues to return a dict object for\ncompatibility.  Users are encouraged to rely on the selection\ninterface.  The dict object result is likely to be deprecated in\nthe future.\n\nAdded packagesdistributions function to return a mapping of\npackages to the distributions that provide them.\n\n- bpo-43332(26): Improves the networking efficiency of *note\nhttp.client: 6a. when using a proxy via 'settunnel()'.  Fewer\nsmall send calls are made during connection setup.\n\n- bpo-43420(27): Improve performance of *note fractions.Fraction:\n1a8. arithmetics for large components.  Contributed by Sergey B.\nKirpichev.\n\n- bpo-43356(28): Allow passing a signal number to\n'thread.interruptmain()'.\n\n- bpo-43399(29): Fix 'ElementTree.extend' not working on iterators\nwhen using the Python implementation\n\n- bpo-43369(30): Improve *note sqlite3: c9. error handling: If\n'sqlite3columntext()' and 'sqlite3columnblob()' set\n'SQLITENOMEM', *note MemoryError: 13e3. is now raised.  Patch by\nErlend E. Aasland.\n\n- bpo-43368(31): Fix a regression introduced in PR 24562, where an\nempty bytestring was fetched as 'None' instead of 'b''' in *note\nsqlite3: c9.  Patch by Mariusz Felisiak.\n\n- bpo-41282(32): Fixed stacklevel of 'DeprecationWarning' emitted\nfrom 'import distutils'.\n\n- bpo-42129(33): 'importlib.resources' now honors namespace packages,\nmerging resources from each location in the namespace as introduced\nin 'importlibresources' 3.2 and including incidental changes\nthrough 5.0.3.\n\n- bpo-43295(34): *note datetime.datetime.strptime(): 146c. now raises\n'ValueError' instead of 'IndexError' when matching ''z'' with the\n'%z' format specifier.\n\n- bpo-43125(35): Return empty string if base64mime.bodyencode\nreceive empty bytes\n\n- bpo-43084(36): *note curses.window.enclose(): 163c. returns now\n'True' or 'False' (as was documented) instead of '1' or '0'.\n\n- bpo-42994(37): Add MIME types for opus, AAC, 3gpp and 3gpp2\n\n- bpo-14678(38): Add an invalidatecaches() method to the\nzipimport.zipimporter class to support\nimportlib.invalidatecaches().  Patch by Desmond Cheong.\n\n- bpo-42782(39): Fail fast in *note shutil.move(): 889. to avoid\ncreating destination directories on failure.\n\n- bpo-40066(40): Enum's 'repr()' and 'str()' have changed: 'repr()'\nis now 'EnumClass.MemberName' and 'str()' is 'MemberName'.\nAdditionally, stdlib Enum's whose contents are available as module\nattributes, such as 'RegexFlag.IGNORECASE', have their 'repr()' as\n'module.name', e.g.  're.IGNORECASE'.\n\n- bpo-26053(41): Fixed bug where the *note pdb: a0. interactive run\ncommand echoed the args from the shell command line, even if those\nhave been overridden at the pdb prompt.\n\n- bpo-24160(42): Fixed bug where breakpoints did not persist across\nmultiple debugger sessions in *note pdb: a0.'s interactive mode.\n\n- bpo-40701(43): When the *note tempfile.tempdir: 163d. global\nvariable is set to a value of type bytes, it is now handled\nconsistently.  Previously exceptions could be raised from some\ntempfile APIs when the directory did not already exist in this\nsituation.  Also ensures that the *note tempfile.gettempdir():\n163e. and *note tempfile.gettempdirb(): 163f. functions 'always'\nreturn 'str' and 'bytes' respectively.\n\n- bpo-39342(44): Expose 'X509VFLAGALLOWPROXYCERTS' as *note\nVERIFYALLOWPROXYCERTS: 1640. to allow proxy certificate\nvalidation as explained in\n'https://www.openssl.org/docs/man1.1.1/man7/proxy-certificates.html'.\n\n- bpo-31861(45): Add builtins.aiter and builtins.anext.  Patch by\nJoshua Bronson (@jab), Daniel Pope (@lordmauve), and Justin Wang\n(@justin39).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43720\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=43433\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=31956\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=40066\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=42136\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=35930\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=41369\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=43422\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=41324\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=43577\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=43571\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=43542\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=40645\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=43510\n\n(15) https://peps.python.org/pep-0597/\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=43521\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=42914\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=41361\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=43423\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=27820\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=43445\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=43245\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=29982\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=43428\n\n(25)\nhttps://importlib-metadata.readthedocs.io/en/latest/history.html#v3-7-0\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=43332\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=43420\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=43356\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=43399\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=43369\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=43368\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=41282\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=42129\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=43295\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=43125\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=43084\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=42994\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=14678\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=42782\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=40066\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=26053\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=24160\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=40701\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=39342\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=31861\n\nFile: python3.12.info,  Node: Documentation<28>,  Next: Tests<26>,  Prev: Library<28>,  Up: Python 3 10 0 alpha 7\n\n1.22.28.4 Documentation\n.......................\n\n- bpo-43199(1): Answer \"Why is there no goto?\" in the Design and\nHistory FAQ.\n\n- bpo-43407(2): Clarified that a result from *note time.monotonic():\nce1, *note time.perfcounter(): 8b6, *note time.processtime():\n8b7, or *note time.threadtime(): 754. can be compared with the\nresult from any following call to the same function - not just the\nnext immediate call.\n\n- bpo-43354(3): Fix type documentation for 'Fault.faultCode'; the\ntype has to be 'int' instead of 'str'.\n\n- bpo-41933(4): Clarified wording of s * n in the Common Sequence\nOperations\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43199\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=43407\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=43354\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=41933\n\nFile: python3.12.info,  Node: Tests<26>,  Next: Build<26>,  Prev: Documentation<28>,  Up: Python 3 10 0 alpha 7\n\n1.22.28.5 Tests\n...............\n\n- bpo-37945(1): Fix testgetsetlocaleissue1813() of testlocale:\nskip the test if 'setlocale()' fails.  Patch by Victor Stinner.\n\n- bpo-41561(2): Add workaround for Ubuntu's custom OpenSSL security\nlevel policy.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=37945\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=41561\n\nFile: python3.12.info,  Node: Build<26>,  Next: Windows<26>,  Prev: Tests<26>,  Up: Python 3 10 0 alpha 7\n\n1.22.28.6 Build\n...............\n\n- bpo-43179(1): Introduce and correctly use ALIGNOFX in place of\nSIZEOFX for alignment-related code in optimized string routines.\nPatch by Jessica Clarke.\n\n- bpo-43631(2): Update macOS, Windows, and CI to OpenSSL 1.1.1k.\n\n- bpo-43617(3): Improve configure.ac: Check for presence of\nautoconf-archive package and remove our copies of M4 macros.\n\n- bpo-43466(4): The 'configure' script now supports\n'--with-openssl-rpath' option.\n\n- bpo-43372(5): Use 'freezeimportlib' to generate code for the\n'hello' module.  This approach ensures the code matches the\ninterpreter version.  Previously, PYTHONFORREGEN was used to\ngenerate the code, which might be wrong.  The marshal format for\ncode objects has changed with bpo-42246(6), commit 877df851.\nUpdate the code and the expected code sizes in ctypes\ntestfrozentable.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43179\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=43631\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=43617\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=43466\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=43372\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=42246\n\nFile: python3.12.info,  Node: Windows<26>,  Next: IDLE<14>,  Prev: Build<26>,  Up: Python 3 10 0 alpha 7\n\n1.22.28.7 Windows\n.................\n\n- bpo-43440(1): Build *note sqlite3: c9. with the 'R*Tree' module\nenabled.  Patch by Erlend E. Aasland.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43440\n\nFile: python3.12.info,  Node: IDLE<14>,  Next: C API<24>,  Prev: Windows<26>,  Up: Python 3 10 0 alpha 7\n\n1.22.28.8 IDLE\n..............\n\n- bpo-42225(1): Document that IDLE can fail on Unix either from\nmisconfigured IP masquerade rules or failure displaying complex\ncolored (non-ascii) characters.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42225\n\nFile: python3.12.info,  Node: C API<24>,  Prev: IDLE<14>,  Up: Python 3 10 0 alpha 7\n\n1.22.28.9 C API\n...............\n\n- bpo-43688(1): The limited C API is now supported if Python is built\nin debug mode (if the 'PyDEBUG' macro is defined).  In the limited\nC API, the *note PyINCREF(): 2ce. and *note PyDECREF(): 2cf.\nfunctions are now implemented as opaque function calls, rather than\naccessing directly the *note PyObject.obrefcnt: 6b0. member, if\nPython is built in debug mode and the 'PyLIMITEDAPI' macro\ntargets Python 3.10 or newer.  It became possible to support the\nlimited C API in debug mode because the *note PyObject: 6b1.\nstructure is the same in release and debug mode since Python 3.8\n(see bpo-36465(2)).\n\nThe limited C API is still not supported in the '--with-trace-refs'\nspecial build ('PyTRACEREFS' macro).\n\nPatch by Victor Stinner.\n\n- bpo-43244(3): Remove the 'pyarena.h' header file with functions:\n\n* 'PyArenaNew()'\n\n* 'PyArenaFree()'\n\n* 'PyArenaMalloc()'\n\n* 'PyArenaAddPyObject()'\n\nThese functions were undocumented, excluded from the limited C API,\nand were only used internally by the compiler.  Patch by Victor\nStinner.\n\n- bpo-43244(4): Remove the compiler and parser functions using\n'struct mod' type, because the public AST C API was removed:\n\n* 'PyASTCompile()'\n\n* 'PyASTCompileEx()'\n\n* 'PyASTCompileObject()'\n\n* 'PyFutureFromAST()'\n\n* 'PyFutureFromASTObject()'\n\n* 'PyParserASTFromFile()'\n\n* 'PyParserASTFromFileObject()'\n\n* 'PyParserASTFromFilename()'\n\n* 'PyParserASTFromString()'\n\n* 'PyParserASTFromStringObject()'\n\nThese functions were undocumented and excluded from the limited C\nAPI. Patch by Victor Stinner.\n\n- bpo-43244(5): Remove 'ast.h', 'asdl.h', and 'Python-ast.h' header\nfiles.  These functions were undocumented and excluded from the\nlimited C API. Most names defined by these header files were not\nprefixed by 'Py' and so could create names conflicts.  For example,\n'Python-ast.h' defined a 'Yield' macro which was conflict with the\n'Yield' name used by the Windows '<winbase.h>' header.  Use the\nPython *note ast: 8. module instead.  Patch by Victor Stinner.\n\n- bpo-43541(6): Fix a 'PyEvalEvalCodeEx()' regression: fix reference\ncounting on builtins.  Patch by Victor Stinner.\n\n- bpo-43244(7): Remove the 'symtable.h' header file and the\nundocumented functions:\n\n* 'PySTGetScope()'\n\n* 'PySymtableBuild()'\n\n* 'PySymtableBuildObject()'\n\n* 'PySymtableFree()'\n\n* 'PySymtableString()'\n\n* 'PySymtableStringObject()'\n\nThe 'PySymtableString()' function was part the stable ABI by\nmistake but it could not be used, because the 'symtable.h' header\nfile was excluded from the limited C API.\n\nThe Python *note symtable: d2. module remains available and is\nunchanged.\n\nPatch by Victor Stinner.\n\n- bpo-43244(8): Remove the 'PyASTValidate()' function.  It is no\nlonger possible to build a AST object ('modty' type) with the\npublic C API. The function was already excluded from the limited C\nAPI ( PEP 384(9)).  Patch by Victor Stinner.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43688\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=36465\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=43244\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=43244\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=43244\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=43541\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=43244\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=43244\n\n(9) https://peps.python.org/pep-0384/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 10 0 alpha 6,  Next: Python 3 10 0 alpha 5,  Prev: Python 3 10 0 alpha 7,  Up: Changelog": {
            "content": "'Release date: 2021-03-01'\n\n* Menu:\n\n* Security: Security<17>.\n* Core and Builtins: Core and Builtins<29>.\n* Library: Library<29>.\n* Documentation: Documentation<29>.\n* Tests: Tests<27>.\n* Build: Build<27>.\n* Windows: Windows<27>.\n* macOS: macOS<21>.\n* IDLE: IDLE<15>.\n* C API: C API<25>.\n\nFile: python3.12.info,  Node: Security<17>,  Next: Core and Builtins<29>,  Up: Python 3 10 0 alpha 6\n\n1.22.29.1 Security\n..................\n\n- bpo-42967(1): Fix web cache poisoning vulnerability by defaulting\nthe query args separator to '&', and allowing the user to choose a\ncustom separator.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42967\n\nFile: python3.12.info,  Node: Core and Builtins<29>,  Next: Library<29>,  Prev: Security<17>,  Up: Python 3 10 0 alpha 6\n\n1.22.29.2 Core and Builtins\n...........................\n\n- bpo-43321(1): Fix 'SystemError' raised when 'PyArgParse*()' is\nused with '#' but without 'PYSSIZETCLEAN' defined.\n\n- bpo-36346(2): 'PyArgParse*()' functions now emits\n'DeprecationWarning' when 'u' or 'Z' format is used.  See PEP\n623(3) for detail.\n\n- bpo-43277(4): Add a new *note PySetCheckExact(): 6ae. function to\nthe C-API to check if an object is an instance of *note set: 39d.\nbut not an instance of a subtype.  Patch by Pablo Galindo.\n\n- bpo-42990(5): The *note types.FunctionType: 68f. constructor now\ninherits the current builtins if the 'globals' dictionary has no\n'\"builtins\"' key, rather than using '{\"None\": None}' as\nbuiltins: same behavior as *note eval(): 690. and *note exec():\n691. functions.  Defining a function with 'def function(...): ...'\nin Python is not affected, globals cannot be overridden with this\nsyntax: it also inherits the current builtins.  Patch by Victor\nStinner.\n\n- bpo-42990(6): Functions have a new 'builtins' attribute which\nis used to look for builtin symbols when a function is executed,\ninstead of looking into 'globals['builtins']'.  Patch by\nMark Shannon and Victor Stinner.\n\n- bpo-43149(7): Improve the error message in the parser for exception\ngroups without parentheses.  Patch by Pablo Galindo.\n\n- bpo-43121(8): Fixed an incorrect *note SyntaxError: 146. message\nfor missing comma in literals.  Patch by Pablo Galindo.\n\n- bpo-42819(9): *note readline: b5.: Explicitly disable bracketed\npaste in the interactive interpreter, even if it's set in the\ninputrc, is enabled by default (eg GNU Readline 8.1), or a user\ncalls 'readline.readinitfile()'.  The Python REPL has not\nimplemented bracketed paste support.  Also, bracketed mode writes\nthe '\"\\x1b[?2004h\"' escape sequence into stdout which causes test\nfailures in applications that don't support it.  It can still be\nexplicitly enabled by calling 'readline.parseandbind(\"set\nenable-bracketed-paste on\")'.  Patch by Dustin Rodrigues.\n\n- bpo-42808(10): Simple calls to 'type(object)' are now faster due to\nthe 'vectorcall' calling convention.  Patch by Dennis Sweeney.\n\n- bpo-42217(11): Make the compiler merges same cocode and\ncolinetable objects in a module like already did for coconsts.\n\n- bpo-41972(12): Substring search functions such as 'str1 in str2'\nand 'str2.find(str1)' now sometimes use the \"Two-Way\" string\ncomparison algorithm to avoid quadratic behavior on long strings.\n\n- bpo-42128(13): Implement PEP 634(14) (structural pattern matching).\nPatch by Brandt Bucher.\n\n- bpo-40692(15): In the *note concurrent.futures.ProcessPoolExecutor:\n707, validate that 'multiprocess.synchronize()' is available on a\ngiven platform and rely on that check in the *note\nconcurrent.futures: 1f. test suite so we can run tests that are\nunrelated to 'ProcessPoolExecutor' on those platforms.\n\n- bpo-38302(16): If *note object.ipow(): 5c4. returns *note\nNotImplemented: 5c5, the operator will correctly fall back to *note\nobject.pow(): 5c6. and *note object.rpow(): 5c7. as\nexpected.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43321\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=36346\n\n(3) https://peps.python.org/pep-0623/\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=43277\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=42990\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=42990\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=43149\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=43121\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=42819\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=42808\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=42217\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=41972\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=42128\n\n(14) https://peps.python.org/pep-0634/\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=40692\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=38302\n\nFile: python3.12.info,  Node: Library<29>,  Next: Documentation<29>,  Prev: Core and Builtins<29>,  Up: Python 3 10 0 alpha 6\n\n1.22.29.3 Library\n.................\n\n- bpo-43316(1): The 'python -m gzip' command line application now\nproperly fails when detecting an unsupported extension.  It exits\nwith a non-zero exit code and prints an error message to stderr.\n\n- bpo-43317(2): Set the chunk size for the 'gzip' module main\nfunction to io.DEFAULTBUFFERSIZE. This is slightly faster than\nthe 1024 bytes constant that was used previously.\n\n- bpo-43146(3): Handle None in single-arg versions of *note\nprintexception(): 645. and *note formatexception(): 643.\n\n- bpo-43260(4): Fix TextIOWrapper can not flush internal buffer\nforever after very large text is written.\n\n- bpo-43258(5): Prevent needless allocation of *note sqlite3: c9.\naggregate function context when no rows match an aggregate query.\nPatch by Erlend E. Aasland.\n\n- bpo-43251(6): Improve *note sqlite3: c9. error handling:\n'sqlite3columnname()' failures now result in *note MemoryError:\n13e3.  Patch by Erlend E. Aasland.\n\n- bpo-40956(7): Fix segfault in *note sqlite3.Connection.backup():\n9bb. if no argument was provided.  The regression was introduced by\nPR 23838.  Patch by Erlend E. Aasland.\n\n- bpo-43172(8): The readline module now passes its tests when built\ndirectly against libedit.  Existing irreconcilable API differences\nremain in *note readline.getbegidx(): 164b. and *note\nreadline.getendidx(): 164c. behavior based on libreadline vs\nlibedit use.\n\n- bpo-43163(9): Fix a bug in *note codeop: 1a. that was causing it to\nnot ask for more input when multi-line snippets have unclosed\nparentheses.  Patch by Pablo Galindo\n\n- bpo-43162(10): deprecate unsupported ability to access enum members\nas attributes of other enum members\n\n- bpo-43146(11): Fix recent regression in None argument handling in\n*note traceback: f9. module functions.\n\n- bpo-43102(12): The namedtuple new method had its builtins\nset to None instead of an actual dictionary.  This created problems\nfor introspection tools.\n\n- bpo-43106(13): Added *note OEVTONLY: 60e, *note OFSYNC: 60f,\n*note OSYMLINK: 610. and *note ONOFOLLOWANY: 611. for macOS.\nPatch by Donghee Na.\n\n- bpo-42960(14): Adds *note resource.RLIMITKQUEUES: 164d. constant\nfrom FreeBSD to the *note resource: b7. module.\n\n- bpo-42151(15): Make the pure Python implementation of *note\nxml.etree.ElementTree: 120. behave the same as the C implementation\n('elementree') regarding default attribute values (by not setting\n'specifiedattributes=1').\n\n- bpo-29753(16): In ctypes, now packed bitfields are calculated\nproperly and the first item of packed bitfields is now shrank\ncorrectly.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43316\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=43317\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=43146\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=43260\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=43258\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=43251\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=40956\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=43172\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=43163\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=43162\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=43146\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=43102\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=43106\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=42960\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=42151\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=29753\n\nFile: python3.12.info,  Node: Documentation<29>,  Next: Tests<27>,  Prev: Library<29>,  Up: Python 3 10 0 alpha 6\n\n1.22.29.4 Documentation\n.......................\n\n- bpo-27646(1): Clarify that 'yield from <expr>' works with any\niterable, not just iterators.\n\n- bpo-36346(2): Update some deprecated unicode APIs which are\ndocumented as \"will be removed in 4.0\" to \"3.12\".  See PEP 623(3)\nfor detail.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27646\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=36346\n\n(3) https://peps.python.org/pep-0623/\n\nFile: python3.12.info,  Node: Tests<27>,  Next: Build<27>,  Prev: Documentation<29>,  Up: Python 3 10 0 alpha 6\n\n1.22.29.5 Tests\n...............\n\n- bpo-43288(1): Fix testimportlib to correctly skip Unicode file\ntests if the filesystem does not support them.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43288\n\nFile: python3.12.info,  Node: Build<27>,  Next: Windows<27>,  Prev: Tests<27>,  Up: Python 3 10 0 alpha 6\n\n1.22.29.6 Build\n...............\n\n- bpo-43174(1): Windows build now uses '/utf-8' compiler option.\n\n- bpo-43103(2): Add a new configure '--without-static-libpython'\noption to not build the 'libpythonMAJOR.MINOR.a' static library and\nnot install the 'python.o' object file.\n\n- bpo-13501(3): The configure script can now use 'libedit' instead of\n'readline' with the command line option '--with-readline=editline'.\n\n- bpo-42603(4): Make configure script use pkg-config to detect the\nlocation of Tcl/Tk headers and libraries, used to build tkinter.\n\nOn macOS, a Tcl/Tk configuration provided by pkg-config will be\npreferred over Tcl/Tk frameworks installed in\n'/{System/,}Library/Frameworks'.  If both exist and the latter is\npreferred, the appropriate '--with-tcltk-*' configuration options\nneed to be explicitly set.\n\n- bpo-39448(5): Add the \"regen-frozen\" makefile target that\nregenerates the code for the frozen 'hello' module.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43174\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=43103\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=13501\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=42603\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=39448\n\nFile: python3.12.info,  Node: Windows<27>,  Next: macOS<21>,  Prev: Build<27>,  Up: Python 3 10 0 alpha 6\n\n1.22.29.7 Windows\n.................\n\n- bpo-43155(1): *note PyCMethodNew(): 1652. is now present in\n'python3.lib'.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43155\n\nFile: python3.12.info,  Node: macOS<21>,  Next: IDLE<15>,  Prev: Windows<27>,  Up: Python 3 10 0 alpha 6\n\n1.22.29.8 macOS\n...............\n\n- bpo-41837(1): Update macOS installer build to use OpenSSL 1.1.1j.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=41837\n\nFile: python3.12.info,  Node: IDLE<15>,  Next: C API<25>,  Prev: macOS<21>,  Up: Python 3 10 0 alpha 6\n\n1.22.29.9 IDLE\n..............\n\n- bpo-43283(1): Document why printing to IDLE's Shell is often slower\nthan printing to a system terminal and that it can be made faster\nby pre-formatting a single string before printing.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43283\n\nFile: python3.12.info,  Node: C API<25>,  Prev: IDLE<15>,  Up: Python 3 10 0 alpha 6\n\n1.22.29.10 C API\n................\n\n- bpo-43278(1): Always put compiler and system information on the\nfirst line of the REPL welcome message.\n\n- bpo-43270(2): Remove the private 'PyErrOCCURRED()' macro: use the\npublic *note PyErrOccurred(): 1656. function instead.\n\n- bpo-35134(3): Move odictobject.h, parserinterface.h,\npicklebufobject.h, pydebug.h, and pyfpe.h into the cpython/\ndirectory.  They must not be included directly, as they are already\nincluded by Python.h: *note Include Files: 56f.\n\n- bpo-35134(4): Move pyarena.h, pyctype.h, and pytime.h into the\ncpython/ directory.  They must not be included directly, as they\nare already included by Python.h: *note Include Files: 56f.\n\n- bpo-40170(5): 'PyExceptionClassName()' is now always declared as a\nfunction, in order to hide implementation details.  The macro\naccessed *note PyTypeObject.tpname: 1657. directly.  Patch by\nErlend E. Aasland.\n\n- bpo-43239(6): The *note PyCFunctionNew(): 1658. function is now\nexported in the ABI when compiled with '-fvisibility=hidden'.\n\n- bpo-40170(7): *note PyIterCheck(): 1659. is now always declared as\na function, in order to hide implementation details.  The macro\naccessed *note PyTypeObject.tpiternext: 1349. directly.  Patch by\nErlend E. Aasland.\n\n- bpo-40170(8): Convert *note PyDescrIsData(): 165a. macro to a\nfunction to hide implementation details: The macro accessed *note\nPyTypeObject.tpdescrset: 165b. directly.  Patch by Erlend E.\nAasland.\n\n- bpo-43181(9): Convert *note PyObjectTypeCheck(): 165c. macro to a\nstatic inline function.  Patch by Erlend E. Aasland.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43278\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=43270\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=35134\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=35134\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=40170\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=43239\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=40170\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=40170\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=43181\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 10 0 alpha 5,  Next: Python 3 10 0 alpha 4,  Prev: Python 3 10 0 alpha 6,  Up: Changelog": {
            "content": "'Release date: 2021-02-02'\n\n* Menu:\n\n* Security: Security<18>.\n* Core and Builtins: Core and Builtins<30>.\n* Library: Library<30>.\n* Documentation: Documentation<30>.\n* Tests: Tests<28>.\n* Build: Build<28>.\n* Windows: Windows<28>.\n* macOS: macOS<22>.\n* IDLE: IDLE<16>.\n* C API: C API<26>.\n\nFile: python3.12.info,  Node: Security<18>,  Next: Core and Builtins<30>,  Up: Python 3 10 0 alpha 5\n\n1.22.30.1 Security\n..................\n\n- bpo-42938(1): Avoid static buffers when computing the repr of *note\nctypes.cdouble: 165f. and *note ctypes.clongdouble: 1660. values.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42938\n\nFile: python3.12.info,  Node: Core and Builtins<30>,  Next: Library<30>,  Prev: Security<18>,  Up: Python 3 10 0 alpha 5\n\n1.22.30.2 Core and Builtins\n...........................\n\n- bpo-42990(1): Refactor the 'PyEval' family of functions.\n\n* An new function 'PyEvalVector' is added to simplify calls to\nPython from C.\n\n* 'PyEvalEvalCodeWithName' is removed\n\n* 'PyEvalEvalCodeEx' is retained as part of the API, but is not\nused internally\n\n- bpo-38631(2): Replace *note PyFatalError(): 7a7. calls in the\ncompiler with regular *note SystemError: 2d7. exceptions.  Patch by\nVictor Stinner.\n\n- bpo-42997(3): Improve error message for missing \":\" before blocks.\nPatch by Pablo Galindo.\n\n- bpo-43017(4): Improve error message in the parser when using\nun-parenthesised tuples in comprehensions.  Patch by Pablo Galindo.\n\n- bpo-42986(5): Fix parser crash when reporting syntax errors in\nf-string with newlines.  Patch by Pablo Galindo.\n\n- bpo-40176(6): Syntax errors for unterminated string literals now\npoint to the start of the string instead of reporting EOF/EOL.\n\n- bpo-42927(7): The inline cache for 'LOADATTR' now also optimizes\naccess to attributes defined by 'slots'.  This makes reading\nsuch attribute up to 30% faster.\n\n- bpo-42864(8): Improve error messages in the parser when parentheses\nare not closed.  Patch by Pablo Galindo.\n\n- bpo-42924(9): Fix 'bytearray' repetition incorrectly copying data\nfrom the start of the buffer, even if the data is offset within the\nbuffer (e.g.  after reassigning a slice at the start of the\n'bytearray' to a shorter byte string).\n\n- bpo-42882(10): Fix the 'PyUnicodeFromId()' function\n(PyIDENTIFIER(var) API) when *note PyInitialize(): 6c2. / *note\nPyFinalize(): 11cd. is called multiple times: preserve\n'PyRuntime.unicodeids.nextindex' value.\n\n- bpo-42827(11): Fix a crash when working out the error line of a\n*note SyntaxError: 146. in some multi-line expressions.\n\n- bpo-42823(12): frame.flineno is correct even if frame.ftrace is\nset to True\n\n- bpo-37324(13): Remove deprecated aliases to *note Collections\nAbstract Base Classes: 683. from the *note collections: 1b. module.\n\n- bpo-41994(14): Fixed possible leak in 'import' when 'sys.modules'\nis not a 'dict'.\n\n- bpo-27772(15): In string formatting, preceding the 'width' field by\n''0'' no longer affects the default alignment for strings.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42990\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=38631\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=42997\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=43017\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=42986\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=40176\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=42927\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=42864\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=42924\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=42882\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=42827\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=42823\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=37324\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=41994\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=27772\n\nFile: python3.12.info,  Node: Library<30>,  Next: Documentation<30>,  Prev: Core and Builtins<30>,  Up: Python 3 10 0 alpha 5\n\n1.22.30.3 Library\n.................\n\n- bpo-43108(1): Fixed a reference leak in the *note curses: 29.\nmodule.  Patch by Pablo Galindo\n\n- bpo-43077(2): Update the bundled pip to 21.0.1 and setuptools to\n52.0.0.\n\n- bpo-41282(3): Deprecate 'distutils' in documentation and add\nwarning on import.\n\n- bpo-43014(4): Improve performance of *note tokenize: f6. by 20-30%.\nPatch by Anthony Sottile.\n\n- bpo-42323(5): Fix *note math.nextafter(): 1b7. for NaN on AIX.\n\n- bpo-42955(6): Add *note sys.stdlibmodulenames: 637, containing\nthe list of the standard library module names.  Patch by Victor\nStinner.\n\n- bpo-42944(7): Fix 'random.Random.sample' when 'counts' argument is\nnot 'None'.\n\n- bpo-42934(8): Use *note TracebackException: 471.'s new 'compact'\nparam in *note TestResult: fdc. to reduce time and memory consumed\nby traceback formatting.\n\n- bpo-42931(9): Add 'randbytes()' to 'random.all'.\n\n- bpo-38250(10): [Enum] Flags consisting of a single bit are now\nconsidered canonical, and will be the only flags returned from\nlisting and iterating over a Flag class or a Flag member.\nMulti-bit flags are considered aliases; they will be returned from\nlookups and operations that result in their value.  Iteration for\nboth Flag and Flag members is in definition order.\n\n- bpo-42877(11): Added the 'compact' parameter to the constructor of\n*note traceback.TracebackException: 471. to reduce time and memory\nfor use cases that only need to call 'TracebackException.format()'\nand 'TracebackException.formatexceptiononly()'.\n\n- bpo-42923(12): The *note PyFatalError(): 7a7. function and the\n*note faulthandler: 53. module now dump the list of extension\nmodules on a fatal error.\n\n- bpo-42848(13): Removed recursion from *note TracebackException:\n471. to allow it to handle long exception chains.\n\n- bpo-42901(14): [Enum] move member creation from 'EnumMeta.new'\nto 'protomember.setname', allowing members to be created and\nvisible in 'initsubclass'.\n\n- bpo-42780(15): Fix os.setinheritable() for OPATH file descriptors\non Linux.\n\n- bpo-42866(16): Fix a reference leak in the 'getcodec()' function of\nCJK codecs.  Patch by Victor Stinner.\n\n- bpo-42846(17): Convert the 6 CJK codec extension modules\n(codecscn, codecshk, codecsiso2022, codecsjp, codecskr\nand codecstw) to the multiphase initialization API ( PEP\n489(18)).  Patch by Victor Stinner.\n\n- bpo-42851(19): remove initsubclass support for Enum members\n\n- bpo-42834(20): Make internal caches of the 'json' module\ncompatible with subinterpreters.\n\n- bpo-41748(21): Fix HTMLParser parsing rules for element attributes\ncontaining commas with spaces.  Patch by Karl Dubost.\n\n- bpo-40810(22): Require SQLite 3.7.15 or newer.  Patch by Erlend E.\nAasland.\n\n- bpo-1635741(23): Convert the multibytecodec extension module (CJK\ncodecs) to multi-phase initialization ( PEP 489(24)).  Patch by\nErlend E. Aasland.\n\n- bpo-42802(25): The distutils 'bdistwininst' command deprecated in\nPython 3.8 has been removed.  The distutils 'bdistwheel' command\nis now recommended to distribute binary packages on Windows.\n\n- bpo-24464(26): The undocumented built-in function\n'sqlite3.enablesharedcache' is now deprecated, scheduled for\nremoval in Python 3.12.  Its use is strongly discouraged by the\nSQLite3 documentation.  Patch by Erlend E. Aasland.\n\n- bpo-42384(27): Make pdb populate sys.path[0] exactly the same as\nregular python execution.\n\n- bpo-42383(28): Fix pdb: previously pdb would fail to restart the\ndebugging target if it was specified using a relative path and the\ncurrent directory changed.\n\n- bpo-42005(29): Fix CLI of *note cProfile: 25. and *note profile:\naa. to catch *note BrokenPipeError: ed5.\n\n- bpo-41604(30): Don't decrement the reference count of the previous\nuserptr when setpaneluserptr fails.\n\n- bpo-41149(31): Allow executing callables that have a boolean value\nof 'False' when passed to 'Threading.thread' as the target.  Patch\ncontributed by Barney Stratford.\n\n- bpo-38307(32): Add an 'endlineno' attribute to the Class and\nFunction objects that appear in the tree returned by pyclbr\nfunctions.  This and the existing 'lineno' attribute define the\nextent of class and def statements.  Patch by Aviral Srivastava.\n\n- bpo-39273(33): The 'BUTTON5*' constants are now exposed in the\n*note curses: 29. module if available.\n\n- bpo-33289(34): Correct call to *note tkinter.colorchooser: eb. to\nreturn RGB triplet of ints instead of floats.  Patch by Cheryl\nSabella.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43108\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=43077\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=41282\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=43014\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=42323\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=42955\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=42944\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=42934\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=42931\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=38250\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=42877\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=42923\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=42848\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=42901\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=42780\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=42866\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=42846\n\n(18) https://peps.python.org/pep-0489/\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=42851\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=42834\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=41748\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=40810\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(24) https://peps.python.org/pep-0489/\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=42802\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=24464\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=42384\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=42383\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=42005\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=41604\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=41149\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=38307\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=39273\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=33289\n\nFile: python3.12.info,  Node: Documentation<30>,  Next: Tests<28>,  Prev: Library<30>,  Up: Python 3 10 0 alpha 5\n\n1.22.30.4 Documentation\n.......................\n\n- bpo-40304(1): Fix doc for type(name, bases, dict).  Patch by Boris\nVerkhovskiy and ??ric Araujo.\n\n- bpo-42811(2): Updated importlib.util.resolvename() doc to use\nspec.parent instead of package.  (Thanks Yair Frid.)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40304\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=42811\n\nFile: python3.12.info,  Node: Tests<28>,  Next: Build<28>,  Prev: Documentation<30>,  Up: Python 3 10 0 alpha 5\n\n1.22.30.5 Tests\n...............\n\n- bpo-40823(1): Use 'unittest.TestLoader().loadTestsFromTestCase()'\ninstead of 'unittest.makeSuite()' in *note sqlite3: c9. tests.\nPatch by Erlend E. Aasland.\n\n- bpo-40810(2): In *note sqlite3: c9, fix 'CheckTraceCallbackContent'\nfor SQLite pre 3.7.15.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40823\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=40810\n\nFile: python3.12.info,  Node: Build<28>,  Next: Windows<28>,  Prev: Tests<28>,  Up: Python 3 10 0 alpha 5\n\n1.22.30.6 Build\n...............\n\n- bpo-43031(1): Pass '--timeout=$(TESTTIMEOUT)' option to the default\nprofile task './python -m test --pgo' command.\n\n- bpo-36143(2): 'make regen-all' now also runs 'regen-keyword'.\nPatch by Victor Stinner.\n\n- bpo-42874(3): Removed the grep -q and -E flags in the tzpath\nvalidation section of the configure script to better accommodate\nusers of some platforms (specifically Solaris 10).\n\n- bpo-31904(4): Add library search path by wr-cc in\naddcrosscompilingpaths() for VxWorks.\n\n- bpo-42856(5): Add '--with-wheel-pkg-dir=PATH' option to the\n'./configure' script.  If specified, the *note ensurepip: 50.\nmodule looks for 'setuptools' and 'pip' wheel packages in this\ndirectory: if both are present, these wheel packages are used\ninstead of ensurepip bundled wheel packages.\n\nSome Linux distribution packaging policies recommend against\nbundling dependencies.  For example, Fedora installs wheel packages\nin the '/usr/share/python-wheels/' directory and don't install the\n'ensurepip.bundled' package.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43031\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=36143\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=42874\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=42856\n\nFile: python3.12.info,  Node: Windows<28>,  Next: macOS<22>,  Prev: Build<28>,  Up: Python 3 10 0 alpha 5\n\n1.22.30.7 Windows\n.................\n\n- bpo-41837(1): Updated Windows installer to include OpenSSL 1.1.1i\n\n- bpo-42584(2): Upgrade Windows installer to use SQLite 3.34.0.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=41837\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=42584\n\nFile: python3.12.info,  Node: macOS<22>,  Next: IDLE<16>,  Prev: Windows<28>,  Up: Python 3 10 0 alpha 5\n\n1.22.30.8 macOS\n...............\n\n- bpo-42504(1): Ensure that the value of\nsysconfig.getconfigvar('MACOSXDEPLOYMENTTARGET') is always a\nstring, even in when the value is parsable as an integer.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42504\n\nFile: python3.12.info,  Node: IDLE<16>,  Next: C API<26>,  Prev: macOS<22>,  Up: Python 3 10 0 alpha 5\n\n1.22.30.9 IDLE\n..............\n\n- bpo-43008(1): Make IDLE invoke *note sys.excepthook(): 5ff. in\nnormal, 2-process mode.  Patch by Ken Hilton.\n\n- bpo-33065(2): Fix problem debugging user classes with repr\nmethod.\n\n- bpo-23544(3): Disable Debug=>Stack Viewer when user code is running\nor Debugger is active, to prevent hang or crash.  Patch by Zackery\nSpytz.\n\n- bpo-32631(4): Finish zzdummy example extension module: make menu\nentries work; add docstrings and tests with 100% coverage.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=43008\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=33065\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=23544\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=32631\n\nFile: python3.12.info,  Node: C API<26>,  Prev: IDLE<16>,  Up: Python 3 10 0 alpha 5\n\n1.22.30.10 C API\n................\n\n- bpo-42979(1): When Python is built in debug mode (with C\nassertions), calling a type slot like 'sqlength' ('len()' in\nPython) now fails with a fatal error if the slot succeeded with an\nexception set, or failed with no exception set.  The error message\ncontains the slot, the type name, and the current exception (if an\nexception is set).  Patch by Victor Stinner.\n\n- bpo-43030(2): Fixed a compiler warning in *note\nPyUNICODEISSPACE(): 166a. on platforms with signed 'wchart'.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42979\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=43030\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 10 0 alpha 4,  Next: Python 3 10 0 alpha 3,  Prev: Python 3 10 0 alpha 5,  Up: Changelog": {
            "content": "'Release date: 2021-01-04'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<31>.\n* Library: Library<31>.\n* Documentation: Documentation<31>.\n* Tests: Tests<29>.\n* Build: Build<29>.\n* macOS: macOS<23>.\n* Tools/Demos: Tools/Demos<15>.\n* C API: C API<27>.\n\nFile: python3.12.info,  Node: Core and Builtins<31>,  Next: Library<31>,  Up: Python 3 10 0 alpha 4\n\n1.22.31.1 Core and Builtins\n...........................\n\n- bpo-42814(1): Fix undefined behavior in\n'Objects/genericaliasobject.c'.\n\n- bpo-42806(2): Fix the column offsets for f-strings *note ast: 8.\nnodes surrounded by parentheses and for nodes that spawn multiple\nlines.  Patch by Pablo Galindo.\n\n- bpo-40631(3): Fix regression where a single parenthesized starred\nexpression was a valid assignment target.\n\n- bpo-27794(4): Improve the error message for failed writes/deletes\nto property objects.  When possible, the attribute name is now\nshown.  Patch provided by Yurii Karabas.\n\n- bpo-42745(5): Make the type attribute lookup cache per-interpreter.\nPatch by Victor Stinner.\n\n- bpo-42246(6): Jumps to jumps are not eliminated when it would break\nPEP 626.\n\n- bpo-42246(7): Make sure that the 'flasti' and 'flineno'\nattributes of a frame are set correctly when an exception is raised\nor re-raised.  Required for PEP 626.\n\n- bpo-32381(8): The coding cookie (ex: '# coding: latin1') is now\nignored in the command passed to the *note -c: 3a4. command line\noption.  Patch by Victor Stinner.\n\n- bpo-30858(9): Improve error location in expressions that contain\nassignments.  Patch by Pablo Galindo and Lysandros Nikolaou.\n\n- bpo-42615(10): Remove jump commands made redundant by the deletion\nof unreachable bytecode blocks\n\n- bpo-42639(11): Make the *note atexit: a. module state\nper-interpreter.  It is now safe have more than one *note atexit:\na. module instance.  Patch by Donghee Na and Victor Stinner.\n\n- bpo-32381(12): Fix encoding name when running a '.pyc' file on\nWindows: *note PyRunSimpleFileExFlags(): 166d. now uses the\ncorrect encoding to decode the filename.\n\n- bpo-42195(13): The 'args' of the parameterized generics for\n*note typing.Callable: 5b8. and *note collections.abc.Callable:\n5de. are now consistent.  The 'args' for *note\ncollections.abc.Callable: 5de. are now flattened while *note\ntyping.Callable: 5b8.'s have not changed.  To allow this change,\n*note types.GenericAlias: 5df. can now be subclassed and\n'collections.abc.Callable''s 'classgetitem' will now return a\nsubclass of 'types.GenericAlias'.  Tests for typing were also\nupdated to not subclass things like 'Callable[..., T]' as that is\nnot a valid base class.  Finally, both 'Callable's no longer\nvalidate their 'argtypes', in 'Callable[[argtypes], resulttype]' to\nprepare for PEP 612(14).  Patch by Ken Jin.\n\n- bpo-40137(15): Convert functools module to use *note\nPyTypeFromModuleAndSpec(): 2aa.\n\n- bpo-40077(16): Convert *note array: 7. to use heap types, and\nestablish module state for these.\n\n- bpo-42008(17): Fix random.Random() seeding.\n\n- bpo-1635741(18): Port the 'pyexpat' extension module to multi-phase\ninitialization ( PEP 489(19)).\n\n- bpo-40521(20): Make the Unicode dictionary of interned strings\ncompatible with subinterpreters.  Patch by Victor Stinner.\n\n- bpo-39465(21): Make 'PyUnicodeFromId()' function compatible with\nsubinterpreters.  Each interpreter now has an array of identifier\nobjects (interned strings decoded from UTF-8).  Patch by Victor\nStinner.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42814\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=42806\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=40631\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=27794\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=42745\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=42246\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=42246\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=32381\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=30858\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=42615\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=42639\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=32381\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=42195\n\n(14) https://peps.python.org/pep-0612/\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=40137\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=40077\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=42008\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(19) https://peps.python.org/pep-0489/\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=40521\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=39465\n\nFile: python3.12.info,  Node: Library<31>,  Next: Documentation<31>,  Prev: Core and Builtins<31>,  Up: Python 3 10 0 alpha 4\n\n1.22.31.2 Library\n.................\n\n- bpo-42257(1): Handle empty string in variable executable in\nplatform.libcver()\n\n- bpo-42772(2): randrange() now raises a TypeError when step is\nspecified without a stop argument.  Formerly, it silently ignored\nthe step argument.\n\n- bpo-42759(3): Fixed equality comparison of 'tkinter.Variable' and\n*note tkinter.font.Font: 166f.  Objects which belong to different\nTcl interpreters are now always different, even if they have the\nsame name.\n\n- bpo-42756(4): Configure LMTP Unix-domain socket to use socket\nglobal default timeout when a timeout is not explicitly provided.\n\n- bpo-23328(5): Allow / character in username, password fields on\nPROXY envars.\n\n- bpo-42740(6): *note typing.getargs(): 68a. and *note\ntyping.getorigin(): 873. now support PEP 604(7) union types and\nPEP 612(8) additions to 'Callable'.\n\n- bpo-42655(9): *note subprocess: d0. 'extragroups' is now correctly\npassed into setgroups() system call.\n\n- bpo-42727(10): 'EnumMeta.prepare' now accepts 'kwds' to\nproperly support 'initsubclass'\n\n- bpo-38308(11): Add optional 'weights' to\n'statistics.harmonicmean()'.\n\n- bpo-42721(12): When simple query dialogs (*note\ntkinter.simpledialog: f2.), message boxes (*note\ntkinter.messagebox: f0.) or color choose dialog (*note\ntkinter.colorchooser: eb.) are created without arguments 'master'\nand 'parent', and the default root window is not yet created, and\n'NoDefaultRoot()' was not called, a new temporal hidden root window\nwill be created automatically.  It will not be set as the default\nroot window and will be destroyed right after closing the dialog\nwindow.  It will help to use these simple dialog windows in\nprograms which do not need other GUI.\n\n- bpo-25246(13): Optimized *note collections.deque.remove(): 1670.\n\n- bpo-35728(14): Added a root parameter to *note\ntkinter.font.nametofont(): 1671.\n\n- bpo-15303(15): *note tkinter: ea. supports now widgets with boolean\nvalue False.\n\n- bpo-42681(16): Fixed range checks for color and pair numbers in\n*note curses: 29.\n\n- bpo-42685(17): Improved placing of simple query windows in Tkinter\n(such as *note tkinter.simpledialog.askinteger(): 1672.).  They are\nnow centered at the center of the parent window if it is specified\nand shown, otherwise at the center of the screen.\n\n- bpo-9694(18): Argparse help no longer uses the confusing phrase,\n\"optional arguments\".  It uses \"options\" instead.\n\n- bpo-1635741(19): Port the *note thread: 2. extension module to the\nmultiphase initialization API ( PEP 489(20)) and convert its static\ntypes to heap types.\n\n- bpo-37961(21): Fix crash in 'tracemalloc.Traceback.repr()'\n(regressed in Python 3.9).\n\n- bpo-42630(22): *note tkinter: ea. functions and constructors which\nneed a default root window raise now *note RuntimeError: 17a. with\ndescriptive message instead of obscure *note AttributeError: 395.\nor *note NameError: 144. if it is not created yet or cannot be\ncreated automatically.\n\n- bpo-42639(23): 'atexit.runexitfuncs()' now logs callback\nexceptions using *note sys.unraisablehook: 448, rather than logging\nthem directly into *note sys.stderr: 757. and raise the last\nexception.\n\n- bpo-42644(24): 'logging.disable' will now validate the types and\nvalue of its parameter.  It also now accepts strings representing\nthe levels (as does 'loging.setLevel') instead of only the\nnumerical values.\n\n- bpo-42639(25): At Python exit, if a callback registered with *note\natexit.register(): 689. fails, its exception is now logged.\nPreviously, only some exceptions were logged, and the last\nexception was always silently ignored.\n\n- bpo-36541(26): Fixed lib2to3.pgen2 to be able to parse PEP-570\npositional only argument syntax.\n\n- bpo-42382(27): In 'importlib.metadata': - 'EntryPoint' objects now\nexpose a '.dist' object referencing the 'Distribution' when\nconstructed from a 'Distribution'.  - Add support for package\ndiscovery under package normalization rules.  - The object returned\nby 'metadata()' now has a formally defined protocol called\n'PackageMetadata' with declared support for the '.getall()'\nmethod.  - Synced with importlibmetadata 3.3.\n\n- bpo-41877(28): A check is added against misspellings of autospect,\nautospec and setspec being passed as arguments to patch,\npatch.object and createautospec.\n\n- bpo-39717(29): [tarfile] update nested exception raising to use\n'from None' or 'from e'\n\n- bpo-41877(30): AttributeError for suspected misspellings of\nassertions on mocks are now pointing out that the cause are\nmisspelled assertions and also what to do if the misspelling is\nactually an intended attribute name.  The unittest.mock document is\nalso updated to reflect the current set of recognised misspellings.\n\n- bpo-41559(31): Implemented PEP 612(32): added 'ParamSpec' and\n'Concatenate' to *note typing: ff.  Patch by Ken Jin.\n\n- bpo-42385(33): StrEnum: fix generatenextvalue to return a str\n\n- bpo-31904(34): Define THREADSTACKSIZE for VxWorks.\n\n- bpo-34750(35): [Enum] 'EnumDict.update()' is now supported.\n\n- bpo-42517(36): Enum: private names do not become members / do not\ngenerate errors - they remain normal attributes\n\n- bpo-42678(37): 'Enum': call 'initsubclass' after members have\nbeen added\n\n- bpo-28964(38): *note ast.literaleval(): a5e. adds line number\ninformation (if available) in error message for malformed nodes.\n\n- bpo-42470(39): *note random.sample(): 52d. no longer warns on a\nsequence which is also a set.\n\n- bpo-31904(40): 'posixpath.expanduser()' returns the input 'path'\nunchanged if user home directory is None on VxWorks.\n\n- bpo-42388(41): Fix subprocess.checkoutput(..., input=None) behavior\nwhen text=True to be consistent with that of the documentation and\nuniversalnewlines=True.\n\n- bpo-34463(42): Fixed discrepancy between *note traceback: f9. and\nthe interpreter in formatting of SyntaxError with lineno not set\n(*note traceback: f9. was changed to match interpreter).\n\n- bpo-42393(43): Raise *note OverflowError: 68d. instead of silent\ntruncation in *note socket.ntohs(): 68c. and *note socket.htons():\n68b.  Silent truncation was deprecated in Python 3.7.  Patch by\nErlend E. Aasland\n\n- bpo-42222(44): Harmonized *note random.randrange(): 665. argument\nhandling to match *note range(): 761.\n\n* The integer test and conversion in 'randrange()' now uses\n*note operator.index(): 1673.\n\n* Non-integer arguments to 'randrange()' are deprecated.\n\n* The 'ValueError' is deprecated in favor of a 'TypeError'.\n\n* It now runs a little faster than before.\n\n(Contributed by Raymond Hettinger and Serhiy Storchaka.)\n\n- bpo-42163(45): Restore compatibility for 'unameresult' around\ndeepcopy and replace.\n\n- bpo-42090(46): 'zipfile.Path.joinpath' now accepts arbitrary\narguments, same as 'pathlib.Path.joinpath'.\n\n- bpo-1635741(47): Port the csv module to the multi-phase\ninitialization API ( PEP 489(48)).\n\n- bpo-42059(49): *note typing.TypedDict: 153. types created using the\nalternative call-style syntax now correctly respect the 'total'\nkeyword argument when setting their 'requiredkeys' and\n'optionalkeys' class attributes.\n\n- bpo-41960(50): Add 'globalns' and 'localns' parameters to the *note\ninspect.signature(): 51c. and *note\ninspect.Signature.fromcallable(): 51f.\n\n- bpo-41907(51): fix 'format()' behavior for 'IntFlag'\n\n- bpo-41891(52): Ensure asyncio.waitfor waits for task completion\n\n- bpo-24792(53): Fixed bug where 'zipimporter' sometimes reports an\nincorrect cause of import errors.\n\n- bpo-31904(54): Fix site and sysconfig modules for VxWorks RTOS\nwhich has no home directories.\n\n- bpo-41462(55): Add *note os.setblocking(): c99. support for\nVxWorks RTOS.\n\n- bpo-40219(56): Lowered 'tkinter.ttk.LabeledScale' dummy widget to\nprevent hiding part of the content label.\n\n- bpo-37193(57): Fixed memory leak in 'socketserver.ThreadingMixIn'\nintroduced in Python 3.7.\n\n- bpo-39068(58): Fix initialization race condition in 'a85encode()'\nand 'b85encode()' in *note base64: c.  Patch by Brandon Stansbury.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42257\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=42772\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=42759\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=42756\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=23328\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=42740\n\n(7) https://peps.python.org/pep-0604/\n\n(8) https://peps.python.org/pep-0612/\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=42655\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=42727\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=38308\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=42721\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=25246\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=35728\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=15303\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=42681\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=42685\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=9694\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(20) https://peps.python.org/pep-0489/\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=37961\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=42630\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=42639\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=42644\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=42639\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=36541\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=42382\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=41877\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=39717\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=41877\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=41559\n\n(32) https://peps.python.org/pep-0612/\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=42385\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=34750\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=42517\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=42678\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=28964\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=42470\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=42388\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=34463\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=42393\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=42222\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=42163\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=42090\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(48) https://peps.python.org/pep-0489/\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=42059\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=41960\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=41907\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=41891\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=24792\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=41462\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=40219\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=37193\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=39068\n\nFile: python3.12.info,  Node: Documentation<31>,  Next: Tests<29>,  Prev: Library<31>,  Up: Python 3 10 0 alpha 4\n\n1.22.31.3 Documentation\n.......................\n\n- bpo-17140(1): Add documentation for the *note\nmultiprocessing.pool.ThreadPool: 1675. class.\n\n- bpo-34398(2): Prominently feature listings from the glossary in\ndocumentation search results.  Patch by Ammar Askar.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=17140\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=34398\n\nFile: python3.12.info,  Node: Tests<29>,  Next: Build<29>,  Prev: Documentation<31>,  Up: Python 3 10 0 alpha 4\n\n1.22.31.4 Tests\n...............\n\n- bpo-42794(1): Update testnntplib to use official group name of\nnews.aioe.org for testing.  Patch by Donghee Na.\n\n- bpo-31904(2): Skip some asyncio tests on VxWorks.\n\n- bpo-42641(3): Enhance 'testselect.testselect()': it now takes 500\nmilliseconds rather than 10 seconds.  Use Python rather than a\nshell to make the test more portable.\n\n- bpo-31904(4): Skip some tests in testallchowncommon() on\nVxWorks.\n\n- bpo-42199(5): Fix bytecode helper assertNotInBytecode.\n\n- bpo-41443(6): Add more attribute checking in testposix.py\n\n- bpo-31904(7): Disable os.popen and impacted tests on VxWorks\n\n- bpo-41439(8): Port testssl and testuuid to VxWorks RTOS.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42794\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=42641\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=42199\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=41443\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=41439\n\nFile: python3.12.info,  Node: Build<29>,  Next: macOS<23>,  Prev: Tests<29>,  Up: Python 3 10 0 alpha 4\n\n1.22.31.5 Build\n...............\n\n- bpo-42692(1): Fix builtinavailable check on older compilers.\nPatch by Joshua Root.\n\n- bpo-27640(2): Added '--disable-test-modules' option to the\n'configure' script: don't build nor install test modules.  Patch by\nXavier de Gaye, Thomas Petazzoni and Peixing Xin.\n\n- bpo-42604(3): Now all platforms use a value for the \"EXTSUFFIX\"\nbuild variable derived from SOABI (for instance in freeBSD,\n\"EXTSUFFIX\" is now \".cpython-310d.so\" instead of \".so\").\nPreviously only Linux, Mac and VxWorks were using a value for\n\"EXTSUFFIX\" that included \"SOABI\".\n\n- bpo-42598(4): Fix implicit function declarations in configure which\ncould have resulted in incorrect configuration checks.  Patch\ncontributed by Joshua Root.\n\n- bpo-31904(5): Enable libpython3.so for VxWorks.\n\n- bpo-29076(6): Add fish shell support to macOS installer.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42692\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=27640\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=42604\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=42598\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=29076\n\nFile: python3.12.info,  Node: macOS<23>,  Next: Tools/Demos<15>,  Prev: Build<29>,  Up: Python 3 10 0 alpha 4\n\n1.22.31.6 macOS\n...............\n\n- bpo-42361(1): Update macOS installer build to use Tcl/Tk 8.6.11\n(rc2, expected to be final release).\n\n- bpo-41837(2): Update macOS installer build to use OpenSSL 1.1.1i.\n\n- bpo-42584(3): Update macOS installer to use SQLite 3.34.0.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42361\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=41837\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=42584\n\nFile: python3.12.info,  Node: Tools/Demos<15>,  Next: C API<27>,  Prev: macOS<23>,  Up: Python 3 10 0 alpha 4\n\n1.22.31.7 Tools/Demos\n.....................\n\n- bpo-42726(1): Fixed Python 3 compatibility issue with\ngdb/libpython.py handling of attribute dictionaries.\n\n- bpo-42613(2): Fix 'freeze.py' tool to use the prope config and\nlibrary directories.  Patch by Victor Stinner.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42726\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=42613\n\nFile: python3.12.info,  Node: C API<27>,  Prev: Tools/Demos<15>,  Up: Python 3 10 0 alpha 4\n\n1.22.31.8 C API\n...............\n\n- bpo-42591(1): Export the 'PyFrozenMain()' function: fix a Python\n3.9.0 regression.  Python 3.9 uses '-fvisibility=hidden' and the\nfunction was not exported explicitly and so not exported.\n\n- bpo-32381(2): Remove the private 'Pyfopen()' function which is no\nlonger needed.  Use 'Pywfopen()' or 'Pyfopenobj()' instead.\nPatch by Victor Stinner.\n\n- bpo-1635741(3): Port *note resource: b7. extension module to module\nstate\n\n- bpo-42111(4): Update the 'xxlimited' module to be a better example\nof how to use the limited C API.\n\n- bpo-40052(5): Fix an alignment build warning/error in function\n'PyVectorcallFunction()'.  Patch by Andreas Schneider, Antoine\nPitrou and Petr Viktorin.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42591\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32381\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=42111\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=40052\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 10 0 alpha 3,  Next: Python 3 10 0 alpha 2,  Prev: Python 3 10 0 alpha 4,  Up: Changelog": {
            "content": "'Release date: 2020-12-07'\n\n* Menu:\n\n* Security: Security<19>.\n* Core and Builtins: Core and Builtins<32>.\n* Library: Library<32>.\n* Documentation: Documentation<32>.\n* Tests: Tests<30>.\n* Build: Build<30>.\n* Windows: Windows<29>.\n* macOS: macOS<24>.\n* IDLE: IDLE<17>.\n* Tools/Demos: Tools/Demos<16>.\n* C API: C API<28>.\n\nFile: python3.12.info,  Node: Security<19>,  Next: Core and Builtins<32>,  Up: Python 3 10 0 alpha 3\n\n1.22.32.1 Security\n..................\n\n- bpo-40791(1): Add 'volatile' to the accumulator variable in\n'hmac.comparedigest', making constant-time-defeating optimizations\nless likely.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40791\n\nFile: python3.12.info,  Node: Core and Builtins<32>,  Next: Library<32>,  Prev: Security<19>,  Up: Python 3 10 0 alpha 3\n\n1.22.32.2 Core and Builtins\n...........................\n\n- bpo-42576(1): 'types.GenericAlias' will now raise a 'TypeError'\nwhen attempting to initialize with a keyword argument.  Previously,\nthis would cause the interpreter to crash if the interpreter was\ncompiled with debug symbols.  This does not affect interpreters\ncompiled for release.  Patch by Ken Jin.\n\n- bpo-42536(2): Several built-in and standard library types now\nensure that their internal result tuples are always tracked by the\n*note garbage collector: 167e.:\n\n- *note collections.OrderedDict.items(): 39f.\n\n- *note dict.items(): 5c1.\n\n- *note enumerate(): 12d5.\n\n- *note functools.reduce(): 1151.\n\n- *note itertools.combinations(): 1188.\n\n- *note itertools.combinationswithreplacement(): 10fa.\n\n- *note itertools.permutations(): 167f.\n\n- *note itertools.product(): 1189.\n\n- *note itertools.ziplongest(): 1116.\n\n- *note zip(): 5c2.\n\nPreviously, they could have become untracked by a prior garbage\ncollection.  Patch by Brandt Bucher.\n\n- bpo-42500(3): Improve handling of exceptions near recursion limit.\nConverts a number of Fatal Errors in RecursionErrors.\n\n- bpo-42246(4): PEP 626: After a return, the flineno attribute of a\nframe is always the last line executed.\n\n- bpo-42435(5): Speed up comparison of bytes objects with non-bytes\nobjects when option *note -b: 3a8. is specified.  Speed up\ncomparison of bytarray objects with non-buffer object.\n\n- bpo-1635741(6): Port the 'warnings' extension module to the\nmulti-phase initialization API ( PEP 489(7)).  Patch by Victor\nStinner.\n\n- bpo-41686(8): On Windows, the 'SIGINT' event,\n'PyOSSigintEvent()', is now created even if Python is configured\nto not install signal handlers (if *note\nPyConfig.installsignalhandlers: 6d6. equals to 0, or\n'PyInitializeEx(0)').\n\n- bpo-42381(9): Allow assignment expressions in set literals and set\ncomprehensions as per PEP 572.  Patch by Pablo Galindo.\n\n- bpo-42202(10): Change function parameters annotations internal\nrepresentation to tuple of strings.  Patch provided by Yurii\nKarabas.\n\n- bpo-42374(11): Fix a regression introduced by the new parser, where\nan unparenthesized walrus operator was not allowed within generator\nexpressions.\n\n- bpo-42316(12): Allow an unparenthesized walrus in subscript\nindexes.\n\n- bpo-42349(13): Make sure that the compiler front-end produces a\nwell-formed control flow graph.  Be be more aggressive in the\ncompiler back-end, as it is now safe to do so.\n\n- bpo-42296(14): On Windows, fix a regression in signal handling\nwhich prevented to interrupt a program using CTRL+C. The signal\nhandler can be run in a thread different than the Python thread, in\nwhich case the test deciding if the thread can handle signals is\nwrong.\n\n- bpo-42332(15): *note types.GenericAlias: 5df. objects can now be\nthe targets of weakrefs.\n\n- bpo-42282(16): Optimise constant subexpressions that appear as part\nof named expressions (previously the AST optimiser did not descend\ninto named expressions).  Patch by Nick Coghlan.\n\n- bpo-42266(17): Fixed a bug with the LOADATTR opcode cache that was\nnot respecting monkey-patching a class-level attribute to make it a\ndescriptor.  Patch by Pablo Galindo.\n\n- bpo-40077(18): Convert *note queue: b1. to use heap types.\n\n- bpo-42246(19): Improved accuracy of line tracing events and\nflineno attribute of Frame objects.  See PEP 626 for details.\n\n- bpo-40077(20): Convert *note mmap: 8b. to use heap types.\n\n- bpo-42233(21): Allow 'GenericAlias' objects to use *note union type\nexpressions: 5b5.  This allows expressions like 'list[int] |\ndict[float, str]' where previously a 'TypeError' would have been\nthrown.  This also fixes union type expressions not de-duplicating\n'GenericAlias' objects.  (Contributed by Ken Jin in bpo-42233(22).)\n\n- bpo-26131(23): The import system triggers a 'ImportWarning' when it\nfalls back to using 'loadmodule()'.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42576\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=42536\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=42500\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=42246\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=42435\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(7) https://peps.python.org/pep-0489/\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=41686\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=42381\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=42202\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=42374\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=42316\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=42349\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=42296\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=42332\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=42282\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=42266\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=40077\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=42246\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=40077\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=42233\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=42233\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=26131\n\nFile: python3.12.info,  Node: Library<32>,  Next: Documentation<32>,  Prev: Core and Builtins<32>,  Up: Python 3 10 0 alpha 3\n\n1.22.32.3 Library\n.................\n\n- bpo-5054(1): CGIHTTPRequestHandler.runcgi() HTTPACCEPT improperly\nparsed.  Replace the special purpose getallmatchingheaders with\ngeneric getall method and add relevant tests.\n\nOriginal Patch by Martin Panter.  Modified by Senthil Kumaran.\n\n- bpo-42562(2): Fix issue when dis failed to parse function that has\nno line numbers.  Patch provided by Yurii Karabas.\n\n- bpo-17735(3): 'inspect.findsource()' now raises *note OSError: 613.\ninstead of *note IndexError: 138f. when 'colineno' of a code\nobject is greater than the file length.  This can happen, for\nexample, when a file is edited after it was imported.  PR by Irit\nKatriel.\n\n- bpo-42116(4): Fix handling of trailing comments by *note\ninspect.getsource(): 144e.\n\n- bpo-42532(5): Remove unexpected call of 'bool' when passing a\n'specarg' argument to a Mock.\n\n- bpo-38200(6): Added itertools.pairwise()\n\n- bpo-41818(7): Fix testmasterread() so that it succeeds on all\nplatforms that either raise OSError or return b\"\" upon reading from\nmaster.\n\n- bpo-42487(8): ChainMap.iter no longer calls getitem on\nunderlying maps\n\n- bpo-42482(9): *note TracebackException: 471. no longer holds a\nreference to the exception's traceback object.  Consequently,\ninstances of TracebackException for equivalent but non-equal\nexceptions now compare as equal.\n\n- bpo-41818(10): Make testopenpty() avoid unexpected success due to\nnumber of rows and/or number of columns being == 0.\n\n- bpo-42392(11): Remove loop parameter from 'asyncio.subprocess' and\n'asyncio.tasks' functions.  Patch provided by Yurii Karabas.\n\n- bpo-42392(12): Remove loop parameter from 'asyncio.openconnection'\nand 'asyncio.startserver' functions.  Patch provided by Yurii\nKarabas.\n\n- bpo-28468(13): Add *note platform.freedesktoposrelease(): 61b.\nfunction to parse freedesktop.org 'os-release' files.\n\n- bpo-42299(14): Removed the 'formatter' module, which was deprecated\nin Python 3.4.  It is somewhat obsolete, little used, and not\ntested.  It was originally scheduled to be removed in Python 3.6,\nbut such removals were delayed until after Python 2.7 EOL. Existing\nusers should copy whatever classes they use into their code.  Patch\nby Donghee Na and and Terry J. Reedy.\n\n- bpo-26131(15): Deprecate zipimport.zipimporter.loadmodule() in\nfavour of execmodule().\n\n- bpo-41818(16): Updated tests for the pty library.  testbasic() has\nbeen changed to testopenpty(); this additionally checks if slave\ntermios and slave winsize are being set properly by pty.openpty().\nIn order to add support for FreeBSD, NetBSD, OpenBSD, and Darwin,\nthis also adds testmasterread(), which demonstrates that\npty.spawn() should not depend on an OSError to exit from its copy\nloop.\n\n- bpo-42392(17): Remove loop parameter from 'init' in all\n'asyncio.locks' and 'asyncio.Queue' classes.  Patch provided by\nYurii Karabas.\n\n- bpo-15450(18): Make *note filecmp.dircmp: db0. respect subclassing.\nNow the *note filecmp.dircmp.subdirs: 1681. behaves as expected\nwhen subclassing dircmp.\n\n- bpo-42413(19): The exception *note socket.timeout: 629. is now an\nalias of *note TimeoutError: 62a.\n\n- bpo-31904(20): Support signal module on VxWorks.\n\n- bpo-42406(21): We fixed an issue in 'pickle.whichmodule' in which\nimporting 'multiprocessing' could change the how pickle identifies\nwhich module an object belongs to, potentially breaking the\nunpickling of those objects.\n\n- bpo-42403(22): Simplify the *note importlib: 71. external bootstrap\ncode: 'importlib.bootstrapexternal' now uses regular imports to\nimport builtin modules.  When it is imported, the builtin *note\nimport(): 6ed. function is already fully working and so can be\nused to import builtin modules like *note sys: d3.  Patch by Victor\nStinner.\n\n- bpo-1635741(23): Convert sre module types to heap types (PEP 384).\nPatch by Erlend E. Aasland.\n\n- bpo-42375(24): subprocess module update for DragonFlyBSD support.\n\n- bpo-41713(25): Port the 'signal' extension module to the\nmulti-phase initialization API ( PEP 489(26)).  Patch by Victor\nStinner and Mohamed Koubaa.\n\n- bpo-37205(27): *note time.time(): 918, *note time.perfcounter():\n8b6. and *note time.monotonic(): ce1. functions can no longer fail\nwith a Python fatal error, instead raise a regular Python exception\non failure.\n\n- bpo-42328(28): Fixed *note tkinter.ttk.Style.map(): 1682.  The\nfunction accepts now the representation of the default state as\nempty sequence (as returned by 'Style.map()').  The structure of\nthe result is now the same on all platform and does not depend on\nthe value of 'wantobjects'.\n\n- bpo-42345(29): Fix various issues with 'typing.Literal' parameter\nhandling (flatten, deduplicate, use type to cache key).  Patch\nprovided by Yurii Karabas.\n\n- bpo-37205(30): *note time.perfcounter(): 8b6. on Windows and *note\ntime.monotonic(): ce1. on macOS are now system-wide.  Previously,\nthey used an offset computed at startup to reduce the precision\nloss caused by the float type.  Use *note time.perfcounterns():\n91c. and *note time.monotonicns(): 91b. added in Python 3.7 to\navoid this precision loss.\n\n- bpo-42318(31): Fixed support of non-BMP characters in *note\ntkinter: ea. on macOS.\n\n- bpo-42350(32): Fix the *note threading.Thread: 76c. class at fork:\ndo nothing if the thread is already stopped (ex: fork called at\nPython exit).  Previously, an error was logged in the child\nprocess.\n\n- bpo-42333(33): Port ssl extension module to heap types.\n\n- bpo-42014(34): The 'onerror' callback from 'shutil.rmtree' now\nreceives correct function when 'os.open' fails.\n\n- bpo-42237(35): Fix 'os.sendfile()' on illumos.\n\n- bpo-42308(36): Add *note threading.excepthook: 640. to allow\nretrieving the original value of *note threading.excepthook(): 641.\nin case it is set to a broken or a different value.  Patch by Mario\nCorchero.\n\n- bpo-42131(37): Implement PEP 451/spec methods on\nzipimport.zipimporter: findspec(), createmodule(), and\nexecmodule().\n\nThis also allows for the documented deprecation of findloader(),\nfindmodule(), and loadmodule().\n\n- bpo-41877(38): Mock objects which are not unsafe will now raise an\nAttributeError if an attribute with the prefix asert, aseert, or\nassrt is accessed, in addition to this already happening for the\nprefixes assert or assret.\n\n- bpo-42264(39): 'sqlite3.OptimizedUnicode' has been undocumented and\nobsolete since Python 3.3, when it was made an alias to *note str:\n157.  It is now deprecated, scheduled for removal in Python 3.12.\n\n- bpo-42251(40): Added *note threading.gettrace(): 63c. and *note\nthreading.getprofile(): 63d. to retrieve the functions set by *note\nthreading.settrace(): 63e. and *note threading.setprofile(): 63f.\nrespectively.  Patch by Mario Corchero.\n\n- bpo-42249(41): Fixed writing binary Plist files larger than 4 GiB.\n\n- bpo-42236(42): On Unix, the *note os.deviceencoding(): 15f4.\nfunction now returns ''UTF-8'' rather than the device encoding if\nthe *note Python UTF-8 Mode: 420. is enabled.\n\n- bpo-41754(43): webbrowser: Ignore 'NotADirectoryError' when calling\n'xdg-settings'.\n\n- bpo-42183(44): Fix a stack overflow error for asyncio Task or\nFuture repr().\n\nThe overflow occurs under some circumstances when a Task or Future\nrecursively returns itself.\n\n- bpo-42140(45): Improve asyncio.wait function to create the futures\nset just one time.\n\n- bpo-42133(46): Update various modules in the stdlib to fall back on\n'spec.loader' when 'loader' isn't defined on a module.\n\n- bpo-26131(47): The 'loadmodule()' methods found in 'importlib' now\ntrigger a 'DeprecationWarning'.\n\n- bpo-39825(48): Windows: Change\n'sysconfig.getconfigvar('EXTSUFFIX')' to the expected full\n'platformtag.extension' format.  Previously it was hard-coded to\n'.pyd', now it is compatible with 'distutils.sysconfig' and will\nresult in something like '.cp38-winamd64.pyd'.  This brings\nwindows into conformance with the other platforms.\n\n- bpo-26389(49): The *note traceback.formatexception(): 643, *note\ntraceback.formatexceptiononly(): 644, and *note\ntraceback.printexception(): 645. functions can now take an\nexception object as a positional-only argument.\n\n- bpo-41889(50): Enum: fix regression involving inheriting a multiply\ninherited enum\n\n- bpo-41861(51): Convert *note sqlite3: c9. to use heap types (PEP\n384).  Patch by Erlend E. Aasland.\n\n- bpo-40624(52): Added support for the XPath '!=' operator in\nxml.etree\n\n- bpo-28850(53): Fix *note pprint.PrettyPrinter.format(): 1683.\noverrides being ignored for contents of small containers.  The\n'pprint.saferepr()' function was removed.\n\n- bpo-41625(54): Expose the 'splice()' as *note os.splice(): 60d. in\nthe *note os: 9c. module.  Patch by Pablo Galindo\n\n- bpo-34215(55): Clarify the error message for *note\nasyncio.IncompleteReadError: 1684. when 'expected' is 'None'.\n\n- bpo-41543(56): Add async context manager support for\ncontextlib.nullcontext.\n\n- bpo-21041(57): *note pathlib.PurePath.parents: 615. now supports\nnegative indexing.  Patch contributed by Yaroslav Pankovych.\n\n- bpo-41332(58): Added missing connectacceptedsocket() method to\n'asyncio.AbstractEventLoop'.\n\n- bpo-12800(59): Extracting a symlink from a tarball should succeed\nand overwrite the symlink if it already exists.  The fix is to\nremove the existing file or symlink before extraction.  Based on\npatch by Chris AtLee, Jeffrey Kintscher, and Senthil Kumaran.\n\n- bpo-40968(60): *note urllib.request: 106. and *note http.client:\n6a. now send 'http/1.1' ALPN extension during TLS handshake when no\ncustom context is supplied.\n\n- bpo-41001(61): Add *note os.eventfd(): 60c. to provide a low level\ninterface for Linux's event notification file descriptor.\n\n- bpo-40816(62): Add AsyncContextDecorator to contextlib to support\nasync context manager as a decorator.\n\n- bpo-40550(63): Fix time-of-check/time-of-action issue in\nsubprocess.Popen.sendsignal.\n\n- bpo-39411(64): Add an 'isasync' identifier to *note pyclbr: af.'s\n'Function' objects.  Patch by Batuhan Taskaya\n\n- bpo-35498(65): Add slice support to *note pathlib.PurePath.parents:\n615.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=5054\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=42562\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=17735\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=42116\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=42532\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=38200\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=41818\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=42487\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=42482\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=41818\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=42392\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=42392\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=28468\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=42299\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=26131\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=41818\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=42392\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=15450\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=42413\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=42406\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=42403\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=42375\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=41713\n\n(26) https://peps.python.org/pep-0489/\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=37205\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=42328\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=42345\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=37205\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=42318\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=42350\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=42333\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=42014\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=42237\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=42308\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=42131\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=41877\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=42264\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=42251\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=42249\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=42236\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=41754\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=42183\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=42140\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=42133\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=26131\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=39825\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=26389\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=41889\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=41861\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=40624\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=28850\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=41625\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=34215\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=41543\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=21041\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=41332\n\n(59) https://bugs.python.org/issue?@action=redirect&bpo=12800\n\n(60) https://bugs.python.org/issue?@action=redirect&bpo=40968\n\n(61) https://bugs.python.org/issue?@action=redirect&bpo=41001\n\n(62) https://bugs.python.org/issue?@action=redirect&bpo=40816\n\n(63) https://bugs.python.org/issue?@action=redirect&bpo=40550\n\n(64) https://bugs.python.org/issue?@action=redirect&bpo=39411\n\n(65) https://bugs.python.org/issue?@action=redirect&bpo=35498\n\nFile: python3.12.info,  Node: Documentation<32>,  Next: Tests<30>,  Prev: Library<32>,  Up: Python 3 10 0 alpha 3\n\n1.22.32.4 Documentation\n.......................\n\n- bpo-42238(1): Tentative to deprecate 'make suspicious' by first\nremoving it from the CI and documentation builds, but keeping it\naround for manual uses.\n\n- bpo-42153(2): Fix the URL for the IMAP protocol documents.\n\n- bpo-41028(3): Language and version switchers, previously maintained\nin every cpython branches, are now handled by docsbuild-script.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42238\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=42153\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=41028\n\nFile: python3.12.info,  Node: Tests<30>,  Next: Build<30>,  Prev: Documentation<32>,  Up: Python 3 10 0 alpha 3\n\n1.22.32.5 Tests\n...............\n\n- bpo-41473(1): Re-enable testgdb on gdb 9.2 and newer:\n'https://bugzilla.redhat.com/showbug.cgi?id=1866884' bug is fixed\nin gdb 10.1.\n\n- bpo-42553(2): Fix 'testasyncio.testcalllater()' race condition:\ndon't measure asyncio performance in the 'calllater()' unit test.\nThe test failed randomly on the CI.\n\n- bpo-31904(3): Fix testnetrc on VxWorks: create temporary\ndirectories using tempcwd().\n\n- bpo-31904(4): skip testgetaddrinfoipv6scopeidsymbolic and\ntestgetnameinfoipv6scopeidsymbolic on VxWorks\n\n- bpo-31904(5): skip testtest of testmailcap on VxWorks\n\n- bpo-31904(6): add shell requirement for testpipes\n\n- bpo-31904(7): skip some tests related to fifo on VxWorks\n\n- bpo-31904(8): Fix testdoctest.py failures for VxWorks.\n\n- bpo-40754(9): Include 'testinternalcapi' module in Windows\ninstaller for test suite\n\n- bpo-41561(10): testssl: skip testminmaxversionmismatch when\nTLS 1.0 is not available\n\n- bpo-31904(11): Fix os module failures for VxWorks RTOS.\n\n- bpo-31904(12): Fix fifo test cases for VxWorks RTOS.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=41473\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=42553\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=40754\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=41561\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\nFile: python3.12.info,  Node: Build<30>,  Next: Windows<29>,  Prev: Tests<30>,  Up: Python 3 10 0 alpha 3\n\n1.22.32.6 Build\n...............\n\n- bpo-31904(1): remove libnet dependency from detectsocket() for\nVxWorks\n\n- bpo-42398(2): Fix a race condition in \"make regen-all\" when make\n-jN option is used to run jobs in parallel.  The clinic.py script\nnow only use atomic write to write files.  Moveover, generated\nfiles are now left unchanged if the content does not change, to not\nchange the file modification time.\n\n- bpo-41617(3): Fix building 'pycorebitutils.h' internal header on\nold clang version without 'builtinbswap16()' (ex: Xcode 4.6.3 on\nMac OS X 10.7).  Patch by Joshua Root and Victor Stinner.\n\n- bpo-38823(4): It is no longer possible to build the 'ctypes'\nextension module without 'wchart' type: remove 'CTYPESUNICODE'\nmacro.  Anyway, the 'wchart' type is required to build Python.\nPatch by Victor Stinner.\n\n- bpo-42087(5): Support was removed for AIX 5.3 and below.  See\nbpo-40680(6).\n\n- bpo-40998(7): Addressed three compiler warnings found by undefined\nbehavior sanitizer (ubsan).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=42398\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=41617\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=38823\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=42087\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=40680\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=40998\n\nFile: python3.12.info,  Node: Windows<29>,  Next: macOS<24>,  Prev: Build<30>,  Up: Python 3 10 0 alpha 3\n\n1.22.32.7 Windows\n.................\n\n- bpo-42120(1): Remove macro definition of 'copysign' (to\n'copysign') in headers.\n\n- bpo-38506(2): The Windows launcher now properly handles Python 3.10\nwhen listing installed Python versions.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42120\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=38506\n\nFile: python3.12.info,  Node: macOS<24>,  Next: IDLE<17>,  Prev: Windows<29>,  Up: Python 3 10 0 alpha 3\n\n1.22.32.8 macOS\n...............\n\n- bpo-42504(1): Fix build on macOS Big Sur when\nMACOSXDEPLOYMENTTARGET=11\n\n- bpo-41116(2): Ensure distutils.unixxcompiler.findlibraryfile can\nfind system provided libraries on macOS 11.\n\n- bpo-41100(3): Add support for macOS 11 and Apple Silicon systems.\n\nIt is now possible to build \"Universal 2\" binaries using\n\"-enable-universalsdk -with-universal-archs=universal2\".\n\nBinaries build on later macOS versions can be deployed back to\nolder versions (tested up to macOS 10.9), when using the correct\ndeployment target.  This is tested using Xcode 11 and later.\n\n- bpo-42232(4): Added Darwin specific madvise options to mmap module.\n\n- bpo-38443(5): The '--enable-universalsdk' and\n'--with-universal-archs' options for the configure script now check\nthat the specified architectures can be used.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42504\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=41116\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=41100\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=42232\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=38443\n\nFile: python3.12.info,  Node: IDLE<17>,  Next: Tools/Demos<16>,  Prev: macOS<24>,  Up: Python 3 10 0 alpha 3\n\n1.22.32.9 IDLE\n..............\n\n- bpo-42508(1): Keep IDLE running on macOS. Remove obsolete\nworkaround that prevented running files with shortcuts when using\nnew universal2 installers built on macOS 11.\n\n- bpo-42426(2): Fix reporting offset of the RE error in searchengine.\n\n- bpo-42415(3): Get docstrings for IDLE calltips more often by using\ninspect.getdoc.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42508\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=42426\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=42415\n\nFile: python3.12.info,  Node: Tools/Demos<16>,  Next: C API<28>,  Prev: IDLE<17>,  Up: Python 3 10 0 alpha 3\n\n1.22.32.10 Tools/Demos\n......................\n\n- bpo-42212(1): The smelly.py script now also checks the Python\ndynamic library and extension modules, not only the Python static\nlibrary.  Make also the script more verbose: explain what it does.\n\n- bpo-36310(2): Allow 'Tools/i18n/pygettext.py' to detect calls to\n'gettext' in f-strings.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42212\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=36310\n\nFile: python3.12.info,  Node: C API<28>,  Prev: Tools/Demos<16>,  Up: Python 3 10 0 alpha 3\n\n1.22.32.11 C API\n................\n\n- bpo-42423(1): The *note PyTypeFromSpecWithBases(): 2e0. and *note\nPyTypeFromModuleAndSpec(): 2aa. functions now accept a single\nclass as the 'bases' argument.\n\n- bpo-1635741(2): Port *note select: bc. extension module to\nmultiphase initialization ( PEP 489(3)).\n\n- bpo-1635741(4): Port posixsubprocess extension module to\nmultiphase initialization ( PEP 489(5)).\n\n- bpo-1635741(6): Port posixshmem extension module to multiphase\ninitialization ( PEP 489(7))\n\n- bpo-1635741(8): Port struct extension module to multiphase\ninitialization ( PEP 489(9))\n\n- bpo-1635741(10): Port *note spwd: c8. extension module to\nmultiphase initialization ( PEP 489(11))\n\n- bpo-1635741(12): Port *note gc: 5b. extension module to multiphase\ninitialization ( PEP 489(13))\n\n- bpo-1635741(14): Port queue extension module to multiphase\ninitialization ( PEP 489(15))\n\n- bpo-39573(16): Convert *note PyTYPE(): 56b. and *note PySIZE():\n56d. back to macros to allow using them as an l-value.  Many third\nparty C extension modules rely on the ability of using PyTYPE()\nand PySIZE() to set an object type and size: 'PyTYPE(obj) =\ntype;' and 'PySIZE(obj) = size;'.\n\n- bpo-1635741(17): Port *note symtable: d2. extension module to\nmultiphase initialization ( PEP 489(18))\n\n- bpo-1635741(19): Port *note grp: 61. and *note pwd: ad. extension\nmodules to multiphase initialization ( PEP 489(20))\n\n- bpo-1635741(21): Port random extension module to multiphase\ninitialization ( PEP 489(22))\n\n- bpo-1635741(23): Port hashlib extension module to multiphase\ninitialization ( PEP 489(24))\n\n- bpo-41713(25): Removed the undocumented 'PyOSInitInterrupts()'\nfunction.  Initializing Python already implicitly installs signal\nhandlers: see *note PyConfig.installsignalhandlers: 6d6.  Patch\nby Victor Stinner.\n\n- bpo-40170(26): The 'PyTRASHCANBEGIN' macro no longer accesses\nPyTypeObject attributes, but now can get the condition by calling\nthe new private 'PyTrashcond()' function which hides\nimplementation details.\n\n- bpo-42260(27): *note PyGetPath(): 32b, *note PyGetPrefix(): 32d,\n*note PyGetExecPrefix(): 329, *note PyGetProgramFullPath(): 32f,\n*note PyGetPythonHome(): 332. and *note PyGetProgramName(): 331.\nfunctions now return 'NULL' if called before *note PyInitialize():\n6c2. (before Python is initialized).  Use the new *note Python\nInitialization Configuration API: 581. to get the *note Python Path\nConfiguration.: 6c3.  Patch by Victor Stinner.\n\n- bpo-42260(28): The *note PyConfigRead(): 57e. function now only\nparses *note PyConfig.argv: 168d. arguments once: *note\nPyConfig.parseargv: 168e. is set to '2' after arguments are\nparsed.  Since Python arguments are strippped from *note\nPyConfig.argv: 168d, parsing arguments twice would parse the\napplication options as Python options.\n\n- bpo-42262(29): Added *note PyNewRef(): 6ab. and *note\nPyXNewRef(): 6ac. functions to increment the reference count of an\nobject and return the object.  Patch by Victor Stinner.\n\n- bpo-42260(30): When *note PyInitialize(): 6c2. is called twice,\nthe second call now updates more *note sys: d3. attributes for the\nconfiguration, rather than only *note sys.argv: 10dd.  Patch by\nVictor Stinner.\n\n- bpo-41832(31): The *note PyTypeFromModuleAndSpec(): 2aa. function\nnow accepts NULL 'tpdoc' slot.\n\n- bpo-1635741(32): Added *note PyModuleAddObjectRef(): 6a9.\nfunction: similar to *note PyModuleAddObject(): 6aa. but don't\nsteal a reference to the value on success.  Patch by Victor\nStinner.\n\n- bpo-42171(33): The *note METHFASTCALL: 157b. calling convention is\nadded to the limited API. The functions *note PyModuleAddType():\n799, *note PyTypeFromModuleAndSpec(): 2aa, *note\nPyTypeGetModule(): 790. and *note PyTypeGetModuleState(): 791.\nare added to the limited API on Windows.\n\n- bpo-42085(34): Add dedicated entry to PyAsyncMethods for sending\nvalues\n\n- bpo-41073(35): *note PyTypeGetSlot(): 6ad. can now accept static\ntypes.\n\n- bpo-30459(36): *note PyListSETITEM(): 6c4, *note\nPyTupleSETITEM(): 6c5. and *note PyCellSET(): 6c6. macros can no\nlonger be used as l-value or r-value.  For example, 'x =\nPyListSETITEM(a, b, c)' and 'PyListSETITEM(a, b, c) = x' now\nfail with a compiler error.  It prevents bugs like 'if\n(PyListSETITEM (a, b, c) < 0) ...' test.  Patch by Zackery Spytz\nand Victor Stinner.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42423\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(3) https://peps.python.org/pep-0489/\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(5) https://peps.python.org/pep-0489/\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(7) https://peps.python.org/pep-0489/\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(9) https://peps.python.org/pep-0489/\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(11) https://peps.python.org/pep-0489/\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(13) https://peps.python.org/pep-0489/\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(15) https://peps.python.org/pep-0489/\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=39573\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(18) https://peps.python.org/pep-0489/\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(20) https://peps.python.org/pep-0489/\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(22) https://peps.python.org/pep-0489/\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(24) https://peps.python.org/pep-0489/\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=41713\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=40170\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=42260\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=42260\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=42262\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=42260\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=41832\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=42171\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=42085\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=41073\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=30459\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 10 0 alpha 2,  Next: Python 3 10 0 alpha 1,  Prev: Python 3 10 0 alpha 3,  Up: Changelog": {
            "content": "'Release date: 2020-11-03'\n\n* Menu:\n\n* Security: Security<20>.\n* Core and Builtins: Core and Builtins<33>.\n* Library: Library<33>.\n* Documentation: Documentation<33>.\n* Tests: Tests<31>.\n* Build: Build<31>.\n* Windows: Windows<30>.\n* macOS: macOS<25>.\n* IDLE: IDLE<18>.\n* C API: C API<29>.\n\nFile: python3.12.info,  Node: Security<20>,  Next: Core and Builtins<33>,  Up: Python 3 10 0 alpha 2\n\n1.22.33.1 Security\n..................\n\n- bpo-42103(1): Prevented potential DoS attack via CPU and RAM\nexhaustion when processing malformed Apple Property List files in\nbinary format.\n\n- bpo-42051(2): The *note plistlib: a6. module no longer accepts\nentity declarations in XML plist files to avoid XML\nvulnerabilities.  This should not affect users as entity\ndeclarations are not used in regular plist files.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42103\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=42051\n\nFile: python3.12.info,  Node: Core and Builtins<33>,  Next: Library<33>,  Prev: Security<20>,  Up: Python 3 10 0 alpha 2\n\n1.22.33.2 Core and Builtins\n...........................\n\n- bpo-42236(1): If the 'nllanginfo(CODESET)' function returns an\nempty string, Python now uses UTF-8 as the filesystem encoding.\nPatch by Victor Stinner.\n\n- bpo-42218(2): Fixed a bug in the PEG parser that was causing\ncrashes in debug mode.  Now errors are checked in left-recursive\nrules to avoid cases where such errors do not get handled in time\nand appear as long-distance crashes in other places.\n\n- bpo-42214(3): Fixed a possible crash in the PEG parser when\nchecking for the '!=' token in the 'barryasflufl' rule.  Patch by\nPablo Galindo.\n\n- bpo-42206(4): Propagate and raise the errors caused by\n'PyASTValidate()' in the parser.\n\n- bpo-41796(5): The *note ast: 8. module internal state is now per\ninterpreter.  Patch by Victor Stinner.\n\n- bpo-42143(6): Fix handling of errors during creation of\n'PyFunctionObject', which resulted in operations on uninitialized\nmemory.  Patch by Yonatan Goldschmidt.\n\n- bpo-41659(7): Fix a bug in the parser, where a curly brace\nfollowing a 'primary' didn't fail immediately.  This led to invalid\nexpressions like 'a {b}' to throw a *note SyntaxError: 146. with a\nwrong offset, or invalid expressions ending with a curly brace like\n'a {' to not fail immediately in the REPL.\n\n- bpo-42150(8): Fix possible buffer overflow in the new parser when\nchecking for continuation lines.  Patch by Pablo Galindo.\n\n- bpo-42123(9): Run the parser two times.  On the first run, disable\nall the rules that only generate better error messages to gain\nperformance.  If there's a parse failure, run the parser a second\ntime with those enabled.\n\n- bpo-42093(10): The 'LOADATTR' instruction now uses new \"per opcode\ncache\" mechanism and it is about 36% faster now.  Patch by Pablo\nGalindo and Yury Selivanov.\n\n- bpo-42030(11): Support for the legacy AIX-specific shared library\nloading support has been removed.  All versions of AIX since 4.3\nhave supported and defaulted to using the common Unix mechanism\ninstead.\n\n- bpo-41984(12): The garbage collector now tracks all user-defined\nclasses.  Patch by Brandt Bucher.\n\n- bpo-41993(13): Fixed potential issues with removing not completely\ninitialized module from 'sys.modules' when import fails.\n\n- bpo-41979(14): Star-unpacking is now allowed for with item's\ntargets in the PEG parser.\n\n- bpo-41974(15): Removed special methods 'int', 'float',\n'floordiv', 'mod', 'divmod', 'rfloordiv',\n'rmod' and 'rdivmod' of the *note complex: 3ad. class.\nThey always raised a *note TypeError: 28e.\n\n- bpo-41902(16): Micro optimization when compute *note sqitem: 1692.\nand *note mpsubscript: 1693. of *note range: 761.  Patch by\nDonghee Na.\n\n- bpo-41894(17): When loading a native module and a load failure\noccurs, prevent a possible UnicodeDecodeError when not running in a\nUTF-8 locale by decoding the load error message using the current\nlocale's encoding.\n\n- bpo-41902(18): Micro optimization for range.index if step is 1.\nPatch by Donghee Na.\n\n- bpo-41435(19): Add 'sys.currentexceptions()' function to retrieve\na dictionary mapping each thread's identifier to the topmost\nexception currently active in that thread at the time the function\nis called.\n\n- bpo-38605(20): Enable 'from future import annotations' ( PEP\n563(21)) by default.  The values found in 'annotations' dicts\nare now strings, e.g.  '{\"x\": \"int\"}' instead of '{\"x\": int}'.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42236\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=42218\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=42214\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=42206\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=41796\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=42143\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=41659\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=42150\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=42123\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=42093\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=42030\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=41984\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=41993\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=41979\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=41974\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=41902\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=41894\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=41902\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=41435\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=38605\n\n(21) https://peps.python.org/pep-0563/\n\nFile: python3.12.info,  Node: Library<33>,  Next: Documentation<33>,  Prev: Core and Builtins<33>,  Up: Python 3 10 0 alpha 2\n\n1.22.33.3 Library\n.................\n\n- bpo-35455(1): On Solaris, *note threadtime(): 754. is now\nimplemented with 'gethrvtime()' because\n'clockgettime(CLOCKTHREADCPUTIMEID)' is not always available.\nPatch by Jakub Kulik.\n\n- bpo-42233(2): The *note repr(): 5f0. of *note typing: ff. types\ncontaining *note Generic Alias Types: 480. previously did not show\nthe parameterized types in the 'GenericAlias'.  They have now been\nchanged to do so.\n\n- bpo-29566(3): 'binhex.binhex()' consistently writes macOS 9 line\nendings.\n\n- bpo-26789(4): The *note logging.FileHandler: 1600. class now keeps\na reference to the builtin *note open(): 26e. function to be able\nto open or reopen the file during Python finalization.  Fix errors\nlike: 'NameError: name 'open' is not defined'.  Patch by Victor\nStinner.\n\n- bpo-42157(5): Removed the 'unicodedata.ucnhashCAPI' attribute\nwhich was an internal PyCapsule object.  The related private\n'PyUnicodeNameCAPI' structure was moved to the internal C API.\nPatch by Victor Stinner.\n\n- bpo-42157(6): Convert the *note unicodedata: 100. extension module\nto the multiphase initialization API ( PEP 489(7)) and convert the\n'unicodedata.UCD' static type to a heap type.  Patch by Mohamed\nKoubaa and Victor Stinner.\n\n- bpo-42146(8): Fix memory leak in *note subprocess.Popen(): 8c3. in\ncase an uid (gid) specified in 'user' ('group', 'extragroups')\noverflows 'uidt' ('gidt').\n\n- bpo-42103(9): 'InvalidFileException' and *note RecursionError: bc6.\nare now the only errors caused by loading malformed binary Plist\nfile (previously ValueError and TypeError could be raised in some\nspecific cases).\n\n- bpo-41490(10): In 'importlib.resources', '.path' method is more\naggressive about releasing handles to zipfile objects early,\nenabling use-cases like certifi to leave the context open but\ndelete the underlying zip file.\n\n- bpo-41052(11): Pickling heap types implemented in C with protocols\n0 and 1 raises now an error instead of producing incorrect data.\n\n- bpo-42089(12): In 'importlib.metadata.PackageNotFoundError', make\nreference to the package metadata being missing to improve the user\nexperience.\n\n- bpo-41491(13): plistlib: fix parsing XML plists with hexadecimal\ninteger values\n\n- bpo-42065(14): Fix an incorrectly formatted error from\n'codecs.charmapdecode()' when called with a mapped value outside\nthe range of valid Unicode code points.  PR by Max Bernstein.\n\n- bpo-41966(15): Fix pickling pure Python *note datetime.time: 6a5.\nsubclasses.  Patch by Dean Inwood.\n\n- bpo-19270(16): *note sched.scheduler.cancel(): 1695. will now\ncancel the correct event, if two events with same priority are\nscheduled for the same time.  Patch by Bar Harel.\n\n- bpo-28660(17): *note textwrap.wrap(): 131e. now attempts to break\nlong words after hyphens when 'breaklongwords=True' and\n'breakonhyphens=True'.\n\n- bpo-35823(18): Use 'vfork()' instead of 'fork()' for *note\nsubprocess.Popen(): 8c3. on Linux to improve performance in cases\nwhere it is deemed safe.\n\n- bpo-42043(19): Add support for 'zipfile.Path' inheritance.\n'zipfile.Path.isfile()' now returns False for non-existent names.\n'zipfile.Path' objects now expose a '.filename' attribute and rely\non that to resolve '.name' and '.parent' when the 'Path' object is\nat the root of the zipfile.\n\n- bpo-42021(20): Fix possible ref leaks in *note sqlite3: c9. module\ninit.\n\n- bpo-39101(21): Fixed tests using IsolatedAsyncioTestCase from\nhanging on BaseExceptions.\n\n- bpo-41976(22): Fixed a bug that was causing *note\nctypes.util.findlibrary(): ba2. to return 'None' when triying to\nlocate a library in an environment when gcc>=9 is available and\n'ldconfig' is not.  Patch by Pablo Galindo\n\n- bpo-41943(23): Fix bug where TestCase.assertLogs doesn't correctly\nfilter messages by level.\n\n- bpo-41923(24): Implement PEP 613(25), introducing *note\ntyping.TypeAlias: 1696. annotation.\n\n- bpo-41905(26): A new function in abc: 'updateabstractmethods' to\nre-calculate an abstract class's abstract status.  In addition,\n'dataclass' has been changed to call this function.\n\n- bpo-23706(27): Added 'newline' parameter to\n'pathlib.Path.writetext()'.\n\n- bpo-41876(28): Tkinter font class repr uses font name\n\n- bpo-41831(29): 'str()' for the 'type' attribute of the\n'tkinter.Event' object always returns now the numeric code returned\nby Tk instead of the name of the event type.\n\n- bpo-39337(30): 'encodings.normalizeencoding()' now ignores\nnon-ASCII characters.\n\n- bpo-41747(31): Ensure all methods that generated from *note\ndataclasses.dataclass(): 38d. objects now have the proper\n'qualname' attribute referring to the class they belong to.\nPatch by Batuhan Taskaya.\n\n- bpo-30681(32): Handle exceptions caused by unparsable date headers\nwhen using email \"default\" policy.  Patch by Tim Bell, Georges Toth\n\n- bpo-41586(33): Add FSETPIPESZ and FGETPIPESZ to fcntl module.\nAllow setting pipesize on subprocess.Popen.\n\n- bpo-41229(34): Add 'contextlib.aclosing' for deterministic cleanup\nof async generators which is analogous to 'contextlib.closing' for\nnon-async generators.  Patch by Joongi Kim and John Belmonte.\n\n- bpo-16396(35): Allow 'ctypes.wintypes' to be imported on\nnon-Windows systems.\n\n- bpo-4356(36): Add a key function to the bisect module.\n\n- bpo-40592(37): *note shutil.which(): 1d6. now ignores empty entries\nin 'PATHEXT' instead of treating them as a match.\n\n- bpo-40492(38): Fix '--outfile' for *note cProfile: 25. / *note\nprofile: aa. not writing the output file in the original directory\nwhen the program being profiled changes the working directory.  PR\nby Anthony Sottile.\n\n- bpo-34204(39): The *note shelve: be. module now uses *note\npickle.DEFAULTPROTOCOL: 623. by default instead of *note pickle:\na1. protocol '3'.\n\n- bpo-27321(40): Fixed KeyError exception when flattening an email to\na string attempts to replace a non-existent\nContent-Transfer-Encoding header.\n\n- bpo-38976(41): The *note http.cookiejar: 6b. module now supports\nthe parsing of cookies in CURL-style cookiejar files through\nMozillaCookieJar on all platforms.  Previously, such cookie entries\nwould be silently ignored when loading a cookiejar with such\nentries.\n\nAdditionally, the HTTP Only attribute is persisted in the object,\nand will be correctly written to file if the MozillaCookieJar\nobject is subsequently dumped.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=35455\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=42233\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=29566\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=26789\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=42157\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=42157\n\n(7) https://peps.python.org/pep-0489/\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=42146\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=42103\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=41490\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=41052\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=42089\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=41491\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=42065\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=41966\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=19270\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=28660\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=35823\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=42043\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=42021\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=39101\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=41976\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=41943\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=41923\n\n(25) https://peps.python.org/pep-0613/\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=41905\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=23706\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=41876\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=41831\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=39337\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=41747\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=30681\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=41586\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=41229\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=16396\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=4356\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=40592\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=40492\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=34204\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=27321\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=38976\n\nFile: python3.12.info,  Node: Documentation<33>,  Next: Tests<31>,  Prev: Library<33>,  Up: Python 3 10 0 alpha 2\n\n1.22.33.4 Documentation\n.......................\n\n- bpo-42061(1): Document format functionality for IP addresses.\n\n- bpo-41910(2): Document the default implementation of\n'object.eq'.\n\n- bpo-42010(3): Clarify that subscription expressions are also valid\nfor certain *note classes: 1698. and *note types: 1699. in the\nstandard library, and for user-defined classes and types if the\nclassmethod 'classgetitem()' is provided.\n\n- bpo-41805(4): Documented *note generic alias type: 480. and *note\ntypes.GenericAlias: 5df.  Also added an entry in glossary for *note\ngeneric types: 13b.\n\n- bpo-39693(5): Fix tarfile's extractfile documentation\n\n- bpo-39416(6): Document some restrictions on the default string\nrepresentations of numeric classes.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42061\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=41910\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=42010\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=41805\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=39693\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=39416\n\nFile: python3.12.info,  Node: Tests<31>,  Next: Build<31>,  Prev: Documentation<33>,  Up: Python 3 10 0 alpha 2\n\n1.22.33.5 Tests\n...............\n\n- bpo-41739(1): Fix\ntestlogging.testracebetweensettargetandflush(): the test now\nwaits until all threads complete to avoid leaking running threads.\n\n- bpo-41970(2): Avoid a test failure in 'testlib2to3' if the module\nhas already imported at the time the test executes.  Patch by Pablo\nGalindo.\n\n- bpo-41944(3): Tests for CJK codecs no longer call 'eval()' on\ncontent received via HTTP.\n\n- bpo-41306(4): Fixed a failure in 'testtk.testwidgets.ScaleTest'\nhappening when executing the test with Tk 8.6.10.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=41739\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=41970\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=41944\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=41306\n\nFile: python3.12.info,  Node: Build<31>,  Next: Windows<30>,  Prev: Tests<31>,  Up: Python 3 10 0 alpha 2\n\n1.22.33.6 Build\n...............\n\n- bpo-38980(1): Add '-fno-semantic-interposition' to both the compile\nand link line when building with '--enable-optimizations'.  Patch\nby Victor Stinner and Pablo Galindo.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38980\n\nFile: python3.12.info,  Node: Windows<30>,  Next: macOS<25>,  Prev: Build<31>,  Up: Python 3 10 0 alpha 2\n\n1.22.33.7 Windows\n.................\n\n- bpo-38439(1): Updates the icons for IDLE in the Windows Store\npackage.\n\n- bpo-38252(2): Use 8-byte step to detect ASCII sequence in 64-bit\nWindows build.\n\n- bpo-39107(3): Update Tcl and Tk to 8.6.10 in Windows installer.\n\n- bpo-41557(4): Update Windows installer to use SQLite 3.33.0.\n\n- bpo-38324(5): Avoid Unicode errors when accessing certain locale\ndata on Windows.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38439\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=38252\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=39107\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=41557\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=38324\n\nFile: python3.12.info,  Node: macOS<25>,  Next: IDLE<18>,  Prev: Windows<30>,  Up: Python 3 10 0 alpha 2\n\n1.22.33.8 macOS\n...............\n\n- bpo-41471(1): Ignore invalid prefix lengths in system proxy\nexcludes.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=41471\n\nFile: python3.12.info,  Node: IDLE<18>,  Next: C API<29>,  Prev: macOS<25>,  Up: Python 3 10 0 alpha 2\n\n1.22.33.9 IDLE\n..............\n\n- bpo-33987(1): Mostly finish using ttk widgets, mainly for editor,\nsettings, and searches.  Some patches by Mark Roseman.\n\n- bpo-40511(2): Typing opening and closing parentheses inside the\nparentheses of a function call will no longer cause unnecessary\n\"flashing\" off and on of an existing open call-tip, e.g.  when\ntyped in a string literal.\n\n- bpo-38439(3): Add a 256??256 pixel IDLE icon to the Windows .ico\nfile.  Created by Andrew Clover.  Remove the low-color gif\nvariations from the .ico file.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33987\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=40511\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=38439\n\nFile: python3.12.info,  Node: C API<29>,  Prev: IDLE<18>,  Up: Python 3 10 0 alpha 2\n\n1.22.33.10 C API\n................\n\n- bpo-42157(1): The private 'PyUnicodeNameCAPI' structure of the\nPyCapsule API 'unicodedata.ucnhashCAPI' has been moved to the\ninternal C API. Patch by Victor Stinner.\n\n- bpo-42015(2): Fix potential crash in deallocating method objects\nwhen dynamically allocated *note PyMethodDef: 1332.'s lifetime is\nmanaged through the 'self' argument of a *note PyCFunction: 12cd.\n\n- bpo-40423(3): The *note subprocess: d0. module and 'os.closerange'\nwill now use the 'closerange(low, high, flags)' syscall when it is\navailable for more efficient closing of ranges of descriptors.\n\n- bpo-41845(4): *note PyObjectGenericGetDict(): 16a0. is available\nagain in the limited API when targeting 3.10 or later.\n\n- bpo-40422(5): Add 'Pycloserange' function to provide performant\nclosing of a range of file descriptors.\n\n- bpo-41986(6): 'PyFileSystemDefaultEncodeErrors' and 'PyUTF8Mode'\nare available again in limited API.\n\n- bpo-41756(7): Add 'PyIterSend' function to allow sending value\ninto generator/coroutine/iterator without raising StopIteration\nexception to signal return.\n\n- bpo-41784(8): Added 'PyUnicodeAsUTF8AndSize' to the limited C API.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42157\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=42015\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=40423\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=41845\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=40422\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=41986\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=41756\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=41784\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 10 0 alpha 1,  Next: Python 3 9 0 beta 1,  Prev: Python 3 10 0 alpha 2,  Up: Changelog": {
            "content": "'Release date: 2020-10-05'\n\n* Menu:\n\n* Security: Security<21>.\n* Core and Builtins: Core and Builtins<34>.\n* Library: Library<34>.\n* Documentation: Documentation<34>.\n* Tests: Tests<32>.\n* Build: Build<32>.\n* Windows: Windows<31>.\n* macOS: macOS<26>.\n* IDLE: IDLE<19>.\n* C API: C API<30>.\n\nFile: python3.12.info,  Node: Security<21>,  Next: Core and Builtins<34>,  Up: Python 3 10 0 alpha 1\n\n1.22.34.1 Security\n..................\n\n- bpo-41304(1): Fixes 'python3x.pth' being ignored on Windows,\ncaused by the fix for bpo-29778(2) (CVE-2020-15801).\n\n- bpo-41162(3): Audit hooks are now cleared later during finalization\nto avoid missing events.\n\n- bpo-29778(4): Ensure 'python3.dll' is loaded from correct locations\nwhen Python is embedded (CVE-2020-15523).\n\n- bpo-41004(5): The hash() methods of ipaddress.IPv4Interface and\nipaddress.IPv6Interface incorrectly generated constant hash values\nof 32 and 128 respectively.  This resulted in always causing hash\ncollisions.  The fix uses hash() to generate hash values for the\ntuple of (address, mask length, network address).\n\n- bpo-39603(6): Prevent http header injection by rejecting control\ncharacters in http.client.putrequest(...).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=41304\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=29778\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=41162\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=29778\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=41004\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=39603\n\nFile: python3.12.info,  Node: Core and Builtins<34>,  Next: Library<34>,  Prev: Security<21>,  Up: Python 3 10 0 alpha 1\n\n1.22.34.2 Core and Builtins\n...........................\n\n- bpo-41909(1): Fixed stack overflow in *note issubclass(): 5b4. and\n*note isinstance(): 14b. when getting the 'bases' attribute\nleads to infinite recursion.\n\n- bpo-41922(2): Speed up calls to 'reversed()' by using the PEP\n590(3) 'vectorcall' calling convention.  Patch by Donghee Na.\n\n- bpo-41873(4): Calls to 'float()' are now faster due to the\n'vectorcall' calling convention.  Patch by Dennis Sweeney.\n\n- bpo-41870(5): Speed up calls to 'bool()' by using the PEP 590(6)\n'vectorcall' calling convention.  Patch by Donghee Na.\n\n- bpo-1635741(7): Port the 'bisect' module to the multi-phase\ninitialization API ( PEP 489(8)).\n\n- bpo-39934(9): Correctly count control blocks in 'except' in\ncompiler.  Ensures that a syntax error, rather a fatal error,\noccurs for deeply nested, named exception handlers.\n\n- bpo-41780(10): Fix 'dir()' of *note types.GenericAlias: 5df.\nPatch by Batuhan Taskaya.\n\n- bpo-1635741(11): Port the 'lsprof' extension module to multi-phase\ninitialization ( PEP 489(12)).\n\n- bpo-1635741(13): Port the *note cmath: 16. extension module to\nmulti-phase initialization ( PEP 489(14)).\n\n- bpo-1635741(15): Port the 'scproxy' extension module to\nmulti-phase initialization ( PEP 489(16)).\n\n- bpo-1635741(17): Port the *note termios: db. extension module to\nmulti-phase initialization ( PEP 489(18)).\n\n- bpo-1635741(19): Convert the 'sha256' extension module types to\nheap types.\n\n- bpo-41690(20): Fix a possible stack overflow in the parser when\nparsing functions and classes with a huge amount of arguments.\nPatch by Pablo Galindo.\n\n- bpo-1635741(21): Port the 'overlapped' extension module to\nmulti-phase initialization ( PEP 489(22)).\n\n- bpo-1635741(23): Port the 'cursespanel' extension module to\nmulti-phase initialization ( PEP 489(24)).\n\n- bpo-1635741(25): Port the 'opcode' extension module to multi-phase\ninitialization ( PEP 489(26)).\n\n- bpo-41681(27): Fixes the wrong error description in the error\nraised by using 2 ',' in format string in f-string and *note\nstr.format(): 3ed.\n\n- bpo-41675(28): The implementation of *note signal.siginterrupt():\nfa7. now uses 'sigaction()' (if it is available in the system)\ninstead of the deprecated 'siginterrupt()'.  Patch by Pablo\nGalindo.\n\n- bpo-41670(29): Prevent line trace being skipped on platforms not\ncompiled with 'USECOMPUTEDGOTOS'.  Fixes issue where some lines\nnested within a try-except block were not being traced on Windows.\n\n- bpo-41654(30): Fix a crash that occurred when destroying subclasses\nof *note MemoryError: 13e3.  Patch by Pablo Galindo.\n\n- bpo-1635741(31): Port the *note zlib: 12d. extension module to\nmulti-phase initialization ( PEP 489(32)).\n\n- bpo-41631(33): The 'ast' module uses again a global state.  Using\na module state per module instance is causing subtle practical\nproblems.  For example, the Mercurial project replaces the\n'import()' function to implement lazy import, whereas Python\nexpected that 'import ast' always return a fully initialized\n'ast' module.\n\n- bpo-40077(34): Convert 'operator' to use *note PyTypeFromSpec():\n2df.\n\n- bpo-1653741(35): Port 'sha3' to multi-phase init.  Convert static\ntypes to heap types.\n\n- bpo-1635741(36): Port the 'blake2' extension module to the\nmulti-phase initialization API ( PEP 489(37)).\n\n- bpo-41533(38): Free the stack allocated in 'vabuildstack' if\n'domkstack' fails and the stack is not a 'smallstack'.\n\n- bpo-41531(39): Fix a bug that was dropping keys when compiling dict\nliterals with more than 0xFFFF elements.  Patch by Pablo Galindo.\n\n- bpo-41525(40): The output of 'python --help' contains now only\nASCII characters.\n\n- bpo-1635741(41): Port the 'sha1', 'sha512', and 'md5' extension\nmodules to multi-phase initialization API ( PEP 489(42)).\n\n- bpo-41431(43): Optimize 'dictmerge()' for copying dict (e.g.\n'dict(d)' and '{}.update(d)').\n\n- bpo-41428(44): Implement PEP 604.  This supports (int | str) etc.\nin place of Union[str, int].\n\n- bpo-41340(45): Removed fallback implementation for 'strdup'.\n\n- bpo-38156(46): Handle interrupts that come after EOF correctly in\n'PyOSStdioReadline'.\n\n- bpo-41342(47): *note round(): 114f. with integer argument is now\nfaster (9-60%).\n\n- bpo-41334(48): Constructors *note str(): 157, *note bytes(): 295.\nand *note bytearray(): 294. are now faster (around 30-40% for small\nobjects).\n\n- bpo-41295(49): Resolve a regression in CPython 3.8.4 where defining\n\"setattr\" in a multi-inheritance setup and calling up the\nhierarchy chain could fail if builtins/extension types were\ninvolved in the base types.\n\n- bpo-41323(50): Bytecode optimizations are performed directly on the\ncontrol flow graph.  This will result in slightly more compact code\nobjects in some circumstances.\n\n- bpo-41247(51): Always cache the running loop holder when running\n'asyncio.setrunningloop'.\n\n- bpo-41252(52): Fix incorrect refcounting in ssl.c's\n'servernamecallback()'.\n\n- bpo-1635741(53): Port *note multiprocessing: 8f. to multi-phase\ninitialization\n\n- bpo-1635741(54): Port 'winapi' to multiphase initialization\n\n- bpo-41215(55): Use non-NULL default values in the PEG parser\nkeyword list to overcome a bug that was preventing Python from\nbeing properly compiled when using the XLC compiler.  Patch by\nPablo Galindo.\n\n- bpo-41218(56): Python 3.8.3 had a regression where compiling with\nast.PyCFALLOWTOPLEVELAWAIT would aggressively mark list\ncomprehension with COCOROUTINE. Now only list comprehension making\nuse of async/await will tagged as so.\n\n- bpo-1635741(57): Port *note faulthandler: 53. to multiphase\ninitialization.\n\n- bpo-1635741(58): Port 'sha256' to multiphase initialization\n\n- bpo-41175(59): Guard against a NULL pointer dereference within\nbytearrayobject triggered by the 'bytearray() + bytearray()'\noperation.\n\n- bpo-41100(60): add arm64 to the allowable Mac OS arches in\nmpdecimal.h\n\n- bpo-41094(61): Fix decoding errors with audit when open files with\nnon-ASCII names on non-UTF-8 locale.\n\n- bpo-39960(62): The \"hackcheck\" that prevents sneaking around a\ntype's setattr() by calling the superclass method was rewritten\nto allow C implemented heap types.\n\n- bpo-41084(63): Prefix the error message with 'f-string: ', when\nparsing an f-string expression which throws a *note SyntaxError:\n146.\n\n- bpo-40521(64): Empty frozensets are no longer singletons.\n\n- bpo-41076(65): Pre-feed the parser with the location of the\nf-string expression, not the f-string itself, which allows us to\nskip the shifting of the AST node locations after the parsing is\ncompleted.\n\n- bpo-41056(66): Fixes a reference to deallocated stack space during\nstartup when constructing sys.path involving a relative symlink\nwhen code was supplied via -c.  (discovered via Coverity)\n\n- bpo-41061(67): Fix incorrect expressions and asserts in hashtable\ncode and tests.\n\n- bpo-41052(68): Opt out serialization/deserialization for\nrandom.Random\n\n- bpo-40939(69): Rename 'PyPegen*' functions to 'PyParser*', so that\nwe can remove the old set of 'PyParser*' functions that were using\nthe old parser, but keep everything backwards-compatible.\n\n- bpo-35975(70): Stefan Behnel reported that cffeatureversion is\nused even when PyCFONLYAST is not set.  This is against the\nintention and against the documented behavior, so it's been fixed.\n\n- bpo-40939(71): Remove the remaining files from the old parser and\nthe 'symbol' module.\n\n- bpo-40077(72): Convert 'bz2' to use *note PyTypeFromSpec(): 2df.\n\n- bpo-41006(73): The 'encodings.latin1' module is no longer imported\nat startup.  Now it is only imported when it is the filesystem\nencoding or the stdio encoding.\n\n- bpo-40636(74): *note zip(): 5c2. now supports PEP 618(75)'s\n'strict' parameter, which raises a *note ValueError: 183. if the\narguments are exhausted at different lengths.  Patch by Brandt\nBucher.\n\n- bpo-1635741(76): Port 'gdbm' to multiphase initialization.\n\n- bpo-40985(77): Fix a bug that caused the *note SyntaxError: 146.\ntext to be empty when a file ends with a line ending in a line\ncontinuation character (i.e.  backslash).  The error text should\ncontain the text of the last line.\n\n- bpo-40958(78): Fix a possible buffer overflow in the PEG parser\nwhen gathering information for emitting syntax errors.  Patch by\nPablo Galindo.\n\n- bpo-1635741(79): Port 'dbm' to multiphase initialization.\n\n- bpo-40957(80): Fix refleak in Pyfopenobj() when PySysAudit()\nfails\n\n- bpo-40950(81): Add a state to the *note nis: 97. module ( PEP\n3121(82)) and apply the multiphase initialization.  Patch by\nDonghee Na.\n\n- bpo-40947(83): The Python *note Path Configuration: 6c3. now takes\n*note PyConfig.platlibdir: 16a4. in account.\n\n- bpo-40939(84): Remove the old parser, the 'parser' module and all\nassociated support code, command-line options and environment\nvariables.  Patch by Pablo Galindo.\n\n- bpo-40847(85): Fix a bug where a line with only a line continuation\ncharacter is not considered a blank line at tokenizer level.  In\nsuch cases, more than a single 'NEWLINE' token was emitted.  The\nold parser was working around the issue, but the new parser threw a\n*note SyntaxError: 146. for valid input due to this.  For example,\nan empty line following a line continuation character was\ninterpreted as a *note SyntaxError: 146.\n\n- bpo-40890(86): Each dictionary view now has a 'mapping' attribute\nthat provides a *note types.MappingProxyType: 186. wrapping the\noriginal dictionary.  Patch contributed by Dennis Sweeney.\n\n- bpo-40889(87): Improved the performance of symmetric difference\noperations on dictionary item views.  Patch by Dennis Sweeney.\n\n- bpo-40904(88): Fix possible segfault in the new PEG parser when\nparsing f-string containing yield statements with no value\n('f\"{yield}\"').  Patch by Pablo Galindo\n\n- bpo-40903(89): Fixed a possible segfault in the new PEG parser when\nproducing error messages for invalid assignments of the form\n'p=p='.  Patch by Pablo Galindo\n\n- bpo-40880(90): Fix invalid memory read in the new parser when\nchecking newlines in string literals.  Patch by Pablo Galindo.\n\n- bpo-40883(91): Fix memory leak in when parsing f-strings in the new\nparser.  Patch by Pablo Galindo\n\n- bpo-40870(92): Raise *note ValueError: 183. when validating custom\nAST's where the constants 'True', 'False' and 'None' are used\nwithin a *note ast.Name: 16a5. node.\n\n- bpo-40854(93): Allow overriding *note sys.platlibdir: 756. via a\nnew *note PYTHONPLATLIBDIR: 16a6. environment variable.\n\n- bpo-40826(94): Fix GIL usage in 'PyOSReadline()': lock the GIL to\nset an exception and pass the Python thread state when checking if\nthere is a pending signal.\n\n- bpo-1635741(95): Port *note fcntl: 54. to multiphase\ninitialization.\n\n- bpo-19468(96): Delete unnecessary instance check in\nimportlib.reload().  Patch by Furkan O\"nder.\n\n- bpo-40824(97): Unexpected errors in calling the 'iter' method\nare no longer masked by 'TypeError' in the *note in: 250. operator\nand functions *note contains(): 6f3, *note indexOf(): 6f4. and\n*note countOf(): 6f5. of the *note operator: 9a. module.\n\n- bpo-40792(98): Attributes 'start', 'stop' and 'step' of the *note\nrange: 761. object now always has exact type *note int: 17e.\nPreviously, they could have been an instance of a subclass of\n'int'.\n\n- bpo-40780(99): Fix a corner case where g-style string formatting of\na float failed to remove trailing zeros.\n\n- bpo-38964(100): When there's a *note SyntaxError: 146. in the\nexpression part of an fstring, the filename attribute of the *note\nSyntaxError: 146. gets correctly set to the name of the file the\nfstring resides in.\n\n- bpo-40750(101): Support the \"-d\" debug flag in the new PEG parser.\nPatch by Pablo Galindo\n\n- bpo-40217(102): Instances of types created with *note\nPyTypeFromSpecWithBases(): 2e0. will no longer automatically visit\ntheir class object when traversing references in the garbage\ncollector.  The user is expected to manually visit the object's\nclass.  Patch by Pablo Galindo.\n\n- bpo-39573(103): *note PyTYPE(): 56b. is changed to the inline\nstatic function.  Patch by Donghee Na.\n\n- bpo-40696(104): Fix a hang that can arise after *note\ngenerator.throw(): 241. due to a cycle in the exception context\nchain.\n\n- bpo-40521(105): Each interpreter now its has own free lists,\nsingletons and caches:\n\n* Free lists: float, tuple, list, dict, frame, context,\nasynchronous generator, MemoryError.\n\n* Singletons: empty tuple, empty bytes string, empty Unicode\nstring, single byte character, single Unicode (latin1)\ncharacter.\n\n* Slice cache.\n\nThey are no longer shared by all interpreters.\n\n- bpo-40679(106): Certain *note TypeError: 28e. messages about\nmissing or extra arguments now include the function's *note\nqualified name: 16a7.  Patch by Dennis Sweeney.\n\n- bpo-29590(107): Make the stack trace correct after calling *note\ngenerator.throw(): 241. on a generator that has yielded from a\n'yield from'.\n\n- bpo-4022(108): Improve performance of generators by not raising\ninternal StopIteration.\n\n- bpo-1635741(109): Port *note mmap: 8b. to multiphase\ninitialization.\n\n- bpo-1635741(110): Port 'lzma' to multiphase initialization.\n\n- bpo-37999(111): Builtin and extension functions that take integer\narguments no longer accept *note Decimal: 5c3.s, *note Fraction:\n1a8.s and other objects that can be converted to integers only with\na loss (e.g.  that have the *note int(): 4f0. method but do not\nhave the *note index(): 4f1. method).\n\n- bpo-29882(112): Add *note int.bitcount(): 5be, counting the number\nof ones in the binary representation of an integer.  Patch by\nNiklas Fiekas.\n\n- bpo-36982(113): Use ncurses extended color functions when available\nto support terminals with 256 colors, and add the new function\n*note curses.hasextendedcolorsupport(): 5e8. to indicate whether\nextended color support is provided by the underlying ncurses\nlibrary.\n\n- bpo-19569(114): Add the private macros 'PyCOMPDIAGPUSH',\n'PyCOMPDIAGIGNOREDEPRDECLS', and 'PyCOMPDIAGPOP'.\n\n- bpo-26680(115): The int type now supports the x.isinteger() method\nfor compatibility with float.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=41909\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=41922\n\n(3) https://peps.python.org/pep-0590/\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=41873\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=41870\n\n(6) https://peps.python.org/pep-0590/\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(8) https://peps.python.org/pep-0489/\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=39934\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=41780\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(12) https://peps.python.org/pep-0489/\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(14) https://peps.python.org/pep-0489/\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(16) https://peps.python.org/pep-0489/\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(18) https://peps.python.org/pep-0489/\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=41690\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(22) https://peps.python.org/pep-0489/\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(24) https://peps.python.org/pep-0489/\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(26) https://peps.python.org/pep-0489/\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=41681\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=41675\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=41670\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=41654\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(32) https://peps.python.org/pep-0489/\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=41631\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=40077\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=1653741\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(37) https://peps.python.org/pep-0489/\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=41533\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=41531\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=41525\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(42) https://peps.python.org/pep-0489/\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=41431\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=41428\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=41340\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=38156\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=41342\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=41334\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=41295\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=41323\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=41247\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=41252\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=41215\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=41218\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(59) https://bugs.python.org/issue?@action=redirect&bpo=41175\n\n(60) https://bugs.python.org/issue?@action=redirect&bpo=41100\n\n(61) https://bugs.python.org/issue?@action=redirect&bpo=41094\n\n(62) https://bugs.python.org/issue?@action=redirect&bpo=39960\n\n(63) https://bugs.python.org/issue?@action=redirect&bpo=41084\n\n(64) https://bugs.python.org/issue?@action=redirect&bpo=40521\n\n(65) https://bugs.python.org/issue?@action=redirect&bpo=41076\n\n(66) https://bugs.python.org/issue?@action=redirect&bpo=41056\n\n(67) https://bugs.python.org/issue?@action=redirect&bpo=41061\n\n(68) https://bugs.python.org/issue?@action=redirect&bpo=41052\n\n(69) https://bugs.python.org/issue?@action=redirect&bpo=40939\n\n(70) https://bugs.python.org/issue?@action=redirect&bpo=35975\n\n(71) https://bugs.python.org/issue?@action=redirect&bpo=40939\n\n(72) https://bugs.python.org/issue?@action=redirect&bpo=40077\n\n(73) https://bugs.python.org/issue?@action=redirect&bpo=41006\n\n(74) https://bugs.python.org/issue?@action=redirect&bpo=40636\n\n(75) https://peps.python.org/pep-0618/\n\n(76) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(77) https://bugs.python.org/issue?@action=redirect&bpo=40985\n\n(78) https://bugs.python.org/issue?@action=redirect&bpo=40958\n\n(79) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(80) https://bugs.python.org/issue?@action=redirect&bpo=40957\n\n(81) https://bugs.python.org/issue?@action=redirect&bpo=40950\n\n(82) https://peps.python.org/pep-3121/\n\n(83) https://bugs.python.org/issue?@action=redirect&bpo=40947\n\n(84) https://bugs.python.org/issue?@action=redirect&bpo=40939\n\n(85) https://bugs.python.org/issue?@action=redirect&bpo=40847\n\n(86) https://bugs.python.org/issue?@action=redirect&bpo=40890\n\n(87) https://bugs.python.org/issue?@action=redirect&bpo=40889\n\n(88) https://bugs.python.org/issue?@action=redirect&bpo=40904\n\n(89) https://bugs.python.org/issue?@action=redirect&bpo=40903\n\n(90) https://bugs.python.org/issue?@action=redirect&bpo=40880\n\n(91) https://bugs.python.org/issue?@action=redirect&bpo=40883\n\n(92) https://bugs.python.org/issue?@action=redirect&bpo=40870\n\n(93) https://bugs.python.org/issue?@action=redirect&bpo=40854\n\n(94) https://bugs.python.org/issue?@action=redirect&bpo=40826\n\n(95) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(96) https://bugs.python.org/issue?@action=redirect&bpo=19468\n\n(97) https://bugs.python.org/issue?@action=redirect&bpo=40824\n\n(98) https://bugs.python.org/issue?@action=redirect&bpo=40792\n\n(99) https://bugs.python.org/issue?@action=redirect&bpo=40780\n\n(100) https://bugs.python.org/issue?@action=redirect&bpo=38964\n\n(101) https://bugs.python.org/issue?@action=redirect&bpo=40750\n\n(102) https://bugs.python.org/issue?@action=redirect&bpo=40217\n\n(103) https://bugs.python.org/issue?@action=redirect&bpo=39573\n\n(104) https://bugs.python.org/issue?@action=redirect&bpo=40696\n\n(105) https://bugs.python.org/issue?@action=redirect&bpo=40521\n\n(106) https://bugs.python.org/issue?@action=redirect&bpo=40679\n\n(107) https://bugs.python.org/issue?@action=redirect&bpo=29590\n\n(108) https://bugs.python.org/issue?@action=redirect&bpo=4022\n\n(109) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(110) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(111) https://bugs.python.org/issue?@action=redirect&bpo=37999\n\n(112) https://bugs.python.org/issue?@action=redirect&bpo=29882\n\n(113) https://bugs.python.org/issue?@action=redirect&bpo=36982\n\n(114) https://bugs.python.org/issue?@action=redirect&bpo=19569\n\n(115) https://bugs.python.org/issue?@action=redirect&bpo=26680\n\nFile: python3.12.info,  Node: Library<34>,  Next: Documentation<34>,  Prev: Core and Builtins<34>,  Up: Python 3 10 0 alpha 1\n\n1.22.34.3 Library\n.................\n\n- bpo-41900(1): C14N 2.0 serialisation in xml.etree.ElementTree\nfailed for unprefixed attributes when a default namespace was\ndefined.\n\n- bpo-41887(2): Strip leading spaces and tabs on *note\nast.literaleval(): a5e.  Also document stripping of spaces and\ntabs for *note eval(): 690.\n\n- bpo-41773(3): Note in documentation that *note random.choices():\nb15. doesn't support non-finite weights, raise *note ValueError:\n183. when given non-finite weights.\n\n- bpo-41840(4): Fix a bug in the *note symtable: d2. module that was\ncausing module-scope global variables to not be reported as both\nlocal and global.  Patch by Pablo Galindo.\n\n- bpo-41842(5): Add *note codecs.unregister(): 5dc. function to\nunregister a codec search function.\n\n- bpo-40564(6): In 'zipfile.Path', mutate the passed ZipFile object\ntype instead of making a copy.  Prevents issues when both the local\ncopy and the caller's copy attempt to close the same file handle.\n\n- bpo-40670(7): More reliable validation of statements in *note\ntimeit.Timer: 131f.  It now accepts \"empty\" statements (only\nwhitespaces and comments) and rejects misindentent statements.\n\n- bpo-41833(8): The *note threading.Thread: 76c. constructor now uses\nthe target name if the 'target' argument is specified but the\n'name' argument is omitted.\n\n- bpo-41817(9): fix 'tkinter.EventType' Enum so all members are\nstrings, and none are tuples\n\n- bpo-41810(10): *note types.EllipsisType: 647, *note\ntypes.NotImplementedType: 649. and *note types.NoneType: 648. have\nbeen reintroduced, providing a new set of types readily\ninterpretable by static type checkers.\n\n- bpo-41815(11): Fix SQLite3 segfault when backing up closed\ndatabase.  Patch contributed by Peter David McCormick.\n\n- bpo-41816(12): StrEnum added: it ensures that all members are\nalready strings or string candidates\n\n- bpo-41517(13): fix bug allowing Enums to be extended via multiple\ninheritance\n\n- bpo-39587(14): use the correct mix-in data type when constructing\nEnums\n\n- bpo-41792(15): Add istypeddict function to typing.py to check if a\ntype is a TypedDict class\n\nPreviously there was no way to check that without using private\nAPI.  See the relevant issue in python/typing(16).\n\n- bpo-41789(17): Honor 'object' overrides in 'Enum' class creation\n(specifically, 'str', 'repr', 'format', and\n'reduceex').\n\n- bpo-32218(18): 'enum.Flag' and 'enum.IntFlag' members are now\niterable.\n\n- bpo-39651(19): Fix a race condition in the 'callsoonthreadsafe()'\nmethod of 'asyncio.ProactorEventLoop': do nothing if the self-pipe\nsocket has been closed.\n\n- bpo-1635741(20): Port the 'mashal' extension module to the\nmulti-phase initialization API ( PEP 489(21)).\n\n- bpo-1635741(22): Port the 'string' extension module to the\nmulti-phase initialization API ( PEP 489(23)).\n\n- bpo-41732(24): Added an *note iterator: 16a9. to *note memoryview:\n17f.\n\n- bpo-41720(25): Fixed 'turtle.Vec2D.rmul()' for arguments which\nare not int or float.\n\n- bpo-41696(26): Fix handling of debug mode in *note asyncio.run():\n197.  This allows setting 'PYTHONASYNCIODEBUG' or '-X dev' to\nenable asyncio debug mode when using *note asyncio.run(): 197.\n\n- bpo-41687(27): Fix implementation of sendfile to be compatible with\nSolaris.\n\n- bpo-41662(28): No longer override exceptions raised in 'len()'\nof a sequence of parameters in *note sqlite3: c9. with *note\nProgrammingError: 238.\n\n- bpo-39010(29): Restarting a 'ProactorEventLoop' on Windows no\nlonger logs spurious 'ConnectionResetErrors'.\n\n- bpo-41638(30): *note ProgrammingError: 238. message for absent\nparameter in *note sqlite3: c9. contains now the name of the\nparameter instead of its index when parameters are supplied as a\ndict.\n\n- bpo-41662(31): Fixed crash when mutate list of parameters during\niteration in *note sqlite3: c9.\n\n- bpo-41513(32): Improved the accuracy of math.hypot().  Internally,\neach step is computed with extra precision so that the result is\nnow almost always correctly rounded.\n\n- bpo-41609(33): The pdb whatis command correctly reports instance\nmethods as 'Method' rather than 'Function'.\n\n- bpo-39994(34): Fixed pprint's handling of dict subclasses that\noverride repr.\n\n- bpo-32751(35): When cancelling the task due to a timeout, *note\nasyncio.waitfor(): 3c8. will now wait until the cancellation is\ncomplete also in the case when 'timeout' is <= 0, like it does with\npositive timeouts.\n\n- bpo-37658(36): *note asyncio.waitfor(): 3c8. now properly handles\nraces between cancellation of itself and the completion of the\nwrapped awaitable.\n\n- bpo-40782(37): Change the method\nasyncio.AbstractEventLoop.runinexecutor to not be a coroutine.\n\n- bpo-41520(38): Fix *note codeop: 1a. regression that prevented\nturning compile warnings into errors.\n\n- bpo-41528(39): turtle uses math module functions to convert degrees\nto radians and vice versa and to calculate vector norm\n\n- bpo-41513(40): Minor algorithmic improvement to math.hypot() and\nmath.dist() giving small gains in speed and accuracy.\n\n- bpo-41503(41): Fixed a race between setTarget and flush in\nlogging.handlers.MemoryHandler.\n\n- bpo-41497(42): Fix potential UnicodeDecodeError in dis module.\n\n- bpo-41467(43): On Windows, fix asyncio 'recvinto()' return value\nwhen the socket/pipe is closed (*note BrokenPipeError: ed5.):\nreturn '0' rather than an empty byte string ('b''').\n\n- bpo-41425(44): Make tkinter doc example runnable.\n\n- bpo-41421(45): Make an algebraic simplification to\nrandom.paretovariate().  It now is slightly less subject to\nround-off error and is slightly faster.  Inputs that used to cause\nZeroDivisionError now cause an OverflowError instead.\n\n- bpo-41440(46): Add *note os.cpucount(): 60b. support for VxWorks\nRTOS.\n\n- bpo-41316(47): Fix the *note tarfile: d8. module to write only\nbasename of TAR file to GZIP compression header.\n\n- bpo-41384(48): Raise TclError instead of TypeError when an unknown\noption is passed to tkinter.OptionMenu.\n\n- bpo-41317(49): Use adddonecallback() in\nasyncio.loop.sockaccept() to unsubscribe reader early on\ncancellation.\n\n- bpo-41364(50): Reduce import overhead of *note uuid: 10b.\n\n- bpo-35328(51): Set the environment variable 'VIRTUALENVPROMPT' at\n*note venv: 10c. activation.\n\n- bpo-41341(52): Recursive evaluation of 'typing.ForwardRef' in\n'gettypehints'.\n\n- bpo-41344(53): Prevent creating 'sharedmemory.SharedMemory'\nobjects with 'size=0'.\n\n- bpo-41333(54): 'collections.OrderedDict.pop()' is now 2 times\nfaster.\n\n- bpo-41288(55): Unpickling invalid NEWOBJEX opcode with the C\nimplementation raises now UnpicklingError instead of crashing.\n\n- bpo-39017(56): Avoid infinite loop when reading specially crafted\nTAR files using the tarfile module (CVE-2019-20907).\n\n- bpo-41273(57): Speed up any transport using\n'ProactorReadPipeTransport' by calling 'recvinto' instead of\n'recv', thus not creating a new buffer for each 'recv' call in the\ntransport's read loop.\n\n- bpo-41235(58): Fix the error handling in *note\nssl.SSLContext.loaddhparams(): fb6.\n\n- bpo-41207(59): In distutils.spawn, restore expectation that\nDistutilsExecError is raised when the command is not found.\n\n- bpo-29727(60): Register *note array.array: 18f. as a *note\nMutableSequence: c31.  Patch by Pablo Galindo.\n\n- bpo-39168(61): Remove the 'new' method of *note typing.Generic:\n1453.\n\n- bpo-41194(62): Fix a crash in the 'ast' module: it can no longer\nbe loaded more than once.  It now uses a global state rather than a\nmodule state.\n\n- bpo-41195(63): Add read-only ssl.SSLContext.securitylevel\nattribute to retrieve the context's security level.\n\n- bpo-41193(64): The 'writehistory()' atexit function of the\nreadline completer now ignores any *note OSError: 613. to ignore\nerror if the filesystem is read-only, instead of only ignoring\n*note FileNotFoundError: 353. and *note PermissionError: b9a.\n\n- bpo-41182(65): selector: use DefaultSelector based upon\nimplementation\n\n- bpo-41161(66): The decimal module now requires libmpdec-2.5.0.\nUsers of -with-system-libmpdec should update their system library.\n\n- bpo-40874(67): The decimal module now requires libmpdec-2.5.0.\n\n- bpo-41138(68): Fixed the *note trace: f8. module CLI for Python\nsource files with non-UTF-8 encoding.\n\n- bpo-31082(69): Use the term \"iterable\" in the docstring for *note\nfunctools.reduce(): 1151.\n\n- bpo-40521(70): Remove freelist from collections.deque().\n\n- bpo-31938(71): Fix default-value signatures of several functions in\nthe *note select: bc. module - by Anthony Sottile.\n\n- bpo-41068(72): Fixed reading files with non-ASCII names from ZIP\narchive directly after writing them.\n\n- bpo-41058(73): 'pdb.findfunction()' now correctly determines the\nsource file encoding.\n\n- bpo-41056(74): Invalid file descriptor values are now prevented\nfrom being passed to os.fpathconf.  (discovered by Coverity)\n\n- bpo-41056(75): Fix a NULL pointer dereference within the ssl module\nduring a MemoryError in the keylog callback.  (discovered by\nCoverity)\n\n- bpo-41056(76): Fixed an instance where a MemoryError within the\nzoneinfo module might not be reported or not reported at its\nsource.  (found by Coverity)\n\n- bpo-41048(77): *note mimetypes.readmimetypes(): 16aa. function\nreads the rule file using UTF-8 encoding, not the locale encoding.\nPatch by Srinivas Reddy Thatiparthy.\n\n- bpo-41043(78): Fixed the use of *note glob(): 5fa. in the stdlib:\nliteral part of the path is now always correctly escaped.\n\n- bpo-41025(79): Fixed an issue preventing the C implementation of\n*note zoneinfo.ZoneInfo: 6f8. from being subclassed.\n\n- bpo-35018(80): Add the *note xml.sax.handler.LexicalHandler: 656.\nclass that is present in other SAX XML implementations.\n\n- bpo-41002(81): Improve performance of HTTPResponse.read with a\ngiven amount.  Patch by Bruce Merry.\n\n- bpo-40448(82): *note ensurepip: 50. now disables the use of 'pip'\ncache when installing the bundled versions of 'pip' and\n'setuptools'.  Patch by Krzysztof Konopko.\n\n- bpo-40967(83): Removed 'asyncio.Task.currenttask()' and\n'asyncio.Task.alltasks()'.  Patch contributed by Re'mi Lapeyre.\n\n- bpo-40924(84): Ensure 'importlib.resources.path' returns an extant\npath for the SourceFileLoader's resource reader.  Avoids the\nregression identified in master while a long-term solution is\ndevised.\n\n- bpo-40955(85): Fix a minor memory leak in *note subprocess: d0.\nmodule when extragroups was specified.\n\n- bpo-40855(86): The standard deviation and variance functions in the\nstatistics module were ignoring their mu and xbar arguments.\n\n- bpo-40939(87): Use the new PEG parser when generating the stdlib\n*note keyword: 7e. module.\n\n- bpo-23427(88): Add *note sys.origargv: 636. attribute: the list of\nthe original command line arguments passed to the Python\nexecutable.\n\n- bpo-33689(89): Ignore empty or whitespace-only lines in .pth files.\nThis matches the documentated behavior.  Before, empty lines caused\nthe site-packages dir to appear multiple times in sys.path.  By Ido\nMichael, contributors Malcolm Smith and Tal Einat.\n\n- bpo-40884(90): Added a 'defaults' parameter to *note\nlogging.Formatter: 12ec, to allow specifying default values for\ncustom fields.  Patch by Asaf Alon and Bar Harel.\n\n- bpo-40876(91): Clarify error message in the *note csv: 27. module.\n\n- bpo-39791(92): Refresh importlib.metadata from importlibmetadata\n1.6.1.\n\n- bpo-40807(93): Stop codeop.maybecompile, used by\ncode.InteractiveInterpreter (and IDLE). from emitting each warning\nthree times.\n\n- bpo-32604(94): Fix reference leak in the *note select: bc. module\nwhen the module is imported in a subinterpreter.\n\n- bpo-39791(95): Built-in loaders (SourceFileLoader and ZipImporter)\nnow supply 'TraversableResources' implementations for\n'ResourceReader', and the fallback function has been removed.\n\n- bpo-39314(96): *note rlcompleter.Completer: 16ab. and the standard\nPython shell now close the parenthesis for functions that take no\narguments.  Patch contributed by Re'mi Lapeyre.\n\n- bpo-17005(97): The topological sort functionality that was\nintroduced initially in the *note functools: 5a. module has been\nmoved to a new *note graphlib: 60. module to better accommodate the\nnew tools and keep the original scope of the *note functools: 5a.\nmodule.  Patch by Pablo Galindo\n\n- bpo-40834(98): Fix truncate when sending str object\nwithxxsubinterpreters.channelsend.\n\n- bpo-40755(99): Add rich comparisons to collections.Counter().\n\n- bpo-26407(100): Unexpected errors in calling the 'iter' method\nare no longer masked by 'TypeError' in *note csv.reader(): 12f7,\n'csv.writer.writerow()' and 'csv.writer.writerows()'.\n\n- bpo-39384(101): Fixed email.contentmanager to allow setcontent()\nto set a null string.\n\n- bpo-40744(102): The *note sqlite3: c9. module uses SQLite API\nfunctions that require SQLite v3.7.3 or higher.  This patch removes\nsupport for older SQLite versions, and explicitly requires SQLite\n3.7.3 both at build, compile and runtime.  Patch by Sergey Fedoseev\nand Erlend E. Aasland.\n\n- bpo-40777(103): Initialize PyDateTimeIsoCalendarDateType.tpbase\nat run-time to avoid errors on some compilers.\n\n- bpo-38488(104): Update ensurepip to install pip 20.1.1 and\nsetuptools 47.1.0.\n\n- bpo-40792(105): The result of *note operator.index(): 1673. now\nalways has exact type *note int: 17e.  Previously, the result could\nhave been an instance of a subclass of 'int'.\n\n- bpo-40767(106): *note webbrowser: 110. now properly finds the\ndefault browser in pure Wayland systems by checking the\nWAYLANDDISPLAY environment variable.  Patch contributed by Je're'my\nAttali.\n\n- bpo-40791(107): 'hashlib.comparedigest()' uses OpenSSL's\n'CRYPTOmemcmp()' function when OpenSSL is available.\n\n- bpo-40795(108): *note ctypes: 28. module: If ctypes fails to\nconvert the result of a callback or if a ctypes callback function\nraises an exception, sys.unraisablehook is now called with an\nexception set.  Previously, the error was logged into stderr by\n*note PyErrPrint(): 16ac.\n\n- bpo-16995(109): Add *note base64.b32hexencode(): 5d7. and *note\nbase64.b32hexdecode(): 5d8. to support the Base32 Encoding with\nExtended Hex Alphabet.\n\n- bpo-30008(110): Fix *note ssl: ca. code to be compatible with\nOpenSSL 1.1.x builds that use 'no-deprecated' and '--api=1.1.0'.\n\n- bpo-30064(111): Fix asyncio 'loop.sock*' race condition issue\n\n- bpo-40759(112): Deprecate the 'symbol' module.\n\n- bpo-40756(113): The second argument (extra) of\n'LoggerAdapter.init' now defaults to None.\n\n- bpo-37129(114): Add a new *note os.RWFAPPEND: 16ad. flag for *note\nos.pwritev(): 99e.\n\n- bpo-40737(115): Fix possible reference leak for *note sqlite3: c9.\ninitialization.\n\n- bpo-40726(116): Handle cases where the 'endlineno' is 'None' on\n*note ast.incrementlineno(): 14ea.\n\n- bpo-40698(117): 'distutils' upload creates SHA2-256 and Blake2b-256\ndigests.  MD5 digests is skipped if platform blocks MD5.\n\n- bpo-40695(118): *note hashlib: 63. no longer falls back to builtin\nhash implementations when OpenSSL provides a hash digest and the\nalgorithm is blocked by security policy.\n\n- bpo-9216(119): *note hashlib.new(): 16ae. passed 'usedforsecurity'\nto OpenSSL EVP constructor 'hashlib.new()'.  testhashlib and\ntestsmtplib handle strict security policy better.\n\n- bpo-40614(120): *note ast.parse(): 182. will not parse self\ndocumenting expressions in f-strings when passed 'featureversion'\nis less than '(3, 8)'.\n\n- bpo-40626(121): Add h5 file extension as MIME Type\napplication/x-hdf5, as per HDF Group recommendation for HDF5\nformatted data files.  Patch contributed by Mark Schwab.\n\n- bpo-25920(122): On macOS, when building Python for macOS 10.4 and\nolder, which wasn't the case for python.org macOS installer, *note\nsocket.getaddrinfo(): 149f. no longer uses an internal lock to\nprevent race conditions when calling 'getaddrinfo()' which is\nthread-safe since macOS 10.5.  Python 3.9 requires macOS 10.6 or\nnewer.  The internal lock caused random hang on fork when another\nthread was calling *note socket.getaddrinfo(): 149f.  The lock was\nalso used on FreeBSD older than 5.3, OpenBSD older than 201311 and\nNetBSD older than 4.\n\n- bpo-40671(123): Prepare 'hashlib' for PEP 489(124) and use *note\nPyModuleAddType(): 799.\n\n- bpo-32309(125): Added a new *note coroutine: 1ae. *note\nasyncio.tothread(): 701.  It is mainly used for running IO-bound\nfunctions in a separate thread to avoid blocking the event loop,\nand essentially works as a high-level version of *note\nruninexecutor(): 702. that can directly take keyword arguments.\n\n- bpo-36543(126): Restored the deprecated 'xml.etree.cElementTree'\nmodule.\n\n- bpo-40611(127): *note MAPPOPULATE: 16af. constant has now been\nadded to the list of exported *note mmap: 8b. module flags.\n\n- bpo-39881(128): PEP 554 for use in the test suite.  (Patch By\nJoannah Nanjekye)\n\n- bpo-13097(129): 'ctypes' now raises an 'ArgumentError' when a\ncallback is invoked with more than 1024 arguments.\n\n- bpo-39385(130): A new test assertion context-manager,\n'unittest.assertNoLogs()' will ensure a given block of code emits\nno log messages using the logging module.  Contributed by Kit Yan\nChoi.\n\n- bpo-23082(131): Updated the error message and docs of\nPurePath.relativeto() to better reflect the function behaviour.\n\n- bpo-40318(132): Use SQLite3 trace v2 API, if it is available.\n\n- bpo-40105(133): ZipFile truncates files to avoid corruption when a\nshorter comment is provided in append (\"a\") mode.  Patch by Jan\nMazur.\n\n- bpo-40084(134): Fix 'Enum.dir': dir(Enum.member) now includes\nattributes as well as methods.\n\n- bpo-31122(135): ssl.wrapsocket() now raises ssl.SSLEOFError rather\nthan OSError when peer closes connection during TLS negotiation\n\n- bpo-39728(136): fix default 'missing' so a duplicate 'ValueError'\nis not set as the 'context' of the original 'ValueError'.\n\n- bpo-39244(137): Fixed\n'multiprocessing.context.getallstartmethods' to properly return\nthe default method first on macOS.\n\n- bpo-39040(138): Fix parsing of invalid mime headers parameters by\ncollapsing whitespace between encoded words in a bare-quote-string.\n\n- bpo-38731(139): Add '--quiet' option to command-line interface of\n*note pycompile: ae.  Patch by Gregory Schevchenko.\n\n- bpo-35714(140): *note struct.error: 119b. is now raised if there is\na null character in a *note struct: cf. format string.\n\n- bpo-38144(141): Added the 'rootdir' and 'dirfd' parameters in\n*note glob.glob(): 5fa.\n\n- bpo-26543(142): Fix 'IMAP4.noop()' when debug mode is enabled (ex:\n'imaplib.Debug = 3').\n\n- bpo-12178(143): *note csv.writer(): 1a2. now correctly escapes\n'escapechar' when input contains 'escapechar'.  Patch by Catalin\nIacob, Berker Peksag, and Itay Elbirt.\n\n- bpo-36290(144): AST nodes are now raising *note TypeError: 28e. on\nconflicting keyword arguments.  Patch contributed by Re'mi Lapeyre.\n\n- bpo-33944(145): Added site.py site-packages tracing in verbose\nmode.\n\n- bpo-35078(146): Refactor formatweekday, formatmonthname methods in\nLocaleHTMLCalendar and LocaleTextCalendar classes in calendar\nmodule to call the base class methods.This enables customizable CSS\nclasses for LocaleHTMLCalendar.  Patch by Srinivas Reddy\nThatiparthy\n\n- bpo-29620(147): *note assertWarns(): fd9. no longer raises a\n'RuntimeException' when accessing a module's 'warningregistry'\ncauses importation of a new module, or when a new module is\nimported in another thread.  Patch by Kernc.\n\n- bpo-31844(148): Remove 'ParserBase.error()' method from the private\nand undocumented 'markupbase' module.  *note\nhtml.parser.HTMLParser: 682. is the only subclass of 'ParserBase'\nand its 'error()' implementation was deprecated in Python 3.4 and\nremoved in Python 3.5.\n\n- bpo-34226(149): Fix 'cgi.parsemultipart' without contentlength.\nPatch by Roger Duran\n\n- bpo-33660(150): Fix pathlib.PosixPath to resolve a relative path\nlocated on the root directory properly.\n\n- bpo-28557(151): Improve the error message for a misbehaving\n'rawio.readinto'\n\n- bpo-26680(152): The d.isinteger() method is added to the Decimal\ntype, for compatibility with other number types.\n\n- bpo-26680(153): The x.isinteger() method is incorporated into the\nabstract types of the numeric tower, Real, Rational and Integral,\nwith appropriate default implementations.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=41900\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=41887\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=41773\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=41840\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=41842\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=40564\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=40670\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=41833\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=41817\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=41810\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=41815\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=41816\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=41517\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=39587\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=41792\n\n(16) https://github.com/python/typing/issues/751\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=41789\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=32218\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=39651\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(21) https://peps.python.org/pep-0489/\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(23) https://peps.python.org/pep-0489/\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=41732\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=41720\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=41696\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=41687\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=41662\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=39010\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=41638\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=41662\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=41513\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=41609\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=39994\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=32751\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=37658\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=40782\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=41520\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=41528\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=41513\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=41503\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=41497\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=41467\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=41425\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=41421\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=41440\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=41316\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=41384\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=41317\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=41364\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=35328\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=41341\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=41344\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=41333\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=41288\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=39017\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=41273\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=41235\n\n(59) https://bugs.python.org/issue?@action=redirect&bpo=41207\n\n(60) https://bugs.python.org/issue?@action=redirect&bpo=29727\n\n(61) https://bugs.python.org/issue?@action=redirect&bpo=39168\n\n(62) https://bugs.python.org/issue?@action=redirect&bpo=41194\n\n(63) https://bugs.python.org/issue?@action=redirect&bpo=41195\n\n(64) https://bugs.python.org/issue?@action=redirect&bpo=41193\n\n(65) https://bugs.python.org/issue?@action=redirect&bpo=41182\n\n(66) https://bugs.python.org/issue?@action=redirect&bpo=41161\n\n(67) https://bugs.python.org/issue?@action=redirect&bpo=40874\n\n(68) https://bugs.python.org/issue?@action=redirect&bpo=41138\n\n(69) https://bugs.python.org/issue?@action=redirect&bpo=31082\n\n(70) https://bugs.python.org/issue?@action=redirect&bpo=40521\n\n(71) https://bugs.python.org/issue?@action=redirect&bpo=31938\n\n(72) https://bugs.python.org/issue?@action=redirect&bpo=41068\n\n(73) https://bugs.python.org/issue?@action=redirect&bpo=41058\n\n(74) https://bugs.python.org/issue?@action=redirect&bpo=41056\n\n(75) https://bugs.python.org/issue?@action=redirect&bpo=41056\n\n(76) https://bugs.python.org/issue?@action=redirect&bpo=41056\n\n(77) https://bugs.python.org/issue?@action=redirect&bpo=41048\n\n(78) https://bugs.python.org/issue?@action=redirect&bpo=41043\n\n(79) https://bugs.python.org/issue?@action=redirect&bpo=41025\n\n(80) https://bugs.python.org/issue?@action=redirect&bpo=35018\n\n(81) https://bugs.python.org/issue?@action=redirect&bpo=41002\n\n(82) https://bugs.python.org/issue?@action=redirect&bpo=40448\n\n(83) https://bugs.python.org/issue?@action=redirect&bpo=40967\n\n(84) https://bugs.python.org/issue?@action=redirect&bpo=40924\n\n(85) https://bugs.python.org/issue?@action=redirect&bpo=40955\n\n(86) https://bugs.python.org/issue?@action=redirect&bpo=40855\n\n(87) https://bugs.python.org/issue?@action=redirect&bpo=40939\n\n(88) https://bugs.python.org/issue?@action=redirect&bpo=23427\n\n(89) https://bugs.python.org/issue?@action=redirect&bpo=33689\n\n(90) https://bugs.python.org/issue?@action=redirect&bpo=40884\n\n(91) https://bugs.python.org/issue?@action=redirect&bpo=40876\n\n(92) https://bugs.python.org/issue?@action=redirect&bpo=39791\n\n(93) https://bugs.python.org/issue?@action=redirect&bpo=40807\n\n(94) https://bugs.python.org/issue?@action=redirect&bpo=32604\n\n(95) https://bugs.python.org/issue?@action=redirect&bpo=39791\n\n(96) https://bugs.python.org/issue?@action=redirect&bpo=39314\n\n(97) https://bugs.python.org/issue?@action=redirect&bpo=17005\n\n(98) https://bugs.python.org/issue?@action=redirect&bpo=40834\n\n(99) https://bugs.python.org/issue?@action=redirect&bpo=40755\n\n(100) https://bugs.python.org/issue?@action=redirect&bpo=26407\n\n(101) https://bugs.python.org/issue?@action=redirect&bpo=39384\n\n(102) https://bugs.python.org/issue?@action=redirect&bpo=40744\n\n(103) https://bugs.python.org/issue?@action=redirect&bpo=40777\n\n(104) https://bugs.python.org/issue?@action=redirect&bpo=38488\n\n(105) https://bugs.python.org/issue?@action=redirect&bpo=40792\n\n(106) https://bugs.python.org/issue?@action=redirect&bpo=40767\n\n(107) https://bugs.python.org/issue?@action=redirect&bpo=40791\n\n(108) https://bugs.python.org/issue?@action=redirect&bpo=40795\n\n(109) https://bugs.python.org/issue?@action=redirect&bpo=16995\n\n(110) https://bugs.python.org/issue?@action=redirect&bpo=30008\n\n(111) https://bugs.python.org/issue?@action=redirect&bpo=30064\n\n(112) https://bugs.python.org/issue?@action=redirect&bpo=40759\n\n(113) https://bugs.python.org/issue?@action=redirect&bpo=40756\n\n(114) https://bugs.python.org/issue?@action=redirect&bpo=37129\n\n(115) https://bugs.python.org/issue?@action=redirect&bpo=40737\n\n(116) https://bugs.python.org/issue?@action=redirect&bpo=40726\n\n(117) https://bugs.python.org/issue?@action=redirect&bpo=40698\n\n(118) https://bugs.python.org/issue?@action=redirect&bpo=40695\n\n(119) https://bugs.python.org/issue?@action=redirect&bpo=9216\n\n(120) https://bugs.python.org/issue?@action=redirect&bpo=40614\n\n(121) https://bugs.python.org/issue?@action=redirect&bpo=40626\n\n(122) https://bugs.python.org/issue?@action=redirect&bpo=25920\n\n(123) https://bugs.python.org/issue?@action=redirect&bpo=40671\n\n(124) https://peps.python.org/pep-0489/\n\n(125) https://bugs.python.org/issue?@action=redirect&bpo=32309\n\n(126) https://bugs.python.org/issue?@action=redirect&bpo=36543\n\n(127) https://bugs.python.org/issue?@action=redirect&bpo=40611\n\n(128) https://bugs.python.org/issue?@action=redirect&bpo=39881\n\n(129) https://bugs.python.org/issue?@action=redirect&bpo=13097\n\n(130) https://bugs.python.org/issue?@action=redirect&bpo=39385\n\n(131) https://bugs.python.org/issue?@action=redirect&bpo=23082\n\n(132) https://bugs.python.org/issue?@action=redirect&bpo=40318\n\n(133) https://bugs.python.org/issue?@action=redirect&bpo=40105\n\n(134) https://bugs.python.org/issue?@action=redirect&bpo=40084\n\n(135) https://bugs.python.org/issue?@action=redirect&bpo=31122\n\n(136) https://bugs.python.org/issue?@action=redirect&bpo=39728\n\n(137) https://bugs.python.org/issue?@action=redirect&bpo=39244\n\n(138) https://bugs.python.org/issue?@action=redirect&bpo=39040\n\n(139) https://bugs.python.org/issue?@action=redirect&bpo=38731\n\n(140) https://bugs.python.org/issue?@action=redirect&bpo=35714\n\n(141) https://bugs.python.org/issue?@action=redirect&bpo=38144\n\n(142) https://bugs.python.org/issue?@action=redirect&bpo=26543\n\n(143) https://bugs.python.org/issue?@action=redirect&bpo=12178\n\n(144) https://bugs.python.org/issue?@action=redirect&bpo=36290\n\n(145) https://bugs.python.org/issue?@action=redirect&bpo=33944\n\n(146) https://bugs.python.org/issue?@action=redirect&bpo=35078\n\n(147) https://bugs.python.org/issue?@action=redirect&bpo=29620\n\n(148) https://bugs.python.org/issue?@action=redirect&bpo=31844\n\n(149) https://bugs.python.org/issue?@action=redirect&bpo=34226\n\n(150) https://bugs.python.org/issue?@action=redirect&bpo=33660\n\n(151) https://bugs.python.org/issue?@action=redirect&bpo=28557\n\n(152) https://bugs.python.org/issue?@action=redirect&bpo=26680\n\n(153) https://bugs.python.org/issue?@action=redirect&bpo=26680\n\nFile: python3.12.info,  Node: Documentation<34>,  Next: Tests<32>,  Prev: Library<34>,  Up: Python 3 10 0 alpha 1\n\n1.22.34.4 Documentation\n.......................\n\n- bpo-41428(1): Add documentation for PEP 604(2) (Allow writing union\ntypes as 'X | Y').\n\n- bpo-41774(3): In Programming FAQ \"Sequences (Tuples/Lists)\"\nsection, add \"How do you remove multiple items from a list\".\n\n- bpo-35293(4): Fix RemovedInSphinx40Warning when building the\ndocumentation.  Patch by Donghee Na.\n\n- bpo-37149(5): Change Shipman tkinter doc link from archive.org to\nTkDocs.  (The doc has been removed from the NMT server.)  The new\nlink responds much faster and includes a short explanatory note.\n\n- bpo-41726(6): Update the refcounts info of\n'PyTypeFromModuleAndSpec'.\n\n- bpo-41624(7): Fix the signature of *note typing.Coroutine: 16b1.\n\n- bpo-40204(8): Enable Sphinx 3.2 'callowprev3' option and disable\n'cwarnonallowedprev3' option to make the documentation\ncompatible with Sphinx 2 and Sphinx 3.\n\n- bpo-41045(9): Add documentation for debug feature of f-strings.\n\n- bpo-41314(10): Changed the release when 'from future import\nannotations' becomes the default from '4.0' to '3.10' (following a\nchange in PEP 563).\n\n- bpo-40979(11): Refactored typing.rst, arranging more than 70\nclasses, functions, and decorators into new sub-sections.\n\n- bpo-40552(12): Fix in tutorial section 4.2.  Code snippet is now\ncorrect.\n\n- bpo-39883(13): Make code, examples, and recipes in the Python\ndocumentation be licensed under the more permissive BSD0 license in\naddition to the existing Python 2.0 license.\n\n- bpo-37703(14): Updated Documentation to comprehensively elaborate\non the behaviour of gather.cancel()\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=41428\n\n(2) https://peps.python.org/pep-0604/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=41774\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=35293\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=37149\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=41726\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=41624\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=40204\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=41045\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=41314\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=40979\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=40552\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=39883\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=37703\n\nFile: python3.12.info,  Node: Tests<32>,  Next: Build<32>,  Prev: Documentation<34>,  Up: Python 3 10 0 alpha 1\n\n1.22.34.5 Tests\n...............\n\n- bpo-41939(1): Fix testsite.testlicenseexistsaturl(): call\n'urllib.request.urlcleanup()' to reset the global\n'urllib.request.opener'.  Patch by Victor Stinner.\n\n- bpo-41731(2): Make testcmdlinescript pass with option '-vv'.\n\n- bpo-41602(3): Add tests for SIGINT handling in the runpy module.\n\n- bpo-41521(4): *note test.support: de.: Rename 'blacklist' parameter\nof *note checkall(): 16b3. to 'notexported'.\n\n- bpo-41477(5): Make ctypes optional in testgenericalias.\n\n- bpo-41085(6): Fix integer overflow in the *note\narray.array.index(): 5d4. method on 64-bit Windows for index larger\nthan '231'.\n\n- bpo-41069(7): 'test.support.TESTFN' and the current directory for\ntests when run via 'test.regrtest' contain now non-ascii characters\nif possible.\n\n- bpo-38377(8): On Linux, skip tests using multiprocessing if the\ncurrent user cannot create a file in '/dev/shm/' directory.  Add\nthe *note skipifbrokenmultiprocessingsynchronize(): 16b4.\nfunction to the *note test.support: de. module.\n\n- bpo-41009(9): Fix use of\n'support.require{linux|mac|freebsd}version()' decorators as class\ndecorator.\n\n- bpo-41003(10): Fix 'testcopyreg' when 'numpy' is installed:\n'test.pickletester' now saves/restores warnings filters when\nimporting 'numpy', to ignore filters installed by 'numpy'.\n\n- bpo-40964(11): Disable remote *note imaplib: 6f. tests, host\ncyrus.andrew.cmu.edu is blocking incoming connections.\n\n- bpo-40927(12): Fix testbinhex when run twice: it now uses\nimportfreshmodule() to ensure that it raises DeprecationWarning\neach time.\n\n- bpo-17258(13): Skip some *note multiprocessing: 8f. tests when MD5\nhash digest is blocked.\n\n- bpo-31904(14): Increase LOOPBACKTIMEOUT to 10 for VxWorks RTOS.\n\n- bpo-38169(15): Increase code coverage for SharedMemory and\nShareableList\n\n- bpo-34401(16): Make testgdb properly run on HP-UX. Patch by\nMichael Osipov.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=41939\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=41731\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=41602\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=41521\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=41477\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=41085\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=41069\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=38377\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=41009\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=41003\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=40964\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=40927\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=17258\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=38169\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=34401\n\nFile: python3.12.info,  Node: Build<32>,  Next: Windows<31>,  Prev: Tests<32>,  Up: Python 3 10 0 alpha 1\n\n1.22.34.6 Build\n...............\n\n- bpo-38249(1): Update *note PyUNREACHABLE: 9f9. to use\nbuiltinunreachable() if only the compiler is able to use it.\nPatch by Donghee Na.\n\n- bpo-41617(2): Fix 'pycorebitutils.h' header file to support old\nclang versions: 'builtinbswap16()' is not available in LLVM\nclang 3.0.\n\n- bpo-40204(3): Pin Sphinx version to 2.3.1 in 'Doc/Makefile'.\n\n- bpo-36020(4): The C99 functions 'snprintf()' and 'vsnprintf()' are\nnow required to build Python.\n\n- bpo-40684(5): 'make install' now uses the 'PLATLIBDIR' variable for\nthe destination 'lib-dynload/' directory when './configure\n--with-platlibdir' is used.\n\n- bpo-40683(6): Fixed an issue where the *note zoneinfo: 12e. module\nand its tests were not included when Python is installed with\n'make'.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38249\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=41617\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=40204\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=36020\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=40684\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=40683\n\nFile: python3.12.info,  Node: Windows<31>,  Next: macOS<26>,  Prev: Build<32>,  Up: Python 3 10 0 alpha 1\n\n1.22.34.7 Windows\n.................\n\n- bpo-41744(1): Fixes automatic import of props file when using the\nNuget package.\n\n- bpo-41627(2): The user site directory for 32-bit now includes a\n'-32' suffix to distinguish it from the 64-bit interpreter's\ndirectory.\n\n- bpo-41526(3): Fixed layout of final page of the installer by\nremoving the special thanks to Mark Hammond (with his permission).\n\n- bpo-41492(4): Fixes the description that appears in UAC prompts.\n\n- bpo-40948(5): Improve post-install message to direct people to the\n\"py\" command.\n\n- bpo-41412(6): The installer will now fail to install on Windows 7\nand Windows 8.  Further, the UCRT dependency is now always\ndownloaded on demand.\n\n- bpo-40741(7): Update Windows release to include SQLite 3.32.3.\n\n- bpo-41142(8): *note msilib: 8d. now supports creating CAB files\nwith non-ASCII file path and adding files with non-ASCII file path\nto them.\n\n- bpo-41074(9): Fixed support of non-ASCII names in functions *note\nmsilib.OpenDatabase(): 16b7. and *note msilib.initdatabase():\n16b8. and non-ASCII SQL in method *note msilib.Database.OpenView():\n16b9.\n\n- bpo-41039(10): Stable ABI redirection DLL (python3.dll) now uses\n'#pragma comment(linker)' for re-exporting.\n\n- bpo-40164(11): Updates Windows OpenSSL to 1.1.1g\n\n- bpo-39631(12): Changes the registered MIME type for '.py' files on\nWindows to 'text/x-python' instead of 'text/plain'.\n\n- bpo-40677(13): Manually define IOREPARSETAGAPPEXECLINK in case\nsome old Windows SDK doesn't have it.\n\n- bpo-37556(14): Extend py.exe help to mention overrides via venv,\nshebang, environmental variables & ini files.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=41744\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=41627\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=41526\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=41492\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=40948\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=41412\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=40741\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=41142\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=41074\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=41039\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=40164\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=39631\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=40677\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=37556\n\nFile: python3.12.info,  Node: macOS<26>,  Next: IDLE<19>,  Prev: Windows<31>,  Up: Python 3 10 0 alpha 1\n\n1.22.34.8 macOS\n...............\n\n- bpo-41557(1): Update macOS installer to use SQLite 3.33.0.\n\n- bpo-39580(2): Avoid opening Finder window if running installer from\nthe command line.  Patch contributed by Rick Heil.\n\n- bpo-41100(3): Fix configure error when building on macOS 11.  Note\nthat the current Python release was released shortly after the\nfirst developer preview of macOS 11 (Big Sur); there are other\nknown issues with building and running on the developer preview.\nBig Sur is expected to be fully supported in a future bugfix\nrelease of Python 3.8.x and with 3.9.0.\n\n- bpo-40741(4): Update macOS installer to use SQLite 3.32.3.\n\n- bpo-41005(5): fixed an XDG settings issue not allowing macos to\nopen browser in webbrowser.py\n\n- bpo-40741(6): Update macOS installer to use SQLite 3.32.2.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=41557\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=39580\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=41100\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=40741\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=41005\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=40741\n\nFile: python3.12.info,  Node: IDLE<19>,  Next: C API<30>,  Prev: macOS<26>,  Up: Python 3 10 0 alpha 1\n\n1.22.34.9 IDLE\n..............\n\n- bpo-41775(1): Use 'IDLE Shell' as shell title\n\n- bpo-35764(2): Rewrite the Calltips doc section.\n\n- bpo-40181(3): In calltips, stop reminding that '/' marks the end of\npositional-only arguments.\n\n- bpo-41468(4): Improve IDLE run crash error message (which users\nshould never see).\n\n- bpo-41373(5): Save files loaded with no line ending, as when blank,\nor different line endings, by setting its line ending to the system\ndefault.  Fix regression in 3.8.4 and 3.9.0b4.\n\n- bpo-41300(6): Save files with non-ascii chars.  Fix regression\nreleased in 3.9.0b4 and 3.8.4.\n\n- bpo-37765(7): Add keywords to module name completion list.  Rewrite\nCompletions section of IDLE doc.\n\n- bpo-41152(8): The encoding of 'stdin', 'stdout' and 'stderr' in\nIDLE is now always UTF-8.\n\n- bpo-41144(9): Make Open Module open a special module such as\nos.path.\n\n- bpo-39885(10): Make context menu Cut and Copy work again when\nright-clicking within a selection.\n\n- bpo-40723(11): Make testidle pass when run after import.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=41775\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=35764\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=40181\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=41468\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=41373\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=41300\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=37765\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=41152\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=41144\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=39885\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=40723\n\nFile: python3.12.info,  Node: C API<30>,  Prev: IDLE<19>,  Up: Python 3 10 0 alpha 1\n\n1.22.34.10 C API\n................\n\n- bpo-41936(1): Removed undocumented macros 'PyALLOWRECURSION' and\n'PyENDALLOWRECURSION' and the 'recursioncritical' field of the\n*note PyInterpreterState: 6d5. structure.\n\n- bpo-41692(2): The 'PyUnicodeInternImmortal()' function is now\ndeprecated and will be removed in Python 3.12: use *note\nPyUnicodeInternInPlace(): 6c9. instead.  Patch by Victor Stinner.\n\n- bpo-41842(3): Add *note PyCodecUnregister(): 6a6. function to\nunregister a codec search function.\n\n- bpo-41834(4): Remove the 'PyCheckRecursionLimit' variable: it has\nbeen replaced by 'ceval.recursionlimit' of the *note\nPyInterpreterState: 6d5. structure.  Patch by Victor Stinner.\n\n- bpo-41689(5): Types created with *note PyTypeFromSpec(): 2df. now\nmake any signature in their 'tpdoc' slot accessible from\n'textsignature'.\n\n- bpo-41524(6): Fix bug in PyOSmystrnicmp and PyOSmystricmp that\nincremented pointers beyond the end of a string.\n\n- bpo-41324(7): Add a minimal decimal capsule API. The API supports\nfast conversions between Decimals up to 38 digits and their triple\nrepresentation as a C struct.\n\n- bpo-30155(8): Add *note PyDateTimeDATEGETTZINFO(): 6a3. and\n*note PyDateTimeTIMEGETTZINFO(): 6a4. macros for accessing the\n'tzinfo' attributes of *note datetime.datetime: 222. and *note\ndatetime.time: 6a5. objects.\n\n- bpo-40170(9): Revert *note PyTypeHasFeature(): 16bd. change: it\nreads again directly the *note PyTypeObject.tpflags: 1620. member\nwhen the limited C API is not used, rather than always calling\n*note PyTypeGetFlags(): 16be. which hides implementation details.\n\n- bpo-41123(10): Remove 'PyUnicodeAsUnicodeCopy'.\n\n- bpo-41123(11): Removed 'PyLongFromUnicode()'.\n\n- bpo-41123(12): Removed 'PyUnicodeGetMax()'.\n\n- bpo-41123(13): Removed 'PyUNICODEstr*' functions manipulating\n'PyUNICODE*' strings.\n\n- bpo-41103(14): 'PyObjectAsCharBuffer()',\n'PyObjectAsReadBuffer()', 'PyObjectCheckReadBuffer()', and\n'PyObjectAsWriteBuffer()' are removed.  Please migrate to new\nbuffer protocol; *note PyObjectGetBuffer(): 541. and *note\nPyBufferRelease(): 54a.\n\n- bpo-36346(15): Raises DeprecationWarning for\n'PyUnicodeFromUnicode(NULL, size)' and\n'PyUnicodeFromStringAndSize(NULL, size)' with 'size > 0'.\n\n- bpo-36346(16): Mark 'PyUNICODECOPY', 'PyUNICODEFILL',\n'PyUnicodeWSTRLENGTH', 'PyUnicodeFromUnicode',\n'PyUnicodeAsUnicode', and 'PyUnicodeAsUnicodeAndSize' as\ndeprecated in C. Remove 'PyUNICODEMATCH' which was deprecated and\nbroken since Python 3.3.\n\n- bpo-40989(17): The 'PyObjectINIT()' and 'PyObjectINITVAR()'\nmacros become aliases to, respectively, *note PyObjectInit(): 898.\nand *note PyObjectInitVar(): 16bf. functions.\n\n- bpo-36020(18): On Windows, '#include \"pyerrors.h\"' no longer\ndefines 'snprintf' and 'vsnprintf' macros.\n\n- bpo-40943(19): The 'PYSSIZETCLEAN' macro must now be defined to\nuse *note PyArgParseTuple(): 2d1. and *note PyBuildValue(): 6bb.\nformats which use '#': 'es#', 'et#', 's#', 'u#', 'y#', 'z#', 'U#'\nand 'Z#'.  See *note Parsing arguments and building values: 6bc.\nand the PEP 353(20).\n\n- bpo-40910(21): Export explicitly the *note PyGetArgcArgv(): 16c0.\nfunction to the C API and document the function.  Previously, it\nwas exported implicitly which no longer works since Python is built\nwith '-fvisibility=hidden'.\n\n- bpo-40724(22): Allow defining buffer slots in type specs.\n\n- bpo-40679(23): Fix a 'PyEvalEvalCode()' crash if 'qualname'\nargument is NULL.\n\n- bpo-40839(24): Calling *note PyDictGetItem(): 6bf. without *note\nGIL: 6c0. held had been allowed for historical reason.  It is no\nlonger allowed.\n\n- bpo-40826(25): 'PyOSInterruptOccurred()' now fails with a fatal\nerror if it is called with the GIL released.\n\n- bpo-40792(26): The result of *note PyNumberIndex(): 6a1. now\nalways has exact type *note int: 17e.  Previously, the result could\nhave been an instance of a subclass of 'int'.\n\n- bpo-39573(27): Convert *note PyREFCNT(): 6bd. and *note PySIZE():\n56d. macros to static inline functions.  They cannot be used as\nl-value anymore: use *note PySETREFCNT(): 6be. and *note\nPySETSIZE(): 56e. to set an object reference count and size.\nThis change is backward incompatible on purpose, to prepare the C\nAPI for an opaque *note PyObject: 6b1. structure.\n\n- bpo-40703(28): The PyTypeFromSpec*() functions no longer overwrite\nthe type's \"module\" attribute if it is set via \"Pytpmembers\"\nor \"Pytpgetset\".\n\n- bpo-39583(29): Remove superfluous \"extern C\" declarations from\n'Include/cpython/*.h'.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=41936\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=41692\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=41842\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=41834\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=41689\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=41524\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=41324\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=30155\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=40170\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=41123\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=41123\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=41123\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=41123\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=41103\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=36346\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=36346\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=40989\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=36020\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=40943\n\n(20) https://peps.python.org/pep-0353/\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=40910\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=40724\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=40679\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=40839\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=40826\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=40792\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=39573\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=40703\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=39583\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 9 0 beta 1,  Next: Python 3 9 0 alpha 6,  Prev: Python 3 10 0 alpha 1,  Up: Changelog": {
            "content": "'Release date: 2020-05-19'\n\n* Menu:\n\n* Security: Security<22>.\n* Core and Builtins: Core and Builtins<35>.\n* Library: Library<35>.\n* Documentation: Documentation<35>.\n* Tests: Tests<33>.\n* Build: Build<33>.\n* Windows: Windows<32>.\n* macOS: macOS<27>.\n* Tools/Demos: Tools/Demos<17>.\n* C API: C API<31>.\n\nFile: python3.12.info,  Node: Security<22>,  Next: Core and Builtins<35>,  Up: Python 3 9 0 beta 1\n\n1.22.35.1 Security\n..................\n\n- bpo-40501(1): *note uuid: 10b. no longer uses *note ctypes: 28. to\nload 'libuuid' or 'rpcrt4.dll' at runtime.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40501\n\nFile: python3.12.info,  Node: Core and Builtins<35>,  Next: Library<35>,  Prev: Security<22>,  Up: Python 3 9 0 beta 1\n\n1.22.35.2 Core and Builtins\n...........................\n\n- bpo-40663(1): Correctly generate annotations where parentheses are\nomitted but required (e.g: 'Type[(str, int, *other))]'.\n\n- bpo-40596(2): Fixed *note str.isidentifier(): 16c4. for\nnon-canonicalized strings containing non-BMP characters on Windows.\n\n- bpo-40593(3): Improved syntax errors for invalid characters in\nsource code.\n\n- bpo-40585(4): Fixed a bug when using *note\ncodeop.compilecommand(): 1522. that was causing exceptions to be\nswallowed with the new parser.  Patch by Pablo Galindo\n\n- bpo-40566(5): Apply PEP 573(6) to *note abc: 4.\n\n- bpo-40502(7): Initialize 'n->ncoloffset'.  (Patch by Joannah\nNanjekye)\n\n- bpo-40527(8): Fix command line argument parsing: no longer write\nerrors multiple times into stderr.\n\n- bpo-1635741(9): Port *note errno: 52. to multiphase initialization\n( PEP 489(10)).\n\n- bpo-40523(11): Add pass-throughs for *note hash(): 3b1. and *note\nreversed(): 661. to *note weakref.proxy: 87e. objects.  Patch by\nPablo Galindo.\n\n- bpo-1635741(12): Port *note syslog: d6. to multiphase\ninitialization ( PEP 489(13)).\n\n- bpo-40246(14): Reporting a specialised error message for invalid\nstring prefixes, which was introduced in bpo-40246(15), is being\nreverted due to backwards compatibility concerns for strings that\nimmediately follow a reserved keyword without whitespace between\nthem.  Constructs like 'bg=\"#d00\" if clear else\"#fca\"' were failing\nto parse, which is not an acceptable breakage on such short notice.\n\n- bpo-40417(16): Fix imp module deprecation warning when\nPyImportReloadModule is called.  Patch by Robert Rouhani.\n\n- bpo-40408(17): Fixed support of nested type variables in\nGenericAlias (e.g.  'list[list[T]]').\n\n- bpo-1635741(18): Port stat module to multiphase initialization (\nPEP 489(19)).\n\n- bpo-29587(20): Enable implicit exception chaining when calling\n*note generator.throw(): 241.\n\n- bpo-40328(21): Add tools for generating mappings headers for\nCJKCodecs.\n\n- bpo-40228(22): Setting frame.flineno is now robust w.r.t.  changes\nin the source-to-bytecode compiler\n\n- bpo-38880(23): Added the ability to list interpreters associated\nwith channel ends in the internal subinterpreters module.\n\n- bpo-37986(24): Improve performance of *note PyLongFromDouble():\n760. for values that fit into long.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40663\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=40596\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=40593\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=40585\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=40566\n\n(6) https://peps.python.org/pep-0573/\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=40502\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=40527\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(10) https://peps.python.org/pep-0489/\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=40523\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(13) https://peps.python.org/pep-0489/\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=40246\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=40246\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=40417\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=40408\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(19) https://peps.python.org/pep-0489/\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=29587\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=40328\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=40228\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=38880\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=37986\n\nFile: python3.12.info,  Node: Library<35>,  Next: Documentation<35>,  Prev: Core and Builtins<35>,  Up: Python 3 9 0 beta 1\n\n1.22.35.3 Library\n.................\n\n- bpo-40662(1): Fixed *note ast.getsourcesegment(): 7fc. for ast\nnodes that have incomplete location information.  Patch by Irit\nKatriel.\n\n- bpo-40665(2): Convert *note bisect: f. to use Argument Clinic.\n\n- bpo-40536(3): Added the *note availabletimezones(): 16c6. function\nto the *note zoneinfo: 12e. module.  Patch by Paul Ganssle.\n\n- bpo-40645(4): The 'hmac.HMAC' exposes internal implementation\ndetails.  The attributes 'digestcons', 'inner', and 'outer' are\ndeprecated and will be removed in the future.\n\n- bpo-40645(5): The internal module 'hashlib' wraps and exposes\nOpenSSL's HMAC API. The new code will be used in Python 3.10 after\nthe internal implementation details of the pure Python HMAC module\nare no longer part of the public API.\n\n- bpo-40637(6): Builtin hash modules can now be disabled or\nselectively enabled with 'configure\n--with-builtin-hashlib-hashes=sha3,blake1' or\n'--without-builtin-hashlib-hashes'.\n\n- bpo-37630(7): The *note hashlib: 63. module can now use SHA3 hashes\nand SHAKE XOF from OpenSSL when available.\n\n- bpo-40479(8): The *note hashlib: 63. now compiles with OpenSSL\n3.0.0-alpha2.\n\n- bpo-40257(9): Revert changes to *note inspect.getdoc(): 821.\n\n- bpo-40607(10): When cancelling a task due to timeout, *note\nasyncio.waitfor(): 3c8. will now propagate the exception if an\nerror happens during cancellation.  Patch by Roman Skurikhin.\n\n- bpo-40612(11): Fix edge cases in SyntaxError formatting.  If the\noffset is <= 0, no caret is printed.  If the offset is > line\nlength, the caret is printed pointing just after the last\ncharacter.\n\n- bpo-40597(12): If text content lines are longer than\npolicy.maxlinelength, always use a content-encoding to make sure\nthey are wrapped.\n\n- bpo-40571(13): Added functools.cache() as a simpler, more\ndiscoverable way to access the unbounded cache variant of\nlrucache(maxsize=None).\n\n- bpo-40503(14): PEP 615(15), the *note zoneinfo: 12e. module.  Adds\nsupport for the IANA time zone database.\n\n- bpo-40397(16): Removed attributes 'args' and 'parameters'\nfrom special generic aliases like 'typing.List' (not subscripted).\n\n- bpo-40549(17): Convert posixmodule.c (\"posix\" or \"nt\" module) to\nthe multiphase initialization (PEP 489).\n\n- bpo-31033(18): Add a 'msg' argument to 'Future.cancel()' and\n'Task.cancel()'.\n\n- bpo-40541(19): Added an optional 'counts' parameter to\nrandom.sample().\n\n- bpo-40515(20): The *note ssl: ca. and *note hashlib: 63. modules\nnow actively check that OpenSSL is build with thread support.\nPython 3.7.0 made thread support mandatory and no longer works\nsafely with a no-thread builds.\n\n- bpo-31033(21): When a *note asyncio.Task: 201. is cancelled, the\nexception traceback now chains all the way back to where the task\nwas first interrupted.\n\n- bpo-40504(22): *note functools.lrucache(): 815. objects can now be\nthe targets of weakrefs.\n\n- bpo-40559(23): Fix possible memory leak in the C implementation of\n*note asyncio.Task: 201.\n\n- bpo-40480(24): 'fnmatch.fnmatch()' could take exponential time in\nthe presence of multiple '*' pattern characters.  This was repaired\nby generating more elaborate regular expressions to avoid futile\nbacktracking.\n\n- bpo-40495(25): *note compileall: 1e. is now able to use hardlinks\nto prevent duplicates in a case when '.pyc' files for different\noptimization levels have the same content.\n\n- bpo-40457(26): The ssl module now support OpenSSL builds without\nTLS 1.0 and 1.1 methods.\n\n- bpo-40355(27): Improve error reporting in *note ast.literaleval():\na5e. in the presence of malformed *note ast.Dict: 16c7. nodes\ninstead of silently ignoring any non-conforming elements.  Patch by\nCurtis Bucher.\n\n- bpo-40465(28): Deprecated the optional 'random' argument to\n'random.shuffle()'.\n\n- bpo-40459(29): *note platform.win32ver(): 16c8. now produces\ncorrect 'ptype' strings instead of empty strings.\n\n- bpo-39435(30): The first argument of *note pickle.loads(): b63. is\nnow positional-only.\n\n- bpo-39305(31): Update *note nntplib: 98. to merge *note\nnntplib.NNTP: 733. and 'nntplib.NNTPBase'.  Patch by Donghee Na.\n\n- bpo-32494(32): Update *note dbm.gnu: 31. to use gdbmcount if\npossible when calling *note len(): 3fb.  Patch by Donghee Na.\n\n- bpo-40453(33): Add 'isolated=True' keyword-only parameter to\n'xxsubinterpreters.create()'.  An isolated subinterpreter cannot\nspawn threads, spawn a child process or call 'os.fork()'.\n\n- bpo-40286(34): Remove 'random.Random.randbytes()': the C\nimplementation of 'randbytes()'.  Implement the method in Python to\nease subclassing: 'randbytes()' now directly reuses\n'getrandbits()'.\n\n- bpo-40394(35): Added default arguments to *note\ndifflib.SequenceMatcher.findlongestmatch(): 16c9.\n\n- bpo-39995(36): Fix a race condition in\nconcurrent.futures.ThreadWakeup: access to ThreadWakeup is now\nprotected with the shutdown lock.\n\n- bpo-30966(37): 'Process.shutdown(wait=True)' of *note\nconcurrent.futures: 1f. now closes explicitly the result queue.\n\n- bpo-30966(38): Add a new *note close(): 731. method to the *note\nSimpleQueue: 730. class to explicitly close the queue.\n\n- bpo-39966(39): Revert bpo-25597(40).  *note\nunittest.mock.MagicMock: cf4. with wraps' set uses default return\nvalues for magic methods.\n\n- bpo-39791(41): Added 'files()' function to importlib.resources with\nsupport for subdirectories in package data, matching backport in\nimportlibresources 1.5.\n\n- bpo-40375(42): *note imaplib.IMAP4.unselect(): 722. is added.\nPatch by Donghee Na.\n\n- bpo-40389(43): 'repr()' now returns 'typing.Optional[T]' when\ncalled for 'typing.Union' of two types, one of which is 'NoneType'.\n\n- bpo-40291(44): Add support for CANJ1939 sockets (available on\nLinux 5.4+)\n\n- bpo-40273(45): *note types.MappingProxyType: 186. is now\nreversible.\n\n- bpo-39075(46): The repr for *note types.SimpleNamespace: 745. is\nnow insertion ordered rather than alphabetical.\n\n- bpo-40192(47): On AIX, *note threadtime(): 754. is now implemented\nwith 'threadcputime()' which has nanosecond resolution, rather\nthan 'clockgettime(CLOCKTHREADCPUTIMEID)' which has a\nresolution of 10 milliseconds.  Patch by Batuhan Taskaya.\n\n- bpo-40025(48): Raise TypeError when generatenextvalue is\ndefined after members.  Patch by Ethan Onstott.\n\n- bpo-39058(49): In the argparse module, the repr for Namespace() and\nother argument holders now displayed in the order attributes were\nadded.  Formerly, it displayed in alphabetical order even though\nargument order is preserved the user visible parts of the module.\n\n- bpo-24416(50): The 'isocalendar()' methods of *note datetime.date:\n70f. and *note datetime.datetime: 222. now return a *note named\ntuple: 417. instead of a *note tuple: 4b8.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40662\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=40665\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=40536\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=40645\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=40645\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=40637\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=37630\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=40479\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=40257\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=40607\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=40612\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=40597\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=40571\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=40503\n\n(15) https://peps.python.org/pep-0615/\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=40397\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=40549\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=31033\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=40541\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=40515\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=31033\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=40504\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=40559\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=40480\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=40495\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=40457\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=40355\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=40465\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=40459\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=39435\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=39305\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=32494\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=40453\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=40286\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=40394\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=39995\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=30966\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=30966\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=39966\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=25597\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=39791\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=40375\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=40389\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=40291\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=40273\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=39075\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=40192\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=40025\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=39058\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=24416\n\nFile: python3.12.info,  Node: Documentation<35>,  Next: Tests<33>,  Prev: Library<35>,  Up: Python 3 9 0 beta 1\n\n1.22.35.4 Documentation\n.......................\n\n- bpo-34790(1): Add version of removal for explicit passing of coros\nto 'asyncio.wait()''s documentation\n\n- bpo-40561(2): Provide docstrings for webbrowser open functions.\n\n- bpo-40499(3): Mention that *note asyncio.wait(): 19a. requires a\nnon-empty set of awaitables.\n\n- bpo-39705(4): Tutorial example for sorted() in the Loop Techniques\nsection is given a better explanation.  Also a new example is\nincluded to explain sorted()'s basic behavior.\n\n- bpo-39435(5): Fix an incorrect signature for *note pickle.loads():\nb63. in the docs\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=34790\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=40561\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=40499\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=39705\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=39435\n\nFile: python3.12.info,  Node: Tests<33>,  Next: Build<33>,  Prev: Documentation<35>,  Up: Python 3 9 0 beta 1\n\n1.22.35.5 Tests\n...............\n\n- bpo-40055(1): distutils.tests now saves/restores warnings filters\nto leave them unchanged.  Importing tests imports docutils which\nimports pkgresources which adds a warnings filter.\n\n- bpo-40436(2): testgdb and test.pythoninfo now check gdb command\nexit code.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40055\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=40436\n\nFile: python3.12.info,  Node: Build<33>,  Next: Windows<32>,  Prev: Tests<33>,  Up: Python 3 9 0 beta 1\n\n1.22.35.6 Build\n...............\n\n- bpo-40653(1): Move dirnameW out of HAVESYMLINK to fix a potential\ncompiling issue.\n\n- bpo-40514(2): Add '--with-experimental-isolated-subinterpreters'\nbuild option to 'configure': better isolate subinterpreters,\nexperimental build mode.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40653\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=40514\n\nFile: python3.12.info,  Node: Windows<32>,  Next: macOS<27>,  Prev: Build<33>,  Up: Python 3 9 0 beta 1\n\n1.22.35.7 Windows\n.................\n\n- bpo-40650(1): Include winsock2.h in pytime.c for timeval.\n\n- bpo-40458(2): Increase reserved stack space to prevent overflow\ncrash on Windows.\n\n- bpo-39148(3): Add IPv6 support to *note asyncio: 9. datagram\nendpoints in ProactorEventLoop.  Change the raised exception for\nunknown address families to ValueError as it's not coming from\nWindows API.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40650\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=40458\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=39148\n\nFile: python3.12.info,  Node: macOS<27>,  Next: Tools/Demos<17>,  Prev: Windows<32>,  Up: Python 3 9 0 beta 1\n\n1.22.35.8 macOS\n...............\n\n- bpo-34956(1): When building Python on macOS from source, 'tkinter'\nnow links with non-system Tcl and Tk frameworks if they are\ninstalled in '/Library/Frameworks', as had been the case on older\nreleases of macOS. If a macOS SDK is explicitly configured, by\nusing '--enable-universalsdk=' or '-isysroot', only the SDK itself\nis searched.  The default behavior can still be overridden with\n'--with-tcltk-includes' and '--with-tcltk-libs'.\n\n- bpo-35569(2): Expose RFC 3542 IPv6 socket options.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=34956\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=35569\n\nFile: python3.12.info,  Node: Tools/Demos<17>,  Next: C API<31>,  Prev: macOS<27>,  Up: Python 3 9 0 beta 1\n\n1.22.35.9 Tools/Demos\n.....................\n\n- bpo-40479(1): Update multissltest helper to test with latest\nOpenSSL 1.0.2, 1.1.0, 1.1.1, and 3.0.0-alpha.\n\n- bpo-40431(2): Fix a syntax typo in 'turtledemo' that now raises a\n'SyntaxError'.\n\n- bpo-40163(3): Fix multissltest tool.  OpenSSL has changed download\nURL for old releases.  The multissltest tool now tries to download\nfrom current and old download URLs.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40479\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=40431\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=40163\n\nFile: python3.12.info,  Node: C API<31>,  Prev: Tools/Demos<17>,  Up: Python 3 9 0 beta 1\n\n1.22.35.10 C API\n................\n\n- bpo-39465(1): Remove the 'PyUnicodeClearStaticStrings()' function\nfrom the C API.\n\n- bpo-38787(2): Add PyCFunctionCheckExact() macro for exact type\nchecks now that we allow subtypes of PyCFunction, as well as\nPyCMethodCheckExact() and PyCMethodCheck() for the new PyCMethod\nsubtype.\n\n- bpo-40545(3): Declare 'PyErrGetTopmostException()' with\n'PyAPIFUNC()' to properly export the function in the C API. The\nfunction remains private ('Py') prefix.\n\n- bpo-40412(4): Nullify inittabcopy during finalization, preventing\nfuture interpreter initializations in an embedded situation from\ncrashing.  Patch by Gregory Szorc.\n\n- bpo-40429(5): The *note PyThreadStateGetFrame(): 57b. function now\nreturns a strong reference to the frame.\n\n- bpo-40428(6): Remove the following functions from the C API. Call\n*note PyGCCollect(): 7b2. explicitly to free all free lists.\n\n* 'PyAsyncGenClearFreeLists()'\n\n* 'PyContextClearFreeList()'\n\n* 'PyDictClearFreeList()'\n\n* 'PyFloatClearFreeList()'\n\n* 'PyFrameClearFreeList()'\n\n* 'PyListClearFreeList()'\n\n* 'PySetClearFreeList()'\n\n* 'PyTupleClearFreeList()'\n\n- bpo-40421(7): New *note PyFrameGetBack(): 571. function: get the\nframe next outer frame.\n\n- bpo-40421(8): New *note PyFrameGetCode(): 576. function: return a\nborrowed reference to the frame code.\n\n- bpo-40217(9): Ensure that instances of types created with *note\nPyTypeFromSpecWithBases(): 2e0. will visit its class object when\ntraversing references in the garbage collector (implemented as an\nextension of the provided *note tptraverse: 569.).  Patch by Pablo\nGalindo.\n\n- bpo-38787(10): Module C state is now accessible from C-defined heap\ntype methods ( PEP 573(11)).  Patch by Marcel Plch and Petr\nViktorin.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39465\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=38787\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=40545\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=40412\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=40429\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=40428\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=40421\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=40421\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=40217\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=38787\n\n(11) https://peps.python.org/pep-0573/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 9 0 alpha 6,  Next: Python 3 9 0 alpha 5,  Prev: Python 3 9 0 beta 1,  Up: Changelog": {
            "content": "'Release date: 2020-04-27'\n\n* Menu:\n\n* Security: Security<23>.\n* Core and Builtins: Core and Builtins<36>.\n* Library: Library<36>.\n* Documentation: Documentation<36>.\n* Tests: Tests<34>.\n* Build: Build<34>.\n* Windows: Windows<33>.\n* macOS: macOS<28>.\n* IDLE: IDLE<20>.\n* Tools/Demos: Tools/Demos<18>.\n* C API: C API<32>.\n\nFile: python3.12.info,  Node: Security<23>,  Next: Core and Builtins<36>,  Up: Python 3 9 0 alpha 6\n\n1.22.36.1 Security\n..................\n\n- bpo-40121(1): Fixes audit events raised on creating a new socket.\n\n- bpo-39073(2): Disallow CR or LF in email.headerregistry.Address\narguments to guard against header injection attacks.\n\n- bpo-39503(3): CVE-2020-8492: The *note AbstractBasicAuthHandler:\n161e. class of the *note urllib.request: 106. module uses an\ninefficient regular expression which can be exploited by an\nattacker to cause a denial of service.  Fix the regex to prevent\nthe catastrophic backtracking.  Vulnerability reported by Ben\nCaller and Matt Schwager.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40121\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=39073\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=39503\n\nFile: python3.12.info,  Node: Core and Builtins<36>,  Next: Library<36>,  Prev: Security<23>,  Up: Python 3 9 0 alpha 6\n\n1.22.36.2 Core and Builtins\n...........................\n\n- bpo-40313(1): Improve the performance of bytes.hex().\n\n- bpo-40334(2): Switch to a new parser, based on PEG. For more\ndetails see PEP 617.  To temporarily switch back to the old parser,\nuse '-X oldparser' or 'PYTHONOLDPARSER=1'.  In Python 3.10 we will\nremove the old parser completely, including the 'parser' module\n(already deprecated) and anything that depends on it.\n\n- bpo-40267(3): Fix the tokenizer to display the correct error\nmessage, when there is a 'SyntaxError' on the last input character\nand no newline follows.  It used to be 'unexpected EOF while\nparsing', while it should be 'invalid syntax'.\n\n- bpo-39522(4): Correctly unparse explicit 'u' prefix for strings\nwhen postponed evaluation for annotations activated.  Patch by\nBatuhan Taskaya.\n\n- bpo-40246(5): Report a specialized error message, 'invalid string\nprefix', when the tokenizer encounters a string with an invalid\nprefix.\n\n- bpo-40082(6): Fix the signal handler: it now always uses the main\ninterpreter, rather than trying to get the current Python thread\nstate.\n\n- bpo-37388(7): str.encode() and str.decode() no longer check the\nencoding and errors in development mode or in debug mode during\nPython finalization.  The codecs machinery can no longer work on\nvery late calls to str.encode() and str.decode().\n\n- bpo-40077(8): Fix possible refleaks in 'json', memo of\nPyScannerObject should be traversed.\n\n- bpo-37207(9): Speed up calls to 'dict()' by using the PEP 590(10)\n'vectorcall' calling convention.\n\n- bpo-40141(11): Add column and line information to 'ast.keyword'\nnodes.  Patch by Pablo Galindo.\n\n- bpo-1635741(12): Port *note resource: b7. to multiphase\ninitialization ( PEP 489(13)).\n\n- bpo-1635741(14): Port *note math: 89. to multiphase initialization\n( PEP 489(15)).\n\n- bpo-1635741(16): Port uuid module to multiphase initialization (\nPEP 489(17)).\n\n- bpo-40077(18): Convert json module to use *note PyTypeFromSpec():\n2df.\n\n- bpo-40067(19): Improve the error message for multiple star\nexpressions in an assignment.  Patch by Furkan Onder\n\n- bpo-1635741(20): Port functools module to multiphase\ninitialization (PEP 489).  Patch by Paulo Henrique Silva.\n\n- bpo-1635741(21): Port operator module to multiphase initialization\n(PEP 489).  Patch by Paulo Henrique Silva.\n\n- bpo-20526(22): Fix *note PyThreadStateClear(): 16d4.\n'PyThreadState.frame' is a borrowed reference, not a strong\nreference: 'PyThreadStateClear()' must not call\n'PyCLEAR(tstate->frame)'.\n\n- bpo-1635741(23): Port time module to multiphase initialization (\nPEP 489(24)).  Patch by Paulo Henrique Silva.\n\n- bpo-1635741(25): Port weakref extension module to multiphase\ninitialization ( PEP 489(26)).\n\n- bpo-40020(27): Fix a leak and subsequent crash in parsetok.c caused\nby realloc misuse on a rare codepath.\n\n- bpo-39939(28): Added str.removeprefix and str.removesuffix methods\nand corresponding bytes, bytearray, and collections.UserString\nmethods to remove affixes from a string if present.  See PEP\n616(29) for a full description.  Patch by Dennis Sweeney.\n\n- bpo-39481(30): Implement PEP 585.  This supports list[int],\ntuple[str, ...] etc.\n\n- bpo-32894(31): Support unparsing of infinity numbers in postponed\nannotations.  Patch by Batuhan Ta??kaya.\n\n- bpo-37207(32): Speed up calls to 'list()' by using the PEP 590(33)\n'vectorcall' calling convention.  Patch by Mark Shannon.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40313\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=40334\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=40267\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=39522\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=40246\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=40082\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=37388\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=40077\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=37207\n\n(10) https://peps.python.org/pep-0590/\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=40141\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(13) https://peps.python.org/pep-0489/\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(15) https://peps.python.org/pep-0489/\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(17) https://peps.python.org/pep-0489/\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=40077\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=40067\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=20526\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(24) https://peps.python.org/pep-0489/\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(26) https://peps.python.org/pep-0489/\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=40020\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=39939\n\n(29) https://peps.python.org/pep-0616/\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=39481\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=32894\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=37207\n\n(33) https://peps.python.org/pep-0590/\n\nFile: python3.12.info,  Node: Library<36>,  Next: Documentation<36>,  Prev: Core and Builtins<36>,  Up: Python 3 9 0 alpha 6\n\n1.22.36.3 Library\n.................\n\n- bpo-40398(1): *note typing.getargs(): 68a. now always returns an\nempty tuple for special generic aliases.\n\n- bpo-40396(2): Functions *note typing.getorigin(): 873, *note\ntyping.getargs(): 68a. and *note typing.gettypehints(): 47f.\nsupport now generic aliases like 'list[int]'.\n\n- bpo-38061(3): Optimize the *note subprocess: d0. module on FreeBSD\nusing 'closefrom()'.  A single 'close(fd)' syscall is cheap, but\nwhen 'sysconf(SCOPENMAX)' is high, the loop calling 'close(fd)'\non each file descriptor can take several milliseconds.\n\nThe workaround on FreeBSD to improve performance was to load and\nmount the fdescfs kernel module, but this is not enabled by\ndefault.\n\nInitial patch by Ed Maste (emaste), Conrad Meyer (cem), Kyle Evans\n(kevans) and Kubilay Kocak (koobs):\n'https://bugs.freebsd.org/bugzilla/showbug.cgi?id=242274'\n\n- bpo-38061(4): On FreeBSD, 'os.closerange(fdlow, fdhigh)' now\ncalls 'closefrom(fdlow)' if 'fdhigh' is greater than or equal to\n'sysconf(SCOPENMAX)'.\n\nInitial patch by Ed Maste (emaste), Conrad Meyer (cem), Kyle Evans\n(kevans) and Kubilay Kocak (koobs):\n'https://bugs.freebsd.org/bugzilla/showbug.cgi?id=242274'\n\n- bpo-40360(5): The *note lib2to3: 7f. module is pending deprecation\ndue to PEP 617(6).\n\n- bpo-40138(7): Fix the Windows implementation of *note os.waitpid():\nbf6. for exit code larger than 'INTMAX >> 8'.  The exit status is\nnow interpreted as an unsigned number.\n\n- bpo-39942(8): Set \"main\" as the default module name when\n\"name\" is missing in *note typing.TypeVar: 164.  Patch by\nWeipeng Hong.\n\n- bpo-40275(9): The *note logging: 82. package is now imported lazily\nin *note unittest: 101. only when the *note assertLogs(): 64f.\nassertion is used.\n\n- bpo-40275(10): The *note asyncio: 9. package is now imported lazily\nin *note unittest: 101. only when the *note\nIsolatedAsyncioTestCase: 48b. class is used.\n\n- bpo-40330(11): In 'ShareableList.setitem()', check the size of\na new string item after encoding it to utf-8, not before.\n\n- bpo-40148(12): Added 'pathlib.Path.withstem()' to create a new\nPath with the stem replaced.\n\n- bpo-40325(13): Deprecated support for set objects in\nrandom.sample().\n\n- bpo-40257(14): Improved help for the *note typing: ff. module.\nDocstrings are now shown for all special forms and special generic\naliases (like 'Union' and 'List').  Using 'help()' with generic\nalias like 'List[int]' will show the help for the correspondent\nconcrete type ('list' in this case).\n\n- bpo-40257(15): *note inspect.getdoc(): 821. no longer returns\ndocstring inherited from the type of the object or from parent\nclass if it is a class if it is not defined in the object itself.\nIn *note pydoc: b0. the documentation string is now shown not only\nfor class, function, method etc, but for any object that has its\nown 'doc' attribute.\n\n- bpo-40287(16): Fixed 'SpooledTemporaryFile.seek()' to return the\nposition.\n\n- bpo-40290(17): Added zscore() to statistics.NormalDist().\n\n- bpo-40282(18): Allow 'random.getrandbits(0)' to succeed and to\nreturn 0.\n\n- bpo-40286(19): Add *note random.randbytes(): 16d6. function and\n'random.Random.randbytes()' method to generate random bytes.\n\n- bpo-40277(20): *note collections.namedtuple(): 711. now provides a\nhuman-readable repr for its field accessors.\n\n- bpo-40270(21): The included copy of sqlite3 on Windows is now\ncompiled with the json extension.  This allows the use of functions\nsuch as 'jsonobject'.\n\n- bpo-29255(22): Wait in 'KqueueSelector.select' when no fds are\nregistered\n\n- bpo-40260(23): Ensure *note modulefinder: 8c. uses *note\nio.opencode(): 146a. and respects coding comments.\n\n- bpo-40234(24): Allow again to spawn daemon threads in\nsubinterpreters (revert change which denied them).\n\n- bpo-39207(25): Workers in *note ProcessPoolExecutor: 707. are now\nspawned on demand, only when there are no available idle workers to\nreuse.  This optimizes startup overhead and reduces the amount of\nlost CPU time to idle workers.  Patch by Kyle Stanley.\n\n- bpo-40091(26): Fix a hang at fork in the logging module: the new\nprivate atforkreinit() method is now used to reinitialize locks\nat fork in the child process.\n\n- bpo-40149(27): Implement traverse and clear slots in abc.abcdata\ntype.\n\n- bpo-40208(28): Remove deprecated 'symtable.SymbolTable.hasexec()'.\n\n- bpo-40196(29): Fix a bug in the *note symtable: d2. module that was\ncausing incorrectly report global variables as local.  Patch by\nPablo Galindo.\n\n- bpo-40190(30): Add support for 'SCAIXREALMEM' to\n'posix.sysconf()'.\n\n- bpo-40182(31): Removed the 'fieldtypes' attribute of the *note\ntyping.NamedTuple: 1f9. class.\n\n- bpo-36517(32): Multiple inheritance with *note typing.NamedTuple:\n1f9. now raises an error instead of silently ignoring other types.\n\n- bpo-40126(33): Fixed reverting multiple patches in unittest.mock.\nPatcher's 'exit()' is now never called if its 'enter()' is\nfailed.  Returning true from 'exit()' silences now the\nexception.\n\n- bpo-40094(34): CGIHTTPRequestHandler of http.server now logs the\nCGI script exit code, rather than the CGI script exit status of\nos.waitpid().  For example, if the script is killed by signal 11,\nit now logs: \"CGI script exit code -11.\"\n\n- bpo-40108(35): Improve the error message when triying to import a\nmodule using *note runpy: b9. and incorrently use the \".py\"\nextension at the end of the module name.  Patch by Pablo Galindo.\n\n- bpo-40094(36): Add *note os.waitstatustoexitcode(): 73b.\nfunction: convert a wait status to an exit code.\n\n- bpo-40089(37): Fix threading.afterfork(): if fork was not called\nby a thread spawned by threading.Thread, threading.afterfork()\nnow creates a MainThread instance for mainthread, instead of a\nDummyThread instance.\n\n- bpo-40089(38): Add a private 'atforkreinit()' method to\n'thread.Lock', 'thread.RLock', *note threading.RLock: 10cc. and\n*note threading.Condition: fca. classes: reinitialize the lock at\nfork in the child process, reset the lock to the unlocked state.\nRename also the private 'resetinternallocks()' method of *note\nthreading.Event: fcd. to 'atforkreinit()'.\n\n- bpo-25780(39): Expose *note CANRAWJOINFILTERS: 74f. in the *note\nsocket: c6. module.\n\n- bpo-39503(40): *note AbstractBasicAuthHandler: 161e. of *note\nurllib.request: 106. now parses all WWW-Authenticate HTTP headers\nand accepts multiple challenges per header: use the realm of the\nfirst Basic challenge.\n\n- bpo-39812(41): Removed daemon threads from *note\nconcurrent.futures: 1f. by adding an internal\n'threading.registeratexit()', which calls registered functions\nprior to joining all non-daemon threads.  This allows for\ncompatibility with subinterpreters, which don't support daemon\nthreads.\n\n- bpo-40050(42): Fix 'importlib.bootstrapexternal': avoid creating\na new 'winreg' builtin module if it's already available in *note\nsys.modules: 16d7, and remove redundant imports.\n\n- bpo-40014(43): Fix 'os.getgrouplist()': if 'getgrouplist()'\nfunction fails because the group list is too small, retry with a\nlarger group list.  On failure, the glibc implementation of\n'getgrouplist()' sets 'ngroups' to the total number of groups.  For\nother implementations, double the group list size.\n\n- bpo-40017(44): Add *note time.CLOCKTAI: 16d8. constant if the\noperating system support it.\n\n- bpo-40016(45): In re docstring, clarify the relationship between\ninline and argument compile flags.\n\n- bpo-39953(46): Update internal table of OpenSSL error codes in the\n'ssl' module.\n\n- bpo-36144(47): Added PEP 584(48) operators to *note\nweakref.WeakValueDictionary: 16d9.\n\n- bpo-36144(49): Added PEP 584(50) operators to *note\nweakref.WeakKeyDictionary: 16da.\n\n- bpo-38891(51): Fix linear runtime behaviour of the 'getitem'\nand 'setitem' methods in *note\nmultiprocessing.sharedmemory.ShareableList: 16db.  This avoids\nquadratic performance when iterating a 'ShareableList'.  Patch by\nThomas Krennwallner.\n\n- bpo-39682(52): Remove undocumented support for 'closing' a\n'pathlib.Path' object via its context manager.  The context manager\nmagic methods remain, but they are now a no-op, making 'Path'\nobjects immutable.\n\n- bpo-36144(53): Added PEP 584(54) operators ('|' and '|=') to *note\ncollections.ChainMap: a62.\n\n- bpo-39011(55): Normalization of line endings in ElementTree\nattributes was removed, as line endings which were replaced by\nentity numbers should be preserved in original form.\n\n- bpo-38410(56): Properly handle *note sys.audit(): 16dc. failures in\n*note sys.setasyncgenhooks(): 1596.\n\n- bpo-36541(57): lib2to3 now recognizes named assignment expressions\n(the walrus operator, ':=')\n\n- bpo-35967(58): In platform, delay the invocation of 'uname -p'\nuntil the processor attribute is requested.\n\n- bpo-35113(59): *note inspect.getsource(): 144e. now returns correct\nsource code for inner class with same name as module level class.\nDecorators are also returned as part of source of the class.  Patch\nby Karthikeyan Singaravelan.\n\n- bpo-33262(60): Deprecate passing None as an argument for *note\nshlex.split(): 292.'s 's' parameter.  Patch by Zackery Spytz.\n\n- bpo-31758(61): Prevent crashes when using an uninitialized\n'elementtree.XMLParser' object.  Patch by Oren Milman.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40398\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=40396\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=38061\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=38061\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=40360\n\n(6) https://peps.python.org/pep-0617/\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=40138\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=39942\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=40275\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=40275\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=40330\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=40148\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=40325\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=40257\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=40257\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=40287\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=40290\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=40282\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=40286\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=40277\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=40270\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=29255\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=40260\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=40234\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=39207\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=40091\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=40149\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=40208\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=40196\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=40190\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=40182\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=36517\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=40126\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=40094\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=40108\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=40094\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=40089\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=40089\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=25780\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=39503\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=39812\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=40050\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=40014\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=40017\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=40016\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=39953\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=36144\n\n(48) https://peps.python.org/pep-0584/\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=36144\n\n(50) https://peps.python.org/pep-0584/\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=38891\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=39682\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=36144\n\n(54) https://peps.python.org/pep-0584/\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=39011\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=38410\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=36541\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=35967\n\n(59) https://bugs.python.org/issue?@action=redirect&bpo=35113\n\n(60) https://bugs.python.org/issue?@action=redirect&bpo=33262\n\n(61) https://bugs.python.org/issue?@action=redirect&bpo=31758\n\nFile: python3.12.info,  Node: Documentation<36>,  Next: Tests<34>,  Prev: Library<36>,  Up: Python 3 9 0 alpha 6\n\n1.22.36.4 Documentation\n.......................\n\n- bpo-27635(1): The pickle documentation incorrectly claimed that\n'new' isn't called by default when unpickling.\n\n- bpo-39879(2): Updated *note Data model: 16de. docs to include *note\ndict(): 237. insertion order preservation.  Patch by Furkan Onder\nand Samy Lahfa.\n\n- bpo-38387(3): Document *note PyDocSTRVAR: 16df. macro in the C-API\nreference.\n\n- bpo-13743(4): Some methods within xml.dom.minidom.Element class are\nnow better documented.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27635\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=39879\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=38387\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=13743\n\nFile: python3.12.info,  Node: Tests<34>,  Next: Build<34>,  Prev: Documentation<36>,  Up: Python 3 9 0 alpha 6\n\n1.22.36.5 Tests\n...............\n\n- bpo-31904(1): Set expected default encoding in\ntestclocalecoercion.py for VxWorks RTOS.\n\n- bpo-40162(2): Update Travis CI configuration to OpenSSL 1.1.1f.\n\n- bpo-40146(3): Update OpenSSL to 1.1.1f in Azure Pipelines.\n\n- bpo-40094(4): Add *note test.support.waitprocess(): 16e1.\nfunction.\n\n- bpo-40003(5): 'test.bisectcmd' now copies Python command line\noptions like '-O' or '-W'.  Moreover, emit a warning if\n'test.bisectcmd' is used with '-w'/'--verbose2' option.\n\n- bpo-39380(6): Add the encoding in *note ftplib.FTP: 715. and *note\nftplib.FTPTLS: 716. to the constructor as keyword-only and change\nthe default from 'latin-1' to 'utf-8' to follow RFC 2640(7).\n\n- bpo-39793(8): Use the same domain when testing 'makemsgid'.  Patch\nby Batuhan Taskaya.\n\n- bpo-1812(9): Fix newline handling in doctest.testfile when loading\nfrom a package whose loader has a getdata method.  Patch by Peter\nDonis.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=40162\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=40146\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=40094\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=40003\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=39380\n\n(7) https://datatracker.ietf.org/doc/html/rfc2640.html\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=39793\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=1812\n\nFile: python3.12.info,  Node: Build<34>,  Next: Windows<33>,  Prev: Tests<34>,  Up: Python 3 9 0 alpha 6\n\n1.22.36.6 Build\n...............\n\n- bpo-38360(1): Support single-argument form of macOS -isysroot flag.\n\n- bpo-40158(2): Fix CPython MSBuild Properties in NuGet Package\n(build/native/python.props)\n\n- bpo-38527(3): Fix configure check on Solaris for \"float word\nordering\": sometimes, the correct \"grep\" command was not being\nused.  Patch by Arnon Yaari.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38360\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=40158\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=38527\n\nFile: python3.12.info,  Node: Windows<33>,  Next: macOS<28>,  Prev: Build<34>,  Up: Python 3 9 0 alpha 6\n\n1.22.36.7 Windows\n.................\n\n- bpo-40164(1): Updates Windows to OpenSSL 1.1.1f\n\n- bpo-8901(2): Ignore the Windows registry when the '-E' option is\nused.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40164\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=8901\n\nFile: python3.12.info,  Node: macOS<28>,  Next: IDLE<20>,  Prev: Windows<33>,  Up: Python 3 9 0 alpha 6\n\n1.22.36.8 macOS\n...............\n\n- bpo-38329(1): python.org macOS installers now update the Current\nversion symlink of /Library/Frameworks/Python.framework/Versions\nfor 3.9 installs.  Previously, Current was only updated for Python\n2.x installs.  This should make it easier to embed Python 3 into\nother macOS applications.\n\n- bpo-40164(2): Update macOS installer builds to use OpenSSL 1.1.1g.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38329\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=40164\n\nFile: python3.12.info,  Node: IDLE<20>,  Next: Tools/Demos<18>,  Prev: macOS<28>,  Up: Python 3 9 0 alpha 6\n\n1.22.36.9 IDLE\n..............\n\n- bpo-38439(1): Add a 256??256 pixel IDLE icon to support more modern\nenvironments.  Created by Andrew Clover.  Delete the unused macOS\nidle.icns icon file.\n\n- bpo-38689(2): IDLE will no longer freeze when inspect.signature\nfails when fetching a calltip.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38439\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=38689\n\nFile: python3.12.info,  Node: Tools/Demos<18>,  Next: C API<32>,  Prev: IDLE<20>,  Up: Python 3 9 0 alpha 6\n\n1.22.36.10 Tools/Demos\n......................\n\n- bpo-40385(1): Removed the checkpyc.py tool.  Please see compileall\nwithout force mode as a potential alternative.\n\n- bpo-40179(2): Fixed translation of '#elif' in Argument Clinic.\n\n- bpo-40094(3): Fix 'which.py' script exit code: it now uses *note\nos.waitstatustoexitcode(): 73b. to convert *note os.system():\n12b2. exit status into an exit code.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40385\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=40179\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=40094\n\nFile: python3.12.info,  Node: C API<32>,  Prev: Tools/Demos<18>,  Up: Python 3 9 0 alpha 6\n\n1.22.36.11 C API\n................\n\n- bpo-40241(1): Move the 'PyGCHead' structure to the internal C API.\n\n- bpo-40170(2): Convert *note PyObjectISGC(): 7a8. macro to a\nfunction to hide implementation details.\n\n- bpo-40241(3): Add the functions *note PyObjectGCIsTracked(): 79a.\nand *note PyObjectGCIsFinalized(): 79b. to the public API to\nallow to query if Python objects are being currently tracked or\nhave been already finalized by the garbage collector respectively.\nPatch by Pablo Galindo.\n\n- bpo-40170(4): The 'PyObjectNEW()' macro becomes an alias to the\n*note PyObjectNew(): 7a9. macro, and the 'PyObjectNEWVAR()'\nmacro becomes an alias to the *note PyObjectNewVar(): 7aa. macro,\nto hide implementation details.  They no longer access directly the\n*note PyTypeObject.tpbasicsize: 7ab. member.\n\n- bpo-40170(5): *note PyTypeHasFeature(): 16bd. now always calls\n*note PyTypeGetFlags(): 16be. to hide implementation details.\nPreviously, it accessed directly the *note PyTypeObject.tpflags:\n1620. member when the limited C API was not used.\n\n- bpo-40170(6): Convert the 'PyObjectGETWEAKREFSLISTPTR()' macro\nto a function to hide implementation details: the macro accessed\ndirectly to the *note PyTypeObject.tpweaklistoffset: 7ac. member.\n\n- bpo-40170(7): Convert *note PyObjectCheckBuffer(): 540. macro to a\nfunction to hide implementation details: the macro accessed\ndirectly the *note PyTypeObject.tpasbuffer: 7ad. member.\n\n- bpo-40170(8): Always declare *note PyIndexCheck(): 7ae. as an\nopaque function to hide implementation details: remove\n'PyIndexCheck()' macro.  The macro accessed directly the *note\nPyTypeObject.tpasnumber: 7af. member.\n\n- bpo-39947(9): Add *note PyThreadStateGetID(): 795. function: get\nthe unique identifier of a Python thread state.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40241\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=40170\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=40241\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=40170\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=40170\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=40170\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=40170\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=40170\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=39947\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 9 0 alpha 5,  Next: Python 3 9 0 alpha 4,  Prev: Python 3 9 0 alpha 6,  Up: Changelog": {
            "content": "'Release date: 2020-03-23'\n\n* Menu:\n\n* Security: Security<24>.\n* Core and Builtins: Core and Builtins<37>.\n* Library: Library<37>.\n* Documentation: Documentation<37>.\n* Tests: Tests<35>.\n* Build: Build<35>.\n* Windows: Windows<34>.\n* macOS: macOS<29>.\n* IDLE: IDLE<21>.\n* Tools/Demos: Tools/Demos<19>.\n* C API: C API<33>.\n\nFile: python3.12.info,  Node: Security<24>,  Next: Core and Builtins<37>,  Up: Python 3 9 0 alpha 5\n\n1.22.37.1 Security\n..................\n\n- bpo-38576(1): Disallow control characters in hostnames in\nhttp.client, addressing CVE-2019-18348.  Such potentially malicious\nheader injection URLs now cause a InvalidURL to be raised.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38576\n\nFile: python3.12.info,  Node: Core and Builtins<37>,  Next: Library<37>,  Prev: Security<24>,  Up: Python 3 9 0 alpha 5\n\n1.22.37.2 Core and Builtins\n...........................\n\n- bpo-40010(1): Optimize pending calls in multithreaded applications.\nIf a thread different than the main thread schedules a pending call\n(*note PyAddPendingCall(): 7a5.), the bytecode evaluation loop is\nno longer interrupted at each bytecode instruction to check for\npending calls which cannot be executed.  Only the main thread can\nexecute pending calls.\n\nPreviously, the bytecode evaluation loop was interrupted at each\ninstruction until the main thread executes pending calls.\n\n- bpo-1635741(2): Port weakref extension module to multiphase\ninitialization ( PEP 489(3)).\n\n- bpo-1635741(4): Port collections module to multiphase\ninitialization ( PEP 489(5)).\n\n- bpo-40010(6): Optimize signal handling in multithreaded\napplications.  If a thread different than the main thread gets a\nsignal, the bytecode evaluation loop is no longer interrupted at\neach bytecode instruction to check for pending signals which cannot\nbe handled.  Only the main thread of the main interpreter can\nhandle signals.\n\nPreviously, the bytecode evaluation loop was interrupted at each\ninstruction until the main thread handles signals.\n\n- bpo-39984(7): If *note PyAddPendingCall(): 7a5. is called in a\nsubinterpreter, the function is now scheduled to be called from the\nsubinterpreter, rather than being called from the main interpreter.\nEach subinterpreter now has its own list of scheduled calls.\n\n- bpo-1635741(8): Port heapq module to multiphase initialization.\n\n- bpo-1635741(9): Port itertools module to multiphase initialization\n( PEP 489(10)).\n\n- bpo-37207(11): Speed up calls to 'frozenset()' by using the PEP\n590(12) 'vectorcall' calling convention.  Patch by Donghee Na.\n\n- bpo-39984(13): subinterpreters: Move\n'PyRuntimeState.ceval.tracingpossible' to\n'PyInterpreterState.ceval.tracingpossible': each interpreter now\nhas its own variable.\n\n- bpo-37207(14): Speed up calls to 'set()' by using the PEP 590(15)\n'vectorcall' calling convention.  Patch by Donghee Na.\n\n- bpo-1635741(16): Port statistics module to multiphase\ninitialization ( PEP 489(17)).\n\n- bpo-39968(18): Use inline function to replace extension modules'\ngetmodulestate macros.\n\n- bpo-39965(19): Correctly raise 'SyntaxError' if 'await' is used\ninside non-async functions and 'PyCFALLOWTOPLEVELAWAIT' is set\n(like in the asyncio REPL). Patch by Pablo Galindo.\n\n- bpo-39562(20): Allow executing asynchronous comprehensions on the\ntop level when the 'PyCFALLOWTOPLEVELAWAIT' flag is given.\nPatch by Batuhan Taskaya.\n\n- bpo-37207(21): Speed up calls to 'tuple()' by using the PEP 590(22)\n'vectorcall' calling convention.  Patch by Donghee Na.\n\n- bpo-38373(23): Changed list overallocation strategy.  It no longer\noverallocates if the new size is closer to overallocated size than\nto the old size and adds padding.\n\n- bpo-39926(24): Update Unicode database to Unicode version 13.0.0.\n\n- bpo-19466(25): Clear the frames of daemon threads earlier during\nthe Python shutdown to call objects destructors.  So \"unclosed\nfile\" resource warnings are now emitted for daemon threads in a\nmore reliable way.\n\n- bpo-38894(26): Fix a bug that was causing incomplete results when\ncalling 'pathlib.Path.glob' in the presence of symlinks that point\nto files where the user does not have read access.  Patch by Pablo\nGalindo and Matt Wozniski.\n\n- bpo-39877(27): Fix *note PyEvalRestoreThread(): 8bd. random crash\nat exit with daemon threads.  It now accesses the 'PyRuntime'\nvariable directly instead of using 'tstate->interp->runtime', since\n'tstate' can be a dangling pointer after *note PyFinalize(): 11cd.\nhas been called.  Moreover, the daemon thread now exits before\ntrying to take the GIL.\n\n- bpo-39871(28): Fix a possible *note SystemError: 2d7. in\n'math.{atan2,copysign,remainder}()' when the first argument cannot\nbe converted to a *note float: 4b7.  Patch by Zackery Spytz.\n\n- bpo-39776(29): Fix race condition where threads created by\nPyGILStateEnsure() could get a duplicate id.\n\nThis affects consumers of tstate->id like the contextvar caching\nmachinery, which could return invalid cached objects under heavy\nthread load (observed in embedded scenarios).\n\n- bpo-39778(30): Fixed a crash due to incorrect handling of weak\nreferences in 'collections.OrderedDict' classes.  Patch by Pablo\nGalindo.\n\n- bpo-1635741(31): Port audioop extension module to multiphase\ninitialization ( PEP 489(32)).\n\n- bpo-39702(33): Relax *note decorator: 514. grammar restrictions to\nallow any valid expression ( PEP 614(34)).\n\n- bpo-38091(35): Tweak import deadlock detection code to not deadlock\nitself.\n\n- bpo-1635741(36): Port locale extension module to multiphase\ninitialization ( PEP 489(37)).\n\n- bpo-39087(38): Optimize *note PyUnicodeAsUTF8(): 9ff. and *note\nPyUnicodeAsUTF8AndSize(): 6a8. slightly when they need to create\ninternal UTF-8 cache.\n\n- bpo-39520(39): Fix unparsing of ext slices with no items\n('foo[:,]').  Patch by Batuhan Taskaya.\n\n- bpo-39220(40): Do not optimize annotations if 'from future\nimport annotations' is used.  Patch by Pablo Galindo.\n\n- bpo-35712(41): Using *note NotImplemented: 5c5. in a boolean\ncontext has been deprecated.  Patch contributed by Josh Rosenberg.\n\n- bpo-22490(42): Don't leak environment variable\n'PYVENVLAUNCHER' into the interpreter session on macOS.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40010\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(3) https://peps.python.org/pep-0489/\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(5) https://peps.python.org/pep-0489/\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=40010\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=39984\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(10) https://peps.python.org/pep-0489/\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=37207\n\n(12) https://peps.python.org/pep-0590/\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=39984\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=37207\n\n(15) https://peps.python.org/pep-0590/\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(17) https://peps.python.org/pep-0489/\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=39968\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=39965\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=39562\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=37207\n\n(22) https://peps.python.org/pep-0590/\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=38373\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=39926\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=19466\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=38894\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=39877\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=39871\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=39776\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=39778\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(32) https://peps.python.org/pep-0489/\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=39702\n\n(34) https://peps.python.org/pep-0614/\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=38091\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(37) https://peps.python.org/pep-0489/\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=39087\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=39520\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=39220\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=35712\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=22490\n\nFile: python3.12.info,  Node: Library<37>,  Next: Documentation<37>,  Prev: Core and Builtins<37>,  Up: Python 3 9 0 alpha 5\n\n1.22.37.3 Library\n.................\n\n- bpo-39830(1): Add *note zipfile.Path: 499. to 'all' in the\n*note zipfile: 12b. module.\n\n- bpo-40000(2): Improved error messages for validation of\n'ast.Constant' nodes.  Patch by Batuhan Taskaya.\n\n- bpo-39999(3): 'module' of the AST node classes is now set to\n\"ast\" instead of \"ast\".  Added docstrings for dummy AST node\nclasses and deprecated attributes.\n\n- bpo-39991(4): *note uuid.getnode(): 9eb. now skips IPv6 addresses\nwith the same string length than a MAC address (17 characters):\nonly use MAC addresses.\n\n- bpo-39988(5): Deprecated 'ast.AugLoad' and 'ast.AugStore' node\nclasses because they are no longer used.\n\n- bpo-39656(6): Ensure 'bin/python3.#' is always present in virtual\nenvironments on POSIX platforms - by Anthony Sottile.\n\n- bpo-39969(7): Deprecated 'ast.Param' node class because it's no\nlonger used.  Patch by Batuhan Taskaya.\n\n- bpo-39360(8): Ensure all workers exit when finalizing a\n'multiprocessing.Pool' implicitly via the module finalization\nhandlers of multiprocessing.  This fixes a deadlock situation that\ncan be experienced when the Pool is not properly finalized via the\ncontext manager or a call to 'multiprocessing.Pool.terminate'.\nPatch by Batuhan Taskaya and Pablo Galindo.\n\n- bpo-35370(9): sys.settrace(), sys.setprofile() and\nlsprof.Profiler.enable() now properly report *note PySysAudit():\n16ec. error if \"sys.setprofile\" or \"sys.settrace\" audit event is\ndenied.\n\n- bpo-39936(10): AIX: Fix aixsupport module when the subprocess is\nnot available, when building Python from scratch.  It now uses new\nprivate bootsubprocess module, rather than having two\nimplementations depending if subprocess is available or not.  So\naixsupport.aixplatform() result is now the same if subprocess is\navailable or not.\n\n- bpo-36144(11): *note collections.OrderedDict: 39f. now implements\n'|' and '|=' ( PEP 584(12)).\n\n- bpo-39652(13): The column name found in\n'sqlite3.Cursor.description' is now truncated on the first '[' only\nif the PARSECOLNAMES option is set.\n\n- bpo-39915(14): Ensure *note\nunittest.mock.AsyncMock.awaitargslist: 16ed. has call objects in\nthe order of awaited arguments instead of using *note\nunittest.mock.Mock.callargs: 16ee. which has the last value of the\ncall.  Patch by Karthikeyan Singaravelan.\n\n- bpo-36144(15): Updated *note os.environ: 102e. and *note\nos.environb: 108b. to support PEP 584(16)'s merge ('|') and update\n('|=') operators.\n\n- bpo-38662(17): The 'ensurepip' module now invokes 'pip' via the\n'runpy' module.  Hence it is no longer tightly coupled with the\ninternal API of the bundled 'pip' version, allowing easier updates\nto a newer 'pip' version both internally and for distributors.\n\n- bpo-38075(18): Fix the *note random.Random.seed(): 16ef. method\nwhen a *note bool: 17d. is passed as the seed.\n\n- bpo-39916(19): More reliable use of 'os.scandir()' in\n'Path.glob()'.  It no longer emits a ResourceWarning when\ninterrupted.\n\n- bpo-39850(20): *note multiprocessing: 8f. now supports abstract\nsocket addresses (if abstract sockets are supported in the running\nplatform).  When creating arbitrary addresses (like when\ndefault-constructing *note multiprocessing.connection.Listener:\n13ca. objects) abstract sockets are preferred to avoid the case\nwhen the temporary-file-generated address is too large for an\nAFUNIX socket address.  Patch by Pablo Galindo.\n\n- bpo-36287(21): *note ast.dump(): 6fd. no longer outputs optional\nfields and attributes with default values.  The default values for\noptional fields and attributes of AST nodes are now set as class\nattributes (e.g.  'Constant.kind' is set to 'None').\n\n- bpo-39889(22): Fixed *note ast.unparse(): 6fe. for extended slices\ncontaining a single element (e.g.  'a[i:j,]').  Remove redundant\ntuples when index with a tuple (e.g.  'a[i, j]').\n\n- bpo-39828(23): Fix *note json.tool: 7d. to catch *note\nBrokenPipeError: ed5.  Patch by Donghee Na.\n\n- bpo-13487(24): Avoid a possible '\"RuntimeError: dictionary changed\nsize during iteration\"' from *note inspect.getmodule(): 1541. when\nit tried to loop through *note sys.modules: 16d7.\n\n- bpo-39674(25): Revert \"bpo-37330(26): open() no longer accept 'U'\nin file mode\".  The \"U\" mode of open() is kept in Python 3.9 to\nease transition from Python 2.7, but will be removed in Python\n3.10.\n\n- bpo-28577(27): The hosts method on 32-bit prefix length\nIPv4Networks and 128-bit prefix IPv6Networks now returns a list\ncontaining the single Address instead of an empty list.\n\n- bpo-39826(28): Add getConnection method to logging HTTPHandler to\nenable custom connections.\n\n- bpo-39763(29): Reimplement 'distutils.spawn.spawn' function with\nthe *note subprocess: d0. module.\n\n- bpo-39794(30): Add -without-decimal-contextvar build option.  This\nenables a thread-local rather than a coroutine local context.\n\n- bpo-36144(31): *note collections.defaultdict: 1031. now implements\n'|' ( PEP 584(32)).\n\n- bpo-39517(33): Fix runpy.runpath() when using pathlike objects\n\n- bpo-39775(34): Change 'inspect.Signature.parameters' back to\n'collections.OrderedDict'.  This was changed to 'dict' in Python\n3.9.0a4.\n\n- bpo-39678(35): Refactor queuemanager in *note\nconcurrent.futures.ProcessPoolExecutor: 707. to make it easier to\nmaintain.\n\n- bpo-39764(36): Fix AttributeError when calling getstack on a\nPyAsyncGenObject Task\n\n- bpo-39769(37): The *note compileall.compiledir(): 95f. function's\n'ddir' parameter and the compileall command line flag '-d' no\nlonger write the wrong pathname to the generated pyc file for\nsubmodules beneath the root of the directory tree being compiled.\nThis fixes a regression introduced with Python 3.5.\n\n- bpo-36144(38): *note types.MappingProxyType: 186. objects now\nsupport the merge ('|') operator from PEP 584(39).\n\n- bpo-38691(40): The *note importlib: 71. module now ignores the\n*note PYTHONCASEOK: 77d. environment variable when the *note -E:\n77e. or *note -I: 77f. command line options are being used.\n\n- bpo-39719(41): Remove 'tempfile.SpooledTemporaryFile.softspace()'\nas files no longer have the 'softspace' attribute in Python 3.\nPatch by Shantanu.\n\n- bpo-39667(42): Improve pathlib.Path compatibility on zipfile.Path\nand correct performance degradation as found in zipp 3.0.\n\n- bpo-39638(43): Keep ASDL signatures in the docstrings for 'AST'\nnodes.  Patch by Batuhan Taskaya\n\n- bpo-39639(44): Deprecated 'ast.Suite' node class because it's no\nlonger used.  Patch by Batuhan Taskaya.\n\n- bpo-39609(45): Add threadnameprefix to default asyncio executor\n\n- bpo-39548(46): Fix handling of header in *note\nurllib.request.AbstractDigestAuthHandler: 16f0. when the optional\n'qop' parameter is not present.\n\n- bpo-39509(47): HTTP status codes '103 EARLYHINTS' and '425\nTOOEARLY' are added to *note http.HTTPStatus: 71b.  Patch by\nDonghee Na.\n\n- bpo-39507(48): Adding HTTP status 418 \"I'm a Teapot\" to HTTPStatus\nin http library.  Patch by Ross Rhodes.\n\n- bpo-39495(49): Remove default value from 'attrs' parameter of *note\nxml.etree.ElementTree.TreeBuilder.start(): 16f1. for consistency\nbetween Python and C implementations.\n\n- bpo-38971(50): Open issue in the BPO indicated a desire to make the\nimplementation of codecs.open() at parity with io.open(), which\nimplements a try/except to assure file stream gets closed before an\nexception is raised.\n\n- bpo-38641(51): Added starred expressions support to 'return' and\n'yield' statements for 'lib2to3'.  Patch by Vlad Emelianov.\n\n- bpo-37534(52): When using minidom module to generate XML documents\nthe ability to add Standalone Document Declaration is added.  All\nthe changes are made to generate a document in compliance with\nExtensible Markup Language (XML) 1.0 (Fifth Edition) W3C\nRecommendation (available here:\n'https://www.w3.org/TR/xml/#sec-prolog-dtd').\n\n- bpo-34788(53): Add support for scoped IPv6 addresses to *note\nipaddress: 7a.  Patch by Oleksandr Pavliuk.\n\n- bpo-34822(54): Simplified AST for subscription.  Simple indices are\nnow represented by their value, extended slices are represented as\ntuples.  *note ast: 8. classes 'Index' and 'ExtSlice' are\nconsidered deprecated and will be removed in future Python\nversions.  In the meantime, 'Index(value)' now returns a 'value'\nitself, 'ExtSlice(slices)' returns 'Tuple(slices, Load())'.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39830\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=40000\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=39999\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=39991\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=39988\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=39656\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=39969\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=39360\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=35370\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=39936\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=36144\n\n(12) https://peps.python.org/pep-0584/\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=39652\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=39915\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=36144\n\n(16) https://peps.python.org/pep-0584/\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=38662\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=38075\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=39916\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=39850\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=36287\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=39889\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=39828\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=13487\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=39674\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=37330\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=28577\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=39826\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=39763\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=39794\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=36144\n\n(32) https://peps.python.org/pep-0584/\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=39517\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=39775\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=39678\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=39764\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=39769\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=36144\n\n(39) https://peps.python.org/pep-0584/\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=38691\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=39719\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=39667\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=39638\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=39639\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=39609\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=39548\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=39509\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=39507\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=39495\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=38971\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=38641\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=37534\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=34788\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=34822\n\nFile: python3.12.info,  Node: Documentation<37>,  Next: Tests<35>,  Prev: Library<37>,  Up: Python 3 9 0 alpha 5\n\n1.22.37.4 Documentation\n.......................\n\n- bpo-39868(1): Updated the Language Reference for PEP 572(2).\n\n- bpo-13790(3): Change 'string' to 'specification' in format doc.\n\n- bpo-17422(4): The language reference no longer restricts default\nclass namespaces to dicts only.\n\n- bpo-39530(5): Fix misleading documentation about mixed-type numeric\ncomparisons.\n\n- bpo-39718(6): Update *note token: f5. documentation to reflect\nadditions in Python 3.8\n\n- bpo-39677(7): Changed operand name of 'MAKEFUNCTION' from 'argc'\nto 'flags' for module *note dis: 35.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39868\n\n(2) https://peps.python.org/pep-0572/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=13790\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=17422\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=39530\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=39718\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=39677\n\nFile: python3.12.info,  Node: Tests<35>,  Next: Build<35>,  Prev: Documentation<37>,  Up: Python 3 9 0 alpha 5\n\n1.22.37.5 Tests\n...............\n\n- bpo-40019(1): testgdb now skips tests if it detects that gdb\nfailed to read debug information because the Python binary is\noptimized.\n\n- bpo-27807(2): 'testsite.teststartupimports()' is now skipped if\na path of *note sys.path: 32c. contains a '.pth' file.\n\n- bpo-26067(3): Do not fail testshutil testchown test when uid or\ngid of user cannot be resolved to a name.\n\n- bpo-39855(4): testsubprocess.testuser() now skips the test on an\nuser name if the user name doesn't exist.  For example, skip the\ntest if the user \"nobody\" doesn't exist on Linux.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40019\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=27807\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=26067\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=39855\n\nFile: python3.12.info,  Node: Build<35>,  Next: Windows<34>,  Prev: Tests<35>,  Up: Python 3 9 0 alpha 5\n\n1.22.37.6 Build\n...............\n\n- bpo-39761(1): Fix build with DTrace but without additional DFLAGS.\n\n- bpo-39763(2): setup.py now uses a basic implementation of the *note\nsubprocess: d0. module if the *note subprocess: d0. module is not\navailable: before required C extension modules are built.\n\n- bpo-1294959(3): Add '--with-platlibdir' option to the configure\nscript: name of the platform-specific library directory, stored in\nthe new *note sys.platlibdir: 756. attribute.  It is used to build\nthe path of platform-specific extension modules and the path of the\nstandard library.  It is equal to '\"lib\"' on most platforms.  On\nFedora and SuSE, it is equal to '\"lib64\"' on 64-bit platforms.\nPatch by Jan Mat??jek, Mat??j Cepl, Charalampos Stratakis and Victor\nStinner.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39761\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=39763\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=1294959\n\nFile: python3.12.info,  Node: Windows<34>,  Next: macOS<29>,  Prev: Build<35>,  Up: Python 3 9 0 alpha 5\n\n1.22.37.7 Windows\n.................\n\n- bpo-39930(1): Ensures the required 'vcruntime140.dll' is included\nin install packages.\n\n- bpo-39847(2): Avoid hang when computer is hibernated whilst waiting\nfor a mutex (for lock-related objects from *note threading: e7.)\naround 49-day uptime.\n\n- bpo-38597(3): 'distutils' will no longer statically link\n'vcruntime140.dll' when a redistributable version is unavailable.\nAll future releases of CPython will include a copy of this DLL to\nensure distributed extensions can continue to load.\n\n- bpo-38380(4): Update Windows builds to use SQLite 3.31.1\n\n- bpo-39789(5): Update Windows release build machines to Visual\nStudio 2019 (MSVC 14.2).\n\n- bpo-34803(6): Package for nuget.org now includes repository\nreference and bundled icon image.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39930\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=39847\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=38597\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=38380\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=39789\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=34803\n\nFile: python3.12.info,  Node: macOS<29>,  Next: IDLE<21>,  Prev: Windows<34>,  Up: Python 3 9 0 alpha 5\n\n1.22.37.8 macOS\n...............\n\n- bpo-38380(1): Update macOS builds to use SQLite 3.31.1\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38380\n\nFile: python3.12.info,  Node: IDLE<21>,  Next: Tools/Demos<19>,  Prev: macOS<29>,  Up: Python 3 9 0 alpha 5\n\n1.22.37.9 IDLE\n..............\n\n- bpo-27115(1): For 'Go to Line', use a Query box subclass with IDLE\nstandard behavior and improved error checking.\n\n- bpo-39885(2): Since clicking to get an IDLE context menu moves the\ncursor, any text selection should be and now is cleared.\n\n- bpo-39852(3): Edit \"Go to line\" now clears any selection,\npreventing accidental deletion.  It also updates Ln and Col on the\nstatus bar.\n\n- bpo-39781(4): Selecting code context lines no longer causes a jump.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27115\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=39885\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=39852\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=39781\n\nFile: python3.12.info,  Node: Tools/Demos<19>,  Next: C API<33>,  Prev: IDLE<21>,  Up: Python 3 9 0 alpha 5\n\n1.22.37.10 Tools/Demos\n......................\n\n- bpo-36184(1): Port python-gdb.py to FreeBSD. python-gdb.py now\nchecks for \"takegil\" function name to check if a frame tries to\nacquire the GIL, instead of checking for \"pthreadcondtimedwait\"\nwhich is specific to Linux and can be a different condition than\nthe GIL.\n\n- bpo-38080(2): Added support to fix 'getproxies' in the\n'lib2to3.fixes.fixurllib' module.  Patch by Jose' Roberto Meza\nCabrera.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36184\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=38080\n\nFile: python3.12.info,  Node: C API<33>,  Prev: Tools/Demos<19>,  Up: Python 3 9 0 alpha 5\n\n1.22.37.11 C API\n................\n\n- bpo-40024(1): Add *note PyModuleAddType(): 799. helper function:\nadd a type to a module.  Patch by Donghee Na.\n\n- bpo-39946(2): Remove 'PyRuntime.getframe' hook and remove\n'PyThreadStateGetFrame' macro which was an alias to\n'PyRuntime.getframe'.  They were only exposed by the internal C\nAPI. Remove also 'PyThreadFrameGetter' type.\n\n- bpo-39947(3): Add *note PyThreadStateGetFrame(): 57b. function:\nget the current frame of a Python thread state.\n\n- bpo-37207(4): Add PyArgNoKwnames helper function.  Patch by\nDonghee Na.\n\n- bpo-39947(5): Add *note PyThreadStateGetInterpreter(): 793.: get\nthe interpreter of a Python thread state.\n\n- bpo-39947(6): Add *note PyInterpreterStateGet(): 794. function to\nthe limited C API.\n\n- bpo-35370(7): If *note PySysAudit(): 16ec. fails in *note\nPyEvalSetProfile(): 1357. or *note PyEvalSetTrace(): 1358, log\nthe error as an unraisable exception.\n\n- bpo-39947(8): Move the static inline function flavor of\nPyEnterRecursiveCall() and PyLeaveRecursiveCall() to the internal\nC API: they access PyThreadState attributes.  The limited C API\nprovides regular functions which hide implementation details.\n\n- bpo-39947(9): PyTRASHCANBEGINCONDITION and PyTRASHCANEND macro\nno longer access PyThreadState attributes, but call new private\nPyTrashbegin() and PyTrashend() functions which hide\nimplementation details.\n\n- bpo-39884(10): *note PyDescrNewMethod(): 16fa. and *note\nPyCFunctionNewEx(): 16fb. now include the method name in the\nSystemError \"bad call flags\" error message to ease debug.\n\n- bpo-39877(11): Deprecated 'PyEvalInitThreads()' and\n'PyEvalThreadsInitialized()'.  Calling 'PyEvalInitThreads()' now\ndoes nothing.\n\n- bpo-38249(12): *note PyUNREACHABLE: 9f9. is now implemented with\n'builtinunreachable()' and analogs in release mode.\n\n- bpo-38643(13): *note PyNumberToBase(): 1547. now raises a *note\nSystemError: 2d7. instead of crashing when called with invalid\nbase.\n\n- bpo-39882(14): The *note PyFatalError(): 7a7. function is replaced\nwith a macro which logs automatically the name of the current\nfunction, unless the 'PyLIMITEDAPI' macro is defined.\n\n- bpo-39824(15): Extension modules: *note mtraverse: 79e, *note\nmclear: 79f. and *note mfree: 7a0. functions of *note\nPyModuleDef: 7a1. are no longer called if the module state was\nrequested but is not allocated yet.  This is the case immediately\nafter the module is created and before the module is executed\n(*note Pymodexec: 7a2. function).  More precisely, these\nfunctions are not called if *note msize: 7a3. is greater than 0\nand the module state (as returned by *note PyModuleGetState():\n7a4.) is 'NULL'.\n\nExtension modules without module state ('msize <= 0') are not\naffected.\n\n- bpo-38913(16): Fixed segfault in 'PyBuildValue()' called with a\nformat containing \"#\" and undefined PYSSIZETCLEAN whwn an\nexception is set.\n\n- bpo-38500(17): Add a private API to get and set the frame\nevaluation function: add *note\nPyInterpreterStateGetEvalFrameFunc(): 16fc. and *note\nPyInterpreterStateSetEvalFrameFunc(): 16fd. C functions.  The\n*note PyFrameEvalFunction: 561. function type now takes a 'tstate'\nparameter.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=40024\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=39946\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=39947\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=37207\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=39947\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=39947\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=35370\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=39947\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=39947\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=39884\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=39877\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=38249\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=38643\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=39882\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=39824\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=38913\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=38500\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 9 0 alpha 4,  Next: Python 3 9 0 alpha 3,  Prev: Python 3 9 0 alpha 5,  Up: Changelog": {
            "content": "'Release date: 2020-02-25'\n\n* Menu:\n\n* Security: Security<25>.\n* Core and Builtins: Core and Builtins<38>.\n* Library: Library<38>.\n* Documentation: Documentation<38>.\n* Tests: Tests<36>.\n* Build: Build<36>.\n* Windows: Windows<35>.\n* IDLE: IDLE<22>.\n* C API: C API<34>.\n\nFile: python3.12.info,  Node: Security<25>,  Next: Core and Builtins<38>,  Up: Python 3 9 0 alpha 4\n\n1.22.38.1 Security\n..................\n\n- bpo-39184(1): Add audit events to functions in 'fcntl', 'msvcrt',\n'os', 'resource', 'shutil', 'signal' and 'syslog'.\n\n- bpo-39401(2): Avoid unsafe DLL load at startup on Windows 7 and\nearlier.\n\n- bpo-39184(3): Add audit events to command execution functions in os\nand pty modules.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39184\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=39401\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=39184\n\nFile: python3.12.info,  Node: Core and Builtins<38>,  Next: Library<38>,  Prev: Security<25>,  Up: Python 3 9 0 alpha 4\n\n1.22.38.2 Core and Builtins\n...........................\n\n- bpo-39382(1): Fix a use-after-free in the single inheritance path\nof 'issubclass()', when the 'bases' of an object has a single\nreference, and so does its first item.  Patch by Yonatan\nGoldschmidt.\n\n- bpo-39573(2): Update clinic tool to use *note PyISTYPE(): 1574.\nPatch by Donghee Na.\n\n- bpo-39619(3): Enable use of *note os.chroot(): 1701. on HP-UX\nsystems.\n\n- bpo-39573(4): Add *note PyISTYPE(): 1574. static inline function\nto check whether the object 'o' type is 'type'.\n\n- bpo-39606(5): Fix regression caused by fix for bpo-39386(6), that\nprevented calling 'aclose' on an async generator that had already\nbeen closed or exhausted.\n\n- bpo-39579(7): Change the ending column offset of 'Attribute' nodes\nconstructed in 'astfordottedname' to point at the end of the\ncurrent node and not at the end of the last 'NAME' node.\n\n- bpo-1635741(8): Port crypt extension module to multiphase\ninitialization ( PEP 489(9)).\n\n- bpo-1635741(10): Port contextvars extension module to multiphase\ninitialization ( PEP 489(11)).\n\n- bpo-39510(12): Fix segfault in 'readinto()' method on closed\nBufferedReader.\n\n- bpo-39502(13): Fix *note time.localtime(): 1353. on 64-bit AIX to\nsupport years before 1902 and after 2038.  Patch by M Felt.\n\n- bpo-39492(14): Fix a reference cycle in the C Pickler that was\npreventing the garbage collection of deleted, pickled objects.\n\n- bpo-39453(15): Fixed a possible crash in 'list.contains()' when\na list is changed during comparing items.  Patch by Donghee Na.\n\n- bpo-39434(16): *note floor division: 762. of float operation now\nhas a better performance.  Also the message of *note\nZeroDivisionError: 763. for this operation is updated.  Patch by\nDonghee Na.\n\n- bpo-1635741(17): Port codecs extension module to multiphase\ninitialization ( PEP 489(18)).\n\n- bpo-1635741(19): Port bz2 extension module to multiphase\ninitialization ( PEP 489(20)).\n\n- bpo-1635741(21): Port abc extension module to multiphase\ninitialization ( PEP 489(22)).\n\n- bpo-39320(23): Replace two complex bytecodes for building dicts\nwith two simpler ones.  The new bytecodes 'DICTMERGE' and\n'DICTUPDATE' have been added The old bytecodes 'BUILDMAPUNPACK'\nand 'BUILDMAPUNPACKWITHCALL' have been removed.\n\n- bpo-39219(24): Syntax errors raised in the tokenizer now always set\ncorrect \"text\" and \"offset\" attributes.\n\n- bpo-36051(25): Drop the GIL during large 'bytes.join' operations.\nPatch by Bruce Merry.\n\n- bpo-38960(26): Fix DTrace build issues on FreeBSD. Patch by David\nCarlier.\n\n- bpo-37207(27): Speed up calls to 'range()' by about 30%, by using\nthe PEP 590 'vectorcall' calling convention.  Patch by Mark\nShannon.\n\n- bpo-36144(28): *note dict: 237. (and *note collections.UserDict:\n1702.) objects now support PEP 584's merge ('|') and update ('|=')\noperators.  Patch by Brandt Bucher.\n\n- bpo-32856(29): Optimized the idiom for assignment a temporary\nvariable in comprehensions.  Now 'for y in [expr]' in\ncomprehensions is as fast as a simple assignment 'y = expr'.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39382\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=39573\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=39619\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=39573\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=39606\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=39386\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=39579\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(9) https://peps.python.org/pep-0489/\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(11) https://peps.python.org/pep-0489/\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=39510\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=39502\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=39492\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=39453\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=39434\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(18) https://peps.python.org/pep-0489/\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(20) https://peps.python.org/pep-0489/\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(22) https://peps.python.org/pep-0489/\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=39320\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=39219\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=36051\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=38960\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=37207\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=36144\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=32856\n\nFile: python3.12.info,  Node: Library<38>,  Next: Documentation<38>,  Prev: Core and Builtins<38>,  Up: Python 3 9 0 alpha 4\n\n1.22.38.3 Library\n.................\n\n- bpo-30566(1): Fix *note IndexError: 138f. when trying to decode an\ninvalid string with punycode codec.\n\n- bpo-39649(2): Remove obsolete check for 'args' in\n'bdb.Bdb.formatstackentry'.\n\n- bpo-39648(3): Expanded *note math.gcd(): 72c. and *note math.lcm():\n72d. to handle multiple arguments.\n\n- bpo-39681(4): Fix a regression where the C pickle module wouldn't\nallow unpickling from a file-like object that doesn't expose a\nreadinto() method.\n\n- bpo-35950(5): Raise *note io.UnsupportedOperation: 1704. in\n'io.BufferedReader.truncate()' when it is called on a read-only\n*note io.BufferedReader: 1082. instance.\n\n- bpo-39479(6): Add *note math.lcm(): 72d. function: least common\nmultiple.\n\n- bpo-39674(7): Revert \"Do not expose abstract collection classes in\nthe collections module\" change (bpo-25988(8)).  Aliases to ABC like\ncollections.Mapping are kept in Python 3.9 to ease transition from\nPython 2.7, but will be removed in Python 3.10.\n\n- bpo-39104(9): Fix hanging ProcessPoolExcutor on\n'shutdown(wait=False)' when a task has failed pickling.\n\n- bpo-39627(10): Fixed TypedDict totality check for inherited keys.\n\n- bpo-39474(11): Fixed starting position of AST for expressions like\n'(a)(b)', '(a)[b]' and '(a).b'.\n\n- bpo-21016(12): The *note pydoc: b0. and *note trace: f8. modules\nnow use the *note sysconfig: d5. module to get the path to the\nPython standard library, to support uncommon installation path like\n'/usr/lib64/python3.9/' on Fedora.  Patch by Jan Mat??jek.\n\n- bpo-39590(13): Collections.deque now holds strong references during\ndeque.contains and deque.count, fixing crashes.\n\n- bpo-39586(14): The distutils 'bdistmsi' command is deprecated in\nPython 3.9, use 'bdistwheel' (wheel packages) instead.\n\n- bpo-39595(15): Improved performance of zipfile.Path for files with\na large number of entries.  Also improved performance and fixed\nminor issue as published with importlibmetadata 1.5(16).\n\n- bpo-39350(17): Fix regression in *note fractions.Fraction: 1a8. if\nthe numerator and/or the denominator is an *note int: 17e.\nsubclass.  The *note math.gcd(): 72c. function is now used to\nnormalize the 'numerator' and 'denominator'.  *note math.gcd():\n72c. always return a *note int: 17e. type.  Previously, the GCD\ntype depended on 'numerator' and 'denominator'.\n\n- bpo-39567(18): Added audit for *note os.walk(): 1c8, *note\nos.fwalk(): 998, *note pathlib.Path.glob(): 1cc. and *note\npathlib.Path.rglob(): 1cd.\n\n- bpo-39559(19): Remove unused, undocumented argument 'getters' from\n*note uuid.getnode(): 9eb.\n\n- bpo-38149(20): *note sys.audit(): 16dc. is now called only once per\ncall of *note glob.glob(): 5fa. and *note glob.iglob(): 5fb.\n\n- bpo-39546(21): Fix a regression in *note ArgumentParser: 28f. where\n'allowabbrev=False' was ignored for long options that used a\nprefix character other than \"-\".\n\n- bpo-39450(22): Striped whitespace from docstring before returning\nit from 'unittest.case.shortDescription()'.\n\n- bpo-12915(23): A new function 'resolvename' has been added to the\n'pkgutil' module.  This resolves a string of the form ''a.b.c.d''\nor ''a.b:c.d'' to an object.  In the example, 'a.b' is a\npackage/module and 'c.d' is an object within that package/module\nreached via recursive attribute access.\n\n- bpo-39353(24): The *note binascii.crchqx(): 518. function is no\nlonger deprecated.\n\n- bpo-39493(25): Mark 'typing.IO.closed' as a property\n\n- bpo-39491(26): Add *note typing.Annotated: 75b. and\n'includeextras' parameter to *note typing.gettypehints(): 47f.\nas part of PEP 593(27).  Patch by Till Varoquaux, documentation by\nTill Varoquaux and Konstantin Kashin.\n\n- bpo-39485(28): Fix a bug in *note unittest.mock.createautospec():\n13b3. that would complain about the wrong number of arguments for\ncustom descriptors defined in an extension module returning\nfunctions.\n\n- bpo-38932(29): Mock fully resets child objects on resetmock().\nPatch by Vegard Stikbakke\n\n- bpo-39082(30): Allow AsyncMock to correctly patch static/class\nmethods\n\n- bpo-39432(31): Implement PEP-489 algorithm for non-ascii \"PyInit...\"\nsymbol names in distutils to make it export the correct init symbol\nalso on Windows.\n\n- bpo-18819(32): Omit 'devmajor' and 'devminor' fields for non-device\nfiles in *note tarfile: d8. archives, enabling bit-for-bit\ncompatibility with GNU 'tar(1)'.\n\n- bpo-39349(33): Added a new 'cancelfutures' parameter to *note\nconcurrent.futures.Executor.shutdown(): 706. that cancels all\npending futures which have not started running, instead of waiting\nfor them to complete before shutting down the executor.\n\n- bpo-39274(34): 'bool(fraction.Fraction)' now returns a boolean even\nif (numerator != 0) does not return a boolean (ex: numpy number).\n\n- bpo-34793(35): Remove support for 'with (await asyncio.lock):' and\n'with (yield from asyncio.lock):'.  The same is correct for\n'asyncio.Condition' and 'asyncio.Semaphore'.\n\n- bpo-25597(36): Ensure, if 'wraps' is supplied to *note\nunittest.mock.MagicMock: cf4, it is used to calculate return values\nfor the magic methods instead of using the default return values.\nPatch by Karthikeyan Singaravelan.\n\n- bpo-36350(37): 'inspect.Signature.parameters' and\n'inspect.BoundArguments.arguments' are now dicts instead of\nOrderedDicts.  Patch contributed by Re'mi Lapeyre.\n\n- bpo-35727(38): Fix sys.exit() and sys.exit(None) exit code\npropagation when used in multiprocessing.Process.\n\n- bpo-32173(39): * Add 'lazycache' function to 'all'.  * Use\n'dict.clear' to clear the cache.  * Refactoring 'getline' function\nand 'checkcache' function.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30566\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=39649\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=39648\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=39681\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=35950\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=39479\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=39674\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=25988\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=39104\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=39627\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=39474\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=21016\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=39590\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=39586\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=39595\n\n(16)\nhttps://importlib-metadata.readthedocs.io/en/latest/history.html#v1-5-0\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=39350\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=39567\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=39559\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=38149\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=39546\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=39450\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=12915\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=39353\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=39493\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=39491\n\n(27) https://peps.python.org/pep-0593/\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=39485\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=38932\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=39082\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=39432\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=18819\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=39349\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=39274\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=34793\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=25597\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=36350\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=35727\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=32173\n\nFile: python3.12.info,  Node: Documentation<38>,  Next: Tests<36>,  Prev: Library<38>,  Up: Python 3 9 0 alpha 4\n\n1.22.38.4 Documentation\n.......................\n\n- bpo-17422(1): The language reference now specifies restrictions on\nclass namespaces.  Adapted from a patch by Ethan Furman.\n\n- bpo-39572(2): Updated documentation of 'total' flag of 'TypedDict'.\n\n- bpo-39654(3): In pyclbr doc, update 'class' to 'module' where\nappropriate and add readmodule comment.  Patch by Hakan C,elik.\n\n- bpo-39153(4): Clarify refcounting semantics for the following\nfunctions: - PyObjectSetItem - PyMappingSetItemString -\nPyDictSetItem - PyDictSetItemString\n\n- bpo-39392(5): Explain that when filling with turtle, overlap\nregions may be left unfilled.\n\n- bpo-39369(6): Update mmap readline method description.  The fact\nthat the readline method does update the file position should not\nbe ignored since this might give the impression for the programmer\nthat it doesn't update it.\n\n- bpo-9056(7): Include subsection in TOC for PDF version of docs.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=17422\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=39572\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=39654\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=39153\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=39392\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=39369\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=9056\n\nFile: python3.12.info,  Node: Tests<36>,  Next: Build<36>,  Prev: Documentation<38>,  Up: Python 3 9 0 alpha 4\n\n1.22.38.5 Tests\n...............\n\n- bpo-38325(1): Skip tests on non-BMP characters of\ntestwinconsoleio.\n\n- bpo-39502(2): Skip testzipfile.testaddfileafter2107() if *note\ntime.localtime(): 1353. fails with *note OverflowError: 68d.  It is\nthe case on AIX 6.1 for example.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38325\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=39502\n\nFile: python3.12.info,  Node: Build<36>,  Next: Windows<35>,  Prev: Tests<36>,  Up: Python 3 9 0 alpha 4\n\n1.22.38.6 Build\n...............\n\n- bpo-39489(1): Remove 'COUNTALLOCS' special build.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39489\n\nFile: python3.12.info,  Node: Windows<35>,  Next: IDLE<22>,  Prev: Build<36>,  Up: Python 3 9 0 alpha 4\n\n1.22.38.7 Windows\n.................\n\n- bpo-39553(1): Delete unused code related to SxS manifests.\n\n- bpo-39439(2): Honor the Python path when a virtualenv is active on\nWindows.\n\n- bpo-39393(3): Improve the error message when attempting to load a\nDLL with unresolved dependencies.\n\n- bpo-38883(4): *note home(): ca2. and *note expanduser(): ca1. on\nWindows now prefer 'USERPROFILE' and no longer use 'HOME', which is\nnot normally set for regular user accounts.  This makes them again\nbehave like *note os.path.expanduser(): 83d, which was changed to\nignore 'HOME' in 3.8, see bpo-36264(5).\n\n- bpo-39185(6): The build.bat script has additional options for\nvery-quiet output (-q) and very-verbose output (-vv)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39553\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=39439\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=39393\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=38883\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=36264\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=39185\n\nFile: python3.12.info,  Node: IDLE<22>,  Next: C API<34>,  Prev: Windows<35>,  Up: Python 3 9 0 alpha 4\n\n1.22.38.8 IDLE\n..............\n\n- bpo-39663(1): Add tests for pyparse findgoodparsestart().\n\n- bpo-39600(2): In the font configuration window, remove duplicated\nfont names.\n\n- bpo-30780(3): Add remaining configdialog tests for buttons and\nhighlights and keys tabs.\n\n- bpo-39388(4): IDLE Settings Cancel button now cancels pending\nchanges\n\n- bpo-38792(5): Close an IDLE shell calltip if a *note\nKeyboardInterrupt: 7f5. or shell restart occurs.  Patch by Zackery\nSpytz.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39663\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=39600\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=30780\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=39388\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=38792\n\nFile: python3.12.info,  Node: C API<34>,  Prev: IDLE<22>,  Up: Python 3 9 0 alpha 4\n\n1.22.38.9 C API\n...............\n\n- bpo-35081(1): Move the 'bytesmethods.h' header file to the\ninternal C API as 'pycorebytesmethods.h': it only contains\nprivate symbols (prefixed by 'Py'), except of the\n'PyDocSTRVARshared()' macro.\n\n- bpo-35081(2): Move the 'dtoa.h' header file to the internal C API\nas 'pycoredtoa.h': it only contains private functions (prefixed by\n'Py').  The *note math: 89. and *note cmath: 16. modules must now\nbe compiled with the 'PyBUILDCORE' macro defined.\n\n- bpo-39573(3): Add *note PySETSIZE(): 56e. function to set the\nsize of an object.\n\n- bpo-39500(4): *note PyUnicodeIsIdentifier(): 170b. does not call\n*note PyFatalError(): 7a7. anymore if the string is not ready.\n\n- bpo-39573(5): Add *note PySETTYPE(): 56c. function to set the\ntype of an object.\n\n- bpo-39573(6): Add a *note PySETREFCNT(): 6be. function to set the\nreference counter of an object.\n\n- bpo-39542(7): Convert *note PyTypeHasFeature(): 16bd, *note\nPyTypeCheck(): 170c. and *note PyTypeCheckExact(): 170d. macros\nto static inline functions.\n\n- bpo-39542(8): In the limited C API, 'PyObjectINIT()' and\n'PyObjectINITVAR()' are now defined as aliases to *note\nPyObjectInit(): 898. and *note PyObjectInitVar(): 16bf. to make\ntheir implementation opaque.  It avoids to leak implementation\ndetails in the limited C API. Exclude the following functions from\nthe limited C API: 'PyNewReference()', 'PyForgetReference()',\n'PyTraceMallocNewReference()' and 'PyGetRefTotal()'.\n\n- bpo-39542(9): Exclude trashcan mechanism from the limited C API: it\nrequires access to PyTypeObject and PyThreadState structure fields,\nwhereas these structures are opaque in the limited C API.\n\n- bpo-39511(10): The *note PyThreadStateClear(): 16d4. function now\ncalls the 'PyThreadState.ondelete' callback.  Previously, that\nhappened in *note PyThreadStateDelete(): 170e.\n\n- bpo-38076(11): Fix to clear the interpreter state only after\nclearing module globals to guarantee module state access from C\nExtensions during runtime destruction\n\n- bpo-39245(12): The Vectorcall API (PEP 590) was made public, adding\nthe functions 'PyObjectVectorcall', 'PyObjectVectorcallMethod',\n'PyVectorcallFunction', 'PyObjectCallOneArg',\n'PyObjectCallMethodNoArgs', 'PyObjectCallMethodOneArg',\n'PyObjectFastCallDict', and the flag 'PyTPFLAGSHAVEVECTORCALL'.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=35081\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=35081\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=39573\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=39500\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=39573\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=39573\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=39542\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=39542\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=39542\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=39511\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=38076\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=39245\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 9 0 alpha 3,  Next: Python 3 9 0 alpha 2,  Prev: Python 3 9 0 alpha 4,  Up: Changelog": {
            "content": "'Release date: 2020-01-24'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<39>.\n* Library: Library<39>.\n* Documentation: Documentation<39>.\n* Build: Build<37>.\n* IDLE: IDLE<23>.\n* C API: C API<35>.\n\nFile: python3.12.info,  Node: Core and Builtins<39>,  Next: Library<39>,  Up: Python 3 9 0 alpha 3\n\n1.22.39.1 Core and Builtins\n...........................\n\n- bpo-39427(1): Document all possibilities for the '-X' options in\nthe command line help section.  Patch by Pablo Galindo.\n\n- bpo-39421(2): Fix possible crashes when operating with the\nfunctions in the *note heapq: 64. module and custom comparison\noperators.\n\n- bpo-39386(3): Prevent double awaiting of async iterator.\n\n- bpo-17005(4): Add 'functools.TopologicalSorter' to the *note\nfunctools: 5a. module to offers functionality to perform\ntopological sorting of graphs.  Patch by Pablo Galindo, Tim Peters\nand Larry Hastings.\n\n- bpo-39320(5): Replace four complex bytecodes for building sequences\nwith three simpler ones.\n\nThe following four bytecodes have been removed:\n\n* BUILDLISTUNPACK\n\n* BUILDTUPLEUNPACK\n\n* BUILDSETUNPACK\n\n* BUILDTUPLEUNPACKWITHCALL\n\nThe following three bytecodes have been added:\n\n* LISTTOTUPLE\n\n* LISTEXTEND\n\n* SETUPDATE\n\n- bpo-39336(6): Import loaders which publish immutable module objects\ncan now publish immutable packages in addition to individual\nmodules.\n\n- bpo-39322(7): Added a new function *note gc.isfinalized(): 718. to\ncheck if an object has been finalized by the garbage collector.\nPatch by Pablo Galindo.\n\n- bpo-39048(8): Improve the displayed error message when incorrect\ntypes are passed to 'async with' statements by looking up the\n'aenter()' special method before the 'aexit()' special\nmethod when entering an asynchronous context manager.  Patch by\nGe'ry Ogam.\n\n- bpo-39235(9): Fix AST end location for lone generator expression in\nfunction call, e.g.  f(i for i in a).\n\n- bpo-39209(10): Correctly handle multi-line tokens in interactive\nmode.  Patch by Pablo Galindo.\n\n- bpo-1635741(11): Port json extension module to multiphase\ninitialization ( PEP 489(12)).\n\n- bpo-39216(13): Fix constant folding optimization for positional\nonly arguments - by Anthony Sottile.\n\n- bpo-39215(14): Fix 'SystemError' when nested function has\nannotation on positional-only argument - by Anthony Sottile.\n\n- bpo-39200(15): Correct the error message when calling the *note\nmin(): d6f. or *note max(): d70. with no arguments.  Patch by\nDonghee Na.\n\n- bpo-39200(16): Correct the error message when trying to construct\n*note range: 761. objects with no arguments.  Patch by Pablo\nGalindo.\n\n- bpo-39166(17): Fix incorrect line execution reporting in trace\nfunctions when tracing the last iteration of asynchronous for\nloops.  Patch by Pablo Galindo.\n\n- bpo-39114(18): Fix incorrect line execution reporting in trace\nfunctions when tracing exception handlers with name binding.  Patch\nby Pablo Galindo.\n\n- bpo-39156(19): Split the COMPAREOP bytecode instruction into four\ndistinct instructions.\n\n* COMPAREOP for rich comparisons\n\n* ISOP for 'is' and 'is not' tests\n\n* CONTAINSOP for 'in' and 'is not' tests\n\n* JUMPIFNOTEXCMATCH for checking exceptions in 'try-except'\nstatements.\n\nThis improves the clarity of the interpreter and should provide a\nmodest speedup.\n\n- bpo-38588(20): Fix possible crashes in dict and list when calling\n*note PyObjectRichCompareBool(): 1711.\n\n- bpo-13601(21): By default, 'sys.stderr' is line-buffered now, even\nif 'stderr' is redirected to a file.  You can still make\n'sys.stderr' unbuffered by passing the *note -u: 1712. command-line\noption or setting the *note PYTHONUNBUFFERED: 1713. environment\nvariable.\n\n(Contributed by Jendrik Seipp in bpo-13601(22).)\n\n- bpo-38610(23): Fix possible crashes in several list methods by\nholding strong references to list elements when calling *note\nPyObjectRichCompareBool(): 1711.\n\n- bpo-32021(24): Include brotli .br encoding in mimetypes\nencodingsmap\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39427\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=39421\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=39386\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=17005\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=39320\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=39336\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=39322\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=39048\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=39235\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=39209\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=1635741\n\n(12) https://peps.python.org/pep-0489/\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=39216\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=39215\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=39200\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=39200\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=39166\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=39114\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=39156\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=38588\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=13601\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=13601\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=38610\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=32021\n\nFile: python3.12.info,  Node: Library<39>,  Next: Documentation<39>,  Prev: Core and Builtins<39>,  Up: Python 3 9 0 alpha 3\n\n1.22.39.2 Library\n.................\n\n- bpo-39430(1): Fixed race condition in lazy imports in *note\ntarfile: d8.\n\n- bpo-39413(2): The *note os.unsetenv(): 739. function is now also\navailable on Windows.\n\n- bpo-39390(3): Fixed a regression with the 'ignore' callback of\n*note shutil.copytree(): 854.  The argument types are now 'str' and\n'List[str]' again.\n\n- bpo-39395(4): The *note os.putenv(): 73a. and *note os.unsetenv():\n739. functions are now always available.\n\n- bpo-39406(5): If 'setenv()' C function is available, *note\nos.putenv(): 73a. is now implemented with 'setenv()' instead of\n'putenv()', so Python doesn't have to handle the environment\nvariable memory.\n\n- bpo-39396(6): Fix 'math.nextafter(-0.0, +0.0)' on AIX 7.1.\n\n- bpo-29435(7): Allow *note tarfile.istarfile(): 15a7. to be used\nwith file and file-like objects, like *note zipfile.iszipfile():\n11a2.  Patch by William Woodruff.\n\n- bpo-39377(8): Removed 'encoding' option from *note json.loads():\n776.  It has been deprecated since Python 3.1.\n\n- bpo-39389(9): Write accurate compression level metadata in *note\ngzip: 62. archives, rather than always signaling maximum\ncompression.\n\n- bpo-39366(10): The previously deprecated 'xpath()' and 'xgtitle()'\nmethods of *note nntplib.NNTP: 733. have been removed.\n\n- bpo-39357(11): Remove the 'buffering' parameter of *note\nbz2.BZ2File: 775.  Since Python 3.0, it was ignored and using it\nwas emitting *note DeprecationWarning: 179.  Pass an open file\nobject, to control how the file is opened.  The 'compresslevel'\nparameter becomes keyword-only.\n\n- bpo-39353(12): Deprecate binhex4 and hexbin4 standards.  Deprecate\nthe 'binhex' module and the following *note binascii: e. functions:\n'b2ahqx()', 'a2bhqx()', 'rlecodehqx()', 'rledecodehqx()', *note\ncrchqx(): 518.\n\n- bpo-39351(13): Remove 'base64.encodestring()' and\n'base64.decodestring()', aliases deprecated since Python 3.1: use\n*note base64.encodebytes(): 773. and *note base64.decodebytes():\n774. instead.\n\n- bpo-39350(14): Remove 'fractions.gcd()' function, deprecated since\nPython 3.5 (bpo-22486(15)): use *note math.gcd(): 72c. instead.\n\n- bpo-39329(16): *note LMTP: 74d. constructor now has an optional\n'timeout' parameter.  Patch by Donghee Na.\n\n- bpo-39313(17): Add a new 'execfunction' option ('-exec-function'\nin the CLI) to 'RefactoringTool' for making 'exec' a function.\nPatch by Batuhan Taskaya.\n\n- bpo-39259(18): *note FTPTLS: 716. and *note FTPTLS: 716. now\nraise a *note ValueError: 183. if the given timeout for their\nconstructor is zero to prevent the creation of a non-blocking\nsocket.  Patch by Donghee Na.\n\n- bpo-39259(19): *note SMTP: 74b. and *note SMTPSSL: 74c. now raise\na *note ValueError: 183. if the given timeout for their constructor\nis zero to prevent the creation of a non-blocking socket.  Patch by\nDonghee Na.\n\n- bpo-39310(20): Add *note math.ulp(): 72e.: return the value of the\nleast significant bit of a float.\n\n- bpo-39297(21): Improved performance of importlib.metadata\ndistribution discovery and resilients to inaccessible sys.path\nentries (importlibmetadata v1.4.0).\n\n- bpo-39259(22): *note NNTP: 733. and *note NNTPSSL: 734. now raise\na *note ValueError: 183. if the given timeout for their constructor\nis zero to prevent the creation of a non-blocking socket.  Patch by\nDonghee Na.\n\n- bpo-38901(23): When you specify prompt='.' or equivalently python\n-m venv -prompt .  ... the basename of the current directory is used\nto set the created venv's prompt when it's activated.\n\n- bpo-39288(24): Add *note math.nextafter(): 1b7.: return the next\nfloating-point value after 'x' towards 'y'.\n\n- bpo-39259(25): *note POP3: 742. and *note POP3SSL: 743. now raise\na *note ValueError: 183. if the given timeout for their constructor\nis zero to prevent the creation of a non-blocking socket.  Patch by\nDonghee Na.\n\n- bpo-39242(26): Updated the Gmane domain from news.gmane.org to\nnews.gmane.io which is used for examples of *note NNTP: 733. news\nreader server and nntplib tests.\n\n- bpo-35292(27): Proxy the 'SimpleHTTPRequestHandler.guesstype' to\n'mimetypes.guesstype' so the 'mimetypes.init' is called lazily to\navoid unnecessary costs when *note http.server: 6d. module is\nimported.\n\n- bpo-39239(28): The *note select.epoll.unregister(): 77b. method no\nlonger ignores the *note EBADF: 77c. error.\n\n- bpo-38907(29): In http.server script, restore binding to IPv4 on\nWindows.\n\n- bpo-39152(30): Fix ttk.Scale.configure([name]) to return\nconfiguration tuple for name or all options.  Giovanni Lombardo\ncontributed part of the patch.\n\n- bpo-39198(31): If an exception were to be thrown in\n'Logger.isEnabledFor' (say, by asyncio timeouts or stopit) , the\n'logging' global lock may not be released appropriately, resulting\nin deadlock.  This change wraps that block of code with\n'try...finally' to ensure the lock is released.\n\n- bpo-39191(32): Perform a check for running loop before starting a\nnew task in 'loop.rununtilcomplete()' to fail fast; it prevents\nthe side effect of new task spawning before exception raising.\n\n- bpo-38871(33): Correctly parenthesize filter-based statements that\ncontain lambda expressions in *note lib2to3: 7f.  Patch by Donghee\nNa.\n\n- bpo-39142(34): A change was made to logging.config.dictConfig to\navoid converting instances of named tuples to ConvertingTuple.\nIt's assumed that named tuples are too specialised to be treated\nlike ordinary tuples; if a user of named tuples requires\nConvertingTuple functionality, they will have to implement that\nthemselves in their named tuple class.\n\n- bpo-39158(35): ast.literaleval() now supports empty sets.\n\n- bpo-39129(36): Fix import path for 'asyncio.TimeoutError'\n\n- bpo-39057(37): 'urllib.request.proxybypassenvironment()' now\nignores leading dots and no longer ignores a trailing newline.\n\n- bpo-39056(38): Fixed handling invalid warning category in the -W\noption.  No longer import the re module if it is not needed.\n\n- bpo-39055(39): *note base64.b64decode(): 1715. with 'validate=True'\nraises now a binascii.Error if the input ends with a single '\\n'.\n\n- bpo-21600(40): Fix 'mock.patch.stopall()' to stop active patches\nthat were created with 'mock.patch.dict()'.\n\n- bpo-39019(41): Implement dummy 'classgetitem' for *note\ntempfile.SpooledTemporaryFile: 45f.\n\n- bpo-39019(42): Implement dummy 'classgetitem' for\n'subprocess.Popen', 'subprocess.CompletedProcess'\n\n- bpo-38914(43): Adjusted the wording of the warning issued by\ndistutils' 'check' command when the 'author' and 'maintainer'\nfields are supplied but no corresponding e-mail field\n('authoremail' or 'maintaineremail') is found.  The wording now\nreflects the fact that these fields are suggested, but not\nrequired.  Patch by Juergen Gmach.\n\n- bpo-38878(44): Fixed subclasshook of *note os.PathLike: a9a. to\nreturn a correct result upon inheritance.  Patch by Bar Harel.\n\n- bpo-38615(45): *note IMAP4: 71e. and *note IMAP4SSL: 71f. now have\nan optional 'timeout' parameter for their constructors.  Also, the\n*note open(): 720. method now has an optional 'timeout' parameter\nwith this change.  The overridden methods of *note IMAP4SSL: 71f.\nand *note IMAP4stream: 721. were applied to this change.  Patch by\nDonghee Na.\n\n- bpo-35182(46): Fixed 'Popen.communicate()' subsequent call crash\nwhen the child process has already closed any piped standard\nstream, but still continues to be running.  Patch by Andriy\nMaletsky.\n\n- bpo-38630(47): On Unix, *note subprocess.Popen.sendsignal(): 1233.\nnow polls the process status.  Polling reduces the risk of sending\na signal to the wrong process if the process completed, the *note\nsubprocess.Popen.returncode: 1716. attribute is still 'None', and\nthe pid has been reassigned (recycled) to a new different process.\n\n- bpo-38536(48): Removes trailing space in formatted currency with\n'international=True' and a locale with symbol following value.\nE.g.  'locale.currency(12.34, international=True)' returned ''12,34\nEUR '' instead of ''12,34 EUR''.\n\n- bpo-38473(49): Use signature from inner mock for autospecced\nmethods attached with 'unittest.mock.attachmock()'.  Patch by\nKarthikeyan Singaravelan.\n\n- bpo-38361(50): Fixed an issue where 'ident' could include a leading\npath separator when *note syslog.openlog(): 296. was called without\narguments.\n\n- bpo-38293(51): Add *note copy.copy(): 289. and *note\ncopy.deepcopy(): 9af. support to *note property(): 3f6. objects.\n\n- bpo-37958(52): Added the pstats.Stats.getprofiledict() method to\nreturn the profile data as a StatsProfile instance.\n\n- bpo-28367(53): Termios magic constants for the following baud\nrates: - B500000 - B576000 - B921600 - B1000000 - B1152000 -\nB1500000 - B2000000 - B2500000 - B3000000 - B3500000 - B4000000\nPatch by Andrey Smirnov\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39430\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=39413\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=39390\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=39395\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=39406\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=39396\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=29435\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=39377\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=39389\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=39366\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=39357\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=39353\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=39351\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=39350\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=22486\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=39329\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=39313\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=39259\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=39259\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=39310\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=39297\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=39259\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=38901\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=39288\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=39259\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=39242\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=35292\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=39239\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=38907\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=39152\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=39198\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=39191\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=38871\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=39142\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=39158\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=39129\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=39057\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=39056\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=39055\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=21600\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=39019\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=39019\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=38914\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=38878\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=38615\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=35182\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=38630\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=38536\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=38473\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=38361\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=38293\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=37958\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=28367\n\nFile: python3.12.info,  Node: Documentation<39>,  Next: Build<37>,  Prev: Library<39>,  Up: Python 3 9 0 alpha 3\n\n1.22.39.3 Documentation\n.......................\n\n- bpo-39381(1): Mention in docs that *note asyncio.geteventloop():\n21e. implicitly creates new event loop only if called from the main\nthread.\n\n- bpo-38918(2): Add an entry for 'module' in the \"function\" &\n\"method\" sections of the *note inspect: 78. docs' *note Types and\nmembers: 1718. table.\n\n- bpo-3530(3): In the *note ast: 8. module documentation, fix a\nmisleading 'NodeTransformer' example and add advice on when to use\nthe 'fixmissinglocations' function.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39381\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=38918\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=3530\n\nFile: python3.12.info,  Node: Build<37>,  Next: IDLE<23>,  Prev: Documentation<39>,  Up: Python 3 9 0 alpha 3\n\n1.22.39.4 Build\n...............\n\n- bpo-39395(1): On non-Windows platforms, the 'setenv()' and\n'unsetenv()' functions are now required to build Python.\n\n- bpo-39160(2): Updated the documentation in './configure --help' to\nshow default values, reference documentation where required and add\nadditional explanation where needed.\n\n- bpo-39144(3): The ctags and etags build targets both include\nModules/ctypes and Python standard library source files.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39395\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=39160\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=39144\n\nFile: python3.12.info,  Node: IDLE<23>,  Next: C API<35>,  Prev: Build<37>,  Up: Python 3 9 0 alpha 3\n\n1.22.39.5 IDLE\n..............\n\n- bpo-39050(1): Make IDLE Settings dialog Help button work again.\n\n- bpo-34118(2): Tag memoryview, range, and tuple as classes, the same\nas list, etcetera, in the library manual built-in functions list.\n\n- bpo-32989(3): Add tests for editor newlineandindentevent method.\nRemove dead code from pyparse findgoodparsestart method.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39050\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=34118\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=32989\n\nFile: python3.12.info,  Node: C API<35>,  Prev: IDLE<23>,  Up: Python 3 9 0 alpha 3\n\n1.22.39.6 C API\n...............\n\n- bpo-39372(1): Clean header files of interfaces defined but with no\nimplementation.  The public API symbols being removed are:\n'PyBytesInsertThousandsGroupingLocale',\n'PyBytesInsertThousandsGrouping', 'PyInitializeFromArgs',\n'PyInitializeFromWideArgs', 'PyFloatRepr', 'PyFloatDigits',\n'PyFloatDigitsInit', 'PyFrameExtendStack',\n'PyAIterWrapperType', 'PyNullImporterType', 'PyCmpWrapperType',\n'PySortWrapperType', 'PyNoArgsFunction'.\n\n- bpo-39164(2): Add a private 'PyErrGetExcInfo()' function to\nretrieve exception information of the specified Python thread\nstate.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39372\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=39164\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 9 0 alpha 2,  Next: Python 3 9 0 alpha 1,  Prev: Python 3 9 0 alpha 3,  Up: Changelog": {
            "content": "'Release date: 2019-12-18'\n\n* Menu:\n\n* Security: Security<26>.\n* Core and Builtins: Core and Builtins<40>.\n* Library: Library<40>.\n* Documentation: Documentation<40>.\n* Tests: Tests<37>.\n* Build: Build<38>.\n* Windows: Windows<36>.\n* macOS: macOS<30>.\n* IDLE: IDLE<24>.\n* C API: C API<36>.\n\nFile: python3.12.info,  Node: Security<26>,  Next: Core and Builtins<40>,  Up: Python 3 9 0 alpha 2\n\n1.22.40.1 Security\n..................\n\n- bpo-38945(1): Newline characters have been escaped when performing\nuu encoding to prevent them from overflowing into to content\nsection of the encoded file.  This prevents malicious or accidental\nmodification of data during the decoding process.\n\n- bpo-37228(2): Due to significant security concerns, the\n'reuseaddress' parameter of *note\nasyncio.loop.createdatagramendpoint(): 517. is no longer\nsupported.  This is because of the behavior of 'SOREUSEADDR' in\nUDP. For more details, see the documentation for\n'loop.createdatagramendpoint()'.  (Contributed by Kyle Stanley,\nAntoine Pitrou, and Yury Selivanov in bpo-37228(3).)\n\n- bpo-38804(4): Fixes a ReDoS vulnerability in *note http.cookiejar:\n6b.  Patch by Ben Caller.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38945\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=37228\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=37228\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=38804\n\nFile: python3.12.info,  Node: Core and Builtins<40>,  Next: Library<40>,  Prev: Security<26>,  Up: Python 3 9 0 alpha 2\n\n1.22.40.2 Core and Builtins\n...........................\n\n- bpo-39028(1): Slightly improve the speed of keyword argument\nparsing with many kwargs by strengthening the assumption that\nkwargs are interned strings.\n\n- bpo-39080(2): Fix the value of 'endcoloffset' for Starred\nExpression AST nodes when they are among the elements in the 'args'\nattribute of Call AST nodes.\n\n- bpo-39031(3): When parsing an \"elif\" node, lineno and coloffset of\nthe node now point to the \"elif\" keyword and not to its condition,\nmaking it consistent with the \"if\" node.  Patch by Lysandros\nNikolaou.\n\n- bpo-20443(4): In Python 3.9.0a1, sys.argv[0] was made an absolute\npath if a filename was specified on the command line.  Revert this\nchange, since most users expect sys.argv to be unmodified.\n\n- bpo-39008(5): *note PySysAudit(): 16ec. now requires 'Pyssizet'\nto be used for size arguments in the format string, regardless of\nwhether 'PYSSIZETCLEAN' was defined at include time.\n\n- bpo-38673(6): In REPL mode, don't switch to PS2 if the line starts\nwith comment or whitespace.  Based on work by Batuhan Ta??kaya.\n\n- bpo-38922(7): Calling 'replace' on a code object now raises the\n'code.new' audit event.\n\n- bpo-38920(8): Add audit hooks for when *note sys.excepthook(): 5ff.\nand *note sys.unraisablehook(): 448. are invoked.\n\n- bpo-38892(9): Improve documentation for audit events table and\nfunctions.\n\n- bpo-38852(10): Set the thread stack size to 8 Mb for debug builds\non android platforms.\n\n- bpo-38858(11): Each Python subinterpreter now has its own \"small\ninteger singletons\": numbers in [-5; 257] range.  It is no longer\npossible to change the number of small integers at build time by\noverriding 'NSMALLNEGINTS' and 'NSMALLPOSINTS' macros: macros\nshould now be modified manually in 'pycorepystate.h' header file.\n\n- bpo-36854(12): The garbage collector state becomes per interpreter\n('PyInterpreterState.gc'), rather than being global\n('PyRuntimeState.gc').\n\n- bpo-38835(13): The 'PyFPESTARTPROTECT()' and\n'PyFPEENDPROTECT()' macros are empty: they have been doing\nnothing for the last year, so stop using them.\n\n- bpo-38328(14): Sped up the creation time of constant *note list:\n3dc. and *note set: 39d. displays.  Patch by Brandt Bucher.\n\n- bpo-38707(15): 'MainThread.nativeid' is now correctly reset in\nchild processes spawned using *note multiprocessing.Process: 996,\ninstead of retaining the parent's value.\n\n- bpo-38629(16): Added 'floor' and 'ceil' methods to float\nobject.  Patch by Batuhan Ta??kaya.\n\n- bpo-27145(17): int + int and int - int operators can now return\nsmall integer singletons.  Patch by hongweipeng.\n\n- bpo-38021(18): Provide a platform tag for AIX that is sufficient\nfor PEP425 binary distribution identification.  Patch by Michael\nFelt.\n\n- bpo-35409(19): Ignore GeneratorExit exceptions when throwing an\nexception into the aclose coroutine of an asynchronous generator.\n\n- bpo-33387(20): Removed WITHCLEANUPSTART, WITHCLEANUPFINISH,\nBEGINFINALLY, ENDFINALLY, CALLFINALLY and POPFINALLY bytecodes.\nReplaced with RERAISE and WITHEXCEPTSTART bytecodes.  The\ncompiler now generates different code for exceptional and\nnon-exceptional branches for 'with' and 'try-except' statements.\nFor 'try-finally' statements the 'finally' block is replicated for\neach exit from the 'try' body.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39028\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=39080\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=39031\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=20443\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=39008\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=38673\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=38922\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=38920\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=38892\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=38852\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=38858\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=36854\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=38835\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=38328\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=38707\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=38629\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=27145\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=38021\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=35409\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=33387\n\nFile: python3.12.info,  Node: Library<40>,  Next: Documentation<40>,  Prev: Core and Builtins<40>,  Up: Python 3 9 0 alpha 2\n\n1.22.40.3 Library\n.................\n\n- bpo-39033(1): Fix *note NameError: 144. in *note zipimport: 12c.\nPatch by Karthikeyan Singaravelan.\n\n- bpo-39022(2): Update importlib.metadata to include improvements\nfrom importlibmetadata 1.3 including better serialization of\nEntryPoints and improved documentation for custom finders.\n\n- bpo-39006(3): Fix asyncio when the ssl module is missing: only\ncheck for ssl.SSLSocket instance if the ssl module is available.\n\n- bpo-38708(4): Fix a potential IndexError in email parser when\nparsing an empty msg-id.\n\n- bpo-38698(5): Add a new 'InvalidMessageID' token to email parser to\nrepresent invalid Message-ID headers.  Also, add defects when there\nis remaining value after parsing the header.\n\n- bpo-38994(6): Implement 'classgetitem' for 'os.PathLike',\n'pathlib.Path'.\n\n- bpo-38979(7): Return class from 'ContextVar.classgetitem' to\nsimplify subclassing.\n\n- bpo-38978(8): Implement 'classgetitem' on asyncio objects\n(Future, Task, Queue).  Patch by Batuhan Taskaya.\n\n- bpo-38916(9): *note array.array: 18f.: Remove 'tostring()' and\n'fromstring()' methods.  They were aliases to 'tobytes()' and\n'frombytes()', deprecated since Python 3.2.\n\n- bpo-38986(10): Make repr of C accelerated TaskWakeupMethWrapper the\nsame as of pure Python version.\n\n- bpo-38982(11): Fix asyncio 'PidfdChildWatcher': handle 'waitpid()'\nerror.  If 'waitpid()' is called elsewhere, 'waitpid()' call fails\nwith *note ChildProcessError: ed1.: use return code 255 in this\ncase, and log a warning.  It ensures that the pidfd file descriptor\nis closed if this error occurs.\n\n- bpo-38529(12): Drop too noisy asyncio warning about deletion of a\nstream without explicit '.close()' call.\n\n- bpo-27413(13): Added ability to pass through 'ensureascii' options\nto json.dumps in the 'json.tool' command-line interface.\n\n- bpo-38634(14): The *note readline: b5. module now detects if Python\nis linked to libedit at runtime on all platforms.  Previously, the\ncheck was only done on macOS.\n\n- bpo-33684(15): Fix 'json.tool' failed to read a JSON file with\nnon-ASCII characters when locale encoding is not UTF-8.\n\n- bpo-38698(16): Prevent UnboundLocalError to pop up in\nparsemessageid.\n\nparsemessageid() was improperly using a token defined inside an\nexception handler, which was raising 'UnboundLocalError' on parsing\nan invalid value.  Patch by Claudiu Popa.\n\n- bpo-38927(17): Use 'python -m pip' instead of 'pip' to upgrade\ndependencies in venv.\n\n- bpo-26730(18): Fix 'SpooledTemporaryFile.rollover()' might corrupt\nthe file when it is in text mode.  Patch by Serhiy Storchaka.\n\n- bpo-38881(19): random.choices() now raises a ValueError when all\nthe weights are zero.\n\n- bpo-38876(20): Raise pickle.UnpicklingError when loading an item\nfrom memo for invalid input.\n\nThe previous code was raising a 'KeyError' for both the Python and\nC implementation.  This was caused by the specified index of an\ninvalid input which did not exist in the memo structure, where the\npickle stores what objects it has seen.  The malformed input would\nhave caused either a 'BINGET' or 'LONGBINGET' load from the memo,\nleading to a 'KeyError' as the determined index was bogus.  Patch\nby Claudiu Popa.\n\n- bpo-38688(21): Calling func:'shutil.copytree' to copy a directory\ntree from one directory to another subdirectory resulted in an\nendless loop and a RecursionError.  A fix was added to consume an\niterator and create the list of the entries to be copied, avoiding\nthe recursion for newly created directories.  Patch by Bruno P.\nKinoshita.\n\n- bpo-38863(22): Improve 'iscgi()' function in *note http.server:\n6d, which enables processing the case that cgi directory is a child\nof another directory other than root.\n\n- bpo-37838(23): *note typing.gettypehints(): 47f. properly handles\nfunctions decorated with *note functools.wraps(): dcd.\n\n- bpo-38870(24): Expose *note ast.unparse(): 6fe. as a function of\nthe *note ast: 8. module that can be used to unparse an *note\nast.AST: 527. object and produce a string with code that would\nproduce an equivalent *note ast.AST: 527. object when parsed.\nPatch by Pablo Galindo and Batuhan Taskaya.\n\n- bpo-38859(25): AsyncMock now returns StopAsyncIteration on the\nexhaustion of a sideeffects iterable.  Since PEP-479 its\nImpossible to raise a StopIteration exception from a coroutine.\n\n- bpo-38857(26): AsyncMock fix for return values that are awaitable\ntypes.  This also covers sideeffect iterable values that happened\nto be awaitable, and wraps callables that return an awaitable type.\nBefore these awaitables were being awaited instead of being\nreturned as is.\n\n- bpo-38834(27): *note typing.TypedDict: 153. subclasses now track\nwhich keys are optional using the 'requiredkeys' and\n'optionalkeys' attributes, to enable runtime validation by\ndownstream projects.  Patch by Zac Hatfield-Dodds.\n\n- bpo-38821(28): Fix unhandled exceptions in *note argparse: 6. when\ninternationalizing error messages for arguments with 'nargs' set to\nspecial (non-integer) values.  Patch by Federico Bond.\n\n- bpo-38820(29): Make Python compatible with OpenSSL 3.0.0.  *note\nssl.SSLSocket.getpeercert(): e27. no longer returns IPv6 addresses\nwith a trailing new line.\n\n- bpo-38811(30): Fix an unhandled exception in *note pathlib: 9f.\nwhen *note os.link(): f5f. is missing.  Patch by Toke\nH??iland-J??rgensen.\n\n- bpo-38686(31): Added support for multiple 'qop' values in *note\nurllib.request.AbstractDigestAuthHandler: 16f0.\n\n- bpo-38712(32): Add the Linux-specific *note\nsignal.pidfdsendsignal(): 749. function, which allows sending a\nsignal to a process identified by a file descriptor rather than a\npid.\n\n- bpo-38348(33): Add '-i' and '--indent' (indentation level), and\n'--no-type-comments' (type comments) command line options to ast\nparsing tool.\n\n- bpo-37523(34): Change 'zipfile.ZipExtFile' to raise 'ValueError'\nwhen trying to access the underlying file object after it has been\nclosed.  This new behavior is consistent with how accessing closed\nfiles is handled in other parts of Python.\n\n- bpo-38045(35): Improve the performance of 'enum.decompose()' in\n*note enum: 51.  Patch by hongweipeng.\n\n- bpo-36820(36): Break cycle generated when saving an exception in\nsocket.py, codeop.py and dyld.py as they keep alive not only the\nexception but user objects through the 'traceback' attribute.\nPatch by Mario Corchero.\n\n- bpo-36406(37): Handle namespace packages in *note doctest: 36.\nPatch by Karthikeyan Singaravelan.\n\n- bpo-34776(38): Fix dataclasses to support forward references in\ntype annotations\n\n- bpo-20928(39): ElementTree supports recursive XInclude processing.\nPatch by Stefan Behnel.\n\n- bpo-29636(40): Add whitespace options for formatting JSON with the\n'json.tool' CLI. The following mutually exclusive options are now\nsupported: '--indent' for setting the indent level in spaces;\n'--tab' for indenting with tabs; '--no-indent' for suppressing\nnewlines; and '--compact' for suppressing all whitespace.  The\ndefault behavior remains the same as '--indent=4'.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39033\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=39022\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=39006\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=38708\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=38698\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=38994\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=38979\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=38978\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=38916\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=38986\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=38982\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=38529\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=27413\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=38634\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=33684\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=38698\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=38927\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=26730\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=38881\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=38876\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=38688\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=38863\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=37838\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=38870\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=38859\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=38857\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=38834\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=38821\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=38820\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=38811\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=38686\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=38712\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=38348\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=37523\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=38045\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=36820\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=36406\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=34776\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=20928\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=29636\n\nFile: python3.12.info,  Node: Documentation<40>,  Next: Tests<37>,  Prev: Library<40>,  Up: Python 3 9 0 alpha 2\n\n1.22.40.4 Documentation\n.......................\n\n- bpo-38928(1): Correct when venv's 'upgradedependencies()' and\n'--upgrade-deps' are added.\n\n- bpo-38899(2): Update documentation to state that to activate\nvirtual environments under fish one should use 'source', not '.' as\ndocumented at\n'https://fishshell.com/docs/current/cmds/source.html'.\n\n- bpo-22377(3): Improves documentation of the values that *note\ndatetime.datetime.strptime(): 146c. accepts for '%Z'.  Patch by\nKarl Dubost.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38928\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=38899\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=22377\n\nFile: python3.12.info,  Node: Tests<37>,  Next: Build<38>,  Prev: Documentation<40>,  Up: Python 3 9 0 alpha 2\n\n1.22.40.5 Tests\n...............\n\n- bpo-38546(1): Fix testressourcesgcedinworkers() of\ntestconcurrentfutures: explicitly stop the manager to prevent\nleaking a child process running in the background after the test\ncompletes.\n\n- bpo-38546(2): Multiprocessing and concurrent.futures tests now stop\nthe resource tracker process when tests complete.\n\n- bpo-38614(3): Replace hardcoded timeout constants in tests with new\n*note test.support: de. constants: *note LOOPBACKTIMEOUT: 1722,\n*note INTERNETTIMEOUT: 1723, *note SHORTTIMEOUT: 1611. and *note\nLONGTIMEOUT: 1724.  It becomes easier to adjust these four timeout\nconstants for all tests at once, rather than having to adjust every\nsingle test file.\n\n- bpo-38547(4): Fix testpty: if the process is the session leader,\nclosing the master file descriptor raises a SIGHUP signal: simply\nignore SIGHUP when running the tests.\n\n- bpo-38992(5): Fix a test for *note math.fsum(): 1229. that was\nfailing due to constant folding.\n\n- bpo-38991(6): *note test.support: de.: 'runpythonuntilend()',\n'assertpythonok()' and 'assertpythonfailure()' functions no\nlonger strip whitespaces from stderr.  Remove\n'test.support.strippythonstderr()' function.\n\n- bpo-38965(7): Fix testfaulthandler on GCC 10.  Use the \"volatile\"\nkeyword in 'faulthandler.stackoverflow()' to prevent tail call\noptimization on any compiler, rather than relying on compiler\nspecific pragma.\n\n- bpo-38875(8): testcapi: trashcan tests now require the test \"cpu\"\nresource.\n\n- bpo-38841(9): Skip asyncio\ntestcreatedatagramendpointexistingsockunix on platforms\nlacking a functional bind() for named unix domain sockets.\n\n- bpo-38692(10): Skip the testposix.testpidfdopen() test if\n'os.pidfdopen()' fails with a *note PermissionError: b9a.  This\nsituation can happen in a Linux sandbox using a syscall whitelist\nwhich doesn't allow the 'pidfdopen()' syscall yet.\n\n- bpo-38839(11): Fix some unused functions in tests.  Patch by Adam\nJohnson.\n\n- bpo-38669(12): Raise *note TypeError: 28e. when passing target as a\nstring with *note unittest.mock.patch.object(): 1725.\n\n- bpo-37957(13): test.regrtest now can receive a list of test\npatterns to ignore (using the -i/-ignore argument) or a file with a\nlist of patterns to ignore (using the -ignore-file argument).\nPatch by Pablo Galindo.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38546\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=38546\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=38614\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=38547\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=38992\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=38991\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=38965\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=38875\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=38841\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=38692\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=38839\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=38669\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=37957\n\nFile: python3.12.info,  Node: Build<38>,  Next: Windows<36>,  Prev: Tests<37>,  Up: Python 3 9 0 alpha 2\n\n1.22.40.6 Build\n...............\n\n- bpo-37404(1): *note asyncio: 9. now raises 'TyperError' when\ncalling incompatible methods with an *note ssl.SSLSocket: 703.\nsocket.  Patch by Ido Michael.\n\n- bpo-36500(2): Added an optional \"regen\" project to the Visual\nStudio solution that will regenerate all grammar, tokens, and\nopcodes.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=37404\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=36500\n\nFile: python3.12.info,  Node: Windows<36>,  Next: macOS<30>,  Prev: Build<38>,  Up: Python 3 9 0 alpha 2\n\n1.22.40.7 Windows\n.................\n\n- bpo-39007(1): Add auditing events to functions in *note winreg:\n111.\n\n- bpo-33125(2): Add support for building and releasing Windows ARM64\npackages.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=39007\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=33125\n\nFile: python3.12.info,  Node: macOS<30>,  Next: IDLE<24>,  Prev: Windows<36>,  Up: Python 3 9 0 alpha 2\n\n1.22.40.8 macOS\n...............\n\n- bpo-37931(1): Fixed a crash on OSX dynamic builds that occurred\nwhen re-initializing the posix module after a PyFinalize if the\nenvironment had changed since the previous 'import posix'.  Patch\nby Beno??t Hudson.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=37931\n\nFile: python3.12.info,  Node: IDLE<24>,  Next: C API<36>,  Prev: macOS<30>,  Up: Python 3 9 0 alpha 2\n\n1.22.40.9 IDLE\n..............\n\n- bpo-38944(1): Escape key now closes IDLE completion windows.  Patch\nby Johnny Najera.\n\n- bpo-38943(2): Fix IDLE autocomplete windows not always appearing on\nsome systems.  Patch by Johnny Najera.\n\n- bpo-38862(3): 'Strip Trailing Whitespace' on the Format menu\nremoves extra newlines at the end of non-shell files.\n\n- bpo-38636(4): Fix IDLE Format menu tab toggle and file indent\nwidth.  These functions (default shortcuts Alt-T and Alt-U) were\nmistakenly disabled in 3.7.5 and 3.8.0.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38944\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=38943\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=38862\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=38636\n\nFile: python3.12.info,  Node: C API<36>,  Prev: IDLE<24>,  Up: Python 3 9 0 alpha 2\n\n1.22.40.10 C API\n................\n\n- bpo-38896(1): Remove 'PyUnicodeClearFreeList()' function: the\nUnicode free list has been removed in Python 3.3.\n\n- bpo-37340(2): Remove 'PyMethodClearFreeList()' and\n'PyCFunctionClearFreeList()' functions: the free lists of bound\nmethod objects have been removed.\n\n- bpo-38835(3): Exclude 'PyFPESTARTPROTECT()' and\n'PyFPEENDPROTECT()' macros of 'pyfpe.h' from 'PyLIMITEDAPI'\n(stable API).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38896\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=37340\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=38835\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 9 0 alpha 1,  Next: Python 3 8 0 beta 1,  Prev: Python 3 9 0 alpha 2,  Up: Changelog": {
            "content": "'Release date: 2019-11-19'\n\n* Menu:\n\n* Security: Security<27>.\n* Core and Builtins: Core and Builtins<41>.\n* Library: Library<41>.\n* Documentation: Documentation<41>.\n* Tests: Tests<38>.\n* Build: Build<39>.\n* Windows: Windows<37>.\n* macOS: macOS<31>.\n* IDLE: IDLE<25>.\n* Tools/Demos: Tools/Demos<20>.\n* C API: C API<37>.\n\nFile: python3.12.info,  Node: Security<27>,  Next: Core and Builtins<41>,  Up: Python 3 9 0 alpha 1\n\n1.22.41.1 Security\n..................\n\n- bpo-38722(1): *note runpy: b9. now uses *note io.opencode(): 146a.\nto open code files.  Patch by Jason Killen.\n\n- bpo-38622(2): Add additional audit events for the *note ctypes: 28.\nmodule.\n\n- bpo-38418(3): Fixes audit event for *note os.system(): 12b2. to be\nnamed 'os.system'.\n\n- bpo-38243(4): Escape the server title of *note\nxmlrpc.server.DocXMLRPCServer: 172d. when rendering the document\npage as HTML. (Contributed by Donghee Na in bpo-38243(5).)\n\n- bpo-38174(6): Update vendorized expat library version to 2.2.8,\nwhich resolves CVE-2019-15903.\n\n- bpo-37764(7): Fixes email.headervalueparser.getunstructured\ngoing into an infinite loop for a specific case in which the email\nheader does not have trailing whitespace, and the case in which it\ncontains an invalid encoded word.  Patch by Ashwin Ramaswami.\n\n- bpo-37461(8): Fix an infinite loop when parsing specially crafted\nemail headers.  Patch by Abhilash Raj.\n\n- bpo-37363(9): Adds audit events for the range of supported run\ncommands (see *note Command line and environment: 172e.).\n\n- bpo-37463(10): ssl.matchhostname() no longer accepts IPv4\naddresses with additional text after the address and only\nquad-dotted notation without trailing whitespaces.  Some\ninetaton() implementations ignore whitespace and all data after\nwhitespace, e.g.  '127.0.0.1 whatever'.\n\n- bpo-37363(11): Adds audit events for *note ensurepip: 50, *note\nftplib: 59, *note glob: 5f, *note imaplib: 6f, *note nntplib: 98,\n*note pdb: a0, *note poplib: a7, *note shutil: c0, *note smtplib:\nc4, *note sqlite3: c9, *note subprocess: d0, *note telnetlib: d9,\n*note tempfile: da. and *note webbrowser: 110, as well as *note\nos.listdir(): f6a, *note os.scandir(): 88c. and *note breakpoint():\n8f9.\n\n- bpo-37364(12): *note io.opencode(): 146a. is now used when reading\n'.pth' files.\n\n- bpo-34631(13): Updated OpenSSL to 1.1.1c in Windows installer\n\n- bpo-34155(14): Fix parsing of invalid email addresses with more\nthan one '@' (e.g.  a@b@c.com.)  to not return the part before 2nd\n'@' as valid email address.  Patch by maxking & jpic.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38722\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=38622\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=38418\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=38243\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=38243\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=38174\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=37764\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=37461\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=37363\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=37463\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=37363\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=37364\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=34631\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=34155\n\nFile: python3.12.info,  Node: Core and Builtins<41>,  Next: Library<41>,  Prev: Security<27>,  Up: Python 3 9 0 alpha 1\n\n1.22.41.2 Core and Builtins\n...........................\n\n- bpo-38631(1): Replace 'PyFatalError()' call with a regular *note\nRuntimeError: 17a. exception in 'float.getformat()'.\n\n- bpo-38639(2): Optimized *note math.floor(): 1216, *note\nmath.ceil(): 1217. and *note math.trunc(): 1218. for floats.\n\n- bpo-38640(3): Fixed a bug in the compiler that was causing to raise\nin the presence of break statements and continue statements inside\nalways false while loops.  Patch by Pablo Galindo.\n\n- bpo-38613(4): Optimized some set operations (e.g.  '|', '^', and\n'-') of 'dictkeys'.  'd.keys() | other' was slower than 'set(d) |\nother' but they are almost same performance for now.\n\n- bpo-28029(5): '\"\".replace(\"\", s, n)' now returns 's' instead of an\nempty string for all non-zero 'n'.  There are similar changes for\n*note bytes: 295. and *note bytearray: 294. objects.\n\n- bpo-38535(6): Fixed line numbers and column offsets for AST nodes\nfor calls without arguments in decorators.\n\n- bpo-38525(7): Fix a segmentation fault when using reverse iterators\nof empty 'dict' objects.  Patch by Donghee Na and Inada Naoki.\n\n- bpo-38465(8): *note bytearray: 294, *note array: 18f. and *note\nmmap: 830. objects allow now to export more than '231' buffers at\na time.\n\n- bpo-38469(9): Fixed a bug where the scope of named expressions was\nnot being resolved correctly in the presence of the 'global'\nkeyword.  Patch by Pablo Galindo.\n\n- bpo-38437(10): Activate the 'GCDEBUG' macro for debug builds of\nthe interpreter (when 'PyDEBUG' is set).  Patch by Pablo Galindo.\n\n- bpo-38379(11): When the garbage collector makes a collection in\nwhich some objects resurrect (they are reachable from outside the\nisolated cycles after the finalizers have been executed), do not\nblock the collection of all objects that are still unreachable.\nPatch by Pablo Galindo and Tim Peters.\n\n- bpo-38379(12): When cyclic garbage collection (gc) runs finalizers\nthat resurrect unreachable objects, the current gc run ends,\nwithout collecting any cyclic trash.  However, the statistics\nreported by 'collect()' and 'getstats()' claimed that all cyclic\ntrash found was collected, and that the resurrected objects were\ncollected.  Changed the stats to report that none were collected.\n\n- bpo-38392(13): In debug mode, *note PyObjectGCTrack(): 1360. now\ncalls 'tptraverse()' of the object type to ensure that the object\nis valid: test that objects visited by 'tptraverse()' are valid.\n\n- bpo-38210(14): Remove unnecessary intersection and update set\noperation in dictview with empty set.  (Contributed by Donghee Na\nin bpo-38210(15).)\n\n- bpo-38402(16): Check the error from the system's underlying 'crypt'\nor 'cryptr'.\n\n- bpo-37474(17): On FreeBSD, Python no longer calls\n'fedisableexcept()' at startup to control the floating point\ncontrol mode.  The call became useless since FreeBSD 6: it became\nthe default mode.\n\n- bpo-38006(18): Fix a bug due to the interaction of weakrefs and the\ncyclic garbage collector.  We must clear any weakrefs in garbage in\norder to prevent their callbacks from executing and causing a\ncrash.\n\n- bpo-38317(19): Fix warnings options priority:\n'PyConfig.warnoptions' has the highest priority, as stated in the\nPEP 587(20).\n\n- bpo-38310(21): Predict 'BUILDMAPUNPACKWITHCALL' ->\n'CALLFUNCTIONEX' opcode pairs in the main interpreter loop.\nPatch by Brandt Bucher.\n\n- bpo-36871(22): Improve error handling for the asserthascalls and\nasserthasawaits methods of mocks.  Fixed a bug where any errors\nencountered while binding the expected calls to the mock's spec\nwere silently swallowed, leading to misleading error output.\n\n- bpo-11410(23): Better control over symbol visibility is provided\nthrough use of the visibility attributes available in gcc >= 4.0,\nprovided in a uniform way across POSIX and Windows.  The POSIX\nbuild files have been updated to compile with -fvisibility=hidden,\nminimising exported symbols.\n\n- bpo-38219(24): Optimized the *note dict: 237. constructor and the\n*note update(): 12ba. method for the case when the argument is a\ndict.\n\n- bpo-38236(25): Python now dumps path configuration if it fails to\nimport the Python codecs of the filesystem and stdio encodings.\n\n- bpo-38013(26): Allow to call 'asyncgeneratorathrow().throw(...)'\neven for non-started async generator helper.  It fixes annoying\nwarning at the end of *note asyncio.run(): 197. call.\n\n- bpo-38124(27): Fix an off-by-one error in PyStateAddModule that\ncould cause out-of-bounds memory access.\n\n- bpo-38116(28): The select module is now PEP-384 compliant and no\nlonger has static state\n\n- bpo-38113(29): ast module updated to PEP-384 and all statics\nremoved\n\n- bpo-38076(30): The struct module is now PEP-384 compatible\n\n- bpo-38075(31): The random module is now PEP-384 compatible\n\n- bpo-38074(32): zlib module made PEP-384 compatible\n\n- bpo-38073(33): Make pwd extension module PEP-384 compatible\n\n- bpo-38072(34): grp module made PEP-384 compatible\n\n- bpo-38069(35): Make posixsubprocess PEP-384 compatible\n\n- bpo-38071(36): Make termios extension module PEP-384 compatible\n\n- bpo-38005(37): Fixed comparing and creating of InterpreterID and\nChannelID.\n\n- bpo-36946(38): Fix possible signed integer overflow when handling\nslices.  Patch by hongweipeng.\n\n- bpo-37994(39): Fixed silencing arbitrary errors if an attribute\nlookup fails in several sites.  Only AttributeError should be\nsilenced.\n\n- bpo-8425(40): Optimize set differenceupdate for the case when the\nother set is much larger than the base set.  (Suggested by Evgeny\nKapun with code contributed by Michele Orr??).\n\n- bpo-37966(41): The implementation of *note isnormalized(): 875.\nhas been greatly sped up on strings that aren't normalized, by\nimplementing the full normalization-quick-check algorithm from the\nUnicode standard.\n\n- bpo-37947(42): Adjust correctly the recursion level in the symtable\ngeneration for named expressions.  Patch by Pablo Galindo.\n\n- bpo-37812(43): The 'CHECKSMALLINT' macro used inside\n'Object/longobject.c' has been replaced with an explicit 'return'\nat each call site.\n\n- bpo-37751(44): Fix *note codecs.lookup(): 784. to normalize the\nencoding name the same way than 'encodings.normalizeencoding()',\nexcept that *note codecs.lookup(): 784. also converts the name to\nlower case.\n\n- bpo-37830(45): Fixed compilation of *note break: 8de. and *note\ncontinue: 7ed. in the *note finally: 7ee. block when the\ncorresponding *note try: 4bc. block contains *note return: 7f2.\nwith a non-constant value.\n\n- bpo-20490(46): Improve import error message for partially\ninitialized module on circular 'from' imports - by Anthony Sottile.\n\n- bpo-37840(47): Fix handling of negative indices in *note sqitem:\n1692. of *note bytearray: 294.  Patch by Sergey Fedoseev.\n\n- bpo-37802(48): Slightly improve performance of *note\nPyLongFromUnsignedLong(): 1730, *note\nPyLongFromUnsignedLongLong(): 1731. and *note PyLongFromSizet():\n1732.  Patch by Sergey Fedoseev.\n\n- bpo-37409(49): Ensure explicit relative imports from interactive\nsessions and scripts (having no parent package) always raise\nImportError, rather than treating the current module as the\npackage.  Patch by Ben Lewis.\n\n- bpo-32912(50): Reverted bpo-32912(51): emitting *note\nSyntaxWarning: 178. instead of *note DeprecationWarning: 179. for\ninvalid escape sequences in string and bytes literals.\n\n- bpo-37757(52): PEP 572(53): As described in the PEP, assignment\nexpressions now raise *note SyntaxError: 146. when their\ninteraction with comprehension scoping results in an ambiguous\ntarget scope.\n\nThe 'TargetScopeError' subclass originally proposed by the PEP has\nbeen removed in favour of just raising regular syntax errors for\nthe disallowed cases.\n\n- bpo-36279(54): Fix potential use of uninitialized memory in *note\nos.wait3(): bf2.\n\n- bpo-36311(55): Decoding bytes objects larger than 2GiB is faster\nand no longer fails when a multibyte characters spans a chunk\nboundary.\n\n- bpo-34880(56): The *note assert: 78a. statement now works properly\nif the *note AssertionError: 476. exception is being shadowed.\nPatch by Zackery Spytz.\n\n- bpo-37340(57): Removed object cache ('freelist') for bound method\nobjects.  Temporary bound method objects are less used than before\nthanks to the 'LOADMETHOD' opcode and the\n'PyObjectVectorcallMethod' C API.\n\n- bpo-37648(58): Fixed minor inconsistency in 'list.contains()',\n'tuple.contains()' and a few other places.  The collection's\nitem is now always at the left and the needle is on the right of\n'=='.\n\n- bpo-37444(59): Update differing exception between\n'builtins.import()' and *note importlib.import(): ee4.\n\n- bpo-37619(60): When adding a wrapper descriptor from one class to a\ndifferent class (for example, setting 'add = str.add' on an\n'int' subclass), an exception is correctly raised when the operator\nis called.\n\n- bpo-37593(61): Swap the positions of the 'posonlyargs' and 'args'\nparameters in the constructor of 'ast.parameters' nodes.\n\n- bpo-37543(62): Optimized pymalloc for non PGO build.\n\n- bpo-37537(63): Compute allocated pymalloc blocks inside\nPyGetAllocatedBlocks().  This slows down PyGetAllocatedBlocks()\nbut gives a small speedup to PyObjectMalloc() and\nPyObjectFree().\n\n- bpo-37467(64): Fix *note sys.excepthook(): 5ff. and\n'PyErrDisplay()' if a filename is a bytes string.  For example,\nfor a SyntaxError exception where the filename attribute is a bytes\nstring.\n\n- bpo-37433(65): Fix 'SyntaxError' indicator printing too many spaces\nfor multi-line strings - by Anthony Sottile.\n\n- bpo-37417(66): 'bytearray.extend()' now correctly handles errors\nthat arise during iteration.  Patch by Brandt Bucher.\n\n- bpo-37414(67): The undocumented 'sys.callstats()' function has been\nremoved.  Since Python 3.7, it was deprecated and always returned\n'None'.  It required a special build option 'CALLPROFILE' which\nwas already removed in Python 3.7.\n\n- bpo-37392(68): Remove 'sys.getcheckinterval()' and\n'sys.setcheckinterval()' functions.  They were deprecated since\nPython 3.2.  Use *note sys.getswitchinterval(): 769. and *note\nsys.setswitchinterval(): 76a. instead.  Remove also\n'checkinterval' field of the 'PyInterpreterState' structure.\n\n- bpo-37388(69): In development mode and in debug build, 'encoding'\nand 'errors' arguments are now checked on string encoding and\ndecoding operations.  Examples: *note open(): 26e, *note\nstr.encode(): 6ee. and *note bytes.decode(): 6ef.\n\nBy default, for best performances, the 'errors' argument is only\nchecked at the first encoding/decoding error, and the 'encoding'\nargument is sometimes ignored for empty strings.\n\n- bpo-37348(70): Optimized decoding short ASCII string with UTF-8 and\nascii codecs.  'b\"foo\".decode()' is about 15% faster.  Patch by\nInada Naoki.\n\n- bpo-24214(71): Improved support of the surrogatepass error handler\nin the UTF-8 and UTF-16 incremental decoders.\n\n- bpo-37330(72): *note open(): 26e, *note io.open(): 26f, *note\ncodecs.open(): 525. and *note fileinput.FileInput: 51b. no longer\naccept ''U'' (\"universal newline\") in the file mode.  This flag was\ndeprecated since Python 3.3.\n\n- bpo-35224(73): Reverse evaluation order of key: value in dict\ncomprehensions as proposed in PEP 572.  I.e.  in '{k: v for ...}',\n'k' will be evaluated before 'v'.\n\n- bpo-37316(74): Fix the *note PySysAudit(): 16ec. call in *note\nmmap.mmap: 830.\n\n- bpo-37300(75): Remove an unnecessary PyXINCREF in classobject.c.\n\n- bpo-37269(76): Fix a bug in the peephole optimizer that was not\ntreating correctly constant conditions with binary operators.\nPatch by Pablo Galindo.\n\n- bpo-20443(77): Python now gets the absolute path of the script\nfilename specified on the command line (ex: \"python3 script.py\"):\nthe file attribute of the main module and sys.path[0]\nbecome an absolute path, rather than a relative path.\n\n- bpo-37257(78): Python's small object allocator ('obmalloc.c') now\nallows (no more than) one empty arena to remain available for\nimmediate reuse, without returning it to the OS. This prevents\nthrashing in simple loops where an arena could be created and\ndestroyed anew on each iteration.\n\n- bpo-37231(79): The dispatching of type slots to special methods\n(for example calling 'mul' when doing 'x * y') has been made\nfaster.\n\n- bpo-36974(80): Implemented separate vectorcall functions for every\ncalling convention of builtin functions and methods.  This improves\nperformance for calls.\n\n- bpo-37213(81): Handle correctly negative line offsets in the\npeephole optimizer.  Patch by Pablo Galindo.\n\n- bpo-37219(82): Remove erroneous optimization for empty set\ndifferences.\n\n- bpo-15913(83): Implement *note PyBufferSizeFromFormat(): 543.\nfunction (previously documented but not implemented): call *note\nstruct.calcsize(): 1733.  Patch by Joannah Nanjekye.\n\n- bpo-36922(84): Slot functions optimize any callable with\n'PyTPFLAGSMETHODDESCRIPTOR' instead of only instances of\n'function'.\n\n- bpo-36974(85): The slot 'tpvectorcalloffset' is inherited\nunconditionally to support 'super().call()' when the base class\nuses vectorcall.\n\n- bpo-37160(86): *note threading.getnativeid(): 869. now also\nsupports NetBSD.\n\n- bpo-37077(87): Add *note threading.getnativeid(): 869. support\nfor AIX. Patch by M. Felt\n\n- bpo-36781(88): *note sum(): 181. has been optimized for boolean\nvalues.\n\n- bpo-34556(89): Add '--upgrade-deps' to venv module.  Patch by\nCooper Ry Lees\n\n- bpo-20523(90): 'pdb.Pdb' supports ~/.pdbrc in Windows 7.  Patch by\nTim Hopper and Dan Lidral-Porter.\n\n- bpo-35551(91): Updated encodings: - Removed the \"tis260\" encoding,\nwhich was an alias for the nonexistent \"tactis\" codec.  - Added\n\"maccenteuro\" as an alias for the maclatin2 encoding.\n\n- bpo-19072(92): The *note classmethod: 246. decorator can now wrap\nother descriptors such as property objects.  Adapted from a patch\nwritten by Graham Dumpleton.\n\n- bpo-27575(93): Improve speed of dictview intersection by directly\nusing set intersection logic.  Patch by David Su.\n\n- bpo-30773(94): Prohibit parallel running of aclose() / asend() /\nathrow().  Fix agrunning to reflect the actual running status of\nthe AG.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38631\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=38639\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=38640\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=38613\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=28029\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=38535\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=38525\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=38465\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=38469\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=38437\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=38379\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=38379\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=38392\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=38210\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=38210\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=38402\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=37474\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=38006\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=38317\n\n(20) https://peps.python.org/pep-0587/\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=38310\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=36871\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=11410\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=38219\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=38236\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=38013\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=38124\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=38116\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=38113\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=38076\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=38075\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=38074\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=38073\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=38072\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=38069\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=38071\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=38005\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=36946\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=37994\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=8425\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=37966\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=37947\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=37812\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=37751\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=37830\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=20490\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=37840\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=37802\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=37409\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=32912\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=32912\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=37757\n\n(53) https://peps.python.org/pep-0572/\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=36279\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=36311\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=34880\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=37340\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=37648\n\n(59) https://bugs.python.org/issue?@action=redirect&bpo=37444\n\n(60) https://bugs.python.org/issue?@action=redirect&bpo=37619\n\n(61) https://bugs.python.org/issue?@action=redirect&bpo=37593\n\n(62) https://bugs.python.org/issue?@action=redirect&bpo=37543\n\n(63) https://bugs.python.org/issue?@action=redirect&bpo=37537\n\n(64) https://bugs.python.org/issue?@action=redirect&bpo=37467\n\n(65) https://bugs.python.org/issue?@action=redirect&bpo=37433\n\n(66) https://bugs.python.org/issue?@action=redirect&bpo=37417\n\n(67) https://bugs.python.org/issue?@action=redirect&bpo=37414\n\n(68) https://bugs.python.org/issue?@action=redirect&bpo=37392\n\n(69) https://bugs.python.org/issue?@action=redirect&bpo=37388\n\n(70) https://bugs.python.org/issue?@action=redirect&bpo=37348\n\n(71) https://bugs.python.org/issue?@action=redirect&bpo=24214\n\n(72) https://bugs.python.org/issue?@action=redirect&bpo=37330\n\n(73) https://bugs.python.org/issue?@action=redirect&bpo=35224\n\n(74) https://bugs.python.org/issue?@action=redirect&bpo=37316\n\n(75) https://bugs.python.org/issue?@action=redirect&bpo=37300\n\n(76) https://bugs.python.org/issue?@action=redirect&bpo=37269\n\n(77) https://bugs.python.org/issue?@action=redirect&bpo=20443\n\n(78) https://bugs.python.org/issue?@action=redirect&bpo=37257\n\n(79) https://bugs.python.org/issue?@action=redirect&bpo=37231\n\n(80) https://bugs.python.org/issue?@action=redirect&bpo=36974\n\n(81) https://bugs.python.org/issue?@action=redirect&bpo=37213\n\n(82) https://bugs.python.org/issue?@action=redirect&bpo=37219\n\n(83) https://bugs.python.org/issue?@action=redirect&bpo=15913\n\n(84) https://bugs.python.org/issue?@action=redirect&bpo=36922\n\n(85) https://bugs.python.org/issue?@action=redirect&bpo=36974\n\n(86) https://bugs.python.org/issue?@action=redirect&bpo=37160\n\n(87) https://bugs.python.org/issue?@action=redirect&bpo=37077\n\n(88) https://bugs.python.org/issue?@action=redirect&bpo=36781\n\n(89) https://bugs.python.org/issue?@action=redirect&bpo=34556\n\n(90) https://bugs.python.org/issue?@action=redirect&bpo=20523\n\n(91) https://bugs.python.org/issue?@action=redirect&bpo=35551\n\n(92) https://bugs.python.org/issue?@action=redirect&bpo=19072\n\n(93) https://bugs.python.org/issue?@action=redirect&bpo=27575\n\n(94) https://bugs.python.org/issue?@action=redirect&bpo=30773\n\nFile: python3.12.info,  Node: Library<41>,  Next: Documentation<41>,  Prev: Core and Builtins<41>,  Up: Python 3 9 0 alpha 1\n\n1.22.41.3 Library\n.................\n\n- bpo-36589(1): The *note curses.updatelinescols(): c49. function\nnow returns 'None' instead of '1' on success.\n\n- bpo-38807(2): Update *note TypeError: 28e. messages for *note\nos.path.join(): 1474. to include *note os.PathLike: a9a. objects as\nacceptable input types.\n\n- bpo-38724(3): Add a repr for 'subprocess.Popen' objects.  Patch by\nAndrey Doroschenko.\n\n- bpo-38786(4): pydoc now recognizes and parses HTTPS URLs.  Patch by\npython273.\n\n- bpo-38785(5): Prevent asyncio from crashing if parent 'init' is\nnot called from a constructor of object derived from\n'asyncio.Future'.\n\n- bpo-38723(6): *note pdb: a0. now uses *note io.opencode(): 146a.\nto trigger auditing events.\n\n- bpo-27805(7): Allow opening pipes and other non-seekable files in\nappend mode with *note open(): 26e.\n\n- bpo-38438(8): Simplify the *note argparse: 6. usage message for\n'nargs=\"*\"'.\n\n- bpo-38761(9): WeakSet is now registered as a\ncollections.abc.MutableSet.\n\n- bpo-38716(10): logging: change RotatingHandler namer and rotator to\nclass-level attributes.  This stops init from setting them to\nNone in the case where a subclass defines them with eponymous\nmethods.\n\n- bpo-38713(11): Add *note os.PPIDFD: 738. constant, which may be\npassed to *note os.waitid(): bf5. to wait on a Linux process file\ndescriptor.\n\n- bpo-38692(12): Add *note asyncio.PidfdChildWatcher: 194, a\nLinux-specific child watcher implementation that polls process file\ndescriptors.\n\n- bpo-38692(13): Expose the Linux 'pidfdopen' syscall as *note\nos.pidfdopen(): 195.\n\n- bpo-38602(14): Added constants 'FOFDGETLK', 'FOFDSETLK' and\n'FOFDSETLKW' to the *note fcntl: 54. module.  Patch by Donghee\nNa.\n\n- bpo-38334(15): Fixed seeking backward on an encrypted\n'zipfile.ZipExtFile'.\n\n- bpo-38312(16): Add *note curses.getescdelay(): 709, *note\ncurses.setescdelay(): 70a, *note curses.gettabsize(): 70b, and\n*note curses.settabsize(): 70c. functions - by Anthony Sottile.\n\n- bpo-38586(17): Now *note fileConfig(): 98d. correctly sets the\n.name of handlers loaded.\n\n- bpo-38565(18): Add new cacheparameters() method for\nfunctools.lrucache() to better support pickling.\n\n- bpo-34679(19): asynci.ProactorEventLoop.close() now only calls\nsignal.setwakeupfd() in the main thread.\n\n- bpo-31202(20): The case the result of 'pathlib.WindowsPath.glob()'\nmatches now the case of the pattern for literal parts.\n\n- bpo-36321(21): Remove misspelled attribute.  The 3.8 changelog\nnoted that this would be removed in 3.9.\n\n- bpo-38521(22): Fixed erroneous equality comparison in\nstatistics.NormalDist().\n\n- bpo-38493(23): Added *note CLDKILLED: 736. and *note CLDSTOPPED:\n737. for 'sicode'.  Patch by Donghee Na.\n\n- bpo-38478(24): Fixed a bug in 'inspect.signature.bind()' that was\ncausing it to fail when handling a keyword argument with same name\nas positional-only parameter.  Patch by Pablo Galindo.\n\n- bpo-33604(25): Fixed 'hmac.new' and 'hmac.HMAC' to raise TypeError\ninstead of ValueError when the digestmod parameter, now required in\n3.8, is omitted.  Also clarified the hmac module documentation and\ndocstrings.\n\n- bpo-38378(26): Parameters 'out' and 'in' of *note os.sendfile():\n946. was renamed to 'outfd' and 'infd'.\n\n- bpo-38417(27): Added support for setting the umask in the child\nprocess to the subprocess module on POSIX systems.\n\n- bpo-38449(28): Revert PR 15522, which introduces a regression in\n*note mimetypes.guesstype(): 13b9. due to improper handling of\nfilenames as urls.\n\n- bpo-38431(29): Fix 'repr' method for 'dataclasses.InitVar' to\nsupport typing objects, patch by Samuel Colvin.\n\n- bpo-38109(30): Add missing *note stat.SIFDOOR: e2a, *note\nstat.SIFPORT: e2b, *note stat.SIFWHT: e2c, *note stat.SISDOOR():\n1735, *note stat.SISPORT(): 1736, and *note stat.SISWHT(): 1737.\nvalues to the Python implementation of *note stat: cb.\n\n- bpo-38422(31): Clarify docstrings of pathlib suffix(es)\n\n- bpo-38405(32): Nested subclasses of *note typing.NamedTuple: 1f9.\nare now pickleable.\n\n- bpo-38332(33): Prevent *note KeyError: 8cf. thrown by\n'encodedwords.decode()' when given an encoded-word with invalid\ncontent-type encoding from propagating all the way to\n'email.message.get()'.\n\n- bpo-38371(34): Deprecated the 'split()' method in\n'tkinter.TkappType' in favour of the 'splitlist()' method which\nhas more consistent and predicable behavior.\n\n- bpo-38341(35): Add *note smtplib.SMTPNotSupportedError: 1738. to\nthe *note smtplib: c4. exported names.\n\n- bpo-38319(36): sendfile() used in socket and shutil modules was\nraising OverflowError for files >= 2GiB on 32-bit architectures.\n(patch by Giampaolo Rodola)\n\n- bpo-38242(37): Revert the new asyncio Streams API\n\n- bpo-13153(38): OS native encoding is now used for converting\nbetween Python strings and Tcl objects.  This allows to display,\ncopy and paste to clipboard emoji and other non-BMP characters.\nConverting strings from Tcl to Python and back now never fails\n(except MemoryError).\n\n- bpo-38019(39): Correctly handle pause/resume reading of closed\nasyncio unix pipe.\n\n- bpo-38163(40): Child mocks will now detect their type as either\nsynchronous or asynchronous, asynchronous child mocks will be\nAsyncMocks and synchronous child mocks will be either MagicMock or\nMock (depending on their parent type).\n\n- bpo-38161(41): Removes AwaitEvent from AsyncMock.\n\n- bpo-38216(42): Allow the rare code that wants to send invalid http\nrequests from the 'http.client' library a way to do so.  The fixes\nfor bpo-30458(43) led to breakage for some projects that were\nrelying on this ability to test their own behavior in the face of\nbad requests.\n\n- bpo-28286(44): Deprecate opening *note GzipFile: 25e. for writing\nimplicitly.  Always specify the 'mode' argument for writing.\n\n- bpo-38108(45): Any synchronous magic methods on an AsyncMock now\nreturn a MagicMock.  Any asynchronous magic methods on a MagicMock\nnow return an AsyncMock.\n\n- bpo-38265(46): Update the 'length' parameter of *note os.pread():\n99d. to accept *note Pyssizet: 88d. instead of int.\n\n- bpo-38112(47): *note compileall: 1e. has a higher default recursion\nlimit and new command-line arguments for path manipulation,\nsymlinks handling, and multiple optimization levels.\n\n- bpo-38248(48): asyncio: Fix inconsistent immediate Task\ncancellation\n\n- bpo-38237(49): The arguments for the builtin pow function are more\ndescriptive.  They can now also be passed in as keywords.\n\n- bpo-34002(50): Improve efficiency in parts of email package by\nchanging while-pop to a for loop, using isdisjoint instead of set\nintersections.\n\n- bpo-38191(51): Constructors of *note NamedTuple: 1f9. and *note\nTypedDict: 153. types now accept arbitrary keyword argument names,\nincluding \"cls\", \"self\", \"typename\", \"typename\", \"fields\" and\n\"fields\".\n\n- bpo-38155(52): Add 'all' to *note datetime: 2e.  Patch by Tahia\nKhan.\n\n- bpo-38185(53): Fixed case-insensitive string comparison in *note\nsqlite3.Row: cd4. indexing.\n\n- bpo-38136(54): Changes AsyncMock call count and await count to be\ntwo different counters.  Now await count only counts when a\ncoroutine has been awaited, not when it has been called, and\nvice-versa.  Update the documentation around this.\n\n- bpo-37828(55): Fix default mock name in *note\nunittest.mock.Mock.assertcalled(): b48. exceptions.  Patch by\nAbraham Toriz Cruz.\n\n- bpo-38175(56): Fix a memory leak in comparison of *note\nsqlite3.Row: cd4. objects.\n\n- bpo-33936(57): hashlib no longer calls obsolete OpenSSL\ninitialization function with OpenSSL 1.1.0+.\n\n- bpo-34706(58): Preserve subclassing in\ninspect.Signature.fromcallable.\n\n- bpo-38153(59): Names of hashing algorithms from OpenSSL are now\nnormalized to follow Python's naming conventions.  For example\nOpenSSL uses sha3-512 instead of sha3512 or blake2b512 instead of\nblake2b.\n\n- bpo-38115(60): Fix a bug in dis.findlinestarts() where it would\nreturn invalid bytecode offsets.  Document that a code object's\ncolnotab can contain invalid bytecode offsets.\n\n- bpo-38148(61): Add slots to *note asyncio: 9. transport classes,\nwhich can reduce memory usage.\n\n- bpo-38142(62): The hashlib OpenSSL wrapper extension module is now\nPEP-384 compliant.\n\n- bpo-9216(63): hashlib constructors now support usedforsecurity flag\nto signal that a hashing algorithm is not used in a security\ncontext.\n\n- bpo-36991(64): Fixes a potential incorrect AttributeError exception\nescaping ZipFile.extract() in some unsupported input error\nsituations.\n\n- bpo-38134(65): Remove obsolete copy of PBKDF2HMACfast.  All\nsupported OpenSSL versions contain a fast implementation.\n\n- bpo-38132(66): The OpenSSL hashlib wrapper uses a simpler\nimplementation.  Several Macros and pointless caches are gone.  The\nhash name now comes from OpenSSL's EVP. The algorithm name stays\nthe same, except it is now always lower case.\n\n- bpo-38008(67): Fix parent class check in protocols to correctly\nidentify the module that provides a builtin protocol, instead of\nassuming they all come from the *note collections.abc: 1c. module\n\n- bpo-34037(68): For *note asyncio: 9, add a new coroutine\n'loop.shutdowndefaultexecutor()'.  The new coroutine provides an\nAPI to schedule an executor shutdown that waits on the threadpool\nto finish closing.  Also, *note asyncio.run(): 197. has been\nupdated to utilize the new coroutine.  Patch by Kyle Stanley.\n\n- bpo-37405(69): Fixed regression bug for socket.getsockname() for\nnon-CANISOTP AFCAN address family sockets by returning a 1-tuple\ninstead of string.\n\n- bpo-38121(70): Update parameter names on functions in\nimportlib.metadata matching the changes in the 0.22 release of\nimportlibmetadata.\n\n- bpo-38110(71): The os.closewalk() implementation now uses the libc\nfdwalk() API on platforms where it is available.\n\n- bpo-38093(72): Fixes AsyncMock so it doesn't crash when used with\nAsyncContextManagers or AsyncIterators.\n\n- bpo-37488(73): Add warning to 'datetime.utctimetuple()',\n'datetime.utcnow()' and 'datetime.utcfromtimestamp()' .\n\n- bpo-35640(74): Allow passing a *note path-like object: 957. as\n'directory' argument to the *note\nhttp.server.SimpleHTTPRequestHandler: 97d. class.  Patch by Ge'ry\nOgam.\n\n- bpo-38086(75): Update importlib.metadata with changes from\nimportlibmetadata 0.21(76).\n\n- bpo-37251(77): Remove 'code' check in AsyncMock that\nincorrectly evaluated function specs as async objects but failed to\nevaluate classes with 'await' but no 'code' attribute\ndefined as async objects.\n\n- bpo-38037(78): Fix reference counters in the *note signal: c1.\nmodule.\n\n- bpo-38066(79): Hide internal asyncio.Stream methods: feedeof(),\nfeeddata(), setexception() and settransport().\n\n- bpo-38059(80): inspect.py now uses sys.exit() instead of exit()\n\n- bpo-38049(81): Added command-line interface for the *note ast: 8.\nmodule.\n\n- bpo-37953(82): In *note typing: ff, improved the 'hash' and\n'eq' methods for 'ForwardReferences'.\n\n- bpo-38026(83): Fixed *note inspect.getattrstatic(): 1b2. used\n'isinstance' while it should avoid dynamic lookup.\n\n- bpo-35923(84): Update *note importlib.machinery.BuiltinImporter:\nafe. to use 'loader.ORIGIN' instead of a hardcoded value.  Patch\nby Donghee Na.\n\n- bpo-38010(85): In 'importlib.metadata' sync with\n'importlibmetadata' 0.20, clarifying behavior of 'files()' and\nfixing issue where only one requirement was returned for\n'requires()' on 'dist-info' packages.\n\n- bpo-38006(86): weakref.WeakValueDictionary defines a local remove()\nfunction used as callback for weak references.  This function was\ncreated with a closure.  Modify the implementation to avoid the\nclosure.\n\n- bpo-37995(87): Added the 'indent' option to *note ast.dump(): 6fd.\nwhich allows it to produce a multiline indented output.\n\n- bpo-34410(88): Fixed a crash in the 'tee()' iterator when re-enter\nit.  RuntimeError is now raised in this case.\n\n- bpo-37140(89): Fix a ctypes regression of Python 3.8.  When a\nctypes.Structure is passed by copy to a function, ctypes internals\ncreated a temporary object which had the side effect of calling the\nstructure finalizer (del) twice.  The Python semantics requires\na finalizer to be called exactly once.  Fix ctypes internals to no\nlonger call the finalizer twice.\n\n- bpo-37587(90): 'json.scanstring' is now up to 3x faster when there\nare many backslash escaped characters in the JSON string.\n\n- bpo-37834(91): Prevent shutil.rmtree exception when built on\nnon-Windows system without fd system call support, like older\nversions of macOS.\n\n- bpo-10978(92): Semaphores and BoundedSemaphores can now release\nmore than one waiting thread at a time.\n\n- bpo-37972(93): Subscripts to the 'unittest.mock.call' objects now\nreceive the same chaining mechanism as any other custom attributes,\nso that the following usage no longer raises a 'TypeError':\n\n'call().foo().getitem('bar')'\n\nPatch by blhsing\n\n- bpo-37965(94): Fix C compiler warning caused by\ndistutils.ccompiler.CCompiler.hasfunction.\n\n- bpo-37964(95): Add 'FGETPATH' command to *note fcntl: 54.\n\n- bpo-37960(96): 'repr()' of buffered and text streams now silences\nonly expected exceptions when get the value of \"name\" and \"mode\"\nattributes.\n\n- bpo-37961(97): Add a 'totalnframe' field to the traces collected\nby the tracemalloc module.  This field indicates the original\nnumber of frames before it was truncated.\n\n- bpo-37951(98): Most features of the subprocess module now work\nagain in subinterpreters.  Only 'preexecfn' is restricted in\nsubinterpreters.\n\n- bpo-36205(99): Fix the rusage implementation of time.processtime()\nto correctly report the sum of the system and user CPU time.\n\n- bpo-37950(100): Fix *note ast.dump(): 6fd. when call with\nincompletely initialized node.\n\n- bpo-34679(101): Restores instantiation of Windows IOCP event loops\nfrom the non-main thread.\n\n- bpo-36917(102): Add default implementation of the *note\nast.NodeVisitor.visitConstant(): 89c. method which emits a\ndeprecation warning and calls corresponding methods 'visitNum()',\n'visitStr()', etc.\n\n- bpo-37798(103): Update teststatistics.py to verify that the\nstatistics module works well for both C and Python implementations.\nPatch by Donghee Na\n\n- bpo-26589(104): Added a new status code to the http module: 451\nUNAVAILABLEFORLEGALREASONS\n\n- bpo-37915(105): Fix a segmentation fault that appeared when\ncomparing instances of 'datetime.timezone' and 'datetime.tzinfo'\nobjects.  Patch by Pablo Galindo.\n\n- bpo-32554(106): Deprecate having random.seed() call hash on\narbitrary types.\n\n- bpo-9938(107): Add optional keyword argument 'exitonerror' for\n'ArgumentParser'.\n\n- bpo-37851(108): The *note faulthandler: 53. module no longer\nallocates its alternative stack at Python startup.  Now the stack\nis only allocated at the first faulthandler usage.\n\n- bpo-32793(109): Fix a duplicated debug message when *note\nsmtplib.SMTP.connect(): 1739. is called.\n\n- bpo-37885(110): venv: Don't generate unset variable warning on\ndeactivate.\n\n- bpo-37868(111): Fix dataclasses.isdataclass when given an instance\nthat never raises AttributeError in getattr.  That is, an\nobject that returns something for dataclassfields even if it's\nnot a dataclass.\n\n- bpo-37811(112): Fix 'socket' module's 'socket.connect(address)'\nfunction being unable to establish connection in case of\ninterrupted system call.  The problem was observed on all OSes\nwhich 'poll(2)' system call can take only non-negative integers and\n-1 as a timeout value.\n\n- bpo-37863(113): Optimizations for Fraction.hash suggested by\nTim Peters.\n\n- bpo-21131(114): Fix 'faulthandler.register(chain=True)' stack.\nfaulthandler now allocates a dedicated stack of 'SIGSTKSZ*2' bytes,\ninstead of just 'SIGSTKSZ' bytes.  Calling the previous signal\nhandler in faulthandler signal handler uses more than 'SIGSTKSZ'\nbytes of stack memory on some platforms.\n\n- bpo-37798(115): Add C fastpath for statistics.NormalDist.invcdf()\nPatch by Donghee Na\n\n- bpo-37804(116): Remove the deprecated method\n'threading.Thread.isAlive()'.  Patch by Donghee Na.\n\n- bpo-37819(117): Add Fraction.asintegerratio() to match the\ncorresponding methods in bool, int, float, and decimal.\n\n- bpo-14465(118): Add an xml.etree.ElementTree.indent() function for\npretty-printing XML trees.  Contributed by Stefan Behnel.\n\n- bpo-37810(119): Fix *note difflib: 34. '?' hint in diff output when\ndealing with tabs.  Patch by Anthony Sottile.\n\n- bpo-37772(120): In 'zipfile.Path', when adding implicit dirs,\nensure that ancestral directories are added and that duplicates are\nexcluded.\n\n- bpo-18578(121): Renamed and documented 'test.bytecodehelper' as\n'test.support.bytecodehelper'.  Patch by Joannah Nanjekye.\n\n- bpo-37785(122): Fix xgettext warnings in *note argparse: 6.\n\n- bpo-34488(123): 'writelines()' method of *note io.BytesIO: d08. is\nnow slightly faster when many small lines are passed.  Patch by\nSergey Fedoseev.\n\n- bpo-37449(124): 'ensurepip' now uses\n'importlib.resources.readbinary()' to read data instead of\n'pkgutil.getdata()'.  Patch by Joannah Nanjekye.\n\n- bpo-28292(125): Mark calendar.py helper functions as being private.\nThe follows PEP 8 guidance to maintain the style conventions in the\nmodule and it addresses a known case of user confusion.\n\n- bpo-18049(126): Add definition of THREADSTACKSIZE for AIX in\nPython/threadpthread.h The default thread stacksize caused crashes\nwith the default recursion limit Patch by M Felt\n\n- bpo-37742(127): The logging.getLogger() API now returns the root\nlogger when passed the name 'root', whereas previously it returned\na non-root logger named 'root'.  This could affect cases where user\ncode explicitly wants a non-root logger named 'root', or\ninstantiates a logger using logging.getLogger(name) in some\ntop-level module called 'root.py'.\n\n- bpo-37738(128): Fix the implementation of curses 'addch(str,\ncolorpair)': pass the color pair to 'setcchar()', instead of\nalways passing 0 as the color pair.\n\n- bpo-37723(129): Fix performance regression on regular expression\nparsing with huge character sets.  Patch by Yann Vaginay.\n\n- bpo-35943(130): The function *note PyImportGetModule(): 9f7. now\nensures any module it returns is fully initialized.  Patch by\nJoannah Nanjekye.\n\n- bpo-32178(131): Fix IndexError in *note email: 37. package when\ntrying to parse invalid address fields starting with ':'.\n\n- bpo-37268(132): The 'parser' module is deprecated and will be\nremoved in future versions of Python.\n\n- bpo-11953(133): Completing WSA* error codes in *note socket: c6.\n\n- bpo-37685(134): Fixed comparisons of *note datetime.timedelta: 7f3.\nand *note datetime.timezone: f2f.\n\n- bpo-37697(135): Synchronize 'importlib.metadata' with\nimportlibmetadata 0.19(136), improving handling of EGG-INFO files\nand fixing a crash when entry point names contained colons.\n\n- bpo-37695(137): Correct *note curses.ungetwch(): f0f. error\nmessage.  Patch by Anthony Sottile.\n\n- bpo-37689(138): Add 'isrelativeto()' in 'PurePath' to determine\nwhether or not one path is relative to another.\n\n- bpo-29553(139): Fixed *note argparse.ArgumentParser.formatusage():\n173a. for mutually exclusive groups.  Patch by Andrew Nester.\n\n- bpo-37691(140): Let math.dist() accept coordinates as sequences (or\niterables) rather than just tuples.\n\n- bpo-37685(141): Fixed 'eq', 'lt' etc implementations in\nsome classes.  They now return *note NotImplemented: 5c5. for\nunsupported type of the other operand.  This allows the other\noperand to play role (for example the equality comparison with\n*note ANY: 173b. will return 'True').\n\n- bpo-37354(142): Make Activate.ps1 Powershell script static to allow\nfor signing it.\n\n- bpo-37664(143): Update wheels bundled with ensurepip (pip 19.2.3\nand setuptools 41.2.0)\n\n- bpo-37663(144): Bring consistency to venv shell activation scripts\nby always using VENVPROMPT.\n\n- bpo-37642(145): Allowed the pure Python implementation of *note\ndatetime.timezone: f2f. to represent sub-minute offsets close to\nminimum and maximum boundaries, specifically in the ranges (23:59,\n24:00) and (-23:59, 24:00).  Patch by Ngalim Siregar\n\n- bpo-36161(146): In *note posix: a8, use 'ttynamer' instead of\n'ttyname' for thread safety.\n\n- bpo-36324(147): Make internal attributes for\nstatistics.NormalDist() private.\n\n- bpo-37555(148): Fix 'NonCallableMock.callmatcher' returning tuple\ninstead of 'Call' object when 'self.specsignature' exists.\nPatch by Elizabeth Uselton\n\n- bpo-29446(149): Make 'from tkinter import *' import only the\nexpected objects.\n\n- bpo-16970(150): Adding a value error when an invalid value in\npassed to nargs Patch by Robert Leenders\n\n- bpo-34443(151): Exceptions from *note enum: 51. now use the\n'qualname' of the enum class in the exception message instead of\nthe 'name'.\n\n- bpo-37491(152): Fix 'IndexError' when parsing email headers with\nunexpectedly ending bare-quoted string value.  Patch by Abhilash\nRaj.\n\n- bpo-37587(153): Make json.loads faster for long strings.  (Patch by\nMarco Paolini)\n\n- bpo-18378(154): Recognize \"UTF-8\" as a valid value for LCCTYPE in\nlocale.parselocalename.\n\n- bpo-37579(155): Return *note NotImplemented: 5c5. in Python\nimplementation of 'eq' for *note timedelta: 7f3. and *note\ntime: 6a5. when the other object being compared is not of the same\ntype to match C implementation.  Patch by Karthikeyan Singaravelan.\n\n- bpo-21478(156): Record calls to parent when autospecced object is\nattached to a mock using 'unittest.mock.attachmock()'.  Patch by\nKarthikeyan Singaravelan.\n\n- bpo-37531(157): \"python3 -m test -jN -timeout=TIMEOUT\" now kills a\nworker process if it runs longer than 'TIMEOUT' seconds.\n\n- bpo-37482(158): Fix serialization of display name in originator or\ndestination address fields with both encoded words and special\nchars.\n\n- bpo-36993(159): Improve error reporting for corrupt zip files with\nbad zip64 extra data.  Patch by Daniel Hillier.\n\n- bpo-37502(160): pickle.loads() no longer raises TypeError when the\nbuffers argument is set to None\n\n- bpo-37520(161): Correct behavior for zipfile.Path.parent when the\npath object identifies a subdirectory.\n\n- bpo-18374(162): Fix the '.coloffset' attribute of nested *note\nast.BinOp: 173c. instances which had a too large value in some\nsituations.\n\n- bpo-37424(163): Fixes a possible hang when using a timeout on\n'subprocess.run()' while capturing output.  If the child process\nspawned its own children or otherwise connected its stdout or\nstderr handles with another process, we could hang after the\ntimeout was reached and our child was killed when attempting to\nread final output from the pipes.\n\n- bpo-37421(164): Fix 'multiprocessing.util.gettempdir()'\nfinalizer: clear also the 'tempdir' configuration of the current\nprocess, so next call to 'gettempdir()' will create a new\ntemporary directory, rather than reusing the removed temporary\ndirectory.\n\n- bpo-37481(165): The distutils 'bdistwininst' command is deprecated\nin Python 3.8, use 'bdistwheel' (wheel packages) instead.\n\n- bpo-37479(166): When 'Enum.str' is overridden in a derived\nclass, the override will be used by 'Enum.format' regardless of\nwhether mixin classes are present.\n\n- bpo-37440(167): http.client now enables TLS 1.3 post-handshake\nauthentication for default context or if a certfile is passed to\nHTTPSConnection.\n\n- bpo-37437(168): Update vendorized expat version to 2.2.7.\n\n- bpo-37428(169): SSLContext.posthandshakeauth = True no longer\nsets SSLVERIFYPOSTHANDSHAKE verify flag for client connections.\nAlthough the option is documented as ignored for clients, OpenSSL\nimplicitly enables cert chain validation when the flag is set.\n\n- bpo-37420(170): *note os.schedsetaffinity(): f7e. now correctly\nhandles errors that arise during iteration over its 'mask'\nargument.  Patch by Brandt Bucher.\n\n- bpo-37412(171): The *note os.getcwdb(): 8c2. function now uses the\nUTF-8 encoding on Windows, rather than the ANSI code page: see PEP\n529(172) for the rationale.  The function is no longer deprecated\non Windows.\n\n- bpo-37406(173): The sqlite3 module now raises TypeError, rather\nthan ValueError, if operation argument type is not str: execute(),\nexecutemany() and calling a connection.\n\n- bpo-29412(174): Fix IndexError in parsing a header value ending\nunexpectedly.  Patch by Abhilash Raj.\n\n- bpo-36546(175): The 'dist' argument for statistics.quantiles() is\nnow positional only.  The current name doesn't reflect that the\nargument can be either a dataset or a distribution.  Marking the\nparameter as positional avoids confusion and makes it possible to\nchange the name later.\n\n- bpo-37394(176): Fix a bug that was causing the *note queue: b1.\nmodule to fail if the accelerator module was not available.  Patch\nby Pablo Galindo.\n\n- bpo-37376(177): *note pprint: a9. now has support for *note\ntypes.SimpleNamespace: 745.  Patch by Carl Bordum Hansen.\n\n- bpo-26967(178): An *note ArgumentParser: 28f. with\n'allowabbrev=False' no longer disables grouping of short flags,\nsuch as '-vv', but only disables abbreviation of long flags as\ndocumented.  Patch by Zac Hatfield-Dodds.\n\n- bpo-37212(179): *note unittest.mock.call(): 173d. now preserves the\norder of keyword arguments in repr output.  Patch by Karthikeyan\nSingaravelan.\n\n- bpo-37372(180): Fix error unpickling datetime.time objects from\nPython 2 with seconds>=24.  Patch by Justin Blanchard.\n\n- bpo-37345(181): Add formal support for UDPLITE sockets.  Support\nwas present before, but it is now easier to detect support with\n'hasattr(socket, 'IPPROTOUDPLITE')' and there are constants\ndefined for each of the values needed: 'socket.IPPROTOUDPLITE',\n'UDPLITESENDCSCOV', and 'UDPLITERECVCSCOV'.  Patch by Gabe\nAppleton.\n\n- bpo-37358(182): Optimized 'functools.partial' by using vectorcall.\n\n- bpo-37347(183): *note sqlite3.Connection.createaggregate(): 173e,\n*note sqlite3.Connection.createfunction(): 173f, *note\nsqlite3.Connection.setauthorizer(): 440, *note\nsqlite3.Connection.setprogresshandler(): 1740. *note\nsqlite3.Connection.settracecallback(): fb3. methods lead to\nsegfaults if some of these methods are called twice with an equal\nobject but not the same.  Now callbacks are stored more carefully.\nPatch by Aleksandr Balezin.\n\n- bpo-37163(184): The 'obj' argument of *note dataclasses.replace():\n1629. is positional-only now.\n\n- bpo-37085(185): Add the optional Linux SocketCAN Broadcast Manager\nconstants, used as flags to configure the BCM behaviour, in the\nsocket module.  Patch by Karl Ding.\n\n- bpo-37328(186): 'HTMLParser.unescape' is removed.  It was\nundocumented and deprecated since Python 3.4.\n\n- bpo-37305(187): Add .webmanifest -> application/manifest+json to\nlist of recognized file types and content type headers\n\n- bpo-37320(188): 'aifc.openfp()' alias to 'aifc.open()',\n'sunau.openfp()' alias to 'sunau.open()', and 'wave.openfp()' alias\nto 'wave.open()' have been removed.  They were deprecated since\nPython 3.7.\n\n- bpo-37315(189): Deprecated accepting floats with integral value\n(like '5.0') in *note math.factorial(): 765.\n\n- bpo-37312(190): 'dummythread' and 'dummythreading' modules have\nbeen removed.  These modules were deprecated since Python 3.7 which\nrequires threading support.\n\n- bpo-33972(191): Email with single part but content-type set to\n'multipart/*' doesn't raise AttributeError anymore.\n\n- bpo-37280(192): Use threadpool for reading from file for sendfile\nfallback mode.\n\n- bpo-37279(193): Fix asyncio sendfile support when sendfile sends\nextra data in fallback mode.\n\n- bpo-19865(194): *note ctypes.createunicodebuffer(): 1741. now\nalso supports non-BMP characters on platforms with 16-bit 'wchart'\n(for example, Windows and AIX).\n\n- bpo-37266(195): In a subinterpreter, spawning a daemon thread now\nraises an exception.  Daemon threads were never supported in\nsubinterpreters.  Previously, the subinterpreter finalization\ncrashed with a Python fatal error if a daemon thread was still\nrunning.\n\n- bpo-37210(196): Allow pure Python implementation of *note pickle:\na1. to work even when the C 'pickle' module is unavailable.\n\n- bpo-21872(197): Fix *note lzma: 85.: module decompresses data\nincompletely.  When decompressing a FORMATALONE format file, and\nit doesn't have the end marker, sometimes the last one to dozens\nbytes can't be output.  Patch by Ma Lin.\n\n- bpo-35922(198): Fix 'RobotFileParser.crawldelay()' and\n'RobotFileParser.requestrate()' to return 'None' rather than raise\n*note AttributeError: 395. when no relevant rule is defined in the\nrobots.txt file.  Patch by Re'mi Lapeyre.\n\n- bpo-35766(199): Change the format of featureversion to be a\n(major, minor) tuple.\n\n- bpo-36607(200): Eliminate *note RuntimeError: 17a. raised by *note\nasyncio.alltasks(): 777. if internal tasks weak set is changed by\nanother thread during iteration.\n\n- bpo-18748(201): 'pyio.IOBase' destructor now does nothing if\ngetting the 'closed' attribute fails to better mimic 'io.IOBase'\nfinalizer.\n\n- bpo-36402(202): Fix a race condition at Python shutdown when\nwaiting for threads.  Wait until the Python thread state of all\nnon-daemon threads get deleted (join all non-daemon threads),\nrather than just wait until non-daemon Python threads complete.\n\n- bpo-37206(203): Default values which cannot be represented as\nPython objects no longer improperly represented as 'None' in\nfunction signatures.\n\n- bpo-37111(204): Added 'encoding' and 'errors' keyword parameters to\n'logging.basicConfig'.\n\n- bpo-12144(205): Ensure cookies with 'expires' attribute are handled\nin 'CookieJar.makecookies()'.\n\n- bpo-34886(206): Fix an unintended ValueError from *note\nsubprocess.run(): 9c9. when checking for conflicting 'input' and\n'stdin' or 'captureoutput' and 'stdout' or 'stderr' args when they\nwere explicitly provided but with 'None' values within a passed in\n'kwargs' dict rather than as passed directly by name.  Patch\ncontributed by Re'mi Lapeyre.\n\n- bpo-37173(207): The exception message for 'inspect.getfile()' now\ncorrectly reports the passed class rather than the builtins module.\n\n- bpo-37178(208): Give math.perm() a one argument form that means the\nsame as math.factorial().\n\n- bpo-37178(209): For math.perm(n, k), let k default to n, giving the\nsame result as factorial.\n\n- bpo-37165(210): Converted collections.countelements to use the\nArgument Clinic.\n\n- bpo-34767(211): Do not always create a *note collections.deque:\n3a0. in *note asyncio.Lock: 89f.\n\n- bpo-37158(212): Speed-up statistics.fmean() by switching from a\nfunction to a generator.\n\n- bpo-34282(213): Remove 'Enum.convert' method, deprecated in 3.8.\n\n- bpo-37150(214): 'argparse.ActionsContainer.addargument' now\nthrows error, if someone accidentally pass FileType class object\ninstead of instance of FileType as 'type' argument.\n\n- bpo-28724(215): The socket module now has the *note\nsocket.sendfds(): 751. and 'socket.recv.fds()' methods.\nContributed by Joannah Nanjekye, Shinya Okano and Victor Stinner.\n\n- bpo-35621(216): Support running asyncio subprocesses when execution\nevent loop in a thread on UNIX.\n\n- bpo-36520(217): Lengthy email headers with UTF-8 characters are now\nproperly encoded when they are folded.  Patch by Jeffrey Kintscher.\n\n- bpo-30835(218): Fixed a bug in email parsing where a message with\ninvalid bytes in content-transfer-encoding of a multipart message\ncan cause an AttributeError.  Patch by Andrew Donnellan.\n\n- bpo-31163(219): pathlib.Path instance's rename and replace methods\nnow return the new Path instance.\n\n- bpo-25068(220): *note urllib.request.ProxyHandler: 1742. now\nlowercases the keys of the passed dictionary.\n\n- bpo-26185(221): Fix *note repr(): 5f0. on empty 'ZipInfo' object.\nPatch by Mickae\"l Schoentgen.\n\n- bpo-21315(222): Email headers containing RFC2047 encoded words are\nparsed despite the missing whitespace, and a defect registered.\nAlso missing trailing whitespace after encoded words is now\nregistered as a defect.\n\n- bpo-31904(223): Port testdatetime to VxWorks: skip zoneinfo tests\non VxWorks\n\n- bpo-35805(224): Add parser for Message-ID header and add it to\ndefault HeaderRegistry.  This should prevent folding of Message-ID\nusing RFC 2048 encoded words.\n\n- bpo-36871(225): Ensure method signature is used instead of\nconstructor signature of a class while asserting mock object\nagainst method calls.  Patch by Karthikeyan Singaravelan.\n\n- bpo-35070(226): posix.getgrouplist() now works correctly when the\nuser belongs to NGROUPSMAX supplemental groups.  Patch by Jeffrey\nKintscher.\n\n- bpo-31783(227): Fix race condition in ThreadPoolExecutor when\nworker threads are created during interpreter shutdown.\n\n- bpo-36582(228): Fix 'UserString.encode()' to correctly return\n'bytes' rather than a 'UserString' instance.\n\n- bpo-32424(229): Deprecate xml.etree.ElementTree.Element.copy() in\nfavor of copy.copy().\n\nPatch by Gordon P. Hemsley\n\n- bpo-36564(230): Fix infinite loop in email header folding logic\nthat would be triggered when an email policy's maxlinelength is\nnot long enough to include the required markup and any values in\nthe message.  Patch by Paul Ganssle\n\n- bpo-36543(231): Removed methods Element.getchildren(),\nElement.getiterator() and ElementTree.getiterator() and the\nxml.etree.cElementTree module.\n\n- bpo-36409(232): Remove the old plistlib API deprecated in Python\n3.4\n\n- bpo-36302(233): distutils sorts source file lists so that Extension\n.so files build more reproducibly by default\n\n- bpo-36250(234): Ignore 'ValueError' from 'signal' with\n'interaction' in non-main thread.\n\n- bpo-36046(235): Added 'user', 'group' and 'extragroups' parameters\nto the subprocess.Popen constructor.  Patch by Patrick McLean.\n\n- bpo-32627(236): Fix compile error when 'uuid' headers conflicting\nincluded.\n\n- bpo-35800(237): Deprecate 'smtpd.MailmanProxy' ready for future\nremoval.\n\n- bpo-35168(238): *note shlex.shlex.punctuationchars: 1743. is now a\nread-only property.\n\n- bpo-8538(239): Add support for boolean actions like '--foo' and\n'--no-foo' to argparse.  Patch contributed by Re'mi Lapeyre.\n\n- bpo-20504(240): Fixes a bug in *note cgi: 13. module when a\nmultipart/form-data request has no 'Content-Length' header.\n\n- bpo-25988(241): The abstract base classes in *note collections.abc:\n1c. no longer are exposed in the regular *note collections: 1b.\nmodule.\n\n- bpo-11122(242): Distutils won't check for rpmbuild in specified\npaths only.\n\n- bpo-34775(243): Division handling of PurePath now returns\nNotImplemented instead of raising a TypeError when passed something\nother than an instance of str or PurePath.  Patch by Roger Aiudi.\n\n- bpo-34749(244): *note binascii.a2bbase64(): 1744. is now up to 2\ntimes faster.  Patch by Sergey Fedoseev.\n\n- bpo-34519(245): Add additional aliases for HP Roman 8.  Patch by\nMichael Osipov.\n\n- bpo-28009(246): Fix uuid.getnode() on platforms with '.' as MAC\nAddr delimiter as well fix for MAC Addr format that omits a leading\n0 in MAC Addr values.  Currently, AIX is the only know platform\nwith these settings.  Patch by Michael Felt.\n\n- bpo-30618(247): Add *note readlink(): 73d.  Patch by Girts\nFolkmanis.\n\n- bpo-32498(248): Made *note urllib.parse.unquote(): 14d8. accept\nbytes in addition to strings.  Patch by Stein Karlsen.\n\n- bpo-33348(249): lib2to3 now recognizes expressions after '*' and\n'' like in 'f(*[] or [])'.\n\n- bpo-32689(250): Update *note shutil.move(): 889. function to allow\nfor Path objects to be used as source argument.  Patch by Emily\nMorehouse and Maxwell \"5.13b\" McKinnon.\n\n- bpo-32820(251): Added 'format' to IPv4 and IPv6 classes.\nAlways outputs a fully zero-padded string.  Supports b/x/n\nmodifiers (bin/hex/native format).  Native format for IPv4 is bin,\nnative format for IPv6 is hex.  Also supports '#' and ''\nmodifiers.\n\n- bpo-27657(252): Fix urllib.parse.urlparse() with numeric paths.  A\nstring like \"path:80\" is no longer parsed as a path but as a scheme\n(\"path\") and a path (\"80\").\n\n- bpo-4963(253): Fixed non-deterministic behavior related to\nmimetypes extension mapping and module reinitialization.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36589\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=38807\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=38724\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=38786\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=38785\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=38723\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=27805\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=38438\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=38761\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=38716\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=38713\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=38692\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=38692\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=38602\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=38334\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=38312\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=38586\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=38565\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=34679\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=31202\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=36321\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=38521\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=38493\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=38478\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=33604\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=38378\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=38417\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=38449\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=38431\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=38109\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=38422\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=38405\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=38332\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=38371\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=38341\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=38319\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=38242\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=13153\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=38019\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=38163\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=38161\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=38216\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=30458\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=28286\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=38108\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=38265\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=38112\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=38248\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=38237\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=34002\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=38191\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=38155\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=38185\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=38136\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=37828\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=38175\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=33936\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=34706\n\n(59) https://bugs.python.org/issue?@action=redirect&bpo=38153\n\n(60) https://bugs.python.org/issue?@action=redirect&bpo=38115\n\n(61) https://bugs.python.org/issue?@action=redirect&bpo=38148\n\n(62) https://bugs.python.org/issue?@action=redirect&bpo=38142\n\n(63) https://bugs.python.org/issue?@action=redirect&bpo=9216\n\n(64) https://bugs.python.org/issue?@action=redirect&bpo=36991\n\n(65) https://bugs.python.org/issue?@action=redirect&bpo=38134\n\n(66) https://bugs.python.org/issue?@action=redirect&bpo=38132\n\n(67) https://bugs.python.org/issue?@action=redirect&bpo=38008\n\n(68) https://bugs.python.org/issue?@action=redirect&bpo=34037\n\n(69) https://bugs.python.org/issue?@action=redirect&bpo=37405\n\n(70) https://bugs.python.org/issue?@action=redirect&bpo=38121\n\n(71) https://bugs.python.org/issue?@action=redirect&bpo=38110\n\n(72) https://bugs.python.org/issue?@action=redirect&bpo=38093\n\n(73) https://bugs.python.org/issue?@action=redirect&bpo=37488\n\n(74) https://bugs.python.org/issue?@action=redirect&bpo=35640\n\n(75) https://bugs.python.org/issue?@action=redirect&bpo=38086\n\n(76)\nhttps://gitlab.com/python-devs/importlibmetadata/blob/0.21/importlibmetadata/docs/changelog.rst\n\n(77) https://bugs.python.org/issue?@action=redirect&bpo=37251\n\n(78) https://bugs.python.org/issue?@action=redirect&bpo=38037\n\n(79) https://bugs.python.org/issue?@action=redirect&bpo=38066\n\n(80) https://bugs.python.org/issue?@action=redirect&bpo=38059\n\n(81) https://bugs.python.org/issue?@action=redirect&bpo=38049\n\n(82) https://bugs.python.org/issue?@action=redirect&bpo=37953\n\n(83) https://bugs.python.org/issue?@action=redirect&bpo=38026\n\n(84) https://bugs.python.org/issue?@action=redirect&bpo=35923\n\n(85) https://bugs.python.org/issue?@action=redirect&bpo=38010\n\n(86) https://bugs.python.org/issue?@action=redirect&bpo=38006\n\n(87) https://bugs.python.org/issue?@action=redirect&bpo=37995\n\n(88) https://bugs.python.org/issue?@action=redirect&bpo=34410\n\n(89) https://bugs.python.org/issue?@action=redirect&bpo=37140\n\n(90) https://bugs.python.org/issue?@action=redirect&bpo=37587\n\n(91) https://bugs.python.org/issue?@action=redirect&bpo=37834\n\n(92) https://bugs.python.org/issue?@action=redirect&bpo=10978\n\n(93) https://bugs.python.org/issue?@action=redirect&bpo=37972\n\n(94) https://bugs.python.org/issue?@action=redirect&bpo=37965\n\n(95) https://bugs.python.org/issue?@action=redirect&bpo=37964\n\n(96) https://bugs.python.org/issue?@action=redirect&bpo=37960\n\n(97) https://bugs.python.org/issue?@action=redirect&bpo=37961\n\n(98) https://bugs.python.org/issue?@action=redirect&bpo=37951\n\n(99) https://bugs.python.org/issue?@action=redirect&bpo=36205\n\n(100) https://bugs.python.org/issue?@action=redirect&bpo=37950\n\n(101) https://bugs.python.org/issue?@action=redirect&bpo=34679\n\n(102) https://bugs.python.org/issue?@action=redirect&bpo=36917\n\n(103) https://bugs.python.org/issue?@action=redirect&bpo=37798\n\n(104) https://bugs.python.org/issue?@action=redirect&bpo=26589\n\n(105) https://bugs.python.org/issue?@action=redirect&bpo=37915\n\n(106) https://bugs.python.org/issue?@action=redirect&bpo=32554\n\n(107) https://bugs.python.org/issue?@action=redirect&bpo=9938\n\n(108) https://bugs.python.org/issue?@action=redirect&bpo=37851\n\n(109) https://bugs.python.org/issue?@action=redirect&bpo=32793\n\n(110) https://bugs.python.org/issue?@action=redirect&bpo=37885\n\n(111) https://bugs.python.org/issue?@action=redirect&bpo=37868\n\n(112) https://bugs.python.org/issue?@action=redirect&bpo=37811\n\n(113) https://bugs.python.org/issue?@action=redirect&bpo=37863\n\n(114) https://bugs.python.org/issue?@action=redirect&bpo=21131\n\n(115) https://bugs.python.org/issue?@action=redirect&bpo=37798\n\n(116) https://bugs.python.org/issue?@action=redirect&bpo=37804\n\n(117) https://bugs.python.org/issue?@action=redirect&bpo=37819\n\n(118) https://bugs.python.org/issue?@action=redirect&bpo=14465\n\n(119) https://bugs.python.org/issue?@action=redirect&bpo=37810\n\n(120) https://bugs.python.org/issue?@action=redirect&bpo=37772\n\n(121) https://bugs.python.org/issue?@action=redirect&bpo=18578\n\n(122) https://bugs.python.org/issue?@action=redirect&bpo=37785\n\n(123) https://bugs.python.org/issue?@action=redirect&bpo=34488\n\n(124) https://bugs.python.org/issue?@action=redirect&bpo=37449\n\n(125) https://bugs.python.org/issue?@action=redirect&bpo=28292\n\n(126) https://bugs.python.org/issue?@action=redirect&bpo=18049\n\n(127) https://bugs.python.org/issue?@action=redirect&bpo=37742\n\n(128) https://bugs.python.org/issue?@action=redirect&bpo=37738\n\n(129) https://bugs.python.org/issue?@action=redirect&bpo=37723\n\n(130) https://bugs.python.org/issue?@action=redirect&bpo=35943\n\n(131) https://bugs.python.org/issue?@action=redirect&bpo=32178\n\n(132) https://bugs.python.org/issue?@action=redirect&bpo=37268\n\n(133) https://bugs.python.org/issue?@action=redirect&bpo=11953\n\n(134) https://bugs.python.org/issue?@action=redirect&bpo=37685\n\n(135) https://bugs.python.org/issue?@action=redirect&bpo=37697\n\n(136)\nhttps://gitlab.com/python-devs/importlibmetadata/-/milestones/20\n\n(137) https://bugs.python.org/issue?@action=redirect&bpo=37695\n\n(138) https://bugs.python.org/issue?@action=redirect&bpo=37689\n\n(139) https://bugs.python.org/issue?@action=redirect&bpo=29553\n\n(140) https://bugs.python.org/issue?@action=redirect&bpo=37691\n\n(141) https://bugs.python.org/issue?@action=redirect&bpo=37685\n\n(142) https://bugs.python.org/issue?@action=redirect&bpo=37354\n\n(143) https://bugs.python.org/issue?@action=redirect&bpo=37664\n\n(144) https://bugs.python.org/issue?@action=redirect&bpo=37663\n\n(145) https://bugs.python.org/issue?@action=redirect&bpo=37642\n\n(146) https://bugs.python.org/issue?@action=redirect&bpo=36161\n\n(147) https://bugs.python.org/issue?@action=redirect&bpo=36324\n\n(148) https://bugs.python.org/issue?@action=redirect&bpo=37555\n\n(149) https://bugs.python.org/issue?@action=redirect&bpo=29446\n\n(150) https://bugs.python.org/issue?@action=redirect&bpo=16970\n\n(151) https://bugs.python.org/issue?@action=redirect&bpo=34443\n\n(152) https://bugs.python.org/issue?@action=redirect&bpo=37491\n\n(153) https://bugs.python.org/issue?@action=redirect&bpo=37587\n\n(154) https://bugs.python.org/issue?@action=redirect&bpo=18378\n\n(155) https://bugs.python.org/issue?@action=redirect&bpo=37579\n\n(156) https://bugs.python.org/issue?@action=redirect&bpo=21478\n\n(157) https://bugs.python.org/issue?@action=redirect&bpo=37531\n\n(158) https://bugs.python.org/issue?@action=redirect&bpo=37482\n\n(159) https://bugs.python.org/issue?@action=redirect&bpo=36993\n\n(160) https://bugs.python.org/issue?@action=redirect&bpo=37502\n\n(161) https://bugs.python.org/issue?@action=redirect&bpo=37520\n\n(162) https://bugs.python.org/issue?@action=redirect&bpo=18374\n\n(163) https://bugs.python.org/issue?@action=redirect&bpo=37424\n\n(164) https://bugs.python.org/issue?@action=redirect&bpo=37421\n\n(165) https://bugs.python.org/issue?@action=redirect&bpo=37481\n\n(166) https://bugs.python.org/issue?@action=redirect&bpo=37479\n\n(167) https://bugs.python.org/issue?@action=redirect&bpo=37440\n\n(168) https://bugs.python.org/issue?@action=redirect&bpo=37437\n\n(169) https://bugs.python.org/issue?@action=redirect&bpo=37428\n\n(170) https://bugs.python.org/issue?@action=redirect&bpo=37420\n\n(171) https://bugs.python.org/issue?@action=redirect&bpo=37412\n\n(172) https://peps.python.org/pep-0529/\n\n(173) https://bugs.python.org/issue?@action=redirect&bpo=37406\n\n(174) https://bugs.python.org/issue?@action=redirect&bpo=29412\n\n(175) https://bugs.python.org/issue?@action=redirect&bpo=36546\n\n(176) https://bugs.python.org/issue?@action=redirect&bpo=37394\n\n(177) https://bugs.python.org/issue?@action=redirect&bpo=37376\n\n(178) https://bugs.python.org/issue?@action=redirect&bpo=26967\n\n(179) https://bugs.python.org/issue?@action=redirect&bpo=37212\n\n(180) https://bugs.python.org/issue?@action=redirect&bpo=37372\n\n(181) https://bugs.python.org/issue?@action=redirect&bpo=37345\n\n(182) https://bugs.python.org/issue?@action=redirect&bpo=37358\n\n(183) https://bugs.python.org/issue?@action=redirect&bpo=37347\n\n(184) https://bugs.python.org/issue?@action=redirect&bpo=37163\n\n(185) https://bugs.python.org/issue?@action=redirect&bpo=37085\n\n(186) https://bugs.python.org/issue?@action=redirect&bpo=37328\n\n(187) https://bugs.python.org/issue?@action=redirect&bpo=37305\n\n(188) https://bugs.python.org/issue?@action=redirect&bpo=37320\n\n(189) https://bugs.python.org/issue?@action=redirect&bpo=37315\n\n(190) https://bugs.python.org/issue?@action=redirect&bpo=37312\n\n(191) https://bugs.python.org/issue?@action=redirect&bpo=33972\n\n(192) https://bugs.python.org/issue?@action=redirect&bpo=37280\n\n(193) https://bugs.python.org/issue?@action=redirect&bpo=37279\n\n(194) https://bugs.python.org/issue?@action=redirect&bpo=19865\n\n(195) https://bugs.python.org/issue?@action=redirect&bpo=37266\n\n(196) https://bugs.python.org/issue?@action=redirect&bpo=37210\n\n(197) https://bugs.python.org/issue?@action=redirect&bpo=21872\n\n(198) https://bugs.python.org/issue?@action=redirect&bpo=35922\n\n(199) https://bugs.python.org/issue?@action=redirect&bpo=35766\n\n(200) https://bugs.python.org/issue?@action=redirect&bpo=36607\n\n(201) https://bugs.python.org/issue?@action=redirect&bpo=18748\n\n(202) https://bugs.python.org/issue?@action=redirect&bpo=36402\n\n(203) https://bugs.python.org/issue?@action=redirect&bpo=37206\n\n(204) https://bugs.python.org/issue?@action=redirect&bpo=37111\n\n(205) https://bugs.python.org/issue?@action=redirect&bpo=12144\n\n(206) https://bugs.python.org/issue?@action=redirect&bpo=34886\n\n(207) https://bugs.python.org/issue?@action=redirect&bpo=37173\n\n(208) https://bugs.python.org/issue?@action=redirect&bpo=37178\n\n(209) https://bugs.python.org/issue?@action=redirect&bpo=37178\n\n(210) https://bugs.python.org/issue?@action=redirect&bpo=37165\n\n(211) https://bugs.python.org/issue?@action=redirect&bpo=34767\n\n(212) https://bugs.python.org/issue?@action=redirect&bpo=37158\n\n(213) https://bugs.python.org/issue?@action=redirect&bpo=34282\n\n(214) https://bugs.python.org/issue?@action=redirect&bpo=37150\n\n(215) https://bugs.python.org/issue?@action=redirect&bpo=28724\n\n(216) https://bugs.python.org/issue?@action=redirect&bpo=35621\n\n(217) https://bugs.python.org/issue?@action=redirect&bpo=36520\n\n(218) https://bugs.python.org/issue?@action=redirect&bpo=30835\n\n(219) https://bugs.python.org/issue?@action=redirect&bpo=31163\n\n(220) https://bugs.python.org/issue?@action=redirect&bpo=25068\n\n(221) https://bugs.python.org/issue?@action=redirect&bpo=26185\n\n(222) https://bugs.python.org/issue?@action=redirect&bpo=21315\n\n(223) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\n(224) https://bugs.python.org/issue?@action=redirect&bpo=35805\n\n(225) https://bugs.python.org/issue?@action=redirect&bpo=36871\n\n(226) https://bugs.python.org/issue?@action=redirect&bpo=35070\n\n(227) https://bugs.python.org/issue?@action=redirect&bpo=31783\n\n(228) https://bugs.python.org/issue?@action=redirect&bpo=36582\n\n(229) https://bugs.python.org/issue?@action=redirect&bpo=32424\n\n(230) https://bugs.python.org/issue?@action=redirect&bpo=36564\n\n(231) https://bugs.python.org/issue?@action=redirect&bpo=36543\n\n(232) https://bugs.python.org/issue?@action=redirect&bpo=36409\n\n(233) https://bugs.python.org/issue?@action=redirect&bpo=36302\n\n(234) https://bugs.python.org/issue?@action=redirect&bpo=36250\n\n(235) https://bugs.python.org/issue?@action=redirect&bpo=36046\n\n(236) https://bugs.python.org/issue?@action=redirect&bpo=32627\n\n(237) https://bugs.python.org/issue?@action=redirect&bpo=35800\n\n(238) https://bugs.python.org/issue?@action=redirect&bpo=35168\n\n(239) https://bugs.python.org/issue?@action=redirect&bpo=8538\n\n(240) https://bugs.python.org/issue?@action=redirect&bpo=20504\n\n(241) https://bugs.python.org/issue?@action=redirect&bpo=25988\n\n(242) https://bugs.python.org/issue?@action=redirect&bpo=11122\n\n(243) https://bugs.python.org/issue?@action=redirect&bpo=34775\n\n(244) https://bugs.python.org/issue?@action=redirect&bpo=34749\n\n(245) https://bugs.python.org/issue?@action=redirect&bpo=34519\n\n(246) https://bugs.python.org/issue?@action=redirect&bpo=28009\n\n(247) https://bugs.python.org/issue?@action=redirect&bpo=30618\n\n(248) https://bugs.python.org/issue?@action=redirect&bpo=32498\n\n(249) https://bugs.python.org/issue?@action=redirect&bpo=33348\n\n(250) https://bugs.python.org/issue?@action=redirect&bpo=32689\n\n(251) https://bugs.python.org/issue?@action=redirect&bpo=32820\n\n(252) https://bugs.python.org/issue?@action=redirect&bpo=27657\n\n(253) https://bugs.python.org/issue?@action=redirect&bpo=4963\n\nFile: python3.12.info,  Node: Documentation<41>,  Next: Tests<38>,  Prev: Library<41>,  Up: Python 3 9 0 alpha 1\n\n1.22.41.4 Documentation\n.......................\n\n- bpo-21767(1): Explicitly mention abc support in\nfunctools.singledispatch\n\n- bpo-38816(2): Provides more details about the interaction between\n'fork()' and CPython's runtime, focusing just on the C-API. This\nincludes cautions about where 'fork()' should and shouldn't be\ncalled.\n\n- bpo-38351(3): Modernize *note email: 37. examples from %-formatting\nto f-strings.\n\n- bpo-38778(4): Document the fact that *note RuntimeError: 17a. is\nraised if *note os.fork(): 231. is called in a subinterpreter.\n\n- bpo-38592(5): Add Brazilian Portuguese to the language switcher at\nPython Documentation website.\n\n- bpo-38294(6): Add list of no-longer-escaped chars to re.escape\ndocumentation\n\n- bpo-38053(7): Modernized the plistlib documentation\n\n- bpo-26868(8): Fix example usage of *note PyModuleAddObject(): 6aa.\nto properly handle errors.\n\n- bpo-36797(9): Fix a dead link in the distutils API Reference.\n\n- bpo-37977(10): Warn more strongly and clearly about pickle\ninsecurity\n\n- bpo-37979(11): Added a link to dateutil.parser.isoparse in the\ndatetime.fromisoformat documentation.  Patch by Paul Ganssle\n\n- bpo-12707(12): Deprecate info(), geturl(), getcode() methods in\nfavor of the headers, url, and status properties, respectively, for\nHTTPResponse and addinfourl.  Also deprecate the code attribute of\naddinfourl in favor of the status attribute.  Patch by Ashwin\nRamaswami\n\n- bpo-37937(13): Mention 'frame.ftrace' in *note sys.settrace():\n135a. docs.\n\n- bpo-37878(14): Make *note PyThreadStateDeleteCurrent(): 1746.\nInternal.\n\n- bpo-37759(15): Beginning edits to Whatsnew 3.8\n\n- bpo-37726(16): Stop recommending getopt in the tutorial for command\nline argument parsing and promote argparse.\n\n- bpo-32910(17): Remove implementation-specific behaviour of how\nvenv's Deactivate works.\n\n- bpo-37256(18): Fix wording of arguments for 'Request' in *note\nurllib.request: 106.\n\n- bpo-37284(19): Add a brief note to indicate that any new\n'sys.implementation' required attributes must go through the PEP\nprocess.\n\n- bpo-30088(20): Documented that *note mailbox.Maildir: 118a.\nconstructor doesn't attempt to verify the maildir folder layout\ncorrectness.  Patch by Sviatoslav Sydorenko.\n\n- bpo-37521(21): Fix 'importlib' examples to insert any newly created\nmodules via importlib.util.modulefromspec() immediately into\nsys.modules instead of after calling loader.execmodule().\n\nThanks to Benjamin Mintz for finding the bug.\n\n- bpo-37456(22): Slash ('/') is now part of syntax.\n\n- bpo-37487(23): Fix PyListGetItem index description to include 0.\n\n- bpo-37149(24): Replace the dead link to the Tkinter 8.5 reference\nby John Shipman, New Mexico Tech, with a link to the archive.org\ncopy.\n\n- bpo-37478(25): Added possible exceptions to the description of\nos.chdir().\n\n- bpo-34903(26): Documented that in *note\ndatetime.datetime.strptime(): 146c, the leading zero in some\ntwo-digit formats is optional.  Patch by Mike Gleen.\n\n- bpo-36260(27): Add decompression pitfalls to zipfile module\ndocumentation.\n\n- bpo-37004(28): In the documentation for difflib, a note was added\nexplicitly warning that the results of SequenceMatcher's ratio\nmethod may depend on the order of the input strings.\n\n- bpo-36960(29): Restructured the *note datetime: 2e. docs in the\ninterest of making them more user-friendly and improving\nreadability.  Patch by Brad Solomon.\n\n- bpo-36487(30): Make C-API docs clear about what the \"main\"\ninterpreter is.\n\n- bpo-23460(31): The documentation for decimal string formatting\nusing the ':g' specifier has been updated to reflect the correct\nexponential notation cutoff point.  Original patch contributed by\nTuomas Suutari.\n\n- bpo-35803(32): Document and test that 'tempfile' functions may\naccept a *note path-like object: 957. for the 'dir' argument.\nPatch by Anthony Sottile.\n\n- bpo-33944(33): Added a note about the intended use of code in .pth\nfiles.\n\n- bpo-34293(34): Fix the Doc/Makefile regarding PAPER environment\nvariable and PDF builds\n\n- bpo-25237(35): Add documentation for tkinter modules\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=21767\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=38816\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=38351\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=38778\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=38592\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=38294\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=38053\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=26868\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=36797\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=37977\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=37979\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=12707\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=37937\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=37878\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=37759\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=37726\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=32910\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=37256\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=37284\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=30088\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=37521\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=37456\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=37487\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=37149\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=37478\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=34903\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=36260\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=37004\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=36960\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=36487\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=23460\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=35803\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=33944\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=34293\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=25237\n\nFile: python3.12.info,  Node: Tests<38>,  Next: Build<39>,  Prev: Documentation<41>,  Up: Python 3 9 0 alpha 1\n\n1.22.41.5 Tests\n...............\n\n- bpo-38614(1): Fix testcommunicate() of\ntestasyncio.testsubprocess: use 'support.LONGTIMEOUT' (5\nminutes), instead of just 1 minute.\n\n- bpo-38614(2): Add timeout constants to *note test.support: de.:\n*note LOOPBACKTIMEOUT: 1722, *note INTERNETTIMEOUT: 1723, *note\nSHORTTIMEOUT: 1611. and *note LONGTIMEOUT: 1724.\n\n- bpo-38502(3): test.regrtest now uses process groups in the\nmultiprocessing mode (-jN command line option) if process groups\nare available: if *note os.setsid(): 1748. and *note os.killpg():\n1749. functions are available.\n\n- bpo-35998(4): Fix a race condition in\ntestasyncio.teststarttlsserver1().  Previously, there was a\nrace condition between the test main() function which replaces the\nprotocol and the test ServerProto protocol which sends ANSWER once\nit gets HELLO. Now, only the test main() function is responsible to\nsend data, ServerProto no longer sends data.\n\n- bpo-38470(5): Fix 'testcompileall.testcompiledirmaxlevels()' on\nWindows without long path support: only create 3 subdirectories\ninstead of between 20 and 100 subdirectories.\n\n- bpo-37531(6): On timeout, regrtest no longer attempts to call\n'popen.communicate()' again: it can hang until all child processes\nusing stdout and stderr pipes completes.  Kill the worker process\nand ignores its output.  Change also the faulthandler timeout of\nthe main process from 1 minute to 5 minutes, for Python slowest\nbuildbots.\n\n- bpo-38239(7): Fix testgdb for Link Time Optimization (LTO) builds.\n\n- bpo-38275(8): testssl now handles disabled TLS/SSL versions\nbetter.  OpenSSL's crypto policy and run-time settings are\nrecognized and tests for disabled versions are skipped.  Tests also\naccept more TLS minimumversions for platforms that override\nOpenSSL's default with strict settings.\n\n- bpo-38271(9): The private keys for testssl were encrypted with\n3DES in traditional PKCS#5 format.  3DES and the digest algorithm\nof PKCS#5 are blocked by some strict crypto policies.  Use PKCS#8\nformat with AES256 encryption instead.\n\n- bpo-38270(10): test.support now has a helper function to check for\navailability of a hash digest function.  Several tests are\nrefactored avoid MD5 and use SHA256 instead.  Other tests are\nmarked to use MD5 and skipped when MD5 is disabled.\n\n- bpo-37123(11): Multiprocessing test testmymanager() now also\nexpects -SIGTERM, not only exitcode 0.\nBaseManager.finalizemanager() sends SIGTERM to the manager\nprocess if it takes longer than 1 second to stop, which happens on\nslow buildbots.\n\n- bpo-38212(12): Multiprocessing tests: increase\ntestqueuefeederdonotstoponexc() timeout from 1 to 60 seconds.\n\n- bpo-38117(13): Test with OpenSSL 1.1.1d\n\n- bpo-38018(14): Increase code coverage for\nmultiprocessing.sharedmemory.\n\n- bpo-37805(15): Add tests for json.dump(..., skipkeys=True).  Patch by\nDonghee Na.\n\n- bpo-37531(16): Enhance regrtest multiprocess timeout: write a\nmessage when killing a worker process, catch popen.kill() and\npopen.wait() exceptions, put a timeout on the second call to\npopen.communicate().\n\n- bpo-37876(17): Add tests for ROT-13 codec.\n\n- bpo-36833(18): Added tests for 'PyDateTimeXXXGETXXX()' macros of\nthe C API of the *note datetime: 2e. module.  Patch by Joannah\nNanjekye.\n\n- bpo-37558(19): Fix\ntestsharedmemorycleanedafterprocesstermination name handling\n\n- bpo-37526(20): Add 'test.support.catchthreadingexception()':\ncontext manager catching *note threading.Thread: 76c. exception\nusing *note threading.excepthook(): 641.\n\n- bpo-37421(21): testconcurrentfutures now explicitly stops the\nForkServer instance if it's running.\n\n- bpo-37421(22): multiprocessing tests now stop the ForkServer\ninstance if it's running: close the \"alive\" file descriptor to ask\nthe server to stop and then remove its UNIX address.\n\n- bpo-37421(23): testdistutils.testbuildext() is now able to\nremove the temporary directory on Windows: don't import the newly\nbuilt C extension (\"xx\") in the current process, but test it in a\nseparated process.\n\n- bpo-37421(24): testconcurrentfutures now cleans up\nmultiprocessing to remove immediately temporary directories created\nby multiprocessing.util.gettempdir().\n\n- bpo-37421(25): testwinconsoleio doesn't leak a temporary file\nanymore: use tempfile.TemporaryFile() to remove it when the test\ncompletes.\n\n- bpo-37421(26): multiprocessing tests now explicitly call\n'runfinalizers()' to immediately remove temporary directories\ncreated by tests.\n\n- bpo-37421(27): urllib.request tests now call *note urlcleanup():\n174a. to remove temporary files created by 'urlretrieve()' tests\nand to clear the 'opener' global variable set by 'urlopen()' and\nfunctions calling indirectly 'urlopen()'.\n\n- bpo-37472(28): Remove 'Lib/test/outstandingbugs.py'.\n\n- bpo-37199(29): Fix test failures when IPv6 is unavailable or\ndisabled.\n\n- bpo-19696(30): Replace deprecated method \"random.choose\" with\n\"random.choice\" in \"testpkgimport.py\".\n\n- bpo-37335(31): Remove no longer necessary code from c locale\ncoercion tests\n\n- bpo-37421(32): Fix testshutil to no longer leak temporary files.\n\n- bpo-37411(33): Fix testwsgiref.testEnviron() to no longer depend\non the environment variables (don't fail if \"X\" variable is set).\n\n- bpo-37400(34): Fix testos.testchown(): use os.getgroups() rather\nthan grp.getgrall() to get groups.  Rename also the test to\ntestchowngid().\n\n- bpo-37359(35): Add -cleanup option to python3 -m test to remove\n'testpython*' directories of previous failed jobs.  Add \"make\ncleantest\" to run 'python3 -m test --cleanup'.\n\n- bpo-37362(36): testgdb no longer fails if it gets an \"unexpected\"\nmessage on stderr: it now ignores stderr.  The purpose of testgdb\nis to test that python-gdb.py commands work as expected, not to\ntest gdb.\n\n- bpo-35998(37): Avoid TimeoutError in testasyncio:\nteststarttlsserver1()\n\n- bpo-37278(38): Fix testasyncio ProactorLoopCtrlC: join the thread\nto prevent leaking a running thread and leaking a reference.\n\n- bpo-37261(39): Fix *note test.support.catchunraisableexception():\n174b.: its exit() method now ignores unraisable exception\nraised when clearing its 'unraisable' attribute.\n\n- bpo-37069(40): regrtest now uses *note sys.unraisablehook(): 448.\nto mark a test as \"environment altered\" (ENVCHANGED) if it emits\nan \"unraisable exception\".  Moreover, regrtest logs a warning in\nthis case.\n\nUse 'python3 -m test --fail-env-changed' to catch unraisable\nexceptions in tests.\n\n- bpo-37252(41): Fix assertions in 'testclose' and\n'testeventsmaskoverflow' devpoll tests.\n\n- bpo-37169(42): Rewrite 'PyObjectIsFreed()' unit tests.\n\n- bpo-37153(43): 'testvenv.testmultiprocessing()' now explicitly\ncalls 'pool.terminate()' to wait until the pool completes.\n\n- bpo-34001(44): Make testssl pass with LibreSSL. LibreSSL handles\nminimum and maximum TLS version differently than OpenSSL.\n\n- bpo-36919(45): Make 'testsourceencoding.testissue2301'\nimplementation independent.  The test will work now for both\nCPython and IronPython.\n\n- bpo-30202(46): Update 'test.testimportlib.testabc' to test\n'findspec()'.\n\n- bpo-28009(47): Modify the testuuid logic to test when a program is\navailable AND can be used to obtain a MACADDR as basis for an UUID.\nPatch by M. Felt\n\n- bpo-34596(48): Fallback to a default reason when *note\nunittest.skip(): 174c. is uncalled.  Patch by Naitree Zhu.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38614\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=38614\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=38502\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=35998\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=38470\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=37531\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=38239\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=38275\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=38271\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=38270\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=37123\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=38212\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=38117\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=38018\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=37805\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=37531\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=37876\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=36833\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=37558\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=37526\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=37421\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=37421\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=37421\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=37421\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=37421\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=37421\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=37421\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=37472\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=37199\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=19696\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=37335\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=37421\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=37411\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=37400\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=37359\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=37362\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=35998\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=37278\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=37261\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=37069\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=37252\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=37169\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=37153\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=34001\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=36919\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=30202\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=28009\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=34596\n\nFile: python3.12.info,  Node: Build<39>,  Next: Windows<37>,  Prev: Tests<38>,  Up: Python 3 9 0 alpha 1\n\n1.22.41.6 Build\n...............\n\n- bpo-38809(1): On Windows, build scripts will now recognize and use\npython.exe from an active virtual env.\n\n- bpo-38684(2): Fix hashlib build when Blake2 is disabled, but\nOpenSSL supports it.\n\n- bpo-38468(3): Misc/python-config.in now uses 'getvar()' for all\nstill existing 'sysconfig.getconfigvar()' calls.  Patch by\nJoannah Nanjekye.\n\n- bpo-37415(4): Fix stdatomic.h header check for ICC compiler: the\nICC implementation lacks atomicuintptrt type which is needed by\nPython.\n\n- bpo-38301(5): In Solaris family, we must be sure to use\n'-DREENTRANT'.  Patch by Jes??s Cea Avi??n.\n\n- bpo-36002(6): Locate 'llvm-profdata' and 'llvm-ar' binaries using\n'ACPATHTOOL' rather than 'ACPATHTARGETTOOL'.\n\n- bpo-37936(7): The '.gitignore' file systematically keeps \"rooted\",\nwith a non-trailing slash, all the rules that are meant to apply to\nfiles in a specific place in the repo.  Previously, when the\nintended file to ignore happened to be at the root of the repo,\nwe'd most often accidentally also ignore files and directories with\nthe same name anywhere in the tree.\n\n- bpo-37760(8): The 'Tools/unicode/makeunicodedata.py' script, which\nis used for converting information from the Unicode Character\nDatabase into generated code and data used by the methods of *note\nstr: 157. and by the *note unicodedata: 100. module, now handles\neach character's data as a 'dataclass' with named attributes,\nrather than a length-18 list of different fields.\n\n- bpo-37936(9): The '.gitignore' file no longer applies to any files\nthat are in fact tracked in the Git repository.  Patch by Greg\nPrice.\n\n- bpo-37725(10): Change \"clean\" makefile target to also clean the\nprogram guided optimization (PGO) data.  Previously you would have\nto use \"make clean\" and \"make profile-removal\", or \"make clobber\".\n\n- bpo-37707(11): Mark some individual tests to skip when -pgo is\nused.  The tests marked increase the PGO task time significantly\nand likely don't help improve optimization of the final executable.\n\n- bpo-36044(12): Reduce the number of unit tests run for the PGO\ngeneration task.  This speeds up the task by a factor of about 15x.\nRunning the full unit test suite is slow.  This change may result\nin a slightly less optimized build since not as many code branches\nwill be executed.  If you are willing to wait for the much slower\nbuild, the old behavior can be restored using './configure [..]\nPROFILETASK=\"-m test -pgo-extended\"'.  We make no guarantees as to\nwhich PGO task set produces a faster build.  Users who care should\nrun their own relevant benchmarks as results can depend on the\nenvironment, workload, and compiler tool chain.\n\n- bpo-37468(13): 'make install' no longer installs 'wininst-*.exe'\nfiles used by distutils bdistwininst: bdistwininst only works on\nWindows.\n\n- bpo-37189(14): Many 'PyRunXXX()' functions like *note\nPyRunString(): 174e. were no longer exported in 'libpython38.dll'\nby mistake.  Export them again to fix the ABI compatibility.\n\n- bpo-25361(15): Enables use of SSE2 instructions in Windows 32-bit\nbuild.\n\n- bpo-36210(16): Update optional extension module detection for AIX.\nossaudiodev and spwd are not applicable for AIX, and are no longer\nreported as missing.  3rd-party packaging of ncurses (with ASIS\nsupport) conflicts with officially supported AIX curses library, so\nconfigure AIX to use libcurses.a.  However, skip trying to build\ncursespanel.\n\npatch by M Felt\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38809\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=38684\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=38468\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=37415\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=38301\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=36002\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=37936\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=37760\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=37936\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=37725\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=37707\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=36044\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=37468\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=37189\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=25361\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=36210\n\nFile: python3.12.info,  Node: Windows<37>,  Next: macOS<31>,  Prev: Build<39>,  Up: Python 3 9 0 alpha 1\n\n1.22.41.7 Windows\n.................\n\n- bpo-38589(1): Fixes HTML Help shortcut when Windows is not\ninstalled to C drive\n\n- bpo-38453(2): Ensure ntpath.realpath() correctly resolves relative\npaths.\n\n- bpo-38519(3): Restores the internal C headers that were missing\nfrom the nuget.org and Microsoft Store packages.\n\n- bpo-38492(4): Remove 'pythonw.exe' dependency on the Microsoft C++\nruntime.\n\n- bpo-38344(5): Fix error message in activate.bat\n\n- bpo-38359(6): Ensures 'pyw.exe' launcher reads correct registry\nkey.\n\n- bpo-38355(7): Fixes 'ntpath.realpath' failing on 'sys.executable'.\n\n- bpo-38117(8): Update bundled OpenSSL to 1.1.1d\n\n- bpo-38092(9): Reduce overhead when using multiprocessing in a\nWindows virtual environment.\n\n- bpo-38133(10): Allow py.exe launcher to locate installations from\nthe Microsoft Store and improve display of active virtual\nenvironments.\n\n- bpo-38114(11): The 'pip.ini' is no longer included in the Nuget\npackage.\n\n- bpo-32592(12): Set Windows 8 as the minimum required version for\nAPI support\n\n- bpo-36634(13): *note os.cpucount(): 60b. now returns active\nprocessors rather than maximum processors.\n\n- bpo-36634(14): venv activate.bat now works when the existing\nvariables contain double quote characters.\n\n- bpo-38081(15): Prevent error calling *note os.path.realpath(): 351.\non ''NUL''.\n\n- bpo-38087(16): Fix case sensitivity in testpathlib and\ntestntpath.\n\n- bpo-38088(17): Fixes distutils not finding vcruntime140.dll with\nonly the v142 toolset installed.\n\n- bpo-37283(18): Ensure command-line and unattend.xml setting\noverride previously detected states in Windows installer.\n\n- bpo-38030(19): Fixes *note os.stat(): 1bf. failing for block\ndevices on Windows\n\n- bpo-38020(20): Fixes potential crash when calling *note\nos.readlink(): 73e. (or indirectly through *note realpath(): 351.)\non a file that is not a supported link.\n\n- bpo-37705(21): Improve the implementation of 'winerrortoerrno()'.\n\n- bpo-37549(22): *note os.dup(): 1750. no longer fails for standard\nstreams on Windows 7.\n\n- bpo-1311(23): The 'nul' file on Windows now returns True from *note\nexists(): 837. and a valid result from *note os.stat(): 1bf. with\n'SIFCHR' set.\n\n- bpo-9949(24): Enable support for following symlinks in\n'os.realpath()'.\n\n- bpo-37834(25): Treat all name surrogate reparse points on Windows\nin *note os.lstat(): 1c0. and other reparse points as regular files\nin *note os.stat(): 1bf.\n\n- bpo-36266(26): Add the module name in the formatted error message\nwhen DLL load fail happens during module import in\n'PyImportFindSharedFuncptrWindows()'.  Patch by Srinivas\nNyayapati.\n\n- bpo-25172(27): Trying to import the *note crypt: 26. module on\nWindows will result in an *note ImportError: 145. with a message\nexplaining that the module isn't supported on Windows.  On other\nplatforms, if the underlying 'crypt' module is not available, the\nImportError will include a message explaining the problem.\n\n- bpo-37778(28): Fixes the icons used for file associations to the\nMicrosoft Store package.\n\n- bpo-37734(29): Fix use of registry values to launch Python from\nMicrosoft Store app.\n\n- bpo-37702(30): Fix memory leak on Windows in creating an SSLContext\nobject or running 'urllib.request.urlopen('https://...')'.\n\n- bpo-37672(31): Switch Windows Store package's pip to use bundled\n'pip.ini' instead of 'PIPUSER' variable.\n\n- bpo-10945(32): Officially drop support for creating bdistwininst\ninstallers on non-Windows systems.\n\n- bpo-37445(33): Include the 'FORMATMESSAGEIGNOREINSERTS' flag in\n'FormatMessageW()' calls.\n\n- bpo-37369(34): Fixes path for *note sys.executable: 330. when\nrunning from the Microsoft Store.\n\n- bpo-37380(35): Don't collect unfinished processes with\n'subprocess.active' on Windows to cleanup later.  Patch by Ruslan\nKuprieiev.\n\n- bpo-37351(36): Removes libpython38.a from standard Windows\ndistribution.\n\n- bpo-35360(37): Update Windows builds to use SQLite 3.28.0.\n\n- bpo-37267(38): On Windows, *note os.dup(): 1750. no longer creates\nan inheritable fd when handling a character file.\n\n- bpo-36779(39): Ensure 'time.tzname' is correct on Windows when the\nactive code page is set to CPUTF7 or CPUTF8.\n\n- bpo-32587(40): Make *note winreg.REGMULTISZ: 1751. support\nzero-length strings.\n\n- bpo-28269(41): Replace use of 'strcasecmp()' for the system\nfunction 'stricmp()'.  Patch by Minmin Gong.\n\n- bpo-36590(42): Add native Bluetooth RFCOMM support to socket\nmodule.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38589\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=38453\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=38519\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=38492\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=38344\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=38359\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=38355\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=38117\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=38092\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=38133\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=38114\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=32592\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=36634\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=36634\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=38081\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=38087\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=38088\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=37283\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=38030\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=38020\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=37705\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=37549\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=1311\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=9949\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=37834\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=36266\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=25172\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=37778\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=37734\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=37702\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=37672\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=10945\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=37445\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=37369\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=37380\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=37351\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=35360\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=37267\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=36779\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=32587\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=28269\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=36590\n\nFile: python3.12.info,  Node: macOS<31>,  Next: IDLE<25>,  Prev: Windows<37>,  Up: Python 3 9 0 alpha 1\n\n1.22.41.8 macOS\n...............\n\n- bpo-38117(1): Updated OpenSSL to 1.1.1d in macOS installer.\n\n- bpo-38089(2): Move Azure Pipelines to latest VM versions and make\nmacOS tests optional\n\n- bpo-18049(3): Increase the default stack size of threads from 5MB\nto 16MB on macOS, to match the stack size of the main thread.  This\navoids crashes on deep recursion in threads.\n\n- bpo-34602(4): Avoid test suite failures on macOS by no longer\ncalling resource.setrlimit to increase the process stack size limit\nat runtime.  The runtime change is no longer needed since the\ninterpreter is being built with a larger default stack size.\n\n- bpo-35360(5): Update macOS installer to use SQLite 3.28.0.\n\n- bpo-34631(6): Updated OpenSSL to 1.1.1c in macOS installer.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38117\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=38089\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=18049\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=34602\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=35360\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=34631\n\nFile: python3.12.info,  Node: IDLE<25>,  Next: Tools/Demos<20>,  Prev: macOS<31>,  Up: Python 3 9 0 alpha 1\n\n1.22.41.9 IDLE\n..............\n\n- bpo-26353(1): Stop adding newline when saving an IDLE shell window.\n\n- bpo-4630(2): Add an option to toggle IDLE's cursor blink for shell,\neditor, and output windows.  See Settings, General, Window\nPreferences, Cursor Blink.  Patch by Zackery Spytz.\n\n- bpo-38598(3): Do not try to compile IDLE shell or output windows\n\n- bpo-36698(4): IDLE no longer fails when write non-encodable\ncharacters to stderr.  It now escapes them with a backslash, as the\nregular Python interpreter.  Added the 'errors' field to the\nstandard streams.\n\n- bpo-35379(5): When exiting IDLE, catch any AttributeError.  One\nhappens when EditorWindow.close is called twice.  Printing a\ntraceback, when IDLE is run from a terminal, is useless and\nannoying.\n\n- bpo-38183(6): To avoid problems, testidle ignores the user config\ndirectory.  It no longer tries to create or access .idlerc or any\nfiles within.  Users must run IDLE to discover problems with saving\nsettings.\n\n- bpo-38077(7): IDLE no longer adds 'argv' to the user namespace when\ninitializing it.  This bug only affected 3.7.4 and 3.8.0b2 to\n3.8.0b4.\n\n- bpo-38041(8): Shell restart lines now fill the window width, always\nstart with '=', and avoid wrapping unnecessarily.  The line will\nstill wrap if the included file name is long relative to the width.\n\n- bpo-35771(9): To avoid occasional spurious testidle failures on\nslower machines, increase the 'hoverdelay' in testtooltip.\n\n- bpo-37824(10): Properly handle user input warnings in IDLE shell.\nCease turning SyntaxWarnings into SyntaxErrors.\n\n- bpo-37929(11): IDLE Settings dialog now closes properly when there\nis no shell window.\n\n- bpo-37902(12): Add mousewheel scrolling for IDLE module, path, and\nstack browsers.  Patch by George Zhang.\n\n- bpo-37849(13): Fixed completions list appearing too high or low\nwhen shown above the current line.\n\n- bpo-36419(14): Refactor IDLE autocomplete and improve testing.\n\n- bpo-37748(15): Reorder the Run menu.  Put the most common choice,\nRun Module, at the top.\n\n- bpo-37692(16): Improve highlight config sample with example shell\ninteraction and better labels for shell elements.\n\n- bpo-37628(17): Settings dialog no longer expands with font size.\n\n- bpo-37627(18): Initialize the Customize Run dialog with the command\nline arguments most recently entered before.  The user can\noptionally edit before submitting them.\n\n- bpo-33610(19): Fix code context not showing the correct context\nwhen first toggled on.\n\n- bpo-37530(20): Optimize code context to reduce unneeded background\nactivity.  Font and highlight changes now occur along with text\nchanges instead of after a random delay.\n\n- bpo-27452(21): Cleanup 'config.py' by inlining 'RemoveFile' and\nsimplifying the handling of 'file' in 'CreateConfigHandlers'.\n\n- bpo-37325(22): Fix tab focus traversal order for help source and\ncustom run dialogs.\n\n- bpo-37321(23): Both subprocess connection error messages now refer\nto the 'Startup failure' section of the IDLE doc.\n\n- bpo-17535(24): Add optional line numbers for IDLE editor windows.\nWindows open without line numbers unless set otherwise in the\nGeneral tab of the configuration dialog.\n\n- bpo-26806(25): To compensate for stack frames added by IDLE and\navoid possible problems with low recursion limits, add 30 to limits\nin the user code execution process.  Subtract 30 when reporting\nrecursion limits to make this addition mostly transparent.\n\n- bpo-37177(26): Properly 'attach' search dialogs to their main\nwindow so that they behave like other dialogs and do not get hidden\nbehind their main window.\n\n- bpo-37039(27): Adjust \"Zoom Height\" to individual screens by\nmomentarily maximizing the window on first use with a particular\nscreen.  Changing screen settings may invalidate the saved height.\nWhile a window is maximized, \"Zoom Height\" has no effect.\n\n- bpo-35763(28): Make calltip reminder about '/' meaning\npositional-only less obtrusive by only adding it when there is room\non the first line.\n\n- bpo-5680(29): Add 'Run... Customized' to the Run menu to run a module\nwith customized settings.  Any 'command line arguments' entered are\nadded to sys.argv.  One can suppress the normal Shell main module\nrestart.\n\n- bpo-36390(30): Gather Format menu functions into format.py.\nCombine paragraph.py, rstrip.py, and format methods from editor.py.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26353\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=4630\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=38598\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=36698\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=35379\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=38183\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=38077\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=38041\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=35771\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=37824\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=37929\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=37902\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=37849\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=36419\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=37748\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=37692\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=37628\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=37627\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=33610\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=37530\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=27452\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=37325\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=37321\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=17535\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=26806\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=37177\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=37039\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=35763\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=5680\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=36390\n\nFile: python3.12.info,  Node: Tools/Demos<20>,  Next: C API<37>,  Prev: IDLE<25>,  Up: Python 3 9 0 alpha 1\n\n1.22.41.10 Tools/Demos\n......................\n\n- bpo-38118(1): Update Valgrind suppression file to ignore a false\nalarm in *note PyUnicodeDecode(): 1755. when using GCC builtin\nstrcmp().\n\n- bpo-38347(2): pathfix.py: Assume all files that end on '.py' are\nPython scripts when working recursively.\n\n- bpo-37803(3): pdb's '--help' and '--version' long options now work.\n\n- bpo-37942(4): Improve ArgumentClinic converter for floats.\n\n- bpo-37704(5): Remove 'Tools/scripts/h2py.py': use cffi to access a\nC API in Python.\n\n- bpo-37675(6): 2to3 now works when run from a zipped standard\nlibrary.\n\n- bpo-37034(7): Argument Clinic now uses the argument name on errors\nwith keyword-only argument instead of their position.  Patch\ncontributed by Re'mi Lapeyre.\n\n- bpo-37064(8): Add option -k to pathscript.py script: preserve\nshebang flags.  Add option -a to pathscript.py script: add flags.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38118\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=38347\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=37803\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=37942\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=37704\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=37675\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=37034\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=37064\n\nFile: python3.12.info,  Node: C API<37>,  Prev: Tools/Demos<20>,  Up: Python 3 9 0 alpha 1\n\n1.22.41.11 C API\n................\n\n- bpo-37633(1): Re-export some function compatibility wrappers for\nmacros in 'pythonrun.h'.\n\n- bpo-38644(2): Provide *note PyEnterRecursiveCall(): 797. and *note\nPyLeaveRecursiveCall(): 798. as regular functions for the limited\nAPI. Previously, there were defined as macros, but these macros\ndidn't work with the limited API which cannot access\n'PyThreadState.recursiondepth' field.  Remove\n'PyCheckRecursionLimit' from the stable ABI.\n\n- bpo-38650(3): The global variable *note\nPyStructSequenceUnnamedField: 7a6. is now a constant and refers to\na constant string.\n\n- bpo-38540(4): Fixed possible leak in *note PyArgParse(): 1757. and\nsimilar functions for format units '\"es#\"' and '\"et#\"' when the\nmacro 'PYSSIZETCLEAN' is not defined.\n\n- bpo-38395(5): Fix a crash in *note weakref.proxy: 87e. objects due\nto incorrect lifetime management when calling some associated\nmethods that may delete the last reference to object being\nreferenced by the proxy.  Patch by Pablo Galindo.\n\n- bpo-36389(6): The 'PyObjectCheckConsistency()' function is now\nalso available in release mode.  For example, it can be used to\ndebug a crash in the 'visitdecref()' function of the GC.\n\n- bpo-38266(7): Revert the removal of PyThreadStateDeleteCurrent()\nwith documentation.\n\n- bpo-38303(8): Update audioop extension module to use the stable ABI\n(PEP-384).  Patch by Tyler Kieft.\n\n- bpo-38234(9): 'PySetPath()' now sets *note sys.executable: 330. to\nthe program full path (*note PyGetProgramFullPath(): 32f.) rather\nthan to the program name (*note PyGetProgramName(): 331.).\n\n- bpo-38234(10): Python ignored arguments passed to 'PySetPath()',\n'PySetPythonHome()' and 'PySetProgramName()': fix Python\ninitialization to use specified arguments.\n\n- bpo-38205(11): The *note PyUNREACHABLE(): 9f9. macro now calls\n*note PyFatalError(): 7a7.\n\n- bpo-38140(12): Make dict and weakref offsets opaque for C heap\ntypes by passing the offsets through PyMemberDef\n\n- bpo-15088(13): The C function 'PyGenNeedsFinalizing' has been\nremoved.  It was not documented, tested or used anywhere within\nCPython after the implementation of PEP 442(14).  Patch by Joannah\nNanjekye.  (Patch by Joannah Nanjekye)\n\n- bpo-36763(15): Options added by 'PySysAddXOption()' are now\nhandled the same way than 'PyConfig.xoptions' and command line '-X'\noptions.\n\n- bpo-37926(16): Fix a crash in 'PySysSetArgvEx(0, NULL, 0)'.\n\n- bpo-37879(17): Fix subtypedealloc to suppress the type decref when\nthe base type is a C heap type\n\n- bpo-37645(18): Add 'PyObjectFunctionStr()' to get a user-friendly\nstring representation of a function-like object.  Patch by Jeroen\nDemeyer.\n\n- bpo-29548(19): The functions 'PyEvalCallObject',\n'PyEvalCallFunction', 'PyEvalCallMethod' and\n'PyEvalCallObjectWithKeywords' are deprecated.  Use *note\nPyObjectCall(): 787. and its variants instead.\n\n- bpo-37151(20): 'PyCFunctionCall' is now a deprecated alias of\n*note PyObjectCall(): 787.\n\n- bpo-37540(21): The vectorcall protocol now requires that the caller\npasses only strings as keyword names.\n\n- bpo-37207(22): The vectorcall protocol is now enabled for 'type'\nobjects: set 'tpvectorcall' to a vectorcall function to be used\ninstead of 'tpnew' and 'tpinit' when calling the class itself.\n\n- bpo-21120(23): Exclude Python-ast.h, ast.h and asdl.h from the\nlimited API.\n\n- bpo-37483(24): Add new function 'PyObjectCallOneArg' for calling\nan object with one positional argument.\n\n- bpo-36763(25): Add *note PyConfigSetWideStringList(): 1758.\nfunction.\n\n- bpo-37337(26): Add fast functions for calling methods:\n'PyObjectVectorcallMethod()', 'PyObjectCallMethodNoArgs()' and\n'PyObjectCallMethodOneArg()'.\n\n- bpo-28805(27): The *note METHFASTCALL: 157b. calling convention\nhas been documented.\n\n- bpo-37221(28): The new function 'PyCodeNewWithPosOnlyArgs()'\nallows to create code objects like 'PyCodeNew()', but with an\nextra 'posonlyargcount' parameter for indicating the number of\npositonal-only arguments.\n\n- bpo-37215(29): Fix dtrace issue introduce by bpo-36842(30)\n\n- bpo-37194(31): Add a new public *note PyObjectCallNoArgs(): 796.\nfunction to the C API: call a callable Python object without any\narguments.  It is the most efficient way to call a callback without\nany argument.  On x86-64, for example,\n'PyObjectCallFunctionObjArgs(func, NULL)' allocates 960 bytes on\nthe stack per call, whereas 'PyObjectCallNoArgs(func)' only\nallocates 624 bytes per call.\n\n- bpo-37170(32): Fix the cast on error in *note\nPyLongAsUnsignedLongLongMask(): 1759.\n\n- bpo-35381(33): Convert posixmodule.c statically allocated types\n'DirEntryType' and 'ScandirIteratorType' to heap-allocated types.\n\n- bpo-34331(34): Use singular/plural noun in error message when\ninstantiating an abstract class with non-overridden abstract\nmethod(s).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=37633\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=38644\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=38650\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=38540\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=38395\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=36389\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=38266\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=38303\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=38234\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=38234\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=38205\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=38140\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=15088\n\n(14) https://peps.python.org/pep-0442/\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=36763\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=37926\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=37879\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=37645\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=29548\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=37151\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=37540\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=37207\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=21120\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=37483\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=36763\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=37337\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=28805\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=37221\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=37215\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=36842\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=37194\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=37170\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=35381\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=34331\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 8 0 beta 1,  Next: Python 3 8 0 alpha 4,  Prev: Python 3 9 0 alpha 1,  Up: Changelog": {
            "content": "'Release date: 2019-06-04'\n\n* Menu:\n\n* Security: Security<28>.\n* Core and Builtins: Core and Builtins<42>.\n* Library: Library<42>.\n* Documentation: Documentation<42>.\n* Tests: Tests<39>.\n* Build: Build<40>.\n* Windows: Windows<38>.\n* macOS: macOS<32>.\n* IDLE: IDLE<26>.\n* Tools/Demos: Tools/Demos<21>.\n* C API: C API<38>.\n\nFile: python3.12.info,  Node: Security<28>,  Next: Core and Builtins<42>,  Up: Python 3 8 0 beta 1\n\n1.22.42.1 Security\n..................\n\n- bpo-35907(1): CVE-2019-9948: Avoid file reading by disallowing\n'local-file://' and 'localfile://' URL schemes in\n'URLopener().open()' and 'URLopener().retrieve()' of *note\nurllib.request: 106.\n\n- bpo-33529(2): Prevent fold function used in email header encoding\nfrom entering infinite loop when there are too many non-ASCII\ncharacters in a header.\n\n- bpo-33164(3): Updated blake2 implementation which uses secure\nmemset implementation provided by platform.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=35907\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=33529\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=33164\n\nFile: python3.12.info,  Node: Core and Builtins<42>,  Next: Library<42>,  Prev: Security<28>,  Up: Python 3 8 0 beta 1\n\n1.22.42.2 Core and Builtins\n...........................\n\n- bpo-35814(1): Allow unpacking in the right hand side of annotated\nassignments.  In particular, 't: Tuple[int, ...] = x, y, *z' is now\nallowed.\n\n- bpo-37126(2): All structseq objects are now tracked by the garbage\ncollector.  Patch by Pablo Galindo.\n\n- bpo-37122(3): Make the 'coargcount' attribute of code objects\nrepresent the total number of positional arguments (including\npositional-only arguments).  The value of 'coposonlyargcount' can\nbe used to distinguish which arguments are positional only, and the\ndifference ('coargcount' - 'coposonlyargcount') is the number of\npositional-or-keyword arguments.  Patch by Pablo Galindo.\n\n- bpo-20092(4): Constructors of *note int: 17e, *note float: 4b7. and\n*note complex: 3ad. will now use the *note index(): 4f1.\nspecial method, if available and the corresponding method *note\nint(): 4f0, *note float(): 7f0. or *note complex():\n3ac. is not available.\n\n- bpo-37087(5): Add native thread ID (TID) support to OpenBSD.\n\n- bpo-26219(6): Implemented per opcode cache mechanism and\n'LOADGLOBAL' instruction use it.  'LOADGLOBAL' is now about 40%\nfaster.  Contributed by Yury Selivanov, and Inada Naoki.\n\n- bpo-37072(7): Fix crash in PyASTFromNodeObject() when flags is\nNULL.\n\n- bpo-37029(8): Freeing a great many small objects could take time\nquadratic in the number of arenas, due to using linear search to\nkeep 'obmalloc.c''s list of usable arenas sorted by order of number\nof free memory pools.  This is accomplished without search now,\nleaving the worst-case time linear in the number of arenas.  For\nprograms where this quite visibly matters (typically with more than\n100 thousand small objects alive simultaneously), this can greatly\nreduce the time needed to release their memory.\n\n- bpo-26423(9): Fix possible overflow in 'wraplenfunc()' when\n'sizeof(long) < sizeof(Pyssizet)' (e.g., 64-bit Windows).\n\n- bpo-37050(10): Improve the AST for \"debug\" f-strings, which use '='\nto print out the source of the expression being evaluated.  Delete\nexprtext from the FormattedValue node, and instead use a Constant\nstring node (possibly merged with adjacent constant expressions\ninside the f-string).\n\n- bpo-22385(11): The 'bytes.hex', 'bytearray.hex', and\n'memoryview.hex' methods as well as the 'binascii.hexlify' and\n'b2ahex' functions now have the ability to include an optional\nseparator between hex bytes.  This functionality was inspired by\nMicroPython's hexlify implementation.\n\n- bpo-26836(12): Add *note os.memfdcreate(): 834.\n\n- bpo-37032(13): Added new 'replace()' method to the code type (*note\ntypes.CodeType: 7f6.).\n\n- bpo-37007(14): Implement *note socket.ifnameindex(): 858, *note\nsocket.ifnametoindex(): 859, and *note socket.ifindextoname():\n85a. on Windows.\n\n- bpo-36829(15): *note PyErrWriteUnraisable(): 175d. now creates a\ntraceback object if there is no current traceback.  Moreover, call\n*note PyErrNormalizeException(): 337. and *note\nPyExceptionSetTraceback(): 175e. to normalize the exception value.\nIgnore any error.\n\n- bpo-36878(16): Only accept text after '# type: ignore' if the first\ncharacter is ASCII. This is to disallow things like '# type:\nignoree''.\n\n- bpo-36878(17): Store text appearing after a '# type: ignore'\ncomment in the AST. For example a type ignore like '# type:\nignore[E1000]' will have the string '\"[E1000]\"' stored in its AST\nnode.\n\n- bpo-2180(18): Treat line continuation at EOF as a 'SyntaxError' by\nAnthony Sottile.\n\n- bpo-36907(19): Fix a crash when calling a C function with a keyword\ndict ('f(kwargs)') and changing the dict 'kwargs' while that\nfunction is running.\n\n- bpo-36946(20): Fix possible signed integer overflow when handling\nslices.\n\n- bpo-36826(21): Add NamedExpression kind support to astunparse.c\n\n- bpo-1875(22): A *note SyntaxError: 146. is now raised if a code\nblocks that will be optimized away (e.g.  if conditions that are\nalways false) contains syntax errors.  Patch by Pablo Galindo.\n\n- bpo-36027(23): Allow computation of modular inverses via\nthree-argument 'pow': the second argument is now permitted to be\nnegative in the case where the first and third arguments are\nrelatively prime.\n\n- bpo-36861(24): Update the Unicode database to version 12.1.0.\n\n- bpo-28866(25): Avoid caching attributes of classes which type\ndefines mro() to avoid a hard cache invalidation problem.\n\n- bpo-36851(26): The 'FrameType' stack is now correctly cleaned up if\nthe execution ends with a return and the stack is not empty.\n\n- bpo-34616(27): The 'compile()' builtin functions now support the\n'ast.PyCFALLOWTOPLEVELAWAIT' flag, which allow to compile\nsources that contains top-level 'await', 'async with' or 'async\nfor'.  This is useful to evaluate async-code from with an already\nasync functions; for example in a custom REPL.\n\n- bpo-36842(28): Implement PEP 578, adding sys.audit, io.opencode\nand related APIs.\n\n- bpo-27639(29): Correct return type for UserList slicing operations.\nPatch by Michael Blahay, Erick Cervantes, and vaultah\n\n- bpo-36737(30): Move PyRuntimeState.warnings into per-interpreter\nstate (via \"module state\").\n\n- bpo-36793(31): Removed 'str' implementations from builtin types\n*note bool: 17d, *note int: 17e, *note float: 4b7, *note complex:\n3ad. and few classes from the standard library.  They now inherit\n'str()' from *note object: 8bb.\n\n- bpo-36817(32): Add a '=' feature f-strings for debugging.  This can\nprecede '!s', '!r', or '!a'.  It produces the text of the\nexpression, followed by an equal sign, followed by the repr of the\nvalue of the expression.  So 'f'{3*9+15=}'' would be equal to the\nstring ''3*9+15=42''.  If '=' is specified, the default conversion\nis set to '!r', unless a format spec is given, in which case the\nformatting behavior is unchanged, and format will be used.\n\n- bpo-24048(33): Save the live exception during import.c's\n'removemodule()'.\n\n- bpo-27987(34): pymalloc returns memory blocks aligned by 16 bytes,\ninstead of 8 bytes, on 64-bit platforms to conform x86-64 ABI.\nRecent compilers assume this alignment more often.  Patch by Inada\nNaoki.\n\n- bpo-36601(35): A long-since-meaningless check for 'getpid() ==\nmainpid' was removed from Python's internal C signal handler.\n\n- bpo-36594(36): Fix incorrect use of '%p' in format strings.  Patch\nby Zackery Spytz.\n\n- bpo-36045(37): 'builtins.help()' now prefixes 'async' for async\nfunctions.\n\n- bpo-36084(38): Add native thread ID (TID) to threading.Thread\nobjects (supported platforms: Windows, FreeBSD, Linux, macOS)\n\n- bpo-36035(39): Added fix for broken symlinks in combination with\npathlib\n\n- bpo-35983(40): Added new trashcan macros to deal with a double\ndeallocation that could occur when the 'tpdealloc' of a subclass\ncalls the 'tpdealloc' of a base class and that base class uses the\ntrashcan mechanism.  Patch by Jeroen Demeyer.\n\n- bpo-20602(41): Do not clear *note sys.flags: 458. and *note\nsys.floatinfo: 175f. during shutdown.  Patch by Zackery Spytz.\n\n- bpo-26826(42): Expose 'copyfilerange()' as a low level API in the\n*note os: 9c. module.\n\n- bpo-32388(43): Remove cross-version binary compatibility\nrequirement in tpflags.\n\n- bpo-31862(44): Port binascii to PEP 489 multiphase initialization.\nPatch by Marcel Plch.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=35814\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=37126\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=37122\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=20092\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=37087\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=26219\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=37072\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=37029\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=26423\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=37050\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=22385\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=26836\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=37032\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=37007\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=36829\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=36878\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=36878\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=2180\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=36907\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=36946\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=36826\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=1875\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=36027\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=36861\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=28866\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=36851\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=34616\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=36842\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=27639\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=36737\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=36793\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=36817\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=24048\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=27987\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=36601\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=36594\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=36045\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=36084\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=36035\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=35983\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=20602\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=26826\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=32388\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=31862\n\nFile: python3.12.info,  Node: Library<42>,  Next: Documentation<42>,  Prev: Core and Builtins<42>,  Up: Python 3 8 0 beta 1\n\n1.22.42.3 Library\n.................\n\n- bpo-37128(1): Added *note math.perm(): 4a0.\n\n- bpo-37120(2): Add SSLContext.numtickets to control the number of\nTLSv1.3 session tickets.\n\n- bpo-12202(3): Fix the error handling in *note\nmsilib.SummaryInformation.GetProperty(): 1761.  Patch by Zackery\nSpytz.\n\n- bpo-26835(4): The fcntl module now contains file sealing constants\nfor sealing of memfds.\n\n- bpo-29262(5): Add 'getorigin()' and 'getargs()' introspection\nhelpers to 'typing' module.\n\n- bpo-12639(6): *note msilib.Directory.startcomponent(): 1762. no\nlonger fails if 'keyfile' is not 'None'.\n\n- bpo-36999(7): Add the 'asyncio.Task.getcoro()' method to publicly\nexpose the tasks's coroutine object.\n\n- bpo-35246(8): Make *note asyncio.createsubprocessexec(): 8a5.\naccept path-like arguments.\n\n- bpo-35279(9): Change default 'maxworkers' of 'ThreadPoolExecutor'\nfrom 'cpucount() * 5' to 'min(32, cpucount() + 4)'.  Previous\nvalue was unreasonably large on many cores machines.\n\n- bpo-37076(10): *note thread.startnewthread(): 13f6. now logs\nuncaught exception raised by the function using *note\nsys.unraisablehook(): 448, rather than *note sys.excepthook(): 5ff,\nso the hook gets access to the function which raised the exception.\n\n- bpo-33725(11): On macOS, the *note multiprocessing: 8f. module now\nuses 'spawn' start method by default.\n\n- bpo-37054(12): Fix destructor 'pyio.BytesIO' and\n'pyio.TextIOWrapper': initialize their 'buffer' attribute as soon\nas possible (in the class body), because it's used by 'del()'\nwhich calls 'close()'.\n\n- bpo-37058(13): PEP 544: Add 'Protocol' and '@runtimecheckable' to\nthe 'typing' module.\n\n- bpo-36933(14): The functions 'sys.setcoroutinewrapper' and\n'sys.getcoroutinewrapper' that were deprecated and marked for\nremoval in 3.8 have been removed.\n\n- bpo-37047(15): Handle late binding and attribute access in *note\nunittest.mock.AsyncMock: 877. setup for autospeccing.  Document\nnewly implemented async methods in *note unittest.mock.MagicMock:\ncf4.\n\n- bpo-37049(16): PEP 589: Add 'TypedDict' to the 'typing' module.\n\n- bpo-37046(17): PEP 586: Add 'Literal' to the 'typing' module.\n\n- bpo-37045(18): PEP 591: Add 'Final' qualifier and '@final'\ndecorator to the 'typing' module.\n\n- bpo-37035(19): Don't log OSError based exceptions if a fatal error\nhas occurred in asyncio transport.  Peer can generate almost any\nOSError, user cannot avoid these exceptions by fixing own code.\nErrors are still propagated to user code, it's just logging them is\npointless and pollute asyncio logs.\n\n- bpo-37001(20): *note symtable.symtable(): 1763. now accepts the\nsame input types for source code as the built-in *note compile():\n528. function.  Patch by Dino Viehland.\n\n- bpo-37028(21): Implement asyncio REPL\n\n- bpo-37027(22): Return safe to use proxy socket object from\ntransport.getextrainfo('socket')\n\n- bpo-32528(23): Make asyncio.CancelledError a BaseException.\n\nThis will address the common mistake many asyncio users make: an\n\"except Exception\" clause breaking Tasks cancellation.\n\nIn addition to this change, we stop inheriting asyncio.TimeoutError\nand asyncio.InvalidStateError from their concurrent.futures.*\ncounterparts.  There's no point for these exceptions to share the\ninheritance chain.\n\n- bpo-1230540(24): Add a new *note threading.excepthook(): 641.\nfunction which handles uncaught *note threading.Thread.run(): 868.\nexception.  It can be overridden to control how uncaught *note\nthreading.Thread.run(): 868. exceptions are handled.\n\n- bpo-36996(25): Handle *note unittest.mock.patch(): cf5. used as a\ndecorator on async functions.\n\n- bpo-37008(26): Add support for calling *note next(): 5cb. with the\nmock resulting from *note unittest.mock.mockopen(): 1764.\n\n- bpo-27737(27): Allow whitespace only header encoding in\n'email.header' - by Batuhan Taskaya\n\n- bpo-36969(28): PDB command 'args' now display positional only\narguments.  Patch contributed by Re'mi Lapeyre.\n\n- bpo-36969(29): PDB command 'args' now display keyword only\narguments.  Patch contributed by Re'mi Lapeyre.\n\n- bpo-36983(30): Add missing names to 'typing.all': 'ChainMap',\n'ForwardRef', 'OrderedDict' - by Anthony Sottile.\n\n- bpo-36972(31): Add SupportsIndex protocol to the typing module to\nallow type checking to detect classes that can be passed to\n'hex()', 'oct()' and 'bin()'.\n\n- bpo-32972(32): Implement 'unittest.IsolatedAsyncioTestCase' to help\ntesting asyncio-based code.\n\n- bpo-36952(33): *note fileinput.input(): 5f2. and *note\nfileinput.FileInput: 51b. 'bufsize' argument has been removed (was\ndeprecated and ignored since Python 3.6), and as a result the\n'mode' and 'openhook' arguments have been made keyword-only.\n\n- bpo-36952(34): Starting with Python 3.3, importing ABCs from *note\ncollections: 1b. is deprecated, and import should be done from\n*note collections.abc: 1c.  Still being able to import from *note\ncollections: 1b. was marked for removal in 3.8, but has been\ndelayed to 3.9; documentation and 'DeprecationWarning' clarified.\n\n- bpo-36949(35): Implement repr for WeakSet objects.\n\n- bpo-36948(36): Fix *note NameError: 144. in *note\nurllib.request.URLopener.retrieve(): 1765.  Patch by Karthikeyan\nSingaravelan.\n\n- bpo-33524(37): Fix the folding of email header when the\nmaxlinelength is 0 or None and the header contains non-ascii\ncharacters.  Contributed by Licht Takeuchi (@Licht-T).\n\n- bpo-24564(38): *note shutil.copystat(): fa0. now ignores *note\nerrno.EINVAL: 1766. on *note os.setxattr(): f77. which may occur\nwhen copying files on filesystems without extended attributes\nsupport.\n\nOriginal patch by Giampaolo Rodola, updated by Ying Wang.\n\n- bpo-36888(39): Python child processes can now access the status of\ntheir parent process using multiprocessing.process.parentprocess\n\n- bpo-36921(40): Deprecate '@coroutine' for sake of 'async def'.\n\n- bpo-25652(41): Fix bug in 'rmod' of 'UserString' - by Batuhan\nTaskaya.\n\n- bpo-36916(42): Remove a message about an unhandled exception in a\ntask when writer.write() is used without await and writer.drain()\nfails with an exception.\n\n- bpo-36889(43): Introduce 'asyncio.Stream' class that merges *note\nasyncio.StreamReader: 1628. and *note asyncio.StreamWriter: 1419.\nfunctionality.  'asyncio.Stream' can work in readonly, writeonly\nand readwrite modes.  Provide 'asyncio.connect()',\n'asyncio.connectunix()', 'asyncio.connectreadpipe()' and\n'asyncio.connectwritepipe()' factories to open 'asyncio.Stream'\nconnections.  Provide 'asyncio.StreamServer' and 'UnixStreamServer'\nto serve servers with asyncio.Stream API. Modify *note\nasyncio.createsubprocessshell(): 8a6. and *note\nasyncio.createsubprocessexec(): 8a5. to use 'asyncio.Stream'\ninstead of deprecated 'StreamReader' and 'StreamWriter'.  Deprecate\n*note asyncio.StreamReader: 1628. and *note asyncio.StreamWriter:\n1419.  Deprecate usage of private classes, e.g.\n'asyncio.FlowControlMixing' and 'asyncio.StreamReaderProtocol'\noutside of asyncio package.\n\n- bpo-36845(44): Added validation of integer prefixes to the\nconstruction of IP networks and interfaces in the ipaddress module.\n\n- bpo-23378(45): Add an extend action to argparser.\n\n- bpo-36867(46): Fix a bug making a SharedMemoryManager instance and\nits parent process use two separate resourcetracker processes.\n\n- bpo-23896(47): Adds a grammar to lib2to3.pygram that contains exec\nas a function not as statement.\n\n- bpo-36895(48): The function 'time.clock()' was deprecated in 3.3 in\nfavor of 'time.perfcounter()' and marked for removal in 3.8, it\nhas removed.\n\n- bpo-35545(49): Fix asyncio discarding IPv6 scopes when ensuring\nhostname resolutions internally\n\n- bpo-36887(50): Add new function *note math.isqrt(): 82d. to compute\ninteger square roots.\n\n- bpo-34632(51): Introduce the 'importlib.metadata' module with\n(provisional) support for reading metadata from third-party\npackages.\n\n- bpo-36878(52): When using 'typecomments=True' in 'ast.parse',\ntreat '# type: ignore' followed by a non-alphanumeric character and\nthen arbitrary text as a type ignore, instead of requiring nothing\nbut whitespace or another comment.  This is to permit formations\nsuch as '# type: ignore[E1000]'.\n\n- bpo-36778(53): 'cp65001' encoding (Windows code page 65001) becomes\nan alias to 'utf8' encoding.\n\n- bpo-36867(54): The multiprocessing.resourcetracker replaces the\nmultiprocessing.semaphoretracker module.  Other than semaphores,\nresourcetracker also tracks sharedmemory segments.\n\n- bpo-30262(55): The 'Cache' and 'Statement' objects of the *note\nsqlite3: c9. module are not exposed to the user.  Patch by Aviv\nPalivoda.\n\n- bpo-24538(56): In 'shutil.copystat()', first copy extended file\nattributes and then file permissions, since extended attributes can\nonly be set on the destination while it is still writeable.\n\n- bpo-36829(57): Add new *note sys.unraisablehook(): 448. function\nwhich can be overridden to control how \"unraisable exceptions\" are\nhandled.  It is called when an exception has occurred but there is\nno way for Python to handle it.  For example, when a destructor\nraises an exception or during garbage collection (*note\ngc.collect(): 865.).\n\n- bpo-36832(58): Introducing 'zipfile.Path', a pathlib-compatible\nwrapper for traversing zip files.\n\n- bpo-36814(59): Fix an issue where os.posixspawnp() would\nincorrectly raise a TypeError when fileactions is None.\n\n- bpo-33110(60): Handle exceptions raised by functions added by\nconcurrent.futures adddonecallback correctly when the Future has\nalready completed.\n\n- bpo-26903(61): Limit 'maxworkers' in 'ProcessPoolExecutor' to 61\nto work around a WaitForMultipleObjects limitation.\n\n- bpo-36813(62): Fix *note QueueListener: c8b. to call\n'queue.taskdone()' upon stopping.  Patch by Bar Harel.\n\n- bpo-36806(63): Forbid creation of asyncio stream objects like\nStreamReader, StreamWriter, Process, and their protocols outside of\nasyncio package.\n\n- bpo-36802(64): Provide both sync and async calls for\nStreamWriter.write() and StreamWriter.close()\n\n- bpo-36801(65): Properly handle SSL connection closing in asyncio\nStreamWriter.drain() call.\n\n- bpo-36785(66): Implement PEP 574 (pickle protocol 5 with\nout-of-band buffers).\n\n- bpo-36772(67): functools.lrucache() can now be used as a straight\ndecorator in addition to its existing usage as a function that\nreturns a decorator.\n\n- bpo-6584(68): Add a *note BadGzipFile: 81e. exception to the *note\ngzip: 62. module.\n\n- bpo-36748(69): Optimized write buffering in C implementation of\n'TextIOWrapper'.  Writing ASCII string to 'TextIOWrapper' with\nascii, latin1, or utf-8 encoding is about 20% faster.  Patch by\nInada Naoki.\n\n- bpo-8138(70): Don't mark 'wsgiref.simpleserver.SimpleServer' as\nmulti-threaded since 'wsgiref.simpleserver.WSGIServer' is\nsingle-threaded.\n\n- bpo-22640(71): *note pycompile.compile(): 850. now supports silent\nmode.  Patch by Joannah Nanjekye\n\n- bpo-29183(72): Fix double exceptions in *note\nwsgiref.handlers.BaseHandler: 1767. by calling its 'close()' method\nonly when no exception is raised.\n\n- bpo-36548(73): Improved the repr of regular expression flags.\n\n- bpo-36542(74): The signature of Python functions can now be\noverridden by specifying the 'textsignature' attribute.\n\n- bpo-36533(75): Reinitialize logging.Handler locks in forked child\nprocesses instead of attempting to acquire them all in the parent\nbefore forking only to be released in the child process.  The\nacquire/release pattern was leading to deadlocks in code that has\nimplemented any form of chained logging handlers that depend upon\none another as the lock acquisition order cannot be guaranteed.\n\n- bpo-35252(76): Throw a TypeError instead of an AssertionError when\nusing an invalid type annotation with singledispatch.\n\n- bpo-35900(77): Allow reduction methods to return a 6-item tuple\nwhere the 6th item specifies a custom state-setting method that's\ncalled instead of the regular 'setstate' method.\n\n- bpo-35900(78): enable custom reduction callback registration for\nfunctions and classes in pickle.c, using the new Pickler's\nattribute 'reduceroverride'\n\n- bpo-36368(79): Fix a bug crashing SharedMemoryManager instances in\ninteractive sessions after a ctrl-c (KeyboardInterrupt) was sent\n\n- bpo-31904(80): Fix mmap fail for VxWorks\n\n- bpo-27497(81): *note csv.DictWriter.writeheader(): 1073. now\nreturns the return value of the underlying 'csv.Writer.writerow()'\nmethod.  Patch contributed by Ashish Nitin Patil.\n\n- bpo-36239(82): Parsing .mo files now ignores comments starting and\nending with #-#-#-#-#.\n\n- bpo-26707(83): Enable plistlib to read and write binary plist files\nthat were created as a KeyedArchive file.  Specifically, this\nallows the plistlib to process 0x80 tokens as UID objects.\n\n- bpo-31904(84): Add posix module support for VxWorks.\n\n- bpo-35125(85): Asyncio: Remove inner callback on outer cancellation\nin shield\n\n- bpo-35721(86): Fix 'asyncio.SelectorEventLoop.subprocessexec()'\nleaks file descriptors if 'Popen' fails and called with\n'stdin=subprocess.PIPE'.  Patch by Niklas Fiekas.\n\n- bpo-31855(87): *note unittest.mock.mockopen(): 1764. results now\nrespects the argument of read([size]).  Patch contributed by Re'mi\nLapeyre.\n\n- bpo-35431(88): Implement *note math.comb(): 49f. that returns\nbinomial coefficient, that computes the number of ways to choose k\nitems from n items without repetition and without order.  Patch by\nYash Aggarwal and Keller Fuchs.\n\n- bpo-26660(89): Fixed permission errors in *note TemporaryDirectory:\n10aa. clean up.  Previously 'TemporaryDirectory.cleanup()' failed\nwhen non-writeable or non-searchable files or directories were\ncreated inside a temporary directory.\n\n- bpo-34271(90): Add debugging helpers to ssl module.  It's now\npossible to dump key material and to trace TLS protocol.  The\ndefault and stdlib contexts also support SSLKEYLOGFILE env var.\n\n- bpo-26467(91): Added AsyncMock to support using unittest to mock\nasyncio coroutines.  Patch by Lisa Roach.\n\n- bpo-33569(92): dataclasses.InitVar: Exposes the type used to create\nthe init var.\n\n- bpo-34424(93): Fix serialization of messages containing encoded\nstrings when the policy.linesep is set to a multi-character string.\nPatch by Jens Troeger.\n\n- bpo-34303(94): Performance of *note functools.reduce(): 1151. is\nslightly improved.  Patch by Sergey Fedoseev.\n\n- bpo-33361(95): Fix a bug in *note codecs.StreamRecoder: 1768. where\nseeking might leave old data in a buffer and break subsequent read\ncalls.  Patch by Ammar Askar.\n\n- bpo-22454(96): The *note shlex: bf. module now exposes *note\nshlex.join(): 852, the inverse of *note shlex.split(): 292.  Patch\nby Bo Bayles.\n\n- bpo-31922(97):\n'asyncio.AbstractEventLoop.createdatagramendpoint()': Do not\nconnect UDP socket when broadcast is allowed.  This allows to\nreceive replies after a UDP broadcast.\n\n- bpo-24882(98): Change ThreadPoolExecutor to use existing idle\nthreads before spinning up new ones.\n\n- bpo-31961(99): Added support for bytes and path-like objects in\n*note subprocess.Popen(): 8c3. on Windows.  The 'args' parameter\nnow accepts a *note path-like object: 957. if 'shell' is 'False'\nand a sequence containing bytes and path-like objects.  The\n'executable' parameter now accepts a bytes and *note path-like\nobject: 957.  The 'cwd' parameter now accepts a bytes object.\nBased on patch by Anders Lorentsen.\n\n- bpo-33123(100): *note pathlib.Path.unlink: 1769. now accepts a\n'missingok' parameter to avoid a *note FileNotFoundError: 353.\nfrom being raised.  Patch by Robert Buchholz.\n\n- bpo-32941(101): Allow *note mmap.mmap: 830. objects to access the\nmadvise() system call (through *note mmap.mmap.madvise(): 831.).\n\n- bpo-22102(102): Added support for ZIP files with disks set to 0.\nSuch files are commonly created by builtin tools on Windows when\nuse ZIP64 extension.  Patch by Francisco Facioni.\n\n- bpo-32515(103): trace.py can now run modules via python3 -m trace\n-t -module modulename\n\n- bpo-32299(104): Changed *note unittest.mock.patch.dict(): 176a. to\nreturn the patched dictionary when used as context manager.  Patch\nby Vadim Tsander.\n\n- bpo-27141(105): Added a 'copy()' to 'collections.UserList' and\n'collections.UserDict' in order to correctly implement shallow\ncopying of the objects.  Patch by Bar Harel.\n\n- bpo-31829(106): '\\r', '\\0' and '\\x1a' (end-of-file on Windows) are\nnow escaped in protocol 0 pickles of Unicode strings.  This allows\nto load them without loss from files open in text mode in Python 2.\n\n- bpo-23395(107): 'thread.interruptmain()' now avoids setting the\nPython error status if the 'SIGINT' signal is ignored or not\nhandled by Python.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=37128\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=37120\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=12202\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=26835\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=29262\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=12639\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=36999\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=35246\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=35279\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=37076\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=33725\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=37054\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=37058\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=36933\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=37047\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=37049\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=37046\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=37045\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=37035\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=37001\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=37028\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=37027\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=32528\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=1230540\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=36996\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=37008\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=27737\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=36969\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=36969\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=36983\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=36972\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=32972\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=36952\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=36952\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=36949\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=36948\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=33524\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=24564\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=36888\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=36921\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=25652\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=36916\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=36889\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=36845\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=23378\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=36867\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=23896\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=36895\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=35545\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=36887\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=34632\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=36878\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=36778\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=36867\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=30262\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=24538\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=36829\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=36832\n\n(59) https://bugs.python.org/issue?@action=redirect&bpo=36814\n\n(60) https://bugs.python.org/issue?@action=redirect&bpo=33110\n\n(61) https://bugs.python.org/issue?@action=redirect&bpo=26903\n\n(62) https://bugs.python.org/issue?@action=redirect&bpo=36813\n\n(63) https://bugs.python.org/issue?@action=redirect&bpo=36806\n\n(64) https://bugs.python.org/issue?@action=redirect&bpo=36802\n\n(65) https://bugs.python.org/issue?@action=redirect&bpo=36801\n\n(66) https://bugs.python.org/issue?@action=redirect&bpo=36785\n\n(67) https://bugs.python.org/issue?@action=redirect&bpo=36772\n\n(68) https://bugs.python.org/issue?@action=redirect&bpo=6584\n\n(69) https://bugs.python.org/issue?@action=redirect&bpo=36748\n\n(70) https://bugs.python.org/issue?@action=redirect&bpo=8138\n\n(71) https://bugs.python.org/issue?@action=redirect&bpo=22640\n\n(72) https://bugs.python.org/issue?@action=redirect&bpo=29183\n\n(73) https://bugs.python.org/issue?@action=redirect&bpo=36548\n\n(74) https://bugs.python.org/issue?@action=redirect&bpo=36542\n\n(75) https://bugs.python.org/issue?@action=redirect&bpo=36533\n\n(76) https://bugs.python.org/issue?@action=redirect&bpo=35252\n\n(77) https://bugs.python.org/issue?@action=redirect&bpo=35900\n\n(78) https://bugs.python.org/issue?@action=redirect&bpo=35900\n\n(79) https://bugs.python.org/issue?@action=redirect&bpo=36368\n\n(80) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\n(81) https://bugs.python.org/issue?@action=redirect&bpo=27497\n\n(82) https://bugs.python.org/issue?@action=redirect&bpo=36239\n\n(83) https://bugs.python.org/issue?@action=redirect&bpo=26707\n\n(84) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\n(85) https://bugs.python.org/issue?@action=redirect&bpo=35125\n\n(86) https://bugs.python.org/issue?@action=redirect&bpo=35721\n\n(87) https://bugs.python.org/issue?@action=redirect&bpo=31855\n\n(88) https://bugs.python.org/issue?@action=redirect&bpo=35431\n\n(89) https://bugs.python.org/issue?@action=redirect&bpo=26660\n\n(90) https://bugs.python.org/issue?@action=redirect&bpo=34271\n\n(91) https://bugs.python.org/issue?@action=redirect&bpo=26467\n\n(92) https://bugs.python.org/issue?@action=redirect&bpo=33569\n\n(93) https://bugs.python.org/issue?@action=redirect&bpo=34424\n\n(94) https://bugs.python.org/issue?@action=redirect&bpo=34303\n\n(95) https://bugs.python.org/issue?@action=redirect&bpo=33361\n\n(96) https://bugs.python.org/issue?@action=redirect&bpo=22454\n\n(97) https://bugs.python.org/issue?@action=redirect&bpo=31922\n\n(98) https://bugs.python.org/issue?@action=redirect&bpo=24882\n\n(99) https://bugs.python.org/issue?@action=redirect&bpo=31961\n\n(100) https://bugs.python.org/issue?@action=redirect&bpo=33123\n\n(101) https://bugs.python.org/issue?@action=redirect&bpo=32941\n\n(102) https://bugs.python.org/issue?@action=redirect&bpo=22102\n\n(103) https://bugs.python.org/issue?@action=redirect&bpo=32515\n\n(104) https://bugs.python.org/issue?@action=redirect&bpo=32299\n\n(105) https://bugs.python.org/issue?@action=redirect&bpo=27141\n\n(106) https://bugs.python.org/issue?@action=redirect&bpo=31829\n\n(107) https://bugs.python.org/issue?@action=redirect&bpo=23395\n\nFile: python3.12.info,  Node: Documentation<42>,  Next: Tests<39>,  Prev: Library<42>,  Up: Python 3 8 0 beta 1\n\n1.22.42.4 Documentation\n.......................\n\n- bpo-36896(1): Clarify that some types have unstable constructor\nsignature between Python versions.\n\n- bpo-36686(2): Improve documentation of the stdin, stdout, and\nstderr arguments of the 'asyncio.subprocessexec' function to\nspecify which values are supported.  Also mention that decoding as\ntext is not supported.\n\nAdd a few tests to verify that the various values passed to the\nstd* arguments actually work.\n\n- bpo-36984(3): Improve version added references in 'typing' module -\nby Anthony Sottile.\n\n- bpo-36868(4): What's new now mentions\nSSLContext.hostnamecheckscommonname instead of\nSSLContext.hostflags.\n\n- bpo-35924(5): Add a note to the 'curses.addstr()' documentation to\nwarn that multiline strings can cause segfaults because of an\nncurses bug.\n\n- bpo-36783(6): Added C API Documentation for TimeFromTimeAndFold\nand PyDateTimeFromDateAndTimeAndFold as per PEP 495.  Patch by\nEdison Abahurire.\n\n- bpo-36797(7): More of the legacy distutils documentation has been\neither pruned, or else more clearly marked as being retained solely\nuntil the setuptools documentation covers it independently.\n\n- bpo-22865(8): Add detail to the documentation on the 'pty.spawn'\nfunction.\n\n- bpo-35397(9): Remove deprecation and document\nurllib.parse.unwrap().  Patch contributed by Re'mi Lapeyre.\n\n- bpo-32995(10): Added the context variable in glossary.\n\n- bpo-33519(11): Clarify that 'copy()' is not part of the\n'MutableSequence' ABC.\n\n- bpo-33482(12): Make 'codecs.StreamRecoder.writelines' take a list\nof bytes.\n\n- bpo-25735(13): Added documentation for func factorial to indicate\nthat returns integer values\n\n- bpo-20285(14): Expand object.doc (docstring) to make it\nclearer.  Modify pydoc.py so that help(object) lists object methods\n(for other classes, help omits methods of the object base class.)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36896\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=36686\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=36984\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=36868\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=35924\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=36783\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=36797\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=22865\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=35397\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=32995\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=33519\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=33482\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=25735\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=20285\n\nFile: python3.12.info,  Node: Tests<39>,  Next: Build<40>,  Prev: Documentation<42>,  Up: Python 3 8 0 beta 1\n\n1.22.42.5 Tests\n...............\n\n- bpo-37069(1): Modify testcoroutines, testcprofile,\ntestgenerators, testraise, testssl and testyieldfrom to use\n*note test.support.catchunraisableexception(): 174b. rather than\n*note test.support.capturedstderr(): 176d.\n\n- bpo-37098(2): Fix testmemfdcreate on older Linux Kernels.\n\n- bpo-37081(3): Test with OpenSSL 1.1.1c\n\n- bpo-36829(4): Add *note test.support.catchunraisableexception():\n174b.: context manager catching unraisable exception using *note\nsys.unraisablehook(): 448.\n\n- bpo-36915(5): The main regrtest process now always removes all\ntemporary directories of worker processes even if they crash or if\nthey are killed on KeyboardInterrupt (CTRL+c).\n\n- bpo-36719(6): \"python3 -m test -jN ...\" now continues the execution\nof next tests when a worker process crash (CHILDERROR state).\nPreviously, the test suite stopped immediately.  Use -failfast to\nstop at the first error.\n\n- bpo-36816(7): Update Lib/test/selfsignedpythontestdotnet.pem to\nmatch self-signed.pythontest.net's new TLS certificate.\n\n- bpo-35925(8): Skip httplib and nntplib networking tests when they\nwould otherwise fail due to a modern OS or distro with a default\nOpenSSL policy of rejecting connections to servers with weak\ncertificates.\n\n- bpo-36782(9): Add tests for several C API functions in the *note\ndatetime: 2e. module.  Patch by Edison Abahurire.\n\n- bpo-36342(10): Fix testmultiprocessing in testvenv if platform\nlacks functioning semopen.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=37069\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=37098\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=37081\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=36829\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=36915\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=36719\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=36816\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=35925\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=36782\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=36342\n\nFile: python3.12.info,  Node: Build<40>,  Next: Windows<38>,  Prev: Tests<39>,  Up: Python 3 8 0 beta 1\n\n1.22.42.6 Build\n...............\n\n- bpo-36721(1): To embed Python into an application, a new '--embed'\noption must be passed to 'python3-config --libs --embed' to get\n'-lpython3.8' (link the application to libpython).  To support both\n3.8 and older, try 'python3-config --libs --embed' first and\nfallback to 'python3-config --libs' (without '--embed') if the\nprevious command fails.\n\nAdd a pkg-config 'python-3.8-embed' module to embed Python into an\napplication: 'pkg-config python-3.8-embed --libs' includes\n'-lpython3.8'.  To support both 3.8 and older, try 'pkg-config\npython-X.Y-embed --libs' first and fallback to 'pkg-config\npython-X.Y --libs' (without '--embed') if the previous command\nfails (replace 'X.Y' with the Python version).\n\nOn the other hand, 'pkg-config python3.8 --libs' no longer contains\n'-lpython3.8'.  C extensions must not be linked to libpython\n(except on Android, case handled by the script); this change is\nbackward incompatible on purpose.\n\n- bpo-36786(2): \"make install\" now runs compileall in parallel.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36721\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=36786\n\nFile: python3.12.info,  Node: Windows<38>,  Next: macOS<32>,  Prev: Build<40>,  Up: Python 3 8 0 beta 1\n\n1.22.42.7 Windows\n.................\n\n- bpo-36965(1): include of STATUSCONTROLCEXIT without depending on\nMSC compiler\n\n- bpo-35926(2): Update to OpenSSL 1.1.1b for Windows.\n\n- bpo-29883(3): Add Windows support for UDP transports for the\nProactor Event Loop.  Patch by Adam Meily.\n\n- bpo-33407(4): The *note PyDEPRECATED(): 8d9. macro has been\nimplemented for MSVC.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36965\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=35926\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=29883\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=33407\n\nFile: python3.12.info,  Node: macOS<32>,  Next: IDLE<26>,  Prev: Windows<38>,  Up: Python 3 8 0 beta 1\n\n1.22.42.8 macOS\n...............\n\n- bpo-36231(1): Support building Python on macOS without /usr/include\ninstalled.  As of macOS 10.14, system header files are only\navailable within an SDK provided by either the Command Line Tools\nor the Xcode app.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36231\n\nFile: python3.12.info,  Node: IDLE<26>,  Next: Tools/Demos<21>,  Prev: macOS<32>,  Up: Python 3 8 0 beta 1\n\n1.22.42.9 IDLE\n..............\n\n- bpo-35610(1): Replace now redundant .contextuseps1 with\n.promptlastline.  This finishes change started in bpo-31858(2).\n\n- bpo-37038(3): Make idlelib.run runnable; add test clause.\n\n- bpo-36958(4): Print any argument other than None or int passed to\nSystemExit or sys.exit().\n\n- bpo-36807(5): When saving a file, call os.fsync() so bits are\nflushed to e.g.  USB drive.\n\n- bpo-32411(6): In browser.py, remove extraneous sorting by line\nnumber since dictionary was created in line number order.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=35610\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31858\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=37038\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=36958\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=36807\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=32411\n\nFile: python3.12.info,  Node: Tools/Demos<21>,  Next: C API<38>,  Prev: IDLE<26>,  Up: Python 3 8 0 beta 1\n\n1.22.42.10 Tools/Demos\n......................\n\n- bpo-37053(1): Handle strings like u\"bar\" correctly in\nTools/parser/unparse.py.  Patch by Chih-Hsuan Yen.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=37053\n\nFile: python3.12.info,  Node: C API<38>,  Prev: Tools/Demos<21>,  Up: Python 3 8 0 beta 1\n\n1.22.42.11 C API\n................\n\n- bpo-36763(1): Implement the PEP 587(2) \"Python Initialization\nConfiguration\".\n\n- bpo-36379(3): Fix crashes when attempting to use the 'modulo'\nparameter when 'ipow' is implemented in C.\n\n- bpo-37107(4): Update *note PyObjectCallMethodObjArgs(): 1774. and\n'PyObjectCallMethodIdObjArgs' to use 'PyObjectGetMethod' to\navoid creating a bound method object in many cases.  Patch by\nMichael J. Sullivan.\n\n- bpo-36974(5): Implement PEP 590(6): Vectorcall: a fast calling\nprotocol for CPython.  This is a new protocol to optimize calls of\ncustom callable objects.\n\n- bpo-36763(7): 'PyMain()' now returns the exitcode rather than\ncalling 'PyExit(exitcode)' when calling 'PyErrPrint()' if the\ncurrent exception type is 'SystemExit'.\n\n- bpo-36922(8): Add new type flag 'PyTPFLAGSMETHODDESCRIPTOR' for\nobjects behaving like unbound methods.  These are objects\nsupporting the optimization given by the\n'LOADMETHOD'/'CALLMETHOD' opcodes.  See PEP 590.\n\n- bpo-36728(9): The 'PyEvalReInitThreads()' function has been\nremoved from the C API. It should not be called explicitly: use\n*note PyOSAfterForkChild(): 33b. instead.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36763\n\n(2) https://peps.python.org/pep-0587/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=36379\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=37107\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=36974\n\n(6) https://peps.python.org/pep-0590/\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=36763\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=36922\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=36728\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 8 0 alpha 4,  Next: Python 3 8 0 alpha 3,  Prev: Python 3 8 0 beta 1,  Up: Changelog": {
            "content": "'Release date: 2019-05-06'\n\n* Menu:\n\n* Security: Security<29>.\n* Core and Builtins: Core and Builtins<43>.\n* Library: Library<43>.\n* Documentation: Documentation<43>.\n* Tests: Tests<40>.\n* Build: Build<41>.\n* Windows: Windows<39>.\n* macOS: macOS<33>.\n* IDLE: IDLE<27>.\n* Tools/Demos: Tools/Demos<22>.\n* C API: C API<39>.\n\nFile: python3.12.info,  Node: Security<29>,  Next: Core and Builtins<43>,  Up: Python 3 8 0 alpha 4\n\n1.22.43.1 Security\n..................\n\n- bpo-36742(1): Fixes mishandling of pre-normalization characters in\nurlsplit().\n\n- bpo-30458(2): Address CVE-2019-9740 by disallowing URL paths with\nembedded whitespace or control characters through into the\nunderlying http client request.  Such potentially malicious header\ninjection URLs now cause an http.client.InvalidURL exception to be\nraised.\n\n- bpo-35755(3): *note shutil.which(): 1d6. now uses\n'os.confstr(\"CSPATH\")' if available and if the 'PATH' environment\nvariable is not set.  Remove also the current directory from\n'posixpath.defpath'.  On Unix, *note shutil.which(): 1d6. and the\n*note subprocess: d0. module no longer search the executable in the\ncurrent directory if the 'PATH' environment variable is not set.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36742\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=30458\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=35755\n\nFile: python3.12.info,  Node: Core and Builtins<43>,  Next: Library<43>,  Prev: Security<29>,  Up: Python 3 8 0 alpha 4\n\n1.22.43.2 Core and Builtins\n...........................\n\n- bpo-36722(1): In debug build, import now also looks for C\nextensions compiled in release mode and for C extensions compiled\nin the stable ABI.\n\n- bpo-32849(2): Fix Python Initialization code on FreeBSD to detect\nproperly when stdin file descriptor (fd 0) is invalid.\n\n- bpo-36623(3): Remove parser headers and related function\ndeclarations that lack implementations after the removal of pgen.\n\n- bpo-20180(4): 'dict.pop()' is now up to 33% faster thanks to\nArgument Clinic.  Patch by Inada Naoki.\n\n- bpo-36611(5): Debug memory allocators: disable serialno field by\ndefault from debug hooks on Python memory allocators to reduce the\nmemory footprint by 5%.  Enable *note tracemalloc: fa. to get the\ntraceback where a memory block has been allocated when a fatal\nmemory error is logged to decide where to put a breakpoint.\nCompile Python with 'PYMEMDEBUGSERIALNO' defined to get back the\nfield.\n\n- bpo-36588(6): On AIX, *note sys.platform: 8bc. doesn't contain the\nmajor version anymore.  Always return ''aix'', instead of ''aix3''\n..  ''aix7''.  Since older Python versions include the version\nnumber, it is recommended to always use\n'sys.platform.startswith('aix')'.  Contributed by M. Felt.\n\n- bpo-36549(7): Change str.capitalize to use titlecase for the first\ncharacter instead of uppercase.\n\n- bpo-36540(8): Implement PEP 570(9) (Python positional-only\nparameters).  Patch by Pablo Galindo.\n\n- bpo-36475(10): 'PyEvalAcquireLock()' and 'PyEvalAcquireThread()'\nnow terminate the current thread if called while the interpreter is\nfinalizing, making them consistent with *note\nPyEvalRestoreThread(): 8bd, *note PyENDALLOWTHREADS(): 8be, and\n*note PyGILStateEnsure(): 8bf.\n\n- bpo-36504(11): Fix signed integer overflow in ctypes.c's\n'PyCArrayTypenew()'.\n\n- bpo-20844(12): Fix running script with encoding cookie and LF line\nending may fail on Windows.\n\n- bpo-24214(13): Fixed support of the surrogatepass error handler in\nthe UTF-8 incremental decoder.\n\n- bpo-36452(14): Changing 'dict' keys during iteration of the dict\nitself, 'keys()', 'values()', or 'items()' will now be detected in\ncertain corner cases where keys are deleted/added so that the\nnumber of keys isn't changed.  A 'RuntimeError' will be raised\nafter 'len(dict)' iterations.  Contributed by Thomas Perl.\n\n- bpo-36459(15): Fix a possible double 'PyMemFREE()' due to\ntokenizer.c's 'toknextc()'.\n\n- bpo-36433(16): Fixed TypeError message in classmethoddescrcall.\n\n- bpo-36430(17): Fix a possible reference leak in *note\nitertools.count(): 10fc.\n\n- bpo-36440(18): Include node names in 'ParserError' messages,\ninstead of numeric IDs.  Patch by A. Skrobov.\n\n- bpo-36143(19): Regenerate *note keyword: 7e. from the Grammar and\nTokens file using pgen.  Patch by Pablo Galindo.\n\n- bpo-18372(20): Add missing *note PyObjectGCTrack(): 1360. calls\nin the *note pickle: a1. module.  Patch by Zackery Spytz.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36722\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32849\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=36623\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=20180\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=36611\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=36588\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=36549\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=36540\n\n(9) https://peps.python.org/pep-0570/\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=36475\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=36504\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=20844\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=24214\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=36452\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=36459\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=36433\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=36430\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=36440\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=36143\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=18372\n\nFile: python3.12.info,  Node: Library<43>,  Next: Documentation<43>,  Prev: Core and Builtins<43>,  Up: Python 3 8 0 alpha 4\n\n1.22.43.3 Library\n.................\n\n- bpo-35952(1): Fix pythoninfo when the compiler is missing.\n\n- bpo-28238(2): The '.find*()' methods of xml.etree.ElementTree can\nnow search for wildcards like '{*}tag' and '{ns}*' that match a tag\nin any namespace or all tags in a namespace.  Patch by Stefan\nBehnel.\n\n- bpo-26978(3): 'pathlib.path.linkto()' is now implemented.  It\ncreates a hard link pointing to a path.\n\n- bpo-1613500(4): *note fileinput.FileInput: 51b. now uses the input\nfile mode to correctly set the output file mode (previously it was\nhardcoded to ''w'') when 'inplace=True' is passed to its\nconstructor.\n\n- bpo-36734(5): Fix compilation of 'faulthandler.c' on HP-UX.\nInitialize 'stackt currentstack' to zero using 'memset()'.\n\n- bpo-13611(6): The xml.etree.ElementTree packages gained support for\nC14N 2.0 serialisation.  Patch by Stefan Behnel.\n\n- bpo-36669(7): Add missing matrix multiplication operator support to\nweakref.proxy.\n\n- bpo-36676(8): The XMLParser() in xml.etree.ElementTree provides\nnamespace prefix context to the parser target if it defines the\ncallback methods \"startns()\" and/or \"endns()\".  Patch by Stefan\nBehnel.\n\n- bpo-36673(9): The TreeBuilder and XMLPullParser in\nxml.etree.ElementTree gained support for parsing comments and\nprocessing instructions.  Patch by Stefan Behnel.\n\n- bpo-36650(10): The C version of functools.lrucache() was treating\ncalls with an empty 'kwargs' dictionary as being distinct from\ncalls with no keywords at all.  This did not result in an incorrect\nanswer, but it did trigger an unexpected cache miss.\n\n- bpo-28552(11): Fix 'distutils.sysconfig' if *note sys.executable:\n330. is 'None' or an empty string: use *note os.getcwd(): 1779. to\ninitialize 'projectbase'.  Fix also the distutils build command:\ndon't use *note sys.executable: 330. if it is 'None' or an empty\nstring.\n\n- bpo-35755(12): *note shutil.which(): 1d6. and\n'distutils.spawn.findexecutable' now use 'os.confstr(\"CSPATH\")'\nif available instead of *note os.defpath: 177a, if the 'PATH'\nenvironment variable is not set.  Moreover, don't use\n'os.confstr(\"CSPATH\")' nor *note os.defpath: 177a. if the 'PATH'\nenvironment variable is set to an empty string.\n\n- bpo-25430(13): improve performance of 'IPNetwork.contains()'\n\n- bpo-30485(14): Path expressions in xml.etree.ElementTree can now\navoid explicit namespace prefixes for tags (or the \"{namespace}tag\"\nnotation) by passing a default namespace with an empty string\nprefix.\n\n- bpo-36613(15): Fix *note asyncio: 9. wait() not removing callback\nif exception\n\n- bpo-36598(16): Fix 'isinstance' check for Mock objects with spec\nwhen the code is executed under tracing.  Patch by Karthikeyan\nSingaravelan.\n\n- bpo-18748(17): In development mode (*note -X: 188. 'dev') and in\ndebug build, the *note io.IOBase: 823. destructor now logs\n'close()' exceptions.  These exceptions are silent by default in\nrelease mode.\n\n- bpo-36575(18): The 'lsprof' module now uses internal timer same to\n'time.perfcounter()' by default.  'gettimeofday(2)' was used on\nUnix.  New timer has better resolution on most Unix platforms and\ntimings are no longer impacted by system clock updates since\n'perfcounter()' is monotonic.  Patch by Inada Naoki.\n\n- bpo-33461(19): 'json.loads' now emits 'DeprecationWarning' when\n'encoding' option is specified.  Patch by Matthias Bussonnier.\n\n- bpo-36559(20): The random module now prefers the lean internal\nsha512 module over hashlib for seed(version=2) to optimize import\ntime.\n\n- bpo-17561(21): Set backlog=None as the default for\nsocket.createserver.\n\n- bpo-34373(22): Fix *note time.mktime(): 105c. error handling on AIX\nfor year before 1970.\n\n- bpo-36232(23): Improve error message when trying to open existing\nDBM database that actually doesn't exist.  Patch by Marco Rougeth.\n\n- bpo-36546(24): Add statistics.quantiles()\n\n- bpo-36050(25): Optimized 'http.client.HTTPResponse.read()' for\nlarge response.  Patch by Inada Naoki.\n\n- bpo-36522(26): If 'debuglevel' is set to >0 in *note http.client:\n6a, print all values for headers with multiple values for the same\nheader name.  Patch by Matt Houglum.\n\n- bpo-36492(27): Deprecated passing required arguments like 'func' as\nkeyword arguments in functions which should accept arbitrary\nkeyword arguments and pass them to other function.  Arbitrary\nkeyword arguments (even with names \"self\" and \"func\") can now be\npassed to these functions if the required arguments are passed as\npositional arguments.\n\n- bpo-27181(28): Add statistics.geometricmean().\n\n- bpo-30427(29): 'os.path.normcase()' relies on 'os.fspath()' to\ncheck the type of its argument.  Redundant checks have been removed\nfrom its 'posixpath.normcase()' and 'ntpath.normcase()'\nimplementations.  Patch by Wolfgang Maier.\n\n- bpo-36385(30): Stop rejecting IPv4 octets for being ambiguously\noctal.  Leading zeros are ignored, and no longer are assumed to\nspecify octal octets.  Octets are always decimal numbers.  Octets\nmust still be no more than three digits, including leading zeroes.\n\n- bpo-36434(31): Errors during writing to a ZIP file no longer\nprevent to properly close it.\n\n- bpo-36407(32): Fixed wrong indentation writing for CDATA section in\nxml.dom.minidom.  Patch by Vladimir Surjaninov.\n\n- bpo-36326(33): inspect.getdoc() can now find docstrings for member\nobjects when slots is a dictionary.\n\n- bpo-36366(34): Calling 'stop()' on an unstarted or stopped *note\nunittest.mock.patch(): cf5. object will now return 'None' instead\nof raising *note RuntimeError: 17a, making the method idempotent.\nPatch by Karthikeyan Singaravelan.\n\n- bpo-36348(35): The 'imap.IMAP4.logout()' method no longer ignores\nsilently arbitrary exceptions.\n\n- bpo-31904(36): Add time module support and fix testtime faiures\nfor VxWorks.\n\n- bpo-36227(37): Added support for keyword arguments\n'defaultnamespace' and 'xmldeclaration' in functions\n'ElementTree.tostring()' and 'ElementTree.tostringlist()'.\n\n- bpo-36004(38): Added new alternate constructors *note\ndatetime.date.fromisocalendar(): 812. and *note\ndatetime.datetime.fromisocalendar(): 813, which construct date\nobjects from ISO year, week number and weekday; these are the\ninverse of each class's 'isocalendar' method.  Patch by Paul\nGanssle.\n\n- bpo-35936(39): *note modulefinder: 8c. no longer depends on the\ndeprecated 'imp' module, and the initializer for *note\nmodulefinder.ModuleFinder: 177b. now has immutable default\narguments.  Patch by Brandt Bucher.\n\n- bpo-35376(40): *note modulefinder: 8c. correctly handles modules\nthat have the same name as a bad package.  Patch by Brandt Bucher.\n\n- bpo-17396(41): *note modulefinder: 8c. no longer crashes when\nencountering syntax errors in followed imports.  Patch by Brandt\nBucher.\n\n- bpo-35934(42): Added *note createserver(): 856. and *note\nhasdualstackipv6(): 857. convenience functions to automate the\nnecessary tasks usually involved when creating a server socket,\nincluding accepting both IPv4 and IPv6 connections on the same\nsocket.  (Contributed by Giampaolo Rodola in bpo-17561(43).)\n\n- bpo-23078(44): Add support for *note classmethod(): 246. and *note\nstaticmethod(): 5cc. to *note unittest.mock.createautospec():\n13b3.  Initial patch by Felipe Ochoa.\n\n- bpo-35416(45): Fix potential resource warnings in distutils.  Patch\nby Mickae\"l Schoentgen.\n\n- bpo-25451(46): Add transparency methods to 'tkinter.PhotoImage'.\nPatch by Zackery Spytz.\n\n- bpo-35082(47): Don't return deleted attributes when calling dir on\na *note unittest.mock.Mock: 878.\n\n- bpo-34547(48): *note wsgiref.handlers.BaseHandler: 1767. now\nhandles abrupt client connection terminations gracefully.  Patch by\nPetter Strandmark.\n\n- bpo-31658(49): *note xml.sax.parse(): 177c. now supports *note\npath-like: 957.  Patch by Mickae\"l Schoentgen.\n\n- bpo-34139(50): Remove stale unix datagram socket before binding\n\n- bpo-33530(51): Implemented Happy Eyeballs in\n'asyncio.createconnection()'.  Added two new arguments,\n'happyeyeballsdelay' and 'interleave', to specify Happy Eyeballs\nbehavior.\n\n- bpo-33291(52): Do not raise AttributeError when calling the inspect\nfunctions isgeneratorfunction, iscoroutinefunction,\nisasyncgenfunction on a method created from an arbitrary callable.\nInstead, return False.\n\n- bpo-31310(53): Fix the multiprocessing.semaphoretracker so it is\nreused by child processes\n\n- bpo-31292(54): Fix 'setup.py check --restructuredtext' for files\ncontaining 'include' directives.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=35952\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=28238\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=26978\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=1613500\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=36734\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=13611\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=36669\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=36676\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=36673\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=36650\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=28552\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=35755\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=25430\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=30485\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=36613\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=36598\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=18748\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=36575\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=33461\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=36559\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=17561\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=34373\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=36232\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=36546\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=36050\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=36522\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=36492\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=27181\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=30427\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=36385\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=36434\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=36407\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=36326\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=36366\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=36348\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=36227\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=36004\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=35936\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=35376\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=17396\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=35934\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=17561\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=23078\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=35416\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=25451\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=35082\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=34547\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=31658\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=34139\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=33530\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=33291\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=31310\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=31292\n\nFile: python3.12.info,  Node: Documentation<43>,  Next: Tests<40>,  Prev: Library<43>,  Up: Python 3 8 0 alpha 4\n\n1.22.43.4 Documentation\n.......................\n\n- bpo-36625(1): Remove obsolete comments from docstrings in\nfractions.Fraction\n\n- bpo-30840(2): Document relative imports\n\n- bpo-36523(3): Add docstring for io.IOBase.writelines().\n\n- bpo-36425(4): New documentation translation: Simplified Chinese(5).\n\n- bpo-36345(6): Avoid the duplication of code from\n'Tools/scripts/serve.py' in using the 'literalinclude' directive\nfor the basic wsgiref-based web server in the documentation of\n*note wsgiref: 113.  Contributed by Ste'phane Wirtel.\n\n- bpo-36345(7): Using the code of the 'Tools/scripts/serve.py' script\nas an example in the *note wsgiref: 113. documentation.\nContributed by Ste'phane Wirtel.\n\n- bpo-36157(8): Added Documention for PyInterpreterStateMain().\n\n- bpo-33043(9): Updates the docs.python.org page with the addition of\na 'Contributing to Docs' link at the end of the page (between\n'Reporting Bugs' and 'About Documentation').  Updates the 'Found a\nBug' page with additional links and information in the\nDocumentation Bugs section.\n\n- bpo-35581(10): @typing.typecheckonly now allows type stubs to\nmark functions and classes not available during runtime.\n\n- bpo-33832(11): Add glossary entry for 'magic method'.\n\n- bpo-32913(12): Added re.Match.groupdict example to regex HOWTO.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36625\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=30840\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=36523\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=36425\n\n(5) https://docs.python.org/zh-cn/\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=36345\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=36345\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=36157\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=33043\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=35581\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=33832\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=32913\n\nFile: python3.12.info,  Node: Tests<40>,  Next: Build<41>,  Prev: Documentation<43>,  Up: Python 3 8 0 alpha 4\n\n1.22.43.5 Tests\n...............\n\n- bpo-36719(1): regrtest now always detects uncollectable objects.\nPreviously, the check was only enabled by '--findleaks'.  The check\nnow also works with '-jN/--multiprocess N'.  '--findleaks' becomes\na deprecated alias to '--fail-env-changed'.\n\n- bpo-36725(2): When using multiprocessing mode (-jN), regrtest now\nbetter reports errors if a worker process fails, and it exits\nimmediately on a worker thread failure or when interrupted.\n\n- bpo-36454(3): Change testtime.testmonotonic() to test only the\nlower bound of elapsed time after a sleep command rather than the\nupper bound.  This prevents unnecessary test failures on slow\nbuildbots.  Patch by Victor Stinner.\n\n- bpo-32424(4): Improve test coverage for xml.etree.ElementTree.\nPatch by Gordon P. Hemsley.\n\n- bpo-32424(5): Fix typo in testcyclicgc() test for\nxml.etree.ElementTree.  Patch by Gordon P. Hemsley.\n\n- bpo-36635(6): Add a new 'testinternalcapi' module to test the\ninternal C API.\n\n- bpo-36629(7): Fix 'testimap4hostdefaultvalue()' of\n'testimaplib': catch also *note errno.ENETUNREACH: 177f. error.\n\n- bpo-36611(8): Fix 'testsys.testgetallocatedblocks()' when *note\ntracemalloc: fa. is enabled.\n\n- bpo-36560(9): Fix reference leak hunting in regrtest: compute also\ndeltas (of reference count, allocated memory blocks, file\ndescriptor count) during warmup, to ensure that everything is\ninitialized before starting to hunt reference leaks.\n\n- bpo-36565(10): Fix reference hunting ('python3 -m test -R 3:3')\nwhen Python has no built-in abc module.\n\n- bpo-31904(11): Port testresource to VxWorks: skip tests cases\nsetting RLIMITFSIZE and RLIMITCPU.\n\n- bpo-31904(12): Fix testtabnanny on VxWorks: adjust ENOENT error\nmessage.\n\n- bpo-36436(13): Fix 'testcapi.pymembufferoverflow()': handle\nmemory allocation failure.\n\n- bpo-31904(14): Fix testutf8mode on VxWorks: Python always use\nUTF-8 on VxWorks.\n\n- bpo-36341(15): Fix tests that may fail with PermissionError upon\ncalling bind() on AFUNIX sockets.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36719\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=36725\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=36454\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=32424\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=32424\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=36635\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=36629\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=36611\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=36560\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=36565\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=36436\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=36341\n\nFile: python3.12.info,  Node: Build<41>,  Next: Windows<39>,  Prev: Tests<40>,  Up: Python 3 8 0 alpha 4\n\n1.22.43.6 Build\n...............\n\n- bpo-36747(1): Remove the stale scriptsinstall Makefile target.\n\n- bpo-21536(2): On Unix, C extensions are no longer linked to\nlibpython except on Android and Cygwin.\n\nIt is now possible for a statically linked Python to load a C\nextension built using a shared library Python.\n\nWhen Python is embedded, 'libpython' must not be loaded with\n'RTLDLOCAL', but 'RTLDGLOBAL' instead.  Previously, using\n'RTLDLOCAL', it was already not possible to load C extensions\nwhich were not linked to 'libpython', such as C extensions of the\nstandard library built by the '*shared*' section of\n'Modules/Setup'.\n\ndistutils, python-config and python-config.py have been modified.\n\n- bpo-36707(3): './configure --with-pymalloc' no longer adds the 'm'\nflag to SOABI (sys.implementation.cachetag).  Enabling or\ndisabling pymalloc has no impact on the ABI.\n\n- bpo-36635(4): Change 'PyAPIFUNC(type)', 'PyAPIDATA(type)' and\n'PyMODINITFUNC' macros of 'pyport.h' when 'PyBUILDCOREMODULE'\nis defined.  The 'PyBUILDCOREMODULE' define must be now be used\nto build a C extension as a dynamic library accessing Python\ninternals: export the 'PyInitXXX()' function in DLL exports on\nWindows.\n\n- bpo-31904(5): Don't build the 'crypt' extension on VxWorks.\n\n- bpo-36618(6): Add '-fmax-type-align=8' to CFLAGS when clang\ncompiler is detected.  The pymalloc memory allocator aligns memory\non 8 bytes.  On x86-64, clang expects alignment on 16 bytes by\ndefault and so uses MOVAPS instruction which can lead to\nsegmentation fault.  Instruct clang that Python is limited to\nalignment on 8 bytes to use MOVUPS instruction instead: slower but\ndon't trigger a SIGSEGV if the memory is not aligned on 16 bytes.\nSadly, the flag must be added to 'CFLAGS' and not just\n'CFLAGSNODIST', since third party C extensions can have the same\nissue.\n\n- bpo-36605(7): 'make tags' and 'make TAGS' now also parse\n'Modules/io/*.c' and 'Modules/io/*.h'.\n\n- bpo-36465(8): Release builds and debug builds are now ABI\ncompatible: defining the 'PyDEBUG' macro no longer implies the\n'PyTRACEREFS' macro, which introduces the only ABI\nincompatibility.  The 'PyTRACEREFS' macro, which adds the\n'sys.getobjects()' function and the *note PYTHONDUMPREFS: 7ca.\nenvironment variable, can be set using the new './configure\n--with-trace-refs' build option.\n\n- bpo-36577(9): setup.py now correctly reports missing OpenSSL\nheaders and libraries again.\n\n- bpo-36544(10): Fix regression introduced in bpo-36146(11)\nrefactoring setup.py\n\n- bpo-36508(12): 'python-config --ldflags' no longer includes flags\nof the 'LINKFORSHARED' variable.  The 'LINKFORSHARED' variable must\nonly be used to build executables.\n\n- bpo-36503(13): Remove references to \"aix3\" and \"aix4\".  Patch by M.\nFelt.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36747\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=21536\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=36707\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=36635\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=36618\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=36605\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=36465\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=36577\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=36544\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=36146\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=36508\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=36503\n\nFile: python3.12.info,  Node: Windows<39>,  Next: macOS<33>,  Prev: Build<41>,  Up: Python 3 8 0 alpha 4\n\n1.22.43.7 Windows\n.................\n\n- bpo-35920(1): Added platform.win32edition() and\nplatform.win32isiot().  Added support for cross-compiling\npackages for Windows ARM32.  Skip tests that are not expected to\nwork on Windows IoT Core ARM32.\n\n- bpo-36649(2): Remove trailing spaces for registry keys when\ninstalled via the Store.\n\n- bpo-34144(3): Fixed activate.bat to correctly update codepage when\nchcp.com returns dots in output.  Patch by Lorenz Mende.\n\n- bpo-36509(4): Added preset-iot layout for Windows IoT ARM\ncontainers.  This layout doesn't contain UI components like tkinter\nor IDLE. It also doesn't contain files to support on-target builds\nsince Windows ARM32 builds must be cross-compiled when using MSVC.\n\n- bpo-35941(5): enumcertificates function of the ssl module now\nreturns certificates from all available certificate stores inside\nwindows in a query instead of returning only certificates from the\nsystem wide certificate store.  This includes certificates from\nthese certificate stores: local machine, local machine enterprise,\nlocal machine group policy, current user, current user group\npolicy, services, users.  ssl.enumcrls() function is changed in\nthe same way to return all certificate revocation lists inside the\nwindows certificate revocation list stores.\n\n- bpo-36441(6): Fixes creating a venv when debug binaries are\ninstalled.\n\n- bpo-36085(7): Enable better DLL resolution on Windows by using safe\nDLL search paths and adding *note os.adddlldirectory(): 810.\n\n- bpo-36010(8): Add the venv standard library module to the nuget\ndistribution for Windows.\n\n- bpo-29515(9): Add the following socket module constants on Windows:\nIPPROTOAH IPPROTOCBT IPPROTODSTOPTS IPPROTOEGP IPPROTOESP\nIPPROTOFRAGMENT IPPROTOGGP IPPROTOHOPOPTS IPPROTOICLFXBM\nIPPROTOICMPV6 IPPROTOIDP IPPROTOIGMP IPPROTOIGP IPPROTOIPV4\nIPPROTOIPV6 IPPROTOL2TP IPPROTOMAX IPPROTOND IPPROTONONE\nIPPROTOPGM IPPROTOPIM IPPROTOPUP IPPROTORDP IPPROTOROUTING\nIPPROTOSCTP IPPROTOST\n\n- bpo-35947(10): Added current version of libffi to\ncpython-source-deps.  Change ctypes to use current version of\nlibffi on Windows.\n\n- bpo-34060(11): Report system load when running test suite on\nWindows.  Patch by Ammar Askar.  Based on prior work by Jeremy\nKloth.\n\n- bpo-31512(12): With the Windows 10 Creators Update, non-elevated\nusers can now create symlinks as long as the computer has Developer\nMode enabled.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=35920\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=36649\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=34144\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=36509\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=35941\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=36441\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=36085\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=36010\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=29515\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=35947\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=34060\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=31512\n\nFile: python3.12.info,  Node: macOS<33>,  Next: IDLE<27>,  Prev: Windows<39>,  Up: Python 3 8 0 alpha 4\n\n1.22.43.8 macOS\n...............\n\n- bpo-34602(1): Avoid failures setting macOS stack resource limit\nwith resource.setrlimit.  This reverts an earlier fix for\nbpo-18075(2) which forced a non-default stack size when building\nthe interpreter executable on macOS.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=34602\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=18075\n\nFile: python3.12.info,  Node: IDLE<27>,  Next: Tools/Demos<22>,  Prev: macOS<33>,  Up: Python 3 8 0 alpha 4\n\n1.22.43.9 IDLE\n..............\n\n- bpo-36429(1): Fix starting IDLE with pyshell.  Add idlelib.pyshell\nalias at top; remove pyshell alias at bottom.  Remove obsolete\nname=='main' command.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36429\n\nFile: python3.12.info,  Node: Tools/Demos<22>,  Next: C API<39>,  Prev: IDLE<27>,  Up: Python 3 8 0 alpha 4\n\n1.22.43.10 Tools/Demos\n......................\n\n- bpo-14546(1): Fix the argument handling in Tools/scripts/lll.py.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=14546\n\nFile: python3.12.info,  Node: C API<39>,  Prev: Tools/Demos<22>,  Up: Python 3 8 0 alpha 4\n\n1.22.43.11 C API\n................\n\n- bpo-36763(1): Fix memory leak in *note\nPySetStandardStreamEncoding(): e75.: release memory if the\nfunction is called twice.\n\n- bpo-36641(2): PyDocVAR(name) and *note PyDocSTRVAR: 16df.(name,\nstr) now create 'static const char name[]' instead of 'static char\nname[]'.  Patch by Inada Naoki.\n\n- bpo-36389(3): Change the value of 'CLEANBYTE', 'DEADDYTE' and\n'FORBIDDENBYTE' internal constants used by debug hooks on Python\nmemory allocators (*note PyMemSetupDebugHooks(): ab5. function).\nByte patterns '0xCB', '0xDB' and '0xFB' have been replaced with\n'0xCD', '0xDD' and '0xFD' to use the same values than Windows CRT\ndebug 'malloc()' and 'free()'.\n\n- bpo-36443(4): Since Python 3.7.0, calling *note PyDecodeLocale():\na0b. before *note PyInitialize(): 6c2. produces mojibake if the\n'LCCTYPE' locale is coerced and/or if the UTF-8 Mode is enabled by\nthe user configuration.  The LCCTYPE coercion and UTF-8 Mode are\nnow disabled by default to fix the mojibake issue.  They must now\nbe enabled explicitly (opt-in) using the new 'PyPreInitialize()'\nAPI with 'PyPreConfig'.\n\n- bpo-36025(5): Fixed an accidental change to the datetime C API\nwhere the arguments to the *note PyDateFromTimestamp(): 1786.\nfunction were incorrectly interpreted as a single timestamp rather\nthan an arguments tuple, which causes existing code to start\nraising *note TypeError: 28e.  The backwards-incompatible change\nwas only present in alpha releases of Python 3.8.  Patch by Paul\nGanssle.\n\n- bpo-35810(6): Modify 'PyObjectInit' to correctly increase the\nrefcount of heap-allocated Type objects.  Also fix the refcounts of\nthe heap-allocated types that were either doing this manually or\nnot decreasing the type's refcount in tpdealloc\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36763\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=36641\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=36389\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=36443\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=36025\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=35810\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 8 0 alpha 3,  Next: Python 3 8 0 alpha 2,  Prev: Python 3 8 0 alpha 4,  Up: Changelog": {
            "content": "'Release date: 2019-03-25'\n\n* Menu:\n\n* Security: Security<30>.\n* Core and Builtins: Core and Builtins<44>.\n* Library: Library<44>.\n* Documentation: Documentation<44>.\n* Tests: Tests<41>.\n* Build: Build<42>.\n* Windows: Windows<40>.\n* IDLE: IDLE<28>.\n* Tools/Demos: Tools/Demos<23>.\n* C API: C API<40>.\n\nFile: python3.12.info,  Node: Security<30>,  Next: Core and Builtins<44>,  Up: Python 3 8 0 alpha 3\n\n1.22.44.1 Security\n..................\n\n- bpo-36216(1): Changes urlsplit() to raise ValueError when the URL\ncontains characters that decompose under IDNA encoding\n(NFKC-normalization) into characters that affect how the URL is\nparsed.\n\n- bpo-35121(2): Don't send cookies of domain A without Domain\nattribute to domain B when domain A is a suffix match of domain B\nwhile using a cookiejar with *note\nhttp.cookiejar.DefaultCookiePolicy: 1789. policy.  Patch by\nKarthikeyan Singaravelan.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36216\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=35121\n\nFile: python3.12.info,  Node: Core and Builtins<44>,  Next: Library<44>,  Prev: Security<30>,  Up: Python 3 8 0 alpha 3\n\n1.22.44.2 Core and Builtins\n...........................\n\n- bpo-36421(1): Fix a possible double decref in ctypes.c's\n'PyCArrayTypenew()'.\n\n- bpo-36412(2): Fix a possible crash when creating a new dictionary.\n\n- bpo-36398(3): Fix a possible crash in 'structseqrepr()'.\n\n- bpo-36256(4): Fix bug in parsermodule when parsing a state in a DFA\nthat has two or more arcs with labels of the same type.  Patch by\nPablo Galindo.\n\n- bpo-36365(5): repr(structseq) is no longer limited to 512 bytes.\n\n- bpo-36374(6): Fix a possible null pointer dereference in\n'mergeconstsrecursive()'.  Patch by Zackery Spytz.\n\n- bpo-36236(7): At Python initialization, the current directory is no\nlonger prepended to *note sys.path: 32c. if it has been removed.\n\n- bpo-36352(8): Python initialization now fails with an error, rather\nthan silently truncating paths, if a path is too long.\n\n- bpo-36301(9): Python initialization now fails if decoding\n'pybuilddir.txt' configuration file fails at startup.\n\n- bpo-36333(10): Fix leak in PyRuntimeStateFini.  Contributed by\nSte'phane Wirtel.\n\n- bpo-36332(11): The builtin *note compile(): 528. can now handle AST\nobjects that contain assignment expressions.  Patch by Pablo\nGalindo.\n\n- bpo-36282(12): Improved error message for too much positional\narguments in some builtin functions.\n\n- bpo-30040(13): New empty dict uses fewer memory for now.  It used\nmore memory than empty dict created by 'dict.clear()'.  And empty\ndict creation and deletion is about 2x faster.  Patch by Inada\nNaoki.\n\n- bpo-36262(14): Fix an unlikely memory leak on conversion from\nstring to float in the function 'Pydgstrtod()' used by\n'float(str)', 'complex(str)', *note pickle.load(): b62, *note\nmarshal.load(): 178b, etc.\n\n- bpo-36252(15): Update Unicode databases to version 12.0.0.\n\n- bpo-36218(16): Fix a segfault occurring when sorting a list of\nheterogeneous values.  Patch contributed by Re'mi Lapeyre and Elliot\nGorokhovsky.\n\n- bpo-36188(17): Cleaned up left-over vestiges of Python 2 unbound\nmethod handling in method objects and documentation.  Patch by\nMartijn Pieters\n\n- bpo-36124(18): Add a new interpreter-specific dict and expose it in\nthe C-API via PyInterpreterStateGetDict().  This parallels\nPyThreadStateGetDict().  However, extension modules should\ncontinue using PyModuleGetState() for their own internal\nper-interpreter state.\n\n- bpo-35975(19): Add a 'featureversion' flag to 'ast.parse()'\n(documented) and 'compile()' (hidden) that allows tweaking the\nparser to support older versions of the grammar.  In particular, if\n'featureversion' is 5 or 6, the hacks for the 'async' and 'await'\nkeyword from PEP 492 are reinstated.  (For 7 or higher, these are\nunconditionally treated as keywords, but they are still special\ntokens rather than 'NAME' tokens that the parser driver\nrecognizes.)\n\n- bpo-31904(20): Use UTF-8 as the system encoding on VxWorks.\n\n- bpo-36048(21): The *note index(): 4f1. special method will be\nused instead of *note int(): 4f0. for implicit conversion of\nPython numbers to C integers.  Using the 'int()' method in\nimplicit conversions has been deprecated.\n\n- bpo-35808(22): Retire pgen and use a modified version of pgen2 to\ngenerate the parser.  Patch by Pablo Galindo.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36421\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=36412\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=36398\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=36256\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=36365\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=36374\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=36236\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=36352\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=36301\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=36333\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=36332\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=36282\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=30040\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=36262\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=36252\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=36218\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=36188\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=36124\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=35975\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=36048\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=35808\n\nFile: python3.12.info,  Node: Library<44>,  Next: Documentation<44>,  Prev: Core and Builtins<44>,  Up: Python 3 8 0 alpha 3\n\n1.22.44.3 Library\n.................\n\n- bpo-36401(1): The class documentation created by pydoc now has a\nseparate section for readonly properties.\n\n- bpo-36320(2): The typing.NamedTuple() class has deprecated the\nfieldtypes attribute in favor of the annotations attribute\nwhich carried the same information.  Also, both attributes were\nconverted from OrderedDict to a regular dict.\n\n- bpo-34745(3): Fix *note asyncio: 9. ssl memory issues caused by\ncircular references\n\n- bpo-36324(4): Add method to statistics.NormalDist for computing the\ninverse cumulative normal distribution.\n\n- bpo-36321(5): collections.namedtuple() misspelled the name of an\nattribute.  To be consistent with typing.NamedTuple, the attribute\nname should have been \"fielddefaults\" instead of\n\"fieldsdefaults\".  For backwards compatibility, both spellings\nare now created.  The misspelled version may be removed in the\nfuture.\n\n- bpo-36297(6): \"unicodeinternal\" codec is removed.  It was\ndeprecated since Python 3.3.  Patch by Inada Naoki.\n\n- bpo-36298(7): Raise ModuleNotFoundError in pyclbr when a module\ncan't be found.  Thanks to 'mental' for the bug report.\n\n- bpo-36268(8): Switch the default format used for writing tars with\n*note tarfile: d8. to the modern POSIX.1-2001 pax standard, from\nthe vendor-specific GNU. Contributed by C.A.M. Gerlach.\n\n- bpo-36285(9): Fix integer overflows in the array module.  Patch by\nStephan Hohe.\n\n- bpo-31904(10): Add signal module support for VxWorks.\n\n- bpo-36272(11): *note logging: 82. does not silently ignore\nRecursionError anymore.  Patch contributed by Re'mi Lapeyre.\n\n- bpo-36280(12): Add a kind field to ast.Constant.  It is 'u' if the\nliteral has a 'u' prefix (i.e.  a Python 2 style unicode literal),\nelse None.\n\n- bpo-35931(13): The *note pdb: a0. 'debug' command now gracefully\nhandles all exceptions.\n\n- bpo-36251(14): Fix format strings used for stderrprinter and\nre.Match reprs.  Patch by Stephan Hohe.\n\n- bpo-36235(15): Fix 'CFLAGS' in 'customizecompiler()' of\n'distutils.sysconfig': when the 'CFLAGS' environment variable is\ndefined, don't override 'CFLAGS' variable with the 'OPT' variable\nanymore.  Initial patch written by David Malcolm.\n\n- bpo-35807(16): Update ensurepip to install pip 19.0.3 and\nsetuptools 40.8.0.\n\n- bpo-36139(17): Release GIL when closing *note mmap: 830. objects.\n\n- bpo-36179(18): Fix two unlikely reference leaks in hashopenssl.\nThe leaks only occur in out-of-memory cases.\n\n- bpo-36169(19): Add overlap() method to statistics.NormalDist.\nComputes the overlapping coefficient for two normal distributions.\n\n- bpo-36103(20): Default buffer size used by 'shutil.copyfileobj()'\nis changed from 16 KiB to 64 KiB on non-Windows platform to reduce\nsystem call overhead.  Contributed by Inada Naoki.\n\n- bpo-36130(21): Fix 'pdb' with 'skip=...' when stepping into a frame\nwithout a 'name' global.  Patch by Anthony Sottile.\n\n- bpo-35652(22): shutil.copytree(copyfunction=...) erroneously pass\nDirEntry instead of a path string.\n\n- bpo-35178(23): Ensure custom *note warnings.formatwarning(): 178d.\nfunction can receive 'line' as positional argument.  Based on patch\nby Tashrif Billah.\n\n- bpo-36106(24): Resolve potential name clash with libm's sinpi().\nPatch by Dmitrii Pasechnik.\n\n- bpo-36091(25): Clean up reference to async generator in Lib/types.\nPatch by Henry Chen.\n\n- bpo-36043(26): 'FileCookieJar' supports *note path-like object:\n957.  Contributed by Ste'phane Wirtel\n\n- bpo-35899(27): Enum has been fixed to correctly handle empty\nstrings and strings with non-Latin characters (ie.  '??', '??')\nwithout crashing.  Original patch contributed by Maxwell.  Assisted\nby Ste'phane Wirtel.\n\n- bpo-21269(28): Add 'args' and 'kwargs' properties to mock call\nobjects.  Contributed by Kumar Akshay.\n\n- bpo-30670(29): 'pprint.pp' has been added to pretty-print objects\nwith dictionary keys being sorted with their insertion order by\ndefault.  Parameter 'sortdicts' has been added to 'pprint.pprint',\n'pprint.pformat' and 'pprint.PrettyPrinter'.  Contributed by Re'mi\nLapeyre.\n\n- bpo-35843(30): Implement 'getitem' for 'NamespacePath'.  Patch\nby Anthony Sottile.\n\n- bpo-35802(31): Clean up code which checked presence of 'os.stat' /\n'os.lstat' / 'os.chmod' which are always present.  Patch by Anthony\nSottile.\n\n- bpo-35715(32): Librates the return value of a ProcessPoolExecutor\nprocessworker after it's no longer needed to free memory\n\n- bpo-35493(33): Use *note multiprocessing.connection.wait(): f4f.\ninstead of polling each 0.2 seconds for worker updates in\n'multiprocessing.Pool'.  Patch by Pablo Galindo.\n\n- bpo-35661(34): Store the venv prompt in pyvenv.cfg.\n\n- bpo-35121(35): Don't set cookie for a request when the request path\nis a prefix match of the cookie's path attribute but doesn't end\nwith \"/\".  Patch by Karthikeyan Singaravelan.\n\n- bpo-21478(36): Calls to a child function created with *note\nunittest.mock.createautospec(): 13b3. should propagate to the\nparent.  Patch by Karthikeyan Singaravelan.\n\n- bpo-35198(37): Fix C++ extension compilation on AIX\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36401\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=36320\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=34745\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=36324\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=36321\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=36297\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=36298\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=36268\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=36285\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=36272\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=36280\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=35931\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=36251\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=36235\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=35807\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=36139\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=36179\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=36169\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=36103\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=36130\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=35652\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=35178\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=36106\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=36091\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=36043\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=35899\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=21269\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=30670\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=35843\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=35802\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=35715\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=35493\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=35661\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=35121\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=21478\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=35198\n\nFile: python3.12.info,  Node: Documentation<44>,  Next: Tests<41>,  Prev: Library<44>,  Up: Python 3 8 0 alpha 3\n\n1.22.44.4 Documentation\n.......................\n\n- bpo-36329(1): Declare the path of the Python binary for the usage\nof 'Tools/scripts/serve.py' when executing 'make -C Doc/ serve'.\nContributed by Ste'phane Wirtel\n\n- bpo-36138(2): Improve documentation about converting\ndatetime.timedelta to scalars.\n\n- bpo-21314(3): A new entry was added to the Core Language Section of\nthe Programming FAQ, which explaines the usage of slash(/) in the\nsignature of a function.  Patch by Lysandros Nikolaou\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36329\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=36138\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=21314\n\nFile: python3.12.info,  Node: Tests<41>,  Next: Build<42>,  Prev: Documentation<44>,  Up: Python 3 8 0 alpha 3\n\n1.22.44.5 Tests\n...............\n\n- bpo-36234(1): testposix.PosixUidGidTests: add tests for invalid\nuid/gid type (str).  Initial patch written by David Malcolm.\n\n- bpo-29571(2): Fix 'testre.testlocaleflag()': use\n'locale.getpreferredencoding()' rather than 'locale.getlocale()' to\nget the locale encoding.  With some locales, 'locale.getlocale()'\nreturns the wrong encoding.\n\n- bpo-36123(3): Fix race condition in testsocket.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36234\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=29571\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=36123\n\nFile: python3.12.info,  Node: Build<42>,  Next: Windows<40>,  Prev: Tests<41>,  Up: Python 3 8 0 alpha 3\n\n1.22.44.6 Build\n...............\n\n- bpo-36356(1): Fix leaks that led to build failure when configured\nwith address sanitizer.\n\n- bpo-36146(2): Add 'TESTEXTENSIONS' constant to 'setup.py' to allow\nto not build test extensions like 'testcapi'.\n\n- bpo-36146(3): Fix setup.py on macOS: only add '/usr/include/ffi' to\ninclude directories of ctypes, not for all extensions.\n\n- bpo-31904(4): Enable build system to cross-build for VxWorks RTOS.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36356\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=36146\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=36146\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=31904\n\nFile: python3.12.info,  Node: Windows<40>,  Next: IDLE<28>,  Prev: Build<42>,  Up: Python 3 8 0 alpha 3\n\n1.22.44.7 Windows\n.................\n\n- bpo-36312(1): Fixed decoders for the following code pages: 50220,\n50221, 50222, 50225, 50227, 50229, 57002 through 57011, 65000 and\n42.\n\n- bpo-36264(2): Don't honor POSIX 'HOME' in 'os.path.expanduser' on\nwindows.  Patch by Anthony Sottile.\n\n- bpo-24643(3): Fix name collisions due to '#define timezone\ntimezone' in PC/pyconfig.h.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36312\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=36264\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=24643\n\nFile: python3.12.info,  Node: IDLE<28>,  Next: Tools/Demos<23>,  Prev: Windows<40>,  Up: Python 3 8 0 alpha 3\n\n1.22.44.8 IDLE\n..............\n\n- bpo-36405(1): Use dict unpacking in idlelib.\n\n- bpo-36396(2): Remove fgBg param of idlelib.config.GetHighlight().\nThis param was only used twice and changed the return type.\n\n- bpo-36176(3): Fix IDLE autocomplete & calltip popup colors.\nPrevent conflicts with Linux dark themes (and slightly darken\ncalltip background).\n\n- bpo-23205(4): For the grep module, add tests for findfiles,\nrefactor findfiles to be a module-level function, and refactor\nfindfiles to use os.walk.\n\n- bpo-23216(5): Add docstrings to IDLE search modules.\n\n- bpo-36152(6): Remove colorizer.ColorDelegator.closewhendone and\nthe corresponding argument of .close().  In IDLE, both have always\nbeen None or False since 2007.\n\n- bpo-32129(7): Avoid blurry IDLE application icon on macOS with Tk\n8.6.  Patch by Kevin Walzer.\n\n- bpo-36096(8): Refactor class variables to instance variables in\ncolorizer.\n\n- bpo-30348(9): Increase test coverage of idlelib.autocomplete by\n30%.  Patch by Louie Lu\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36405\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=36396\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=36176\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=23205\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=23216\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=36152\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=32129\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=36096\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=30348\n\nFile: python3.12.info,  Node: Tools/Demos<23>,  Next: C API<40>,  Prev: IDLE<28>,  Up: Python 3 8 0 alpha 3\n\n1.22.44.9 Tools/Demos\n.....................\n\n- bpo-35132(1): Fix py-list and py-bt commands of python-gdb.py on\ngdb7.\n\n- bpo-32217(2): Fix freeze script on Windows.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=35132\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32217\n\nFile: python3.12.info,  Node: C API<40>,  Prev: Tools/Demos<23>,  Up: Python 3 8 0 alpha 3\n\n1.22.44.10 C API\n................\n\n- bpo-36381(1): Raise 'DeprecationWarning' when '#' formats are used\nfor building or parsing values without 'PYSSIZETCLEAN'.\n\n- bpo-36142(2): The whole coreconfig.h header is now excluded from\nPyLIMITEDAPI. Move functions definitions into a new internal\npycorecoreconfig.h header.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36381\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=36142\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 8 0 alpha 2,  Next: Python 3 8 0 alpha 1,  Prev: Python 3 8 0 alpha 3,  Up: Changelog": {
            "content": "'Release date: 2019-02-25'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<45>.\n* Library: Library<45>.\n* Documentation: Documentation<45>.\n* Tests: Tests<42>.\n* Windows: Windows<41>.\n* IDLE: IDLE<29>.\n\nFile: python3.12.info,  Node: Core and Builtins<45>,  Next: Library<45>,  Up: Python 3 8 0 alpha 2\n\n1.22.45.1 Core and Builtins\n...........................\n\n- bpo-36052(1): Raise a *note SyntaxError: 146. when assigning a\nvalue to 'debug' with the Assignment Operator.  Contributed by\nSte'phane Wirtel and Pablo Galindo.\n\n- bpo-36012(2): Doubled the speed of class variable writes.  When a\nnon-dunder attribute was updated, there was an unnecessary call to\nupdate slots.\n\n- bpo-35942(3): The error message emitted when returning invalid\ntypes from 'fspath' in interfaces that allow passing *note\nPathLike: a9a. objects has been improved and now it does explain\nthe origin of the error.\n\n- bpo-36016(4): 'gc.getobjects' can now receive an optional\nparameter indicating a generation to get objects from.  Patch by\nPablo Galindo.\n\n- bpo-1054041(5): When the main interpreter exits due to an uncaught\nKeyboardInterrupt, the process now exits in the appropriate manner\nfor its parent process to detect that a SIGINT or ^C terminated the\nprocess.  This allows shells and batch scripts to understand that\nthe user has asked them to stop.\n\n- bpo-35992(6): Fix 'classgetitem()' not being called on a class\nwith a custom non-subscriptable metaclass.\n\n- bpo-35993(7): Fix a crash on fork when using subinterpreters.\nContributed by Ste'phane Wirtel\n\n- bpo-35991(8): Fix a potential double free in\nModules/randommodule.c.\n\n- bpo-35961(9): Fix a crash in slicerichcompare(): use strong\nreferences rather than stolen references for the two temporary\ninternal tuples.\n\n- bpo-35911(10): Enable the creation of cell objects by adding a\n'cell.new' method, and expose the type 'cell' in 'Lib/types.py'\nunder the name CellType.  Patch by Pierre Glaser.\n\n- bpo-12822(11): Use monotonic clock for 'pthreadcondtimedwait'\nwhen 'pthreadcondattrsetclock' and 'CLOCKMONOTONIC' are\navailable.\n\n- bpo-15248(12): The compiler emits now syntax warnings in the case\nwhen a comma is likely missed before tuple or list.\n\n- bpo-35886(13): The implementation of PyInterpreterState has been\nmoved into the internal header files (guarded by PyBUILDCORE).\n\n- bpo-31506(14): Clarify the errors reported when 'object.new'\nand 'object.init' receive more than one argument.  Contributed\nby Sanyam Khurana.\n\n- bpo-35724(15): Signal-handling is now guaranteed to happen relative\nto the main interpreter.\n\n- bpo-33608(16): We added a new internal PyAddPendingCall() that\noperates relative to the provided interpreter.  This allows us to\nuse the existing implementation to ask another interpreter to do\nwork that cannot be done in the current interpreter, like decref an\nobject the other interpreter owns.  The existing\nPyAddPendingCall() only operates relative to the main interpreter.\n\n- bpo-33989(17): Fix a possible crash in *note list.sort(): a13. when\nsorting objects with 'obtype->tprichcompare == NULL'.  Patch by\nZackery Spytz.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36052\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=36012\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=35942\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=36016\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=1054041\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=35992\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=35993\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=35991\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=35961\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=35911\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=12822\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=15248\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=35886\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=31506\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=35724\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=33608\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=33989\n\nFile: python3.12.info,  Node: Library<45>,  Next: Documentation<45>,  Prev: Core and Builtins<45>,  Up: Python 3 8 0 alpha 2\n\n1.22.45.2 Library\n.................\n\n- bpo-35512(1): *note unittest.mock.patch.dict(): 176a. used as a\ndecorator with string target resolves the target during function\ncall instead of during decorator construction.  Patch by\nKarthikeyan Singaravelan.\n\n- bpo-36018(2): Add statistics.NormalDist, a tool for creating and\nmanipulating normal distributions of random variable.  Features a\ncomposite class that treats the mean and standard deviation of\nmeasurement data as single entity.\n\n- bpo-35904(3): Added statistics.fmean() as a faster, floating point\nvariant of the existing mean() function.\n\n- bpo-35918(4): Removed broken 'haskey' method from\nmultiprocessing.managers.SyncManager.dict.  Contributed by Re'mi\nLapeyre.\n\n- bpo-18283(5): Add support for bytes to *note shutil.which(): 1d6.\n\n- bpo-35960(6): Fix *note dataclasses.field(): 1798. throwing away\nempty mapping objects passed as metadata.\n\n- bpo-35500(7): Write expected and actual call parameters on separate\nlines in *note unittest.mock.Mock.assertcalledwith(): 1799.\nassertion errors.  Contributed by Susan Su.\n\n- bpo-35931(8): The *note pdb: a0. 'debug' command now gracefully\nhandles syntax errors.\n\n- bpo-24209(9): In http.server script, rely on getaddrinfo to bind to\npreferred address based on the bind parameter.  Now default bind or\nbinding to a name may bind to IPv6 or dual-stack, depending on the\nenvironment.\n\n- bpo-35321(10): Set 'spec.origin' of 'frozenimportlib' to\nfrozen so that it matches the behavior of\n'frozenimportlibexternal'.  Patch by Nina Zakharenko.\n\n- bpo-35378(11): Fix a reference issue inside 'multiprocessing.Pool'\nthat caused the pool to remain alive if it was deleted without\nbeing closed or terminated explicitly.  A new strong reference is\nadded to the pool iterators to link the lifetime of the pool to the\nlifetime of its iterators so the pool does not get destroyed if a\npool iterator is still alive.\n\n- bpo-34294(12): re module, fix wrong capturing groups in rare cases.\n*note re.search(): 10a2, *note re.findall(): ea1, *note re.sub():\n1ff. and other functions that scan through string looking for a\nmatch, should reset capturing groups between two match attempts.\nPatch by Ma Lin.\n\n- bpo-35615(13): *note weakref: 10f.: Fix a RuntimeError when copying\na WeakKeyDictionary or a WeakValueDictionary, due to some keys or\nvalues disappearing while iterating.\n\n- bpo-35606(14): Implement *note math.prod(): 82c. as analogous\nfunction to *note sum(): 181. that returns the product of a 'start'\nvalue (default: 1) times an iterable of numbers.  Patch by Pablo\nGalindo.\n\n- bpo-32417(15): Performing arithmetic between *note\ndatetime.datetime: 222. subclasses and *note datetime.timedelta:\n7f3. now returns an object of the same type as the *note\ndatetime.datetime: 222. subclass.  As a result, *note\ndatetime.datetime.astimezone(): 7f4. and alternate constructors\nlike *note datetime.datetime.now(): 225. and\n'datetime.fromtimestamp()' called with a 'tz' argument now 'also'\nretain their subclass.\n\n- bpo-35153(16): Add 'headers' optional keyword-only parameter to\n*note xmlrpc.client.ServerProxy: 883, 'xmlrpc.client.Transport' and\n'xmlrpc.client.SafeTransport'.  Patch by Ce'dric Krier.\n\n- bpo-34572(17): Fix C implementation of pickle.loads to use\nimportlib's locking mechanisms, and thereby avoid using partially\nloaded modules.  Patch by Tim Burgess.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=35512\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=36018\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=35904\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=35918\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=18283\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=35960\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=35500\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=35931\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=24209\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=35321\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=35378\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=34294\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=35615\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=35606\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=32417\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=35153\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=34572\n\nFile: python3.12.info,  Node: Documentation<45>,  Next: Tests<42>,  Prev: Library<45>,  Up: Python 3 8 0 alpha 2\n\n1.22.45.3 Documentation\n.......................\n\n- bpo-36083(1): Fix formatting of -check-hash-based-pycs options in\nthe manpage Synopsis.\n\n- bpo-36007(2): Bump minimum sphinx version to 1.8.  Patch by Anthony\nSottile.\n\n- bpo-22062(3): Update documentation and docstrings for pathlib.\nOriginal patch by Mike Short.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=36083\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=36007\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=22062\n\nFile: python3.12.info,  Node: Tests<42>,  Next: Windows<41>,  Prev: Documentation<45>,  Up: Python 3 8 0 alpha 2\n\n1.22.45.4 Tests\n...............\n\n- bpo-27313(1): Avoid testttkguionly ComboboxTest failure with\nmacOS Cocoa Tk.\n\n- bpo-36019(2): Add test.support.TESTHTTPURL and replace references\nof 'http://www.example.com' by this new constant.  Contributed by\nSte'phane Wirtel.\n\n- bpo-36037(3): Fix testssl for strict OpenSSL configuration like\nRHEL8 strict crypto policy.  Use older TLS version for minimum TLS\nversion of the server SSL context if needed, to test TLS version\nolder than default minimum TLS version.\n\n- bpo-35798(4): Added 'test.support.checksyntaxwarning()'.\n\n- bpo-35505(5): Make testimap4hostdefaultvalue independent on\nwhether the local IMAP server is running.\n\n- bpo-35917(6): multiprocessing: provide unit tests for SyncManager\nand SharedMemoryManager classes + all the shareable types which are\nsupposed to be supported by them.  (patch by Giampaolo Rodola)\n\n- bpo-35704(7): Skip 'testshutil.testunpackarchivexztar' to\nprevent a MemoryError on 32-bit AIX when MAXDATA setting is less\nthan 0x20000000.\n\nPatch by Michael Felt (aixtools)\n\n- bpo-34720(8): Assert mstate != NULL to mimic GC traversal\nfunctions that do not correctly handle module creation when the\nmodule state has not been created.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27313\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=36019\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=36037\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=35798\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=35505\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=35917\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=35704\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=34720\n\nFile: python3.12.info,  Node: Windows<41>,  Next: IDLE<29>,  Prev: Tests<42>,  Up: Python 3 8 0 alpha 2\n\n1.22.45.5 Windows\n.................\n\n- bpo-35976(1): Added ARM build support to Windows build files in\nPCBuild.\n\n- bpo-35692(2): 'pathlib' no longer raises when checking file and\ndirectory existence on drives that are not ready\n\n- bpo-35872(3): Uses the base Python executable when invoking venv in\na virtual environment\n\n- bpo-35873(4): Prevents venv paths being inherited by child\nprocesses\n\n- bpo-35299(5): Fix sysconfig detection of the source directory and\ndistutils handling of pyconfig.h during PGO profiling\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=35976\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=35692\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=35872\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=35873\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=35299\n\nFile: python3.12.info,  Node: IDLE<29>,  Prev: Windows<41>,  Up: Python 3 8 0 alpha 2\n\n1.22.45.6 IDLE\n..............\n\n- bpo-24310(1): IDLE - Document settings dialog font tab sample.\n\n- bpo-35833(2): Revise IDLE doc for control codes sent to Shell.  Add\na code example block.\n\n- bpo-35689(3): Add docstrings and unittests for colorizer.py.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24310\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=35833\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=35689\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 8 0 alpha 1,  Next: Python 3 7 0 final,  Prev: Python 3 8 0 alpha 2,  Up: Changelog": {
            "content": "'Release date: 2019-02-03'\n\n* Menu:\n\n* Security: Security<31>.\n* Core and Builtins: Core and Builtins<46>.\n* Library: Library<46>.\n* Documentation: Documentation<46>.\n* Tests: Tests<43>.\n* Build: Build<43>.\n* Windows: Windows<42>.\n* macOS: macOS<34>.\n* IDLE: IDLE<30>.\n* Tools/Demos: Tools/Demos<24>.\n* C API: C API<41>.\n\nFile: python3.12.info,  Node: Security<31>,  Next: Core and Builtins<46>,  Up: Python 3 8 0 alpha 1\n\n1.22.46.1 Security\n..................\n\n- bpo-35746(1): [CVE-2019-5010] Fix a NULL pointer deref in ssl\nmodule.  The cert parser did not handle CRL distribution points\nwith empty DP or URI correctly.  A malicious or buggy certificate\ncan result into segfault.  Vulnerability (TALOS-2018-0758) reported\nby Colin Read and Nicolas Edet of Cisco.\n\n- bpo-34812(2): The *note -I: 77f. command line option (run Python in\nisolated mode) is now also copied by the *note multiprocessing: 8f.\nand 'distutils' modules when spawning child processes.  Previously,\nonly *note -E: 77e. and *note -s: 1200. options (enabled by *note\n-I: 77f.) were copied.\n\n- bpo-34791(3): The xml.sax and xml.dom.domreg no longer use\nenvironment variables to override parser implementations when\nsys.flags.ignoreenvironment is set by -E or -I arguments.\n\n- bpo-17239(4): The xml.sax and xml.dom.minidom parsers no longer\nprocesses external entities by default.  External DTD and ENTITY\ndeclarations no longer load files or create network connections.\n\n- bpo-34623(5): CVE-2018-14647: The C accelerated elementtree module\nnow initializes hash randomization salt from PyHashSecret instead\nof libexpat's default CSPRNG.\n\n- bpo-34405(6): Updated to OpenSSL 1.1.0i for Windows builds.\n\n- bpo-33871(7): Fixed sending the part of the file in *note\nos.sendfile(): 946. on macOS. Using the 'trailers' argument could\ncause sending more bytes from the input file than was specified.\n\n- bpo-32533(8): Fixed thread-safety of error handling in ssl.\n\n- bpo-33136(9): Harden ssl module against LibreSSL CVE-2018-8970.\nX509VERIFYPARAMset1host() is called with an explicit namelen.\nA new test ensures that NULL bytes are not allowed.\n\n- bpo-33001(10): Minimal fix to prevent buffer overrun in os.symlink\non Windows\n\n- bpo-32981(11): Regexes in difflib and poplib were vulnerable to\ncatastrophic backtracking.  These regexes formed potential DOS\nvectors (REDOS). They have been refactored.  This resolves\nCVE-2018-1060 and CVE-2018-1061.  Patch by Jamie Davis.\n\n- bpo-28414(12): The ssl module now allows users to perform their own\nIDN en/decoding when using SNI.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=35746\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=34812\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=34791\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=17239\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=34623\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=34405\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=33871\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=32533\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=33136\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=33001\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=32981\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=28414\n\nFile: python3.12.info,  Node: Core and Builtins<46>,  Next: Library<46>,  Prev: Security<31>,  Up: Python 3 8 0 alpha 1\n\n1.22.46.2 Core and Builtins\n...........................\n\n- bpo-35877(1): Make parenthesis optional for named expressions in\nwhile statement.  Patch by Karthikeyan Singaravelan.\n\n- bpo-35814(2): Allow same right hand side expressions in annotated\nassignments as in normal ones.  In particular, 'x: Tuple[int, int]\n= 1, 2' (without parentheses on the right) is now allowed.\n\n- bpo-35766(3): Add the option to parse PEP 484 type comments in the\nast module.  (Off by default.)  This is merging the key\nfunctionality of the third party fork thereof,\n[typedast]('https://github.com/python/typedast').\n\n- bpo-35713(4): Reorganize Python initialization to get working\nexceptions and sys.stderr earlier.\n\n- bpo-33416(5): Add end line and end column position information to\nthe Python AST nodes.  This is a C-level backwards incompatible\nchange.\n\n- bpo-35720(6): Fixed a minor memory leak in\npymainparsecmdlineimpl function in Modules/main.c\n\n- bpo-35634(7): 'func(kwargs)' will now raise an error when\n'kwargs' is a mapping containing multiple entries with the same\nkey.  An error was already raised when other keyword arguments are\npassed before 'kwargs' since Python 3.6.\n\n- bpo-35623(8): Fix a crash when sorting very long lists.  Patch by\nStephan Hohe.\n\n- bpo-35214(9): clang Memory Sanitizer build instrumentation was\nadded to work around false positives from posix, socket, time,\ntestio, and testfaulthandler.\n\n- bpo-35560(10): Fix an assertion error in *note format(): 3eb. in\ndebug build for floating point formatting with \"n\" format, zero\npadding and small width.  Release build is not impacted.  Patch by\nKarthikeyan Singaravelan.\n\n- bpo-35552(11): Format characters '%s' and '%V' in *note\nPyUnicodeFromFormat(): 2d5. and '%s' in *note\nPyBytesFromFormat(): 17a1. no longer read memory past the limit if\n'precision' is specified.\n\n- bpo-35504(12): Fix segfaults and *note SystemError: 2d7.s when\ndeleting certain attributes.  Patch by Zackery Spytz.\n\n- bpo-35504(13): Fixed a SystemError when delete the\ncharacterswritten attribute of an OSError.\n\n- bpo-35494(14): Improved syntax error messages for unbalanced\nparentheses in f-string.\n\n- bpo-35444(15): Fixed error handling in pickling methods when fail\nto look up builtin \"getattr\".  Sped up pickling iterators.\n\n- bpo-35436(16): Fix various issues with memory allocation error\nhandling.  Patch by Zackery Spytz.\n\n- bpo-35423(17): Separate the signal handling trigger in the eval\nloop from the \"pending calls\" machinery.  There is no semantic\nchange and the difference in performance is insignificant.\n\n- bpo-35357(18): Internal attributes' names of unittest.mock.Call\nand unittest.mock.MagicProxy (name, parent & fromkall) are now\nprefixed with mock in order to prevent clashes with widely used\nobject attributes.  Fixed minor typo in test function name.\n\n- bpo-35372(19): Fixed the code page decoder for input longer than 2\nGiB containing undecodable bytes.\n\n- bpo-35336(20): Fix PYTHONCOERCECLOCALE=1 environment variable: only\ncoerce the C locale if the LCCTYPE locale is \"C\".\n\n- bpo-31241(21): The 'lineno' and 'coloffset' attributes of AST\nnodes for list comprehensions, generator expressions and tuples are\nnow point to the opening parenthesis or square brace.  For tuples\nwithout parenthesis they point to the position of the first item.\n\n- bpo-33954(22): For *note str.format(): 3ed, 'float.format()'\nand 'complex.format()' methods for non-ASCII decimal point when\nusing the \"n\" formatter.\n\n- bpo-35269(23): Fix a possible segfault involving a newly created\ncoroutine.  Patch by Zackery Spytz.\n\n- bpo-35224(24): Implement PEP 572(25) (assignment expressions).\nPatch by Emily Morehouse.\n\n- bpo-32492(26): Speed up 'namedtuple()' attribute access by 1.6x\nusing a C fast-path for the name descriptors.  Patch by Pablo\nGalindo.\n\n- bpo-35214(27): Fixed an out of bounds memory access when parsing a\ntruncated unicode escape sequence at the end of a string such as\n''\\N''.  It would read one byte beyond the end of the memory\nallocation.\n\n- bpo-35214(28): The interpreter and extension modules have had\nannotations added so that they work properly under clang's Memory\nSanitizer.  A new configure flag -with-memory-sanitizer has been\nadded to make test builds of this nature easier to perform.\n\n- bpo-35193(29): Fix an off by one error in the bytecode peephole\noptimizer where it could read bytes beyond the end of bounds of an\narray when removing unreachable code.  This bug was present in\nevery release of Python 3.6 and 3.7 until now.\n\n- bpo-35169(30): Improved error messages for forbidden assignments.\n\n- bpo-34022(31): Fix handling of hash-based bytecode files in *note\nzipimport: 12c.  Patch by Elvis Pranskevichus.\n\n- bpo-28401(32): Debug builds will no longer to attempt to import\nextension modules built for the ABI as they were never compatible\nto begin with.  Patch by Stefano Rivera.\n\n- bpo-29341(33): Clarify in the docstrings of *note os: 9c. methods\nthat path-like objects are also accepted as input parameters.\n\n- bpo-35050(34): *note socket: c6.: Fix off-by-one bug in length\ncheck for 'AFALG' name and type.\n\n- bpo-29743(35): Raise *note ValueError: 183. instead of *note\nOverflowError: 68d. in case of a negative 'length' in a *note\nctypes.Array: 17a2. subclass.  Also raise *note TypeError: 28e.\ninstead of *note AttributeError: 395. for non-integer 'length'.\nOriginal patch by Oren Milman.\n\n- bpo-16806(36): Fix 'lineno' and 'coloffset' for multi-line string\ntokens.\n\n- bpo-35029(37): *note SyntaxWarning: 178. raised as an exception at\ncode generation time will be now replaced with a *note SyntaxError:\n146. for better error reporting.\n\n- bpo-34983(38): Expose *note symtable.Symbol.isnonlocal(): 17a3. in\nthe symtable module.  Patch by Pablo Galindo.\n\n- bpo-34974(39): *note bytes: 295. and *note bytearray: 294.\nconstructors no longer convert unexpected exceptions (e.g.  *note\nMemoryError: 13e3. and *note KeyboardInterrupt: 7f5.) to *note\nTypeError: 28e.\n\n- bpo-34939(40): Allow annotated names in module namespace that are\ndeclared global before the annotation happens.  Patch by Pablo\nGalindo.\n\n- bpo-34973(41): Fixed crash in *note bytes(): 295. when the *note\nlist: 3dc. argument is mutated while it is iterated.\n\n- bpo-34876(42): The 'lineno' and 'coloffset' attributes of the AST\nfor decorated function and class refer now to the position of the\ncorresponding 'def', 'async def' and 'class' instead of the\nposition of the first decorator.  This leads to more correct line\nreporting in tracing.  This is the only case when the position of\nchild AST nodes can precede the position of the parent AST node.\n\n- bpo-34879(43): Fix a possible null pointer dereference in\nbytesobject.c.  Patch by Zackery Spytz.\n\n- bpo-34784(44): Fix the implementation of PyStructSequenceNewType\nin order to create heap allocated StructSequences.\n\n- bpo-32912(45): A *note SyntaxWarning: 178. is now emitted instead\nof a *note DeprecationWarning: 179. for invalid escape sequences in\nstring and bytes literals.\n\n- bpo-34854(46): Fixed a crash in compiling string annotations\ncontaining a lambda with a keyword-only argument that doesn't have\na default value.\n\n- bpo-34850(47): The compiler now produces a *note SyntaxWarning:\n178. when identity checks ('is' and 'is not') are used with certain\ntypes of literals (e.g.  strings, ints).  These can often work by\naccident in CPython, but are not guaranteed by the language spec.\nThe warning advises users to use equality tests ('==' and '!=')\ninstead.\n\n- bpo-34824(48): Fix a possible null pointer dereference in\nModules/ssl.c.  Patch by Zackery Spytz.\n\n- bpo-30156(49): The C function 'propertydescrget()' uses a\n\"cached\" tuple to optimize function calls.  But this tuple can be\ndiscovered in debug mode with 'sys.getobjects()'.  Remove the\noptimization, it's not really worth it and it causes 3 different\ncrashes last years.\n\n- bpo-34762(50): Fix contextvars C API to use PyObject* pointer\ntypes.\n\n- bpo-34751(51): The hash function for tuples is now based on xxHash\nwhich gives better collision results on (formerly) pathological\ncases.  Additionally, on 64-bit systems it improves tuple hashes in\ngeneral.  Patch by Jeroen Demeyer with substantial contributions by\nTim Peters.\n\n- bpo-34735(52): Fix a memory leak in Modules/timemodule.c.  Patch by\nZackery Spytz.\n\n- bpo-34683(53): Fixed a bug where some SyntaxError error pointed to\nlocations that were off-by-one.\n\n- bpo-34651(54): Only allow the main interpreter to fork.  The avoids\nthe possibility of affecting the main interpreter, which is\ncritical to operation of the runtime.\n\n- bpo-34653(55): Remove unused function\nPyParserSimpleParseStringFilename.\n\n- bpo-32236(56): Warn that line buffering is not supported if *note\nopen(): 26e. is called with binary mode and 'buffering=1'.\n\n- bpo-34641(57): Further restrict the syntax of the left-hand side of\nkeyword arguments in function calls.  In particular,\n'f((keyword)=arg)' is now disallowed.\n\n- bpo-34637(58): Make the 'start' argument to 'sum()' visible as a\nkeyword argument.\n\n- bpo-1621(59): Do not assume signed integer overflow behavior (C\nundefined behavior) when performing set hash table resizing.\n\n- bpo-34588(60): Fix an off-by-one in the recursive call pruning\nfeature of traceback formatting.\n\n- bpo-34485(61): On Windows, the LCCTYPE is now set to the user\npreferred locale at startup.  Previously, the LCCTYPE locale was\n\"C\" at startup, but changed when calling setlocale(LCCTYPE, \"\") or\nsetlocale(LCALL, \"\").\n\n- bpo-34485(62): Standard streams like sys.stdout now use the\n\"surrogateescape\" error handler, instead of \"strict\", on the POSIX\nlocale (when the C locale is not coerced and the UTF-8 Mode is\ndisabled).\n\n- bpo-34485(63): Fix the error handler of standard streams like\nsys.stdout: PYTHONIOENCODING=\":\" is now ignored instead of setting\nthe error handler to \"strict\".\n\n- bpo-34485(64): Python now gets the locale encoding with C code to\ninitialize the encoding of standard streams like sys.stdout.\nMoreover, the encoding is now initialized to the Python codec name\nto get a normalized encoding name and to ensure that the codec is\nloaded.  The change avoids importing bootlocale and locale\nmodules at startup by default.\n\n- bpo-34527(65): On FreeBSD, PyDecodeLocale() and PyEncodeLocale()\nnow also forces the ASCII encoding if the LCCTYPE locale is\n\"POSIX\", not only if the LCCTYPE locale is \"C\".\n\n- bpo-34527(66): The UTF-8 Mode is now also enabled by the \"POSIX\"\nlocale, not only by the \"C\" locale.\n\n- bpo-34403(67): On HP-UX with C or POSIX locale,\nsys.getfilesystemencoding() now returns \"ascii\" instead of \"roman8\"\n(when the UTF-8 Mode is disabled and the C locale is not coerced).\n\n- bpo-34523(68): The Python filesystem encoding is now read earlier\nduring the Python initialization.\n\n- bpo-12458(69): Tracebacks show now correct line number for\nsubexpressions in multiline expressions.  Tracebacks show now the\nline number of the first line for multiline expressions instead of\nthe line number of the last subexpression.\n\n- bpo-34408(70): Prevent a null pointer dereference and resource\nleakage in 'PyInterpreterStateNew()'.\n\n- bpo-34400(71): Fix undefined behavior in parsetok.c.  Patch by\nZackery Spytz.\n\n- bpo-33073(72): Added asintegerratio to ints to make them more\ninteroperable with floats.\n\n- bpo-34377(73): Update valgrind suppression list to use\n'PyObjectFree'/'PyObjectRealloc' instead of\n'PyObjectFree'/'PyObjectRealloc'.\n\n- bpo-34353(74): Added the \"socket\" option in the 'stat.filemode()'\nPython implementation to match the C implementation.\n\n- bpo-34320(75): Fix 'dict(od)' didn't copy iteration order of\nOrderedDict.\n\n- bpo-34113(76): Fixed crash on debug builds when opcode stack was\nadjusted with negative numbers.  Patch by Constantin Petrisor.\n\n- bpo-34100(77): Compiler now merges constants in tuples and\nfrozensets recursively.  Code attributes like 'conames' are merged\ntoo.\n\n- bpo-34151(78): Performance of list concatenation, repetition and\nslicing operations is slightly improved.  Patch by Sergey Fedoseev.\n\n- bpo-34170(79): -X dev: it is now possible to override the memory\nallocator using PYTHONMALLOC even if the developer mode is enabled.\n\n- bpo-33237(80): Improved *note AttributeError: 395. message for\npartially initialized module.\n\n- bpo-34149(81): Fix min and max functions to get default behavior\nwhen key is None.\n\n- bpo-34125(82): Profiling of unbound built-in methods now works when\n'kwargs' is given.\n\n- bpo-34141(83): Optimized pickling atomic types (None, bool, int,\nfloat, bytes, str).\n\n- bpo-34126(84): Fix crashes when profiling certain invalid calls of\nunbound methods.  Patch by Jeroen Demeyer.\n\n- bpo-24618(85): Fixed reading invalid memory when create the code\nobject with too small varnames tuple or too large argument counts.\n\n- bpo-34068(86): In *note io.IOBase.close(): 17a4, ensure that the\n*note closed: 17a5. attribute is not set with a live exception.\nPatch by Zackery Spytz and Serhiy Storchaka.\n\n- bpo-34087(87): Fix buffer overflow while converting unicode to\nnumeric values.\n\n- bpo-34080(88): Fixed a memory leak in the compiler when it raised\nsome uncommon errors during tokenizing.\n\n- bpo-34066(89): Disabled interruption by Ctrl-C between calling\n'open()' and entering a 'with' block in 'with open()'.\n\n- bpo-34042(90): Fix dict.copy() to maintain correct total refcount\n(as reported by sys.gettotalrefcount()).\n\n- bpo-33418(91): Fix potential memory leak in function object when it\ncreates reference cycle.\n\n- bpo-33985(92): Implement contextvars.ContextVar.name attribute.\n\n- bpo-33956(93): Update vendored Expat library copy to version 2.2.5.\n\n- bpo-24596(94): Decref the module object in *note\nPyRunSimpleFileExFlags(): 166d. before calling *note\nPyErrPrint(): 16ac.  Patch by Zackery Spytz.\n\n- bpo-33451(95): Close directly executed pyc files before calling\n'PyEvalEvalCode()'.\n\n- bpo-1617161(96): The hash of 'BuiltinMethodType' instances (methods\nof built-in classes) now depends on the hash of the identity of\n'self' instead of its value.  The hash and equality of\n'ModuleType' and 'MethodWrapperType' instances (methods of\nuser-defined classes and some methods of built-in classes like\n'str.add') now depend on the hash and equality of the identity\nof 'self' instead of its value.  'MethodWrapperType' instances\nno longer support ordering.\n\n- bpo-33824(97): Fix \"LCALL=C python3.7 -V\": reset properly the\ncommand line parser when the encoding changes after reading the\nPython configuration.\n\n- bpo-33803(98): Fix a crash in hamt.c caused by enabling GC tracking\nfor an object that hadn't all of its fields set to NULL.\n\n- bpo-33738(99): Seven macro incompatibilities with the Limited API\nwere fixed, and the macros *note PyIterCheck(): 1659, *note\nPyIndexCheck(): 7ae. and 'PyExceptionClassName()' were added as\nfunctions.  A script for automatic macro checks was added.\n\n- bpo-33786(100): Fix asynchronous generators to handle GeneratorExit\nin athrow() correctly\n\n- bpo-30167(101): 'PyRunSimpleFileExFlags' removes 'cached' from\nmodule in addition to 'file'.\n\n- bpo-33706(102): Fix a crash in Python initialization when parsing\nthe command line options.  Thanks Christoph Gohlke for the bug\nreport and the fix!\n\n- bpo-33597(103): Reduce 'PyGCHead' size from 3 words to 2 words.\n\n- bpo-30654(104): Fixed reset of the SIGINT handler to SIGDFL on\ninterpreter shutdown even when there was a custom handler set\npreviously.  Patch by Philipp Kerling.\n\n- bpo-33622(105): Fixed a leak when the garbage collector fails to\nadd an object with the 'del' method or referenced by it into\nthe *note gc.garbage: 1035. list.  *note PyGCCollect(): 7b2. can\nnow be called when an exception is set and preserves it.\n\n- bpo-33462(106): Make dict and dict views reversible.  Patch by Re'mi\nLapeyre.\n\n- bpo-23722(107): A *note RuntimeError: 17a. is now raised when the\ncustom metaclass doesn't provide the 'classcell' entry in the\nnamespace passed to 'type.new'.  A *note DeprecationWarning:\n179. was emitted in Python 3.6-3.7.\n\n- bpo-33499(108): Add *note PYTHONPYCACHEPREFIX: 7c7. environment\nvariable and *note -X: 188. 'pycacheprefix' command-line option to\nset an alternate root directory for writing module bytecode cache\nfiles.\n\n- bpo-25711(109): The *note zipimport: 12c. module has been rewritten\nin pure Python.\n\n- bpo-33509(110): Fix moduleglobals parameter of\nwarnings.warnexplicit(): don't crash if moduleglobals is not a\ndict.\n\n- bpo-31849(111): Fix signed/unsigned comparison warning in pyhash.c.\n\n- bpo-33475(112): Fixed miscellaneous bugs in converting annotations\nto strings and optimized parentheses in the string representation.\n\n- bpo-20104(113): Added support for the 'setpgroup', 'resetids',\n'setsigmask', 'setsigdef' and 'scheduler' parameters of\n'posixspawn'.  Patch by Pablo Galindo.\n\n- bpo-33391(114): Fix a leak in setsymmetricdifference().\n\n- bpo-33363(115): Raise a SyntaxError for 'async with' and 'async\nfor' statements outside of async functions.\n\n- bpo-28055(116): Fix unaligned accesses in siphash24().  Patch by\nRolf Eike Beer.\n\n- bpo-33128(117): Fix a bug that causes PathFinder to appear twice on\nsys.metapath.  Patch by Pablo Galindo Salgado.\n\n- bpo-33331(118): Modules imported last are now cleared first at\ninterpreter shutdown.\n\n- bpo-33312(119): Fixed clang ubsan (undefined behavior sanitizer)\nwarnings in dictobject.c by adjusting how the internal struct\ndictkeysobject shared keys structure is declared.\n\n- bpo-33305(120): Improved syntax error messages for invalid\nnumerical literals.\n\n- bpo-33306(121): Improved syntax error messages for unbalanced\nparentheses.\n\n- bpo-33234(122): The list constructor will pre-size and not\nover-allocate when the input length is known.\n\n- bpo-33270(123): Intern the names for all anonymous code objects.\nPatch by Zackery Spytz.\n\n- bpo-30455(124): The C and Python code and the documentation related\nto tokens are now generated from a single source file\n'Grammar/Tokens'.\n\n- bpo-33176(125): Add a 'toreadonly()' method to memoryviews.\n\n- bpo-33231(126): Fix potential memory leak in 'normalizestring()'.\n\n- bpo-33205(127): Change dict growth function from\n'rounduptopower2(used*2+hashtablesize/2)' to\n'rounduptopower2(used*3)'.  Previously, dict is shrinked only\nwhen 'used == 0'.  Now dict has more chance to be shrinked.\n\n- bpo-29922(128): Improved error messages in 'async with' when\n'aenter()' or 'aexit()' return non-awaitable object.\n\n- bpo-33199(129): Fix 'maversiontag' in dict implementation is\nuninitialized when copying from key-sharing dict.\n\n- bpo-33053(130): When using the -m switch, sys.path[0] is now\nexplicitly expanded as the 'starting' working directory, rather\nthan being left as the empty path (which allows imports from the\ncurrent working directory at the time of the import)\n\n- bpo-33138(131): Changed standard error message for non-pickleable\nand non-copyable types.  It now says \"cannot pickle\" instead of\n\"can't pickle\" or \"cannot serialize\".\n\n- bpo-33018(132): Improve consistency of errors raised by\n'issubclass()' when called with a non-class and an abstract base\nclass as the first and second arguments, respectively.  Patch by\nJosh Bronson.\n\n- bpo-33083(133): 'math.factorial' no longer accepts arguments that\nare not int-like.  Patch by Pablo Galindo.\n\n- bpo-33041(134): Added new opcode *note ENDASYNCFOR: 8df. and\nfixes the following issues:\n\n* Setting global *note StopAsyncIteration: 17a6. no longer\nbreaks 'async for' loops.\n\n* Jumping into an 'async for' loop is now disabled.\n\n* Jumping out of an 'async for' loop no longer corrupts the\nstack.\n\n- bpo-25750(135): Fix rare Python crash due to bad refcounting in\n'typegetattro()' if a descriptor deletes itself from the class.\nPatch by Jeroen Demeyer.\n\n- bpo-33041(136): Fixed bytecode generation for \"async for\" with a\ncomplex target.  A StopAsyncIteration raised on assigning or\nunpacking will be now propagated instead of stopping the iteration.\n\n- bpo-33026(137): Fixed jumping out of \"with\" block by setting\nflineno.\n\n- bpo-33005(138): Fix a crash on fork when using a custom memory\nallocator (ex: using PYTHONMALLOC env var).  PyGILStateReinit()\nand PyInterpreterStateEnable() now use the default RAW memory\nallocator to allocate a new interpreters mutex on fork.\n\n- bpo-32911(139): Due to unexpected compatibility issues discovered\nduring downstream beta testing, reverted bpo-29463(140).\n'docstring' field is removed from Module, ClassDef, FunctionDef,\nand AsyncFunctionDef ast nodes which was added in 3.7a1.  Docstring\nexpression is restored as a first statement in their body.  Based\non patch by Inada Naoki.\n\n- bpo-17288(141): Prevent jumps from 'return' and 'exception' trace\nevents.\n\n- bpo-32946(142): Importing names from already imported module with\n\"from ... import ...\" is now 30% faster if the module is not a package.\n\n- bpo-32932(143): Make error message more revealing when there are\nnon-str objects in 'all'.\n\n- bpo-32925(144): Optimized iterating and containing test for literal\nlists consisting of non-constants: 'x in [a, b]' and 'for x in [a,\nb]'.  The case of all constant elements already was optimized.\n\n- bpo-32889(145): Update Valgrind suppression list to account for the\nrename of 'PyADDRESSINRANG' to 'addressinrange'.\n\n- bpo-32836(146): Don't use temporary variables in cases of\nlist/dict/set comprehensions\n\n- bpo-31356(147): Remove the new API added in bpo-31356(148)\n(gc.ensuredisabled() context manager).\n\n- bpo-32305(149): For namespace packages, ensure that both 'file'\nand 'spec.origin' are set to None.\n\n- bpo-32303(150): Make sure 'spec.loader' matches 'loader'\nfor namespace packages.\n\n- bpo-32711(151): Fix the warning messages for Python/astunparse.c.\nPatch by Ste'phane Wirtel\n\n- bpo-32583(152): Fix possible crashing in builtin Unicode decoders\ncaused by write out-of-bound errors when using customized decode\nerror handlers.\n\n- bpo-32489(153): A *note continue: 7ed. statement is now allowed in\nthe *note finally: 7ee. clause.\n\n- bpo-17611(154): Simplified the interpreter loop by moving the logic\nof unrolling the stack of blocks into the compiler.  The compiler\nemits now explicit instructions for adjusting the stack of values\nand calling the cleaning up code for *note break: 8de, *note\ncontinue: 7ed. and *note return: 7f2.\n\nRemoved opcodes 'BREAKLOOP', 'CONTINUELOOP', 'SETUPLOOP' and\n'SETUPEXCEPT'.  Added new opcodes 'ROTFOUR', 'BEGINFINALLY' and\n'CALLFINALLY' and 'POPFINALLY'.  Changed the behavior of\n'ENDFINALLY' and 'WITHCLEANUPSTART'.\n\n- bpo-32285(155): New function unicodedata.isnormalized, which can\ncheck whether a string is in a specific normal form.\n\n- bpo-10544(156): Yield expressions are now disallowed in\ncomprehensions and generator expressions except the expression for\nthe outermost iterable.\n\n- bpo-32117(157): Iterable unpacking is now allowed without\nparentheses in yield and return statements, e.g.  'yield 1, 2, 3,\n*rest'.  Thanks to David Cuthbert for the change and Jordan Chapman\nfor added tests.\n\n- bpo-31902(158): Fix the 'coloffset' attribute for ast nodes\n'ast.AsyncFor', 'ast.AsyncFunctionDef', and 'ast.AsyncWith'.\nPreviously, 'coloffset' pointed to the keyword after 'async'.\n\n- bpo-25862(159): Fix assertion failures in the 'tell()' method of\n'io.TextIOWrapper'.  Patch by Zackery Spytz.\n\n- bpo-21983(160): Fix a crash in 'ctypes.cast()' in case the type\nargument is a ctypes structured data type.  Patch by Eryk Sun and\nOren Milman.\n\n- bpo-31577(161): Fix a crash in 'os.utime()' in case of a bad ns\nargument.  Patch by Oren Milman.\n\n- bpo-29832(162): Remove references to 'getsockaddrarg' from various\nsocket error messages.  Patch by Oren Milman.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=35877\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=35814\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=35766\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=35713\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=33416\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=35720\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=35634\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=35623\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=35214\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=35560\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=35552\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=35504\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=35504\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=35494\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=35444\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=35436\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=35423\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=35357\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=35372\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=35336\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=31241\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=33954\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=35269\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=35224\n\n(25) https://peps.python.org/pep-0572/\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=32492\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=35214\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=35214\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=35193\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=35169\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=34022\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=28401\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=29341\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=35050\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=29743\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=16806\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=35029\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=34983\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=34974\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=34939\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=34973\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=34876\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=34879\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=34784\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=32912\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=34854\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=34850\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=34824\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=30156\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=34762\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=34751\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=34735\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=34683\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=34651\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=34653\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=32236\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=34641\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=34637\n\n(59) https://bugs.python.org/issue?@action=redirect&bpo=1621\n\n(60) https://bugs.python.org/issue?@action=redirect&bpo=34588\n\n(61) https://bugs.python.org/issue?@action=redirect&bpo=34485\n\n(62) https://bugs.python.org/issue?@action=redirect&bpo=34485\n\n(63) https://bugs.python.org/issue?@action=redirect&bpo=34485\n\n(64) https://bugs.python.org/issue?@action=redirect&bpo=34485\n\n(65) https://bugs.python.org/issue?@action=redirect&bpo=34527\n\n(66) https://bugs.python.org/issue?@action=redirect&bpo=34527\n\n(67) https://bugs.python.org/issue?@action=redirect&bpo=34403\n\n(68) https://bugs.python.org/issue?@action=redirect&bpo=34523\n\n(69) https://bugs.python.org/issue?@action=redirect&bpo=12458\n\n(70) https://bugs.python.org/issue?@action=redirect&bpo=34408\n\n(71) https://bugs.python.org/issue?@action=redirect&bpo=34400\n\n(72) https://bugs.python.org/issue?@action=redirect&bpo=33073\n\n(73) https://bugs.python.org/issue?@action=redirect&bpo=34377\n\n(74) https://bugs.python.org/issue?@action=redirect&bpo=34353\n\n(75) https://bugs.python.org/issue?@action=redirect&bpo=34320\n\n(76) https://bugs.python.org/issue?@action=redirect&bpo=34113\n\n(77) https://bugs.python.org/issue?@action=redirect&bpo=34100\n\n(78) https://bugs.python.org/issue?@action=redirect&bpo=34151\n\n(79) https://bugs.python.org/issue?@action=redirect&bpo=34170\n\n(80) https://bugs.python.org/issue?@action=redirect&bpo=33237\n\n(81) https://bugs.python.org/issue?@action=redirect&bpo=34149\n\n(82) https://bugs.python.org/issue?@action=redirect&bpo=34125\n\n(83) https://bugs.python.org/issue?@action=redirect&bpo=34141\n\n(84) https://bugs.python.org/issue?@action=redirect&bpo=34126\n\n(85) https://bugs.python.org/issue?@action=redirect&bpo=24618\n\n(86) https://bugs.python.org/issue?@action=redirect&bpo=34068\n\n(87) https://bugs.python.org/issue?@action=redirect&bpo=34087\n\n(88) https://bugs.python.org/issue?@action=redirect&bpo=34080\n\n(89) https://bugs.python.org/issue?@action=redirect&bpo=34066\n\n(90) https://bugs.python.org/issue?@action=redirect&bpo=34042\n\n(91) https://bugs.python.org/issue?@action=redirect&bpo=33418\n\n(92) https://bugs.python.org/issue?@action=redirect&bpo=33985\n\n(93) https://bugs.python.org/issue?@action=redirect&bpo=33956\n\n(94) https://bugs.python.org/issue?@action=redirect&bpo=24596\n\n(95) https://bugs.python.org/issue?@action=redirect&bpo=33451\n\n(96) https://bugs.python.org/issue?@action=redirect&bpo=1617161\n\n(97) https://bugs.python.org/issue?@action=redirect&bpo=33824\n\n(98) https://bugs.python.org/issue?@action=redirect&bpo=33803\n\n(99) https://bugs.python.org/issue?@action=redirect&bpo=33738\n\n(100) https://bugs.python.org/issue?@action=redirect&bpo=33786\n\n(101) https://bugs.python.org/issue?@action=redirect&bpo=30167\n\n(102) https://bugs.python.org/issue?@action=redirect&bpo=33706\n\n(103) https://bugs.python.org/issue?@action=redirect&bpo=33597\n\n(104) https://bugs.python.org/issue?@action=redirect&bpo=30654\n\n(105) https://bugs.python.org/issue?@action=redirect&bpo=33622\n\n(106) https://bugs.python.org/issue?@action=redirect&bpo=33462\n\n(107) https://bugs.python.org/issue?@action=redirect&bpo=23722\n\n(108) https://bugs.python.org/issue?@action=redirect&bpo=33499\n\n(109) https://bugs.python.org/issue?@action=redirect&bpo=25711\n\n(110) https://bugs.python.org/issue?@action=redirect&bpo=33509\n\n(111) https://bugs.python.org/issue?@action=redirect&bpo=31849\n\n(112) https://bugs.python.org/issue?@action=redirect&bpo=33475\n\n(113) https://bugs.python.org/issue?@action=redirect&bpo=20104\n\n(114) https://bugs.python.org/issue?@action=redirect&bpo=33391\n\n(115) https://bugs.python.org/issue?@action=redirect&bpo=33363\n\n(116) https://bugs.python.org/issue?@action=redirect&bpo=28055\n\n(117) https://bugs.python.org/issue?@action=redirect&bpo=33128\n\n(118) https://bugs.python.org/issue?@action=redirect&bpo=33331\n\n(119) https://bugs.python.org/issue?@action=redirect&bpo=33312\n\n(120) https://bugs.python.org/issue?@action=redirect&bpo=33305\n\n(121) https://bugs.python.org/issue?@action=redirect&bpo=33306\n\n(122) https://bugs.python.org/issue?@action=redirect&bpo=33234\n\n(123) https://bugs.python.org/issue?@action=redirect&bpo=33270\n\n(124) https://bugs.python.org/issue?@action=redirect&bpo=30455\n\n(125) https://bugs.python.org/issue?@action=redirect&bpo=33176\n\n(126) https://bugs.python.org/issue?@action=redirect&bpo=33231\n\n(127) https://bugs.python.org/issue?@action=redirect&bpo=33205\n\n(128) https://bugs.python.org/issue?@action=redirect&bpo=29922\n\n(129) https://bugs.python.org/issue?@action=redirect&bpo=33199\n\n(130) https://bugs.python.org/issue?@action=redirect&bpo=33053\n\n(131) https://bugs.python.org/issue?@action=redirect&bpo=33138\n\n(132) https://bugs.python.org/issue?@action=redirect&bpo=33018\n\n(133) https://bugs.python.org/issue?@action=redirect&bpo=33083\n\n(134) https://bugs.python.org/issue?@action=redirect&bpo=33041\n\n(135) https://bugs.python.org/issue?@action=redirect&bpo=25750\n\n(136) https://bugs.python.org/issue?@action=redirect&bpo=33041\n\n(137) https://bugs.python.org/issue?@action=redirect&bpo=33026\n\n(138) https://bugs.python.org/issue?@action=redirect&bpo=33005\n\n(139) https://bugs.python.org/issue?@action=redirect&bpo=32911\n\n(140) https://bugs.python.org/issue?@action=redirect&bpo=29463\n\n(141) https://bugs.python.org/issue?@action=redirect&bpo=17288\n\n(142) https://bugs.python.org/issue?@action=redirect&bpo=32946\n\n(143) https://bugs.python.org/issue?@action=redirect&bpo=32932\n\n(144) https://bugs.python.org/issue?@action=redirect&bpo=32925\n\n(145) https://bugs.python.org/issue?@action=redirect&bpo=32889\n\n(146) https://bugs.python.org/issue?@action=redirect&bpo=32836\n\n(147) https://bugs.python.org/issue?@action=redirect&bpo=31356\n\n(148) https://bugs.python.org/issue?@action=redirect&bpo=31356\n\n(149) https://bugs.python.org/issue?@action=redirect&bpo=32305\n\n(150) https://bugs.python.org/issue?@action=redirect&bpo=32303\n\n(151) https://bugs.python.org/issue?@action=redirect&bpo=32711\n\n(152) https://bugs.python.org/issue?@action=redirect&bpo=32583\n\n(153) https://bugs.python.org/issue?@action=redirect&bpo=32489\n\n(154) https://bugs.python.org/issue?@action=redirect&bpo=17611\n\n(155) https://bugs.python.org/issue?@action=redirect&bpo=32285\n\n(156) https://bugs.python.org/issue?@action=redirect&bpo=10544\n\n(157) https://bugs.python.org/issue?@action=redirect&bpo=32117\n\n(158) https://bugs.python.org/issue?@action=redirect&bpo=31902\n\n(159) https://bugs.python.org/issue?@action=redirect&bpo=25862\n\n(160) https://bugs.python.org/issue?@action=redirect&bpo=21983\n\n(161) https://bugs.python.org/issue?@action=redirect&bpo=31577\n\n(162) https://bugs.python.org/issue?@action=redirect&bpo=29832\n\nFile: python3.12.info,  Node: Library<46>,  Next: Documentation<46>,  Prev: Core and Builtins<46>,  Up: Python 3 8 0 alpha 1\n\n1.22.46.3 Library\n.................\n\n- bpo-35845(1): Add 'order' parameter to memoryview.tobytes().\n\n- bpo-35864(2): The asdict() method for collections.namedtuple now\nreturns a regular dict instead of an OrderedDict.\n\n- bpo-35537(3): An ExitStack is now used internally within\nsubprocess.Popen to clean up pipe file handles.  No behavior change\nin normal operation.  But if closing one handle were ever to cause\nan exception, the others will now be closed instead of leaked.\n(patch by Giampaolo Rodola)\n\n- bpo-35847(4): RISC-V needed the CTYPESPASSBYREFHACK. Fixes\nctypes Structure testpassbyvalue.\n\n- bpo-35813(5): Shared memory submodule added to multiprocessing to\navoid need for serialization between processes\n\n- bpo-35780(6): Fix lrucache() errors arising in recursive,\nreentrant, or multi-threaded code.  These errors could result in\norphan links and in the cache being trapped in a state with fewer\nthan the specified maximum number of links.  Fix handling of\nnegative maxsize which should have been treated as zero.  Fix\nerrors in toggling the \"full\" status flag.  Fix misordering of\nlinks when errors are encountered.  Sync-up the C code and pure\nPython code for the space saving path in functions with a single\npositional argument.  In this common case, the space overhead of an\nlru cache entry is reduced by almost half.  Fix counting of cache\nmisses.  In error cases, the miss count was out of sync with the\nactual number of times the underlying user function was called.\n\n- bpo-35537(7): *note os.posixspawn(): 885. and *note\nos.posixspawnp(): 17a8. now have a 'setsid' parameter.\n\n- bpo-23846(8): *note asyncio.ProactorEventLoop: 3d2. now catches and\nlogs send errors when the self-pipe is full.\n\n- bpo-34323(9): *note asyncio: 9.: Enhance 'IocpProactor.close()'\nlog: wait 1 second before the first log, then log every second.\nLog also the number of seconds since 'close()' was called.\n\n- bpo-35674(10): Add a new *note os.posixspawnp(): 17a8. function.\nPatch by Joannah Nanjekye.\n\n- bpo-35733(11): 'ast.Constant(boolean)' no longer an instance of\n'ast.Num'.  Patch by Anthony Sottile.\n\n- bpo-35726(12): QueueHandler.prepare() now makes a copy of the\nrecord before modifying and enqueueing it, to avoid affecting other\nhandlers in the chain.\n\n- bpo-35719(13): Sped up multi-argument *note math: 89. functions\natan2(), copysign(), remainder() and hypot() by 1.3-2.5 times.\n\n- bpo-35717(14): Fix KeyError exception raised when using enums and\ncompile.  Patch contributed by Re'mi Lapeyre.\n\n- bpo-35699(15): Fixed detection of Visual Studio Build Tools 2017 in\ndistutils\n\n- bpo-32710(16): Fix memory leaks in asyncio ProactorEventLoop on\noverlapped operation failure.\n\n- bpo-35702(17): The *note time.CLOCKUPTIMERAW: 86e. constant is\nnow available for macOS 10.12.\n\n- bpo-32710(18): Fix a memory leak in asyncio in the\nProactorEventLoop when 'ReadFile()' or 'WSASend()' overlapped\noperation fail immediately: release the internal buffer.\n\n- bpo-35682(19): Fix 'asyncio.ProactorEventLoop.sendfile()': don't\nattempt to set the result of an internal future if it's already\ndone.\n\n- bpo-35283(20): Add a deprecated warning for the\n'threading.Thread.isAlive()' method.  Patch by Donghee Na.\n\n- bpo-35664(21): Improve operator.itemgetter() performance by 33%\nwith optimized argument handling and with adding a fast path for\nthe common case of a single non-negative integer index into a tuple\n(which is the typical use case in the standard library).\n\n- bpo-35643(22): Fixed a SyntaxWarning: invalid escape sequence in\nModules/sha3/cleanup.py.  Patch by Mickae\"l Schoentgen.\n\n- bpo-35619(23): Improved support of custom data descriptors in *note\nhelp(): 6f0. and *note pydoc: b0.\n\n- bpo-28503(24): The 'crypt' module now internally uses the\n'cryptr()' library function instead of 'crypt()' when available.\n\n- bpo-35614(25): Fixed help() on metaclasses.  Patch by Sanyam\nKhurana.\n\n- bpo-35568(26): Expose 'raise(signum)' as 'raisesignal'\n\n- bpo-35588(27): The floor division and modulo operations and the\n*note divmod(): 7c5. function on *note fractions.Fraction: 1a8.\ntypes are 2-4x faster.  Patch by Stefan Behnel.\n\n- bpo-35585(28): Speed-up building enums by value, e.g.\nhttp.HTTPStatus(200).\n\n- bpo-30561(29): random.gammavariate(1.0, beta) now computes the same\nresult as random.expovariate(1.0 / beta).  This synchronizes the\ntwo algorithms and eliminates some idiosyncrasies in the old\nimplementation.  It does however produce a difference stream of\nrandom variables than it used to.\n\n- bpo-35537(30): The *note subprocess: d0. module can now use the\n*note os.posixspawn(): 885. function in some cases for better\nperformance.\n\n- bpo-35526(31): Delaying the 'joke' of barryasFLUFL.mandatory to\nPython version 4.0\n\n- bpo-35523(32): Remove *note ctypes: 28. callback workaround: no\nlonger create a callback at startup.  Avoid SELinux alert on\n'import ctypes' and 'import uuid'.\n\n- bpo-31784(33): *note uuid.uuid1(): 9ec. now calls *note\ntime.timens(): 91e. rather than 'int(time.time() * 1e9)'.\n\n- bpo-35513(34): 'TextTestRunner' of 'unittest.runner' now uses *note\ntime.perfcounter(): 8b6. rather than *note time.time(): 918. to\nmeasure the execution time of a test: *note time.time(): 918. can\ngo backwards, whereas *note time.perfcounter(): 8b6. is monotonic.\n\n- bpo-35502(35): Fixed reference leaks in *note\nxml.etree.ElementTree.TreeBuilder: 881. in case of unfinished\nbuilding of the tree (in particular when an error was raised during\nparsing XML).\n\n- bpo-35348(36): Make *note platform.architecture(): 17a9. parsing of\n'file' command output more reliable: add the '-b' option to the\n'file' command to omit the filename, force the usage of the C\nlocale, and search also the \"shared object\" pattern.\n\n- bpo-35491(37): *note multiprocessing: 8f.: Add 'Pool.repr()'\nand enhance 'BaseProcess.repr()' (add pid and parent pid) to\nease debugging.  Pool state constant values are now strings instead\nof integers, for example 'RUN' value becomes ''RUN'' instead of\n'0'.\n\n- bpo-35477(38): 'multiprocessing.Pool.enter()' now fails if the\npool is not running: 'with pool:' fails if used more than once.\n\n- bpo-31446(39): Copy command line that was passed to CreateProcessW\nsince this function can change the content of the input buffer.\n\n- bpo-35471(40): Python 2.4 dropped MacOS 9 support.  The macpath\nmodule was deprecated in Python 3.7.  The module is now removed.\n\n- bpo-23057(41): Unblock Proactor event loop when keyboard interrupt\nis received on Windows\n\n- bpo-35052(42): Fix xml.dom.minidom cloneNode() on a document with\nan entity: pass the correct arguments to the user data handler of\nan entity.\n\n- bpo-20239(43): Allow repeated assignment deletion of *note\nunittest.mock.Mock: 878. attributes.  Patch by Pablo Galindo.\n\n- bpo-17185(44): Set 'signature' on mock for *note inspect: 78.\nto get signature.  Patch by Karthikeyan Singaravelan.\n\n- bpo-35445(45): Memory errors during creating posix.environ no\nlonger ignored.\n\n- bpo-35415(46): Validate fileno= argument to socket.socket().\n\n- bpo-35424(47): 'multiprocessing.Pool' destructor now emits *note\nResourceWarning: a86. if the pool is still running.\n\n- bpo-35330(48): When a 'Mock' instance was used to wrap an object,\nif 'sideeffect' is used in one of the mocks of it methods, don't\ncall the original implementation and return the result of using the\nside effect the same way that it is done with returnvalue.\n\n- bpo-35346(49): Drop Mac OS 9 and Rhapsody support from the *note\nplatform: a5. module.  Rhapsody last release was in 2000.  Mac OS 9\nlast release was in 2001.\n\n- bpo-10496(50): 'checkenviron()' of 'distutils.utils' now catches\n*note KeyError: 8cf. on calling *note pwd.getpwuid(): 17aa.: don't\ncreate the 'HOME' environment variable in this case.\n\n- bpo-10496(51): 'posixpath.expanduser()' now returns the input\n'path' unchanged if the 'HOME' environment variable is not set and\nthe current user has no home directory (if the current user\nidentifier doesn't exist in the password database).  This change\nfix the *note site: c2. module if the current user doesn't exist in\nthe password database (if the user has no home directory).\n\n- bpo-35389(52): *note platform.libcver(): 17ab. now uses\n'os.confstr('CSGNULIBCVERSION')' if available and the\n'executable' parameter is not set.\n\n- bpo-35394(53): Add empty slots to asyncio abstract protocols.\n\n- bpo-35310(54): Fix a bug in *note select.select(): bfc. where, in\nsome cases, the file descriptor sequences were returned unmodified\nafter a signal interruption, even though the file descriptors might\nnot be ready yet.  *note select.select(): bfc. will now always\nreturn empty lists if a timeout has occurred.  Patch by Oran\nAvraham.\n\n- bpo-35380(55): Enable TCPNODELAY on Windows for proactor asyncio\nevent loop.\n\n- bpo-35341(56): Add generic version of 'collections.OrderedDict' to\nthe 'typing' module.  Patch by Ismo Toijala.\n\n- bpo-35371(57): Fixed possible crash in 'os.utime()' on Windows when\npass incorrect arguments.\n\n- bpo-35346(58): *note platform.uname(): 17ac. now redirects 'stderr'\nto *note os.devnull: 17ad. when running external programs like 'cmd\n/c ver'.\n\n- bpo-35066(59): Previously, calling the strftime() method on a\ndatetime object with a trailing '%' in the format string would\nresult in an exception.  However, this only occurred when the\ndatetime C module was being used; the python implementation did not\nmatch this behavior.  Datetime is now PEP-399 compliant, and will\nnot throw an exception on a trailing '%'.\n\n- bpo-35345(60): The function 'platform.popen' has been removed, it\nwas deprecated since Python 3.3: use *note os.popen(): 8b5.\ninstead.\n\n- bpo-35344(61): On macOS, *note platform.platform(): 14a3. now uses\n*note platform.macver(): 17ae, if it returns a non-empty release\nstring, to get the macOS version rather than the darwin version.\n\n- bpo-35312(62): Make 'lib2to3.pgen2.parse.ParseError' round-trip\npickle-able.  Patch by Anthony Sottile.\n\n- bpo-35308(63): Fix regression in 'webbrowser' where default\nbrowsers may be preferred over browsers in the 'BROWSER'\nenvironment variable.\n\n- bpo-24746(64): Avoid stripping trailing whitespace in doctest fancy\ndiff.  Original patch by R. David Murray & Jairo Trad.  Enhanced by\nSanyam Khurana.\n\n- bpo-28604(65): *note locale.localeconv(): a44. now sets temporarily\nthe 'LCCTYPE' locale to the 'LCMONETARY' locale if the two\nlocales are different and monetary strings are non-ASCII. This\ntemporary change affects other threads.\n\n- bpo-35277(66): Update ensurepip to install pip 18.1 and setuptools\n40.6.2.\n\n- bpo-24209(67): Adds IPv6 support when invoking http.server\ndirectly.\n\n- bpo-35226(68): Recursively check arguments when testing for\nequality of *note unittest.mock.call: 173d. objects and add note\nthat tracking of parameters used to create ancestors of mocks in\n'mockcalls' is not possible.\n\n- bpo-29564(69): The warnings module now suggests to enable\ntracemalloc if the source is specified, the tracemalloc module is\navailable, but tracemalloc is not tracing memory allocations.\n\n- bpo-35189(70): Modify the following fnctl function to retry if\ninterrupted by a signal (EINTR): flock, lockf, fnctl\n\n- bpo-30064(71): Use adddonecallback() in sock* asyncio API to\nunsubscribe reader/writer early on calcellation.\n\n- bpo-35186(72): Removed the \"built with\" comment added when\n'setup.py upload' is used with either 'bdistrpm' or 'bdistdumb'.\n\n- bpo-35152(73): Allow sending more than 2 GB at once on a\nmultiprocessing connection on non-Windows systems.\n\n- bpo-35062(74): Fix incorrect parsing of\n'io.IncrementalNewlineDecoder''s 'translate' argument.\n\n- bpo-35065(75): Remove 'StreamReaderProtocol.untrackreader'.  The\ncall to 'untrackreader' is currently performed too soon, causing\nthe protocol to forget about the reader before 'connectionlost'\ncan run and feed the EOF to the reader.\n\n- bpo-34160(76): ElementTree and minidom now preserve the attribute\norder specified by the user.\n\n- bpo-35079(77): Improve difflib.SequenceManager.getmatchingblocks\ndoc by adding 'non-overlapping' and changing '!=' to '<'.\n\n- bpo-33710(78): Deprecated 'l*gettext()' functions and methods in\nthe *note gettext: 5e. module.  They return encoded bytes instead\nof Unicode strings and are artifacts from Python 2 times.  Also\ndeprecated functions and methods related to setting the charset for\n'l*gettext()' functions and methods.\n\n- bpo-35017(79): *note socketserver.BaseServer.serveforever(): fb1.\nnow exits immediately if it's *note shutdown(): 17af. method is\ncalled while it is polling for new events.\n\n- bpo-35024(80): 'importlib' no longer logs 'wrote <bytecode path>'\nredundantly after '(created|could not create) <bytecode path>' is\nalready logged.  Patch by Quentin Agren.\n\n- bpo-35047(81): 'unittest.mock' now includes mock calls in exception\nmessages if 'assertnotcalled', 'assertcalledonce', or\n'assertcalledoncewith' fails.  Patch by Petter Strandmark.\n\n- bpo-31047(82): Fix 'ntpath.abspath' regression where it didn't\nremove a trailing separator on Windows.  Patch by Tim Graham.\n\n- bpo-35053(83): tracemalloc now tries to update the traceback when\nan object is reused from a \"free list\" (optimization for faster\nobject creation, used by the builtin list type for example).\n\n- bpo-31553(84): Add the -json-lines option to json.tool.  Patch by\nhongweipeng.\n\n- bpo-34794(85): Fixed a leak in Tkinter when pass the Python wrapper\naround TclObj back to Tcl/Tk.\n\n- bpo-34909(86): Enum: fix grandchildren subclassing when parent\nmixed with concrete data types.\n\n- bpo-35022(87): *note unittest.mock.MagicMock: cf4. now supports the\n'fspath' method (from *note os.PathLike: a9a.).\n\n- bpo-35008(88): Fixed references leaks when call the\n'setstate()' method of *note xml.etree.ElementTree.Element:\n23e. in the C implementation for already initialized element.\n\n- bpo-23420(89): Verify the value for the parameter '-s' of the\ncProfile CLI. Patch by Robert Kuska\n\n- bpo-33947(90): dataclasses now handle recursive reprs without\nraising RecursionError.\n\n- bpo-34890(91): Make *note inspect.iscoroutinefunction(): 1af, *note\ninspect.isgeneratorfunction(): 152c. and *note\ninspect.isasyncgenfunction(): 152d. work with *note\nfunctools.partial(): d31.  Patch by Pablo Galindo.\n\n- bpo-34521(92): Use *note socket.CMSGSPACE(): 17b0. to calculate\nancillary data size instead of *note socket.CMSGLEN(): 17b1. in\n'multiprocessing.reduction.recvfds()' as RFC 3542(93) requires the\nuse of the former for portable applications.\n\n- bpo-31522(94): The 'mailbox.mbox.getstring' function 'from'\nparameter can now successfully be set to a non-default value.\n\n- bpo-34970(95): Protect tasks weak set manipulation in\n'asyncio.alltasks()'\n\n- bpo-34969(96): gzip: Add -fast, -best on the gzip CLI, these\nparameters will be used for the fast compression method (quick) or\nthe best method compress (slower, but smaller file).  Also, change\nthe default compression level to 6 (tradeoff).\n\n- bpo-16965(97): The *note 2to3: 17b2. *note execfile: 17b3. fixer\nnow opens the file with mode ''rb''.  Patch by Zackery Spytz.\n\n- bpo-34966(98): *note pydoc: b0. now supports aliases not only to\nmethods defined in the end class, but also to inherited methods.\nThe docstring is not duplicated for aliases.\n\n- bpo-34926(99): *note mimetypes.MimeTypes.guesstype(): 17b4. now\naccepts *note path-like object: 957. in addition to url strings.\nPatch by Mayank Asthana.\n\n- bpo-23831(100): Add 'moveto()' method to the 'tkinter.Canvas'\nwidget.  Patch by Juliette Monsel.\n\n- bpo-34941(101): Methods 'find()', 'findtext()' and 'findall()' of\nthe 'Element' class in the *note xml.etree.ElementTree: 120. module\nare now able to find children which are instances of 'Element'\nsubclasses.\n\n- bpo-32680(102): *note smtplib.SMTP: 74b. objects now always have a\n'sock' attribute present\n\n- bpo-34769(103): Fix for async generators not finalizing when event\nloop is in debug mode and garbage collector runs in another thread.\n\n- bpo-34936(104): Fix 'TclError' in\n'tkinter.Spinbox.selectionelement()'.  Patch by Juliette Monsel.\n\n- bpo-34829(105): Add methods 'selectionfrom', 'selectionrange',\n'selectionpresent' and 'selectionto' to the 'tkinter.Spinbox' for\nconsistency with the 'tkinter.Entry' widget.  Patch by Juliette\nMonsel.\n\n- bpo-34911(106): Added 'secureprotocols' argument to\n'http.cookiejar.DefaultCookiePolicy' to allow for tweaking of\nprotocols and also to add support by default for 'wss', the secure\nwebsocket protocol.\n\n- bpo-34922(107): Fixed integer overflow in the *note digest(): 17b5.\nand *note hexdigest(): 17b6. methods for the SHAKE algorithm in the\n*note hashlib: 63. module.\n\n- bpo-34925(108): 25% speedup in argument parsing for the functions\nin the bisect module.\n\n- bpo-34900(109): Fixed *note unittest.TestCase.debug(): 15f6. when\nused to call test methods with subtests.  Patch by Bruno Oliveira.\n\n- bpo-34844(110): logging.Formatter enhancement - Ensure styles and\nfmt matches in logging.Formatter - Added validate method in each\nformat style class: StrFormatStyle, PercentStyle,\nStringTemplateStyle.  - This method is called in the constructor of\nlogging.Formatter class - Also re-raise the KeyError in the format\nmethod of each style class, so it would a bit clear that it's an\nerror with the invalid format fields.\n\n- bpo-34897(111): Adjust test.support.missingcompilerexecutable\ncheck so that a nominal command name of \"\" is ignored.  Patch by\nMichael Felt.\n\n- bpo-34871(112): Fix inspect module polluted 'sys.modules' when\nparsing 'textsignature' of callable.\n\n- bpo-34898(113): Add 'mtime' argument to 'gzip.compress' for\nreproducible output.  Patch by Guo Ci Teo.\n\n- bpo-28441(114): On Cygwin and MinGW, ensure that 'sys.executable'\nalways includes the full filename in the path, including the '.exe'\nsuffix (unless it is a symbolic link).\n\n- bpo-34866(115): Adding 'maxnumfields' to 'cgi.FieldStorage' to\nmake DOS attacks harder by limiting the number of\n'MiniFieldStorage' objects created by 'FieldStorage'.\n\n- bpo-34711(116): http.server ensures it reports HTTPStatus.NOTFOUND\nwhen the local path ends with \"/\" and is not a directory, even if\nthe underlying OS (e.g.  AIX) accepts such paths as a valid file\nreference.  Patch by Michael Felt.\n\n- bpo-34872(117): Fix self-cancellation in C implementation of\nasyncio.Task\n\n- bpo-34849(118): Don't log waiting for 'selector.select' in asyncio\nloop iteration.  The waiting is pretty normal for any asyncio\nprogram, logging its time just adds a noise to logs without any\nuseful information provided.\n\n- bpo-34022(119): The 'SOURCEDATEEPOCH' environment variable no\nlonger overrides the value of the 'invalidationmode' argument to\n*note pycompile.compile(): 850, and determines its default value\ninstead.\n\n- bpo-34819(120): Use a monotonic clock to compute timeouts in\n'Executor.map()' and 'ascompleted()', in order to prevent timeouts\nfrom deviating when the system clock is adjusted.\n\n- bpo-34758(121): Add .wasm -> application/wasm to list of recognized\nfile types and content type headers\n\n- bpo-34789(122): *note xml.sax.makeparser(): 17b7. now accepts any\niterable as its 'parserlist' argument.  Patch by Andre's Delfino.\n\n- bpo-34334(123): In 'QueueHandler', clear 'exctext' from\n'LogRecord' to prevent traceback from being written twice.\n\n- bpo-34687(124): On Windows, asyncio now uses ProactorEventLoop,\ninstead of SelectorEventLoop, by default.\n\n- bpo-5950(125): Support reading zip files with archive comments in\n*note zipimport: 12c.\n\n- bpo-32892(126): The parser now represents all constants as *note\nast.Constant: 215. instead of using specific constant AST types\n('Num', 'Str', 'Bytes', 'NameConstant' and 'Ellipsis').  These\nclasses are considered deprecated and will be removed in future\nPython versions.\n\n- bpo-34728(127): Add deprecation warning when 'loop' is used in\nmethods: 'asyncio.sleep', 'asyncio.wait' and 'asyncio.waitfor'.\n\n- bpo-34738(128): ZIP files created by 'distutils' will now include\nentries for directories.\n\n- bpo-34659(129): Add an optional 'initial' argument to\nitertools.accumulate().\n\n- bpo-29577(130): Support multiple mixin classes when creating Enums.\n\n- bpo-34670(131): Add SSLContext.posthandshakeauth and\nSSLSocket.verifyclientposthandshake for TLS 1.3's post handshake\nauthentication feature.\n\n- bpo-32718(132): The Activate.ps1 script from venv works with\nPowerShell Core 6.1 and is now available under all operating\nsystems.\n\n- bpo-31177(133): Fix bug that prevented using *note resetmock: b4a.\non mock instances with deleted attributes\n\n- bpo-34672(134): Add a workaround, so the ''Z'' *note\ntime.strftime(): 105d. specifier on the musl C library can work in\nsome cases.\n\n- bpo-34666(135): Implement 'asyncio.StreamWriter.awrite' and\n'asyncio.StreamWriter.aclose()' coroutines.  Methods are needed for\nproviding a consistent stream API with control flow switched on by\ndefault.\n\n- bpo-6721(136): Acquire the logging module's commonly used internal\nlocks while fork()ing to avoid deadlocks in the child process.\n\n- bpo-34658(137): Fix a rare interpreter unhandled exception state\nSystemError only seen when using subprocess with a preexecfn while\nan afterparent handler has been registered with\nos.registeratfork and the fork system call fails.\n\n- bpo-34652(138): Ensure *note os.lchmod(): 17b8. is never defined on\nLinux.\n\n- bpo-34638(139): Store a weak reference to stream reader to break\nstrong references loop between reader and protocol.  It allows to\ndetect and close the socket if the stream is deleted (garbage\ncollected) without 'close()' call.\n\n- bpo-34536(140): 'Enum.missing': raise 'ValueError' if None\nreturned and 'TypeError' if non-member is returned.\n\n- bpo-34636(141): Speed up re scanning of many non-matching\ncharacters for s w and d within bytes objects.  (microoptimization)\n\n- bpo-24412(142): Add *note addModuleCleanup(): 879. and *note\naddClassCleanup(): 87a. to unittest to support cleanups for\n'setUpModule()' and *note setUpClass(): 87b.  Patch by Lisa Roach.\n\n- bpo-34630(143): Don't log SSL certificate errors in asyncio code\n(connection error logging is skipped already).\n\n- bpo-32490(144): Prevent filename duplication in *note subprocess:\nd0. exception messages.  Patch by Zackery Spytz.\n\n- bpo-34363(145): dataclasses.asdict() and .astuple() now handle\nnamedtuples correctly.\n\n- bpo-34625(146): Update vendorized expat library version to 2.2.6.\n\n- bpo-32270(147): The subprocess module no longer mistakenly closes\nredirected fds even when they were in passfds when outside of the\ndefault {0, 1, 2} set.\n\n- bpo-34622(148): Create a dedicated 'asyncio.CancelledError',\n'asyncio.InvalidStateError' and 'asyncio.TimeoutError' exception\nclasses.  Inherit them from corresponding exceptions from\n'concurrent.futures' package.  Extract 'asyncio' exceptions into a\nseparate file.\n\n- bpo-34610(149): Fixed iterator of\n'multiprocessing.managers.DictProxy'.\n\n- bpo-34421(150): Fix distutils logging for non-ASCII strings.  This\ncaused installation issues on Windows.\n\n- bpo-34604(151): Fix possible mojibake in the error message of\n'pwd.getpwnam' and 'grp.getgrnam' using string representation\nbecause of invisible characters or trailing whitespaces.  Patch by\nWilliam Grzybowski.\n\n- bpo-30977(152): Make uuid.UUID use 'slots' to reduce its memory\nfootprint.  Based on original patch by Wouter Bolsterlee.\n\n- bpo-34574(153): OrderedDict iterators are not exhausted during\npickling anymore.  Patch by Sergey Fedoseev.\n\n- bpo-8110(154): Refactored *note subprocess: d0. to check for\nWindows-specific modules rather than 'sys.platform == 'win32''.\n\n- bpo-34530(155): 'distutils.spawn.findexecutable()' now falls back\non *note os.defpath: 177a. if the 'PATH' environment variable is\nnot set.\n\n- bpo-34563(156): On Windows, fix multiprocessing.Connection for very\nlarge read: fix winapi.PeekNamedPipe() and winapi.ReadFile() for\nread larger than INTMAX (usually '231-1').\n\n- bpo-34558(157): Correct typo in Lib/ctypes/aix.py\n\n- bpo-34282(158): Move 'Enum.convert' to 'EnumMeta.convert' and\nfix enum members getting shadowed by parent attributes.\n\n- bpo-22872(159): When the queue is closed, *note ValueError: 183. is\nnow raised by *note multiprocessing.Queue.put(): 17b9. and *note\nmultiprocessing.Queue.get(): 17ba. instead of *note AssertionError:\n476. and *note OSError: 613, respectively.  Patch by Zackery Spytz.\n\n- bpo-34515(160): Fix parsing non-ASCII identifiers in\n'lib2to3.pgen2.tokenize' ( PEP 3131(161)).\n\n- bpo-13312(162): Avoids a possible integer underflow (undefined\nbehavior) in the time module's year handling code when passed a\nvery low negative year value.\n\n- bpo-34472(163): Improved compatibility for streamed files in *note\nzipfile: 12b.  Previously an optional signature was not being\nwritten and certain ZIP applications were not supported.  Patch by\nSilas Sewell.\n\n- bpo-34454(164): Fix the .fromisoformat() methods of datetime types\ncrashing when given unicode with non-UTF-8-encodable code points.\nSpecifically, datetime.fromisoformat() now accepts surrogate\nunicode code points used as the separator.  Report and tests by\nAlexey Izbyshev, patch by Paul Ganssle.\n\n- bpo-6700(165): Fix inspect.getsourcelines for module level\nframes/tracebacks.  Patch by Vladimir Matveev.\n\n- bpo-34171(166): Running the *note trace: f8. module no longer\ncreates the 'trace.cover' file.\n\n- bpo-34441(167): Fix crash when an 'ABC'-derived class with invalid\n'subclasses' is passed as the second argument to *note\nissubclass(): 5b4.  Patch by Alexey Izbyshev.\n\n- bpo-34427(168): Fix infinite loop in 'a.extend(a)' for\n'MutableSequence' subclasses.\n\n- bpo-34412(169): Make *note signal.strsignal(): 17bb. work on HP-UX.\nPatch by Michael Osipov.\n\n- bpo-20849(170): shutil.copytree now accepts a new 'dirsexistok'\nkeyword argument.  Patch by Josh Bronson.\n\n- bpo-31715(171): Associate '.mjs' file extension with\n'application/javascript' MIME Type.\n\n- bpo-34384(172): *note os.readlink(): 73e. now accepts *note\npath-like: 957. and *note bytes: 295. objects on Windows.\n\n- bpo-22602(173): The UTF-7 decoder now raises *note\nUnicodeDecodeError: 83c. for ill-formed sequences starting with \"+\"\n(as specified in RFC 2152).  Patch by Zackery Spytz.\n\n- bpo-2122(174): The *note mmap.flush(): 8cb. method now returns\n'None' on success, raises an exception on error under all\nplatforms.\n\n- bpo-34341(175): Appending to the ZIP archive with the ZIP64\nextension no longer grows the size of extra fields of existing\nentries.\n\n- bpo-34333(176): Fix %-formatting in *note\npathlib.PurePath.withsuffix(): 17bc. when formatting an error\nmessage.\n\n- bpo-18540(177): The *note imaplib.IMAP4: 71e. and *note\nimaplib.IMAP4SSL: 71f. classes now resolve to the local host IP\ncorrectly when the default value of 'host' parameter ('''') is\nused.\n\n- bpo-26502(178): Implement 'traceback.FrameSummary.len()' method\nto preserve compatibility with the old tuple API.\n\n- bpo-34318(179): *note assertRaises(): 281, *note\nassertRaisesRegex(): 283, *note assertWarns(): fd9. and *note\nassertWarnsRegex(): fda. no longer success if the passed callable\nis None.  They no longer ignore unknown keyword arguments in the\ncontext manager mode.  A DeprecationWarning was raised in these\ncases since Python 3.5.\n\n- bpo-9372(180): Deprecate *note getitem(): 4b9. methods of *note\nxml.dom.pulldom.DOMEventStream: 519, *note\nwsgiref.util.FileWrapper: 51a. and *note fileinput.FileInput: 51b.\n\n- bpo-33613(181): Fix a race condition in\n'multiprocessing.semaphoretracker' when the tracker receives\nSIGINT before it can register signal handlers for ignoring it.\n\n- bpo-34248(182): Report filename in the exception raised when the\ndatabase file cannot be opened by *note dbm.gnu.open(): 17bd. and\n*note dbm.ndbm.open(): 17be. due to OS-related error.  Patch by\nZsolt Cserna.\n\n- bpo-33089(183): Add math.dist() to compute the Euclidean distance\nbetween two points.\n\n- bpo-34246(184): *note smtplib.SMTP.sendmessage(): cbb. no longer\nmodifies the content of the 'mailoptions' argument.  Patch by\nPablo S. Blum de Aguiar.\n\n- bpo-31047(185): Fix 'ntpath.abspath' for invalid paths on windows.\nPatch by Franz Woellert.\n\n- bpo-32321(186): Add pure Python fallback for functools.reduce.\nPatch by Robert Wright.\n\n- bpo-34270(187): The default asyncio task class now always has a\nname which can be get or set using two new methods (*note\ngetname(): 804. and *note setname(): 803.) and is visible in the\n*note repr(): 5f0. output.  An initial name can also be set using\nthe new 'name' keyword argument to *note asyncio.createtask():\n3c5. or the 'createtask()' method of the event loop.  If no\ninitial name is set, the default Task implementation generates a\nname like 'Task-1' using a monotonic counter.\n\n- bpo-34263(188): asyncio's event loop will not pass timeouts longer\nthan one day to epoll/select etc.\n\n- bpo-34035(189): Fix several AttributeError in zipfile seek()\nmethods.  Patch by Mickae\"l Schoentgen.\n\n- bpo-32215(190): Fix performance regression in *note sqlite3: c9.\nwhen a DML statement appeared in a different line than the rest of\nthe SQL query.\n\n- bpo-34075(191): Deprecate passing non-ThreadPoolExecutor instances\nto 'AbstractEventLoop.setdefaultexecutor()'.\n\n- bpo-34251(192): Restore 'msilib.Win64' to preserve backwards\ncompatibility since it's already used by 'distutils'' 'bdistmsi'\ncommand.\n\n- bpo-19891(193): Ignore errors caused by missing / non-writable\nhomedir while writing history during exit of an interactive\nsession.  Patch by Anthony Sottile.\n\n- bpo-33089(194): Enhanced math.hypot() to support more than two\ndimensions.\n\n- bpo-34228(195): tracemalloc: PYTHONTRACEMALLOC=0 environment\nvariable and -X tracemalloc=0 command line option are now allowed\nto disable explicitly tracemalloc at startup.\n\n- bpo-13041(196): Use *note shutil.getterminalsize(): f73. to\ncalculate the terminal width correctly in the\n'argparse.HelpFormatter' class.  Initial patch by Zbyszek\nJ??drzejewski-Szmek.\n\n- bpo-34213(197): Allow frozen dataclasses to have a field named\n\"object\".  Previously this conflicted with an internal use of\n\"object\".\n\n- bpo-34052(198): *note sqlite3.Connection.createaggregate(): 173e,\n*note sqlite3.Connection.createfunction(): 173f, *note\nsqlite3.Connection.setauthorizer(): 440, *note\nsqlite3.Connection.setprogresshandler(): 1740. methods raises\nTypeError when unhashable objects are passed as callable.  These\nmethods now don't pass such objects to SQLite API. Previous\nbehavior could lead to segfaults.  Patch by Sergey Fedoseev.\n\n- bpo-34197(199): Attributes 'skipinitialspace', 'doublequote' and\n'strict' of the 'dialect' attribute of the *note csv: 27. reader\nare now *note bool: 17d. instances instead of integers 0 or 1.\n\n- bpo-32788(200): Errors other than *note TypeError: 28e. raised in\nmethods 'adapt()' and 'conform()' in the *note sqlite3: c9.\nmodule are now propagated to the user.\n\n- bpo-21446(201): The *note reload: 17bf. fixer now uses *note\nimportlib.reload(): 26b. instead of deprecated 'imp.reload()'.\n\n- bpo-940286(202): pydoc's 'Helper.showtopic()' method now prints the\ncross references of a topic correctly.\n\n- bpo-34164(203): *note base64.b32decode(): e9c. could raise\nUnboundLocalError or OverflowError for incorrect padding.  Now it\nalways raises 'base64.Error' in these cases.\n\n- bpo-33729(204): Fixed issues with arguments parsing in *note\nhashlib: 63.\n\n- bpo-34097(205): ZipFile can zip files older than 1980-01-01 and\nnewer than 2107-12-31 using a new 'stricttimestamps' parameter at\nthe cost of setting the timestamp to the limit.\n\n- bpo-34108(206): Remove extraneous CR in 2to3 refactor.\n\n- bpo-34070(207): Make sure to only check if the handle is a tty,\nwhen opening a file with 'buffering=-1'.\n\n- bpo-27494(208): Reverted bpo-27494(209).  2to3 rejects now a\ntrailing comma in generator expressions.\n\n- bpo-33967(210): functools.singledispatch now raises TypeError\ninstead of IndexError when no positional arguments are passed.\n\n- bpo-34041(211): Add the parameter 'deterministic' to the *note\nsqlite3.Connection.createfunction(): 173f. method.  Patch by\nSergey Fedoseev.\n\n- bpo-34056(212): Ensure the loader shim created by 'imp.loadmodule'\nalways returns bytes from its 'getdata()' function.  This fixes\nusing 'imp.loadmodule' with PEP 552(213) hash-based pycs.\n\n- bpo-34054(214): The multiprocessing module now uses the monotonic\nclock *note time.monotonic(): ce1. instead of the system clock\n*note time.time(): 918. to implement timeout.\n\n- bpo-34043(215): Optimize tarfile uncompress performance about 15%\nwhen gzip is used.\n\n- bpo-34044(216): 'subprocess.Popen' now copies the 'startupinfo'\nargument to leave it unchanged: it will modify the copy, so that\nthe same 'STARTUPINFO' object can be used multiple times.\n\n- bpo-34010(217): Fixed a performance regression for reading streams\nwith tarfile.  The buffered read should use a list, instead of\nappending to a bytes object.\n\n- bpo-34019(218): webbrowser: Correct the arguments passed to Opera\nBrowser when opening a new URL using the 'webbrowser' module.\nPatch by Bumsik Kim.\n\n- bpo-34003(219): csv.DictReader now creates dicts instead of\nOrderedDicts.  Patch by Michael Selik.\n\n- bpo-33978(220): Closed existing logging handlers before\nreconfiguration via fileConfig and dictConfig.  Patch by\nKarthikeyan Singaravelan.\n\n- bpo-14117(221): Make minor tweaks to turtledemo.  The 'wikipedia'\nexample is now 'rosette', describing what it draws.  The 'penrose'\nprint output is reduced.  The'1024' output of 'tree' is eliminated.\n\n- bpo-33974(222): Fixed passing lists and tuples of strings\ncontaining special characters '\"', '\\', '{', '}' and '\\n' as\noptions to *note ttk: f4. widgets.\n\n- bpo-27500(223): Fix getaddrinfo to resolve IPv6 addresses\ncorrectly.\n\n- bpo-24567(224): Improve random.choices() to handle subnormal input\nweights that could occasionally trigger an IndexError.\n\n- bpo-33871(225): Fixed integer overflow in *note os.readv(): 99c,\n*note os.writev(): 99f, *note os.preadv(): 99b. and *note\nos.pwritev(): 99e. and in *note os.sendfile(): 946. with 'headers'\nor 'trailers' arguments (on BSD-based OSes and macOS).\n\n- bpo-25007(226): Add *note copy.copy(): 289. and *note\ncopy.deepcopy(): 9af. support to zlib compressors and\ndecompressors.  Patch by Zackery Spytz.\n\n- bpo-33929(227): multiprocessing: Fix a race condition in Popen of\nmultiprocessing.popenspawnwin32.  The child process now\nduplicates the read end of pipe instead of \"stealing\" it.\nPreviously, the read end of pipe was \"stolen\" by the child process,\nbut it leaked a handle if the child process had been terminated\nbefore it could steal the handle from the parent process.\n\n- bpo-33899(228): Tokenize module now implicitly emits a NEWLINE when\nprovided with input that does not have a trailing new line.  This\nbehavior now matches what the C tokenizer does internally.\nContributed by Ammar Askar.\n\n- bpo-33897(229): Added a 'force' keyword argument to\nlogging.basicConfig().\n\n- bpo-33695(230): *note shutil.copytree(): 854. uses *note\nos.scandir(): 88c. function and all copy functions depending from\nit use cached *note os.stat(): 1bf. values.  The speedup for\ncopying a directory with 8000 files is around +9% on Linux, +20% on\nWindows and + 30% on a Windows SMB share.  Also the number of *note\nos.stat(): 1bf. syscalls is reduced by 38% making *note\nshutil.copytree(): 854. especially faster on network filesystems.\n(Contributed by Giampaolo Rodola' in bpo-33695(231).)\n\n- bpo-33916(232): bz2 and lzma: When Decompressor.init() is\ncalled twice, free the old lock to not leak memory.\n\n- bpo-32568(233): Make select.epoll() and its documentation\nconsistent regarding 'sizehint' and 'flags'.\n\n- bpo-33833(234): Fixed bug in asyncio where ProactorSocketTransport\nlogs AssertionError if force closed during write.\n\n- bpo-33663(235): Convert content length to string before putting to\nheader.\n\n- bpo-33721(236): *note os.path: 9d. functions that return a boolean\nresult like *note exists(): 837, *note lexists(): 838, *note\nisdir(): 839, *note isfile(): 83a, *note islink(): 835, and *note\nismount(): 83b, and *note pathlib.Path: 149. methods that return a\nboolean result like *note exists(): 83f, *note isdir(): 840, *note\nisfile(): 841, *note ismount(): 842, *note issymlink(): 843,\n*note isblockdevice(): 844, *note ischardevice(): 845, *note\nisfifo(): 846, *note issocket(): 847. now return 'False' instead\nof raising *note ValueError: 183. or its subclasses *note\nUnicodeEncodeError: 442. and *note UnicodeDecodeError: 83c. for\npaths that contain characters or bytes unrepresentable at the OS\nlevel.\n\n- bpo-26544(237): Fixed implementation of *note platform.libcver():\n17ab.  It almost always returned version '2.9' for glibc.\n\n- bpo-33843(238): Remove deprecated 'cgi.escape', 'cgi.parseqs' and\n'cgi.parseqsl'.\n\n- bpo-33842(239): Remove 'tarfile.filemode' which is deprecated since\nPython 3.3.\n\n- bpo-30167(240): Prevent site.main() exception if PYTHONSTARTUP is\nset.  Patch by Steve Weber.\n\n- bpo-33805(241): Improve error message of dataclasses.replace() when\nan InitVar is not specified\n\n- bpo-33687(242): Fix the call to 'os.chmod()' for 'uu.decode()' if a\nmode is given or decoded.  Patch by Timo Furrer.\n\n- bpo-33812(243): Datetime instance d with non-None tzinfo, but with\nd.tzinfo.utcoffset(d) returning None is now treated as naive by the\nastimezone() method.\n\n- bpo-32108(244): In configparser, don't clear section when it is\nassigned to itself.\n\n- bpo-27397(245): Make email module properly handle invalid-length\nbase64 strings.\n\n- bpo-33578(246): Implement multibyte encoder/decoder state methods\n\n- bpo-30805(247): Avoid race condition with debug logging\n\n- bpo-33476(248): Fix headervalueparser.py when address group is\nmissing final ';'.  Contributed by Enrique Perez-Terron\n\n- bpo-33694(249): asyncio: Fix a race condition causing data loss on\npausereading()/resumereading() when using the ProactorEventLoop.\n\n- bpo-32493(250): Correct test for 'uuidencbe' availability in\n'configure.ac'.  Patch by Michael Felt.\n\n- bpo-33792(251): Add asyncio.WindowsSelectorEventLoopPolicy and\nasyncio.WindowsProactorEventLoopPolicy.\n\n- bpo-33274(252): W3C DOM Level 1 specifies return value of\nElement.removeAttributeNode() as \"The Attr node that was removed.\"\nxml.dom.minidom now complies with this requirement.\n\n- bpo-33778(253): Update 'unicodedata''s database to Unicode version\n11.0.0.\n\n- bpo-33165(254): Added a stacklevel parameter to logging calls to\nallow use of wrapper/helper functions for logging APIs.\n\n- bpo-33770(255): improve base64 exception message for encoded inputs\nof invalid length\n\n- bpo-33769(256): asyncio/starttls: Fix error message; cancel\ncallbacks in case of an unhandled error; mark SSLTransport as\nclosed if it is aborted.\n\n- bpo-33767(257): The concatenation ('+') and repetition ('*')\nsequence operations now raise *note TypeError: 28e. instead of\n*note SystemError: 2d7. when performed on *note mmap.mmap: 830.\nobjects.  Patch by Zackery Spytz.\n\n- bpo-33734(258): asyncio/ssl: Fix AttributeError, increase default\nhandshake timeout\n\n- bpo-31014(259): Fixed creating a controller for *note webbrowser:\n110. when a user specifies a path to an entry in the BROWSER\nenvironment variable.  Based on patch by John Still.\n\n- bpo-2504(260): Add gettext.pgettext() and variants.\n\n- bpo-33197(261): Add description property for ParameterKind\n\n- bpo-32751(262): When cancelling the task due to a timeout, *note\nasyncio.waitfor(): 3c8. will now wait until the cancellation is\ncomplete.\n\n- bpo-32684(263): Fix gather to propagate cancellation of itself even\nwith returnexceptions.\n\n- bpo-33654(264): Support protocol type switching in\nSSLTransport.setprotocol().\n\n- bpo-33674(265): Pause the transport as early as possible to further\nreduce the risk of datareceived() being called before\nconnectionmade().\n\n- bpo-33671(266): *note shutil.copyfile(): 886, *note shutil.copy():\n887, *note shutil.copy2(): 888, *note shutil.copytree(): 854. and\n*note shutil.move(): 889. use platform-specific fast-copy syscalls\non Linux and macOS in order to copy the file more efficiently.  On\nWindows *note shutil.copyfile(): 886. uses a bigger default buffer\nsize (1 MiB instead of 16 KiB) and a *note memoryview(): 17f.-based\nvariant of *note shutil.copyfileobj(): 88a. is used.  The speedup\nfor copying a 512MiB file is about +26% on Linux, +50% on macOS and\n+40% on Windows.  Also, much less CPU cycles are consumed.\n(Contributed by Giampaolo Rodola' in bpo-25427(267).)\n\n- bpo-33674(268): Fix a race condition in\nSSLProtocol.connectionmade() of asyncio.sslproto: start\nimmediately the handshake instead of using callsoon().\nPreviously, datareceived() could be called before the handshake\nstarted, causing the handshake to hang or fail.\n\n- bpo-31647(269): Fixed bug where calling writeeof() on a\nSelectorSocketTransport after it's already closed raises\nAttributeError.\n\n- bpo-32610(270): Make asyncio.alltasks() return only pending tasks.\n\n- bpo-32410(271): Avoid blocking on file IO in sendfile fallback code\n\n- bpo-33469(272): Fix RuntimeError after closing loop that used\nruninexecutor\n\n- bpo-33672(273): Fix Task.repr crash with Cython's bogus\ncoroutines\n\n- bpo-33654(274): Fix transport.setprotocol() to support switching\nbetween asyncio.Protocol and asyncio.BufferedProtocol.  Fix\nloop.starttls() to work with asyncio.BufferedProtocols.\n\n- bpo-33652(275): Pickles of type variables and subscripted generics\nare now future-proof and compatible with older Python versions.\n\n- bpo-32493(276): Fixed *note uuid.uuid1(): 9ec. on FreeBSD.\n\n- bpo-33238(277): Add 'InvalidStateError' to *note\nconcurrent.futures: 1f.  'Future.setresult' and\n'Future.setexception' now raise 'InvalidStateError' if the futures\nare not pending or running.  Patch by Jason Haydaman.\n\n- bpo-33618(278): Finalize and document preliminary and experimental\nTLS 1.3 support with OpenSSL 1.1.1\n\n- bpo-33625(279): Release GIL on 'grp.getgrnam', 'grp.getgrgid',\n'pwd.getpwnam' and 'pwd.getpwuid' if reentrant variants of these\nfunctions are available.  Patch by William Grzybowski.\n\n- bpo-33623(280): Fix possible SIGSGV when asyncio.Future is created\nin del\n\n- bpo-11874(281): Use a better regex when breaking usage into\nwrappable parts.  Avoids bogus assertion errors from custom metavar\nstrings.\n\n- bpo-30877(282): Fixed a bug in the Python implementation of the\nJSON decoder that prevented the cache of parsed strings from\nclearing after finishing the decoding.  Based on patch by c-fos.\n\n- bpo-33604(283): Remove HMAC default to md5 marked for removal in\n3.8 (removal originally planned in 3.6, bump to 3.8 in PR 7062).\n\n- bpo-33582(284): Emit a deprecation warning for\ninspect.formatargspec\n\n- bpo-21145(285): Add 'functools.cachedproperty' decorator, for\ncomputed properties cached for the life of the instance.\n\n- bpo-33570(286): Change TLS 1.3 cipher suite settings for\ncompatibility with OpenSSL 1.1.1-pre6 and newer.  OpenSSL 1.1.1\nwill have TLS 1.3 ciphers enabled by default.\n\n- bpo-28556(287): Do not simplify arguments to 'typing.Union'.  Now\n'Union[Manager, Employee]' is not simplified to 'Employee' at\nruntime.  Such simplification previously caused several bugs and\nlimited possibilities for introspection.\n\n- bpo-12486(288): *note tokenize.generatetokens(): 203. is now\ndocumented as a public API to tokenize unicode strings.  It was\npreviously present but undocumented.\n\n- bpo-33540(289): Add a new 'blockonclose' class attribute to\n'ForkingMixIn' and 'ThreadingMixIn' classes of *note socketserver:\nc7.\n\n- bpo-33548(290): tempfile.candidatetempdirlist should consider\ncommon TEMP locations\n\n- bpo-33109(291): argparse subparsers are once again not required by\ndefault, reverting the change in behavior introduced by\nbpo-26510(292) in 3.7.0a2.\n\n- bpo-33541(293): Remove unused private method\n'strptime.LocaleTime.pad' (a.k.a.  'LocaleTimepad').\n\n- bpo-33536(294): dataclasses.makedataclass now checks for invalid\nfield names and duplicate fields.  Also, added a check for invalid\nfield specifications.\n\n- bpo-33542(295): Prevent 'uuid.getnode' from using a DUID instead\nof a MAC on Windows.  Patch by Zvi Effron\n\n- bpo-26819(296): Fix race condition with\n'ReadTransport.resumereading' in Windows proactor event loop.\n\n- Fix failure in 'typing.gettypehints()' when ClassVar was provided\nas a string forward reference.\n\n- bpo-33516(297): *note unittest.mock.MagicMock: cf4. now supports\nthe 'round' magic method.\n\n- bpo-28612(298): Added support for Site Maps to urllib's\n'RobotFileParser' as *note RobotFileParser.sitemaps(): 17c0.\nPatch by Lady Red, based on patch by Peter Wirtz.\n\n- bpo-28167(299): Remove platform.linuxdistribution, which was\ndeprecated since 3.5.\n\n- bpo-33504(300): Switch the default dictionary implementation for\n*note configparser: 20. from *note collections.OrderedDict: 39f. to\nthe standard *note dict: 237. type.\n\n- bpo-33505(301): Optimize asyncio.ensurefuture() by reordering if\nchecks: 1.17x faster.\n\n- bpo-33497(302): Add errors param to cgi.parsemultipart and make an\nencoding in FieldStorage use the given errors (needed for Twisted).\nPatch by Amber Brown.\n\n- bpo-29235(303): The 'cProfile.Profile' class can now be used as a\ncontext manager.  Patch by Scott Sanderson.\n\n- bpo-33495(304): Change dataclasses.Fields repr to use the repr of\neach of its members, instead of str.  This makes it more clear what\neach field actually represents.  This is especially true for the\n'type' member.\n\n- bpo-26103(305): Correct 'inspect.isdatadescriptor' to look for\n'set' or 'delete'.  Patch by Aaron Hall.\n\n- bpo-29209(306): Removed the 'doctype()' method and the 'html'\nparameter of the constructor of *note XMLParser: 880.  The\n'doctype()' method defined in a subclass will no longer be called.\nDeprecated methods 'getchildren()' and 'getiterator()' in the *note\nElementTree: 120. module emit now a *note DeprecationWarning: 179.\ninstead of *note PendingDeprecationWarning: 6e0.\n\n- bpo-33453(307): Fix dataclasses to work if using literal string\ntype annotations or if using PEP 563 \"Postponed Evaluation of\nAnnotations\".  Only specific string prefixes are detected for both\nClassVar (\"ClassVar\" and \"typing.ClassVar\") and InitVar (\"InitVar\"\nand \"dataclasses.InitVar\").\n\n- bpo-28556(308): Minor fixes in typing module: add annotations to\n'NamedTuple.new', pass '*args' and 'kwds' in\n'Generic.new'.  Original PRs by Paulius ??arka and Chad\nDombrova.\n\n- bpo-33365(309): Print the header values besides the header keys\ninstead just the header keys if 'debuglevel' is set to >0 in *note\nhttp.client: 6a.  Patch by Marco Strigl.\n\n- bpo-20087(310): Updated alias mapping with glibc 2.27 supported\nlocales.\n\n- bpo-33422(311): Fix trailing quotation marks getting deleted when\nlooking up byte/string literals on pydoc.  Patch by Andre's Delfino.\n\n- bpo-28167(312): The function 'platform.linuxdistribution' and\n'platform.dist' now trigger a 'DeprecationWarning' and have been\nmarked for removal in Python 3.8\n\n- bpo-33281(313): Fix ctypes.util.findlibrary regression on macOS.\n\n- bpo-33311(314): Text and html output generated by cgitb does not\ndisplay parentheses if the current call is done directly in the\nmodule.  Patch by Ste'phane Blondon.\n\n- bpo-27300(315): The file classes in 'tempfile' now accept an\n'errors' parameter that complements the already existing\n'encoding'.  Patch by Stephan Hohe.\n\n- bpo-32933(316): *note unittest.mock.mockopen(): 1764. now supports\niteration over the file contents.  Patch by Tony Flury.\n\n- bpo-33217(317): Raise *note TypeError: 28e. when looking up\nnon-Enum objects in Enum classes and Enum members.\n\n- bpo-33197(318): Update error message when constructing invalid\ninspect.Parameters Patch by Donghee Na.\n\n- bpo-33383(319): Fixed crash in the get() method of the *note\ndbm.ndbm: 32. database object when it is called with a single\nargument.\n\n- bpo-33375(320): The warnings module now finds the Python file\nassociated with a warning from the code object, rather than the\nframe's global namespace.  This is consistent with how tracebacks\nand pdb find filenames, and should work better for dynamically\nexecuted code.\n\n- bpo-33336(321): 'imaplib' now allows 'MOVE' command in\n'IMAP4.uid()' (RFC 6851: IMAP MOVE Extension) and potentially as a\nname of supported method of 'IMAP4' object.\n\n- bpo-32455(322): Added 'jump' parameter to *note dis.stackeffect():\nda1.\n\n- bpo-27485(323): Rename and deprecate undocumented functions in\n*note urllib.parse(): 105.\n\n- bpo-33332(324): Add 'signal.validsignals()' to expose the POSIX\nsigfillset() functionality.\n\n- bpo-33251(325): 'ConfigParser.items()' was fixed so that key-value\npairs passed in via *note vars(): 17c1. are not included in the\nresulting output.\n\n- bpo-33329(326): Fix multiprocessing regression on newer glibcs\n\n- bpo-33334(327): *note dis.stackeffect(): da1. now supports all\ndefined opcodes including NOP and EXTENDEDARG.\n\n- bpo-991266(328): Fix quoting of the 'Comment' attribute of *note\nhttp.cookies.SimpleCookie: 17c2.\n\n- bpo-33131(329): Upgrade bundled version of pip to 10.0.1.\n\n- bpo-33308(330): Fixed a crash in the 'parser' module when\nconverting an ST object to a tree of tuples or lists with\n'lineinfo=False' and 'colinfo=True'.\n\n- bpo-23403(331): lib2to3 now uses pickle protocol 4 for pre-computed\ngrammars.\n\n- bpo-33266(332): lib2to3 now recognizes 'rf'...'' strings.\n\n- bpo-11594(333): Ensure line-endings are respected when using\nlib2to3.\n\n- bpo-33254(334): Have *note importlib.resources.contents(): 4f9. and\n*note importlib.abc.ResourceReader.contents(): 17c3. return an\n*note iterable: 109d. instead of an *note iterator: 16a9.\n\n- bpo-33265(335): 'contextlib.ExitStack' and\n'contextlib.AsyncExitStack' now use a method instead of a wrapper\nfunction for exit callbacks.\n\n- bpo-33263(336): Fix FD leak in 'SelectorSocketTransport' Patch by\nVlad Starostin.\n\n- bpo-33256(337): Fix display of '<module>' call in the html produced\nby 'cgitb.html()'.  Patch by Ste'phane Blondon.\n\n- bpo-33144(338): 'random.Random()' and its subclassing mechanism got\noptimized to check only once at class/subclass instantiation time\nwhether its 'getrandbits()' method can be relied on by other\nmethods, including 'randrange()', for the generation of arbitrarily\nlarge random integers.  Patch by Wolfgang Maier.\n\n- bpo-33185(339): Fixed regression when running pydoc with the *note\n-m: 3a5. switch.  (The regression was introduced in 3.7.0b3 by the\nresolution of bpo-33053(340))\n\nThis fix also changed pydoc to add 'os.getcwd()' to *note sys.path:\n32c. when necessary, rather than adding '\".\"'.\n\n- bpo-29613(341): Added support for the 'SameSite' cookie flag to the\n'http.cookies' module.\n\n- bpo-33169(342): Delete entries of 'None' in *note\nsys.pathimportercache: 3a9. when\n'importlib.machinery.invalidatecaches()' is called.\n\n- bpo-33203(343): 'random.Random.choice()' now raises 'IndexError'\nfor empty sequences consistently even when called from subclasses\nwithout a 'getrandbits()' implementation.\n\n- bpo-33224(344): Update difflib.mdiff() for PEP 479(345).  Convert\nan uncaught StopIteration in a generator into a return-statement.\n\n- bpo-33209(346): End framing at the end of C implementation of *note\npickle.Pickler.dump(): 17c4.\n\n- bpo-32861(347): The urllib.robotparser's 'str' representation\nnow includes wildcard entries and the \"Crawl-delay\" and\n\"Request-rate\" fields.  Also removes extra newlines that were being\nappended to the end of the string.  Patch by Michael Lazar.\n\n- bpo-23403(348): 'DEFAULTPROTOCOL' in *note pickle: a1. was bumped\nto 4.  Protocol 4 is described in PEP 3154(349) and available since\nPython 3.4.  It offers better performance and smaller size compared\nto protocol 3 introduced in Python 3.0.\n\n- bpo-20104(350): Improved error handling and fixed a reference leak\nin *note os.posixspawn(): 885.\n\n- bpo-33106(351): Deleting a key from a read-only dbm database raises\nmodule specific error instead of KeyError.\n\n- bpo-33175(352): In dataclasses, Field.setname now looks up the\nsetname special method on the class, not the instance, of the\ndefault value.\n\n- bpo-32380(353): Create functools.singledispatchmethod to support\ngeneric single dispatch on descriptors and methods.\n\n- bpo-33141(354): Have Field objects pass through setname to\ntheir default values, if they have their own setname.\n\n- bpo-33096(355): Allow ttk.Treeview.insert to insert iid that has a\nfalse boolean value.  Note iid=0 and iid=False would be same.\nPatch by Garvit Khatri.\n\n- bpo-32873(356): Treat type variables and special typing forms as\nimmutable by copy and pickle.  This fixes several minor issues and\ninconsistencies, and improves backwards compatibility with Python\n3.6.\n\n- bpo-33134(357): When computing dataclass's hash, use the lookup\ntable to contain the function which returns the hash value.\nThis is an improvement over looking up a string, and then testing\nthat string to see what to do.\n\n- bpo-33127(358): The ssl module now compiles with LibreSSL 2.7.1.\n\n- bpo-32505(359): Raise TypeError if a member variable of a dataclass\nis of type Field, but doesn't have a type annotation.\n\n- bpo-33078(360): Fix the failure on OSX caused by the tests relying\non semgetvalue\n\n- bpo-33116(361): Add 'Field' to dataclasses.all.\n\n- bpo-32896(362): Fix an error where subclassing a dataclass with a\nfield that uses a defaultfactory would generate an incorrect\nclass.\n\n- bpo-33100(363): Dataclasses: If a field has a default value that's\na MemberDescriptorType, then it's from that field being in\nslots, not an actual default value.\n\n- bpo-32953(364): If a non-dataclass inherits from a frozen\ndataclass, allow attributes to be added to the derived class.  Only\nattributes from the frozen dataclass cannot be assigned to.\nRequire all dataclasses in a hierarchy to be either all frozen or\nall non-frozen.\n\n- bpo-33097(365): Raise RuntimeError when 'executor.submit' is called\nduring interpreter shutdown.\n\n- bpo-32968(366): Modulo and floor division involving Fraction and\nfloat should return float.\n\n- bpo-33061(367): Add missing 'NoReturn' to 'all' in typing.py\n\n- bpo-33078(368): Fix the size handling in multiprocessing.Queue when\na pickling error occurs.\n\n- bpo-33064(369): lib2to3 now properly supports trailing commas after\n'*args' and 'kwargs' in function signatures.\n\n- bpo-33056(370): FIX properly close leaking fds in\nconcurrent.futures.ProcessPoolExecutor.\n\n- bpo-33021(371): Release the GIL during fstat() calls, avoiding hang\nof all threads when calling mmap.mmap(), os.urandom(), and\nrandom.seed().  Patch by Nir Soffer.\n\n- bpo-31804(372): Avoid failing in multiprocessing.Process if the\nstandard streams are closed or None at exit.\n\n- bpo-33034(373): Providing an explicit error message when casting\nthe port property to anything that is not an integer value using\n'urlparse()' and 'urlsplit()'.  Patch by Matt Eaton.\n\n- bpo-30249(374): Improve struct.unpackfrom() exception messages for\nproblems with the buffer size and offset.\n\n- bpo-33037(375): Skip sending/receiving data after SSL transport\nclosing.\n\n- bpo-27683(376): Fix a regression in *note ipaddress: 7a. that\nresult of 'hosts()' is empty when the network is constructed by a\ntuple containing an integer mask and only 1 bit left for addresses.\n\n- bpo-22674(377): Add the strsignal() function in the signal module\nthat returns the system description of the given signal, as\nreturned by strsignal(3).\n\n- bpo-32999(378): Fix C implementation of 'ABC.subclasscheck(cls,\nsubclass)' crashed when 'subclass' is not a type object.\n\n- bpo-33009(379): Fix inspect.signature() for single-parameter\npartialmethods.\n\n- bpo-32969(380): Expose several missing constants in zlib and fix\ncorresponding documentation.\n\n- bpo-32056(381): Improved exceptions raised for invalid number of\nchannels and sample width when read an audio file in modules *note\naifc: 5, *note wave: 10e. and *note sunau: d1.\n\n- bpo-32970(382): Improved disassembly of the MAKEFUNCTION\ninstruction.\n\n- bpo-32844(383): Fix wrong redirection of a low descriptor (0 or 1)\nto stderr in subprocess if another low descriptor is closed.\n\n- bpo-32960(384): For dataclasses, disallow inheriting frozen from\nnon-frozen classes, and also disallow inheriting non-frozen from\nfrozen classes.  This restriction will be relaxed at a future date.\n\n- bpo-32713(385): Fixed tarfile.itn handling of out-of-bounds float\nvalues.  Patch by Joffrey Fuhrer.\n\n- bpo-32257(386): The ssl module now contains OPNORENEGOTIATION\nconstant, available with OpenSSL 1.1.0h or 1.1.1.\n\n- bpo-32951(387): Direct instantiation of SSLSocket and SSLObject\nobjects is now prohibited.  The constructors were never documented,\ntested, or designed as public constructors.  Users were suppose to\nuse ssl.wrapsocket() or SSLContext.\n\n- bpo-32929(388): Remove the tri-state parameter \"hash\", and add the\nboolean \"unsafehash\".  If unsafehash is True, add a hash\nfunction, but if a hash exists, raise TypeError.  If\nunsafehash is False, add a hash based on the values of eq= and\nfrozen=.  The unsafehash=False behavior is the same as the old\nhash=None behavior.  unsafehash=False is the default, just as\nhash=None used to be.\n\n- bpo-32947(389): Add OPENABLEMIDDLEBOXCOMPAT and test workaround\nfor TLSv1.3 for future compatibility with OpenSSL 1.1.1.\n\n- bpo-32146(390): Document the interaction between frozen executables\nand the spawn and forkserver start methods in multiprocessing.\n\n- bpo-30622(391): The ssl module now detects missing NPN support in\nLibreSSL.\n\n- bpo-32922(392): dbm.open() now encodes filename with the filesystem\nencoding rather than default encoding.\n\n- bpo-32759(393): Free unused arenas in multiprocessing.heap.\n\n- bpo-32859(394): In 'os.dup2', don't check every call whether the\n'dup3' syscall exists or not.\n\n- bpo-32556(395): nt.getfinalpathname, nt.getvolumepathname and\nnt.getdiskusage now correctly convert from bytes.\n\n- bpo-21060(396): Rewrite confusing message from setup.py upload from\n\"No dist file created in earlier command\" to the more helpful \"Must\ncreate and upload files in one command\".\n\n- bpo-32857(397): In *note tkinter: ea, 'aftercancel(None)' now\nraises a *note ValueError: 183. instead of canceling the first\nscheduled function.  Patch by Cheryl Sabella.\n\n- bpo-32852(398): Make sure sys.argv remains as a list when running\ntrace.\n\n- bpo-31333(399): 'abc' module is added.  It is a speedup module\nwith C implementations for various functions and methods in 'abc'.\nCreating an ABC subclass and calling 'isinstance' or 'issubclass'\nwith an ABC subclass are up to 1.5x faster.  In addition, this\nmakes Python start-up up to 10% faster.\n\nNote that the new implementation hides internal registry and\ncaches, previously accessible via private attributes\n'abcregistry', 'abccache', and 'abcnegativecache'.  There\nare three debugging helper methods that can be used instead\n'dumpregistry', 'abcregistryclear', and 'abccachesclear'.\n\n- bpo-32841(400): Fixed 'asyncio.Condition' issue which silently\nignored cancellation after notifying and cancelling a conditional\nlock.  Patch by Bar Harel.\n\n- bpo-32819(401): ssl.matchhostname() has been simplified and no\nlonger depends on re and ipaddress module for wildcard and IP\naddresses.  Error reporting for invalid wildcards has been\nimproved.\n\n- bpo-19675(402): 'multiprocessing.Pool' no longer leaks processes if\nits initialization fails.\n\n- bpo-32394(403): socket: Remove\nTCPFASTOPEN,TCPKEEPCNT,TCPKEEPIDLE,TCPKEEPINTVL flags on older\nversion Windows during run-time.\n\n- bpo-31787(404): Fixed refleaks of 'init()' methods in various\nmodules.  (Contributed by Oren Milman)\n\n- bpo-30157(405): Fixed guessing quote and delimiter in\ncsv.Sniffer.sniff() when only the last field is quoted.  Patch by\nJake Davis.\n\n- bpo-30688(406): Added support of '\\N{name}' escapes in regular\nexpressions.  Based on patch by Jonathan Eunice.\n\n- bpo-32792(407): collections.ChainMap() preserves the order of the\nunderlying mappings.\n\n- bpo-32775(408): *note fnmatch.translate(): 17c5. no longer produces\npatterns which contain set operations.  Sets starting with '[' or\ncontaining '-', '&&', '~~' or '||' will be interpreted differently\nin regular expressions in future versions.  Currently they emit\nwarnings.  fnmatch.translate() now avoids producing patterns\ncontaining such sets by accident.\n\n- bpo-32622(409): Implement native fast sendfile for Windows proactor\nevent loop.\n\n- bpo-32777(410): Fix a rare but potential pre-exec child process\ndeadlock in subprocess on POSIX systems when marking file\ndescriptors inheritable on exec in the child process.  This bug\nappears to have been introduced in 3.4.\n\n- bpo-32647(411): The ctypes module used to depend on indirect\nlinking for dlopen.  The shared extension is now explicitly linked\nagainst libdl on platforms with dl.\n\n- bpo-32749(412): A *note dbm.dumb: 30. database opened with flags\n'r' is now read-only.  *note dbm.dumb.open(): 8c8. with flags 'r'\nand 'w' no longer creates a database if it does not exist.\n\n- bpo-32741(413): Implement 'asyncio.TimerHandle.when()' method.\n\n- bpo-32691(414): Use modspec.parent when running modules with pdb\n\n- bpo-32734(415): Fixed 'asyncio.Lock()' safety issue which allowed\nacquiring and locking the same lock multiple times, without it\nbeing free.  Patch by Bar Harel.\n\n- bpo-32727(416): Do not include name field in SMTP envelope from\naddress.  Patch by Ste'phane Wirtel\n\n- bpo-31453(417): Add TLSVersion constants and\nSSLContext.maximumversion / minimumversion attributes.  The new\nAPI wraps OpenSSL 1.1\n'https://web.archive.org/web/20180309043602/https://www.openssl.org/docs/man1.1.0/ssl/SSLCTXsetminprotoversion.html'\nfeature.\n\n- bpo-24334(418): Internal implementation details of ssl module were\ncleaned up.  The SSLSocket has one less layer of indirection.\nOwner and session information are now handled by the SSLSocket and\nSSLObject constructor.  Channel binding implementation has been\nsimplified.\n\n- bpo-31848(419): Fix the error handling in Aifcread.initfp() when\nthe SSND chunk is not found.  Patch by Zackery Spytz.\n\n- bpo-32585(420): Add Ttk spinbox widget to *note tkinter.ttk: f4.\nPatch by Alan D Moore.\n\n- bpo-32512(421): *note profile: aa. CLI accepts '-m modulename' as\nan alternative to script path.\n\n- bpo-8525(422): help() on a type now displays builtin subclasses.\nThis is intended primarily to help with notification of more\nspecific exception subclasses.\n\nPatch by Sanyam Khurana.\n\n- bpo-31639(423): http.server now exposes a ThreadingHTTPServer class\nand uses it when the module is run with '-m' to cope with web\nbrowsers pre-opening sockets.\n\n- bpo-29877(424): compileall: import ProcessPoolExecutor only when\nneeded, preventing hangs on low resource platforms\n\n- bpo-32221(425): Various functions returning tuple containing IPv6\naddresses now omit '%scope' part since the same information is\nalready encoded in 'scopeid' tuple item.  Especially this speeds up\n'socket.recvfrom()' when it receives multicast packet since useless\nresolving of network interface name is omitted.\n\n- bpo-32147(426): *note binascii.unhexlify(): 17c6. is now up to 2\ntimes faster.  Patch by Sergey Fedoseev.\n\n- bpo-30693(427): The TarFile class now recurses directories in a\nreproducible way.\n\n- bpo-30693(428): The ZipFile class now recurses directories in a\nreproducible way.\n\n- bpo-31680(429): Added *note curses.ncursesversion: 80d.\n\n- bpo-31908(430): Fix output of cover files for 'trace' module\ncommand-line tool.  Previously emitted cover files only when\n'--missing' option was used.  Patch by Michael Selik.\n\n- bpo-31608(431): Raise a 'TypeError' instead of crashing if a\n'collections.deque' subclass returns a non-deque from 'new'.\nPatch by Oren Milman.\n\n- bpo-31425(432): Add support for sockets of the AFQIPCRTR address\nfamily, supported by the Linux kernel.  This is used to communicate\nwith services, such as GPS or radio, running on Qualcomm devices.\nPatch by Bjorn Andersson.\n\n- bpo-22005(433): Implemented unpickling instances of *note datetime:\n222, *note date: 70f. and *note time: 6a5. pickled by Python 2.\n'encoding='latin1'' should be used for successful decoding.\n\n- bpo-27645(434): *note sqlite3.Connection: 1d9. now exposes a *note\nbackup: 9bb. method, if the underlying SQLite library is at version\n3.6.11 or higher.  Patch by Lele Gaifax.\n\n- bpo-16865(435): Support arrays >=2GiB in *note ctypes: 28.  Patch\nby Segev Finer.\n\n- bpo-31508(436): Removed support of arguments in\n'tkinter.ttk.Treeview.selection'.  It was deprecated in 3.6.  Use\nspecialized methods like 'selectionset' for changing the\nselection.\n\n- bpo-29456(437): Fix bugs in hangul normalization: u1176, u11a7 and\nu11c3\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=35845\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=35864\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=35537\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=35847\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=35813\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=35780\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=35537\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=23846\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=34323\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=35674\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=35733\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=35726\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=35719\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=35717\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=35699\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=32710\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=35702\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=32710\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=35682\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=35283\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=35664\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=35643\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=35619\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=28503\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=35614\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=35568\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=35588\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=35585\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=30561\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=35537\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=35526\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=35523\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=31784\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=35513\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=35502\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=35348\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=35491\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=35477\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=31446\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=35471\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=23057\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=35052\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=20239\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=17185\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=35445\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=35415\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=35424\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=35330\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=35346\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=10496\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=10496\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=35389\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=35394\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=35310\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=35380\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=35341\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=35371\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=35346\n\n(59) https://bugs.python.org/issue?@action=redirect&bpo=35066\n\n(60) https://bugs.python.org/issue?@action=redirect&bpo=35345\n\n(61) https://bugs.python.org/issue?@action=redirect&bpo=35344\n\n(62) https://bugs.python.org/issue?@action=redirect&bpo=35312\n\n(63) https://bugs.python.org/issue?@action=redirect&bpo=35308\n\n(64) https://bugs.python.org/issue?@action=redirect&bpo=24746\n\n(65) https://bugs.python.org/issue?@action=redirect&bpo=28604\n\n(66) https://bugs.python.org/issue?@action=redirect&bpo=35277\n\n(67) https://bugs.python.org/issue?@action=redirect&bpo=24209\n\n(68) https://bugs.python.org/issue?@action=redirect&bpo=35226\n\n(69) https://bugs.python.org/issue?@action=redirect&bpo=29564\n\n(70) https://bugs.python.org/issue?@action=redirect&bpo=35189\n\n(71) https://bugs.python.org/issue?@action=redirect&bpo=30064\n\n(72) https://bugs.python.org/issue?@action=redirect&bpo=35186\n\n(73) https://bugs.python.org/issue?@action=redirect&bpo=35152\n\n(74) https://bugs.python.org/issue?@action=redirect&bpo=35062\n\n(75) https://bugs.python.org/issue?@action=redirect&bpo=35065\n\n(76) https://bugs.python.org/issue?@action=redirect&bpo=34160\n\n(77) https://bugs.python.org/issue?@action=redirect&bpo=35079\n\n(78) https://bugs.python.org/issue?@action=redirect&bpo=33710\n\n(79) https://bugs.python.org/issue?@action=redirect&bpo=35017\n\n(80) https://bugs.python.org/issue?@action=redirect&bpo=35024\n\n(81) https://bugs.python.org/issue?@action=redirect&bpo=35047\n\n(82) https://bugs.python.org/issue?@action=redirect&bpo=31047\n\n(83) https://bugs.python.org/issue?@action=redirect&bpo=35053\n\n(84) https://bugs.python.org/issue?@action=redirect&bpo=31553\n\n(85) https://bugs.python.org/issue?@action=redirect&bpo=34794\n\n(86) https://bugs.python.org/issue?@action=redirect&bpo=34909\n\n(87) https://bugs.python.org/issue?@action=redirect&bpo=35022\n\n(88) https://bugs.python.org/issue?@action=redirect&bpo=35008\n\n(89) https://bugs.python.org/issue?@action=redirect&bpo=23420\n\n(90) https://bugs.python.org/issue?@action=redirect&bpo=33947\n\n(91) https://bugs.python.org/issue?@action=redirect&bpo=34890\n\n(92) https://bugs.python.org/issue?@action=redirect&bpo=34521\n\n(93) https://datatracker.ietf.org/doc/html/rfc3542.html\n\n(94) https://bugs.python.org/issue?@action=redirect&bpo=31522\n\n(95) https://bugs.python.org/issue?@action=redirect&bpo=34970\n\n(96) https://bugs.python.org/issue?@action=redirect&bpo=34969\n\n(97) https://bugs.python.org/issue?@action=redirect&bpo=16965\n\n(98) https://bugs.python.org/issue?@action=redirect&bpo=34966\n\n(99) https://bugs.python.org/issue?@action=redirect&bpo=34926\n\n(100) https://bugs.python.org/issue?@action=redirect&bpo=23831\n\n(101) https://bugs.python.org/issue?@action=redirect&bpo=34941\n\n(102) https://bugs.python.org/issue?@action=redirect&bpo=32680\n\n(103) https://bugs.python.org/issue?@action=redirect&bpo=34769\n\n(104) https://bugs.python.org/issue?@action=redirect&bpo=34936\n\n(105) https://bugs.python.org/issue?@action=redirect&bpo=34829\n\n(106) https://bugs.python.org/issue?@action=redirect&bpo=34911\n\n(107) https://bugs.python.org/issue?@action=redirect&bpo=34922\n\n(108) https://bugs.python.org/issue?@action=redirect&bpo=34925\n\n(109) https://bugs.python.org/issue?@action=redirect&bpo=34900\n\n(110) https://bugs.python.org/issue?@action=redirect&bpo=34844\n\n(111) https://bugs.python.org/issue?@action=redirect&bpo=34897\n\n(112) https://bugs.python.org/issue?@action=redirect&bpo=34871\n\n(113) https://bugs.python.org/issue?@action=redirect&bpo=34898\n\n(114) https://bugs.python.org/issue?@action=redirect&bpo=28441\n\n(115) https://bugs.python.org/issue?@action=redirect&bpo=34866\n\n(116) https://bugs.python.org/issue?@action=redirect&bpo=34711\n\n(117) https://bugs.python.org/issue?@action=redirect&bpo=34872\n\n(118) https://bugs.python.org/issue?@action=redirect&bpo=34849\n\n(119) https://bugs.python.org/issue?@action=redirect&bpo=34022\n\n(120) https://bugs.python.org/issue?@action=redirect&bpo=34819\n\n(121) https://bugs.python.org/issue?@action=redirect&bpo=34758\n\n(122) https://bugs.python.org/issue?@action=redirect&bpo=34789\n\n(123) https://bugs.python.org/issue?@action=redirect&bpo=34334\n\n(124) https://bugs.python.org/issue?@action=redirect&bpo=34687\n\n(125) https://bugs.python.org/issue?@action=redirect&bpo=5950\n\n(126) https://bugs.python.org/issue?@action=redirect&bpo=32892\n\n(127) https://bugs.python.org/issue?@action=redirect&bpo=34728\n\n(128) https://bugs.python.org/issue?@action=redirect&bpo=34738\n\n(129) https://bugs.python.org/issue?@action=redirect&bpo=34659\n\n(130) https://bugs.python.org/issue?@action=redirect&bpo=29577\n\n(131) https://bugs.python.org/issue?@action=redirect&bpo=34670\n\n(132) https://bugs.python.org/issue?@action=redirect&bpo=32718\n\n(133) https://bugs.python.org/issue?@action=redirect&bpo=31177\n\n(134) https://bugs.python.org/issue?@action=redirect&bpo=34672\n\n(135) https://bugs.python.org/issue?@action=redirect&bpo=34666\n\n(136) https://bugs.python.org/issue?@action=redirect&bpo=6721\n\n(137) https://bugs.python.org/issue?@action=redirect&bpo=34658\n\n(138) https://bugs.python.org/issue?@action=redirect&bpo=34652\n\n(139) https://bugs.python.org/issue?@action=redirect&bpo=34638\n\n(140) https://bugs.python.org/issue?@action=redirect&bpo=34536\n\n(141) https://bugs.python.org/issue?@action=redirect&bpo=34636\n\n(142) https://bugs.python.org/issue?@action=redirect&bpo=24412\n\n(143) https://bugs.python.org/issue?@action=redirect&bpo=34630\n\n(144) https://bugs.python.org/issue?@action=redirect&bpo=32490\n\n(145) https://bugs.python.org/issue?@action=redirect&bpo=34363\n\n(146) https://bugs.python.org/issue?@action=redirect&bpo=34625\n\n(147) https://bugs.python.org/issue?@action=redirect&bpo=32270\n\n(148) https://bugs.python.org/issue?@action=redirect&bpo=34622\n\n(149) https://bugs.python.org/issue?@action=redirect&bpo=34610\n\n(150) https://bugs.python.org/issue?@action=redirect&bpo=34421\n\n(151) https://bugs.python.org/issue?@action=redirect&bpo=34604\n\n(152) https://bugs.python.org/issue?@action=redirect&bpo=30977\n\n(153) https://bugs.python.org/issue?@action=redirect&bpo=34574\n\n(154) https://bugs.python.org/issue?@action=redirect&bpo=8110\n\n(155) https://bugs.python.org/issue?@action=redirect&bpo=34530\n\n(156) https://bugs.python.org/issue?@action=redirect&bpo=34563\n\n(157) https://bugs.python.org/issue?@action=redirect&bpo=34558\n\n(158) https://bugs.python.org/issue?@action=redirect&bpo=34282\n\n(159) https://bugs.python.org/issue?@action=redirect&bpo=22872\n\n(160) https://bugs.python.org/issue?@action=redirect&bpo=34515\n\n(161) https://peps.python.org/pep-3131/\n\n(162) https://bugs.python.org/issue?@action=redirect&bpo=13312\n\n(163) https://bugs.python.org/issue?@action=redirect&bpo=34472\n\n(164) https://bugs.python.org/issue?@action=redirect&bpo=34454\n\n(165) https://bugs.python.org/issue?@action=redirect&bpo=6700\n\n(166) https://bugs.python.org/issue?@action=redirect&bpo=34171\n\n(167) https://bugs.python.org/issue?@action=redirect&bpo=34441\n\n(168) https://bugs.python.org/issue?@action=redirect&bpo=34427\n\n(169) https://bugs.python.org/issue?@action=redirect&bpo=34412\n\n(170) https://bugs.python.org/issue?@action=redirect&bpo=20849\n\n(171) https://bugs.python.org/issue?@action=redirect&bpo=31715\n\n(172) https://bugs.python.org/issue?@action=redirect&bpo=34384\n\n(173) https://bugs.python.org/issue?@action=redirect&bpo=22602\n\n(174) https://bugs.python.org/issue?@action=redirect&bpo=2122\n\n(175) https://bugs.python.org/issue?@action=redirect&bpo=34341\n\n(176) https://bugs.python.org/issue?@action=redirect&bpo=34333\n\n(177) https://bugs.python.org/issue?@action=redirect&bpo=18540\n\n(178) https://bugs.python.org/issue?@action=redirect&bpo=26502\n\n(179) https://bugs.python.org/issue?@action=redirect&bpo=34318\n\n(180) https://bugs.python.org/issue?@action=redirect&bpo=9372\n\n(181) https://bugs.python.org/issue?@action=redirect&bpo=33613\n\n(182) https://bugs.python.org/issue?@action=redirect&bpo=34248\n\n(183) https://bugs.python.org/issue?@action=redirect&bpo=33089\n\n(184) https://bugs.python.org/issue?@action=redirect&bpo=34246\n\n(185) https://bugs.python.org/issue?@action=redirect&bpo=31047\n\n(186) https://bugs.python.org/issue?@action=redirect&bpo=32321\n\n(187) https://bugs.python.org/issue?@action=redirect&bpo=34270\n\n(188) https://bugs.python.org/issue?@action=redirect&bpo=34263\n\n(189) https://bugs.python.org/issue?@action=redirect&bpo=34035\n\n(190) https://bugs.python.org/issue?@action=redirect&bpo=32215\n\n(191) https://bugs.python.org/issue?@action=redirect&bpo=34075\n\n(192) https://bugs.python.org/issue?@action=redirect&bpo=34251\n\n(193) https://bugs.python.org/issue?@action=redirect&bpo=19891\n\n(194) https://bugs.python.org/issue?@action=redirect&bpo=33089\n\n(195) https://bugs.python.org/issue?@action=redirect&bpo=34228\n\n(196) https://bugs.python.org/issue?@action=redirect&bpo=13041\n\n(197) https://bugs.python.org/issue?@action=redirect&bpo=34213\n\n(198) https://bugs.python.org/issue?@action=redirect&bpo=34052\n\n(199) https://bugs.python.org/issue?@action=redirect&bpo=34197\n\n(200) https://bugs.python.org/issue?@action=redirect&bpo=32788\n\n(201) https://bugs.python.org/issue?@action=redirect&bpo=21446\n\n(202) https://bugs.python.org/issue?@action=redirect&bpo=940286\n\n(203) https://bugs.python.org/issue?@action=redirect&bpo=34164\n\n(204) https://bugs.python.org/issue?@action=redirect&bpo=33729\n\n(205) https://bugs.python.org/issue?@action=redirect&bpo=34097\n\n(206) https://bugs.python.org/issue?@action=redirect&bpo=34108\n\n(207) https://bugs.python.org/issue?@action=redirect&bpo=34070\n\n(208) https://bugs.python.org/issue?@action=redirect&bpo=27494\n\n(209) https://bugs.python.org/issue?@action=redirect&bpo=27494\n\n(210) https://bugs.python.org/issue?@action=redirect&bpo=33967\n\n(211) https://bugs.python.org/issue?@action=redirect&bpo=34041\n\n(212) https://bugs.python.org/issue?@action=redirect&bpo=34056\n\n(213) https://peps.python.org/pep-0552/\n\n(214) https://bugs.python.org/issue?@action=redirect&bpo=34054\n\n(215) https://bugs.python.org/issue?@action=redirect&bpo=34043\n\n(216) https://bugs.python.org/issue?@action=redirect&bpo=34044\n\n(217) https://bugs.python.org/issue?@action=redirect&bpo=34010\n\n(218) https://bugs.python.org/issue?@action=redirect&bpo=34019\n\n(219) https://bugs.python.org/issue?@action=redirect&bpo=34003\n\n(220) https://bugs.python.org/issue?@action=redirect&bpo=33978\n\n(221) https://bugs.python.org/issue?@action=redirect&bpo=14117\n\n(222) https://bugs.python.org/issue?@action=redirect&bpo=33974\n\n(223) https://bugs.python.org/issue?@action=redirect&bpo=27500\n\n(224) https://bugs.python.org/issue?@action=redirect&bpo=24567\n\n(225) https://bugs.python.org/issue?@action=redirect&bpo=33871\n\n(226) https://bugs.python.org/issue?@action=redirect&bpo=25007\n\n(227) https://bugs.python.org/issue?@action=redirect&bpo=33929\n\n(228) https://bugs.python.org/issue?@action=redirect&bpo=33899\n\n(229) https://bugs.python.org/issue?@action=redirect&bpo=33897\n\n(230) https://bugs.python.org/issue?@action=redirect&bpo=33695\n\n(231) https://bugs.python.org/issue?@action=redirect&bpo=33695\n\n(232) https://bugs.python.org/issue?@action=redirect&bpo=33916\n\n(233) https://bugs.python.org/issue?@action=redirect&bpo=32568\n\n(234) https://bugs.python.org/issue?@action=redirect&bpo=33833\n\n(235) https://bugs.python.org/issue?@action=redirect&bpo=33663\n\n(236) https://bugs.python.org/issue?@action=redirect&bpo=33721\n\n(237) https://bugs.python.org/issue?@action=redirect&bpo=26544\n\n(238) https://bugs.python.org/issue?@action=redirect&bpo=33843\n\n(239) https://bugs.python.org/issue?@action=redirect&bpo=33842\n\n(240) https://bugs.python.org/issue?@action=redirect&bpo=30167\n\n(241) https://bugs.python.org/issue?@action=redirect&bpo=33805\n\n(242) https://bugs.python.org/issue?@action=redirect&bpo=33687\n\n(243) https://bugs.python.org/issue?@action=redirect&bpo=33812\n\n(244) https://bugs.python.org/issue?@action=redirect&bpo=32108\n\n(245) https://bugs.python.org/issue?@action=redirect&bpo=27397\n\n(246) https://bugs.python.org/issue?@action=redirect&bpo=33578\n\n(247) https://bugs.python.org/issue?@action=redirect&bpo=30805\n\n(248) https://bugs.python.org/issue?@action=redirect&bpo=33476\n\n(249) https://bugs.python.org/issue?@action=redirect&bpo=33694\n\n(250) https://bugs.python.org/issue?@action=redirect&bpo=32493\n\n(251) https://bugs.python.org/issue?@action=redirect&bpo=33792\n\n(252) https://bugs.python.org/issue?@action=redirect&bpo=33274\n\n(253) https://bugs.python.org/issue?@action=redirect&bpo=33778\n\n(254) https://bugs.python.org/issue?@action=redirect&bpo=33165\n\n(255) https://bugs.python.org/issue?@action=redirect&bpo=33770\n\n(256) https://bugs.python.org/issue?@action=redirect&bpo=33769\n\n(257) https://bugs.python.org/issue?@action=redirect&bpo=33767\n\n(258) https://bugs.python.org/issue?@action=redirect&bpo=33734\n\n(259) https://bugs.python.org/issue?@action=redirect&bpo=31014\n\n(260) https://bugs.python.org/issue?@action=redirect&bpo=2504\n\n(261) https://bugs.python.org/issue?@action=redirect&bpo=33197\n\n(262) https://bugs.python.org/issue?@action=redirect&bpo=32751\n\n(263) https://bugs.python.org/issue?@action=redirect&bpo=32684\n\n(264) https://bugs.python.org/issue?@action=redirect&bpo=33654\n\n(265) https://bugs.python.org/issue?@action=redirect&bpo=33674\n\n(266) https://bugs.python.org/issue?@action=redirect&bpo=33671\n\n(267) https://bugs.python.org/issue?@action=redirect&bpo=25427\n\n(268) https://bugs.python.org/issue?@action=redirect&bpo=33674\n\n(269) https://bugs.python.org/issue?@action=redirect&bpo=31647\n\n(270) https://bugs.python.org/issue?@action=redirect&bpo=32610\n\n(271) https://bugs.python.org/issue?@action=redirect&bpo=32410\n\n(272) https://bugs.python.org/issue?@action=redirect&bpo=33469\n\n(273) https://bugs.python.org/issue?@action=redirect&bpo=33672\n\n(274) https://bugs.python.org/issue?@action=redirect&bpo=33654\n\n(275) https://bugs.python.org/issue?@action=redirect&bpo=33652\n\n(276) https://bugs.python.org/issue?@action=redirect&bpo=32493\n\n(277) https://bugs.python.org/issue?@action=redirect&bpo=33238\n\n(278) https://bugs.python.org/issue?@action=redirect&bpo=33618\n\n(279) https://bugs.python.org/issue?@action=redirect&bpo=33625\n\n(280) https://bugs.python.org/issue?@action=redirect&bpo=33623\n\n(281) https://bugs.python.org/issue?@action=redirect&bpo=11874\n\n(282) https://bugs.python.org/issue?@action=redirect&bpo=30877\n\n(283) https://bugs.python.org/issue?@action=redirect&bpo=33604\n\n(284) https://bugs.python.org/issue?@action=redirect&bpo=33582\n\n(285) https://bugs.python.org/issue?@action=redirect&bpo=21145\n\n(286) https://bugs.python.org/issue?@action=redirect&bpo=33570\n\n(287) https://bugs.python.org/issue?@action=redirect&bpo=28556\n\n(288) https://bugs.python.org/issue?@action=redirect&bpo=12486\n\n(289) https://bugs.python.org/issue?@action=redirect&bpo=33540\n\n(290) https://bugs.python.org/issue?@action=redirect&bpo=33548\n\n(291) https://bugs.python.org/issue?@action=redirect&bpo=33109\n\n(292) https://bugs.python.org/issue?@action=redirect&bpo=26510\n\n(293) https://bugs.python.org/issue?@action=redirect&bpo=33541\n\n(294) https://bugs.python.org/issue?@action=redirect&bpo=33536\n\n(295) https://bugs.python.org/issue?@action=redirect&bpo=33542\n\n(296) https://bugs.python.org/issue?@action=redirect&bpo=26819\n\n(297) https://bugs.python.org/issue?@action=redirect&bpo=33516\n\n(298) https://bugs.python.org/issue?@action=redirect&bpo=28612\n\n(299) https://bugs.python.org/issue?@action=redirect&bpo=28167\n\n(300) https://bugs.python.org/issue?@action=redirect&bpo=33504\n\n(301) https://bugs.python.org/issue?@action=redirect&bpo=33505\n\n(302) https://bugs.python.org/issue?@action=redirect&bpo=33497\n\n(303) https://bugs.python.org/issue?@action=redirect&bpo=29235\n\n(304) https://bugs.python.org/issue?@action=redirect&bpo=33495\n\n(305) https://bugs.python.org/issue?@action=redirect&bpo=26103\n\n(306) https://bugs.python.org/issue?@action=redirect&bpo=29209\n\n(307) https://bugs.python.org/issue?@action=redirect&bpo=33453\n\n(308) https://bugs.python.org/issue?@action=redirect&bpo=28556\n\n(309) https://bugs.python.org/issue?@action=redirect&bpo=33365\n\n(310) https://bugs.python.org/issue?@action=redirect&bpo=20087\n\n(311) https://bugs.python.org/issue?@action=redirect&bpo=33422\n\n(312) https://bugs.python.org/issue?@action=redirect&bpo=28167\n\n(313) https://bugs.python.org/issue?@action=redirect&bpo=33281\n\n(314) https://bugs.python.org/issue?@action=redirect&bpo=33311\n\n(315) https://bugs.python.org/issue?@action=redirect&bpo=27300\n\n(316) https://bugs.python.org/issue?@action=redirect&bpo=32933\n\n(317) https://bugs.python.org/issue?@action=redirect&bpo=33217\n\n(318) https://bugs.python.org/issue?@action=redirect&bpo=33197\n\n(319) https://bugs.python.org/issue?@action=redirect&bpo=33383\n\n(320) https://bugs.python.org/issue?@action=redirect&bpo=33375\n\n(321) https://bugs.python.org/issue?@action=redirect&bpo=33336\n\n(322) https://bugs.python.org/issue?@action=redirect&bpo=32455\n\n(323) https://bugs.python.org/issue?@action=redirect&bpo=27485\n\n(324) https://bugs.python.org/issue?@action=redirect&bpo=33332\n\n(325) https://bugs.python.org/issue?@action=redirect&bpo=33251\n\n(326) https://bugs.python.org/issue?@action=redirect&bpo=33329\n\n(327) https://bugs.python.org/issue?@action=redirect&bpo=33334\n\n(328) https://bugs.python.org/issue?@action=redirect&bpo=991266\n\n(329) https://bugs.python.org/issue?@action=redirect&bpo=33131\n\n(330) https://bugs.python.org/issue?@action=redirect&bpo=33308\n\n(331) https://bugs.python.org/issue?@action=redirect&bpo=23403\n\n(332) https://bugs.python.org/issue?@action=redirect&bpo=33266\n\n(333) https://bugs.python.org/issue?@action=redirect&bpo=11594\n\n(334) https://bugs.python.org/issue?@action=redirect&bpo=33254\n\n(335) https://bugs.python.org/issue?@action=redirect&bpo=33265\n\n(336) https://bugs.python.org/issue?@action=redirect&bpo=33263\n\n(337) https://bugs.python.org/issue?@action=redirect&bpo=33256\n\n(338) https://bugs.python.org/issue?@action=redirect&bpo=33144\n\n(339) https://bugs.python.org/issue?@action=redirect&bpo=33185\n\n(340) https://bugs.python.org/issue?@action=redirect&bpo=33053\n\n(341) https://bugs.python.org/issue?@action=redirect&bpo=29613\n\n(342) https://bugs.python.org/issue?@action=redirect&bpo=33169\n\n(343) https://bugs.python.org/issue?@action=redirect&bpo=33203\n\n(344) https://bugs.python.org/issue?@action=redirect&bpo=33224\n\n(345) https://peps.python.org/pep-0479/\n\n(346) https://bugs.python.org/issue?@action=redirect&bpo=33209\n\n(347) https://bugs.python.org/issue?@action=redirect&bpo=32861\n\n(348) https://bugs.python.org/issue?@action=redirect&bpo=23403\n\n(349) https://peps.python.org/pep-3154/\n\n(350) https://bugs.python.org/issue?@action=redirect&bpo=20104\n\n(351) https://bugs.python.org/issue?@action=redirect&bpo=33106\n\n(352) https://bugs.python.org/issue?@action=redirect&bpo=33175\n\n(353) https://bugs.python.org/issue?@action=redirect&bpo=32380\n\n(354) https://bugs.python.org/issue?@action=redirect&bpo=33141\n\n(355) https://bugs.python.org/issue?@action=redirect&bpo=33096\n\n(356) https://bugs.python.org/issue?@action=redirect&bpo=32873\n\n(357) https://bugs.python.org/issue?@action=redirect&bpo=33134\n\n(358) https://bugs.python.org/issue?@action=redirect&bpo=33127\n\n(359) https://bugs.python.org/issue?@action=redirect&bpo=32505\n\n(360) https://bugs.python.org/issue?@action=redirect&bpo=33078\n\n(361) https://bugs.python.org/issue?@action=redirect&bpo=33116\n\n(362) https://bugs.python.org/issue?@action=redirect&bpo=32896\n\n(363) https://bugs.python.org/issue?@action=redirect&bpo=33100\n\n(364) https://bugs.python.org/issue?@action=redirect&bpo=32953\n\n(365) https://bugs.python.org/issue?@action=redirect&bpo=33097\n\n(366) https://bugs.python.org/issue?@action=redirect&bpo=32968\n\n(367) https://bugs.python.org/issue?@action=redirect&bpo=33061\n\n(368) https://bugs.python.org/issue?@action=redirect&bpo=33078\n\n(369) https://bugs.python.org/issue?@action=redirect&bpo=33064\n\n(370) https://bugs.python.org/issue?@action=redirect&bpo=33056\n\n(371) https://bugs.python.org/issue?@action=redirect&bpo=33021\n\n(372) https://bugs.python.org/issue?@action=redirect&bpo=31804\n\n(373) https://bugs.python.org/issue?@action=redirect&bpo=33034\n\n(374) https://bugs.python.org/issue?@action=redirect&bpo=30249\n\n(375) https://bugs.python.org/issue?@action=redirect&bpo=33037\n\n(376) https://bugs.python.org/issue?@action=redirect&bpo=27683\n\n(377) https://bugs.python.org/issue?@action=redirect&bpo=22674\n\n(378) https://bugs.python.org/issue?@action=redirect&bpo=32999\n\n(379) https://bugs.python.org/issue?@action=redirect&bpo=33009\n\n(380) https://bugs.python.org/issue?@action=redirect&bpo=32969\n\n(381) https://bugs.python.org/issue?@action=redirect&bpo=32056\n\n(382) https://bugs.python.org/issue?@action=redirect&bpo=32970\n\n(383) https://bugs.python.org/issue?@action=redirect&bpo=32844\n\n(384) https://bugs.python.org/issue?@action=redirect&bpo=32960\n\n(385) https://bugs.python.org/issue?@action=redirect&bpo=32713\n\n(386) https://bugs.python.org/issue?@action=redirect&bpo=32257\n\n(387) https://bugs.python.org/issue?@action=redirect&bpo=32951\n\n(388) https://bugs.python.org/issue?@action=redirect&bpo=32929\n\n(389) https://bugs.python.org/issue?@action=redirect&bpo=32947\n\n(390) https://bugs.python.org/issue?@action=redirect&bpo=32146\n\n(391) https://bugs.python.org/issue?@action=redirect&bpo=30622\n\n(392) https://bugs.python.org/issue?@action=redirect&bpo=32922\n\n(393) https://bugs.python.org/issue?@action=redirect&bpo=32759\n\n(394) https://bugs.python.org/issue?@action=redirect&bpo=32859\n\n(395) https://bugs.python.org/issue?@action=redirect&bpo=32556\n\n(396) https://bugs.python.org/issue?@action=redirect&bpo=21060\n\n(397) https://bugs.python.org/issue?@action=redirect&bpo=32857\n\n(398) https://bugs.python.org/issue?@action=redirect&bpo=32852\n\n(399) https://bugs.python.org/issue?@action=redirect&bpo=31333\n\n(400) https://bugs.python.org/issue?@action=redirect&bpo=32841\n\n(401) https://bugs.python.org/issue?@action=redirect&bpo=32819\n\n(402) https://bugs.python.org/issue?@action=redirect&bpo=19675\n\n(403) https://bugs.python.org/issue?@action=redirect&bpo=32394\n\n(404) https://bugs.python.org/issue?@action=redirect&bpo=31787\n\n(405) https://bugs.python.org/issue?@action=redirect&bpo=30157\n\n(406) https://bugs.python.org/issue?@action=redirect&bpo=30688\n\n(407) https://bugs.python.org/issue?@action=redirect&bpo=32792\n\n(408) https://bugs.python.org/issue?@action=redirect&bpo=32775\n\n(409) https://bugs.python.org/issue?@action=redirect&bpo=32622\n\n(410) https://bugs.python.org/issue?@action=redirect&bpo=32777\n\n(411) https://bugs.python.org/issue?@action=redirect&bpo=32647\n\n(412) https://bugs.python.org/issue?@action=redirect&bpo=32749\n\n(413) https://bugs.python.org/issue?@action=redirect&bpo=32741\n\n(414) https://bugs.python.org/issue?@action=redirect&bpo=32691\n\n(415) https://bugs.python.org/issue?@action=redirect&bpo=32734\n\n(416) https://bugs.python.org/issue?@action=redirect&bpo=32727\n\n(417) https://bugs.python.org/issue?@action=redirect&bpo=31453\n\n(418) https://bugs.python.org/issue?@action=redirect&bpo=24334\n\n(419) https://bugs.python.org/issue?@action=redirect&bpo=31848\n\n(420) https://bugs.python.org/issue?@action=redirect&bpo=32585\n\n(421) https://bugs.python.org/issue?@action=redirect&bpo=32512\n\n(422) https://bugs.python.org/issue?@action=redirect&bpo=8525\n\n(423) https://bugs.python.org/issue?@action=redirect&bpo=31639\n\n(424) https://bugs.python.org/issue?@action=redirect&bpo=29877\n\n(425) https://bugs.python.org/issue?@action=redirect&bpo=32221\n\n(426) https://bugs.python.org/issue?@action=redirect&bpo=32147\n\n(427) https://bugs.python.org/issue?@action=redirect&bpo=30693\n\n(428) https://bugs.python.org/issue?@action=redirect&bpo=30693\n\n(429) https://bugs.python.org/issue?@action=redirect&bpo=31680\n\n(430) https://bugs.python.org/issue?@action=redirect&bpo=31908\n\n(431) https://bugs.python.org/issue?@action=redirect&bpo=31608\n\n(432) https://bugs.python.org/issue?@action=redirect&bpo=31425\n\n(433) https://bugs.python.org/issue?@action=redirect&bpo=22005\n\n(434) https://bugs.python.org/issue?@action=redirect&bpo=27645\n\n(435) https://bugs.python.org/issue?@action=redirect&bpo=16865\n\n(436) https://bugs.python.org/issue?@action=redirect&bpo=31508\n\n(437) https://bugs.python.org/issue?@action=redirect&bpo=29456\n\nFile: python3.12.info,  Node: Documentation<46>,  Next: Tests<43>,  Prev: Library<46>,  Up: Python 3 8 0 alpha 1\n\n1.22.46.4 Documentation\n.......................\n\n- bpo-21257(1): Document *note http.client.parseheaders(): 17c8.\n\n- bpo-34764(2): Improve example of iter() with 2nd sentinel argument.\n\n- bpo-35564(3): Explicitly set masterdoc variable in conf.py for\ncompliance with Sphinx 2.0\n\n- bpo-35511(4): Specified that profile.Profile class doesn't not\nsupport enable or disable methods.  Also, elaborated that Profile\nobject as a context manager is only supported in cProfile module.\n\n- bpo-10536(5): Enhance the gettext docs.  Patch by ??ric Araujo\n\n- bpo-35089(6): Remove mention of 'typing.io' and 'typing.re'.  Their\ntypes should be imported from 'typing' directly.\n\n- bpo-35038(7): Fix the documentation about an unexisting\n'frestricted' attribute in the frame object.  Patch by Ste'phane\nWirtel\n\n- bpo-35042(8): Replace PEP XYZ by the pep role and allow to use the\ndirect links to the PEPs.\n\n- bpo-35044(9): Fix the documentation with the role 'exc' for the\nappropriated exception.  Patch by Ste'phane Wirtel\n\n- bpo-35035(10): Rename documentation for *note email.utils: 4c. to\n'email.utils.rst'.\n\n- bpo-34967(11): Use app.addobjecttype() instead of the deprecated\nSphinx function app.descriptionunit()\n\n- bpo-34913(12): Add documentation about the new command line\ninterface of the gzip module.\n\n- bpo-32174(13): chm document displays non-ASCII charaters properly\non some MBCS Windows systems.\n\n- bpo-11233(14): Create availability directive for documentation.\nOriginal patch by Georg Brandl.\n\n- bpo-34790(15): Document how passing coroutines to asyncio.wait()\ncan be confusing.\n\n- bpo-34552(16): Make clear that '==' operator sometimes is\nequivalent to 'is'.  The '<', '<=', '>' and '>=' operators are only\ndefined where they make sense.\n\n- bpo-28617(17): Fixed info in the stdtypes docs concerning the types\nthat support membership tests.\n\n- bpo-20177(18): Migrate datetime.date.fromtimestamp to Argument\nClinic.  Patch by Tim Hoffmann.\n\n- bpo-34065(19): Fix wrongly written basicConfig documentation markup\nsyntax\n\n- bpo-33460(20): replaced ellipsis with correct error codes in\ntutorial chapter 3.\n\n- bpo-33847(21): Add '@' operator entry to index.\n\n- bpo-33409(22): Clarified the relationship between PEP 538(23)'s\nPYTHONCOERCECLOCALE and PEP 540's PYTHONUTF8 mode.\n\n- bpo-33197(24): Add versionadded tag to the documentation of\nParameterKind.description\n\n- bpo-17045(25): Improve the C-API doc for PyTypeObject.  This\nincludes adding several quick-reference tables and a lot of missing\nslot/typedef entries.  The existing entries were also cleaned up\nwith a slightly more consistent format.\n\n- bpo-33736(26): Improve the documentation of *note\nasyncio.openconnection(): 950, *note asyncio.startserver(): 951.\nand their UNIX socket counterparts.\n\n- bpo-23859(27): Document that 'asyncio.wait()' does not cancel its\nfutures on timeout.\n\n- bpo-32436(28): Document PEP 567(29) changes to asyncio.\n\n- bpo-33604(30): Update HMAC md5 default to a DeprecationWarning,\nbump removal to 3.8.\n\n- bpo-33594(31): Document 'getargspec', 'fromfunction' and\n'frombuiltin' as deprecated in their respective docstring, and\ninclude version since deprecation in DeprecationWarning message.\n\n- bpo-33503(32): Fix broken pypi link\n\n- bpo-33421(33): Add missing documentation for\n'typing.AsyncContextManager'.\n\n- bpo-33487(34): BZ2file now emit a DeprecationWarning when\nbuffering=None is passed, the deprecation message and documentation\nalso now explicitly state it is deprecated since 3.0.\n\n- bpo-33378(35): Add Korean language switcher for\n'https://docs.python.org/3/'\n\n- bpo-33276(36): Clarify that the 'path' attribute on modules\ncannot be just any value.\n\n- bpo-33201(37): Modernize documentation for writing C extension\ntypes.\n\n- bpo-33195(38): Deprecate 'PyUNICODE' usage in 'c-api/arg'\ndocument.  'PyUNICODE' related APIs are deprecated since Python\n3.3, but it is missed in the document.\n\n- bpo-33126(39): Document PyBufferToContiguous().\n\n- bpo-27212(40): Modify documentation for the 'islice()' recipe to\nconsume initial values up to the start index.\n\n- bpo-28247(41): Update *note zipapp: 12a. documentation to describe\nhow to make standalone applications.\n\n- bpo-18802(42): Documentation changes for ipaddress.  Patch by Jon\nFoster and Berker Peksag.\n\n- bpo-27428(43): Update documentation to clarify that\n'WindowsRegistryFinder' implements 'MetaPathFinder'.  (Patch by\nHimanshu Lakhara)\n\n- bpo-28124(44): The ssl module function ssl.wrapsocket() has been\nde-emphasized and deprecated in favor of the more secure and\nefficient SSLContext.wrapsocket() method.\n\n- bpo-17232(45): Clarify docs for -O and -OO. Patch by Terry Reedy.\n\n- bpo-32436(46): Add documentation for the contextvars module (PEP\n567).\n\n- bpo-32800(47): Update link to w3c doc for xml default namespaces.\n\n- bpo-11015(48): Update *note test.support: de. documentation.\n\n- bpo-32613(49): Update the faq/windows.html to use the py command\nfrom PEP 397 instead of python.\n\n- bpo-8722(50): Document 'getattr()' behavior when property\n'get()' method raises *note AttributeError: 395.\n\n- bpo-32614(51): Modify RE examples in documentation to use raw\nstrings to prevent *note DeprecationWarning: 179. and add text to\nREGEX HOWTO to highlight the deprecation.\n\n- bpo-20709(52): Remove the paragraph where we explain that\nos.utime() does not support a directory as path under Windows.\nPatch by Jan-Philip Gehrcke\n\n- bpo-32722(53): Remove the bad example in the tutorial of the\nGenerator Expression.  Patch by Ste'phane Wirtel\n\n- bpo-31972(54): Improve docstrings for 'pathlib.PurePath'\nsubclasses.\n\n- bpo-30607(55): Use the externalized 'python-docs-theme' package\nwhen building the documentation.\n\n- bpo-8243(56): Add a note about curses.addch and curses.addstr\nexception behavior when writing outside a window, or pad.\n\n- bpo-32337(57): Update documentation related with 'dict' order.\n\n- bpo-25041(58): Document 'AFPACKET' in the *note socket: c6.\nmodule.\n\n- bpo-31432(59): Clarify meaning of CERTNONE, CERTOPTIONAL, and\nCERTREQUIRED flags for ssl.SSLContext.verifymode.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=21257\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=34764\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=35564\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=35511\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=10536\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=35089\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=35038\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=35042\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=35044\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=35035\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=34967\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=34913\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=32174\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=11233\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=34790\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=34552\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=28617\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=20177\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=34065\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=33460\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=33847\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=33409\n\n(23) https://peps.python.org/pep-0538/\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=33197\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=17045\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=33736\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=23859\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=32436\n\n(29) https://peps.python.org/pep-0567/\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=33604\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=33594\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=33503\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=33421\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=33487\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=33378\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=33276\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=33201\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=33195\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=33126\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=27212\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=28247\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=18802\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=27428\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=28124\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=17232\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=32436\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=32800\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=11015\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=32613\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=8722\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=32614\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=20709\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=32722\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=31972\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=30607\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=8243\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=32337\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=25041\n\n(59) https://bugs.python.org/issue?@action=redirect&bpo=31432\n\nFile: python3.12.info,  Node: Tests<43>,  Next: Build<43>,  Prev: Documentation<46>,  Up: Python 3 8 0 alpha 1\n\n1.22.46.5 Tests\n...............\n\n- bpo-35772(1): Fix sparse file tests of testtarfile on ppc64 with\nthe tmpfs filesystem.  Fix the function testing if the filesystem\nsupports sparse files: create a file which contains data and\n\"holes\", instead of creating a file which contains no data.  tmpfs\neffective block size is a page size (tmpfs lives in the page\ncache).  RHEL uses 64 KiB pages on aarch64, ppc64, ppc64le, only\ns390x and x8664 use 4 KiB pages, whereas the test punch holes of 4\nKiB.\n\n- bpo-35045(2): Make ssl tests less strict and also accept TLSv1 as\nsystem default.  The changes unbreaks testminmaxversion on\nFedora 29.\n\n- bpo-32710(3): 'testasyncio/testsendfile.py' now resets the event\nloop policy using 'tearDownModule()' as done in other tests, to\nprevent a warning when running tests on Windows.\n\n- bpo-33717(4): test.pythoninfo now logs information of all clocks,\nnot only time.time() and time.perfcounter().\n\n- bpo-35488(5): Add a test to pathlib's Path.match() to verify it\ndoes not support glob-style  recursive pattern matching.\n\n- bpo-31731(6): Fix a race condition in 'checkinterruptedwrite()'\nof testio: create directly the thread with SIGALRM signal blocked,\nrather than blocking the signal later from the thread.  Previously,\nit was possible that the thread gets the signal before the signal\nis blocked.\n\n- bpo-35424(7): Fix testmultiprocessingmainhandling: use\n'multiprocessing.Pool' with a context manager and then explicitly\njoin the pool.\n\n- bpo-35519(8): Rename 'test.bisect' module to 'test.bisectcmd' to\navoid conflict with *note bisect: f. module when running directly a\ntest like './python Lib/test/testxmlrpc.py'.\n\n- bpo-35513(9): Replace *note time.time(): 918. with *note\ntime.monotonic(): ce1. in tests to measure time delta.\n\n- bpo-34279(10): 'test.support.rununittest()' no longer raise\n'TestDidNotRun' if the test result contains skipped tests.  The\nexception is now only raised if no test have been run and no test\nhave been skipped.\n\n- bpo-35412(11): Add testcase to 'testfuture4': check unicode\nliteral.\n\n- bpo-26704(12): Added test demonstrating double-patching of an\ninstance method.  Patch by Anthony Sottile.\n\n- bpo-33725(13): testmultiprocessingfork may crash on recent\nversions of macOS. Until the issue is resolved, skip the test on\nmacOS.\n\n- bpo-35352(14): Modify testasyncio to use the certificate set from\nthe test directory.\n\n- bpo-35317(15): Fix 'mktime()' overflow error in 'testemail': run\n'testlocaltimedaylighttruedsttrue()' and\n'testlocaltimedaylightfalsedsttrue()' with a specific\ntimezone.\n\n- bpo-21263(16): After several reports that testgdb does not work\nproperly on macOS and since gdb is not shipped by default anymore,\ntestgdb is now skipped on macOS when LLVM Clang has been used to\ncompile Python.  Patch by Lysandros Nikolaou\n\n- bpo-34279(17): regrtest issue a warning when no tests have been\nexecuted in a particular test file.  Also, a new final result state\nis issued if no test have been executed across all test files.\nPatch by Pablo Galindo.\n\n- bpo-34962(18): make docstest in Doc now passes., and is enforced in\nCI\n\n- bpo-23596(19): Use argparse for the command line of the gzip\nmodule.  Patch by Antony Lee\n\n- bpo-34537(20): Fix 'testgdb.teststrings()' when 'LCALL=C' and\nGDB was compiled with Python 3.6 or earlier.\n\n- bpo-34587(21): testsocket: Remove RDSTest.testCongestion().  The\ntest tries to fill the receiver's socket buffer and expects an\nerror.  But the RDS protocol doesn't require that.  Moreover, the\nLinux implementation of RDS expects that the producer of the\nmessages reduces its rate, it's not the role of the receiver to\ntrigger an error.  The test fails on Fedora 28 by design, so just\nremove it.\n\n- bpo-34661(22): Fix testshutil if unzip doesn't support -t.\n\n- bpo-34200(23): Fixed non-deterministic flakiness of testpkg by not\nusing the scary test.support.modulecleanup() logic to save and\nrestore sys.modules contents between test cases.\n\n- bpo-34569(24): The experimental PEP 554 data channels now correctly\npass negative PyLong objects between subinterpreters on 32-bit\nsystems.  Patch by Michael Felt.\n\n- bpo-34594(25): Fix usage of hardcoded 'errno' values in the tests.\n\n- bpo-34579(26): Fix testembed for AIX Patch by Michael Felt\n\n- bpo-34542(27): Use 3072 RSA keys and SHA-256 signature for test\ncerts and keys.\n\n- bpo-11193(28): Remove special condition for AIX in\n'testsubprocess.testundecodableenv'\n\n- bpo-34347(29): Fix 'testutf8mode.testcmdline' for AIX\n\n- bpo-34490(30): On AIX with AFUNIX family sockets getsockname()\ndoes not provide 'sockname', so skip calls to\ntransport.getextrainfo('sockname')\n\n- bpo-34391(31): Fix ftplib test for TLS 1.3 by reading from data\nsocket.\n\n- bpo-11192(32): Fix 'testsocket' on AIX 6.1 and later IPv6 zone id\nsupports only supported by 'inetpton6zone()'.  Switch to\nruntime-based 'platform.system()' to establish current platform\nrather than build-time based 'sys.platform()'\n\n- bpo-34399(33): Update all RSA keys and DH params to use at least\n2048 bits.\n\n- bpo-34373(34): Fix 'testmktime' and 'testpthreadgetcpuclickid'\ntests for AIX Add range checking for 'PyTimelocaltime' for AIX\nPatch by Michael Felt\n\n- bpo-11191(35): Skip the distutils test 'testsearchcpp' when using\nXLC as compiler patch by aixtools (Michael Felt)\n\n- Improved an error message when mock asserthascalls fails.\n\n- bpo-33746(36): Fix testunittest when run in verbose mode.\n\n- bpo-33901(37): Fix testdbmgnu on macOS with gdbm 1.15: add a\nlarger value to make sure that the file size changes.\n\n- bpo-33873(38): Fix a bug in 'regrtest' that caused an extra test to\nrun if -huntrleaks/-R was used.  Exit with error in case that\ninvalid parameters are specified to -huntrleaks/-R (at least one\nwarmup run and one repetition must be used).\n\n- bpo-33562(39): Check that a global asyncio event loop policy is not\nleft behind by any tests.\n\n- bpo-33655(40): Ignore testposixfallocate failures on BSD\nplatforms that might be due to running on ZFS.\n\n- bpo-32962(41): Fixed testgdb when Python is compiled with flags\n-mcet -fcf-protection -O0.\n\n- bpo-33358(42): Fix\n'testembed.testpreinitializationsysoptions()' when the\ninterpreter is built with '--enable-shared'.\n\n- bpo-32872(43): Avoid regrtest compatibility issue with namespace\npackages.\n\n- bpo-32517(44): Fix failing 'testasyncio' on macOS 10.12.2+ due to\ntransport of 'KqueueSelector' loop was not being closed.\n\n- bpo-32663(45): Making sure the 'SMTPUTF8SimTests' class of tests\ngets run in 'testsmtplib.py'.\n\n- bpo-27643(46): TestC test case needs \"signed short\" bitfields, but\nthe IBM XLC compiler (on AIX) does not support this Skip the code\nand test when AIX and XLC are used\n\nApplicable to Python2-2.7 and later\n\n- bpo-19417(47): Add testbdb.py.\n\n- bpo-31809(48): Add tests to verify connection with secp ECDH\ncurves.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=35772\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=35045\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=32710\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=33717\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=35488\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=31731\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=35424\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=35519\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=35513\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=34279\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=35412\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=26704\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=33725\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=35352\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=35317\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=21263\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=34279\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=34962\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=23596\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=34537\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=34587\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=34661\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=34200\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=34569\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=34594\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=34579\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=34542\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=11193\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=34347\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=34490\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=34391\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=11192\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=34399\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=34373\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=11191\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=33746\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=33901\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=33873\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=33562\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=33655\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=32962\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=33358\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=32872\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=32517\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=32663\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=27643\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=19417\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=31809\n\nFile: python3.12.info,  Node: Build<43>,  Next: Windows<42>,  Prev: Tests<43>,  Up: Python 3 8 0 alpha 1\n\n1.22.46.6 Build\n...............\n\n- bpo-34691(1): The contextvars module is now built into the core\nPython library on Windows.\n\n- bpo-35683(2): Improved Azure Pipelines build steps and now\nverifying layouts correctly\n\n- bpo-35642(3): Remove asynciomodule.c from pythoncore.vcxproj\n\n- bpo-35550(4): Fix incorrect Solaris #ifdef checks to look for sun\n&& SVR4 instead of sun when compiling.\n\n- bpo-35499(5): 'make profile-opt' no longer replaces 'CFLAGSNODIST'\nwith 'CFLAGS'.  It now adds profile-guided optimization (PGO) flags\nto 'CFLAGSNODIST': existing 'CFLAGSNODIST' flags are kept.\n\n- bpo-35257(6): Avoid leaking the linker flags from Link Time\nOptimizations (LTO) into distutils when compiling C extensions.\n\n- bpo-35351(7): When building Python with clang and LTO, LTO flags\nare no longer passed into CFLAGS to build third-party C extensions\nthrough distutils.\n\n- bpo-35139(8): Fix a compiler error when statically linking\n'pyexpat' in 'Modules/Setup'.\n\n- bpo-35059(9): PCbuild: Set InlineFunctionExpansion to\nOnlyExplicitInline (\"/Ob1\" option) in pyproject.props in Debug mode\nto expand functions marked as inline.  This change should make\nPython compiled in Debug mode a little bit faster on Windows.\n\n- bpo-35011(10): Restores the use of pyexpatns.h to isolate our\nembedded copy of the expat C library so that its symbols do not\nconflict at link or dynamic loading time with an embedding\napplication or other extension modules with their own version of\nlibexpat.\n\n- bpo-28015(11): Have -with-lto works correctly with clang.\n\n- bpo-34765(12): Update the outdated install-sh file to the latest\nrevision from automake v1.16.1\n\n- bpo-34585(13): Check for floating-point byte order in configure.ac\nusing compilation tests instead of executing code, so that these\nchecks work in cross-compiled builds.\n\n- bpo-34710(14): Fixed SSL module build with OpenSSL & pedantic\nCFLAGS.\n\n- bpo-34582(15): Add JUnit XML output for regression tests and update\nAzure DevOps builds.\n\n- bpo-34081(16): Make Sphinx warnings as errors in the Docs Makefile.\n\n- bpo-34555(17): Fix for case where it was not possible to have both\n'HAVELINUXVMSOCKETSH' and 'HAVESOCKADDRALG' be undefined.\n\n- bpo-33015(18): Fix an undefined behaviour in the pthread\nimplementation of 'PyThreadstartnewthread()': add a function\nwrapper to always return 'NULL'.\n\n- bpo-34245(19): The Python shared library is now installed with\nwrite permission (mode 0755), which is the standard way of\ninstalling such libraries.\n\n- bpo-34121(20): Fix detection of C11 atomic support on clang.\n\n- bpo-32430(21): Rename Modules/Setup.dist to Modules/Setup, and\nremove the necessity to copy the former manually to the latter when\nupdating the local source tree.\n\n- bpo-30345(22): Add -g to LDFLAGS when compiling with LTO to get\ndebug symbols.\n\n- bpo-5755(23): Move '-Wstrict-prototypes' option to 'CFLAGSNODIST'\nfrom 'OPT'.  This option emitted annoying warnings when building\nextension modules written in C++.\n\n- bpo-33614(24): Ensures module definition files for the stable ABI\non Windows are correctly regenerated.\n\n- bpo-33648(25): The -with-c-locale-warning configuration flag has\nbeen removed.  It has had no effect for about a year.\n\n- bpo-33522(26): Enable CI builds on Visual Studio Team Services at\n'https://python.visualstudio.com/cpython'\n\n- bpo-33512(27): configure's check for \"long double\" has been\nsimplified\n\n- bpo-33483(28): C compiler is now correctly detected from the\nstandard environment variables.  -without-gcc and -with-icc options\nhave been removed.\n\n- bpo-33394(29): Enable the verbose build for extension modules, when\nGNU make is passed macros on the command line.\n\n- bpo-33393(30): Update config.guess and config.sub files.\n\n- bpo-33377(31): Add new triplets for mips r6 and riscv variants\n(used in extension suffixes).\n\n- bpo-32232(32): By default, modules configured in 'Modules/Setup'\nare no longer built with '-DPyBUILDCORE'.  Instead, modules that\nspecifically need that preprocessor definition include it in their\nindividual entries.\n\n- bpo-33182(33): The embedding tests can once again be built with\nclang 6.0\n\n- bpo-33163(34): Upgrade pip to 9.0.3 and setuptools to v39.0.1.\n\n- bpo-33012(35): gcc 8 has added a new warning heuristic to detect\ninvalid function casts and a stock python build seems to hit that\nwarning quite often.  The most common is the cast of a METHNOARGS\nfunction (that uses just one argument) to a PyCFunction.  Fix this\nby adding a dummy argument to all functions that implement\nMETHNOARGS.\n\n- bpo-32898(36): Fix the python debug build when using COUNTALLOCS.\n\n- bpo-29442(37): Replace optparse with argparse in setup.py\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=34691\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=35683\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=35642\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=35550\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=35499\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=35257\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=35351\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=35139\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=35059\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=35011\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=28015\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=34765\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=34585\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=34710\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=34582\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=34081\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=34555\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=33015\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=34245\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=34121\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=32430\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=30345\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=5755\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=33614\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=33648\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=33522\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=33512\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=33483\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=33394\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=33393\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=33377\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=32232\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=33182\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=33163\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=33012\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=32898\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=29442\n\nFile: python3.12.info,  Node: Windows<42>,  Next: macOS<34>,  Prev: Build<43>,  Up: Python 3 8 0 alpha 1\n\n1.22.46.7 Windows\n.................\n\n- bpo-35890(1): Fix API calling consistency of GetVersionEx and\nwcstok.\n\n- bpo-32560(2): The 'py' launcher now forwards its 'STARTUPINFO'\nstructure to child processes.\n\n- bpo-35854(3): Fix EnvBuilder and -symlinks in venv on Windows\n\n- bpo-35811(4): Avoid propagating venv settings when launching via\npy.exe\n\n- bpo-35797(5): Fix default executable used by the multiprocessing\nmodule\n\n- bpo-35758(6): Allow building on ARM with MSVC.\n\n- bpo-29734(7): Fix handle leaks in os.stat on Windows.\n\n- bpo-35596(8): Use unchecked PYCs for the embeddable distro to avoid\nzipimport restrictions.\n\n- bpo-35596(9): Fix vcruntime140.dll being added to embeddable distro\nmultiple times.\n\n- bpo-35402(10): Update Windows build to use Tcl and Tk 8.6.9\n\n- bpo-35401(11): Updates Windows build to OpenSSL 1.1.0j\n\n- bpo-34977(12): venv on Windows will now use a python.exe redirector\nrather than copying the actual binaries from the base environment.\n\n- bpo-34977(13): Adds support for building a Windows App Store\npackage\n\n- bpo-35067(14): Remove distutilsfindvs module and use vswhere.exe\ninstead.\n\n- bpo-32557(15): Allow shutil.diskusage to take a file path on\nWindows\n\n- bpo-34770(16): Fix a possible null pointer dereference in\npyshellext.cpp.\n\n- bpo-34603(17): Fix returning structs from functions produced by\nMSVC\n\n- bpo-34581(18): Guard MSVC-specific code in socketmodule.c with\n'#ifdef MSCVER'.\n\n- bpo-34532(19): Fixes exit code of list version arguments for\npy.exe.\n\n- bpo-34062(20): Fixed the '-list' and '-list-paths' arguments for\nthe py.exe launcher\n\n- bpo-34225(21): Ensure INCLUDE and LIB directories do not end with a\nbackslash.\n\n- bpo-34011(22): A suite of code has been changed which copied across\nDLLs and init.tcl from the running Python location into a venv\nbeing created.  These copies are needed only when running from a\nPython source build, and the copying code is now only run when that\nis the case, rather than whenever a venv is created.\n\n- bpo-34006(23): Revert line length limit for Windows help docs.  The\nline-length limit is not needed because the pages appear in a\nseparate app rather than on a browser tab.  It can also interact\nbadly with the DPI setting.\n\n- bpo-31546(24): Restore running PyOSInputHook while waiting for\nuser input at the prompt.  The restores integration of interactive\nGUI windows (such as Matplotlib figures) with the prompt on\nWindows.\n\n- bpo-30237(25): Output error when ReadConsole is canceled by\nCancelSynchronousIo instead of crashing.\n\n- bpo-33895(26): GIL is released while calling functions that acquire\nWindows loader lock.\n\n- bpo-33720(27): Reduces maximum marshal recursion depth on release\nbuilds.\n\n- bpo-29097(28): Fix bug where 'datetime.fromtimestamp()' erroneously\nthrows an *note OSError: 613. on Windows for values between 0 and\n86400.  Patch by Ammar Askar.\n\n- bpo-33316(29): PyThreadreleaselock always fails\n\n- bpo-33184(30): Update Windows installer to use OpenSSL 1.1.0h.\n\n- bpo-32890(31): Fix usage of GetLastError() instead of errno in\nos.execve() and os.truncate().\n\n- bpo-33016(32): Fix potential use of uninitialized memory in\nnt.getfinalpathname\n\n- bpo-32903(33): Fix a memory leak in os.chdir() on Windows if the\ncurrent directory is set to a UNC path.\n\n- bpo-32901(34): Update Tcl and Tk versions to 8.6.8\n\n- bpo-31966(35): Fixed WindowsConsoleIO.write() for writing empty\ndata.\n\n- bpo-32409(36): Ensures activate.bat can handle Unicode contents.\n\n- bpo-32457(37): Improves handling of denormalized executable path\nwhen launching Python.\n\n- bpo-32370(38): Use the correct encoding for ipconfig output in the\nuuid module.  Patch by Segev Finer.\n\n- bpo-29248(39): Fix *note os.readlink(): 73e. on Windows, which was\nmistakenly treating the 'PrintNameOffset' field of the reparse data\nbuffer as a number of characters instead of bytes.  Patch by Craig\nHolmquist and SSE4.\n\n- bpo-1104(40): Correctly handle string length in\n'msilib.SummaryInfo.GetProperty()' to prevent it from truncating\nthe last character.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=35890\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32560\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=35854\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=35811\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=35797\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=35758\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=29734\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=35596\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=35596\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=35402\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=35401\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=34977\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=34977\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=35067\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=32557\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=34770\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=34603\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=34581\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=34532\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=34062\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=34225\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=34011\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=34006\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=31546\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=30237\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=33895\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=33720\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=29097\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=33316\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=33184\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=32890\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=33016\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=32903\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=32901\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=31966\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=32409\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=32457\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=32370\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=29248\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=1104\n\nFile: python3.12.info,  Node: macOS<34>,  Next: IDLE<30>,  Prev: Windows<42>,  Up: Python 3 8 0 alpha 1\n\n1.22.46.8 macOS\n...............\n\n- bpo-35401(1): Update macOS installer to use OpenSSL 1.1.0j.\n\n- bpo-35025(2): Properly guard the use of the 'CLOCKGETTIME' et al.\nmacros in 'timemodule' on macOS.\n\n- bpo-24658(3): On macOS, fix reading from and writing into a file\nwith a size larger than 2 GiB.\n\n- bpo-34405(4): Update to OpenSSL 1.1.0i for macOS installer builds.\n\n- bpo-33635(5): In macOS stat on some file descriptors (/dev/fd/3\nf.e) will result in bad file descriptor OSError.  Guard against\nthis exception was added in isdir, isfile and similar methods.\nDirEntry.isdir can also throw this exception so\nRecursiveWildcardSelector.iteratedirectories was also extended\nwith the same error ignoring pattern.\n\n- bpo-13631(6): The .editrc file in user's home directory is now\nprocessed correctly during the readline initialization through\neditline emulation on macOS.\n\n- bpo-33184(7): Update macOS installer build to use OpenSSL 1.1.0h.\n\n- bpo-32726(8): Build and link with private copy of Tcl/Tk 8.6 for\nthe macOS 10.6+ installer.  The 10.9+ installer variant already\ndoes this.  This means that the Python 3.7 provided by the\npython.org macOS installers no longer need or use any external\nversions of Tcl/Tk, either system-provided or user-installed, such\nas ActiveTcl.\n\n- bpo-32901(9): Update macOS 10.9+ installer to Tcl/Tk 8.6.8.\n\n- bpo-31903(10): In 'scproxy', drop the GIL when calling into\n'SystemConfiguration' to avoid deadlocks.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=35401\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=35025\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=24658\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=34405\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=33635\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=13631\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=33184\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=32726\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=32901\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=31903\n\nFile: python3.12.info,  Node: IDLE<30>,  Next: Tools/Demos<24>,  Prev: macOS<34>,  Up: Python 3 8 0 alpha 1\n\n1.22.46.9 IDLE\n..............\n\n- bpo-35770(1): IDLE macosx deletes Options => Configure IDLE. It\npreviously deleted Window => Zoom Height by mistake.  (Zoom Height\nis now on the Options menu).  On Mac, the settings dialog is\naccessed via Preferences on the IDLE menu.\n\n- bpo-35769(2): Change IDLE's new file name from 'Untitled' to\n'untitled'\n\n- bpo-35660(3): Fix imports in idlelib.window.\n\n- bpo-35641(4): Proper format 'calltip' when the function has no\ndocstring.\n\n- bpo-33987(5): Use ttk Frame for ttk widgets.\n\n- bpo-34055(6): Fix erroneous 'smart' indents and newlines in IDLE\nShell.\n\n- bpo-35591(7): Find Selection now works when selection not found.\n\n- bpo-35196(8): Speed up squeezer line counting.\n\n- bpo-35598(9): Update configkey: use PEP 8 names and ttk widgets,\nmake some objects global, and add tests.\n\n- bpo-28097(10): Add Previous/Next History entries to Shell menu.\n\n- bpo-35208(11): Squeezer now properly counts wrapped lines before\nnewlines.\n\n- bpo-35555(12): Gray out Code Context menu entry when it's not\napplicable.\n\n- bpo-35521(13): Document the IDLE editor code context feature.  Add\nsome internal references within the IDLE doc.\n\n- bpo-22703(14): The Code Context menu label now toggles between\nShow/Hide Code Context.  The Zoom Height menu now toggles between\nZoom/Restore Height.  Zoom Height has moved from the Window menu to\nthe Options menu.\n\n- bpo-35213(15): Where appropriate, use 'macOS' in idlelib.\n\n- bpo-34864(16): On macOS, warn if the system preference \"Prefer tabs\nwhen opening documents\" is set to \"Always\".\n\n- bpo-34864(17): Document two IDLE on MacOS issues.  The System\nPreferences Dock \"prefer tabs always\" setting disables some IDLE\nfeatures.  Menus are a bit different than as described for Windows\nand Linux.\n\n- bpo-35202(18): Remove unused imports from lib/idlelib\n\n- bpo-33000(19): Document that IDLE's shell has no line limit.  A\nprogram that runs indefinitely can overfill memory.\n\n- bpo-23220(20): Explain how IDLE's Shell displays output.\n\n- bpo-35099(21): Improve the doc about IDLE running user code.  The\nsection is renamed from \"IDLE - console differences\" is renamed\n\"Running user code\".  It mostly covers the implications of using\ncustom 'sys.stdXXX' objects.\n\n- bpo-35097(22): Add IDLE doc subsection explaining editor windows.\nTopics include opening, title and status bar, .py* extension, and\nrunning.\n\n- bpo-35093(23): Document the IDLE document viewer in the IDLE doc.\nAdd a paragraph in \"Help and preferences\", \"Help sources\"\nsubsection.\n\n- bpo-35088(24): Update idlelib.help.copystring docstring.  We now\nuse git and backporting instead of hg and forward merging.\n\n- bpo-35087(25): Update idlelib help files for the current doc build.\nThe main change is the elimination of chapter-section numbers.\n\n- bpo-34548(26): Use configured color theme for read-only text views.\n\n- bpo-1529353(27): Enable \"squeezing\" of long outputs in the shell,\nto avoid performance degradation and to clean up the history\nwithout losing it.  Squeezed outputs may be copied, viewed in a\nseparate window, and \"unsqueezed\".\n\n- bpo-34047(28): Fixed mousewheel scrolling direction on macOS.\n\n- bpo-34275(29): Make IDLE calltips always visible on Mac.  Some\nMacOS-tk combinations need .updateidletasks().  Patch by Kevin\nWalzer.\n\n- bpo-34120(30): Fix unresponsiveness after closing certain windows\nand dialogs.\n\n- bpo-33975(31): Avoid small type when running htests.  Since part of\nthe purpose of human-viewed tests is to determine that widgets look\nright, it is important that they look the same for testing as when\nrunning IDLE.\n\n- bpo-33905(32): Add test for idlelib.stackview.StackBrowser.\n\n- bpo-33924(33): Change mainmenu.menudefs key 'windows' to 'window'.\nEvery other menudef key is lowercase version of main menu entry.\n\n- bpo-33906(34): Rename idlelib.windows as window Match Window on the\nmain menu and remove last plural module name.\n\n- bpo-33917(35): Fix and document idlelib/idletest/template.py.  The\nrevised file compiles, runs, and tests OK. idletest/README.txt\nexplains how to use it to create new IDLE test files.\n\n- bpo-33904(36): IDLE: In rstrip, rename class RstripExtension as\nRstrip\n\n- bpo-33907(37): For consistency and clarity, rename an IDLE module\nand classes.  Module calltips and its class CallTips are now\ncalltip and Calltip.  In module calltipw, class CallTip is now\nCalltipWindow.\n\n- bpo-33856(38): Add \"help\" in the welcome message of IDLE\n\n- bpo-33839(39): IDLE: refactor ToolTip and CallTip and add\ndocumentation and tests\n\n- bpo-33855(40): Minimally test all IDLE modules.  Add missing files,\nimport module, instantiate classes, and check coverage.  Check\nexisting files.\n\n- bpo-33656(41): On Windows, add API call saying that tk scales for\nDPI. On Windows 8.1+ or 10, with DPI compatibility properties of\nthe Python binary unchanged, and a monitor resolution greater than\n96 DPI, this should make text and lines sharper.  It should\notherwise have no effect.\n\n- bpo-33768(42): Clicking on a context line moves that line to the\ntop of the editor window.\n\n- bpo-33763(43): IDLE: Use read-only text widget for code context\ninstead of label widget.\n\n- bpo-33664(44): Scroll IDLE editor text by lines.  Previously, the\nmouse wheel and scrollbar slider moved text by a fixed number of\npixels, resulting in partial lines at the top of the editor box.\nThe change also applies to the shell and grep output windows, but\nnot to read-only text views.\n\n- bpo-33679(45): Enable theme-specific color configuration for Code\nContext.  Use the Highlights tab to see the setting for built-in\nthemes or add settings to custom themes.\n\n- bpo-33642(46): Display up to maxlines non-blank lines for Code\nContext.  If there is no current context, show a single blank line.\n\n- bpo-33628(47): IDLE: Cleanup codecontext.py and its test.\n\n- bpo-33564(48): IDLE's code context now recognizes async as a block\nopener.\n\n- bpo-21474(49): Update word/identifier definition from ascii to\nunicode.  In text and entry boxes, this affects selection by\ndouble-click, movement left/right by control-left/right, and\ndeletion left/right by control-BACKSPACE/DEL.\n\n- bpo-33204(50): IDLE: consistently color invalid string prefixes.  A\n'u' string prefix cannot be paired with either 'r' or 'f'.\nConsistently color as much of the prefix, starting at the right, as\nis valid.  Revise and extend colorizer test.\n\n- bpo-32984(51): Set 'file' while running a startup file.  Like\nPython, IDLE optionally runs one startup file in the Shell window\nbefore presenting the first interactive input prompt.  For IDLE,\n'-s' runs a file named in environmental variable 'IDLESTARTUP' or\n*note PYTHONSTARTUP: e3b.; '-r file' runs 'file'.  Python sets\n'file' to the startup file name before running the file and\nunsets it before the first prompt.  IDLE now does the same when run\nnormally, without the '-n' option.\n\n- bpo-32940(52): Simplify and rename StringTranslatePseudoMapping in\npyparse.\n\n- bpo-32916(53): Change 'str' to 'code' in pyparse.\n\n- bpo-32905(54): Remove unused code in pyparse module.\n\n- bpo-32874(55): Add tests for pyparse.\n\n- bpo-32837(56): Using the system and place-dependent default\nencoding for open() is a bad idea for IDLE's system and\nlocation-independent files.\n\n- bpo-32826(57): Add \"encoding=utf-8\" to open() in IDLE's\ntesthelpabout.  GUI test testfilebuttons() only looks at\ninitial ascii-only lines, but failed on systems where open()\ndefaults to 'ascii' because readline() internally reads and decodes\nfar enough ahead to encounter a non-ascii character in CREDITS.txt.\n\n- bpo-32831(58): Add docstrings and tests for codecontext.\n\n- bpo-32765(59): Update configdialog General tab docstring to add new\nwidgets to the widget list.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=35770\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=35769\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=35660\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=35641\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=33987\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=34055\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=35591\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=35196\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=35598\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=28097\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=35208\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=35555\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=35521\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=22703\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=35213\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=34864\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=34864\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=35202\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=33000\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=23220\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=35099\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=35097\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=35093\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=35088\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=35087\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=34548\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=1529353\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=34047\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=34275\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=34120\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=33975\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=33905\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=33924\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=33906\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=33917\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=33904\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=33907\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=33856\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=33839\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=33855\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=33656\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=33768\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=33763\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=33664\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=33679\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=33642\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=33628\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=33564\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=21474\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=33204\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=32984\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=32940\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=32916\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=32905\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=32874\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=32837\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=32826\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=32831\n\n(59) https://bugs.python.org/issue?@action=redirect&bpo=32765\n\nFile: python3.12.info,  Node: Tools/Demos<24>,  Next: C API<41>,  Prev: IDLE<30>,  Up: Python 3 8 0 alpha 1\n\n1.22.46.10 Tools/Demos\n......................\n\n- bpo-35884(1): Add a benchmark script for timing various ways to\naccess variables: 'Tools/scripts/varaccessbenchmark.py'.\n\n- bpo-34989(2): python-gdb.py now handles errors on computing the\nline number of a Python frame.\n\n- bpo-20260(3): Argument Clinic now has non-bitwise unsigned int\nconverters.\n\n- bpo-32962(4): python-gdb now catches 'UnicodeDecodeError'\nexceptions when calling 'string()'.\n\n- bpo-32962(5): python-gdb now catches ValueError on readvar(): when\nPython has no debug symbols for example.\n\n- bpo-33189(6): 'pygettext.py' now recognizes only literal strings as\ndocstrings and translatable strings, and rejects bytes literals and\nf-string expressions.\n\n- bpo-31920(7): Fixed handling directories as arguments in the\n'pygettext' script.  Based on patch by Oleg Krasnikov.\n\n- bpo-29673(8): Fix pystackv and pystack gdbinit macros.\n\n- bpo-25427(9): Remove the pyvenv script in favor of 'python3 -m\nvenv' in order to lower confusion as to what Python interpreter a\nvirtual environment will be created for.\n\n- bpo-32885(10): Add an '-n' flag for 'Tools/scripts/pathfix.py' to\ndisable automatic backup creation (files with '~' suffix).\n\n- bpo-32222(11): Fix pygettext not extracting docstrings for\nfunctions with type annotated arguments.  Patch by Toby Harradine.\n\n- bpo-31583(12): Fix 2to3 for using with -add-suffix option but\nwithout -output-dir option for relative path to files in current\ndirectory.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=35884\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=34989\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=20260\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=32962\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=32962\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=33189\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=31920\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=29673\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=25427\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=32885\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=32222\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=31583\n\nFile: python3.12.info,  Node: C API<41>,  Prev: Tools/Demos<24>,  Up: Python 3 8 0 alpha 1\n\n1.22.46.11 C API\n................\n\n- bpo-35713(1): The 'PyByteArrayInit()' and 'PyByteArrayFini()'\nfunctions have been removed.  They did nothing since Python 2.7.4\nand Python 3.2.0, were excluded from the limited API (stable ABI),\nand were not documented.\n\n- bpo-33817(2): Fixed *note PyBytesResize(): 17d0. for empty bytes\nobjects.\n\n- bpo-35322(3): Fix memory leak in *note PyUnicodeEncodeLocale():\na0e. and *note PyUnicodeEncodeFSDefault(): 17d1. on error\nhandling.\n\n- bpo-35059(4): The following C macros have been converted to static\ninline functions: *note PyINCREF(): 2ce, *note PyDECREF(): 2cf,\n*note PyXINCREF(): 892, *note PyXDECREF(): 57d,\n'PyObjectINIT()', 'PyObjectINITVAR()'.\n\n- bpo-35296(5): 'make install' now also installs the internal API:\n'Include/internal/*.h' header files.\n\n- bpo-35081(6): Internal APIs surrounded by '#ifdef PyBUILDCORE'\nhave been moved from 'Include/*.h' headers to new header files\n'Include/internal/pycore*.h'.\n\n- bpo-35259(7): Conditionally declare *note PyFinalizeEx(): b67.\n(new in 3.6) based on PyLIMITEDAPI. Patch by Arthur Neufeld.\n\n- bpo-35081(8): The 'PyObjectGCTRACK()' and\n'PyObjectGCUNTRACK()' macros have been removed from the public C\nAPI.\n\n- bpo-35134(9): Creation of a new 'Include/cpython/' subdirectory.\n\n- bpo-34725(10): Adds PySetProgramFullPath so embedders may\noverride sys.executable\n\n- bpo-34910(11): Ensure that *note PyObjectPrint(): 17d2. always\nreturns '-1' on error.  Patch by Zackery Spytz.\n\n- bpo-34523(12): PyDecodeLocale() and PyEncodeLocale() now use the\nUTF-8 encoding on Windows if PyLegacyWindowsFSEncodingFlag is\nzero.\n\n- bpo-34193(13): Fix pluralization in TypeError messages in getargs.c\nand typeobject.c: '1 argument' instead of '1 arguments' and '1\nelement' instead of '1 elements'.\n\n- bpo-34127(14): Return grammatically correct error message based on\nargument count.  Patch by Karthikeyan Singaravelan.\n\n- bpo-23927(15): Fixed *note SystemError: 2d7. in *note\nPyArgParseTupleAndKeywords(): b68. when the 'w*' format unit is\nused for optional parameter.\n\n- bpo-32455(16): Added 'PyCompileOpcodeStackEffectWithJump()'.\n\n- bpo-34008(17): PyMain() can again be called after PyInitialize(),\nas in Python 3.6.\n\n- bpo-32500(18): Fixed error messages for *note PySequenceSize():\n17d3, *note PySequenceGetItem(): 17d4, *note PySequenceSetItem():\n17d5. and *note PySequenceDelItem(): 17d6. called with a mapping\nand *note PyMappingSize(): 17d7. called with a sequence.\n\n- bpo-33818(19): 'PyExceptionClassName()' will now return 'const\nchar *' instead of 'char *'.\n\n- bpo-33042(20): Embedding applications may once again call\nPySysResetWarnOptions, PySysAddWarnOption, and PySysAddXOption\nprior to calling PyInitialize.\n\n- bpo-32374(21): Document that mtraverse for multi-phase initialized\nmodules can be called with mstate=NULL, and add a sanity check\n\n- bpo-30863(22): *note PyUnicodeAsWideChar(): 17d8. and *note\nPyUnicodeAsWideCharString(): 6d4. no longer cache the 'wchart*'\nrepresentation of string objects.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=35713\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=33817\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=35322\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=35059\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=35296\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=35081\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=35259\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=35081\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=35134\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=34725\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=34910\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=34523\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=34193\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=34127\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=23927\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=32455\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=34008\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=32500\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=33818\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=33042\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=32374\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=30863\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 7 0 final,  Next: Python 3 7 0 release candidate 1,  Prev: Python 3 8 0 alpha 1,  Up: Changelog": {
            "content": "'Release date: 2018-06-27'\n\n* Menu:\n\n* Library: Library<47>.\n* C API: C API<42>.\n\nFile: python3.12.info,  Node: Library<47>,  Next: C API<42>,  Up: Python 3 7 0 final\n\n1.22.47.1 Library\n.................\n\n- bpo-33851(1): Fix *note ast.getdocstring(): 17db. for a node that\nlacks a docstring.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33851\n\nFile: python3.12.info,  Node: C API<42>,  Prev: Library<47>,  Up: Python 3 7 0 final\n\n1.22.47.2 C API\n...............\n\n- bpo-33932(1): Calling PyInitialize() twice does nothing, instead\nof failing with a fatal error: restore the Python 3.6 behaviour.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33932\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 7 0 release candidate 1,  Next: Python 3 7 0 beta 5,  Prev: Python 3 7 0 final,  Up: Changelog": {
            "content": "'Release date: 2018-06-12'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<47>.\n* Library: Library<48>.\n* Documentation: Documentation<47>.\n* Build: Build<44>.\n* Windows: Windows<43>.\n* IDLE: IDLE<31>.\n\nFile: python3.12.info,  Node: Core and Builtins<47>,  Next: Library<48>,  Up: Python 3 7 0 release candidate 1\n\n1.22.48.1 Core and Builtins\n...........................\n\n- bpo-33803(1): Fix a crash in hamt.c caused by enabling GC tracking\nfor an object that hadn't all of its fields set to NULL.\n\n- bpo-33706(2): Fix a crash in Python initialization when parsing the\ncommand line options.  Thanks Christoph Gohlke for the bug report\nand the fix!\n\n- bpo-30654(3): Fixed reset of the SIGINT handler to SIGDFL on\ninterpreter shutdown even when there was a custom handler set\npreviously.  Patch by Philipp Kerling.\n\n- bpo-31849(4): Fix signed/unsigned comparison warning in pyhash.c.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33803\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=33706\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=30654\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=31849\n\nFile: python3.12.info,  Node: Library<48>,  Next: Documentation<47>,  Prev: Core and Builtins<47>,  Up: Python 3 7 0 release candidate 1\n\n1.22.48.2 Library\n.................\n\n- bpo-30167(1): Prevent site.main() exception if PYTHONSTARTUP is\nset.  Patch by Steve Weber.\n\n- bpo-33812(2): Datetime instance d with non-None tzinfo, but with\nd.tzinfo.utcoffset(d) returning None is now treated as naive by the\nastimezone() method.\n\n- bpo-30805(3): Avoid race condition with debug logging\n\n- bpo-33694(4): asyncio: Fix a race condition causing data loss on\npausereading()/resumereading() when using the ProactorEventLoop.\n\n- bpo-32493(5): Correct test for 'uuidencbe' availability in\n'configure.ac'.  Patch by Michael Felt.\n\n- bpo-33792(6): Add asyncio.WindowsSelectorEventLoopPolicy and\nasyncio.WindowsProactorEventLoopPolicy.\n\n- bpo-33778(7): Update 'unicodedata''s database to Unicode version\n11.0.0.\n\n- bpo-33770(8): improve base64 exception message for encoded inputs\nof invalid length\n\n- bpo-33769(9): asyncio/starttls: Fix error message; cancel\ncallbacks in case of an unhandled error; mark SSLTransport as\nclosed if it is aborted.\n\n- bpo-33767(10): The concatenation ('+') and repetition ('*')\nsequence operations now raise *note TypeError: 28e. instead of\n*note SystemError: 2d7. when performed on *note mmap.mmap: 830.\nobjects.  Patch by Zackery Spytz.\n\n- bpo-33734(11): asyncio/ssl: Fix AttributeError, increase default\nhandshake timeout\n\n- bpo-11874(12): Use a better regex when breaking usage into\nwrappable parts.  Avoids bogus assertion errors from custom metavar\nstrings.\n\n- bpo-33582(13): Emit a deprecation warning for inspect.formatargspec\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30167\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=33812\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=30805\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=33694\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=32493\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=33792\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=33778\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=33770\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=33769\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=33767\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=33734\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=11874\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=33582\n\nFile: python3.12.info,  Node: Documentation<47>,  Next: Build<44>,  Prev: Library<48>,  Up: Python 3 7 0 release candidate 1\n\n1.22.48.3 Documentation\n.......................\n\n- bpo-33409(1): Clarified the relationship between PEP 538(2)'s\nPYTHONCOERCECLOCALE and PEP 540's PYTHONUTF8 mode.\n\n- bpo-33736(3): Improve the documentation of *note\nasyncio.openconnection(): 950, *note asyncio.startserver(): 951.\nand their UNIX socket counterparts.\n\n- bpo-31432(4): Clarify meaning of CERTNONE, CERTOPTIONAL, and\nCERTREQUIRED flags for ssl.SSLContext.verifymode.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33409\n\n(2) https://peps.python.org/pep-0538/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=33736\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=31432\n\nFile: python3.12.info,  Node: Build<44>,  Next: Windows<43>,  Prev: Documentation<47>,  Up: Python 3 7 0 release candidate 1\n\n1.22.48.4 Build\n...............\n\n- bpo-5755(1): Move '-Wstrict-prototypes' option to 'CFLAGSNODIST'\nfrom 'OPT'.  This option emitted annoying warnings when building\nextension modules written in C++.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=5755\n\nFile: python3.12.info,  Node: Windows<43>,  Next: IDLE<31>,  Prev: Build<44>,  Up: Python 3 7 0 release candidate 1\n\n1.22.48.5 Windows\n.................\n\n- bpo-33720(1): Reduces maximum marshal recursion depth on release\nbuilds.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33720\n\nFile: python3.12.info,  Node: IDLE<31>,  Prev: Windows<43>,  Up: Python 3 7 0 release candidate 1\n\n1.22.48.6 IDLE\n..............\n\n- bpo-33656(1): On Windows, add API call saying that tk scales for\nDPI. On Windows 8.1+ or 10, with DPI compatibility properties of\nthe Python binary unchanged, and a monitor resolution greater than\n96 DPI, this should make text and lines sharper.  It should\notherwise have no effect.\n\n- bpo-33768(2): Clicking on a context line moves that line to the top\nof the editor window.\n\n- bpo-33763(3): IDLE: Use read-only text widget for code context\ninstead of label widget.\n\n- bpo-33664(4): Scroll IDLE editor text by lines.  Previously, the\nmouse wheel and scrollbar slider moved text by a fixed number of\npixels, resulting in partial lines at the top of the editor box.\nThe change also applies to the shell and grep output windows, but\nnot to read-only text views.\n\n- bpo-33679(5): Enable theme-specific color configuration for Code\nContext.  Use the Highlights tab to see the setting for built-in\nthemes or add settings to custom themes.\n\n- bpo-33642(6): Display up to maxlines non-blank lines for Code\nContext.  If there is no current context, show a single blank line.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33656\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=33768\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=33763\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=33664\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=33679\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=33642\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 7 0 beta 5,  Next: Python 3 7 0 beta 4,  Prev: Python 3 7 0 release candidate 1,  Up: Changelog": {
            "content": "'Release date: 2018-05-30'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<48>.\n* Library: Library<49>.\n* Documentation: Documentation<48>.\n* Tests: Tests<44>.\n* Build: Build<45>.\n* macOS: macOS<35>.\n* IDLE: IDLE<32>.\n\nFile: python3.12.info,  Node: Core and Builtins<48>,  Next: Library<49>,  Up: Python 3 7 0 beta 5\n\n1.22.49.1 Core and Builtins\n...........................\n\n- bpo-33622(1): Fixed a leak when the garbage collector fails to add\nan object with the 'del' method or referenced by it into the\n*note gc.garbage: 1035. list.  *note PyGCCollect(): 7b2. can now\nbe called when an exception is set and preserves it.\n\n- bpo-33509(2): Fix moduleglobals parameter of\nwarnings.warnexplicit(): don't crash if moduleglobals is not a\ndict.\n\n- bpo-20104(3): The new 'os.posixspawn' added in 3.7.0b1 was removed\nas we are still working on what the API should look like.  Expect\nthis in 3.8 instead.\n\n- bpo-33475(4): Fixed miscellaneous bugs in converting annotations to\nstrings and optimized parentheses in the string representation.\n\n- bpo-33391(5): Fix a leak in setsymmetricdifference().\n\n- bpo-28055(6): Fix unaligned accesses in siphash24().  Patch by Rolf\nEike Beer.\n\n- bpo-32911(7): Due to unexpected compatibility issues discovered\nduring downstream beta testing, reverted bpo-29463(8).  'docstring'\nfield is removed from Module, ClassDef, FunctionDef, and\nAsyncFunctionDef ast nodes which was added in 3.7a1.  Docstring\nexpression is restored as a first statement in their body.  Based\non patch by Inada Naoki.\n\n- bpo-21983(9): Fix a crash in 'ctypes.cast()' in case the type\nargument is a ctypes structured data type.  Patch by Eryk Sun and\nOren Milman.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33622\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=33509\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=20104\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=33475\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=33391\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=28055\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=32911\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=29463\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=21983\n\nFile: python3.12.info,  Node: Library<49>,  Next: Documentation<48>,  Prev: Core and Builtins<48>,  Up: Python 3 7 0 beta 5\n\n1.22.49.2 Library\n.................\n\n- bpo-32751(1): When cancelling the task due to a timeout, *note\nasyncio.waitfor(): 3c8. will now wait until the cancellation is\ncomplete.\n\n- bpo-32684(2): Fix gather to propagate cancellation of itself even\nwith returnexceptions.\n\n- bpo-33654(3): Support protocol type switching in\nSSLTransport.setprotocol().\n\n- bpo-33674(4): Pause the transport as early as possible to further\nreduce the risk of datareceived() being called before\nconnectionmade().\n\n- bpo-33674(5): Fix a race condition in SSLProtocol.connectionmade()\nof asyncio.sslproto: start immediately the handshake instead of\nusing callsoon().  Previously, datareceived() could be called\nbefore the handshake started, causing the handshake to hang or\nfail.\n\n- bpo-31647(6): Fixed bug where calling writeeof() on a\nSelectorSocketTransport after it's already closed raises\nAttributeError.\n\n- bpo-32610(7): Make asyncio.alltasks() return only pending tasks.\n\n- bpo-32410(8): Avoid blocking on file IO in sendfile fallback code\n\n- bpo-33469(9): Fix RuntimeError after closing loop that used\nruninexecutor\n\n- bpo-33672(10): Fix Task.repr crash with Cython's bogus\ncoroutines\n\n- bpo-33654(11): Fix transport.setprotocol() to support switching\nbetween asyncio.Protocol and asyncio.BufferedProtocol.  Fix\nloop.starttls() to work with asyncio.BufferedProtocols.\n\n- bpo-33652(12): Pickles of type variables and subscripted generics\nare now future-proof and compatible with older Python versions.\n\n- bpo-32493(13): Fixed *note uuid.uuid1(): 9ec. on FreeBSD.\n\n- bpo-33618(14): Finalize and document preliminary and experimental\nTLS 1.3 support with OpenSSL 1.1.1\n\n- bpo-33623(15): Fix possible SIGSGV when asyncio.Future is created\nin del\n\n- bpo-30877(16): Fixed a bug in the Python implementation of the JSON\ndecoder that prevented the cache of parsed strings from clearing\nafter finishing the decoding.  Based on patch by c-fos.\n\n- bpo-33570(17): Change TLS 1.3 cipher suite settings for\ncompatibility with OpenSSL 1.1.1-pre6 and newer.  OpenSSL 1.1.1\nwill have TLS 1.3 ciphers enabled by default.\n\n- bpo-28556(18): Do not simplify arguments to 'typing.Union'.  Now\n'Union[Manager, Employee]' is not simplified to 'Employee' at\nruntime.  Such simplification previously caused several bugs and\nlimited possibilities for introspection.\n\n- bpo-33540(19): Add a new 'blockonclose' class attribute to\n'ForkingMixIn' and 'ThreadingMixIn' classes of *note socketserver:\nc7.\n\n- bpo-33548(20): tempfile.candidatetempdirlist should consider\ncommon TEMP locations\n\n- bpo-33109(21): argparse subparsers are once again not required by\ndefault, reverting the change in behavior introduced by\nbpo-26510(22) in 3.7.0a2.\n\n- bpo-33536(23): dataclasses.makedataclass now checks for invalid\nfield names and duplicate fields.  Also, added a check for invalid\nfield specifications.\n\n- bpo-33542(24): Prevent 'uuid.getnode' from using a DUID instead of\na MAC on Windows.  Patch by Zvi Effron\n\n- bpo-26819(25): Fix race condition with\n'ReadTransport.resumereading' in Windows proactor event loop.\n\n- Fix failure in 'typing.gettypehints()' when ClassVar was provided\nas a string forward reference.\n\n- bpo-33505(26): Optimize asyncio.ensurefuture() by reordering if\nchecks: 1.17x faster.\n\n- bpo-33497(27): Add errors param to cgi.parsemultipart and make an\nencoding in FieldStorage use the given errors (needed for Twisted).\nPatch by Amber Brown.\n\n- bpo-33495(28): Change dataclasses.Fields repr to use the repr of\neach of its members, instead of str.  This makes it more clear what\neach field actually represents.  This is especially true for the\n'type' member.\n\n- bpo-33453(29): Fix dataclasses to work if using literal string type\nannotations or if using PEP 563 \"Postponed Evaluation of\nAnnotations\".  Only specific string prefixes are detected for both\nClassVar (\"ClassVar\" and \"typing.ClassVar\") and InitVar (\"InitVar\"\nand \"dataclasses.InitVar\").\n\n- bpo-28556(30): Minor fixes in typing module: add annotations to\n'NamedTuple.new', pass '*args' and 'kwds' in\n'Generic.new'.  Original PRs by Paulius ??arka and Chad\nDombrova.\n\n- bpo-20087(31): Updated alias mapping with glibc 2.27 supported\nlocales.\n\n- bpo-33422(32): Fix trailing quotation marks getting deleted when\nlooking up byte/string literals on pydoc.  Patch by Andre's Delfino.\n\n- bpo-28167(33): The function 'platform.linuxdistribution' and\n'platform.dist' now trigger a 'DeprecationWarning' and have been\nmarked for removal in Python 3.8\n\n- bpo-33197(34): Update error message when constructing invalid\ninspect.Parameters Patch by Donghee Na.\n\n- bpo-33263(35): Fix FD leak in 'SelectorSocketTransport' Patch by\nVlad Starostin.\n\n- bpo-32861(36): The urllib.robotparser's 'str' representation\nnow includes wildcard entries and the \"Crawl-delay\" and\n\"Request-rate\" fields.  Patch by Michael Lazar.\n\n- bpo-32257(37): The ssl module now contains OPNORENEGOTIATION\nconstant, available with OpenSSL 1.1.0h or 1.1.1.\n\n- bpo-16865(38): Support arrays >=2GiB in *note ctypes: 28.  Patch by\nSegev Finer.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32751\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32684\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=33654\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=33674\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=33674\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=31647\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=32610\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=32410\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=33469\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=33672\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=33654\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=33652\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=32493\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=33618\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=33623\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=30877\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=33570\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=28556\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=33540\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=33548\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=33109\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=26510\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=33536\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=33542\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=26819\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=33505\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=33497\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=33495\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=33453\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=28556\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=20087\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=33422\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=28167\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=33197\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=33263\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=32861\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=32257\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=16865\n\nFile: python3.12.info,  Node: Documentation<48>,  Next: Tests<44>,  Prev: Library<49>,  Up: Python 3 7 0 beta 5\n\n1.22.49.3 Documentation\n.......................\n\n- bpo-23859(1): Document that 'asyncio.wait()' does not cancel its\nfutures on timeout.\n\n- bpo-32436(2): Document PEP 567(3) changes to asyncio.\n\n- bpo-33604(4): Update HMAC md5 default to a DeprecationWarning, bump\nremoval to 3.8.\n\n- bpo-33503(5): Fix broken pypi link\n\n- bpo-33421(6): Add missing documentation for\n'typing.AsyncContextManager'.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23859\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32436\n\n(3) https://peps.python.org/pep-0567/\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=33604\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=33503\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=33421\n\nFile: python3.12.info,  Node: Tests<44>,  Next: Build<45>,  Prev: Documentation<48>,  Up: Python 3 7 0 beta 5\n\n1.22.49.4 Tests\n...............\n\n- bpo-33655(1): Ignore testposixfallocate failures on BSD platforms\nthat might be due to running on ZFS.\n\n- bpo-32604(2): Remove the xxsubinterpreters module (meant for\ntesting) and associated helpers.  This module was originally added\nrecently in 3.7b1.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33655\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32604\n\nFile: python3.12.info,  Node: Build<45>,  Next: macOS<35>,  Prev: Tests<44>,  Up: Python 3 7 0 beta 5\n\n1.22.49.5 Build\n...............\n\n- bpo-33614(1): Ensures module definition files for the stable ABI on\nWindows are correctly regenerated.\n\n- bpo-33522(2): Enable CI builds on Visual Studio Team Services at\n'https://python.visualstudio.com/cpython'\n\n- bpo-33012(3): Add '-Wno-cast-function-type' for gcc 8 for silencing\nwarnings about function casts like casting to PyCFunction in method\ndefinition lists.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33614\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=33522\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=33012\n\nFile: python3.12.info,  Node: macOS<35>,  Next: IDLE<32>,  Prev: Build<45>,  Up: Python 3 7 0 beta 5\n\n1.22.49.6 macOS\n...............\n\n- bpo-13631(1): The .editrc file in user's home directory is now\nprocessed correctly during the readline initialization through\neditline emulation on macOS.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=13631\n\nFile: python3.12.info,  Node: IDLE<32>,  Prev: macOS<35>,  Up: Python 3 7 0 beta 5\n\n1.22.49.7 IDLE\n..............\n\n- bpo-33628(1): IDLE: Cleanup codecontext.py and its test.\n\n- bpo-33564(2): IDLE's code context now recognizes async as a block\nopener.\n\n- bpo-32831(3): Add docstrings and tests for codecontext.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33628\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=33564\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=32831\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 7 0 beta 4,  Next: Python 3 7 0 beta 3,  Prev: Python 3 7 0 beta 5,  Up: Changelog": {
            "content": "'Release date: 2018-05-02'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<49>.\n* Library: Library<50>.\n* Documentation: Documentation<49>.\n* Tests: Tests<45>.\n* Build: Build<46>.\n* Windows: Windows<44>.\n* macOS: macOS<36>.\n* IDLE: IDLE<33>.\n* Tools/Demos: Tools/Demos<25>.\n\nFile: python3.12.info,  Node: Core and Builtins<49>,  Next: Library<50>,  Up: Python 3 7 0 beta 4\n\n1.22.50.1 Core and Builtins\n...........................\n\n- bpo-33363(1): Raise a SyntaxError for 'async with' and 'async for'\nstatements outside of async functions.\n\n- bpo-33128(2): Fix a bug that causes PathFinder to appear twice on\nsys.metapath.  Patch by Pablo Galindo Salgado.\n\n- bpo-33312(3): Fixed clang ubsan (undefined behavior sanitizer)\nwarnings in dictobject.c by adjusting how the internal struct\ndictkeysobject shared keys structure is declared.\n\n- bpo-33231(4): Fix potential memory leak in 'normalizestring()'.\n\n- bpo-33205(5): Change dict growth function from\n'rounduptopower2(used*2+hashtablesize/2)' to\n'rounduptopower2(used*3)'.  Previously, dict is shrinked only\nwhen 'used == 0'.  Now dict has more chance to be shrinked.\n\n- bpo-29922(6): Improved error messages in 'async with' when\n'aenter()' or 'aexit()' return non-awaitable object.\n\n- bpo-33199(7): Fix 'maversiontag' in dict implementation is\nuninitialized when copying from key-sharing dict.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33363\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=33128\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=33312\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=33231\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=33205\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=29922\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=33199\n\nFile: python3.12.info,  Node: Library<50>,  Next: Documentation<49>,  Prev: Core and Builtins<49>,  Up: Python 3 7 0 beta 4\n\n1.22.50.2 Library\n.................\n\n- bpo-33281(1): Fix ctypes.util.findlibrary regression on macOS.\n\n- bpo-33383(2): Fixed crash in the get() method of the *note\ndbm.ndbm: 32. database object when it is called with a single\nargument.\n\n- bpo-33329(3): Fix multiprocessing regression on newer glibcs\n\n- bpo-991266(4): Fix quoting of the 'Comment' attribute of *note\nhttp.cookies.SimpleCookie: 17c2.\n\n- bpo-33131(5): Upgrade bundled version of pip to 10.0.1.\n\n- bpo-33308(6): Fixed a crash in the 'parser' module when converting\nan ST object to a tree of tuples or lists with 'lineinfo=False'\nand 'colinfo=True'.\n\n- bpo-33266(7): lib2to3 now recognizes 'rf'...'' strings.\n\n- bpo-11594(8): Ensure line-endings are respected when using lib2to3.\n\n- bpo-33254(9): Have *note importlib.resources.contents(): 4f9. and\n*note importlib.abc.ResourceReader.contents(): 17c3. return an\n*note iterable: 109d. instead of an *note iterator: 16a9.\n\n- bpo-33256(10): Fix display of '<module>' call in the html produced\nby 'cgitb.html()'.  Patch by Ste'phane Blondon.\n\n- bpo-33185(11): Fixed regression when running pydoc with the *note\n-m: 3a5. switch.  (The regression was introduced in 3.7.0b3 by the\nresolution of bpo-33053(12)) This fix also changed pydoc to add\n'os.getcwd()' to *note sys.path: 32c. when necessary, rather than\nadding '\".\"'.\n\n- bpo-33169(13): Delete entries of 'None' in *note\nsys.pathimportercache: 3a9. when\n'importlib.machinery.invalidatecaches()' is called.\n\n- bpo-33217(14): Deprecate looking up non-Enum objects in Enum\nclasses and Enum members (will raise *note TypeError: 28e. in\n3.8+).\n\n- bpo-33203(15): 'random.Random.choice()' now raises 'IndexError' for\nempty sequences consistently even when called from subclasses\nwithout a 'getrandbits()' implementation.\n\n- bpo-33224(16): Update difflib.mdiff() for PEP 479(17).  Convert an\nuncaught StopIteration in a generator into a return-statement.\n\n- bpo-33209(18): End framing at the end of C implementation of *note\npickle.Pickler.dump(): 17c4.\n\n- bpo-20104(19): Improved error handling and fixed a reference leak\nin *note os.posixspawn(): 885.\n\n- bpo-33175(20): In dataclasses, Field.setname now looks up the\nsetname special method on the class, not the instance, of the\ndefault value.\n\n- bpo-33097(21): Raise RuntimeError when 'executor.submit' is called\nduring interpreter shutdown.\n\n- bpo-31908(22): Fix output of cover files for 'trace' module\ncommand-line tool.  Previously emitted cover files only when\n'--missing' option was used.  Patch by Michael Selik.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33281\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=33383\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=33329\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=991266\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=33131\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=33308\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=33266\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=11594\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=33254\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=33256\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=33185\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=33053\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=33169\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=33217\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=33203\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=33224\n\n(17) https://peps.python.org/pep-0479/\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=33209\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=20104\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=33175\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=33097\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=31908\n\nFile: python3.12.info,  Node: Documentation<49>,  Next: Tests<45>,  Prev: Library<50>,  Up: Python 3 7 0 beta 4\n\n1.22.50.3 Documentation\n.......................\n\n- bpo-33378(1): Add Korean language switcher for\n'https://docs.python.org/3/'\n\n- bpo-33276(2): Clarify that the 'path' attribute on modules\ncannot be just any value.\n\n- bpo-33201(3): Modernize documentation for writing C extension\ntypes.\n\n- bpo-33195(4): Deprecate 'PyUNICODE' usage in 'c-api/arg' document.\n'PyUNICODE' related APIs are deprecated since Python 3.3, but it\nis missed in the document.\n\n- bpo-8243(5): Add a note about curses.addch and curses.addstr\nexception behavior when writing outside a window, or pad.\n\n- bpo-32337(6): Update documentation related with 'dict' order.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33378\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=33276\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=33201\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=33195\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=8243\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=32337\n\nFile: python3.12.info,  Node: Tests<45>,  Next: Build<46>,  Prev: Documentation<49>,  Up: Python 3 7 0 beta 4\n\n1.22.50.4 Tests\n...............\n\n- bpo-33358(1): Fix\n'testembed.testpreinitializationsysoptions()' when the\ninterpreter is built with '--enable-shared'.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33358\n\nFile: python3.12.info,  Node: Build<46>,  Next: Windows<44>,  Prev: Tests<45>,  Up: Python 3 7 0 beta 4\n\n1.22.50.5 Build\n...............\n\n- bpo-33394(1): Enable the verbose build for extension modules, when\nGNU make is passed macros on the command line.\n\n- bpo-33393(2): Update config.guess and config.sub files.\n\n- bpo-33377(3): Add new triplets for mips r6 and riscv variants (used\nin extension suffixes).\n\n- bpo-32232(4): By default, modules configured in 'Modules/Setup' are\nno longer built with '-DPyBUILDCORE'.  Instead, modules that\nspecifically need that preprocessor definition include it in their\nindividual entries.\n\n- bpo-33182(5): The embedding tests can once again be built with\nclang 6.0\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33394\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=33393\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=33377\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=32232\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=33182\n\nFile: python3.12.info,  Node: Windows<44>,  Next: macOS<36>,  Prev: Build<46>,  Up: Python 3 7 0 beta 4\n\n1.22.50.6 Windows\n.................\n\n- bpo-33184(1): Update Windows installer to use OpenSSL 1.1.0h.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33184\n\nFile: python3.12.info,  Node: macOS<36>,  Next: IDLE<33>,  Prev: Windows<44>,  Up: Python 3 7 0 beta 4\n\n1.22.50.7 macOS\n...............\n\n- bpo-33184(1): Update macOS installer build to use OpenSSL 1.1.0h.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33184\n\nFile: python3.12.info,  Node: IDLE<33>,  Next: Tools/Demos<25>,  Prev: macOS<36>,  Up: Python 3 7 0 beta 4\n\n1.22.50.8 IDLE\n..............\n\n- bpo-21474(1): Update word/identifier definition from ascii to\nunicode.  In text and entry boxes, this affects selection by\ndouble-click, movement left/right by control-left/right, and\ndeletion left/right by control-BACKSPACE/DEL.\n\n- bpo-33204(2): IDLE: consistently color invalid string prefixes.  A\n'u' string prefix cannot be paired with either 'r' or 'f'.\nConsistently color as much of the prefix, starting at the right, as\nis valid.  Revise and extend colorizer test.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=21474\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=33204\n\nFile: python3.12.info,  Node: Tools/Demos<25>,  Prev: IDLE<33>,  Up: Python 3 7 0 beta 4\n\n1.22.50.9 Tools/Demos\n.....................\n\n- bpo-33189(1): 'pygettext.py' now recognizes only literal strings as\ndocstrings and translatable strings, and rejects bytes literals and\nf-string expressions.\n\n- bpo-31920(2): Fixed handling directories as arguments in the\n'pygettext' script.  Based on patch by Oleg Krasnikov.\n\n- bpo-29673(3): Fix pystackv and pystack gdbinit macros.\n\n- bpo-31583(4): Fix 2to3 for using with -add-suffix option but\nwithout -output-dir option for relative path to files in current\ndirectory.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33189\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31920\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=29673\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=31583\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 7 0 beta 3,  Next: Python 3 7 0 beta 2,  Prev: Python 3 7 0 beta 4,  Up: Changelog": {
            "content": "'Release date: 2018-03-29'\n\n* Menu:\n\n* Security: Security<32>.\n* Core and Builtins: Core and Builtins<50>.\n* Library: Library<51>.\n* Documentation: Documentation<50>.\n* Tests: Tests<46>.\n* Build: Build<47>.\n* Windows: Windows<45>.\n* macOS: macOS<37>.\n* IDLE: IDLE<34>.\n* Tools/Demos: Tools/Demos<26>.\n* C API: C API<43>.\n\nFile: python3.12.info,  Node: Security<32>,  Next: Core and Builtins<50>,  Up: Python 3 7 0 beta 3\n\n1.22.51.1 Security\n..................\n\n- bpo-33136(1): Harden ssl module against LibreSSL CVE-2018-8970.\nX509VERIFYPARAMset1host() is called with an explicit namelen.\nA new test ensures that NULL bytes are not allowed.\n\n- bpo-33001(2): Minimal fix to prevent buffer overrun in os.symlink\non Windows\n\n- bpo-32981(3): Regexes in difflib and poplib were vulnerable to\ncatastrophic backtracking.  These regexes formed potential DOS\nvectors (REDOS). They have been refactored.  This resolves\nCVE-2018-1060 and CVE-2018-1061.  Patch by Jamie Davis.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33136\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=33001\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=32981\n\nFile: python3.12.info,  Node: Core and Builtins<50>,  Next: Library<51>,  Prev: Security<32>,  Up: Python 3 7 0 beta 3\n\n1.22.51.2 Core and Builtins\n...........................\n\n- bpo-33053(1): When using the -m switch, sys.path[0] is now\nexplicitly expanded as the 'starting' working directory, rather\nthan being left as the empty path (which allows imports from the\ncurrent working directory at the time of the import)\n\n- bpo-33018(2): Improve consistency of errors raised by\n'issubclass()' when called with a non-class and an abstract base\nclass as the first and second arguments, respectively.  Patch by\nJosh Bronson.\n\n- bpo-33041(3): Fixed jumping when the function contains an 'async\nfor' loop.\n\n- bpo-33026(4): Fixed jumping out of \"with\" block by setting\nflineno.\n\n- bpo-33005(5): Fix a crash on fork when using a custom memory\nallocator (ex: using PYTHONMALLOC env var).  PyGILStateReinit()\nand PyInterpreterStateEnable() now use the default RAW memory\nallocator to allocate a new interpreters mutex on fork.\n\n- bpo-17288(6): Prevent jumps from 'return' and 'exception' trace\nevents.\n\n- bpo-32836(7): Don't use temporary variables in cases of\nlist/dict/set comprehensions\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33053\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=33018\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=33041\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=33026\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=33005\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=17288\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=32836\n\nFile: python3.12.info,  Node: Library<51>,  Next: Documentation<50>,  Prev: Core and Builtins<50>,  Up: Python 3 7 0 beta 3\n\n1.22.51.3 Library\n.................\n\n- bpo-33141(1): Have Field objects pass through setname to their\ndefault values, if they have their own setname.\n\n- bpo-33096(2): Allow ttk.Treeview.insert to insert iid that has a\nfalse boolean value.  Note iid=0 and iid=False would be same.\nPatch by Garvit Khatri.\n\n- bpo-32873(3): Treat type variables and special typing forms as\nimmutable by copy and pickle.  This fixes several minor issues and\ninconsistencies, and improves backwards compatibility with Python\n3.6.\n\n- bpo-33134(4): When computing dataclass's hash, use the lookup\ntable to contain the function which returns the hash value.\nThis is an improvement over looking up a string, and then testing\nthat string to see what to do.\n\n- bpo-33127(5): The ssl module now compiles with LibreSSL 2.7.1.\n\n- bpo-32505(6): Raise TypeError if a member variable of a dataclass\nis of type Field, but doesn't have a type annotation.\n\n- bpo-33078(7): Fix the failure on OSX caused by the tests relying on\nsemgetvalue\n\n- bpo-33116(8): Add 'Field' to dataclasses.all.\n\n- bpo-32896(9): Fix an error where subclassing a dataclass with a\nfield that uses a defaultfactory would generate an incorrect\nclass.\n\n- bpo-33100(10): Dataclasses: If a field has a default value that's a\nMemberDescriptorType, then it's from that field being in slots,\nnot an actual default value.\n\n- bpo-32953(11): If a non-dataclass inherits from a frozen dataclass,\nallow attributes to be added to the derived class.  Only attributes\nfrom the frozen dataclass cannot be assigned to.  Require all\ndataclasses in a hierarchy to be either all frozen or all\nnon-frozen.\n\n- bpo-33061(12): Add missing 'NoReturn' to 'all' in typing.py\n\n- bpo-33078(13): Fix the size handling in multiprocessing.Queue when\na pickling error occurs.\n\n- bpo-33064(14): lib2to3 now properly supports trailing commas after\n'*args' and 'kwargs' in function signatures.\n\n- bpo-33056(15): FIX properly close leaking fds in\nconcurrent.futures.ProcessPoolExecutor.\n\n- bpo-33021(16): Release the GIL during fstat() calls, avoiding hang\nof all threads when calling mmap.mmap(), os.urandom(), and\nrandom.seed().  Patch by Nir Soffer.\n\n- bpo-31804(17): Avoid failing in multiprocessing.Process if the\nstandard streams are closed or None at exit.\n\n- bpo-33037(18): Skip sending/receiving data after SSL transport\nclosing.\n\n- bpo-27683(19): Fix a regression in *note ipaddress: 7a. that result\nof 'hosts()' is empty when the network is constructed by a tuple\ncontaining an integer mask and only 1 bit left for addresses.\n\n- bpo-32999(20): Fix C implementation of 'ABC.subclasscheck(cls,\nsubclass)' crashed when 'subclass' is not a type object.\n\n- bpo-33009(21): Fix inspect.signature() for single-parameter\npartialmethods.\n\n- bpo-32969(22): Expose several missing constants in zlib and fix\ncorresponding documentation.\n\n- bpo-32056(23): Improved exceptions raised for invalid number of\nchannels and sample width when read an audio file in modules *note\naifc: 5, *note wave: 10e. and *note sunau: d1.\n\n- bpo-32844(24): Fix wrong redirection of a low descriptor (0 or 1)\nto stderr in subprocess if another low descriptor is closed.\n\n- bpo-32857(25): In *note tkinter: ea, 'aftercancel(None)' now\nraises a *note ValueError: 183. instead of canceling the first\nscheduled function.  Patch by Cheryl Sabella.\n\n- bpo-31639(26): http.server now exposes a ThreadedHTTPServer class\nand uses it when the module is run with '-m' to cope with web\nbrowsers pre-opening sockets.\n\n- bpo-27645(27): *note sqlite3.Connection: 1d9. now exposes a *note\nbackup: 9bb. method, if the underlying SQLite library is at version\n3.6.11 or higher.  Patch by Lele Gaifax.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33141\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=33096\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=32873\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=33134\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=33127\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=32505\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=33078\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=33116\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=32896\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=33100\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=32953\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=33061\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=33078\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=33064\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=33056\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=33021\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=31804\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=33037\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=27683\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=32999\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=33009\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=32969\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=32056\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=32844\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=32857\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=31639\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=27645\n\nFile: python3.12.info,  Node: Documentation<50>,  Next: Tests<46>,  Prev: Library<51>,  Up: Python 3 7 0 beta 3\n\n1.22.51.4 Documentation\n.......................\n\n- bpo-33126(1): Document PyBufferToContiguous().\n\n- bpo-27212(2): Modify documentation for the 'islice()' recipe to\nconsume initial values up to the start index.\n\n- bpo-28247(3): Update *note zipapp: 12a. documentation to describe\nhow to make standalone applications.\n\n- bpo-18802(4): Documentation changes for ipaddress.  Patch by Jon\nFoster and Berker Peksag.\n\n- bpo-27428(5): Update documentation to clarify that\n'WindowsRegistryFinder' implements 'MetaPathFinder'.  (Patch by\nHimanshu Lakhara)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33126\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=27212\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=28247\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=18802\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=27428\n\nFile: python3.12.info,  Node: Tests<46>,  Next: Build<47>,  Prev: Documentation<50>,  Up: Python 3 7 0 beta 3\n\n1.22.51.5 Tests\n...............\n\n- bpo-32872(1): Avoid regrtest compatibility issue with namespace\npackages.\n\n- bpo-32517(2): Fix failing 'testasyncio' on macOS 10.12.2+ due to\ntransport of 'KqueueSelector' loop was not being closed.\n\n- bpo-19417(3): Add testbdb.py.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32872\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32517\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=19417\n\nFile: python3.12.info,  Node: Build<47>,  Next: Windows<45>,  Prev: Tests<46>,  Up: Python 3 7 0 beta 3\n\n1.22.51.6 Build\n...............\n\n- bpo-33163(1): Upgrade pip to 9.0.3 and setuptools to v39.0.1.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33163\n\nFile: python3.12.info,  Node: Windows<45>,  Next: macOS<37>,  Prev: Build<47>,  Up: Python 3 7 0 beta 3\n\n1.22.51.7 Windows\n.................\n\n- bpo-33016(1): Fix potential use of uninitialized memory in\nnt.getfinalpathname\n\n- bpo-32903(2): Fix a memory leak in os.chdir() on Windows if the\ncurrent directory is set to a UNC path.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33016\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32903\n\nFile: python3.12.info,  Node: macOS<37>,  Next: IDLE<34>,  Prev: Windows<45>,  Up: Python 3 7 0 beta 3\n\n1.22.51.8 macOS\n...............\n\n- bpo-32726(1): Build and link with private copy of Tcl/Tk 8.6 for\nthe macOS 10.6+ installer.  The 10.9+ installer variant already\ndoes this.  This means that the Python 3.7 provided by the\npython.org macOS installers no longer need or use any external\nversions of Tcl/Tk, either system-provided or user-installed, such\nas ActiveTcl.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32726\n\nFile: python3.12.info,  Node: IDLE<34>,  Next: Tools/Demos<26>,  Prev: macOS<37>,  Up: Python 3 7 0 beta 3\n\n1.22.51.9 IDLE\n..............\n\n- bpo-32984(1): Set 'file' while running a startup file.  Like\nPython, IDLE optionally runs one startup file in the Shell window\nbefore presenting the first interactive input prompt.  For IDLE,\n'-s' runs a file named in environmental variable 'IDLESTARTUP' or\n*note PYTHONSTARTUP: e3b.; '-r file' runs 'file'.  Python sets\n'file' to the startup file name before running the file and\nunsets it before the first prompt.  IDLE now does the same when run\nnormally, without the '-n' option.\n\n- bpo-32940(2): Simplify and rename StringTranslatePseudoMapping in\npyparse.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32984\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32940\n\nFile: python3.12.info,  Node: Tools/Demos<26>,  Next: C API<43>,  Prev: IDLE<34>,  Up: Python 3 7 0 beta 3\n\n1.22.51.10 Tools/Demos\n......................\n\n- bpo-32885(1): Add an '-n' flag for 'Tools/scripts/pathfix.py' to\ndisable automatic backup creation (files with '~' suffix).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32885\n\nFile: python3.12.info,  Node: C API<43>,  Prev: Tools/Demos<26>,  Up: Python 3 7 0 beta 3\n\n1.22.51.11 C API\n................\n\n- bpo-33042(1): Embedding applications may once again call\nPySysResetWarnOptions, PySysAddWarnOption, and PySysAddXOption\nprior to calling PyInitialize.\n\n- bpo-32374(2): Document that mtraverse for multi-phase initialized\nmodules can be called with mstate=NULL, and add a sanity check\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33042\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32374\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 7 0 beta 2,  Next: Python 3 7 0 beta 1,  Prev: Python 3 7 0 beta 3,  Up: Changelog": {
            "content": "'Release date: 2018-02-27'\n\n* Menu:\n\n* Security: Security<33>.\n* Core and Builtins: Core and Builtins<51>.\n* Library: Library<52>.\n* Documentation: Documentation<51>.\n* Tests: Tests<47>.\n* Build: Build<48>.\n* Windows: Windows<46>.\n* macOS: macOS<38>.\n* IDLE: IDLE<35>.\n* Tools/Demos: Tools/Demos<27>.\n\nFile: python3.12.info,  Node: Security<33>,  Next: Core and Builtins<51>,  Up: Python 3 7 0 beta 2\n\n1.22.52.1 Security\n..................\n\n- bpo-28414(1): The ssl module now allows users to perform their own\nIDN en/decoding when using SNI.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28414\n\nFile: python3.12.info,  Node: Core and Builtins<51>,  Next: Library<52>,  Prev: Security<33>,  Up: Python 3 7 0 beta 2\n\n1.22.52.2 Core and Builtins\n...........................\n\n- bpo-32889(1): Update Valgrind suppression list to account for the\nrename of 'PyADDRESSINRANG' to 'addressinrange'.\n\n- bpo-31356(2): Remove the new API added in bpo-31356(3)\n(gc.ensuredisabled() context manager).\n\n- bpo-32305(4): For namespace packages, ensure that both 'file'\nand 'spec.origin' are set to None.\n\n- bpo-32303(5): Make sure 'spec.loader' matches 'loader' for\nnamespace packages.\n\n- bpo-32711(6): Fix the warning messages for Python/astunparse.c.\nPatch by Ste'phane Wirtel\n\n- bpo-32583(7): Fix possible crashing in builtin Unicode decoders\ncaused by write out-of-bound errors when using customized decode\nerror handlers.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32889\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31356\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=31356\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=32305\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=32303\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=32711\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=32583\n\nFile: python3.12.info,  Node: Library<52>,  Next: Documentation<51>,  Prev: Core and Builtins<51>,  Up: Python 3 7 0 beta 2\n\n1.22.52.3 Library\n.................\n\n- bpo-32960(1): For dataclasses, disallow inheriting frozen from\nnon-frozen classes, and also disallow inheriting non-frozen from\nfrozen classes.  This restriction will be relaxed at a future date.\n\n- bpo-32713(2): Fixed tarfile.itn handling of out-of-bounds float\nvalues.  Patch by Joffrey Fuhrer.\n\n- bpo-32951(3): Direct instantiation of SSLSocket and SSLObject\nobjects is now prohibited.  The constructors were never documented,\ntested, or designed as public constructors.  Users were suppose to\nuse ssl.wrapsocket() or SSLContext.\n\n- bpo-32929(4): Remove the tri-state parameter \"hash\", and add the\nboolean \"unsafehash\".  If unsafehash is True, add a hash\nfunction, but if a hash exists, raise TypeError.  If\nunsafehash is False, add a hash based on the values of eq= and\nfrozen=.  The unsafehash=False behavior is the same as the old\nhash=None behavior.  unsafehash=False is the default, just as\nhash=None used to be.\n\n- bpo-32947(5): Add OPENABLEMIDDLEBOXCOMPAT and test workaround\nfor TLSv1.3 for future compatibility with OpenSSL 1.1.1.\n\n- bpo-30622(6): The ssl module now detects missing NPN support in\nLibreSSL.\n\n- bpo-32922(7): dbm.open() now encodes filename with the filesystem\nencoding rather than default encoding.\n\n- bpo-32859(8): In 'os.dup2', don't check every call whether the\n'dup3' syscall exists or not.\n\n- bpo-32556(9): nt.getfinalpathname, nt.getvolumepathname and\nnt.getdiskusage now correctly convert from bytes.\n\n- bpo-25988(10): Emit a *note DeprecationWarning: 179. when using or\nimporting an ABC directly from *note collections: 1b. rather than\nfrom *note collections.abc: 1c.\n\n- bpo-21060(11): Rewrite confusing message from setup.py upload from\n\"No dist file created in earlier command\" to the more helpful \"Must\ncreate and upload files in one command\".\n\n- bpo-32852(12): Make sure sys.argv remains as a list when running\ntrace.\n\n- bpo-31333(13): 'abc' module is added.  It is a speedup module with\nC implementations for various functions and methods in 'abc'.\nCreating an ABC subclass and calling 'isinstance' or 'issubclass'\nwith an ABC subclass are up to 1.5x faster.  In addition, this\nmakes Python start-up up to 10% faster.  Note that the new\nimplementation hides internal registry and caches, previously\naccessible via private attributes 'abcregistry', 'abccache',\nand 'abcnegativecache'.  There are three debugging helper\nmethods that can be used instead 'dumpregistry',\n'abcregistryclear', and 'abccachesclear'.\n\n- bpo-32841(14): Fixed 'asyncio.Condition' issue which silently\nignored cancellation after notifying and cancelling a conditional\nlock.  Patch by Bar Harel.\n\n- bpo-32819(15): ssl.matchhostname() has been simplified and no\nlonger depends on re and ipaddress module for wildcard and IP\naddresses.  Error reporting for invalid wildcards has been\nimproved.\n\n- bpo-32394(16): socket: Remove\nTCPFASTOPEN,TCPKEEPCNT,TCPKEEPIDLE,TCPKEEPINTVL flags on older\nversion Windows during run-time.\n\n- bpo-31787(17): Fixed refleaks of 'init()' methods in various\nmodules.  (Contributed by Oren Milman)\n\n- bpo-30157(18): Fixed guessing quote and delimiter in\ncsv.Sniffer.sniff() when only the last field is quoted.  Patch by\nJake Davis.\n\n- bpo-32792(19): collections.ChainMap() preserves the order of the\nunderlying mappings.\n\n- bpo-32775(20): *note fnmatch.translate(): 17c5. no longer produces\npatterns which contain set operations.  Sets starting with '[' or\ncontaining '-', '&&', '~~' or '||' will be interpreted differently\nin regular expressions in future versions.  Currently they emit\nwarnings.  fnmatch.translate() now avoids producing patterns\ncontaining such sets by accident.\n\n- bpo-32622(21): Implement native fast sendfile for Windows proactor\nevent loop.\n\n- bpo-32777(22): Fix a rare but potential pre-exec child process\ndeadlock in subprocess on POSIX systems when marking file\ndescriptors inheritable on exec in the child process.  This bug\nappears to have been introduced in 3.4.\n\n- bpo-32647(23): The ctypes module used to depend on indirect linking\nfor dlopen.  The shared extension is now explicitly linked against\nlibdl on platforms with dl.\n\n- bpo-32741(24): Implement 'asyncio.TimerHandle.when()' method.\n\n- bpo-32691(25): Use modspec.parent when running modules with pdb\n\n- bpo-32734(26): Fixed 'asyncio.Lock()' safety issue which allowed\nacquiring and locking the same lock multiple times, without it\nbeing free.  Patch by Bar Harel.\n\n- bpo-32727(27): Do not include name field in SMTP envelope from\naddress.  Patch by Ste'phane Wirtel\n\n- bpo-31453(28): Add TLSVersion constants and\nSSLContext.maximumversion / minimumversion attributes.  The new\nAPI wraps OpenSSL 1.1\n'https://web.archive.org/web/20180309043602/https://www.openssl.org/docs/man1.1.0/ssl/SSLCTXsetminprotoversion.html'\nfeature.\n\n- bpo-24334(29): Internal implementation details of ssl module were\ncleaned up.  The SSLSocket has one less layer of indirection.\nOwner and session information are now handled by the SSLSocket and\nSSLObject constructor.  Channel binding implementation has been\nsimplified.\n\n- bpo-31848(30): Fix the error handling in Aifcread.initfp() when\nthe SSND chunk is not found.  Patch by Zackery Spytz.\n\n- bpo-32585(31): Add Ttk spinbox widget to *note tkinter.ttk: f4.\nPatch by Alan D Moore.\n\n- bpo-32221(32): Various functions returning tuple containing IPv6\naddresses now omit '%scope' part since the same information is\nalready encoded in 'scopeid' tuple item.  Especially this speeds up\n'socket.recvfrom()' when it receives multicast packet since useless\nresolving of network interface name is omitted.\n\n- bpo-30693(33): The TarFile class now recurses directories in a\nreproducible way.\n\n- bpo-30693(34): The ZipFile class now recurses directories in a\nreproducible way.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32960\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32713\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=32951\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=32929\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=32947\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=30622\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=32922\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=32859\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=32556\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=25988\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=21060\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=32852\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=31333\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=32841\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=32819\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=32394\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=31787\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=30157\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=32792\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=32775\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=32622\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=32777\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=32647\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=32741\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=32691\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=32734\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=32727\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=31453\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=24334\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=31848\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=32585\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=32221\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=30693\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=30693\n\nFile: python3.12.info,  Node: Documentation<51>,  Next: Tests<47>,  Prev: Library<52>,  Up: Python 3 7 0 beta 2\n\n1.22.52.4 Documentation\n.......................\n\n- bpo-28124(1): The ssl module function ssl.wrapsocket() has been\nde-emphasized and deprecated in favor of the more secure and\nefficient SSLContext.wrapsocket() method.\n\n- bpo-17232(2): Clarify docs for -O and -OO. Patch by Terry Reedy.\n\n- bpo-32436(3): Add documentation for the contextvars module (PEP\n567).\n\n- bpo-32800(4): Update link to w3c doc for xml default namespaces.\n\n- bpo-11015(5): Update *note test.support: de. documentation.\n\n- bpo-8722(6): Document 'getattr()' behavior when property\n'get()' method raises *note AttributeError: 395.\n\n- bpo-32614(7): Modify RE examples in documentation to use raw\nstrings to prevent *note DeprecationWarning: 179. and add text to\nREGEX HOWTO to highlight the deprecation.\n\n- bpo-31972(8): Improve docstrings for 'pathlib.PurePath' subclasses.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28124\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=17232\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=32436\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=32800\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=11015\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=8722\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=32614\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=31972\n\nFile: python3.12.info,  Node: Tests<47>,  Next: Build<48>,  Prev: Documentation<51>,  Up: Python 3 7 0 beta 2\n\n1.22.52.5 Tests\n...............\n\n- bpo-31809(1): Add tests to verify connection with secp ECDH curves.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31809\n\nFile: python3.12.info,  Node: Build<48>,  Next: Windows<46>,  Prev: Tests<47>,  Up: Python 3 7 0 beta 2\n\n1.22.52.6 Build\n...............\n\n- bpo-32898(1): Fix the python debug build when using COUNTALLOCS.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32898\n\nFile: python3.12.info,  Node: Windows<46>,  Next: macOS<38>,  Prev: Build<48>,  Up: Python 3 7 0 beta 2\n\n1.22.52.7 Windows\n.................\n\n- bpo-32901(1): Update Tcl and Tk versions to 8.6.8\n\n- bpo-31966(2): Fixed WindowsConsoleIO.write() for writing empty\ndata.\n\n- bpo-32409(3): Ensures activate.bat can handle Unicode contents.\n\n- bpo-32457(4): Improves handling of denormalized executable path\nwhen launching Python.\n\n- bpo-32370(5): Use the correct encoding for ipconfig output in the\nuuid module.  Patch by Segev Finer.\n\n- bpo-29248(6): Fix *note os.readlink(): 73e. on Windows, which was\nmistakenly treating the 'PrintNameOffset' field of the reparse data\nbuffer as a number of characters instead of bytes.  Patch by Craig\nHolmquist and SSE4.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32901\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31966\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=32409\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=32457\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=32370\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=29248\n\nFile: python3.12.info,  Node: macOS<38>,  Next: IDLE<35>,  Prev: Windows<46>,  Up: Python 3 7 0 beta 2\n\n1.22.52.8 macOS\n...............\n\n- bpo-32901(1): Update macOS 10.9+ installer to Tcl/Tk 8.6.8.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32901\n\nFile: python3.12.info,  Node: IDLE<35>,  Next: Tools/Demos<27>,  Prev: macOS<38>,  Up: Python 3 7 0 beta 2\n\n1.22.52.9 IDLE\n..............\n\n- bpo-32916(1): Change 'str' to 'code' in pyparse.\n\n- bpo-32905(2): Remove unused code in pyparse module.\n\n- bpo-32874(3): Add tests for pyparse.\n\n- bpo-32837(4): Using the system and place-dependent default encoding\nfor open() is a bad idea for IDLE's system and location-independent\nfiles.\n\n- bpo-32826(5): Add \"encoding=utf-8\" to open() in IDLE's\ntesthelpabout.  GUI test testfilebuttons() only looks at\ninitial ascii-only lines, but failed on systems where open()\ndefaults to 'ascii' because readline() internally reads and decodes\nfar enough ahead to encounter a non-ascii character in CREDITS.txt.\n\n- bpo-32765(6): Update configdialog General tab docstring to add new\nwidgets to the widget list.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32916\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32905\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=32874\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=32837\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=32826\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=32765\n\nFile: python3.12.info,  Node: Tools/Demos<27>,  Prev: IDLE<35>,  Up: Python 3 7 0 beta 2\n\n1.22.52.10 Tools/Demos\n......................\n\n- bpo-32222(1): Fix pygettext not extracting docstrings for functions\nwith type annotated arguments.  Patch by Toby Harradine.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32222\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 7 0 beta 1,  Next: Python 3 7 0 alpha 4,  Prev: Python 3 7 0 beta 2,  Up: Changelog": {
            "content": "'Release date: 2018-01-30'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<52>.\n* Library: Library<53>.\n* Documentation: Documentation<52>.\n* Tests: Tests<48>.\n* Build: Build<49>.\n* Windows: Windows<47>.\n* macOS: macOS<39>.\n* C API: C API<44>.\n\nFile: python3.12.info,  Node: Core and Builtins<52>,  Next: Library<53>,  Up: Python 3 7 0 beta 1\n\n1.22.53.1 Core and Builtins\n...........................\n\n- bpo-32703(1): Fix coroutine's ResourceWarning when there's an\nactive error set when it's being finalized.\n\n- bpo-32650(2): Pdb and other debuggers dependent on bdb.py will\ncorrectly step over (next command) native coroutines.  Patch by\nPablo Galindo.\n\n- bpo-28685(3): Optimize list.sort() and sorted() by using type\nspecialized comparisons when possible.\n\n- bpo-32685(4): Improve suggestion when the Python 2 form of print\nstatement is either present on the same line as the header of a\ncompound statement or else terminated by a semi-colon instead of a\nnewline.  Patch by Nitish Chandra.\n\n- bpo-32697(5): Python now explicitly preserves the definition order\nof keyword-only parameters.  It's always preserved their order, but\nthis behavior was never guaranteed before; this behavior is now\nguaranteed and tested.\n\n- bpo-32690(6): The locals() dictionary now displays in the lexical\norder that variables were defined.  Previously, the order was\nreversed.\n\n- bpo-32677(7): Add '.isascii()' method to 'str', 'bytes' and\n'bytearray'.  It can be used to test that string contains only\nASCII characters.\n\n- bpo-32670(8): Enforce PEP 479(9) for all code.  This means that\nmanually raising a StopIteration exception from a generator is\nprohibited for all code, regardless of whether 'from future\nimport generatorstop' was used or not.\n\n- bpo-32591(10): Added built-in support for tracking the origin of\ncoroutine objects; see sys.setcoroutineorigintrackingdepth and\nCoroutineType.crorigin.  This replaces the asyncio debug mode's\nuse of coroutine wrapping for native coroutine objects.\n\n- bpo-31368(11): Expose preadv and pwritev system calls in the os\nmodule.  Patch by Pablo Galindo\n\n- bpo-32544(12): 'hasattr(obj, name)' and 'getattr(obj, name,\ndefault)' are about 4 times faster than before when 'name' is not\nfound and 'obj' doesn't override 'getattr' or\n'getattribute'.\n\n- bpo-26163(13): Improved frozenset() hash to create more distinct\nhash values when faced with datasets containing many similar\nvalues.\n\n- bpo-32550(14): Remove the STOREANNOTATION bytecode.\n\n- bpo-20104(15): Expose posixspawn as a low level API in the os\nmodule.  (removed before 3.7.0rc1)\n\n- bpo-24340(16): Fixed estimation of the code stack size.\n\n- bpo-32436(17): Implement PEP 567(18) Context Variables.\n\n- bpo-18533(19): 'repr()' on a dict containing its own 'values()' or\n'items()' no longer raises 'RecursionError'; OrderedDict similarly.\nInstead, use '...', as for other recursive structures.  Patch by\nBen North.\n\n- bpo-20891(20): PyInitialize() now creates the GIL. The GIL is no\nlonger created \"on demand\" to fix a race condition when\nPyGILStateEnsure() is called in a non-Python thread.\n\n- bpo-32028(21): Leading whitespace is now correctly ignored when\ngenerating suggestions for converting Py2 print statements to Py3\nbuiltin print function calls.  Patch by Sanyam Khurana.\n\n- bpo-31179(22): Make dict.copy() up to 5.5 times faster.\n\n- bpo-31113(23): Get rid of recursion in the compiler for normal\ncontrol flow.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32703\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32650\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=28685\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=32685\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=32697\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=32690\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=32677\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=32670\n\n(9) https://peps.python.org/pep-0479/\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=32591\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=31368\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=32544\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=26163\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=32550\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=20104\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=24340\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=32436\n\n(18) https://peps.python.org/pep-0567/\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=18533\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=20891\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=32028\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=31179\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=31113\n\nFile: python3.12.info,  Node: Library<53>,  Next: Documentation<52>,  Prev: Core and Builtins<52>,  Up: Python 3 7 0 beta 1\n\n1.22.53.2 Library\n.................\n\n- bpo-25988(1): Deprecate exposing the contents of collections.abc in\nthe regular collections module.\n\n- bpo-31429(2): The default cipher suite selection of the ssl module\nnow uses a blacklist approach rather than a hard-coded whitelist.\nPython no longer re-enables ciphers that have been blocked by\nOpenSSL security update.  Default cipher suite selection can be\nconfigured on compile time.\n\n- bpo-30306(3): contextlib.contextmanager now releases the arguments\npassed to the underlying generator as soon as the context manager\nis entered.  Previously it would keep them alive for as long as the\ncontext manager was alive, even when not being used as a function\ndecorator.  Patch by Martin Teichmann.\n\n- bpo-21417(4): Added support for setting the compression level for\nzipfile.ZipFile.\n\n- bpo-32251(5): Implement asyncio.BufferedProtocol (provisional API).\n\n- bpo-32513(6): In dataclasses, allow easier overriding of dunder\nmethods without specifying decorator parameters.\n\n- bpo-32660(7): *note termios: db. makes available 'FIONREAD',\n'FIONCLEX', 'FIOCLEX', 'FIOASYNC' and 'FIONBIO' also under\nSolaris/derivatives.\n\n- bpo-27931(8): Fix email address header parsing error when the\nusername is an empty quoted string.  Patch by Xiang Zhang.\n\n- bpo-32659(9): Under Solaris and derivatives, *note os.statresult:\n1318. provides a stfstype attribute.\n\n- bpo-32662(10): Implement Server.startserving(),\nServer.serveforever(), and Server.isserving() methods.  Add\n'startserving' keyword parameter to loop.createserver() and\nloop.createunixserver().\n\n- bpo-32391(11): Implement *note asyncio.StreamWriter.waitclosed():\n943. and *note asyncio.StreamWriter.isclosing(): 944. methods\n\n- bpo-32643(12): Make Task.step, Task.wakeup and\nFuture.schedulecallbacks methods private.\n\n- bpo-32630(13): Refactor decimal module to use contextvars to store\ndecimal context.\n\n- bpo-32622(14): Add 'asyncio.AbstractEventLoop.sendfile()' method.\n\n- bpo-32304(15): distutils' upload command no longer corrupts tar\nfiles ending with a CR byte, and no longer tries to convert CR to\nCRLF in any of the upload text fields.\n\n- bpo-32502(16): uuid.uuid1 no longer raises an exception if a 64-bit\nhardware address is encountered.\n\n- bpo-32596(17): 'concurrent.futures' imports 'ThreadPoolExecutor'\nand 'ProcessPoolExecutor' lazily (using PEP 562(18)).  It makes\n'import asyncio' about 15% faster because asyncio uses only\n'ThreadPoolExecutor' by default.\n\n- bpo-31801(19): Add 'ignore' to 'Enum' so temporary variables can\nbe used during class construction without being turned into\nmembers.\n\n- bpo-32576(20): Use queue.SimpleQueue() in places where it can be\ninvoked from a weakref callback.\n\n- bpo-32574(21): Fix memory leak in asyncio.Queue, when the queue has\nlimited size and it is full, the cancelation of queue.put() can\ncause a memory leak.  Patch by: Jose' Melero.\n\n- bpo-32521(22): The nis module is now compatible with new libnsl and\nheaders location.\n\n- bpo-32467(23): collections.abc.ValuesView now inherits from\ncollections.abc.Collection.\n\n- bpo-32473(24): Improve ABCMeta.dumpregistry() output readability\n\n- bpo-32102(25): New argument 'captureoutput' for subprocess.run\n\n- bpo-32521(26): glibc has removed Sun RPC. Use replacement libtirpc\nheaders and library in nis module.\n\n- bpo-32493(27): UUID module fixes build for FreeBSD/OpenBSD\n\n- bpo-32503(28): Pickling with protocol 4 no longer creates too small\nframes.\n\n- bpo-29237(29): Create enum for pstats sorting options\n\n- bpo-32454(30): Add close(fd) function to the socket module.\n\n- bpo-25942(31): The subprocess module is now more graceful when\nhandling a Ctrl-C KeyboardInterrupt during subprocess.call,\nsubprocess.run, or a Popen context manager.  It now waits a short\namount of time for the child (presumed to have also gotten the\nSIGINT) to exit, before continuing the KeyboardInterrupt exception\nhandling.  This still includes a SIGKILL in the call() and run()\nAPIs, but at least the child had a chance first.\n\n- bpo-32433(32): The hmac module now has hmac.digest(), which\nprovides an optimized HMAC digest.\n\n- bpo-28134(33): Sockets now auto-detect family, type and protocol\nfrom file descriptor by default.\n\n- bpo-32404(34): Fix bug where *note\ndatetime.datetime.fromtimestamp(): 226. did not call new in\n*note datetime.datetime: 222. subclasses.\n\n- bpo-32403(35): Improved speed of *note datetime.date: 70f. and\n*note datetime.datetime: 222. alternate constructors.\n\n- bpo-32228(36): Ensure that 'truncate()' preserves the file position\n(as reported by 'tell()') after writes longer than the buffer size.\n\n- bpo-32410(37): Implement 'loop.socksendfile' for asyncio event\nloop.\n\n- bpo-22908(38): Added seek and tell to the ZipExtFile class.  This\nonly works if the file object used to open the zipfile is seekable.\n\n- bpo-32373(39): Add socket.getblocking() method.\n\n- bpo-32248(40): Add *note importlib.resources: 75. and *note\nimportlib.abc.ResourceReader: 934. as the unified API for reading\nresources contained within packages.  Loaders wishing to support\nresource reading must implement the 'getresourcereader()' method.\nFile-based and zipimport-based loaders both implement these APIs.\n*note importlib.abc.ResourceLoader: a2c. is deprecated in favor of\nthese new APIs.\n\n- bpo-32320(41): collections.namedtuple() now supports default\nvalues.\n\n- bpo-29302(42): Add contextlib.AsyncExitStack.  Patch by Alexander\nMohr and Ilya Kulakov.\n\n- bpo-31961(43): 'Removed in Python 3.7.0b2.'  The 'args' argument of\nsubprocess.Popen can now be a *note path-like object: 957.  If\n'args' is given as a sequence, it's first element can now be a\n*note path-like object: 957. as well.\n\n- bpo-31900(44): The *note locale.localeconv(): a44. function now\nsets temporarily the 'LCCTYPE' locale to the 'LCNUMERIC' locale\nto decode 'decimalpoint' and 'thousandssep' byte strings if they\nare non-ASCII or longer than 1 byte, and the 'LCNUMERIC' locale is\ndifferent than the 'LCCTYPE' locale.  This temporary change\naffects other threads.  Same change for the *note str.format():\n3ed. method when formatting a number (*note int: 17e, *note float:\n4b7, *note float: 4b7. and subclasses) with the 'n' type (ex:\n''{:n}'.format(1234)').\n\n- bpo-31853(45): Use super().method instead of socket.method in\nSSLSocket.  They were there most likely for legacy reasons.\n\n- bpo-31399(46): The ssl module now uses OpenSSL's\nX509VERIFYPARAMset1host() and X509VERIFYPARAMset1ip() API\nto verify hostname and IP addresses.  Subject common name fallback\ncan be disabled with SSLContext.hostnamecheckscommonname.\n\n- bpo-14976(47): Add a queue.SimpleQueue class, an unbounded FIFO\nqueue with a reentrant C implementation of put().\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25988\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31429\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=30306\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=21417\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=32251\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=32513\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=32660\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=27931\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=32659\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=32662\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=32391\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=32643\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=32630\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=32622\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=32304\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=32502\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=32596\n\n(18) https://peps.python.org/pep-0562/\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=31801\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=32576\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=32574\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=32521\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=32467\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=32473\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=32102\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=32521\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=32493\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=32503\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=29237\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=32454\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=25942\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=32433\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=28134\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=32404\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=32403\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=32228\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=32410\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=22908\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=32373\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=32248\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=32320\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=29302\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=31961\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=31900\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=31853\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=31399\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=14976\n\nFile: python3.12.info,  Node: Documentation<52>,  Next: Tests<48>,  Prev: Library<53>,  Up: Python 3 7 0 beta 1\n\n1.22.53.3 Documentation\n.......................\n\n- bpo-32724(1): Add references to some commands in the documentation\nof Pdb.  Patch by Ste'phane Wirtel\n\n- bpo-32649(2): Complete the C API documentation, profiling and\ntracing part with the newly added per-opcode events.\n\n- bpo-17799(3): Explain real behaviour of sys.settrace and\nsys.setprofile and their C-API counterparts regarding which type of\nevents are received in each function.  Patch by Pablo Galindo\nSalgado.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32724\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32649\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=17799\n\nFile: python3.12.info,  Node: Tests<48>,  Next: Build<49>,  Prev: Documentation<52>,  Up: Python 3 7 0 beta 1\n\n1.22.53.4 Tests\n...............\n\n- bpo-32721(1): Fix testhashlib to not fail if the md5 module is\nnot built.\n\n- bpo-28414(2): Add test cases for IDNA 2003 and 2008 host names.\nIDNA 2003 internationalized host names are working since\nbpo-31399(3) has landed.  IDNA 2008 are still broken.\n\n- bpo-32604(4): Add a new \"xxsubinterpreters\" extension module that\nexposes the existing subinterpreter C-API and a new\ncross-interpreter data sharing mechanism.  The module is primarily\nintended for more thorough testing of the existing subinterpreter\nsupport.  Note that the xxsubinterpreters module has been removed\nin 3.7.0rc1.\n\n- bpo-32602(5): Add test certs and test for ECDSA cert and EC/RSA\ndual mode.\n\n- bpo-32549(6): On Travis CI, Python now Compiles and uses a local\ncopy of OpenSSL 1.1.0g for testing.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32721\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=28414\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=31399\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=32604\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=32602\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=32549\n\nFile: python3.12.info,  Node: Build<49>,  Next: Windows<47>,  Prev: Tests<48>,  Up: Python 3 7 0 beta 1\n\n1.22.53.5 Build\n...............\n\n- bpo-32635(1): Fix segfault of the crypt module when libxcrypt is\nprovided instead of libcrypt at the system.\n\n- bpo-32598(2): Use autoconf to detect OpenSSL libs, headers and\nsupported features.  The axcheckopenssl M4 macro uses pkg-config\nto locate OpenSSL and falls back to manual search.\n\n- bpo-32593(3): Drop support of FreeBSD 9 and older.\n\n- bpo-29708(4): If the 'SOURCEDATEEPOCH' environment variable is\nset, *note pycompile: ae. will always create hash-based '.pyc'\nfiles.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32635\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32598\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=32593\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=29708\n\nFile: python3.12.info,  Node: Windows<47>,  Next: macOS<39>,  Prev: Build<49>,  Up: Python 3 7 0 beta 1\n\n1.22.53.6 Windows\n.................\n\n- bpo-32588(1): Create standalone distutilsfindvs module and add\nmissing queue module to installer.\n\n- bpo-29911(2): Ensure separate Modify and Uninstall buttons are\ndisplayed.\n\n- bpo-32507(3): Use app-local UCRT install rather than the proper\nupdate for old versions of Windows.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32588\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=29911\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=32507\n\nFile: python3.12.info,  Node: macOS<39>,  Next: C API<44>,  Prev: Windows<47>,  Up: Python 3 7 0 beta 1\n\n1.22.53.7 macOS\n...............\n\n- bpo-32726(1): Provide an additional, more modern macOS installer\nvariant that supports macOS 10.9+ systems in 64-bit mode only.\nUpgrade the supplied third-party libraries to OpenSSL 1.1.0g and to\nSQLite 3.22.0.  The 10.9+ installer now links with and supplies its\nown copy of Tcl/Tk 8.6.\n\n- bpo-28440(2): No longer add /Library/Python/3.x/site-packages to\nsys.path for macOS framework builds to avoid future conflicts.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32726\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=28440\n\nFile: python3.12.info,  Node: C API<44>,  Prev: macOS<39>,  Up: Python 3 7 0 beta 1\n\n1.22.53.8 C API\n...............\n\n- bpo-32681(1): Fix uninitialized variable 'res' in the C\nimplementation of os.dup2.  Patch by Ste'phane Wirtel\n\n- bpo-10381(2): Add C API access to the 'datetime.timezone'\nconstructor and 'datetime.timzone.UTC' singleton.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32681\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=10381\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 7 0 alpha 4,  Next: Python 3 7 0 alpha 3,  Prev: Python 3 7 0 beta 1,  Up: Changelog": {
            "content": "'Release date: 2018-01-08'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<53>.\n* Library: Library<54>.\n* Documentation: Documentation<53>.\n* Tests: Tests<49>.\n* Windows: Windows<48>.\n* Tools/Demos: Tools/Demos<28>.\n* C API: C API<45>.\n\nFile: python3.12.info,  Node: Core and Builtins<53>,  Next: Library<54>,  Up: Python 3 7 0 alpha 4\n\n1.22.54.1 Core and Builtins\n...........................\n\n- bpo-31975(1): The default warning filter list now starts with a\n\"default::DeprecationWarning:main\" entry, so deprecation\nwarnings are once again shown by default in single-file scripts and\nat the interactive prompt.\n\n- bpo-32226(2): 'classgetitem' is now an automatic class method.\n\n- bpo-32399(3): Add AIX uuid library support for RFC4122 using\nuuidcreate() in libc.a\n\n- bpo-32390(4): Fix the compilation failure on AIX after the ffsid\nfield has been added to the object returned by os.statvfs()\n(bpo-32143(5)).  Original patch by Michael Felt.\n\n- bpo-32379(6): Make MRO computation faster when a class inherits\nfrom a single base.\n\n- bpo-32259(7): The error message of a TypeError raised when unpack\nnon-iterable is now more specific.\n\n- bpo-27169(8): The 'debug' constant is now optimized out at\ncompile time.  This fixes also bpo-22091(9).\n\n- bpo-32329(10): The *note -R: 1818. option now turns on hash\nrandomization when the *note PYTHONHASHSEED: ef4. environment\nvariable is set to '0'.  Previously, the option was ignored.\nMoreover, 'sys.flags.hashrandomization' is now properly set to 0\nwhen hash randomization is turned off by 'PYTHONHASHSEED=0'.\n\n- bpo-30416(11): The optimizer is now protected from spending much\ntime doing complex calculations and consuming much memory for\ncreating large constants in constant folding.  Increased limits for\nconstants that can be produced in constant folding.\n\n- bpo-32282(12): Fix an unnecessary ifdef in the include of\nVersionHelpers.h in socketmodule on Windows.\n\n- bpo-30579(13): Implement TracebackType.new to allow\nPython-level creation of traceback objects, and make\nTracebackType.tbnext mutable.\n\n- bpo-32260(14): Don't byte swap the input keys to the SipHash\nalgorithm on big-endian platforms.  This should ensure siphash\ngives consistent results across platforms.\n\n- bpo-31506(15): Improve the error message logic for object.new\nand object.init.  Patch by Sanyam Khurana.\n\n- bpo-20361(16): '-b' and '-bb' now inject ''default::BytesWarning''\nand 'error::BytesWarning' entries into 'sys.warnoptions', ensuring\nthat they take precedence over any other warning filters configured\nvia the '-W' option or the 'PYTHONWARNINGS' environment variable.\n\n- bpo-32230(17): '-X dev' now injects a ''default'' entry into\nsys.warnoptions, ensuring that it behaves identically to actually\npassing '-Wdefault' at the command line.\n\n- bpo-29240(18): Add a new UTF-8 mode: implementation of the PEP\n540(19).\n\n- bpo-32226(20): PEP 560(21): Add support for 'mroentries' and\n'classgetitem'.  Implemented by Ivan Levkivskyi.\n\n- bpo-32225(22): PEP 562(23): Add support for module 'getattr'\nand 'dir'.  Implemented by Ivan Levkivskyi.\n\n- bpo-31901(24): The 'atexit' module now has its callback stored per\ninterpreter.\n\n- bpo-31650(25): Implement PEP 552(26) (Deterministic pycs).  Python\nnow supports invalidating bytecode cache files bashed on a source\ncontent hash rather than source last-modified time.\n\n- bpo-29469(27): Move constant folding from bytecode layer to AST\nlayer.  Original patch by Eugene Toder.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31975\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32226\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=32399\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=32390\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=32143\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=32379\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=32259\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=27169\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=22091\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=32329\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=30416\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=32282\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=30579\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=32260\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=31506\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=20361\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=32230\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=29240\n\n(19) https://peps.python.org/pep-0540/\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=32226\n\n(21) https://peps.python.org/pep-0560/\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=32225\n\n(23) https://peps.python.org/pep-0562/\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=31901\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=31650\n\n(26) https://peps.python.org/pep-0552/\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=29469\n\nFile: python3.12.info,  Node: Library<54>,  Next: Documentation<53>,  Prev: Core and Builtins<53>,  Up: Python 3 7 0 alpha 4\n\n1.22.54.2 Library\n.................\n\n- bpo-32506(1): Now that dict is defined as keeping insertion order,\ndrop OrderedDict and just use plain dict.\n\n- bpo-32279(2): Add params to dataclasses.makedataclasses(): init,\nrepr, eq, order, hash, and frozen.  Pass them through to\ndataclass().\n\n- bpo-32278(3): Make type information optional on\ndataclasses.makedataclass().  If omitted, the string 'typing.Any'\nis used.\n\n- bpo-32499(4): Add dataclasses.isdataclass(obj), which returns True\nif obj is a dataclass or an instance of one.\n\n- bpo-32468(5): Improve frame repr() to mention filename, code name\nand current line number.\n\n- bpo-23749(6): asyncio: Implement loop.starttls()\n\n- bpo-32441(7): Return the new file descriptor (i.e., the second\nargument) from 'os.dup2'.  Previously, 'None' was always returned.\n\n- bpo-32422(8): 'functools.lrucache' uses less memory (3 words for\neach cached key) and takes about 1/3 time for cyclic GC.\n\n- bpo-31721(9): Prevent Python crash from happening when\nFuture.logtraceback is set to True manually.  Now it can only be\nset to False, or a ValueError is raised.\n\n- bpo-32415(10): asyncio: Add Task.getloop() and Future.getloop()\n\n- bpo-26133(11): Don't unsubscribe signals in asyncio UNIX event loop\non interpreter shutdown.\n\n- bpo-32363(12): Make asyncio.Task.setexception() and setresult()\nraise NotImplementedError.  Task.step() and Future.await()\nraise proper exceptions when they are in an invalid state, instead\nof raising an AssertionError.\n\n- bpo-32357(13): Optimize asyncio.iscoroutine() and\nloop.createtask() for non-native coroutines (e.g.  async/await\ncompiled with Cython).  'loop.createtask(pythoncoroutine)' used\nto be 20% faster than 'loop.createtask(cythoncoroutine)'.  Now,\nthe latter is as fast.\n\n- bpo-32356(14): asyncio.transport.resumereading() and\npausereading() are now idempotent.  New transport.isreading()\nmethod is added.\n\n- bpo-32355(15): Optimize asyncio.gather(); now up to 15% faster.\n\n- bpo-32351(16): Use fastpath in asyncio.sleep if delay<0 (2x boost)\n\n- bpo-32348(17): Optimize asyncio.Future schedule/add/remove\ncallback.  The optimization shows 3-6% performance improvements of\nasync/await code.\n\n- bpo-32331(18): Fix socket.settimeout() and socket.setblocking() to\nkeep socket.type as is.  Fix socket.socket() constructor to reset\nany bit flags applied to socket's type.  This change only affects\nOSes that have SOCKNONBLOCK and/or SOCKCLOEXEC.\n\n- bpo-32248(19): Add *note importlib.abc.ResourceReader: 934. as an\nABC for loaders to provide a unified API for reading resources\ncontained within packages.  Also add *note importlib.resources: 75.\nas the port of 'importlibresources'.\n\n- bpo-32311(20): Implement asyncio.createtask(coro) shortcut\n\n- bpo-32327(21): Convert asyncio functions that were documented as\ncoroutines to coroutines.  Affected functions: loop.socksendall,\nloop.sockrecv, loop.sockaccept, loop.getaddrinfo,\nloop.getnameinfo.\n\n- bpo-32323(22): *note urllib.parse.urlsplit(): b95. does not convert\nzone-id (scope) to lower case for scoped IPv6 addresses in\nhostnames now.\n\n- bpo-32302(23): Fix bdistwininst of distutils for CRT v142: it\nbinary compatible with CRT v140.\n\n- bpo-29711(24): Fix 'stopserving' in asyncio proactor loop kill all\nlistening servers\n\n- bpo-32308(25): *note re.sub(): 1ff. now replaces empty matches\nadjacent to a previous non-empty match.\n\n- bpo-29970(26): Abort asyncio SSLProtocol connection if handshake\nnot complete within 10 seconds.\n\n- bpo-32314(27): Implement asyncio.run().\n\n- bpo-17852(28): Revert incorrect fix based on misunderstanding of\nPyPyAtExit() semantics.\n\n- bpo-32296(29): Implement asyncio.getrunningloop() and\ngeteventloop() in C. This makes them 4x faster.\n\n- bpo-32250(30): Implement 'asyncio.currenttask()' and\n'asyncio.alltasks()'.  Add helpers intended to be used by\nalternative task implementations: 'asyncio.registertask',\n'asyncio.entertask', 'asyncio.leavetask' and\n'asyncio.unregistertask'.  Deprecate\n'asyncio.Task.currenttask()' and 'asyncio.Task.alltasks()'.\n\n- bpo-32255(31): A single empty field is now always quoted when\nwritten into a CSV file.  This allows to distinguish an empty row\nfrom a row consisting of a single empty field.  Patch by Licht\nTakeuchi.\n\n- bpo-32277(32): Raise 'NotImplementedError' instead of 'SystemError'\non platforms where 'chmod(..., followsymlinks=False)' is not\nsupported.  Patch by Anthony Sottile.\n\n- bpo-30050(33): New argument warnonfullbuffer to\nsignal.setwakeupfd lets you control whether Python prints a\nwarning on stderr when the wakeup fd buffer overflows.\n\n- bpo-29137(34): The 'fpectl' library has been removed.  It was never\nenabled by default, never worked correctly on x86-64, and it\nchanged the Python ABI in ways that caused unexpected breakage of C\nextensions.\n\n- bpo-32273(35): Move asyncio.testutils to test.testasyncio.\n\n- bpo-32272(36): Remove asyncio.async() function.\n\n- bpo-32269(37): Add asyncio.getrunningloop() function.\n\n- bpo-32265(38): All class and static methods of builtin types now\nare correctly classified by inspect.classifyclassattrs() and\ngrouped in pydoc ouput.  Added types.ClassMethodDescriptorType for\nunbound class methods of builtin types.\n\n- bpo-32253(39): Deprecate 'yield from lock', 'await lock', 'with\n(yield from lock)' and 'with await lock' for asyncio\nsynchronization primitives.\n\n- bpo-22589(40): Changed MIME type of .bmp from 'image/x-ms-bmp' to\n'image/bmp'\n\n- bpo-32193(41): Convert asyncio to use 'async/await' syntax.  Old\nstyled 'yield from' is still supported too.\n\n- bpo-32206(42): Add support to run modules with pdb\n\n- bpo-32227(43): 'functools.singledispatch' now supports registering\nimplementations using type annotations.\n\n- bpo-15873(44): Added new alternate constructors *note\ndatetime.datetime.fromisoformat(): 3e2, *note\ndatetime.time.fromisoformat(): 3e1. and *note\ndatetime.date.fromisoformat(): 3e0. as the inverse operation of\neach classes's respective 'isoformat' methods.\n\n- bpo-32199(45): The getnode() ip getter now uses 'ip link' instead\nof 'ip link list'.\n\n- bpo-32143(46): os.statvfs() includes the ffsid field from\nstatvfs(2)\n\n- bpo-26439(47): Fix ctypes.util.findlibrary() for AIX by\nimplementing ctypes.aix.findlibrary() Patch by: Michael Felt\n\n- bpo-31993(48): The pickler now uses less memory when serializing\nlarge bytes and str objects into a file.  Pickles created with\nprotocol 4 will require less memory for unpickling large bytes and\nstr objects.\n\n- bpo-27456(49): Ensure TCPNODELAY is set on Linux.  Tests by Victor\nStinner.\n\n- bpo-31778(50): ast.literaleval() is now more strict.  Addition and\nsubtraction of arbitrary numbers no longer allowed.\n\n- bpo-31802(51): Importing native path module ('posixpath', 'ntpath')\nnow works even if the 'os' module still is not imported.\n\n- bpo-30241(52): Add contextlib.AbstractAsyncContextManager.  Patch\nby Jelle Zijlstra.\n\n- bpo-31699(53): Fix deadlocks in *note\nconcurrent.futures.ProcessPoolExecutor: 707. when task arguments or\nresults cause pickling or unpickling errors.  This should make sure\nthat calls to the 'ProcessPoolExecutor' API always eventually\nreturn.\n\n- bpo-15216(54): 'TextIOWrapper.reconfigure()' supports changing\n'encoding', 'errors', and 'newline'.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32506\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32279\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=32278\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=32499\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=32468\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=23749\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=32441\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=32422\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=31721\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=32415\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=26133\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=32363\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=32357\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=32356\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=32355\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=32351\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=32348\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=32331\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=32248\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=32311\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=32327\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=32323\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=32302\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=29711\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=32308\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=29970\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=32314\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=17852\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=32296\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=32250\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=32255\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=32277\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=30050\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=29137\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=32273\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=32272\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=32269\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=32265\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=32253\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=22589\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=32193\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=32206\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=32227\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=15873\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=32199\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=32143\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=26439\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=31993\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=27456\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=31778\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=31802\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=30241\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=31699\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=15216\n\nFile: python3.12.info,  Node: Documentation<53>,  Next: Tests<49>,  Prev: Library<54>,  Up: Python 3 7 0 alpha 4\n\n1.22.54.3 Documentation\n.......................\n\n- bpo-32418(1): Add getloop() method to Server and AbstractServer\nclasses.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32418\n\nFile: python3.12.info,  Node: Tests<49>,  Next: Windows<48>,  Prev: Documentation<53>,  Up: Python 3 7 0 alpha 4\n\n1.22.54.4 Tests\n...............\n\n- bpo-32252(1): Fix faulthandlersuppresscrashreport() used to\nprevent core dump files when testing crashes.  getrlimit() returns\nzero on success.\n\n- bpo-32002(2): Adjust C locale coercion testing for the empty locale\nand POSIX locale cases to more readily adjust to platform dependent\nbehaviour.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32252\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32002\n\nFile: python3.12.info,  Node: Windows<48>,  Next: Tools/Demos<28>,  Prev: Tests<49>,  Up: Python 3 7 0 alpha 4\n\n1.22.54.5 Windows\n.................\n\n- bpo-19764(1): Implement support for\n'subprocess.Popen(closefds=True)' on Windows.  Patch by Segev\nFiner.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=19764\n\nFile: python3.12.info,  Node: Tools/Demos<28>,  Next: C API<45>,  Prev: Windows<48>,  Up: Python 3 7 0 alpha 4\n\n1.22.54.6 Tools/Demos\n.....................\n\n- bpo-24960(1): 2to3 and lib2to3 can now read pickled grammar files\nusing pkgutil.getdata() rather than probing the filesystem.  This\nlets 2to3 and lib2to3 work when run from a zipfile.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24960\n\nFile: python3.12.info,  Node: C API<45>,  Prev: Tools/Demos<28>,  Up: Python 3 7 0 alpha 4\n\n1.22.54.7 C API\n...............\n\n- bpo-32030(1): PyInitialize() doesn't reset the memory allocators\nto default if the 'PYTHONMALLOC' environment variable is not set.\n\n- bpo-29084(2): Undocumented C API for OrderedDict has been excluded\nfrom the limited C API. It was added by mistake and actually never\nworked in the limited C API.\n\n- bpo-32264(3): Moved the pygetopt.h header into internal/, since it\nhas no public APIs.\n\n- bpo-32241(4): *note PySetProgramName(): 181f. and *note\nPySetPythonHome(): 1820. now take the 'const wchar *' arguments\ninstead of 'wchar *'.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32030\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=29084\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=32264\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=32241\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 7 0 alpha 3,  Next: Python 3 7 0 alpha 2,  Prev: Python 3 7 0 alpha 4,  Up: Changelog": {
            "content": "'Release date: 2017-12-05'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<54>.\n* Library: Library<55>.\n* Documentation: Documentation<54>.\n* Tests: Tests<50>.\n* Build: Build<50>.\n* Windows: Windows<49>.\n* macOS: macOS<40>.\n* IDLE: IDLE<36>.\n* Tools/Demos: Tools/Demos<29>.\n* C API: C API<46>.\n\nFile: python3.12.info,  Node: Core and Builtins<54>,  Next: Library<55>,  Up: Python 3 7 0 alpha 3\n\n1.22.55.1 Core and Builtins\n...........................\n\n- bpo-32176(1): coflags.CONOFREE is now always set correctly by the\ncode object constructor based on freevars and cellvars, rather than\nneeding to be set correctly by the caller.  This ensures it will be\ncleared automatically when additional cell references are injected\ninto a modified code object and function.\n\n- bpo-10544(2): Yield expressions are now deprecated in\ncomprehensions and generator expressions.  They are still permitted\nin the definition of the outermost iterable, as that is evaluated\ndirectly in the enclosing scope.\n\n- bpo-32137(3): The repr of deeply nested dict now raises a\nRecursionError instead of crashing due to a stack overflow.\n\n- bpo-32096(4): Revert memory allocator changes in the C API: move\nstructures back from PyRuntime to Objects/obmalloc.c.  The memory\nallocators are once again initialized statically, and so\nPyMemRawMalloc() and PyDecodeLocale() can be called before\nPyRuntimeInitialize().\n\n- bpo-32043(5): Add a new \"developer mode\": new \"-X dev\" command line\noption to enable debug checks at runtime.\n\n- bpo-32023(6): SyntaxError is now correctly raised when a generator\nexpression without parenthesis is used instead of an inheritance\nlist in a class definition.  The duplication of the parentheses can\nbe omitted only on calls.\n\n- bpo-32012(7): SyntaxError is now correctly raised when a generator\nexpression without parenthesis is passed as an argument, but\nfollowed by a trailing comma.  A generator expression always needs\nto be directly inside a set of parentheses and cannot have a comma\non either side.\n\n- bpo-28180(8): A new internal 'PySetLocaleFromEnv(category)'\nhelper function has been added in order to improve the consistency\nof behaviour across different 'libc' implementations (e.g.  Android\ndoesn't support setting the locale from the environment by\ndefault).\n\n- bpo-31949(9): Fixed several issues in printing tracebacks\n(PyTraceBackPrint()).  Setting sys.tracebacklimit to 0 or less now\nsuppresses printing tracebacks.  Setting sys.tracebacklimit to None\nnow causes using the default limit.  Setting sys.tracebacklimit to\nan integer larger than LONGMAX now means using the limit LONGMAX\nrather than the default limit.  Fixed integer overflows in the case\nof more than '231' traceback items on Windows.  Fixed output\nerrors handling.\n\n- bpo-30696(10): Fix the interactive interpreter looping endlessly\nwhen no memory.\n\n- bpo-20047(11): Bytearray methods partition() and rpartition() now\naccept only bytes-like objects as separator, as documented.  In\nparticular they now raise TypeError rather of returning a bogus\nresult when an integer is passed as a separator.\n\n- bpo-21720(12): BytesWarning no longer emitted when the 'fromlist'\nargument of 'import()' or the 'all' attribute of the module\ncontain bytes instances.\n\n- bpo-31845(13): Environment variables are once more read correctly\nat interpreter startup.\n\n- bpo-28936(14): Ensure that lexically first syntax error involving a\nparameter and 'global' or 'nonlocal' is detected first at a given\nscope.  Patch by Ivan Levkivskyi.\n\n- bpo-31825(15): Fixed OverflowError in the 'unicode-escape' codec\nand in codecs.escapedecode() when decode an escaped non-ascii\nbyte.\n\n- bpo-31618(16): The per-frame tracing logic added in 3.7a1 has been\naltered so that 'frame->flineno' is updated before either '\"line\"'\nor '\"opcode\"' events are emitted.  Previously, opcode events were\nemitted first, and therefore would occasionally see stale line\nnumbers on the frame.  The behavior of this feature has changed\nslightly as a result: when both 'ftracelines' and\n'ftraceopcodes' are enabled, line events now occur first.\n\n- bpo-28603(17): Print the full context/cause chain of exceptions on\ninterpreter exit, even if an exception in the chain is unhashable\nor compares equal to later ones.  Patch by Zane Bitter.\n\n- bpo-31786(18): Fix timeout rounding in the select module to round\ncorrectly negative timeouts between -1.0 and 0.0.  The functions\nnow block waiting for events as expected.  Previously, the call was\nincorrectly non-blocking.  Patch by Pablo Galindo.\n\n- bpo-31781(19): Prevent crashes when calling methods of an\nuninitialized 'zipimport.zipimporter' object.  Patch by Oren\nMilman.\n\n- bpo-30399(20): Standard repr() of BaseException with a single\nargument no longer contains redundant trailing comma.\n\n- bpo-31626(21): Fixed a bug in debug memory allocator.  There was a\nwrite to freed memory after shrinking a memory block.\n\n- bpo-30817(22): 'PyErrPrintEx()' clears now the ignored exception\nthat may be raised by 'PySysSetObjectId()', for example when no\nmemory.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32176\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=10544\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=32137\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=32096\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=32043\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=32023\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=32012\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=28180\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=31949\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=30696\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=20047\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=21720\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=31845\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=28936\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=31825\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=31618\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=28603\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=31786\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=31781\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=30399\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=31626\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=30817\n\nFile: python3.12.info,  Node: Library<55>,  Next: Documentation<54>,  Prev: Core and Builtins<54>,  Up: Python 3 7 0 alpha 3\n\n1.22.55.2 Library\n.................\n\n- bpo-28556(1): Two minor fixes for 'typing' module: allow shallow\ncopying instances of generic classes, improve interaction of\n'initsubclass' with generics.  Original PRs by Ivan\nLevkivskyi.\n\n- bpo-32214(2): PEP 557, Data Classes.  Provides a decorator which\nadds boilerplate methods to classes which use type annotations so\nspecify fields.\n\n- bpo-27240(3): The header folding algorithm for the new email\npolicies has been rewritten, which also fixes bpo-30788(4),\nbpo-31831(5), and bpo-32182(6).  In particular, RFC2231 folding is\nnow done correctly.\n\n- bpo-32186(7): io.FileIO.readall() and io.FileIO.read() now release\nthe GIL when getting the file size.  Fixed hang of all threads with\ninaccessible NFS server.  Patch by Nir Soffer.\n\n- bpo-32101(8): Add *note sys.flags.devmode: 1824. flag\n\n- bpo-32154(9): The 'asyncio.windowsutils.socketpair()' function has\nbeen removed: use directly *note socket.socketpair(): a3b. which is\navailable on all platforms since Python 3.5 (before, it wasn't\navailable on Windows).  'asyncio.windowsutils.socketpair()' was\njust an alias to 'socket.socketpair' on Python 3.5 and newer.\n\n- bpo-32089(10): warnings: In development (-X dev) and debug mode\n(pydebug build), use the \"default\" action for ResourceWarning,\nrather than the \"always\" action, in the default warnings filters.\n\n- bpo-32107(11): 'uuid.getnode()' now preferentially returns\nuniversally administered MAC addresses if available, over locally\nadministered MAC addresses.  This makes a better guarantee for\nglobal uniqueness of UUIDs returned from 'uuid.uuid1()'.  If only\nlocally administered MAC addresses are available, the first such\none found is returned.\n\n- bpo-23033(12): Wildcard is now supported in hostname when it is one\nand only character in the left most segment of hostname in second\nargument of 'ssl.matchhostname()'.  Patch by Mandeep Singh.\n\n- bpo-12239(13): Make *note msilib.SummaryInformation.GetProperty():\n1761. return 'None' when the value of property is 'VTEMPTY'.\nInitial patch by Mark Mc Mahon.\n\n- bpo-28334(14): Use *note os.path.expanduser(): 83d. to find the\n'~/.netrc' file in *note netrc.netrc: 1624.  If it does not exist,\n*note FileNotFoundError: 353. is raised.  Patch by Dimitri\nMerejkowsky.\n\n- bpo-32121(15): Made 'tracemalloc.Traceback' behave more like the\ntraceback module, sorting the frames from oldest to most recent.\n'Traceback.format()' now accepts negative 'limit', truncating the\nresult to the 'abs(limit)' oldest frames.  To get the old\nbehaviour, one can use the new 'mostrecentfirst' argument to\n'Traceback.format()'.  (Patch by Jesse Bakker.)\n\n- bpo-31325(16): Fix wrong usage of *note collections.namedtuple():\n711. in the *note RobotFileParser.parse(): 1825. method.  Initial\npatch by Robin Wellner.\n\n- bpo-12382(17): *note msilib.OpenDatabase(): 16b7. now raises a\nbetter exception message when it couldn't open or create an MSI\nfile.  Initial patch by William Tisa\"ter.\n\n- bpo-19610(18): 'setup()' now warns about invalid types for some\nfields.  The 'distutils.dist.Distribution' class now warns when\n'classifiers', 'keywords' and 'platforms' fields are not specified\nas a list or a string.\n\n- bpo-32071(19): Added the '-k' command-line option to 'python -m\nunittest' to run only tests that match the given pattern(s).\n\n- bpo-10049(20): Added 'nullcontext' no-op context manager to\ncontextlib.  This provides a simpler and faster alternative to\nExitStack() when handling optional context managers.\n\n- bpo-28684(21): The new test.support.skipunlessbindunixsocket()\ndecorator is used here to skip asyncio tests that fail because the\nplatform lacks a functional bind() function for unix domain sockets\n(as it is the case for non root users on the recent Android\nversions that run now SELinux in enforcing mode).\n\n- bpo-32110(22): 'codecs.StreamReader.read(n)' now returns not more\nthan 'n' characters/bytes for non-negative 'n'.  This makes it\ncompatible with 'read()' methods of other file-like objects.\n\n- bpo-27535(23): The warnings module doesn't leak memory anymore in\nthe hidden warnings registry for the \"ignore\" action of warnings\nfilters.  warnexplicit() function doesn't add the warning key to\nthe registry anymore for the \"ignore\" action.\n\n- bpo-32088(24): warnings: When Python is build is debug mode\n('PyDEBUG'), *note DeprecationWarning: 179, *note\nPendingDeprecationWarning: 6e0. and *note ImportWarning: 243.\nwarnings are now displayed by default.\n\n- bpo-1647489(25): Fixed searching regular expression patterns that\ncould match an empty string.  Non-empty string can now be correctly\nfound after matching an empty string.\n\n- bpo-25054(26): Added support of splitting on a pattern that could\nmatch an empty string.\n\n- bpo-32072(27): Fixed issues with binary plists: Fixed saving\nbytearrays.  Identical objects will be saved only once.  Equal\nreferences will be load as identical objects.  Added support for\nsaving and loading recursive data structures.\n\n- bpo-32069(28): Drop legacy SSL transport from asyncio,\nssl.MemoryBIO is always used anyway.\n\n- bpo-32066(29): asyncio: Support pathlib.Path in\ncreateunixconnection; sock arg should be optional\n\n- bpo-32046(30): Updates 2to3 to convert from\noperator.isCallable(obj) to callable(obj).  Patch by Donghee Na.\n\n- bpo-32018(31): inspect.signature should follow PEP 8(32), if the\nparameter has an annotation and a default value.  Patch by Donghee\nNa.\n\n- bpo-32025(33): Add time.threadtime() and time.threadtimens()\n\n- bpo-32037(34): Integers that fit in a signed 32-bit integer will be\nnow pickled with protocol 0 using the INT opcode.  This will\ndecrease the size of a pickle, speed up pickling and unpickling,\nand make these integers be unpickled as int instances in Python 2.\n\n- bpo-32034(35): Make asyncio.IncompleteReadError and\nLimitOverrunError pickleable.\n\n- bpo-32015(36): Fixed the looping of asyncio in the case of\nreconnection the socket during waiting async read/write from/to the\nsocket.\n\n- bpo-32011(37): Restored support of loading marshal files with the\nTYPEINT64 code.  These files can be produced in Python 2.7.\n\n- bpo-28369(38): Enhance addreader/writer check that socket is not\nused by some transport.  Before, only cases when addreader/writer\nwere called with an int FD were supported.  Now the check is\nimplemented correctly for all file-like objects.\n\n- bpo-31976(39): Fix race condition when flushing a file is slow,\nwhich can cause a segfault if closing the file from another thread.\n\n- bpo-31985(40): Formally deprecated aifc.openfp, sunau.openfp, and\nwave.openfp.  Since change 7bc817d5ba917528e8bd07ec461c635291e7b06a\nin 1993, openfp in each of the three modules had been pointing to\nthat module's open function as a matter of backwards compatibility,\nthough it had been both untested and undocumented.\n\n- bpo-21862(41): cProfile command line now accepts '-m modulename'\nas an alternative to script path.  Patch by Sanyam Khurana.\n\n- bpo-31970(42): Reduce performance overhead of asyncio debug mode.\n\n- bpo-31843(43): 'database' argument of sqlite3.connect() now accepts\na *note path-like object: 957, instead of just a string.\n\n- bpo-31945(44): Add Configurable 'blocksize' to 'HTTPConnection' and\n'HTTPSConnection' for improved upload throughput.  Patch by Nir\nSoffer.\n\n- bpo-31943(45): Add a 'cancelled()' method to *note asyncio.Handle:\n1826.  Patch by Marat Sharafutdinov.\n\n- bpo-9678(46): Fixed determining the MAC address in the uuid module:\nUsing ifconfig on NetBSD and OpenBSD. Using arp on Linux, FreeBSD,\nNetBSD and OpenBSD. Based on patch by Takayuki Shimizukawa.\n\n- bpo-30057(47): Fix potential missed signal in signal.signal().\n\n- bpo-31933(48): Fix Blake2 params leafsize and nodeoffset on big\nendian platforms.  Patch by Jack O'Connor.\n\n- bpo-21423(49): Add an initializer argument to\n{Process,Thread}PoolExecutor\n\n- bpo-31927(50): Fixed compilation of the socket module on NetBSD 8.\nFixed assertion failure or reading arbitrary data when parse a\nAFBLUETOOTH address on NetBSD and DragonFly BSD.\n\n- bpo-27666(51): Fixed stack corruption in curses.box() and\ncurses.ungetmouse() when the size of types chtype or mmaskt is\nless than the size of C long.  curses.box() now accepts characters\nas arguments.  Based on patch by Steve Fink.\n\n- bpo-31917(52): Add 3 new clock identifiers: *note\ntime.CLOCKBOOTTIME: 9d1, *note time.CLOCKPROF: 9d2. and *note\ntime.CLOCKUPTIME: 9d3.\n\n- bpo-31897(53): plistlib now catches more errors when read binary\nplists and raises InvalidFileException instead of unexpected\nexceptions.\n\n- bpo-25720(54): Fix the method for checking pad state of curses\nWINDOW. Patch by Masayuki Yamamoto.\n\n- bpo-31893(55): Fixed the layout of the kqueueevent structure on\nOpenBSD and NetBSD. Fixed the comparison of the kqueueevent\nobjects.\n\n- bpo-31891(56): Fixed building the curses module on NetBSD.\n\n- bpo-31884(57): added required constants to subprocess module for\nsetting priority on windows\n\n- bpo-28281(58): Remove year (1-9999) limits on the\nCalendar.weekday() function.  Patch by Mark Gollahon.\n\n- bpo-31702(59): crypt.mksalt() now allows to specify the number of\nrounds for SHA-256 and SHA-512 hashing.\n\n- bpo-30639(60): *note inspect.getfile(): 1827. no longer computes\nthe repr of unknown objects to display in an error message, to\nprotect against badly behaved custom reprs.\n\n- bpo-30768(61): Fix the pthread+semaphore implementation of\nPyThreadacquirelocktimed() when called with timeout > 0 and\nintrflag=0: recompute the timeout if semtimedwait() is\ninterrupted by a signal (EINTR). See also the PEP 475(62).\n\n- bpo-31854(63): Add 'mmap.ACCESSDEFAULT' constant.\n\n- bpo-31834(64): Use optimized code for BLAKE2 only with SSSE3+.  The\npure SSE2 implementation is slower than the pure C reference\nimplementation.\n\n- bpo-28292(65): Calendar.itermonthdates() will now consistently\nraise an exception when a date falls outside of the 0001-01-01\nthrough 9999-12-31 range.  To support applications that cannot\ntolerate such exceptions, the new methods itermonthdays3() and\nitermonthdays4() are added.  The new methods return tuples and are\nnot restricted by the range supported by datetime.date.\n\n- bpo-28564(66): The shutil.rmtree() function has been sped up to\n20-40%.  This was done using the os.scandir() function.\n\n- bpo-28416(67): Instances of pickle.Pickler subclass with the\npersistentid() method and pickle.Unpickler subclass with the\npersistentload() method no longer create reference cycles.\n\n- bpo-31653(68): Don't release the GIL if we can acquire a\nmultiprocessing semaphore immediately.\n\n- bpo-28326(69): Fix multiprocessing.Process when stdout and/or\nstderr is closed or None.\n\n- bpo-20825(70): Add 'subnetof' and 'supersetof' containment tests\nto *note ipaddress.IPv6Network: 985. and *note\nipaddress.IPv4Network: 986.  Patch by Michel Albert and Cheryl\nSabella.\n\n- bpo-31827(71): Remove the os.statfloattimes() function.  It was\nintroduced in Python 2.3 for backward compatibility with Python\n2.2, and was deprecated since Python 3.1.\n\n- bpo-31756(72): Add a 'subprocess.Popen(text=False)' keyword\nargument to 'subprocess' functions to be more explicit about when\nthe library should attempt to decode outputs into text.  Patch by\nAndrew Clegg.\n\n- bpo-31819(73): Add AbstractEventLoop.sockrecvinto().\n\n- bpo-31457(74): If nested log adapters are used, the inner\n'process()' methods are no longer omitted.\n\n- bpo-31457(75): The 'manager' property on LoggerAdapter objects is\nnow properly settable.\n\n- bpo-31806(76): Fix timeout rounding in time.sleep(),\nthreading.Lock.acquire() and socket.socket.settimeout() to round\ncorrectly negative timeouts between -1.0 and 0.0.  The functions\nnow block waiting for events as expected.  Previously, the call was\nincorrectly non-blocking.  Patch by Pablo Galindo.\n\n- bpo-31803(77): time.clock() and time.getclockinfo('clock') now\nemit a DeprecationWarning warning.\n\n- bpo-31800(78): Extended support for parsing UTC offsets.  strptime\n'%z' can now parse the output generated by datetime.isoformat,\nincluding seconds and microseconds.\n\n- bpo-28603(79): traceback: Fix a TypeError that occurred during\nprinting of exception tracebacks when either the current exception\nor an exception in its context/cause chain is unhashable.  Patch by\nZane Bitter.\n\n- bpo-30541(80): Add new function to seal a mock and prevent the\nautomatically creation of child mocks.  Patch by Mario Corchero.\n\n- bpo-31784(81): Implement the PEP 564(82), add new 6 new functions\nwith nanosecond resolution to the *note time: e8. module: *note\nclockgettimens(): 919, *note clocksettimens(): 91a, *note\nmonotonicns(): 91b, *note perfcounterns(): 91c, *note\nprocesstimens(): 91d, *note timens(): 91e.\n\n- bpo-30143(83): 2to3 now generates a code that uses abstract\ncollection classes from collections.abc rather than collections.\n\n- bpo-31770(84): Prevent a crash when calling the 'init()' method\nof a 'sqlite3.Cursor' object more than once.  Patch by Oren Milman.\n\n- bpo-31764(85): Prevent a crash in 'sqlite3.Cursor.close()' in case\nthe 'Cursor' object is uninitialized.  Patch by Oren Milman.\n\n- bpo-31752(86): Fix possible crash in timedelta constructor called\nwith custom integers.\n\n- bpo-31620(87): an empty asyncio.Queue now doesn't leak memory when\nqueue.get pollers timeout\n\n- bpo-31690(88): Allow the flags re.ASCII, re.LOCALE, and re.UNICODE\nto be used as group flags for regular expressions.\n\n- bpo-30349(89): FutureWarning is now emitted if a regular expression\ncontains character set constructs that will change semantically in\nthe future (nested sets and set operations).\n\n- bpo-31664(90): Added support for the Blowfish hashing in the crypt\nmodule.\n\n- bpo-31632(91): Fix method setprotocol() of class\nSSLProtocolTransport in asyncio module.  This method was\npreviously modifying a wrong reference to the protocol.\n\n- bpo-15037(92): Added a workaround for getkey() in curses for\nncurses 5.7 and earlier.\n\n- bpo-31307(93): Allow use of bytes objects for arguments to *note\nconfigparser.ConfigParser.read(): 12bd.  Patch by Vincent Michel.\n\n- bpo-31334(94): Fix 'poll.poll([timeout])' in the 'select' module\nfor arbitrary negative timeouts on all OSes where it can only be a\nnon-negative integer or -1.  Patch by Riccardo Coccioli.\n\n- bpo-31310(95): multiprocessing's semaphore tracker should be\nlaunched again if crashed.\n\n- bpo-31308(96): Make multiprocessing's forkserver process immune to\nCtrl-C and other user interruptions.  If it crashes, restart it\nwhen necessary.\n\n- bpo-31245(97): Added support for AFUNIX socket in asyncio\n'createdatagramendpoint'.\n\n- bpo-30553(98): Add HTTP/2 status code 421 (Misdirected Request) to\n*note http.HTTPStatus: 71b.  Patch by Vitor Pereira.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28556\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32214\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=27240\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=30788\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=31831\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=32182\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=32186\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=32101\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=32154\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=32089\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=32107\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=23033\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=12239\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=28334\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=32121\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=31325\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=12382\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=19610\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=32071\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=10049\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=28684\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=32110\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=27535\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=32088\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=1647489\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=25054\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=32072\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=32069\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=32066\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=32046\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=32018\n\n(32) https://peps.python.org/pep-0008/\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=32025\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=32037\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=32034\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=32015\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=32011\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=28369\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=31976\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=31985\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=21862\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=31970\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=31843\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=31945\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=31943\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=9678\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=30057\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=31933\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=21423\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=31927\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=27666\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=31917\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=31897\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=25720\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=31893\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=31891\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=31884\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=28281\n\n(59) https://bugs.python.org/issue?@action=redirect&bpo=31702\n\n(60) https://bugs.python.org/issue?@action=redirect&bpo=30639\n\n(61) https://bugs.python.org/issue?@action=redirect&bpo=30768\n\n(62) https://peps.python.org/pep-0475/\n\n(63) https://bugs.python.org/issue?@action=redirect&bpo=31854\n\n(64) https://bugs.python.org/issue?@action=redirect&bpo=31834\n\n(65) https://bugs.python.org/issue?@action=redirect&bpo=28292\n\n(66) https://bugs.python.org/issue?@action=redirect&bpo=28564\n\n(67) https://bugs.python.org/issue?@action=redirect&bpo=28416\n\n(68) https://bugs.python.org/issue?@action=redirect&bpo=31653\n\n(69) https://bugs.python.org/issue?@action=redirect&bpo=28326\n\n(70) https://bugs.python.org/issue?@action=redirect&bpo=20825\n\n(71) https://bugs.python.org/issue?@action=redirect&bpo=31827\n\n(72) https://bugs.python.org/issue?@action=redirect&bpo=31756\n\n(73) https://bugs.python.org/issue?@action=redirect&bpo=31819\n\n(74) https://bugs.python.org/issue?@action=redirect&bpo=31457\n\n(75) https://bugs.python.org/issue?@action=redirect&bpo=31457\n\n(76) https://bugs.python.org/issue?@action=redirect&bpo=31806\n\n(77) https://bugs.python.org/issue?@action=redirect&bpo=31803\n\n(78) https://bugs.python.org/issue?@action=redirect&bpo=31800\n\n(79) https://bugs.python.org/issue?@action=redirect&bpo=28603\n\n(80) https://bugs.python.org/issue?@action=redirect&bpo=30541\n\n(81) https://bugs.python.org/issue?@action=redirect&bpo=31784\n\n(82) https://peps.python.org/pep-0564/\n\n(83) https://bugs.python.org/issue?@action=redirect&bpo=30143\n\n(84) https://bugs.python.org/issue?@action=redirect&bpo=31770\n\n(85) https://bugs.python.org/issue?@action=redirect&bpo=31764\n\n(86) https://bugs.python.org/issue?@action=redirect&bpo=31752\n\n(87) https://bugs.python.org/issue?@action=redirect&bpo=31620\n\n(88) https://bugs.python.org/issue?@action=redirect&bpo=31690\n\n(89) https://bugs.python.org/issue?@action=redirect&bpo=30349\n\n(90) https://bugs.python.org/issue?@action=redirect&bpo=31664\n\n(91) https://bugs.python.org/issue?@action=redirect&bpo=31632\n\n(92) https://bugs.python.org/issue?@action=redirect&bpo=15037\n\n(93) https://bugs.python.org/issue?@action=redirect&bpo=31307\n\n(94) https://bugs.python.org/issue?@action=redirect&bpo=31334\n\n(95) https://bugs.python.org/issue?@action=redirect&bpo=31310\n\n(96) https://bugs.python.org/issue?@action=redirect&bpo=31308\n\n(97) https://bugs.python.org/issue?@action=redirect&bpo=31245\n\n(98) https://bugs.python.org/issue?@action=redirect&bpo=30553\n\nFile: python3.12.info,  Node: Documentation<54>,  Next: Tests<50>,  Prev: Library<55>,  Up: Python 3 7 0 alpha 3\n\n1.22.55.3 Documentation\n.......................\n\n- bpo-32105(1): Added asyncio.BaseEventLoop.connectacceptedsocket\nversionadded marker.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32105\n\nFile: python3.12.info,  Node: Tests<50>,  Next: Build<50>,  Prev: Documentation<54>,  Up: Python 3 7 0 alpha 3\n\n1.22.55.4 Tests\n...............\n\n- bpo-31380(1): Skip testhttpservers testundecodablefile on macOS:\nfails on APFS.\n\n- bpo-31705(2): Skip testsocket.testsha256() on Linux kernel older\nthan 4.5.  The test fails with ENOKEY on kernel 3.10 (on ppc64le).\nA fix was merged into the kernel 4.5.\n\n- bpo-32138(3): Skip on Android testfaulthandler tests that raise\nSIGSEGV and remove the test.support.requiresandroidlevel\ndecorator.\n\n- bpo-32136(4): The runtime embedding tests have been split out from\n'Lib/test/testcapi.py' into a new 'Lib/test/testembed.py' file.\n\n- bpo-28668(5): test.support.requiresmultiprocessingqueue is\nremoved.  Skip tests with\ntest.support.importmodule('multiprocessing.synchronize') instead\nwhen the semaphore implementation is broken or missing.\n\n- bpo-32126(6): Skip testgeteventloopnewprocess in\ntest.testasyncio.testevents when semopen() is not functional.\n\n- bpo-31174(7): Fix testtools.testunparse: DirectoryTestCase now\nstores the names sample to always test the same files.  It prevents\nfalse alarms when hunting reference leaks.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31380\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31705\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=32138\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=32136\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=28668\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=32126\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=31174\n\nFile: python3.12.info,  Node: Build<50>,  Next: Windows<49>,  Prev: Tests<50>,  Up: Python 3 7 0 alpha 3\n\n1.22.55.5 Build\n...............\n\n- bpo-28538(1): Revert the previous changes, the ifnameindex\nstructure is defined by Unified Headers.\n\n- bpo-28762(2): Revert the last commit, the FLOCK macro is defined\nby Android Unified Headers.\n\n- bpo-29040(3): Support building Android with Unified Headers.  The\nfirst NDK release to support Unified Headers is android-ndk-r14.\n\n- bpo-32059(4): 'detectmodules()' in 'setup.py' now also searches\nthe sysroot paths when cross-compiling.\n\n- bpo-31957(5): Fixes Windows SDK version detection when building for\nWindows.\n\n- bpo-31609(6): Fixes quotes in PCbuild/clean.bat\n\n- bpo-31934(7): Abort the build when building out of a not clean\nsource tree.\n\n- bpo-31926(8): Fixed Argument Clinic sometimes causing compilation\nerrors when there was more than one function and/or method in a .c\nfile with the same name.\n\n- bpo-28791(9): Update Windows builds to use SQLite 3.21.0.\n\n- bpo-28791(10): Update OS X installer to use SQLite 3.21.0.\n\n- bpo-28643(11): Record profile-opt build progress with stamp files.\n\n- bpo-31866(12): Finish removing support for AtheOS.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28538\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=28762\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=29040\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=32059\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=31957\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=31609\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=31934\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=31926\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=28791\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=28791\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=28643\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=31866\n\nFile: python3.12.info,  Node: Windows<49>,  Next: macOS<40>,  Prev: Build<50>,  Up: Python 3 7 0 alpha 3\n\n1.22.55.6 Windows\n.................\n\n- bpo-1102(1): Return 'None' when 'View.Fetch()' returns\n'ERRORNOMOREITEMS' instead of raising 'MSIError'.  Initial patch\nby Anthony Tuininga.\n\n- bpo-31944(2): Fixes Modify button in Apps and Features dialog.\n\n- bpo-20486(3): Implement the 'Database.Close()' method to help\nclosing MSI database objects.\n\n- bpo-31857(4): Make the behavior of USESTACKCHECK deterministic in\na multi-threaded environment.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=1102\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31944\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=20486\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=31857\n\nFile: python3.12.info,  Node: macOS<40>,  Next: IDLE<36>,  Prev: Windows<49>,  Up: Python 3 7 0 alpha 3\n\n1.22.55.7 macOS\n...............\n\n- bpo-31392(1): Update macOS installer to use OpenSSL 1.0.2m\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31392\n\nFile: python3.12.info,  Node: IDLE<36>,  Next: Tools/Demos<29>,  Prev: macOS<40>,  Up: Python 3 7 0 alpha 3\n\n1.22.55.8 IDLE\n..............\n\n- bpo-32207(1): Improve tk event exception tracebacks in IDLE. When\ntk event handling is driven by IDLE's run loop, a confusing and\ndistracting queue.EMPTY traceback context is no longer added to tk\nevent exception tracebacks.  The traceback is now the same as when\nevent handling is driven by user code.  Patch based on a suggestion\nby Serhiy Storchaka.\n\n- bpo-32164(2): Delete unused file idlelib/tabbedpages.py.  Use of\nTabbedPageSet in configdialog was replaced by ttk.Notebook.\n\n- bpo-32100(3): IDLE: Fix old and new bugs in pathbrowser; improve\ntests.  Patch mostly by Cheryl Sabella.\n\n- bpo-31858(4): IDLE - Restrict shell prompt manipulation to the\nshell.  Editor and output windows only see an empty last prompt\nline.  This simplifies the code and fixes a minor bug when newline\nis inserted.  Sys.ps1, if present, is read on Shell start-up, but\nis not set or changed.\n\n- bpo-31860(5): The font sample in the IDLE configuration dialog is\nnow editable.  Changes persist while IDLE remains open\n\n- bpo-31836(6): Testcodemodule now passes if run after testidle,\nwhich sets ps1.  The code module uses sys.ps1 if present or sets it\nto '>>> ' if not.  Testcodemodule now properly tests both\nbehaviors.  Ditto for ps2.\n\n- bpo-28603(7): Fix a TypeError that caused a shell restart when\nprinting a traceback that includes an exception that is unhashable.\nPatch by Zane Bitter.\n\n- bpo-13802(8): Use non-Latin characters in the IDLE's Font settings\nsample.  Even if one selects a font that defines a limited subset\nof the unicode Basic Multilingual Plane, tcl/tk will use other\nfonts that define a character.  The expanded example give users of\nnon-Latin characters a better idea of what they might see in IDLE's\nshell and editors.  To make room for the expanded sample, frames on\nthe Font tab are re-arranged.  The Font/Tabs help explains a bit\nabout the additions.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32207\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32164\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=32100\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=31858\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=31860\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=31836\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=28603\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=13802\n\nFile: python3.12.info,  Node: Tools/Demos<29>,  Next: C API<46>,  Prev: IDLE<36>,  Up: Python 3 7 0 alpha 3\n\n1.22.55.9 Tools/Demos\n.....................\n\n- bpo-32159(1): Remove CVS and Subversion tools: remove svneol.py and\ntreesync.py scripts.  CPython migrated from CVS to Subversion, to\nMercurial, and then to Git.  CVS and Subversion are no longer used\nto develop CPython.\n\n- bpo-30722(2): Make redemo work with Python 3.6 and newer versions.\nAlso, remove the 'LOCALE' option since it doesn't work with string\npatterns in Python 3.  Patch by Christoph Sarnowski.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32159\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=30722\n\nFile: python3.12.info,  Node: C API<46>,  Prev: Tools/Demos<29>,  Up: Python 3 7 0 alpha 3\n\n1.22.55.10 C API\n................\n\n- bpo-20891(1): Fix PyGILStateEnsure().  When PyGILStateEnsure() is\ncalled in a non-Python thread before PyEvalInitThreads(), only\ncall PyEvalInitThreads() after calling PyThreadStateNew() to fix\na crash.\n\n- bpo-32125(2): The 'PyUseClassExceptionsFlag' flag has been\nremoved.  It was deprecated and wasn't used anymore since Python\n2.0.\n\n- bpo-25612(3): Move the current exception state from the frame\nobject to the co-routine.  This simplifies the interpreter and\nfixes a couple of obscure bugs caused by having swap exception\nstate when entering or exiting a generator.\n\n- bpo-23699(4): Add PyRETURNRICHCOMPARE macro to reduce boilerplate\ncode in rich comparison functions.\n\n- bpo-30697(5): The 'PyExcRecursionErrorInst' singleton is removed\nand 'PyErrNormalizeException()' does not use it anymore.  This\nsingleton is persistent and its members being never cleared may\ncause a segfault during finalization of the interpreter.  See also\nbpo-22898(6).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=20891\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32125\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=25612\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=23699\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=30697\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=22898\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 7 0 alpha 2,  Next: Python 3 7 0 alpha 1,  Prev: Python 3 7 0 alpha 3,  Up: Changelog": {
            "content": "'Release date: 2017-10-16'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<55>.\n* Library: Library<56>.\n* Documentation: Documentation<55>.\n* Build: Build<51>.\n* IDLE: IDLE<37>.\n* C API: C API<47>.\n\nFile: python3.12.info,  Node: Core and Builtins<55>,  Next: Library<56>,  Up: Python 3 7 0 alpha 2\n\n1.22.56.1 Core and Builtins\n...........................\n\n- bpo-31558(1): 'gc.freeze()' is a new API that allows for moving all\nobjects currently tracked by the garbage collector to a permanent\ngeneration, effectively removing them from future collection\nevents.  This can be used to protect those objects from having\ntheir PyGCHead mutated.  In effect, this enables great\ncopy-on-write stability at fork().\n\n- bpo-31642(2): Restored blocking \"from package import module\" by\nsetting sys.modules[\"package.module\"] to None.\n\n- bpo-31708(3): Allow use of asynchronous generator expressions in\nsynchronous functions.\n\n- bpo-31709(4): Drop support of asynchronous aiter.\n\n- bpo-30404(5): The -u option now makes the stdout and stderr streams\nunbuffered rather than line-buffered.\n\n- bpo-31619(6): Fixed a ValueError when convert a string with large\nnumber of underscores to integer with binary base.\n\n- bpo-31602(7): Fix an assertion failure in\n'zipimporter.getsource()' in case of a bad 'zlib.decompress()'.\nPatch by Oren Milman.\n\n- bpo-31592(8): Fixed an assertion failure in Python parser in case\nof a bad 'unicodedata.normalize()'.  Patch by Oren Milman.\n\n- bpo-31588(9): Raise a 'TypeError' with a helpful error message when\nclass creation fails due to a metaclass with a bad 'prepare()'\nmethod.  Patch by Oren Milman.\n\n- bpo-31574(10): Importlib was instrumented with two dtrace probes to\nprofile import timing.\n\n- bpo-31566(11): Fix an assertion failure in 'warnings.warn()' in\ncase of a bad 'name' global.  Patch by Oren Milman.\n\n- bpo-31506(12): Improved the error message logic for\n'object.new' and 'object.init'.\n\n- bpo-31505(13): Fix an assertion failure in 'json', in case\n'json.makeencoder()' received a bad 'encoder()' argument.  Patch\nby Oren Milman.\n\n- bpo-31492(14): Fix assertion failures in case of failing to import\nfrom a module with a bad 'name' attribute, and in case of\nfailing to access an attribute of such a module.  Patch by Oren\nMilman.\n\n- bpo-31478(15): Fix an assertion failure in 'random.Random.seed()'\nin case the argument has a bad 'abs()' method.  Patch by Oren\nMilman.\n\n- bpo-31336(16): Speed up class creation by 10-20% by reducing the\noverhead in the necessary special method lookups.  Patch by Stefan\nBehnel.\n\n- bpo-31415(17): Add '-X importtime' option to show how long each\nimport takes.  It can be used to optimize application's startup\ntime.  Support the *note PYTHONPROFILEIMPORTTIME: 92c. as an\nequivalent way to enable this.\n\n- bpo-31410(18): Optimized calling wrapper and classmethod\ndescriptors.\n\n- bpo-31353(19): PEP 553(20) - Add a new built-in called\n'breakpoint()' which calls 'sys.breakpointhook()'.  By default this\nimports 'pdb' and calls 'pdb.settrace()', but users may override\n'sys.breakpointhook()' to call whatever debugger they want.  The\noriginal value of the hook is saved in 'sys.breakpointhook'.\n\n- bpo-17852(21): Maintain a list of open buffered files, flush them\nbefore exiting the interpreter.  Based on a patch from Armin Rigo.\n\n- bpo-31315(22): Fix an assertion failure in imp.createdynamic(),\nwhen spec.name is not a string.  Patch by Oren Milman.\n\n- bpo-31311(23): Fix a crash in the 'setstate()' method of\n'ctypes.CData', in case of a bad 'dict'.  Patch by Oren\nMilman.\n\n- bpo-31293(24): Fix crashes in true division and multiplication of a\ntimedelta object by a float with a bad asintegerratio() method.\nPatch by Oren Milman.\n\n- bpo-31285(25): Fix an assertion failure in\n'warnings.warnexplicit', when the return value of the received\nloader's 'getsource()' has a bad 'splitlines()' method.  Patch by\nOren Milman.\n\n- bpo-30406(26): Make 'async' and 'await' proper keywords, as\nspecified in PEP 492(27).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31558\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31642\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=31708\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=31709\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=30404\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=31619\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=31602\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=31592\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=31588\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=31574\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=31566\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=31506\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=31505\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=31492\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=31478\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=31336\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=31415\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=31410\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=31353\n\n(20) https://peps.python.org/pep-0553/\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=17852\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=31315\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=31311\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=31293\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=31285\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=30406\n\n(27) https://peps.python.org/pep-0492/\n\nFile: python3.12.info,  Node: Library<56>,  Next: Documentation<55>,  Prev: Core and Builtins<55>,  Up: Python 3 7 0 alpha 2\n\n1.22.56.2 Library\n.................\n\n- bpo-30058(1): Fixed buffer overflow in select.kqueue.control().\n\n- bpo-31672(2): 'idpattern' in 'string.Template' matched some\nnon-ASCII characters.  Now it uses '-i' regular expression local\nflag to avoid non-ASCII characters.\n\n- bpo-31701(3): On Windows, faulthandler.enable() now ignores MSC and\nCOM exceptions.\n\n- bpo-31728(4): Prevent crashes in 'elementtree' due to unsafe\ncleanup of 'Element.text' and 'Element.tail'.  Patch by Oren\nMilman.\n\n- bpo-31671(5): Now 're.compile()' converts passed RegexFlag to\nnormal int object before compiling.  bmregexcompile benchmark\nshows 14% performance improvements.\n\n- bpo-30397(6): The types of compiled regular objects and match\nobjects are now exposed as 're.Pattern' and 're.Match'.  This adds\ninformation in pydoc output for the 're' module.\n\n- bpo-31675(7): Fixed memory leaks in Tkinter's methods splitlist()\nand split() when pass a string larger than 2 GiB.\n\n- bpo-31673(8): Fixed typo in the name of Tkinter's method\nadderrorinfo().\n\n- bpo-31648(9): Improvements to path predicates in ElementTree: Allow\nwhitespace around predicate parts, i.e.  \"[a = 'text']\" instead of\nrequiring the less readable \"[a='text']\".  Add support for text\ncomparison of the current node, like \"[.='text']\".  Patch by Stefan\nBehnel.\n\n- bpo-30806(10): Fix the string representation of a netrc object.\n\n- bpo-31638(11): Add optional argument 'compressed' to\n'zipapp.createarchive', and add option '--compress' to the command\nline interface of 'zipapp'.\n\n- bpo-25351(12): Avoid venv activate failures with undefined\nvariables\n\n- bpo-20519(13): Avoid ctypes use (if possible) and improve import\ntime for uuid.\n\n- bpo-28293(14): The regular expression cache is no longer completely\ndumped when it is full.\n\n- bpo-31596(15): Added pthreadgetcpuclockid() to the time module\n\n- bpo-27494(16): Make 2to3 accept a trailing comma in generator\nexpressions.  For example, 'set(x for x in [],)' is now allowed.\n\n- bpo-30347(17): Stop crashes when concurrently iterate over\nitertools.groupby() iterators.\n\n- bpo-30346(18): An iterator produced by itertools.groupby() iterator\nnow becomes exhausted after advancing the groupby iterator.\n\n- bpo-31556(19): Cancel asyncio.waitfor future faster if timeout <=\n0\n\n- bpo-31540(20): Allow passing a context object in *note\nconcurrent.futures.ProcessPoolExecutor: 707. constructor.  Also,\nfree job resources in *note concurrent.futures.ProcessPoolExecutor:\n707. earlier to improve memory usage when a worker waits for new\njobs.\n\n- bpo-31516(21): 'threading.currentthread()' should not return a\ndummy thread at shutdown.\n\n- bpo-31525(22): In the sqlite module, require the sqlite3preparev2\nAPI. Thus, the sqlite module now requires sqlite version at least\n3.3.9.\n\n- bpo-26510(23): argparse subparsers are now required by default.\nThis matches behaviour in Python 2.  For optional subparsers, use\nthe new parameter 'addsubparsers(required=False)'.  Patch by\nAnthony Sottile.  (As of 3.7.0rc1, the default was changed to not\nrequired as had been the case since Python 3.3.)\n\n- bpo-27541(24): Reprs of subclasses of some collection and iterator\nclasses ('bytearray', 'array.array', 'collections.deque',\n'collections.defaultdict', 'itertools.count', 'itertools.repeat')\nnow contain actual type name instead of hardcoded names of the base\nclass.\n\n- bpo-31351(25): python -m ensurepip now exits with non-zero exit\ncode if pip bootstrapping has failed.\n\n- bpo-31389(26): 'pdb.settrace()' now takes an optional keyword-only\nargument 'header'.  If given, this is printed to the console just\nbefore debugging begins.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30058\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31672\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=31701\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=31728\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=31671\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=30397\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=31675\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=31673\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=31648\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=30806\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=31638\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=25351\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=20519\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=28293\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=31596\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=27494\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=30347\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=30346\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=31556\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=31540\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=31516\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=31525\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=26510\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=27541\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=31351\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=31389\n\nFile: python3.12.info,  Node: Documentation<55>,  Next: Build<51>,  Prev: Library<56>,  Up: Python 3 7 0 alpha 2\n\n1.22.56.3 Documentation\n.......................\n\n- bpo-31537(1): Fix incorrect usage of 'gethistorylength' in\nreadline documentation example code.  Patch by Brad Smith.\n\n- bpo-30085(2): The operator functions without double underscores are\npreferred for clarity.  The one with underscores are only kept for\nback-compatibility.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31537\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=30085\n\nFile: python3.12.info,  Node: Build<51>,  Next: IDLE<37>,  Prev: Documentation<55>,  Up: Python 3 7 0 alpha 2\n\n1.22.56.4 Build\n...............\n\n- bpo-31696(1): Improve compiler version information in *note\nsys.version: b70. when Python is built with Clang.\n\n- bpo-31625(2): Stop using ranlib on static libraries.  Instead, we\nassume ar supports the 's' flag.\n\n- bpo-31624(3): Remove support for BSD/OS.\n\n- bpo-22140(4): Prevent double substitution of prefix in\npython-config.sh.\n\n- bpo-31569(5): Correct PCBuild/ case to PCbuild/ in build scripts\nand documentation.\n\n- bpo-31536(6): Avoid wholesale rebuild after 'make regen-all' if\nnothing changed.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31696\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31625\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=31624\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=22140\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=31569\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=31536\n\nFile: python3.12.info,  Node: IDLE<37>,  Next: C API<47>,  Prev: Build<51>,  Up: Python 3 7 0 alpha 2\n\n1.22.56.5 IDLE\n..............\n\n- bpo-31460(1): Simplify the API of IDLE's Module Browser.  Passing a\nwidget instead of an flist with a root widget opens the option of\ncreating a browser frame that is only part of a window.  Passing a\nfull file name instead of pieces assumed to come from a .py file\nopens the possibility of browsing python files that do not end in\n.py.\n\n- bpo-31649(2): IDLE - Make htest, utest parameters keyword only.\n\n- bpo-31559(3): Remove test order dependence in\nidletest.testbrowser.\n\n- bpo-31459(4): Rename IDLE's module browser from Class Browser to\nModule Browser.  The original module-level class and method browser\nbecame a module browser, with the addition of module-level\nfunctions, years ago.  Nested classes and functions were added\nyesterday.  For back-compatibility, the virtual event\n<<open-class-browser>>, which appears on the Keys tab of the\nSettings dialog, is not changed.  Patch by Cheryl Sabella.\n\n- bpo-31500(5): Default fonts now are scaled on HiDPI displays.\n\n- bpo-1612262(6): IDLE module browser now shows nested classes and\nfunctions.  Original patches for code and tests by Guilherme Polo\nand Cheryl Sabella, respectively.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31460\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31649\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=31559\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=31459\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=31500\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=1612262\n\nFile: python3.12.info,  Node: C API<47>,  Prev: IDLE<37>,  Up: Python 3 7 0 alpha 2\n\n1.22.56.6 C API\n...............\n\n- bpo-28280(1): Make 'PyMappingKeys()', 'PyMappingValues()' and\n'PyMappingItems()' always return a 'list' (rather than a 'list' or\na 'tuple').  Patch by Oren Milman.\n\n- bpo-31532(2): Fix memory corruption due to allocator mix in\ngetpath.c between PyGetPath() and PySetPath()\n\n- bpo-25658(3): Implement PEP 539(4) for Thread Specific Storage\n(TSS) API: it is a new Thread Local Storage (TLS) API to CPython\nwhich would supersede use of the existing TLS API within the\nCPython interpreter, while deprecating the existing API. PEP\nwritten by Erik M. Bray, patch by Masayuki Yamamoto.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28280\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31532\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=25658\n\n(4) https://peps.python.org/pep-0539/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 7 0 alpha 1,  Next: Python 3 6 6 final,  Prev: Python 3 7 0 alpha 2,  Up: Changelog": {
            "content": "'Release date: 2017-09-19'\n\n* Menu:\n\n* Security: Security<34>.\n* Core and Builtins: Core and Builtins<56>.\n* Library: Library<57>.\n* Documentation: Documentation<56>.\n* Tests: Tests<51>.\n* Build: Build<52>.\n* Windows: Windows<50>.\n* IDLE: IDLE<38>.\n* Tools/Demos: Tools/Demos<30>.\n* C API: C API<48>.\n\nFile: python3.12.info,  Node: Security<34>,  Next: Core and Builtins<56>,  Up: Python 3 7 0 alpha 1\n\n1.22.57.1 Security\n..................\n\n- bpo-29781(1): SSLObject.version() now correctly returns None when\nhandshake over BIO has not been performed yet.\n\n- bpo-29505(2): Add fuzz tests for float(str), int(str),\nunicode(str); for oss-fuzz.\n\n- bpo-30947(3): Upgrade libexpat embedded copy from version 2.2.1 to\n2.2.3 to get security fixes.\n\n- bpo-30730(4): Prevent environment variables injection in subprocess\non Windows.  Prevent passing other environment variables and\ncommand arguments.\n\n- bpo-30694(5): Upgrade expat copy from 2.2.0 to 2.2.1 to get fixes\nof multiple security vulnerabilities including: CVE-2017-9233\n(External entity infinite loop DoS), CVE-2016-9063 (Integer\noverflow, re-fix), CVE-2016-0718 (Fix regression bugs from 2.2.0's\nfix to CVE-2016-0718) and CVE-2012-0876 (Counter hash flooding with\nSipHash).  Note: the CVE-2016-5300 (Use os-specific entropy sources\nlike getrandom) doesn't impact Python, since Python already gets\nentropy from the OS to set the expat secret using\n'XMLSetHashSalt()'.\n\n- bpo-30500(6): Fix urllib.parse.splithost() to correctly parse\nfragments.  For example, 'splithost('//127.0.0.1#@evil.com/')' now\ncorrectly returns the '127.0.0.1' host, instead of treating\n'@evil.com' as the host in an authentication ('login@host').\n\n- bpo-29591(7): Update expat copy from 2.1.1 to 2.2.0 to get fixes of\nCVE-2016-0718 and CVE-2016-4472.  See\n'https://sourceforge.net/p/expat/bugs/537/' for more information.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=29781\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=29505\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=30947\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=30730\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=30694\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=30500\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=29591\n\nFile: python3.12.info,  Node: Core and Builtins<56>,  Next: Library<57>,  Prev: Security<34>,  Up: Python 3 7 0 alpha 1\n\n1.22.57.2 Core and Builtins\n...........................\n\n- bpo-31490(1): Fix an assertion failure in 'ctypes' class\ndefinition, in case the class has an attribute whose name is\nspecified in 'anonymous' but not in 'fields'.  Patch by Oren\nMilman.\n\n- bpo-31471(2): Fix an assertion failure in 'subprocess.Popen()' on\nWindows, in case the env argument has a bad 'keys()' method.  Patch\nby Oren Milman.\n\n- bpo-31418(3): Fix an assertion failure in 'PyErrWriteUnraisable()'\nin case of an exception with a bad 'module' attribute.  Patch\nby Oren Milman.\n\n- bpo-31416(4): Fix assertion failures in case of a bad\nwarnings.filters or warnings.defaultaction.  Patch by Oren Milman.\n\n- bpo-28411(5): Change direct usage of PyInterpreterState.modules to\nPyImportGetModuleDict().  Also introduce more uniformity in other\ncode that deals with sys.modules.  This helps reduce complications\nwhen working on sys.modules.\n\n- bpo-28411(6): Switch to the abstract API when dealing with\n'PyInterpreterState.modules'.  This allows later support for all\ndict subclasses and other Mapping implementations.  Also add a\n'PyImportGetModule()' function to reduce a bunch of duplicated\ncode.\n\n- bpo-31411(7): Raise a TypeError instead of SystemError in case\nwarnings.onceregistry is not a dictionary.  Patch by Oren Milman.\n\n- bpo-31344(8): For finer control of tracing behaviour when testing\nthe interpreter, two new frame attributes have been added to\ncontrol the emission of particular trace events: 'ftracelines'\n('True' by default) to turn off per-line trace events; and\n'ftraceopcodes' ('False' by default) to turn on per-opcode trace\nevents.\n\n- bpo-31373(9): Fix several possible instances of undefined behavior\ndue to floating-point demotions.\n\n- bpo-30465(10): Location information ('lineno' and 'coloffset') in\nf-strings is now (mostly) correct.  This fixes tools like flake8\nfrom showing warnings on the wrong line (typically the first line\nof the file).\n\n- bpo-30860(11): Consolidate CPython's global runtime state under a\nsingle struct.  This improves discoverability of the runtime state.\n\n- bpo-31347(12): Fix possible undefined behavior in\nPyObjectFastCallPrepend.\n\n- bpo-31343(13): Include sys/sysmacros.h for major(), minor(), and\nmakedev().  GNU C libray plans to remove the functions from\nsys/types.h.\n\n- bpo-31291(14): Fix an assertion failure in\n'zipimport.zipimporter.getdata' on Windows, when the return value\nof 'pathname.replace('/','\\\\')' isn't a string.  Patch by Oren\nMilman.\n\n- bpo-31271(15): Fix an assertion failure in the 'write()' method of\n'io.TextIOWrapper', when the encoder doesn't return a bytes object.\nPatch by Oren Milman.\n\n- bpo-31243(16): Fix a crash in some methods of 'io.TextIOWrapper',\nwhen the decoder's state is invalid.  Patch by Oren Milman.\n\n- bpo-30721(17): 'print' now shows correct usage hint for using\nPython 2 redirection syntax.  Patch by Sanyam Khurana.\n\n- bpo-31070(18): Fix a race condition in importlib\ngetmodulelock().\n\n- bpo-30747(19): Add a non-dummy implementation of Pyatomicstore\nand Pyatomicload on MSVC.\n\n- bpo-31095(20): Fix potential crash during GC caused by 'tpdealloc'\nwhich doesn't call 'PyObjectGCUnTrack()'.\n\n- bpo-31071(21): Avoid masking original TypeError in call with *\nunpacking when other arguments are passed.\n\n- bpo-30978(22): str.formatmap() now passes key lookup exceptions\nthrough.  Previously any exception was replaced with a KeyError\nexception.\n\n- bpo-30808(23): Use Pyatomic API for concurrency-sensitive signal\nstate.\n\n- bpo-30876(24): Relative import from unloaded package now reimports\nthe package instead of failing with SystemError.  Relative import\nfrom non-package now fails with ImportError rather than\nSystemError.\n\n- bpo-30703(25): Improve signal delivery.  Avoid using\nPyAddPendingCall from signal handler, to avoid calling\nsignal-unsafe functions.  The tests I'm adding here fail without\nthe rest of the patch, on Linux and OS X. This means our signal\ndelivery logic had defects (some signals could be lost).\n\n- bpo-30765(26): Avoid blocking in pthreadmutexlock() when\nPyThreadacquirelock() is asked not to block.\n\n- bpo-31161(27): Make sure the 'Missing parentheses' syntax error\nmessage is only applied to SyntaxError, not to subclasses.  Patch\nby Martijn Pieters.\n\n- bpo-30814(28): Fixed a race condition when import a submodule from\na package.\n\n- bpo-30736(29): The internal unicodedata database has been upgraded\nto Unicode 10.0.\n\n- bpo-30604(30): Move coextrafreefuncs from per-thread to\nper-interpreter to avoid crashes.\n\n- bpo-30597(31): 'print' now shows expected input in custom error\nmessage when used as a Python 2 statement.  Patch by Sanyam\nKhurana.\n\n- bpo-30682(32): Removed a too-strict assertion that failed for\ncertain f-strings, such as eval(\"f'\\n'\") and eval(\"f'\\r'\").\n\n- bpo-30501(33): The compiler now produces more optimal code for\ncomplex condition expressions in the \"if\", \"while\" and \"assert\"\nstatement, the \"if\" expression, and generator expressions and\ncomprehensions.\n\n- bpo-28180(34): Implement PEP 538(35) (legacy C locale coercion).\nThis means that when a suitable coercion target locale is\navailable, both the core interpreter and locale-aware C extensions\nwill assume the use of UTF-8 as the default text encoding, rather\nthan ASCII.\n\n- bpo-30486(36): Allows setting cell values for closure.  Patch\nby Lisa Roach.\n\n- bpo-30537(37): itertools.islice now accepts integer-like objects\n(having an index method) as start, stop, and slice arguments\n\n- bpo-25324(38): Tokens needed for parsing in Python moved to C.\n'COMMENT', 'NL' and 'ENCODING'.  This way the tokens and toknames\nin the token module don't get changed when you import the tokenize\nmodule.\n\n- bpo-29104(39): Fixed parsing backslashes in f-strings.\n\n- bpo-27945(40): Fixed various segfaults with dict when input\ncollections are mutated during searching, inserting or comparing.\nBased on patches by Duane Griffin and Tim Mitchell.\n\n- bpo-25794(41): Fixed type.setattr() and type.delattr() for\nnon-interned attribute names.  Based on patch by Eryk Sun.\n\n- bpo-30039(42): If a KeyboardInterrupt happens when the interpreter\nis in the middle of resuming a chain of nested 'yield from' or\n'await' calls, it's now correctly delivered to the innermost frame.\n\n- bpo-28974(43): 'object.format(x, '')' is now equivalent to\n'str(x)' rather than 'format(str(self), '')'.\n\n- bpo-30024(44): Circular imports involving absolute imports with\nbinding a submodule to a name are now supported.\n\n- bpo-12414(45): sys.getsizeof() on a code object now returns the\nsizes which includes the code struct and sizes of objects which it\nreferences.  Patch by Donghee Na.\n\n- bpo-29839(46): len() now raises ValueError rather than\nOverflowError if len() returned a large negative integer.\n\n- bpo-11913(47): README.rst is now included in the list of distutils\nstandard READMEs and therefore included in source distributions.\n\n- bpo-29914(48): Fixed default implementations of reduce and\nreduceex().  object.reduce() no longer takes arguments,\nobject.reduceex() now requires one argument.\n\n- bpo-29949(49): Fix memory usage regression of set and frozenset\nobject.\n\n- bpo-29935(50): Fixed error messages in the index() method of tuple,\nlist and deque when pass indices of wrong type.\n\n- bpo-29816(51): Shift operation now has less opportunity to raise\nOverflowError.  ValueError always is raised rather than\nOverflowError for negative counts.  Shifting zero with non-negative\ncount always returns zero.\n\n- bpo-24821(52): Fixed the slowing down to 25 times in the searching\nof some unlucky Unicode characters.\n\n- bpo-29102(53): Add a unique ID to PyInterpreterState.  This makes\nit easier to identify each subinterpreter.\n\n- bpo-29894(54): The deprecation warning is emitted if complex\nreturns an instance of a strict subclass of complex.  In a future\nversions of Python this can be an error.\n\n- bpo-29859(55): Show correct error messages when any of the\npthread* calls in threadpthread.h fails.\n\n- bpo-29849(56): Fix a memory leak when an ImportError is raised\nduring from import.\n\n- bpo-28856(57): Fix an oversight that %b format for bytes should\nsupport objects follow the buffer protocol.\n\n- bpo-29723(58): The 'sys.path[0]' initialization change for\nbpo-29139(59) caused a regression by revealing an inconsistency in\nhow sys.path is initialized when executing 'main' from a\nzipfile, directory, or other import location.  The interpreter now\nconsistently avoids ever adding the import location's parent\ndirectory to 'sys.path', and ensures no other 'sys.path' entries\nare inadvertently modified when inserting the import location named\non the command line.\n\n- bpo-29568(60): Escaped percent \"%%\" in the format string for\nclassic string formatting no longer allows any characters between\ntwo percents.\n\n- bpo-29714(61): Fix a regression that bytes format may fail when\ncontaining zero bytes inside.\n\n- bpo-29695(62): bool(), float(), list() and tuple() no longer take\nkeyword arguments.  The first argument of int() can now be passes\nonly as positional argument.\n\n- bpo-28893(63): Set correct cause for errors about invalid\nawaitables returned from aiter and anext.\n\n- bpo-28876(64): 'bool(range)' works even if 'len(range)' raises\n*note OverflowError: 68d.\n\n- bpo-29683(65): Fixes to memory allocation in PyCodeSetExtra.\nPatch by Brian Coleman.\n\n- bpo-29684(66): Fix minor regression of\nPyEvalCallObjectWithKeywords.  It should raise TypeError when\nkwargs is not a dict.  But it might cause segv when args=NULL and\nkwargs is not a dict.\n\n- bpo-28598(67): Support rmod for subclasses of str being called\nbefore str.mod.  Patch by Martijn Pieters.\n\n- bpo-29607(68): Fix stackeffect computation for CALLFUNCTIONEX.\nPatch by Matthieu Dartiailh.\n\n- bpo-29602(69): Fix incorrect handling of signed zeros in complex\nconstructor for complex subclasses and for inputs having a\ncomplex method.  Patch by Serhiy Storchaka.\n\n- bpo-29347(70): Fixed possibly dereferencing undefined pointers when\ncreating weakref objects.\n\n- bpo-29463(71): Add 'docstring' field to Module, ClassDef,\nFunctionDef, and AsyncFunctionDef ast nodes.  docstring is not\nfirst stmt in their body anymore.  It affects 'cofirstlineno' and\n'colnotab' of code object for module and class.  (Reverted in\nbpo-32911(72).)\n\n- bpo-29438(73): Fixed use-after-free problem in key sharing dict.\n\n- bpo-29546(74): Set the 'path' and 'name' attribute on ImportError\nfor 'from ... import ...'.\n\n- bpo-29546(75): Improve from-import error message with location\n\n- bpo-29478(76): If maxlinelength=None is specified while using the\nCompat32 policy, it is no longer ignored.  Patch by Mircea Cosbuc.\n\n- bpo-29319(77): Prevent RunMainFromImporter overwriting sys.path[0].\n\n- bpo-29337(78): Fixed possible BytesWarning when compare the code\nobjects.  Warnings could be emitted at compile time.\n\n- bpo-29327(79): Fixed a crash when pass the iterable keyword\nargument to sorted().\n\n- bpo-29034(80): Fix memory leak and use-after-free in os module\n(pathconverter).\n\n- bpo-29159(81): Fix regression in bytes(x) when x.index() raises\nException.\n\n- bpo-29049(82): Call PyObjectGCTRACK() lazily when calling Python\nfunction.  Calling function is up to 5% faster.\n\n- bpo-28927(83): bytes.fromhex() and bytearray.fromhex() now ignore\nall ASCII whitespace, not only spaces.  Patch by Robert Xiao.\n\n- bpo-28932(84): Do not include <sys/random.h> if it does not exist.\n\n- bpo-25677(85): Correct the positioning of the syntax error caret\nfor indented blocks.  Based on patch by Michael Layzell.\n\n- bpo-29000(86): Fixed bytes formatting of octals with zero padding\nin alternate form.\n\n- bpo-18896(87): Python function can now have more than 255\nparameters.  collections.namedtuple() now supports tuples with more\nthan 255 elements.\n\n- bpo-28596(88): The preferred encoding is UTF-8 on Android.  Patch\nwritten by Chi Hsuan Yen.\n\n- bpo-22257(89): Clean up interpreter startup (see PEP 432(90)).\n\n- bpo-26919(91): On Android, operating system data is now always\nencoded/decoded to/from UTF-8, instead of the locale encoding to\navoid inconsistencies with os.fsencode() and os.fsdecode() which\nare already using UTF-8.\n\n- bpo-28991(92): functools.lrucache() was susceptible to an obscure\nreentrancy bug triggerable by a monkey-patched len() function.\n\n- bpo-28147(93): Fix a memory leak in split-table dictionaries:\nsetattr() must not convert combined table into split table.  Patch\nwritten by INADA Naoki.\n\n- bpo-28739(94): f-string expressions are no longer accepted as\ndocstrings and by ast.literaleval() even if they do not include\nexpressions.\n\n- bpo-28512(95): Fixed setting the offset attribute of SyntaxError by\nPyErrSyntaxLocationEx() and PyErrSyntaxLocationObject().\n\n- bpo-28918(96): Fix the cross compilation of xxlimited when Python\nhas been built with PyDEBUG defined.\n\n- bpo-23722(97): Rather than silently producing a class that doesn't\nsupport zero-argument 'super()' in methods, failing to pass the new\n'classcell' namespace entry up to 'type.new' now results in\na 'DeprecationWarning' and a class that supports zero-argument\n'super()'.\n\n- bpo-28797(98): Modifying the class dict inside the setname\nmethod of a descriptor that is used inside that class no longer\nprevents calling the setname method of other descriptors.\n\n- bpo-28799(99): Remove the 'PyEvalGetCallStats()' function and\ndeprecate the untested and undocumented 'sys.callstats()' function.\nRemove the 'CALLPROFILE' special build: use the *note\nsys.setprofile(): 1359. function, *note cProfile: 25. or *note\nprofile: aa. to profile function calls.\n\n- bpo-12844(100): More than 255 arguments can now be passed to a\nfunction.\n\n- bpo-28782(101): Fix a bug in the implementation 'yield from' when\nchecking if the next instruction is YIELDFROM. Regression\nintroduced by WORDCODE (bpo-26647(102)).\n\n- bpo-28774(103): Fix error position of the unicode error in ASCII\nand Latin1 encoders when a string returned by the error handler\ncontains multiple non-encodable characters (non-ASCII for the ASCII\ncodec, characters out of the U+0000-U+00FF range for Latin1).\n\n- bpo-28731(104): Optimize PyDictNewPresized() to create correct\nsize dict.  Improve speed of dict literal with constant keys up to\n30%.\n\n- bpo-28532(105): Show sys.version when -V option is supplied twice.\n\n- bpo-27100(106): The with-statement now checks for enter before\nit checks for exit.  This gives less confusing error messages\nwhen both methods are missing.  Patch by Jonathan Ellington.\n\n- bpo-28746(107): Fix the setinheritable() file descriptor method on\nplatforms that do not have the ioctl FIOCLEX and FIONCLEX commands.\n\n- bpo-26920(108): Fix not getting the locale's charset upon\ninitializing the interpreter, on platforms that do not have\nlanginfo.\n\n- bpo-28648(109): Fixed crash in PyDecodeLocale() in debug build on\nMac OS X when decode astral characters.  Patch by Xiang Zhang.\n\n- bpo-28665(110): Improve speed of the STOREDEREF opcode by 40%.\n\n- bpo-19398(111): Extra slash no longer added to sys.path components\nin case of empty compile-time PYTHONPATH components.\n\n- bpo-28621(112): Sped up converting int to float by reusing faster\nbits counting implementation.  Patch by Adrian Wielgosik.\n\n- bpo-28580(113): Optimize iterating split table values.  Patch by\nXiang Zhang.\n\n- bpo-28583(114): PyDictSetDefault didn't combine split table when\nneeded.  Patch by Xiang Zhang.\n\n- bpo-28128(115): Deprecation warning for invalid str and byte escape\nsequences now prints better information about where the error\noccurs.  Patch by Serhiy Storchaka and Eric Smith.\n\n- bpo-28509(116): dict.update() no longer allocate unnecessary large\nmemory.\n\n- bpo-28426(117): Fixed potential crash in\nPyUnicodeAsDecodedObject() in debug build.\n\n- bpo-28517(118): Fixed of-by-one error in the peephole optimizer\nthat caused keeping unreachable code.\n\n- bpo-28214(119): Improved exception reporting for problematic\nsetname attributes.\n\n- bpo-23782(120): Fixed possible memory leak in PyTracebackAdd()\nand exception loss in PyTraceBackHere().\n\n- bpo-28183(121): Optimize and cleanup dict iteration.\n\n- bpo-26081(122): Added C implementation of asyncio.Future.  Original\npatch by Yury Selivanov.\n\n- bpo-28379(123): Added sanity checks and tests for\nPyUnicodeCopyCharacters().  Patch by Xiang Zhang.\n\n- bpo-28376(124): The type of long range iterator is now registered\nas Iterator.  Patch by Oren Milman.\n\n- bpo-28376(125): Creating instances of rangeiterator by calling\nrangeiterator type now is disallowed.  Calling iter() on range\ninstance is the only way.  Patch by Oren Milman.\n\n- bpo-26906(126): Resolving special methods of uninitialized type now\ncauses implicit initialization of the type instead of a fail.\n\n- bpo-18287(127): PyTypeReady() now checks that tpname is not NULL.\nOriginal patch by Niklas Koep.\n\n- bpo-24098(128): Fixed possible crash when AST is changed in process\nof compiling it.\n\n- bpo-28201(129): Dict reduces possibility of 2nd conflict in hash\ntable when hashes have same lower bits.\n\n- bpo-28350(130): String constants with null character no longer\ninterned.\n\n- bpo-26617(131): Fix crash when GC runs during weakref callbacks.\n\n- bpo-27942(132): String constants now interned recursively in tuples\nand frozensets.\n\n- bpo-28289(133): ImportError.init now resets not specified\nattributes.\n\n- bpo-21578(134): Fixed misleading error message when ImportError\ncalled with invalid keyword args.\n\n- bpo-28203(135): Fix incorrect type in complex(1.0, {2:3}) error\nmessage.  Patch by Soumya Sharma.\n\n- bpo-28086(136): Single var-positional argument of tuple subtype was\npassed unscathed to the C-defined function.  Now it is converted to\nexact tuple.\n\n- bpo-28214(137): Now setname is looked up on the class instead\nof the instance.\n\n- bpo-27955(138): Fallback on reading /dev/urandom device when the\ngetrandom() syscall fails with EPERM, for example when blocked by\nSECCOMP.\n\n- bpo-28192(139): Don't import readline in isolated mode.\n\n- bpo-27441(140): Remove some redundant assignments to obsize in\nlongobject.c.  Thanks Oren Milman.\n\n- bpo-27222(141): Clean up redundant code in longrshift function.\nThanks Oren Milman.\n\n- Upgrade internal unicode databases to Unicode version 9.0.0.\n\n- bpo-28131(142): Fix a regression in zipimport's compilesource().\nzipimport should use the same optimization level as the\ninterpreter.\n\n- bpo-28126(143): Replace PyMEMCPY with memcpy().  Visual Studio can\nproperly optimize memcpy().\n\n- bpo-28120(144): Fix dict.pop() for splitted dictionary when trying\nto remove a \"pending key\" (Not yet inserted in split-table).  Patch\nby Xiang Zhang.\n\n- bpo-26182(145): Raise DeprecationWarning when async and await\nkeywords are used as variable/attribute/class/function name.\n\n- bpo-26182(146): Fix a refleak in code that raises\nDeprecationWarning.\n\n- bpo-28721(147): Fix asynchronous generators aclose() and athrow()\nto handle StopAsyncIteration propagation properly.\n\n- bpo-26110(148): Speed-up method calls: add LOADMETHOD and\nCALLMETHOD opcodes.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31490\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31471\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=31418\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=31416\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=28411\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=28411\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=31411\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=31344\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=31373\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=30465\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=30860\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=31347\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=31343\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=31291\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=31271\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=31243\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=30721\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=31070\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=30747\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=31095\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=31071\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=30978\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=30808\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=30876\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=30703\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=30765\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=31161\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=30814\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=30736\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=30604\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=30597\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=30682\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=30501\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=28180\n\n(35) https://peps.python.org/pep-0538/\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=30486\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=30537\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=25324\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=29104\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=27945\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=25794\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=30039\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=28974\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=30024\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=12414\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=29839\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=11913\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=29914\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=29949\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=29935\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=29816\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=24821\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=29102\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=29894\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=29859\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=29849\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=28856\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=29723\n\n(59) https://bugs.python.org/issue?@action=redirect&bpo=29139\n\n(60) https://bugs.python.org/issue?@action=redirect&bpo=29568\n\n(61) https://bugs.python.org/issue?@action=redirect&bpo=29714\n\n(62) https://bugs.python.org/issue?@action=redirect&bpo=29695\n\n(63) https://bugs.python.org/issue?@action=redirect&bpo=28893\n\n(64) https://bugs.python.org/issue?@action=redirect&bpo=28876\n\n(65) https://bugs.python.org/issue?@action=redirect&bpo=29683\n\n(66) https://bugs.python.org/issue?@action=redirect&bpo=29684\n\n(67) https://bugs.python.org/issue?@action=redirect&bpo=28598\n\n(68) https://bugs.python.org/issue?@action=redirect&bpo=29607\n\n(69) https://bugs.python.org/issue?@action=redirect&bpo=29602\n\n(70) https://bugs.python.org/issue?@action=redirect&bpo=29347\n\n(71) https://bugs.python.org/issue?@action=redirect&bpo=29463\n\n(72) https://bugs.python.org/issue?@action=redirect&bpo=32911\n\n(73) https://bugs.python.org/issue?@action=redirect&bpo=29438\n\n(74) https://bugs.python.org/issue?@action=redirect&bpo=29546\n\n(75) https://bugs.python.org/issue?@action=redirect&bpo=29546\n\n(76) https://bugs.python.org/issue?@action=redirect&bpo=29478\n\n(77) https://bugs.python.org/issue?@action=redirect&bpo=29319\n\n(78) https://bugs.python.org/issue?@action=redirect&bpo=29337\n\n(79) https://bugs.python.org/issue?@action=redirect&bpo=29327\n\n(80) https://bugs.python.org/issue?@action=redirect&bpo=29034\n\n(81) https://bugs.python.org/issue?@action=redirect&bpo=29159\n\n(82) https://bugs.python.org/issue?@action=redirect&bpo=29049\n\n(83) https://bugs.python.org/issue?@action=redirect&bpo=28927\n\n(84) https://bugs.python.org/issue?@action=redirect&bpo=28932\n\n(85) https://bugs.python.org/issue?@action=redirect&bpo=25677\n\n(86) https://bugs.python.org/issue?@action=redirect&bpo=29000\n\n(87) https://bugs.python.org/issue?@action=redirect&bpo=18896\n\n(88) https://bugs.python.org/issue?@action=redirect&bpo=28596\n\n(89) https://bugs.python.org/issue?@action=redirect&bpo=22257\n\n(90) https://peps.python.org/pep-0432/\n\n(91) https://bugs.python.org/issue?@action=redirect&bpo=26919\n\n(92) https://bugs.python.org/issue?@action=redirect&bpo=28991\n\n(93) https://bugs.python.org/issue?@action=redirect&bpo=28147\n\n(94) https://bugs.python.org/issue?@action=redirect&bpo=28739\n\n(95) https://bugs.python.org/issue?@action=redirect&bpo=28512\n\n(96) https://bugs.python.org/issue?@action=redirect&bpo=28918\n\n(97) https://bugs.python.org/issue?@action=redirect&bpo=23722\n\n(98) https://bugs.python.org/issue?@action=redirect&bpo=28797\n\n(99) https://bugs.python.org/issue?@action=redirect&bpo=28799\n\n(100) https://bugs.python.org/issue?@action=redirect&bpo=12844\n\n(101) https://bugs.python.org/issue?@action=redirect&bpo=28782\n\n(102) https://bugs.python.org/issue?@action=redirect&bpo=26647\n\n(103) https://bugs.python.org/issue?@action=redirect&bpo=28774\n\n(104) https://bugs.python.org/issue?@action=redirect&bpo=28731\n\n(105) https://bugs.python.org/issue?@action=redirect&bpo=28532\n\n(106) https://bugs.python.org/issue?@action=redirect&bpo=27100\n\n(107) https://bugs.python.org/issue?@action=redirect&bpo=28746\n\n(108) https://bugs.python.org/issue?@action=redirect&bpo=26920\n\n(109) https://bugs.python.org/issue?@action=redirect&bpo=28648\n\n(110) https://bugs.python.org/issue?@action=redirect&bpo=28665\n\n(111) https://bugs.python.org/issue?@action=redirect&bpo=19398\n\n(112) https://bugs.python.org/issue?@action=redirect&bpo=28621\n\n(113) https://bugs.python.org/issue?@action=redirect&bpo=28580\n\n(114) https://bugs.python.org/issue?@action=redirect&bpo=28583\n\n(115) https://bugs.python.org/issue?@action=redirect&bpo=28128\n\n(116) https://bugs.python.org/issue?@action=redirect&bpo=28509\n\n(117) https://bugs.python.org/issue?@action=redirect&bpo=28426\n\n(118) https://bugs.python.org/issue?@action=redirect&bpo=28517\n\n(119) https://bugs.python.org/issue?@action=redirect&bpo=28214\n\n(120) https://bugs.python.org/issue?@action=redirect&bpo=23782\n\n(121) https://bugs.python.org/issue?@action=redirect&bpo=28183\n\n(122) https://bugs.python.org/issue?@action=redirect&bpo=26081\n\n(123) https://bugs.python.org/issue?@action=redirect&bpo=28379\n\n(124) https://bugs.python.org/issue?@action=redirect&bpo=28376\n\n(125) https://bugs.python.org/issue?@action=redirect&bpo=28376\n\n(126) https://bugs.python.org/issue?@action=redirect&bpo=26906\n\n(127) https://bugs.python.org/issue?@action=redirect&bpo=18287\n\n(128) https://bugs.python.org/issue?@action=redirect&bpo=24098\n\n(129) https://bugs.python.org/issue?@action=redirect&bpo=28201\n\n(130) https://bugs.python.org/issue?@action=redirect&bpo=28350\n\n(131) https://bugs.python.org/issue?@action=redirect&bpo=26617\n\n(132) https://bugs.python.org/issue?@action=redirect&bpo=27942\n\n(133) https://bugs.python.org/issue?@action=redirect&bpo=28289\n\n(134) https://bugs.python.org/issue?@action=redirect&bpo=21578\n\n(135) https://bugs.python.org/issue?@action=redirect&bpo=28203\n\n(136) https://bugs.python.org/issue?@action=redirect&bpo=28086\n\n(137) https://bugs.python.org/issue?@action=redirect&bpo=28214\n\n(138) https://bugs.python.org/issue?@action=redirect&bpo=27955\n\n(139) https://bugs.python.org/issue?@action=redirect&bpo=28192\n\n(140) https://bugs.python.org/issue?@action=redirect&bpo=27441\n\n(141) https://bugs.python.org/issue?@action=redirect&bpo=27222\n\n(142) https://bugs.python.org/issue?@action=redirect&bpo=28131\n\n(143) https://bugs.python.org/issue?@action=redirect&bpo=28126\n\n(144) https://bugs.python.org/issue?@action=redirect&bpo=28120\n\n(145) https://bugs.python.org/issue?@action=redirect&bpo=26182\n\n(146) https://bugs.python.org/issue?@action=redirect&bpo=26182\n\n(147) https://bugs.python.org/issue?@action=redirect&bpo=28721\n\n(148) https://bugs.python.org/issue?@action=redirect&bpo=26110\n\nFile: python3.12.info,  Node: Library<57>,  Next: Documentation<56>,  Prev: Core and Builtins<56>,  Up: Python 3 7 0 alpha 1\n\n1.22.57.3 Library\n.................\n\n- bpo-31499(1): xml.etree: Fix a crash when a parser is part of a\nreference cycle.\n\n- bpo-31482(2): 'random.seed()' now works with bytes in version=1\n\n- bpo-28556(3): typing.gettypehints now finds the right globalns\nfor classes and modules by default (when no 'globalns' was\nspecified by the caller).\n\n- bpo-28556(4): Speed improvements to the 'typing' module.  Original\nPRs by Ivan Levkivskyi and Mitar.\n\n- bpo-31544(5): The C accelerator module of ElementTree ignored\nexceptions raised when looking up TreeBuilder target methods in\nXMLParser().\n\n- bpo-31234(6): socket.createconnection() now fixes manually a\nreference cycle: clear the variable storing the last exception on\nsuccess.\n\n- bpo-31457(7): LoggerAdapter objects can now be nested.\n\n- bpo-31431(8): SSLContext.checkhostname now automatically sets\nSSLContext.verifymode to ssl.CERTREQUIRED instead of failing with\na ValueError.\n\n- bpo-31233(9): socketserver.ThreadingMixIn now keeps a list of\nnon-daemonic threads to wait until all these threads complete in\nserverclose().\n\n- bpo-28638(10): Changed the implementation strategy for\ncollections.namedtuple() to substantially reduce the use of exec()\nin favor of precomputed methods.  As a result, the 'verbose'\nparameter and 'source' attribute are no longer supported.  The\nbenefits include 1) having a smaller memory footprint for\napplications using multiple named tuples, 2) faster creation of the\nnamed tuple class (approx 4x to 6x depending on how it is\nmeasured), and 3) minor speed-ups for instance creation using\nnew, make, and replace.  (The primary patch contributor is\nJelle Zijlstra with further improvements by INADA Naoki, Serhiy\nStorchaka, and Raymond Hettinger.)\n\n- bpo-31400(11): Improves SSL error handling to avoid losing error\nnumbers.\n\n- bpo-27629(12): Make return types of SSLContext.wrapbio() and\nSSLContext.wrapsocket() customizable.\n\n- bpo-28958(13): ssl.SSLContext() now uses OpenSSL error information\nwhen a context cannot be instantiated.\n\n- bpo-28182(14): The SSL module now raises SSLCertVerificationError\nwhen OpenSSL fails to verify the peer's certificate.  The exception\ncontains more information about the error.\n\n- bpo-27340(15): SSLSocket.sendall() now uses memoryview to create\nslices of data.  This fixes support for all bytes-like object.  It\nis also more efficient and avoids costly copies.\n\n- bpo-14191(16): A new function\n'argparse.ArgumentParser.parseintermixedargs' provides the\nability to parse command lines where there user intermixes options\nand positional arguments.\n\n- bpo-31178(17): Fix string concatenation bug in rare error path in\nthe subprocess module\n\n- bpo-31350(18): Micro-optimize 'asyncio.getrunningloop()' to\nbecome up to 10% faster.\n\n- bpo-31170(19): expat: Update libexpat from 2.2.3 to 2.2.4.  Fix\ncopying of partial characters for UTF-8 input (libexpat bug 115):\n'https://github.com/libexpat/libexpat/issues/115'\n\n- bpo-29136(20): Add TLS 1.3 cipher suites and OPNOTLSv13.\n\n- bpo-1198569(21): 'string.Template' subclasses can optionally define\n'braceidpattern' if they want to specify different placeholder\npatterns inside and outside the braces.  If None (the default) it\nfalls back to 'idpattern'.\n\n- bpo-31326(22): concurrent.futures.ProcessPoolExecutor.shutdown()\nnow explicitly closes the call queue.  Moreover,\nshutdown(wait=True) now also join the call queue thread, to prevent\nleaking a dangling thread.\n\n- bpo-27144(23): The 'map()' and 'ascompleted()' iterators in\n'concurrent.futures' now avoid keeping a reference to yielded\nobjects.\n\n- bpo-31281(24): Fix 'fileinput.FileInput(files, inplace=True)' when\n'files' contain 'pathlib.Path' objects.\n\n- bpo-10746(25): Fix ctypes producing wrong PEP 3118(26) type codes\nfor integer types.\n\n- bpo-27584(27): 'AFVSOCK' has been added to the socket interface\nwhich allows communication between virtual machines and their host.\n\n- bpo-22536(28): The subprocess module now sets the filename when\nFileNotFoundError is raised on POSIX systems due to the executable\nor cwd not being found.\n\n- bpo-29741(29): Update some methods in the pyio module to also\naccept integer types.  Patch by Oren Milman.\n\n- bpo-31249(30): concurrent.futures: WorkItem.run() used by\nThreadPoolExecutor now breaks a reference cycle between an\nexception object and the WorkItem object.\n\n- bpo-31247(31): xmlrpc.server now explicitly breaks reference cycles\nwhen using sys.excinfo() in code handling exceptions.\n\n- bpo-23835(32): configparser: reading defaults in the\n'ConfigParser()' constructor is now using 'readdict()', making its\nbehavior consistent with the rest of the parser.  Non-string keys\nand values in the defaults dictionary are now being implicitly\nconverted to strings.  Patch by James Tocknell.\n\n- bpo-31238(33): pydoc: the stop() method of the private ServerThread\nclass now waits until DocServer.serveuntilquit() completes and\nthen explicitly sets its docserver attribute to None to break a\nreference cycle.\n\n- bpo-5001(34): Many asserts in 'multiprocessing' are now more\ninformative, and some error types have been changed to more\nspecific ones.\n\n- bpo-31109(35): Convert zipimport to use Argument Clinic.\n\n- bpo-30102(36): The ssl and hashlib modules now call\nOPENSSLaddallalgorithmsnoconf() on OpenSSL < 1.1.0.  The\nfunction detects CPU features and enables optimizations on some CPU\narchitectures such as POWER8.  Patch is based on research from\nGustavo Serra Scalet.\n\n- bpo-18966(37): Non-daemonic threads created by a\nmultiprocessing.Process are now joined on child exit.\n\n- bpo-31183(38): 'dis' now works with asynchronous generator and\ncoroutine objects.  Patch by George Collins based on diagnosis by\nLuciano Ramalho.\n\n- bpo-5001(39): There are a number of uninformative asserts in the\n'multiprocessing' module, as noted in issue 5001.  This change\nfixes two of the most potentially problematic ones, since they are\nin error-reporting code, in the\n'multiprocessing.managers.converttoerror' function.  (It also\nmakes more informative a ValueError message.)  The only potentially\nproblematic change is that the AssertionError is now a TypeError;\nhowever, this should also help distinguish it from an\nAssertionError being 'reported' by the function/its caller (such as\nin issue 31169).  - Patch by Allen W. Smith (drallensmith on\ngithub).\n\n- bpo-31185(40): Fixed miscellaneous errors in asyncio speedup\nmodule.\n\n- bpo-31151(41): socketserver.ForkingMixIn.serverclose() now waits\nuntil all child processes completed to prevent leaking zombie\nprocesses.\n\n- bpo-31072(42): Add an 'includefile' parameter to\n'zipapp.createarchive()'\n\n- bpo-24700(43): Optimize array.array comparison.  It is now from 10x\nup to 70x faster when comparing arrays holding values of the same\ninteger type.\n\n- bpo-31135(44): ttk: fix the destroy() method of LabeledScale and\nOptionMenu classes.  Call the parent destroy() method even if the\nused attribute doesn't exist.  The LabeledScale.destroy() method\nnow also explicitly clears label and scale attributes to help the\ngarbage collector to destroy all widgets.\n\n- bpo-31107(45): Fix 'copyreg.slotnames()' mangled attribute\ncalculation for classes whose name begins with an underscore.\nPatch by Shane Harvey.\n\n- bpo-31080(46): Allow 'logging.config.fileConfig' to accept kwargs\nand/or args.\n\n- bpo-30897(47): 'pathlib.Path' objects now include an 'ismount()'\nmethod (only implemented on POSIX). This is similar to\n'os.path.ismount(p)'.  Patch by Cooper Ry Lees.\n\n- bpo-31061(48): Fixed a crash when using asyncio and threads.\n\n- bpo-30987(49): Added support for CAN ISO-TP protocol in the socket\nmodule.\n\n- bpo-30522(50): Added a 'setStream' method to\n'logging.StreamHandler' to allow the stream to be set after\ncreation.\n\n- bpo-30502(51): Fix handling of long oids in ssl.  Based on patch by\nChristian Heimes.\n\n- bpo-5288(52): Support tzinfo objects with sub-minute offsets.\n\n- bpo-30919(53): Fix shared memory performance regression in\nmultiprocessing in 3.x.  Shared memory used anonymous memory\nmappings in 2.x, while 3.x mmaps actual files.  Try to be careful\nto do as little disk I/O as possible.\n\n- bpo-26732(54): Fix too many fds in processes started with the\n\"forkserver\" method.  A child process would inherit as many fds as\nthe number of still-running children.\n\n- bpo-29403(55): Fix 'unittest.mock''s autospec to not fail on\nmethod-bound builtin functions.  Patch by Aaron Gallagher.\n\n- bpo-30961(56): Fix decrementing a borrowed reference in\ntracemalloc.\n\n- bpo-19896(57): Fix multiprocessing.sharedctypes to recognize\ntypecodes ''q'' and ''Q''.\n\n- bpo-30946(58): Remove obsolete code in readline module for\nplatforms where GNU readline is older than 2.1 or where select() is\nnot available.\n\n- bpo-25684(59): Change 'ttk.OptionMenu' radiobuttons to be unique\nacross instances of 'OptionMenu'.\n\n- bpo-30886(60): Fix multiprocessing.Queue.jointhread(): it now\nwaits until the thread completes, even if the thread was started by\nthe same process which created the queue.\n\n- bpo-29854(61): Fix segfault in readline when using readline's\nhistory-size option.  Patch by Nir Soffer.\n\n- bpo-30794(62): Added multiprocessing.Process.kill method to\nterminate using the SIGKILL signal on Unix.\n\n- bpo-30319(63): socket.close() now ignores ECONNRESET error.\n\n- bpo-30828(64): Fix out of bounds write in\n'asyncio.CFuture.removedonecallback()'.\n\n- bpo-30302(65): Use keywords in the 'repr' of 'datetime.timedelta'.\n\n- bpo-30807(66): signal.setitimer() may disable the timer when passed\na tiny value.  Tiny values (such as 1e-6) are valid non-zero values\nfor setitimer(), which is specified as taking\nmicrosecond-resolution intervals.  However, on some platform, our\nconversion routine could convert 1e-6 into a zero interval,\ntherefore disabling the timer instead of (re-)scheduling it.\n\n- bpo-30441(67): Fix bug when modifying os.environ while iterating\nover it\n\n- bpo-29585(68): Avoid importing 'sysconfig' from 'site' to improve\nstartup speed.  Python startup is about 5% faster on Linux and 30%\nfaster on macOS.\n\n- bpo-29293(69): Add missing parameter \"n\" on\nmultiprocessing.Condition.notify().  The doc claims\nmultiprocessing.Condition behaves like threading.Condition, but its\nnotify() method lacked the optional \"n\" argument (to specify the\nnumber of sleepers to wake up) that threading.Condition.notify()\naccepts.\n\n- bpo-30532(70): Fix email header value parser dropping folding white\nspace in certain cases.\n\n- bpo-30596(71): Add a 'close()' method to 'multiprocessing.Process'.\n\n- bpo-9146(72): Fix a segmentation fault in hashopenssl when\nstandard hash functions such as md5 are not available in the linked\nOpenSSL library.  As in some special FIPS-140 build environments.\n\n- bpo-29169(73): Update zlib to 1.2.11.\n\n- bpo-30119(74): ftplib.FTP.putline() now throws ValueError on\ncommands that contains CR or LF. Patch by Donghee Na.\n\n- bpo-30879(75): os.listdir() and os.scandir() now emit bytes names\nwhen called with bytes-like argument.\n\n- bpo-30746(76): Prohibited the '=' character in environment variable\nnames in 'os.putenv()' and 'os.spawn*()'.\n\n- bpo-30664(77): The description of a unittest subtest now preserves\nthe order of keyword arguments of TestCase.subTest().\n\n- bpo-21071(78): struct.Struct.format type is now *note str: 157.\ninstead of *note bytes: 295.\n\n- bpo-29212(79): Fix concurrent.futures.thread.ThreadPoolExecutor\nthreads to have a non repr() based thread name by default when no\nthreadnameprefix is supplied.  They will now identify themselves\nas \"ThreadPoolExecutor-yn\".\n\n- bpo-29755(80): Fixed the lgettext() family of functions in the\ngettext module.  They now always return bytes.\n\n- bpo-30616(81): Functional API of enum allows to create empty enums.\nPatched by Donghee Na\n\n- bpo-30038(82): Fix race condition between signal delivery and\nwakeup file descriptor.  Patch by Nathaniel Smith.\n\n- bpo-23894(83): lib2to3 now recognizes 'rb'...'' and 'f'...''\nstrings.\n\n- bpo-24744(84): pkgutil.walkpackages function now raises ValueError\nif 'path' is a string.  Patch by Sanyam Khurana.\n\n- bpo-24484(85): Avoid race condition in multiprocessing cleanup.\n\n- bpo-30589(86): Fix multiprocessing.Process.exitcode to return the\nopposite of the signal number when the process is killed by a\nsignal (instead of 255) when using the \"forkserver\" method.\n\n- bpo-28994(87): The traceback no longer displayed for SystemExit\nraised in a callback registered by atexit.\n\n- bpo-30508(88): Don't log exceptions if Task/Future \"cancel()\"\nmethod was called.\n\n- bpo-30645(89): Fix path calculation in 'imp.loadpackage()', fixing\nit for cases when a package is only shipped with bytecodes.  Patch\nby Alexandru Ardelean.\n\n- bpo-11822(90): The dis.dis() function now is able to disassemble\nnested code objects.\n\n- bpo-30624(91): selectors does not take KeyboardInterrupt and\nSystemExit into account, leaving a fd in a bad state in case of\nerror.  Patch by Giampaolo Rodola'.\n\n- bpo-30595(92): multiprocessing.Queue.get() with a timeout now polls\nits reader in non-blocking mode if it succeeded to acquire the lock\nbut the acquire took longer than the timeout.\n\n- bpo-28556(93): Updates to typing module: Add generic\nAsyncContextManager, add support for ContextManager on all\nversions.  Original PRs by Jelle Zijlstra and Ivan Levkivskyi\n\n- bpo-30605(94): re.compile() no longer raises a BytesWarning when\ncompiling a bytes instance with misplaced inline modifier.  Patch\nby Roy Williams.\n\n- bpo-29870(95): Fix ssl sockets leaks when connection is aborted in\nasyncio/ssl implementation.  Patch by Michae\"l Sgha??er.\n\n- bpo-29743(96): Closing transport during handshake process leaks\nopen socket.  Patch by Nikolay Kim\n\n- bpo-27585(97): Fix waiter cancellation in asyncio.Lock.  Patch by\nMathieu Sornay.\n\n- bpo-30014(98): modify() method of poll(), epoll() and devpoll()\nbased classes of selectors module is around 10% faster.  Patch by\nGiampaolo Rodola'.\n\n- bpo-30418(99): On Windows, subprocess.Popen.communicate() now also\nignore EINVAL on stdin.write() if the child process is still\nrunning but closed the pipe.\n\n- bpo-30463(100): Addded empty slots to abc.ABC. This allows\nsubclassers to deny dict and weakref creation.  Patch by\nAaron Hall.\n\n- bpo-30520(101): Loggers are now pickleable.\n\n- bpo-30557(102): faulthandler now correctly filters and displays\nexception codes on Windows\n\n- bpo-30526(103): Add TextIOWrapper.reconfigure() and a\nTextIOWrapper.writethrough attribute.\n\n- bpo-30245(104): Fix possible overflow when organize\nstruct.packinto error message.  Patch by Yuan Liu.\n\n- bpo-30378(105): Fix the problem that logging.handlers.SysLogHandler\ncannot handle IPv6 addresses.\n\n- bpo-16500(106): Allow registering at-fork handlers.\n\n- bpo-30470(107): Deprecate invalid ctypes call protection on\nWindows.  Patch by Mariatta Wijaya.\n\n- bpo-30414(108): multiprocessing.Queue.feed background running\nthread do not break from main loop on exception.\n\n- bpo-30003(109): Fix handling escape characters in HZ codec.  Based\non patch by Ma Lin.\n\n- bpo-30149(110): inspect.signature() now supports callables with\nvariable-argument parameters wrapped with partialmethod.  Patch by\nDonghee Na.\n\n- bpo-30436(111): importlib.findspec() raises ModuleNotFoundError\ninstead of AttributeError if the specified parent module is not a\npackage (i.e.  lacks a path attribute).\n\n- bpo-30301(112): Fix AttributeError when using SimpleQueue.empty()\nunder 'spawn' and 'forkserver' start methods.\n\n- bpo-30375(113): Warnings emitted when compile a regular expression\nnow always point to the line in the user code.  Previously they\ncould point into inners of the re module if emitted from inside of\ngroups or conditionals.\n\n- bpo-30329(114): imaplib and poplib now catch the Windows socket\nWSAEINVAL error (code 10022) on shutdown(SHUTRDWR): An invalid\noperation was attempted.  This error occurs sometimes on SSL\nconnections.\n\n- bpo-29196(115): Removed previously deprecated in Python 2.4 classes\nPlist, Dict and InternalDict in the plistlib module.  Dict values\nin the result of functions readPlist() and readPlistFromBytes() are\nnow normal dicts.  You no longer can use attribute access to access\nitems of these dictionaries.\n\n- bpo-9850(116): The 'macpath' is now deprecated and will be removed\nin Python 3.8.\n\n- bpo-30299(117): Compiling regular expression in debug mode on\nCPython now displays the compiled bytecode in human readable form.\n\n- bpo-30048(118): Fixed 'Task.cancel()' can be ignored when the task\nis running coroutine and the coroutine returned without any more\n'await'.\n\n- bpo-30266(119): contextlib.AbstractContextManager now supports\nanti-registration by setting enter = None or exit = None,\nfollowing the pattern introduced in bpo-25958(120).  Patch by Jelle\nZijlstra.\n\n- bpo-30340(121): Enhanced regular expressions optimization.  This\nincreased the performance of matching some patterns up to 25 times.\n\n- bpo-30298(122): Weaken the condition of deprecation warnings for\ninline modifiers.  Now allowed several subsequential inline\nmodifiers at the start of the pattern (e.g.  ''(?i)(?s)...'').  In\nverbose mode whitespaces and comments now are allowed before and\nbetween inline modifiers (e.g.  ''(?x) (?i) (?s)...'').\n\n- bpo-30285(123): Optimized case-insensitive matching and searching\nof regular expressions.\n\n- bpo-29990(124): Fix range checking in GB18030 decoder.  Original\npatch by Ma Lin.\n\n- bpo-29979(125): rewrite cgi.parsemultipart, reusing the\nFieldStorage class and making its results consistent with those of\nFieldStorage for multipart/form-data requests.  Patch by Pierre\nQuentel.\n\n- bpo-30243(126): Removed the init methods of json's scanner and\nencoder.  Misusing them could cause memory leaks or crashes.  Now\nscanner and encoder objects are completely initialized in the\nnew methods.\n\n- bpo-30215(127): Compiled regular expression objects with the\nre.LOCALE flag no longer depend on the locale at compile time.\nOnly the locale at matching time affects the result of matching.\n\n- bpo-30185(128): Avoid KeyboardInterrupt tracebacks in forkserver\nhelper process when Ctrl-C is received.\n\n- bpo-30103(129): binascii.b2auu() and uu.encode() now support using\n''`'' as zero instead of space.\n\n- bpo-28556(130): Various updates to typing module: add\ntyping.NoReturn type, use WrapperDescriptorType, minor bug-fixes.\nOriginal PRs by Jim Fasarakis-Hilliard and Ivan Levkivskyi.\n\n- bpo-30205(131): Fix getsockname() for unbound AFUNIX sockets on\nLinux.\n\n- bpo-30228(132): The seek() and tell() methods of io.FileIO now set\nthe internal seekable attribute to avoid one syscall on open() (in\nbuffered or text mode).\n\n- bpo-30190(133): unittest's assertAlmostEqual and\nassertNotAlmostEqual provide a better message in case of failure\nwhich includes the difference between left and right arguments.\n(patch by Giampaolo Rodola')\n\n- bpo-30101(134): Add support for curses.AITALIC.\n\n- bpo-29822(135): inspect.isabstract() now works during\ninitsubclass.  Patch by Nate Soares.\n\n- bpo-29960(136): Preserve generator state when\nrandom.Random.setstate() raises an exception.  Patch by Bryan\nOlson.\n\n- bpo-30070(137): Fixed leaks and crashes in errors handling in the\nparser module.\n\n- bpo-22352(138): Column widths in the output of dis.dis() are now\nadjusted for large line numbers and instruction offsets.\n\n- bpo-30061(139): Fixed crashes in IOBase methods next() and\nreadlines() when readline() or next() respectively return\nnon-sizeable object.  Fixed possible other errors caused by not\nchecking results of PyObjectSize(), PySequenceSize(), or\nPyMappingSize().\n\n- bpo-30218(140): Fix PathLike support for shutil.unpackarchive.\nPatch by Jelle Zijlstra.\n\n- bpo-10076(141): Compiled regular expression and match objects in\nthe re module now support copy.copy() and copy.deepcopy() (they are\nconsidered atomic).\n\n- bpo-30068(142): io.IOBase.readlines will check if it's closed\nfirst when hint is present.\n\n- bpo-29694(143): Fixed race condition in pathlib mkdir with flags\nparents=True.  Patch by Armin Rigo.\n\n- bpo-29692(144): Fixed arbitrary unchaining of RuntimeError\nexceptions in contextlib.contextmanager.  Patch by Siddharth\nVelankar.\n\n- bpo-26187(145): Test that sqlite3 trace callback is not called\nmultiple times when schema is changing.  Indirectly fixed by\nswitching to use sqlite3preparev2() in bpo-9303(146).  Patch by\nAviv Palivoda.\n\n- bpo-30017(147): Allowed calling the close() method of the zip entry\nwriter object multiple times.  Writing to a closed writer now\nalways produces a ValueError.\n\n- bpo-29998(148): Pickling and copying ImportError now preserves name\nand path attributes.\n\n- bpo-29995(149): re.escape() now escapes only regex special\ncharacters.\n\n- bpo-29962(150): Add math.remainder operation, implementing\nremainder as specified in IEEE 754.\n\n- bpo-29649(151): Improve struct.packinto() exception messages for\nproblems with the buffer size and offset.  Patch by Andrew Nester.\n\n- bpo-29654(152): Support If-Modified-Since HTTP header (browser\ncache).  Patch by Pierre Quentel.\n\n- bpo-29931(153): Fixed comparison check for ipaddress.ipinterface\nobjects.  Patch by Sanjay Sundaresan.\n\n- bpo-29953(154): Fixed memory leaks in the replace() method of\ndatetime and time objects when pass out of bound fold argument.\n\n- bpo-29942(155): Fix a crash in itertools.chain.fromiterable when\nencountering long runs of empty iterables.\n\n- bpo-10030(156): Sped up reading encrypted ZIP files by 2 times.\n\n- bpo-29204(157): Element.getiterator() and the html parameter of\nXMLParser() were deprecated only in the documentation (since Python\n3.2 and 3.4 correspondingly).  Now using them emits a deprecation\nwarning.\n\n- bpo-27863(158): Fixed multiple crashes in ElementTree caused by\nrace conditions and wrong types.\n\n- bpo-25996(159): Added support of file descriptors in os.scandir()\non Unix.  os.fwalk() is sped up by 2 times by using os.scandir().\n\n- bpo-28699(160): Fixed a bug in pools in multiprocessing.pool that\nraising an exception at the very first of an iterable may swallow\nthe exception or make the program hang.  Patch by Davin Potts and\nXiang Zhang.\n\n- bpo-23890(161): unittest.TestCase.assertRaises() now manually\nbreaks a reference cycle to not keep objects alive longer than\nexpected.\n\n- bpo-29901(162): The zipapp module now supports general path-like\nobjects, not just pathlib.Path.\n\n- bpo-25803(163): Avoid incorrect errors raised by\nPath.mkdir(existok=True) when the OS gives priority to errors such\nas EACCES over EEXIST.\n\n- bpo-29861(164): Release references to tasks, their arguments and\ntheir results as soon as they are finished in multiprocessing.Pool.\n\n- bpo-19930(165): The mode argument of os.makedirs() no longer\naffects the file permission bits of newly created\nintermediate-level directories.\n\n- bpo-29884(166): faulthandler: Restore the old sigaltstack during\nteardown.  Patch by Christophe Zeitouny.\n\n- bpo-25455(167): Fixed crashes in repr of recursive buffered\nfile-like objects.\n\n- bpo-29800(168): Fix crashes in partial.repr if the keys of\npartial.keywords are not strings.  Patch by Michael Seifert.\n\n- bpo-8256(169): Fixed possible failing or crashing input() if\nattributes \"encoding\" or \"errors\" of sys.stdin or sys.stdout are\nnot set or are not strings.\n\n- bpo-28692(170): Using non-integer value for selecting a plural form\nin gettext is now deprecated.\n\n- bpo-26121(171): Use C library implementation for math functions\nerf() and erfc().\n\n- bpo-29619(172): os.stat() and os.DirEntry.inode() now convert inode\n(stino) using unsigned integers.\n\n- bpo-28298(173): Fix a bug that prevented array 'Q', 'L' and 'I'\nfrom accepting big intables (objects that have int) as\nelements.\n\n- bpo-29645(174): Speed up importing the webbrowser module.\nwebbrowser.register() is now thread-safe.\n\n- bpo-28231(175): The zipfile module now accepts path-like objects\nfor external paths.\n\n- bpo-26915(176): index() and count() methods of\ncollections.abc.Sequence now check identity before checking\nequality when do comparisons.\n\n- bpo-28682(177): Added support for bytes paths in os.fwalk().\n\n- bpo-29728(178): Add new 'socket.TCPNOTSENTLOWAT' (Linux 3.12)\nconstant.  Patch by Nathaniel J. Smith.\n\n- bpo-29623(179): Allow use of path-like object as a single argument\nin ConfigParser.read().  Patch by David Ellis.\n\n- bpo-9303(180): Migrate sqlite3 module to v2 API. Patch by Aviv\nPalivoda.\n\n- bpo-28963(181): Fix out of bound iteration in\nasyncio.Future.removedonecallback implemented in C.\n\n- bpo-29704(182): asyncio.subprocess.SubprocessStreamProtocol no\nlonger closes before all pipes are closed.\n\n- bpo-29271(183): Fix Task.currenttask and Task.alltasks\nimplemented in C to accept None argument as their pure Python\nimplementation.\n\n- bpo-29703(184): Fix asyncio to support instantiation of new event\nloops in child processes.\n\n- bpo-29615(185): SimpleXMLRPCDispatcher no longer chains KeyError\n(or any other exception) to exception(s) raised in the dispatched\nmethods.  Patch by Petr Motejlek.\n\n- bpo-7769(186): Method registerfunction() of\nxmlrpc.server.SimpleXMLRPCDispatcher and its subclasses can now be\nused as a decorator.\n\n- bpo-29376(187): Fix assertion error in\nthreading.DummyThread.isalive().\n\n- bpo-28624(188): Add a test that checks that cwd parameter of\nPopen() accepts PathLike objects.  Patch by Sayan Chowdhury.\n\n- bpo-28518(189): Start a transaction implicitly before a DML\nstatement.  Patch by Aviv Palivoda.\n\n- bpo-29742(190): getextrainfo() raises exception if get called on\nclosed ssl transport.  Patch by Nikolay Kim.\n\n- bpo-16285(191): urllib.parse.quote is now based on RFC 3986 and\nhence includes '~' in the set of characters that is not quoted by\ndefault.  Patch by Christian Theune and Ratnadeep Debnath.\n\n- bpo-29532(192): Altering a kwarg dictionary passed to\nfunctools.partial() no longer affects a partial object after\ncreation.\n\n- bpo-29110(193): Fix file object leak in aifc.open() when file is\ngiven as a filesystem path and is not in valid AIFF format.  Patch\nby Anthony Zhang.\n\n- bpo-22807(194): Add uuid.SafeUUID and uuid.UUID.issafe to relay\ninformation from the platform about whether generated UUIDs are\ngenerated with a multiprocessing safe method.\n\n- bpo-29576(195): Improve some deprecations in importlib.  Some\ndeprecated methods now emit DeprecationWarnings and have better\ndescriptive messages.\n\n- bpo-29534(196): Fixed different behaviour of Decimal.fromfloat()\nfor decimal and pydecimal.  Thanks Andrew Nester.\n\n- bpo-10379(197): locale.formatstring now supports the 'monetary'\nkeyword argument, and locale.format is deprecated.\n\n- bpo-29851(198): importlib.reload() now raises ModuleNotFoundError\nif the module lacks a spec.\n\n- bpo-28556(199): Various updates to typing module: typing.Counter,\ntyping.ChainMap, improved ABC caching, etc.  Original PRs by Jelle\nZijlstra, Ivan Levkivskyi, Manuel Krebber, and ??ukasz Langa.\n\n- bpo-29100(200): Fix datetime.fromtimestamp() regression introduced\nin Python 3.6.0: check minimum and maximum years.\n\n- bpo-29416(201): Prevent infinite loop in pathlib.Path.mkdir\n\n- bpo-29444(202): Fixed out-of-bounds buffer access in the group()\nmethod of the match object.  Based on patch by WGH.\n\n- bpo-29377(203): Add WrapperDescriptorType, MethodWrapperType, and\nMethodDescriptorType built-in types to types module.  Original\npatch by Manuel Krebber.\n\n- bpo-29218(204): Unused installmisc command is now removed.  It has\nbeen documented as unused since 2000.  Patch by Eric N. Vander\nWeele.\n\n- bpo-29368(205): The extend() method is now called instead of the\nappend() method when unpickle collections.deque and other list-like\nobjects.  This can speed up unpickling to 2 times.\n\n- bpo-29338(206): The help of a builtin or extension class now\nincludes the constructor signature if textsignature is\nprovided for the class.\n\n- bpo-29335(207): Fix subprocess.Popen.wait() when the child process\nhas exited to a stopped instead of terminated state (ex: when under\nptrace).\n\n- bpo-29290(208): Fix a regression in argparse that help messages\nwould wrap at non-breaking spaces.\n\n- bpo-28735(209): Fixed the comparison of mock.MagickMock with\nmock.ANY.\n\n- bpo-29197(210): Removed deprecated function ntpath.splitunc().\n\n- bpo-29210(211): Removed support of deprecated argument \"exclude\" in\ntarfile.TarFile.add().\n\n- bpo-29219(212): Fixed infinite recursion in the repr of\nuninitialized ctypes.CDLL instances.\n\n- bpo-29192(213): Removed deprecated features in the http.cookies\nmodule.\n\n- bpo-29193(214): A format string argument for\nstring.Formatter.format() is now positional-only.\n\n- bpo-29195(215): Removed support of deprecated undocumented keyword\narguments in methods of regular expression objects.\n\n- bpo-28969(216): Fixed race condition in C implementation of\nfunctools.lrucache.  KeyError could be raised when cached function\nwith full cache was simultaneously called from different threads\nwith the same uncached arguments.\n\n- bpo-20804(217): The unittest.mock.sentinel attributes now preserve\ntheir identity when they are copied or pickled.\n\n- bpo-29142(218): In urllib.request, suffixes in noproxy environment\nvariable with leading dots could match related hostnames again\n(e.g.  .b.c matches a.b.c).  Patch by Milan Oberkirch.\n\n- bpo-28961(219): Fix unittest.mock.Call helper: don't ignore the\nname parameter anymore.  Patch written by Jiajun Huang.\n\n- bpo-15812(220): inspect.getframeinfo() now correctly shows the\nfirst line of a context.  Patch by Sam Breese.\n\n- bpo-28985(221): Update authorizer constants in sqlite3 module.\nPatch by Dingyuan Wang.\n\n- bpo-29079(222): Prevent infinite loop in pathlib.resolve() on\nWindows\n\n- bpo-13051(223): Fixed recursion errors in large or resized\ncurses.textpad.Textbox.  Based on patch by Tycho Andersen.\n\n- bpo-9770(224): curses.ascii predicates now work correctly with\nnegative integers.\n\n- bpo-28427(225): old keys should not remove new values from\nWeakValueDictionary when collecting from another thread.\n\n- bpo-28923(226): Remove editor artifacts from Tix.py.\n\n- bpo-28871(227): Fixed a crash when deallocate deep ElementTree.\n\n- bpo-19542(228): Fix bugs in WeakValueDictionary.setdefault() and\nWeakValueDictionary.pop() when a GC collection happens in another\nthread.\n\n- bpo-20191(229): Fixed a crash in resource.prlimit() when passing a\nsequence that doesn't own its elements as limits.\n\n- bpo-16255(230): subprocess.Popen uses /system/bin/sh on Android as\nthe shell, instead of /bin/sh.\n\n- bpo-28779(231): multiprocessing.setforkserverpreload() would\ncrash the forkserver process if a preloaded module instantiated\nsome multiprocessing objects such as locks.\n\n- bpo-26937(232): The chown() method of the tarfile.TarFile class\ndoes not fail now when the grp module cannot be imported, as for\nexample on Android platforms.\n\n- bpo-28847(233): dbm.dumb now supports reading read-only files and\nno longer writes the index file when it is not changed.  A\ndeprecation warning is now emitted if the index file is missed and\nrecreated in the 'r' and 'w' modes (will be an error in future\nPython releases).\n\n- bpo-27030(234): Unknown escapes consisting of ''\\'' and an ASCII\nletter in re.sub() replacement templates regular expressions now\nare errors.\n\n- bpo-28835(235): Fix a regression introduced in\nwarnings.catchwarnings(): call warnings.showwarning() if it was\noverridden inside the context manager.\n\n- bpo-27172(236): To assist with upgrades from 2.7, the previously\ndocumented deprecation of 'inspect.getfullargspec()' has been\nreversed.  This decision may be revisited again after the Python\n2.7 branch is no longer officially supported.\n\n- bpo-28740(237): Add sys.getandroidapilevel(): return the build time\nAPI version of Android as an integer.  Function only available on\nAndroid.\n\n- bpo-26273(238): Add new 'socket.TCPCONGESTION' (Linux 2.6.13) and\n'socket.TCPUSERTIMEOUT' (Linux 2.6.37) constants.  Patch written\nby Omar Sandoval.\n\n- bpo-28752(239): Restored the reduce() methods of datetime\nobjects.\n\n- bpo-28727(240): Regular expression patterns, sre.SREPattern\nobjects created by re.compile(), become comparable (only x==y and\nx!=y operators).  This change should fix the bpo-18383(241): don't\nduplicate warning filters when the warnings module is reloaded\n(thing usually only done in unit tests).\n\n- bpo-20572(242): Remove the subprocess.Popen.wait endtime parameter.\nIt was deprecated in 3.4 and undocumented prior to that.\n\n- bpo-25659(243): In ctypes, prevent a crash calling the\nfrombuffer() and frombuffercopy() methods on abstract classes\nlike Array.\n\n- bpo-28548(244): In the \"http.server\" module, parse the protocol\nversion if possible, to avoid using HTTP 0.9 in some error\nresponses.\n\n- bpo-19717(245): Makes Path.resolve() succeed on paths that do not\nexist.  Patch by Vajrasky Kok\n\n- bpo-28563(246): Fixed possible DoS and arbitrary code execution\nwhen handle plural form selections in the gettext module.  The\nexpression parser now supports exact syntax supported by GNU\ngettext.\n\n- bpo-28387(247): Fixed possible crash in io.TextIOWrapper\ndeallocator when the garbage collector is invoked in other thread.\nBased on patch by Sebastian Cufre.\n\n- bpo-27517(248): LZMA compressor and decompressor no longer raise\nexceptions if given empty data twice.  Patch by Benjamin Fogle.\n\n- bpo-28549(249): Fixed segfault in curses's addch() with ncurses6.\n\n- bpo-28449(250): tarfile.open() with mode \"r\" or \"r:\" now tries to\nopen a tar file with compression before trying to open it without\ncompression.  Otherwise it had 50% chance failed with\nignorezeros=True.\n\n- bpo-23262(251): The webbrowser module now supports Firefox 36+ and\nderived browsers.  Based on patch by Oleg Broytman.\n\n- bpo-24241(252): The webbrowser in an X environment now prefers\nusing the default browser directly.  Also, the webbrowser\nregister() function now has a documented 'preferred' argument, to\nspecify browsers to be returned by get() with no arguments.  Patch\nby David Steele\n\n- bpo-27939(253): Fixed bugs in tkinter.ttk.LabeledScale and\ntkinter.Scale caused by representing the scale as float value\ninternally in Tk.  tkinter.IntVar now works if float value is set\nto underlying Tk variable.\n\n- bpo-28255(254): calendar.TextCalendar.prweek() no longer prints a\nspace after a weeks's calendar.  calendar.TextCalendar.pryear() no\nlonger prints redundant newline after a year's calendar.  Based on\npatch by Xiang Zhang.\n\n- bpo-28255(255): calendar.TextCalendar.prmonth() no longer prints a\nspace at the start of new line after printing a month's calendar.\nPatch by Xiang Zhang.\n\n- bpo-20491(256): The textwrap.TextWrapper class now honors\nnon-breaking spaces.  Based on patch by Kaarle Ritvanen.\n\n- bpo-28353(257): os.fwalk() no longer fails on broken links.\n\n- bpo-28430(258): Fix iterator of C implemented asyncio.Future\ndoesn't accept non-None value is passed to it.send(val).\n\n- bpo-27025(259): Generated names for Tkinter widgets now start by\nthe \"!\" prefix for readability.\n\n- bpo-25464(260): Fixed HList.headerexists() in tkinter.tix module\nby addin a workaround to Tix library bug.\n\n- bpo-28488(261): shutil.makearchive() no longer adds entry \"./\" to\nZIP archive.\n\n- bpo-25953(262): re.sub() now raises an error for invalid numerical\ngroup reference in replacement template even if the pattern is not\nfound in the string.  Error message for invalid group reference now\nincludes the group index and the position of the reference.  Based\non patch by SilentGhost.\n\n- bpo-28469(263): timeit now uses the sequence 1, 2, 5, 10, 20, 50,...\ninstead of 1, 10, 100,... for autoranging.\n\n- bpo-28115(264): Command-line interface of the zipfile module now\nuses argparse.  Added support of long options.\n\n- bpo-18219(265): Optimize csv.DictWriter for large number of\ncolumns.  Patch by Mariatta Wijaya.\n\n- bpo-28448(266): Fix C implemented asyncio.Future didn't work on\nWindows.\n\n- bpo-23214(267): In the \"io\" module, the argument to BufferedReader\nand BytesIO's read1() methods is now optional and can be -1,\nmatching the BufferedIOBase specification.\n\n- bpo-28480(268): Fix error building socket module when\nmultithreading is disabled.\n\n- bpo-28240(269): timeit: remove '-c/--clock' and '-t/--time' command\nline options which were deprecated since Python 3.3.\n\n- bpo-28240(270): timeit now repeats the benchmarks 5 times instead\nof only 3 to make benchmarks more reliable.\n\n- bpo-28240(271): timeit autorange now uses a single loop iteration\nif the benchmark takes less than 10 seconds, instead of 10\niterations.  \"python3 -m timeit -s 'import time' 'time.sleep(1)'\"\nnow takes 4 seconds instead of 40 seconds.\n\n- Distutils.sdist now looks for README and setup.py files with case\nsensitivity.  This behavior matches that found in Setuptools 6.0\nand later.  See setuptools 100(272) for rationale.\n\n- bpo-24452(273): Make webbrowser support Chrome on Mac OS X. Patch\nby Ned Batchelder.\n\n- bpo-20766(274): Fix references leaked by pdb in the handling of\nSIGINT handlers.\n\n- bpo-27998(275): Fixed bytes path support in os.scandir() on\nWindows.  Patch by Eryk Sun.\n\n- bpo-28317(276): The disassembler now decodes FORMATVALUE argument.\n\n- bpo-28380(277): unittest.mock Mock autospec functions now properly\nsupport assertcalled, assertnotcalled, and assertcalledonce.\n\n- bpo-28229(278): lzma module now supports pathlib.\n\n- bpo-28321(279): Fixed writing non-BMP characters with binary format\nin plistlib.\n\n- bpo-28225(280): bz2 module now supports pathlib.  Initial patch by\nEthan Furman.\n\n- bpo-28227(281): gzip now supports pathlib.  Patch by Ethan Furman.\n\n- bpo-28332(282): Deprecated silent truncations in socket.htons and\nsocket.ntohs.  Original patch by Oren Milman.\n\n- bpo-27358(283): Optimized merging var-keyword arguments and\nimproved error message when passing a non-mapping as a var-keyword\nargument.\n\n- bpo-28257(284): Improved error message when passing a non-iterable\nas a var-positional argument.  Added opcode\nBUILDTUPLEUNPACKWITHCALL.\n\n- bpo-28322(285): Fixed possible crashes when unpickle itertools\nobjects from incorrect pickle data.  Based on patch by John Leitch.\n\n- bpo-28228(286): imghdr now supports pathlib.\n\n- bpo-28226(287): compileall now supports pathlib.\n\n- bpo-28314(288): Fix function declaration (C flags) for the\ngetiterator() method of xml.etree.ElementTree.Element.\n\n- bpo-28148(289): Stop using localtime() and gmtime() in the time\nmodule.  Introduced platform independent PyTimelocaltime API that\nis similar to POSIX localtimer, but available on all platforms.\nPatch by Ed Schouten.\n\n- bpo-28253(290): Fixed calendar functions for extreme months:\n0001-01 and 9999-12.  Methods itermonthdays() and itermonthdays2()\nare reimplemented so that they don't call itermonthdates() which\ncan cause datetime.date under/overflow.\n\n- bpo-28275(291): Fixed possible use after free in the decompress()\nmethods of the LZMADecompressor and BZ2Decompressor classes.\nOriginal patch by John Leitch.\n\n- bpo-27897(292): Fixed possible crash in\nsqlite3.Connection.createcollation() if pass invalid string-like\nobject as a name.  Patch by Xiang Zhang.\n\n- bpo-18844(293): random.choices() now has k as a keyword-only\nargument to improve the readability of common cases and come into\nline with the signature used in other languages.\n\n- bpo-18893(294): Fix invalid exception handling in\nLib/ctypes/macholib/dyld.py.  Patch by Madison May.\n\n- bpo-27611(295): Fixed support of default root window in the\ntkinter.tix module.  Added the master parameter in the DisplayStyle\nconstructor.\n\n- bpo-27348(296): In the traceback module, restore the formatting of\nexception messages like \"Exception: None\".  This fixes a regression\nintroduced in 3.5a2.\n\n- bpo-25651(297): Allow false values to be used for msg parameter of\nsubTest().\n\n- bpo-27778(298): Fix a memory leak in os.getrandom() when the\ngetrandom() is interrupted by a signal and a signal handler raises\na Python exception.\n\n- bpo-28200(299): Fix memory leak on Windows in the os module (fix\npathconverter() function).\n\n- bpo-25400(300): RobotFileParser now correctly returns default\nvalues for crawldelay and requestrate.  Initial patch by Peter\nWirtz.\n\n- bpo-27932(301): Prevent memory leak in win32ver().\n\n- Fix UnboundLocalError in socket.sendfileusesendfile.\n\n- bpo-28075(302): Check for ERRORACCESSDENIED in Windows\nimplementation of os.stat().  Patch by Eryk Sun.\n\n- bpo-22493(303): Warning message emitted by using inline flags in\nthe middle of regular expression now contains a (truncated) regex\npattern.  Patch by Tim Graham.\n\n- bpo-25270(304): Prevent codecs.escapeencode() from raising\nSystemError when an empty bytestring is passed.\n\n- bpo-28181(305): Get antigravity over HTTPS. Patch by Kaartic\nSivaraam.\n\n- bpo-25895(306): Enable WebSocket URL schemes in\nurllib.parse.urljoin.  Patch by Gergely Imreh and Markus\nHoltermann.\n\n- bpo-28114(307): Fix a crash in parseenvlist() when env contains\nbyte strings.  Patch by Eryk Sun.\n\n- bpo-27599(308): Fixed buffer overrun in binascii.b2aqp() and\nbinascii.a2bqp().\n\n- bpo-27906(309): Fix socket accept exhaustion during high TCP\ntraffic.  Patch by Kevin Conway.\n\n- bpo-28174(310): Handle when SOREUSEPORT isn't properly supported.\nPatch by Seth Michael Larson.\n\n- bpo-26654(311): Inspect functools.partial in\nasyncio.Handle.repr.  Patch by iceboy.\n\n- bpo-26909(312): Fix slow pipes IO in asyncio.  Patch by INADA\nNaoki.\n\n- bpo-28176(313): Fix callbacks race in\nasyncio.SelectorLoop.sockconnect.\n\n- bpo-27759(314): Fix selectors incorrectly retain invalid file\ndescriptors.  Patch by Mark Williams.\n\n- bpo-28325(315): Remove vestigial MacOS 9 macurl2path module and its\ntests.\n\n- bpo-28368(316): Refuse monitoring processes if the child watcher\nhas no loop attached.  Patch by Vincent Michel.\n\n- bpo-28369(317): Raise RuntimeError when transport's FD is used with\naddreader, addwriter, etc.\n\n- bpo-28370(318): Speedup asyncio.StreamReader.readexactly.  Patch by\n?????????????????? ????????.\n\n- bpo-28371(319): Deprecate passing asyncio.Handles to\nruninexecutor.\n\n- bpo-28372(320): Fix asyncio to support formatting of non-python\ncoroutines.\n\n- bpo-28399(321): Remove UNIX socket from FS before binding.  Patch\nby ?????????????????? ????????.\n\n- bpo-27972(322): Prohibit Tasks to await on themselves.\n\n- bpo-24142(323): Reading a corrupt config file left configparser in\nan invalid state.  Original patch by Florian Ho\"ch.\n\n- bpo-29581(324): ABCMeta.new now accepts 'kwargs', allowing\nabstract base classes to use keyword parameters in\ninitsubclass.  Patch by Nate Soares.\n\n- bpo-25532(325): inspect.unwrap() will now only try to unwrap an\nobject sys.getrecursionlimit() times, to protect against objects\nwhich create a new object on every attribute access.\n\n- bpo-30177(326): path.resolve(strict=False) no longer cuts the path\nafter the first element not present in the filesystem.  Patch by\nAntoine Pietri.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31499\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31482\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=28556\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=28556\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=31544\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=31234\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=31457\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=31431\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=31233\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=28638\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=31400\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=27629\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=28958\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=28182\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=27340\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=14191\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=31178\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=31350\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=31170\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=29136\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=1198569\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=31326\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=27144\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=31281\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=10746\n\n(26) https://peps.python.org/pep-3118/\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=27584\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=22536\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=29741\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=31249\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=31247\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=23835\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=31238\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=5001\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=31109\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=30102\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=18966\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=31183\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=5001\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=31185\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=31151\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=31072\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=24700\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=31135\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=31107\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=31080\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=30897\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=31061\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=30987\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=30522\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=30502\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=5288\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=30919\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=26732\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=29403\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=30961\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=19896\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=30946\n\n(59) https://bugs.python.org/issue?@action=redirect&bpo=25684\n\n(60) https://bugs.python.org/issue?@action=redirect&bpo=30886\n\n(61) https://bugs.python.org/issue?@action=redirect&bpo=29854\n\n(62) https://bugs.python.org/issue?@action=redirect&bpo=30794\n\n(63) https://bugs.python.org/issue?@action=redirect&bpo=30319\n\n(64) https://bugs.python.org/issue?@action=redirect&bpo=30828\n\n(65) https://bugs.python.org/issue?@action=redirect&bpo=30302\n\n(66) https://bugs.python.org/issue?@action=redirect&bpo=30807\n\n(67) https://bugs.python.org/issue?@action=redirect&bpo=30441\n\n(68) https://bugs.python.org/issue?@action=redirect&bpo=29585\n\n(69) https://bugs.python.org/issue?@action=redirect&bpo=29293\n\n(70) https://bugs.python.org/issue?@action=redirect&bpo=30532\n\n(71) https://bugs.python.org/issue?@action=redirect&bpo=30596\n\n(72) https://bugs.python.org/issue?@action=redirect&bpo=9146\n\n(73) https://bugs.python.org/issue?@action=redirect&bpo=29169\n\n(74) https://bugs.python.org/issue?@action=redirect&bpo=30119\n\n(75) https://bugs.python.org/issue?@action=redirect&bpo=30879\n\n(76) https://bugs.python.org/issue?@action=redirect&bpo=30746\n\n(77) https://bugs.python.org/issue?@action=redirect&bpo=30664\n\n(78) https://bugs.python.org/issue?@action=redirect&bpo=21071\n\n(79) https://bugs.python.org/issue?@action=redirect&bpo=29212\n\n(80) https://bugs.python.org/issue?@action=redirect&bpo=29755\n\n(81) https://bugs.python.org/issue?@action=redirect&bpo=30616\n\n(82) https://bugs.python.org/issue?@action=redirect&bpo=30038\n\n(83) https://bugs.python.org/issue?@action=redirect&bpo=23894\n\n(84) https://bugs.python.org/issue?@action=redirect&bpo=24744\n\n(85) https://bugs.python.org/issue?@action=redirect&bpo=24484\n\n(86) https://bugs.python.org/issue?@action=redirect&bpo=30589\n\n(87) https://bugs.python.org/issue?@action=redirect&bpo=28994\n\n(88) https://bugs.python.org/issue?@action=redirect&bpo=30508\n\n(89) https://bugs.python.org/issue?@action=redirect&bpo=30645\n\n(90) https://bugs.python.org/issue?@action=redirect&bpo=11822\n\n(91) https://bugs.python.org/issue?@action=redirect&bpo=30624\n\n(92) https://bugs.python.org/issue?@action=redirect&bpo=30595\n\n(93) https://bugs.python.org/issue?@action=redirect&bpo=28556\n\n(94) https://bugs.python.org/issue?@action=redirect&bpo=30605\n\n(95) https://bugs.python.org/issue?@action=redirect&bpo=29870\n\n(96) https://bugs.python.org/issue?@action=redirect&bpo=29743\n\n(97) https://bugs.python.org/issue?@action=redirect&bpo=27585\n\n(98) https://bugs.python.org/issue?@action=redirect&bpo=30014\n\n(99) https://bugs.python.org/issue?@action=redirect&bpo=30418\n\n(100) https://bugs.python.org/issue?@action=redirect&bpo=30463\n\n(101) https://bugs.python.org/issue?@action=redirect&bpo=30520\n\n(102) https://bugs.python.org/issue?@action=redirect&bpo=30557\n\n(103) https://bugs.python.org/issue?@action=redirect&bpo=30526\n\n(104) https://bugs.python.org/issue?@action=redirect&bpo=30245\n\n(105) https://bugs.python.org/issue?@action=redirect&bpo=30378\n\n(106) https://bugs.python.org/issue?@action=redirect&bpo=16500\n\n(107) https://bugs.python.org/issue?@action=redirect&bpo=30470\n\n(108) https://bugs.python.org/issue?@action=redirect&bpo=30414\n\n(109) https://bugs.python.org/issue?@action=redirect&bpo=30003\n\n(110) https://bugs.python.org/issue?@action=redirect&bpo=30149\n\n(111) https://bugs.python.org/issue?@action=redirect&bpo=30436\n\n(112) https://bugs.python.org/issue?@action=redirect&bpo=30301\n\n(113) https://bugs.python.org/issue?@action=redirect&bpo=30375\n\n(114) https://bugs.python.org/issue?@action=redirect&bpo=30329\n\n(115) https://bugs.python.org/issue?@action=redirect&bpo=29196\n\n(116) https://bugs.python.org/issue?@action=redirect&bpo=9850\n\n(117) https://bugs.python.org/issue?@action=redirect&bpo=30299\n\n(118) https://bugs.python.org/issue?@action=redirect&bpo=30048\n\n(119) https://bugs.python.org/issue?@action=redirect&bpo=30266\n\n(120) https://bugs.python.org/issue?@action=redirect&bpo=25958\n\n(121) https://bugs.python.org/issue?@action=redirect&bpo=30340\n\n(122) https://bugs.python.org/issue?@action=redirect&bpo=30298\n\n(123) https://bugs.python.org/issue?@action=redirect&bpo=30285\n\n(124) https://bugs.python.org/issue?@action=redirect&bpo=29990\n\n(125) https://bugs.python.org/issue?@action=redirect&bpo=29979\n\n(126) https://bugs.python.org/issue?@action=redirect&bpo=30243\n\n(127) https://bugs.python.org/issue?@action=redirect&bpo=30215\n\n(128) https://bugs.python.org/issue?@action=redirect&bpo=30185\n\n(129) https://bugs.python.org/issue?@action=redirect&bpo=30103\n\n(130) https://bugs.python.org/issue?@action=redirect&bpo=28556\n\n(131) https://bugs.python.org/issue?@action=redirect&bpo=30205\n\n(132) https://bugs.python.org/issue?@action=redirect&bpo=30228\n\n(133) https://bugs.python.org/issue?@action=redirect&bpo=30190\n\n(134) https://bugs.python.org/issue?@action=redirect&bpo=30101\n\n(135) https://bugs.python.org/issue?@action=redirect&bpo=29822\n\n(136) https://bugs.python.org/issue?@action=redirect&bpo=29960\n\n(137) https://bugs.python.org/issue?@action=redirect&bpo=30070\n\n(138) https://bugs.python.org/issue?@action=redirect&bpo=22352\n\n(139) https://bugs.python.org/issue?@action=redirect&bpo=30061\n\n(140) https://bugs.python.org/issue?@action=redirect&bpo=30218\n\n(141) https://bugs.python.org/issue?@action=redirect&bpo=10076\n\n(142) https://bugs.python.org/issue?@action=redirect&bpo=30068\n\n(143) https://bugs.python.org/issue?@action=redirect&bpo=29694\n\n(144) https://bugs.python.org/issue?@action=redirect&bpo=29692\n\n(145) https://bugs.python.org/issue?@action=redirect&bpo=26187\n\n(146) https://bugs.python.org/issue?@action=redirect&bpo=9303\n\n(147) https://bugs.python.org/issue?@action=redirect&bpo=30017\n\n(148) https://bugs.python.org/issue?@action=redirect&bpo=29998\n\n(149) https://bugs.python.org/issue?@action=redirect&bpo=29995\n\n(150) https://bugs.python.org/issue?@action=redirect&bpo=29962\n\n(151) https://bugs.python.org/issue?@action=redirect&bpo=29649\n\n(152) https://bugs.python.org/issue?@action=redirect&bpo=29654\n\n(153) https://bugs.python.org/issue?@action=redirect&bpo=29931\n\n(154) https://bugs.python.org/issue?@action=redirect&bpo=29953\n\n(155) https://bugs.python.org/issue?@action=redirect&bpo=29942\n\n(156) https://bugs.python.org/issue?@action=redirect&bpo=10030\n\n(157) https://bugs.python.org/issue?@action=redirect&bpo=29204\n\n(158) https://bugs.python.org/issue?@action=redirect&bpo=27863\n\n(159) https://bugs.python.org/issue?@action=redirect&bpo=25996\n\n(160) https://bugs.python.org/issue?@action=redirect&bpo=28699\n\n(161) https://bugs.python.org/issue?@action=redirect&bpo=23890\n\n(162) https://bugs.python.org/issue?@action=redirect&bpo=29901\n\n(163) https://bugs.python.org/issue?@action=redirect&bpo=25803\n\n(164) https://bugs.python.org/issue?@action=redirect&bpo=29861\n\n(165) https://bugs.python.org/issue?@action=redirect&bpo=19930\n\n(166) https://bugs.python.org/issue?@action=redirect&bpo=29884\n\n(167) https://bugs.python.org/issue?@action=redirect&bpo=25455\n\n(168) https://bugs.python.org/issue?@action=redirect&bpo=29800\n\n(169) https://bugs.python.org/issue?@action=redirect&bpo=8256\n\n(170) https://bugs.python.org/issue?@action=redirect&bpo=28692\n\n(171) https://bugs.python.org/issue?@action=redirect&bpo=26121\n\n(172) https://bugs.python.org/issue?@action=redirect&bpo=29619\n\n(173) https://bugs.python.org/issue?@action=redirect&bpo=28298\n\n(174) https://bugs.python.org/issue?@action=redirect&bpo=29645\n\n(175) https://bugs.python.org/issue?@action=redirect&bpo=28231\n\n(176) https://bugs.python.org/issue?@action=redirect&bpo=26915\n\n(177) https://bugs.python.org/issue?@action=redirect&bpo=28682\n\n(178) https://bugs.python.org/issue?@action=redirect&bpo=29728\n\n(179) https://bugs.python.org/issue?@action=redirect&bpo=29623\n\n(180) https://bugs.python.org/issue?@action=redirect&bpo=9303\n\n(181) https://bugs.python.org/issue?@action=redirect&bpo=28963\n\n(182) https://bugs.python.org/issue?@action=redirect&bpo=29704\n\n(183) https://bugs.python.org/issue?@action=redirect&bpo=29271\n\n(184) https://bugs.python.org/issue?@action=redirect&bpo=29703\n\n(185) https://bugs.python.org/issue?@action=redirect&bpo=29615\n\n(186) https://bugs.python.org/issue?@action=redirect&bpo=7769\n\n(187) https://bugs.python.org/issue?@action=redirect&bpo=29376\n\n(188) https://bugs.python.org/issue?@action=redirect&bpo=28624\n\n(189) https://bugs.python.org/issue?@action=redirect&bpo=28518\n\n(190) https://bugs.python.org/issue?@action=redirect&bpo=29742\n\n(191) https://bugs.python.org/issue?@action=redirect&bpo=16285\n\n(192) https://bugs.python.org/issue?@action=redirect&bpo=29532\n\n(193) https://bugs.python.org/issue?@action=redirect&bpo=29110\n\n(194) https://bugs.python.org/issue?@action=redirect&bpo=22807\n\n(195) https://bugs.python.org/issue?@action=redirect&bpo=29576\n\n(196) https://bugs.python.org/issue?@action=redirect&bpo=29534\n\n(197) https://bugs.python.org/issue?@action=redirect&bpo=10379\n\n(198) https://bugs.python.org/issue?@action=redirect&bpo=29851\n\n(199) https://bugs.python.org/issue?@action=redirect&bpo=28556\n\n(200) https://bugs.python.org/issue?@action=redirect&bpo=29100\n\n(201) https://bugs.python.org/issue?@action=redirect&bpo=29416\n\n(202) https://bugs.python.org/issue?@action=redirect&bpo=29444\n\n(203) https://bugs.python.org/issue?@action=redirect&bpo=29377\n\n(204) https://bugs.python.org/issue?@action=redirect&bpo=29218\n\n(205) https://bugs.python.org/issue?@action=redirect&bpo=29368\n\n(206) https://bugs.python.org/issue?@action=redirect&bpo=29338\n\n(207) https://bugs.python.org/issue?@action=redirect&bpo=29335\n\n(208) https://bugs.python.org/issue?@action=redirect&bpo=29290\n\n(209) https://bugs.python.org/issue?@action=redirect&bpo=28735\n\n(210) https://bugs.python.org/issue?@action=redirect&bpo=29197\n\n(211) https://bugs.python.org/issue?@action=redirect&bpo=29210\n\n(212) https://bugs.python.org/issue?@action=redirect&bpo=29219\n\n(213) https://bugs.python.org/issue?@action=redirect&bpo=29192\n\n(214) https://bugs.python.org/issue?@action=redirect&bpo=29193\n\n(215) https://bugs.python.org/issue?@action=redirect&bpo=29195\n\n(216) https://bugs.python.org/issue?@action=redirect&bpo=28969\n\n(217) https://bugs.python.org/issue?@action=redirect&bpo=20804\n\n(218) https://bugs.python.org/issue?@action=redirect&bpo=29142\n\n(219) https://bugs.python.org/issue?@action=redirect&bpo=28961\n\n(220) https://bugs.python.org/issue?@action=redirect&bpo=15812\n\n(221) https://bugs.python.org/issue?@action=redirect&bpo=28985\n\n(222) https://bugs.python.org/issue?@action=redirect&bpo=29079\n\n(223) https://bugs.python.org/issue?@action=redirect&bpo=13051\n\n(224) https://bugs.python.org/issue?@action=redirect&bpo=9770\n\n(225) https://bugs.python.org/issue?@action=redirect&bpo=28427\n\n(226) https://bugs.python.org/issue?@action=redirect&bpo=28923\n\n(227) https://bugs.python.org/issue?@action=redirect&bpo=28871\n\n(228) https://bugs.python.org/issue?@action=redirect&bpo=19542\n\n(229) https://bugs.python.org/issue?@action=redirect&bpo=20191\n\n(230) https://bugs.python.org/issue?@action=redirect&bpo=16255\n\n(231) https://bugs.python.org/issue?@action=redirect&bpo=28779\n\n(232) https://bugs.python.org/issue?@action=redirect&bpo=26937\n\n(233) https://bugs.python.org/issue?@action=redirect&bpo=28847\n\n(234) https://bugs.python.org/issue?@action=redirect&bpo=27030\n\n(235) https://bugs.python.org/issue?@action=redirect&bpo=28835\n\n(236) https://bugs.python.org/issue?@action=redirect&bpo=27172\n\n(237) https://bugs.python.org/issue?@action=redirect&bpo=28740\n\n(238) https://bugs.python.org/issue?@action=redirect&bpo=26273\n\n(239) https://bugs.python.org/issue?@action=redirect&bpo=28752\n\n(240) https://bugs.python.org/issue?@action=redirect&bpo=28727\n\n(241) https://bugs.python.org/issue?@action=redirect&bpo=18383\n\n(242) https://bugs.python.org/issue?@action=redirect&bpo=20572\n\n(243) https://bugs.python.org/issue?@action=redirect&bpo=25659\n\n(244) https://bugs.python.org/issue?@action=redirect&bpo=28548\n\n(245) https://bugs.python.org/issue?@action=redirect&bpo=19717\n\n(246) https://bugs.python.org/issue?@action=redirect&bpo=28563\n\n(247) https://bugs.python.org/issue?@action=redirect&bpo=28387\n\n(248) https://bugs.python.org/issue?@action=redirect&bpo=27517\n\n(249) https://bugs.python.org/issue?@action=redirect&bpo=28549\n\n(250) https://bugs.python.org/issue?@action=redirect&bpo=28449\n\n(251) https://bugs.python.org/issue?@action=redirect&bpo=23262\n\n(252) https://bugs.python.org/issue?@action=redirect&bpo=24241\n\n(253) https://bugs.python.org/issue?@action=redirect&bpo=27939\n\n(254) https://bugs.python.org/issue?@action=redirect&bpo=28255\n\n(255) https://bugs.python.org/issue?@action=redirect&bpo=28255\n\n(256) https://bugs.python.org/issue?@action=redirect&bpo=20491\n\n(257) https://bugs.python.org/issue?@action=redirect&bpo=28353\n\n(258) https://bugs.python.org/issue?@action=redirect&bpo=28430\n\n(259) https://bugs.python.org/issue?@action=redirect&bpo=27025\n\n(260) https://bugs.python.org/issue?@action=redirect&bpo=25464\n\n(261) https://bugs.python.org/issue?@action=redirect&bpo=28488\n\n(262) https://bugs.python.org/issue?@action=redirect&bpo=25953\n\n(263) https://bugs.python.org/issue?@action=redirect&bpo=28469\n\n(264) https://bugs.python.org/issue?@action=redirect&bpo=28115\n\n(265) https://bugs.python.org/issue?@action=redirect&bpo=18219\n\n(266) https://bugs.python.org/issue?@action=redirect&bpo=28448\n\n(267) https://bugs.python.org/issue?@action=redirect&bpo=23214\n\n(268) https://bugs.python.org/issue?@action=redirect&bpo=28480\n\n(269) https://bugs.python.org/issue?@action=redirect&bpo=28240\n\n(270) https://bugs.python.org/issue?@action=redirect&bpo=28240\n\n(271) https://bugs.python.org/issue?@action=redirect&bpo=28240\n\n(272) https://github.com/pypa/setuptools/issues/100\n\n(273) https://bugs.python.org/issue?@action=redirect&bpo=24452\n\n(274) https://bugs.python.org/issue?@action=redirect&bpo=20766\n\n(275) https://bugs.python.org/issue?@action=redirect&bpo=27998\n\n(276) https://bugs.python.org/issue?@action=redirect&bpo=28317\n\n(277) https://bugs.python.org/issue?@action=redirect&bpo=28380\n\n(278) https://bugs.python.org/issue?@action=redirect&bpo=28229\n\n(279) https://bugs.python.org/issue?@action=redirect&bpo=28321\n\n(280) https://bugs.python.org/issue?@action=redirect&bpo=28225\n\n(281) https://bugs.python.org/issue?@action=redirect&bpo=28227\n\n(282) https://bugs.python.org/issue?@action=redirect&bpo=28332\n\n(283) https://bugs.python.org/issue?@action=redirect&bpo=27358\n\n(284) https://bugs.python.org/issue?@action=redirect&bpo=28257\n\n(285) https://bugs.python.org/issue?@action=redirect&bpo=28322\n\n(286) https://bugs.python.org/issue?@action=redirect&bpo=28228\n\n(287) https://bugs.python.org/issue?@action=redirect&bpo=28226\n\n(288) https://bugs.python.org/issue?@action=redirect&bpo=28314\n\n(289) https://bugs.python.org/issue?@action=redirect&bpo=28148\n\n(290) https://bugs.python.org/issue?@action=redirect&bpo=28253\n\n(291) https://bugs.python.org/issue?@action=redirect&bpo=28275\n\n(292) https://bugs.python.org/issue?@action=redirect&bpo=27897\n\n(293) https://bugs.python.org/issue?@action=redirect&bpo=18844\n\n(294) https://bugs.python.org/issue?@action=redirect&bpo=18893\n\n(295) https://bugs.python.org/issue?@action=redirect&bpo=27611\n\n(296) https://bugs.python.org/issue?@action=redirect&bpo=27348\n\n(297) https://bugs.python.org/issue?@action=redirect&bpo=25651\n\n(298) https://bugs.python.org/issue?@action=redirect&bpo=27778\n\n(299) https://bugs.python.org/issue?@action=redirect&bpo=28200\n\n(300) https://bugs.python.org/issue?@action=redirect&bpo=25400\n\n(301) https://bugs.python.org/issue?@action=redirect&bpo=27932\n\n(302) https://bugs.python.org/issue?@action=redirect&bpo=28075\n\n(303) https://bugs.python.org/issue?@action=redirect&bpo=22493\n\n(304) https://bugs.python.org/issue?@action=redirect&bpo=25270\n\n(305) https://bugs.python.org/issue?@action=redirect&bpo=28181\n\n(306) https://bugs.python.org/issue?@action=redirect&bpo=25895\n\n(307) https://bugs.python.org/issue?@action=redirect&bpo=28114\n\n(308) https://bugs.python.org/issue?@action=redirect&bpo=27599\n\n(309) https://bugs.python.org/issue?@action=redirect&bpo=27906\n\n(310) https://bugs.python.org/issue?@action=redirect&bpo=28174\n\n(311) https://bugs.python.org/issue?@action=redirect&bpo=26654\n\n(312) https://bugs.python.org/issue?@action=redirect&bpo=26909\n\n(313) https://bugs.python.org/issue?@action=redirect&bpo=28176\n\n(314) https://bugs.python.org/issue?@action=redirect&bpo=27759\n\n(315) https://bugs.python.org/issue?@action=redirect&bpo=28325\n\n(316) https://bugs.python.org/issue?@action=redirect&bpo=28368\n\n(317) https://bugs.python.org/issue?@action=redirect&bpo=28369\n\n(318) https://bugs.python.org/issue?@action=redirect&bpo=28370\n\n(319) https://bugs.python.org/issue?@action=redirect&bpo=28371\n\n(320) https://bugs.python.org/issue?@action=redirect&bpo=28372\n\n(321) https://bugs.python.org/issue?@action=redirect&bpo=28399\n\n(322) https://bugs.python.org/issue?@action=redirect&bpo=27972\n\n(323) https://bugs.python.org/issue?@action=redirect&bpo=24142\n\n(324) https://bugs.python.org/issue?@action=redirect&bpo=29581\n\n(325) https://bugs.python.org/issue?@action=redirect&bpo=25532\n\n(326) https://bugs.python.org/issue?@action=redirect&bpo=30177\n\nFile: python3.12.info,  Node: Documentation<56>,  Next: Tests<51>,  Prev: Library<57>,  Up: Python 3 7 0 alpha 1\n\n1.22.57.4 Documentation\n.......................\n\n- bpo-31294(1): Fix incomplete code snippet in the\nZeroMQSocketListener and ZeroMQSocketHandler examples and adapt\nthem to Python 3.\n\n- bpo-21649(2): Add RFC 7525 and Mozilla server side TLS links to SSL\ndocumentation.\n\n- bpo-31128(3): Allow the pydoc server to bind to arbitrary\nhostnames.\n\n- bpo-30803(4): Clarify doc on truth value testing.  Original patch\nby Peter Thomassen.\n\n- bpo-30176(5): Add missing attribute related constants in curses\ndocumentation.\n\n- bpo-30052(6): the link targets for *note bytes(): 295. and *note\nbytearray(): 294. are now their respective type definitions, rather\nthan the corresponding builtin function entries.  Use *note bytes:\n183c. and *note bytearray: 183d. to reference the latter.  In order\nto ensure this and future cross-reference updates are applied\nautomatically, the daily documentation builds now disable the\ndefault output caching features in Sphinx.\n\n- bpo-26985(7): Add missing info of code object in inspect\ndocumentation.\n\n- bpo-19824(8): Improve the documentation for, and links to, template\nstrings by emphasizing their utility for internationalization, and\nby clarifying some usage constraints.  (See also: bpo-20314(9),\nbpo-12518(10))\n\n- bpo-28929(11): Link the documentation to its source file on GitHub.\n\n- bpo-25008(12): Document smtpd.py as effectively deprecated and add\na pointer to aiosmtpd, a third-party asyncio-based replacement.\n\n- bpo-26355(13): Add canonical header link on each page to\ncorresponding major version of the documentation.  Patch by\nMatthias Bussonnier.\n\n- bpo-29349(14): Fix Python 2 syntax in code for building the\ndocumentation.\n\n- bpo-23722(15): The data model reference and the porting section in\nthe 3.6 What's New guide now cover the additional 'classcell'\nhandling needed for custom metaclasses to fully support PEP 487(16)\nand zero-argument 'super()'.\n\n- bpo-28513(17): Documented command-line interface of zipfile.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31294\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=21649\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=31128\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=30803\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=30176\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=30052\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=26985\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=19824\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=20314\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=12518\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=28929\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=25008\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=26355\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=29349\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=23722\n\n(16) https://peps.python.org/pep-0487/\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=28513\n\nFile: python3.12.info,  Node: Tests<51>,  Next: Build<52>,  Prev: Documentation<56>,  Up: Python 3 7 0 alpha 1\n\n1.22.57.5 Tests\n...............\n\n- bpo-29639(1): test.support.HOST is now \"localhost\", a new HOSTv4\nconstant has been added for your '127.0.0.1' needs, similar to the\nexisting HOSTv6 constant.\n\n- bpo-31320(2): Silence traceback in testssl\n\n- bpo-31346(3): Prefer PROTOCOLTLSCLIENT and PROTOCOLTLSSERVER\nprotocols for SSLContext.\n\n- bpo-25674(4): Remove sha256.tbs-internet.com ssl test\n\n- bpo-30715(5): Address ALPN callback changes for OpenSSL 1.1.0f.\nThe latest version behaves like OpenSSL 1.0.2 and no longer aborts\nhandshake.\n\n- bpo-30822(6): regrtest: Exclude tzdata from regrtest -all.  When\nrunning the test suite using -use=all / -u all, exclude tzdata\nsince it makes testdatetime too slow (15-20 min on some buildbots)\nwhich then times out on some buildbots.  Fix also regrtest command\nline parser to allow passing -u extralargefile to run\ntestzipfile64.\n\n- bpo-30695(7): Add the 'setnomemory(start, stop)' and\n'removememhooks()' functions to the 'testcapi' module.\n\n- bpo-30357(8): testthread: setUp() now uses\nsupport.threadingsetup() and support.threadingcleanup() to wait\nuntil threads complete to avoid random side effects on following\ntests.  Initial patch written by Grzegorz Grzywacz.\n\n- bpo-30197(9): Enhanced functions swapattr() and swapitem() in the\ntest.support module.  They now work when delete replaced attribute\nor item inside the with statement.  The old value of the attribute\nor item (or None if it doesn't exist) now will be assigned to the\ntarget of the \"as\" clause, if there is one.\n\n- bpo-24932(10): Use proper command line parsing in testembed\n\n- bpo-28950(11): Disallow -j0 to be combined with -T/-l in regrtest\ncommand line arguments.\n\n- bpo-28683(12): Fix the tests that bind() a unix socket and raise\nPermissionError on Android for a non-root user.\n\n- bpo-26936(13): Fix the testsocket failures on Android -\ngetservbyname(), getservbyport() and getaddrinfo() are broken on\nsome Android API levels.\n\n- bpo-28666(14): Now test.support.rmtree is able to remove unwritable\nor unreadable directories.\n\n- bpo-23839(15): Various caches now are cleared before running every\ntest file.\n\n- bpo-26944(16): Fix testposix for Android where 'id -G' is entirely\nwrong or missing the effective gid.\n\n- bpo-28409(17): regrtest: fix the parser of command line arguments.\n\n- bpo-28217(18): Adds testconsole module to test console input.\n\n- bpo-26939(19): Add the support.setswitchinterval() function to fix\ntestfunctools hanging on the Android armv7 qemu emulator.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=29639\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31320\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=31346\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=25674\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=30715\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=30822\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=30695\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=30357\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=30197\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=24932\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=28950\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=28683\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=26936\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=28666\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=23839\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=26944\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=28409\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=28217\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=26939\n\nFile: python3.12.info,  Node: Build<52>,  Next: Windows<50>,  Prev: Tests<51>,  Up: Python 3 7 0 alpha 1\n\n1.22.57.6 Build\n...............\n\n- bpo-31354(1): Allow '--with-lto' to be used on all builds, not just\n'make profile-opt'.\n\n- bpo-31370(2): Remove support for building -without-threads.  This\noption is not really useful anymore in the 21st century.  Removing\nlots of conditional paths allows us to simplify the code base,\nincluding in difficult to maintain low-level internal code.\n\n- bpo-31341(3): Per PEP 11(4), support for the IRIX operating system\nwas removed.\n\n- bpo-30854(5): Fix compile error when compiling -without-threads.\nPatch by Masayuki Yamamoto.\n\n- bpo-30687(6): Locate msbuild.exe on Windows when building rather\nthan vcvarsall.bat\n\n- bpo-20210(7): Support the 'disabled' marker in Setup files.\nExtension modules listed after this marker are not built at all,\nneither by the Makefile nor by setup.py.\n\n- bpo-29941(8): Add '--with-assertions' configure flag to explicitly\nenable C 'assert()' checks.  Defaults to off.  '--with-pydebug'\nimplies '--with-assertions'.\n\n- bpo-28787(9): Fix out-of-tree builds of Python when configured with\n'--with--dtrace'.\n\n- bpo-29243(10): Prevent unnecessary rebuilding of Python during\n'make test', 'make install' and some other make targets when\nconfigured with '--enable-optimizations'.\n\n- bpo-23404(11): Don't regenerate generated files based on file\nmodification time anymore: the action is now explicit.  Replace\n'make touch' with 'make regen-all'.\n\n- bpo-29643(12): Fix '--enable-optimization' didn't work.\n\n- bpo-27593(13): sys.version and the platform module pythonbuild(),\npythonbranch(), and pythonrevision() functions now use git\ninformation rather than hg when building from a repo.\n\n- bpo-29572(14): Update Windows build and OS X installers to use\nOpenSSL 1.0.2k.\n\n- bpo-27659(15): Prohibit implicit C function declarations: use\n'-Werror=implicit-function-declaration' when possible (GCC and\nClang, but it depends on the compiler version).  Patch written by\nChi Hsuan Yen.\n\n- bpo-29384(16): Remove old Be OS helper scripts.\n\n- bpo-26851(17): Set Android compilation and link flags.\n\n- bpo-28768(18): Fix implicit declaration of function setmode.\nPatch by Masayuki Yamamoto\n\n- bpo-29080(19): Removes hard dependency on hg.exe from\nPCBuild/build.bat\n\n- bpo-23903(20): Added missed names to PC/python3.def.\n\n- bpo-28762(21): lockf() is available on Android API level 24, but\nthe FLOCK macro is not defined in android-ndk-r13.\n\n- bpo-28538(22): Fix the compilation error that occurs because\nifnameindex() is available on Android API level 24, but the\nifnameindex structure is not defined.\n\n- bpo-20211(23): Do not add the directory for installing C header\nfiles and the directory for installing object code libraries to the\ncross compilation search paths.  Original patch by Thomas\nPetazzoni.\n\n- bpo-28849(24): Do not define sys.implementation.multiarch on\nAndroid.\n\n- bpo-10656(25): Fix out-of-tree building on AIX. Patch by Tristan\nCarel and Michael Haubenwallner.\n\n- bpo-26359(26): Rename -with-optimiations to -enable-optimizations.\n\n- bpo-28444(27): Fix missing extensions modules when cross compiling.\n\n- bpo-28208(28): Update Windows build and OS X installers to use\nSQLite 3.14.2.\n\n- bpo-28248(29): Update Windows build and OS X installers to use\nOpenSSL 1.0.2j.\n\n- bpo-21124(30): Fix building the struct module on Cygwin by passing\n'NULL' instead of '&PyTypeType' to PyVarObjectHEADINIT. Patch by\nMasayuki Yamamoto.\n\n- bpo-13756(31): Fix building extensions modules on Cygwin.  Patch by\nRoumen Petrov, based on original patch by Jason Tishler.\n\n- bpo-21085(32): Add configure check for siginfot.siband, which\nCygwin does not provide.  Patch by Masayuki Yamamoto with review\nand rebase by Erik Bray.\n\n- bpo-28258(33): Fixed build with Estonian locale (python-config and\ndistclean targets in Makefile).  Patch by Arfrever Frehtes\nTaifersar Arahesis.\n\n- bpo-26661(34): setup.py now detects system libffi with multiarch\nwrapper.\n\n- bpo-27979(35): A full copy of libffi is no longer bundled for use\nwhen building ctypes on non-OSX UNIX platforms.  An installed copy\nof libffi is now required when building ctypes on such platforms.\n\n- bpo-15819(36): Remove redundant include search directory option for\nbuilding outside the source tree.\n\n- bpo-28676(37): Prevent missing 'getentropy' declaration warning on\nmacOS. Patch by Gareth Rees.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31354\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31370\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=31341\n\n(4) https://peps.python.org/pep-0011/\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=30854\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=30687\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=20210\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=29941\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=28787\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=29243\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=23404\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=29643\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=27593\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=29572\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=27659\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=29384\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=26851\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=28768\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=29080\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=23903\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=28762\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=28538\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=20211\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=28849\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=10656\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=26359\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=28444\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=28208\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=28248\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=21124\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=13756\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=21085\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=28258\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=26661\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=27979\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=15819\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=28676\n\nFile: python3.12.info,  Node: Windows<50>,  Next: IDLE<38>,  Prev: Build<52>,  Up: Python 3 7 0 alpha 1\n\n1.22.57.7 Windows\n.................\n\n- bpo-31392(1): Update Windows build to use OpenSSL 1.1.0f\n\n- bpo-30389(2): Adds detection of Visual Studio 2017 to distutils on\nWindows.\n\n- bpo-31358(3): zlib is no longer bundled in the CPython source,\ninstead it is downloaded on demand just like bz2, lzma, OpenSSL,\nTcl/Tk, and SQLite.\n\n- bpo-31340(4): Change to building with MSVC v141 (included with\nVisual Studio 2017)\n\n- bpo-30581(5): os.cpucount() now returns the correct number of\nprocessors on Windows when the number of logical processors is\ngreater than 64.\n\n- bpo-30916(6): Pre-build OpenSSL, Tcl and Tk and include the\nbinaries in the build.\n\n- bpo-30731(7): Add a missing xmlns to python.manifest so that it\nmatches the schema.\n\n- bpo-30291(8): Allow requiring 64-bit interpreters from py.exe using\n-64 suffix.  Contributed by Steve (Gadget) Barnes.\n\n- bpo-30362(9): Adds list options (-0, -0p) to py.exe launcher.\nContributed by Steve Barnes.\n\n- bpo-23451(10): Fix socket deprecation warnings in socketmodule.c.\nPatch by Segev Finer.\n\n- bpo-30450(11): The build process on Windows no longer depends on\nSubversion, instead pulling external code from GitHub via a Python\nscript.  If Python 3.6 is not found on the system (via 'py -3.6'),\nNuGet is used to download a copy of 32-bit Python.\n\n- bpo-29579(12): Removes readme.txt from the installer.\n\n- bpo-25778(13): winreg does not truncate string correctly (Patch by\nEryk Sun)\n\n- bpo-28896(14): Deprecate WindowsRegistryFinder and disable it by\ndefault\n\n- bpo-28522(15): Fixes mishandled buffer reallocation in getpathp.c\n\n- bpo-28402(16): Adds signed catalog files for stdlib on Windows.\n\n- bpo-28333(17): Enables Unicode for ps1/ps2 and input() prompts.\n(Patch by Eryk Sun)\n\n- bpo-28251(18): Improvements to help manuals on Windows.\n\n- bpo-28110(19): launcher.msi has different product codes between\n32-bit and 64-bit\n\n- bpo-28161(20): Opening CON for write access fails\n\n- bpo-28162(21): WindowsConsoleIO readall() fails if first line\nstarts with Ctrl+Z\n\n- bpo-28163(22): WindowsConsoleIO fileno() passes wrong flags to\nopenosfhandle\n\n- bpo-28164(23): PyIOgetconsoletype fails for various paths\n\n- bpo-28137(24): Renames Windows path file to .pth\n\n- bpo-28138(25): Windows .pth file should allow import site\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31392\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=30389\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=31358\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=31340\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=30581\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=30916\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=30731\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=30291\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=30362\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=23451\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=30450\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=29579\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=25778\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=28896\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=28522\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=28402\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=28333\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=28251\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=28110\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=28161\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=28162\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=28163\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=28164\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=28137\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=28138\n\nFile: python3.12.info,  Node: IDLE<38>,  Next: Tools/Demos<30>,  Prev: Windows<50>,  Up: Python 3 7 0 alpha 1\n\n1.22.57.8 IDLE\n..............\n\n- bpo-31493(1): IDLE code context - fix code update and font update\ntimers.  Canceling timers prevents a warning message when testidle\ncompletes.\n\n- bpo-31488(2): IDLE - Update non-key options in former extension\nclasses.  When applying configdialog changes, call .reload for each\nfeature class.  Change ParenMatch so updated options affect\nexisting instances attached to existing editor windows.\n\n- bpo-31477(3): IDLE - Improve rstrip entry in doc.  Strip trailing\nwhitespace strips more than blank spaces.  Multiline string\nliterals are not skipped.\n\n- bpo-31480(4): IDLE - make tests pass with zzdummy extension\ndisabled by default.\n\n- bpo-31421(5): Document how IDLE runs tkinter programs.  IDLE calls\ntcl/tk update in the background in order to make live interaction\nand experimentation with tkinter applications much easier.\n\n- bpo-31414(6): IDLE - fix tk entry box tests by deleting first.\nAdding to an int entry is not the same as deleting and inserting\nbecause int('') will fail.\n\n- bpo-31051(7): Rearrange IDLE configdialog GenPage into Window,\nEditor, and Help sections.\n\n- bpo-30617(8): IDLE - Add docstrings and tests for outwin subclass\nof editor.  Move some data and functions from the class to module\nlevel.  Patch by Cheryl Sabella.\n\n- bpo-31287(9): IDLE - Do not modify tkinter.message in\ntestconfigdialog.\n\n- bpo-27099(10): Convert IDLE's built-in 'extensions' to regular\nfeatures.  About 10 IDLE features were implemented as supposedly\noptional extensions.  Their different behavior could be confusing\nor worse for users and not good for maintenance.  Hence the\nconversion.  The main difference for users is that user\nconfigurable key bindings for builtin features are now handled\nuniformly.  Now, editing a binding in a keyset only affects its\nvalue in the keyset.  All bindings are defined together in the\nsystem-specific default keysets in config-extensions.def.  All\ncustom keysets are saved as a whole in config-extension.cfg.  All\ntake effect as soon as one clicks Apply or Ok.  The affected events\nare '<<force-open-completions>>', '<<expand-word>>',\n'<<force-open-calltip>>', '<<flash-paren>>',\n'<<format-paragraph>>', '<<run-module>>', '<<check-module>>', and\n'<<zoom-height>>'.  Any (global) customizations made before 3.6.3\nwill not affect their keyset-specific customization after 3.6.3.\nand vice versa.  Initial patch by Charles Wohlganger.\n\n- bpo-31206(11): IDLE: Factor HighPage(Frame) class from\nConfigDialog.  Patch by Cheryl Sabella.\n\n- bpo-31001(12): Add tests for configdialog highlight tab.  Patch by\nCheryl Sabella.\n\n- bpo-31205(13): IDLE: Factor KeysPage(Frame) class from\nConfigDialog.  The slightly modified tests continue to pass.  Patch\nby Cheryl Sabella.\n\n- bpo-31130(14): IDLE - stop leaks in testconfigdialog.  Initial\npatch by Victor Stinner.\n\n- bpo-31002(15): Add tests for configdialog keys tab.  Patch by\nCheryl Sabella.\n\n- bpo-19903(16): IDLE: Calltips use 'inspect.signature' instead of\n'inspect.getfullargspec'.  This improves calltips for builtins\nconverted to use Argument Clinic.  Patch by Louie Lu.\n\n- bpo-31083(17): IDLE - Add an outline of a TabPage class in\nconfigdialog.  Update existing classes to match outline.  Initial\npatch by Cheryl Sabella.\n\n- bpo-31050(18): Factor GenPage(Frame) class from ConfigDialog.  The\nslightly modified tests continue to pass.  Patch by Cheryl Sabella.\n\n- bpo-31004(19): IDLE - Factor FontPage(Frame) class from\nConfigDialog.  Slightly modified tests continue to pass.  Fix\nGeneral tests.  Patch mostly by Cheryl Sabella.\n\n- bpo-30781(20): IDLE - Use ttk widgets in ConfigDialog.  Patches by\nTerry Jan Reedy and Cheryl Sabella.\n\n- bpo-31060(21): IDLE - Finish rearranging methods of ConfigDialog\nGrouping methods pertaining to each tab and the buttons will aid\nwriting tests and improving the tabs and will enable splitting the\ngroups into classes.\n\n- bpo-30853(22): IDLE - Factor a VarTrace class out of ConfigDialog.\nInstance tracers manages pairs consisting of a tk variable and a\ncallback function.  When tracing is turned on, setting the variable\ncalls the function.  Test coverage for the new class is 100%.\n\n- bpo-31003(23): IDLE: Add more tests for General tab.\n\n- bpo-30993(24): IDLE - Improve configdialog font page and tests.  In\nconfigdialog: Document causal pathways in createfonttab\ndocstring.  Simplify some attribute names.  Move setsamples calls\nto varchangedfont (idea from Cheryl Sabella).  Move related\nfunctions to positions after the create widgets function.  In\ntestconfigdialog: Fix testfontset so not order dependent.  Fix\nrenamed testindentscale so it tests the widget.  Adjust tests for\nmovement of setsamples call.  Add tests for load functions.  Put\nall font tests in one class and tab indent tests in another.\nExcept for two lines, these tests completely cover the related\nfunctions.\n\n- bpo-30981(25): IDLE - Add more configdialog font page tests.\n\n- bpo-28523(26): IDLE: replace 'colour' with 'color' in configdialog.\n\n- bpo-30917(27): Add tests for idlelib.config.IdleConf.  Increase\ncoverage from 46% to 96%.  Patch by Louie Lu.\n\n- bpo-30934(28): Document coverage details for idlelib tests.  Add\nsection to idlelib/idle-test/README.txt.  Include check that\nbranches are taken both ways.  Exclude IDLE-specific code that does\nnot run during unit tests.\n\n- bpo-30913(29): IDLE: Document ConfigDialog tk Vars, methods, and\nwidgets in docstrings This will facilitate improving the dialog and\nsplitting up the class.  Original patch by Cheryl Sabella.\n\n- bpo-30899(30): IDLE: Add tests for ConfigParser subclasses in\nconfig.  Patch by Louie Lu.\n\n- bpo-30881(31): IDLE: Add docstrings to browser.py.  Patch by Cheryl\nSabella.\n\n- bpo-30851(32): IDLE: Remove unused variables in configdialog.  One\nis a duplicate, one is set but cannot be altered by users.  Patch\nby Cheryl Sabella.\n\n- bpo-30870(33): IDLE: In Settings dialog, select font with Up, Down\nkeys as well as mouse.  Initial patch by Louie Lu.\n\n- bpo-8231(34): IDLE: call config.IdleConf.GetUserCfgDir only once.\n\n- bpo-30779(35): IDLE: Factor ConfigChanges class from configdialog,\nput in config; test.  * In config, put dump test code in a\nfunction; run it and unittest in 'if name == 'main'.  * Add\nclass config.ConfigChanges based on changesclassv4.py on bpo\nissue.  * Add class testconfig.ChangesTest, partly using\nconfigdialogtestsv1.py.  * Revise configdialog to use\nConfigChanges; see tracker msg297804.  * Revise testconfigdialog\nto match configdialog changes.  * Remove configdialog functions\nunused or moved to ConfigChanges.  Cheryl Sabella contributed parts\nof the patch.\n\n- bpo-30777(36): IDLE: configdialog - Add docstrings and fix\ncomments.  Patch by Cheryl Sabella.\n\n- bpo-30495(37): IDLE: Improve textview with docstrings, PEP8 names,\nand more tests.  Patch by Cheryl Sabella.\n\n- bpo-30723(38): IDLE: Make several improvements to parenmatch.  Add\n'parens' style to highlight both opener and closer.  Make 'default'\nstyle, which is not default, a synonym for 'opener'.  Make\ntime-delay work the same with all styles.  Add help for config\ndialog extensions tab, including help for parenmatch.  Add new\ntests.  Original patch by Charles Wohlganger.\n\n- bpo-30674(39): IDLE: add docstrings to grep module.  Patch by\nCheryl Sabella\n\n- bpo-21519(40): IDLE's basic custom key entry dialog now detects\nduplicates properly.  Original patch by Saimadhav Heblikar.\n\n- bpo-29910(41): IDLE no longer deletes a character after commenting\nout a region by a key shortcut.  Add 'return 'break'' for this and\nother potential conflicts between IDLE and default key bindings.\n\n- bpo-30728(42): Review and change idlelib.configdialog names.\nLowercase method and attribute names.  Replace 'colour' with\n'color', expand overly cryptic names, delete unneeded underscores.\nReplace 'import *' with specific imports.  Patches by Cheryl\nSabella.\n\n- bpo-6739(43): IDLE: Verify user-entered key sequences by trying to\nbind them with tk.  Add tests for all 3 validation functions.\nOriginal patch by G Polo.  Tests added by Cheryl Sabella.\n\n- bpo-15786(44): Fix several problems with IDLE's autocompletion box.\nThe following should now work: clicking on selection box items;\nusing the scrollbar; selecting an item by hitting Return.  Hangs on\nMacOSX should no longer happen.  Patch by Louie Lu.\n\n- bpo-25514(45): Add doc subsubsection about IDLE failure to start.\nPopup no-connection message directs users to this section.\n\n- bpo-30642(46): Fix reference leaks in IDLE tests.  Patches by Louie\nLu and Terry Jan Reedy.\n\n- bpo-30495(47): Add docstrings for textview.py and use PEP8 names.\nPatches by Cheryl Sabella and Terry Jan Reedy.\n\n- bpo-30290(48): Help-about: use pep8 names and add tests.  Increase\ncoverage to 100%.  Patches by Louie Lu, Cheryl Sabella, and Terry\nJan Reedy.\n\n- bpo-30303(49): Add utest option to textview; add new tests.\nIncrease coverage to 100%.  Patches by Louie Lu and Terry Jan\nReedy.\n\n- bpo-29071(50): IDLE colors f-string prefixes (but not invalid ur\nprefixes).\n\n- bpo-28572(51): Add 10% to coverage of IDLE's testconfigdialog.\nUpdate and augment description of the configuration system.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31493\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31488\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=31477\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=31480\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=31421\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=31414\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=31051\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=30617\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=31287\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=27099\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=31206\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=31001\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=31205\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=31130\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=31002\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=19903\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=31083\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=31050\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=31004\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=30781\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=31060\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=30853\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=31003\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=30993\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=30981\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=28523\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=30917\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=30934\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=30913\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=30899\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=30881\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=30851\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=30870\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=8231\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=30779\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=30777\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=30495\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=30723\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=30674\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=21519\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=29910\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=30728\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=6739\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=15786\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=25514\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=30642\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=30495\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=30290\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=30303\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=29071\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=28572\n\nFile: python3.12.info,  Node: Tools/Demos<30>,  Next: C API<48>,  Prev: IDLE<38>,  Up: Python 3 7 0 alpha 1\n\n1.22.57.9 Tools/Demos\n.....................\n\n- bpo-30983(1): gdb integration commands (py-bt, etc.)  work on\noptimized shared builds now, too.  PEP 523(2) introduced\nPyEvalEvalFrameDefault which inlines PyEvalEvalFrameEx on\nnon-debug shared builds.  This broke the ability to use py-bt,\npy-up, and a few other Python-specific gdb integrations.  The\nproblem is fixed by only looking for PyEvalEvalFrameDefault\nframes in python-gdb.py.  Original patch by Bruno \"Polaco\"\nPenteado.\n\n- bpo-29748(3): Added the slice index converter in Argument Clinic.\n\n- bpo-24037(4): Argument Clinic now uses the converter\n'bool(accept={int})' rather than 'int' for semantical booleans.\nThis avoids repeating the default value for Python and C and will\nhelp in converting to 'bool' in future.\n\n- bpo-29367(5): python-gdb.py now supports also 'method-wrapper'\n('wrapperobject') objects.\n\n- bpo-28023(6): Fix python-gdb.py didn't support new dict\nimplementation.\n\n- bpo-15369(7): The pybench and pystone microbenchmark have been\nremoved from Tools.  Please use the new Python benchmark suite\n'https://github.com/python/pyperformance' which is more reliable\nand includes a portable version of pybench working on Python 2 and\nPython 3.\n\n- bpo-28102(8): The zipfile module CLI now prints usage to stderr.\nPatch by Stephen J. Turnbull.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30983\n\n(2) https://peps.python.org/pep-0523/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=29748\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=24037\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=29367\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=28023\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=15369\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=28102\n\nFile: python3.12.info,  Node: C API<48>,  Prev: Tools/Demos<30>,  Up: Python 3 7 0 alpha 1\n\n1.22.57.10 C API\n................\n\n- bpo-31338(1): Added the 'PyUNREACHABLE()' macro for code paths\nwhich are never expected to be reached.  This and a few other\nuseful macros are now documented in the C API manual.\n\n- bpo-30832(2): Remove own implementation for thread-local storage.\nCPython has provided the own implementation for thread-local\nstorage (TLS) on Python/thread.c, it's used in the case which a\nplatform has not supplied native TLS. However, currently all\nsupported platforms (Windows and pthreads) have provided native TLS\nand defined the PyHAVENATIVETLS macro with unconditional in any\ncase.\n\n- bpo-30708(3): PyUnicodeAsWideCharString() now raises a ValueError\nif the second argument is NULL and the wchart* string contains\nnull characters.\n\n- bpo-16500(4): Deprecate PyOSAfterFork() and add PyOSBeforeFork(),\nPyOSAfterForkParent() and PyOSAfterForkChild().\n\n- bpo-6532(5): The type of results of PyThreadstartnewthread() and\nPyThreadgetthreadident(), and the id parameter of\nPyThreadStateSetAsyncExc() changed from \"long\" to \"unsigned long\".\n\n- bpo-27867(6): Function PySliceGetIndicesEx() is deprecated and\nreplaced with a macro if PyLIMITEDAPI is not set or set to the\nvalue between 0x03050400 and 0x03060000 (not including) or\n0x03060100 or higher.  Added functions PySliceUnpack() and\nPySliceAdjustIndices().\n\n- bpo-29083(7): Fixed the declaration of some public API functions.\nPyArgVaParse() and PyArgVaParseTupleAndKeywords() were not\navailable in limited API. PyArgValidateKeywordArguments(),\nPyArgUnpackTuple() and PyBuildValue() were not available in\nlimited API of version < 3.3 when PYSSIZETCLEAN is defined.\n\n- bpo-28769(8): The result of PyUnicodeAsUTF8AndSize() and\nPyUnicodeAsUTF8() is now of type 'const char *' rather of 'char\n*'.\n\n- bpo-29058(9): All stable API extensions added after Python 3.2 are\nnow available only when PyLIMITEDAPI is set to the PYVERSIONHEX\nvalue of the minimum Python version supporting this API.\n\n- bpo-28822(10): The index parameters 'start' and 'end' of\nPyUnicodeFindChar() are now adjusted to behave like\n'str[start:end]'.\n\n- bpo-28808(11): PyUnicodeCompareWithASCIIString() now never raises\nexceptions.\n\n- bpo-28761(12): The fields name and doc of structures PyMemberDef,\nPyGetSetDef, PyStructSequenceField, PyStructSequenceDesc, and\nwrapperbase are now of type 'const char *' rather of 'char *'.\n\n- bpo-28748(13): Private variable PyPackageContext is now of type\n'const char *' rather of 'char *'.\n\n- bpo-19569(14): Compiler warnings are now emitted if use most of\ndeprecated functions.\n\n- bpo-28426(15): Deprecated undocumented functions\nPyUnicodeAsEncodedObject(), PyUnicodeAsDecodedObject(),\nPyUnicodeAsDecodedUnicode() and PyUnicodeAsEncodedUnicode().\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31338\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=30832\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=30708\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=16500\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=6532\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=27867\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=29083\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=28769\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=29058\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=28822\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=28808\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=28761\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=28748\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=19569\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=28426\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 6 6 final,  Next: Python 3 6 6 release candidate 1,  Prev: Python 3 7 0 alpha 1,  Up: Changelog": {
            "content": "'Release date: 2018-06-27'\n\nThere were no new changes in version 3.6.6.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 6 6 release candidate 1,  Next: Python 3 6 5 final,  Prev: Python 3 6 6 final,  Up: Changelog": {
            "content": "'Release date: 2018-06-11'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<57>.\n* Library: Library<58>.\n* Documentation: Documentation<57>.\n* Tests: Tests<52>.\n* Build: Build<53>.\n* Windows: Windows<51>.\n* macOS: macOS<41>.\n* IDLE: IDLE<39>.\n* Tools/Demos: Tools/Demos<31>.\n* C API: C API<49>.\n\nFile: python3.12.info,  Node: Core and Builtins<57>,  Next: Library<58>,  Up: Python 3 6 6 release candidate 1\n\n1.22.59.1 Core and Builtins\n...........................\n\n- bpo-33786(1): Fix asynchronous generators to handle GeneratorExit\nin athrow() correctly\n\n- bpo-30654(2): Fixed reset of the SIGINT handler to SIGDFL on\ninterpreter shutdown even when there was a custom handler set\npreviously.  Patch by Philipp Kerling.\n\n- bpo-33622(3): Fixed a leak when the garbage collector fails to add\nan object with the 'del' method or referenced by it into the\n*note gc.garbage: 1035. list.  *note PyGCCollect(): 7b2. can now\nbe called when an exception is set and preserves it.\n\n- bpo-31849(4): Fix signed/unsigned comparison warning in pyhash.c.\n\n- bpo-33391(5): Fix a leak in setsymmetricdifference().\n\n- bpo-28055(6): Fix unaligned accesses in siphash24().  Patch by Rolf\nEike Beer.\n\n- bpo-33231(7): Fix potential memory leak in 'normalizestring()'.\n\n- bpo-29922(8): Improved error messages in 'async with' when\n'aenter()' or 'aexit()' return non-awaitable object.\n\n- bpo-33199(9): Fix 'maversiontag' in dict implementation is\nuninitialized when copying from key-sharing dict.\n\n- bpo-33041(10): Fixed jumping when the function contains an 'async\nfor' loop.\n\n- bpo-32282(11): Fix an unnecessary ifdef in the include of\nVersionHelpers.h in socketmodule on Windows.\n\n- bpo-21983(12): Fix a crash in 'ctypes.cast()' in case the type\nargument is a ctypes structured data type.  Patch by Eryk Sun and\nOren Milman.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33786\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=30654\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=33622\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=31849\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=33391\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=28055\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=33231\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=29922\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=33199\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=33041\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=32282\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=21983\n\nFile: python3.12.info,  Node: Library<58>,  Next: Documentation<57>,  Prev: Core and Builtins<57>,  Up: Python 3 6 6 release candidate 1\n\n1.22.59.2 Library\n.................\n\n- bpo-30167(1): Prevent site.main() exception if PYTHONSTARTUP is\nset.  Patch by Steve Weber.\n\n- bpo-33812(2): Datetime instance d with non-None tzinfo, but with\nd.tzinfo.utcoffset(d) returning None is now treated as naive by the\nastimezone() method.\n\n- bpo-30805(3): Avoid race condition with debug logging\n\n- bpo-33767(4): The concatenation ('+') and repetition ('*') sequence\noperations now raise *note TypeError: 28e. instead of *note\nSystemError: 2d7. when performed on *note mmap.mmap: 830. objects.\nPatch by Zackery Spytz.\n\n- bpo-32684(5): Fix gather to propagate cancellation of itself even\nwith returnexceptions.\n\n- bpo-33674(6): Fix a race condition in SSLProtocol.connectionmade()\nof asyncio.sslproto: start immediately the handshake instead of\nusing callsoon().  Previously, datareceived() could be called\nbefore the handshake started, causing the handshake to hang or\nfail.\n\n- bpo-31647(7): Fixed bug where calling writeeof() on a\nSelectorSocketTransport after it's already closed raises\nAttributeError.\n\n- bpo-33672(8): Fix Task.repr crash with Cython's bogus\ncoroutines\n\n- bpo-33469(9): Fix RuntimeError after closing loop that used\nruninexecutor\n\n- bpo-11874(10): Use a better regex when breaking usage into\nwrappable parts.  Avoids bogus assertion errors from custom metavar\nstrings.\n\n- bpo-30877(11): Fixed a bug in the Python implementation of the JSON\ndecoder that prevented the cache of parsed strings from clearing\nafter finishing the decoding.  Based on patch by c-fos.\n\n- bpo-33548(12): tempfile.candidatetempdirlist should consider\ncommon TEMP locations\n\n- bpo-33542(13): Prevent 'uuid.getnode' from using a DUID instead of\na MAC on Windows.  Patch by Zvi Effron\n\n- bpo-26819(14): Fix race condition with\n'ReadTransport.resumereading' in Windows proactor event loop.\n\n- bpo-28556(15): Minor fixes in typing module: add annotations to\n'NamedTuple.new', pass '*args' and 'kwds' in\n'Generic.new'.  Original PRs by Paulius ??arka and Chad\nDombrova.\n\n- bpo-20087(16): Updated alias mapping with glibc 2.27 supported\nlocales.\n\n- bpo-33422(17): Fix trailing quotation marks getting deleted when\nlooking up byte/string literals on pydoc.  Patch by Andre's Delfino.\n\n- bpo-33197(18): Update error message when constructing invalid\ninspect.Parameters Patch by Donghee Na.\n\n- bpo-33383(19): Fixed crash in the get() method of the *note\ndbm.ndbm: 32. database object when it is called with a single\nargument.\n\n- bpo-33329(20): Fix multiprocessing regression on newer glibcs\n\n- bpo-991266(21): Fix quoting of the 'Comment' attribute of *note\nhttp.cookies.SimpleCookie: 17c2.\n\n- bpo-33131(22): Upgrade bundled version of pip to 10.0.1.\n\n- bpo-33308(23): Fixed a crash in the 'parser' module when converting\nan ST object to a tree of tuples or lists with 'lineinfo=False'\nand 'colinfo=True'.\n\n- bpo-33263(24): Fix FD leak in 'SelectorSocketTransport' Patch by\nVlad Starostin.\n\n- bpo-33256(25): Fix display of '<module>' call in the html produced\nby 'cgitb.html()'.  Patch by Ste'phane Blondon.\n\n- bpo-33203(26): 'random.Random.choice()' now raises 'IndexError' for\nempty sequences consistently even when called from subclasses\nwithout a 'getrandbits()' implementation.\n\n- bpo-33224(27): Update difflib.mdiff() for PEP 479(28).  Convert an\nuncaught StopIteration in a generator into a return-statement.\n\n- bpo-33209(29): End framing at the end of C implementation of *note\npickle.Pickler.dump(): 17c4.\n\n- bpo-32861(30): The urllib.robotparser's 'str' representation\nnow includes wildcard entries and the \"Crawl-delay\" and\n\"Request-rate\" fields.  Patch by Michael Lazar.\n\n- bpo-33096(31): Allow ttk.Treeview.insert to insert iid that has a\nfalse boolean value.  Note iid=0 and iid=False would be same.\nPatch by Garvit Khatri.\n\n- bpo-33127(32): The ssl module now compiles with LibreSSL 2.7.1.\n\n- bpo-33021(33): Release the GIL during fstat() calls, avoiding hang\nof all threads when calling mmap.mmap(), os.urandom(), and\nrandom.seed().  Patch by Nir Soffer.\n\n- bpo-27683(34): Fix a regression in *note ipaddress: 7a. that result\nof 'hosts()' is empty when the network is constructed by a tuple\ncontaining an integer mask and only 1 bit left for addresses.\n\n- bpo-32844(35): Fix wrong redirection of a low descriptor (0 or 1)\nto stderr in subprocess if another low descriptor is closed.\n\n- bpo-31908(36): Fix output of cover files for 'trace' module\ncommand-line tool.  Previously emitted cover files only when\n'--missing' option was used.  Patch by Michael Selik.\n\n- bpo-31457(37): If nested log adapters are used, the inner\n'process()' methods are no longer omitted.\n\n- bpo-16865(38): Support arrays >=2GiB in *note ctypes: 28.  Patch by\nSegev Finer.\n\n- bpo-31238(39): pydoc: the stop() method of the private ServerThread\nclass now waits until DocServer.serveuntilquit() completes and\nthen explicitly sets its docserver attribute to None to break a\nreference cycle.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30167\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=33812\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=30805\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=33767\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=32684\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=33674\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=31647\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=33672\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=33469\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=11874\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=30877\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=33548\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=33542\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=26819\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=28556\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=20087\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=33422\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=33197\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=33383\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=33329\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=991266\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=33131\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=33308\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=33263\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=33256\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=33203\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=33224\n\n(28) https://peps.python.org/pep-0479/\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=33209\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=32861\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=33096\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=33127\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=33021\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=27683\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=32844\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=31908\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=31457\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=16865\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=31238\n\nFile: python3.12.info,  Node: Documentation<57>,  Next: Tests<52>,  Prev: Library<58>,  Up: Python 3 6 6 release candidate 1\n\n1.22.59.3 Documentation\n.......................\n\n- bpo-33503(1): Fix broken pypi link\n\n- bpo-33421(2): Add missing documentation for\n'typing.AsyncContextManager'.\n\n- bpo-33378(3): Add Korean language switcher for\n'https://docs.python.org/3/'\n\n- bpo-33276(4): Clarify that the 'path' attribute on modules\ncannot be just any value.\n\n- bpo-33201(5): Modernize documentation for writing C extension\ntypes.\n\n- bpo-33195(6): Deprecate 'PyUNICODE' usage in 'c-api/arg' document.\n'PyUNICODE' related APIs are deprecated since Python 3.3, but it\nis missed in the document.\n\n- bpo-33126(7): Document PyBufferToContiguous().\n\n- bpo-27212(8): Modify documentation for the 'islice()' recipe to\nconsume initial values up to the start index.\n\n- bpo-28247(9): Update *note zipapp: 12a. documentation to describe\nhow to make standalone applications.\n\n- bpo-18802(10): Documentation changes for ipaddress.  Patch by Jon\nFoster and Berker Peksag.\n\n- bpo-27428(11): Update documentation to clarify that\n'WindowsRegistryFinder' implements 'MetaPathFinder'.  (Patch by\nHimanshu Lakhara)\n\n- bpo-8243(12): Add a note about curses.addch and curses.addstr\nexception behavior when writing outside a window, or pad.\n\n- bpo-31432(13): Clarify meaning of CERTNONE, CERTOPTIONAL, and\nCERTREQUIRED flags for ssl.SSLContext.verifymode.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33503\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=33421\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=33378\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=33276\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=33201\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=33195\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=33126\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=27212\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=28247\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=18802\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=27428\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=8243\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=31432\n\nFile: python3.12.info,  Node: Tests<52>,  Next: Build<53>,  Prev: Documentation<57>,  Up: Python 3 6 6 release candidate 1\n\n1.22.59.4 Tests\n...............\n\n- bpo-33655(1): Ignore testposixfallocate failures on BSD platforms\nthat might be due to running on ZFS.\n\n- bpo-19417(2): Add testbdb.py.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33655\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=19417\n\nFile: python3.12.info,  Node: Build<53>,  Next: Windows<51>,  Prev: Tests<52>,  Up: Python 3 6 6 release candidate 1\n\n1.22.59.5 Build\n...............\n\n- bpo-5755(1): Move '-Wstrict-prototypes' option to 'CFLAGSNODIST'\nfrom 'OPT'.  This option emitted annoying warnings when building\nextension modules written in C++.\n\n- bpo-33614(2): Ensures module definition files for the stable ABI on\nWindows are correctly regenerated.\n\n- bpo-33522(3): Enable CI builds on Visual Studio Team Services at\n'https://python.visualstudio.com/cpython'\n\n- bpo-33012(4): Add '-Wno-cast-function-type' for gcc 8 for silencing\nwarnings about function casts like casting to PyCFunction in method\ndefinition lists.\n\n- bpo-33394(5): Enable the verbose build for extension modules, when\nGNU make is passed macros on the command line.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=5755\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=33614\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=33522\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=33012\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=33394\n\nFile: python3.12.info,  Node: Windows<51>,  Next: macOS<41>,  Prev: Build<53>,  Up: Python 3 6 6 release candidate 1\n\n1.22.59.6 Windows\n.................\n\n- bpo-33184(1): Update Windows installer to OpenSSL 1.0.2o.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33184\n\nFile: python3.12.info,  Node: macOS<41>,  Next: IDLE<39>,  Prev: Windows<51>,  Up: Python 3 6 6 release candidate 1\n\n1.22.59.7 macOS\n...............\n\n- bpo-33184(1): Update macOS installer build to use OpenSSL 1.0.2o.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33184\n\nFile: python3.12.info,  Node: IDLE<39>,  Next: Tools/Demos<31>,  Prev: macOS<41>,  Up: Python 3 6 6 release candidate 1\n\n1.22.59.8 IDLE\n..............\n\n- bpo-33656(1): On Windows, add API call saying that tk scales for\nDPI. On Windows 8.1+ or 10, with DPI compatibility properties of\nthe Python binary unchanged, and a monitor resolution greater than\n96 DPI, this should make text and lines sharper.  It should\notherwise have no effect.\n\n- bpo-33768(2): Clicking on a context line moves that line to the top\nof the editor window.\n\n- bpo-33763(3): IDLE: Use read-only text widget for code context\ninstead of label widget.\n\n- bpo-33664(4): Scroll IDLE editor text by lines.  Previously, the\nmouse wheel and scrollbar slider moved text by a fixed number of\npixels, resulting in partial lines at the top of the editor box.\nThe change also applies to the shell and grep output windows, but\nnot to read-only text views.\n\n- bpo-33679(5): Enable theme-specific color configuration for Code\nContext.  Use the Highlights tab to see the setting for built-in\nthemes or add settings to custom themes.\n\n- bpo-33642(6): Display up to maxlines non-blank lines for Code\nContext.  If there is no current context, show a single blank line.\n\n- bpo-33628(7): IDLE: Cleanup codecontext.py and its test.\n\n- bpo-33564(8): IDLE's code context now recognizes async as a block\nopener.\n\n- bpo-29706(9): IDLE now colors async and await as keywords in 3.6.\nThey become full keywords in 3.7.\n\n- bpo-21474(10): Update word/identifier definition from ascii to\nunicode.  In text and entry boxes, this affects selection by\ndouble-click, movement left/right by control-left/right, and\ndeletion left/right by control-BACKSPACE/DEL.\n\n- bpo-33204(11): IDLE: consistently color invalid string prefixes.  A\n'u' string prefix cannot be paired with either 'r' or 'f'.\nConsistently color as much of the prefix, starting at the right, as\nis valid.  Revise and extend colorizer test.\n\n- bpo-32831(12): Add docstrings and tests for codecontext.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33656\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=33768\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=33763\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=33664\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=33679\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=33642\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=33628\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=33564\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=29706\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=21474\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=33204\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=32831\n\nFile: python3.12.info,  Node: Tools/Demos<31>,  Next: C API<49>,  Prev: IDLE<39>,  Up: Python 3 6 6 release candidate 1\n\n1.22.59.9 Tools/Demos\n.....................\n\n- bpo-33189(1): 'pygettext.py' now recognizes only literal strings as\ndocstrings and translatable strings, and rejects bytes literals and\nf-string expressions.\n\n- bpo-31920(2): Fixed handling directories as arguments in the\n'pygettext' script.  Based on patch by Oleg Krasnikov.\n\n- bpo-29673(3): Fix pystackv and pystack gdbinit macros.\n\n- bpo-32885(4): Add an '-n' flag for 'Tools/scripts/pathfix.py' to\ndisable automatic backup creation (files with '~' suffix).\n\n- bpo-31583(5): Fix 2to3 for using with -add-suffix option but\nwithout -output-dir option for relative path to files in current\ndirectory.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33189\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31920\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=29673\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=32885\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=31583\n\nFile: python3.12.info,  Node: C API<49>,  Prev: Tools/Demos<31>,  Up: Python 3 6 6 release candidate 1\n\n1.22.59.10 C API\n................\n\n- bpo-32374(1): Document that mtraverse for multi-phase initialized\nmodules can be called with mstate=NULL, and add a sanity check\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32374\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 6 5 final,  Next: Python 3 6 5 release candidate 1,  Prev: Python 3 6 6 release candidate 1,  Up: Changelog": {
            "content": "'Release date: 2018-03-28'\n\n* Menu:\n\n* Tests: Tests<53>.\n* Build: Build<54>.\n\nFile: python3.12.info,  Node: Tests<53>,  Next: Build<54>,  Up: Python 3 6 5 final\n\n1.22.60.1 Tests\n...............\n\n- bpo-32872(1): Avoid regrtest compatibility issue with namespace\npackages.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32872\n\nFile: python3.12.info,  Node: Build<54>,  Prev: Tests<53>,  Up: Python 3 6 5 final\n\n1.22.60.2 Build\n...............\n\n- bpo-33163(1): Upgrade pip to 9.0.3 and setuptools to v39.0.1.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33163\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 6 5 release candidate 1,  Next: Python 3 6 4 final,  Prev: Python 3 6 5 final,  Up: Changelog": {
            "content": "'Release date: 2018-03-13'\n\n* Menu:\n\n* Security: Security<35>.\n* Core and Builtins: Core and Builtins<58>.\n* Library: Library<59>.\n* Documentation: Documentation<58>.\n* Tests: Tests<54>.\n* Build: Build<55>.\n* Windows: Windows<52>.\n* macOS: macOS<42>.\n* IDLE: IDLE<40>.\n* Tools/Demos: Tools/Demos<32>.\n* C API: C API<50>.\n\nFile: python3.12.info,  Node: Security<35>,  Next: Core and Builtins<58>,  Up: Python 3 6 5 release candidate 1\n\n1.22.61.1 Security\n..................\n\n- bpo-33001(1): Minimal fix to prevent buffer overrun in os.symlink\non Windows\n\n- bpo-32981(2): Regexes in difflib and poplib were vulnerable to\ncatastrophic backtracking.  These regexes formed potential DOS\nvectors (REDOS). They have been refactored.  This resolves\nCVE-2018-1060 and CVE-2018-1061.  Patch by Jamie Davis.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33001\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32981\n\nFile: python3.12.info,  Node: Core and Builtins<58>,  Next: Library<59>,  Prev: Security<35>,  Up: Python 3 6 5 release candidate 1\n\n1.22.61.2 Core and Builtins\n...........................\n\n- bpo-33026(1): Fixed jumping out of \"with\" block by setting\nflineno.\n\n- bpo-17288(2): Prevent jumps from 'return' and 'exception' trace\nevents.\n\n- bpo-32889(3): Update Valgrind suppression list to account for the\nrename of 'PyADDRESSINRANG' to 'addressinrange'.\n\n- bpo-32650(4): Pdb and other debuggers dependent on bdb.py will\ncorrectly step over (next command) native coroutines.  Patch by\nPablo Galindo.\n\n- bpo-32685(5): Improve suggestion when the Python 2 form of print\nstatement is either present on the same line as the header of a\ncompound statement or else terminated by a semi-colon instead of a\nnewline.  Patch by Nitish Chandra.\n\n- bpo-32583(6): Fix possible crashing in builtin Unicode decoders\ncaused by write out-of-bound errors when using customized decode\nerror handlers.\n\n- bpo-26163(7): Improved frozenset() hash to create more distinct\nhash values when faced with datasets containing many similar\nvalues.\n\n- bpo-27169(8): The 'debug' constant is now optimized out at\ncompile time.  This fixes also bpo-22091(9).\n\n- bpo-32329(10): 'sys.flags.hashrandomization' is now properly set\nto 0 when hash randomization is turned off by 'PYTHONHASHSEED=0'.\n\n- bpo-30416(11): The optimizer is now protected from spending much\ntime doing complex calculations and consuming much memory for\ncreating large constants in constant folding.\n\n- bpo-18533(12): 'repr()' on a dict containing its own 'values()' or\n'items()' no longer raises 'RecursionError'; OrderedDict similarly.\nInstead, use '...', as for other recursive structures.  Patch by\nBen North.\n\n- bpo-32028(13): Leading whitespace is now correctly ignored when\ngenerating suggestions for converting Py2 print statements to Py3\nbuiltin print function calls.  Patch by Sanyam Khurana.\n\n- bpo-32137(14): The repr of deeply nested dict now raises a\nRecursionError instead of crashing due to a stack overflow.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33026\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=17288\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=32889\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=32650\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=32685\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=32583\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=26163\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=27169\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=22091\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=32329\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=30416\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=18533\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=32028\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=32137\n\nFile: python3.12.info,  Node: Library<59>,  Next: Documentation<58>,  Prev: Core and Builtins<58>,  Up: Python 3 6 5 release candidate 1\n\n1.22.61.3 Library\n.................\n\n- bpo-33064(1): lib2to3 now properly supports trailing commas after\n'*args' and 'kwargs' in function signatures.\n\n- bpo-31804(2): Avoid failing in multiprocessing.Process if the\nstandard streams are closed or None at exit.\n\n- bpo-33037(3): Skip sending/receiving data after SSL transport\nclosing.\n\n- bpo-30353(4): Fix ctypes pass-by-value for structs on 64-bit\nCygwin/MinGW.\n\n- bpo-33009(5): Fix inspect.signature() for single-parameter\npartialmethods.\n\n- bpo-32969(6): Expose several missing constants in zlib and fix\ncorresponding documentation.\n\n- bpo-32713(7): Fixed tarfile.itn handling of out-of-bounds float\nvalues.  Patch by Joffrey Fuhrer.\n\n- bpo-30622(8): The ssl module now detects missing NPN support in\nLibreSSL.\n\n- bpo-32922(9): dbm.open() now encodes filename with the filesystem\nencoding rather than default encoding.\n\n- bpo-32859(10): In 'os.dup2', don't check every call whether the\n'dup3' syscall exists or not.\n\n- bpo-21060(11): Rewrite confusing message from setup.py upload from\n\"No dist file created in earlier command\" to the more helpful \"Must\ncreate and upload files in one command\".\n\n- bpo-32857(12): In *note tkinter: ea, 'aftercancel(None)' now\nraises a *note ValueError: 183. instead of canceling the first\nscheduled function.  Patch by Cheryl Sabella.\n\n- bpo-32852(13): Make sure sys.argv remains as a list when running\ntrace.\n\n- bpo-32841(14): Fixed 'asyncio.Condition' issue which silently\nignored cancellation after notifying and cancelling a conditional\nlock.  Patch by Bar Harel.\n\n- bpo-31787(15): Fixed refleaks of 'init()' methods in various\nmodules.  (Contributed by Oren Milman)\n\n- bpo-30157(16): Fixed guessing quote and delimiter in\ncsv.Sniffer.sniff() when only the last field is quoted.  Patch by\nJake Davis.\n\n- bpo-32394(17): socket: Remove TCPFASTOPEN, TCPKEEPCNT flags on\nolder version Windows during run-time.\n\n- bpo-32777(18): Fix a rare but potential pre-exec child process\ndeadlock in subprocess on POSIX systems when marking file\ndescriptors inheritable on exec in the child process.  This bug\nappears to have been introduced in 3.4.\n\n- bpo-32647(19): The ctypes module used to depend on indirect linking\nfor dlopen.  The shared extension is now explicitly linked against\nlibdl on platforms with dl.\n\n- bpo-32734(20): Fixed 'asyncio.Lock()' safety issue which allowed\nacquiring and locking the same lock multiple times, without it\nbeing free.  Patch by Bar Harel.\n\n- bpo-32727(21): Do not include name field in SMTP envelope from\naddress.  Patch by Ste'phane Wirtel\n\n- bpo-27931(22): Fix email address header parsing error when the\nusername is an empty quoted string.  Patch by Xiang Zhang.\n\n- bpo-32304(23): distutils' upload command no longer corrupts tar\nfiles ending with a CR byte, and no longer tries to convert CR to\nCRLF in any of the upload text fields.\n\n- bpo-32502(24): uuid.uuid1 no longer raises an exception if a 64-bit\nhardware address is encountered.\n\n- bpo-31848(25): Fix the error handling in Aifcread.initfp() when\nthe SSND chunk is not found.  Patch by Zackery Spytz.\n\n- bpo-32555(26): On FreeBSD and Solaris, os.strerror() now always\ndecode the byte string from the current locale encoding, rather\nthan using ASCII/surrogateescape in some cases.\n\n- bpo-32521(27): The nis module is now compatible with new libnsl and\nheaders location.\n\n- bpo-32473(28): Improve ABCMeta.dumpregistry() output readability\n\n- bpo-32521(29): glibc has removed Sun RPC. Use replacement libtirpc\nheaders and library in nis module.\n\n- bpo-32228(30): Ensure that 'truncate()' preserves the file position\n(as reported by 'tell()') after writes longer than the buffer size.\n\n- bpo-26133(31): Don't unsubscribe signals in asyncio UNIX event loop\non interpreter shutdown.\n\n- bpo-32185(32): The SSL module no longer sends IP addresses in SNI\nTLS extension on platforms with OpenSSL 1.0.2+ or inetpton.\n\n- bpo-32323(33): *note urllib.parse.urlsplit(): b95. does not convert\nzone-id (scope) to lower case for scoped IPv6 addresses in\nhostnames now.\n\n- bpo-32302(34): Fix bdistwininst of distutils for CRT v142: it\nbinary compatible with CRT v140.\n\n- bpo-32255(35): A single empty field is now always quoted when\nwritten into a CSV file.  This allows to distinguish an empty row\nfrom a row consisting of a single empty field.  Patch by Licht\nTakeuchi.\n\n- bpo-32277(36): Raise 'NotImplementedError' instead of 'SystemError'\non platforms where 'chmod(..., followsymlinks=False)' is not\nsupported.  Patch by Anthony Sottile.\n\n- bpo-32199(37): The getnode() ip getter now uses 'ip link' instead\nof 'ip link list'.\n\n- bpo-27456(38): Ensure TCPNODELAY is set on Linux.  Tests by Victor\nStinner.\n\n- bpo-31900(39): The *note locale.localeconv(): a44. function now\nsets temporarily the 'LCCTYPE' locale to the 'LCNUMERIC' locale\nto decode 'decimalpoint' and 'thousandssep' byte strings if they\nare non-ASCII or longer than 1 byte, and the 'LCNUMERIC' locale is\ndifferent than the 'LCCTYPE' locale.  This temporary change\naffects other threads.  Same change for the *note str.format():\n3ed. method when formatting a number (*note int: 17e, *note float:\n4b7, *note float: 4b7. and subclasses) with the 'n' type (ex:\n''{:n}'.format(1234)').\n\n- bpo-31802(40): Importing native path module ('posixpath', 'ntpath')\nnow works even if the 'os' module still is not imported.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33064\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31804\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=33037\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=30353\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=33009\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=32969\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=32713\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=30622\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=32922\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=32859\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=21060\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=32857\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=32852\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=32841\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=31787\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=30157\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=32394\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=32777\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=32647\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=32734\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=32727\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=27931\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=32304\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=32502\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=31848\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=32555\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=32521\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=32473\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=32521\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=32228\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=26133\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=32185\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=32323\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=32302\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=32255\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=32277\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=32199\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=27456\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=31900\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=31802\n\nFile: python3.12.info,  Node: Documentation<58>,  Next: Tests<54>,  Prev: Library<59>,  Up: Python 3 6 5 release candidate 1\n\n1.22.61.4 Documentation\n.......................\n\n- bpo-17232(1): Clarify docs for -O and -OO. Patch by Terry Reedy.\n\n- bpo-32800(2): Update link to w3c doc for xml default namespaces.\n\n- bpo-8722(3): Document 'getattr()' behavior when property\n'get()' method raises *note AttributeError: 395.\n\n- bpo-32614(4): Modify RE examples in documentation to use raw\nstrings to prevent *note DeprecationWarning: 179. and add text to\nREGEX HOWTO to highlight the deprecation.\n\n- bpo-31972(5): Improve docstrings for 'pathlib.PurePath' subclasses.\n\n- bpo-17799(6): Explain real behaviour of sys.settrace and\nsys.setprofile and their C-API counterparts regarding which type of\nevents are received in each function.  Patch by Pablo Galindo\nSalgado.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=17232\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32800\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=8722\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=32614\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=31972\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=17799\n\nFile: python3.12.info,  Node: Tests<54>,  Next: Build<55>,  Prev: Documentation<58>,  Up: Python 3 6 5 release candidate 1\n\n1.22.61.5 Tests\n...............\n\n- bpo-32517(1): Fix failing 'testasyncio' on macOS 10.12.2+ due to\ntransport of 'KqueueSelector' loop was not being closed.\n\n- bpo-32721(2): Fix testhashlib to not fail if the md5 module is\nnot built.\n\n- bpo-32252(3): Fix faulthandlersuppresscrashreport() used to\nprevent core dump files when testing crashes.  getrlimit() returns\nzero on success.\n\n- bpo-31518(4): Debian Unstable has disabled TLS 1.0 and 1.1 for\nSSLv23METHOD().  Change TLS/SSL protocol of some tests to\nPROTOCOLTLS or PROTOCOLTLSv12 to make them pass on Debian.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32517\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32721\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=32252\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=31518\n\nFile: python3.12.info,  Node: Build<55>,  Next: Windows<52>,  Prev: Tests<54>,  Up: Python 3 6 5 release candidate 1\n\n1.22.61.6 Build\n...............\n\n- bpo-32635(1): Fix segfault of the crypt module when libxcrypt is\nprovided instead of libcrypt at the system.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32635\n\nFile: python3.12.info,  Node: Windows<52>,  Next: macOS<42>,  Prev: Build<55>,  Up: Python 3 6 5 release candidate 1\n\n1.22.61.7 Windows\n.................\n\n- bpo-33016(1): Fix potential use of uninitialized memory in\nnt.getfinalpathname\n\n- bpo-32903(2): Fix a memory leak in os.chdir() on Windows if the\ncurrent directory is set to a UNC path.\n\n- bpo-31966(3): Fixed WindowsConsoleIO.write() for writing empty\ndata.\n\n- bpo-32409(4): Ensures activate.bat can handle Unicode contents.\n\n- bpo-32457(5): Improves handling of denormalized executable path\nwhen launching Python.\n\n- bpo-32370(6): Use the correct encoding for ipconfig output in the\nuuid module.  Patch by Segev Finer.\n\n- bpo-29248(7): Fix *note os.readlink(): 73e. on Windows, which was\nmistakenly treating the 'PrintNameOffset' field of the reparse data\nbuffer as a number of characters instead of bytes.  Patch by Craig\nHolmquist and SSE4.\n\n- bpo-32588(8): Create standalone distutilsfindvs module.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33016\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32903\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=31966\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=32409\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=32457\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=32370\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=29248\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=32588\n\nFile: python3.12.info,  Node: macOS<42>,  Next: IDLE<40>,  Prev: Windows<52>,  Up: Python 3 6 5 release candidate 1\n\n1.22.61.8 macOS\n...............\n\n- bpo-32726(1): Provide an additional, more modern macOS installer\nvariant that supports macOS 10.9+ systems in 64-bit mode only.\nUpgrade the supplied third-party libraries to OpenSSL 1.0.2n, XZ\n5.2.3, and SQLite 3.22.0.  The 10.9+ installer now links with and\nsupplies its own copy of Tcl/Tk 8.6.8.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32726\n\nFile: python3.12.info,  Node: IDLE<40>,  Next: Tools/Demos<32>,  Prev: macOS<42>,  Up: Python 3 6 5 release candidate 1\n\n1.22.61.9 IDLE\n..............\n\n- bpo-32984(1): Set 'file' while running a startup file.  Like\nPython, IDLE optionally runs one startup file in the Shell window\nbefore presenting the first interactive input prompt.  For IDLE,\n'-s' runs a file named in environmental variable 'IDLESTARTUP' or\n*note PYTHONSTARTUP: e3b.; '-r file' runs 'file'.  Python sets\n'file' to the startup file name before running the file and\nunsets it before the first prompt.  IDLE now does the same when run\nnormally, without the '-n' option.\n\n- bpo-32940(2): Simplify and rename StringTranslatePseudoMapping in\npyparse.\n\n- bpo-32916(3): Change 'str' to 'code' in pyparse.\n\n- bpo-32905(4): Remove unused code in pyparse module.\n\n- bpo-32874(5): Add tests for pyparse.\n\n- bpo-32837(6): Using the system and place-dependent default encoding\nfor open() is a bad idea for IDLE's system and location-independent\nfiles.\n\n- bpo-32826(7): Add \"encoding=utf-8\" to open() in IDLE's\ntesthelpabout.  GUI test testfilebuttons() only looks at\ninitial ascii-only lines, but failed on systems where open()\ndefaults to 'ascii' because readline() internally reads and decodes\nfar enough ahead to encounter a non-ascii character in CREDITS.txt.\n\n- bpo-32765(8): Update configdialog General tab docstring to add new\nwidgets to the widget list.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32984\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32940\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=32916\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=32905\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=32874\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=32837\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=32826\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=32765\n\nFile: python3.12.info,  Node: Tools/Demos<32>,  Next: C API<50>,  Prev: IDLE<40>,  Up: Python 3 6 5 release candidate 1\n\n1.22.61.10 Tools/Demos\n......................\n\n- bpo-24960(1): 2to3 and lib2to3 can now read pickled grammar files\nusing pkgutil.getdata() rather than probing the filesystem.  This\nlets 2to3 and lib2to3 work when run from a zipfile.\n\n- bpo-32222(2): Fix pygettext not extracting docstrings for functions\nwith type annotated arguments.  Patch by Toby Harradine.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24960\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32222\n\nFile: python3.12.info,  Node: C API<50>,  Prev: Tools/Demos<32>,  Up: Python 3 6 5 release candidate 1\n\n1.22.61.11 C API\n................\n\n- bpo-29084(1): Undocumented C API for OrderedDict has been excluded\nfrom the limited C API. It was added by mistake and actually never\nworked in the limited C API.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=29084\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 6 4 final,  Next: Python 3 6 4 release candidate 1,  Prev: Python 3 6 5 release candidate 1,  Up: Changelog": {
            "content": "'Release date: 2017-12-18'\n\nThere were no new code changes in version 3.6.4 since v3.6.4rc1.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 6 4 release candidate 1,  Next: Python 3 6 3 final,  Prev: Python 3 6 4 final,  Up: Changelog": {
            "content": "'Release date: 2017-12-05'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<59>.\n* Library: Library<60>.\n* Documentation: Documentation<59>.\n* Tests: Tests<55>.\n* Build: Build<56>.\n* Windows: Windows<53>.\n* macOS: macOS<43>.\n* IDLE: IDLE<41>.\n* Tools/Demos: Tools/Demos<33>.\n* C API: C API<51>.\n\nFile: python3.12.info,  Node: Core and Builtins<59>,  Next: Library<60>,  Up: Python 3 6 4 release candidate 1\n\n1.22.63.1 Core and Builtins\n...........................\n\n- bpo-32176(1): coflags.CONOFREE is now always set correctly by the\ncode object constructor based on freevars and cellvars, rather than\nneeding to be set correctly by the caller.  This ensures it will be\ncleared automatically when additional cell references are injected\ninto a modified code object and function.\n\n- bpo-31949(2): Fixed several issues in printing tracebacks\n(PyTraceBackPrint()).  Setting sys.tracebacklimit to 0 or less now\nsuppresses printing tracebacks.  Setting sys.tracebacklimit to None\nnow causes using the default limit.  Setting sys.tracebacklimit to\nan integer larger than LONGMAX now means using the limit LONGMAX\nrather than the default limit.  Fixed integer overflows in the case\nof more than '231' traceback items on Windows.  Fixed output\nerrors handling.\n\n- bpo-30696(3): Fix the interactive interpreter looping endlessly\nwhen no memory.\n\n- bpo-20047(4): Bytearray methods partition() and rpartition() now\naccept only bytes-like objects as separator, as documented.  In\nparticular they now raise TypeError rather of returning a bogus\nresult when an integer is passed as a separator.\n\n- bpo-31852(5): Fix a segmentation fault caused by a combination of\nthe async soft keyword and continuation lines.\n\n- bpo-21720(6): BytesWarning no longer emitted when the 'fromlist'\nargument of 'import()' or the 'all' attribute of the module\ncontain bytes instances.\n\n- bpo-31825(7): Fixed OverflowError in the 'unicode-escape' codec and\nin codecs.escapedecode() when decode an escaped non-ascii byte.\n\n- bpo-28603(8): Print the full context/cause chain of exceptions on\ninterpreter exit, even if an exception in the chain is unhashable\nor compares equal to later ones.  Patch by Zane Bitter.\n\n- bpo-31786(9): Fix timeout rounding in the select module to round\ncorrectly negative timeouts between -1.0 and 0.0.  The functions\nnow block waiting for events as expected.  Previously, the call was\nincorrectly non-blocking.  Patch by Pablo Galindo.\n\n- bpo-31642(10): Restored blocking \"from package import module\" by\nsetting sys.modules[\"package.module\"] to None.\n\n- bpo-31626(11): Fixed a bug in debug memory allocator.  There was a\nwrite to freed memory after shrinking a memory block.\n\n- bpo-31619(12): Fixed a ValueError when convert a string with large\nnumber of underscores to integer with binary base.\n\n- bpo-31592(13): Fixed an assertion failure in Python parser in case\nof a bad 'unicodedata.normalize()'.  Patch by Oren Milman.\n\n- bpo-31588(14): Raise a 'TypeError' with a helpful error message\nwhen class creation fails due to a metaclass with a bad\n'prepare()' method.  Patch by Oren Milman.\n\n- bpo-31566(15): Fix an assertion failure in 'warnings.warn()' in\ncase of a bad 'name' global.  Patch by Oren Milman.\n\n- bpo-31505(16): Fix an assertion failure in 'json', in case\n'json.makeencoder()' received a bad 'encoder()' argument.  Patch\nby Oren Milman.\n\n- bpo-31492(17): Fix assertion failures in case of failing to import\nfrom a module with a bad 'name' attribute, and in case of\nfailing to access an attribute of such a module.  Patch by Oren\nMilman.\n\n- bpo-31490(18): Fix an assertion failure in 'ctypes' class\ndefinition, in case the class has an attribute whose name is\nspecified in 'anonymous' but not in 'fields'.  Patch by Oren\nMilman.\n\n- bpo-31478(19): Fix an assertion failure in 'random.Random.seed()'\nin case the argument has a bad 'abs()' method.  Patch by Oren\nMilman.\n\n- bpo-31315(20): Fix an assertion failure in imp.createdynamic(),\nwhen spec.name is not a string.  Patch by Oren Milman.\n\n- bpo-31311(21): Fix a crash in the 'setstate()' method of\n'ctypes.CData', in case of a bad 'dict'.  Patch by Oren\nMilman.\n\n- bpo-31293(22): Fix crashes in true division and multiplication of a\ntimedelta object by a float with a bad asintegerratio() method.\nPatch by Oren Milman.\n\n- bpo-31285(23): Fix an assertion failure in\n'warnings.warnexplicit', when the return value of the received\nloader's 'getsource()' has a bad 'splitlines()' method.  Patch by\nOren Milman.\n\n- bpo-30817(24): 'PyErrPrintEx()' clears now the ignored exception\nthat may be raised by 'PySysSetObjectId()', for example when no\nmemory.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32176\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31949\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=30696\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=20047\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=31852\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=21720\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=31825\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=28603\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=31786\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=31642\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=31626\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=31619\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=31592\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=31588\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=31566\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=31505\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=31492\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=31490\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=31478\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=31315\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=31311\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=31293\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=31285\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=30817\n\nFile: python3.12.info,  Node: Library<60>,  Next: Documentation<59>,  Prev: Core and Builtins<59>,  Up: Python 3 6 4 release candidate 1\n\n1.22.63.2 Library\n.................\n\n- bpo-28556(1): Two minor fixes for 'typing' module: allow shallow\ncopying instances of generic classes, improve interaction of\n'initsubclass' with generics.  Original PRs by Ivan\nLevkivskyi.\n\n- bpo-27240(2): The header folding algorithm for the new email\npolicies has been rewritten, which also fixes bpo-30788(3),\nbpo-31831(4), and bpo-32182(5).  In particular, RFC2231 folding is\nnow done correctly.\n\n- bpo-32186(6): io.FileIO.readall() and io.FileIO.read() now release\nthe GIL when getting the file size.  Fixed hang of all threads with\ninaccessible NFS server.  Patch by Nir Soffer.\n\n- bpo-12239(7): Make *note msilib.SummaryInformation.GetProperty():\n1761. return 'None' when the value of property is 'VTEMPTY'.\nInitial patch by Mark Mc Mahon.\n\n- bpo-31325(8): Fix wrong usage of *note collections.namedtuple():\n711. in the *note RobotFileParser.parse(): 1825. method.  Initial\npatch by Robin Wellner.\n\n- bpo-12382(9): *note msilib.OpenDatabase(): 16b7. now raises a\nbetter exception message when it couldn't open or create an MSI\nfile.  Initial patch by William Tisa\"ter.\n\n- bpo-32110(10): 'codecs.StreamReader.read(n)' now returns not more\nthan 'n' characters/bytes for non-negative 'n'.  This makes it\ncompatible with 'read()' methods of other file-like objects.\n\n- bpo-32072(11): Fixed issues with binary plists: Fixed saving\nbytearrays.  Identical objects will be saved only once.  Equal\nreferences will be load as identical objects.  Added support for\nsaving and loading recursive data structures.\n\n- bpo-32034(12): Make asyncio.IncompleteReadError and\nLimitOverrunError pickleable.\n\n- bpo-32015(13): Fixed the looping of asyncio in the case of\nreconnection the socket during waiting async read/write from/to the\nsocket.\n\n- bpo-32011(14): Restored support of loading marshal files with the\nTYPEINT64 code.  These files can be produced in Python 2.7.\n\n- bpo-31970(15): Reduce performance overhead of asyncio debug mode.\n\n- bpo-9678(16): Fixed determining the MAC address in the uuid module:\nUsing ifconfig on NetBSD and OpenBSD. Using arp on Linux, FreeBSD,\nNetBSD and OpenBSD. Based on patch by Takayuki Shimizukawa.\n\n- bpo-30057(17): Fix potential missed signal in signal.signal().\n\n- bpo-31933(18): Fix Blake2 params leafsize and nodeoffset on big\nendian platforms.  Patch by Jack O'Connor.\n\n- bpo-31927(19): Fixed compilation of the socket module on NetBSD 8.\nFixed assertion failure or reading arbitrary data when parse a\nAFBLUETOOTH address on NetBSD and DragonFly BSD.\n\n- bpo-27666(20): Fixed stack corruption in curses.box() and\ncurses.ungetmouse() when the size of types chtype or mmaskt is\nless than the size of C long.  curses.box() now accepts characters\nas arguments.  Based on patch by Steve Fink.\n\n- bpo-31897(21): plistlib now catches more errors when read binary\nplists and raises InvalidFileException instead of unexpected\nexceptions.\n\n- bpo-25720(22): Fix the method for checking pad state of curses\nWINDOW. Patch by Masayuki Yamamoto.\n\n- bpo-31893(23): Fixed the layout of the kqueueevent structure on\nOpenBSD and NetBSD. Fixed the comparison of the kqueueevent\nobjects.\n\n- bpo-31891(24): Fixed building the curses module on NetBSD.\n\n- bpo-28416(25): Instances of pickle.Pickler subclass with the\npersistentid() method and pickle.Unpickler subclass with the\npersistentload() method no longer create reference cycles.\n\n- bpo-28326(26): Fix multiprocessing.Process when stdout and/or\nstderr is closed or None.\n\n- bpo-31457(27): If nested log adapters are used, the inner\n'process()' methods are no longer omitted.\n\n- bpo-31457(28): The 'manager' property on LoggerAdapter objects is\nnow properly settable.\n\n- bpo-31806(29): Fix timeout rounding in time.sleep(),\nthreading.Lock.acquire() and socket.socket.settimeout() to round\ncorrectly negative timeouts between -1.0 and 0.0.  The functions\nnow block waiting for events as expected.  Previously, the call was\nincorrectly non-blocking.  Patch by Pablo Galindo.\n\n- bpo-28603(30): traceback: Fix a TypeError that occurred during\nprinting of exception tracebacks when either the current exception\nor an exception in its context/cause chain is unhashable.  Patch by\nZane Bitter.\n\n- bpo-30058(31): Fixed buffer overflow in select.kqueue.control().\n\n- bpo-31770(32): Prevent a crash when calling the 'init()' method\nof a 'sqlite3.Cursor' object more than once.  Patch by Oren Milman.\n\n- bpo-31672(33): 'idpattern' in 'string.Template' matched some\nnon-ASCII characters.  Now it uses '-i' regular expression local\nflag to avoid non-ASCII characters.\n\n- bpo-31764(34): Prevent a crash in 'sqlite3.Cursor.close()' in case\nthe 'Cursor' object is uninitialized.  Patch by Oren Milman.\n\n- bpo-31752(35): Fix possible crash in timedelta constructor called\nwith custom integers.\n\n- bpo-31701(36): On Windows, faulthandler.enable() now ignores MSC\nand COM exceptions.\n\n- bpo-31728(37): Prevent crashes in 'elementtree' due to unsafe\ncleanup of 'Element.text' and 'Element.tail'.  Patch by Oren\nMilman.\n\n- bpo-31620(38): an empty asyncio.Queue now doesn't leak memory when\nqueue.get pollers timeout\n\n- bpo-31632(39): Fix method setprotocol() of class\nSSLProtocolTransport in asyncio module.  This method was\npreviously modifying a wrong reference to the protocol.\n\n- bpo-31675(40): Fixed memory leaks in Tkinter's methods splitlist()\nand split() when pass a string larger than 2 GiB.\n\n- bpo-31673(41): Fixed typo in the name of Tkinter's method\nadderrorinfo().\n\n- bpo-30806(42): Fix the string representation of a netrc object.\n\n- bpo-15037(43): Added a workaround for getkey() in curses for\nncurses 5.7 and earlier.\n\n- bpo-25351(44): Avoid venv activate failures with undefined\nvariables\n\n- bpo-25532(45): inspect.unwrap() will now only try to unwrap an\nobject sys.getrecursionlimit() times, to protect against objects\nwhich create a new object on every attribute access.\n\n- bpo-30347(46): Stop crashes when concurrently iterate over\nitertools.groupby() iterators.\n\n- bpo-31516(47): 'threading.currentthread()' should not return a\ndummy thread at shutdown.\n\n- bpo-31351(48): python -m ensurepip now exits with non-zero exit\ncode if pip bootstrapping has failed.\n\n- bpo-31482(49): 'random.seed()' now works with bytes in version=1\n\n- bpo-31334(50): Fix 'poll.poll([timeout])' in the 'select' module\nfor arbitrary negative timeouts on all OSes where it can only be a\nnon-negative integer or -1.  Patch by Riccardo Coccioli.\n\n- bpo-31310(51): multiprocessing's semaphore tracker should be\nlaunched again if crashed.\n\n- bpo-31308(52): Make multiprocessing's forkserver process immune to\nCtrl-C and other user interruptions.  If it crashes, restart it\nwhen necessary.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28556\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=27240\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=30788\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=31831\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=32182\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=32186\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=12239\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=31325\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=12382\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=32110\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=32072\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=32034\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=32015\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=32011\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=31970\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=9678\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=30057\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=31933\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=31927\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=27666\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=31897\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=25720\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=31893\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=31891\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=28416\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=28326\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=31457\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=31457\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=31806\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=28603\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=30058\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=31770\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=31672\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=31764\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=31752\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=31701\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=31728\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=31620\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=31632\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=31675\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=31673\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=30806\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=15037\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=25351\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=25532\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=30347\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=31516\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=31351\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=31482\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=31334\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=31310\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=31308\n\nFile: python3.12.info,  Node: Documentation<59>,  Next: Tests<55>,  Prev: Library<60>,  Up: Python 3 6 4 release candidate 1\n\n1.22.63.3 Documentation\n.......................\n\n- bpo-32105(1): Added asyncio.BaseEventLoop.connectacceptedsocket\nversionadded marker.\n\n- bpo-31537(2): Fix incorrect usage of 'gethistorylength' in\nreadline documentation example code.  Patch by Brad Smith.\n\n- bpo-30085(3): The operator functions without double underscores are\npreferred for clarity.  The one with underscores are only kept for\nback-compatibility.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32105\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31537\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=30085\n\nFile: python3.12.info,  Node: Tests<55>,  Next: Build<56>,  Prev: Documentation<59>,  Up: Python 3 6 4 release candidate 1\n\n1.22.63.4 Tests\n...............\n\n- bpo-31380(1): Skip testhttpservers testundecodablefile on macOS:\nfails on APFS.\n\n- bpo-31705(2): Skip testsocket.testsha256() on Linux kernel older\nthan 4.5.  The test fails with ENOKEY on kernel 3.10 (on ppc64le).\nA fix was merged into the kernel 4.5.\n\n- bpo-31174(3): Fix testtools.testunparse: DirectoryTestCase now\nstores the names sample to always test the same files.  It prevents\nfalse alarms when hunting reference leaks.\n\n- bpo-30695(4): Add the 'setnomemory(start, stop)' and\n'removememhooks()' functions to the 'testcapi' module.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31380\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31705\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=31174\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=30695\n\nFile: python3.12.info,  Node: Build<56>,  Next: Windows<53>,  Prev: Tests<55>,  Up: Python 3 6 4 release candidate 1\n\n1.22.63.5 Build\n...............\n\n- bpo-32059(1): 'detectmodules()' in 'setup.py' now also searches\nthe sysroot paths when cross-compiling.\n\n- bpo-31957(2): Fixes Windows SDK version detection when building for\nWindows.\n\n- bpo-31609(3): Fixes quotes in PCbuild/clean.bat\n\n- bpo-31934(4): Abort the build when building out of a not clean\nsource tree.\n\n- bpo-31926(5): Fixed Argument Clinic sometimes causing compilation\nerrors when there was more than one function and/or method in a .c\nfile with the same name.\n\n- bpo-28791(6): Update Windows builds to use SQLite 3.21.0.\n\n- bpo-28791(7): Update OS X installer to use SQLite 3.21.0.\n\n- bpo-22140(8): Prevent double substitution of prefix in\npython-config.sh.\n\n- bpo-31536(9): Avoid wholesale rebuild after 'make regen-all' if\nnothing changed.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32059\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31957\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=31609\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=31934\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=31926\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=28791\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=28791\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=22140\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=31536\n\nFile: python3.12.info,  Node: Windows<53>,  Next: macOS<43>,  Prev: Build<56>,  Up: Python 3 6 4 release candidate 1\n\n1.22.63.6 Windows\n.................\n\n- bpo-1102(1): Return 'None' when 'View.Fetch()' returns\n'ERRORNOMOREITEMS' instead of raising 'MSIError'.  Initial patch\nby Anthony Tuininga.\n\n- bpo-31944(2): Fixes Modify button in Apps and Features dialog.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=1102\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31944\n\nFile: python3.12.info,  Node: macOS<43>,  Next: IDLE<41>,  Prev: Windows<53>,  Up: Python 3 6 4 release candidate 1\n\n1.22.63.7 macOS\n...............\n\n- bpo-31392(1): Update macOS installer to use OpenSSL 1.0.2m\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31392\n\nFile: python3.12.info,  Node: IDLE<41>,  Next: Tools/Demos<33>,  Prev: macOS<43>,  Up: Python 3 6 4 release candidate 1\n\n1.22.63.8 IDLE\n..............\n\n- bpo-32207(1): Improve tk event exception tracebacks in IDLE. When\ntk event handling is driven by IDLE's run loop, a confusing and\ndistracting queue.EMPTY traceback context is no longer added to tk\nevent exception tracebacks.  The traceback is now the same as when\nevent handling is driven by user code.  Patch based on a suggestion\nby Serhiy Storchaka.\n\n- bpo-32164(2): Delete unused file idlelib/tabbedpages.py.  Use of\nTabbedPageSet in configdialog was replaced by ttk.Notebook.\n\n- bpo-32100(3): IDLE: Fix old and new bugs in pathbrowser; improve\ntests.  Patch mostly by Cheryl Sabella.\n\n- bpo-31858(4): IDLE - Restrict shell prompt manipulation to the\nshell.  Editor and output windows only see an empty last prompt\nline.  This simplifies the code and fixes a minor bug when newline\nis inserted.  Sys.ps1, if present, is read on Shell start-up, but\nis not set or changed.\n\n- bpo-31860(5): The font sample in the IDLE configuration dialog is\nnow editable.  Changes persist while IDLE remains open\n\n- bpo-31836(6): Testcodemodule now passes if run after testidle,\nwhich sets ps1.  The code module uses sys.ps1 if present or sets it\nto '>>> ' if not.  Testcodemodule now properly tests both\nbehaviors.  Ditto for ps2.\n\n- bpo-28603(7): Fix a TypeError that caused a shell restart when\nprinting a traceback that includes an exception that is unhashable.\nPatch by Zane Bitter.\n\n- bpo-13802(8): Use non-Latin characters in the IDLE's Font settings\nsample.  Even if one selects a font that defines a limited subset\nof the unicode Basic Multilingual Plane, tcl/tk will use other\nfonts that define a character.  The expanded example give users of\nnon-Latin characters a better idea of what they might see in IDLE's\nshell and editors.  To make room for the expanded sample, frames on\nthe Font tab are re-arranged.  The Font/Tabs help explains a bit\nabout the additions.\n\n- bpo-31460(9): Simplify the API of IDLE's Module Browser.  Passing a\nwidget instead of an flist with a root widget opens the option of\ncreating a browser frame that is only part of a window.  Passing a\nfull file name instead of pieces assumed to come from a .py file\nopens the possibility of browsing python files that do not end in\n.py.\n\n- bpo-31649(10): IDLE - Make htest, utest parameters keyword only.\n\n- bpo-31559(11): Remove test order dependence in\nidletest.testbrowser.\n\n- bpo-31459(12): Rename IDLE's module browser from Class Browser to\nModule Browser.  The original module-level class and method browser\nbecame a module browser, with the addition of module-level\nfunctions, years ago.  Nested classes and functions were added\nyesterday.  For back-compatibility, the virtual event\n<<open-class-browser>>, which appears on the Keys tab of the\nSettings dialog, is not changed.  Patch by Cheryl Sabella.\n\n- bpo-31500(13): Default fonts now are scaled on HiDPI displays.\n\n- bpo-1612262(14): IDLE module browser now shows nested classes and\nfunctions.  Original patches for code and tests by Guilherme Polo\nand Cheryl Sabella, respectively.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32207\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=32164\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=32100\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=31858\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=31860\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=31836\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=28603\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=13802\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=31460\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=31649\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=31559\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=31459\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=31500\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=1612262\n\nFile: python3.12.info,  Node: Tools/Demos<33>,  Next: C API<51>,  Prev: IDLE<41>,  Up: Python 3 6 4 release candidate 1\n\n1.22.63.9 Tools/Demos\n.....................\n\n- bpo-30722(1): Make redemo work with Python 3.6 and newer versions.\nAlso, remove the 'LOCALE' option since it doesn't work with string\npatterns in Python 3.  Patch by Christoph Sarnowski.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30722\n\nFile: python3.12.info,  Node: C API<51>,  Prev: Tools/Demos<33>,  Up: Python 3 6 4 release candidate 1\n\n1.22.63.10 C API\n................\n\n- bpo-20891(1): Fix PyGILStateEnsure().  When PyGILStateEnsure() is\ncalled in a non-Python thread before PyEvalInitThreads(), only\ncall PyEvalInitThreads() after calling PyThreadStateNew() to fix\na crash.\n\n- bpo-31532(2): Fix memory corruption due to allocator mix in\ngetpath.c between PyGetPath() and PySetPath()\n\n- bpo-30697(3): The 'PyExcRecursionErrorInst' singleton is removed\nand 'PyErrNormalizeException()' does not use it anymore.  This\nsingleton is persistent and its members being never cleared may\ncause a segfault during finalization of the interpreter.  See also\nbpo-22898(4).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=20891\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31532\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=30697\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=22898\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 6 3 final,  Next: Python 3 6 3 release candidate 1,  Prev: Python 3 6 4 release candidate 1,  Up: Changelog": {
            "content": "'Release date: 2017-10-03'\n\n* Menu:\n\n* Library: Library<61>.\n* Build: Build<57>.\n\nFile: python3.12.info,  Node: Library<61>,  Next: Build<57>,  Up: Python 3 6 3 final\n\n1.22.64.1 Library\n.................\n\n- bpo-31641(1): Re-allow arbitrary iterables in\n'concurrent.futures.ascompleted()'.  Fixes regression in 3.6.3rc1.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31641\n\nFile: python3.12.info,  Node: Build<57>,  Prev: Library<61>,  Up: Python 3 6 3 final\n\n1.22.64.2 Build\n...............\n\n- bpo-31662(1): Fix typos in Windows 'uploadrelease.bat' script.  Fix\nWindows Doc build issues in 'Doc/make.bat'.\n\n- bpo-31423(2): Fix building the PDF documentation with newer\nversions of Sphinx.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31662\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31423\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 6 3 release candidate 1,  Next: Python 3 6 2 final,  Prev: Python 3 6 3 final,  Up: Changelog": {
            "content": "'Release date: 2017-09-18'\n\n* Menu:\n\n* Security: Security<36>.\n* Core and Builtins: Core and Builtins<60>.\n* Library: Library<62>.\n* Documentation: Documentation<60>.\n* Tests: Tests<56>.\n* Build: Build<58>.\n* Windows: Windows<54>.\n* IDLE: IDLE<42>.\n* Tools/Demos: Tools/Demos<34>.\n\nFile: python3.12.info,  Node: Security<36>,  Next: Core and Builtins<60>,  Up: Python 3 6 3 release candidate 1\n\n1.22.65.1 Security\n..................\n\n- bpo-29781(1): SSLObject.version() now correctly returns None when\nhandshake over BIO has not been performed yet.\n\n- bpo-30947(2): Upgrade libexpat embedded copy from version 2.2.1 to\n2.2.3 to get security fixes.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=29781\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=30947\n\nFile: python3.12.info,  Node: Core and Builtins<60>,  Next: Library<62>,  Prev: Security<36>,  Up: Python 3 6 3 release candidate 1\n\n1.22.65.2 Core and Builtins\n...........................\n\n- bpo-31471(1): Fix an assertion failure in 'subprocess.Popen()' on\nWindows, in case the env argument has a bad 'keys()' method.  Patch\nby Oren Milman.\n\n- bpo-31418(2): Fix an assertion failure in 'PyErrWriteUnraisable()'\nin case of an exception with a bad 'module' attribute.  Patch\nby Oren Milman.\n\n- bpo-31416(3): Fix assertion failures in case of a bad\nwarnings.filters or warnings.defaultaction.  Patch by Oren Milman.\n\n- bpo-31411(4): Raise a TypeError instead of SystemError in case\nwarnings.onceregistry is not a dictionary.  Patch by Oren Milman.\n\n- bpo-31373(5): Fix several possible instances of undefined behavior\ndue to floating-point demotions.\n\n- bpo-30465(6): Location information ('lineno' and 'coloffset') in\nf-strings is now (mostly) correct.  This fixes tools like flake8\nfrom showing warnings on the wrong line (typically the first line\nof the file).\n\n- bpo-31343(7): Include sys/sysmacros.h for major(), minor(), and\nmakedev().  GNU C libray plans to remove the functions from\nsys/types.h.\n\n- bpo-31291(8): Fix an assertion failure in\n'zipimport.zipimporter.getdata' on Windows, when the return value\nof 'pathname.replace('/','\\\\')' isn't a string.  Patch by Oren\nMilman.\n\n- bpo-31271(9): Fix an assertion failure in the 'write()' method of\n'io.TextIOWrapper', when the encoder doesn't return a bytes object.\nPatch by Oren Milman.\n\n- bpo-31243(10): Fix a crash in some methods of 'io.TextIOWrapper',\nwhen the decoder's state is invalid.  Patch by Oren Milman.\n\n- bpo-30721(11): 'print' now shows correct usage hint for using\nPython 2 redirection syntax.  Patch by Sanyam Khurana.\n\n- bpo-31070(12): Fix a race condition in importlib\ngetmodulelock().\n\n- bpo-31095(13): Fix potential crash during GC caused by 'tpdealloc'\nwhich doesn't call 'PyObjectGCUnTrack()'.\n\n- bpo-31071(14): Avoid masking original TypeError in call with *\nunpacking when other arguments are passed.\n\n- bpo-30978(15): str.formatmap() now passes key lookup exceptions\nthrough.  Previously any exception was replaced with a KeyError\nexception.\n\n- bpo-30808(16): Use Pyatomic API for concurrency-sensitive signal\nstate.\n\n- bpo-30876(17): Relative import from unloaded package now reimports\nthe package instead of failing with SystemError.  Relative import\nfrom non-package now fails with ImportError rather than\nSystemError.\n\n- bpo-30703(18): Improve signal delivery.  Avoid using\nPyAddPendingCall from signal handler, to avoid calling\nsignal-unsafe functions.  The tests I'm adding here fail without\nthe rest of the patch, on Linux and OS X. This means our signal\ndelivery logic had defects (some signals could be lost).\n\n- bpo-30765(19): Avoid blocking in pthreadmutexlock() when\nPyThreadacquirelock() is asked not to block.\n\n- bpo-31161(20): Make sure the 'Missing parentheses' syntax error\nmessage is only applied to SyntaxError, not to subclasses.  Patch\nby Martijn Pieters.\n\n- bpo-30814(21): Fixed a race condition when import a submodule from\na package.\n\n- bpo-30597(22): 'print' now shows expected input in custom error\nmessage when used as a Python 2 statement.  Patch by Sanyam\nKhurana.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31471\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31418\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=31416\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=31411\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=31373\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=30465\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=31343\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=31291\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=31271\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=31243\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=30721\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=31070\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=31095\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=31071\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=30978\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=30808\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=30876\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=30703\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=30765\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=31161\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=30814\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=30597\n\nFile: python3.12.info,  Node: Library<62>,  Next: Documentation<60>,  Prev: Core and Builtins<60>,  Up: Python 3 6 3 release candidate 1\n\n1.22.65.3 Library\n.................\n\n- bpo-31499(1): xml.etree: Fix a crash when a parser is part of a\nreference cycle.\n\n- bpo-28556(2): typing.gettypehints now finds the right globalns\nfor classes and modules by default (when no 'globalns' was\nspecified by the caller).\n\n- bpo-28556(3): Speed improvements to the 'typing' module.  Original\nPRs by Ivan Levkivskyi and Mitar.\n\n- bpo-31544(4): The C accelerator module of ElementTree ignored\nexceptions raised when looking up TreeBuilder target methods in\nXMLParser().\n\n- bpo-31234(5): socket.createconnection() now fixes manually a\nreference cycle: clear the variable storing the last exception on\nsuccess.\n\n- bpo-31457(6): LoggerAdapter objects can now be nested.\n\n- bpo-31400(7): Improves SSL error handling to avoid losing error\nnumbers.\n\n- bpo-28958(8): ssl.SSLContext() now uses OpenSSL error information\nwhen a context cannot be instantiated.\n\n- bpo-27340(9): SSLSocket.sendall() now uses memoryview to create\nslices of data.  This fixes support for all bytes-like object.  It\nis also more efficient and avoids costly copies.\n\n- bpo-31178(10): Fix string concatenation bug in rare error path in\nthe subprocess module\n\n- bpo-31350(11): Micro-optimize 'asyncio.getrunningloop()' to\nbecome up to 10% faster.\n\n- bpo-31170(12): expat: Update libexpat from 2.2.3 to 2.2.4.  Fix\ncopying of partial characters for UTF-8 input (libexpat bug 115):\n'https://github.com/libexpat/libexpat/issues/115'\n\n- bpo-29136(13): Add TLS 1.3 cipher suites and OPNOTLSv13.\n\n- bpo-29212(14): Fix concurrent.futures.thread.ThreadPoolExecutor\nthreads to have a non repr() based thread name by default when no\nthreadnameprefix is supplied.  They will now identify themselves\nas \"ThreadPoolExecutor-yn\".\n\n- bpo-9146(15): Fix a segmentation fault in hashopenssl when\nstandard hash functions such as md5 are not available in the linked\nOpenSSL library.  As in some special FIPS-140 build environments.\n\n- bpo-27144(16): The 'map()' and 'ascompleted()' iterators in\n'concurrent.futures' now avoid keeping a reference to yielded\nobjects.\n\n- bpo-10746(17): Fix ctypes producing wrong PEP 3118(18) type codes\nfor integer types.\n\n- bpo-22536(19): The subprocess module now sets the filename when\nFileNotFoundError is raised on POSIX systems due to the executable\nor cwd not being found.\n\n- bpo-31249(20): concurrent.futures: WorkItem.run() used by\nThreadPoolExecutor now breaks a reference cycle between an\nexception object and the WorkItem object.\n\n- bpo-31247(21): xmlrpc.server now explicitly breaks reference cycles\nwhen using sys.excinfo() in code handling exceptions.\n\n- bpo-30102(22): The ssl and hashlib modules now call\nOPENSSLaddallalgorithmsnoconf() on OpenSSL < 1.1.0.  The\nfunction detects CPU features and enables optimizations on some CPU\narchitectures such as POWER8.  Patch is based on research from\nGustavo Serra Scalet.\n\n- bpo-31185(23): Fixed miscellaneous errors in asyncio speedup\nmodule.\n\n- bpo-31135(24): ttk: fix the destroy() method of LabeledScale and\nOptionMenu classes.  Call the parent destroy() method even if the\nused attribute doesn't exist.  The LabeledScale.destroy() method\nnow also explicitly clears label and scale attributes to help the\ngarbage collector to destroy all widgets.\n\n- bpo-31107(25): Fix 'copyreg.slotnames()' mangled attribute\ncalculation for classes whose name begins with an underscore.\nPatch by Shane Harvey.\n\n- bpo-31061(26): Fixed a crash when using asyncio and threads.\n\n- bpo-30502(27): Fix handling of long oids in ssl.  Based on patch by\nChristian Heimes.\n\n- bpo-30119(28): ftplib.FTP.putline() now throws ValueError on\ncommands that contains CR or LF. Patch by Donghee Na.\n\n- bpo-30595(29): multiprocessing.Queue.get() with a timeout now polls\nits reader in non-blocking mode if it succeeded to acquire the lock\nbut the acquire took longer than the timeout.\n\n- bpo-29403(30): Fix 'unittest.mock''s autospec to not fail on\nmethod-bound builtin functions.  Patch by Aaron Gallagher.\n\n- bpo-30961(31): Fix decrementing a borrowed reference in\ntracemalloc.\n\n- bpo-25684(32): Change 'ttk.OptionMenu' radiobuttons to be unique\nacross instances of 'OptionMenu'.\n\n- bpo-30886(33): Fix multiprocessing.Queue.jointhread(): it now\nwaits until the thread completes, even if the thread was started by\nthe same process which created the queue.\n\n- bpo-29854(34): Fix segfault in readline when using readline's\nhistory-size option.  Patch by Nir Soffer.\n\n- bpo-30319(35): socket.close() now ignores ECONNRESET error.\n\n- bpo-30828(36): Fix out of bounds write in\n'asyncio.CFuture.removedonecallback()'.\n\n- bpo-30807(37): signal.setitimer() may disable the timer when passed\na tiny value.  Tiny values (such as 1e-6) are valid non-zero values\nfor setitimer(), which is specified as taking\nmicrosecond-resolution intervals.  However, on some platform, our\nconversion routine could convert 1e-6 into a zero interval,\ntherefore disabling the timer instead of (re-)scheduling it.\n\n- bpo-30441(38): Fix bug when modifying os.environ while iterating\nover it\n\n- bpo-30532(39): Fix email header value parser dropping folding white\nspace in certain cases.\n\n- bpo-30879(40): os.listdir() and os.scandir() now emit bytes names\nwhen called with bytes-like argument.\n\n- bpo-30746(41): Prohibited the '=' character in environment variable\nnames in 'os.putenv()' and 'os.spawn*()'.\n\n- bpo-29755(42): Fixed the lgettext() family of functions in the\ngettext module.  They now always return bytes.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31499\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=28556\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=28556\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=31544\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=31234\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=31457\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=31400\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=28958\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=27340\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=31178\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=31350\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=31170\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=29136\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=29212\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=9146\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=27144\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=10746\n\n(18) https://peps.python.org/pep-3118/\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=22536\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=31249\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=31247\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=30102\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=31185\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=31135\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=31107\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=31061\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=30502\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=30119\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=30595\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=29403\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=30961\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=25684\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=30886\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=29854\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=30319\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=30828\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=30807\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=30441\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=30532\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=30879\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=30746\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=29755\n\nFile: python3.12.info,  Node: Documentation<60>,  Next: Tests<56>,  Prev: Library<62>,  Up: Python 3 6 3 release candidate 1\n\n1.22.65.4 Documentation\n.......................\n\n- bpo-31294(1): Fix incomplete code snippet in the\nZeroMQSocketListener and ZeroMQSocketHandler examples and adapt\nthem to Python 3.\n\n- bpo-21649(2): Add RFC 7525 and Mozilla server side TLS links to SSL\ndocumentation.\n\n- bpo-30803(3): Clarify doc on truth value testing.  Original patch\nby Peter Thomassen.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31294\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=21649\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=30803\n\nFile: python3.12.info,  Node: Tests<56>,  Next: Build<58>,  Prev: Documentation<60>,  Up: Python 3 6 3 release candidate 1\n\n1.22.65.5 Tests\n...............\n\n- bpo-31320(1): Silence traceback in testssl\n\n- bpo-25674(2): Remove sha256.tbs-internet.com ssl test\n\n- bpo-30715(3): Address ALPN callback changes for OpenSSL 1.1.0f.\nThe latest version behaves like OpenSSL 1.0.2 and no longer aborts\nhandshake.\n\n- bpo-30822(4): regrtest: Exclude tzdata from regrtest -all.  When\nrunning the test suite using -use=all / -u all, exclude tzdata\nsince it makes testdatetime too slow (15-20 min on some buildbots)\nwhich then times out on some buildbots.  Fix also regrtest command\nline parser to allow passing -u extralargefile to run\ntestzipfile64.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31320\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=25674\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=30715\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=30822\n\nFile: python3.12.info,  Node: Build<58>,  Next: Windows<54>,  Prev: Tests<56>,  Up: Python 3 6 3 release candidate 1\n\n1.22.65.6 Build\n...............\n\n- bpo-30854(1): Fix compile error when compiling -without-threads.\nPatch by Masayuki Yamamoto.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30854\n\nFile: python3.12.info,  Node: Windows<54>,  Next: IDLE<42>,  Prev: Build<58>,  Up: Python 3 6 3 release candidate 1\n\n1.22.65.7 Windows\n.................\n\n- bpo-30389(1): Adds detection of Visual Studio 2017 to distutils on\nWindows.\n\n- bpo-31340(2): Change to building with MSVC v141 (included with\nVisual Studio 2017)\n\n- bpo-30581(3): os.cpucount() now returns the correct number of\nprocessors on Windows when the number of logical processors is\ngreater than 64.\n\n- bpo-30731(4): Add a missing xmlns to python.manifest so that it\nmatches the schema.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30389\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31340\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=30581\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=30731\n\nFile: python3.12.info,  Node: IDLE<42>,  Next: Tools/Demos<34>,  Prev: Windows<54>,  Up: Python 3 6 3 release candidate 1\n\n1.22.65.8 IDLE\n..............\n\n- bpo-31493(1): IDLE code context - fix code update and font update\ntimers.  Canceling timers prevents a warning message when testidle\ncompletes.\n\n- bpo-31488(2): IDLE - Update non-key options in former extension\nclasses.  When applying configdialog changes, call .reload for each\nfeature class.  Change ParenMatch so updated options affect\nexisting instances attached to existing editor windows.\n\n- bpo-31477(3): IDLE - Improve rstrip entry in doc.  Strip trailing\nwhitespace strips more than blank spaces.  Multiline string\nliterals are not skipped.\n\n- bpo-31480(4): IDLE - make tests pass with zzdummy extension\ndisabled by default.\n\n- bpo-31421(5): Document how IDLE runs tkinter programs.  IDLE calls\ntcl/tk update in the background in order to make live interaction\nand experimentation with tkinter applications much easier.\n\n- bpo-31414(6): IDLE - fix tk entry box tests by deleting first.\nAdding to an int entry is not the same as deleting and inserting\nbecause int('') will fail.\n\n- bpo-31051(7): Rearrange IDLE configdialog GenPage into Window,\nEditor, and Help sections.\n\n- bpo-30617(8): IDLE - Add docstrings and tests for outwin subclass\nof editor.  Move some data and functions from the class to module\nlevel.  Patch by Cheryl Sabella.\n\n- bpo-31287(9): IDLE - Do not modify tkinter.message in\ntestconfigdialog.\n\n- bpo-27099(10): Convert IDLE's built-in 'extensions' to regular\nfeatures.  About 10 IDLE features were implemented as supposedly\noptional extensions.  Their different behavior could be confusing\nor worse for users and not good for maintenance.  Hence the\nconversion.  The main difference for users is that user\nconfigurable key bindings for builtin features are now handled\nuniformly.  Now, editing a binding in a keyset only affects its\nvalue in the keyset.  All bindings are defined together in the\nsystem-specific default keysets in config-extensions.def.  All\ncustom keysets are saved as a whole in config-extension.cfg.  All\ntake effect as soon as one clicks Apply or Ok.  The affected events\nare '<<force-open-completions>>', '<<expand-word>>',\n'<<force-open-calltip>>', '<<flash-paren>>',\n'<<format-paragraph>>', '<<run-module>>', '<<check-module>>', and\n'<<zoom-height>>'.  Any (global) customizations made before 3.6.3\nwill not affect their keyset-specific customization after 3.6.3.\nand vice versa.  Initial patch by Charles Wohlganger.\n\n- bpo-31206(11): IDLE: Factor HighPage(Frame) class from\nConfigDialog.  Patch by Cheryl Sabella.\n\n- bpo-31001(12): Add tests for configdialog highlight tab.  Patch by\nCheryl Sabella.\n\n- bpo-31205(13): IDLE: Factor KeysPage(Frame) class from\nConfigDialog.  The slightly modified tests continue to pass.  Patch\nby Cheryl Sabella.\n\n- bpo-31130(14): IDLE - stop leaks in testconfigdialog.  Initial\npatch by Victor Stinner.\n\n- bpo-31002(15): Add tests for configdialog keys tab.  Patch by\nCheryl Sabella.\n\n- bpo-19903(16): IDLE: Calltips use 'inspect.signature' instead of\n'inspect.getfullargspec'.  This improves calltips for builtins\nconverted to use Argument Clinic.  Patch by Louie Lu.\n\n- bpo-31083(17): IDLE - Add an outline of a TabPage class in\nconfigdialog.  Update existing classes to match outline.  Initial\npatch by Cheryl Sabella.\n\n- bpo-31050(18): Factor GenPage(Frame) class from ConfigDialog.  The\nslightly modified tests continue to pass.  Patch by Cheryl Sabella.\n\n- bpo-31004(19): IDLE - Factor FontPage(Frame) class from\nConfigDialog.  Slightly modified tests continue to pass.  Fix\nGeneral tests.  Patch mostly by Cheryl Sabella.\n\n- bpo-30781(20): IDLE - Use ttk widgets in ConfigDialog.  Patches by\nTerry Jan Reedy and Cheryl Sabella.\n\n- bpo-31060(21): IDLE - Finish rearranging methods of ConfigDialog\nGrouping methods pertaining to each tab and the buttons will aid\nwriting tests and improving the tabs and will enable splitting the\ngroups into classes.\n\n- bpo-30853(22): IDLE - Factor a VarTrace class out of ConfigDialog.\nInstance tracers manages pairs consisting of a tk variable and a\ncallback function.  When tracing is turned on, setting the variable\ncalls the function.  Test coverage for the new class is 100%.\n\n- bpo-31003(23): IDLE: Add more tests for General tab.\n\n- bpo-30993(24): IDLE - Improve configdialog font page and tests.  In\nconfigdialog: Document causal pathways in createfonttab\ndocstring.  Simplify some attribute names.  Move setsamples calls\nto varchangedfont (idea from Cheryl Sabella).  Move related\nfunctions to positions after the create widgets function.  In\ntestconfigdialog: Fix testfontset so not order dependent.  Fix\nrenamed testindentscale so it tests the widget.  Adjust tests for\nmovement of setsamples call.  Add tests for load functions.  Put\nall font tests in one class and tab indent tests in another.\nExcept for two lines, these tests completely cover the related\nfunctions.\n\n- bpo-30981(25): IDLE - Add more configdialog font page tests.\n\n- bpo-28523(26): IDLE: replace 'colour' with 'color' in configdialog.\n\n- bpo-30917(27): Add tests for idlelib.config.IdleConf.  Increase\ncoverage from 46% to 96%.  Patch by Louie Lu.\n\n- bpo-30934(28): Document coverage details for idlelib tests.  Add\nsection to idlelib/idle-test/README.txt.  Include check that\nbranches are taken both ways.  Exclude IDLE-specific code that does\nnot run during unit tests.\n\n- bpo-30913(29): IDLE: Document ConfigDialog tk Vars, methods, and\nwidgets in docstrings This will facilitate improving the dialog and\nsplitting up the class.  Original patch by Cheryl Sabella.\n\n- bpo-30899(30): IDLE: Add tests for ConfigParser subclasses in\nconfig.  Patch by Louie Lu.\n\n- bpo-30881(31): IDLE: Add docstrings to browser.py.  Patch by Cheryl\nSabella.\n\n- bpo-30851(32): IDLE: Remove unused variables in configdialog.  One\nis a duplicate, one is set but cannot be altered by users.  Patch\nby Cheryl Sabella.\n\n- bpo-30870(33): IDLE: In Settings dialog, select font with Up, Down\nkeys as well as mouse.  Initial patch by Louie Lu.\n\n- bpo-8231(34): IDLE: call config.IdleConf.GetUserCfgDir only once.\n\n- bpo-30779(35): IDLE: Factor ConfigChanges class from configdialog,\nput in config; test.  * In config, put dump test code in a\nfunction; run it and unittest in 'if name == 'main'.  * Add\nclass config.ConfigChanges based on changesclassv4.py on bpo\nissue.  * Add class testconfig.ChangesTest, partly using\nconfigdialogtestsv1.py.  * Revise configdialog to use\nConfigChanges; see tracker msg297804.  * Revise testconfigdialog\nto match configdialog changes.  * Remove configdialog functions\nunused or moved to ConfigChanges.  Cheryl Sabella contributed parts\nof the patch.\n\n- bpo-30777(36): IDLE: configdialog - Add docstrings and fix\ncomments.  Patch by Cheryl Sabella.\n\n- bpo-30495(37): IDLE: Improve textview with docstrings, PEP8 names,\nand more tests.  Patch by Cheryl Sabella.\n\n- bpo-30723(38): IDLE: Make several improvements to parenmatch.  Add\n'parens' style to highlight both opener and closer.  Make 'default'\nstyle, which is not default, a synonym for 'opener'.  Make\ntime-delay work the same with all styles.  Add help for config\ndialog extensions tab, including help for parenmatch.  Add new\ntests.  Original patch by Charles Wohlganger.\n\n- bpo-30674(39): IDLE: add docstrings to grep module.  Patch by\nCheryl Sabella\n\n- bpo-21519(40): IDLE's basic custom key entry dialog now detects\nduplicates properly.  Original patch by Saimadhav Heblikar.\n\n- bpo-29910(41): IDLE no longer deletes a character after commenting\nout a region by a key shortcut.  Add 'return 'break'' for this and\nother potential conflicts between IDLE and default key bindings.\n\n- bpo-30728(42): Review and change idlelib.configdialog names.\nLowercase method and attribute names.  Replace 'colour' with\n'color', expand overly cryptic names, delete unneeded underscores.\nReplace 'import *' with specific imports.  Patches by Cheryl\nSabella.\n\n- bpo-6739(43): IDLE: Verify user-entered key sequences by trying to\nbind them with tk.  Add tests for all 3 validation functions.\nOriginal patch by G Polo.  Tests added by Cheryl Sabella.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31493\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31488\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=31477\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=31480\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=31421\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=31414\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=31051\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=30617\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=31287\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=27099\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=31206\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=31001\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=31205\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=31130\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=31002\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=19903\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=31083\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=31050\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=31004\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=30781\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=31060\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=30853\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=31003\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=30993\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=30981\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=28523\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=30917\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=30934\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=30913\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=30899\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=30881\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=30851\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=30870\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=8231\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=30779\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=30777\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=30495\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=30723\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=30674\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=21519\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=29910\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=30728\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=6739\n\nFile: python3.12.info,  Node: Tools/Demos<34>,  Prev: IDLE<42>,  Up: Python 3 6 3 release candidate 1\n\n1.22.65.9 Tools/Demos\n.....................\n\n- bpo-30983(1): gdb integration commands (py-bt, etc.)  work on\noptimized shared builds now, too.  PEP 523(2) introduced\nPyEvalEvalFrameDefault which inlines PyEvalEvalFrameEx on\nnon-debug shared builds.  This broke the ability to use py-bt,\npy-up, and a few other Python-specific gdb integrations.  The\nproblem is fixed by only looking for PyEvalEvalFrameDefault\nframes in python-gdb.py.  Original patch by Bruno \"Polaco\"\nPenteado.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30983\n\n(2) https://peps.python.org/pep-0523/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 6 2 final,  Next: Python 3 6 2 release candidate 2,  Prev: Python 3 6 3 release candidate 1,  Up: Changelog": {
            "content": "'Release date: 2017-07-17'\n",
            "subsections": []
        },
        "No changes since release candidate 2": {
            "content": "",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 6 2 release candidate 2,  Next: Python 3 6 2 release candidate 1,  Prev: Python 3 6 2 final,  Up: Changelog": {
            "content": "'Release date: 2017-07-07'\n\n* Menu:\n\n* Security: Security<37>.\n\nFile: python3.12.info,  Node: Security<37>,  Up: Python 3 6 2 release candidate 2\n\n1.22.67.1 Security\n..................\n\n- bpo-30730(1): Prevent environment variables injection in subprocess\non Windows.  Prevent passing other environment variables and\ncommand arguments.\n\n- bpo-30694(2): Upgrade expat copy from 2.2.0 to 2.2.1 to get fixes\nof multiple security vulnerabilities including: CVE-2017-9233\n(External entity infinite loop DoS), CVE-2016-9063 (Integer\noverflow, re-fix), CVE-2016-0718 (Fix regression bugs from 2.2.0's\nfix to CVE-2016-0718) and CVE-2012-0876 (Counter hash flooding with\nSipHash).  Note: the CVE-2016-5300 (Use os-specific entropy sources\nlike getrandom) doesn't impact Python, since Python already gets\nentropy from the OS to set the expat secret using\n'XMLSetHashSalt()'.\n\n- bpo-30500(3): Fix urllib.parse.splithost() to correctly parse\nfragments.  For example, 'splithost('//127.0.0.1#@evil.com/')' now\ncorrectly returns the '127.0.0.1' host, instead of treating\n'@evil.com' as the host in an authentication ('login@host').\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30730\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=30694\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=30500\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 6 2 release candidate 1,  Next: Python 3 6 1 final,  Prev: Python 3 6 2 release candidate 2,  Up: Changelog": {
            "content": "'Release date: 2017-06-17'\n\n* Menu:\n\n* Security: Security<38>.\n* Core and Builtins: Core and Builtins<61>.\n* Library: Library<63>.\n* IDLE: IDLE<43>.\n* C API: C API<52>.\n* Build: Build<59>.\n* Documentation: Documentation<61>.\n* Tools/Demos: Tools/Demos<35>.\n* Tests: Tests<57>.\n* Windows: Windows<55>.\n\nFile: python3.12.info,  Node: Security<38>,  Next: Core and Builtins<61>,  Up: Python 3 6 2 release candidate 1\n\n1.22.68.1 Security\n..................\n\n- bpo-29591(1): Update expat copy from 2.1.1 to 2.2.0 to get fixes of\nCVE-2016-0718 and CVE-2016-4472.  See\n'https://sourceforge.net/p/expat/bugs/537/' for more information.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=29591\n\nFile: python3.12.info,  Node: Core and Builtins<61>,  Next: Library<63>,  Prev: Security<38>,  Up: Python 3 6 2 release candidate 1\n\n1.22.68.2 Core and Builtins\n...........................\n\n- bpo-30682(1): Removed a too-strict assertion that failed for\ncertain f-strings, such as eval(\"f'\\n'\") and eval(\"f'\\r'\").\n\n- bpo-30604(2): Move coextrafreefuncs to not be per-thread to avoid\ncrashes\n\n- bpo-29104(3): Fixed parsing backslashes in f-strings.\n\n- bpo-27945(4): Fixed various segfaults with dict when input\ncollections are mutated during searching, inserting or comparing.\nBased on patches by Duane Griffin and Tim Mitchell.\n\n- bpo-25794(5): Fixed type.setattr() and type.delattr() for\nnon-interned attribute names.  Based on patch by Eryk Sun.\n\n- bpo-30039(6): If a KeyboardInterrupt happens when the interpreter\nis in the middle of resuming a chain of nested 'yield from' or\n'await' calls, it's now correctly delivered to the innermost frame.\n\n- bpo-12414(7): sys.getsizeof() on a code object now returns the\nsizes which includes the code struct and sizes of objects which it\nreferences.  Patch by Donghee Na.\n\n- bpo-29949(8): Fix memory usage regression of set and frozenset\nobject.\n\n- bpo-29935(9): Fixed error messages in the index() method of tuple,\nlist and deque when pass indices of wrong type.\n\n- bpo-29859(10): Show correct error messages when any of the\npthread* calls in threadpthread.h fails.\n\n- bpo-28876(11): 'bool(range)' works even if 'len(range)' raises\n*note OverflowError: 68d.\n\n- bpo-29600(12): Fix wrapping coroutine return values in\nStopIteration.\n\n- bpo-28856(13): Fix an oversight that %b format for bytes should\nsupport objects follow the buffer protocol.\n\n- bpo-29714(14): Fix a regression that bytes format may fail when\ncontaining zero bytes inside.\n\n- bpo-29478(15): If maxlinelength=None is specified while using the\nCompat32 policy, it is no longer ignored.  Patch by Mircea Cosbuc.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30682\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=30604\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=29104\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=27945\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=25794\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=30039\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=12414\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=29949\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=29935\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=29859\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=28876\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=29600\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=28856\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=29714\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=29478\n\nFile: python3.12.info,  Node: Library<63>,  Next: IDLE<43>,  Prev: Core and Builtins<61>,  Up: Python 3 6 2 release candidate 1\n\n1.22.68.3 Library\n.................\n\n- bpo-30616(1): Functional API of enum allows to create empty enums.\nPatched by Donghee Na\n\n- bpo-30038(2): Fix race condition between signal delivery and wakeup\nfile descriptor.  Patch by Nathaniel Smith.\n\n- bpo-23894(3): lib2to3 now recognizes 'rb'...'' and 'f'...''\nstrings.\n\n- bpo-23890(4): unittest.TestCase.assertRaises() now manually breaks\na reference cycle to not keep objects alive longer than expected.\n\n- bpo-30149(5): inspect.signature() now supports callables with\nvariable-argument parameters wrapped with partialmethod.  Patch by\nDonghee Na.\n\n- bpo-30645(6): Fix path calculation in imp.loadpackage(), fixing it\nfor cases when a package is only shipped with bytecodes.  Patch by\nAlexandru Ardelean.\n\n- bpo-29931(7): Fixed comparison check for ipaddress.ipinterface\nobjects.  Patch by Sanjay Sundaresan.\n\n- bpo-30605(8): re.compile() no longer raises a BytesWarning when\ncompiling a bytes instance with misplaced inline modifier.  Patch\nby Roy Williams.\n\n- bpo-24484(9): Avoid race condition in multiprocessing cleanup\n(#2159)\n\n- bpo-28994(10): The traceback no longer displayed for SystemExit\nraised in a callback registered by atexit.\n\n- bpo-30508(11): Don't log exceptions if Task/Future \"cancel()\"\nmethod was called.\n\n- bpo-28556(12): Updates to typing module: Add generic\nAsyncContextManager, add support for ContextManager on all\nversions.  Original PRs by Jelle Zijlstra and Ivan Levkivskyi\n\n- bpo-29870(13): Fix ssl sockets leaks when connection is aborted in\nasyncio/ssl implementation.  Patch by Michae\"l Sgha??er.\n\n- bpo-29743(14): Closing transport during handshake process leaks\nopen socket.  Patch by Nikolay Kim\n\n- bpo-27585(15): Fix waiter cancellation in asyncio.Lock.  Patch by\nMathieu Sornay.\n\n- bpo-30418(16): On Windows, subprocess.Popen.communicate() now also\nignore EINVAL on stdin.write() if the child process is still\nrunning but closed the pipe.\n\n- bpo-29822(17): inspect.isabstract() now works during\ninitsubclass.  Patch by Nate Soares.\n\n- bpo-29581(18): ABCMeta.new now accepts 'kwargs', allowing\nabstract base classes to use keyword parameters in\ninitsubclass.  Patch by Nate Soares.\n\n- bpo-30557(19): faulthandler now correctly filters and displays\nexception codes on Windows\n\n- bpo-30378(20): Fix the problem that logging.handlers.SysLogHandler\ncannot handle IPv6 addresses.\n\n- bpo-29960(21): Preserve generator state when\nrandom.Random.setstate() raises an exception.  Patch by Bryan\nOlson.\n\n- bpo-30414(22): multiprocessing.Queue.feed background running\nthread do not break from main loop on exception.\n\n- bpo-30003(23): Fix handling escape characters in HZ codec.  Based\non patch by Ma Lin.\n\n- bpo-30301(24): Fix AttributeError when using SimpleQueue.empty()\nunder 'spawn' and 'forkserver' start methods.\n\n- bpo-30329(25): imaplib and poplib now catch the Windows socket\nWSAEINVAL error (code 10022) on shutdown(SHUTRDWR): An invalid\noperation was attempted.  This error occurs sometimes on SSL\nconnections.\n\n- bpo-30375(26): Warnings emitted when compile a regular expression\nnow always point to the line in the user code.  Previously they\ncould point into inners of the re module if emitted from inside of\ngroups or conditionals.\n\n- bpo-30048(27): Fixed 'Task.cancel()' can be ignored when the task\nis running coroutine and the coroutine returned without any more\n'await'.\n\n- bpo-30266(28): contextlib.AbstractContextManager now supports\nanti-registration by setting enter = None or exit = None,\nfollowing the pattern introduced in bpo-25958(29).  Patch by Jelle\nZijlstra.\n\n- bpo-30298(30): Weaken the condition of deprecation warnings for\ninline modifiers.  Now allowed several subsequential inline\nmodifiers at the start of the pattern (e.g.  ''(?i)(?s)...'').  In\nverbose mode whitespaces and comments now are allowed before and\nbetween inline modifiers (e.g.  ''(?x) (?i) (?s)...'').\n\n- bpo-29990(31): Fix range checking in GB18030 decoder.  Original\npatch by Ma Lin.\n\n- bpo-26293(32): Change resulted because of zipfile breakage.  (See\nalso: bpo-29094(33))\n\n- bpo-30243(34): Removed the init methods of json's scanner and\nencoder.  Misusing them could cause memory leaks or crashes.  Now\nscanner and encoder objects are completely initialized in the\nnew methods.\n\n- bpo-30185(35): Avoid KeyboardInterrupt tracebacks in forkserver\nhelper process when Ctrl-C is received.\n\n- bpo-28556(36): Various updates to typing module: add\ntyping.NoReturn type, use WrapperDescriptorType, minor bug-fixes.\nOriginal PRs by Jim Fasarakis-Hilliard and Ivan Levkivskyi.\n\n- bpo-30205(37): Fix getsockname() for unbound AFUNIX sockets on\nLinux.\n\n- bpo-30070(38): Fixed leaks and crashes in errors handling in the\nparser module.\n\n- bpo-30061(39): Fixed crashes in IOBase methods next() and\nreadlines() when readline() or next() respectively return\nnon-sizeable object.  Fixed possible other errors caused by not\nchecking results of PyObjectSize(), PySequenceSize(), or\nPyMappingSize().\n\n- bpo-30017(40): Allowed calling the close() method of the zip entry\nwriter object multiple times.  Writing to a closed writer now\nalways produces a ValueError.\n\n- bpo-30068(41): io.IOBase.readlines will check if it's closed\nfirst when hint is present.\n\n- bpo-29694(42): Fixed race condition in pathlib mkdir with flags\nparents=True.  Patch by Armin Rigo.\n\n- bpo-29692(43): Fixed arbitrary unchaining of RuntimeError\nexceptions in contextlib.contextmanager.  Patch by Siddharth\nVelankar.\n\n- bpo-29998(44): Pickling and copying ImportError now preserves name\nand path attributes.\n\n- bpo-29953(45): Fixed memory leaks in the replace() method of\ndatetime and time objects when pass out of bound fold argument.\n\n- bpo-29942(46): Fix a crash in itertools.chain.fromiterable when\nencountering long runs of empty iterables.\n\n- bpo-27863(47): Fixed multiple crashes in ElementTree caused by race\nconditions and wrong types.\n\n- bpo-28699(48): Fixed a bug in pools in multiprocessing.pool that\nraising an exception at the very first of an iterable may swallow\nthe exception or make the program hang.  Patch by Davin Potts and\nXiang Zhang.\n\n- bpo-25803(49): Avoid incorrect errors raised by\nPath.mkdir(existok=True) when the OS gives priority to errors such\nas EACCES over EEXIST.\n\n- bpo-29861(50): Release references to tasks, their arguments and\ntheir results as soon as they are finished in multiprocessing.Pool.\n\n- bpo-29884(51): faulthandler: Restore the old sigaltstack during\nteardown.  Patch by Christophe Zeitouny.\n\n- bpo-25455(52): Fixed crashes in repr of recursive buffered\nfile-like objects.\n\n- bpo-29800(53): Fix crashes in partial.repr if the keys of\npartial.keywords are not strings.  Patch by Michael Seifert.\n\n- bpo-29742(54): getextrainfo() raises exception if get called on\nclosed ssl transport.  Patch by Nikolay Kim.\n\n- bpo-8256(55): Fixed possible failing or crashing input() if\nattributes \"encoding\" or \"errors\" of sys.stdin or sys.stdout are\nnot set or are not strings.\n\n- bpo-28298(56): Fix a bug that prevented array 'Q', 'L' and 'I' from\naccepting big intables (objects that have int) as elements.\nPatch by Oren Milman.\n\n- bpo-28231(57): The zipfile module now accepts path-like objects for\nexternal paths.\n\n- bpo-26915(58): index() and count() methods of\ncollections.abc.Sequence now check identity before checking\nequality when do comparisons.\n\n- bpo-29615(59): SimpleXMLRPCDispatcher no longer chains KeyError (or\nany other exception) to exception(s) raised in the dispatched\nmethods.  Patch by Petr Motejlek.\n\n- bpo-30177(60): path.resolve(strict=False) no longer cuts the path\nafter the first element not present in the filesystem.  Patch by\nAntoine Pietri.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30616\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=30038\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=23894\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=23890\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=30149\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=30645\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=29931\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=30605\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=24484\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=28994\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=30508\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=28556\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=29870\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=29743\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=27585\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=30418\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=29822\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=29581\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=30557\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=30378\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=29960\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=30414\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=30003\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=30301\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=30329\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=30375\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=30048\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=30266\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=25958\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=30298\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=29990\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=26293\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=29094\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=30243\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=30185\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=28556\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=30205\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=30070\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=30061\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=30017\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=30068\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=29694\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=29692\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=29998\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=29953\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=29942\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=27863\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=28699\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=25803\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=29861\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=29884\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=25455\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=29800\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=29742\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=8256\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=28298\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=28231\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=26915\n\n(59) https://bugs.python.org/issue?@action=redirect&bpo=29615\n\n(60) https://bugs.python.org/issue?@action=redirect&bpo=30177\n\nFile: python3.12.info,  Node: IDLE<43>,  Next: C API<52>,  Prev: Library<63>,  Up: Python 3 6 2 release candidate 1\n\n1.22.68.4 IDLE\n..............\n\n- bpo-15786(1): Fix several problems with IDLE's autocompletion box.\nThe following should now work: clicking on selection box items;\nusing the scrollbar; selecting an item by hitting Return.  Hangs on\nMacOSX should no longer happen.  Patch by Louie Lu.\n\n- bpo-25514(2): Add doc subsubsection about IDLE failure to start.\nPopup no-connection message directs users to this section.\n\n- bpo-30642(3): Fix reference leaks in IDLE tests.  Patches by Louie\nLu and Terry Jan Reedy.\n\n- bpo-30495(4): Add docstrings for textview.py and use PEP8 names.\nPatches by Cheryl Sabella and Terry Jan Reedy.\n\n- bpo-30290(5): Help-about: use pep8 names and add tests.  Increase\ncoverage to 100%.  Patches by Louie Lu, Cheryl Sabella, and Terry\nJan Reedy.\n\n- bpo-30303(6): Add utest option to textview; add new tests.\nIncrease coverage to 100%.  Patches by Louie Lu and Terry Jan\nReedy.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=15786\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=25514\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=30642\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=30495\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=30290\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=30303\n\nFile: python3.12.info,  Node: C API<52>,  Next: Build<59>,  Prev: IDLE<43>,  Up: Python 3 6 2 release candidate 1\n\n1.22.68.5 C API\n...............\n\n- bpo-27867(1): Function PySliceGetIndicesEx() no longer replaced\nwith a macro if PyLIMITEDAPI is not set.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27867\n\nFile: python3.12.info,  Node: Build<59>,  Next: Documentation<61>,  Prev: C API<52>,  Up: Python 3 6 2 release candidate 1\n\n1.22.68.6 Build\n...............\n\n- bpo-29941(1): Add '--with-assertions' configure flag to explicitly\nenable C 'assert()' checks.  Defaults to off.  '--with-pydebug'\nimplies '--with-assertions'.\n\n- bpo-28787(2): Fix out-of-tree builds of Python when configured with\n'--with--dtrace'.\n\n- bpo-29243(3): Prevent unnecessary rebuilding of Python during 'make\ntest', 'make install' and some other make targets when configured\nwith '--enable-optimizations'.\n\n- bpo-23404(4): Don't regenerate generated files based on file\nmodification time anymore: the action is now explicit.  Replace\n'make touch' with 'make regen-all'.\n\n- bpo-29643(5): Fix '--enable-optimization' didn't work.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=29941\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=28787\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=29243\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=23404\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=29643\n\nFile: python3.12.info,  Node: Documentation<61>,  Next: Tools/Demos<35>,  Prev: Build<59>,  Up: Python 3 6 2 release candidate 1\n\n1.22.68.7 Documentation\n.......................\n\n- bpo-30176(1): Add missing attribute related constants in curses\ndocumentation.\n\n- bpo-30052(2): the link targets for *note bytes(): 295. and *note\nbytearray(): 294. are now their respective type definitions, rather\nthan the corresponding builtin function entries.  Use *note bytes:\n183c. and *note bytearray: 183d. to reference the latter.  In order\nto ensure this and future cross-reference updates are applied\nautomatically, the daily documentation builds now disable the\ndefault output caching features in Sphinx.\n\n- bpo-26985(3): Add missing info of code object in inspect\ndocumentation.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30176\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=30052\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=26985\n\nFile: python3.12.info,  Node: Tools/Demos<35>,  Next: Tests<57>,  Prev: Documentation<61>,  Up: Python 3 6 2 release candidate 1\n\n1.22.68.8 Tools/Demos\n.....................\n\n- bpo-29367(1): python-gdb.py now supports also 'method-wrapper'\n('wrapperobject') objects.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=29367\n\nFile: python3.12.info,  Node: Tests<57>,  Next: Windows<55>,  Prev: Tools/Demos<35>,  Up: Python 3 6 2 release candidate 1\n\n1.22.68.9 Tests\n...............\n\n- bpo-30357(1): testthread: setUp() now uses\nsupport.threadingsetup() and support.threadingcleanup() to wait\nuntil threads complete to avoid random side effects on following\ntests.  Initial patch written by Grzegorz Grzywacz.\n\n- bpo-30197(2): Enhanced functions swapattr() and swapitem() in the\ntest.support module.  They now work when delete replaced attribute\nor item inside the with statement.  The old value of the attribute\nor item (or None if it doesn't exist) now will be assigned to the\ntarget of the \"as\" clause, if there is one.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30357\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=30197\n\nFile: python3.12.info,  Node: Windows<55>,  Prev: Tests<57>,  Up: Python 3 6 2 release candidate 1\n\n1.22.68.10 Windows\n..................\n\n- bpo-30687(1): Locate msbuild.exe on Windows when building rather\nthan vcvarsall.bat\n\n- bpo-30450(2): The build process on Windows no longer depends on\nSubversion, instead pulling external code from GitHub via a Python\nscript.  If Python 3.6 is not found on the system (via 'py -3.6'),\nNuGet is used to download a copy of 32-bit Python.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30687\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=30450\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 6 1 final,  Next: Python 3 6 1 release candidate 1,  Prev: Python 3 6 2 release candidate 1,  Up: Changelog": {
            "content": "'Release date: 2017-03-21'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<62>.\n* Build: Build<60>.\n\nFile: python3.12.info,  Node: Core and Builtins<62>,  Next: Build<60>,  Up: Python 3 6 1 final\n\n1.22.69.1 Core and Builtins\n...........................\n\n- bpo-29723(1): The 'sys.path[0]' initialization change for\nbpo-29139(2) caused a regression by revealing an inconsistency in\nhow sys.path is initialized when executing 'main' from a\nzipfile, directory, or other import location.  The interpreter now\nconsistently avoids ever adding the import location's parent\ndirectory to 'sys.path', and ensures no other 'sys.path' entries\nare inadvertently modified when inserting the import location named\non the command line.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=29723\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=29139\n\nFile: python3.12.info,  Node: Build<60>,  Prev: Core and Builtins<62>,  Up: Python 3 6 1 final\n\n1.22.69.2 Build\n...............\n\n- bpo-27593(1): fix format of git information used in sys.version\n\n- Fix incompatible comment in python.h\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27593\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 6 1 release candidate 1,  Next: Python 3 6 0 final,  Prev: Python 3 6 1 final,  Up: Changelog": {
            "content": "'Release date: 2017-03-04'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<63>.\n* Library: Library<64>.\n* IDLE: IDLE<44>.\n* Windows: Windows<56>.\n* C API: C API<53>.\n* Documentation: Documentation<62>.\n* Tests: Tests<58>.\n* Build: Build<61>.\n\nFile: python3.12.info,  Node: Core and Builtins<63>,  Next: Library<64>,  Up: Python 3 6 1 release candidate 1\n\n1.22.70.1 Core and Builtins\n...........................\n\n- bpo-28893(1): Set correct cause for errors about invalid\nawaitables returned from aiter and anext.\n\n- bpo-29683(2): Fixes to memory allocation in PyCodeSetExtra.\nPatch by Brian Coleman.\n\n- bpo-29684(3): Fix minor regression of\nPyEvalCallObjectWithKeywords.  It should raise TypeError when\nkwargs is not a dict.  But it might cause segv when args=NULL and\nkwargs is not a dict.\n\n- bpo-28598(4): Support rmod for subclasses of str being called\nbefore str.mod.  Patch by Martijn Pieters.\n\n- bpo-29607(5): Fix stackeffect computation for CALLFUNCTIONEX.\nPatch by Matthieu Dartiailh.\n\n- bpo-29602(6): Fix incorrect handling of signed zeros in complex\nconstructor for complex subclasses and for inputs having a\ncomplex method.  Patch by Serhiy Storchaka.\n\n- bpo-29347(7): Fixed possibly dereferencing undefined pointers when\ncreating weakref objects.\n\n- bpo-29438(8): Fixed use-after-free problem in key sharing dict.\n\n- bpo-29319(9): Prevent RunMainFromImporter overwriting sys.path[0].\n\n- bpo-29337(10): Fixed possible BytesWarning when compare the code\nobjects.  Warnings could be emitted at compile time.\n\n- bpo-29327(11): Fixed a crash when pass the iterable keyword\nargument to sorted().\n\n- bpo-29034(12): Fix memory leak and use-after-free in os module\n(pathconverter).\n\n- bpo-29159(13): Fix regression in bytes(x) when x.index() raises\nException.\n\n- bpo-28932(14): Do not include <sys/random.h> if it does not exist.\n\n- bpo-25677(15): Correct the positioning of the syntax error caret\nfor indented blocks.  Based on patch by Michael Layzell.\n\n- bpo-29000(16): Fixed bytes formatting of octals with zero padding\nin alternate form.\n\n- bpo-26919(17): On Android, operating system data is now always\nencoded/decoded to/from UTF-8, instead of the locale encoding to\navoid inconsistencies with os.fsencode() and os.fsdecode() which\nare already using UTF-8.\n\n- bpo-28991(18): functools.lrucache() was susceptible to an obscure\nreentrancy bug triggerable by a monkey-patched len() function.\n\n- bpo-28739(19): f-string expressions are no longer accepted as\ndocstrings and by ast.literaleval() even if they do not include\nexpressions.\n\n- bpo-28512(20): Fixed setting the offset attribute of SyntaxError by\nPyErrSyntaxLocationEx() and PyErrSyntaxLocationObject().\n\n- bpo-28918(21): Fix the cross compilation of xxlimited when Python\nhas been built with PyDEBUG defined.\n\n- bpo-28731(22): Optimize PyDictNewPresized() to create correct\nsize dict.  Improve speed of dict literal with constant keys up to\n30%.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28893\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=29683\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=29684\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=28598\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=29607\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=29602\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=29347\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=29438\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=29319\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=29337\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=29327\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=29034\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=29159\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=28932\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=25677\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=29000\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=26919\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=28991\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=28739\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=28512\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=28918\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=28731\n\nFile: python3.12.info,  Node: Library<64>,  Next: IDLE<44>,  Prev: Core and Builtins<63>,  Up: Python 3 6 1 release candidate 1\n\n1.22.70.2 Library\n.................\n\n- bpo-29169(1): Update zlib to 1.2.11.\n\n- bpo-29623(2): Allow use of path-like object as a single argument in\nConfigParser.read().  Patch by David Ellis.\n\n- bpo-28963(3): Fix out of bound iteration in\nasyncio.Future.removedonecallback implemented in C.\n\n- bpo-29704(4): asyncio.subprocess.SubprocessStreamProtocol no longer\ncloses before all pipes are closed.\n\n- bpo-29271(5): Fix Task.currenttask and Task.alltasks implemented\nin C to accept None argument as their pure Python implementation.\n\n- bpo-29703(6): Fix asyncio to support instantiation of new event\nloops in child processes.\n\n- bpo-29376(7): Fix assertion error in\nthreading.DummyThread.isalive().\n\n- bpo-28624(8): Add a test that checks that cwd parameter of Popen()\naccepts PathLike objects.  Patch by Sayan Chowdhury.\n\n- bpo-28518(9): Start a transaction implicitly before a DML\nstatement.  Patch by Aviv Palivoda.\n\n- bpo-29532(10): Altering a kwarg dictionary passed to\nfunctools.partial() no longer affects a partial object after\ncreation.\n\n- bpo-29110(11): Fix file object leak in aifc.open() when file is\ngiven as a filesystem path and is not in valid AIFF format.  Patch\nby Anthony Zhang.\n\n- bpo-28556(12): Various updates to typing module: typing.Counter,\ntyping.ChainMap, improved ABC caching, etc.  Original PRs by Jelle\nZijlstra, Ivan Levkivskyi, Manuel Krebber, and ??ukasz Langa.\n\n- bpo-29100(13): Fix datetime.fromtimestamp() regression introduced\nin Python 3.6.0: check minimum and maximum years.\n\n- bpo-29519(14): Fix weakref spewing exceptions during interpreter\nshutdown when used with a rare combination of multiprocessing and\ncustom codecs.\n\n- bpo-29416(15): Prevent infinite loop in pathlib.Path.mkdir\n\n- bpo-29444(16): Fixed out-of-bounds buffer access in the group()\nmethod of the match object.  Based on patch by WGH.\n\n- bpo-29335(17): Fix subprocess.Popen.wait() when the child process\nhas exited to a stopped instead of terminated state (ex: when under\nptrace).\n\n- bpo-29290(18): Fix a regression in argparse that help messages\nwould wrap at non-breaking spaces.\n\n- bpo-28735(19): Fixed the comparison of mock.MagickMock with\nmock.ANY.\n\n- bpo-29316(20): Restore the provisional status of typing module, add\ncorresponding note to documentation.  Patch by Ivan L.\n\n- bpo-29219(21): Fixed infinite recursion in the repr of\nuninitialized ctypes.CDLL instances.\n\n- bpo-29011(22): Fix an important omission by adding Deque to the\ntyping module.\n\n- bpo-28969(23): Fixed race condition in C implementation of\nfunctools.lrucache.  KeyError could be raised when cached function\nwith full cache was simultaneously called from different threads\nwith the same uncached arguments.\n\n- bpo-29142(24): In urllib.request, suffixes in noproxy environment\nvariable with leading dots could match related hostnames again\n(e.g.  .b.c matches a.b.c).  Patch by Milan Oberkirch.\n\n- bpo-28961(25): Fix unittest.mock.Call helper: don't ignore the\nname parameter anymore.  Patch written by Jiajun Huang.\n\n- bpo-29203(26): functools.lrucache() now respects PEP 468(27) and\npreserves the order of keyword arguments.  f(a=1, b=2) is now\ncached separately from f(b=2, a=1) since both calls could\npotentially give different results.\n\n- bpo-15812(28): inspect.getframeinfo() now correctly shows the first\nline of a context.  Patch by Sam Breese.\n\n- bpo-29094(29): Offsets in a ZIP file created with extern file\nobject and modes \"w\" and \"x\" now are relative to the start of the\nfile.\n\n- bpo-29085(30): Allow random.Random.seed() to use high quality OS\nrandomness rather than the pid and time.\n\n- bpo-29061(31): Fixed bug in secrets.randbelow() which would hang\nwhen given a negative input.  Patch by Brendan Donegan.\n\n- bpo-29079(32): Prevent infinite loop in pathlib.resolve() on\nWindows\n\n- bpo-13051(33): Fixed recursion errors in large or resized\ncurses.textpad.Textbox.  Based on patch by Tycho Andersen.\n\n- bpo-29119(34): Fix weakrefs in the pure python version of\ncollections.OrderedDict movetoend() method.  Contributed by Andra\nBogildea.\n\n- bpo-9770(35): curses.ascii predicates now work correctly with\nnegative integers.\n\n- bpo-28427(36): old keys should not remove new values from\nWeakValueDictionary when collecting from another thread.\n\n- bpo-28923(37): Remove editor artifacts from Tix.py.\n\n- bpo-29055(38): Neaten-up empty population error on random.choice()\nby suppressing the upstream exception.\n\n- bpo-28871(39): Fixed a crash when deallocate deep ElementTree.\n\n- bpo-19542(40): Fix bugs in WeakValueDictionary.setdefault() and\nWeakValueDictionary.pop() when a GC collection happens in another\nthread.\n\n- bpo-20191(41): Fixed a crash in resource.prlimit() when passing a\nsequence that doesn't own its elements as limits.\n\n- bpo-28779(42): multiprocessing.setforkserverpreload() would crash\nthe forkserver process if a preloaded module instantiated some\nmultiprocessing objects such as locks.\n\n- bpo-28847(43): dbm.dumb now supports reading read-only files and no\nlonger writes the index file when it is not changed.\n\n- bpo-26937(44): The chown() method of the tarfile.TarFile class does\nnot fail now when the grp module cannot be imported, as for example\non Android platforms.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=29169\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=29623\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=28963\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=29704\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=29271\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=29703\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=29376\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=28624\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=28518\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=29532\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=29110\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=28556\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=29100\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=29519\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=29416\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=29444\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=29335\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=29290\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=28735\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=29316\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=29219\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=29011\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=28969\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=29142\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=28961\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=29203\n\n(27) https://peps.python.org/pep-0468/\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=15812\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=29094\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=29085\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=29061\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=29079\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=13051\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=29119\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=9770\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=28427\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=28923\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=29055\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=28871\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=19542\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=20191\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=28779\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=28847\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=26937\n\nFile: python3.12.info,  Node: IDLE<44>,  Next: Windows<56>,  Prev: Library<64>,  Up: Python 3 6 1 release candidate 1\n\n1.22.70.3 IDLE\n..............\n\n- bpo-29071(1): IDLE colors f-string prefixes (but not invalid ur\nprefixes).\n\n- bpo-28572(2): Add 10% to coverage of IDLE's testconfigdialog.\nUpdate and augment description of the configuration system.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=29071\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=28572\n\nFile: python3.12.info,  Node: Windows<56>,  Next: C API<53>,  Prev: IDLE<44>,  Up: Python 3 6 1 release candidate 1\n\n1.22.70.4 Windows\n.................\n\n- bpo-29579(1): Removes readme.txt from the installer\n\n- bpo-29326(2): Ignores blank lines in .pth files (Patch by Alexey\nIzbyshev)\n\n- bpo-28164(3): Correctly handle special console filenames (patch by\nEryk Sun)\n\n- bpo-29409(4): Implement PEP 529(5) for io.FileIO (Patch by Eryk\nSun)\n\n- bpo-29392(6): Prevent crash when passing invalid arguments into\nmsvcrt module.\n\n- bpo-25778(7): winreg does not truncate string correctly (Patch by\nEryk Sun)\n\n- bpo-28896(8): Deprecate WindowsRegistryFinder and disable it by\ndefault.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=29579\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=29326\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=28164\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=29409\n\n(5) https://peps.python.org/pep-0529/\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=29392\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=25778\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=28896\n\nFile: python3.12.info,  Node: C API<53>,  Next: Documentation<62>,  Prev: Windows<56>,  Up: Python 3 6 1 release candidate 1\n\n1.22.70.5 C API\n...............\n\n- bpo-27867(1): Function PySliceGetIndicesEx() is replaced with a\nmacro if PyLIMITEDAPI is not set or set to the value between\n0x03050400 and 0x03060000 (not including) or 0x03060100 or higher.\n\n- bpo-29083(2): Fixed the declaration of some public API functions.\nPyArgVaParse() and PyArgVaParseTupleAndKeywords() were not\navailable in limited API. PyArgValidateKeywordArguments(),\nPyArgUnpackTuple() and PyBuildValue() were not available in\nlimited API of version < 3.3 when PYSSIZETCLEAN is defined.\n\n- bpo-29058(3): All stable API extensions added after Python 3.2 are\nnow available only when PyLIMITEDAPI is set to the PYVERSIONHEX\nvalue of the minimum Python version supporting this API.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27867\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=29083\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=29058\n\nFile: python3.12.info,  Node: Documentation<62>,  Next: Tests<58>,  Prev: C API<53>,  Up: Python 3 6 1 release candidate 1\n\n1.22.70.6 Documentation\n.......................\n\n- bpo-28929(1): Link the documentation to its source file on GitHub.\n\n- bpo-25008(2): Document smtpd.py as effectively deprecated and add a\npointer to aiosmtpd, a third-party asyncio-based replacement.\n\n- bpo-26355(3): Add canonical header link on each page to\ncorresponding major version of the documentation.  Patch by\nMatthias Bussonnier.\n\n- bpo-29349(4): Fix Python 2 syntax in code for building the\ndocumentation.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28929\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=25008\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=26355\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=29349\n\nFile: python3.12.info,  Node: Tests<58>,  Next: Build<61>,  Prev: Documentation<62>,  Up: Python 3 6 1 release candidate 1\n\n1.22.70.7 Tests\n...............\n\n- bpo-28087(1): Skip testasyncore and testeintr poll failures on\nmacOS. Skip some tests of select.poll when running on macOS due to\nunresolved issues with the underlying system poll function on some\nmacOS versions.\n\n- bpo-29571(2): to match the behaviour of the 're.LOCALE' flag,\ntestre.testlocaleflag now uses\n'locale.getpreferredencoding(False)' to determine the candidate\nencoding for the test regex (allowing it to correctly skip the test\nwhen the default locale encoding is a multi-byte encoding)\n\n- bpo-28950(3): Disallow -j0 to be combined with -T/-l in regrtest\ncommand line arguments.\n\n- bpo-28683(4): Fix the tests that bind() a unix socket and raise\nPermissionError on Android for a non-root user.\n\n- bpo-26939(5): Add the support.setswitchinterval() function to fix\ntestfunctools hanging on the Android armv7 qemu emulator.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28087\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=29571\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=28950\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=28683\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=26939\n\nFile: python3.12.info,  Node: Build<61>,  Prev: Tests<58>,  Up: Python 3 6 1 release candidate 1\n\n1.22.70.8 Build\n...............\n\n- bpo-27593(1): sys.version and the platform module pythonbuild(),\npythonbranch(), and pythonrevision() functions now use git\ninformation rather than hg when building from a repo.\n\n- bpo-29572(2): Update Windows build and OS X installers to use\nOpenSSL 1.0.2k.\n\n- bpo-26851(3): Set Android compilation and link flags.\n\n- bpo-28768(4): Fix implicit declaration of function setmode.  Patch\nby Masayuki Yamamoto\n\n- bpo-29080(5): Removes hard dependency on hg.exe from\nPCBuild/build.bat\n\n- bpo-23903(6): Added missed names to PC/python3.def.\n\n- bpo-28762(7): lockf() is available on Android API level 24, but the\nFLOCK macro is not defined in android-ndk-r13.\n\n- bpo-28538(8): Fix the compilation error that occurs because\nifnameindex() is available on Android API level 24, but the\nifnameindex structure is not defined.\n\n- bpo-20211(9): Do not add the directory for installing C header\nfiles and the directory for installing object code libraries to the\ncross compilation search paths.  Original patch by Thomas\nPetazzoni.\n\n- bpo-28849(10): Do not define sys.implementation.multiarch on\nAndroid.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27593\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=29572\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=26851\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=28768\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=29080\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=23903\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=28762\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=28538\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=20211\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=28849\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 6 0 final,  Next: Python 3 6 0 release candidate 2,  Prev: Python 3 6 1 release candidate 1,  Up: Changelog": {
            "content": "'Release date: 2016-12-23'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 6 0 release candidate 2,  Next: Python 3 6 0 release candidate 1,  Prev: Python 3 6 0 final,  Up: Changelog": {
            "content": "'Release date: 2016-12-16'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<64>.\n* Tools/Demos: Tools/Demos<36>.\n* Windows: Windows<57>.\n* Build: Build<62>.\n\nFile: python3.12.info,  Node: Core and Builtins<64>,  Next: Tools/Demos<36>,  Up: Python 3 6 0 release candidate 2\n\n1.22.72.1 Core and Builtins\n...........................\n\n- bpo-28147(1): Fix a memory leak in split-table dictionaries:\nsetattr() must not convert combined table into split table.  Patch\nwritten by INADA Naoki.\n\n- bpo-28990(2): Fix asyncio SSL hanging if connection is closed\nbefore handshake is completed.  (Patch by HoHo-Ho)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28147\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=28990\n\nFile: python3.12.info,  Node: Tools/Demos<36>,  Next: Windows<57>,  Prev: Core and Builtins<64>,  Up: Python 3 6 0 release candidate 2\n\n1.22.72.2 Tools/Demos\n.....................\n\n- bpo-28770(1): Fix python-gdb.py for fastcalls.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28770\n\nFile: python3.12.info,  Node: Windows<57>,  Next: Build<62>,  Prev: Tools/Demos<36>,  Up: Python 3 6 0 release candidate 2\n\n1.22.72.3 Windows\n.................\n\n- bpo-28896(1): Deprecate WindowsRegistryFinder.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28896\n\nFile: python3.12.info,  Node: Build<62>,  Prev: Windows<57>,  Up: Python 3 6 0 release candidate 2\n\n1.22.72.4 Build\n...............\n\n- bpo-28898(1): Prevent gdb build errors due to HAVELONGLONG\nredefinition.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28898\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 6 0 release candidate 1,  Next: Python 3 6 0 beta 4,  Prev: Python 3 6 0 release candidate 2,  Up: Changelog": {
            "content": "'Release date: 2016-12-06'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<65>.\n* Library: Library<65>.\n* C API: C API<54>.\n* Documentation: Documentation<63>.\n* Tools/Demos: Tools/Demos<37>.\n\nFile: python3.12.info,  Node: Core and Builtins<65>,  Next: Library<65>,  Up: Python 3 6 0 release candidate 1\n\n1.22.73.1 Core and Builtins\n...........................\n\n- bpo-23722(1): Rather than silently producing a class that doesn't\nsupport zero-argument 'super()' in methods, failing to pass the new\n'classcell' namespace entry up to 'type.new' now results in\na 'DeprecationWarning' and a class that supports zero-argument\n'super()'.\n\n- bpo-28797(2): Modifying the class dict inside the setname\nmethod of a descriptor that is used inside that class no longer\nprevents calling the setname method of other descriptors.\n\n- bpo-28782(3): Fix a bug in the implementation 'yield from' when\nchecking if the next instruction is YIELDFROM. Regression\nintroduced by WORDCODE (bpo-26647(4)).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23722\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=28797\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=28782\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=26647\n\nFile: python3.12.info,  Node: Library<65>,  Next: C API<54>,  Prev: Core and Builtins<65>,  Up: Python 3 6 0 release candidate 1\n\n1.22.73.2 Library\n.................\n\n- bpo-27030(1): Unknown escapes in re.sub() replacement template are\nallowed again.  But they still are deprecated and will be disabled\nin 3.7.\n\n- bpo-28835(2): Fix a regression introduced in\nwarnings.catchwarnings(): call warnings.showwarning() if it was\noverridden inside the context manager.\n\n- bpo-27172(3): To assist with upgrades from 2.7, the previously\ndocumented deprecation of 'inspect.getfullargspec()' has been\nreversed.  This decision may be revisited again after the Python\n2.7 branch is no longer officially supported.\n\n- bpo-26273(4): Add new 'socket.TCPCONGESTION' (Linux 2.6.13) and\n'socket.TCPUSERTIMEOUT' (Linux 2.6.37) constants.  Patch written\nby Omar Sandoval.\n\n- bpo-24142(5): Reading a corrupt config file left configparser in an\ninvalid state.  Original patch by Florian Ho\"ch.\n\n- bpo-28843(6): Fix asyncio C Task to handle exceptions\ntraceback.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27030\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=28835\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=27172\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=26273\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=24142\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=28843\n\nFile: python3.12.info,  Node: C API<54>,  Next: Documentation<63>,  Prev: Library<65>,  Up: Python 3 6 0 release candidate 1\n\n1.22.73.3 C API\n...............\n\n- bpo-28808(1): PyUnicodeCompareWithASCIIString() now never raises\nexceptions.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28808\n\nFile: python3.12.info,  Node: Documentation<63>,  Next: Tools/Demos<37>,  Prev: C API<54>,  Up: Python 3 6 0 release candidate 1\n\n1.22.73.4 Documentation\n.......................\n\n- bpo-23722(1): The data model reference and the porting section in\nthe What's New guide now cover the additional 'classcell'\nhandling needed for custom metaclasses to fully support PEP 487(2)\nand zero-argument 'super()'.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23722\n\n(2) https://peps.python.org/pep-0487/\n\nFile: python3.12.info,  Node: Tools/Demos<37>,  Prev: Documentation<63>,  Up: Python 3 6 0 release candidate 1\n\n1.22.73.5 Tools/Demos\n.....................\n\n- bpo-28023(1): Fix python-gdb.py didn't support new dict\nimplementation.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28023\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 6 0 beta 4,  Next: Python 3 6 0 beta 3,  Prev: Python 3 6 0 release candidate 1,  Up: Changelog": {
            "content": "'Release date: 2016-11-21'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<66>.\n* Library: Library<66>.\n* Documentation: Documentation<64>.\n* Tests: Tests<59>.\n* Build: Build<63>.\n\nFile: python3.12.info,  Node: Core and Builtins<66>,  Next: Library<66>,  Up: Python 3 6 0 beta 4\n\n1.22.74.1 Core and Builtins\n...........................\n\n- bpo-28532(1): Show sys.version when -V option is supplied twice.\n\n- bpo-27100(2): The with-statement now checks for enter before it\nchecks for exit.  This gives less confusing error messages when\nboth methods are missing.  Patch by Jonathan Ellington.\n\n- bpo-28746(3): Fix the setinheritable() file descriptor method on\nplatforms that do not have the ioctl FIOCLEX and FIONCLEX commands.\n\n- bpo-26920(4): Fix not getting the locale's charset upon\ninitializing the interpreter, on platforms that do not have\nlanginfo.\n\n- bpo-28648(5): Fixed crash in PyDecodeLocale() in debug build on\nMac OS X when decode astral characters.  Patch by Xiang Zhang.\n\n- bpo-19398(6): Extra slash no longer added to sys.path components in\ncase of empty compile-time PYTHONPATH components.\n\n- bpo-28665(7): Improve speed of the STOREDEREF opcode by 40%.\n\n- bpo-28583(8): PyDictSetDefault didn't combine split table when\nneeded.  Patch by Xiang Zhang.\n\n- bpo-27243(9): Change PendingDeprecationWarning ->\nDeprecationWarning.  As it was agreed in the issue, aiter\nreturning an awaitable should result in PendingDeprecationWarning\nin 3.5 and in DeprecationWarning in 3.6.\n\n- bpo-26182(10): Fix a refleak in code that raises\nDeprecationWarning.\n\n- bpo-28721(11): Fix asynchronous generators aclose() and athrow() to\nhandle StopAsyncIteration propagation properly.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28532\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=27100\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=28746\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=26920\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=28648\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=19398\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=28665\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=28583\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=27243\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=26182\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=28721\n\nFile: python3.12.info,  Node: Library<66>,  Next: Documentation<64>,  Prev: Core and Builtins<66>,  Up: Python 3 6 0 beta 4\n\n1.22.74.2 Library\n.................\n\n- bpo-28752(1): Restored the reduce() methods of datetime\nobjects.\n\n- bpo-28727(2): Regular expression patterns, sre.SREPattern objects\ncreated by re.compile(), become comparable (only x==y and x!=y\noperators).  This change should fix the bpo-18383(3): don't\nduplicate warning filters when the warnings module is reloaded\n(thing usually only done in unit tests).\n\n- bpo-20572(4): The subprocess.Popen.wait method's undocumented\nendtime parameter now raises a DeprecationWarning.\n\n- bpo-25659(5): In ctypes, prevent a crash calling the frombuffer()\nand frombuffercopy() methods on abstract classes like Array.\n\n- bpo-19717(6): Makes Path.resolve() succeed on paths that do not\nexist.  Patch by Vajrasky Kok\n\n- bpo-28563(7): Fixed possible DoS and arbitrary code execution when\nhandle plural form selections in the gettext module.  The\nexpression parser now supports exact syntax supported by GNU\ngettext.\n\n- bpo-28387(8): Fixed possible crash in io.TextIOWrapper deallocator\nwhen the garbage collector is invoked in other thread.  Based on\npatch by Sebastian Cufre.\n\n- bpo-28600(9): Optimize loop.callsoon.\n\n- bpo-28613(10): Fix geteventloop() return the current loop if\ncalled from coroutines/callbacks.\n\n- bpo-28634(11): Fix asyncio.isfuture() to support unittest.Mock.\n\n- bpo-26081(12): Fix refleak in asyncio.Future.iter().throw.\n\n- bpo-28639(13): Fix inspect.isawaitable to always return bool Patch\nby Justin Mayfield.\n\n- bpo-28652(14): Make loop methods reject socket kinds they do not\nsupport.\n\n- bpo-28653(15): Fix a refleak in functools.lrucache.\n\n- bpo-28703(16): Fix asyncio.iscoroutinefunction to handle Mock\nobjects.\n\n- bpo-28704(17): Fix createunixserver to support Path-like objects\n(PEP 519).\n\n- bpo-28720(18): Add collections.abc.AsyncGenerator.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28752\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=28727\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=18383\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=20572\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=25659\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=19717\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=28563\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=28387\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=28600\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=28613\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=28634\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=26081\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=28639\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=28652\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=28653\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=28703\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=28704\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=28720\n\nFile: python3.12.info,  Node: Documentation<64>,  Next: Tests<59>,  Prev: Library<66>,  Up: Python 3 6 0 beta 4\n\n1.22.74.3 Documentation\n.......................\n\n- bpo-28513(1): Documented command-line interface of zipfile.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28513\n\nFile: python3.12.info,  Node: Tests<59>,  Next: Build<63>,  Prev: Documentation<64>,  Up: Python 3 6 0 beta 4\n\n1.22.74.4 Tests\n...............\n\n- bpo-28666(1): Now test.support.rmtree is able to remove unwritable\nor unreadable directories.\n\n- bpo-23839(2): Various caches now are cleared before running every\ntest file.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28666\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=23839\n\nFile: python3.12.info,  Node: Build<63>,  Prev: Tests<59>,  Up: Python 3 6 0 beta 4\n\n1.22.74.5 Build\n...............\n\n- bpo-10656(1): Fix out-of-tree building on AIX. Patch by Tristan\nCarel and Michael Haubenwallner.\n\n- bpo-26359(2): Rename -with-optimiations to -enable-optimizations.\n\n- bpo-28676(3): Prevent missing 'getentropy' declaration warning on\nmacOS. Patch by Gareth Rees.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=10656\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=26359\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=28676\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 6 0 beta 3,  Next: Python 3 6 0 beta 2,  Prev: Python 3 6 0 beta 4,  Up: Changelog": {
            "content": "'Release date: 2016-10-31'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<67>.\n* Library: Library<67>.\n* Windows: Windows<58>.\n* Build: Build<64>.\n* Tests: Tests<60>.\n\nFile: python3.12.info,  Node: Core and Builtins<67>,  Next: Library<67>,  Up: Python 3 6 0 beta 3\n\n1.22.75.1 Core and Builtins\n...........................\n\n- bpo-28128(1): Deprecation warning for invalid str and byte escape\nsequences now prints better information about where the error\noccurs.  Patch by Serhiy Storchaka and Eric Smith.\n\n- bpo-28509(2): dict.update() no longer allocate unnecessary large\nmemory.\n\n- bpo-28426(3): Fixed potential crash in PyUnicodeAsDecodedObject()\nin debug build.\n\n- bpo-28517(4): Fixed of-by-one error in the peephole optimizer that\ncaused keeping unreachable code.\n\n- bpo-28214(5): Improved exception reporting for problematic\nsetname attributes.\n\n- bpo-23782(6): Fixed possible memory leak in PyTracebackAdd() and\nexception loss in PyTraceBackHere().\n\n- bpo-28471(7): Fix \"Python memory allocator called without holding\nthe GIL\" crash in socket.setblocking.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28128\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=28509\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=28426\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=28517\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=28214\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=23782\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=28471\n\nFile: python3.12.info,  Node: Library<67>,  Next: Windows<58>,  Prev: Core and Builtins<67>,  Up: Python 3 6 0 beta 3\n\n1.22.75.2 Library\n.................\n\n- bpo-27517(1): LZMA compressor and decompressor no longer raise\nexceptions if given empty data twice.  Patch by Benjamin Fogle.\n\n- bpo-28549(2): Fixed segfault in curses's addch() with ncurses6.\n\n- bpo-28449(3): tarfile.open() with mode \"r\" or \"r:\" now tries to\nopen a tar file with compression before trying to open it without\ncompression.  Otherwise it had 50% chance failed with\nignorezeros=True.\n\n- bpo-23262(4): The webbrowser module now supports Firefox 36+ and\nderived browsers.  Based on patch by Oleg Broytman.\n\n- bpo-27939(5): Fixed bugs in tkinter.ttk.LabeledScale and\ntkinter.Scale caused by representing the scale as float value\ninternally in Tk.  tkinter.IntVar now works if float value is set\nto underlying Tk variable.\n\n- bpo-18844(6): The various ways of specifying weights for\nrandom.choices() now produce the same result sequences.\n\n- bpo-28255(7): calendar.TextCalendar().prmonth() no longer prints a\nspace at the start of new line after printing a month's calendar.\nPatch by Xiang Zhang.\n\n- bpo-20491(8): The textwrap.TextWrapper class now honors\nnon-breaking spaces.  Based on patch by Kaarle Ritvanen.\n\n- bpo-28353(9): os.fwalk() no longer fails on broken links.\n\n- bpo-28430(10): Fix iterator of C implemented asyncio.Future doesn't\naccept non-None value is passed to it.send(val).\n\n- bpo-27025(11): Generated names for Tkinter widgets now start by the\n\"!\" prefix for readability.\n\n- bpo-25464(12): Fixed HList.headerexists() in tkinter.tix module by\naddin a workaround to Tix library bug.\n\n- bpo-28488(13): shutil.makearchive() no longer adds entry \"./\" to\nZIP archive.\n\n- bpo-25953(14): re.sub() now raises an error for invalid numerical\ngroup reference in replacement template even if the pattern is not\nfound in the string.  Error message for invalid group reference now\nincludes the group index and the position of the reference.  Based\non patch by SilentGhost.\n\n- bpo-18219(15): Optimize csv.DictWriter for large number of columns.\nPatch by Mariatta Wijaya.\n\n- bpo-28448(16): Fix C implemented asyncio.Future didn't work on\nWindows.\n\n- bpo-28480(17): Fix error building socket module when multithreading\nis disabled.\n\n- bpo-24452(18): Make webbrowser support Chrome on Mac OS X.\n\n- bpo-20766(19): Fix references leaked by pdb in the handling of\nSIGINT handlers.\n\n- bpo-28492(20): Fix how StopIteration exception is raised in\nasyncio.Future.\n\n- bpo-28500(21): Fix asyncio to handle async gens GC from another\nthread.\n\n- bpo-26923(22): Fix asyncio.Gather to refuse being cancelled once\nall children are done.  Patch by Johannes Ebke.\n\n- bpo-26796(23): Don't configure the number of workers for default\nthreadpool executor.  Initial patch by Hans Lawrenz.\n\n- bpo-28544(24): Implement asyncio.Task in C.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27517\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=28549\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=28449\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=23262\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=27939\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=18844\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=28255\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=20491\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=28353\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=28430\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=27025\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=25464\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=28488\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=25953\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=18219\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=28448\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=28480\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=24452\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=20766\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=28492\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=28500\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=26923\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=26796\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=28544\n\nFile: python3.12.info,  Node: Windows<58>,  Next: Build<64>,  Prev: Library<67>,  Up: Python 3 6 0 beta 3\n\n1.22.75.3 Windows\n.................\n\n- bpo-28522(1): Fixes mishandled buffer reallocation in getpathp.c\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28522\n\nFile: python3.12.info,  Node: Build<64>,  Next: Tests<60>,  Prev: Windows<58>,  Up: Python 3 6 0 beta 3\n\n1.22.75.4 Build\n...............\n\n- bpo-28444(1): Fix missing extensions modules when cross compiling.\n\n- bpo-28208(2): Update Windows build and OS X installers to use\nSQLite 3.14.2.\n\n- bpo-28248(3): Update Windows build and OS X installers to use\nOpenSSL 1.0.2j.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28444\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=28208\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=28248\n\nFile: python3.12.info,  Node: Tests<60>,  Prev: Build<64>,  Up: Python 3 6 0 beta 3\n\n1.22.75.5 Tests\n...............\n\n- bpo-26944(1): Fix testposix for Android where 'id -G' is entirely\nwrong or missing the effective gid.\n\n- bpo-28409(2): regrtest: fix the parser of command line arguments.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26944\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=28409\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 6 0 beta 2,  Next: Python 3 6 0 beta 1,  Prev: Python 3 6 0 beta 3,  Up: Changelog": {
            "content": "'Release date: 2016-10-10'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<68>.\n* Library: Library<68>.\n* Windows: Windows<59>.\n* C API: C API<55>.\n* Build: Build<65>.\n* Tests: Tests<61>.\n\nFile: python3.12.info,  Node: Core and Builtins<68>,  Next: Library<68>,  Up: Python 3 6 0 beta 2\n\n1.22.76.1 Core and Builtins\n...........................\n\n- bpo-28183(1): Optimize and cleanup dict iteration.\n\n- bpo-26081(2): Added C implementation of asyncio.Future.  Original\npatch by Yury Selivanov.\n\n- bpo-28379(3): Added sanity checks and tests for\nPyUnicodeCopyCharacters().  Patch by Xiang Zhang.\n\n- bpo-28376(4): The type of long range iterator is now registered as\nIterator.  Patch by Oren Milman.\n\n- bpo-28376(5): Creating instances of rangeiterator by calling\nrangeiterator type now is deprecated.  Patch by Oren Milman.\n\n- bpo-28376(6): The constructor of rangeiterator now checks that\nstep is not 0.  Patch by Oren Milman.\n\n- bpo-26906(7): Resolving special methods of uninitialized type now\ncauses implicit initialization of the type instead of a fail.\n\n- bpo-18287(8): PyTypeReady() now checks that tpname is not NULL.\nOriginal patch by Niklas Koep.\n\n- bpo-24098(9): Fixed possible crash when AST is changed in process\nof compiling it.\n\n- bpo-28201(10): Dict reduces possibility of 2nd conflict in hash\ntable when hashes have same lower bits.\n\n- bpo-28350(11): String constants with null character no longer\ninterned.\n\n- bpo-26617(12): Fix crash when GC runs during weakref callbacks.\n\n- bpo-27942(13): String constants now interned recursively in tuples\nand frozensets.\n\n- bpo-21578(14): Fixed misleading error message when ImportError\ncalled with invalid keyword args.\n\n- bpo-28203(15): Fix incorrect type in complex(1.0, {2:3}) error\nmessage.  Patch by Soumya Sharma.\n\n- bpo-28086(16): Single var-positional argument of tuple subtype was\npassed unscathed to the C-defined function.  Now it is converted to\nexact tuple.\n\n- bpo-28214(17): Now setname is looked up on the class instead\nof the instance.\n\n- bpo-27955(18): Fallback on reading /dev/urandom device when the\ngetrandom() syscall fails with EPERM, for example when blocked by\nSECCOMP.\n\n- bpo-28192(19): Don't import readline in isolated mode.\n\n- Upgrade internal unicode databases to Unicode version 9.0.0.\n\n- bpo-28131(20): Fix a regression in zipimport's compilesource().\nzipimport should use the same optimization level as the\ninterpreter.\n\n- bpo-28126(21): Replace PyMEMCPY with memcpy().  Visual Studio can\nproperly optimize memcpy().\n\n- bpo-28120(22): Fix dict.pop() for splitted dictionary when trying\nto remove a \"pending key\" (Not yet inserted in split-table).  Patch\nby Xiang Zhang.\n\n- bpo-26182(23): Raise DeprecationWarning when async and await\nkeywords are used as variable/attribute/class/function name.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28183\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=26081\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=28379\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=28376\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=28376\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=28376\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=26906\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=18287\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=24098\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=28201\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=28350\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=26617\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=27942\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=21578\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=28203\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=28086\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=28214\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=27955\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=28192\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=28131\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=28126\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=28120\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=26182\n\nFile: python3.12.info,  Node: Library<68>,  Next: Windows<59>,  Prev: Core and Builtins<68>,  Up: Python 3 6 0 beta 2\n\n1.22.76.2 Library\n.................\n\n- bpo-27998(1): Fixed bytes path support in os.scandir() on Windows.\nPatch by Eryk Sun.\n\n- bpo-28317(2): The disassembler now decodes FORMATVALUE argument.\n\n- bpo-26293(3): Fixed writing ZIP files that starts not from the\nstart of the file.  Offsets in ZIP file now are relative to the\nstart of the archive in conforming to the specification.\n\n- bpo-28380(4): unittest.mock Mock autospec functions now properly\nsupport assertcalled, assertnotcalled, and assertcalledonce.\n\n- bpo-27181(5): remove statistics.geometricmean and defer until 3.7.\n\n- bpo-28229(6): lzma module now supports pathlib.\n\n- bpo-28321(7): Fixed writing non-BMP characters with binary format\nin plistlib.\n\n- bpo-28225(8): bz2 module now supports pathlib.  Initial patch by\nEthan Furman.\n\n- bpo-28227(9): gzip now supports pathlib.  Patch by Ethan Furman.\n\n- bpo-27358(10): Optimized merging var-keyword arguments and improved\nerror message when passing a non-mapping as a var-keyword argument.\n\n- bpo-28257(11): Improved error message when passing a non-iterable\nas a var-positional argument.  Added opcode\nBUILDTUPLEUNPACKWITHCALL.\n\n- bpo-28322(12): Fixed possible crashes when unpickle itertools\nobjects from incorrect pickle data.  Based on patch by John Leitch.\n\n- bpo-28228(13): imghdr now supports pathlib.\n\n- bpo-28226(14): compileall now supports pathlib.\n\n- bpo-28314(15): Fix function declaration (C flags) for the\ngetiterator() method of xml.etree.ElementTree.Element.\n\n- bpo-28148(16): Stop using localtime() and gmtime() in the time\nmodule.  Introduced platform independent PyTimelocaltime API that\nis similar to POSIX localtimer, but available on all platforms.\nPatch by Ed Schouten.\n\n- bpo-28253(17): Fixed calendar functions for extreme months: 0001-01\nand 9999-12.  Methods itermonthdays() and itermonthdays2() are\nreimplemented so that they don't call itermonthdates() which can\ncause datetime.date under/overflow.\n\n- bpo-28275(18): Fixed possible use after free in the decompress()\nmethods of the LZMADecompressor and BZ2Decompressor classes.\nOriginal patch by John Leitch.\n\n- bpo-27897(19): Fixed possible crash in\nsqlite3.Connection.createcollation() if pass invalid string-like\nobject as a name.  Patch by Xiang Zhang.\n\n- bpo-18844(20): random.choices() now has k as a keyword-only\nargument to improve the readability of common cases and come into\nline with the signature used in other languages.\n\n- bpo-18893(21): Fix invalid exception handling in\nLib/ctypes/macholib/dyld.py.  Patch by Madison May.\n\n- bpo-27611(22): Fixed support of default root window in the\ntkinter.tix module.  Added the master parameter in the DisplayStyle\nconstructor.\n\n- bpo-27348(23): In the traceback module, restore the formatting of\nexception messages like \"Exception: None\".  This fixes a regression\nintroduced in 3.5a2.\n\n- bpo-25651(24): Allow false values to be used for msg parameter of\nsubTest().\n\n- bpo-27778(25): Fix a memory leak in os.getrandom() when the\ngetrandom() is interrupted by a signal and a signal handler raises\na Python exception.\n\n- bpo-28200(26): Fix memory leak on Windows in the os module (fix\npathconverter() function).\n\n- bpo-25400(27): RobotFileParser now correctly returns default values\nfor crawldelay and requestrate.  Initial patch by Peter Wirtz.\n\n- bpo-27932(28): Prevent memory leak in win32ver().\n\n- Fix UnboundLocalError in socket.sendfileusesendfile.\n\n- bpo-28075(29): Check for ERRORACCESSDENIED in Windows\nimplementation of os.stat().  Patch by Eryk Sun.\n\n- bpo-22493(30): Warning message emitted by using inline flags in the\nmiddle of regular expression now contains a (truncated) regex\npattern.  Patch by Tim Graham.\n\n- bpo-25270(31): Prevent codecs.escapeencode() from raising\nSystemError when an empty bytestring is passed.\n\n- bpo-28181(32): Get antigravity over HTTPS. Patch by Kaartic\nSivaraam.\n\n- bpo-25895(33): Enable WebSocket URL schemes in\nurllib.parse.urljoin.  Patch by Gergely Imreh and Markus\nHoltermann.\n\n- bpo-28114(34): Fix a crash in parseenvlist() when env contains\nbyte strings.  Patch by Eryk Sun.\n\n- bpo-27599(35): Fixed buffer overrun in binascii.b2aqp() and\nbinascii.a2bqp().\n\n- bpo-27906(36): Fix socket accept exhaustion during high TCP\ntraffic.  Patch by Kevin Conway.\n\n- bpo-28174(37): Handle when SOREUSEPORT isn't properly supported.\nPatch by Seth Michael Larson.\n\n- bpo-26654(38): Inspect functools.partial in\nasyncio.Handle.repr.  Patch by iceboy.\n\n- bpo-26909(39): Fix slow pipes IO in asyncio.  Patch by INADA Naoki.\n\n- bpo-28176(40): Fix callbacks race in\nasyncio.SelectorLoop.sockconnect.\n\n- bpo-27759(41): Fix selectors incorrectly retain invalid file\ndescriptors.  Patch by Mark Williams.\n\n- bpo-28368(42): Refuse monitoring processes if the child watcher has\nno loop attached.  Patch by Vincent Michel.\n\n- bpo-28369(43): Raise RuntimeError when transport's FD is used with\naddreader, addwriter, etc.\n\n- bpo-28370(44): Speedup asyncio.StreamReader.readexactly.  Patch by\n?????????????????? ????????.\n\n- bpo-28371(45): Deprecate passing asyncio.Handles to\nruninexecutor.\n\n- bpo-28372(46): Fix asyncio to support formatting of non-python\ncoroutines.\n\n- bpo-28399(47): Remove UNIX socket from FS before binding.  Patch by\n?????????????????? ????????.\n\n- bpo-27972(48): Prohibit Tasks to await on themselves.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27998\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=28317\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=26293\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=28380\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=27181\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=28229\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=28321\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=28225\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=28227\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=27358\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=28257\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=28322\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=28228\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=28226\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=28314\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=28148\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=28253\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=28275\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=27897\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=18844\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=18893\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=27611\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=27348\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=25651\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=27778\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=28200\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=25400\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=27932\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=28075\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=22493\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=25270\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=28181\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=25895\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=28114\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=27599\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=27906\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=28174\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=26654\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=26909\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=28176\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=27759\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=28368\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=28369\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=28370\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=28371\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=28372\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=28399\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=27972\n\nFile: python3.12.info,  Node: Windows<59>,  Next: C API<55>,  Prev: Library<68>,  Up: Python 3 6 0 beta 2\n\n1.22.76.3 Windows\n.................\n\n- bpo-28402(1): Adds signed catalog files for stdlib on Windows.\n\n- bpo-28333(2): Enables Unicode for ps1/ps2 and input() prompts.\n(Patch by Eryk Sun)\n\n- bpo-28251(3): Improvements to help manuals on Windows.\n\n- bpo-28110(4): launcher.msi has different product codes between\n32-bit and 64-bit\n\n- bpo-28161(5): Opening CON for write access fails\n\n- bpo-28162(6): WindowsConsoleIO readall() fails if first line starts\nwith Ctrl+Z\n\n- bpo-28163(7): WindowsConsoleIO fileno() passes wrong flags to\nopenosfhandle\n\n- bpo-28164(8): PyIOgetconsoletype fails for various paths\n\n- bpo-28137(9): Renames Windows path file to .pth\n\n- bpo-28138(10): Windows .pth file should allow import site\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28402\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=28333\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=28251\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=28110\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=28161\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=28162\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=28163\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=28164\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=28137\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=28138\n\nFile: python3.12.info,  Node: C API<55>,  Next: Build<65>,  Prev: Windows<59>,  Up: Python 3 6 0 beta 2\n\n1.22.76.4 C API\n...............\n\n- bpo-28426(1): Deprecated undocumented functions\nPyUnicodeAsEncodedObject(), PyUnicodeAsDecodedObject(),\nPyUnicodeAsDecodedUnicode() and PyUnicodeAsEncodedUnicode().\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28426\n\nFile: python3.12.info,  Node: Build<65>,  Next: Tests<61>,  Prev: C API<55>,  Up: Python 3 6 0 beta 2\n\n1.22.76.5 Build\n...............\n\n- bpo-28258(1): Fixed build with Estonian locale (python-config and\ndistclean targets in Makefile).  Patch by Arfrever Frehtes\nTaifersar Arahesis.\n\n- bpo-26661(2): setup.py now detects system libffi with multiarch\nwrapper.\n\n- bpo-15819(3): Remove redundant include search directory option for\nbuilding outside the source tree.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28258\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=26661\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=15819\n\nFile: python3.12.info,  Node: Tests<61>,  Prev: Build<65>,  Up: Python 3 6 0 beta 2\n\n1.22.76.6 Tests\n...............\n\n- bpo-28217(1): Adds testconsole module to test console input.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28217\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 6 0 beta 1,  Next: Python 3 6 0 alpha 4,  Prev: Python 3 6 0 beta 2,  Up: Changelog": {
            "content": "'Release date: 2016-09-12'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<69>.\n* Library: Library<69>.\n* IDLE: IDLE<45>.\n* C API: C API<56>.\n* Tests: Tests<62>.\n* Build: Build<66>.\n* Tools/Demos: Tools/Demos<38>.\n* Windows: Windows<60>.\n\nFile: python3.12.info,  Node: Core and Builtins<69>,  Next: Library<69>,  Up: Python 3 6 0 beta 1\n\n1.22.77.1 Core and Builtins\n...........................\n\n- bpo-23722(1): The class cell used by zero-argument super() is\nnow initialized from type.new rather than buildclass, so\nclass methods relying on that will now work correctly when called\nfrom metaclass methods during class creation.  Patch by Martin\nTeichmann.\n\n- bpo-25221(2): Fix corrupted result from PyLongFromLong(0) when\nPython is compiled with NSMALLPOSINTS = 0.\n\n- bpo-27080(3): Implement formatting support for PEP 515(4).  Initial\npatch by Chris Angelico.\n\n- bpo-27199(5): In tarfile, expose copyfileobj bufsize to improve\nthroughput.  Patch by Jason Fried.\n\n- bpo-27948(6): In f-strings, only allow backslashes inside the\nbraces (where the expressions are).  This is a breaking change from\nthe 3.6 alpha releases, where backslashes are allowed anywhere in\nan f-string.  Also, require that expressions inside f-strings be\nenclosed within literal braces, and not escapes like\n'f'\\x7b\"hi\"\\x7d''.\n\n- bpo-28046(7): Remove platform-specific directories from sys.path.\n\n- bpo-28071(8): Add early-out for differencing from an empty set.\n\n- bpo-25758(9): Prevents zipimport from unnecessarily encoding a\nfilename (patch by Eryk Sun)\n\n- bpo-25856(10): The module attribute of extension classes and\nfunctions now is interned.  This leads to more compact pickle data\nwith protocol 4.\n\n- bpo-27213(11): Rework CALLFUNCTION* opcodes to produce shorter and\nmore efficient bytecode.  Patch by Demur Rumed, design by Serhiy\nStorchaka, reviewed by Serhiy Storchaka and Victor Stinner.\n\n- bpo-26331(12): Implement tokenizing support for PEP 515(13).  Patch\nby Georg Brandl.\n\n- bpo-27999(14): Make \"global after use\" a SyntaxError, and ditto for\nnonlocal.  Patch by Ivan Levkivskyi.\n\n- bpo-28003(15): Implement PEP 525(16) - Asynchronous Generators.\n\n- bpo-27985(17): Implement PEP 526(18) - Syntax for Variable\nAnnotations.  Patch by Ivan Levkivskyi.\n\n- bpo-26058(19): Add a new private version to the builtin dict type,\nincremented at each dictionary creation and at each dictionary\nchange.  Implementation of the PEP 509.\n\n- bpo-27364(20): A backslash-character pair that is not a valid\nescape sequence now generates a DeprecationWarning.  Patch by\nEmanuel Barry.\n\n- bpo-27350(21): 'dict' implementation is changed like PyPy.  It is\nmore compact and preserves insertion order.  (Concept developed by\nRaymond Hettinger and patch by Inada Naoki.)\n\n- bpo-27911(22): Remove unnecessary error checks in\n'execbuiltinordynamic()'.\n\n- bpo-27078(23): Added BUILDSTRING opcode.  Optimized f-strings\nevaluation.\n\n- bpo-17884(24): Python now requires systems with inttypes.h and\nstdint.h\n\n- bpo-27961(25): Require platforms to support 'long long'.  Python\nhasn't compiled without 'long long' for years, so this is basically\na formality.\n\n- bpo-27355(26): Removed support for Windows CE. It was never\nfinished, and Windows CE is no longer a relevant platform for\nPython.\n\n- Implement PEP 523(27).\n\n- bpo-27870(28): A left shift of zero by a large integer no longer\nattempts to allocate large amounts of memory.\n\n- bpo-25402(29): In int-to-decimal-string conversion, improve the\nestimate of the intermediate memory required, and remove an\nunnecessarily strict overflow check.  Patch by Serhiy Storchaka.\n\n- bpo-27214(30): In longinvert, be more careful about modifying\nobject returned by longadd, and remove an unnecessary check for\nsmall longs.  Thanks Oren Milman for analysis and patch.\n\n- bpo-27506(31): Support passing the bytes/bytearray.translate()\n\"delete\" argument by keyword.\n\n- bpo-27812(32): Properly clear out a generator's frame's\nbackreference to the generator to prevent crashes in frame.clear().\n\n- bpo-27811(33): Fix a crash when a coroutine that has not been\nawaited is finalized with warnings-as-errors enabled.\n\n- bpo-27587(34): Fix another issue found by PVS-Studio: Null pointer\ncheck after use of 'def' in PyStateAddModule().  Initial patch by\nChristian Heimes.\n\n- bpo-27792(35): The modulo operation applied to 'bool' and other\n'int' subclasses now always returns an 'int'.  Previously the\nreturn type depended on the input values.  Patch by Xiang Zhang.\n\n- bpo-26984(36): int() now always returns an instance of exact int.\n\n- bpo-25604(37): Fix a minor bug in integer true division; this bug\ncould potentially have caused off-by-one-ulp results on platforms\nwith unreliable ldexp implementations.\n\n- bpo-24254(38): Make class definition namespace ordered by default.\n\n- bpo-27662(39): Fix an overflow check in 'ListNew': the original\ncode was checking against 'PySIZEMAX' instead of the correct\nupper bound of 'PySSIZETMAX'.  Patch by Xiang Zhang.\n\n- bpo-27782(40): Multi-phase extension module import now correctly\nallows the 'mmethods' field to be used to add module level\nfunctions to instances of non-module types returned from\n'Pycreatemod'.  Patch by Xiang Zhang.\n\n- bpo-27936(41): The round() function accepted a second None argument\nfor some types but not for others.  Fixed the inconsistency by\naccepting None for all numeric types.\n\n- bpo-27487(42): Warn if a submodule argument to \"python -m\" or\nrunpy.runmodule() is found in sys.modules after parent packages\nare imported, but before the submodule is executed.\n\n- bpo-27157(43): Make only type() itself accept the one-argument\nform.  Patch by Eryk Sun and Emanuel Barry.\n\n- bpo-27558(44): Fix a SystemError in the implementation of \"raise\"\nstatement.  In a brand new thread, raise a RuntimeError since there\nis no active exception to reraise.  Patch written by Xiang Zhang.\n\n- bpo-28008(45): Implement PEP 530(46) - asynchronous comprehensions.\n\n- bpo-27942(47): Fix memory leak in codeobject.c\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23722\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=25221\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=27080\n\n(4) https://peps.python.org/pep-0515/\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=27199\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=27948\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=28046\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=28071\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=25758\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=25856\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=27213\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=26331\n\n(13) https://peps.python.org/pep-0515/\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=27999\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=28003\n\n(16) https://peps.python.org/pep-0525/\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=27985\n\n(18) https://peps.python.org/pep-0526/\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=26058\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=27364\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=27350\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=27911\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=27078\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=17884\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=27961\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=27355\n\n(27) https://peps.python.org/pep-0523/\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=27870\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=25402\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=27214\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=27506\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=27812\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=27811\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=27587\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=27792\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=26984\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=25604\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=24254\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=27662\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=27782\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=27936\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=27487\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=27157\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=27558\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=28008\n\n(46) https://peps.python.org/pep-0530/\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=27942\n\nFile: python3.12.info,  Node: Library<69>,  Next: IDLE<45>,  Prev: Core and Builtins<69>,  Up: Python 3 6 0 beta 1\n\n1.22.77.2 Library\n.................\n\n- bpo-28732(1): Fix crash in os.spawnv() with no elements in args\n\n- bpo-28485(2): Always raise ValueError for negative\ncompileall.compiledir(workers=...) parameter, even when\nmultithreading is unavailable.\n\n- bpo-28037(3): Use sqlite3getautocommit() instead of setting\nConnection->inTransaction manually.\n\n- bpo-25283(4): Attributes tmgmtoff and tmzone are now available on\nall platforms in the return values of time.localtime() and\ntime.gmtime().\n\n- bpo-24454(5): Regular expression match object groups are now\naccessible using getitem.  \"mo[x]\" is equivalent to\n\"mo.group(x)\".\n\n- bpo-10740(6): sqlite3 no longer implicitly commit an open\ntransaction before DDL statements.\n\n- bpo-17941(7): Add a 'module' parameter to collections.namedtuple().\n\n- bpo-22493(8): Inline flags now should be used only at the start of\nthe regular expression.  Deprecation warning is emitted if uses\nthem in the middle of the regular expression.\n\n- bpo-26885(9): xmlrpc now supports unmarshalling additional data\ntypes used by Apache XML-RPC implementation for numerics and None.\n\n- bpo-28070(10): Fixed parsing inline verbose flag in regular\nexpressions.\n\n- bpo-19500(11): Add client-side SSL session resumption to the ssl\nmodule.\n\n- bpo-28022(12): Deprecate ssl-related arguments in favor of\nSSLContext.  The deprecation include manual creation of SSLSocket\nand certfile/keyfile (or similar) in ftplib, httplib, imaplib,\nsmtplib, poplib and urllib.\n\n- bpo-28043(13): SSLContext has improved default settings:\nOPNOSSLv2, OPNOSSLv3, OPNOCOMPRESSION,\nOPCIPHERSERVERPREFERENCE, OPSINGLEDHUSE, OPSINGLEECDHUSE\nand HIGH ciphers without MD5.\n\n- bpo-24693(14): Changed some RuntimeError's in the zipfile module to\nmore appropriate types.  Improved some error messages and debugging\noutput.\n\n- bpo-17909(15): 'json.load' and 'json.loads' now support binary\ninput encoded as UTF-8, UTF-16 or UTF-32.  Patch by Serhiy\nStorchaka.\n\n- bpo-27137(16): the pure Python fallback implementation of\n'functools.partial' now matches the behaviour of its accelerated C\ncounterpart for subclassing, pickling and text representation\npurposes.  Patch by Emanuel Barry and Serhiy Storchaka.\n\n- Fix possible integer overflows and crashes in the mmap module with\nunusual usage patterns.\n\n- bpo-1703178(17): Fix the ability to pass the -link-objects option\nto the distutils buildext command.\n\n- bpo-28019(18): itertools.count() no longer rounds non-integer step\nin range between 1.0 and 2.0 to 1.\n\n- bpo-18401(19): Pdb now supports the 'readrc' keyword argument to\ncontrol whether .pdbrc files should be read.  Patch by Martin\nMatusiak and Sam Kimbrel.\n\n- bpo-25969(20): Update the lib2to3 grammar to handle the unpacking\ngeneralizations added in 3.5.\n\n- bpo-14977(21): mailcap now respects the order of the lines in the\nmailcap files (\"first match\"), as required by RFC 1542.  Patch by\nMichael Lazar.\n\n- bpo-28082(22): Convert re flag constants to IntFlag.\n\n- bpo-28025(23): Convert all ssl module constants to IntEnum and\nIntFlags.  SSLContext properties now return flags and enums.\n\n- bpo-23591(24): Add Flag, IntFlag, and auto() to enum module.\n\n- bpo-433028(25): Added support of modifier spans in regular\nexpressions.\n\n- bpo-24594(26): Validates persist parameter when opening MSI\ndatabase\n\n- bpo-17582(27): xml.etree.ElementTree nows preserves whitespaces in\nattributes (Patch by Duane Griffin.  Reviewed and approved by\nStefan Behnel.)\n\n- bpo-28047(28): Fixed calculation of line length used for the base64\nCTE in the new email policies.\n\n- bpo-27576(29): Fix call order in OrderedDict.init().\n\n- email.generator.DecodedGenerator now supports the policy keyword.\n\n- bpo-28027(30): Remove undocumented modules from 'Lib/plat-*': IN,\nCDROM, DLFCN, TYPES, CDIO, and STROPTS.\n\n- bpo-27445(31): Don't pass str(charset) to MIMEText.setpayload().\nPatch by Claude Paroz.\n\n- bpo-24277(32): The new email API is no longer provisional, and the\ndocs have been reorganized and rewritten to emphasize the new API.\n\n- bpo-22450(33): urllib now includes an 'Accept: */*' header among\nthe default headers.  This makes the results of REST API requests\nmore consistent and predictable especially when proxy servers are\ninvolved.\n\n- lib2to3.pgen3.driver.loadgrammar() now creates a stable cache file\nbetween runs given the same Grammar.txt input regardless of the\nhash randomization setting.\n\n- bpo-28005(34): Allow ImportErrors in encoding implementation to\npropagate.\n\n- bpo-26667(35): Support path-like objects in importlib.util.\n\n- bpo-27570(36): Avoid zero-length memcpy() etc calls with null\nsource pointers in the \"ctypes\" and \"array\" modules.\n\n- bpo-22233(37): Break email header lines 'only' on the RFC specified\nCR and LF characters, not on arbitrary unicode line breaks.  This\nalso fixes a bug in HTTP header parsing.\n\n- bpo-27331(38): The email.mime classes now all accept an optional\npolicy keyword.\n\n- bpo-27988(39): Fix email iterattachments incorrect mutation of\npayload list.\n\n- bpo-16113(40): Add SHA-3 and SHAKE support to hashlib module.\n\n- Eliminate a tautological-pointer-compare warning in scproxy.c.\n\n- bpo-27776(41): The *note os.urandom(): 276. function does now block\non Linux 3.17 and newer until the system urandom entropy pool is\ninitialized to increase the security.  This change is part of the\nPEP 524(42).\n\n- bpo-27778(43): Expose the Linux 'getrandom()' syscall as a new\n*note os.getrandom(): b0c. function.  This change is part of the\nPEP 524(44).\n\n- bpo-27691(45): Fix ssl module's parsing of GENRID subject\nalternative name fields in X.509 certs.\n\n- bpo-18844(46): Add random.choices().\n\n- bpo-25761(47): Improved error reporting about truncated pickle data\nin C implementation of unpickler.  UnpicklingError is now raised\ninstead of AttributeError and ValueError in some cases.\n\n- bpo-26798(48): Add BLAKE2 (blake2b and blake2s) to hashlib.\n\n- bpo-26032(49): Optimized globbing in pathlib by using os.scandir();\nit is now about 1.5-4 times faster.\n\n- bpo-25596(50): Optimized glob() and iglob() functions in the glob\nmodule; they are now about 3-6 times faster.\n\n- bpo-27928(51): Add scrypt (password-based key derivation function)\nto hashlib module (requires OpenSSL 1.1.0).\n\n- bpo-27850(52): Remove 3DES from ssl module's default cipher list to\ncounter measure sweet32 attack (CVE-2016-2183).\n\n- bpo-27766(53): Add ChaCha20 Poly1305 to ssl module's default cipher\nlist.  (Required OpenSSL 1.1.0 or LibreSSL).\n\n- bpo-25387(54): Check return value of winsound.MessageBeep.\n\n- bpo-27866(55): Add SSLContext.getciphers() method to get a list of\nall enabled ciphers.\n\n- bpo-27744(56): Add AFALG (Linux Kernel crypto) to socket module.\n\n- bpo-26470(57): Port ssl and hashlib module to OpenSSL 1.1.0.\n\n- bpo-11620(58): Fix support for SNDMEMORY in winsound.PlaySound.\nBased on a patch by Tim Lesher.\n\n- bpo-11734(59): Add support for IEEE 754 half-precision floats to\nthe struct module.  Based on a patch by Eli Stevens.\n\n- bpo-27919(60): Deprecated 'extrapath' distribution option in\ndistutils packaging.\n\n- bpo-23229(61): Add new 'cmath' constants: 'cmath.inf' and\n'cmath.nan' to match 'math.inf' and 'math.nan', and also\n'cmath.infj' and 'cmath.nanj' to match the format used by complex\nrepr.\n\n- bpo-27842(62): The csv.DictReader now returns rows of type\nOrderedDict.  (Contributed by Steve Holden.)\n\n- Remove support for passing a file descriptor to os.access.  It\nnever worked but previously didn't raise.\n\n- bpo-12885(63): Fix error when distutils encounters symlink.\n\n- bpo-27881(64): Fixed possible bugs when setting\nsqlite3.Connection.isolationlevel.  Based on patch by Xiang Zhang.\n\n- bpo-27861(65): Fixed a crash in sqlite3.Connection.cursor() when a\nfactory creates not a cursor.  Patch by Xiang Zhang.\n\n- bpo-19884(66): Avoid spurious output on OS X with Gnu Readline.\n\n- bpo-27706(67): Restore deterministic behavior of\nrandom.Random().seed() for string seeds using seeding version 1.\nAllows sequences of calls to random() to exactly match those\nobtained in Python 2.  Patch by Nofar Schnider.\n\n- bpo-10513(68): Fix a regression in Connection.commit().  Statements\nshould not be reset after a commit.\n\n- bpo-12319(69): Chunked transfer encoding support added to\nhttp.client.HTTPConnection requests.  The\nurllib.request.AbstractHTTPHandler class does not enforce a\nContent-Length header any more.  If a HTTP request has a file or\niterable body, but no Content-Length header, the library now falls\nback to use chunked transfer-encoding.\n\n- A new version of typing.py from 'https://github.com/python/typing':\n- Collection (only for 3.6) (bpo-27598(70)) - Add FrozenSet to\nall (upstream #261) - fix crash in gettypevars() (upstream\n#259) - Remove the dict constraint in ForwardRef.evaltype\n(upstream #252)\n\n- bpo-27832(71): Make 'normalize' parameter to 'Fraction'\nconstructor keyword-only, so that 'Fraction(2, 3, 4)' now raises\n'TypeError'.\n\n- bpo-27539(72): Fix unnormalised 'Fraction.pow' result in the\ncase of negative exponent and negative base.\n\n- bpo-21718(73): cursor.description is now available for queries\nusing CTEs.\n\n- bpo-27819(74): In distutils sdists, simply produce the \"gztar\"\n(gzipped tar format) distributions on all platforms unless\n\"formats\" is supplied.\n\n- bpo-2466(75): posixpath.ismount now correctly recognizes mount\npoints which the user does not have permission to access.\n\n- bpo-9998(76): On Linux, ctypes.util.findlibrary now looks in\nLDLIBRARYPATH for shared libraries.\n\n- bpo-27573(77): exit message for code.interact is now configurable.\n\n- bpo-27930(78): Improved behaviour of\nlogging.handlers.QueueListener.  Thanks to Paulo Andrade and Petr\nViktorin for the analysis and patch.\n\n- bpo-6766(79): Distributed reference counting added to\nmultiprocessing to support nesting of shared values / proxy\nobjects.\n\n- bpo-21201(80): Improves readability of multiprocessing error\nmessage.  Thanks to Wojciech Walczak for patch.\n\n- asyncio: Add setprotocol / getprotocol to Transports.\n\n- bpo-27456(81): asyncio: Set TCPNODELAY by default.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28732\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=28485\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=28037\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=25283\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=24454\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=10740\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=17941\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=22493\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=26885\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=28070\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=19500\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=28022\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=28043\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=24693\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=17909\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=27137\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=1703178\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=28019\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=18401\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=25969\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=14977\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=28082\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=28025\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=23591\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=433028\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=24594\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=17582\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=28047\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=27576\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=28027\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=27445\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=24277\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=22450\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=28005\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=26667\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=27570\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=22233\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=27331\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=27988\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=16113\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=27776\n\n(42) https://peps.python.org/pep-0524/\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=27778\n\n(44) https://peps.python.org/pep-0524/\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=27691\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=18844\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=25761\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=26798\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=26032\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=25596\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=27928\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=27850\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=27766\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=25387\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=27866\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=27744\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=26470\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=11620\n\n(59) https://bugs.python.org/issue?@action=redirect&bpo=11734\n\n(60) https://bugs.python.org/issue?@action=redirect&bpo=27919\n\n(61) https://bugs.python.org/issue?@action=redirect&bpo=23229\n\n(62) https://bugs.python.org/issue?@action=redirect&bpo=27842\n\n(63) https://bugs.python.org/issue?@action=redirect&bpo=12885\n\n(64) https://bugs.python.org/issue?@action=redirect&bpo=27881\n\n(65) https://bugs.python.org/issue?@action=redirect&bpo=27861\n\n(66) https://bugs.python.org/issue?@action=redirect&bpo=19884\n\n(67) https://bugs.python.org/issue?@action=redirect&bpo=27706\n\n(68) https://bugs.python.org/issue?@action=redirect&bpo=10513\n\n(69) https://bugs.python.org/issue?@action=redirect&bpo=12319\n\n(70) https://bugs.python.org/issue?@action=redirect&bpo=27598\n\n(71) https://bugs.python.org/issue?@action=redirect&bpo=27832\n\n(72) https://bugs.python.org/issue?@action=redirect&bpo=27539\n\n(73) https://bugs.python.org/issue?@action=redirect&bpo=21718\n\n(74) https://bugs.python.org/issue?@action=redirect&bpo=27819\n\n(75) https://bugs.python.org/issue?@action=redirect&bpo=2466\n\n(76) https://bugs.python.org/issue?@action=redirect&bpo=9998\n\n(77) https://bugs.python.org/issue?@action=redirect&bpo=27573\n\n(78) https://bugs.python.org/issue?@action=redirect&bpo=27930\n\n(79) https://bugs.python.org/issue?@action=redirect&bpo=6766\n\n(80) https://bugs.python.org/issue?@action=redirect&bpo=21201\n\n(81) https://bugs.python.org/issue?@action=redirect&bpo=27456\n\nFile: python3.12.info,  Node: IDLE<45>,  Next: C API<56>,  Prev: Library<69>,  Up: Python 3 6 0 beta 1\n\n1.22.77.3 IDLE\n..............\n\n- bpo-15308(1): Add 'interrupt execution' (^C) to Shell menu.  Patch\nby Roger Serwy, updated by Bayard Randel.\n\n- bpo-27922(2): Stop IDLE tests from 'flashing' gui widgets on the\nscreen.\n\n- bpo-27891(3): Consistently group and sort imports within idlelib\nmodules.\n\n- bpo-17642(4): add larger font sizes for classroom projection.\n\n- Add version to title of IDLE help window.\n\n- bpo-25564(5): In section on IDLE - console differences, mention\nthat using exec means that builtins is defined for each\nstatement.\n\n- bpo-27821(6): Fix 3.6.0a3 regression that prevented custom key sets\nfrom being selected when no custom theme was defined.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=15308\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=27922\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=27891\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=17642\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=25564\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=27821\n\nFile: python3.12.info,  Node: C API<56>,  Next: Tests<62>,  Prev: IDLE<45>,  Up: Python 3 6 0 beta 1\n\n1.22.77.4 C API\n...............\n\n- bpo-26900(1): Excluded underscored names and other private API from\nlimited API.\n\n- bpo-26027(2): Add support for path-like objects in\nPyUnicodeFSConverter() & PyUnicodeFSDecoder().\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26900\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=26027\n\nFile: python3.12.info,  Node: Tests<62>,  Next: Build<66>,  Prev: C API<56>,  Up: Python 3 6 0 beta 1\n\n1.22.77.5 Tests\n...............\n\n- bpo-27427(1): Additional tests for the math module.  Patch by\nFrancisco Couzo.\n\n- bpo-27953(2): Skip math and cmath tests that fail on OS X 10.4 due\nto a poor libm implementation of tan.\n\n- bpo-26040(3): Improve testmath and testcmath coverage and rigour.\nPatch by Jeff Allen.\n\n- bpo-27787(4): Call gc.collect() before checking each test for\n\"dangling threads\", since the dangling threads are weak references.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27427\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=27953\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=26040\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=27787\n\nFile: python3.12.info,  Node: Build<66>,  Next: Tools/Demos<38>,  Prev: Tests<62>,  Up: Python 3 6 0 beta 1\n\n1.22.77.6 Build\n...............\n\n- bpo-27566(1): Fix clean target in freeze makefile (patch by Lisa\nRoach)\n\n- bpo-27705(2): Update message in validateucrtbase.py\n\n- bpo-27976(3): Deprecate building ctypes with the bundled copy of\nlibffi on non-OSX UNIX platforms.\n\n- bpo-27983(4): Cause lack of llvm-profdata tool when using clang as\nrequired for PGO linking to be a configure time error rather than\nmake time when '--with-optimizations' is enabled.  Also improve our\nability to find the llvm-profdata tool on MacOS and some Linuxes.\n\n- bpo-21590(5): Support for DTrace and SystemTap probes.\n\n- bpo-26307(6): The profile-opt build now applies PGO to the built-in\nmodules.\n\n- bpo-26359(7): Add the -with-optimizations flag to turn on LTO and\nPGO build support when available.\n\n- bpo-27917(8): Set platform triplets for Android builds.\n\n- bpo-25825(9): Update references to the $(LIBPL) installation path\non AIX. This path was changed in 3.2a4.\n\n- Update OS X installer to use SQLite 3.14.1 and XZ 5.2.2.\n\n- bpo-21122(10): Fix LTO builds on OS X.\n\n- bpo-17128(11): Build OS X installer with a private copy of OpenSSL.\nAlso provide a sample Install Certificates command script to\ninstall a set of root certificates from the third-party certifi\nmodule.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27566\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=27705\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=27976\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=27983\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=21590\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=26307\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=26359\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=27917\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=25825\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=21122\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=17128\n\nFile: python3.12.info,  Node: Tools/Demos<38>,  Next: Windows<60>,  Prev: Build<66>,  Up: Python 3 6 0 beta 1\n\n1.22.77.7 Tools/Demos\n.....................\n\n- bpo-27952(1): Get Tools/scripts/fixcid.py working with Python 3 and\nthe current \"re\" module, avoid invalid Python backslash escapes,\nand fix a bug parsing escaped C quote signs.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27952\n\nFile: python3.12.info,  Node: Windows<60>,  Prev: Tools/Demos<38>,  Up: Python 3 6 0 beta 1\n\n1.22.77.8 Windows\n.................\n\n- bpo-28065(1): Update xz dependency to 5.2.2 and build it from\nsource.\n\n- bpo-25144(2): Ensures TargetDir is set before continuing with\ncustom install.\n\n- bpo-1602(3): Windows console doesn't input or print Unicode (PEP\n528)\n\n- bpo-27781(4): Change file system encoding on Windows to UTF-8 (PEP\n529)\n\n- bpo-27731(5): Opt-out of MAXPATH on Windows 10\n\n- bpo-6135(6): Adds encoding and errors parameters to subprocess.\n\n- bpo-27959(7): Adds oem encoding, alias ansi to mbcs, move aliasmbcs\nto codec lookup.\n\n- bpo-27982(8): The functions of the winsound module now accept\nkeyword arguments.\n\n- bpo-20366(9): Build full text search support into SQLite on\nWindows.\n\n- bpo-27756(10): Adds new icons for Python files and processes on\nWindows.  Designs by Cherry Wang.\n\n- bpo-27883(11): Update sqlite to 3.14.1.0 on Windows.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28065\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=25144\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=1602\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=27781\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=27731\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=6135\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=27959\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=27982\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=20366\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=27756\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=27883\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 6 0 alpha 4,  Next: Python 3 6 0 alpha 3,  Prev: Python 3 6 0 beta 1,  Up: Changelog": {
            "content": "'Release date: 2016-08-15'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<70>.\n* Library: Library<70>.\n* IDLE: IDLE<46>.\n* Tests: Tests<63>.\n* Windows: Windows<61>.\n* Build: Build<67>.\n\nFile: python3.12.info,  Node: Core and Builtins<70>,  Next: Library<70>,  Up: Python 3 6 0 alpha 4\n\n1.22.78.1 Core and Builtins\n...........................\n\n- bpo-27704(1): Optimized creating bytes and bytearray from byte-like\nobjects and iterables.  Speed up to 3 times for short objects.\nOriginal patch by Naoki Inada.\n\n- bpo-26823(2): Large sections of repeated lines in tracebacks are\nnow abbreviated as \"[Previous line repeated {count} more times]\" by\nthe builtin traceback rendering.  Patch by Emanuel Barry.\n\n- bpo-27574(3): Decreased an overhead of parsing keyword arguments in\nfunctions implemented with using Argument Clinic.\n\n- bpo-22557(4): Now importing already imported modules is up to 2.5\ntimes faster.\n\n- bpo-17596(5): Include <wincrypt.h> to help with Min GW building.\n\n- bpo-17599(6): On Windows, rename the privately defined\nREPARSEDATABUFFER structure to avoid conflicting with the\ndefinition from Min GW.\n\n- bpo-27507(7): Add integer overflow check in bytearray.extend().\nPatch by Xiang Zhang.\n\n- bpo-27581(8): Don't rely on wrapping for overflow check in\nPySequenceTuple().  Patch by Xiang Zhang.\n\n- bpo-1621(9): Avoid signed integer overflow in list and tuple\noperations.  Patch by Xiang Zhang.\n\n- bpo-27419(10): Standard import() no longer look up \"import\"\nin globals or builtins for importing submodules or \"from import\".\nFixed a crash if raise a warning about unabling to resolve package\nfrom spec or package.\n\n- bpo-27083(11): Respect the PYTHONCASEOK environment variable under\nWindows.\n\n- bpo-27514(12): Make having too many statically nested blocks a\nSyntaxError instead of SystemError.\n\n- bpo-27366(13): Implemented PEP 487(14) (Simpler customization of\nclass creation).  Upon subclassing, the initsubclass\nclassmethod is called on the base class.  Descriptors are\ninitialized with setname after class creation.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27704\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=26823\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=27574\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=22557\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=17596\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=17599\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=27507\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=27581\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=1621\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=27419\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=27083\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=27514\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=27366\n\n(14) https://peps.python.org/pep-0487/\n\nFile: python3.12.info,  Node: Library<70>,  Next: IDLE<46>,  Prev: Core and Builtins<70>,  Up: Python 3 6 0 alpha 4\n\n1.22.78.2 Library\n.................\n\n- bpo-26027(1): Add PEP 519(2)/fspath() support to the os and\nos.path modules.  Includes code from Jelle Zijlstra.  (See also:\nbpo-27524(3))\n\n- bpo-27598(4): Add Collections to collections.abc.  Patch by Ivan\nLevkivskyi, docs by Neil Girdhar.\n\n- bpo-25958(5): Support \"anti-registration\" of special methods from\nvarious ABCs, like hash, iter or len.  All these (and\nseveral more) can be set to None in an implementation class and the\nbehavior will be as if the method is not defined at all.\n(Previously, this mechanism existed only for hash, to make\nmutable classes unhashable.)  Code contributed by Andrew Barnert\nand Ivan Levkivskyi.\n\n- bpo-16764(6): Support keyword arguments to zlib.decompress().\nPatch by Xiang Zhang.\n\n- bpo-27736(7): Prevent segfault after interpreter re-initialization\ndue to ref count problem introduced in code for bpo-27038(8) in\n3.6.0a3.  Patch by Xiang Zhang.\n\n- bpo-25628(9): The 'verbose' and 'rename' parameters for\ncollections.namedtuple are now keyword-only.\n\n- bpo-12345(10): Add mathematical constant tau to math and cmath.\nSee also PEP 628(11).\n\n- bpo-26823(12): traceback.StackSummary.format now abbreviates large\nsections of repeated lines as \"[Previous line repeated {count} more\ntimes]\" (this change then further affects other traceback display\noperations in the module).  Patch by Emanuel Barry.\n\n- bpo-27664(13): Add to\nconcurrent.futures.thread.ThreadPoolExecutor() the ability to\nspecify a thread name prefix.\n\n- bpo-27181(14): Add geometricmean and harmonicmean to statistics\nmodule.\n\n- bpo-27573(15): code.interact now prints an message when exiting.\n\n- bpo-6422(16): Add autorange method to timeit.Timer objects.\n\n- bpo-27773(17): Correct some memory management errors\nserverhostname in ssl.wrapsocket().\n\n- bpo-26750(18): unittest.mock.createautospec() now works properly\nfor subclasses of property() and other data descriptors.  Removes\nthe never publicly used, never documented\nunittest.mock.DescriptorTypes tuple.\n\n- bpo-26754(19): Undocumented support of general bytes-like objects\nas path in compile() and similar functions is now deprecated.\n\n- bpo-26800(20): Undocumented support of general bytes-like objects\nas paths in os functions is now deprecated.\n\n- bpo-26981(21): Add order compatibility shim to enum.Enum for\nPython 2/3 code bases.\n\n- bpo-27661(22): Added tzinfo keyword argument to datetime.combine.\n\n- In the curses module, raise an error if window.getstr() or\nwindow.instr() is passed a negative value.\n\n- bpo-27783(23): Fix possible usage of uninitialized memory in\noperator.methodcaller.\n\n- bpo-27774(24): Fix possible PyDECREF on unowned object in sre.\n\n- bpo-27760(25): Fix possible integer overflow in binascii.b2aqp.\n\n- bpo-27758(26): Fix possible integer overflow in the csv module for\nlarge record lengths.\n\n- bpo-27568(27): Prevent HTTPoxy attack (CVE-2016-1000110).  Ignore\nthe HTTPPROXY variable when REQUESTMETHOD environment is set,\nwhich indicates that the script is in CGI mode.\n\n- bpo-7063(28): Remove dead code from the \"array\" module's slice\nhandling.  Patch by Chuck.\n\n- bpo-27656(29): Do not assume sched.h defines any SCHED* constants.\n\n- bpo-27130(30): In the \"zlib\" module, fix handling of large buffers\n(typically 4 GiB) when compressing and decompressing.  Previously,\ninputs were limited to 4 GiB, and compression and decompression\noperations did not properly handle results of 4 GiB.\n\n- bpo-24773(31): Implemented PEP 495(32) (Local Time Disambiguation).\n\n- Expose the EPOLLEXCLUSIVE constant (when it is defined) in the\nselect module.\n\n- bpo-27567(33): Expose the EPOLLRDHUP and POLLRDHUP constants in the\nselect module.\n\n- bpo-1621(34): Avoid signed int negation overflow in the \"audioop\"\nmodule.\n\n- bpo-27533(35): Release GIL in nt.isdir\n\n- bpo-17711(36): Fixed unpickling by the persistent ID with protocol\n0.  Original patch by Alexandre Vassalotti.\n\n- bpo-27522(37): Avoid an unintentional reference cycle in\nemail.feedparser.\n\n- bpo-27512(38): Fix a segfault when os.fspath() called an\nfspath() method that raised an exception.  Patch by Xiang\nZhang.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26027\n\n(2) https://peps.python.org/pep-0519/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=27524\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=27598\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=25958\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=16764\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=27736\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=27038\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=25628\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=12345\n\n(11) https://peps.python.org/pep-0628/\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=26823\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=27664\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=27181\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=27573\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=6422\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=27773\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=26750\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=26754\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=26800\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=26981\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=27661\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=27783\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=27774\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=27760\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=27758\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=27568\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=7063\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=27656\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=27130\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=24773\n\n(32) https://peps.python.org/pep-0495/\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=27567\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=1621\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=27533\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=17711\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=27522\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=27512\n\nFile: python3.12.info,  Node: IDLE<46>,  Next: Tests<63>,  Prev: Library<70>,  Up: Python 3 6 0 alpha 4\n\n1.22.78.3 IDLE\n..............\n\n- bpo-27714(1): texttextview and testautocomplete now pass when\nre-run in the same process.  This occurs when testidle fails when\nrun with the -w option but without -jn.  Fix warning from\ntestconfig.\n\n- bpo-27621(2): Put query response validation error messages in the\nquery box itself instead of in a separate messagebox.  Redo tests\nto match.  Add Mac OSX refinements.  Original patch by Mark\nRoseman.\n\n- bpo-27620(3): Escape key now closes Query box as cancelled.\n\n- bpo-27609(4): IDLE: tab after initial whitespace should tab, not\nautocomplete.  This fixes problem with writing docstrings at least\ntwice indented.\n\n- bpo-27609(5): Explicitly return None when there are also non-None\nreturns.  In a few cases, reverse a condition and eliminate a\nreturn.\n\n- bpo-25507(6): IDLE no longer runs buggy code because of its tkinter\nimports.  Users must include the same imports required to run\ndirectly in Python.\n\n- bpo-27173(7): Add 'IDLE Modern Unix' to the built-in key sets.\nMake the default key set depend on the platform.  Add tests for the\nchanges to the config module.\n\n- bpo-27452(8): add line counter and crc to IDLE configHandler test\ndump.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27714\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=27621\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=27620\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=27609\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=27609\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=25507\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=27173\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=27452\n\nFile: python3.12.info,  Node: Tests<63>,  Next: Windows<61>,  Prev: IDLE<46>,  Up: Python 3 6 0 alpha 4\n\n1.22.78.4 Tests\n...............\n\n- bpo-25805(1): Skip a test in testpkgutil as needed that doesn't\nwork when 'name == main'.  Patch by SilentGhost.\n\n- bpo-27472(2): Add test.support.unixshell as the path to the\ndefault shell.\n\n- bpo-27369(3): In testpyexpat, avoid testing an error message\ndetail that changed in Expat 2.2.0.\n\n- bpo-27594(4): Prevent assertion error when running testast with\ncoverage enabled: ensure code object has a valid first line number.\nPatch suggested by Ivan Levkivskyi.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25805\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=27472\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=27369\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=27594\n\nFile: python3.12.info,  Node: Windows<61>,  Next: Build<67>,  Prev: Tests<63>,  Up: Python 3 6 0 alpha 4\n\n1.22.78.5 Windows\n.................\n\n- bpo-27647(1): Update bundled Tcl/Tk to 8.6.6.\n\n- bpo-27610(2): Adds PEP 514(3) metadata to Windows installer\n\n- bpo-27469(4): Adds a shell extension to the launcher so that drag\nand drop works correctly.\n\n- bpo-27309(5): Enables proper Windows styles in python[w].exe\nmanifest.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27647\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=27610\n\n(3) https://peps.python.org/pep-0514/\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=27469\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=27309\n\nFile: python3.12.info,  Node: Build<67>,  Prev: Windows<61>,  Up: Python 3 6 0 alpha 4\n\n1.22.78.6 Build\n...............\n\n- bpo-27713(1): Suppress spurious build warnings when updating\nimportlib's bootstrap files.  Patch by Xiang Zhang\n\n- bpo-25825(2): Correct the references to Modules/python.exp, which\nis required on AIX. The references were accidentally changed in\n3.5.0a1.\n\n- bpo-27453(3): CPP invocation in configure must use CPPFLAGS. Patch\nby Chi Hsuan Yen.\n\n- bpo-27641(4): The configure script now inserts comments into the\nmakefile to prevent the pgen and freezeimportlib executables from\nbeing cross-compiled.\n\n- bpo-26662(5): Set PYTHONFORGEN in configure as the Python program\nto be used for file generation during the build.\n\n- bpo-10910(6): Avoid C++ compilation errors on FreeBSD and OS X.\nAlso update FreedBSD version checks for the original ctype UTF-8\nworkaround.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27713\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=25825\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=27453\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=27641\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=26662\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=10910\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 6 0 alpha 3,  Next: Python 3 6 0 alpha 2,  Prev: Python 3 6 0 alpha 4,  Up: Changelog": {
            "content": "'Release date: 2016-07-11'\n\n* Menu:\n\n* Security: Security<39>.\n* Core and Builtins: Core and Builtins<71>.\n* Library: Library<71>.\n* IDLE: IDLE<47>.\n* C API: C API<57>.\n* Build: Build<68>.\n* Tools/Demos: Tools/Demos<39>.\n* Documentation: Documentation<65>.\n* Tests: Tests<64>.\n\nFile: python3.12.info,  Node: Security<39>,  Next: Core and Builtins<71>,  Up: Python 3 6 0 alpha 3\n\n1.22.79.1 Security\n..................\n\n- bpo-27278(1): Fix os.urandom() implementation using getrandom() on\nLinux.  Truncate size to INTMAX and loop until we collected enough\nrandom bytes, instead of casting a directly Pyssizet to int.\n\n- bpo-22636(2): Avoid shell injection problems with\nctypes.util.findlibrary().\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27278\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=22636\n\nFile: python3.12.info,  Node: Core and Builtins<71>,  Next: Library<71>,  Prev: Security<39>,  Up: Python 3 6 0 alpha 3\n\n1.22.79.2 Core and Builtins\n...........................\n\n- bpo-27473(1): Fixed possible integer overflow in bytes and\nbytearray concatenations.  Patch by Xiang Zhang.\n\n- bpo-23034(2): The output of a special Python build with defined\nCOUNTALLOCS, SHOWALLOCCOUNT or SHOWTRACKCOUNT macros is now\noff by default.  It can be re-enabled using the \"-X showalloccount\"\noption.  It now outputs to stderr instead of stdout.\n\n- bpo-27443(3): lengthhint() of bytearray iterators no longer\nreturn a negative integer for a resized bytearray.\n\n- bpo-27007(4): The fromhex() class methods of bytes and bytearray\nsubclasses now return an instance of corresponding subclass.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27473\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=23034\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=27443\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=27007\n\nFile: python3.12.info,  Node: Library<71>,  Next: IDLE<47>,  Prev: Core and Builtins<71>,  Up: Python 3 6 0 alpha 3\n\n1.22.79.3 Library\n.................\n\n- bpo-26844(1): Fix error message for imp.findmodule() to refer to\n'path' instead of 'name'.  Patch by Lev Maximov.\n\n- bpo-23804(2): Fix SSL zero-length recv() calls to not block and not\nraise an error about unclean EOF.\n\n- bpo-27466(3): Change time format returned by\nhttp.cookie.time2netscape, confirming the netscape cookie format\nand making it consistent with documentation.\n\n- bpo-21708(4): Deprecated dbm.dumb behavior that differs from common\ndbm behavior: creating a database in 'r' and 'w' modes and\nmodifying a database in 'r' mode.\n\n- bpo-26721(5): Change the socketserver.StreamRequestHandler.wfile\nattribute to implement BufferedIOBase.  In particular, the write()\nmethod no longer does partial writes.\n\n- bpo-22115(6): Added methods traceadd, traceremove and traceinfo\nin the tkinter.Variable class.  They replace old methods\ntracevariable, trace, tracevdelete and tracevinfo that use\nobsolete Tcl commands and might not work in future versions of Tcl.\nFixed old tracing methods: tracevdelete() with wrong mode no\nlonger break tracing, tracevinfo() now always returns a list of\npairs of strings, tracing in the \"u\" mode now works.\n\n- bpo-26243(7): Only the level argument to zlib.compress() is keyword\nargument now.  The first argument is positional-only.\n\n- bpo-27038(8): Expose the DirEntry type as os.DirEntry.  Code patch\nby Jelle Zijlstra.\n\n- bpo-27186(9): Update os.fspath()/PyOSFSPath() to check the return\nvalue of fspath() to be either str or bytes.\n\n- bpo-18726(10): All optional parameters of the dump(), dumps(),\nload() and loads() functions and JSONEncoder and JSONDecoder class\nconstructors in the json module are now keyword-only.\n\n- bpo-27319(11): Methods selectionset(), selectionadd(),\nselectionremove() and selectiontoggle() of ttk.TreeView now allow\npassing multiple items as multiple arguments instead of passing\nthem as a tuple.  Deprecated undocumented ability of calling the\nselection() method with arguments.\n\n- bpo-27079(12): Fixed curses.ascii functions isblank(), iscntrl()\nand ispunct().\n\n- bpo-27294(13): Numerical state in the repr for Tkinter event\nobjects is now represented as a combination of known flags.\n\n- bpo-27177(14): Match objects in the re module now support\nindex-like objects as group indices.  Based on patches by Jeroen\nDemeyer and Xiang Zhang.\n\n- bpo-26754(15): Some functions (compile() etc) accepted a filename\nargument encoded as an iterable of integers.  Now only strings and\nbyte-like objects are accepted.\n\n- bpo-26536(16): socket.ioctl now supports SIOLOOPBACKFASTPATH.\nPatch by Daniel Stokes.\n\n- bpo-27048(17): Prevents distutils failing on Windows when\nenvironment variables contain non-ASCII characters\n\n- bpo-27330(18): Fixed possible leaks in the ctypes module.\n\n- bpo-27238(19): Got rid of bare excepts in the turtle module.\nOriginal patch by Jelle Zijlstra.\n\n- bpo-27122(20): When an exception is raised within the context being\nmanaged by a contextlib.ExitStack() and one of the exit stack\ngenerators catches and raises it in a chain, do not re-raise the\noriginal exception when exiting, let the new chained one through.\nThis avoids the PEP 479(21) bug described in issue25782.\n\n- bpo-16864(22): sqlite3.Cursor.lastrowid now supports REPLACE\nstatement.  Initial patch by Alex LordThorsen.\n\n- bpo-26386(23): Fixed ttk.TreeView selection operations with item\nid's containing spaces.\n\n- bpo-8637(24): Honor a pager set by the env var MANPAGER (in\npreference to one set by the env var PAGER).\n\n- bpo-16182(25): Fix various functions in the \"readline\" module to\nuse the locale encoding, and fix getbegidx() and getendidx() to\nreturn code point indexes.\n\n- bpo-27392(26): Add loop.connectacceptedsocket().  Patch by Jim\nFulton.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26844\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=23804\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=27466\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=21708\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=26721\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=22115\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=26243\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=27038\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=27186\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=18726\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=27319\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=27079\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=27294\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=27177\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=26754\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=26536\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=27048\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=27330\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=27238\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=27122\n\n(21) https://peps.python.org/pep-0479/\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=16864\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=26386\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=8637\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=16182\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=27392\n\nFile: python3.12.info,  Node: IDLE<47>,  Next: C API<57>,  Prev: Library<71>,  Up: Python 3 6 0 alpha 3\n\n1.22.79.4 IDLE\n..............\n\n- bpo-27477(1): IDLE search dialogs now use ttk widgets.\n\n- bpo-27173(2): Add 'IDLE Modern Unix' to the built-in key sets.\nMake the default key set depend on the platform.  Add tests for the\nchanges to the config module.\n\n- bpo-27452(3): make command line \"idle-test> python testhelp.py\"\nwork.  file is relative when python is started in the file's\ndirectory.\n\n- bpo-27452(4): add line counter and crc to IDLE configHandler test\ndump.\n\n- bpo-27380(5): IDLE: add query.py with base Query dialog and ttk\nwidgets.  Module had subclasses SectionName, ModuleName, and\nHelpSource, which are used to get information from users by\nconfigdialog and file =>Load Module.  Each subclass has itw own\nvalidity checks.  Using ModuleName allows users to edit bad module\nnames instead of starting over.  Add tests and delete the two files\ncombined into the new one.\n\n- bpo-27372(6): Testidle no longer changes the locale.\n\n- bpo-27365(7): Allow non-ascii chars in IDLE NEWS.txt, for\ncontributor names.\n\n- bpo-27245(8): IDLE: Cleanly delete custom themes and key bindings.\nPreviously, when IDLE was started from a console or by import, a\ncascade of warnings was emitted.  Patch by Serhiy Storchaka.\n\n- bpo-24137(9): Run IDLE, testidle, and htest with tkinter default\nroot disabled.  Fix code and tests that fail with this restriction.\nFix htests to not create a second and redundant root and mainloop.\n\n- bpo-27310(10): Fix IDLE.app failure to launch on OS X due to\nvestigial import.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27477\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=27173\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=27452\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=27452\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=27380\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=27372\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=27365\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=27245\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=24137\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=27310\n\nFile: python3.12.info,  Node: C API<57>,  Next: Build<68>,  Prev: IDLE<47>,  Up: Python 3 6 0 alpha 3\n\n1.22.79.5 C API\n...............\n\n- bpo-26754(1): PyUnicodeFSDecoder() accepted a filename argument\nencoded as an iterable of integers.  Now only strings and byte-like\nobjects are accepted.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26754\n\nFile: python3.12.info,  Node: Build<68>,  Next: Tools/Demos<39>,  Prev: C API<57>,  Up: Python 3 6 0 alpha 3\n\n1.22.79.6 Build\n...............\n\n- bpo-28066(1): Fix the logic that searches build directories for\ngenerated include files when building outside the source tree.\n\n- bpo-27442(2): Expose the Android API level that python was built\nagainst, in sysconfig.getconfigvars() as 'ANDROIDAPILEVEL'.\n\n- bpo-27434(3): The interpreter that runs the cross-build, found in\nPATH, must now be of the same feature version (e.g.  3.6) as the\nsource being built.\n\n- bpo-26930(4): Update Windows builds to use OpenSSL 1.0.2h.\n\n- bpo-23968(5): Rename the platform directory from plat-$(MACHDEP) to\nplat-$(PLATFORMTRIPLET). Rename the config directory (LIBPL) from\nconfig-$(LDVERSION) to config-$(LDVERSION)-$(PLATFORMTRIPLET).\nInstall the platform specific sysconfigdata module into the\nplatform directory and rename it to include the ABIFLAGS.\n\n- Don't use largefile support for GNU/Hurd.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28066\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=27442\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=27434\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=26930\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=23968\n\nFile: python3.12.info,  Node: Tools/Demos<39>,  Next: Documentation<65>,  Prev: Build<68>,  Up: Python 3 6 0 alpha 3\n\n1.22.79.7 Tools/Demos\n.....................\n\n- bpo-27332(1): Fixed the type of the first argument of module-level\nfunctions generated by Argument Clinic.  Patch by Petr Viktorin.\n\n- bpo-27418(2): Fixed Tools/importbench/importbench.py.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27332\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=27418\n\nFile: python3.12.info,  Node: Documentation<65>,  Next: Tests<64>,  Prev: Tools/Demos<39>,  Up: Python 3 6 0 alpha 3\n\n1.22.79.8 Documentation\n.......................\n\n- bpo-19489(1): Moved the search box from the sidebar to the header\nand footer of each page.  Patch by Ammar Askar.\n\n- bpo-27285(2): Update documentation to reflect the deprecation of\n'pyvenv' and normalize on the term \"virtual environment\".  Patch by\nSteve Piercy.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=19489\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=27285\n\nFile: python3.12.info,  Node: Tests<64>,  Prev: Documentation<65>,  Up: Python 3 6 0 alpha 3\n\n1.22.79.9 Tests\n...............\n\n- bpo-27027(1): Added test.support.isandroid that is True when this\nis an Android build.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27027\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 6 0 alpha 2,  Next: Python 3 6 0 alpha 1,  Prev: Python 3 6 0 alpha 3,  Up: Changelog": {
            "content": "'Release date: 2016-06-13'\n\n* Menu:\n\n* Security: Security<40>.\n* Core and Builtins: Core and Builtins<72>.\n* Library: Library<72>.\n* IDLE: IDLE<48>.\n* Documentation: Documentation<66>.\n* Tests: Tests<65>.\n* Windows: Windows<62>.\n* Build: Build<69>.\n* C API: C API<58>.\n* Tools/Demos: Tools/Demos<40>.\n\nFile: python3.12.info,  Node: Security<40>,  Next: Core and Builtins<72>,  Up: Python 3 6 0 alpha 2\n\n1.22.80.1 Security\n..................\n\n- bpo-26556(1): Update expat to 2.1.1, fixes CVE-2015-1283.\n\n- Fix TLS stripping vulnerability in smtplib, CVE-2016-0772.\nReported by Team Oststrom.\n\n- bpo-26839(2): On Linux, *note os.urandom(): 276. now calls\n'getrandom()' with 'GRNDNONBLOCK' to fall back on reading\n'/dev/urandom' if the urandom entropy pool is not initialized yet.\nPatch written by Colm Buckley.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26556\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=26839\n\nFile: python3.12.info,  Node: Core and Builtins<72>,  Next: Library<72>,  Prev: Security<40>,  Up: Python 3 6 0 alpha 2\n\n1.22.80.2 Core and Builtins\n...........................\n\n- bpo-27095(1): Simplified MAKEFUNCTION and removed MAKECLOSURE\nopcodes.  Patch by Demur Rumed.\n\n- bpo-27190(2): Raise NotSupportedError if sqlite3 is older than\n3.3.1.  Patch by Dave Sawyer.\n\n- bpo-27286(3): Fixed compiling BUILDMAPUNPACKWITHCALL opcode.\nCalling function with generalized unpacking (PEP 448) and\nconflicting keyword names could cause undefined behavior.\n\n- bpo-27140(4): Added BUILDCONSTKEYMAP opcode.\n\n- bpo-27186(5): Add support for os.PathLike objects to open() (part\nof PEP 519(6)).\n\n- bpo-27066(7): Fixed SystemError if a custom opener (for open())\nreturns a negative number without setting an exception.\n\n- bpo-26983(8): float() now always return an instance of exact float.\nThe deprecation warning is emitted if float returns an instance\nof a strict subclass of float.  In a future versions of Python this\ncan be an error.\n\n- bpo-27097(9): Python interpreter is now about 7% faster due to\noptimized instruction decoding.  Based on patch by Demur Rumed.\n\n- bpo-26647(10): Python interpreter now uses 16-bit wordcode instead\nof bytecode.  Patch by Demur Rumed.\n\n- bpo-23275(11): Allow assigning to an empty target list in round\nbrackets: () = iterable.\n\n- bpo-27243(12): Update the aiter protocol: instead of returning\nan awaitable that resolves to an asynchronous iterator, the\nasynchronous iterator should be returned directly.  Doing the\nformer will trigger a PendingDeprecationWarning.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27095\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=27190\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=27286\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=27140\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=27186\n\n(6) https://peps.python.org/pep-0519/\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=27066\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=26983\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=27097\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=26647\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=23275\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=27243\n\nFile: python3.12.info,  Node: Library<72>,  Next: IDLE<48>,  Prev: Core and Builtins<72>,  Up: Python 3 6 0 alpha 2\n\n1.22.80.3 Library\n.................\n\n- Comment out socket (SOREUSEPORT) and posix (OSHLOCK, OEXLOCK)\nconstants exposed on the API which are not implemented on GNU/Hurd.\nThey would not work at runtime anyway.\n\n- bpo-27025(1): Generated names for Tkinter widgets are now more\nmeaningful and recognizable.\n\n- bpo-25455(2): Fixed crashes in repr of recursive\nElementTree.Element and functools.partial objects.\n\n- bpo-27294(3): Improved repr for Tkinter event objects.\n\n- bpo-20508(4): Improve exception message of\nIPv{4,6}Network.getitem.  Patch by Gareth Rees.\n\n- bpo-21386(5): Implement missing IPv4Address.isglobal property.  It\nwas documented since 07a5610bae9d.  Initial patch by Roger Luethi.\n\n- bpo-27029(6): Removed deprecated support of universal newlines mode\nfrom ZipFile.open().\n\n- bpo-27030(7): Unknown escapes consisting of ''\\'' and an ASCII\nletter in regular expressions now are errors.  The re.LOCALE flag\nnow can be used only with bytes patterns.\n\n- bpo-27186(8): Add os.PathLike support to DirEntry (part of PEP\n519(9)).  Initial patch by Jelle Zijlstra.\n\n- bpo-20900(10): distutils register command now decodes HTTP\nresponses correctly.  Initial patch by ingrid.\n\n- bpo-27186(11): Add os.PathLike support to pathlib, removing its\nprovisional status (part of PEP 519).  Initial patch by Dusty\nPhillips.\n\n- bpo-27186(12): Add support for os.PathLike objects to os.fsencode()\nand os.fsdecode() (part of PEP 519(13)).\n\n- bpo-27186(14): Introduce os.PathLike and os.fspath() (part of PEP\n519(15)).\n\n- A new version of typing.py provides several new classes and\nfeatures: @overload outside stubs, Reversible, DefaultDict, Text,\nContextManager, Type[], NewType(), TYPECHECKING, and numerous bug\nfixes (note that some of the new features are not yet implemented\nin mypy or other static analyzers).  Also classes for PEP 492(16)\n(Awaitable, AsyncIterable, AsyncIterator) have been added (in fact\nthey made it into 3.5.1 but were never mentioned).\n\n- bpo-25738(17): Stop http.server.BaseHTTPRequestHandler.senderror()\nfrom sending a message body for 205 Reset Content.  Also, don't\nsend Content header fields in responses that don't have a body.\nPatch by Susumu Koshiba.\n\n- bpo-21313(18): Fix the \"platform\" module to tolerate when\nsys.version contains truncated build information.\n\n- bpo-23883(19): Added missing APIs to all to match the\ndocumented APIs for the following modules: cgi, mailbox, mimetypes,\nplistlib and smtpd.  Patches by Jacek Ko??odziej.\n\n- bpo-27164(20): In the zlib module, allow decompressing raw Deflate\nstreams with a predefined zdict.  Based on patch by Xiang Zhang.\n\n- bpo-24291(21): Fix wsgiref.simpleserver.WSGIRequestHandler to\ncompletely write data to the client.  Previously it could do\npartial writes and truncate data.  Also,\nwsgiref.handler.ServerHandler can now handle stdout doing partial\nwrites, but this is deprecated.\n\n- bpo-21272(22): Use sysconfigdata.py to initialize\ndistutils.sysconfig.\n\n- bpo-19611(23): *note inspect: 78. now reports the implicit '.0'\nparameters generated by the compiler for comprehension and\ngenerator expression scopes as if they were positional-only\nparameters called 'implicit0'.  Patch by Jelle Zijlstra.\n\n- bpo-26809(24): Add 'all' to *note string: cd.  Patch by Emanuel\nBarry.\n\n- bpo-26373(25): subprocess.Popen.communicate now correctly ignores\nBrokenPipeError when the child process dies before .communicate()\nis called in more/all circumstances.\n\n- signal, socket, and ssl module IntEnum constant name lookups now\nreturn a consistent name for values having multiple names.  Ex:\nsignal.Signals(6) now refers to itself as signal.SIGALRM rather\nthan flipping between that and signal.SIGIOT based on the\ninterpreter's hash randomization seed.\n\n- bpo-27167(26): Clarify the subprocess.CalledProcessError error\nmessage text when the child process died due to a signal.\n\n- bpo-25931(27): Don't define socketserver.Forking* names on\nplatforms such as Windows that do not support os.fork().\n\n- bpo-21776(28): distutils.upload now correctly handles HTTPError.\nInitial patch by Claudiu Popa.\n\n- bpo-26526(29): Replace custom parse tree validation in the parser\nmodule with a simple DFA validator.\n\n- bpo-27114(30): Fix SSLContext.loadwindowsstorecerts fails with\nPermissionError\n\n- bpo-18383(31): Avoid creating duplicate filters when using\nfilterwarnings and simplefilter.  Based on patch by Alex Shkop.\n\n- bpo-23026(32): winreg.QueryValueEx() now return an integer for\nREGQWORD type.\n\n- bpo-26741(33): subprocess.Popen destructor now emits a\nResourceWarning warning if the child process is still running.\n\n- bpo-27056(34): Optimize pickle.load() and pickle.loads(), up to 10%\nfaster to deserialize a lot of small objects.\n\n- bpo-21271(35): New keyword only parameters in resetmock call.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27025\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=25455\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=27294\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=20508\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=21386\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=27029\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=27030\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=27186\n\n(9) https://peps.python.org/pep-0519/\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=20900\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=27186\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=27186\n\n(13) https://peps.python.org/pep-0519/\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=27186\n\n(15) https://peps.python.org/pep-0519/\n\n(16) https://peps.python.org/pep-0492/\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=25738\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=21313\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=23883\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=27164\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=24291\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=21272\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=19611\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=26809\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=26373\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=27167\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=25931\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=21776\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=26526\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=27114\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=18383\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=23026\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=26741\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=27056\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=21271\n\nFile: python3.12.info,  Node: IDLE<48>,  Next: Documentation<66>,  Prev: Library<72>,  Up: Python 3 6 0 alpha 2\n\n1.22.80.4 IDLE\n..............\n\n- bpo-5124(1): Paste with text selected now replaces the selection on\nX11.  This matches how paste works on Windows, Mac, most modern\nLinux apps, and ttk widgets.  Original patch by Serhiy Storchaka.\n\n- bpo-24750(2): Switch all scrollbars in IDLE to ttk versions.  Where\nneeded, minimal tests are added to cover changes.\n\n- bpo-24759(3): IDLE requires tk 8.5 and availability ttk widgets.\nDelete now unneeded tk version tests and code for older versions.\nAdd test for IDLE syntax colorizer.\n\n- bpo-27239(4): idlelib.macosx.isXyzTk functions initialize as\nneeded.\n\n- bpo-27262(5): move Aqua unbinding code, which enable context menus,\nto macosx.\n\n- bpo-24759(6): Make clear in idlelib.idletest.init that the\ndirectory is a private implementation of test.testidle and tool\nfor maintainers.\n\n- bpo-27196(7): Stop 'ThemeChanged' warnings when running IDLE tests.\nThese persisted after other warnings were suppressed in #20567.\nApply Serhiy Storchaka's updateidletasks solution to four test\nfiles.  Record this additional advice in idletest/README.txt\n\n- bpo-20567(8): Revise idletest/README.txt with advice about\navoiding tk warning messages from tests.  Apply advice to several\nIDLE tests.\n\n- bpo-24225(9): Update idlelib/README.txt with new file names and\nevent handlers.\n\n- bpo-27156(10): Remove obsolete code not used by IDLE.\n\n- bpo-27117(11): Make colorizer htest and turtledemo work with dark\nthemes.  Move code for configuring text widget colors to a new\nfunction.\n\n- bpo-24225(12): Rename many 'idlelib/*.py' and 'idletest/test*.py'\nfiles.  Edit files to replace old names with new names when the old\nname referred to the module rather than the class it contained.\nSee the issue and IDLE section in What's New in 3.6 for more.\n\n- bpo-26673(13): When tk reports font size as 0, change to size 10.\nSuch fonts on Linux prevented the configuration dialog from\nopening.\n\n- bpo-21939(14): Add test for IDLE's percolator.  Original patch by\nSaimadhav Heblikar.\n\n- bpo-21676(15): Add test for IDLE's replace dialog.  Original patch\nby Saimadhav Heblikar.\n\n- bpo-18410(16): Add test for IDLE's search dialog.  Original patch\nby Westley Mart??nez.\n\n- bpo-21703(17): Add test for undo delegator.  Patch mostly by\nSaimadhav Heblikar .\n\n- bpo-27044(18): Add ConfigDialog.removevarcallbacks to stop memory\nleaks.\n\n- bpo-23977(19): Add more asserts to testdelegator.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=5124\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=24750\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=24759\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=27239\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=27262\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=24759\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=27196\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=20567\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=24225\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=27156\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=27117\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=24225\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=26673\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=21939\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=21676\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=18410\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=21703\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=27044\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=23977\n\nFile: python3.12.info,  Node: Documentation<66>,  Next: Tests<65>,  Prev: IDLE<48>,  Up: Python 3 6 0 alpha 2\n\n1.22.80.5 Documentation\n.......................\n\n- bpo-16484(1): Change the default PYTHONDOCS URL to \"https:\", and\nfix the resulting links to use lowercase.  Patch by Sean Rodman,\ntest by Kaushik Nadikuditi.\n\n- bpo-24136(2): Document the new PEP 448(3) unpacking syntax of 3.5.\n\n- bpo-22558(4): Add remaining doc links to source code for\nPython-coded modules.  Patch by Yoni Lavi.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=16484\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=24136\n\n(3) https://peps.python.org/pep-0448/\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=22558\n\nFile: python3.12.info,  Node: Tests<65>,  Next: Windows<62>,  Prev: Documentation<66>,  Up: Python 3 6 0 alpha 2\n\n1.22.80.6 Tests\n...............\n\n- bpo-25285(1): regrtest now uses subprocesses when the -j1 command\nline option is used: each test file runs in a fresh child process.\nBefore, the -j1 option was ignored.\n\n- bpo-25285(2): Tools/buildbot/test.bat script now uses -j1 by\ndefault to run each test file in fresh child process.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25285\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=25285\n\nFile: python3.12.info,  Node: Windows<62>,  Next: Build<69>,  Prev: Tests<65>,  Up: Python 3 6 0 alpha 2\n\n1.22.80.7 Windows\n.................\n\n- bpo-27064(1): The py.exe launcher now defaults to Python 3.  The\nWindows launcher 'py.exe' no longer prefers an installed Python 2\nversion over Python 3 by default when used interactively.\n\n- bpo-17500(2): Remove unused and outdated icons.  (See also:\n'https://github.com/python/pythondotorg/issues/945')\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27064\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=17500\n\nFile: python3.12.info,  Node: Build<69>,  Next: C API<58>,  Prev: Windows<62>,  Up: Python 3 6 0 alpha 2\n\n1.22.80.8 Build\n...............\n\n- bpo-27229(1): Fix the cross-compiling pgen rule for in-tree builds.\nPatch by Xavier de Gaye.\n\n- bpo-26930(2): Update OS X 10.5+ 32-bit-only installer to build and\nlink with OpenSSL 1.0.2h.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27229\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=26930\n\nFile: python3.12.info,  Node: C API<58>,  Next: Tools/Demos<40>,  Prev: Build<69>,  Up: Python 3 6 0 alpha 2\n\n1.22.80.9 C API\n...............\n\n- bpo-27186(1): Add the PyOSFSPath() function (part of PEP 519(2)).\n\n- bpo-26282(3): PyArgParseTupleAndKeywords() now supports\npositional-only parameters.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27186\n\n(2) https://peps.python.org/pep-0519/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=26282\n\nFile: python3.12.info,  Node: Tools/Demos<40>,  Prev: C API<58>,  Up: Python 3 6 0 alpha 2\n\n1.22.80.10 Tools/Demos\n......................\n\n- bpo-26282(1): Argument Clinic now supports positional-only and\nkeyword parameters in the same function.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26282\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 6 0 alpha 1,  Next: Python 3 5 5 final,  Prev: Python 3 6 0 alpha 2,  Up: Changelog": {
            "content": "'Release date: 2016-05-16'\n\n* Menu:\n\n* Security: Security<41>.\n* Core and Builtins: Core and Builtins<73>.\n* Library: Library<73>.\n* IDLE: IDLE<49>.\n* Documentation: Documentation<67>.\n* Tests: Tests<66>.\n* Build: Build<70>.\n* Windows: Windows<63>.\n* Tools/Demos: Tools/Demos<41>.\n* C API: C API<59>.\n\nFile: python3.12.info,  Node: Security<41>,  Next: Core and Builtins<73>,  Up: Python 3 6 0 alpha 1\n\n1.22.81.1 Security\n..................\n\n- bpo-26657(1): Fix directory traversal vulnerability with\nhttp.server on Windows.  This fixes a regression that was\nintroduced in 3.3.4rc1 and 3.4.0rc1.  Based on patch by Philipp\nHagemeister.\n\n- bpo-26313(2): ssl.py loadwindowsstorecerts fails if windows\ncert store is empty.  Patch by Baji.\n\n- bpo-25939(3): On Windows open the cert store readonly in\nssl.enumcertificates.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26657\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=26313\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=25939\n\nFile: python3.12.info,  Node: Core and Builtins<73>,  Next: Library<73>,  Prev: Security<41>,  Up: Python 3 6 0 alpha 1\n\n1.22.81.2 Core and Builtins\n...........................\n\n- bpo-20041(1): Fixed TypeError when frame.ftrace is set to None.\nPatch by Xavier de Gaye.\n\n- bpo-26168(2): Fixed possible refleaks in failing PyBuildValue()\nwith the \"N\" format unit.\n\n- bpo-26991(3): Fix possible refleak when creating a function with\nannotations.\n\n- bpo-27039(4): Fixed bytearray.remove() for values greater than 127.\nBased on patch by Joe Jevnik.\n\n- bpo-23640(5): int.frombytes() no longer bypasses constructors for\nsubclasses.\n\n- bpo-27005(6): Optimized the float.fromhex() class method for exact\nfloat.  It is now 2 times faster.\n\n- bpo-18531(7): Single var-keyword argument of dict subtype was\npassed unscathed to the C-defined function.  Now it is converted to\nexact dict.\n\n- bpo-26811(8): gc.getobjects() no longer contains a broken tuple\nwith NULL pointer.\n\n- bpo-20120(9): Use RawConfigParser for .pypirc parsing, removing\nsupport for interpolation unintentionally added with move to Python\n3.  Behavior no longer does any interpolation in .pypirc files,\nmatching behavior in Python 2.7 and Setuptools 19.0.\n\n- bpo-26249(10): Memory functions of the *note PyMemMalloc(): ab1.\ndomain (*note PYMEMDOMAINMEM: ab4.) now use the *note pymalloc\nallocator: b61. rather than system 'malloc()'.  Applications\ncalling *note PyMemMalloc(): ab1. without holding the GIL can now\ncrash: use 'PYTHONMALLOC=debug' environment variable to validate\nthe usage of memory allocators in your application.\n\n- bpo-26802(11): Optimize function calls only using unpacking like\n'func(*tuple)' (no other positional argument, no keyword): avoid\ncopying the tuple.  Patch written by Joe Jevnik.\n\n- bpo-26659(12): Make the builtin slice type support cycle\ncollection.\n\n- bpo-26718(13): super.init no longer leaks memory if called\nmultiple times.  NOTE: A direct call of super.init is not\nendorsed!\n\n- bpo-27138(14): Fix the doc comment for FileFinder.findspec().\n\n- bpo-27147(15): Mention PEP 420(16) in the importlib docs.\n\n- bpo-25339(17): PYTHONIOENCODING now has priority over locale in\nsetting the error handler for stdin and stdout.\n\n- bpo-26494(18): Fixed crash on iterating exhausting iterators.\nAffected classes are generic sequence iterators, iterators of str,\nbytes, bytearray, list, tuple, set, frozenset, dict, OrderedDict,\ncorresponding views and os.scandir() iterator.\n\n- bpo-26574(19): Optimize 'bytes.replace(b'', b'.')' and\n'bytearray.replace(b'', b'.')'.  Patch written by Josh Snider.\n\n- bpo-26581(20): If coding cookie is specified multiple times on a\nline in Python source code file, only the first one is taken to\naccount.\n\n- bpo-19711(21): Add tests for reloading namespace packages.\n\n- bpo-21099(22): Switch applicable importlib tests to use PEP 451(23)\nAPI.\n\n- bpo-26563(24): Debug hooks on Python memory allocators now raise a\nfatal error if functions of the *note PyMemMalloc(): ab1. family\nare called without holding the GIL.\n\n- bpo-26564(25): On error, the debug hooks on Python memory\nallocators now use the *note tracemalloc: fa. module to get the\ntraceback where a memory block was allocated.\n\n- bpo-26558(26): The debug hooks on Python memory allocator *note\nPyObjectMalloc(): ab3. now detect when functions are called\nwithout holding the GIL.\n\n- bpo-26516(27): Add *note PYTHONMALLOC: aaf. environment variable to\nset the Python memory allocators and/or install debug hooks.\n\n- bpo-26516(28): The *note PyMemSetupDebugHooks(): ab5. function can\nnow also be used on Python compiled in release mode.\n\n- bpo-26516(29): The *note PYTHONMALLOCSTATS: 18d9. environment\nvariable can now also be used on Python compiled in release mode.\nIt now has no effect if set to an empty string.\n\n- bpo-26516(30): In debug mode, debug hooks are now also installed on\nPython memory allocators when Python is configured without\npymalloc.\n\n- bpo-26464(31): Fix str.translate() when string is ASCII and first\nreplacements removes character, but next replacement uses a\nnon-ASCII character or a string longer than 1 character.\nRegression introduced in Python 3.5.0.\n\n- bpo-22836(32): Ensure exception reports from PyErrDisplay() and\nPyErrWriteUnraisable() are sensible even when formatting them\nproduces secondary errors.  This affects the reports produced by\nsys.excepthook() and when del() raises an exception.\n\n- bpo-26302(33): Correct behavior to reject comma as a legal\ncharacter for cookie names.\n\n- bpo-26136(34): Upgrade the warning when a generator raises\nStopIteration from PendingDeprecationWarning to DeprecationWarning.\nPatch by Anish Shah.\n\n- bpo-26204(35): The compiler now ignores all constant statements:\nbytes, str, int, float, complex, name constants (None, False,\nTrue), Ellipsis and ast.Constant; not only str and int.  For\nexample, '1.0' is now ignored in 'def f(): 1.0'.\n\n- bpo-4806(36): Avoid masking the original TypeError exception when\nusing star ('*') unpacking in function calls.  Based on patch by\nHagen Fu\"rstenau and Daniel Urban.\n\n- bpo-26146(37): Add a new kind of AST node: 'ast.Constant'.  It can\nbe used by external AST optimizers, but the compiler does not emit\ndirectly such node.\n\n- bpo-23601(38): Sped-up allocation of dict key objects by using\nPython's small object allocator.  (Contributed by Julian Taylor.)\n\n- bpo-18018(39): Import raises ImportError instead of SystemError if\na relative import is attempted without a known parent package.\n\n- bpo-25843(40): When compiling code, don't merge constants if they\nare equal but have a different types.  For example, 'f1, f2 =\nlambda: 1, lambda: 1.0' is now correctly compiled to two different\nfunctions: 'f1()' returns '1' ('int') and 'f2()' returns '1.0'\n('float'), even if '1' and '1.0' are equal.\n\n- bpo-26107(41): The format of the 'colnotab' attribute of code\nobjects changes to support negative line number delta.\n\n- bpo-26154(42): Add a new private PyThreadStateUncheckedGet()\nfunction to get the current Python thread state, but don't issue a\nfatal error if it is NULL. This new function must be used instead\nof accessing directly the PyThreadStateCurrent variable.  The\nvariable is no more exposed since Python 3.5.1 to hide the exact\nimplementation of atomic C types, to avoid compiler issues.\n\n- bpo-25791(43): If package != spec.parent or if neither\npackage or spec are defined then ImportWarning is raised.\n\n- bpo-22995(44): [UPDATE] Comment out the one of the pickleability\ntests in PyObjectGetState() due to regressions observed in\nCython-based projects.\n\n- bpo-25961(45): Disallowed null characters in the type name.\n\n- bpo-25973(46): Fix segfault when an invalid nonlocal statement\nbinds a name starting with two underscores.\n\n- bpo-22995(47): Instances of extension types with a state that\naren't subclasses of list or dict and haven't implemented any\npickle-related methods (reduce, reduceex, getnewargs,\ngetnewargsex, or getstate), can no longer be pickled.\nIncluding memoryview.\n\n- bpo-20440(48): Massive replacing unsafe attribute setting code with\nspecial macro PySETREF.\n\n- bpo-25766(49): Special method bytes() now works in str\nsubclasses.\n\n- bpo-25421(50): sizeof methods of builtin types now use dynamic\nbasic size.  This allows sys.getsize() to work correctly with their\nsubclasses with slots defined.\n\n- bpo-25709(51): Fixed problem with in-place string concatenation and\nutf-8 cache.\n\n- bpo-5319(52): New PyFinalizeEx() API allowing Python to set an\nexit status of 120 on failure to flush buffered streams.\n\n- bpo-25485(53): telnetlib.Telnet is now a context manager.\n\n- bpo-24097(54): Fixed crash in object.reduce() if slot name is\nfreed inside getattr.\n\n- bpo-24731(55): Fixed crash on converting objects with special\nmethods bytes, trunc, and float returning instances of\nsubclasses of bytes, int, and float to subclasses of bytes, int,\nand float correspondingly.\n\n- bpo-25630(56): Fix a possible segfault during argument parsing in\nfunctions that accept filesystem paths.\n\n- bpo-23564(57): Fixed a partially broken sanity check in the\nposixsubprocess internals regarding how fdstopass were passed to\nthe child.  The bug had no actual impact as subprocess.py already\navoided it.\n\n- bpo-25388(58): Fixed tokenizer crash when processing undecodable\nsource code with a null byte.\n\n- bpo-25462(59): The hash of the key now is calculated only once in\nmost operations in C implementation of OrderedDict.\n\n- bpo-22995(60): Default implementation of reduce and\nreduceex now rejects builtin types with not defined new.\n\n- bpo-24802(61): Avoid buffer overreads when int(), float(),\ncompile(), exec() and eval() are passed bytes-like objects.  These\nobjects are not necessarily terminated by a null byte, but the\nfunctions assumed they were.\n\n- bpo-25555(62): Fix parser and AST: fill lineno and coloffset of\n\"arg\" node when compiling AST from Python objects.\n\n- bpo-24726(63): Fixed a crash and leaking NULL in repr() of\nOrderedDict that was mutated by direct calls of dict methods.\n\n- bpo-25449(64): Iterating OrderedDict with keys with unstable hash\nnow raises KeyError in C implementations as well as in Python\nimplementation.\n\n- bpo-25395(65): Fixed crash when highly nested OrderedDict\nstructures were garbage collected.\n\n- bpo-25401(66): Optimize bytes.fromhex() and bytearray.fromhex():\nthey are now between 2x and 3.5x faster.\n\n- bpo-25399(67): Optimize bytearray % args using the new private\nPyBytesWriter API. Formatting is now between 2.5 and 5 times\nfaster.\n\n- bpo-25274(68): sys.setrecursionlimit() now raises a RecursionError\nif the new recursion limit is too low depending at the current\nrecursion depth.  Modify also the \"lower-water mark\" formula to\nmake it monotonic.  This mark is used to decide when the overflowed\nflag of the thread state is reset.\n\n- bpo-24402(69): Fix input() to prompt to the redirected stdout when\nsys.stdout.fileno() fails.\n\n- bpo-25349(70): Optimize bytes % args using the new private\nPyBytesWriter API. Formatting is now up to 2 times faster.\n\n- bpo-24806(71): Prevent builtin types that are not allowed to be\nsubclassed from being subclassed through multiple inheritance.\n\n- bpo-25301(72): The UTF-8 decoder is now up to 15 times as fast for\nerror handlers: 'ignore', 'replace' and 'surrogateescape'.\n\n- bpo-24848(73): Fixed a number of bugs in UTF-7 decoding of\nmisformed data.\n\n- bpo-25267(74): The UTF-8 encoder is now up to 75 times as fast for\nerror handlers: 'ignore', 'replace', 'surrogateescape',\n'surrogatepass'.  Patch co-written with Serhiy Storchaka.\n\n- bpo-25280(75): Import trace messages emitted in verbose (-v) mode\nare no longer formatted twice.\n\n- bpo-25227(76): Optimize ASCII and latin1 encoders with the\n'surrogateescape' error handler: the encoders are now up to 3 times\nas fast.  Initial patch written by Serhiy Storchaka.\n\n- bpo-25003(77): On Solaris 11.3 or newer, os.urandom() now uses the\ngetrandom() function instead of the getentropy() function.  The\ngetentropy() function is blocking to generate very good quality\nentropy, os.urandom() doesn't need such high-quality entropy.\n\n- bpo-9232(78): Modify Python's grammar to allow trailing commas in\nthe argument list of a function declaration.  For example, \"def\nf(*, a = 3,): pass\" is now legal.  Patch from Mark Dickinson.\n\n- bpo-24965(79): Implement PEP 498(80) \"Literal String\nInterpolation\".  This allows you to embed expressions inside\nf-strings, which are converted to normal strings at run time.\nGiven x=3, then f'value={x}' == 'value=3'.  Patch by Eric V. Smith.\n\n- bpo-26478(81): Fix semantic bugs when using binary operators with\ndictionary views and tuples.\n\n- bpo-26171(82): Fix possible integer overflow and heap corruption in\nzipimporter.getdata().\n\n- bpo-25660(83): Fix TAB key behaviour in REPL with readline.\n\n- bpo-26288(84): Optimize PyLongAsDouble.\n\n- bpo-26289(85): Optimize floor and modulo division for single-digit\nlongs.  Microbenchmarks show 2-2.5x improvement.  Built-in 'divmod'\nfunction is now also ~10% faster.  (See also: bpo-26315(86))\n\n- bpo-25887(87): Raise a RuntimeError when a coroutine object is\nawaited more than once.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=20041\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=26168\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=26991\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=27039\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=23640\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=27005\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=18531\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=26811\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=20120\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=26249\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=26802\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=26659\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=26718\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=27138\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=27147\n\n(16) https://peps.python.org/pep-0420/\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=25339\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=26494\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=26574\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=26581\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=19711\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=21099\n\n(23) https://peps.python.org/pep-0451/\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=26563\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=26564\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=26558\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=26516\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=26516\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=26516\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=26516\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=26464\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=22836\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=26302\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=26136\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=26204\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=4806\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=26146\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=23601\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=18018\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=25843\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=26107\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=26154\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=25791\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=22995\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=25961\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=25973\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=22995\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=20440\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=25766\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=25421\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=25709\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=5319\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=25485\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=24097\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=24731\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=25630\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=23564\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=25388\n\n(59) https://bugs.python.org/issue?@action=redirect&bpo=25462\n\n(60) https://bugs.python.org/issue?@action=redirect&bpo=22995\n\n(61) https://bugs.python.org/issue?@action=redirect&bpo=24802\n\n(62) https://bugs.python.org/issue?@action=redirect&bpo=25555\n\n(63) https://bugs.python.org/issue?@action=redirect&bpo=24726\n\n(64) https://bugs.python.org/issue?@action=redirect&bpo=25449\n\n(65) https://bugs.python.org/issue?@action=redirect&bpo=25395\n\n(66) https://bugs.python.org/issue?@action=redirect&bpo=25401\n\n(67) https://bugs.python.org/issue?@action=redirect&bpo=25399\n\n(68) https://bugs.python.org/issue?@action=redirect&bpo=25274\n\n(69) https://bugs.python.org/issue?@action=redirect&bpo=24402\n\n(70) https://bugs.python.org/issue?@action=redirect&bpo=25349\n\n(71) https://bugs.python.org/issue?@action=redirect&bpo=24806\n\n(72) https://bugs.python.org/issue?@action=redirect&bpo=25301\n\n(73) https://bugs.python.org/issue?@action=redirect&bpo=24848\n\n(74) https://bugs.python.org/issue?@action=redirect&bpo=25267\n\n(75) https://bugs.python.org/issue?@action=redirect&bpo=25280\n\n(76) https://bugs.python.org/issue?@action=redirect&bpo=25227\n\n(77) https://bugs.python.org/issue?@action=redirect&bpo=25003\n\n(78) https://bugs.python.org/issue?@action=redirect&bpo=9232\n\n(79) https://bugs.python.org/issue?@action=redirect&bpo=24965\n\n(80) https://peps.python.org/pep-0498/\n\n(81) https://bugs.python.org/issue?@action=redirect&bpo=26478\n\n(82) https://bugs.python.org/issue?@action=redirect&bpo=26171\n\n(83) https://bugs.python.org/issue?@action=redirect&bpo=25660\n\n(84) https://bugs.python.org/issue?@action=redirect&bpo=26288\n\n(85) https://bugs.python.org/issue?@action=redirect&bpo=26289\n\n(86) https://bugs.python.org/issue?@action=redirect&bpo=26315\n\n(87) https://bugs.python.org/issue?@action=redirect&bpo=25887\n\nFile: python3.12.info,  Node: Library<73>,  Next: IDLE<49>,  Prev: Core and Builtins<73>,  Up: Python 3 6 0 alpha 1\n\n1.22.81.3 Library\n.................\n\n- bpo-27057(1): Fix os.setinheritable() on Android, ioctl() is\nblocked by SELinux and fails with EACCESS. The function now falls\nback to fcntl().  Patch written by Micha?? Bednarski.\n\n- bpo-27014(2): Fix infinite recursion using typing.py.  Thanks to\nKalle Tuure!\n\n- bpo-27031(3): Removed dummy methods in Tkinter widget classes:\ntkmenuBar() and tkbindForTraversal().\n\n- bpo-14132(4): Fix urllib.request redirect handling when the target\nonly has a query string.  Original fix by J??n Janech.\n\n- bpo-17214(5): The \"urllib.request\" module now percent-encodes\nnon-ASCII bytes found in redirect target URLs.  Some servers send\nLocation header fields with non-ASCII bytes, but \"http.client\"\nrequires the request target to be ASCII-encodable, otherwise a\nUnicodeEncodeError is raised.  Based on patch by Christian Heimes.\n\n- bpo-27033(6): The default value of the decodedata parameter for\nsmtpd.SMTPChannel and smtpd.SMTPServer constructors is changed to\nFalse.\n\n- bpo-27034(7): Removed deprecated class asynchat.fifo.\n\n- bpo-26870(8): Added readline.setautohistory(), which can stop\nentries being automatically added to the history list.  Based on\npatch by Tyler Crompton.\n\n- bpo-26039(9): zipfile.ZipFile.open() can now be used to write data\ninto a ZIP file, as well as for extracting data.  Patch by Thomas\nKluyver.\n\n- bpo-26892(10): Honor debuglevel flag in urllib.request.HTTPHandler.\nPatch contributed by Chi Hsuan Yen.\n\n- bpo-22274(11): In the subprocess module, allow stderr to be\nredirected to stdout even when stdout is not redirected.  Patch by\nAkira Li.\n\n- bpo-26807(12): mockopen 'files' no longer error on readline at end\nof file.  Patch from Yolanda Robla.\n\n- bpo-25745(13): Fixed leaking a userptr in curses panel destructor.\n\n- bpo-26977(14): Removed unnecessary, and ignored, call to sum of\nsquares helper in statistics.pvariance.\n\n- bpo-26002(15): Use bisect in statistics.median instead of a linear\nsearch.  Patch by Upendra Kuma.\n\n- bpo-25974(16): Make use of new Decimal.asintegerratio() method in\nstatistics module.  Patch by Stefan Krah.\n\n- bpo-26996(17): Add secrets module as described in PEP 506(18).\n\n- bpo-26881(19): The modulefinder module now supports extended opcode\narguments.\n\n- bpo-23815(20): Fixed crashes related to directly created instances\nof types in tkinter and curses.panel modules.\n\n- bpo-17765(21): weakref.ref() no longer silently ignores keyword\narguments.  Patch by Georg Brandl.\n\n- bpo-26873(22): xmlrpc now raises ResponseError on unsupported type\ntags instead of silently return incorrect result.\n\n- bpo-26915(23): The contains methods in the collections ABCs now\ncheck for identity before checking equality.  This better matches\nthe behavior of the concrete classes, allows sensible handling of\nNaNs, and makes it easier to reason about container invariants.\n\n- bpo-26711(24): Fixed the comparison of plistlib.Data with other\ntypes.\n\n- bpo-24114(25): Fix an uninitialized variable in 'ctypes.util'.  The\nbug only occurs on SunOS when the ctypes implementation searches\nfor the 'crle' program.  Patch by Xiang Zhang.  Tested on SunOS by\nKees Bos.\n\n- bpo-26864(26): In urllib.request, change the proxy bypass host\nchecking against noproxy to be case-insensitive, and to not match\nunrelated host names that happen to have a bypassed hostname as a\nsuffix.  Patch by Xiang Zhang.\n\n- bpo-24902(27): Print server URL on http.server startup.  Initial\npatch by Felix Kaiser.\n\n- bpo-25788(28): fileinput.hookencoded() now supports an \"errors\"\nargument for passing to open.  Original patch by Joseph Hackman.\n\n- bpo-26634(29): recursiverepr() now sets qualname of wrapper.\nPatch by Xiang Zhang.\n\n- bpo-26804(30): urllib.request will prefer lowercase proxy\nenvironment variables over UPPERCASE or MixedCase ones.  Patch\ncontributed by Hans-Peter Jansen.\n\n- bpo-26837(31): assertSequenceEqual() now correctly outputs\nnon-stringified differing items (like bytes in the -b mode).  This\naffects assertListEqual() and assertTupleEqual().\n\n- bpo-26041(32): Remove \"will be removed in Python 3.7\" from\ndeprecation messages of platform.dist() and\nplatform.linuxdistribution().  Patch by Kumaripaba Miyurusara\nAthukorala.\n\n- bpo-26822(33): itemgetter, attrgetter and methodcaller objects no\nlonger silently ignore keyword arguments.\n\n- bpo-26733(34): Disassembling a class now disassembles class and\nstatic methods.  Patch by Xiang Zhang.\n\n- bpo-26801(35): Fix error handling in *note\nshutil.getterminalsize(): f73, catch *note AttributeError: 395.\ninstead of *note NameError: 144.  Patch written by Emanuel Barry.\n\n- bpo-24838(36): tarfile's ustar and gnu formats now correctly\ncalculate name and link field limits for multibyte character\nencodings like utf-8.\n\n- bpo-26717(37): Stop encoding Latin-1-ized WSGI paths with UTF-8.\nPatch by Anthony Sottile.\n\n- bpo-26782(38): Add STARTUPINFO to subprocess.all on Windows.\n\n- bpo-26404(39): Add context manager to socketserver.  Patch by Aviv\nPalivoda.\n\n- bpo-26735(40): Fix *note os.urandom(): 276. on Solaris 11.3 and\nnewer when reading more than 1,024 bytes: call 'getrandom()'\nmultiple times with a limit of 1024 bytes per call.\n\n- bpo-26585(41): Eliminate http.server.quotehtml() and use\nhtml.escape(quote=False).  Patch by Xiang Zhang.\n\n- bpo-26685(42): Raise OSError if closing a socket fails.\n\n- bpo-16329(43): Add .webm to mimetypes.typesmap.  Patch by\nGiampaolo Rodola'.\n\n- bpo-13952(44): Add .csv to mimetypes.typesmap.  Patch by Geoff\nWilson.\n\n- bpo-26587(45): the site module now allows .pth files to specify\nfiles to be added to sys.path (e.g.  zip files).\n\n- bpo-25609(46): Introduce contextlib.AbstractContextManager and\ntyping.ContextManager.\n\n- bpo-26709(47): Fixed Y2038 problem in loading binary PLists.\n\n- bpo-23735(48): Handle terminal resizing with Readline 6.3+ by\ninstalling our own SIGWINCH handler.  Patch by Eric Price.\n\n- bpo-25951(49): Change SSLSocket.sendall() to return None, as\nexplicitly documented for plain socket objects.  Patch by Aviv\nPalivoda.\n\n- bpo-26586(50): In http.server, respond with \"413 Request header\nfields too large\" if there are too many header fields to parse,\nrather than killing the connection and raising an unhandled\nexception.  Patch by Xiang Zhang.\n\n- bpo-26676(51): Added missing XMLPullParser to ElementTree.all.\n\n- bpo-22854(52): Change BufferedReader.writable() and\nBufferedWriter.readable() to always return False.\n\n- bpo-26492(53): Exhausted iterator of array.array now conforms with\nthe behavior of iterators of other mutable sequences: it lefts\nexhausted even if iterated array is extended.\n\n- bpo-26641(54): doctest.DocFileTest and doctest.testfile() now\nsupport packages (module splitted into multiple directories) for\nthe package parameter.\n\n- bpo-25195(55): Fix a regression in mock.MagicMock.  Call is a\nsubclass of tuple (changeset 3603bae63c13 only works for classes)\nso we need to implement ne ourselves.  Patch by Andrew Plummer.\n\n- bpo-26644(56): Raise ValueError rather than SystemError when a\nnegative length is passed to SSLSocket.recv() or read().\n\n- bpo-23804(57): Fix SSL recv(0) and read(0) methods to return zero\nbytes instead of up to 1024.\n\n- bpo-26616(58): Fixed a bug in datetime.astimezone() method.\n\n- bpo-26637(59): The *note importlib: 71. module now emits an *note\nImportError: 145. rather than a *note TypeError: 28e. if *note\nimport(): 6ed. is tried during the Python shutdown process but\n*note sys.path: 32c. is already cleared (set to 'None').\n\n- bpo-21925(60): *note warnings.formatwarning(): 178d. now catches\nexceptions when calling *note linecache.getline(): c82. and *note\ntracemalloc.getobjecttraceback(): 18db. to be able to log *note\nResourceWarning: a86. emitted late during the Python shutdown\nprocess.\n\n- bpo-23848(61): On Windows, faulthandler.enable() now also installs\nan exception handler to dump the traceback of all Python threads on\nany Windows exception, not only on UNIX signals (SIGSEGV, SIGFPE,\nSIGABRT).\n\n- bpo-26530(62): Add C functions 'PyTraceMallocTrack()' and\n'PyTraceMallocUntrack()' to track memory blocks using the *note\ntracemalloc: fa. module.  Add 'PyTraceMallocGetTraceback()' to\nget the traceback of an object.\n\n- bpo-26588(63): The tracemalloc now supports tracing memory\nallocations of multiple address spaces (domains).\n\n- bpo-24266(64): Ctrl+C during Readline history search now cancels\nthe search mode when compiled with Readline 7.\n\n- bpo-26590(65): Implement a safe finalizer for the socket.socket\ntype.  It now releases the GIL to close the socket.\n\n- bpo-18787(66): spwd.getspnam() now raises a PermissionError if the\nuser doesn't have privileges.\n\n- bpo-26560(67): Avoid potential ValueError in\nBaseHandler.startresponse.  Initial patch by Peter Inglesby.\n\n- bpo-26567(68): Add a new function *note PyErrResourceWarning():\nb6a. function to pass the destroyed object.  Add a 'source'\nattribute to 'warnings.WarningMessage'.  Add\nwarnings.showwarnmsg() which uses tracemalloc to get the traceback\nwhere source object was allocated.\n\n- bpo-26569(69): Fix *note pyclbr.readmodule(): 620. and *note\npyclbr.readmoduleex(): 621. to support importing packages.\n\n- bpo-26499(70): Account for remaining Content-Length in\nHTTPResponse.readline() and read1().  Based on patch by Silent\nGhost.  Also document that HTTPResponse now supports these methods.\n\n- bpo-25320(71): Handle sockets in directories unittest discovery is\nscanning.  Patch from Victor van den Elzen.\n\n- bpo-16181(72): cookiejar.http2time() now returns None if year is\nhigher than datetime.MAXYEAR.\n\n- bpo-26513(73): Fixes platform module detection of Windows Server\n\n- bpo-23718(74): Fixed parsing time in week 0 before Jan 1.  Original\npatch by Tam??s Bence Gedai.\n\n- bpo-26323(75): Add Mock.assertcalled() and\nMock.assertcalledonce() methods to unittest.mock.  Patch written\nby Amit Saha.\n\n- bpo-20589(76): Invoking Path.owner() and Path.group() on Windows\nnow raise NotImplementedError instead of ImportError.\n\n- bpo-26177(77): Fixed the keys() method for Canvas and Scrollbar\nwidgets.\n\n- bpo-15068(78): Got rid of excessive buffering in fileinput.  The\nbufsize parameter is now deprecated and ignored.\n\n- bpo-19475(79): Added an optional argument timespec to the datetime\nisoformat() method to choose the precision of the time component.\n\n- bpo-2202(80): Fix UnboundLocalError in\nAbstractDigestAuthHandler.getalgorithmimpls.  Initial patch by\nMathieu Dupuy.\n\n- bpo-26167(81): Minimized overhead in copy.copy() and\ncopy.deepcopy().  Optimized copying and deepcopying bytearrays,\nNotImplemented, slices, short lists, tuples, dicts, sets.\n\n- bpo-25718(82): Fixed pickling and copying the accumulate() iterator\nwith total is None.\n\n- bpo-26475(83): Fixed debugging output for regular expressions with\nthe (?x) flag.\n\n- bpo-26482(84): Allowed pickling recursive dequeues.\n\n- bpo-26335(85): Make mmap.write() return the number of bytes written\nlike other write methods.  Patch by Jakub Stasiak.\n\n- bpo-26457(86): Fixed the subnets() methods in IP network classes\nfor the case when resulting prefix length is equal to maximal\nprefix length.  Based on patch by Xiang Zhang.\n\n- bpo-26385(87): Remove the file if the internal open() call in\nNamedTemporaryFile() fails.  Patch by Silent Ghost.\n\n- bpo-26402(88): Fix XML-RPC client to retry when the server shuts\ndown a persistent connection.  This was a regression related to the\nnew http.client.RemoteDisconnected exception in 3.5.0a4.\n\n- bpo-25913(89): Leading '<~' is optional now in base64.a85decode()\nwith adobe=True.  Patch by Swati Jaiswal.\n\n- bpo-26186(90): Remove an invalid type check in\nimportlib.util.LazyLoader.\n\n- bpo-26367(91): importlib.import() raises ImportError like\nbuiltins.import() when 'level' is specified but without an\naccompanying package specified.\n\n- bpo-26309(92): In the \"socketserver\" module, shut down the request\n(closing the connected socket) when verifyrequest() returns false.\nPatch by Aviv Palivoda.\n\n- bpo-23430(93): Change the socketserver module to only catch\nexceptions raised from a request handler that are derived from\nException (instead of BaseException).  Therefore SystemExit and\nKeyboardInterrupt no longer trigger the handleerror() method, and\nwill now to stop a single-threaded server.\n\n- bpo-25995(94): os.walk() no longer uses FDs proportional to the\ntree depth.\n\n- bpo-25994(95): Added the close() method and the support of the\ncontext manager protocol for the os.scandir() iterator.\n\n- bpo-23992(96): multiprocessing: make MapResult not fail-fast upon\nexception.\n\n- bpo-26243(97): Support keyword arguments to zlib.compress().  Patch\nby Aviv Palivoda.\n\n- bpo-26117(98): The os.scandir() iterator now closes file descriptor\nnot only when the iteration is finished, but when it was failed\nwith error.\n\n- bpo-25949(99): dict for an OrderedDict instance is now created\nonly when needed.\n\n- bpo-25911(100): Restored support of bytes paths in os.walk() on\nWindows.\n\n- bpo-26045(101): Add UTF-8 suggestion to error message when posting\na non-Latin-1 string with http.client.\n\n- bpo-26039(102): Added zipfile.ZipInfo.fromfile() and\nzipinfo.ZipInfo.isdir().  Patch by Thomas Kluyver.\n\n- bpo-12923(103): Reset FancyURLopener's redirect counter even if\nthere is an exception.  Based on patches by Brian Brazil and Daniel\nRocco.\n\n- bpo-25945(104): Fixed a crash when unpickle the functools.partial\nobject with wrong state.  Fixed a leak in failed functools.partial\nconstructor.  \"args\" and \"keywords\" attributes of functools.partial\nhave now always types tuple and dict correspondingly.\n\n- bpo-26202(105): copy.deepcopy() now correctly copies range()\nobjects with non-atomic attributes.\n\n- bpo-23076(106): Path.glob() now raises a ValueError if it's called\nwith an invalid pattern.  Patch by Thomas Nyberg.\n\n- bpo-19883(107): Fixed possible integer overflows in zipimport.\n\n- bpo-26227(108): On Windows, getnameinfo(), gethostbyaddr() and\ngethostbynameex() functions of the socket module now decode the\nhostname from the ANSI code page rather than UTF-8.\n\n- bpo-26099(109): The site module now writes an error into stderr if\nsitecustomize module can be imported but executing the module raise\nan ImportError.  Same change for usercustomize.\n\n- bpo-26147(110): xmlrpc now works with strings not encodable with\nused non-UTF-8 encoding.\n\n- bpo-25935(111): Garbage collector now breaks reference loops with\nOrderedDict.\n\n- bpo-16620(112): Fixed AttributeError in msilib.Directory.glob().\n\n- bpo-26013(113): Added compatibility with broken protocol 2 pickles\ncreated in old Python 3 versions (3.4.3 and lower).\n\n- bpo-26129(114): Deprecated accepting non-integers in\ngrp.getgrgid().\n\n- bpo-25850(115): Use cross-compilation by default for 64-bit\nWindows.\n\n- bpo-25822(116): Add docstrings to the fields of urllib.parse\nresults.  Patch contributed by Swati Jaiswal.\n\n- bpo-22642(117): Convert trace module option parsing mechanism to\nargparse.  Patch contributed by SilentGhost.\n\n- bpo-24705(118): Fix sysconfig.parsemakefile not expanding ${}\nvars appearing before $() vars.\n\n- bpo-26069(119): Remove the deprecated apis in the trace module.\n\n- bpo-22138(120): Fix mock.patch behavior when patching descriptors.\nRestore original values after patching.  Patch contributed by Sean\nMcCully.\n\n- bpo-25672(121): In the ssl module, enable the\nSSLMODERELEASEBUFFERS mode option if it is safe to do so.\n\n- bpo-26012(122): Don't traverse into symlinks for '' pattern in\npathlib.Path.[r]glob().\n\n- bpo-24120(123): Ignore PermissionError when traversing a tree with\npathlib.Path.[r]glob().  Patch by Ulrich Petri.\n\n- bpo-21815(124): Accept ] characters in the data portion of imap\nresponses, in order to handle the flags with square brackets\naccepted and produced by servers such as gmail.\n\n- bpo-25447(125): fileinput now uses sys.stdin as-is if it does not\nhave a buffer attribute (restores backward compatibility).\n\n- bpo-25971(126): Optimized creating Fractions from floats by 2 times\nand from Decimals by 3 times.\n\n- bpo-25802(127): Document as deprecated the remaining\nimplementations of importlib.abc.Loader.loadmodule().\n\n- bpo-25928(128): Add Decimal.asintegerratio().\n\n- bpo-25447(129): Copying the lrucache() wrapper object now always\nworks, independently from the type of the wrapped object (by\nreturning the original object unchanged).\n\n- bpo-25768(130): Have the functions in compileall return booleans\ninstead of ints and add proper documentation and tests for the\nreturn values.\n\n- bpo-24103(131): Fixed possible use after free in\nElementTree.XMLPullParser.\n\n- bpo-25860(132): os.fwalk() no longer skips remaining directories\nwhen error occurs.  Original patch by Samson Lee.\n\n- bpo-25914(133): Fixed and simplified OrderedDict.sizeof.\n\n- bpo-25869(134): Optimized deepcopying ElementTree; it is now 20\ntimes faster.\n\n- bpo-25873(135): Optimized iterating ElementTree.  Iterating\nelements Element.iter() is now 40% faster, iterating text\nElement.itertext() is now up to 2.5 times faster.\n\n- bpo-25902(136): Fixed various refcount issues in ElementTree\niteration.\n\n- bpo-22227(137): The TarFile iterator is reimplemented using\ngenerator.  This implementation is simpler that using class.\n\n- bpo-25638(138): Optimized ElementTree.iterparse(); it is now 2x\nfaster.  Optimized ElementTree parsing; it is now 10% faster.\n\n- bpo-25761(139): Improved detecting errors in broken pickle data.\n\n- bpo-25717(140): Restore the previous behaviour of tolerating most\nfstat() errors when opening files.  This was a regression in 3.5a1,\nand stopped anonymous temporary files from working in special\ncases.\n\n- bpo-24903(141): Fix regression in number of arguments compileall\naccepts when '-d' is specified.  The check on the number of\narguments has been dropped completely as it never worked correctly\nanyway.\n\n- bpo-25764(142): In the subprocess module, preserve any exception\ncaused by fork() failure when preexecfn is used.\n\n- bpo-25771(143): Tweak the exception message for\nimportlib.util.resolvename() when 'package' isn't specified but\nnecessary.\n\n- bpo-6478(144): strptime's regexp cache now is reset after changing\ntimezone with time.tzset().\n\n- bpo-14285(145): When executing a package with the \"python -m\npackage\" option, and package initialization fails, a proper\ntraceback is now reported.  The \"runpy\" module now lets exceptions\nfrom package initialization pass back to the caller, rather than\nraising ImportError.\n\n- bpo-19771(146): Also in runpy and the \"-m\" option, omit the\nirrelevant message \"... is a package and cannot be directly executed\"\nif the package could not even be initialized (e.g.  due to a bad\n'*.pyc' file).\n\n- bpo-25177(147): Fixed problem with the mean of very small and very\nlarge numbers.  As a side effect, statistics.mean and\nstatistics.variance should be significantly faster.\n\n- bpo-25718(148): Fixed copying object with state with boolean value\nis false.\n\n- bpo-10131(149): Fixed deep copying of minidom documents.  Based on\npatch by Marian Ganisin.\n\n- bpo-7990(150): dir() on ElementTree.Element now lists properties:\n\"tag\", \"text\", \"tail\" and \"attrib\".  Original patch by Santoso\nWijaya.\n\n- bpo-25725(151): Fixed a reference leak in pickle.loads() when\nunpickling invalid data including tuple instructions.\n\n- bpo-25663(152): In the Readline completer, avoid listing duplicate\nglobal names, and search the global namespace before searching\nbuiltins.\n\n- bpo-25688(153): Fixed file leak in ElementTree.iterparse() raising\nan error.\n\n- bpo-23914(154): Fixed SystemError raised by unpickler on broken\npickle data.\n\n- bpo-25691(155): Fixed crash on deleting ElementTree.Element\nattributes.\n\n- bpo-25624(156): ZipFile now always writes a ZIPSTORED header for\ndirectory entries.  Patch by Dingyuan Wang.\n\n- bpo-25626(157): Change three zlib functions to accept sizes that\nfit in Pyssizet, but internally cap those sizes to UINTMAX. This\nresolves a regression in 3.5 where GzipFile.read() failed to read\nchunks larger than 2 or 4 GiB. The change affects the\nzlib.Decompress.decompress() maxlength parameter, the\nzlib.decompress() bufsize parameter, and the\nzlib.Decompress.flush() length parameter.\n\n- bpo-25583(158): Avoid incorrect errors raised by\nos.makedirs(existok=True) when the OS gives priority to errors\nsuch as EACCES over EEXIST.\n\n- bpo-25593(159): Change semantics of EventLoop.stop() in asyncio.\n\n- bpo-6973(160): When we know a subprocess.Popen process has died, do\nnot allow the sendsignal(), terminate(), or kill() methods to do\nanything as they could potentially signal a different process.\n\n- bpo-23883(161): Added missing APIs to all to match the\ndocumented APIs for the following modules: calendar, csv, enum,\nfileinput, ftplib, logging, optparse, tarfile, threading and wave.\nAlso added a test.support.checkall() helper.  Patches by Jacek\nKo??odziej, Mauro S. M. Rodrigues and Joel Taddei.\n\n- bpo-25590(162): In the Readline completer, only call getattr() once\nper attribute.  Also complete names of attributes such as\nproperties and slots which are listed by dir() but not yet created\non an instance.\n\n- bpo-25498(163): Fix a crash when garbage-collecting ctypes objects\ncreated by wrapping a memoryview.  This was a regression made in\n3.5a1.  Based on patch by Eryksun.\n\n- bpo-25584(164): Added \"escape\" to the all list in the glob\nmodule.\n\n- bpo-25584(165): Fixed recursive glob() with patterns starting with\n''.\n\n- bpo-25446(166): Fix regression in smtplib's AUTH LOGIN support.\n\n- bpo-18010(167): Fix the pydoc web server's module search function\nto handle exceptions from importing packages.\n\n- bpo-25554(168): Got rid of circular references in regular\nexpression parsing.\n\n- bpo-18973(169): Command-line interface of the calendar module now\nuses argparse instead of optparse.\n\n- bpo-25510(170): fileinput.FileInput.readline() now returns b''\ninstead of '' at the end if the FileInput was opened with binary\nmode.  Patch by Ryosuke Ito.\n\n- bpo-25503(171): Fixed inspect.getdoc() for inherited docstrings of\nproperties.  Original patch by John Mark Vandenberg.\n\n- bpo-25515(172): Always use os.urandom as a source of randomness in\nuuid.uuid4.\n\n- bpo-21827(173): Fixed textwrap.dedent() for the case when largest\ncommon whitespace is a substring of smallest leading whitespace.\nBased on patch by Robert Li.\n\n- bpo-25447(174): The lrucache() wrapper objects now can be copied\nand pickled (by returning the original object unchanged).\n\n- bpo-25390(175): typing: Don't crash on Union[str, Pattern].\n\n- bpo-25441(176): asyncio: Raise error from drain() when socket is\nclosed.\n\n- bpo-25410(177): Cleaned up and fixed minor bugs in C implementation\nof OrderedDict.\n\n- bpo-25411(178): Improved Unicode support in SMTPHandler through\nbetter use of the email package.  Thanks to user simon04 for the\npatch.\n\n- Move the imp module from a PendingDeprecationWarning to\nDeprecationWarning.\n\n- bpo-25407(179): Remove mentions of the formatter module being\nremoved in Python 3.6.\n\n- bpo-25406(180): Fixed a bug in C implementation of\nOrderedDict.movetoend() that caused segmentation fault or hang in\niterating after moving several items to the start of ordered dict.\n\n- bpo-25382(181): pickletools.dis() now outputs implicit memo index\nfor the MEMOIZE opcode.\n\n- bpo-25357(182): Add an optional newline parameter to\nbinascii.b2abase64().  base64.b64encode() uses it to avoid a\nmemory copy.\n\n- bpo-24164(183): Objects that need calling 'new' with keyword\narguments, can now be pickled using pickle protocols older than\nprotocol version 4.\n\n- bpo-25364(184): zipfile now works in threads disabled builds.\n\n- bpo-25328(185): smtpd's SMTPChannel now correctly raises a\nValueError if both decodedata and enableSMTPUTF8 are set to true.\n\n- bpo-16099(186): RobotFileParser now supports Crawl-delay and\nRequest-rate extensions.  Patch by Nikolay Bogoychev.\n\n- bpo-25316(187): distutils raises OSError instead of\nDistutilsPlatformError when MSVC is not installed.\n\n- bpo-25380(188): Fixed protocol for the STACKGLOBAL opcode in\npickletools.opcodes.\n\n- bpo-23972(189): Updates asyncio datagram create method allowing\nreuseport and reuseaddr socket options to be set prior to binding\nthe socket.  Mirroring the existing asyncio createserver method\nthe reuseaddr option for datagram sockets defaults to True if the\nO/S is 'posix' (except if the platform is Cygwin).  Patch by Chris\nLaws.\n\n- bpo-25304(190): Add asyncio.runcoroutinethreadsafe().  This lets\nyou submit a coroutine to a loop from another thread, returning a\nconcurrent.futures.Future.  By Vincent Michel.\n\n- bpo-25232(191): Fix CGIRequestHandler to split the query from the\nURL at the first question mark (?)  rather than the last.  Patch\nfrom Xiang Zhang.\n\n- bpo-24657(192): Prevent CGIRequestHandler from collapsing slashes\nin the query part of the URL as if it were a path.  Patch from\nXiang Zhang.\n\n- bpo-25287(193): Don't add crypt.METHODCRYPT to crypt.methods if\nit's not supported.  Check if it is supported, it may not be\nsupported on OpenBSD for example.\n\n- bpo-23600(194): Default implementation of tzinfo.fromutc() was\nreturning wrong results in some cases.\n\n- bpo-25203(195): Failed readline.setcompleterdelims() no longer\nleft the module in inconsistent state.\n\n- bpo-25011(196): rlcompleter now omits private and special attribute\nnames unless the prefix starts with underscores.\n\n- bpo-25209(197): rlcompleter now can add a space or a colon after\ncompleted keyword.\n\n- bpo-22241(198): timezone.utc name is now plain 'UTC', not\n'UTC-00:00'.\n\n- bpo-23517(199): fromtimestamp() and utcfromtimestamp() methods of\ndatetime.datetime now round microseconds to nearest with ties going\nto nearest even integer (ROUNDHALFEVEN), as round(float), instead\nof rounding towards -Infinity (ROUNDFLOOR).\n\n- bpo-23552(200): Timeit now warns when there is substantial (4x)\nvariance between best and worst times.  Patch from Serhiy\nStorchaka.\n\n- bpo-24633(201): site-packages/README -> README.txt.\n\n- bpo-24879(202): help() and pydoc can now list named tuple fields in\nthe order they were defined rather than alphabetically.  The\nordering is determined by the fields attribute if present.\n\n- bpo-24874(203): Improve speed of itertools.cycle() and make its\npickle more compact.\n\n- Fix crash in itertools.cycle.setstate() when the first argument\nwasn't a list.\n\n- bpo-20059(204): urllib.parse raises ValueError on all invalid\nports.  Patch by Martin Panter.\n\n- bpo-24360(205): Improve repr of argparse.Namespace() for\ninvalid identifiers.  Patch by Matthias Bussonnier.\n\n- bpo-23426(206): runsetup was broken in distutils.  Patch from\nAlexander Belopolsky.\n\n- bpo-13938(207): 2to3 converts StringTypes to a tuple.  Patch from\nMark Hammond.\n\n- bpo-2091(208): open() accepted a 'U' mode string containing '+',\nbut 'U' can only be used with 'r'.  Patch from Jeff Balogh and John\nO'Connor.\n\n- bpo-8585(209): improved tests for zipimporter2.  Patch from Mark\nLawrence.\n\n- bpo-18622(210): unittest.mock.mockopen().resetmock would recurse\ninfinitely.  Patch from Nicola Palumbo and Laurent De Buyst.\n\n- bpo-24426(211): Fast searching optimization in regular expressions\nnow works for patterns that starts with capturing groups.  Fast\nsearching optimization now can't be disabled at compile time.\n\n- bpo-23661(212): unittest.mock sideeffects can now be exceptions\nagain.  This was a regression vs Python 3.4.  Patch from Ignacio\nRossi\n\n- bpo-13248(213): Remove deprecated inspect.getmoduleinfo function.\n\n- bpo-25578(214): Fix (another) memory leak in\nSSLSocket.getpeercer().\n\n- bpo-25530(215): Disable the vulnerable SSLv3 protocol by default\nwhen creating ssl.SSLContext.\n\n- bpo-25569(216): Fix memory leak in SSLSocket.getpeercert().\n\n- bpo-25471(217): Sockets returned from accept() shouldn't appear to\nbe nonblocking.\n\n- bpo-25319(218): When threading.Event is reinitialized, the\nunderlying condition should use a regular lock rather than a\nrecursive lock.\n\n- Skip getaddrinfo if host is already resolved.  Patch by A. Jesse\nJiryu Davis.\n\n- bpo-26050(219): Add asyncio.StreamReader.readuntil() method.  Patch\nby ???????? ??????????????????.\n\n- bpo-25924(220): Avoid unnecessary serialization of getaddrinfo(3)\ncalls on OS X versions 10.5 or higher.  Original patch by A. Jesse\nJiryu Davis.\n\n- bpo-26406(221): Avoid unnecessary serialization of getaddrinfo(3)\ncalls on current versions of OpenBSD and NetBSD. Patch by A. Jesse\nJiryu Davis.\n\n- bpo-26848(222): Fix asyncio/subprocess.communicate() to handle\nempty input.  Patch by Jack O'Connor.\n\n- bpo-27040(223): Add loop.getexceptionhandler method\n\n- bpo-27041(224): asyncio: Add loop.createfuture method\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27057\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=27014\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=27031\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=14132\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=17214\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=27033\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=27034\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=26870\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=26039\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=26892\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=22274\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=26807\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=25745\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=26977\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=26002\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=25974\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=26996\n\n(18) https://peps.python.org/pep-0506/\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=26881\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=23815\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=17765\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=26873\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=26915\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=26711\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=24114\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=26864\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=24902\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=25788\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=26634\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=26804\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=26837\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=26041\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=26822\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=26733\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=26801\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=24838\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=26717\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=26782\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=26404\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=26735\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=26585\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=26685\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=16329\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=13952\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=26587\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=25609\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=26709\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=23735\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=25951\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=26586\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=26676\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=22854\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=26492\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=26641\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=25195\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=26644\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=23804\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=26616\n\n(59) https://bugs.python.org/issue?@action=redirect&bpo=26637\n\n(60) https://bugs.python.org/issue?@action=redirect&bpo=21925\n\n(61) https://bugs.python.org/issue?@action=redirect&bpo=23848\n\n(62) https://bugs.python.org/issue?@action=redirect&bpo=26530\n\n(63) https://bugs.python.org/issue?@action=redirect&bpo=26588\n\n(64) https://bugs.python.org/issue?@action=redirect&bpo=24266\n\n(65) https://bugs.python.org/issue?@action=redirect&bpo=26590\n\n(66) https://bugs.python.org/issue?@action=redirect&bpo=18787\n\n(67) https://bugs.python.org/issue?@action=redirect&bpo=26560\n\n(68) https://bugs.python.org/issue?@action=redirect&bpo=26567\n\n(69) https://bugs.python.org/issue?@action=redirect&bpo=26569\n\n(70) https://bugs.python.org/issue?@action=redirect&bpo=26499\n\n(71) https://bugs.python.org/issue?@action=redirect&bpo=25320\n\n(72) https://bugs.python.org/issue?@action=redirect&bpo=16181\n\n(73) https://bugs.python.org/issue?@action=redirect&bpo=26513\n\n(74) https://bugs.python.org/issue?@action=redirect&bpo=23718\n\n(75) https://bugs.python.org/issue?@action=redirect&bpo=26323\n\n(76) https://bugs.python.org/issue?@action=redirect&bpo=20589\n\n(77) https://bugs.python.org/issue?@action=redirect&bpo=26177\n\n(78) https://bugs.python.org/issue?@action=redirect&bpo=15068\n\n(79) https://bugs.python.org/issue?@action=redirect&bpo=19475\n\n(80) https://bugs.python.org/issue?@action=redirect&bpo=2202\n\n(81) https://bugs.python.org/issue?@action=redirect&bpo=26167\n\n(82) https://bugs.python.org/issue?@action=redirect&bpo=25718\n\n(83) https://bugs.python.org/issue?@action=redirect&bpo=26475\n\n(84) https://bugs.python.org/issue?@action=redirect&bpo=26482\n\n(85) https://bugs.python.org/issue?@action=redirect&bpo=26335\n\n(86) https://bugs.python.org/issue?@action=redirect&bpo=26457\n\n(87) https://bugs.python.org/issue?@action=redirect&bpo=26385\n\n(88) https://bugs.python.org/issue?@action=redirect&bpo=26402\n\n(89) https://bugs.python.org/issue?@action=redirect&bpo=25913\n\n(90) https://bugs.python.org/issue?@action=redirect&bpo=26186\n\n(91) https://bugs.python.org/issue?@action=redirect&bpo=26367\n\n(92) https://bugs.python.org/issue?@action=redirect&bpo=26309\n\n(93) https://bugs.python.org/issue?@action=redirect&bpo=23430\n\n(94) https://bugs.python.org/issue?@action=redirect&bpo=25995\n\n(95) https://bugs.python.org/issue?@action=redirect&bpo=25994\n\n(96) https://bugs.python.org/issue?@action=redirect&bpo=23992\n\n(97) https://bugs.python.org/issue?@action=redirect&bpo=26243\n\n(98) https://bugs.python.org/issue?@action=redirect&bpo=26117\n\n(99) https://bugs.python.org/issue?@action=redirect&bpo=25949\n\n(100) https://bugs.python.org/issue?@action=redirect&bpo=25911\n\n(101) https://bugs.python.org/issue?@action=redirect&bpo=26045\n\n(102) https://bugs.python.org/issue?@action=redirect&bpo=26039\n\n(103) https://bugs.python.org/issue?@action=redirect&bpo=12923\n\n(104) https://bugs.python.org/issue?@action=redirect&bpo=25945\n\n(105) https://bugs.python.org/issue?@action=redirect&bpo=26202\n\n(106) https://bugs.python.org/issue?@action=redirect&bpo=23076\n\n(107) https://bugs.python.org/issue?@action=redirect&bpo=19883\n\n(108) https://bugs.python.org/issue?@action=redirect&bpo=26227\n\n(109) https://bugs.python.org/issue?@action=redirect&bpo=26099\n\n(110) https://bugs.python.org/issue?@action=redirect&bpo=26147\n\n(111) https://bugs.python.org/issue?@action=redirect&bpo=25935\n\n(112) https://bugs.python.org/issue?@action=redirect&bpo=16620\n\n(113) https://bugs.python.org/issue?@action=redirect&bpo=26013\n\n(114) https://bugs.python.org/issue?@action=redirect&bpo=26129\n\n(115) https://bugs.python.org/issue?@action=redirect&bpo=25850\n\n(116) https://bugs.python.org/issue?@action=redirect&bpo=25822\n\n(117) https://bugs.python.org/issue?@action=redirect&bpo=22642\n\n(118) https://bugs.python.org/issue?@action=redirect&bpo=24705\n\n(119) https://bugs.python.org/issue?@action=redirect&bpo=26069\n\n(120) https://bugs.python.org/issue?@action=redirect&bpo=22138\n\n(121) https://bugs.python.org/issue?@action=redirect&bpo=25672\n\n(122) https://bugs.python.org/issue?@action=redirect&bpo=26012\n\n(123) https://bugs.python.org/issue?@action=redirect&bpo=24120\n\n(124) https://bugs.python.org/issue?@action=redirect&bpo=21815\n\n(125) https://bugs.python.org/issue?@action=redirect&bpo=25447\n\n(126) https://bugs.python.org/issue?@action=redirect&bpo=25971\n\n(127) https://bugs.python.org/issue?@action=redirect&bpo=25802\n\n(128) https://bugs.python.org/issue?@action=redirect&bpo=25928\n\n(129) https://bugs.python.org/issue?@action=redirect&bpo=25447\n\n(130) https://bugs.python.org/issue?@action=redirect&bpo=25768\n\n(131) https://bugs.python.org/issue?@action=redirect&bpo=24103\n\n(132) https://bugs.python.org/issue?@action=redirect&bpo=25860\n\n(133) https://bugs.python.org/issue?@action=redirect&bpo=25914\n\n(134) https://bugs.python.org/issue?@action=redirect&bpo=25869\n\n(135) https://bugs.python.org/issue?@action=redirect&bpo=25873\n\n(136) https://bugs.python.org/issue?@action=redirect&bpo=25902\n\n(137) https://bugs.python.org/issue?@action=redirect&bpo=22227\n\n(138) https://bugs.python.org/issue?@action=redirect&bpo=25638\n\n(139) https://bugs.python.org/issue?@action=redirect&bpo=25761\n\n(140) https://bugs.python.org/issue?@action=redirect&bpo=25717\n\n(141) https://bugs.python.org/issue?@action=redirect&bpo=24903\n\n(142) https://bugs.python.org/issue?@action=redirect&bpo=25764\n\n(143) https://bugs.python.org/issue?@action=redirect&bpo=25771\n\n(144) https://bugs.python.org/issue?@action=redirect&bpo=6478\n\n(145) https://bugs.python.org/issue?@action=redirect&bpo=14285\n\n(146) https://bugs.python.org/issue?@action=redirect&bpo=19771\n\n(147) https://bugs.python.org/issue?@action=redirect&bpo=25177\n\n(148) https://bugs.python.org/issue?@action=redirect&bpo=25718\n\n(149) https://bugs.python.org/issue?@action=redirect&bpo=10131\n\n(150) https://bugs.python.org/issue?@action=redirect&bpo=7990\n\n(151) https://bugs.python.org/issue?@action=redirect&bpo=25725\n\n(152) https://bugs.python.org/issue?@action=redirect&bpo=25663\n\n(153) https://bugs.python.org/issue?@action=redirect&bpo=25688\n\n(154) https://bugs.python.org/issue?@action=redirect&bpo=23914\n\n(155) https://bugs.python.org/issue?@action=redirect&bpo=25691\n\n(156) https://bugs.python.org/issue?@action=redirect&bpo=25624\n\n(157) https://bugs.python.org/issue?@action=redirect&bpo=25626\n\n(158) https://bugs.python.org/issue?@action=redirect&bpo=25583\n\n(159) https://bugs.python.org/issue?@action=redirect&bpo=25593\n\n(160) https://bugs.python.org/issue?@action=redirect&bpo=6973\n\n(161) https://bugs.python.org/issue?@action=redirect&bpo=23883\n\n(162) https://bugs.python.org/issue?@action=redirect&bpo=25590\n\n(163) https://bugs.python.org/issue?@action=redirect&bpo=25498\n\n(164) https://bugs.python.org/issue?@action=redirect&bpo=25584\n\n(165) https://bugs.python.org/issue?@action=redirect&bpo=25584\n\n(166) https://bugs.python.org/issue?@action=redirect&bpo=25446\n\n(167) https://bugs.python.org/issue?@action=redirect&bpo=18010\n\n(168) https://bugs.python.org/issue?@action=redirect&bpo=25554\n\n(169) https://bugs.python.org/issue?@action=redirect&bpo=18973\n\n(170) https://bugs.python.org/issue?@action=redirect&bpo=25510\n\n(171) https://bugs.python.org/issue?@action=redirect&bpo=25503\n\n(172) https://bugs.python.org/issue?@action=redirect&bpo=25515\n\n(173) https://bugs.python.org/issue?@action=redirect&bpo=21827\n\n(174) https://bugs.python.org/issue?@action=redirect&bpo=25447\n\n(175) https://bugs.python.org/issue?@action=redirect&bpo=25390\n\n(176) https://bugs.python.org/issue?@action=redirect&bpo=25441\n\n(177) https://bugs.python.org/issue?@action=redirect&bpo=25410\n\n(178) https://bugs.python.org/issue?@action=redirect&bpo=25411\n\n(179) https://bugs.python.org/issue?@action=redirect&bpo=25407\n\n(180) https://bugs.python.org/issue?@action=redirect&bpo=25406\n\n(181) https://bugs.python.org/issue?@action=redirect&bpo=25382\n\n(182) https://bugs.python.org/issue?@action=redirect&bpo=25357\n\n(183) https://bugs.python.org/issue?@action=redirect&bpo=24164\n\n(184) https://bugs.python.org/issue?@action=redirect&bpo=25364\n\n(185) https://bugs.python.org/issue?@action=redirect&bpo=25328\n\n(186) https://bugs.python.org/issue?@action=redirect&bpo=16099\n\n(187) https://bugs.python.org/issue?@action=redirect&bpo=25316\n\n(188) https://bugs.python.org/issue?@action=redirect&bpo=25380\n\n(189) https://bugs.python.org/issue?@action=redirect&bpo=23972\n\n(190) https://bugs.python.org/issue?@action=redirect&bpo=25304\n\n(191) https://bugs.python.org/issue?@action=redirect&bpo=25232\n\n(192) https://bugs.python.org/issue?@action=redirect&bpo=24657\n\n(193) https://bugs.python.org/issue?@action=redirect&bpo=25287\n\n(194) https://bugs.python.org/issue?@action=redirect&bpo=23600\n\n(195) https://bugs.python.org/issue?@action=redirect&bpo=25203\n\n(196) https://bugs.python.org/issue?@action=redirect&bpo=25011\n\n(197) https://bugs.python.org/issue?@action=redirect&bpo=25209\n\n(198) https://bugs.python.org/issue?@action=redirect&bpo=22241\n\n(199) https://bugs.python.org/issue?@action=redirect&bpo=23517\n\n(200) https://bugs.python.org/issue?@action=redirect&bpo=23552\n\n(201) https://bugs.python.org/issue?@action=redirect&bpo=24633\n\n(202) https://bugs.python.org/issue?@action=redirect&bpo=24879\n\n(203) https://bugs.python.org/issue?@action=redirect&bpo=24874\n\n(204) https://bugs.python.org/issue?@action=redirect&bpo=20059\n\n(205) https://bugs.python.org/issue?@action=redirect&bpo=24360\n\n(206) https://bugs.python.org/issue?@action=redirect&bpo=23426\n\n(207) https://bugs.python.org/issue?@action=redirect&bpo=13938\n\n(208) https://bugs.python.org/issue?@action=redirect&bpo=2091\n\n(209) https://bugs.python.org/issue?@action=redirect&bpo=8585\n\n(210) https://bugs.python.org/issue?@action=redirect&bpo=18622\n\n(211) https://bugs.python.org/issue?@action=redirect&bpo=24426\n\n(212) https://bugs.python.org/issue?@action=redirect&bpo=23661\n\n(213) https://bugs.python.org/issue?@action=redirect&bpo=13248\n\n(214) https://bugs.python.org/issue?@action=redirect&bpo=25578\n\n(215) https://bugs.python.org/issue?@action=redirect&bpo=25530\n\n(216) https://bugs.python.org/issue?@action=redirect&bpo=25569\n\n(217) https://bugs.python.org/issue?@action=redirect&bpo=25471\n\n(218) https://bugs.python.org/issue?@action=redirect&bpo=25319\n\n(219) https://bugs.python.org/issue?@action=redirect&bpo=26050\n\n(220) https://bugs.python.org/issue?@action=redirect&bpo=25924\n\n(221) https://bugs.python.org/issue?@action=redirect&bpo=26406\n\n(222) https://bugs.python.org/issue?@action=redirect&bpo=26848\n\n(223) https://bugs.python.org/issue?@action=redirect&bpo=27040\n\n(224) https://bugs.python.org/issue?@action=redirect&bpo=27041\n\nFile: python3.12.info,  Node: IDLE<49>,  Next: Documentation<67>,  Prev: Library<73>,  Up: Python 3 6 0 alpha 1\n\n1.22.81.4 IDLE\n..............\n\n- bpo-20640(1): Add tests for idlelib.configHelpSourceEdit.  Patch by\nSaimadhav Heblikar.\n\n- In the 'IDLE-console differences' section of the IDLE doc, clarify\nhow running with IDLE affects sys.modules and the standard streams.\n\n- bpo-25507(2): fix incorrect change in IOBinding that prevented\nprinting.  Augment IOBinding htest to include all major IOBinding\nfunctions.\n\n- bpo-25905(3): Revert unwanted conversion of ' to ' RIGHT SINGLE\nQUOTATION MARK in README.txt and open this and NEWS.txt with\n'ascii'.  Re-encode CREDITS.txt to utf-8 and open it with 'utf-8'.\n\n- bpo-15348(4): Stop the debugger engine (normally in a user process)\nbefore closing the debugger window (running in the IDLE process).\nThis prevents the RuntimeErrors that were being caught and ignored.\n\n- bpo-24455(5): Prevent IDLE from hanging when a) closing the shell\nwhile the debugger is active (15347); b) closing the debugger with\nthe [X] button (15348); and c) activating the debugger when already\nactive (24455).  The patch by Mark Roseman does this by making two\nchanges.  1.  Suspend and resume the gui.interaction method with\nthe tcl vwait mechanism intended for this purpose (instead of\nroot.mainloop & .quit).  2.  In gui.run, allow any existing\ninteraction to terminate first.\n\n- Change 'The program' to 'Your program' in an IDLE 'kill program?'\nmessage to make it clearer that the program referred to is the\ncurrently running user program, not IDLE itself.\n\n- bpo-24750(6): Improve the appearance of the IDLE editor window\nstatus bar.  Patch by Mark Roseman.\n\n- bpo-25313(7): Change the handling of new built-in text color themes\nto better address the compatibility problem introduced by the\naddition of IDLE Dark.  Consistently use the revised\nidleConf.CurrentTheme everywhere in idlelib.\n\n- bpo-24782(8): Extension configuration is now a tab in the IDLE\nPreferences dialog rather than a separate dialog.  The former tabs\nare now a sorted list.  Patch by Mark Roseman.\n\n- bpo-22726(9): Re-activate the config dialog help button with some\ncontent about the other buttons and the new IDLE Dark theme.\n\n- bpo-24820(10): IDLE now has an 'IDLE Dark' built-in text color\ntheme.  It is more or less IDLE Classic inverted, with a cobalt\nblue background.  Strings, comments, keywords, ... are still green,\nred, orange, ... .  To use it with IDLEs released before November\n2015, hit the 'Save as New Custom Theme' button and enter a new\nname, such as 'Custom Dark'.  The custom theme will work with any\nIDLE release, and can be modified.\n\n- bpo-25224(11): README.txt is now an idlelib index for IDLE\ndevelopers and curious users.  The previous user content is now in\nthe IDLE doc chapter.  'IDLE' now means 'Integrated Development and\nLearning Environment'.\n\n- bpo-24820(12): Users can now set breakpoint colors in Settings ->\nCustom Highlighting.  Original patch by Mark Roseman.\n\n- bpo-24972(13): Inactive selection background now matches active\nselection background, as configured by users, on all systems.\nFound items are now always highlighted on Windows.  Initial patch\nby Mark Roseman.\n\n- bpo-24570(14): Idle: make calltip and completion boxes appear on\nMacs affected by a tk regression.  Initial patch by Mark Roseman.\n\n- bpo-24988(15): Idle ScrolledList context menus (used in debugger)\nnow work on Mac Aqua.  Patch by Mark Roseman.\n\n- bpo-24801(16): Make right-click for context menu work on Mac Aqua.\nPatch by Mark Roseman.\n\n- bpo-25173(17): Associate tkinter messageboxes with a specific\nwidget.  For Mac OSX, make them a 'sheet'.  Patch by Mark Roseman.\n\n- bpo-25198(18): Enhance the initial html viewer now used for Idle\nHelp.  Properly indent fixed-pitch text (patch by Mark Roseman).\nGive code snippet a very Sphinx-like light blueish-gray background.\nRe-use initial width and height set by users for shell and editor.\nWhen the Table of Contents (TOC) menu is used, put the section\nheader at the top of the screen.\n\n- bpo-25225(19): Condense and rewrite Idle doc section on text\ncolors.\n\n- bpo-21995(20): Explain some differences between IDLE and console\nPython.\n\n- bpo-22820(21): Explain need for 'print' when running file from Idle\neditor.\n\n- bpo-25224(22): Doc: augment Idle feature list and no-subprocess\nsection.\n\n- bpo-25219(23): Update doc for Idle command line options.  Some were\nmissing and notes were not correct.\n\n- bpo-24861(24): Most of idlelib is private and subject to change.\nUse idleib.idle.* to start Idle.  See idlelib.init.doc.\n\n- bpo-25199(25): Idle: add synchronization comments for future\nmaintainers.\n\n- bpo-16893(26): Replace help.txt with help.html for Idle doc\ndisplay.  The new idlelib/help.html is rstripped\nDoc/build/html/library/idle.html.  It looks better than help.txt\nand will better document Idle as released.  The tkinter html viewer\nthat works for this file was written by Rose Roseman.  The now\nunused EditorWindow.HelpDialog class and helt.txt file are\ndeprecated.\n\n- bpo-24199(27): Deprecate unused idlelib.idlever with possible\nremoval in 3.6.\n\n- bpo-24790(28): Remove extraneous code (which also create 2 & 3\nconflicts).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=20640\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=25507\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=25905\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=15348\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=24455\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=24750\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=25313\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=24782\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=22726\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=24820\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=25224\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=24820\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=24972\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=24570\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=24988\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=24801\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=25173\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=25198\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=25225\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=21995\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=22820\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=25224\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=25219\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=24861\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=25199\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=16893\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=24199\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=24790\n\nFile: python3.12.info,  Node: Documentation<67>,  Next: Tests<66>,  Prev: IDLE<49>,  Up: Python 3 6 0 alpha 1\n\n1.22.81.5 Documentation\n.......................\n\n- bpo-26736(1): Used HTTPS for external links in the documentation if\npossible.\n\n- bpo-6953(2): Rework the Readline module documentation to group\nrelated functions together, and add more details such as what\nunderlying Readline functions and variables are accessed.\n\n- bpo-23606(3): Adds note to ctypes documentation regarding\ncdll.msvcrt.\n\n- bpo-24952(4): Clarify the default size argument of stacksize() in\nthe \"threading\" and \"thread\" modules.  Patch from Mattip.\n\n- bpo-26014(5): Update 3.x packaging documentation: * \"See also\"\nlinks to the new docs are now provided in the legacy pages * links\nto setuptools documentation have been updated\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26736\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=6953\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=23606\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=24952\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=26014\n\nFile: python3.12.info,  Node: Tests<66>,  Next: Build<70>,  Prev: Documentation<67>,  Up: Python 3 6 0 alpha 1\n\n1.22.81.6 Tests\n...............\n\n- bpo-21916(1): Added tests for the turtle module.  Patch by ingrid,\nGregory Loyse and Jelle Zijlstra.\n\n- bpo-26295(2): When using \"python3 -m test -testdir=TESTDIR\",\nregrtest doesn't add \"test.\" prefix to test module names.\n\n- bpo-26523(3): The multiprocessing thread pool\n(multiprocessing.dummy.Pool) was untested.\n\n- bpo-26015(4): Added new tests for pickling iterators of mutable\nsequences.\n\n- bpo-26325(5): Added test.support.checknoresourcewarning() to\ncheck that no ResourceWarning is emitted.\n\n- bpo-25940(6): Changed testssl to use its internal local server\nmore.  This avoids relying on svn.python.org, which recently\nchanged root certificate.\n\n- bpo-25616(7): Tests for OrderedDict are extracted from\ntestcollections into separate file testordereddict.\n\n- bpo-25449(8): Added tests for OrderedDict subclasses.\n\n- bpo-25188(9): Add -P/-pgo to test.regrtest to suppress error output\nwhen running the test suite for the purposes of a PGO build.\nInitial patch by Alecsandru Patrascu.\n\n- bpo-22806(10): Add 'python -m test --list-tests' command to list\ntests.\n\n- bpo-18174(11): 'python -m test --huntrleaks ...' now also checks\nfor leak of file descriptors.  Patch written by Richard Oudkerk.\n\n- bpo-25260(12): Fix 'python -m test --coverage' on Windows.  Remove\nthe list of ignored directories.\n\n- 'PCbuild\\rt.bat' now accepts an unlimited number of arguments to\npass along to regrtest.py.  Previously there was a limit of 9.\n\n- bpo-26583(13): Skip testtimestampoverflow in testimport if\nbytecode files cannot be written.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=21916\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=26295\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=26523\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=26015\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=26325\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=25940\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=25616\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=25449\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=25188\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=22806\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=18174\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=25260\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=26583\n\nFile: python3.12.info,  Node: Build<70>,  Next: Windows<63>,  Prev: Tests<66>,  Up: Python 3 6 0 alpha 1\n\n1.22.81.7 Build\n...............\n\n- bpo-21277(1): Don't try to link ctypes with a fficonvenience\nlibrary.\n\n- bpo-26884(2): Fix linking extension modules for cross builds.\nPatch by Xavier de Gaye.\n\n- bpo-26932(3): Fixed support of RTLD* constants defined as enum\nvalues, not via macros (in particular on Android).  Patch by Chi\nHsuan Yen.\n\n- bpo-22359(4): Disable the rules for running freezeimportlib and\npgen when cross-compiling.  The output of these programs is\nnormally saved with the source code anyway, and is still\nregenerated when doing a native build.  Patch by Xavier de Gaye.\n\n- bpo-21668(5): Link audioop, datetime, ctypestest modules to\nlibm, except on Mac OS X. Patch written by Chi Hsuan Yen.\n\n- bpo-25702(6): A -with-lto configure option has been added that will\nenable link time optimizations at build time during a make\nprofile-opt.  Some compilers and toolchains are known to not\nproduce stable code when using LTO, be sure to test things\nthoroughly before relying on it.  It can provide a few % speed up\nover profile-opt alone.\n\n- bpo-26624(7): Adds validation of ucrtbase[d].dll version with\nwarning for old versions.\n\n- bpo-17603(8): Avoid error about nonexistent fileblocks.o file by\nusing a lower-level check for stblocks in struct stat.\n\n- bpo-26079(9): Fixing the build output folder for tix-8.4.3.6.\nPatch by Bjoern Thiel.\n\n- bpo-26465(10): Update Windows builds to use OpenSSL 1.0.2g.\n\n- bpo-25348(11): Added '--pgo' and '--pgo-job' arguments to\n'PCbuild\\build.bat' for building with Profile-Guided Optimization.\nThe old 'PCbuild\\buildpgo.bat' script is removed.\n\n- bpo-25827(12): Add support for building with ICC to 'configure',\nincluding a new '--with-icc' flag.\n\n- bpo-25696(13): Fix installation of Python on UNIX with make -j9.\n\n- bpo-24986(14): It is now possible to build Python on Windows\nwithout errors when external libraries are not available.\n\n- bpo-24421(15): Compile Modules/math.c once, before building\nextensions.  Previously it could fail to compile properly if the\nmath and cmath builds were concurrent.\n\n- bpo-26465(16): Update OS X 10.5+ 32-bit-only installer to build and\nlink with OpenSSL 1.0.2g.\n\n- bpo-26268(17): Update Windows builds to use OpenSSL 1.0.2f.\n\n- bpo-25136(18): Support Apple Xcode 7's new textual SDK stub\nlibraries.\n\n- bpo-24324(19): Do not enable unreachable code warnings when using\ngcc as the option does not work correctly in older versions of gcc\nand has been silently removed as of gcc-4.5.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=21277\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=26884\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=26932\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=22359\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=21668\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=25702\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=26624\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=17603\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=26079\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=26465\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=25348\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=25827\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=25696\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=24986\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=24421\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=26465\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=26268\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=25136\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=24324\n\nFile: python3.12.info,  Node: Windows<63>,  Next: Tools/Demos<41>,  Prev: Build<70>,  Up: Python 3 6 0 alpha 1\n\n1.22.81.8 Windows\n.................\n\n- bpo-27053(1): Updates makezip.py to correctly generate library ZIP\nfile.\n\n- bpo-26268(2): Update the preparessl.py script to handle OpenSSL\nreleases that don't include the contents of the include directory\n(that is, 1.0.2e and later).\n\n- bpo-26071(3): bdistwininst created binaries fail to start and find\n32bit Python\n\n- bpo-26073(4): Update the list of magic numbers in launcher\n\n- bpo-26065(5): Excludes venv from library when generating embeddable\ndistro.\n\n- bpo-25022(6): Removed very outdated PC/examplent/ directory.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27053\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=26268\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=26071\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=26073\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=26065\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=25022\n\nFile: python3.12.info,  Node: Tools/Demos<41>,  Next: C API<59>,  Prev: Windows<63>,  Up: Python 3 6 0 alpha 1\n\n1.22.81.9 Tools/Demos\n.....................\n\n- bpo-26799(1): Fix python-gdb.py: don't get C types once when the\nPython code is loaded, but get C types on demand.  The C types can\nchange if python-gdb.py is loaded before the Python executable.\nPatch written by Thomas Ilsche.\n\n- bpo-26271(2): Fix the Freeze tool to properly use flags passed\nthrough configure.  Patch by Daniel Shaulov.\n\n- bpo-26489(3): Add dictionary unpacking support to\nTools/parser/unparse.py.  Patch by Guo Ci Teo.\n\n- bpo-26316(4): Fix variable name typo in Argument Clinic.\n\n- bpo-25440(5): Fix output of python-config -extension-suffix.\n\n- bpo-25154(6): The pyvenv script has been deprecated in favour of\n'python3 -m venv'.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26799\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=26271\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=26489\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=26316\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=25440\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=25154\n\nFile: python3.12.info,  Node: C API<59>,  Prev: Tools/Demos<41>,  Up: Python 3 6 0 alpha 1\n\n1.22.81.10 C API\n................\n\n- bpo-26312(1): SystemError is now raised in all programming bugs\nwith using PyArgParseTupleAndKeywords().  RuntimeError did raised\nbefore in some programming bugs.\n\n- bpo-26198(2): ValueError is now raised instead of TypeError on\nbuffer overflow in parsing \"es#\" and \"et#\" format units.\nSystemError is now raised instead of TypeError on programmatical\nerror in parsing format string.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26312\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=26198\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 5 5 final,  Next: Python 3 5 5 release candidate 1,  Prev: Python 3 6 0 alpha 1,  Up: Changelog": {
            "content": "'Release date: 2018-02-04'\n\nThere were no new changes in version 3.5.5.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 5 5 release candidate 1,  Next: Python 3 5 4 final,  Prev: Python 3 5 5 final,  Up: Changelog": {
            "content": "'Release date: 2018-01-23'\n\n* Menu:\n\n* Security: Security<42>.\n* Core and Builtins: Core and Builtins<74>.\n* Library: Library<74>.\n\nFile: python3.12.info,  Node: Security<42>,  Next: Core and Builtins<74>,  Up: Python 3 5 5 release candidate 1\n\n1.22.83.1 Security\n..................\n\n- bpo-32551(1): The 'sys.path[0]' initialization change for\nbpo-29139(2) caused a regression by revealing an inconsistency in\nhow sys.path is initialized when executing 'main' from a\nzipfile, directory, or other import location.  This is considered a\npotential security issue, as it may lead to privileged processes\nunexpectedly loading code from user controlled directories in\nsituations where that was not previously the case.  The interpreter\nnow consistently avoids ever adding the import location's parent\ndirectory to 'sys.path', and ensures no other 'sys.path' entries\nare inadvertently modified when inserting the import location named\non the command line.  (Originally reported as bpo-29723(3) against\nPython 3.6rc1, but it was missed at the time that the then upcoming\nPython 3.5.4 release would also be affected)\n\n- bpo-30657(4): Fixed possible integer overflow in\nPyBytesDecodeEscape, CVE-2017-1000158.  Original patch by Jay\nBosamiya; rebased to Python 3 by Miro Hron??ok.\n\n- bpo-30947(5): Upgrade libexpat embedded copy from version 2.2.1 to\n2.2.3 to get security fixes.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32551\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=29139\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=29723\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=30657\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=30947\n\nFile: python3.12.info,  Node: Core and Builtins<74>,  Next: Library<74>,  Prev: Security<42>,  Up: Python 3 5 5 release candidate 1\n\n1.22.83.2 Core and Builtins\n...........................\n\n- bpo-31095(1): Fix potential crash during GC caused by 'tpdealloc'\nwhich doesn't call 'PyObjectGCUnTrack()'.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=31095\n\nFile: python3.12.info,  Node: Library<74>,  Prev: Core and Builtins<74>,  Up: Python 3 5 5 release candidate 1\n\n1.22.83.3 Library\n.................\n\n- bpo-32072(1): Fixed issues with binary plists: Fixed saving\nbytearrays.  Identical objects will be saved only once.  Equal\nreferences will be load as identical objects.  Added support for\nsaving and loading recursive data structures.\n\n- bpo-31170(2): expat: Update libexpat from 2.2.3 to 2.2.4.  Fix\ncopying of partial characters for UTF-8 input (libexpat bug 115):\n'https://github.com/libexpat/libexpat/issues/115'\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=32072\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=31170\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 5 4 final,  Next: Python 3 5 4 release candidate 1,  Prev: Python 3 5 5 release candidate 1,  Up: Changelog": {
            "content": "'Release date: 2017-08-07'\n\n* Menu:\n\n* Library: Library<75>.\n\nFile: python3.12.info,  Node: Library<75>,  Up: Python 3 5 4 final\n\n1.22.84.1 Library\n.................\n\n- bpo-30119(1): ftplib.FTP.putline() now throws ValueError on\ncommands that contains CR or LF. Patch by Donghee Na.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30119\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 5 4 release candidate 1,  Next: Python 3 5 3 final,  Prev: Python 3 5 4 final,  Up: Changelog": {
            "content": "'Release date: 2017-07-23'\n\n* Menu:\n\n* Security: Security<43>.\n* Core and Builtins: Core and Builtins<75>.\n* Library: Library<76>.\n* Documentation: Documentation<68>.\n* Tests: Tests<67>.\n* Build: Build<71>.\n* Windows: Windows<64>.\n* C API: C API<60>.\n\nFile: python3.12.info,  Node: Security<43>,  Next: Core and Builtins<75>,  Up: Python 3 5 4 release candidate 1\n\n1.22.85.1 Security\n..................\n\n- bpo-30730(1): Prevent environment variables injection in subprocess\non Windows.  Prevent passing other environment variables and\ncommand arguments.\n\n- bpo-30694(2): Upgrade expat copy from 2.2.0 to 2.2.1 to get fixes\nof multiple security vulnerabilities including: CVE-2017-9233\n(External entity infinite loop DoS), CVE-2016-9063 (Integer\noverflow, re-fix), CVE-2016-0718 (Fix regression bugs from 2.2.0's\nfix to CVE-2016-0718) and CVE-2012-0876 (Counter hash flooding with\nSipHash).  Note: the CVE-2016-5300 (Use os-specific entropy sources\nlike getrandom) doesn't impact Python, since Python already gets\nentropy from the OS to set the expat secret using\n'XMLSetHashSalt()'.\n\n- bpo-30500(3): Fix urllib.parse.splithost() to correctly parse\nfragments.  For example, 'splithost('//127.0.0.1#@evil.com/')' now\ncorrectly returns the '127.0.0.1' host, instead of treating\n'@evil.com' as the host in an authentication ('login@host').\n\n- bpo-29591(4): Update expat copy from 2.1.1 to 2.2.0 to get fixes of\nCVE-2016-0718 and CVE-2016-4472.  See\n'https://sourceforge.net/p/expat/bugs/537/' for more information.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30730\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=30694\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=30500\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=29591\n\nFile: python3.12.info,  Node: Core and Builtins<75>,  Next: Library<76>,  Prev: Security<43>,  Up: Python 3 5 4 release candidate 1\n\n1.22.85.2 Core and Builtins\n...........................\n\n- bpo-30876(1): Relative import from unloaded package now reimports\nthe package instead of failing with SystemError.  Relative import\nfrom non-package now fails with ImportError rather than\nSystemError.\n\n- bpo-30765(2): Avoid blocking in pthreadmutexlock() when\nPyThreadacquirelock() is asked not to block.\n\n- bpo-27945(3): Fixed various segfaults with dict when input\ncollections are mutated during searching, inserting or comparing.\nBased on patches by Duane Griffin and Tim Mitchell.\n\n- bpo-25794(4): Fixed type.setattr() and type.delattr() for\nnon-interned attribute names.  Based on patch by Eryk Sun.\n\n- bpo-29935(5): Fixed error messages in the index() method of tuple,\nlist and deque when pass indices of wrong type.\n\n- bpo-28876(6): 'bool(range)' works even if 'len(range)' raises *note\nOverflowError: 68d.\n\n- bpo-29600(7): Fix wrapping coroutine return values in\nStopIteration.\n\n- bpo-29537(8): Restore runtime compatibility with bytecode files\ngenerated by CPython 3.5.0 to 3.5.2, and adjust the eval loop to\navoid the problems that could be caused by the malformed variant of\nthe BUILDMAPUNPACKWITHCALL opcode that they may contain.  Patch\nby Petr Viktorin, Serhiy Storchaka, and Nick Coghlan.\n\n- bpo-28598(9): Support rmod for subclasses of str being called\nbefore str.mod.  Patch by Martijn Pieters.\n\n- bpo-29602(10): Fix incorrect handling of signed zeros in complex\nconstructor for complex subclasses and for inputs having a\ncomplex method.  Patch by Serhiy Storchaka.\n\n- bpo-29347(11): Fixed possibly dereferencing undefined pointers when\ncreating weakref objects.\n\n- bpo-29438(12): Fixed use-after-free problem in key sharing dict.\n\n- bpo-29319(13): Prevent RunMainFromImporter overwriting sys.path[0].\n\n- bpo-29337(14): Fixed possible BytesWarning when compare the code\nobjects.  Warnings could be emitted at compile time.\n\n- bpo-29478(15): If maxlinelength=None is specified while using the\nCompat32 policy, it is no longer ignored.  Patch by Mircea Cosbuc.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30876\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=30765\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=27945\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=25794\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=29935\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=28876\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=29600\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=29537\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=28598\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=29602\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=29347\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=29438\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=29319\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=29337\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=29478\n\nFile: python3.12.info,  Node: Library<76>,  Next: Documentation<68>,  Prev: Core and Builtins<75>,  Up: Python 3 5 4 release candidate 1\n\n1.22.85.3 Library\n.................\n\n- bpo-29403(1): Fix 'unittest.mock''s autospec to not fail on\nmethod-bound builtin functions.  Patch by Aaron Gallagher.\n\n- bpo-30961(2): Fix decrementing a borrowed reference in tracemalloc.\n\n- bpo-30886(3): Fix multiprocessing.Queue.jointhread(): it now waits\nuntil the thread completes, even if the thread was started by the\nsame process which created the queue.\n\n- bpo-29854(4): Fix segfault in readline when using readline's\nhistory-size option.  Patch by Nir Soffer.\n\n- bpo-30807(5): signal.setitimer() may disable the timer when passed\na tiny value.  Tiny values (such as 1e-6) are valid non-zero values\nfor setitimer(), which is specified as taking\nmicrosecond-resolution intervals.  However, on some platform, our\nconversion routine could convert 1e-6 into a zero interval,\ntherefore disabling the timer instead of (re-)scheduling it.\n\n- bpo-30441(6): Fix bug when modifying os.environ while iterating\nover it\n\n- bpo-30532(7): Fix email header value parser dropping folding white\nspace in certain cases.\n\n- bpo-29169(8): Update zlib to 1.2.11.\n\n- bpo-30879(9): os.listdir() and os.scandir() now emit bytes names\nwhen called with bytes-like argument.\n\n- bpo-30746(10): Prohibited the '=' character in environment variable\nnames in 'os.putenv()' and 'os.spawn*()'.\n\n- bpo-29755(11): Fixed the lgettext() family of functions in the\ngettext module.  They now always return bytes.\n\n- bpo-30645(12): Fix path calculation in imp.loadpackage(), fixing\nit for cases when a package is only shipped with bytecodes.  Patch\nby Alexandru Ardelean.\n\n- bpo-23890(13): unittest.TestCase.assertRaises() now manually breaks\na reference cycle to not keep objects alive longer than expected.\n\n- bpo-30149(14): inspect.signature() now supports callables with\nvariable-argument parameters wrapped with partialmethod.  Patch by\nDonghee Na.\n\n- bpo-29931(15): Fixed comparison check for ipaddress.ipinterface\nobjects.  Patch by Sanjay Sundaresan.\n\n- bpo-24484(16): Avoid race condition in multiprocessing cleanup.\n\n- bpo-28994(17): The traceback no longer displayed for SystemExit\nraised in a callback registered by atexit.\n\n- bpo-30508(18): Don't log exceptions if Task/Future \"cancel()\"\nmethod was called.\n\n- bpo-28556(19): Updates to typing module: Add generic\nAsyncContextManager, add support for ContextManager on all\nversions.  Original PRs by Jelle Zijlstra and Ivan Levkivskyi\n\n- bpo-29870(20): Fix ssl sockets leaks when connection is aborted in\nasyncio/ssl implementation.  Patch by Michae\"l Sgha??er.\n\n- bpo-29743(21): Closing transport during handshake process leaks\nopen socket.  Patch by Nikolay Kim\n\n- bpo-27585(22): Fix waiter cancellation in asyncio.Lock.  Patch by\nMathieu Sornay.\n\n- bpo-30418(23): On Windows, subprocess.Popen.communicate() now also\nignore EINVAL on stdin.write() if the child process is still\nrunning but closed the pipe.\n\n- bpo-30378(24): Fix the problem that logging.handlers.SysLogHandler\ncannot handle IPv6 addresses.\n\n- bpo-29960(25): Preserve generator state when\nrandom.Random.setstate() raises an exception.  Patch by Bryan\nOlson.\n\n- bpo-30414(26): multiprocessing.Queue.feed background running\nthread do not break from main loop on exception.\n\n- bpo-30003(27): Fix handling escape characters in HZ codec.  Based\non patch by Ma Lin.\n\n- bpo-30301(28): Fix AttributeError when using SimpleQueue.empty()\nunder 'spawn' and 'forkserver' start methods.\n\n- bpo-30329(29): imaplib and poplib now catch the Windows socket\nWSAEINVAL error (code 10022) on shutdown(SHUTRDWR): An invalid\noperation was attempted.  This error occurs sometimes on SSL\nconnections.\n\n- bpo-30375(30): Warnings emitted when compile a regular expression\nnow always point to the line in the user code.  Previously they\ncould point into inners of the re module if emitted from inside of\ngroups or conditionals.\n\n- bpo-30048(31): Fixed 'Task.cancel()' can be ignored when the task\nis running coroutine and the coroutine returned without any more\n'await'.\n\n- bpo-29990(32): Fix range checking in GB18030 decoder.  Original\npatch by Ma Lin.\n\n- bpo-26293(33): Change resulted because of zipfile breakage.  (See\nalso: bpo-29094(34))\n\n- bpo-30243(35): Removed the init methods of json's scanner and\nencoder.  Misusing them could cause memory leaks or crashes.  Now\nscanner and encoder objects are completely initialized in the\nnew methods.\n\n- bpo-30185(36): Avoid KeyboardInterrupt tracebacks in forkserver\nhelper process when Ctrl-C is received.\n\n- bpo-28556(37): Various updates to typing module: add\ntyping.NoReturn type, use WrapperDescriptorType, minor bug-fixes.\nOriginal PRs by Jim Fasarakis-Hilliard and Ivan Levkivskyi.\n\n- bpo-30205(38): Fix getsockname() for unbound AFUNIX sockets on\nLinux.\n\n- bpo-30070(39): Fixed leaks and crashes in errors handling in the\nparser module.\n\n- bpo-30061(40): Fixed crashes in IOBase methods next() and\nreadlines() when readline() or next() respectively return\nnon-sizeable object.  Fixed possible other errors caused by not\nchecking results of PyObjectSize(), PySequenceSize(), or\nPyMappingSize().\n\n- bpo-30068(41): io.IOBase.readlines will check if it's closed\nfirst when hint is present.\n\n- bpo-29694(42): Fixed race condition in pathlib mkdir with flags\nparents=True.  Patch by Armin Rigo.\n\n- bpo-29692(43): Fixed arbitrary unchaining of RuntimeError\nexceptions in contextlib.contextmanager.  Patch by Siddharth\nVelankar.\n\n- bpo-29998(44): Pickling and copying ImportError now preserves name\nand path attributes.\n\n- bpo-29942(45): Fix a crash in itertools.chain.fromiterable when\nencountering long runs of empty iterables.\n\n- bpo-27863(46): Fixed multiple crashes in ElementTree caused by race\nconditions and wrong types.\n\n- bpo-28699(47): Fixed a bug in pools in multiprocessing.pool that\nraising an exception at the very first of an iterable may swallow\nthe exception or make the program hang.  Patch by Davin Potts and\nXiang Zhang.\n\n- bpo-25803(48): Avoid incorrect errors raised by\nPath.mkdir(existok=True) when the OS gives priority to errors such\nas EACCES over EEXIST.\n\n- bpo-29861(49): Release references to tasks, their arguments and\ntheir results as soon as they are finished in multiprocessing.Pool.\n\n- bpo-29884(50): faulthandler: Restore the old sigaltstack during\nteardown.  Patch by Christophe Zeitouny.\n\n- bpo-25455(51): Fixed crashes in repr of recursive buffered\nfile-like objects.\n\n- bpo-29800(52): Fix crashes in partial.repr if the keys of\npartial.keywords are not strings.  Patch by Michael Seifert.\n\n- bpo-29742(53): getextrainfo() raises exception if get called on\nclosed ssl transport.  Patch by Nikolay Kim.\n\n- bpo-8256(54): Fixed possible failing or crashing input() if\nattributes \"encoding\" or \"errors\" of sys.stdin or sys.stdout are\nnot set or are not strings.\n\n- bpo-28298(55): Fix a bug that prevented array 'Q', 'L' and 'I' from\naccepting big intables (objects that have int) as elements.\nPatch by Oren Milman.\n\n- bpo-29615(56): SimpleXMLRPCDispatcher no longer chains KeyError (or\nany other exception) to exception(s) raised in the dispatched\nmethods.  Patch by Petr Motejlek.\n\n- bpo-29704(57): asyncio.subprocess.SubprocessStreamProtocol no\nlonger closes before all pipes are closed.\n\n- bpo-29703(58): Fix asyncio to support instantiation of new event\nloops in child processes.\n\n- bpo-29376(59): Fix assertion error in\nthreading.DummyThread.isalive().\n\n- bpo-29110(60): Fix file object leak in aifc.open() when file is\ngiven as a filesystem path and is not in valid AIFF format.  Patch\nby Anthony Zhang.\n\n- bpo-28961(61): Fix unittest.mock.Call helper: don't ignore the\nname parameter anymore.  Patch written by Jiajun Huang.\n\n- bpo-29532(62): Altering a kwarg dictionary passed to\nfunctools.partial() no longer affects a partial object after\ncreation.\n\n- bpo-28556(63): Various updates to typing module: typing.Counter,\ntyping.ChainMap, improved ABC caching, etc.  Original PRs by Jelle\nZijlstra, Ivan Levkivskyi, Manuel Krebber, and ??ukasz Langa.\n\n- bpo-29100(64): Fix datetime.fromtimestamp() regression introduced\nin Python 3.6.0: check minimum and maximum years.\n\n- bpo-29519(65): Fix weakref spewing exceptions during interpreter\nshutdown when used with a rare combination of multiprocessing and\ncustom codecs.\n\n- bpo-29416(66): Prevent infinite loop in pathlib.Path.mkdir\n\n- bpo-29444(67): Fixed out-of-bounds buffer access in the group()\nmethod of the match object.  Based on patch by WGH.\n\n- bpo-29335(68): Fix subprocess.Popen.wait() when the child process\nhas exited to a stopped instead of terminated state (ex: when under\nptrace).\n\n- bpo-29290(69): Fix a regression in argparse that help messages\nwould wrap at non-breaking spaces.\n\n- bpo-28735(70): Fixed the comparison of mock.MagickMock with\nmock.ANY.\n\n- bpo-29011(71): Fix an important omission by adding Deque to the\ntyping module.\n\n- bpo-29219(72): Fixed infinite recursion in the repr of\nuninitialized ctypes.CDLL instances.\n\n- bpo-28969(73): Fixed race condition in C implementation of\nfunctools.lrucache.  KeyError could be raised when cached function\nwith full cache was simultaneously called from different threads\nwith the same uncached arguments.\n\n- bpo-29142(74): In urllib.request, suffixes in noproxy environment\nvariable with leading dots could match related hostnames again\n(e.g.  .b.c matches a.b.c).  Patch by Milan Oberkirch.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=29403\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=30961\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=30886\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=29854\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=30807\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=30441\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=30532\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=29169\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=30879\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=30746\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=29755\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=30645\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=23890\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=30149\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=29931\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=24484\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=28994\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=30508\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=28556\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=29870\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=29743\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=27585\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=30418\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=30378\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=29960\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=30414\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=30003\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=30301\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=30329\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=30375\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=30048\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=29990\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=26293\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=29094\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=30243\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=30185\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=28556\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=30205\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=30070\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=30061\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=30068\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=29694\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=29692\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=29998\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=29942\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=27863\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=28699\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=25803\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=29861\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=29884\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=25455\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=29800\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=29742\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=8256\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=28298\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=29615\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=29704\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=29703\n\n(59) https://bugs.python.org/issue?@action=redirect&bpo=29376\n\n(60) https://bugs.python.org/issue?@action=redirect&bpo=29110\n\n(61) https://bugs.python.org/issue?@action=redirect&bpo=28961\n\n(62) https://bugs.python.org/issue?@action=redirect&bpo=29532\n\n(63) https://bugs.python.org/issue?@action=redirect&bpo=28556\n\n(64) https://bugs.python.org/issue?@action=redirect&bpo=29100\n\n(65) https://bugs.python.org/issue?@action=redirect&bpo=29519\n\n(66) https://bugs.python.org/issue?@action=redirect&bpo=29416\n\n(67) https://bugs.python.org/issue?@action=redirect&bpo=29444\n\n(68) https://bugs.python.org/issue?@action=redirect&bpo=29335\n\n(69) https://bugs.python.org/issue?@action=redirect&bpo=29290\n\n(70) https://bugs.python.org/issue?@action=redirect&bpo=28735\n\n(71) https://bugs.python.org/issue?@action=redirect&bpo=29011\n\n(72) https://bugs.python.org/issue?@action=redirect&bpo=29219\n\n(73) https://bugs.python.org/issue?@action=redirect&bpo=28969\n\n(74) https://bugs.python.org/issue?@action=redirect&bpo=29142\n\nFile: python3.12.info,  Node: Documentation<68>,  Next: Tests<67>,  Prev: Library<76>,  Up: Python 3 5 4 release candidate 1\n\n1.22.85.4 Documentation\n.......................\n\n- bpo-30176(1): Add missing attribute related constants in curses\ndocumentation.\n\n- bpo-26985(2): Add missing info of code object in inspect\ndocumentation.\n\n- bpo-28929(3): Link the documentation to its source file on GitHub.\n\n- bpo-25008(4): Document smtpd.py as effectively deprecated and add a\npointer to aiosmtpd, a third-party asyncio-based replacement.\n\n- bpo-26355(5): Add canonical header link on each page to\ncorresponding major version of the documentation.  Patch by\nMatthias Bussonnier.\n\n- bpo-29349(6): Fix Python 2 syntax in code for building the\ndocumentation.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30176\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=26985\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=28929\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=25008\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=26355\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=29349\n\nFile: python3.12.info,  Node: Tests<67>,  Next: Build<71>,  Prev: Documentation<68>,  Up: Python 3 5 4 release candidate 1\n\n1.22.85.5 Tests\n...............\n\n- bpo-30822(1): Fix regrtest command line parser to allow passing -u\nextralargefile to run testzipfile64.\n\n- bpo-30383(2): regrtest: Enhance regrtest and backport features from\nthe master branch.  Add options: -coverage, -testdir, -list-tests\n(list test files, don't run them), -list-cases (list test\nidentifiers, don't run them, bpo-30523(3)), -matchfile (load a list\nof test filters from a text file, bpo-30540(4)), -slowest (alias to\n-slow).  Enhance output: add timestamp, test result, currently\nrunning tests, \"Tests result: xxx\" summary with total duration,\netc.  Fix reference leak hunting in regrtest, -huntrleaks: regrtest\nnow warms up caches, create explicitly all internal singletons\nwhich are created on demand to prevent false positives when\nchecking for reference leaks.  (bpo-30675(5)).\n\n- bpo-30357(6): testthread: setUp() now uses\nsupport.threadingsetup() and support.threadingcleanup() to wait\nuntil threads complete to avoid random side effects on following\ntests.  Initial patch written by Grzegorz Grzywacz.\n\n- bpo-28087(7): Skip testasyncore and testeintr poll failures on\nmacOS. Skip some tests of select.poll when running on macOS due to\nunresolved issues with the underlying system poll function on some\nmacOS versions.\n\n- bpo-30197(8): Enhanced functions swapattr() and swapitem() in the\ntest.support module.  They now work when delete replaced attribute\nor item inside the with statement.  The old value of the attribute\nor item (or None if it doesn't exist) now will be assigned to the\ntarget of the \"as\" clause, if there is one.\n\n- bpo-29571(9): to match the behaviour of the 're.LOCALE' flag,\ntestre.testlocaleflag now uses\n'locale.getpreferredencoding(False)' to determine the candidate\nencoding for the test regex (allowing it to correctly skip the test\nwhen the default locale encoding is a multi-byte encoding)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30822\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=30383\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=30523\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=30540\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=30675\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=30357\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=28087\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=30197\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=29571\n\nFile: python3.12.info,  Node: Build<71>,  Next: Windows<64>,  Prev: Tests<67>,  Up: Python 3 5 4 release candidate 1\n\n1.22.85.6 Build\n...............\n\n- bpo-29243(1): Prevent unnecessary rebuilding of Python during 'make\ntest', 'make install' and some other make targets when configured\nwith '--enable-optimizations'.\n\n- bpo-23404(2): Don't regenerate generated files based on file\nmodification time anymore: the action is now explicit.  Replace\n'make touch' with 'make regen-all'.\n\n- bpo-29643(3): Fix '--enable-optimization' didn't work.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=29243\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=23404\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=29643\n\nFile: python3.12.info,  Node: Windows<64>,  Next: C API<60>,  Prev: Build<71>,  Up: Python 3 5 4 release candidate 1\n\n1.22.85.7 Windows\n.................\n\n- bpo-30687(1): Locate msbuild.exe on Windows when building rather\nthan vcvarsall.bat\n\n- bpo-29392(2): Prevent crash when passing invalid arguments into\nmsvcrt module.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=30687\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=29392\n\nFile: python3.12.info,  Node: C API<60>,  Prev: Windows<64>,  Up: Python 3 5 4 release candidate 1\n\n1.22.85.8 C API\n...............\n\n- bpo-27867(1): Function PySliceGetIndicesEx() is replaced with a\nmacro if PyLIMITEDAPI is set to the value between 0x03050400 and\n0x03060000 (not including) or 0x03060100 or higher.\n\n- bpo-29083(2): Fixed the declaration of some public API functions.\nPyArgVaParse() and PyArgVaParseTupleAndKeywords() were not\navailable in limited API. PyArgValidateKeywordArguments(),\nPyArgUnpackTuple() and PyBuildValue() were not available in\nlimited API of version < 3.3 when PYSSIZETCLEAN is defined.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27867\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=29083\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 5 3 final,  Next: Python 3 5 3 release candidate 1,  Prev: Python 3 5 4 release candidate 1,  Up: Changelog": {
            "content": "'Release date: 2017-01-17'\n\nThere were no code changes between 3.5.3rc1 and 3.5.3 final.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 5 3 release candidate 1,  Next: Python 3 5 2 final,  Prev: Python 3 5 3 final,  Up: Changelog": {
            "content": "'Release date: 2017-01-02'\n\n* Menu:\n\n* Security: Security<44>.\n* Core and Builtins: Core and Builtins<76>.\n* Library: Library<77>.\n* IDLE: IDLE<50>.\n* C API: C API<61>.\n* Documentation: Documentation<69>.\n* Tests: Tests<68>.\n* Tools/Demos: Tools/Demos<42>.\n* Windows: Windows<65>.\n* Build: Build<72>.\n\nFile: python3.12.info,  Node: Security<44>,  Next: Core and Builtins<76>,  Up: Python 3 5 3 release candidate 1\n\n1.22.87.1 Security\n..................\n\n- bpo-27278(1): Fix os.urandom() implementation using getrandom() on\nLinux.  Truncate size to INTMAX and loop until we collected enough\nrandom bytes, instead of casting a directly Pyssizet to int.\n\n- bpo-22636(2): Avoid shell injection problems with\nctypes.util.findlibrary().\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27278\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=22636\n\nFile: python3.12.info,  Node: Core and Builtins<76>,  Next: Library<77>,  Prev: Security<44>,  Up: Python 3 5 3 release candidate 1\n\n1.22.87.2 Core and Builtins\n...........................\n\n- bpo-29073(1): bytearray formatting no longer truncates on first\nnull byte.\n\n- bpo-28932(2): Do not include <sys/random.h> if it does not exist.\n\n- bpo-28147(3): Fix a memory leak in split-table dictionaries:\nsetattr() must not convert combined table into split table.\n\n- bpo-25677(4): Correct the positioning of the syntax error caret for\nindented blocks.  Based on patch by Michael Layzell.\n\n- bpo-29000(5): Fixed bytes formatting of octals with zero padding in\nalternate form.\n\n- bpo-28512(6): Fixed setting the offset attribute of SyntaxError by\nPyErrSyntaxLocationEx() and PyErrSyntaxLocationObject().\n\n- bpo-28991(7): functools.lrucache() was susceptible to an obscure\nreentrancy bug caused by a monkey-patched len() function.\n\n- bpo-28648(8): Fixed crash in PyDecodeLocale() in debug build on\nMac OS X when decode astral characters.  Patch by Xiang Zhang.\n\n- bpo-19398(9): Extra slash no longer added to sys.path components in\ncase of empty compile-time PYTHONPATH components.\n\n- bpo-28426(10): Fixed potential crash in PyUnicodeAsDecodedObject()\nin debug build.\n\n- bpo-23782(11): Fixed possible memory leak in PyTracebackAdd() and\nexception loss in PyTraceBackHere().\n\n- bpo-28379(12): Added sanity checks and tests for\nPyUnicodeCopyCharacters().  Patch by Xiang Zhang.\n\n- bpo-28376(13): The type of long range iterator is now registered as\nIterator.  Patch by Oren Milman.\n\n- bpo-28376(14): The constructor of rangeiterator now checks that\nstep is not 0.  Patch by Oren Milman.\n\n- bpo-26906(15): Resolving special methods of uninitialized type now\ncauses implicit initialization of the type instead of a fail.\n\n- bpo-18287(16): PyTypeReady() now checks that tpname is not NULL.\nOriginal patch by Niklas Koep.\n\n- bpo-24098(17): Fixed possible crash when AST is changed in process\nof compiling it.\n\n- bpo-28350(18): String constants with null character no longer\ninterned.\n\n- bpo-26617(19): Fix crash when GC runs during weakref callbacks.\n\n- bpo-27942(20): String constants now interned recursively in tuples\nand frozensets.\n\n- bpo-21578(21): Fixed misleading error message when ImportError\ncalled with invalid keyword args.\n\n- bpo-28203(22): Fix incorrect type in error message from\n'complex(1.0, {2:3})'.  Patch by Soumya Sharma.\n\n- bpo-27955(23): Fallback on reading /dev/urandom device when the\ngetrandom() syscall fails with EPERM, for example when blocked by\nSECCOMP.\n\n- bpo-28131(24): Fix a regression in zipimport's compilesource().\nzipimport should use the same optimization level as the\ninterpreter.\n\n- bpo-25221(25): Fix corrupted result from PyLongFromLong(0) when\nPython is compiled with NSMALLPOSINTS = 0.\n\n- bpo-25758(26): Prevents zipimport from unnecessarily encoding a\nfilename (patch by Eryk Sun)\n\n- bpo-28189(27): dictitemscontains no longer swallows compare\nerrors.  (Patch by Xiang Zhang)\n\n- bpo-27812(28): Properly clear out a generator's frame's\nbackreference to the generator to prevent crashes in frame.clear().\n\n- bpo-27811(29): Fix a crash when a coroutine that has not been\nawaited is finalized with warnings-as-errors enabled.\n\n- bpo-27587(30): Fix another issue found by PVS-Studio: Null pointer\ncheck after use of 'def' in PyStateAddModule().  Initial patch by\nChristian Heimes.\n\n- bpo-26020(31): set literal evaluation order did not match\ndocumented behaviour.\n\n- bpo-27782(32): Multi-phase extension module import now correctly\nallows the 'mmethods' field to be used to add module level\nfunctions to instances of non-module types returned from\n'Pycreatemod'.  Patch by Xiang Zhang.\n\n- bpo-27936(33): The round() function accepted a second None argument\nfor some types but not for others.  Fixed the inconsistency by\naccepting None for all numeric types.\n\n- bpo-27487(34): Warn if a submodule argument to \"python -m\" or\nrunpy.runmodule() is found in sys.modules after parent packages\nare imported, but before the submodule is executed.\n\n- bpo-27558(35): Fix a SystemError in the implementation of \"raise\"\nstatement.  In a brand new thread, raise a RuntimeError since there\nis no active exception to reraise.  Patch written by Xiang Zhang.\n\n- bpo-27419(36): Standard import() no longer look up \"import\"\nin globals or builtins for importing submodules or \"from import\".\nFixed handling an error of non-string package name.\n\n- bpo-27083(37): Respect the PYTHONCASEOK environment variable under\nWindows.\n\n- bpo-27514(38): Make having too many statically nested blocks a\nSyntaxError instead of SystemError.\n\n- bpo-27473(39): Fixed possible integer overflow in bytes and\nbytearray concatenations.  Patch by Xiang Zhang.\n\n- bpo-27507(40): Add integer overflow check in bytearray.extend().\nPatch by Xiang Zhang.\n\n- bpo-27581(41): Don't rely on wrapping for overflow check in\nPySequenceTuple().  Patch by Xiang Zhang.\n\n- bpo-27443(42): lengthhint() of bytearray iterators no longer\nreturn a negative integer for a resized bytearray.\n\n- bpo-27942(43): Fix memory leak in codeobject.c\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=29073\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=28932\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=28147\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=25677\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=29000\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=28512\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=28991\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=28648\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=19398\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=28426\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=23782\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=28379\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=28376\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=28376\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=26906\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=18287\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=24098\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=28350\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=26617\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=27942\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=21578\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=28203\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=27955\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=28131\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=25221\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=25758\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=28189\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=27812\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=27811\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=27587\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=26020\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=27782\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=27936\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=27487\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=27558\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=27419\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=27083\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=27514\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=27473\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=27507\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=27581\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=27443\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=27942\n\nFile: python3.12.info,  Node: Library<77>,  Next: IDLE<50>,  Prev: Core and Builtins<76>,  Up: Python 3 5 3 release candidate 1\n\n1.22.87.3 Library\n.................\n\n- bpo-15812(1): inspect.getframeinfo() now correctly shows the first\nline of a context.  Patch by Sam Breese.\n\n- bpo-29094(2): Offsets in a ZIP file created with extern file object\nand modes \"w\" and \"x\" now are relative to the start of the file.\n\n- bpo-13051(3): Fixed recursion errors in large or resized\ncurses.textpad.Textbox.  Based on patch by Tycho Andersen.\n\n- bpo-29119(4): Fix weakrefs in the pure python version of\ncollections.OrderedDict movetoend() method.  Contributed by Andra\nBogildea.\n\n- bpo-9770(5): curses.ascii predicates now work correctly with\nnegative integers.\n\n- bpo-28427(6): old keys should not remove new values from\nWeakValueDictionary when collecting from another thread.\n\n- bpo-28923(7): Remove editor artifacts from Tix.py.\n\n- bpo-28871(8): Fixed a crash when deallocate deep ElementTree.\n\n- bpo-19542(9): Fix bugs in WeakValueDictionary.setdefault() and\nWeakValueDictionary.pop() when a GC collection happens in another\nthread.\n\n- bpo-20191(10): Fixed a crash in resource.prlimit() when pass a\nsequence that doesn't own its elements as limits.\n\n- bpo-28779(11): multiprocessing.setforkserverpreload() would crash\nthe forkserver process if a preloaded module instantiated some\nmultiprocessing objects such as locks.\n\n- bpo-28847(12): dbm.dumb now supports reading read-only files and no\nlonger writes the index file when it is not changed.\n\n- bpo-25659(13): In ctypes, prevent a crash calling the frombuffer()\nand frombuffercopy() methods on abstract classes like Array.\n\n- bpo-28732(14): Fix crash in os.spawnv() with no elements in args\n\n- bpo-28485(15): Always raise ValueError for negative\ncompileall.compiledir(workers=...) parameter, even when\nmultithreading is unavailable.\n\n- bpo-28387(16): Fixed possible crash in io.TextIOWrapper\ndeallocator when the garbage collector is invoked in other thread.\nBased on patch by Sebastian Cufre.\n\n- bpo-27517(17): LZMA compressor and decompressor no longer raise\nexceptions if given empty data twice.  Patch by Benjamin Fogle.\n\n- bpo-28549(18): Fixed segfault in curses's addch() with ncurses6.\n\n- bpo-28449(19): tarfile.open() with mode \"r\" or \"r:\" now tries to\nopen a tar file with compression before trying to open it without\ncompression.  Otherwise it had 50% chance failed with\nignorezeros=True.\n\n- bpo-23262(20): The webbrowser module now supports Firefox 36+ and\nderived browsers.  Based on patch by Oleg Broytman.\n\n- bpo-27939(21): Fixed bugs in tkinter.ttk.LabeledScale and\ntkinter.Scale caused by representing the scale as float value\ninternally in Tk.  tkinter.IntVar now works if float value is set\nto underlying Tk variable.\n\n- bpo-28255(22): calendar.TextCalendar().prmonth() no longer prints a\nspace at the start of new line after printing a month's calendar.\nPatch by Xiang Zhang.\n\n- bpo-20491(23): The textwrap.TextWrapper class now honors\nnon-breaking spaces.  Based on patch by Kaarle Ritvanen.\n\n- bpo-28353(24): os.fwalk() no longer fails on broken links.\n\n- bpo-25464(25): Fixed HList.headerexists() in tkinter.tix module by\naddin a workaround to Tix library bug.\n\n- bpo-28488(26): shutil.makearchive() no longer add entry \"./\" to\nZIP archive.\n\n- bpo-24452(27): Make webbrowser support Chrome on Mac OS X.\n\n- bpo-20766(28): Fix references leaked by pdb in the handling of\nSIGINT handlers.\n\n- bpo-26293(29): Fixed writing ZIP files that starts not from the\nstart of the file.  Offsets in ZIP file now are relative to the\nstart of the archive in conforming to the specification.\n\n- bpo-28321(30): Fixed writing non-BMP characters with binary format\nin plistlib.\n\n- bpo-28322(31): Fixed possible crashes when unpickle itertools\nobjects from incorrect pickle data.  Based on patch by John Leitch.\n\n- Fix possible integer overflows and crashes in the mmap module with\nunusual usage patterns.\n\n- bpo-1703178(32): Fix the ability to pass the -link-objects option\nto the distutils buildext command.\n\n- bpo-28253(33): Fixed calendar functions for extreme months: 0001-01\nand 9999-12.  Methods itermonthdays() and itermonthdays2() are\nreimplemented so that they don't call itermonthdates() which can\ncause datetime.date under/overflow.\n\n- bpo-28275(34): Fixed possible use after free in the decompress()\nmethods of the LZMADecompressor and BZ2Decompressor classes.\nOriginal patch by John Leitch.\n\n- bpo-27897(35): Fixed possible crash in\nsqlite3.Connection.createcollation() if pass invalid string-like\nobject as a name.  Patch by Xiang Zhang.\n\n- bpo-18893(36): Fix invalid exception handling in\nLib/ctypes/macholib/dyld.py.  Patch by Madison May.\n\n- bpo-27611(37): Fixed support of default root window in the\ntkinter.tix module.\n\n- bpo-27348(38): In the traceback module, restore the formatting of\nexception messages like \"Exception: None\".  This fixes a regression\nintroduced in 3.5a2.\n\n- bpo-25651(39): Allow false values to be used for msg parameter of\nsubTest().\n\n- bpo-27932(40): Prevent memory leak in win32ver().\n\n- Fix UnboundLocalError in socket.sendfileusesendfile.\n\n- bpo-28075(41): Check for ERRORACCESSDENIED in Windows\nimplementation of os.stat().  Patch by Eryk Sun.\n\n- bpo-25270(42): Prevent codecs.escapeencode() from raising\nSystemError when an empty bytestring is passed.\n\n- bpo-28181(43): Get antigravity over HTTPS. Patch by Kaartic\nSivaraam.\n\n- bpo-25895(44): Enable WebSocket URL schemes in\nurllib.parse.urljoin.  Patch by Gergely Imreh and Markus\nHoltermann.\n\n- bpo-27599(45): Fixed buffer overrun in binascii.b2aqp() and\nbinascii.a2bqp().\n\n- bpo-19003(46): m email.generator now replaces only '\\r' and/or '\\n'\nline endings, per the RFC, instead of all unicode line endings.\n\n- bpo-28019(47): itertools.count() no longer rounds non-integer step\nin range between 1.0 and 2.0 to 1.\n\n- bpo-25969(48): Update the lib2to3 grammar to handle the unpacking\ngeneralizations added in 3.5.\n\n- bpo-14977(49): mailcap now respects the order of the lines in the\nmailcap files (\"first match\"), as required by RFC 1542.  Patch by\nMichael Lazar.\n\n- bpo-24594(50): Validates persist parameter when opening MSI\ndatabase\n\n- bpo-17582(51): xml.etree.ElementTree nows preserves whitespaces in\nattributes (Patch by Duane Griffin.  Reviewed and approved by\nStefan Behnel.)\n\n- bpo-28047(52): Fixed calculation of line length used for the base64\nCTE in the new email policies.\n\n- bpo-27445(53): Don't pass str(charset) to MIMEText.setpayload().\nPatch by Claude Paroz.\n\n- bpo-22450(54): urllib now includes an 'Accept: */*' header among\nthe default headers.  This makes the results of REST API requests\nmore consistent and predictable especially when proxy servers are\ninvolved.\n\n- lib2to3.pgen3.driver.loadgrammar() now creates a stable cache file\nbetween runs given the same Grammar.txt input regardless of the\nhash randomization setting.\n\n- bpo-27570(55): Avoid zero-length memcpy() etc calls with null\nsource pointers in the \"ctypes\" and \"array\" modules.\n\n- bpo-22233(56): Break email header lines 'only' on the RFC specified\nCR and LF characters, not on arbitrary unicode line breaks.  This\nalso fixes a bug in HTTP header parsing.\n\n- bpo-27988(57): Fix email iterattachments incorrect mutation of\npayload list.\n\n- bpo-27691(58): Fix ssl module's parsing of GENRID subject\nalternative name fields in X.509 certs.\n\n- bpo-27850(59): Remove 3DES from ssl module's default cipher list to\ncounter measure sweet32 attack (CVE-2016-2183).\n\n- bpo-27766(60): Add ChaCha20 Poly1305 to ssl module's default cipher\nlist.  (Required OpenSSL 1.1.0 or LibreSSL).\n\n- bpo-26470(61): Port ssl and hashlib module to OpenSSL 1.1.0.\n\n- Remove support for passing a file descriptor to os.access.  It\nnever worked but previously didn't raise.\n\n- bpo-12885(62): Fix error when distutils encounters symlink.\n\n- bpo-27881(63): Fixed possible bugs when setting\nsqlite3.Connection.isolationlevel.  Based on patch by Xiang Zhang.\n\n- bpo-27861(64): Fixed a crash in sqlite3.Connection.cursor() when a\nfactory creates not a cursor.  Patch by Xiang Zhang.\n\n- bpo-19884(65): Avoid spurious output on OS X with Gnu Readline.\n\n- bpo-27706(66): Restore deterministic behavior of\nrandom.Random().seed() for string seeds using seeding version 1.\nAllows sequences of calls to random() to exactly match those\nobtained in Python 2.  Patch by Nofar Schnider.\n\n- bpo-10513(67): Fix a regression in Connection.commit().  Statements\nshould not be reset after a commit.\n\n- A new version of typing.py from 'https://github.com/python/typing':\nCollection (only for 3.6) (bpo-27598(68)).  Add FrozenSet to\nall (upstream #261).  Fix crash in gettypevars() (upstream\n#259).  Remove the dict constraint in ForwardRef.evaltype\n(upstream #252).\n\n- bpo-27539(69): Fix unnormalised 'Fraction.pow' result in the\ncase of negative exponent and negative base.\n\n- bpo-21718(70): cursor.description is now available for queries\nusing CTEs.\n\n- bpo-2466(71): posixpath.ismount now correctly recognizes mount\npoints which the user does not have permission to access.\n\n- bpo-27773(72): Correct some memory management errors\nserverhostname in ssl.wrapsocket().\n\n- bpo-26750(73): unittest.mock.createautospec() now works properly\nfor subclasses of property() and other data descriptors.\n\n- In the curses module, raise an error if window.getstr() or\nwindow.instr() is passed a negative value.\n\n- bpo-27783(74): Fix possible usage of uninitialized memory in\noperator.methodcaller.\n\n- bpo-27774(75): Fix possible PyDECREF on unowned object in sre.\n\n- bpo-27760(76): Fix possible integer overflow in binascii.b2aqp.\n\n- bpo-27758(77): Fix possible integer overflow in the csv module for\nlarge record lengths.\n\n- bpo-27568(78): Prevent HTTPoxy attack (CVE-2016-1000110).  Ignore\nthe HTTPPROXY variable when REQUESTMETHOD environment is set,\nwhich indicates that the script is in CGI mode.\n\n- bpo-27656(79): Do not assume sched.h defines any SCHED* constants.\n\n- bpo-27130(80): In the \"zlib\" module, fix handling of large buffers\n(typically 4 GiB) when compressing and decompressing.  Previously,\ninputs were limited to 4 GiB, and compression and decompression\noperations did not properly handle results of 4 GiB.\n\n- bpo-27533(81): Release GIL in nt.isdir\n\n- bpo-17711(82): Fixed unpickling by the persistent ID with protocol\n0.  Original patch by Alexandre Vassalotti.\n\n- bpo-27522(83): Avoid an unintentional reference cycle in\nemail.feedparser.\n\n- bpo-26844(84): Fix error message for imp.findmodule() to refer to\n'path' instead of 'name'.  Patch by Lev Maximov.\n\n- bpo-23804(85): Fix SSL zero-length recv() calls to not block and\nnot raise an error about unclean EOF.\n\n- bpo-27466(86): Change time format returned by\nhttp.cookie.time2netscape, confirming the netscape cookie format\nand making it consistent with documentation.\n\n- bpo-26664(87): Fix activate.fish by removing mis-use of '$'.\n\n- bpo-22115(88): Fixed tracing Tkinter variables: tracevdelete()\nwith wrong mode no longer break tracing, tracevinfo() now always\nreturns a list of pairs of strings, tracing in the \"u\" mode now\nworks.\n\n- Fix a scoping issue in importlib.util.LazyLoader which triggered an\nUnboundLocalError when lazy-loading a module that was already put\ninto sys.modules.\n\n- bpo-27079(89): Fixed curses.ascii functions isblank(), iscntrl()\nand ispunct().\n\n- bpo-26754(90): Some functions (compile() etc) accepted a filename\nargument encoded as an iterable of integers.  Now only strings and\nbyte-like objects are accepted.\n\n- bpo-27048(91): Prevents distutils failing on Windows when\nenvironment variables contain non-ASCII characters\n\n- bpo-27330(92): Fixed possible leaks in the ctypes module.\n\n- bpo-27238(93): Got rid of bare excepts in the turtle module.\nOriginal patch by Jelle Zijlstra.\n\n- bpo-27122(94): When an exception is raised within the context being\nmanaged by a contextlib.ExitStack() and one of the exit stack\ngenerators catches and raises it in a chain, do not re-raise the\noriginal exception when exiting, let the new chained one through.\nThis avoids the PEP 479(95) bug described in issue25782.\n\n- bpo-26386(96): Fixed ttk.TreeView selection operations with item\nid's containing spaces.\n\n- bpo-16182(97): Fix various functions in the \"readline\" module to\nuse the locale encoding, and fix getbegidx() and getendidx() to\nreturn code point indexes.\n\n- bpo-27392(98): Add loop.connectacceptedsocket().  Patch by Jim\nFulton.\n\n- bpo-27930(99): Improved behaviour of\nlogging.handlers.QueueListener.  Thanks to Paulo Andrade and Petr\nViktorin for the analysis and patch.\n\n- bpo-21201(100): Improves readability of multiprocessing error\nmessage.  Thanks to Wojciech Walczak for patch.\n\n- bpo-27456(101): asyncio: Set TCPNODELAY by default.\n\n- bpo-27906(102): Fix socket accept exhaustion during high TCP\ntraffic.  Patch by Kevin Conway.\n\n- bpo-28174(103): Handle when SOREUSEPORT isn't properly supported.\nPatch by Seth Michael Larson.\n\n- bpo-26654(104): Inspect functools.partial in\nasyncio.Handle.repr.  Patch by iceboy.\n\n- bpo-26909(105): Fix slow pipes IO in asyncio.  Patch by INADA\nNaoki.\n\n- bpo-28176(106): Fix callbacks race in\nasyncio.SelectorLoop.sockconnect.\n\n- bpo-27759(107): Fix selectors incorrectly retain invalid file\ndescriptors.  Patch by Mark Williams.\n\n- bpo-28368(108): Refuse monitoring processes if the child watcher\nhas no loop attached.  Patch by Vincent Michel.\n\n- bpo-28369(109): Raise RuntimeError when transport's FD is used with\naddreader, addwriter, etc.\n\n- bpo-28370(110): Speedup asyncio.StreamReader.readexactly.  Patch by\n?????????????????? ????????.\n\n- bpo-28371(111): Deprecate passing asyncio.Handles to\nruninexecutor.\n\n- bpo-28372(112): Fix asyncio to support formatting of non-python\ncoroutines.\n\n- bpo-28399(113): Remove UNIX socket from FS before binding.  Patch\nby ?????????????????? ????????.\n\n- bpo-27972(114): Prohibit Tasks to await on themselves.\n\n- bpo-26923(115): Fix asyncio.Gather to refuse being cancelled once\nall children are done.  Patch by Johannes Ebke.\n\n- bpo-26796(116): Don't configure the number of workers for default\nthreadpool executor.  Initial patch by Hans Lawrenz.\n\n- bpo-28600(117): Optimize loop.callsoon().\n\n- bpo-28613(118): Fix geteventloop() return the current loop if\ncalled from coroutines/callbacks.\n\n- bpo-28639(119): Fix inspect.isawaitable to always return bool Patch\nby Justin Mayfield.\n\n- bpo-28652(120): Make loop methods reject socket kinds they do not\nsupport.\n\n- bpo-28653(121): Fix a refleak in functools.lrucache.\n\n- bpo-28703(122): Fix asyncio.iscoroutinefunction to handle Mock\nobjects.\n\n- bpo-24142(123): Reading a corrupt config file left the parser in an\ninvalid state.  Original patch by Florian Ho\"ch.\n\n- bpo-28990(124): Fix SSL hanging if connection is closed before\nhandshake completed.  (Patch by HoHo-Ho)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=15812\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=29094\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=13051\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=29119\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=9770\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=28427\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=28923\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=28871\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=19542\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=20191\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=28779\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=28847\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=25659\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=28732\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=28485\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=28387\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=27517\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=28549\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=28449\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=23262\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=27939\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=28255\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=20491\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=28353\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=25464\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=28488\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=24452\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=20766\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=26293\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=28321\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=28322\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=1703178\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=28253\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=28275\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=27897\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=18893\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=27611\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=27348\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=25651\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=27932\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=28075\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=25270\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=28181\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=25895\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=27599\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=19003\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=28019\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=25969\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=14977\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=24594\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=17582\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=28047\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=27445\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=22450\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=27570\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=22233\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=27988\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=27691\n\n(59) https://bugs.python.org/issue?@action=redirect&bpo=27850\n\n(60) https://bugs.python.org/issue?@action=redirect&bpo=27766\n\n(61) https://bugs.python.org/issue?@action=redirect&bpo=26470\n\n(62) https://bugs.python.org/issue?@action=redirect&bpo=12885\n\n(63) https://bugs.python.org/issue?@action=redirect&bpo=27881\n\n(64) https://bugs.python.org/issue?@action=redirect&bpo=27861\n\n(65) https://bugs.python.org/issue?@action=redirect&bpo=19884\n\n(66) https://bugs.python.org/issue?@action=redirect&bpo=27706\n\n(67) https://bugs.python.org/issue?@action=redirect&bpo=10513\n\n(68) https://bugs.python.org/issue?@action=redirect&bpo=27598\n\n(69) https://bugs.python.org/issue?@action=redirect&bpo=27539\n\n(70) https://bugs.python.org/issue?@action=redirect&bpo=21718\n\n(71) https://bugs.python.org/issue?@action=redirect&bpo=2466\n\n(72) https://bugs.python.org/issue?@action=redirect&bpo=27773\n\n(73) https://bugs.python.org/issue?@action=redirect&bpo=26750\n\n(74) https://bugs.python.org/issue?@action=redirect&bpo=27783\n\n(75) https://bugs.python.org/issue?@action=redirect&bpo=27774\n\n(76) https://bugs.python.org/issue?@action=redirect&bpo=27760\n\n(77) https://bugs.python.org/issue?@action=redirect&bpo=27758\n\n(78) https://bugs.python.org/issue?@action=redirect&bpo=27568\n\n(79) https://bugs.python.org/issue?@action=redirect&bpo=27656\n\n(80) https://bugs.python.org/issue?@action=redirect&bpo=27130\n\n(81) https://bugs.python.org/issue?@action=redirect&bpo=27533\n\n(82) https://bugs.python.org/issue?@action=redirect&bpo=17711\n\n(83) https://bugs.python.org/issue?@action=redirect&bpo=27522\n\n(84) https://bugs.python.org/issue?@action=redirect&bpo=26844\n\n(85) https://bugs.python.org/issue?@action=redirect&bpo=23804\n\n(86) https://bugs.python.org/issue?@action=redirect&bpo=27466\n\n(87) https://bugs.python.org/issue?@action=redirect&bpo=26664\n\n(88) https://bugs.python.org/issue?@action=redirect&bpo=22115\n\n(89) https://bugs.python.org/issue?@action=redirect&bpo=27079\n\n(90) https://bugs.python.org/issue?@action=redirect&bpo=26754\n\n(91) https://bugs.python.org/issue?@action=redirect&bpo=27048\n\n(92) https://bugs.python.org/issue?@action=redirect&bpo=27330\n\n(93) https://bugs.python.org/issue?@action=redirect&bpo=27238\n\n(94) https://bugs.python.org/issue?@action=redirect&bpo=27122\n\n(95) https://peps.python.org/pep-0479/\n\n(96) https://bugs.python.org/issue?@action=redirect&bpo=26386\n\n(97) https://bugs.python.org/issue?@action=redirect&bpo=16182\n\n(98) https://bugs.python.org/issue?@action=redirect&bpo=27392\n\n(99) https://bugs.python.org/issue?@action=redirect&bpo=27930\n\n(100) https://bugs.python.org/issue?@action=redirect&bpo=21201\n\n(101) https://bugs.python.org/issue?@action=redirect&bpo=27456\n\n(102) https://bugs.python.org/issue?@action=redirect&bpo=27906\n\n(103) https://bugs.python.org/issue?@action=redirect&bpo=28174\n\n(104) https://bugs.python.org/issue?@action=redirect&bpo=26654\n\n(105) https://bugs.python.org/issue?@action=redirect&bpo=26909\n\n(106) https://bugs.python.org/issue?@action=redirect&bpo=28176\n\n(107) https://bugs.python.org/issue?@action=redirect&bpo=27759\n\n(108) https://bugs.python.org/issue?@action=redirect&bpo=28368\n\n(109) https://bugs.python.org/issue?@action=redirect&bpo=28369\n\n(110) https://bugs.python.org/issue?@action=redirect&bpo=28370\n\n(111) https://bugs.python.org/issue?@action=redirect&bpo=28371\n\n(112) https://bugs.python.org/issue?@action=redirect&bpo=28372\n\n(113) https://bugs.python.org/issue?@action=redirect&bpo=28399\n\n(114) https://bugs.python.org/issue?@action=redirect&bpo=27972\n\n(115) https://bugs.python.org/issue?@action=redirect&bpo=26923\n\n(116) https://bugs.python.org/issue?@action=redirect&bpo=26796\n\n(117) https://bugs.python.org/issue?@action=redirect&bpo=28600\n\n(118) https://bugs.python.org/issue?@action=redirect&bpo=28613\n\n(119) https://bugs.python.org/issue?@action=redirect&bpo=28639\n\n(120) https://bugs.python.org/issue?@action=redirect&bpo=28652\n\n(121) https://bugs.python.org/issue?@action=redirect&bpo=28653\n\n(122) https://bugs.python.org/issue?@action=redirect&bpo=28703\n\n(123) https://bugs.python.org/issue?@action=redirect&bpo=24142\n\n(124) https://bugs.python.org/issue?@action=redirect&bpo=28990\n\nFile: python3.12.info,  Node: IDLE<50>,  Next: C API<61>,  Prev: Library<77>,  Up: Python 3 5 3 release candidate 1\n\n1.22.87.4 IDLE\n..............\n\n- bpo-15308(1): Add 'interrupt execution' (^C) to Shell menu.  Patch\nby Roger Serwy, updated by Bayard Randel.\n\n- bpo-27922(2): Stop IDLE tests from 'flashing' gui widgets on the\nscreen.\n\n- Add version to title of IDLE help window.\n\n- bpo-25564(3): In section on IDLE - console differences, mention\nthat using exec means that builtins is defined for each\nstatement.\n\n- bpo-27714(4): texttextview and testautocomplete now pass when\nre-run in the same process.  This occurs when testidle fails when\nrun with the -w option but without -jn.  Fix warning from\ntestconfig.\n\n- bpo-25507(5): IDLE no longer runs buggy code because of its tkinter\nimports.  Users must include the same imports required to run\ndirectly in Python.\n\n- bpo-27452(6): add line counter and crc to IDLE configHandler test\ndump.\n\n- bpo-27365(7): Allow non-ascii chars in IDLE NEWS.txt, for\ncontributor names.\n\n- bpo-27245(8): IDLE: Cleanly delete custom themes and key bindings.\nPreviously, when IDLE was started from a console or by import, a\ncascade of warnings was emitted.  Patch by Serhiy Storchaka.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=15308\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=27922\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=25564\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=27714\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=25507\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=27452\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=27365\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=27245\n\nFile: python3.12.info,  Node: C API<61>,  Next: Documentation<69>,  Prev: IDLE<50>,  Up: Python 3 5 3 release candidate 1\n\n1.22.87.5 C API\n...............\n\n- bpo-28808(1): PyUnicodeCompareWithASCIIString() now never raises\nexceptions.\n\n- bpo-26754(2): PyUnicodeFSDecoder() accepted a filename argument\nencoded as an iterable of integers.  Now only strings and\nbytes-like objects are accepted.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28808\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=26754\n\nFile: python3.12.info,  Node: Documentation<69>,  Next: Tests<68>,  Prev: C API<61>,  Up: Python 3 5 3 release candidate 1\n\n1.22.87.6 Documentation\n.......................\n\n- bpo-28513(1): Documented command-line interface of zipfile.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28513\n\nFile: python3.12.info,  Node: Tests<68>,  Next: Tools/Demos<42>,  Prev: Documentation<69>,  Up: Python 3 5 3 release candidate 1\n\n1.22.87.7 Tests\n...............\n\n- bpo-28950(1): Disallow -j0 to be combined with -T/-l/-M in regrtest\ncommand line arguments.\n\n- bpo-28666(2): Now test.support.rmtree is able to remove unwritable\nor unreadable directories.\n\n- bpo-23839(3): Various caches now are cleared before running every\ntest file.\n\n- bpo-28409(4): regrtest: fix the parser of command line arguments.\n\n- bpo-27787(5): Call gc.collect() before checking each test for\n\"dangling threads\", since the dangling threads are weak references.\n\n- bpo-27369(6): In testpyexpat, avoid testing an error message\ndetail that changed in Expat 2.2.0.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28950\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=28666\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=23839\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=28409\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=27787\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=27369\n\nFile: python3.12.info,  Node: Tools/Demos<42>,  Next: Windows<65>,  Prev: Tests<68>,  Up: Python 3 5 3 release candidate 1\n\n1.22.87.8 Tools/Demos\n.....................\n\n- bpo-27952(1): Get Tools/scripts/fixcid.py working with Python 3 and\nthe current \"re\" module, avoid invalid Python backslash escapes,\nand fix a bug parsing escaped C quote signs.\n\n- bpo-27332(2): Fixed the type of the first argument of module-level\nfunctions generated by Argument Clinic.  Patch by Petr Viktorin.\n\n- bpo-27418(3): Fixed Tools/importbench/importbench.py.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27952\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=27332\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=27418\n\nFile: python3.12.info,  Node: Windows<65>,  Next: Build<72>,  Prev: Tools/Demos<42>,  Up: Python 3 5 3 release candidate 1\n\n1.22.87.9 Windows\n.................\n\n- bpo-28251(1): Improvements to help manuals on Windows.\n\n- bpo-28110(2): launcher.msi has different product codes between\n32-bit and 64-bit\n\n- bpo-25144(3): Ensures TargetDir is set before continuing with\ncustom install.\n\n- bpo-27469(4): Adds a shell extension to the launcher so that drag\nand drop works correctly.\n\n- bpo-27309(5): Enabled proper Windows styles in python[w].exe\nmanifest.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28251\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=28110\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=25144\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=27469\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=27309\n\nFile: python3.12.info,  Node: Build<72>,  Prev: Windows<65>,  Up: Python 3 5 3 release candidate 1\n\n1.22.87.10 Build\n................\n\n- bpo-29080(1): Removes hard dependency on hg.exe from\nPCBuild/build.bat\n\n- bpo-23903(2): Added missed names to PC/python3.def.\n\n- bpo-10656(3): Fix out-of-tree building on AIX. Patch by Tristan\nCarel and Michael Haubenwallner.\n\n- bpo-26359(4): Rename -with-optimiations to -enable-optimizations.\n\n- bpo-28444(5): Fix missing extensions modules when cross compiling.\n\n- bpo-28248(6): Update Windows build and OS X installers to use\nOpenSSL 1.0.2j.\n\n- bpo-28258(7): Fixed build with Estonian locale (python-config and\ndistclean targets in Makefile).  Patch by Arfrever Frehtes\nTaifersar Arahesis.\n\n- bpo-26661(8): setup.py now detects system libffi with multiarch\nwrapper.\n\n- bpo-28066(9): Fix the logic that searches build directories for\ngenerated include files when building outside the source tree.\n\n- bpo-15819(10): Remove redundant include search directory option for\nbuilding outside the source tree.\n\n- bpo-27566(11): Fix clean target in freeze makefile (patch by Lisa\nRoach)\n\n- bpo-27705(12): Update message in validateucrtbase.py\n\n- bpo-27983(13): Cause lack of llvm-profdata tool when using clang as\nrequired for PGO linking to be a configure time error rather than\nmake time when -with-optimizations is enabled.  Also improve our\nability to find the llvm-profdata tool on MacOS and some Linuxes.\n\n- bpo-26307(14): The profile-opt build now applies PGO to the\nbuilt-in modules.\n\n- bpo-26359(15): Add the -with-optimizations configure flag.\n\n- bpo-27713(16): Suppress spurious build warnings when updating\nimportlib's bootstrap files.  Patch by Xiang Zhang\n\n- bpo-25825(17): Correct the references to Modules/python.exp and\nldsoaix, which are required on AIX. This updates references to an\ninstallation path that was changed in 3.2a4, and undoes changed\nreferences to the build tree that were made in 3.5.0a1.\n\n- bpo-27453(18): CPP invocation in configure must use CPPFLAGS. Patch\nby Chi Hsuan Yen.\n\n- bpo-27641(19): The configure script now inserts comments into the\nmakefile to prevent the pgen and freezeimportlib executables from\nbeing cross-compiled.\n\n- bpo-26662(20): Set PYTHONFORGEN in configure as the Python\nprogram to be used for file generation during the build.\n\n- bpo-10910(21): Avoid C++ compilation errors on FreeBSD and OS X.\nAlso update FreedBSD version checks for the original ctype UTF-8\nworkaround.\n\n- bpo-28676(22): Prevent missing 'getentropy' declaration warning on\nmacOS. Patch by Gareth Rees.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=29080\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=23903\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=10656\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=26359\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=28444\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=28248\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=28258\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=26661\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=28066\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=15819\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=27566\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=27705\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=27983\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=26307\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=26359\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=27713\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=25825\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=27453\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=27641\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=26662\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=10910\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=28676\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 5 2 final,  Next: Python 3 5 2 release candidate 1,  Prev: Python 3 5 3 release candidate 1,  Up: Changelog": {
            "content": "'Release date: 2016-06-26'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<77>.\n* Tests: Tests<69>.\n* IDLE: IDLE<51>.\n\nFile: python3.12.info,  Node: Core and Builtins<77>,  Next: Tests<69>,  Up: Python 3 5 2 final\n\n1.22.88.1 Core and Builtins\n...........................\n\n- bpo-26930(1): Update Windows builds to use OpenSSL 1.0.2h.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26930\n\nFile: python3.12.info,  Node: Tests<69>,  Next: IDLE<51>,  Prev: Core and Builtins<77>,  Up: Python 3 5 2 final\n\n1.22.88.2 Tests\n...............\n\n- bpo-26867(1): Ubuntu's openssl OPNOSSLv3 is forced on by default;\nfix test.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26867\n\nFile: python3.12.info,  Node: IDLE<51>,  Prev: Tests<69>,  Up: Python 3 5 2 final\n\n1.22.88.3 IDLE\n..............\n\n- bpo-27365(1): Allow non-ascii in idlelib/NEWS.txt - minimal part\nfor 3.5.2.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27365\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 5 2 release candidate 1,  Next: Python 3 5 1 final,  Prev: Python 3 5 2 final,  Up: Changelog": {
            "content": "'Release date: 2016-06-12'\n\n* Menu:\n\n* Security: Security<45>.\n* Core and Builtins: Core and Builtins<78>.\n* Library: Library<78>.\n* IDLE: IDLE<52>.\n* Documentation: Documentation<70>.\n* Tests: Tests<70>.\n* Build: Build<73>.\n* Windows: Windows<66>.\n* Tools/Demos: Tools/Demos<43>.\n\nFile: python3.12.info,  Node: Security<45>,  Next: Core and Builtins<78>,  Up: Python 3 5 2 release candidate 1\n\n1.22.89.1 Security\n..................\n\n- bpo-26556(1): Update expat to 2.1.1, fixes CVE-2015-1283.\n\n- Fix TLS stripping vulnerability in smtplib, CVE-2016-0772.\nReported by Team Oststrom\n\n- bpo-26839(2): On Linux, *note os.urandom(): 276. now calls\n'getrandom()' with 'GRNDNONBLOCK' to fall back on reading\n'/dev/urandom' if the urandom entropy pool is not initialized yet.\nPatch written by Colm Buckley.\n\n- bpo-26657(3): Fix directory traversal vulnerability with\nhttp.server on Windows.  This fixes a regression that was\nintroduced in 3.3.4rc1 and 3.4.0rc1.  Based on patch by Philipp\nHagemeister.\n\n- bpo-26313(4): ssl.py loadwindowsstorecerts fails if windows\ncert store is empty.  Patch by Baji.\n\n- bpo-25939(5): On Windows open the cert store readonly in\nssl.enumcertificates.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26556\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=26839\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=26657\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=26313\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=25939\n\nFile: python3.12.info,  Node: Core and Builtins<78>,  Next: Library<78>,  Prev: Security<45>,  Up: Python 3 5 2 release candidate 1\n\n1.22.89.2 Core and Builtins\n...........................\n\n- bpo-27066(1): Fixed SystemError if a custom opener (for open())\nreturns a negative number without setting an exception.\n\n- bpo-20041(2): Fixed TypeError when frame.ftrace is set to None.\nPatch by Xavier de Gaye.\n\n- bpo-26168(3): Fixed possible refleaks in failing PyBuildValue()\nwith the \"N\" format unit.\n\n- bpo-26991(4): Fix possible refleak when creating a function with\nannotations.\n\n- bpo-27039(5): Fixed bytearray.remove() for values greater than 127.\nPatch by Joe Jevnik.\n\n- bpo-23640(6): int.frombytes() no longer bypasses constructors for\nsubclasses.\n\n- bpo-26811(7): gc.getobjects() no longer contains a broken tuple\nwith NULL pointer.\n\n- bpo-20120(8): Use RawConfigParser for .pypirc parsing, removing\nsupport for interpolation unintentionally added with move to Python\n3.  Behavior no longer does any interpolation in .pypirc files,\nmatching behavior in Python 2.7 and Setuptools 19.0.\n\n- bpo-26659(9): Make the builtin slice type support cycle collection.\n\n- bpo-26718(10): super.init no longer leaks memory if called\nmultiple times.  NOTE: A direct call of super.init is not\nendorsed!\n\n- bpo-25339(11): PYTHONIOENCODING now has priority over locale in\nsetting the error handler for stdin and stdout.\n\n- bpo-26494(12): Fixed crash on iterating exhausting iterators.\nAffected classes are generic sequence iterators, iterators of str,\nbytes, bytearray, list, tuple, set, frozenset, dict, OrderedDict,\ncorresponding views and os.scandir() iterator.\n\n- bpo-26581(13): If coding cookie is specified multiple times on a\nline in Python source code file, only the first one is taken to\naccount.\n\n- bpo-26464(14): Fix str.translate() when string is ASCII and first\nreplacements removes character, but next replacement uses a\nnon-ASCII character or a string longer than 1 character.\nRegression introduced in Python 3.5.0.\n\n- bpo-22836(15): Ensure exception reports from PyErrDisplay() and\nPyErrWriteUnraisable() are sensible even when formatting them\nproduces secondary errors.  This affects the reports produced by\nsys.excepthook() and when del() raises an exception.\n\n- bpo-26302(16): Correct behavior to reject comma as a legal\ncharacter for cookie names.\n\n- bpo-4806(17): Avoid masking the original TypeError exception when\nusing star ('*') unpacking in function calls.  Based on patch by\nHagen Fu\"rstenau and Daniel Urban.\n\n- bpo-27138(18): Fix the doc comment for FileFinder.findspec().\n\n- bpo-26154(19): Add a new private PyThreadStateUncheckedGet()\nfunction to get the current Python thread state, but don't issue a\nfatal error if it is NULL. This new function must be used instead\nof accessing directly the PyThreadStateCurrent variable.  The\nvariable is no more exposed since Python 3.5.1 to hide the exact\nimplementation of atomic C types, to avoid compiler issues.\n\n- bpo-26194(20): Deque.insert() gave odd results for bounded deques\nthat had reached their maximum size.  Now an IndexError will be\nraised when attempting to insert into a full deque.\n\n- bpo-25843(21): When compiling code, don't merge constants if they\nare equal but have a different types.  For example, 'f1, f2 =\nlambda: 1, lambda: 1.0' is now correctly compiled to two different\nfunctions: 'f1()' returns '1' ('int') and 'f2()' returns '1.0'\n('int'), even if '1' and '1.0' are equal.\n\n- bpo-22995(22): [UPDATE] Comment out the one of the pickleability\ntests in PyObjectGetState() due to regressions observed in\nCython-based projects.\n\n- bpo-25961(23): Disallowed null characters in the type name.\n\n- bpo-25973(24): Fix segfault when an invalid nonlocal statement\nbinds a name starting with two underscores.\n\n- bpo-22995(25): Instances of extension types with a state that\naren't subclasses of list or dict and haven't implemented any\npickle-related methods (reduce, reduceex, getnewargs,\ngetnewargsex, or getstate), can no longer be pickled.\nIncluding memoryview.\n\n- bpo-20440(26): Massive replacing unsafe attribute setting code with\nspecial macro PySETREF.\n\n- bpo-25766(27): Special method bytes() now works in str\nsubclasses.\n\n- bpo-25421(28): sizeof methods of builtin types now use dynamic\nbasic size.  This allows sys.getsize() to work correctly with their\nsubclasses with slots defined.\n\n- bpo-25709(29): Fixed problem with in-place string concatenation and\nutf-8 cache.\n\n- bpo-27147(30): Mention PEP 420(31) in the importlib docs.\n\n- bpo-24097(32): Fixed crash in object.reduce() if slot name is\nfreed inside getattr.\n\n- bpo-24731(33): Fixed crash on converting objects with special\nmethods bytes, trunc, and float returning instances of\nsubclasses of bytes, int, and float to subclasses of bytes, int,\nand float correspondingly.\n\n- bpo-26478(34): Fix semantic bugs when using binary operators with\ndictionary views and tuples.\n\n- bpo-26171(35): Fix possible integer overflow and heap corruption in\nzipimporter.getdata().\n\n- bpo-25660(36): Fix TAB key behaviour in REPL with readline.\n\n- bpo-25887(37): Raise a RuntimeError when a coroutine object is\nawaited more than once.\n\n- bpo-27243(38): Update the aiter protocol: instead of returning\nan awaitable that resolves to an asynchronous iterator, the\nasynchronous iterator should be returned directly.  Doing the\nformer will trigger a PendingDeprecationWarning.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27066\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=20041\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=26168\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=26991\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=27039\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=23640\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=26811\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=20120\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=26659\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=26718\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=25339\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=26494\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=26581\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=26464\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=22836\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=26302\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=4806\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=27138\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=26154\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=26194\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=25843\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=22995\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=25961\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=25973\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=22995\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=20440\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=25766\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=25421\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=25709\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=27147\n\n(31) https://peps.python.org/pep-0420/\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=24097\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=24731\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=26478\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=26171\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=25660\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=25887\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=27243\n\nFile: python3.12.info,  Node: Library<78>,  Next: IDLE<52>,  Prev: Core and Builtins<78>,  Up: Python 3 5 2 release candidate 1\n\n1.22.89.3 Library\n.................\n\n- bpo-21386(1): Implement missing IPv4Address.isglobal property.  It\nwas documented since 07a5610bae9d.  Initial patch by Roger Luethi.\n\n- bpo-20900(2): distutils register command now decodes HTTP responses\ncorrectly.  Initial patch by ingrid.\n\n- A new version of typing.py provides several new classes and\nfeatures: @overload outside stubs, Reversible, DefaultDict, Text,\nContextManager, Type[], NewType(), TYPECHECKING, and numerous bug\nfixes (note that some of the new features are not yet implemented\nin mypy or other static analyzers).  Also classes for PEP 492(3)\n(Awaitable, AsyncIterable, AsyncIterator) have been added (in fact\nthey made it into 3.5.1 but were never mentioned).\n\n- bpo-25738(4): Stop http.server.BaseHTTPRequestHandler.senderror()\nfrom sending a message body for 205 Reset Content.  Also, don't\nsend Content header fields in responses that don't have a body.\nPatch by Susumu Koshiba.\n\n- bpo-21313(5): Fix the \"platform\" module to tolerate when\nsys.version contains truncated build information.\n\n- bpo-27164(6): In the zlib module, allow decompressing raw Deflate\nstreams with a predefined zdict.  Based on patch by Xiang Zhang.\n\n- bpo-24291(7): Fix wsgiref.simpleserver.WSGIRequestHandler to\ncompletely write data to the client.  Previously it could do\npartial writes and truncate data.  Also,\nwsgiref.handler.ServerHandler can now handle stdout doing partial\nwrites, but this is deprecated.\n\n- bpo-26809(8): Add 'all' to *note string: cd.  Patch by Emanuel\nBarry.\n\n- bpo-26373(9): subprocess.Popen.communicate now correctly ignores\nBrokenPipeError when the child process dies before .communicate()\nis called in more/all circumstances.\n\n- bpo-21776(10): distutils.upload now correctly handles HTTPError.\nInitial patch by Claudiu Popa.\n\n- bpo-27114(11): Fix SSLContext.loadwindowsstorecerts fails with\nPermissionError\n\n- bpo-18383(12): Avoid creating duplicate filters when using\nfilterwarnings and simplefilter.  Based on patch by Alex Shkop.\n\n- bpo-27057(13): Fix os.setinheritable() on Android, ioctl() is\nblocked by SELinux and fails with EACCESS. The function now falls\nback to fcntl().  Patch written by Micha?? Bednarski.\n\n- bpo-27014(14): Fix infinite recursion using typing.py.  Thanks to\nKalle Tuure!\n\n- bpo-14132(15): Fix urllib.request redirect handling when the target\nonly has a query string.  Original fix by J??n Janech.\n\n- bpo-17214(16): The \"urllib.request\" module now percent-encodes\nnon-ASCII bytes found in redirect target URLs.  Some servers send\nLocation header fields with non-ASCII bytes, but \"http.client\"\nrequires the request target to be ASCII-encodable, otherwise a\nUnicodeEncodeError is raised.  Based on patch by Christian Heimes.\n\n- bpo-26892(17): Honor debuglevel flag in urllib.request.HTTPHandler.\nPatch contributed by Chi Hsuan Yen.\n\n- bpo-22274(18): In the subprocess module, allow stderr to be\nredirected to stdout even when stdout is not redirected.  Patch by\nAkira Li.\n\n- bpo-26807(19): mockopen 'files' no longer error on readline at end\nof file.  Patch from Yolanda Robla.\n\n- bpo-25745(20): Fixed leaking a userptr in curses panel destructor.\n\n- bpo-26977(21): Removed unnecessary, and ignored, call to sum of\nsquares helper in statistics.pvariance.\n\n- bpo-26881(22): The modulefinder module now supports extended opcode\narguments.\n\n- bpo-23815(23): Fixed crashes related to directly created instances\nof types in tkinter and curses.panel modules.\n\n- bpo-17765(24): weakref.ref() no longer silently ignores keyword\narguments.  Patch by Georg Brandl.\n\n- bpo-26873(25): xmlrpc now raises ResponseError on unsupported type\ntags instead of silently return incorrect result.\n\n- bpo-26711(26): Fixed the comparison of plistlib.Data with other\ntypes.\n\n- bpo-24114(27): Fix an uninitialized variable in 'ctypes.util'.  The\nbug only occurs on SunOS when the ctypes implementation searches\nfor the 'crle' program.  Patch by Xiang Zhang.  Tested on SunOS by\nKees Bos.\n\n- bpo-26864(28): In urllib.request, change the proxy bypass host\nchecking against noproxy to be case-insensitive, and to not match\nunrelated host names that happen to have a bypassed hostname as a\nsuffix.  Patch by Xiang Zhang.\n\n- bpo-26634(29): recursiverepr() now sets qualname of wrapper.\nPatch by Xiang Zhang.\n\n- bpo-26804(30): urllib.request will prefer lowercase proxy\nenvironment variables over UPPERCASE or MixedCase ones.  Patch\ncontributed by Hans-Peter Jansen.\n\n- bpo-26837(31): assertSequenceEqual() now correctly outputs\nnon-stringified differing items (like bytes in the -b mode).  This\naffects assertListEqual() and assertTupleEqual().\n\n- bpo-26041(32): Remove \"will be removed in Python 3.7\" from\ndeprecation messages of platform.dist() and\nplatform.linuxdistribution().  Patch by Kumaripaba Miyurusara\nAthukorala.\n\n- bpo-26822(33): itemgetter, attrgetter and methodcaller objects no\nlonger silently ignore keyword arguments.\n\n- bpo-26733(34): Disassembling a class now disassembles class and\nstatic methods.  Patch by Xiang Zhang.\n\n- bpo-26801(35): Fix error handling in *note\nshutil.getterminalsize(): f73, catch *note AttributeError: 395.\ninstead of *note NameError: 144.  Patch written by Emanuel Barry.\n\n- bpo-24838(36): tarfile's ustar and gnu formats now correctly\ncalculate name and link field limits for multibyte character\nencodings like utf-8.\n\n- bpo-26717(37): Stop encoding Latin-1-ized WSGI paths with UTF-8.\nPatch by Anthony Sottile.\n\n- bpo-26735(38): Fix *note os.urandom(): 276. on Solaris 11.3 and\nnewer when reading more than 1,024 bytes: call 'getrandom()'\nmultiple times with a limit of 1024 bytes per call.\n\n- bpo-16329(39): Add .webm to mimetypes.typesmap.  Patch by\nGiampaolo Rodola'.\n\n- bpo-13952(40): Add .csv to mimetypes.typesmap.  Patch by Geoff\nWilson.\n\n- bpo-26709(41): Fixed Y2038 problem in loading binary PLists.\n\n- bpo-23735(42): Handle terminal resizing with Readline 6.3+ by\ninstalling our own SIGWINCH handler.  Patch by Eric Price.\n\n- bpo-26586(43): In http.server, respond with \"413 Request header\nfields too large\" if there are too many header fields to parse,\nrather than killing the connection and raising an unhandled\nexception.  Patch by Xiang Zhang.\n\n- bpo-22854(44): Change BufferedReader.writable() and\nBufferedWriter.readable() to always return False.\n\n- bpo-25195(45): Fix a regression in mock.MagicMock.  Call is a\nsubclass of tuple (changeset 3603bae63c13 only works for classes)\nso we need to implement ne ourselves.  Patch by Andrew Plummer.\n\n- bpo-26644(46): Raise ValueError rather than SystemError when a\nnegative length is passed to SSLSocket.recv() or read().\n\n- bpo-23804(47): Fix SSL recv(0) and read(0) methods to return zero\nbytes instead of up to 1024.\n\n- bpo-26616(48): Fixed a bug in datetime.astimezone() method.\n\n- bpo-21925(49): *note warnings.formatwarning(): 178d. now catches\nexceptions on 'linecache.getline(...)' to be able to log *note\nResourceWarning: a86. emitted late during the Python shutdown\nprocess.\n\n- bpo-24266(50): Ctrl+C during Readline history search now cancels\nthe search mode when compiled with Readline 7.\n\n- bpo-26560(51): Avoid potential ValueError in\nBaseHandler.startresponse.  Initial patch by Peter Inglesby.\n\n- bpo-26569(52): Fix *note pyclbr.readmodule(): 620. and *note\npyclbr.readmoduleex(): 621. to support importing packages.\n\n- bpo-26499(53): Account for remaining Content-Length in\nHTTPResponse.readline() and read1().  Based on patch by Silent\nGhost.  Also document that HTTPResponse now supports these methods.\n\n- bpo-25320(54): Handle sockets in directories unittest discovery is\nscanning.  Patch from Victor van den Elzen.\n\n- bpo-16181(55): cookiejar.http2time() now returns None if year is\nhigher than datetime.MAXYEAR.\n\n- bpo-26513(56): Fixes platform module detection of Windows Server\n\n- bpo-23718(57): Fixed parsing time in week 0 before Jan 1.  Original\npatch by Tam??s Bence Gedai.\n\n- bpo-20589(58): Invoking Path.owner() and Path.group() on Windows\nnow raise NotImplementedError instead of ImportError.\n\n- bpo-26177(59): Fixed the keys() method for Canvas and Scrollbar\nwidgets.\n\n- bpo-15068(60): Got rid of excessive buffering in the fileinput\nmodule.  The bufsize parameter is no longer used.\n\n- bpo-2202(61): Fix UnboundLocalError in\nAbstractDigestAuthHandler.getalgorithmimpls.  Initial patch by\nMathieu Dupuy.\n\n- bpo-25718(62): Fixed pickling and copying the accumulate() iterator\nwith total is None.\n\n- bpo-26475(63): Fixed debugging output for regular expressions with\nthe (?x) flag.\n\n- bpo-26457(64): Fixed the subnets() methods in IP network classes\nfor the case when resulting prefix length is equal to maximal\nprefix length.  Based on patch by Xiang Zhang.\n\n- bpo-26385(65): Remove the file if the internal open() call in\nNamedTemporaryFile() fails.  Patch by Silent Ghost.\n\n- bpo-26402(66): Fix XML-RPC client to retry when the server shuts\ndown a persistent connection.  This was a regression related to the\nnew http.client.RemoteDisconnected exception in 3.5.0a4.\n\n- bpo-25913(67): Leading '<~' is optional now in base64.a85decode()\nwith adobe=True.  Patch by Swati Jaiswal.\n\n- bpo-26186(68): Remove an invalid type check in\nimportlib.util.LazyLoader.\n\n- bpo-26367(69): importlib.import() raises SystemError like\nbuiltins.import() when 'level' is specified but without an\naccompanying package specified.\n\n- bpo-26309(70): In the \"socketserver\" module, shut down the request\n(closing the connected socket) when verifyrequest() returns false.\nPatch by Aviv Palivoda.\n\n- bpo-25995(71): os.walk() no longer uses FDs proportional to the\ntree depth.\n\n- bpo-26117(72): The os.scandir() iterator now closes file descriptor\nnot only when the iteration is finished, but when it was failed\nwith error.\n\n- bpo-25911(73): Restored support of bytes paths in os.walk() on\nWindows.\n\n- bpo-26045(74): Add UTF-8 suggestion to error message when posting a\nnon-Latin-1 string with http.client.\n\n- bpo-12923(75): Reset FancyURLopener's redirect counter even if\nthere is an exception.  Based on patches by Brian Brazil and Daniel\nRocco.\n\n- bpo-25945(76): Fixed a crash when unpickle the functools.partial\nobject with wrong state.  Fixed a leak in failed functools.partial\nconstructor.  \"args\" and \"keywords\" attributes of functools.partial\nhave now always types tuple and dict correspondingly.\n\n- bpo-26202(77): copy.deepcopy() now correctly copies range() objects\nwith non-atomic attributes.\n\n- bpo-23076(78): Path.glob() now raises a ValueError if it's called\nwith an invalid pattern.  Patch by Thomas Nyberg.\n\n- bpo-19883(79): Fixed possible integer overflows in zipimport.\n\n- bpo-26227(80): On Windows, getnameinfo(), gethostbyaddr() and\ngethostbynameex() functions of the socket module now decode the\nhostname from the ANSI code page rather than UTF-8.\n\n- bpo-26147(81): xmlrpc now works with strings not encodable with\nused non-UTF-8 encoding.\n\n- bpo-25935(82): Garbage collector now breaks reference loops with\nOrderedDict.\n\n- bpo-16620(83): Fixed AttributeError in msilib.Directory.glob().\n\n- bpo-26013(84): Added compatibility with broken protocol 2 pickles\ncreated in old Python 3 versions (3.4.3 and lower).\n\n- bpo-25850(85): Use cross-compilation by default for 64-bit Windows.\n\n- bpo-17633(86): Improve zipimport's support for namespace packages.\n\n- bpo-24705(87): Fix sysconfig.parsemakefile not expanding ${} vars\nappearing before $() vars.\n\n- bpo-22138(88): Fix mock.patch behavior when patching descriptors.\nRestore original values after patching.  Patch contributed by Sean\nMcCully.\n\n- bpo-25672(89): In the ssl module, enable the\nSSLMODERELEASEBUFFERS mode option if it is safe to do so.\n\n- bpo-26012(90): Don't traverse into symlinks for '' pattern in\npathlib.Path.[r]glob().\n\n- bpo-24120(91): Ignore PermissionError when traversing a tree with\npathlib.Path.[r]glob().  Patch by Ulrich Petri.\n\n- bpo-25447(92): fileinput now uses sys.stdin as-is if it does not\nhave a buffer attribute (restores backward compatibility).\n\n- bpo-25447(93): Copying the lrucache() wrapper object now always\nworks, independently from the type of the wrapped object (by\nreturning the original object unchanged).\n\n- bpo-24103(94): Fixed possible use after free in\nElementTree.XMLPullParser.\n\n- bpo-25860(95): os.fwalk() no longer skips remaining directories\nwhen error occurs.  Original patch by Samson Lee.\n\n- bpo-25914(96): Fixed and simplified OrderedDict.sizeof.\n\n- bpo-25902(97): Fixed various refcount issues in ElementTree\niteration.\n\n- bpo-25717(98): Restore the previous behaviour of tolerating most\nfstat() errors when opening files.  This was a regression in 3.5a1,\nand stopped anonymous temporary files from working in special\ncases.\n\n- bpo-24903(99): Fix regression in number of arguments compileall\naccepts when '-d' is specified.  The check on the number of\narguments has been dropped completely as it never worked correctly\nanyway.\n\n- bpo-25764(100): In the subprocess module, preserve any exception\ncaused by fork() failure when preexecfn is used.\n\n- bpo-6478(101): strptime's regexp cache now is reset after changing\ntimezone with time.tzset().\n\n- bpo-14285(102): When executing a package with the \"python -m\npackage\" option, and package initialization fails, a proper\ntraceback is now reported.  The \"runpy\" module now lets exceptions\nfrom package initialization pass back to the caller, rather than\nraising ImportError.\n\n- bpo-19771(103): Also in runpy and the \"-m\" option, omit the\nirrelevant message \"... is a package and cannot be directly executed\"\nif the package could not even be initialized (e.g.  due to a bad\n'*.pyc' file).\n\n- bpo-25177(104): Fixed problem with the mean of very small and very\nlarge numbers.  As a side effect, statistics.mean and\nstatistics.variance should be significantly faster.\n\n- bpo-25718(105): Fixed copying object with state with boolean value\nis false.\n\n- bpo-10131(106): Fixed deep copying of minidom documents.  Based on\npatch by Marian Ganisin.\n\n- bpo-25725(107): Fixed a reference leak in pickle.loads() when\nunpickling invalid data including tuple instructions.\n\n- bpo-25663(108): In the Readline completer, avoid listing duplicate\nglobal names, and search the global namespace before searching\nbuiltins.\n\n- bpo-25688(109): Fixed file leak in ElementTree.iterparse() raising\nan error.\n\n- bpo-23914(110): Fixed SystemError raised by unpickler on broken\npickle data.\n\n- bpo-25691(111): Fixed crash on deleting ElementTree.Element\nattributes.\n\n- bpo-25624(112): ZipFile now always writes a ZIPSTORED header for\ndirectory entries.  Patch by Dingyuan Wang.\n\n- Skip getaddrinfo if host is already resolved.  Patch by A. Jesse\nJiryu Davis.\n\n- bpo-26050(113): Add asyncio.StreamReader.readuntil() method.  Patch\nby ???????? ??????????????????.\n\n- bpo-25924(114): Avoid unnecessary serialization of getaddrinfo(3)\ncalls on OS X versions 10.5 or higher.  Original patch by A. Jesse\nJiryu Davis.\n\n- bpo-26406(115): Avoid unnecessary serialization of getaddrinfo(3)\ncalls on current versions of OpenBSD and NetBSD. Patch by A. Jesse\nJiryu Davis.\n\n- bpo-26848(116): Fix asyncio/subprocess.communicate() to handle\nempty input.  Patch by Jack O'Connor.\n\n- bpo-27040(117): Add loop.getexceptionhandler method\n\n- bpo-27041(118): asyncio: Add loop.createfuture method\n\n- bpo-27223(119): asyncio: Fix readready and writeready to\nrespect connlost.  Patch by ??ukasz Langa.\n\n- bpo-22970(120): asyncio: Fix inconsistency cancelling\nCondition.wait.  Patch by David Coles.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=21386\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=20900\n\n(3) https://peps.python.org/pep-0492/\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=25738\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=21313\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=27164\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=24291\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=26809\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=26373\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=21776\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=27114\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=18383\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=27057\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=27014\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=14132\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=17214\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=26892\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=22274\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=26807\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=25745\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=26977\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=26881\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=23815\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=17765\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=26873\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=26711\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=24114\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=26864\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=26634\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=26804\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=26837\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=26041\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=26822\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=26733\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=26801\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=24838\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=26717\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=26735\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=16329\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=13952\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=26709\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=23735\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=26586\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=22854\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=25195\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=26644\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=23804\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=26616\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=21925\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=24266\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=26560\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=26569\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=26499\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=25320\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=16181\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=26513\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=23718\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=20589\n\n(59) https://bugs.python.org/issue?@action=redirect&bpo=26177\n\n(60) https://bugs.python.org/issue?@action=redirect&bpo=15068\n\n(61) https://bugs.python.org/issue?@action=redirect&bpo=2202\n\n(62) https://bugs.python.org/issue?@action=redirect&bpo=25718\n\n(63) https://bugs.python.org/issue?@action=redirect&bpo=26475\n\n(64) https://bugs.python.org/issue?@action=redirect&bpo=26457\n\n(65) https://bugs.python.org/issue?@action=redirect&bpo=26385\n\n(66) https://bugs.python.org/issue?@action=redirect&bpo=26402\n\n(67) https://bugs.python.org/issue?@action=redirect&bpo=25913\n\n(68) https://bugs.python.org/issue?@action=redirect&bpo=26186\n\n(69) https://bugs.python.org/issue?@action=redirect&bpo=26367\n\n(70) https://bugs.python.org/issue?@action=redirect&bpo=26309\n\n(71) https://bugs.python.org/issue?@action=redirect&bpo=25995\n\n(72) https://bugs.python.org/issue?@action=redirect&bpo=26117\n\n(73) https://bugs.python.org/issue?@action=redirect&bpo=25911\n\n(74) https://bugs.python.org/issue?@action=redirect&bpo=26045\n\n(75) https://bugs.python.org/issue?@action=redirect&bpo=12923\n\n(76) https://bugs.python.org/issue?@action=redirect&bpo=25945\n\n(77) https://bugs.python.org/issue?@action=redirect&bpo=26202\n\n(78) https://bugs.python.org/issue?@action=redirect&bpo=23076\n\n(79) https://bugs.python.org/issue?@action=redirect&bpo=19883\n\n(80) https://bugs.python.org/issue?@action=redirect&bpo=26227\n\n(81) https://bugs.python.org/issue?@action=redirect&bpo=26147\n\n(82) https://bugs.python.org/issue?@action=redirect&bpo=25935\n\n(83) https://bugs.python.org/issue?@action=redirect&bpo=16620\n\n(84) https://bugs.python.org/issue?@action=redirect&bpo=26013\n\n(85) https://bugs.python.org/issue?@action=redirect&bpo=25850\n\n(86) https://bugs.python.org/issue?@action=redirect&bpo=17633\n\n(87) https://bugs.python.org/issue?@action=redirect&bpo=24705\n\n(88) https://bugs.python.org/issue?@action=redirect&bpo=22138\n\n(89) https://bugs.python.org/issue?@action=redirect&bpo=25672\n\n(90) https://bugs.python.org/issue?@action=redirect&bpo=26012\n\n(91) https://bugs.python.org/issue?@action=redirect&bpo=24120\n\n(92) https://bugs.python.org/issue?@action=redirect&bpo=25447\n\n(93) https://bugs.python.org/issue?@action=redirect&bpo=25447\n\n(94) https://bugs.python.org/issue?@action=redirect&bpo=24103\n\n(95) https://bugs.python.org/issue?@action=redirect&bpo=25860\n\n(96) https://bugs.python.org/issue?@action=redirect&bpo=25914\n\n(97) https://bugs.python.org/issue?@action=redirect&bpo=25902\n\n(98) https://bugs.python.org/issue?@action=redirect&bpo=25717\n\n(99) https://bugs.python.org/issue?@action=redirect&bpo=24903\n\n(100) https://bugs.python.org/issue?@action=redirect&bpo=25764\n\n(101) https://bugs.python.org/issue?@action=redirect&bpo=6478\n\n(102) https://bugs.python.org/issue?@action=redirect&bpo=14285\n\n(103) https://bugs.python.org/issue?@action=redirect&bpo=19771\n\n(104) https://bugs.python.org/issue?@action=redirect&bpo=25177\n\n(105) https://bugs.python.org/issue?@action=redirect&bpo=25718\n\n(106) https://bugs.python.org/issue?@action=redirect&bpo=10131\n\n(107) https://bugs.python.org/issue?@action=redirect&bpo=25725\n\n(108) https://bugs.python.org/issue?@action=redirect&bpo=25663\n\n(109) https://bugs.python.org/issue?@action=redirect&bpo=25688\n\n(110) https://bugs.python.org/issue?@action=redirect&bpo=23914\n\n(111) https://bugs.python.org/issue?@action=redirect&bpo=25691\n\n(112) https://bugs.python.org/issue?@action=redirect&bpo=25624\n\n(113) https://bugs.python.org/issue?@action=redirect&bpo=26050\n\n(114) https://bugs.python.org/issue?@action=redirect&bpo=25924\n\n(115) https://bugs.python.org/issue?@action=redirect&bpo=26406\n\n(116) https://bugs.python.org/issue?@action=redirect&bpo=26848\n\n(117) https://bugs.python.org/issue?@action=redirect&bpo=27040\n\n(118) https://bugs.python.org/issue?@action=redirect&bpo=27041\n\n(119) https://bugs.python.org/issue?@action=redirect&bpo=27223\n\n(120) https://bugs.python.org/issue?@action=redirect&bpo=22970\n\nFile: python3.12.info,  Node: IDLE<52>,  Next: Documentation<70>,  Prev: Library<78>,  Up: Python 3 5 2 release candidate 1\n\n1.22.89.4 IDLE\n..............\n\n- bpo-5124(1): Paste with text selected now replaces the selection on\nX11.  This matches how paste works on Windows, Mac, most modern\nLinux apps, and ttk widgets.  Original patch by Serhiy Storchaka.\n\n- bpo-24759(2): Make clear in idlelib.idletest.init that the\ndirectory is a private implementation of test.testidle and tool\nfor maintainers.\n\n- bpo-27196(3): Stop 'ThemeChanged' warnings when running IDLE tests.\nThese persisted after other warnings were suppressed in #20567.\nApply Serhiy Storchaka's updateidletasks solution to four test\nfiles.  Record this additional advice in idletest/README.txt\n\n- bpo-20567(4): Revise idletest/README.txt with advice about\navoiding tk warning messages from tests.  Apply advice to several\nIDLE tests.\n\n- bpo-27117(5): Make colorizer htest and turtledemo work with dark\nthemes.  Move code for configuring text widget colors to a new\nfunction.\n\n- bpo-26673(6): When tk reports font size as 0, change to size 10.\nSuch fonts on Linux prevented the configuration dialog from\nopening.\n\n- bpo-21939(7): Add test for IDLE's percolator.  Original patch by\nSaimadhav Heblikar.\n\n- bpo-21676(8): Add test for IDLE's replace dialog.  Original patch\nby Saimadhav Heblikar.\n\n- bpo-18410(9): Add test for IDLE's search dialog.  Original patch by\nWestley Mart??nez.\n\n- bpo-21703(10): Add test for IDLE's undo delegator.  Original patch\nby Saimadhav Heblikar .\n\n- bpo-27044(11): Add ConfigDialog.removevarcallbacks to stop memory\nleaks.\n\n- bpo-23977(12): Add more asserts to testdelegator.\n\n- bpo-20640(13): Add tests for idlelib.configHelpSourceEdit.  Patch\nby Saimadhav Heblikar.\n\n- In the 'IDLE-console differences' section of the IDLE doc, clarify\nhow running with IDLE affects sys.modules and the standard streams.\n\n- bpo-25507(14): fix incorrect change in IOBinding that prevented\nprinting.  Augment IOBinding htest to include all major IOBinding\nfunctions.\n\n- bpo-25905(15): Revert unwanted conversion of ' to ' RIGHT SINGLE\nQUOTATION MARK in README.txt and open this and NEWS.txt with\n'ascii'.  Re-encode CREDITS.txt to utf-8 and open it with 'utf-8'.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=5124\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=24759\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=27196\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=20567\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=27117\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=26673\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=21939\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=21676\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=18410\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=21703\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=27044\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=23977\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=20640\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=25507\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=25905\n\nFile: python3.12.info,  Node: Documentation<70>,  Next: Tests<70>,  Prev: IDLE<52>,  Up: Python 3 5 2 release candidate 1\n\n1.22.89.5 Documentation\n.......................\n\n- bpo-19489(1): Moved the search box from the sidebar to the header\nand footer of each page.  Patch by Ammar Askar.\n\n- bpo-24136(2): Document the new PEP 448(3) unpacking syntax of 3.5.\n\n- bpo-26736(4): Used HTTPS for external links in the documentation if\npossible.\n\n- bpo-6953(5): Rework the Readline module documentation to group\nrelated functions together, and add more details such as what\nunderlying Readline functions and variables are accessed.\n\n- bpo-23606(6): Adds note to ctypes documentation regarding\ncdll.msvcrt.\n\n- bpo-25500(7): Fix documentation to not claim that import is\nsearched for in the global scope.\n\n- bpo-26014(8): Update 3.x packaging documentation: * \"See also\"\nlinks to the new docs are now provided in the legacy pages * links\nto setuptools documentation have been updated\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=19489\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=24136\n\n(3) https://peps.python.org/pep-0448/\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=26736\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=6953\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=23606\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=25500\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=26014\n\nFile: python3.12.info,  Node: Tests<70>,  Next: Build<73>,  Prev: Documentation<70>,  Up: Python 3 5 2 release candidate 1\n\n1.22.89.6 Tests\n...............\n\n- bpo-21916(1): Added tests for the turtle module.  Patch by ingrid,\nGregory Loyse and Jelle Zijlstra.\n\n- bpo-26523(2): The multiprocessing thread pool\n(multiprocessing.dummy.Pool) was untested.\n\n- bpo-26015(3): Added new tests for pickling iterators of mutable\nsequences.\n\n- bpo-26325(4): Added test.support.checknoresourcewarning() to\ncheck that no ResourceWarning is emitted.\n\n- bpo-25940(5): Changed testssl to use self-signed.pythontest.net.\nThis avoids relying on svn.python.org, which recently changed root\ncertificate.\n\n- bpo-25616(6): Tests for OrderedDict are extracted from\ntestcollections into separate file testordereddict.\n\n- bpo-26583(7): Skip testtimestampoverflow in testimport if\nbytecode files cannot be written.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=21916\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=26523\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=26015\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=26325\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=25940\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=25616\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=26583\n\nFile: python3.12.info,  Node: Build<73>,  Next: Windows<66>,  Prev: Tests<70>,  Up: Python 3 5 2 release candidate 1\n\n1.22.89.7 Build\n...............\n\n- bpo-26884(1): Fix linking extension modules for cross builds.\nPatch by Xavier de Gaye.\n\n- bpo-22359(2): Disable the rules for running freezeimportlib and\npgen when cross-compiling.  The output of these programs is\nnormally saved with the source code anyway, and is still\nregenerated when doing a native build.  Patch by Xavier de Gaye.\n\n- bpo-27229(3): Fix the cross-compiling pgen rule for in-tree builds.\nPatch by Xavier de Gaye.\n\n- bpo-21668(4): Link audioop, datetime, ctypestest modules to\nlibm, except on Mac OS X. Patch written by Xavier de Gaye.\n\n- bpo-25702(5): A -with-lto configure option has been added that will\nenable link time optimizations at build time during a make\nprofile-opt.  Some compilers and toolchains are known to not\nproduce stable code when using LTO, be sure to test things\nthoroughly before relying on it.  It can provide a few % speed up\nover profile-opt alone.\n\n- bpo-26624(6): Adds validation of ucrtbase[d].dll version with\nwarning for old versions.\n\n- bpo-17603(7): Avoid error about nonexistent fileblocks.o file by\nusing a lower-level check for stblocks in struct stat.\n\n- bpo-26079(8): Fixing the build output folder for tix-8.4.3.6.\nPatch by Bjoern Thiel.\n\n- bpo-26465(9): Update Windows builds to use OpenSSL 1.0.2g.\n\n- bpo-24421(10): Compile Modules/math.c once, before building\nextensions.  Previously it could fail to compile properly if the\nmath and cmath builds were concurrent.\n\n- bpo-25348(11): Added '--pgo' and '--pgo-job' arguments to\n'PCbuild\\build.bat' for building with Profile-Guided Optimization.\nThe old 'PCbuild\\buildpgo.bat' script is now deprecated, and\nsimply calls 'PCbuild\\build.bat --pgo %*'.\n\n- bpo-25827(12): Add support for building with ICC to 'configure',\nincluding a new '--with-icc' flag.\n\n- bpo-25696(13): Fix installation of Python on UNIX with make -j9.\n\n- bpo-26930(14): Update OS X 10.5+ 32-bit-only installer to build and\nlink with OpenSSL 1.0.2h.\n\n- bpo-26268(15): Update Windows builds to use OpenSSL 1.0.2f.\n\n- bpo-25136(16): Support Apple Xcode 7's new textual SDK stub\nlibraries.\n\n- bpo-24324(17): Do not enable unreachable code warnings when using\ngcc as the option does not work correctly in older versions of gcc\nand has been silently removed as of gcc-4.5.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26884\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=22359\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=27229\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=21668\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=25702\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=26624\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=17603\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=26079\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=26465\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=24421\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=25348\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=25827\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=25696\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=26930\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=26268\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=25136\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=24324\n\nFile: python3.12.info,  Node: Windows<66>,  Next: Tools/Demos<43>,  Prev: Build<73>,  Up: Python 3 5 2 release candidate 1\n\n1.22.89.8 Windows\n.................\n\n- bpo-27053(1): Updates makezip.py to correctly generate library ZIP\nfile.\n\n- bpo-26268(2): Update the preparessl.py script to handle OpenSSL\nreleases that don't include the contents of the include directory\n(that is, 1.0.2e and later).\n\n- bpo-26071(3): bdistwininst created binaries fail to start and find\n32bit Python\n\n- bpo-26073(4): Update the list of magic numbers in launcher\n\n- bpo-26065(5): Excludes venv from library when generating embeddable\ndistro.\n\n- bpo-17500(6): Remove unused and outdated icons.  (See also:\n'https://github.com/python/pythondotorg/issues/945')\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=27053\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=26268\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=26071\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=26073\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=26065\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=17500\n\nFile: python3.12.info,  Node: Tools/Demos<43>,  Prev: Windows<66>,  Up: Python 3 5 2 release candidate 1\n\n1.22.89.9 Tools/Demos\n.....................\n\n- bpo-26799(1): Fix python-gdb.py: don't get C types once when the\nPython code is loaded, but get C types on demand.  The C types can\nchange if python-gdb.py is loaded before the Python executable.\nPatch written by Thomas Ilsche.\n\n- bpo-26271(2): Fix the Freeze tool to properly use flags passed\nthrough configure.  Patch by Daniel Shaulov.\n\n- bpo-26489(3): Add dictionary unpacking support to\nTools/parser/unparse.py.  Patch by Guo Ci Teo.\n\n- bpo-26316(4): Fix variable name typo in Argument Clinic.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=26799\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=26271\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=26489\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=26316\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 5 1 final,  Next: Python 3 5 1 release candidate 1,  Prev: Python 3 5 2 release candidate 1,  Up: Changelog": {
            "content": "'Release date: 2015-12-06'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<79>.\n* Windows: Windows<67>.\n\nFile: python3.12.info,  Node: Core and Builtins<79>,  Next: Windows<67>,  Up: Python 3 5 1 final\n\n1.22.90.1 Core and Builtins\n...........................\n\n- bpo-25709(1): Fixed problem with in-place string concatenation and\nutf-8 cache.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25709\n\nFile: python3.12.info,  Node: Windows<67>,  Prev: Core and Builtins<79>,  Up: Python 3 5 1 final\n\n1.22.90.2 Windows\n.................\n\n- bpo-25715(1): Python 3.5.1 installer shows wrong upgrade path and\nincorrect logic for launcher detection.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25715\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 5 1 release candidate 1,  Next: Python 3 5 0 final,  Prev: Python 3 5 1 final,  Up: Changelog": {
            "content": "'Release date: 2015-11-22'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<80>.\n* Library: Library<79>.\n* IDLE: IDLE<53>.\n* Documentation: Documentation<71>.\n* Tests: Tests<71>.\n* Build: Build<74>.\n* Windows: Windows<68>.\n* Tools/Demos: Tools/Demos<44>.\n\nFile: python3.12.info,  Node: Core and Builtins<80>,  Next: Library<79>,  Up: Python 3 5 1 release candidate 1\n\n1.22.91.1 Core and Builtins\n...........................\n\n- bpo-25630(1): Fix a possible segfault during argument parsing in\nfunctions that accept filesystem paths.\n\n- bpo-23564(2): Fixed a partially broken sanity check in the\nposixsubprocess internals regarding how fdstopass were passed to\nthe child.  The bug had no actual impact as subprocess.py already\navoided it.\n\n- bpo-25388(3): Fixed tokenizer crash when processing undecodable\nsource code with a null byte.\n\n- bpo-25462(4): The hash of the key now is calculated only once in\nmost operations in C implementation of OrderedDict.\n\n- bpo-22995(5): Default implementation of reduce and\nreduceex now rejects builtin types with not defined new.\n\n- bpo-25555(6): Fix parser and AST: fill lineno and coloffset of\n\"arg\" node when compiling AST from Python objects.\n\n- bpo-24802(7): Avoid buffer overreads when int(), float(),\ncompile(), exec() and eval() are passed bytes-like objects.  These\nobjects are not necessarily terminated by a null byte, but the\nfunctions assumed they were.\n\n- bpo-24726(8): Fixed a crash and leaking NULL in repr() of\nOrderedDict that was mutated by direct calls of dict methods.\n\n- bpo-25449(9): Iterating OrderedDict with keys with unstable hash\nnow raises KeyError in C implementations as well as in Python\nimplementation.\n\n- bpo-25395(10): Fixed crash when highly nested OrderedDict\nstructures were garbage collected.\n\n- bpo-25274(11): sys.setrecursionlimit() now raises a RecursionError\nif the new recursion limit is too low depending at the current\nrecursion depth.  Modify also the \"lower-water mark\" formula to\nmake it monotonic.  This mark is used to decide when the overflowed\nflag of the thread state is reset.\n\n- bpo-24402(12): Fix input() to prompt to the redirected stdout when\nsys.stdout.fileno() fails.\n\n- bpo-24806(13): Prevent builtin types that are not allowed to be\nsubclassed from being subclassed through multiple inheritance.\n\n- bpo-24848(14): Fixed a number of bugs in UTF-7 decoding of\nmisformed data.\n\n- bpo-25280(15): Import trace messages emitted in verbose (-v) mode\nare no longer formatted twice.\n\n- bpo-25003(16): On Solaris 11.3 or newer, os.urandom() now uses the\ngetrandom() function instead of the getentropy() function.  The\ngetentropy() function is blocking to generate very good quality\nentropy, os.urandom() doesn't need such high-quality entropy.\n\n- bpo-25182(17): The stdprinter (used as sys.stderr before the io\nmodule is imported at startup) now uses the backslashreplace error\nhandler.\n\n- bpo-25131(18): Make the line number and column offset of set/dict\nliterals and comprehensions correspond to the opening brace.\n\n- bpo-25150(19): Hide the private 'PyatomicXXX' symbols from the\npublic Python.h header to fix a compilation error with OpenMP.\nPyThreadStateGET() becomes an alias to PyThreadStateGet() to\navoid ABI incompatibilities.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25630\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=23564\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=25388\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=25462\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=22995\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=25555\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=24802\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=24726\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=25449\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=25395\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=25274\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=24402\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=24806\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=24848\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=25280\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=25003\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=25182\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=25131\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=25150\n\nFile: python3.12.info,  Node: Library<79>,  Next: IDLE<53>,  Prev: Core and Builtins<80>,  Up: Python 3 5 1 release candidate 1\n\n1.22.91.2 Library\n.................\n\n- bpo-25626(1): Change three zlib functions to accept sizes that fit\nin Pyssizet, but internally cap those sizes to UINTMAX. This\nresolves a regression in 3.5 where GzipFile.read() failed to read\nchunks larger than 2 or 4 GiB. The change affects the\nzlib.Decompress.decompress() maxlength parameter, the\nzlib.decompress() bufsize parameter, and the\nzlib.Decompress.flush() length parameter.\n\n- bpo-25583(2): Avoid incorrect errors raised by\nos.makedirs(existok=True) when the OS gives priority to errors\nsuch as EACCES over EEXIST.\n\n- bpo-25593(3): Change semantics of EventLoop.stop() in asyncio.\n\n- bpo-6973(4): When we know a subprocess.Popen process has died, do\nnot allow the sendsignal(), terminate(), or kill() methods to do\nanything as they could potentially signal a different process.\n\n- bpo-25590(5): In the Readline completer, only call getattr() once\nper attribute.\n\n- bpo-25498(6): Fix a crash when garbage-collecting ctypes objects\ncreated by wrapping a memoryview.  This was a regression made in\n3.5a1.  Based on patch by Eryksun.\n\n- bpo-25584(7): Added \"escape\" to the all list in the glob\nmodule.\n\n- bpo-25584(8): Fixed recursive glob() with patterns starting with\n''.\n\n- bpo-25446(9): Fix regression in smtplib's AUTH LOGIN support.\n\n- bpo-18010(10): Fix the pydoc web server's module search function to\nhandle exceptions from importing packages.\n\n- bpo-25554(11): Got rid of circular references in regular expression\nparsing.\n\n- bpo-25510(12): fileinput.FileInput.readline() now returns b''\ninstead of '' at the end if the FileInput was opened with binary\nmode.  Patch by Ryosuke Ito.\n\n- bpo-25503(13): Fixed inspect.getdoc() for inherited docstrings of\nproperties.  Original patch by John Mark Vandenberg.\n\n- bpo-25515(14): Always use os.urandom as a source of randomness in\nuuid.uuid4.\n\n- bpo-21827(15): Fixed textwrap.dedent() for the case when largest\ncommon whitespace is a substring of smallest leading whitespace.\nBased on patch by Robert Li.\n\n- bpo-25447(16): The lrucache() wrapper objects now can be copied\nand pickled (by returning the original object unchanged).\n\n- bpo-25390(17): typing: Don't crash on Union[str, Pattern].\n\n- bpo-25441(18): asyncio: Raise error from drain() when socket is\nclosed.\n\n- bpo-25410(19): Cleaned up and fixed minor bugs in C implementation\nof OrderedDict.\n\n- bpo-25411(20): Improved Unicode support in SMTPHandler through\nbetter use of the email package.  Thanks to user simon04 for the\npatch.\n\n- bpo-25407(21): Remove mentions of the formatter module being\nremoved in Python 3.6.\n\n- bpo-25406(22): Fixed a bug in C implementation of\nOrderedDict.movetoend() that caused segmentation fault or hang in\niterating after moving several items to the start of ordered dict.\n\n- bpo-25364(23): zipfile now works in threads disabled builds.\n\n- bpo-25328(24): smtpd's SMTPChannel now correctly raises a\nValueError if both decodedata and enableSMTPUTF8 are set to true.\n\n- bpo-25316(25): distutils raises OSError instead of\nDistutilsPlatformError when MSVC is not installed.\n\n- bpo-25380(26): Fixed protocol for the STACKGLOBAL opcode in\npickletools.opcodes.\n\n- bpo-23972(27): Updates asyncio datagram create method allowing\nreuseport and reuseaddr socket options to be set prior to binding\nthe socket.  Mirroring the existing asyncio createserver method\nthe reuseaddr option for datagram sockets defaults to True if the\nO/S is 'posix' (except if the platform is Cygwin).  Patch by Chris\nLaws.\n\n- bpo-25304(28): Add asyncio.runcoroutinethreadsafe().  This lets\nyou submit a coroutine to a loop from another thread, returning a\nconcurrent.futures.Future.  By Vincent Michel.\n\n- bpo-25232(29): Fix CGIRequestHandler to split the query from the\nURL at the first question mark (?)  rather than the last.  Patch\nfrom Xiang Zhang.\n\n- bpo-24657(30): Prevent CGIRequestHandler from collapsing slashes in\nthe query part of the URL as if it were a path.  Patch from Xiang\nZhang.\n\n- bpo-24483(31): C implementation of functools.lrucache() now\ncalculates key's hash only once.\n\n- bpo-22958(32): Constructor and update method of\nweakref.WeakValueDictionary now accept the self and the dict\nkeyword arguments.\n\n- bpo-22609(33): Constructor of collections.UserDict now accepts the\nself keyword argument.\n\n- bpo-25111(34): Fixed comparison of traceback.FrameSummary.\n\n- bpo-25262(35): Added support for BINBYTES8 opcode in Python\nimplementation of unpickler.  Highest 32 bits of 64-bit size for\nBINUNICODE8 and BINBYTES8 opcodes no longer silently ignored on\n32-bit platforms in C implementation.\n\n- bpo-25034(36): Fix string.Formatter problem with auto-numbering and\nnested formatspecs.  Patch by Anthon van der Neut.\n\n- bpo-25233(37): Rewrite the guts of asyncio.Queue and\nasyncio.Semaphore to be more understandable and correct.\n\n- bpo-25203(38): Failed readline.setcompleterdelims() no longer\nleft the module in inconsistent state.\n\n- bpo-23600(39): Default implementation of tzinfo.fromutc() was\nreturning wrong results in some cases.\n\n- bpo-23329(40): Allow the ssl module to be built with older versions\nof LibreSSL.\n\n- Prevent overflow in UnpicklerRead.\n\n- bpo-25047(41): The XML encoding declaration written by Element Tree\nnow respects the letter case given by the user.  This restores the\nability to write encoding names in uppercase like \"UTF-8\", which\nworked in Python 2.\n\n- bpo-25135(42): Make dequeclear() safer by emptying the deque\nbefore clearing.  This helps avoid possible reentrancy issues.\n\n- bpo-19143(43): platform module now reads Windows version from\nkernel32.dll to avoid compatibility shims.\n\n- bpo-25092(44): Fix datetime.strftime() failure when errno was\nalready set to EINVAL.\n\n- bpo-23517(45): Fix rounding in fromtimestamp() and\nutcfromtimestamp() methods of datetime.datetime: microseconds are\nnow rounded to nearest with ties going to nearest even integer\n(ROUNDHALFEVEN), instead of being rounding towards minus infinity\n(ROUNDFLOOR). It's important that these methods use the same\nrounding mode than datetime.timedelta to keep the property:\n(datetime(1970,1,1) + timedelta(seconds=t)) ==\ndatetime.utcfromtimestamp(t).  It also the rounding mode used by\nround(float) for example.\n\n- bpo-25155(46): Fix datetime.datetime.now() and\ndatetime.datetime.utcnow() on Windows to support date after year\n2038.  It was a regression introduced in Python 3.5.0.\n\n- bpo-25108(47): Omitted internal frames in traceback functions\nprintstack(), formatstack(), and extractstack() called without\narguments.\n\n- bpo-25118(48): Fix a regression of Python 3.5.0 in os.waitpid() on\nWindows.\n\n- bpo-24684(49): socket.socket.getaddrinfo() now calls\nPyUnicodeAsEncodedString() instead of calling the encode() method\nof the host, to handle correctly custom string with an encode()\nmethod which doesn't return a byte string.  The encoder of the IDNA\ncodec is now called directly instead of calling the encode() method\nof the string.\n\n- bpo-25060(50): Correctly compute stack usage of the BUILDMAP\nopcode.\n\n- bpo-24857(51): Comparing callargs to a long sequence now correctly\nreturns a boolean result instead of raising an exception.  Patch by\nA Kaptur.\n\n- bpo-23144(52): Make sure that HTMLParser.feed() returns all the\ndata, even when convertcharrefs is True.\n\n- bpo-24982(53): shutil.makearchive() with the \"zip\" format now adds\nentries for directories (including empty directories) in ZIP file.\n\n- bpo-25019(54): Fixed a crash caused by setting non-string key of\nexpat parser.  Based on patch by John Leitch.\n\n- bpo-16180(55): Exit pdb if file has syntax error, instead of\ntrapping user in an infinite loop.  Patch by Xavier de Gaye.\n\n- bpo-24891(56): Fix a race condition at Python startup if the file\ndescriptor of stdin (0), stdout (1) or stderr (2) is closed while\nPython is creating sys.stdin, sys.stdout and sys.stderr objects.\nThese attributes are now set to None if the creation of the object\nfailed, instead of raising an OSError exception.  Initial patch\nwritten by Marco Paolini.\n\n- bpo-24992(57): Fix error handling and a race condition (related to\ngarbage collection) in collections.OrderedDict constructor.\n\n- bpo-24881(58): Fixed setting binary mode in Python implementation\nof FileIO on Windows and Cygwin.  Patch from Akira Li.\n\n- bpo-25578(59): Fix (another) memory leak in SSLSocket.getpeercer().\n\n- bpo-25530(60): Disable the vulnerable SSLv3 protocol by default\nwhen creating ssl.SSLContext.\n\n- bpo-25569(61): Fix memory leak in SSLSocket.getpeercert().\n\n- bpo-25471(62): Sockets returned from accept() shouldn't appear to\nbe nonblocking.\n\n- bpo-25319(63): When threading.Event is reinitialized, the\nunderlying condition should use a regular lock rather than a\nrecursive lock.\n\n- bpo-21112(64): Fix regression in unittest.expectedFailure on\nsubclasses.  Patch from Berker Peksag.\n\n- bpo-24764(65): cgi.FieldStorage.readmulti() now ignores the\nContent-Length header in part headers.  Patch written by Peter\nLandry and reviewed by Pierre Quentel.\n\n- bpo-24913(66): Fix overrun error in deque.index().  Found by John\nLeitch and Bryce Darling.\n\n- bpo-24774(67): Fix docstring in http.server.test.  Patch from\nChiu-Hsiang Hsu.\n\n- bpo-21159(68): Improve message in\nconfigparser.InterpolationMissingOptionError.  Patch from ??ukasz\nLanga.\n\n- bpo-20362(69): Honour TestCase.longMessage correctly in\nassertRegex.  Patch from Ilia Kurenkov.\n\n- bpo-23572(70): Fixed functools.singledispatch on classes with false\nmetaclasses.  Patch by Ethan Furman.\n\n- asyncio: ensurefuture() now accepts awaitable objects.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25626\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=25583\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=25593\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=6973\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=25590\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=25498\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=25584\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=25584\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=25446\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=18010\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=25554\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=25510\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=25503\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=25515\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=21827\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=25447\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=25390\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=25441\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=25410\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=25411\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=25407\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=25406\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=25364\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=25328\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=25316\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=25380\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=23972\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=25304\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=25232\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=24657\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=24483\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=22958\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=22609\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=25111\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=25262\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=25034\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=25233\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=25203\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=23600\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=23329\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=25047\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=25135\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=19143\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=25092\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=23517\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=25155\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=25108\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=25118\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=24684\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=25060\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=24857\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=23144\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=24982\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=25019\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=16180\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=24891\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=24992\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=24881\n\n(59) https://bugs.python.org/issue?@action=redirect&bpo=25578\n\n(60) https://bugs.python.org/issue?@action=redirect&bpo=25530\n\n(61) https://bugs.python.org/issue?@action=redirect&bpo=25569\n\n(62) https://bugs.python.org/issue?@action=redirect&bpo=25471\n\n(63) https://bugs.python.org/issue?@action=redirect&bpo=25319\n\n(64) https://bugs.python.org/issue?@action=redirect&bpo=21112\n\n(65) https://bugs.python.org/issue?@action=redirect&bpo=24764\n\n(66) https://bugs.python.org/issue?@action=redirect&bpo=24913\n\n(67) https://bugs.python.org/issue?@action=redirect&bpo=24774\n\n(68) https://bugs.python.org/issue?@action=redirect&bpo=21159\n\n(69) https://bugs.python.org/issue?@action=redirect&bpo=20362\n\n(70) https://bugs.python.org/issue?@action=redirect&bpo=23572\n\nFile: python3.12.info,  Node: IDLE<53>,  Next: Documentation<71>,  Prev: Library<79>,  Up: Python 3 5 1 release candidate 1\n\n1.22.91.3 IDLE\n..............\n\n- bpo-15348(1): Stop the debugger engine (normally in a user process)\nbefore closing the debugger window (running in the IDLE process).\nThis prevents the RuntimeErrors that were being caught and ignored.\n\n- bpo-24455(2): Prevent IDLE from hanging when a) closing the shell\nwhile the debugger is active (15347); b) closing the debugger with\nthe [X] button (15348); and c) activating the debugger when already\nactive (24455).  The patch by Mark Roseman does this by making two\nchanges.  1.  Suspend and resume the gui.interaction method with\nthe tcl vwait mechanism intended for this purpose (instead of\nroot.mainloop & .quit).  2.  In gui.run, allow any existing\ninteraction to terminate first.\n\n- Change 'The program' to 'Your program' in an IDLE 'kill program?'\nmessage to make it clearer that the program referred to is the\ncurrently running user program, not IDLE itself.\n\n- bpo-24750(3): Improve the appearance of the IDLE editor window\nstatus bar.  Patch by Mark Roseman.\n\n- bpo-25313(4): Change the handling of new built-in text color themes\nto better address the compatibility problem introduced by the\naddition of IDLE Dark.  Consistently use the revised\nidleConf.CurrentTheme everywhere in idlelib.\n\n- bpo-24782(5): Extension configuration is now a tab in the IDLE\nPreferences dialog rather than a separate dialog.  The former tabs\nare now a sorted list.  Patch by Mark Roseman.\n\n- bpo-22726(6): Re-activate the config dialog help button with some\ncontent about the other buttons and the new IDLE Dark theme.\n\n- bpo-24820(7): IDLE now has an 'IDLE Dark' built-in text color\ntheme.  It is more or less IDLE Classic inverted, with a cobalt\nblue background.  Strings, comments, keywords, ... are still green,\nred, orange, ... .  To use it with IDLEs released before November\n2015, hit the 'Save as New Custom Theme' button and enter a new\nname, such as 'Custom Dark'.  The custom theme will work with any\nIDLE release, and can be modified.\n\n- bpo-25224(8): README.txt is now an idlelib index for IDLE\ndevelopers and curious users.  The previous user content is now in\nthe IDLE doc chapter.  'IDLE' now means 'Integrated Development and\nLearning Environment'.\n\n- bpo-24820(9): Users can now set breakpoint colors in Settings ->\nCustom Highlighting.  Original patch by Mark Roseman.\n\n- bpo-24972(10): Inactive selection background now matches active\nselection background, as configured by users, on all systems.\nFound items are now always highlighted on Windows.  Initial patch\nby Mark Roseman.\n\n- bpo-24570(11): Idle: make calltip and completion boxes appear on\nMacs affected by a tk regression.  Initial patch by Mark Roseman.\n\n- bpo-24988(12): Idle ScrolledList context menus (used in debugger)\nnow work on Mac Aqua.  Patch by Mark Roseman.\n\n- bpo-24801(13): Make right-click for context menu work on Mac Aqua.\nPatch by Mark Roseman.\n\n- bpo-25173(14): Associate tkinter messageboxes with a specific\nwidget.  For Mac OSX, make them a 'sheet'.  Patch by Mark Roseman.\n\n- bpo-25198(15): Enhance the initial html viewer now used for Idle\nHelp.  Properly indent fixed-pitch text (patch by Mark Roseman).\nGive code snippet a very Sphinx-like light blueish-gray background.\nRe-use initial width and height set by users for shell and editor.\nWhen the Table of Contents (TOC) menu is used, put the section\nheader at the top of the screen.\n\n- bpo-25225(16): Condense and rewrite Idle doc section on text\ncolors.\n\n- bpo-21995(17): Explain some differences between IDLE and console\nPython.\n\n- bpo-22820(18): Explain need for 'print' when running file from Idle\neditor.\n\n- bpo-25224(19): Doc: augment Idle feature list and no-subprocess\nsection.\n\n- bpo-25219(20): Update doc for Idle command line options.  Some were\nmissing and notes were not correct.\n\n- bpo-24861(21): Most of idlelib is private and subject to change.\nUse idleib.idle.* to start Idle.  See idlelib.init.doc.\n\n- bpo-25199(22): Idle: add synchronization comments for future\nmaintainers.\n\n- bpo-16893(23): Replace help.txt with help.html for Idle doc\ndisplay.  The new idlelib/help.html is rstripped\nDoc/build/html/library/idle.html.  It looks better than help.txt\nand will better document Idle as released.  The tkinter html viewer\nthat works for this file was written by Mark Roseman.  The now\nunused EditorWindow.HelpDialog class and helt.txt file are\ndeprecated.\n\n- bpo-24199(24): Deprecate unused idlelib.idlever with possible\nremoval in 3.6.\n\n- bpo-24790(25): Remove extraneous code (which also create 2 & 3\nconflicts).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=15348\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=24455\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=24750\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=25313\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=24782\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=22726\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=24820\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=25224\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=24820\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=24972\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=24570\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=24988\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=24801\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=25173\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=25198\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=25225\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=21995\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=22820\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=25224\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=25219\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=24861\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=25199\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=16893\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=24199\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=24790\n\nFile: python3.12.info,  Node: Documentation<71>,  Next: Tests<71>,  Prev: IDLE<53>,  Up: Python 3 5 1 release candidate 1\n\n1.22.91.4 Documentation\n.......................\n\n- bpo-22558(1): Add remaining doc links to source code for\nPython-coded modules.  Patch by Yoni Lavi.\n\n- bpo-12067(2): Rewrite Comparisons section in the Expressions\nchapter of the language reference.  Some of the details of\ncomparing mixed types were incorrect or ambiguous.  NotImplemented\nis only relevant at a lower level than the Expressions chapter.\nAdded details of comparing range() objects, and default behaviour\nand consistency suggestions for user-defined classes.  Patch from\nAndy Maier.\n\n- bpo-24952(3): Clarify the default size argument of stacksize() in\nthe \"threading\" and \"thread\" modules.  Patch from Mattip.\n\n- bpo-23725(4): Overhaul tempfile docs.  Note deprecated status of\nmktemp.  Patch from Zbigniew J??drzejewski-Szmek.\n\n- bpo-24808(5): Update the types of some PyTypeObject fields.  Patch\nby Joseph Weston.\n\n- bpo-22812(6): Fix unittest discovery examples.  Patch from Pam\nMcA'Nulty.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=22558\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=12067\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=24952\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=23725\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=24808\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=22812\n\nFile: python3.12.info,  Node: Tests<71>,  Next: Build<74>,  Prev: Documentation<71>,  Up: Python 3 5 1 release candidate 1\n\n1.22.91.5 Tests\n...............\n\n- bpo-25449(1): Added tests for OrderedDict subclasses.\n\n- bpo-25099(2): Make testcompileall not fail when an entry on\nsys.path cannot be written to (commonly seen in administrative\ninstalls on Windows).\n\n- bpo-23919(3): Prevents assert dialogs appearing in the test suite.\n\n- 'PCbuild\\rt.bat' now accepts an unlimited number of arguments to\npass along to regrtest.py.  Previously there was a limit of 9.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25449\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=25099\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=23919\n\nFile: python3.12.info,  Node: Build<74>,  Next: Windows<68>,  Prev: Tests<71>,  Up: Python 3 5 1 release candidate 1\n\n1.22.91.6 Build\n...............\n\n- bpo-24915(1): Add LLVM support for PGO builds and use the test\nsuite to generate the profile data.  Initial patch by Alecsandru\nPatrascu of Intel.\n\n- bpo-24910(2): Windows MSIs now have unique display names.\n\n- bpo-24986(3): It is now possible to build Python on Windows without\nerrors when external libraries are not available.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24915\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=24910\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=24986\n\nFile: python3.12.info,  Node: Windows<68>,  Next: Tools/Demos<44>,  Prev: Build<74>,  Up: Python 3 5 1 release candidate 1\n\n1.22.91.7 Windows\n.................\n\n- bpo-25450(1): Updates shortcuts to start Python in installation\ndirectory.\n\n- bpo-25164(2): Changes default all-users install directory to match\nper-user directory.\n\n- bpo-25143(3): Improves installer error messages for unsupported\nplatforms.\n\n- bpo-25163(4): Display correct directory in installer when using\nnon-default settings.\n\n- bpo-25361(5): Disables use of SSE2 instructions in Windows 32-bit\nbuild\n\n- bpo-25089(6): Adds logging to installer for case where launcher is\nnot selected on upgrade.\n\n- bpo-25165(7): Windows uninstallation should not remove launcher if\nother versions remain\n\n- bpo-25112(8): py.exe launcher is missing icons\n\n- bpo-25102(9): Windows installer does not precompile for -O or -OO.\n\n- bpo-25081(10): Makes Back button in installer go back to upgrade\npage when upgrading.\n\n- bpo-25091(11): Increases font size of the installer.\n\n- bpo-25126(12): Clarifies that the non-web installer will download\nsome components.\n\n- bpo-25213(13): Restores requestedExecutionLevel to manifest to\ndisable UAC virtualization.\n\n- bpo-25022(14): Removed very outdated PC/examplent/ directory.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25450\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=25164\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=25143\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=25163\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=25361\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=25089\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=25165\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=25112\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=25102\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=25081\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=25091\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=25126\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=25213\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=25022\n\nFile: python3.12.info,  Node: Tools/Demos<44>,  Prev: Windows<68>,  Up: Python 3 5 1 release candidate 1\n\n1.22.91.8 Tools/Demos\n.....................\n\n- bpo-25440(1): Fix output of python-config -extension-suffix.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25440\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 5 0 final,  Next: Python 3 5 0 release candidate 4,  Prev: Python 3 5 1 release candidate 1,  Up: Changelog": {
            "content": "'Release date: 2015-09-13'\n\n* Menu:\n\n* Build: Build<75>.\n\nFile: python3.12.info,  Node: Build<75>,  Up: Python 3 5 0 final\n\n1.22.92.1 Build\n...............\n\n- bpo-25071(1): Windows installer should not require TargetDir\nparameter when installing quietly.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25071\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 5 0 release candidate 4,  Next: Python 3 5 0 release candidate 3,  Prev: Python 3 5 0 final,  Up: Changelog": {
            "content": "'Release date: 2015-09-09'\n\n* Menu:\n\n* Library: Library<80>.\n* Build: Build<76>.\n\nFile: python3.12.info,  Node: Library<80>,  Next: Build<76>,  Up: Python 3 5 0 release candidate 4\n\n1.22.93.1 Library\n.................\n\n- bpo-25029(1): Fixes MemoryError in teststrptime.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25029\n\nFile: python3.12.info,  Node: Build<76>,  Prev: Library<80>,  Up: Python 3 5 0 release candidate 4\n\n1.22.93.2 Build\n...............\n\n- bpo-25027(1): Reverts partial-static build options and adds\nvcruntime140.dll to Windows installation.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=25027\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 5 0 release candidate 3,  Next: Python 3 5 0 release candidate 2,  Prev: Python 3 5 0 release candidate 4,  Up: Changelog": {
            "content": "'Release date: 2015-09-07'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<81>.\n* Library: Library<81>.\n\nFile: python3.12.info,  Node: Core and Builtins<81>,  Next: Library<81>,  Up: Python 3 5 0 release candidate 3\n\n1.22.94.1 Core and Builtins\n...........................\n\n- bpo-24305(1): Prevent import subsystem stack frames from being\ncounted by the warnings.warn(stacklevel=) parameter.\n\n- bpo-24912(2): Prevent class assignment to immutable built-in\nobjects.\n\n- bpo-24975(3): Fix AST compilation for PEP 448(4) syntax.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24305\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=24912\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=24975\n\n(4) https://peps.python.org/pep-0448/\n\nFile: python3.12.info,  Node: Library<81>,  Prev: Core and Builtins<81>,  Up: Python 3 5 0 release candidate 3\n\n1.22.94.2 Library\n.................\n\n- bpo-24917(1): timestrftime() buffer over-read.\n\n- bpo-24748(2): To resolve a compatibility problem found with py2exe\nand pywin32, imp.loaddynamic() once again ignores previously\nloaded modules to support Python modules replacing themselves with\nextension modules.  Patch by Petr Viktorin.\n\n- bpo-24635(3): Fixed a bug in typing.py where isinstance([],\ntyping.Iterable) would return True once, then False on subsequent\ncalls.\n\n- bpo-24989(4): Fixed buffer overread in BytesIO.readline() if a\nposition is set beyond size.  Based on patch by John Leitch.\n\n- bpo-24913(5): Fix overrun error in deque.index().  Found by John\nLeitch and Bryce Darling.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24917\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=24748\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=24635\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=24989\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=24913\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 5 0 release candidate 2,  Next: Python 3 5 0 release candidate 1,  Prev: Python 3 5 0 release candidate 3,  Up: Changelog": {
            "content": "'Release date: 2015-08-25'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<82>.\n* Library: Library<82>.\n\nFile: python3.12.info,  Node: Core and Builtins<82>,  Next: Library<82>,  Up: Python 3 5 0 release candidate 2\n\n1.22.95.1 Core and Builtins\n...........................\n\n- bpo-24769(1): Interpreter now starts properly when dynamic loading\nis disabled.  Patch by Petr Viktorin.\n\n- bpo-21167(2): NAN operations are now handled correctly when python\nis compiled with ICC even if -fp-model strict is not specified.\n\n- bpo-24492(3): A \"package\" lacking a name attribute when trying\nto perform a 'from .. import ...' statement will trigger an\nImportError instead of an AttributeError.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24769\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=21167\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=24492\n\nFile: python3.12.info,  Node: Library<82>,  Prev: Core and Builtins<82>,  Up: Python 3 5 0 release candidate 2\n\n1.22.95.2 Library\n.................\n\n- bpo-24847(1): Removes vcruntime140.dll dependency from Tcl/Tk.\n\n- bpo-24839(2): platform.syscmdver raises DeprecationWarning\n\n- bpo-24867(3): Fix Task.getstack() for 'async def' coroutines\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24847\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=24839\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=24867\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 5 0 release candidate 1,  Next: Python 3 5 0 beta 4,  Prev: Python 3 5 0 release candidate 2,  Up: Changelog": {
            "content": "'Release date: 2015-08-09'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<83>.\n* Library: Library<83>.\n* IDLE: IDLE<54>.\n* Documentation: Documentation<72>.\n* Tests: Tests<72>.\n\nFile: python3.12.info,  Node: Core and Builtins<83>,  Next: Library<83>,  Up: Python 3 5 0 release candidate 1\n\n1.22.96.1 Core and Builtins\n...........................\n\n- bpo-24667(1): Resize odict in all cases that the underlying dict\nresizes.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24667\n\nFile: python3.12.info,  Node: Library<83>,  Next: IDLE<54>,  Prev: Core and Builtins<83>,  Up: Python 3 5 0 release candidate 1\n\n1.22.96.2 Library\n.................\n\n- bpo-24824(1): Signatures of codecs.encode() and codecs.decode() now\nare compatible with pydoc.\n\n- bpo-24634(2): Importing uuid should not try to load libc on Windows\n\n- bpo-24798(3): msvccompiler.py doesn't properly support manifests\n\n- bpo-4395(4): Better testing and documentation of binary operators.\nPatch by Martin Panter.\n\n- bpo-23973(5): Update typing.py from GitHub repo.\n\n- bpo-23004(6): mockopen() now reads binary data correctly when the\ntype of readdata is bytes.  Initial patch by Aaron Hill.\n\n- bpo-23888(7): Handle fractional time in cookie expiry.  Patch by\nssh.\n\n- bpo-23652(8): Make it possible to compile the select module against\nthe libc headers from the Linux Standard Base, which do not include\nsome EPOLL macros.  Patch by Matt Frank.\n\n- bpo-22932(9): Fix timezones in email.utils.formatdate.  Patch from\nDmitry Shachnev.\n\n- bpo-23779(10): imaplib raises TypeError if authenticator tries to\nabort.  Patch from Craig Holmquist.\n\n- bpo-23319(11): Fix ctypes.BigEndianStructure, swap correctly bytes.\nPatch written by Matthieu Gautier.\n\n- bpo-23254(12): Document how to close the TCPServer listening\nsocket.  Patch from Martin Panter.\n\n- bpo-19450(13): Update Windows and OS X installer builds to use\nSQLite 3.8.11.\n\n- bpo-17527(14): Add PATCH to wsgiref.validator.  Patch from Luca\nSbardella.\n\n- bpo-24791(15): Fix grammar regression for call syntax: 'g(*a or\nb)'.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24824\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=24634\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=24798\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=4395\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=23973\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=23004\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=23888\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=23652\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=22932\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=23779\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=23319\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=23254\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=19450\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=17527\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=24791\n\nFile: python3.12.info,  Node: IDLE<54>,  Next: Documentation<72>,  Prev: Library<83>,  Up: Python 3 5 0 release candidate 1\n\n1.22.96.3 IDLE\n..............\n\n- bpo-23672(1): Allow Idle to edit and run files with astral chars in\nname.  Patch by Mohd Sanad Zaki Rizvi.\n\n- bpo-24745(2): Idle editor default font.  Switch from Courier to\nplatform-sensitive TkFixedFont.  This should not affect current\ncustomized font selections.  If there is a problem, edit\n$HOME/.idlerc/config-main.cfg and remove ''fontXXX'' entries from\n[Editor Window].  Patch by Mark Roseman.\n\n- bpo-21192(3): Idle editor.  When a file is run, put its name in the\nrestart bar.  Do not print false prompts.  Original patch by Adnan\nUmer.\n\n- bpo-13884(4): Idle menus.  Remove tearoff lines.  Patch by Roger\nSerwy.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23672\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=24745\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=21192\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=13884\n\nFile: python3.12.info,  Node: Documentation<72>,  Next: Tests<72>,  Prev: IDLE<54>,  Up: Python 3 5 0 release candidate 1\n\n1.22.96.4 Documentation\n.......................\n\n- bpo-24129(1): Clarify the reference documentation for name\nresolution.  This includes removing the assumption that readers\nwill be familiar with the name resolution scheme Python used prior\nto the introduction of lexical scoping for function namespaces.\nPatch by Ivan Levkivskyi.\n\n- bpo-20769(2): Improve reload() docs.  Patch by Dorian Pula.\n\n- bpo-23589(3): Remove duplicate sentence from the FAQ. Patch by\nYongzhi Pan.\n\n- bpo-24729(4): Correct IO tutorial to match implementation regarding\nencoding parameter to open function.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24129\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=20769\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=23589\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=24729\n\nFile: python3.12.info,  Node: Tests<72>,  Prev: Documentation<72>,  Up: Python 3 5 0 release candidate 1\n\n1.22.96.5 Tests\n...............\n\n- bpo-24751(1): When running regrtest with the '-w' command line\noption, a test run is no longer marked as a failure if all tests\nsucceed when re-run.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24751\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 5 0 beta 4,  Next: Python 3 5 0 beta 3,  Prev: Python 3 5 0 release candidate 1,  Up: Changelog": {
            "content": "'Release date: 2015-07-26'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<84>.\n* Library: Library<84>.\n* Build: Build<77>.\n\nFile: python3.12.info,  Node: Core and Builtins<84>,  Next: Library<84>,  Up: Python 3 5 0 beta 4\n\n1.22.97.1 Core and Builtins\n...........................\n\n- bpo-23573(1): Restored optimization of bytes.rfind() and\nbytearray.rfind() for single-byte argument on Linux.\n\n- bpo-24569(2): Make PEP 448(3) dictionary evaluation more\nconsistent.\n\n- bpo-24583(4): Fix crash when set is mutated while being updated.\n\n- bpo-24407(5): Fix crash when dict is mutated while being updated.\n\n- bpo-24619(6): New approach for tokenizing async/await.  As a\nconsequence, it is now possible to have one-line 'async def foo():\nawait ..' functions.\n\n- bpo-24687(7): Plug refleak on SyntaxError in function parameters\nannotations.\n\n- bpo-15944(8): memoryview: Allow arbitrary formats when casting to\nbytes.  Patch by Martin Panter.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23573\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=24569\n\n(3) https://peps.python.org/pep-0448/\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=24583\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=24407\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=24619\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=24687\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=15944\n\nFile: python3.12.info,  Node: Library<84>,  Next: Build<77>,  Prev: Core and Builtins<84>,  Up: Python 3 5 0 beta 4\n\n1.22.97.2 Library\n.................\n\n- bpo-23441(1): rcompleter now prints a tab character instead of\ndisplaying possible completions for an empty word.  Initial patch\nby Martin Sekera.\n\n- bpo-24683(2): Fixed crashes in json functions called with\narguments of inappropriate type.\n\n- bpo-21697(3): shutil.copytree() now correctly handles symbolic\nlinks that point to directories.  Patch by Eduardo Seabra and\nThomas Kluyver.\n\n- bpo-14373(4): Fixed segmentation fault when gc.collect() is called\nduring constructing lrucache (C implementation).\n\n- bpo-24695(5): Fix a regression in traceback.printexception().  If\nexctraceback is None we shouldn't print a traceback header like\ndescribed in the documentation.\n\n- bpo-24620(6): Random.setstate() now validates the value of state\nlast element.\n\n- bpo-22485(7): Fixed an issue that caused 'inspect.getsource' to\nreturn incorrect results on nested functions.\n\n- bpo-22153(8): Improve unittest docs.  Patch from Martin Panter and\nevilzero.\n\n- bpo-24580(9): Symbolic group references to open group in re\npatterns now are explicitly forbidden as well as numeric group\nreferences.\n\n- bpo-24206(10): Fixed eq and ne methods of inspect classes.\n\n- bpo-24631(11): Fixed regression in the timeit module with multiline\nsetup.\n\n- bpo-18622(12): unittest.mock.mockopen().resetmock would recurse\ninfinitely.  Patch from Nicola Palumbo and Laurent De Buyst.\n\n- bpo-23661(13): unittest.mock sideeffects can now be exceptions\nagain.  This was a regression vs Python 3.4.  Patch from Ignacio\nRossi\n\n- bpo-24608(14): chunk.Chunk.read() now always returns bytes, not\nstr.\n\n- bpo-18684(15): Fixed reading out of the buffer in the re module.\n\n- bpo-24259(16): tarfile now raises a ReadError if an archive is\ntruncated inside a data segment.\n\n- bpo-15014(17): SMTP.auth() and SMTP.login() now support RFC 4954's\noptional initial-response argument to the SMTP AUTH command.\n\n- bpo-24669(18): Fix inspect.getsource() for 'async def' functions.\nPatch by Kai Groner.\n\n- bpo-24688(19): ast.getdocstring() for 'async def' functions.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23441\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=24683\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=21697\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=14373\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=24695\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=24620\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=22485\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=22153\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=24580\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=24206\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=24631\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=18622\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=23661\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=24608\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=18684\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=24259\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=15014\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=24669\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=24688\n\nFile: python3.12.info,  Node: Build<77>,  Prev: Library<84>,  Up: Python 3 5 0 beta 4\n\n1.22.97.3 Build\n...............\n\n- bpo-24603(1): Update Windows builds and OS X 10.5 installer to use\nOpenSSL 1.0.2d.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24603\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 5 0 beta 3,  Next: Python 3 5 0 beta 2,  Prev: Python 3 5 0 beta 4,  Up: Changelog": {
            "content": "'Release date: 2015-07-05'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<85>.\n* Library: Library<85>.\n* Tests: Tests<73>.\n* Documentation: Documentation<73>.\n* Build: Build<78>.\n\nFile: python3.12.info,  Node: Core and Builtins<85>,  Next: Library<85>,  Up: Python 3 5 0 beta 3\n\n1.22.98.1 Core and Builtins\n...........................\n\n- bpo-24467(1): Fixed possible buffer over-read in bytearray.  The\nbytearray object now always allocates place for trailing null byte\nand it's buffer now is always null-terminated.\n\n- Upgrade to Unicode 8.0.0.\n\n- bpo-24345(2): Add Pytpfinalize slot for the stable ABI.\n\n- bpo-24400(3): Introduce a distinct type for PEP 492(4) coroutines;\nadd types.CoroutineType, inspect.getcoroutinestate,\ninspect.getcoroutinelocals; coroutines no longer use COGENERATOR\nflag; sys.setcoroutinewrapper works only for 'async def'\ncoroutines; inspect.iscoroutine no longer uses\ncollections.abc.Coroutine, it's intended to test for pure 'async\ndef' coroutines only; add new opcode: GETYIELDFROMITER; fix\ngenerators wrapper used in types.coroutine to be instance of\ncollections.abc.Generator; collections.abc.Awaitable and\ncollections.abc.Coroutine can no longer be used to detect\ngenerator-based coroutines-use inspect.isawaitable instead.\n\n- bpo-24450(5): Add giyieldfrom to generators and crawait to\ncoroutines.  Contributed by Benno Leslie and Yury Selivanov.\n\n- bpo-19235(6): Add new RecursionError exception.  Patch by Georg\nBrandl.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24467\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=24345\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=24400\n\n(4) https://peps.python.org/pep-0492/\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=24450\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=19235\n\nFile: python3.12.info,  Node: Library<85>,  Next: Tests<73>,  Prev: Core and Builtins<85>,  Up: Python 3 5 0 beta 3\n\n1.22.98.2 Library\n.................\n\n- bpo-21750(1): mockopen.readdata can now be read from each\ninstance, as it could in Python 3.3.\n\n- bpo-24552(2): Fix use after free in an error case of the pickle\nmodule.\n\n- bpo-24514(3): tarfile now tolerates number fields consisting of\nonly whitespace.\n\n- bpo-19176(4): Fixed doctype() related bugs in C implementation of\nElementTree.  A deprecation warning no longer issued by XMLParser\nsubclass with default doctype() method.  Direct call of doctype()\nnow issues a warning.  Parser's doctype() now is not called if\ntarget's doctype() is called.  Based on patch by Martin Panter.\n\n- bpo-20387(5): Restore semantic round-trip correctness in\ntokenize/untokenize for tab-indented blocks.\n\n- bpo-24456(6): Fixed possible buffer over-read in adpcm2lin() and\nlin2adpcm() functions of the audioop module.\n\n- bpo-24336(7): The contextmanager decorator now works with functions\nwith keyword arguments called \"func\" and \"self\".  Patch by Martin\nPanter.\n\n- bpo-24522(8): Fix possible integer overflow in json accelerator\nmodule.\n\n- bpo-24489(9): ensure a previously set C errno doesn't disturb\ncmath.polar().\n\n- bpo-24408(10): Fixed AttributeError in measure() and metrics()\nmethods of tkinter.Font.\n\n- bpo-14373(11): C implementation of functools.lrucache() now can be\nused with methods.\n\n- bpo-24347(12): Set KeyError if PyDictGetItemWithError returns\nNULL.\n\n- bpo-24348(13): Drop superfluous incref/decref.\n\n- bpo-24359(14): Check for changed OrderedDict size during iteration.\n\n- bpo-24368(15): Support keyword arguments in OrderedDict methods.\n\n- bpo-24362(16): Simplify the C OrderedDict fast nodes resize logic.\n\n- bpo-24377(17): Fix a ref leak in OrderedDict.repr.\n\n- bpo-24369(18): Defend against key-changes during iteration.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=21750\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=24552\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=24514\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=19176\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=20387\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=24456\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=24336\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=24522\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=24489\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=24408\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=14373\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=24347\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=24348\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=24359\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=24368\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=24362\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=24377\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=24369\n\nFile: python3.12.info,  Node: Tests<73>,  Next: Documentation<73>,  Prev: Library<85>,  Up: Python 3 5 0 beta 3\n\n1.22.98.3 Tests\n...............\n\n- bpo-24373(1): testmultiphase and xxlimited now use tptraverse and\ntpfinalize to avoid reference leaks encountered when combining\ntpdealloc with PyTypeFromSpec (see bpo-16690(2) for details)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24373\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=16690\n\nFile: python3.12.info,  Node: Documentation<73>,  Next: Build<78>,  Prev: Tests<73>,  Up: Python 3 5 0 beta 3\n\n1.22.98.4 Documentation\n.......................\n\n- bpo-24458(1): Update documentation to cover multi-phase\ninitialization for extension modules (PEP 489).  Patch by Petr\nViktorin.\n\n- bpo-24351(2): Clarify what is meant by \"identifier\" in the context\nof string.Template instances.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24458\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=24351\n\nFile: python3.12.info,  Node: Build<78>,  Prev: Documentation<73>,  Up: Python 3 5 0 beta 3\n\n1.22.98.5 Build\n...............\n\n- bpo-24432(1): Update Windows builds and OS X 10.5 installer to use\nOpenSSL 1.0.2c.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24432\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 5 0 beta 2,  Next: Python 3 5 0 beta 1,  Prev: Python 3 5 0 beta 3,  Up: Changelog": {
            "content": "'Release date: 2015-05-31'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<86>.\n* Library: Library<86>.\n\nFile: python3.12.info,  Node: Core and Builtins<86>,  Next: Library<86>,  Up: Python 3 5 0 beta 2\n\n1.22.99.1 Core and Builtins\n...........................\n\n- bpo-24284(1): The startswith and endswith methods of the str class\nno longer return True when finding the empty string and the indexes\nare completely out of range.\n\n- bpo-24115(2): Update uses of PyObjectIsTrue(), PyObjectNot(),\nPyObjectIsInstance(), PyObjectRichCompareBool() and\nPyDictContains() to check for and handle errors correctly.\n\n- bpo-24328(3): Fix importing one character extension modules.\n\n- bpo-11205(4): In dictionary displays, evaluate the key before the\nvalue.\n\n- bpo-24285(5): Fixed regression that prevented importing extension\nmodules from inside packages.  Patch by Petr Viktorin.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24284\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=24115\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=24328\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=11205\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=24285\n\nFile: python3.12.info,  Node: Library<86>,  Prev: Core and Builtins<86>,  Up: Python 3 5 0 beta 2\n\n1.22.99.2 Library\n.................\n\n- bpo-23247(1): Fix a crash in the StreamWriter.reset() of CJK\ncodecs.\n\n- bpo-24270(2): Add math.isclose() and cmath.isclose() functions as\nper PEP 485(3).  Contributed by Chris Barker and Tal Einat.\n\n- bpo-5633(4): Fixed timeit when the statement is a string and the\nsetup is not.\n\n- bpo-24326(5): Fixed audioop.ratecv() with non-default weightB\nargument.  Original patch by David Moore.\n\n- bpo-16991(6): Add a C implementation of OrderedDict.\n\n- bpo-23934(7): Fix inspect.signature to fail correctly for builtin\ntypes lacking signature information.  Initial patch by James\nPowell.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23247\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=24270\n\n(3) https://peps.python.org/pep-0485/\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=5633\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=24326\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=16991\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=23934\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 5 0 beta 1,  Next: Python 3 5 0 alpha 4,  Prev: Python 3 5 0 beta 2,  Up: Changelog": {
            "content": "'Release date: 2015-05-24'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<87>.\n* Library: Library<87>.\n* IDLE: IDLE<55>.\n* Tests: Tests<74>.\n* Documentation: Documentation<74>.\n* Tools/Demos: Tools/Demos<45>.\n\nFile: python3.12.info,  Node: Core and Builtins<87>,  Next: Library<87>,  Up: Python 3 5 0 beta 1\n\n1.22.100.1 Core and Builtins\n............................\n\n- bpo-24276(1): Fixed optimization of property descriptor getter.\n\n- bpo-24268(2): PEP 489: Multi-phase extension module initialization.\nPatch by Petr Viktorin.\n\n- bpo-23955(3): Add pyvenv.cfg option to suppress\nregistry/environment lookup for generating sys.path on Windows.\n\n- bpo-24257(4): Fixed system error in the comparison of faked\ntypes.SimpleNamespace.\n\n- bpo-22939(5): Fixed integer overflow in iterator object.  Patch by\nClement Rouault.\n\n- bpo-23985(6): Fix a possible buffer overrun when deleting a slice\nfrom the front of a bytearray and then appending some other bytes\ndata.\n\n- bpo-24102(7): Fixed exception type checking in standard error\nhandlers.\n\n- bpo-15027(8): The UTF-32 encoder is now 3x to 7x faster.\n\n- bpo-23290(9): Optimize setmerge() for cases where the target is\nempty.  (Contributed by Serhiy Storchaka.)\n\n- bpo-2292(10): PEP 448: Additional Unpacking Generalizations.\n\n- bpo-24096(11): Make warnings.warnexplicit more robust against\nmutation of the warnings.filters list.\n\n- bpo-23996(12): Avoid a crash when a delegated generator raises an\nunnormalized StopIteration exception.  Patch by Stefan Behnel.\n\n- bpo-23910(13): Optimize property() getter calls.  Patch by Joe\nJevnik.\n\n- bpo-23911(14): Move path-based importlib bootstrap code to a\nseparate frozen module.\n\n- bpo-24192(15): Fix namespace package imports.\n\n- bpo-24022(16): Fix tokenizer crash when processing undecodable\nsource code.\n\n- bpo-9951(17): Added a hex() method to bytes, bytearray, and\nmemoryview.\n\n- bpo-22906(18): PEP 479: Change StopIteration handling inside\ngenerators.\n\n- bpo-24017(19): PEP 492: Coroutines with async and await syntax.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24276\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=24268\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=23955\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=24257\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=22939\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=23985\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=24102\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=15027\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=23290\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=2292\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=24096\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=23996\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=23910\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=23911\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=24192\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=24022\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=9951\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=22906\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=24017\n\nFile: python3.12.info,  Node: Library<87>,  Next: IDLE<55>,  Prev: Core and Builtins<87>,  Up: Python 3 5 0 beta 1\n\n1.22.100.2 Library\n..................\n\n- bpo-14373(1): Added C implementation of functools.lrucache().\nBased on patches by Matt Joiner and Alexey Kachayev.\n\n- bpo-24230(2): The tempfile module now accepts bytes for prefix,\nsuffix and dir parameters and returns bytes in such situations\n(matching the os module APIs).\n\n- bpo-22189(3): collections.UserString now supports getnewargs(),\nrmod(), casefold(), formatmap(), isprintable(), and\nmaketrans().  Patch by Joe Jevnik.\n\n- bpo-24244(4): Prevents termination when an invalid format string is\nencountered on Windows in strftime.\n\n- bpo-23973(5): PEP 484: Add the typing module.\n\n- bpo-23086(6): The collections.abc.Sequence() abstract base class\nadded 'start' and 'stop' parameters to the index() mixin.  Patch by\nDevin Jeanpierre.\n\n- bpo-20035(7): Replaced the 'tkinter.fix' module used for setting\nup the Tcl/Tk environment on Windows with a private function in the\n'tkinter' module that makes no permanent changes to the\nenvironment.\n\n- bpo-24257(8): Fixed segmentation fault in sqlite3.Row constructor\nwith faked cursor type.\n\n- bpo-15836(9): assertRaises(), assertRaisesRegex(), assertWarns()\nand assertWarnsRegex() assertments now check the type of the first\nargument to prevent possible user error.  Based on patch by Daniel\nWagner-Hall.\n\n- bpo-9858(10): Add missing method stubs to io.RawIOBase.  Patch by\nLaura Rupprecht.\n\n- bpo-22955(11): attrgetter, itemgetter and methodcaller objects in\nthe operator module now support pickling.  Added readable and\nevaluable repr for these objects.  Based on patch by Josh\nRosenberg.\n\n- bpo-22107(12): tempfile.gettempdir() and tempfile.mkdtemp() now try\nagain when a directory with the chosen name already exists on\nWindows as well as on Unix.  tempfile.mkstemp() now fails early if\nparent directory is not valid (not exists or is a file) on Windows.\n\n- bpo-23780(13): Improved error message in os.path.join() with single\nargument.\n\n- bpo-6598(14): Increased time precision and random number range in\nemail.utils.makemsgid() to strengthen the uniqueness of the\nmessage ID.\n\n- bpo-24091(15): Fixed various crashes in corner cases in C\nimplementation of ElementTree.\n\n- bpo-21931(16): msilib.FCICreate() now raises TypeError in the case\nof a bad argument instead of a ValueError with a bogus FCI error\nnumber.  Patch by Jeffrey Armstrong.\n\n- bpo-13866(17): 'quotevia' argument added to\nurllib.parse.urlencode.\n\n- bpo-20098(18): New manglefrom policy option for email, default\nTrue for compat32, but False for all other policies.\n\n- bpo-24211(19): The email library now supports RFC 6532: it can\ngenerate headers using utf-8 instead of encoded words.\n\n- bpo-16314(20): Added support for the LZMA compression in distutils.\n\n- bpo-21804(21): poplib now supports RFC 6856 (UTF8).\n\n- bpo-18682(22): Optimized pprint functions for builtin scalar types.\n\n- bpo-22027(23): smtplib now supports RFC 6531 (SMTPUTF8).\n\n- bpo-23488(24): Random generator objects now consume 2x less memory\non 64-bit.\n\n- bpo-1322(25): platform.dist() and platform.linuxdistribution()\nfunctions are now deprecated.  Initial patch by Vajrasky Kok.\n\n- bpo-22486(26): Added the math.gcd() function.  The fractions.gcd()\nfunction now is deprecated.  Based on patch by Mark Dickinson.\n\n- bpo-24064(27): Property() docstrings are now writeable.  (Patch by\nBerker Peksag.)\n\n- bpo-22681(28): Added support for the koi8t encoding.\n\n- bpo-22682(29): Added support for the kz1048 encoding.\n\n- bpo-23796(30): peek and read1 methods of BufferedReader now raise\nValueError if they called on a closed object.  Patch by John\nHergenroeder.\n\n- bpo-21795(31): smtpd now supports the 8BITMIME extension whenever\nthe new 'decodedata' constructor argument is set to False.\n\n- bpo-24155(32): optimize heapq.heapify() for better cache\nperformance when heapifying large lists.\n\n- bpo-21800(33): imaplib now supports RFC 5161 (enable), RFC 6855\n(utf8/internationalized email) and automatically encodes non-ASCII\nusernames and passwords to UTF8.\n\n- bpo-20274(34): When calling a sqlite.Connection, it now complains\nif passed any keyword arguments.  Previously it silently ignored\nthem.\n\n- bpo-20274(35): Remove ignored and erroneous \"kwargs\" parameters\nfrom three METHVARARGS methods on sqlite.Connection.\n\n- bpo-24134(36): assertRaises(), assertRaisesRegex(), assertWarns()\nand assertWarnsRegex() checks now emits a deprecation warning when\ncallable is None or keyword arguments except msg is passed in the\ncontext manager mode.\n\n- bpo-24018(37): Add a collections.abc.Generator abstract base class.\nContributed by Stefan Behnel.\n\n- bpo-23880(38): Tkinter's getint() and getdouble() now support\nTclObj.  Tkinter's getdouble() now supports any numbers (in\nparticular int).\n\n- bpo-22619(39): Added negative limit support in the traceback\nmodule.  Based on patch by Dmitry Kazakov.\n\n- bpo-24094(40): Fix possible crash in json.encode with poorly\nbehaved dict subclasses.\n\n- bpo-9246(41): On POSIX, os.getcwd() now supports paths longer than\n1025 bytes.  Patch written by William Orr.\n\n- bpo-17445(42): add difflib.diffbytes() to support comparison of\nbyte strings (fixes a regression from Python 2).\n\n- bpo-23917(43): Fall back to sequential compilation when\nProcessPoolExecutor doesn't exist.  Patch by Claudiu Popa.\n\n- bpo-23008(44): Fixed resolving attributes with boolean value is\nFalse in pydoc.\n\n- Fix asyncio issue 235: LifoQueue and PriorityQueue's put didn't\nincrement unfinished tasks (this bug was introduced when\nJoinableQueue was merged with Queue).\n\n- bpo-23908(45): os functions now reject paths with embedded null\ncharacter on Windows instead of silently truncating them.\n\n- bpo-23728(46): binascii.crchqx() could return an integer outside\nof the range 0-0xffff for empty data.\n\n- bpo-23887(47): urllib.error.HTTPError now has a proper repr()\nrepresentation.  Patch by Berker Peksag.\n\n- asyncio: New event loop APIs: settaskfactory() and\ngettaskfactory().\n\n- asyncio: async() function is deprecated in favour of\nensurefuture().\n\n- bpo-24178(48): asyncio.Lock, Condition, Semaphore, and\nBoundedSemaphore support new 'async with' syntax.  Contributed by\nYury Selivanov.\n\n- bpo-24179(49): Support 'async for' for asyncio.StreamReader.\nContributed by Yury Selivanov.\n\n- bpo-24184(50): Add AsyncIterator and AsyncIterable ABCs to\ncollections.abc.  Contributed by Yury Selivanov.\n\n- bpo-22547(51): Implement informative repr for\ninspect.BoundArguments.  Contributed by Yury Selivanov.\n\n- bpo-24190(52): Implement inspect.BoundArgument.applydefaults()\nmethod.  Contributed by Yury Selivanov.\n\n- bpo-20691(53): Add 'followwrapped' argument to\ninspect.Signature.fromcallable() and inspect.signature().\nContributed by Yury Selivanov.\n\n- bpo-24248(54): Deprecate inspect.Signature.fromfunction() and\ninspect.Signature.frombuiltin().\n\n- bpo-23898(55): Fix inspect.classifyclassattrs() to support\nattributes with overloaded eq and bool.  Patch by Mike\nBayer.\n\n- bpo-24298(56): Fix inspect.signature() to correctly unwrap wrappers\naround bound methods.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=14373\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=24230\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=22189\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=24244\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=23973\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=23086\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=20035\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=24257\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=15836\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=9858\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=22955\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=22107\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=23780\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=6598\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=24091\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=21931\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=13866\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=20098\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=24211\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=16314\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=21804\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=18682\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=22027\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=23488\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=1322\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=22486\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=24064\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=22681\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=22682\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=23796\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=21795\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=24155\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=21800\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=20274\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=20274\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=24134\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=24018\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=23880\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=22619\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=24094\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=9246\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=17445\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=23917\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=23008\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=23908\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=23728\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=23887\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=24178\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=24179\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=24184\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=22547\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=24190\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=20691\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=24248\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=23898\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=24298\n\nFile: python3.12.info,  Node: IDLE<55>,  Next: Tests<74>,  Prev: Library<87>,  Up: Python 3 5 0 beta 1\n\n1.22.100.3 IDLE\n...............\n\n- bpo-23184(1): remove unused names and imports in idlelib.  Initial\npatch by Al Sweigart.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23184\n\nFile: python3.12.info,  Node: Tests<74>,  Next: Documentation<74>,  Prev: IDLE<55>,  Up: Python 3 5 0 beta 1\n\n1.22.100.4 Tests\n................\n\n- bpo-21520(1): testzipfile no longer fails if the word 'bad'\nappears anywhere in the name of the current directory.\n\n- bpo-9517(2): Move scripthelper into the support package.  Patch by\nChristie Wilson.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=21520\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=9517\n\nFile: python3.12.info,  Node: Documentation<74>,  Next: Tools/Demos<45>,  Prev: Tests<74>,  Up: Python 3 5 0 beta 1\n\n1.22.100.5 Documentation\n........................\n\n- bpo-22155(1): Add File Handlers subsection with createfilehandler\nto tkinter doc.  Remove obsolete example from FAQ. Patch by Martin\nPanter.\n\n- bpo-24029(2): Document the name binding behavior for submodule\nimports.\n\n- bpo-24077(3): Fix typo in man page for -I command option: -s, not",
            "subsections": [
                {
                    "name": "-S",
                    "content": "---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=22155\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=24029\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=24077\n\nFile: python3.12.info,  Node: Tools/Demos<45>,  Prev: Documentation<74>,  Up: Python 3 5 0 beta 1\n\n1.22.100.6 Tools/Demos\n......................\n\n- bpo-24000(1): Improved Argument Clinic's mapping of converters to\nlegacy \"format units\".  Updated the documentation to match.\n\n- bpo-24001(2): Argument Clinic converters now use accept={type}\ninstead of types={'type'} to specify the types the converter\naccepts.\n\n- bpo-23330(3): h2py now supports arbitrary filenames in #include.\n\n- bpo-24031(4): make patchcheck now supports git checkouts, too.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=24000\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=24001\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=23330\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=24031\n",
                    "flag": "-S"
                }
            ]
        },
        "File: python3.12.info,  Node: Python 3 5 0 alpha 4,  Next: Python 3 5 0 alpha 3,  Prev: Python 3 5 0 beta 1,  Up: Changelog": {
            "content": "'Release date: 2015-04-19'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<88>.\n* Library: Library<88>.\n* Build: Build<79>.\n* Tests: Tests<75>.\n* Tools/Demos: Tools/Demos<46>.\n* C API: C API<62>.\n\nFile: python3.12.info,  Node: Core and Builtins<88>,  Next: Library<88>,  Up: Python 3 5 0 alpha 4\n\n1.22.101.1 Core and Builtins\n............................\n\n- bpo-22980(1): Under Linux, GNU/KFreeBSD and the Hurd, C extensions\nnow include the architecture triplet in the extension name, to make\nit easy to test builds for different ABIs in the same working tree.\nUnder OS X, the extension name now includes PEP 3149(2)-style\ninformation.\n\n- bpo-22631(3): Added Linux-specific socket constant\nCANRAWFDFRAMES. Patch courtesy of Joe Jevnik.\n\n- bpo-23731(4): Implement PEP 488(5): removal of .pyo files.\n\n- bpo-23726(6): Don't enable GC for user subclasses of non-GC types\nthat don't add any new fields.  Patch by Eugene Toder.\n\n- bpo-23309(7): Avoid a deadlock at shutdown if a daemon thread is\naborted while it is holding a lock to a buffered I/O object, and\nthe main thread tries to use the same I/O object (typically stdout\nor stderr).  A fatal error is emitted instead.\n\n- bpo-22977(8): Fixed formatting Windows error messages on Wine.\nPatch by Martin Panter.\n\n- bpo-23466(9): %c, %o, %x, and %X in bytes formatting now raise\nTypeError on non-integer input.\n\n- bpo-24044(10): Fix possible null pointer dereference in list.sort\nin out of memory conditions.\n\n- bpo-21354(11): PyCFunctionNew function is exposed by python DLL\nagain.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=22980\n\n(2) https://peps.python.org/pep-3149/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=22631\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=23731\n\n(5) https://peps.python.org/pep-0488/\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=23726\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=23309\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=22977\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=23466\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=24044\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=21354\n\nFile: python3.12.info,  Node: Library<88>,  Next: Build<79>,  Prev: Core and Builtins<88>,  Up: Python 3 5 0 alpha 4\n\n1.22.101.2 Library\n..................\n\n- bpo-23840(1): tokenize.open() now closes the temporary binary file\non error to fix a resource warning.\n\n- bpo-16914(2): new debuglevel 2 in smtplib adds timestamps to debug\noutput.\n\n- bpo-7159(3): urllib.request now supports sending auth credentials\nautomatically after the first 401.  This enhancement is a superset\nof the enhancement from bpo-19494(4) and supersedes that change.\n\n- bpo-23703(5): Fix a regression in urljoin() introduced in\n901e4e52b20a.  Patch by Demian Brecht.\n\n- bpo-4254(6): Adds curses.updatelinescols().  Patch by Arnon\nYaari\n\n- bpo-19933(7): Provide default argument for ndigits in round.  Patch\nby Vajrasky Kok.\n\n- bpo-23193(8): Add a numericowner parameter to\ntarfile.TarFile.extract and tarfile.TarFile.extractall.  Patch by\nMichael Vogt and Eric Smith.\n\n- bpo-23342(9): Add a subprocess.run() function than returns a\nCalledProcess instance for a more consistent API than the existing\ncall* functions.\n\n- bpo-21217(10): inspect.getsourcelines() now tries to compute the\nstart and end lines from the code object, fixing an issue when a\nlambda function is used as decorator argument.  Patch by Thomas\nBallinger and Allison Kaptur.\n\n- bpo-24521(11): Fix possible integer overflows in the pickle module.\n\n- bpo-22931(12): Allow '[' and ']' in cookie values.\n\n- The keywords attribute of functools.partial is now always a\ndictionary.\n\n- bpo-23811(13): Add missing newline to the PyCompileError error\nmessage.  Patch by Alex Shkop.\n\n- bpo-21116(14): Avoid blowing memory when allocating a\nmultiprocessing shared array that's larger than 50% of the\navailable RAM. Patch by Me'de'ric Boquien.\n\n- bpo-22982(15): Improve BOM handling when seeking to multiple\npositions of a writable text file.\n\n- bpo-23464(16): Removed deprecated asyncio JoinableQueue.\n\n- bpo-23529(17): Limit the size of decompressed data when reading\nfrom GzipFile, BZ2File or LZMAFile.  This defeats denial of service\nattacks using compressed bombs (i.e.  compressed payloads which\ndecompress to a huge size).  Patch by Martin Panter and Nikolaus\nRath.\n\n- bpo-21859(18): Added Python implementation of io.FileIO.\n\n- bpo-23865(19): close() methods in multiple modules now are\nidempotent and more robust at shutdown.  If they need to release\nmultiple resources, all are released even if errors occur.\n\n- bpo-23400(20): Raise same exception on both Python 2 and 3 if\nsemopen is not available.  Patch by Davin Potts.\n\n- bpo-10838(21): The subprocess now module includes SubprocessError\nand TimeoutError in its list of exported names for the users wild\nenough to use 'from subprocess import *'.\n\n- bpo-23411(22): Added DefragResult, ParseResult, SplitResult,\nDefragResultBytes, ParseResultBytes, and SplitResultBytes to\nurllib.parse.all.  Patch by Martin Panter.\n\n- bpo-23881(23): urllib.request.ftpwrapper constructor now closes the\nsocket if the FTP connection failed to fix a ResourceWarning.\n\n- bpo-23853(24): *note socket.socket.sendall(): c04. does no more\nreset the socket timeout each time data is sent successfully.  The\nsocket timeout is now the maximum total duration to send all data.\n\n- bpo-22721(25): An order of multiline pprint output of set or dict\ncontaining orderable and non-orderable elements no longer depends\non iteration order of set or dict.\n\n- bpo-15133(26): tkinter.tkapp.getboolean() now supports TclObj and\nalways returns bool.  tkinter.BooleanVar now validates input values\n(accepted bool, int, str, and TclObj).  tkinter.BooleanVar.get()\nnow always returns bool.\n\n- bpo-10590(27): xml.sax.parseString() now supports string argument.\n\n- bpo-23338(28): Fixed formatting ctypes error messages on Cygwin.\nPatch by Makoto Kato.\n\n- bpo-15582(29): inspect.getdoc() now follows inheritance chains.\n\n- bpo-2175(30): SAX parsers now support a character stream of\nInputSource object.\n\n- bpo-16840(31): Tkinter now supports 64-bit integers added in Tcl\n8.4 and arbitrary precision integers added in Tcl 8.5.\n\n- bpo-23834(32): Fix socket.sendto(), use the C Pyssizet type to\nstore the result of sendto() instead of the C int type.\n\n- bpo-23618(33): *note socket.socket.connect(): bff. now waits until\nthe connection completes instead of raising *note InterruptedError:\nbe3. if the connection is interrupted by signals, signal handlers\ndon't raise an exception and the socket is blocking or has a\ntimeout.  *note socket.socket.connect(): bff. still raise *note\nInterruptedError: be3. for non-blocking sockets.\n\n- bpo-21526(34): Tkinter now supports new boolean type in Tcl 8.5.\n\n- bpo-23836(35): Fix the faulthandler module to handle reentrant\ncalls to its signal handlers.\n\n- bpo-23838(36): linecache now clears the cache and returns an empty\nresult on MemoryError.\n\n- bpo-10395(37): Added os.path.commonpath().  Implemented in\nposixpath and ntpath.  Based on patch by Rafik Draoui.\n\n- bpo-23611(38): Serializing more \"lookupable\" objects (such as\nunbound methods or nested classes) now are supported with pickle\nprotocols < 4.\n\n- bpo-13583(39): sqlite3.Row now supports slice indexing.\n\n- bpo-18473(40): Fixed 2to3 and 3to2 compatible pickle mappings.\nFixed ambiguous reverse mappings.  Added many new mappings.  Import\nmapping is no longer applied to modules already mapped with full\nname mapping.\n\n- bpo-23485(41): select.select() is now retried automatically with\nthe recomputed timeout when interrupted by a signal, except if the\nsignal handler raises an exception.  This change is part of the PEP\n475(42).\n\n- bpo-23752(43): When built from an existing file descriptor,\nio.FileIO() now only calls fstat() once.  Before fstat() was called\ntwice, which was not necessary.\n\n- bpo-23704(44): collections.deque() objects now support add,\nmul, and imul().\n\n- bpo-23171(45): csv.Writer.writerow() now supports arbitrary\niterables.\n\n- bpo-23745(46): The new email header parser now handles duplicate\nMIME parameter names without error, similar to how getparam\nbehaves.\n\n- bpo-22117(47): Fix os.utime(), it now rounds the timestamp towards\nminus infinity (-inf) instead of rounding towards zero.\n\n- bpo-23310(48): Fix MagicMock's initializer to work with\nmethods, just like configuremock().  Patch by Kasia Jachim.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23840\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=16914\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=7159\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=19494\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=23703\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=4254\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=19933\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=23193\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=23342\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=21217\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=24521\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=22931\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=23811\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=21116\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=22982\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=23464\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=23529\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=21859\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=23865\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=23400\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=10838\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=23411\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=23881\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=23853\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=22721\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=15133\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=10590\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=23338\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=15582\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=2175\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=16840\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=23834\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=23618\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=21526\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=23836\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=23838\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=10395\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=23611\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=13583\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=18473\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=23485\n\n(42) https://peps.python.org/pep-0475/\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=23752\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=23704\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=23171\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=23745\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=22117\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=23310\n\nFile: python3.12.info,  Node: Build<79>,  Next: Tests<75>,  Prev: Library<88>,  Up: Python 3 5 0 alpha 4\n\n1.22.101.3 Build\n................\n\n- bpo-23817(1): FreeBSD now uses \"1.0\" in the SOVERSION as other\noperating systems, instead of just \"1\".\n\n- bpo-23501(2): Argument Clinic now generates code into separate\nfiles by default.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23817\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=23501\n\nFile: python3.12.info,  Node: Tests<75>,  Next: Tools/Demos<46>,  Prev: Build<79>,  Up: Python 3 5 0 alpha 4\n\n1.22.101.4 Tests\n................\n\n- bpo-23799(1): Added test.support.startthreads() for running and\ncleaning up multiple threads.\n\n- bpo-22390(2): test.regrtest now emits a warning if temporary files\nor directories are left after running a test.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23799\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=22390\n\nFile: python3.12.info,  Node: Tools/Demos<46>,  Next: C API<62>,  Prev: Tests<75>,  Up: Python 3 5 0 alpha 4\n\n1.22.101.5 Tools/Demos\n......................\n\n- bpo-18128(1): pygettext now uses standard +NNNN format in the\nPOT-Creation-Date header.\n\n- bpo-23935(2): Argument Clinic's understanding of format units\naccepting bytes, bytearrays, and buffers is now consistent with\nboth the documentation and the implementation.\n\n- bpo-23944(3): Argument Clinic now wraps long impl prototypes at\ncolumn 78.\n\n- bpo-20586(4): Argument Clinic now ensures that functions without\ndocstrings have signatures.\n\n- bpo-23492(5): Argument Clinic now generates argument parsing code\nwith PyArgParse instead of PyArgParseTuple if possible.\n\n- bpo-23500(6): Argument Clinic is now smarter about generating the\n\"#ifndef\" (empty) definition of the methoddef macro: it's only\ngenerated once, even if Argument Clinic processes the same symbol\nmultiple times, and it's emitted at the end of all processing\nrather than immediately after the first use.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=18128\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=23935\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=23944\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=20586\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=23492\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=23500\n\nFile: python3.12.info,  Node: C API<62>,  Prev: Tools/Demos<46>,  Up: Python 3 5 0 alpha 4\n\n1.22.101.6 C API\n................\n\n- bpo-23998(1): PyImportReInitLock() now checks for lock allocation\nerror\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23998\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 5 0 alpha 3,  Next: Python 3 5 0 alpha 2,  Prev: Python 3 5 0 alpha 4,  Up: Changelog": {
            "content": "'Release date: 2015-03-28'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<89>.\n* Library: Library<89>.\n* Build: Build<80>.\n* Tests: Tests<76>.\n* Tools/Demos: Tools/Demos<47>.\n\nFile: python3.12.info,  Node: Core and Builtins<89>,  Next: Library<89>,  Up: Python 3 5 0 alpha 3\n\n1.22.102.1 Core and Builtins\n............................\n\n- bpo-23573(1): Increased performance of string search operations\n(str.find, str.index, str.count, the in operator, str.split,\nstr.partition) with arguments of different kinds (UCS1, UCS2,\nUCS4).\n\n- bpo-23753(2): Python doesn't support anymore platforms without\nstat() or fstat(), these functions are always required.\n\n- bpo-23681(3): The -b option now affects comparisons of bytes with\nint.\n\n- bpo-23632(4): Memoryviews now allow tuple indexing (including for\nmulti-dimensional memoryviews).\n\n- bpo-23192(5): Fixed generator lambdas.  Patch by Bruno Cauet.\n\n- bpo-23629(6): Fix the default sizeof implementation for\nvariable-sized objects.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23573\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=23753\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=23681\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=23632\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=23192\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=23629\n\nFile: python3.12.info,  Node: Library<89>,  Next: Build<80>,  Prev: Core and Builtins<89>,  Up: Python 3 5 0 alpha 3\n\n1.22.102.2 Library\n..................\n\n- bpo-14260(1): The groupindex attribute of regular expression\npattern object now is non-modifiable mapping.\n\n- bpo-23792(2): Ignore KeyboardInterrupt when the pydoc pager is\nactive.  This mimics the behavior of the standard unix pagers, and\nprevents pipepager from shutting down while the pager itself is\nstill running.\n\n- bpo-23775(3): pprint() of OrderedDict now outputs the same\nrepresentation as repr().\n\n- bpo-23765(4): Removed IsBadStringPtr calls in ctypes\n\n- bpo-22364(5): Improved some re error messages using regex for\nhints.\n\n- bpo-23742(6): ntpath.expandvars() no longer loses unbalanced single\nquotes.\n\n- bpo-21717(7): The zipfile.ZipFile.open function now supports 'x'\n(exclusive creation) mode.\n\n- bpo-21802(8): The reader in BufferedRWPair now is closed even when\nclosing writer failed in BufferedRWPair.close().\n\n- bpo-23622(9): Unknown escapes in regular expressions that consist\nof ''\\'' and ASCII letter now raise a deprecation warning and will\nbe forbidden in Python 3.6.\n\n- bpo-23671(10): string.Template now allows specifying the \"self\"\nparameter as a keyword argument.  string.Formatter now allows\nspecifying the \"self\" and the \"formatstring\" parameters as keyword\narguments.\n\n- bpo-23502(11): The pprint module now supports mapping proxies.\n\n- bpo-17530(12): pprint now wraps long bytes objects and bytearrays.\n\n- bpo-22687(13): Fixed some corner cases in breaking words in\ntetxtwrap.  Got rid of quadratic complexity in breaking long words.\n\n- bpo-4727(14): The copy module now uses pickle protocol 4 (PEP 3154)\nand supports copying of instances of classes whose new method\ntakes keyword-only arguments.\n\n- bpo-23491(15): Added a zipapp module to support creating executable\nzip file archives of Python code.  Registered \".pyz\" and \".pyzw\"\nextensions on Windows for these archives (PEP 441).\n\n- bpo-23657(16): Avoid explicit checks for str in zipapp, adding\nsupport for pathlib.Path objects as arguments.\n\n- bpo-23688(17): Added support of arbitrary bytes-like objects and\navoided unnecessary copying of memoryview in gzip.GzipFile.write().\nOriginal patch by Wolfgang Maier.\n\n- bpo-23252(18): Added support for writing ZIP files to unseekable\nstreams.\n\n- bpo-23647(19): Increase imaplib's MAXLINE to accommodate modern\nmailbox sizes.\n\n- bpo-23539(20): If body is None, http.client.HTTPConnection.request\nnow sets Content-Length to 0 for PUT, POST, and PATCH headers to\navoid 411 errors from some web servers.\n\n- bpo-22351(21): The nntplib.NNTP constructor no longer leaves the\nconnection and socket open until the garbage collector cleans them\nup.  Patch by Martin Panter.\n\n- bpo-23704(22): collections.deque() objects now support methods for\nindex(), insert(), and copy().  This allows deques to be registered\nas a MutableSequence and it improves their substitutability for\nlists.\n\n- bpo-23715(23): *note signal.sigwaitinfo(): c07. and *note\nsignal.sigtimedwait(): c06. are now retried when interrupted by a\nsignal not in the 'sigset' parameter, if the signal handler does\nnot raise an exception.  signal.sigtimedwait() recomputes the\ntimeout with a monotonic clock when it is retried.\n\n- bpo-23001(24): Few functions in modules mmap, ossaudiodev, socket,\nssl, and codecs, that accepted only read-only bytes-like object now\naccept writable bytes-like object too.\n\n- bpo-23646(25): If time.sleep() is interrupted by a signal, the\nsleep is now retried with the recomputed delay, except if the\nsignal handler raises an exception (PEP 475).\n\n- bpo-23136(26): strptime now uniformly handles all days in week 0,\nincluding Dec 30 of previous year.  Based on patch by Jim Carroll.\n\n- bpo-23700(27): Iterator of NamedTemporaryFile now keeps a reference\nto NamedTemporaryFile instance.  Patch by Bohuslav Kabrda.\n\n- bpo-22903(28): The fake test case created by unittest.loader when\nit fails importing a test module is now picklable.\n\n- bpo-22181(29): On Linux, os.urandom() now uses the new getrandom()\nsyscall if available, syscall introduced in the Linux kernel 3.17.\nIt is more reliable and more secure, because it avoids the need of\na file descriptor and waits until the kernel has enough entropy.\n\n- bpo-2211(30): Updated the implementation of the http.cookies.Morsel\nclass.  Setting attributes key, value and codedvalue directly now\nis deprecated.  update() and setdefault() now transform and check\nkeys.  Comparing for equality now takes into account attributes\nkey, value and codedvalue.  copy() now returns a Morsel, not a\ndict.  repr() now contains all attributes.  Optimized checking keys\nand quoting values.  Added new tests.  Original patch by Demian\nBrecht.\n\n- bpo-18983(31): Allow selection of output units in timeit.  Patch by\nJulian Gindi.\n\n- bpo-23631(32): Fix traceback.formatlist when a traceback has been\nmutated.\n\n- bpo-23568(33): Add rdivmod support to MagicMock() objects.  Patch\nby H??kan Lo\"vdahl.\n\n- bpo-2052(34): Add charset parameter to HtmlDiff.makefile().\n\n- bpo-23668(35): Support os.truncate and os.ftruncate on Windows.\n\n- bpo-23138(36): Fixed parsing cookies with absent keys or values in\ncookiejar.  Patch by Demian Brecht.\n\n- bpo-23051(37): multiprocessing.Pool methods imap() and\nimapunordered() now handle exceptions raised by an iterator.\nPatch by Alon Diamant and Davin Potts.\n\n- bpo-23581(38): Add matmul support to MagicMock.  Patch by H??kan\nLo\"vdahl.\n\n- bpo-23566(39): enable(), register(), dumptraceback() and\ndumptracebacklater() functions of faulthandler now accept file\ndescriptors.  Patch by Wei Wu.\n\n- bpo-22928(40): Disabled HTTP header injections in http.client.\nOriginal patch by Demian Brecht.\n\n- bpo-23615(41): Modules bz2, tarfile and tokenize now can be\nreloaded with imp.reload().  Patch by Thomas Kluyver.\n\n- bpo-23605(42): os.walk() now calls os.scandir() instead of\nos.listdir().  The usage of os.scandir() reduces the number of\ncalls to os.stat().  Initial patch written by Ben Hoyt.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=14260\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=23792\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=23775\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=23765\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=22364\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=23742\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=21717\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=21802\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=23622\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=23671\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=23502\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=17530\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=22687\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=4727\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=23491\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=23657\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=23688\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=23252\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=23647\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=23539\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=22351\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=23704\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=23715\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=23001\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=23646\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=23136\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=23700\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=22903\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=22181\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=2211\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=18983\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=23631\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=23568\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=2052\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=23668\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=23138\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=23051\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=23581\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=23566\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=22928\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=23615\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=23605\n\nFile: python3.12.info,  Node: Build<80>,  Next: Tests<76>,  Prev: Library<89>,  Up: Python 3 5 0 alpha 3\n\n1.22.102.3 Build\n................\n\n- bpo-23585(1): make patchcheck will ensure the interpreter is built.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23585\n\nFile: python3.12.info,  Node: Tests<76>,  Next: Tools/Demos<47>,  Prev: Build<80>,  Up: Python 3 5 0 alpha 3\n\n1.22.102.4 Tests\n................\n\n- bpo-23583(1): Added tests for standard IO streams in IDLE.\n\n- bpo-22289(2): Prevent testurllib2net failures due to ftp\nconnection timeout.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23583\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=22289\n\nFile: python3.12.info,  Node: Tools/Demos<47>,  Prev: Tests<76>,  Up: Python 3 5 0 alpha 3\n\n1.22.102.5 Tools/Demos\n......................\n\n- bpo-22826(1): The result of open() in Tools/freeze/bkfile.py is now\nbetter compatible with regular files (in particular it now supports\nthe context management protocol).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=22826\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 5 0 alpha 2,  Next: Python 3 5 0 alpha 1,  Prev: Python 3 5 0 alpha 3,  Up: Changelog": {
            "content": "'Release date: 2015-03-09'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<90>.\n* Library: Library<90>.\n* Build: Build<81>.\n* C API: C API<63>.\n* Windows: Windows<69>.\n\nFile: python3.12.info,  Node: Core and Builtins<90>,  Next: Library<90>,  Up: Python 3 5 0 alpha 2\n\n1.22.103.1 Core and Builtins\n............................\n\n- bpo-23571(1): PyObjectCall() and PyCFunctionCall() now raise a\nSystemError if a function returns a result and raises an exception.\nThe SystemError is chained to the previous exception.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23571\n\nFile: python3.12.info,  Node: Library<90>,  Next: Build<81>,  Prev: Core and Builtins<90>,  Up: Python 3 5 0 alpha 2\n\n1.22.103.2 Library\n..................\n\n- bpo-22524(1): New os.scandir() function, part of the PEP 471(2):\n\"os.scandir() function - a better and faster directory iterator\".\nPatch written by Ben Hoyt.\n\n- bpo-23103(3): Reduced the memory consumption of IPv4Address and\nIPv6Address.\n\n- bpo-21793(4): BaseHTTPRequestHandler again logs response code as\nnumeric, not as stringified enum.  Patch by Demian Brecht.\n\n- bpo-23476(5): In the ssl module, enable OpenSSL's\nX509VFLAGTRUSTEDFIRST flag on certificate stores when it is\navailable.\n\n- bpo-23576(6): Avoid stalling in SSL reads when EOF has been reached\nin the SSL layer but the underlying connection hasn't been closed.\n\n- bpo-23504(7): Added an all to the types module.\n\n- bpo-23563(8): Optimized utility functions in urllib.parse.\n\n- bpo-7830(9): Flatten nested functools.partial.\n\n- bpo-20204(10): Added the module attribute to tkinter classes.\n\n- bpo-19980(11): Improved help() for non-recognized strings.\nhelp('') now shows the help on str.  help('help') now shows the\nhelp on help().  Original patch by Mark Lawrence.\n\n- bpo-23521(12): Corrected pure python implementation of timedelta\ndivision.  Eliminated OverflowError from 'timedelta * float' for\nsome floats; Corrected rounding in timedelta true division.\n\n- bpo-21619(13): Popen objects no longer leave a zombie after exit in\nthe with statement if the pipe was broken.  Patch by Martin Panter.\n\n- bpo-22936(14): Make it possible to show local variables in\ntracebacks for both the traceback module and unittest.\n\n- bpo-15955(15): Add an option to limit the output size in\nbz2.decompress().  Patch by Nikolaus Rath.\n\n- bpo-6639(16): Module-level turtle functions no longer raise\nTclError after closing the window.\n\n- bpo-814253(17): Group references and conditional group references\nnow work in lookbehind assertions in regular expressions.  (See\nalso: bpo-9179(18))\n\n- bpo-23215(19): Multibyte codecs with custom error handlers that\nignores errors consumed too much memory and raised SystemError or\nMemoryError.  Original patch by Aleksi Torhamo.\n\n- bpo-5700(20): io.FileIO() called flush() after closing the file.\nflush() was not called in close() if closefd=False.\n\n- bpo-23374(21): Fixed pydoc failure with non-ASCII files when stdout\nencoding differs from file system encoding (e.g.  on Mac OS).\n\n- bpo-23481(22): Remove RC4 from the SSL module's default cipher\nlist.\n\n- bpo-21548(23): Fix pydoc.synopsis() and pydoc.apropos() on modules\nwith empty docstrings.\n\n- bpo-22885(24): Fixed arbitrary code execution vulnerability in the\ndbm.dumb module.  Original patch by Claudiu Popa.\n\n- bpo-23239(25): ssl.matchhostname() now supports matching of IP\naddresses.\n\n- bpo-23146(26): Fix mishandling of absolute Windows paths with\nforward slashes in pathlib.\n\n- bpo-23096(27): Pickle representation of floats with protocol 0 now\nis the same for both Python and C implementations.\n\n- bpo-19105(28): pprint now more efficiently uses free space at the\nright.\n\n- bpo-14910(29): Add allowabbrev parameter to\nargparse.ArgumentParser.  Patch by Jonathan Paugh, Steven Bethard,\npaul j3 and Daniel Eriksson.\n\n- bpo-21717(30): tarfile.open() now supports 'x' (exclusive creation)\nmode.\n\n- bpo-23344(31): marshal.dumps() is now 20-25% faster on average.\n\n- bpo-20416(32): marshal.dumps() with protocols 3 and 4 is now 40-50%\nfaster on average.\n\n- bpo-23421(33): Fixed compression in tarfile CLI. Patch by wdv4758h.\n\n- bpo-23367(34): Fix possible overflows in the unicodedata module.\n\n- bpo-23361(35): Fix possible overflow in Windows subprocess creation\ncode.\n\n- logging.handlers.QueueListener now takes a respecthandlerlevel\nkeyword argument which, if set to True, will pass messages to\nhandlers taking handler levels into account.\n\n- bpo-19705(36): turtledemo now has a visual sorting algorithm demo.\nOriginal patch from Jason Yeo.\n\n- bpo-23801(37): Fix issue where cgi.FieldStorage did not always\nignore the entire preamble to a multipart body.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=22524\n\n(2) https://peps.python.org/pep-0471/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=23103\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=21793\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=23476\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=23576\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=23504\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=23563\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=7830\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=20204\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=19980\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=23521\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=21619\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=22936\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=15955\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=6639\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=814253\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=9179\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=23215\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=5700\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=23374\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=23481\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=21548\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=22885\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=23239\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=23146\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=23096\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=19105\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=14910\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=21717\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=23344\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=20416\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=23421\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=23367\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=23361\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=19705\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=23801\n\nFile: python3.12.info,  Node: Build<81>,  Next: C API<63>,  Prev: Library<90>,  Up: Python 3 5 0 alpha 2\n\n1.22.103.3 Build\n................\n\n- bpo-23445(1): pydebug builds now use \"gcc -Og\" where possible, to\nmake the resulting executable faster.\n\n- bpo-23686(2): Update OS X 10.5 installer build to use OpenSSL\n1.0.2a.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23445\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=23686\n\nFile: python3.12.info,  Node: C API<63>,  Next: Windows<69>,  Prev: Build<81>,  Up: Python 3 5 0 alpha 2\n\n1.22.103.4 C API\n................\n\n- bpo-20204(1): Deprecation warning is now raised for builtin types\nwithout the module attribute.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=20204\n\nFile: python3.12.info,  Node: Windows<69>,  Prev: C API<63>,  Up: Python 3 5 0 alpha 2\n\n1.22.103.5 Windows\n..................\n\n- bpo-23465(1): Implement PEP 486(2) - Make the Python Launcher aware\nof virtual environments.  Patch by Paul Moore.\n\n- bpo-23437(3): Make user scripts directory versioned on Windows.\nPatch by Paul Moore.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23465\n\n(2) https://peps.python.org/pep-0486/\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=23437\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python 3 5 0 alpha 1,  Prev: Python 3 5 0 alpha 2,  Up: Changelog": {
            "content": "'Release date: 2015-02-08'\n\n* Menu:\n\n* Core and Builtins: Core and Builtins<91>.\n* Library: Library<91>.\n* IDLE: IDLE<56>.\n* Build: Build<82>.\n* C API: C API<64>.\n* Documentation: Documentation<75>.\n* Tests: Tests<77>.\n* Tools/Demos: Tools/Demos<48>.\n* Windows: Windows<70>.\n\nFile: python3.12.info,  Node: Core and Builtins<91>,  Next: Library<91>,  Up: Python 3 5 0 alpha 1\n\n1.22.104.1 Core and Builtins\n............................\n\n- bpo-23285(1): PEP 475 - EINTR handling.\n\n- bpo-22735(2): Fix many edge cases (including crashes) involving\ncustom mro() implementations.\n\n- bpo-22896(3): Avoid using PyObjectAsCharBuffer(),\nPyObjectAsReadBuffer() and PyObjectAsWriteBuffer().\n\n- bpo-21295(4): Revert some changes (bpo-16795(5)) to AST line\nnumbers and column offsets that constituted a regression.\n\n- bpo-22986(6): Allow changing an object's class between a\ndynamic type and static type in some cases.\n\n- bpo-15859(7): PyUnicodeEncodeFSDefault(), PyUnicodeEncodeMBCS()\nand PyUnicodeEncodeCodePage() now raise an exception if the object\nis not a Unicode object.  For PyUnicodeEncodeFSDefault(), it was\nalready the case on platforms other than Windows.  Patch written by\nCampbell Barton.\n\n- bpo-21408(8): The default ne() now returns NotImplemented if\neq() returned NotImplemented.  Original patch by Martin Panter.\n\n- bpo-23321(9): Fixed a crash in str.decode() when error handler\nreturned replacement string longer than malformed input data.\n\n- bpo-22286(10): The \"backslashreplace\" error handlers now works with\ndecoding and translating.\n\n- bpo-23253(11): Delay-load ShellExecute[AW] in os.startfile for\nreduced startup overhead on Windows.\n\n- bpo-22038(12): pyatomic.h now uses stdatomic.h or GCC built-in\nfunctions for atomic memory access if available.  Patch written by\nVitor de Lima and Gustavo Temple.\n\n- bpo-20284(13): %-interpolation (aka printf) formatting added for\nbytes and bytearray.\n\n- bpo-23048(14): Fix jumping out of an infinite while loop in the\npdb.\n\n- bpo-20335(15): bytes constructor now raises TypeError when encoding\nor errors is specified with non-string argument.  Based on patch by\nRenaud Blanch.\n\n- bpo-22834(16): If the current working directory ends up being set\nto a non-existent directory then import will no longer raise\nFileNotFoundError.\n\n- bpo-22869(17): Move the interpreter startup & shutdown code to a\nnew dedicated pylifecycle.c module\n\n- bpo-22847(18): Improve method cache efficiency.\n\n- bpo-22335(19): Fix crash when trying to enlarge a bytearray to\n0x7fffffff bytes on a 32-bit platform.\n\n- bpo-22653(20): Fix an assertion failure in debug mode when doing a\nreentrant dict insertion in debug mode.\n\n- bpo-22643(21): Fix integer overflow in Unicode case operations\n(upper, lower, title, swapcase, casefold).\n\n- bpo-17636(22): Circular imports involving relative imports are now\nsupported.\n\n- bpo-22604(23): Fix assertion error in debug mode when dividing a\ncomplex number by (nan+0j).\n\n- bpo-21052(24): Do not raise ImportWarning when sys.pathhooks or\nsys.metapath are set to None.\n\n- bpo-16518(25): Use 'bytes-like object required' in error messages\nthat previously used the far more cryptic \"'x' does not support the\nbuffer protocol.\n\n- bpo-22470(26): Fixed integer overflow issues in \"backslashreplace\",\n\"xmlcharrefreplace\", and \"surrogatepass\" error handlers.\n\n- bpo-22540(27): speed up 'PyObjectIsInstance' and\n'PyObjectIsSubclass' in the common case that the second argument\nhas metaclass 'type'.\n\n- bpo-18711(28): Add a new 'PyErrFormatV' function, similar to\n'PyErrFormat' but accepting a 'valist' argument.\n\n- bpo-22520(29): Fix overflow checking when generating the repr of a\nunicode object.\n\n- bpo-22519(30): Fix overflow checking in PyBytesRepr.\n\n- bpo-22518(31): Fix integer overflow issues in latin-1 encoding.\n\n- bpo-16324(32): charset parameter of MIMEText now also accepts\nemail.charset.Charset instances.  Initial patch by Claude Paroz.\n\n- bpo-1764286(33): Fix inspect.getsource() to support decorated\nfunctions.  Patch by Claudiu Popa.\n\n- bpo-18554(34): os.all includes posix functions.\n\n- bpo-21391(35): Use os.path.abspath in the shutil module.\n\n- bpo-11471(36): avoid generating a JUMPFORWARD instruction at the\nend of an if-block if there is no else-clause.  Original patch by\nEugene Toder.\n\n- bpo-22215(37): Now ValueError is raised instead of TypeError when\nstr or bytes argument contains not permitted null character or\nbyte.\n\n- bpo-22258(38): Fix the internal function setinheritable() on\nIllumos.  This platform exposes the function 'ioctl(FIOCLEX)', but\ncalling it fails with errno is ENOTTY: \"Inappropriate ioctl for\ndevice\".  setinheritable() now falls back to the slower 'fcntl()'\n('FGETFD' and then 'FSETFD').\n\n- bpo-21389(39): Displaying the qualname of the underlying\nfunction in the repr of a bound method.\n\n- bpo-22206(40): Using pthread, PyThreadcreatekey() now sets errno\nto ENOMEM and returns -1 (error) on integer overflow.\n\n- bpo-20184(41): Argument Clinic based signature introspection added\nfor 30 of the builtin functions.\n\n- bpo-22116(42): C functions and methods (of the\n'builtinfunctionormethod' type) can now be weakref'ed.  Patch by\nWei Wu.\n\n- bpo-22077(43): Improve index error messages for bytearrays, bytes,\nlists, and tuples by adding 'or slices'.  Added ', not <typename>'\nfor bytearrays.  Original patch by Claudiu Popa.\n\n- bpo-20179(44): Apply Argument Clinic to bytes and bytearray.  Patch\nby Tal Einat.\n\n- bpo-22082(45): Clear interned strings in slotdefs.\n\n- Upgrade Unicode database to Unicode 7.0.0.\n\n- bpo-21897(46): Fix a crash with the flocals attribute with closure\nvariables when frame.clear() has been called.\n\n- bpo-21205(47): Add a new 'qualname' attribute to generator, the\nqualified name, and use it in the representation of a generator\n('repr(gen)').  The default name of the generator ('name'\nattribute) is now get from the function instead of the code.  Use\n'gen.gicode.coname' to get the name of the code.\n\n- bpo-21669(48): With the aid of heuristics in SyntaxError.init,\nthe parser now attempts to generate more meaningful (or at least\nmore search engine friendly) error messages when \"exec\" and \"print\"\nare used as statements.\n\n- bpo-21642(49): In the conditional if-else expression, allow an\ninteger written with no space between itself and the 'else' keyword\n(e.g.  'True if 42else False') to be valid syntax.\n\n- bpo-21523(50): Fix over-pessimistic computation of the stack effect\nof some opcodes in the compiler.  This also fixes a quadratic\ncompilation time issue noticeable when compiling code with a large\nnumber of \"and\" and \"or\" operators.\n\n- bpo-21418(51): Fix a crash in the builtin function super() when\ncalled without argument and without current frame (ex: embedded\nPython).\n\n- bpo-21425(52): Fix flushing of standard streams in the interactive\ninterpreter.\n\n- bpo-21435(53): In rare cases, when running finalizers on objects in\ncyclic trash a bad pointer dereference could occur due to a subtle\nflaw in internal iteration logic.\n\n- bpo-21377(54): PyBytesConcat() now tries to concatenate in-place\nwhen the first argument has a reference count of 1.  Patch by\nNikolaus Rath.\n\n- bpo-20355(55): -W command line options now have higher priority\nthan the PYTHONWARNINGS environment variable.  Patch by Arfrever.\n\n- bpo-21274(56): Define PATHMAX for GNU/Hurd in Python/pythonrun.c.\n\n- bpo-20904(57): Support setting FPU precision on m68k.\n\n- bpo-21209(58): Fix sending tuples to custom generator objects with\nthe yield from syntax.\n\n- bpo-21193(59): pow(a, b, c) now raises ValueError rather than\nTypeError when b is negative.  Patch by Josh Rosenberg.\n\n- bpo-21176(60): PEP 465: Add the '@' operator for matrix\nmultiplication.\n\n- bpo-21134(61): Fix segfault when str is called on an uninitialized\nUnicodeEncodeError, UnicodeDecodeError, or UnicodeTranslateError\nobject.\n\n- bpo-19537(62): Fix PyUnicodeDATA() alignment under m68k.  Patch by\nAndreas Schwab.\n\n- bpo-20929(63): Add a type cast to avoid shifting a negative number.\n\n- bpo-20731(64): Properly position in source code files even if they\nare opened in text mode.  Patch by Serhiy Storchaka.\n\n- bpo-20637(65): Key-sharing now also works for instance dictionaries\nof subclasses.  Patch by Peter Ingebretson.\n\n- bpo-8297(66): Attributes missing from modules now include the\nmodule name in the error text.  Original patch by ysj.ray.\n\n- bpo-19995(67): %c, %o, %x, and %X now raise TypeError on\nnon-integer input.\n\n- bpo-19655(68): The ASDL parser - used by the build process to\ngenerate code for managing the Python AST in C - was rewritten.\nThe new parser is self contained and does not require to carry long\nthe spark.py parser-generator library; spark.py was removed from\nthe source base.\n\n- bpo-12546(69): Allow '\\x00' to be used as a fill character when\nusing str, int, float, and complex format methods.\n\n- bpo-20480(70): Add ipaddress.reversepointer.  Patch by Leon Weber.\n\n- bpo-13598(71): Modify string.Formatter to support auto-numbering of\nreplacement fields.  It now matches the behavior of str.format() in\nthis regard.  Patches by Phil Elson and Ramchandra Apte.\n\n- bpo-8931(72): Make alternate formatting ('#') for type 'c' raise an\nexception.  In versions prior to 3.5, '#' with 'c' had no effect.\nNow specifying it is an error.  Patch by Torsten Landschoff.\n\n- bpo-23165(73): Perform overflow checks before allocating memory in\nthe Pychar2wchar function.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23285\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=22735\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=22896\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=21295\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=16795\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=22986\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=15859\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=21408\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=23321\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=22286\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=23253\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=22038\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=20284\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=23048\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=20335\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=22834\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=22869\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=22847\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=22335\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=22653\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=22643\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=17636\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=22604\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=21052\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=16518\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=22470\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=22540\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=18711\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=22520\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=22519\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=22518\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=16324\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=1764286\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=18554\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=21391\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=11471\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=22215\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=22258\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=21389\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=22206\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=20184\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=22116\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=22077\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=20179\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=22082\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=21897\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=21205\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=21669\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=21642\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=21523\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=21418\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=21425\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=21435\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=21377\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=20355\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=21274\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=20904\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=21209\n\n(59) https://bugs.python.org/issue?@action=redirect&bpo=21193\n\n(60) https://bugs.python.org/issue?@action=redirect&bpo=21176\n\n(61) https://bugs.python.org/issue?@action=redirect&bpo=21134\n\n(62) https://bugs.python.org/issue?@action=redirect&bpo=19537\n\n(63) https://bugs.python.org/issue?@action=redirect&bpo=20929\n\n(64) https://bugs.python.org/issue?@action=redirect&bpo=20731\n\n(65) https://bugs.python.org/issue?@action=redirect&bpo=20637\n\n(66) https://bugs.python.org/issue?@action=redirect&bpo=8297\n\n(67) https://bugs.python.org/issue?@action=redirect&bpo=19995\n\n(68) https://bugs.python.org/issue?@action=redirect&bpo=19655\n\n(69) https://bugs.python.org/issue?@action=redirect&bpo=12546\n\n(70) https://bugs.python.org/issue?@action=redirect&bpo=20480\n\n(71) https://bugs.python.org/issue?@action=redirect&bpo=13598\n\n(72) https://bugs.python.org/issue?@action=redirect&bpo=8931\n\n(73) https://bugs.python.org/issue?@action=redirect&bpo=23165\n\nFile: python3.12.info,  Node: Library<91>,  Next: IDLE<56>,  Prev: Core and Builtins<91>,  Up: Python 3 5 0 alpha 1\n\n1.22.104.2 Library\n..................\n\n- bpo-23399(1): pyvenv creates relative symlinks where possible.\n\n- bpo-20289(2): cgi.FieldStorage() now supports the context\nmanagement protocol.\n\n- bpo-13128(3): Print response headers for CONNECT requests when\ndebuglevel > 0.  Patch by Demian Brecht.\n\n- bpo-15381(4): Optimized io.BytesIO to make less allocations and\ncopyings.\n\n- bpo-22818(5): Splitting on a pattern that could match an empty\nstring now raises a warning.  Patterns that can only match empty\nstrings are now rejected.\n\n- bpo-23099(6): Closing io.BytesIO with exported buffer is rejected\nnow to prevent corrupting exported buffer.\n\n- bpo-23326(7): Removed ne implementations.  Since fixing default\nne implementation in bpo-21408(8) they are redundant.\n\n- bpo-23363(9): Fix possible overflow in itertools.permutations.\n\n- bpo-23364(10): Fix possible overflow in itertools.product.\n\n- bpo-23366(11): Fixed possible integer overflow in\nitertools.combinations.\n\n- bpo-23369(12): Fixed possible integer overflow in\njson.encodebasestringascii.\n\n- bpo-23353(13): Fix the exception handling of generators in\nPyEvalEvalFrameEx().  At entry, save or swap the exception state\neven if PyEvalEvalFrameEx() is called with throwflag=0.  At exit,\nthe exception state is now always restored or swapped, not only if\nwhy is WHYYIELD or WHYRETURN. Patch co-written with Antoine\nPitrou.\n\n- bpo-14099(14): Restored support of writing ZIP files to tellable\nbut non-seekable streams.\n\n- bpo-14099(15): Writing to ZipFile and reading multiple ZipExtFiles\nis threadsafe now.\n\n- bpo-19361(16): JSON decoder now raises JSONDecodeError instead of\nValueError.\n\n- bpo-18518(17): timeit now rejects statements which can't be\ncompiled outside a function or a loop (e.g.  \"return\" or \"break\").\n\n- bpo-23094(18): Fixed readline with frames in Python implementation\nof pickle.\n\n- bpo-23268(19): Fixed bugs in the comparison of ipaddress classes.\n\n- bpo-21408(20): Removed incorrect implementations of ne() which\ndidn't returned NotImplemented if eq() returned NotImplemented.\nThe default ne() now works correctly.\n\n- bpo-19996(21): 'email.feedparser.FeedParser' now handles\n(malformed) headers with no key rather than assuming the body has\nstarted.\n\n- bpo-20188(22): Support Application-Layer Protocol Negotiation\n(ALPN) in the ssl module.\n\n- bpo-23133(23): Pickling of ipaddress objects now produces more\ncompact and portable representation.\n\n- bpo-23248(24): Update ssl error codes from latest OpenSSL git\nmaster.\n\n- bpo-23266(25): Much faster implementation of\nipaddress.collapseaddresses() when there are many non-consecutive\naddresses.\n\n- bpo-23098(26): 64-bit devt is now supported in the os module.\n\n- bpo-21817(27): When an exception is raised in a task submitted to a\nProcessPoolExecutor, the remote traceback is now displayed in the\nparent process.  Patch by Claudiu Popa.\n\n- bpo-15955(28): Add an option to limit output size when\ndecompressing LZMA data.  Patch by Nikolaus Rath and Martin Panter.\n\n- bpo-23250(29): In the http.cookies module, capitalize \"HttpOnly\"\nand \"Secure\" as they are written in the standard.\n\n- bpo-23063(30): In the distutils' check command, fix parsing of reST\nwith code or code-block directives.\n\n- bpo-23209(31): selectors.BaseSelector.getkey() now raises a\nRuntimeError if the selector is closed.  And\nselectors.BaseSelector.close() now clears its internal reference to\nthe selector mapping to break a reference cycle.  Initial patch\nwritten by Martin Richard.  (See also: bpo-23225(32))\n\n- bpo-17911(33): Provide a way to seed the linecache for a PEP-302\nmodule without actually loading the code.\n\n- bpo-17911(34): Provide a new object API for traceback, including\nthe ability to not lookup lines at all until the traceback is\nactually rendered, without any trace of the original objects being\nkept alive.\n\n- bpo-19777(35): Provide a home() classmethod on Path objects.\nContributed by Victor Salgado and Mayank Tripathi.\n\n- bpo-23206(36): Make 'json.dumps(..., ensureascii=False)' as fast\nas the default case of 'ensureascii=True'.  Patch by Naoki Inada.\n\n- bpo-23185(37): Add math.inf and math.nan constants.\n\n- bpo-23186(38): Add ssl.SSLObject.sharedciphers() and\nssl.SSLSocket.sharedciphers() to fetch the client's list ciphers\nsent at handshake.\n\n- bpo-23143(39): Remove compatibility with OpenSSLs older than 0.9.8.\n\n- bpo-23132(40): Improve performance and introspection support of\ncomparison methods created by functool.totalordering.\n\n- bpo-19776(41): Add an expanduser() method on Path objects.\n\n- bpo-23112(42): Fix SimpleHTTPServer to correctly carry the query\nstring and fragment when it redirects to add a trailing slash.\n\n- bpo-21793(43): Added http.HTTPStatus enums (i.e.  HTTPStatus.OK,\nHTTPStatus.NOTFOUND). Patch by Demian Brecht.\n\n- bpo-23093(44): In the io, module allow more operations to work on\ndetached streams.\n\n- bpo-23111(45): In the ftplib, make ssl.PROTOCOLSSLv23 the default\nprotocol version.\n\n- bpo-22585(46): On OpenBSD 5.6 and newer, os.urandom() now calls\ngetentropy(), instead of reading /dev/urandom, to get pseudo-random\nbytes.\n\n- bpo-19104(47): pprint now produces evaluable output for wrapped\nstrings.\n\n- bpo-23071(48): Added missing names to codecs.all.  Patch by\nMartin Panter.\n\n- bpo-22783(49): Pickling now uses the NEWOBJ opcode instead of the\nNEWOBJEX opcode if possible.\n\n- bpo-15513(50): Added a sizeof implementation for pickle\nclasses.\n\n- bpo-19858(51): pickletools.optimize() now aware of the MEMOIZE\nopcode, can produce more compact result and no longer produces\ninvalid output if input data contains MEMOIZE opcodes together with\nPUT or BINPUT opcodes.\n\n- bpo-22095(52): Fixed HTTPConnection.settunnel with default port.\nThe port value in the host header was set to \"None\".  Patch by\nDemian Brecht.\n\n- bpo-23016(53): A warning no longer produces an AttributeError when\nthe program is run with pythonw.exe.\n\n- bpo-21775(54): shutil.copytree(): fix crash when copying to VFAT.\nAn exception handler assumed that OSError objects always have a\n'winerror' attribute.  That is not the case, so the exception\nhandler itself raised AttributeError when run on Linux (and,\npresumably, any other non-Windows OS). Patch by Greg Ward.\n\n- bpo-1218234(55): Fix inspect.getsource() to load updated source of\nreloaded module.  Initial patch by Berker Peksag.\n\n- bpo-21740(56): Support wrapped callables in doctest.  Patch by\nClaudiu Popa.\n\n- bpo-23009(57): Make sure selectors.EpollSelector.select() works\nwhen no FD is registered.\n\n- bpo-22959(58): In the constructor of http.client.HTTPSConnection,\nprefer the context's checkhostname attribute over the\n'checkhostname' parameter.\n\n- bpo-22696(59): Add function *note sys.isfinalizing(): 8c0. to know\nabout interpreter shutdown.\n\n- bpo-16043(60): Add a default limit for the amount of data\nxmlrpclib.gzipdecode will return.  This resolves CVE-2013-1753.\n\n- bpo-14099(61): ZipFile.open() no longer reopen the underlying file.\nObjects returned by ZipFile.open() can now operate independently of\nthe ZipFile even if the ZipFile was created by passing in a\nfile-like object as the first argument to the constructor.\n\n- bpo-22966(62): Fix pycache pyc file name clobber when\npyccompile is asked to compile a source file containing multiple\ndots in the source file name.\n\n- bpo-21971(63): Update turtledemo doc and add module to the index.\n\n- bpo-21032(64): Fixed socket leak if HTTPConnection.getresponse()\nfails.  Original patch by Martin Panter.\n\n- bpo-22407(65): Deprecated the use of re.LOCALE flag with str\npatterns or re.ASCII. It was newer worked.\n\n- bpo-22902(66): The \"ip\" command is now used on Linux to determine\nMAC address in uuid.getnode().  Pach by Bruno Cauet.\n\n- bpo-22960(67): Add a context argument to xmlrpclib.ServerProxy\nconstructor.\n\n- bpo-22389(68): Add contextlib.redirectstderr().\n\n- bpo-21356(69): Make ssl.RANDegd() optional to support LibreSSL.\nThe availability of the function is checked during the compilation.\nPatch written by Bernard Spil.\n\n- bpo-22915(70): SAX parser now supports files opened with file\ndescriptor or bytes path.\n\n- bpo-22609(71): Constructors and update methods of mapping classes\nin the collections module now accept the self keyword argument.\n\n- bpo-22940(72): Add readline.appendhistoryfile.\n\n- bpo-19676(73): Added the \"namereplace\" error handler.\n\n- bpo-22788(74): Add 'context' parameter to\nlogging.handlers.HTTPHandler.\n\n- bpo-22921(75): Allow SSLContext to take the 'hostname' parameter\neven if OpenSSL doesn't support SNI.\n\n- bpo-22894(76): TestCase.subTest() would cause the test suite to be\nstopped when in failfast mode, even in the absence of failures.\n\n- bpo-22796(77): HTTP cookie parsing is now stricter, in order to\nprotect against potential injection attacks.\n\n- bpo-22370(78): Windows detection in pathlib is now more robust.\n\n- bpo-22841(79): Reject coroutines in asyncio addsignalhandler().\nPatch by Ludovic.Gasc.\n\n- bpo-19494(80): Added urllib.request.HTTPBasicPriorAuthHandler.\nPatch by Matej Cepl.\n\n- bpo-22578(81): Added attributes to the re.error class.\n\n- bpo-22849(82): Fix possible double free in the io.TextIOWrapper\nconstructor.\n\n- bpo-12728(83): Different Unicode characters having the same\nuppercase but different lowercase are now matched in\ncase-insensitive regular expressions.\n\n- bpo-22821(84): Fixed fcntl() with integer argument on 64-bit\nbig-endian platforms.\n\n- bpo-21650(85): Add an '--sort-keys' option to 'json.tool' CLI.\n\n- bpo-22824(86): Updated reprlib output format for sets to use set\nliterals.  Patch contributed by Berker Peksag.\n\n- bpo-22824(87): Updated reprlib output format for arrays to display\nempty arrays without an unnecessary empty list.  Suggested by\nSerhiy Storchaka.\n\n- bpo-22406(88): Fixed the uucodec codec incorrectly ported to 3.x.\nBased on patch by Martin Panter.\n\n- bpo-17293(89): uuid.getnode() now determines MAC address on AIX\nusing netstat.  Based on patch by Aivars Kalv??ns.\n\n- bpo-22769(90): Fixed ttk.Treeview.taghas() when called without\narguments.\n\n- bpo-22417(91): Verify certificates by default in httplib (PEP 476).\n\n- bpo-22775(92): Fixed unpickling of http.cookies.SimpleCookie with\nprotocol 2 and above.  Patch by Tim Graham.\n\n- bpo-22776(93): Brought excluded code into the scope of a try block\nin SysLogHandler.emit().\n\n- bpo-22665(94): Add missing getterminalsize and SameFileError to\nshutil.all.\n\n- bpo-6623(95): Remove deprecated Netrc class in the ftplib module.\nPatch by Matt Chaput.\n\n- bpo-17381(96): Fixed handling of case-insensitive ranges in regular\nexpressions.\n\n- bpo-22410(97): Module level functions in the re module now cache\ncompiled locale-dependent regular expressions taking into account\nthe locale.\n\n- bpo-22759(98): Query methods on pathlib.Path() (exists(), isdir(),\netc.)  now return False when the underlying stat call raises\nNotADirectoryError.\n\n- bpo-8876(99): distutils now falls back to copying files when hard\nlinking doesn't work.  This allows use with special filesystems\nsuch as VirtualBox shared folders.\n\n- bpo-22217(100): Implemented reprs of classes in the zipfile module.\n\n- bpo-22457(101): Honour loadtests in the startdir of discovery.\n\n- bpo-18216(102): gettext now raises an error when a .mo file has an\nunsupported major version number.  Patch by Aaron Hill.\n\n- bpo-13918(103): Provide a locale.delocalize() function which can\nremove locale-specific number formatting from a string representing\na number, without then converting it to a specific type.  Patch by\nCe'dric Krier.\n\n- bpo-22676(104): Make the pickling of global objects which don't\nhave a module attribute less slow.\n\n- bpo-18853(105): Fixed ResourceWarning in shlex.nain.\n\n- bpo-9351(106): Defaults set with setdefaults on an argparse\nsubparser are no longer ignored when also set on the parent parser.\n\n- bpo-7559(107): unittest test loading ImportErrors are reported as\nimport errors with their import exception rather than as attribute\nerrors after the import has already failed.\n\n- bpo-19746(108): Make it possible to examine the errors from\nunittest discovery without executing the test suite.  The new\n'errors' attribute on 'TestLoader' exposes these non-fatal errors\nencountered during discovery.\n\n- bpo-21991(109): Make email.headerregistry's header 'params'\nattributes be read-only (MappingProxyType).  Previously the\ndictionary was modifiable but a new one was created on each access\nof the attribute.\n\n- bpo-22638(110): SSLv3 is now disabled throughout the standard\nlibrary.  It can still be enabled by instantiating a SSLContext\nmanually.\n\n- bpo-22641(111): In asyncio, the default SSL context for client\nconnections is now created using ssl.createdefaultcontext(), for\nstronger security.\n\n- bpo-17401(112): Include closefd in io.FileIO repr.\n\n- bpo-21338(113): Add silent mode for compileall.  quiet parameters\nof compile{dir, file, path} functions now have a multilevel value.\nAlso, -q option of the CLI now have a multilevel value.  Patch by\nThomas Kluyver.\n\n- bpo-20152(114): Convert the array and cmath modules to Argument\nClinic.\n\n- bpo-18643(115): Add socket.socketpair() on Windows.\n\n- bpo-22435(116): Fix a file descriptor leak when socketserver bind\nfails.\n\n- bpo-13096(117): Fixed segfault in CTypes POINTER handling of large\nvalues.\n\n- bpo-11694(118): Raise ConversionError in xdrlib as documented.\nPatch by Filip Gruszczy??ski and Claudiu Popa.\n\n- bpo-19380(119): Optimized parsing of regular expressions.\n\n- bpo-1519638(120): Now unmatched groups are replaced with empty\nstrings in re.sub() and re.subn().\n\n- bpo-18615(121): sndhdr.what/whathdr now return a namedtuple.\n\n- bpo-22462(122): Fix pyexpat's creation of a dummy frame to make it\nappear in exception tracebacks.\n\n- bpo-21965(123): Add support for in-memory SSL to the ssl module.\nPatch by Geert Jansen.\n\n- bpo-21173(124): Fix len() on a WeakKeyDictionary when .clear() was\ncalled with an iterator alive.\n\n- bpo-11866(125): Eliminated race condition in the computation of\nnames for new threads.\n\n- bpo-21905(126): Avoid RuntimeError in pickle.whichmodule() when\nsys.modules is mutated while iterating.  Patch by Olivier Grisel.\n\n- bpo-11271(127): concurrent.futures.Executor.map() now takes a\n'chunksize' argument to allow batching of tasks in child processes\nand improve performance of ProcessPoolExecutor.  Patch by Dan\nO'Reilly.\n\n- bpo-21883(128): os.path.join() and os.path.relpath() now raise a\nTypeError with more helpful error message for unsupported or\nmismatched types of arguments.\n\n- bpo-22219(129): The zipfile module CLI now adds entries for\ndirectories (including empty directories) in ZIP file.\n\n- bpo-22449(130): In the ssl.SSLContext.loaddefaultcerts, consult\nthe environmental variables SSLCERTDIR and SSLCERTFILE on\nWindows.\n\n- bpo-22508(131): The email.version variable has been removed;\nthe email code is no longer shipped separately from the stdlib, and\nversion hasn't been updated in several releases.\n\n- bpo-20076(132): Added non derived UTF-8 aliases to locale aliases\ntable.\n\n- bpo-20079(133): Added locales supported in glibc 2.18 to locale\nalias table.\n\n- bpo-20218(134): Added convenience methods readtext/writetext and\nreadbytes/ writebytes to pathlib.Path objects.\n\n- bpo-22396(135): On 32-bit AIX platform, don't expose\nos.posixfadvise() nor os.posixfallocate() because their\nprototypes in system headers are wrong.\n\n- bpo-22517(136): When an io.BufferedRWPair object is deallocated,\nclear its weakrefs.\n\n- bpo-22437(137): Number of capturing groups in regular expression is\nno longer limited by 100.\n\n- bpo-17442(138): InteractiveInterpreter now displays the full\nchained traceback in its showtraceback method, to match the built\nin interactive interpreter.\n\n- bpo-23392(139): Added tests for marshal C API that works with\nFILE*.\n\n- bpo-10510(140): distutils register and upload methods now use HTML\nstandards compliant CRLF line endings.\n\n- bpo-9850(141): Fixed macpath.join() for empty first component.\nPatch by Oleg Oshmyan.\n\n- bpo-5309(142): distutils' build and buildext commands now accept a\n'-j' option to enable parallel building of extension modules.\n\n- bpo-22448(143): Improve canceled timer handles cleanup to prevent\nunbound memory usage.  Patch by Joshua Moore-Oliva.\n\n- bpo-22427(144): TemporaryDirectory no longer attempts to clean up\ntwice when used in the with statement in generator.\n\n- bpo-22362(145): Forbidden ambiguous octal escapes out of range\n0-0o377 in regular expressions.\n\n- bpo-20912(146): Now directories added to ZIP file have correct Unix\nand MS-DOS directory attributes.\n\n- bpo-21866(147): ZipFile.close() no longer writes ZIP64 central\ndirectory records if allowZip64 is false.\n\n- bpo-22278(148): Fix urljoin problem with relative urls, a\nregression observed after changes to issue22118 were submitted.\n\n- bpo-22415(149): Fixed debugging output of the GROUPREFEXISTS\nopcode in the re module.  Removed trailing spaces in debugging\noutput.\n\n- bpo-22423(150): Unhandled exception in thread no longer causes\nunhandled AttributeError when sys.stderr is None.\n\n- bpo-21332(151): Ensure that 'bufsize=1' in subprocess.Popen()\nselects line buffering, rather than block buffering.  Patch by\nAkira Li.\n\n- bpo-21091(152): Fix API bug:\nemail.message.EmailMessage.isattachment is now a method.\n\n- bpo-21079(153): Fix email.message.EmailMessage.isattachment to\nreturn the correct result when the header has parameters as well as\na value.\n\n- bpo-22247(154): Add NNTPError to nntplib.all.\n\n- bpo-22366(155): urllib.request.urlopen will accept a context object\n(SSLContext) as an argument which will then be used for HTTPS\nconnection.  Patch by Alex Gaynor.\n\n- bpo-4180(156): The warnings registries are now reset when the\nfilters are modified.\n\n- bpo-22419(157): Limit the length of incoming HTTP request in\nwsgiref server to 65536 bytes and send a 414 error code for higher\nlengths.  Patch contributed by Devin Cook.\n\n- Lax cookie parsing in http.cookies could be a security issue when\ncombined with non-standard cookie handling in some web browsers.\nReported by Sergey Bobrov.\n\n- bpo-20537(158): logging methods now accept an exception instance as\nwell as a Boolean value or exception tuple.  Thanks to Yury\nSelivanov for the patch.\n\n- bpo-22384(159): An exception in Tkinter callback no longer crashes\nthe program when it is run with pythonw.exe.\n\n- bpo-22168(160): Prevent turtle AttributeError with non-default\nCanvas on OS X.\n\n- bpo-21147(161): sqlite3 now raises an exception if the request\ncontains a null character instead of truncating it.  Based on patch\nby Victor Stinner.\n\n- bpo-13968(162): The glob module now supports recursive search in\nsubdirectories using the '' pattern.\n\n- bpo-21951(163): Fixed a crash in Tkinter on AIX when called Tcl\ncommand with empty string or tuple argument.\n\n- bpo-21951(164): Tkinter now most likely raises MemoryError instead\nof crash if the memory allocation fails.\n\n- bpo-22338(165): Fix a crash in the json module on memory allocation\nfailure.\n\n- bpo-12410(166): imaplib.IMAP4 now supports the context management\nprotocol.  Original patch by Tarek Ziade'.\n\n- bpo-21270(167): We now override tuple methods in mock.call objects\nso that they can be used as normal call attributes.\n\n- bpo-16662(168): 'loadtests()' is now unconditionally run when it\nis present in a package's 'init.py'.\n'TestLoader.loadTestsFromModule()' still accepts useloadtests,\nbut it is deprecated and ignored.  A new keyword-only attribute\n'pattern' is added and documented.  Patch given by Robert Collins,\ntweaked by Barry Warsaw.\n\n- bpo-22226(169): First letter no longer is stripped from the\n\"status\" key in the result of Treeview.heading().\n\n- bpo-19524(170): Fixed resource leak in the HTTP connection when an\ninvalid response is received.  Patch by Martin Panter.\n\n- bpo-20421(171): Add a .version() method to SSL sockets exposing the\nactual protocol version in use.\n\n- bpo-19546(172): configparser exceptions no longer expose\nimplementation details.  Chained KeyErrors are removed, which leads\nto cleaner tracebacks.  Patch by Claudiu Popa.\n\n- bpo-22051(173): turtledemo no longer reloads examples to re-run\nthem.  Initialization of variables and gui setup should be done in\nmain(), which is called each time a demo is run, but not on import.\n\n- bpo-21933(174): Turtledemo users can change the code font size with\na menu selection or control(command) '-' or '+' or\ncontrol-mousewheel.  Original patch by Lita Cho.\n\n- bpo-21597(175): The separator between the turtledemo text pane and\nthe drawing canvas can now be grabbed and dragged with a mouse.\nThe code text pane can be widened to easily view or copy the full\nwidth of the text.  The canvas can be widened on small screens.\nOriginal patches by Jan Kanis and Lita Cho.\n\n- bpo-18132(176): Turtledemo buttons no longer disappear when the\nwindow is shrunk.  Original patches by Jan Kanis and Lita Cho.\n\n- bpo-22043(177): time.monotonic() is now always available.\n'threading.Lock.acquire()', 'threading.RLock.acquire()' and socket\noperations now use a monotonic clock, instead of the system clock,\nwhen a timeout is used.\n\n- bpo-21527(178): Add a default number of workers to\nThreadPoolExecutor equal to 5 times the number of CPUs.  Patch by\nClaudiu Popa.\n\n- bpo-22216(179): smtplib now resets its state more completely after\na quit.  The most obvious consequence of the previous behavior was\na STARTTLS failure during a connect/starttls/quit/connect/starttls\nsequence.\n\n- bpo-22098(180): ctypes' BigEndianStructure and\nLittleEndianStructure now define an empty slots so that\nsubclasses don't always get an instance dict.  Patch by Claudiu\nPopa.\n\n- bpo-22185(181): Fix an occasional RuntimeError in\nthreading.Condition.wait() caused by mutation of the waiters queue\nwithout holding the lock.  Patch by Doug Zongker.\n\n- bpo-22287(182): On UNIX, PyTimegettimeofday() now uses\nclockgettime(CLOCKREALTIME) if available.  As a side effect,\nPython now depends on the librt library on Solaris and on Linux\n(only with glibc older than 2.17).\n\n- bpo-22182(183): Use e.args to unpack exceptions correctly in\ndistutils.fileutil.movefile.  Patch by Claudiu Popa.\n\n- The webbrowser module now uses subprocess's startnewsession=True\nrather than a potentially risky preexecfn=os.setsid call.\n\n- bpo-22042(184): signal.setwakeupfd(fd) now raises an exception if\nthe file descriptor is in blocking mode.\n\n- bpo-16808(185): inspect.stack() now returns a named tuple instead\nof a tuple.  Patch by Daniel Shahaf.\n\n- bpo-22236(186): Fixed Tkinter images copying operations in\nNoDefaultRoot mode.\n\n- bpo-2527(187): Add a 'globals' argument to timeit functions, in\norder to override the globals namespace in which the timed code is\nexecuted.  Patch by Ben Roberts.\n\n- bpo-22118(188): Switch urllib.parse to use RFC 3986 semantics for\nthe resolution of relative URLs, rather than RFCs 1808 and 2396.\nPatch by Demian Brecht.\n\n- bpo-21549(189): Added the \"members\" parameter to TarFile.list().\n\n- bpo-19628(190): Allow compileall recursion depth to be specified\nwith a -r option.\n\n- bpo-15696(191): Add a sizeof implementation for mmap objects on\nWindows.\n\n- bpo-22068(192): Avoided reference loops with Variables and Fonts in\nTkinter.\n\n- bpo-22165(193): SimpleHTTPRequestHandler now supports undecodable\nfile names.\n\n- bpo-15381(194): Optimized line reading in io.BytesIO.\n\n- bpo-8797(195): Raise HTTPError on failed Basic Authentication\nimmediately.  Initial patch by Sam Bull.\n\n- bpo-20729(196): Restored the use of lazy\niterkeys()/itervalues()/iteritems() in the mailbox module.\n\n- bpo-21448(197): Changed FeedParser feed() to avoid 'O'('n'^2)\nbehavior when parsing long line.  Original patch by Raymond\nHettinger.\n\n- bpo-22184(198): The functools LRU Cache decorator factory now gives\nan earlier and clearer error message when the user forgets the\nrequired parameters.\n\n- bpo-17923(199): glob() patterns ending with a slash no longer match\nnon-dirs on AIX. Based on patch by Delhallt.\n\n- bpo-21725(200): Added support for RFC 6531 (SMTPUTF8) in smtpd.\n\n- bpo-22176(201): Update the ctypes module's libffi to v3.1.  This\nrelease adds support for the Linux AArch64 and POWERPC ELF ABIv2\nlittle endian architectures.\n\n- bpo-5411(202): Added support for the \"xztar\" format in the shutil\nmodule.\n\n- bpo-21121(203): Don't force 3rd party C extensions to be built with\n-Werror=declaration-after-statement.\n\n- bpo-21975(204): Fixed crash when using uninitialized sqlite3.Row\n(in particular when unpickling pickled sqlite3.Row).  sqlite3.Row\nis now initialized in the new() method.\n\n- bpo-20170(205): Convert posixmodule to use Argument Clinic.\n\n- bpo-21539(206): Add an 'existsok' argument to 'Pathlib.mkdir()' to\nmimic 'mkdir -p' and 'os.makedirs()' functionality.  When true,\nignore 'FileExistsErrors'.  Patch by Berker Peksag.\n\n- bpo-22127(207): Bypass IDNA for pure-ASCII host names in the socket\nmodule (in particular for numeric IPs).\n\n- bpo-21047(208): set the default value for the 'convertcharrefs'\nargument of HTMLParser to True.  Patch by Berker Peksag.\n\n- Add an all to html.entities.\n\n- bpo-15114(209): the strict mode and argument of HTMLParser,\nHTMLParser.error, and the HTMLParserError exception have been\nremoved.\n\n- bpo-22085(210): Dropped support of Tk 8.3 in Tkinter.\n\n- bpo-21580(211): Now Tkinter correctly handles bytes arguments\npassed to Tk.  In particular this allows initializing images from\nbinary data.\n\n- bpo-22003(212): When initialized from a bytes object, io.BytesIO()\nnow defers making a copy until it is mutated, improving performance\nand memory use on some use cases.  Patch by David Wilson.\n\n- bpo-22018(213): On Windows, signal.setwakeupfd() now also\nsupports sockets.  A side effect is that Python depends to the\nWinSock library.\n\n- bpo-22054(214): Add os.getblocking() and os.setblocking()\nfunctions to get and set the blocking mode of a file descriptor\n(False if the ONONBLOCK flag is set, True otherwise).  These\nfunctions are not available on Windows.\n\n- bpo-17172(215): Make turtledemo start as active on OS X even when\nrun with subprocess.  Patch by Lita Cho.\n\n- bpo-21704(216): Fix build error for multiprocessing when\nsemaphores are not available.  Patch by Arfrever Frehtes Taifersar\nArahesis.\n\n- bpo-20173(217): Convert sha1, sha256, sha512 and md5 to\nArgumentClinic.  Patch by Vajrasky Kok.\n\n- Fix repr(socket.socket) on Windows 64-bit: don't fail with\nOverflowError on closed socket.  repr(socket.socket) already works\nfine.\n\n- bpo-22033(218): Reprs of most Python implemented classes now\ncontain actual class name instead of hardcoded one.\n\n- bpo-21947(219): The dis module can now disassemble\ngenerator-iterator objects based on their gicode attribute.  Patch\nby Clement Rouault.\n\n- bpo-16133(220): The asynchat.asyncchat.handleread() method now\nignores BlockingIOError exceptions.\n\n- bpo-22044(221): Fixed premature DECREF in calltzinfomethod.\nPatch by Tom Flanagan.\n\n- bpo-19884(222): readline: Disable the meta modifier key if stdout\nis not a terminal to not write the ANSI sequence '\"\\033[1034h\"'\ninto stdout.  This sequence is used on some terminal (ex:\nTERM=xterm-256color\") to enable support of 8 bit characters.\n\n- bpo-4350(223): Removed a number of out-of-dated and non-working for\na long time Tkinter methods.\n\n- bpo-6167(224): Scrollbar.activate() now returns the name of active\nelement if the argument is not specified.  Scrollbar.set() now\nalways accepts only 2 arguments.\n\n- bpo-15275(225): Clean up and speed up the ntpath module.\n\n- bpo-21888(226): plistlib's load() and loads() now work if the fmt\nparameter is specified.\n\n- bpo-22032(227): qualname instead of name is now always used\nto format fully qualified class names of Python implemented\nclasses.\n\n- bpo-22031(228): Reprs now always use hexadecimal format with the\n\"0x\" prefix when contain an id in form \" at 0x...\".\n\n- bpo-22018(229): signal.setwakeupfd() now raises an OSError\ninstead of a ValueError on 'fstat()' failure.\n\n- bpo-21044(230): tarfile.open() now handles fileobj with an integer\n'name' attribute.  Based on patch by Antoine Pietri.\n\n- bpo-21966(231): Respect -q command-line option when code module is\nran.\n\n- bpo-19076(232): Don't pass the redundant 'file' argument to\nself.error().\n\n- bpo-16382(233): Improve exception message of warnings.warn() for\nbad category.  Initial patch by Phil Elson.\n\n- bpo-21932(234): os.read() now uses a *note Pyssizet(): 88d. type\ninstead of int for the size to support reading more than 2 GB at\nonce.  On Windows, the size is truncated to INTMAX. As any call to\nos.read(), the OS may read less bytes than the number of requested\nbytes.\n\n- bpo-21942(235): Fixed source file viewing in pydoc's server mode on\nWindows.\n\n- bpo-11259(236): asynchat.asyncchat().setterminator() now raises a\nValueError if the number of received bytes is negative.\n\n- bpo-12523(237): asynchat.asyncchat.push() now raises a TypeError\nif it doesn't get a bytes string\n\n- bpo-21707(238): Add missing kwonlyargcount argument to\nModuleFinder.replacepathsincode().\n\n- bpo-20639(239): calling Path.withsuffix('') allows removing the\nsuffix again.  Patch by July Tikhonov.\n\n- bpo-21714(240): Disallow the construction of invalid paths using\nPath.withname().  Original patch by Antony Lee.\n\n- bpo-15014(241): Added 'auth' method to smtplib to make implementing\nauth mechanisms simpler, and used it internally in the login\nmethod.\n\n- bpo-21151(242): Fixed a segfault in the winreg module when 'None'\nis passed as a 'REGBINARY' value to SetValueEx.  Patch by John\nEhresman.\n\n- bpo-21090(243): io.FileIO.readall() does not ignore I/O errors\nanymore.  Before, it ignored I/O errors if at least the first C\ncall read() succeed.\n\n- bpo-5800(244): headers parameter of wsgiref.headers.Headers is now\noptional.  Initial patch by Pablo Torres Navarrete and SilentGhost.\n\n- bpo-21781(245): ssl.RANDadd() now supports strings longer than 2\nGB.\n\n- bpo-21679(246): Prevent extraneous fstat() calls during open().\nPatch by Bohuslav Kabrda.\n\n- bpo-21863(247): cProfile now displays the module name of C\nextension functions, in addition to their own name.\n\n- bpo-11453(248): asyncore: emit a ResourceWarning when an unclosed\nfilewrapper object is destroyed.  The destructor now closes the\nfile if needed.  The close() method can now be called twice: the\nsecond call does nothing.\n\n- bpo-21858(249): Better handling of Python exceptions in the sqlite3\nmodule.\n\n- bpo-21476(250): Make sure the email.parser.BytesParser\nTextIOWrapper is discarded after parsing, so the input file isn't\nunexpectedly closed.\n\n- bpo-20295(251): imghdr now recognizes OpenEXR format images.\n\n- bpo-21729(252): Used the \"with\" statement in the dbm.dumb module to\nensure files closing.  Patch by Claudiu Popa.\n\n- bpo-21491(253): socketserver: Fix a race condition in child\nprocesses reaping.\n\n- bpo-21719(254): Added the 'stfileattributes' field to\nos.statresult on Windows.\n\n- bpo-21832(255): Require named tuple inputs to be exact strings.\n\n- bpo-21722(256): The distutils \"upload\" command now exits with a\nnon-zero return code when uploading fails.  Patch by Martin\nDengler.\n\n- bpo-21723(257): asyncio.Queue: support any type of number (ex:\nfloat) for the maximum size.  Patch written by Vajrasky Kok.\n\n- bpo-21711(258): support for \"site-python\" directories has now been\nremoved from the site module (it was deprecated in 3.4).\n\n- bpo-17552(259): new socket.sendfile() method allowing a file to be\nsent over a socket by using high-performance os.sendfile() on UNIX.\nPatch by Giampaolo Rodola'.\n\n- bpo-18039(260): dbm.dump.open() now always creates a new database\nwhen the flag has the value 'n'.  Patch by Claudiu Popa.\n\n- bpo-21326(261): Add a new isclosed() method to\nasyncio.BaseEventLoop.  runforever() and rununtilcomplete()\nmethods of asyncio.BaseEventLoop now raise an exception if the\nevent loop was closed.\n\n- bpo-21766(262): Prevent a security hole in CGIHTTPServer by URL\nunquoting paths before checking for a CGI script at that path.\n\n- bpo-21310(263): Fixed possible resource leak in failed open().\n\n- bpo-21256(264): Printout of keyword args should be in deterministic\norder in a mock function call.  This will help to write better\ndoctests.\n\n- bpo-21677(265): Fixed chaining nonnormalized exceptions in io\nclose() methods.\n\n- bpo-11709(266): Fix the pydoc.help function to not fail when\nsys.stdin is not a valid file.\n\n- bpo-21515(267): tempfile.TemporaryFile now uses os.OTMPFILE flag\nis available.\n\n- bpo-13223(268): Fix pydoc.writedoc so that the HTML documentation\nfor methods that use 'self' in the example code is generated\ncorrectly.\n\n- bpo-21463(269): In urllib.request, fix pruning of the FTP cache.\n\n- bpo-21618(270): The subprocess module could fail to close open fds\nthat were inherited by the calling process and already higher than\nPOSIX resource limits would otherwise allow.  On systems with a\nfunctioning /proc/self/fd or /dev/fd interface the max is now\nignored and all fds are closed.\n\n- bpo-20383(271): Introduce importlib.util.modulefromspec() as the\npreferred way to create a new module.\n\n- bpo-21552(272): Fixed possible integer overflow of too long string\nlengths in the tkinter module on 64-bit platforms.\n\n- bpo-14315(273): The zipfile module now ignores extra fields in the\ncentral directory that are too short to be parsed instead of\nletting a struct.unpack error bubble up as this \"bad data\" appears\nin many real world zip files in the wild and is ignored by other\nzip tools.\n\n- bpo-13742(274): Added \"key\" and \"reverse\" parameters to\nheapq.merge().  (First draft of patch contributed by Simon Sapin.)\n\n- bpo-21402(275): tkinter.ttk now works when default root window is\nnot set.\n\n- bpo-3015(276): tkinter.create() now creates tkapp object with\nwantobject=1 by default.\n\n- bpo-10203(277): sqlite3.Row now truly supports sequence protocol.\nIn particular it supports reverse() and negative indices.  Original\npatch by Claudiu Popa.\n\n- bpo-18807(278): If copying (no symlinks) specified for a venv, then\nthe python interpreter aliases (python, python3) are now created by\ncopying rather than symlinking.\n\n- bpo-20197(279): Added support for the WebP image type in the imghdr\nmodule.  Patch by Fabrice Aneche and Claudiu Popa.\n\n- bpo-21513(280): Speedup some properties of IP addresses\n(IPv4Address, IPv6Address) such as .isprivate or .ismulticast.\n\n- bpo-21137(281): Improve the repr for threading.Lock() and its\nvariants by showing the \"locked\" or \"unlocked\" status.  Patch by\nBerker Peksag.\n\n- bpo-21538(282): The plistlib module now supports loading of binary\nplist files when reference or offset size is not a power of two.\n\n- bpo-21455(283): Add a default backlog to socket.listen().\n\n- bpo-21525(284): Most Tkinter methods which accepted tuples now\naccept lists too.\n\n- bpo-22166(285): With the assistance of a new internal\ncodecs.forgetcodec helping function, testcodecs now clears the\nencoding caches to avoid the appearance of a reference leak\n\n- bpo-22236(286): Tkinter tests now don't reuse default root window.\nNew root window is created for every test class.\n\n- bpo-10744(287): Fix PEP 3118(288) format strings on ctypes objects\nwith a nontrivial shape.\n\n- bpo-20826(289): Optimize ipaddress.collapseaddresses().\n\n- bpo-21487(290): Optimize ipaddress.summarizeaddressrange() and\nipaddress.{IPv4Network,IPv6Network}.subnets().\n\n- bpo-21486(291): Optimize parsing of netmasks in\nipaddress.IPv4Network and ipaddress.IPv6Network.\n\n- bpo-13916(292): Disallowed the surrogatepass error handler for non\nUTF-* encodings.\n\n- bpo-20998(293): Fixed re.fullmatch() of repeated single character\npattern with ignore case.  Original patch by Matthew Barnett.\n\n- bpo-21075(294): fileinput.FileInput now reads bytes from standard\nstream if binary mode is specified.  Patch by Sam Kimbrel.\n\n- bpo-19775(295): Add a samefile() method to pathlib Path objects.\nInitial patch by Vajrasky Kok.\n\n- bpo-21226(296): Set up modules properly in\nPyImportExecCodeModuleObject (and friends).\n\n- bpo-21398(297): Fix a unicode error in the pydoc pager when the\ndocumentation contains characters not encodable to the stdout\nencoding.\n\n- bpo-16531(298): ipaddress.IPv4Network and ipaddress.IPv6Network now\naccept an (address, netmask) tuple argument, so as to easily\nconstruct network objects from existing addresses.\n\n- bpo-21156(299): importlib.abc.InspectLoader.sourcetocode() is now\na staticmethod.\n\n- bpo-21424(300): Simplified and optimized heaqp.nlargest() and\nnmsmallest() to make fewer tuple comparisons.\n\n- bpo-21396(301): Fix TextIOWrapper(..., writethrough=True) to not\nforce a flush() on the underlying binary stream.  Patch by akira.\n\n- bpo-18314(302): Unlink now removes junctions on Windows.  Patch by\nKim Gra\"sman\n\n- bpo-21088(303): Bugfix for curses.window.addch() regression in\n3.4.0.  In porting to Argument Clinic, the first two arguments were\nreversed.\n\n- bpo-21407(304): decimal: The module now supports function\nsignatures.\n\n- bpo-10650(305): Remove the non-standard 'watchexp' parameter from\nthe Decimal.quantize() method in the Python version.  It had never\nbeen present in the C version.\n\n- bpo-21469(306): Reduced the risk of false positives in robotparser\nby checking to make sure that robots.txt has been read or does not\nexist prior to returning True in canfetch().\n\n- bpo-19414(307): Have the OrderedDict mark deleted links as\nunusable.  This gives an early failure if the link is deleted\nduring iteration.\n\n- bpo-21421(308): Add slots to the MappingViews ABC. Patch by\nJosh Rosenberg.\n\n- bpo-21101(309): Eliminate double hashing in the C speed-up code for\ncollections.Counter().\n\n- bpo-21321(310): itertools.islice() now releases the reference to\nthe source iterator when the slice is exhausted.  Patch by Anton\nAfanasyev.\n\n- bpo-21057(311): TextIOWrapper now allows the underlying binary\nstream's read() or read1() method to return an arbitrary bytes-like\nobject (such as a memoryview).  Patch by Nikolaus Rath.\n\n- bpo-20951(312): SSLSocket.send() now raises either SSLWantReadError\nor SSLWantWriteError on a non-blocking socket if the operation\nwould block.  Previously, it would return 0.  Patch by Nikolaus\nRath.\n\n- bpo-13248(313): removed previously deprecated asyncore.dispatcher\ngetattr cheap inheritance hack.\n\n- bpo-9815(314): assertRaises now tries to clear references to local\nvariables in the exception's traceback.\n\n- bpo-19940(315): ssl.certtimetoseconds() now interprets the given\ntime string in the UTC timezone (as specified in RFC 5280), not the\nlocal timezone.\n\n- bpo-13204(316): Calling sys.flags.new would crash the\ninterpreter, now it raises a TypeError.\n\n- bpo-19385(317): Make operations on a closed dbm.dumb database\nalways raise the same exception.\n\n- bpo-21207(318): Detect when the os.urandom cached fd has been\nclosed or replaced, and open it anew.\n\n- bpo-21291(319): subprocess's Popen.wait() is now thread safe so\nthat multiple threads may be calling wait() or poll() on a Popen\ninstance at the same time without losing the Popen.returncode\nvalue.\n\n- bpo-21127(320): Path objects can now be instantiated from str\nsubclass instances (such as 'numpy.str').\n\n- bpo-15002(321): urllib.response object to use TemporaryFileWrapper\n(and TemporaryFileCloser) facility.  Provides a better way to\nhandle file descriptor close.  Patch contributed by Christian\nTheune.\n\n- bpo-12220(322): mindom now raises a custom ValueError indicating it\ndoesn't support spaces in URIs instead of letting a 'split'\nValueError bubble up.\n\n- bpo-21068(323): The ssl.PROTOCOL* constants are now enum members.\n\n- bpo-21276(324): posixmodule: Don't define USEXATTRS on KFreeBSD\nand the Hurd.\n\n- bpo-21262(325): New method assertnotcalled for Mock.  It raises\nAssertionError if the mock has been called.\n\n- bpo-21238(326): New keyword argument 'unsafe' to Mock.  It raises\n'AttributeError' incase of an attribute startswith assert or\nassret.\n\n- bpo-20896(327): ssl.getservercertificate() now uses\nPROTOCOLSSLv23, not PROTOCOLSSLv3, for maximum compatibility.\n\n- bpo-21239(328): patch.stopall() didn't work deterministically when\nthe same name was patched more than once.\n\n- bpo-21203(329): Updated fileConfig and dictConfig to remove\ninconsistencies.  Thanks to Jure Koren for the patch.\n\n- bpo-21222(330): Passing name keyword argument to\nmock.createautospec now works.\n\n- bpo-21197(331): Add lib64 -> lib symlink in venvs on 64-bit non-OS\nX POSIX.\n\n- bpo-17498(332): Some SMTP servers disconnect after certain errors,\nviolating strict RFC conformance.  Instead of losing the error code\nwhen we issue the subsequent RSET, smtplib now returns the error\ncode and defers raising the SMTPServerDisconnected error until the\nnext command is issued.\n\n- bpo-17826(333): setting an iterable sideeffect on a mock function\ncreated by createautospec now works.  Patch by Kushal Das.\n\n- bpo-7776(334): Fix 'Host:' header and reconnection when using\nhttp.client.HTTPConnection.settunnel().  Patch by Nikolaus Rath.\n\n- bpo-20968(335): unittest.mock.MagicMock now supports division.\nPatch by Johannes Baiter.\n\n- bpo-21529(336): Fix arbitrary memory access in\nJSONDecoder.rawdecode with a negative second parameter.  Bug\nreported by Guido Vranken.  (See also: CVE-2014-4616)\n\n- bpo-21169(337): getpass now handles non-ascii characters that the\ninput stream encoding cannot encode by re-encoding using the\nreplace error handler.\n\n- bpo-21171(338): Fixed undocumented filter API of the rot13 codec.\nPatch by Berker Peksag.\n\n- bpo-20539(339): Improved math.factorial error message for large\npositive inputs and changed exception type (OverflowError ->\nValueError) for large negative inputs.\n\n- bpo-21172(340): isinstance check relaxed from dict to\ncollections.Mapping.\n\n- bpo-21155(341): asyncio.EventLoop.createunixserver() now raises a\nValueError if path and sock are specified at the same time.\n\n- bpo-21136(342): Avoid unnecessary normalization of Fractions\nresulting from power and other operations.  Patch by Raymond\nHettinger.\n\n- bpo-17621(343): Introduce importlib.util.LazyLoader.\n\n- bpo-21076(344): signal module constants were turned into enums.\nPatch by Giampaolo Rodola'.\n\n- bpo-20636(345): Improved the repr of Tkinter widgets.\n\n- bpo-19505(346): The items, keys, and values views of OrderedDict\nnow support reverse iteration using reversed().\n\n- bpo-21149(347): Improved thread-safety in logging cleanup during\ninterpreter shutdown.  Thanks to Devin Jeanpierre for the patch.\n\n- bpo-21058(348): Fix a leak of file descriptor in *note\ntempfile.NamedTemporaryFile(): 1ea, close the file descriptor if\n*note io.open(): 26f. fails\n\n- bpo-21200(349): Return None from pkgutil.getloader() when spec\nis missing.\n\n- bpo-21013(350): Enhance ssl.createdefaultcontext() when used for\nserver side sockets to provide better security by default.\n\n- bpo-20145(351): 'assertRaisesRegex' and 'assertWarnsRegex' now\nraise a 'TypeError' if the second argument is not a string or\ncompiled regex.\n\n- bpo-20633(352): Replace relative import by absolute import.\n\n- bpo-20980(353): Stop wrapping exception when using ThreadPool.\n\n- bpo-21082(354): In os.makedirs, do not set the process-wide umask.\nNote this changes behavior of makedirs when existok=True.\n\n- bpo-20990(355): Fix issues found by pyflakes for multiprocessing.\n\n- bpo-21015(356): SSL contexts will now automatically select an\nelliptic curve for ECDH key exchange on OpenSSL 1.0.2 and later,\nand otherwise default to \"prime256v1\".\n\n- bpo-21000(357): Improve the command-line interface of json.tool.\n\n- bpo-20995(358): Enhance default ciphers used by the ssl module to\nenable better security and prioritize perfect forward secrecy.\n\n- bpo-20884(359): Don't assume that file is defined on\nimportlib.init.\n\n- bpo-21499(360): Ignore builtins in several\ntestimportlib.testapi tests.\n\n- bpo-20627(361): xmlrpc.client.ServerProxy is now a context manager.\n\n- bpo-19165(362): The formatter module now raises DeprecationWarning\ninstead of PendingDeprecationWarning.\n\n- bpo-13936(363): Remove the ability of datetime.time instances to be\nconsidered false in boolean contexts.\n\n- bpo-18931(364): selectors module now supports /dev/poll on Solaris.\nPatch by Giampaolo Rodola'.\n\n- bpo-19977(365): When the 'LCTYPE' locale is the POSIX locale ('C'\nlocale), *note sys.stdin: 293. and *note sys.stdout: 90c. are now\nusing the 'surrogateescape' error handler, instead of the 'strict'\nerror handler.\n\n- bpo-20574(366): Implement incremental decoder for cp65001 code\n(Windows code page 65001, Microsoft UTF-8).\n\n- bpo-20879(367): Delay the initialization of encoding and decoding\ntables for base32, ascii85 and base85 codecs in the base64 module,\nand delay the initialization of the unquotetobytes() table of the\nurllib.parse module, to not waste memory if these modules are not\nused.\n\n- bpo-19157(368): Include the broadcast address in the usuable hosts\nfor IPv6 in ipaddress.\n\n- bpo-11599(369): When an external command (e.g.  compiler) fails,\ndistutils now prints out the whole command line (instead of just\nthe command name) if the environment variable DISTUTILSDEBUG is\nset.\n\n- bpo-4931(370): distutils should not produce unhelpful \"error: None\"\nmessages anymore.  distutils.util.grokenvironmenterror is kept\nbut doc-deprecated.\n\n- bpo-20875(371): Prevent possible gzip \"'read' is not defined\"\nNameError.  Patch by Claudiu Popa.\n\n- bpo-11558(372): 'email.message.Message.attach' now returns a more\nuseful error message if 'attach' is called on a message for which\n'ismultipart' is False.\n\n- bpo-20283(373): RE pattern methods now accept the string keyword\nparameters as documented.  The pattern and source keyword\nparameters are left as deprecated aliases.\n\n- bpo-20778(374): Fix modulefinder to work with bytecode-only\nmodules.\n\n- bpo-20791(375): copy.copy() now doesn't make a copy when the input\nis a bytes object.  Initial patch by Peter Otten.\n\n- bpo-19748(376): On AIX, time.mktime() now raises an OverflowError\nfor year outsize range [1902; 2037].\n\n- bpo-19573(377): inspect.signature: Use enum for parameter kind\nconstants.\n\n- bpo-20726(378): inspect.signature: Make Signature and Parameter\npicklable.\n\n- bpo-17373(379): Add inspect.Signature.fromcallable method.\n\n- bpo-20378(380): Improve repr of inspect.Signature and\ninspect.Parameter.\n\n- bpo-20816(381): Fix inspect.getcallargs() to raise correct\nTypeError for missing keyword-only arguments.  Patch by Jeremiah\nLowin.\n\n- bpo-20817(382): Fix inspect.getcallargs() to fail correctly if more\nthan 3 arguments are missing.  Patch by Jeremiah Lowin.\n\n- bpo-6676(383): Ensure a meaningful exception is raised when\nattempting to parse more than one XML document per pyexpat\nxmlparser instance.  (Original patches by Hirokazu Yamamoto and\nAmaury Forgeot d'Arc, with suggested wording by David Gutteridge)\n\n- bpo-21117(384): Fix inspect.signature to better support\nfunctools.partial.  Due to the specifics of functools.partial\nimplementation, positional-or-keyword arguments passed as keyword\narguments become keyword-only.\n\n- bpo-20334(385): inspect.Signature and inspect.Parameter are now\nhashable.  Thanks to Antony Lee for bug reports and suggestions.\n\n- bpo-15916(386): doctest.DocTestSuite returns an empty\nunittest.TestSuite instead of raising ValueError if it finds no\ntests\n\n- bpo-21209(387): Fix asyncio.tasks.CoroWrapper to workaround a bug\nin yield-from implementation in CPythons prior to 3.4.1.\n\n- asyncio: Add gi{frame,running,code} properties to CoroWrapper\n(upstream bpo-163(388)).\n\n- bpo-21311(389): Avoid exception in osxsupport with non-standard\ncompiler configurations.  Patch by John Szakmeister.\n\n- bpo-11571(390): Ensure that the turtle window becomes the topmost\nwindow when launched on OS X.\n\n- bpo-21801(391): Validate that signature is None or an instance\nof Signature.\n\n- bpo-21923(392): Prevent AttributeError in\ndistutils.sysconfig.customizecompiler due to possible\nuninitialized configvars.\n\n- bpo-21323(393): Fix http.server to again handle scripts in CGI\nsubdirectories, broken by the fix for security bpo-19435(394).\nPatch by Zach Byrne.\n\n- bpo-22733(395): Fix ffiprepargs not zero-extending argument\nvalues correctly on 64-bit Windows.\n\n- bpo-23302(396): Default to TCPNODELAY=1 upon establishing an\nHTTPConnection.  Removed use of hard-coded MSS as it's an\noptimization that's no longer needed with Nagle disabled.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23399\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=20289\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=13128\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=15381\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=22818\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=23099\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=23326\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=21408\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=23363\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=23364\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=23366\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=23369\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=23353\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=14099\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=14099\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=19361\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=18518\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=23094\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=23268\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=21408\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=19996\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=20188\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=23133\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=23248\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=23266\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=23098\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=21817\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=15955\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=23250\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=23063\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=23209\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=23225\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=17911\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=17911\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=19777\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=23206\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=23185\n\n(38) https://bugs.python.org/issue?@action=redirect&bpo=23186\n\n(39) https://bugs.python.org/issue?@action=redirect&bpo=23143\n\n(40) https://bugs.python.org/issue?@action=redirect&bpo=23132\n\n(41) https://bugs.python.org/issue?@action=redirect&bpo=19776\n\n(42) https://bugs.python.org/issue?@action=redirect&bpo=23112\n\n(43) https://bugs.python.org/issue?@action=redirect&bpo=21793\n\n(44) https://bugs.python.org/issue?@action=redirect&bpo=23093\n\n(45) https://bugs.python.org/issue?@action=redirect&bpo=23111\n\n(46) https://bugs.python.org/issue?@action=redirect&bpo=22585\n\n(47) https://bugs.python.org/issue?@action=redirect&bpo=19104\n\n(48) https://bugs.python.org/issue?@action=redirect&bpo=23071\n\n(49) https://bugs.python.org/issue?@action=redirect&bpo=22783\n\n(50) https://bugs.python.org/issue?@action=redirect&bpo=15513\n\n(51) https://bugs.python.org/issue?@action=redirect&bpo=19858\n\n(52) https://bugs.python.org/issue?@action=redirect&bpo=22095\n\n(53) https://bugs.python.org/issue?@action=redirect&bpo=23016\n\n(54) https://bugs.python.org/issue?@action=redirect&bpo=21775\n\n(55) https://bugs.python.org/issue?@action=redirect&bpo=1218234\n\n(56) https://bugs.python.org/issue?@action=redirect&bpo=21740\n\n(57) https://bugs.python.org/issue?@action=redirect&bpo=23009\n\n(58) https://bugs.python.org/issue?@action=redirect&bpo=22959\n\n(59) https://bugs.python.org/issue?@action=redirect&bpo=22696\n\n(60) https://bugs.python.org/issue?@action=redirect&bpo=16043\n\n(61) https://bugs.python.org/issue?@action=redirect&bpo=14099\n\n(62) https://bugs.python.org/issue?@action=redirect&bpo=22966\n\n(63) https://bugs.python.org/issue?@action=redirect&bpo=21971\n\n(64) https://bugs.python.org/issue?@action=redirect&bpo=21032\n\n(65) https://bugs.python.org/issue?@action=redirect&bpo=22407\n\n(66) https://bugs.python.org/issue?@action=redirect&bpo=22902\n\n(67) https://bugs.python.org/issue?@action=redirect&bpo=22960\n\n(68) https://bugs.python.org/issue?@action=redirect&bpo=22389\n\n(69) https://bugs.python.org/issue?@action=redirect&bpo=21356\n\n(70) https://bugs.python.org/issue?@action=redirect&bpo=22915\n\n(71) https://bugs.python.org/issue?@action=redirect&bpo=22609\n\n(72) https://bugs.python.org/issue?@action=redirect&bpo=22940\n\n(73) https://bugs.python.org/issue?@action=redirect&bpo=19676\n\n(74) https://bugs.python.org/issue?@action=redirect&bpo=22788\n\n(75) https://bugs.python.org/issue?@action=redirect&bpo=22921\n\n(76) https://bugs.python.org/issue?@action=redirect&bpo=22894\n\n(77) https://bugs.python.org/issue?@action=redirect&bpo=22796\n\n(78) https://bugs.python.org/issue?@action=redirect&bpo=22370\n\n(79) https://bugs.python.org/issue?@action=redirect&bpo=22841\n\n(80) https://bugs.python.org/issue?@action=redirect&bpo=19494\n\n(81) https://bugs.python.org/issue?@action=redirect&bpo=22578\n\n(82) https://bugs.python.org/issue?@action=redirect&bpo=22849\n\n(83) https://bugs.python.org/issue?@action=redirect&bpo=12728\n\n(84) https://bugs.python.org/issue?@action=redirect&bpo=22821\n\n(85) https://bugs.python.org/issue?@action=redirect&bpo=21650\n\n(86) https://bugs.python.org/issue?@action=redirect&bpo=22824\n\n(87) https://bugs.python.org/issue?@action=redirect&bpo=22824\n\n(88) https://bugs.python.org/issue?@action=redirect&bpo=22406\n\n(89) https://bugs.python.org/issue?@action=redirect&bpo=17293\n\n(90) https://bugs.python.org/issue?@action=redirect&bpo=22769\n\n(91) https://bugs.python.org/issue?@action=redirect&bpo=22417\n\n(92) https://bugs.python.org/issue?@action=redirect&bpo=22775\n\n(93) https://bugs.python.org/issue?@action=redirect&bpo=22776\n\n(94) https://bugs.python.org/issue?@action=redirect&bpo=22665\n\n(95) https://bugs.python.org/issue?@action=redirect&bpo=6623\n\n(96) https://bugs.python.org/issue?@action=redirect&bpo=17381\n\n(97) https://bugs.python.org/issue?@action=redirect&bpo=22410\n\n(98) https://bugs.python.org/issue?@action=redirect&bpo=22759\n\n(99) https://bugs.python.org/issue?@action=redirect&bpo=8876\n\n(100) https://bugs.python.org/issue?@action=redirect&bpo=22217\n\n(101) https://bugs.python.org/issue?@action=redirect&bpo=22457\n\n(102) https://bugs.python.org/issue?@action=redirect&bpo=18216\n\n(103) https://bugs.python.org/issue?@action=redirect&bpo=13918\n\n(104) https://bugs.python.org/issue?@action=redirect&bpo=22676\n\n(105) https://bugs.python.org/issue?@action=redirect&bpo=18853\n\n(106) https://bugs.python.org/issue?@action=redirect&bpo=9351\n\n(107) https://bugs.python.org/issue?@action=redirect&bpo=7559\n\n(108) https://bugs.python.org/issue?@action=redirect&bpo=19746\n\n(109) https://bugs.python.org/issue?@action=redirect&bpo=21991\n\n(110) https://bugs.python.org/issue?@action=redirect&bpo=22638\n\n(111) https://bugs.python.org/issue?@action=redirect&bpo=22641\n\n(112) https://bugs.python.org/issue?@action=redirect&bpo=17401\n\n(113) https://bugs.python.org/issue?@action=redirect&bpo=21338\n\n(114) https://bugs.python.org/issue?@action=redirect&bpo=20152\n\n(115) https://bugs.python.org/issue?@action=redirect&bpo=18643\n\n(116) https://bugs.python.org/issue?@action=redirect&bpo=22435\n\n(117) https://bugs.python.org/issue?@action=redirect&bpo=13096\n\n(118) https://bugs.python.org/issue?@action=redirect&bpo=11694\n\n(119) https://bugs.python.org/issue?@action=redirect&bpo=19380\n\n(120) https://bugs.python.org/issue?@action=redirect&bpo=1519638\n\n(121) https://bugs.python.org/issue?@action=redirect&bpo=18615\n\n(122) https://bugs.python.org/issue?@action=redirect&bpo=22462\n\n(123) https://bugs.python.org/issue?@action=redirect&bpo=21965\n\n(124) https://bugs.python.org/issue?@action=redirect&bpo=21173\n\n(125) https://bugs.python.org/issue?@action=redirect&bpo=11866\n\n(126) https://bugs.python.org/issue?@action=redirect&bpo=21905\n\n(127) https://bugs.python.org/issue?@action=redirect&bpo=11271\n\n(128) https://bugs.python.org/issue?@action=redirect&bpo=21883\n\n(129) https://bugs.python.org/issue?@action=redirect&bpo=22219\n\n(130) https://bugs.python.org/issue?@action=redirect&bpo=22449\n\n(131) https://bugs.python.org/issue?@action=redirect&bpo=22508\n\n(132) https://bugs.python.org/issue?@action=redirect&bpo=20076\n\n(133) https://bugs.python.org/issue?@action=redirect&bpo=20079\n\n(134) https://bugs.python.org/issue?@action=redirect&bpo=20218\n\n(135) https://bugs.python.org/issue?@action=redirect&bpo=22396\n\n(136) https://bugs.python.org/issue?@action=redirect&bpo=22517\n\n(137) https://bugs.python.org/issue?@action=redirect&bpo=22437\n\n(138) https://bugs.python.org/issue?@action=redirect&bpo=17442\n\n(139) https://bugs.python.org/issue?@action=redirect&bpo=23392\n\n(140) https://bugs.python.org/issue?@action=redirect&bpo=10510\n\n(141) https://bugs.python.org/issue?@action=redirect&bpo=9850\n\n(142) https://bugs.python.org/issue?@action=redirect&bpo=5309\n\n(143) https://bugs.python.org/issue?@action=redirect&bpo=22448\n\n(144) https://bugs.python.org/issue?@action=redirect&bpo=22427\n\n(145) https://bugs.python.org/issue?@action=redirect&bpo=22362\n\n(146) https://bugs.python.org/issue?@action=redirect&bpo=20912\n\n(147) https://bugs.python.org/issue?@action=redirect&bpo=21866\n\n(148) https://bugs.python.org/issue?@action=redirect&bpo=22278\n\n(149) https://bugs.python.org/issue?@action=redirect&bpo=22415\n\n(150) https://bugs.python.org/issue?@action=redirect&bpo=22423\n\n(151) https://bugs.python.org/issue?@action=redirect&bpo=21332\n\n(152) https://bugs.python.org/issue?@action=redirect&bpo=21091\n\n(153) https://bugs.python.org/issue?@action=redirect&bpo=21079\n\n(154) https://bugs.python.org/issue?@action=redirect&bpo=22247\n\n(155) https://bugs.python.org/issue?@action=redirect&bpo=22366\n\n(156) https://bugs.python.org/issue?@action=redirect&bpo=4180\n\n(157) https://bugs.python.org/issue?@action=redirect&bpo=22419\n\n(158) https://bugs.python.org/issue?@action=redirect&bpo=20537\n\n(159) https://bugs.python.org/issue?@action=redirect&bpo=22384\n\n(160) https://bugs.python.org/issue?@action=redirect&bpo=22168\n\n(161) https://bugs.python.org/issue?@action=redirect&bpo=21147\n\n(162) https://bugs.python.org/issue?@action=redirect&bpo=13968\n\n(163) https://bugs.python.org/issue?@action=redirect&bpo=21951\n\n(164) https://bugs.python.org/issue?@action=redirect&bpo=21951\n\n(165) https://bugs.python.org/issue?@action=redirect&bpo=22338\n\n(166) https://bugs.python.org/issue?@action=redirect&bpo=12410\n\n(167) https://bugs.python.org/issue?@action=redirect&bpo=21270\n\n(168) https://bugs.python.org/issue?@action=redirect&bpo=16662\n\n(169) https://bugs.python.org/issue?@action=redirect&bpo=22226\n\n(170) https://bugs.python.org/issue?@action=redirect&bpo=19524\n\n(171) https://bugs.python.org/issue?@action=redirect&bpo=20421\n\n(172) https://bugs.python.org/issue?@action=redirect&bpo=19546\n\n(173) https://bugs.python.org/issue?@action=redirect&bpo=22051\n\n(174) https://bugs.python.org/issue?@action=redirect&bpo=21933\n\n(175) https://bugs.python.org/issue?@action=redirect&bpo=21597\n\n(176) https://bugs.python.org/issue?@action=redirect&bpo=18132\n\n(177) https://bugs.python.org/issue?@action=redirect&bpo=22043\n\n(178) https://bugs.python.org/issue?@action=redirect&bpo=21527\n\n(179) https://bugs.python.org/issue?@action=redirect&bpo=22216\n\n(180) https://bugs.python.org/issue?@action=redirect&bpo=22098\n\n(181) https://bugs.python.org/issue?@action=redirect&bpo=22185\n\n(182) https://bugs.python.org/issue?@action=redirect&bpo=22287\n\n(183) https://bugs.python.org/issue?@action=redirect&bpo=22182\n\n(184) https://bugs.python.org/issue?@action=redirect&bpo=22042\n\n(185) https://bugs.python.org/issue?@action=redirect&bpo=16808\n\n(186) https://bugs.python.org/issue?@action=redirect&bpo=22236\n\n(187) https://bugs.python.org/issue?@action=redirect&bpo=2527\n\n(188) https://bugs.python.org/issue?@action=redirect&bpo=22118\n\n(189) https://bugs.python.org/issue?@action=redirect&bpo=21549\n\n(190) https://bugs.python.org/issue?@action=redirect&bpo=19628\n\n(191) https://bugs.python.org/issue?@action=redirect&bpo=15696\n\n(192) https://bugs.python.org/issue?@action=redirect&bpo=22068\n\n(193) https://bugs.python.org/issue?@action=redirect&bpo=22165\n\n(194) https://bugs.python.org/issue?@action=redirect&bpo=15381\n\n(195) https://bugs.python.org/issue?@action=redirect&bpo=8797\n\n(196) https://bugs.python.org/issue?@action=redirect&bpo=20729\n\n(197) https://bugs.python.org/issue?@action=redirect&bpo=21448\n\n(198) https://bugs.python.org/issue?@action=redirect&bpo=22184\n\n(199) https://bugs.python.org/issue?@action=redirect&bpo=17923\n\n(200) https://bugs.python.org/issue?@action=redirect&bpo=21725\n\n(201) https://bugs.python.org/issue?@action=redirect&bpo=22176\n\n(202) https://bugs.python.org/issue?@action=redirect&bpo=5411\n\n(203) https://bugs.python.org/issue?@action=redirect&bpo=21121\n\n(204) https://bugs.python.org/issue?@action=redirect&bpo=21975\n\n(205) https://bugs.python.org/issue?@action=redirect&bpo=20170\n\n(206) https://bugs.python.org/issue?@action=redirect&bpo=21539\n\n(207) https://bugs.python.org/issue?@action=redirect&bpo=22127\n\n(208) https://bugs.python.org/issue?@action=redirect&bpo=21047\n\n(209) https://bugs.python.org/issue?@action=redirect&bpo=15114\n\n(210) https://bugs.python.org/issue?@action=redirect&bpo=22085\n\n(211) https://bugs.python.org/issue?@action=redirect&bpo=21580\n\n(212) https://bugs.python.org/issue?@action=redirect&bpo=22003\n\n(213) https://bugs.python.org/issue?@action=redirect&bpo=22018\n\n(214) https://bugs.python.org/issue?@action=redirect&bpo=22054\n\n(215) https://bugs.python.org/issue?@action=redirect&bpo=17172\n\n(216) https://bugs.python.org/issue?@action=redirect&bpo=21704\n\n(217) https://bugs.python.org/issue?@action=redirect&bpo=20173\n\n(218) https://bugs.python.org/issue?@action=redirect&bpo=22033\n\n(219) https://bugs.python.org/issue?@action=redirect&bpo=21947\n\n(220) https://bugs.python.org/issue?@action=redirect&bpo=16133\n\n(221) https://bugs.python.org/issue?@action=redirect&bpo=22044\n\n(222) https://bugs.python.org/issue?@action=redirect&bpo=19884\n\n(223) https://bugs.python.org/issue?@action=redirect&bpo=4350\n\n(224) https://bugs.python.org/issue?@action=redirect&bpo=6167\n\n(225) https://bugs.python.org/issue?@action=redirect&bpo=15275\n\n(226) https://bugs.python.org/issue?@action=redirect&bpo=21888\n\n(227) https://bugs.python.org/issue?@action=redirect&bpo=22032\n\n(228) https://bugs.python.org/issue?@action=redirect&bpo=22031\n\n(229) https://bugs.python.org/issue?@action=redirect&bpo=22018\n\n(230) https://bugs.python.org/issue?@action=redirect&bpo=21044\n\n(231) https://bugs.python.org/issue?@action=redirect&bpo=21966\n\n(232) https://bugs.python.org/issue?@action=redirect&bpo=19076\n\n(233) https://bugs.python.org/issue?@action=redirect&bpo=16382\n\n(234) https://bugs.python.org/issue?@action=redirect&bpo=21932\n\n(235) https://bugs.python.org/issue?@action=redirect&bpo=21942\n\n(236) https://bugs.python.org/issue?@action=redirect&bpo=11259\n\n(237) https://bugs.python.org/issue?@action=redirect&bpo=12523\n\n(238) https://bugs.python.org/issue?@action=redirect&bpo=21707\n\n(239) https://bugs.python.org/issue?@action=redirect&bpo=20639\n\n(240) https://bugs.python.org/issue?@action=redirect&bpo=21714\n\n(241) https://bugs.python.org/issue?@action=redirect&bpo=15014\n\n(242) https://bugs.python.org/issue?@action=redirect&bpo=21151\n\n(243) https://bugs.python.org/issue?@action=redirect&bpo=21090\n\n(244) https://bugs.python.org/issue?@action=redirect&bpo=5800\n\n(245) https://bugs.python.org/issue?@action=redirect&bpo=21781\n\n(246) https://bugs.python.org/issue?@action=redirect&bpo=21679\n\n(247) https://bugs.python.org/issue?@action=redirect&bpo=21863\n\n(248) https://bugs.python.org/issue?@action=redirect&bpo=11453\n\n(249) https://bugs.python.org/issue?@action=redirect&bpo=21858\n\n(250) https://bugs.python.org/issue?@action=redirect&bpo=21476\n\n(251) https://bugs.python.org/issue?@action=redirect&bpo=20295\n\n(252) https://bugs.python.org/issue?@action=redirect&bpo=21729\n\n(253) https://bugs.python.org/issue?@action=redirect&bpo=21491\n\n(254) https://bugs.python.org/issue?@action=redirect&bpo=21719\n\n(255) https://bugs.python.org/issue?@action=redirect&bpo=21832\n\n(256) https://bugs.python.org/issue?@action=redirect&bpo=21722\n\n(257) https://bugs.python.org/issue?@action=redirect&bpo=21723\n\n(258) https://bugs.python.org/issue?@action=redirect&bpo=21711\n\n(259) https://bugs.python.org/issue?@action=redirect&bpo=17552\n\n(260) https://bugs.python.org/issue?@action=redirect&bpo=18039\n\n(261) https://bugs.python.org/issue?@action=redirect&bpo=21326\n\n(262) https://bugs.python.org/issue?@action=redirect&bpo=21766\n\n(263) https://bugs.python.org/issue?@action=redirect&bpo=21310\n\n(264) https://bugs.python.org/issue?@action=redirect&bpo=21256\n\n(265) https://bugs.python.org/issue?@action=redirect&bpo=21677\n\n(266) https://bugs.python.org/issue?@action=redirect&bpo=11709\n\n(267) https://bugs.python.org/issue?@action=redirect&bpo=21515\n\n(268) https://bugs.python.org/issue?@action=redirect&bpo=13223\n\n(269) https://bugs.python.org/issue?@action=redirect&bpo=21463\n\n(270) https://bugs.python.org/issue?@action=redirect&bpo=21618\n\n(271) https://bugs.python.org/issue?@action=redirect&bpo=20383\n\n(272) https://bugs.python.org/issue?@action=redirect&bpo=21552\n\n(273) https://bugs.python.org/issue?@action=redirect&bpo=14315\n\n(274) https://bugs.python.org/issue?@action=redirect&bpo=13742\n\n(275) https://bugs.python.org/issue?@action=redirect&bpo=21402\n\n(276) https://bugs.python.org/issue?@action=redirect&bpo=3015\n\n(277) https://bugs.python.org/issue?@action=redirect&bpo=10203\n\n(278) https://bugs.python.org/issue?@action=redirect&bpo=18807\n\n(279) https://bugs.python.org/issue?@action=redirect&bpo=20197\n\n(280) https://bugs.python.org/issue?@action=redirect&bpo=21513\n\n(281) https://bugs.python.org/issue?@action=redirect&bpo=21137\n\n(282) https://bugs.python.org/issue?@action=redirect&bpo=21538\n\n(283) https://bugs.python.org/issue?@action=redirect&bpo=21455\n\n(284) https://bugs.python.org/issue?@action=redirect&bpo=21525\n\n(285) https://bugs.python.org/issue?@action=redirect&bpo=22166\n\n(286) https://bugs.python.org/issue?@action=redirect&bpo=22236\n\n(287) https://bugs.python.org/issue?@action=redirect&bpo=10744\n\n(288) https://peps.python.org/pep-3118/\n\n(289) https://bugs.python.org/issue?@action=redirect&bpo=20826\n\n(290) https://bugs.python.org/issue?@action=redirect&bpo=21487\n\n(291) https://bugs.python.org/issue?@action=redirect&bpo=21486\n\n(292) https://bugs.python.org/issue?@action=redirect&bpo=13916\n\n(293) https://bugs.python.org/issue?@action=redirect&bpo=20998\n\n(294) https://bugs.python.org/issue?@action=redirect&bpo=21075\n\n(295) https://bugs.python.org/issue?@action=redirect&bpo=19775\n\n(296) https://bugs.python.org/issue?@action=redirect&bpo=21226\n\n(297) https://bugs.python.org/issue?@action=redirect&bpo=21398\n\n(298) https://bugs.python.org/issue?@action=redirect&bpo=16531\n\n(299) https://bugs.python.org/issue?@action=redirect&bpo=21156\n\n(300) https://bugs.python.org/issue?@action=redirect&bpo=21424\n\n(301) https://bugs.python.org/issue?@action=redirect&bpo=21396\n\n(302) https://bugs.python.org/issue?@action=redirect&bpo=18314\n\n(303) https://bugs.python.org/issue?@action=redirect&bpo=21088\n\n(304) https://bugs.python.org/issue?@action=redirect&bpo=21407\n\n(305) https://bugs.python.org/issue?@action=redirect&bpo=10650\n\n(306) https://bugs.python.org/issue?@action=redirect&bpo=21469\n\n(307) https://bugs.python.org/issue?@action=redirect&bpo=19414\n\n(308) https://bugs.python.org/issue?@action=redirect&bpo=21421\n\n(309) https://bugs.python.org/issue?@action=redirect&bpo=21101\n\n(310) https://bugs.python.org/issue?@action=redirect&bpo=21321\n\n(311) https://bugs.python.org/issue?@action=redirect&bpo=21057\n\n(312) https://bugs.python.org/issue?@action=redirect&bpo=20951\n\n(313) https://bugs.python.org/issue?@action=redirect&bpo=13248\n\n(314) https://bugs.python.org/issue?@action=redirect&bpo=9815\n\n(315) https://bugs.python.org/issue?@action=redirect&bpo=19940\n\n(316) https://bugs.python.org/issue?@action=redirect&bpo=13204\n\n(317) https://bugs.python.org/issue?@action=redirect&bpo=19385\n\n(318) https://bugs.python.org/issue?@action=redirect&bpo=21207\n\n(319) https://bugs.python.org/issue?@action=redirect&bpo=21291\n\n(320) https://bugs.python.org/issue?@action=redirect&bpo=21127\n\n(321) https://bugs.python.org/issue?@action=redirect&bpo=15002\n\n(322) https://bugs.python.org/issue?@action=redirect&bpo=12220\n\n(323) https://bugs.python.org/issue?@action=redirect&bpo=21068\n\n(324) https://bugs.python.org/issue?@action=redirect&bpo=21276\n\n(325) https://bugs.python.org/issue?@action=redirect&bpo=21262\n\n(326) https://bugs.python.org/issue?@action=redirect&bpo=21238\n\n(327) https://bugs.python.org/issue?@action=redirect&bpo=20896\n\n(328) https://bugs.python.org/issue?@action=redirect&bpo=21239\n\n(329) https://bugs.python.org/issue?@action=redirect&bpo=21203\n\n(330) https://bugs.python.org/issue?@action=redirect&bpo=21222\n\n(331) https://bugs.python.org/issue?@action=redirect&bpo=21197\n\n(332) https://bugs.python.org/issue?@action=redirect&bpo=17498\n\n(333) https://bugs.python.org/issue?@action=redirect&bpo=17826\n\n(334) https://bugs.python.org/issue?@action=redirect&bpo=7776\n\n(335) https://bugs.python.org/issue?@action=redirect&bpo=20968\n\n(336) https://bugs.python.org/issue?@action=redirect&bpo=21529\n\n(337) https://bugs.python.org/issue?@action=redirect&bpo=21169\n\n(338) https://bugs.python.org/issue?@action=redirect&bpo=21171\n\n(339) https://bugs.python.org/issue?@action=redirect&bpo=20539\n\n(340) https://bugs.python.org/issue?@action=redirect&bpo=21172\n\n(341) https://bugs.python.org/issue?@action=redirect&bpo=21155\n\n(342) https://bugs.python.org/issue?@action=redirect&bpo=21136\n\n(343) https://bugs.python.org/issue?@action=redirect&bpo=17621\n\n(344) https://bugs.python.org/issue?@action=redirect&bpo=21076\n\n(345) https://bugs.python.org/issue?@action=redirect&bpo=20636\n\n(346) https://bugs.python.org/issue?@action=redirect&bpo=19505\n\n(347) https://bugs.python.org/issue?@action=redirect&bpo=21149\n\n(348) https://bugs.python.org/issue?@action=redirect&bpo=21058\n\n(349) https://bugs.python.org/issue?@action=redirect&bpo=21200\n\n(350) https://bugs.python.org/issue?@action=redirect&bpo=21013\n\n(351) https://bugs.python.org/issue?@action=redirect&bpo=20145\n\n(352) https://bugs.python.org/issue?@action=redirect&bpo=20633\n\n(353) https://bugs.python.org/issue?@action=redirect&bpo=20980\n\n(354) https://bugs.python.org/issue?@action=redirect&bpo=21082\n\n(355) https://bugs.python.org/issue?@action=redirect&bpo=20990\n\n(356) https://bugs.python.org/issue?@action=redirect&bpo=21015\n\n(357) https://bugs.python.org/issue?@action=redirect&bpo=21000\n\n(358) https://bugs.python.org/issue?@action=redirect&bpo=20995\n\n(359) https://bugs.python.org/issue?@action=redirect&bpo=20884\n\n(360) https://bugs.python.org/issue?@action=redirect&bpo=21499\n\n(361) https://bugs.python.org/issue?@action=redirect&bpo=20627\n\n(362) https://bugs.python.org/issue?@action=redirect&bpo=19165\n\n(363) https://bugs.python.org/issue?@action=redirect&bpo=13936\n\n(364) https://bugs.python.org/issue?@action=redirect&bpo=18931\n\n(365) https://bugs.python.org/issue?@action=redirect&bpo=19977\n\n(366) https://bugs.python.org/issue?@action=redirect&bpo=20574\n\n(367) https://bugs.python.org/issue?@action=redirect&bpo=20879\n\n(368) https://bugs.python.org/issue?@action=redirect&bpo=19157\n\n(369) https://bugs.python.org/issue?@action=redirect&bpo=11599\n\n(370) https://bugs.python.org/issue?@action=redirect&bpo=4931\n\n(371) https://bugs.python.org/issue?@action=redirect&bpo=20875\n\n(372) https://bugs.python.org/issue?@action=redirect&bpo=11558\n\n(373) https://bugs.python.org/issue?@action=redirect&bpo=20283\n\n(374) https://bugs.python.org/issue?@action=redirect&bpo=20778\n\n(375) https://bugs.python.org/issue?@action=redirect&bpo=20791\n\n(376) https://bugs.python.org/issue?@action=redirect&bpo=19748\n\n(377) https://bugs.python.org/issue?@action=redirect&bpo=19573\n\n(378) https://bugs.python.org/issue?@action=redirect&bpo=20726\n\n(379) https://bugs.python.org/issue?@action=redirect&bpo=17373\n\n(380) https://bugs.python.org/issue?@action=redirect&bpo=20378\n\n(381) https://bugs.python.org/issue?@action=redirect&bpo=20816\n\n(382) https://bugs.python.org/issue?@action=redirect&bpo=20817\n\n(383) https://bugs.python.org/issue?@action=redirect&bpo=6676\n\n(384) https://bugs.python.org/issue?@action=redirect&bpo=21117\n\n(385) https://bugs.python.org/issue?@action=redirect&bpo=20334\n\n(386) https://bugs.python.org/issue?@action=redirect&bpo=15916\n\n(387) https://bugs.python.org/issue?@action=redirect&bpo=21209\n\n(388) https://bugs.python.org/issue?@action=redirect&bpo=163\n\n(389) https://bugs.python.org/issue?@action=redirect&bpo=21311\n\n(390) https://bugs.python.org/issue?@action=redirect&bpo=11571\n\n(391) https://bugs.python.org/issue?@action=redirect&bpo=21801\n\n(392) https://bugs.python.org/issue?@action=redirect&bpo=21923\n\n(393) https://bugs.python.org/issue?@action=redirect&bpo=21323\n\n(394) https://bugs.python.org/issue?@action=redirect&bpo=19435\n\n(395) https://bugs.python.org/issue?@action=redirect&bpo=22733\n\n(396) https://bugs.python.org/issue?@action=redirect&bpo=23302\n\nFile: python3.12.info,  Node: IDLE<56>,  Next: Build<82>,  Prev: Library<91>,  Up: Python 3 5 0 alpha 1\n\n1.22.104.3 IDLE\n...............\n\n- bpo-20577(1): Configuration of the max line length for the\nFormatParagraph extension has been moved from the General tab of\nthe Idle preferences dialog to the FormatParagraph tab of the\nConfig Extensions dialog.  Patch by Tal Einat.\n\n- bpo-16893(2): Update Idle doc chapter to match current Idle and add\nnew information.\n\n- bpo-3068(3): Add Idle extension configuration dialog to Options\nmenu.  Changes are written to HOME/.idlerc/config-extensions.cfg.\nOriginal patch by Tal Einat.\n\n- bpo-16233(4): A module browser (File : Class Browser, Alt+C)\nrequires an editor window with a filename.  When Class Browser is\nrequested otherwise, from a shell, output window, or 'Untitled'\neditor, Idle no longer displays an error box.  It now pops up an\nOpen Module box (Alt+M). If a valid name is entered and a module is\nopened, a corresponding browser is also opened.\n\n- bpo-4832(5): Save As to type Python files automatically adds .py to\nthe name you enter (even if your system does not display it).  Some\nsystems automatically add .txt when type is Text files.\n\n- bpo-21986(6): Code objects are not normally pickled by the pickle\nmodule.  To match this, they are no longer pickled when running\nunder Idle.\n\n- bpo-17390(7): Adjust Editor window title; remove 'Python', move\nversion to end.\n\n- bpo-14105(8): Idle debugger breakpoints no longer disappear when\ninserting or deleting lines.\n\n- bpo-17172(9): Turtledemo can now be run from Idle.  Currently, the\nentry is on the Help menu, but it may move to Run.  Patch by\nRamchandra Apt and Lita Cho.\n\n- bpo-21765(10): Add support for non-ascii identifiers to\nHyperParser.\n\n- bpo-21940(11): Add unittest for WidgetRedirector.  Initial patch by\nSaimadhav Heblikar.\n\n- bpo-18592(12): Add unittest for SearchDialogBase.  Patch by Phil\nWebster.\n\n- bpo-21694(13): Add unittest for ParenMatch.  Patch by Saimadhav\nHeblikar.\n\n- bpo-21686(14): add unittest for HyperParser.  Original patch by\nSaimadhav Heblikar.\n\n- bpo-12387(15): Add missing upper(lower)case versions of default\nWindows key bindings for Idle so Caps Lock does not disable them.\nPatch by Roger Serwy.\n\n- bpo-21695(16): Closing a Find-in-files output window while the\nsearch is still in progress no longer closes Idle.\n\n- bpo-18910(17): Add unittest for textView.  Patch by Phil Webster.\n\n- bpo-18292(18): Add unittest for AutoExpand.  Patch by Saihadhav\nHeblikar.\n\n- bpo-18409(19): Add unittest for AutoComplete.  Patch by Phil\nWebster.\n\n- bpo-21477(20): htest.py - Improve framework, complete set of tests.\nPatches by Saimadhav Heblikar\n\n- bpo-18104(21): Add idlelib/idletest/htest.py with a few sample\ntests to begin consolidating and improving human-validated tests of\nIdle.  Change other files as needed to work with htest.  Running\nthe module as main runs all tests.\n\n- bpo-21139(22): Change default paragraph width to 72, the PEP 8(23)\nrecommendation.\n\n- bpo-21284(24): Paragraph reformat test passes after user changes\nreformat width.\n\n- bpo-17654(25): Ensure IDLE menus are customized properly on OS X\nfor non-framework builds and for all variants of Tk.\n\n- bpo-23180(26): Rename IDLE \"Windows\" menu item to \"Window\".  Patch\nby Al Sweigart.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=20577\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=16893\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=3068\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=16233\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=4832\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=21986\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=17390\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=14105\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=17172\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=21765\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=21940\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=18592\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=21694\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=21686\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=12387\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=21695\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=18910\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=18292\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=18409\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=21477\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=18104\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=21139\n\n(23) https://peps.python.org/pep-0008/\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=21284\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=17654\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=23180\n\nFile: python3.12.info,  Node: Build<82>,  Next: C API<64>,  Prev: IDLE<56>,  Up: Python 3 5 0 alpha 1\n\n1.22.104.4 Build\n................\n\n- bpo-15506(1): Use standard PKGPROGPKGCONFIG autoconf macro in\nthe configure script.\n\n- bpo-22935(2): Allow the ssl module to be compiled if openssl\ndoesn't support SSL 3.\n\n- bpo-22592(3): Drop support of the Borland C compiler to build\nPython.  The distutils module still supports it to build\nextensions.\n\n- bpo-22591(4): Drop support of MS-DOS, especially of the DJGPP\ncompiler (MS-DOS port of GCC).\n\n- bpo-16537(5): Check whether self.extensions is empty in setup.py.\nPatch by Jonathan Hosmer.\n\n- bpo-22359(6): Remove incorrect uses of recursive make.  Patch by\nJonas Wagner.\n\n- bpo-21958(7): Define HAVEROUND when building with Visual Studio\n2013 and above.  Patch by Zachary Turner.\n\n- bpo-18093(8): the programs that embed the CPython runtime are now\nin a separate \"Programs\" directory, rather than being kept in the\nModules directory.\n\n- bpo-15759(9): \"make suspicious\", \"make linkcheck\" and \"make\ndoctest\" in Doc/ now display special message when and only when\nthere are failures.\n\n- bpo-21141(10): The Windows build process no longer attempts to find\nPerl, instead relying on OpenSSL source being configured and ready\nto build.  The 'PCbuild\\buildssl.py' script has been re-written\nand re-named to 'PCbuild\\preparessl.py', and takes care of\nconfiguring OpenSSL source for both 32 and 64 bit platforms.\nOpenSSL sources obtained from svn.python.org will always be\npre-configured and ready to build.\n\n- bpo-21037(11): Add a build option to enable AddressSanitizer\nsupport.\n\n- bpo-19962(12): The Windows build process now creates \"python.bat\"\nin the root of the source tree, which passes all arguments through\nto the most recently built interpreter.\n\n- bpo-21285(13): Refactor and fix curses configure check to always\nsearch in a ncursesw directory.\n\n- bpo-15234(14): For BerkeleyDB and Sqlite, only add the found\nlibrary and include directories if they aren't already being\nsearched.  This avoids an explicit runtime library dependency.\n\n- bpo-17861(15): Tools/scripts/generateopcodeh.py automatically\nregenerates Include/opcode.h from Lib/opcode.py if the latter gets\nany change.\n\n- bpo-20644(16): OS X installer build support for documentation build\nchanges in 3.4.1: assume externally supplied sphinx-build is\navailable in /usr/bin.\n\n- bpo-20022(17): Eliminate use of deprecated bundlebuilder in OS X\nbuilds.\n\n- bpo-15968(18): Incorporated Tcl, Tk, and Tix builds into the\nWindows build solution.\n\n- bpo-17095(19): Fix Modules/Setup 'shared' support.\n\n- bpo-21811(20): Anticipated fixes to support OS X versions > 10.9.\n\n- bpo-21166(21): Prevent possible segfaults and other random failures\nof python -generate-posix-vars in pybuilddir.txt build target.\n\n- bpo-18096(22): Fix library order returned by python-config.\n\n- bpo-17219(23): Add library build dir for Python extension\ncross-builds.\n\n- bpo-22919(24): Windows build updated to support VC 14.0 (Visual\nStudio 2015), which will be used for the official release.\n\n- bpo-21236(25): Build msi.pyd with cabinet.lib instead of fci.lib\n\n- bpo-17128(26): Use private version of OpenSSL for OS X 10.5+\ninstaller.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=15506\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=22935\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=22592\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=22591\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=16537\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=22359\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=21958\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=18093\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=15759\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=21141\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=21037\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=19962\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=21285\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=15234\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=17861\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=20644\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=20022\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=15968\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=17095\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=21811\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=21166\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=18096\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=17219\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=22919\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=21236\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=17128\n\nFile: python3.12.info,  Node: C API<64>,  Next: Documentation<75>,  Prev: Build<82>,  Up: Python 3 5 0 alpha 1\n\n1.22.104.5 C API\n................\n\n- bpo-14203(1): Remove obsolete support for view==NULL in\nPyBufferFillInfo(), bytearraygetbuffer(), bytesiobufgetbuffer()\nand arraybuffergetbuf().  All functions now raise BufferError in\nthat case.\n\n- bpo-22445(2): PyBufferIsContiguous() now implements precise\ncontiguity tests, compatible with NumPy's\nNPYRELAXEDSTRIDESCHECKING compilation flag.  Previously the\nfunction reported false negatives for corner cases.\n\n- bpo-22079(3): PyTypeReady() now checks that statically allocated\ntype has no dynamically allocated bases.\n\n- bpo-22453(4): Removed non-documented macro PyObjectREPR().\n\n- bpo-18395(5): Rename 'Pychar2wchar()' to *note PyDecodeLocale():\na0b, rename 'Pywchar2char()' to *note PyEncodeLocale(): a0c, and\ndocument these functions.\n\n- bpo-21233(6): Add new C functions: PyMemRawCalloc(),\nPyMemCalloc(), PyObjectCalloc(), PyObjectGCCalloc().\nbytes(int) is now using 'calloc()' instead of 'malloc()' for large\nobjects which is faster and use less memory.\n\n- bpo-20942(7): PyImportImportFrozenModuleObject() no longer sets\nfile to match what importlib does; this affects\nfrozenimportlib as well as any module loaded using\nimp.initfrozen().\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=14203\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=22445\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=22079\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=22453\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=18395\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=21233\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=20942\n\nFile: python3.12.info,  Node: Documentation<75>,  Next: Tests<77>,  Prev: C API<64>,  Up: Python 3 5 0 alpha 1\n\n1.22.104.6 Documentation\n........................\n\n- bpo-19548(1): Update the codecs module documentation to better\ncover the distinction between text encodings and other codecs,\ntogether with other clarifications.  Patch by Martin Panter.\n\n- bpo-22394(2): Doc/Makefile now supports 'make venv\nPYTHON=../python' to create a venv for generating the\ndocumentation, e.g., 'make html PYTHON=venv/bin/python3'.\n\n- bpo-21514(3): The documentation of the json module now refers to\nnew JSON RFC 7159 instead of obsoleted RFC 4627.\n\n- bpo-21777(4): The binary sequence methods on bytes and bytearray\nare now documented explicitly, rather than assuming users will be\nable to derive the expected behaviour from the behaviour of the\ncorresponding str methods.\n\n- bpo-6916(5): undocument deprecated asynchat.fifo class.\n\n- bpo-17386(6): Expanded functionality of the 'Doc/make.bat' script\nto make it much more comparable to 'Doc/Makefile'.\n\n- bpo-21312(7): Update the threadfoobar.h template file to include\nnewer threading APIs.  Patch by Jack McCracken.\n\n- bpo-21043(8): Remove the recommendation for specific CA\norganizations and to mention the ability to load the OS\ncertificates.\n\n- bpo-20765(9): Add missing documentation for PurePath.withname()\nand PurePath.withsuffix().\n\n- bpo-19407(10): New package installation and distribution guides\nbased on the Python Packaging Authority tools.  Existing guides\nhave been retained as legacy links from the distutils docs, as they\nstill contain some required reference material for tool developers\nthat isn't recorded anywhere else.\n\n- bpo-19697(11): Document cases where main.spec is None.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=19548\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=22394\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=21514\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=21777\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=6916\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=17386\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=21312\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=21043\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=20765\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=19407\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=19697\n\nFile: python3.12.info,  Node: Tests<77>,  Next: Tools/Demos<48>,  Prev: Documentation<75>,  Up: Python 3 5 0 alpha 1\n\n1.22.104.7 Tests\n................\n\n- bpo-18982(1): Add tests for CLI of the calendar module.\n\n- bpo-19548(2): Added some additional checks to testcodecs to ensure\nthat statements in the updated documentation remain accurate.\nPatch by Martin Panter.\n\n- bpo-22838(3): All testre tests now work with unittest test\ndiscovery.\n\n- bpo-22173(4): Update lib2to3 tests to use unittest test discovery.\n\n- bpo-16000(5): Convert testcurses to use unittest.\n\n- bpo-21456(6): Skip two tests in testurllib2net.py if ssl module\nnot present.  Patch by Remi Pointel.\n\n- bpo-20746(7): Fix testpdb to run in refleak mode (-R). Patch by\nXavier de Gaye.\n\n- bpo-22060(8): testctypes has been somewhat cleaned up and\nsimplified; it now uses unittest test discovery to find its tests.\n\n- bpo-22104(9): regrtest.py no longer holds a reference to the suite\nof tests loaded from test modules that don't define testmain().\n\n- bpo-22111(10): Assorted cleanups in testimaplib.  Patch by Milan\nOberkirch.\n\n- bpo-22002(11): Added 'loadpackagetests' function to test.support\nand used it to implement/augment test discovery in testasyncio,\ntestemail, testimportlib, testjson, and testtools.\n\n- bpo-21976(12): Fix testssl to accept LibreSSL version strings.\nThanks to William Orr.\n\n- bpo-21918(13): Converted testtools from a module to a package\ncontaining separate test files for each tested script.\n\n- bpo-9554(14): Use modern unittest features in testargparse.\nInitial patch by Denver Coneybeare and Radu Voicilas.\n\n- bpo-20155(15): Changed HTTP method names in failing tests in\ntesthttpservers so that packet filtering software (specifically\nWindows Base Filtering Engine) does not interfere with the\ntransaction semantics expected by the tests.\n\n- bpo-19493(16): Refactored the ctypes test package to skip tests\nexplicitly rather than silently.\n\n- bpo-18492(17): All resources are now allowed when tests are not run\nby regrtest.py.\n\n- bpo-21634(18): Fix pystone micro-benchmark: use floor division\ninstead of true division to benchmark integers instead of floating\npoint numbers.  Set pystone version to 1.2.  Patch written by\nLennart Regebro.\n\n- bpo-21605(19): Added tests for Tkinter images.\n\n- bpo-21493(20): Added test for ntpath.expanduser().  Original patch\nby Claudiu Popa.\n\n- bpo-19925(21): Added tests for the spwd module.  Original patch by\nVajrasky Kok.\n\n- bpo-21522(22): Added Tkinter tests for Listbox.itemconfigure(),\nPanedWindow.paneconfigure(), and Menu.entryconfigure().\n\n- bpo-17756(23): Fix testcode test when run from the installed\nlocation.\n\n- bpo-17752(24): Fix distutils tests when run from the installed\nlocation.\n\n- bpo-18604(25): Consolidated checks for GUI availability.  All\nplatforms now at least check whether Tk can be instantiated when\nthe GUI resource is requested.\n\n- bpo-21275(26): Fix a socket test on KFreeBSD.\n\n- bpo-21223(27): Pass testsite/teststartupimports when some of the\nextensions are built as builtins.\n\n- bpo-20635(28): Added tests for Tk geometry managers.\n\n- Add test case for freeze.\n\n- bpo-20743(29): Fix a reference leak in testtcl.\n\n- bpo-21097(30): Move testnamespacepkgs into testimportlib.\n\n- bpo-21503(31): Use testboth() consistently in testimportlib.\n\n- bpo-20939(32): Avoid various network test failures due to new\nredirect of 'http://www.python.org/' to 'https://www.python.org':\nuse 'http://www.example.com' instead.\n\n- bpo-20668(33): asyncio tests no longer rely on tests.txt file.\n(Patch by Vajrasky Kok)\n\n- bpo-21093(34): Prevent failures of ctypes testmacholib on OS X if\na copy of libz exists in $HOME/lib or /usr/local/lib.\n\n- bpo-22770(35): Prevent some Tk segfaults on OS X when running gui\ntests.\n\n- bpo-23211(36): Workaround testlogging failure on some OS X 10.6\nsystems.\n\n- bpo-23345(37): Prevent testssl failures with large OpenSSL patch\nlevel values (like 0.9.8zc).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=18982\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=19548\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=22838\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=22173\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=16000\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=21456\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=20746\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=22060\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=22104\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=22111\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=22002\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=21976\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=21918\n\n(14) https://bugs.python.org/issue?@action=redirect&bpo=9554\n\n(15) https://bugs.python.org/issue?@action=redirect&bpo=20155\n\n(16) https://bugs.python.org/issue?@action=redirect&bpo=19493\n\n(17) https://bugs.python.org/issue?@action=redirect&bpo=18492\n\n(18) https://bugs.python.org/issue?@action=redirect&bpo=21634\n\n(19) https://bugs.python.org/issue?@action=redirect&bpo=21605\n\n(20) https://bugs.python.org/issue?@action=redirect&bpo=21493\n\n(21) https://bugs.python.org/issue?@action=redirect&bpo=19925\n\n(22) https://bugs.python.org/issue?@action=redirect&bpo=21522\n\n(23) https://bugs.python.org/issue?@action=redirect&bpo=17756\n\n(24) https://bugs.python.org/issue?@action=redirect&bpo=17752\n\n(25) https://bugs.python.org/issue?@action=redirect&bpo=18604\n\n(26) https://bugs.python.org/issue?@action=redirect&bpo=21275\n\n(27) https://bugs.python.org/issue?@action=redirect&bpo=21223\n\n(28) https://bugs.python.org/issue?@action=redirect&bpo=20635\n\n(29) https://bugs.python.org/issue?@action=redirect&bpo=20743\n\n(30) https://bugs.python.org/issue?@action=redirect&bpo=21097\n\n(31) https://bugs.python.org/issue?@action=redirect&bpo=21503\n\n(32) https://bugs.python.org/issue?@action=redirect&bpo=20939\n\n(33) https://bugs.python.org/issue?@action=redirect&bpo=20668\n\n(34) https://bugs.python.org/issue?@action=redirect&bpo=21093\n\n(35) https://bugs.python.org/issue?@action=redirect&bpo=22770\n\n(36) https://bugs.python.org/issue?@action=redirect&bpo=23211\n\n(37) https://bugs.python.org/issue?@action=redirect&bpo=23345\n\nFile: python3.12.info,  Node: Tools/Demos<48>,  Next: Windows<70>,  Prev: Tests<77>,  Up: Python 3 5 0 alpha 1\n\n1.22.104.8 Tools/Demos\n......................\n\n- bpo-22314(1): pydoc now works when the LINES environment variable\nis set.\n\n- bpo-22615(2): Argument Clinic now supports the \"type\" argument for\nthe int converter.  This permits using the int converter with enums\nand typedefs.\n\n- bpo-20076(3): The makelocalealias.py script no longer ignores UTF-8\nmapping.\n\n- bpo-20079(4): The makelocalealias.py script now can parse the\nSUPPORTED file from glibc sources and supports command line options\nfor source paths.\n\n- bpo-22201(5): Command-line interface of the zipfile module now\ncorrectly extracts ZIP files with directory entries.  Patch by Ryan\nWilson.\n\n- bpo-22120(6): For functions using an unsigned integer return\nconverter, Argument Clinic now generates a cast to that type for\nthe comparison to -1 in the generated code.  (This suppresses a\ncompilation warning.)\n\n- bpo-18974(7): Tools/scripts/diff.py now uses argparse instead of\noptparse.\n\n- bpo-21906(8): Make Tools/scripts/md5sum.py work in Python 3.  Patch\nby Zachary Ware.\n\n- bpo-21629(9): Fix Argument Clinic's \"-converters\" feature.\n\n- Add support for 'yield from' to 2to3.\n\n- Add support for the PEP 465(10) matrix multiplication operator to\n2to3.\n\n- bpo-16047(11): Fix module exception list and file handling in\nfreeze.  Patch by Meador Inge.\n\n- bpo-11824(12): Consider ABI tags in freeze.  Patch by Meador Inge.\n\n- bpo-20535(13): PYTHONWARNING no longer affects the runtests.py\nscript.  Patch by Arfrever Frehtes Taifersar Arahesis.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=22314\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=22615\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=20076\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=20079\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=22201\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=22120\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=18974\n\n(8) https://bugs.python.org/issue?@action=redirect&bpo=21906\n\n(9) https://bugs.python.org/issue?@action=redirect&bpo=21629\n\n(10) https://peps.python.org/pep-0465/\n\n(11) https://bugs.python.org/issue?@action=redirect&bpo=16047\n\n(12) https://bugs.python.org/issue?@action=redirect&bpo=11824\n\n(13) https://bugs.python.org/issue?@action=redirect&bpo=20535\n\nFile: python3.12.info,  Node: Windows<70>,  Prev: Tools/Demos<48>,  Up: Python 3 5 0 alpha 1\n\n1.22.104.9 Windows\n..................\n\n- bpo-23260(1): Update Windows installer\n\n- The bundled version of Tcl/Tk has been updated to 8.6.3.  The most\nvisible result of this change is the addition of new native file\ndialogs when running on Windows Vista or newer.  See Tcl/Tk's TIP\n432 for more information.  Also, this version of Tcl/Tk includes\nsupport for Windows 10.\n\n- bpo-17896(2): The Windows build scripts now expect external library\nsources to be in 'PCbuild\\..\\externals' rather than\n'PCbuild\\..\\..'.\n\n- bpo-17717(3): The Windows build scripts now use a copy of NASM\npulled from svn.python.org to build OpenSSL.\n\n- bpo-21907(4): Improved the batch scripts provided for building\nPython.\n\n- bpo-22644(5): The bundled version of OpenSSL has been updated to\n1.0.1j.\n\n- bpo-10747(6): Use versioned labels in the Windows start menu.\nPatch by Olive Kilburn.\n\n- bpo-22980(7): .pyd files with a version and platform tag (for\nexample, \".cp35-win32.pyd\") will now be loaded in preference to\nthose without tags.\n\n'(For information about older versions, consult the HISTORY file.)'\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=23260\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=17896\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=17717\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=21907\n\n(5) https://bugs.python.org/issue?@action=redirect&bpo=22644\n\n(6) https://bugs.python.org/issue?@action=redirect&bpo=10747\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=22980\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The Python Tutorial,  Next: Python Setup and Usage,  Prev: What's New in Python,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "2 The Python Tutorial": {
            "content": "",
            "subsections": []
        },
        "Python is an easy to learn, powerful programming language.  It has": {
            "content": "efficient high-level data structures and a simple but effective approach\nto object-oriented programming.  Python's elegant syntax and dynamic\ntyping, together with its interpreted nature, make it an ideal language\nfor scripting and rapid application development in many areas on most\nplatforms.\n",
            "subsections": []
        },
        "The Python interpreter and the extensive standard library are freely": {
            "content": "available in source or binary form for all major platforms from the",
            "subsections": []
        },
        "Python web site, 'https://www.python.org/', and may be freely": {
            "content": "distributed.  The same site also contains distributions of and pointers\nto many free third party Python modules, programs and tools, and\nadditional documentation.\n",
            "subsections": []
        },
        "The Python interpreter is easily extended with new functions and data": {
            "content": "types implemented in C or C++ (or other languages callable from C).",
            "subsections": []
        },
        "Python is also suitable as an extension language for customizable": {
            "content": "applications.\n",
            "subsections": []
        },
        "This tutorial introduces the reader informally to the basic concepts and": {
            "content": "features of the Python language and system.  It helps to have a Python\ninterpreter handy for hands-on experience, but all examples are\nself-contained, so the tutorial can be read off-line as well.\n\nFor a description of standard objects and modules, see *note The Python\nStandard Library: 13d.  *note The Python Language Reference: 13e. gives\na more formal definition of the language.  To write extensions in C or\nC++, read *note Extending and Embedding the Python Interpreter: 195e.\nand *note Python/C API Reference Manual: 195f.  There are also several\nbooks covering Python in depth.\n",
            "subsections": []
        },
        "This tutorial does not attempt to be comprehensive and cover every": {
            "content": "single feature, or even every commonly used feature.  Instead, it\nintroduces many of Python's most noteworthy features, and will give you\na good idea of the language's flavor and style.  After reading it, you\nwill be able to read and write Python modules and programs, and you will\nbe ready to learn more about the various Python library modules\ndescribed in *note The Python Standard Library: 13d.\n\nThe *note Glossary: 1960. is also worth going through.\n\n* Menu:\n\n* Whetting Your Appetite::\n* Using the Python Interpreter::\n* An Informal Introduction to Python::\n* More Control Flow Tools::\n* Data Structures::\n* Modules: Modules<2>.\n* Input and Output::\n* Errors and Exceptions::\n* Classes::\n* Brief Tour of the Standard Library::\n* Brief Tour of the Standard Library -- Part II::\n* Virtual Environments and Packages::\n* What Now?::\n* Interactive Input Editing and History Substitution::\n* Floating Point Arithmetic; Issues and Limitations: Floating Point Arithmetic Issues and Limitations.\n* Appendix::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Whetting Your Appetite,  Next: Using the Python Interpreter,  Up: The Python Tutorial": {
            "content": "",
            "subsections": [
                {
                    "name": "2.1 Whetting Your Appetite",
                    "content": ""
                }
            ]
        },
        "If you do much work on computers, eventually you find that there's some": {
            "content": "task you'd like to automate.  For example, you may wish to perform a\nsearch-and-replace over a large number of text files, or rename and\nrearrange a bunch of photo files in a complicated way.  Perhaps you'd\nlike to write a small custom database, or a specialized GUI application,\nor a simple game.\n",
            "subsections": []
        },
        "If you're a professional software developer, you may have to work with": {
            "content": "several C/C++/Java libraries but find the usual\nwrite/compile/test/re-compile cycle is too slow.  Perhaps you're writing\na test suite for such a library and find writing the testing code a\ntedious task.  Or maybe you've written a program that could use an\nextension language, and you don't want to design and implement a whole\nnew language for your application.\n\nPython is just the language for you.\n",
            "subsections": []
        },
        "You could write a Unix shell script or Windows batch files for some of": {
            "content": "these tasks, but shell scripts are best at moving around files and\nchanging text data, not well-suited for GUI applications or games.  You\ncould write a C/C++/Java program, but it can take a lot of development\ntime to get even a first-draft program.  Python is simpler to use,\navailable on Windows, macOS, and Unix operating systems, and will help\nyou get the job done more quickly.\n",
            "subsections": []
        },
        "Python is simple to use, but it is a real programming language, offering": {
            "content": "much more structure and support for large programs than shell scripts or\nbatch files can offer.  On the other hand, Python also offers much more\nerror checking than C, and, being a 'very-high-level language', it has\nhigh-level data types built in, such as flexible arrays and\ndictionaries.  Because of its more general data types Python is\napplicable to a much larger problem domain than Awk or even Perl, yet\nmany things are at least as easy in Python as in those languages.\n",
            "subsections": []
        },
        "Python allows you to split your program into modules that can be reused": {
            "content": "in other Python programs.  It comes with a large collection of standard\nmodules that you can use as the basis of your programs -- or as examples\nto start learning to program in Python.  Some of these modules provide\nthings like file I/O, system calls, sockets, and even interfaces to\ngraphical user interface toolkits like Tk.\n",
            "subsections": []
        },
        "Python is an interpreted language, which can save you considerable time": {
            "content": "during program development because no compilation and linking is\nnecessary.  The interpreter can be used interactively, which makes it\neasy to experiment with features of the language, to write throw-away\nprograms, or to test functions during bottom-up program development.  It\nis also a handy desk calculator.\n",
            "subsections": []
        },
        "Python enables programs to be written compactly and readably.  Programs": {
            "content": "written in Python are typically much shorter than equivalent C, C++, or\nJava programs, for several reasons:\n\n* the high-level data types allow you to express complex operations\nin a single statement;\n\n* statement grouping is done by indentation instead of beginning and\nending brackets;\n\n* no variable or argument declarations are necessary.\n",
            "subsections": []
        },
        "Python is 'extensible': if you know how to program in C it is easy to": {
            "content": "add a new built-in function or module to the interpreter, either to\nperform critical operations at maximum speed, or to link Python programs\nto libraries that may only be available in binary form (such as a\nvendor-specific graphics library).  Once you are really hooked, you can\nlink the Python interpreter into an application written in C and use it\nas an extension or command language for that application.\n\nBy the way, the language is named after the BBC show \"Monty Python's\nFlying Circus\" and has nothing to do with reptiles.  Making references\nto Monty Python skits in documentation is not only allowed, it is\nencouraged!\n",
            "subsections": []
        },
        "Now that you are all excited about Python, you'll want to examine it in": {
            "content": "some more detail.  Since the best way to learn a language is to use it,\nthe tutorial invites you to play with the Python interpreter as you\nread.\n",
            "subsections": []
        },
        "In the next chapter, the mechanics of using the interpreter are": {
            "content": "explained.  This is rather mundane information, but essential for trying\nout the examples shown later.\n",
            "subsections": []
        },
        "The rest of the tutorial introduces various features of the Python": {
            "content": "language and system through examples, beginning with simple expressions,\nstatements and data types, through functions and modules, and finally\ntouching upon advanced concepts like exceptions and user-defined\nclasses.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using the Python Interpreter,  Next: An Informal Introduction to Python,  Prev: Whetting Your Appetite,  Up: The Python Tutorial": {
            "content": "",
            "subsections": [
                {
                    "name": "2.2 Using the Python Interpreter",
                    "content": "* Menu:\n\n* Invoking the Interpreter::\n* The Interpreter and Its Environment::\n"
                }
            ]
        },
        "File: python3.12.info,  Node: Invoking the Interpreter,  Next: The Interpreter and Its Environment,  Up: Using the Python Interpreter": {
            "content": "",
            "subsections": []
        },
        "The Python interpreter is usually installed as": {
            "content": "'/usr/local/bin/python3.12' on those machines where it is available;\nputting '/usr/local/bin' in your Unix shell's search path makes it\npossible to start it by typing the command:\n\npython3.12\n\nto the shell.  (1)  Since the choice of the directory where the\ninterpreter lives is an installation option, other places are possible;\ncheck with your local Python guru or system administrator.  (E.g.,\n'/usr/local/python' is a popular alternative location.)\n\nOn Windows machines where you have installed Python from the *note",
            "subsections": []
        },
        "Microsoft Store: 1969, the 'python3.12' command will be available.  If": {
            "content": "you have the *note py.exe launcher: 37f. installed, you can use the 'py'\ncommand.  See *note Excursus; Setting environment variables: 196a. for\nother ways to launch Python.\n",
            "subsections": []
        },
        "Typing an end-of-file character ('Control-D' on Unix, 'Control-Z' on": {
            "content": "",
            "subsections": []
        },
        "Windows) at the primary prompt causes the interpreter to exit with a": {
            "content": "zero exit status.  If that doesn't work, you can exit the interpreter by\ntyping the following command: 'quit()'.\n",
            "subsections": []
        },
        "The interpreter's line-editing features include interactive editing,": {
            "content": "history substitution and code completion on systems that support the GNU",
            "subsections": []
        },
        "Readline(2) library.  Perhaps the quickest check to see whether command": {
            "content": "line editing is supported is typing 'Control-P' to the first Python\nprompt you get.  If it beeps, you have command line editing; see\nAppendix *note Interactive Input Editing and History Substitution: 196b.\nfor an introduction to the keys.  If nothing appears to happen, or if\n'^P' is echoed, command line editing isn't available; you'll only be\nable to use backspace to remove characters from the current line.\n",
            "subsections": []
        },
        "The interpreter operates somewhat like the Unix shell: when called with": {
            "content": "standard input connected to a tty device, it reads and executes commands\ninteractively; when called with a file name argument or with a file as\nstandard input, it reads and executes a 'script' from that file.\n\nA second way of starting the interpreter is 'python -c command [arg]\n...', which executes the statement(s) in 'command', analogous to the\nshell's *note -c: 3a4. option.  Since Python statements often contain\nspaces or other characters that are special to the shell, it is usually\nadvised to quote 'command' in its entirety.\n",
            "subsections": []
        },
        "Some Python modules are also useful as scripts.  These can be invoked": {
            "content": "using 'python -m module [arg] ...', which executes the source file for\n'module' as if you had spelled out its full name on the command line.\n",
            "subsections": []
        },
        "When a script file is used, it is sometimes useful to be able to run the": {
            "content": "script and enter interactive mode afterwards.  This can be done by\npassing *note -i: 1336. before the script.\n\nAll command line options are described in *note Command line and\nenvironment: 172e.\n\n* Menu:\n\n* Argument Passing::\n* Interactive Mode::\n\n---------- Footnotes ----------\n\n(1) On Unix, the Python 3.x interpreter is by default not installed\nwith the executable named 'python', so that it does not conflict with a\nsimultaneously installed Python 2.x executable.\n\n(2) https://tiswww.case.edu/php/chet/readline/rltop.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Argument Passing,  Next: Interactive Mode,  Up: Invoking the Interpreter": {
            "content": "2.2.1.1 Argument Passing\n........................\n",
            "subsections": []
        },
        "When known to the interpreter, the script name and additional arguments": {
            "content": "thereafter are turned into a list of strings and assigned to the 'argv'\nvariable in the 'sys' module.  You can access this list by executing\n'import sys'.  The length of the list is at least one; when no script\nand no arguments are given, 'sys.argv[0]' is an empty string.  When the\nscript name is given as ''-'' (meaning standard input), 'sys.argv[0]' is\nset to ''-''.  When *note -c: 3a4. 'command' is used, 'sys.argv[0]' is\nset to ''-c''.  When *note -m: 3a5. 'module' is used, 'sys.argv[0]' is\nset to the full name of the located module.  Options found after *note\n-c: 3a4. 'command' or *note -m: 3a5. 'module' are not consumed by the",
            "subsections": []
        },
        "Python interpreter's option processing but left in 'sys.argv' for the": {
            "content": "command or module to handle.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Interactive Mode,  Prev: Argument Passing,  Up: Invoking the Interpreter": {
            "content": "2.2.1.2 Interactive Mode\n........................\n",
            "subsections": []
        },
        "When commands are read from a tty, the interpreter is said to be in": {
            "content": "'interactive mode'.  In this mode it prompts for the next command with\nthe 'primary prompt', usually three greater-than signs ('>>>'); for\ncontinuation lines it prompts with the 'secondary prompt', by default\nthree dots ('...').  The interpreter prints a welcome message stating\nits version number and a copyright notice before printing the first\nprompt:\n\n$ python3.12\nPython 3.12 (default, April 4 2022, 09:25:04)\n[GCC 10.2.0] on linux\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>>\n",
            "subsections": []
        },
        "Continuation lines are needed when entering a multi-line construct.  As": {
            "content": "an example, take a look at this *note if: 24f. statement:\n\n>>> theworldisflat = True\n>>> if theworldisflat:\n...     print(\"Be careful not to fall off!\")\n...\nBe careful not to fall off!\n\nFor more on interactive mode, see *note Interactive Mode: 196f.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The Interpreter and Its Environment,  Prev: Invoking the Interpreter,  Up: Using the Python Interpreter": {
            "content": "* Menu:\n\n* Source Code Encoding::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Source Code Encoding,  Up: The Interpreter and Its Environment": {
            "content": "2.2.2.1 Source Code Encoding\n............................\n",
            "subsections": []
        },
        "By default, Python source files are treated as encoded in UTF-8.  In": {
            "content": "that encoding, characters of most languages in the world can be used\nsimultaneously in string literals, identifiers and comments -- although\nthe standard library only uses ASCII characters for identifiers, a\nconvention that any portable code should follow.  To display all these\ncharacters properly, your editor must recognize that the file is UTF-8,\nand it must use a font that supports all the characters in the file.\n",
            "subsections": []
        },
        "To declare an encoding other than the default one, a special comment": {
            "content": "line should be added as the 'first' line of the file.  The syntax is as\nfollows:\n\n# -*- coding: encoding -*-\n\nwhere 'encoding' is one of the valid *note codecs: 19. supported by\nPython.\n",
            "subsections": []
        },
        "For example, to declare that Windows-1252 encoding is to be used, the": {
            "content": "first line of your source code file should be:\n\n# -*- coding: cp1252 -*-\n",
            "subsections": []
        },
        "One exception to the 'first line' rule is when the source code starts": {
            "content": "with a *note UNIX \"shebang\" line: 1974.  In this case, the encoding\ndeclaration should be added as the second line of the file.  For\nexample:\n\n#!/usr/bin/env python3\n# -*- coding: cp1252 -*-\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: An Informal Introduction to Python,  Next: More Control Flow Tools,  Prev: Using the Python Interpreter,  Up: The Python Tutorial": {
            "content": "",
            "subsections": [
                {
                    "name": "2.3 An Informal Introduction to Python",
                    "content": ""
                }
            ]
        },
        "In the following examples, input and output are distinguished by the": {
            "content": "presence or absence of prompts (*note >>>: 1978. and *note ...: 1979.): to\nrepeat the example, you must type everything after the prompt, when the\nprompt appears; lines that do not begin with a prompt are output from\nthe interpreter.  Note that a secondary prompt on a line by itself in an\nexample means you must type a blank line; this is used to end a\nmulti-line command.\n",
            "subsections": []
        },
        "Many of the examples in this manual, even those entered at the": {
            "content": "interactive prompt, include comments.  Comments in Python start with the\nhash character, '#', and extend to the end of the physical line.  A\ncomment may appear at the start of a line or following whitespace or\ncode, but not within a string literal.  A hash character within a string\nliteral is just a hash character.  Since comments are to clarify code\nand are not interpreted by Python, they may be omitted when typing in\nexamples.\n\nSome examples:\n\n# this is the first comment\nspam = 1  # and this is the second comment\n# ... and now a third!\ntext = \"# This is not a comment because it's inside quotes.\"\n\n* Menu:\n\n* Using Python as a Calculator::\n* First Steps Towards Programming::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using Python as a Calculator,  Next: First Steps Towards Programming,  Up: An Informal Introduction to Python": {
            "content": "",
            "subsections": []
        },
        "Let's try some simple Python commands.  Start the interpreter and wait": {
            "content": "for the primary prompt, '>>>'.  (It shouldn't take long.)\n\n* Menu:\n\n* Numbers::\n* Text::\n* Lists::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Numbers,  Next: Text,  Up: Using Python as a Calculator": {
            "content": "2.3.1.1 Numbers\n...............\n",
            "subsections": []
        },
        "The interpreter acts as a simple calculator: you can type an expression": {
            "content": "at it and it will write the value.  Expression syntax is\nstraightforward: the operators '+', '-', '*' and '/' can be used to\nperform arithmetic; parentheses ('()') can be used for grouping.  For\nexample:\n\n>>> 2 + 2\n4\n>>> 50 - 5*6\n20\n>>> (50 - 5*6) / 4\n5.0\n>>> 8 / 5  # division always returns a floating point number\n1.6\n\nThe integer numbers (e.g.  '2', '4', '20') have type *note int: 17e, the\nones with a fractional part (e.g.  '5.0', '1.6') have type *note float:\n4b7.  We will see more about numeric types later in the tutorial.\n\nDivision ('/') always returns a float.  To do *note floor division: 762.\nand get an integer result you can use the '//' operator; to calculate\nthe remainder you can use '%':\n\n>>> 17 / 3  # classic division returns a float\n5.666666666666667\n>>>\n>>> 17 // 3  # floor division discards the fractional part\n5\n>>> 17 % 3  # the % operator returns the remainder of the division\n2\n>>> 5 * 3 + 2  # floored quotient * divisor + remainder\n17\n",
            "subsections": []
        },
        "With Python, it is possible to use the '' operator to calculate powers": {
            "content": "(1):\n\n>>> 5  2  # 5 squared\n25\n>>> 2  7  # 2 to the power of 7\n128\n\nThe equal sign ('=') is used to assign a value to a variable.\nAfterwards, no result is displayed before the next interactive prompt:\n\n>>> width = 20\n>>> height = 5 * 9\n>>> width * height\n900\n\nIf a variable is not \"defined\" (assigned a value), trying to use it will\ngive you an error:\n\n>>> n  # try to access an undefined variable\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nNameError: name 'n' is not defined\n",
            "subsections": []
        },
        "There is full support for floating point; operators with mixed type": {
            "content": "operands convert the integer operand to floating point:\n\n>>> 4 * 3.75 - 1\n14.0\n",
            "subsections": []
        },
        "In interactive mode, the last printed expression is assigned to the": {
            "content": "variable ''.  This means that when you are using Python as a desk\ncalculator, it is somewhat easier to continue calculations, for example:\n\n>>> tax = 12.5 / 100\n>>> price = 100.50\n>>> price * tax\n12.5625\n>>> price +\n113.0625\n>>> round(, 2)\n113.06\n",
            "subsections": []
        },
        "This variable should be treated as read-only by the user.  Don't": {
            "content": "explicitly assign a value to it -- you would create an independent local\nvariable with the same name masking the built-in variable with its magic\nbehavior.\n\nIn addition to *note int: 17e. and *note float: 4b7, Python supports\nother types of numbers, such as *note Decimal: 5c3. and *note Fraction:\n1a8.  Python also has built-in support for *note complex numbers: 197e,\nand uses the 'j' or 'J' suffix to indicate the imaginary part (e.g.\n'3+5j').\n\n---------- Footnotes ----------\n\n(1) Since '' has higher precedence than '-', '-32' will be\ninterpreted as '-(32)' and thus result in '-9'.  To avoid this and get\n'9', you can use '(-3)2'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Text,  Next: Lists,  Prev: Numbers,  Up: Using Python as a Calculator": {
            "content": "2.3.1.2 Text\n............\n\nPython can manipulate text (represented by type *note str: 157,\nso-called \"strings\") as well as numbers.  This includes characters\n\"'!'\", words \"'rabbit'\", names \"'Paris'\", sentences \"'Got your back.'\",\netc.  \"'Yay! :)'\".  They can be enclosed in single quotes (''...'') or\ndouble quotes ('\"...\"') with the same result (1).\n\n>>> 'spam eggs'  # single quotes\n'spam eggs'\n>>> \"Paris rabbit got your back :)! Yay!\"  # double quotes\n'Paris rabbit got your back :)! Yay!'\n>>> '1975'  # digits and numerals enclosed in quotes are also strings\n'1975'\n\nTo quote a quote, we need to \"escape\" it, by preceding it with '\\'.\nAlternatively, we can use the other type of quotation marks:\n\n>>> 'doesn\\'t'  # use \\' to escape the single quote...\n\"doesn't\"\n>>> \"doesn't\"  # ...or use double quotes instead\n\"doesn't\"\n>>> '\"Yes,\" they said.'\n'\"Yes,\" they said.'\n>>> \"\\\"Yes,\\\" they said.\"\n'\"Yes,\" they said.'\n>>> '\"Isn\\'t,\" they said.'\n'\"Isn\\'t,\" they said.'\n",
            "subsections": []
        },
        "In the Python shell, the string definition and output string can look": {
            "content": "different.  The *note print(): de5. function produces a more readable\noutput, by omitting the enclosing quotes and by printing escaped and\nspecial characters:\n\n>>> s = 'First line.\\nSecond line.'  # \\n means newline\n>>> s  # without print(), special characters are included in the string\n'First line.\\nSecond line.'\n>>> print(s)  # with print(), special characters are interpreted, so \\n produces new line\nFirst line.\nSecond line.\n\nIf you don't want characters prefaced by '\\' to be interpreted as\nspecial characters, you can use 'raw strings' by adding an 'r' before\nthe first quote:\n\n>>> print('C:\\some\\name')  # here \\n means newline!\nC:\\some\name\n>>> print(r'C:\\some\\name')  # note the r before the quote\nC:\\some\\name\n",
            "subsections": []
        },
        "There is one subtle aspect to raw strings: a raw string may not end in": {
            "content": "an odd number of '\\' characters; see *note the FAQ entry: 1981. for more\ninformation and workarounds.\n",
            "subsections": []
        },
        "String literals can span multiple lines.  One way is using": {
            "content": "triple-quotes: '\"\"\"...\"\"\"' or ''''...''''.  End of lines are\nautomatically included in the string, but it's possible to prevent this\nby adding a '\\' at the end of the line.  The following example:\n\nprint(\"\"\"\\\nUsage: thingy [OPTIONS]\n-h                        Display this usage message\n-H hostname               Hostname to connect to\n\"\"\")\n\nproduces the following output (note that the initial newline is not\nincluded):\n\nUsage: thingy [OPTIONS]\n-h                        Display this usage message\n-H hostname               Hostname to connect to\n\nStrings can be concatenated (glued together) with the '+' operator, and\nrepeated with '*':\n\n>>> # 3 times 'un', followed by 'ium'\n>>> 3 * 'un' + 'ium'\n'unununium'\n",
            "subsections": []
        },
        "Two or more 'string literals' (i.e.  the ones enclosed between quotes)": {
            "content": "next to each other are automatically concatenated.\n\n>>> 'Py' 'thon'\n'Python'\n\nThis feature is particularly useful when you want to break long strings:\n\n>>> text = ('Put several strings within parentheses '\n...         'to have them joined together.')\n>>> text\n'Put several strings within parentheses to have them joined together.'\n",
            "subsections": []
        },
        "This only works with two literals though, not with variables or": {
            "content": "expressions:\n\n>>> prefix = 'Py'\n>>> prefix 'thon'  # can't concatenate a variable and a string literal\nFile \"<stdin>\", line 1\nprefix 'thon'\n^^^^^^\nSyntaxError: invalid syntax\n>>> ('un' * 3) 'ium'\nFile \"<stdin>\", line 1\n('un' * 3) 'ium'\n^^^^^\nSyntaxError: invalid syntax\n",
            "subsections": []
        },
        "If you want to concatenate variables or a variable and a literal, use": {
            "content": "'+':\n\n>>> prefix + 'thon'\n'Python'\n",
            "subsections": []
        },
        "Strings can be 'indexed' (subscripted), with the first character having": {
            "content": "index 0.  There is no separate character type; a character is simply a\nstring of size one:\n\n>>> word = 'Python'\n>>> word[0]  # character in position 0\n'P'\n>>> word[5]  # character in position 5\n'n'\n\nIndices may also be negative numbers, to start counting from the right:\n\n>>> word[-1]  # last character\n'n'\n>>> word[-2]  # second-last character\n'o'\n>>> word[-6]\n'P'\n\nNote that since -0 is the same as 0, negative indices start from -1.\n",
            "subsections": []
        },
        "In addition to indexing, 'slicing' is also supported.  While indexing is": {
            "content": "used to obtain individual characters, 'slicing' allows you to obtain a\nsubstring:\n\n>>> word[0:2]  # characters from position 0 (included) to 2 (excluded)\n'Py'\n>>> word[2:5]  # characters from position 2 (included) to 5 (excluded)\n'tho'\n",
            "subsections": []
        },
        "Slice indices have useful defaults; an omitted first index defaults to": {
            "content": "zero, an omitted second index defaults to the size of the string being\nsliced.\n\n>>> word[:2]   # character from the beginning to position 2 (excluded)\n'Py'\n>>> word[4:]   # characters from position 4 (included) to the end\n'on'\n>>> word[-2:]  # characters from the second-last (included) to the end\n'on'\n\nNote how the start is always included, and the end always excluded.\nThis makes sure that 's[:i] + s[i:]' is always equal to 's':\n\n>>> word[:2] + word[2:]\n'Python'\n>>> word[:4] + word[4:]\n'Python'\n",
            "subsections": []
        },
        "One way to remember how slices work is to think of the indices as": {
            "content": "pointing 'between' characters, with the left edge of the first character\nnumbered 0.  Then the right edge of the last character of a string of\n'n' characters has index 'n', for example:\n\n+---+---+---+---+---+---+\n| P | y | t | h | o | n |\n+---+---+---+---+---+---+\n0   1   2   3   4   5   6\n-6  -5  -4  -3  -2  -1\n",
            "subsections": []
        },
        "The first row of numbers gives the position of the indices 0...6 in the": {
            "content": "string; the second row gives the corresponding negative indices.  The\nslice from 'i' to 'j' consists of all characters between the edges\nlabeled 'i' and 'j', respectively.\n",
            "subsections": []
        },
        "For non-negative indices, the length of a slice is the difference of the": {
            "content": "indices, if both are within bounds.  For example, the length of\n'word[1:3]' is 2.\n\nAttempting to use an index that is too large will result in an error:\n\n>>> word[42]  # the word only has 6 characters\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nIndexError: string index out of range\n",
            "subsections": []
        },
        "However, out of range slice indexes are handled gracefully when used for": {
            "content": "slicing:\n\n>>> word[4:42]\n'on'\n>>> word[42:]\n''\n\nPython strings cannot be changed -- they are *note immutable: 1982.",
            "subsections": []
        },
        "Therefore, assigning to an indexed position in the string results in an": {
            "content": "error:\n\n>>> word[0] = 'J'\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nTypeError: 'str' object does not support item assignment\n>>> word[2:] = 'py'\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nTypeError: 'str' object does not support item assignment\n\nIf you need a different string, you should create a new one:\n\n>>> 'J' + word[1:]\n'Jython'\n>>> word[:2] + 'py'\n'Pypy'\n\nThe built-in function *note len(): 3fb. returns the length of a string:\n\n>>> s = 'supercalifragilisticexpialidocious'\n>>> len(s)\n34\n\nSee also\n........\n\n*note Text Sequence Type -- str: 1983.\n\nStrings are examples of 'sequence types', and support the common\noperations supported by such types.\n\n*note String Methods: 1984.\n\nStrings support a large number of methods for basic transformations\nand searching.\n\n*note f-strings: 7cd.\n\nString literals that have embedded expressions.\n\n*note Format String Syntax: 1205.\n\nInformation about string formatting with *note str.format(): 3ed.\n\n*note printf-style String Formatting: 49c.\n\nThe old formatting operations invoked when strings are the left\noperand of the '%' operator are described in more detail here.\n\n---------- Footnotes ----------\n\n(1) Unlike other languages, special characters such as '\\n' have the\nsame meaning with both single (''...'') and double ('\"...\"') quotes.",
            "subsections": []
        },
        "The only difference between the two is that within single quotes you": {
            "content": "don't need to escape '\"' (but you have to escape '\\'') and vice versa.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Lists,  Prev: Text,  Up: Using Python as a Calculator": {
            "content": "2.3.1.3 Lists\n.............\n",
            "subsections": []
        },
        "Python knows a number of 'compound' data types, used to group together": {
            "content": "other values.  The most versatile is the 'list', which can be written as\na list of comma-separated values (items) between square brackets.  Lists\nmight contain items of different types, but usually the items all have\nthe same type.\n\n>>> squares = [1, 4, 9, 16, 25]\n>>> squares\n[1, 4, 9, 16, 25]\n\nLike strings (and all other built-in *note sequence: 236. types), lists\ncan be indexed and sliced:\n\n>>> squares[0]  # indexing returns the item\n1\n>>> squares[-1]\n25\n>>> squares[-3:]  # slicing returns a new list\n[9, 16, 25]\n\nLists also support operations like concatenation:\n\n>>> squares + [36, 49, 64, 81, 100]\n[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]\n\nUnlike strings, which are *note immutable: 1982, lists are a *note\nmutable: 1987. type, i.e.  it is possible to change their content:\n\n>>> cubes = [1, 8, 27, 65, 125]  # something's wrong here\n>>> 4  3  # the cube of 4 is 64, not 65!\n64\n>>> cubes[3] = 64  # replace the wrong value\n>>> cubes\n[1, 8, 27, 64, 125]\n",
            "subsections": []
        },
        "You can also add new items at the end of the list, by using the": {
            "content": "'list.append()' 'method' (we will see more about methods later):\n\n>>> cubes.append(216)  # add the cube of 6\n>>> cubes.append(7  3)  # and the cube of 7\n>>> cubes\n[1, 8, 27, 64, 125, 216, 343]\n",
            "subsections": []
        },
        "Simple assignment in Python never copies data.  When you assign a list": {
            "content": "to a variable, the variable refers to the 'existing list'.  Any changes\nyou make to the list through one variable will be seen through all other\nvariables that refer to it.:\n\n>>> rgb = [\"Red\", \"Green\", \"Blue\"]\n>>> rgba = rgb\n>>> id(rgb) == id(rgba)  # they reference the same object\nTrue\n>>> rgba.append(\"Alph\")\n>>> rgb\n[\"Red\", \"Green\", \"Blue\", \"Alph\"]\n",
            "subsections": []
        },
        "All slice operations return a new list containing the requested": {
            "content": "elements.  This means that the following slice returns a *note shallow\ncopy: 1988. of the list:\n\n>>> correctrgba = rgba[:]\n>>> correctrgba[-1] = \"Alpha\"\n>>> correctrgba\n[\"Red\", \"Green\", \"Blue\", \"Alpha\"]\n>>> rgba\n[\"Red\", \"Green\", \"Blue\", \"Alph\"]\n",
            "subsections": []
        },
        "Assignment to slices is also possible, and this can even change the size": {
            "content": "of the list or clear it entirely:\n\n>>> letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g']\n>>> letters\n['a', 'b', 'c', 'd', 'e', 'f', 'g']\n>>> # replace some values\n>>> letters[2:5] = ['C', 'D', 'E']\n>>> letters\n['a', 'b', 'C', 'D', 'E', 'f', 'g']\n>>> # now remove them\n>>> letters[2:5] = []\n>>> letters\n['a', 'b', 'f', 'g']\n>>> # clear the list by replacing all the elements with an empty list\n>>> letters[:] = []\n>>> letters\n[]\n\nThe built-in function *note len(): 3fb. also applies to lists:\n\n>>> letters = ['a', 'b', 'c', 'd']\n>>> len(letters)\n4\n",
            "subsections": []
        },
        "It is possible to nest lists (create lists containing other lists), for": {
            "content": "example:\n\n>>> a = ['a', 'b', 'c']\n>>> n = [1, 2, 3]\n>>> x = [a, n]\n>>> x\n[['a', 'b', 'c'], [1, 2, 3]]\n>>> x[0]\n['a', 'b', 'c']\n>>> x[0][1]\n'b'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: First Steps Towards Programming,  Prev: Using Python as a Calculator,  Up: An Informal Introduction to Python": {
            "content": "",
            "subsections": []
        },
        "Of course, we can use Python for more complicated tasks than adding two": {
            "content": "and two together.  For instance, we can write an initial sub-sequence of\nthe Fibonacci series(1) as follows:\n\n>>> # Fibonacci series:\n... # the sum of two elements defines the next\n... a, b = 0, 1\n>>> while a < 10:\n...     print(a)\n...     a, b = b, a+b\n...\n0\n1\n1\n2\n3\n5\n8\n\nThis example introduces several new features.\n\n* The first line contains a 'multiple assignment': the variables 'a'\nand 'b' simultaneously get the new values 0 and 1.  On the last\nline this is used again, demonstrating that the expressions on the\nright-hand side are all evaluated first before any of the\nassignments take place.  The right-hand side expressions are\nevaluated from the left to the right.\n\n* The *note while: 198b. loop executes as long as the condition\n(here: 'a < 10') remains true.  In Python, like in C, any non-zero\ninteger value is true; zero is false.  The condition may also be a\nstring or list value, in fact any sequence; anything with a\nnon-zero length is true, empty sequences are false.  The test used\nin the example is a simple comparison.  The standard comparison\noperators are written the same as in C: '<' (less than), '>'\n(greater than), '==' (equal to), '<=' (less than or equal to), '>='\n(greater than or equal to) and '!=' (not equal to).\n\n* The 'body' of the loop is 'indented': indentation is Python's way\nof grouping statements.  At the interactive prompt, you have to\ntype a tab or space(s) for each indented line.  In practice you\nwill prepare more complicated input for Python with a text editor;\nall decent text editors have an auto-indent facility.  When a\ncompound statement is entered interactively, it must be followed by\na blank line to indicate completion (since the parser cannot guess\nwhen you have typed the last line).  Note that each line within a\nbasic block must be indented by the same amount.\n\n* The *note print(): de5. function writes the value of the\nargument(s) it is given.  It differs from just writing the\nexpression you want to write (as we did earlier in the calculator\nexamples) in the way it handles multiple arguments, floating point\nquantities, and strings.  Strings are printed without quotes, and a\nspace is inserted between items, so you can format things nicely,\nlike this:\n\n>>> i = 256*256\n>>> print('The value of i is', i)\nThe value of i is 65536\n\nThe keyword argument 'end' can be used to avoid the newline after\nthe output, or end the output with a different string:\n\n>>> a, b = 0, 1\n>>> while a < 1000:\n...     print(a, end=',')\n...     a, b = b, a+b\n...\n0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Fibonaccisequence\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: More Control Flow Tools,  Next: Data Structures,  Prev: An Informal Introduction to Python,  Up: The Python Tutorial": {
            "content": "",
            "subsections": [
                {
                    "name": "2.4 More Control Flow Tools",
                    "content": "As well as the *note while: 198b. statement just introduced, Python uses\na few more that we will encounter in this chapter.\n\n* Menu:\n\n* if Statements::\n* for Statements::\n* The range() Function: The range Function.\n* break and continue Statements, and else Clauses on Loops: break and continue Statements and else Clauses on Loops.\n* pass Statements::\n* match Statements::\n* Defining Functions::\n* More on Defining Functions::\n* Intermezzo; Coding Style: Intermezzo Coding Style.\n"
                }
            ]
        },
        "File: python3.12.info,  Node: if Statements,  Next: for Statements,  Up: More Control Flow Tools": {
            "content": "Perhaps the most well-known statement type is the *note if: 24f.\nstatement.  For example:\n\n>>> x = int(input(\"Please enter an integer: \"))\nPlease enter an integer: 42\n>>> if x < 0:\n...     x = 0\n...     print('Negative changed to zero')\n... elif x == 0:\n...     print('Zero')\n... elif x == 1:\n...     print('Single')\n... else:\n...     print('More')\n...\nMore\n\nThere can be zero or more *note elif: 1991. parts, and the *note else:\n24d. part is optional.  The keyword ''elif'' is short for 'else if', and\nis useful to avoid excessive indentation.  An 'if' ... 'elif' ... 'elif' ...\nsequence is a substitute for the 'switch' or 'case' statements found in\nother languages.\n",
            "subsections": []
        },
        "If you're comparing the same value to several constants, or checking for": {
            "content": "specific types or attributes, you may also find the 'match' statement\nuseful.  For more details see *note match Statements: 1992.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: for Statements,  Next: The range Function,  Prev: if Statements,  Up: More Control Flow Tools": {
            "content": "The *note for: 24e. statement in Python differs a bit from what you may\nbe used to in C or Pascal.  Rather than always iterating over an\narithmetic progression of numbers (like in Pascal), or giving the user\nthe ability to define both the iteration step and halting condition (as\nC), Python's 'for' statement iterates over the items of any sequence (a\nlist or a string), in the order that they appear in the sequence.  For\nexample (no pun intended):\n\n>>> # Measure some strings:\n... words = ['cat', 'window', 'defenestrate']\n>>> for w in words:\n...     print(w, len(w))\n...\ncat 3\nwindow 6\ndefenestrate 12\n",
            "subsections": []
        },
        "Code that modifies a collection while iterating over that same": {
            "content": "collection can be tricky to get right.  Instead, it is usually more\nstraight-forward to loop over a copy of the collection or to create a\nnew collection:\n\n# Create a sample collection\nusers = {'Hans': 'active', '??le'onore': 'inactive', '?????????': 'active'}\n\n# Strategy:  Iterate over a copy\nfor user, status in users.copy().items():\nif status == 'inactive':\ndel users[user]\n\n# Strategy:  Create a new collection\nactiveusers = {}\nfor user, status in users.items():\nif status == 'active':\nactiveusers[user] = status\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The range Function,  Next: break and continue Statements and else Clauses on Loops,  Prev: for Statements,  Up: More Control Flow Tools": {
            "content": "",
            "subsections": []
        },
        "If you do need to iterate over a sequence of numbers, the built-in": {
            "content": "function *note range(): 761. comes in handy.  It generates arithmetic\nprogressions:\n\n>>> for i in range(5):\n...     print(i)\n...\n0\n1\n2\n3\n4\n",
            "subsections": []
        },
        "The given end point is never part of the generated sequence; 'range(10)'": {
            "content": "generates 10 values, the legal indices for items of a sequence of length\n10.  It is possible to let the range start at another number, or to\nspecify a different increment (even negative; sometimes this is called\nthe 'step'):\n\n>>> list(range(5, 10))\n[5, 6, 7, 8, 9]\n\n>>> list(range(0, 10, 3))\n[0, 3, 6, 9]\n\n>>> list(range(-10, -100, -30))\n[-10, -40, -70]\n\nTo iterate over the indices of a sequence, you can combine *note\nrange(): 761. and *note len(): 3fb. as follows:\n\n>>> a = ['Mary', 'had', 'a', 'little', 'lamb']\n>>> for i in range(len(a)):\n...     print(i, a[i])\n...\n0 Mary\n1 had\n2 a\n3 little\n4 lamb\n\nIn most such cases, however, it is convenient to use the *note\nenumerate(): 12d5. function, see *note Looping Techniques: 1997.\n\nA strange thing happens if you just print a range:\n\n>>> range(10)\nrange(0, 10)\n\nIn many ways the object returned by *note range(): 761. behaves as if it\nis a list, but in fact it isn't.  It is an object which returns the\nsuccessive items of the desired sequence when you iterate over it, but\nit doesn't really make the list, thus saving space.\n\nWe say such an object is *note iterable: 109d, that is, suitable as a\ntarget for functions and constructs that expect something from which\nthey can obtain successive items until the supply is exhausted.  We have\nseen that the *note for: 24e. statement is such a construct, while an\nexample of a function that takes an iterable is *note sum(): 181.:\n\n>>> sum(range(4))  # 0 + 1 + 2 + 3\n6\n",
            "subsections": []
        },
        "Later we will see more functions that return iterables and take": {
            "content": "iterables as arguments.  In chapter *note Data Structures: 1998, we will\ndiscuss in more detail about *note list(): 3dc.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: break and continue Statements and else Clauses on Loops,  Next: pass Statements,  Prev: The range Function,  Up: More Control Flow Tools": {
            "content": "The *note break: 8de. statement breaks out of the innermost enclosing\n*note for: 24e. or *note while: 198b. loop.\n\nA 'for' or 'while' loop can include an 'else' clause.\n\nIn a *note for: 24e. loop, the 'else' clause is executed after the loop\nreaches its final iteration.\n\nIn a *note while: 198b. loop, it's executed after the loop's condition\nbecomes false.\n",
            "subsections": []
        },
        "In either kind of loop, the 'else' clause is 'not' executed if the loop": {
            "content": "was terminated by a *note break: 8de.\n",
            "subsections": []
        },
        "This is exemplified in the following 'for' loop, which searches for": {
            "content": "prime numbers:\n\n>>> for n in range(2, 10):\n...     for x in range(2, n):\n...         if n % x == 0:\n...             print(n, 'equals', x, '*', n//x)\n...             break\n...     else:\n...         # loop fell through without finding a factor\n...         print(n, 'is a prime number')\n...\n2 is a prime number\n3 is a prime number\n4 equals 2 * 2\n5 is a prime number\n6 equals 2 * 3\n7 is a prime number\n8 equals 2 * 4\n9 equals 3 * 3\n\n(Yes, this is the correct code.  Look closely: the 'else' clause belongs\nto the *note for: 24e. loop, 'not' the *note if: 24f. statement.)\n",
            "subsections": []
        },
        "When used with a loop, the 'else' clause has more in common with the": {
            "content": "'else' clause of a *note try: 4bc. statement than it does with that of\n*note if: 24f. statements: a *note try: 4bc. statement's 'else' clause\nruns when no exception occurs, and a loop's 'else' clause runs when no\n'break' occurs.  For more on the 'try' statement and exceptions, see\n*note Handling Exceptions: 199b.\n\nThe *note continue: 7ed. statement, also borrowed from C, continues with\nthe next iteration of the loop:\n\n>>> for num in range(2, 10):\n...     if num % 2 == 0:\n...         print(\"Found an even number\", num)\n...         continue\n...     print(\"Found an odd number\", num)\n...\nFound an even number 2\nFound an odd number 3\nFound an even number 4\nFound an odd number 5\nFound an even number 6\nFound an odd number 7\nFound an even number 8\nFound an odd number 9\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: pass Statements,  Next: match Statements,  Prev: break and continue Statements and else Clauses on Loops,  Up: More Control Flow Tools": {
            "content": "The *note pass: 199e. statement does nothing.  It can be used when a\nstatement is required syntactically but the program requires no action.\nFor example:\n\n>>> while True:\n...     pass  # Busy-wait for keyboard interrupt (Ctrl+C)\n...\n\nThis is commonly used for creating minimal classes:\n\n>>> class MyEmptyClass:\n...     pass\n...\n\nAnother place *note pass: 199e. can be used is as a place-holder for a\nfunction or conditional body when you are working on new code, allowing\nyou to keep thinking at a more abstract level.  The 'pass' is silently\nignored:\n\n>>> def initlog(*args):\n...     pass   # Remember to implement this!\n...\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: match Statements,  Next: Defining Functions,  Prev: pass Statements,  Up: More Control Flow Tools": {
            "content": "A *note match: 601. statement takes an expression and compares its value\nto successive patterns given as one or more case blocks.  This is\nsuperficially similar to a switch statement in C, Java or JavaScript\n(and many other languages), but it's more similar to pattern matching in\nlanguages like Rust or Haskell.  Only the first pattern that matches\ngets executed and it can also extract components (sequence elements or\nobject attributes) from the value into variables.\n\nThe simplest form compares a subject value against one or more literals:\n\ndef httperror(status):\nmatch status:\ncase 400:\nreturn \"Bad request\"\ncase 404:\nreturn \"Not found\"\ncase 418:\nreturn \"I'm a teapot\"\ncase :\nreturn \"Something's wrong with the internet\"\n\nNote the last block: the \"variable name\" '' acts as a 'wildcard' and\nnever fails to match.  If no case matches, none of the branches is\nexecuted.\n\nYou can combine several literals in a single pattern using '|' (\"or\"):\n\ncase 401 | 403 | 404:\nreturn \"Not allowed\"\n",
            "subsections": []
        },
        "Patterns can look like unpacking assignments, and can be used to bind": {
            "content": "variables:\n\n# point is an (x, y) tuple\nmatch point:\ncase (0, 0):\nprint(\"Origin\")\ncase (0, y):\nprint(f\"Y={y}\")\ncase (x, 0):\nprint(f\"X={x}\")\ncase (x, y):\nprint(f\"X={x}, Y={y}\")\ncase :\nraise ValueError(\"Not a point\")\n\nStudy that one carefully!  The first pattern has two literals, and can\nbe thought of as an extension of the literal pattern shown above.  But\nthe next two patterns combine a literal and a variable, and the variable\n'binds' a value from the subject ('point').  The fourth pattern captures\ntwo values, which makes it conceptually similar to the unpacking\nassignment '(x, y) = point'.\n",
            "subsections": []
        },
        "If you are using classes to structure your data you can use the class": {
            "content": "name followed by an argument list resembling a constructor, but with the\nability to capture attributes into variables:\n\nclass Point:\ndef init(self, x, y):\nself.x = x\nself.y = y\n\ndef whereis(point):\nmatch point:\ncase Point(x=0, y=0):\nprint(\"Origin\")\ncase Point(x=0, y=y):\nprint(f\"Y={y}\")\ncase Point(x=x, y=0):\nprint(f\"X={x}\")\ncase Point():\nprint(\"Somewhere else\")\ncase :\nprint(\"Not a point\")\n",
            "subsections": []
        },
        "Patterns can be arbitrarily nested.  For example, if we have a short": {
            "content": "list of Points, with 'matchargs' added, we could match it like\nthis:\n\nclass Point:\nmatchargs = ('x', 'y')\ndef init(self, x, y):\nself.x = x\nself.y = y\n\nmatch points:\ncase []:\nprint(\"No points\")\ncase [Point(0, 0)]:\nprint(\"The origin\")\ncase [Point(x, y)]:\nprint(f\"Single point {x}, {y}\")\ncase [Point(0, y1), Point(0, y2)]:\nprint(f\"Two on the Y axis at {y1}, {y2}\")\ncase :\nprint(\"Something else\")\n\nWe can add an 'if' clause to a pattern, known as a \"guard\".  If the\nguard is false, 'match' goes on to try the next case block.  Note that\nvalue capture happens before the guard is evaluated:\n\nmatch point:\ncase Point(x, y) if x == y:\nprint(f\"Y=X at {x}\")\ncase Point(x, y):\nprint(f\"Not on the diagonal\")\n\nSeveral other key features of this statement:\n\n- Like unpacking assignments, tuple and list patterns have exactly\nthe same meaning and actually match arbitrary sequences.  An\nimportant exception is that they don't match iterators or strings.\n\n- Sequence patterns support extended unpacking: '[x, y, *rest]' and\n'(x, y, *rest)' work similar to unpacking assignments.  The name\nafter '*' may also be '', so '(x, y, *)' matches a sequence of at\nleast two items without binding the remaining items.\n\n- Mapping patterns: '{\"bandwidth\": b, \"latency\": l}' captures the\n'\"bandwidth\"' and '\"latency\"' values from a dictionary.  Unlike\nsequence patterns, extra keys are ignored.  An unpacking like\n'rest' is also supported.  (But '' would be redundant, so it\nis not allowed.)\n\n- Subpatterns may be captured using the 'as' keyword:\n\ncase (Point(x1, y1), Point(x2, y2) as p2): ...\n\nwill capture the second element of the input as 'p2' (as long as\nthe input is a sequence of two points)\n\n- Most literals are compared by equality, however the singletons\n'True', 'False' and 'None' are compared by identity.\n\n- Patterns may use named constants.  These must be dotted names to\nprevent them from being interpreted as capture variable:\n\nfrom enum import Enum\nclass Color(Enum):\nRED = 'red'\nGREEN = 'green'\nBLUE = 'blue'\n\ncolor = Color(input(\"Enter your choice of 'red', 'blue' or 'green': \"))\n\nmatch color:\ncase Color.RED:\nprint(\"I see red!\")\ncase Color.GREEN:\nprint(\"Grass is green\")\ncase Color.BLUE:\nprint(\"I'm feeling the blues :(\")\n",
            "subsections": []
        },
        "For a more detailed explanation and additional examples, you can look": {
            "content": "into PEP 636(1) which is written in a tutorial format.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0636/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Defining Functions,  Next: More on Defining Functions,  Prev: match Statements,  Up: More Control Flow Tools": {
            "content": "",
            "subsections": []
        },
        "We can create a function that writes the Fibonacci series to an": {
            "content": "arbitrary boundary:\n\n>>> def fib(n):    # write Fibonacci series up to n\n...     \"\"\"Print a Fibonacci series up to n.\"\"\"\n...     a, b = 0, 1\n...     while a < n:\n...         print(a, end=' ')\n...         a, b = b, a+b\n...     print()\n...\n>>> # Now call the function we just defined:\n... fib(2000)\n0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597\n\nThe keyword *note def: 12af. introduces a function 'definition'.  It\nmust be followed by the function name and the parenthesized list of\nformal parameters.  The statements that form the body of the function\nstart at the next line, and must be indented.\n",
            "subsections": []
        },
        "The first statement of the function body can optionally be a string": {
            "content": "literal; this string literal is the function's documentation string, or\n'docstring'.  (More about docstrings can be found in the section *note",
            "subsections": []
        },
        "Documentation Strings: 19a2.)  There are tools which use docstrings to": {
            "content": "automatically produce online or printed documentation, or to let the\nuser interactively browse through code; it's good practice to include\ndocstrings in code that you write, so make a habit of it.\n",
            "subsections": []
        },
        "The 'execution' of a function introduces a new symbol table used for the": {
            "content": "local variables of the function.  More precisely, all variable\nassignments in a function store the value in the local symbol table;\nwhereas variable references first look in the local symbol table, then\nin the local symbol tables of enclosing functions, then in the global\nsymbol table, and finally in the table of built-in names.  Thus, global\nvariables and variables of enclosing functions cannot be directly\nassigned a value within a function (unless, for global variables, named\nin a *note global: 19a3. statement, or, for variables of enclosing\nfunctions, named in a *note nonlocal: 111f. statement), although they\nmay be referenced.\n",
            "subsections": []
        },
        "The actual parameters (arguments) to a function call are introduced in": {
            "content": "the local symbol table of the called function when it is called; thus,\narguments are passed using 'call by value' (where the 'value' is always\nan object 'reference', not the value of the object).  (1)  When a\nfunction calls another function, or calls itself recursively, a new\nlocal symbol table is created for that call.\n\nA function definition associates the function name with the function\nobject in the current symbol table.  The interpreter recognizes the\nobject pointed to by that name as a user-defined function.  Other names\ncan also point to that same function object and can also be used to\naccess the function:\n\n>>> fib\n<function fib at 10042ed0>\n>>> f = fib\n>>> f(100)\n0 1 1 2 3 5 8 13 21 34 55 89\n",
            "subsections": []
        },
        "Coming from other languages, you might object that 'fib' is not a": {
            "content": "function but a procedure since it doesn't return a value.  In fact, even\nfunctions without a *note return: 7f2. statement do return a value,\nalbeit a rather boring one.  This value is called 'None' (it's a\nbuilt-in name).  Writing the value 'None' is normally suppressed by the\ninterpreter if it would be the only value written.  You can see it if\nyou really want to using *note print(): de5.:\n\n>>> fib(0)\n>>> print(fib(0))\nNone\n",
            "subsections": []
        },
        "It is simple to write a function that returns a list of the numbers of": {
            "content": "the Fibonacci series, instead of printing it:\n\n>>> def fib2(n):  # return Fibonacci series up to n\n...     \"\"\"Return a list containing the Fibonacci series up to n.\"\"\"\n...     result = []\n...     a, b = 0, 1\n...     while a < n:\n...         result.append(a)    # see below\n...         a, b = b, a+b\n...     return result\n...\n>>> f100 = fib2(100)    # call it\n>>> f100                # write the result\n[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]\n\nThis example, as usual, demonstrates some new Python features:\n\n* The *note return: 7f2. statement returns with a value from a\nfunction.  'return' without an expression argument returns 'None'.\nFalling off the end of a function also returns 'None'.\n\n* The statement 'result.append(a)' calls a 'method' of the list\nobject 'result'.  A method is a function that 'belongs' to an\nobject and is named 'obj.methodname', where 'obj' is some object\n(this may be an expression), and 'methodname' is the name of a\nmethod that is defined by the object's type.  Different types\ndefine different methods.  Methods of different types may have the\nsame name without causing ambiguity.  (It is possible to define\nyour own object types and methods, using 'classes', see *note\nClasses: 19a4.) The method 'append()' shown in the example is\ndefined for list objects; it adds a new element at the end of the\nlist.  In this example it is equivalent to 'result = result + [a]',\nbut more efficient.\n\n---------- Footnotes ----------\n\n(1) Actually, 'call by object reference' would be a better\ndescription, since if a mutable object is passed, the caller will see\nany changes the callee makes to it (items inserted into a list).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: More on Defining Functions,  Next: Intermezzo Coding Style,  Prev: Defining Functions,  Up: More Control Flow Tools": {
            "content": "",
            "subsections": []
        },
        "It is also possible to define functions with a variable number of": {
            "content": "arguments.  There are three forms, which can be combined.\n\n* Menu:\n\n* Default Argument Values::\n* Keyword Arguments::\n* Special parameters::\n* Arbitrary Argument Lists::\n* Unpacking Argument Lists::\n* Lambda Expressions::\n* Documentation Strings::\n* Function Annotations::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Default Argument Values,  Next: Keyword Arguments,  Up: More on Defining Functions": {
            "content": "2.4.8.1 Default Argument Values\n...............................\n",
            "subsections": []
        },
        "The most useful form is to specify a default value for one or more": {
            "content": "arguments.  This creates a function that can be called with fewer\narguments than it is defined to allow.  For example:\n\ndef askok(prompt, retries=4, reminder='Please try again!'):\nwhile True:\nreply = input(prompt)\nif reply in {'y', 'ye', 'yes'}:\nreturn True\nif reply in {'n', 'no', 'nop', 'nope'}:\nreturn False\nretries = retries - 1\nif retries < 0:\nraise ValueError('invalid user response')\nprint(reminder)\n\nThis function can be called in several ways:\n\n* giving only the mandatory argument: 'askok('Do you really want to\nquit?')'\n\n* giving one of the optional arguments: 'askok('OK to overwrite the\nfile?', 2)'\n\n* or even giving all arguments: 'askok('OK to overwrite the file?',\n2, 'Come on, only yes or no!')'\n\nThis example also introduces the *note in: 250. keyword.  This tests\nwhether or not a sequence contains a certain value.\n",
            "subsections": []
        },
        "The default values are evaluated at the point of function definition in": {
            "content": "the 'defining' scope, so that\n\ni = 5\n\ndef f(arg=i):\nprint(arg)\n\ni = 6\nf()\n\nwill print '5'.\n\n'Important warning:' The default value is evaluated only once.  This\nmakes a difference when the default is a mutable object such as a list,\ndictionary, or instances of most classes.  For example, the following\nfunction accumulates the arguments passed to it on subsequent calls:\n\ndef f(a, L=[]):\nL.append(a)\nreturn L\n\nprint(f(1))\nprint(f(2))\nprint(f(3))\n\nThis will print\n\n[1]\n[1, 2]\n[1, 2, 3]\n",
            "subsections": []
        },
        "If you don't want the default to be shared between subsequent calls, you": {
            "content": "can write the function like this instead:\n\ndef f(a, L=None):\nif L is None:\nL = []\nL.append(a)\nreturn L\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Keyword Arguments,  Next: Special parameters,  Prev: Default Argument Values,  Up: More on Defining Functions": {
            "content": "2.4.8.2 Keyword Arguments\n.........................\n\nFunctions can also be called using *note keyword arguments: b64. of the\nform 'kwarg=value'.  For instance, the following function:\n\ndef parrot(voltage, state='a stiff', action='voom', type='Norwegian Blue'):\nprint(\"-- This parrot wouldn't\", action, end=' ')\nprint(\"if you put\", voltage, \"volts through it.\")\nprint(\"-- Lovely plumage, the\", type)\nprint(\"-- It's\", state, \"!\")\n\naccepts one required argument ('voltage') and three optional arguments\n('state', 'action', and 'type').  This function can be called in any of\nthe following ways:\n\nparrot(1000)                                          # 1 positional argument\nparrot(voltage=1000)                                  # 1 keyword argument\nparrot(voltage=1000000, action='VOOOOOM')             # 2 keyword arguments\nparrot(action='VOOOOOM', voltage=1000000)             # 2 keyword arguments\nparrot('a million', 'bereft of life', 'jump')         # 3 positional arguments\nparrot('a thousand', state='pushing up the daisies')  # 1 positional, 1 keyword\n\nbut all the following calls would be invalid:\n\nparrot()                     # required argument missing\nparrot(voltage=5.0, 'dead')  # non-keyword argument after a keyword argument\nparrot(110, voltage=220)     # duplicate value for the same argument\nparrot(actor='John Cleese')  # unknown keyword argument\n\nIn a function call, keyword arguments must follow positional arguments.",
            "subsections": []
        },
        "All the keyword arguments passed must match one of the arguments": {
            "content": "accepted by the function (e.g.  'actor' is not a valid argument for the\n'parrot' function), and their order is not important.  This also\nincludes non-optional arguments (e.g.  'parrot(voltage=1000)' is valid\ntoo).  No argument may receive a value more than once.  Here's an\nexample that fails due to this restriction:\n\n>>> def function(a):\n...     pass\n...\n>>> function(0, a=0)\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nTypeError: function() got multiple values for argument 'a'\n",
            "subsections": []
        },
        "When a final formal parameter of the form 'name' is present, it": {
            "content": "receives a dictionary (see *note Mapping Types -- dict: 8fc.) containing\nall keyword arguments except for those corresponding to a formal\nparameter.  This may be combined with a formal parameter of the form\n'*name' (described in the next subsection) which receives a *note tuple:\n19ab. containing the positional arguments beyond the formal parameter\nlist.  ('*name' must occur before 'name'.)  For example, if we define\na function like this:\n\ndef cheeseshop(kind, *arguments, keywords):\nprint(\"-- Do you have any\", kind, \"?\")\nprint(\"-- I'm sorry, we're all out of\", kind)\nfor arg in arguments:\nprint(arg)\nprint(\"-\" * 40)\nfor kw in keywords:\nprint(kw, \":\", keywords[kw])\n\nIt could be called like this:\n\ncheeseshop(\"Limburger\", \"It's very runny, sir.\",\n\"It's really very, VERY runny, sir.\",\nshopkeeper=\"Michael Palin\",\nclient=\"John Cleese\",\nsketch=\"Cheese Shop Sketch\")\n\nand of course it would print:\n\n-- Do you have any Limburger ?\n-- I'm sorry, we're all out of Limburger\nIt's very runny, sir.\nshopkeeper : Michael Palin\nclient : John Cleese\nsketch : Cheese Shop Sketch\n",
            "subsections": []
        },
        "Note that the order in which the keyword arguments are printed is": {
            "content": "guaranteed to match the order in which they were provided in the\nfunction call.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Special parameters,  Next: Arbitrary Argument Lists,  Prev: Keyword Arguments,  Up: More on Defining Functions": {
            "content": "2.4.8.3 Special parameters\n..........................\n",
            "subsections": []
        },
        "By default, arguments may be passed to a Python function either by": {
            "content": "position or explicitly by keyword.  For readability and performance, it\nmakes sense to restrict the way arguments can be passed so that a\ndeveloper need only look at the function definition to determine if\nitems are passed by position, by position or keyword, or by keyword.\n\nA function definition may look like:\n\ndef f(pos1, pos2, /, posorkwd, *, kwd1, kwd2):\n-----------    ----------     ----------\n|             |                  |\n|        Positional or keyword   |\n|                                - Keyword only\n-- Positional only\n\nwhere '/' and '*' are optional.  If used, these symbols indicate the\nkind of parameter by how the arguments may be passed to the function:\npositional-only, positional-or-keyword, and keyword-only.  Keyword\nparameters are also referred to as named parameters.\n\n* Menu:\n\n* Positional-or-Keyword Arguments::\n* Positional-Only Parameters::\n* Keyword-Only Arguments::\n* Function Examples::\n* Recap::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Positional-or-Keyword Arguments,  Next: Positional-Only Parameters,  Up: Special parameters": {
            "content": "2.4.8.4 Positional-or-Keyword Arguments\n.......................................\n\nIf '/' and '*' are not present in the function definition, arguments may\nbe passed to a function by position or by keyword.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Positional-Only Parameters,  Next: Keyword-Only Arguments,  Prev: Positional-or-Keyword Arguments,  Up: Special parameters": {
            "content": "2.4.8.5 Positional-Only Parameters\n..................................\n",
            "subsections": []
        },
        "Looking at this in a bit more detail, it is possible to mark certain": {
            "content": "parameters as 'positional-only'.  If 'positional-only', the parameters'\norder matters, and the parameters cannot be passed by keyword.",
            "subsections": []
        },
        "Positional-only parameters are placed before a '/' (forward-slash).  The": {
            "content": "'/' is used to logically separate the positional-only parameters from\nthe rest of the parameters.  If there is no '/' in the function\ndefinition, there are no positional-only parameters.\n",
            "subsections": []
        },
        "Parameters following the '/' may be 'positional-or-keyword' or": {
            "content": "'keyword-only'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Keyword-Only Arguments,  Next: Function Examples,  Prev: Positional-Only Parameters,  Up: Special parameters": {
            "content": "2.4.8.6 Keyword-Only Arguments\n..............................\n",
            "subsections": []
        },
        "To mark parameters as 'keyword-only', indicating the parameters must be": {
            "content": "passed by keyword argument, place an '*' in the arguments list just\nbefore the first 'keyword-only' parameter.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Function Examples,  Next: Recap,  Prev: Keyword-Only Arguments,  Up: Special parameters": {
            "content": "2.4.8.7 Function Examples\n.........................\n",
            "subsections": []
        },
        "Consider the following example function definitions paying close": {
            "content": "attention to the markers '/' and '*':\n\n>>> def standardarg(arg):\n...     print(arg)\n...\n>>> def posonlyarg(arg, /):\n...     print(arg)\n...\n>>> def kwdonlyarg(*, arg):\n...     print(arg)\n...\n>>> def combinedexample(posonly, /, standard, *, kwdonly):\n...     print(posonly, standard, kwdonly)\n",
            "subsections": []
        },
        "The first function definition, 'standardarg', the most familiar form,": {
            "content": "places no restrictions on the calling convention and arguments may be\npassed by position or keyword:\n\n>>> standardarg(2)\n2\n\n>>> standardarg(arg=2)\n2\n",
            "subsections": []
        },
        "The second function 'posonlyarg' is restricted to only use positional": {
            "content": "parameters as there is a '/' in the function definition:\n\n>>> posonlyarg(1)\n1\n\n>>> posonlyarg(arg=1)\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nTypeError: posonlyarg() got some positional-only arguments passed as keyword arguments: 'arg'\n",
            "subsections": []
        },
        "The third function 'kwdonlyargs' only allows keyword arguments as": {
            "content": "indicated by a '*' in the function definition:\n\n>>> kwdonlyarg(3)\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nTypeError: kwdonlyarg() takes 0 positional arguments but 1 was given\n\n>>> kwdonlyarg(arg=3)\n3\n",
            "subsections": []
        },
        "And the last uses all three calling conventions in the same function": {
            "content": "definition:\n\n>>> combinedexample(1, 2, 3)\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nTypeError: combinedexample() takes 2 positional arguments but 3 were given\n\n>>> combinedexample(1, 2, kwdonly=3)\n1 2 3\n\n>>> combinedexample(1, standard=2, kwdonly=3)\n1 2 3\n\n>>> combinedexample(posonly=1, standard=2, kwdonly=3)\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nTypeError: combinedexample() got some positional-only arguments passed as keyword arguments: 'posonly'\n",
            "subsections": []
        },
        "Finally, consider this function definition which has a potential": {
            "content": "collision between the positional argument 'name' and 'kwds' which has\n'name' as a key:\n\ndef foo(name, kwds):\nreturn 'name' in kwds\n",
            "subsections": []
        },
        "There is no possible call that will make it return 'True' as the keyword": {
            "content": "''name'' will always bind to the first parameter.  For example:\n\n>>> foo(1, {'name': 2})\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nTypeError: foo() got multiple values for argument 'name'\n>>>\n",
            "subsections": []
        },
        "But using '/' (positional only arguments), it is possible since it": {
            "content": "allows 'name' as a positional argument and ''name'' as a key in the\nkeyword arguments:\n\n>>> def foo(name, /, kwds):\n...     return 'name' in kwds\n...\n>>> foo(1, {'name': 2})\nTrue\n",
            "subsections": []
        },
        "In other words, the names of positional-only parameters can be used in": {
            "content": "'kwds' without ambiguity.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Recap,  Prev: Function Examples,  Up: Special parameters": {
            "content": "2.4.8.8 Recap\n.............\n",
            "subsections": []
        },
        "The use case will determine which parameters to use in the function": {
            "content": "definition:\n\ndef f(pos1, pos2, /, posorkwd, *, kwd1, kwd2):\n\nAs guidance:\n\n* Use positional-only if you want the name of the parameters to not\nbe available to the user.  This is useful when parameter names have\nno real meaning, if you want to enforce the order of the arguments\nwhen the function is called or if you need to take some positional\nparameters and arbitrary keywords.\n\n* Use keyword-only when names have meaning and the function\ndefinition is more understandable by being explicit with names or\nyou want to prevent users relying on the position of the argument\nbeing passed.\n\n* For an API, use positional-only to prevent breaking API changes if\nthe parameter's name is modified in the future.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Arbitrary Argument Lists,  Next: Unpacking Argument Lists,  Prev: Special parameters,  Up: More on Defining Functions": {
            "content": "2.4.8.9 Arbitrary Argument Lists\n................................\n",
            "subsections": []
        },
        "Finally, the least frequently used option is to specify that a function": {
            "content": "can be called with an arbitrary number of arguments.  These arguments\nwill be wrapped up in a tuple (see *note Tuples and Sequences: 19ab.).",
            "subsections": []
        },
        "Before the variable number of arguments, zero or more normal arguments": {
            "content": "may occur.\n\ndef writemultipleitems(file, separator, *args):\nfile.write(separator.join(args))\n",
            "subsections": []
        },
        "Normally, these 'variadic' arguments will be last in the list of formal": {
            "content": "parameters, because they scoop up all remaining input arguments that are\npassed to the function.  Any formal parameters which occur after the\n'*args' parameter are 'keyword-only' arguments, meaning that they can\nonly be used as keywords rather than positional arguments.\n\n>>> def concat(*args, sep=\"/\"):\n...     return sep.join(args)\n...\n>>> concat(\"earth\", \"mars\", \"venus\")\n'earth/mars/venus'\n>>> concat(\"earth\", \"mars\", \"venus\", sep=\".\")\n'earth.mars.venus'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Unpacking Argument Lists,  Next: Lambda Expressions,  Prev: Arbitrary Argument Lists,  Up: More on Defining Functions": {
            "content": "2.4.8.10 Unpacking Argument Lists\n.................................\n",
            "subsections": []
        },
        "The reverse situation occurs when the arguments are already in a list or": {
            "content": "tuple but need to be unpacked for a function call requiring separate\npositional arguments.  For instance, the built-in *note range(): 761.\nfunction expects separate 'start' and 'stop' arguments.  If they are not\navailable separately, write the function call with the '*'-operator to\nunpack the arguments out of a list or tuple:\n\n>>> list(range(3, 6))            # normal call with separate arguments\n[3, 4, 5]\n>>> args = [3, 6]\n>>> list(range(*args))            # call with arguments unpacked from a list\n[3, 4, 5]\n",
            "subsections": []
        },
        "In the same fashion, dictionaries can deliver keyword arguments with the": {
            "content": "''-operator:\n\n>>> def parrot(voltage, state='a stiff', action='voom'):\n...     print(\"-- This parrot wouldn't\", action, end=' ')\n...     print(\"if you put\", voltage, \"volts through it.\", end=' ')\n...     print(\"E's\", state, \"!\")\n...\n>>> d = {\"voltage\": \"four million\", \"state\": \"bleedin' demised\", \"action\": \"VOOM\"}\n>>> parrot(d)\n-- This parrot wouldn't VOOM if you put four million volts through it. E's bleedin' demised !\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Lambda Expressions,  Next: Documentation Strings,  Prev: Unpacking Argument Lists,  Up: More on Defining Functions": {
            "content": "2.4.8.11 Lambda Expressions\n...........................\n\nSmall anonymous functions can be created with the *note lambda: 1115.\nkeyword.  This function returns the sum of its two arguments: 'lambda a,\nb: a+b'.  Lambda functions can be used wherever function objects are\nrequired.  They are syntactically restricted to a single expression.",
            "subsections": []
        },
        "Semantically, they are just syntactic sugar for a normal function": {
            "content": "definition.  Like nested function definitions, lambda functions can\nreference variables from the containing scope:\n\n>>> def makeincrementor(n):\n...     return lambda x: x + n\n...\n>>> f = makeincrementor(42)\n>>> f(0)\n42\n>>> f(1)\n43\n\nThe above example uses a lambda expression to return a function.\nAnother use is to pass a small function as an argument:\n\n>>> pairs = [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')]\n>>> pairs.sort(key=lambda pair: pair[1])\n>>> pairs\n[(4, 'four'), (1, 'one'), (3, 'three'), (2, 'two')]\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Documentation Strings,  Next: Function Annotations,  Prev: Lambda Expressions,  Up: More on Defining Functions": {
            "content": "2.4.8.12 Documentation Strings\n..............................\n",
            "subsections": []
        },
        "Here are some conventions about the content and formatting of": {
            "content": "documentation strings.\n",
            "subsections": []
        },
        "The first line should always be a short, concise summary of the object's": {
            "content": "purpose.  For brevity, it should not explicitly state the object's name\nor type, since these are available by other means (except if the name\nhappens to be a verb describing a function's operation).  This line\nshould begin with a capital letter and end with a period.\n",
            "subsections": []
        },
        "If there are more lines in the documentation string, the second line": {
            "content": "should be blank, visually separating the summary from the rest of the\ndescription.  The following lines should be one or more paragraphs\ndescribing the object's calling conventions, its side effects, etc.\n",
            "subsections": []
        },
        "The Python parser does not strip indentation from multi-line string": {
            "content": "literals in Python, so tools that process documentation have to strip\nindentation if desired.  This is done using the following convention.",
            "subsections": []
        },
        "The first non-blank line 'after' the first line of the string determines": {
            "content": "the amount of indentation for the entire documentation string.  (We\ncan't use the first line since it is generally adjacent to the string's\nopening quotes so its indentation is not apparent in the string\nliteral.)  Whitespace \"equivalent\" to this indentation is then stripped\nfrom the start of all lines of the string.  Lines that are indented less\nshould not occur, but if they occur all their leading whitespace should\nbe stripped.  Equivalence of whitespace should be tested after expansion\nof tabs (to 8 spaces, normally).\n\nHere is an example of a multi-line docstring:\n\n>>> def myfunction():\n...     \"\"\"Do nothing, but document it.\n...\n...     No, really, it doesn't do anything.\n...     \"\"\"\n...     pass\n...\n>>> print(myfunction.doc)\nDo nothing, but document it.\n\nNo, really, it doesn't do anything.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Function Annotations,  Prev: Documentation Strings,  Up: More on Defining Functions": {
            "content": "2.4.8.13 Function Annotations\n.............................\n\n*note Function annotations: 19bb. are completely optional metadata\ninformation about the types used by user-defined functions (see PEP\n3107(1) and PEP 484(2) for more information).\n\n*note Annotations: 19bc. are stored in the 'annotations' attribute\nof the function as a dictionary and have no effect on any other part of\nthe function.  Parameter annotations are defined by a colon after the\nparameter name, followed by an expression evaluating to the value of the\nannotation.  Return annotations are defined by a literal '->', followed\nby an expression, between the parameter list and the colon denoting the\nend of the *note def: 12af. statement.  The following example has a\nrequired argument, an optional argument, and the return value annotated:\n\n>>> def f(ham: str, eggs: str = 'eggs') -> str:\n...     print(\"Annotations:\", f.annotations)\n...     print(\"Arguments:\", ham, eggs)\n...     return ham + ' and ' + eggs\n...\n>>> f('spam')\nAnnotations: {'ham': <class 'str'>, 'return': <class 'str'>, 'eggs': <class 'str'>}\nArguments: spam eggs\n'spam and eggs'\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3107/\n\n(2) https://peps.python.org/pep-0484/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Intermezzo Coding Style,  Prev: More on Defining Functions,  Up: More Control Flow Tools": {
            "content": "",
            "subsections": []
        },
        "Now that you are about to write longer, more complex pieces of Python,": {
            "content": "it is a good time to talk about 'coding style'.  Most languages can be\nwritten (or more concise, 'formatted') in different styles; some are\nmore readable than others.  Making it easy for others to read your code\nis always a good idea, and adopting a nice coding style helps\ntremendously for that.\n",
            "subsections": []
        },
        "For Python, PEP 8(1) has emerged as the style guide that most projects": {
            "content": "adhere to; it promotes a very readable and eye-pleasing coding style.",
            "subsections": []
        },
        "Every Python developer should read it at some point; here are the most": {
            "content": "important points extracted for you:\n\n* Use 4-space indentation, and no tabs.\n\n4 spaces are a good compromise between small indentation (allows\ngreater nesting depth) and large indentation (easier to read).\nTabs introduce confusion, and are best left out.\n\n* Wrap lines so that they don't exceed 79 characters.\n\nThis helps users with small displays and makes it possible to have\nseveral code files side-by-side on larger displays.\n\n* Use blank lines to separate functions and classes, and larger\nblocks of code inside functions.\n\n* When possible, put comments on a line of their own.\n\n* Use docstrings.\n\n* Use spaces around operators and after commas, but not directly\ninside bracketing constructs: 'a = f(1, 2) + g(3, 4)'.\n\n* Name your classes and functions consistently; the convention is to\nuse 'UpperCamelCase' for classes and 'lowercasewithunderscores'\nfor functions and methods.  Always use 'self' as the name for the\nfirst method argument (see *note A First Look at Classes: 19bf. for\nmore on classes and methods).\n\n* Don't use fancy encodings if your code is meant to be used in\ninternational environments.  Python's default, UTF-8, or even plain\nASCII work best in any case.\n\n* Likewise, don't use non-ASCII characters in identifiers if there is\nonly the slightest chance people speaking a different language will\nread or maintain the code.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0008/\n\nFile: python3.12.info,  Node: Data Structures,  Next: Modules<2>,  Prev: More Control Flow Tools,  Up: The Python Tutorial\n",
            "subsections": [
                {
                    "name": "2.5 Data Structures",
                    "content": ""
                }
            ]
        },
        "This chapter describes some things you've learned about already in more": {
            "content": "detail, and adds some new things as well.\n\n* Menu:\n\n* More on Lists::\n* The del statement::\n* Tuples and Sequences::\n* Sets::\n* Dictionaries::\n* Looping Techniques::\n* More on Conditions::\n* Comparing Sequences and Other Types::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: More on Lists,  Next: The del statement,  Up: Data Structures": {
            "content": "",
            "subsections": []
        },
        "The list data type has some more methods.  Here are all of the methods": {
            "content": "of list objects:\n\n-- Method: list.append (x)\n\nAdd an item to the end of the list.  Equivalent to 'a[len(a):] =\n[x]'.\n\n-- Method: list.extend (iterable)\n\nExtend the list by appending all the items from the iterable.\nEquivalent to 'a[len(a):] = iterable'.\n\n-- Method: list.insert (i, x)\n\nInsert an item at a given position.  The first argument is the\nindex of the element before which to insert, so 'a.insert(0, x)'\ninserts at the front of the list, and 'a.insert(len(a), x)' is\nequivalent to 'a.append(x)'.\n\n-- Method: list.remove (x)\n\nRemove the first item from the list whose value is equal to 'x'.\nIt raises a *note ValueError: 183. if there is no such item.\n\n-- Method: list.pop ([i])\n\nRemove the item at the given position in the list, and return it.\nIf no index is specified, 'a.pop()' removes and returns the last\nitem in the list.  It raises an *note IndexError: 138f. if the list\nis empty or the index is outside the list range.\n\n-- Method: list.clear ()\n\nRemove all items from the list.  Equivalent to 'del a[:]'.\n\n-- Method: list.index (x[, start[, end]])\n\nReturn zero-based index in the list of the first item whose value\nis equal to 'x'.  Raises a *note ValueError: 183. if there is no\nsuch item.\n\nThe optional arguments 'start' and 'end' are interpreted as in the\nslice notation and are used to limit the search to a particular\nsubsequence of the list.  The returned index is computed relative\nto the beginning of the full sequence rather than the 'start'\nargument.\n\n-- Method: list.count (x)\n\nReturn the number of times 'x' appears in the list.\n\n-- Method: list.sort (*, key=None, reverse=False)\n\nSort the items of the list in place (the arguments can be used for\nsort customization, see *note sorted(): a12. for their\nexplanation).\n\n-- Method: list.reverse ()\n\nReverse the elements of the list in place.\n\n-- Method: list.copy ()\n\nReturn a shallow copy of the list.  Equivalent to 'a[:]'.\n\nAn example that uses most of the list methods:\n\n>>> fruits = ['orange', 'apple', 'pear', 'banana', 'kiwi', 'apple', 'banana']\n>>> fruits.count('apple')\n2\n>>> fruits.count('tangerine')\n0\n>>> fruits.index('banana')\n3\n>>> fruits.index('banana', 4)  # Find next banana starting at position 4\n6\n>>> fruits.reverse()\n>>> fruits\n['banana', 'apple', 'kiwi', 'banana', 'pear', 'apple', 'orange']\n>>> fruits.append('grape')\n>>> fruits\n['banana', 'apple', 'kiwi', 'banana', 'pear', 'apple', 'orange', 'grape']\n>>> fruits.sort()\n>>> fruits\n['apple', 'apple', 'banana', 'banana', 'grape', 'kiwi', 'orange', 'pear']\n>>> fruits.pop()\n'pear'\n",
            "subsections": []
        },
        "You might have noticed that methods like 'insert', 'remove' or 'sort'": {
            "content": "that only modify the list have no return value printed - they return the\ndefault 'None'.  (1)  This is a design principle for all mutable data\nstructures in Python.\n",
            "subsections": []
        },
        "Another thing you might notice is that not all data can be sorted or": {
            "content": "compared.  For instance, '[None, 'hello', 10]' doesn't sort because\nintegers can't be compared to strings and 'None' can't be compared to\nother types.  Also, there are some types that don't have a defined\nordering relation.  For example, '3+4j < 5+7j' isn't a valid comparison.\n\n* Menu:\n\n* Using Lists as Stacks::\n* Using Lists as Queues::\n* List Comprehensions: List Comprehensions<2>.\n* Nested List Comprehensions::\n\n---------- Footnotes ----------\n\n(1) Other languages may return the mutated object, which allows\nmethod chaining, such as 'd->insert(\"a\")->remove(\"b\")->sort();'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using Lists as Stacks,  Next: Using Lists as Queues,  Up: More on Lists": {
            "content": "2.5.1.1 Using Lists as Stacks\n.............................\n",
            "subsections": []
        },
        "The list methods make it very easy to use a list as a stack, where the": {
            "content": "last element added is the first element retrieved (\"last-in,\nfirst-out\").  To add an item to the top of the stack, use 'append()'.",
            "subsections": []
        },
        "To retrieve an item from the top of the stack, use 'pop()' without an": {
            "content": "explicit index.  For example:\n\n>>> stack = [3, 4, 5]\n>>> stack.append(6)\n>>> stack.append(7)\n>>> stack\n[3, 4, 5, 6, 7]\n>>> stack.pop()\n7\n>>> stack\n[3, 4, 5, 6]\n>>> stack.pop()\n6\n>>> stack.pop()\n5\n>>> stack\n[3, 4]\n\nFile: python3.12.info,  Node: Using Lists as Queues,  Next: List Comprehensions<2>,  Prev: Using Lists as Stacks,  Up: More on Lists\n\n2.5.1.2 Using Lists as Queues\n.............................\n",
            "subsections": []
        },
        "It is also possible to use a list as a queue, where the first element": {
            "content": "added is the first element retrieved (\"first-in, first-out\"); however,\nlists are not efficient for this purpose.  While appends and pops from\nthe end of list are fast, doing inserts or pops from the beginning of a\nlist is slow (because all of the other elements have to be shifted by\none).\n\nTo implement a queue, use *note collections.deque: 3a0. which was\ndesigned to have fast appends and pops from both ends.  For example:\n\n>>> from collections import deque\n>>> queue = deque([\"Eric\", \"John\", \"Michael\"])\n>>> queue.append(\"Terry\")           # Terry arrives\n>>> queue.append(\"Graham\")          # Graham arrives\n>>> queue.popleft()                 # The first to arrive now leaves\n'Eric'\n>>> queue.popleft()                 # The second to arrive now leaves\n'John'\n>>> queue                           # Remaining queue in order of arrival\ndeque(['Michael', 'Terry', 'Graham'])\n\nFile: python3.12.info,  Node: List Comprehensions<2>,  Next: Nested List Comprehensions,  Prev: Using Lists as Queues,  Up: More on Lists\n\n2.5.1.3 List Comprehensions\n...........................\n",
            "subsections": []
        },
        "List comprehensions provide a concise way to create lists.  Common": {
            "content": "applications are to make new lists where each element is the result of\nsome operations applied to each member of another sequence or iterable,\nor to create a subsequence of those elements that satisfy a certain\ncondition.\n\nFor example, assume we want to create a list of squares, like:\n\n>>> squares = []\n>>> for x in range(10):\n...     squares.append(x2)\n...\n>>> squares\n[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]\n",
            "subsections": []
        },
        "Note that this creates (or overwrites) a variable named 'x' that still": {
            "content": "exists after the loop completes.  We can calculate the list of squares\nwithout any side effects using:\n\nsquares = list(map(lambda x: x2, range(10)))\n\nor, equivalently:\n\nsquares = [x2 for x in range(10)]\n\nwhich is more concise and readable.\n\nA list comprehension consists of brackets containing an expression\nfollowed by a 'for' clause, then zero or more 'for' or 'if' clauses.",
            "subsections": []
        },
        "The result will be a new list resulting from evaluating the expression": {
            "content": "in the context of the 'for' and 'if' clauses which follow it.  For\nexample, this listcomp combines the elements of two lists if they are\nnot equal:\n\n>>> [(x, y) for x in [1,2,3] for y in [3,1,4] if x != y]\n[(1, 3), (1, 4), (2, 3), (2, 1), (2, 4), (3, 1), (3, 4)]\n\nand it's equivalent to:\n\n>>> combs = []\n>>> for x in [1,2,3]:\n...     for y in [3,1,4]:\n...         if x != y:\n...             combs.append((x, y))\n...\n>>> combs\n[(1, 3), (1, 4), (2, 3), (2, 1), (2, 4), (3, 1), (3, 4)]\n\nNote how the order of the *note for: 24e. and *note if: 24f. statements\nis the same in both these snippets.\n",
            "subsections": []
        },
        "If the expression is a tuple (e.g.  the '(x, y)' in the previous": {
            "content": "example), it must be parenthesized.\n\n>>> vec = [-4, -2, 0, 2, 4]\n>>> # create a new list with the values doubled\n>>> [x*2 for x in vec]\n[-8, -4, 0, 4, 8]\n>>> # filter the list to exclude negative numbers\n>>> [x for x in vec if x >= 0]\n[0, 2, 4]\n>>> # apply a function to all the elements\n>>> [abs(x) for x in vec]\n[4, 2, 0, 2, 4]\n>>> # call a method on each element\n>>> freshfruit = ['  banana', '  loganberry ', 'passion fruit  ']\n>>> [weapon.strip() for weapon in freshfruit]\n['banana', 'loganberry', 'passion fruit']\n>>> # create a list of 2-tuples like (number, square)\n>>> [(x, x2) for x in range(6)]\n[(0, 0), (1, 1), (2, 4), (3, 9), (4, 16), (5, 25)]\n>>> # the tuple must be parenthesized, otherwise an error is raised\n>>> [x, x2 for x in range(6)]\nFile \"<stdin>\", line 1\n[x, x2 for x in range(6)]\n^^^^^^^\nSyntaxError: did you forget parentheses around the comprehension target?\n>>> # flatten a list using a listcomp with two 'for'\n>>> vec = [[1,2,3], [4,5,6], [7,8,9]]\n>>> [num for elem in vec for num in elem]\n[1, 2, 3, 4, 5, 6, 7, 8, 9]\n",
            "subsections": []
        },
        "List comprehensions can contain complex expressions and nested": {
            "content": "functions:\n\n>>> from math import pi\n>>> [str(round(pi, i)) for i in range(1, 6)]\n['3.1', '3.14', '3.142', '3.1416', '3.14159']\n\nFile: python3.12.info,  Node: Nested List Comprehensions,  Prev: List Comprehensions<2>,  Up: More on Lists\n\n2.5.1.4 Nested List Comprehensions\n..................................\n",
            "subsections": []
        },
        "The initial expression in a list comprehension can be any arbitrary": {
            "content": "expression, including another list comprehension.\n",
            "subsections": []
        },
        "Consider the following example of a 3x4 matrix implemented as a list of": {
            "content": "3 lists of length 4:\n\n>>> matrix = [\n...     [1, 2, 3, 4],\n...     [5, 6, 7, 8],\n...     [9, 10, 11, 12],\n... ]\n\nThe following list comprehension will transpose rows and columns:\n\n>>> [[row[i] for row in matrix] for i in range(4)]\n[[1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12]]\n",
            "subsections": []
        },
        "As we saw in the previous section, the inner list comprehension is": {
            "content": "evaluated in the context of the *note for: 24e. that follows it, so this\nexample is equivalent to:\n\n>>> transposed = []\n>>> for i in range(4):\n...     transposed.append([row[i] for row in matrix])\n...\n>>> transposed\n[[1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12]]\n\nwhich, in turn, is the same as:\n\n>>> transposed = []\n>>> for i in range(4):\n...     # the following 3 lines implement the nested listcomp\n...     transposedrow = []\n...     for row in matrix:\n...         transposedrow.append(row[i])\n...     transposed.append(transposedrow)\n...\n>>> transposed\n[[1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12]]\n",
            "subsections": []
        },
        "In the real world, you should prefer built-in functions to complex flow": {
            "content": "statements.  The *note zip(): 5c2. function would do a great job for\nthis use case:\n\n>>> list(zip(*matrix))\n[(1, 5, 9), (2, 6, 10), (3, 7, 11), (4, 8, 12)]\n\nSee *note Unpacking Argument Lists: 19b4. for details on the asterisk in\nthis line.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The del statement,  Next: Tuples and Sequences,  Prev: More on Lists,  Up: Data Structures": {
            "content": "",
            "subsections": []
        },
        "There is a way to remove an item from a list given its index instead of": {
            "content": "its value: the *note del: 14fb. statement.  This differs from the\n'pop()' method which returns a value.  The 'del' statement can also be\nused to remove slices from a list or clear the entire list (which we did\nearlier by assignment of an empty list to the slice).  For example:\n\n>>> a = [-1, 1, 66.25, 333, 333, 1234.5]\n>>> del a[0]\n>>> a\n[1, 66.25, 333, 333, 1234.5]\n>>> del a[2:4]\n>>> a\n[1, 66.25, 1234.5]\n>>> del a[:]\n>>> a\n[]\n\n*note del: 14fb. can also be used to delete entire variables:\n\n>>> del a\n",
            "subsections": []
        },
        "Referencing the name 'a' hereafter is an error (at least until another": {
            "content": "value is assigned to it).  We'll find other uses for *note del: 14fb.\nlater.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Tuples and Sequences,  Next: Sets,  Prev: The del statement,  Up: Data Structures": {
            "content": "",
            "subsections": []
        },
        "We saw that lists and strings have many common properties, such as": {
            "content": "indexing and slicing operations.  They are two examples of 'sequence'\ndata types (see *note Sequence Types -- list, tuple, range: 19ce.).",
            "subsections": []
        },
        "Since Python is an evolving language, other sequence data types may be": {
            "content": "added.  There is also another standard sequence data type: the 'tuple'.\n\nA tuple consists of a number of values separated by commas, for\ninstance:\n\n>>> t = 12345, 54321, 'hello!'\n>>> t[0]\n12345\n>>> t\n(12345, 54321, 'hello!')\n>>> # Tuples may be nested:\n... u = t, (1, 2, 3, 4, 5)\n>>> u\n((12345, 54321, 'hello!'), (1, 2, 3, 4, 5))\n>>> # Tuples are immutable:\n... t[0] = 88888\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nTypeError: 'tuple' object does not support item assignment\n>>> # but they can contain mutable objects:\n... v = ([1, 2, 3], [3, 2, 1])\n>>> v\n([1, 2, 3], [3, 2, 1])\n",
            "subsections": []
        },
        "As you see, on output tuples are always enclosed in parentheses, so that": {
            "content": "nested tuples are interpreted correctly; they may be input with or\nwithout surrounding parentheses, although often parentheses are\nnecessary anyway (if the tuple is part of a larger expression).  It is\nnot possible to assign to the individual items of a tuple, however it is\npossible to create tuples which contain mutable objects, such as lists.\n",
            "subsections": []
        },
        "Though tuples may seem similar to lists, they are often used in": {
            "content": "different situations and for different purposes.  Tuples are *note\nimmutable: 1982, and usually contain a heterogeneous sequence of\nelements that are accessed via unpacking (see later in this section) or\nindexing (or even by attribute in the case of *note namedtuples: 711.).\nLists are *note mutable: 1987, and their elements are usually\nhomogeneous and are accessed by iterating over the list.\n\nA special problem is the construction of tuples containing 0 or 1 items:\nthe syntax has some extra quirks to accommodate these.  Empty tuples are\nconstructed by an empty pair of parentheses; a tuple with one item is\nconstructed by following a value with a comma (it is not sufficient to\nenclose a single value in parentheses).  Ugly, but effective.  For\nexample:\n\n>>> empty = ()\n>>> singleton = 'hello',    # <-- note trailing comma\n>>> len(empty)\n0\n>>> len(singleton)\n1\n>>> singleton\n('hello',)\n\nThe statement 't = 12345, 54321, 'hello!'' is an example of 'tuple\npacking': the values '12345', '54321' and ''hello!'' are packed together\nin a tuple.  The reverse operation is also possible:\n\n>>> x, y, z = t\n",
            "subsections": []
        },
        "This is called, appropriately enough, 'sequence unpacking' and works for": {
            "content": "any sequence on the right-hand side.  Sequence unpacking requires that\nthere are as many variables on the left side of the equals sign as there\nare elements in the sequence.  Note that multiple assignment is really\njust a combination of tuple packing and sequence unpacking.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Sets,  Next: Dictionaries,  Prev: Tuples and Sequences,  Up: Data Structures": {
            "content": "",
            "subsections": []
        },
        "Python also includes a data type for 'sets'.  A set is an unordered": {
            "content": "collection with no duplicate elements.  Basic uses include membership\ntesting and eliminating duplicate entries.  Set objects also support\nmathematical operations like union, intersection, difference, and\nsymmetric difference.\n\nCurly braces or the *note set(): 39d. function can be used to create\nsets.  Note: to create an empty set you have to use 'set()', not '{}';\nthe latter creates an empty dictionary, a data structure that we discuss\nin the next section.\n\nHere is a brief demonstration:\n\n>>> basket = {'apple', 'orange', 'apple', 'pear', 'orange', 'banana'}\n>>> print(basket)                      # show that duplicates have been removed\n{'orange', 'banana', 'pear', 'apple'}\n>>> 'orange' in basket                 # fast membership testing\nTrue\n>>> 'crabgrass' in basket\nFalse\n\n>>> # Demonstrate set operations on unique letters from two words\n...\n>>> a = set('abracadabra')\n>>> b = set('alacazam')\n>>> a                                  # unique letters in a\n{'a', 'r', 'b', 'c', 'd'}\n>>> a - b                              # letters in a but not in b\n{'r', 'd', 'b'}\n>>> a | b                              # letters in a or b or both\n{'a', 'c', 'r', 'd', 'b', 'm', 'z', 'l'}\n>>> a & b                              # letters in both a and b\n{'a', 'c'}\n>>> a ^ b                              # letters in a or b but not both\n{'r', 'd', 'b', 'm', 'z', 'l'}\n\nSimilarly to *note list comprehensions: 19c9, set comprehensions are\nalso supported:\n\n>>> a = {x for x in 'abracadabra' if x not in 'abc'}\n>>> a\n{'r', 'd'}\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Dictionaries,  Next: Looping Techniques,  Prev: Sets,  Up: Data Structures": {
            "content": "",
            "subsections": []
        },
        "Another useful data type built into Python is the 'dictionary' (see": {
            "content": "*note Mapping Types -- dict: 8fc.).  Dictionaries are sometimes found in\nother languages as \"associative memories\" or \"associative arrays\".",
            "subsections": []
        },
        "Unlike sequences, which are indexed by a range of numbers, dictionaries": {
            "content": "are indexed by 'keys', which can be any immutable type; strings and\nnumbers can always be keys.  Tuples can be used as keys if they contain\nonly strings, numbers, or tuples; if a tuple contains any mutable object\neither directly or indirectly, it cannot be used as a key.  You can't\nuse lists as keys, since lists can be modified in place using index\nassignments, slice assignments, or methods like 'append()' and\n'extend()'.\n",
            "subsections": []
        },
        "It is best to think of a dictionary as a set of 'key: value' pairs, with": {
            "content": "the requirement that the keys are unique (within one dictionary).  A\npair of braces creates an empty dictionary: '{}'.  Placing a\ncomma-separated list of key:value pairs within the braces adds initial\nkey:value pairs to the dictionary; this is also the way dictionaries are\nwritten on output.\n",
            "subsections": []
        },
        "The main operations on a dictionary are storing a value with some key": {
            "content": "and extracting the value given the key.  It is also possible to delete a\nkey:value pair with 'del'.  If you store using a key that is already in\nuse, the old value associated with that key is forgotten.  It is an\nerror to extract a value using a non-existent key.\n",
            "subsections": []
        },
        "Performing 'list(d)' on a dictionary returns a list of all the keys used": {
            "content": "in the dictionary, in insertion order (if you want it sorted, just use\n'sorted(d)' instead).  To check whether a single key is in the\ndictionary, use the *note in: 250. keyword.\n\nHere is a small example using a dictionary:\n\n>>> tel = {'jack': 4098, 'sape': 4139}\n>>> tel['guido'] = 4127\n>>> tel\n{'jack': 4098, 'sape': 4139, 'guido': 4127}\n>>> tel['jack']\n4098\n>>> del tel['sape']\n>>> tel['irv'] = 4127\n>>> tel\n{'jack': 4098, 'guido': 4127, 'irv': 4127}\n>>> list(tel)\n['jack', 'guido', 'irv']\n>>> sorted(tel)\n['guido', 'irv', 'jack']\n>>> 'guido' in tel\nTrue\n>>> 'jack' not in tel\nFalse\n\nThe *note dict(): 237. constructor builds dictionaries directly from\nsequences of key-value pairs:\n\n>>> dict([('sape', 4139), ('guido', 4127), ('jack', 4098)])\n{'sape': 4139, 'guido': 4127, 'jack': 4098}\n",
            "subsections": []
        },
        "In addition, dict comprehensions can be used to create dictionaries from": {
            "content": "arbitrary key and value expressions:\n\n>>> {x: x2 for x in (2, 4, 6)}\n{2: 4, 4: 16, 6: 36}\n",
            "subsections": []
        },
        "When the keys are simple strings, it is sometimes easier to specify": {
            "content": "pairs using keyword arguments:\n\n>>> dict(sape=4139, guido=4127, jack=4098)\n{'sape': 4139, 'guido': 4127, 'jack': 4098}\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Looping Techniques,  Next: More on Conditions,  Prev: Dictionaries,  Up: Data Structures": {
            "content": "",
            "subsections": []
        },
        "When looping through dictionaries, the key and corresponding value can": {
            "content": "be retrieved at the same time using the *note items(): 5c1. method.\n\n>>> knights = {'gallahad': 'the pure', 'robin': 'the brave'}\n>>> for k, v in knights.items():\n...     print(k, v)\n...\ngallahad the pure\nrobin the brave\n",
            "subsections": []
        },
        "When looping through a sequence, the position index and corresponding": {
            "content": "value can be retrieved at the same time using the *note enumerate():\n12d5. function.\n\n>>> for i, v in enumerate(['tic', 'tac', 'toe']):\n...     print(i, v)\n...\n0 tic\n1 tac\n2 toe\n",
            "subsections": []
        },
        "To loop over two or more sequences at the same time, the entries can be": {
            "content": "paired with the *note zip(): 5c2. function.\n\n>>> questions = ['name', 'quest', 'favorite color']\n>>> answers = ['lancelot', 'the holy grail', 'blue']\n>>> for q, a in zip(questions, answers):\n...     print('What is your {0}?  It is {1}.'.format(q, a))\n...\nWhat is your name?  It is lancelot.\nWhat is your quest?  It is the holy grail.\nWhat is your favorite color?  It is blue.\n",
            "subsections": []
        },
        "To loop over a sequence in reverse, first specify the sequence in a": {
            "content": "forward direction and then call the *note reversed(): 661. function.\n\n>>> for i in reversed(range(1, 10, 2)):\n...     print(i)\n...\n9\n7\n5\n3\n1\n\nTo loop over a sequence in sorted order, use the *note sorted(): a12.\nfunction which returns a new sorted list while leaving the source\nunaltered.\n\n>>> basket = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana']\n>>> for i in sorted(basket):\n...     print(i)\n...\napple\napple\nbanana\norange\norange\npear\n\nUsing *note set(): 39d. on a sequence eliminates duplicate elements.\nThe use of *note sorted(): a12. in combination with *note set(): 39d.\nover a sequence is an idiomatic way to loop over unique elements of the\nsequence in sorted order.\n\n>>> basket = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana']\n>>> for f in sorted(set(basket)):\n...     print(f)\n...\napple\nbanana\norange\npear\n",
            "subsections": []
        },
        "It is sometimes tempting to change a list while you are looping over it;": {
            "content": "however, it is often simpler and safer to create a new list instead.\n\n>>> import math\n>>> rawdata = [56.2, float('NaN'), 51.7, 55.3, 52.5, float('NaN'), 47.8]\n>>> filtereddata = []\n>>> for value in rawdata:\n...     if not math.isnan(value):\n...         filtereddata.append(value)\n...\n>>> filtereddata\n[56.2, 51.7, 55.3, 52.5, 47.8]\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: More on Conditions,  Next: Comparing Sequences and Other Types,  Prev: Looping Techniques,  Up: Data Structures": {
            "content": "",
            "subsections": []
        },
        "The conditions used in 'while' and 'if' statements can contain any": {
            "content": "operators, not just comparisons.\n",
            "subsections": []
        },
        "The comparison operators 'in' and 'not in' are membership tests that": {
            "content": "determine whether a value is in (or not in) a container.  The operators\n'is' and 'is not' compare whether two objects are really the same\nobject.  All comparison operators have the same priority, which is lower\nthan that of all numerical operators.\n\nComparisons can be chained.  For example, 'a < b == c' tests whether 'a'\nis less than 'b' and moreover 'b' equals 'c'.\n",
            "subsections": []
        },
        "Comparisons may be combined using the Boolean operators 'and' and 'or',": {
            "content": "and the outcome of a comparison (or of any other Boolean expression) may\nbe negated with 'not'.  These have lower priorities than comparison\noperators; between them, 'not' has the highest priority and 'or' the\nlowest, so that 'A and not B or C' is equivalent to '(A and (not B)) or\nC'.  As always, parentheses can be used to express the desired\ncomposition.\n",
            "subsections": []
        },
        "The Boolean operators 'and' and 'or' are so-called 'short-circuit'": {
            "content": "operators: their arguments are evaluated from left to right, and\nevaluation stops as soon as the outcome is determined.  For example, if\n'A' and 'C' are true but 'B' is false, 'A and B and C' does not evaluate\nthe expression 'C'.  When used as a general value and not as a Boolean,\nthe return value of a short-circuit operator is the last evaluated\nargument.\n",
            "subsections": []
        },
        "It is possible to assign the result of a comparison or other Boolean": {
            "content": "expression to a variable.  For example,\n\n>>> string1, string2, string3 = '', 'Trondheim', 'Hammer Dance'\n>>> nonnull = string1 or string2 or string3\n>>> nonnull\n'Trondheim'\n",
            "subsections": []
        },
        "Note that in Python, unlike C, assignment inside expressions must be": {
            "content": "done explicitly with the *note walrus operator: 19d6. ':='.  This avoids\na common class of problems encountered in C programs: typing '=' in an\nexpression when '==' was intended.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Comparing Sequences and Other Types,  Prev: More on Conditions,  Up: Data Structures": {
            "content": "",
            "subsections": []
        },
        "Sequence objects typically may be compared to other objects with the": {
            "content": "same sequence type.  The comparison uses 'lexicographical' ordering:\nfirst the first two items are compared, and if they differ this\ndetermines the outcome of the comparison; if they are equal, the next\ntwo items are compared, and so on, until either sequence is exhausted.",
            "subsections": []
        },
        "If two items to be compared are themselves sequences of the same type,": {
            "content": "the lexicographical comparison is carried out recursively.  If all items\nof two sequences compare equal, the sequences are considered equal.  If\none sequence is an initial sub-sequence of the other, the shorter\nsequence is the smaller (lesser) one.  Lexicographical ordering for\nstrings uses the Unicode code point number to order individual\ncharacters.  Some examples of comparisons between sequences of the same\ntype:\n\n(1, 2, 3)              < (1, 2, 4)\n[1, 2, 3]              < [1, 2, 4]\n'ABC' < 'C' < 'Pascal' < 'Python'\n(1, 2, 3, 4)           < (1, 2, 4)\n(1, 2)                 < (1, 2, -1)\n(1, 2, 3)             == (1.0, 2.0, 3.0)\n(1, 2, ('aa', 'ab'))   < (1, 2, ('abc', 'a'), 4)\n\nNote that comparing objects of different types with '<' or '>' is legal\nprovided that the objects have appropriate comparison methods.  For\nexample, mixed numeric types are compared according to their numeric\nvalue, so 0 equals 0.0, etc.  Otherwise, rather than providing an\narbitrary ordering, the interpreter will raise a *note TypeError: 28e.\nexception.\n\nFile: python3.12.info,  Node: Modules<2>,  Next: Input and Output,  Prev: Data Structures,  Up: The Python Tutorial\n",
            "subsections": [
                {
                    "name": "2.6 Modules",
                    "content": ""
                }
            ]
        },
        "If you quit from the Python interpreter and enter it again, the": {
            "content": "definitions you have made (functions and variables) are lost.",
            "subsections": []
        },
        "Therefore, if you want to write a somewhat longer program, you are": {
            "content": "better off using a text editor to prepare the input for the interpreter\nand running it with that file as input instead.  This is known as\ncreating a 'script'.  As your program gets longer, you may want to split\nit into several files for easier maintenance.  You may also want to use\na handy function that you've written in several programs without copying\nits definition into each program.\n",
            "subsections": []
        },
        "To support this, Python has a way to put definitions in a file and use": {
            "content": "them in a script or in an interactive instance of the interpreter.  Such\na file is called a 'module'; definitions from a module can be 'imported'\ninto other modules or into the 'main' module (the collection of\nvariables that you have access to in a script executed at the top level\nand in calculator mode).\n\nA module is a file containing Python definitions and statements.  The\nfile name is the module name with the suffix '.py' appended.  Within a\nmodule, the module's name (as a string) is available as the value of the\nglobal variable 'name'.  For instance, use your favorite text editor\nto create a file called 'fibo.py' in the current directory with the\nfollowing contents:\n\n# Fibonacci numbers module\n\ndef fib(n):    # write Fibonacci series up to n\na, b = 0, 1\nwhile a < n:\nprint(a, end=' ')\na, b = b, a+b\nprint()\n\ndef fib2(n):   # return Fibonacci series up to n\nresult = []\na, b = 0, 1\nwhile a < n:\nresult.append(a)\na, b = b, a+b\nreturn result\n",
            "subsections": []
        },
        "Now enter the Python interpreter and import this module with the": {
            "content": "following command:\n\n>>> import fibo\n",
            "subsections": []
        },
        "This does not add the names of the functions defined in 'fibo' directly": {
            "content": "to the current *note namespace: 19dc. (see *note Python Scopes and",
            "subsections": []
        },
        "Namespaces: 19dd. for more details); it only adds the module name 'fibo'": {
            "content": "there.  Using the module name you can access the functions:\n\n>>> fibo.fib(1000)\n0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987\n>>> fibo.fib2(100)\n[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]\n>>> fibo.name\n'fibo'\n\nIf you intend to use a function often you can assign it to a local name:\n\n>>> fib = fibo.fib\n>>> fib(500)\n0 1 1 2 3 5 8 13 21 34 55 89 144 233 377\n\n* Menu:\n\n* More on Modules::\n* Standard Modules::\n* The dir() Function: The dir Function.\n* Packages::\n\nFile: python3.12.info,  Node: More on Modules,  Next: Standard Modules,  Up: Modules<2>\n\n\nA module can contain executable statements as well as function\ndefinitions.  These statements are intended to initialize the module.",
            "subsections": []
        },
        "They are executed only the 'first' time the module name is encountered": {
            "content": "in an import statement.  (1)  (They are also run if the file is executed\nas a script.)\n",
            "subsections": []
        },
        "Each module has its own private namespace, which is used as the global": {
            "content": "namespace by all functions defined in the module.  Thus, the author of a\nmodule can use global variables in the module without worrying about\naccidental clashes with a user's global variables.  On the other hand,\nif you know what you are doing you can touch a module's global variables\nwith the same notation used to refer to its functions,\n'modname.itemname'.\n",
            "subsections": []
        },
        "Modules can import other modules.  It is customary but not required to": {
            "content": "place all *note import: 3a6. statements at the beginning of a module (or\nscript, for that matter).  The imported module names, if placed at the\ntop level of a module (outside any functions or classes), are added to\nthe module's global namespace.\n\nThere is a variant of the *note import: 3a6. statement that imports\nnames from a module directly into the importing module's namespace.  For\nexample:\n\n>>> from fibo import fib, fib2\n>>> fib(500)\n0 1 1 2 3 5 8 13 21 34 55 89 144 233 377\n",
            "subsections": []
        },
        "This does not introduce the module name from which the imports are taken": {
            "content": "in the local namespace (so in the example, 'fibo' is not defined).\n\nThere is even a variant to import all names that a module defines:\n\n>>> from fibo import *\n>>> fib(500)\n0 1 1 2 3 5 8 13 21 34 55 89 144 233 377\n\nThis imports all names except those beginning with an underscore ('').",
            "subsections": []
        },
        "In most cases Python programmers do not use this facility since it": {
            "content": "introduces an unknown set of names into the interpreter, possibly hiding\nsome things you have already defined.\n\nNote that in general the practice of importing '*' from a module or\npackage is frowned upon, since it often causes poorly readable code.\nHowever, it is okay to use it to save typing in interactive sessions.\n",
            "subsections": []
        },
        "If the module name is followed by 'as', then the name following 'as' is": {
            "content": "bound directly to the imported module.\n\n>>> import fibo as fib\n>>> fib.fib(500)\n0 1 1 2 3 5 8 13 21 34 55 89 144 233 377\n",
            "subsections": []
        },
        "This is effectively importing the module in the same way that 'import": {
            "content": "fibo' will do, with the only difference of it being available as 'fib'.\n\nIt can also be used when utilising *note from: 1123. with similar\neffects:\n\n>>> from fibo import fib as fibonacci\n>>> fibonacci(500)\n0 1 1 2 3 5 8 13 21 34 55 89 144 233 377\n\nNote: For efficiency reasons, each module is only imported once per\ninterpreter session.  Therefore, if you change your modules, you\nmust restart the interpreter - or, if it's just one module you want\nto test interactively, use *note importlib.reload(): 26b, e.g.\n'import importlib; importlib.reload(modulename)'.\n\n* Menu:\n\n* Executing modules as scripts::\n* The Module Search Path::\n* \"Compiled\" Python files::\n\n---------- Footnotes ----------\n\n(1) In fact function definitions are also 'statements' that are\n'executed'; the execution of a module-level function definition adds the\nfunction name to the module's global namespace.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Executing modules as scripts,  Next: The Module Search Path,  Up: More on Modules": {
            "content": "2.6.1.1 Executing modules as scripts\n....................................\n",
            "subsections": []
        },
        "When you run a Python module with": {
            "content": "python fibo.py <arguments>\n\nthe code in the module will be executed, just as if you imported it, but\nwith the 'name' set to '\"main\"'.  That means that by adding this\ncode at the end of your module:\n\nif name == \"main\":\nimport sys\nfib(int(sys.argv[1]))\n\nyou can make the file usable as a script as well as an importable\nmodule, because the code that parses the command line only runs if the\nmodule is executed as the \"main\" file:\n\n$ python fibo.py 50\n0 1 1 2 3 5 8 13 21 34\n\nIf the module is imported, the code is not run:\n\n>>> import fibo\n>>>\n",
            "subsections": []
        },
        "This is often used either to provide a convenient user interface to a": {
            "content": "module, or for testing purposes (running the module as a script executes\na test suite).\n\nFile: python3.12.info,  Node: The Module Search Path,  Next: \"Compiled\" Python files,  Prev: Executing modules as scripts,  Up: More on Modules\n\n2.6.1.2 The Module Search Path\n..............................\n",
            "subsections": []
        },
        "When a module named 'spam' is imported, the interpreter first searches": {
            "content": "for a built-in module with that name.  These module names are listed in\n*note sys.builtinmodulenames: 19e4.  If not found, it then searches\nfor a file named 'spam.py' in a list of directories given by the\nvariable *note sys.path: 32c.  *note sys.path: 32c. is initialized from\nthese locations:\n\n* The directory containing the input script (or the current directory\nwhen no file is specified).\n\n* *note PYTHONPATH: e92. (a list of directory names, with the same\nsyntax as the shell variable 'PATH').\n\n* The installation-dependent default (by convention including a\n'site-packages' directory, handled by the *note site: c2. module).\n\nMore details are at *note The initialization of the sys.path module\nsearch path: 19e5.\n\nNote: On file systems which support symlinks, the directory\ncontaining the input script is calculated after the symlink is\nfollowed.  In other words the directory containing the symlink is\n'not' added to the module search path.\n\nAfter initialization, Python programs can modify *note sys.path: 32c.",
            "subsections": []
        },
        "The directory containing the script being run is placed at the beginning": {
            "content": "of the search path, ahead of the standard library path.  This means that\nscripts in that directory will be loaded instead of modules of the same\nname in the library directory.  This is an error unless the replacement\nis intended.  See section *note Standard Modules: 19e6. for more\ninformation.\n\nFile: python3.12.info,  Node: \"Compiled\" Python files,  Prev: The Module Search Path,  Up: More on Modules\n\n2.6.1.3 \"Compiled\" Python files\n...............................\n",
            "subsections": []
        },
        "To speed up loading modules, Python caches the compiled version of each": {
            "content": "module in the 'pycache' directory under the name\n'module.`version'.pyc', where the version encodes the format of the\ncompiled file; it generally contains the Python version number.  For\nexample, in CPython release 3.3 the compiled version of spam.py would be\ncached as 'pycache/spam.cpython-33.pyc'.  This naming convention\nallows compiled modules from different releases and different versions\nof Python to coexist.\n",
            "subsections": []
        },
        "Python checks the modification date of the source against the compiled": {
            "content": "version to see if it's out of date and needs to be recompiled.  This is\na completely automatic process.  Also, the compiled modules are\nplatform-independent, so the same library can be shared among systems\nwith different architectures.\n",
            "subsections": []
        },
        "Python does not check the cache in two circumstances.  First, it always": {
            "content": "recompiles and does not store the result for the module that's loaded\ndirectly from the command line.  Second, it does not check the cache if\nthere is no source module.  To support a non-source (compiled only)\ndistribution, the compiled module must be in the source directory, and\nthere must not be a source module.\n\nSome tips for experts:\n\n* You can use the *note -O: c11. or *note -OO: c12. switches on the\nPython command to reduce the size of a compiled module.  The '-O'\nswitch removes assert statements, the '-OO' switch removes both\nassert statements and doc strings.  Since some programs may\nrely on having these available, you should only use this option if\nyou know what you're doing.  \"Optimized\" modules have an 'opt-' tag\nand are usually smaller.  Future releases may change the effects of\noptimization.\n\n* A program doesn't run any faster when it is read from a '.pyc' file\nthan when it is read from a '.py' file; the only thing that's\nfaster about '.pyc' files is the speed with which they are loaded.\n\n* The module *note compileall: 1e. can create .pyc files for all\nmodules in a directory.\n\n* There is more detail on this process, including a flow chart of the\ndecisions, in PEP 3147(1).\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3147/\n\nFile: python3.12.info,  Node: Standard Modules,  Next: The dir Function,  Prev: More on Modules,  Up: Modules<2>\n\n",
            "subsections": []
        },
        "Python comes with a library of standard modules, described in a separate": {
            "content": "document, the Python Library Reference (\"Library Reference\" hereafter).",
            "subsections": []
        },
        "Some modules are built into the interpreter; these provide access to": {
            "content": "operations that are not part of the core of the language but are\nnevertheless built in, either for efficiency or to provide access to\noperating system primitives such as system calls.  The set of such\nmodules is a configuration option which also depends on the underlying\nplatform.  For example, the *note winreg: 111. module is only provided\non Windows systems.  One particular module deserves some attention:\n*note sys: d3, which is built into every Python interpreter.  The\nvariables 'sys.ps1' and 'sys.ps2' define the strings used as primary and\nsecondary prompts:\n\n>>> import sys\n>>> sys.ps1\n'>>> '\n>>> sys.ps2\n'... '\n>>> sys.ps1 = 'C> '\nC> print('Yuck!')\nYuck!\nC>\n",
            "subsections": []
        },
        "These two variables are only defined if the interpreter is in": {
            "content": "interactive mode.\n",
            "subsections": []
        },
        "The variable 'sys.path' is a list of strings that determines the": {
            "content": "interpreter's search path for modules.  It is initialized to a default\npath taken from the environment variable *note PYTHONPATH: e92, or from\na built-in default if *note PYTHONPATH: e92. is not set.  You can modify\nit using standard list operations:\n\n>>> import sys\n>>> sys.path.append('/ufs/guido/lib/python')\n\nFile: python3.12.info,  Node: The dir Function,  Next: Packages,  Prev: Standard Modules,  Up: Modules<2>\n\n\nThe built-in function *note dir(): 3ff. is used to find out which names\na module defines.  It returns a sorted list of strings:\n\n>>> import fibo, sys\n>>> dir(fibo)\n['name', 'fib', 'fib2']\n>>> dir(sys)\n['breakpointhook', 'displayhook', 'doc', 'excepthook',\n'interactivehook', 'loader', 'name', 'package', 'spec',\n'stderr', 'stdin', 'stdout', 'unraisablehook',\n'cleartypecache', 'currentframes', 'debugmallocstats', 'framework',\n'getframe', 'git', 'home', 'xoptions', 'abiflags', 'addaudithook',\n'apiversion', 'argv', 'audit', 'baseexecprefix', 'baseprefix',\n'breakpointhook', 'builtinmodulenames', 'byteorder', 'calltracing',\n'callstats', 'copyright', 'displayhook', 'dontwritebytecode', 'excinfo',\n'excepthook', 'execprefix', 'executable', 'exit', 'flags', 'floatinfo',\n'floatreprstyle', 'getasyncgenhooks', 'getcoroutineorigintrackingdepth',\n'getallocatedblocks', 'getdefaultencoding', 'getdlopenflags',\n'getfilesystemencodeerrors', 'getfilesystemencoding', 'getprofile',\n'getrecursionlimit', 'getrefcount', 'getsizeof', 'getswitchinterval',\n'gettrace', 'hashinfo', 'hexversion', 'implementation', 'intinfo',\n'intern', 'isfinalizing', 'lasttraceback', 'lasttype', 'lastvalue',\n'maxsize', 'maxunicode', 'metapath', 'modules', 'path', 'pathhooks',\n'pathimportercache', 'platform', 'prefix', 'ps1', 'ps2', 'pycacheprefix',\n'setasyncgenhooks', 'setcoroutineorigintrackingdepth', 'setdlopenflags',\n'setprofile', 'setrecursionlimit', 'setswitchinterval', 'settrace', 'stderr',\n'stdin', 'stdout', 'threadinfo', 'unraisablehook', 'version', 'versioninfo',\n'warnoptions']\n\nWithout arguments, *note dir(): 3ff. lists the names you have defined\ncurrently:\n\n>>> a = [1, 2, 3, 4, 5]\n>>> import fibo\n>>> fib = fibo.fib\n>>> dir()\n['builtins', 'name', 'a', 'fib', 'fibo', 'sys']\n",
            "subsections": []
        },
        "Note that it lists all types of names: variables, modules, functions,": {
            "content": "etc.\n\n*note dir(): 3ff. does not list the names of built-in functions and\nvariables.  If you want a list of those, they are defined in the\nstandard module *note builtins: 10.:\n\n>>> import builtins\n>>> dir(builtins)\n['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException',\n'BlockingIOError', 'BrokenPipeError', 'BufferError', 'BytesWarning',\n'ChildProcessError', 'ConnectionAbortedError', 'ConnectionError',\n'ConnectionRefusedError', 'ConnectionResetError', 'DeprecationWarning',\n'EOFError', 'Ellipsis', 'EnvironmentError', 'Exception', 'False',\n'FileExistsError', 'FileNotFoundError', 'FloatingPointError',\n'FutureWarning', 'GeneratorExit', 'IOError', 'ImportError',\n'ImportWarning', 'IndentationError', 'IndexError', 'InterruptedError',\n'IsADirectoryError', 'KeyError', 'KeyboardInterrupt', 'LookupError',\n'MemoryError', 'NameError', 'None', 'NotADirectoryError', 'NotImplemented',\n'NotImplementedError', 'OSError', 'OverflowError',\n'PendingDeprecationWarning', 'PermissionError', 'ProcessLookupError',\n'ReferenceError', 'ResourceWarning', 'RuntimeError', 'RuntimeWarning',\n'StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError',\n'SystemExit', 'TabError', 'TimeoutError', 'True', 'TypeError',\n'UnboundLocalError', 'UnicodeDecodeError', 'UnicodeEncodeError',\n'UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserWarning',\n'ValueError', 'Warning', 'ZeroDivisionError', '', 'buildclass',\n'debug', 'doc', 'import', 'name', 'package', 'abs',\n'all', 'any', 'ascii', 'bin', 'bool', 'bytearray', 'bytes', 'callable',\n'chr', 'classmethod', 'compile', 'complex', 'copyright', 'credits',\n'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'exec', 'exit',\n'filter', 'float', 'format', 'frozenset', 'getattr', 'globals', 'hasattr',\n'hash', 'help', 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass',\n'iter', 'len', 'license', 'list', 'locals', 'map', 'max', 'memoryview',\n'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property',\n'quit', 'range', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice',\n'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'vars',\n'zip']\n\nFile: python3.12.info,  Node: Packages,  Prev: The dir Function,  Up: Modules<2>\n\n",
            "subsections": []
        },
        "Packages are a way of structuring Python's module namespace by using": {
            "content": "\"dotted module names\".  For example, the module name 'A.B' designates a\nsubmodule named 'B' in a package named 'A'.  Just like the use of\nmodules saves the authors of different modules from having to worry\nabout each other's global variable names, the use of dotted module names\nsaves the authors of multi-module packages like NumPy or Pillow from\nhaving to worry about each other's module names.\n\nSuppose you want to design a collection of modules (a \"package\") for the\nuniform handling of sound files and sound data.  There are many\ndifferent sound file formats (usually recognized by their extension, for\nexample: '.wav', '.aiff', '.au'), so you may need to create and maintain\na growing collection of modules for the conversion between the various\nfile formats.  There are also many different operations you might want\nto perform on sound data (such as mixing, adding echo, applying an\nequalizer function, creating an artificial stereo effect), so in\naddition you will be writing a never-ending stream of modules to perform\nthese operations.  Here's a possible structure for your package\n(expressed in terms of a hierarchical filesystem):\n\nsound/                          Top-level package\ninit.py               Initialize the sound package\nformats/                  Subpackage for file format conversions\ninit.py\nwavread.py\nwavwrite.py\naiffread.py\naiffwrite.py\nauread.py\nauwrite.py\n...\neffects/                  Subpackage for sound effects\ninit.py\necho.py\nsurround.py\nreverse.py\n...\nfilters/                  Subpackage for filters\ninit.py\nequalizer.py\nvocoder.py\nkaraoke.py\n...\n",
            "subsections": []
        },
        "When importing the package, Python searches through the directories on": {
            "content": "'sys.path' looking for the package subdirectory.\n",
            "subsections": []
        },
        "The 'init.py' files are required to make Python treat directories": {
            "content": "containing the file as packages (unless using a *note namespace package:\n19ed, a relatively advanced feature).  This prevents directories with a\ncommon name, such as 'string', from unintentionally hiding valid modules\nthat occur later on the module search path.  In the simplest case,\n'init.py' can just be an empty file, but it can also execute\ninitialization code for the package or set the 'all' variable,\ndescribed later.\n",
            "subsections": []
        },
        "Users of the package can import individual modules from the package, for": {
            "content": "example:\n\nimport sound.effects.echo\n",
            "subsections": []
        },
        "This loads the submodule 'sound.effects.echo'.  It must be referenced": {
            "content": "with its full name.\n\nsound.effects.echo.echofilter(input, output, delay=0.7, atten=4)\n\nAn alternative way of importing the submodule is:\n\nfrom sound.effects import echo\n",
            "subsections": []
        },
        "This also loads the submodule 'echo', and makes it available without its": {
            "content": "package prefix, so it can be used as follows:\n\necho.echofilter(input, output, delay=0.7, atten=4)\n",
            "subsections": []
        },
        "Yet another variation is to import the desired function or variable": {
            "content": "directly:\n\nfrom sound.effects.echo import echofilter\n",
            "subsections": []
        },
        "Again, this loads the submodule 'echo', but this makes its function": {
            "content": "'echofilter()' directly available:\n\nechofilter(input, output, delay=0.7, atten=4)\n",
            "subsections": []
        },
        "Note that when using 'from package import item', the item can be either": {
            "content": "a submodule (or subpackage) of the package, or some other name defined\nin the package, like a function, class or variable.  The 'import'\nstatement first tests whether the item is defined in the package; if\nnot, it assumes it is a module and attempts to load it.  If it fails to\nfind it, an *note ImportError: 145. exception is raised.\n",
            "subsections": []
        },
        "Contrarily, when using syntax like 'import item.subitem.subsubitem',": {
            "content": "each item except for the last must be a package; the last item can be a\nmodule or a package but can't be a class or function or variable defined\nin the previous item.\n\n* Menu:\n\n* Importing * From a Package::\n* Intra-package References::\n* Packages in Multiple Directories::\n\nFile: python3.12.info,  Node: Importing * From a Package,  Next: Intra-package References,  Up: Packages\n\n2.6.4.1 Importing * From a Package\n..................................\n\nNow what happens when the user writes 'from sound.effects import *'?",
            "subsections": []
        },
        "Ideally, one would hope that this somehow goes out to the filesystem,": {
            "content": "finds which submodules are present in the package, and imports them all.",
            "subsections": []
        },
        "This could take a long time and importing sub-modules might have": {
            "content": "unwanted side-effects that should only happen when the sub-module is\nexplicitly imported.\n",
            "subsections": []
        },
        "The only solution is for the package author to provide an explicit index": {
            "content": "of the package.  The *note import: 3a6. statement uses the following\nconvention: if a package's 'init.py' code defines a list named\n'all', it is taken to be the list of module names that should be\nimported when 'from package import *' is encountered.  It is up to the\npackage author to keep this list up-to-date when a new version of the\npackage is released.  Package authors may also decide not to support it,\nif they don't see a use for importing * from their package.  For\nexample, the file 'sound/effects/init.py' could contain the\nfollowing code:\n\nall = [\"echo\", \"surround\", \"reverse\"]\n\nThis would mean that 'from sound.effects import *' would import the\nthree named submodules of the 'sound.effects' package.\n\nBe aware that submodules might become shadowed by locally defined names.",
            "subsections": []
        },
        "For example, if you added a 'reverse' function to the": {
            "content": "'sound/effects/init.py' file, the 'from sound.effects import *'\nwould only import the two submodules 'echo' and 'surround', but 'not'\nthe 'reverse' submodule, because it is shadowed by the locally defined\n'reverse' function:\n\nall = [\n\"echo\",      # refers to the 'echo.py' file\n\"surround\",  # refers to the 'surround.py' file\n\"reverse\",   # !!! refers to the 'reverse' function now !!!\n]\n\ndef reverse(msg: str):  # <-- this name shadows the 'reverse.py' submodule\nreturn msg[::-1]    #     in the case of a 'from sound.effects import *'\n\nIf 'all' is not defined, the statement 'from sound.effects import *'\ndoes 'not' import all submodules from the package 'sound.effects' into\nthe current namespace; it only ensures that the package 'sound.effects'\nhas been imported (possibly running any initialization code in\n'init.py') and then imports whatever names are defined in the\npackage.  This includes any names defined (and submodules explicitly\nloaded) by 'init.py'.  It also includes any submodules of the\npackage that were explicitly loaded by previous *note import: 3a6.\nstatements.  Consider this code:\n\nimport sound.effects.echo\nimport sound.effects.surround\nfrom sound.effects import *\n",
            "subsections": []
        },
        "In this example, the 'echo' and 'surround' modules are imported in the": {
            "content": "current namespace because they are defined in the 'sound.effects'\npackage when the 'from...import' statement is executed.  (This also\nworks when 'all' is defined.)\n",
            "subsections": []
        },
        "Although certain modules are designed to export only names that follow": {
            "content": "certain patterns when you use 'import *', it is still considered bad\npractice in production code.\n",
            "subsections": []
        },
        "Remember, there is nothing wrong with using 'from package import": {
            "content": "specificsubmodule'!  In fact, this is the recommended notation unless\nthe importing module needs to use submodules with the same name from\ndifferent packages.\n\nFile: python3.12.info,  Node: Intra-package References,  Next: Packages in Multiple Directories,  Prev: Importing * From a Package,  Up: Packages\n\n2.6.4.2 Intra-package References\n................................\n",
            "subsections": []
        },
        "When packages are structured into subpackages (as with the 'sound'": {
            "content": "package in the example), you can use absolute imports to refer to\nsubmodules of siblings packages.  For example, if the module\n'sound.filters.vocoder' needs to use the 'echo' module in the\n'sound.effects' package, it can use 'from sound.effects import echo'.\n",
            "subsections": []
        },
        "You can also write relative imports, with the 'from module import name'": {
            "content": "form of import statement.  These imports use leading dots to indicate\nthe current and parent packages involved in the relative import.  From\nthe 'surround' module for example, you might use:\n\nfrom . import echo\nfrom .. import formats\nfrom ..filters import equalizer\n\nNote that relative imports are based on the name of the current module.\nSince the name of the main module is always '\"main\"', modules\nintended for use as the main module of a Python application must always\nuse absolute imports.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Packages in Multiple Directories,  Prev: Intra-package References,  Up: Packages": {
            "content": "2.6.4.3 Packages in Multiple Directories\n........................................\n\nPackages support one more special attribute, *note path: 19f3.  This\nis initialized to be a list containing the name of the directory holding\nthe package's 'init.py' before the code in that file is executed.",
            "subsections": []
        },
        "This variable can be modified; doing so affects future searches for": {
            "content": "modules and subpackages contained in the package.\n",
            "subsections": []
        },
        "While this feature is not often needed, it can be used to extend the set": {
            "content": "of modules found in a package.\n\nFile: python3.12.info,  Node: Input and Output,  Next: Errors and Exceptions,  Prev: Modules<2>,  Up: The Python Tutorial\n",
            "subsections": [
                {
                    "name": "2.7 Input and Output",
                    "content": ""
                }
            ]
        },
        "There are several ways to present the output of a program; data can be": {
            "content": "printed in a human-readable form, or written to a file for future use.\nThis chapter will discuss some of the possibilities.\n\n* Menu:\n\n* Fancier Output Formatting::\n* Reading and Writing Files::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Fancier Output Formatting,  Next: Reading and Writing Files,  Up: Input and Output": {
            "content": "",
            "subsections": []
        },
        "So far we've encountered two ways of writing values: 'expression": {
            "content": "statements' and the *note print(): de5. function.  (A third way is using\nthe *note write(): 19f9. method of file objects; the standard output\nfile can be referenced as 'sys.stdout'.  See the Library Reference for\nmore information on this.)\n",
            "subsections": []
        },
        "Often you'll want more control over the formatting of your output than": {
            "content": "simply printing space-separated values.  There are several ways to\nformat output.\n\n* To use *note formatted string literals: 19fa, begin a string with\n'f' or 'F' before the opening quotation mark or triple quotation\nmark.  Inside this string, you can write a Python expression\nbetween '{' and '}' characters that can refer to variables or\nliteral values.\n\n>>> year = 2016\n>>> event = 'Referendum'\n>>> f'Results of the {year} {event}'\n'Results of the 2016 Referendum'\n\n* The *note str.format(): 3ed. method of strings requires more manual\neffort.  You'll still use '{' and '}' to mark where a variable will\nbe substituted and can provide detailed formatting directives, but\nyou'll also need to provide the information to be formatted.\n\n>>> yesvotes = 42572654\n>>> novotes = 43132495\n>>> percentage = yesvotes / (yesvotes + novotes)\n>>> '{:-9} YES votes  {:2.2%}'.format(yesvotes, percentage)\n' 42572654 YES votes  49.67%'\n\n* Finally, you can do all the string handling yourself by using\nstring slicing and concatenation operations to create any layout\nyou can imagine.  The string type has some methods that perform\nuseful operations for padding strings to a given column width.\n",
            "subsections": []
        },
        "When you don't need fancy output but just want a quick display of some": {
            "content": "variables for debugging purposes, you can convert any value to a string\nwith the *note repr(): 5f0. or *note str(): 157. functions.\n\nThe *note str(): 157. function is meant to return representations of\nvalues which are fairly human-readable, while *note repr(): 5f0. is\nmeant to generate representations which can be read by the interpreter\n(or will force a *note SyntaxError: 146. if there is no equivalent\nsyntax).  For objects which don't have a particular representation for\nhuman consumption, *note str(): 157. will return the same value as *note\nrepr(): 5f0.  Many values, such as numbers or structures like lists and\ndictionaries, have the same representation using either function.\nStrings, in particular, have two distinct representations.\n\nSome examples:\n\n>>> s = 'Hello, world.'\n>>> str(s)\n'Hello, world.'\n>>> repr(s)\n\"'Hello, world.'\"\n>>> str(1/7)\n'0.14285714285714285'\n>>> x = 10 * 3.25\n>>> y = 200 * 200\n>>> s = 'The value of x is ' + repr(x) + ', and y is ' + repr(y) + '...'\n>>> print(s)\nThe value of x is 32.5, and y is 40000...\n>>> # The repr() of a string adds string quotes and backslashes:\n... hello = 'hello, world\\n'\n>>> hellos = repr(hello)\n>>> print(hellos)\n'hello, world\\n'\n>>> # The argument to repr() may be any Python object:\n... repr((x, y, ('spam', 'eggs')))\n\"(32.5, 40000, ('spam', 'eggs'))\"\n\nThe *note string: cd. module contains a *note Template: 453. class that\noffers yet another way to substitute values into strings, using\nplaceholders like '$x' and replacing them with values from a dictionary,\nbut offers much less control of the formatting.\n\n* Menu:\n\n* Formatted String Literals::\n* The String format() Method: The String format Method.\n* Manual String Formatting::\n* Old string formatting::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Formatted String Literals,  Next: The String format Method,  Up: Fancier Output Formatting": {
            "content": "2.7.1.1 Formatted String Literals\n.................................\n\n*note Formatted string literals: 7cd. (also called f-strings for short)\nlet you include the value of Python expressions inside a string by\nprefixing the string with 'f' or 'F' and writing expressions as\n'{expression}'.\n",
            "subsections": []
        },
        "An optional format specifier can follow the expression.  This allows": {
            "content": "greater control over how the value is formatted.  The following example\nrounds pi to three places after the decimal:\n\n>>> import math\n>>> print(f'The value of pi is approximately {math.pi:.3f}.')\nThe value of pi is approximately 3.142.\n",
            "subsections": []
        },
        "Passing an integer after the '':'' will cause that field to be a minimum": {
            "content": "number of characters wide.  This is useful for making columns line up.\n\n>>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 7678}\n>>> for name, phone in table.items():\n...     print(f'{name:10} ==> {phone:10d}')\n...\nSjoerd     ==>       4127\nJack       ==>       4098\nDcab       ==>       7678\n\nOther modifiers can be used to convert the value before it is formatted.\n''!a'' applies *note ascii(): 123b, ''!s'' applies *note str(): 157, and\n''!r'' applies *note repr(): 5f0.:\n\n>>> animals = 'eels'\n>>> print(f'My hovercraft is full of {animals}.')\nMy hovercraft is full of eels.\n>>> print(f'My hovercraft is full of {animals!r}.')\nMy hovercraft is full of 'eels'.\n\nThe '=' specifier can be used to expand an expression to the text of the\nexpression, an equal sign, then the representation of the evaluated\nexpression:\n\n>>> bugs = 'roaches'\n>>> count = 13\n>>> area = 'living room'\n>>> print(f'Debugging {bugs=} {count=} {area=}')\nDebugging bugs='roaches' count=13 area='living room'\n\nSee *note self-documenting expressions: 7cb. for more information on the\n'=' specifier.  For a reference on these format specifications, see the\nreference guide for the *note Format Specification Mini-Language: 3a7.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The String format Method,  Next: Manual String Formatting,  Prev: Formatted String Literals,  Up: Fancier Output Formatting": {
            "content": "2.7.1.2 The String format() Method\n..................................\n\nBasic usage of the *note str.format(): 3ed. method looks like this:\n\n>>> print('We are the {} who say \"{}!\"'.format('knights', 'Ni'))\nWe are the knights who say \"Ni!\"\n",
            "subsections": []
        },
        "The brackets and characters within them (called format fields) are": {
            "content": "replaced with the objects passed into the *note str.format(): 3ed.\nmethod.  A number in the brackets can be used to refer to the position\nof the object passed into the *note str.format(): 3ed. method.\n\n>>> print('{0} and {1}'.format('spam', 'eggs'))\nspam and eggs\n>>> print('{1} and {0}'.format('spam', 'eggs'))\neggs and spam\n\nIf keyword arguments are used in the *note str.format(): 3ed. method,\ntheir values are referred to by using the name of the argument.\n\n>>> print('This {food} is {adjective}.'.format(\n...       food='spam', adjective='absolutely horrible'))\nThis spam is absolutely horrible.\n\nPositional and keyword arguments can be arbitrarily combined:\n\n>>> print('The story of {0}, {1}, and {other}.'.format('Bill', 'Manfred',\n...                                                    other='Georg'))\nThe story of Bill, Manfred, and Georg.\n",
            "subsections": []
        },
        "If you have a really long format string that you don't want to split up,": {
            "content": "it would be nice if you could reference the variables to be formatted by\nname instead of by position.  This can be done by simply passing the\ndict and using square brackets ''[]'' to access the keys.\n\n>>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678}\n>>> print('Jack: {0[Jack]:d}; Sjoerd: {0[Sjoerd]:d}; '\n...       'Dcab: {0[Dcab]:d}'.format(table))\nJack: 4098; Sjoerd: 4127; Dcab: 8637678\n",
            "subsections": []
        },
        "This could also be done by passing the 'table' dictionary as keyword": {
            "content": "arguments with the '' notation.\n\n>>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678}\n>>> print('Jack: {Jack:d}; Sjoerd: {Sjoerd:d}; Dcab: {Dcab:d}'.format(table))\nJack: 4098; Sjoerd: 4127; Dcab: 8637678\n",
            "subsections": []
        },
        "This is particularly useful in combination with the built-in function": {
            "content": "*note vars(): 17c1, which returns a dictionary containing all local\nvariables.\n",
            "subsections": []
        },
        "As an example, the following lines produce a tidily aligned set of": {
            "content": "columns giving integers and their squares and cubes:\n\n>>> for x in range(1, 11):\n...     print('{0:2d} {1:3d} {2:4d}'.format(x, x*x, x*x*x))\n...\n1   1    1\n2   4    8\n3   9   27\n4  16   64\n5  25  125\n6  36  216\n7  49  343\n8  64  512\n9  81  729\n10 100 1000\n\nFor a complete overview of string formatting with *note str.format():\n3ed, see *note Format String Syntax: 1205.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Manual String Formatting,  Next: Old string formatting,  Prev: The String format Method,  Up: Fancier Output Formatting": {
            "content": "2.7.1.3 Manual String Formatting\n................................\n\nHere's the same table of squares and cubes, formatted manually:\n\n>>> for x in range(1, 11):\n...     print(repr(x).rjust(2), repr(x*x).rjust(3), end=' ')\n...     # Note use of 'end' on previous line\n...     print(repr(x*x*x).rjust(4))\n...\n1   1    1\n2   4    8\n3   9   27\n4  16   64\n5  25  125\n6  36  216\n7  49  343\n8  64  512\n9  81  729\n10 100 1000\n\n(Note that the one space between each column was added by the way *note\nprint(): de5. works: it always adds spaces between its arguments.)\n\nThe *note str.rjust(): 19ff. method of string objects right-justifies a\nstring in a field of a given width by padding it with spaces on the\nleft.  There are similar methods *note str.ljust(): 1a00. and *note\nstr.center(): 1a01.  These methods do not write anything, they just\nreturn a new string.  If the input string is too long, they don't\ntruncate it, but return it unchanged; this will mess up your column\nlay-out but that's usually better than the alternative, which would be\nlying about a value.  (If you really want truncation you can always add\na slice operation, as in 'x.ljust(n)[:n]'.)\n\nThere is another method, *note str.zfill(): 1309, which pads a numeric\nstring on the left with zeros.  It understands about plus and minus\nsigns:\n\n>>> '12'.zfill(5)\n'00012'\n>>> '-3.14'.zfill(7)\n'-003.14'\n>>> '3.14159265359'.zfill(5)\n'3.14159265359'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Old string formatting,  Prev: Manual String Formatting,  Up: Fancier Output Formatting": {
            "content": "2.7.1.4 Old string formatting\n.............................\n\nThe % operator (modulo) can also be used for string formatting.  Given\n''string' % values', instances of '%' in 'string' are replaced with zero\nor more elements of 'values'.  This operation is commonly known as\nstring interpolation.  For example:\n\n>>> import math\n>>> print('The value of pi is approximately %5.3f.' % math.pi)\nThe value of pi is approximately 3.142.\n\nMore information can be found in the *note printf-style String\nFormatting: 49c. section.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Reading and Writing Files,  Prev: Fancier Output Formatting,  Up: Input and Output": {
            "content": "*note open(): 26e. returns a *note file object: 1037, and is most\ncommonly used with two positional arguments and one keyword argument:\n'open(filename, mode, encoding=None)'\n\n>>> f = open('workfile', 'w', encoding=\"utf-8\")\n",
            "subsections": []
        },
        "The first argument is a string containing the filename.  The second": {
            "content": "argument is another string containing a few characters describing the\nway in which the file will be used.  'mode' can be ''r'' when the file\nwill only be read, ''w'' for only writing (an existing file with the\nsame name will be erased), and ''a'' opens the file for appending; any\ndata written to the file is automatically added to the end.  ''r+''\nopens the file for both reading and writing.  The 'mode' argument is\noptional; ''r'' will be assumed if it's omitted.\n",
            "subsections": []
        },
        "Normally, files are opened in 'text mode', that means, you read and": {
            "content": "write strings from and to the file, which are encoded in a specific\n'encoding'.  If 'encoding' is not specified, the default is platform\ndependent (see *note open(): 26e.).  Because UTF-8 is the modern\nde-facto standard, 'encoding=\"utf-8\"' is recommended unless you know\nthat you need to use a different encoding.  Appending a ''b'' to the\nmode opens the file in 'binary mode'.  Binary mode data is read and\nwritten as *note bytes: 295. objects.  You can not specify 'encoding'\nwhen opening file in binary mode.\n",
            "subsections": []
        },
        "In text mode, the default when reading is to convert platform-specific": {
            "content": "line endings ('\\n' on Unix, '\\r\\n' on Windows) to just '\\n'.  When\nwriting in text mode, the default is to convert occurrences of '\\n' back\nto platform-specific line endings.  This behind-the-scenes modification\nto file data is fine for text files, but will corrupt binary data like\nthat in 'JPEG' or 'EXE' files.  Be very careful to use binary mode when\nreading and writing such files.\n\nIt is good practice to use the *note with: 396. keyword when dealing\nwith file objects.  The advantage is that the file is properly closed\nafter its suite finishes, even if an exception is raised at some point.\nUsing 'with' is also much shorter than writing equivalent *note try:\n4bc.-*note finally: 7ee. blocks:\n\n>>> with open('workfile', encoding=\"utf-8\") as f:\n...     readdata = f.read()\n\n>>> # We can check that the file has been automatically closed.\n>>> f.closed\nTrue\n\nIf you're not using the *note with: 396. keyword, then you should call\n'f.close()' to close the file and immediately free up any system\nresources used by it.\n\nWarning: Calling 'f.write()' without using the 'with' keyword or\ncalling 'f.close()' 'might' result in the arguments of 'f.write()'\nnot being completely written to the disk, even if the program exits\nsuccessfully.\n\nAfter a file object is closed, either by a *note with: 396. statement or\nby calling 'f.close()', attempts to use the file object will\nautomatically fail.\n\n>>> f.close()\n>>> f.read()\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nValueError: I/O operation on closed file.\n\n* Menu:\n\n* Methods of File Objects::\n* Saving structured data with json::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Methods of File Objects,  Next: Saving structured data with json,  Up: Reading and Writing Files": {
            "content": "2.7.2.1 Methods of File Objects\n...............................\n",
            "subsections": []
        },
        "The rest of the examples in this section will assume that a file object": {
            "content": "called 'f' has already been created.\n",
            "subsections": []
        },
        "To read a file's contents, call 'f.read(size)', which reads some": {
            "content": "quantity of data and returns it as a string (in text mode) or bytes\nobject (in binary mode).  'size' is an optional numeric argument.  When\n'size' is omitted or negative, the entire contents of the file will be\nread and returned; it's your problem if the file is twice as large as\nyour machine's memory.  Otherwise, at most 'size' characters (in text\nmode) or 'size' bytes (in binary mode) are read and returned.  If the\nend of the file has been reached, 'f.read()' will return an empty string\n('''').\n\n>>> f.read()\n'This is the entire file.\\n'\n>>> f.read()\n''\n\n'f.readline()' reads a single line from the file; a newline character\n('\\n') is left at the end of the string, and is only omitted on the last\nline of the file if the file doesn't end in a newline.  This makes the\nreturn value unambiguous; if 'f.readline()' returns an empty string, the\nend of the file has been reached, while a blank line is represented by\n''\\n'', a string containing only a single newline.\n\n>>> f.readline()\n'This is the first line of the file.\\n'\n>>> f.readline()\n'Second line of the file\\n'\n>>> f.readline()\n''\n",
            "subsections": []
        },
        "For reading lines from a file, you can loop over the file object.  This": {
            "content": "is memory efficient, fast, and leads to simple code:\n\n>>> for line in f:\n...     print(line, end='')\n...\nThis is the first line of the file.\nSecond line of the file\n",
            "subsections": []
        },
        "If you want to read all the lines of a file in a list you can also use": {
            "content": "'list(f)' or 'f.readlines()'.\n\n'f.write(string)' writes the contents of 'string' to the file, returning\nthe number of characters written.\n\n>>> f.write('This is a test\\n')\n15\n",
            "subsections": []
        },
        "Other types of objects need to be converted - either to a string (in": {
            "content": "text mode) or a bytes object (in binary mode) - before writing them:\n\n>>> value = ('the answer', 42)\n>>> s = str(value)  # convert the tuple to string\n>>> f.write(s)\n18\n\n'f.tell()' returns an integer giving the file object's current position\nin the file represented as number of bytes from the beginning of the\nfile when in binary mode and an opaque number when in text mode.\n",
            "subsections": []
        },
        "To change the file object's position, use 'f.seek(offset, whence)'.  The": {
            "content": "position is computed from adding 'offset' to a reference point; the\nreference point is selected by the 'whence' argument.  A 'whence' value\nof 0 measures from the beginning of the file, 1 uses the current file\nposition, and 2 uses the end of the file as the reference point.\n'whence' can be omitted and defaults to 0, using the beginning of the\nfile as the reference point.\n\n>>> f = open('workfile', 'rb+')\n>>> f.write(b'0123456789abcdef')\n16\n>>> f.seek(5)      # Go to the 6th byte in the file\n5\n>>> f.read(1)\nb'5'\n>>> f.seek(-3, 2)  # Go to the 3rd byte before the end\n13\n>>> f.read(1)\nb'd'\n",
            "subsections": []
        },
        "In text files (those opened without a 'b' in the mode string), only": {
            "content": "seeks relative to the beginning of the file are allowed (the exception\nbeing seeking to the very file end with 'seek(0, 2)') and the only valid\n'offset' values are those returned from the 'f.tell()', or zero.  Any\nother 'offset' value produces undefined behaviour.\n\nFile objects have some additional methods, such as *note isatty(): 1a07.\nand *note truncate(): 1187. which are less frequently used; consult the\nLibrary Reference for a complete guide to file objects.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Saving structured data with json,  Prev: Methods of File Objects,  Up: Reading and Writing Files": {
            "content": "2.7.2.2 Saving structured data with 'json'\n..........................................\n",
            "subsections": []
        },
        "Strings can easily be written to and read from a file.  Numbers take a": {
            "content": "bit more effort, since the *note read(): 1a0a. method only returns\nstrings, which will have to be passed to a function like *note int():\n17e, which takes a string like ''123'' and returns its numeric value\n123.  When you want to save more complex data types like nested lists\nand dictionaries, parsing and serializing by hand becomes complicated.\n",
            "subsections": []
        },
        "Rather than having users constantly writing and debugging code to save": {
            "content": "complicated data types to files, Python allows you to use the popular\ndata interchange format called JSON (JavaScript Object Notation)(1).\nThe standard module called *note json: 7c. can take Python data\nhierarchies, and convert them to string representations; this process is\ncalled 'serializing'.  Reconstructing the data from the string\nrepresentation is called 'deserializing'.  Between serializing and\ndeserializing, the string representing the object may have been stored\nin a file or data, or sent over a network connection to some distant\nmachine.\n\nNote: The JSON format is commonly used by modern applications to\nallow for data exchange.  Many programmers are already familiar\nwith it, which makes it a good choice for interoperability.\n",
            "subsections": []
        },
        "If you have an object 'x', you can view its JSON string representation": {
            "content": "with a simple line of code:\n\n>>> import json\n>>> x = [1, 'simple', 'list']\n>>> json.dumps(x)\n'[1, \"simple\", \"list\"]'\n\nAnother variant of the *note dumps(): b9d. function, called *note\ndump(): b9c, simply serializes the object to a *note text file: 1a0b.\nSo if 'f' is a *note text file: 1a0b. object opened for writing, we can\ndo this:\n\njson.dump(x, f)\n\nTo decode the object again, if 'f' is a *note binary file: 1a0c. or\n*note text file: 1a0b. object which has been opened for reading:\n\nx = json.load(f)\n\nNote: JSON files must be encoded in UTF-8.  Use 'encoding=\"utf-8\"'\nwhen opening JSON file as a *note text file: 1a0b. for both of\nreading and writing.\n",
            "subsections": []
        },
        "This simple serialization technique can handle lists and dictionaries,": {
            "content": "but serializing arbitrary class instances in JSON requires a bit of\nextra effort.  The reference for the *note json: 7c. module contains an\nexplanation of this.\n\nSee also\n........\n\n*note pickle: a1. - the pickle module\n\nContrary to *note JSON: 1a09, 'pickle' is a protocol which allows the\nserialization of arbitrarily complex Python objects.  As such, it is\nspecific to Python and cannot be used to communicate with applications\nwritten in other languages.  It is also insecure by default:\ndeserializing pickle data coming from an untrusted source can execute\narbitrary code, if the data was crafted by a skilled attacker.\n\n---------- Footnotes ----------\n\n(1) https://json.org\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Errors and Exceptions,  Next: Classes,  Prev: Input and Output,  Up: The Python Tutorial": {
            "content": "",
            "subsections": [
                {
                    "name": "2.8 Errors and Exceptions",
                    "content": ""
                }
            ]
        },
        "Until now error messages haven't been more than mentioned, but if you": {
            "content": "have tried out the examples you have probably seen some.  There are (at\nleast) two distinguishable kinds of errors: 'syntax errors' and\n'exceptions'.\n\n* Menu:\n\n* Syntax Errors::\n* Exceptions::\n* Handling Exceptions::\n* Raising Exceptions::\n* Exception Chaining::\n* User-defined Exceptions::\n* Defining Clean-up Actions::\n* Predefined Clean-up Actions::\n* Raising and Handling Multiple Unrelated Exceptions::\n* Enriching Exceptions with Notes::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Syntax Errors,  Next: Exceptions,  Up: Errors and Exceptions": {
            "content": "",
            "subsections": []
        },
        "Syntax errors, also known as parsing errors, are perhaps the most common": {
            "content": "kind of complaint you get while you are still learning Python:\n\n>>> while True print('Hello world')\nFile \"<stdin>\", line 1\nwhile True print('Hello world')\n^^^^^\nSyntaxError: invalid syntax\n",
            "subsections": []
        },
        "The parser repeats the offending line and displays little 'arrow's": {
            "content": "pointing at the token in the line where the error was detected.  The\nerror may be caused by the absence of a token 'before' the indicated\ntoken.  In the example, the error is detected at the function *note\nprint(): de5, since a colon ('':'') is missing before it.  File name and\nline number are printed so you know where to look in case the input came\nfrom a script.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Exceptions,  Next: Handling Exceptions,  Prev: Syntax Errors,  Up: Errors and Exceptions": {
            "content": "",
            "subsections": []
        },
        "Even if a statement or expression is syntactically correct, it may cause": {
            "content": "an error when an attempt is made to execute it.  Errors detected during\nexecution are called 'exceptions' and are not unconditionally fatal: you\nwill soon learn how to handle them in Python programs.  Most exceptions\nare not handled by programs, however, and result in error messages as\nshown here:\n\n>>> 10 * (1/0)\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nZeroDivisionError: division by zero\n>>> 4 + spam*3\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nNameError: name 'spam' is not defined\n>>> '2' + 2\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nTypeError: can only concatenate str (not \"int\") to str\n",
            "subsections": []
        },
        "The last line of the error message indicates what happened.  Exceptions": {
            "content": "come in different types, and the type is printed as part of the message:\nthe types in the example are *note ZeroDivisionError: 763, *note\nNameError: 144. and *note TypeError: 28e.  The string printed as the\nexception type is the name of the built-in exception that occurred.",
            "subsections": []
        },
        "This is true for all built-in exceptions, but need not be true for": {
            "content": "user-defined exceptions (although it is a useful convention).  Standard\nexception names are built-in identifiers (not reserved keywords).\n",
            "subsections": []
        },
        "The rest of the line provides detail based on the type of exception and": {
            "content": "what caused it.\n",
            "subsections": []
        },
        "The preceding part of the error message shows the context where the": {
            "content": "exception occurred, in the form of a stack traceback.  In general it\ncontains a stack traceback listing source lines; however, it will not\ndisplay lines read from standard input.\n\n*note Built-in Exceptions: 15e6. lists the built-in exceptions and their\nmeanings.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Handling Exceptions,  Next: Raising Exceptions,  Prev: Exceptions,  Up: Errors and Exceptions": {
            "content": "",
            "subsections": []
        },
        "It is possible to write programs that handle selected exceptions.  Look": {
            "content": "at the following example, which asks the user for input until a valid\ninteger has been entered, but allows the user to interrupt the program\n(using 'Control-C' or whatever the operating system supports); note that\na user-generated interruption is signalled by raising the *note\nKeyboardInterrupt: 7f5. exception.\n\n>>> while True:\n...     try:\n...         x = int(input(\"Please enter a number: \"))\n...         break\n...     except ValueError:\n...         print(\"Oops!  That was no valid number.  Try again...\")\n...\n\nThe *note try: 4bc. statement works as follows.\n\n* First, the 'try clause' (the statement(s) between the *note try:\n4bc. and *note except: 379. keywords) is executed.\n\n* If no exception occurs, the 'except clause' is skipped and\nexecution of the *note try: 4bc. statement is finished.\n\n* If an exception occurs during execution of the *note try: 4bc.\nclause, the rest of the clause is skipped.  Then, if its type\nmatches the exception named after the *note except: 379. keyword,\nthe 'except clause' is executed, and then execution continues after\nthe try/except block.\n\n* If an exception occurs which does not match the exception named in\nthe 'except clause', it is passed on to outer *note try: 4bc.\nstatements; if no handler is found, it is an 'unhandled exception'\nand execution stops with an error message.\n\nA *note try: 4bc. statement may have more than one 'except clause', to\nspecify handlers for different exceptions.  At most one handler will be\nexecuted.  Handlers only handle exceptions that occur in the\ncorresponding 'try clause', not in other handlers of the same 'try'\nstatement.  An 'except clause' may name multiple exceptions as a\nparenthesized tuple, for example:\n\n... except (RuntimeError, TypeError, NameError):\n...     pass\n\nA class in an *note except: 379. clause is compatible with an exception\nif it is the same class or a base class thereof (but not the other way\naround -- an 'except clause' listing a derived class is not compatible\nwith a base class).  For example, the following code will print B, C, D\nin that order:\n\nclass B(Exception):\npass\n\nclass C(B):\npass\n\nclass D(C):\npass\n\nfor cls in [B, C, D]:\ntry:\nraise cls()\nexcept D:\nprint(\"D\")\nexcept C:\nprint(\"C\")\nexcept B:\nprint(\"B\")\n",
            "subsections": []
        },
        "Note that if the 'except clauses' were reversed (with 'except B' first),": {
            "content": "it would have printed B, B, B -- the first matching 'except clause' is\ntriggered.\n",
            "subsections": []
        },
        "When an exception occurs, it may have associated values, also known as": {
            "content": "the exception's 'arguments'.  The presence and types of the arguments\ndepend on the exception type.\n\nThe 'except clause' may specify a variable after the exception name.",
            "subsections": []
        },
        "The variable is bound to the exception instance which typically has an": {
            "content": "'args' attribute that stores the arguments.  For convenience, builtin\nexception types define *note str(): 3e9. to print all the arguments\nwithout explicitly accessing '.args'.\n\n>>> try:\n...     raise Exception('spam', 'eggs')\n... except Exception as inst:\n...     print(type(inst))    # the exception type\n...     print(inst.args)     # arguments stored in .args\n...     print(inst)          # str allows args to be printed directly,\n...                          # but may be overridden in exception subclasses\n...     x, y = inst.args     # unpack args\n...     print('x =', x)\n...     print('y =', y)\n...\n<class 'Exception'>\n('spam', 'eggs')\n('spam', 'eggs')\nx = spam\ny = eggs\n\nThe exception's *note str(): 3e9. output is printed as the last part\n('detail') of the message for unhandled exceptions.\n\n*note BaseException: 37c. is the common base class of all exceptions.\nOne of its subclasses, *note Exception: 7ff, is the base class of all\nthe non-fatal exceptions.  Exceptions which are not subclasses of *note",
            "subsections": []
        },
        "Exception: 7ff. are not typically handled, because they are used to": {
            "content": "indicate that the program should terminate.  They include *note\nSystemExit: b97. which is raised by *note sys.exit(): 11c2. and *note",
            "subsections": []
        },
        "KeyboardInterrupt: 7f5. which is raised when a user wishes to interrupt": {
            "content": "the program.\n\n*note Exception: 7ff. can be used as a wildcard that catches (almost)\neverything.  However, it is good practice to be as specific as possible\nwith the types of exceptions that we intend to handle, and to allow any\nunexpected exceptions to propagate on.\n\nThe most common pattern for handling *note Exception: 7ff. is to print\nor log the exception and then re-raise it (allowing a caller to handle\nthe exception as well):\n\nimport sys\n\ntry:\nf = open('myfile.txt')\ns = f.readline()\ni = int(s.strip())\nexcept OSError as err:\nprint(\"OS error:\", err)\nexcept ValueError:\nprint(\"Could not convert data to an integer.\")\nexcept Exception as err:\nprint(f\"Unexpected {err=}, {type(err)=}\")\nraise\n\nThe *note try: 4bc. ... *note except: 379. statement has an optional 'else\nclause', which, when present, must follow all 'except clauses'.  It is\nuseful for code that must be executed if the 'try clause' does not raise\nan exception.  For example:\n\nfor arg in sys.argv[1:]:\ntry:\nf = open(arg, 'r')\nexcept OSError:\nprint('cannot open', arg)\nelse:\nprint(arg, 'has', len(f.readlines()), 'lines')\nf.close()\n",
            "subsections": []
        },
        "The use of the 'else' clause is better than adding additional code to": {
            "content": "the *note try: 4bc. clause because it avoids accidentally catching an\nexception that wasn't raised by the code being protected by the 'try' ...\n'except' statement.\n",
            "subsections": []
        },
        "Exception handlers do not handle only exceptions that occur immediately": {
            "content": "in the 'try clause', but also those that occur inside functions that are\ncalled (even indirectly) in the 'try clause'.  For example:\n\n>>> def thisfails():\n...     x = 1/0\n...\n>>> try:\n...     thisfails()\n... except ZeroDivisionError as err:\n...     print('Handling run-time error:', err)\n...\nHandling run-time error: division by zero\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Raising Exceptions,  Next: Exception Chaining,  Prev: Handling Exceptions,  Up: Errors and Exceptions": {
            "content": "The *note raise: 3b3. statement allows the programmer to force a\nspecified exception to occur.  For example:\n\n>>> raise NameError('HiThere')\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nNameError: HiThere\n\nThe sole argument to *note raise: 3b3. indicates the exception to be\nraised.  This must be either an exception instance or an exception class\n(a class that derives from *note BaseException: 37c, such as *note",
            "subsections": []
        },
        "Exception: 7ff. or one of its subclasses).  If an exception class is": {
            "content": "passed, it will be implicitly instantiated by calling its constructor\nwith no arguments:\n\nraise ValueError  # shorthand for 'raise ValueError()'\n",
            "subsections": []
        },
        "If you need to determine whether an exception was raised but don't": {
            "content": "intend to handle it, a simpler form of the *note raise: 3b3. statement\nallows you to re-raise the exception:\n\n>>> try:\n...     raise NameError('HiThere')\n... except NameError:\n...     print('An exception flew by!')\n...     raise\n...\nAn exception flew by!\nTraceback (most recent call last):\nFile \"<stdin>\", line 2, in <module>\nNameError: HiThere\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Exception Chaining,  Next: User-defined Exceptions,  Prev: Raising Exceptions,  Up: Errors and Exceptions": {
            "content": "If an unhandled exception occurs inside an *note except: 379. section,\nit will have the exception being handled attached to it and included in\nthe error message:\n\n>>> try:\n...     open(\"database.sqlite\")\n... except OSError:\n...     raise RuntimeError(\"unable to handle error\")\n...\nTraceback (most recent call last):\nFile \"<stdin>\", line 2, in <module>\nFileNotFoundError: [Errno 2] No such file or directory: 'database.sqlite'\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\nFile \"<stdin>\", line 4, in <module>\nRuntimeError: unable to handle error\n",
            "subsections": []
        },
        "To indicate that an exception is a direct consequence of another, the": {
            "content": "*note raise: 3b3. statement allows an optional *note from: 3b3. clause:\n\n# exc must be exception instance or None.\nraise RuntimeError from exc\n\nThis can be useful when you are transforming exceptions.  For example:\n\n>>> def func():\n...     raise ConnectionError\n...\n>>> try:\n...     func()\n... except ConnectionError as exc:\n...     raise RuntimeError('Failed to open database') from exc\n...\nTraceback (most recent call last):\nFile \"<stdin>\", line 2, in <module>\nFile \"<stdin>\", line 2, in func\nConnectionError\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\nFile \"<stdin>\", line 4, in <module>\nRuntimeError: Failed to open database\n",
            "subsections": []
        },
        "It also allows disabling automatic exception chaining using the 'from": {
            "content": "None' idiom:\n\n>>> try:\n...     open('database.sqlite')\n... except OSError:\n...     raise RuntimeError from None\n...\nTraceback (most recent call last):\nFile \"<stdin>\", line 4, in <module>\nRuntimeError\n\nFor more information about chaining mechanics, see *note Built-in\nExceptions: 15e6.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: User-defined Exceptions,  Next: Defining Clean-up Actions,  Prev: Exception Chaining,  Up: Errors and Exceptions": {
            "content": "",
            "subsections": []
        },
        "Programs may name their own exceptions by creating a new exception class": {
            "content": "(see *note Classes: 19a4. for more about Python classes).  Exceptions\nshould typically be derived from the *note Exception: 7ff. class, either\ndirectly or indirectly.\n",
            "subsections": []
        },
        "Exception classes can be defined which do anything any other class can": {
            "content": "do, but are usually kept simple, often only offering a number of\nattributes that allow information about the error to be extracted by\nhandlers for the exception.\n\nMost exceptions are defined with names that end in \"Error\", similar to\nthe naming of the standard exceptions.\n",
            "subsections": []
        },
        "Many standard modules define their own exceptions to report errors that": {
            "content": "may occur in functions they define.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Defining Clean-up Actions,  Next: Predefined Clean-up Actions,  Prev: User-defined Exceptions,  Up: Errors and Exceptions": {
            "content": "The *note try: 4bc. statement has another optional clause which is\nintended to define clean-up actions that must be executed under all\ncircumstances.  For example:\n\n>>> try:\n...     raise KeyboardInterrupt\n... finally:\n...     print('Goodbye, world!')\n...\nGoodbye, world!\nTraceback (most recent call last):\nFile \"<stdin>\", line 2, in <module>\nKeyboardInterrupt\n\nIf a *note finally: 7ee. clause is present, the 'finally' clause will\nexecute as the last task before the *note try: 4bc. statement completes.",
            "subsections": []
        },
        "The 'finally' clause runs whether or not the 'try' statement produces an": {
            "content": "exception.  The following points discuss more complex cases when an\nexception occurs:\n\n* If an exception occurs during execution of the 'try' clause, the\nexception may be handled by an *note except: 379. clause.  If the\nexception is not handled by an 'except' clause, the exception is\nre-raised after the 'finally' clause has been executed.\n\n* An exception could occur during execution of an 'except' or 'else'\nclause.  Again, the exception is re-raised after the 'finally'\nclause has been executed.\n\n* If the 'finally' clause executes a *note break: 8de, *note\ncontinue: 7ed. or *note return: 7f2. statement, exceptions are not\nre-raised.\n\n* If the 'try' statement reaches a *note break: 8de, *note continue:\n7ed. or *note return: 7f2. statement, the 'finally' clause will\nexecute just prior to the 'break', 'continue' or 'return'\nstatement's execution.\n\n* If a 'finally' clause includes a 'return' statement, the returned\nvalue will be the one from the 'finally' clause's 'return'\nstatement, not the value from the 'try' clause's 'return'\nstatement.\n\nFor example:\n\n>>> def boolreturn():\n...     try:\n...         return True\n...     finally:\n...         return False\n...\n>>> boolreturn()\nFalse\n\nA more complicated example:\n\n>>> def divide(x, y):\n...     try:\n...         result = x / y\n...     except ZeroDivisionError:\n...         print(\"division by zero!\")\n...     else:\n...         print(\"result is\", result)\n...     finally:\n...         print(\"executing finally clause\")\n...\n>>> divide(2, 1)\nresult is 2.0\nexecuting finally clause\n>>> divide(2, 0)\ndivision by zero!\nexecuting finally clause\n>>> divide(\"2\", \"1\")\nexecuting finally clause\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nFile \"<stdin>\", line 3, in divide\nTypeError: unsupported operand type(s) for /: 'str' and 'str'\n\nAs you can see, the *note finally: 7ee. clause is executed in any event.\nThe *note TypeError: 28e. raised by dividing two strings is not handled\nby the *note except: 379. clause and therefore re-raised after the\n'finally' clause has been executed.\n\nIn real world applications, the *note finally: 7ee. clause is useful for\nreleasing external resources (such as files or network connections),\nregardless of whether the use of the resource was successful.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Predefined Clean-up Actions,  Next: Raising and Handling Multiple Unrelated Exceptions,  Prev: Defining Clean-up Actions,  Up: Errors and Exceptions": {
            "content": "",
            "subsections": []
        },
        "Some objects define standard clean-up actions to be undertaken when the": {
            "content": "object is no longer needed, regardless of whether or not the operation\nusing the object succeeded or failed.  Look at the following example,\nwhich tries to open a file and print its contents to the screen.\n\nfor line in open(\"myfile.txt\"):\nprint(line, end=\"\")\n",
            "subsections": []
        },
        "The problem with this code is that it leaves the file open for an": {
            "content": "indeterminate amount of time after this part of the code has finished\nexecuting.  This is not an issue in simple scripts, but can be a problem\nfor larger applications.  The *note with: 396. statement allows objects\nlike files to be used in a way that ensures they are always cleaned up\npromptly and correctly.\n\nwith open(\"myfile.txt\") as f:\nfor line in f:\nprint(line, end=\"\")\n",
            "subsections": []
        },
        "After the statement is executed, the file 'f' is always closed, even if": {
            "content": "a problem was encountered while processing the lines.  Objects which,\nlike files, provide predefined clean-up actions will indicate this in\ntheir documentation.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Raising and Handling Multiple Unrelated Exceptions,  Next: Enriching Exceptions with Notes,  Prev: Predefined Clean-up Actions,  Up: Errors and Exceptions": {
            "content": "",
            "subsections": []
        },
        "There are situations where it is necessary to report several exceptions": {
            "content": "that have occurred.  This is often the case in concurrency frameworks,\nwhen several tasks may have failed in parallel, but there are also other\nuse cases where it is desirable to continue execution and collect\nmultiple errors rather than raise the first exception.\n\nThe builtin *note ExceptionGroup: 17b. wraps a list of exception\ninstances so that they can be raised together.  It is an exception\nitself, so it can be caught like any other exception.\n\n>>> def f():\n...     excs = [OSError('error 1'), SystemError('error 2')]\n...     raise ExceptionGroup('there were problems', excs)\n...\n>>> f()\n+ Exception Group Traceback (most recent call last):\n|   File \"<stdin>\", line 1, in <module>\n|   File \"<stdin>\", line 3, in f\n| ExceptionGroup: there were problems\n+-+---------------- 1 ----------------\n| OSError: error 1\n+---------------- 2 ----------------\n| SystemError: error 2\n+------------------------------------\n>>> try:\n...     f()\n... except Exception as e:\n...     print(f'caught {type(e)}: e')\n...\ncaught <class 'ExceptionGroup'>: e\n>>>\n\nBy using 'except*' instead of 'except', we can selectively handle only\nthe exceptions in the group that match a certain type.  In the following\nexample, which shows a nested exception group, each 'except*' clause\nextracts from the group exceptions of a certain type while letting all\nother exceptions propagate to other clauses and eventually to be\nreraised.\n\n>>> def f():\n...     raise ExceptionGroup(\n...         \"group1\",\n...         [\n...             OSError(1),\n...             SystemError(2),\n...             ExceptionGroup(\n...                 \"group2\",\n...                 [\n...                     OSError(3),\n...                     RecursionError(4)\n...                 ]\n...             )\n...         ]\n...     )\n...\n>>> try:\n...     f()\n... except* OSError as e:\n...     print(\"There were OSErrors\")\n... except* SystemError as e:\n...     print(\"There were SystemErrors\")\n...\nThere were OSErrors\nThere were SystemErrors\n+ Exception Group Traceback (most recent call last):\n|   File \"<stdin>\", line 2, in <module>\n|   File \"<stdin>\", line 2, in f\n| ExceptionGroup: group1\n+-+---------------- 1 ----------------\n| ExceptionGroup: group2\n+-+---------------- 1 ----------------\n| RecursionError: 4\n+------------------------------------\n>>>\n",
            "subsections": []
        },
        "Note that the exceptions nested in an exception group must be instances,": {
            "content": "not types.  This is because in practice the exceptions would typically\nbe ones that have already been raised and caught by the program, along\nthe following pattern:\n\n>>> excs = []\n... for test in tests:\n...     try:\n...         test.run()\n...     except Exception as e:\n...         excs.append(e)\n...\n>>> if excs:\n...    raise ExceptionGroup(\"Test Failures\", excs)\n...\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Enriching Exceptions with Notes,  Prev: Raising and Handling Multiple Unrelated Exceptions,  Up: Errors and Exceptions": {
            "content": "",
            "subsections": []
        },
        "When an exception is created in order to be raised, it is usually": {
            "content": "initialized with information that describes the error that has occurred.",
            "subsections": []
        },
        "There are cases where it is useful to add information after the": {
            "content": "exception was caught.  For this purpose, exceptions have a method\n'addnote(note)' that accepts a string and adds it to the exception's\nnotes list.  The standard traceback rendering includes all notes, in the\norder they were added, after the exception.\n\n>>> try:\n...     raise TypeError('bad type')\n... except Exception as e:\n...     e.addnote('Add some information')\n...     e.addnote('Add some more information')\n...     raise\n...\nTraceback (most recent call last):\nFile \"<stdin>\", line 2, in <module>\nTypeError: bad type\nAdd some information\nAdd some more information\n>>>\n",
            "subsections": []
        },
        "For example, when collecting exceptions into an exception group, we may": {
            "content": "want to add context information for the individual errors.  In the\nfollowing each exception in the group has a note indicating when this\nerror has occurred.\n\n>>> def f():\n...     raise OSError('operation failed')\n...\n>>> excs = []\n>>> for i in range(3):\n...     try:\n...         f()\n...     except Exception as e:\n...         e.addnote(f'Happened in Iteration {i+1}')\n...         excs.append(e)\n...\n>>> raise ExceptionGroup('We have some problems', excs)\n+ Exception Group Traceback (most recent call last):\n|   File \"<stdin>\", line 1, in <module>\n| ExceptionGroup: We have some problems (3 sub-exceptions)\n+-+---------------- 1 ----------------\n| Traceback (most recent call last):\n|   File \"<stdin>\", line 3, in <module>\n|   File \"<stdin>\", line 2, in f\n| OSError: operation failed\n| Happened in Iteration 1\n+---------------- 2 ----------------\n| Traceback (most recent call last):\n|   File \"<stdin>\", line 3, in <module>\n|   File \"<stdin>\", line 2, in f\n| OSError: operation failed\n| Happened in Iteration 2\n+---------------- 3 ----------------\n| Traceback (most recent call last):\n|   File \"<stdin>\", line 3, in <module>\n|   File \"<stdin>\", line 2, in f\n| OSError: operation failed\n| Happened in Iteration 3\n+------------------------------------\n>>>\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Classes,  Next: Brief Tour of the Standard Library,  Prev: Errors and Exceptions,  Up: The Python Tutorial": {
            "content": "",
            "subsections": [
                {
                    "name": "2.9 Classes",
                    "content": "Classes provide a means of bundling data and functionality together."
                }
            ]
        },
        "Creating a new class creates a new 'type' of object, allowing new": {
            "content": "'instances' of that type to be made.  Each class instance can have\nattributes attached to it for maintaining its state.  Class instances\ncan also have methods (defined by its class) for modifying its state.\n",
            "subsections": []
        },
        "Compared with other programming languages, Python's class mechanism adds": {
            "content": "classes with a minimum of new syntax and semantics.  It is a mixture of\nthe class mechanisms found in C++ and Modula-3.  Python classes provide\nall the standard features of Object Oriented Programming: the class\ninheritance mechanism allows multiple base classes, a derived class can\noverride any methods of its base class or classes, and a method can call\nthe method of a base class with the same name.  Objects can contain\narbitrary amounts and kinds of data.  As is true for modules, classes\npartake of the dynamic nature of Python: they are created at runtime,\nand can be modified further after creation.\n\nIn C++ terminology, normally class members (including the data members)\nare 'public' (except see below *note Private Variables: 1a25.), and all\nmember functions are 'virtual'.  As in Modula-3, there are no shorthands\nfor referencing the object's members from its methods: the method\nfunction is declared with an explicit first argument representing the\nobject, which is provided implicitly by the call.  As in Smalltalk,\nclasses themselves are objects.  This provides semantics for importing\nand renaming.  Unlike C++ and Modula-3, built-in types can be used as\nbase classes for extension by the user.  Also, like in C++, most\nbuilt-in operators with special syntax (arithmetic operators,\nsubscripting etc.)  can be redefined for class instances.\n\n(Lacking universally accepted terminology to talk about classes, I will\nmake occasional use of Smalltalk and C++ terms.  I would use Modula-3\nterms, since its object-oriented semantics are closer to those of Python\nthan C++, but I expect that few readers have heard of it.)\n\n* Menu:\n\n* A Word About Names and Objects::\n* Python Scopes and Namespaces::\n* A First Look at Classes::\n* Random Remarks::\n* Inheritance::\n* Private Variables::\n* Odds and Ends::\n* Iterators::\n* Generators::\n* Generator Expressions::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: A Word About Names and Objects,  Next: Python Scopes and Namespaces,  Up: Classes": {
            "content": "",
            "subsections": []
        },
        "Objects have individuality, and multiple names (in multiple scopes) can": {
            "content": "be bound to the same object.  This is known as aliasing in other\nlanguages.  This is usually not appreciated on a first glance at Python,\nand can be safely ignored when dealing with immutable basic types\n(numbers, strings, tuples).  However, aliasing has a possibly surprising\neffect on the semantics of Python code involving mutable objects such as\nlists, dictionaries, and most other types.  This is usually used to the\nbenefit of the program, since aliases behave like pointers in some\nrespects.  For example, passing an object is cheap since only a pointer\nis passed by the implementation; and if a function modifies an object\npassed as an argument, the caller will see the change -- this eliminates\nthe need for two different argument passing mechanisms as in Pascal.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python Scopes and Namespaces,  Next: A First Look at Classes,  Prev: A Word About Names and Objects,  Up: Classes": {
            "content": "",
            "subsections": []
        },
        "Before introducing classes, I first have to tell you something about": {
            "content": "",
            "subsections": []
        },
        "Python's scope rules.  Class definitions play some neat tricks with": {
            "content": "namespaces, and you need to know how scopes and namespaces work to fully\nunderstand what's going on.  Incidentally, knowledge about this subject\nis useful for any advanced Python programmer.\n\nLet's begin with some definitions.\n\nA 'namespace' is a mapping from names to objects.  Most namespaces are\ncurrently implemented as Python dictionaries, but that's normally not\nnoticeable in any way (except for performance), and it may change in the\nfuture.  Examples of namespaces are: the set of built-in names\n(containing functions such as *note abs(): 1a29, and built-in exception\nnames); the global names in a module; and the local names in a function\ninvocation.  In a sense the set of attributes of an object also form a\nnamespace.  The important thing to know about namespaces is that there\nis absolutely no relation between names in different namespaces; for\ninstance, two different modules may both define a function 'maximize'\nwithout confusion -- users of the modules must prefix it with the module\nname.\n",
            "subsections": []
        },
        "By the way, I use the word 'attribute' for any name following a dot --": {
            "content": "for example, in the expression 'z.real', 'real' is an attribute of the\nobject 'z'.  Strictly speaking, references to names in modules are\nattribute references: in the expression 'modname.funcname', 'modname' is\na module object and 'funcname' is an attribute of it.  In this case\nthere happens to be a straightforward mapping between the module's\nattributes and the global names defined in the module: they share the\nsame namespace!  (1)\n",
            "subsections": []
        },
        "Attributes may be read-only or writable.  In the latter case, assignment": {
            "content": "to attributes is possible.  Module attributes are writable: you can\nwrite 'modname.theanswer = 42'.  Writable attributes may also be\ndeleted with the *note del: 14fb. statement.  For example, 'del\nmodname.theanswer' will remove the attribute 'theanswer' from the\nobject named by 'modname'.\n",
            "subsections": []
        },
        "Namespaces are created at different moments and have different": {
            "content": "lifetimes.  The namespace containing the built-in names is created when\nthe Python interpreter starts up, and is never deleted.  The global\nnamespace for a module is created when the module definition is read in;\nnormally, module namespaces also last until the interpreter quits.  The\nstatements executed by the top-level invocation of the interpreter,\neither read from a script file or interactively, are considered part of\na module called *note main: 1, so they have their own global\nnamespace.  (The built-in names actually also live in a module; this is\ncalled *note builtins: 10.)\n",
            "subsections": []
        },
        "The local namespace for a function is created when the function is": {
            "content": "called, and deleted when the function returns or raises an exception\nthat is not handled within the function.  (Actually, forgetting would be\na better way to describe what actually happens.)  Of course, recursive\ninvocations each have their own local namespace.\n\nA 'scope' is a textual region of a Python program where a namespace is\ndirectly accessible.  \"Directly accessible\" here means that an\nunqualified reference to a name attempts to find the name in the\nnamespace.\n\nAlthough scopes are determined statically, they are used dynamically.",
            "subsections": []
        },
        "At any time during execution, there are 3 or 4 nested scopes whose": {
            "content": "namespaces are directly accessible:\n\n* the innermost scope, which is searched first, contains the local\nnames\n\n* the scopes of any enclosing functions, which are searched starting\nwith the nearest enclosing scope, contain non-local, but also\nnon-global names\n\n* the next-to-last scope contains the current module's global names\n\n* the outermost scope (searched last) is the namespace containing\nbuilt-in names\n",
            "subsections": []
        },
        "If a name is declared global, then all references and assignments go": {
            "content": "directly to the next-to-last scope containing the module's global names.\nTo rebind variables found outside of the innermost scope, the *note\nnonlocal: 111f. statement can be used; if not declared nonlocal, those\nvariables are read-only (an attempt to write to such a variable will\nsimply create a 'new' local variable in the innermost scope, leaving the\nidentically named outer variable unchanged).\n",
            "subsections": []
        },
        "Usually, the local scope references the local names of the (textually)": {
            "content": "current function.  Outside functions, the local scope references the\nsame namespace as the global scope: the module's namespace.  Class\ndefinitions place yet another namespace in the local scope.\n",
            "subsections": []
        },
        "It is important to realize that scopes are determined textually: the": {
            "content": "global scope of a function defined in a module is that module's\nnamespace, no matter from where or by what alias the function is called.",
            "subsections": []
        },
        "On the other hand, the actual search for names is done dynamically, at": {
            "content": "run time -- however, the language definition is evolving towards static\nname resolution, at \"compile\" time, so don't rely on dynamic name\nresolution!  (In fact, local variables are already determined\nstatically.)\n\nA special quirk of Python is that - if no *note global: 19a3. or *note\nnonlocal: 111f. statement is in effect - assignments to names always go\ninto the innermost scope.  Assignments do not copy data -- they just bind\nnames to objects.  The same is true for deletions: the statement 'del x'\nremoves the binding of 'x' from the namespace referenced by the local\nscope.  In fact, all operations that introduce new names use the local\nscope: in particular, *note import: 3a6. statements and function\ndefinitions bind the module or function name in the local scope.\n\nThe *note global: 19a3. statement can be used to indicate that\nparticular variables live in the global scope and should be rebound\nthere; the *note nonlocal: 111f. statement indicates that particular\nvariables live in an enclosing scope and should be rebound there.\n\n* Menu:\n\n* Scopes and Namespaces Example::\n\n---------- Footnotes ----------\n\n(1) Except for one thing.  Module objects have a secret read-only\nattribute called *note dict: aa8. which returns the dictionary used\nto implement the module's namespace; the name *note dict: aa8. is an\nattribute but not a global name.  Obviously, using this violates the\nabstraction of namespace implementation, and should be restricted to\nthings like post-mortem debuggers.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Scopes and Namespaces Example,  Up: Python Scopes and Namespaces": {
            "content": "2.9.2.1 Scopes and Namespaces Example\n.....................................\n",
            "subsections": []
        },
        "This is an example demonstrating how to reference the different scopes": {
            "content": "and namespaces, and how *note global: 19a3. and *note nonlocal: 111f.\naffect variable binding:\n\ndef scopetest():\ndef dolocal():\nspam = \"local spam\"\n\ndef dononlocal():\nnonlocal spam\nspam = \"nonlocal spam\"\n\ndef doglobal():\nglobal spam\nspam = \"global spam\"\n\nspam = \"test spam\"\ndolocal()\nprint(\"After local assignment:\", spam)\ndononlocal()\nprint(\"After nonlocal assignment:\", spam)\ndoglobal()\nprint(\"After global assignment:\", spam)\n\nscopetest()\nprint(\"In global scope:\", spam)\n\nThe output of the example code is:\n\nAfter local assignment: test spam\nAfter nonlocal assignment: nonlocal spam\nAfter global assignment: nonlocal spam\nIn global scope: global spam\n",
            "subsections": []
        },
        "Note how the 'local' assignment (which is default) didn't change": {
            "content": "'scopetest\"s binding of 'spam'.  The *note nonlocal: 111f. assignment\nchanged 'scopetest\"s binding of 'spam', and the *note global: 19a3.\nassignment changed the module-level binding.\n",
            "subsections": []
        },
        "You can also see that there was no previous binding for 'spam' before": {
            "content": "the *note global: 19a3. assignment.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: A First Look at Classes,  Next: Random Remarks,  Prev: Python Scopes and Namespaces,  Up: Classes": {
            "content": "",
            "subsections": []
        },
        "Classes introduce a little bit of new syntax, three new object types,": {
            "content": "and some new semantics.\n\n* Menu:\n\n* Class Definition Syntax::\n* Class Objects::\n* Instance Objects::\n* Method Objects::\n* Class and Instance Variables::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Class Definition Syntax,  Next: Class Objects,  Up: A First Look at Classes": {
            "content": "2.9.3.1 Class Definition Syntax\n...............................\n\nThe simplest form of class definition looks like this:\n\nclass ClassName:\n<statement-1>\n.\n.\n.\n<statement-N>\n\nClass definitions, like function definitions (*note def: 12af.\nstatements) must be executed before they have any effect.  (You could\nconceivably place a class definition in a branch of an *note if: 24f.\nstatement, or inside a function.)\n",
            "subsections": []
        },
        "In practice, the statements inside a class definition will usually be": {
            "content": "function definitions, but other statements are allowed, and sometimes\nuseful -- we'll come back to this later.  The function definitions inside\na class normally have a peculiar form of argument list, dictated by the\ncalling conventions for methods -- again, this is explained later.\n",
            "subsections": []
        },
        "When a class definition is entered, a new namespace is created, and used": {
            "content": "as the local scope -- thus, all assignments to local variables go into\nthis new namespace.  In particular, function definitions bind the name\nof the new function here.\n",
            "subsections": []
        },
        "When a class definition is left normally (via the end), a 'class object'": {
            "content": "is created.  This is basically a wrapper around the contents of the\nnamespace created by the class definition; we'll learn more about class\nobjects in the next section.  The original local scope (the one in\neffect just before the class definition was entered) is reinstated, and\nthe class object is bound here to the class name given in the class\ndefinition header ('ClassName' in the example).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Class Objects,  Next: Instance Objects,  Prev: Class Definition Syntax,  Up: A First Look at Classes": {
            "content": "2.9.3.2 Class Objects\n.....................\n",
            "subsections": []
        },
        "Class objects support two kinds of operations: attribute references and": {
            "content": "instantiation.\n\n'Attribute references' use the standard syntax used for all attribute\nreferences in Python: 'obj.name'.  Valid attribute names are all the\nnames that were in the class's namespace when the class object was\ncreated.  So, if the class definition looked like this:\n\nclass MyClass:\n\"\"\"A simple example class\"\"\"\ni = 12345\n\ndef f(self):\nreturn 'hello world'\n\nthen 'MyClass.i' and 'MyClass.f' are valid attribute references,\nreturning an integer and a function object, respectively.  Class\nattributes can also be assigned to, so you can change the value of\n'MyClass.i' by assignment.  'doc' is also a valid attribute,\nreturning the docstring belonging to the class: '\"A simple example\nclass\"'.\n",
            "subsections": []
        },
        "Class 'instantiation' uses function notation.  Just pretend that the": {
            "content": "class object is a parameterless function that returns a new instance of\nthe class.  For example (assuming the above class):\n\nx = MyClass()\n\ncreates a new 'instance' of the class and assigns this object to the\nlocal variable 'x'.\n\nThe instantiation operation (\"calling\" a class object) creates an empty\nobject.  Many classes like to create objects with instances customized\nto a specific initial state.  Therefore a class may define a special\nmethod named *note init(): 47d, like this:\n\ndef init(self):\nself.data = []\n\nWhen a class defines an *note init(): 47d. method, class\ninstantiation automatically invokes 'init()' for the newly created\nclass instance.  So in this example, a new, initialized instance can be\nobtained by:\n\nx = MyClass()\n\nOf course, the *note init(): 47d. method may have arguments for\ngreater flexibility.  In that case, arguments given to the class\ninstantiation operator are passed on to 'init()'.  For example,\n\n>>> class Complex:\n...     def init(self, realpart, imagpart):\n...         self.r = realpart\n...         self.i = imagpart\n...\n>>> x = Complex(3.0, -4.5)\n>>> x.r, x.i\n(3.0, -4.5)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Instance Objects,  Next: Method Objects,  Prev: Class Objects,  Up: A First Look at Classes": {
            "content": "2.9.3.3 Instance Objects\n........................\n\nNow what can we do with instance objects?  The only operations\nunderstood by instance objects are attribute references.  There are two\nkinds of valid attribute names: data attributes and methods.\n\n'data attributes' correspond to \"instance variables\" in Smalltalk, and\nto \"data members\" in C++.  Data attributes need not be declared; like\nlocal variables, they spring into existence when they are first assigned\nto.  For example, if 'x' is the instance of 'MyClass' created above, the\nfollowing piece of code will print the value '16', without leaving a\ntrace:\n\nx.counter = 1\nwhile x.counter < 10:\nx.counter = x.counter * 2\nprint(x.counter)\ndel x.counter\n",
            "subsections": []
        },
        "The other kind of instance attribute reference is a 'method'.  A method": {
            "content": "is a function that \"belongs to\" an object.  (In Python, the term method\nis not unique to class instances: other object types can have methods as\nwell.  For example, list objects have methods called append, insert,\nremove, sort, and so on.  However, in the following discussion, we'll\nuse the term method exclusively to mean methods of class instance\nobjects, unless explicitly stated otherwise.)\n",
            "subsections": []
        },
        "Valid method names of an instance object depend on its class.  By": {
            "content": "definition, all attributes of a class that are function objects define\ncorresponding methods of its instances.  So in our example, 'x.f' is a\nvalid method reference, since 'MyClass.f' is a function, but 'x.i' is\nnot, since 'MyClass.i' is not.  But 'x.f' is not the same thing as\n'MyClass.f' -- it is a 'method object', not a function object.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Method Objects,  Next: Class and Instance Variables,  Prev: Instance Objects,  Up: A First Look at Classes": {
            "content": "2.9.3.4 Method Objects\n......................\n\nUsually, a method is called right after it is bound:\n\nx.f()\n\nIn the 'MyClass' example, this will return the string ''hello world''.",
            "subsections": []
        },
        "However, it is not necessary to call a method right away: 'x.f' is a": {
            "content": "method object, and can be stored away and called at a later time.  For\nexample:\n\nxf = x.f\nwhile True:\nprint(xf())\n\nwill continue to print 'hello world' until the end of time.\n\nWhat exactly happens when a method is called?  You may have noticed that\n'x.f()' was called without an argument above, even though the function\ndefinition for 'f()' specified an argument.  What happened to the\nargument?  Surely Python raises an exception when a function that\nrequires an argument is called without any -- even if the argument isn't\nactually used...\n",
            "subsections": []
        },
        "Actually, you may have guessed the answer: the special thing about": {
            "content": "methods is that the instance object is passed as the first argument of\nthe function.  In our example, the call 'x.f()' is exactly equivalent to\n'MyClass.f(x)'.  In general, calling a method with a list of 'n'\narguments is equivalent to calling the corresponding function with an\nargument list that is created by inserting the method's instance object\nbefore the first argument.\n",
            "subsections": []
        },
        "In general, methods work as follows.  When a non-data attribute of an": {
            "content": "instance is referenced, the instance's class is searched.  If the name\ndenotes a valid class attribute that is a function object, references to\nboth the instance object and the function object are packed into a\nmethod object.  When the method object is called with an argument list,\na new argument list is constructed from the instance object and the\nargument list, and the function object is called with this new argument\nlist.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Class and Instance Variables,  Prev: Method Objects,  Up: A First Look at Classes": {
            "content": "2.9.3.5 Class and Instance Variables\n....................................\n",
            "subsections": []
        },
        "Generally speaking, instance variables are for data unique to each": {
            "content": "instance and class variables are for attributes and methods shared by\nall instances of the class:\n\nclass Dog:\n\nkind = 'canine'         # class variable shared by all instances\n\ndef init(self, name):\nself.name = name    # instance variable unique to each instance\n\n>>> d = Dog('Fido')\n>>> e = Dog('Buddy')\n>>> d.kind                  # shared by all dogs\n'canine'\n>>> e.kind                  # shared by all dogs\n'canine'\n>>> d.name                  # unique to d\n'Fido'\n>>> e.name                  # unique to e\n'Buddy'\n\nAs discussed in *note A Word About Names and Objects: 1a27, shared data\ncan have possibly surprising effects with involving *note mutable: 1987.\nobjects such as lists and dictionaries.  For example, the 'tricks' list\nin the following code should not be used as a class variable because\njust a single list would be shared by all 'Dog' instances:\n\nclass Dog:\n\ntricks = []             # mistaken use of a class variable\n\ndef init(self, name):\nself.name = name\n\ndef addtrick(self, trick):\nself.tricks.append(trick)\n\n>>> d = Dog('Fido')\n>>> e = Dog('Buddy')\n>>> d.addtrick('roll over')\n>>> e.addtrick('play dead')\n>>> d.tricks                # unexpectedly shared by all dogs\n['roll over', 'play dead']\n\nCorrect design of the class should use an instance variable instead:\n\nclass Dog:\n\ndef init(self, name):\nself.name = name\nself.tricks = []    # creates a new empty list for each dog\n\ndef addtrick(self, trick):\nself.tricks.append(trick)\n\n>>> d = Dog('Fido')\n>>> e = Dog('Buddy')\n>>> d.addtrick('roll over')\n>>> e.addtrick('play dead')\n>>> d.tricks\n['roll over']\n>>> e.tricks\n['play dead']\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Random Remarks,  Next: Inheritance,  Prev: A First Look at Classes,  Up: Classes": {
            "content": "",
            "subsections": []
        },
        "If the same attribute name occurs in both an instance and in a class,": {
            "content": "then attribute lookup prioritizes the instance:\n\n>>> class Warehouse:\n...    purpose = 'storage'\n...    region = 'west'\n...\n>>> w1 = Warehouse()\n>>> print(w1.purpose, w1.region)\nstorage west\n>>> w2 = Warehouse()\n>>> w2.region = 'east'\n>>> print(w2.purpose, w2.region)\nstorage east\n",
            "subsections": []
        },
        "Data attributes may be referenced by methods as well as by ordinary": {
            "content": "users (\"clients\") of an object.  In other words, classes are not usable\nto implement pure abstract data types.  In fact, nothing in Python makes\nit possible to enforce data hiding -- it is all based upon convention.\n(On the other hand, the Python implementation, written in C, can\ncompletely hide implementation details and control access to an object\nif necessary; this can be used by extensions to Python written in C.)\n",
            "subsections": []
        },
        "Clients should use data attributes with care -- clients may mess up": {
            "content": "invariants maintained by the methods by stamping on their data\nattributes.  Note that clients may add data attributes of their own to\nan instance object without affecting the validity of the methods, as\nlong as name conflicts are avoided -- again, a naming convention can save\na lot of headaches here.\n",
            "subsections": []
        },
        "There is no shorthand for referencing data attributes (or other": {
            "content": "methods!)  from within methods.  I find that this actually increases the\nreadability of methods: there is no chance of confusing local variables\nand instance variables when glancing through a method.\n",
            "subsections": []
        },
        "Often, the first argument of a method is called 'self'.  This is nothing": {
            "content": "more than a convention: the name 'self' has absolutely no special\nmeaning to Python.  Note, however, that by not following the convention\nyour code may be less readable to other Python programmers, and it is\nalso conceivable that a 'class browser' program might be written that\nrelies upon such a convention.\n",
            "subsections": []
        },
        "Any function object that is a class attribute defines a method for": {
            "content": "instances of that class.  It is not necessary that the function\ndefinition is textually enclosed in the class definition: assigning a\nfunction object to a local variable in the class is also ok.  For\nexample:\n\n# Function defined outside the class\ndef f1(self, x, y):\nreturn min(x, x+y)\n\nclass C:\nf = f1\n\ndef g(self):\nreturn 'hello world'\n\nh = g\n",
            "subsections": []
        },
        "Now 'f', 'g' and 'h' are all attributes of class 'C' that refer to": {
            "content": "function objects, and consequently they are all methods of instances of\n'C' -- 'h' being exactly equivalent to 'g'.  Note that this practice\nusually only serves to confuse the reader of a program.\n",
            "subsections": []
        },
        "Methods may call other methods by using method attributes of the 'self'": {
            "content": "argument:\n\nclass Bag:\ndef init(self):\nself.data = []\n\ndef add(self, x):\nself.data.append(x)\n\ndef addtwice(self, x):\nself.add(x)\nself.add(x)\n",
            "subsections": []
        },
        "Methods may reference global names in the same way as ordinary": {
            "content": "functions.  The global scope associated with a method is the module\ncontaining its definition.  (A class is never used as a global scope.)",
            "subsections": []
        },
        "While one rarely encounters a good reason for using global data in a": {
            "content": "method, there are many legitimate uses of the global scope: for one\nthing, functions and modules imported into the global scope can be used\nby methods, as well as functions and classes defined in it.  Usually,\nthe class containing the method is itself defined in this global scope,\nand in the next section we'll find some good reasons why a method would\nwant to reference its own class.\n",
            "subsections": []
        },
        "Each value is an object, and therefore has a 'class' (also called its": {
            "content": "'type').  It is stored as 'object.class'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Inheritance,  Next: Private Variables,  Prev: Random Remarks,  Up: Classes": {
            "content": "Of course, a language feature would not be worthy of the name \"class\"\nwithout supporting inheritance.  The syntax for a derived class\ndefinition looks like this:\n\nclass DerivedClassName(BaseClassName):\n<statement-1>\n.\n.\n.\n<statement-N>\n",
            "subsections": []
        },
        "The name 'BaseClassName' must be defined in a namespace accessible from": {
            "content": "the scope containing the derived class definition.  In place of a base\nclass name, other arbitrary expressions are also allowed.  This can be\nuseful, for example, when the base class is defined in another module:\n\nclass DerivedClassName(modname.BaseClassName):\n",
            "subsections": []
        },
        "Execution of a derived class definition proceeds the same as for a base": {
            "content": "class.  When the class object is constructed, the base class is\nremembered.  This is used for resolving attribute references: if a\nrequested attribute is not found in the class, the search proceeds to\nlook in the base class.  This rule is applied recursively if the base\nclass itself is derived from some other class.\n\nThere's nothing special about instantiation of derived classes:\n'DerivedClassName()' creates a new instance of the class.  Method\nreferences are resolved as follows: the corresponding class attribute is\nsearched, descending down the chain of base classes if necessary, and\nthe method reference is valid if this yields a function object.\n",
            "subsections": []
        },
        "Derived classes may override methods of their base classes.  Because": {
            "content": "methods have no special privileges when calling other methods of the\nsame object, a method of a base class that calls another method defined\nin the same base class may end up calling a method of a derived class\nthat overrides it.  (For C++ programmers: all methods in Python are\neffectively 'virtual'.)\n",
            "subsections": []
        },
        "An overriding method in a derived class may in fact want to extend": {
            "content": "rather than simply replace the base class method of the same name.",
            "subsections": []
        },
        "There is a simple way to call the base class method directly: just call": {
            "content": "'BaseClassName.methodname(self, arguments)'.  This is occasionally\nuseful to clients as well.  (Note that this only works if the base class\nis accessible as 'BaseClassName' in the global scope.)\n\nPython has two built-in functions that work with inheritance:\n\n* Use *note isinstance(): 14b. to check an instance's type:\n'isinstance(obj, int)' will be 'True' only if 'obj.class' is\n*note int: 17e. or some class derived from *note int: 17e.\n\n* Use *note issubclass(): 5b4. to check class inheritance:\n'issubclass(bool, int)' is 'True' since *note bool: 17d. is a\nsubclass of *note int: 17e.  However, 'issubclass(float, int)' is\n'False' since *note float: 4b7. is not a subclass of *note int:\n17e.\n\n* Menu:\n\n* Multiple Inheritance::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Multiple Inheritance,  Up: Inheritance": {
            "content": "2.9.5.1 Multiple Inheritance\n............................\n",
            "subsections": []
        },
        "Python supports a form of multiple inheritance as well.  A class": {
            "content": "definition with multiple base classes looks like this:\n\nclass DerivedClassName(Base1, Base2, Base3):\n<statement-1>\n.\n.\n.\n<statement-N>\n",
            "subsections": []
        },
        "For most purposes, in the simplest cases, you can think of the search": {
            "content": "for attributes inherited from a parent class as depth-first,\nleft-to-right, not searching twice in the same class where there is an\noverlap in the hierarchy.  Thus, if an attribute is not found in\n'DerivedClassName', it is searched for in 'Base1', then (recursively) in\nthe base classes of 'Base1', and if it was not found there, it was\nsearched for in 'Base2', and so on.\n",
            "subsections": []
        },
        "In fact, it is slightly more complex than that; the method resolution": {
            "content": "order changes dynamically to support cooperative calls to *note super():\n204.  This approach is known in some other multiple-inheritance\nlanguages as call-next-method and is more powerful than the super call\nfound in single-inheritance languages.\n",
            "subsections": []
        },
        "Dynamic ordering is necessary because all cases of multiple inheritance": {
            "content": "exhibit one or more diamond relationships (where at least one of the\nparent classes can be accessed through multiple paths from the\nbottommost class).  For example, all classes inherit from *note object:\n8bb, so any case of multiple inheritance provides more than one path to\nreach *note object: 8bb.  To keep the base classes from being accessed\nmore than once, the dynamic algorithm linearizes the search order in a\nway that preserves the left-to-right ordering specified in each class,\nthat calls each parent only once, and that is monotonic (meaning that a\nclass can be subclassed without affecting the precedence order of its\nparents).  Taken together, these properties make it possible to design\nreliable and extensible classes with multiple inheritance.  For more\ndetail, see 'https://www.python.org/download/releases/2.3/mro/'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Private Variables,  Next: Odds and Ends,  Prev: Inheritance,  Up: Classes": {
            "content": "\"Private\" instance variables that cannot be accessed except from inside\nan object don't exist in Python.  However, there is a convention that is\nfollowed by most Python code: a name prefixed with an underscore (e.g.\n'spam') should be treated as a non-public part of the API (whether it\nis a function, a method or a data member).  It should be considered an\nimplementation detail and subject to change without notice.\n",
            "subsections": []
        },
        "Since there is a valid use-case for class-private members (namely to": {
            "content": "avoid name clashes of names with names defined by subclasses), there is\nlimited support for such a mechanism, called 'name mangling'.  Any\nidentifier of the form 'spam' (at least two leading underscores, at\nmost one trailing underscore) is textually replaced with\n'classnamespam', where 'classname' is the current class name with\nleading underscore(s) stripped.  This mangling is done without regard to\nthe syntactic position of the identifier, as long as it occurs within\nthe definition of a class.\n",
            "subsections": []
        },
        "Name mangling is helpful for letting subclasses override methods without": {
            "content": "breaking intraclass method calls.  For example:\n\nclass Mapping:\ndef init(self, iterable):\nself.itemslist = []\nself.update(iterable)\n\ndef update(self, iterable):\nfor item in iterable:\nself.itemslist.append(item)\n\nupdate = update   # private copy of original update() method\n\nclass MappingSubclass(Mapping):\n\ndef update(self, keys, values):\n# provides new signature for update()\n# but does not break init()\nfor item in zip(keys, values):\nself.itemslist.append(item)\n",
            "subsections": []
        },
        "The above example would work even if 'MappingSubclass' were to introduce": {
            "content": "a 'update' identifier since it is replaced with 'Mappingupdate' in\nthe 'Mapping' class and 'MappingSubclassupdate' in the\n'MappingSubclass' class respectively.\n",
            "subsections": []
        },
        "Note that the mangling rules are designed mostly to avoid accidents; it": {
            "content": "still is possible to access or modify a variable that is considered\nprivate.  This can even be useful in special circumstances, such as in\nthe debugger.\n",
            "subsections": []
        },
        "Notice that code passed to 'exec()' or 'eval()' does not consider the": {
            "content": "classname of the invoking class to be the current class; this is similar\nto the effect of the 'global' statement, the effect of which is likewise\nrestricted to code that is byte-compiled together.  The same restriction\napplies to 'getattr()', 'setattr()' and 'delattr()', as well as when\nreferencing 'dict' directly.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Odds and Ends,  Next: Iterators,  Prev: Private Variables,  Up: Classes": {
            "content": "",
            "subsections": []
        },
        "Sometimes it is useful to have a data type similar to the Pascal": {
            "content": "\"record\" or C \"struct\", bundling together a few named data items.  The\nidiomatic approach is to use *note dataclasses: 2d. for this purpose:\n\nfrom dataclasses import dataclass\n\n@dataclass\nclass Employee:\nname: str\ndept: str\nsalary: int\n\n>>> john = Employee('john', 'computer lab', 1000)\n>>> john.dept\n'computer lab'\n>>> john.salary\n1000\n\nA piece of Python code that expects a particular abstract data type can\noften be passed a class that emulates the methods of that data type\ninstead.  For instance, if you have a function that formats some data\nfrom a file object, you can define a class with methods *note read():\n1a0a. and *note readline(): 1a40. that get the data from a string buffer\ninstead, and pass it as an argument.\n\n*note Instance method objects: 1a41. have attributes, too: *note\nm.self: 121d. is the instance object with the method 'm()', and\n*note m.func: 1171. is the *note function object: 1a42.\ncorresponding to the method.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Iterators,  Next: Generators,  Prev: Odds and Ends,  Up: Classes": {
            "content": "",
            "subsections": []
        },
        "By now you have probably noticed that most container objects can be": {
            "content": "looped over using a *note for: 24e. statement:\n\nfor element in [1, 2, 3]:\nprint(element)\nfor element in (1, 2, 3):\nprint(element)\nfor key in {'one':1, 'two':2}:\nprint(key)\nfor char in \"123\":\nprint(char)\nfor line in open(\"myfile.txt\"):\nprint(line, end='')\n",
            "subsections": []
        },
        "This style of access is clear, concise, and convenient.  The use of": {
            "content": "iterators pervades and unifies Python.  Behind the scenes, the *note\nfor: 24e. statement calls *note iter(): 5ca. on the container object.\nThe function returns an iterator object that defines the method *note\nnext(): 1141. which accesses elements in the container one at a\ntime.  When there are no more elements, *note next(): 1141. raises a\n*note StopIteration: a40. exception which tells the 'for' loop to\nterminate.  You can call the *note next(): 1141. method using the\n*note next(): 5cb. built-in function; this example shows how it all\nworks:\n\n>>> s = 'abc'\n>>> it = iter(s)\n>>> it\n<striterator object at 0x10c90e650>\n>>> next(it)\n'a'\n>>> next(it)\n'b'\n>>> next(it)\n'c'\n>>> next(it)\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nnext(it)\nStopIteration\n",
            "subsections": []
        },
        "Having seen the mechanics behind the iterator protocol, it is easy to": {
            "content": "add iterator behavior to your classes.  Define an *note iter():\n1a45. method which returns an object with a *note next(): 1141.\nmethod.  If the class defines 'next()', then 'iter()' can just\nreturn 'self':\n\nclass Reverse:\n\"\"\"Iterator for looping over a sequence backwards.\"\"\"\ndef init(self, data):\nself.data = data\nself.index = len(data)\n\ndef iter(self):\nreturn self\n\ndef next(self):\nif self.index == 0:\nraise StopIteration\nself.index = self.index - 1\nreturn self.data[self.index]\n\n>>> rev = Reverse('spam')\n>>> iter(rev)\n<main.Reverse object at 0x00A1DB50>\n>>> for char in rev:\n...     print(char)\n...\nm\na\np\ns\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Generators,  Next: Generator Expressions,  Prev: Iterators,  Up: Classes": {
            "content": "*note Generators: eda. are a simple and powerful tool for creating\niterators.  They are written like regular functions but use the *note\nyield: 7f1. statement whenever they want to return data.  Each time\n*note next(): 5cb. is called on it, the generator resumes where it left\noff (it remembers all the data values and which statement was last\nexecuted).  An example shows that generators can be trivially easy to\ncreate:\n\ndef reverse(data):\nfor index in range(len(data)-1, -1, -1):\nyield data[index]\n\n>>> for char in reverse('golf'):\n...     print(char)\n...\nf\nl\no\ng\n",
            "subsections": []
        },
        "Anything that can be done with generators can also be done with": {
            "content": "class-based iterators as described in the previous section.  What makes\ngenerators so compact is that the *note iter(): 1a48. and *note\nnext(): 1a49. methods are created automatically.\n",
            "subsections": []
        },
        "Another key feature is that the local variables and execution state are": {
            "content": "automatically saved between calls.  This made the function easier to\nwrite and much more clear than an approach using instance variables like\n'self.index' and 'self.data'.\n",
            "subsections": []
        },
        "In addition to automatic method creation and saving program state, when": {
            "content": "generators terminate, they automatically raise *note StopIteration: a40.",
            "subsections": []
        },
        "In combination, these features make it easy to create iterators with no": {
            "content": "more effort than writing a regular function.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Generator Expressions,  Prev: Generators,  Up: Classes": {
            "content": "",
            "subsections": []
        },
        "Some simple generators can be coded succinctly as expressions using a": {
            "content": "syntax similar to list comprehensions but with parentheses instead of\nsquare brackets.  These expressions are designed for situations where\nthe generator is used right away by an enclosing function.  Generator\nexpressions are more compact but less versatile than full generator\ndefinitions and tend to be more memory friendly than equivalent list\ncomprehensions.\n\nExamples:\n\n>>> sum(i*i for i in range(10))                 # sum of squares\n285\n\n>>> xvec = [10, 20, 30]\n>>> yvec = [7, 5, 3]\n>>> sum(x*y for x,y in zip(xvec, yvec))         # dot product\n260\n\n>>> uniquewords = set(word for line in page  for word in line.split())\n\n>>> valedictorian = max((student.gpa, student.name) for student in graduates)\n\n>>> data = 'golf'\n>>> list(data[i] for i in range(len(data)-1, -1, -1))\n['f', 'l', 'o', 'g']\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Brief Tour of the Standard Library,  Next: Brief Tour of the Standard Library -- Part II,  Prev: Classes,  Up: The Python Tutorial": {
            "content": "",
            "subsections": [
                {
                    "name": "2.10 Brief Tour of the Standard Library",
                    "content": "* Menu:\n\n* Operating System Interface::\n* File Wildcards::\n* Command Line Arguments::\n* Error Output Redirection and Program Termination::\n* String Pattern Matching::\n* Mathematics::\n* Internet Access::\n* Dates and Times::\n* Data Compression::\n* Performance Measurement::\n* Quality Control::\n* Batteries Included::\n"
                }
            ]
        },
        "File: python3.12.info,  Node: Operating System Interface,  Next: File Wildcards,  Up: Brief Tour of the Standard Library": {
            "content": "The *note os: 9c. module provides dozens of functions for interacting\nwith the operating system:\n\n>>> import os\n>>> os.getcwd()      # Return the current working directory\n'C:\\\\Python312'\n>>> os.chdir('/server/accesslogs')   # Change current working directory\n>>> os.system('mkdir today')   # Run the command mkdir in the system shell\n0\n\nBe sure to use the 'import os' style instead of 'from os import *'.\nThis will keep *note os.open(): bee. from shadowing the built-in *note\nopen(): 26e. function which operates much differently.\n\nThe built-in *note dir(): 3ff. and *note help(): 6f0. functions are\nuseful as interactive aids for working with large modules like *note os:\n9c.:\n\n>>> import os\n>>> dir(os)\n<returns a list of all module functions>\n>>> help(os)\n<returns an extensive manual page created from the module's docstrings>\n\nFor daily file and directory management tasks, the *note shutil: c0.\nmodule provides a higher level interface that is easier to use:\n\n>>> import shutil\n>>> shutil.copyfile('data.db', 'archive.db')\n'archive.db'\n>>> shutil.move('/build/executables', 'installdir')\n'installdir'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: File Wildcards,  Next: Command Line Arguments,  Prev: Operating System Interface,  Up: Brief Tour of the Standard Library": {
            "content": "The *note glob: 5f. module provides a function for making file lists\nfrom directory wildcard searches:\n\n>>> import glob\n>>> glob.glob('*.py')\n['primes.py', 'random.py', 'quote.py']\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Command Line Arguments,  Next: Error Output Redirection and Program Termination,  Prev: File Wildcards,  Up: Brief Tour of the Standard Library": {
            "content": "Common utility scripts often need to process command line arguments.\nThese arguments are stored in the *note sys: d3. module's 'argv'\nattribute as a list.  For instance, let's take the following 'demo.py'\nfile:\n\n# File demo.py\nimport sys\nprint(sys.argv)\n",
            "subsections": []
        },
        "Here is the output from running 'python demo.py one two three' at the": {
            "content": "command line:\n\n['demo.py', 'one', 'two', 'three']\n\nThe *note argparse: 6. module provides a more sophisticated mechanism to\nprocess command line arguments.  The following script extracts one or\nmore filenames and an optional number of lines to be displayed:\n\nimport argparse\n\nparser = argparse.ArgumentParser(\nprog='top',\ndescription='Show top lines from each file')\nparser.addargument('filenames', nargs='+')\nparser.addargument('-l', '--lines', type=int, default=10)\nargs = parser.parseargs()\nprint(args)\n\nWhen run at the command line with 'python top.py --lines=5 alpha.txt\nbeta.txt', the script sets 'args.lines' to '5' and 'args.filenames' to\n'['alpha.txt', 'beta.txt']'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Error Output Redirection and Program Termination,  Next: String Pattern Matching,  Prev: Command Line Arguments,  Up: Brief Tour of the Standard Library": {
            "content": "The *note sys: d3. module also has attributes for 'stdin', 'stdout', and\n'stderr'.  The latter is useful for emitting warnings and error messages\nto make them visible even when 'stdout' has been redirected:\n\n>>> sys.stderr.write('Warning, log file not found starting a new one\\n')\nWarning, log file not found starting a new one\n\nThe most direct way to terminate a script is to use 'sys.exit()'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: String Pattern Matching,  Next: Mathematics,  Prev: Error Output Redirection and Program Termination,  Up: Brief Tour of the Standard Library": {
            "content": "The *note re: b4. module provides regular expression tools for advanced\nstring processing.  For complex matching and manipulation, regular\nexpressions offer succinct, optimized solutions:\n\n>>> import re\n>>> re.findall(r'\\bf[a-z]*', 'which foot or hand fell fastest')\n['foot', 'fell', 'fastest']\n>>> re.sub(r'(\\b[a-z]+) \\1', r'\\1', 'cat in the the hat')\n'cat in the hat'\n",
            "subsections": []
        },
        "When only simple capabilities are needed, string methods are preferred": {
            "content": "because they are easier to read and debug:\n\n>>> 'tea for too'.replace('too', 'two')\n'tea for two'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Mathematics,  Next: Internet Access,  Prev: String Pattern Matching,  Up: Brief Tour of the Standard Library": {
            "content": "The *note math: 89. module gives access to the underlying C library\nfunctions for floating point math:\n\n>>> import math\n>>> math.cos(math.pi / 4)\n0.70710678118654757\n>>> math.log(1024, 2)\n10.0\n\nThe *note random: b3. module provides tools for making random\nselections:\n\n>>> import random\n>>> random.choice(['apple', 'pear', 'banana'])\n'apple'\n>>> random.sample(range(100), 10)   # sampling without replacement\n[30, 83, 16, 4, 8, 81, 41, 50, 18, 33]\n>>> random.random()    # random float\n0.17970987693706186\n>>> random.randrange(6)    # random integer chosen from range(6)\n4\n\nThe *note statistics: cc. module calculates basic statistical properties\n(the mean, median, variance, etc.)  of numeric data:\n\n>>> import statistics\n>>> data = [2.75, 1.75, 1.25, 0.25, 0.5, 1.25, 3.5]\n>>> statistics.mean(data)\n1.6071428571428572\n>>> statistics.median(data)\n1.25\n>>> statistics.variance(data)\n1.3720238095238095\n\nThe SciPy project <'https://scipy.org'> has many other modules for\nnumerical computations.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Internet Access,  Next: Dates and Times,  Prev: Mathematics,  Up: Brief Tour of the Standard Library": {
            "content": "",
            "subsections": []
        },
        "There are a number of modules for accessing the internet and processing": {
            "content": "internet protocols.  Two of the simplest are *note urllib.request: 106.\nfor retrieving data from URLs and *note smtplib: c4. for sending mail:\n\n>>> from urllib.request import urlopen\n>>> with urlopen('http://worldtimeapi.org/api/timezone/etc/UTC.txt') as response:\n...     for line in response:\n...         line = line.decode()             # Convert bytes to a str\n...         if line.startswith('datetime'):\n...             print(line.rstrip())         # Remove trailing newline\n...\ndatetime: 2022-01-01T01:36:47.689215+00:00\n\n>>> import smtplib\n>>> server = smtplib.SMTP('localhost')\n>>> server.sendmail('soothsayer@example.org', 'jcaesar@example.org',\n... \"\"\"To: jcaesar@example.org\n... From: soothsayer@example.org\n...\n... Beware the Ides of March.\n... \"\"\")\n>>> server.quit()\n\n(Note that the second example needs a mailserver running on localhost.)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Dates and Times,  Next: Data Compression,  Prev: Internet Access,  Up: Brief Tour of the Standard Library": {
            "content": "The *note datetime: 2e. module supplies classes for manipulating dates\nand times in both simple and complex ways.  While date and time\narithmetic is supported, the focus of the implementation is on efficient\nmember extraction for output formatting and manipulation.  The module\nalso supports objects that are timezone aware.\n\n>>> # dates are easily constructed and formatted\n>>> from datetime import date\n>>> now = date.today()\n>>> now\ndatetime.date(2003, 12, 2)\n>>> now.strftime(\"%m-%d-%y. %d %b %Y is a %A on the %d day of %B.\")\n'12-02-03. 02 Dec 2003 is a Tuesday on the 02 day of December.'\n\n>>> # dates support calendar arithmetic\n>>> birthday = date(1964, 7, 31)\n>>> age = now - birthday\n>>> age.days\n14368\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Data Compression,  Next: Performance Measurement,  Prev: Dates and Times,  Up: Brief Tour of the Standard Library": {
            "content": "",
            "subsections": []
        },
        "Common data archiving and compression formats are directly supported by": {
            "content": "modules including: *note zlib: 12d, *note gzip: 62, *note bz2: 11, *note\nlzma: 85, *note zipfile: 12b. and *note tarfile: d8.\n\n>>> import zlib\n>>> s = b'witch which has which witches wrist watch'\n>>> len(s)\n41\n>>> t = zlib.compress(s)\n>>> len(t)\n37\n>>> zlib.decompress(t)\nb'witch which has which witches wrist watch'\n>>> zlib.crc32(s)\n226805979\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Performance Measurement,  Next: Quality Control,  Prev: Data Compression,  Up: Brief Tour of the Standard Library": {
            "content": "",
            "subsections": []
        },
        "Some Python users develop a deep interest in knowing the relative": {
            "content": "performance of different approaches to the same problem.  Python\nprovides a measurement tool that answers those questions immediately.\n",
            "subsections": []
        },
        "For example, it may be tempting to use the tuple packing and unpacking": {
            "content": "feature instead of the traditional approach to swapping arguments.  The\n*note timeit: e9. module quickly demonstrates a modest performance\nadvantage:\n\n>>> from timeit import Timer\n>>> Timer('t=a; a=b; b=t', 'a=1; b=2').timeit()\n0.57535828626024577\n>>> Timer('a,b = b,a', 'a=1; b=2').timeit()\n0.54962537085770791\n\nIn contrast to *note timeit: e9.'s fine level of granularity, the *note\nprofile: aa. and *note pstats: ab. modules provide tools for identifying\ntime critical sections in larger blocks of code.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Quality Control,  Next: Batteries Included,  Prev: Performance Measurement,  Up: Brief Tour of the Standard Library": {
            "content": "",
            "subsections": []
        },
        "One approach for developing high quality software is to write tests for": {
            "content": "each function as it is developed and to run those tests frequently\nduring the development process.\n\nThe *note doctest: 36. module provides a tool for scanning a module and\nvalidating tests embedded in a program's docstrings.  Test construction\nis as simple as cutting-and-pasting a typical call along with its\nresults into the docstring.  This improves the documentation by\nproviding the user with an example and it allows the doctest module to\nmake sure the code remains true to the documentation:\n\ndef average(values):\n\"\"\"Computes the arithmetic mean of a list of numbers.\n\n>>> print(average([20, 30, 70]))\n40.0\n\"\"\"\nreturn sum(values) / len(values)\n\nimport doctest\ndoctest.testmod()   # automatically validate the embedded tests\n\nThe *note unittest: 101. module is not as effortless as the *note\ndoctest: 36. module, but it allows a more comprehensive set of tests to\nbe maintained in a separate file:\n\nimport unittest\n\nclass TestStatisticalFunctions(unittest.TestCase):\n\ndef testaverage(self):\nself.assertEqual(average([20, 30, 70]), 40.0)\nself.assertEqual(round(average([1, 5, 7]), 1), 4.3)\nwith self.assertRaises(ZeroDivisionError):\naverage([])\nwith self.assertRaises(TypeError):\naverage(20, 30, 70)\n\nunittest.main()  # Calling from the command line invokes all tests\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Batteries Included,  Prev: Quality Control,  Up: Brief Tour of the Standard Library": {
            "content": "Python has a \"batteries included\" philosophy.  This is best seen through\nthe sophisticated and robust capabilities of its larger packages.  For\nexample:\n\n* The *note xmlrpc.client: 128. and *note xmlrpc.server: 129. modules\nmake implementing remote procedure calls into an almost trivial\ntask.  Despite the modules' names, no direct knowledge or handling\nof XML is needed.\n\n* The *note email: 37. package is a library for managing email\nmessages, including MIME and other RFC 2822(1)-based message\ndocuments.  Unlike *note smtplib: c4. and *note poplib: a7. which\nactually send and receive messages, the email package has a\ncomplete toolset for building or decoding complex message\nstructures (including attachments) and for implementing internet\nencoding and header protocols.\n\n* The *note json: 7c. package provides robust support for parsing\nthis popular data interchange format.  The *note csv: 27. module\nsupports direct reading and writing of files in Comma-Separated\nValue format, commonly supported by databases and spreadsheets.\nXML processing is supported by the *note xml.etree.ElementTree:\n120, *note xml.dom: 11c. and *note xml.sax: 124. packages.\nTogether, these modules and packages greatly simplify data\ninterchange between Python applications and other tools.\n\n* The *note sqlite3: c9. module is a wrapper for the SQLite database\nlibrary, providing a persistent database that can be updated and\naccessed using slightly nonstandard SQL syntax.\n\n* Internationalization is supported by a number of modules including\n*note gettext: 5e, *note locale: 81, and the *note codecs: 19.\npackage.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc2822.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Brief Tour of the Standard Library -- Part II,  Next: Virtual Environments and Packages,  Prev: Brief Tour of the Standard Library,  Up: The Python Tutorial": {
            "content": "",
            "subsections": [
                {
                    "name": "2.11 Brief Tour of the Standard Library -- Part II",
                    "content": ""
                }
            ]
        },
        "This second tour covers more advanced modules that support professional": {
            "content": "programming needs.  These modules rarely occur in small scripts.\n\n* Menu:\n\n* Output Formatting::\n* Templating::\n* Working with Binary Data Record Layouts::\n* Multi-threading: Multi-threading<2>.\n* Logging::\n* Weak References::\n* Tools for Working with Lists::\n* Decimal Floating Point Arithmetic::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Output Formatting,  Next: Templating,  Up: Brief Tour of the Standard Library -- Part II": {
            "content": "The *note reprlib: b6. module provides a version of *note repr(): 5f0.\ncustomized for abbreviated displays of large or deeply nested\ncontainers:\n\n>>> import reprlib\n>>> reprlib.repr(set('supercalifragilisticexpialidocious'))\n\"{'a', 'c', 'd', 'e', 'f', 'g', ...}\"\n\nThe *note pprint: a9. module offers more sophisticated control over\nprinting both built-in and user defined objects in a way that is\nreadable by the interpreter.  When the result is longer than one line,\nthe \"pretty printer\" adds line breaks and indentation to more clearly\nreveal data structure:\n\n>>> import pprint\n>>> t = [[[['black', 'cyan'], 'white', ['green', 'red']], [['magenta',\n...     'yellow'], 'blue']]]\n...\n>>> pprint.pprint(t, width=30)\n[[[['black', 'cyan'],\n'white',\n['green', 'red']],\n[['magenta', 'yellow'],\n'blue']]]\n\nThe *note textwrap: e6. module formats paragraphs of text to fit a given\nscreen width:\n\n>>> import textwrap\n>>> doc = \"\"\"The wrap() method is just like fill() except that it returns\n... a list of strings instead of one big string with newlines to separate\n... the wrapped lines.\"\"\"\n...\n>>> print(textwrap.fill(doc, width=40))\nThe wrap() method is just like fill()\nexcept that it returns a list of strings\ninstead of one big string with newlines\nto separate the wrapped lines.\n\nThe *note locale: 81. module accesses a database of culture specific\ndata formats.  The grouping attribute of locale's format function\nprovides a direct way of formatting numbers with group separators:\n\n>>> import locale\n>>> locale.setlocale(locale.LCALL, 'EnglishUnited States.1252')\n'EnglishUnited States.1252'\n>>> conv = locale.localeconv()          # get a mapping of conventions\n>>> x = 1234567.8\n>>> locale.formatstring(\"%d\", x, grouping=True)\n'1,234,567'\n>>> locale.formatstring(\"%s%.*f\", (conv['currencysymbol'],\n...                      conv['fracdigits'], x), grouping=True)\n'$1,234,567.80'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Templating,  Next: Working with Binary Data Record Layouts,  Prev: Output Formatting,  Up: Brief Tour of the Standard Library -- Part II": {
            "content": "The *note string: cd. module includes a versatile *note Template: 453.\nclass with a simplified syntax suitable for editing by end-users.  This\nallows users to customize their applications without having to alter the\napplication.\n\nThe format uses placeholder names formed by '$' with valid Python\nidentifiers (alphanumeric characters and underscores).  Surrounding the\nplaceholder with braces allows it to be followed by more alphanumeric\nletters with no intervening spaces.  Writing '$$' creates a single\nescaped '$':\n\n>>> from string import Template\n>>> t = Template('${village}folk send $$10 to $cause.')\n>>> t.substitute(village='Nottingham', cause='the ditch fund')\n'Nottinghamfolk send $10 to the ditch fund.'\n\nThe *note substitute(): 1a6e. method raises a *note KeyError: 8cf. when\na placeholder is not supplied in a dictionary or a keyword argument.",
            "subsections": []
        },
        "For mail-merge style applications, user supplied data may be incomplete": {
            "content": "and the *note safesubstitute(): 1a6f. method may be more appropriate --\nit will leave placeholders unchanged if data is missing:\n\n>>> t = Template('Return the $item to $owner.')\n>>> d = dict(item='unladen swallow')\n>>> t.substitute(d)\nTraceback (most recent call last):\n...\nKeyError: 'owner'\n>>> t.safesubstitute(d)\n'Return the unladen swallow to $owner.'\n",
            "subsections": []
        },
        "Template subclasses can specify a custom delimiter.  For example, a": {
            "content": "batch renaming utility for a photo browser may elect to use percent\nsigns for placeholders such as the current date, image sequence number,\nor file format:\n\n>>> import time, os.path\n>>> photofiles = ['img1074.jpg', 'img1076.jpg', 'img1077.jpg']\n>>> class BatchRename(Template):\n...     delimiter = '%'\n...\n>>> fmt = input('Enter rename style (%d-date %n-seqnum %f-format):  ')\nEnter rename style (%d-date %n-seqnum %f-format):  Ashley%n%f\n\n>>> t = BatchRename(fmt)\n>>> date = time.strftime('%d%b%y')\n>>> for i, filename in enumerate(photofiles):\n...     base, ext = os.path.splitext(filename)\n...     newname = t.substitute(d=date, n=i, f=ext)\n...     print('{0} --> {1}'.format(filename, newname))\n\nimg1074.jpg --> Ashley0.jpg\nimg1076.jpg --> Ashley1.jpg\nimg1077.jpg --> Ashley2.jpg\n",
            "subsections": []
        },
        "Another application for templating is separating program logic from the": {
            "content": "details of multiple output formats.  This makes it possible to\nsubstitute custom templates for XML files, plain text reports, and HTML\nweb reports.\n\nFile: python3.12.info,  Node: Working with Binary Data Record Layouts,  Next: Multi-threading<2>,  Prev: Templating,  Up: Brief Tour of the Standard Library -- Part II\n\n\nThe *note struct: cf. module provides *note pack(): 10ef. and *note\nunpack(): 1520. functions for working with variable length binary record\nformats.  The following example shows how to loop through header\ninformation in a ZIP file without using the *note zipfile: 12b. module.\nPack codes '\"H\"' and '\"I\"' represent two and four byte unsigned numbers\nrespectively.  The '\"<\"' indicates that they are standard size and in\nlittle-endian byte order:\n\nimport struct\n\nwith open('myfile.zip', 'rb') as f:\ndata = f.read()\n\nstart = 0\nfor i in range(3):                      # show the first 3 file headers\nstart += 14\nfields = struct.unpack('<IIIHH', data[start:start+16])\ncrc32, compsize, uncompsize, filenamesize, extrasize = fields\n\nstart += 16\nfilename = data[start:start+filenamesize]\nstart += filenamesize\nextra = data[start:start+extrasize]\nprint(filename, hex(crc32), compsize, uncompsize)\n\nstart += extrasize + compsize     # skip to the next header\n\nFile: python3.12.info,  Node: Multi-threading<2>,  Next: Logging,  Prev: Working with Binary Data Record Layouts,  Up: Brief Tour of the Standard Library -- Part II\n\n",
            "subsections": []
        },
        "Threading is a technique for decoupling tasks which are not sequentially": {
            "content": "dependent.  Threads can be used to improve the responsiveness of\napplications that accept user input while other tasks run in the\nbackground.  A related use case is running I/O in parallel with\ncomputations in another thread.\n\nThe following code shows how the high level *note threading: e7. module\ncan run tasks in background while the main program continues to run:\n\nimport threading, zipfile\n\nclass AsyncZip(threading.Thread):\ndef init(self, infile, outfile):\nthreading.Thread.init(self)\nself.infile = infile\nself.outfile = outfile\n\ndef run(self):\nf = zipfile.ZipFile(self.outfile, 'w', zipfile.ZIPDEFLATED)\nf.write(self.infile)\nf.close()\nprint('Finished background zip of:', self.infile)\n\nbackground = AsyncZip('mydata.txt', 'myarchive.zip')\nbackground.start()\nprint('The main program continues to run in foreground.')\n\nbackground.join()    # Wait for the background task to finish\nprint('Main program waited until background was done.')\n",
            "subsections": []
        },
        "The principal challenge of multi-threaded applications is coordinating": {
            "content": "threads that share data or other resources.  To that end, the threading\nmodule provides a number of synchronization primitives including locks,\nevents, condition variables, and semaphores.\n",
            "subsections": []
        },
        "While those tools are powerful, minor design errors can result in": {
            "content": "problems that are difficult to reproduce.  So, the preferred approach to\ntask coordination is to concentrate all access to a resource in a single\nthread and then use the *note queue: b1. module to feed that thread with\nrequests from other threads.  Applications using *note Queue: 1203.\nobjects for inter-thread communication and coordination are easier to\ndesign, more readable, and more reliable.\n\nFile: python3.12.info,  Node: Logging,  Next: Weak References,  Prev: Multi-threading<2>,  Up: Brief Tour of the Standard Library -- Part II\n\n\nThe *note logging: 82. module offers a full featured and flexible\nlogging system.  At its simplest, log messages are sent to a file or to\n'sys.stderr':\n\nimport logging\nlogging.debug('Debugging information')\nlogging.info('Informational message')\nlogging.warning('Warning:config file %s not found', 'server.conf')\nlogging.error('Error occurred')\nlogging.critical('Critical error -- shutting down')\n\nThis produces the following output:\n\nWARNING:root:Warning:config file server.conf not found\nERROR:root:Error occurred\nCRITICAL:root:Critical error -- shutting down\n",
            "subsections": []
        },
        "By default, informational and debugging messages are suppressed and the": {
            "content": "output is sent to standard error.  Other output options include routing\nmessages through email, datagrams, sockets, or to an HTTP Server.  New\nfilters can select different routing based on message priority: *note\nDEBUG: 1a76, *note INFO: 1a77, *note WARNING: 1a78, *note ERROR: 1a79,\nand *note CRITICAL: 1a7a.\n",
            "subsections": []
        },
        "The logging system can be configured directly from Python or can be": {
            "content": "loaded from a user editable configuration file for customized logging\nwithout altering the application.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Weak References,  Next: Tools for Working with Lists,  Prev: Logging,  Up: Brief Tour of the Standard Library -- Part II": {
            "content": "",
            "subsections": []
        },
        "Python does automatic memory management (reference counting for most": {
            "content": "objects and *note garbage collection: 167e. to eliminate cycles).  The\nmemory is freed shortly after the last reference to it has been\neliminated.\n",
            "subsections": []
        },
        "This approach works fine for most applications but occasionally there is": {
            "content": "a need to track objects only as long as they are being used by something\nelse.  Unfortunately, just tracking them creates a reference that makes\nthem permanent.  The *note weakref: 10f. module provides tools for\ntracking objects without creating a reference.  When the object is no\nlonger needed, it is automatically removed from a weakref table and a\ncallback is triggered for weakref objects.  Typical applications include\ncaching objects that are expensive to create:\n\n>>> import weakref, gc\n>>> class A:\n...     def init(self, value):\n...         self.value = value\n...     def repr(self):\n...         return str(self.value)\n...\n>>> a = A(10)                   # create a reference\n>>> d = weakref.WeakValueDictionary()\n>>> d['primary'] = a            # does not create a reference\n>>> d['primary']                # fetch the object if it is still alive\n10\n>>> del a                       # remove the one reference\n>>> gc.collect()                # run garbage collection right away\n0\n>>> d['primary']                # entry was automatically removed\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nd['primary']                # entry was automatically removed\nFile \"C:/python312/lib/weakref.py\", line 46, in getitem\no = self.data[key]()\nKeyError: 'primary'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Tools for Working with Lists,  Next: Decimal Floating Point Arithmetic,  Prev: Weak References,  Up: Brief Tour of the Standard Library -- Part II": {
            "content": "Many data structure needs can be met with the built-in list type.",
            "subsections": []
        },
        "However, sometimes there is a need for alternative implementations with": {
            "content": "different performance trade-offs.\n\nThe *note array: 7. module provides an *note array(): 18f. object that\nis like a list that stores only homogeneous data and stores it more\ncompactly.  The following example shows an array of numbers stored as\ntwo byte unsigned binary numbers (typecode '\"H\"') rather than the usual\n16 bytes per entry for regular lists of Python int objects:\n\n>>> from array import array\n>>> a = array('H', [4000, 10, 700, 22222])\n>>> sum(a)\n26932\n>>> a[1:3]\narray('H', [10, 700])\n\nThe *note collections: 1b. module provides a *note deque(): 3a0. object\nthat is like a list with faster appends and pops from the left side but\nslower lookups in the middle.  These objects are well suited for\nimplementing queues and breadth first tree searches:\n\n>>> from collections import deque\n>>> d = deque([\"task1\", \"task2\", \"task3\"])\n>>> d.append(\"task4\")\n>>> print(\"Handling\", d.popleft())\nHandling task1\n\nunsearched = deque([startingnode])\ndef breadthfirstsearch(unsearched):\nnode = unsearched.popleft()\nfor m in genmoves(node):\nif isgoal(m):\nreturn m\nunsearched.append(m)\n",
            "subsections": []
        },
        "In addition to alternative list implementations, the library also offers": {
            "content": "other tools such as the *note bisect: f. module with functions for\nmanipulating sorted lists:\n\n>>> import bisect\n>>> scores = [(100, 'perl'), (200, 'tcl'), (400, 'lua'), (500, 'python')]\n>>> bisect.insort(scores, (300, 'ruby'))\n>>> scores\n[(100, 'perl'), (200, 'tcl'), (300, 'ruby'), (400, 'lua'), (500, 'python')]\n\nThe *note heapq: 64. module provides functions for implementing heaps\nbased on regular lists.  The lowest valued entry is always kept at\nposition zero.  This is useful for applications which repeatedly access\nthe smallest element but do not want to run a full list sort:\n\n>>> from heapq import heapify, heappop, heappush\n>>> data = [1, 3, 5, 7, 9, 2, 4, 6, 8, 0]\n>>> heapify(data)                      # rearrange the list into heap order\n>>> heappush(data, -5)                 # add a new entry\n>>> [heappop(data) for i in range(3)]  # fetch the three smallest entries\n[-5, 0, 1]\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Decimal Floating Point Arithmetic,  Prev: Tools for Working with Lists,  Up: Brief Tour of the Standard Library -- Part II": {
            "content": "The *note decimal: 33. module offers a *note Decimal: 5c3. datatype for\ndecimal floating point arithmetic.  Compared to the built-in *note\nfloat: 4b7. implementation of binary floating point, the class is\nespecially helpful for\n\n* financial applications and other uses which require exact decimal\nrepresentation,\n\n* control over precision,\n\n* control over rounding to meet legal or regulatory requirements,\n\n* tracking of significant decimal places, or\n\n* applications where the user expects the results to match\ncalculations done by hand.\n\nFor example, calculating a 5% tax on a 70 cent phone charge gives\ndifferent results in decimal floating point and binary floating point.",
            "subsections": []
        },
        "The difference becomes significant if the results are rounded to the": {
            "content": "nearest cent:\n\n>>> from decimal import *\n>>> round(Decimal('0.70') * Decimal('1.05'), 2)\nDecimal('0.74')\n>>> round(.70 * 1.05, 2)\n0.73\n\nThe *note Decimal: 5c3. result keeps a trailing zero, automatically\ninferring four place significance from multiplicands with two place\nsignificance.  Decimal reproduces mathematics as done by hand and avoids\nissues that can arise when binary floating point cannot exactly\nrepresent decimal quantities.\n\nExact representation enables the *note Decimal: 5c3. class to perform\nmodulo calculations and equality tests that are unsuitable for binary\nfloating point:\n\n>>> Decimal('1.00') % Decimal('.10')\nDecimal('0.00')\n>>> 1.00 % 0.10\n0.09999999999999995\n\n>>> sum([Decimal('0.1')]*10) == Decimal('1.0')\nTrue\n>>> 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 == 1.0\nFalse\n\nThe *note decimal: 33. module provides arithmetic with as much precision\nas needed:\n\n>>> getcontext().prec = 36\n>>> Decimal(1) / Decimal(7)\nDecimal('0.142857142857142857142857142857142857')\n\nFile: python3.12.info,  Node: Virtual Environments and Packages,  Next: What Now?,  Prev: Brief Tour of the Standard Library -- Part II,  Up: The Python Tutorial\n",
            "subsections": [
                {
                    "name": "2.12 Virtual Environments and Packages",
                    "content": "* Menu:\n\n* Introduction: Introduction<4>.\n* Creating Virtual Environments::\n* Managing Packages with pip::\n\nFile: python3.12.info,  Node: Introduction<4>,  Next: Creating Virtual Environments,  Up: Virtual Environments and Packages\n\n"
                }
            ]
        },
        "Python applications will often use packages and modules that don't come": {
            "content": "as part of the standard library.  Applications will sometimes need a\nspecific version of a library, because the application may require that\na particular bug has been fixed or the application may be written using\nan obsolete version of the library's interface.\n",
            "subsections": []
        },
        "This means it may not be possible for one Python installation to meet": {
            "content": "the requirements of every application.  If application A needs version\n1.0 of a particular module but application B needs version 2.0, then the\nrequirements are in conflict and installing either version 1.0 or 2.0\nwill leave one application unable to run.\n\nThe solution for this problem is to create a *note virtual environment:\n1a85, a self-contained directory tree that contains a Python\ninstallation for a particular version of Python, plus a number of\nadditional packages.\n",
            "subsections": []
        },
        "Different applications can then use different virtual environments.  To": {
            "content": "resolve the earlier example of conflicting requirements, application A\ncan have its own virtual environment with version 1.0 installed while\napplication B has another virtual environment with version 2.0.  If\napplication B requires a library be upgraded to version 3.0, this will\nnot affect application A's environment.\n\nFile: python3.12.info,  Node: Creating Virtual Environments,  Next: Managing Packages with pip,  Prev: Introduction<4>,  Up: Virtual Environments and Packages\n\n",
            "subsections": []
        },
        "The module used to create and manage virtual environments is called": {
            "content": "*note venv: 10c.  *note venv: 10c. will usually install the most recent\nversion of Python that you have available.  If you have multiple\nversions of Python on your system, you can select a specific Python\nversion by running 'python3' or whichever version you want.\n",
            "subsections": []
        },
        "To create a virtual environment, decide upon a directory where you want": {
            "content": "to place it, and run the *note venv: 10c. module as a script with the\ndirectory path:\n\npython -m venv tutorial-env\n",
            "subsections": []
        },
        "This will create the 'tutorial-env' directory if it doesn't exist, and": {
            "content": "also create directories inside it containing a copy of the Python\ninterpreter and various supporting files.\n\nA common directory location for a virtual environment is '.venv'.  This\nname keeps the directory typically hidden in your shell and thus out of\nthe way while giving it a name that explains why the directory exists.",
            "subsections": []
        },
        "It also prevents clashing with '.env' environment variable definition": {
            "content": "files that some tooling supports.\n\nOnce you've created a virtual environment, you may activate it.\n\nOn Windows, run:\n\ntutorial-env\\Scripts\\activate\n\nOn Unix or MacOS, run:\n\nsource tutorial-env/bin/activate\n\n(This script is written for the bash shell.  If you use the 'csh' or\n'fish' shells, there are alternate 'activate.csh' and 'activate.fish'\nscripts you should use instead.)\n",
            "subsections": []
        },
        "Activating the virtual environment will change your shell's prompt to": {
            "content": "show what virtual environment you're using, and modify the environment\nso that running 'python' will get you that particular version and\ninstallation of Python.  For example:\n\n$ source ~/envs/tutorial-env/bin/activate\n(tutorial-env) $ python\nPython 3.5.1 (default, May  6 2016, 10:59:36)\n...\n>>> import sys\n>>> sys.path\n['', '/usr/local/lib/python35.zip', ...,\n'~/envs/tutorial-env/lib/python3.5/site-packages']\n>>>\n\nTo deactivate a virtual environment, type:\n\ndeactivate\n\ninto the terminal.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Managing Packages with pip,  Prev: Creating Virtual Environments,  Up: Virtual Environments and Packages": {
            "content": "",
            "subsections": []
        },
        "You can install, upgrade, and remove packages using a program called": {
            "content": "'pip'.  By default 'pip' will install packages from the Python Package",
            "subsections": []
        },
        "Index(1).  You can browse the Python Package Index by going to it in": {
            "content": "your web browser.\n\n'pip' has a number of subcommands: \"install\", \"uninstall\", \"freeze\",\netc.  (Consult the *note Installing Python Modules: d5c. guide for\ncomplete documentation for 'pip'.)\n",
            "subsections": []
        },
        "You can install the latest version of a package by specifying a": {
            "content": "package's name:\n\n(tutorial-env) $ python -m pip install novas\nCollecting novas\nDownloading novas-3.1.1.3.tar.gz (136kB)\nInstalling collected packages: novas\nRunning setup.py install for novas\nSuccessfully installed novas-3.1.1.3\n",
            "subsections": []
        },
        "You can also install a specific version of a package by giving the": {
            "content": "package name followed by '==' and the version number:\n\n(tutorial-env) $ python -m pip install requests==2.6.0\nCollecting requests==2.6.0\nUsing cached requests-2.6.0-py2.py3-none-any.whl\nInstalling collected packages: requests\nSuccessfully installed requests-2.6.0\n",
            "subsections": []
        },
        "If you re-run this command, 'pip' will notice that the requested version": {
            "content": "is already installed and do nothing.  You can supply a different version\nnumber to get that version, or you can run 'python -m pip install\n--upgrade' to upgrade the package to the latest version:\n\n(tutorial-env) $ python -m pip install --upgrade requests\nCollecting requests\nInstalling collected packages: requests\nFound existing installation: requests 2.6.0\nUninstalling requests-2.6.0:\nSuccessfully uninstalled requests-2.6.0\nSuccessfully installed requests-2.7.0\n\n'python -m pip uninstall' followed by one or more package names will\nremove the packages from the virtual environment.\n\n'python -m pip show' will display information about a particular\npackage:\n\nMetadata-Version: 2.0\nName: requests\nVersion: 2.7.0\nSummary: Python HTTP for Humans.\nHome-page: http://python-requests.org\nAuthor: Kenneth Reitz\nAuthor-email: me@kennethreitz.com\nLicense: Apache 2.0\nLocation: /Users/akuchling/envs/tutorial-env/lib/python3.4/site-packages\nRequires:\n\n'python -m pip list' will display all of the packages installed in the\nvirtual environment:\n\n(tutorial-env) $ python -m pip list\nnovas (3.1.1.3)\nnumpy (1.9.2)\npip (7.0.3)\nrequests (2.7.0)\nsetuptools (16.0)\n\n'python -m pip freeze' will produce a similar list of the installed\npackages, but the output uses the format that 'python -m pip install'\nexpects.  A common convention is to put this list in a\n'requirements.txt' file:\n\n(tutorial-env) $ python -m pip freeze > requirements.txt\n(tutorial-env) $ cat requirements.txt\nnovas==3.1.1.3\nnumpy==1.9.2\nrequests==2.7.0\n",
            "subsections": []
        },
        "The 'requirements.txt' can then be committed to version control and": {
            "content": "shipped as part of an application.  Users can then install all the\nnecessary packages with 'install -r':\n\n(tutorial-env) $ python -m pip install -r requirements.txt\nCollecting novas==3.1.1.3 (from -r requirements.txt (line 1))\n...\nCollecting numpy==1.9.2 (from -r requirements.txt (line 2))\n...\nCollecting requests==2.7.0 (from -r requirements.txt (line 3))\n...\nInstalling collected packages: novas, numpy, requests\nRunning setup.py install for novas\nSuccessfully installed novas-3.1.1.3 numpy-1.9.2 requests-2.7.0\n\n'pip' has many more options.  Consult the *note Installing Python",
            "subsections": []
        },
        "Modules: d5c. guide for complete documentation for 'pip'.  When you've": {
            "content": "written a package and want to make it available on the Python Package\nIndex, consult the Python packaging user guide(2).\n\n---------- Footnotes ----------\n\n(1) https://pypi.org\n\n(2)\nhttps://packaging.python.org/en/latest/tutorials/packaging-projects/\n\nFile: python3.12.info,  Node: What Now?,  Next: Interactive Input Editing and History Substitution,  Prev: Virtual Environments and Packages,  Up: The Python Tutorial\n",
            "subsections": [
                {
                    "name": "2.13 What Now?",
                    "content": ""
                }
            ]
        },
        "Reading this tutorial has probably reinforced your interest in using": {
            "content": "",
            "subsections": []
        },
        "Python -- you should be eager to apply Python to solving your real-world": {
            "content": "problems.  Where should you go to learn more?\n",
            "subsections": []
        },
        "This tutorial is part of Python's documentation set.  Some other": {
            "content": "documents in the set are:\n\n* *note The Python Standard Library: 13d.:\n\nYou should browse through this manual, which gives complete (though\nterse) reference material about types, functions, and the modules\nin the standard library.  The standard Python distribution includes\na 'lot' of additional code.  There are modules to read Unix\nmailboxes, retrieve documents via HTTP, generate random numbers,\nparse command-line options, compress data, and many other tasks.\nSkimming through the Library Reference will give you an idea of\nwhat's available.\n\n* *note Installing Python Modules: d5c. explains how to install\nadditional modules written by other Python users.\n\n* *note The Python Language Reference: 13e.: A detailed explanation\nof Python's syntax and semantics.  It's heavy reading, but is\nuseful as a complete guide to the language itself.\n\nMore Python resources:\n\n* 'https://www.python.org': The major Python web site.  It contains\ncode, documentation, and pointers to Python-related pages around\nthe web.\n\n* 'https://docs.python.org': Fast access to Python's documentation.\n\n* 'https://pypi.org': The Python Package Index, previously also\nnicknamed the Cheese Shop (1), is an index of user-created Python\nmodules that are available for download.  Once you begin releasing\ncode, you can register it here so that others can find it.\n\n* 'https://code.activestate.com/recipes/langs/python/': The Python\nCookbook is a sizable collection of code examples, larger modules,\nand useful scripts.  Particularly notable contributions are\ncollected in a book also titled Python Cookbook (O'Reilly &\nAssociates, ISBN 0-596-00797-3.)\n\n* 'https://pyvideo.org' collects links to Python-related videos from\nconferences and user-group meetings.\n\n* 'https://scipy.org': The Scientific Python project includes modules\nfor fast array computations and manipulations plus a host of\npackages for such things as linear algebra, Fourier transforms,\nnon-linear solvers, random number distributions, statistical\nanalysis and the like.\n",
            "subsections": []
        },
        "For Python-related questions and problem reports, you can post to the": {
            "content": "newsgroup 'comp.lang.python', or send them to the mailing list at\n<python-list@python.org>.  The newsgroup and mailing list are gatewayed,\nso messages posted to one will automatically be forwarded to the other.",
            "subsections": []
        },
        "There are hundreds of postings a day, asking (and answering) questions,": {
            "content": "suggesting new features, and announcing new modules.  Mailing list\narchives are available at 'https://mail.python.org/pipermail/'.\n\nBefore posting, be sure to check the list of *note Frequently Asked",
            "subsections": []
        },
        "Questions: 1a8b. (also called the FAQ). The FAQ answers many of the": {
            "content": "questions that come up again and again, and may already contain the\nsolution for your problem.\n\n---------- Footnotes ----------\n\n(1) \"Cheese Shop\" is a Monty Python's sketch: a customer enters a\ncheese shop, but whatever cheese he asks for, the clerk says it's\nmissing.\n\nFile: python3.12.info,  Node: Interactive Input Editing and History Substitution,  Next: Floating Point Arithmetic Issues and Limitations,  Prev: What Now?,  Up: The Python Tutorial\n",
            "subsections": [
                {
                    "name": "2.14 Interactive Input Editing and History Substitution",
                    "content": ""
                }
            ]
        },
        "Some versions of the Python interpreter support editing of the current": {
            "content": "input line and history substitution, similar to facilities found in the",
            "subsections": []
        },
        "Korn shell and the GNU Bash shell.  This is implemented using the GNU": {
            "content": "",
            "subsections": []
        },
        "Readline(1) library, which supports various styles of editing.  This": {
            "content": "library has its own documentation which we won't duplicate here.\n\n* Menu:\n\n* Tab Completion and History Editing::\n* Alternatives to the Interactive Interpreter::\n\n---------- Footnotes ----------\n\n(1) https://tiswww.case.edu/php/chet/readline/rltop.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Tab Completion and History Editing,  Next: Alternatives to the Interactive Interpreter,  Up: Interactive Input Editing and History Substitution": {
            "content": "Completion of variable and module names is *note automatically enabled:\ne3c. at interpreter startup so that the 'Tab' key invokes the completion\nfunction; it looks at Python statement names, the current local\nvariables, and the available module names.  For dotted expressions such\nas 'string.a', it will evaluate the expression up to the final ''.'' and\nthen suggest completions from the attributes of the resulting object.",
            "subsections": []
        },
        "Note that this may execute application-defined code if an object with a": {
            "content": "*note getattr(): 1f8. method is part of the expression.  The default\nconfiguration also saves your history into a file named\n'.pythonhistory' in your user directory.  The history will be available\nagain during the next interactive interpreter session.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Alternatives to the Interactive Interpreter,  Prev: Tab Completion and History Editing,  Up: Interactive Input Editing and History Substitution": {
            "content": "",
            "subsections": []
        },
        "This facility is an enormous step forward compared to earlier versions": {
            "content": "of the interpreter; however, some wishes are left: It would be nice if\nthe proper indentation were suggested on continuation lines (the parser\nknows if an indent token is required next).  The completion mechanism\nmight use the interpreter's symbol table.  A command to check (or even\nsuggest) matching parentheses, quotes, etc., would also be useful.\n",
            "subsections": []
        },
        "One alternative enhanced interactive interpreter that has been around": {
            "content": "for quite some time is IPython(1), which features tab completion, object\nexploration and advanced history management.  It can also be thoroughly\ncustomized and embedded into other applications.  Another similar\nenhanced interactive environment is bpython(2).\n\n---------- Footnotes ----------\n\n(1) https://ipython.org/\n\n(2) https://bpython-interpreter.org/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Floating Point Arithmetic Issues and Limitations,  Next: Appendix,  Prev: Interactive Input Editing and History Substitution,  Up: The Python Tutorial": {
            "content": "",
            "subsections": [
                {
                    "name": "2.15 Floating Point Arithmetic: Issues and Limitations",
                    "content": ""
                }
            ]
        },
        "Floating-point numbers are represented in computer hardware as base 2": {
            "content": "(binary) fractions.  For example, the 'decimal' fraction '0.625' has\nvalue 6/10 + 2/100 + 5/1000, and in the same way the 'binary' fraction\n'0.101' has value 1/2 + 0/4 + 1/8.  These two fractions have identical\nvalues, the only real difference being that the first is written in base\n10 fractional notation, and the second in base 2.\n",
            "subsections": []
        },
        "Unfortunately, most decimal fractions cannot be represented exactly as": {
            "content": "binary fractions.  A consequence is that, in general, the decimal\nfloating-point numbers you enter are only approximated by the binary\nfloating-point numbers actually stored in the machine.\n",
            "subsections": []
        },
        "The problem is easier to understand at first in base 10.  Consider the": {
            "content": "fraction 1/3.  You can approximate that as a base 10 fraction:\n\n0.3\n\nor, better,\n\n0.33\n\nor, better,\n\n0.333\n\nand so on.  No matter how many digits you're willing to write down, the\nresult will never be exactly 1/3, but will be an increasingly better\napproximation of 1/3.\n",
            "subsections": []
        },
        "In the same way, no matter how many base 2 digits you're willing to use,": {
            "content": "the decimal value 0.1 cannot be represented exactly as a base 2\nfraction.  In base 2, 1/10 is the infinitely repeating fraction\n\n0.0001100110011001100110011001100110011001100110011...\n",
            "subsections": []
        },
        "Stop at any finite number of bits, and you get an approximation.  On": {
            "content": "most machines today, floats are approximated using a binary fraction\nwith the numerator using the first 53 bits starting with the most\nsignificant bit and with the denominator as a power of two.  In the case\nof 1/10, the binary fraction is '3602879701896397 / 2  55' which is\nclose to but not exactly equal to the true value of 1/10.\n",
            "subsections": []
        },
        "Many users are not aware of the approximation because of the way values": {
            "content": "are displayed.  Python only prints a decimal approximation to the true\ndecimal value of the binary approximation stored by the machine.  On\nmost machines, if Python were to print the true decimal value of the\nbinary approximation stored for 0.1, it would have to display:\n\n>>> 0.1\n0.1000000000000000055511151231257827021181583404541015625\n",
            "subsections": []
        },
        "That is more digits than most people find useful, so Python keeps the": {
            "content": "number of digits manageable by displaying a rounded value instead:\n\n>>> 1 / 10\n0.1\n",
            "subsections": []
        },
        "Just remember, even though the printed result looks like the exact value": {
            "content": "of 1/10, the actual stored value is the nearest representable binary\nfraction.\n",
            "subsections": []
        },
        "Interestingly, there are many different decimal numbers that share the": {
            "content": "same nearest approximate binary fraction.  For example, the numbers\n'0.1' and '0.10000000000000001' and\n'0.1000000000000000055511151231257827021181583404541015625' are all\napproximated by '3602879701896397 / 2  55'.  Since all of these\ndecimal values share the same approximation, any one of them could be\ndisplayed while still preserving the invariant 'eval(repr(x)) == x'.\n\nHistorically, the Python prompt and built-in *note repr(): 5f0. function\nwould choose the one with 17 significant digits, '0.10000000000000001'.",
            "subsections": []
        },
        "Starting with Python 3.1, Python (on most systems) is now able to choose": {
            "content": "the shortest of these and simply display '0.1'.\n",
            "subsections": []
        },
        "Note that this is in the very nature of binary floating-point: this is": {
            "content": "not a bug in Python, and it is not a bug in your code either.  You'll\nsee the same kind of thing in all languages that support your hardware's\nfloating-point arithmetic (although some languages may not 'display' the\ndifference by default, or in all output modes).\n",
            "subsections": []
        },
        "For more pleasant output, you may wish to use string formatting to": {
            "content": "produce a limited number of significant digits:\n\n>>> format(math.pi, '.12g')  # give 12 significant digits\n'3.14159265359'\n\n>>> format(math.pi, '.2f')   # give 2 digits after the point\n'3.14'\n\n>>> repr(math.pi)\n'3.141592653589793'\n\nIt's important to realize that this is, in a real sense, an illusion:\nyou're simply rounding the 'display' of the true machine value.\n",
            "subsections": []
        },
        "One illusion may beget another.  For example, since 0.1 is not exactly": {
            "content": "1/10, summing three values of 0.1 may not yield exactly 0.3, either:\n\n>>> 0.1 + 0.1 + 0.1 == 0.3\nFalse\n",
            "subsections": []
        },
        "Also, since the 0.1 cannot get any closer to the exact value of 1/10 and": {
            "content": "0.3 cannot get any closer to the exact value of 3/10, then pre-rounding\nwith *note round(): 114f. function cannot help:\n\n>>> round(0.1, 1) + round(0.1, 1) + round(0.1, 1) == round(0.3, 1)\nFalse\n",
            "subsections": []
        },
        "Though the numbers cannot be made closer to their intended exact values,": {
            "content": "the *note math.isclose(): c0c. function can be useful for comparing\ninexact values:\n\n>>> math.isclose(0.1 + 0.1 + 0.1, 0.3)\nTrue\n\nAlternatively, the *note round(): 114f. function can be used to compare\nrough approximations:\n\n>>> round(math.pi, ndigits=2) == round(22 / 7, ndigits=2)\nTrue\n",
            "subsections": []
        },
        "Binary floating-point arithmetic holds many surprises like this.  The": {
            "content": "problem with \"0.1\" is explained in precise detail below, in the\n\"Representation Error\" section.  See Examples of Floating Point",
            "subsections": []
        },
        "Problems(1) for a pleasant summary of how binary floating-point works": {
            "content": "and the kinds of problems commonly encountered in practice.  Also see",
            "subsections": []
        },
        "The Perils of Floating Point(2) for a more complete account of other": {
            "content": "common surprises.\n\nAs that says near the end, \"there are no easy answers.\" Still, don't be\nunduly wary of floating-point!  The errors in Python float operations\nare inherited from the floating-point hardware, and on most machines are\non the order of no more than 1 part in 253 per operation.  That's more\nthan adequate for most tasks, but you do need to keep in mind that it's\nnot decimal arithmetic and that every float operation can suffer a new\nrounding error.\n",
            "subsections": []
        },
        "While pathological cases do exist, for most casual use of floating-point": {
            "content": "arithmetic you'll see the result you expect in the end if you simply\nround the display of your final results to the number of decimal digits\nyou expect.  *note str(): 157. usually suffices, and for finer control\nsee the *note str.format(): 3ed. method's format specifiers in *note\nFormat String Syntax: 1205.\n",
            "subsections": []
        },
        "For use cases which require exact decimal representation, try using the": {
            "content": "*note decimal: 33. module which implements decimal arithmetic suitable\nfor accounting applications and high-precision applications.\n\nAnother form of exact arithmetic is supported by the *note fractions:\n58. module which implements arithmetic based on rational numbers (so the\nnumbers like 1/3 can be represented exactly).\n",
            "subsections": []
        },
        "If you are a heavy user of floating-point operations you should take a": {
            "content": "look at the NumPy package and many other packages for mathematical and\nstatistical operations supplied by the SciPy project.  See\n<'https://scipy.org'>.\n",
            "subsections": []
        },
        "Python provides tools that may help on those rare occasions when you": {
            "content": "really 'do' want to know the exact value of a float.  The *note\nfloat.asintegerratio(): 1a95. method expresses the value of a float as\na fraction:\n\n>>> x = 3.14159\n>>> x.asintegerratio()\n(3537115888337719, 1125899906842624)\n",
            "subsections": []
        },
        "Since the ratio is exact, it can be used to losslessly recreate the": {
            "content": "original value:\n\n>>> x == 3537115888337719 / 1125899906842624\nTrue\n\nThe *note float.hex(): 1a96. method expresses a float in hexadecimal\n(base 16), again giving the exact value stored by your computer:\n\n>>> x.hex()\n'0x1.921f9f01b866ep+1'\n",
            "subsections": []
        },
        "This precise hexadecimal representation can be used to reconstruct the": {
            "content": "float value exactly:\n\n>>> x == float.fromhex('0x1.921f9f01b866ep+1')\nTrue\n",
            "subsections": []
        },
        "Since the representation is exact, it is useful for reliably porting": {
            "content": "values across different versions of Python (platform independence) and\nexchanging data with other languages that support the same format (such\nas Java and C99).\n\nAnother helpful tool is the *note sum(): 181. function which helps\nmitigate loss-of-precision during summation.  It uses extended precision\nfor intermediate rounding steps as values are added onto a running\ntotal.  That can make a difference in overall accuracy so that the\nerrors do not accumulate to the point where they affect the final total:\n\n>>> 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 == 1.0\nFalse\n>>> sum([0.1] * 10) == 1.0\nTrue\n\nThe *note math.fsum(): 1229. goes further and tracks all of the \"lost\ndigits\" as values are added onto a running total so that the result has\nonly a single rounding.  This is slower than *note sum(): 181. but will\nbe more accurate in uncommon cases where large magnitude inputs mostly\ncancel each other out leaving a final sum near zero:\n\n>>> arr = [-0.10430216751806065, -266310978.67179024, 143401161448607.16,\n...        -143401161400469.7, 266262841.31058735, -0.003244936839808227]\n>>> float(sum(map(Fraction, arr)))   # Exact summation with single rounding\n8.042173697819788e-13\n>>> math.fsum(arr)                   # Single rounding\n8.042173697819788e-13\n>>> sum(arr)                         # Multiple roundings in extended precision\n8.042178034628478e-13\n>>> total = 0.0\n>>> for x in arr:\n...     total += x                   # Multiple roundings in standard precision\n...\n>>> total                            # Straight addition has no correct digits!\n-0.0051575902860057365\n\n* Menu:\n\n* Representation Error::\n\n---------- Footnotes ----------\n\n(1)\nhttps://jvns.ca/blog/2023/01/13/examples-of-floating-point-problems/\n\n(2) http://www.indowsway.com/floatingpoint.htm\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Representation Error,  Up: Floating Point Arithmetic Issues and Limitations": {
            "content": "This section explains the \"0.1\" example in detail, and shows how you can\nperform an exact analysis of cases like this yourself.  Basic\nfamiliarity with binary floating-point representation is assumed.\n\n'Representation error' refers to the fact that some (most, actually)\ndecimal fractions cannot be represented exactly as binary (base 2)\nfractions.  This is the chief reason why Python (or Perl, C, C++, Java,",
            "subsections": []
        },
        "Fortran, and many others) often won't display the exact decimal number": {
            "content": "you expect.\n\nWhy is that?  1/10 is not exactly representable as a binary fraction.",
            "subsections": []
        },
        "Since at least 2000, almost all machines use IEEE 754 binary": {
            "content": "floating-point arithmetic, and almost all platforms map Python floats to\nIEEE 754 binary64 \"double precision\" values.  IEEE 754 binary64 values\ncontain 53 bits of precision, so on input the computer strives to\nconvert 0.1 to the closest fraction it can of the form 'J'/2'N' where\n'J' is an integer containing exactly 53 bits.  Rewriting\n\n1 / 10 ~= J / (2N)\n\nas\n\nJ ~= 2N / 10\n\nand recalling that 'J' has exactly 53 bits (is '>= 252' but '<\n253'), the best value for 'N' is 56:\n\n>>> 252 <=  256 // 10  < 253\nTrue\n",
            "subsections": []
        },
        "That is, 56 is the only value for 'N' that leaves 'J' with exactly 53": {
            "content": "bits.  The best possible value for 'J' is then that quotient rounded:\n\n>>> q, r = divmod(256, 10)\n>>> r\n6\n",
            "subsections": []
        },
        "Since the remainder is more than half of 10, the best approximation is": {
            "content": "obtained by rounding up:\n\n>>> q+1\n7205759403792794\n",
            "subsections": []
        },
        "Therefore the best possible approximation to 1/10 in IEEE 754 double": {
            "content": "precision is:\n\n7205759403792794 / 2  56\n",
            "subsections": []
        },
        "Dividing both the numerator and denominator by two reduces the fraction": {
            "content": "to:\n\n3602879701896397 / 2  55\n",
            "subsections": []
        },
        "Note that since we rounded up, this is actually a little bit larger than": {
            "content": "1/10; if we had not rounded up, the quotient would have been a little\nbit smaller than 1/10.  But in no case can it be 'exactly' 1/10!\n\nSo the computer never \"sees\" 1/10: what it sees is the exact fraction\ngiven above, the best IEEE 754 double approximation it can get:\n\n>>> 0.1 * 2  55\n3602879701896397.0\n",
            "subsections": []
        },
        "If we multiply that fraction by 1055, we can see the value out to 55": {
            "content": "decimal digits:\n\n>>> 3602879701896397 * 10  55 // 2  55\n1000000000000000055511151231257827021181583404541015625\n\nmeaning that the exact number stored in the computer is equal to the\ndecimal value 0.1000000000000000055511151231257827021181583404541015625.",
            "subsections": []
        },
        "Instead of displaying the full decimal value, many languages (including": {
            "content": "older versions of Python), round the result to 17 significant digits:\n\n>>> format(0.1, '.17f')\n'0.10000000000000001'\n\nThe *note fractions: 58. and *note decimal: 33. modules make these\ncalculations easy:\n\n>>> from decimal import Decimal\n>>> from fractions import Fraction\n\n>>> Fraction.fromfloat(0.1)\nFraction(3602879701896397, 36028797018963968)\n\n>>> (0.1).asintegerratio()\n(3602879701896397, 36028797018963968)\n\n>>> Decimal.fromfloat(0.1)\nDecimal('0.1000000000000000055511151231257827021181583404541015625')\n\n>>> format(Decimal.fromfloat(0.1), '.17')\n'0.10000000000000001'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Appendix,  Prev: Floating Point Arithmetic Issues and Limitations,  Up: The Python Tutorial": {
            "content": "",
            "subsections": [
                {
                    "name": "2.16 Appendix",
                    "content": "* Menu:\n\n* Interactive Mode: Interactive Mode<2>.\n\nFile: python3.12.info,  Node: Interactive Mode<2>,  Up: Appendix\n\n\n* Menu:\n\n* Error Handling::\n* Executable Python Scripts::\n* The Interactive Startup File::\n* The Customization Modules::\n\nFile: python3.12.info,  Node: Error Handling,  Next: Executable Python Scripts,  Up: Interactive Mode<2>\n\n2.16.1.1 Error Handling\n.......................\n"
                }
            ]
        },
        "When an error occurs, the interpreter prints an error message and a": {
            "content": "stack trace.  In interactive mode, it then returns to the primary\nprompt; when input came from a file, it exits with a nonzero exit status\nafter printing the stack trace.  (Exceptions handled by an *note except:\n379. clause in a *note try: 4bc. statement are not errors in this\ncontext.)  Some errors are unconditionally fatal and cause an exit with\na nonzero exit status; this applies to internal inconsistencies and some\ncases of running out of memory.  All error messages are written to the\nstandard error stream; normal output from executed commands is written\nto standard output.\n",
            "subsections": []
        },
        "Typing the interrupt character (usually 'Control-C' or 'Delete') to the": {
            "content": "primary or secondary prompt cancels the input and returns to the primary\nprompt.  (1)  Typing an interrupt while a command is executing raises\nthe *note KeyboardInterrupt: 7f5. exception, which may be handled by a\n*note try: 4bc. statement.\n\n---------- Footnotes ----------\n\n(1) A problem with the GNU Readline package may prevent this.\n\nFile: python3.12.info,  Node: Executable Python Scripts,  Next: The Interactive Startup File,  Prev: Error Handling,  Up: Interactive Mode<2>\n\n2.16.1.2 Executable Python Scripts\n..................................\n",
            "subsections": []
        },
        "On BSD'ish Unix systems, Python scripts can be made directly executable,": {
            "content": "like shell scripts, by putting the line\n\n#!/usr/bin/env python3.5\n\n(assuming that the interpreter is on the user's 'PATH') at the beginning\nof the script and giving the file an executable mode.  The '#!' must be\nthe first two characters of the file.  On some platforms, this first\nline must end with a Unix-style line ending (''\\n''), not a Windows\n(''\\r\\n'') line ending.  Note that the hash, or pound, character, ''#'',\nis used to start a comment in Python.\n",
            "subsections": []
        },
        "The script can be given an executable mode, or permission, using the": {
            "content": "'chmod' command.\n\n$ chmod +x myscript.py\n\nOn Windows systems, there is no notion of an \"executable mode\".  The",
            "subsections": []
        },
        "Python installer automatically associates '.py' files with 'python.exe'": {
            "content": "so that a double-click on a Python file will run it as a script.  The\nextension can also be '.pyw', in that case, the console window that\nnormally appears is suppressed.\n\nFile: python3.12.info,  Node: The Interactive Startup File,  Next: The Customization Modules,  Prev: Executable Python Scripts,  Up: Interactive Mode<2>\n\n2.16.1.3 The Interactive Startup File\n.....................................\n",
            "subsections": []
        },
        "When you use Python interactively, it is frequently handy to have some": {
            "content": "standard commands executed every time the interpreter is started.  You\ncan do this by setting an environment variable named *note\nPYTHONSTARTUP: e3b. to the name of a file containing your start-up\ncommands.  This is similar to the '.profile' feature of the Unix shells.\n",
            "subsections": []
        },
        "This file is only read in interactive sessions, not when Python reads": {
            "content": "commands from a script, and not when '/dev/tty' is given as the explicit\nsource of commands (which otherwise behaves like an interactive\nsession).  It is executed in the same namespace where interactive\ncommands are executed, so that objects that it defines or imports can be\nused without qualification in the interactive session.  You can also\nchange the prompts 'sys.ps1' and 'sys.ps2' in this file.\n",
            "subsections": []
        },
        "If you want to read an additional start-up file from the current": {
            "content": "directory, you can program this in the global start-up file using code\nlike 'if os.path.isfile('.pythonrc.py'):\nexec(open('.pythonrc.py').read())'.  If you want to use the startup file\nin a script, you must do this explicitly in the script:\n\nimport os\nfilename = os.environ.get('PYTHONSTARTUP')\nif filename and os.path.isfile(filename):\nwith open(filename) as fobj:\nstartupfile = fobj.read()\nexec(startupfile)\n\nFile: python3.12.info,  Node: The Customization Modules,  Prev: The Interactive Startup File,  Up: Interactive Mode<2>\n\n2.16.1.4 The Customization Modules\n..................................\n",
            "subsections": []
        },
        "Python provides two hooks to let you customize it: sitecustomize and": {
            "content": "usercustomize.  To see how it works, you need first to find the location\nof your user site-packages directory.  Start Python and run this code:\n\n>>> import site\n>>> site.getusersitepackages()\n'/home/user/.local/lib/python3.5/site-packages'\n",
            "subsections": []
        },
        "Now you can create a file named 'usercustomize.py' in that directory and": {
            "content": "put anything you want in it.  It will affect every invocation of Python,\nunless it is started with the *note -s: 1200. option to disable the\nautomatic import.\n\nsitecustomize works in the same way, but is typically created by an\nadministrator of the computer in the global site-packages directory, and\nis imported before usercustomize.  See the documentation of the *note\nsite: c2. module for more details.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python Setup and Usage,  Next: The Python Language Reference,  Prev: The Python Tutorial,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "3 Python Setup and Usage": {
            "content": "",
            "subsections": []
        },
        "This part of the documentation is devoted to general information on the": {
            "content": "setup of the Python environment on different platforms, the invocation\nof the interpreter and things that make working with Python easier.\n\n* Menu:\n\n* Command line and environment::\n* Using Python on Unix platforms::\n* Configure Python::\n* Using Python on Windows::\n* Using Python on a Mac::\n* Editors and IDEs::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Command line and environment,  Next: Using Python on Unix platforms,  Up: Python Setup and Usage": {
            "content": "",
            "subsections": [
                {
                    "name": "3.1 Command line and environment",
                    "content": ""
                }
            ]
        },
        "The CPython interpreter scans the command line and the environment for": {
            "content": "various settings.\n\n'CPython implementation detail:' Other implementations' command line\nschemes may differ.  See *note Alternate Implementations: 1aa9. for\nfurther resources.\n\n* Menu:\n\n* Command line::\n* Environment variables::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Command line,  Next: Environment variables,  Up: Command line and environment": {
            "content": "When invoking Python, you may specify any of these options:\n\npython [-bBdEhiIOqsSuvVWx?] [-c command | -m module-name | script | - ] [args]\n\nThe most common use case is, of course, a simple invocation of a script:\n\npython myscript.py\n\n* Menu:\n\n* Interface options::\n* Generic options::\n* Miscellaneous options::\n* Options you shouldn't use::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Interface options,  Next: Generic options,  Up: Command line": {
            "content": "3.1.1.1 Interface options\n.........................\n",
            "subsections": []
        },
        "The interpreter interface resembles that of the UNIX shell, but provides": {
            "content": "some additional methods of invocation:\n\n* When called with standard input connected to a tty device, it\nprompts for commands and executes them until an EOF (an end-of-file\ncharacter, you can produce that with 'Ctrl-D' on UNIX or 'Ctrl-Z,\nEnter' on Windows) is read.\n\n* When called with a file name argument or with a file as standard\ninput, it reads and executes a script from that file.\n\n* When called with a directory name argument, it reads and executes\nan appropriately named script from that directory.\n\n* When called with '-c command', it executes the Python statement(s)\ngiven as 'command'.  Here 'command' may contain multiple statements\nseparated by newlines.  Leading whitespace is significant in Python\nstatements!\n\n* When called with '-m module-name', the given module is located on\nthe Python module path and executed as a script.\n",
            "subsections": []
        },
        "In non-interactive mode, the entire input is parsed before it is": {
            "content": "executed.\n",
            "subsections": []
        },
        "An interface option terminates the list of options consumed by the": {
            "content": "interpreter, all consecutive arguments will end up in *note sys.argv:\n10dd. - note that the first element, subscript zero ('sys.argv[0]'), is\na string reflecting the program's source.\n\n-- Option: -c <command>\n\nExecute the Python code in 'command'.  'command' can be one or more\nstatements separated by newlines, with significant leading\nwhitespace as in normal module code.\n\nIf this option is given, the first element of *note sys.argv: 10dd.\nwill be '\"-c\"' and the current directory will be added to the start\nof *note sys.path: 32c. (allowing modules in that directory to be\nimported as top level modules).\n\nRaises an *note auditing event: 161d. 'cpython.runcommand' with\nargument 'command'.\n\n-- Option: -m <module-name>\n\nSearch *note sys.path: 32c. for the named module and execute its\ncontents as the *note main: 1. module.\n\nSince the argument is a 'module' name, you must not give a file\nextension ('.py').  The module name should be a valid absolute\nPython module name, but the implementation may not always enforce\nthis (e.g.  it may allow you to use a name that includes a hyphen).\n\nPackage names (including namespace packages) are also permitted.\nWhen a package name is supplied instead of a normal module, the\ninterpreter will execute '<pkg>.main' as the main module.  This\nbehaviour is deliberately similar to the handling of directories\nand zipfiles that are passed to the interpreter as the script\nargument.\n\nNote: This option cannot be used with built-in modules and\nextension modules written in C, since they do not have Python\nmodule files.  However, it can still be used for precompiled\nmodules, even if the original source file is not available.\n\nIf this option is given, the first element of *note sys.argv: 10dd.\nwill be the full path to the module file (while the module file is\nbeing located, the first element will be set to '\"-m\"').  As with\nthe *note -c: 3a4. option, the current directory will be added to\nthe start of *note sys.path: 32c.\n\n*note -I: 77f. option can be used to run the script in isolated\nmode where *note sys.path: 32c. contains neither the current\ndirectory nor the user's site-packages directory.  All 'PYTHON*'\nenvironment variables are ignored, too.\n\nMany standard library modules contain code that is invoked on their\nexecution as a script.  An example is the *note timeit: e9. module:\n\npython -m timeit -s \"setup here\" \"benchmarked code here\"\npython -m timeit -h # for details\n\nRaises an *note auditing event: 161d. 'cpython.runmodule' with\nargument 'module-name'.\n\nSee also\n........\n\n*note runpy.runmodule(): 156a.\n\nEquivalent functionality directly available to Python code\n\nPEP 338(1) - Executing modules as scripts\n\nChanged in version 3.1: Supply the package name to run a 'main'\nsubmodule.\n\nChanged in version 3.4: namespace packages are also supported\n\n-- Describe: -\n\nRead commands from standard input (*note sys.stdin: 293.).  If\nstandard input is a terminal, *note -i: 1336. is implied.\n\nIf this option is given, the first element of *note sys.argv: 10dd.\nwill be '\"-\"' and the current directory will be added to the start\nof *note sys.path: 32c.\n\nRaises an *note auditing event: 161d. 'cpython.runstdin' with no\narguments.\n\n-- Describe: <script>\n\nExecute the Python code contained in 'script', which must be a\nfilesystem path (absolute or relative) referring to either a Python\nfile, a directory containing a 'main.py' file, or a zipfile\ncontaining a 'main.py' file.\n\nIf this option is given, the first element of *note sys.argv: 10dd.\nwill be the script name as given on the command line.\n\nIf the script name refers directly to a Python file, the directory\ncontaining that file is added to the start of *note sys.path: 32c,\nand the file is executed as the *note main: 1. module.\n\nIf the script name refers to a directory or zipfile, the script\nname is added to the start of *note sys.path: 32c. and the\n'main.py' file in that location is executed as the *note\nmain: 1. module.\n\n*note -I: 77f. option can be used to run the script in isolated\nmode where *note sys.path: 32c. contains neither the script's\ndirectory nor the user's site-packages directory.  All 'PYTHON*'\nenvironment variables are ignored, too.\n\nRaises an *note auditing event: 161d. 'cpython.runfile' with\nargument 'filename'.\n\nSee also\n........\n\n*note runpy.runpath(): 1193.\n\nEquivalent functionality directly available to Python code\n\nIf no interface option is given, *note -i: 1336. is implied,\n'sys.argv[0]' is an empty string ('\"\"') and the current directory will\nbe added to the start of *note sys.path: 32c.  Also, tab-completion and\nhistory editing is automatically enabled, if available on your platform\n(see *note Readline configuration: e3c.).\n\nSee also\n........\n\n*note Invoking the Interpreter: 1968.\n",
            "subsections": []
        },
        "Changed in version 3.4: Automatic enabling of tab-completion and history": {
            "content": "editing.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0338/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Generic options,  Next: Miscellaneous options,  Prev: Interface options,  Up: Command line": {
            "content": "3.1.1.2 Generic options\n.......................\n\n-- Option: -?\n-- Option: -h\n-- Option: --help\n\nPrint a short description of all command line options and\ncorresponding environment variables and exit.\n\n-- Option: --help-env\n\nPrint a short description of Python-specific environment variables\nand exit.\n\nNew in version 3.11.\n\n-- Option: --help-xoptions\n\nPrint a description of implementation-specific *note -X: 188.\noptions and exit.\n\nNew in version 3.11.\n\n-- Option: --help-all\n\nPrint complete usage information and exit.\n\nNew in version 3.11.\n\n-- Option: -V\n-- Option: --version\n\nPrint the Python version number and exit.  Example output could be:\n\nPython 3.8.0b2+\n\nWhen given twice, print more information about the build, like:\n\nPython 3.8.0b2+ (3.8:0c076caaa8, Apr 20 2019, 21:55:00)\n[GCC 6.2.0 20161005]\n\nNew in version 3.6: The '-VV' option.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Miscellaneous options,  Next: Options you shouldn't use,  Prev: Generic options,  Up: Command line": {
            "content": "3.1.1.3 Miscellaneous options\n.............................\n\n-- Option: -b\n\nIssue a warning when converting *note bytes: 295. or *note\nbytearray: 294. to *note str: 157. without specifying encoding or\ncomparing 'bytes' or 'bytearray' with 'str' or 'bytes' with *note\nint: 17e.  Issue an error when the option is given twice ('-bb').\n\nChanged in version 3.5: Affects also comparisons of *note bytes:\n295. with *note int: 17e.\n\n-- Option: -B\n\nIf given, Python won't try to write '.pyc' files on the import of\nsource modules.  See also *note PYTHONDONTWRITEBYTECODE: 1223.\n\n-- Option: --check-hash-based-pycs default|always|never\n\nControl the validation behavior of hash-based '.pyc' files.  See\n*note Cached bytecode invalidation: 3b2.  When set to 'default',\nchecked and unchecked hash-based bytecode cache files are validated\naccording to their default semantics.  When set to 'always', all\nhash-based '.pyc' files, whether checked or unchecked, are\nvalidated against their corresponding source file.  When set to\n'never', hash-based '.pyc' files are not validated against their\ncorresponding source files.\n\nThe semantics of timestamp-based '.pyc' files are unaffected by\nthis option.\n\n-- Option: -d\n\nTurn on parser debugging output (for expert only).  See also the\n*note PYTHONDEBUG: 1ab5. environment variable.\n\nThis option requires a *note debug build of Python: 67f, otherwise\nit's ignored.\n\n-- Option: -E\n\nIgnore all 'PYTHON*' environment variables, e.g.  *note PYTHONPATH:\ne92. and *note PYTHONHOME: 334, that might be set.\n\nSee also the *note -P: 362. and *note -I: 77f. (isolated) options.\n\n-- Option: -i\n\nWhen a script is passed as first argument or the *note -c: 3a4.\noption is used, enter interactive mode after executing the script\nor the command, even when *note sys.stdin: 293. does not appear to\nbe a terminal.  The *note PYTHONSTARTUP: e3b. file is not read.\n\nThis can be useful to inspect global variables or a stack trace\nwhen a script raises an exception.  See also *note PYTHONINSPECT:\n1335.\n\n-- Option: -I\n\nRun Python in isolated mode.  This also implies *note -E: 77e,\n*note -P: 362. and *note -s: 1200. options.\n\nIn isolated mode *note sys.path: 32c. contains neither the script's\ndirectory nor the user's site-packages directory.  All 'PYTHON*'\nenvironment variables are ignored, too.  Further restrictions may\nbe imposed to prevent the user from injecting malicious code.\n\nNew in version 3.4.\n\n-- Option: -O\n\nRemove assert statements and any code conditional on the value of\n*note debug: 5ce.  Augment the filename for compiled (*note\nbytecode: 370.) files by adding '.opt-1' before the '.pyc'\nextension (see PEP 488(1)).  See also *note PYTHONOPTIMIZE: 1ab6.\n\nChanged in version 3.5: Modify '.pyc' filenames according to PEP\n488(2).\n\n-- Option: -OO\n\nDo *note -O: c11. and also discard docstrings.  Augment the\nfilename for compiled (*note bytecode: 370.) files by adding\n'.opt-2' before the '.pyc' extension (see PEP 488(3)).\n\nChanged in version 3.5: Modify '.pyc' filenames according to PEP\n488(4).\n\n-- Option: -P\n\nDon't prepend a potentially unsafe path to *note sys.path: 32c.:\n\n* 'python -m module' command line: Don't prepend the current\nworking directory.\n\n* 'python script.py' command line: Don't prepend the script's\ndirectory.  If it's a symbolic link, resolve symbolic links.\n\n* 'python -c code' and 'python' (REPL) command lines: Don't\nprepend an empty string, which means the current working\ndirectory.\n\nSee also the *note PYTHONSAFEPATH: 363. environment variable, and\n*note -E: 77e. and *note -I: 77f. (isolated) options.\n\nNew in version 3.11.\n\n-- Option: -q\n\nDon't display the copyright and version messages even in\ninteractive mode.\n\nNew in version 3.2.\n\n-- Option: -R\n\nTurn on hash randomization.  This option only has an effect if the\n*note PYTHONHASHSEED: ef4. environment variable is set to '0',\nsince hash randomization is enabled by default.\n\nOn previous versions of Python, this option turns on hash\nrandomization, so that the *note hash(): 932. values of str and\nbytes objects are \"salted\" with an unpredictable random value.\nAlthough they remain constant within an individual Python process,\nthey are not predictable between repeated invocations of Python.\n\nHash randomization is intended to provide protection against a\ndenial-of-service caused by carefully chosen inputs that exploit\nthe worst case performance of a dict construction, 'O'('n'^2)\ncomplexity.  See 'http://ocert.org/advisories/ocert-2011-003.html'\nfor details.\n\n*note PYTHONHASHSEED: ef4. allows you to set a fixed value for the\nhash seed secret.\n\nNew in version 3.2.3.\n\nChanged in version 3.7: The option is no longer ignored.\n\n-- Option: -s\n\nDon't add the *note user site-packages directory: 1ab8. to *note\nsys.path: 32c.\n\nSee also *note PYTHONNOUSERSITE: 1201.\n\nSee also\n........\n\nPEP 370(5) - Per user site-packages directory\n\n-- Option: -S\n\nDisable the import of the module *note site: c2. and the\nsite-dependent manipulations of *note sys.path: 32c. that it\nentails.  Also disable these manipulations if *note site: c2. is\nexplicitly imported later (call *note site.main(): 1ab9. if you\nwant them to be triggered).\n\n-- Option: -u\n\nForce the stdout and stderr streams to be unbuffered.  This option\nhas no effect on the stdin stream.\n\nSee also *note PYTHONUNBUFFERED: 1713.\n\nChanged in version 3.7: The text layer of the stdout and stderr\nstreams now is unbuffered.\n\n-- Option: -v\n\nPrint a message each time a module is initialized, showing the\nplace (filename or built-in module) from which it is loaded.  When\ngiven twice ('-vv'), print a message for each file that is checked\nfor when searching for a module.  Also provides information on\nmodule cleanup at exit.\n\nChanged in version 3.10: The *note site: c2. module reports the\nsite-specific paths and '.pth' files being processed.\n\nSee also *note PYTHONVERBOSE: 1aba.\n\n-- Option: -W arg\n\nWarning control.  Python's warning machinery by default prints\nwarning messages to *note sys.stderr: 757.\n\nThe simplest settings apply a particular action unconditionally to\nall warnings emitted by a process (even those that are otherwise\nignored by default):\n\n-Wdefault  # Warn once per call location\n-Werror    # Convert to exceptions\n-Walways   # Warn every time\n-Wmodule   # Warn once per calling module\n-Wonce     # Warn once per Python process\n-Wignore   # Never warn\n\nThe action names can be abbreviated as desired and the interpreter\nwill resolve them to the appropriate action name.  For example,\n'-Wi' is the same as '-Wignore'.\n\nThe full form of argument is:\n\naction:message:category:module:lineno\n\nEmpty fields match all values; trailing empty fields may be\nomitted.  For example '-W ignore::DeprecationWarning' ignores all\nDeprecationWarning warnings.\n\nThe 'action' field is as explained above but only applies to\nwarnings that match the remaining fields.\n\nThe 'message' field must match the whole warning message; this\nmatch is case-insensitive.\n\nThe 'category' field matches the warning category (ex:\n'DeprecationWarning').  This must be a class name; the match test\nwhether the actual warning category of the message is a subclass of\nthe specified warning category.\n\nThe 'module' field matches the (fully qualified) module name; this\nmatch is case-sensitive.\n\nThe 'lineno' field matches the line number, where zero matches all\nline numbers and is thus equivalent to an omitted line number.\n\nMultiple *note -W: 6df. options can be given; when a warning\nmatches more than one option, the action for the last matching\noption is performed.  Invalid *note -W: 6df. options are ignored\n(though, a warning message is printed about invalid options when\nthe first warning is issued).\n\nWarnings can also be controlled using the *note PYTHONWARNINGS:\n9ee. environment variable and from within a Python program using\nthe *note warnings: 10d. module.  For example, the *note\nwarnings.filterwarnings(): 1301. function can be used to use a\nregular expression on the warning message.\n\nSee *note The Warnings Filter: 6e1. and *note Describing Warning\nFilters: 1abc. for more details.\n\n-- Option: -x\n\nSkip the first line of the source, allowing use of non-Unix forms\nof '#!cmd'.  This is intended for a DOS specific hack only.\n\n-- Option: -X\n\nReserved for various implementation-specific options.  CPython\ncurrently defines the following possible values:\n\n* '-X faulthandler' to enable *note faulthandler: 53.  See also\n*note PYTHONFAULTHANDLER: ef7.\n\n* '-X showrefcount' to output the total reference count and\nnumber of used memory blocks when the program finishes or\nafter each statement in the interactive interpreter.  This\nonly works on *note debug builds: 67f.\n\n* '-X tracemalloc' to start tracing Python memory allocations\nusing the *note tracemalloc: fa. module.  By default, only the\nmost recent frame is stored in a traceback of a trace.  Use\n'-X tracemalloc=NFRAME' to start tracing with a traceback\nlimit of 'NFRAME' frames.  See *note tracemalloc.start():\n1abe. and *note PYTHONTRACEMALLOC: 1abf. for more information.\n\n* '-X intmaxstrdigits' configures the *note integer string\nconversion length limitation: 3bc.  See also *note\nPYTHONINTMAXSTRDIGITS: 1514.\n\n* '-X importtime' to show how long each import takes.  It shows\nmodule name, cumulative time (including nested imports) and\nself time (excluding nested imports).  Note that its output\nmay be broken in multi-threaded application.  Typical usage is\n'python3 -X importtime -c 'import asyncio''.  See also *note\nPYTHONPROFILEIMPORTTIME: 92c.\n\n* '-X dev': enable *note Python Development Mode: 6e3,\nintroducing additional runtime checks that are too expensive\nto be enabled by default.  See also *note PYTHONDEVMODE: 924.\n\n* '-X utf8' enables the *note Python UTF-8 Mode: 420.  '-X\nutf8=0' explicitly disables *note Python UTF-8 Mode: 420.\n(even when it would otherwise activate automatically).  See\nalso *note PYTHONUTF8: 90e.\n\n* '-X pycacheprefix=PATH' enables writing '.pyc' files to a\nparallel tree rooted at the given directory instead of to the\ncode tree.  See also *note PYTHONPYCACHEPREFIX: 7c7.\n\n* '-X warndefaultencoding' issues a *note EncodingWarning:\n1ac0. when the locale-specific default encoding is used for\nopening files.  See also *note PYTHONWARNDEFAULTENCODING: 5af.\n\n* '-X nodebugranges' disables the inclusion of the tables\nmapping extra location information (end line, start column\noffset and end column offset) to every instruction in code\nobjects.  This is useful when smaller code objects and pyc\nfiles are desired as well as suppressing the extra visual\nlocation indicators when the interpreter displays tracebacks.\nSee also *note PYTHONNODEBUGRANGES: 375.\n\n* '-X frozenmodules' determines whether or not frozen modules\nare ignored by the import machinery.  A value of \"on\" means\nthey get imported and \"off\" means they are ignored.  The\ndefault is \"on\" if this is an installed Python (the normal\ncase).  If it's under development (running from the source\ntree) then the default is \"off\".  Note that the\n\"importlibbootstrap\" and \"importlibbootstrapexternal\"\nfrozen modules are always used, even if this flag is set to\n\"off\".\n\n* '-X perf' enables support for the Linux 'perf' profiler.  When\nthis option is provided, the 'perf' profiler will be able to\nreport Python calls.  This option is only available on some\nplatforms and will do nothing if is not supported on the\ncurrent system.  The default value is \"off\".  See also *note\nPYTHONPERFSUPPORT: 187. and *note Python support for the Linux\nperf profiler: 151.\n\nIt also allows passing arbitrary values and retrieving them through\nthe *note sys.xoptions: 1ac1. dictionary.\n\nNew in version 3.2.\n\nChanged in version 3.3: Added the '-X faulthandler' option.\n\nChanged in version 3.4: Added the '-X showrefcount' and '-X\ntracemalloc' options.\n\nChanged in version 3.6: Added the '-X showalloccount' option.\n\nChanged in version 3.7: Added the '-X importtime', '-X dev' and '-X\nutf8' options.\n\nChanged in version 3.8: Added the '-X pycacheprefix' option.  The\n'-X dev' option now logs 'close()' exceptions in *note io.IOBase:\n823. destructor.\n\nChanged in version 3.9: Using '-X dev' option, check 'encoding' and\n'errors' arguments on string encoding and decoding operations.\n\nThe '-X showalloccount' option has been removed.\n\nChanged in version 3.10: Added the '-X warndefaultencoding'\noption.  Removed the '-X oldparser' option.\n\nChanged in version 3.11: Added the '-X nodebugranges', '-X\nfrozenmodules' and '-X intmaxstrdigits' options.\n\nChanged in version 3.12: Added the '-X perf' option.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0488/\n\n(2) https://peps.python.org/pep-0488/\n\n(3) https://peps.python.org/pep-0488/\n\n(4) https://peps.python.org/pep-0488/\n\n(5) https://peps.python.org/pep-0370/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Options you shouldn't use,  Prev: Miscellaneous options,  Up: Command line": {
            "content": "3.1.1.4 Options you shouldn't use\n.................................\n\n-- Option: -J\n\nReserved for use by Jython(1).\n\n---------- Footnotes ----------\n\n(1) https://www.jython.org/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Environment variables,  Prev: Command line,  Up: Command line and environment": {
            "content": "",
            "subsections": []
        },
        "These environment variables influence Python's behavior, they are": {
            "content": "processed before the command-line switches other than -E or -I. It is\ncustomary that command-line switches override environmental variables\nwhere there is a conflict.\n\n-- Environment Variable: PYTHONHOME\n\nChange the location of the standard Python libraries.  By default,\nthe libraries are searched in '`prefix'/lib/python`version'' and\n'`execprefix'/lib/python`version'', where '`prefix'' and\n'`execprefix'' are installation-dependent directories, both\ndefaulting to '/usr/local'.\n\nWhen *note PYTHONHOME: 334. is set to a single directory, its value\nreplaces both '`prefix'' and '`execprefix''.  To specify different\nvalues for these, set *note PYTHONHOME: 334. to\n'`prefix':`execprefix''.\n\n-- Environment Variable: PYTHONPATH\n\nAugment the default search path for module files.  The format is\nthe same as the shell's 'PATH': one or more directory pathnames\nseparated by *note os.pathsep: 1ac4. (e.g.  colons on Unix or\nsemicolons on Windows).  Non-existent directories are silently\nignored.\n\nIn addition to normal directories, individual *note PYTHONPATH:\ne92. entries may refer to zipfiles containing pure Python modules\n(in either source or compiled form).  Extension modules cannot be\nimported from zipfiles.\n\nThe default search path is installation dependent, but generally\nbegins with '`prefix'/lib/python`version'' (see *note PYTHONHOME:\n334. above).  It is 'always' appended to *note PYTHONPATH: e92.\n\nAn additional directory will be inserted in the search path in\nfront of *note PYTHONPATH: e92. as described above under *note\nInterface options: 1aac.  The search path can be manipulated from\nwithin a Python program as the variable *note sys.path: 32c.\n\n-- Environment Variable: PYTHONSAFEPATH\n\nIf this is set to a non-empty string, don't prepend a potentially\nunsafe path to *note sys.path: 32c.: see the *note -P: 362. option\nfor details.\n\nNew in version 3.11.\n\n-- Environment Variable: PYTHONPLATLIBDIR\n\nIf this is set to a non-empty string, it overrides the *note\nsys.platlibdir: 756. value.\n\nNew in version 3.9.\n\n-- Environment Variable: PYTHONSTARTUP\n\nIf this is the name of a readable file, the Python commands in that\nfile are executed before the first prompt is displayed in\ninteractive mode.  The file is executed in the same namespace where\ninteractive commands are executed so that objects defined or\nimported in it can be used without qualification in the interactive\nsession.  You can also change the prompts *note sys.ps1: 1ac5. and\n*note sys.ps2: 1ac6. and the hook *note sys.interactivehook:\ne3a. in this file.\n\nRaises an *note auditing event: 161d. 'cpython.runstartup' with\nthe filename as the argument when called on startup.\n\n-- Environment Variable: PYTHONOPTIMIZE\n\nIf this is set to a non-empty string it is equivalent to specifying\nthe *note -O: c11. option.  If set to an integer, it is equivalent\nto specifying *note -O: c11. multiple times.\n\n-- Environment Variable: PYTHONBREAKPOINT\n\nIf this is set, it names a callable using dotted-path notation.\nThe module containing the callable will be imported and then the\ncallable will be run by the default implementation of *note\nsys.breakpointhook(): 910. which itself is called by built-in *note\nbreakpoint(): 8f9.  If not set, or set to the empty string, it is\nequivalent to the value \"pdb.settrace\".  Setting this to the\nstring \"0\" causes the default implementation of *note\nsys.breakpointhook(): 910. to do nothing but return immediately.\n\nNew in version 3.7.\n\n-- Environment Variable: PYTHONDEBUG\n\nIf this is set to a non-empty string it is equivalent to specifying\nthe *note -d: 1ab4. option.  If set to an integer, it is equivalent\nto specifying *note -d: 1ab4. multiple times.\n\nThis environment variable requires a *note debug build of Python:\n67f, otherwise it's ignored.\n\n-- Environment Variable: PYTHONINSPECT\n\nIf this is set to a non-empty string it is equivalent to specifying\nthe *note -i: 1336. option.\n\nThis variable can also be modified by Python code using *note\nos.environ: 102e. to force inspect mode on program termination.\n\n-- Environment Variable: PYTHONUNBUFFERED\n\nIf this is set to a non-empty string it is equivalent to specifying\nthe *note -u: 1712. option.\n\n-- Environment Variable: PYTHONVERBOSE\n\nIf this is set to a non-empty string it is equivalent to specifying\nthe *note -v: 127b. option.  If set to an integer, it is equivalent\nto specifying *note -v: 127b. multiple times.\n\n-- Environment Variable: PYTHONCASEOK\n\nIf this is set, Python ignores case in *note import: 3a6.\nstatements.  This only works on Windows and macOS.\n\n-- Environment Variable: PYTHONDONTWRITEBYTECODE\n\nIf this is set to a non-empty string, Python won't try to write\n'.pyc' files on the import of source modules.  This is equivalent\nto specifying the *note -B: 1222. option.\n\n-- Environment Variable: PYTHONPYCACHEPREFIX\n\nIf this is set, Python will write '.pyc' files in a mirror\ndirectory tree at this path, instead of in 'pycache'\ndirectories within the source tree.  This is equivalent to\nspecifying the *note -X: 188. 'pycacheprefix=PATH' option.\n\nNew in version 3.8.\n\n-- Environment Variable: PYTHONHASHSEED\n\nIf this variable is not set or set to 'random', a random value is\nused to seed the hashes of str and bytes objects.\n\nIf *note PYTHONHASHSEED: ef4. is set to an integer value, it is\nused as a fixed seed for generating the hash() of the types covered\nby the hash randomization.\n\nIts purpose is to allow repeatable hashing, such as for selftests\nfor the interpreter itself, or to allow a cluster of python\nprocesses to share hash values.\n\nThe integer must be a decimal number in the range [0,4294967295].\nSpecifying the value 0 will disable hash randomization.\n\nNew in version 3.2.3.\n\n-- Environment Variable: PYTHONINTMAXSTRDIGITS\n\nIf this variable is set to an integer, it is used to configure the\ninterpreter's global *note integer string conversion length\nlimitation: 3bc.\n\nNew in version 3.11.\n\n-- Environment Variable: PYTHONIOENCODING\n\nIf this is set before running the interpreter, it overrides the\nencoding used for stdin/stdout/stderr, in the syntax\n'encodingname:errorhandler'.  Both the 'encodingname' and the\n':errorhandler' parts are optional and have the same meaning as in\n*note str.encode(): 6ee.\n\nFor stderr, the ':errorhandler' part is ignored; the handler will\nalways be ''backslashreplace''.\n\nChanged in version 3.4: The 'encodingname' part is now optional.\n\nChanged in version 3.6: On Windows, the encoding specified by this\nvariable is ignored for interactive console buffers unless *note\nPYTHONLEGACYWINDOWSSTDIO: aa6. is also specified.  Files and pipes\nredirected through the standard streams are not affected.\n\n-- Environment Variable: PYTHONNOUSERSITE\n\nIf this is set, Python won't add the *note user site-packages\ndirectory: 1ab8. to *note sys.path: 32c.\n\nSee also\n........\n\nPEP 370(1) - Per user site-packages directory\n\n-- Environment Variable: PYTHONUSERBASE\n\nDefines the *note user base directory: 1194, which is used to\ncompute the path of the *note user site-packages directory: 1ab8.\nand *note installation paths: 1ac7. for 'python -m pip install\n--user'.\n\nSee also\n........\n\nPEP 370(2) - Per user site-packages directory\n\n-- Environment Variable: PYTHONEXECUTABLE\n\nIf this environment variable is set, 'sys.argv[0]' will be set to\nits value instead of the value got through the C runtime.  Only\nworks on macOS.\n\n-- Environment Variable: PYTHONWARNINGS\n\nThis is equivalent to the *note -W: 6df. option.  If set to a comma\nseparated string, it is equivalent to specifying *note -W: 6df.\nmultiple times, with filters later in the list taking precedence\nover those earlier in the list.\n\nThe simplest settings apply a particular action unconditionally to\nall warnings emitted by a process (even those that are otherwise\nignored by default):\n\nPYTHONWARNINGS=default  # Warn once per call location\nPYTHONWARNINGS=error    # Convert to exceptions\nPYTHONWARNINGS=always   # Warn every time\nPYTHONWARNINGS=module   # Warn once per calling module\nPYTHONWARNINGS=once     # Warn once per Python process\nPYTHONWARNINGS=ignore   # Never warn\n\nSee *note The Warnings Filter: 6e1. and *note Describing Warning\nFilters: 1abc. for more details.\n\n-- Environment Variable: PYTHONFAULTHANDLER\n\nIf this environment variable is set to a non-empty string, *note\nfaulthandler.enable(): aed. is called at startup: install a handler\nfor *note SIGSEGV: 1ac9, *note SIGFPE: 1aca, *note SIGABRT: 1acb,\n*note SIGBUS: 1acc. and *note SIGILL: 1acd. signals to dump the\nPython traceback.  This is equivalent to *note -X: 188.\n'faulthandler' option.\n\nNew in version 3.3.\n\n-- Environment Variable: PYTHONTRACEMALLOC\n\nIf this environment variable is set to a non-empty string, start\ntracing Python memory allocations using the *note tracemalloc: fa.\nmodule.  The value of the variable is the maximum number of frames\nstored in a traceback of a trace.  For example,\n'PYTHONTRACEMALLOC=1' stores only the most recent frame.  See the\n*note tracemalloc.start(): 1abe. function for more information.\nThis is equivalent to setting the *note -X: 188. 'tracemalloc'\noption.\n\nNew in version 3.4.\n\n-- Environment Variable: PYTHONPROFILEIMPORTTIME\n\nIf this environment variable is set to a non-empty string, Python\nwill show how long each import takes.  This is equivalent to\nsetting the *note -X: 188. 'importtime' option.\n\nNew in version 3.7.\n\n-- Environment Variable: PYTHONASYNCIODEBUG\n\nIf this environment variable is set to a non-empty string, enable\nthe *note debug mode: 1acf. of the *note asyncio: 9. module.\n\nNew in version 3.4.\n\n-- Environment Variable: PYTHONMALLOC\n\nSet the Python memory allocators and/or install debug hooks.\n\nSet the family of memory allocators used by Python:\n\n* 'default': use the *note default memory allocators: 1ad0.\n\n* 'malloc': use the 'malloc()' function of the C library for all\ndomains (*note PYMEMDOMAINRAW: 1ad1, *note PYMEMDOMAINMEM:\nab4, *note PYMEMDOMAINOBJ: ab2.).\n\n* 'pymalloc': use the *note pymalloc allocator: b61. for *note\nPYMEMDOMAINMEM: ab4. and *note PYMEMDOMAINOBJ: ab2.\ndomains and use the 'malloc()' function for the *note\nPYMEMDOMAINRAW: 1ad1. domain.\n\nInstall *note debug hooks: 1ad2.:\n\n* 'debug': install debug hooks on top of the *note default\nmemory allocators: 1ad0.\n\n* 'mallocdebug': same as 'malloc' but also install debug hooks.\n\n* 'pymallocdebug': same as 'pymalloc' but also install debug\nhooks.\n\nNew in version 3.6.\n\nChanged in version 3.7: Added the '\"default\"' allocator.\n\n-- Environment Variable: PYTHONMALLOCSTATS\n\nIf set to a non-empty string, Python will print statistics of the\n*note pymalloc memory allocator: b61. every time a new pymalloc\nobject arena is created, and on shutdown.\n\nThis variable is ignored if the *note PYTHONMALLOC: aaf.\nenvironment variable is used to force the 'malloc()' allocator of\nthe C library, or if Python is configured without 'pymalloc'\nsupport.\n\nChanged in version 3.6: This variable can now also be used on\nPython compiled in release mode.  It now has no effect if set to an\nempty string.\n\n-- Environment Variable: PYTHONLEGACYWINDOWSFSENCODING\n\nIf set to a non-empty string, the default *note filesystem encoding\nand error handler: 291. mode will revert to their pre-3.6 values of\n'mbcs' and 'replace', respectively.  Otherwise, the new defaults\n'utf-8' and 'surrogatepass' are used.\n\nThis may also be enabled at runtime with *note\nsys.enablelegacywindowsfsencoding(): aa4.\n\n*note Availability: 1ad3.: Windows.\n\nNew in version 3.6: See PEP 529(3) for more details.\n\n-- Environment Variable: PYTHONLEGACYWINDOWSSTDIO\n\nIf set to a non-empty string, does not use the new console reader\nand writer.  This means that Unicode characters will be encoded\naccording to the active console code page, rather than using utf-8.\n\nThis variable is ignored if the standard streams are redirected (to\nfiles or pipes) rather than referring to console buffers.\n\n*note Availability: 1ad3.: Windows.\n\nNew in version 3.6.\n\n-- Environment Variable: PYTHONCOERCECLOCALE\n\nIf set to the value '0', causes the main Python command line\napplication to skip coercing the legacy ASCII-based C and POSIX\nlocales to a more capable UTF-8 based alternative.\n\nIf this variable is 'not' set (or is set to a value other than\n'0'), the 'LCALL' locale override environment variable is also not\nset, and the current locale reported for the 'LCCTYPE' category is\neither the default 'C' locale, or else the explicitly ASCII-based\n'POSIX' locale, then the Python CLI will attempt to configure the\nfollowing locales for the 'LCCTYPE' category in the order listed\nbefore loading the interpreter runtime:\n\n* 'C.UTF-8'\n\n* 'C.utf8'\n\n* 'UTF-8'\n\nIf setting one of these locale categories succeeds, then the\n'LCCTYPE' environment variable will also be set accordingly in the\ncurrent process environment before the Python runtime is\ninitialized.  This ensures that in addition to being seen by both\nthe interpreter itself and other locale-aware components running in\nthe same process (such as the GNU 'readline' library), the updated\nsetting is also seen in subprocesses (regardless of whether or not\nthose processes are running a Python interpreter), as well as in\noperations that query the environment rather than the current C\nlocale (such as Python's own *note locale.getdefaultlocale():\n249.).\n\nConfiguring one of these locales (either explicitly or via the\nabove implicit locale coercion) automatically enables the\n'surrogateescape' *note error handler: 1543. for *note sys.stdin:\n293. and *note sys.stdout: 90c. (*note sys.stderr: 757. continues\nto use 'backslashreplace' as it does in any other locale).  This\nstream handling behavior can be overridden using *note\nPYTHONIOENCODING: e7e. as usual.\n\nFor debugging purposes, setting 'PYTHONCOERCECLOCALE=warn' will\ncause Python to emit warning messages on 'stderr' if either the\nlocale coercion activates, or else if a locale that 'would' have\ntriggered coercion is still active when the Python runtime is\ninitialized.\n\nAlso note that even when locale coercion is disabled, or when it\nfails to find a suitable target locale, *note PYTHONUTF8: 90e. will\nstill activate by default in legacy ASCII-based locales.  Both\nfeatures must be disabled in order to force the interpreter to use\n'ASCII' instead of 'UTF-8' for system interfaces.\n\n*note Availability: 1ad3.: Unix.\n\nNew in version 3.7: See PEP 538(4) for more details.\n\n-- Environment Variable: PYTHONDEVMODE\n\nIf this environment variable is set to a non-empty string, enable\n*note Python Development Mode: 6e3, introducing additional runtime\nchecks that are too expensive to be enabled by default.  This is\nequivalent to setting the *note -X: 188. 'dev' option.\n\nNew in version 3.7.\n\n-- Environment Variable: PYTHONUTF8\n\nIf set to '1', enable the *note Python UTF-8 Mode: 420.\n\nIf set to '0', disable the *note Python UTF-8 Mode: 420.\n\nSetting any other non-empty string causes an error during\ninterpreter initialisation.\n\nNew in version 3.7.\n\n-- Environment Variable: PYTHONWARNDEFAULTENCODING\n\nIf this environment variable is set to a non-empty string, issue a\n*note EncodingWarning: 1ac0. when the locale-specific default\nencoding is used.\n\nSee *note Opt-in EncodingWarning: 1ad4. for details.\n\nNew in version 3.10.\n\n-- Environment Variable: PYTHONNODEBUGRANGES\n\nIf this variable is set, it disables the inclusion of the tables\nmapping extra location information (end line, start column offset\nand end column offset) to every instruction in code objects.  This\nis useful when smaller code objects and pyc files are desired as\nwell as suppressing the extra visual location indicators when the\ninterpreter displays tracebacks.\n\nNew in version 3.11.\n\n-- Environment Variable: PYTHONPERFSUPPORT\n\nIf this variable is set to a nonzero value, it enables support for\nthe Linux 'perf' profiler so Python calls can be detected by it.\n\nIf set to '0', disable Linux 'perf' profiler support.\n\nSee also the *note -X perf: 188. command-line option and *note\nPython support for the Linux perf profiler: 151.\n\nNew in version 3.12.\n\n* Menu:\n\n* Debug-mode variables::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0370/\n\n(2) https://peps.python.org/pep-0370/\n\n(3) https://peps.python.org/pep-0529/\n\n(4) https://peps.python.org/pep-0538/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Debug-mode variables,  Up: Environment variables": {
            "content": "3.1.2.1 Debug-mode variables\n............................\n\n-- Environment Variable: PYTHONDUMPREFS\n\nIf set, Python will dump objects and reference counts still alive\nafter shutting down the interpreter.\n\nNeed Python configured with the *note -with-trace-refs: 6b2. build\noption.\n\n-- Environment Variable: PYTHONDUMPREFSFILE=FILENAME\n\nIf set, Python will dump objects and reference counts still alive\nafter shutting down the interpreter into a file called 'FILENAME'.\n\nNeed Python configured with the *note -with-trace-refs: 6b2. build\noption.\n\nNew in version 3.11.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using Python on Unix platforms,  Next: Configure Python,  Prev: Command line and environment,  Up: Python Setup and Usage": {
            "content": "",
            "subsections": [
                {
                    "name": "3.2 Using Python on Unix platforms",
                    "content": "* Menu:\n\n* Getting and installing the latest version of Python::\n* Building Python::\n* Python-related paths and files::\n* Miscellaneous::\n* Custom OpenSSL::\n"
                }
            ]
        },
        "File: python3.12.info,  Node: Getting and installing the latest version of Python,  Next: Building Python,  Up: Using Python on Unix platforms": {
            "content": "* Menu:\n\n* On Linux::\n* On FreeBSD and OpenBSD::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: On Linux,  Next: On FreeBSD and OpenBSD,  Up: Getting and installing the latest version of Python": {
            "content": "3.2.1.1 On Linux\n................\n",
            "subsections": []
        },
        "Python comes preinstalled on most Linux distributions, and is available": {
            "content": "as a package on all others.  However there are certain features you\nmight want to use that are not available on your distro's package.  You\ncan easily compile the latest version of Python from source.\n",
            "subsections": []
        },
        "In the event that Python doesn't come preinstalled and isn't in the": {
            "content": "repositories as well, you can easily make packages for your own distro.\nHave a look at the following links:\n\nSee also\n........\n\n'https://www.debian.org/doc/manuals/maint-guide/first.en.html'\n\nfor Debian users\n\n'https://en.opensuse.org/Portal:Packaging'\n\nfor OpenSuse users\n\n'https://docs.fedoraproject.org/en-US/package-maintainers/PackagingTutorialGNUHello/'\n\nfor Fedora users\n\n'https://slackbook.org/html/package-management-making-packages.html'\n\nfor Slackware users\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: On FreeBSD and OpenBSD,  Prev: On Linux,  Up: Getting and installing the latest version of Python": {
            "content": "3.2.1.2 On FreeBSD and OpenBSD\n..............................\n\n* FreeBSD users, to add the package use:\n\npkg install python3\n\n* OpenBSD users, to add the package use:\n\npkgadd -r python\n\npkgadd ftp://ftp.openbsd.org/pub/OpenBSD/4.2/packages/<insert your architecture here>/python-<version>.tgz\n\nFor example i386 users get the 2.5.1 version of Python using:\n\npkgadd ftp://ftp.openbsd.org/pub/OpenBSD/4.2/packages/i386/python-2.5.1p2.tgz\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Building Python,  Next: Python-related paths and files,  Prev: Getting and installing the latest version of Python,  Up: Using Python on Unix platforms": {
            "content": "",
            "subsections": []
        },
        "If you want to compile CPython yourself, first thing you should do is": {
            "content": "get the source(1).  You can download either the latest release's source\nor just grab a fresh checkout(2).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python-related paths and files,  Next: Miscellaneous,  Prev: Building Python,  Up: Using Python on Unix platforms": {
            "content": "",
            "subsections": []
        },
        "These are subject to difference depending on local installation": {
            "content": "conventions; *note prefix: 1ae0. and *note execprefix: 1ae1. are\ninstallation-dependent and should be interpreted as for GNU software;\nthey may be the same.\n\nFor example, on most Linux systems, the default for both is '/usr'.\n",
            "subsections": []
        },
        "File/directory                                      Meaning": {
            "content": "---------------------------------------------------------------------------------------------------\n\n'`execprefix'/bin/python3'                         Recommended location of the interpreter.\n\n\n'`prefix'/lib/python`version'',                     Recommended locations of the directories\n'`execprefix'/lib/python`version''                 containing the standard modules.\n\n\n'`prefix'/include/python`version'',                 Recommended locations of the directories\n'`execprefix'/include/python`version''             containing the include files needed for\ndeveloping Python extensions and embedding\nthe interpreter.\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Miscellaneous,  Next: Custom OpenSSL,  Prev: Python-related paths and files,  Up: Using Python on Unix platforms": {
            "content": "",
            "subsections": []
        },
        "To easily use Python scripts on Unix, you need to make them executable,": {
            "content": "e.g.  with\n\n$ chmod +x script\n\nand put an appropriate Shebang line at the top of the script.  A good\nchoice is usually\n\n#!/usr/bin/env python3\n\nwhich searches for the Python interpreter in the whole 'PATH'.  However,\nsome Unices may not have the 'env' command, so you may need to hardcode\n'/usr/bin/python3' as the interpreter path.\n\nTo use shell commands in your Python scripts, look at the *note\nsubprocess: d0. module.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Custom OpenSSL,  Prev: Miscellaneous,  Up: Using Python on Unix platforms": {
            "content": "1. To use your vendor's OpenSSL configuration and system trust store,\nlocate the directory with 'openssl.cnf' file or symlink in '/etc'.\nOn most distribution the file is either in '/etc/ssl' or\n'/etc/pki/tls'.  The directory should also contain a 'cert.pem'\nfile and/or a 'certs' directory.\n\n$ find /etc/ -name openssl.cnf -printf \"%h\\n\"\n/etc/ssl\n\n2. Download, build, and install OpenSSL. Make sure you use\n'installsw' and not 'install'.  The 'installsw' target does not\noverride 'openssl.cnf'.\n\n$ curl -O https://www.openssl.org/source/openssl-VERSION.tar.gz\n$ tar xzf openssl-VERSION\n$ pushd openssl-VERSION\n$ ./config \\\n--prefix=/usr/local/custom-openssl \\\n--libdir=lib \\\n--openssldir=/etc/ssl\n$ make -j1 depend\n$ make -j8\n$ make installsw\n$ popd\n\n3. Build Python with custom OpenSSL (see the configure\n'--with-openssl' and '--with-openssl-rpath' options)\n\n$ pushd python-3.x.x\n$ ./configure -C \\\n--with-openssl=/usr/local/custom-openssl \\\n--with-openssl-rpath=auto \\\n--prefix=/usr/local/python-3.x.x\n$ make -j8\n$ make altinstall\n\nNote: Patch releases of OpenSSL have a backwards compatible ABI.\nYou don't need to recompile Python to update OpenSSL. It's\nsufficient to replace the custom OpenSSL installation with a newer\nversion.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Configure Python,  Next: Using Python on Windows,  Prev: Using Python on Unix platforms,  Up: Python Setup and Usage": {
            "content": "",
            "subsections": [
                {
                    "name": "3.3 Configure Python",
                    "content": "* Menu:\n\n* Build Requirements::\n* Generated files::\n* Configure Options::\n* Python Build System::\n* Compiler and linker flags::\n"
                }
            ]
        },
        "File: python3.12.info,  Node: Build Requirements,  Next: Generated files,  Up: Configure Python": {
            "content": "Features required to build CPython:\n\n* A C11(1) compiler.  Optional C11 features(2) are not required.\n\n* Support for IEEE 754(3) floating point numbers and floating point\nNot-a-Number (NaN)(4).\n\n* Support for threads.\n\n* OpenSSL 1.1.1 or newer for the *note ssl: ca. and *note hashlib:\n63. modules.\n\n* On Windows, Microsoft Visual Studio 2017 or later is required.\n",
            "subsections": []
        },
        "Changed in version 3.5: On Windows, Visual Studio 2015 or later is": {
            "content": "required.\n",
            "subsections": []
        },
        "Changed in version 3.6: Selected C99 features are now required, like": {
            "content": "'<stdint.h>' and 'static inline' functions.\n",
            "subsections": []
        },
        "Changed in version 3.7: Thread support and OpenSSL 1.0.2 are now": {
            "content": "required.\n\nChanged in version 3.10: OpenSSL 1.1.1 is now required.\n",
            "subsections": []
        },
        "Changed in version 3.11: C11 compiler, IEEE 754 and NaN support are now": {
            "content": "required.  On Windows, Visual Studio 2017 or later is required.\n\nSee also PEP 7(5) \"Style Guide for C Code\" and PEP 11(6) \"CPython\nplatform support\".\n\n---------- Footnotes ----------\n\n(1) https://en.cppreference.com/w/c/11\n\n(2)\nhttps://en.wikipedia.org/wiki/C11(Cstandardrevision)#Optionalfeatures\n\n(3) https://en.wikipedia.org/wiki/IEEE754\n\n(4) https://en.wikipedia.org/wiki/NaN#Floatingpoint\n\n(5) https://peps.python.org/pep-0007/\n\n(6) https://peps.python.org/pep-0011/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Generated files,  Next: Configure Options,  Prev: Build Requirements,  Up: Configure Python": {
            "content": "",
            "subsections": []
        },
        "To reduce build dependencies, Python source code contains multiple": {
            "content": "generated files.  Commands to regenerate all generated files:\n\nmake regen-all\nmake regen-stdlib-module-names\nmake regen-limited-abi\nmake regen-configure\n",
            "subsections": []
        },
        "The 'Makefile.pre.in' file documents generated files, their inputs, and": {
            "content": "tools used to regenerate them.  Search for 'regen-*' make targets.\n\n* Menu:\n\n* configure script::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: configure script,  Up: Generated files": {
            "content": "3.3.2.1 configure script\n........................\n",
            "subsections": []
        },
        "The 'make regen-configure' command regenerates the 'aclocal.m4' file and": {
            "content": "the 'configure' script using the 'Tools/build/regen-configure.sh' shell\nscript which uses an Ubuntu container to get the same tools versions and\nhave a reproducible output.\n\nThe container is optional, the following command can be run locally:\n\nautoreconf -ivf -Werror\n",
            "subsections": []
        },
        "The generated files can change depending on the exact": {
            "content": "'autoconf-archive', 'aclocal' and 'pkg-config' versions.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Configure Options,  Next: Python Build System,  Prev: Generated files,  Up: Configure Python": {
            "content": "List all './configure' script options using:\n\n./configure --help\n\nSee also the 'Misc/SpecialBuilds.txt' in the Python source distribution.\n\n* Menu:\n\n* General Options::\n* WebAssembly Options::\n* Install Options::\n* Performance options::\n* Python Debug Build::\n* Debug options::\n* Linker options::\n* Libraries options::\n* Security Options::\n* macOS Options::\n* Cross Compiling Options::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: General Options,  Next: WebAssembly Options,  Up: Configure Options": {
            "content": "3.3.3.1 General Options\n.......................\n\n-- Option: --enable-loadable-sqlite-extensions\n\nSupport loadable extensions in the 'sqlite' extension module\n(default is no) of the *note sqlite3: c9. module.\n\nSee the *note sqlite3.Connection.enableloadextension(): 634.\nmethod of the *note sqlite3: c9. module.\n\nNew in version 3.6.\n\n-- Option: --disable-ipv6\n\nDisable IPv6 support (enabled by default if supported), see the\n*note socket: c6. module.\n\n-- Option: --enable-big-digits=[15|30]\n\nDefine the size in bits of Python *note int: 17e. digits: 15 or 30\nbits.\n\nBy default, the digit size is 30.\n\nDefine the 'PYLONGBITSINDIGIT' to '15' or '30'.\n\nSee *note sys.intinfo.bitsperdigit: 110c.\n\n-- Option: --with-suffix=SUFFIX\n\nSet the Python executable suffix to 'SUFFIX'.\n\nThe default suffix is '.exe' on Windows and macOS ('python.exe'\nexecutable), '.js' on Emscripten node, '.html' on Emscripten\nbrowser, '.wasm' on WASI, and an empty string on other platforms\n('python' executable).\n\nChanged in version 3.11: The default suffix on WASM platform is one\nof '.js', '.html' or '.wasm'.\n\n-- Option: --with-tzpath=<list of absolute paths separated by pathsep>\n\nSelect the default time zone search path for *note zoneinfo.TZPATH:\n1af0.  See the *note Compile-time configuration: 1af1. of the *note\nzoneinfo: 12e. module.\n\nDefault:\n'/usr/share/zoneinfo:/usr/lib/zoneinfo:/usr/share/lib/zoneinfo:/etc/zoneinfo'.\n\nSee *note os.pathsep: 1ac4. path separator.\n\nNew in version 3.9.\n\n-- Option: --without-decimal-contextvar\n\nBuild the 'decimal' extension module using a thread-local context\nrather than a coroutine-local context (default), see the *note\ndecimal: 33. module.\n\nSee *note decimal.HAVECONTEXTVAR: 1af3. and the *note contextvars:\n22. module.\n\nNew in version 3.9.\n\n-- Option: --with-dbmliborder=<list of backend names>\n\nOverride order to check db backends for the *note dbm: 2f. module\n\nA valid value is a colon (':') separated string with the backend\nnames:\n\n* 'ndbm';\n\n* 'gdbm';\n\n* 'bdb'.\n\n-- Option: --without-c-locale-coercion\n\nDisable C locale coercion to a UTF-8 based locale (enabled by\ndefault).\n\nDon't define the 'PYCOERCECLOCALE' macro.\n\nSee *note PYTHONCOERCECLOCALE: 90b. and the PEP 538(1).\n\n-- Option: --without-freelists\n\nDisable all freelists except the empty tuple singleton.\n\nNew in version 3.11.\n\n-- Option: --with-platlibdir=DIRNAME\n\nPython library directory name (default is 'lib').\n\nFedora and SuSE use 'lib64' on 64-bit platforms.\n\nSee *note sys.platlibdir: 756.\n\nNew in version 3.9.\n\n-- Option: --with-wheel-pkg-dir=PATH\n\nDirectory of wheel packages used by the *note ensurepip: 50. module\n(none by default).\n\nSome Linux distribution packaging policies recommend against\nbundling dependencies.  For example, Fedora installs wheel packages\nin the '/usr/share/python-wheels/' directory and don't install the\n'ensurepip.bundled' package.\n\nNew in version 3.10.\n\n-- Option: --with-pkg-config=[check|yes|no]\n\nWhether configure should use 'pkg-config' to detect build\ndependencies.\n\n* 'check' (default): 'pkg-config' is optional\n\n* 'yes': 'pkg-config' is mandatory\n\n* 'no': configure does not use 'pkg-config' even when present\n\nNew in version 3.11.\n\n-- Option: --enable-pystats\n\nTurn on internal statistics gathering.\n\nThe statistics will be dumped to a arbitrary (probably unique) file\nin '/tmp/pystats/', or 'C:\\temp\\pystats\\' on Windows.  If that\ndirectory does not exist, results will be printed on stdout.\n\nUse 'Tools/scripts/summarizestats.py' to read the stats.\n\nNew in version 3.11.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0538/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: WebAssembly Options,  Next: Install Options,  Prev: General Options,  Up: Configure Options": {
            "content": "3.3.3.2 WebAssembly Options\n...........................\n\n-- Option: --with-emscripten-target=[browser|node]\n\nSet build flavor for 'wasm32-emscripten'.\n\n* 'browser' (default): preload minimal stdlib, default MEMFS.\n\n* 'node': NODERAWFS and pthread support.\n\nNew in version 3.11.\n\n-- Option: --enable-wasm-dynamic-linking\n\nTurn on dynamic linking support for WASM.\n\nDynamic linking enables 'dlopen'.  File size of the executable\nincreases due to limited dead code elimination and additional\nfeatures.\n\nNew in version 3.11.\n\n-- Option: --enable-wasm-pthreads\n\nTurn on pthreads support for WASM.\n\nNew in version 3.11.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Install Options,  Next: Performance options,  Prev: WebAssembly Options,  Up: Configure Options": {
            "content": "3.3.3.3 Install Options\n.......................\n\n-- Option: --prefix=PREFIX\n\nInstall architecture-independent files in PREFIX. On Unix, it\ndefaults to '/usr/local'.\n\nThis value can be retrieved at runtime using *note sys.prefix: 32e.\n\nAs an example, one can use '--prefix=\"$HOME/.local/\"' to install a\nPython in its home directory.\n\n-- Option: --exec-prefix=EPREFIX\n\nInstall architecture-dependent files in EPREFIX, defaults to *note\n-prefix: 1ae0.\n\nThis value can be retrieved at runtime using *note sys.execprefix:\n32a.\n\n-- Option: --disable-test-modules\n\nDon't build nor install test modules, like the *note test: dc.\npackage or the 'testcapi' extension module (built and installed by\ndefault).\n\nNew in version 3.10.\n\n-- Option: --with-ensurepip=[upgrade|install|no]\n\nSelect the *note ensurepip: 50. command run on Python installation:\n\n* 'upgrade' (default): run 'python -m ensurepip --altinstall\n--upgrade' command.\n\n* 'install': run 'python -m ensurepip --altinstall' command;\n\n* 'no': don't run ensurepip;\n\nNew in version 3.6.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Performance options,  Next: Python Debug Build,  Prev: Install Options,  Up: Configure Options": {
            "content": "3.3.3.4 Performance options\n...........................\n\nConfiguring Python using '--enable-optimizations --with-lto' (PGO + LTO)\nis recommended for best performance.  The experimental '--enable-bolt'\nflag can also be used to improve performance.\n\n-- Option: --enable-optimizations\n\nEnable Profile Guided Optimization (PGO) using *note PROFILETASK:\n1afd. (disabled by default).\n\nThe C compiler Clang requires 'llvm-profdata' program for PGO. On\nmacOS, GCC also requires it: GCC is just an alias to Clang on\nmacOS.\n\nDisable also semantic interposition in libpython if\n'--enable-shared' and GCC is used: add\n'-fno-semantic-interposition' to the compiler and linker flags.\n\nNew in version 3.6.\n\nChanged in version 3.10: Use '-fno-semantic-interposition' on GCC.\n\n-- Environment Variable: PROFILETASK\n\nEnvironment variable used in the Makefile: Python command line\narguments for the PGO generation task.\n\nDefault: '-m test --pgo --timeout=$(TESTTIMEOUT)'.\n\nNew in version 3.8.\n\n-- Option: --with-lto=[full|thin|no|yes]\n\nEnable Link Time Optimization (LTO) in any build (disabled by\ndefault).\n\nThe C compiler Clang requires 'llvm-ar' for LTO ('ar' on macOS), as\nwell as an LTO-aware linker ('ld.gold' or 'lld').\n\nNew in version 3.6.\n\nNew in version 3.11: To use ThinLTO feature, use '--with-lto=thin'\non Clang.\n\nChanged in version 3.12: Use ThinLTO as the default optimization\npolicy on Clang if the compiler accepts the flag.\n\n-- Option: --enable-bolt\n\nEnable usage of the BOLT post-link binary optimizer(1) (disabled by\ndefault).\n\nBOLT is part of the LLVM project but is not always included in\ntheir binary distributions.  This flag requires that 'llvm-bolt'\nand 'merge-fdata' are available.\n\nBOLT is still a fairly new project so this flag should be\nconsidered experimental for now.  Because this tool operates on\nmachine code its success is dependent on a combination of the build\nenvironment + the other optimization configure args + the CPU\narchitecture, and not all combinations are supported.  BOLT\nversions before LLVM 16 are known to crash BOLT under some\nscenarios.  Use of LLVM 16 or newer for BOLT optimization is\nstrongly encouraged.\n\nThe 'BOLTINSTRUMENTFLAGS' and 'BOLTAPPLYFLAGS' 'configure'\nvariables can be defined to override the default set of arguments\nfor 'llvm-bolt' to instrument and apply BOLT data to binaries,\nrespectively.\n\nNew in version 3.12.\n\n-- Option: --with-computed-gotos\n\nEnable computed gotos in evaluation loop (enabled by default on\nsupported compilers).\n\n-- Option: --without-pymalloc\n\nDisable the specialized Python memory allocator *note pymalloc:\nb61. (enabled by default).\n\nSee also *note PYTHONMALLOC: aaf. environment variable.\n\n-- Option: --without-doc-strings\n\nDisable static documentation strings to reduce the memory footprint\n(enabled by default).  Documentation strings defined in Python are\nnot affected.\n\nDon't define the 'WITHDOCSTRINGS' macro.\n\nSee the 'PyDocSTRVAR()' macro.\n\n-- Option: --enable-profiling\n\nEnable C-level code profiling with 'gprof' (disabled by default).\n\n-- Option: --with-strict-overflow\n\nAdd '-fstrict-overflow' to the C compiler flags (by default we add\n'-fno-strict-overflow' instead).\n\n---------- Footnotes ----------\n\n(1) https://github.com/llvm/llvm-project/tree/main/bolt\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python Debug Build,  Next: Debug options,  Prev: Performance options,  Up: Configure Options": {
            "content": "3.3.3.5 Python Debug Build\n..........................\n\nA debug build is Python built with the *note -with-pydebug: 1b04.\nconfigure option.\n\nEffects of a debug build:\n\n* Display all warnings by default: the list of default warning\nfilters is empty in the *note warnings: 10d. module.\n\n* Add 'd' to *note sys.abiflags: 891.\n\n* Add 'sys.gettotalrefcount()' function.\n\n* Add *note -X showrefcount: 188. command line option.\n\n* Add *note -d: 1ab4. command line option and *note PYTHONDEBUG:\n1ab5. environment variable to debug the parser.\n\n* Add support for the 'lltrace' variable: enable low-level\ntracing in the bytecode evaluation loop if the variable is defined.\n\n* Install *note debug hooks on memory allocators: 1ad0. to detect\nbuffer overflow and other memory errors.\n\n* Define 'PyDEBUG' and 'PyREFDEBUG' macros.\n\n* Add runtime checks: code surrounded by '#ifdef PyDEBUG' and\n'#endif'.  Enable 'assert(...)' and 'PyObjectASSERT(...)'\nassertions: don't set the 'NDEBUG' macro (see also the *note\n-with-assertions: 1b05. configure option).  Main runtime checks:\n\n* Add sanity checks on the function arguments.\n\n* Unicode and int objects are created with their memory filled\nwith a pattern to detect usage of uninitialized objects.\n\n* Ensure that functions which can clear or replace the current\nexception are not called with an exception raised.\n\n* Check that deallocator functions don't change the current\nexception.\n\n* The garbage collector (*note gc.collect(): 865. function) runs\nsome basic checks on objects consistency.\n\n* The 'PySAFEDOWNCAST()' macro checks for integer underflow\nand overflow when downcasting from wide types to narrow types.\n\nSee also the *note Python Development Mode: 6e3. and the *note\n-with-trace-refs: 6b2. configure option.\n",
            "subsections": []
        },
        "Changed in version 3.8: Release builds and debug builds are now ABI": {
            "content": "compatible: defining the 'PyDEBUG' macro no longer implies the\n'PyTRACEREFS' macro (see the *note -with-trace-refs: 6b2. option),\nwhich introduces the only ABI incompatibility.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Debug options,  Next: Linker options,  Prev: Python Debug Build,  Up: Configure Options": {
            "content": "3.3.3.6 Debug options\n.....................\n\n-- Option: --with-pydebug\n\n*note Build Python in debug mode: 67f.: define the 'PyDEBUG' macro\n(disabled by default).\n\n-- Option: --with-trace-refs\n\nEnable tracing references for debugging purpose (disabled by\ndefault).\n\nEffects:\n\n* Define the 'PyTRACEREFS' macro.\n\n* Add 'sys.getobjects()' function.\n\n* Add *note PYTHONDUMPREFS: 7ca. environment variable.\n\nThis build is not ABI compatible with release build (default build)\nor debug build ('PyDEBUG' and 'PyREFDEBUG' macros).\n\nNew in version 3.8.\n\n-- Option: --with-assertions\n\nBuild with C assertions enabled (default is no): 'assert(...);' and\n'PyObjectASSERT(...);'.\n\nIf set, the 'NDEBUG' macro is not defined in the *note OPT: 1b07.\ncompiler variable.\n\nSee also the *note -with-pydebug: 1b04. option (*note debug build:\n67f.) which also enables assertions.\n\nNew in version 3.6.\n\n-- Option: --with-valgrind\n\nEnable Valgrind support (default is no).\n\n-- Option: --with-dtrace\n\nEnable DTrace support (default is no).\n\nSee *note Instrumenting CPython with DTrace and SystemTap: ab7.\n\nNew in version 3.6.\n\n-- Option: --with-address-sanitizer\n\nEnable AddressSanitizer memory error detector, 'asan' (default is\nno).\n\nNew in version 3.6.\n\n-- Option: --with-memory-sanitizer\n\nEnable MemorySanitizer allocation error detector, 'msan' (default\nis no).\n\nNew in version 3.6.\n\n-- Option: --with-undefined-behavior-sanitizer\n\nEnable UndefinedBehaviorSanitizer undefined behaviour detector,\n'ubsan' (default is no).\n\nNew in version 3.6.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Linker options,  Next: Libraries options,  Prev: Debug options,  Up: Configure Options": {
            "content": "3.3.3.7 Linker options\n......................\n\n-- Option: --enable-shared\n\nEnable building a shared Python library: 'libpython' (default is\nno).\n\n-- Option: --without-static-libpython\n\nDo not build 'libpythonMAJOR.MINOR.a' and do not install 'python.o'\n(built and enabled by default).\n\nNew in version 3.10.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Libraries options,  Next: Security Options,  Prev: Linker options,  Up: Configure Options": {
            "content": "3.3.3.8 Libraries options\n.........................\n\n-- Option: --with-libs='lib1 ...'\n\nLink against additional libraries (default is no).\n\n-- Option: --with-system-expat\n\nBuild the 'pyexpat' module using an installed 'expat' library\n(default is no).\n\n-- Option: --with-system-libmpdec\n\nBuild the 'decimal' extension module using an installed 'mpdec'\nlibrary, see the *note decimal: 33. module (default is no).\n\nNew in version 3.3.\n\n-- Option: --with-readline=editline\n\nUse 'editline' library for backend of the *note readline: b5.\nmodule.\n\nDefine the 'WITHEDITLINE' macro.\n\nNew in version 3.10.\n\n-- Option: --without-readline\n\nDon't build the *note readline: b5. module (built by default).\n\nDon't define the 'HAVELIBREADLINE' macro.\n\nNew in version 3.10.\n\n-- Option: --with-libm=STRING\n\nOverride 'libm' math library to 'STRING' (default is\nsystem-dependent).\n\n-- Option: --with-libc=STRING\n\nOverride 'libc' C library to 'STRING' (default is\nsystem-dependent).\n\n-- Option: --with-openssl=DIR\n\nRoot of the OpenSSL directory.\n\nNew in version 3.7.\n\n-- Option: --with-openssl-rpath=[no|auto|DIR]\n\nSet runtime library directory (rpath) for OpenSSL libraries:\n\n* 'no' (default): don't set rpath;\n\n* 'auto': auto-detect rpath from *note -with-openssl: 1b14. and\n'pkg-config';\n\n* 'DIR': set an explicit rpath.\n\nNew in version 3.10.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Security Options,  Next: macOS Options,  Prev: Libraries options,  Up: Configure Options": {
            "content": "3.3.3.9 Security Options\n........................\n\n-- Option: --with-hash-algorithm=[fnv|siphash13|siphash24]\n\nSelect hash algorithm for use in 'Python/pyhash.c':\n\n* 'siphash13' (default);\n\n* 'siphash24';\n\n* 'fnv'.\n\nNew in version 3.4.\n\nNew in version 3.11: 'siphash13' is added and it is the new\ndefault.\n\n-- Option:\n--with-builtin-hashlib-hashes=md5,sha1,sha256,sha512,sha3,blake2\n\nBuilt-in hash modules:\n\n* 'md5';\n\n* 'sha1';\n\n* 'sha256';\n\n* 'sha512';\n\n* 'sha3' (with shake);\n\n* 'blake2'.\n\nNew in version 3.9.\n\n-- Option: --with-ssl-default-suites=[python|openssl|STRING]\n\nOverride the OpenSSL default cipher suites string:\n\n* 'python' (default): use Python's preferred selection;\n\n* 'openssl': leave OpenSSL's defaults untouched;\n\n* 'STRING': use a custom string\n\nSee the *note ssl: ca. module.\n\nNew in version 3.7.\n\nChanged in version 3.10: The settings 'python' and 'STRING' also\nset TLS 1.2 as minimum protocol version.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: macOS Options,  Next: Cross Compiling Options,  Prev: Security Options,  Up: Configure Options": {
            "content": "3.3.3.10 macOS Options\n......................\n\nSee 'Mac/README.rst'.\n\n-- Option: --enable-universalsdk\n\n-- Option: --enable-universalsdk=SDKDIR\n\nCreate a universal binary build.  'SDKDIR' specifies which macOS\nSDK should be used to perform the build (default is no).\n\n-- Option: --enable-framework\n\n-- Option: --enable-framework=INSTALLDIR\n\nCreate a Python.framework rather than a traditional Unix install.\nOptional 'INSTALLDIR' specifies the installation path (default is\nno).\n\n-- Option: --with-universal-archs=ARCH\n\nSpecify the kind of universal binary that should be created.  This\noption is only valid when *note -enable-universalsdk: 78d. is set.\n\nOptions:\n\n* 'universal2';\n\n* '32-bit';\n\n* '64-bit';\n\n* '3-way';\n\n* 'intel';\n\n* 'intel-32';\n\n* 'intel-64';\n\n* 'all'.\n\n-- Option: --with-framework-name=FRAMEWORK\n\nSpecify the name for the python framework on macOS only valid when\n*note -enable-framework: 1b1b. is set (default: 'Python').\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Cross Compiling Options,  Prev: macOS Options,  Up: Configure Options": {
            "content": "3.3.3.11 Cross Compiling Options\n................................\n",
            "subsections": []
        },
        "Cross compiling, also known as cross building, can be used to build": {
            "content": "",
            "subsections": []
        },
        "Python for another CPU architecture or platform.  Cross compiling": {
            "content": "requires a Python interpreter for the build platform.  The version of\nthe build Python must match the version of the cross compiled host\nPython.\n\n-- Option: --build=BUILD\n\nconfigure for building on BUILD, usually guessed by 'config.guess'.\n\n-- Option: --host=HOST\n\ncross-compile to build programs to run on HOST (target platform)\n\n-- Option: --with-build-python=path/to/python\n\npath to build 'python' binary for cross compiling\n\nNew in version 3.11.\n\n-- Option: CONFIGSITE=file\n\nAn environment variable that points to a file with configure\noverrides.\n\nExample 'config.site' file:\n\n# config.site-aarch64\naccvbuggygetaddrinfo=no\naccvfiledevptmx=yes\naccvfiledevptc=no\n\nCross compiling example:\n\nCONFIGSITE=config.site-aarch64 ../configure \\\n--build=x8664-pc-linux-gnu \\\n--host=aarch64-unknown-linux-gnu \\\n--with-build-python=../x8664/python\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python Build System,  Next: Compiler and linker flags,  Prev: Configure Options,  Up: Configure Python": {
            "content": "* Menu:\n\n* Main files of the build system::\n* Main build steps::\n* Main Makefile targets::\n* C extensions::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Main files of the build system,  Next: Main build steps,  Up: Python Build System": {
            "content": "3.3.4.1 Main files of the build system\n......................................\n\n* 'configure.ac' => 'configure';\n\n* 'Makefile.pre.in' => 'Makefile' (created by 'configure');\n\n* 'pyconfig.h' (created by 'configure');\n\n* 'Modules/Setup': C extensions built by the Makefile using\n'Module/makesetup' shell script;\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Main build steps,  Next: Main Makefile targets,  Prev: Main files of the build system,  Up: Python Build System": {
            "content": "3.3.4.2 Main build steps\n........................\n\n* C files ('.c') are built as object files ('.o').\n\n* A static 'libpython' library ('.a') is created from objects files.\n\n* 'python.o' and the static 'libpython' library are linked into the\nfinal 'python' program.\n\n* C extensions are built by the Makefile (see 'Modules/Setup').\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Main Makefile targets,  Next: C extensions,  Prev: Main build steps,  Up: Python Build System": {
            "content": "3.3.4.3 Main Makefile targets\n.............................\n\n* 'make': Build Python with the standard library.\n\n* 'make platform:': build the 'python' program, but don't build the\nstandard library extension modules.\n\n* 'make profile-opt': build Python using Profile Guided Optimization\n(PGO). You can use the configure *note -enable-optimizations: 65d.\noption to make this the default target of the 'make' command ('make\nall' or just 'make').\n\n* 'make buildbottest': Build Python and run the Python test suite,\nthe same way than buildbots test Python.  Set 'TESTTIMEOUT'\nvariable (in seconds) to change the test timeout (1200 by default:\n20 minutes).\n\n* 'make install': Build and install Python.\n\n* 'make regen-all': Regenerate (almost) all generated files; 'make\nregen-stdlib-module-names' and 'autoconf' must be run separately\nfor the remaining generated files.\n\n* 'make clean': Remove built files.\n\n* 'make distclean': Same than 'make clean', but remove also files\ncreated by the configure script.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: C extensions,  Prev: Main Makefile targets,  Up: Python Build System": {
            "content": "3.3.4.4 C extensions\n....................\n\nSome C extensions are built as built-in modules, like the 'sys' module.",
            "subsections": []
        },
        "They are built with the 'PyBUILDCOREBUILTIN' macro defined.  Built-in": {
            "content": "modules have no 'file' attribute:\n\n>>> import sys\n>>> sys\n<module 'sys' (built-in)>\n>>> sys.file\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nAttributeError: module 'sys' has no attribute 'file'\n",
            "subsections": []
        },
        "Other C extensions are built as dynamic libraries, like the 'asyncio'": {
            "content": "module.  They are built with the 'PyBUILDCOREMODULE' macro defined.\nExample on Linux x86-64:\n\n>>> import asyncio\n>>> asyncio\n<module 'asyncio' from '/usr/lib64/python3.9/lib-dynload/asyncio.cpython-39-x8664-linux-gnu.so'>\n>>> asyncio.file\n'/usr/lib64/python3.9/lib-dynload/asyncio.cpython-39-x8664-linux-gnu.so'\n\n'Modules/Setup' is used to generate Makefile targets to build C\nextensions.  At the beginning of the files, C extensions are built as\nbuilt-in modules.  Extensions defined after the '*shared*' marker are\nbuilt as dynamic libraries.\n\nThe 'PyAPIFUNC()', 'PyAPIDATA()' and *note PyMODINITFUNC: 132e.\nmacros of 'Include/exports.h' are defined differently depending if the\n'PyBUILDCOREMODULE' macro is defined:\n\n* Use 'PyEXPORTEDSYMBOL' if the 'PyBUILDCOREMODULE' is defined\n\n* Use 'PyIMPORTEDSYMBOL' otherwise.\n",
            "subsections": []
        },
        "If the 'PyBUILDCOREBUILTIN' macro is used by mistake on a C extension": {
            "content": "built as a shared library, its 'PyInitXXX()' function is not exported,\ncausing an *note ImportError: 145. on import.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Compiler and linker flags,  Prev: Python Build System,  Up: Configure Python": {
            "content": "",
            "subsections": []
        },
        "Options set by the './configure' script and environment variables and": {
            "content": "used by 'Makefile'.\n\n* Menu:\n\n* Preprocessor flags::\n* Compiler flags::\n* Linker flags::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Preprocessor flags,  Next: Compiler flags,  Up: Compiler and linker flags": {
            "content": "3.3.5.1 Preprocessor flags\n..........................\n\n-- Environment Variable: CONFIGURECPPFLAGS\n\nValue of *note CPPFLAGS: 1310. variable passed to the './configure'\nscript.\n\nNew in version 3.6.\n\n-- Environment Variable: CPPFLAGS\n\n(Objective) C/C++ preprocessor flags, e.g.  '-IINCLUDEDIR' if you\nhave headers in a nonstandard directory 'includedir'.\n\nBoth *note CPPFLAGS: 1310. and *note LDFLAGS: 130f. need to contain\nthe shell's value to be able to build extension modules using the\ndirectories specified in the environment variables.\n\n-- Environment Variable: BASECPPFLAGS\n\nNew in version 3.4.\n\n-- Environment Variable: PYCPPFLAGS\n\nExtra preprocessor flags added for building the interpreter object\nfiles.\n\nDefault: '$(BASECPPFLAGS) -I. -I$(srcdir)/Include\n$(CONFIGURECPPFLAGS) $(CPPFLAGS)'.\n\nNew in version 3.2.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Compiler flags,  Next: Linker flags,  Prev: Preprocessor flags,  Up: Compiler and linker flags": {
            "content": "3.3.5.2 Compiler flags\n......................\n\n-- Environment Variable: CC\n\nC compiler command.\n\nExample: 'gcc -pthread'.\n\n-- Environment Variable: CXX\n\nC++ compiler command.\n\nExample: 'g++ -pthread'.\n\n-- Environment Variable: CFLAGS\n\nC compiler flags.\n\n-- Environment Variable: CFLAGSNODIST\n\n*note CFLAGSNODIST: 1b30. is used for building the interpreter and\nstdlib C extensions.  Use it when a compiler flag should 'not' be\npart of *note CFLAGS: 130e. once Python is installed (gh-65320(1)).\n\nIn particular, *note CFLAGS: 130e. should not contain:\n\n* the compiler flag '-I' (for setting the search path for\ninclude files).  The '-I' flags are processed from left to\nright, and any flags in *note CFLAGS: 130e. would take\nprecedence over user- and package-supplied '-I' flags.\n\n* hardening flags such as '-Werror' because distributions cannot\ncontrol whether packages installed by users conform to such\nheightened standards.\n\nNew in version 3.5.\n\n-- Environment Variable: COMPILEALLOPTS\n\nOptions passed to the *note compileall: 1e. command line when\nbuilding PYC files in 'make install'.  Default: '-j0'.\n\nNew in version 3.12.\n\n-- Environment Variable: EXTRACFLAGS\n\nExtra C compiler flags.\n\n-- Environment Variable: CONFIGURECFLAGS\n\nValue of *note CFLAGS: 130e. variable passed to the './configure'\nscript.\n\nNew in version 3.2.\n\n-- Environment Variable: CONFIGURECFLAGSNODIST\n\nValue of *note CFLAGSNODIST: 1b30. variable passed to the\n'./configure' script.\n\nNew in version 3.5.\n\n-- Environment Variable: BASECFLAGS\n\nBase compiler flags.\n\n-- Environment Variable: OPT\n\nOptimization flags.\n\n-- Environment Variable: CFLAGSALIASING\n\nStrict or non-strict aliasing flags used to compile\n'Python/dtoa.c'.\n\nNew in version 3.7.\n\n-- Environment Variable: CCSHARED\n\nCompiler flags used to build a shared library.\n\nFor example, '-fPIC' is used on Linux and on BSD.\n\n-- Environment Variable: CFLAGSFORSHARED\n\nExtra C flags added for building the interpreter object files.\n\nDefault: '$(CCSHARED)' when *note -enable-shared: 65e. is used, or\nan empty string otherwise.\n\n-- Environment Variable: PYCFLAGS\n\nDefault: '$(BASECFLAGS) $(OPT) $(CONFIGURECFLAGS) $(CFLAGS)\n$(EXTRACFLAGS)'.\n\n-- Environment Variable: PYCFLAGSNODIST\n\nDefault: '$(CONFIGURECFLAGSNODIST) $(CFLAGSNODIST)\n-I$(srcdir)/Include/internal'.\n\nNew in version 3.5.\n\n-- Environment Variable: PYSTDMODULECFLAGS\n\nC flags used for building the interpreter object files.\n\nDefault: '$(PYCFLAGS) $(PYCFLAGSNODIST) $(PYCPPFLAGS)\n$(CFLAGSFORSHARED)'.\n\nNew in version 3.7.\n\n-- Environment Variable: PYCORECFLAGS\n\nDefault: '$(PYSTDMODULECFLAGS) -DPyBUILDCORE'.\n\nNew in version 3.2.\n\n-- Environment Variable: PYBUILTINMODULECFLAGS\n\nCompiler flags to build a standard library extension module as a\nbuilt-in module, like the *note posix: a8. module.\n\nDefault: '$(PYSTDMODULECFLAGS) -DPyBUILDCOREBUILTIN'.\n\nNew in version 3.8.\n\n-- Environment Variable: PURIFY\n\nPurify command.  Purify is a memory debugger program.\n\nDefault: empty string (not used).\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/65320\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Linker flags,  Prev: Compiler flags,  Up: Compiler and linker flags": {
            "content": "3.3.5.3 Linker flags\n....................\n\n-- Environment Variable: LINKCC\n\nLinker command used to build programs like 'python' and\n'testembed'.\n\nDefault: '$(PURIFY) $(CC)'.\n\n-- Environment Variable: CONFIGURELDFLAGS\n\nValue of *note LDFLAGS: 130f. variable passed to the './configure'\nscript.\n\nAvoid assigning *note CFLAGS: 130e, *note LDFLAGS: 130f, etc.  so\nusers can use them on the command line to append to these values\nwithout stomping the pre-set values.\n\nNew in version 3.2.\n\n-- Environment Variable: LDFLAGSNODIST\n\n*note LDFLAGSNODIST: 1b42. is used in the same manner as *note\nCFLAGSNODIST: 1b30.  Use it when a linker flag should 'not' be\npart of *note LDFLAGS: 130f. once Python is installed\n(gh-65320(1)).\n\nIn particular, *note LDFLAGS: 130f. should not contain:\n\n* the compiler flag '-L' (for setting the search path for\nlibraries).  The '-L' flags are processed from left to right,\nand any flags in *note LDFLAGS: 130f. would take precedence\nover user- and package-supplied '-L' flags.\n\n-- Environment Variable: CONFIGURELDFLAGSNODIST\n\nValue of *note LDFLAGSNODIST: 1b42. variable passed to the\n'./configure' script.\n\nNew in version 3.8.\n\n-- Environment Variable: LDFLAGS\n\nLinker flags, e.g.  '-LLIBDIR' if you have libraries in a\nnonstandard directory 'libdir'.\n\nBoth *note CPPFLAGS: 1310. and *note LDFLAGS: 130f. need to contain\nthe shell's value to be able to build extension modules using the\ndirectories specified in the environment variables.\n\n-- Environment Variable: LIBS\n\nLinker flags to pass libraries to the linker when linking the\nPython executable.\n\nExample: '-lrt'.\n\n-- Environment Variable: LDSHARED\n\nCommand to build a shared library.\n\nDefault: '@LDSHARED@ $(PYLDFLAGS)'.\n\n-- Environment Variable: BLDSHARED\n\nCommand to build 'libpython' shared library.\n\nDefault: '@BLDSHARED@ $(PYCORELDFLAGS)'.\n\n-- Environment Variable: PYLDFLAGS\n\nDefault: '$(CONFIGURELDFLAGS) $(LDFLAGS)'.\n\n-- Environment Variable: PYLDFLAGSNODIST\n\nDefault: '$(CONFIGURELDFLAGSNODIST) $(LDFLAGSNODIST)'.\n\nNew in version 3.8.\n\n-- Environment Variable: PYCORELDFLAGS\n\nLinker flags used for building the interpreter object files.\n\nNew in version 3.8.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/65320\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using Python on Windows,  Next: Using Python on a Mac,  Prev: Configure Python,  Up: Python Setup and Usage": {
            "content": "",
            "subsections": [
                {
                    "name": "3.4 Using Python on Windows",
                    "content": ""
                }
            ]
        },
        "This document aims to give an overview of Windows-specific behaviour you": {
            "content": "should know about when using Python on Microsoft Windows.\n",
            "subsections": []
        },
        "Unlike most Unix systems and services, Windows does not include a system": {
            "content": "supported installation of Python.  To make Python available, the CPython\nteam has compiled Windows installers with every release(1) for many\nyears.  These installers are primarily intended to add a per-user\ninstallation of Python, with the core interpreter and library being used\nby a single user.  The installer is also able to install for all users\nof a single machine, and a separate ZIP file is available for\napplication-local distributions.\n",
            "subsections": []
        },
        "As specified in PEP 11(2), a Python release only supports a Windows": {
            "content": "platform while Microsoft considers the platform under extended support.",
            "subsections": []
        },
        "This means that Python 3.12 supports Windows 8.1 and newer.  If you": {
            "content": "require Windows 7 support, please install Python 3.8.\n",
            "subsections": []
        },
        "There are a number of different installers available for Windows, each": {
            "content": "with certain benefits and downsides.\n\n*note The full installer: 1b4c. contains all components and is the best\noption for developers using Python for any kind of project.\n\n*note The Microsoft Store package: 1969. is a simple installation of",
            "subsections": []
        },
        "Python that is suitable for running scripts and packages, and using IDLE": {
            "content": "or other development environments.  It requires Windows 10 and above,\nbut can be safely installed without corrupting other programs.  It also\nprovides many convenient commands for launching Python and its tools.\n\n*note The nuget.org packages: 1b4d. are lightweight installations\nintended for continuous integration systems.  It can be used to build",
            "subsections": []
        },
        "Python packages or run scripts, but is not updateable and has no user": {
            "content": "interface tools.\n\n*note The embeddable package: 1b4e. is a minimal package of Python\nsuitable for embedding into a larger application.\n\n* Menu:\n\n* The full installer::\n* The Microsoft Store package::\n* The nuget.org packages: The nuget org packages.\n* The embeddable package::\n* Alternative bundles::\n* Configuring Python::\n* UTF-8 mode::\n* Python Launcher for Windows::\n* Finding modules::\n* Additional modules::\n* Compiling Python on Windows::\n* Other Platforms::\n\n---------- Footnotes ----------\n\n(1) https://www.python.org/downloads/\n\n(2) https://peps.python.org/pep-0011/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The full installer,  Next: The Microsoft Store package,  Up: Using Python on Windows": {
            "content": "* Menu:\n\n* Installation steps::\n* Removing the MAXPATH Limitation::\n* Installing Without UI::\n* Installing Without Downloading::\n* Modifying an install::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Installation steps,  Next: Removing the MAXPATH Limitation,  Up: The full installer": {
            "content": "3.4.1.1 Installation steps\n..........................\n",
            "subsections": []
        },
        "Four Python 3.12 installers are available for download - two each for": {
            "content": "the 32-bit and 64-bit versions of the interpreter.  The 'web installer'\nis a small initial download, and it will automatically download the\nrequired components as necessary.  The 'offline installer' includes the\ncomponents necessary for a default installation and only requires an\ninternet connection for optional features.  See *note Installing Without",
            "subsections": []
        },
        "Downloading: 1b51. for other ways to avoid downloading during": {
            "content": "installation.\n\nAfter starting the installer, one of two options may be selected:\n\n\n\n\nIf you select \"Install Now\":\n\n* You will 'not' need to be an administrator (unless a system update\nfor the C Runtime Library is required or you install the *note\nPython Launcher for Windows: 37f. for all users)\n\n* Python will be installed into your user directory\n\n* The *note Python Launcher for Windows: 37f. will be installed\naccording to the option at the bottom of the first page\n\n* The standard library, test suite, launcher and pip will be\ninstalled\n\n* If selected, the install directory will be added to your 'PATH'\n\n* Shortcuts will only be visible for the current user\n\nSelecting \"Customize installation\" will allow you to select the features\nto install, the installation location and other options or post-install\nactions.  To install debugging symbols or binaries, you will need to use\nthis option.\n\nTo perform an all-users installation, you should select \"Customize\ninstallation\".  In this case:\n\n* You may be required to provide administrative credentials or\napproval\n\n* Python will be installed into the Program Files directory\n\n* The *note Python Launcher for Windows: 37f. will be installed into\nthe Windows directory\n\n* Optional features may be selected during installation\n\n* The standard library can be pre-compiled to bytecode\n\n* If selected, the install directory will be added to the system\n'PATH'\n\n* Shortcuts are available for all users\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Removing the MAXPATH Limitation,  Next: Installing Without UI,  Prev: Installation steps,  Up: The full installer": {
            "content": "3.4.1.2 Removing the MAXPATH Limitation\n........................................\n",
            "subsections": []
        },
        "Windows historically has limited path lengths to 260 characters.  This": {
            "content": "meant that paths longer than this would not resolve and errors would\nresult.\n",
            "subsections": []
        },
        "In the latest versions of Windows, this limitation can be expanded to": {
            "content": "approximately 32,000 characters.  Your administrator will need to\nactivate the \"Enable Win32 long paths\" group policy, or set\n'LongPathsEnabled' to '1' in the registry key\n'HKEYLOCALMACHINE\\SYSTEM\\CurrentControlSet\\Control\\FileSystem'.\n\nThis allows the *note open(): 26e. function, the *note os: 9c. module\nand most other path functionality to accept and return paths longer than\n260 characters.\n\nAfter changing the above option, no further configuration is required.\n\nChanged in version 3.6: Support for long paths was enabled in Python.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Installing Without UI,  Next: Installing Without Downloading,  Prev: Removing the MAXPATH Limitation,  Up: The full installer": {
            "content": "3.4.1.3 Installing Without UI\n.............................\n",
            "subsections": []
        },
        "All of the options available in the installer UI can also be specified": {
            "content": "from the command line, allowing scripted installers to replicate an\ninstallation on many machines without user interaction.  These options\nmay also be set without suppressing the UI in order to change some of\nthe defaults.\n\nThe following options (found by executing the installer with '/?') can\nbe passed into the installer:\n",
            "subsections": []
        },
        "Name                      Description": {
            "content": "---------------------------------------------------------------------------------------\n\n/passive                  to display progress without requiring user interaction\n\n\n/quiet                    to install/uninstall without displaying any UI\n\n\n/simple                   to prevent user customization\n\n\n/uninstall                to remove Python (without confirmation)\n\n\n/layout [directory]       to pre-download all components\n\n\n/log [filename]           to specify log files location\n\n\nAll other options are passed as 'name=value', where the value is usually\n'0' to disable a feature, '1' to enable a feature, or a path.  The full\nlist of available options is shown below.\n",
            "subsections": []
        },
        "Name                            Description                                Default": {
            "content": "----------------------------------------------------------------------------------------------------------\n",
            "subsections": []
        },
        "InstallAllUsers                 Perform a system-wide installation.        0": {
            "content": "",
            "subsections": []
        },
        "TargetDir                       The installation directory                 Selected based on": {
            "content": "InstallAllUsers\n\n\nDefaultAllUsersTargetDir        The default installation directory for     '%ProgramFiles%\\Python X.Y'\nall-user installs                          or\n'%ProgramFiles(x86)%\\Python\nX.Y'\n\n\nDefaultJustForMeTargetDir       The default install directory for          '%LocalAppData%\\Programs\\Python\\PythonXY'\njust-for-me installs                       or\n'%LocalAppData%\\Programs\\Python\\PythonXY-32'\nor\n'%LocalAppData%\\Programs\\Python\\PythonXY-64'\n\n",
            "subsections": []
        },
        "DefaultCustomTargetDir          The default custom install directory       (empty)": {
            "content": "displayed in the UI\n\n",
            "subsections": []
        },
        "AssociateFiles                  Create file associations if the launcher   1": {
            "content": "is also installed.\n\n",
            "subsections": []
        },
        "CompileAll                      Compile all '.py' files to '.pyc'.         0": {
            "content": "",
            "subsections": []
        },
        "PrependPath                     Prepend install and Scripts directories    0": {
            "content": "to 'PATH' and add '.PY' to 'PATHEXT'\n\n",
            "subsections": []
        },
        "AppendPath                      Append install and Scripts directories     0": {
            "content": "to 'PATH' and add '.PY' to 'PATHEXT'\n\n",
            "subsections": []
        },
        "Shortcuts                       Create shortcuts for the interpreter,      1": {
            "content": "documentation and IDLE if installed.\n\n",
            "subsections": []
        },
        "Includedoc                     Install Python manual                      1": {
            "content": "",
            "subsections": []
        },
        "Includedebug                   Install debug binaries                     0": {
            "content": "",
            "subsections": []
        },
        "Includedev                     Install developer headers and libraries.   1": {
            "content": "Omitting this may lead to an unusable\ninstallation.\n\n",
            "subsections": []
        },
        "Includeexe                     Install 'python.exe' and related files.    1": {
            "content": "Omitting this may lead to an unusable\ninstallation.\n\n",
            "subsections": []
        },
        "Includelauncher                Install                                    1": {
            "content": "*note Python Launcher for Windows: 37f.\n\n",
            "subsections": []
        },
        "InstallLauncherAllUsers         Installs the launcher for all users.       1": {
            "content": "Also requires 'Includelauncher' to be\nset to 1\n\n",
            "subsections": []
        },
        "Includelib                     Install standard library and extension     1": {
            "content": "modules.  Omitting this may lead to an\nunusable installation.\n\n",
            "subsections": []
        },
        "Includepip                     Install bundled pip and setuptools         1": {
            "content": "Includesymbols                 Install debugging symbols ('*.pdb')        0\n\n",
            "subsections": []
        },
        "Includetcltk                   Install Tcl/Tk support and IDLE            1": {
            "content": "",
            "subsections": []
        },
        "Includetest                    Install standard library test suite        1": {
            "content": "",
            "subsections": []
        },
        "Includetools                   Install utility scripts                    1": {
            "content": "",
            "subsections": []
        },
        "LauncherOnly                    Only installs the launcher.  This will     0": {
            "content": "override most other options.\n\n",
            "subsections": []
        },
        "SimpleInstall                   Disable most install UI                    0": {
            "content": "",
            "subsections": []
        },
        "SimpleInstallDescription        A custom message to display when the       (empty)": {
            "content": "simplified install UI is used.\n\n",
            "subsections": []
        },
        "For example, to silently install a default, system-wide Python": {
            "content": "installation, you could use the following command (from an elevated\ncommand prompt):\n\npython-3.9.0.exe /quiet InstallAllUsers=1 PrependPath=1 Includetest=0\n",
            "subsections": []
        },
        "To allow users to easily install a personal copy of Python without the": {
            "content": "test suite, you could provide a shortcut with the following command.\nThis will display a simplified initial page and disallow customization:\n\npython-3.9.0.exe InstallAllUsers=0 Includelauncher=0 Includetest=0\nSimpleInstall=1 SimpleInstallDescription=\"Just for me, no test suite.\"\n\n(Note that omitting the launcher also omits file associations, and is\nonly recommended for per-user installs when there is also a system-wide\ninstallation that included the launcher.)\n",
            "subsections": []
        },
        "The options listed above can also be provided in a file named": {
            "content": "'unattend.xml' alongside the executable.  This file specifies a list of\noptions and values.  When a value is provided as an attribute, it will\nbe converted to a number if possible.  Values provided as element text\nare always left as strings.  This example file sets the same options as\nthe previous example:\n\n<Options>\n<Option Name=\"InstallAllUsers\" Value=\"no\" />\n<Option Name=\"Includelauncher\" Value=\"0\" />\n<Option Name=\"Includetest\" Value=\"no\" />\n<Option Name=\"SimpleInstall\" Value=\"yes\" />\n<Option Name=\"SimpleInstallDescription\">Just for me, no test suite</Option>\n</Options>\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Installing Without Downloading,  Next: Modifying an install,  Prev: Installing Without UI,  Up: The full installer": {
            "content": "3.4.1.4 Installing Without Downloading\n......................................\n",
            "subsections": []
        },
        "As some features of Python are not included in the initial installer": {
            "content": "download, selecting those features may require an internet connection.",
            "subsections": []
        },
        "To avoid this need, all possible components may be downloaded on-demand": {
            "content": "to create a complete 'layout' that will no longer require an internet\nconnection regardless of the selected features.  Note that this download\nmay be bigger than required, but where a large number of installations\nare going to be performed it is very useful to have a locally cached\ncopy.\n",
            "subsections": []
        },
        "Execute the following command from Command Prompt to download all": {
            "content": "possible required files.  Remember to substitute 'python-3.9.0.exe' for\nthe actual name of your installer, and to create layouts in their own\ndirectories to avoid collisions between files with the same name.\n\npython-3.9.0.exe /layout [optional target directory]\n\nYou may also specify the '/quiet' option to hide the progress display.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Modifying an install,  Prev: Installing Without Downloading,  Up: The full installer": {
            "content": "3.4.1.5 Modifying an install\n............................\n",
            "subsections": []
        },
        "Once Python has been installed, you can add or remove features through": {
            "content": "the Programs and Features tool that is part of Windows.  Select the\nPython entry and choose \"Uninstall/Change\" to open the installer in\nmaintenance mode.\n\n\"Modify\" allows you to add or remove features by modifying the\ncheckboxes - unchanged checkboxes will not install or remove anything.",
            "subsections": []
        },
        "Some options cannot be changed in this mode, such as the install": {
            "content": "directory; to modify these, you will need to remove and then reinstall\nPython completely.\n\n\"Repair\" will verify all the files that should be installed using the\ncurrent settings and replace any that have been removed or modified.\n\n\"Uninstall\" will remove Python entirely, with the exception of the *note",
            "subsections": []
        },
        "Python Launcher for Windows: 37f, which has its own entry in Programs": {
            "content": "and Features.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The Microsoft Store package,  Next: The nuget org packages,  Prev: The full installer,  Up: Using Python on Windows": {
            "content": "New in version 3.7.2.\n",
            "subsections": []
        },
        "The Microsoft Store package is an easily installable Python interpreter": {
            "content": "that is intended mainly for interactive use, for example, by students.\n",
            "subsections": []
        },
        "To install the package, ensure you have the latest Windows 10 updates": {
            "content": "and search the Microsoft Store app for \"Python 3.12\".  Ensure that the\napp you select is published by the Python Software Foundation, and\ninstall it.\n\nWarning: Python will always be available for free on the Microsoft\nStore.  If you are asked to pay for it, you have not selected the\ncorrect package.\n\nAfter installation, Python may be launched by finding it in Start.",
            "subsections": []
        },
        "Alternatively, it will be available from any Command Prompt or": {
            "content": "",
            "subsections": []
        },
        "PowerShell session by typing 'python'.  Further, pip and IDLE may be": {
            "content": "used by typing 'pip' or 'idle'.  IDLE can also be found in Start.\n",
            "subsections": []
        },
        "All three commands are also available with version number suffixes, for": {
            "content": "example, as 'python3.exe' and 'python3.x.exe' as well as 'python.exe'\n(where '3.x' is the specific version you want to launch, such as 3.12).\nOpen \"Manage App Execution Aliases\" through Start to select which\nversion of Python is associated with each command.  It is recommended to\nmake sure that 'pip' and 'idle' are consistent with whichever version of\n'python' is selected.\n",
            "subsections": []
        },
        "Virtual environments can be created with 'python -m venv' and activated": {
            "content": "and used as normal.\n",
            "subsections": []
        },
        "If you have installed another version of Python and added it to your": {
            "content": "'PATH' variable, it will be available as 'python.exe' rather than the\none from the Microsoft Store.  To access the new installation, use\n'python3.exe' or 'python3.x.exe'.\n",
            "subsections": []
        },
        "The 'py.exe' launcher will detect this Python installation, but will": {
            "content": "prefer installations from the traditional installer.\n",
            "subsections": []
        },
        "To remove Python, open Settings and use Apps and Features, or else find": {
            "content": "",
            "subsections": []
        },
        "Python in Start and right-click to select Uninstall.  Uninstalling will": {
            "content": "remove all packages you installed directly into this Python\ninstallation, but will not remove any virtual environments\n\n* Menu:\n\n* Known issues::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Known issues,  Up: The Microsoft Store package": {
            "content": "3.4.2.1 Known issues\n....................\n\n* Menu:\n\n* Redirection of local data, registry, and temporary paths: Redirection of local data registry and temporary paths.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Redirection of local data registry and temporary paths,  Up: Known issues": {
            "content": "3.4.2.2 Redirection of local data, registry, and temporary paths\n................................................................\n",
            "subsections": []
        },
        "Because of restrictions on Microsoft Store apps, Python scripts may not": {
            "content": "have full write access to shared locations such as 'TEMP' and the\nregistry.  Instead, it will write to a private copy.  If your scripts\nmust modify the shared locations, you will need to install the full\ninstaller.\n",
            "subsections": []
        },
        "At runtime, Python will use a private copy of well-known Windows folders": {
            "content": "and the registry.  For example, if the environment variable '%APPDATA%'\nis 'c:\\Users\\<user>\\AppData\\', then when writing to\n'C:\\Users\\<user>\\AppData\\Local' will write to\n'C:\\Users\\<user>\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.8qbz5n2kfra8p0\\LocalCache\\Local\\'.\n",
            "subsections": []
        },
        "When reading files, Windows will return the file from the private": {
            "content": "folder, or if that does not exist, the real Windows directory.  For\nexample reading 'C:\\Windows\\System32' returns the contents of\n'C:\\Windows\\System32' plus the contents of 'C:\\Program\nFiles\\WindowsApps\\packagename\\VFS\\SystemX86'.\n\nYou can find the real path of any existing file using *note\nos.path.realpath(): 351.:\n\n>>> import os\n>>> testfile = 'C:\\\\Users\\\\example\\\\AppData\\\\Local\\\\test.txt'\n>>> os.path.realpath(testfile)\n'C:\\\\Users\\\\example\\\\AppData\\\\Local\\\\Packages\\\\PythonSoftwareFoundation.Python.3.8qbz5n2kfra8p0\\\\LocalCache\\\\Local\\\\test.txt'\n\nWhen writing to the Windows Registry, the following behaviors exist:\n\n* Reading from 'HKLM\\\\Software' is allowed and results are merged\nwith the 'registry.dat' file in the package.\n\n* Writing to 'HKLM\\\\Software' is not allowed if the corresponding\nkey/value exists, i.e.  modifying existing keys.\n\n* Writing to 'HKLM\\\\Software' is allowed as long as a corresponding\nkey/value does not exist in the package and the user has the\ncorrect access permissions.\n",
            "subsections": []
        },
        "For more detail on the technical basis for these limitations, please": {
            "content": "consult Microsoft's documentation on packaged full-trust apps, currently\navailable at\ndocs.microsoft.com/en-us/windows/msix/desktop/desktop-to-uwp-behind-the-scenes(1)\n\n---------- Footnotes ----------\n\n(1)\nhttps://docs.microsoft.com/en-us/windows/msix/desktop/desktop-to-uwp-behind-the-scenes\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The nuget org packages,  Next: The embeddable package,  Prev: The Microsoft Store package,  Up: Using Python on Windows": {
            "content": "New in version 3.5.2.\n",
            "subsections": []
        },
        "The nuget.org package is a reduced size Python environment intended for": {
            "content": "use on continuous integration and build systems that do not have a\nsystem-wide install of Python.  While nuget is \"the package manager for\n.NET\", it also works perfectly fine for packages containing build-time\ntools.\n\nVisit nuget.org(1) for the most up-to-date information on using nuget.\nWhat follows is a summary that is sufficient for Python developers.\n",
            "subsections": []
        },
        "The 'nuget.exe' command line tool may be downloaded directly from": {
            "content": "'https://aka.ms/nugetclidl', for example, using curl or PowerShell.",
            "subsections": []
        },
        "With the tool, the latest version of Python for 64-bit or 32-bit": {
            "content": "machines is installed using:\n\nnuget.exe install python -ExcludeVersion -OutputDirectory .\nnuget.exe install pythonx86 -ExcludeVersion -OutputDirectory .\n",
            "subsections": []
        },
        "To select a particular version, add a '-Version 3.x.y'.  The output": {
            "content": "directory may be changed from '.', and the package will be installed\ninto a subdirectory.  By default, the subdirectory is named the same as\nthe package, and without the '-ExcludeVersion' option this name will\ninclude the specific version installed.  Inside the subdirectory is a\n'tools' directory that contains the Python installation:\n\n# Without -ExcludeVersion\n> .\\python.3.5.2\\tools\\python.exe -V\nPython 3.5.2\n\n# With -ExcludeVersion\n> .\\python\\tools\\python.exe -V\nPython 3.5.2\n",
            "subsections": []
        },
        "In general, nuget packages are not upgradeable, and newer versions": {
            "content": "should be installed side-by-side and referenced using the full path.",
            "subsections": []
        },
        "Alternatively, delete the package directory manually and install it": {
            "content": "again.  Many CI systems will do this automatically if they do not\npreserve files between builds.\n\nAlongside the 'tools' directory is a 'build\\native' directory.  This\ncontains a MSBuild properties file 'python.props' that can be used in a\nC++ project to reference the Python install.  Including the settings\nwill automatically use the headers and import libraries in your build.\n",
            "subsections": []
        },
        "The package information pages on nuget.org are": {
            "content": "www.nuget.org/packages/python(2) for the 64-bit version and\nwww.nuget.org/packages/pythonx86(3) for the 32-bit version.\n\n---------- Footnotes ----------\n\n(1) https://www.nuget.org/\n\n(2) https://www.nuget.org/packages/python\n\n(3) https://www.nuget.org/packages/pythonx86\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The embeddable package,  Next: Alternative bundles,  Prev: The nuget org packages,  Up: Using Python on Windows": {
            "content": "New in version 3.5.\n",
            "subsections": []
        },
        "The embedded distribution is a ZIP file containing a minimal Python": {
            "content": "environment.  It is intended for acting as part of another application,\nrather than being directly accessed by end-users.\n",
            "subsections": []
        },
        "When extracted, the embedded distribution is (almost) fully isolated": {
            "content": "from the user's system, including environment variables, system registry\nsettings, and installed packages.  The standard library is included as\npre-compiled and optimized '.pyc' files in a ZIP, and 'python3.dll',\n'python37.dll', 'python.exe' and 'pythonw.exe' are all provided.  Tcl/tk\n(including all dependents, such as Idle), pip and the Python\ndocumentation are not included.\n\nNote: The embedded distribution does not include the Microsoft C\nRuntime(1) and it is the responsibility of the application\ninstaller to provide this.  The runtime may have already been\ninstalled on a user's system previously or automatically via\nWindows Update, and can be detected by finding 'ucrtbase.dll' in\nthe system directory.\n",
            "subsections": []
        },
        "Third-party packages should be installed by the application installer": {
            "content": "alongside the embedded distribution.  Using pip to manage dependencies\nas for a regular Python installation is not supported with this\ndistribution, though with some care it may be possible to include and\nuse pip for automatic updates.  In general, third-party packages should\nbe treated as part of the application (\"vendoring\") so that the\ndeveloper can ensure compatibility with newer versions before providing\nupdates to users.\n\nThe two recommended use cases for this distribution are described below.\n\n* Menu:\n\n* Python Application::\n* Embedding Python::\n\n---------- Footnotes ----------\n\n(1)\nhttps://docs.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist#visual-studio-2015-2017-2019-and-2022\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python Application,  Next: Embedding Python,  Up: The embeddable package": {
            "content": "3.4.4.1 Python Application\n..........................\n",
            "subsections": []
        },
        "An application written in Python does not necessarily require users to": {
            "content": "be aware of that fact.  The embedded distribution may be used in this\ncase to include a private version of Python in an install package.",
            "subsections": []
        },
        "Depending on how transparent it should be (or conversely, how": {
            "content": "professional it should appear), there are two options.\n",
            "subsections": []
        },
        "Using a specialized executable as a launcher requires some coding, but": {
            "content": "provides the most transparent experience for users.  With a customized\nlauncher, there are no obvious indications that the program is running\non Python: icons can be customized, company and version information can\nbe specified, and file associations behave properly.  In most cases, a\ncustom launcher should simply be able to call 'PyMain' with a\nhard-coded command line.\n",
            "subsections": []
        },
        "The simpler approach is to provide a batch file or generated shortcut": {
            "content": "that directly calls the 'python.exe' or 'pythonw.exe' with the required\ncommand-line arguments.  In this case, the application will appear to be",
            "subsections": []
        },
        "Python and not its actual name, and users may have trouble": {
            "content": "distinguishing it from other running Python processes or file\nassociations.\n",
            "subsections": []
        },
        "With the latter approach, packages should be installed as directories": {
            "content": "alongside the Python executable to ensure they are available on the\npath.  With the specialized launcher, packages can be located in other\nlocations as there is an opportunity to specify the search path before\nlaunching the application.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Embedding Python,  Prev: Python Application,  Up: The embeddable package": {
            "content": "3.4.4.2 Embedding Python\n........................\n",
            "subsections": []
        },
        "Applications written in native code often require some form of scripting": {
            "content": "language, and the embedded Python distribution can be used for this\npurpose.  In general, the majority of the application is in native code,\nand some part will either invoke 'python.exe' or directly use\n'python3.dll'.  For either case, extracting the embedded distribution to\na subdirectory of the application installation is sufficient to provide\na loadable Python interpreter.\n",
            "subsections": []
        },
        "As with the application use, packages can be installed to any location": {
            "content": "as there is an opportunity to specify search paths before initializing\nthe interpreter.  Otherwise, there is no fundamental differences between\nusing the embedded distribution and a regular installation.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Alternative bundles,  Next: Configuring Python,  Prev: The embeddable package,  Up: Using Python on Windows": {
            "content": "",
            "subsections": []
        },
        "Besides the standard CPython distribution, there are modified packages": {
            "content": "including additional functionality.  The following is a list of popular\nversions and their key features:\n",
            "subsections": []
        },
        "ActivePython(1)": {
            "content": "Installer with multi-platform compatibility, documentation, PyWin32\n",
            "subsections": []
        },
        "Anaconda(2)": {
            "content": "Popular scientific modules (such as numpy, scipy and pandas) and\nthe 'conda' package manager.\n",
            "subsections": []
        },
        "Enthought Deployment Manager(3)": {
            "content": "\"The Next Generation Python Environment and Package Manager\".\n\nPreviously Enthought provided Canopy, but it reached end of life in\n2016(4).\n",
            "subsections": []
        },
        "WinPython(5)": {
            "content": "Windows-specific distribution with prebuilt scientific packages and\ntools for building packages.\n",
            "subsections": []
        },
        "Note that these packages may not include the latest versions of Python": {
            "content": "or other libraries, and are not maintained or supported by the core\nPython team.\n\n---------- Footnotes ----------\n\n(1) https://www.activestate.com/products/python/\n\n(2) https://www.anaconda.com/download/\n\n(3) https://www.enthought.com/edm/\n\n(4)\nhttps://support.enthought.com/hc/en-us/articles/360038600051-Canopy-GUI-end-of-life-transition-to-the-Enthought-Deployment-Manager-EDM-and-Visual-Studio-Code\n\n(5) https://winpython.github.io/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Configuring Python,  Next: UTF-8 mode,  Prev: Alternative bundles,  Up: Using Python on Windows": {
            "content": "",
            "subsections": []
        },
        "To run Python conveniently from a command prompt, you might consider": {
            "content": "changing some default environment variables in Windows.  While the\ninstaller provides an option to configure the PATH and PATHEXT variables\nfor you, this is only reliable for a single, system-wide installation.",
            "subsections": []
        },
        "If you regularly use multiple versions of Python, consider using the": {
            "content": "*note Python Launcher for Windows: 37f.\n\n* Menu:\n\n* Excursus; Setting environment variables: Excursus Setting environment variables.\n* Finding the Python executable::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Excursus Setting environment variables,  Next: Finding the Python executable,  Up: Configuring Python": {
            "content": "3.4.6.1 Excursus: Setting environment variables\n...............................................\n",
            "subsections": []
        },
        "Windows allows environment variables to be configured permanently at": {
            "content": "both the User level and the System level, or temporarily in a command\nprompt.\n",
            "subsections": []
        },
        "To temporarily set environment variables, open Command Prompt and use": {
            "content": "the 'set' command:\n\nC:\\>set PATH=C:\\Program Files\\Python 3.9;%PATH%\nC:\\>set PYTHONPATH=%PYTHONPATH%;C:\\Mypythonlib\nC:\\>python\n",
            "subsections": []
        },
        "These changes will apply to any further commands executed in that": {
            "content": "console, and will be inherited by any applications started from the\nconsole.\n",
            "subsections": []
        },
        "Including the variable name within percent signs will expand to the": {
            "content": "existing value, allowing you to add your new value at either the start\nor the end.  Modifying 'PATH' by adding the directory containing\n'python.exe' to the start is a common way to ensure the correct version\nof Python is launched.\n",
            "subsections": []
        },
        "To permanently modify the default environment variables, click Start and": {
            "content": "search for 'edit environment variables', or open System properties,",
            "subsections": []
        },
        "Advanced system settings and click the Environment Variables button.  In": {
            "content": "this dialog, you can add or modify User and System variables.  To change\nSystem variables, you need non-restricted access to your machine (i.e.\nAdministrator rights).\n\nNote: Windows will concatenate User variables 'after' System\nvariables, which may cause unexpected results when modifying\n'PATH'.\n\nThe *note PYTHONPATH: e92. variable is used by all versions of\nPython, so you should not permanently configure it unless the\nlisted paths only include code that is compatible with all of your\ninstalled Python versions.\n\nSee also\n........\n\n'https://docs.microsoft.com/en-us/windows/win32/procthread/environment-variables'\n\nOverview of environment variables on Windows\n\n'https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/set1'\n\nThe 'set' command, for temporarily modifying environment variables\n\n'https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/setx'\n\nThe 'setx' command, for permanently modifying environment variables\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Finding the Python executable,  Prev: Excursus Setting environment variables,  Up: Configuring Python": {
            "content": "3.4.6.2 Finding the Python executable\n.....................................\n\nChanged in version 3.5.\n",
            "subsections": []
        },
        "Besides using the automatically created start menu entry for the Python": {
            "content": "interpreter, you might want to start Python in the command prompt.  The\ninstaller has an option to set that up for you.\n\nOn the first page of the installer, an option labelled \"Add Python to\nPATH\" may be selected to have the installer add the install location\ninto the 'PATH'.  The location of the 'Scripts\\' folder is also added.",
            "subsections": []
        },
        "This allows you to type 'python' to run the interpreter, and 'pip' for": {
            "content": "the package installer.  Thus, you can also execute your scripts with\ncommand line options, see *note Command line: e7b. documentation.\n",
            "subsections": []
        },
        "If you don't enable this option at install time, you can always re-run": {
            "content": "the installer, select Modify, and enable it.  Alternatively, you can\nmanually modify the 'PATH' using the directions in *note Excursus;",
            "subsections": []
        },
        "Setting environment variables: 196a.  You need to set your 'PATH'": {
            "content": "environment variable to include the directory of your Python\ninstallation, delimited by a semicolon from other entries.  An example\nvariable could look like this (assuming the first two entries already\nexisted):\n\nC:\\WINDOWS\\system32;C:\\WINDOWS;C:\\Program Files\\Python 3.9\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: UTF-8 mode,  Next: Python Launcher for Windows,  Prev: Configuring Python,  Up: Using Python on Windows": {
            "content": "New in version 3.7.\n",
            "subsections": []
        },
        "Windows still uses legacy encodings for the system encoding (the ANSI": {
            "content": "Code Page).  Python uses it for the default encoding of text files (e.g.\n*note locale.getencoding(): 41f.).\n",
            "subsections": []
        },
        "This may cause issues because UTF-8 is widely used on the internet and": {
            "content": "most Unix systems, including WSL (Windows Subsystem for Linux).\n\nYou can use the *note Python UTF-8 Mode: 420. to change the default text\nencoding to UTF-8.  You can enable the *note Python UTF-8 Mode: 420. via\nthe '-X utf8' command line option, or the 'PYTHONUTF8=1' environment\nvariable.  See *note PYTHONUTF8: 90e. for enabling UTF-8 mode, and *note",
            "subsections": []
        },
        "Excursus; Setting environment variables: 196a. for how to modify": {
            "content": "environment variables.\n\nWhen the *note Python UTF-8 Mode: 420. is enabled, you can still use the\nsystem encoding (the ANSI Code Page) via the \"mbcs\" codec.\n\nNote that adding 'PYTHONUTF8=1' to the default environment variables\nwill affect all Python 3.7+ applications on your system.  If you have\nany Python 3.7+ applications which rely on the legacy system encoding,\nit is recommended to set the environment variable temporarily or use the\n'-X utf8' command line option.\n\nNote: Even when UTF-8 mode is disabled, Python uses UTF-8 by\ndefault on Windows for:\n\n* Console I/O including standard I/O (see PEP 528(1) for\ndetails).\n\n* The *note filesystem encoding: 291. (see PEP 529(2) for\ndetails).\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0528/\n\n(2) https://peps.python.org/pep-0529/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python Launcher for Windows,  Next: Finding modules,  Prev: UTF-8 mode,  Up: Using Python on Windows": {
            "content": "New in version 3.3.\n",
            "subsections": []
        },
        "The Python launcher for Windows is a utility which aids in locating and": {
            "content": "executing of different Python versions.  It allows scripts (or the\ncommand-line) to indicate a preference for a specific Python version,\nand will locate and execute that version.\n",
            "subsections": []
        },
        "Unlike the 'PATH' variable, the launcher will correctly select the most": {
            "content": "appropriate version of Python.  It will prefer per-user installations\nover system-wide ones, and orders by language version rather than using\nthe most recently installed version.\n\nThe launcher was originally specified in PEP 397(1).\n\n* Menu:\n\n* Getting started::\n* Shebang Lines::\n* Arguments in shebang lines::\n* Customization::\n* Diagnostics::\n* Dry Run::\n* Install on demand::\n* Return codes::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0397/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Getting started,  Next: Shebang Lines,  Up: Python Launcher for Windows": {
            "content": "3.4.8.1 Getting started\n.......................\n\n* Menu:\n\n* From the command-line::\n* Virtual environments::\n* From a script::\n* From file associations::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: From the command-line,  Next: Virtual environments,  Up: Getting started": {
            "content": "3.4.8.2 From the command-line\n.............................\n\nChanged in version 3.6.\n",
            "subsections": []
        },
        "System-wide installations of Python 3.3 and later will put the launcher": {
            "content": "on your 'PATH'.  The launcher is compatible with all available versions\nof Python, so it does not matter which version is installed.  To check\nthat the launcher is available, execute the following command in Command\nPrompt:\n\npy\n",
            "subsections": []
        },
        "You should find that the latest version of Python you have installed is": {
            "content": "started - it can be exited as normal, and any additional command-line\narguments specified will be sent directly to Python.\n",
            "subsections": []
        },
        "If you have multiple versions of Python installed (e.g., 3.7 and 3.12)": {
            "content": "you will have noticed that Python 3.12 was started - to launch Python\n3.7, try the command:\n\npy -3.7\n",
            "subsections": []
        },
        "If you want the latest version of Python 2 you have installed, try the": {
            "content": "command:\n\npy -2\n\nIf you see the following error, you do not have the launcher installed:\n\n'py' is not recognized as an internal or external command,\noperable program or batch file.\n\nThe command:\n\npy --list\n\ndisplays the currently installed version(s) of Python.\n",
            "subsections": []
        },
        "The '-x.y' argument is the short form of the '-V:Company/Tag' argument,": {
            "content": "which allows selecting a specific Python runtime, including those that\nmay have come from somewhere other than python.org.  Any runtime\nregistered by following PEP 514(1) will be discoverable.  The '--list'\ncommand lists all available runtimes using the '-V:' format.\n",
            "subsections": []
        },
        "When using the '-V:' argument, specifying the Company will limit": {
            "content": "selection to runtimes from that provider, while specifying only the Tag\nwill select from all providers.  Note that omitting the slash implies a\ntag:\n\n# Select any '3.*' tagged runtime\npy -V:3\n\n# Select any 'PythonCore' released runtime\npy -V:PythonCore/\n\n# Select PythonCore's latest Python 3 runtime\npy -V:PythonCore/3\n",
            "subsections": []
        },
        "The short form of the argument ('-3') only ever selects from core Python": {
            "content": "releases, and not other distributions.  However, the longer form\n('-V:3') will select from any.\n",
            "subsections": []
        },
        "The Company is matched on the full string, case-insenitive.  The Tag is": {
            "content": "matched oneither the full string, or a prefix, provided the next\ncharacter is a dot or a hyphen.  This allows '-V:3.1' to match '3.1-32',\nbut not '3.10'.  Tags are sorted using numerical ordering ('3.10' is\nnewer than '3.1'), but are compared using text ('-V:3.01' does not match\n'3.1').\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0514/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Virtual environments,  Next: From a script,  Prev: From the command-line,  Up: Getting started": {
            "content": "3.4.8.3 Virtual environments\n............................\n\nNew in version 3.5.\n",
            "subsections": []
        },
        "If the launcher is run with no explicit Python version specification,": {
            "content": "and a virtual environment (created with the standard library *note venv:\n10c. module or the external 'virtualenv' tool) active, the launcher will\nrun the virtual environment's interpreter rather than the global one.",
            "subsections": []
        },
        "To run the global interpreter, either deactivate the virtual": {
            "content": "environment, or explicitly specify the global Python version.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: From a script,  Next: From file associations,  Prev: Virtual environments,  Up: Getting started": {
            "content": "3.4.8.4 From a script\n.....................\n",
            "subsections": []
        },
        "Let's create a test Python script - create a file called 'hello.py' with": {
            "content": "the following contents\n\n#! python\nimport sys\nsys.stdout.write(\"hello from Python %s\\n\" % (sys.version,))\n\nFrom the directory in which hello.py lives, execute the command:\n\npy hello.py\n",
            "subsections": []
        },
        "You should notice the version number of your latest Python 2.x": {
            "content": "installation is printed.  Now try changing the first line to be:\n\n#! python3\n",
            "subsections": []
        },
        "Re-executing the command should now print the latest Python 3.x": {
            "content": "information.  As with the above command-line examples, you can specify a\nmore explicit version qualifier.  Assuming you have Python 3.7\ninstalled, try changing the first line to '#! python3.7' and you should\nfind the 3.7 version information printed.\n\nNote that unlike interactive use, a bare \"python\" will use the latest\nversion of Python 2.x that you have installed.  This is for backward\ncompatibility and for compatibility with Unix, where the command\n'python' typically refers to Python 2.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: From file associations,  Prev: From a script,  Up: Getting started": {
            "content": "3.4.8.5 From file associations\n..............................\n",
            "subsections": []
        },
        "The launcher should have been associated with Python files (i.e.  '.py',": {
            "content": "'.pyw', '.pyc' files) when it was installed.  This means that when you\ndouble-click on one of these files from Windows explorer the launcher\nwill be used, and therefore you can use the same facilities described\nabove to have the script specify the version which should be used.\n",
            "subsections": []
        },
        "The key benefit of this is that a single launcher can support multiple": {
            "content": "",
            "subsections": []
        },
        "Python versions at the same time depending on the contents of the first": {
            "content": "line.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Shebang Lines,  Next: Arguments in shebang lines,  Prev: Getting started,  Up: Python Launcher for Windows": {
            "content": "3.4.8.6 Shebang Lines\n.....................\n\nIf the first line of a script file starts with '#!', it is known as a\n\"shebang\" line.  Linux and other Unix like operating systems have native\nsupport for such lines and they are commonly used on such systems to\nindicate how a script should be executed.  This launcher allows the same\nfacilities to be used with Python scripts on Windows and the examples\nabove demonstrate their use.\n",
            "subsections": []
        },
        "To allow shebang lines in Python scripts to be portable between Unix and": {
            "content": "",
            "subsections": []
        },
        "Windows, this launcher supports a number of 'virtual' commands to": {
            "content": "specify which interpreter to use.  The supported virtual commands are:\n\n* '/usr/bin/env'\n\n* '/usr/bin/python'\n\n* '/usr/local/bin/python'\n\n* 'python'\n",
            "subsections": []
        },
        "For example, if the first line of your script starts with": {
            "content": "#! /usr/bin/python\n",
            "subsections": []
        },
        "The default Python will be located and used.  As many Python scripts": {
            "content": "written to work on Unix will already have this line, you should find\nthese scripts can be used by the launcher without modification.  If you\nare writing a new script on Windows which you hope will be useful on\nUnix, you should use one of the shebang lines starting with '/usr'.\n",
            "subsections": []
        },
        "Any of the above virtual commands can be suffixed with an explicit": {
            "content": "version (either just the major version, or the major and minor version).\nFurthermore the 32-bit version can be requested by adding \"-32\" after\nthe minor version.  I.e.  '/usr/bin/python3.7-32' will request usage of\nthe 32-bit python 3.7.\n",
            "subsections": []
        },
        "New in version 3.7: Beginning with python launcher 3.7 it is possible to": {
            "content": "request 64-bit version by the \"-64\" suffix.  Furthermore it is possible\nto specify a major and architecture without minor (i.e.\n'/usr/bin/python3-64').\n\nChanged in version 3.11: The \"-64\" suffix is deprecated, and now implies\n\"any architecture that is not provably i386/32-bit\".  To request a\nspecific environment, use the new '-V:TAG' argument with the complete\ntag.\n",
            "subsections": []
        },
        "The '/usr/bin/env' form of shebang line has one further special": {
            "content": "property.  Before looking for installed Python interpreters, this form\nwill search the executable 'PATH' for a Python executable matching the\nname provided as the first argument.  This corresponds to the behaviour\nof the Unix 'env' program, which performs a 'PATH' search.  If an\nexecutable matching the first argument after the 'env' command cannot be\nfound, but the argument starts with 'python', it will be handled as\ndescribed for the other virtual commands.  The environment variable\n'PYLAUNCHERNOSEARCHPATH' may be set (to any value) to skip this\nsearch of 'PATH'.\n",
            "subsections": []
        },
        "Shebang lines that do not match any of these patterns are looked up in": {
            "content": "the '[commands]' section of the launcher's *note .INI file: 1b6a.  This\nmay be used to handle certain commands in a way that makes sense for\nyour system.  The name of the command must be a single argument (no\nspaces in the shebang executable), and the value substituted is the full\npath to the executable (additional arguments specified in the .INI will\nbe quoted as part of the filename).\n\n[commands]\n/bin/xpython=C:\\Program Files\\XPython\\python.exe\n",
            "subsections": []
        },
        "Any commands not found in the .INI file are treated as 'Windows'": {
            "content": "executable paths that are absolute or relative to the directory\ncontaining the script file.  This is a convenience for Windows-only\nscripts, such as those generated by an installer, since the behavior is\nnot compatible with Unix-style shells.  These paths may be quoted, and\nmay include multiple arguments, after which the path to the script and\nany additional arguments will be appended.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Arguments in shebang lines,  Next: Customization,  Prev: Shebang Lines,  Up: Python Launcher for Windows": {
            "content": "3.4.8.7 Arguments in shebang lines\n..................................\n",
            "subsections": []
        },
        "The shebang lines can also specify additional options to be passed to": {
            "content": "the Python interpreter.  For example, if you have a shebang line:\n\n#! /usr/bin/python -v\n",
            "subsections": []
        },
        "Then Python will be started with the '-v' option": {
            "content": "",
            "subsections": []
        },
        "File: python3.12.info,  Node: Customization,  Next: Diagnostics,  Prev: Arguments in shebang lines,  Up: Python Launcher for Windows": {
            "content": "3.4.8.8 Customization\n.....................\n\n* Menu:\n\n* Customization via INI files::\n* Customizing default Python versions::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Customization via INI files,  Next: Customizing default Python versions,  Up: Customization": {
            "content": "3.4.8.9 Customization via INI files\n...................................\n",
            "subsections": []
        },
        "Two .ini files will be searched by the launcher - 'py.ini' in the": {
            "content": "current user's application data directory ('%LOCALAPPDATA%' or\n'$env:LocalAppData') and 'py.ini' in the same directory as the launcher.",
            "subsections": []
        },
        "The same .ini files are used for both the 'console' version of the": {
            "content": "launcher (i.e.  py.exe) and for the 'windows' version (i.e.  pyw.exe).\n\nCustomization specified in the \"application directory\" will have\nprecedence over the one next to the executable, so a user, who may not\nhave write access to the .ini file next to the launcher, can override\ncommands in that global .ini file.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Customizing default Python versions,  Prev: Customization via INI files,  Up: Customization": {
            "content": "3.4.8.10 Customizing default Python versions\n............................................\n",
            "subsections": []
        },
        "In some cases, a version qualifier can be included in a command to": {
            "content": "dictate which version of Python will be used by the command.  A version\nqualifier starts with a major version number and can optionally be\nfollowed by a period ('.') and a minor version specifier.  Furthermore\nit is possible to specify if a 32 or 64 bit implementation shall be\nrequested by adding \"-32\" or \"-64\".\n\nFor example, a shebang line of '#!python' has no version qualifier,\nwhile '#!python3' has a version qualifier which specifies only a major\nversion.\n",
            "subsections": []
        },
        "If no version qualifiers are found in a command, the environment": {
            "content": "variable 'PYPYTHON' can be set to specify the default version\nqualifier.  If it is not set, the default is \"3\".  The variable can\nspecify any value that may be passed on the command line, such as \"3\",\n\"3.7\", \"3.7-32\" or \"3.7-64\".  (Note that the \"-64\" option is only\navailable with the launcher included with Python 3.7 or newer.)\n",
            "subsections": []
        },
        "If no minor version qualifiers are found, the environment variable": {
            "content": "'PYPYTHON{major}' (where '{major}' is the current major version\nqualifier as determined above) can be set to specify the full version.",
            "subsections": []
        },
        "If no such option is found, the launcher will enumerate the installed": {
            "content": "",
            "subsections": []
        },
        "Python versions and use the latest minor release found for the major": {
            "content": "version, which is likely, although not guaranteed, to be the most\nrecently installed version in that family.\n",
            "subsections": []
        },
        "On 64-bit Windows with both 32-bit and 64-bit implementations of the": {
            "content": "same (major.minor) Python version installed, the 64-bit version will\nalways be preferred.  This will be true for both 32-bit and 64-bit\nimplementations of the launcher - a 32-bit launcher will prefer to\nexecute a 64-bit Python installation of the specified version if\navailable.  This is so the behavior of the launcher can be predicted\nknowing only what versions are installed on the PC and without regard to\nthe order in which they were installed (i.e., without knowing whether a\n32 or 64-bit version of Python and corresponding launcher was installed\nlast).  As noted above, an optional \"-32\" or \"-64\" suffix can be used on\na version specifier to change this behaviour.\n\nExamples:\n\n* If no relevant options are set, the commands 'python' and 'python2'\nwill use the latest Python 2.x version installed and the command\n'python3' will use the latest Python 3.x installed.\n\n* The command 'python3.7' will not consult any options at all as the\nversions are fully specified.\n\n* If 'PYPYTHON=3', the commands 'python' and 'python3' will both use\nthe latest installed Python 3 version.\n\n* If 'PYPYTHON=3.7-32', the command 'python' will use the 32-bit\nimplementation of 3.7 whereas the command 'python3' will use the\nlatest installed Python (PYPYTHON was not considered at all as a\nmajor version was specified.)\n\n* If 'PYPYTHON=3' and 'PYPYTHON3=3.7', the commands 'python' and\n'python3' will both use specifically 3.7\n",
            "subsections": []
        },
        "In addition to environment variables, the same settings can be": {
            "content": "configured in the .INI file used by the launcher.  The section in the\nINI file is called '[defaults]' and the key name will be the same as the\nenvironment variables without the leading 'PY' prefix (and note that\nthe key names in the INI file are case insensitive.)  The contents of an\nenvironment variable will override things specified in the INI file.\n\nFor example:\n\n* Setting 'PYPYTHON=3.7' is equivalent to the INI file containing:\n\n[defaults]\npython=3.7\n\n* Setting 'PYPYTHON=3' and 'PYPYTHON3=3.7' is equivalent to the INI\nfile containing:\n\n[defaults]\npython=3\npython3=3.7\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Diagnostics,  Next: Dry Run,  Prev: Customization,  Up: Python Launcher for Windows": {
            "content": "3.4.8.11 Diagnostics\n....................\n",
            "subsections": []
        },
        "If an environment variable 'PYLAUNCHERDEBUG' is set (to any value), the": {
            "content": "launcher will print diagnostic information to stderr (i.e.  to the\nconsole).  While this information manages to be simultaneously verbose\n'and' terse, it should allow you to see what versions of Python were\nlocated, why a particular version was chosen and the exact command-line\nused to execute the target Python.  It is primarily intended for testing\nand debugging.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Dry Run,  Next: Install on demand,  Prev: Diagnostics,  Up: Python Launcher for Windows": {
            "content": "3.4.8.12 Dry Run\n................\n",
            "subsections": []
        },
        "If an environment variable 'PYLAUNCHERDRYRUN' is set (to any value),": {
            "content": "the launcher will output the command it would have run, but will not\nactually launch Python.  This may be useful for tools that want to use\nthe launcher to detect and then launch Python directly.  Note that the\ncommand written to standard output is always encoded using UTF-8, and\nmay not render correctly in the console.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Install on demand,  Next: Return codes,  Prev: Dry Run,  Up: Python Launcher for Windows": {
            "content": "3.4.8.13 Install on demand\n..........................\n",
            "subsections": []
        },
        "If an environment variable 'PYLAUNCHERALLOWINSTALL' is set (to any": {
            "content": "value), and the requested Python version is not installed but is\navailable on the Microsoft Store, the launcher will attempt to install\nit.  This may require user interaction to complete, and you may need to\nrun the command again.\n",
            "subsections": []
        },
        "An additional 'PYLAUNCHERALWAYSINSTALL' variable causes the launcher": {
            "content": "to always try to install Python, even if it is detected.  This is mainly\nintended for testing (and should be used with 'PYLAUNCHERDRYRUN').\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Return codes,  Prev: Install on demand,  Up: Python Launcher for Windows": {
            "content": "3.4.8.14 Return codes\n.....................\n\nThe following exit codes may be returned by the Python launcher.",
            "subsections": []
        },
        "Unfortunately, there is no way to distinguish these from the exit code": {
            "content": "of Python itself.\n",
            "subsections": []
        },
        "The names of codes are as used in the sources, and are only for": {
            "content": "reference.  There is no way to access or resolve them apart from reading\nthis page.  Entries are listed in alphabetical order of names.\n",
            "subsections": []
        },
        "Name                    Value       Description": {
            "content": "----------------------------------------------------------------------------------------\n\nRCBADVENVCFG         107         A 'pyvenv.cfg' was found but is corrupt.\n\n\nRCCREATEPROCESS       101         Failed to launch Python.\n\n\nRCINSTALLING           111         An install was started, but the command will need\nto be re-run after it completes.\n\n\nRCINTERNALERROR       109         Unexpected error.  Please report a bug.\n\n\nRCNOCOMMANDLINE       108         Unable to obtain command line from the operating\nsystem.\n\n\nRCNOPYTHON            103         Unable to locate the requested version.\n\n\nRCNOVENVCFG          106         A 'pyvenv.cfg' was required but not found.\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Finding modules,  Next: Additional modules,  Prev: Python Launcher for Windows,  Up: Using Python on Windows": {
            "content": "These notes supplement the description at *note The initialization of\nthe sys.path module search path: 19e5. with detailed Windows notes.\n\nWhen no '.pth' file is found, this is how *note sys.path: 32c. is\npopulated on Windows:\n\n* An empty entry is added at the start, which corresponds to the\ncurrent directory.\n\n* If the environment variable *note PYTHONPATH: e92. exists, as\ndescribed in *note Environment variables: 3b8, its entries are\nadded next.  Note that on Windows, paths in this variable must be\nseparated by semicolons, to distinguish them from the colon used in\ndrive identifiers ('C:\\' etc.).\n\n* Additional \"application paths\" can be added in the registry as\nsubkeys of '\\SOFTWARE\\Python\\PythonCore{version}\\PythonPath' under\nboth the 'HKEYCURRENTUSER' and 'HKEYLOCALMACHINE' hives.\nSubkeys which have semicolon-delimited path strings as their\ndefault value will cause each path to be added to *note sys.path:\n32c.  (Note that all known installers only use HKLM, so HKCU is\ntypically empty.)\n\n* If the environment variable *note PYTHONHOME: 334. is set, it is\nassumed as \"Python Home\".  Otherwise, the path of the main Python\nexecutable is used to locate a \"landmark file\" (either 'Lib\\os.py'\nor 'pythonXY.zip') to deduce the \"Python Home\".  If a Python home\nis found, the relevant sub-directories added to *note sys.path:\n32c. ('Lib', 'plat-win', etc) are based on that folder.  Otherwise,\nthe core Python path is constructed from the PythonPath stored in\nthe registry.\n\n* If the Python Home cannot be located, no *note PYTHONPATH: e92. is\nspecified in the environment, and no registry entries can be found,\na default path with relative entries is used (e.g.\n'.\\Lib;.\\plat-win', etc).\n",
            "subsections": []
        },
        "If a 'pyvenv.cfg' file is found alongside the main executable or in the": {
            "content": "directory one level above the executable, the following variations\napply:\n\n* If 'home' is an absolute path and *note PYTHONHOME: 334. is not\nset, this path is used instead of the path to the main executable\nwhen deducing the home location.\n\nThe end result of all this is:\n\n* When running 'python.exe', or any other .exe in the main Python\ndirectory (either an installed version, or directly from the\nPCbuild directory), the core path is deduced, and the core paths in\nthe registry are ignored.  Other \"application paths\" in the\nregistry are always read.\n\n* When Python is hosted in another .exe (different directory,\nembedded via COM, etc), the \"Python Home\" will not be deduced, so\nthe core path from the registry is used.  Other \"application paths\"\nin the registry are always read.\n\n* If Python can't find its home and there are no registry value\n(frozen .exe, some very strange installation setup) you get a path\nwith some default, but relative, paths.\n",
            "subsections": []
        },
        "For those who want to bundle Python into their application or": {
            "content": "distribution, the following advice will prevent conflicts with other\ninstallations:\n\n* Include a '.pth' file alongside your executable containing the\ndirectories to include.  This will ignore paths listed in the\nregistry and environment variables, and also ignore *note site: c2.\nunless 'import site' is listed.\n\n* If you are loading 'python3.dll' or 'python37.dll' in your own\nexecutable, explicitly call *note PySetPath(): 1b74. or (at least)\n*note PySetProgramName(): 181f. before *note PyInitialize(): 6c2.\n\n* Clear and/or overwrite *note PYTHONPATH: e92. and set *note\nPYTHONHOME: 334. before launching 'python.exe' from your\napplication.\n\n* If you cannot use the previous suggestions (for example, you are a\ndistribution that allows people to run 'python.exe' directly),\nensure that the landmark file ('Lib\\os.py') exists in your install\ndirectory.  (Note that it will not be detected inside a ZIP file,\nbut a correctly named ZIP file will be detected instead.)\n",
            "subsections": []
        },
        "These will ensure that the files in a system-wide installation will not": {
            "content": "take precedence over the copy of the standard library bundled with your\napplication.  Otherwise, your users may experience problems using your\napplication.  Note that the first suggestion is the best, as the others\nmay still be susceptible to non-standard paths in the registry and user\nsite-packages.\n",
            "subsections": []
        },
        "Changed in version 3.6: Add '.pth' file support and removes 'applocal'": {
            "content": "option from 'pyvenv.cfg'.\n\nChanged in version 3.6: Add 'python`XX'.zip' as a potential landmark\nwhen directly adjacent to the executable.\n",
            "subsections": []
        },
        "Deprecated since version 3.6: Modules specified in the registry under": {
            "content": "'Modules' (not 'PythonPath') may be imported by *note\nimportlib.machinery.WindowsRegistryFinder: b7f.  This finder is enabled\non Windows in 3.6.0 and earlier, but may need to be explicitly added to\n*note sys.metapath: b80. in the future.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Additional modules,  Next: Compiling Python on Windows,  Prev: Finding modules,  Up: Using Python on Windows": {
            "content": "",
            "subsections": []
        },
        "Even though Python aims to be portable among all platforms, there are": {
            "content": "features that are unique to Windows.  A couple of modules, both in the\nstandard library and external, and snippets exist to use these features.\n\nThe Windows-specific standard modules are documented in *note MS Windows\nSpecific Services: 1b76.\n\n* Menu:\n\n* PyWin32::\n* cxFreeze::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: PyWin32,  Next: cxFreeze,  Up: Additional modules": {
            "content": "3.4.10.1 PyWin32\n................\n",
            "subsections": []
        },
        "The PyWin32(1) module by Mark Hammond is a collection of modules for": {
            "content": "advanced Windows-specific support.  This includes utilities for:\n\n* Component Object Model(2) (COM)\n\n* Win32 API calls\n\n* Registry\n\n* Event log\n\n* Microsoft Foundation Classes(3) (MFC) user interfaces\n",
            "subsections": []
        },
        "PythonWin(4) is a sample MFC application shipped with PyWin32.  It is an": {
            "content": "embeddable IDE with a built-in debugger.\n\nSee also\n........\n\nWin32 How Do I...?(5)\n\nby Tim Golden\n",
            "subsections": []
        },
        "Python and COM(6)": {
            "content": "by David and Paul Boddie\n\n---------- Footnotes ----------\n\n(1) https://pypi.org/project/pywin32\n\n(2)\nhttps://docs.microsoft.com/en-us/windows/win32/com/component-object-model-com-portal\n\n(3) https://docs.microsoft.com/en-us/cpp/mfc/mfc-desktop-applications\n\n(4)\nhttps://web.archive.org/web/20060524042422/https://www.python.org/windows/pythonwin/\n\n(5) http://timgolden.me.uk/python/win32howdoi.html\n\n(6) https://www.boddie.org.uk/python/COM.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: cxFreeze,  Prev: PyWin32,  Up: Additional modules": {
            "content": "3.4.10.2 cxFreeze\n..................\n\ncxFreeze(1) wraps Python scripts into executable Windows programs\n('`*'.exe' files).  When you have done this, you can distribute your\napplication without requiring your users to install Python.\n\n---------- Footnotes ----------\n\n(1) https://cx-freeze.readthedocs.io/en/latest/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Compiling Python on Windows,  Next: Other Platforms,  Prev: Additional modules,  Up: Using Python on Windows": {
            "content": "",
            "subsections": []
        },
        "The source tree contains a build solution and project files for": {
            "content": "",
            "subsections": []
        },
        "Microsoft Visual Studio, which is the compiler used to build the": {
            "content": "official Python releases.  These files are in the 'PCbuild' directory.\n\nCheck 'PCbuild/readme.txt' for general information on the build process.\n\nFor extension modules, consult *note Building C and C++ Extensions on\nWindows: 1b7a.\n\n---------- Footnotes ----------\n\n(1) https://www.python.org/downloads/source/\n\n(2) https://devguide.python.org/setup/#get-the-source-code\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Other Platforms,  Prev: Compiling Python on Windows,  Up: Using Python on Windows": {
            "content": "",
            "subsections": []
        },
        "With ongoing development of Python, some platforms that used to be": {
            "content": "supported earlier are no longer supported (due to the lack of users or\ndevelopers).  Check PEP 11(1) for details on all unsupported platforms.\n\n* Windows CE(2) is no longer supported(3) since Python 3 (if it ever\nwas).\n\n* The Cygwin(4) installer offers to install the Python interpreter(5)\nas well\n",
            "subsections": []
        },
        "See Python for Windows(6) for detailed information about platforms with": {
            "content": "pre-compiled installers.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0011/\n\n(2) https://pythonce.sourceforge.net/\n\n(3) https://github.com/python/cpython/issues/71542\n\n(4) https://cygwin.com/\n\n(5) https://cygwin.com/packages/summary/python3.html\n\n(6) https://www.python.org/downloads/windows/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using Python on a Mac,  Next: Editors and IDEs,  Prev: Using Python on Windows,  Up: Python Setup and Usage": {
            "content": "",
            "subsections": [
                {
                    "name": "3.5 Using Python on a Mac",
                    "content": "Author: Bob Savage <<bobsavage@mac.com>>\n"
                }
            ]
        },
        "Python on a Mac running macOS is in principle very similar to Python on": {
            "content": "any other Unix platform, but there are a number of additional features\nsuch as the integrated development environment (IDE) and the Package\nManager that are worth pointing out.\n* Menu:\n\n* Getting and Installing Python::\n* The IDE::\n* Installing Additional Python Packages::\n* GUI Programming::\n* Distributing Python Applications::\n* Other Resources::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Getting and Installing Python,  Next: The IDE,  Up: Using Python on a Mac": {
            "content": "macOS used to come with Python 2.7 pre-installed between versions 10.8\nand 12.3(1).  You are invited to install the most recent version of\nPython 3 from the Python website(2).  A current \"universal2 binary\"\nbuild of Python, which runs natively on the Mac's new Apple Silicon and\nlegacy Intel processors, is available there.\n\nWhat you get after installing is a number of things:\n\n* A 'Python 3.12' folder in your 'Applications' folder.  In here you\nfind IDLE, the development environment that is a standard part of\nofficial Python distributions; and 'Python Launcher', which handles\ndouble-clicking Python scripts from the Finder.\n\n* A framework '/Library/Frameworks/Python.framework', which includes\nthe Python executable and libraries.  The installer adds this\nlocation to your shell path.  To uninstall Python, you can remove\nthese three things.  A symlink to the Python executable is placed\nin '/usr/local/bin/'.\n\nNote: On macOS 10.8-12.3, the Apple-provided build of Python is\ninstalled in '/System/Library/Frameworks/Python.framework' and\n'/usr/bin/python', respectively.  You should never modify or delete\nthese, as they are Apple-controlled and are used by Apple- or\nthird-party software.  Remember that if you choose to install a\nnewer Python version from python.org, you will have two different\nbut functional Python installations on your computer, so it will be\nimportant that your paths and usages are consistent with what you\nwant to do.\n\nIDLE includes a Help menu that allows you to access Python\ndocumentation.  If you are completely new to Python you should start\nreading the tutorial introduction in that document.\n",
            "subsections": []
        },
        "If you are familiar with Python on other Unix platforms you should read": {
            "content": "the section on running Python scripts from the Unix shell.\n\n* Menu:\n\n* How to run a Python script::\n* Running scripts with a GUI::\n* Configuration::\n\n---------- Footnotes ----------\n\n(1)\nhttps://developer.apple.com/documentation/macos-release-notes/macos-123-release-notes#Python\n\n(2) https://www.python.org/downloads/macos/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: How to run a Python script,  Next: Running scripts with a GUI,  Up: Getting and Installing Python": {
            "content": "3.5.1.1 How to run a Python script\n..................................\n",
            "subsections": []
        },
        "Your best way to get started with Python on macOS is through the IDLE": {
            "content": "integrated development environment; see section *note The IDE: 1b83. and\nuse the Help menu when the IDE is running.\n",
            "subsections": []
        },
        "If you want to run Python scripts from the Terminal window command line": {
            "content": "or from the Finder you first need an editor to create your script.\nmacOS comes with a number of standard Unix command line editors, 'vim'\n'nano' among them.  If you want a more Mac-like editor, 'BBEdit' from",
            "subsections": []
        },
        "Bare Bones Software (see": {
            "content": "'https://www.barebones.com/products/bbedit/index.html') are good\nchoices, as is 'TextMate' (see 'https://macromates.com').  Other editors\ninclude 'MacVim' ('https://macvim.org') and 'Aquamacs'\n('https://aquamacs.org').\n",
            "subsections": []
        },
        "To run your script from the Terminal window you must make sure that": {
            "content": "'/usr/local/bin' is in your shell search path.\n\nTo run your script from the Finder you have two options:\n\n* Drag it to 'Python Launcher'.\n\n* Select 'Python Launcher' as the default application to open your\nscript (or any '.py' script) through the finder Info window and\ndouble-click it.  'Python Launcher' has various preferences to\ncontrol how your script is launched.  Option-dragging allows you to\nchange these for one invocation, or use its Preferences menu to\nchange things globally.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Running scripts with a GUI,  Next: Configuration,  Prev: How to run a Python script,  Up: Getting and Installing Python": {
            "content": "3.5.1.2 Running scripts with a GUI\n..................................\n",
            "subsections": []
        },
        "With older versions of Python, there is one macOS quirk that you need to": {
            "content": "be aware of: programs that talk to the Aqua window manager (in other\nwords, anything that has a GUI) need to be run in a special way.  Use\n'pythonw' instead of 'python' to start such scripts.\n\nWith Python 3.9, you can use either 'python' or 'pythonw'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Configuration,  Prev: Running scripts with a GUI,  Up: Getting and Installing Python": {
            "content": "3.5.1.3 Configuration\n.....................\n",
            "subsections": []
        },
        "Python on macOS honors all standard Unix environment variables such as": {
            "content": "*note PYTHONPATH: e92, but setting these variables for programs started\nfrom the Finder is non-standard as the Finder does not read your\n'.profile' or '.cshrc' at startup.  You need to create a file\n'~/.MacOSX/environment.plist'.  See Apple's Technical Q&A QA1067(1) for\ndetails.\n\nFor more information on installation Python packages, see section *note\nInstalling Additional Python Packages: 1b87.\n\n---------- Footnotes ----------\n\n(1) https://developer.apple.com/library/archive/qa/qa1067/index.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The IDE,  Next: Installing Additional Python Packages,  Prev: Getting and Installing Python,  Up: Using Python on a Mac": {
            "content": "",
            "subsections": []
        },
        "Python ships with the standard IDLE development environment.  A good": {
            "content": "introduction to using IDLE can be found at\n'https://www.hashcollision.org/hkn/python/idleintro/index.html'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Installing Additional Python Packages,  Next: GUI Programming,  Prev: The IDE,  Up: Using Python on a Mac": {
            "content": "This section has moved to the Python Packaging User Guide(1).\n\n---------- Footnotes ----------\n\n(1)\nhttps://packaging.python.org/en/latest/tutorials/installing-packages/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: GUI Programming,  Next: Distributing Python Applications,  Prev: Installing Additional Python Packages,  Up: Using Python on a Mac": {
            "content": "",
            "subsections": []
        },
        "There are several options for building GUI applications on the Mac with": {
            "content": "Python.\n\n'PyObjC' is a Python binding to Apple's Objective-C/Cocoa framework,\nwhich is the foundation of most modern Mac development.  Information on\nPyObjC is available from 'https://pypi.org/project/pyobjc/'.\n\nThe standard Python GUI toolkit is *note tkinter: ea, based on the\ncross-platform Tk toolkit ('https://www.tcl.tk').  An Aqua-native\nversion of Tk is bundled with macOS by Apple, and the latest version can\nbe downloaded and installed from 'https://www.activestate.com'; it can\nalso be built from source.\n\nA number of alternative macOS GUI toolkits are available:\n\n* PySide(1): Official Python bindings to the Qt GUI toolkit(2).\n\n* PyQt(3): Alternative Python bindings to Qt.\n\n* Kivy(4): A cross-platform GUI toolkit that supports desktop and\nmobile platforms.\n\n* Toga(5): Part of the BeeWare Project(6); supports desktop, mobile,\nweb and console apps.\n\n* wxPython(7): A cross-platform toolkit that supports desktop\noperating systems.\n\n---------- Footnotes ----------\n\n(1) https://www.qt.io/qt-for-python\n\n(2) https://qt.io\n\n(3) https://riverbankcomputing.com/software/pyqt/intro\n\n(4) https://kivy.org\n\n(5) https://toga.readthedocs.io\n\n(6) https://beeware.org\n\n(7) https://www.wxpython.org\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Distributing Python Applications,  Next: Other Resources,  Prev: GUI Programming,  Up: Using Python on a Mac": {
            "content": "A range of tools exist for converting your Python code into a standalone\ndistributable application:\n\n* py2app(1): Supports creating macOS '.app' bundles from a Python\nproject.\n\n* Briefcase(2): Part of the BeeWare Project(3); a cross-platform\npackaging tool that supports creation of '.app' bundles on macOS,\nas well as managing signing and notarization.\n\n* PyInstaller(4): A cross-platform packaging tool that creates a\nsingle file or folder as a distributable artifact.\n\n---------- Footnotes ----------\n\n(1) https://pypi.org/project/py2app/\n\n(2) https://briefcase.readthedocs.io\n\n(3) https://beeware.org\n\n(4) https://pyinstaller.org/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Other Resources,  Prev: Distributing Python Applications,  Up: Using Python on a Mac": {
            "content": "",
            "subsections": []
        },
        "The Pythonmac-SIG mailing list is an excellent support resource for": {
            "content": "Python users and developers on the Mac:\n\n'https://www.python.org/community/sigs/current/pythonmac-sig/'\n\nAnother useful resource is the MacPython wiki:\n\n'https://wiki.python.org/moin/MacPython'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Editors and IDEs,  Prev: Using Python on a Mac,  Up: Python Setup and Usage": {
            "content": "",
            "subsections": [
                {
                    "name": "3.6 Editors and IDEs",
                    "content": "There are a number of IDEs that support Python programming language."
                }
            ]
        },
        "Many editors and IDEs provide syntax highlighting, debugging tools, and": {
            "content": "PEP 8(1) checks.\n",
            "subsections": []
        },
        "Please go to Python Editors(2) and Integrated Development": {
            "content": "Environments(3) for a comprehensive list.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0008/\n\n(2) https://wiki.python.org/moin/PythonEditors\n\n(3) https://wiki.python.org/moin/IntegratedDevelopmentEnvironments\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The Python Language Reference,  Next: The Python Standard Library,  Prev: Python Setup and Usage,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "4 The Python Language Reference": {
            "content": "This reference manual describes the syntax and \"core semantics\" of the\nlanguage.  It is terse, but attempts to be exact and complete.  The\nsemantics of non-essential built-in object types and of the built-in\nfunctions and modules are described in *note The Python Standard\nLibrary: 13d.  For an informal introduction to the language, see *note\nThe Python Tutorial: 195d.  For C or C++ programmers, two additional\nmanuals exist: *note Extending and Embedding the Python Interpreter:\n195e. describes the high-level picture of how to write a Python\nextension module, and the *note Python/C API Reference Manual: 195f.\ndescribes the interfaces available to C/C++ programmers in detail.\n\n* Menu:\n\n* Introduction: Introduction<5>.\n* Lexical analysis::\n* Data model::\n* Execution model::\n* The import system::\n* Expressions::\n* Simple statements::\n* Compound statements::\n* Top-level components::\n* Full Grammar specification::\n\nFile: python3.12.info,  Node: Introduction<5>,  Next: Lexical analysis,  Up: The Python Language Reference\n",
            "subsections": [
                {
                    "name": "4.1 Introduction",
                    "content": ""
                }
            ]
        },
        "This reference manual describes the Python programming language.  It is": {
            "content": "not intended as a tutorial.\n",
            "subsections": []
        },
        "While I am trying to be as precise as possible, I chose to use English": {
            "content": "rather than formal specifications for everything except syntax and\nlexical analysis.  This should make the document more understandable to\nthe average reader, but will leave room for ambiguities.  Consequently,\nif you were coming from Mars and tried to re-implement Python from this\ndocument alone, you might have to guess things and in fact you would\nprobably end up implementing quite a different language.  On the other\nhand, if you are using Python and wonder what the precise rules about a\nparticular area of the language are, you should definitely be able to\nfind them here.  If you would like to see a more formal definition of\nthe language, maybe you could volunteer your time -- or invent a cloning\nmachine :-).\n",
            "subsections": []
        },
        "It is dangerous to add too many implementation details to a language": {
            "content": "reference document -- the implementation may change, and other\nimplementations of the same language may work differently.  On the other\nhand, CPython is the one Python implementation in widespread use\n(although alternate implementations continue to gain support), and its\nparticular quirks are sometimes worth being mentioned, especially where\nthe implementation imposes additional limitations.  Therefore, you'll\nfind short \"implementation notes\" sprinkled throughout the text.\n",
            "subsections": []
        },
        "Every Python implementation comes with a number of built-in and standard": {
            "content": "modules.  These are documented in *note The Python Standard Library:\n13d.  A few built-in modules are mentioned when they interact in a\nsignificant way with the language definition.\n\n* Menu:\n\n* Alternate Implementations::\n* Notation::\n\nFile: python3.12.info,  Node: Alternate Implementations,  Next: Notation,  Up: Introduction<5>\n\n",
            "subsections": []
        },
        "Though there is one Python implementation which is by far the most": {
            "content": "popular, there are some alternate implementations which are of\nparticular interest to different audiences.\n\nKnown implementations include:\n\nCPython\n\nThis is the original and most-maintained implementation of Python,\nwritten in C. New language features generally appear here first.\n",
            "subsections": []
        },
        "Jython": {
            "content": "Python implemented in Java.  This implementation can be used as a\nscripting language for Java applications, or can be used to create\napplications using the Java class libraries.  It is also often used\nto create tests for Java libraries.  More information can be found\nat the Jython website(1).\n\nPython for .NET\n\nThis implementation actually uses the CPython implementation, but\nis a managed .NET application and makes .NET libraries available.\nIt was created by Brian Lloyd.  For more information, see the\nPython for .NET home page(2).\n",
            "subsections": []
        },
        "IronPython": {
            "content": "An alternate Python for .NET. Unlike Python.NET, this is a complete\nPython implementation that generates IL, and compiles Python code\ndirectly to .NET assemblies.  It was created by Jim Hugunin, the\noriginal creator of Jython.  For more information, see the\nIronPython website(3).\n",
            "subsections": []
        },
        "PyPy": {
            "content": "An implementation of Python written completely in Python.  It\nsupports several advanced features not found in other\nimplementations like stackless support and a Just in Time compiler.\nOne of the goals of the project is to encourage experimentation\nwith the language itself by making it easier to modify the\ninterpreter (since it is written in Python).  Additional\ninformation is available on the PyPy project's home page(4).\n",
            "subsections": []
        },
        "Each of these implementations varies in some way from the language as": {
            "content": "documented in this manual, or introduces specific information beyond\nwhat's covered in the standard Python documentation.  Please refer to\nthe implementation-specific documentation to determine what else you\nneed to know about the specific implementation you're using.\n\n---------- Footnotes ----------\n\n(1) https://www.jython.org/\n\n(2) https://pythonnet.github.io/\n\n(3) https://ironpython.net/\n\n(4) https://www.pypy.org/\n\nFile: python3.12.info,  Node: Notation,  Prev: Alternate Implementations,  Up: Introduction<5>\n\n",
            "subsections": []
        },
        "The descriptions of lexical analysis and syntax use a modified": {
            "content": "",
            "subsections": []
        },
        "Backus-Naur form (BNF)(1) grammar notation.  This uses the following": {
            "content": "style of definition:\n\nname      ::= lcletter (lcletter | \"\")*\nlcletter ::= \"a\"...\"z\"\n",
            "subsections": []
        },
        "The first line says that a 'name' is an 'lcletter' followed by a": {
            "content": "sequence of zero or more 'lcletter's and underscores.  An 'lcletter'\nin turn is any of the single characters ''a'' through ''z''.  (This rule\nis actually adhered to for the names defined in lexical and grammar\nrules in this document.)\n",
            "subsections": []
        },
        "Each rule begins with a name (which is the name defined by the rule) and": {
            "content": "'::='.  A vertical bar ('|') is used to separate alternatives; it is the\nleast binding operator in this notation.  A star ('*') means zero or\nmore repetitions of the preceding item; likewise, a plus ('+') means one\nor more repetitions, and a phrase enclosed in square brackets ('[ ]')\nmeans zero or one occurrences (in other words, the enclosed phrase is\noptional).  The '*' and '+' operators bind as tightly as possible;\nparentheses are used for grouping.  Literal strings are enclosed in\nquotes.  White space is only meaningful to separate tokens.  Rules are\nnormally contained on a single line; rules with many alternatives may be\nformatted alternatively with each line after the first beginning with a\nvertical bar.\n",
            "subsections": []
        },
        "In lexical definitions (as the example above), two more conventions are": {
            "content": "used: Two literal characters separated by three dots mean a choice of\nany single character in the given (inclusive) range of ASCII characters.\nA phrase between angular brackets ('<...>') gives an informal\ndescription of the symbol defined; e.g., this could be used to describe\nthe notion of 'control character' if needed.\n",
            "subsections": []
        },
        "Even though the notation used is almost the same, there is a big": {
            "content": "difference between the meaning of lexical and syntactic definitions: a\nlexical definition operates on the individual characters of the input\nsource, while a syntax definition operates on the stream of tokens\ngenerated by the lexical analysis.  All uses of BNF in the next chapter\n(\"Lexical Analysis\") are lexical definitions; uses in subsequent\nchapters are syntactic definitions.\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Backus%E2%80%93Naurform\n\nFile: python3.12.info,  Node: Lexical analysis,  Next: Data model,  Prev: Introduction<5>,  Up: The Python Language Reference\n",
            "subsections": [
                {
                    "name": "4.2 Lexical analysis",
                    "content": "A Python program is read by a 'parser'.  Input to the parser is a stream\nof 'tokens', generated by the 'lexical analyzer'.  This chapter\ndescribes how the lexical analyzer breaks a file into tokens.\n"
                }
            ]
        },
        "Python reads program text as Unicode code points; the encoding of a": {
            "content": "source file can be given by an encoding declaration and defaults to\nUTF-8, see PEP 3120(1) for details.  If the source file cannot be\ndecoded, a *note SyntaxError: 146. is raised.\n\n* Menu:\n\n* Line structure::\n* Other tokens::\n* Identifiers and keywords::\n* Literals::\n* Operators::\n* Delimiters::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3120/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Line structure,  Next: Other tokens,  Up: Lexical analysis": {
            "content": "A Python program is divided into a number of 'logical lines'.\n\n* Menu:\n\n* Logical lines::\n* Physical lines::\n* Comments::\n* Encoding declarations::\n* Explicit line joining::\n* Implicit line joining::\n* Blank lines::\n* Indentation::\n* Whitespace between tokens::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Logical lines,  Next: Physical lines,  Up: Line structure": {
            "content": "4.2.1.1 Logical lines\n.....................\n\nThe end of a logical line is represented by the token NEWLINE.",
            "subsections": []
        },
        "Statements cannot cross logical line boundaries except where NEWLINE is": {
            "content": "allowed by the syntax (e.g., between statements in compound statements).\nA logical line is constructed from one or more 'physical lines' by\nfollowing the explicit or implicit 'line joining' rules.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Physical lines,  Next: Comments,  Prev: Logical lines,  Up: Line structure": {
            "content": "4.2.1.2 Physical lines\n......................\n\nA physical line is a sequence of characters terminated by an end-of-line\nsequence.  In source files and strings, any of the standard platform\nline termination sequences can be used - the Unix form using ASCII LF\n(linefeed), the Windows form using the ASCII sequence CR LF (return\nfollowed by linefeed), or the old Macintosh form using the ASCII CR\n(return) character.  All of these forms can be used equally, regardless\nof platform.  The end of input also serves as an implicit terminator for\nthe final physical line.\n",
            "subsections": []
        },
        "When embedding Python, source code strings should be passed to Python": {
            "content": "APIs using the standard C conventions for newline characters (the '\\n'\ncharacter, representing ASCII LF, is the line terminator).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Comments,  Next: Encoding declarations,  Prev: Physical lines,  Up: Line structure": {
            "content": "4.2.1.3 Comments\n................\n\nA comment starts with a hash character ('#') that is not part of a\nstring literal, and ends at the end of the physical line.  A comment\nsignifies the end of the logical line unless the implicit line joining\nrules are invoked.  Comments are ignored by the syntax.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Encoding declarations,  Next: Explicit line joining,  Prev: Comments,  Up: Line structure": {
            "content": "4.2.1.4 Encoding declarations\n.............................\n",
            "subsections": []
        },
        "If a comment in the first or second line of the Python script matches": {
            "content": "the regular expression 'coding[=:]\\s*([-\\w.]+)', this comment is\nprocessed as an encoding declaration; the first group of this expression\nnames the encoding of the source code file.  The encoding declaration\nmust appear on a line of its own.  If it is the second line, the first\nline must also be a comment-only line.  The recommended forms of an\nencoding expression are\n\n# -*- coding: <encoding-name> -*-\n\nwhich is recognized also by GNU Emacs, and\n\n# vim:fileencoding=<encoding-name>\n\nwhich is recognized by Bram Moolenaar's VIM.\n",
            "subsections": []
        },
        "If no encoding declaration is found, the default encoding is UTF-8.  If": {
            "content": "the implicit or explicit encoding of a file is UTF-8, an initial UTF-8\nbyte-order mark (b'xefxbbxbf') is ignored rather than being a syntax\nerror.\n",
            "subsections": []
        },
        "If an encoding is declared, the encoding name must be recognized by": {
            "content": "Python (see *note Standard Encodings: c15.).  The encoding is used for\nall lexical analysis, including string literals, comments and\nidentifiers.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Explicit line joining,  Next: Implicit line joining,  Prev: Encoding declarations,  Up: Line structure": {
            "content": "4.2.1.5 Explicit line joining\n.............................\n",
            "subsections": []
        },
        "Two or more physical lines may be joined into logical lines using": {
            "content": "backslash characters ('\\'), as follows: when a physical line ends in a\nbackslash that is not part of a string literal or comment, it is joined\nwith the following forming a single logical line, deleting the backslash\nand the following end-of-line character.  For example:\n\nif 1900 < year < 2100 and 1 <= month <= 12 \\\nand 1 <= day <= 31 and 0 <= hour < 24 \\\nand 0 <= minute < 60 and 0 <= second < 60:   # Looks like a valid date\nreturn 1\n\nA line ending in a backslash cannot carry a comment.  A backslash does\nnot continue a comment.  A backslash does not continue a token except\nfor string literals (i.e., tokens other than string literals cannot be\nsplit across physical lines using a backslash).  A backslash is illegal\nelsewhere on a line outside a string literal.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Implicit line joining,  Next: Blank lines,  Prev: Explicit line joining,  Up: Line structure": {
            "content": "4.2.1.6 Implicit line joining\n.............................\n",
            "subsections": []
        },
        "Expressions in parentheses, square brackets or curly braces can be split": {
            "content": "over more than one physical line without using backslashes.  For\nexample:\n\nmonthnames = ['Januari', 'Februari', 'Maart',      # These are the\n'April',   'Mei',      'Juni',       # Dutch names\n'Juli',    'Augustus', 'September',  # for the months\n'Oktober', 'November', 'December']   # of the year\n",
            "subsections": []
        },
        "Implicitly continued lines can carry comments.  The indentation of the": {
            "content": "continuation lines is not important.  Blank continuation lines are\nallowed.  There is no NEWLINE token between implicit continuation lines.",
            "subsections": []
        },
        "Implicitly continued lines can also occur within triple-quoted strings": {
            "content": "(see below); in that case they cannot carry comments.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Blank lines,  Next: Indentation,  Prev: Implicit line joining,  Up: Line structure": {
            "content": "4.2.1.7 Blank lines\n...................\n\nA logical line that contains only spaces, tabs, formfeeds and possibly a\ncomment, is ignored (i.e., no NEWLINE token is generated).  During\ninteractive input of statements, handling of a blank line may differ\ndepending on the implementation of the read-eval-print loop.  In the\nstandard interactive interpreter, an entirely blank logical line (i.e.\none containing not even whitespace or a comment) terminates a multi-line\nstatement.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Indentation,  Next: Whitespace between tokens,  Prev: Blank lines,  Up: Line structure": {
            "content": "4.2.1.8 Indentation\n...................\n",
            "subsections": []
        },
        "Leading whitespace (spaces and tabs) at the beginning of a logical line": {
            "content": "is used to compute the indentation level of the line, which in turn is\nused to determine the grouping of statements.\n",
            "subsections": []
        },
        "Tabs are replaced (from left to right) by one to eight spaces such that": {
            "content": "the total number of characters up to and including the replacement is a\nmultiple of eight (this is intended to be the same rule as used by",
            "subsections": []
        },
        "Unix).  The total number of spaces preceding the first non-blank": {
            "content": "character then determines the line's indentation.  Indentation cannot be\nsplit over multiple physical lines using backslashes; the whitespace up\nto the first backslash determines the indentation.\n",
            "subsections": []
        },
        "Indentation is rejected as inconsistent if a source file mixes tabs and": {
            "content": "spaces in a way that makes the meaning dependent on the worth of a tab\nin spaces; a *note TabError: 29b. is raised in that case.\n\n'Cross-platform compatibility note:' because of the nature of text\neditors on non-UNIX platforms, it is unwise to use a mixture of spaces\nand tabs for the indentation in a single source file.  It should also be\nnoted that different platforms may explicitly limit the maximum\nindentation level.\n\nA formfeed character may be present at the start of the line; it will be\nignored for the indentation calculations above.  Formfeed characters\noccurring elsewhere in the leading whitespace have an undefined effect\n(for instance, they may reset the space count to zero).\n",
            "subsections": []
        },
        "The indentation levels of consecutive lines are used to generate INDENT": {
            "content": "and DEDENT tokens, using a stack, as follows.\n",
            "subsections": []
        },
        "Before the first line of the file is read, a single zero is pushed on": {
            "content": "the stack; this will never be popped off again.  The numbers pushed on\nthe stack will always be strictly increasing from bottom to top.  At the\nbeginning of each logical line, the line's indentation level is compared\nto the top of the stack.  If it is equal, nothing happens.  If it is\nlarger, it is pushed on the stack, and one INDENT token is generated.",
            "subsections": []
        },
        "If it is smaller, it 'must' be one of the numbers occurring on the": {
            "content": "stack; all numbers on the stack that are larger are popped off, and for\neach number popped off a DEDENT token is generated.  At the end of the\nfile, a DEDENT token is generated for each number remaining on the stack\nthat is larger than zero.\n",
            "subsections": []
        },
        "Here is an example of a correctly (though confusingly) indented piece of": {
            "content": "Python code:\n\ndef perm(l):\n# Compute the list of all permutations of l\nif len(l) <= 1:\nreturn [l]\nr = []\nfor i in range(len(l)):\ns = l[:i] + l[i+1:]\np = perm(s)\nfor x in p:\nr.append(l[i:i+1] + x)\nreturn r\n\nThe following example shows various indentation errors:\n\ndef perm(l):                       # error: first line indented\nfor i in range(len(l)):             # error: not indented\ns = l[:i] + l[i+1:]\np = perm(l[:i] + l[i+1:])   # error: unexpected indent\nfor x in p:\nr.append(l[i:i+1] + x)\nreturn r                # error: inconsistent dedent\n\n(Actually, the first three errors are detected by the parser; only the\nlast error is found by the lexical analyzer -- the indentation of 'return\nr' does not match a level popped off the stack.)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Whitespace between tokens,  Prev: Indentation,  Up: Line structure": {
            "content": "4.2.1.9 Whitespace between tokens\n.................................\n",
            "subsections": []
        },
        "Except at the beginning of a logical line or in string literals, the": {
            "content": "whitespace characters space, tab and formfeed can be used\ninterchangeably to separate tokens.  Whitespace is needed between two\ntokens only if their concatenation could otherwise be interpreted as a\ndifferent token (e.g., ab is one token, but a b is two tokens).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Other tokens,  Next: Identifiers and keywords,  Prev: Line structure,  Up: Lexical analysis": {
            "content": "",
            "subsections": []
        },
        "Besides NEWLINE, INDENT and DEDENT, the following categories of tokens": {
            "content": "exist: 'identifiers', 'keywords', 'literals', 'operators', and\n'delimiters'.  Whitespace characters (other than line terminators,\ndiscussed earlier) are not tokens, but serve to delimit tokens.  Where\nambiguity exists, a token comprises the longest possible string that\nforms a legal token, when read from left to right.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Identifiers and keywords,  Next: Literals,  Prev: Other tokens,  Up: Lexical analysis": {
            "content": "",
            "subsections": []
        },
        "Identifiers (also referred to as 'names') are described by the following": {
            "content": "lexical definitions.\n",
            "subsections": []
        },
        "The syntax of identifiers in Python is based on the Unicode standard": {
            "content": "annex UAX-31, with elaboration and changes as defined below; see also\nPEP 3131(1) for further details.\n\nWithin the ASCII range (U+0001..U+007F), the valid characters for\nidentifiers are the same as in Python 2.x: the uppercase and lowercase\nletters 'A' through 'Z', the underscore '' and, except for the first\ncharacter, the digits '0' through '9'.\n",
            "subsections": []
        },
        "Python 3.0 introduces additional characters from outside the ASCII range": {
            "content": "(see PEP 3131(2)).  For these characters, the classification uses the\nversion of the Unicode Character Database as included in the *note\nunicodedata: 100. module.\n\nIdentifiers are unlimited in length.  Case is significant.\n\nidentifier   ::= xidstart xidcontinue*\nidstart     ::= <all characters in general categories Lu, Ll, Lt, Lm, Lo, Nl, the underscore, and characters with the OtherIDStart property>\nidcontinue  ::= <all characters in idstart, plus characters in the categories Mn, Mc, Nd, Pc and others with the OtherIDContinue property>\nxidstart    ::= <all characters in idstart whose NFKC normalization is in \"idstart xidcontinue*\">\nxidcontinue ::= <all characters in idcontinue whose NFKC normalization is in \"idcontinue*\">\n\nThe Unicode category codes mentioned above stand for:\n\n* 'Lu' - uppercase letters\n\n* 'Ll' - lowercase letters\n\n* 'Lt' - titlecase letters\n\n* 'Lm' - modifier letters\n\n* 'Lo' - other letters\n\n* 'Nl' - letter numbers\n\n* 'Mn' - nonspacing marks\n\n* 'Mc' - spacing combining marks\n\n* 'Nd' - decimal numbers\n\n* 'Pc' - connector punctuations\n\n* 'OtherIDStart' - explicit list of characters in PropList.txt(3)\nto support backwards compatibility\n\n* 'OtherIDContinue' - likewise\n",
            "subsections": []
        },
        "All identifiers are converted into the normal form NFKC while parsing;": {
            "content": "comparison of identifiers is based on NFKC.\n\nA non-normative HTML file listing all valid identifier characters for",
            "subsections": []
        },
        "Unicode 15.0.0 can be found at": {
            "content": "'https://www.unicode.org/Public/15.0.0/ucd/DerivedCoreProperties.txt'\n\n* Menu:\n\n* Keywords::\n* Soft Keywords::\n* Reserved classes of identifiers::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3131/\n\n(2) https://peps.python.org/pep-3131/\n\n(3) https://www.unicode.org/Public/15.0.0/ucd/PropList.txt\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Keywords,  Next: Soft Keywords,  Up: Identifiers and keywords": {
            "content": "4.2.3.1 Keywords\n................\n",
            "subsections": []
        },
        "The following identifiers are used as reserved words, or 'keywords' of": {
            "content": "the language, and cannot be used as ordinary identifiers.  They must be\nspelled exactly as written here:\n\nFalse      await      else       import     pass\nNone       break      except     in         raise\nTrue       class      finally    is         return\nand        continue   for        lambda     try\nas         def        from       nonlocal   while\nassert     del        global     not        with\nasync      elif       if         or         yield\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Soft Keywords,  Next: Reserved classes of identifiers,  Prev: Keywords,  Up: Identifiers and keywords": {
            "content": "4.2.3.2 Soft Keywords\n.....................\n\nNew in version 3.10.\n",
            "subsections": []
        },
        "Some identifiers are only reserved under specific contexts.  These are": {
            "content": "known as 'soft keywords'.  The identifiers 'match', 'case', 'type' and\n'' can syntactically act as keywords in certain contexts, but this\ndistinction is done at the parser level, not when tokenizing.\n",
            "subsections": []
        },
        "As soft keywords, their use in the grammar is possible while still": {
            "content": "preserving compatibility with existing code that uses these names as\nidentifier names.\n\n'match', 'case', and '' are used in the *note match: 601. statement.\n'type' is used in the *note type: 13a. statement.\n\nChanged in version 3.12: 'type' is now a soft keyword.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Reserved classes of identifiers,  Prev: Soft Keywords,  Up: Identifiers and keywords": {
            "content": "4.2.3.3 Reserved classes of identifiers\n.......................................\n\nCertain classes of identifiers (besides keywords) have special meanings.",
            "subsections": []
        },
        "These classes are identified by the patterns of leading and trailing": {
            "content": "underscore characters:\n\n'*'\n\nNot imported by 'from module import *'.\n\n''\n\nIn a 'case' pattern within a *note match: 601. statement, '' is a\n*note soft keyword: 600. that denotes a *note wildcard: 602.\n\nSeparately, the interactive interpreter makes the result of the\nlast evaluation available in the variable ''.  (It is stored in\nthe *note builtins: 10. module, alongside built-in functions like\n'print'.)\n\nElsewhere, '' is a regular identifier.  It is often used to name\n\"special\" items, but it is not special to Python itself.\n\nNote: The name '' is often used in conjunction with\ninternationalization; refer to the documentation for the *note\ngettext: 5e. module for more information on this convention.\n\nIt is also commonly used for unused variables.\n\n'*'\n\nSystem-defined names, informally known as \"dunder\" names.  These\nnames are defined by the interpreter and its implementation\n(including the standard library).  Current system names are\ndiscussed in the *note Special method names: ab9. section and\nelsewhere.  More will likely be defined in future versions of\nPython.  'Any' use of '*' names, in any context, that does not\nfollow explicitly documented use, is subject to breakage without\nwarning.\n\n'*'\n\nClass-private names.  Names in this category, when used within the\ncontext of a class definition, are re-written to use a mangled form\nto help avoid name clashes between \"private\" attributes of base and\nderived classes.  See section *note Identifiers (Names): 1bc1.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Literals,  Next: Operators,  Prev: Identifiers and keywords,  Up: Lexical analysis": {
            "content": "Literals are notations for constant values of some built-in types.\n\n* Menu:\n\n* String and Bytes literals::\n* String literal concatenation::\n* f-strings::\n* Numeric literals::\n* Integer literals::\n* Floating point literals::\n* Imaginary literals::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: String and Bytes literals,  Next: String literal concatenation,  Up: Literals": {
            "content": "4.2.4.1 String and Bytes literals\n.................................\n\nString literals are described by the following lexical definitions:\n\nstringliteral   ::= [stringprefix](shortstring | longstring)\nstringprefix    ::= \"r\" | \"u\" | \"R\" | \"U\" | \"f\" | \"F\"\n| \"fr\" | \"Fr\" | \"fR\" | \"FR\" | \"rf\" | \"rF\" | \"Rf\" | \"RF\"\nshortstring     ::= \"'\" shortstringitem* \"'\" | '\"' shortstringitem* '\"'\nlongstring      ::= \"'''\" longstringitem* \"'''\" | '\"\"\"' longstringitem* '\"\"\"'\nshortstringitem ::= shortstringchar | stringescapeseq\nlongstringitem  ::= longstringchar | stringescapeseq\nshortstringchar ::= <any source character except \"\\\" or newline or the quote>\nlongstringchar  ::= <any source character except \"\\\">\nstringescapeseq ::= \"\\\" <any source character>\n\nbytesliteral   ::= bytesprefix(shortbytes | longbytes)\nbytesprefix    ::= \"b\" | \"B\" | \"br\" | \"Br\" | \"bR\" | \"BR\" | \"rb\" | \"rB\" | \"Rb\" | \"RB\"\nshortbytes     ::= \"'\" shortbytesitem* \"'\" | '\"' shortbytesitem* '\"'\nlongbytes      ::= \"'''\" longbytesitem* \"'''\" | '\"\"\"' longbytesitem* '\"\"\"'\nshortbytesitem ::= shortbyteschar | bytesescapeseq\nlongbytesitem  ::= longbyteschar | bytesescapeseq\nshortbyteschar ::= <any ASCII character except \"\\\" or newline or the quote>\nlongbyteschar  ::= <any ASCII character except \"\\\">\nbytesescapeseq ::= \"\\\" <any ASCII character>\n",
            "subsections": []
        },
        "One syntactic restriction not indicated by these productions is that": {
            "content": "whitespace is not allowed between the *note stringprefix: 1bc7. or *note\nbytesprefix: 1bd0. and the rest of the literal.  The source character\nset is defined by the encoding declaration; it is UTF-8 if no encoding\ndeclaration is given in the source file; see section *note Encoding\ndeclarations: 1ba8.\n",
            "subsections": []
        },
        "In plain English: Both types of literals can be enclosed in matching": {
            "content": "single quotes (''') or double quotes ('\"').  They can also be enclosed\nin matching groups of three single or double quotes (these are generally\nreferred to as 'triple-quoted strings').  The backslash ('\\') character\nis used to give special meaning to otherwise ordinary characters like\n'n', which means 'newline' when escaped ('\\n').  It can also be used to\nescape characters that otherwise have a special meaning, such as\nnewline, backslash itself, or the quote character.  See *note escape\nsequences: 16a. below for examples.\n",
            "subsections": []
        },
        "Bytes literals are always prefixed with ''b'' or ''B''; they produce an": {
            "content": "instance of the *note bytes: 295. type instead of the *note str: 157.\ntype.  They may only contain ASCII characters; bytes with a numeric\nvalue of 128 or greater must be expressed with escapes.\n",
            "subsections": []
        },
        "Both string and bytes literals may optionally be prefixed with a letter": {
            "content": "''r'' or ''R''; such strings are called 'raw strings' and treat\nbackslashes as literal characters.  As a result, in string literals,\n''\\U'' and ''\\u'' escapes in raw strings are not treated specially.",
            "subsections": []
        },
        "Given that Python 2.x's raw unicode literals behave differently than": {
            "content": "Python 3.x's the ''ur'' syntax is not supported.\n",
            "subsections": []
        },
        "New in version 3.3: The ''rb'' prefix of raw bytes literals has been": {
            "content": "added as a synonym of ''br''.\n",
            "subsections": []
        },
        "Support for the unicode legacy literal ('u'value'') was reintroduced to": {
            "content": "simplify the maintenance of dual Python 2.x and 3.x codebases.  See PEP\n414(1) for more information.\n\nA string literal with ''f'' or ''F'' in its prefix is a 'formatted\nstring literal'; see *note f-strings: 7cd.  The ''f'' may be combined\nwith ''r'', but not with ''b'' or ''u'', therefore raw formatted strings\nare possible, but formatted bytes literals are not.\n",
            "subsections": []
        },
        "In triple-quoted literals, unescaped newlines and quotes are allowed": {
            "content": "(and are retained), except that three unescaped quotes in a row\nterminate the literal.  (A \"quote\" is the character used to open the\nliteral, i.e.  either ''' or '\"'.)\n\n* Menu:\n\n* Escape sequences::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0414/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Escape sequences,  Up: String and Bytes literals": {
            "content": "4.2.4.2 Escape sequences\n........................\n",
            "subsections": []
        },
        "Unless an ''r'' or ''R'' prefix is present, escape sequences in string": {
            "content": "and bytes literals are interpreted according to rules similar to those\nused by Standard C. The recognized escape sequences are:\n",
            "subsections": []
        },
        "Escape Sequence               Meaning                               Notes": {
            "content": "--------------------------------------------------------------------------------\n\n'\\N{NAME}'                    Character named 'name' in the         (5)\nUnicode database\n\n\n'\\uXXXX'                      Character with 16-bit hex value       (6)\n'xxxx'\n\n\n'\\UXXXXXXXX'                  Character with 32-bit hex value       (7)\n'xxxxxxxx'\n\n\nNotes:\n\n1. A backslash can be added at the end of a line to ignore the\nnewline:\n\n>>> 'This string will not include \\\n... backslashes or newline characters.'\n'This string will not include backslashes or newline characters.'\n\nThe same result can be achieved using *note triple-quoted strings:\n1bc5, or parentheses and *note string literal concatenation: 1bd9.\n\n2. As in Standard C, up to three octal digits are accepted.\n\nChanged in version 3.11: Octal escapes with value larger than\n'0o377' produce a *note DeprecationWarning: 179.\n\nChanged in version 3.12: Octal escapes with value larger than\n'0o377' produce a *note SyntaxWarning: 178.  In a future Python\nversion they will be eventually a *note SyntaxError: 146.\n\n3. Unlike in Standard C, exactly two hex digits are required.\n\n4. In a bytes literal, hexadecimal and octal escapes denote the byte\nwith the given value.  In a string literal, these escapes denote a\nUnicode character with the given value.\n\n5.\nChanged in version 3.3: Support for name aliases (1) has been\nadded.\n\n6. Exactly four hex digits are required.\n\n7. Any Unicode character can be encoded this way.  Exactly eight hex\ndigits are required.\n",
            "subsections": []
        },
        "Unlike Standard C, all unrecognized escape sequences are left in the": {
            "content": "string unchanged, i.e., 'the backslash is left in the result'.  (This\nbehavior is useful when debugging: if an escape sequence is mistyped,\nthe resulting output is more easily recognized as broken.)  It is also\nimportant to note that the escape sequences only recognized in string\nliterals fall into the category of unrecognized escapes for bytes\nliterals.\n\nChanged in version 3.6: Unrecognized escape sequences produce a *note\nDeprecationWarning: 179.\n\nChanged in version 3.12: Unrecognized escape sequences produce a *note",
            "subsections": []
        },
        "SyntaxWarning: 178.  In a future Python version they will be eventually": {
            "content": "a *note SyntaxError: 146.\n",
            "subsections": []
        },
        "Even in a raw literal, quotes can be escaped with a backslash, but the": {
            "content": "backslash remains in the result; for example, 'r\"\\\"\"' is a valid string\nliteral consisting of two characters: a backslash and a double quote;\n'r\"\\\"' is not a valid string literal (even a raw string cannot end in an\nodd number of backslashes).  Specifically, 'a raw literal cannot end in\na single backslash' (since the backslash would escape the following\nquote character).  Note also that a single backslash followed by a\nnewline is interpreted as those two characters as part of the literal,\n'not' as a line continuation.\n\n---------- Footnotes ----------\n\n(1) 'https://www.unicode.org/Public/15.0.0/ucd/NameAliases.txt'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: String literal concatenation,  Next: f-strings,  Prev: String and Bytes literals,  Up: Literals": {
            "content": "4.2.4.3 String literal concatenation\n....................................\n",
            "subsections": []
        },
        "Multiple adjacent string or bytes literals (delimited by whitespace),": {
            "content": "possibly using different quoting conventions, are allowed, and their\nmeaning is the same as their concatenation.  Thus, '\"hello\" 'world'' is\nequivalent to '\"helloworld\"'.  This feature can be used to reduce the\nnumber of backslashes needed, to split long strings conveniently across\nlong lines, or even to add comments to parts of strings, for example:\n\nre.compile(\"[A-Za-z]\"       # letter or underscore\n\"[A-Za-z0-9]*\"   # letter, digit or underscore\n)\n",
            "subsections": []
        },
        "Note that this feature is defined at the syntactical level, but": {
            "content": "implemented at compile time.  The '+' operator must be used to\nconcatenate string expressions at run time.  Also note that literal\nconcatenation can use different quoting styles for each component (even\nmixing raw strings and triple quoted strings), and formatted string\nliterals may be concatenated with plain string literals.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: f-strings,  Next: Numeric literals,  Prev: String literal concatenation,  Up: Literals": {
            "content": "4.2.4.4 f-strings\n.................\n\nNew in version 3.6.\n\nA 'formatted string literal' or 'f-string' is a string literal that is\nprefixed with ''f'' or ''F''.  These strings may contain replacement\nfields, which are expressions delimited by curly braces '{}'.  While\nother string literals always have a constant value, formatted strings\nare really expressions evaluated at run time.\n",
            "subsections": []
        },
        "Escape sequences are decoded like in ordinary string literals (except": {
            "content": "when a literal is also marked as a raw string).  After decoding, the\ngrammar for the contents of the string is:\n\nfstring          ::= (literalchar | \"{{\" | \"}}\" | replacementfield)*\nreplacementfield ::= \"{\" fexpression [\"=\"] [\"!\" conversion] [\":\" formatspec] \"}\"\nfexpression      ::= (conditionalexpression | \"*\" orexpr)\n(\",\" conditionalexpression | \",\" \"*\" orexpr)* [\",\"]\n| yieldexpression\nconversion        ::= \"s\" | \"r\" | \"a\"\nformatspec       ::= (literalchar | replacementfield)*\nliteralchar      ::= <any code point except \"{\", \"}\" or NULL>\n",
            "subsections": []
        },
        "The parts of the string outside curly braces are treated literally,": {
            "content": "except that any doubled curly braces ''{{'' or ''}}'' are replaced with\nthe corresponding single curly brace.  A single opening curly bracket\n''{'' marks a replacement field, which starts with a Python expression.",
            "subsections": []
        },
        "To display both the expression text and its value after evaluation,": {
            "content": "(useful in debugging), an equal sign ''='' may be added after the\nexpression.  A conversion field, introduced by an exclamation point\n''!'' may follow.  A format specifier may also be appended, introduced\nby a colon '':''.  A replacement field ends with a closing curly bracket\n''}''.\n",
            "subsections": []
        },
        "Expressions in formatted string literals are treated like regular Python": {
            "content": "expressions surrounded by parentheses, with a few exceptions.  An empty\nexpression is not allowed, and both *note lambda: 1115. and assignment\nexpressions ':=' must be surrounded by explicit parentheses.  Each\nexpression is evaluated in the context where the formatted string\nliteral appears, in order from left to right.  Replacement expressions\ncan contain newlines in both single-quoted and triple-quoted f-strings\nand they can contain comments.  Everything that comes after a '#' inside\na replacement field is a comment (even closing braces and quotes).  In\nthat case, replacement fields must be closed in a different line.\n\n>>> f\"abc{a # This is a comment }\"\n... + 3}\"\n'abc5'\n\nChanged in version 3.7: Prior to Python 3.7, an *note await: 516.\nexpression and comprehensions containing an *note async for: 8e0. clause\nwere illegal in the expressions in formatted string literals due to a\nproblem with the implementation.\n",
            "subsections": []
        },
        "Changed in version 3.12: Prior to Python 3.12, comments were not allowed": {
            "content": "inside f-string replacement fields.\n\nWhen the equal sign ''='' is provided, the output will have the\nexpression text, the ''='' and the evaluated value.  Spaces after the\nopening brace ''{'', within the expression and after the ''='' are all\nretained in the output.  By default, the ''='' causes the *note repr():\n5f0. of the expression to be provided, unless there is a format\nspecified.  When a format is specified it defaults to the *note str():\n157. of the expression unless a conversion ''!r'' is declared.\n\nNew in version 3.8: The equal sign ''=''.\n",
            "subsections": []
        },
        "If a conversion is specified, the result of evaluating the expression is": {
            "content": "converted before formatting.  Conversion ''!s'' calls *note str(): 157.\non the result, ''!r'' calls *note repr(): 5f0, and ''!a'' calls *note\nascii(): 123b.\n\nThe result is then formatted using the *note format(): 3eb. protocol.\nThe format specifier is passed to the *note format(): 3ea. method of\nthe expression or conversion result.  An empty string is passed when the\nformat specifier is omitted.  The formatted result is then included in\nthe final value of the whole string.\n\nTop-level format specifiers may include nested replacement fields.\nThese nested fields may include their own conversion fields and *note\nformat specifiers: 3a7, but may not include more deeply nested\nreplacement fields.  The *note format specifier mini-language: 3a7. is\nthe same as that used by the *note str.format(): 3ed. method.\n",
            "subsections": []
        },
        "Formatted string literals may be concatenated, but replacement fields": {
            "content": "cannot be split across literals.\n\nSome examples of formatted string literals:\n\n>>> name = \"Fred\"\n>>> f\"He said his name is {name!r}.\"\n\"He said his name is 'Fred'.\"\n>>> f\"He said his name is {repr(name)}.\"  # repr() is equivalent to !r\n\"He said his name is 'Fred'.\"\n>>> width = 10\n>>> precision = 4\n>>> value = decimal.Decimal(\"12.34567\")\n>>> f\"result: {value:{width}.{precision}}\"  # nested fields\n'result:      12.35'\n>>> today = datetime(year=2017, month=1, day=27)\n>>> f\"{today:%B %d, %Y}\"  # using date format specifier\n'January 27, 2017'\n>>> f\"{today=:%B %d, %Y}\" # using date format specifier and debugging\n'today=January 27, 2017'\n>>> number = 1024\n>>> f\"{number:#0x}\"  # using integer format specifier\n'0x400'\n>>> foo = \"bar\"\n>>> f\"{ foo = }\" # preserves whitespace\n\" foo = 'bar'\"\n>>> line = \"The mill's closed\"\n>>> f\"{line = }\"\n'line = \"The mill\\'s closed\"'\n>>> f\"{line = :20}\"\n\"line = The mill's closed   \"\n>>> f\"{line = !r:20}\"\n'line = \"The mill\\'s closed\" '\n",
            "subsections": []
        },
        "Reusing the outer f-string quoting type inside a replacement field is": {
            "content": "permitted:\n\n>>> a = dict(x=2)\n>>> f\"abc {a[\"x\"]} def\"\n'abc 2 def'\n",
            "subsections": []
        },
        "Changed in version 3.12: Prior to Python 3.12, reuse of the same quoting": {
            "content": "type of the outer f-string inside a replacement field was not possible.\n",
            "subsections": []
        },
        "Backslashes are also allowed in replacement fields and are evaluated the": {
            "content": "same way as in any other context:\n\n>>> a = [\"a\", \"b\", \"c\"]\n>>> print(f\"List a contains:\\n{\"\\n\".join(a)}\")\nList a contains:\na\nb\nc\n",
            "subsections": []
        },
        "Changed in version 3.12: Prior to Python 3.12, backslashes were not": {
            "content": "permitted inside an f-string replacement field.\n",
            "subsections": []
        },
        "Formatted string literals cannot be used as docstrings, even if they do": {
            "content": "not include expressions.\n\n>>> def foo():\n...     f\"Not a docstring\"\n...\n>>> foo.doc is None\nTrue\n",
            "subsections": []
        },
        "See also PEP 498(1) for the proposal that added formatted string": {
            "content": "literals, and *note str.format(): 3ed, which uses a related format\nstring mechanism.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0498/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Numeric literals,  Next: Integer literals,  Prev: f-strings,  Up: Literals": {
            "content": "4.2.4.5 Numeric literals\n........................\n",
            "subsections": []
        },
        "There are three types of numeric literals: integers, floating point": {
            "content": "numbers, and imaginary numbers.  There are no complex literals (complex\nnumbers can be formed by adding a real number and an imaginary number).\n",
            "subsections": []
        },
        "Note that numeric literals do not include a sign; a phrase like '-1' is": {
            "content": "actually an expression composed of the unary operator ''-'' and the\nliteral '1'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Integer literals,  Next: Floating point literals,  Prev: Numeric literals,  Up: Literals": {
            "content": "4.2.4.6 Integer literals\n........................\n\nInteger literals are described by the following lexical definitions:\n\ninteger      ::= decinteger | bininteger | octinteger | hexinteger\ndecinteger   ::= nonzerodigit ([\"\"] digit)* | \"0\"+ ([\"\"] \"0\")*\nbininteger   ::= \"0\" (\"b\" | \"B\") ([\"\"] bindigit)+\noctinteger   ::= \"0\" (\"o\" | \"O\") ([\"\"] octdigit)+\nhexinteger   ::= \"0\" (\"x\" | \"X\") ([\"\"] hexdigit)+\nnonzerodigit ::= \"1\"...\"9\"\ndigit        ::= \"0\"...\"9\"\nbindigit     ::= \"0\" | \"1\"\noctdigit     ::= \"0\"...\"7\"\nhexdigit     ::= digit | \"a\"...\"f\" | \"A\"...\"F\"\n",
            "subsections": []
        },
        "There is no limit for the length of integer literals apart from what can": {
            "content": "be stored in available memory.\n",
            "subsections": []
        },
        "Underscores are ignored for determining the numeric value of the": {
            "content": "literal.  They can be used to group digits for enhanced readability.",
            "subsections": []
        },
        "One underscore can occur between digits, and after base specifiers like": {
            "content": "'0x'.\n\nNote that leading zeros in a non-zero decimal number are not allowed.",
            "subsections": []
        },
        "This is for disambiguation with C-style octal literals, which Python": {
            "content": "used before version 3.0.\n\nSome examples of integer literals:\n\n7     2147483647                        0o177    0b100110111\n3     79228162514264337593543950336     0o377    0xdeadbeef\n100000000000                   0b11100101\n",
            "subsections": []
        },
        "Changed in version 3.6: Underscores are now allowed for grouping": {
            "content": "purposes in literals.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Floating point literals,  Next: Imaginary literals,  Prev: Integer literals,  Up: Literals": {
            "content": "4.2.4.7 Floating point literals\n...............................\n",
            "subsections": []
        },
        "Floating point literals are described by the following lexical": {
            "content": "definitions:\n\nfloatnumber   ::= pointfloat | exponentfloat\npointfloat    ::= [digitpart] fraction | digitpart \".\"\nexponentfloat ::= (digitpart | pointfloat) exponent\ndigitpart     ::= digit ([\"\"] digit)*\nfraction      ::= \".\" digitpart\nexponent      ::= (\"e\" | \"E\") [\"+\" | \"-\"] digitpart\n",
            "subsections": []
        },
        "Note that the integer and exponent parts are always interpreted using": {
            "content": "radix 10.  For example, '077e010' is legal, and denotes the same number\nas '77e10'.  The allowed range of floating point literals is\nimplementation-dependent.  As in integer literals, underscores are\nsupported for digit grouping.\n\nSome examples of floating point literals:\n\n3.14    10.    .001    1e100    3.14e-10    0e0    3.141593\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Imaginary literals,  Prev: Floating point literals,  Up: Literals": {
            "content": "4.2.4.8 Imaginary literals\n..........................\n\nImaginary literals are described by the following lexical definitions:\n\nimagnumber ::= (floatnumber | digitpart) (\"j\" | \"J\")\n\nAn imaginary literal yields a complex number with a real part of 0.0.",
            "subsections": []
        },
        "Complex numbers are represented as a pair of floating point numbers and": {
            "content": "have the same restrictions on their range.  To create a complex number\nwith a nonzero real part, add a floating point number to it, e.g.,\n'(3+4j)'.  Some examples of imaginary literals:\n\n3.14j   10.j    10j     .001j   1e100j   3.14e-10j   3.141593j\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Operators,  Next: Delimiters,  Prev: Literals,  Up: Lexical analysis": {
            "content": "The following tokens are operators:\n\n+       -       *             /       //      %      @\n<<      >>      &       |       ^       ~       :=\n<       >       <=      >=      ==      !=\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Delimiters,  Prev: Operators,  Up: Lexical analysis": {
            "content": "The following tokens serve as delimiters in the grammar:\n\n(       )       [       ]       {       }\n,       :       .       ;       @       =       ->\n+=      -=      *=      /=      //=     %=      @=\n&=      |=      ^=      >>=     <<=     =\n",
            "subsections": []
        },
        "The period can also occur in floating-point and imaginary literals.  A": {
            "content": "sequence of three periods has a special meaning as an ellipsis literal.",
            "subsections": []
        },
        "The second half of the list, the augmented assignment operators, serve": {
            "content": "lexically as delimiters, but also perform an operation.\n",
            "subsections": []
        },
        "The following printing ASCII characters have special meaning as part of": {
            "content": "other tokens or are otherwise significant to the lexical analyzer:\n\n'       \"       #       \\\n",
            "subsections": []
        },
        "The following printing ASCII characters are not used in Python.  Their": {
            "content": "occurrence outside string literals and comments is an unconditional\nerror:\n\n$       ?       `\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Data model,  Next: Execution model,  Prev: Lexical analysis,  Up: The Python Language Reference": {
            "content": "",
            "subsections": [
                {
                    "name": "4.3 Data model",
                    "content": "* Menu:\n\n* Objects, values and types: Objects values and types.\n* The standard type hierarchy::\n* Special method names::\n* Coroutines::\n"
                }
            ]
        },
        "File: python3.12.info,  Node: Objects values and types,  Next: The standard type hierarchy,  Up: Data model": {
            "content": "'Objects' are Python's abstraction for data.  All data in a Python\nprogram is represented by objects or by relations between objects.  (In\na sense, and in conformance to Von Neumann's model of a \"stored program\ncomputer\", code is also represented by objects.)\n",
            "subsections": []
        },
        "Every object has an identity, a type and a value.  An object's": {
            "content": "'identity' never changes once it has been created; you may think of it\nas the object's address in memory.  The *note is: 251. operator compares\nthe identity of two objects; the *note id(): 1279. function returns an\ninteger representing its identity.\n\n'CPython implementation detail:' For CPython, 'id(x)' is the memory\naddress where 'x' is stored.\n",
            "subsections": []
        },
        "An object's type determines the operations that the object supports": {
            "content": "(e.g., \"does it have a length?\") and also defines the possible values\nfor objects of that type.  The *note type(): ba0. function returns an\nobject's type (which is an object itself).  Like its identity, an\nobject's 'type' is also unchangeable.  (1)\n",
            "subsections": []
        },
        "The 'value' of some objects can change.  Objects whose value can change": {
            "content": "are said to be 'mutable'; objects whose value is unchangeable once they\nare created are called 'immutable'.  (The value of an immutable\ncontainer object that contains a reference to a mutable object can\nchange when the latter's value is changed; however the container is\nstill considered immutable, because the collection of objects it\ncontains cannot be changed.  So, immutability is not strictly the same\nas having an unchangeable value, it is more subtle.)  An object's\nmutability is determined by its type; for instance, numbers, strings and\ntuples are immutable, while dictionaries and lists are mutable.\n",
            "subsections": []
        },
        "Objects are never explicitly destroyed; however, when they become": {
            "content": "unreachable they may be garbage-collected.  An implementation is allowed\nto postpone garbage collection or omit it altogether -- it is a matter of\nimplementation quality how garbage collection is implemented, as long as\nno objects are collected that are still reachable.\n\n'CPython implementation detail:' CPython currently uses a\nreference-counting scheme with (optional) delayed detection of\ncyclically linked garbage, which collects most objects as soon as they\nbecome unreachable, but is not guaranteed to collect garbage containing\ncircular references.  See the documentation of the *note gc: 5b. module\nfor information on controlling the collection of cyclic garbage.  Other\nimplementations act differently and CPython may change.  Do not depend\non immediate finalization of objects when they become unreachable (so\nyou should always close files explicitly).\n",
            "subsections": []
        },
        "Note that the use of the implementation's tracing or debugging": {
            "content": "facilities may keep objects alive that would normally be collectable.\nAlso note that catching an exception with a *note try: 4bc....*note\nexcept: 379. statement may keep objects alive.\n\nSome objects contain references to \"external\" resources such as open\nfiles or windows.  It is understood that these resources are freed when\nthe object is garbage-collected, but since garbage collection is not\nguaranteed to happen, such objects also provide an explicit way to\nrelease the external resource, usually a 'close()' method.  Programs are\nstrongly recommended to explicitly close such objects.  The *note try:\n4bc....*note finally: 7ee. statement and the *note with: 396. statement\nprovide convenient ways to do this.\n",
            "subsections": []
        },
        "Some objects contain references to other objects; these are called": {
            "content": "'containers'.  Examples of containers are tuples, lists and\ndictionaries.  The references are part of a container's value.  In most\ncases, when we talk about the value of a container, we imply the values,\nnot the identities of the contained objects; however, when we talk about\nthe mutability of a container, only the identities of the immediately\ncontained objects are implied.  So, if an immutable container (like a\ntuple) contains a reference to a mutable object, its value changes if\nthat mutable object is changed.\n",
            "subsections": []
        },
        "Types affect almost all aspects of object behavior.  Even the importance": {
            "content": "of object identity is affected in some sense: for immutable types,\noperations that compute new values may actually return a reference to\nany existing object with the same type and value, while for mutable\nobjects this is not allowed.  E.g., after 'a = 1; b = 1', 'a' and 'b'\nmay or may not refer to the same object with the value one, depending on\nthe implementation, but after 'c = []; d = []', 'c' and 'd' are\nguaranteed to refer to two different, unique, newly created empty lists.\n(Note that 'c = d = []' assigns the same object to both 'c' and 'd'.)\n\n---------- Footnotes ----------\n\n(1) It 'is' possible in some cases to change an object's type, under\ncertain controlled conditions.  It generally isn't a good idea though,\nsince it can lead to some very strange behaviour if it is handled\nincorrectly.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The standard type hierarchy,  Next: Special method names,  Prev: Objects values and types,  Up: Data model": {
            "content": "",
            "subsections": []
        },
        "Below is a list of the types that are built into Python.  Extension": {
            "content": "modules (written in C, Java, or other languages, depending on the\nimplementation) can define additional types.  Future versions of Python\nmay add types to the type hierarchy (e.g., rational numbers, efficiently\nstored arrays of integers, etc.), although such additions will often be\nprovided via the standard library instead.\n",
            "subsections": []
        },
        "Some of the type descriptions below contain a paragraph listing 'special": {
            "content": "attributes.' These are attributes that provide access to the\nimplementation and are not intended for general use.  Their definition\nmay change in the future.\n\n* Menu:\n\n* None::\n* NotImplemented::\n* Ellipsis::\n* numbers.Number: numbers Number.\n* Sequences::\n* Set types::\n* Mappings::\n* Callable types::\n* Modules: Modules<3>.\n* Custom classes::\n* Class instances::\n* I/O objects (also known as file objects): I/O objects also known as file objects.\n* Internal types::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: None,  Next: NotImplemented,  Up: The standard type hierarchy": {
            "content": "4.3.2.1 None\n............\n\nThis type has a single value.  There is a single object with this value.",
            "subsections": []
        },
        "This object is accessed through the built-in name 'None'.  It is used to": {
            "content": "signify the absence of a value in many situations, e.g., it is returned\nfrom functions that don't explicitly return anything.  Its truth value\nis false.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: NotImplemented,  Next: Ellipsis,  Prev: None,  Up: The standard type hierarchy": {
            "content": "4.3.2.2 NotImplemented\n......................\n\nThis type has a single value.  There is a single object with this value.\nThis object is accessed through the built-in name *note NotImplemented:\n5c5.  Numeric methods and rich comparison methods should return this\nvalue if they do not implement the operation for the operands provided.\n(The interpreter will then try the reflected operation, or some other\nfallback, depending on the operator.)  It should not be evaluated in a\nboolean context.\n\nSee *note Implementing the arithmetic operations: 1c08. for more\ndetails.\n\nChanged in version 3.9: Evaluating *note NotImplemented: 5c5. in a\nboolean context is deprecated.  While it currently evaluates as true, it\nwill emit a *note DeprecationWarning: 179.  It will raise a *note\nTypeError: 28e. in a future version of Python.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Ellipsis,  Next: numbers Number,  Prev: NotImplemented,  Up: The standard type hierarchy": {
            "content": "4.3.2.3 Ellipsis\n................\n\nThis type has a single value.  There is a single object with this value.",
            "subsections": []
        },
        "This object is accessed through the literal '...' or the built-in name": {
            "content": "'Ellipsis'.  Its truth value is true.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: numbers Number,  Next: Sequences,  Prev: Ellipsis,  Up: The standard type hierarchy": {
            "content": "4.3.2.4 'numbers.Number'\n........................\n",
            "subsections": []
        },
        "These are created by numeric literals and returned as results by": {
            "content": "arithmetic operators and arithmetic built-in functions.  Numeric objects\nare immutable; once created their value never changes.  Python numbers\nare of course strongly related to mathematical numbers, but subject to\nthe limitations of numerical representation in computers.\n\nThe string representations of the numeric classes, computed by *note\nrepr(): 3e8. and *note str(): 3e9, have the following\nproperties:\n\n* They are valid numeric literals which, when passed to their class\nconstructor, produce an object having the value of the original\nnumeric.\n\n* The representation is in base 10, when possible.\n\n* Leading zeros, possibly excepting a single zero before a decimal\npoint, are not shown.\n\n* Trailing zeros, possibly excepting a single zero after a decimal\npoint, are not shown.\n\n* A sign is shown only when the number is negative.\n",
            "subsections": []
        },
        "Python distinguishes between integers, floating point numbers, and": {
            "content": "complex numbers:\n\n* Menu:\n\n* numbers.Integral: numbers Integral.\n* numbers.Real (float): numbers Real float.\n* numbers.Complex (complex): numbers Complex complex.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: numbers Integral,  Next: numbers Real float,  Up: numbers Number": {
            "content": "4.3.2.5 'numbers.Integral'\n..........................\n",
            "subsections": []
        },
        "These represent elements from the mathematical set of integers (positive": {
            "content": "and negative).\n\nNote:\nThe rules for integer representation are intended to give the most\nmeaningful interpretation of shift and mask operations involving\nnegative integers.\n\nThere are two types of integers:\n\nIntegers (*note int: 17e.)\n\nThese represent numbers in an unlimited range, subject to available\n(virtual) memory only.  For the purpose of shift and mask\noperations, a binary representation is assumed, and negative\nnumbers are represented in a variant of 2's complement which gives\nthe illusion of an infinite string of sign bits extending to the\nleft.\n\nBooleans (*note bool: 17d.)\n\nThese represent the truth values False and True.  The two objects\nrepresenting the values 'False' and 'True' are the only Boolean\nobjects.  The Boolean type is a subtype of the integer type, and\nBoolean values behave like the values 0 and 1, respectively, in\nalmost all contexts, the exception being that when converted to a\nstring, the strings '\"False\"' or '\"True\"' are returned,\nrespectively.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: numbers Real float,  Next: numbers Complex complex,  Prev: numbers Integral,  Up: numbers Number": {
            "content": "4.3.2.6 'numbers.Real' ('float')\n................................\n\nThese represent machine-level double precision floating point numbers.",
            "subsections": []
        },
        "You are at the mercy of the underlying machine architecture (and C or": {
            "content": "Java implementation) for the accepted range and handling of overflow.",
            "subsections": []
        },
        "Python does not support single-precision floating point numbers; the": {
            "content": "savings in processor and memory usage that are usually the reason for\nusing these are dwarfed by the overhead of using objects in Python, so\nthere is no reason to complicate the language with two kinds of floating\npoint numbers.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: numbers Complex complex,  Prev: numbers Real float,  Up: numbers Number": {
            "content": "4.3.2.7 'numbers.Complex' ('complex')\n.....................................\n",
            "subsections": []
        },
        "These represent complex numbers as a pair of machine-level double": {
            "content": "precision floating point numbers.  The same caveats apply as for\nfloating point numbers.  The real and imaginary parts of a complex\nnumber 'z' can be retrieved through the read-only attributes 'z.real'\nand 'z.imag'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Sequences,  Next: Set types,  Prev: numbers Number,  Up: The standard type hierarchy": {
            "content": "4.3.2.8 Sequences\n.................\n\nThese represent finite ordered sets indexed by non-negative numbers.\nThe built-in function *note len(): 3fb. returns the number of items of a\nsequence.  When the length of a sequence is 'n', the index set contains\nthe numbers 0, 1, ..., 'n'-1.  Item 'i' of sequence 'a' is selected by\n'a[i]'.  Some sequences, including built-in sequences, interpret\nnegative subscripts by adding the sequence length.  For example, 'a[-2]'\nequals 'a[n-2]', the second to last item of sequence a with length 'n'.\n\nSequences also support slicing: 'a[i:j]' selects all items with index\n'k' such that 'i' '<=' 'k' '<' 'j'.  When used as an expression, a slice\nis a sequence of the same type.  The comment above about negative\nindexes also applies to negative slice positions.\n\nSome sequences also support \"extended slicing\" with a third \"step\"\nparameter: 'a[i:j:k]' selects all items of 'a' with index 'x' where 'x =\ni + n*k', 'n' '>=' '0' and 'i' '<=' 'x' '<' 'j'.\n\nSequences are distinguished according to their mutability:\n\n* Menu:\n\n* Immutable sequences::\n* Mutable sequences::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Immutable sequences,  Next: Mutable sequences,  Up: Sequences": {
            "content": "4.3.2.9 Immutable sequences\n...........................\n",
            "subsections": []
        },
        "An object of an immutable sequence type cannot change once it is": {
            "content": "created.  (If the object contains references to other objects, these\nother objects may be mutable and may be changed; however, the collection\nof objects directly referenced by an immutable object cannot change.)\n\nThe following types are immutable sequences:\n",
            "subsections": []
        },
        "Strings": {
            "content": "A string is a sequence of values that represent Unicode code\npoints.  All the code points in the range 'U+0000 - U+10FFFF' can\nbe represented in a string.  Python doesn't have a char type;\ninstead, every code point in the string is represented as a string\nobject with length '1'.  The built-in function *note ord(): 1c10.\nconverts a code point from its string form to an integer in the\nrange '0 - 10FFFF'; *note chr(): 1c11. converts an integer in the\nrange '0 - 10FFFF' to the corresponding length '1' string object.\n*note str.encode(): 6ee. can be used to convert a *note str: 157.\nto *note bytes: 295. using the given text encoding, and *note\nbytes.decode(): 6ef. can be used to achieve the opposite.\n",
            "subsections": []
        },
        "Tuples": {
            "content": "The items of a tuple are arbitrary Python objects.  Tuples of two\nor more items are formed by comma-separated lists of expressions.\nA tuple of one item (a 'singleton') can be formed by affixing a\ncomma to an expression (an expression by itself does not create a\ntuple, since parentheses must be usable for grouping of\nexpressions).  An empty tuple can be formed by an empty pair of\nparentheses.\n",
            "subsections": []
        },
        "Bytes": {
            "content": "A bytes object is an immutable array.  The items are 8-bit bytes,\nrepresented by integers in the range 0 <= x < 256.  Bytes literals\n(like 'b'abc'') and the built-in *note bytes(): 295. constructor\ncan be used to create bytes objects.  Also, bytes objects can be\ndecoded to strings via the *note decode(): 6ef. method.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Mutable sequences,  Prev: Immutable sequences,  Up: Sequences": {
            "content": "4.3.2.10 Mutable sequences\n..........................\n",
            "subsections": []
        },
        "Mutable sequences can be changed after they are created.  The": {
            "content": "subscription and slicing notations can be used as the target of\nassignment and *note del: 14fb. (delete) statements.\n\nNote:\nThe *note collections: 1b. and *note array: 7. module provide\nadditional examples of mutable sequence types.\n\nThere are currently two intrinsic mutable sequence types:\n",
            "subsections": []
        },
        "Lists": {
            "content": "The items of a list are arbitrary Python objects.  Lists are formed\nby placing a comma-separated list of expressions in square\nbrackets.  (Note that there are no special cases needed to form\nlists of length 0 or 1.)\n",
            "subsections": []
        },
        "Byte Arrays": {
            "content": "A bytearray object is a mutable array.  They are created by the\nbuilt-in *note bytearray(): 294. constructor.  Aside from being\nmutable (and hence unhashable), byte arrays otherwise provide the\nsame interface and functionality as immutable *note bytes: 295.\nobjects.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Set types,  Next: Mappings,  Prev: Sequences,  Up: The standard type hierarchy": {
            "content": "4.3.2.11 Set types\n..................\n",
            "subsections": []
        },
        "These represent unordered, finite sets of unique, immutable objects.  As": {
            "content": "such, they cannot be indexed by any subscript.  However, they can be\niterated over, and the built-in function *note len(): 3fb. returns the\nnumber of items in a set.  Common uses for sets are fast membership\ntesting, removing duplicates from a sequence, and computing mathematical\noperations such as intersection, union, difference, and symmetric\ndifference.\n",
            "subsections": []
        },
        "For set elements, the same immutability rules apply as for dictionary": {
            "content": "keys.  Note that numeric types obey the normal rules for numeric\ncomparison: if two numbers compare equal (e.g., '1' and '1.0'), only one\nof them can be contained in a set.\n\nThere are currently two intrinsic set types:\n",
            "subsections": []
        },
        "Sets": {
            "content": "These represent a mutable set.  They are created by the built-in\n*note set(): 39d. constructor and can be modified afterwards by\nseveral methods, such as 'add()'.\n",
            "subsections": []
        },
        "Frozen sets": {
            "content": "These represent an immutable set.  They are created by the built-in\n*note frozenset(): 39e. constructor.  As a frozenset is immutable\nand *note hashable: 3db, it can be used again as an element of\nanother set, or as a dictionary key.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Mappings,  Next: Callable types,  Prev: Set types,  Up: The standard type hierarchy": {
            "content": "4.3.2.12 Mappings\n.................\n\nThese represent finite sets of objects indexed by arbitrary index sets.\nThe subscript notation 'a[k]' selects the item indexed by 'k' from the\nmapping 'a'; this can be used in expressions and as the target of\nassignments or *note del: 14fb. statements.  The built-in function *note\nlen(): 3fb. returns the number of items in a mapping.\n\nThere is currently a single intrinsic mapping type:\n\n* Menu:\n\n* Dictionaries: Dictionaries<2>.\n\nFile: python3.12.info,  Node: Dictionaries<2>,  Up: Mappings\n\n4.3.2.13 Dictionaries\n.....................\n",
            "subsections": []
        },
        "These represent finite sets of objects indexed by nearly arbitrary": {
            "content": "values.  The only types of values not acceptable as keys are values\ncontaining lists or dictionaries or other mutable types that are\ncompared by value rather than by object identity, the reason being that\nthe efficient implementation of dictionaries requires a key's hash value\nto remain constant.  Numeric types used for keys obey the normal rules\nfor numeric comparison: if two numbers compare equal (e.g., '1' and\n'1.0') then they can be used interchangeably to index the same\ndictionary entry.\n",
            "subsections": []
        },
        "Dictionaries preserve insertion order, meaning that keys will be": {
            "content": "produced in the same order they were added sequentially over the\ndictionary.  Replacing an existing key does not change the order,\nhowever removing a key and re-inserting it will add it to the end\ninstead of keeping its old place.\n\nDictionaries are mutable; they can be created by the '{...}' notation\n(see section *note Dictionary displays: bda.).\n\nThe extension modules *note dbm.ndbm: 32. and *note dbm.gnu: 31. provide\nadditional examples of mapping types, as does the *note collections: 1b.\nmodule.\n",
            "subsections": []
        },
        "Changed in version 3.7: Dictionaries did not preserve insertion order in": {
            "content": "versions of Python before 3.6.  In CPython 3.6, insertion order was\npreserved, but it was considered an implementation detail at that time\nrather than a language guarantee.\n\nFile: python3.12.info,  Node: Callable types,  Next: Modules<3>,  Prev: Mappings,  Up: The standard type hierarchy\n\n4.3.2.14 Callable types\n.......................\n",
            "subsections": []
        },
        "These are the types to which the function call operation (see section": {
            "content": "*note Calls: bd8.) can be applied:\n\n* Menu:\n\n* User-defined functions::\n* Instance methods::\n* Generator functions::\n* Coroutine functions::\n* Asynchronous generator functions::\n* Built-in functions::\n* Built-in methods::\n* Classes: Classes<2>.\n* Class Instances::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: User-defined functions,  Next: Instance methods,  Up: Callable types": {
            "content": "4.3.2.15 User-defined functions\n...............................\n\nA user-defined function object is created by a function definition (see\nsection *note Function definitions: 19bb.).  It should be called with an\nargument list containing the same number of items as the function's\nformal parameter list.\n\n* Menu:\n\n* Special read-only attributes::\n* Special writable attributes::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Special read-only attributes,  Next: Special writable attributes,  Up: User-defined functions": {
            "content": "4.3.2.16 Special read-only attributes\n.....................................\n",
            "subsections": []
        },
        "Attribute                                              Meaning": {
            "content": "--------------------------------------------------------------------------------------------------------------\n\n-- Attribute: function.doc                        The function's documentation string, or 'None' if\nunavailable.  Not inherited by subclasses.\n\n\n-- Attribute: function.name                       The function's name.  See also:\n*note name attributes: 1302.\n\n\n-- Attribute: function.qualname                   The function's *note qualified name: 16a7.  See\nalso: *note qualname attributes: 1c1c.\n\nNew in version 3.3.\n\n\n-- Attribute: function.module                     The name of the module the function was defined in,\nor 'None' if unavailable.\n\n\n-- Attribute: function.defaults                   A *note tuple: 4b8. containing default\n*note parameter: 1c1e. values for those parameters\nthat have defaults, or 'None' if no parameters have\na default value.\n\n\n-- Attribute: function.code                       The *note code object: 59f. representing the\ncompiled function body.\n\n\n-- Attribute: function.dict                       The namespace supporting arbitrary function\nattributes.  See also:\n*note dict attributes: aa8.\n\n\n-- Attribute: function.annotations                A *note dictionary: 237. containing annotations of\n*note parameters: 1c1e.  The keys of the dictionary\nare the parameter names, and ''return'' for the\nreturn annotation, if provided.  See also:\n*note Annotations Best Practices: 5cd.\n\n\n-- Attribute: function.kwdefaults                 A *note dictionary: 237. containing defaults for\nkeyword-only *note parameters: 1c1e.\n\n\n-- Attribute: function.typeparams                A *note tuple: 4b8. containing the\n*note type parameters: 166. of a\n*note generic function: 15e.\n\nNew in version 3.12.\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Special writable attributes,  Prev: Special read-only attributes,  Up: User-defined functions": {
            "content": "4.3.2.17 Special writable attributes\n....................................\n\nMost of these attributes check the type of the assigned value:\n",
            "subsections": []
        },
        "Function objects also support getting and setting arbitrary attributes,": {
            "content": "which can be used, for example, to attach metadata to functions.\nRegular attribute dot-notation is used to get and set such attributes.\n\n'CPython implementation detail:' CPython's current implementation only\nsupports function attributes on user-defined functions.  Function\nattributes on *note built-in functions: 1c20. may be supported in the\nfuture.\n",
            "subsections": []
        },
        "Additional information about a function's definition can be retrieved": {
            "content": "from its *note code object: 59f. (accessible via the *note code:\n1145. attribute).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Instance methods,  Next: Generator functions,  Prev: User-defined functions,  Up: Callable types": {
            "content": "4.3.2.18 Instance methods\n.........................\n",
            "subsections": []
        },
        "An instance method object combines a class, a class instance and any": {
            "content": "callable object (normally a user-defined function).\n\nSpecial read-only attributes:\n\n-- Attribute: method.self                         Refers to the class instance object to which the\nmethod is *note bound: 1c22.\n\n\n-- Attribute: method.func                         Refers to the original *note function object: 1a42.\n\n\n-- Attribute: method.doc                          The method's documentation (same as\n*note method.func.doc: 104d.).  A\n*note string: 157. if the original function had a\ndocstring, else 'None'.\n\n\n-- Attribute: method.name                         The name of the method (same as\n*note method.func.name: 1149.)\n\n\n-- Attribute: method.module                       The name of the module the method was defined in, or\n'None' if unavailable.\n\n",
            "subsections": []
        },
        "Methods also support accessing (but not setting) the arbitrary function": {
            "content": "attributes on the underlying *note function object: 1a42.\n",
            "subsections": []
        },
        "User-defined method objects may be created when getting an attribute of": {
            "content": "a class (perhaps via an instance of that class), if that attribute is a\nuser-defined *note function object: 1a42. or a *note classmethod: 246.\nobject.  When an instance method object is created by retrieving a\nuser-defined *note function object: 1a42. from a class via one of its\ninstances, its *note self: 121d. attribute is the instance, and the\nmethod object is said to be 'bound'.  The new method's *note func:\n1171. attribute is the original function object.\n\nWhen an instance method object is created by retrieving a *note\nclassmethod: 246. object from a class or instance, its *note self:\n121d. attribute is the class itself, and its *note func: 1171.\nattribute is the function object underlying the class method.\n\nWhen an instance method object is called, the underlying function (*note\nfunc: 1171.) is called, inserting the class instance (*note\nself: 121d.) in front of the argument list.  For instance, when 'C'\nis a class which contains a definition for a function 'f()', and 'x' is\nan instance of 'C', calling 'x.f(1)' is equivalent to calling 'C.f(x,\n1)'.\n\nWhen an instance method object is derived from a *note classmethod: 246.\nobject, the \"class instance\" stored in *note self: 121d. will\nactually be the class itself, so that calling either 'x.f(1)' or\n'C.f(1)' is equivalent to calling 'f(C,1)' where 'f' is the underlying\nfunction.\n\nNote that the transformation from *note function object: 1a42. to\ninstance method object happens each time the attribute is retrieved from\nthe instance.  In some cases, a fruitful optimization is to assign the\nattribute to a local variable and call that local variable.  Also notice\nthat this transformation only happens for user-defined functions; other\ncallable objects (and all non-callable objects) are retrieved without\ntransformation.  It is also important to note that user-defined\nfunctions which are attributes of a class instance are not converted to\nbound methods; this 'only' happens when the function is an attribute of\nthe class.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Generator functions,  Next: Coroutine functions,  Prev: Instance methods,  Up: Callable types": {
            "content": "4.3.2.19 Generator functions\n............................\n\nA function or method which uses the *note yield: 7f1. statement (see\nsection *note The yield statement: 7f1.) is called a 'generator\nfunction'.  Such a function, when called, always returns an *note\niterator: 16a9. object which can be used to execute the body of the\nfunction: calling the iterator's *note iterator.next(): 1141. method\nwill cause the function to execute until it provides a value using the\n'yield' statement.  When the function executes a *note return: 7f2.\nstatement or falls off the end, a *note StopIteration: a40. exception is\nraised and the iterator will have reached the end of the set of values\nto be returned.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Coroutine functions,  Next: Asynchronous generator functions,  Prev: Generator functions,  Up: Callable types": {
            "content": "4.3.2.20 Coroutine functions\n............................\n\nA function or method which is defined using *note async def: 394. is\ncalled a 'coroutine function'.  Such a function, when called, returns a\n*note coroutine: 1ae. object.  It may contain *note await: 516.\nexpressions, as well as *note async with: 399. and *note async for: 8e0.\nstatements.  See also the *note Coroutine Objects: 1c28. section.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Asynchronous generator functions,  Next: Built-in functions,  Prev: Coroutine functions,  Up: Callable types": {
            "content": "4.3.2.21 Asynchronous generator functions\n.........................................\n\nA function or method which is defined using *note async def: 394. and\nwhich uses the *note yield: 7f1. statement is called a 'asynchronous\ngenerator function'.  Such a function, when called, returns an *note\nasynchronous iterator: bd4. object which can be used in an *note async\nfor: 8e0. statement to execute the body of the function.\n\nCalling the asynchronous iterator's *note aiterator.anext: 1c2a.\nmethod will return an *note awaitable: ac3. which when awaited will\nexecute until it provides a value using the *note yield: 7f1.\nexpression.  When the function executes an empty *note return: 7f2.\nstatement or falls off the end, a *note StopAsyncIteration: 17a6.\nexception is raised and the asynchronous iterator will have reached the\nend of the set of values to be yielded.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Built-in functions,  Next: Built-in methods,  Prev: Asynchronous generator functions,  Up: Callable types": {
            "content": "4.3.2.22 Built-in functions\n...........................\n\nA built-in function object is a wrapper around a C function.  Examples\nof built-in functions are *note len(): 3fb. and *note math.sin(): 1315.\n(*note math: 89. is a standard built-in module).  The number and type of\nthe arguments are determined by the C function.  Special read-only\nattributes:\n\n* 'doc' is the function's documentation string, or 'None' if\nunavailable.  See *note function.doc: 104d.\n\n* 'name' is the function's name.  See *note function.name:\n1149.\n\n* 'self' is set to 'None' (but see the next item).\n\n* 'module' is the name of the module the function was defined in\nor 'None' if unavailable.  See *note function.module: 1c1d.\n\nFile: python3.12.info,  Node: Built-in methods,  Next: Classes<2>,  Prev: Built-in functions,  Up: Callable types\n\n4.3.2.23 Built-in methods\n.........................\n",
            "subsections": []
        },
        "This is really a different disguise of a built-in function, this time": {
            "content": "containing an object passed to the C function as an implicit extra\nargument.  An example of a built-in method is 'alist.append()', assuming\n'alist' is a list object.  In this case, the special read-only attribute\n'self' is set to the object denoted by 'alist'.  (The attribute has\nthe same semantics as it does with *note other instance methods: 121d.)\n\nFile: python3.12.info,  Node: Classes<2>,  Next: Class Instances,  Prev: Built-in methods,  Up: Callable types\n\n4.3.2.24 Classes\n................\n",
            "subsections": []
        },
        "Classes are callable.  These objects normally act as factories for new": {
            "content": "instances of themselves, but variations are possible for class types\nthat override *note new(): 2e2.  The arguments of the call are\npassed to 'new()' and, in the typical case, to *note init():\n47d. to initialize the new instance.\n\nFile: python3.12.info,  Node: Class Instances,  Prev: Classes<2>,  Up: Callable types\n\n4.3.2.25 Class Instances\n........................\n\nInstances of arbitrary classes can be made callable by defining a *note\ncall(): 2b1. method in their class.\n\nFile: python3.12.info,  Node: Modules<3>,  Next: Custom classes,  Prev: Callable types,  Up: The standard type hierarchy\n\n4.3.2.26 Modules\n................\n",
            "subsections": []
        },
        "Modules are a basic organizational unit of Python code, and are created": {
            "content": "by the *note import system: 1c31. as invoked either by the *note import:\n3a6. statement, or by calling functions such as *note\nimportlib.importmodule(): 26a. and built-in *note import(): 6ed.  A\nmodule object has a namespace implemented by a *note dictionary: 237.\nobject (this is the dictionary referenced by the *note globals:\n1148. attribute of functions defined in the module).  Attribute\nreferences are translated to lookups in this dictionary, e.g., 'm.x' is\nequivalent to 'm.dict[\"x\"]'.  A module object does not contain the\ncode object used to initialize the module (since it isn't needed once\nthe initialization is done).\n",
            "subsections": []
        },
        "Attribute assignment updates the module's namespace dictionary, e.g.,": {
            "content": "'m.x = 1' is equivalent to 'm.dict[\"x\"] = 1'.\n\nPredefined (writable) attributes:\n\n*note name: 11fd.\n\nThe module's name.\n\n'doc'\n\nThe module's documentation string, or 'None' if unavailable.\n\n*note file: 1c32.\n\nThe pathname of the file from which the module was loaded, if\nit was loaded from a file.  The *note file: 1c32.\nattribute may be missing for certain types of modules, such as\nC modules that are statically linked into the interpreter.\nFor extension modules loaded dynamically from a shared\nlibrary, it's the pathname of the shared library file.\n\n'annotations'\n\nA dictionary containing *note variable annotations: bb0.\ncollected during module body execution.  For best practices on\nworking with 'annotations', please see *note Annotations\nBest Practices: 5cd.\n\nSpecial read-only attribute: *note dict: aa8. is the module's\nnamespace as a dictionary object.\n\n'CPython implementation detail:' Because of the way CPython clears\nmodule dictionaries, the module dictionary will be cleared when the\nmodule falls out of scope even if the dictionary still has live\nreferences.  To avoid this, copy the dictionary or keep the module\naround while using its dictionary directly.\n\nFile: python3.12.info,  Node: Custom classes,  Next: Class instances,  Prev: Modules<3>,  Up: The standard type hierarchy\n\n4.3.2.27 Custom classes\n.......................\n",
            "subsections": []
        },
        "Custom class types are typically created by class definitions (see": {
            "content": "section *note Class definitions: 114c.).  A class has a namespace\nimplemented by a dictionary object.  Class attribute references are\ntranslated to lookups in this dictionary, e.g., 'C.x' is translated to\n'C.dict[\"x\"]' (although there are a number of hooks which allow for\nother means of locating attributes).  When the attribute name is not\nfound there, the attribute search continues in the base classes.  This\nsearch of the base classes uses the C3 method resolution order which\nbehaves correctly even in the presence of 'diamond' inheritance\nstructures where there are multiple inheritance paths leading back to a\ncommon ancestor.  Additional details on the C3 MRO used by Python can be\nfound in the documentation accompanying the 2.3 release at\n'https://www.python.org/download/releases/2.3/mro/'.\n",
            "subsections": []
        },
        "When a class attribute reference (for class 'C', say) would yield a": {
            "content": "class method object, it is transformed into an instance method object\nwhose *note self: 121d. attribute is 'C'.  When it would yield a\n*note staticmethod: 5cc. object, it is transformed into the object\nwrapped by the static method object.  See section *note Implementing",
            "subsections": []
        },
        "Descriptors: a98. for another way in which attributes retrieved from a": {
            "content": "class may differ from those actually contained in its *note dict:\naa8.\n",
            "subsections": []
        },
        "Class attribute assignments update the class's dictionary, never the": {
            "content": "dictionary of a base class.\n\nA class object can be called (see above) to yield a class instance (see\nbelow).\n\nSpecial attributes:\n\n*note name: 1302.\n\nThe class name.\n\n'module'\n\nThe name of the module in which the class was defined.\n\n*note dict: aa8.\n\nThe dictionary containing the class's namespace.\n\n*note bases: 1303.\n\nA tuple containing the base classes, in the order of their\noccurrence in the base class list.\n\n'doc'\n\nThe class's documentation string, or 'None' if undefined.\n\n'annotations'\n\nA dictionary containing *note variable annotations: bb0.\ncollected during class body execution.  For best practices on\nworking with 'annotations', please see *note Annotations\nBest Practices: 5cd.\n\n'typeparams'\n\nA tuple containing the *note type parameters: 166. of a *note\ngeneric class: 15d.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Class instances,  Next: I/O objects also known as file objects,  Prev: Custom classes,  Up: The standard type hierarchy": {
            "content": "4.3.2.28 Class instances\n........................\n\nA class instance is created by calling a class object (see above).  A\nclass instance has a namespace implemented as a dictionary which is the\nfirst place in which attribute references are searched.  When an\nattribute is not found there, and the instance's class has an attribute\nby that name, the search continues with the class attributes.  If a\nclass attribute is found that is a user-defined function object, it is\ntransformed into an instance method object whose *note self: 121d.\nattribute is the instance.  Static method and class method objects are\nalso transformed; see above under \"Classes\".  See section *note",
            "subsections": []
        },
        "Implementing Descriptors: a98. for another way in which attributes of a": {
            "content": "class retrieved via its instances may differ from the objects actually\nstored in the class's *note dict: aa8.  If no class attribute is\nfound, and the object's class has a *note getattr(): 1f8. method,\nthat is called to satisfy the lookup.\n",
            "subsections": []
        },
        "Attribute assignments and deletions update the instance's dictionary,": {
            "content": "never a class's dictionary.  If the class has a *note setattr():\n1c35. or *note delattr(): 1c36. method, this is called instead of\nupdating the instance dictionary directly.\n",
            "subsections": []
        },
        "Class instances can pretend to be numbers, sequences, or mappings if": {
            "content": "they have methods with certain special names.  See section *note Special\nmethod names: ab9.\n\nSpecial attributes: *note dict: aa8. is the attribute dictionary;\n*note class: 1304. is the instance's class.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: I/O objects also known as file objects,  Next: Internal types,  Prev: Class instances,  Up: The standard type hierarchy": {
            "content": "4.3.2.29 I/O objects (also known as file objects)\n.................................................\n\nA *note file object: 1037. represents an open file.  Various shortcuts\nare available to create file objects: the *note open(): 26e. built-in\nfunction, and also *note os.popen(): 8b5, *note os.fdopen(): 1c38, and\nthe *note makefile(): 1013. method of socket objects (and perhaps by\nother functions or methods provided by extension modules).\n",
            "subsections": []
        },
        "The objects 'sys.stdin', 'sys.stdout' and 'sys.stderr' are initialized": {
            "content": "to file objects corresponding to the interpreter's standard input,\noutput and error streams; they are all open in text mode and therefore\nfollow the interface defined by the *note io.TextIOBase: 461. abstract\nclass.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Internal types,  Prev: I/O objects also known as file objects,  Up: The standard type hierarchy": {
            "content": "4.3.2.30 Internal types\n.......................\n\nA few types used internally by the interpreter are exposed to the user.",
            "subsections": []
        },
        "Their definitions may change with future versions of the interpreter,": {
            "content": "but they are mentioned here for completeness.\n\n* Menu:\n\n* Code objects::\n* Frame objects::\n* Traceback objects::\n* Slice objects::\n* Static method objects::\n* Class method objects::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Code objects,  Next: Frame objects,  Up: Internal types": {
            "content": "4.3.2.31 Code objects\n.....................\n\nCode objects represent 'byte-compiled' executable Python code, or *note\nbytecode: 370.  The difference between a code object and a function\nobject is that the function object contains an explicit reference to the\nfunction's globals (the module in which it was defined), while a code\nobject contains no context; also the default argument values are stored\nin the function object, not in the code object (because they represent\nvalues calculated at run-time).  Unlike function objects, code objects\nare immutable and contain no references (directly or indirectly) to\nmutable objects.\n\n* Menu:\n\n* Special read-only attributes: Special read-only attributes<2>.\n* Methods on code objects::\n\nFile: python3.12.info,  Node: Special read-only attributes<2>,  Next: Methods on code objects,  Up: Code objects\n\n4.3.2.32 Special read-only attributes\n.....................................\n\n-- Attribute: codeobject.coname                      The function name\n\n\n-- Attribute: codeobject.coqualname                  The fully qualified function name\n\nNew in version 3.11.\n\n\n-- Attribute: codeobject.coargcount                  The total number of positional\n*note parameters: 1c1e. (including positional-only\nparameters and parameters with default values) that\nthe function has\n\n\n-- Attribute: codeobject.coposonlyargcount           The number of positional-only\n*note parameters: 1c1e. (including arguments with\ndefault values) that the function has\n\n\n-- Attribute: codeobject.cokwonlyargcount            The number of keyword-only *note parameters: 1c1e.\n(including arguments with default values) that the\nfunction has\n\n\n-- Attribute: codeobject.conlocals                   The number of *note local variables: 1c19. used by\nthe function (including parameters)\n\n\n-- Attribute: codeobject.covarnames                  A *note tuple: 4b8. containing the names of the\nlocal variables in the function (starting with the\nparameter names)\n\n\n-- Attribute: codeobject.cocellvars                  A *note tuple: 4b8. containing the names of\n*note local variables: 1c19. that are referenced by\nnested functions inside the function\n\n\n-- Attribute: codeobject.cofreevars                  A *note tuple: 4b8. containing the names of free\nvariables in the function\n\n\n-- Attribute: codeobject.cocode                      A string representing the sequence of\n*note bytecode: 370. instructions in the function\n\n\n-- Attribute: codeobject.coconsts                    A *note tuple: 4b8. containing the literals used by\nthe *note bytecode: 370. in the function\n\n\n-- Attribute: codeobject.conames                     A *note tuple: 4b8. containing the names used by the\n*note bytecode: 370. in the function\n\n\n-- Attribute: codeobject.cofilename                  The name of the file from which the code was\ncompiled\n\n\n-- Attribute: codeobject.cofirstlineno               The line number of the first line of the function\n\n\n-- Attribute: codeobject.colnotab                    A string encoding the mapping from\n*note bytecode: 370. offsets to line numbers.  For\ndetails, see the source code of the interpreter.\n\nDeprecated since version 3.12: This attribute of\ncode objects is deprecated, and may be removed in\nPython 3.14.\n\n\n-- Attribute: codeobject.costacksize                 The required stack size of the code object\n\n\n-- Attribute: codeobject.coflags                     An *note integer: 17e. encoding a number of flags\nfor the interpreter.\n\n\nThe following flag bits are defined for *note coflags: 1c4a.: bit\n'0x04' is set if the function uses the '*arguments' syntax to accept an\narbitrary number of positional arguments; bit '0x08' is set if the\nfunction uses the 'keywords' syntax to accept arbitrary keyword\narguments; bit '0x20' is set if the function is a generator.  See *note",
            "subsections": []
        },
        "Code Objects Bit Flags: 1c4b. for details on the semantics of each flags": {
            "content": "that might be present.\n",
            "subsections": []
        },
        "Future feature declarations ('from future import division') also use": {
            "content": "bits in *note coflags: 1c4a. to indicate whether a code object was\ncompiled with a particular feature enabled: bit '0x2000' is set if the\nfunction was compiled with future division enabled; bits '0x10' and\n'0x1000' were used in earlier versions of Python.\n\nOther bits in *note coflags: 1c4a. are reserved for internal use.\n\nIf a code object represents a function, the first item in *note\ncoconsts: 1c46. is the documentation string of the function, or 'None'\nif undefined.\n\nFile: python3.12.info,  Node: Methods on code objects,  Prev: Special read-only attributes<2>,  Up: Code objects\n\n4.3.2.33 Methods on code objects\n................................\n\n-- Method: codeobject.copositions ()\n\nReturns an iterable over the source code positions of each *note\nbytecode: 370. instruction in the code object.\n\nThe iterator returns *note tuple: 4b8.s containing the\n'(startline, endline, startcolumn, endcolumn)'.  The 'i-th'\ntuple corresponds to the position of the source code that compiled\nto the 'i-th' instruction.  Column information is 0-indexed utf-8\nbyte offsets on the given source line.\n\nThis positional information can be missing.  A non-exhaustive lists\nof cases where this may happen:\n\n- Running the interpreter with *note -X: 188. 'nodebugranges'.\n\n- Loading a pyc file compiled while using *note -X: 188.\n'nodebugranges'.\n\n- Position tuples corresponding to artificial instructions.\n\n- Line and column numbers that can't be represented due to\nimplementation specific limitations.\n\nWhen this occurs, some or all of the tuple elements can be *note\nNone: 43f.\n\nNew in version 3.11.\n\nNote: This feature requires storing column positions in code\nobjects which may result in a small increase of disk usage of\ncompiled Python files or interpreter memory usage.  To avoid\nstoring the extra information and/or deactivate printing the\nextra traceback information, the *note -X: 188.\n'nodebugranges' command line flag or the *note\nPYTHONNODEBUGRANGES: 375. environment variable can be used.\n\n-- Method: codeobject.colines ()\n\nReturns an iterator that yields information about successive ranges\nof *note bytecode: 370.s.  Each item yielded is a '(start, end,\nlineno)' *note tuple: 4b8.:\n\n* 'start' (an *note int: 17e.) represents the offset (inclusive)\nof the start of the *note bytecode: 370. range\n\n* 'end' (an *note int: 17e.) represents the offset (exclusive)\nof the end of the *note bytecode: 370. range\n\n* 'lineno' is an *note int: 17e. representing the line number of\nthe *note bytecode: 370. range, or 'None' if the bytecodes in\nthe given range have no line number\n\nThe items yielded will have the following properties:\n\n* The first range yielded will have a 'start' of 0.\n\n* The '(start, end)' ranges will be non-decreasing and\nconsecutive.  That is, for any pair of *note tuple: 4b8.s, the\n'start' of the second will be equal to the 'end' of the first.\n\n* No range will be backwards: 'end >= start' for all triples.\n\n* The last *note tuple: 4b8. yielded will have 'end' equal to\nthe size of the *note bytecode: 370.\n\nZero-width ranges, where 'start == end', are allowed.  Zero-width\nranges are used for lines that are present in the source code, but\nhave been eliminated by the *note bytecode: 370. compiler.\n\nNew in version 3.10.\n\nSee also\n........\n\nPEP 626(1) - Precise line numbers for debugging and other tools.\n\nThe PEP that introduced the 'colines()' method.\n\n-- Method: codeobject.replace (kwargs)\n\nReturn a copy of the code object with new values for the specified\nfields.\n\nNew in version 3.8.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0626/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Frame objects,  Next: Traceback objects,  Prev: Code objects,  Up: Internal types": {
            "content": "4.3.2.34 Frame objects\n......................\n\nFrame objects represent execution frames.  They may occur in *note\ntraceback objects: 92b, and are also passed to registered trace\nfunctions.\n\n* Menu:\n\n* Special read-only attributes: Special read-only attributes<3>.\n* Special writable attributes: Special writable attributes<2>.\n* Frame object methods::\n\nFile: python3.12.info,  Node: Special read-only attributes<3>,  Next: Special writable attributes<2>,  Up: Frame objects\n\n4.3.2.35 Special read-only attributes\n.....................................\n\n-- Attribute: frame.fback                            Points to the previous stack frame (towards the\ncaller), or 'None' if this is the bottom stack frame\n\n\n-- Attribute: frame.fcode                            The *note code object: 59f. being executed in this\nframe.  Accessing this attribute raises an\n*note auditing event: 161d. 'object.getattr'\nwith arguments 'obj' and '\"fcode\"'.\n\n\n-- Attribute: frame.flocals                          The dictionary used by the frame to look up\n*note local variables: 1c19.\n\n\n-- Attribute: frame.fglobals                         The dictionary used by the frame to look up\n*note global variables: 1c19.\n\n\n-- Attribute: frame.fbuiltins                        The dictionary used by the frame to look up\n*note built-in (intrinsic) names: 1c19.\n\n\n-- Attribute: frame.flasti                           The \"precise instruction\" of the frame object (this\nis an index into the *note bytecode: 370. string of\nthe *note code object: 59f.)\n\n\nFile: python3.12.info,  Node: Special writable attributes<2>,  Next: Frame object methods,  Prev: Special read-only attributes<3>,  Up: Frame objects\n\n4.3.2.36 Special writable attributes\n....................................\n\n-- Attribute: frame.ftrace                           If not 'None', this is a function called for various\nevents during code execution (this is used by\ndebuggers).  Normally an event is triggered for each\nnew source line (see *note ftracelines: a1f.).\n\n\n-- Attribute: frame.ftracelines                     Set this attribute to *note False: 971. to disable\ntriggering a tracing event for each source line.\n\n\n-- Attribute: frame.ftraceopcodes                   Set this attribute to *note True: a53. to allow\nper-opcode events to be requested.  Note that this\nmay lead to undefined interpreter behaviour if\nexceptions raised by the trace function escape to\nthe function being traced.\n\n\n-- Attribute: frame.flineno                          The current line number of the frame - writing to\nthis from within a trace function jumps to the given\nline (only for the bottom-most frame).  A debugger\ncan implement a Jump command (aka Set Next\nStatement) by writing to this attribute.\n\n\nFile: python3.12.info,  Node: Frame object methods,  Prev: Special writable attributes<2>,  Up: Frame objects\n\n4.3.2.37 Frame object methods\n.............................\n\nFrame objects support one method:\n\n-- Method: frame.clear ()\n\nThis method clears all references to *note local variables: 1c19.\nheld by the frame.  Also, if the frame belonged to a *note\ngenerator: eda, the generator is finalized.  This helps break\nreference cycles involving frame objects (for example when catching\nan *note exception: 15e6. and storing its *note traceback: 92b. for\nlater use).\n\n*note RuntimeError: 17a. is raised if the frame is currently\nexecuting.\n\nNew in version 3.4.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Traceback objects,  Next: Slice objects,  Prev: Frame objects,  Up: Internal types": {
            "content": "4.3.2.38 Traceback objects\n..........................\n\nTraceback objects represent the stack trace of an *note exception: 1a0f.\nA traceback object is implicitly created when an exception occurs, and\nmay also be explicitly created by calling *note types.TracebackType:\n929.\n",
            "subsections": []
        },
        "Changed in version 3.7: Traceback objects can now be explicitly": {
            "content": "instantiated from Python code.\n",
            "subsections": []
        },
        "For implicitly created tracebacks, when the search for an exception": {
            "content": "handler unwinds the execution stack, at each unwound level a traceback\nobject is inserted in front of the current traceback.  When an exception\nhandler is entered, the stack trace is made available to the program.\n(See section *note The try statement: 4bc.)  It is accessible as the\nthird item of the tuple returned by *note sys.excinfo(): 456, and as\nthe *note traceback: 113c. attribute of the caught exception.\n",
            "subsections": []
        },
        "When the program contains no suitable handler, the stack trace is": {
            "content": "written (nicely formatted) to the standard error stream; if the\ninterpreter is interactive, it is also made available to the user as\n*note sys.lasttraceback: 1e5.\n",
            "subsections": []
        },
        "For explicitly created tracebacks, it is up to the creator of the": {
            "content": "traceback to determine how the *note tbnext: 92a. attributes should be\nlinked to form a full stack trace.\n\nSpecial read-only attributes:\n\n-- Attribute: traceback.tbframe                      Points to the execution *note frame: 4af. of the\ncurrent level.\n\nAccessing this attribute raises an\n*note auditing event: 161d. 'object.getattr'\nwith arguments 'obj' and '\"tbframe\"'.\n\n\n-- Attribute: traceback.tblineno                     Gives the line number where the exception occurred\n\n\n-- Attribute: traceback.tblasti                      Indicates the \"precise instruction\".\n\n",
            "subsections": []
        },
        "The line number and last instruction in the traceback may differ from": {
            "content": "the line number of its *note frame object: 4af. if the exception\noccurred in a *note try: 4bc. statement with no matching except clause\nor with a *note finally: 7ee. clause.\n\n-- Attribute: traceback.tbnext\n\nThe special writable attribute 'tbnext' is the next level in the\nstack trace (towards the frame where the exception occurred), or\n'None' if there is no next level.\n\nChanged in version 3.7: This attribute is now writable\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Slice objects,  Next: Static method objects,  Prev: Traceback objects,  Up: Internal types": {
            "content": "4.3.2.39 Slice objects\n......................\n\nSlice objects are used to represent slices for *note getitem(): 4b9.\nmethods.  They are also created by the built-in *note slice(): 180.\nfunction.\n\nSpecial read-only attributes: *note start: 1c5b. is the lower bound;\n*note stop: 1c5c. is the upper bound; *note step: 1c5d. is the step\nvalue; each is 'None' if omitted.  These attributes can have any type.\n\nSlice objects support one method:\n\n-- Method: slice.indices (self, length)\n\nThis method takes a single integer argument 'length' and computes\ninformation about the slice that the slice object would describe if\napplied to a sequence of 'length' items.  It returns a tuple of\nthree integers; respectively these are the 'start' and 'stop'\nindices and the 'step' or stride length of the slice.  Missing or\nout-of-bounds indices are handled in a manner consistent with\nregular slices.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Static method objects,  Next: Class method objects,  Prev: Slice objects,  Up: Internal types": {
            "content": "4.3.2.40 Static method objects\n..............................\n",
            "subsections": []
        },
        "Static method objects provide a way of defeating the transformation of": {
            "content": "function objects to method objects described above.  A static method\nobject is a wrapper around any other object, usually a user-defined\nmethod object.  When a static method object is retrieved from a class or\na class instance, the object actually returned is the wrapped object,\nwhich is not subject to any further transformation.  Static method\nobjects are also callable.  Static method objects are created by the\nbuilt-in *note staticmethod(): 5cc. constructor.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Class method objects,  Prev: Static method objects,  Up: Internal types": {
            "content": "4.3.2.41 Class method objects\n.............................\n\nA class method object, like a static method object, is a wrapper around\nanother object that alters the way in which that object is retrieved\nfrom classes and class instances.  The behaviour of class method objects\nupon such retrieval is described above, under *note \"instance methods\":\n1a41.  Class method objects are created by the built-in *note\nclassmethod(): 246. constructor.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Special method names,  Next: Coroutines,  Prev: The standard type hierarchy,  Up: Data model": {
            "content": "A class can implement certain operations that are invoked by special\nsyntax (such as arithmetic operations or subscripting and slicing) by\ndefining methods with special names.  This is Python's approach to\n'operator overloading', allowing classes to define their own behavior\nwith respect to language operators.  For instance, if a class defines a\nmethod named *note getitem(): 4b9, and 'x' is an instance of this\nclass, then 'x[i]' is roughly equivalent to 'type(x).getitem(x, i)'.",
            "subsections": []
        },
        "Except where mentioned, attempts to execute an operation raise an": {
            "content": "exception when no appropriate method is defined (typically *note\nAttributeError: 395. or *note TypeError: 28e.).\n",
            "subsections": []
        },
        "Setting a special method to 'None' indicates that the corresponding": {
            "content": "operation is not available.  For example, if a class sets *note\niter(): 1c61. to 'None', the class is not iterable, so calling *note\niter(): 5ca. on its instances will raise a *note TypeError: 28e.\n(without falling back to *note getitem(): 4b9.).  (1)\n",
            "subsections": []
        },
        "When implementing a class that emulates any built-in type, it is": {
            "content": "important that the emulation only be implemented to the degree that it\nmakes sense for the object being modelled.  For example, some sequences\nmay work well with retrieval of individual elements, but extracting a\nslice may not make sense.  (One example of this is the 'NodeList'\ninterface in the W3C's Document Object Model.)\n\n* Menu:\n\n* Basic customization::\n* Customizing attribute access::\n* Customizing class creation::\n* Customizing instance and subclass checks::\n* Emulating generic types::\n* Emulating callable objects::\n* Emulating container types::\n* Emulating numeric types::\n* With Statement Context Managers::\n* Customizing positional arguments in class pattern matching::\n* Emulating buffer types::\n* Special method lookup::\n\n---------- Footnotes ----------\n\n(1) The *note hash(): 932, *note iter(): 1c61, *note\nreversed(): 1c62, and *note contains(): 1c63. methods have\nspecial handling for this; others will still raise a *note TypeError:\n28e, but may do so by relying on the behavior that 'None' is not\ncallable.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Basic customization,  Next: Customizing attribute access,  Up: Special method names": {
            "content": "4.3.3.1 Basic customization\n...........................\n\n-- Method: object.new (cls[, ...])\n\nCalled to create a new instance of class 'cls'.  *note new():\n2e2. is a static method (special-cased so you need not declare it\nas such) that takes the class of which an instance was requested as\nits first argument.  The remaining arguments are those passed to\nthe object constructor expression (the call to the class).  The\nreturn value of *note new(): 2e2. should be the new object\ninstance (usually an instance of 'cls').\n\nTypical implementations create a new instance of the class by\ninvoking the superclass's *note new(): 2e2. method using\n'super().new(cls[, ...])' with appropriate arguments and then\nmodifying the newly created instance as necessary before returning\nit.\n\nIf *note new(): 2e2. is invoked during object construction and\nit returns an instance of 'cls', then the new instance's *note\ninit(): 47d. method will be invoked like 'init(self[,\n...])', where 'self' is the new instance and the remaining\narguments are the same as were passed to the object constructor.\n\nIf *note new(): 2e2. does not return an instance of 'cls', then\nthe new instance's *note init(): 47d. method will not be\ninvoked.\n\n*note new(): 2e2. is intended mainly to allow subclasses of\nimmutable types (like int, str, or tuple) to customize instance\ncreation.  It is also commonly overridden in custom metaclasses in\norder to customize class creation.\n\n-- Method: object.init (self[, ...])\n\nCalled after the instance has been created (by *note new():\n2e2.), but before it is returned to the caller.  The arguments are\nthose passed to the class constructor expression.  If a base class\nhas an *note init(): 47d. method, the derived class's *note\ninit(): 47d. method, if any, must explicitly call it to ensure\nproper initialization of the base class part of the instance; for\nexample: 'super().init([args...])'.\n\nBecause *note new(): 2e2. and *note init(): 47d. work\ntogether in constructing objects (*note new(): 2e2. to create\nit, and *note init(): 47d. to customize it), no non-'None'\nvalue may be returned by *note init(): 47d.; doing so will\ncause a *note TypeError: 28e. to be raised at runtime.\n\n-- Method: object.del (self)\n\nCalled when the instance is about to be destroyed.  This is also\ncalled a finalizer or (improperly) a destructor.  If a base class\nhas a *note del(): 1c66. method, the derived class's *note\ndel(): 1c66. method, if any, must explicitly call it to ensure\nproper deletion of the base class part of the instance.\n\nIt is possible (though not recommended!)  for the *note del():\n1c66. method to postpone destruction of the instance by creating a\nnew reference to it.  This is called object 'resurrection'.  It is\nimplementation-dependent whether *note del(): 1c66. is called a\nsecond time when a resurrected object is about to be destroyed; the\ncurrent *note CPython: 4c9. implementation only calls it once.\n\nIt is not guaranteed that *note del(): 1c66. methods are called\nfor objects that still exist when the interpreter exits.\n\nNote: 'del x' doesn't directly call 'x.del()' -- the former\ndecrements the reference count for 'x' by one, and the latter\nis only called when 'x''s reference count reaches zero.\n\n'CPython implementation detail:' It is possible for a reference\ncycle to prevent the reference count of an object from going to\nzero.  In this case, the cycle will be later detected and deleted\nby the *note cyclic garbage collector: 167e.  A common cause of\nreference cycles is when an exception has been caught in a local\nvariable.  The frame's locals then reference the exception, which\nreferences its own traceback, which references the locals of all\nframes caught in the traceback.\n\nSee also\n........\n\nDocumentation for the *note gc: 5b. module.\n\nWarning: Due to the precarious circumstances under which *note\ndel(): 1c66. methods are invoked, exceptions that occur\nduring their execution are ignored, and a warning is printed\nto 'sys.stderr' instead.  In particular:\n\n* *note del(): 1c66. can be invoked when arbitrary code\nis being executed, including from any arbitrary thread.\nIf *note del(): 1c66. needs to take a lock or invoke\nany other blocking resource, it may deadlock as the\nresource may already be taken by the code that gets\ninterrupted to execute *note del(): 1c66.\n\n* *note del(): 1c66. can be executed during interpreter\nshutdown.  As a consequence, the global variables it\nneeds to access (including other modules) may already\nhave been deleted or set to 'None'.  Python guarantees\nthat globals whose name begins with a single underscore\nare deleted from their module before other globals are\ndeleted; if no other references to such globals exist,\nthis may help in assuring that imported modules are still\navailable at the time when the *note del(): 1c66.\nmethod is called.\n\n-- Method: object.repr (self)\n\nCalled by the *note repr(): 5f0. built-in function to compute the\n\"official\" string representation of an object.  If at all possible,\nthis should look like a valid Python expression that could be used\nto recreate an object with the same value (given an appropriate\nenvironment).  If this is not possible, a string of the form\n'<...some useful description...>' should be returned.  The return\nvalue must be a string object.  If a class defines *note\nrepr(): 3e8. but not *note str(): 3e9, then *note\nrepr(): 3e8. is also used when an \"informal\" string\nrepresentation of instances of that class is required.\n\nThis is typically used for debugging, so it is important that the\nrepresentation is information-rich and unambiguous.\n\n-- Method: object.str (self)\n\nCalled by *note str(object): 157. and the built-in functions *note\nformat(): 3eb. and *note print(): de5. to compute the \"informal\" or\nnicely printable string representation of an object.  The return\nvalue must be a *note string: 1983. object.\n\nThis method differs from *note object.repr(): 3e8. in that\nthere is no expectation that *note str(): 3e9. return a valid\nPython expression: a more convenient or concise representation can\nbe used.\n\nThe default implementation defined by the built-in type *note\nobject: 8bb. calls *note object.repr(): 3e8.\n\n-- Method: object.bytes (self)\n\nCalled by *note bytes: 183c. to compute a byte-string\nrepresentation of an object.  This should return a *note bytes:\n295. object.\n\n-- Method: object.format (self, formatspec)\n\nCalled by the *note format(): 3eb. built-in function, and by\nextension, evaluation of *note formatted string literals: 7cd. and\nthe *note str.format(): 3ed. method, to produce a \"formatted\"\nstring representation of an object.  The 'formatspec' argument is\na string that contains a description of the formatting options\ndesired.  The interpretation of the 'formatspec' argument is up to\nthe type implementing *note format(): 3ea, however most classes\nwill either delegate formatting to one of the built-in types, or\nuse a similar formatting option syntax.\n\nSee *note Format Specification Mini-Language: 3a7. for a\ndescription of the standard formatting syntax.\n\nThe return value must be a string object.\n\nChanged in version 3.4: The format method of 'object' itself\nraises a *note TypeError: 28e. if passed any non-empty string.\n\nChanged in version 3.7: 'object.format(x, '')' is now\nequivalent to 'str(x)' rather than 'format(str(x), '')'.\n\n-- Method: object.lt (self, other)\n-- Method: object.le (self, other)\n-- Method: object.eq (self, other)\n-- Method: object.ne (self, other)\n-- Method: object.gt (self, other)\n-- Method: object.ge (self, other)\n\nThese are the so-called \"rich comparison\" methods.  The\ncorrespondence between operator symbols and method names is as\nfollows: 'x<y' calls 'x.lt(y)', 'x<=y' calls 'x.le(y)',\n'x==y' calls 'x.eq(y)', 'x!=y' calls 'x.ne(y)', 'x>y' calls\n'x.gt(y)', and 'x>=y' calls 'x.ge(y)'.\n\nA rich comparison method may return the singleton *note\nNotImplemented: 5c5. if it does not implement the operation for a\ngiven pair of arguments.  By convention, 'False' and 'True' are\nreturned for a successful comparison.  However, these methods can\nreturn any value, so if the comparison operator is used in a\nBoolean context (e.g., in the condition of an 'if' statement),\nPython will call *note bool(): 17d. on the value to determine if\nthe result is true or false.\n\nBy default, 'object' implements *note eq(): 931. by using 'is',\nreturning *note NotImplemented: 5c5. in the case of a false\ncomparison: 'True if x is y else NotImplemented'.  For *note\nne(): 1372, by default it delegates to *note eq(): 931. and\ninverts the result unless it is 'NotImplemented'.  There are no\nother implied relationships among the comparison operators or\ndefault implementations; for example, the truth of '(x<y or x==y)'\ndoes not imply 'x<=y'.  To automatically generate ordering\noperations from a single root operation, see *note\nfunctools.totalordering(): db2.\n\nSee the paragraph on *note hash(): 932. for some important\nnotes on creating *note hashable: 3db. objects which support custom\ncomparison operations and are usable as dictionary keys.\n\nThere are no swapped-argument versions of these methods (to be used\nwhen the left argument does not support the operation but the right\nargument does); rather, *note lt(): 1180. and *note gt():\n1182. are each other's reflection, *note le(): 1181. and *note\nge(): 1183. are each other's reflection, and *note eq():\n931. and *note ne(): 1372. are their own reflection.  If the\noperands are of different types, and the right operand's type is a\ndirect or indirect subclass of the left operand's type, the\nreflected method of the right operand has priority, otherwise the\nleft operand's method has priority.  Virtual subclassing is not\nconsidered.\n\nWhen no appropriate method returns any value other than *note\nNotImplemented: 5c5, the '==' and '!=' operators will fall back to\n'is' and 'is not', respectively.\n\n-- Method: object.hash (self)\n\nCalled by built-in function *note hash(): 3b1. and for operations\non members of hashed collections including *note set: 39d, *note\nfrozenset: 39e, and *note dict: 237.  The 'hash()' method\nshould return an integer.  The only required property is that\nobjects which compare equal have the same hash value; it is advised\nto mix together the hash values of the components of the object\nthat also play a part in comparison of objects by packing them into\na tuple and hashing the tuple.  Example:\n\ndef hash(self):\nreturn hash((self.name, self.nick, self.color))\n\nNote: *note hash(): 3b1. truncates the value returned from an\nobject's custom *note hash(): 932. method to the size of a\n*note Pyssizet: 88d.  This is typically 8 bytes on 64-bit\nbuilds and 4 bytes on 32-bit builds.  If an object's *note\nhash(): 932. must interoperate on builds of different bit\nsizes, be sure to check the width on all supported builds.  An\neasy way to do this is with 'python -c \"import sys;\nprint(sys.hashinfo.width)\"'.\n\nIf a class does not define an *note eq(): 931. method it should\nnot define a *note hash(): 932. operation either; if it defines\n*note eq(): 931. but not *note hash(): 932, its instances\nwill not be usable as items in hashable collections.  If a class\ndefines mutable objects and implements an *note eq(): 931.\nmethod, it should not implement *note hash(): 932, since the\nimplementation of *note hashable: 3db. collections requires that a\nkey's hash value is immutable (if the object's hash value changes,\nit will be in the wrong hash bucket).\n\nUser-defined classes have *note eq(): 931. and *note\nhash(): 932. methods by default; with them, all objects compare\nunequal (except with themselves) and 'x.hash()' returns an\nappropriate value such that 'x == y' implies both that 'x is y' and\n'hash(x) == hash(y)'.\n\nA class that overrides *note eq(): 931. and does not define\n*note hash(): 932. will have its *note hash(): 932.\nimplicitly set to 'None'.  When the *note hash(): 932. method\nof a class is 'None', instances of the class will raise an\nappropriate *note TypeError: 28e. when a program attempts to\nretrieve their hash value, and will also be correctly identified as\nunhashable when checking 'isinstance(obj,\ncollections.abc.Hashable)'.\n\nIf a class that overrides *note eq(): 931. needs to retain the\nimplementation of *note hash(): 932. from a parent class, the\ninterpreter must be told this explicitly by setting 'hash =\n<ParentClass>.hash'.\n\nIf a class that does not override *note eq(): 931. wishes to\nsuppress hash support, it should include 'hash = None' in the\nclass definition.  A class which defines its own *note hash():\n932. that explicitly raises a *note TypeError: 28e. would be\nincorrectly identified as hashable by an 'isinstance(obj,\ncollections.abc.Hashable)' call.\n\nNote: By default, the *note hash(): 932. values of str and\nbytes objects are \"salted\" with an unpredictable random value.\nAlthough they remain constant within an individual Python\nprocess, they are not predictable between repeated invocations\nof Python.\n\nThis is intended to provide protection against a\ndenial-of-service caused by carefully chosen inputs that\nexploit the worst case performance of a dict insertion,\n'O'('n'^2) complexity.  See\n'http://ocert.org/advisories/ocert-2011-003.html' for details.\n\nChanging hash values affects the iteration order of sets.\nPython has never made guarantees about this ordering (and it\ntypically varies between 32-bit and 64-bit builds).\n\nSee also *note PYTHONHASHSEED: ef4.\n\nChanged in version 3.3: Hash randomization is enabled by default.\n\n-- Method: object.bool (self)\n\nCalled to implement truth value testing and the built-in operation\n'bool()'; should return 'False' or 'True'.  When this method is not\ndefined, *note len(): 1c68. is called, if it is defined, and\nthe object is considered true if its result is nonzero.  If a class\ndefines neither 'len()' nor 'bool()', all its instances are\nconsidered true.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Customizing attribute access,  Next: Customizing class creation,  Prev: Basic customization,  Up: Special method names": {
            "content": "4.3.3.2 Customizing attribute access\n....................................\n",
            "subsections": []
        },
        "The following methods can be defined to customize the meaning of": {
            "content": "attribute access (use of, assignment to, or deletion of 'x.name') for\nclass instances.\n\n-- Method: object.getattr (self, name)\n\nCalled when the default attribute access fails with an *note\nAttributeError: 395. (either *note getattribute(): a16. raises\nan *note AttributeError: 395. because 'name' is not an instance\nattribute or an attribute in the class tree for 'self'; or *note\nget(): 1518. of a 'name' property raises *note AttributeError:\n395.).  This method should either return the (computed) attribute\nvalue or raise an *note AttributeError: 395. exception.\n\nNote that if the attribute is found through the normal mechanism,\n*note getattr(): 1f8. is not called.  (This is an intentional\nasymmetry between *note getattr(): 1f8. and *note\nsetattr(): 1c35.)  This is done both for efficiency reasons and\nbecause otherwise *note getattr(): 1f8. would have no way to\naccess other attributes of the instance.  Note that at least for\ninstance variables, you can fake total control by not inserting any\nvalues in the instance attribute dictionary (but instead inserting\nthem in another object).  See the *note getattribute(): a16.\nmethod below for a way to actually get total control over attribute\naccess.\n\n-- Method: object.getattribute (self, name)\n\nCalled unconditionally to implement attribute accesses for\ninstances of the class.  If the class also defines *note\ngetattr(): 1f8, the latter will not be called unless *note\ngetattribute(): a16. either calls it explicitly or raises an\n*note AttributeError: 395.  This method should return the\n(computed) attribute value or raise an *note AttributeError: 395.\nexception.  In order to avoid infinite recursion in this method,\nits implementation should always call the base class method with\nthe same name to access any attributes it needs, for example,\n'object.getattribute(self, name)'.\n\nNote: This method may still be bypassed when looking up\nspecial methods as the result of implicit invocation via\nlanguage syntax or *note built-in functions: 1c20.  See *note\nSpecial method lookup: 1c6b.\n\nFor certain sensitive attribute accesses, raises an *note auditing\nevent: 161d. 'object.getattr' with arguments 'obj' and 'name'.\n\n-- Method: object.setattr (self, name, value)\n\nCalled when an attribute assignment is attempted.  This is called\ninstead of the normal mechanism (i.e.  store the value in the\ninstance dictionary).  'name' is the attribute name, 'value' is the\nvalue to be assigned to it.\n\nIf *note setattr(): 1c35. wants to assign to an instance\nattribute, it should call the base class method with the same name,\nfor example, 'object.setattr(self, name, value)'.\n\nFor certain sensitive attribute assignments, raises an *note\nauditing event: 161d. 'object.setattr' with arguments 'obj',\n'name', 'value'.\n\n-- Method: object.delattr (self, name)\n\nLike *note setattr(): 1c35. but for attribute deletion instead\nof assignment.  This should only be implemented if 'del obj.name'\nis meaningful for the object.\n\nFor certain sensitive attribute deletions, raises an *note auditing\nevent: 161d. 'object.delattr' with arguments 'obj' and 'name'.\n\n-- Method: object.dir (self)\n\nCalled when *note dir(): 3ff. is called on the object.  An iterable\nmust be returned.  *note dir(): 3ff. converts the returned iterable\nto a list and sorts it.\n\n* Menu:\n\n* Customizing module attribute access::\n* Implementing Descriptors::\n* Invoking Descriptors::\n* slots: slots<2>.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Customizing module attribute access,  Next: Implementing Descriptors,  Up: Customizing attribute access": {
            "content": "4.3.3.3 Customizing module attribute access\n...........................................\n",
            "subsections": []
        },
        "Special names 'getattr' and 'dir' can be also used to customize": {
            "content": "access to module attributes.  The 'getattr' function at the module\nlevel should accept one argument which is the name of an attribute and\nreturn the computed value or raise an *note AttributeError: 395.  If an\nattribute is not found on a module object through the normal lookup,\ni.e.  *note object.getattribute(): a16, then 'getattr' is\nsearched in the module 'dict' before raising an *note",
            "subsections": []
        },
        "AttributeError: 395.  If found, it is called with the attribute name and": {
            "content": "the result is returned.\n",
            "subsections": []
        },
        "The 'dir' function should accept no arguments, and return an": {
            "content": "iterable of strings that represents the names accessible on module.  If\npresent, this function overrides the standard *note dir(): 3ff. search\non a module.\n",
            "subsections": []
        },
        "For a more fine grained customization of the module behavior (setting": {
            "content": "attributes, properties, etc.), one can set the 'class' attribute of\na module object to a subclass of *note types.ModuleType: c71.  For\nexample:\n\nimport sys\nfrom types import ModuleType\n\nclass VerboseModule(ModuleType):\ndef repr(self):\nreturn f'Verbose {self.name}'\n\ndef setattr(self, attr, value):\nprint(f'Setting {attr}...')\nsuper().setattr(attr, value)\n\nsys.modules[name].class = VerboseModule\n\nNote: Defining module 'getattr' and setting module 'class'\nonly affect lookups made using the attribute access syntax -\ndirectly accessing the module globals (whether by code within the\nmodule, or via a reference to the module's globals dictionary) is\nunaffected.\n\nChanged in version 3.5: 'class' module attribute is now writable.\n\nNew in version 3.7: 'getattr' and 'dir' module attributes.\n\nSee also\n........\n\nPEP 562(1) - Module getattr and dir\n\nDescribes the 'getattr' and 'dir' functions on modules.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0562/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Implementing Descriptors,  Next: Invoking Descriptors,  Prev: Customizing module attribute access,  Up: Customizing attribute access": {
            "content": "4.3.3.4 Implementing Descriptors\n................................\n",
            "subsections": []
        },
        "The following methods only apply when an instance of the class": {
            "content": "containing the method (a so-called 'descriptor' class) appears in an\n'owner' class (the descriptor must be in either the owner's class\ndictionary or in the class dictionary for one of its parents).  In the\nexamples below, \"the attribute\" refers to the attribute whose name is\nthe key of the property in the owner class' *note dict: aa8.\n\n-- Method: object.get (self, instance, owner=None)\n\nCalled to get the attribute of the owner class (class attribute\naccess) or of an instance of that class (instance attribute\naccess).  The optional 'owner' argument is the owner class, while\n'instance' is the instance that the attribute was accessed through,\nor 'None' when the attribute is accessed through the 'owner'.\n\nThis method should return the computed attribute value or raise an\n*note AttributeError: 395. exception.\n\nPEP 252(1) specifies that *note get(): 1518. is callable with\none or two arguments.  Python's own built-in descriptors support\nthis specification; however, it is likely that some third-party\ntools have descriptors that require both arguments.  Python's own\n*note getattribute(): a16. implementation always passes in both\narguments whether they are required or not.\n\n-- Method: object.set (self, instance, value)\n\nCalled to set the attribute on an instance 'instance' of the owner\nclass to a new value, 'value'.\n\nNote, adding *note set(): 1c6f. or *note delete(): 1c70.\nchanges the kind of descriptor to a \"data descriptor\".  See *note\nInvoking Descriptors: 1c71. for more details.\n\n-- Method: object.delete (self, instance)\n\nCalled to delete the attribute on an instance 'instance' of the\nowner class.\n",
            "subsections": []
        },
        "Instances of descriptors may also have the 'objclass' attribute": {
            "content": "present:\n\n-- Attribute: object.objclass\n\nThe attribute 'objclass' is interpreted by the *note inspect:\n78. module as specifying the class where this object was defined\n(setting this appropriately can assist in runtime introspection of\ndynamic class attributes).  For callables, it may indicate that an\ninstance of the given type (or a subclass) is expected or required\nas the first positional argument (for example, CPython sets this\nattribute for unbound methods that are implemented in C).\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0252/\n\nFile: python3.12.info,  Node: Invoking Descriptors,  Next: slots<2>,  Prev: Implementing Descriptors,  Up: Customizing attribute access\n\n4.3.3.5 Invoking Descriptors\n............................\n\nIn general, a descriptor is an object attribute with \"binding behavior\",\none whose attribute access has been overridden by methods in the\ndescriptor protocol: *note get(): 1518, *note set(): 1c6f, and\n*note delete(): 1c70.  If any of those methods are defined for an\nobject, it is said to be a descriptor.\n",
            "subsections": []
        },
        "The default behavior for attribute access is to get, set, or delete the": {
            "content": "attribute from an object's dictionary.  For instance, 'a.x' has a lookup\nchain starting with 'a.dict['x']', then 'type(a).dict['x']', and\ncontinuing through the method resolution order of 'type(a)'.  If the\nlooked-up value is an object defining one of the descriptor methods,\nthen Python may override the default behavior and invoke the descriptor\nmethod instead.  Where this occurs in the precedence chain depends on\nwhich descriptor methods were defined.\n",
            "subsections": []
        },
        "However, if the looked-up value is an object defining one of the": {
            "content": "descriptor methods, then Python may override the default behavior and\ninvoke the descriptor method instead.  Where this occurs in the\nprecedence chain depends on which descriptor methods were defined and\nhow they were called.\n",
            "subsections": []
        },
        "The starting point for descriptor invocation is a binding, 'a.x'.  How": {
            "content": "the arguments are assembled depends on 'a':\n",
            "subsections": []
        },
        "Direct Call": {
            "content": "The simplest and least common call is when user code directly\ninvokes a descriptor method: 'x.get(a)'.\n",
            "subsections": []
        },
        "Instance Binding": {
            "content": "If binding to an object instance, 'a.x' is transformed into the\ncall: 'type(a).dict['x'].get(a, type(a))'.\n",
            "subsections": []
        },
        "Class Binding": {
            "content": "If binding to a class, 'A.x' is transformed into the call:\n'A.dict['x'].get(None, A)'.\n",
            "subsections": []
        },
        "Super Binding": {
            "content": "A dotted lookup such as 'super(A, a).x' searches\n'a.class.mro' for a base class 'B' following 'A' and then\nreturns 'B.dict['x'].get(a, A)'.  If not a descriptor, 'x'\nis returned unchanged.\n",
            "subsections": []
        },
        "For instance bindings, the precedence of descriptor invocation depends": {
            "content": "on which descriptor methods are defined.  A descriptor can define any\ncombination of *note get(): 1518, *note set(): 1c6f. and *note\ndelete(): 1c70.  If it does not define 'get()', then accessing\nthe attribute will return the descriptor object itself unless there is a\nvalue in the object's instance dictionary.  If the descriptor defines\n'set()' and/or 'delete()', it is a data descriptor; if it\ndefines neither, it is a non-data descriptor.  Normally, data\ndescriptors define both 'get()' and 'set()', while non-data\ndescriptors have just the 'get()' method.  Data descriptors with\n'get()' and 'set()' (and/or 'delete()') defined always\noverride a redefinition in an instance dictionary.  In contrast,\nnon-data descriptors can be overridden by instances.\n\nPython methods (including those decorated with *note @staticmethod: 5cc.\nand *note @classmethod: 246.) are implemented as non-data descriptors.",
            "subsections": []
        },
        "Accordingly, instances can redefine and override methods.  This allows": {
            "content": "individual instances to acquire behaviors that differ from other\ninstances of the same class.\n\nThe *note property(): 3f6. function is implemented as a data descriptor.\nAccordingly, instances cannot override the behavior of a property.\n\nFile: python3.12.info,  Node: slots<2>,  Prev: Invoking Descriptors,  Up: Customizing attribute access\n\n4.3.3.6 slots\n.................\n\n'slots' allow us to explicitly declare data members (like\nproperties) and deny the creation of *note dict: aa8. and\n'weakref' (unless explicitly declared in 'slots' or available in\na parent.)\n\nThe space saved over using *note dict: aa8. can be significant.\nAttribute lookup speed can be significantly improved as well.\n\n-- Data: object.slots\n\nThis class variable can be assigned a string, iterable, or sequence\nof strings with variable names used by instances.  'slots'\nreserves space for the declared variables and prevents the\nautomatic creation of *note dict: aa8. and 'weakref' for\neach instance.\nNotes on using 'slots':\n\n* When inheriting from a class without 'slots', the *note\ndict: aa8. and 'weakref' attribute of the instances will\nalways be accessible.\n\n* Without a *note dict: aa8. variable, instances cannot be\nassigned new variables not listed in the 'slots' definition.\nAttempts to assign to an unlisted variable name raises *note\nAttributeError: 395.  If dynamic assignment of new variables is\ndesired, then add ''dict'' to the sequence of strings in the\n'slots' declaration.\n\n* Without a 'weakref' variable for each instance, classes\ndefining 'slots' do not support *note weak references: 10f. to\nits instances.  If weak reference support is needed, then add\n''weakref'' to the sequence of strings in the 'slots'\ndeclaration.\n\n* 'slots' are implemented at the class level by creating *note\ndescriptors: a98. for each variable name.  As a result, class\nattributes cannot be used to set default values for instance\nvariables defined by 'slots'; otherwise, the class attribute\nwould overwrite the descriptor assignment.\n\n* The action of a 'slots' declaration is not limited to the class\nwhere it is defined.  'slots' declared in parents are available\nin child classes.  However, child subclasses will get a *note\ndict: aa8. and 'weakref' unless they also define\n'slots' (which should only contain names of any 'additional'\nslots).\n\n* If a class defines a slot also defined in a base class, the\ninstance variable defined by the base class slot is inaccessible\n(except by retrieving its descriptor directly from the base class).\nThis renders the meaning of the program undefined.  In the future,\na check may be added to prevent this.\n\n* *note TypeError: 28e. will be raised if nonempty 'slots' are\ndefined for a class derived from a *note \"variable-length\" built-in\ntype: 1c77. such as *note int: 17e, *note bytes: 295, and *note\ntuple: 4b8.\n\n* Any non-string *note iterable: 109d. may be assigned to\n'slots'.\n\n* If a *note dictionary: 237. is used to assign 'slots', the\ndictionary keys will be used as the slot names.  The values of the\ndictionary can be used to provide per-attribute docstrings that\nwill be recognised by *note inspect.getdoc(): 821. and displayed in\nthe output of *note help(): 6f0.\n\n* *note class: 1304. assignment works only if both classes have\nthe same 'slots'.\n\n* *note Multiple inheritance: 1a3c. with multiple slotted parent\nclasses can be used, but only one parent is allowed to have\nattributes created by slots (the other bases must have empty slot\nlayouts) - violations raise *note TypeError: 28e.\n\n* If an *note iterator: 16a9. is used for 'slots' then a *note\ndescriptor: 1c78. is created for each of the iterator's values.\nHowever, the 'slots' attribute will be an empty iterator.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Customizing class creation,  Next: Customizing instance and subclass checks,  Prev: Customizing attribute access,  Up: Special method names": {
            "content": "4.3.3.7 Customizing class creation\n..................................\n\nWhenever a class inherits from another class, *note initsubclass():\n3fe. is called on the parent class.  This way, it is possible to write\nclasses which change the behavior of subclasses.  This is closely\nrelated to class decorators, but where class decorators only affect the\nspecific class they're applied to, 'initsubclass' solely applies to\nfuture subclasses of the class defining the method.\n\n-- Method: classmethod object.initsubclass (cls)\n\nThis method is called whenever the containing class is subclassed.\n'cls' is then the new subclass.  If defined as a normal instance\nmethod, this method is implicitly converted to a class method.\n\nKeyword arguments which are given to a new class are passed to the\nparent class's 'initsubclass'.  For compatibility with other\nclasses using 'initsubclass', one should take out the needed\nkeyword arguments and pass the others over to the base class, as\nin:\n\nclass Philosopher:\ndef initsubclass(cls, /, defaultname, kwargs):\nsuper().initsubclass(kwargs)\ncls.defaultname = defaultname\n\nclass AustralianPhilosopher(Philosopher, defaultname=\"Bruce\"):\npass\n\nThe default implementation 'object.initsubclass' does nothing,\nbut raises an error if it is called with any arguments.\n\nNote: The metaclass hint 'metaclass' is consumed by the rest\nof the type machinery, and is never passed to\n'initsubclass' implementations.  The actual metaclass\n(rather than the explicit hint) can be accessed as\n'type(cls)'.\n\nNew in version 3.6.\n",
            "subsections": []
        },
        "When a class is created, 'type.new()' scans the class variables and": {
            "content": "makes callbacks to those with a *note setname(): a97. hook.\n\n-- Method: object.setname (self, owner, name)\n\nAutomatically called at the time the owning class 'owner' is\ncreated.  The object has been assigned to 'name' in that class:\n\nclass A:\nx = C()  # Automatically calls: x.setname(A, 'x')\n\nIf the class variable is assigned after the class is created, *note\nsetname(): a97. will not be called automatically.  If needed,\n*note setname(): a97. can be called directly:\n\nclass A:\npass\n\nc = C()\nA.x = c                  # The hook is not called\nc.setname(A, 'x')   # Manually invoke the hook\n\nSee *note Creating the class object: a93. for more details.\n\nNew in version 3.6.\n\n* Menu:\n\n* Metaclasses::\n* Resolving MRO entries::\n* Determining the appropriate metaclass::\n* Preparing the class namespace::\n* Executing the class body::\n* Creating the class object::\n* Uses for metaclasses::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Metaclasses,  Next: Resolving MRO entries,  Up: Customizing class creation": {
            "content": "4.3.3.8 Metaclasses\n...................\n\nBy default, classes are constructed using *note type(): ba0.  The class\nbody is executed in a new namespace and the class name is bound locally\nto the result of 'type(name, bases, namespace)'.\n",
            "subsections": []
        },
        "The class creation process can be customized by passing the 'metaclass'": {
            "content": "keyword argument in the class definition line, or by inheriting from an\nexisting class that included such an argument.  In the following\nexample, both 'MyClass' and 'MySubclass' are instances of 'Meta':\n\nclass Meta(type):\npass\n\nclass MyClass(metaclass=Meta):\npass\n\nclass MySubclass(MyClass):\npass\n",
            "subsections": []
        },
        "Any other keyword arguments that are specified in the class definition": {
            "content": "are passed through to all metaclass operations described below.\n\nWhen a class definition is executed, the following steps occur:\n\n* MRO entries are resolved;\n\n* the appropriate metaclass is determined;\n\n* the class namespace is prepared;\n\n* the class body is executed;\n\n* the class object is created.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Resolving MRO entries,  Next: Determining the appropriate metaclass,  Prev: Metaclasses,  Up: Customizing class creation": {
            "content": "4.3.3.9 Resolving MRO entries\n.............................\n\n-- Method: object.mroentries (self, bases)\n\nIf a base that appears in a class definition is not an instance of\n*note type: ba0, then an 'mroentries()' method is searched on\nthe base.  If an 'mroentries()' method is found, the base is\nsubstituted with the result of a call to 'mroentries()' when\ncreating the class.  The method is called with the original bases\ntuple passed to the 'bases' parameter, and must return a tuple of\nclasses that will be used instead of the base.  The returned tuple\nmay be empty: in these cases, the original base is ignored.\n\nSee also\n........\n\n*note types.resolvebases(): 9df.\n\nDynamically resolve bases that are not instances of *note type:\nba0.\n\n*note types.getoriginalbases(): 1f4.\n\nRetrieve a class's \"original bases\" prior to modifications by *note\nmroentries(): 1c7d.\n\nPEP 560(1)\n\nCore support for typing module and generic types.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0560/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Determining the appropriate metaclass,  Next: Preparing the class namespace,  Prev: Resolving MRO entries,  Up: Customizing class creation": {
            "content": "4.3.3.10 Determining the appropriate metaclass\n..............................................\n",
            "subsections": []
        },
        "The appropriate metaclass for a class definition is determined as": {
            "content": "follows:\n\n* if no bases and no explicit metaclass are given, then *note type():\nba0. is used;\n\n* if an explicit metaclass is given and it is 'not' an instance of\n*note type(): ba0, then it is used directly as the metaclass;\n\n* if an instance of *note type(): ba0. is given as the explicit\nmetaclass, or bases are defined, then the most derived metaclass is\nused.\n",
            "subsections": []
        },
        "The most derived metaclass is selected from the explicitly specified": {
            "content": "metaclass (if any) and the metaclasses (i.e.  'type(cls)') of all\nspecified base classes.  The most derived metaclass is one which is a\nsubtype of 'all' of these candidate metaclasses.  If none of the\ncandidate metaclasses meets that criterion, then the class definition\nwill fail with 'TypeError'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Preparing the class namespace,  Next: Executing the class body,  Prev: Determining the appropriate metaclass,  Up: Customizing class creation": {
            "content": "4.3.3.11 Preparing the class namespace\n......................................\n",
            "subsections": []
        },
        "Once the appropriate metaclass has been identified, then the class": {
            "content": "namespace is prepared.  If the metaclass has a 'prepare' attribute,\nit is called as 'namespace = metaclass.prepare(name, bases, kwds)'\n(where the additional keyword arguments, if any, come from the class\ndefinition).  The 'prepare' method should be implemented as a *note\nclassmethod: 246.  The namespace returned by 'prepare' is passed in\nto 'new', but when the final class object is created the namespace\nis copied into a new 'dict'.\n",
            "subsections": []
        },
        "If the metaclass has no 'prepare' attribute, then the class": {
            "content": "namespace is initialised as an empty ordered mapping.\n\nSee also\n........\n\nPEP 3115(1) - Metaclasses in Python 3000\n\nIntroduced the 'prepare' namespace hook\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3115/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Executing the class body,  Next: Creating the class object,  Prev: Preparing the class namespace,  Up: Customizing class creation": {
            "content": "4.3.3.12 Executing the class body\n.................................\n",
            "subsections": []
        },
        "The class body is executed (approximately) as 'exec(body, globals(),": {
            "content": "namespace)'.  The key difference from a normal call to *note exec():\n691. is that lexical scoping allows the class body (including any\nmethods) to reference names from the current and outer scopes when the\nclass definition occurs inside a function.\n",
            "subsections": []
        },
        "However, even when the class definition occurs inside the function,": {
            "content": "methods defined inside the class still cannot see names defined at the\nclass scope.  Class variables must be accessed through the first\nparameter of instance or class methods, or through the implicit\nlexically scoped 'class' reference described in the next section.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Creating the class object,  Next: Uses for metaclasses,  Prev: Executing the class body,  Up: Customizing class creation": {
            "content": "4.3.3.13 Creating the class object\n..................................\n",
            "subsections": []
        },
        "Once the class namespace has been populated by executing the class body,": {
            "content": "the class object is created by calling 'metaclass(name, bases,\nnamespace, kwds)' (the additional keywords passed here are the same as\nthose passed to 'prepare').\n",
            "subsections": []
        },
        "This class object is the one that will be referenced by the": {
            "content": "zero-argument form of *note super(): 204.  'class' is an implicit\nclosure reference created by the compiler if any methods in a class body\nrefer to either 'class' or 'super'.  This allows the zero argument\nform of *note super(): 204. to correctly identify the class being\ndefined based on lexical scoping, while the class or instance that was\nused to make the current call is identified based on the first argument\npassed to the method.\n\n'CPython implementation detail:' In CPython 3.6 and later, the\n'class' cell is passed to the metaclass as a 'classcell' entry\nin the class namespace.  If present, this must be propagated up to the\n'type.new' call in order for the class to be initialised correctly.\nFailing to do so will result in a *note RuntimeError: 17a. in Python\n3.8.\n\nWhen using the default metaclass *note type: ba0, or any metaclass that\nultimately calls 'type.new', the following additional customization\nsteps are invoked after creating the class object:\n\n1. The 'type.new' method collects all of the attributes in the\nclass namespace that define a *note setname(): a97. method;\n\n2. Those 'setname' methods are called with the class being\ndefined and the assigned name of that particular attribute;\n\n3. The *note initsubclass(): 3fe. hook is called on the immediate\nparent of the new class in its method resolution order.\n",
            "subsections": []
        },
        "After the class object is created, it is passed to the class decorators": {
            "content": "included in the class definition (if any) and the resulting object is\nbound in the local namespace as the defined class.\n",
            "subsections": []
        },
        "When a new class is created by 'type.new', the object provided as": {
            "content": "the namespace parameter is copied to a new ordered mapping and the\noriginal object is discarded.  The new copy is wrapped in a read-only\nproxy, which becomes the *note dict: aa8. attribute of the class\nobject.\n\nSee also\n........\n\nPEP 3135(1) - New super\n\nDescribes the implicit 'class' closure reference\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3135/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Uses for metaclasses,  Prev: Creating the class object,  Up: Customizing class creation": {
            "content": "4.3.3.14 Uses for metaclasses\n.............................\n",
            "subsections": []
        },
        "The potential uses for metaclasses are boundless.  Some ideas that have": {
            "content": "been explored include enum, logging, interface checking, automatic\ndelegation, automatic property creation, proxies, frameworks, and\nautomatic resource locking/synchronization.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Customizing instance and subclass checks,  Next: Emulating generic types,  Prev: Customizing class creation,  Up: Special method names": {
            "content": "4.3.3.15 Customizing instance and subclass checks\n.................................................\n",
            "subsections": []
        },
        "The following methods are used to override the default behavior of the": {
            "content": "*note isinstance(): 14b. and *note issubclass(): 5b4. built-in\nfunctions.\n\nIn particular, the metaclass *note abc.ABCMeta: d80. implements these\nmethods in order to allow the addition of Abstract Base Classes (ABCs)\nas \"virtual base classes\" to any class or type (including built-in\ntypes), including other ABCs.\n\n-- Method: class.instancecheck (self, instance)\n\nReturn true if 'instance' should be considered a (direct or\nindirect) instance of 'class'.  If defined, called to implement\n'isinstance(instance, class)'.\n\n-- Method: class.subclasscheck (self, subclass)\n\nReturn true if 'subclass' should be considered a (direct or\nindirect) subclass of 'class'.  If defined, called to implement\n'issubclass(subclass, class)'.\n",
            "subsections": []
        },
        "Note that these methods are looked up on the type (metaclass) of a": {
            "content": "class.  They cannot be defined as class methods in the actual class.",
            "subsections": []
        },
        "This is consistent with the lookup of special methods that are called on": {
            "content": "instances, only in this case the instance is itself a class.\n\nSee also\n........\n\nPEP 3119(1) - Introducing Abstract Base Classes\n\nIncludes the specification for customizing *note isinstance(): 14b.\nand *note issubclass(): 5b4. behavior through *note\ninstancecheck(): 1c84. and *note subclasscheck(): 1c85,\nwith motivation for this functionality in the context of adding\nAbstract Base Classes (see the *note abc: 4. module) to the\nlanguage.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3119/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Emulating generic types,  Next: Emulating callable objects,  Prev: Customizing instance and subclass checks,  Up: Special method names": {
            "content": "4.3.3.16 Emulating generic types\n................................\n\nWhen using *note type annotations: 168, it is often useful to\n'parameterize' a *note generic type: 13b. using Python's square-brackets\nnotation.  For example, the annotation 'list[int]' might be used to\nsignify a *note list: 3dc. in which all the elements are of type *note\nint: 17e.\n\nSee also\n........\n\nPEP 484(1) - Type Hints\n\nIntroducing Python's framework for type annotations\n\n*note Generic Alias Types: 480.\n\nDocumentation for objects representing parameterized generic\nclasses\n\n*note Generics: 1c87, *note user-defined generics: 1f5. and *note typing.Generic: 1453.\n\nDocumentation on how to implement generic classes that can be\nparameterized at runtime and understood by static type-checkers.\n\nA class can 'generally' only be parameterized if it defines the special\nclass method 'classgetitem()'.\n\n-- Method: classmethod object.classgetitem (cls, key)\n\nReturn an object representing the specialization of a generic class\nby type arguments found in 'key'.\n\nWhen defined on a class, 'classgetitem()' is automatically a\nclass method.  As such, there is no need for it to be decorated\nwith *note @classmethod: 246. when it is defined.\n\n* Menu:\n\n* The purpose of classgetitem::\n* classgetitem versus getitem::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0484/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The purpose of classgetitem,  Next: classgetitem versus getitem,  Up: Emulating generic types": {
            "content": "4.3.3.17 The purpose of 'classgetitem'\n...........................................\n\nThe purpose of *note classgetitem(): 520. is to allow runtime\nparameterization of standard-library generic classes in order to more\neasily apply *note type hints: 1c89. to these classes.\n",
            "subsections": []
        },
        "To implement custom generic classes that can be parameterized at runtime": {
            "content": "and understood by static type-checkers, users should either inherit from\na standard library class that already implements *note\nclassgetitem(): 520, or inherit from *note typing.Generic: 1453,\nwhich has its own implementation of 'classgetitem()'.\n\nCustom implementations of *note classgetitem(): 520. on classes\ndefined outside of the standard library may not be understood by\nthird-party type-checkers such as mypy.  Using 'classgetitem()' on\nany class for purposes other than type hinting is discouraged.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: classgetitem versus getitem,  Prev: The purpose of classgetitem,  Up: Emulating generic types": {
            "content": "4.3.3.18 'classgetitem' versus 'getitem'\n.................................................\n\nUsually, the *note subscription: 1c8c. of an object using square\nbrackets will call the *note getitem(): 4b9. instance method defined\non the object's class.  However, if the object being subscribed is\nitself a class, the class method *note classgetitem(): 520. may be\ncalled instead.  'classgetitem()' should return a *note\nGenericAlias: 480. object if it is properly defined.\n\nPresented with the *note expression: 1c8d. 'obj[x]', the Python\ninterpreter follows something like the following process to decide\nwhether *note getitem(): 4b9. or *note classgetitem(): 520.\nshould be called:\n\nfrom inspect import isclass\n\ndef subscribe(obj, x):\n\"\"\"Return the result of the expression 'obj[x]'\"\"\"\n\nclassofobj = type(obj)\n\n# If the class of obj defines getitem,\n# call classofobj.getitem(obj, x)\nif hasattr(classofobj, 'getitem'):\nreturn classofobj.getitem(obj, x)\n\n# Else, if obj is a class and defines classgetitem,\n# call obj.classgetitem(x)\nelif isclass(obj) and hasattr(obj, 'classgetitem'):\nreturn obj.classgetitem(x)\n\n# Else, raise an exception\nelse:\nraise TypeError(\nf\"'{classofobj.name}' object is not subscriptable\"\n)\n",
            "subsections": []
        },
        "In Python, all classes are themselves instances of other classes.  The": {
            "content": "class of a class is known as that class's *note metaclass: 1c8e, and\nmost classes have the *note type: ba0. class as their metaclass.  *note\ntype: ba0. does not define *note getitem(): 4b9, meaning that\nexpressions such as 'list[int]', 'dict[str, float]' and 'tuple[str,\nbytes]' all result in *note classgetitem(): 520. being called:\n\n>>> # list has class \"type\" as its metaclass, like most classes:\n>>> type(list)\n<class 'type'>\n>>> type(dict) == type(list) == type(tuple) == type(str) == type(bytes)\nTrue\n>>> # \"list[int]\" calls \"list.classgetitem(int)\"\n>>> list[int]\nlist[int]\n>>> # list.classgetitem returns a GenericAlias object:\n>>> type(list[int])\n<class 'types.GenericAlias'>\n\nHowever, if a class has a custom metaclass that defines *note\ngetitem(): 4b9, subscribing the class may result in different\nbehaviour.  An example of this can be found in the *note enum: 51.\nmodule:\n\n>>> from enum import Enum\n>>> class Menu(Enum):\n...     \"\"\"A breakfast menu\"\"\"\n...     SPAM = 'spam'\n...     BACON = 'bacon'\n...\n>>> # Enum classes have a custom metaclass:\n>>> type(Menu)\n<class 'enum.EnumMeta'>\n>>> # EnumMeta defines getitem,\n>>> # so classgetitem is not called,\n>>> # and the result is not a GenericAlias object:\n>>> Menu['SPAM']\n<Menu.SPAM: 'spam'>\n>>> type(Menu['SPAM'])\n<enum 'Menu'>\n\nSee also\n........\n\nPEP 560(1) - Core Support for typing module and generic types\n\nIntroducing *note classgetitem(): 520, and outlining when a\n*note subscription: 1c8c. results in 'classgetitem()' being\ncalled instead of *note getitem(): 4b9.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0560/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Emulating callable objects,  Next: Emulating container types,  Prev: Emulating generic types,  Up: Special method names": {
            "content": "4.3.3.19 Emulating callable objects\n...................................\n\n-- Method: object.call (self[, args...])\n\nCalled when the instance is \"called\" as a function; if this method\nis defined, 'x(arg1, arg2, ...)' roughly translates to\n'type(x).call(x, arg1, ...)'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Emulating container types,  Next: Emulating numeric types,  Prev: Emulating callable objects,  Up: Special method names": {
            "content": "4.3.3.20 Emulating container types\n..................................\n\nThe following methods can be defined to implement container objects.\nContainers usually are *note sequences: 236. (such as *note lists: 3dc.\nor *note tuples: 4b8.) or *note mappings: 1030. (like *note\ndictionaries: 237.), but can represent other containers as well.  The\nfirst set of methods is used either to emulate a sequence or to emulate\na mapping; the difference is that for a sequence, the allowable keys\nshould be the integers 'k' for which '0 <= k < N' where 'N' is the\nlength of the sequence, or *note slice: 180. objects, which define a\nrange of items.  It is also recommended that mappings provide the\nmethods 'keys()', 'values()', 'items()', 'get()', 'clear()',\n'setdefault()', 'pop()', 'popitem()', 'copy()', and 'update()' behaving\nsimilar to those for Python's standard *note dictionary: 237. objects.\nThe *note collections.abc: 1c. module provides a *note MutableMapping:\nf1e. *note abstract base class: 102a. to help create those methods from\na base set of *note getitem(): 4b9, *note setitem(): 1320, *note\ndelitem(): 1321, and 'keys()'.  Mutable sequences should provide\nmethods 'append()', 'count()', 'index()', 'extend()', 'insert()',\n'pop()', 'remove()', 'reverse()' and 'sort()', like Python standard\n*note list: 3dc. objects.  Finally, sequence types should implement\naddition (meaning concatenation) and multiplication (meaning repetition)\nby defining the methods *note add(): 1c93, *note radd(): 1c94,\n*note iadd(): 1c95, *note mul(): 1c96, *note rmul(): 1c97.\nand *note imul(): 1c98. described below; they should not define\nother numerical operators.  It is recommended that both mappings and\nsequences implement the *note contains(): 1c63. method to allow\nefficient use of the 'in' operator; for mappings, 'in' should search the\nmapping's keys; for sequences, it should search through the values.  It\nis further recommended that both mappings and sequences implement the\n*note iter(): 1c61. method to allow efficient iteration through the\ncontainer; for mappings, 'iter()' should iterate through the\nobject's keys; for sequences, it should iterate through the values.\n\n-- Method: object.len (self)\n\nCalled to implement the built-in function *note len(): 3fb.  Should\nreturn the length of the object, an integer '>=' 0.  Also, an\nobject that doesn't define a *note bool(): 114a. method and\nwhose 'len()' method returns zero is considered to be false in\na Boolean context.\n\n'CPython implementation detail:' In CPython, the length is required\nto be at most *note sys.maxsize: 1039.  If the length is larger\nthan 'sys.maxsize' some features (such as *note len(): 3fb.) may\nraise *note OverflowError: 68d.  To prevent raising 'OverflowError'\nby truth value testing, an object must define a *note bool():\n114a. method.\n\n-- Method: object.lengthhint (self)\n\nCalled to implement *note operator.lengthhint(): ddd.  Should\nreturn an estimated length for the object (which may be greater or\nless than the actual length).  The length must be an integer '>='\n0.  The return value may also be *note NotImplemented: 5c5, which\nis treated the same as if the 'lengthhint' method didn't exist\nat all.  This method is purely an optimization and is never\nrequired for correctness.\n\nNew in version 3.4.\n\nNote: Slicing is done exclusively with the following three methods.\nA call like\n\na[1:2] = b\n\nis translated to\n\na[slice(1, 2, None)] = b\n\nand so forth.  Missing slice items are always filled in with\n'None'.\n\n-- Method: object.getitem (self, key)\n\nCalled to implement evaluation of 'self[key]'.  For *note sequence:\n236. types, the accepted keys should be integers.  Optionally, they\nmay support *note slice: 180. objects as well.  Negative index\nsupport is also optional.  If 'key' is of an inappropriate type,\n*note TypeError: 28e. may be raised; if 'key' is a value outside\nthe set of indexes for the sequence (after any special\ninterpretation of negative values), *note IndexError: 138f. should\nbe raised.  For *note mapping: 1030. types, if 'key' is missing\n(not in the container), *note KeyError: 8cf. should be raised.\n\nNote: *note for: 24e. loops expect that an *note IndexError:\n138f. will be raised for illegal indexes to allow proper\ndetection of the end of the sequence.\n\nNote: When *note subscripting: 1c8c. a 'class', the special\nclass method *note classgetitem(): 520. may be called\ninstead of 'getitem()'.  See *note classgetitem\nversus getitem: 1c8b. for more details.\n\n-- Method: object.setitem (self, key, value)\n\nCalled to implement assignment to 'self[key]'.  Same note as for\n*note getitem(): 4b9.  This should only be implemented for\nmappings if the objects support changes to the values for keys, or\nif new keys can be added, or for sequences if elements can be\nreplaced.  The same exceptions should be raised for improper 'key'\nvalues as for the *note getitem(): 4b9. method.\n\n-- Method: object.delitem (self, key)\n\nCalled to implement deletion of 'self[key]'.  Same note as for\n*note getitem(): 4b9.  This should only be implemented for\nmappings if the objects support removal of keys, or for sequences\nif elements can be removed from the sequence.  The same exceptions\nshould be raised for improper 'key' values as for the *note\ngetitem(): 4b9. method.\n\n-- Method: object.missing (self, key)\n\nCalled by *note dict: 237.*note getitem(): 4b9. to implement\n'self[key]' for dict subclasses when key is not in the dictionary.\n\n-- Method: object.iter (self)\n\nThis method is called when an *note iterator: 16a9. is required for\na container.  This method should return a new iterator object that\ncan iterate over all the objects in the container.  For mappings,\nit should iterate over the keys of the container.\n\n-- Method: object.reversed (self)\n\nCalled (if present) by the *note reversed(): 661. built-in to\nimplement reverse iteration.  It should return a new iterator\nobject that iterates over all the objects in the container in\nreverse order.\n\nIf the *note reversed(): 1c62. method is not provided, the\n*note reversed(): 661. built-in will fall back to using the\nsequence protocol (*note len(): 1c68. and *note getitem():\n4b9.).  Objects that support the sequence protocol should only\nprovide *note reversed(): 1c62. if they can provide an\nimplementation that is more efficient than the one provided by\n*note reversed(): 661.\n\nThe membership test operators (*note in: 250. and *note not in: 3fc.)\nare normally implemented as an iteration through a container.  However,\ncontainer objects can supply the following special method with a more\nefficient implementation, which also does not require the object be\niterable.\n\n-- Method: object.contains (self, item)\n\nCalled to implement membership test operators.  Should return true\nif 'item' is in 'self', false otherwise.  For mapping objects, this\nshould consider the keys of the mapping rather than the values or\nthe key-item pairs.\n\nFor objects that don't define *note contains(): 1c63, the\nmembership test first tries iteration via *note iter(): 1c61,\nthen the old sequence iteration protocol via *note getitem():\n4b9, see *note this section in the language reference: 1c9a.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Emulating numeric types,  Next: With Statement Context Managers,  Prev: Emulating container types,  Up: Special method names": {
            "content": "4.3.3.21 Emulating numeric types\n................................\n\nThe following methods can be defined to emulate numeric objects.",
            "subsections": []
        },
        "Methods corresponding to operations that are not supported by the": {
            "content": "particular kind of number implemented (e.g., bitwise operations for\nnon-integral numbers) should be left undefined.\n\n-- Method: object.add (self, other)\n-- Method: object.sub (self, other)\n-- Method: object.mul (self, other)\n-- Method: object.matmul (self, other)\n-- Method: object.truediv (self, other)\n-- Method: object.floordiv (self, other)\n-- Method: object.mod (self, other)\n-- Method: object.divmod (self, other)\n-- Method: object.pow (self, other[, modulo])\n-- Method: object.lshift (self, other)\n-- Method: object.rshift (self, other)\n-- Method: object.and (self, other)\n-- Method: object.xor (self, other)\n-- Method: object.or (self, other)\n\nThese methods are called to implement the binary arithmetic\noperations ('+', '-', '*', '@', '/', '//', '%', *note divmod():\n7c5, *note pow(): 7f7, '', '<<', '>>', '&', '^', '|').  For\ninstance, to evaluate the expression 'x + y', where 'x' is an\ninstance of a class that has an *note add(): 1c93. method,\n'type(x).add(x, y)' is called.  The *note divmod(): 1ca0.\nmethod should be the equivalent to using *note floordiv():\n134e. and *note mod(): 1c9f.; it should not be related to *note\ntruediv(): 134d.  Note that *note pow(): 5c6. should be\ndefined to accept an optional third argument if the ternary version\nof the built-in *note pow(): 7f7. function is to be supported.\n\nIf one of those methods does not support the operation with the\nsupplied arguments, it should return *note NotImplemented: 5c5.\n\n-- Method: object.radd (self, other)\n-- Method: object.rsub (self, other)\n-- Method: object.rmul (self, other)\n-- Method: object.rmatmul (self, other)\n-- Method: object.rtruediv (self, other)\n-- Method: object.rfloordiv (self, other)\n-- Method: object.rmod (self, other)\n-- Method: object.rdivmod (self, other)\n-- Method: object.rpow (self, other[, modulo])\n-- Method: object.rlshift (self, other)\n-- Method: object.rrshift (self, other)\n-- Method: object.rand (self, other)\n-- Method: object.rxor (self, other)\n-- Method: object.ror (self, other)\n\nThese methods are called to implement the binary arithmetic\noperations ('+', '-', '*', '@', '/', '//', '%', *note divmod():\n7c5, *note pow(): 7f7, '', '<<', '>>', '&', '^', '|') with\nreflected (swapped) operands.  These functions are only called if\nthe left operand does not support the corresponding operation (1)\nand the operands are of different types.  (2)  For instance, to\nevaluate the expression 'x - y', where 'y' is an instance of a\nclass that has an *note rsub(): 1ca6. method,\n'type(y).rsub(y, x)' is called if 'type(x).sub(x, y)'\nreturns *note NotImplemented: 5c5.\n\nNote that ternary *note pow(): 7f7. will not try calling *note\nrpow(): 5c7. (the coercion rules would become too complicated).\n\nNote: If the right operand's type is a subclass of the left\noperand's type and that subclass provides a different\nimplementation of the reflected method for the operation, this\nmethod will be called before the left operand's non-reflected\nmethod.  This behavior allows subclasses to override their\nancestors' operations.\n\n-- Method: object.iadd (self, other)\n-- Method: object.isub (self, other)\n-- Method: object.imul (self, other)\n-- Method: object.imatmul (self, other)\n-- Method: object.itruediv (self, other)\n-- Method: object.ifloordiv (self, other)\n-- Method: object.imod (self, other)\n-- Method: object.ipow (self, other[, modulo])\n-- Method: object.ilshift (self, other)\n-- Method: object.irshift (self, other)\n-- Method: object.iand (self, other)\n-- Method: object.ixor (self, other)\n-- Method: object.ior (self, other)\n\nThese methods are called to implement the augmented arithmetic\nassignments ('+=', '-=', '*=', '@=', '/=', '//=', '%=', '=',\n'<<=', '>>=', '&=', '^=', '|=').  These methods should attempt to\ndo the operation in-place (modifying 'self') and return the result\n(which could be, but does not have to be, 'self').  If a specific\nmethod is not defined, or if that method returns *note\nNotImplemented: 5c5, the augmented assignment falls back to the\nnormal methods.  For instance, if 'x' is an instance of a class\nwith an *note iadd(): 1c95. method, 'x += y' is equivalent to\n'x = x.iadd(y)' .  If *note iadd(): 1c95. does not exist,\nor if 'x.iadd(y)' returns 'NotImplemented', 'x.add(y)' and\n'y.radd(x)' are considered, as with the evaluation of 'x + y'.\nIn certain situations, augmented assignment can result in\nunexpected errors (see *note Why does atuple[i] += ['item'] raise\nan exception when the addition works?: 1cbb.), but this behavior is\nin fact part of the data model.\n\n-- Method: object.neg (self)\n-- Method: object.pos (self)\n-- Method: object.abs (self)\n-- Method: object.invert (self)\n\nCalled to implement the unary arithmetic operations ('-', '+',\n*note abs(): 1a29. and '~').\n\n-- Method: object.complex (self)\n-- Method: object.int (self)\n-- Method: object.float (self)\n\nCalled to implement the built-in functions *note complex(): 3ad,\n*note int(): 17e. and *note float(): 4b7.  Should return a value of\nthe appropriate type.\n\n-- Method: object.index (self)\n\nCalled to implement *note operator.index(): 1673, and whenever\nPython needs to losslessly convert the numeric object to an integer\nobject (such as in slicing, or in the built-in *note bin(): 1120,\n*note hex(): 1143. and *note oct(): 1142. functions).  Presence of\nthis method indicates that the numeric object is an integer type.\nMust return an integer.\n\nIf *note int(): 4f0, *note float(): 7f0. and *note\ncomplex(): 3ac. are not defined then corresponding built-in\nfunctions *note int(): 17e, *note float(): 4b7. and *note\ncomplex(): 3ad. fall back to *note index(): 4f1.\n\n-- Method: object.round (self[, ndigits])\n-- Method: object.trunc (self)\n-- Method: object.floor (self)\n-- Method: object.ceil (self)\n\nCalled to implement the built-in function *note round(): 114f. and\n*note math: 89. functions *note trunc(): 1218, *note floor(): 1216.\nand *note ceil(): 1217.  Unless 'ndigits' is passed to\n'round()' all these methods should return the value of the\nobject truncated to an *note Integral: 1cc3. (typically an *note\nint: 17e.).\n\nThe built-in function *note int(): 17e. falls back to *note\ntrunc(): 4ef. if neither *note int(): 4f0. nor *note\nindex(): 4f1. is defined.\n\nChanged in version 3.11: The delegation of *note int(): 17e. to\n*note trunc(): 4ef. is deprecated.\n\n---------- Footnotes ----------\n\n(1) \"Does not support\" here means that the class has no such method,\nor the method returns *note NotImplemented: 5c5.  Do not set the method\nto 'None' if you want to force fallback to the right operand's reflected\nmethod--that will instead have the opposite effect of explicitly\n'blocking' such fallback.\n\n(2) For operands of the same type, it is assumed that if the\nnon-reflected method - such as *note add(): 1c93. - fails then the\noverall operation is not supported, which is why the reflected method is\nnot called.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: With Statement Context Managers,  Next: Customizing positional arguments in class pattern matching,  Prev: Emulating numeric types,  Up: Special method names": {
            "content": "4.3.3.22 With Statement Context Managers\n........................................\n\nA 'context manager' is an object that defines the runtime context to be\nestablished when executing a *note with: 396. statement.  The context\nmanager handles the entry into, and the exit from, the desired runtime\ncontext for the execution of the block of code.  Context managers are\nnormally invoked using the 'with' statement (described in section *note",
            "subsections": []
        },
        "The with statement: 396.), but can also be used by directly invoking": {
            "content": "their methods.\n",
            "subsections": []
        },
        "Typical uses of context managers include saving and restoring various": {
            "content": "kinds of global state, locking and unlocking resources, closing opened\nfiles, etc.\n\nFor more information on context managers, see *note Context Manager\nTypes: 1cc6.\n\n-- Method: object.enter (self)\n\nEnter the runtime context related to this object.  The *note with:\n396. statement will bind this method's return value to the\ntarget(s) specified in the 'as' clause of the statement, if any.\n\n-- Method: object.exit (self, exctype, excvalue, traceback)\n\nExit the runtime context related to this object.  The parameters\ndescribe the exception that caused the context to be exited.  If\nthe context was exited without an exception, all three arguments\nwill be *note None: 43f.\n\nIf an exception is supplied, and the method wishes to suppress the\nexception (i.e., prevent it from being propagated), it should\nreturn a true value.  Otherwise, the exception will be processed\nnormally upon exit from this method.\n\nNote that *note exit(): 1175. methods should not reraise the\npassed-in exception; this is the caller's responsibility.\n\nSee also\n........\n\nPEP 343(1) - The \"with\" statement\n\nThe specification, background, and examples for the Python *note\nwith: 396. statement.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0343/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Customizing positional arguments in class pattern matching,  Next: Emulating buffer types,  Prev: With Statement Context Managers,  Up: Special method names": {
            "content": "4.3.3.23 Customizing positional arguments in class pattern matching\n...................................................................\n",
            "subsections": []
        },
        "When using a class name in a pattern, positional arguments in the": {
            "content": "pattern are not allowed by default, i.e.  'case MyClass(x, y)' is\ntypically invalid without special support in 'MyClass'.  To be able to\nuse that kind of pattern, the class needs to define a 'matchargs'\nattribute.\n\n-- Data: object.matchargs\n\nThis class variable can be assigned a tuple of strings.  When this\nclass is used in a class pattern with positional arguments, each\npositional argument will be converted into a keyword argument,\nusing the corresponding value in 'matchargs' as the keyword.\nThe absence of this attribute is equivalent to setting it to '()'.\n\nFor example, if 'MyClass.matchargs' is '(\"left\", \"center\",\n\"right\")' that means that 'case MyClass(x, y)' is equivalent to 'case\nMyClass(left=x, center=y)'.  Note that the number of arguments in the\npattern must be smaller than or equal to the number of elements in\n'matchargs'; if it is larger, the pattern match attempt will raise\na *note TypeError: 28e.\n\nNew in version 3.10.\n\nSee also\n........\n\nPEP 634(1) - Structural Pattern Matching\n\nThe specification for the Python 'match' statement.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0634/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Emulating buffer types,  Next: Special method lookup,  Prev: Customizing positional arguments in class pattern matching,  Up: Special method names": {
            "content": "4.3.3.24 Emulating buffer types\n...............................\n\nThe *note buffer protocol: 148. provides a way for Python objects to\nexpose efficient access to a low-level memory array.  This protocol is\nimplemented by builtin types such as *note bytes: 295. and *note\nmemoryview: 17f, and third-party libraries may define additional buffer\ntypes.\n",
            "subsections": []
        },
        "While buffer types are usually implemented in C, it is also possible to": {
            "content": "implement the protocol in Python.\n\n-- Method: object.buffer (self, flags)\n\nCalled when a buffer is requested from 'self' (for example, by the\n*note memoryview: 17f. constructor).  The 'flags' argument is an\ninteger representing the kind of buffer requested, affecting for\nexample whether the returned buffer is read-only or writable.\n*note inspect.BufferFlags: 171. provides a convenient way to\ninterpret the flags.  The method must return a *note memoryview:\n17f. object.\n\n-- Method: object.releasebuffer (self, buffer)\n\nCalled when a buffer is no longer needed.  The 'buffer' argument is\na *note memoryview: 17f. object that was previously returned by\n*note buffer(): 16f.  The method must release any resources\nassociated with the buffer.  This method should return 'None'.\nBuffer objects that do not need to perform any cleanup are not\nrequired to implement this method.\n\nNew in version 3.12.\n\nSee also\n........\n\nPEP 688(1) - Making the buffer protocol accessible in Python\n\nIntroduces the Python 'buffer' and 'releasebuffer'\nmethods.\n\n*note collections.abc.Buffer: 170.\n\nABC for buffer types.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0688/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Special method lookup,  Prev: Emulating buffer types,  Up: Special method names": {
            "content": "4.3.3.25 Special method lookup\n..............................\n",
            "subsections": []
        },
        "For custom classes, implicit invocations of special methods are only": {
            "content": "guaranteed to work correctly if defined on an object's type, not in the\nobject's instance dictionary.  That behaviour is the reason why the\nfollowing code raises an exception:\n\n>>> class C:\n...     pass\n...\n>>> c = C()\n>>> c.len = lambda: 5\n>>> len(c)\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nTypeError: object of type 'C' has no len()\n",
            "subsections": []
        },
        "The rationale behind this behaviour lies with a number of special": {
            "content": "methods such as *note hash(): 932. and *note repr(): 3e8. that\nare implemented by all objects, including type objects.  If the implicit\nlookup of these methods used the conventional lookup process, they would\nfail when invoked on the type object itself:\n\n>>> 1 .hash() == hash(1)\nTrue\n>>> int.hash() == hash(int)\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nTypeError: descriptor 'hash' of 'int' object needs an argument\n",
            "subsections": []
        },
        "Incorrectly attempting to invoke an unbound method of a class in this": {
            "content": "way is sometimes referred to as 'metaclass confusion', and is avoided by\nbypassing the instance when looking up special methods:\n\n>>> type(1).hash(1) == hash(1)\nTrue\n>>> type(int).hash(int) == hash(int)\nTrue\n",
            "subsections": []
        },
        "In addition to bypassing any instance attributes in the interest of": {
            "content": "correctness, implicit special method lookup generally also bypasses the\n*note getattribute(): a16. method even of the object's metaclass:\n\n>>> class Meta(type):\n...     def getattribute(*args):\n...         print(\"Metaclass getattribute invoked\")\n...         return type.getattribute(*args)\n...\n>>> class C(object, metaclass=Meta):\n...     def len(self):\n...         return 10\n...     def getattribute(*args):\n...         print(\"Class getattribute invoked\")\n...         return object.getattribute(*args)\n...\n>>> c = C()\n>>> c.len()                 # Explicit lookup via instance\nClass getattribute invoked\n10\n>>> type(c).len(c)          # Explicit lookup via type\nMetaclass getattribute invoked\n10\n>>> len(c)                      # Implicit lookup\n10\n\nBypassing the *note getattribute(): a16. machinery in this fashion\nprovides significant scope for speed optimisations within the\ninterpreter, at the cost of some flexibility in the handling of special\nmethods (the special method 'must' be set on the class object itself in\norder to be consistently invoked by the interpreter).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Coroutines,  Prev: Special method names,  Up: Data model": {
            "content": "* Menu:\n\n* Awaitable Objects::\n* Coroutine Objects::\n* Asynchronous Iterators::\n* Asynchronous Context Managers::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Awaitable Objects,  Next: Coroutine Objects,  Up: Coroutines": {
            "content": "4.3.4.1 Awaitable Objects\n.........................\n\nAn *note awaitable: ac3. object generally implements an *note\nawait(): 1cce. method.  *note Coroutine objects: 1ae. returned from\n*note async def: 394. functions are awaitable.\n\nNote: The *note generator iterator: a22. objects returned from\ngenerators decorated with *note types.coroutine(): ced. are also\nawaitable, but they do not implement *note await(): 1cce.\n\n-- Method: object.await (self)\n\nMust return an *note iterator: 16a9.  Should be used to implement\n*note awaitable: ac3. objects.  For instance, *note asyncio.Future:\na11. implements this method to be compatible with the *note await:\n516. expression.\n\nNote: The language doesn't place any restriction on the type\nor value of the objects yielded by the iterator returned by\n'await', as this is specific to the implementation of the\nasynchronous execution framework (e.g.  *note asyncio: 9.)\nthat will be managing the *note awaitable: ac3. object.\n\nNew in version 3.5.\n\nSee also\n........\n\nPEP 492(1) for additional information about awaitable objects.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0492/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Coroutine Objects,  Next: Asynchronous Iterators,  Prev: Awaitable Objects,  Up: Coroutines": {
            "content": "4.3.4.2 Coroutine Objects\n.........................\n\n*note Coroutine objects: 1ae. are *note awaitable: ac3. objects.  A\ncoroutine's execution can be controlled by calling *note await():\n1cce. and iterating over the result.  When the coroutine has finished\nexecuting and returns, the iterator raises *note StopIteration: a40, and\nthe exception's *note value: 1cd0. attribute holds the return value.  If\nthe coroutine raises an exception, it is propagated by the iterator.\nCoroutines should not directly raise unhandled *note StopIteration: a40.\nexceptions.\n",
            "subsections": []
        },
        "Coroutines also have the methods listed below, which are analogous to": {
            "content": "those of generators (see *note Generator-iterator methods: 1cd1.).",
            "subsections": []
        },
        "However, unlike generators, coroutines do not directly support": {
            "content": "iteration.\n\nChanged in version 3.5.2: It is a *note RuntimeError: 17a. to await on a\ncoroutine more than once.\n\n-- Method: coroutine.send (value)\n\nStarts or resumes execution of the coroutine.  If 'value' is\n'None', this is equivalent to advancing the iterator returned by\n*note await(): 1cce.  If 'value' is not 'None', this method\ndelegates to the *note send(): 1cd3. method of the iterator that\ncaused the coroutine to suspend.  The result (return value, *note\nStopIteration: a40, or other exception) is the same as when\niterating over the 'await()' return value, described above.\n\n-- Method: coroutine.throw (value)\n\n-- Method: coroutine.throw (type[, value[, traceback]])\n\nRaises the specified exception in the coroutine.  This method\ndelegates to the *note throw(): 241. method of the iterator that\ncaused the coroutine to suspend, if it has such a method.\nOtherwise, the exception is raised at the suspension point.  The\nresult (return value, *note StopIteration: a40, or other exception)\nis the same as when iterating over the *note await(): 1cce.\nreturn value, described above.  If the exception is not caught in\nthe coroutine, it propagates back to the caller.\n\nChanged in version 3.12: The second signature (type[, value[,\ntraceback]]) is deprecated and may be removed in a future version\nof Python.\n\n-- Method: coroutine.close ()\n\nCauses the coroutine to clean itself up and exit.  If the coroutine\nis suspended, this method first delegates to the *note close():\n1517. method of the iterator that caused the coroutine to suspend,\nif it has such a method.  Then it raises *note GeneratorExit: 121c.\nat the suspension point, causing the coroutine to immediately clean\nitself up.  Finally, the coroutine is marked as having finished\nexecuting, even if it was never started.\n\nCoroutine objects are automatically closed using the above process\nwhen they are about to be destroyed.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Asynchronous Iterators,  Next: Asynchronous Context Managers,  Prev: Coroutine Objects,  Up: Coroutines": {
            "content": "4.3.4.3 Asynchronous Iterators\n..............................\n",
            "subsections": []
        },
        "An 'asynchronous iterator' can call asynchronous code in its 'anext'": {
            "content": "method.\n\nAsynchronous iterators can be used in an *note async for: 8e0.\nstatement.\n\n-- Method: object.aiter (self)\n\nMust return an 'asynchronous iterator' object.\n\n-- Method: object.anext (self)\n\nMust return an 'awaitable' resulting in a next value of the\niterator.  Should raise a *note StopAsyncIteration: 17a6. error\nwhen the iteration is over.\n\nAn example of an asynchronous iterable object:\n\nclass Reader:\nasync def readline(self):\n...\n\ndef aiter(self):\nreturn self\n\nasync def anext(self):\nval = await self.readline()\nif val == b'':\nraise StopAsyncIteration\nreturn val\n\nNew in version 3.5.\n\nChanged in version 3.7: Prior to Python 3.7, *note aiter(): a41.\ncould return an 'awaitable' that would resolve to an *note asynchronous\niterator: bd4.\n\nStarting with Python 3.7, *note aiter(): a41. must return an\nasynchronous iterator object.  Returning anything else will result in a\n*note TypeError: 28e. error.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Asynchronous Context Managers,  Prev: Asynchronous Iterators,  Up: Coroutines": {
            "content": "4.3.4.4 Asynchronous Context Managers\n.....................................\n",
            "subsections": []
        },
        "An 'asynchronous context manager' is a 'context manager' that is able to": {
            "content": "suspend execution in its 'aenter' and 'aexit' methods.\n\nAsynchronous context managers can be used in an *note async with: 399.\nstatement.\n\n-- Method: object.aenter (self)\n\nSemantically similar to *note enter(): 389, the only difference\nbeing that it must return an 'awaitable'.\n\n-- Method: object.aexit (self, exctype, excvalue, traceback)\n\nSemantically similar to *note exit(): 1175, the only difference\nbeing that it must return an 'awaitable'.\n\nAn example of an asynchronous context manager class:\n\nclass AsyncContextManager:\nasync def aenter(self):\nawait log('entering context')\n\nasync def aexit(self, exctype, exc, tb):\nawait log('exiting context')\n\nNew in version 3.5.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Execution model,  Next: The import system,  Prev: Data model,  Up: The Python Language Reference": {
            "content": "",
            "subsections": [
                {
                    "name": "4.4 Execution model",
                    "content": "* Menu:\n\n* Structure of a program::\n* Naming and binding::\n* Exceptions: Exceptions<2>.\n"
                }
            ]
        },
        "File: python3.12.info,  Node: Structure of a program,  Next: Naming and binding,  Up: Execution model": {
            "content": "A Python program is constructed from code blocks.  A 'block' is a piece\nof Python program text that is executed as a unit.  The following are\nblocks: a module, a function body, and a class definition.  Each command\ntyped interactively is a block.  A script file (a file given as standard\ninput to the interpreter or specified as a command line argument to the\ninterpreter) is a code block.  A script command (a command specified on\nthe interpreter command line with the *note -c: 3a4. option) is a code\nblock.  A module run as a top level script (as module 'main') from\nthe command line using a *note -m: 3a5. argument is also a code block.\nThe string argument passed to the built-in functions *note eval(): 690.\nand *note exec(): 691. is a code block.\n\nA code block is executed in an 'execution frame'.  A frame contains some\nadministrative information (used for debugging) and determines where and\nhow execution continues after the code block's execution has completed.\n\nFile: python3.12.info,  Node: Naming and binding,  Next: Exceptions<2>,  Prev: Structure of a program,  Up: Execution model\n\n\n* Menu:\n\n* Binding of names::\n* Resolution of names::\n* Annotation scopes::\n* Lazy evaluation::\n* Builtins and restricted execution::\n* Interaction with dynamic features::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Binding of names,  Next: Resolution of names,  Up: Naming and binding": {
            "content": "4.4.2.1 Binding of names\n........................\n\n'Names' refer to objects.  Names are introduced by name binding\noperations.\n\nThe following constructs bind names:\n\n* formal parameters to functions,\n\n* class definitions,\n\n* function definitions,\n\n* assignment expressions,\n\n* *note targets: 1ce1. that are identifiers if occurring in an\nassignment:\n\n+ *note for: 24e. loop header,\n\n+ after 'as' in a *note with: 396. statement, *note except: 379.\nclause, *note except*: 378. clause, or in the as-pattern in\nstructural pattern matching,\n\n+ in a capture pattern in structural pattern matching\n\n* *note import: 3a6. statements.\n\n* *note type: 13a. statements.\n\n* *note type parameter lists: 166.\n\nThe 'import' statement of the form 'from ... import *' binds all names\ndefined in the imported module, except those beginning with an\nunderscore.  This form may only be used at the module level.\n\nA target occurring in a *note del: 14fb. statement is also considered\nbound for this purpose (though the actual semantics are to unbind the\nname).\n",
            "subsections": []
        },
        "Each assignment or import statement occurs within a block defined by a": {
            "content": "class or function definition or at the module level (the top-level code\nblock).\n",
            "subsections": []
        },
        "If a name is bound in a block, it is a local variable of that block,": {
            "content": "unless declared as *note nonlocal: 111f. or *note global: 19a3.  If a\nname is bound at the module level, it is a global variable.  (The\nvariables of the module code block are local and global.)  If a variable\nis used in a code block but not defined there, it is a 'free variable'.\n",
            "subsections": []
        },
        "Each occurrence of a name in the program text refers to the 'binding' of": {
            "content": "that name established by the following name resolution rules.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Resolution of names,  Next: Annotation scopes,  Prev: Binding of names,  Up: Naming and binding": {
            "content": "4.4.2.2 Resolution of names\n...........................\n\nA 'scope' defines the visibility of a name within a block.  If a local\nvariable is defined in a block, its scope includes that block.  If the\ndefinition occurs in a function block, the scope extends to any blocks\ncontained within the defining one, unless a contained block introduces a\ndifferent binding for the name.\n",
            "subsections": []
        },
        "When a name is used in a code block, it is resolved using the nearest": {
            "content": "enclosing scope.  The set of all such scopes visible to a code block is\ncalled the block's 'environment'.\n\nWhen a name is not found at all, a *note NameError: 144. exception is\nraised.  If the current scope is a function scope, and the name refers\nto a local variable that has not yet been bound to a value at the point\nwhere the name is used, an *note UnboundLocalError: 1390. exception is\nraised.  *note UnboundLocalError: 1390. is a subclass of *note\nNameError: 144.\n",
            "subsections": []
        },
        "If a name binding operation occurs anywhere within a code block, all": {
            "content": "uses of the name within the block are treated as references to the\ncurrent block.  This can lead to errors when a name is used within a\nblock before it is bound.  This rule is subtle.  Python lacks\ndeclarations and allows name binding operations to occur anywhere within\na code block.  The local variables of a code block can be determined by\nscanning the entire text of the block for name binding operations.  See\n*note the FAQ entry on UnboundLocalError: 1ce4. for examples.\n\nIf the *note global: 19a3. statement occurs within a block, all uses of\nthe names specified in the statement refer to the bindings of those\nnames in the top-level namespace.  Names are resolved in the top-level\nnamespace by searching the global namespace, i.e.  the namespace of the\nmodule containing the code block, and the builtins namespace, the\nnamespace of the module *note builtins: 10.  The global namespace is\nsearched first.  If the names are not found there, the builtins\nnamespace is searched.  The 'global' statement must precede all uses of\nthe listed names.\n\nThe *note global: 19a3. statement has the same scope as a name binding\noperation in the same block.  If the nearest enclosing scope for a free\nvariable contains a global statement, the free variable is treated as a\nglobal.\n\nThe *note nonlocal: 111f. statement causes corresponding names to refer\nto previously bound variables in the nearest enclosing function scope.\n*note SyntaxError: 146. is raised at compile time if the given name does\nnot exist in any enclosing function scope.  *note Type parameters: 166.\ncannot be rebound with the 'nonlocal' statement.\n",
            "subsections": []
        },
        "The namespace for a module is automatically created the first time a": {
            "content": "module is imported.  The main module for a script is always called *note\nmain: 1.\n\nClass definition blocks and arguments to *note exec(): 691. and *note\neval(): 690. are special in the context of name resolution.  A class\ndefinition is an executable statement that may use and define names.",
            "subsections": []
        },
        "These references follow the normal rules for name resolution with an": {
            "content": "exception that unbound local variables are looked up in the global\nnamespace.  The namespace of the class definition becomes the attribute\ndictionary of the class.  The scope of names defined in a class block is\nlimited to the class block; it does not extend to the code blocks of\nmethods.  This includes comprehensions and generator expressions, but it\ndoes not include *note annotation scopes: 167, which have access to\ntheir enclosing class scopes.  This means that the following will fail:\n\nclass A:\na = 42\nb = list(a + i for i in range(10))\n\nHowever, the following will succeed:\n\nclass A:\ntype Alias = Nested\nclass Nested: pass\n\nprint(A.Alias.value)  # <type 'A.Nested'>\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Annotation scopes,  Next: Lazy evaluation,  Prev: Resolution of names,  Up: Naming and binding": {
            "content": "4.4.2.3 Annotation scopes\n.........................\n\n*note Type parameter lists: 166. and *note type: 13a. statements\nintroduce 'annotation scopes', which behave mostly like function scopes,\nbut with some exceptions discussed below.  *note Annotations: 168.\ncurrently do not use annotation scopes, but they are expected to use\nannotation scopes in Python 3.13 when PEP 649(1) is implemented.\n\nAnnotation scopes are used in the following contexts:\n\n* Type parameter lists for *note generic type aliases: 161.\n\n* Type parameter lists for *note generic functions: 15e.  A generic\nfunction's annotations are executed within the annotation scope,\nbut its defaults and decorators are not.\n\n* Type parameter lists for *note generic classes: 15d.  A generic\nclass's base classes and keyword arguments are executed within the\nannotation scope, but its decorators are not.\n\n* The bounds and constraints for type variables (*note lazily\nevaluated: 165.).\n\n* The value of type aliases (*note lazily evaluated: 165.).\n\nAnnotation scopes differ from function scopes in the following ways:\n\n* Annotation scopes have access to their enclosing class namespace.\nIf an annotation scope is immediately within a class scope, or\nwithin another annotation scope that is immediately within a class\nscope, the code in the annotation scope can use names defined in\nthe class scope as if it were executed directly within the class\nbody.  This contrasts with regular functions defined within\nclasses, which cannot access names defined in the class scope.\n\n* Expressions in annotation scopes cannot contain *note yield: 7f1,\n'yield from', *note await: 516, or *note ;=: 1ce6. expressions.\n(These expressions are allowed in other scopes contained within the\nannotation scope.)\n\n* Names defined in annotation scopes cannot be rebound with *note\nnonlocal: 111f. statements in inner scopes.  This includes only\ntype parameters, as no other syntactic elements that can appear\nwithin annotation scopes can introduce new names.\n\n* While annotation scopes have an internal name, that name is not\nreflected in the *note qualname: 16a7. of objects defined\nwithin the scope.  Instead, the 'qualname' of such objects is\nas if the object were defined in the enclosing scope.\n",
            "subsections": []
        },
        "New in version 3.12: Annotation scopes were introduced in Python 3.12 as": {
            "content": "part of PEP 695(2).\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0649/\n\n(2) https://peps.python.org/pep-0695/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Lazy evaluation,  Next: Builtins and restricted execution,  Prev: Annotation scopes,  Up: Naming and binding": {
            "content": "4.4.2.4 Lazy evaluation\n.......................\n\nThe values of type aliases created through the *note type: 13a.\nstatement are 'lazily evaluated'.  The same applies to the bounds and\nconstraints of type variables created through the *note type parameter\nsyntax: 166.  This means that they are not evaluated when the type alias\nor type variable is created.  Instead, they are only evaluated when\ndoing so is necessary to resolve an attribute access.\n\nExample:\n\n>>> type Alias = 1/0\n>>> Alias.value\nTraceback (most recent call last):\n...\nZeroDivisionError: division by zero\n>>> def func[T: 1/0](): pass\n>>> T = func.typeparams[0]\n>>> T.bound\nTraceback (most recent call last):\n...\nZeroDivisionError: division by zero\n",
            "subsections": []
        },
        "Here the exception is raised only when the 'value' attribute of the": {
            "content": "type alias or the 'bound' attribute of the type variable is\naccessed.\n",
            "subsections": []
        },
        "This behavior is primarily useful for references to types that have not": {
            "content": "yet been defined when the type alias or type variable is created.  For\nexample, lazy evaluation enables creation of mutually recursive type\naliases:\n\nfrom typing import Literal\n\ntype SimpleExpr = int | Parenthesized\ntype Parenthesized = tuple[Literal[\"(\"], Expr, Literal[\")\"]]\ntype Expr = SimpleExpr | tuple[SimpleExpr, Literal[\"+\", \"-\"], Expr]\n\nLazily evaluated values are evaluated in *note annotation scope: 167,\nwhich means that names that appear inside the lazily evaluated value are\nlooked up as if they were used in the immediately enclosing scope.\n\nNew in version 3.12.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Builtins and restricted execution,  Next: Interaction with dynamic features,  Prev: Lazy evaluation,  Up: Naming and binding": {
            "content": "4.4.2.5 Builtins and restricted execution\n.........................................\n\n'CPython implementation detail:' Users should not touch 'builtins';\nit is strictly an implementation detail.  Users wanting to override\nvalues in the builtins namespace should *note import: 3a6. the *note\nbuiltins: 10. module and modify its attributes appropriately.\n",
            "subsections": []
        },
        "The builtins namespace associated with the execution of a code block is": {
            "content": "actually found by looking up the name 'builtins' in its global\nnamespace; this should be a dictionary or a module (in the latter case\nthe module's dictionary is used).  By default, when in the *note\nmain: 1. module, 'builtins' is the built-in module *note\nbuiltins: 10.; when in any other module, 'builtins' is an alias for\nthe dictionary of the *note builtins: 10. module itself.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Interaction with dynamic features,  Prev: Builtins and restricted execution,  Up: Naming and binding": {
            "content": "4.4.2.6 Interaction with dynamic features\n.........................................\n",
            "subsections": []
        },
        "Name resolution of free variables occurs at runtime, not at compile": {
            "content": "time.  This means that the following code will print 42:\n\ni = 10\ndef f():\nprint(i)\ni = 42\nf()\n\nThe *note eval(): 690. and *note exec(): 691. functions do not have\naccess to the full environment for resolving names.  Names may be\nresolved in the local and global namespaces of the caller.  Free\nvariables are not resolved in the nearest enclosing namespace, but in\nthe global namespace.  (1)  The *note exec(): 691. and *note eval():\n690. functions have optional arguments to override the global and local\nnamespace.  If only one namespace is specified, it is used for both.\n\n---------- Footnotes ----------\n\n(1) This limitation occurs because the code that is executed by these\noperations is not available at the time the module is compiled.\n\nFile: python3.12.info,  Node: Exceptions<2>,  Prev: Naming and binding,  Up: Execution model\n\n",
            "subsections": []
        },
        "Exceptions are a means of breaking out of the normal flow of control of": {
            "content": "a code block in order to handle errors or other exceptional conditions.",
            "subsections": []
        },
        "An exception is 'raised' at the point where the error is detected; it": {
            "content": "may be 'handled' by the surrounding code block or by any code block that\ndirectly or indirectly invoked the code block where the error occurred.\n",
            "subsections": []
        },
        "The Python interpreter raises an exception when it detects a run-time": {
            "content": "error (such as division by zero).  A Python program can also explicitly\nraise an exception with the *note raise: 3b3. statement.  Exception\nhandlers are specified with the *note try: 4bc. ... *note except: 379.\nstatement.  The *note finally: 7ee. clause of such a statement can be\nused to specify cleanup code which does not handle the exception, but is\nexecuted whether an exception occurred or not in the preceding code.\n\nPython uses the \"termination\" model of error handling: an exception\nhandler can find out what happened and continue execution at an outer\nlevel, but it cannot repair the cause of the error and retry the failing\noperation (except by re-entering the offending piece of code from the\ntop).\n",
            "subsections": []
        },
        "When an exception is not handled at all, the interpreter terminates": {
            "content": "execution of the program, or returns to its interactive main loop.  In\neither case, it prints a stack traceback, except when the exception is\n*note SystemExit: b97.\n\nExceptions are identified by class instances.  The *note except: 379.\nclause is selected depending on the class of the instance: it must\nreference the class of the instance or a *note non-virtual base class:\n102a. thereof.  The instance can be received by the handler and can\ncarry additional information about the exceptional condition.\n\nNote: Exception messages are not part of the Python API. Their\ncontents may change from one version of Python to the next without\nwarning and should not be relied on by code which will run under\nmultiple versions of the interpreter.\n\nSee also the description of the *note try: 4bc. statement in section\n*note The try statement: 4bc. and *note raise: 3b3. statement in section\n*note The raise statement: 3b3.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The import system,  Next: Expressions,  Prev: Execution model,  Up: The Python Language Reference": {
            "content": "",
            "subsections": [
                {
                    "name": "4.5 The import system",
                    "content": "Python code in one *note module: 1463. gains access to the code in\nanother module by the process of *note importing: 1cf0. it.  The *note\nimport: 3a6. statement is the most common way of invoking the import\nmachinery, but it is not the only way.  Functions such as *note\nimportlib.importmodule(): 26a. and built-in *note import(): 6ed.\ncan also be used to invoke the import machinery.\n\nThe *note import: 3a6. statement combines two operations; it searches\nfor the named module, then it binds the results of that search to a name\nin the local scope.  The search operation of the 'import' statement is\ndefined as a call to the *note import(): 6ed. function, with the\nappropriate arguments.  The return value of *note import(): 6ed. is\nused to perform the name binding operation of the 'import' statement."
                }
            ]
        },
        "See the 'import' statement for the exact details of that name binding": {
            "content": "operation.\n\nA direct call to *note import(): 6ed. performs only the module\nsearch and, if found, the module creation operation.  While certain\nside-effects may occur, such as the importing of parent packages, and\nthe updating of various caches (including *note sys.modules: 16d7.),\nonly the *note import: 3a6. statement performs a name binding operation.\n\nWhen an *note import: 3a6. statement is executed, the standard builtin\n*note import(): 6ed. function is called.  Other mechanisms for\ninvoking the import system (such as *note importlib.importmodule():\n26a.) may choose to bypass *note import(): 6ed. and use their own\nsolutions to implement import semantics.\n",
            "subsections": []
        },
        "When a module is first imported, Python searches for the module and if": {
            "content": "found, it creates a module object (1), initializing it.  If the named\nmodule cannot be found, a *note ModuleNotFoundError: 981. is raised.",
            "subsections": []
        },
        "Python implements various strategies to search for the named module when": {
            "content": "the import machinery is invoked.  These strategies can be modified and\nextended by using various hooks described in the sections below.\n",
            "subsections": []
        },
        "Changed in version 3.3: The import system has been updated to fully": {
            "content": "implement the second phase of PEP 302(2).  There is no longer any\nimplicit import machinery - the full import system is exposed through\n*note sys.metapath: b80.  In addition, native namespace package support\nhas been implemented (see PEP 420(3)).\n\n* Menu:\n\n* importlib: importlib<9>.\n* Packages: Packages<2>.\n* Searching::\n* Loading::\n* The Path Based Finder::\n* Replacing the standard import system::\n* Package Relative Imports::\n* Special considerations for main::\n* References::\n\n---------- Footnotes ----------\n\n(1) See *note types.ModuleType: c71.\n\n(2) https://peps.python.org/pep-0302/\n\n(3) https://peps.python.org/pep-0420/\n\nFile: python3.12.info,  Node: importlib<9>,  Next: Packages<2>,  Up: The import system\n\n\nThe *note importlib: 71. module provides a rich API for interacting with\nthe import system.  For example *note importlib.importmodule(): 26a.\nprovides a recommended, simpler API than built-in *note import():\n6ed. for invoking the import machinery.  Refer to the *note importlib:\n71. library documentation for additional detail.\n\nFile: python3.12.info,  Node: Packages<2>,  Next: Searching,  Prev: importlib<9>,  Up: The import system\n\n",
            "subsections": []
        },
        "Python has only one type of module object, and all modules are of this": {
            "content": "type, regardless of whether the module is implemented in Python, C, or\nsomething else.  To help organize modules and provide a naming\nhierarchy, Python has a concept of *note packages: 1cf3.\n",
            "subsections": []
        },
        "You can think of packages as the directories on a file system and": {
            "content": "modules as files within directories, but don't take this analogy too\nliterally since packages and modules need not originate from the file\nsystem.  For the purposes of this documentation, we'll use this\nconvenient analogy of directories and files.  Like file system\ndirectories, packages are organized hierarchically, and packages may\nthemselves contain subpackages, as well as regular modules.\n",
            "subsections": []
        },
        "It's important to keep in mind that all packages are modules, but not": {
            "content": "all modules are packages.  Or put another way, packages are just a\nspecial kind of module.  Specifically, any module that contains a\n'path' attribute is considered a package.\n",
            "subsections": []
        },
        "All modules have a name.  Subpackage names are separated from their": {
            "content": "parent package name by a dot, akin to Python's standard attribute access\nsyntax.  Thus you might have a package called *note email: 37, which in\nturn has a subpackage called *note email.mime: 41. and a module within\nthat subpackage called *note email.mime.text: 49.\n\n* Menu:\n\n* Regular packages::\n* Namespace packages::\n\nFile: python3.12.info,  Node: Regular packages,  Next: Namespace packages,  Up: Packages<2>\n\n4.5.2.1 Regular packages\n........................\n\nPython defines two types of packages, *note regular packages: 1cf5. and\n*note namespace packages: 19ed.  Regular packages are traditional\npackages as they existed in Python 3.2 and earlier.  A regular package\nis typically implemented as a directory containing an 'init.py'\nfile.  When a regular package is imported, this 'init.py' file is\nimplicitly executed, and the objects it defines are bound to names in\nthe package's namespace.  The 'init.py' file can contain the same",
            "subsections": []
        },
        "Python code that any other module can contain, and Python will add some": {
            "content": "additional attributes to the module when it is imported.\n",
            "subsections": []
        },
        "For example, the following file system layout defines a top level": {
            "content": "'parent' package with three subpackages:\n\nparent/\ninit.py\none/\ninit.py\ntwo/\ninit.py\nthree/\ninit.py\n",
            "subsections": []
        },
        "Importing 'parent.one' will implicitly execute 'parent/init.py' and": {
            "content": "'parent/one/init.py'.  Subsequent imports of 'parent.two' or\n'parent.three' will execute 'parent/two/init.py' and\n'parent/three/init.py' respectively.\n\nFile: python3.12.info,  Node: Namespace packages,  Prev: Regular packages,  Up: Packages<2>\n\n4.5.2.2 Namespace packages\n..........................\n\nA namespace package is a composite of various *note portions: 1cf7,\nwhere each portion contributes a subpackage to the parent package.",
            "subsections": []
        },
        "Portions may reside in different locations on the file system.  Portions": {
            "content": "may also be found in zip files, on the network, or anywhere else that",
            "subsections": []
        },
        "Python searches during import.  Namespace packages may or may not": {
            "content": "correspond directly to objects on the file system; they may be virtual\nmodules that have no concrete representation.\n",
            "subsections": []
        },
        "Namespace packages do not use an ordinary list for their 'path'": {
            "content": "attribute.  They instead use a custom iterable type which will\nautomatically perform a new search for package portions on the next\nimport attempt within that package if the path of their parent package\n(or *note sys.path: 32c. for a top level package) changes.\n",
            "subsections": []
        },
        "With namespace packages, there is no 'parent/init.py' file.  In": {
            "content": "fact, there may be multiple 'parent' directories found during import\nsearch, where each one is provided by a different portion.  Thus\n'parent/one' may not be physically located next to 'parent/two'.  In\nthis case, Python will create a namespace package for the top-level\n'parent' package whenever it or one of its subpackages is imported.\n\nSee also PEP 420(1) for the namespace package specification.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0420/\n\nFile: python3.12.info,  Node: Searching,  Next: Loading,  Prev: Packages<2>,  Up: The import system\n\n\nTo begin the search, Python needs the *note fully qualified: 16a7. name\nof the module (or package, but for the purposes of this discussion, the\ndifference is immaterial) being imported.  This name may come from\nvarious arguments to the *note import: 3a6. statement, or from the\nparameters to the *note importlib.importmodule(): 26a. or *note\nimport(): 6ed. functions.\n",
            "subsections": []
        },
        "This name will be used in various phases of the import search, and it": {
            "content": "may be the dotted path to a submodule, e.g.  'foo.bar.baz'.  In this\ncase, Python first tries to import 'foo', then 'foo.bar', and finally\n'foo.bar.baz'.  If any of the intermediate imports fail, a *note\nModuleNotFoundError: 981. is raised.\n\n* Menu:\n\n* The module cache::\n* Finders and loaders::\n* Import hooks::\n* The meta path::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The module cache,  Next: Finders and loaders,  Up: Searching": {
            "content": "4.5.3.1 The module cache\n........................\n\nThe first place checked during import search is *note sys.modules: 16d7.",
            "subsections": []
        },
        "This mapping serves as a cache of all modules that have been previously": {
            "content": "imported, including the intermediate paths.  So if 'foo.bar.baz' was\npreviously imported, *note sys.modules: 16d7. will contain entries for\n'foo', 'foo.bar', and 'foo.bar.baz'.  Each key will have as its value\nthe corresponding module object.\n\nDuring import, the module name is looked up in *note sys.modules: 16d7.\nand if present, the associated value is the module satisfying the\nimport, and the process completes.  However, if the value is 'None',\nthen a *note ModuleNotFoundError: 981. is raised.  If the module name is\nmissing, Python will continue searching for the module.\n\n*note sys.modules: 16d7. is writable.  Deleting a key may not destroy\nthe associated module (as other modules may hold references to it), but\nit will invalidate the cache entry for the named module, causing Python\nto search anew for the named module upon its next import.  The key can\nalso be assigned to 'None', forcing the next import of the module to\nresult in a *note ModuleNotFoundError: 981.\n",
            "subsections": []
        },
        "Beware though, as if you keep a reference to the module object,": {
            "content": "invalidate its cache entry in *note sys.modules: 16d7, and then\nre-import the named module, the two module objects will 'not' be the\nsame.  By contrast, *note importlib.reload(): 26b. will reuse the 'same'\nmodule object, and simply reinitialise the module contents by rerunning\nthe module's code.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Finders and loaders,  Next: Import hooks,  Prev: The module cache,  Up: Searching": {
            "content": "4.5.3.2 Finders and loaders\n...........................\n\nIf the named module is not found in *note sys.modules: 16d7, then",
            "subsections": []
        },
        "Python's import protocol is invoked to find and load the module.  This": {
            "content": "protocol consists of two conceptual objects, *note finders: 1cfc. and\n*note loaders: 13e6.  A finder's job is to determine whether it can find\nthe named module using whatever strategy it knows about.  Objects that\nimplement both of these interfaces are referred to as *note importers:\n1cfd. - they return themselves when they find that they can load the\nrequested module.\n",
            "subsections": []
        },
        "Python includes a number of default finders and importers.  The first": {
            "content": "one knows how to locate built-in modules, and the second knows how to\nlocate frozen modules.  A third default finder searches an *note import\npath: 1cfe. for modules.  The *note import path: 1cfe. is a list of\nlocations that may name file system paths or zip files.  It can also be\nextended to search for any locatable resource, such as those identified\nby URLs.\n",
            "subsections": []
        },
        "The import machinery is extensible, so new finders can be added to": {
            "content": "extend the range and scope of module searching.\n",
            "subsections": []
        },
        "Finders do not actually load modules.  If they can find the named": {
            "content": "module, they return a 'module spec', an encapsulation of the module's\nimport-related information, which the import machinery then uses when\nloading the module.\n",
            "subsections": []
        },
        "The following sections describe the protocol for finders and loaders in": {
            "content": "more detail, including how you can create and register new ones to\nextend the import machinery.\n",
            "subsections": []
        },
        "Changed in version 3.4: In previous versions of Python, finders returned": {
            "content": "*note loaders: 13e6. directly, whereas now they return module specs\nwhich 'contain' loaders.  Loaders are still used during import but have\nfewer responsibilities.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Import hooks,  Next: The meta path,  Prev: Finders and loaders,  Up: Searching": {
            "content": "4.5.3.3 Import hooks\n....................\n",
            "subsections": []
        },
        "The import machinery is designed to be extensible; the primary mechanism": {
            "content": "for this are the 'import hooks'.  There are two types of import hooks:\n'meta hooks' and 'import path hooks'.\n",
            "subsections": []
        },
        "Meta hooks are called at the start of import processing, before any": {
            "content": "other import processing has occurred, other than *note sys.modules:\n16d7. cache look up.  This allows meta hooks to override *note sys.path:\n32c. processing, frozen modules, or even built-in modules.  Meta hooks\nare registered by adding new finder objects to *note sys.metapath: b80,\nas described below.\n\nImport path hooks are called as part of *note sys.path: 32c. (or\n'package.path') processing, at the point where their associated path\nitem is encountered.  Import path hooks are registered by adding new\ncallables to *note sys.pathhooks: e9b. as described below.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The meta path,  Prev: Import hooks,  Up: Searching": {
            "content": "4.5.3.4 The meta path\n.....................\n\nWhen the named module is not found in *note sys.modules: 16d7, Python\nnext searches *note sys.metapath: b80, which contains a list of meta\npath finder objects.  These finders are queried in order to see if they\nknow how to handle the named module.  Meta path finders must implement a\nmethod called *note findspec(): 666. which takes three arguments: a\nname, an import path, and (optionally) a target module.  The meta path\nfinder can use any strategy it wants to determine whether it can handle\nthe named module or not.\n",
            "subsections": []
        },
        "If the meta path finder knows how to handle the named module, it returns": {
            "content": "a spec object.  If it cannot handle the named module, it returns 'None'.\nIf *note sys.metapath: b80. processing reaches the end of its list\nwithout returning a spec, then a *note ModuleNotFoundError: 981. is\nraised.  Any other exceptions raised are simply propagated up, aborting\nthe import process.\n\nThe *note findspec(): 666. method of meta path finders is called with\ntwo or three arguments.  The first is the fully qualified name of the\nmodule being imported, for example 'foo.bar.baz'.  The second argument\nis the path entries to use for the module search.  For top-level\nmodules, the second argument is 'None', but for submodules or\nsubpackages, the second argument is the value of the parent package's\n'path' attribute.  If the appropriate 'path' attribute cannot be\naccessed, a *note ModuleNotFoundError: 981. is raised.  The third\nargument is an existing module object that will be the target of loading\nlater.  The import system passes in a target module only during reload.\n",
            "subsections": []
        },
        "The meta path may be traversed multiple times for a single import": {
            "content": "request.  For example, assuming none of the modules involved has already\nbeen cached, importing 'foo.bar.baz' will first perform a top level\nimport, calling 'mpf.findspec(\"foo\", None, None)' on each meta path\nfinder ('mpf').  After 'foo' has been imported, 'foo.bar' will be\nimported by traversing the meta path a second time, calling\n'mpf.findspec(\"foo.bar\", foo.path, None)'.  Once 'foo.bar' has been\nimported, the final traversal will call 'mpf.findspec(\"foo.bar.baz\",\nfoo.bar.path, None)'.\n",
            "subsections": []
        },
        "Some meta path finders only support top level imports.  These importers": {
            "content": "will always return 'None' when anything other than 'None' is passed as\nthe second argument.\n\nPython's default *note sys.metapath: b80. has three meta path finders,\none that knows how to import built-in modules, one that knows how to\nimport frozen modules, and one that knows how to import modules from an\n*note import path: 1cfe. (i.e.  the *note path based finder: 1d01.).\n\nChanged in version 3.4: The *note findspec(): 666. method of meta path\nfinders replaced 'findmodule()', which is now deprecated.  While it\nwill continue to work without change, the import machinery will try it\nonly if the finder does not implement *note findspec(): 666.\n",
            "subsections": []
        },
        "Changed in version 3.10: Use of 'findmodule()' by the import system now": {
            "content": "raises *note ImportWarning: 243.\n\nChanged in version 3.12: 'findmodule()' has been removed.  Use *note\nfindspec(): 666. instead.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Loading,  Next: The Path Based Finder,  Prev: Searching,  Up: The import system": {
            "content": "",
            "subsections": []
        },
        "If and when a module spec is found, the import machinery will use it": {
            "content": "(and the loader it contains) when loading the module.  Here is an\napproximation of what happens during the loading portion of import:\n\nmodule = None\nif spec.loader is not None and hasattr(spec.loader, 'createmodule'):\n# It is assumed 'execmodule' will also be defined on the loader.\nmodule = spec.loader.createmodule(spec)\nif module is None:\nmodule = ModuleType(spec.name)\n# The import-related module attributes get set here:\ninitmoduleattrs(spec, module)\n\nif spec.loader is None:\n# unsupported\nraise ImportError\nif spec.origin is None and spec.submodulesearchlocations is not None:\n# namespace package\nsys.modules[spec.name] = module\nelif not hasattr(spec.loader, 'execmodule'):\nmodule = spec.loader.loadmodule(spec.name)\nelse:\nsys.modules[spec.name] = module\ntry:\nspec.loader.execmodule(module)\nexcept BaseException:\ntry:\ndel sys.modules[spec.name]\nexcept KeyError:\npass\nraise\nreturn sys.modules[spec.name]\n\nNote the following details:\n\n* If there is an existing module object with the given name in *note\nsys.modules: 16d7, import will have already returned it.\n\n* The module will exist in *note sys.modules: 16d7. before the loader\nexecutes the module code.  This is crucial because the module code\nmay (directly or indirectly) import itself; adding it to *note\nsys.modules: 16d7. beforehand prevents unbounded recursion in the\nworst case and multiple loading in the best.\n\n* If loading fails, the failing module - and only the failing module\n- gets removed from *note sys.modules: 16d7.  Any module already in\nthe *note sys.modules: 16d7. cache, and any module that was\nsuccessfully loaded as a side-effect, must remain in the cache.\nThis contrasts with reloading where even the failing module is left\nin *note sys.modules: 16d7.\n\n* After the module is created but before execution, the import\nmachinery sets the import-related module attributes\n(\"initmoduleattrs\" in the pseudo-code example above), as\nsummarized in a *note later section: 1d03.\n\n* Module execution is the key moment of loading in which the module's\nnamespace gets populated.  Execution is entirely delegated to the\nloader, which gets to decide what gets populated and how.\n\n* The module created during loading and passed to execmodule() may\nnot be the one returned at the end of import (1).\n",
            "subsections": []
        },
        "Changed in version 3.4: The import system has taken over the boilerplate": {
            "content": "responsibilities of loaders.  These were previously performed by the\n*note importlib.abc.Loader.loadmodule(): 663. method.\n\n* Menu:\n\n* Loaders::\n* Submodules::\n* Module spec::\n* Import-related module attributes::\n* module.path: module path.\n* Module reprs::\n* Cached bytecode invalidation::\n\n---------- Footnotes ----------\n\n(1) The importlib implementation avoids using the return value\ndirectly.  Instead, it gets the module object by looking the module name\nup in *note sys.modules: 16d7.  The indirect effect of this is that an\nimported module may replace itself in *note sys.modules: 16d7.  This is\nimplementation-specific behavior that is not guaranteed to work in other\nPython implementations.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Loaders,  Next: Submodules,  Up: Loading": {
            "content": "4.5.4.1 Loaders\n...............\n",
            "subsections": []
        },
        "Module loaders provide the critical function of loading: module": {
            "content": "execution.  The import machinery calls the *note\nimportlib.abc.Loader.execmodule(): 664. method with a single argument,\nthe module object to execute.  Any value returned from *note\nexecmodule(): 664. is ignored.\n\nLoaders must satisfy the following requirements:\n\n* If the module is a Python module (as opposed to a built-in module\nor a dynamically loaded extension), the loader should execute the\nmodule's code in the module's global name space\n('module.dict').\n\n* If the loader cannot execute the module, it should raise an *note\nImportError: 145, although any other exception raised during *note\nexecmodule(): 664. will be propagated.\n",
            "subsections": []
        },
        "In many cases, the finder and loader can be the same object; in such": {
            "content": "cases the *note findspec(): 666. method would just return a spec with\nthe loader set to 'self'.\n",
            "subsections": []
        },
        "Module loaders may opt in to creating the module object during loading": {
            "content": "by implementing a *note createmodule(): afd. method.  It takes one\nargument, the module spec, and returns the new module object to use\nduring loading.  'createmodule()' does not need to set any attributes\non the module object.  If the method returns 'None', the import\nmachinery will create the new module itself.\n\nNew in version 3.4: The *note createmodule(): afd. method of loaders.\n\nChanged in version 3.4: The *note loadmodule(): 663. method was\nreplaced by *note execmodule(): 664. and the import machinery assumed\nall the boilerplate responsibilities of loading.\n",
            "subsections": []
        },
        "For compatibility with existing loaders, the import machinery will use": {
            "content": "the 'loadmodule()' method of loaders if it exists and the loader does\nnot also implement 'execmodule()'.  However, 'loadmodule()' has been\ndeprecated and loaders should implement 'execmodule()' instead.\n",
            "subsections": []
        },
        "The 'loadmodule()' method must implement all the boilerplate loading": {
            "content": "functionality described above in addition to executing the module.  All\nthe same constraints apply, with some additional clarification:\n\n* If there is an existing module object with the given name in *note\nsys.modules: 16d7, the loader must use that existing module.\n(Otherwise, *note importlib.reload(): 26b. will not work\ncorrectly.)  If the named module does not exist in *note\nsys.modules: 16d7, the loader must create a new module object and\nadd it to *note sys.modules: 16d7.\n\n* The module 'must' exist in *note sys.modules: 16d7. before the\nloader executes the module code, to prevent unbounded recursion or\nmultiple loading.\n\n* If loading fails, the loader must remove any modules it has\ninserted into *note sys.modules: 16d7, but it must remove 'only'\nthe failing module(s), and only if the loader itself has loaded the\nmodule(s) explicitly.\n\nChanged in version 3.5: A *note DeprecationWarning: 179. is raised when\n'execmodule()' is defined but 'createmodule()' is not.\n\nChanged in version 3.6: An *note ImportError: 145. is raised when\n'execmodule()' is defined but 'createmodule()' is not.\n\nChanged in version 3.10: Use of 'loadmodule()' will raise *note\nImportWarning: 243.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Submodules,  Next: Module spec,  Prev: Loaders,  Up: Loading": {
            "content": "4.5.4.2 Submodules\n..................\n",
            "subsections": []
        },
        "When a submodule is loaded using any mechanism (e.g.  'importlib' APIs,": {
            "content": "the 'import' or 'import-from' statements, or built-in 'import()') a\nbinding is placed in the parent module's namespace to the submodule\nobject.  For example, if package 'spam' has a submodule 'foo', after\nimporting 'spam.foo', 'spam' will have an attribute 'foo' which is bound\nto the submodule.  Let's say you have the following directory structure:\n\nspam/\ninit.py\nfoo.py\n\nand 'spam/init.py' has the following line in it:\n\nfrom .foo import Foo\n\nthen executing the following puts name bindings for 'foo' and 'Foo' in\nthe 'spam' module:\n\n>>> import spam\n>>> spam.foo\n<module 'spam.foo' from '/tmp/imports/spam/foo.py'>\n>>> spam.Foo\n<class 'spam.foo.Foo'>\n",
            "subsections": []
        },
        "Given Python's familiar name binding rules this might seem surprising,": {
            "content": "but it's actually a fundamental feature of the import system.  The\ninvariant holding is that if you have 'sys.modules['spam']' and\n'sys.modules['spam.foo']' (as you would after the above import), the\nlatter must appear as the 'foo' attribute of the former.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Module spec,  Next: Import-related module attributes,  Prev: Submodules,  Up: Loading": {
            "content": "4.5.4.3 Module spec\n...................\n",
            "subsections": []
        },
        "The import machinery uses a variety of information about each module": {
            "content": "during import, especially before loading.  Most of the information is\ncommon to all modules.  The purpose of a module's spec is to encapsulate\nthis import-related information on a per-module basis.\n",
            "subsections": []
        },
        "Using a spec during import allows state to be transferred between import": {
            "content": "system components, e.g.  between the finder that creates the module spec\nand the loader that executes it.  Most importantly, it allows the import\nmachinery to perform the boilerplate operations of loading, whereas\nwithout a module spec the loader had that responsibility.\n",
            "subsections": []
        },
        "The module's spec is exposed as the 'spec' attribute on a module": {
            "content": "object.  See *note ModuleSpec: 1d07. for details on the contents of the\nmodule spec.\n\nNew in version 3.4.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Import-related module attributes,  Next: module path,  Prev: Module spec,  Up: Loading": {
            "content": "4.5.4.4 Import-related module attributes\n........................................\n",
            "subsections": []
        },
        "The import machinery fills in these attributes on each module object": {
            "content": "during loading, based on the module's spec, before the loader executes\nthe module.\n\nIt is 'strongly' recommended that you rely on *note spec: 1d09. and\nits attributes instead of any of the other individual attributes listed\nbelow.\n\n-- Attribute: name\n\nThe 'name' attribute must be set to the fully qualified name of\nthe module.  This name is used to uniquely identify the module in\nthe import system.\n\n-- Attribute: loader\n\nThe 'loader' attribute must be set to the loader object that\nthe import machinery used when loading the module.  This is mostly\nfor introspection, but can be used for additional loader-specific\nfunctionality, for example getting data associated with a loader.\n\nIt is 'strongly' recommended that you rely on *note spec: 1d09.\ninstead of this attribute.\n\nChanged in version 3.12: The value of 'loader' is expected to\nbe the same as 'spec.loader'.  The use of 'loader' is\ndeprecated and slated for removal in Python 3.14.\n\n-- Attribute: package\n\nThe module's 'package' attribute may be set.  Its value must be\na string, but it can be the same value as its 'name'.  When the\nmodule is a package, its 'package' value should be set to its\n'name'.  When the module is not a package, 'package' should\nbe set to the empty string for top-level modules, or for\nsubmodules, to the parent package's name.  See PEP 366(1) for\nfurther details.\n\nThis attribute is used instead of 'name' to calculate explicit\nrelative imports for main modules, as defined in PEP 366(2).\n\nIt is 'strongly' recommended that you rely on *note spec: 1d09.\ninstead of this attribute.\n\nChanged in version 3.6: The value of 'package' is expected to\nbe the same as 'spec.parent'.\n\nChanged in version 3.10: *note ImportWarning: 243. is raised if\nimport falls back to 'package' instead of *note parent: 1d0a.\n\nChanged in version 3.12: Raise *note DeprecationWarning: 179.\ninstead of *note ImportWarning: 243. when falling back to\n'package'.\n\n-- Attribute: spec\n\nThe 'spec' attribute must be set to the module spec that was\nused when importing the module.  Setting 'spec' appropriately\napplies equally to *note modules initialized during interpreter\nstartup: 1d0b.  The one exception is 'main', where 'spec'\nis *note set to None in some cases: 1d0c.\n\nWhen 'spec.parent' is not set, 'package' is used as a\nfallback.\n\nNew in version 3.4.\n\nChanged in version 3.6: 'spec.parent' is used as a fallback\nwhen 'package' is not defined.\n\n-- Attribute: path\n\nIf the module is a package (either regular or namespace), the\nmodule object's 'path' attribute must be set.  The value must\nbe iterable, but may be empty if 'path' has no further\nsignificance.  If 'path' is not empty, it must produce strings\nwhen iterated over.  More details on the semantics of 'path'\nare given *note below: 1d0d.\n\nNon-package modules should not have a 'path' attribute.\n\n-- Attribute: file\n\n-- Attribute: cached\n\n'file' is optional (if set, value must be a string).  It\nindicates the pathname of the file from which the module was loaded\n(if loaded from a file), or the pathname of the shared library file\nfor extension modules loaded dynamically from a shared library.  It\nmight be missing for certain types of modules, such as C modules\nthat are statically linked into the interpreter, and the import\nsystem may opt to leave it unset if it has no semantic meaning\n(e.g.  a module loaded from a database).\n\nIf 'file' is set then the 'cached' attribute might also be\nset, which is the path to any compiled version of the code (e.g.\nbyte-compiled file).  The file does not need to exist to set this\nattribute; the path can simply point to where the compiled file\nwould exist (see PEP 3147(3)).\n\nNote that 'cached' may be set even if 'file' is not set.\nHowever, that scenario is quite atypical.  Ultimately, the loader\nis what makes use of the module spec provided by the finder (from\nwhich 'file' and 'cached' are derived).  So if a loader can\nload from a cached module but otherwise does not load from a file,\nthat atypical scenario may be appropriate.\n\nIt is 'strongly' recommended that you rely on *note spec: 1d09.\ninstead of 'cached'.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0366/\n\n(2) https://peps.python.org/pep-0366/\n\n(3) https://peps.python.org/pep-3147/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: module path,  Next: Module reprs,  Prev: Import-related module attributes,  Up: Loading": {
            "content": "4.5.4.5 module.path\n.......................\n\nBy definition, if a module has a 'path' attribute, it is a package.\n\nA package's 'path' attribute is used during imports of its\nsubpackages.  Within the import machinery, it functions much the same as\n*note sys.path: 32c, i.e.  providing a list of locations to search for\nmodules during import.  However, 'path' is typically much more\nconstrained than *note sys.path: 32c.\n\n'path' must be an iterable of strings, but it may be empty.  The\nsame rules used for *note sys.path: 32c. also apply to a package's\n'path', and *note sys.pathhooks: e9b. (described below) are\nconsulted when traversing a package's 'path'.\n\nA package's 'init.py' file may set or alter the package's 'path'\nattribute, and this was typically the way namespace packages were\nimplemented prior to PEP 420(1).  With the adoption of PEP 420(2),\nnamespace packages no longer need to supply 'init.py' files\ncontaining only 'path' manipulation code; the import machinery\nautomatically sets 'path' correctly for the namespace package.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0420/\n\n(2) https://peps.python.org/pep-0420/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Module reprs,  Next: Cached bytecode invalidation,  Prev: module path,  Up: Loading": {
            "content": "4.5.4.6 Module reprs\n....................\n",
            "subsections": []
        },
        "By default, all modules have a usable repr, however depending on the": {
            "content": "attributes set above, and in the module's spec, you can more explicitly\ncontrol the repr of module objects.\n",
            "subsections": []
        },
        "If the module has a spec ('spec'), the import machinery will try to": {
            "content": "generate a repr from it.  If that fails or there is no spec, the import\nsystem will craft a default repr using whatever information is available\non the module.  It will try to use the 'module.name',\n'module.file', and 'module.loader' as input into the repr, with\ndefaults for whatever information is missing.\n\nHere are the exact rules used:\n\n* If the module has a 'spec' attribute, the information in the\nspec is used to generate the repr.  The \"name\", \"loader\", \"origin\",\nand \"haslocation\" attributes are consulted.\n\n* If the module has a 'file' attribute, this is used as part of\nthe module's repr.\n\n* If the module has no 'file' but does have a 'loader' that\nis not 'None', then the loader's repr is used as part of the\nmodule's repr.\n\n* Otherwise, just use the module's 'name' in the repr.\n",
            "subsections": []
        },
        "Changed in version 3.12: Use of 'modulerepr()', having been deprecated": {
            "content": "since Python 3.4, was removed in Python 3.12 and is no longer called\nduring the resolution of a module's repr.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Cached bytecode invalidation,  Prev: Module reprs,  Up: Loading": {
            "content": "4.5.4.7 Cached bytecode invalidation\n....................................\n",
            "subsections": []
        },
        "Before Python loads cached bytecode from a '.pyc' file, it checks": {
            "content": "whether the cache is up-to-date with the source '.py' file.  By default,",
            "subsections": []
        },
        "Python does this by storing the source's last-modified timestamp and": {
            "content": "size in the cache file when writing it.  At runtime, the import system\nthen validates the cache file by checking the stored metadata in the\ncache file against the source's metadata.\n\nPython also supports \"hash-based\" cache files, which store a hash of the\nsource file's contents rather than its metadata.  There are two variants\nof hash-based '.pyc' files: checked and unchecked.  For checked\nhash-based '.pyc' files, Python validates the cache file by hashing the\nsource file and comparing the resulting hash with the hash in the cache\nfile.  If a checked hash-based cache file is found to be invalid, Python\nregenerates it and writes a new checked hash-based cache file.  For\nunchecked hash-based '.pyc' files, Python simply assumes the cache file\nis valid if it exists.  Hash-based '.pyc' files validation behavior may\nbe overridden with the *note -check-hash-based-pycs: 1ab3. flag.\n",
            "subsections": []
        },
        "Changed in version 3.7: Added hash-based '.pyc' files.  Previously,": {
            "content": "Python only supported timestamp-based invalidation of bytecode caches.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The Path Based Finder,  Next: Replacing the standard import system,  Prev: Loading,  Up: The import system": {
            "content": "",
            "subsections": []
        },
        "As mentioned previously, Python comes with several default meta path": {
            "content": "finders.  One of these, called the *note path based finder: 1d01. (*note\nPathFinder: e9a.), searches an *note import path: 1cfe, which contains a\nlist of *note path entries: 1d12.  Each path entry names a location to\nsearch for modules.\n\nThe path based finder itself doesn't know how to import anything.",
            "subsections": []
        },
        "Instead, it traverses the individual path entries, associating each of": {
            "content": "them with a path entry finder that knows how to handle that particular\nkind of path.\n",
            "subsections": []
        },
        "The default set of path entry finders implement all the semantics for": {
            "content": "finding modules on the file system, handling special file types such as",
            "subsections": []
        },
        "Python source code ('.py' files), Python byte code ('.pyc' files) and": {
            "content": "shared libraries (e.g.  '.so' files).  When supported by the *note\nzipimport: 12c. module in the standard library, the default path entry\nfinders also handle loading all of these file types (other than shared\nlibraries) from zipfiles.\n",
            "subsections": []
        },
        "Path entries need not be limited to file system locations.  They can": {
            "content": "refer to URLs, database queries, or any other location that can be\nspecified as a string.\n",
            "subsections": []
        },
        "The path based finder provides additional hooks and protocols so that": {
            "content": "you can extend and customize the types of searchable path entries.  For\nexample, if you wanted to support path entries as network URLs, you\ncould write a hook that implements HTTP semantics to find modules on the\nweb.  This hook (a callable) would return a *note path entry finder:\nee8. supporting the protocol described below, which was then used to get\na loader for the module from the web.\n\nA word of warning: this section and the previous both use the term\n'finder', distinguishing between them by using the terms *note meta path\nfinder: ee7. and *note path entry finder: ee8.  These two types of\nfinders are very similar, support similar protocols, and function in\nsimilar ways during the import process, but it's important to keep in\nmind that they are subtly different.  In particular, meta path finders\noperate at the beginning of the import process, as keyed off the *note\nsys.metapath: b80. traversal.\n",
            "subsections": []
        },
        "By contrast, path entry finders are in a sense an implementation detail": {
            "content": "of the path based finder, and in fact, if the path based finder were to\nbe removed from *note sys.metapath: b80, none of the path entry finder\nsemantics would be invoked.\n\n* Menu:\n\n* Path entry finders::\n* Path entry finder protocol::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Path entry finders,  Next: Path entry finder protocol,  Up: The Path Based Finder": {
            "content": "4.5.5.1 Path entry finders\n..........................\n\nThe *note path based finder: 1d01. is responsible for finding and\nloading Python modules and packages whose location is specified with a\nstring *note path entry: 1d12.  Most path entries name locations in the\nfile system, but they need not be limited to this.\n\nAs a meta path finder, the *note path based finder: 1d01. implements the\n*note findspec(): 666. protocol previously described, however it\nexposes additional hooks that can be used to customize how modules are\nfound and loaded from the *note import path: 1cfe.\n\nThree variables are used by the *note path based finder: 1d01, *note\nsys.path: 32c, *note sys.pathhooks: e9b. and *note\nsys.pathimportercache: 3a9.  The 'path' attributes on package\nobjects are also used.  These provide additional ways that the import\nmachinery can be customized.\n\n*note sys.path: 32c. contains a list of strings providing search\nlocations for modules and packages.  It is initialized from the *note\nPYTHONPATH: e92. environment variable and various other installation-\nand implementation-specific defaults.  Entries in *note sys.path: 32c.\ncan name directories on the file system, zip files, and potentially\nother \"locations\" (see the *note site: c2. module) that should be\nsearched for modules, such as URLs, or database queries.  Only strings\nshould be present on *note sys.path: 32c.; all other data types are\nignored.\n\nThe *note path based finder: 1d01. is a *note meta path finder: ee7, so\nthe import machinery begins the *note import path: 1cfe. search by\ncalling the path based finder's *note findspec(): e85. method as\ndescribed previously.  When the 'path' argument to *note findspec():\ne85. is given, it will be a list of string paths to traverse - typically\na package's 'path' attribute for an import within that package.  If\nthe 'path' argument is 'None', this indicates a top level import and\n*note sys.path: 32c. is used.\n",
            "subsections": []
        },
        "The path based finder iterates over every entry in the search path, and": {
            "content": "for each of these, looks for an appropriate *note path entry finder:\nee8. (*note PathEntryFinder: 66a.) for the path entry.  Because this can\nbe an expensive operation (e.g.  there may be 'stat()' call overheads\nfor this search), the path based finder maintains a cache mapping path\nentries to path entry finders.  This cache is maintained in *note\nsys.pathimportercache: 3a9. (despite the name, this cache actually\nstores finder objects rather than being limited to *note importer: 1cfd.\nobjects).  In this way, the expensive search for a particular *note path\nentry: 1d12. location's *note path entry finder: ee8. need only be done\nonce.  User code is free to remove cache entries from *note\nsys.pathimportercache: 3a9. forcing the path based finder to perform\nthe path entry search again.\n",
            "subsections": []
        },
        "If the path entry is not present in the cache, the path based finder": {
            "content": "iterates over every callable in *note sys.pathhooks: e9b.  Each of the\n*note path entry hooks: 1d14. in this list is called with a single\nargument, the path entry to be searched.  This callable may either\nreturn a *note path entry finder: ee8. that can handle the path entry,\nor it may raise *note ImportError: 145.  An *note ImportError: 145. is\nused by the path based finder to signal that the hook cannot find a\n*note path entry finder: ee8. for that *note path entry: 1d12.  The\nexception is ignored and *note import path: 1cfe. iteration continues.",
            "subsections": []
        },
        "The hook should expect either a string or bytes object; the encoding of": {
            "content": "bytes objects is up to the hook (e.g.  it may be a file system encoding,\nUTF-8, or something else), and if the hook cannot decode the argument,\nit should raise *note ImportError: 145.\n\nIf *note sys.pathhooks: e9b. iteration ends with no *note path entry\nfinder: ee8. being returned, then the path based finder's *note\nfindspec(): e85. method will store 'None' in *note\nsys.pathimportercache: 3a9. (to indicate that there is no finder for\nthis path entry) and return 'None', indicating that this *note meta path\nfinder: ee7. could not find the module.\n\nIf a *note path entry finder: ee8. 'is' returned by one of the *note\npath entry hook: 1d14. callables on *note sys.pathhooks: e9b, then the\nfollowing protocol is used to ask the finder for a module spec, which is\nthen used when loading the module.\n",
            "subsections": []
        },
        "The current working directory - denoted by an empty string - is handled": {
            "content": "slightly differently from other entries on *note sys.path: 32c.  First,\nif the current working directory is found to not exist, no value is\nstored in *note sys.pathimportercache: 3a9.  Second, the value for the\ncurrent working directory is looked up fresh for each module lookup.\nThird, the path used for *note sys.pathimportercache: 3a9. and\nreturned by *note importlib.machinery.PathFinder.findspec(): e85. will\nbe the actual current working directory and not the empty string.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Path entry finder protocol,  Prev: Path entry finders,  Up: The Path Based Finder": {
            "content": "4.5.5.2 Path entry finder protocol\n..................................\n",
            "subsections": []
        },
        "In order to support imports of modules and initialized packages and also": {
            "content": "to contribute portions to namespace packages, path entry finders must\nimplement the *note findspec(): 667. method.\n\n*note findspec(): 667. takes two arguments: the fully qualified name of\nthe module being imported, and the (optional) target module.\n'findspec()' returns a fully populated spec for the module.  This spec\nwill always have \"loader\" set (with one exception).\n",
            "subsections": []
        },
        "To indicate to the import machinery that the spec represents a namespace": {
            "content": "*note portion: 1cf7, the path entry finder sets\n'submodulesearchlocations' to a list containing the portion.\n\nChanged in version 3.4: *note findspec(): 667. replaced 'findloader()'\nand 'findmodule()', both of which are now deprecated, but will be used\nif 'findspec()' is not defined.\n",
            "subsections": []
        },
        "Older path entry finders may implement one of these two deprecated": {
            "content": "methods instead of 'findspec()'.  The methods are still respected for\nthe sake of backward compatibility.  However, if 'findspec()' is\nimplemented on the path entry finder, the legacy methods are ignored.\n\n'findloader()' takes one argument, the fully qualified name of the\nmodule being imported.  'findloader()' returns a 2-tuple where the\nfirst item is the loader and the second item is a namespace *note\nportion: 1cf7.\n",
            "subsections": []
        },
        "For backwards compatibility with other implementations of the import": {
            "content": "protocol, many path entry finders also support the same, traditional\n'findmodule()' method that meta path finders support.  However path\nentry finder 'findmodule()' methods are never called with a 'path'\nargument (they are expected to record the appropriate path information\nfrom the initial call to the path hook).\n",
            "subsections": []
        },
        "The 'findmodule()' method on path entry finders is deprecated, as it": {
            "content": "does not allow the path entry finder to contribute portions to namespace\npackages.  If both 'findloader()' and 'findmodule()' exist on a path\nentry finder, the import system will always call 'findloader()' in\npreference to 'findmodule()'.\n",
            "subsections": []
        },
        "Changed in version 3.10: Calls to 'findmodule()' and 'findloader()' by": {
            "content": "the import system will raise *note ImportWarning: 243.\n",
            "subsections": []
        },
        "Changed in version 3.12: 'findmodule()' and 'findloader()' have been": {
            "content": "removed.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Replacing the standard import system,  Next: Package Relative Imports,  Prev: The Path Based Finder,  Up: The import system": {
            "content": "",
            "subsections": []
        },
        "The most reliable mechanism for replacing the entire import system is to": {
            "content": "delete the default contents of *note sys.metapath: b80, replacing them\nentirely with a custom meta path hook.\n",
            "subsections": []
        },
        "If it is acceptable to only alter the behaviour of import statements": {
            "content": "without affecting other APIs that access the import system, then\nreplacing the builtin *note import(): 6ed. function may be\nsufficient.  This technique may also be employed at the module level to\nonly alter the behaviour of import statements within that module.\n",
            "subsections": []
        },
        "To selectively prevent the import of some modules from a hook early on": {
            "content": "the meta path (rather than disabling the standard import system\nentirely), it is sufficient to raise *note ModuleNotFoundError: 981.\ndirectly from *note findspec(): 666. instead of returning 'None'.  The\nlatter indicates that the meta path search should continue, while\nraising an exception terminates it immediately.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Package Relative Imports,  Next: Special considerations for main,  Prev: Replacing the standard import system,  Up: The import system": {
            "content": "",
            "subsections": []
        },
        "Relative imports use leading dots.  A single leading dot indicates a": {
            "content": "relative import, starting with the current package.  Two or more leading\ndots indicate a relative import to the parent(s) of the current package,\none level per dot after the first.  For example, given the following\npackage layout:\n\npackage/\ninit.py\nsubpackage1/\ninit.py\nmoduleX.py\nmoduleY.py\nsubpackage2/\ninit.py\nmoduleZ.py\nmoduleA.py\n",
            "subsections": []
        },
        "In either 'subpackage1/moduleX.py' or 'subpackage1/init.py', the": {
            "content": "following are valid relative imports:\n\nfrom .moduleY import spam\nfrom .moduleY import spam as ham\nfrom . import moduleY\nfrom ..subpackage1 import moduleY\nfrom ..subpackage2.moduleZ import eggs\nfrom ..moduleA import foo\n\nAbsolute imports may use either the 'import <>' or 'from <> import <>'\nsyntax, but relative imports may only use the second form; the reason\nfor this is that:\n\nimport XXX.YYY.ZZZ\n\nshould expose 'XXX.YYY.ZZZ' as a usable expression, but .moduleY is not\na valid expression.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Special considerations for main,  Next: References,  Prev: Package Relative Imports,  Up: The import system": {
            "content": "The *note main: 1. module is a special case relative to Python's\nimport system.  As noted *note elsewhere: 1d0b, the 'main' module is\ndirectly initialized at interpreter startup, much like *note sys: d3.\nand *note builtins: 10.  However, unlike those two, it doesn't strictly\nqualify as a built-in module.  This is because the manner in which\n'main' is initialized depends on the flags and other options with\nwhich the interpreter is invoked.\n\n* Menu:\n\n* main.spec: main spec.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: main spec,  Up: Special considerations for main": {
            "content": "4.5.8.1 main.spec\n.........................\n\nDepending on how *note main: 1. is initialized, 'main.spec'\ngets set appropriately or to 'None'.\n\nWhen Python is started with the *note -m: 3a5. option, 'spec' is set\nto the module spec of the corresponding module or package.  'spec'\nis also populated when the 'main' module is loaded as part of\nexecuting a directory, zipfile or other *note sys.path: 32c. entry.\n\nIn *note the remaining cases: 1aac. 'main.spec' is set to\n'None', as the code used to populate the *note main: 1. does not\ncorrespond directly with an importable module:\n\n- interactive prompt\n\n- *note -c: 3a4. option\n\n- running from stdin\n\n- running directly from a source or bytecode file\n",
            "subsections": []
        },
        "Note that 'main.spec' is always 'None' in the last case, 'even": {
            "content": "if' the file could technically be imported directly as a module instead.\nUse the *note -m: 3a5. switch if valid module metadata is desired in\n*note main: 1.\n",
            "subsections": []
        },
        "Note also that even when 'main' corresponds with an importable": {
            "content": "module and 'main.spec' is set accordingly, they're still\nconsidered 'distinct' modules.  This is due to the fact that blocks\nguarded by 'if name == \"main\":' checks only execute when the\nmodule is used to populate the 'main' namespace, and not during\nnormal import.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: References,  Prev: Special considerations for main,  Up: The import system": {
            "content": "The import machinery has evolved considerably since Python's early days.",
            "subsections": []
        },
        "The original specification for packages(1) is still available to read,": {
            "content": "although some details have changed since the writing of that document.\n\nThe original specification for *note sys.metapath: b80. was PEP 302(2),\nwith subsequent extension in PEP 420(3).\n\nPEP 420(4) introduced *note namespace packages: 19ed. for Python 3.3.\nPEP 420(5) also introduced the 'findloader()' protocol as an\nalternative to 'findmodule()'.\n\nPEP 366(6) describes the addition of the 'package' attribute for\nexplicit relative imports in main modules.\n\nPEP 328(7) introduced absolute and explicit relative imports and\ninitially proposed 'name' for semantics PEP 366(8) would eventually\nspecify for 'package'.\n\nPEP 338(9) defines executing modules as scripts.\n\nPEP 451(10) adds the encapsulation of per-module import state in spec\nobjects.  It also off-loads most of the boilerplate responsibilities of\nloaders back onto the import machinery.  These changes allow the\ndeprecation of several APIs in the import system and also addition of\nnew methods to finders and loaders.\n\n---------- Footnotes ----------\n\n(1) https://www.python.org/doc/essays/packages/\n\n(2) https://peps.python.org/pep-0302/\n\n(3) https://peps.python.org/pep-0420/\n\n(4) https://peps.python.org/pep-0420/\n\n(5) https://peps.python.org/pep-0420/\n\n(6) https://peps.python.org/pep-0366/\n\n(7) https://peps.python.org/pep-0328/\n\n(8) https://peps.python.org/pep-0366/\n\n(9) https://peps.python.org/pep-0338/\n\n(10) https://peps.python.org/pep-0451/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Expressions,  Next: Simple statements,  Prev: The import system,  Up: The Python Language Reference": {
            "content": "",
            "subsections": [
                {
                    "name": "4.6 Expressions",
                    "content": ""
                }
            ]
        },
        "This chapter explains the meaning of the elements of expressions in": {
            "content": "Python.\n\n'Syntax Notes:' In this and the following chapters, extended BNF\nnotation will be used to describe syntax, not lexical analysis.  When\n(one alternative of) a syntax rule has the form\n\nname ::= othername\n\nand no semantics are given, the semantics of this form of 'name' are the\nsame as for 'othername'.\n\n* Menu:\n\n* Arithmetic conversions::\n* Atoms::\n* Primaries::\n* Await expression::\n* The power operator::\n* Unary arithmetic and bitwise operations::\n* Binary arithmetic operations::\n* Shifting operations::\n* Binary bitwise operations::\n* Comparisons::\n* Boolean operations::\n* Assignment expressions: Assignment expressions<2>.\n* Conditional expressions::\n* Lambdas::\n* Expression lists::\n* Evaluation order::\n* Operator precedence::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Arithmetic conversions,  Next: Atoms,  Up: Expressions": {
            "content": "When a description of an arithmetic operator below uses the phrase \"the\nnumeric arguments are converted to a common type\", this means that the\noperator implementation for built-in types works as follows:\n\n* If either argument is a complex number, the other is converted to\ncomplex;\n\n* otherwise, if either argument is a floating point number, the other\nis converted to floating point;\n\n* otherwise, both must be integers and no conversion is necessary.\n",
            "subsections": []
        },
        "Some additional rules apply for certain operators (e.g., a string as a": {
            "content": "left argument to the '%' operator).  Extensions must define their own\nconversion behavior.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Atoms,  Next: Primaries,  Prev: Arithmetic conversions,  Up: Expressions": {
            "content": "",
            "subsections": []
        },
        "Atoms are the most basic elements of expressions.  The simplest atoms": {
            "content": "are identifiers or literals.  Forms enclosed in parentheses, brackets or\nbraces are also categorized syntactically as atoms.  The syntax for\natoms is:\n\natom      ::= identifier | literal | enclosure\nenclosure ::= parenthform | listdisplay | dictdisplay | setdisplay\n| generatorexpression | yieldatom\n\n* Menu:\n\n* Identifiers (Names): Identifiers Names.\n* Literals: Literals<2>.\n* Parenthesized forms::\n* Displays for lists, sets and dictionaries: Displays for lists sets and dictionaries.\n* List displays::\n* Set displays::\n* Dictionary displays::\n* Generator expressions::\n* Yield expressions::\n\nFile: python3.12.info,  Node: Identifiers Names,  Next: Literals<2>,  Up: Atoms\n\n4.6.2.1 Identifiers (Names)\n...........................\n\nAn identifier occurring as an atom is a name.  See section *note\nIdentifiers and keywords: 1bb5. for lexical definition and section *note\nNaming and binding: 1c19. for documentation of naming and binding.\n",
            "subsections": []
        },
        "When the name is bound to an object, evaluation of the atom yields that": {
            "content": "object.  When a name is not bound, an attempt to evaluate it raises a\n*note NameError: 144. exception.\n\n'Private name mangling:' When an identifier that textually occurs in a\nclass definition begins with two or more underscore characters and does\nnot end in two or more underscores, it is considered a 'private name' of\nthat class.  Private names are transformed to a longer form before code\nis generated for them.  The transformation inserts the class name, with\nleading underscores removed and a single underscore inserted, in front\nof the name.  For example, the identifier 'spam' occurring in a class\nnamed 'Ham' will be transformed to 'Hamspam'.  This transformation is\nindependent of the syntactical context in which the identifier is used.",
            "subsections": []
        },
        "If the transformed name is extremely long (longer than 255 characters),": {
            "content": "implementation defined truncation may happen.  If the class name\nconsists only of underscores, no transformation is done.\n\nFile: python3.12.info,  Node: Literals<2>,  Next: Parenthesized forms,  Prev: Identifiers Names,  Up: Atoms\n\n4.6.2.2 Literals\n................\n\nPython supports string and bytes literals and various numeric literals:\n\nliteral ::= stringliteral | bytesliteral\n| integer | floatnumber | imagnumber\n",
            "subsections": []
        },
        "Evaluation of a literal yields an object of the given type (string,": {
            "content": "bytes, integer, floating point number, complex number) with the given\nvalue.  The value may be approximated in the case of floating point and\nimaginary (complex) literals.  See section *note Literals: 1bc3. for\ndetails.\n",
            "subsections": []
        },
        "All literals correspond to immutable data types, and hence the object's": {
            "content": "identity is less important than its value.  Multiple evaluations of\nliterals with the same value (either the same occurrence in the program\ntext or a different occurrence) may obtain the same object or a\ndifferent object with the same value.\n\nFile: python3.12.info,  Node: Parenthesized forms,  Next: Displays for lists sets and dictionaries,  Prev: Literals<2>,  Up: Atoms\n\n4.6.2.3 Parenthesized forms\n...........................\n\nA parenthesized form is an optional expression list enclosed in\nparentheses:\n\nparenthform ::= \"(\" [starredexpression] \")\"\n\nA parenthesized expression list yields whatever that expression list\nyields: if the list contains at least one comma, it yields a tuple;\notherwise, it yields the single expression that makes up the expression\nlist.\n",
            "subsections": []
        },
        "An empty pair of parentheses yields an empty tuple object.  Since tuples": {
            "content": "are immutable, the same rules as for literals apply (i.e., two\noccurrences of the empty tuple may or may not yield the same object).\n",
            "subsections": []
        },
        "Note that tuples are not formed by the parentheses, but rather by use of": {
            "content": "the comma.  The exception is the empty tuple, for which parentheses\n'are' required -- allowing unparenthesized \"nothing\" in expressions would\ncause ambiguities and allow common typos to pass uncaught.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Displays for lists sets and dictionaries,  Next: List displays,  Prev: Parenthesized forms,  Up: Atoms": {
            "content": "4.6.2.4 Displays for lists, sets and dictionaries\n.................................................\n",
            "subsections": []
        },
        "For constructing a list, a set or a dictionary Python provides special": {
            "content": "syntax called \"displays\", each of them in two flavors:\n\n* either the container contents are listed explicitly, or\n\n* they are computed via a set of looping and filtering instructions,\ncalled a 'comprehension'.\n\nCommon syntax elements for comprehensions are:\n\ncomprehension ::= assignmentexpression compfor\ncompfor      ::= [\"async\"] \"for\" targetlist \"in\" ortest [compiter]\ncompiter     ::= compfor | compif\ncompif       ::= \"if\" ortest [compiter]\n",
            "subsections": []
        },
        "The comprehension consists of a single expression followed by at least": {
            "content": "one 'for' clause and zero or more 'for' or 'if' clauses.  In this case,\nthe elements of the new container are those that would be produced by\nconsidering each of the 'for' or 'if' clauses a block, nesting from left\nto right, and evaluating the expression to produce an element each time\nthe innermost block is reached.\n",
            "subsections": []
        },
        "However, aside from the iterable expression in the leftmost 'for'": {
            "content": "clause, the comprehension is executed in a separate implicitly nested\nscope.  This ensures that names assigned to in the target list don't\n\"leak\" into the enclosing scope.\n",
            "subsections": []
        },
        "The iterable expression in the leftmost 'for' clause is evaluated": {
            "content": "directly in the enclosing scope and then passed as an argument to the\nimplicitly nested scope.  Subsequent 'for' clauses and any filter\ncondition in the leftmost 'for' clause cannot be evaluated in the\nenclosing scope as they may depend on the values obtained from the\nleftmost iterable.  For example: '[x*y for x in range(10) for y in\nrange(x, x+10)]'.\n",
            "subsections": []
        },
        "To ensure the comprehension always results in a container of the": {
            "content": "appropriate type, 'yield' and 'yield from' expressions are prohibited in\nthe implicitly nested scope.\n\nSince Python 3.6, in an *note async def: 394. function, an 'async for'\nclause may be used to iterate over a *note asynchronous iterator: bd4.\nA comprehension in an 'async def' function may consist of either a 'for'\nor 'async for' clause following the leading expression, may contain\nadditional 'for' or 'async for' clauses, and may also use *note await:\n516. expressions.  If a comprehension contains either 'async for'\nclauses or 'await' expressions or other asynchronous comprehensions it\nis called an 'asynchronous comprehension'.  An asynchronous\ncomprehension may suspend the execution of the coroutine function in\nwhich it appears.  See also PEP 530(1).\n\nNew in version 3.6: Asynchronous comprehensions were introduced.\n",
            "subsections": []
        },
        "Changed in version 3.8: 'yield' and 'yield from' prohibited in the": {
            "content": "implicitly nested scope.\n",
            "subsections": []
        },
        "Changed in version 3.11: Asynchronous comprehensions are now allowed": {
            "content": "inside comprehensions in asynchronous functions.  Outer comprehensions\nimplicitly become asynchronous.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0530/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: List displays,  Next: Set displays,  Prev: Displays for lists sets and dictionaries,  Up: Atoms": {
            "content": "4.6.2.5 List displays\n.....................\n\nA list display is a possibly empty series of expressions enclosed in\nsquare brackets:\n\nlistdisplay ::= \"[\" [starredlist | comprehension] \"]\"\n\nA list display yields a new list object, the contents being specified by\neither a list of expressions or a comprehension.  When a comma-separated\nlist of expressions is supplied, its elements are evaluated from left to\nright and placed into the list object in that order.  When a\ncomprehension is supplied, the list is constructed from the elements\nresulting from the comprehension.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Set displays,  Next: Dictionary displays,  Prev: List displays,  Up: Atoms": {
            "content": "4.6.2.6 Set displays\n....................\n\nA set display is denoted by curly braces and distinguishable from\ndictionary displays by the lack of colons separating keys and values:\n\nsetdisplay ::= \"{\" (starredlist | comprehension) \"}\"\n\nA set display yields a new mutable set object, the contents being\nspecified by either a sequence of expressions or a comprehension.  When\na comma-separated list of expressions is supplied, its elements are\nevaluated from left to right and added to the set object.  When a\ncomprehension is supplied, the set is constructed from the elements\nresulting from the comprehension.\n\nAn empty set cannot be constructed with '{}'; this literal constructs an\nempty dictionary.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Dictionary displays,  Next: Generator expressions,  Prev: Set displays,  Up: Atoms": {
            "content": "4.6.2.7 Dictionary displays\n...........................\n\nA dictionary display is a possibly empty series of dict items (key/value\npairs) enclosed in curly braces:\n\ndictdisplay       ::= \"{\" [dictitemlist | dictcomprehension] \"}\"\ndictitemlist     ::= dictitem (\",\" dictitem)* [\",\"]\ndictitem          ::= expression \":\" expression | \"\" orexpr\ndictcomprehension ::= expression \":\" expression compfor\n\nA dictionary display yields a new dictionary object.\n",
            "subsections": []
        },
        "If a comma-separated sequence of dict items is given, they are evaluated": {
            "content": "from left to right to define the entries of the dictionary: each key\nobject is used as a key into the dictionary to store the corresponding\nvalue.  This means that you can specify the same key multiple times in\nthe dict item list, and the final dictionary's value for that key will\nbe the last one given.\n\nA double asterisk '' denotes 'dictionary unpacking'.  Its operand must\nbe a *note mapping: 1030.  Each mapping item is added to the new\ndictionary.  Later values replace values already set by earlier dict\nitems and earlier dictionary unpackings.\n",
            "subsections": []
        },
        "New in version 3.5: Unpacking into dictionary displays, originally": {
            "content": "proposed by PEP 448(1).\n\nA dict comprehension, in contrast to list and set comprehensions, needs\ntwo expressions separated with a colon followed by the usual \"for\" and\n\"if\" clauses.  When the comprehension is run, the resulting key and\nvalue elements are inserted in the new dictionary in the order they are\nproduced.\n",
            "subsections": []
        },
        "Restrictions on the types of the key values are listed earlier in": {
            "content": "section *note The standard type hierarchy: 1c05.  (To summarize, the key\ntype should be *note hashable: 3db, which excludes all mutable objects.)",
            "subsections": []
        },
        "Clashes between duplicate keys are not detected; the last value": {
            "content": "(textually rightmost in the display) stored for a given key value\nprevails.\n",
            "subsections": []
        },
        "Changed in version 3.8: Prior to Python 3.8, in dict comprehensions, the": {
            "content": "evaluation order of key and value was not well-defined.  In CPython, the\nvalue was evaluated before the key.  Starting with 3.8, the key is\nevaluated before the value, as proposed by PEP 572(2).\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0448/\n\n(2) https://peps.python.org/pep-0572/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Generator expressions,  Next: Yield expressions,  Prev: Dictionary displays,  Up: Atoms": {
            "content": "4.6.2.8 Generator expressions\n.............................\n\nA generator expression is a compact generator notation in parentheses:\n\ngeneratorexpression ::= \"(\" expression compfor \")\"\n\nA generator expression yields a new generator object.  Its syntax is the\nsame as for comprehensions, except that it is enclosed in parentheses\ninstead of brackets or curly braces.\n",
            "subsections": []
        },
        "Variables used in the generator expression are evaluated lazily when the": {
            "content": "*note next(): 1a49. method is called for the generator object (in\nthe same fashion as normal generators).  However, the iterable\nexpression in the leftmost 'for' clause is immediately evaluated, so\nthat an error produced by it will be emitted at the point where the\ngenerator expression is defined, rather than at the point where the\nfirst value is retrieved.  Subsequent 'for' clauses and any filter\ncondition in the leftmost 'for' clause cannot be evaluated in the\nenclosing scope as they may depend on the values obtained from the\nleftmost iterable.  For example: '(x*y for x in range(10) for y in\nrange(x, x+10))'.\n",
            "subsections": []
        },
        "The parentheses can be omitted on calls with only one argument.  See": {
            "content": "section *note Calls: bd8. for details.\n",
            "subsections": []
        },
        "To avoid interfering with the expected operation of the generator": {
            "content": "expression itself, 'yield' and 'yield from' expressions are prohibited\nin the implicitly defined generator.\n\nIf a generator expression contains either 'async for' clauses or *note\nawait: 516. expressions it is called an 'asynchronous generator\nexpression'.  An asynchronous generator expression returns a new\nasynchronous generator object, which is an asynchronous iterator (see\n*note Asynchronous Iterators: bd5.).\n\nNew in version 3.6: Asynchronous generator expressions were introduced.\n",
            "subsections": []
        },
        "Changed in version 3.7: Prior to Python 3.7, asynchronous generator": {
            "content": "expressions could only appear in *note async def: 394. coroutines.",
            "subsections": []
        },
        "Starting with 3.7, any function can use asynchronous generator": {
            "content": "expressions.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Yield expressions,  Prev: Generator expressions,  Up: Atoms": {
            "content": "4.6.2.9 Yield expressions\n.........................\n\nyieldatom       ::= \"(\" yieldexpression \")\"\nyieldfrom       ::= \"yield\" \"from\" expression\nyieldexpression ::= \"yield\" expressionlist | yieldfrom\n\nThe yield expression is used when defining a *note generator: eda.\nfunction or an *note asynchronous generator: 1d47. function and thus can\nonly be used in the body of a function definition.  Using a yield\nexpression in a function's body causes that function to be a generator\nfunction, and using it in an *note async def: 394. function's body\ncauses that coroutine function to be an asynchronous generator function.\nFor example:\n\ndef gen():  # defines a generator function\nyield 123\n\nasync def agen(): # defines an asynchronous generator function\nyield 123\n",
            "subsections": []
        },
        "Due to their side effects on the containing scope, 'yield' expressions": {
            "content": "are not permitted as part of the implicitly defined scopes used to\nimplement comprehensions and generator expressions.\n",
            "subsections": []
        },
        "Changed in version 3.8: Yield expressions prohibited in the implicitly": {
            "content": "nested scopes used to implement comprehensions and generator\nexpressions.\n",
            "subsections": []
        },
        "Generator functions are described below, while asynchronous generator": {
            "content": "functions are described separately in section *note Asynchronous\ngenerator functions: 1d48.\n",
            "subsections": []
        },
        "When a generator function is called, it returns an iterator known as a": {
            "content": "generator.  That generator then controls the execution of the generator\nfunction.  The execution starts when one of the generator's methods is\ncalled.  At that time, the execution proceeds to the first yield\nexpression, where it is suspended again, returning the value of *note\nexpressionlist: 1d49. to the generator's caller, or 'None' if *note\nexpressionlist: 1d49. is omitted.  By suspended, we mean that all local\nstate is retained, including the current bindings of local variables,\nthe instruction pointer, the internal evaluation stack, and the state of\nany exception handling.  When the execution is resumed by calling one of\nthe generator's methods, the function can proceed exactly as if the\nyield expression were just another external call.  The value of the\nyield expression after resuming depends on the method which resumed the\nexecution.  If *note next(): 1a49. is used (typically via either a\n*note for: 24e. or the *note next(): 5cb. builtin) then the result is\n*note None: 43f.  Otherwise, if *note send(): 1cd3. is used, then the\nresult will be the value passed in to that method.\n",
            "subsections": []
        },
        "All of this makes generator functions quite similar to coroutines; they": {
            "content": "yield multiple times, they have more than one entry point and their\nexecution can be suspended.  The only difference is that a generator\nfunction cannot control where the execution should continue after it\nyields; the control is always transferred to the generator's caller.\n\nYield expressions are allowed anywhere in a *note try: 4bc. construct.",
            "subsections": []
        },
        "If the generator is not resumed before it is finalized (by reaching a": {
            "content": "zero reference count or by being garbage collected), the\ngenerator-iterator's *note close(): 1517. method will be called,\nallowing any pending *note finally: 7ee. clauses to execute.\n\nWhen 'yield from <expr>' is used, the supplied expression must be an\niterable.  The values produced by iterating that iterable are passed\ndirectly to the caller of the current generator's methods.  Any values\npassed in with *note send(): 1cd3. and any exceptions passed in with\n*note throw(): 241. are passed to the underlying iterator if it has the\nappropriate methods.  If this is not the case, then *note send(): 1cd3.\nwill raise *note AttributeError: 395. or *note TypeError: 28e, while\n*note throw(): 241. will just raise the passed in exception immediately.\n\nWhen the underlying iterator is complete, the *note value: 1cd0.\nattribute of the raised *note StopIteration: a40. instance becomes the\nvalue of the yield expression.  It can be either set explicitly when\nraising *note StopIteration: a40, or automatically when the subiterator\nis a generator (by returning a value from the subgenerator).\n\nChanged in version 3.3: Added 'yield from <expr>' to delegate control\nflow to a subiterator.\n",
            "subsections": []
        },
        "The parentheses may be omitted when the yield expression is the sole": {
            "content": "expression on the right hand side of an assignment statement.\n\nSee also\n........\n\nPEP 255(1) - Simple Generators\n\nThe proposal for adding generators and the *note yield: 7f1.\nstatement to Python.\n\nPEP 342(2) - Coroutines via Enhanced Generators\n\nThe proposal to enhance the API and syntax of generators, making\nthem usable as simple coroutines.\n\nPEP 380(3) - Syntax for Delegating to a Subgenerator\n\nThe proposal to introduce the *note yieldfrom: 1d45. syntax,\nmaking delegation to subgenerators easy.\n\nPEP 525(4) - Asynchronous Generators\n\nThe proposal that expanded on PEP 492(5) by adding generator\ncapabilities to coroutine functions.\n\n* Menu:\n\n* Generator-iterator methods::\n* Examples::\n* Asynchronous generator functions: Asynchronous generator functions<2>.\n* Asynchronous generator-iterator methods::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0255/\n\n(2) https://peps.python.org/pep-0342/\n\n(3) https://peps.python.org/pep-0380/\n\n(4) https://peps.python.org/pep-0525/\n\n(5) https://peps.python.org/pep-0492/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Generator-iterator methods,  Next: Examples,  Up: Yield expressions": {
            "content": "4.6.2.10 Generator-iterator methods\n...................................\n",
            "subsections": []
        },
        "This subsection describes the methods of a generator iterator.  They can": {
            "content": "be used to control the execution of a generator function.\n",
            "subsections": []
        },
        "Note that calling any of the generator methods below when the generator": {
            "content": "is already executing raises a *note ValueError: 183. exception.\n\n-- Method: generator.next ()\n\nStarts the execution of a generator function or resumes it at the\nlast executed yield expression.  When a generator function is\nresumed with a *note next(): 1a49. method, the current yield\nexpression always evaluates to *note None: 43f.  The execution then\ncontinues to the next yield expression, where the generator is\nsuspended again, and the value of the *note expressionlist: 1d49.\nis returned to *note next(): 1a49.'s caller.  If the generator\nexits without yielding another value, a *note StopIteration: a40.\nexception is raised.\n\nThis method is normally called implicitly, e.g.  by a *note for:\n24e. loop, or by the built-in *note next(): 5cb. function.\n\n-- Method: generator.send (value)\n\nResumes the execution and \"sends\" a value into the generator\nfunction.  The 'value' argument becomes the result of the current\nyield expression.  The *note send(): 1cd3. method returns the next\nvalue yielded by the generator, or raises *note StopIteration: a40.\nif the generator exits without yielding another value.  When *note\nsend(): 1cd3. is called to start the generator, it must be called\nwith *note None: 43f. as the argument, because there is no yield\nexpression that could receive the value.\n\n-- Method: generator.throw (value)\n\n-- Method: generator.throw (type[, value[, traceback]])\n\nRaises an exception at the point where the generator was paused,\nand returns the next value yielded by the generator function.  If\nthe generator exits without yielding another value, a *note\nStopIteration: a40. exception is raised.  If the generator function\ndoes not catch the passed-in exception, or raises a different\nexception, then that exception propagates to the caller.\n\nIn typical use, this is called with a single exception instance\nsimilar to the way the *note raise: 3b3. keyword is used.\n\nFor backwards compatibility, however, the second signature is\nsupported, following a convention from older versions of Python.\nThe 'type' argument should be an exception class, and 'value'\nshould be an exception instance.  If the 'value' is not provided,\nthe 'type' constructor is called to get an instance.  If\n'traceback' is provided, it is set on the exception, otherwise any\nexisting *note traceback: 113c. attribute stored in 'value' may\nbe cleared.\n\nChanged in version 3.12: The second signature (type[, value[,\ntraceback]]) is deprecated and may be removed in a future version\nof Python.\n\n-- Method: generator.close ()\n\nRaises a *note GeneratorExit: 121c. at the point where the\ngenerator function was paused.  If the generator function then\nexits gracefully, is already closed, or raises *note GeneratorExit:\n121c. (by not catching the exception), close returns to its caller.\nIf the generator yields a value, a *note RuntimeError: 17a. is\nraised.  If the generator raises any other exception, it is\npropagated to the caller.  *note close(): 1517. does nothing if the\ngenerator has already exited due to an exception or normal exit.\n\nFile: python3.12.info,  Node: Examples,  Next: Asynchronous generator functions<2>,  Prev: Generator-iterator methods,  Up: Yield expressions\n\n4.6.2.11 Examples\n.................\n",
            "subsections": []
        },
        "Here is a simple example that demonstrates the behavior of generators": {
            "content": "and generator functions:\n\n>>> def echo(value=None):\n...     print(\"Execution starts when 'next()' is called for the first time.\")\n...     try:\n...         while True:\n...             try:\n...                 value = (yield value)\n...             except Exception as e:\n...                 value = e\n...     finally:\n...         print(\"Don't forget to clean up when 'close()' is called.\")\n...\n>>> generator = echo(1)\n>>> print(next(generator))\nExecution starts when 'next()' is called for the first time.\n1\n>>> print(next(generator))\nNone\n>>> print(generator.send(2))\n2\n>>> generator.throw(TypeError, \"spam\")\nTypeError('spam',)\n>>> generator.close()\nDon't forget to clean up when 'close()' is called.\n\nFor examples using 'yield from', see *note PEP 380; Syntax for\nDelegating to a Subgenerator: eb2. in \"What's New in Python.\"\n\nFile: python3.12.info,  Node: Asynchronous generator functions<2>,  Next: Asynchronous generator-iterator methods,  Prev: Examples,  Up: Yield expressions\n\n4.6.2.12 Asynchronous generator functions\n.........................................\n",
            "subsections": []
        },
        "The presence of a yield expression in a function or method defined using": {
            "content": "*note async def: 394. further defines the function as an *note\nasynchronous generator: 1d47. function.\n",
            "subsections": []
        },
        "When an asynchronous generator function is called, it returns an": {
            "content": "asynchronous iterator known as an asynchronous generator object.  That\nobject then controls the execution of the generator function.  An\nasynchronous generator object is typically used in an *note async for:\n8e0. statement in a coroutine function analogously to how a generator\nobject would be used in a *note for: 24e. statement.\n\nCalling one of the asynchronous generator's methods returns an *note\nawaitable: ac3. object, and the execution starts when this object is\nawaited on.  At that time, the execution proceeds to the first yield\nexpression, where it is suspended again, returning the value of *note\nexpressionlist: 1d49. to the awaiting coroutine.  As with a generator,\nsuspension means that all local state is retained, including the current\nbindings of local variables, the instruction pointer, the internal\nevaluation stack, and the state of any exception handling.  When the\nexecution is resumed by awaiting on the next object returned by the\nasynchronous generator's methods, the function can proceed exactly as if\nthe yield expression were just another external call.  The value of the\nyield expression after resuming depends on the method which resumed the\nexecution.  If *note anext(): 1d4d. is used then the result is *note\nNone: 43f.  Otherwise, if *note asend(): 6f2. is used, then the result\nwill be the value passed in to that method.\n\nIf an asynchronous generator happens to exit early by *note break: 8de,\nthe caller task being cancelled, or other exceptions, the generator's\nasync cleanup code will run and possibly raise exceptions or access\ncontext variables in an unexpected context-perhaps after the lifetime of\ntasks it depends, or during the event loop shutdown when the\nasync-generator garbage collection hook is called.  To prevent this, the\ncaller must explicitly close the async generator by calling *note\naclose(): 6f1. method to finalize the generator and ultimately detach it\nfrom the event loop.\n",
            "subsections": []
        },
        "In an asynchronous generator function, yield expressions are allowed": {
            "content": "anywhere in a *note try: 4bc. construct.  However, if an asynchronous\ngenerator is not resumed before it is finalized (by reaching a zero\nreference count or by being garbage collected), then a yield expression\nwithin a 'try' construct could result in a failure to execute pending\n*note finally: 7ee. clauses.  In this case, it is the responsibility of\nthe event loop or scheduler running the asynchronous generator to call\nthe asynchronous generator-iterator's *note aclose(): 6f1. method and\nrun the resulting coroutine object, thus allowing any pending 'finally'\nclauses to execute.\n",
            "subsections": []
        },
        "To take care of finalization upon event loop termination, an event loop": {
            "content": "should define a 'finalizer' function which takes an asynchronous\ngenerator-iterator and presumably calls *note aclose(): 6f1. and\nexecutes the coroutine.  This 'finalizer' may be registered by calling\n*note sys.setasyncgenhooks(): 1596.  When first iterated over, an\nasynchronous generator-iterator will store the registered 'finalizer' to\nbe called upon finalization.  For a reference example of a 'finalizer'\nmethod see the implementation of 'asyncio.Loop.shutdownasyncgens' in\nLib/asyncio/baseevents.py(1).\n\nThe expression 'yield from <expr>' is a syntax error when used in an\nasynchronous generator function.\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/asyncio/baseevents.py\n\nFile: python3.12.info,  Node: Asynchronous generator-iterator methods,  Prev: Asynchronous generator functions<2>,  Up: Yield expressions\n\n4.6.2.13 Asynchronous generator-iterator methods\n................................................\n",
            "subsections": []
        },
        "This subsection describes the methods of an asynchronous generator": {
            "content": "iterator, which are used to control the execution of a generator\nfunction.\n\n-- Method: coroutine agen.anext ()\n\nReturns an awaitable which when run starts to execute the\nasynchronous generator or resumes it at the last executed yield\nexpression.  When an asynchronous generator function is resumed\nwith an *note anext(): 1d4d. method, the current yield\nexpression always evaluates to *note None: 43f. in the returned\nawaitable, which when run will continue to the next yield\nexpression.  The value of the *note expressionlist: 1d49. of the\nyield expression is the value of the *note StopIteration: a40.\nexception raised by the completing coroutine.  If the asynchronous\ngenerator exits without yielding another value, the awaitable\ninstead raises a *note StopAsyncIteration: 17a6. exception,\nsignalling that the asynchronous iteration has completed.\n\nThis method is normally called implicitly by a *note async for:\n8e0. loop.\n\n-- Method: coroutine agen.asend (value)\n\nReturns an awaitable which when run resumes the execution of the\nasynchronous generator.  As with the *note send(): 1cd3. method for\na generator, this \"sends\" a value into the asynchronous generator\nfunction, and the 'value' argument becomes the result of the\ncurrent yield expression.  The awaitable returned by the *note\nasend(): 6f2. method will return the next value yielded by the\ngenerator as the value of the raised *note StopIteration: a40, or\nraises *note StopAsyncIteration: 17a6. if the asynchronous\ngenerator exits without yielding another value.  When *note\nasend(): 6f2. is called to start the asynchronous generator, it\nmust be called with *note None: 43f. as the argument, because there\nis no yield expression that could receive the value.\n\n-- Method: coroutine agen.athrow (value)\n\n-- Method: coroutine agen.athrow (type[, value[, traceback]])\n\nReturns an awaitable that raises an exception of type 'type' at the\npoint where the asynchronous generator was paused, and returns the\nnext value yielded by the generator function as the value of the\nraised *note StopIteration: a40. exception.  If the asynchronous\ngenerator exits without yielding another value, a *note\nStopAsyncIteration: 17a6. exception is raised by the awaitable.  If\nthe generator function does not catch the passed-in exception, or\nraises a different exception, then when the awaitable is run that\nexception propagates to the caller of the awaitable.\n\nChanged in version 3.12: The second signature (type[, value[,\ntraceback]]) is deprecated and may be removed in a future version\nof Python.\n\n-- Method: coroutine agen.aclose ()\n\nReturns an awaitable that when run will throw a *note\nGeneratorExit: 121c. into the asynchronous generator function at\nthe point where it was paused.  If the asynchronous generator\nfunction then exits gracefully, is already closed, or raises *note\nGeneratorExit: 121c. (by not catching the exception), then the\nreturned awaitable will raise a *note StopIteration: a40.\nexception.  Any further awaitables returned by subsequent calls to\nthe asynchronous generator will raise a *note StopAsyncIteration:\n17a6. exception.  If the asynchronous generator yields a value, a\n*note RuntimeError: 17a. is raised by the awaitable.  If the\nasynchronous generator raises any other exception, it is propagated\nto the caller of the awaitable.  If the asynchronous generator has\nalready exited due to an exception or normal exit, then further\ncalls to *note aclose(): 6f1. will return an awaitable that does\nnothing.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Primaries,  Next: Await expression,  Prev: Atoms,  Up: Expressions": {
            "content": "Primaries represent the most tightly bound operations of the language.\nTheir syntax is:\n\nprimary ::= atom | attributeref | subscription | slicing | call\n\n* Menu:\n\n* Attribute references::\n* Subscriptions::\n* Slicings::\n* Calls::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Attribute references,  Next: Subscriptions,  Up: Primaries": {
            "content": "4.6.3.1 Attribute references\n............................\n\nAn attribute reference is a primary followed by a period and a name:\n\nattributeref ::= primary \".\" identifier\n",
            "subsections": []
        },
        "The primary must evaluate to an object of a type that supports attribute": {
            "content": "references, which most objects do.  This object is then asked to produce\nthe attribute whose name is the identifier.  The type and value produced\nis determined by the object.  Multiple evaluations of the same attribute\nreference may yield different objects.\n\nThis production can be customized by overriding the *note\ngetattribute(): a16. method or the *note getattr(): 1f8. method.",
            "subsections": []
        },
        "The 'getattribute()' method is called first and either returns a": {
            "content": "value or raises *note AttributeError: 395. if the attribute is not\navailable.\n\nIf an *note AttributeError: 395. is raised and the object has a\n'getattr()' method, that method is called as a fallback.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Subscriptions,  Next: Slicings,  Prev: Attribute references,  Up: Primaries": {
            "content": "4.6.3.2 Subscriptions\n.....................\n\nThe subscription of an instance of a *note container class: 1c92. will\ngenerally select an element from the container.  The subscription of a\n*note generic class: 13b. will generally return a *note GenericAlias:\n480. object.\n\nsubscription ::= primary \"[\" expressionlist \"]\"\n",
            "subsections": []
        },
        "When an object is subscripted, the interpreter will evaluate the primary": {
            "content": "and the expression list.\n",
            "subsections": []
        },
        "The primary must evaluate to an object that supports subscription.  An": {
            "content": "object may support subscription through defining one or both of *note\ngetitem(): 4b9. and *note classgetitem(): 520.  When the\nprimary is subscripted, the evaluated result of the expression list will\nbe passed to one of these methods.  For more details on when\n'classgetitem' is called instead of 'getitem', see *note\nclassgetitem versus getitem: 1c8b.\n",
            "subsections": []
        },
        "If the expression list contains at least one comma, it will evaluate to": {
            "content": "a *note tuple: 4b8. containing the items of the expression list.",
            "subsections": []
        },
        "Otherwise, the expression list will evaluate to the value of the list's": {
            "content": "sole member.\n",
            "subsections": []
        },
        "For built-in objects, there are two types of objects that support": {
            "content": "subscription via *note getitem(): 4b9.:\n\n1. Mappings.  If the primary is a *note mapping: 1030, the expression\nlist must evaluate to an object whose value is one of the keys of\nthe mapping, and the subscription selects the value in the mapping\nthat corresponds to that key.  An example of a builtin mapping\nclass is the *note dict: 237. class.\n\n2. Sequences.  If the primary is a *note sequence: 236, the expression\nlist must evaluate to an *note int: 17e. or a *note slice: 180. (as\ndiscussed in the following section).  Examples of builtin sequence\nclasses include the *note str: 157, *note list: 3dc. and *note\ntuple: 4b8. classes.\n",
            "subsections": []
        },
        "The formal syntax makes no special provision for negative indices in": {
            "content": "*note sequences: 236.  However, built-in sequences all provide a *note\ngetitem(): 4b9. method that interprets negative indices by adding\nthe length of the sequence to the index so that, for example, 'x[-1]'\nselects the last item of 'x'.  The resulting value must be a nonnegative\ninteger less than the number of items in the sequence, and the\nsubscription selects the item whose index is that value (counting from\nzero).  Since the support for negative indices and slicing occurs in the\nobject's *note getitem(): 4b9. method, subclasses overriding this\nmethod will need to explicitly add that support.\n\nA *note string: 157. is a special kind of sequence whose items are\n'characters'.  A character is not a separate data type but a string of\nexactly one character.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Slicings,  Next: Calls,  Prev: Subscriptions,  Up: Primaries": {
            "content": "4.6.3.3 Slicings\n................\n\nA slicing selects a range of items in a sequence object (e.g., a string,\ntuple or list).  Slicings may be used as expressions or as targets in\nassignment or *note del: 14fb. statements.  The syntax for a slicing:\n\nslicing      ::= primary \"[\" slicelist \"]\"\nslicelist   ::= sliceitem (\",\" sliceitem)* [\",\"]\nsliceitem   ::= expression | properslice\nproperslice ::= [lowerbound] \":\" [upperbound] [ \":\" [stride] ]\nlowerbound  ::= expression\nupperbound  ::= expression\nstride       ::= expression\n",
            "subsections": []
        },
        "There is ambiguity in the formal syntax here: anything that looks like": {
            "content": "an expression list also looks like a slice list, so any subscription can\nbe interpreted as a slicing.  Rather than further complicating the\nsyntax, this is disambiguated by defining that in this case the\ninterpretation as a subscription takes priority over the interpretation\nas a slicing (this is the case if the slice list contains no proper\nslice).\n",
            "subsections": []
        },
        "The semantics for a slicing are as follows.  The primary is indexed": {
            "content": "(using the same *note getitem(): 4b9. method as normal subscription)\nwith a key that is constructed from the slice list, as follows.  If the\nslice list contains at least one comma, the key is a tuple containing\nthe conversion of the slice items; otherwise, the conversion of the lone\nslice item is the key.  The conversion of a slice item that is an\nexpression is that expression.  The conversion of a proper slice is a\nslice object (see section *note The standard type hierarchy: 1c05.)\nwhose *note start: 1c5b, *note stop: 1c5c. and *note step: 1c5d.\nattributes are the values of the expressions given as lower bound, upper\nbound and stride, respectively, substituting 'None' for missing\nexpressions.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Calls,  Prev: Slicings,  Up: Primaries": {
            "content": "4.6.3.4 Calls\n.............\n\nA call calls a callable object (e.g., a *note function: 1d62.) with a\npossibly empty series of *note arguments: 154.:\n\ncall                 ::= primary \"(\" [argumentlist [\",\"] | comprehension] \")\"\nargumentlist        ::= positionalarguments [\",\" starredandkeywords]\n[\",\" keywordsarguments]\n| starredandkeywords [\",\" keywordsarguments]\n| keywordsarguments\npositionalarguments ::= positionalitem (\",\" positionalitem)*\npositionalitem      ::= assignmentexpression | \"*\" expression\nstarredandkeywords ::= (\"*\" expression | keyworditem)\n(\",\" \"*\" expression | \",\" keyworditem)*\nkeywordsarguments   ::= (keyworditem | \"\" expression)\n(\",\" keyworditem | \",\" \"\" expression)*\nkeyworditem         ::= identifier \"=\" expression\n",
            "subsections": []
        },
        "An optional trailing comma may be present after the positional and": {
            "content": "keyword arguments but does not affect the semantics.\n",
            "subsections": []
        },
        "The primary must evaluate to a callable object (user-defined functions,": {
            "content": "built-in functions, methods of built-in objects, class objects, methods\nof class instances, and all objects having a *note call(): 2b1.\nmethod are callable).  All argument expressions are evaluated before the\ncall is attempted.  Please refer to section *note Function definitions:\n19bb. for the syntax of formal *note parameter: 1c1e. lists.\n",
            "subsections": []
        },
        "If keyword arguments are present, they are first converted to positional": {
            "content": "arguments, as follows.  First, a list of unfilled slots is created for\nthe formal parameters.  If there are N positional arguments, they are\nplaced in the first N slots.  Next, for each keyword argument, the\nidentifier is used to determine the corresponding slot (if the\nidentifier is the same as the first formal parameter name, the first\nslot is used, and so on).  If the slot is already filled, a *note",
            "subsections": []
        },
        "TypeError: 28e. exception is raised.  Otherwise, the argument is placed": {
            "content": "in the slot, filling it (even if the expression is 'None', it fills the\nslot).  When all arguments have been processed, the slots that are still\nunfilled are filled with the corresponding default value from the\nfunction definition.  (Default values are calculated, once, when the\nfunction is defined; thus, a mutable object such as a list or dictionary\nused as default value will be shared by all calls that don't specify an\nargument value for the corresponding slot; this should usually be\navoided.)  If there are any unfilled slots for which no default value is\nspecified, a *note TypeError: 28e. exception is raised.  Otherwise, the\nlist of filled slots is used as the argument list for the call.\n\n'CPython implementation detail:' An implementation may provide built-in\nfunctions whose positional parameters do not have names, even if they\nare 'named' for the purpose of documentation, and which therefore cannot\nbe supplied by keyword.  In CPython, this is the case for functions\nimplemented in C that use *note PyArgParseTuple(): 2d1. to parse their\narguments.\n",
            "subsections": []
        },
        "If there are more positional arguments than there are formal parameter": {
            "content": "slots, a *note TypeError: 28e. exception is raised, unless a formal\nparameter using the syntax '*identifier' is present; in this case, that\nformal parameter receives a tuple containing the excess positional\narguments (or an empty tuple if there were no excess positional\narguments).\n",
            "subsections": []
        },
        "If any keyword argument does not correspond to a formal parameter name,": {
            "content": "a *note TypeError: 28e. exception is raised, unless a formal parameter\nusing the syntax 'identifier' is present; in this case, that formal\nparameter receives a dictionary containing the excess keyword arguments\n(using the keywords as keys and the argument values as corresponding\nvalues), or a (new) empty dictionary if there were no excess keyword\narguments.\n\nIf the syntax '*expression' appears in the function call, 'expression'\nmust evaluate to an *note iterable: 109d.  Elements from these iterables\nare treated as if they were additional positional arguments.  For the\ncall 'f(x1, x2, *y, x3, x4)', if 'y' evaluates to a sequence 'y1', ...,\n'yM', this is equivalent to a call with M+4 positional arguments 'x1',\n'x2', 'y1', ..., 'yM', 'x3', 'x4'.\n\nA consequence of this is that although the '*expression' syntax may\nappear 'after' explicit keyword arguments, it is processed 'before' the\nkeyword arguments (and any 'expression' arguments - see below).  So:\n\n>>> def f(a, b):\n...     print(a, b)\n...\n>>> f(b=1, *(2,))\n2 1\n>>> f(a=1, *(2,))\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nTypeError: f() got multiple values for keyword argument 'a'\n>>> f(1, *(2,))\n1 2\n\nIt is unusual for both keyword arguments and the '*expression' syntax to\nbe used in the same call, so in practice this confusion does not often\narise.\n",
            "subsections": []
        },
        "If the syntax 'expression' appears in the function call, 'expression'": {
            "content": "must evaluate to a *note mapping: 1030, the contents of which are\ntreated as additional keyword arguments.  If a parameter matching a key\nhas already been given a value (by an explicit keyword argument, or from\nanother unpacking), a *note TypeError: 28e. exception is raised.\n\nWhen 'expression' is used, each key in this mapping must be a string.",
            "subsections": []
        },
        "Each value from the mapping is assigned to the first formal parameter": {
            "content": "eligible for keyword assignment whose name is equal to the key.  A key\nneed not be a Python identifier (e.g.  '\"max-temp ??F\"' is acceptable,\nalthough it will not match any formal parameter that could be declared).",
            "subsections": []
        },
        "If there is no match to a formal parameter the key-value pair is": {
            "content": "collected by the '' parameter, if there is one, or if there is not, a\n*note TypeError: 28e. exception is raised.\n\nFormal parameters using the syntax '*identifier' or 'identifier'\ncannot be used as positional argument slots or as keyword argument\nnames.\n\nChanged in version 3.5: Function calls accept any number of '*' and ''\nunpackings, positional arguments may follow iterable unpackings ('*'),\nand keyword arguments may follow dictionary unpackings ('').\nOriginally proposed by PEP 448(1).\n\nA call always returns some value, possibly 'None', unless it raises an\nexception.  How this value is computed depends on the type of the\ncallable object.\n\nIf it is--\n\na user-defined function:\n\nThe code block for the function is executed, passing it the\nargument list.  The first thing the code block will do is bind the\nformal parameters to the arguments; this is described in section\n*note Function definitions: 19bb.  When the code block executes a\n*note return: 7f2. statement, this specifies the return value of\nthe function call.\n\na built-in function or method:\n\nThe result is up to the interpreter; see *note Built-in Functions:\n10d5. for the descriptions of built-in functions and methods.\n\na class object:\n\nA new instance of that class is returned.\n\na class instance method:\n\nThe corresponding user-defined function is called, with an argument\nlist that is one longer than the argument list of the call: the\ninstance becomes the first argument.\n\na class instance:\n\nThe class must define a *note call(): 2b1. method; the effect\nis then the same as if that method was called.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0448/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Await expression,  Next: The power operator,  Prev: Primaries,  Up: Expressions": {
            "content": "Suspend the execution of *note coroutine: 1ae. on an *note awaitable:\nac3. object.  Can only be used inside a *note coroutine function: bd1.\n\nawaitexpr ::= \"await\" primary\n\nNew in version 3.5.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The power operator,  Next: Unary arithmetic and bitwise operations,  Prev: Await expression,  Up: Expressions": {
            "content": "",
            "subsections": []
        },
        "The power operator binds more tightly than unary operators on its left;": {
            "content": "it binds less tightly than unary operators on its right.  The syntax is:\n\npower ::= (awaitexpr | primary) [\"\" uexpr]\n",
            "subsections": []
        },
        "Thus, in an unparenthesized sequence of power and unary operators, the": {
            "content": "operators are evaluated from right to left (this does not constrain the\nevaluation order for the operands): '-12' results in '-1'.\n\nThe power operator has the same semantics as the built-in *note pow():\n7f7. function, when called with two arguments: it yields its left\nargument raised to the power of its right argument.  The numeric\narguments are first converted to a common type, and the result is of\nthat type.\n",
            "subsections": []
        },
        "For int operands, the result has the same type as the operands unless": {
            "content": "the second argument is negative; in that case, all arguments are\nconverted to float and a float result is delivered.  For example,\n'102' returns '100', but '10-2' returns '0.01'.\n\nRaising '0.0' to a negative power results in a *note ZeroDivisionError:\n763.  Raising a negative number to a fractional power results in a *note\ncomplex: 3ad. number.  (In earlier versions it raised a *note",
            "subsections": []
        },
        "ValueError: 183.)": {
            "content": "This operation can be customized using the special *note pow(): 5c6.\nmethod.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Unary arithmetic and bitwise operations,  Next: Binary arithmetic operations,  Prev: The power operator,  Up: Expressions": {
            "content": "All unary arithmetic and bitwise operations have the same priority:\n\nuexpr ::= power | \"-\" uexpr | \"+\" uexpr | \"~\" uexpr\n",
            "subsections": []
        },
        "The unary '-' (minus) operator yields the negation of its numeric": {
            "content": "argument; the operation can be overridden with the *note neg():\n1cbc. special method.\n\nThe unary '+' (plus) operator yields its numeric argument unchanged; the\noperation can be overridden with the *note pos(): 1cbd. special\nmethod.\n\nThe unary '~' (invert) operator yields the bitwise inversion of its\ninteger argument.  The bitwise inversion of 'x' is defined as '-(x+1)'.",
            "subsections": []
        },
        "It only applies to integral numbers or to custom objects that override": {
            "content": "the *note invert(): 1cbf. special method.\n",
            "subsections": []
        },
        "In all three cases, if the argument does not have the proper type, a": {
            "content": "*note TypeError: 28e. exception is raised.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Binary arithmetic operations,  Next: Shifting operations,  Prev: Unary arithmetic and bitwise operations,  Up: Expressions": {
            "content": "The binary arithmetic operations have the conventional priority levels.",
            "subsections": []
        },
        "Note that some of these operations also apply to certain non-numeric": {
            "content": "types.  Apart from the power operator, there are only two levels, one\nfor multiplicative operators and one for additive operators:\n\nmexpr ::= uexpr | mexpr \"*\" uexpr | mexpr \"@\" mexpr |\nmexpr \"//\" uexpr | mexpr \"/\" uexpr |\nmexpr \"%\" uexpr\naexpr ::= mexpr | aexpr \"+\" mexpr | aexpr \"-\" mexpr\n\nThe '*' (multiplication) operator yields the product of its arguments.",
            "subsections": []
        },
        "The arguments must either both be numbers, or one argument must be an": {
            "content": "integer and the other must be a sequence.  In the former case, the\nnumbers are converted to a common type and then multiplied together.  In\nthe latter case, sequence repetition is performed; a negative repetition\nfactor yields an empty sequence.\n\nThis operation can be customized using the special *note mul():\n1c96. and *note rmul(): 1c97. methods.\n\nThe '@' (at) operator is intended to be used for matrix multiplication.\nNo builtin Python types implement this operator.\n\nNew in version 3.5.\n",
            "subsections": []
        },
        "The '/' (division) and '//' (floor division) operators yield the": {
            "content": "quotient of their arguments.  The numeric arguments are first converted\nto a common type.  Division of integers yields a float, while floor\ndivision of integers results in an integer; the result is that of\nmathematical division with the 'floor' function applied to the result.\nDivision by zero raises the *note ZeroDivisionError: 763. exception.\n\nThis operation can be customized using the special *note truediv():\n134d. and *note floordiv(): 134e. methods.\n\nThe '%' (modulo) operator yields the remainder from the division of the\nfirst argument by the second.  The numeric arguments are first converted\nto a common type.  A zero right argument raises the *note",
            "subsections": []
        },
        "ZeroDivisionError: 763. exception.  The arguments may be floating point": {
            "content": "numbers, e.g., '3.14%0.7' equals '0.34' (since '3.14' equals '4*0.7 +\n0.34'.)  The modulo operator always yields a result with the same sign\nas its second operand (or zero); the absolute value of the result is\nstrictly smaller than the absolute value of the second operand (1).\n",
            "subsections": []
        },
        "The floor division and modulo operators are connected by the following": {
            "content": "identity: 'x == (x//y)*y + (x%y)'.  Floor division and modulo are also\nconnected with the built-in function *note divmod(): 7c5.: 'divmod(x, y)\n== (x//y, x%y)'.  (2).\n\nIn addition to performing the modulo operation on numbers, the '%'\noperator is also overloaded by string objects to perform old-style\nstring formatting (also known as interpolation).  The syntax for string\nformatting is described in the Python Library Reference, section *note\nprintf-style String Formatting: 49c.\n\nThe 'modulo' operation can be customized using the special *note\nmod(): 1c9f. method.\n\nThe floor division operator, the modulo operator, and the *note\ndivmod(): 7c5. function are not defined for complex numbers.  Instead,\nconvert to a floating point number using the *note abs(): 1a29. function\nif appropriate.\n\nThe '+' (addition) operator yields the sum of its arguments.  The\narguments must either both be numbers or both be sequences of the same\ntype.  In the former case, the numbers are converted to a common type\nand then added together.  In the latter case, the sequences are\nconcatenated.\n\nThis operation can be customized using the special *note add():\n1c93. and *note radd(): 1c94. methods.\n\nThe '-' (subtraction) operator yields the difference of its arguments.\nThe numeric arguments are first converted to a common type.\n\nThis operation can be customized using the special *note sub():\n1c9d. method.\n\n---------- Footnotes ----------\n\n(1) While 'abs(x%y) < abs(y)' is true mathematically, for floats it\nmay not be true numerically due to roundoff.  For example, and assuming\na platform on which a Python float is an IEEE 754 double-precision\nnumber, in order that '-1e-100 % 1e100' have the same sign as '1e100',\nthe computed result is '-1e-100 + 1e100', which is numerically exactly\nequal to '1e100'.  The function *note math.fmod(): 1d76. returns a\nresult whose sign matches the sign of the first argument instead, and so\nreturns '-1e-100' in this case.  Which approach is more appropriate\ndepends on the application.\n\n(2) If x is very close to an exact integer multiple of y, it's\npossible for 'x//y' to be one larger than '(x-x%y)//y' due to rounding.",
            "subsections": []
        },
        "In such cases, Python returns the latter result, in order to preserve": {
            "content": "that 'divmod(x,y)[0] * y + x % y' be very close to 'x'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Shifting operations,  Next: Binary bitwise operations,  Prev: Binary arithmetic operations,  Up: Expressions": {
            "content": "",
            "subsections": []
        },
        "The shifting operations have lower priority than the arithmetic": {
            "content": "operations:\n\nshiftexpr ::= aexpr | shiftexpr (\"<<\" | \">>\") aexpr\n",
            "subsections": []
        },
        "These operators accept integers as arguments.  They shift the first": {
            "content": "argument to the left or right by the number of bits given by the second\nargument.\n\nThis operation can be customized using the special *note lshift():\n1ca1. and *note rshift(): 1ca2. methods.\n\nA right shift by 'n' bits is defined as floor division by 'pow(2,n)'.  A\nleft shift by 'n' bits is defined as multiplication with 'pow(2,n)'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Binary bitwise operations,  Next: Comparisons,  Prev: Shifting operations,  Up: Expressions": {
            "content": "Each of the three bitwise operations has a different priority level:\n\nandexpr ::= shiftexpr | andexpr \"&\" shiftexpr\nxorexpr ::= andexpr | xorexpr \"^\" andexpr\norexpr  ::= xorexpr | orexpr \"|\" xorexpr\n\nThe '&' operator yields the bitwise AND of its arguments, which must be\nintegers or one of them must be a custom object overriding *note\nand(): 1ca3. or *note rand(): 1cae. special methods.\n\nThe '^' operator yields the bitwise XOR (exclusive OR) of its arguments,\nwhich must be integers or one of them must be a custom object overriding\n*note xor(): 1ca4. or *note rxor(): 1caf. special methods.\n\nThe '|' operator yields the bitwise (inclusive) OR of its arguments,\nwhich must be integers or one of them must be a custom object overriding\n*note or(): 1ca5. or *note ror(): 1cb0. special methods.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Comparisons,  Next: Boolean operations,  Prev: Binary bitwise operations,  Up: Expressions": {
            "content": "",
            "subsections": []
        },
        "Unlike C, all comparison operations in Python have the same priority,": {
            "content": "which is lower than that of any arithmetic, shifting or bitwise\noperation.  Also unlike C, expressions like 'a < b < c' have the\ninterpretation that is conventional in mathematics:\n\ncomparison    ::= orexpr (compoperator orexpr)*\ncompoperator ::= \"<\" | \">\" | \"==\" | \">=\" | \"<=\" | \"!=\"\n| \"is\" [\"not\"] | [\"not\"] \"in\"\n",
            "subsections": []
        },
        "Comparisons yield boolean values: 'True' or 'False'.  Custom 'rich": {
            "content": "comparison methods' may return non-boolean values.  In this case Python\nwill call *note bool(): 17d. on such value in boolean contexts.\n\nComparisons can be chained arbitrarily, e.g., 'x < y <= z' is equivalent\nto 'x < y and y <= z', except that 'y' is evaluated only once (but in\nboth cases 'z' is not evaluated at all when 'x < y' is found to be\nfalse).\n",
            "subsections": []
        },
        "Formally, if 'a', 'b', 'c', ..., 'y', 'z' are expressions and 'op1',": {
            "content": "'op2', ..., 'opN' are comparison operators, then 'a op1 b op2 c ... y opN\nz' is equivalent to 'a op1 b and b op2 c and ... y opN z', except that\neach expression is evaluated at most once.\n",
            "subsections": []
        },
        "Note that 'a op1 b op2 c' doesn't imply any kind of comparison between": {
            "content": "'a' and 'c', so that, e.g., 'x < y > z' is perfectly legal (though\nperhaps not pretty).\n\n* Menu:\n\n* Value comparisons::\n* Membership test operations::\n* Identity comparisons::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Value comparisons,  Next: Membership test operations,  Up: Comparisons": {
            "content": "4.6.10.1 Value comparisons\n..........................\n\nThe operators '<', '>', '==', '>=', '<=', and '!=' compare the values of\ntwo objects.  The objects do not need to have the same type.\n\nChapter *note Objects, values and types: 1c02. states that objects have\na value (in addition to type and identity).  The value of an object is a\nrather abstract notion in Python: For example, there is no canonical\naccess method for an object's value.  Also, there is no requirement that\nthe value of an object should be constructed in a particular way, e.g.\ncomprised of all its data attributes.  Comparison operators implement a\nparticular notion of what the value of an object is.  One can think of\nthem as defining the value of an object indirectly, by means of their\ncomparison implementation.\n\nBecause all types are (direct or indirect) subtypes of *note object:\n8bb, they inherit the default comparison behavior from *note object:\n8bb.  Types can customize their comparison behavior by implementing\n'rich comparison methods' like *note lt(): 1180, described in *note\nBasic customization: 1c65.\n\nThe default behavior for equality comparison ('==' and '!=') is based on\nthe identity of the objects.  Hence, equality comparison of instances\nwith the same identity results in equality, and equality comparison of\ninstances with different identities results in inequality.  A motivation\nfor this default behavior is the desire that all objects should be\nreflexive (i.e.  'x is y' implies 'x == y').\n\nA default order comparison ('<', '>', '<=', and '>=') is not provided;\nan attempt raises *note TypeError: 28e.  A motivation for this default\nbehavior is the lack of a similar invariant as for equality.\n",
            "subsections": []
        },
        "The behavior of the default equality comparison, that instances with": {
            "content": "different identities are always unequal, may be in contrast to what\ntypes will need that have a sensible definition of object value and\nvalue-based equality.  Such types will need to customize their\ncomparison behavior, and in fact, a number of built-in types have done\nthat.\n",
            "subsections": []
        },
        "The following list describes the comparison behavior of the most": {
            "content": "important built-in types.\n\n* Numbers of built-in numeric types (*note Numeric Types -- int,\nfloat, complex: 197e.) and of the standard library types *note\nfractions.Fraction: 1a8. and *note decimal.Decimal: 5c3. can be\ncompared within and across their types, with the restriction that\ncomplex numbers do not support order comparison.  Within the limits\nof the types involved, they compare mathematically\n(algorithmically) correct without loss of precision.\n\nThe not-a-number values 'float('NaN')' and 'decimal.Decimal('NaN')'\nare special.  Any ordered comparison of a number to a not-a-number\nvalue is false.  A counter-intuitive implication is that\nnot-a-number values are not equal to themselves.  For example, if\n'x = float('NaN')', '3 < x', 'x < 3' and 'x == x' are all false,\nwhile 'x != x' is true.  This behavior is compliant with IEEE 754.\n\n* 'None' and *note NotImplemented: 5c5. are singletons.  PEP 8(1)\nadvises that comparisons for singletons should always be done with\n'is' or 'is not', never the equality operators.\n\n* Binary sequences (instances of *note bytes: 295. or *note\nbytearray: 294.) can be compared within and across their types.\nThey compare lexicographically using the numeric values of their\nelements.\n\n* Strings (instances of *note str: 157.) compare lexicographically\nusing the numerical Unicode code points (the result of the built-in\nfunction *note ord(): 1c10.) of their characters.  (2)\n\nStrings and binary sequences cannot be directly compared.\n\n* Sequences (instances of *note tuple: 4b8, *note list: 3dc, or *note\nrange: 761.) can be compared only within each of their types, with\nthe restriction that ranges do not support order comparison.\nEquality comparison across these types results in inequality, and\nordering comparison across these types raises *note TypeError: 28e.\n\nSequences compare lexicographically using comparison of\ncorresponding elements.  The built-in containers typically assume\nidentical objects are equal to themselves.  That lets them bypass\nequality tests for identical objects to improve performance and to\nmaintain their internal invariants.\n\nLexicographical comparison between built-in collections works as\nfollows:\n\n- For two collections to compare equal, they must be of the same\ntype, have the same length, and each pair of corresponding\nelements must compare equal (for example, '[1,2] == (1,2)' is\nfalse because the type is not the same).\n\n- Collections that support order comparison are ordered the same\nas their first unequal elements (for example, '[1,2,x] <=\n[1,2,y]' has the same value as 'x <= y').  If a corresponding\nelement does not exist, the shorter collection is ordered\nfirst (for example, '[1,2] < [1,2,3]' is true).\n\n* Mappings (instances of *note dict: 237.) compare equal if and only\nif they have equal '(key, value)' pairs.  Equality comparison of\nthe keys and values enforces reflexivity.\n\nOrder comparisons ('<', '>', '<=', and '>=') raise *note TypeError:\n28e.\n\n* Sets (instances of *note set: 39d. or *note frozenset: 39e.) can be\ncompared within and across their types.\n\nThey define order comparison operators to mean subset and superset\ntests.  Those relations do not define total orderings (for example,\nthe two sets '{1,2}' and '{2,3}' are not equal, nor subsets of one\nanother, nor supersets of one another).  Accordingly, sets are not\nappropriate arguments for functions which depend on total ordering\n(for example, *note min(): d6f, *note max(): d70, and *note\nsorted(): a12. produce undefined results given a list of sets as\ninputs).\n\nComparison of sets enforces reflexivity of its elements.\n\n* Most other built-in types have no comparison methods implemented,\nso they inherit the default comparison behavior.\n",
            "subsections": []
        },
        "User-defined classes that customize their comparison behavior should": {
            "content": "follow some consistency rules, if possible:\n\n* Equality comparison should be reflexive.  In other words, identical\nobjects should compare equal:\n\n'x is y' implies 'x == y'\n\n* Comparison should be symmetric.  In other words, the following\nexpressions should have the same result:\n\n'x == y' and 'y == x'\n\n'x != y' and 'y != x'\n\n'x < y' and 'y > x'\n\n'x <= y' and 'y >= x'\n\n* Comparison should be transitive.  The following (non-exhaustive)\nexamples illustrate that:\n\n'x > y and y > z' implies 'x > z'\n\n'x < y and y <= z' implies 'x < z'\n\n* Inverse comparison should result in the boolean negation.  In other\nwords, the following expressions should have the same result:\n\n'x == y' and 'not x != y'\n\n'x < y' and 'not x >= y' (for total ordering)\n\n'x > y' and 'not x <= y' (for total ordering)\n\nThe last two expressions apply to totally ordered collections (e.g.\nto sequences, but not to sets or mappings).  See also the *note\ntotalordering(): db2. decorator.\n\n* The *note hash(): 3b1. result should be consistent with equality.\nObjects that are equal should either have the same hash value, or\nbe marked as unhashable.\n",
            "subsections": []
        },
        "Python does not enforce these consistency rules.  In fact, the": {
            "content": "not-a-number values are an example for not following these rules.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0008/\n\n(2) The Unicode standard distinguishes between 'code points' (e.g.\nU+0041) and 'abstract characters' (e.g.  \"LATIN CAPITAL LETTER A\").",
            "subsections": []
        },
        "While most abstract characters in Unicode are only represented using one": {
            "content": "code point, there is a number of abstract characters that can in\naddition be represented using a sequence of more than one code point.\nFor example, the abstract character \"LATIN CAPITAL LETTER C WITH\nCEDILLA\" can be represented as a single 'precomposed character' at code\nposition U+00C7, or as a sequence of a 'base character' at code position\nU+0043 (LATIN CAPITAL LETTER C), followed by a 'combining character' at\ncode position U+0327 (COMBINING CEDILLA).\n",
            "subsections": []
        },
        "The comparison operators on strings compare at the level of Unicode code": {
            "content": "points.  This may be counter-intuitive to humans.  For example,\n'\"\\u00C7\" == \"\\u0043\\u0327\"' is 'False', even though both strings\nrepresent the same abstract character \"LATIN CAPITAL LETTER C WITH\nCEDILLA\".\n",
            "subsections": []
        },
        "To compare strings at the level of abstract characters (that is, in a": {
            "content": "way intuitive to humans), use *note unicodedata.normalize(): 4a4.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Membership test operations,  Next: Identity comparisons,  Prev: Value comparisons,  Up: Comparisons": {
            "content": "4.6.10.2 Membership test operations\n...................................\n\nThe operators *note in: 250. and *note not in: 3fc. test for membership.\n'x in s' evaluates to 'True' if 'x' is a member of 's', and 'False'\notherwise.  'x not in s' returns the negation of 'x in s'.  All built-in\nsequences and set types support this as well as dictionary, for which\n'in' tests whether the dictionary has a given key.  For container types\nsuch as list, tuple, set, frozenset, dict, or collections.deque, the\nexpression 'x in y' is equivalent to 'any(x is e or x == e for e in y)'.\n",
            "subsections": []
        },
        "For the string and bytes types, 'x in y' is 'True' if and only if 'x' is": {
            "content": "a substring of 'y'.  An equivalent test is 'y.find(x) != -1'.  Empty\nstrings are always considered to be a substring of any other string, so\n'\"\" in \"abc\"' will return 'True'.\n\nFor user-defined classes which define the *note contains(): 1c63.\nmethod, 'x in y' returns 'True' if 'y.contains(x)' returns a true\nvalue, and 'False' otherwise.\n\nFor user-defined classes which do not define *note contains(): 1c63.\nbut do define *note iter(): 1c61, 'x in y' is 'True' if some value\n'z', for which the expression 'x is z or x == z' is true, is produced\nwhile iterating over 'y'.  If an exception is raised during the\niteration, it is as if *note in: 250. raised that exception.\n",
            "subsections": []
        },
        "Lastly, the old-style iteration protocol is tried: if a class defines": {
            "content": "*note getitem(): 4b9, 'x in y' is 'True' if and only if there is a\nnon-negative integer index 'i' such that 'x is y[i] or x == y[i]', and\nno lower integer index raises the *note IndexError: 138f. exception.\n(If any other exception is raised, it is as if *note in: 250. raised\nthat exception).\n\nThe operator *note not in: 3fc. is defined to have the inverse truth\nvalue of *note in: 250.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Identity comparisons,  Prev: Membership test operations,  Up: Comparisons": {
            "content": "4.6.10.3 Identity comparisons\n.............................\n\nThe operators *note is: 251. and *note is not: 1d86. test for an\nobject's identity: 'x is y' is true if and only if 'x' and 'y' are the\nsame object.  An Object's identity is determined using the *note id():\n1279. function.  'x is not y' yields the inverse truth value.  (1)\n\n---------- Footnotes ----------\n\n(1) Due to automatic garbage-collection, free lists, and the dynamic\nnature of descriptors, you may notice seemingly unusual behaviour in\ncertain uses of the *note is: 251. operator, like those involving\ncomparisons between instance methods, or constants.  Check their\ndocumentation for more info.\n\nFile: python3.12.info,  Node: Boolean operations,  Next: Assignment expressions<2>,  Prev: Comparisons,  Up: Expressions\n\n\nortest  ::= andtest | ortest \"or\" andtest\nandtest ::= nottest | andtest \"and\" nottest\nnottest ::= comparison | \"not\" nottest\n",
            "subsections": []
        },
        "In the context of Boolean operations, and also when expressions are used": {
            "content": "by control flow statements, the following values are interpreted as\nfalse: 'False', 'None', numeric zero of all types, and empty strings and\ncontainers (including strings, tuples, lists, dictionaries, sets and\nfrozensets).  All other values are interpreted as true.  User-defined\nobjects can customize their truth value by providing a *note bool():\n114a. method.\n\nThe operator *note not: 1d89. yields 'True' if its argument is false,\n'False' otherwise.\n",
            "subsections": []
        },
        "The expression 'x and y' first evaluates 'x'; if 'x' is false, its value": {
            "content": "is returned; otherwise, 'y' is evaluated and the resulting value is\nreturned.\n",
            "subsections": []
        },
        "The expression 'x or y' first evaluates 'x'; if 'x' is true, its value": {
            "content": "is returned; otherwise, 'y' is evaluated and the resulting value is\nreturned.\n\nNote that neither *note and: 24c. nor *note or: 252. restrict the value\nand type they return to 'False' and 'True', but rather return the last\nevaluated argument.  This is sometimes useful, e.g., if 's' is a string\nthat should be replaced by a default value if it is empty, the\nexpression 's or 'foo'' yields the desired value.  Because *note not:\n1d89. has to create a new value, it returns a boolean value regardless\nof the type of its argument (for example, 'not 'foo'' produces 'False'\nrather than ''''.)\n\nFile: python3.12.info,  Node: Assignment expressions<2>,  Next: Conditional expressions,  Prev: Boolean operations,  Up: Expressions\n\n\nassignmentexpression ::= [identifier \":=\"] expression\n\nAn assignment expression (sometimes also called a \"named expression\" or\n\"walrus\") assigns an *note expression: 1d8e. to an *note identifier:\n1bb7, while also returning the value of the *note expression: 1d8e.\n\nOne common use case is when handling matched regular expressions:\n\nif matching := pattern.search(data):\ndosomething(matching)\n\nOr, when processing a file stream in chunks:\n\nwhile chunk := file.read(9000):\nprocess(chunk)\n",
            "subsections": []
        },
        "Assignment expressions must be surrounded by parentheses when used as": {
            "content": "expression statements and when used as sub-expressions in slicing,\nconditional, lambda, keyword-argument, and comprehension-if expressions\nand in 'assert', 'with', and 'assignment' statements.  In all other\nplaces where they can be used, parentheses are not required, including\nin 'if' and 'while' statements.\n",
            "subsections": []
        },
        "New in version 3.8: See PEP 572(1) for more details about assignment": {
            "content": "expressions.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0572/\n\nFile: python3.12.info,  Node: Conditional expressions,  Next: Lambdas,  Prev: Assignment expressions<2>,  Up: Expressions\n\n\nconditionalexpression ::= ortest [\"if\" ortest \"else\" expression]\nexpression             ::= conditionalexpression | lambdaexpr\n\nConditional expressions (sometimes called a \"ternary operator\") have the\nlowest priority of all Python operations.\n",
            "subsections": []
        },
        "The expression 'x if C else y' first evaluates the condition, 'C' rather": {
            "content": "than 'x'.  If 'C' is true, 'x' is evaluated and its value is returned;\notherwise, 'y' is evaluated and its value is returned.\n\nSee PEP 308(1) for more details about conditional expressions.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0308/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Lambdas,  Next: Expression lists,  Prev: Conditional expressions,  Up: Expressions": {
            "content": "lambdaexpr ::= \"lambda\" [parameterlist] \":\" expression\n",
            "subsections": []
        },
        "Lambda expressions (sometimes called lambda forms) are used to create": {
            "content": "anonymous functions.  The expression 'lambda parameters: expression'\nyields a function object.  The unnamed object behaves like a function\nobject defined with:\n\ndef <lambda>(parameters):\nreturn expression\n\nSee section *note Function definitions: 19bb. for the syntax of\nparameter lists.  Note that functions created with lambda expressions\ncannot contain statements or annotations.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Expression lists,  Next: Evaluation order,  Prev: Lambdas,  Up: Expressions": {
            "content": "expressionlist    ::= expression (\",\" expression)* [\",\"]\nstarredlist       ::= starreditem (\",\" starreditem)* [\",\"]\nstarredexpression ::= expression | (starreditem \",\")* [starreditem]\nstarreditem       ::= assignmentexpression | \"*\" orexpr\n",
            "subsections": []
        },
        "Except when part of a list or set display, an expression list containing": {
            "content": "at least one comma yields a tuple.  The length of the tuple is the\nnumber of expressions in the list.  The expressions are evaluated from\nleft to right.\n\nAn asterisk '*' denotes 'iterable unpacking'.  Its operand must be an\n*note iterable: 109d.  The iterable is expanded into a sequence of\nitems, which are included in the new tuple, list, or set, at the site of\nthe unpacking.\n",
            "subsections": []
        },
        "New in version 3.5: Iterable unpacking in expression lists, originally": {
            "content": "proposed by PEP 448(1).\n\nA trailing comma is required only to create a one-item tuple, such as\n'1,'; it is optional in all other cases.  A single expression without a\ntrailing comma doesn't create a tuple, but rather yields the value of\nthat expression.  (To create an empty tuple, use an empty pair of\nparentheses: '()'.)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0448/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Evaluation order,  Next: Operator precedence,  Prev: Expression lists,  Up: Expressions": {
            "content": "",
            "subsections": []
        },
        "Python evaluates expressions from left to right.  Notice that while": {
            "content": "evaluating an assignment, the right-hand side is evaluated before the\nleft-hand side.\n",
            "subsections": []
        },
        "In the following lines, expressions will be evaluated in the arithmetic": {
            "content": "order of their suffixes:\n\nexpr1, expr2, expr3, expr4\n(expr1, expr2, expr3, expr4)\n{expr1: expr2, expr3: expr4}\nexpr1 + expr2 * (expr3 - expr4)\nexpr1(expr2, expr3, *expr4, expr5)\nexpr3, expr4 = expr1, expr2\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Operator precedence,  Prev: Evaluation order,  Up: Expressions": {
            "content": "",
            "subsections": []
        },
        "The following table summarizes the operator precedence in Python, from": {
            "content": "highest precedence (most binding) to lowest precedence (least binding).",
            "subsections": []
        },
        "Operators in the same box have the same precedence.  Unless the syntax": {
            "content": "is explicitly given, operators are binary.  Operators in the same box\ngroup left to right (except for exponentiation and conditional\nexpressions, which group from right to left).\n",
            "subsections": []
        },
        "Note that comparisons, membership tests, and identity tests, all have": {
            "content": "the same precedence and have a left-to-right chaining feature as\ndescribed in the *note Comparisons: 1d7f. section.\n",
            "subsections": []
        },
        "Operator                                            Description": {
            "content": "----------------------------------------------------------------------------------------------\n\n'(expressions...)',                                 Binding or parenthesized expression,\nlist display, dictionary display, set\n'[expressions...]', '{key: value...}',              display\n'{expressions...}'\n\n'x[index]', 'x[index:index]', 'x(arguments...)',    Subscription, slicing, call, attribute\n'x.attribute'                                       reference\n\n\n*note await x: 516.                                 Await expression\n\n\n''                                                Exponentiation (1)\n\n\n'+x', '-x', '~x'                                    Positive, negative, bitwise NOT\n\n\n'*', '@', '/', '//', '%'                            Multiplication, matrix multiplication,\ndivision, floor division, remainder (2)\n\n\n'+', '-'                                            Addition and subtraction\n\n\n'<<', '>>'                                          Shifts\n\n\n'&'                                                 Bitwise AND\n\n\n'^'                                                 Bitwise XOR\n\n\n'|'                                                 Bitwise OR\n\n\n*note in: 250, *note not in: 3fc, *note is: 251,    Comparisons, including membership tests\n*note is not: 1d86, '<', '<=', '>', '>=', '!=',     and identity tests\n'=='\n\n*note not x: 1d89.                                  Boolean NOT\n\n\n*note and: 24c.                                     Boolean AND\n\n\n*note or: 252.                                      Boolean OR\n\n\n*note if: 1d90. - 'else'                            Conditional expression\n\n\n*note lambda: 1115.                                 Lambda expression\n\n\n':='                                                Assignment expression\n\n\n---------- Footnotes ----------\n\n(1) The power operator '' binds less tightly than an arithmetic or\nbitwise unary operator on its right, that is, '2-1' is '0.5'.\n\n(2) The '%' operator is also used for string formatting; the same\nprecedence applies.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Simple statements,  Next: Compound statements,  Prev: Expressions,  Up: The Python Language Reference": {
            "content": "",
            "subsections": [
                {
                    "name": "4.7 Simple statements",
                    "content": "A simple statement is comprised within a single logical line.  Several\nsimple statements may occur on a single line separated by semicolons.\nThe syntax for simple statements is:\n\nsimplestmt ::= expressionstmt\n| assertstmt\n| assignmentstmt\n| augmentedassignmentstmt\n| annotatedassignmentstmt\n| passstmt\n| delstmt\n| returnstmt\n| yieldstmt\n| raisestmt\n| breakstmt\n| continuestmt\n| importstmt\n| futurestmt\n| globalstmt\n| nonlocalstmt\n| typestmt\n\n* Menu:\n\n* Expression statements::\n* Assignment statements::\n* The assert statement::\n* The pass statement::\n* The del statement: The del statement<2>.\n* The return statement::\n* The yield statement::\n* The raise statement::\n* The break statement::\n* The continue statement::\n* The import statement::\n* The global statement::\n* The nonlocal statement::\n* The type statement::\n"
                }
            ]
        },
        "File: python3.12.info,  Node: Expression statements,  Next: Assignment statements,  Up: Simple statements": {
            "content": "",
            "subsections": []
        },
        "Expression statements are used (mostly interactively) to compute and": {
            "content": "write a value, or (usually) to call a procedure (a function that returns\nno meaningful result; in Python, procedures return the value 'None').\nOther uses of expression statements are allowed and occasionally useful.\nThe syntax for an expression statement is:\n\nexpressionstmt ::= starredexpression\n",
            "subsections": []
        },
        "An expression statement evaluates the expression list (which may be a": {
            "content": "single expression).\n",
            "subsections": []
        },
        "In interactive mode, if the value is not 'None', it is converted to a": {
            "content": "string using the built-in *note repr(): 5f0. function and the resulting\nstring is written to standard output on a line by itself (except if the\nresult is 'None', so that procedure calls do not cause any output.)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Assignment statements,  Next: The assert statement,  Prev: Expression statements,  Up: Simple statements": {
            "content": "",
            "subsections": []
        },
        "Assignment statements are used to (re)bind names to values and to modify": {
            "content": "attributes or items of mutable objects:\n\nassignmentstmt ::= (targetlist \"=\")+ (starredexpression | yieldexpression)\ntargetlist     ::= target (\",\" target)* [\",\"]\ntarget          ::= identifier\n| \"(\" [targetlist] \")\"\n| \"[\" [targetlist] \"]\"\n| attributeref\n| subscription\n| slicing\n| \"*\" target\n\n(See section *note Primaries: 1d51. for the syntax definitions for\n'attributeref', 'subscription', and 'slicing'.)\n",
            "subsections": []
        },
        "An assignment statement evaluates the expression list (remember that": {
            "content": "this can be a single expression or a comma-separated list, the latter\nyielding a tuple) and assigns the single resulting object to each of the\ntarget lists, from left to right.\n",
            "subsections": []
        },
        "Assignment is defined recursively depending on the form of the target": {
            "content": "(list).  When a target is part of a mutable object (an attribute\nreference, subscription or slicing), the mutable object must ultimately\nperform the assignment and decide about its validity, and may raise an\nexception if the assignment is unacceptable.  The rules observed by\nvarious types and the exceptions raised are given with the definition of\nthe object types (see section *note The standard type hierarchy: 1c05.).\n",
            "subsections": []
        },
        "Assignment of an object to a target list, optionally enclosed in": {
            "content": "parentheses or square brackets, is recursively defined as follows.\n\n* If the target list is a single target with no trailing comma,\noptionally in parentheses, the object is assigned to that target.\n\n* Else:\n\n* If the target list contains one target prefixed with an\nasterisk, called a \"starred\" target: The object must be an\niterable with at least as many items as there are targets in\nthe target list, minus one.  The first items of the iterable\nare assigned, from left to right, to the targets before the\nstarred target.  The final items of the iterable are assigned\nto the targets after the starred target.  A list of the\nremaining items in the iterable is then assigned to the\nstarred target (the list can be empty).\n\n* Else: The object must be an iterable with the same number of\nitems as there are targets in the target list, and the items\nare assigned, from left to right, to the corresponding\ntargets.\n",
            "subsections": []
        },
        "Assignment of an object to a single target is recursively defined as": {
            "content": "follows.\n\n* If the target is an identifier (name):\n\n* If the name does not occur in a *note global: 19a3. or *note\nnonlocal: 111f. statement in the current code block: the name\nis bound to the object in the current local namespace.\n\n* Otherwise: the name is bound to the object in the global\nnamespace or the outer namespace determined by *note nonlocal:\n111f, respectively.\n\nThe name is rebound if it was already bound.  This may cause the\nreference count for the object previously bound to the name to\nreach zero, causing the object to be deallocated and its destructor\n(if it has one) to be called.\n\n* If the target is an attribute reference: The primary expression in\nthe reference is evaluated.  It should yield an object with\nassignable attributes; if this is not the case, *note TypeError:\n28e. is raised.  That object is then asked to assign the assigned\nobject to the given attribute; if it cannot perform the assignment,\nit raises an exception (usually but not necessarily *note\nAttributeError: 395.).  Note: If the object is a class instance and\nthe attribute reference occurs on both sides of the assignment\noperator, the right-hand side expression, 'a.x' can access either\nan instance attribute or (if no instance attribute exists) a class\nattribute.  The left-hand side target 'a.x' is always set as an\ninstance attribute, creating it if necessary.  Thus, the two\noccurrences of 'a.x' do not necessarily refer to the same\nattribute: if the right-hand side expression refers to a class\nattribute, the left-hand side creates a new instance attribute as\nthe target of the assignment:\n\nclass Cls:\nx = 3             # class variable\ninst = Cls()\ninst.x = inst.x + 1   # writes inst.x as 4 leaving Cls.x as 3\n\nThis description does not necessarily apply to descriptor\nattributes, such as properties created with *note property(): 3f6.\n\n* If the target is a subscription: The primary expression in the\nreference is evaluated.  It should yield either a mutable sequence\nobject (such as a list) or a mapping object (such as a dictionary).\nNext, the subscript expression is evaluated.\n\nIf the primary is a mutable sequence object (such as a list), the\nsubscript must yield an integer.  If it is negative, the sequence's\nlength is added to it.  The resulting value must be a nonnegative\ninteger less than the sequence's length, and the sequence is asked\nto assign the assigned object to its item with that index.  If the\nindex is out of range, *note IndexError: 138f. is raised\n(assignment to a subscripted sequence cannot add new items to a\nlist).\n\nIf the primary is a mapping object (such as a dictionary), the\nsubscript must have a type compatible with the mapping's key type,\nand the mapping is then asked to create a key/value pair which maps\nthe subscript to the assigned object.  This can either replace an\nexisting key/value pair with the same key value, or insert a new\nkey/value pair (if no key with the same value existed).\n\nFor user-defined objects, the *note setitem(): 1320. method is\ncalled with appropriate arguments.\n\n* If the target is a slicing: The primary expression in the reference\nis evaluated.  It should yield a mutable sequence object (such as a\nlist).  The assigned object should be a sequence object of the same\ntype.  Next, the lower and upper bound expressions are evaluated,\ninsofar they are present; defaults are zero and the sequence's\nlength.  The bounds should evaluate to integers.  If either bound\nis negative, the sequence's length is added to it.  The resulting\nbounds are clipped to lie between zero and the sequence's length,\ninclusive.  Finally, the sequence object is asked to replace the\nslice with the items of the assigned sequence.  The length of the\nslice may be different from the length of the assigned sequence,\nthus changing the length of the target sequence, if the target\nsequence allows it.\n\n'CPython implementation detail:' In the current implementation, the\nsyntax for targets is taken to be the same as for expressions, and\ninvalid syntax is rejected during the code generation phase, causing\nless detailed error messages.\n",
            "subsections": []
        },
        "Although the definition of assignment implies that overlaps between the": {
            "content": "left-hand side and the right-hand side are 'simultaneous' (for example\n'a, b = b, a' swaps two variables), overlaps 'within' the collection of\nassigned-to variables occur left-to-right, sometimes resulting in\nconfusion.  For instance, the following program prints '[0, 2]':\n\nx = [0, 1]\ni = 0\ni, x[i] = 1, 2         # i is updated, then x[i] is updated\nprint(x)\n\nSee also\n........\n\nPEP 3132(1) - Extended Iterable Unpacking\n\nThe specification for the '*target' feature.\n\n* Menu:\n\n* Augmented assignment statements::\n* Annotated assignment statements::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3132/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Augmented assignment statements,  Next: Annotated assignment statements,  Up: Assignment statements": {
            "content": "4.7.2.1 Augmented assignment statements\n.......................................\n",
            "subsections": []
        },
        "Augmented assignment is the combination, in a single statement, of a": {
            "content": "binary operation and an assignment statement:\n\naugmentedassignmentstmt ::= augtarget augop (expressionlist | yieldexpression)\naugtarget                 ::= identifier | attributeref | subscription | slicing\naugop                     ::= \"+=\" | \"-=\" | \"*=\" | \"@=\" | \"/=\" | \"//=\" | \"%=\" | \"=\"\n| \">>=\" | \"<<=\" | \"&=\" | \"^=\" | \"|=\"\n\n(See section *note Primaries: 1d51. for the syntax definitions of the\nlast three symbols.)\n",
            "subsections": []
        },
        "An augmented assignment evaluates the target (which, unlike normal": {
            "content": "assignment statements, cannot be an unpacking) and the expression list,\nperforms the binary operation specific to the type of assignment on the\ntwo operands, and assigns the result to the original target.  The target\nis only evaluated once.\n\nAn augmented assignment expression like 'x += 1' can be rewritten as 'x\n= x + 1' to achieve a similar, but not exactly equal effect.  In the\naugmented version, 'x' is only evaluated once.  Also, when possible, the\nactual operation is performed 'in-place', meaning that rather than\ncreating a new object and assigning that to the target, the old object\nis modified instead.\n",
            "subsections": []
        },
        "Unlike normal assignments, augmented assignments evaluate the left-hand": {
            "content": "side 'before' evaluating the right-hand side.  For example, 'a[i] +=\nf(x)' first looks-up 'a[i]', then it evaluates 'f(x)' and performs the\naddition, and lastly, it writes the result back to 'a[i]'.\n",
            "subsections": []
        },
        "With the exception of assigning to tuples and multiple targets in a": {
            "content": "single statement, the assignment done by augmented assignment statements\nis handled the same way as normal assignments.  Similarly, with the\nexception of the possible 'in-place' behavior, the binary operation\nperformed by augmented assignment is the same as the normal binary\noperations.\n\nFor targets which are attribute references, the same *note caveat about\nclass and instance attributes: 1da8. applies as for regular assignments.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Annotated assignment statements,  Prev: Augmented assignment statements,  Up: Assignment statements": {
            "content": "4.7.2.2 Annotated assignment statements\n.......................................\n\n*note Annotation: bb0. assignment is the combination, in a single\nstatement, of a variable or attribute annotation and an optional\nassignment statement:\n\nannotatedassignmentstmt ::= augtarget \":\" expression\n[\"=\" (starredexpression | yieldexpression)]\n\nThe difference from normal *note Assignment statements: 1ce1. is that\nonly a single target is allowed.\n",
            "subsections": []
        },
        "For simple names as assignment targets, if in class or module scope, the": {
            "content": "annotations are evaluated and stored in a special class or module\nattribute 'annotations' that is a dictionary mapping from variable\nnames (mangled if private) to evaluated annotations.  This attribute is\nwritable and is automatically created at the start of class or module\nbody execution, if annotations are found statically.\n",
            "subsections": []
        },
        "For expressions as assignment targets, the annotations are evaluated if": {
            "content": "in class or module scope, but not stored.\n",
            "subsections": []
        },
        "If a name is annotated in a function scope, then this name is local for": {
            "content": "that scope.  Annotations are never evaluated and stored in function\nscopes.\n",
            "subsections": []
        },
        "If the right hand side is present, an annotated assignment performs the": {
            "content": "actual assignment before evaluating annotations (where applicable).  If\nthe right hand side is not present for an expression target, then the\ninterpreter evaluates the target except for the last *note\nsetitem(): 1320. or *note setattr(): 1c35. call.\n\nSee also\n........\n\nPEP 526(1) - Syntax for Variable Annotations\n\nThe proposal that added syntax for annotating the types of\nvariables (including class variables and instance variables),\ninstead of expressing them through comments.\n\nPEP 484(2) - Type hints\n\nThe proposal that added the *note typing: ff. module to provide a\nstandard syntax for type annotations that can be used in static\nanalysis tools and IDEs.\n",
            "subsections": []
        },
        "Changed in version 3.8: Now annotated assignments allow the same": {
            "content": "expressions in the right hand side as regular assignments.  Previously,\nsome expressions (like un-parenthesized tuple expressions) caused a\nsyntax error.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0526/\n\n(2) https://peps.python.org/pep-0484/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The assert statement,  Next: The pass statement,  Prev: Assignment statements,  Up: Simple statements": {
            "content": "",
            "subsections": []
        },
        "Assert statements are a convenient way to insert debugging assertions": {
            "content": "into a program:\n\nassertstmt ::= \"assert\" expression [\",\" expression]\n",
            "subsections": []
        },
        "The simple form, 'assert expression', is equivalent to": {
            "content": "if debug:\nif not expression: raise AssertionError\n",
            "subsections": []
        },
        "The extended form, 'assert expression1, expression2', is equivalent to": {
            "content": "if debug:\nif not expression1: raise AssertionError(expression2)\n\nThese equivalences assume that *note debug: 5ce. and *note\nAssertionError: 476. refer to the built-in variables with those names.\nIn the current implementation, the built-in variable *note debug:\n5ce. is 'True' under normal circumstances, 'False' when optimization is\nrequested (command line option *note -O: c11.).  The current code\ngenerator emits no code for an assert statement when optimization is\nrequested at compile time.  Note that it is unnecessary to include the\nsource code for the expression that failed in the error message; it will\nbe displayed as part of the stack trace.\n\nAssignments to *note debug: 5ce. are illegal.  The value for the\nbuilt-in variable is determined when the interpreter starts.\n\nFile: python3.12.info,  Node: The pass statement,  Next: The del statement<2>,  Prev: The assert statement,  Up: Simple statements\n\n\npassstmt ::= \"pass\"\n\n*note pass: 199e. is a null operation -- when it is executed, nothing\nhappens.  It is useful as a placeholder when a statement is required\nsyntactically, but no code needs to be executed, for example:\n\ndef f(arg): pass    # a function that does nothing (yet)\n\nclass C: pass       # a class with no methods (yet)\n\nFile: python3.12.info,  Node: The del statement<2>,  Next: The return statement,  Prev: The pass statement,  Up: Simple statements\n\n\ndelstmt ::= \"del\" targetlist\n",
            "subsections": []
        },
        "Deletion is recursively defined very similar to the way assignment is": {
            "content": "defined.  Rather than spelling it out in full details, here are some\nhints.\n",
            "subsections": []
        },
        "Deletion of a target list recursively deletes each target, from left to": {
            "content": "right.\n",
            "subsections": []
        },
        "Deletion of a name removes the binding of that name from the local or": {
            "content": "global namespace, depending on whether the name occurs in a *note\nglobal: 19a3. statement in the same code block.  If the name is unbound,\na *note NameError: 144. exception will be raised.\n",
            "subsections": []
        },
        "Deletion of attribute references, subscriptions and slicings is passed": {
            "content": "to the primary object involved; deletion of a slicing is in general\nequivalent to assignment of an empty slice of the right type (but even\nthis is determined by the sliced object).\n",
            "subsections": []
        },
        "Changed in version 3.2: Previously it was illegal to delete a name from": {
            "content": "the local namespace if it occurs as a free variable in a nested block.\n\nFile: python3.12.info,  Node: The return statement,  Next: The yield statement,  Prev: The del statement<2>,  Up: Simple statements\n\n\nreturnstmt ::= \"return\" [expressionlist]\n\n*note return: 7f2. may only occur syntactically nested in a function\ndefinition, not within a nested class definition.\n",
            "subsections": []
        },
        "If an expression list is present, it is evaluated, else 'None' is": {
            "content": "substituted.\n\n*note return: 7f2. leaves the current function call with the expression\nlist (or 'None') as return value.\n\nWhen *note return: 7f2. passes control out of a *note try: 4bc.\nstatement with a *note finally: 7ee. clause, that 'finally' clause is\nexecuted before really leaving the function.\n\nIn a generator function, the *note return: 7f2. statement indicates that\nthe generator is done and will cause *note StopIteration: a40. to be\nraised.  The returned value (if any) is used as an argument to construct\n*note StopIteration: a40. and becomes the *note StopIteration.value:\n1cd0. attribute.\n\nIn an asynchronous generator function, an empty *note return: 7f2.\nstatement indicates that the asynchronous generator is done and will\ncause *note StopAsyncIteration: 17a6. to be raised.  A non-empty\n'return' statement is a syntax error in an asynchronous generator\nfunction.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The yield statement,  Next: The raise statement,  Prev: The return statement,  Up: Simple statements": {
            "content": "yieldstmt ::= yieldexpression\n\nA *note yield: 7f1. statement is semantically equivalent to a *note\nyield expression: 1d43.  The yield statement can be used to omit the\nparentheses that would otherwise be required in the equivalent yield\nexpression statement.  For example, the yield statements\n\nyield <expr>\nyield from <expr>\n\nare equivalent to the yield expression statements\n\n(yield <expr>)\n(yield from <expr>)\n\nYield expressions and statements are only used when defining a *note\ngenerator: eda. function, and are only used in the body of the generator\nfunction.  Using yield in a function definition is sufficient to cause\nthat definition to create a generator function instead of a normal\nfunction.\n\nFor full details of *note yield: 7f1. semantics, refer to the *note\nYield expressions: 1d43. section.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The raise statement,  Next: The break statement,  Prev: The yield statement,  Up: Simple statements": {
            "content": "raisestmt ::= \"raise\" [expression [\"from\" expression]]\n\nIf no expressions are present, *note raise: 3b3. re-raises the exception\nthat is currently being handled, which is also known as the 'active\nexception'.  If there isn't currently an active exception, a *note\nRuntimeError: 17a. exception is raised indicating that this is an error.\n\nOtherwise, *note raise: 3b3. evaluates the first expression as the\nexception object.  It must be either a subclass or an instance of *note",
            "subsections": []
        },
        "BaseException: 37c.  If it is a class, the exception instance will be": {
            "content": "obtained when needed by instantiating the class with no arguments.\n",
            "subsections": []
        },
        "The 'type' of the exception is the exception instance's class, the": {
            "content": "'value' is the instance itself.\n\nA traceback object is normally created automatically when an exception\nis raised and attached to it as the *note traceback: 113c.\nattribute.  You can create an exception and set your own traceback in\none step using the *note withtraceback(): 1dbd. exception method (which\nreturns the same exception instance, with its traceback set to its\nargument), like so:\n\nraise Exception(\"foo occurred\").withtraceback(tracebackobj)\n",
            "subsections": []
        },
        "The 'from' clause is used for exception chaining: if given, the second": {
            "content": "'expression' must be another exception class or instance.  If the second\nexpression is an exception instance, it will be attached to the raised\nexception as the *note cause: 113e. attribute (which is writable).",
            "subsections": []
        },
        "If the expression is an exception class, the class will be instantiated": {
            "content": "and the resulting exception instance will be attached to the raised\nexception as the 'cause' attribute.  If the raised exception is not\nhandled, both exceptions will be printed:\n\n>>> try:\n...     print(1 / 0)\n... except Exception as exc:\n...     raise RuntimeError(\"Something bad happened\") from exc\n...\nTraceback (most recent call last):\nFile \"<stdin>\", line 2, in <module>\nprint(1 / 0)\n~~^~~\nZeroDivisionError: division by zero\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\nFile \"<stdin>\", line 4, in <module>\nraise RuntimeError(\"Something bad happened\") from exc\nRuntimeError: Something bad happened\n\nA similar mechanism works implicitly if a new exception is raised when\nan exception is already being handled.  An exception may be handled when\nan *note except: 379. or *note finally: 7ee. clause, or a *note with:\n396. statement, is used.  The previous exception is then attached as the\nnew exception's *note context: 113d. attribute:\n\n>>> try:\n...     print(1 / 0)\n... except:\n...     raise RuntimeError(\"Something bad happened\")\n...\nTraceback (most recent call last):\nFile \"<stdin>\", line 2, in <module>\nprint(1 / 0)\n~~^~~\nZeroDivisionError: division by zero\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\nFile \"<stdin>\", line 4, in <module>\nraise RuntimeError(\"Something bad happened\")\nRuntimeError: Something bad happened\n\nException chaining can be explicitly suppressed by specifying *note\nNone: 43f. in the 'from' clause:\n\n>>> try:\n...     print(1 / 0)\n... except:\n...     raise RuntimeError(\"Something bad happened\") from None\n...\nTraceback (most recent call last):\nFile \"<stdin>\", line 4, in <module>\nRuntimeError: Something bad happened\n\nAdditional information on exceptions can be found in section *note",
            "subsections": []
        },
        "Exceptions: 1cec, and information about handling exceptions is in": {
            "content": "section *note The try statement: 4bc.\n\nChanged in version 3.3: *note None: 43f. is now permitted as 'Y' in\n'raise X from Y'.\n\nAdded the *note suppresscontext: 1dbe. attribute to suppress\nautomatic display of the exception context.\n",
            "subsections": []
        },
        "Changed in version 3.11: If the traceback of the active exception is": {
            "content": "modified in an *note except: 379. clause, a subsequent 'raise' statement\nre-raises the exception with the modified traceback.  Previously, the\nexception was re-raised with the traceback it had when it was caught.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The break statement,  Next: The continue statement,  Prev: The raise statement,  Up: Simple statements": {
            "content": "breakstmt ::= \"break\"\n\n*note break: 8de. may only occur syntactically nested in a *note for:\n24e. or *note while: 198b. loop, but not nested in a function or class\ndefinition within that loop.\n",
            "subsections": []
        },
        "It terminates the nearest enclosing loop, skipping the optional 'else'": {
            "content": "clause if the loop has one.\n\nIf a *note for: 24e. loop is terminated by *note break: 8de, the loop\ncontrol target keeps its current value.\n\nWhen *note break: 8de. passes control out of a *note try: 4bc. statement\nwith a *note finally: 7ee. clause, that 'finally' clause is executed\nbefore really leaving the loop.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The continue statement,  Next: The import statement,  Prev: The break statement,  Up: Simple statements": {
            "content": "continuestmt ::= \"continue\"\n\n*note continue: 7ed. may only occur syntactically nested in a *note for:\n24e. or *note while: 198b. loop, but not nested in a function or class\ndefinition within that loop.  It continues with the next cycle of the\nnearest enclosing loop.\n\nWhen *note continue: 7ed. passes control out of a *note try: 4bc.\nstatement with a *note finally: 7ee. clause, that 'finally' clause is\nexecuted before really starting the next loop cycle.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The import statement,  Next: The global statement,  Prev: The continue statement,  Up: Simple statements": {
            "content": "importstmt     ::= \"import\" module [\"as\" identifier] (\",\" module [\"as\" identifier])*\n| \"from\" relativemodule \"import\" identifier [\"as\" identifier]\n(\",\" identifier [\"as\" identifier])*\n| \"from\" relativemodule \"import\" \"(\" identifier [\"as\" identifier]\n(\",\" identifier [\"as\" identifier])* [\",\"] \")\"\n| \"from\" relativemodule \"import\" \"*\"\nmodule          ::= (identifier \".\")* identifier\nrelativemodule ::= \".\"* module | \".\"+\n\nThe basic import statement (no *note from: 1123. clause) is executed in\ntwo steps:\n\n1. find a module, loading and initializing it if necessary\n\n2. define a name or names in the local namespace for the scope where\nthe *note import: 3a6. statement occurs.\n",
            "subsections": []
        },
        "When the statement contains multiple clauses (separated by commas) the": {
            "content": "two steps are carried out separately for each clause, just as though the\nclauses had been separated out into individual import statements.\n",
            "subsections": []
        },
        "The details of the first step, finding and loading modules, are": {
            "content": "described in greater detail in the section on the *note import system:\n1c31, which also describes the various types of packages and modules\nthat can be imported, as well as all the hooks that can be used to\ncustomize the import system.  Note that failures in this step may\nindicate either that the module could not be located, 'or' that an error\noccurred while initializing the module, which includes execution of the\nmodule's code.\n",
            "subsections": []
        },
        "If the requested module is retrieved successfully, it will be made": {
            "content": "available in the local namespace in one of three ways:\n\n* If the module name is followed by 'as', then the name following\n'as' is bound directly to the imported module.\n\n* If no other name is specified, and the module being imported is a\ntop level module, the module's name is bound in the local namespace\nas a reference to the imported module\n\n* If the module being imported is 'not' a top level module, then the\nname of the top level package that contains the module is bound in\nthe local namespace as a reference to the top level package.  The\nimported module must be accessed using its full qualified name\nrather than directly\n\nThe *note from: 1123. form uses a slightly more complex process:\n\n1. find the module specified in the *note from: 1123. clause, loading\nand initializing it if necessary;\n\n2. for each of the identifiers specified in the *note import: 3a6.\nclauses:\n\n1. check if the imported module has an attribute by that name\n\n2. if not, attempt to import a submodule with that name and then\ncheck the imported module again for that attribute\n\n3. if the attribute is not found, *note ImportError: 145. is\nraised.\n\n4. otherwise, a reference to that value is stored in the local\nnamespace, using the name in the 'as' clause if it is present,\notherwise using the attribute name\n\nExamples:\n\nimport foo                 # foo imported and bound locally\nimport foo.bar.baz         # foo, foo.bar, and foo.bar.baz imported, foo bound locally\nimport foo.bar.baz as fbb  # foo, foo.bar, and foo.bar.baz imported, foo.bar.baz bound as fbb\nfrom foo.bar import baz    # foo, foo.bar, and foo.bar.baz imported, foo.bar.baz bound as baz\nfrom foo import attr       # foo imported and foo.attr bound as attr\n\nIf the list of identifiers is replaced by a star (''*''), all public\nnames defined in the module are bound in the local namespace for the\nscope where the *note import: 3a6. statement occurs.\n",
            "subsections": []
        },
        "The 'public names' defined by a module are determined by checking the": {
            "content": "module's namespace for a variable named 'all'; if defined, it must\nbe a sequence of strings which are names defined or imported by that\nmodule.  The names given in 'all' are all considered public and are\nrequired to exist.  If 'all' is not defined, the set of public names\nincludes all names found in the module's namespace which do not begin\nwith an underscore character ('''').  'all' should contain the\nentire public API. It is intended to avoid accidentally exporting items\nthat are not part of the API (such as library modules which were\nimported and used within the module).\n\nThe wild card form of import -- 'from module import *' -- is only allowed\nat the module level.  Attempting to use it in class or function\ndefinitions will raise a *note SyntaxError: 146.\n",
            "subsections": []
        },
        "When specifying what module to import you do not have to specify the": {
            "content": "absolute name of the module.  When a module or package is contained\nwithin another package it is possible to make a relative import within\nthe same top package without having to mention the package name.  By\nusing leading dots in the specified module or package after *note from:\n1123. you can specify how high to traverse up the current package\nhierarchy without specifying exact names.  One leading dot means the\ncurrent package where the module making the import exists.  Two dots\nmeans up one package level.  Three dots is up two levels, etc.  So if\nyou execute 'from . import mod' from a module in the 'pkg' package then\nyou will end up importing 'pkg.mod'.  If you execute 'from ..subpkg2\nimport mod' from within 'pkg.subpkg1' you will import 'pkg.subpkg2.mod'.\nThe specification for relative imports is contained in the *note Package\nRelative Imports: 1d18. section.\n\n*note importlib.importmodule(): 26a. is provided to support\napplications that determine dynamically the modules to be loaded.\n\nRaises an *note auditing event: 161d. 'import' with arguments 'module',\n'filename', 'sys.path', 'sys.metapath', 'sys.pathhooks'.\n\n* Menu:\n\n* Future statements::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Future statements,  Up: The import statement": {
            "content": "4.7.11.1 Future statements\n..........................\n\nA 'future statement' is a directive to the compiler that a particular\nmodule should be compiled using syntax or semantics that will be\navailable in a specified future release of Python where the feature\nbecomes standard.\n",
            "subsections": []
        },
        "The future statement is intended to ease migration to future versions of": {
            "content": "",
            "subsections": []
        },
        "Python that introduce incompatible changes to the language.  It allows": {
            "content": "use of the new features on a per-module basis before the release in\nwhich the feature becomes standard.\n\nfuturestmt ::= \"from\" \"future\" \"import\" feature [\"as\" identifier]\n(\",\" feature [\"as\" identifier])*\n| \"from\" \"future\" \"import\" \"(\" feature [\"as\" identifier]\n(\",\" feature [\"as\" identifier])* [\",\"] \")\"\nfeature     ::= identifier\n\nA future statement must appear near the top of the module.  The only\nlines that can appear before a future statement are:\n\n* the module docstring (if any),\n\n* comments,\n\n* blank lines, and\n\n* other future statements.\n",
            "subsections": []
        },
        "The only feature that requires using the future statement is": {
            "content": "'annotations' (see PEP 563(1)).\n",
            "subsections": []
        },
        "All historical features enabled by the future statement are still": {
            "content": "recognized by Python 3.  The list includes 'absoluteimport',\n'division', 'generators', 'generatorstop', 'unicodeliterals',\n'printfunction', 'nestedscopes' and 'withstatement'.  They are all\nredundant because they are always enabled, and only kept for backwards\ncompatibility.\n\nA future statement is recognized and treated specially at compile time:",
            "subsections": []
        },
        "Changes to the semantics of core constructs are often implemented by": {
            "content": "generating different code.  It may even be the case that a new feature\nintroduces new incompatible syntax (such as a new reserved word), in\nwhich case the compiler may need to parse the module differently.  Such\ndecisions cannot be pushed off until runtime.\n",
            "subsections": []
        },
        "For any given release, the compiler knows which feature names have been": {
            "content": "defined, and raises a compile-time error if a future statement contains\na feature not known to it.\n\nThe direct runtime semantics are the same as for any import statement:\nthere is a standard module *note future: 0, described later, and it\nwill be imported in the usual way at the time the future statement is\nexecuted.\n",
            "subsections": []
        },
        "The interesting runtime semantics depend on the specific feature enabled": {
            "content": "by the future statement.\n\nNote that there is nothing special about the statement:\n\nimport future [as name]\n",
            "subsections": []
        },
        "That is not a future statement; it's an ordinary import statement with": {
            "content": "no special semantics or syntax restrictions.\n\nCode compiled by calls to the built-in functions *note exec(): 691. and\n*note compile(): 528. that occur in a module 'M' containing a future\nstatement will, by default, use the new syntax or semantics associated\nwith the future statement.  This can be controlled by optional arguments\nto *note compile(): 528. -- see the documentation of that function for\ndetails.\n\nA future statement typed at an interactive interpreter prompt will take\neffect for the rest of the interpreter session.  If an interpreter is\nstarted with the *note -i: 1336. option, is passed a script name to\nexecute, and the script includes a future statement, it will be in\neffect in the interactive session started after the script is executed.\n\nSee also\n........\n\nPEP 236(2) - Back to the future\n\nThe original proposal for the future mechanism.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0563/\n\n(2) https://peps.python.org/pep-0236/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The global statement,  Next: The nonlocal statement,  Prev: The import statement,  Up: Simple statements": {
            "content": "globalstmt ::= \"global\" identifier (\",\" identifier)*\n\nThe *note global: 19a3. statement is a declaration which holds for the\nentire current code block.  It means that the listed identifiers are to\nbe interpreted as globals.  It would be impossible to assign to a global\nvariable without 'global', although free variables may refer to globals\nwithout being declared global.\n\nNames listed in a *note global: 19a3. statement must not be used in the\nsame code block textually preceding that 'global' statement.\n\nNames listed in a *note global: 19a3. statement must not be defined as\nformal parameters, or as targets in *note with: 396. statements or *note\nexcept: 379. clauses, or in a *note for: 24e. target list, *note class:\n114c. definition, function definition, *note import: 3a6. statement, or\nvariable annotation.\n\n'CPython implementation detail:' The current implementation does not\nenforce some of these restrictions, but programs should not abuse this\nfreedom, as future implementations may enforce them or silently change\nthe meaning of the program.\n\n'Programmer's note:' *note global: 19a3. is a directive to the parser.",
            "subsections": []
        },
        "It applies only to code parsed at the same time as the 'global'": {
            "content": "statement.  In particular, a 'global' statement contained in a string or\ncode object supplied to the built-in *note exec(): 691. function does\nnot affect the code block 'containing' the function call, and code\ncontained in such a string is unaffected by 'global' statements in the\ncode containing the function call.  The same applies to the *note\neval(): 690. and *note compile(): 528. functions.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The nonlocal statement,  Next: The type statement,  Prev: The global statement,  Up: Simple statements": {
            "content": "nonlocalstmt ::= \"nonlocal\" identifier (\",\" identifier)*\n",
            "subsections": []
        },
        "When the definition of a function or class is nested (enclosed) within": {
            "content": "the definitions of other functions, its nonlocal scopes are the local\nscopes of the enclosing functions.  The *note nonlocal: 111f. statement\ncauses the listed identifiers to refer to names previously bound in\nnonlocal scopes.  It allows encapsulated code to rebind such nonlocal\nidentifiers.  If a name is bound in more than one nonlocal scope, the\nnearest binding is used.  If a name is not bound in any nonlocal scope,\nor if there is no nonlocal scope, a *note SyntaxError: 146. is raised.\n",
            "subsections": []
        },
        "The nonlocal statement applies to the entire scope of a function or": {
            "content": "class body.  A *note SyntaxError: 146. is raised if a variable is used\nor assigned to prior to its nonlocal declaration in the scope.\n\nSee also\n........\n\nPEP 3104(1) - Access to Names in Outer Scopes\n\nThe specification for the *note nonlocal: 111f. statement.\n\n'Programmer's note:' *note nonlocal: 111f. is a directive to the parser\nand applies only to code parsed along with it.  See the note for the\n*note global: 19a3. statement.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3104/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The type statement,  Prev: The nonlocal statement,  Up: Simple statements": {
            "content": "typestmt ::= 'type' identifier [typeparams] \"=\" expression\n",
            "subsections": []
        },
        "The 'type' statement declares a type alias, which is an instance of": {
            "content": "*note typing.TypeAliasType: 160.\n\nFor example, the following statement creates a type alias:\n\ntype Point = tuple[float, float]\n\nThis code is roughly equivalent to:\n\nannotation-def VALUEOFPoint():\nreturn tuple[float, float]\nPoint = typing.TypeAliasType(\"Point\", VALUEOFPoint())\n\n'annotation-def' indicates an *note annotation scope: 167, which behaves\nmostly like a function, but with several small differences.\n",
            "subsections": []
        },
        "The value of the type alias is evaluated in the annotation scope.  It is": {
            "content": "not evaluated when the type alias is created, but only when the value is\naccessed through the type alias's 'value' attribute (see *note Lazy\nevaluation: 165.).  This allows the type alias to refer to names that\nare not yet defined.\n\nType aliases may be made generic by adding a *note type parameter list:\n166. after the name.  See *note Generic type aliases: 161. for more.\n\n'type' is a *note soft keyword: 600.\n\nNew in version 3.12.\n\nSee also\n........\n\nPEP 695(1) - Type Parameter Syntax\n\nIntroduced the 'type' statement and syntax for generic classes and\nfunctions.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0695/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Compound statements,  Next: Top-level components,  Prev: Simple statements,  Up: The Python Language Reference": {
            "content": "",
            "subsections": [
                {
                    "name": "4.8 Compound statements",
                    "content": ""
                }
            ]
        },
        "Compound statements contain (groups of) other statements; they affect or": {
            "content": "control the execution of those other statements in some way.  In\ngeneral, compound statements span multiple lines, although in simple\nincarnations a whole compound statement may be contained in one line.\n\nThe *note if: 24f, *note while: 198b. and *note for: 24e. statements\nimplement traditional control flow constructs.  *note try: 4bc.\nspecifies exception handlers and/or cleanup code for a group of\nstatements, while the *note with: 396. statement allows the execution of\ninitialization and finalization code around a block of code.  Function\nand class definitions are also syntactically compound statements.\n\nA compound statement consists of one or more 'clauses.' A clause\nconsists of a header and a 'suite.' The clause headers of a particular\ncompound statement are all at the same indentation level.  Each clause\nheader begins with a uniquely identifying keyword and ends with a colon.\nA suite is a group of statements controlled by a clause.  A suite can be\none or more semicolon-separated simple statements on the same line as\nthe header, following the header's colon, or it can be one or more\nindented statements on subsequent lines.  Only the latter form of a\nsuite can contain nested compound statements; the following is illegal,\nmostly because it wouldn't be clear to which *note if: 24f. clause a\nfollowing *note else: 24d. clause would belong:\n\nif test1: if test2: print(x)\n",
            "subsections": []
        },
        "Also note that the semicolon binds tighter than the colon in this": {
            "content": "context, so that in the following example, either all or none of the\n*note print(): de5. calls are executed:\n\nif x < y < z: print(x); print(y); print(z)\n\nSummarizing:\n\ncompoundstmt ::= ifstmt\n| whilestmt\n| forstmt\n| trystmt\n| withstmt\n| matchstmt\n| funcdef\n| classdef\n| asyncwithstmt\n| asyncforstmt\n| asyncfuncdef\nsuite         ::= stmtlist NEWLINE | NEWLINE INDENT statement+ DEDENT\nstatement     ::= stmtlist NEWLINE | compoundstmt\nstmtlist     ::= simplestmt (\";\" simplestmt)* [\";\"]\n",
            "subsections": []
        },
        "Note that statements always end in a 'NEWLINE' possibly followed by a": {
            "content": "'DEDENT'.  Also note that optional continuation clauses always begin\nwith a keyword that cannot start a statement, thus there are no\nambiguities (the 'dangling *note else: 24d.' problem is solved in Python\nby requiring nested *note if: 24f. statements to be indented).\n",
            "subsections": []
        },
        "The formatting of the grammar rules in the following sections places": {
            "content": "each clause on a separate line for clarity.\n* Menu:\n\n* The if statement::\n* The while statement::\n* The for statement::\n* The try statement::\n* The with statement::\n* The match statement::\n* Function definitions::\n* Class definitions::\n* Coroutines: Coroutines<2>.\n* Type parameter lists::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The if statement,  Next: The while statement,  Up: Compound statements": {
            "content": "The *note if: 24f. statement is used for conditional execution:\n\nifstmt ::= \"if\" assignmentexpression \":\" suite\n(\"elif\" assignmentexpression \":\" suite)*\n[\"else\" \":\" suite]\n",
            "subsections": []
        },
        "It selects exactly one of the suites by evaluating the expressions one": {
            "content": "by one until one is found to be true (see section *note Boolean\noperations: 1d87. for the definition of true and false); then that suite\nis executed (and no other part of the *note if: 24f. statement is\nexecuted or evaluated).  If all expressions are false, the suite of the\n*note else: 24d. clause, if present, is executed.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The while statement,  Next: The for statement,  Prev: The if statement,  Up: Compound statements": {
            "content": "The *note while: 198b. statement is used for repeated execution as long\nas an expression is true:\n\nwhilestmt ::= \"while\" assignmentexpression \":\" suite\n[\"else\" \":\" suite]\n",
            "subsections": []
        },
        "This repeatedly tests the expression and, if it is true, executes the": {
            "content": "first suite; if the expression is false (which may be the first time it\nis tested) the suite of the 'else' clause, if present, is executed and\nthe loop terminates.\n\nA *note break: 8de. statement executed in the first suite terminates the\nloop without executing the 'else' clause's suite.  A *note continue:\n7ed. statement executed in the first suite skips the rest of the suite\nand goes back to testing the expression.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The for statement,  Next: The try statement,  Prev: The while statement,  Up: Compound statements": {
            "content": "The *note for: 24e. statement is used to iterate over the elements of a\nsequence (such as a string, tuple or list) or other iterable object:\n\nforstmt ::= \"for\" targetlist \"in\" starredlist \":\" suite\n[\"else\" \":\" suite]\n",
            "subsections": []
        },
        "The 'starredlist' expression is evaluated once; it should yield an": {
            "content": "*note iterable: 109d. object.  An *note iterator: 16a9. is created for\nthat iterable.  The first item provided by the iterator is then assigned\nto the target list using the standard rules for assignments (see *note",
            "subsections": []
        },
        "Assignment statements: 1ce1.), and the suite is executed.  This repeats": {
            "content": "for each item provided by the iterator.  When the iterator is exhausted,\nthe suite in the 'else' clause, if present, is executed, and the loop\nterminates.\n\nA *note break: 8de. statement executed in the first suite terminates the\nloop without executing the 'else' clause's suite.  A *note continue:\n7ed. statement executed in the first suite skips the rest of the suite\nand continues with the next item, or with the 'else' clause if there is\nno next item.\n\nThe for-loop makes assignments to the variables in the target list.",
            "subsections": []
        },
        "This overwrites all previous assignments to those variables including": {
            "content": "those made in the suite of the for-loop:\n\nfor i in range(10):\nprint(i)\ni = 5             # this will not affect the for-loop\n# because i will be overwritten with the next\n# index in the range\n",
            "subsections": []
        },
        "Names in the target list are not deleted when the loop is finished, but": {
            "content": "if the sequence is empty, they will not have been assigned to at all by\nthe loop.  Hint: the built-in type *note range(): 761. represents\nimmutable arithmetic sequences of integers.  For instance, iterating\n'range(3)' successively yields 0, 1, and then 2.\n",
            "subsections": []
        },
        "Changed in version 3.11: Starred elements are now allowed in the": {
            "content": "expression list.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The try statement,  Next: The with statement,  Prev: The for statement,  Up: Compound statements": {
            "content": "",
            "subsections": []
        },
        "The 'try' statement specifies exception handlers and/or cleanup code for": {
            "content": "a group of statements:\n\ntrystmt  ::= try1stmt | try2stmt | try3stmt\ntry1stmt ::= \"try\" \":\" suite\n(\"except\" [expression [\"as\" identifier]] \":\" suite)+\n[\"else\" \":\" suite]\n[\"finally\" \":\" suite]\ntry2stmt ::= \"try\" \":\" suite\n(\"except\" \"*\" expression [\"as\" identifier] \":\" suite)+\n[\"else\" \":\" suite]\n[\"finally\" \":\" suite]\ntry3stmt ::= \"try\" \":\" suite\n\"finally\" \":\" suite\n\nAdditional information on exceptions can be found in section *note\nExceptions: 1cec, and information on using the *note raise: 3b3.\nstatement to generate exceptions may be found in section *note The raise\nstatement: 3b3.\n\n* Menu:\n\n* except clause::\n* except* clause::\n* else clause::\n* finally clause::\n\nFile: python3.12.info,  Node: except clause,  Next: except* clause,  Up: The try statement\n\n4.8.4.1 'except' clause\n.......................\n",
            "subsections": []
        },
        "The 'except' clause(s) specify one or more exception handlers.  When no": {
            "content": "exception occurs in the *note try: 4bc. clause, no exception handler is\nexecuted.  When an exception occurs in the 'try' suite, a search for an\nexception handler is started.  This search inspects the 'except' clauses\nin turn until one is found that matches the exception.  An\nexpression-less 'except' clause, if present, must be last; it matches\nany exception.  For an 'except' clause with an expression, that\nexpression is evaluated, and the clause matches the exception if the\nresulting object is \"compatible\" with the exception.  An object is\ncompatible with an exception if the object is the class or a *note\nnon-virtual base class: 102a. of the exception object, or a tuple\ncontaining an item that is the class or a non-virtual base class of the\nexception object.\n",
            "subsections": []
        },
        "If no 'except' clause matches the exception, the search for an exception": {
            "content": "handler continues in the surrounding code and on the invocation stack.\n(1)\n",
            "subsections": []
        },
        "If the evaluation of an expression in the header of an 'except' clause": {
            "content": "raises an exception, the original search for a handler is canceled and a\nsearch starts for the new exception in the surrounding code and on the\ncall stack (it is treated as if the entire *note try: 4bc. statement\nraised the exception).\n",
            "subsections": []
        },
        "When a matching 'except' clause is found, the exception is assigned to": {
            "content": "the target specified after the 'as' keyword in that 'except' clause, if\npresent, and the 'except' clause's suite is executed.  All 'except'\nclauses must have an executable block.  When the end of this block is\nreached, execution continues normally after the entire *note try: 4bc.\nstatement.  (This means that if two nested handlers exist for the same\nexception, and the exception occurs in the 'try' clause of the inner\nhandler, the outer handler will not handle the exception.)\n",
            "subsections": []
        },
        "When an exception has been assigned using 'as target', it is cleared at": {
            "content": "the end of the 'except' clause.  This is as if\n\nexcept E as N:\nfoo\n\nwas translated to\n\nexcept E as N:\ntry:\nfoo\nfinally:\ndel N\n",
            "subsections": []
        },
        "This means the exception must be assigned to a different name to be able": {
            "content": "to refer to it after the 'except' clause.  Exceptions are cleared\nbecause with the traceback attached to them, they form a reference cycle\nwith the stack frame, keeping all locals in that frame alive until the\nnext garbage collection occurs.\n",
            "subsections": []
        },
        "Before an 'except' clause's suite is executed, the exception is stored": {
            "content": "in the *note sys: d3. module, where it can be accessed from within the\nbody of the 'except' clause by calling *note sys.exception(): 457.  When\nleaving an exception handler, the exception stored in the *note sys: d3.\nmodule is reset to its previous value:\n\n>>> print(sys.exception())\nNone\n>>> try:\n...     raise TypeError\n... except:\n...     print(repr(sys.exception()))\n...     try:\n...          raise ValueError\n...     except:\n...         print(repr(sys.exception()))\n...     print(repr(sys.exception()))\n...\nTypeError()\nValueError()\nTypeError()\n>>> print(sys.exception())\nNone\n\n---------- Footnotes ----------\n\n(1) The exception is propagated to the invocation stack unless there\nis a *note finally: 7ee. clause which happens to raise another\nexception.  That new exception causes the old one to be lost.\n\nFile: python3.12.info,  Node: except* clause,  Next: else clause,  Prev: except clause,  Up: The try statement\n\n4.8.4.2 'except*' clause\n........................\n\nThe 'except*' clause(s) are used for handling *note ExceptionGroup:\n17b.s.  The exception type for matching is interpreted as in the case of\n*note except: 379, but in the case of exception groups we can have\npartial matches when the type matches some of the exceptions in the\ngroup.  This means that multiple 'except*' clauses can execute, each\nhandling part of the exception group.  Each clause executes at most once\nand handles an exception group of all matching exceptions.  Each\nexception in the group is handled by at most one 'except*' clause, the\nfirst that matches it.\n\n>>> try:\n...     raise ExceptionGroup(\"eg\",\n...         [ValueError(1), TypeError(2), OSError(3), OSError(4)])\n... except* TypeError as e:\n...     print(f'caught {type(e)} with nested {e.exceptions}')\n... except* OSError as e:\n...     print(f'caught {type(e)} with nested {e.exceptions}')\n...\ncaught <class 'ExceptionGroup'> with nested (TypeError(2),)\ncaught <class 'ExceptionGroup'> with nested (OSError(3), OSError(4))\n+ Exception Group Traceback (most recent call last):\n|   File \"<stdin>\", line 2, in <module>\n| ExceptionGroup: eg\n+-+---------------- 1 ----------------\n| ValueError: 1\n+------------------------------------\n\nAny remaining exceptions that were not handled by any 'except*' clause\nare re-raised at the end, along with all exceptions that were raised\nfrom within the 'except*' clauses.  If this list contains more than one\nexception to reraise, they are combined into an exception group.\n",
            "subsections": []
        },
        "If the raised exception is not an exception group and its type matches": {
            "content": "one of the 'except*' clauses, it is caught and wrapped by an exception\ngroup with an empty message string.\n\n>>> try:\n...     raise BlockingIOError\n... except* BlockingIOError as e:\n...     print(repr(e))\n...\nExceptionGroup('', (BlockingIOError()))\n\nAn 'except*' clause must have a matching type, and this type cannot be a\nsubclass of *note BaseExceptionGroup: 377.  It is not possible to mix\n*note except: 379. and 'except*' in the same *note try: 4bc.  *note\nbreak: 8de, *note continue: 7ed. and *note return: 7f2. cannot appear in\nan 'except*' clause.\n\nFile: python3.12.info,  Node: else clause,  Next: finally clause,  Prev: except* clause,  Up: The try statement\n\n4.8.4.3 'else' clause\n.....................\n",
            "subsections": []
        },
        "The optional 'else' clause is executed if the control flow leaves the": {
            "content": "*note try: 4bc. suite, no exception was raised, and no *note return:\n7f2, *note continue: 7ed, or *note break: 8de. statement was executed.\nExceptions in the 'else' clause are not handled by the preceding *note\nexcept: 379. clauses.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: finally clause,  Prev: else clause,  Up: The try statement": {
            "content": "4.8.4.4 'finally' clause\n........................\n\nIf 'finally' is present, it specifies a 'cleanup' handler.  The *note\ntry: 4bc. clause is executed, including any *note except: 379. and *note\nelse: 24d. clauses.  If an exception occurs in any of the clauses and is\nnot handled, the exception is temporarily saved.  The 'finally' clause\nis executed.  If there is a saved exception it is re-raised at the end\nof the 'finally' clause.  If the 'finally' clause raises another\nexception, the saved exception is set as the context of the new\nexception.  If the 'finally' clause executes a *note return: 7f2, *note\nbreak: 8de. or *note continue: 7ed. statement, the saved exception is\ndiscarded:\n\n>>> def f():\n...     try:\n...         1/0\n...     finally:\n...         return 42\n...\n>>> f()\n42\n",
            "subsections": []
        },
        "The exception information is not available to the program during": {
            "content": "execution of the 'finally' clause.\n\nWhen a *note return: 7f2, *note break: 8de. or *note continue: 7ed.\nstatement is executed in the *note try: 4bc. suite of a 'try'...'finally'\nstatement, the 'finally' clause is also executed 'on the way out.'\n\nThe return value of a function is determined by the last *note return:\n7f2. statement executed.  Since the 'finally' clause always executes, a\n'return' statement executed in the 'finally' clause will always be the\nlast one executed:\n\n>>> def foo():\n...     try:\n...         return 'try'\n...     finally:\n...         return 'finally'\n...\n>>> foo()\n'finally'\n\nChanged in version 3.8: Prior to Python 3.8, a *note continue: 7ed.\nstatement was illegal in the 'finally' clause due to a problem with the\nimplementation.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The with statement,  Next: The match statement,  Prev: The try statement,  Up: Compound statements": {
            "content": "The *note with: 396. statement is used to wrap the execution of a block\nwith methods defined by a context manager (see section *note With\nStatement Context Managers: 1cc4.).  This allows common *note try:\n4bc....*note except: 379....*note finally: 7ee. usage patterns to be\nencapsulated for convenient reuse.\n\nwithstmt          ::= \"with\" ( \"(\" withstmtcontents \",\"? \")\" | withstmtcontents ) \":\" suite\nwithstmtcontents ::= withitem (\",\" withitem)*\nwithitem          ::= expression [\"as\" target]\n\nThe execution of the *note with: 396. statement with one \"item\" proceeds\nas follows:\n\n1. The context expression (the expression given in the *note\nwithitem: 1deb.) is evaluated to obtain a context manager.\n\n2. The context manager's *note enter(): 389. is loaded for later\nuse.\n\n3. The context manager's *note exit(): 1175. is loaded for later\nuse.\n\n4. The context manager's *note enter(): 389. method is invoked.\n\n5. If a target was included in the *note with: 396. statement, the\nreturn value from *note enter(): 389. is assigned to it.\n\nNote: The *note with: 396. statement guarantees that if the\n*note enter(): 389. method returns without an error, then\n*note exit(): 1175. will always be called.  Thus, if an\nerror occurs during the assignment to the target list, it will\nbe treated the same as an error occurring within the suite\nwould be.  See step 7 below.\n\n6. The suite is executed.\n\n7. The context manager's *note exit(): 1175. method is invoked.\nIf an exception caused the suite to be exited, its type, value, and\ntraceback are passed as arguments to *note exit(): 1175.\nOtherwise, three *note None: 43f. arguments are supplied.\n\nIf the suite was exited due to an exception, and the return value\nfrom the *note exit(): 1175. method was false, the exception is\nreraised.  If the return value was true, the exception is\nsuppressed, and execution continues with the statement following\nthe *note with: 396. statement.\n\nIf the suite was exited for any reason other than an exception, the\nreturn value from *note exit(): 1175. is ignored, and execution\nproceeds at the normal location for the kind of exit that was\ntaken.\n\nThe following code:\n\nwith EXPRESSION as TARGET:\nSUITE\n\nis semantically equivalent to:\n\nmanager = (EXPRESSION)\nenter = type(manager).enter\nexit = type(manager).exit\nvalue = enter(manager)\nhitexcept = False\n\ntry:\nTARGET = value\nSUITE\nexcept:\nhitexcept = True\nif not exit(manager, *sys.excinfo()):\nraise\nfinally:\nif not hitexcept:\nexit(manager, None, None, None)\n",
            "subsections": []
        },
        "With more than one item, the context managers are processed as if": {
            "content": "multiple *note with: 396. statements were nested:\n\nwith A() as a, B() as b:\nSUITE\n\nis semantically equivalent to:\n\nwith A() as a:\nwith B() as b:\nSUITE\n",
            "subsections": []
        },
        "You can also write multi-item context managers in multiple lines if the": {
            "content": "items are surrounded by parentheses.  For example:\n\nwith (\nA() as a,\nB() as b,\n):\nSUITE\n\nChanged in version 3.1: Support for multiple context expressions.\n",
            "subsections": []
        },
        "Changed in version 3.10: Support for using grouping parentheses to break": {
            "content": "the statement in multiple lines.\n\nSee also\n........\n\nPEP 343(1) - The \"with\" statement\n\nThe specification, background, and examples for the Python *note\nwith: 396. statement.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0343/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The match statement,  Next: Function definitions,  Prev: The with statement,  Up: Compound statements": {
            "content": "New in version 3.10.\n\nThe match statement is used for pattern matching.  Syntax:\n\nmatchstmt   ::= 'match' subjectexpr \":\" NEWLINE INDENT caseblock+ DEDENT\nsubjectexpr ::= starnamedexpression \",\" starnamedexpressions?\n| namedexpression\ncaseblock   ::= 'case' patterns [guard] \":\" block\n\nNote: This section uses single quotes to denote *note soft\nkeywords: 600.\n",
            "subsections": []
        },
        "Pattern matching takes a pattern as input (following 'case') and a": {
            "content": "subject value (following 'match').  The pattern (which may contain\nsubpatterns) is matched against the subject value.  The outcomes are:\n\n* A match success or failure (also termed a pattern success or\nfailure).\n\n* Possible binding of matched values to a name.  The prerequisites\nfor this are further discussed below.\n\nThe 'match' and 'case' keywords are *note soft keywords: 600.\n\nSee also\n........\n\n* PEP 634(1) - Structural Pattern Matching: Specification\n\n* PEP 636(2) - Structural Pattern Matching: Tutorial\n\n* Menu:\n\n* Overview::\n* Guards::\n* Irrefutable Case Blocks::\n* Patterns::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0634/\n\n(2) https://peps.python.org/pep-0636/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Overview,  Next: Guards,  Up: The match statement": {
            "content": "4.8.6.1 Overview\n................\n\nHere's an overview of the logical flow of a match statement:\n\n1. The subject expression 'subjectexpr' is evaluated and a resulting\nsubject value obtained.  If the subject expression contains a\ncomma, a tuple is constructed using *note the standard rules: 1df1.\n\n2. Each pattern in a 'caseblock' is attempted to match with the\nsubject value.  The specific rules for success or failure are\ndescribed below.  The match attempt can also bind some or all of\nthe standalone names within the pattern.  The precise pattern\nbinding rules vary per pattern type and are specified below.  'Name\nbindings made during a successful pattern match outlive the\nexecuted block and can be used after the match statement'.\n\nNote: During failed pattern matches, some subpatterns may\nsucceed.  Do not rely on bindings being made for a failed\nmatch.  Conversely, do not rely on variables remaining\nunchanged after a failed match.  The exact behavior is\ndependent on implementation and may vary.  This is an\nintentional decision made to allow different implementations\nto add optimizations.\n\n3. If the pattern succeeds, the corresponding guard (if present) is\nevaluated.  In this case all name bindings are guaranteed to have\nhappened.\n\n* If the guard evaluates as true or is missing, the 'block'\ninside 'caseblock' is executed.\n\n* Otherwise, the next 'caseblock' is attempted as described\nabove.\n\n* If there are no further case blocks, the match statement is\ncompleted.\n\nNote: Users should generally never rely on a pattern being\nevaluated.  Depending on implementation, the interpreter may cache\nvalues or use other optimizations which skip repeated evaluations.\n\nA sample match statement:\n\n>>> flag = False\n>>> match (100, 200):\n...    case (100, 300):  # Mismatch: 200 != 300\n...        print('Case 1')\n...    case (100, 200) if flag:  # Successful match, but guard fails\n...        print('Case 2')\n...    case (100, y):  # Matches and binds y to 200\n...        print(f'Case 3, y: {y}')\n...    case :  # Pattern not attempted\n...        print('Case 4, I match anything!')\n...\nCase 3, y: 200\n",
            "subsections": []
        },
        "In this case, 'if flag' is a guard.  Read more about that in the next": {
            "content": "section.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Guards,  Next: Irrefutable Case Blocks,  Prev: Overview,  Up: The match statement": {
            "content": "4.8.6.2 Guards\n..............\n\nguard ::= \"if\" namedexpression\n\nA 'guard' (which is part of the 'case') must succeed for code inside the\n'case' block to execute.  It takes the form: *note if: 24f. followed by\nan expression.\n\nThe logical flow of a 'case' block with a 'guard' follows:\n\n1. Check that the pattern in the 'case' block succeeded.  If the\npattern failed, the 'guard' is not evaluated and the next 'case'\nblock is checked.\n\n2. If the pattern succeeded, evaluate the 'guard'.\n\n* If the 'guard' condition evaluates as true, the case block is\nselected.\n\n* If the 'guard' condition evaluates as false, the case block is\nnot selected.\n\n* If the 'guard' raises an exception during evaluation, the\nexception bubbles up.\n",
            "subsections": []
        },
        "Guards are allowed to have side effects as they are expressions.  Guard": {
            "content": "evaluation must proceed from the first to the last case block, one at a\ntime, skipping case blocks whose pattern(s) don't all succeed.  (I.e.,\nguard evaluation must happen in order.)  Guard evaluation must stop once\na case block is selected.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Irrefutable Case Blocks,  Next: Patterns,  Prev: Guards,  Up: The match statement": {
            "content": "4.8.6.3 Irrefutable Case Blocks\n...............................\n",
            "subsections": []
        },
        "An irrefutable case block is a match-all case block.  A match statement": {
            "content": "may have at most one irrefutable case block, and it must be last.\n\nA case block is considered irrefutable if it has no guard and its\npattern is irrefutable.  A pattern is considered irrefutable if we can\nprove from its syntax alone that it will always succeed.  Only the\nfollowing patterns are irrefutable:\n\n* *note AS Patterns: 1df6. whose left-hand side is irrefutable\n\n* *note OR Patterns: 1df7. containing at least one irrefutable\npattern\n\n* *note Capture Patterns: 1df8.\n\n* *note Wildcard Patterns: 602.\n\n* parenthesized irrefutable patterns\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Patterns,  Prev: Irrefutable Case Blocks,  Up: The match statement": {
            "content": "4.8.6.4 Patterns\n................\n\nNote: This section uses grammar notations beyond standard EBNF:\n\n* the notation 'SEP.RULE+' is shorthand for 'RULE (SEP RULE)*'\n\n* the notation '!RULE' is shorthand for a negative lookahead\nassertion\n\nThe top-level syntax for 'patterns' is:\n\npatterns       ::= opensequencepattern | pattern\npattern        ::= aspattern | orpattern\nclosedpattern ::= | literalpattern\n| capturepattern\n| wildcardpattern\n| valuepattern\n| grouppattern\n| sequencepattern\n| mappingpattern\n| classpattern\n\nThe descriptions below will include a description \"in simple terms\" of\nwhat a pattern does for illustration purposes (credits to Raymond",
            "subsections": []
        },
        "Hettinger for a document that inspired most of the descriptions).  Note": {
            "content": "that these descriptions are purely for illustration purposes and 'may\nnot' reflect the underlying implementation.  Furthermore, they do not\ncover all valid forms.\n\n* Menu:\n\n* OR Patterns::\n* AS Patterns::\n* Literal Patterns::\n* Capture Patterns::\n* Wildcard Patterns::\n* Value Patterns::\n* Group Patterns::\n* Sequence Patterns::\n* Mapping Patterns::\n* Class Patterns::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: OR Patterns,  Next: AS Patterns,  Up: Patterns": {
            "content": "4.8.6.5 OR Patterns\n...................\n\nAn OR pattern is two or more patterns separated by vertical bars '|'.\nSyntax:\n\norpattern ::= \"|\".closedpattern+\n\nOnly the final subpattern may be *note irrefutable: 1df4, and each\nsubpattern must bind the same set of names to avoid ambiguity.\n",
            "subsections": []
        },
        "An OR pattern matches each of its subpatterns in turn to the subject": {
            "content": "value, until one succeeds.  The OR pattern is then considered\nsuccessful.  Otherwise, if none of the subpatterns succeed, the OR\npattern fails.\n\nIn simple terms, 'P1 | P2 | ...' will try to match 'P1', if it fails it\nwill try to match 'P2', succeeding immediately if any succeeds, failing\notherwise.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: AS Patterns,  Next: Literal Patterns,  Prev: OR Patterns,  Up: Patterns": {
            "content": "4.8.6.6 AS Patterns\n...................\n\nAn AS pattern matches an OR pattern on the left of the *note as: 1de7.\nkeyword against a subject.  Syntax:\n\naspattern ::= orpattern \"as\" capturepattern\n",
            "subsections": []
        },
        "If the OR pattern fails, the AS pattern fails.  Otherwise, the AS": {
            "content": "pattern binds the subject to the name on the right of the as keyword and\nsucceeds.  'capturepattern' cannot be a ''.\n",
            "subsections": []
        },
        "In simple terms 'P as NAME' will match with 'P', and on success it will": {
            "content": "set 'NAME = <subject>'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Literal Patterns,  Next: Capture Patterns,  Prev: AS Patterns,  Up: Patterns": {
            "content": "4.8.6.7 Literal Patterns\n........................\n\nA literal pattern corresponds to most *note literals: 1bc3. in Python.\nSyntax:\n\nliteralpattern ::= signednumber\n| signednumber \"+\" NUMBER\n| signednumber \"-\" NUMBER\n| strings\n| \"None\"\n| \"True\"\n| \"False\"\n| signednumber: NUMBER | \"-\" NUMBER\n\nThe rule 'strings' and the token 'NUMBER' are defined in the *note\nstandard Python grammar: 1e04.  Triple-quoted strings are supported.\nRaw strings and byte strings are supported.  *note f-strings: 7cd. are\nnot supported.\n\nThe forms 'signednumber '+' NUMBER' and 'signednumber '-' NUMBER' are\nfor expressing *note complex numbers: 1bf9.; they require a real number\non the left and an imaginary number on the right.  E.g.  '3 + 4j'.\n\nIn simple terms, 'LITERAL' will succeed only if '<subject> == LITERAL'.\nFor the singletons 'None', 'True' and 'False', the *note is: 251.\noperator is used.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Capture Patterns,  Next: Wildcard Patterns,  Prev: Literal Patterns,  Up: Patterns": {
            "content": "4.8.6.8 Capture Patterns\n........................\n\nA capture pattern binds the subject value to a name.  Syntax:\n\ncapturepattern ::= !'' NAME\n\nA single underscore '' is not a capture pattern (this is what '!'''\nexpresses).  It is instead treated as a *note wildcardpattern: 1e07.\n",
            "subsections": []
        },
        "In a given pattern, a given name can only be bound once.  E.g.  'case x,": {
            "content": "x: ...' is invalid while 'case [x] | x: ...' is allowed.\n",
            "subsections": []
        },
        "Capture patterns always succeed.  The binding follows scoping rules": {
            "content": "established by the assignment expression operator in PEP 572(1); the\nname becomes a local variable in the closest containing function scope\nunless there's an applicable *note global: 19a3. or *note nonlocal:\n111f. statement.\n\nIn simple terms 'NAME' will always succeed and it will set 'NAME =\n<subject>'.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0572/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Wildcard Patterns,  Next: Value Patterns,  Prev: Capture Patterns,  Up: Patterns": {
            "content": "4.8.6.9 Wildcard Patterns\n.........................\n\nA wildcard pattern always succeeds (matches anything) and binds no name.\nSyntax:\n\nwildcardpattern ::= ''\n\n'' is a *note soft keyword: 600. within any pattern, but only within\npatterns.  It is an identifier, as usual, even within 'match' subject\nexpressions, 'guard's, and 'case' blocks.\n\nIn simple terms, '' will always succeed.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Value Patterns,  Next: Group Patterns,  Prev: Wildcard Patterns,  Up: Patterns": {
            "content": "4.8.6.10 Value Patterns\n.......................\n\nA value pattern represents a named value in Python.  Syntax:\n\nvaluepattern ::= attr\nattr          ::= nameorattr \".\" NAME\nnameorattr  ::= attr | NAME\n\nThe dotted name in the pattern is looked up using standard Python *note\nname resolution rules: 1ce3.  The pattern succeeds if the value found\ncompares equal to the subject value (using the '==' equality operator).\n\nIn simple terms 'NAME1.NAME2' will succeed only if '<subject> ==\nNAME1.NAME2'\n\nNote: If the same value occurs multiple times in the same match\nstatement, the interpreter may cache the first value found and\nreuse it rather than repeat the same lookup.  This cache is\nstrictly tied to a given execution of a given match statement.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Group Patterns,  Next: Sequence Patterns,  Prev: Value Patterns,  Up: Patterns": {
            "content": "4.8.6.11 Group Patterns\n.......................\n\nA group pattern allows users to add parentheses around patterns to\nemphasize the intended grouping.  Otherwise, it has no additional\nsyntax.  Syntax:\n\ngrouppattern ::= \"(\" pattern \")\"\n\nIn simple terms '(P)' has the same effect as 'P'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Sequence Patterns,  Next: Mapping Patterns,  Prev: Group Patterns,  Up: Patterns": {
            "content": "4.8.6.12 Sequence Patterns\n..........................\n\nA sequence pattern contains several subpatterns to be matched against\nsequence elements.  The syntax is similar to the unpacking of a list or\ntuple.\n\nsequencepattern       ::= \"[\" [maybesequencepattern] \"]\"\n| \"(\" [opensequencepattern] \")\"\nopensequencepattern  ::= maybestarpattern \",\" [maybesequencepattern]\nmaybesequencepattern ::= \",\".maybestarpattern+ \",\"?\nmaybestarpattern     ::= starpattern | pattern\nstarpattern           ::= \"*\" (capturepattern | wildcardpattern)\n",
            "subsections": []
        },
        "There is no difference if parentheses or square brackets are used for": {
            "content": "sequence patterns (i.e.  '(...)' vs '[...]' ).\n\nNote: A single pattern enclosed in parentheses without a trailing\ncomma (e.g.  '(3 | 4)') is a *note group pattern: 1e0e.  While a\nsingle pattern enclosed in square brackets (e.g.  '[3 | 4]') is\nstill a sequence pattern.\n",
            "subsections": []
        },
        "At most one star subpattern may be in a sequence pattern.  The star": {
            "content": "subpattern may occur in any position.  If no star subpattern is present,\nthe sequence pattern is a fixed-length sequence pattern; otherwise it is\na variable-length sequence pattern.\n",
            "subsections": []
        },
        "The following is the logical flow for matching a sequence pattern": {
            "content": "against a subject value:\n\n1. If the subject value is not a sequence (1), the sequence pattern\nfails.\n\n2. If the subject value is an instance of 'str', 'bytes' or\n'bytearray' the sequence pattern fails.\n\n3. The subsequent steps depend on whether the sequence pattern is\nfixed or variable-length.\n\nIf the sequence pattern is fixed-length:\n\n1. If the length of the subject sequence is not equal to the\nnumber of subpatterns, the sequence pattern fails\n\n2. Subpatterns in the sequence pattern are matched to their\ncorresponding items in the subject sequence from left to\nright.  Matching stops as soon as a subpattern fails.  If all\nsubpatterns succeed in matching their corresponding item, the\nsequence pattern succeeds.\n\nOtherwise, if the sequence pattern is variable-length:\n\n1. If the length of the subject sequence is less than the number\nof non-star subpatterns, the sequence pattern fails.\n\n2. The leading non-star subpatterns are matched to their\ncorresponding items as for fixed-length sequences.\n\n3. If the previous step succeeds, the star subpattern matches a\nlist formed of the remaining subject items, excluding the\nremaining items corresponding to non-star subpatterns\nfollowing the star subpattern.\n\n4. Remaining non-star subpatterns are matched to their\ncorresponding subject items, as for a fixed-length sequence.\n\nNote: The length of the subject sequence is obtained via *note\nlen(): 3fb. (i.e.  via the 'len()' protocol).  This length\nmay be cached by the interpreter in a similar manner as *note\nvalue patterns: 1e0a.\n\nIn simple terms '[P1, P2, P3,' ... ', P<N>]' matches only if all the\nfollowing happens:\n\n* check '<subject>' is a sequence\n\n* 'len(subject) == <N>'\n\n* 'P1' matches '<subject>[0]' (note that this match can also bind\nnames)\n\n* 'P2' matches '<subject>[1]' (note that this match can also bind\nnames)\n\n* ... and so on for the corresponding pattern/element.\n\n---------- Footnotes ----------\n\n(1) In pattern matching, a sequence is defined as one of the\nfollowing:\n\n* a class that inherits from *note collections.abc.Sequence: 1038.\n\n* a Python class that has been registered as *note\ncollections.abc.Sequence: 1038.\n\n* a builtin class that has its (CPython) *note PyTPFLAGSSEQUENCE:\n1606. bit set\n\n* a class that inherits from any of the above\n\nThe following standard library classes are sequences:\n\n* *note array.array: 18f.\n\n* *note collections.deque: 3a0.\n\n* *note list: 3dc.\n\n* *note memoryview: 17f.\n\n* *note range: 761.\n\n* *note tuple: 4b8.\n\nNote: Subject values of type 'str', 'bytes', and 'bytearray' do not\nmatch sequence patterns.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Mapping Patterns,  Next: Class Patterns,  Prev: Sequence Patterns,  Up: Patterns": {
            "content": "4.8.6.13 Mapping Patterns\n.........................\n\nA mapping pattern contains one or more key-value patterns.  The syntax\nis similar to the construction of a dictionary.  Syntax:\n\nmappingpattern     ::= \"{\" [itemspattern] \"}\"\nitemspattern       ::= \",\".keyvaluepattern+ \",\"?\nkeyvaluepattern   ::= (literalpattern | valuepattern) \":\" pattern\n| doublestarpattern\ndoublestarpattern ::= \"\" capturepattern\n",
            "subsections": []
        },
        "At most one double star pattern may be in a mapping pattern.  The double": {
            "content": "star pattern must be the last subpattern in the mapping pattern.\n",
            "subsections": []
        },
        "Duplicate keys in mapping patterns are disallowed.  Duplicate literal": {
            "content": "keys will raise a *note SyntaxError: 146.  Two keys that otherwise have\nthe same value will raise a *note ValueError: 183. at runtime.\n",
            "subsections": []
        },
        "The following is the logical flow for matching a mapping pattern against": {
            "content": "a subject value:\n\n1. If the subject value is not a mapping (1),the mapping pattern\nfails.\n\n2. If every key given in the mapping pattern is present in the subject\nmapping, and the pattern for each key matches the corresponding\nitem of the subject mapping, the mapping pattern succeeds.\n\n3. If duplicate keys are detected in the mapping pattern, the pattern\nis considered invalid.  A *note SyntaxError: 146. is raised for\nduplicate literal values; or a *note ValueError: 183. for named\nkeys of the same value.\n\nNote: Key-value pairs are matched using the two-argument form of\nthe mapping subject's 'get()' method.  Matched key-value pairs must\nalready be present in the mapping, and not created on-the-fly via\n'missing()' or *note getitem(): 4b9.\n\nIn simple terms '{KEY1: P1, KEY2: P2, ... }' matches only if all the\nfollowing happens:\n\n* check '<subject>' is a mapping\n\n* 'KEY1 in <subject>'\n\n* 'P1' matches '<subject>[KEY1]'\n\n* ... and so on for the corresponding KEY/pattern pair.\n\n---------- Footnotes ----------\n\n(1) In pattern matching, a mapping is defined as one of the\nfollowing:\n\n* a class that inherits from *note collections.abc.Mapping: 6e2.\n\n* a Python class that has been registered as *note\ncollections.abc.Mapping: 6e2.\n\n* a builtin class that has its (CPython) *note PyTPFLAGSMAPPING:\n1605. bit set\n\n* a class that inherits from any of the above\n\nThe standard library classes *note dict: 237. and *note\ntypes.MappingProxyType: 186. are mappings.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Class Patterns,  Prev: Mapping Patterns,  Up: Patterns": {
            "content": "4.8.6.14 Class Patterns\n.......................\n\nA class pattern represents a class and its positional and keyword\narguments (if any).  Syntax:\n\nclasspattern       ::= nameorattr \"(\" [patternarguments \",\"?] \")\"\npatternarguments   ::= positionalpatterns [\",\" keywordpatterns]\n| keywordpatterns\npositionalpatterns ::= \",\".pattern+\nkeywordpatterns    ::= \",\".keywordpattern+\nkeywordpattern     ::= NAME \"=\" pattern\n\nThe same keyword should not be repeated in class patterns.\n",
            "subsections": []
        },
        "The following is the logical flow for matching a class pattern against a": {
            "content": "subject value:\n\n1. If 'nameorattr' is not an instance of the builtin *note type:\nba0. , raise *note TypeError: 28e.\n\n2. If the subject value is not an instance of 'nameorattr' (tested\nvia *note isinstance(): 14b.), the class pattern fails.\n\n3. If no pattern arguments are present, the pattern succeeds.\nOtherwise, the subsequent steps depend on whether keyword or\npositional argument patterns are present.\n\nFor a number of built-in types (specified below), a single\npositional subpattern is accepted which will match the entire\nsubject; for these types keyword patterns also work as for other\ntypes.\n\nIf only keyword patterns are present, they are processed as\nfollows, one by one:\n\nI. The keyword is looked up as an attribute on the subject.\n\n* If this raises an exception other than *note\nAttributeError: 395, the exception bubbles up.\n\n* If this raises *note AttributeError: 395, the class\npattern has failed.\n\n* Else, the subpattern associated with the keyword pattern\nis matched against the subject's attribute value.  If\nthis fails, the class pattern fails; if this succeeds,\nthe match proceeds to the next keyword.\n\nII. If all keyword patterns succeed, the class pattern succeeds.\n\nIf any positional patterns are present, they are converted to\nkeyword patterns using the *note matchargs: 1622. attribute on\nthe class 'nameorattr' before matching:\n\nI. The equivalent of 'getattr(cls, \"matchargs\", ())' is\ncalled.\n\n* If this raises an exception, the exception bubbles up.\n\n* If the returned value is not a tuple, the conversion\nfails and *note TypeError: 28e. is raised.\n\n* If there are more positional patterns than\n'len(cls.matchargs)', *note TypeError: 28e. is\nraised.\n\n* Otherwise, positional pattern 'i' is converted to a\nkeyword pattern using 'matchargs[i]' as the keyword.\n'matchargs[i]' must be a string; if not *note\nTypeError: 28e. is raised.\n\n* If there are duplicate keywords, *note TypeError: 28e. is\nraised.\n\nSee also\n........\n\n*note Customizing positional arguments in class pattern\nmatching: 1cc7.\n\nII. Once all positional patterns have been converted to keyword patterns,\n\nthe match proceeds as if there were only keyword patterns.\n\nFor the following built-in types the handling of positional\nsubpatterns is different:\n\n* *note bool: 17d.\n\n* *note bytearray: 294.\n\n* *note bytes: 295.\n\n* *note dict: 237.\n\n* *note float: 4b7.\n\n* *note frozenset: 39e.\n\n* *note int: 17e.\n\n* *note list: 3dc.\n\n* *note set: 39d.\n\n* *note str: 157.\n\n* *note tuple: 4b8.\n\nThese classes accept a single positional argument, and the pattern\nthere is matched against the whole object rather than an attribute.\nFor example 'int(0|1)' matches the value '0', but not the value\n'0.0'.\n\nIn simple terms 'CLS(P1, attr=P2)' matches only if the following\nhappens:\n\n* 'isinstance(<subject>, CLS)'\n\n* convert 'P1' to a keyword pattern using 'CLS.matchargs'\n\n* For each keyword argument 'attr=P2':\n\n* 'hasattr(<subject>, \"attr\")'\n\n* 'P2' matches '<subject>.attr'\n\n* ... and so on for the corresponding keyword argument/pattern pair.\n\nSee also\n........\n\n* PEP 634(1) - Structural Pattern Matching: Specification\n\n* PEP 636(2) - Structural Pattern Matching: Tutorial\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0634/\n\n(2) https://peps.python.org/pep-0636/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Function definitions,  Next: Class definitions,  Prev: The match statement,  Up: Compound statements": {
            "content": "A function definition defines a user-defined function object (see\nsection *note The standard type hierarchy: 1c05.):\n\nfuncdef                   ::= [decorators] \"def\" funcname [typeparams] \"(\" [parameterlist] \")\"\n[\"->\" expression] \":\" suite\ndecorators                ::= decorator+\ndecorator                 ::= \"@\" assignmentexpression NEWLINE\nparameterlist            ::= defparameter (\",\" defparameter)* \",\" \"/\" [\",\" [parameterlistnoposonly]]\n| parameterlistnoposonly\nparameterlistnoposonly ::= defparameter (\",\" defparameter)* [\",\" [parameterliststarargs]]\n| parameterliststarargs\nparameterliststarargs   ::= \"*\" [parameter] (\",\" defparameter)* [\",\" [\"\" parameter [\",\"]]]\n| \"\" parameter [\",\"]\nparameter                 ::= identifier [\":\" expression]\ndefparameter              ::= parameter [\"=\" expression]\nfuncname                  ::= identifier\n\nA function definition is an executable statement.  Its execution binds\nthe function name in the current local namespace to a function object (a\nwrapper around the executable code for the function).  This function\nobject contains a reference to the current global namespace as the\nglobal namespace to be used when the function is called.\n",
            "subsections": []
        },
        "The function definition does not execute the function body; this gets": {
            "content": "executed only when the function is called.  (1)\n\nA function definition may be wrapped by one or more *note decorator:\n514. expressions.  Decorator expressions are evaluated when the function\nis defined, in the scope that contains the function definition.  The\nresult must be a callable, which is invoked with the function object as\nthe only argument.  The returned value is bound to the function name\ninstead of the function object.  Multiple decorators are applied in\nnested fashion.  For example, the following code\n\n@f1(arg)\n@f2\ndef func(): pass\n\nis roughly equivalent to\n\ndef func(): pass\nfunc = f1(arg)(f2(func))\n\nexcept that the original function is not temporarily bound to the name\n'func'.\n\nChanged in version 3.9: Functions may be decorated with any valid *note\nassignmentexpression: 1ce6.  Previously, the grammar was much more\nrestrictive; see PEP 614(2) for details.\n\nA list of *note type parameters: 166. may be given in square brackets\nbetween the function's name and the opening parenthesis for its\nparameter list.  This indicates to static type checkers that the\nfunction is generic.  At runtime, the type parameters can be retrieved\nfrom the function's *note typeparams: 1c1f. attribute.  See *note\nGeneric functions: 15e. for more.\n\nChanged in version 3.12: Type parameter lists are new in Python 3.12.\n\nWhen one or more *note parameters: 1c1e. have the form 'parameter' '='\n'expression', the function is said to have \"default parameter values.\"\nFor a parameter with a default value, the corresponding *note argument:\n154. may be omitted from a call, in which case the parameter's default\nvalue is substituted.  If a parameter has a default value, all following\nparameters up until the \"'*'\" must also have a default value -- this is a\nsyntactic restriction that is not expressed by the grammar.\n\n'Default parameter values are evaluated from left to right when the\nfunction definition is executed.'  This means that the expression is\nevaluated once, when the function is defined, and that the same\n\"pre-computed\" value is used for each call.  This is especially\nimportant to understand when a default parameter value is a mutable\nobject, such as a list or a dictionary: if the function modifies the\nobject (e.g.  by appending an item to a list), the default parameter\nvalue is in effect modified.  This is generally not what was intended.\nA way around this is to use 'None' as the default, and explicitly test\nfor it in the body of the function, e.g.:\n\ndef whatsonthetelly(penguin=None):\nif penguin is None:\npenguin = []\npenguin.append(\"property of the zoo\")\nreturn penguin\n\nFunction call semantics are described in more detail in section *note",
            "subsections": []
        },
        "Calls: bd8.  A function call always assigns values to all parameters": {
            "content": "mentioned in the parameter list, either from positional arguments, from\nkeyword arguments, or from default values.  If the form \"'*identifier'\"\nis present, it is initialized to a tuple receiving any excess positional\nparameters, defaulting to the empty tuple.  If the form \"'identifier'\"\nis present, it is initialized to a new ordered mapping receiving any\nexcess keyword arguments, defaulting to a new empty mapping of the same\ntype.  Parameters after \"'*'\" or \"'*identifier'\" are keyword-only\nparameters and may only be passed by keyword arguments.  Parameters\nbefore \"'/'\" are positional-only parameters and may only be passed by\npositional arguments.\n",
            "subsections": []
        },
        "Changed in version 3.8: The '/' function parameter syntax may be used to": {
            "content": "indicate positional-only parameters.  See PEP 570(3) for details.\n\nParameters may have an *note annotation: 19bc. of the form \"':\nexpression'\" following the parameter name.  Any parameter may have an\nannotation, even those of the form '*identifier' or 'identifier'.\nFunctions may have \"return\" annotation of the form \"'-> expression'\"\nafter the parameter list.  These annotations can be any valid Python\nexpression.  The presence of annotations does not change the semantics\nof a function.  The annotation values are available as values of a\ndictionary keyed by the parameters' names in the 'annotations'\nattribute of the function object.  If the 'annotations' import from\n*note future: 0. is used, annotations are preserved as strings at\nruntime which enables postponed evaluation.  Otherwise, they are\nevaluated when the function definition is executed.  In this case\nannotations may be evaluated in a different order than they appear in\nthe source code.\n",
            "subsections": []
        },
        "It is also possible to create anonymous functions (functions not bound": {
            "content": "to a name), for immediate use in expressions.  This uses lambda\nexpressions, described in section *note Lambdas: 1115.  Note that the\nlambda expression is merely a shorthand for a simplified function\ndefinition; a function defined in a \"*note def: 12af.\" statement can be\npassed around or assigned to another name just like a function defined\nby a lambda expression.  The \"'def'\" form is actually more powerful\nsince it allows the execution of multiple statements and annotations.\n\n'Programmer's note:' Functions are first-class objects.  A \"'def'\"\nstatement executed inside a function definition defines a local function\nthat can be returned or passed around.  Free variables used in the\nnested function can access the local variables of the function\ncontaining the def.  See section *note Naming and binding: 1c19. for\ndetails.\n\nSee also\n........\n\nPEP 3107(4) - Function Annotations\n\nThe original specification for function annotations.\n\nPEP 484(5) - Type Hints\n\nDefinition of a standard meaning for annotations: type hints.\n\nPEP 526(6) - Syntax for Variable Annotations\n\nAbility to type hint variable declarations, including class\nvariables and instance variables.\n\nPEP 563(7) - Postponed Evaluation of Annotations\n\nSupport for forward references within annotations by preserving\nannotations in a string form at runtime instead of eager\nevaluation.\n\nPEP 318(8) - Decorators for Functions and Methods\n\nFunction and method decorators were introduced.  Class decorators\nwere introduced in PEP 3129(9).\n\n---------- Footnotes ----------\n\n(1) A string literal appearing as the first statement in the function\nbody is transformed into the function's *note doc: 104d. attribute\nand therefore the function's *note docstring: 1e2f.\n\n(2) https://peps.python.org/pep-0614/\n\n(3) https://peps.python.org/pep-0570/\n\n(4) https://peps.python.org/pep-3107/\n\n(5) https://peps.python.org/pep-0484/\n\n(6) https://peps.python.org/pep-0526/\n\n(7) https://peps.python.org/pep-0563/\n\n(8) https://peps.python.org/pep-0318/\n\n(9) https://peps.python.org/pep-3129/\n\nFile: python3.12.info,  Node: Class definitions,  Next: Coroutines<2>,  Prev: Function definitions,  Up: Compound statements\n\n\nA class definition defines a class object (see section *note The\nstandard type hierarchy: 1c05.):\n\nclassdef    ::= [decorators] \"class\" classname [typeparams] [inheritance] \":\" suite\ninheritance ::= \"(\" [argumentlist] \")\"\nclassname   ::= identifier\n\nA class definition is an executable statement.  The inheritance list\nusually gives a list of base classes (see *note Metaclasses: 1c7b. for\nmore advanced uses), so each item in the list should evaluate to a class\nobject which allows subclassing.  Classes without an inheritance list\ninherit, by default, from the base class *note object: 8bb.; hence,\n\nclass Foo:\npass\n\nis equivalent to\n\nclass Foo(object):\npass\n\nThe class's suite is then executed in a new execution frame (see *note",
            "subsections": []
        },
        "Naming and binding: 1c19.), using a newly created local namespace and": {
            "content": "the original global namespace.  (Usually, the suite contains mostly\nfunction definitions.)  When the class's suite finishes execution, its\nexecution frame is discarded but its local namespace is saved.  (1)  A\nclass object is then created using the inheritance list for the base\nclasses and the saved local namespace for the attribute dictionary.  The\nclass name is bound to this class object in the original local\nnamespace.\n",
            "subsections": []
        },
        "The order in which attributes are defined in the class body is preserved": {
            "content": "in the new class's 'dict'.  Note that this is reliable only right\nafter the class is created and only for classes that were defined using\nthe definition syntax.\n\nClass creation can be customized heavily using *note metaclasses: 1c7b.\n",
            "subsections": []
        },
        "Classes can also be decorated: just like when decorating functions,": {
            "content": "@f1(arg)\n@f2\nclass Foo: pass\n\nis roughly equivalent to\n\nclass Foo: pass\nFoo = f1(arg)(f2(Foo))\n",
            "subsections": []
        },
        "The evaluation rules for the decorator expressions are the same as for": {
            "content": "function decorators.  The result is then bound to the class name.\n\nChanged in version 3.9: Classes may be decorated with any valid *note\nassignmentexpression: 1ce6.  Previously, the grammar was much more\nrestrictive; see PEP 614(2) for details.\n\nA list of *note type parameters: 166. may be given in square brackets\nimmediately after the class's name.  This indicates to static type\ncheckers that the class is generic.  At runtime, the type parameters can\nbe retrieved from the class's 'typeparams' attribute.  See *note\nGeneric classes: 15d. for more.\n\nChanged in version 3.12: Type parameter lists are new in Python 3.12.\n\n'Programmer's note:' Variables defined in the class definition are class\nattributes; they are shared by instances.  Instance attributes can be\nset in a method with 'self.name = value'.  Both class and instance\nattributes are accessible through the notation \"'self.name'\", and an\ninstance attribute hides a class attribute with the same name when\naccessed in this way.  Class attributes can be used as defaults for\ninstance attributes, but using mutable values there can lead to\nunexpected results.  *note Descriptors: a98. can be used to create\ninstance variables with different implementation details.\n\nSee also\n........\n\nPEP 3115(3) - Metaclasses in Python 3000\n\nThe proposal that changed the declaration of metaclasses to the\ncurrent syntax, and the semantics for how classes with metaclasses\nare constructed.\n\nPEP 3129(4) - Class Decorators\n\nThe proposal that added class decorators.  Function and method\ndecorators were introduced in PEP 318(5).\n\n---------- Footnotes ----------\n\n(1) A string literal appearing as the first statement in the class\nbody is transformed into the namespace's 'doc' item and therefore\nthe class's *note docstring: 1e2f.\n\n(2) https://peps.python.org/pep-0614/\n\n(3) https://peps.python.org/pep-3115/\n\n(4) https://peps.python.org/pep-3129/\n\n(5) https://peps.python.org/pep-0318/\n\nFile: python3.12.info,  Node: Coroutines<2>,  Next: Type parameter lists,  Prev: Class definitions,  Up: Compound statements\n\n\nNew in version 3.5.\n\n* Menu:\n\n* Coroutine function definition::\n* The async for statement::\n* The async with statement::\n\nFile: python3.12.info,  Node: Coroutine function definition,  Next: The async for statement,  Up: Coroutines<2>\n\n4.8.9.1 Coroutine function definition\n.....................................\n\nasyncfuncdef ::= [decorators] \"async\" \"def\" funcname \"(\" [parameterlist] \")\"\n[\"->\" expression] \":\" suite\n",
            "subsections": []
        },
        "Execution of Python coroutines can be suspended and resumed at many": {
            "content": "points (see *note coroutine: 1ae.).  *note await: 516. expressions,\n*note async for: 8e0. and *note async with: 399. can only be used in the\nbody of a coroutine function.\n",
            "subsections": []
        },
        "Functions defined with 'async def' syntax are always coroutine": {
            "content": "functions, even if they do not contain 'await' or 'async' keywords.\n\nIt is a *note SyntaxError: 146. to use a 'yield from' expression inside\nthe body of a coroutine function.\n\nAn example of a coroutine function:\n\nasync def func(param1, param2):\ndostuff()\nawait somecoroutine()\n",
            "subsections": []
        },
        "Changed in version 3.7: 'await' and 'async' are now keywords; previously": {
            "content": "they were only treated as such inside the body of a coroutine function.\n\nFile: python3.12.info,  Node: The async for statement,  Next: The async with statement,  Prev: Coroutine function definition,  Up: Coroutines<2>\n\n4.8.9.2 The 'async for' statement\n.................................\n\nasyncforstmt ::= \"async\" forstmt\n\nAn *note asynchronous iterable: bd2. provides an 'aiter' method that\ndirectly returns an *note asynchronous iterator: bd4, which can call\nasynchronous code in its 'anext' method.\n",
            "subsections": []
        },
        "The 'async for' statement allows convenient iteration over asynchronous": {
            "content": "iterables.\n\nThe following code:\n\nasync for TARGET in ITER:\nSUITE\nelse:\nSUITE2\n\nIs semantically equivalent to:\n\niter = (ITER)\niter = type(iter).aiter(iter)\nrunning = True\n\nwhile running:\ntry:\nTARGET = await type(iter).anext(iter)\nexcept StopAsyncIteration:\nrunning = False\nelse:\nSUITE\nelse:\nSUITE2\n\nSee also *note aiter(): a41. and *note anext(): 1c2a. for\ndetails.\n\nIt is a *note SyntaxError: 146. to use an 'async for' statement outside\nthe body of a coroutine function.\n\nFile: python3.12.info,  Node: The async with statement,  Prev: The async for statement,  Up: Coroutines<2>\n\n4.8.9.3 The 'async with' statement\n..................................\n\nasyncwithstmt ::= \"async\" withstmt\n\nAn *note asynchronous context manager: 39b. is a *note context manager:\n398. that is able to suspend execution in its 'enter' and 'exit'\nmethods.\n\nThe following code:\n\nasync with EXPRESSION as TARGET:\nSUITE\n\nis semantically equivalent to:\n\nmanager = (EXPRESSION)\naenter = type(manager).aenter\naexit = type(manager).aexit\nvalue = await aenter(manager)\nhitexcept = False\n\ntry:\nTARGET = value\nSUITE\nexcept:\nhitexcept = True\nif not await aexit(manager, *sys.excinfo()):\nraise\nfinally:\nif not hitexcept:\nawait aexit(manager, None, None, None)\n\nSee also *note aenter(): 1cd7. and *note aexit(): 1cd8. for\ndetails.\n\nIt is a *note SyntaxError: 146. to use an 'async with' statement outside\nthe body of a coroutine function.\n\nSee also\n........\n\nPEP 492(1) - Coroutines with async and await syntax\n\nThe proposal that made coroutines a proper standalone concept in\nPython, and added supporting syntax.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0492/\n\nFile: python3.12.info,  Node: Type parameter lists,  Prev: Coroutines<2>,  Up: Compound statements\n\n\nNew in version 3.12.\n\ntypeparams  ::= \"[\" typeparam (\",\" typeparam)* \"]\"\ntypeparam   ::= typevar | typevartuple | paramspec\ntypevar      ::= identifier (\":\" expression)?\ntypevartuple ::= \"*\" identifier\nparamspec    ::= \"\" identifier\n\n*note Functions: 12af. (including *note coroutines: 394.), *note\nclasses: 114c. and *note type aliases: 13a. may contain a type parameter\nlist:\n\ndef max[T](args: list[T]) -> T:\n...\n\nasync def amax[T](args: list[T]) -> T:\n...\n\nclass Bag[T]:\ndef iter(self) -> Iterator[T]:\n...\n\ndef add(self, arg: T) -> None:\n...\n\ntype ListOrSet[T] = list[T] | set[T]\n",
            "subsections": []
        },
        "Semantically, this indicates that the function, class, or type alias is": {
            "content": "generic over a type variable.  This information is primarily used by\nstatic type checkers, and at runtime, generic objects behave much like\ntheir non-generic counterparts.\n\nType parameters are declared in square brackets ('[]') immediately after\nthe name of the function, class, or type alias.  The type parameters are\naccessible within the scope of the generic object, but not elsewhere.\nThus, after a declaration 'def func[T](): pass', the name 'T' is not\navailable in the module scope.  Below, the semantics of generic objects\nare described with more precision.  The scope of type parameters is\nmodeled with a special function (technically, an *note annotation scope:\n167.) that wraps the creation of the generic object.\n",
            "subsections": []
        },
        "Generic functions, classes, and type aliases have a 'typeparams'": {
            "content": "attribute listing their type parameters.\n\nType parameters come in three kinds:\n\n* *note typing.TypeVar: 164, introduced by a plain name (e.g., 'T').\nSemantically, this represents a single type to a type checker.\n\n* *note typing.TypeVarTuple: 162, introduced by a name prefixed with\na single asterisk (e.g., '*Ts').  Semantically, this stands for a\ntuple of any number of types.\n\n* *note typing.ParamSpec: 163, introduced by a name prefixed with two\nasterisks (e.g., 'P').  Semantically, this stands for the\nparameters of a callable.\n\n*note typing.TypeVar: 164. declarations can define 'bounds' and\n'constraints' with a colon (':') followed by an expression.  A single\nexpression after the colon indicates a bound (e.g.  'T: int').",
            "subsections": []
        },
        "Semantically, this means that the 'typing.TypeVar' can only represent": {
            "content": "types that are a subtype of this bound.  A parenthesized tuple of\nexpressions after the colon indicates a set of constraints (e.g.  'T:\n(str, bytes)').  Each member of the tuple should be a type (again, this\nis not enforced at runtime).  Constrained type variables can only take\non one of the types in the list of constraints.\n",
            "subsections": []
        },
        "For 'typing.TypeVar's declared using the type parameter list syntax, the": {
            "content": "bound and constraints are not evaluated when the generic object is\ncreated, but only when the value is explicitly accessed through the\nattributes 'bound' and 'constraints'.  To accomplish this, the\nbounds or constraints are evaluated in a separate *note annotation\nscope: 167.\n\n*note typing.TypeVarTuple: 162.s and *note typing.ParamSpec: 163.s\ncannot have bounds or constraints.\n",
            "subsections": []
        },
        "The following example indicates the full set of allowed type parameter": {
            "content": "declarations:\n\ndef overlygeneric[\nSimpleTypeVar,\nTypeVarWithBound: int,\nTypeVarWithConstraints: (str, bytes),\n*SimpleTypeVarTuple,\nSimpleParamSpec,\n](\na: SimpleTypeVar,\nb: TypeVarWithBound,\nc: Callable[SimpleParamSpec, TypeVarWithConstraints],\n*d: SimpleTypeVarTuple,\n): ...\n\n* Menu:\n\n* Generic functions::\n* Generic classes::\n* Generic type aliases::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Generic functions,  Next: Generic classes,  Up: Type parameter lists": {
            "content": "4.8.10.1 Generic functions\n..........................\n\nGeneric functions are declared as follows:\n\ndef func[T](arg: T): ...\n\nThis syntax is equivalent to:\n\nannotation-def TYPEPARAMSOFfunc():\nT = typing.TypeVar(\"T\")\ndef func(arg: T): ...\nfunc.typeparams = (T,)\nreturn func\nfunc = TYPEPARAMSOFfunc()\n\nHere 'annotation-def' indicates an *note annotation scope: 167, which is\nnot actually bound to any name at runtime.  (One other liberty is taken\nin the translation: the syntax does not go through attribute access on\nthe *note typing: ff. module, but creates an instance of *note\ntyping.TypeVar: 164. directly.)\n",
            "subsections": []
        },
        "The annotations of generic functions are evaluated within the annotation": {
            "content": "scope used for declaring the type parameters, but the function's\ndefaults and decorators are not.\n",
            "subsections": []
        },
        "The following example illustrates the scoping rules for these cases, as": {
            "content": "well as for additional flavors of type parameters:\n\n@decorator\ndef func[T: int, *Ts, P](*args: *Ts, arg: Callable[P, T] = somedefault):\n...\n\nExcept for the *note lazy evaluation: 165. of the *note TypeVar: 164.\nbound, this is equivalent to:\n\nDEFAULTOFarg = somedefault\n\nannotation-def TYPEPARAMSOFfunc():\n\nannotation-def BOUNDOFT():\nreturn int\n# In reality, BOUNDOFT() is evaluated only on demand.\nT = typing.TypeVar(\"T\", bound=BOUNDOFT())\n\nTs = typing.TypeVarTuple(\"Ts\")\nP = typing.ParamSpec(\"P\")\n\ndef func(*args: *Ts, arg: Callable[P, T] = DEFAULTOFarg):\n...\n\nfunc.typeparams = (T, Ts, P)\nreturn func\nfunc = decorator(TYPEPARAMSOFfunc())\n",
            "subsections": []
        },
        "The capitalized names like 'DEFAULTOFarg' are not actually bound at": {
            "content": "runtime.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Generic classes,  Next: Generic type aliases,  Prev: Generic functions,  Up: Type parameter lists": {
            "content": "4.8.10.2 Generic classes\n........................\n\nGeneric classes are declared as follows:\n\nclass Bag[T]: ...\n\nThis syntax is equivalent to:\n\nannotation-def TYPEPARAMSOFBag():\nT = typing.TypeVar(\"T\")\nclass Bag(typing.Generic[T]):\ntypeparams = (T,)\n...\nreturn Bag\nBag = TYPEPARAMSOFBag()\n\nHere again 'annotation-def' (not a real keyword) indicates an *note\nannotation scope: 167, and the name 'TYPEPARAMSOFBag' is not actually\nbound at runtime.\n\nGeneric classes implicitly inherit from *note typing.Generic: 1453.  The\nbase classes and keyword arguments of generic classes are evaluated\nwithin the type scope for the type parameters, and decorators are\nevaluated outside that scope.  This is illustrated by this example:\n\n@decorator\nclass Bag(Base[T], arg=T): ...\n\nThis is equivalent to:\n\nannotation-def TYPEPARAMSOFBag():\nT = typing.TypeVar(\"T\")\nclass Bag(Base[T], typing.Generic[T], arg=T):\ntypeparams = (T,)\n...\nreturn Bag\nBag = decorator(TYPEPARAMSOFBag())\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Generic type aliases,  Prev: Generic classes,  Up: Type parameter lists": {
            "content": "4.8.10.3 Generic type aliases\n.............................\n\nThe *note type: 13a. statement can also be used to create a generic type\nalias:\n\ntype ListOrSet[T] = list[T] | set[T]\n\nExcept for the *note lazy evaluation: 165. of the value, this is\nequivalent to:\n\nannotation-def TYPEPARAMSOFListOrSet():\nT = typing.TypeVar(\"T\")\n\nannotation-def VALUEOFListOrSet():\nreturn list[T] | set[T]\n# In reality, the value is lazily evaluated\nreturn typing.TypeAliasType(\"ListOrSet\", VALUEOFListOrSet(), typeparams=(T,))\nListOrSet = TYPEPARAMSOFListOrSet()\n\nHere, 'annotation-def' (not a real keyword) indicates an *note\nannotation scope: 167.  The capitalized names like\n'TYPEPARAMSOFListOrSet' are not actually bound at runtime.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Top-level components,  Next: Full Grammar specification,  Prev: Compound statements,  Up: The Python Language Reference": {
            "content": "",
            "subsections": [
                {
                    "name": "4.9 Top-level components",
                    "content": ""
                }
            ]
        },
        "The Python interpreter can get its input from a number of sources: from": {
            "content": "a script passed to it as standard input or as program argument, typed in\ninteractively, from a module source file, etc.  This chapter gives the\nsyntax used in these cases.\n\n* Menu:\n\n* Complete Python programs::\n* File input::\n* Interactive input::\n* Expression input::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Complete Python programs,  Next: File input,  Up: Top-level components": {
            "content": "",
            "subsections": []
        },
        "While a language specification need not prescribe how the language": {
            "content": "interpreter is invoked, it is useful to have a notion of a complete",
            "subsections": []
        },
        "Python program.  A complete Python program is executed in a minimally": {
            "content": "initialized environment: all built-in and standard modules are\navailable, but none have been initialized, except for *note sys: d3.\n(various system services), *note builtins: 10. (built-in functions,\nexceptions and 'None') and *note main: 1.  The latter is used to\nprovide the local and global namespace for execution of the complete\nprogram.\n",
            "subsections": []
        },
        "The syntax for a complete Python program is that for file input,": {
            "content": "described in the next section.\n",
            "subsections": []
        },
        "The interpreter may also be invoked in interactive mode; in this case,": {
            "content": "it does not read and execute a complete program but reads and executes\none statement (possibly compound) at a time.  The initial environment is\nidentical to that of a complete program; each statement is executed in\nthe namespace of *note main: 1.\n\nA complete program can be passed to the interpreter in three forms: with\nthe *note -c: 3a4. 'string' command line option, as a file passed as the\nfirst command line argument, or as standard input.  If the file or\nstandard input is a tty device, the interpreter enters interactive mode;\notherwise, it executes the file as a complete program.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: File input,  Next: Interactive input,  Prev: Complete Python programs,  Up: Top-level components": {
            "content": "All input read from non-interactive files has the same form:\n\nfileinput ::= (NEWLINE | statement)*\n\nThis syntax is used in the following situations:\n\n* when parsing a complete Python program (from a file or from a\nstring);\n\n* when parsing a module;\n\n* when parsing a string passed to the *note exec(): 691. function;\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Interactive input,  Next: Expression input,  Prev: File input,  Up: Top-level components": {
            "content": "Input in interactive mode is parsed using the following grammar:\n\ninteractiveinput ::= [stmtlist] NEWLINE | compoundstmt NEWLINE\n",
            "subsections": []
        },
        "Note that a (top-level) compound statement must be followed by a blank": {
            "content": "line in interactive mode; this is needed to help the parser detect the\nend of the input.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Expression input,  Prev: Interactive input,  Up: Top-level components": {
            "content": "*note eval(): 690. is used for expression input.  It ignores leading\nwhitespace.  The string argument to *note eval(): 690. must have the\nfollowing form:\n\nevalinput ::= expressionlist NEWLINE*\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Full Grammar specification,  Prev: Top-level components,  Up: The Python Language Reference": {
            "content": "",
            "subsections": [
                {
                    "name": "4.10 Full Grammar specification",
                    "content": ""
                }
            ]
        },
        "This is the full Python grammar, derived directly from the grammar used": {
            "content": "to generate the CPython parser (see Grammar/python.gram(1)).  The\nversion here omits details related to code generation and error\nrecovery.\n\nThe notation is a mixture of EBNF(2) and PEG(3). In particular, '&'\nfollowed by a symbol, token or parenthesized group indicates a positive\nlookahead (i.e., is required to match but not consumed), while '!'\nindicates a negative lookahead (i.e., is required 'not' to match).  We\nuse the '|' separator to mean PEG's \"ordered choice\" (written as '/' in\ntraditional PEG grammars).  See PEP 617(4) for more details on the\ngrammar's syntax.\n\n# PEG grammar for Python\n\n@trailer '''\nvoid *\nPyPegenparse(Parser *p)\n{\n// Initialize keywords\np->keywords = reservedkeywords;\np->nkeywordlists = nkeywordlists;\np->softkeywords = softkeywords;\n\n// Run parser\nvoid *result = NULL;\nif (p->startrule == Pyfileinput) {\nresult = filerule(p);\n} else if (p->startrule == Pysingleinput) {\nresult = interactiverule(p);\n} else if (p->startrule == Pyevalinput) {\nresult = evalrule(p);\n} else if (p->startrule == Pyfunctypeinput) {\nresult = functyperule(p);\n}\n\nreturn result;\n}\n'''\n\n# ========================= START OF THE GRAMMAR =========================\n\n# General grammatical elements and rules:\n#\n# * Strings with double quotes (\") denote SOFT KEYWORDS\n# * Strings with single quotes (') denote KEYWORDS\n# * Upper case names (NAME) denote tokens in the Grammar/Tokens file\n# * Rule names starting with \"invalid\" are used for specialized syntax errors\n#     - These rules are NOT used in the first pass of the parser.\n#     - Only if the first pass fails to parse, a second pass including the invalid\n#       rules will be executed.\n#     - If the parser fails in the second phase with a generic syntax error, the\n#       location of the generic failure of the first pass will be used (this avoids\n#       reporting incorrect locations due to the invalid rules).\n#     - The order of the alternatives involving invalid rules matter\n#       (like any rule in PEG).\n#\n# Grammar Syntax (see PEP 617 for more information):\n#\n# rulename: expression\n#   Optionally, a type can be included right after the rule name, which\n#   specifies the return type of the C or Python function corresponding to the\n#   rule:\n# rulename[returntype]: expression\n#   If the return type is omitted, then a void * is returned in C and an Any in\n#   Python.\n# e1 e2\n#   Match e1, then match e2.\n# e1 | e2\n#   Match e1 or e2.\n#   The first alternative can also appear on the line after the rule name for\n#   formatting purposes. In that case, a | must be used before the first\n#   alternative, like so:\n#       rulename[returntype]:\n#            | firstalt\n#            | secondalt\n# ( e )\n#   Match e (allows also to use other operators in the group like '(e)*')\n# [ e ] or e?\n#   Optionally match e.\n# e*\n#   Match zero or more occurrences of e.\n# e+\n#   Match one or more occurrences of e.\n# s.e+\n#   Match one or more occurrences of e, separated by s. The generated parse tree\n#   does not include the separator. This is otherwise identical to (e (s e)*).\n# &e\n#   Succeed if e can be parsed, without consuming any input.\n# !e\n#   Fail if e can be parsed, without consuming any input.\n# ~\n#   Commit to the current alternative, even if it fails to parse.\n#\n\n# STARTING RULES\n# ==============\n\nfile[modty]: a=[statements] ENDMARKER { PyPegenmakemodule(p, a) }\ninteractive[modty]: a=statementnewline { PyASTInteractive(a, p->arena) }\neval[modty]: a=expressions NEWLINE* ENDMARKER { PyASTExpression(a, p->arena) }\nfunctype[modty]: '(' a=[typeexpressions] ')' '->' b=expression NEWLINE* ENDMARKER { PyASTFunctionType(a, b, p->arena) }\n\n# GENERAL STATEMENTS\n# ==================\n\nstatements[asdlstmtseq*]: a=statement+ { (asdlstmtseq*)PyPegenseqflatten(p, a) }\n\nstatement[asdlstmtseq*]: a=compoundstmt { (asdlstmtseq*)PyPegensingletonseq(p, a) } | a[asdlstmtseq*]=simplestmts { a }\n\nstatementnewline[asdlstmtseq*]:\n| a=compoundstmt NEWLINE { (asdlstmtseq*)PyPegensingletonseq(p, a) }\n| simplestmts\n| NEWLINE { (asdlstmtseq*)PyPegensingletonseq(p, CHECK(stmtty, PyASTPass(EXTRA))) }\n| ENDMARKER { PyPegeninteractiveexit(p) }\n\nsimplestmts[asdlstmtseq*]:\n| a=simplestmt !';' NEWLINE { (asdlstmtseq*)PyPegensingletonseq(p, a) } # Not needed, there for speedup\n| a[asdlstmtseq*]=';'.simplestmt+ [';'] NEWLINE { a }\n\n# NOTE: assignment MUST precede expression, else parsing a simple assignment\n# will throw a SyntaxError.\nsimplestmt[stmtty] (memo):\n| assignment\n| &\"type\" typealias\n| e=starexpressions { PyASTExpr(e, EXTRA) }\n| &'return' returnstmt\n| &('import' | 'from') importstmt\n| &'raise' raisestmt\n| 'pass' { PyASTPass(EXTRA) }\n| &'del' delstmt\n| &'yield' yieldstmt\n| &'assert' assertstmt\n| 'break' { PyASTBreak(EXTRA) }\n| 'continue' { PyASTContinue(EXTRA) }\n| &'global' globalstmt\n| &'nonlocal' nonlocalstmt\n\ncompoundstmt[stmtty]:\n| &('def' | '@' | ASYNC) functiondef\n| &'if' ifstmt\n| &('class' | '@') classdef\n| &('with' | ASYNC) withstmt\n| &('for' | ASYNC) forstmt\n| &'try' trystmt\n| &'while' whilestmt\n| matchstmt\n\n# SIMPLE STATEMENTS\n# =================\n\n# NOTE: annotatedrhs may start with 'yield'; yieldexpr must start with 'yield'\nassignment[stmtty]:\n| a=NAME ':' b=expression c=['=' d=annotatedrhs { d }] {\nCHECKVERSION(\nstmtty,\n6,\n\"Variable annotation syntax is\",\nPyASTAnnAssign(CHECK(exprty, PyPegensetexprcontext(p, a, Store)), b, c, 1, EXTRA)\n) }\n| a=('(' b=singletarget ')' { b }\n| singlesubscriptattributetarget) ':' b=expression c=['=' d=annotatedrhs { d }] {\nCHECKVERSION(stmtty, 6, \"Variable annotations syntax is\", PyASTAnnAssign(a, b, c, 0, EXTRA)) }\n| a[asdlexprseq*]=(z=startargets '=' { z })+ b=(yieldexpr | starexpressions) !'=' tc=[TYPECOMMENT] {\nPyASTAssign(a, b, NEWTYPECOMMENT(p, tc), EXTRA) }\n| a=singletarget b=augassign ~ c=(yieldexpr | starexpressions) {\nPyASTAugAssign(a, b->kind, c, EXTRA) }\n| invalidassignment\n\nannotatedrhs[exprty]: yieldexpr | starexpressions\n\naugassign[AugOperator*]:\n| '+=' { PyPegenaugoperator(p, Add) }\n| '-=' { PyPegenaugoperator(p, Sub) }\n| '*=' { PyPegenaugoperator(p, Mult) }\n| '@=' { CHECKVERSION(AugOperator*, 5, \"The '@' operator is\", PyPegenaugoperator(p, MatMult)) }\n| '/=' { PyPegenaugoperator(p, Div) }\n| '%=' { PyPegenaugoperator(p, Mod) }\n| '&=' { PyPegenaugoperator(p, BitAnd) }\n| '|=' { PyPegenaugoperator(p, BitOr) }\n| '^=' { PyPegenaugoperator(p, BitXor) }\n| '<<=' { PyPegenaugoperator(p, LShift) }\n| '>>=' { PyPegenaugoperator(p, RShift) }\n| '=' { PyPegenaugoperator(p, Pow) }\n| '//=' { PyPegenaugoperator(p, FloorDiv) }\n\nreturnstmt[stmtty]:\n| 'return' a=[starexpressions] { PyASTReturn(a, EXTRA) }\n\nraisestmt[stmtty]:\n| 'raise' a=expression b=['from' z=expression { z }] { PyASTRaise(a, b, EXTRA) }\n| 'raise' { PyASTRaise(NULL, NULL, EXTRA) }\n\nglobalstmt[stmtty]: 'global' a[asdlexprseq*]=','.NAME+ {\nPyASTGlobal(CHECK(asdlidentifierseq*, PyPegenmapnamestoids(p, a)), EXTRA) }\n\nnonlocalstmt[stmtty]: 'nonlocal' a[asdlexprseq*]=','.NAME+ {\nPyASTNonlocal(CHECK(asdlidentifierseq*, PyPegenmapnamestoids(p, a)), EXTRA) }\n\ndelstmt[stmtty]:\n| 'del' a=deltargets &(';' | NEWLINE) { PyASTDelete(a, EXTRA) }\n| invaliddelstmt\n\nyieldstmt[stmtty]: y=yieldexpr { PyASTExpr(y, EXTRA) }\n\nassertstmt[stmtty]: 'assert' a=expression b=[',' z=expression { z }] { PyASTAssert(a, b, EXTRA) }\n\nimportstmt[stmtty]:\n| invalidimport\n| importname\n| importfrom\n\n# Import statements\n# -----------------\n\nimportname[stmtty]: 'import' a=dottedasnames { PyASTImport(a, EXTRA) }\n# note below: the ('.' | '...') is necessary because '...' is tokenized as ELLIPSIS\nimportfrom[stmtty]:\n| 'from' a=('.' | '...')* b=dottedname 'import' c=importfromtargets {\nPyASTImportFrom(b->v.Name.id, c, PyPegenseqcountdots(a), EXTRA) }\n| 'from' a=('.' | '...')+ 'import' b=importfromtargets {\nPyASTImportFrom(NULL, b, PyPegenseqcountdots(a), EXTRA) }\nimportfromtargets[asdlaliasseq*]:\n| '(' a=importfromasnames [','] ')' { a }\n| importfromasnames !','\n| '*' { (asdlaliasseq*)PyPegensingletonseq(p, CHECK(aliasty, PyPegenaliasforstar(p, EXTRA))) }\n| invalidimportfromtargets\nimportfromasnames[asdlaliasseq*]:\n| a[asdlaliasseq*]=','.importfromasname+ { a }\nimportfromasname[aliasty]:\n| a=NAME b=['as' z=NAME { z }] { PyASTalias(a->v.Name.id,\n(b) ? ((exprty) b)->v.Name.id : NULL,\nEXTRA) }\ndottedasnames[asdlaliasseq*]:\n| a[asdlaliasseq*]=','.dottedasname+ { a }\ndottedasname[aliasty]:\n| a=dottedname b=['as' z=NAME { z }] { PyASTalias(a->v.Name.id,\n(b) ? ((exprty) b)->v.Name.id : NULL,\nEXTRA) }\ndottedname[exprty]:\n| a=dottedname '.' b=NAME { PyPegenjoinnameswithdot(p, a, b) }\n| NAME\n\n# COMPOUND STATEMENTS\n# ===================\n\n# Common elements\n# ---------------\n\nblock[asdlstmtseq*] (memo):\n| NEWLINE INDENT a=statements DEDENT { a }\n| simplestmts\n| invalidblock\n\ndecorators[asdlexprseq*]: a[asdlexprseq*]=('@' f=namedexpression NEWLINE { f })+ { a }\n\n# Class definitions\n# -----------------\n\nclassdef[stmtty]:\n| a=decorators b=classdefraw { PyPegenclassdefdecorators(p, a, b) }\n| classdefraw\n\nclassdefraw[stmtty]:\n| invalidclassdefraw\n| 'class' a=NAME t=[typeparams] b=['(' z=[arguments] ')' { z }] ':' c=block {\nPyASTClassDef(a->v.Name.id,\n(b) ? ((exprty) b)->v.Call.args : NULL,\n(b) ? ((exprty) b)->v.Call.keywords : NULL,\nc, NULL, t, EXTRA) }\n\n# Function definitions\n# --------------------\n\nfunctiondef[stmtty]:\n| d=decorators f=functiondefraw { PyPegenfunctiondefdecorators(p, d, f) }\n| functiondefraw\n\nfunctiondefraw[stmtty]:\n| invaliddefraw\n| 'def' n=NAME t=[typeparams] &&'(' params=[params] ')' a=['->' z=expression { z }] &&':' tc=[functypecomment] b=block {\nPyASTFunctionDef(n->v.Name.id,\n(params) ? params : CHECK(argumentsty, PyPegenemptyarguments(p)),\nb, NULL, a, NEWTYPECOMMENT(p, tc), t, EXTRA) }\n| ASYNC 'def' n=NAME t=[typeparams] &&'(' params=[params] ')' a=['->' z=expression { z }] &&':' tc=[functypecomment] b=block {\nCHECKVERSION(\nstmtty,\n5,\n\"Async functions are\",\nPyASTAsyncFunctionDef(n->v.Name.id,\n(params) ? params : CHECK(argumentsty, PyPegenemptyarguments(p)),\nb, NULL, a, NEWTYPECOMMENT(p, tc), t, EXTRA)\n) }\n\n# Function parameters\n# -------------------\n\nparams[argumentsty]:\n| invalidparameters\n| parameters\n\nparameters[argumentsty]:\n| a=slashnodefault b[asdlargseq*]=paramnodefault* c=paramwithdefault* d=[staretc] {\nCHECKVERSION(argumentsty, 8, \"Positional-only parameters are\", PyPegenmakearguments(p, a, NULL, b, c, d)) }\n| a=slashwithdefault b=paramwithdefault* c=[staretc] {\nCHECKVERSION(argumentsty, 8, \"Positional-only parameters are\", PyPegenmakearguments(p, NULL, a, NULL, b, c)) }\n| a[asdlargseq*]=paramnodefault+ b=paramwithdefault* c=[staretc] {\nPyPegenmakearguments(p, NULL, NULL, a, b, c) }\n| a=paramwithdefault+ b=[staretc] { PyPegenmakearguments(p, NULL, NULL, NULL, a, b)}\n| a=staretc { PyPegenmakearguments(p, NULL, NULL, NULL, NULL, a) }\n\n# Some duplication here because we can't write (',' | &')'),\n# which is because we don't support empty alternatives (yet).\n\nslashnodefault[asdlargseq*]:\n| a[asdlargseq*]=paramnodefault+ '/' ',' { a }\n| a[asdlargseq*]=paramnodefault+ '/' &')' { a }\nslashwithdefault[SlashWithDefault*]:\n| a=paramnodefault* b=paramwithdefault+ '/' ',' { PyPegenslashwithdefault(p, (asdlargseq *)a, b) }\n| a=paramnodefault* b=paramwithdefault+ '/' &')' { PyPegenslashwithdefault(p, (asdlargseq *)a, b) }\n\nstaretc[StarEtc*]:\n| invalidstaretc\n| '*' a=paramnodefault b=parammaybedefault* c=[kwds] {\nPyPegenstaretc(p, a, b, c) }\n| '*' a=paramnodefaultstarannotation b=parammaybedefault* c=[kwds] {\nPyPegenstaretc(p, a, b, c) }\n| '*' ',' b=parammaybedefault+ c=[kwds] {\nPyPegenstaretc(p, NULL, b, c) }\n| a=kwds { PyPegenstaretc(p, NULL, NULL, a) }\n\nkwds[argty]:\n| invalidkwds\n| '' a=paramnodefault { a }\n\n# One parameter.  This *includes* a following comma and type comment.\n#\n# There are three styles:\n# - No default\n# - With default\n# - Maybe with default\n#\n# There are two alternative forms of each, to deal with type comments:\n# - Ends in a comma followed by an optional type comment\n# - No comma, optional type comment, must be followed by close paren\n# The latter form is for a final parameter without trailing comma.\n#\n\nparamnodefault[argty]:\n| a=param ',' tc=TYPECOMMENT? { PyPegenaddtypecommenttoarg(p, a, tc) }\n| a=param tc=TYPECOMMENT? &')' { PyPegenaddtypecommenttoarg(p, a, tc) }\nparamnodefaultstarannotation[argty]:\n| a=paramstarannotation ',' tc=TYPECOMMENT? { PyPegenaddtypecommenttoarg(p, a, tc) }\n| a=paramstarannotation tc=TYPECOMMENT? &')' { PyPegenaddtypecommenttoarg(p, a, tc) }\nparamwithdefault[NameDefaultPair*]:\n| a=param c=default ',' tc=TYPECOMMENT? { PyPegennamedefaultpair(p, a, c, tc) }\n| a=param c=default tc=TYPECOMMENT? &')' { PyPegennamedefaultpair(p, a, c, tc) }\nparammaybedefault[NameDefaultPair*]:\n| a=param c=default? ',' tc=TYPECOMMENT? { PyPegennamedefaultpair(p, a, c, tc) }\n| a=param c=default? tc=TYPECOMMENT? &')' { PyPegennamedefaultpair(p, a, c, tc) }\nparam[argty]: a=NAME b=annotation? { PyASTarg(a->v.Name.id, b, NULL, EXTRA) }\nparamstarannotation[argty]: a=NAME b=starannotation { PyASTarg(a->v.Name.id, b, NULL, EXTRA) }\nannotation[exprty]: ':' a=expression { a }\nstarannotation[exprty]: ':' a=starexpression { a }\ndefault[exprty]: '=' a=expression { a } | invaliddefault\n\n# If statement\n# ------------\n\nifstmt[stmtty]:\n| invalidifstmt\n| 'if' a=namedexpression ':' b=block c=elifstmt {\nPyASTIf(a, b, CHECK(asdlstmtseq*, PyPegensingletonseq(p, c)), EXTRA) }\n| 'if' a=namedexpression ':' b=block c=[elseblock] { PyASTIf(a, b, c, EXTRA) }\nelifstmt[stmtty]:\n| invalidelifstmt\n| 'elif' a=namedexpression ':' b=block c=elifstmt {\nPyASTIf(a, b, CHECK(asdlstmtseq*, PyPegensingletonseq(p, c)), EXTRA) }\n| 'elif' a=namedexpression ':' b=block c=[elseblock] { PyASTIf(a, b, c, EXTRA) }\nelseblock[asdlstmtseq*]:\n| invalidelsestmt\n| 'else' &&':' b=block { b }\n\n# While statement\n# ---------------\n\nwhilestmt[stmtty]:\n| invalidwhilestmt\n| 'while' a=namedexpression ':' b=block c=[elseblock] { PyASTWhile(a, b, c, EXTRA) }\n\n# For statement\n# -------------\n\nforstmt[stmtty]:\n| invalidforstmt\n| 'for' t=startargets 'in' ~ ex=starexpressions ':' tc=[TYPECOMMENT] b=block el=[elseblock] {\nPyASTFor(t, ex, b, el, NEWTYPECOMMENT(p, tc), EXTRA) }\n| ASYNC 'for' t=startargets 'in' ~ ex=starexpressions ':' tc=[TYPECOMMENT] b=block el=[elseblock] {\nCHECKVERSION(stmtty, 5, \"Async for loops are\", PyASTAsyncFor(t, ex, b, el, NEWTYPECOMMENT(p, tc), EXTRA)) }\n| invalidfortarget\n\n# With statement\n# --------------\n\nwithstmt[stmtty]:\n| invalidwithstmtindent\n| 'with' '(' a[asdlwithitemseq*]=','.withitem+ ','? ')' ':' b=block {\nPyASTWith(a, b, NULL, EXTRA) }\n| 'with' a[asdlwithitemseq*]=','.withitem+ ':' tc=[TYPECOMMENT] b=block {\nPyASTWith(a, b, NEWTYPECOMMENT(p, tc), EXTRA) }\n| ASYNC 'with' '(' a[asdlwithitemseq*]=','.withitem+ ','? ')' ':' b=block {\nCHECKVERSION(stmtty, 5, \"Async with statements are\", PyASTAsyncWith(a, b, NULL, EXTRA)) }\n| ASYNC 'with' a[asdlwithitemseq*]=','.withitem+ ':' tc=[TYPECOMMENT] b=block {\nCHECKVERSION(stmtty, 5, \"Async with statements are\", PyASTAsyncWith(a, b, NEWTYPECOMMENT(p, tc), EXTRA)) }\n| invalidwithstmt\n\nwithitem[withitemty]:\n| e=expression 'as' t=startarget &(',' | ')' | ':') { PyASTwithitem(e, t, p->arena) }\n| invalidwithitem\n| e=expression { PyASTwithitem(e, NULL, p->arena) }\n\n# Try statement\n# -------------\n\ntrystmt[stmtty]:\n| invalidtrystmt\n| 'try' &&':' b=block f=finallyblock { PyASTTry(b, NULL, NULL, f, EXTRA) }\n| 'try' &&':' b=block ex[asdlexcepthandlerseq*]=exceptblock+ el=[elseblock] f=[finallyblock] { PyASTTry(b, ex, el, f, EXTRA) }\n| 'try' &&':' b=block ex[asdlexcepthandlerseq*]=exceptstarblock+ el=[elseblock] f=[finallyblock] {\nCHECKVERSION(stmtty, 11, \"Exception groups are\",\nPyASTTryStar(b, ex, el, f, EXTRA)) }\n\n\n# Except statement\n# ----------------\n\nexceptblock[excepthandlerty]:\n| invalidexceptstmtindent\n| 'except' e=expression t=['as' z=NAME { z }] ':' b=block {\nPyASTExceptHandler(e, (t) ? ((exprty) t)->v.Name.id : NULL, b, EXTRA) }\n| 'except' ':' b=block { PyASTExceptHandler(NULL, NULL, b, EXTRA) }\n| invalidexceptstmt\nexceptstarblock[excepthandlerty]:\n| invalidexceptstarstmtindent\n| 'except' '*' e=expression t=['as' z=NAME { z }] ':' b=block {\nPyASTExceptHandler(e, (t) ? ((exprty) t)->v.Name.id : NULL, b, EXTRA) }\n| invalidexceptstmt\nfinallyblock[asdlstmtseq*]:\n| invalidfinallystmt\n| 'finally' &&':' a=block { a }\n\n# Match statement\n# ---------------\n\nmatchstmt[stmtty]:\n| \"match\" subject=subjectexpr ':' NEWLINE INDENT cases[asdlmatchcaseseq*]=caseblock+ DEDENT {\nCHECKVERSION(stmtty, 10, \"Pattern matching is\", PyASTMatch(subject, cases, EXTRA)) }\n| invalidmatchstmt\n\nsubjectexpr[exprty]:\n| value=starnamedexpression ',' values=starnamedexpressions? {\nPyASTTuple(CHECK(asdlexprseq*, PyPegenseqinsertinfront(p, value, values)), Load, EXTRA) }\n| namedexpression\n\ncaseblock[matchcasety]:\n| invalidcaseblock\n| \"case\" pattern=patterns guard=guard? ':' body=block {\nPyASTmatchcase(pattern, guard, body, p->arena) }\n\nguard[exprty]: 'if' guard=namedexpression { guard }\n\npatterns[patternty]:\n| patterns[asdlpatternseq*]=opensequencepattern {\nPyASTMatchSequence(patterns, EXTRA) }\n| pattern\n\npattern[patternty]:\n| aspattern\n| orpattern\n\naspattern[patternty]:\n| pattern=orpattern 'as' target=patterncapturetarget {\nPyASTMatchAs(pattern, target->v.Name.id, EXTRA) }\n| invalidaspattern\n\norpattern[patternty]:\n| patterns[asdlpatternseq*]='|'.closedpattern+ {\nasdlseqLEN(patterns) == 1 ? asdlseqGET(patterns, 0) : PyASTMatchOr(patterns, EXTRA) }\n\nclosedpattern[patternty] (memo):\n| literalpattern\n| capturepattern\n| wildcardpattern\n| valuepattern\n| grouppattern\n| sequencepattern\n| mappingpattern\n| classpattern\n\n# Literal patterns are used for equality and identity constraints\nliteralpattern[patternty]:\n| value=signednumber !('+' | '-') { PyASTMatchValue(value, EXTRA) }\n| value=complexnumber { PyASTMatchValue(value, EXTRA) }\n| value=strings { PyASTMatchValue(value, EXTRA) }\n| 'None' { PyASTMatchSingleton(PyNone, EXTRA) }\n| 'True' { PyASTMatchSingleton(PyTrue, EXTRA) }\n| 'False' { PyASTMatchSingleton(PyFalse, EXTRA) }\n\n# Literal expressions are used to restrict permitted mapping pattern keys\nliteralexpr[exprty]:\n| signednumber !('+' | '-')\n| complexnumber\n| strings\n| 'None' { PyASTConstant(PyNone, NULL, EXTRA) }\n| 'True' { PyASTConstant(PyTrue, NULL, EXTRA) }\n| 'False' { PyASTConstant(PyFalse, NULL, EXTRA) }\n\ncomplexnumber[exprty]:\n| real=signedrealnumber '+' imag=imaginarynumber {\nPyASTBinOp(real, Add, imag, EXTRA) }\n| real=signedrealnumber '-' imag=imaginarynumber  {\nPyASTBinOp(real, Sub, imag, EXTRA) }\n\nsignednumber[exprty]:\n| NUMBER\n| '-' number=NUMBER { PyASTUnaryOp(USub, number, EXTRA) }\n\nsignedrealnumber[exprty]:\n| realnumber\n| '-' real=realnumber { PyASTUnaryOp(USub, real, EXTRA) }\n\nrealnumber[exprty]:\n| real=NUMBER { PyPegenensurereal(p, real) }\n\nimaginarynumber[exprty]:\n| imag=NUMBER { PyPegenensureimaginary(p, imag) }\n\ncapturepattern[patternty]:\n| target=patterncapturetarget { PyASTMatchAs(NULL, target->v.Name.id, EXTRA) }\n\npatterncapturetarget[exprty]:\n| !\"\" name=NAME !('.' | '(' | '=') {\nPyPegensetexprcontext(p, name, Store) }\n\nwildcardpattern[patternty]:\n| \"\" { PyASTMatchAs(NULL, NULL, EXTRA) }\n\nvaluepattern[patternty]:\n| attr=attr !('.' | '(' | '=') { PyASTMatchValue(attr, EXTRA) }\n\nattr[exprty]:\n| value=nameorattr '.' attr=NAME {\nPyASTAttribute(value, attr->v.Name.id, Load, EXTRA) }\n\nnameorattr[exprty]:\n| attr\n| NAME\n\ngrouppattern[patternty]:\n| '(' pattern=pattern ')' { pattern }\n\nsequencepattern[patternty]:\n| '[' patterns=maybesequencepattern? ']' { PyASTMatchSequence(patterns, EXTRA) }\n| '(' patterns=opensequencepattern? ')' { PyASTMatchSequence(patterns, EXTRA) }\n\nopensequencepattern[asdlseq*]:\n| pattern=maybestarpattern ',' patterns=maybesequencepattern? {\nPyPegenseqinsertinfront(p, pattern, patterns) }\n\nmaybesequencepattern[asdlseq*]:\n| patterns=','.maybestarpattern+ ','? { patterns }\n\nmaybestarpattern[patternty]:\n| starpattern\n| pattern\n\nstarpattern[patternty] (memo):\n| '*' target=patterncapturetarget {\nPyASTMatchStar(target->v.Name.id, EXTRA) }\n| '*' wildcardpattern {\nPyASTMatchStar(NULL, EXTRA) }\n\nmappingpattern[patternty]:\n| '{' '}' {\nPyASTMatchMapping(NULL, NULL, NULL, EXTRA) }\n| '{' rest=doublestarpattern ','? '}' {\nPyASTMatchMapping(NULL, NULL, rest->v.Name.id, EXTRA) }\n| '{' items=itemspattern ',' rest=doublestarpattern ','? '}' {\nPyASTMatchMapping(\nCHECK(asdlexprseq*, PyPegengetpatternkeys(p, items)),\nCHECK(asdlpatternseq*, PyPegengetpatterns(p, items)),\nrest->v.Name.id,\nEXTRA) }\n| '{' items=itemspattern ','? '}' {\nPyASTMatchMapping(\nCHECK(asdlexprseq*, PyPegengetpatternkeys(p, items)),\nCHECK(asdlpatternseq*, PyPegengetpatterns(p, items)),\nNULL,\nEXTRA) }\n\nitemspattern[asdlseq*]:\n| ','.keyvaluepattern+\n\nkeyvaluepattern[KeyPatternPair*]:\n| key=(literalexpr | attr) ':' pattern=pattern {\nPyPegenkeypatternpair(p, key, pattern) }\n\ndoublestarpattern[exprty]:\n| '' target=patterncapturetarget { target }\n\nclasspattern[patternty]:\n| cls=nameorattr '(' ')' {\nPyASTMatchClass(cls, NULL, NULL, NULL, EXTRA) }\n| cls=nameorattr '(' patterns=positionalpatterns ','? ')' {\nPyASTMatchClass(cls, patterns, NULL, NULL, EXTRA) }\n| cls=nameorattr '(' keywords=keywordpatterns ','? ')' {\nPyASTMatchClass(\ncls, NULL,\nCHECK(asdlidentifierseq*, PyPegenmapnamestoids(p,\nCHECK(asdlexprseq*, PyPegengetpatternkeys(p, keywords)))),\nCHECK(asdlpatternseq*, PyPegengetpatterns(p, keywords)),\nEXTRA) }\n| cls=nameorattr '(' patterns=positionalpatterns ',' keywords=keywordpatterns ','? ')' {\nPyASTMatchClass(\ncls,\npatterns,\nCHECK(asdlidentifierseq*, PyPegenmapnamestoids(p,\nCHECK(asdlexprseq*, PyPegengetpatternkeys(p, keywords)))),\nCHECK(asdlpatternseq*, PyPegengetpatterns(p, keywords)),\nEXTRA) }\n| invalidclasspattern\n\npositionalpatterns[asdlpatternseq*]:\n| args[asdlpatternseq*]=','.pattern+ { args }\n\nkeywordpatterns[asdlseq*]:\n| ','.keywordpattern+\n\nkeywordpattern[KeyPatternPair*]:\n| arg=NAME '=' value=pattern { PyPegenkeypatternpair(p, arg, value) }\n\n# Type statement\n# ---------------\n\ntypealias[stmtty]:\n| \"type\" n=NAME t=[typeparams] '=' b=expression {\nCHECKVERSION(stmtty, 12, \"Type statement is\",\nPyASTTypeAlias(CHECK(exprty, PyPegensetexprcontext(p, n, Store)), t, b, EXTRA)) }\n\n# Type parameter declaration\n# --------------------------\n\ntypeparams[asdltypeparamseq*]: '[' t=typeparamseq  ']' {\nCHECKVERSION(asdltypeparamseq *, 12, \"Type parameter lists are\", t) }\n\ntypeparamseq[asdltypeparamseq*]: a[asdltypeparamseq*]=','.typeparam+ [','] { a }\n\ntypeparam[typeparamty] (memo):\n| a=NAME b=[typeparambound] { PyASTTypeVar(a->v.Name.id, b, EXTRA) }\n| '*' a=NAME colon=':' e=expression {\nRAISESYNTAXERRORSTARTINGFROM(colon, e->kind == Tuplekind\n? \"cannot use constraints with TypeVarTuple\"\n: \"cannot use bound with TypeVarTuple\")\n}\n| '*' a=NAME { PyASTTypeVarTuple(a->v.Name.id, EXTRA) }\n| '' a=NAME colon=':' e=expression {\nRAISESYNTAXERRORSTARTINGFROM(colon, e->kind == Tuplekind\n? \"cannot use constraints with ParamSpec\"\n: \"cannot use bound with ParamSpec\")\n}\n| '' a=NAME { PyASTParamSpec(a->v.Name.id, EXTRA) }\n\ntypeparambound[exprty]: ':' e=expression { e }\n\n# EXPRESSIONS\n# -----------\n\nexpressions[exprty]:\n| a=expression b=(',' c=expression { c })+ [','] {\nPyASTTuple(CHECK(asdlexprseq*, PyPegenseqinsertinfront(p, a, b)), Load, EXTRA) }\n| a=expression ',' { PyASTTuple(CHECK(asdlexprseq*, PyPegensingletonseq(p, a)), Load, EXTRA) }\n| expression\n\nexpression[exprty] (memo):\n| invalidexpression\n| invalidlegacyexpression\n| a=disjunction 'if' b=disjunction 'else' c=expression { PyASTIfExp(b, a, c, EXTRA) }\n| disjunction\n| lambdef\n\nyieldexpr[exprty]:\n| 'yield' 'from' a=expression { PyASTYieldFrom(a, EXTRA) }\n| 'yield' a=[starexpressions] { PyASTYield(a, EXTRA) }\n\nstarexpressions[exprty]:\n| a=starexpression b=(',' c=starexpression { c })+ [','] {\nPyASTTuple(CHECK(asdlexprseq*, PyPegenseqinsertinfront(p, a, b)), Load, EXTRA) }\n| a=starexpression ',' { PyASTTuple(CHECK(asdlexprseq*, PyPegensingletonseq(p, a)), Load, EXTRA) }\n| starexpression\n\nstarexpression[exprty] (memo):\n| '*' a=bitwiseor { PyASTStarred(a, Load, EXTRA) }\n| expression\n\nstarnamedexpressions[asdlexprseq*]: a[asdlexprseq*]=','.starnamedexpression+ [','] { a }\n\nstarnamedexpression[exprty]:\n| '*' a=bitwiseor { PyASTStarred(a, Load, EXTRA) }\n| namedexpression\n\nassignmentexpression[exprty]:\n| a=NAME ':=' ~ b=expression {\nCHECKVERSION(exprty, 8, \"Assignment expressions are\",\nPyASTNamedExpr(CHECK(exprty, PyPegensetexprcontext(p, a, Store)), b, EXTRA)) }\n\nnamedexpression[exprty]:\n| assignmentexpression\n| invalidnamedexpression\n| expression !':='\n\ndisjunction[exprty] (memo):\n| a=conjunction b=('or' c=conjunction { c })+ { PyASTBoolOp(\nOr,\nCHECK(asdlexprseq*, PyPegenseqinsertinfront(p, a, b)),\nEXTRA) }\n| conjunction\n\nconjunction[exprty] (memo):\n| a=inversion b=('and' c=inversion { c })+ { PyASTBoolOp(\nAnd,\nCHECK(asdlexprseq*, PyPegenseqinsertinfront(p, a, b)),\nEXTRA) }\n| inversion\n\ninversion[exprty] (memo):\n| 'not' a=inversion { PyASTUnaryOp(Not, a, EXTRA) }\n| comparison\n\n# Comparison operators\n# --------------------\n\ncomparison[exprty]:\n| a=bitwiseor b=compareopbitwiseorpair+ {\nPyASTCompare(\na,\nCHECK(asdlintseq*, PyPegengetcmpops(p, b)),\nCHECK(asdlexprseq*, PyPegengetexprs(p, b)),\nEXTRA) }\n| bitwiseor\n\ncompareopbitwiseorpair[CmpopExprPair*]:\n| eqbitwiseor\n| noteqbitwiseor\n| ltebitwiseor\n| ltbitwiseor\n| gtebitwiseor\n| gtbitwiseor\n| notinbitwiseor\n| inbitwiseor\n| isnotbitwiseor\n| isbitwiseor\n\neqbitwiseor[CmpopExprPair*]: '==' a=bitwiseor { PyPegencmpopexprpair(p, Eq, a) }\nnoteqbitwiseor[CmpopExprPair*]:\n| (tok='!=' { PyPegencheckbarryasflufl(p, tok) ? NULL : tok}) a=bitwiseor {PyPegencmpopexprpair(p, NotEq, a) }\nltebitwiseor[CmpopExprPair*]: '<=' a=bitwiseor { PyPegencmpopexprpair(p, LtE, a) }\nltbitwiseor[CmpopExprPair*]: '<' a=bitwiseor { PyPegencmpopexprpair(p, Lt, a) }\ngtebitwiseor[CmpopExprPair*]: '>=' a=bitwiseor { PyPegencmpopexprpair(p, GtE, a) }\ngtbitwiseor[CmpopExprPair*]: '>' a=bitwiseor { PyPegencmpopexprpair(p, Gt, a) }\nnotinbitwiseor[CmpopExprPair*]: 'not' 'in' a=bitwiseor { PyPegencmpopexprpair(p, NotIn, a) }\ninbitwiseor[CmpopExprPair*]: 'in' a=bitwiseor { PyPegencmpopexprpair(p, In, a) }\nisnotbitwiseor[CmpopExprPair*]: 'is' 'not' a=bitwiseor { PyPegencmpopexprpair(p, IsNot, a) }\nisbitwiseor[CmpopExprPair*]: 'is' a=bitwiseor { PyPegencmpopexprpair(p, Is, a) }\n\n# Bitwise operators\n# -----------------\n\nbitwiseor[exprty]:\n| a=bitwiseor '|' b=bitwisexor { PyASTBinOp(a, BitOr, b, EXTRA) }\n| bitwisexor\n\nbitwisexor[exprty]:\n| a=bitwisexor '^' b=bitwiseand { PyASTBinOp(a, BitXor, b, EXTRA) }\n| bitwiseand\n\nbitwiseand[exprty]:\n| a=bitwiseand '&' b=shiftexpr { PyASTBinOp(a, BitAnd, b, EXTRA) }\n| shiftexpr\n\nshiftexpr[exprty]:\n| a=shiftexpr '<<' b=sum { PyASTBinOp(a, LShift, b, EXTRA) }\n| a=shiftexpr '>>' b=sum { PyASTBinOp(a, RShift, b, EXTRA) }\n| sum\n\n# Arithmetic operators\n# --------------------\n\nsum[exprty]:\n| a=sum '+' b=term { PyASTBinOp(a, Add, b, EXTRA) }\n| a=sum '-' b=term { PyASTBinOp(a, Sub, b, EXTRA) }\n| term\n\nterm[exprty]:\n| a=term '*' b=factor { PyASTBinOp(a, Mult, b, EXTRA) }\n| a=term '/' b=factor { PyASTBinOp(a, Div, b, EXTRA) }\n| a=term '//' b=factor { PyASTBinOp(a, FloorDiv, b, EXTRA) }\n| a=term '%' b=factor { PyASTBinOp(a, Mod, b, EXTRA) }\n| a=term '@' b=factor { CHECKVERSION(exprty, 5, \"The '@' operator is\", PyASTBinOp(a, MatMult, b, EXTRA)) }\n| factor\n\nfactor[exprty] (memo):\n| '+' a=factor { PyASTUnaryOp(UAdd, a, EXTRA) }\n| '-' a=factor { PyASTUnaryOp(USub, a, EXTRA) }\n| '~' a=factor { PyASTUnaryOp(Invert, a, EXTRA) }\n| power\n\npower[exprty]:\n| a=awaitprimary '' b=factor { PyASTBinOp(a, Pow, b, EXTRA) }\n| awaitprimary\n\n# Primary elements\n# ----------------\n\n# Primary elements are things like \"obj.something.something\", \"obj[something]\", \"obj(something)\", \"obj\" ...\n\nawaitprimary[exprty] (memo):\n| AWAIT a=primary { CHECKVERSION(exprty, 5, \"Await expressions are\", PyASTAwait(a, EXTRA)) }\n| primary\n\nprimary[exprty]:\n| a=primary '.' b=NAME { PyASTAttribute(a, b->v.Name.id, Load, EXTRA) }\n| a=primary b=genexp { PyASTCall(a, CHECK(asdlexprseq*, (asdlexprseq*)PyPegensingletonseq(p, b)), NULL, EXTRA) }\n| a=primary '(' b=[arguments] ')' {\nPyASTCall(a,\n(b) ? ((exprty) b)->v.Call.args : NULL,\n(b) ? ((exprty) b)->v.Call.keywords : NULL,\nEXTRA) }\n| a=primary '[' b=slices ']' { PyASTSubscript(a, b, Load, EXTRA) }\n| atom\n\nslices[exprty]:\n| a=slice !',' { a }\n| a[asdlexprseq*]=','.(slice | starredexpression)+ [','] { PyASTTuple(a, Load, EXTRA) }\n\nslice[exprty]:\n| a=[expression] ':' b=[expression] c=[':' d=[expression] { d }] { PyASTSlice(a, b, c, EXTRA) }\n| a=namedexpression { a }\n\natom[exprty]:\n| NAME\n| 'True' { PyASTConstant(PyTrue, NULL, EXTRA) }\n| 'False' { PyASTConstant(PyFalse, NULL, EXTRA) }\n| 'None' { PyASTConstant(PyNone, NULL, EXTRA) }\n| &(STRING|FSTRINGSTART) strings\n| NUMBER\n| &'(' (tuple | group | genexp)\n| &'[' (list | listcomp)\n| &'{' (dict | set | dictcomp | setcomp)\n| '...' { PyASTConstant(PyEllipsis, NULL, EXTRA) }\n\ngroup[exprty]:\n| '(' a=(yieldexpr | namedexpression) ')' { a }\n| invalidgroup\n\n# Lambda functions\n# ----------------\n\nlambdef[exprty]:\n| 'lambda' a=[lambdaparams] ':' b=expression {\nPyASTLambda((a) ? a : CHECK(argumentsty, PyPegenemptyarguments(p)), b, EXTRA) }\n\nlambdaparams[argumentsty]:\n| invalidlambdaparameters\n| lambdaparameters\n\n# lambdaparameters etc. duplicates parameters but without annotations\n# or type comments, and if there's no comma after a parameter, we expect\n# a colon, not a close parenthesis.  (For more, see parameters above.)\n#\nlambdaparameters[argumentsty]:\n| a=lambdaslashnodefault b[asdlargseq*]=lambdaparamnodefault* c=lambdaparamwithdefault* d=[lambdastaretc] {\nCHECKVERSION(argumentsty, 8, \"Positional-only parameters are\", PyPegenmakearguments(p, a, NULL, b, c, d)) }\n| a=lambdaslashwithdefault b=lambdaparamwithdefault* c=[lambdastaretc] {\nCHECKVERSION(argumentsty, 8, \"Positional-only parameters are\", PyPegenmakearguments(p, NULL, a, NULL, b, c)) }\n| a[asdlargseq*]=lambdaparamnodefault+ b=lambdaparamwithdefault* c=[lambdastaretc] {\nPyPegenmakearguments(p, NULL, NULL, a, b, c) }\n| a=lambdaparamwithdefault+ b=[lambdastaretc] { PyPegenmakearguments(p, NULL, NULL, NULL, a, b)}\n| a=lambdastaretc { PyPegenmakearguments(p, NULL, NULL, NULL, NULL, a) }\n\nlambdaslashnodefault[asdlargseq*]:\n| a[asdlargseq*]=lambdaparamnodefault+ '/' ',' { a }\n| a[asdlargseq*]=lambdaparamnodefault+ '/' &':' { a }\n\nlambdaslashwithdefault[SlashWithDefault*]:\n| a=lambdaparamnodefault* b=lambdaparamwithdefault+ '/' ',' { PyPegenslashwithdefault(p, (asdlargseq *)a, b) }\n| a=lambdaparamnodefault* b=lambdaparamwithdefault+ '/' &':' { PyPegenslashwithdefault(p, (asdlargseq *)a, b) }\n\nlambdastaretc[StarEtc*]:\n| invalidlambdastaretc\n| '*' a=lambdaparamnodefault b=lambdaparammaybedefault* c=[lambdakwds] {\nPyPegenstaretc(p, a, b, c) }\n| '*' ',' b=lambdaparammaybedefault+ c=[lambdakwds] {\nPyPegenstaretc(p, NULL, b, c) }\n| a=lambdakwds { PyPegenstaretc(p, NULL, NULL, a) }\n\nlambdakwds[argty]:\n| invalidlambdakwds\n| '' a=lambdaparamnodefault { a }\n\nlambdaparamnodefault[argty]:\n| a=lambdaparam ',' { a }\n| a=lambdaparam &':' { a }\nlambdaparamwithdefault[NameDefaultPair*]:\n| a=lambdaparam c=default ',' { PyPegennamedefaultpair(p, a, c, NULL) }\n| a=lambdaparam c=default &':' { PyPegennamedefaultpair(p, a, c, NULL) }\nlambdaparammaybedefault[NameDefaultPair*]:\n| a=lambdaparam c=default? ',' { PyPegennamedefaultpair(p, a, c, NULL) }\n| a=lambdaparam c=default? &':' { PyPegennamedefaultpair(p, a, c, NULL) }\nlambdaparam[argty]: a=NAME { PyASTarg(a->v.Name.id, NULL, NULL, EXTRA) }\n\n# LITERALS\n# ========\n\nfstringmiddle[exprty]:\n| fstringreplacementfield\n| t=FSTRINGMIDDLE { PyPegenconstantfromtoken(p, t) }\nfstringreplacementfield[exprty]:\n| '{' a=(yieldexpr | starexpressions) debugexpr='='? conversion=[fstringconversion] format=[fstringfullformatspec] rbrace='}' {\nPyPegenformattedvalue(p, a, debugexpr, conversion, format, rbrace, EXTRA) }\n| invalidreplacementfield\nfstringconversion[ResultTokenWithMetadata*]:\n| convtoken=\"!\" conv=NAME { PyPegencheckfstringconversion(p, convtoken, conv) }\nfstringfullformatspec[ResultTokenWithMetadata*]:\n| colon=':' spec=fstringformatspec* { PyPegensetupfullformatspec(p, colon, (asdlexprseq *) spec, EXTRA) }\nfstringformatspec[exprty]:\n| t=FSTRINGMIDDLE { PyPegendecodedconstantfromtoken(p, t) }\n| fstringreplacementfield\nfstring[exprty]:\n| a=FSTRINGSTART b=fstringmiddle* c=FSTRINGEND { PyPegenjoinedstr(p, a, (asdlexprseq*)b, c) }\n\nstring[exprty]: s[Token*]=STRING { PyPegenconstantfromstring(p, s) }\nstrings[exprty] (memo): a[asdlexprseq*]=(fstring|string)+ { PyPegenconcatenatestrings(p, a, EXTRA) }\n\nlist[exprty]:\n| '[' a=[starnamedexpressions] ']' { PyASTList(a, Load, EXTRA) }\n\ntuple[exprty]:\n| '(' a=[y=starnamedexpression ',' z=[starnamedexpressions] { PyPegenseqinsertinfront(p, y, z) } ] ')' {\nPyASTTuple(a, Load, EXTRA) }\n\nset[exprty]: '{' a=starnamedexpressions '}' { PyASTSet(a, EXTRA) }\n\n# Dicts\n# -----\n\ndict[exprty]:\n| '{' a=[doublestarredkvpairs] '}' {\nPyASTDict(\nCHECK(asdlexprseq*, PyPegengetkeys(p, a)),\nCHECK(asdlexprseq*, PyPegengetvalues(p, a)),\nEXTRA) }\n| '{' invaliddoublestarredkvpairs '}'\n\ndoublestarredkvpairs[asdlseq*]: a=','.doublestarredkvpair+ [','] { a }\n\ndoublestarredkvpair[KeyValuePair*]:\n| '' a=bitwiseor { PyPegenkeyvaluepair(p, NULL, a) }\n| kvpair\n\nkvpair[KeyValuePair*]: a=expression ':' b=expression { PyPegenkeyvaluepair(p, a, b) }\n\n# Comprehensions & Generators\n# ---------------------------\n\nforifclauses[asdlcomprehensionseq*]:\n| a[asdlcomprehensionseq*]=forifclause+ { a }\n\nforifclause[comprehensionty]:\n| ASYNC 'for' a=startargets 'in' ~ b=disjunction c[asdlexprseq*]=('if' z=disjunction { z })* {\nCHECKVERSION(comprehensionty, 6, \"Async comprehensions are\", PyASTcomprehension(a, b, c, 1, p->arena)) }\n| 'for' a=startargets 'in' ~ b=disjunction c[asdlexprseq*]=('if' z=disjunction { z })* {\nPyASTcomprehension(a, b, c, 0, p->arena) }\n| invalidfortarget\n\nlistcomp[exprty]:\n| '[' a=namedexpression b=forifclauses ']' { PyASTListComp(a, b, EXTRA) }\n| invalidcomprehension\n\nsetcomp[exprty]:\n| '{' a=namedexpression b=forifclauses '}' { PyASTSetComp(a, b, EXTRA) }\n| invalidcomprehension\n\ngenexp[exprty]:\n| '(' a=( assignmentexpression | expression !':=') b=forifclauses ')' { PyASTGeneratorExp(a, b, EXTRA) }\n| invalidcomprehension\n\ndictcomp[exprty]:\n| '{' a=kvpair b=forifclauses '}' { PyASTDictComp(a->key, a->value, b, EXTRA) }\n| invaliddictcomprehension\n\n# FUNCTION CALL ARGUMENTS\n# =======================\n\narguments[exprty] (memo):\n| a=args [','] &')' { a }\n| invalidarguments\n\nargs[exprty]:\n| a[asdlexprseq*]=','.(starredexpression | ( assignmentexpression | expression !':=') !'=')+ b=[',' k=kwargs {k}] {\nPyPegencollectcallseqs(p, a, b, EXTRA) }\n| a=kwargs { PyASTCall(PyPegendummyname(p),\nCHECKNULLALLOWED(asdlexprseq*, PyPegenseqextractstarredexprs(p, a)),\nCHECKNULLALLOWED(asdlkeywordseq*, PyPegenseqdeletestarredexprs(p, a)),\nEXTRA) }\n\nkwargs[asdlseq*]:\n| a=','.kwargorstarred+ ',' b=','.kwargordoublestarred+ { PyPegenjoinsequences(p, a, b) }\n| ','.kwargorstarred+\n| ','.kwargordoublestarred+\n\nstarredexpression[exprty]:\n| invalidstarredexpression\n| '*' a=expression { PyASTStarred(a, Load, EXTRA) }\n| '*' { RAISESYNTAXERROR(\"Invalid star expression\") }\n\nkwargorstarred[KeywordOrStarred*]:\n| invalidkwarg\n| a=NAME '=' b=expression {\nPyPegenkeywordorstarred(p, CHECK(keywordty, PyASTkeyword(a->v.Name.id, b, EXTRA)), 1) }\n| a=starredexpression { PyPegenkeywordorstarred(p, a, 0) }\n\nkwargordoublestarred[KeywordOrStarred*]:\n| invalidkwarg\n| a=NAME '=' b=expression {\nPyPegenkeywordorstarred(p, CHECK(keywordty, PyASTkeyword(a->v.Name.id, b, EXTRA)), 1) }\n| '' a=expression { PyPegenkeywordorstarred(p, CHECK(keywordty, PyASTkeyword(NULL, a, EXTRA)), 1) }\n\n# ASSIGNMENT TARGETS\n# ==================\n\n# Generic targets\n# ---------------\n\n# NOTE: startargets may contain *bitwiseor, targets may not.\nstartargets[exprty]:\n| a=startarget !',' { a }\n| a=startarget b=(',' c=startarget { c })* [','] {\nPyASTTuple(CHECK(asdlexprseq*, PyPegenseqinsertinfront(p, a, b)), Store, EXTRA) }\n\nstartargetslistseq[asdlexprseq*]: a[asdlexprseq*]=','.startarget+ [','] { a }\n\nstartargetstupleseq[asdlexprseq*]:\n| a=startarget b=(',' c=startarget { c })+ [','] { (asdlexprseq*) PyPegenseqinsertinfront(p, a, b) }\n| a=startarget ',' { (asdlexprseq*) PyPegensingletonseq(p, a) }\n\nstartarget[exprty] (memo):\n| '*' a=(!'*' startarget) {\nPyASTStarred(CHECK(exprty, PyPegensetexprcontext(p, a, Store)), Store, EXTRA) }\n| targetwithstaratom\n\ntargetwithstaratom[exprty] (memo):\n| a=tprimary '.' b=NAME !tlookahead { PyASTAttribute(a, b->v.Name.id, Store, EXTRA) }\n| a=tprimary '[' b=slices ']' !tlookahead { PyASTSubscript(a, b, Store, EXTRA) }\n| staratom\n\nstaratom[exprty]:\n| a=NAME { PyPegensetexprcontext(p, a, Store) }\n| '(' a=targetwithstaratom ')' { PyPegensetexprcontext(p, a, Store) }\n| '(' a=[startargetstupleseq] ')' { PyASTTuple(a, Store, EXTRA) }\n| '[' a=[startargetslistseq] ']' { PyASTList(a, Store, EXTRA) }\n\nsingletarget[exprty]:\n| singlesubscriptattributetarget\n| a=NAME { PyPegensetexprcontext(p, a, Store) }\n| '(' a=singletarget ')' { a }\n\nsinglesubscriptattributetarget[exprty]:\n| a=tprimary '.' b=NAME !tlookahead { PyASTAttribute(a, b->v.Name.id, Store, EXTRA) }\n| a=tprimary '[' b=slices ']' !tlookahead { PyASTSubscript(a, b, Store, EXTRA) }\n\ntprimary[exprty]:\n| a=tprimary '.' b=NAME &tlookahead { PyASTAttribute(a, b->v.Name.id, Load, EXTRA) }\n| a=tprimary '[' b=slices ']' &tlookahead { PyASTSubscript(a, b, Load, EXTRA) }\n| a=tprimary b=genexp &tlookahead {\nPyASTCall(a, CHECK(asdlexprseq*, (asdlexprseq*)PyPegensingletonseq(p, b)), NULL, EXTRA) }\n| a=tprimary '(' b=[arguments] ')' &tlookahead {\nPyASTCall(a,\n(b) ? ((exprty) b)->v.Call.args : NULL,\n(b) ? ((exprty) b)->v.Call.keywords : NULL,\nEXTRA) }\n| a=atom &tlookahead { a }\n\ntlookahead: '(' | '[' | '.'\n\n# Targets for del statements\n# --------------------------\n\ndeltargets[asdlexprseq*]: a[asdlexprseq*]=','.deltarget+ [','] { a }\n\ndeltarget[exprty] (memo):\n| a=tprimary '.' b=NAME !tlookahead { PyASTAttribute(a, b->v.Name.id, Del, EXTRA) }\n| a=tprimary '[' b=slices ']' !tlookahead { PyASTSubscript(a, b, Del, EXTRA) }\n| deltatom\n\ndeltatom[exprty]:\n| a=NAME { PyPegensetexprcontext(p, a, Del) }\n| '(' a=deltarget ')' { PyPegensetexprcontext(p, a, Del) }\n| '(' a=[deltargets] ')' { PyASTTuple(a, Del, EXTRA) }\n| '[' a=[deltargets] ']' { PyASTList(a, Del, EXTRA) }\n\n# TYPING ELEMENTS\n# ---------------\n\n# typeexpressions allow */ but ignore them\ntypeexpressions[asdlexprseq*]:\n| a=','.expression+ ',' '*' b=expression ',' '' c=expression {\n(asdlexprseq*)PyPegenseqappendtoend(\np,\nCHECK(asdlseq*, PyPegenseqappendtoend(p, a, b)),\nc) }\n| a=','.expression+ ',' '*' b=expression { (asdlexprseq*)PyPegenseqappendtoend(p, a, b) }\n| a=','.expression+ ',' '' b=expression { (asdlexprseq*)PyPegenseqappendtoend(p, a, b) }\n| '*' a=expression ',' '' b=expression {\n(asdlexprseq*)PyPegenseqappendtoend(\np,\nCHECK(asdlseq*, PyPegensingletonseq(p, a)),\nb) }\n| '*' a=expression { (asdlexprseq*)PyPegensingletonseq(p, a) }\n| '' a=expression { (asdlexprseq*)PyPegensingletonseq(p, a) }\n| a[asdlexprseq*]=','.expression+ {a}\n\nfunctypecomment[Token*]:\n| NEWLINE t=TYPECOMMENT &(NEWLINE INDENT) { t }  # Must be followed by indented block\n| invaliddoubletypecomments\n| TYPECOMMENT\n\n# ========================= END OF THE GRAMMAR ===========================\n\n\n\n# ========================= START OF INVALID RULES =======================\n\n# From here on, there are rules for invalid syntax with specialised error messages\ninvalidarguments:\n| ((','.(starredexpression | ( assignmentexpression | expression !':=') !'=')+ ',' kwargs) | kwargs) a=',' ','.(starredexpression !'=')+ {\nRAISESYNTAXERRORSTARTINGFROM(a, \"iterable argument unpacking follows keyword argument unpacking\") }\n| a=expression b=forifclauses ',' [args | expression forifclauses] {\nRAISESYNTAXERRORKNOWNRANGE(a, PyPegengetlastcomprehensionitem(PyPegenlastitem(b, comprehensionty)), \"Generator expression must be parenthesized\") }\n| a=NAME b='=' expression forifclauses {\nRAISESYNTAXERRORKNOWNRANGE(a, b, \"invalid syntax. Maybe you meant '==' or ':=' instead of '='?\")}\n| (args ',')? a=NAME b='=' &(',' | ')') {\nRAISESYNTAXERRORKNOWNRANGE(a, b, \"expected argument value expression\")}\n| a=args b=forifclauses { PyPegennonparengenexpincall(p, a, b) }\n| args ',' a=expression b=forifclauses {\nRAISESYNTAXERRORKNOWNRANGE(a, PyPegengetlastcomprehensionitem(PyPegenlastitem(b, comprehensionty)), \"Generator expression must be parenthesized\") }\n| a=args ',' args { PyPegenargumentsparsingerror(p, a) }\ninvalidkwarg:\n| a[Token*]=('True'|'False'|'None') b='=' {\nRAISESYNTAXERRORKNOWNRANGE(a, b, \"cannot assign to %s\", PyBytesASSTRING(a->bytes)) }\n| a=NAME b='=' expression forifclauses {\nRAISESYNTAXERRORKNOWNRANGE(a, b, \"invalid syntax. Maybe you meant '==' or ':=' instead of '='?\")}\n| !(NAME '=') a=expression b='=' {\nRAISESYNTAXERRORKNOWNRANGE(\na, b, \"expression cannot contain assignment, perhaps you meant \\\"==\\\"?\") }\n| a='' expression '=' b=expression {\nRAISESYNTAXERRORKNOWNRANGE(a, b, \"cannot assign to keyword argument unpacking\") }\n\n# IMPORTANT: Note that the \"withoutinvalid\" suffix causes the rule to not call invalid rules under it\nexpressionwithoutinvalid[exprty]:\n| a=disjunction 'if' b=disjunction 'else' c=expression { PyASTIfExp(b, a, c, EXTRA) }\n| disjunction\n| lambdef\ninvalidlegacyexpression:\n| a=NAME !'(' b=starexpressions {\nPyPegenchecklegacystmt(p, a) ? RAISESYNTAXERRORKNOWNRANGE(a, b,\n\"Missing parentheses in call to '%U'. Did you mean %U(...)?\", a->v.Name.id, a->v.Name.id) : NULL}\n\ninvalidexpression:\n# !(NAME STRING) is not matched so we don't show this error with some invalid string prefixes like: kf\"dsfsdf\"\n# Soft keywords need to also be ignored because they can be parsed as NAME NAME\n| !(NAME STRING | SOFTKEYWORD) a=disjunction b=expressionwithoutinvalid {\nPyPegenchecklegacystmt(p, a) ? NULL : p->tokens[p->mark-1]->level == 0 ? NULL :\nRAISESYNTAXERRORKNOWNRANGE(a, b, \"invalid syntax. Perhaps you forgot a comma?\") }\n| a=disjunction 'if' b=disjunction !('else'|':') { RAISESYNTAXERRORKNOWNRANGE(a, b, \"expected 'else' after 'if' expression\") }\n| a='lambda' [lambdaparams] b=':' &FSTRINGMIDDLE  {\nRAISESYNTAXERRORKNOWNRANGE(a, b, \"f-string: lambda expressions are not allowed without parentheses\") }\n\ninvalidnamedexpression(memo):\n| a=expression ':=' expression {\nRAISESYNTAXERRORKNOWNLOCATION(\na, \"cannot use assignment expressions with %s\", PyPegengetexprname(a)) }\n| a=NAME '=' b=bitwiseor !('='|':=') {\nRAISESYNTAXERRORKNOWNRANGE(a, b, \"invalid syntax. Maybe you meant '==' or ':=' instead of '='?\") }\n| !(list|tuple|genexp|'True'|'None'|'False') a=bitwiseor b='=' bitwiseor !('='|':=') {\nRAISESYNTAXERRORKNOWNLOCATION(a, \"cannot assign to %s here. Maybe you meant '==' instead of '='?\",\nPyPegengetexprname(a)) }\n\ninvalidassignment:\n| a=invalidannassigntarget ':' expression {\nRAISESYNTAXERRORKNOWNLOCATION(\na,\n\"only single target (not %s) can be annotated\",\nPyPegengetexprname(a)\n)}\n| a=starnamedexpression ',' starnamedexpressions* ':' expression {\nRAISESYNTAXERRORKNOWNLOCATION(a, \"only single target (not tuple) can be annotated\") }\n| a=expression ':' expression {\nRAISESYNTAXERRORKNOWNLOCATION(a, \"illegal target for annotation\") }\n| (startargets '=')* a=starexpressions '=' {\nRAISESYNTAXERRORINVALIDTARGET(STARTARGETS, a) }\n| (startargets '=')* a=yieldexpr '=' { RAISESYNTAXERRORKNOWNLOCATION(a, \"assignment to yield expression not possible\") }\n| a=starexpressions augassign (yieldexpr | starexpressions) {\nRAISESYNTAXERRORKNOWNLOCATION(\na,\n\"'%s' is an illegal expression for augmented assignment\",\nPyPegengetexprname(a)\n)}\ninvalidannassigntarget[exprty]:\n| list\n| tuple\n| '(' a=invalidannassigntarget ')' { a }\ninvaliddelstmt:\n| 'del' a=starexpressions {\nRAISESYNTAXERRORINVALIDTARGET(DELTARGETS, a) }\ninvalidblock:\n| NEWLINE !INDENT { RAISEINDENTATIONERROR(\"expected an indented block\") }\ninvalidcomprehension:\n| ('[' | '(' | '{') a=starredexpression forifclauses {\nRAISESYNTAXERRORKNOWNLOCATION(a, \"iterable unpacking cannot be used in comprehension\") }\n| ('[' | '{') a=starnamedexpression ',' b=starnamedexpressions forifclauses {\nRAISESYNTAXERRORKNOWNRANGE(a, PyPegenlastitem(b, exprty),\n\"did you forget parentheses around the comprehension target?\") }\n| ('[' | '{') a=starnamedexpression b=',' forifclauses {\nRAISESYNTAXERRORKNOWNRANGE(a, b, \"did you forget parentheses around the comprehension target?\") }\ninvaliddictcomprehension:\n| '{' a='' bitwiseor forifclauses '}' {\nRAISESYNTAXERRORKNOWNLOCATION(a, \"dict unpacking cannot be used in dict comprehension\") }\ninvalidparameters:\n| a=\"/\" ',' {\nRAISESYNTAXERRORKNOWNLOCATION(a, \"at least one argument must precede /\") }\n| (slashnodefault | slashwithdefault) parammaybedefault* a='/' {\nRAISESYNTAXERRORKNOWNLOCATION(a, \"/ may appear only once\") }\n| slashnodefault? paramnodefault* invalidparametershelper a=paramnodefault {\nRAISESYNTAXERRORKNOWNLOCATION(a, \"parameter without a default follows parameter with a default\") }\n| paramnodefault* a='(' paramnodefault+ ','? b=')' {\nRAISESYNTAXERRORKNOWNRANGE(a, b, \"Function parameters cannot be parenthesized\") }\n| (slashnodefault | slashwithdefault)? parammaybedefault* '*' (',' | paramnodefault) parammaybedefault* a='/' {\nRAISESYNTAXERRORKNOWNLOCATION(a, \"/ must be ahead of *\") }\n| parammaybedefault+ '/' a='*' {\nRAISESYNTAXERRORKNOWNLOCATION(a, \"expected comma between / and *\") }\ninvaliddefault:\n| a='=' &(')'|',') { RAISESYNTAXERRORKNOWNLOCATION(a, \"expected default value expression\") }\ninvalidstaretc:\n| a='*' (')' | ',' (')' | '')) { RAISESYNTAXERRORKNOWNLOCATION(a, \"named arguments must follow bare *\") }\n| '*' ',' TYPECOMMENT { RAISESYNTAXERROR(\"bare * has associated type comment\") }\n| '*' param a='=' { RAISESYNTAXERRORKNOWNLOCATION(a, \"var-positional argument cannot have default value\") }\n| '*' (paramnodefault | ',') parammaybedefault* a='*' (paramnodefault | ',') {\nRAISESYNTAXERRORKNOWNLOCATION(a, \"* argument may appear only once\") }\ninvalidkwds:\n| '' param a='=' { RAISESYNTAXERRORKNOWNLOCATION(a, \"var-keyword argument cannot have default value\") }\n| '' param ',' a=param { RAISESYNTAXERRORKNOWNLOCATION(a, \"arguments cannot follow var-keyword argument\") }\n| '' param ',' a[Token*]=('*'|''|'/') { RAISESYNTAXERRORKNOWNLOCATION(a, \"arguments cannot follow var-keyword argument\") }\ninvalidparametershelper: # This is only there to avoid type errors\n| a=slashwithdefault { PyPegensingletonseq(p, a) }\n| paramwithdefault+\ninvalidlambdaparameters:\n| a=\"/\" ',' {\nRAISESYNTAXERRORKNOWNLOCATION(a, \"at least one argument must precede /\") }\n| (lambdaslashnodefault | lambdaslashwithdefault) lambdaparammaybedefault* a='/' {\nRAISESYNTAXERRORKNOWNLOCATION(a, \"/ may appear only once\") }\n| lambdaslashnodefault? lambdaparamnodefault* invalidlambdaparametershelper a=lambdaparamnodefault {\nRAISESYNTAXERRORKNOWNLOCATION(a, \"parameter without a default follows parameter with a default\") }\n| lambdaparamnodefault* a='(' ','.lambdaparam+ ','? b=')' {\nRAISESYNTAXERRORKNOWNRANGE(a, b, \"Lambda expression parameters cannot be parenthesized\") }\n| (lambdaslashnodefault | lambdaslashwithdefault)? lambdaparammaybedefault* '*' (',' | lambdaparamnodefault) lambdaparammaybedefault* a='/' {\nRAISESYNTAXERRORKNOWNLOCATION(a, \"/ must be ahead of *\") }\n| lambdaparammaybedefault+ '/' a='*' {\nRAISESYNTAXERRORKNOWNLOCATION(a, \"expected comma between / and *\") }\ninvalidlambdaparametershelper:\n| a=lambdaslashwithdefault { PyPegensingletonseq(p, a) }\n| lambdaparamwithdefault+\ninvalidlambdastaretc:\n| '*' (':' | ',' (':' | '')) { RAISESYNTAXERROR(\"named arguments must follow bare *\") }\n| '*' lambdaparam a='=' { RAISESYNTAXERRORKNOWNLOCATION(a, \"var-positional argument cannot have default value\") }\n| '*' (lambdaparamnodefault | ',') lambdaparammaybedefault* a='*' (lambdaparamnodefault | ',') {\nRAISESYNTAXERRORKNOWNLOCATION(a, \"* argument may appear only once\") }\ninvalidlambdakwds:\n| '' lambdaparam a='=' { RAISESYNTAXERRORKNOWNLOCATION(a, \"var-keyword argument cannot have default value\") }\n| '' lambdaparam ',' a=lambdaparam { RAISESYNTAXERRORKNOWNLOCATION(a, \"arguments cannot follow var-keyword argument\") }\n| '' lambdaparam ',' a[Token*]=('*'|''|'/') { RAISESYNTAXERRORKNOWNLOCATION(a, \"arguments cannot follow var-keyword argument\") }\ninvaliddoubletypecomments:\n| TYPECOMMENT NEWLINE TYPECOMMENT NEWLINE INDENT {\nRAISESYNTAXERROR(\"Cannot have two type comments on def\") }\ninvalidwithitem:\n| expression 'as' a=expression &(',' | ')' | ':') {\nRAISESYNTAXERRORINVALIDTARGET(STARTARGETS, a) }\n\ninvalidfortarget:\n| ASYNC? 'for' a=starexpressions {\nRAISESYNTAXERRORINVALIDTARGET(FORTARGETS, a) }\n\ninvalidgroup:\n| '(' a=starredexpression ')' {\nRAISESYNTAXERRORKNOWNLOCATION(a, \"cannot use starred expression here\") }\n| '(' a='' expression ')' {\nRAISESYNTAXERRORKNOWNLOCATION(a, \"cannot use double starred expression here\") }\ninvalidimport:\n| a='import' ','.dottedname+ 'from' dottedname {\nRAISESYNTAXERRORSTARTINGFROM(a, \"Did you mean to use 'from ... import ...' instead?\") }\n\ninvalidimportfromtargets:\n| importfromasnames ',' NEWLINE {\nRAISESYNTAXERROR(\"trailing comma not allowed without surrounding parentheses\") }\n\ninvalidwithstmt:\n| [ASYNC] 'with' ','.(expression ['as' startarget])+ NEWLINE { RAISESYNTAXERROR(\"expected ':'\") }\n| [ASYNC] 'with' '(' ','.(expressions ['as' startarget])+ ','? ')' NEWLINE { RAISESYNTAXERROR(\"expected ':'\") }\ninvalidwithstmtindent:\n| [ASYNC] a='with' ','.(expression ['as' startarget])+ ':' NEWLINE !INDENT {\nRAISEINDENTATIONERROR(\"expected an indented block after 'with' statement on line %d\", a->lineno) }\n| [ASYNC] a='with' '(' ','.(expressions ['as' startarget])+ ','? ')' ':' NEWLINE !INDENT {\nRAISEINDENTATIONERROR(\"expected an indented block after 'with' statement on line %d\", a->lineno) }\n\ninvalidtrystmt:\n| a='try' ':' NEWLINE !INDENT {\nRAISEINDENTATIONERROR(\"expected an indented block after 'try' statement on line %d\", a->lineno) }\n| 'try' ':' block !('except' | 'finally') { RAISESYNTAXERROR(\"expected 'except' or 'finally' block\") }\n| 'try' ':' block* exceptblock+ a='except' b='*' expression ['as' NAME] ':' {\nRAISESYNTAXERRORKNOWNRANGE(a, b, \"cannot have both 'except' and 'except*' on the same 'try'\") }\n| 'try' ':' block* exceptstarblock+ a='except' [expression ['as' NAME]] ':' {\nRAISESYNTAXERRORKNOWNLOCATION(a, \"cannot have both 'except' and 'except*' on the same 'try'\") }\ninvalidexceptstmt:\n| 'except' '*'? a=expression ',' expressions ['as' NAME ] ':' {\nRAISESYNTAXERRORSTARTINGFROM(a, \"multiple exception types must be parenthesized\") }\n| a='except' '*'? expression ['as' NAME ] NEWLINE { RAISESYNTAXERROR(\"expected ':'\") }\n| a='except' NEWLINE { RAISESYNTAXERROR(\"expected ':'\") }\n| a='except' '*' (NEWLINE | ':') { RAISESYNTAXERROR(\"expected one or more exception types\") }\ninvalidfinallystmt:\n| a='finally' ':' NEWLINE !INDENT {\nRAISEINDENTATIONERROR(\"expected an indented block after 'finally' statement on line %d\", a->lineno) }\ninvalidexceptstmtindent:\n| a='except' expression ['as' NAME ] ':' NEWLINE !INDENT {\nRAISEINDENTATIONERROR(\"expected an indented block after 'except' statement on line %d\", a->lineno) }\n| a='except' ':' NEWLINE !INDENT { RAISEINDENTATIONERROR(\"expected an indented block after 'except' statement on line %d\", a->lineno) }\ninvalidexceptstarstmtindent:\n| a='except' '*' expression ['as' NAME ] ':' NEWLINE !INDENT {\nRAISEINDENTATIONERROR(\"expected an indented block after 'except*' statement on line %d\", a->lineno) }\ninvalidmatchstmt:\n| \"match\" subjectexpr NEWLINE { CHECKVERSION(void*, 10, \"Pattern matching is\", RAISESYNTAXERROR(\"expected ':'\") ) }\n| a=\"match\" subject=subjectexpr ':' NEWLINE !INDENT {\nRAISEINDENTATIONERROR(\"expected an indented block after 'match' statement on line %d\", a->lineno) }\ninvalidcaseblock:\n| \"case\" patterns guard? NEWLINE { RAISESYNTAXERROR(\"expected ':'\") }\n| a=\"case\" patterns guard? ':' NEWLINE !INDENT {\nRAISEINDENTATIONERROR(\"expected an indented block after 'case' statement on line %d\", a->lineno) }\ninvalidaspattern:\n| orpattern 'as' a=\"\" { RAISESYNTAXERRORKNOWNLOCATION(a, \"cannot use '' as a target\") }\n| orpattern 'as' !NAME a=expression { RAISESYNTAXERRORKNOWNLOCATION(a, \"invalid pattern target\") }\ninvalidclasspattern:\n| nameorattr '(' a=invalidclassargumentpattern  { RAISESYNTAXERRORKNOWNRANGE(\nPyPegenfirstitem(a, patternty),\nPyPegenlastitem(a, patternty),\n\"positional patterns follow keyword patterns\") }\ninvalidclassargumentpattern[asdlpatternseq*]:\n| [positionalpatterns ','] keywordpatterns ',' a=positionalpatterns { a }\ninvalidifstmt:\n| 'if' namedexpression NEWLINE { RAISESYNTAXERROR(\"expected ':'\") }\n| a='if' a=namedexpression ':' NEWLINE !INDENT {\nRAISEINDENTATIONERROR(\"expected an indented block after 'if' statement on line %d\", a->lineno) }\ninvalidelifstmt:\n| 'elif' namedexpression NEWLINE { RAISESYNTAXERROR(\"expected ':'\") }\n| a='elif' namedexpression ':' NEWLINE !INDENT {\nRAISEINDENTATIONERROR(\"expected an indented block after 'elif' statement on line %d\", a->lineno) }\ninvalidelsestmt:\n| a='else' ':' NEWLINE !INDENT {\nRAISEINDENTATIONERROR(\"expected an indented block after 'else' statement on line %d\", a->lineno) }\ninvalidwhilestmt:\n| 'while' namedexpression NEWLINE { RAISESYNTAXERROR(\"expected ':'\") }\n| a='while' namedexpression ':' NEWLINE !INDENT {\nRAISEINDENTATIONERROR(\"expected an indented block after 'while' statement on line %d\", a->lineno) }\ninvalidforstmt:\n| [ASYNC] 'for' startargets 'in' starexpressions NEWLINE { RAISESYNTAXERROR(\"expected ':'\") }\n| [ASYNC] a='for' startargets 'in' starexpressions ':' NEWLINE !INDENT {\nRAISEINDENTATIONERROR(\"expected an indented block after 'for' statement on line %d\", a->lineno) }\ninvaliddefraw:\n| [ASYNC] a='def' NAME [typeparams] '(' [params] ')' ['->' expression] ':' NEWLINE !INDENT {\nRAISEINDENTATIONERROR(\"expected an indented block after function definition on line %d\", a->lineno) }\ninvalidclassdefraw:\n| 'class' NAME [typeparams] ['(' [arguments] ')'] NEWLINE { RAISESYNTAXERROR(\"expected ':'\") }\n| a='class' NAME [typeparams] ['(' [arguments] ')'] ':' NEWLINE !INDENT {\nRAISEINDENTATIONERROR(\"expected an indented block after class definition on line %d\", a->lineno) }\n\ninvaliddoublestarredkvpairs:\n| ','.doublestarredkvpair+ ',' invalidkvpair\n| expression ':' a='*' bitwiseor { RAISESYNTAXERRORSTARTINGFROM(a, \"cannot use a starred expression in a dictionary value\") }\n| expression a=':' &('}'|',') { RAISESYNTAXERRORKNOWNLOCATION(a, \"expression expected after dictionary key and ':'\") }\ninvalidkvpair:\n| a=expression !(':') {\nRAISEERRORKNOWNLOCATION(p, PyExcSyntaxError, a->lineno, a->endcoloffset - 1, a->endlineno, -1, \"':' expected after dictionary key\") }\n| expression ':' a='*' bitwiseor { RAISESYNTAXERRORSTARTINGFROM(a, \"cannot use a starred expression in a dictionary value\") }\n| expression a=':' &('}'|',') {RAISESYNTAXERRORKNOWNLOCATION(a, \"expression expected after dictionary key and ':'\") }\ninvalidstarredexpression:\n| a='*' expression '=' b=expression { RAISESYNTAXERRORKNOWNRANGE(a, b, \"cannot assign to iterable argument unpacking\") }\n\ninvalidreplacementfield:\n| '{' a='=' { RAISESYNTAXERRORKNOWNLOCATION(a, \"f-string: valid expression required before '='\") }\n| '{' a='!' { RAISESYNTAXERRORKNOWNLOCATION(a, \"f-string: valid expression required before '!'\") }\n| '{' a=':' { RAISESYNTAXERRORKNOWNLOCATION(a, \"f-string: valid expression required before ':'\") }\n| '{' a='}' { RAISESYNTAXERRORKNOWNLOCATION(a, \"f-string: valid expression required before '}'\") }\n| '{' !(yieldexpr | starexpressions) { RAISESYNTAXERRORONNEXTTOKEN(\"f-string: expecting a valid expression after '{'\")}\n| '{' (yieldexpr | starexpressions) !('=' | '!' | ':' | '}') {\nPyErrOccurred() ? NULL : RAISESYNTAXERRORONNEXTTOKEN(\"f-string: expecting '=', or '!', or ':', or '}'\") }\n| '{' (yieldexpr | starexpressions) '=' !('!' | ':' | '}') {\nPyErrOccurred() ? NULL : RAISESYNTAXERRORONNEXTTOKEN(\"f-string: expecting '!', or ':', or '}'\") }\n| '{' (yieldexpr | starexpressions) '='? invalidconversioncharacter\n| '{' (yieldexpr | starexpressions) '='? ['!' NAME] !(':' | '}') {\nPyErrOccurred() ? NULL : RAISESYNTAXERRORONNEXTTOKEN(\"f-string: expecting ':' or '}'\") }\n| '{' (yieldexpr | starexpressions) '='? ['!' NAME] ':' fstringformatspec* !'}' {\nPyErrOccurred() ? NULL : RAISESYNTAXERRORONNEXTTOKEN(\"f-string: expecting '}', or format specs\") }\n| '{' (yieldexpr | starexpressions) '='? ['!' NAME] !'}' {\nPyErrOccurred() ? NULL : RAISESYNTAXERRORONNEXTTOKEN(\"f-string: expecting '}'\") }\n\ninvalidconversioncharacter:\n| '!' &(':' | '}') { RAISESYNTAXERRORONNEXTTOKEN(\"f-string: missing conversion character\") }\n| '!' !NAME { RAISESYNTAXERRORONNEXTTOKEN(\"f-string: invalid conversion character\") }\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Grammar/python.gram\n\n(2) https://en.wikipedia.org/wiki/ExtendedBackus%E2%80%93Naurform\n\n(3) https://en.wikipedia.org/wiki/Parsingexpressiongrammar\n\n(4) https://peps.python.org/pep-0617/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The Python Standard Library,  Next: Extending and Embedding the Python Interpreter,  Prev: The Python Language Reference,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "5 The Python Standard Library": {
            "content": "While *note The Python Language Reference: 13e. describes the exact\nsyntax and semantics of the Python language, this library reference\nmanual describes the standard library that is distributed with Python.",
            "subsections": []
        },
        "It also describes some of the optional components that are commonly": {
            "content": "included in Python distributions.\n",
            "subsections": []
        },
        "Python's standard library is very extensive, offering a wide range of": {
            "content": "facilities as indicated by the long table of contents listed below.  The\nlibrary contains built-in modules (written in C) that provide access to\nsystem functionality such as file I/O that would otherwise be\ninaccessible to Python programmers, as well as modules written in Python\nthat provide standardized solutions for many problems that occur in\neveryday programming.  Some of these modules are explicitly designed to\nencourage and enhance the portability of Python programs by abstracting\naway platform-specifics into platform-neutral APIs.\n",
            "subsections": []
        },
        "The Python installers for the Windows platform usually include the": {
            "content": "entire standard library and often also include many additional\ncomponents.  For Unix-like operating systems Python is normally provided\nas a collection of packages, so it may be necessary to use the packaging\ntools provided with the operating system to obtain some or all of the\noptional components.\n",
            "subsections": []
        },
        "In addition to the standard library, there is an active collection of": {
            "content": "hundreds of thousands of components (from individual programs and\nmodules to packages and entire application development frameworks),\navailable from the Python Package Index(1).\n\n* Menu:\n\n* Introduction: Introduction<6>.\n* Built-in Functions::\n* Built-in Constants::\n* Built-in Types::\n* Built-in Exceptions::\n* Text Processing Services::\n* Binary Data Services::\n* Data Types::\n* Numeric and Mathematical Modules::\n* Functional Programming Modules::\n* File and Directory Access::\n* Data Persistence::\n* Data Compression and Archiving::\n* File Formats::\n* Cryptographic Services::\n* Generic Operating System Services::\n* Concurrent Execution::\n* Networking and Interprocess Communication::\n* Internet Data Handling::\n* Structured Markup Processing Tools::\n* Internet Protocols and Support::\n* Multimedia Services::\n* Internationalization::\n* Program Frameworks::\n* Graphical User Interfaces with Tk::\n* Development Tools::\n* Debugging and Profiling::\n* Software Packaging and Distribution::\n* Python Runtime Services::\n* Custom Python Interpreters::\n* Importing Modules::\n* Python Language Services::\n* MS Windows Specific Services::\n* Unix Specific Services::\n* Modules command-line interface (CLI): Modules command-line interface CLI.\n* Superseded Modules::\n* Security Considerations: Security Considerations<4>.\n\n---------- Footnotes ----------\n\n(1) https://pypi.org\n\nFile: python3.12.info,  Node: Introduction<6>,  Next: Built-in Functions,  Up: The Python Standard Library\n",
            "subsections": [
                {
                    "name": "5.1 Introduction",
                    "content": "The \"Python library\" contains several different kinds of components.\n"
                }
            ]
        },
        "It contains data types that would normally be considered part of the": {
            "content": "\"core\" of a language, such as numbers and lists.  For these types, the",
            "subsections": []
        },
        "Python language core defines the form of literals and places some": {
            "content": "constraints on their semantics, but does not fully define the semantics.\n(On the other hand, the language core does define syntactic properties\nlike the spelling and priorities of operators.)\n",
            "subsections": []
        },
        "The library also contains built-in functions and exceptions -- objects": {
            "content": "that can be used by all Python code without the need of an *note import:\n3a6. statement.  Some of these are defined by the core language, but\nmany are not essential for the core semantics and are only described\nhere.\n\nThe bulk of the library, however, consists of a collection of modules.",
            "subsections": []
        },
        "There are many ways to dissect this collection.  Some modules are": {
            "content": "written in C and built in to the Python interpreter; others are written\nin Python and imported in source form.  Some modules provide interfaces\nthat are highly specific to Python, like printing a stack trace; some\nprovide interfaces that are specific to particular operating systems,\nsuch as access to specific hardware; others provide interfaces that are\nspecific to a particular application domain, like the World Wide Web.",
            "subsections": []
        },
        "Some modules are available in all versions and ports of Python; others": {
            "content": "are only available when the underlying system supports or requires them;\nyet others are available only when a particular configuration option was\nchosen at the time when Python was compiled and installed.\n\nThis manual is organized \"from the inside out:\" it first describes the\nbuilt-in functions, data types and exceptions, and finally the modules,\ngrouped in chapters of related modules.\n",
            "subsections": []
        },
        "This means that if you start reading this manual from the start, and": {
            "content": "skip to the next chapter when you get bored, you will get a reasonable\noverview of the available modules and application areas that are\nsupported by the Python library.  Of course, you don't 'have' to read it\nlike a novel -- you can also browse the table of contents (in front of\nthe manual), or look for a specific function, module or term in the\nindex (in the back).  And finally, if you enjoy learning about random\nsubjects, you choose a random page number (see module *note random: b3.)\nand read a section or two.  Regardless of the order in which you read\nthe sections of this manual, it helps to start with chapter *note",
            "subsections": []
        },
        "Built-in Functions: 10d5, as the remainder of the manual assumes": {
            "content": "familiarity with this material.\n\nLet the show begin!\n\n* Menu:\n\n* Notes on availability::\n\nFile: python3.12.info,  Node: Notes on availability,  Up: Introduction<6>\n\n\n* An \"Availability: Unix\" note means that this function is commonly\nfound on Unix systems.  It does not make any claims about its\nexistence on a specific operating system.\n\n* If not separately noted, all functions that claim \"Availability:\nUnix\" are supported on macOS, which builds on a Unix core.\n\n* If an availability note contains both a minimum Kernel version and\na minimum libc version, then both conditions must hold.  For\nexample a feature with note 'Availability: Linux >= 3.17 with glibc\n>= 2.27' requires both Linux 3.17 or newer and glibc 2.27 or newer.\n\n* Menu:\n\n* WebAssembly platforms::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: WebAssembly platforms,  Up: Notes on availability": {
            "content": "5.1.1.1 WebAssembly platforms\n.............................\n",
            "subsections": []
        },
        "The WebAssembly(1) platforms 'wasm32-emscripten' (Emscripten(2)) and": {
            "content": "'wasm32-wasi' (WASI(3)) provide a subset of POSIX APIs.  WebAssembly\nruntimes and browsers are sandboxed and have limited access to the host\nand external resources.  Any Python standard library module that uses\nprocesses, threading, networking, signals, or other forms of\ninter-process communication (IPC), is either not available or may not\nwork as on other Unix-like systems.  File I/O, file system, and Unix\npermission-related functions are restricted, too.  Emscripten does not\npermit blocking I/O. Other blocking operations like *note sleep(): 469.\nblock the browser event loop.\n",
            "subsections": []
        },
        "The properties and behavior of Python on WebAssembly platforms depend on": {
            "content": "the Emscripten(4)-SDK or WASI(5)-SDK version, WASM runtimes (browser,",
            "subsections": []
        },
        "NodeJS, wasmtime(6)), and Python build time flags.  WebAssembly,": {
            "content": "",
            "subsections": []
        },
        "Emscripten, and WASI are evolving standards; some features like": {
            "content": "networking may be supported in the future.\n",
            "subsections": []
        },
        "For Python in the browser, users should consider Pyodide(7) or": {
            "content": "",
            "subsections": []
        },
        "PyScript(8).  PyScript is built on top of Pyodide, which itself is built": {
            "content": "on top of CPython and Emscripten.  Pyodide provides access to browsers'",
            "subsections": []
        },
        "JavaScript and DOM APIs as well as limited networking capabilities with": {
            "content": "JavaScript's 'XMLHttpRequest' and 'Fetch' APIs.\n\n* Process-related APIs are not available or always fail with an\nerror.  That includes APIs that spawn new processes (*note fork():\n231, *note execve(): f69.), wait for processes (*note waitpid():\nbf6.), send signals (*note kill(): 11db.), or otherwise interact\nwith processes.  The *note subprocess: d0. is importable but does\nnot work.\n\n* The *note socket: c6. module is available, but is limited and\nbehaves differently from other platforms.  On Emscripten, sockets\nare always non-blocking and require additional JavaScript code and\nhelpers on the server to proxy TCP through WebSockets; see\nEmscripten Networking(9) for more information.  WASI snapshot\npreview 1 only permits sockets from an existing file descriptor.\n\n* Some functions are stubs that either don't do anything and always\nreturn hardcoded values.\n\n* Functions related to file descriptors, file permissions, file\nownership, and links are limited and don't support some operations.\nFor example, WASI does not permit symlinks with absolute file\nnames.\n\n---------- Footnotes ----------\n\n(1) https://webassembly.org/\n\n(2) https://emscripten.org/\n\n(3) https://wasi.dev/\n\n(4) https://emscripten.org/\n\n(5) https://wasi.dev/\n\n(6) https://wasmtime.dev/\n\n(7) https://pyodide.org/\n\n(8) https://pyscript.net/\n\n(9) https://emscripten.org/docs/porting/networking.html\n\nFile: python3.12.info,  Node: Built-in Functions,  Next: Built-in Constants,  Prev: Introduction<6>,  Up: The Python Standard Library\n",
            "subsections": [
                {
                    "name": "5.2 Built-in Functions",
                    "content": ""
                }
            ]
        },
        "The Python interpreter has a number of functions and types built into it": {
            "content": "that are always available.  They are listed here in alphabetical order.\n",
            "subsections": []
        },
        "Built-in Functions": {
            "content": "--------------------------------------------------------------------------------------------------------------------\n\n'A'                           'E'                         'L'                         'R'\n*note abs(): 1a29.            *note enumerate(): 12d5.     *note len(): 3fb.          *note range(): 1e61.\n*note aiter(): 5c8.           *note eval(): 690.          *note list(): 1e5f.         *note repr(): 5f0.\n*note all(): 1278.            *note exec(): 691.          *note locals(): 173.        *note reversed(): 661.\n*note anext(): 5c9.                                                                   *note round(): 114f.\n*note any(): 1277.            'F'                         'M'\n*note ascii(): 123b.          *note filter(): 660.        *note map(): 65f.           'S'\n*note float(): 4b7.         *note max(): d70.           *note set(): 1e62.\n'B'                           *note format(): 3eb.        *note memoryview(): 1e60.     *note setattr(): 1e63.\n*note bin(): 1120.            *note frozenset(): 1e5e.     *note min(): d6f.          *note slice(): 180.\n*note bool(): 17d.                                                                    *note sorted(): a12.\n*note breakpoint(): 8f9.      'G'                         'N'                         *note staticmethod(): 5cc.\n*note bytearray(): 183d.      *note getattr(): a15.       *note next(): 5cb.          *note str(): 1e64.\n*note bytes(): 183c.          *note globals(): 15c9.                                  *note sum(): 181.\n'O'                         *note super(): 204.\n'C'                           'H'                         *note object(): 8bb.\n*note callable(): 103a.       *note hasattr(): 1f7.       *note oct(): 1142.          'T'\n*note chr(): 1c11.            *note hash(): 3b1.          *note open(): 26e.          *note tuple(): 1e65.\n*note classmethod(): 246.     *note help(): 6f0.          *note ord(): 1c10.          *note type(): ba0.\n*note compile(): 528.         *note hex(): 1143.\n*note complex(): 3ad.                                     'P'                         'V'\n'I'                         *note pow(): 7f7.           *note vars(): 17c1.\n'D'                           *note id(): 1279.           *note print(): de5.\n*note delattr(): 1e5c.        *note input(): 114d.        *note property(): 3f6.      'Z'\n*note dict(): 1e5d.           *note int(): 17e.                                       *note zip(): 5c2.\n*note dir(): 3ff.             *note isinstance(): 14b.\n*note divmod(): 7c5.          *note issubclass(): 5b4.                                ''\n*note iter(): 5ca.                                      *note import(): 6ed.\n\n\n-- Function: abs (x)\n\nReturn the absolute value of a number.  The argument may be an\ninteger, a floating point number, or an object implementing *note\nabs(): 1cbe.  If the argument is a complex number, its\nmagnitude is returned.\n\n-- Function: aiter (asynciterable)\n\nReturn an *note asynchronous iterator: bd4. for an *note\nasynchronous iterable: bd2.  Equivalent to calling 'x.aiter()'.\n\nNote: Unlike *note iter(): 5ca, *note aiter(): 5c8. has no\n2-argument variant.\n\nNew in version 3.10.\n\n-- Function: all (iterable)\n\nReturn 'True' if all elements of the 'iterable' are true (or if the\niterable is empty).  Equivalent to:\n\ndef all(iterable):\nfor element in iterable:\nif not element:\nreturn False\nreturn True\n\n-- Function: awaitable anext (asynciterator)\n\n-- Function: awaitable anext (asynciterator, default)\n\nWhen awaited, return the next item from the given *note\nasynchronous iterator: bd4, or 'default' if given and the iterator\nis exhausted.\n\nThis is the async variant of the *note next(): 5cb. builtin, and\nbehaves similarly.\n\nThis calls the *note anext(): 1c2a. method of 'asynciterator',\nreturning an *note awaitable: ac3.  Awaiting this returns the next\nvalue of the iterator.  If 'default' is given, it is returned if\nthe iterator is exhausted, otherwise *note StopAsyncIteration:\n17a6. is raised.\n\nNew in version 3.10.\n\n-- Function: any (iterable)\n\nReturn 'True' if any element of the 'iterable' is true.  If the\niterable is empty, return 'False'.  Equivalent to:\n\ndef any(iterable):\nfor element in iterable:\nif element:\nreturn True\nreturn False\n\n-- Function: ascii (object)\n\nAs *note repr(): 5f0, return a string containing a printable\nrepresentation of an object, but escape the non-ASCII characters in\nthe string returned by *note repr(): 5f0. using '\\x', '\\u', or '\\U'\nescapes.  This generates a string similar to that returned by *note\nrepr(): 5f0. in Python 2.\n\n-- Function: bin (x)\n\nConvert an integer number to a binary string prefixed with \"0b\".\nThe result is a valid Python expression.  If 'x' is not a Python\n*note int: 17e. object, it has to define an *note index(): 4f1.\nmethod that returns an integer.  Some examples:\n\n>>> bin(3)\n'0b11'\n>>> bin(-10)\n'-0b1010'\n\nIf the prefix \"0b\" is desired or not, you can use either of the\nfollowing ways.\n\n>>> format(14, '#b'), format(14, 'b')\n('0b1110', '1110')\n>>> f'{14:#b}', f'{14:b}'\n('0b1110', '1110')\n\nSee also *note format(): 3eb. for more information.\n\n-- Class: bool (x=False)\n\nReturn a Boolean value, i.e.  one of 'True' or 'False'.  'x' is\nconverted using the standard *note truth testing procedure: 1e66.\nIf 'x' is false or omitted, this returns 'False'; otherwise, it\nreturns 'True'.  The *note bool: 17d. class is a subclass of *note\nint: 17e. (see *note Numeric Types -- int, float, complex: 197e.).\nIt cannot be subclassed further.  Its only instances are 'False'\nand 'True' (see *note Boolean Type - bool: 1e67.).\n\nChanged in version 3.7: 'x' is now a positional-only parameter.\n\n-- Function: breakpoint (*args, kws)\n\nThis function drops you into the debugger at the call site.\nSpecifically, it calls *note sys.breakpointhook(): 910, passing\n'args' and 'kws' straight through.  By default,\n'sys.breakpointhook()' calls *note pdb.settrace(): 9a6. expecting\nno arguments.  In this case, it is purely a convenience function so\nyou don't have to explicitly import *note pdb: a0. or type as much\ncode to enter the debugger.  However, *note sys.breakpointhook():\n910. can be set to some other function and *note breakpoint(): 8f9.\nwill automatically call that, allowing you to drop into the\ndebugger of choice.  If *note sys.breakpointhook(): 910. is not\naccessible, this function will raise *note RuntimeError: 17a.\n\nBy default, the behavior of *note breakpoint(): 8f9. can be changed\nwith the *note PYTHONBREAKPOINT: 911. environment variable.  See\n*note sys.breakpointhook(): 910. for usage details.\n\nNote that this is not guaranteed if *note sys.breakpointhook():\n910. has been replaced.\n\nRaises an *note auditing event: 161d. 'builtins.breakpoint' with\nargument 'breakpointhook'.\n\nNew in version 3.7.\n\n-- Class: bytearray (source=b'')\n\n-- Class: bytearray (source, encoding)\n\n-- Class: bytearray (source, encoding, errors)\n\nReturn a new array of bytes.  The *note bytearray: 294. class is a\nmutable sequence of integers in the range 0 <= x < 256.  It has\nmost of the usual methods of mutable sequences, described in *note\nMutable Sequence Types: 1e68, as well as most methods that the\n*note bytes: 295. type has, see *note Bytes and Bytearray\nOperations: 1e69.\n\nThe optional 'source' parameter can be used to initialize the array\nin a few different ways:\n\n* If it is a 'string', you must also give the 'encoding' (and\noptionally, 'errors') parameters; *note bytearray(): 294. then\nconverts the string to bytes using *note str.encode(): 6ee.\n\n* If it is an 'integer', the array will have that size and will\nbe initialized with null bytes.\n\n* If it is an object conforming to the *note buffer interface:\n148, a read-only buffer of the object will be used to\ninitialize the bytes array.\n\n* If it is an 'iterable', it must be an iterable of integers in\nthe range '0 <= x < 256', which are used as the initial\ncontents of the array.\n\nWithout an argument, an array of size 0 is created.\n\nSee also *note Binary Sequence Types -- bytes, bytearray,\nmemoryview: 1e6a. and *note Bytearray Objects: 1e6b.\n\n-- Class: bytes (source=b'')\n\n-- Class: bytes (source, encoding)\n\n-- Class: bytes (source, encoding, errors)\n\nReturn a new \"bytes\" object which is an immutable sequence of\nintegers in the range '0 <= x < 256'.  *note bytes: 295. is an\nimmutable version of *note bytearray: 294. - it has the same\nnon-mutating methods and the same indexing and slicing behavior.\n\nAccordingly, constructor arguments are interpreted as for *note\nbytearray(): 294.\n\nBytes objects can also be created with literals, see *note String\nand Bytes literals: 1bc5.\n\nSee also *note Binary Sequence Types -- bytes, bytearray,\nmemoryview: 1e6a, *note Bytes Objects: 1e6c, and *note Bytes and\nBytearray Operations: 1e69.\n\n-- Function: callable (object)\n\nReturn *note True: a53. if the 'object' argument appears callable,\n*note False: 971. if not.  If this returns 'True', it is still\npossible that a call fails, but if it is 'False', calling 'object'\nwill never succeed.  Note that classes are callable (calling a\nclass returns a new instance); instances are callable if their\nclass has a *note call(): 2b1. method.\n\nNew in version 3.2: This function was first removed in Python 3.0\nand then brought back in Python 3.2.\n\n-- Function: chr (i)\n\nReturn the string representing a character whose Unicode code point\nis the integer 'i'.  For example, 'chr(97)' returns the string\n''a'', while 'chr(8364)' returns the string ''???''.  This is the\ninverse of *note ord(): 1c10.\n\nThe valid range for the argument is from 0 through 1,114,111\n(0x10FFFF in base 16).  *note ValueError: 183. will be raised if\n'i' is outside that range.\n\n-- Function: @classmethod\n\nTransform a method into a class method.\n\nA class method receives the class as an implicit first argument,\njust like an instance method receives the instance.  To declare a\nclass method, use this idiom:\n\nclass C:\n@classmethod\ndef f(cls, arg1, arg2): ...\n\nThe '@classmethod' form is a function *note decorator: 514. - see\n*note Function definitions: 19bb. for details.\n\nA class method can be called either on the class (such as 'C.f()')\nor on an instance (such as 'C().f()').  The instance is ignored\nexcept for its class.  If a class method is called for a derived\nclass, the derived class object is passed as the implied first\nargument.\n\nClass methods are different than C++ or Java static methods.  If\nyou want those, see *note staticmethod(): 5cc. in this section.\nFor more information on class methods, see *note The standard type\nhierarchy: 1c05.\n\nChanged in version 3.9: Class methods can now wrap other *note\ndescriptors: 1c78. such as *note property(): 3f6.\n\nChanged in version 3.10: Class methods now inherit the method\nattributes ('module', 'name', 'qualname', 'doc' and\n'annotations') and have a new 'wrapped' attribute.\n\nChanged in version 3.11: Class methods can no longer wrap other\n*note descriptors: 1c78. such as *note property(): 3f6.\n\n-- Function: compile (source, filename, mode, flags=0,\ndontinherit=False, optimize=-1)\n\nCompile the 'source' into a code or AST object.  Code objects can\nbe executed by *note exec(): 691. or *note eval(): 690.  'source'\ncan either be a normal string, a byte string, or an AST object.\nRefer to the *note ast: 8. module documentation for information on\nhow to work with AST objects.\n\nThe 'filename' argument should give the file from which the code\nwas read; pass some recognizable value if it wasn't read from a\nfile (''<string>'' is commonly used).\n\nThe 'mode' argument specifies what kind of code must be compiled;\nit can be ''exec'' if 'source' consists of a sequence of\nstatements, ''eval'' if it consists of a single expression, or\n''single'' if it consists of a single interactive statement (in the\nlatter case, expression statements that evaluate to something other\nthan 'None' will be printed).\n\nThe optional arguments 'flags' and 'dontinherit' control which\n*note compiler options: 1e6d. should be activated and which *note\nfuture features: 390. should be allowed.  If neither is present (or\nboth are zero) the code is compiled with the same flags that affect\nthe code that is calling *note compile(): 528.  If the 'flags'\nargument is given and 'dontinherit' is not (or is zero) then the\ncompiler options and the future statements specified by the 'flags'\nargument are used in addition to those that would be used anyway.\nIf 'dontinherit' is a non-zero integer then the 'flags' argument\nis it - the flags (future features and compiler options) in the\nsurrounding code are ignored.\n\nCompiler options and future statements are specified by bits which\ncan be bitwise ORed together to specify multiple options.  The\nbitfield required to specify a given future feature can be found as\nthe *note compilerflag: 1e6e. attribute on the *note Feature:\n1e6f. instance in the *note future: 0. module.  *note Compiler\nflags: 1e6d. can be found in *note ast: 8. module, with 'PyCF'\nprefix.\n\nThe argument 'optimize' specifies the optimization level of the\ncompiler; the default value of '-1' selects the optimization level\nof the interpreter as given by *note -O: c11. options.  Explicit\nlevels are '0' (no optimization; 'debug' is true), '1' (asserts\nare removed, 'debug' is false) or '2' (docstrings are removed\ntoo).\n\nThis function raises *note SyntaxError: 146. if the compiled source\nis invalid, and *note ValueError: 183. if the source contains null\nbytes.\n\nIf you want to parse Python code into its AST representation, see\n*note ast.parse(): 182.\n\nRaises an *note auditing event: 161d. 'compile' with arguments\n'source' and 'filename'.  This event may also be raised by implicit\ncompilation.\n\nNote: When compiling a string with multi-line code in\n''single'' or ''eval'' mode, input must be terminated by at\nleast one newline character.  This is to facilitate detection\nof incomplete and complete statements in the *note code: 18.\nmodule.\n\nWarning: It is possible to crash the Python interpreter with a\nsufficiently large/complex string when compiling to an AST\nobject due to stack depth limitations in Python's AST\ncompiler.\n\nChanged in version 3.2: Allowed use of Windows and Mac newlines.\nAlso, input in ''exec'' mode does not have to end in a newline\nanymore.  Added the 'optimize' parameter.\n\nChanged in version 3.5: Previously, *note TypeError: 28e. was\nraised when null bytes were encountered in 'source'.\n\nNew in version 3.8: 'ast.PyCFALLOWTOPLEVELAWAIT' can now be\npassed in flags to enable support for top-level 'await', 'async\nfor', and 'async with'.\n\n-- Class: complex (real=0, imag=0)\n\n-- Class: complex (string)\n\nReturn a complex number with the value 'real' + 'imag'*1j or\nconvert a string or number to a complex number.  If the first\nparameter is a string, it will be interpreted as a complex number\nand the function must be called without a second parameter.  The\nsecond parameter can never be a string.  Each argument may be any\nnumeric type (including complex).  If 'imag' is omitted, it\ndefaults to zero and the constructor serves as a numeric conversion\nlike *note int: 17e. and *note float: 4b7.  If both arguments are\nomitted, returns '0j'.\n\nFor a general Python object 'x', 'complex(x)' delegates to\n'x.complex()'.  If *note complex(): 3ac. is not defined\nthen it falls back to *note float(): 7f0.  If 'float()' is\nnot defined then it falls back to *note index(): 4f1.\n\nNote: When converting from a string, the string must not\ncontain whitespace around the central '+' or '-' operator.\nFor example, 'complex('1+2j')' is fine, but 'complex('1 +\n2j')' raises *note ValueError: 183.\n\nThe complex type is described in *note Numeric Types -- int, float,\ncomplex: 197e.\n\nChanged in version 3.6: Grouping digits with underscores as in code\nliterals is allowed.\n\nChanged in version 3.8: Falls back to *note index(): 4f1. if\n*note complex(): 3ac. and *note float(): 7f0. are not\ndefined.\n\n-- Function: delattr (object, name)\n\nThis is a relative of *note setattr(): 1e63.  The arguments are an\nobject and a string.  The string must be the name of one of the\nobject's attributes.  The function deletes the named attribute,\nprovided the object allows it.  For example, 'delattr(x, 'foobar')'\nis equivalent to 'del x.foobar'.  'name' need not be a Python\nidentifier (see *note setattr(): 1e63.).\n\n-- Class: dict (kwarg)\n\n-- Class: dict (mapping, kwarg)\n\n-- Class: dict (iterable, kwarg)\n\nCreate a new dictionary.  The *note dict: 237. object is the\ndictionary class.  See *note dict: 237. and *note Mapping Types --\ndict: 8fc. for documentation about this class.\n\nFor other containers see the built-in *note list: 3dc, *note set:\n39d, and *note tuple: 4b8. classes, as well as the *note\ncollections: 1b. module.\n\n-- Function: dir ()\n\n-- Function: dir (object)\n\nWithout arguments, return the list of names in the current local\nscope.  With an argument, attempt to return a list of valid\nattributes for that object.\n\nIf the object has a method named *note dir(): 1c6c, this method\nwill be called and must return the list of attributes.  This allows\nobjects that implement a custom *note getattr(): 1f8. or *note\ngetattribute(): a16. function to customize the way *note dir():\n3ff. reports their attributes.\n\nIf the object does not provide *note dir(): 1c6c, the function\ntries its best to gather information from the object's *note\ndict: aa8. attribute, if defined, and from its type object.\nThe resulting list is not necessarily complete and may be\ninaccurate when the object has a custom *note getattr(): 1f8.\n\nThe default *note dir(): 3ff. mechanism behaves differently with\ndifferent types of objects, as it attempts to produce the most\nrelevant, rather than complete, information:\n\n* If the object is a module object, the list contains the names\nof the module's attributes.\n\n* If the object is a type or class object, the list contains the\nnames of its attributes, and recursively of the attributes of\nits bases.\n\n* Otherwise, the list contains the object's attributes' names,\nthe names of its class's attributes, and recursively of the\nattributes of its class's base classes.\n\nThe resulting list is sorted alphabetically.  For example:\n\n>>> import struct\n>>> dir()   # show the names in the module namespace\n['builtins', 'name', 'struct']\n>>> dir(struct)   # show the names in the struct module\n['Struct', 'all', 'builtins', 'cached', 'doc', 'file',\n'initializing', 'loader', 'name', 'package',\n'clearcache', 'calcsize', 'error', 'pack', 'packinto',\n'unpack', 'unpackfrom']\n>>> class Shape:\n...     def dir(self):\n...         return ['area', 'perimeter', 'location']\n...\n>>> s = Shape()\n>>> dir(s)\n['area', 'location', 'perimeter']\n\nNote: Because *note dir(): 3ff. is supplied primarily as a\nconvenience for use at an interactive prompt, it tries to\nsupply an interesting set of names more than it tries to\nsupply a rigorously or consistently defined set of names, and\nits detailed behavior may change across releases.  For\nexample, metaclass attributes are not in the result list when\nthe argument is a class.\n\n-- Function: divmod (a, b)\n\nTake two (non-complex) numbers as arguments and return a pair of\nnumbers consisting of their quotient and remainder when using\ninteger division.  With mixed operand types, the rules for binary\narithmetic operators apply.  For integers, the result is the same\nas '(a // b, a % b)'.  For floating point numbers the result is\n'(q, a % b)', where 'q' is usually 'math.floor(a / b)' but may be 1\nless than that.  In any case 'q * b + a % b' is very close to 'a',\nif 'a % b' is non-zero it has the same sign as 'b', and '0 <= abs(a\n% b) < abs(b)'.\n\n-- Function: enumerate (iterable, start=0)\n\nReturn an enumerate object.  'iterable' must be a sequence, an\n*note iterator: 16a9, or some other object which supports\niteration.  The *note next(): 1141. method of the iterator\nreturned by *note enumerate(): 12d5. returns a tuple containing a\ncount (from 'start' which defaults to 0) and the values obtained\nfrom iterating over 'iterable'.\n\n>>> seasons = ['Spring', 'Summer', 'Fall', 'Winter']\n>>> list(enumerate(seasons))\n[(0, 'Spring'), (1, 'Summer'), (2, 'Fall'), (3, 'Winter')]\n>>> list(enumerate(seasons, start=1))\n[(1, 'Spring'), (2, 'Summer'), (3, 'Fall'), (4, 'Winter')]\n\nEquivalent to:\n\ndef enumerate(iterable, start=0):\nn = start\nfor elem in iterable:\nyield n, elem\nn += 1\n\n-- Function: eval (expression, globals=None, locals=None)\n\nThe arguments are a string and optional globals and locals.  If\nprovided, 'globals' must be a dictionary.  If provided, 'locals'\ncan be any mapping object.\n\nThe 'expression' argument is parsed and evaluated as a Python\nexpression (technically speaking, a condition list) using the\n'globals' and 'locals' dictionaries as global and local namespace.\nIf the 'globals' dictionary is present and does not contain a value\nfor the key 'builtins', a reference to the dictionary of the\nbuilt-in module *note builtins: 10. is inserted under that key\nbefore 'expression' is parsed.  That way you can control what\nbuiltins are available to the executed code by inserting your own\n'builtins' dictionary into 'globals' before passing it to *note\neval(): 690.  If the 'locals' dictionary is omitted it defaults to\nthe 'globals' dictionary.  If both dictionaries are omitted, the\nexpression is executed with the 'globals' and 'locals' in the\nenvironment where *note eval(): 690. is called.  Note, 'eval()'\ndoes not have access to the *note nested scopes: 1e71. (non-locals)\nin the enclosing environment.\n\nThe return value is the result of the evaluated expression.  Syntax\nerrors are reported as exceptions.  Example:\n\n>>> x = 1\n>>> eval('x+1')\n2\n\nThis function can also be used to execute arbitrary code objects\n(such as those created by *note compile(): 528.).  In this case,\npass a code object instead of a string.  If the code object has\nbeen compiled with ''exec'' as the 'mode' argument, *note eval():\n690.'s return value will be 'None'.\n\nHints: dynamic execution of statements is supported by the *note\nexec(): 691. function.  The *note globals(): 15c9. and *note\nlocals(): 173. functions return the current global and local\ndictionary, respectively, which may be useful to pass around for\nuse by *note eval(): 690. or *note exec(): 691.\n\nIf the given source is a string, then leading and trailing spaces\nand tabs are stripped.\n\nSee *note ast.literaleval(): a5e. for a function that can safely\nevaluate strings with expressions containing only literals.\n\nRaises an *note auditing event: 161d. 'exec' with the code object\nas the argument.  Code compilation events may also be raised.\n\n-- Function: exec (object, globals=None, locals=None, /, *,\nclosure=None)\n\nThis function supports dynamic execution of Python code.  'object'\nmust be either a string or a code object.  If it is a string, the\nstring is parsed as a suite of Python statements which is then\nexecuted (unless a syntax error occurs).  (1)  If it is a code\nobject, it is simply executed.  In all cases, the code that's\nexecuted is expected to be valid as file input (see the section\n*note File input: 1e48. in the Reference Manual).  Be aware that\nthe *note nonlocal: 111f, *note yield: 7f1, and *note return: 7f2.\nstatements may not be used outside of function definitions even\nwithin the context of code passed to the *note exec(): 691.\nfunction.  The return value is 'None'.\n\nIn all cases, if the optional parts are omitted, the code is\nexecuted in the current scope.  If only 'globals' is provided, it\nmust be a dictionary (and not a subclass of dictionary), which will\nbe used for both the global and the local variables.  If 'globals'\nand 'locals' are given, they are used for the global and local\nvariables, respectively.  If provided, 'locals' can be any mapping\nobject.  Remember that at the module level, globals and locals are\nthe same dictionary.  If exec gets two separate objects as\n'globals' and 'locals', the code will be executed as if it were\nembedded in a class definition.\n\nIf the 'globals' dictionary does not contain a value for the key\n'builtins', a reference to the dictionary of the built-in\nmodule *note builtins: 10. is inserted under that key.  That way\nyou can control what builtins are available to the executed code by\ninserting your own 'builtins' dictionary into 'globals' before\npassing it to *note exec(): 691.\n\nThe 'closure' argument specifies a closure-a tuple of cellvars.\nIt's only valid when the 'object' is a code object containing free\nvariables.  The length of the tuple must exactly match the number\nof free variables referenced by the code object.\n\nRaises an *note auditing event: 161d. 'exec' with the code object\nas the argument.  Code compilation events may also be raised.\n\nNote: The built-in functions *note globals(): 15c9. and *note\nlocals(): 173. return the current global and local dictionary,\nrespectively, which may be useful to pass around for use as\nthe second and third argument to *note exec(): 691.\n\nNote: The default 'locals' act as described for function *note\nlocals(): 173. below: modifications to the default 'locals'\ndictionary should not be attempted.  Pass an explicit 'locals'\ndictionary if you need to see effects of the code on 'locals'\nafter function *note exec(): 691. returns.\n\nChanged in version 3.11: Added the 'closure' parameter.\n\n-- Function: filter (function, iterable)\n\nConstruct an iterator from those elements of 'iterable' for which\n'function' is true.  'iterable' may be either a sequence, a\ncontainer which supports iteration, or an iterator.  If 'function'\nis 'None', the identity function is assumed, that is, all elements\nof 'iterable' that are false are removed.\n\nNote that 'filter(function, iterable)' is equivalent to the\ngenerator expression '(item for item in iterable if\nfunction(item))' if function is not 'None' and '(item for item in\niterable if item)' if function is 'None'.\n\nSee *note itertools.filterfalse(): 1e72. for the complementary\nfunction that returns elements of 'iterable' for which 'function'\nis false.\n\n-- Class: float (x=0.0)\n\nReturn a floating point number constructed from a number or string\n'x'.\n\nIf the argument is a string, it should contain a decimal number,\noptionally preceded by a sign, and optionally embedded in\nwhitespace.  The optional sign may be ''+'' or ''-''; a ''+'' sign\nhas no effect on the value produced.  The argument may also be a\nstring representing a NaN (not-a-number), or positive or negative\ninfinity.  More precisely, the input must conform to the\n'floatvalue' production rule in the following grammar, after\nleading and trailing whitespace characters are removed:\n\nsign        ::= \"+\" | \"-\"\ninfinity    ::= \"Infinity\" | \"inf\"\nnan         ::= \"nan\"\ndigit       ::= <a Unicode decimal digit, i.e. characters in Unicode general category Nd>\ndigitpart   ::= digit ([\"\"] digit)*\nnumber      ::= [digitpart] \".\" digitpart | digitpart [\".\"]\nexponent    ::= (\"e\" | \"E\") [\"+\" | \"-\"] digitpart\nfloatnumber ::= number [exponent]\nfloatvalue  ::= [sign] (floatnumber | infinity | nan)\n\nCase is not significant, so, for example, \"inf\", \"Inf\", \"INFINITY\",\nand \"iNfINity\" are all acceptable spellings for positive infinity.\n\nOtherwise, if the argument is an integer or a floating point\nnumber, a floating point number with the same value (within\nPython's floating point precision) is returned.  If the argument is\noutside the range of a Python float, an *note OverflowError: 68d.\nwill be raised.\n\nFor a general Python object 'x', 'float(x)' delegates to\n'x.float()'.  If *note float(): 7f0. is not defined then it\nfalls back to *note index(): 4f1.\n\nIf no argument is given, '0.0' is returned.\n\nExamples:\n\n>>> float('+1.23')\n1.23\n>>> float('   -12345\\n')\n-12345.0\n>>> float('1e-003')\n0.001\n>>> float('+1E6')\n1000000.0\n>>> float('-Infinity')\n-inf\n\nThe float type is described in *note Numeric Types -- int, float,\ncomplex: 197e.\n\nChanged in version 3.6: Grouping digits with underscores as in code\nliterals is allowed.\n\nChanged in version 3.7: 'x' is now a positional-only parameter.\n\nChanged in version 3.8: Falls back to *note index(): 4f1. if\n*note float(): 7f0. is not defined.\n\n-- Function: format (value, formatspec='')\n\nConvert a 'value' to a \"formatted\" representation, as controlled by\n'formatspec'.  The interpretation of 'formatspec' will depend on\nthe type of the 'value' argument; however, there is a standard\nformatting syntax that is used by most built-in types: *note Format\nSpecification Mini-Language: 3a7.\n\nThe default 'formatspec' is an empty string which usually gives\nthe same effect as calling *note str(value): 157.\n\nA call to 'format(value, formatspec)' is translated to\n'type(value).format(value, formatspec)' which bypasses the\ninstance dictionary when searching for the value's *note\nformat(): 3ea. method.  A *note TypeError: 28e. exception is\nraised if the method search reaches *note object: 8bb. and the\n'formatspec' is non-empty, or if either the 'formatspec' or the\nreturn value are not strings.\n\nChanged in version 3.4: 'object().format(formatspec)' raises\n*note TypeError: 28e. if 'formatspec' is not an empty string.\n\n-- Class: frozenset (iterable=set())\n\nReturn a new *note frozenset: 39e. object, optionally with elements\ntaken from 'iterable'.  'frozenset' is a built-in class.  See *note\nfrozenset: 39e. and *note Set Types -- set, frozenset: 1e7c. for\ndocumentation about this class.\n\nFor other containers see the built-in *note set: 39d, *note list:\n3dc, *note tuple: 4b8, and *note dict: 237. classes, as well as the\n*note collections: 1b. module.\n\n-- Function: getattr (object, name)\n\n-- Function: getattr (object, name, default)\n\nReturn the value of the named attribute of 'object'.  'name' must\nbe a string.  If the string is the name of one of the object's\nattributes, the result is the value of that attribute.  For\nexample, 'getattr(x, 'foobar')' is equivalent to 'x.foobar'.  If\nthe named attribute does not exist, 'default' is returned if\nprovided, otherwise *note AttributeError: 395. is raised.  'name'\nneed not be a Python identifier (see *note setattr(): 1e63.).\n\nNote: Since *note private name mangling: 1d28. happens at\ncompilation time, one must manually mangle a private\nattribute's (attributes with two leading underscores) name in\norder to retrieve it with *note getattr(): a15.\n\n-- Function: globals ()\n\nReturn the dictionary implementing the current module namespace.\nFor code within functions, this is set when the function is defined\nand remains the same regardless of where the function is called.\n\n-- Function: hasattr (object, name)\n\nThe arguments are an object and a string.  The result is 'True' if\nthe string is the name of one of the object's attributes, 'False'\nif not.  (This is implemented by calling 'getattr(object, name)'\nand seeing whether it raises an *note AttributeError: 395. or not.)\n\n-- Function: hash (object)\n\nReturn the hash value of the object (if it has one).  Hash values\nare integers.  They are used to quickly compare dictionary keys\nduring a dictionary lookup.  Numeric values that compare equal have\nthe same hash value (even if they are of different types, as is the\ncase for 1 and 1.0).\n\nNote: For objects with custom *note hash(): 932. methods,\nnote that *note hash(): 3b1. truncates the return value based\non the bit width of the host machine.\n\n-- Function: help ()\n\n-- Function: help (request)\n\nInvoke the built-in help system.  (This function is intended for\ninteractive use.)  If no argument is given, the interactive help\nsystem starts on the interpreter console.  If the argument is a\nstring, then the string is looked up as the name of a module,\nfunction, class, method, keyword, or documentation topic, and a\nhelp page is printed on the console.  If the argument is any other\nkind of object, a help page on the object is generated.\n\nNote that if a slash(/) appears in the parameter list of a function\nwhen invoking *note help(): 6f0, it means that the parameters prior\nto the slash are positional-only.  For more info, see *note the FAQ\nentry on positional-only parameters: 1e7d.\n\nThis function is added to the built-in namespace by the *note site:\nc2. module.\n\nChanged in version 3.4: Changes to *note pydoc: b0. and *note\ninspect: 78. mean that the reported signatures for callables are\nnow more comprehensive and consistent.\n\n-- Function: hex (x)\n\nConvert an integer number to a lowercase hexadecimal string\nprefixed with \"0x\".  If 'x' is not a Python *note int: 17e. object,\nit has to define an *note index(): 4f1. method that returns an\ninteger.  Some examples:\n\n>>> hex(255)\n'0xff'\n>>> hex(-42)\n'-0x2a'\n\nIf you want to convert an integer number to an uppercase or lower\nhexadecimal string with prefix or not, you can use either of the\nfollowing ways:\n\n>>> '%#x' % 255, '%x' % 255, '%X' % 255\n('0xff', 'ff', 'FF')\n>>> format(255, '#x'), format(255, 'x'), format(255, 'X')\n('0xff', 'ff', 'FF')\n>>> f'{255:#x}', f'{255:x}', f'{255:X}'\n('0xff', 'ff', 'FF')\n\nSee also *note format(): 3eb. for more information.\n\nSee also *note int(): 17e. for converting a hexadecimal string to\nan integer using a base of 16.\n\nNote: To obtain a hexadecimal string representation for a\nfloat, use the *note float.hex(): 1a96. method.\n\n-- Function: id (object)\n\nReturn the \"identity\" of an object.  This is an integer which is\nguaranteed to be unique and constant for this object during its\nlifetime.  Two objects with non-overlapping lifetimes may have the\nsame *note id(): 1279. value.\n\n'CPython implementation detail:' This is the address of the object\nin memory.\n\nRaises an *note auditing event: 161d. 'builtins.id' with argument\n'id'.\n\n-- Function: input ()\n\n-- Function: input (prompt)\n\nIf the 'prompt' argument is present, it is written to standard\noutput without a trailing newline.  The function then reads a line\nfrom input, converts it to a string (stripping a trailing newline),\nand returns that.  When EOF is read, *note EOFError: 114e. is\nraised.  Example:\n\n>>> s = input('--> ')\n--> Monty Python's Flying Circus\n>>> s\n\"Monty Python's Flying Circus\"\n\nIf the *note readline: b5. module was loaded, then *note input():\n114d. will use it to provide elaborate line editing and history\nfeatures.\n\nRaises an *note auditing event: 161d. 'builtins.input' with\nargument 'prompt' before reading input\n\nRaises an *note auditing event: 161d. 'builtins.input/result' with\nthe result after successfully reading input.\n\n-- Class: int (x=0)\n\n-- Class: int (x, base=10)\n\nReturn an integer object constructed from a number or string 'x',\nor return '0' if no arguments are given.  If 'x' defines *note\nint(): 4f0, 'int(x)' returns 'x.int()'.  If 'x' defines\n*note index(): 4f1, it returns 'x.index()'.  If 'x' defines\n*note trunc(): 4ef, it returns 'x.trunc()'.  For floating\npoint numbers, this truncates towards zero.\n\nIf 'x' is not a number or if 'base' is given, then 'x' must be a\nstring, *note bytes: 295, or *note bytearray: 294. instance\nrepresenting an integer in radix 'base'.  Optionally, the string\ncan be preceded by '+' or '-' (with no space in between), have\nleading zeros, be surrounded by whitespace, and have single\nunderscores interspersed between digits.\n\nA base-n integer string contains digits, each representing a value\nfrom 0 to n-1.  The values 0-9 can be represented by any Unicode\ndecimal digit.  The values 10-35 can be represented by 'a' to 'z'\n(or 'A' to 'Z').  The default 'base' is 10.  The allowed bases are\n0 and 2-36.  Base-2, -8, and -16 strings can be optionally prefixed\nwith '0b'/'0B', '0o'/'0O', or '0x'/'0X', as with integer literals\nin code.  For base 0, the string is interpreted in a similar way to\nan *note integer literal in code: 1be6, in that the actual base is\n2, 8, 10, or 16 as determined by the prefix.  Base 0 also disallows\nleading zeros: 'int('010', 0)' is not legal, while 'int('010')' and\n'int('010', 8)' are.\n\nThe integer type is described in *note Numeric Types -- int, float,\ncomplex: 197e.\n\nChanged in version 3.4: If 'base' is not an instance of *note int:\n17e. and the 'base' object has a *note base.index: 4f1. method,\nthat method is called to obtain an integer for the base.  Previous\nversions used *note base.int: 4f0. instead of *note\nbase.index: 4f1.\n\nChanged in version 3.6: Grouping digits with underscores as in code\nliterals is allowed.\n\nChanged in version 3.7: 'x' is now a positional-only parameter.\n\nChanged in version 3.8: Falls back to *note index(): 4f1. if\n*note int(): 4f0. is not defined.\n\nChanged in version 3.11: The delegation to *note trunc(): 4ef.\nis deprecated.\n\nChanged in version 3.11: *note int: 17e. string inputs and string\nrepresentations can be limited to help avoid denial of service\nattacks.  A *note ValueError: 183. is raised when the limit is\nexceeded while converting a string 'x' to an *note int: 17e. or\nwhen converting an *note int: 17e. into a string would exceed the\nlimit.  See the *note integer string conversion length limitation:\n3bc. documentation.\n\n-- Function: isinstance (object, classinfo)\n\nReturn 'True' if the 'object' argument is an instance of the\n'classinfo' argument, or of a (direct, indirect, or *note virtual:\n102a.) subclass thereof.  If 'object' is not an object of the given\ntype, the function always returns 'False'.  If 'classinfo' is a\ntuple of type objects (or recursively, other such tuples) or a\n*note Union Type: 5b5. of multiple types, return 'True' if 'object'\nis an instance of any of the types.  If 'classinfo' is not a type\nor tuple of types and such tuples, a *note TypeError: 28e.\nexception is raised.  *note TypeError: 28e. may not be raised for\nan invalid type if an earlier check succeeds.\n\nChanged in version 3.10: 'classinfo' can be a *note Union Type:\n5b5.\n\n-- Function: issubclass (class, classinfo)\n\nReturn 'True' if 'class' is a subclass (direct, indirect, or *note\nvirtual: 102a.) of 'classinfo'.  A class is considered a subclass\nof itself.  'classinfo' may be a tuple of class objects (or\nrecursively, other such tuples) or a *note Union Type: 5b5, in\nwhich case return 'True' if 'class' is a subclass of any entry in\n'classinfo'.  In any other case, a *note TypeError: 28e. exception\nis raised.\n\nChanged in version 3.10: 'classinfo' can be a *note Union Type:\n5b5.\n\n-- Function: iter (object)\n\n-- Function: iter (object, sentinel)\n\nReturn an *note iterator: 16a9. object.  The first argument is\ninterpreted very differently depending on the presence of the\nsecond argument.  Without a second argument, 'object' must be a\ncollection object which supports the *note iterable: 109d. protocol\n(the *note iter(): 1c61. method), or it must support the\nsequence protocol (the *note getitem(): 4b9. method with\ninteger arguments starting at '0').  If it does not support either\nof those protocols, *note TypeError: 28e. is raised.  If the second\nargument, 'sentinel', is given, then 'object' must be a callable\nobject.  The iterator created in this case will call 'object' with\nno arguments for each call to its *note next(): 1141. method;\nif the value returned is equal to 'sentinel', *note StopIteration:\na40. will be raised, otherwise the value will be returned.\n\nSee also *note Iterator Types: 1e7e.\n\nOne useful application of the second form of *note iter(): 5ca. is\nto build a block-reader.  For example, reading fixed-width blocks\nfrom a binary database file until the end of file is reached:\n\nfrom functools import partial\nwith open('mydata.db', 'rb') as f:\nfor block in iter(partial(f.read, 64), b''):\nprocessblock(block)\n\n-- Function: len (s)\n\nReturn the length (the number of items) of an object.  The argument\nmay be a sequence (such as a string, bytes, tuple, list, or range)\nor a collection (such as a dictionary, set, or frozen set).\n\n'CPython implementation detail:' 'len' raises *note OverflowError:\n68d. on lengths larger than *note sys.maxsize: 1039, such as *note\nrange(2  100): 761.\n\n-- Class: list\n\n-- Class: list (iterable)\n\nRather than being a function, *note list: 3dc. is actually a\nmutable sequence type, as documented in *note Lists: 1e7f. and\n*note Sequence Types -- list, tuple, range: 19ce.\n\n-- Function: locals ()\n\nUpdate and return a dictionary representing the current local\nsymbol table.  Free variables are returned by *note locals(): 173.\nwhen it is called in function blocks, but not in class blocks.\nNote that at the module level, *note locals(): 173. and *note\nglobals(): 15c9. are the same dictionary.\n\nNote: The contents of this dictionary should not be modified;\nchanges may not affect the values of local and free variables\nused by the interpreter.\n\n-- Function: map (function, iterable, *iterables)\n\nReturn an iterator that applies 'function' to every item of\n'iterable', yielding the results.  If additional 'iterables'\narguments are passed, 'function' must take that many arguments and\nis applied to the items from all iterables in parallel.  With\nmultiple iterables, the iterator stops when the shortest iterable\nis exhausted.  For cases where the function inputs are already\narranged into argument tuples, see *note itertools.starmap(): f53.\n\n-- Function: max (iterable, *, key=None)\n\n-- Function: max (iterable, *, default, key=None)\n\n-- Function: max (arg1, arg2, *args, key=None)\n\nReturn the largest item in an iterable or the largest of two or\nmore arguments.\n\nIf one positional argument is provided, it should be an *note\niterable: 109d.  The largest item in the iterable is returned.  If\ntwo or more positional arguments are provided, the largest of the\npositional arguments is returned.\n\nThere are two optional keyword-only arguments.  The 'key' argument\nspecifies a one-argument ordering function like that used for *note\nlist.sort(): a13.  The 'default' argument specifies an object to\nreturn if the provided iterable is empty.  If the iterable is empty\nand 'default' is not provided, a *note ValueError: 183. is raised.\n\nIf multiple items are maximal, the function returns the first one\nencountered.  This is consistent with other sort-stability\npreserving tools such as 'sorted(iterable, key=keyfunc,\nreverse=True)[0]' and 'heapq.nlargest(1, iterable, key=keyfunc)'.\n\nChanged in version 3.4: Added the 'default' keyword-only parameter.\n\nChanged in version 3.8: The 'key' can be 'None'.\n\n-- Class: memoryview (object)\n\nReturn a \"memory view\" object created from the given argument.  See\n*note Memory Views: 1e80. for more information.\n\n-- Function: min (iterable, *, key=None)\n\n-- Function: min (iterable, *, default, key=None)\n\n-- Function: min (arg1, arg2, *args, key=None)\n\nReturn the smallest item in an iterable or the smallest of two or\nmore arguments.\n\nIf one positional argument is provided, it should be an *note\niterable: 109d.  The smallest item in the iterable is returned.  If\ntwo or more positional arguments are provided, the smallest of the\npositional arguments is returned.\n\nThere are two optional keyword-only arguments.  The 'key' argument\nspecifies a one-argument ordering function like that used for *note\nlist.sort(): a13.  The 'default' argument specifies an object to\nreturn if the provided iterable is empty.  If the iterable is empty\nand 'default' is not provided, a *note ValueError: 183. is raised.\n\nIf multiple items are minimal, the function returns the first one\nencountered.  This is consistent with other sort-stability\npreserving tools such as 'sorted(iterable, key=keyfunc)[0]' and\n'heapq.nsmallest(1, iterable, key=keyfunc)'.\n\nChanged in version 3.4: Added the 'default' keyword-only parameter.\n\nChanged in version 3.8: The 'key' can be 'None'.\n\n-- Function: next (iterator)\n\n-- Function: next (iterator, default)\n\nRetrieve the next item from the *note iterator: 16a9. by calling\nits *note next(): 1141. method.  If 'default' is given, it is\nreturned if the iterator is exhausted, otherwise *note\nStopIteration: a40. is raised.\n\n-- Class: object\n\nReturn a new featureless object.  *note object: 8bb. is a base for\nall classes.  It has methods that are common to all instances of\nPython classes.  This function does not accept any arguments.\n\nNote: *note object: 8bb. does 'not' have a *note dict:\naa8, so you can't assign arbitrary attributes to an instance\nof the *note object: 8bb. class.\n\n-- Function: oct (x)\n\nConvert an integer number to an octal string prefixed with \"0o\".\nThe result is a valid Python expression.  If 'x' is not a Python\n*note int: 17e. object, it has to define an *note index(): 4f1.\nmethod that returns an integer.  For example:\n\n>>> oct(8)\n'0o10'\n>>> oct(-56)\n'-0o70'\n\nIf you want to convert an integer number to an octal string either\nwith the prefix \"0o\" or not, you can use either of the following\nways.\n\n>>> '%#o' % 10, '%o' % 10\n('0o12', '12')\n>>> format(10, '#o'), format(10, 'o')\n('0o12', '12')\n>>> f'{10:#o}', f'{10:o}'\n('0o12', '12')\n\nSee also *note format(): 3eb. for more information.\n\n-- Function: open (file, mode='r', buffering=-1, encoding=None,\nerrors=None, newline=None, closefd=True, opener=None)\n\nOpen 'file' and return a corresponding *note file object: 1037.  If\nthe file cannot be opened, an *note OSError: 613. is raised.  See\n*note Reading and Writing Files: 1a04. for more examples of how to\nuse this function.\n\n'file' is a *note path-like object: 957. giving the pathname\n(absolute or relative to the current working directory) of the file\nto be opened or an integer file descriptor of the file to be\nwrapped.  (If a file descriptor is given, it is closed when the\nreturned I/O object is closed unless 'closefd' is set to 'False'.)\n\n'mode' is an optional string that specifies the mode in which the\nfile is opened.  It defaults to ''r'' which means open for reading\nin text mode.  Other common values are ''w'' for writing\n(truncating the file if it already exists), ''x'' for exclusive\ncreation, and ''a'' for appending (which on 'some' Unix systems,\nmeans that 'all' writes append to the end of the file regardless of\nthe current seek position).  In text mode, if 'encoding' is not\nspecified the encoding used is platform-dependent: *note\nlocale.getencoding(): 41f. is called to get the current locale\nencoding.  (For reading and writing raw bytes use binary mode and\nleave 'encoding' unspecified.)  The available modes are:\n\nCharacter     Meaning\n\n----------------------------------------------------------------------------------\n\n''r''         open for reading (default)\n\n\n''w''         open for writing, truncating the file first\n\n\n''x''         open for exclusive creation, failing if the file already exists\n\n\n''a''         open for writing, appending to the end of file if it exists\n\n\n''b''         binary mode\n\n\n''t''         text mode (default)\n\n\n''+''         open for updating (reading and writing)\n\n\nThe default mode is ''r'' (open for reading text, a synonym of\n''rt'').  Modes ''w+'' and ''w+b'' open and truncate the file.\nModes ''r+'' and ''r+b'' open the file with no truncation.\n\nAs mentioned in the *note Overview: 1e82, Python distinguishes\nbetween binary and text I/O. Files opened in binary mode (including\n''b'' in the 'mode' argument) return contents as *note bytes: 295.\nobjects without any decoding.  In text mode (the default, or when\n''t'' is included in the 'mode' argument), the contents of the file\nare returned as *note str: 157, the bytes having been first decoded\nusing a platform-dependent encoding or using the specified\n'encoding' if given.\n\nNote: Python doesn't depend on the underlying operating\nsystem's notion of text files; all the processing is done by\nPython itself, and is therefore platform-independent.\n\n'buffering' is an optional integer used to set the buffering\npolicy.  Pass 0 to switch buffering off (only allowed in binary\nmode), 1 to select line buffering (only usable when writing in text\nmode), and an integer > 1 to indicate the size in bytes of a\nfixed-size chunk buffer.  Note that specifying a buffer size this\nway applies for binary buffered I/O, but 'TextIOWrapper' (i.e.,\nfiles opened with 'mode='r+'') would have another buffering.  To\ndisable buffering in 'TextIOWrapper', consider using the\n'writethrough' flag for *note io.TextIOWrapper.reconfigure(): 983.\nWhen no 'buffering' argument is given, the default buffering policy\nworks as follows:\n\n* Binary files are buffered in fixed-size chunks; the size of\nthe buffer is chosen using a heuristic trying to determine the\nunderlying device's \"block size\" and falling back on *note\nio.DEFAULTBUFFERSIZE: 13eb.  On many systems, the buffer\nwill typically be 4096 or 8192 bytes long.\n\n* \"Interactive\" text files (files for which *note isatty():\n1a07. returns 'True') use line buffering.  Other text files\nuse the policy described above for binary files.\n\n'encoding' is the name of the encoding used to decode or encode the\nfile.  This should only be used in text mode.  The default encoding\nis platform dependent (whatever *note locale.getencoding(): 41f.\nreturns), but any *note text encoding: 1e83. supported by Python\ncan be used.  See the *note codecs: 19. module for the list of\nsupported encodings.\n\n'errors' is an optional string that specifies how encoding and\ndecoding errors are to be handled--this cannot be used in binary\nmode.  A variety of standard error handlers are available (listed\nunder *note Error Handlers: 1543.), though any error handling name\nthat has been registered with *note codecs.registererror(): 12f0.\nis also valid.  The standard names include:\n\n* ''strict'' to raise a *note ValueError: 183. exception if\nthere is an encoding error.  The default value of 'None' has\nthe same effect.\n\n* ''ignore'' ignores errors.  Note that ignoring encoding errors\ncan lead to data loss.\n\n* ''replace'' causes a replacement marker (such as ''?'') to be\ninserted where there is malformed data.\n\n* ''surrogateescape'' will represent any incorrect bytes as low\nsurrogate code units ranging from U+DC80 to U+DCFF. These\nsurrogate code units will then be turned back into the same\nbytes when the 'surrogateescape' error handler is used when\nwriting data.  This is useful for processing files in an\nunknown encoding.\n\n* ''xmlcharrefreplace'' is only supported when writing to a\nfile.  Characters not supported by the encoding are replaced\nwith the appropriate XML character reference '&#NNN;'.\n\n* ''backslashreplace'' replaces malformed data by Python's\nbackslashed escape sequences.\n\n* ''namereplace'' (also only supported when writing) replaces\nunsupported characters with '\\N{...}' escape sequences.\n\n'newline' determines how to parse newline characters from the\nstream.  It can be 'None', '''', ''\\n'', ''\\r'', and ''\\r\\n''.  It\nworks as follows:\n\n* When reading input from the stream, if 'newline' is 'None',\nuniversal newlines mode is enabled.  Lines in the input can\nend in ''\\n'', ''\\r'', or ''\\r\\n'', and these are translated\ninto ''\\n'' before being returned to the caller.  If it is\n'''', universal newlines mode is enabled, but line endings are\nreturned to the caller untranslated.  If it has any of the\nother legal values, input lines are only terminated by the\ngiven string, and the line ending is returned to the caller\nuntranslated.\n\n* When writing output to the stream, if 'newline' is 'None', any\n''\\n'' characters written are translated to the system default\nline separator, *note os.linesep: 1e84.  If 'newline' is ''''\nor ''\\n'', no translation takes place.  If 'newline' is any of\nthe other legal values, any ''\\n'' characters written are\ntranslated to the given string.\n\nIf 'closefd' is 'False' and a file descriptor rather than a\nfilename was given, the underlying file descriptor will be kept\nopen when the file is closed.  If a filename is given 'closefd'\nmust be 'True' (the default); otherwise, an error will be raised.\n\nA custom opener can be used by passing a callable as 'opener'.  The\nunderlying file descriptor for the file object is then obtained by\ncalling 'opener' with ('file', 'flags').  'opener' must return an\nopen file descriptor (passing *note os.open: bee. as 'opener'\nresults in functionality similar to passing 'None').\n\nThe newly created file is *note non-inheritable: d60.\n\nThe following example uses the *note dirfd: f59. parameter of the\n*note os.open(): bee. function to open a file relative to a given\ndirectory:\n\n>>> import os\n>>> dirfd = os.open('somedir', os.ORDONLY)\n>>> def opener(path, flags):\n...     return os.open(path, flags, dirfd=dirfd)\n...\n>>> with open('spamspam.txt', 'w', opener=opener) as f:\n...     print('This will be written to somedir/spamspam.txt', file=f)\n...\n>>> os.close(dirfd)  # don't leak a file descriptor\n\nThe type of *note file object: 1037. returned by the *note open():\n26e. function depends on the mode.  When *note open(): 26e. is used\nto open a file in a text mode (''w'', ''r'', ''wt'', ''rt'', etc.),\nit returns a subclass of *note io.TextIOBase: 461. (specifically\n*note io.TextIOWrapper: b8f.).  When used to open a file in a\nbinary mode with buffering, the returned class is a subclass of\n*note io.BufferedIOBase: 460.  The exact class varies: in read\nbinary mode, it returns an *note io.BufferedReader: 1082.; in write\nbinary and append binary modes, it returns an *note\nio.BufferedWriter: 1e85, and in read/write mode, it returns an\n*note io.BufferedRandom: 1e86.  When buffering is disabled, the raw\nstream, a subclass of *note io.RawIOBase: f40, *note io.FileIO:\n1186, is returned.\n\nSee also the file handling modules, such as *note fileinput: 56,\n*note io: 79. (where *note open(): 26e. is declared), *note os: 9c,\n*note os.path: 9d, *note tempfile: da, and *note shutil: c0.\n\nRaises an *note auditing event: 161d. 'open' with arguments 'file',\n'mode', 'flags'.\n\nThe 'mode' and 'flags' arguments may have been modified or inferred\nfrom the original call.\n\nChanged in version 3.3:\n\n* The 'opener' parameter was added.\n\n* The ''x'' mode was added.\n\n* *note IOError: ecb. used to be raised, it is now an alias of\n*note OSError: 613.\n\n* *note FileExistsError: e97. is now raised if the file opened\nin exclusive creation mode (''x'') already exists.\n\nChanged in version 3.4:\n\n* The file is now non-inheritable.\n\nChanged in version 3.5:\n\n* If the system call is interrupted and the signal handler does\nnot raise an exception, the function now retries the system\ncall instead of raising an *note InterruptedError: be3.\nexception (see PEP 475(2) for the rationale).\n\n* The ''namereplace'' error handler was added.\n\nChanged in version 3.6:\n\n* Support added to accept objects implementing *note\nos.PathLike: a9a.\n\n* On Windows, opening a console buffer may return a subclass of\n*note io.RawIOBase: f40. other than *note io.FileIO: 1186.\n\nChanged in version 3.11: The ''U'' mode has been removed.\n\n-- Function: ord (c)\n\nGiven a string representing one Unicode character, return an\ninteger representing the Unicode code point of that character.  For\nexample, 'ord('a')' returns the integer '97' and 'ord('???')' (Euro\nsign) returns '8364'.  This is the inverse of *note chr(): 1c11.\n\n-- Function: pow (base, exp, mod=None)\n\nReturn 'base' to the power 'exp'; if 'mod' is present, return\n'base' to the power 'exp', modulo 'mod' (computed more efficiently\nthan 'pow(base, exp) % mod').  The two-argument form 'pow(base,\nexp)' is equivalent to using the power operator: 'baseexp'.\n\nThe arguments must have numeric types.  With mixed operand types,\nthe coercion rules for binary arithmetic operators apply.  For\n*note int: 17e. operands, the result has the same type as the\noperands (after coercion) unless the second argument is negative;\nin that case, all arguments are converted to float and a float\nresult is delivered.  For example, 'pow(10, 2)' returns '100', but\n'pow(10, -2)' returns '0.01'.  For a negative base of type *note\nint: 17e. or *note float: 4b7. and a non-integral exponent, a\ncomplex result is delivered.  For example, 'pow(-9, 0.5)' returns a\nvalue close to '3j'.\n\nFor *note int: 17e. operands 'base' and 'exp', if 'mod' is present,\n'mod' must also be of integer type and 'mod' must be nonzero.  If\n'mod' is present and 'exp' is negative, 'base' must be relatively\nprime to 'mod'.  In that case, 'pow(invbase, -exp, mod)' is\nreturned, where 'invbase' is an inverse to 'base' modulo 'mod'.\n\nHere's an example of computing an inverse for '38' modulo '97':\n\n>>> pow(38, -1, mod=97)\n23\n>>> 23 * 38 % 97 == 1\nTrue\n\nChanged in version 3.8: For *note int: 17e. operands, the\nthree-argument form of 'pow' now allows the second argument to be\nnegative, permitting computation of modular inverses.\n\nChanged in version 3.8: Allow keyword arguments.  Formerly, only\npositional arguments were supported.\n\n-- Function: print (*objects, sep=' ', end='\\n', file=None,\nflush=False)\n\nPrint 'objects' to the text stream 'file', separated by 'sep' and\nfollowed by 'end'.  'sep', 'end', 'file', and 'flush', if present,\nmust be given as keyword arguments.\n\nAll non-keyword arguments are converted to strings like *note\nstr(): 157. does and written to the stream, separated by 'sep' and\nfollowed by 'end'.  Both 'sep' and 'end' must be strings; they can\nalso be 'None', which means to use the default values.  If no\n'objects' are given, *note print(): de5. will just write 'end'.\n\nThe 'file' argument must be an object with a 'write(string)'\nmethod; if it is not present or 'None', *note sys.stdout: 90c. will\nbe used.  Since printed arguments are converted to text strings,\n*note print(): de5. cannot be used with binary mode file objects.\nFor these, use 'file.write(...)' instead.\n\nOutput buffering is usually determined by 'file'.  However, if\n'flush' is true, the stream is forcibly flushed.\n\nChanged in version 3.3: Added the 'flush' keyword argument.\n\n-- Class: property (fget=None, fset=None, fdel=None, doc=None)\n\nReturn a property attribute.\n\n'fget' is a function for getting an attribute value.  'fset' is a\nfunction for setting an attribute value.  'fdel' is a function for\ndeleting an attribute value.  And 'doc' creates a docstring for the\nattribute.\n\nA typical use is to define a managed attribute 'x':\n\nclass C:\ndef init(self):\nself.x = None\n\ndef getx(self):\nreturn self.x\n\ndef setx(self, value):\nself.x = value\n\ndef delx(self):\ndel self.x\n\nx = property(getx, setx, delx, \"I'm the 'x' property.\")\n\nIf 'c' is an instance of 'C', 'c.x' will invoke the getter, 'c.x =\nvalue' will invoke the setter, and 'del c.x' the deleter.\n\nIf given, 'doc' will be the docstring of the property attribute.\nOtherwise, the property will copy 'fget''s docstring (if it\nexists).  This makes it possible to create read-only properties\neasily using *note property(): 3f6. as a *note decorator: 514.:\n\nclass Parrot:\ndef init(self):\nself.voltage = 100000\n\n@property\ndef voltage(self):\n\"\"\"Get the current voltage.\"\"\"\nreturn self.voltage\n\nThe '@property' decorator turns the 'voltage()' method into a\n\"getter\" for a read-only attribute with the same name, and it sets\nthe docstring for 'voltage' to \"Get the current voltage.\"\n\n-- Function: @getter\n\n-- Function: @setter\n\n-- Function: @deleter\n\nA property object has 'getter', 'setter', and 'deleter'\nmethods usable as decorators that create a copy of the\nproperty with the corresponding accessor function set to the\ndecorated function.  This is best explained with an example:\n\nclass C:\ndef init(self):\nself.x = None\n\n@property\ndef x(self):\n\"\"\"I'm the 'x' property.\"\"\"\nreturn self.x\n\n@x.setter\ndef x(self, value):\nself.x = value\n\n@x.deleter\ndef x(self):\ndel self.x\n\nThis code is exactly equivalent to the first example.  Be sure\nto give the additional functions the same name as the original\nproperty ('x' in this case.)\n\nThe returned property object also has the attributes 'fget',\n'fset', and 'fdel' corresponding to the constructor arguments.\n\nChanged in version 3.5: The docstrings of property objects are now\nwriteable.\n\n-- Class: range (stop)\n\n-- Class: range (start, stop, step=1)\n\nRather than being a function, *note range: 761. is actually an\nimmutable sequence type, as documented in *note Ranges: 1e87. and\n*note Sequence Types -- list, tuple, range: 19ce.\n\n-- Function: repr (object)\n\nReturn a string containing a printable representation of an object.\nFor many types, this function makes an attempt to return a string\nthat would yield an object with the same value when passed to *note\neval(): 690.; otherwise, the representation is a string enclosed in\nangle brackets that contains the name of the type of the object\ntogether with additional information often including the name and\naddress of the object.  A class can control what this function\nreturns for its instances by defining a *note repr(): 3e8.\nmethod.  If *note sys.displayhook(): 137a. is not accessible, this\nfunction will raise *note RuntimeError: 17a.\n\nThis class has a custom representation that can be evaluated:\n\nclass Person:\ndef init(self, name, age):\nself.name = name\nself.age = age\n\ndef repr(self):\nreturn f\"Person('{self.name}', {self.age})\"\n\n-- Function: reversed (seq)\n\nReturn a reverse *note iterator: 16a9.  'seq' must be an object\nwhich has a *note reversed(): 1c62. method or supports the\nsequence protocol (the *note len(): 1c68. method and the *note\ngetitem(): 4b9. method with integer arguments starting at '0').\n\n-- Function: round (number, ndigits=None)\n\nReturn 'number' rounded to 'ndigits' precision after the decimal\npoint.  If 'ndigits' is omitted or is 'None', it returns the\nnearest integer to its input.\n\nFor the built-in types supporting *note round(): 114f, values are\nrounded to the closest multiple of 10 to the power minus 'ndigits';\nif two multiples are equally close, rounding is done toward the\neven choice (so, for example, both 'round(0.5)' and 'round(-0.5)'\nare '0', and 'round(1.5)' is '2').  Any integer value is valid for\n'ndigits' (positive, zero, or negative).  The return value is an\ninteger if 'ndigits' is omitted or 'None'.  Otherwise, the return\nvalue has the same type as 'number'.\n\nFor a general Python object 'number', 'round' delegates to\n'number.round'.\n\nNote: The behavior of *note round(): 114f. for floats can be\nsurprising: for example, 'round(2.675, 2)' gives '2.67'\ninstead of the expected '2.68'.  This is not a bug: it's a\nresult of the fact that most decimal fractions can't be\nrepresented exactly as a float.  See *note Floating Point\nArithmetic; Issues and Limitations: 1a94. for more\ninformation.\n\n-- Class: set\n\n-- Class: set (iterable)\n\nReturn a new *note set: 39d. object, optionally with elements taken\nfrom 'iterable'.  'set' is a built-in class.  See *note set: 39d.\nand *note Set Types -- set, frozenset: 1e7c. for documentation about\nthis class.\n\nFor other containers see the built-in *note frozenset: 39e, *note\nlist: 3dc, *note tuple: 4b8, and *note dict: 237. classes, as well\nas the *note collections: 1b. module.\n\n-- Function: setattr (object, name, value)\n\nThis is the counterpart of *note getattr(): a15.  The arguments are\nan object, a string, and an arbitrary value.  The string may name\nan existing attribute or a new attribute.  The function assigns the\nvalue to the attribute, provided the object allows it.  For\nexample, 'setattr(x, 'foobar', 123)' is equivalent to 'x.foobar =\n123'.\n\n'name' need not be a Python identifier as defined in *note\nIdentifiers and keywords: 1bb5. unless the object chooses to\nenforce that, for example in a custom *note getattribute():\na16. or via *note slots: 1344.  An attribute whose name is not\nan identifier will not be accessible using the dot notation, but is\naccessible through *note getattr(): a15. etc..\n\nNote: Since *note private name mangling: 1d28. happens at\ncompilation time, one must manually mangle a private\nattribute's (attributes with two leading underscores) name in\norder to set it with *note setattr(): 1e63.\n\n-- Class: slice (stop)\n\n-- Class: slice (start, stop, step=None)\n\nReturn a *note slice: 1e88. object representing the set of indices\nspecified by 'range(start, stop, step)'.  The 'start' and 'step'\narguments default to 'None'.\n\n-- Attribute: start\n\n-- Attribute: stop\n\n-- Attribute: step\n\nSlice objects have read-only data attributes 'start', 'stop',\nand 'step' which merely return the argument values (or their\ndefault).  They have no other explicit functionality; however,\nthey are used by NumPy and other third-party packages.\n\nSlice objects are also generated when extended indexing syntax is\nused.  For example: 'a[start:stop:step]' or 'a[start:stop, i]'.\nSee *note itertools.islice(): 988. for an alternate version that\nreturns an *note iterator: 16a9.\n\nChanged in version 3.12: Slice objects are now *note hashable: 3db.\n(provided *note start: 1c5b, *note stop: 1c5c, and *note step:\n1c5d. are hashable).\n\n-- Function: sorted (iterable, /, *, key=None, reverse=False)\n\nReturn a new sorted list from the items in 'iterable'.\n\nHas two optional arguments which must be specified as keyword\narguments.\n\n'key' specifies a function of one argument that is used to extract\na comparison key from each element in 'iterable' (for example,\n'key=str.lower').  The default value is 'None' (compare the\nelements directly).\n\n'reverse' is a boolean value.  If set to 'True', then the list\nelements are sorted as if each comparison were reversed.\n\nUse *note functools.cmptokey(): 104e. to convert an old-style\n'cmp' function to a 'key' function.\n\nThe built-in *note sorted(): a12. function is guaranteed to be\nstable.  A sort is stable if it guarantees not to change the\nrelative order of elements that compare equal -- this is helpful for\nsorting in multiple passes (for example, sort by department, then\nby salary grade).\n\nThe sort algorithm uses only '<' comparisons between items.  While\ndefining an *note lt(): 1180. method will suffice for sorting,\nPEP 8(3) recommends that all six *note rich comparisons: 1d7f. be\nimplemented.  This will help avoid bugs when using the same data\nwith other ordering tools such as *note max(): d70. that rely on a\ndifferent underlying method.  Implementing all six comparisons also\nhelps avoid confusion for mixed type comparisons which can call\nreflected the *note gt(): 1182. method.\n\nFor sorting examples and a brief sorting tutorial, see *note\nSorting Techniques: 1e89.\n\n-- Function: @staticmethod\n\nTransform a method into a static method.\n\nA static method does not receive an implicit first argument.  To\ndeclare a static method, use this idiom:\n\nclass C:\n@staticmethod\ndef f(arg1, arg2, argN): ...\n\nThe '@staticmethod' form is a function *note decorator: 514. - see\n*note Function definitions: 19bb. for details.\n\nA static method can be called either on the class (such as 'C.f()')\nor on an instance (such as 'C().f()').  Moreover, they can be\ncalled as regular functions (such as 'f()').\n\nStatic methods in Python are similar to those found in Java or C++.\nAlso, see *note classmethod(): 246. for a variant that is useful\nfor creating alternate class constructors.\n\nLike all decorators, it is also possible to call 'staticmethod' as\na regular function and do something with its result.  This is\nneeded in some cases where you need a reference to a function from\na class body and you want to avoid the automatic transformation to\ninstance method.  For these cases, use this idiom:\n\ndef regularfunction():\n...\n\nclass C:\nmethod = staticmethod(regularfunction)\n\nFor more information on static methods, see *note The standard type\nhierarchy: 1c05.\n\nChanged in version 3.10: Static methods now inherit the method\nattributes ('module', 'name', 'qualname', 'doc' and\n'annotations'), have a new 'wrapped' attribute, and are now\ncallable as regular functions.\n\n-- Class: str (object='')\n\n-- Class: str (object=b'', encoding='utf-8', errors='strict')\n\nReturn a *note str: 157. version of 'object'.  See *note str():\n157. for details.\n\n'str' is the built-in string *note class: 1698.  For general\ninformation about strings, see *note Text Sequence Type -- str:\n1983.\n\n-- Function: sum (iterable, /, start=0)\n\nSums 'start' and the items of an 'iterable' from left to right and\nreturns the total.  The 'iterable''s items are normally numbers,\nand the start value is not allowed to be a string.\n\nFor some use cases, there are good alternatives to *note sum():\n181.  The preferred, fast way to concatenate a sequence of strings\nis by calling '''.join(sequence)'.  To add floating point values\nwith extended precision, see *note math.fsum(): 1229.  To\nconcatenate a series of iterables, consider using *note\nitertools.chain(): 1e8a.\n\nChanged in version 3.8: The 'start' parameter can be specified as a\nkeyword argument.\n\nChanged in version 3.12: Summation of floats switched to an\nalgorithm that gives higher accuracy on most builds.\n\n-- Class: super\n\n-- Class: super (type, objectortype=None)\n\nReturn a proxy object that delegates method calls to a parent or\nsibling class of 'type'.  This is useful for accessing inherited\nmethods that have been overridden in a class.\n\nThe 'objectortype' determines the *note method resolution order:\n1e8b. to be searched.  The search starts from the class right after\nthe 'type'.\n\nFor example, if *note mro: 1e8c. of 'objectortype' is 'D -> B\n-> C -> A -> object' and the value of 'type' is 'B', then *note\nsuper(): 204. searches 'C -> A -> object'.\n\nThe *note mro: 1e8c. attribute of the 'objectortype' lists\nthe method resolution search order used by both *note getattr():\na15. and *note super(): 204.  The attribute is dynamic and can\nchange whenever the inheritance hierarchy is updated.\n\nIf the second argument is omitted, the super object returned is\nunbound.  If the second argument is an object, 'isinstance(obj,\ntype)' must be true.  If the second argument is a type,\n'issubclass(type2, type)' must be true (this is useful for\nclassmethods).\n\nThere are two typical use cases for 'super'.  In a class hierarchy\nwith single inheritance, 'super' can be used to refer to parent\nclasses without naming them explicitly, thus making the code more\nmaintainable.  This use closely parallels the use of 'super' in\nother programming languages.\n\nThe second use case is to support cooperative multiple inheritance\nin a dynamic execution environment.  This use case is unique to\nPython and is not found in statically compiled languages or\nlanguages that only support single inheritance.  This makes it\npossible to implement \"diamond diagrams\" where multiple base\nclasses implement the same method.  Good design dictates that such\nimplementations have the same calling signature in every case\n(because the order of calls is determined at runtime, because that\norder adapts to changes in the class hierarchy, and because that\norder can include sibling classes that are unknown prior to\nruntime).\n\nFor both use cases, a typical superclass call looks like this:\n\nclass C(B):\ndef method(self, arg):\nsuper().method(arg)    # This does the same thing as:\n# super(C, self).method(arg)\n\nIn addition to method lookups, *note super(): 204. also works for\nattribute lookups.  One possible use case for this is calling *note\ndescriptors: 1c78. in a parent or sibling class.\n\nNote that *note super(): 204. is implemented as part of the binding\nprocess for explicit dotted attribute lookups such as\n'super().getitem(name)'.  It does so by implementing its own\n*note getattribute(): a16. method for searching classes in a\npredictable order that supports cooperative multiple inheritance.\nAccordingly, *note super(): 204. is undefined for implicit lookups\nusing statements or operators such as 'super()[name]'.\n\nAlso note that, aside from the zero argument form, *note super():\n204. is not limited to use inside methods.  The two argument form\nspecifies the arguments exactly and makes the appropriate\nreferences.  The zero argument form only works inside a class\ndefinition, as the compiler fills in the necessary details to\ncorrectly retrieve the class being defined, as well as accessing\nthe current instance for ordinary methods.\n\nFor practical suggestions on how to design cooperative classes\nusing *note super(): 204, see guide to using super()(4).\n\n-- Class: tuple\n\n-- Class: tuple (iterable)\n\nRather than being a function, *note tuple: 4b8. is actually an\nimmutable sequence type, as documented in *note Tuples: 1df1. and\n*note Sequence Types -- list, tuple, range: 19ce.\n\n-- Class: type (object)\n\n-- Class: type (name, bases, dict, kwds)\n\nWith one argument, return the type of an 'object'.  The return\nvalue is a type object and generally the same object as returned by\n*note object.class: 1304.\n\nThe *note isinstance(): 14b. built-in function is recommended for\ntesting the type of an object, because it takes subclasses into\naccount.\n\nWith three arguments, return a new type object.  This is\nessentially a dynamic form of the *note class: 114c. statement.\nThe 'name' string is the class name and becomes the *note name:\n1302. attribute.  The 'bases' tuple contains the base classes and\nbecomes the *note bases: 1303. attribute; if empty, *note\nobject: 8bb, the ultimate base of all classes, is added.  The\n'dict' dictionary contains attribute and method definitions for the\nclass body; it may be copied or wrapped before becoming the *note\ndict: aa8. attribute.  The following two statements create\nidentical *note type: ba0. objects:\n\n>>> class X:\n...     a = 1\n...\n>>> X = type('X', (), dict(a=1))\n\nSee also *note Type Objects: 1e8d.\n\nKeyword arguments provided to the three argument form are passed to\nthe appropriate metaclass machinery (usually *note\ninitsubclass(): 3fe.) in the same way that keywords in a class\ndefinition (besides 'metaclass') would.\n\nSee also *note Customizing class creation: a94.\n\nChanged in version 3.6: Subclasses of *note type: ba0. which don't\noverride 'type.new' may no longer use the one-argument form to\nget the type of an object.\n\n-- Function: vars ()\n\n-- Function: vars (object)\n\nReturn the *note dict: aa8. attribute for a module, class,\ninstance, or any other object with a *note dict: aa8.\nattribute.\n\nObjects such as modules and instances have an updateable *note\ndict: aa8. attribute; however, other objects may have write\nrestrictions on their *note dict: aa8. attributes (for example,\nclasses use a *note types.MappingProxyType: 186. to prevent direct\ndictionary updates).\n\nWithout an argument, *note vars(): 17c1. acts like *note locals():\n173.  Note, the locals dictionary is only useful for reads since\nupdates to the locals dictionary are ignored.\n\nA *note TypeError: 28e. exception is raised if an object is\nspecified but it doesn't have a *note dict: aa8. attribute (for\nexample, if its class defines the *note slots: 1344.\nattribute).\n\n-- Function: zip (*iterables, strict=False)\n\nIterate over several iterables in parallel, producing tuples with\nan item from each one.\n\nExample:\n\n>>> for item in zip([1, 2, 3], ['sugar', 'spice', 'everything nice']):\n...     print(item)\n...\n(1, 'sugar')\n(2, 'spice')\n(3, 'everything nice')\n\nMore formally: *note zip(): 5c2. returns an iterator of tuples,\nwhere the 'i'-th tuple contains the 'i'-th element from each of the\nargument iterables.\n\nAnother way to think of *note zip(): 5c2. is that it turns rows\ninto columns, and columns into rows.  This is similar to\ntransposing a matrix(5).\n\n*note zip(): 5c2. is lazy: The elements won't be processed until\nthe iterable is iterated on, e.g.  by a 'for' loop or by wrapping\nin a *note list: 3dc.\n\nOne thing to consider is that the iterables passed to *note zip():\n5c2. could have different lengths; sometimes by design, and\nsometimes because of a bug in the code that prepared these\niterables.  Python offers three different approaches to dealing\nwith this issue:\n\n* By default, *note zip(): 5c2. stops when the shortest iterable\nis exhausted.  It will ignore the remaining items in the\nlonger iterables, cutting off the result to the length of the\nshortest iterable:\n\n>>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))\n[(0, 'fee'), (1, 'fi'), (2, 'fo')]\n\n* *note zip(): 5c2. is often used in cases where the iterables\nare assumed to be of equal length.  In such cases, it's\nrecommended to use the 'strict=True' option.  Its output is\nthe same as regular *note zip(): 5c2.:\n\n>>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))\n[('a', 1), ('b', 2), ('c', 3)]\n\nUnlike the default behavior, it raises a *note ValueError:\n183. if one iterable is exhausted before the others:\n\n>>> for item in zip(range(3), ['fee', 'fi', 'fo', 'fum'], strict=True):\n...     print(item)\n...\n(0, 'fee')\n(1, 'fi')\n(2, 'fo')\nTraceback (most recent call last):\n...\nValueError: zip() argument 2 is longer than argument 1\n\nWithout the 'strict=True' argument, any bug that results in\niterables of different lengths will be silenced, possibly\nmanifesting as a hard-to-find bug in another part of the\nprogram.\n\n* Shorter iterables can be padded with a constant value to make\nall the iterables have the same length.  This is done by *note\nitertools.ziplongest(): 1116.\n\nEdge cases: With a single iterable argument, *note zip(): 5c2.\nreturns an iterator of 1-tuples.  With no arguments, it returns an\nempty iterator.\n\nTips and tricks:\n\n* The left-to-right evaluation order of the iterables is\nguaranteed.  This makes possible an idiom for clustering a\ndata series into n-length groups using 'zip(*[iter(s)]*n,\nstrict=True)'.  This repeats the 'same' iterator 'n' times so\nthat each output tuple has the result of 'n' calls to the\niterator.  This has the effect of dividing the input into\nn-length chunks.\n\n* *note zip(): 5c2. in conjunction with the '*' operator can be\nused to unzip a list:\n\n>>> x = [1, 2, 3]\n>>> y = [4, 5, 6]\n>>> list(zip(x, y))\n[(1, 4), (2, 5), (3, 6)]\n>>> x2, y2 = zip(*zip(x, y))\n>>> x == list(x2) and y == list(y2)\nTrue\n\nChanged in version 3.10: Added the 'strict' argument.\n\n-- Function: import (name, globals=None, locals=None, fromlist=(),\nlevel=0)\n\nNote: This is an advanced function that is not needed in\neveryday Python programming, unlike *note\nimportlib.importmodule(): 26a.\n\nThis function is invoked by the *note import: 3a6. statement.  It\ncan be replaced (by importing the *note builtins: 10. module and\nassigning to 'builtins.import') in order to change semantics of\nthe 'import' statement, but doing so is 'strongly' discouraged as\nit is usually simpler to use import hooks (see PEP 302(6)) to\nattain the same goals and does not cause issues with code which\nassumes the default import implementation is in use.  Direct use of\n*note import(): 6ed. is also discouraged in favor of *note\nimportlib.importmodule(): 26a.\n\nThe function imports the module 'name', potentially using the given\n'globals' and 'locals' to determine how to interpret the name in a\npackage context.  The 'fromlist' gives the names of objects or\nsubmodules that should be imported from the module given by 'name'.\nThe standard implementation does not use its 'locals' argument at\nall and uses its 'globals' only to determine the package context of\nthe *note import: 3a6. statement.\n\n'level' specifies whether to use absolute or relative imports.  '0'\n(the default) means only perform absolute imports.  Positive values\nfor 'level' indicate the number of parent directories to search\nrelative to the directory of the module calling *note import():\n6ed. (see PEP 328(7) for the details).\n\nWhen the 'name' variable is of the form 'package.module', normally,\nthe top-level package (the name up till the first dot) is returned,\n'not' the module named by 'name'.  However, when a non-empty\n'fromlist' argument is given, the module named by 'name' is\nreturned.\n\nFor example, the statement 'import spam' results in bytecode\nresembling the following code:\n\nspam = import('spam', globals(), locals(), [], 0)\n\nThe statement 'import spam.ham' results in this call:\n\nspam = import('spam.ham', globals(), locals(), [], 0)\n\nNote how *note import(): 6ed. returns the toplevel module here\nbecause this is the object that is bound to a name by the *note\nimport: 3a6. statement.\n\nOn the other hand, the statement 'from spam.ham import eggs,\nsausage as saus' results in\n\ntemp = import('spam.ham', globals(), locals(), ['eggs', 'sausage'], 0)\neggs = temp.eggs\nsaus = temp.sausage\n\nHere, the 'spam.ham' module is returned from *note import():\n6ed.  From this object, the names to import are retrieved and\nassigned to their respective names.\n\nIf you simply want to import a module (potentially within a\npackage) by name, use *note importlib.importmodule(): 26a.\n\nChanged in version 3.3: Negative values for 'level' are no longer\nsupported (which also changes the default value to 0).\n\nChanged in version 3.9: When the command line options *note -E:\n77e. or *note -I: 77f. are being used, the environment variable\n*note PYTHONCASEOK: 77d. is now ignored.\n\n---------- Footnotes ----------\n\n(1) Note that the parser only accepts the Unix-style end of line\nconvention.  If you are reading the code from a file, make sure to use\nnewline conversion mode to convert Windows or Mac-style newlines.\n\n(2) https://peps.python.org/pep-0475/\n\n(3) https://peps.python.org/pep-0008/\n\n(4)\nhttps://rhettinger.wordpress.com/2011/05/26/super-considered-super/\n\n(5) https://en.wikipedia.org/wiki/Transpose\n\n(6) https://peps.python.org/pep-0302/\n\n(7) https://peps.python.org/pep-0328/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Built-in Constants,  Next: Built-in Types,  Prev: Built-in Functions,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.3 Built-in Constants",
                    "content": "A small number of constants live in the built-in namespace.  They are:\n\n-- Data: False\n\nThe false value of the *note bool: 17d. type.  Assignments to\n'False' are illegal and raise a *note SyntaxError: 146.\n\n-- Data: True\n\nThe true value of the *note bool: 17d. type.  Assignments to 'True'\nare illegal and raise a *note SyntaxError: 146.\n\n-- Data: None\n\nAn object frequently used to represent the absence of a value, as\nwhen default arguments are not passed to a function.  Assignments\nto 'None' are illegal and raise a *note SyntaxError: 146.  'None'\nis the sole instance of the *note NoneType: 648. type.\n\n-- Data: NotImplemented\n\nA special value which should be returned by the binary special\nmethods (e.g.  *note eq(): 931, *note lt(): 1180, *note\nadd(): 1c93, *note rsub(): 1ca6, etc.)  to indicate that\nthe operation is not implemented with respect to the other type;\nmay be returned by the in-place binary special methods (e.g.  *note\nimul(): 1c98, *note iand(): 1cb8, etc.)  for the same\npurpose.  It should not be evaluated in a boolean context.\n'NotImplemented' is the sole instance of the *note\ntypes.NotImplementedType: 649. type.\n\nNote: When a binary (or in-place) method returns\n'NotImplemented' the interpreter will try the reflected\noperation on the other type (or some other fallback, depending\non the operator).  If all attempts return 'NotImplemented',\nthe interpreter will raise an appropriate exception.\nIncorrectly returning 'NotImplemented' will result in a\nmisleading error message or the 'NotImplemented' value being\nreturned to Python code.\n\nSee *note Implementing the arithmetic operations: 1c08. for\nexamples.\n\nNote: 'NotImplementedError' and 'NotImplemented' are not\ninterchangeable, even though they have similar names and\npurposes.  See *note NotImplementedError: ba5. for details on\nwhen to use it.\n\nChanged in version 3.9: Evaluating 'NotImplemented' in a boolean\ncontext is deprecated.  While it currently evaluates as true, it\nwill emit a *note DeprecationWarning: 179.  It will raise a *note\nTypeError: 28e. in a future version of Python.\n\n-- Data: Ellipsis\n\nThe same as the ellipsis literal \"'...'\".  Special value used\nmostly in conjunction with extended slicing syntax for user-defined\ncontainer data types.  'Ellipsis' is the sole instance of the *note\ntypes.EllipsisType: 647. type.\n\n-- Data: debug\n\nThis constant is true if Python was not started with an *note -O:\nc11. option.  See also the *note assert: 78a. statement.\n\nNote: The names *note None: 43f, *note False: 971, *note True: a53.\nand *note debug: 5ce. cannot be reassigned (assignments to\nthem, even as an attribute name, raise *note SyntaxError: 146.), so\nthey can be considered \"true\" constants.\n\n* Menu:\n\n* Constants added by the site module::\n"
                }
            ]
        },
        "File: python3.12.info,  Node: Constants added by the site module,  Up: Built-in Constants": {
            "content": "The *note site: c2. module (which is imported automatically during\nstartup, except if the *note -S: 101c. command-line option is given)\nadds several constants to the built-in namespace.  They are useful for\nthe interactive interpreter shell and should not be used in programs.\n\n-- Data: quit (code=None)\n-- Data: exit (code=None)\n\nObjects that when printed, print a message like \"Use quit() or\nCtrl-D (i.e.  EOF) to exit\", and when called, raise *note\nSystemExit: b97. with the specified exit code.\n\n-- Data: copyright\n-- Data: credits\n\nObjects that when printed or called, print the text of copyright or\ncredits, respectively.\n\n-- Data: license\n\nObject that when printed, prints the message \"Type license() to see\nthe full license text\", and when called, displays the full license\ntext in a pager-like fashion (one screen at a time).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Built-in Types,  Next: Built-in Exceptions,  Prev: Built-in Constants,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.4 Built-in Types",
                    "content": ""
                }
            ]
        },
        "The following sections describe the standard types that are built into": {
            "content": "the interpreter.\n",
            "subsections": []
        },
        "The principal built-in types are numerics, sequences, mappings, classes,": {
            "content": "instances and exceptions.\n",
            "subsections": []
        },
        "Some collection classes are mutable.  The methods that add, subtract, or": {
            "content": "rearrange their members in place, and don't return a specific item,\nnever return the collection instance itself but 'None'.\n",
            "subsections": []
        },
        "Some operations are supported by several object types; in particular,": {
            "content": "practically all objects can be compared for equality, tested for truth\nvalue, and converted to a string (with the *note repr(): 5f0. function\nor the slightly different *note str(): 157. function).  The latter\nfunction is implicitly used when an object is written by the *note\nprint(): de5. function.\n\n* Menu:\n\n* Truth Value Testing::\n* Boolean Operations -- and, or, not: Boolean Operations -- and or not.\n* Comparisons: Comparisons<2>.\n* Numeric Types -- int, float, complex: Numeric Types -- int float complex.\n* Boolean Type - bool::\n* Iterator Types::\n* Sequence Types -- list, tuple, range: Sequence Types -- list tuple range.\n* Text Sequence Type -- str::\n* Binary Sequence Types -- bytes, bytearray, memoryview: Binary Sequence Types -- bytes bytearray memoryview.\n* Set Types -- set, frozenset: Set Types -- set frozenset.\n* Mapping Types -- dict::\n* Context Manager Types::\n* Type Annotation Types -- Generic Alias, Union: Type Annotation Types -- Generic Alias Union.\n* Other Built-in Types::\n* Special Attributes::\n* Integer string conversion length limitation::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Truth Value Testing,  Next: Boolean Operations -- and or not,  Up: Built-in Types": {
            "content": "Any object can be tested for truth value, for use in an *note if: 24f.\nor *note while: 198b. condition or as operand of the Boolean operations\nbelow.\n",
            "subsections": []
        },
        "By default, an object is considered true unless its class defines either": {
            "content": "a *note bool(): 114a. method that returns 'False' or a *note\nlen(): 1c68. method that returns zero, when called with the object.\n(1)  Here are most of the built-in objects considered false:\n\n* constants defined to be false: 'None' and 'False'\n\n* zero of any numeric type: '0', '0.0', '0j', 'Decimal(0)',\n'Fraction(0, 1)'\n\n* empty sequences and collections: '''', '()', '[]', '{}', 'set()',\n'range(0)'\n",
            "subsections": []
        },
        "Operations and built-in functions that have a Boolean result always": {
            "content": "return '0' or 'False' for false and '1' or 'True' for true, unless\notherwise stated.  (Important exception: the Boolean operations 'or' and\n'and' always return one of their operands.)\n\n---------- Footnotes ----------\n\n(1) Additional information on these special methods may be found in\nthe Python Reference Manual (*note Basic customization: 1c65.).\n\nFile: python3.12.info,  Node: Boolean Operations -- and or not,  Next: Comparisons<2>,  Prev: Truth Value Testing,  Up: Built-in Types\n\n\nThese are the Boolean operations, ordered by ascending priority:\n",
            "subsections": []
        },
        "Operation         Result                                Notes": {
            "content": "--------------------------------------------------------------------\n\n'x or y'          if 'x' is true, then 'x', else 'y'    (1)\n\n\n'x and y'         if 'x' is false, then 'x', else 'y'   (2)\n\n\n'not x'           if 'x' is false, then 'True', else    (3)\n'False'\n\n\nNotes:\n\n1. This is a short-circuit operator, so it only evaluates the second\nargument if the first one is false.\n\n2. This is a short-circuit operator, so it only evaluates the second\nargument if the first one is true.\n\n3. 'not' has a lower priority than non-Boolean operators, so 'not a ==\nb' is interpreted as 'not (a == b)', and 'a == not b' is a syntax\nerror.\n\nFile: python3.12.info,  Node: Comparisons<2>,  Next: Numeric Types -- int float complex,  Prev: Boolean Operations -- and or not,  Up: Built-in Types\n\n",
            "subsections": []
        },
        "There are eight comparison operations in Python.  They all have the same": {
            "content": "priority (which is higher than that of the Boolean operations).\nComparisons can be chained arbitrarily; for example, 'x < y <= z' is\nequivalent to 'x < y and y <= z', except that 'y' is evaluated only once\n(but in both cases 'z' is not evaluated at all when 'x < y' is found to\nbe false).\n\nThis table summarizes the comparison operations:\n",
            "subsections": []
        },
        "Operation        Meaning": {
            "content": "-----------------------------------------------\n\n'<'              strictly less than\n\n\n'<='             less than or equal\n\n\n'>'              strictly greater than\n\n\n'>='             greater than or equal\n\n\n'=='             equal\n\n\n'!='             not equal\n\n\n'is'             object identity\n\n\n'is not'         negated object identity\n\n",
            "subsections": []
        },
        "Objects of different types, except different numeric types, never": {
            "content": "compare equal.  The '==' operator is always defined but for some object\ntypes (for example, class objects) is equivalent to *note is: 251.  The\n'<', '<=', '>' and '>=' operators are only defined where they make\nsense; for example, they raise a *note TypeError: 28e. exception when\none of the arguments is a complex number.\n",
            "subsections": []
        },
        "Non-identical instances of a class normally compare as non-equal unless": {
            "content": "the class defines the *note eq(): 931. method.\n",
            "subsections": []
        },
        "Instances of a class cannot be ordered with respect to other instances": {
            "content": "of the same class, or other types of object, unless the class defines\nenough of the methods *note lt(): 1180, *note le(): 1181, *note\ngt(): 1182, and *note ge(): 1183. (in general, *note lt():\n1180. and *note eq(): 931. are sufficient, if you want the\nconventional meanings of the comparison operators).\n\nThe behavior of the *note is: 251. and *note is not: 1d86. operators\ncannot be customized; also they can be applied to any two objects and\nnever raise an exception.\n\nTwo more operations with the same syntactic priority, *note in: 250. and\n*note not in: 3fc, are supported by types that are *note iterable: 109d.\nor implement the *note contains(): 1c63. method.\n\nFile: python3.12.info,  Node: Numeric Types -- int float complex,  Next: Boolean Type - bool,  Prev: Comparisons<2>,  Up: Built-in Types\n\n",
            "subsections": []
        },
        "There are three distinct numeric types: 'integers', 'floating point": {
            "content": "numbers', and 'complex numbers'.  In addition, Booleans are a subtype of\nintegers.  Integers have unlimited precision.  Floating point numbers\nare usually implemented using double in C; information about the\nprecision and internal representation of floating point numbers for the\nmachine on which your program is running is available in *note\nsys.floatinfo: 175f.  Complex numbers have a real and imaginary part,\nwhich are each a floating point number.  To extract these parts from a\ncomplex number 'z', use 'z.real' and 'z.imag'.  (The standard library\nincludes the additional numeric types *note fractions.Fraction: 1a8, for\nrationals, and *note decimal.Decimal: 5c3, for floating-point numbers\nwith user-definable precision.)\n",
            "subsections": []
        },
        "Numbers are created by numeric literals or as the result of built-in": {
            "content": "functions and operators.  Unadorned integer literals (including hex,\noctal and binary numbers) yield integers.  Numeric literals containing a\ndecimal point or an exponent sign yield floating point numbers.",
            "subsections": []
        },
        "Appending ''j'' or ''J'' to a numeric literal yields an imaginary number": {
            "content": "(a complex number with a zero real part) which you can add to an integer\nor float to get a complex number with real and imaginary parts.\n",
            "subsections": []
        },
        "Python fully supports mixed arithmetic: when a binary arithmetic": {
            "content": "operator has operands of different numeric types, the operand with the\n\"narrower\" type is widened to that of the other, where integer is\nnarrower than floating point, which is narrower than complex.  A\ncomparison between numbers of different types behaves as though the\nexact values of those numbers were being compared.  (1)\n\nThe constructors *note int(): 17e, *note float(): 4b7, and *note\ncomplex(): 3ad. can be used to produce numbers of a specific type.\n",
            "subsections": []
        },
        "All numeric types (except complex) support the following operations (for": {
            "content": "priorities of the operations, see *note Operator precedence: 1d9c.):\n",
            "subsections": []
        },
        "Operation                 Result                                Notes         Full documentation": {
            "content": "-------------------------------------------------------------------------------------------------------\n\n'x + y'                   sum of 'x' and 'y'\n\n\n'x - y'                   difference of 'x' and 'y'\n\n\n'x * y'                   product of 'x' and 'y'\n\n\n'x / y'                   quotient of 'x' and 'y'\n\n\n'x // y'                  floored quotient of 'x' and 'y'       (1)(2)\n\n\n'x % y'                   remainder of 'x / y'                  (2)\n\n\n'-x'                      'x' negated\n\n\n'+x'                      'x' unchanged\n\n\n'abs(x)'                  absolute value or magnitude of 'x'                  *note abs(): 1a29.\n\n\n'int(x)'                  'x' converted to integer              (3)(6)        *note int(): 17e.\n\n\n'float(x)'                'x' converted to floating point       (4)(6)        *note float(): 4b7.\n\n\n'complex(re, im)'         a complex number with real part       (6)           *note complex(): 3ad.\n're', imaginary part 'im'.  'im'\ndefaults to zero.\n\n\n'c.conjugate()'           conjugate of the complex number 'c'\n\n\n'divmod(x, y)'            the pair '(x // y, x % y)'            (2)           *note divmod(): 7c5.\n\n\n'pow(x, y)'               'x' to the power 'y'                  (5)           *note pow(): 7f7.\n\n\n'x  y'                  'x' to the power 'y'                  (5)\n\n\nNotes:\n\n1. Also referred to as integer division.  For operands of type *note\nint: 17e, the result has type *note int: 17e.  For operands of type\n*note float: 4b7, the result has type *note float: 4b7.  In\ngeneral, the result is a whole integer, though the result's type is\nnot necessarily *note int: 17e.  The result is always rounded\ntowards minus infinity: '1//2' is '0', '(-1)//2' is '-1', '1//(-2)'\nis '-1', and '(-1)//(-2)' is '0'.\n\n2. Not for complex numbers.  Instead convert to floats using *note\nabs(): 1a29. if appropriate.\n\n3.\nConversion from *note float: 4b7. to *note int: 17e. truncates,\ndiscarding the fractional part.  See functions *note math.floor():\n1216. and *note math.ceil(): 1217. for alternative conversions.\n\n4. float also accepts the strings \"nan\" and \"inf\" with an optional\nprefix \"+\" or \"-\" for Not a Number (NaN) and positive or negative\ninfinity.\n\n5. Python defines 'pow(0, 0)' and '0  0' to be '1', as is common for\nprogramming languages.\n\n6. The numeric literals accepted include the digits '0' to '9' or any\nUnicode equivalent (code points with the 'Nd' property).\n\nSee the Unicode Standard(2) for a complete list of code points with\nthe 'Nd' property.\n\nAll *note numbers.Real: 1ea1. types (*note int: 17e. and *note float:\n4b7.) also include the following operations:\n",
            "subsections": []
        },
        "Operation                Result": {
            "content": "---------------------------------------------------------------------------\n\n*note math.trunc(x): 1218.'x' truncated to *note Integral: 1cc3.\n\n\n*note round(x[, n]): 114f.'x' rounded to 'n' digits, rounding half to\neven.  If 'n' is omitted, it defaults to 0.\n\n\n*note math.floor(x): 1216.the greatest *note Integral: 1cc3. <= 'x'\n\n\n*note math.ceil(x): 1217.the least *note Integral: 1cc3. >= 'x'\n\n\nFor additional numeric operations see the *note math: 89. and *note\ncmath: 16. modules.\n\n* Menu:\n\n* Bitwise Operations on Integer Types::\n* Additional Methods on Integer Types::\n* Additional Methods on Float::\n* Hashing of numeric types::\n\n---------- Footnotes ----------\n\n(1) As a consequence, the list '[1, 2]' is considered equal to '[1.0,\n2.0]', and similarly for tuples.\n\n(2)\nhttps://unicode.org/Public/UNIDATA/extracted/DerivedNumericType.txt\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Bitwise Operations on Integer Types,  Next: Additional Methods on Integer Types,  Up: Numeric Types -- int float complex": {
            "content": "5.4.4.1 Bitwise Operations on Integer Types\n...........................................\n",
            "subsections": []
        },
        "Bitwise operations only make sense for integers.  The result of bitwise": {
            "content": "operations is calculated as though carried out in two's complement with\nan infinite number of sign bits.\n",
            "subsections": []
        },
        "The priorities of the binary bitwise operations are all lower than the": {
            "content": "numeric operations and higher than the comparisons; the unary operation\n'~' has the same priority as the other unary numeric operations ('+' and\n'-').\n\nThis table lists the bitwise operations sorted in ascending priority:\n",
            "subsections": []
        },
        "Operation        Result                               Notes": {
            "content": "---------------------------------------------------------------------\n\n'x | y'          bitwise 'or' of 'x' and 'y'          (4)\n\n\n'x ^ y'          bitwise 'exclusive or' of 'x' and    (4)\n'y'\n\n\n'x & y'          bitwise 'and' of 'x' and 'y'         (4)\n\n\n'x << n'         'x' shifted left by 'n' bits         (1)(2)\n\n\n'x >> n'         'x' shifted right by 'n' bits        (1)(3)\n\n\n'~x'             the bits of 'x' inverted\n\n\nNotes:\n\n1. Negative shift counts are illegal and cause a *note ValueError:\n183. to be raised.\n\n2. A left shift by 'n' bits is equivalent to multiplication by 'pow(2,\nn)'.\n\n3. A right shift by 'n' bits is equivalent to floor division by\n'pow(2, n)'.\n\n4. Performing these calculations with at least one extra sign\nextension bit in a finite two's complement representation (a\nworking bit-width of '1 + max(x.bitlength(), y.bitlength())' or\nmore) is sufficient to get the same result as if there were an\ninfinite number of sign bits.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Additional Methods on Integer Types,  Next: Additional Methods on Float,  Prev: Bitwise Operations on Integer Types,  Up: Numeric Types -- int float complex": {
            "content": "5.4.4.2 Additional Methods on Integer Types\n...........................................\n\nThe int type implements the *note numbers.Integral: 1cc3. *note abstract\nbase class: 102a.  In addition, it provides a few more methods:\n\n-- Method: int.bitlength ()\n\nReturn the number of bits necessary to represent an integer in\nbinary, excluding the sign and leading zeros:\n\n>>> n = -37\n>>> bin(n)\n'-0b100101'\n>>> n.bitlength()\n6\n\nMore precisely, if 'x' is nonzero, then 'x.bitlength()' is the\nunique positive integer 'k' such that '2(k-1) <= abs(x) < 2k'.\nEquivalently, when 'abs(x)' is small enough to have a correctly\nrounded logarithm, then 'k = 1 + int(log(abs(x), 2))'.  If 'x' is\nzero, then 'x.bitlength()' returns '0'.\n\nEquivalent to:\n\ndef bitlength(self):\ns = bin(self)       # binary representation:  bin(-37) --> '-0b100101'\ns = s.lstrip('-0b') # remove leading zeros and minus sign\nreturn len(s)       # len('100101') --> 6\n\nNew in version 3.1.\n\n-- Method: int.bitcount ()\n\nReturn the number of ones in the binary representation of the\nabsolute value of the integer.  This is also known as the\npopulation count.  Example:\n\n>>> n = 19\n>>> bin(n)\n'0b10011'\n>>> n.bitcount()\n3\n>>> (-n).bitcount()\n3\n\nEquivalent to:\n\ndef bitcount(self):\nreturn bin(self).count(\"1\")\n\nNew in version 3.10.\n\n-- Method: int.tobytes (length=1, byteorder='big', *, signed=False)\n\nReturn an array of bytes representing an integer.\n\n>>> (1024).tobytes(2, byteorder='big')\nb'\\x04\\x00'\n>>> (1024).tobytes(10, byteorder='big')\nb'\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x04\\x00'\n>>> (-1024).tobytes(10, byteorder='big', signed=True)\nb'\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xfc\\x00'\n>>> x = 1000\n>>> x.tobytes((x.bitlength() + 7) // 8, byteorder='little')\nb'\\xe8\\x03'\n\nThe integer is represented using 'length' bytes, and defaults to 1.\nAn *note OverflowError: 68d. is raised if the integer is not\nrepresentable with the given number of bytes.\n\nThe 'byteorder' argument determines the byte order used to\nrepresent the integer, and defaults to '\"big\"'.  If 'byteorder' is\n'\"big\"', the most significant byte is at the beginning of the byte\narray.  If 'byteorder' is '\"little\"', the most significant byte is\nat the end of the byte array.\n\nThe 'signed' argument determines whether two's complement is used\nto represent the integer.  If 'signed' is 'False' and a negative\ninteger is given, an *note OverflowError: 68d. is raised.  The\ndefault value for 'signed' is 'False'.\n\nThe default values can be used to conveniently turn an integer into\na single byte object:\n\n>>> (65).tobytes()\nb'A'\n\nHowever, when using the default arguments, don't try to convert a\nvalue greater than 255 or you'll get an *note OverflowError: 68d.\n\nEquivalent to:\n\ndef tobytes(n, length=1, byteorder='big', signed=False):\nif byteorder == 'little':\norder = range(length)\nelif byteorder == 'big':\norder = reversed(range(length))\nelse:\nraise ValueError(\"byteorder must be either 'little' or 'big'\")\n\nreturn bytes((n >> i*8) & 0xff for i in order)\n\nNew in version 3.2.\n\nChanged in version 3.11: Added default argument values for 'length'\nand 'byteorder'.\n\n-- Method: classmethod int.frombytes (bytes, byteorder='big', *,\nsigned=False)\n\nReturn the integer represented by the given array of bytes.\n\n>>> int.frombytes(b'\\x00\\x10', byteorder='big')\n16\n>>> int.frombytes(b'\\x00\\x10', byteorder='little')\n4096\n>>> int.frombytes(b'\\xfc\\x00', byteorder='big', signed=True)\n-1024\n>>> int.frombytes(b'\\xfc\\x00', byteorder='big', signed=False)\n64512\n>>> int.frombytes([255, 0, 0], byteorder='big')\n16711680\n\nThe argument 'bytes' must either be a *note bytes-like object: b82.\nor an iterable producing bytes.\n\nThe 'byteorder' argument determines the byte order used to\nrepresent the integer, and defaults to '\"big\"'.  If 'byteorder' is\n'\"big\"', the most significant byte is at the beginning of the byte\narray.  If 'byteorder' is '\"little\"', the most significant byte is\nat the end of the byte array.  To request the native byte order of\nthe host system, use *note sys.byteorder: 1ea6. as the byte order\nvalue.\n\nThe 'signed' argument indicates whether two's complement is used to\nrepresent the integer.\n\nEquivalent to:\n\ndef frombytes(bytes, byteorder='big', signed=False):\nif byteorder == 'little':\nlittleordered = list(bytes)\nelif byteorder == 'big':\nlittleordered = list(reversed(bytes))\nelse:\nraise ValueError(\"byteorder must be either 'little' or 'big'\")\n\nn = sum(b << i*8 for i, b in enumerate(littleordered))\nif signed and littleordered and (littleordered[-1] & 0x80):\nn -= 1 << 8*len(littleordered)\n\nreturn n\n\nNew in version 3.2.\n\nChanged in version 3.11: Added default argument value for\n'byteorder'.\n\n-- Method: int.asintegerratio ()\n\nReturn a pair of integers whose ratio is equal to the original\ninteger and has a positive denominator.  The integer ratio of\nintegers (whole numbers) is always the integer as the numerator and\n'1' as the denominator.\n\nNew in version 3.8.\n\n-- Method: int.isinteger ()\n\nReturns 'True'.  Exists for duck type compatibility with *note\nfloat.isinteger(): 1ea7.\n\nNew in version 3.12.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Additional Methods on Float,  Next: Hashing of numeric types,  Prev: Additional Methods on Integer Types,  Up: Numeric Types -- int float complex": {
            "content": "5.4.4.3 Additional Methods on Float\n...................................\n\nThe float type implements the *note numbers.Real: 1ea1. *note abstract\nbase class: 102a.  float also has the following additional methods.\n\n-- Method: float.asintegerratio ()\n\nReturn a pair of integers whose ratio is exactly equal to the\noriginal float.  The ratio is in lowest terms and has a positive\ndenominator.  Raises *note OverflowError: 68d. on infinities and a\n*note ValueError: 183. on NaNs.\n\n-- Method: float.isinteger ()\n\nReturn 'True' if the float instance is finite with integral value,\nand 'False' otherwise:\n\n>>> (-2.0).isinteger()\nTrue\n>>> (3.2).isinteger()\nFalse\n",
            "subsections": []
        },
        "Two methods support conversion to and from hexadecimal strings.  Since": {
            "content": "",
            "subsections": []
        },
        "Python's floats are stored internally as binary numbers, converting a": {
            "content": "float to or from a 'decimal' string usually involves a small rounding\nerror.  In contrast, hexadecimal strings allow exact representation and\nspecification of floating-point numbers.  This can be useful when\ndebugging, and in numerical work.\n\n-- Method: float.hex ()\n\nReturn a representation of a floating-point number as a hexadecimal\nstring.  For finite floating-point numbers, this representation\nwill always include a leading '0x' and a trailing 'p' and exponent.\n\n-- Method: classmethod float.fromhex (s)\n\nClass method to return the float represented by a hexadecimal\nstring 's'.  The string 's' may have leading and trailing\nwhitespace.\n\nNote that *note float.hex(): 1a96. is an instance method, while *note\nfloat.fromhex(): 1ea9. is a class method.\n\nA hexadecimal string takes the form:\n\n[sign] ['0x'] integer ['.' fraction] ['p' exponent]\n\nwhere the optional 'sign' may by either '+' or '-', 'integer' and\n'fraction' are strings of hexadecimal digits, and 'exponent' is a\ndecimal integer with an optional leading sign.  Case is not significant,\nand there must be at least one hexadecimal digit in either the integer\nor the fraction.  This syntax is similar to the syntax specified in\nsection 6.4.4.2 of the C99 standard, and also to the syntax used in Java\n1.5 onwards.  In particular, the output of *note float.hex(): 1a96. is\nusable as a hexadecimal floating-point literal in C or Java code, and\nhexadecimal strings produced by C's '%a' format character or Java's\n'Double.toHexString' are accepted by *note float.fromhex(): 1ea9.\n",
            "subsections": []
        },
        "Note that the exponent is written in decimal rather than hexadecimal,": {
            "content": "and that it gives the power of 2 by which to multiply the coefficient.",
            "subsections": []
        },
        "For example, the hexadecimal string '0x3.a7p10' represents the": {
            "content": "floating-point number '(3 + 10./16 + 7./162) * 2.010', or '3740.0':\n\n>>> float.fromhex('0x3.a7p10')\n3740.0\n",
            "subsections": []
        },
        "Applying the reverse conversion to '3740.0' gives a different": {
            "content": "hexadecimal string representing the same number:\n\n>>> float.hex(3740.0)\n'0x1.d380000000000p+11'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Hashing of numeric types,  Prev: Additional Methods on Float,  Up: Numeric Types -- int float complex": {
            "content": "5.4.4.4 Hashing of numeric types\n................................\n",
            "subsections": []
        },
        "For numbers 'x' and 'y', possibly of different types, it's a requirement": {
            "content": "that 'hash(x) == hash(y)' whenever 'x == y' (see the *note hash():\n932. method documentation for more details).  For ease of implementation\nand efficiency across a variety of numeric types (including *note int:\n17e, *note float: 4b7, *note decimal.Decimal: 5c3. and *note\nfractions.Fraction: 1a8.) Python's hash for numeric types is based on a\nsingle mathematical function that's defined for any rational number, and\nhence applies to all instances of *note int: 17e. and *note\nfractions.Fraction: 1a8, and all finite instances of *note float: 4b7.\nand *note decimal.Decimal: 5c3.  Essentially, this function is given by\nreduction modulo 'P' for a fixed prime 'P'.  The value of 'P' is made\navailable to Python as the *note modulus: 1eac. attribute of *note\nsys.hashinfo: e72.\n\n'CPython implementation detail:' Currently, the prime used is 'P = 231\n- 1' on machines with 32-bit C longs and 'P = 261 - 1' on machines\nwith 64-bit C longs.\n\nHere are the rules in detail:\n\n- If 'x = m / n' is a nonnegative rational number and 'n' is not\ndivisible by 'P', define 'hash(x)' as 'm * invmod(n, P) % P', where\n'invmod(n, P)' gives the inverse of 'n' modulo 'P'.\n\n- If 'x = m / n' is a nonnegative rational number and 'n' is\ndivisible by 'P' (but 'm' is not) then 'n' has no inverse modulo\n'P' and the rule above doesn't apply; in this case define 'hash(x)'\nto be the constant value 'sys.hashinfo.inf'.\n\n- If 'x = m / n' is a negative rational number define 'hash(x)' as\n'-hash(-x)'.  If the resulting hash is '-1', replace it with '-2'.\n\n- The particular values 'sys.hashinfo.inf' and '-sys.hashinfo.inf'\nare used as hash values for positive infinity or negative infinity\n(respectively).\n\n- For a *note complex: 3ad. number 'z', the hash values of the real\nand imaginary parts are combined by computing 'hash(z.real) +\nsys.hashinfo.imag * hash(z.imag)', reduced modulo\n'2sys.hashinfo.width' so that it lies in\n'range(-2(sys.hashinfo.width - 1), 2(sys.hashinfo.width -\n1))'.  Again, if the result is '-1', it's replaced with '-2'.\n",
            "subsections": []
        },
        "To clarify the above rules, here's some example Python code, equivalent": {
            "content": "to the built-in hash, for computing the hash of a rational number, *note\nfloat: 4b7, or *note complex: 3ad.:\n\nimport sys, math\n\ndef hashfraction(m, n):\n\"\"\"Compute the hash of a rational number m / n.\n\nAssumes m and n are integers, with n positive.\nEquivalent to hash(fractions.Fraction(m, n)).\n\n\"\"\"\nP = sys.hashinfo.modulus\n# Remove common factors of P.  (Unnecessary if m and n already coprime.)\nwhile m % P == n % P == 0:\nm, n = m // P, n // P\n\nif n % P == 0:\nhashvalue = sys.hashinfo.inf\nelse:\n# Fermat's Little Theorem: pow(n, P-1, P) is 1, so\n# pow(n, P-2, P) gives the inverse of n modulo P.\nhashvalue = (abs(m) % P) * pow(n, P - 2, P) % P\nif m < 0:\nhashvalue = -hashvalue\nif hashvalue == -1:\nhashvalue = -2\nreturn hashvalue\n\ndef hashfloat(x):\n\"\"\"Compute the hash of a float x.\"\"\"\n\nif math.isnan(x):\nreturn object.hash(x)\nelif math.isinf(x):\nreturn sys.hashinfo.inf if x > 0 else -sys.hashinfo.inf\nelse:\nreturn hashfraction(*x.asintegerratio())\n\ndef hashcomplex(z):\n\"\"\"Compute the hash of a complex number z.\"\"\"\n\nhashvalue = hashfloat(z.real) + sys.hashinfo.imag * hashfloat(z.imag)\n# do a signed reduction modulo 2sys.hashinfo.width\nM = 2(sys.hashinfo.width - 1)\nhashvalue = (hashvalue & (M - 1)) - (hashvalue & M)\nif hashvalue == -1:\nhashvalue = -2\nreturn hashvalue\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Boolean Type - bool,  Next: Iterator Types,  Prev: Numeric Types -- int float complex,  Up: Built-in Types": {
            "content": "Booleans represent truth values.  The *note bool: 17d. type has exactly\ntwo constant instances: 'True' and 'False'.\n\nThe built-in function *note bool(): 17d. converts any value to a\nboolean, if the value can be interpreted as a truth value (see section\n*note Truth Value Testing: 1e66. above).\n\nFor logical operations, use the *note boolean operators: 1e9c. 'and',\n'or' and 'not'.  When applying the bitwise operators '&', '|', '^' to\ntwo booleans, they return a bool equivalent to the logical operations\n\"and\", \"or\", \"xor\".  However, the logical operators 'and', 'or' and '!='\nshould be preferred over '&', '|' and '^'.\n",
            "subsections": []
        },
        "Deprecated since version 3.12: The use of the bitwise inversion operator": {
            "content": "'~' is deprecated and will raise an error in Python 3.14.\n\n*note bool: 17d. is a subclass of *note int: 17e. (see *note Numeric",
            "subsections": []
        },
        "Types -- int, float, complex: 197e.).  In many numeric contexts, 'False'": {
            "content": "and 'True' behave like the integers 0 and 1, respectively.  However,\nrelying on this is discouraged; explicitly convert using *note int():\n17e. instead.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Iterator Types,  Next: Sequence Types -- list tuple range,  Prev: Boolean Type - bool,  Up: Built-in Types": {
            "content": "",
            "subsections": []
        },
        "Python supports a concept of iteration over containers.  This is": {
            "content": "implemented using two distinct methods; these are used to allow\nuser-defined classes to support iteration.  Sequences, described below\nin more detail, always support the iteration methods.\n\nOne method needs to be defined for container objects to provide *note\niterable: 109d. support:\n\n-- Method: container.iter ()\n\nReturn an *note iterator: 16a9. object.  The object is required to\nsupport the iterator protocol described below.  If a container\nsupports different types of iteration, additional methods can be\nprovided to specifically request iterators for those iteration\ntypes.  (An example of an object supporting multiple forms of\niteration would be a tree structure which supports both\nbreadth-first and depth-first traversal.)  This method corresponds\nto the *note tpiter: 1348. slot of the type structure for Python\nobjects in the Python/C API.\n",
            "subsections": []
        },
        "The iterator objects themselves are required to support the following": {
            "content": "two methods, which together form the 'iterator protocol':\n\n-- Method: iterator.iter ()\n\nReturn the *note iterator: 16a9. object itself.  This is required\nto allow both containers and iterators to be used with the *note\nfor: 24e. and *note in: 250. statements.  This method corresponds\nto the *note tpiter: 1348. slot of the type structure for Python\nobjects in the Python/C API.\n\n-- Method: iterator.next ()\n\nReturn the next item from the *note iterator: 16a9.  If there are\nno further items, raise the *note StopIteration: a40. exception.\nThis method corresponds to the *note tpiternext: 1349. slot of the\ntype structure for Python objects in the Python/C API.\n",
            "subsections": []
        },
        "Python defines several iterator objects to support iteration over": {
            "content": "general and specific sequence types, dictionaries, and other more\nspecialized forms.  The specific types are not important beyond their\nimplementation of the iterator protocol.\n\nOnce an iterator's *note next(): 1141. method raises *note\nStopIteration: a40, it must continue to do so on subsequent calls.\nImplementations that do not obey this property are deemed broken.\n\n* Menu:\n\n* Generator Types::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Generator Types,  Up: Iterator Types": {
            "content": "5.4.6.1 Generator Types\n.......................\n\nPython's *note generator: eda.s provide a convenient way to implement\nthe iterator protocol.  If a container object's *note iter(): 1a48.\nmethod is implemented as a generator, it will automatically return an\niterator object (technically, a generator object) supplying the\n'iter()' and *note next(): 1a49. methods.  More information\nabout generators can be found in *note the documentation for the yield\nexpression: 1d43.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Sequence Types -- list tuple range,  Next: Text Sequence Type -- str,  Prev: Iterator Types,  Up: Built-in Types": {
            "content": "There are three basic sequence types: lists, tuples, and range objects.\nAdditional sequence types tailored for processing of *note binary data:\n1e6a. and *note text strings: 1983. are described in dedicated sections.\n\n* Menu:\n\n* Common Sequence Operations::\n* Immutable Sequence Types::\n* Mutable Sequence Types::\n* Lists: Lists<2>.\n* Tuples::\n* Ranges::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Common Sequence Operations,  Next: Immutable Sequence Types,  Up: Sequence Types -- list tuple range": {
            "content": "5.4.7.1 Common Sequence Operations\n..................................\n",
            "subsections": []
        },
        "The operations in the following table are supported by most sequence": {
            "content": "types, both mutable and immutable.  The *note collections.abc.Sequence:\n1038. ABC is provided to make it easier to correctly implement these\noperations on custom sequence types.\n\nThis table lists the sequence operations sorted in ascending priority.",
            "subsections": []
        },
        "In the table, 's' and 't' are sequences of the same type, 'n', 'i', 'j'": {
            "content": "and 'k' are integers and 'x' is an arbitrary object that meets any type\nand value restrictions imposed by 's'.\n",
            "subsections": []
        },
        "The 'in' and 'not in' operations have the same priorities as the": {
            "content": "comparison operations.  The '+' (concatenation) and '*' (repetition)\noperations have the same priority as the corresponding numeric\noperations.  (1)\n",
            "subsections": []
        },
        "Operation                      Result                               Notes": {
            "content": "-----------------------------------------------------------------------------------\n\n'x in s'                       'True' if an item of 's' is equal    (1)\nto 'x', else 'False'\n\n\n'x not in s'                   'False' if an item of 's' is equal   (1)\nto 'x', else 'True'\n\n\n's + t'                        the concatenation of 's' and 't'     (6)(7)\n\n\n's * n' or 'n * s'             equivalent to adding 's' to itself   (2)(7)\n'n' times\n\n\n's[i]'                         'i'th item of 's', origin 0          (3)\n\n\n's[i:j]'                       slice of 's' from 'i' to 'j'         (3)(4)\n\n\n's[i:j:k]'                     slice of 's' from 'i' to 'j' with    (3)(5)\nstep 'k'\n\n\n'len(s)'                       length of 's'\n\n\n'min(s)'                       smallest item of 's'\n\n\n'max(s)'                       largest item of 's'\n\n\n's.index(x[, i[, j]])'         index of the first occurrence of     (8)\n'x' in 's' (at or after index 'i'\nand before index 'j')\n\n\n's.count(x)'                   total number of occurrences of 'x'\nin 's'\n\n",
            "subsections": []
        },
        "Sequences of the same type also support comparisons.  In particular,": {
            "content": "tuples and lists are compared lexicographically by comparing\ncorresponding elements.  This means that to compare equal, every element\nmust compare equal and the two sequences must be of the same type and\nhave the same length.  (For full details see *note Comparisons: 1d7f. in\nthe language reference.)\n",
            "subsections": []
        },
        "Forward and reversed iterators over mutable sequences access values": {
            "content": "using an index.  That index will continue to march forward (or backward)\neven if the underlying sequence is mutated.  The iterator terminates\nonly when an *note IndexError: 138f. or a *note StopIteration: a40. is\nencountered (or when the index drops below zero).\n\nNotes:\n\n1. While the 'in' and 'not in' operations are used only for simple\ncontainment testing in the general case, some specialised sequences\n(such as *note str: 157, *note bytes: 295. and *note bytearray:\n294.) also use them for subsequence testing:\n\n>>> \"gg\" in \"eggs\"\nTrue\n\n2. Values of 'n' less than '0' are treated as '0' (which yields an\nempty sequence of the same type as 's').  Note that items in the\nsequence 's' are not copied; they are referenced multiple times.\nThis often haunts new Python programmers; consider:\n\n>>> lists = [[]] * 3\n>>> lists\n[[], [], []]\n>>> lists[0].append(3)\n>>> lists\n[[3], [3], [3]]\n\nWhat has happened is that '[[]]' is a one-element list containing\nan empty list, so all three elements of '[[]] * 3' are references\nto this single empty list.  Modifying any of the elements of\n'lists' modifies this single list.  You can create a list of\ndifferent lists this way:\n\n>>> lists = [[] for i in range(3)]\n>>> lists[0].append(3)\n>>> lists[1].append(5)\n>>> lists[2].append(7)\n>>> lists\n[[3], [5], [7]]\n\nFurther explanation is available in the FAQ entry *note How do I\ncreate a multidimensional list?: 1eb5.\n\n3. If 'i' or 'j' is negative, the index is relative to the end of\nsequence 's': 'len(s) + i' or 'len(s) + j' is substituted.  But\nnote that '-0' is still '0'.\n\n4. The slice of 's' from 'i' to 'j' is defined as the sequence of\nitems with index 'k' such that 'i <= k < j'.  If 'i' or 'j' is\ngreater than 'len(s)', use 'len(s)'.  If 'i' is omitted or 'None',\nuse '0'.  If 'j' is omitted or 'None', use 'len(s)'.  If 'i' is\ngreater than or equal to 'j', the slice is empty.\n\n5. The slice of 's' from 'i' to 'j' with step 'k' is defined as the\nsequence of items with index 'x = i + n*k' such that '0 <= n <\n(j-i)/k'.  In other words, the indices are 'i', 'i+k', 'i+2*k',\n'i+3*k' and so on, stopping when 'j' is reached (but never\nincluding 'j').  When 'k' is positive, 'i' and 'j' are reduced to\n'len(s)' if they are greater.  When 'k' is negative, 'i' and 'j'\nare reduced to 'len(s) - 1' if they are greater.  If 'i' or 'j' are\nomitted or 'None', they become \"end\" values (which end depends on\nthe sign of 'k').  Note, 'k' cannot be zero.  If 'k' is 'None', it\nis treated like '1'.\n\n6. Concatenating immutable sequences always results in a new object.\nThis means that building up a sequence by repeated concatenation\nwill have a quadratic runtime cost in the total sequence length.\nTo get a linear runtime cost, you must switch to one of the\nalternatives below:\n\n* if concatenating *note str: 157. objects, you can build a list\nand use *note str.join(): 1eb6. at the end or else write to an\n*note io.StringIO: d94. instance and retrieve its value when\ncomplete\n\n* if concatenating *note bytes: 295. objects, you can similarly\nuse *note bytes.join(): 1eb7. or *note io.BytesIO: d08, or you\ncan do in-place concatenation with a *note bytearray: 294.\nobject.  *note bytearray: 294. objects are mutable and have an\nefficient overallocation mechanism\n\n* if concatenating *note tuple: 4b8. objects, extend a *note\nlist: 3dc. instead\n\n* for other types, investigate the relevant class documentation\n\n7. Some sequence types (such as *note range: 761.) only support item\nsequences that follow specific patterns, and hence don't support\nsequence concatenation or repetition.\n\n8. 'index' raises *note ValueError: 183. when 'x' is not found in 's'.\nNot all implementations support passing the additional arguments\n'i' and 'j'.  These arguments allow efficient searching of\nsubsections of the sequence.  Passing the extra arguments is\nroughly equivalent to using 's[i:j].index(x)', only without copying\nany data and with the returned index being relative to the start of\nthe sequence rather than the start of the slice.\n\n---------- Footnotes ----------\n\n(1) They must have since the parser can't tell the type of the\noperands.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Immutable Sequence Types,  Next: Mutable Sequence Types,  Prev: Common Sequence Operations,  Up: Sequence Types -- list tuple range": {
            "content": "5.4.7.2 Immutable Sequence Types\n................................\n",
            "subsections": []
        },
        "The only operation that immutable sequence types generally implement": {
            "content": "that is not also implemented by mutable sequence types is support for\nthe *note hash(): 3b1. built-in.\n\nThis support allows immutable sequences, such as *note tuple: 4b8.\ninstances, to be used as *note dict: 237. keys and stored in *note set:\n39d. and *note frozenset: 39e. instances.\n",
            "subsections": []
        },
        "Attempting to hash an immutable sequence that contains unhashable values": {
            "content": "will result in *note TypeError: 28e.\n\nFile: python3.12.info,  Node: Mutable Sequence Types,  Next: Lists<2>,  Prev: Immutable Sequence Types,  Up: Sequence Types -- list tuple range\n\n5.4.7.3 Mutable Sequence Types\n..............................\n",
            "subsections": []
        },
        "The operations in the following table are defined on mutable sequence": {
            "content": "types.  The *note collections.abc.MutableSequence: c31. ABC is provided\nto make it easier to correctly implement these operations on custom\nsequence types.\n",
            "subsections": []
        },
        "In the table 's' is an instance of a mutable sequence type, 't' is any": {
            "content": "iterable object and 'x' is an arbitrary object that meets any type and\nvalue restrictions imposed by 's' (for example, *note bytearray: 294.\nonly accepts integers that meet the value restriction '0 <= x <= 255').\n",
            "subsections": []
        },
        "Operation                          Result                               Notes": {
            "content": "--------------------------------------------------------------------------------------------------\n\n's[i] = x'                         item 'i' of 's' is replaced by 'x'\n\n\n's[i:j] = t'                       slice of 's' from 'i' to 'j' is\nreplaced by the contents of the\niterable 't'\n\n\n'del s[i:j]'                       same as 's[i:j] = []'\n\n\n's[i:j:k] = t'                     the elements of 's[i:j:k]' are       (1)\nreplaced by those of 't'\n\n\n'del s[i:j:k]'                     removes the elements of 's[i:j:k]'\nfrom the list\n\n\n's.append(x)'                      appends 'x' to the end of the\nsequence (same as\n's[len(s):len(s)] = [x]')\n\n\n's.clear()'                        removes all items from 's' (same     (5)\nas 'del s[:]')\n\n\n's.copy()'                         creates a shallow copy of 's'        (5)\n(same as 's[:]')\n\n\n's.extend(t)' or 's += t'          extends 's' with the contents of\n't' (for the most part the same as\n's[len(s):len(s)] = t')\n\n\n's *= n'                           updates 's' with its contents        (6)\nrepeated 'n' times\n\n\n's.insert(i, x)'                   inserts 'x' into 's' at the index\ngiven by 'i' (same as 's[i:i] =\n[x]')\n\n\n's.pop()' or 's.pop(i)'            retrieves the item at 'i' and also   (2)\nremoves it from 's'\n\n\n's.remove(x)'                      remove the first item from 's'       (3)\nwhere 's[i]' is equal to 'x'\n\n\n's.reverse()'                      reverses the items of 's' in place   (4)\n\n\nNotes:\n\n1. 't' must have the same length as the slice it is replacing.\n\n2. The optional argument 'i' defaults to '-1', so that by default the\nlast item is removed and returned.\n\n3. 'remove()' raises *note ValueError: 183. when 'x' is not found in\n's'.\n\n4. The 'reverse()' method modifies the sequence in place for economy\nof space when reversing a large sequence.  To remind users that it\noperates by side effect, it does not return the reversed sequence.\n\n5. 'clear()' and 'copy()' are included for consistency with the\ninterfaces of mutable containers that don't support slicing\noperations (such as *note dict: 237. and *note set: 39d.).\n'copy()' is not part of the *note collections.abc.MutableSequence:\nc31. ABC, but most concrete mutable sequence classes provide it.\n\nNew in version 3.3: 'clear()' and 'copy()' methods.\n\n6. The value 'n' is an integer, or an object implementing *note\nindex(): 4f1.  Zero and negative values of 'n' clear the\nsequence.  Items in the sequence are not copied; they are\nreferenced multiple times, as explained for 's * n' under *note\nCommon Sequence Operations: 1eb4.\n\nFile: python3.12.info,  Node: Lists<2>,  Next: Tuples,  Prev: Mutable Sequence Types,  Up: Sequence Types -- list tuple range\n\n5.4.7.4 Lists\n.............\n",
            "subsections": []
        },
        "Lists are mutable sequences, typically used to store collections of": {
            "content": "homogeneous items (where the precise degree of similarity will vary by\napplication).\n\n-- Class: list ([iterable])\n\nLists may be constructed in several ways:\n\n* Using a pair of square brackets to denote the empty list: '[]'\n\n* Using square brackets, separating items with commas: '[a]',\n'[a, b, c]'\n\n* Using a list comprehension: '[x for x in iterable]'\n\n* Using the type constructor: 'list()' or 'list(iterable)'\n\nThe constructor builds a list whose items are the same and in the\nsame order as 'iterable''s items.  'iterable' may be either a\nsequence, a container that supports iteration, or an iterator\nobject.  If 'iterable' is already a list, a copy is made and\nreturned, similar to 'iterable[:]'.  For example, 'list('abc')'\nreturns '['a', 'b', 'c']' and 'list( (1, 2, 3) )' returns '[1, 2,\n3]'.  If no argument is given, the constructor creates a new empty\nlist, '[]'.\n\nMany other operations also produce lists, including the *note\nsorted(): a12. built-in.\n\nLists implement all of the *note common: 1eb4. and *note mutable:\n1e68. sequence operations.  Lists also provide the following\nadditional method:\n\n-- Method: sort (*, key=None, reverse=False)\n\nThis method sorts the list in place, using only '<'\ncomparisons between items.  Exceptions are not suppressed - if\nany comparison operations fail, the entire sort operation will\nfail (and the list will likely be left in a partially modified\nstate).\n\n*note sort(): a13. accepts two arguments that can only be\npassed by keyword (*note keyword-only arguments: 8b8.):\n\n'key' specifies a function of one argument that is used to\nextract a comparison key from each list element (for example,\n'key=str.lower').  The key corresponding to each item in the\nlist is calculated once and then used for the entire sorting\nprocess.  The default value of 'None' means that list items\nare sorted directly without calculating a separate key value.\n\nThe *note functools.cmptokey(): 104e. utility is available\nto convert a 2.x style 'cmp' function to a 'key' function.\n\n'reverse' is a boolean value.  If set to 'True', then the list\nelements are sorted as if each comparison were reversed.\n\nThis method modifies the sequence in place for economy of\nspace when sorting a large sequence.  To remind users that it\noperates by side effect, it does not return the sorted\nsequence (use *note sorted(): a12. to explicitly request a new\nsorted list instance).\n\nThe *note sort(): a13. method is guaranteed to be stable.  A\nsort is stable if it guarantees not to change the relative\norder of elements that compare equal -- this is helpful for\nsorting in multiple passes (for example, sort by department,\nthen by salary grade).\n\nFor sorting examples and a brief sorting tutorial, see *note\nSorting Techniques: 1e89.\n\n'CPython implementation detail:' While a list is being sorted,\nthe effect of attempting to mutate, or even inspect, the list\nis undefined.  The C implementation of Python makes the list\nappear empty for the duration, and raises *note ValueError:\n183. if it can detect that the list has been mutated during a\nsort.\n\nFile: python3.12.info,  Node: Tuples,  Next: Ranges,  Prev: Lists<2>,  Up: Sequence Types -- list tuple range\n\n5.4.7.5 Tuples\n..............\n",
            "subsections": []
        },
        "Tuples are immutable sequences, typically used to store collections of": {
            "content": "heterogeneous data (such as the 2-tuples produced by the *note\nenumerate(): 12d5. built-in).  Tuples are also used for cases where an\nimmutable sequence of homogeneous data is needed (such as allowing\nstorage in a *note set: 39d. or *note dict: 237. instance).\n\n-- Class: tuple ([iterable])\n\nTuples may be constructed in a number of ways:\n\n* Using a pair of parentheses to denote the empty tuple: '()'\n\n* Using a trailing comma for a singleton tuple: 'a,' or '(a,)'\n\n* Separating items with commas: 'a, b, c' or '(a, b, c)'\n\n* Using the *note tuple(): 4b8. built-in: 'tuple()' or\n'tuple(iterable)'\n\nThe constructor builds a tuple whose items are the same and in the\nsame order as 'iterable''s items.  'iterable' may be either a\nsequence, a container that supports iteration, or an iterator\nobject.  If 'iterable' is already a tuple, it is returned\nunchanged.  For example, 'tuple('abc')' returns '('a', 'b', 'c')'\nand 'tuple( [1, 2, 3] )' returns '(1, 2, 3)'.  If no argument is\ngiven, the constructor creates a new empty tuple, '()'.\n\nNote that it is actually the comma which makes a tuple, not the\nparentheses.  The parentheses are optional, except in the empty\ntuple case, or when they are needed to avoid syntactic ambiguity.\nFor example, 'f(a, b, c)' is a function call with three arguments,\nwhile 'f((a, b, c))' is a function call with a 3-tuple as the sole\nargument.\n\nTuples implement all of the *note common: 1eb4. sequence\noperations.\n",
            "subsections": []
        },
        "For heterogeneous collections of data where access by name is clearer": {
            "content": "than access by index, *note collections.namedtuple(): 711. may be a more\nappropriate choice than a simple tuple object.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Ranges,  Prev: Tuples,  Up: Sequence Types -- list tuple range": {
            "content": "5.4.7.6 Ranges\n..............\n\nThe *note range: 761. type represents an immutable sequence of numbers\nand is commonly used for looping a specific number of times in *note\nfor: 24e. loops.\n\n-- Class: range (stop)\n\n-- Class: range (start, stop[, step])\n\nThe arguments to the range constructor must be integers (either\nbuilt-in *note int: 17e. or any object that implements the *note\nindex(): 4f1. special method).  If the 'step' argument is\nomitted, it defaults to '1'.  If the 'start' argument is omitted,\nit defaults to '0'.  If 'step' is zero, *note ValueError: 183. is\nraised.\n\nFor a positive 'step', the contents of a range 'r' are determined\nby the formula 'r[i] = start + step*i' where 'i >= 0' and 'r[i] <\nstop'.\n\nFor a negative 'step', the contents of the range are still\ndetermined by the formula 'r[i] = start + step*i', but the\nconstraints are 'i >= 0' and 'r[i] > stop'.\n\nA range object will be empty if 'r[0]' does not meet the value\nconstraint.  Ranges do support negative indices, but these are\ninterpreted as indexing from the end of the sequence determined by\nthe positive indices.\n\nRanges containing absolute values larger than *note sys.maxsize:\n1039. are permitted but some features (such as *note len(): 3fb.)\nmay raise *note OverflowError: 68d.\n\nRange examples:\n\n>>> list(range(10))\n[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n>>> list(range(1, 11))\n[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n>>> list(range(0, 30, 5))\n[0, 5, 10, 15, 20, 25]\n>>> list(range(0, 10, 3))\n[0, 3, 6, 9]\n>>> list(range(0, -10, -1))\n[0, -1, -2, -3, -4, -5, -6, -7, -8, -9]\n>>> list(range(0))\n[]\n>>> list(range(1, 0))\n[]\n\nRanges implement all of the *note common: 1eb4. sequence operations\nexcept concatenation and repetition (due to the fact that range\nobjects can only represent sequences that follow a strict pattern\nand repetition and concatenation will usually violate that\npattern).\n\n-- Attribute: start\n\nThe value of the 'start' parameter (or '0' if the parameter\nwas not supplied)\n\n-- Attribute: stop\n\nThe value of the 'stop' parameter\n\n-- Attribute: step\n\nThe value of the 'step' parameter (or '1' if the parameter was\nnot supplied)\n\nThe advantage of the *note range: 761. type over a regular *note list:\n3dc. or *note tuple: 4b8. is that a *note range: 761. object will always\ntake the same (small) amount of memory, no matter the size of the range\nit represents (as it only stores the 'start', 'stop' and 'step' values,\ncalculating individual items and subranges as needed).\n\nRange objects implement the *note collections.abc.Sequence: 1038. ABC,\nand provide features such as containment tests, element index lookup,\nslicing and support for negative indices (see *note Sequence Types --\nlist, tuple, range: 19ce.):\n\n>>> r = range(0, 20, 2)\n>>> r\nrange(0, 20, 2)\n>>> 11 in r\nFalse\n>>> 10 in r\nTrue\n>>> r.index(10)\n5\n>>> r[5]\n10\n>>> r[:5]\nrange(0, 10, 2)\n>>> r[-1]\n18\n\nTesting range objects for equality with '==' and '!=' compares them as\nsequences.  That is, two range objects are considered equal if they\nrepresent the same sequence of values.  (Note that two range objects\nthat compare equal might have different *note start: 1ebe, *note stop:\n1ebf. and *note step: 1ec0. attributes, for example 'range(0) ==\nrange(2, 1, 3)' or 'range(0, 3, 2) == range(0, 4, 2)'.)\n",
            "subsections": []
        },
        "Changed in version 3.2: Implement the Sequence ABC. Support slicing and": {
            "content": "negative indices.  Test *note int: 17e. objects for membership in\nconstant time instead of iterating through all items.\n\nChanged in version 3.3: Define '==' and '!=' to compare range objects\nbased on the sequence of values they define (instead of comparing based\non object identity).\n\nAdded the *note start: 1ebe, *note stop: 1ebf. and *note step: 1ec0.\nattributes.\n\nSee also\n........\n\n* The linspace recipe(1) shows how to implement a lazy version of\nrange suitable for floating point applications.\n\n---------- Footnotes ----------\n\n(1) https://code.activestate.com/recipes/579000/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Text Sequence Type -- str,  Next: Binary Sequence Types -- bytes bytearray memoryview,  Prev: Sequence Types -- list tuple range,  Up: Built-in Types": {
            "content": "Textual data in Python is handled with *note str: 157. objects, or\n'strings'.  Strings are immutable *note sequences: 19ce. of Unicode code\npoints.  String literals are written in a variety of ways:\n\n* Single quotes: ''allows embedded \"double\" quotes''\n\n* Double quotes: '\"allows embedded 'single' quotes\"'\n\n* Triple quoted: ''''Three single quotes'''', '\"\"\"Three double\nquotes\"\"\"'\n",
            "subsections": []
        },
        "Triple quoted strings may span multiple lines - all associated": {
            "content": "whitespace will be included in the string literal.\n",
            "subsections": []
        },
        "String literals that are part of a single expression and have only": {
            "content": "whitespace between them will be implicitly converted to a single string\nliteral.  That is, '(\"spam \" \"eggs\") == \"spam eggs\"'.\n\nSee *note String and Bytes literals: 1bc5. for more about the various\nforms of string literal, including supported *note escape sequences:\n16a, and the 'r' (\"raw\") prefix that disables most escape sequence\nprocessing.\n\nStrings may also be created from other objects using the *note str: 157.\nconstructor.\n\nSince there is no separate \"character\" type, indexing a string produces\nstrings of length 1.  That is, for a non-empty string 's', 's[0] ==\ns[0:1]'.\n\nThere is also no mutable string type, but *note str.join(): 1eb6. or\n*note io.StringIO: d94. can be used to efficiently construct strings\nfrom multiple fragments.\n",
            "subsections": []
        },
        "Changed in version 3.3: For backwards compatibility with the Python 2": {
            "content": "series, the 'u' prefix is once again permitted on string literals.  It\nhas no effect on the meaning of string literals and cannot be combined\nwith the 'r' prefix.\n\n-- Class: str (object='')\n\n-- Class: str (object=b'', encoding='utf-8', errors='strict')\n\nReturn a *note string: 1983. version of 'object'.  If 'object' is\nnot provided, returns the empty string.  Otherwise, the behavior of\n'str()' depends on whether 'encoding' or 'errors' is given, as\nfollows.\n\nIf neither 'encoding' nor 'errors' is given, 'str(object)' returns\n*note type(object).str(object): 3e9, which is the \"informal\" or\nnicely printable string representation of 'object'.  For string\nobjects, this is the string itself.  If 'object' does not have a\n*note str(): 3e9. method, then *note str(): 157. falls back to\nreturning *note repr(object): 5f0.\n\nIf at least one of 'encoding' or 'errors' is given, 'object' should\nbe a *note bytes-like object: b82. (e.g.  *note bytes: 295. or\n*note bytearray: 294.).  In this case, if 'object' is a *note\nbytes: 295. (or *note bytearray: 294.) object, then 'str(bytes,\nencoding, errors)' is equivalent to *note bytes.decode(encoding,\nerrors): 6ef.  Otherwise, the bytes object underlying the buffer\nobject is obtained before calling *note bytes.decode(): 6ef.  See\n*note Binary Sequence Types -- bytes, bytearray, memoryview: 1e6a.\nand *note Buffer Protocol: 148. for information on buffer objects.\n\nPassing a *note bytes: 295. object to *note str(): 157. without the\n'encoding' or 'errors' arguments falls under the first case of\nreturning the informal string representation (see also the *note\n-b: 3a8. command-line option to Python).  For example:\n\n>>> str(b'Zoot!')\n\"b'Zoot!'\"\n\nFor more information on the 'str' class and its methods, see *note\nText Sequence Type -- str: 1983. and the *note String Methods: 1984.\nsection below.  To output formatted strings, see the *note\nf-strings: 7cd. and *note Format String Syntax: 1205. sections.  In\naddition, see the *note Text Processing Services: 1ec2. section.\n\n* Menu:\n\n* String Methods: String Methods<2>.\n* printf-style String Formatting::\n\nFile: python3.12.info,  Node: String Methods<2>,  Next: printf-style String Formatting,  Up: Text Sequence Type -- str\n\n5.4.8.1 String Methods\n......................\n\nStrings implement all of the *note common: 1eb4. sequence operations,\nalong with the additional methods described below.\n",
            "subsections": []
        },
        "Strings also support two styles of string formatting, one providing a": {
            "content": "large degree of flexibility and customization (see *note str.format():\n3ed, *note Format String Syntax: 1205. and *note Custom String",
            "subsections": []
        },
        "Formatting: 1ec4.) and the other based on C 'printf' style formatting": {
            "content": "that handles a narrower range of types and is slightly harder to use\ncorrectly, but is often faster for the cases it can handle (*note\nprintf-style String Formatting: 49c.).\n\nThe *note Text Processing Services: 1ec5. section of the standard\nlibrary covers a number of other modules that provide various text\nrelated utilities (including regular expression support in the *note re:\nb4. module).\n\n-- Method: str.capitalize ()\n\nReturn a copy of the string with its first character capitalized\nand the rest lowercased.\n\nChanged in version 3.8: The first character is now put into\ntitlecase rather than uppercase.  This means that characters like\ndigraphs will only have their first letter capitalized, instead of\nthe full character.\n\n-- Method: str.casefold ()\n\nReturn a casefolded copy of the string.  Casefolded strings may be\nused for caseless matching.\n\nCasefolding is similar to lowercasing but more aggressive because\nit is intended to remove all case distinctions in a string.  For\nexample, the German lowercase letter ''ss'' is equivalent to '\"ss\"'.\nSince it is already lowercase, *note lower(): 154a. would do\nnothing to ''ss''; *note casefold(): c33. converts it to '\"ss\"'.\n\nThe casefolding algorithm is described in section 3.13 'Default\nCase Folding' of the Unicode Standard(1).\n\nNew in version 3.3.\n\n-- Method: str.center (width[, fillchar])\n\nReturn centered in a string of length 'width'.  Padding is done\nusing the specified 'fillchar' (default is an ASCII space).  The\noriginal string is returned if 'width' is less than or equal to\n'len(s)'.\n\n-- Method: str.count (sub[, start[, end]])\n\nReturn the number of non-overlapping occurrences of substring 'sub'\nin the range ['start', 'end'].  Optional arguments 'start' and\n'end' are interpreted as in slice notation.\n\nIf 'sub' is empty, returns the number of empty strings between\ncharacters which is the length of the string plus one.\n\n-- Method: str.encode (encoding='utf-8', errors='strict')\n\nReturn the string encoded to *note bytes: 295.\n\n'encoding' defaults to ''utf-8''; see *note Standard Encodings:\nc15. for possible values.\n\n'errors' controls how encoding errors are handled.  If ''strict''\n(the default), a *note UnicodeError: 111b. exception is raised.\nOther possible values are ''ignore'', ''replace'',\n''xmlcharrefreplace'', ''backslashreplace'' and any other name\nregistered via *note codecs.registererror(): 12f0.  See *note\nError Handlers: 1543. for details.\n\nFor performance reasons, the value of 'errors' is not checked for\nvalidity unless an encoding error actually occurs, *note Python\nDevelopment Mode: 6e3. is enabled or a *note debug build: 67f. is\nused.\n\nChanged in version 3.1: Added support for keyword arguments.\n\nChanged in version 3.9: The value of the 'errors' argument is now\nchecked in *note Python Development Mode: 6e3. and in *note debug\nmode: 67f.\n\n-- Method: str.endswith (suffix[, start[, end]])\n\nReturn 'True' if the string ends with the specified 'suffix',\notherwise return 'False'.  'suffix' can also be a tuple of suffixes\nto look for.  With optional 'start', test beginning at that\nposition.  With optional 'end', stop comparing at that position.\n\n-- Method: str.expandtabs (tabsize=8)\n\nReturn a copy of the string where all tab characters are replaced\nby one or more spaces, depending on the current column and the\ngiven tab size.  Tab positions occur every 'tabsize' characters\n(default is 8, giving tab positions at columns 0, 8, 16 and so on).\nTo expand the string, the current column is set to zero and the\nstring is examined character by character.  If the character is a\ntab ('\\t'), one or more space characters are inserted in the result\nuntil the current column is equal to the next tab position.  (The\ntab character itself is not copied.)  If the character is a newline\n('\\n') or return ('\\r'), it is copied and the current column is\nreset to zero.  Any other character is copied unchanged and the\ncurrent column is incremented by one regardless of how the\ncharacter is represented when printed.\n\n>>> '01\\t012\\t0123\\t01234'.expandtabs()\n'01      012     0123    01234'\n>>> '01\\t012\\t0123\\t01234'.expandtabs(4)\n'01  012 0123    01234'\n\n-- Method: str.find (sub[, start[, end]])\n\nReturn the lowest index in the string where substring 'sub' is\nfound within the slice 's[start:end]'.  Optional arguments 'start'\nand 'end' are interpreted as in slice notation.  Return '-1' if\n'sub' is not found.\n\nNote: The *note find(): d0c. method should be used only if you\nneed to know the position of 'sub'.  To check if 'sub' is a\nsubstring or not, use the *note in: 250. operator:\n\n>>> 'Py' in 'Python'\nTrue\n\n-- Method: str.format (*args, kwargs)\n\nPerform a string formatting operation.  The string on which this\nmethod is called can contain literal text or replacement fields\ndelimited by braces '{}'.  Each replacement field contains either\nthe numeric index of a positional argument, or the name of a\nkeyword argument.  Returns a copy of the string where each\nreplacement field is replaced with the string value of the\ncorresponding argument.\n\n>>> \"The sum of 1 + 2 is {0}\".format(1+2)\n'The sum of 1 + 2 is 3'\n\nSee *note Format String Syntax: 1205. for a description of the\nvarious formatting options that can be specified in format strings.\n\nNote: When formatting a number (*note int: 17e, *note float:\n4b7, *note complex: 3ad, *note decimal.Decimal: 5c3. and\nsubclasses) with the 'n' type (ex: ''{:n}'.format(1234)'), the\nfunction temporarily sets the 'LCCTYPE' locale to the\n'LCNUMERIC' locale to decode 'decimalpoint' and\n'thousandssep' fields of 'localeconv()' if they are non-ASCII\nor longer than 1 byte, and the 'LCNUMERIC' locale is\ndifferent than the 'LCCTYPE' locale.  This temporary change\naffects other threads.\n\nChanged in version 3.7: When formatting a number with the 'n' type,\nthe function sets temporarily the 'LCCTYPE' locale to the\n'LCNUMERIC' locale in some cases.\n\n-- Method: str.formatmap (mapping)\n\nSimilar to 'str.format(mapping)', except that 'mapping' is used\ndirectly and not copied to a *note dict: 237.  This is useful if\nfor example 'mapping' is a dict subclass:\n\n>>> class Default(dict):\n...     def missing(self, key):\n...         return key\n...\n>>> '{name} was born in {country}'.formatmap(Default(name='Guido'))\n'Guido was born in country'\n\nNew in version 3.2.\n\n-- Method: str.index (sub[, start[, end]])\n\nLike *note find(): d0c, but raise *note ValueError: 183. when the\nsubstring is not found.\n\n-- Method: str.isalnum ()\n\nReturn 'True' if all characters in the string are alphanumeric and\nthere is at least one character, 'False' otherwise.  A character\n'c' is alphanumeric if one of the following returns 'True':\n'c.isalpha()', 'c.isdecimal()', 'c.isdigit()', or 'c.isnumeric()'.\n\n-- Method: str.isalpha ()\n\nReturn 'True' if all characters in the string are alphabetic and\nthere is at least one character, 'False' otherwise.  Alphabetic\ncharacters are those characters defined in the Unicode character\ndatabase as \"Letter\", i.e., those with general category property\nbeing one of \"Lm\", \"Lt\", \"Lu\", \"Ll\", or \"Lo\".  Note that this is\ndifferent from the Alphabetic property defined in the section 4.10\n'Letters, Alphabetic, and Ideographic' of the Unicode Standard(2).\n\n-- Method: str.isascii ()\n\nReturn 'True' if the string is empty or all characters in the\nstring are ASCII, 'False' otherwise.  ASCII characters have code\npoints in the range U+0000-U+007F.\n\nNew in version 3.7.\n\n-- Method: str.isdecimal ()\n\nReturn 'True' if all characters in the string are decimal\ncharacters and there is at least one character, 'False' otherwise.\nDecimal characters are those that can be used to form numbers in\nbase 10, e.g.  U+0660, ARABIC-INDIC DIGIT ZERO. Formally a decimal\ncharacter is a character in the Unicode General Category \"Nd\".\n\n-- Method: str.isdigit ()\n\nReturn 'True' if all characters in the string are digits and there\nis at least one character, 'False' otherwise.  Digits include\ndecimal characters and digits that need special handling, such as\nthe compatibility superscript digits.  This covers digits which\ncannot be used to form numbers in base 10, like the Kharosthi\nnumbers.  Formally, a digit is a character that has the property\nvalue NumericType=Digit or NumericType=Decimal.\n\n-- Method: str.isidentifier ()\n\nReturn 'True' if the string is a valid identifier according to the\nlanguage definition, section *note Identifiers and keywords: 1bb5.\n\n*note keyword.iskeyword(): 1ece. can be used to test whether string\n's' is a reserved identifier, such as *note def: 12af. and *note\nclass: 114c.\n\nExample:\n\n>>> from keyword import iskeyword\n\n>>> 'hello'.isidentifier(), iskeyword('hello')\n(True, False)\n>>> 'def'.isidentifier(), iskeyword('def')\n(True, True)\n\n-- Method: str.islower ()\n\nReturn 'True' if all cased characters (3) in the string are\nlowercase and there is at least one cased character, 'False'\notherwise.\n\n-- Method: str.isnumeric ()\n\nReturn 'True' if all characters in the string are numeric\ncharacters, and there is at least one character, 'False' otherwise.\nNumeric characters include digit characters, and all characters\nthat have the Unicode numeric value property, e.g.  U+2155, VULGAR\nFRACTION ONE FIFTH. Formally, numeric characters are those with the\nproperty value NumericType=Digit, NumericType=Decimal or\nNumericType=Numeric.\n\n-- Method: str.isprintable ()\n\nReturn 'True' if all characters in the string are printable or the\nstring is empty, 'False' otherwise.  Nonprintable characters are\nthose characters defined in the Unicode character database as\n\"Other\" or \"Separator\", excepting the ASCII space (0x20) which is\nconsidered printable.  (Note that printable characters in this\ncontext are those which should not be escaped when *note repr():\n5f0. is invoked on a string.  It has no bearing on the handling of\nstrings written to *note sys.stdout: 90c. or *note sys.stderr:\n757.)\n\n-- Method: str.isspace ()\n\nReturn 'True' if there are only whitespace characters in the string\nand there is at least one character, 'False' otherwise.\n\nA character is 'whitespace' if in the Unicode character database\n(see *note unicodedata: 100.), either its general category is 'Zs'\n(\"Separator, space\"), or its bidirectional class is one of 'WS',\n'B', or 'S'.\n\n-- Method: str.istitle ()\n\nReturn 'True' if the string is a titlecased string and there is at\nleast one character, for example uppercase characters may only\nfollow uncased characters and lowercase characters only cased ones.\nReturn 'False' otherwise.\n\n-- Method: str.isupper ()\n\nReturn 'True' if all cased characters (4) in the string are\nuppercase and there is at least one cased character, 'False'\notherwise.\n\n>>> 'BANANA'.isupper()\nTrue\n>>> 'banana'.isupper()\nFalse\n>>> 'baNana'.isupper()\nFalse\n>>> ' '.isupper()\nFalse\n\n-- Method: str.join (iterable)\n\nReturn a string which is the concatenation of the strings in\n'iterable'.  A *note TypeError: 28e. will be raised if there are\nany non-string values in 'iterable', including *note bytes: 295.\nobjects.  The separator between elements is the string providing\nthis method.\n\n-- Method: str.ljust (width[, fillchar])\n\nReturn the string left justified in a string of length 'width'.\nPadding is done using the specified 'fillchar' (default is an ASCII\nspace).  The original string is returned if 'width' is less than or\nequal to 'len(s)'.\n\n-- Method: str.lower ()\n\nReturn a copy of the string with all the cased characters (5)\nconverted to lowercase.\n\nThe lowercasing algorithm used is described in section 3.13\n'Default Case Folding' of the Unicode Standard(6).\n\n-- Method: str.lstrip ([chars])\n\nReturn a copy of the string with leading characters removed.  The\n'chars' argument is a string specifying the set of characters to be\nremoved.  If omitted or 'None', the 'chars' argument defaults to\nremoving whitespace.  The 'chars' argument is not a prefix; rather,\nall combinations of its values are stripped:\n\n>>> '   spacious   '.lstrip()\n'spacious   '\n>>> 'www.example.com'.lstrip('cmowz.')\n'example.com'\n\nSee *note str.removeprefix(): 6e8. for a method that will remove a\nsingle prefix string rather than all of a set of characters.  For\nexample:\n\n>>> 'Arthur: three!'.lstrip('Arthur: ')\n'ee!'\n>>> 'Arthur: three!'.removeprefix('Arthur: ')\n'three!'\n\n-- Method: static str.maketrans (x[, y[, z]])\n\nThis static method returns a translation table usable for *note\nstr.translate(): 1ed5.\n\nIf there is only one argument, it must be a dictionary mapping\nUnicode ordinals (integers) or characters (strings of length 1) to\nUnicode ordinals, strings (of arbitrary lengths) or 'None'.\nCharacter keys will then be converted to ordinals.\n\nIf there are two arguments, they must be strings of equal length,\nand in the resulting dictionary, each character in x will be mapped\nto the character at the same position in y.  If there is a third\nargument, it must be a string, whose characters will be mapped to\n'None' in the result.\n\n-- Method: str.partition (sep)\n\nSplit the string at the first occurrence of 'sep', and return a\n3-tuple containing the part before the separator, the separator\nitself, and the part after the separator.  If the separator is not\nfound, return a 3-tuple containing the string itself, followed by\ntwo empty strings.\n\n-- Method: str.removeprefix (prefix, /)\n\nIf the string starts with the 'prefix' string, return\n'string[len(prefix):]'.  Otherwise, return a copy of the original\nstring:\n\n>>> 'TestHook'.removeprefix('Test')\n'Hook'\n>>> 'BaseTestCase'.removeprefix('Test')\n'BaseTestCase'\n\nNew in version 3.9.\n\n-- Method: str.removesuffix (suffix, /)\n\nIf the string ends with the 'suffix' string and that 'suffix' is\nnot empty, return 'string[:-len(suffix)]'.  Otherwise, return a\ncopy of the original string:\n\n>>> 'MiscTests'.removesuffix('Tests')\n'Misc'\n>>> 'TmpDirMixin'.removesuffix('Tests')\n'TmpDirMixin'\n\nNew in version 3.9.\n\n-- Method: str.replace (old, new[, count])\n\nReturn a copy of the string with all occurrences of substring 'old'\nreplaced by 'new'.  If the optional argument 'count' is given, only\nthe first 'count' occurrences are replaced.\n\n-- Method: str.rfind (sub[, start[, end]])\n\nReturn the highest index in the string where substring 'sub' is\nfound, such that 'sub' is contained within 's[start:end]'.\nOptional arguments 'start' and 'end' are interpreted as in slice\nnotation.  Return '-1' on failure.\n\n-- Method: str.rindex (sub[, start[, end]])\n\nLike *note rfind(): d0d. but raises *note ValueError: 183. when the\nsubstring 'sub' is not found.\n\n-- Method: str.rjust (width[, fillchar])\n\nReturn the string right justified in a string of length 'width'.\nPadding is done using the specified 'fillchar' (default is an ASCII\nspace).  The original string is returned if 'width' is less than or\nequal to 'len(s)'.\n\n-- Method: str.rpartition (sep)\n\nSplit the string at the last occurrence of 'sep', and return a\n3-tuple containing the part before the separator, the separator\nitself, and the part after the separator.  If the separator is not\nfound, return a 3-tuple containing two empty strings, followed by\nthe string itself.\n\n-- Method: str.rsplit (sep=None, maxsplit=-1)\n\nReturn a list of the words in the string, using 'sep' as the\ndelimiter string.  If 'maxsplit' is given, at most 'maxsplit'\nsplits are done, the 'rightmost' ones.  If 'sep' is not specified\nor 'None', any whitespace string is a separator.  Except for\nsplitting from the right, *note rsplit(): 10cd. behaves like *note\nsplit(): d0e. which is described in detail below.\n\n-- Method: str.rstrip ([chars])\n\nReturn a copy of the string with trailing characters removed.  The\n'chars' argument is a string specifying the set of characters to be\nremoved.  If omitted or 'None', the 'chars' argument defaults to\nremoving whitespace.  The 'chars' argument is not a suffix; rather,\nall combinations of its values are stripped:\n\n>>> '   spacious   '.rstrip()\n'   spacious'\n>>> 'mississippi'.rstrip('ipz')\n'mississ'\n\nSee *note str.removesuffix(): 6e9. for a method that will remove a\nsingle suffix string rather than all of a set of characters.  For\nexample:\n\n>>> 'Monty Python'.rstrip(' Python')\n'M'\n>>> 'Monty Python'.removesuffix(' Python')\n'Monty'\n\n-- Method: str.split (sep=None, maxsplit=-1)\n\nReturn a list of the words in the string, using 'sep' as the\ndelimiter string.  If 'maxsplit' is given, at most 'maxsplit'\nsplits are done (thus, the list will have at most 'maxsplit+1'\nelements).  If 'maxsplit' is not specified or '-1', then there is\nno limit on the number of splits (all possible splits are made).\n\nIf 'sep' is given, consecutive delimiters are not grouped together\nand are deemed to delimit empty strings (for example,\n''1,,2'.split(',')' returns '['1', '', '2']').  The 'sep' argument\nmay consist of multiple characters (for example,\n''1<>2<>3'.split('<>')' returns '['1', '2', '3']').  Splitting an\nempty string with a specified separator returns '['']'.\n\nFor example:\n\n>>> '1,2,3'.split(',')\n['1', '2', '3']\n>>> '1,2,3'.split(',', maxsplit=1)\n['1', '2,3']\n>>> '1,2,,3,'.split(',')\n['1', '2', '', '3', '']\n\nIf 'sep' is not specified or is 'None', a different splitting\nalgorithm is applied: runs of consecutive whitespace are regarded\nas a single separator, and the result will contain no empty strings\nat the start or end if the string has leading or trailing\nwhitespace.  Consequently, splitting an empty string or a string\nconsisting of just whitespace with a 'None' separator returns '[]'.\n\nFor example:\n\n>>> '1 2 3'.split()\n['1', '2', '3']\n>>> '1 2 3'.split(maxsplit=1)\n['1', '2 3']\n>>> '   1   2   3   '.split()\n['1', '2', '3']\n\n-- Method: str.splitlines (keepends=False)\n\nReturn a list of the lines in the string, breaking at line\nboundaries.  Line breaks are not included in the resulting list\nunless 'keepends' is given and true.\n\nThis method splits on the following line boundaries.  In\nparticular, the boundaries are a superset of *note universal\nnewlines: b90.\n\nRepresentation              Description\n\n--------------------------------------------------------------\n\n'\\n'                        Line Feed\n\n\n'\\r'                        Carriage Return\n\n\n'\\r\\n'                      Carriage Return + Line Feed\n\n\n'\\v' or '\\x0b'              Line Tabulation\n\n\n'\\f' or '\\x0c'              Form Feed\n\n\n'\\x1c'                      File Separator\n\n\n'\\x1d'                      Group Separator\n\n\n'\\x1e'                      Record Separator\n\n\n'\\x85'                      Next Line (C1 Control Code)\n\n\n'\\u2028'                    Line Separator\n\n\n'\\u2029'                    Paragraph Separator\n\n\nChanged in version 3.2: '\\v' and '\\f' added to list of line\nboundaries.\n\nFor example:\n\n>>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n['ab c', '', 'de fg', 'kl']\n>>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n['ab c\\n', '\\n', 'de fg\\r', 'kl\\r\\n']\n\nUnlike *note split(): d0e. when a delimiter string 'sep' is given,\nthis method returns an empty list for the empty string, and a\nterminal line break does not result in an extra line:\n\n>>> \"\".splitlines()\n[]\n>>> \"One line\\n\".splitlines()\n['One line']\n\nFor comparison, 'split('\\n')' gives:\n\n>>> ''.split('\\n')\n['']\n>>> 'Two lines\\n'.split('\\n')\n['Two lines', '']\n\n-- Method: str.startswith (prefix[, start[, end]])\n\nReturn 'True' if string starts with the 'prefix', otherwise return\n'False'.  'prefix' can also be a tuple of prefixes to look for.\nWith optional 'start', test string beginning at that position.\nWith optional 'end', stop comparing string at that position.\n\n-- Method: str.strip ([chars])\n\nReturn a copy of the string with the leading and trailing\ncharacters removed.  The 'chars' argument is a string specifying\nthe set of characters to be removed.  If omitted or 'None', the\n'chars' argument defaults to removing whitespace.  The 'chars'\nargument is not a prefix or suffix; rather, all combinations of its\nvalues are stripped:\n\n>>> '   spacious   '.strip()\n'spacious'\n>>> 'www.example.com'.strip('cmowz.')\n'example'\n\nThe outermost leading and trailing 'chars' argument values are\nstripped from the string.  Characters are removed from the leading\nend until reaching a string character that is not contained in the\nset of characters in 'chars'.  A similar action takes place on the\ntrailing end.  For example:\n\n>>> commentstring = '#....... Section 3.2.1 Issue #32 .......'\n>>> commentstring.strip('.#! ')\n'Section 3.2.1 Issue #32'\n\n-- Method: str.swapcase ()\n\nReturn a copy of the string with uppercase characters converted to\nlowercase and vice versa.  Note that it is not necessarily true\nthat 's.swapcase().swapcase() == s'.\n\n-- Method: str.title ()\n\nReturn a titlecased version of the string where words start with an\nuppercase character and the remaining characters are lowercase.\n\nFor example:\n\n>>> 'Hello world'.title()\n'Hello World'\n\nThe algorithm uses a simple language-independent definition of a\nword as groups of consecutive letters.  The definition works in\nmany contexts but it means that apostrophes in contractions and\npossessives form word boundaries, which may not be the desired\nresult:\n\n>>> \"they're bill's friends from the UK\".title()\n\"They'Re Bill'S Friends From The Uk\"\n\nThe *note string.capwords(): 1ed8. function does not have this\nproblem, as it splits words on spaces only.\n\nAlternatively, a workaround for apostrophes can be constructed\nusing regular expressions:\n\n>>> import re\n>>> def titlecase(s):\n...     return re.sub(r\"[A-Za-z]+('[A-Za-z]+)?\",\n...                   lambda mo: mo.group(0).capitalize(),\n...                   s)\n...\n>>> titlecase(\"they're bill's friends.\")\n\"They're Bill's Friends.\"\n\n-- Method: str.translate (table)\n\nReturn a copy of the string in which each character has been mapped\nthrough the given translation table.  The table must be an object\nthat implements indexing via *note getitem(): 4b9, typically a\n*note mapping: 1030. or *note sequence: 236.  When indexed by a\nUnicode ordinal (an integer), the table object can do any of the\nfollowing: return a Unicode ordinal or a string, to map the\ncharacter to one or more other characters; return 'None', to delete\nthe character from the return string; or raise a *note LookupError:\n1ed9. exception, to map the character to itself.\n\nYou can use *note str.maketrans(): c36. to create a translation map\nfrom character-to-character mappings in different formats.\n\nSee also the *note codecs: 19. module for a more flexible approach\nto custom character mappings.\n\n-- Method: str.upper ()\n\nReturn a copy of the string with all the cased characters (7)\nconverted to uppercase.  Note that 's.upper().isupper()' might be\n'False' if 's' contains uncased characters or if the Unicode\ncategory of the resulting character(s) is not \"Lu\" (Letter,\nuppercase), but e.g.  \"Lt\" (Letter, titlecase).\n\nThe uppercasing algorithm used is described in section 3.13\n'Default Case Folding' of the Unicode Standard(8).\n\n-- Method: str.zfill (width)\n\nReturn a copy of the string left filled with ASCII ''0'' digits to\nmake a string of length 'width'.  A leading sign prefix\n(''+''/''-'') is handled by inserting the padding 'after' the sign\ncharacter rather than before.  The original string is returned if\n'width' is less than or equal to 'len(s)'.\n\nFor example:\n\n>>> \"42\".zfill(5)\n'00042'\n>>> \"-42\".zfill(5)\n'-0042'\n\n---------- Footnotes ----------\n\n(1) https://www.unicode.org/versions/Unicode15.0.0/ch03.pdf\n\n(2) https://www.unicode.org/versions/Unicode15.0.0/ch04.pdf\n\n(3) Cased characters are those with general category property being\none of \"Lu\" (Letter, uppercase), \"Ll\" (Letter, lowercase), or \"Lt\"\n(Letter, titlecase).\n\n(4) Cased characters are those with general category property being\none of \"Lu\" (Letter, uppercase), \"Ll\" (Letter, lowercase), or \"Lt\"\n(Letter, titlecase).\n\n(5) Cased characters are those with general category property being\none of \"Lu\" (Letter, uppercase), \"Ll\" (Letter, lowercase), or \"Lt\"\n(Letter, titlecase).\n\n(6) https://www.unicode.org/versions/Unicode15.0.0/ch03.pdf\n\n(7) Cased characters are those with general category property being\none of \"Lu\" (Letter, uppercase), \"Ll\" (Letter, lowercase), or \"Lt\"\n(Letter, titlecase).\n\n(8) https://www.unicode.org/versions/Unicode15.0.0/ch03.pdf\n\nFile: python3.12.info,  Node: printf-style String Formatting,  Prev: String Methods<2>,  Up: Text Sequence Type -- str\n\n5.4.8.2 'printf'-style String Formatting\n........................................\n\nNote: The formatting operations described here exhibit a variety of\nquirks that lead to a number of common errors (such as failing to\ndisplay tuples and dictionaries correctly).  Using the newer *note\nformatted string literals: 7cd, the *note str.format(): 3ed.\ninterface, or *note template strings: 1edc. may help avoid these\nerrors.  Each of these alternatives provides their own trade-offs\nand benefits of simplicity, flexibility, and/or extensibility.\n\nString objects have one unique built-in operation: the '%' operator\n(modulo).  This is also known as the string 'formatting' or\n'interpolation' operator.  Given 'format % values' (where 'format' is a\nstring), '%' conversion specifications in 'format' are replaced with\nzero or more elements of 'values'.  The effect is similar to using the\n'sprintf()' in the C language.\n",
            "subsections": []
        },
        "If 'format' requires a single argument, 'values' may be a single": {
            "content": "non-tuple object.  (1)  Otherwise, 'values' must be a tuple with exactly\nthe number of items specified by the format bytes object, or a single\nmapping object (for example, a dictionary).\n\nA conversion specifier contains two or more characters and has the\nfollowing components, which must occur in this order:\n\n1. The ''%'' character, which marks the start of the specifier.\n\n2. Mapping key (optional), consisting of a parenthesised sequence of\ncharacters (for example, '(somename)').\n\n3. Conversion flags (optional), which affect the result of some\nconversion types.\n\n4. Minimum field width (optional).  If specified as an ''*''\n(asterisk), the actual width is read from the next element of the\ntuple in 'values', and the object to convert comes after the\nminimum field width and optional precision.\n\n5. Precision (optional), given as a ''.'' (dot) followed by the\nprecision.  If specified as ''*'' (an asterisk), the actual\nprecision is read from the next element of the tuple in 'values',\nand the value to convert comes after the precision.\n\n6. Length modifier (optional).\n\n7. Conversion type.\n",
            "subsections": []
        },
        "When the right argument is a dictionary (or other mapping type), then": {
            "content": "the formats in the bytes object 'must' include a parenthesised mapping\nkey into that dictionary inserted immediately after the ''%'' character.",
            "subsections": []
        },
        "The mapping key selects the value to be formatted from the mapping.  For": {
            "content": "example:\n\n>>> print(b'%(language)s has %(number)03d quote types.' %\n...       {b'language': b\"Python\", b\"number\": 2})\nb'Python has 002 quote types.'\n\nIn this case no '*' specifiers may occur in a format (since they require\na sequential parameter list).\n\nThe conversion flag characters are:\n",
            "subsections": []
        },
        "Flag          Meaning": {
            "content": "----------------------------------------------------------------------------------------\n\n''#''         The value conversion will use the \"alternate form\" (where defined\nbelow).\n\n\n''0''         The conversion will be zero padded for numeric values.\n\n\n''-''         The converted value is left adjusted (overrides the ''0'' conversion if\nboth are given).\n\n\n'' ''         (a space) A blank should be left before a positive number (or empty\nstring) produced by a signed conversion.\n\n\n''+''         A sign character (''+'' or ''-'') will precede the conversion\n(overrides a \"space\" flag).\n\n\nA length modifier ('h', 'l', or 'L') may be present, but is ignored as\nit is not necessary for Python - so e.g.  '%ld' is identical to '%d'.\n\nThe conversion types are:\n",
            "subsections": []
        },
        "Conversion       Meaning                                                   Notes": {
            "content": "---------------------------------------------------------------------------------------\n\n''d''            Signed integer decimal.\n\n\n''i''            Signed integer decimal.\n\n\n''o''            Signed octal value.                                       (1)\n\n\n''u''            Obsolete type - it is identical to ''d''.                 (8)\n\n\n''x''            Signed hexadecimal (lowercase).                           (2)\n\n\n''X''            Signed hexadecimal (uppercase).                           (2)\n\n\n''e''            Floating point exponential format (lowercase).            (3)\n\n\n''E''            Floating point exponential format (uppercase).            (3)\n\n\n''f''            Floating point decimal format.                            (3)\n\n\n''F''            Floating point decimal format.                            (3)\n\n\n''g''            Floating point format.  Uses lowercase exponential        (4)\nformat if exponent is less than -4 or not less than\nprecision, decimal format otherwise.\n\n\n''G''            Floating point format.  Uses uppercase exponential        (4)\nformat if exponent is less than -4 or not less than\nprecision, decimal format otherwise.\n\n\n''c''            Single byte (accepts integer or single byte objects).\n\n\n''b''            Bytes (any object that follows the                        (5)\n*note buffer protocol: 148. or has\n*note bytes(): 3ae.).\n\n\n''s''            ''s'' is an alias for ''b'' and should only be used for   (6)\nPython2/3 code bases.\n\n\n''a''            Bytes (converts any Python object using                   (5)\n'repr(obj).encode('ascii', 'backslashreplace')').\n\n\n''r''            ''r'' is an alias for ''a'' and should only be used for   (7)\nPython2/3 code bases.\n\n\n''%''            No argument is converted, results in a ''%'' character\nin the result.\n\n\nNotes:\n\n1. The alternate form causes a leading octal specifier (''0o'') to be\ninserted before the first digit.\n\n2. The alternate form causes a leading ''0x'' or ''0X'' (depending on\nwhether the ''x'' or ''X'' format was used) to be inserted before\nthe first digit.\n\n3. The alternate form causes the result to always contain a decimal\npoint, even if no digits follow it.\n\nThe precision determines the number of digits after the decimal\npoint and defaults to 6.\n\n4. The alternate form causes the result to always contain a decimal\npoint, and trailing zeroes are not removed as they would otherwise\nbe.\n\nThe precision determines the number of significant digits before\nand after the decimal point and defaults to 6.\n\n5. If precision is 'N', the output is truncated to 'N' characters.\n\n6. 'b'%s'' is deprecated, but will not be removed during the 3.x\nseries.\n\n7. 'b'%r'' is deprecated, but will not be removed during the 3.x\nseries.\n\n8. See PEP 237(2).\n\nNote: The bytearray version of this method does 'not' operate in\nplace - it always produces a new object, even if no changes were\nmade.\n\nSee also\n........\n\nPEP 461(3) - Adding % formatting to bytes and bytearray\n\nNew in version 3.5.\n\n---------- Footnotes ----------\n\n(1) To format only a tuple you should therefore provide a singleton\ntuple whose only element is the tuple to be formatted.\n\n(2) https://peps.python.org/pep-0237/\n\n(3) https://peps.python.org/pep-0461/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Binary Sequence Types -- bytes bytearray memoryview,  Next: Set Types -- set frozenset,  Prev: Text Sequence Type -- str,  Up: Built-in Types": {
            "content": "The core built-in types for manipulating binary data are *note bytes:\n295. and *note bytearray: 294.  They are supported by *note memoryview:\n17f. which uses the *note buffer protocol: 148. to access the memory of\nother binary objects without needing to make a copy.\n\nThe *note array: 7. module supports efficient storage of basic data\ntypes like 32-bit integers and IEEE754 double-precision floating values.\n\n* Menu:\n\n* Bytes Objects::\n* Bytearray Objects::\n* Bytes and Bytearray Operations::\n* printf-style Bytes Formatting::\n* Memory Views::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Bytes Objects,  Next: Bytearray Objects,  Up: Binary Sequence Types -- bytes bytearray memoryview": {
            "content": "5.4.9.1 Bytes Objects\n.....................\n",
            "subsections": []
        },
        "Bytes objects are immutable sequences of single bytes.  Since many major": {
            "content": "binary protocols are based on the ASCII text encoding, bytes objects\noffer several methods that are only valid when working with ASCII\ncompatible data and are closely related to string objects in a variety\nof other ways.\n\n-- Class: bytes ([source[, encoding[, errors]]])\n\nFirstly, the syntax for bytes literals is largely the same as that\nfor string literals, except that a 'b' prefix is added:\n\n* Single quotes: 'b'still allows embedded \"double\" quotes''\n\n* Double quotes: 'b\"still allows embedded 'single' quotes\"'\n\n* Triple quoted: 'b'''3 single quotes'''', 'b\"\"\"3 double\nquotes\"\"\"'\n\nOnly ASCII characters are permitted in bytes literals (regardless\nof the declared source code encoding).  Any binary values over 127\nmust be entered into bytes literals using the appropriate escape\nsequence.\n\nAs with string literals, bytes literals may also use a 'r' prefix\nto disable processing of escape sequences.  See *note String and\nBytes literals: 1bc5. for more about the various forms of bytes\nliteral, including supported escape sequences.\n\nWhile bytes literals and representations are based on ASCII text,\nbytes objects actually behave like immutable sequences of integers,\nwith each value in the sequence restricted such that '0 <= x < 256'\n(attempts to violate this restriction will trigger *note\nValueError: 183.).  This is done deliberately to emphasise that\nwhile many binary formats include ASCII based elements and can be\nusefully manipulated with some text-oriented algorithms, this is\nnot generally the case for arbitrary binary data (blindly applying\ntext processing algorithms to binary data formats that are not\nASCII compatible will usually lead to data corruption).\n\nIn addition to the literal forms, bytes objects can be created in a\nnumber of other ways:\n\n* A zero-filled bytes object of a specified length: 'bytes(10)'\n\n* From an iterable of integers: 'bytes(range(20))'\n\n* Copying existing binary data via the buffer protocol:\n'bytes(obj)'\n\nAlso see the *note bytes: 183c. built-in.\n\nSince 2 hexadecimal digits correspond precisely to a single byte,\nhexadecimal numbers are a commonly used format for describing\nbinary data.  Accordingly, the bytes type has an additional class\nmethod to read data in that format:\n\n-- Method: classmethod fromhex (string)\n\nThis *note bytes: 295. class method returns a bytes object,\ndecoding the given string object.  The string must contain two\nhexadecimal digits per byte, with ASCII whitespace being\nignored.\n\n>>> bytes.fromhex('2Ef0 F1f2  ')\nb'.\\xf0\\xf1\\xf2'\n\nChanged in version 3.7: *note bytes.fromhex(): 926. now skips\nall ASCII whitespace in the string, not just spaces.\n\nA reverse conversion function exists to transform a bytes object\ninto its hexadecimal representation.\n\n-- Method: hex ([sep[, bytespersep]])\n\nReturn a string object containing two hexadecimal digits for\neach byte in the instance.\n\n>>> b'\\xf0\\xf1\\xf2'.hex()\n'f0f1f2'\n\nIf you want to make the hex string easier to read, you can\nspecify a single character separator 'sep' parameter to\ninclude in the output.  By default, this separator will be\nincluded between each byte.  A second optional 'bytespersep'\nparameter controls the spacing.  Positive values calculate the\nseparator position from the right, negative values from the\nleft.\n\n>>> value = b'\\xf0\\xf1\\xf2'\n>>> value.hex('-')\n'f0-f1-f2'\n>>> value.hex('', 2)\n'f0f1f2'\n>>> b'UUDDLRLRAB'.hex(' ', -4)\n'55554444 4c524c52 4142'\n\nNew in version 3.5.\n\nChanged in version 3.8: *note bytes.hex(): bc3. now supports\noptional 'sep' and 'bytespersep' parameters to insert\nseparators between bytes in the hex output.\n",
            "subsections": []
        },
        "Since bytes objects are sequences of integers (akin to a tuple), for a": {
            "content": "bytes object 'b', 'b[0]' will be an integer, while 'b[0:1]' will be a\nbytes object of length 1.  (This contrasts with text strings, where both\nindexing and slicing will produce a string of length 1)\n",
            "subsections": []
        },
        "The representation of bytes objects uses the literal format ('b'...'')": {
            "content": "since it is often more useful than e.g.  'bytes([46, 46, 46])'.  You can\nalways convert a bytes object into a list of integers using 'list(b)'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Bytearray Objects,  Next: Bytes and Bytearray Operations,  Prev: Bytes Objects,  Up: Binary Sequence Types -- bytes bytearray memoryview": {
            "content": "5.4.9.2 Bytearray Objects\n.........................\n\n*note bytearray: 294. objects are a mutable counterpart to *note bytes:\n295. objects.\n\n-- Class: bytearray ([source[, encoding[, errors]]])\n\nThere is no dedicated literal syntax for bytearray objects, instead\nthey are always created by calling the constructor:\n\n* Creating an empty instance: 'bytearray()'\n\n* Creating a zero-filled instance with a given length:\n'bytearray(10)'\n\n* From an iterable of integers: 'bytearray(range(20))'\n\n* Copying existing binary data via the buffer protocol:\n'bytearray(b'Hi!')'\n\nAs bytearray objects are mutable, they support the *note mutable:\n1e68. sequence operations in addition to the common bytes and\nbytearray operations described in *note Bytes and Bytearray\nOperations: 1e69.\n\nAlso see the *note bytearray: 183d. built-in.\n\nSince 2 hexadecimal digits correspond precisely to a single byte,\nhexadecimal numbers are a commonly used format for describing\nbinary data.  Accordingly, the bytearray type has an additional\nclass method to read data in that format:\n\n-- Method: classmethod fromhex (string)\n\nThis *note bytearray: 294. class method returns bytearray\nobject, decoding the given string object.  The string must\ncontain two hexadecimal digits per byte, with ASCII whitespace\nbeing ignored.\n\n>>> bytearray.fromhex('2Ef0 F1f2  ')\nbytearray(b'.\\xf0\\xf1\\xf2')\n\nChanged in version 3.7: *note bytearray.fromhex(): 927. now\nskips all ASCII whitespace in the string, not just spaces.\n\nA reverse conversion function exists to transform a bytearray\nobject into its hexadecimal representation.\n\n-- Method: hex ([sep[, bytespersep]])\n\nReturn a string object containing two hexadecimal digits for\neach byte in the instance.\n\n>>> bytearray(b'\\xf0\\xf1\\xf2').hex()\n'f0f1f2'\n\nNew in version 3.5.\n\nChanged in version 3.8: Similar to *note bytes.hex(): bc3,\n*note bytearray.hex(): bc4. now supports optional 'sep' and\n'bytespersep' parameters to insert separators between bytes\nin the hex output.\n",
            "subsections": []
        },
        "Since bytearray objects are sequences of integers (akin to a list), for": {
            "content": "a bytearray object 'b', 'b[0]' will be an integer, while 'b[0:1]' will\nbe a bytearray object of length 1.  (This contrasts with text strings,\nwhere both indexing and slicing will produce a string of length 1)\n",
            "subsections": []
        },
        "The representation of bytearray objects uses the bytes literal format": {
            "content": "('bytearray(b'...')') since it is often more useful than e.g.\n'bytearray([46, 46, 46])'.  You can always convert a bytearray object\ninto a list of integers using 'list(b)'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Bytes and Bytearray Operations,  Next: printf-style Bytes Formatting,  Prev: Bytearray Objects,  Up: Binary Sequence Types -- bytes bytearray memoryview": {
            "content": "5.4.9.3 Bytes and Bytearray Operations\n......................................\n\nBoth bytes and bytearray objects support the *note common: 1eb4.\nsequence operations.  They interoperate not just with operands of the\nsame type, but with any *note bytes-like object: b82.  Due to this\nflexibility, they can be freely mixed in operations without causing\nerrors.  However, the return type of the result may depend on the order\nof operands.\n\nNote: The methods on bytes and bytearray objects don't accept\nstrings as their arguments, just as the methods on strings don't\naccept bytes as their arguments.  For example, you have to write:\n\na = \"abc\"\nb = a.replace(\"a\", \"f\")\n\nand:\n\na = b\"abc\"\nb = a.replace(b\"a\", b\"f\")\n",
            "subsections": []
        },
        "Some bytes and bytearray operations assume the use of ASCII compatible": {
            "content": "binary formats, and hence should be avoided when working with arbitrary\nbinary data.  These restrictions are covered below.\n\nNote: Using these ASCII based operations to manipulate binary data\nthat is not stored in an ASCII based format may lead to data\ncorruption.\n",
            "subsections": []
        },
        "The following methods on bytes and bytearray objects can be used with": {
            "content": "arbitrary binary data.\n\n-- Method: bytes.count (sub[, start[, end]])\n-- Method: bytearray.count (sub[, start[, end]])\n\nReturn the number of non-overlapping occurrences of subsequence\n'sub' in the range ['start', 'end'].  Optional arguments 'start'\nand 'end' are interpreted as in slice notation.\n\nThe subsequence to search for may be any *note bytes-like object:\nb82. or an integer in the range 0 to 255.\n\nIf 'sub' is empty, returns the number of empty slices between\ncharacters which is the length of the bytes object plus one.\n\nChanged in version 3.3: Also accept an integer in the range 0 to\n255 as the subsequence.\n\n-- Method: bytes.removeprefix (prefix, /)\n-- Method: bytearray.removeprefix (prefix, /)\n\nIf the binary data starts with the 'prefix' string, return\n'bytes[len(prefix):]'.  Otherwise, return a copy of the original\nbinary data:\n\n>>> b'TestHook'.removeprefix(b'Test')\nb'Hook'\n>>> b'BaseTestCase'.removeprefix(b'Test')\nb'BaseTestCase'\n\nThe 'prefix' may be any *note bytes-like object: b82.\n\nNote: The bytearray version of this method does 'not' operate\nin place - it always produces a new object, even if no changes\nwere made.\n\nNew in version 3.9.\n\n-- Method: bytes.removesuffix (suffix, /)\n-- Method: bytearray.removesuffix (suffix, /)\n\nIf the binary data ends with the 'suffix' string and that 'suffix'\nis not empty, return 'bytes[:-len(suffix)]'.  Otherwise, return a\ncopy of the original binary data:\n\n>>> b'MiscTests'.removesuffix(b'Tests')\nb'Misc'\n>>> b'TmpDirMixin'.removesuffix(b'Tests')\nb'TmpDirMixin'\n\nThe 'suffix' may be any *note bytes-like object: b82.\n\nNote: The bytearray version of this method does 'not' operate\nin place - it always produces a new object, even if no changes\nwere made.\n\nNew in version 3.9.\n\n-- Method: bytes.decode (encoding='utf-8', errors='strict')\n-- Method: bytearray.decode (encoding='utf-8', errors='strict')\n\nReturn the bytes decoded to a *note str: 157.\n\n'encoding' defaults to ''utf-8''; see *note Standard Encodings:\nc15. for possible values.\n\n'errors' controls how decoding errors are handled.  If ''strict''\n(the default), a *note UnicodeError: 111b. exception is raised.\nOther possible values are ''ignore'', ''replace'', and any other\nname registered via *note codecs.registererror(): 12f0.  See *note\nError Handlers: 1543. for details.\n\nFor performance reasons, the value of 'errors' is not checked for\nvalidity unless a decoding error actually occurs, *note Python\nDevelopment Mode: 6e3. is enabled or a *note debug build: 67f. is\nused.\n\nNote: Passing the 'encoding' argument to *note str: 157.\nallows decoding any *note bytes-like object: b82. directly,\nwithout needing to make a temporary 'bytes' or 'bytearray'\nobject.\n\nChanged in version 3.1: Added support for keyword arguments.\n\nChanged in version 3.9: The value of the 'errors' argument is now\nchecked in *note Python Development Mode: 6e3. and in *note debug\nmode: 67f.\n\n-- Method: bytes.endswith (suffix[, start[, end]])\n-- Method: bytearray.endswith (suffix[, start[, end]])\n\nReturn 'True' if the binary data ends with the specified 'suffix',\notherwise return 'False'.  'suffix' can also be a tuple of suffixes\nto look for.  With optional 'start', test beginning at that\nposition.  With optional 'end', stop comparing at that position.\n\nThe suffix(es) to search for may be any *note bytes-like object:\nb82.\n\n-- Method: bytes.find (sub[, start[, end]])\n-- Method: bytearray.find (sub[, start[, end]])\n\nReturn the lowest index in the data where the subsequence 'sub' is\nfound, such that 'sub' is contained in the slice 's[start:end]'.\nOptional arguments 'start' and 'end' are interpreted as in slice\nnotation.  Return '-1' if 'sub' is not found.\n\nThe subsequence to search for may be any *note bytes-like object:\nb82. or an integer in the range 0 to 255.\n\nNote: The *note find(): 15a0. method should be used only if\nyou need to know the position of 'sub'.  To check if 'sub' is\na substring or not, use the *note in: 250. operator:\n\n>>> b'Py' in b'Python'\nTrue\n\nChanged in version 3.3: Also accept an integer in the range 0 to\n255 as the subsequence.\n\n-- Method: bytes.index (sub[, start[, end]])\n-- Method: bytearray.index (sub[, start[, end]])\n\nLike *note find(): 15a0, but raise *note ValueError: 183. when the\nsubsequence is not found.\n\nThe subsequence to search for may be any *note bytes-like object:\nb82. or an integer in the range 0 to 255.\n\nChanged in version 3.3: Also accept an integer in the range 0 to\n255 as the subsequence.\n\n-- Method: bytes.join (iterable)\n-- Method: bytearray.join (iterable)\n\nReturn a bytes or bytearray object which is the concatenation of\nthe binary data sequences in 'iterable'.  A *note TypeError: 28e.\nwill be raised if there are any values in 'iterable' that are not\n*note bytes-like objects: b82, including *note str: 157. objects.\nThe separator between elements is the contents of the bytes or\nbytearray object providing this method.\n\n-- Method: static bytes.maketrans (from, to)\n-- Method: static bytearray.maketrans (from, to)\n\nThis static method returns a translation table usable for *note\nbytes.translate(): 1eee. that will map each character in 'from'\ninto the character at the same position in 'to'; 'from' and 'to'\nmust both be *note bytes-like objects: b82. and have the same\nlength.\n\nNew in version 3.1.\n\n-- Method: bytes.partition (sep)\n-- Method: bytearray.partition (sep)\n\nSplit the sequence at the first occurrence of 'sep', and return a\n3-tuple containing the part before the separator, the separator\nitself or its bytearray copy, and the part after the separator.  If\nthe separator is not found, return a 3-tuple containing a copy of\nthe original sequence, followed by two empty bytes or bytearray\nobjects.\n\nThe separator to search for may be any *note bytes-like object:\nb82.\n\n-- Method: bytes.replace (old, new[, count])\n-- Method: bytearray.replace (old, new[, count])\n\nReturn a copy of the sequence with all occurrences of subsequence\n'old' replaced by 'new'.  If the optional argument 'count' is\ngiven, only the first 'count' occurrences are replaced.\n\nThe subsequence to search for and its replacement may be any *note\nbytes-like object: b82.\n\nNote: The bytearray version of this method does 'not' operate\nin place - it always produces a new object, even if no changes\nwere made.\n\n-- Method: bytes.rfind (sub[, start[, end]])\n-- Method: bytearray.rfind (sub[, start[, end]])\n\nReturn the highest index in the sequence where the subsequence\n'sub' is found, such that 'sub' is contained within 's[start:end]'.\nOptional arguments 'start' and 'end' are interpreted as in slice\nnotation.  Return '-1' on failure.\n\nThe subsequence to search for may be any *note bytes-like object:\nb82. or an integer in the range 0 to 255.\n\nChanged in version 3.3: Also accept an integer in the range 0 to\n255 as the subsequence.\n\n-- Method: bytes.rindex (sub[, start[, end]])\n-- Method: bytearray.rindex (sub[, start[, end]])\n\nLike *note rfind(): 15a1. but raises *note ValueError: 183. when\nthe subsequence 'sub' is not found.\n\nThe subsequence to search for may be any *note bytes-like object:\nb82. or an integer in the range 0 to 255.\n\nChanged in version 3.3: Also accept an integer in the range 0 to\n255 as the subsequence.\n\n-- Method: bytes.rpartition (sep)\n-- Method: bytearray.rpartition (sep)\n\nSplit the sequence at the last occurrence of 'sep', and return a\n3-tuple containing the part before the separator, the separator\nitself or its bytearray copy, and the part after the separator.  If\nthe separator is not found, return a 3-tuple containing two empty\nbytes or bytearray objects, followed by a copy of the original\nsequence.\n\nThe separator to search for may be any *note bytes-like object:\nb82.\n\n-- Method: bytes.startswith (prefix[, start[, end]])\n-- Method: bytearray.startswith (prefix[, start[, end]])\n\nReturn 'True' if the binary data starts with the specified\n'prefix', otherwise return 'False'.  'prefix' can also be a tuple\nof prefixes to look for.  With optional 'start', test beginning at\nthat position.  With optional 'end', stop comparing at that\nposition.\n\nThe prefix(es) to search for may be any *note bytes-like object:\nb82.\n\n-- Method: bytes.translate (table, /, delete=b'')\n-- Method: bytearray.translate (table, /, delete=b'')\n\nReturn a copy of the bytes or bytearray object where all bytes\noccurring in the optional argument 'delete' are removed, and the\nremaining bytes have been mapped through the given translation\ntable, which must be a bytes object of length 256.\n\nYou can use the *note bytes.maketrans(): 10ed. method to create a\ntranslation table.\n\nSet the 'table' argument to 'None' for translations that only\ndelete characters:\n\n>>> b'read this short text'.translate(None, b'aeiou')\nb'rd ths shrt txt'\n\nChanged in version 3.6: 'delete' is now supported as a keyword\nargument.\n",
            "subsections": []
        },
        "The following methods on bytes and bytearray objects have default": {
            "content": "behaviours that assume the use of ASCII compatible binary formats, but\ncan still be used with arbitrary binary data by passing appropriate\narguments.  Note that all of the bytearray methods in this section do\n'not' operate in place, and instead produce new objects.\n\n-- Method: bytes.center (width[, fillbyte])\n-- Method: bytearray.center (width[, fillbyte])\n\nReturn a copy of the object centered in a sequence of length\n'width'.  Padding is done using the specified 'fillbyte' (default\nis an ASCII space).  For *note bytes: 295. objects, the original\nsequence is returned if 'width' is less than or equal to 'len(s)'.\n\nNote: The bytearray version of this method does 'not' operate\nin place - it always produces a new object, even if no changes\nwere made.\n\n-- Method: bytes.ljust (width[, fillbyte])\n-- Method: bytearray.ljust (width[, fillbyte])\n\nReturn a copy of the object left justified in a sequence of length\n'width'.  Padding is done using the specified 'fillbyte' (default\nis an ASCII space).  For *note bytes: 295. objects, the original\nsequence is returned if 'width' is less than or equal to 'len(s)'.\n\nNote: The bytearray version of this method does 'not' operate\nin place - it always produces a new object, even if no changes\nwere made.\n\n-- Method: bytes.lstrip ([chars])\n-- Method: bytearray.lstrip ([chars])\n\nReturn a copy of the sequence with specified leading bytes removed.\nThe 'chars' argument is a binary sequence specifying the set of\nbyte values to be removed - the name refers to the fact this method\nis usually used with ASCII characters.  If omitted or 'None', the\n'chars' argument defaults to removing ASCII whitespace.  The\n'chars' argument is not a prefix; rather, all combinations of its\nvalues are stripped:\n\n>>> b'   spacious   '.lstrip()\nb'spacious   '\n>>> b'www.example.com'.lstrip(b'cmowz.')\nb'example.com'\n\nThe binary sequence of byte values to remove may be any *note\nbytes-like object: b82.  See *note removeprefix(): 1ee3. for a\nmethod that will remove a single prefix string rather than all of a\nset of characters.  For example:\n\n>>> b'Arthur: three!'.lstrip(b'Arthur: ')\nb'ee!'\n>>> b'Arthur: three!'.removeprefix(b'Arthur: ')\nb'three!'\n\nNote: The bytearray version of this method does 'not' operate\nin place - it always produces a new object, even if no changes\nwere made.\n\n-- Method: bytes.rjust (width[, fillbyte])\n-- Method: bytearray.rjust (width[, fillbyte])\n\nReturn a copy of the object right justified in a sequence of length\n'width'.  Padding is done using the specified 'fillbyte' (default\nis an ASCII space).  For *note bytes: 295. objects, the original\nsequence is returned if 'width' is less than or equal to 'len(s)'.\n\nNote: The bytearray version of this method does 'not' operate\nin place - it always produces a new object, even if no changes\nwere made.\n\n-- Method: bytes.rsplit (sep=None, maxsplit=-1)\n-- Method: bytearray.rsplit (sep=None, maxsplit=-1)\n\nSplit the binary sequence into subsequences of the same type, using\n'sep' as the delimiter string.  If 'maxsplit' is given, at most\n'maxsplit' splits are done, the 'rightmost' ones.  If 'sep' is not\nspecified or 'None', any subsequence consisting solely of ASCII\nwhitespace is a separator.  Except for splitting from the right,\n*note rsplit(): 1f03. behaves like *note split(): 1f04. which is\ndescribed in detail below.\n\n-- Method: bytes.rstrip ([chars])\n-- Method: bytearray.rstrip ([chars])\n\nReturn a copy of the sequence with specified trailing bytes\nremoved.  The 'chars' argument is a binary sequence specifying the\nset of byte values to be removed - the name refers to the fact this\nmethod is usually used with ASCII characters.  If omitted or\n'None', the 'chars' argument defaults to removing ASCII whitespace.\nThe 'chars' argument is not a suffix; rather, all combinations of\nits values are stripped:\n\n>>> b'   spacious   '.rstrip()\nb'   spacious'\n>>> b'mississippi'.rstrip(b'ipz')\nb'mississ'\n\nThe binary sequence of byte values to remove may be any *note\nbytes-like object: b82.  See *note removesuffix(): 1ee5. for a\nmethod that will remove a single suffix string rather than all of a\nset of characters.  For example:\n\n>>> b'Monty Python'.rstrip(b' Python')\nb'M'\n>>> b'Monty Python'.removesuffix(b' Python')\nb'Monty'\n\nNote: The bytearray version of this method does 'not' operate\nin place - it always produces a new object, even if no changes\nwere made.\n\n-- Method: bytes.split (sep=None, maxsplit=-1)\n-- Method: bytearray.split (sep=None, maxsplit=-1)\n\nSplit the binary sequence into subsequences of the same type, using\n'sep' as the delimiter string.  If 'maxsplit' is given and\nnon-negative, at most 'maxsplit' splits are done (thus, the list\nwill have at most 'maxsplit+1' elements).  If 'maxsplit' is not\nspecified or is '-1', then there is no limit on the number of\nsplits (all possible splits are made).\n\nIf 'sep' is given, consecutive delimiters are not grouped together\nand are deemed to delimit empty subsequences (for example,\n'b'1,,2'.split(b',')' returns '[b'1', b'', b'2']').  The 'sep'\nargument may consist of a multibyte sequence (for example,\n'b'1<>2<>3'.split(b'<>')' returns '[b'1', b'2', b'3']').  Splitting\nan empty sequence with a specified separator returns '[b'']' or\n'[bytearray(b'')]' depending on the type of object being split.\nThe 'sep' argument may be any *note bytes-like object: b82.\n\nFor example:\n\n>>> b'1,2,3'.split(b',')\n[b'1', b'2', b'3']\n>>> b'1,2,3'.split(b',', maxsplit=1)\n[b'1', b'2,3']\n>>> b'1,2,,3,'.split(b',')\n[b'1', b'2', b'', b'3', b'']\n\nIf 'sep' is not specified or is 'None', a different splitting\nalgorithm is applied: runs of consecutive ASCII whitespace are\nregarded as a single separator, and the result will contain no\nempty strings at the start or end if the sequence has leading or\ntrailing whitespace.  Consequently, splitting an empty sequence or\na sequence consisting solely of ASCII whitespace without a\nspecified separator returns '[]'.\n\nFor example:\n\n>>> b'1 2 3'.split()\n[b'1', b'2', b'3']\n>>> b'1 2 3'.split(maxsplit=1)\n[b'1', b'2 3']\n>>> b'   1   2   3   '.split()\n[b'1', b'2', b'3']\n\n-- Method: bytes.strip ([chars])\n-- Method: bytearray.strip ([chars])\n\nReturn a copy of the sequence with specified leading and trailing\nbytes removed.  The 'chars' argument is a binary sequence\nspecifying the set of byte values to be removed - the name refers\nto the fact this method is usually used with ASCII characters.  If\nomitted or 'None', the 'chars' argument defaults to removing ASCII\nwhitespace.  The 'chars' argument is not a prefix or suffix;\nrather, all combinations of its values are stripped:\n\n>>> b'   spacious   '.strip()\nb'spacious'\n>>> b'www.example.com'.strip(b'cmowz.')\nb'example'\n\nThe binary sequence of byte values to remove may be any *note\nbytes-like object: b82.\n\nNote: The bytearray version of this method does 'not' operate\nin place - it always produces a new object, even if no changes\nwere made.\n",
            "subsections": []
        },
        "The following methods on bytes and bytearray objects assume the use of": {
            "content": "ASCII compatible binary formats and should not be applied to arbitrary\nbinary data.  Note that all of the bytearray methods in this section do\n'not' operate in place, and instead produce new objects.\n\n-- Method: bytes.capitalize ()\n-- Method: bytearray.capitalize ()\n\nReturn a copy of the sequence with each byte interpreted as an\nASCII character, and the first byte capitalized and the rest\nlowercased.  Non-ASCII byte values are passed through unchanged.\n\nNote: The bytearray version of this method does 'not' operate\nin place - it always produces a new object, even if no changes\nwere made.\n\n-- Method: bytes.expandtabs (tabsize=8)\n-- Method: bytearray.expandtabs (tabsize=8)\n\nReturn a copy of the sequence where all ASCII tab characters are\nreplaced by one or more ASCII spaces, depending on the current\ncolumn and the given tab size.  Tab positions occur every 'tabsize'\nbytes (default is 8, giving tab positions at columns 0, 8, 16 and\nso on).  To expand the sequence, the current column is set to zero\nand the sequence is examined byte by byte.  If the byte is an ASCII\ntab character ('b'\\t''), one or more space characters are inserted\nin the result until the current column is equal to the next tab\nposition.  (The tab character itself is not copied.)  If the\ncurrent byte is an ASCII newline ('b'\\n'') or carriage return\n('b'\\r''), it is copied and the current column is reset to zero.\nAny other byte value is copied unchanged and the current column is\nincremented by one regardless of how the byte value is represented\nwhen printed:\n\n>>> b'01\\t012\\t0123\\t01234'.expandtabs()\nb'01      012     0123    01234'\n>>> b'01\\t012\\t0123\\t01234'.expandtabs(4)\nb'01  012 0123    01234'\n\nNote: The bytearray version of this method does 'not' operate\nin place - it always produces a new object, even if no changes\nwere made.\n\n-- Method: bytes.isalnum ()\n-- Method: bytearray.isalnum ()\n\nReturn 'True' if all bytes in the sequence are alphabetical ASCII\ncharacters or ASCII decimal digits and the sequence is not empty,\n'False' otherwise.  Alphabetic ASCII characters are those byte\nvalues in the sequence\n'b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ''.  ASCII\ndecimal digits are those byte values in the sequence\n'b'0123456789''.\n\nFor example:\n\n>>> b'ABCabc1'.isalnum()\nTrue\n>>> b'ABC abc1'.isalnum()\nFalse\n\n-- Method: bytes.isalpha ()\n-- Method: bytearray.isalpha ()\n\nReturn 'True' if all bytes in the sequence are alphabetic ASCII\ncharacters and the sequence is not empty, 'False' otherwise.\nAlphabetic ASCII characters are those byte values in the sequence\n'b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ''.\n\nFor example:\n\n>>> b'ABCabc'.isalpha()\nTrue\n>>> b'ABCabc1'.isalpha()\nFalse\n\n-- Method: bytes.isascii ()\n-- Method: bytearray.isascii ()\n\nReturn 'True' if the sequence is empty or all bytes in the sequence\nare ASCII, 'False' otherwise.  ASCII bytes are in the range 0-0x7F.\n\nNew in version 3.7.\n\n-- Method: bytes.isdigit ()\n-- Method: bytearray.isdigit ()\n\nReturn 'True' if all bytes in the sequence are ASCII decimal digits\nand the sequence is not empty, 'False' otherwise.  ASCII decimal\ndigits are those byte values in the sequence 'b'0123456789''.\n\nFor example:\n\n>>> b'1234'.isdigit()\nTrue\n>>> b'1.23'.isdigit()\nFalse\n\n-- Method: bytes.islower ()\n-- Method: bytearray.islower ()\n\nReturn 'True' if there is at least one lowercase ASCII character in\nthe sequence and no uppercase ASCII characters, 'False' otherwise.\n\nFor example:\n\n>>> b'hello world'.islower()\nTrue\n>>> b'Hello world'.islower()\nFalse\n\nLowercase ASCII characters are those byte values in the sequence\n'b'abcdefghijklmnopqrstuvwxyz''.  Uppercase ASCII characters are\nthose byte values in the sequence 'b'ABCDEFGHIJKLMNOPQRSTUVWXYZ''.\n\n-- Method: bytes.isspace ()\n-- Method: bytearray.isspace ()\n\nReturn 'True' if all bytes in the sequence are ASCII whitespace and\nthe sequence is not empty, 'False' otherwise.  ASCII whitespace\ncharacters are those byte values in the sequence 'b' \\t\\n\\r\\x0b\\f''\n(space, tab, newline, carriage return, vertical tab, form feed).\n\n-- Method: bytes.istitle ()\n-- Method: bytearray.istitle ()\n\nReturn 'True' if the sequence is ASCII titlecase and the sequence\nis not empty, 'False' otherwise.  See *note bytes.title(): 1f1c.\nfor more details on the definition of \"titlecase\".\n\nFor example:\n\n>>> b'Hello World'.istitle()\nTrue\n>>> b'Hello world'.istitle()\nFalse\n\n-- Method: bytes.isupper ()\n-- Method: bytearray.isupper ()\n\nReturn 'True' if there is at least one uppercase alphabetic ASCII\ncharacter in the sequence and no lowercase ASCII characters,\n'False' otherwise.\n\nFor example:\n\n>>> b'HELLO WORLD'.isupper()\nTrue\n>>> b'Hello world'.isupper()\nFalse\n\nLowercase ASCII characters are those byte values in the sequence\n'b'abcdefghijklmnopqrstuvwxyz''.  Uppercase ASCII characters are\nthose byte values in the sequence 'b'ABCDEFGHIJKLMNOPQRSTUVWXYZ''.\n\n-- Method: bytes.lower ()\n-- Method: bytearray.lower ()\n\nReturn a copy of the sequence with all the uppercase ASCII\ncharacters converted to their corresponding lowercase counterpart.\n\nFor example:\n\n>>> b'Hello World'.lower()\nb'hello world'\n\nLowercase ASCII characters are those byte values in the sequence\n'b'abcdefghijklmnopqrstuvwxyz''.  Uppercase ASCII characters are\nthose byte values in the sequence 'b'ABCDEFGHIJKLMNOPQRSTUVWXYZ''.\n\nNote: The bytearray version of this method does 'not' operate\nin place - it always produces a new object, even if no changes\nwere made.\n\n-- Method: bytes.splitlines (keepends=False)\n-- Method: bytearray.splitlines (keepends=False)\n\nReturn a list of the lines in the binary sequence, breaking at\nASCII line boundaries.  This method uses the *note universal\nnewlines: b90. approach to splitting lines.  Line breaks are not\nincluded in the resulting list unless 'keepends' is given and true.\n\nFor example:\n\n>>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n[b'ab c', b'', b'de fg', b'kl']\n>>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n[b'ab c\\n', b'\\n', b'de fg\\r', b'kl\\r\\n']\n\nUnlike *note split(): 1f07. when a delimiter string 'sep' is given,\nthis method returns an empty list for the empty string, and a\nterminal line break does not result in an extra line:\n\n>>> b\"\".split(b'\\n'), b\"Two lines\\n\".split(b'\\n')\n([b''], [b'Two lines', b''])\n>>> b\"\".splitlines(), b\"One line\\n\".splitlines()\n([], [b'One line'])\n\n-- Method: bytes.swapcase ()\n-- Method: bytearray.swapcase ()\n\nReturn a copy of the sequence with all the lowercase ASCII\ncharacters converted to their corresponding uppercase counterpart\nand vice-versa.\n\nFor example:\n\n>>> b'Hello World'.swapcase()\nb'hELLO wORLD'\n\nLowercase ASCII characters are those byte values in the sequence\n'b'abcdefghijklmnopqrstuvwxyz''.  Uppercase ASCII characters are\nthose byte values in the sequence 'b'ABCDEFGHIJKLMNOPQRSTUVWXYZ''.\n\nUnlike *note str.swapcase(): 1ed6, it is always the case that\n'bin.swapcase().swapcase() == bin' for the binary versions.  Case\nconversions are symmetrical in ASCII, even though that is not\ngenerally true for arbitrary Unicode code points.\n\nNote: The bytearray version of this method does 'not' operate\nin place - it always produces a new object, even if no changes\nwere made.\n\n-- Method: bytes.title ()\n-- Method: bytearray.title ()\n\nReturn a titlecased version of the binary sequence where words\nstart with an uppercase ASCII character and the remaining\ncharacters are lowercase.  Uncased byte values are left unmodified.\n\nFor example:\n\n>>> b'Hello world'.title()\nb'Hello World'\n\nLowercase ASCII characters are those byte values in the sequence\n'b'abcdefghijklmnopqrstuvwxyz''.  Uppercase ASCII characters are\nthose byte values in the sequence 'b'ABCDEFGHIJKLMNOPQRSTUVWXYZ''.\nAll other byte values are uncased.\n\nThe algorithm uses a simple language-independent definition of a\nword as groups of consecutive letters.  The definition works in\nmany contexts but it means that apostrophes in contractions and\npossessives form word boundaries, which may not be the desired\nresult:\n\n>>> b\"they're bill's friends from the UK\".title()\nb\"They'Re Bill'S Friends From The Uk\"\n\nA workaround for apostrophes can be constructed using regular\nexpressions:\n\n>>> import re\n>>> def titlecase(s):\n...     return re.sub(rb\"[A-Za-z]+('[A-Za-z]+)?\",\n...                   lambda mo: mo.group(0)[0:1].upper() +\n...                              mo.group(0)[1:].lower(),\n...                   s)\n...\n>>> titlecase(b\"they're bill's friends.\")\nb\"They're Bill's Friends.\"\n\nNote: The bytearray version of this method does 'not' operate\nin place - it always produces a new object, even if no changes\nwere made.\n\n-- Method: bytes.upper ()\n-- Method: bytearray.upper ()\n\nReturn a copy of the sequence with all the lowercase ASCII\ncharacters converted to their corresponding uppercase counterpart.\n\nFor example:\n\n>>> b'Hello World'.upper()\nb'HELLO WORLD'\n\nLowercase ASCII characters are those byte values in the sequence\n'b'abcdefghijklmnopqrstuvwxyz''.  Uppercase ASCII characters are\nthose byte values in the sequence 'b'ABCDEFGHIJKLMNOPQRSTUVWXYZ''.\n\nNote: The bytearray version of this method does 'not' operate\nin place - it always produces a new object, even if no changes\nwere made.\n\n-- Method: bytes.zfill (width)\n-- Method: bytearray.zfill (width)\n\nReturn a copy of the sequence left filled with ASCII 'b'0'' digits\nto make a sequence of length 'width'.  A leading sign prefix\n('b'+''/ 'b'-'') is handled by inserting the padding 'after' the\nsign character rather than before.  For *note bytes: 295. objects,\nthe original sequence is returned if 'width' is less than or equal\nto 'len(seq)'.\n\nFor example:\n\n>>> b\"42\".zfill(5)\nb'00042'\n>>> b\"-42\".zfill(5)\nb'-0042'\n\nNote: The bytearray version of this method does 'not' operate\nin place - it always produces a new object, even if no changes\nwere made.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: printf-style Bytes Formatting,  Next: Memory Views,  Prev: Bytes and Bytearray Operations,  Up: Binary Sequence Types -- bytes bytearray memoryview": {
            "content": "5.4.9.4 'printf'-style Bytes Formatting\n.......................................\n\nNote: The formatting operations described here exhibit a variety of\nquirks that lead to a number of common errors (such as failing to\ndisplay tuples and dictionaries correctly).  If the value being\nprinted may be a tuple or dictionary, wrap it in a tuple.\n\nBytes objects ('bytes'/'bytearray') have one unique built-in operation:\nthe '%' operator (modulo).  This is also known as the bytes 'formatting'\nor 'interpolation' operator.  Given 'format % values' (where 'format' is\na bytes object), '%' conversion specifications in 'format' are replaced\nwith zero or more elements of 'values'.  The effect is similar to using\nthe 'sprintf()' in the C language.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Memory Views,  Prev: printf-style Bytes Formatting,  Up: Binary Sequence Types -- bytes bytearray memoryview": {
            "content": "5.4.9.5 Memory Views\n....................\n\n*note memoryview: 17f. objects allow Python code to access the internal\ndata of an object that supports the *note buffer protocol: 148. without\ncopying.\n\n-- Class: memoryview (object)\n\nCreate a *note memoryview: 17f. that references 'object'.  'object'\nmust support the buffer protocol.  Built-in objects that support\nthe buffer protocol include *note bytes: 295. and *note bytearray:\n294.\n\nA *note memoryview: 17f. has the notion of an 'element', which is\nthe atomic memory unit handled by the originating 'object'.  For\nmany simple types such as *note bytes: 295. and *note bytearray:\n294, an element is a single byte, but other types such as *note\narray.array: 18f. may have bigger elements.\n\n'len(view)' is equal to the length of *note tolist: 1f2c, which is\nthe nested list representation of the view.  If 'view.ndim = 1',\nthis is equal to the number of elements in the view.\n\nChanged in version 3.12: If 'view.ndim == 0', 'len(view)' now\nraises *note TypeError: 28e. instead of returning 1.\n\nThe *note itemsize: 1f2d. attribute will give you the number of\nbytes in a single element.\n\nA *note memoryview: 17f. supports slicing and indexing to expose\nits data.  One-dimensional slicing will result in a subview:\n\n>>> v = memoryview(b'abcefg')\n>>> v[1]\n98\n>>> v[-1]\n103\n>>> v[1:4]\n<memory at 0x7f3ddc9f4350>\n>>> bytes(v[1:4])\nb'bce'\n\nIf *note format: 1f2e. is one of the native format specifiers from\nthe *note struct: cf. module, indexing with an integer or a tuple\nof integers is also supported and returns a single 'element' with\nthe correct type.  One-dimensional memoryviews can be indexed with\nan integer or a one-integer tuple.  Multi-dimensional memoryviews\ncan be indexed with tuples of exactly 'ndim' integers where 'ndim'\nis the number of dimensions.  Zero-dimensional memoryviews can be\nindexed with the empty tuple.\n\nHere is an example with a non-byte format:\n\n>>> import array\n>>> a = array.array('l', [-11111111, 22222222, -33333333, 44444444])\n>>> m = memoryview(a)\n>>> m[0]\n-11111111\n>>> m[-1]\n44444444\n>>> m[::2].tolist()\n[-11111111, -33333333]\n\nIf the underlying object is writable, the memoryview supports\none-dimensional slice assignment.  Resizing is not allowed:\n\n>>> data = bytearray(b'abcefg')\n>>> v = memoryview(data)\n>>> v.readonly\nFalse\n>>> v[0] = ord(b'z')\n>>> data\nbytearray(b'zbcefg')\n>>> v[1:4] = b'123'\n>>> data\nbytearray(b'z123fg')\n>>> v[2:3] = b'spam'\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nValueError: memoryview assignment: lvalue and rvalue have different structures\n>>> v[2:6] = b'spam'\n>>> data\nbytearray(b'z1spam')\n\nOne-dimensional memoryviews of *note hashable: 3db. (read-only)\ntypes with formats 'B', 'b' or 'c' are also hashable.  The hash is\ndefined as 'hash(m) == hash(m.tobytes())':\n\n>>> v = memoryview(b'abcefg')\n>>> hash(v) == hash(b'abcefg')\nTrue\n>>> hash(v[2:4]) == hash(b'ce')\nTrue\n>>> hash(v[::-2]) == hash(b'abcefg'[::-2])\nTrue\n\nChanged in version 3.3: One-dimensional memoryviews can now be\nsliced.  One-dimensional memoryviews with formats 'B', 'b' or 'c'\nare now *note hashable: 3db.\n\nChanged in version 3.4: memoryview is now registered automatically\nwith *note collections.abc.Sequence: 1038.\n\nChanged in version 3.5: memoryviews can now be indexed with tuple\nof integers.\n\n*note memoryview: 17f. has several methods:\n\n-- Method: eq (exporter)\n\nA memoryview and a PEP 3118(1) exporter are equal if their\nshapes are equivalent and if all corresponding values are\nequal when the operands' respective format codes are\ninterpreted using *note struct: cf. syntax.\n\nFor the subset of *note struct: cf. format strings currently\nsupported by *note tolist(): 1f2c, 'v' and 'w' are equal if\n'v.tolist() == w.tolist()':\n\n>>> import array\n>>> a = array.array('I', [1, 2, 3, 4, 5])\n>>> b = array.array('d', [1.0, 2.0, 3.0, 4.0, 5.0])\n>>> c = array.array('b', [5, 3, 1])\n>>> x = memoryview(a)\n>>> y = memoryview(b)\n>>> x == a == y == b\nTrue\n>>> x.tolist() == a.tolist() == y.tolist() == b.tolist()\nTrue\n>>> z = y[::-2]\n>>> z == c\nTrue\n>>> z.tolist() == c.tolist()\nTrue\n\nIf either format string is not supported by the *note struct:\ncf. module, then the objects will always compare as unequal\n(even if the format strings and buffer contents are\nidentical):\n\n>>> from ctypes import BigEndianStructure, clong\n>>> class BEPoint(BigEndianStructure):\n...     fields = [(\"x\", clong), (\"y\", clong)]\n...\n>>> point = BEPoint(100, 200)\n>>> a = memoryview(point)\n>>> b = memoryview(point)\n>>> a == point\nFalse\n>>> a == b\nFalse\n\nNote that, as with floating point numbers, 'v is w' does 'not'\nimply 'v == w' for memoryview objects.\n\nChanged in version 3.3: Previous versions compared the raw\nmemory disregarding the item format and the logical array\nstructure.\n\n-- Method: tobytes (order='C')\n\nReturn the data in the buffer as a bytestring.  This is\nequivalent to calling the *note bytes: 295. constructor on the\nmemoryview.\n\n>>> m = memoryview(b\"abc\")\n>>> m.tobytes()\nb'abc'\n>>> bytes(m)\nb'abc'\n\nFor non-contiguous arrays the result is equal to the flattened\nlist representation with all elements converted to bytes.\n*note tobytes(): 1f30. supports all format strings, including\nthose that are not in *note struct: cf. module syntax.\n\nNew in version 3.8: 'order' can be {'C', 'F', 'A'}.  When\n'order' is 'C' or 'F', the data of the original array is\nconverted to C or Fortran order.  For contiguous views, 'A'\nreturns an exact copy of the physical memory.  In particular,\nin-memory Fortran order is preserved.  For non-contiguous\nviews, the data is converted to C first.  'order=None' is the\nsame as 'order='C''.\n\n-- Method: hex ([sep[, bytespersep]])\n\nReturn a string object containing two hexadecimal digits for\neach byte in the buffer.\n\n>>> m = memoryview(b\"abc\")\n>>> m.hex()\n'616263'\n\nNew in version 3.5.\n\nChanged in version 3.8: Similar to *note bytes.hex(): bc3,\n*note memoryview.hex(): bc5. now supports optional 'sep' and\n'bytespersep' parameters to insert separators between bytes\nin the hex output.\n\n-- Method: tolist ()\n\nReturn the data in the buffer as a list of elements.\n\n>>> memoryview(b'abc').tolist()\n[97, 98, 99]\n>>> import array\n>>> a = array.array('d', [1.1, 2.2, 3.3])\n>>> m = memoryview(a)\n>>> m.tolist()\n[1.1, 2.2, 3.3]\n\nChanged in version 3.3: *note tolist(): 1f2c. now supports all\nsingle character native formats in *note struct: cf. module\nsyntax as well as multi-dimensional representations.\n\n-- Method: toreadonly ()\n\nReturn a readonly version of the memoryview object.  The\noriginal memoryview object is unchanged.\n\n>>> m = memoryview(bytearray(b'abc'))\n>>> mm = m.toreadonly()\n>>> mm.tolist()\n[97, 98, 99]\n>>> mm[0] = 42\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nTypeError: cannot modify read-only memory\n>>> m[0] = 43\n>>> mm.tolist()\n[43, 98, 99]\n\nNew in version 3.8.\n\n-- Method: release ()\n\nRelease the underlying buffer exposed by the memoryview\nobject.  Many objects take special actions when a view is held\non them (for example, a *note bytearray: 294. would\ntemporarily forbid resizing); therefore, calling release() is\nhandy to remove these restrictions (and free any dangling\nresources) as soon as possible.\n\nAfter this method has been called, any further operation on\nthe view raises a *note ValueError: 183. (except *note\nrelease(): 1032. itself which can be called multiple times):\n\n>>> m = memoryview(b'abc')\n>>> m.release()\n>>> m[0]\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nValueError: operation forbidden on released memoryview object\n\nThe context management protocol can be used for a similar\neffect, using the 'with' statement:\n\n>>> with memoryview(b'abc') as m:\n...     m[0]\n...\n97\n>>> m[0]\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nValueError: operation forbidden on released memoryview object\n\nNew in version 3.2.\n\n-- Method: cast (format[, shape])\n\nCast a memoryview to a new format or shape.  'shape' defaults\nto '[bytelength//newitemsize]', which means that the result\nview will be one-dimensional.  The return value is a new\nmemoryview, but the buffer itself is not copied.  Supported\ncasts are 1D -> C-*note contiguous: 1f33. and C-contiguous ->\n1D.\n\nThe destination format is restricted to a single element\nnative format in *note struct: cf. syntax.  One of the formats\nmust be a byte format ('B', 'b' or 'c').  The byte length of\nthe result must be the same as the original length.  Note that\nall byte lengths may depend on the operating system.\n\nCast 1D/long to 1D/unsigned bytes:\n\n>>> import array\n>>> a = array.array('l', [1,2,3])\n>>> x = memoryview(a)\n>>> x.format\n'l'\n>>> x.itemsize\n8\n>>> len(x)\n3\n>>> x.nbytes\n24\n>>> y = x.cast('B')\n>>> y.format\n'B'\n>>> y.itemsize\n1\n>>> len(y)\n24\n>>> y.nbytes\n24\n\nCast 1D/unsigned bytes to 1D/char:\n\n>>> b = bytearray(b'zyz')\n>>> x = memoryview(b)\n>>> x[0] = b'a'\nTraceback (most recent call last):\n...\nTypeError: memoryview: invalid type for format 'B'\n>>> y = x.cast('c')\n>>> y[0] = b'a'\n>>> b\nbytearray(b'ayz')\n\nCast 1D/bytes to 3D/ints to 1D/signed char:\n\n>>> import struct\n>>> buf = struct.pack(\"i\"*12, *list(range(12)))\n>>> x = memoryview(buf)\n>>> y = x.cast('i', shape=[2,2,3])\n>>> y.tolist()\n[[[0, 1, 2], [3, 4, 5]], [[6, 7, 8], [9, 10, 11]]]\n>>> y.format\n'i'\n>>> y.itemsize\n4\n>>> len(y)\n2\n>>> y.nbytes\n48\n>>> z = y.cast('b')\n>>> z.format\n'b'\n>>> z.itemsize\n1\n>>> len(z)\n48\n>>> z.nbytes\n48\n\nCast 1D/unsigned long to 2D/unsigned long:\n\n>>> buf = struct.pack(\"L\"*6, *list(range(6)))\n>>> x = memoryview(buf)\n>>> y = x.cast('L', shape=[2,3])\n>>> len(y)\n2\n>>> y.nbytes\n48\n>>> y.tolist()\n[[0, 1, 2], [3, 4, 5]]\n\nNew in version 3.3.\n\nChanged in version 3.5: The source format is no longer\nrestricted when casting to a byte view.\n\nThere are also several readonly attributes available:\n\n-- Attribute: obj\n\nThe underlying object of the memoryview:\n\n>>> b  = bytearray(b'xyz')\n>>> m = memoryview(b)\n>>> m.obj is b\nTrue\n\nNew in version 3.3.\n\n-- Attribute: nbytes\n\n'nbytes == product(shape) * itemsize == len(m.tobytes())'.\nThis is the amount of space in bytes that the array would use\nin a contiguous representation.  It is not necessarily equal\nto 'len(m)':\n\n>>> import array\n>>> a = array.array('i', [1,2,3,4,5])\n>>> m = memoryview(a)\n>>> len(m)\n5\n>>> m.nbytes\n20\n>>> y = m[::2]\n>>> len(y)\n3\n>>> y.nbytes\n12\n>>> len(y.tobytes())\n12\n\nMulti-dimensional arrays:\n\n>>> import struct\n>>> buf = struct.pack(\"d\"*12, *[1.5*x for x in range(12)])\n>>> x = memoryview(buf)\n>>> y = x.cast('d', shape=[3,4])\n>>> y.tolist()\n[[0.0, 1.5, 3.0, 4.5], [6.0, 7.5, 9.0, 10.5], [12.0, 13.5, 15.0, 16.5]]\n>>> len(y)\n3\n>>> y.nbytes\n96\n\nNew in version 3.3.\n\n-- Attribute: readonly\n\nA bool indicating whether the memory is read only.\n\n-- Attribute: format\n\nA string containing the format (in *note struct: cf. module\nstyle) for each element in the view.  A memoryview can be\ncreated from exporters with arbitrary format strings, but some\nmethods (e.g.  *note tolist(): 1f2c.) are restricted to native\nsingle element formats.\n\nChanged in version 3.3: format ''B'' is now handled according\nto the struct module syntax.  This means that\n'memoryview(b'abc')[0] == b'abc'[0] == 97'.\n\n-- Attribute: itemsize\n\nThe size in bytes of each element of the memoryview:\n\n>>> import array, struct\n>>> m = memoryview(array.array('H', [32000, 32001, 32002]))\n>>> m.itemsize\n2\n>>> m[0]\n32000\n>>> struct.calcsize('H') == m.itemsize\nTrue\n\n-- Attribute: ndim\n\nAn integer indicating how many dimensions of a\nmulti-dimensional array the memory represents.\n\n-- Attribute: shape\n\nA tuple of integers the length of *note ndim: 1f37. giving the\nshape of the memory as an N-dimensional array.\n\nChanged in version 3.3: An empty tuple instead of 'None' when\nndim = 0.\n\n-- Attribute: strides\n\nA tuple of integers the length of *note ndim: 1f37. giving the\nsize in bytes to access each element for each dimension of the\narray.\n\nChanged in version 3.3: An empty tuple instead of 'None' when\nndim = 0.\n\n-- Attribute: suboffsets\n\nUsed internally for PIL-style arrays.  The value is\ninformational only.\n\n-- Attribute: ccontiguous\n\nA bool indicating whether the memory is C-*note contiguous:\n1f33.\n\nNew in version 3.3.\n\n-- Attribute: fcontiguous\n\nA bool indicating whether the memory is Fortran *note\ncontiguous: 1f33.\n\nNew in version 3.3.\n\n-- Attribute: contiguous\n\nA bool indicating whether the memory is *note contiguous:\n1f33.\n\nNew in version 3.3.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3118/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Set Types -- set frozenset,  Next: Mapping Types -- dict,  Prev: Binary Sequence Types -- bytes bytearray memoryview,  Up: Built-in Types": {
            "content": "A 'set' object is an unordered collection of distinct *note hashable:\n3db. objects.  Common uses include membership testing, removing\nduplicates from a sequence, and computing mathematical operations such\nas intersection, union, difference, and symmetric difference.  (For\nother containers see the built-in *note dict: 237, *note list: 3dc, and\n*note tuple: 4b8. classes, and the *note collections: 1b. module.)\n",
            "subsections": []
        },
        "Like other collections, sets support 'x in set', 'len(set)', and 'for x": {
            "content": "in set'.  Being an unordered collection, sets do not record element\nposition or order of insertion.  Accordingly, sets do not support\nindexing, slicing, or other sequence-like behavior.\n\nThere are currently two built-in set types, *note set: 39d. and *note\nfrozenset: 39e.  The *note set: 39d. type is mutable -- the contents can\nbe changed using methods like 'add()' and 'remove()'.  Since it is\nmutable, it has no hash value and cannot be used as either a dictionary\nkey or as an element of another set.  The *note frozenset: 39e. type is\nimmutable and *note hashable: 3db. -- its contents cannot be altered\nafter it is created; it can therefore be used as a dictionary key or as\nan element of another set.\n",
            "subsections": []
        },
        "Non-empty sets (not frozensets) can be created by placing a": {
            "content": "comma-separated list of elements within braces, for example: '{'jack',\n'sjoerd'}', in addition to the *note set: 39d. constructor.\n\nThe constructors for both classes work the same:\n\n-- Class: set ([iterable])\n-- Class: frozenset ([iterable])\n\nReturn a new set or frozenset object whose elements are taken from\n'iterable'.  The elements of a set must be *note hashable: 3db.  To\nrepresent sets of sets, the inner sets must be *note frozenset:\n39e. objects.  If 'iterable' is not specified, a new empty set is\nreturned.\n\nSets can be created by several means:\n\n* Use a comma-separated list of elements within braces:\n'{'jack', 'sjoerd'}'\n\n* Use a set comprehension: '{c for c in 'abracadabra' if c not\nin 'abc'}'\n\n* Use the type constructor: 'set()', 'set('foobar')', 'set(['a',\n'b', 'foo'])'\n\nInstances of *note set: 39d. and *note frozenset: 39e. provide the\nfollowing operations:\n\n-- Describe: len(s)\n\nReturn the number of elements in set 's' (cardinality of 's').\n\n-- Describe: x in s\n\nTest 'x' for membership in 's'.\n\n-- Describe: x not in s\n\nTest 'x' for non-membership in 's'.\n\n-- Method: isdisjoint (other)\n\nReturn 'True' if the set has no elements in common with\n'other'.  Sets are disjoint if and only if their intersection\nis the empty set.\n\n-- Method: issubset (other)\n\n-- Method: set <= other\n\nTest whether every element in the set is in 'other'.\n\n-- Method: set < other\n\nTest whether the set is a proper subset of 'other', that is,\n'set <= other and set != other'.\n\n-- Method: issuperset (other)\n\n-- Method: set >= other\n\nTest whether every element in 'other' is in the set.\n\n-- Method: set > other\n\nTest whether the set is a proper superset of 'other', that is,\n'set >= other and set != other'.\n\n-- Method: union (*others)\n\n-- Method: set | other | ...\n\nReturn a new set with elements from the set and all others.\n\n-- Method: intersection (*others)\n\n-- Method: set & other & ...\n\nReturn a new set with elements common to the set and all\nothers.\n\n-- Method: difference (*others)\n\n-- Method: set - other - ...\n\nReturn a new set with elements in the set that are not in the\nothers.\n\n-- Method: symmetricdifference (other)\n\n-- Method: set ^ other\n\nReturn a new set with elements in either the set or 'other'\nbut not both.\n\n-- Method: copy ()\n\nReturn a shallow copy of the set.\n\nNote, the non-operator versions of *note union(): 12d7, *note\nintersection(): 12d8, *note difference(): 1f42, *note\nsymmetricdifference(): 1f43, *note issubset(): 1f40, and *note\nissuperset(): 1f41. methods will accept any iterable as an\nargument.  In contrast, their operator based counterparts require\ntheir arguments to be sets.  This precludes error-prone\nconstructions like 'set('abc') & 'cbs'' in favor of the more\nreadable 'set('abc').intersection('cbs')'.\n\nBoth *note set: 39d. and *note frozenset: 39e. support set to set\ncomparisons.  Two sets are equal if and only if every element of\neach set is contained in the other (each is a subset of the other).\nA set is less than another set if and only if the first set is a\nproper subset of the second set (is a subset, but is not equal).  A\nset is greater than another set if and only if the first set is a\nproper superset of the second set (is a superset, but is not\nequal).\n\nInstances of *note set: 39d. are compared to instances of *note\nfrozenset: 39e. based on their members.  For example, 'set('abc')\n== frozenset('abc')' returns 'True' and so does 'set('abc') in\nset([frozenset('abc')])'.\n\nThe subset and equality comparisons do not generalize to a total\nordering function.  For example, any two nonempty disjoint sets are\nnot equal and are not subsets of each other, so 'all' of the\nfollowing return 'False': 'a<b', 'a==b', or 'a>b'.\n\nSince sets only define partial ordering (subset relationships), the\noutput of the *note list.sort(): a13. method is undefined for lists\nof sets.\n\nSet elements, like dictionary keys, must be *note hashable: 3db.\n\nBinary operations that mix *note set: 39d. instances with *note\nfrozenset: 39e. return the type of the first operand.  For example:\n'frozenset('ab') | set('bc')' returns an instance of *note\nfrozenset: 39e.\n\nThe following table lists operations available for *note set: 39d.\nthat do not apply to immutable instances of *note frozenset: 39e.:\n\n-- Method: update (*others)\n\n-- Method: set |= other | ...\n\nUpdate the set, adding elements from all others.\n\n-- Method: intersectionupdate (*others)\n\n-- Method: set &= other & ...\n\nUpdate the set, keeping only elements found in it and all\nothers.\n\n-- Method: differenceupdate (*others)\n\n-- Method: set -= other | ...\n\nUpdate the set, removing elements found in others.\n\n-- Method: symmetricdifferenceupdate (other)\n\n-- Method: set ^= other\n\nUpdate the set, keeping only elements found in either set, but\nnot in both.\n\n-- Method: add (elem)\n\nAdd element 'elem' to the set.\n\n-- Method: remove (elem)\n\nRemove element 'elem' from the set.  Raises *note KeyError:\n8cf. if 'elem' is not contained in the set.\n\n-- Method: discard (elem)\n\nRemove element 'elem' from the set if it is present.\n\n-- Method: pop ()\n\nRemove and return an arbitrary element from the set.  Raises\n*note KeyError: 8cf. if the set is empty.\n\n-- Method: clear ()\n\nRemove all elements from the set.\n\nNote, the non-operator versions of the *note update(): 1f45, *note\nintersectionupdate(): 12d9, *note differenceupdate(): 1f46, and\n*note symmetricdifferenceupdate(): 12da. methods will accept any\niterable as an argument.\n\nNote, the 'elem' argument to the *note contains(): 1c63, *note\nremove(): 1f48, and *note discard(): 1f49. methods may be a set.\nTo support searching for an equivalent frozenset, a temporary one\nis created from 'elem'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Mapping Types -- dict,  Next: Context Manager Types,  Prev: Set Types -- set frozenset,  Up: Built-in Types": {
            "content": "A *note mapping: 1030. object maps *note hashable: 3db. values to\narbitrary objects.  Mappings are mutable objects.  There is currently\nonly one standard mapping type, the 'dictionary'.  (For other containers\nsee the built-in *note list: 3dc, *note set: 39d, and *note tuple: 4b8.\nclasses, and the *note collections: 1b. module.)\n\nA dictionary's keys are 'almost' arbitrary values.  Values that are not\n*note hashable: 3db, that is, values containing lists, dictionaries or\nother mutable types (that are compared by value rather than by object\nidentity) may not be used as keys.  Values that compare equal (such as\n'1', '1.0', and 'True') can be used interchangeably to index the same\ndictionary entry.\n\n-- Class: dict (kwargs)\n\n-- Class: dict (mapping, kwargs)\n\n-- Class: dict (iterable, kwargs)\n\nReturn a new dictionary initialized from an optional positional\nargument and a possibly empty set of keyword arguments.\n\nDictionaries can be created by several means:\n\n* Use a comma-separated list of 'key: value' pairs within\nbraces: '{'jack': 4098, 'sjoerd': 4127}' or '{4098: 'jack',\n4127: 'sjoerd'}'\n\n* Use a dict comprehension: '{}', '{x: x  2 for x in\nrange(10)}'\n\n* Use the type constructor: 'dict()', 'dict([('foo', 100),\n('bar', 200)])', 'dict(foo=100, bar=200)'\n\nIf no positional argument is given, an empty dictionary is created.\nIf a positional argument is given and it is a mapping object, a\ndictionary is created with the same key-value pairs as the mapping\nobject.  Otherwise, the positional argument must be an *note\niterable: 109d. object.  Each item in the iterable must itself be\nan iterable with exactly two objects.  The first object of each\nitem becomes a key in the new dictionary, and the second object the\ncorresponding value.  If a key occurs more than once, the last\nvalue for that key becomes the corresponding value in the new\ndictionary.\n\nIf keyword arguments are given, the keyword arguments and their\nvalues are added to the dictionary created from the positional\nargument.  If a key being added is already present, the value from\nthe keyword argument replaces the value from the positional\nargument.\n\nTo illustrate, the following examples all return a dictionary equal\nto '{\"one\": 1, \"two\": 2, \"three\": 3}':\n\n>>> a = dict(one=1, two=2, three=3)\n>>> b = {'one': 1, 'two': 2, 'three': 3}\n>>> c = dict(zip(['one', 'two', 'three'], [1, 2, 3]))\n>>> d = dict([('two', 2), ('one', 1), ('three', 3)])\n>>> e = dict({'three': 3, 'one': 1, 'two': 2})\n>>> f = dict({'one': 1, 'three': 3}, two=2)\n>>> a == b == c == d == e == f\nTrue\n\nProviding keyword arguments as in the first example only works for\nkeys that are valid Python identifiers.  Otherwise, any valid keys\ncan be used.\n\nThese are the operations that dictionaries support (and therefore,\ncustom mapping types should support too):\n\n-- Describe: list(d)\n\nReturn a list of all the keys used in the dictionary 'd'.\n\n-- Describe: len(d)\n\nReturn the number of items in the dictionary 'd'.\n\n-- Describe: d[key]\n\nReturn the item of 'd' with key 'key'.  Raises a *note\nKeyError: 8cf. if 'key' is not in the map.\n\nIf a subclass of dict defines a method 'missing()' and\n'key' is not present, the 'd[key]' operation calls that method\nwith the key 'key' as argument.  The 'd[key]' operation then\nreturns or raises whatever is returned or raised by the\n'missing(key)' call.  No other operations or methods\ninvoke 'missing()'.  If 'missing()' is not defined,\n*note KeyError: 8cf. is raised.  'missing()' must be a\nmethod; it cannot be an instance variable:\n\n>>> class Counter(dict):\n...     def missing(self, key):\n...         return 0\n...\n>>> c = Counter()\n>>> c['red']\n0\n>>> c['red'] += 1\n>>> c['red']\n1\n\nThe example above shows part of the implementation of *note\ncollections.Counter: f09.  A different 'missing' method is\nused by *note collections.defaultdict: 1031.\n\n-- Describe: d[key] = value\n\nSet 'd[key]' to 'value'.\n\n-- Describe: del d[key]\n\nRemove 'd[key]' from 'd'.  Raises a *note KeyError: 8cf. if\n'key' is not in the map.\n\n-- Describe: key in d\n\nReturn 'True' if 'd' has a key 'key', else 'False'.\n\n-- Describe: key not in d\n\nEquivalent to 'not key in d'.\n\n-- Describe: iter(d)\n\nReturn an iterator over the keys of the dictionary.  This is a\nshortcut for 'iter(d.keys())'.\n\n-- Method: clear ()\n\nRemove all items from the dictionary.\n\n-- Method: copy ()\n\nReturn a shallow copy of the dictionary.\n\n-- Method: classmethod fromkeys (iterable[, value])\n\nCreate a new dictionary with keys from 'iterable' and values\nset to 'value'.\n\n*note fromkeys(): 1f4e. is a class method that returns a new\ndictionary.  'value' defaults to 'None'.  All of the values\nrefer to just a single instance, so it generally doesn't make\nsense for 'value' to be a mutable object such as an empty\nlist.  To get distinct values, use a *note dict comprehension:\nbda. instead.\n\n-- Method: get (key[, default])\n\nReturn the value for 'key' if 'key' is in the dictionary, else\n'default'.  If 'default' is not given, it defaults to 'None',\nso that this method never raises a *note KeyError: 8cf.\n\n-- Method: items ()\n\nReturn a new view of the dictionary's items ('(key, value)'\npairs).  See the *note documentation of view objects: 1f50.\n\n-- Method: keys ()\n\nReturn a new view of the dictionary's keys.  See the *note\ndocumentation of view objects: 1f50.\n\n-- Method: pop (key[, default])\n\nIf 'key' is in the dictionary, remove it and return its value,\nelse return 'default'.  If 'default' is not given and 'key' is\nnot in the dictionary, a *note KeyError: 8cf. is raised.\n\n-- Method: popitem ()\n\nRemove and return a '(key, value)' pair from the dictionary.\nPairs are returned in LIFO (last-in, first-out) order.\n\n*note popitem(): 1381. is useful to destructively iterate over\na dictionary, as often used in set algorithms.  If the\ndictionary is empty, calling *note popitem(): 1381. raises a\n*note KeyError: 8cf.\n\nChanged in version 3.7: LIFO order is now guaranteed.  In\nprior versions, *note popitem(): 1381. would return an\narbitrary key/value pair.\n\n-- Describe: reversed(d)\n\nReturn a reverse iterator over the keys of the dictionary.\nThis is a shortcut for 'reversed(d.keys())'.\n\nNew in version 3.8.\n\n-- Method: setdefault (key[, default])\n\nIf 'key' is in the dictionary, return its value.  If not,\ninsert 'key' with a value of 'default' and return 'default'.\n'default' defaults to 'None'.\n\n-- Method: update ([other])\n\nUpdate the dictionary with the key/value pairs from 'other',\noverwriting existing keys.  Return 'None'.\n\n*note update(): 12ba. accepts either another dictionary object\nor an iterable of key/value pairs (as tuples or other\niterables of length two).  If keyword arguments are specified,\nthe dictionary is then updated with those key/value pairs:\n'd.update(red=1, blue=2)'.\n\n-- Method: values ()\n\nReturn a new view of the dictionary's values.  See the *note\ndocumentation of view objects: 1f50.\n\nAn equality comparison between one 'dict.values()' view and\nanother will always return 'False'.  This also applies when\ncomparing 'dict.values()' to itself:\n\n>>> d = {'a': 1}\n>>> d.values() == d.values()\nFalse\n\n-- Describe: d | other\n\nCreate a new dictionary with the merged keys and values of 'd'\nand 'other', which must both be dictionaries.  The values of\n'other' take priority when 'd' and 'other' share keys.\n\nNew in version 3.9.\n\n-- Describe: d |= other\n\nUpdate the dictionary 'd' with keys and values from 'other',\nwhich may be either a *note mapping: 1030. or an *note\niterable: 109d. of key/value pairs.  The values of 'other'\ntake priority when 'd' and 'other' share keys.\n\nNew in version 3.9.\n\nDictionaries compare equal if and only if they have the same '(key,\nvalue)' pairs (regardless of ordering).  Order comparisons ('<',\n'<=', '>=', '>') raise *note TypeError: 28e.\n\nDictionaries preserve insertion order.  Note that updating a key\ndoes not affect the order.  Keys added after deletion are inserted\nat the end.\n\n>>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n>>> d\n{'one': 1, 'two': 2, 'three': 3, 'four': 4}\n>>> list(d)\n['one', 'two', 'three', 'four']\n>>> list(d.values())\n[1, 2, 3, 4]\n>>> d[\"one\"] = 42\n>>> d\n{'one': 42, 'two': 2, 'three': 3, 'four': 4}\n>>> del d[\"two\"]\n>>> d[\"two\"] = None\n>>> d\n{'one': 42, 'three': 3, 'four': 4, 'two': None}\n\nChanged in version 3.7: Dictionary order is guaranteed to be\ninsertion order.  This behavior was an implementation detail of\nCPython from 3.6.\n\nDictionaries and dictionary views are reversible.\n\n>>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n>>> d\n{'one': 1, 'two': 2, 'three': 3, 'four': 4}\n>>> list(reversed(d))\n['four', 'three', 'two', 'one']\n>>> list(reversed(d.values()))\n[4, 3, 2, 1]\n>>> list(reversed(d.items()))\n[('four', 4), ('three', 3), ('two', 2), ('one', 1)]\n\nChanged in version 3.8: Dictionaries are now reversible.\n\nSee also\n........\n\n*note types.MappingProxyType: 186. can be used to create a read-only\nview of a *note dict: 237.\n\n* Menu:\n\n* Dictionary view objects::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Dictionary view objects,  Up: Mapping Types -- dict": {
            "content": "5.4.11.1 Dictionary view objects\n................................\n\nThe objects returned by *note dict.keys(): 5bf, *note dict.values():\n5c0. and *note dict.items(): 5c1. are 'view objects'.  They provide a\ndynamic view on the dictionary's entries, which means that when the\ndictionary changes, the view reflects these changes.\n",
            "subsections": []
        },
        "Dictionary views can be iterated over to yield their respective data,": {
            "content": "and support membership tests:\n\n-- Describe: len(dictview)\n\nReturn the number of entries in the dictionary.\n\n-- Describe: iter(dictview)\n\nReturn an iterator over the keys, values or items (represented as\ntuples of '(key, value)') in the dictionary.\n\nKeys and values are iterated over in insertion order.  This allows\nthe creation of '(value, key)' pairs using *note zip(): 5c2.:\n'pairs = zip(d.values(), d.keys())'.  Another way to create the\nsame list is 'pairs = [(v, k) for (k, v) in d.items()]'.\n\nIterating views while adding or deleting entries in the dictionary\nmay raise a *note RuntimeError: 17a. or fail to iterate over all\nentries.\n\nChanged in version 3.7: Dictionary order is guaranteed to be\ninsertion order.\n\n-- Describe: x in dictview\n\nReturn 'True' if 'x' is in the underlying dictionary's keys, values\nor items (in the latter case, 'x' should be a '(key, value)'\ntuple).\n\n-- Describe: reversed(dictview)\n\nReturn a reverse iterator over the keys, values or items of the\ndictionary.  The view will be iterated in reverse order of the\ninsertion.\n\nChanged in version 3.8: Dictionary views are now reversible.\n\n-- Describe: dictview.mapping\n\nReturn a *note types.MappingProxyType: 186. that wraps the original\ndictionary to which the view refers.\n\nNew in version 3.10.\n\nKeys views are set-like since their entries are unique and *note\nhashable: 3db.  Items views also have set-like operations since the\n(key, value) pairs are unique and the keys are hashable.  If all values\nin an items view are hashable as well, then the items view can\ninteroperate with other sets.  (Values views are not treated as set-like\nsince the entries are generally not unique.)  For set-like views, all of\nthe operations defined for the abstract base class *note\ncollections.abc.Set: 1f53. are available (for example, '==', '<', or\n'^').  While using set operators, set-like views accept any iterable as\nthe other operand, unlike sets which only accept sets as the input.\n\nAn example of dictionary view usage:\n\n>>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500}\n>>> keys = dishes.keys()\n>>> values = dishes.values()\n\n>>> # iteration\n>>> n = 0\n>>> for val in values:\n...     n += val\n...\n>>> print(n)\n504\n\n>>> # keys and values are iterated over in the same order (insertion order)\n>>> list(keys)\n['eggs', 'sausage', 'bacon', 'spam']\n>>> list(values)\n[2, 1, 1, 500]\n\n>>> # view objects are dynamic and reflect dict changes\n>>> del dishes['eggs']\n>>> del dishes['sausage']\n>>> list(keys)\n['bacon', 'spam']\n\n>>> # set operations\n>>> keys & {'eggs', 'bacon', 'salad'}\n{'bacon'}\n>>> keys ^ {'sausage', 'juice'} == {'juice', 'sausage', 'bacon', 'spam'}\nTrue\n>>> keys | ['juice', 'juice', 'juice'] == {'bacon', 'spam', 'juice'}\nTrue\n\n>>> # get back a read-only proxy for the original dictionary\n>>> values.mapping\nmappingproxy({'bacon': 1, 'spam': 500})\n>>> values.mapping['spam']\n500\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Context Manager Types,  Next: Type Annotation Types -- Generic Alias Union,  Prev: Mapping Types -- dict,  Up: Built-in Types": {
            "content": "Python's *note with: 396. statement supports the concept of a runtime\ncontext defined by a context manager.  This is implemented using a pair\nof methods that allow user-defined classes to define a runtime context\nthat is entered before the statement body is executed and exited when\nthe statement ends:\n\n-- Method: contextmanager.enter ()\n\nEnter the runtime context and return either this object or another\nobject related to the runtime context.  The value returned by this\nmethod is bound to the identifier in the 'as' clause of *note with:\n396. statements using this context manager.\n\nAn example of a context manager that returns itself is a *note file\nobject: 1037.  File objects return themselves from enter() to\nallow *note open(): 26e. to be used as the context expression in a\n*note with: 396. statement.\n\nAn example of a context manager that returns a related object is\nthe one returned by *note decimal.localcontext(): 1562.  These\nmanagers set the active decimal context to a copy of the original\ndecimal context and then return the copy.  This allows changes to\nbe made to the current decimal context in the body of the *note\nwith: 396. statement without affecting code outside the 'with'\nstatement.\n\n-- Method: contextmanager.exit (exctype, excval, exctb)\n\nExit the runtime context and return a Boolean flag indicating if\nany exception that occurred should be suppressed.  If an exception\noccurred while executing the body of the *note with: 396.\nstatement, the arguments contain the exception type, value and\ntraceback information.  Otherwise, all three arguments are 'None'.\n\nReturning a true value from this method will cause the *note with:\n396. statement to suppress the exception and continue execution\nwith the statement immediately following the 'with' statement.\nOtherwise the exception continues propagating after this method has\nfinished executing.  Exceptions that occur during execution of this\nmethod will replace any exception that occurred in the body of the\n'with' statement.\n\nThe exception passed in should never be reraised explicitly -\ninstead, this method should return a false value to indicate that\nthe method completed successfully and does not want to suppress the\nraised exception.  This allows context management code to easily\ndetect whether or not an *note exit(): 1175. method has\nactually failed.\n",
            "subsections": []
        },
        "Python defines several context managers to support easy thread": {
            "content": "synchronisation, prompt closure of files or other objects, and simpler\nmanipulation of the active decimal arithmetic context.  The specific\ntypes are not treated specially beyond their implementation of the\ncontext management protocol.  See the *note contextlib: 21. module for\nsome examples.\n\nPython's *note generator: eda.s and the *note contextlib.contextmanager:\n1076. decorator provide a convenient way to implement these protocols.\nIf a generator function is decorated with the *note\ncontextlib.contextmanager: 1076. decorator, it will return a context\nmanager implementing the necessary *note enter(): 1f55. and *note\nexit(): 1f56. methods, rather than the iterator produced by an\nundecorated generator function.\n",
            "subsections": []
        },
        "Note that there is no specific slot for any of these methods in the type": {
            "content": "structure for Python objects in the Python/C API. Extension types\nwanting to define these methods must provide them as a normal Python\naccessible method.  Compared to the overhead of setting up the runtime\ncontext, the overhead of a single class dictionary lookup is negligible.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Type Annotation Types -- Generic Alias Union,  Next: Other Built-in Types,  Prev: Context Manager Types,  Up: Built-in Types": {
            "content": "The core built-in types for *note type annotations: 168. are *note\nGeneric Alias: 480. and *note Union: 5b5.\n\n* Menu:\n\n* Generic Alias Type::\n* Union Type::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Generic Alias Type,  Next: Union Type,  Up: Type Annotation Types -- Generic Alias Union": {
            "content": "5.4.13.1 Generic Alias Type\n...........................\n\n'GenericAlias' objects are generally created by *note subscripting:\n1c8c. a class.  They are most often used with *note container classes:\n1c92, such as *note list: 3dc. or *note dict: 237.  For example,\n'list[int]' is a 'GenericAlias' object created by subscripting the\n'list' class with the argument *note int: 17e.  'GenericAlias' objects\nare intended primarily for use with *note type annotations: 168.\n\nNote: It is generally only possible to subscript a class if the\nclass implements the special method *note classgetitem(): 520.\n\nA 'GenericAlias' object acts as a proxy for a *note generic type: 13b,\nimplementing 'parameterized generics'.\n\nFor a container class, the argument(s) supplied to a *note subscription:\n1c8c. of the class may indicate the type(s) of the elements an object\ncontains.  For example, 'set[bytes]' can be used in type annotations to\nsignify a *note set: 39d. in which all the elements are of type *note\nbytes: 295.\n\nFor a class which defines *note classgetitem(): 520. but is not a\ncontainer, the argument(s) supplied to a subscription of the class will\noften indicate the return type(s) of one or more methods defined on an\nobject.  For example, *note regular expressions: b4. can be used on both\nthe *note str: 157. data type and the *note bytes: 295. data type:\n\n* If 'x = re.search('foo', 'foo')', 'x' will be a *note re.Match:\ndf7. object where the return values of 'x.group(0)' and 'x[0]' will\nboth be of type *note str: 157.  We can represent this kind of\nobject in type annotations with the 'GenericAlias' 're.Match[str]'.\n\n* If 'y = re.search(b'bar', b'bar')', (note the 'b' for *note bytes:\n295.), 'y' will also be an instance of 're.Match', but the return\nvalues of 'y.group(0)' and 'y[0]' will both be of type *note bytes:\n295.  In type annotations, we would represent this variety of *note\nre.Match: df7. objects with 're.Match[bytes]'.\n\n'GenericAlias' objects are instances of the class *note\ntypes.GenericAlias: 5df, which can also be used to create 'GenericAlias'\nobjects directly.\n\n-- Describe: T[X, Y, ...]\n\nCreates a 'GenericAlias' representing a type 'T' parameterized by\ntypes 'X', 'Y', and more depending on the 'T' used.  For example, a\nfunction expecting a *note list: 3dc. containing *note float: 4b7.\nelements:\n\ndef average(values: list[float]) -> float:\nreturn sum(values) / len(values)\n\nAnother example for *note mapping: 1030. objects, using a *note\ndict: 237, which is a generic type expecting two type parameters\nrepresenting the key type and the value type.  In this example, the\nfunction expects a 'dict' with keys of type *note str: 157. and\nvalues of type *note int: 17e.:\n\ndef sendpostrequest(url: str, body: dict[str, int]) -> None:\n...\n\nThe builtin functions *note isinstance(): 14b. and *note issubclass():\n5b4. do not accept 'GenericAlias' types for their second argument:\n\n>>> isinstance([1, 2], list[str])\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nTypeError: isinstance() argument 2 cannot be a parameterized generic\n\nThe Python runtime does not enforce *note type annotations: 168.  This\nextends to generic types and their type parameters.  When creating a\ncontainer object from a 'GenericAlias', the elements in the container\nare not checked against their type.  For example, the following code is\ndiscouraged, but will run without errors:\n\n>>> t = list[str]\n>>> t([1, 2, 3])\n[1, 2, 3]\n",
            "subsections": []
        },
        "Furthermore, parameterized generics erase type parameters during object": {
            "content": "creation:\n\n>>> t = list[str]\n>>> type(t)\n<class 'types.GenericAlias'>\n\n>>> l = t()\n>>> type(l)\n<class 'list'>\n\nCalling *note repr(): 5f0. or *note str(): 157. on a generic shows the\nparameterized type:\n\n>>> repr(list[int])\n'list[int]'\n\n>>> str(list[int])\n'list[int]'\n\nThe *note getitem(): 4b9. method of generic containers will raise an\nexception to disallow mistakes like 'dict[str][str]':\n\n>>> dict[str][str]\nTraceback (most recent call last):\n...\nTypeError: dict[str] is not a generic class\n\nHowever, such expressions are valid when *note type variables: 1c87. are\nused.  The index must have as many elements as there are type variable\nitems in the 'GenericAlias' object's *note args: 1f59.\n\n>>> from typing import TypeVar\n>>> Y = TypeVar('Y')\n>>> dict[str, Y][int]\ndict[str, int]\n\n* Menu:\n\n* Standard Generic Classes::\n* Special Attributes of GenericAlias objects::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Standard Generic Classes,  Next: Special Attributes of GenericAlias objects,  Up: Generic Alias Type": {
            "content": "5.4.13.2 Standard Generic Classes\n.................................\n\nThe following standard library classes support parameterized generics.\nThis list is non-exhaustive.\n\n* *note tuple: 4b8.\n\n* *note list: 3dc.\n\n* *note dict: 237.\n\n* *note set: 39d.\n\n* *note frozenset: 39e.\n\n* *note type: ba0.\n\n* *note collections.deque: 3a0.\n\n* *note collections.defaultdict: 1031.\n\n* *note collections.OrderedDict: 39f.\n\n* *note collections.Counter: f09.\n\n* *note collections.ChainMap: a62.\n\n* *note collections.abc.Awaitable: c39.\n\n* *note collections.abc.Coroutine: c3a.\n\n* *note collections.abc.AsyncIterable: c3c.\n\n* *note collections.abc.AsyncIterator: c3b.\n\n* *note collections.abc.AsyncGenerator: ad7.\n\n* *note collections.abc.Iterable: 1f5b.\n\n* *note collections.abc.Iterator: 1f5c.\n\n* *note collections.abc.Generator: c38.\n\n* *note collections.abc.Reversible: ad6.\n\n* *note collections.abc.Container: 1f5d.\n\n* *note collections.abc.Collection: ad5.\n\n* *note collections.abc.Callable: 5de.\n\n* *note collections.abc.Set: 1f53.\n\n* *note collections.abc.MutableSet: 1f5e.\n\n* *note collections.abc.Mapping: 6e2.\n\n* *note collections.abc.MutableMapping: f1e.\n\n* *note collections.abc.Sequence: 1038.\n\n* *note collections.abc.MutableSequence: c31.\n\n* *note collections.abc.ByteString: 221.\n\n* *note collections.abc.MappingView: 1f5f.\n\n* *note collections.abc.KeysView: 1f60.\n\n* *note collections.abc.ItemsView: 1f61.\n\n* *note collections.abc.ValuesView: 1f62.\n\n* *note contextlib.AbstractContextManager: ada.\n\n* *note contextlib.AbstractAsyncContextManager: 964.\n\n* *note dataclasses.Field: 1f63.\n\n* *note functools.cachedproperty: 299.\n\n* *note functools.partialmethod: 8a9.\n\n* *note os.PathLike: a9a.\n\n* *note queue.LifoQueue: 1f64.\n\n* *note queue.Queue: 1203.\n\n* *note queue.PriorityQueue: 1f65.\n\n* *note queue.SimpleQueue: 9aa.\n\n* *note re.Pattern: df6.\n\n* *note re.Match: df7.\n\n* *note shelve.BsdDbShelf: 1f66.\n\n* *note shelve.DbfilenameShelf: 1f67.\n\n* *note shelve.Shelf: e0a.\n\n* *note types.MappingProxyType: 186.\n\n* *note weakref.WeakKeyDictionary: 16da.\n\n* *note weakref.WeakMethod: e62.\n\n* *note weakref.WeakSet: 3a1.\n\n* *note weakref.WeakValueDictionary: 16d9.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Special Attributes of GenericAlias objects,  Prev: Standard Generic Classes,  Up: Generic Alias Type": {
            "content": "5.4.13.3 Special Attributes of 'GenericAlias' objects\n.....................................................\n\nAll parameterized generics implement special read-only attributes.\n\n-- Attribute: genericalias.origin\n\nThis attribute points at the non-parameterized generic class:\n\n>>> list[int].origin\n<class 'list'>\n\n-- Attribute: genericalias.args\n\nThis attribute is a *note tuple: 4b8. (possibly of length 1) of\ngeneric types passed to the original *note classgetitem():\n520. of the generic class:\n\n>>> dict[str, list[int]].args\n(<class 'str'>, list[int])\n\n-- Attribute: genericalias.parameters\n\nThis attribute is a lazily computed tuple (possibly empty) of\nunique type variables found in 'args':\n\n>>> from typing import TypeVar\n\n>>> T = TypeVar('T')\n>>> list[T].parameters\n(~T,)\n\nNote: A 'GenericAlias' object with *note typing.ParamSpec:\n163. parameters may not have correct 'parameters' after\nsubstitution because *note typing.ParamSpec: 163. is intended\nprimarily for static type checking.\n\n-- Attribute: genericalias.unpacked\n\nA boolean that is true if the alias has been unpacked using the '*'\noperator (see *note TypeVarTuple: 162.).\n\nNew in version 3.11.\n\nSee also\n........\n\nPEP 484(1) - Type Hints\n\nIntroducing Python's framework for type annotations.\n\nPEP 585(2) - Type Hinting Generics In Standard Collections\n\nIntroducing the ability to natively parameterize standard-library\nclasses, provided they implement the special class method *note\nclassgetitem(): 520.\n\n*note Generics: 1c87, *note user-defined generics: 1f5. and *note typing.Generic: 1453.\n\nDocumentation on how to implement generic classes that can be\nparameterized at runtime and understood by static type-checkers.\n\nNew in version 3.9.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0484/\n\n(2) https://peps.python.org/pep-0585/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Union Type,  Prev: Generic Alias Type,  Up: Type Annotation Types -- Generic Alias Union": {
            "content": "5.4.13.4 Union Type\n...................\n\nA union object holds the value of the '|' (bitwise or) operation on\nmultiple *note type objects: 1e8d.  These types are intended primarily\nfor *note type annotations: 168.  The union type expression enables\ncleaner type hinting syntax compared to *note typing.Union: 408.\n\n-- Describe: X | Y | ...\n\nDefines a union object which holds types 'X', 'Y', and so forth.\n'X | Y' means either X or Y. It is equivalent to 'typing.Union[X,\nY]'.  For example, the following function expects an argument of\ntype *note int: 17e. or *note float: 4b7.:\n\ndef square(number: int | float) -> int | float:\nreturn number  2\n\nNote: The '|' operand cannot be used at runtime to define\nunions where one or more members is a forward reference.  For\nexample, 'int | \"Foo\"', where '\"Foo\"' is a reference to a\nclass not yet defined, will fail at runtime.  For unions which\ninclude forward references, present the whole expression as a\nstring, e.g.  '\"int | Foo\"'.\n\n-- Describe: unionobject == other\n\nUnion objects can be tested for equality with other union objects.\nDetails:\n\n* Unions of unions are flattened:\n\n(int | str) | float == int | str | float\n\n* Redundant types are removed:\n\nint | str | int == int | str\n\n* When comparing unions, the order is ignored:\n\nint | str == str | int\n\n* It is compatible with *note typing.Union: 408.:\n\nint | str == typing.Union[int, str]\n\n* Optional types can be spelled as a union with 'None':\n\nstr | None == typing.Optional[str]\n\n-- Describe: isinstance(obj, unionobject)\n\n-- Describe: issubclass(obj, unionobject)\n\nCalls to *note isinstance(): 14b. and *note issubclass(): 5b4. are\nalso supported with a union object:\n\n>>> isinstance(\"\", int | str)\nTrue\n\nHowever, *note parameterized generics: 480. in union objects cannot\nbe checked:\n\n>>> isinstance(1, int | list[int])  # short-circuit evaluation\nTrue\n>>> isinstance([1], int | list[int])\nTraceback (most recent call last):\n...\nTypeError: isinstance() argument 2 cannot be a parameterized generic\n\nThe user-exposed type for the union object can be accessed from *note\ntypes.UnionType: 407. and used for *note isinstance(): 14b. checks.  An\nobject cannot be instantiated from the type:\n\n>>> import types\n>>> isinstance(int | str, types.UnionType)\nTrue\n>>> types.UnionType()\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nTypeError: cannot create 'types.UnionType' instances\n\nNote: The 'or()' method for type objects was added to support\nthe syntax 'X | Y'.  If a metaclass implements 'or()', the\nUnion may override it:\n\n>>> class M(type):\n...     def or(self, other):\n...         return \"Hello\"\n...\n>>> class C(metaclass=M):\n...     pass\n...\n>>> C | int\n'Hello'\n>>> int | C\nint | C\n\nSee also\n........\n\nPEP 604(1) - PEP proposing the 'X | Y' syntax and the Union type.\n\nNew in version 3.10.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0604/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Other Built-in Types,  Next: Special Attributes,  Prev: Type Annotation Types -- Generic Alias Union,  Up: Built-in Types": {
            "content": "",
            "subsections": []
        },
        "The interpreter supports several other kinds of objects.  Most of these": {
            "content": "support only one or two operations.\n\n* Menu:\n\n* Modules: Modules<4>.\n* Classes and Class Instances::\n* Functions::\n* Methods::\n* Code Objects::\n* Type Objects::\n* The Null Object::\n* The Ellipsis Object::\n* The NotImplemented Object::\n* Internal Objects::\n\nFile: python3.12.info,  Node: Modules<4>,  Next: Classes and Class Instances,  Up: Other Built-in Types\n\n5.4.14.1 Modules\n................\n",
            "subsections": []
        },
        "The only special operation on a module is attribute access: 'm.name',": {
            "content": "where 'm' is a module and 'name' accesses a name defined in 'm''s symbol\ntable.  Module attributes can be assigned to.  (Note that the *note\nimport: 3a6. statement is not, strictly speaking, an operation on a\nmodule object; 'import foo' does not require a module object named 'foo'\nto exist, rather it requires an (external) 'definition' for a module\nnamed 'foo' somewhere.)\n\nA special attribute of every module is *note dict: aa8.  This is the\ndictionary containing the module's symbol table.  Modifying this\ndictionary will actually change the module's symbol table, but direct\nassignment to the *note dict: aa8. attribute is not possible (you\ncan write 'm.dict['a'] = 1', which defines 'm.a' to be '1', but you\ncan't write 'm.dict = {}').  Modifying *note dict: aa8. directly\nis not recommended.\n\nModules built into the interpreter are written like this: '<module 'sys'\n(built-in)>'.  If loaded from a file, they are written as '<module 'os'\nfrom '/usr/local/lib/pythonX.Y/os.pyc'>'.\n\nFile: python3.12.info,  Node: Classes and Class Instances,  Next: Functions,  Prev: Modules<4>,  Up: Other Built-in Types\n\n5.4.14.2 Classes and Class Instances\n....................................\n\nSee *note Objects, values and types: 1c02. and *note Class definitions:\n114c. for these.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Functions,  Next: Methods,  Prev: Classes and Class Instances,  Up: Other Built-in Types": {
            "content": "5.4.14.3 Functions\n..................\n",
            "subsections": []
        },
        "Function objects are created by function definitions.  The only": {
            "content": "operation on a function object is to call it: 'func(argument-list)'.\n",
            "subsections": []
        },
        "There are really two flavors of function objects: built-in functions and": {
            "content": "user-defined functions.  Both support the same operation (to call the\nfunction), but the implementation is different, hence the different\nobject types.\n\nSee *note Function definitions: 19bb. for more information.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Methods,  Next: Code Objects,  Prev: Functions,  Up: Other Built-in Types": {
            "content": "5.4.14.4 Methods\n................\n\nMethods are functions that are called using the attribute notation.\nThere are two flavors: *note built-in methods: 1c2d. (such as 'append()'\non lists) and *note class instance method: 1a41.  Built-in methods are\ndescribed with the types that support them.\n",
            "subsections": []
        },
        "If you access a method (a function defined in a class namespace) through": {
            "content": "an instance, you get a special object: a 'bound method' (also called\n*note instance method: 1a41.) object.  When called, it will add the\n'self' argument to the argument list.  Bound methods have two special\nread-only attributes: *note m.self: 121d. is the object on which the\nmethod operates, and *note m.func: 1171. is the function\nimplementing the method.  Calling 'm(arg-1, arg-2, ..., arg-n)' is\ncompletely equivalent to calling 'm.func(m.self, arg-1, arg-2,\n..., arg-n)'.\n\nLike *note function objects: 1a42, bound method objects support getting\narbitrary attributes.  However, since method attributes are actually\nstored on the underlying function object (*note method.func: 1171.),\nsetting method attributes on bound methods is disallowed.  Attempting to\nset an attribute on a method results in an *note AttributeError: 395.\nbeing raised.  In order to set a method attribute, you need to\nexplicitly set it on the underlying function object:\n\n>>> class C:\n...     def method(self):\n...         pass\n...\n>>> c = C()\n>>> c.method.whoami = 'my name is method'  # can't set on the method\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nAttributeError: 'method' object has no attribute 'whoami'\n>>> c.method.func.whoami = 'my name is method'\n>>> c.method.whoami\n'my name is method'\n\nSee *note Instance methods: 1a41. for more information.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Code Objects,  Next: Type Objects,  Prev: Methods,  Up: Other Built-in Types": {
            "content": "5.4.14.5 Code Objects\n.....................\n",
            "subsections": []
        },
        "Code objects are used by the implementation to represent": {
            "content": "\"pseudo-compiled\" executable Python code such as a function body.  They\ndiffer from function objects because they don't contain a reference to\ntheir global execution environment.  Code objects are returned by the\nbuilt-in *note compile(): 528. function and can be extracted from\nfunction objects through their *note code: 1145. attribute.  See\nalso the *note code: 18. module.\n\nAccessing *note code: 1145. raises an *note auditing event: 161d.\n'object.getattr' with arguments 'obj' and '\"code\"'.\n\nA code object can be executed or evaluated by passing it (instead of a\nsource string) to the *note exec(): 691. or *note eval(): 690. built-in\nfunctions.\n\nSee *note The standard type hierarchy: 1c05. for more information.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Type Objects,  Next: The Null Object,  Prev: Code Objects,  Up: Other Built-in Types": {
            "content": "5.4.14.6 Type Objects\n.....................\n",
            "subsections": []
        },
        "Type objects represent the various object types.  An object's type is": {
            "content": "accessed by the built-in function *note type(): ba0.  There are no\nspecial operations on types.  The standard module *note types: fe.\ndefines names for all standard built-in types.\n\nTypes are written like this: '<class 'int'>'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The Null Object,  Next: The Ellipsis Object,  Prev: Type Objects,  Up: Other Built-in Types": {
            "content": "5.4.14.7 The Null Object\n........................\n",
            "subsections": []
        },
        "This object is returned by functions that don't explicitly return a": {
            "content": "value.  It supports no special operations.  There is exactly one null\nobject, named 'None' (a built-in name).  'type(None)()' produces the\nsame singleton.\n\nIt is written as 'None'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The Ellipsis Object,  Next: The NotImplemented Object,  Prev: The Null Object,  Up: Other Built-in Types": {
            "content": "5.4.14.8 The Ellipsis Object\n............................\n\nThis object is commonly used by slicing (see *note Slicings: 1d59.).  It\nsupports no special operations.  There is exactly one ellipsis object,\nnamed *note Ellipsis: 1e91. (a built-in name).  'type(Ellipsis)()'\nproduces the *note Ellipsis: 1e91. singleton.\n\nIt is written as 'Ellipsis' or '...'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The NotImplemented Object,  Next: Internal Objects,  Prev: The Ellipsis Object,  Up: Other Built-in Types": {
            "content": "5.4.14.9 The NotImplemented Object\n..................................\n",
            "subsections": []
        },
        "This object is returned from comparisons and binary operations when they": {
            "content": "are asked to operate on types they don't support.  See *note\nComparisons: 1d7f. for more information.  There is exactly one *note",
            "subsections": []
        },
        "NotImplemented: 5c5. object.  'type(NotImplemented)()' produces the": {
            "content": "singleton instance.\n\nIt is written as 'NotImplemented'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Internal Objects,  Prev: The NotImplemented Object,  Up: Other Built-in Types": {
            "content": "5.4.14.10 Internal Objects\n..........................\n\nSee *note The standard type hierarchy: 1c05. for this information.  It\ndescribes *note stack frame objects: 4af, *note traceback objects: 92b,\nand slice objects.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Special Attributes,  Next: Integer string conversion length limitation,  Prev: Other Built-in Types,  Up: Built-in Types": {
            "content": "",
            "subsections": []
        },
        "The implementation adds a few special read-only attributes to several": {
            "content": "object types, where they are relevant.  Some of these are not reported\nby the *note dir(): 3ff. built-in function.\n\n-- Attribute: object.dict\n\nA dictionary or other mapping object used to store an object's\n(writable) attributes.\n\n-- Attribute: instance.class\n\nThe class to which a class instance belongs.\n\n-- Attribute: class.bases\n\nThe tuple of base classes of a class object.\n\n-- Attribute: definition.name\n\nThe name of the class, function, method, descriptor, or generator\ninstance.\n\n-- Attribute: definition.qualname\n\nThe *note qualified name: 16a7. of the class, function, method,\ndescriptor, or generator instance.\n\nNew in version 3.3.\n\n-- Attribute: definition.typeparams\n\nThe *note type parameters: 166. of generic classes, functions, and\n*note type aliases: 15f.\n\nNew in version 3.12.\n\n-- Attribute: class.mro\n\nThis attribute is a tuple of classes that are considered when\nlooking for base classes during method resolution.\n\n-- Method: class.mro ()\n\nThis method can be overridden by a metaclass to customize the\nmethod resolution order for its instances.  It is called at class\ninstantiation, and its result is stored in *note mro: 1e8c.\n\n-- Method: class.subclasses ()\n\nEach class keeps a list of weak references to its immediate\nsubclasses.  This method returns a list of all those references\nstill alive.  The list is in definition order.  Example:\n\n>>> int.subclasses()\n[<class 'bool'>, <enum 'IntEnum'>, <flag 'IntFlag'>, <class 're.constants.NamedIntConstant'>]\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Integer string conversion length limitation,  Prev: Special Attributes,  Up: Built-in Types": {
            "content": "CPython has a global limit for converting between *note int: 17e. and\n*note str: 157. to mitigate denial of service attacks.  This limit\n'only' applies to decimal or other non-power-of-two number bases.",
            "subsections": []
        },
        "Hexadecimal, octal, and binary conversions are unlimited.  The limit can": {
            "content": "be configured.\n\nThe *note int: 17e. type in CPython is an arbitrary length number stored\nin binary form (commonly known as a \"bignum\").  There exists no\nalgorithm that can convert a string to a binary integer or a binary\ninteger to a string in linear time, 'unless' the base is a power of 2.",
            "subsections": []
        },
        "Even the best known algorithms for base 10 have sub-quadratic": {
            "content": "complexity.  Converting a large value such as 'int('1' * 500000)' can\ntake over a second on a fast CPU.\n",
            "subsections": []
        },
        "Limiting conversion size offers a practical way to avoid": {
            "content": "CVE-2020-10735(1).\n",
            "subsections": []
        },
        "The limit is applied to the number of digit characters in the input or": {
            "content": "output string when a non-linear conversion algorithm would be involved.\nUnderscores and the sign are not counted towards the limit.\n\nWhen an operation would exceed the limit, a *note ValueError: 183. is\nraised:\n\n>>> import sys\n>>> sys.setintmaxstrdigits(4300)  # Illustrative, this is the default.\n>>>  = int('2' * 5432)\nTraceback (most recent call last):\n...\nValueError: Exceeds the limit (4300 digits) for integer string conversion: value has 5432 digits; use sys.setintmaxstrdigits() to increase the limit\n>>> i = int('2' * 4300)\n>>> len(str(i))\n4300\n>>> isquared = i*i\n>>> len(str(isquared))\nTraceback (most recent call last):\n...\nValueError: Exceeds the limit (4300 digits) for integer string conversion; use sys.setintmaxstrdigits() to increase the limit\n>>> len(hex(isquared))\n7144\n>>> assert int(hex(isquared), base=16) == i*i  # Hexadecimal is unlimited.\n\nThe default limit is 4300 digits as provided in *note\nsys.intinfo.defaultmaxstrdigits: 110c.  The lowest limit that can be\nconfigured is 640 digits as provided in *note\nsys.intinfo.strdigitscheckthreshold: 110c.\n\nVerification:\n\n>>> import sys\n>>> assert sys.intinfo.defaultmaxstrdigits == 4300, sys.intinfo\n>>> assert sys.intinfo.strdigitscheckthreshold == 640, sys.intinfo\n>>> msg = int('578966293710682886880994035146873798396722250538762761564'\n...           '9252925514383915483333812743580549779436104706260696366600'\n...           '571186405732').tobytes(53, 'big')\n...\n\nNew in version 3.11.\n\n* Menu:\n\n* Affected APIs::\n* Configuring the limit::\n* Recommended configuration::\n\n---------- Footnotes ----------\n\n(1) https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-10735\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Affected APIs,  Next: Configuring the limit,  Up: Integer string conversion length limitation": {
            "content": "5.4.16.1 Affected APIs\n......................\n",
            "subsections": []
        },
        "The limitation only applies to potentially slow conversions between": {
            "content": "*note int: 17e. and *note str: 157. or *note bytes: 295.:\n\n* 'int(string)' with default base 10.\n\n* 'int(string, base)' for all bases that are not a power of 2.\n\n* 'str(integer)'.\n\n* 'repr(integer)'.\n\n* any other string conversion to base 10, for example 'f\"{integer}\"',\n'\"{}\".format(integer)', or 'b\"%d\" % integer'.\n\nThe limitations do not apply to functions with a linear algorithm:\n\n* 'int(string, base)' with base 2, 4, 8, 16, or 32.\n\n* *note int.frombytes(): 15b3. and *note int.tobytes(): 15f2.\n\n* *note hex(): 1143, *note oct(): 1142, *note bin(): 1120.\n\n* *note Format Specification Mini-Language: 3a7. for hex, octal, and\nbinary numbers.\n\n* *note str: 157. to *note float: 4b7.\n\n* *note str: 157. to *note decimal.Decimal: 5c3.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Configuring the limit,  Next: Recommended configuration,  Prev: Affected APIs,  Up: Integer string conversion length limitation": {
            "content": "5.4.16.2 Configuring the limit\n..............................\n",
            "subsections": []
        },
        "Before Python starts up you can use an environment variable or an": {
            "content": "interpreter command line flag to configure the limit:\n\n* *note PYTHONINTMAXSTRDIGITS: 1514, e.g.  'PYTHONINTMAXSTRDIGITS=640\npython3' to set the limit to 640 or 'PYTHONINTMAXSTRDIGITS=0\npython3' to disable the limitation.\n\n* *note -X intmaxstrdigits: 188, e.g.  'python3 -X\nintmaxstrdigits=640'\n\n* *note sys.flags.intmaxstrdigits: 1f89. contains the value of\n*note PYTHONINTMAXSTRDIGITS: 1514. or *note -X intmaxstrdigits:\n188.  If both the env var and the '-X' option are set, the '-X'\noption takes precedence.  A value of '-1' indicates that both were\nunset, thus a value of *note sys.intinfo.defaultmaxstrdigits:\n1f8a. was used during initialization.\n",
            "subsections": []
        },
        "From code, you can inspect the current limit and set a new one using": {
            "content": "these *note sys: d3. APIs:\n\n* *note sys.getintmaxstrdigits(): 1f8b. and *note\nsys.setintmaxstrdigits(): 1515. are a getter and setter for the\ninterpreter-wide limit.  Subinterpreters have their own limit.\n\nInformation about the default and minimum can be found in *note\nsys.intinfo: 110c.:\n\n* *note sys.intinfo.defaultmaxstrdigits: 110c. is the compiled-in\ndefault limit.\n\n* *note sys.intinfo.strdigitscheckthreshold: 110c. is the lowest\naccepted value for the limit (other than 0 which disables it).\n\nNew in version 3.11.\n\nCaution: Setting a low limit 'can' lead to problems.  While rare,\ncode exists that contains integer constants in decimal in their\nsource that exceed the minimum threshold.  A consequence of setting\nthe limit is that Python source code containing decimal integer\nliterals longer than the limit will encounter an error during\nparsing, usually at startup time or import time or even at\ninstallation time - anytime an up to date '.pyc' does not already\nexist for the code.  A workaround for source that contains such\nlarge constants is to convert them to '0x' hexadecimal form as it\nhas no limit.\n\nTest your application thoroughly if you use a low limit.  Ensure\nyour tests run with the limit set early via the environment or flag\nso that it applies during startup and even during any installation\nstep that may invoke Python to precompile '.py' sources to '.pyc'\nfiles.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Recommended configuration,  Prev: Configuring the limit,  Up: Integer string conversion length limitation": {
            "content": "5.4.16.3 Recommended configuration\n..................................\n\nThe default *note sys.intinfo.defaultmaxstrdigits: 1f8a. is expected\nto be reasonable for most applications.  If your application requires a\ndifferent limit, set it from your main entry point using Python version\nagnostic code as these APIs were added in security patch releases in\nversions before 3.12.\n\nExample:\n\n>>> import sys\n>>> if hasattr(sys, \"setintmaxstrdigits\"):\n...     upperbound = 68000\n...     lowerbound = 4004\n...     currentlimit = sys.getintmaxstrdigits()\n...     if currentlimit == 0 or currentlimit > upperbound:\n...         sys.setintmaxstrdigits(upperbound)\n...     elif currentlimit < lowerbound:\n...         sys.setintmaxstrdigits(lowerbound)\n\nIf you need to disable it entirely, set it to '0'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Built-in Exceptions,  Next: Text Processing Services,  Prev: Built-in Types,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.5 Built-in Exceptions",
                    "content": ""
                }
            ]
        },
        "In Python, all exceptions must be instances of a class that derives from": {
            "content": "*note BaseException: 37c.  In a *note try: 4bc. statement with an *note\nexcept: 379. clause that mentions a particular class, that clause also\nhandles any exception classes derived from that class (but not exception\nclasses from which 'it' is derived).  Two exception classes that are not\nrelated via subclassing are never equivalent, even if they have the same\nname.\n",
            "subsections": []
        },
        "The built-in exceptions listed in this chapter can be generated by the": {
            "content": "interpreter or built-in functions.  Except where mentioned, they have an\n\"associated value\" indicating the detailed cause of the error.  This may\nbe a string or a tuple of several items of information (e.g., an error\ncode and a string explaining the code).  The associated value is usually\npassed as arguments to the exception class's constructor.\n",
            "subsections": []
        },
        "User code can raise built-in exceptions.  This can be used to test an": {
            "content": "exception handler or to report an error condition \"just like\" the\nsituation in which the interpreter raises the same exception; but beware\nthat there is nothing to prevent user code from raising an inappropriate\nerror.\n",
            "subsections": []
        },
        "The built-in exception classes can be subclassed to define new": {
            "content": "exceptions; programmers are encouraged to derive new exceptions from the\n*note Exception: 7ff. class or one of its subclasses, and not from *note",
            "subsections": []
        },
        "BaseException: 37c.  More information on defining exceptions is": {
            "content": "available in the Python Tutorial under *note User-defined Exceptions:\n1a19.\n\n* Menu:\n\n* Exception context::\n* Inheriting from built-in exceptions::\n* Base classes::\n* Concrete exceptions::\n* Warnings::\n* Exception groups::\n* Exception hierarchy::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Exception context,  Next: Inheriting from built-in exceptions,  Up: Built-in Exceptions": {
            "content": "",
            "subsections": []
        },
        "Three attributes on exception objects provide information about the": {
            "content": "context in which the exception was raised:\n\n-- Attribute: BaseException.context\n-- Attribute: BaseException.cause\n-- Attribute: BaseException.suppresscontext\n\nWhen raising a new exception while another exception is already\nbeing handled, the new exception's 'context' attribute is\nautomatically set to the handled exception.  An exception may be\nhandled when an *note except: 379. or *note finally: 7ee. clause,\nor a *note with: 396. statement, is used.\n\nThis implicit exception context can be supplemented with an\nexplicit cause by using 'from' with *note raise: 3b3.:\n\nraise newexc from originalexc\n\nThe expression following *note from: 3b3. must be an exception or\n'None'.  It will be set as 'cause' on the raised exception.\nSetting 'cause' also implicitly sets the 'suppresscontext'\nattribute to 'True', so that using 'raise newexc from None'\neffectively replaces the old exception with the new one for display\npurposes (e.g.  converting *note KeyError: 8cf. to *note\nAttributeError: 395.), while leaving the old exception available in\n'context' for introspection when debugging.\n\nThe default traceback display code shows these chained exceptions\nin addition to the traceback for the exception itself.  An\nexplicitly chained exception in 'cause' is always shown when\npresent.  An implicitly chained exception in 'context' is shown\nonly if 'cause' is *note None: 43f. and 'suppresscontext'\nis false.\n\nIn either case, the exception itself is always shown after any\nchained exceptions so that the final line of the traceback always\nshows the last exception that was raised.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Inheriting from built-in exceptions,  Next: Base classes,  Prev: Exception context,  Up: Built-in Exceptions": {
            "content": "User code can create subclasses that inherit from an exception type.",
            "subsections": []
        },
        "It's recommended to only subclass one exception type at a time to avoid": {
            "content": "any possible conflicts between how the bases handle the 'args'\nattribute, as well as due to possible memory layout incompatibilities.\n\n'CPython implementation detail:' Most built-in exceptions are\nimplemented in C for efficiency, see: Objects/exceptions.c(1).  Some\nhave custom memory layouts which makes it impossible to create a\nsubclass that inherits from multiple exception types.  The memory layout\nof a type is an implementation detail and might change between Python\nversions, leading to new conflicts in the future.  Therefore, it's\nrecommended to avoid subclassing multiple exception types altogether.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Objects/exceptions.c\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Base classes,  Next: Concrete exceptions,  Prev: Inheriting from built-in exceptions,  Up: Built-in Exceptions": {
            "content": "",
            "subsections": []
        },
        "The following exceptions are used mostly as base classes for other": {
            "content": "exceptions.\n\n-- Exception: BaseException\n\nThe base class for all built-in exceptions.  It is not meant to be\ndirectly inherited by user-defined classes (for that, use *note\nException: 7ff.).  If *note str(): 157. is called on an instance of\nthis class, the representation of the argument(s) to the instance\nare returned, or the empty string when there were no arguments.\n\n-- Attribute: args\n\nThe tuple of arguments given to the exception constructor.\nSome built-in exceptions (like *note OSError: 613.) expect a\ncertain number of arguments and assign a special meaning to\nthe elements of this tuple, while others are usually called\nonly with a single string giving an error message.\n\n-- Method: withtraceback (tb)\n\nThis method sets 'tb' as the new traceback for the exception\nand returns the exception object.  It was more commonly used\nbefore the exception chaining features of PEP 3134(1) became\navailable.  The following example shows how we can convert an\ninstance of 'SomeException' into an instance of\n'OtherException' while preserving the traceback.  Once raised,\nthe current frame is pushed onto the traceback of the\n'OtherException', as would have happened to the traceback of\nthe original 'SomeException' had we allowed it to propagate to\nthe caller.\n\ntry:\n...\nexcept SomeException:\ntb = sys.exception().traceback\nraise OtherException(...).withtraceback(tb)\n\n-- Attribute: traceback\n\nA writable field that holds the *note traceback object: 92b.\nassociated with this exception.  See also: *note The raise\nstatement: 3b3.\n\n-- Method: addnote (note)\n\nAdd the string 'note' to the exception's notes which appear in\nthe standard traceback after the exception string.  A *note\nTypeError: 28e. is raised if 'note' is not a string.\n\nNew in version 3.11.\n\n-- Attribute: notes\n\nA list of the notes of this exception, which were added with\n*note addnote(): 37b.  This attribute is created when *note\naddnote(): 37b. is called.\n\nNew in version 3.11.\n\n-- Exception: Exception\n\nAll built-in, non-system-exiting exceptions are derived from this\nclass.  All user-defined exceptions should also be derived from\nthis class.\n\n-- Exception: ArithmeticError\n\nThe base class for those built-in exceptions that are raised for\nvarious arithmetic errors: *note OverflowError: 68d, *note\nZeroDivisionError: 763, *note FloatingPointError: 1f94.\n\n-- Exception: BufferError\n\nRaised when a *note buffer: 148. related operation cannot be\nperformed.\n\n-- Exception: LookupError\n\nThe base class for the exceptions that are raised when a key or\nindex used on a mapping or sequence is invalid: *note IndexError:\n138f, *note KeyError: 8cf.  This can be raised directly by *note\ncodecs.lookup(): 784.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3134/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Concrete exceptions,  Next: Warnings,  Prev: Base classes,  Up: Built-in Exceptions": {
            "content": "The following exceptions are the exceptions that are usually raised.\n\n-- Exception: AssertionError\n\nRaised when an *note assert: 78a. statement fails.\n\n-- Exception: AttributeError\n\nRaised when an attribute reference (see *note Attribute references:\n1d53.) or assignment fails.  (When an object does not support\nattribute references or attribute assignments at all, *note\nTypeError: 28e. is raised.)\n\nThe 'name' and 'obj' attributes can be set using keyword-only\narguments to the constructor.  When set they represent the name of\nthe attribute that was attempted to be accessed and the object that\nwas accessed for said attribute, respectively.\n\nChanged in version 3.10: Added the 'name' and 'obj' attributes.\n\n-- Exception: EOFError\n\nRaised when the *note input(): 114d. function hits an end-of-file\ncondition (EOF) without reading any data.  (N.B.: the\n'io.IOBase.read()' and *note io.IOBase.readline(): 11a1. methods\nreturn an empty string when they hit EOF.)\n\n-- Exception: FloatingPointError\n\nNot currently used.\n\n-- Exception: GeneratorExit\n\nRaised when a *note generator: eda. or *note coroutine: 1ae. is\nclosed; see *note generator.close(): 1517. and *note\ncoroutine.close(): 1cd4.  It directly inherits from *note\nBaseException: 37c. instead of *note Exception: 7ff. since it is\ntechnically not an error.\n\n-- Exception: ImportError\n\nRaised when the *note import: 3a6. statement has troubles trying to\nload a module.  Also raised when the \"from list\" in 'from ...\nimport' has a name that cannot be found.\n\nThe optional 'name' and 'path' keyword-only arguments set the\ncorresponding attributes:\n\n-- Attribute: name\n\nThe name of the module that was attempted to be imported.\n\n-- Attribute: path\n\nThe path to any file which triggered the exception.\n\nChanged in version 3.3: Added the *note name: 1f96. and *note path:\n1f97. attributes.\n\n-- Exception: ModuleNotFoundError\n\nA subclass of *note ImportError: 145. which is raised by *note\nimport: 3a6. when a module could not be located.  It is also raised\nwhen 'None' is found in *note sys.modules: 16d7.\n\nNew in version 3.6.\n\n-- Exception: IndexError\n\nRaised when a sequence subscript is out of range.  (Slice indices\nare silently truncated to fall in the allowed range; if an index is\nnot an integer, *note TypeError: 28e. is raised.)\n\n-- Exception: KeyError\n\nRaised when a mapping (dictionary) key is not found in the set of\nexisting keys.\n\n-- Exception: KeyboardInterrupt\n\nRaised when the user hits the interrupt key (normally 'Control-C'\nor 'Delete').  During execution, a check for interrupts is made\nregularly.  The exception inherits from *note BaseException: 37c.\nso as to not be accidentally caught by code that catches *note\nException: 7ff. and thus prevent the interpreter from exiting.\n\nNote: Catching a *note KeyboardInterrupt: 7f5. requires\nspecial consideration.  Because it can be raised at\nunpredictable points, it may, in some circumstances, leave the\nrunning program in an inconsistent state.  It is generally\nbest to allow *note KeyboardInterrupt: 7f5. to end the program\nas quickly as possible or avoid raising it entirely.  (See\n*note Note on Signal Handlers and Exceptions: 1f98.)\n\n-- Exception: MemoryError\n\nRaised when an operation runs out of memory but the situation may\nstill be rescued (by deleting some objects).  The associated value\nis a string indicating what kind of (internal) operation ran out of\nmemory.  Note that because of the underlying memory management\narchitecture (C's 'malloc()' function), the interpreter may not\nalways be able to completely recover from this situation; it\nnevertheless raises an exception so that a stack traceback can be\nprinted, in case a run-away program was the cause.\n\n-- Exception: NameError\n\nRaised when a local or global name is not found.  This applies only\nto unqualified names.  The associated value is an error message\nthat includes the name that could not be found.\n\nThe 'name' attribute can be set using a keyword-only argument to\nthe constructor.  When set it represent the name of the variable\nthat was attempted to be accessed.\n\nChanged in version 3.10: Added the 'name' attribute.\n\n-- Exception: NotImplementedError\n\nThis exception is derived from *note RuntimeError: 17a.  In user\ndefined base classes, abstract methods should raise this exception\nwhen they require derived classes to override the method, or while\nthe class is being developed to indicate that the real\nimplementation still needs to be added.\n\nNote: It should not be used to indicate that an operator or\nmethod is not meant to be supported at all - in that case\neither leave the operator / method undefined or, if a\nsubclass, set it to *note None: 43f.\n\nNote: 'NotImplementedError' and *note NotImplemented: 5c5. are\nnot interchangeable, even though they have similar names and\npurposes.  See 'NotImplemented' for details on when to use it.\n\n-- Exception: OSError ([arg])\n\n-- Exception: OSError (errno, strerror[, filename[, winerror[,\nfilename2]]])\n\nThis exception is raised when a system function returns a\nsystem-related error, including I/O failures such as \"file not\nfound\" or \"disk full\" (not for illegal argument types or other\nincidental errors).\n\nThe second form of the constructor sets the corresponding\nattributes, described below.  The attributes default to *note None:\n43f. if not specified.  For backwards compatibility, if three\narguments are passed, the *note args: 2cb. attribute contains only\na 2-tuple of the first two constructor arguments.\n\nThe constructor often actually returns a subclass of *note OSError:\n613, as described in *note OS exceptions: 1f99. below.  The\nparticular subclass depends on the final *note errno: 1f9a. value.\nThis behaviour only occurs when constructing *note OSError: 613.\ndirectly or via an alias, and is not inherited when subclassing.\n\n-- Attribute: errno\n\nA numeric error code from the C variable 'errno'.\n\n-- Attribute: winerror\n\nUnder Windows, this gives you the native Windows error code.\nThe *note errno: 1f9a. attribute is then an approximate\ntranslation, in POSIX terms, of that native error code.\n\nUnder Windows, if the 'winerror' constructor argument is an\ninteger, the *note errno: 1f9a. attribute is determined from\nthe Windows error code, and the 'errno' argument is ignored.\nOn other platforms, the 'winerror' argument is ignored, and\nthe *note winerror: 1f9b. attribute does not exist.\n\n-- Attribute: strerror\n\nThe corresponding error message, as provided by the operating\nsystem.  It is formatted by the C functions 'perror()' under\nPOSIX, and 'FormatMessage()' under Windows.\n\n-- Attribute: filename\n-- Attribute: filename2\n\nFor exceptions that involve a file system path (such as *note\nopen(): 26e. or *note os.unlink(): f66.), *note filename:\n1f9d. is the file name passed to the function.  For functions\nthat involve two file system paths (such as *note os.rename():\nf62.), *note filename2: 1f9e. corresponds to the second file\nname passed to the function.\n\nChanged in version 3.3: *note EnvironmentError: ecc, *note IOError:\necb, *note WindowsError: ecd, *note socket.error: ece, *note\nselect.error: ecf. and 'mmap.error' have been merged into *note\nOSError: 613, and the constructor may return a subclass.\n\nChanged in version 3.4: The *note filename: 1f9d. attribute is now\nthe original file name passed to the function, instead of the name\nencoded to or decoded from the *note filesystem encoding and error\nhandler: 291.  Also, the 'filename2' constructor argument and\nattribute was added.\n\n-- Exception: OverflowError\n\nRaised when the result of an arithmetic operation is too large to\nbe represented.  This cannot occur for integers (which would rather\nraise *note MemoryError: 13e3. than give up).  However, for\nhistorical reasons, OverflowError is sometimes raised for integers\nthat are outside a required range.  Because of the lack of\nstandardization of floating point exception handling in C, most\nfloating point operations are not checked.\n\n-- Exception: RecursionError\n\nThis exception is derived from *note RuntimeError: 17a.  It is\nraised when the interpreter detects that the maximum recursion\ndepth (see *note sys.getrecursionlimit(): 1e8.) is exceeded.\n\nNew in version 3.5: Previously, a plain *note RuntimeError: 17a.\nwas raised.\n\n-- Exception: ReferenceError\n\nThis exception is raised when a weak reference proxy, created by\nthe *note weakref.proxy(): 87e. function, is used to access an\nattribute of the referent after it has been garbage collected.  For\nmore information on weak references, see the *note weakref: 10f.\nmodule.\n\n-- Exception: RuntimeError\n\nRaised when an error is detected that doesn't fall in any of the\nother categories.  The associated value is a string indicating what\nprecisely went wrong.\n\n-- Exception: StopIteration\n\nRaised by built-in function *note next(): 5cb. and an *note\niterator: 16a9.'s *note next(): 1141. method to signal that\nthere are no further items produced by the iterator.\n\n-- Attribute: value\n\nThe exception object has a single attribute 'value', which is\ngiven as an argument when constructing the exception, and\ndefaults to *note None: 43f.\n\nWhen a *note generator: eda. or *note coroutine: 1ae. function\nreturns, a new *note StopIteration: a40. instance is raised, and\nthe value returned by the function is used as the *note value:\n1cd0. parameter to the constructor of the exception.\n\nIf a generator code directly or indirectly raises *note\nStopIteration: a40, it is converted into a *note RuntimeError: 17a.\n(retaining the *note StopIteration: a40. as the new exception's\ncause).\n\nChanged in version 3.3: Added 'value' attribute and the ability for\ngenerator functions to use it to return a value.\n\nChanged in version 3.5: Introduced the RuntimeError transformation\nvia 'from future import generatorstop', see PEP 479(1).\n\nChanged in version 3.7: Enable PEP 479(2) for all code by default:\na *note StopIteration: a40. error raised in a generator is\ntransformed into a *note RuntimeError: 17a.\n\n-- Exception: StopAsyncIteration\n\nMust be raised by *note anext(): 1c2a. method of an *note\nasynchronous iterator: bd4. object to stop the iteration.\n\nNew in version 3.5.\n\n-- Exception: SyntaxError (message, details)\n\nRaised when the parser encounters a syntax error.  This may occur\nin an *note import: 3a6. statement, in a call to the built-in\nfunctions *note compile(): 528, *note exec(): 691, or *note eval():\n690, or when reading the initial script or standard input (also\ninteractively).\n\nThe *note str(): 157. of the exception instance returns only the\nerror message.  Details is a tuple whose members are also available\nas separate attributes.\n\n-- Attribute: filename\n\nThe name of the file the syntax error occurred in.\n\n-- Attribute: lineno\n\nWhich line number in the file the error occurred in.  This is\n1-indexed: the first line in the file has a 'lineno' of 1.\n\n-- Attribute: offset\n\nThe column in the line where the error occurred.  This is\n1-indexed: the first character in the line has an 'offset' of\n1.\n\n-- Attribute: text\n\nThe source code text involved in the error.\n\n-- Attribute: endlineno\n\nWhich line number in the file the error occurred ends in.\nThis is 1-indexed: the first line in the file has a 'lineno'\nof 1.\n\n-- Attribute: endoffset\n\nThe column in the end line where the error occurred finishes.\nThis is 1-indexed: the first character in the line has an\n'offset' of 1.\n\nFor errors in f-string fields, the message is prefixed by\n\"f-string: \" and the offsets are offsets in a text constructed from\nthe replacement expression.  For example, compiling f'Bad {a b}\nfield' results in this args attribute: ('f-string: ...', ('', 1, 2,\n'(a b)n', 1, 5)).\n\nChanged in version 3.10: Added the *note endlineno: 1fa3. and\n*note endoffset: 1fa4. attributes.\n\n-- Exception: IndentationError\n\nBase class for syntax errors related to incorrect indentation.\nThis is a subclass of *note SyntaxError: 146.\n\n-- Exception: TabError\n\nRaised when indentation contains an inconsistent use of tabs and\nspaces.  This is a subclass of *note IndentationError: 59a.\n\n-- Exception: SystemError\n\nRaised when the interpreter finds an internal error, but the\nsituation does not look so serious to cause it to abandon all hope.\nThe associated value is a string indicating what went wrong (in\nlow-level terms).\n\nYou should report this to the author or maintainer of your Python\ninterpreter.  Be sure to report the version of the Python\ninterpreter ('sys.version'; it is also printed at the start of an\ninteractive Python session), the exact error message (the\nexception's associated value) and if possible the source of the\nprogram that triggered the error.\n\n-- Exception: SystemExit\n\nThis exception is raised by the *note sys.exit(): 11c2. function.\nIt inherits from *note BaseException: 37c. instead of *note\nException: 7ff. so that it is not accidentally caught by code that\ncatches *note Exception: 7ff.  This allows the exception to\nproperly propagate up and cause the interpreter to exit.  When it\nis not handled, the Python interpreter exits; no stack traceback is\nprinted.  The constructor accepts the same optional argument passed\nto *note sys.exit(): 11c2.  If the value is an integer, it\nspecifies the system exit status (passed to C's 'exit()' function);\nif it is 'None', the exit status is zero; if it has another type\n(such as a string), the object's value is printed and the exit\nstatus is one.\n\nA call to *note sys.exit(): 11c2. is translated into an exception\nso that clean-up handlers (*note finally: 7ee. clauses of *note\ntry: 4bc. statements) can be executed, and so that a debugger can\nexecute a script without running the risk of losing control.  The\n*note os.exit(): 1fa5. function can be used if it is absolutely\npositively necessary to exit immediately (for example, in the child\nprocess after a call to *note os.fork(): 231.).\n\n-- Attribute: code\n\nThe exit status or error message that is passed to the\nconstructor.  (Defaults to 'None'.)\n\n-- Exception: TypeError\n\nRaised when an operation or function is applied to an object of\ninappropriate type.  The associated value is a string giving\ndetails about the type mismatch.\n\nThis exception may be raised by user code to indicate that an\nattempted operation on an object is not supported, and is not meant\nto be.  If an object is meant to support a given operation but has\nnot yet provided an implementation, *note NotImplementedError: ba5.\nis the proper exception to raise.\n\nPassing arguments of the wrong type (e.g.  passing a *note list:\n3dc. when an *note int: 17e. is expected) should result in a *note\nTypeError: 28e, but passing arguments with the wrong value (e.g.  a\nnumber outside expected boundaries) should result in a *note\nValueError: 183.\n\n-- Exception: UnboundLocalError\n\nRaised when a reference is made to a local variable in a function\nor method, but no value has been bound to that variable.  This is a\nsubclass of *note NameError: 144.\n\n-- Exception: UnicodeError\n\nRaised when a Unicode-related encoding or decoding error occurs.\nIt is a subclass of *note ValueError: 183.\n\n*note UnicodeError: 111b. has attributes that describe the encoding\nor decoding error.  For example, 'err.object[err.start:err.end]'\ngives the particular invalid input that the codec failed on.\n\n-- Attribute: encoding\n\nThe name of the encoding that raised the error.\n\n-- Attribute: reason\n\nA string describing the specific codec error.\n\n-- Attribute: object\n\nThe object the codec was attempting to encode or decode.\n\n-- Attribute: start\n\nThe first index of invalid data in *note object: 8bb.\n\n-- Attribute: end\n\nThe index after the last invalid data in *note object: 8bb.\n\n-- Exception: UnicodeEncodeError\n\nRaised when a Unicode-related error occurs during encoding.  It is\na subclass of *note UnicodeError: 111b.\n\n-- Exception: UnicodeDecodeError\n\nRaised when a Unicode-related error occurs during decoding.  It is\na subclass of *note UnicodeError: 111b.\n\n-- Exception: UnicodeTranslateError\n\nRaised when a Unicode-related error occurs during translating.  It\nis a subclass of *note UnicodeError: 111b.\n\n-- Exception: ValueError\n\nRaised when an operation or function receives an argument that has\nthe right type but an inappropriate value, and the situation is not\ndescribed by a more precise exception such as *note IndexError:\n138f.\n\n-- Exception: ZeroDivisionError\n\nRaised when the second argument of a division or modulo operation\nis zero.  The associated value is a string indicating the type of\nthe operands and the operation.\n",
            "subsections": []
        },
        "The following exceptions are kept for compatibility with previous": {
            "content": "versions; starting from Python 3.3, they are aliases of *note OSError:\n613.\n\n-- Exception: EnvironmentError\n\n-- Exception: IOError\n\n-- Exception: WindowsError\n\nOnly available on Windows.\n\n* Menu:\n\n* OS exceptions::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0479/\n\n(2) https://peps.python.org/pep-0479/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: OS exceptions,  Up: Concrete exceptions": {
            "content": "5.5.4.1 OS exceptions\n.....................\n\nThe following exceptions are subclasses of *note OSError: 613, they get\nraised depending on the system error code.\n\n-- Exception: BlockingIOError\n\nRaised when an operation would block on an object (e.g.  socket)\nset for non-blocking operation.  Corresponds to 'errno' *note\nEAGAIN: 1fad, *note EALREADY: 1fae, *note EWOULDBLOCK: 1faf. and\n*note EINPROGRESS: 1fb0.\n\nIn addition to those of *note OSError: 613, *note BlockingIOError:\ned0. can have one more attribute:\n\n-- Attribute: characterswritten\n\nAn integer containing the number of characters written to the\nstream before it blocked.  This attribute is available when\nusing the buffered I/O classes from the *note io: 79. module.\n\n-- Exception: ChildProcessError\n\nRaised when an operation on a child process failed.  Corresponds to\n'errno' *note ECHILD: 1fb2.\n\n-- Exception: ConnectionError\n\nA base class for connection-related issues.\n\nSubclasses are *note BrokenPipeError: ed5, *note\nConnectionAbortedError: ed6, *note ConnectionRefusedError: ed7. and\n*note ConnectionResetError: ed8.\n\n-- Exception: BrokenPipeError\n\nA subclass of *note ConnectionError: c67, raised when trying to\nwrite on a pipe while the other end has been closed, or trying to\nwrite on a socket which has been shutdown for writing.  Corresponds\nto 'errno' *note EPIPE: 1fb3. and *note ESHUTDOWN: 1fb4.\n\n-- Exception: ConnectionAbortedError\n\nA subclass of *note ConnectionError: c67, raised when a connection\nattempt is aborted by the peer.  Corresponds to 'errno' *note\nECONNABORTED: 1fb5.\n\n-- Exception: ConnectionRefusedError\n\nA subclass of *note ConnectionError: c67, raised when a connection\nattempt is refused by the peer.  Corresponds to 'errno' *note\nECONNREFUSED: 1fb6.\n\n-- Exception: ConnectionResetError\n\nA subclass of *note ConnectionError: c67, raised when a connection\nis reset by the peer.  Corresponds to 'errno' *note ECONNRESET:\n1fb7.\n\n-- Exception: FileExistsError\n\nRaised when trying to create a file or directory which already\nexists.  Corresponds to 'errno' *note EEXIST: 1fb8.\n\n-- Exception: FileNotFoundError\n\nRaised when a file or directory is requested but doesn't exist.\nCorresponds to 'errno' *note ENOENT: 1fb9.\n\n-- Exception: InterruptedError\n\nRaised when a system call is interrupted by an incoming signal.\nCorresponds to 'errno' *note EINTR: be2.\n\nChanged in version 3.5: Python now retries system calls when a\nsyscall is interrupted by a signal, except if the signal handler\nraises an exception (see PEP 475(1) for the rationale), instead of\nraising *note InterruptedError: be3.\n\n-- Exception: IsADirectoryError\n\nRaised when a file operation (such as *note os.remove(): f61.) is\nrequested on a directory.  Corresponds to 'errno' *note EISDIR:\n1fba.\n\n-- Exception: NotADirectoryError\n\nRaised when a directory operation (such as *note os.listdir():\nf6a.) is requested on something which is not a directory.  On most\nPOSIX platforms, it may also be raised if an operation attempts to\nopen or traverse a non-directory file as if it were a directory.\nCorresponds to 'errno' *note ENOTDIR: 1fbb.\n\n-- Exception: PermissionError\n\nRaised when trying to run an operation without the adequate access\nrights - for example filesystem permissions.  Corresponds to\n'errno' *note EACCES: 1fbc, *note EPERM: 1527, and *note\nENOTCAPABLE: 1516.\n\nChanged in version 3.11.1: WASI's *note ENOTCAPABLE: 1516. is now\nmapped to *note PermissionError: b9a.\n\n-- Exception: ProcessLookupError\n\nRaised when a given process doesn't exist.  Corresponds to 'errno'\n*note ESRCH: 1fbd.\n\n-- Exception: TimeoutError\n\nRaised when a system function timed out at the system level.\nCorresponds to 'errno' *note ETIMEDOUT: 1fbe.\n\nNew in version 3.3: All the above *note OSError: 613. subclasses were\nadded.\n\nSee also\n........\n\nPEP 3151(2) - Reworking the OS and IO exception hierarchy\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0475/\n\n(2) https://peps.python.org/pep-3151/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Warnings,  Next: Exception groups,  Prev: Concrete exceptions,  Up: Built-in Exceptions": {
            "content": "The following exceptions are used as warning categories; see the *note\nWarning Categories: 1fc1. documentation for more details.\n\n-- Exception: Warning\n\nBase class for warning categories.\n\n-- Exception: UserWarning\n\nBase class for warnings generated by user code.\n\n-- Exception: DeprecationWarning\n\nBase class for warnings about deprecated features when those\nwarnings are intended for other Python developers.\n\nIgnored by the default warning filters, except in the 'main'\nmodule ( PEP 565(1)).  Enabling the *note Python Development Mode:\n6e3. shows this warning.\n\nThe deprecation policy is described in PEP 387(2).\n\n-- Exception: PendingDeprecationWarning\n\nBase class for warnings about features which are obsolete and\nexpected to be deprecated in the future, but are not deprecated at\nthe moment.\n\nThis class is rarely used as emitting a warning about a possible\nupcoming deprecation is unusual, and *note DeprecationWarning: 179.\nis preferred for already active deprecations.\n\nIgnored by the default warning filters.  Enabling the *note Python\nDevelopment Mode: 6e3. shows this warning.\n\nThe deprecation policy is described in PEP 387(3).\n\n-- Exception: SyntaxWarning\n\nBase class for warnings about dubious syntax.\n\n-- Exception: RuntimeWarning\n\nBase class for warnings about dubious runtime behavior.\n\n-- Exception: FutureWarning\n\nBase class for warnings about deprecated features when those\nwarnings are intended for end users of applications that are\nwritten in Python.\n\n-- Exception: ImportWarning\n\nBase class for warnings about probable mistakes in module imports.\n\nIgnored by the default warning filters.  Enabling the *note Python\nDevelopment Mode: 6e3. shows this warning.\n\n-- Exception: UnicodeWarning\n\nBase class for warnings related to Unicode.\n\n-- Exception: EncodingWarning\n\nBase class for warnings related to encodings.\n\nSee *note Opt-in EncodingWarning: 1ad4. for details.\n\nNew in version 3.10.\n\n-- Exception: BytesWarning\n\nBase class for warnings related to *note bytes: 295. and *note\nbytearray: 294.\n\n-- Exception: ResourceWarning\n\nBase class for warnings related to resource usage.\n\nIgnored by the default warning filters.  Enabling the *note Python\nDevelopment Mode: 6e3. shows this warning.\n\nNew in version 3.2.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0565/\n\n(2) https://peps.python.org/pep-0387/\n\n(3) https://peps.python.org/pep-0387/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Exception groups,  Next: Exception hierarchy,  Prev: Warnings,  Up: Built-in Exceptions": {
            "content": "",
            "subsections": []
        },
        "The following are used when it is necessary to raise multiple unrelated": {
            "content": "exceptions.  They are part of the exception hierarchy so they can be\nhandled with *note except: 379. like all other exceptions.  In addition,\nthey are recognised by *note except*: 378, which matches their subgroups\nbased on the types of the contained exceptions.\n\n-- Exception: ExceptionGroup (msg, excs)\n\n-- Exception: BaseExceptionGroup (msg, excs)\n\nBoth of these exception types wrap the exceptions in the sequence\n'excs'.  The 'msg' parameter must be a string.  The difference\nbetween the two classes is that *note BaseExceptionGroup: 377.\nextends *note BaseException: 37c. and it can wrap any exception,\nwhile *note ExceptionGroup: 17b. extends *note Exception: 7ff. and\nit can only wrap subclasses of *note Exception: 7ff.  This design\nis so that 'except Exception' catches an *note ExceptionGroup: 17b.\nbut not *note BaseExceptionGroup: 377.\n\nThe *note BaseExceptionGroup: 377. constructor returns an *note\nExceptionGroup: 17b. rather than a *note BaseExceptionGroup: 377.\nif all contained exceptions are *note Exception: 7ff. instances, so\nit can be used to make the selection automatic.  The *note\nExceptionGroup: 17b. constructor, on the other hand, raises a *note\nTypeError: 28e. if any contained exception is not an *note\nException: 7ff. subclass.\n\n-- Attribute: message\n\nThe 'msg' argument to the constructor.  This is a read-only\nattribute.\n\n-- Attribute: exceptions\n\nA tuple of the exceptions in the 'excs' sequence given to the\nconstructor.  This is a read-only attribute.\n\n-- Method: subgroup (condition)\n\nReturns an exception group that contains only the exceptions\nfrom the current group that match 'condition', or 'None' if\nthe result is empty.\n\nThe condition can be either a function that accepts an\nexception and returns true for those that should be in the\nsubgroup, or it can be an exception type or a tuple of\nexception types, which is used to check for a match using the\nsame check that is used in an 'except' clause.\n\nThe nesting structure of the current exception is preserved in\nthe result, as are the values of its *note message: 1fc6,\n*note traceback: 113c, *note cause: 113e, *note\ncontext: 113d. and *note notes: 1f92. fields.  Empty\nnested groups are omitted from the result.\n\nThe condition is checked for all exceptions in the nested\nexception group, including the top-level and any nested\nexception groups.  If the condition is true for such an\nexception group, it is included in the result in full.\n\n-- Method: split (condition)\n\nLike *note subgroup(): 1fc8, but returns the pair '(match,\nrest)' where 'match' is 'subgroup(condition)' and 'rest' is\nthe remaining non-matching part.\n\n-- Method: derive (excs)\n\nReturns an exception group with the same *note message: 1fc6,\nbut which wraps the exceptions in 'excs'.\n\nThis method is used by *note subgroup(): 1fc8. and *note\nsplit(): 1fc9.  A subclass needs to override it in order to\nmake *note subgroup(): 1fc8. and *note split(): 1fc9. return\ninstances of the subclass rather than *note ExceptionGroup:\n17b.\n\n*note subgroup(): 1fc8. and *note split(): 1fc9. copy the\n*note traceback: 113c, *note cause: 113e, *note\ncontext: 113d. and *note notes: 1f92. fields from the\noriginal exception group to the one returned by *note\nderive(): 1fca, so these fields do not need to be updated by\n*note derive(): 1fca.\n\n>>> class MyGroup(ExceptionGroup):\n...     def derive(self, excs):\n...         return MyGroup(self.message, excs)\n...\n>>> e = MyGroup(\"eg\", [ValueError(1), TypeError(2)])\n>>> e.addnote(\"a note\")\n>>> e.context = Exception(\"context\")\n>>> e.cause = Exception(\"cause\")\n>>> try:\n...    raise e\n... except Exception as e:\n...    exc = e\n...\n>>> match, rest = exc.split(ValueError)\n>>> exc, exc.context, exc.cause, exc.notes\n(MyGroup('eg', [ValueError(1), TypeError(2)]), Exception('context'), Exception('cause'), ['a note'])\n>>> match, match.context, match.cause, match.notes\n(MyGroup('eg', [ValueError(1)]), Exception('context'), Exception('cause'), ['a note'])\n>>> rest, rest.context, rest.cause, rest.notes\n(MyGroup('eg', [TypeError(2)]), Exception('context'), Exception('cause'), ['a note'])\n>>> exc.traceback is match.traceback is rest.traceback\nTrue\n\nNote that *note BaseExceptionGroup: 377. defines *note new():\n2e2, so subclasses that need a different constructor signature need\nto override that rather than *note init(): 47d.  For example,\nthe following defines an exception group subclass which accepts an\nexitcode and and constructs the group's message from it.\n\nclass Errors(ExceptionGroup):\ndef new(cls, errors, exitcode):\nself = super().new(Errors, f\"exit code: {exitcode}\", errors)\nself.exitcode = exitcode\nreturn self\n\ndef derive(self, excs):\nreturn Errors(excs, self.exitcode)\n\nLike *note ExceptionGroup: 17b, any subclass of *note\nBaseExceptionGroup: 377. which is also a subclass of *note\nException: 7ff. can only wrap instances of *note Exception: 7ff.\n\nNew in version 3.11.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Exception hierarchy,  Prev: Exception groups,  Up: Built-in Exceptions": {
            "content": "The class hierarchy for built-in exceptions is:\n\nBaseException\n????????? BaseExceptionGroup\n????????? GeneratorExit\n????????? KeyboardInterrupt\n????????? SystemExit\n????????? Exception\n????????? ArithmeticError\n???    ????????? FloatingPointError\n???    ????????? OverflowError\n???    ????????? ZeroDivisionError\n????????? AssertionError\n????????? AttributeError\n????????? BufferError\n????????? EOFError\n????????? ExceptionGroup [BaseExceptionGroup]\n????????? ImportError\n???    ????????? ModuleNotFoundError\n????????? LookupError\n???    ????????? IndexError\n???    ????????? KeyError\n????????? MemoryError\n????????? NameError\n???    ????????? UnboundLocalError\n????????? OSError\n???    ????????? BlockingIOError\n???    ????????? ChildProcessError\n???    ????????? ConnectionError\n???    ???    ????????? BrokenPipeError\n???    ???    ????????? ConnectionAbortedError\n???    ???    ????????? ConnectionRefusedError\n???    ???    ????????? ConnectionResetError\n???    ????????? FileExistsError\n???    ????????? FileNotFoundError\n???    ????????? InterruptedError\n???    ????????? IsADirectoryError\n???    ????????? NotADirectoryError\n???    ????????? PermissionError\n???    ????????? ProcessLookupError\n???    ????????? TimeoutError\n????????? ReferenceError\n????????? RuntimeError\n???    ????????? NotImplementedError\n???    ????????? RecursionError\n????????? StopAsyncIteration\n????????? StopIteration\n????????? SyntaxError\n???    ????????? IndentationError\n???         ????????? TabError\n????????? SystemError\n????????? TypeError\n????????? ValueError\n???    ????????? UnicodeError\n???         ????????? UnicodeDecodeError\n???         ????????? UnicodeEncodeError\n???         ????????? UnicodeTranslateError\n????????? Warning\n????????? BytesWarning\n????????? DeprecationWarning\n????????? EncodingWarning\n????????? FutureWarning\n????????? ImportWarning\n????????? PendingDeprecationWarning\n????????? ResourceWarning\n????????? RuntimeWarning\n????????? SyntaxWarning\n????????? UnicodeWarning\n????????? UserWarning\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Text Processing Services,  Next: Binary Data Services,  Prev: Built-in Exceptions,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.6 Text Processing Services",
                    "content": ""
                }
            ]
        },
        "The modules described in this chapter provide a wide range of string": {
            "content": "manipulation operations and other text processing services.\n\nThe *note codecs: 19. module described under *note Binary Data Services:\n1fce. is also highly relevant to text processing.  In addition, see the\ndocumentation for Python's built-in string type in *note Text Sequence\nType -- str: 1983.\n\n* Menu:\n\n* string -- Common string operations::\n* re -- Regular expression operations::\n* difflib -- Helpers for computing deltas::\n* textwrap -- Text wrapping and filling::\n* unicodedata -- Unicode Database::\n* stringprep -- Internet String Preparation::\n* readline -- GNU readline interface::\n* rlcompleter -- Completion function for GNU readline::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: string -- Common string operations,  Next: re -- Regular expression operations,  Up: Text Processing Services": {
            "content": "'Source code:' Lib/string.py(1)\n\n\n\nSee also\n........\n\n*note Text Sequence Type -- str: 1983.\n\n*note String Methods: 1984.\n\n* Menu:\n\n* String constants::\n* Custom String Formatting::\n* Format String Syntax::\n* Template strings::\n* Helper functions::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/string.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: String constants,  Next: Custom String Formatting,  Up: string -- Common string operations": {
            "content": "5.6.1.1 String constants\n........................\n\nThe constants defined in this module are:\n\n-- Data: string.asciiletters\n\nThe concatenation of the *note asciilowercase: 1fd2. and *note\nasciiuppercase: 1fd3. constants described below.  This value is\nnot locale-dependent.\n\n-- Data: string.asciilowercase\n\nThe lowercase letters ''abcdefghijklmnopqrstuvwxyz''.  This value\nis not locale-dependent and will not change.\n\n-- Data: string.asciiuppercase\n\nThe uppercase letters ''ABCDEFGHIJKLMNOPQRSTUVWXYZ''.  This value\nis not locale-dependent and will not change.\n\n-- Data: string.digits\n\nThe string ''0123456789''.\n\n-- Data: string.hexdigits\n\nThe string ''0123456789abcdefABCDEF''.\n\n-- Data: string.octdigits\n\nThe string ''01234567''.\n\n-- Data: string.punctuation\n\nString of ASCII characters which are considered punctuation\ncharacters in the 'C' locale: '!\"#$%&'()*+,-./:;<=>?@[\\]^`{|}~'.\n\n-- Data: string.printable\n\nString of ASCII characters which are considered printable.  This is\na combination of *note digits: 1fd4, *note asciiletters: 1139,\n*note punctuation: 1fd7, and *note whitespace: 1fd9.\n\n-- Data: string.whitespace\n\nA string containing all ASCII characters that are considered\nwhitespace.  This includes the characters space, tab, linefeed,\nreturn, formfeed, and vertical tab.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Custom String Formatting,  Next: Format String Syntax,  Prev: String constants,  Up: string -- Common string operations": {
            "content": "5.6.1.2 Custom String Formatting\n................................\n",
            "subsections": []
        },
        "The built-in string class provides the ability to do complex variable": {
            "content": "substitutions and value formatting via the *note format(): 3ed. method\ndescribed in PEP 3101(1).  The *note Formatter: d21. class in the *note\nstring: cd. module allows you to create and customize your own string\nformatting behaviors using the same implementation as the built-in *note\nformat(): 3ed. method.\n\n-- Class: string.Formatter\n\nThe *note Formatter: d21. class has the following public methods:\n\n-- Method: format (formatstring, /, *args, kwargs)\n\nThe primary API method.  It takes a format string and an\narbitrary set of positional and keyword arguments.  It is just\na wrapper that calls *note vformat(): 1fdb.\n\nChanged in version 3.7: A format string argument is now *note\npositional-only: 8b3.\n\n-- Method: vformat (formatstring, args, kwargs)\n\nThis function does the actual work of formatting.  It is\nexposed as a separate function for cases where you want to\npass in a predefined dictionary of arguments, rather than\nunpacking and repacking the dictionary as individual arguments\nusing the '*args' and 'kwargs' syntax.  *note vformat():\n1fdb. does the work of breaking up the format string into\ncharacter data and replacement fields.  It calls the various\nmethods described below.\n\nIn addition, the *note Formatter: d21. defines a number of methods\nthat are intended to be replaced by subclasses:\n\n-- Method: parse (formatstring)\n\nLoop over the formatstring and return an iterable of tuples\n('literaltext', 'fieldname', 'formatspec', 'conversion').\nThis is used by *note vformat(): 1fdb. to break the string\ninto either literal text, or replacement fields.\n\nThe values in the tuple conceptually represent a span of\nliteral text followed by a single replacement field.  If there\nis no literal text (which can happen if two replacement fields\noccur consecutively), then 'literaltext' will be a\nzero-length string.  If there is no replacement field, then\nthe values of 'fieldname', 'formatspec' and 'conversion'\nwill be 'None'.\n\n-- Method: getfield (fieldname, args, kwargs)\n\nGiven 'fieldname' as returned by *note parse(): 1fdc. (see\nabove), convert it to an object to be formatted.  Returns a\ntuple (obj, usedkey).  The default version takes strings of\nthe form defined in PEP 3101(2), such as \"0[name]\" or\n\"label.title\".  'args' and 'kwargs' are as passed in to *note\nvformat(): 1fdb.  The return value 'usedkey' has the same\nmeaning as the 'key' parameter to *note getvalue(): 1fde.\n\n-- Method: getvalue (key, args, kwargs)\n\nRetrieve a given field value.  The 'key' argument will be\neither an integer or a string.  If it is an integer, it\nrepresents the index of the positional argument in 'args'; if\nit is a string, then it represents a named argument in\n'kwargs'.\n\nThe 'args' parameter is set to the list of positional\narguments to *note vformat(): 1fdb, and the 'kwargs' parameter\nis set to the dictionary of keyword arguments.\n\nFor compound field names, these functions are only called for\nthe first component of the field name; subsequent components\nare handled through normal attribute and indexing operations.\n\nSo for example, the field expression '0.name' would cause\n*note getvalue(): 1fde. to be called with a 'key' argument of\n0.  The 'name' attribute will be looked up after *note\ngetvalue(): 1fde. returns by calling the built-in *note\ngetattr(): a15. function.\n\nIf the index or keyword refers to an item that does not exist,\nthen an *note IndexError: 138f. or *note KeyError: 8cf. should\nbe raised.\n\n-- Method: checkunusedargs (usedargs, args, kwargs)\n\nImplement checking for unused arguments if desired.  The\narguments to this function is the set of all argument keys\nthat were actually referred to in the format string (integers\nfor positional arguments, and strings for named arguments),\nand a reference to the 'args' and 'kwargs' that was passed to\nvformat.  The set of unused args can be calculated from these\nparameters.  *note checkunusedargs(): 1fdf. is assumed to\nraise an exception if the check fails.\n\n-- Method: formatfield (value, formatspec)\n\n*note formatfield(): 1fe0. simply calls the global *note\nformat(): 3eb. built-in.  The method is provided so that\nsubclasses can override it.\n\n-- Method: convertfield (value, conversion)\n\nConverts the value (returned by *note getfield(): 1fdd.)\ngiven a conversion type (as in the tuple returned by the *note\nparse(): 1fdc. method).  The default version understands 's'\n(str), 'r' (repr) and 'a' (ascii) conversion types.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3101/\n\n(2) https://peps.python.org/pep-3101/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Format String Syntax,  Next: Template strings,  Prev: Custom String Formatting,  Up: string -- Common string operations": {
            "content": "5.6.1.3 Format String Syntax\n............................\n\nThe *note str.format(): 3ed. method and the *note Formatter: d21. class\nshare the same syntax for format strings (although in the case of *note\nFormatter: d21, subclasses can define their own format string syntax).\nThe syntax is related to that of *note formatted string literals: 7cd,\nbut it is less sophisticated and, in particular, does not support\narbitrary expressions.\n\nFormat strings contain \"replacement fields\" surrounded by curly braces\n'{}'.  Anything that is not contained in braces is considered literal\ntext, which is copied unchanged to the output.  If you need to include a\nbrace character in the literal text, it can be escaped by doubling: '{{'\nand '}}'.\n\nThe grammar for a replacement field is as follows:\n\nreplacementfield ::= \"{\" [fieldname] [\"!\" conversion] [\":\" formatspec] \"}\"\nfieldname        ::= argname (\".\" attributename | \"[\" elementindex \"]\")*\nargname          ::= [identifier | digit+]\nattributename    ::= identifier\nelementindex     ::= digit+ | indexstring\nindexstring      ::= <any source character except \"]\"> +\nconversion        ::= \"r\" | \"s\" | \"a\"\nformatspec       ::= format-spec:formatspec\n",
            "subsections": []
        },
        "In less formal terms, the replacement field can start with a": {
            "content": "'fieldname' that specifies the object whose value is to be formatted\nand inserted into the output instead of the replacement field.  The\n'fieldname' is optionally followed by a 'conversion' field, which is\npreceded by an exclamation point ''!'', and a 'formatspec', which is\npreceded by a colon '':''.  These specify a non-default format for the\nreplacement value.\n\nSee also the *note Format Specification Mini-Language: 3a7. section.\n",
            "subsections": []
        },
        "The 'fieldname' itself begins with an 'argname' that is either a": {
            "content": "number or a keyword.  If it's a number, it refers to a positional\nargument, and if it's a keyword, it refers to a named keyword argument.\nAn 'argname' is treated as a number if a call to *note str.isdecimal():\n1ecc. on the string would return true.  If the numerical argnames in a\nformat string are 0, 1, 2, ... in sequence, they can all be omitted (not\njust some) and the numbers 0, 1, 2, ... will be automatically inserted in\nthat order.  Because 'argname' is not quote-delimited, it is not\npossible to specify arbitrary dictionary keys (e.g., the strings ''10''\nor '':-]'') within a format string.  The 'argname' can be followed by\nany number of index or attribute expressions.  An expression of the form\n''.name'' selects the named attribute using *note getattr(): a15, while\nan expression of the form ''[index]'' does an index lookup using *note\ngetitem(): 4b9.\n",
            "subsections": []
        },
        "Changed in version 3.1: The positional argument specifiers can be": {
            "content": "omitted for *note str.format(): 3ed, so ''{} {}'.format(a, b)' is\nequivalent to ''{0} {1}'.format(a, b)'.\n",
            "subsections": []
        },
        "Changed in version 3.4: The positional argument specifiers can be": {
            "content": "omitted for *note Formatter: d21.\n\nSome simple format string examples:\n\n\"First, thou shalt count to {0}\"  # References first positional argument\n\"Bring me a {}\"                   # Implicitly references the first positional argument\n\"From {} to {}\"                   # Same as \"From {0} to {1}\"\n\"My quest is {name}\"              # References keyword argument 'name'\n\"Weight in tons {0.weight}\"       # 'weight' attribute of first positional arg\n\"Units destroyed: {players[0]}\"   # First element of keyword argument 'players'.\n\nThe 'conversion' field causes a type coercion before formatting.\nNormally, the job of formatting a value is done by the *note\nformat(): 3ea. method of the value itself.  However, in some cases\nit is desirable to force a type to be formatted as a string, overriding\nits own definition of formatting.  By converting the value to a string\nbefore calling *note format(): 3ea, the normal formatting logic is\nbypassed.\n\nThree conversion flags are currently supported: ''!s'' which calls *note\nstr(): 157. on the value, ''!r'' which calls *note repr(): 5f0. and\n''!a'' which calls *note ascii(): 123b.\n\nSome examples:\n\n\"Harold's a clever {0!s}\"        # Calls str() on the argument first\n\"Bring out the holy {name!r}\"    # Calls repr() on the argument first\n\"More {!a}\"                      # Calls ascii() on the argument first\n",
            "subsections": []
        },
        "The 'formatspec' field contains a specification of how the value should": {
            "content": "be presented, including such details as field width, alignment, padding,\ndecimal precision and so on.  Each value type can define its own\n\"formatting mini-language\" or interpretation of the 'formatspec'.\n",
            "subsections": []
        },
        "Most built-in types support a common formatting mini-language, which is": {
            "content": "described in the next section.\n\nA 'formatspec' field can also include nested replacement fields within\nit.  These nested replacement fields may contain a field name,\nconversion flag and format specification, but deeper nesting is not\nallowed.  The replacement fields within the formatspec are substituted\nbefore the 'formatspec' string is interpreted.  This allows the\nformatting of a value to be dynamically specified.\n\nSee the *note Format examples: 1feb. section for some examples.\n\n* Menu:\n\n* Format Specification Mini-Language::\n* Format examples::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Format Specification Mini-Language,  Next: Format examples,  Up: Format String Syntax": {
            "content": "5.6.1.4 Format Specification Mini-Language\n..........................................\n\n\"Format specifications\" are used within replacement fields contained\nwithin a format string to define how individual values are presented\n(see *note Format String Syntax: 1205. and *note f-strings: 7cd.).  They\ncan also be passed directly to the built-in *note format(): 3eb.\nfunction.  Each formattable type may define how the format specification\nis to be interpreted.\n",
            "subsections": []
        },
        "Most built-in types implement the following options for format": {
            "content": "specifications, although some of the formatting options are only\nsupported by the numeric types.\n\nA general convention is that an empty format specification produces the\nsame result as if you had called *note str(): 157. on the value.  A\nnon-empty format specification typically modifies the result.\n\nThe general form of a 'standard format specifier' is:\n\nformatspec     ::= [[fill]align][sign][\"z\"][\"#\"][\"0\"][width][groupingoption][\".\" precision][type]\nfill            ::= <any character>\nalign           ::= \"<\" | \">\" | \"=\" | \"^\"\nsign            ::= \"+\" | \"-\" | \" \"\nwidth           ::= digit+\ngroupingoption ::= \"\" | \",\"\nprecision       ::= digit+\ntype            ::= \"b\" | \"c\" | \"d\" | \"e\" | \"E\" | \"f\" | \"F\" | \"g\" | \"G\" | \"n\" | \"o\" | \"s\" | \"x\" | \"X\" | \"%\"\n",
            "subsections": []
        },
        "If a valid 'align' value is specified, it can be preceded by a 'fill'": {
            "content": "character that can be any character and defaults to a space if omitted.\nIt is not possible to use a literal curly brace (\"'{'\" or \"'}'\") as the\n'fill' character in a *note formatted string literal: 7cd. or when using\nthe *note str.format(): 3ed. method.  However, it is possible to insert\na curly brace with a nested replacement field.  This limitation doesn't\naffect the *note format(): 3eb. function.\n\nThe meaning of the various alignment options is as follows:\n",
            "subsections": []
        },
        "Option        Meaning": {
            "content": "-----------------------------------------------------------------------------\n\n''+''         indicates that a sign should be used for both positive as\nwell as negative numbers.\n\n\n''-''         indicates that a sign should be used only for negative\nnumbers (this is the default behavior).\n\n\nspace         indicates that a leading space should be used on positive\nnumbers, and a minus sign on negative numbers.\n\n",
            "subsections": []
        },
        "Note that unless a minimum field width is defined, the field width will": {
            "content": "always be the same size as the data to fill it, so that the alignment\noption has no meaning in this case.\n",
            "subsections": []
        },
        "The 'sign' option is only valid for number types, and can be one of the": {
            "content": "following:\n",
            "subsections": []
        },
        "The ''z'' option coerces negative zero floating-point values to positive": {
            "content": "zero after rounding to the format precision.  This option is only valid\nfor floating-point presentation types.\n\nChanged in version 3.11: Added the ''z'' option (see also PEP 682(1)).\n\nThe ''#'' option causes the \"alternate form\" to be used for the\nconversion.  The alternate form is defined differently for different\ntypes.  This option is only valid for integer, float and complex types.",
            "subsections": []
        },
        "For integers, when binary, octal, or hexadecimal output is used, this": {
            "content": "option adds the respective prefix ''0b'', ''0o'', ''0x'', or ''0X'' to\nthe output value.  For float and complex the alternate form causes the\nresult of the conversion to always contain a decimal-point character,\neven if no digits follow it.  Normally, a decimal-point character\nappears in the result of these conversions only if a digit follows it.",
            "subsections": []
        },
        "In addition, for ''g'' and ''G'' conversions, trailing zeros are not": {
            "content": "removed from the result.\n\nThe '','' option signals the use of a comma for a thousands separator.",
            "subsections": []
        },
        "For a locale aware separator, use the ''n'' integer presentation type": {
            "content": "instead.\n\nChanged in version 3.1: Added the '','' option (see also PEP 378(2)).\n",
            "subsections": []
        },
        "The '''' option signals the use of an underscore for a thousands": {
            "content": "separator for floating point presentation types and for integer\npresentation type ''d''.  For integer presentation types ''b'', ''o'',\n''x'', and ''X'', underscores will be inserted every 4 digits.  For\nother presentation types, specifying this option is an error.\n\nChanged in version 3.6: Added the '''' option (see also PEP 515(3)).\n\n'width' is a decimal integer defining the minimum total field width,\nincluding any prefixes, separators, and other formatting characters.  If\nnot specified, then the field width will be determined by the content.\n",
            "subsections": []
        },
        "When no explicit alignment is given, preceding the 'width' field by a": {
            "content": "zero (''0'') character enables sign-aware zero-padding for numeric\ntypes.  This is equivalent to a 'fill' character of ''0'' with an\n'alignment' type of ''=''.\n",
            "subsections": []
        },
        "Changed in version 3.10: Preceding the 'width' field by ''0'' no longer": {
            "content": "affects the default alignment for strings.\n",
            "subsections": []
        },
        "The 'precision' is a decimal integer indicating how many digits should": {
            "content": "be displayed after the decimal point for presentation types ''f'' and\n''F'', or before and after the decimal point for presentation types\n''g'' or ''G''.  For string presentation types the field indicates the\nmaximum field size - in other words, how many characters will be used\nfrom the field content.  The 'precision' is not allowed for integer\npresentation types.\n\nFinally, the 'type' determines how the data should be presented.\n\nThe available string presentation types are:\n\nType          Meaning\n\n-----------------------------------------------------------------------------\n\n''s''         String format.  This is the default type for strings and may\nbe omitted.\n\n\nNone          The same as ''s''.\n\n\nThe available integer presentation types are:\n\nType          Meaning\n\n-----------------------------------------------------------------------------\n\n''b''         Binary format.  Outputs the number in base 2.\n\n\n''c''         Character.  Converts the integer to the corresponding\nunicode character before printing.\n\n\n''d''         Decimal Integer.  Outputs the number in base 10.\n\n\n''o''         Octal format.  Outputs the number in base 8.\n\n\n''x''         Hex format.  Outputs the number in base 16, using lower-case\nletters for the digits above 9.\n\n\n''X''         Hex format.  Outputs the number in base 16, using upper-case\nletters for the digits above 9.  In case ''#'' is specified,\nthe prefix ''0x'' will be upper-cased to ''0X'' as well.\n\n\n''n''         Number.  This is the same as ''d'', except that it uses the\ncurrent locale setting to insert the appropriate number\nseparator characters.\n\n\nNone          The same as ''d''.\n\n",
            "subsections": []
        },
        "In addition to the above presentation types, integers can be formatted": {
            "content": "with the floating point presentation types listed below (except ''n''\nand 'None').  When doing so, *note float(): 4b7. is used to convert the\ninteger to a floating point number before formatting.\n\nThe available presentation types for *note float: 4b7. and *note\nDecimal: 5c3. values are:\n\nType          Meaning\n\n-----------------------------------------------------------------------------\n\n''e''         Scientific notation.  For a given precision 'p', formats the\nnumber in scientific notation with the letter 'e' separating\nthe coefficient from the exponent.  The coefficient has one\ndigit before and 'p' digits after the decimal point, for a\ntotal of 'p + 1' significant digits.  With no precision\ngiven, uses a precision of '6' digits after the decimal\npoint for *note float: 4b7, and shows all coefficient digits\nfor *note Decimal: 5c3.  If no digits follow the decimal\npoint, the decimal point is also removed unless the '#'\noption is used.\n\n\n''E''         Scientific notation.  Same as ''e'' except it uses an upper\ncase 'E' as the separator character.\n\n\n''f''         Fixed-point notation.  For a given precision 'p', formats\nthe number as a decimal number with exactly 'p' digits\nfollowing the decimal point.  With no precision given, uses\na precision of '6' digits after the decimal point for\n*note float: 4b7, and uses a precision large enough to show\nall coefficient digits for *note Decimal: 5c3.  If no digits\nfollow the decimal point, the decimal point is also removed\nunless the '#' option is used.\n\n\n''F''         Fixed-point notation.  Same as ''f'', but converts 'nan' to\n'NAN' and 'inf' to 'INF'.\n\n\n''g''         General format.  For a given precision 'p >= 1', this rounds\nthe number to 'p' significant digits and then formats the\nresult in either fixed-point format or in scientific\nnotation, depending on its magnitude.  A precision of '0' is\ntreated as equivalent to a precision of '1'.\n\nThe precise rules are as follows: suppose that the result\nformatted with presentation type ''e'' and precision 'p-1'\nwould have exponent 'exp'.  Then, if 'm <= exp < p', where\n'm' is -4 for floats and -6 for *note Decimals: 5c3, the\nnumber is formatted with presentation type ''f'' and\nprecision 'p-1-exp'.  Otherwise, the number is formatted\nwith presentation type ''e'' and precision 'p-1'.  In both\ncases insignificant trailing zeros are removed from the\nsignificand, and the decimal point is also removed if there\nare no remaining digits following it, unless the ''#''\noption is used.\n\nWith no precision given, uses a precision of '6' significant\ndigits for *note float: 4b7.  For *note Decimal: 5c3, the\ncoefficient of the result is formed from the coefficient\ndigits of the value; scientific notation is used for values\nsmaller than '1e-6' in absolute value and values where the\nplace value of the least significant digit is larger than 1,\nand fixed-point notation is used otherwise.\n\nPositive and negative infinity, positive and negative zero,\nand nans, are formatted as 'inf', '-inf', '0', '-0' and\n'nan' respectively, regardless of the precision.\n\n\n''G''         General format.  Same as ''g'' except switches to ''E'' if\nthe number gets too large.  The representations of infinity\nand NaN are uppercased, too.\n\n\n''n''         Number.  This is the same as ''g'', except that it uses the\ncurrent locale setting to insert the appropriate number\nseparator characters.\n\n\n''%''         Percentage.  Multiplies the number by 100 and displays in\nfixed (''f'') format, followed by a percent sign.\n\n\nNone          For *note float: 4b7. this is the same as ''g'', except that\nwhen fixed-point notation is used to format the result, it\nalways includes at least one digit past the decimal point.\nThe precision used is as large as needed to represent the\ngiven value faithfully.\n\nFor *note Decimal: 5c3, this is the same as either ''g'' or\n''G'' depending on the value of 'context.capitals' for the\ncurrent decimal context.\n\nThe overall effect is to match the output of\n*note str(): 157. as altered by the other format modifiers.\n\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0682/\n\n(2) https://peps.python.org/pep-0378/\n\n(3) https://peps.python.org/pep-0515/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Format examples,  Prev: Format Specification Mini-Language,  Up: Format String Syntax": {
            "content": "5.6.1.5 Format examples\n.......................\n\nThis section contains examples of the *note str.format(): 3ed. syntax\nand comparison with the old '%'-formatting.\n\nIn most of the cases the syntax is similar to the old '%'-formatting,\nwith the addition of the '{}' and with ':' used instead of '%'.  For\nexample, ''%03.2f'' can be translated to ''{:03.2f}''.\n",
            "subsections": []
        },
        "The new format syntax also supports new and different options, shown in": {
            "content": "the following examples.\n\nAccessing arguments by position:\n\n>>> '{0}, {1}, {2}'.format('a', 'b', 'c')\n'a, b, c'\n>>> '{}, {}, {}'.format('a', 'b', 'c')  # 3.1+ only\n'a, b, c'\n>>> '{2}, {1}, {0}'.format('a', 'b', 'c')\n'c, b, a'\n>>> '{2}, {1}, {0}'.format(*'abc')      # unpacking argument sequence\n'c, b, a'\n>>> '{0}{1}{0}'.format('abra', 'cad')   # arguments' indices can be repeated\n'abracadabra'\n\nAccessing arguments by name:\n\n>>> 'Coordinates: {latitude}, {longitude}'.format(latitude='37.24N', longitude='-115.81W')\n'Coordinates: 37.24N, -115.81W'\n>>> coord = {'latitude': '37.24N', 'longitude': '-115.81W'}\n>>> 'Coordinates: {latitude}, {longitude}'.format(coord)\n'Coordinates: 37.24N, -115.81W'\n\nAccessing arguments' attributes:\n\n>>> c = 3-5j\n>>> ('The complex number {0} is formed from the real part {0.real} '\n...  'and the imaginary part {0.imag}.').format(c)\n'The complex number (3-5j) is formed from the real part 3.0 and the imaginary part -5.0.'\n>>> class Point:\n...     def init(self, x, y):\n...         self.x, self.y = x, y\n...     def str(self):\n...         return 'Point({self.x}, {self.y})'.format(self=self)\n...\n>>> str(Point(4, 2))\n'Point(4, 2)'\n\nAccessing arguments' items:\n\n>>> coord = (3, 5)\n>>> 'X: {0[0]};  Y: {0[1]}'.format(coord)\n'X: 3;  Y: 5'\n\nReplacing '%s' and '%r':\n\n>>> \"repr() shows quotes: {!r}; str() doesn't: {!s}\".format('test1', 'test2')\n\"repr() shows quotes: 'test1'; str() doesn't: test2\"\n\nAligning the text and specifying a width:\n\n>>> '{:<30}'.format('left aligned')\n'left aligned                  '\n>>> '{:>30}'.format('right aligned')\n'                 right aligned'\n>>> '{:^30}'.format('centered')\n'           centered           '\n>>> '{:*^30}'.format('centered')  # use '*' as a fill char\n'*centered*'\n\nReplacing '%+f', '%-f', and '% f' and specifying a sign:\n\n>>> '{:+f}; {:+f}'.format(3.14, -3.14)  # show it always\n'+3.140000; -3.140000'\n>>> '{: f}; {: f}'.format(3.14, -3.14)  # show a space for positive numbers\n' 3.140000; -3.140000'\n>>> '{:-f}; {:-f}'.format(3.14, -3.14)  # show only the minus -- same as '{:f}; {:f}'\n'3.140000; -3.140000'\n\nReplacing '%x' and '%o' and converting the value to different bases:\n\n>>> # format also supports binary numbers\n>>> \"int: {0:d};  hex: {0:x};  oct: {0:o};  bin: {0:b}\".format(42)\n'int: 42;  hex: 2a;  oct: 52;  bin: 101010'\n>>> # with 0x, 0o, or 0b as prefix:\n>>> \"int: {0:d};  hex: {0:#x};  oct: {0:#o};  bin: {0:#b}\".format(42)\n'int: 42;  hex: 0x2a;  oct: 0o52;  bin: 0b101010'\n\nUsing the comma as a thousands separator:\n\n>>> '{:,}'.format(1234567890)\n'1,234,567,890'\n\nExpressing a percentage:\n\n>>> points = 19\n>>> total = 22\n>>> 'Correct answers: {:.2%}'.format(points/total)\n'Correct answers: 86.36%'\n\nUsing type-specific formatting:\n\n>>> import datetime\n>>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\n>>> '{:%Y-%m-%d %H:%M:%S}'.format(d)\n'2010-07-04 12:15:58'\n\nNesting arguments and more complex examples:\n\n>>> for align, text in zip('<^>', ['left', 'center', 'right']):\n...     '{0:{fill}{align}16}'.format(text, fill=align, align=align)\n...\n'left<<<<<<<<<<<<'\n'^^^^^center^^^^^'\n'>>>>>>>>>>>right'\n>>>\n>>> octets = [192, 168, 0, 1]\n>>> '{:02X}{:02X}{:02X}{:02X}'.format(*octets)\n'C0A80001'\n>>> int(, 16)\n3232235521\n>>>\n>>> width = 5\n>>> for num in range(5,12):\n...     for base in 'dXob':\n...         print('{0:{width}{base}}'.format(num, base=base, width=width), end=' ')\n...     print()\n...\n5     5     5   101\n6     6     6   110\n7     7     7   111\n8     8    10  1000\n9     9    11  1001\n10     A    12  1010\n11     B    13  1011\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Template strings,  Next: Helper functions,  Prev: Format String Syntax,  Up: string -- Common string operations": {
            "content": "5.6.1.6 Template strings\n........................\n",
            "subsections": []
        },
        "Template strings provide simpler string substitutions as described in": {
            "content": "PEP 292(1).  A primary use case for template strings is for\ninternationalization (i18n) since in that context, the simpler syntax\nand functionality makes it easier to translate than other built-in\nstring formatting facilities in Python.  As an example of a library\nbuilt on template strings for i18n, see the flufl.i18n(2) package.\n\nTemplate strings support '$'-based substitutions, using the following\nrules:\n\n* '$$' is an escape; it is replaced with a single '$'.\n\n* '$identifier' names a substitution placeholder matching a mapping\nkey of '\"identifier\"'.  By default, '\"identifier\"' is restricted to\nany case-insensitive ASCII alphanumeric string (including\nunderscores) that starts with an underscore or ASCII letter.  The\nfirst non-identifier character after the '$' character terminates\nthis placeholder specification.\n\n* '${identifier}' is equivalent to '$identifier'.  It is required\nwhen valid identifier characters follow the placeholder but are not\npart of the placeholder, such as '\"${noun}ification\"'.\n\nAny other appearance of '$' in the string will result in a *note\nValueError: 183. being raised.\n\nThe *note string: cd. module provides a *note Template: 453. class that\nimplements these rules.  The methods of *note Template: 453. are:\n\n-- Class: string.Template (template)\n\nThe constructor takes a single argument which is the template\nstring.\n\n-- Method: substitute (mapping={}, /, kwds)\n\nPerforms the template substitution, returning a new string.\n'mapping' is any dictionary-like object with keys that match\nthe placeholders in the template.  Alternatively, you can\nprovide keyword arguments, where the keywords are the\nplaceholders.  When both 'mapping' and 'kwds' are given and\nthere are duplicates, the placeholders from 'kwds' take\nprecedence.\n\n-- Method: safesubstitute (mapping={}, /, kwds)\n\nLike *note substitute(): 1a6e, except that if placeholders are\nmissing from 'mapping' and 'kwds', instead of raising a *note\nKeyError: 8cf. exception, the original placeholder will appear\nin the resulting string intact.  Also, unlike with *note\nsubstitute(): 1a6e, any other appearances of the '$' will\nsimply return '$' instead of raising *note ValueError: 183.\n\nWhile other exceptions may still occur, this method is called\n\"safe\" because it always tries to return a usable string\ninstead of raising an exception.  In another sense, *note\nsafesubstitute(): 1a6f. may be anything other than safe,\nsince it will silently ignore malformed templates containing\ndangling delimiters, unmatched braces, or placeholders that\nare not valid Python identifiers.\n\n-- Method: isvalid ()\n\nReturns false if the template has invalid placeholders that\nwill cause *note substitute(): 1a6e. to raise *note\nValueError: 183.\n\nNew in version 3.11.\n\n-- Method: getidentifiers ()\n\nReturns a list of the valid identifiers in the template, in\nthe order they first appear, ignoring any invalid identifiers.\n\nNew in version 3.11.\n\n*note Template: 453. instances also provide one public data\nattribute:\n\n-- Attribute: template\n\nThis is the object passed to the constructor's 'template'\nargument.  In general, you shouldn't change it, but read-only\naccess is not enforced.\n\nHere is an example of how to use a Template:\n\n>>> from string import Template\n>>> s = Template('$who likes $what')\n>>> s.substitute(who='tim', what='kung pao')\n'tim likes kung pao'\n>>> d = dict(who='tim')\n>>> Template('Give $who $100').substitute(d)\nTraceback (most recent call last):\n...\nValueError: Invalid placeholder in string: line 1, col 11\n>>> Template('$who likes $what').substitute(d)\nTraceback (most recent call last):\n...\nKeyError: 'what'\n>>> Template('$who likes $what').safesubstitute(d)\n'tim likes $what'\n\nAdvanced usage: you can derive subclasses of *note Template: 453. to\ncustomize the placeholder syntax, delimiter character, or the entire\nregular expression used to parse template strings.  To do this, you can\noverride these class attributes:\n\n* 'delimiter' - This is the literal string describing a placeholder\nintroducing delimiter.  The default value is '$'.  Note that this\nshould 'not' be a regular expression, as the implementation will\ncall *note re.escape(): a4f. on this string as needed.  Note\nfurther that you cannot change the delimiter after class creation\n(i.e.  a different delimiter must be set in the subclass's class\nnamespace).\n\n* 'idpattern' - This is the regular expression describing the pattern\nfor non-braced placeholders.  The default value is the regular\nexpression '(?a:[a-z][a-z0-9]*)'.  If this is given and\n'braceidpattern' is 'None' this pattern will also apply to braced\nplaceholders.\n\nNote: Since default 'flags' is 're.IGNORECASE', pattern\n'[a-z]' can match with some non-ASCII characters.  That's why\nwe use the local 'a' flag here.\n\nChanged in version 3.7: 'braceidpattern' can be used to define\nseparate patterns used inside and outside the braces.\n\n* 'braceidpattern' - This is like 'idpattern' but describes the\npattern for braced placeholders.  Defaults to 'None' which means to\nfall back to 'idpattern' (i.e.  the same pattern is used both\ninside and outside braces).  If given, this allows you to define\ndifferent patterns for braced and unbraced placeholders.\n\nNew in version 3.7.\n\n* 'flags' - The regular expression flags that will be applied when\ncompiling the regular expression used for recognizing\nsubstitutions.  The default value is 're.IGNORECASE'.  Note that\n're.VERBOSE' will always be added to the flags, so custom\n'idpattern's must follow conventions for verbose regular\nexpressions.\n\nNew in version 3.2.\n",
            "subsections": []
        },
        "Alternatively, you can provide the entire regular expression pattern by": {
            "content": "overriding the class attribute 'pattern'.  If you do this, the value\nmust be a regular expression object with four named capturing groups.",
            "subsections": []
        },
        "The capturing groups correspond to the rules given above, along with the": {
            "content": "invalid placeholder rule:\n\n* 'escaped' - This group matches the escape sequence, e.g.  '$$', in\nthe default pattern.\n\n* 'named' - This group matches the unbraced placeholder name; it\nshould not include the delimiter in capturing group.\n\n* 'braced' - This group matches the brace enclosed placeholder name;\nit should not include either the delimiter or braces in the\ncapturing group.\n\n* 'invalid' - This group matches any other delimiter pattern (usually\na single delimiter), and it should appear last in the regular\nexpression.\n\nThe methods on this class will raise *note ValueError: 183. if the\npattern matches the template without one of these named groups matching.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0292/\n\n(2) https://flufli18n.readthedocs.io/en/latest/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Helper functions,  Prev: Template strings,  Up: string -- Common string operations": {
            "content": "5.6.1.7 Helper functions\n........................\n\n-- Function: string.capwords (s, sep=None)\n\nSplit the argument into words using *note str.split(): d0e,\ncapitalize each word using *note str.capitalize(): 1ec6, and join\nthe capitalized words using *note str.join(): 1eb6.  If the\noptional second argument 'sep' is absent or 'None', runs of\nwhitespace characters are replaced by a single space and leading\nand trailing whitespace are removed, otherwise 'sep' is used to\nsplit and join the words.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: re -- Regular expression operations,  Next: difflib -- Helpers for computing deltas,  Prev: string -- Common string operations,  Up: Text Processing Services": {
            "content": "'Source code:' Lib/re/(1)\n\n\n",
            "subsections": []
        },
        "This module provides regular expression matching operations similar to": {
            "content": "those found in Perl.\n\nBoth patterns and strings to be searched can be Unicode strings (*note\nstr: 157.) as well as 8-bit strings (*note bytes: 295.).  However,",
            "subsections": []
        },
        "Unicode strings and 8-bit strings cannot be mixed: that is, you cannot": {
            "content": "match a Unicode string with a bytes pattern or vice-versa; similarly,\nwhen asking for a substitution, the replacement string must be of the\nsame type as both the pattern and the search string.\n\nRegular expressions use the backslash character (''\\'') to indicate\nspecial forms or to allow special characters to be used without invoking\ntheir special meaning.  This collides with Python's usage of the same\ncharacter for the same purpose in string literals; for example, to match\na literal backslash, one might have to write ''\\\\\\\\'' as the pattern\nstring, because the regular expression must be '\\\\', and each backslash\nmust be expressed as '\\\\' inside a regular Python string literal.  Also,\nplease note that any invalid escape sequences in Python's usage of the\nbackslash in string literals now generate a *note SyntaxWarning: 178.\nand in the future this will become a *note SyntaxError: 146.  This\nbehaviour will happen even if it is a valid escape sequence for a\nregular expression.\n",
            "subsections": []
        },
        "The solution is to use Python's raw string notation for regular": {
            "content": "expressions; backslashes are not handled in any special way in a string\nliteral prefixed with ''r'', so 'r\"\\n\"' is a two-character string\ncontaining ''\\'' and ''n'', while '\"\\n\"' is a one-character string\ncontaining a newline.  Regular expressions will often be written in\nPython code using this raw string notation.\n",
            "subsections": []
        },
        "It is important to note that most regular expression operations are": {
            "content": "available as module-level functions and methods on *note compiled\nregular expressions: df6.  The functions are shortcuts that don't\nrequire you to compile a regex object first, but miss some fine-tuning\nparameters.\n\nSee also\n........\n",
            "subsections": []
        },
        "The third-party regex(2) module, which has an API compatible with the": {
            "content": "standard library *note re: b4. module, but offers additional\nfunctionality and a more thorough Unicode support.\n\n* Menu:\n\n* Regular Expression Syntax::\n* Module Contents::\n* Regular Expression Objects::\n* Match Objects::\n* Regular Expression Examples::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/re/\n\n(2) https://pypi.org/project/regex/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Regular Expression Syntax,  Next: Module Contents,  Up: re -- Regular expression operations": {
            "content": "5.6.2.1 Regular Expression Syntax\n.................................\n\nA regular expression (or RE) specifies a set of strings that matches it;\nthe functions in this module let you check if a particular string\nmatches a given regular expression (or if a given regular expression\nmatches a particular string, which comes down to the same thing).\n",
            "subsections": []
        },
        "Regular expressions can be concatenated to form new regular expressions;": {
            "content": "if 'A' and 'B' are both regular expressions, then 'AB' is also a regular\nexpression.  In general, if a string 'p' matches 'A' and another string\n'q' matches 'B', the string 'pq' will match AB. This holds unless 'A' or\n'B' contain low precedence operations; boundary conditions between 'A'\nand 'B'; or have numbered group references.  Thus, complex expressions\ncan easily be constructed from simpler primitive expressions like the\nones described here.  For details of the theory and implementation of\nregular expressions, consult the Friedl book *note [Frie09]: 1ffc, or\nalmost any textbook about compiler construction.\n\nA brief explanation of the format of regular expressions follows.  For\nfurther information and a gentler presentation, consult the *note\nRegular Expression HOWTO: 1ffd.\n\nRegular expressions can contain both special and ordinary characters.",
            "subsections": []
        },
        "Most ordinary characters, like ''A'', ''a'', or ''0'', are the simplest": {
            "content": "regular expressions; they simply match themselves.  You can concatenate\nordinary characters, so 'last' matches the string ''last''.  (In the\nrest of this section, we'll write RE's in 'this special style', usually\nwithout quotes, and strings to be matched ''in single quotes''.)\n\nSome characters, like ''|'' or ''('', are special.  Special characters\neither stand for classes of ordinary characters, or affect how the\nregular expressions around them are interpreted.\n\nRepetition operators or quantifiers ('*', '+', '?', '{m,n}', etc) cannot\nbe directly nested.  This avoids ambiguity with the non-greedy modifier\nsuffix '?', and with other modifiers in other implementations.  To apply\na second repetition to an inner repetition, parentheses may be used.\nFor example, the expression '(?:a{6})*' matches any multiple of six\n''a'' characters.\n\nThe special characters are:\n\n'.'\n\n(Dot.)  In the default mode, this matches any character except a\nnewline.  If the *note DOTALL: 1ffe. flag has been specified, this\nmatches any character including a newline.\n\n'^'\n\n(Caret.)  Matches the start of the string, and in *note MULTILINE:\n1fff. mode also matches immediately after each newline.\n\n'$'\n\nMatches the end of the string or just before the newline at the end\nof the string, and in *note MULTILINE: 1fff. mode also matches\nbefore a newline.  'foo' matches both 'foo' and 'foobar', while the\nregular expression 'foo$' matches only 'foo'.  More interestingly,\nsearching for 'foo.$' in ''foo1\\nfoo2\\n'' matches 'foo2' normally,\nbut 'foo1' in *note MULTILINE: 1fff. mode; searching for a single\n'$' in ''foo\\n'' will find two (empty) matches: one just before the\nnewline, and one at the end of the string.\n\n'*'\n\nCauses the resulting RE to match 0 or more repetitions of the\npreceding RE, as many repetitions as are possible.  'ab*' will\nmatch 'a', 'ab', or 'a' followed by any number of 'b's.\n\n'+'\n\nCauses the resulting RE to match 1 or more repetitions of the\npreceding RE. 'ab+' will match 'a' followed by any non-zero number\nof 'b's; it will not match just 'a'.\n\n'?'\n\nCauses the resulting RE to match 0 or 1 repetitions of the\npreceding RE. 'ab?' will match either 'a' or 'ab'.\n\n'*?', '+?', '??'\n\nThe ''*'', ''+'', and ''?'' quantifiers are all 'greedy'; they\nmatch as much text as possible.  Sometimes this behaviour isn't\ndesired; if the RE '<.*>' is matched against ''<a> b <c>'', it will\nmatch the entire string, and not just ''<a>''.  Adding '?' after\nthe quantifier makes it perform the match in 'non-greedy' or\n'minimal' fashion; as 'few' characters as possible will be matched.\nUsing the RE '<.*?>' will match only ''<a>''.\n\n'*+', '++', '?+'\n\nLike the ''*'', ''+'', and ''?'' quantifiers, those where ''+'' is\nappended also match as many times as possible.  However, unlike the\ntrue greedy quantifiers, these do not allow back-tracking when the\nexpression following it fails to match.  These are known as\n'possessive' quantifiers.  For example, 'a*a' will match ''aaaa''\nbecause the 'a*' will match all 4 ''a''s, but, when the final ''a''\nis encountered, the expression is backtracked so that in the end\nthe 'a*' ends up matching 3 ''a''s total, and the fourth ''a'' is\nmatched by the final ''a''.  However, when 'a*+a' is used to match\n''aaaa'', the 'a*+' will match all 4 ''a'', but when the final\n''a'' fails to find any more characters to match, the expression\ncannot be backtracked and will thus fail to match.  'x*+', 'x++'\nand 'x?+' are equivalent to '(?>x*)', '(?>x+)' and '(?>x?)'\ncorrespondingly.\n\nNew in version 3.11.\n\n'{m}'\n\nSpecifies that exactly 'm' copies of the previous RE should be\nmatched; fewer matches cause the entire RE not to match.  For\nexample, 'a{6}' will match exactly six ''a'' characters, but not\nfive.\n\n'{m,n}'\n\nCauses the resulting RE to match from 'm' to 'n' repetitions of the\npreceding RE, attempting to match as many repetitions as possible.\nFor example, 'a{3,5}' will match from 3 to 5 ''a'' characters.\nOmitting 'm' specifies a lower bound of zero, and omitting 'n'\nspecifies an infinite upper bound.  As an example, 'a{4,}b' will\nmatch ''aaaab'' or a thousand ''a'' characters followed by a ''b'',\nbut not ''aaab''.  The comma may not be omitted or the modifier\nwould be confused with the previously described form.\n\n'{m,n}?'\n\nCauses the resulting RE to match from 'm' to 'n' repetitions of the\npreceding RE, attempting to match as 'few' repetitions as possible.\nThis is the non-greedy version of the previous quantifier.  For\nexample, on the 6-character string ''aaaaaa'', 'a{3,5}' will match\n5 ''a'' characters, while 'a{3,5}?' will only match 3 characters.\n\n'{m,n}+'\n\nCauses the resulting RE to match from 'm' to 'n' repetitions of the\npreceding RE, attempting to match as many repetitions as possible\n'without' establishing any backtracking points.  This is the\npossessive version of the quantifier above.  For example, on the\n6-character string ''aaaaaa'', 'a{3,5}+aa' attempt to match 5 ''a''\ncharacters, then, requiring 2 more ''a''s, will need more\ncharacters than available and thus fail, while 'a{3,5}aa' will\nmatch with 'a{3,5}' capturing 5, then 4 ''a''s by backtracking and\nthen the final 2 ''a''s are matched by the final 'aa' in the\npattern.  'x{m,n}+' is equivalent to '(?>x{m,n})'.\n\nNew in version 3.11.\n\n'\\'\n\nEither escapes special characters (permitting you to match\ncharacters like ''*'', ''?'', and so forth), or signals a special\nsequence; special sequences are discussed below.\n\nIf you're not using a raw string to express the pattern, remember\nthat Python also uses the backslash as an escape sequence in string\nliterals; if the escape sequence isn't recognized by Python's\nparser, the backslash and subsequent character are included in the\nresulting string.  However, if Python would recognize the resulting\nsequence, the backslash should be repeated twice.  This is\ncomplicated and hard to understand, so it's highly recommended that\nyou use raw strings for all but the simplest expressions.\n\n'[]'\n\nUsed to indicate a set of characters.  In a set:\n\n* Characters can be listed individually, e.g.  '[amk]' will\nmatch ''a'', ''m'', or ''k''.\n\n* Ranges of characters can be indicated by giving two characters\nand separating them by a ''-'', for example '[a-z]' will match\nany lowercase ASCII letter, '[0-5][0-9]' will match all the\ntwo-digits numbers from '00' to '59', and '[0-9A-Fa-f]' will\nmatch any hexadecimal digit.  If '-' is escaped (e.g.\n'[a\\-z]') or if it's placed as the first or last character\n(e.g.  '[-a]' or '[a-]'), it will match a literal ''-''.\n\n* Special characters lose their special meaning inside sets.\nFor example, '[(+*)]' will match any of the literal characters\n''('', ''+'', ''*'', or '')''.\n\n* Character classes such as '\\w' or '\\S' (defined below) are\nalso accepted inside a set, although the characters they match\ndepend on the *note flags: 2000. used.\n\n* Characters that are not within a range can be matched by\n'complementing' the set.  If the first character of the set is\n''^'', all the characters that are 'not' in the set will be\nmatched.  For example, '[^5]' will match any character except\n''5'', and '[^^]' will match any character except ''^''.  '^'\nhas no special meaning if it's not the first character in the\nset.\n\n* To match a literal '']'' inside a set, precede it with a\nbackslash, or place it at the beginning of the set.  For\nexample, both '[()[\\]{}]' and '[]()[{}]' will match a right\nbracket, as well as left bracket, braces, and parentheses.\n\n* Support of nested sets and set operations as in Unicode\nTechnical Standard #18(1) might be added in the future.  This\nwould change the syntax, so to facilitate this change a *note\nFutureWarning: 23f. will be raised in ambiguous cases for the\ntime being.  That includes sets starting with a literal ''[''\nor containing literal character sequences ''--'', ''&&'',\n''~~'', and ''||''.  To avoid a warning escape them with a\nbackslash.\n\nChanged in version 3.7: *note FutureWarning: 23f. is raised if a\ncharacter set contains constructs that will change semantically in\nthe future.\n\n'|'\n\n'A|B', where 'A' and 'B' can be arbitrary REs, creates a regular\nexpression that will match either 'A' or 'B'. An arbitrary number\nof REs can be separated by the ''|'' in this way.  This can be used\ninside groups (see below) as well.  As the target string is\nscanned, REs separated by ''|'' are tried from left to right.  When\none pattern completely matches, that branch is accepted.  This\nmeans that once 'A' matches, 'B' will not be tested further, even\nif it would produce a longer overall match.  In other words, the\n''|'' operator is never greedy.  To match a literal ''|'', use\n'\\|', or enclose it inside a character class, as in '[|]'.\n\n'(...)'\n\nMatches whatever regular expression is inside the parentheses, and\nindicates the start and end of a group; the contents of a group can\nbe retrieved after a match has been performed, and can be matched\nlater in the string with the '\\number' special sequence, described\nbelow.  To match the literals ''('' or '')'', use '\\(' or '\\)', or\nenclose them inside a character class: '[(]', '[)]'.\n\n'(?...)'\n\nThis is an extension notation (a ''?'' following a ''('' is not\nmeaningful otherwise).  The first character after the ''?''\ndetermines what the meaning and further syntax of the construct is.\nExtensions usually do not create a new group; '(?P<name>...)' is\nthe only exception to this rule.  Following are the currently\nsupported extensions.\n\n'(?aiLmsux)'\n\n(One or more letters from the set ''a'', ''i'', ''L'', ''m'',\n''s'', ''u'', ''x''.)  The group matches the empty string; the\nletters set the corresponding flags for the entire regular\nexpression:\n\n* *note re.A: 2001. (ASCII-only matching)\n\n* *note re.I: 2002. (ignore case)\n\n* *note re.L: 2003. (locale dependent)\n\n* *note re.M: 2004. (multi-line)\n\n* *note re.S: 2005. (dot matches all)\n\n* *note re.U: 2006. (Unicode matching)\n\n* *note re.X: 2007. (verbose)\n\n(The flags are described in *note Module Contents: 2008.)  This is\nuseful if you wish to include the flags as part of the regular\nexpression, instead of passing a 'flag' argument to the *note\nre.compile(): a17. function.  Flags should be used first in the\nexpression string.\n\nChanged in version 3.11: This construction can only be used at the\nstart of the expression.\n\n'(?:...)'\n\nA non-capturing version of regular parentheses.  Matches whatever\nregular expression is inside the parentheses, but the substring\nmatched by the group 'cannot' be retrieved after performing a match\nor referenced later in the pattern.\n\n'(?aiLmsux-imsx:...)'\n\n(Zero or more letters from the set ''a'', ''i'', ''L'', ''m'',\n''s'', ''u'', ''x'', optionally followed by ''-'' followed by one\nor more letters from the ''i'', ''m'', ''s'', ''x''.)  The letters\nset or remove the corresponding flags for the part of the\nexpression:\n\n* *note re.A: 2001. (ASCII-only matching)\n\n* *note re.I: 2002. (ignore case)\n\n* *note re.L: 2003. (locale dependent)\n\n* *note re.M: 2004. (multi-line)\n\n* *note re.S: 2005. (dot matches all)\n\n* *note re.U: 2006. (Unicode matching)\n\n* *note re.X: 2007. (verbose)\n\n(The flags are described in *note Module Contents: 2008.)\n\nThe letters ''a'', ''L'' and ''u'' are mutually exclusive when used\nas inline flags, so they can't be combined or follow ''-''.\nInstead, when one of them appears in an inline group, it overrides\nthe matching mode in the enclosing group.  In Unicode patterns\n'(?a:...)' switches to ASCII-only matching, and '(?u:...)' switches\nto Unicode matching (default).  In bytes patterns '(?L:...)'\nswitches to locale dependent matching, and '(?a:...)' switches to\nASCII-only matching (default).  This override is only in effect for\nthe narrow inline group, and the original matching mode is restored\noutside of the group.\n\nNew in version 3.6.\n\nChanged in version 3.7: The letters ''a'', ''L'' and ''u'' also can\nbe used in a group.\n\n'(?>...)'\n\nAttempts to match '...' as if it was a separate regular expression,\nand if successful, continues to match the rest of the pattern\nfollowing it.  If the subsequent pattern fails to match, the stack\ncan only be unwound to a point 'before' the '(?>...)' because once\nexited, the expression, known as an 'atomic group', has thrown away\nall stack points within itself.  Thus, '(?>.*).' would never match\nanything because first the '.*' would match all characters\npossible, then, having nothing left to match, the final '.' would\nfail to match.  Since there are no stack points saved in the Atomic\nGroup, and there is no stack point before it, the entire expression\nwould thus fail to match.\n\nNew in version 3.11.\n\n'(?P<name>...)'\n\nSimilar to regular parentheses, but the substring matched by the\ngroup is accessible via the symbolic group name 'name'.  Group\nnames must be valid Python identifiers, and in *note bytes: 295.\npatterns they can only contain bytes in the ASCII range.  Each\ngroup name must be defined only once within a regular expression.\nA symbolic group is also a numbered group, just as if the group\nwere not named.\n\nNamed groups can be referenced in three contexts.  If the pattern\nis '(?P<quote>['\"]).*?(?P=quote)' (i.e.  matching a string quoted\nwith either single or double quotes):\n\nContext of reference to group \"quote\"       Ways to reference it\n\n-----------------------------------------------------------------------------------\n\nin the same pattern itself                     * '(?P=quote)' (as shown)\n\n* '\\1'\n\n\nwhen processing match object 'm'               * 'm.group('quote')'\n\n* 'm.end('quote')' (etc.)\n\n\nin a string passed to the 'repl' argument      * '\\g<quote>'\nof 're.sub()'\n* '\\g<1>'\n\n* '\\1'\n\n\nChanged in version 3.12: In *note bytes: 295. patterns, group\n'name' can only contain bytes in the ASCII range\n('b'\\x00''-'b'\\x7f'').\n\n'(?P=name)'\n\nA backreference to a named group; it matches whatever text was\nmatched by the earlier group named 'name'.\n\n'(?#...)'\n\nA comment; the contents of the parentheses are simply ignored.\n\n'(?=...)'\n\nMatches if '...' matches next, but doesn't consume any of the\nstring.  This is called a 'lookahead assertion'.  For example,\n'Isaac (?=Asimov)' will match ''Isaac '' only if it's followed by\n''Asimov''.\n\n'(?!...)'\n\nMatches if '...' doesn't match next.  This is a 'negative lookahead\nassertion'.  For example, 'Isaac (?!Asimov)' will match ''Isaac ''\nonly if it's 'not' followed by ''Asimov''.\n\n'(?<=...)'\n\nMatches if the current position in the string is preceded by a\nmatch for '...' that ends at the current position.  This is called\na 'positive lookbehind assertion'.  '(?<=abc)def' will find a match\nin ''abcdef'', since the lookbehind will back up 3 characters and\ncheck if the contained pattern matches.  The contained pattern must\nonly match strings of some fixed length, meaning that 'abc' or\n'a|b' are allowed, but 'a*' and 'a{3,4}' are not.  Note that\npatterns which start with positive lookbehind assertions will not\nmatch at the beginning of the string being searched; you will most\nlikely want to use the *note search(): 10a2. function rather than\nthe *note match(): 10a3. function:\n\n>>> import re\n>>> m = re.search('(?<=abc)def', 'abcdef')\n>>> m.group(0)\n'def'\n\nThis example looks for a word following a hyphen:\n\n>>> m = re.search(r'(?<=-)\\w+', 'spam-egg')\n>>> m.group(0)\n'egg'\n\nChanged in version 3.5: Added support for group references of fixed\nlength.\n\n'(?<!...)'\n\nMatches if the current position in the string is not preceded by a\nmatch for '...'.  This is called a 'negative lookbehind assertion'.\nSimilar to positive lookbehind assertions, the contained pattern\nmust only match strings of some fixed length.  Patterns which start\nwith negative lookbehind assertions may match at the beginning of\nthe string being searched.\n\n'(?(id/name)yes-pattern|no-pattern)'\n\nWill try to match with 'yes-pattern' if the group with given 'id'\nor 'name' exists, and with 'no-pattern' if it doesn't.\n'no-pattern' is optional and can be omitted.  For example,\n'(<)?(\\w+@\\w+(?:\\.\\w+)+)(?(1)>|$)' is a poor email matching\npattern, which will match with ''<user@host.com>'' as well as\n''user@host.com'', but not with ''<user@host.com'' nor\n''user@host.com>''.\n\nChanged in version 3.12: Group 'id' can only contain ASCII digits.\nIn *note bytes: 295. patterns, group 'name' can only contain bytes\nin the ASCII range ('b'\\x00''-'b'\\x7f'').\n\nThe special sequences consist of ''\\'' and a character from the list\nbelow.  If the ordinary character is not an ASCII digit or an ASCII\nletter, then the resulting RE will match the second character.  For\nexample, '\\$' matches the character ''$''.\n\n'\\number'\n\nMatches the contents of the group of the same number.  Groups are\nnumbered starting from 1.  For example, '(.+) \\1' matches ''the\nthe'' or ''55 55'', but not ''thethe'' (note the space after the\ngroup).  This special sequence can only be used to match one of the\nfirst 99 groups.  If the first digit of 'number' is 0, or 'number'\nis 3 octal digits long, it will not be interpreted as a group\nmatch, but as the character with octal value 'number'.  Inside the\n''['' and '']'' of a character class, all numeric escapes are\ntreated as characters.\n\n'\\A'\n\nMatches only at the start of the string.\n\n'\\b'\n\nMatches the empty string, but only at the beginning or end of a\nword.  A word is defined as a sequence of word characters.  Note\nthat formally, '\\b' is defined as the boundary between a '\\w' and a\n'\\W' character (or vice versa), or between '\\w' and the beginning\nor end of the string.  This means that 'r'\\bat\\b'' matches ''at'',\n''at.'', ''(at)'', and ''as at ay'' but not ''attempt'' or\n''atlas''.\n\nThe default word characters in Unicode (str) patterns are Unicode\nalphanumerics and the underscore, but this can be changed by using\nthe *note ASCII: 3f9. flag.  Word boundaries are determined by the\ncurrent locale if the *note LOCALE: 9ac. flag is used.\n\nNote: Inside a character range, '\\b' represents the backspace\ncharacter, for compatibility with Python's string literals.\n\n'\\B'\n\nMatches the empty string, but only when it is 'not' at the\nbeginning or end of a word.  This means that 'r'at\\B'' matches\n''athens'', ''atom'', ''attorney'', but not ''at'', ''at.'', or\n''at!''.  '\\B' is the opposite of '\\b', so word characters in\nUnicode (str) patterns are Unicode alphanumerics or the underscore,\nalthough this can be changed by using the *note ASCII: 3f9. flag.\nWord boundaries are determined by the current locale if the *note\nLOCALE: 9ac. flag is used.\n\n'\\d'\n\nFor Unicode (str) patterns:\n\nMatches any Unicode decimal digit (that is, any character in\nUnicode character category [Nd](2)).  This includes '[0-9]',\nand also many other digit characters.\n\nMatches '[0-9]' if the *note ASCII: 3f9. flag is used.\n\nFor 8-bit (bytes) patterns:\n\nMatches any decimal digit in the ASCII character set; this is\nequivalent to '[0-9]'.\n\n'\\D'\n\nMatches any character which is not a decimal digit.  This is the\nopposite of '\\d'.\n\nMatches '[^0-9]' if the *note ASCII: 3f9. flag is used.\n\n'\\s'\n\nFor Unicode (str) patterns:\n\nMatches Unicode whitespace characters (which includes '[\n\\t\\n\\r\\f\\v]', and also many other characters, for example the\nnon-breaking spaces mandated by typography rules in many\nlanguages).\n\nMatches '[ \\t\\n\\r\\f\\v]' if the *note ASCII: 3f9. flag is used.\n\nFor 8-bit (bytes) patterns:\n\nMatches characters considered whitespace in the ASCII\ncharacter set; this is equivalent to '[ \\t\\n\\r\\f\\v]'.\n\n'\\S'\n\nMatches any character which is not a whitespace character.  This is\nthe opposite of '\\s'.\n\nMatches '[^ \\t\\n\\r\\f\\v]' if the *note ASCII: 3f9. flag is used.\n\n'\\w'\n\nFor Unicode (str) patterns:\n\nMatches Unicode word characters; this includes all Unicode\nalphanumeric characters (as defined by *note str.isalnum():\n1eca.), as well as the underscore ('').\n\nMatches '[a-zA-Z0-9]' if the *note ASCII: 3f9. flag is used.\n\nFor 8-bit (bytes) patterns:\n\nMatches characters considered alphanumeric in the ASCII\ncharacter set; this is equivalent to '[a-zA-Z0-9]'.  If the\n*note LOCALE: 9ac. flag is used, matches characters considered\nalphanumeric in the current locale and the underscore.\n\n'\\W'\n\nMatches any character which is not a word character.  This is the\nopposite of '\\w'.  By default, matches non-underscore ('')\ncharacters for which *note str.isalnum(): 1eca. returns 'False'.\n\nMatches '[^a-zA-Z0-9]' if the *note ASCII: 3f9. flag is used.\n\nIf the *note LOCALE: 9ac. flag is used, matches characters which\nare neither alphanumeric in the current locale nor the underscore.\n\n'\\Z'\n\nMatches only at the end of the string.\n\nMost of the *note escape sequences: 16a. supported by Python string\nliterals are also accepted by the regular expression parser:\n\n\\a      \\b      \\f      \\n\n\\N      \\r      \\t      \\u\n\\U      \\v      \\x      \\\\\n\n(Note that '\\b' is used to represent word boundaries, and means\n\"backspace\" only inside character classes.)\n\n''\\u'', ''\\U'', and ''\\N'' escape sequences are only recognized in",
            "subsections": []
        },
        "Unicode (str) patterns.  In bytes patterns they are errors.  Unknown": {
            "content": "escapes of ASCII letters are reserved for future use and treated as\nerrors.\n",
            "subsections": []
        },
        "Octal escapes are included in a limited form.  If the first digit is a": {
            "content": "0, or if there are three octal digits, it is considered an octal escape.",
            "subsections": []
        },
        "Otherwise, it is a group reference.  As for string literals, octal": {
            "content": "escapes are always at most three digits in length.\n\nChanged in version 3.3: The ''\\u'' and ''\\U'' escape sequences have been\nadded.\n\nChanged in version 3.6: Unknown escapes consisting of ''\\'' and an ASCII\nletter now are errors.\n\nChanged in version 3.8: The ''\\N{NAME}'' escape sequence has been added.\nAs in string literals, it expands to the named Unicode character (e.g.\n''\\N{EM DASH}'').\n\n---------- Footnotes ----------\n\n(1) https://unicode.org/reports/tr18/\n\n(2) https://www.unicode.org/versions/Unicode15.0.0/ch04.pdf#G134153\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Module Contents,  Next: Regular Expression Objects,  Prev: Regular Expression Syntax,  Up: re -- Regular expression operations": {
            "content": "5.6.2.2 Module Contents\n.......................\n",
            "subsections": []
        },
        "The module defines several functions, constants, and an exception.  Some": {
            "content": "of the functions are simplified versions of the full featured methods\nfor compiled regular expressions.  Most non-trivial applications always\nuse the compiled form.\n\n* Menu:\n\n* Flags::\n* Functions: Functions<2>.\n* Exceptions: Exceptions<3>.\n\nFile: python3.12.info,  Node: Flags,  Next: Functions<2>,  Up: Module Contents\n\n5.6.2.3 Flags\n.............\n\nChanged in version 3.6: Flag constants are now instances of *note\nRegexFlag: 3fa, which is a subclass of *note enum.IntFlag: 200b.\n\n-- Class: re.RegexFlag\n\nAn *note enum.IntFlag: 200b. class containing the regex options\nlisted below.\n\nNew in version 3.11: - added to 'all'\n\n-- Data: re.A\n-- Data: re.ASCII\n\nMake '\\w', '\\W', '\\b', '\\B', '\\d', '\\D', '\\s' and '\\S' perform\nASCII-only matching instead of full Unicode matching.  This is only\nmeaningful for Unicode (str) patterns, and is ignored for bytes\npatterns.\n\nCorresponds to the inline flag '(?a)'.\n\nNote: The *note U: 2006. flag still exists for backward\ncompatibility, but is redundant in Python 3 since matches are\nUnicode by default for 'str' patterns, and Unicode matching\nisn't allowed for bytes patterns.  *note UNICODE: 9ad. and the\ninline flag '(?u)' are similarly redundant.\n\n-- Data: re.DEBUG\n\nDisplay debug information about compiled expression.\n\nNo corresponding inline flag.\n\n-- Data: re.I\n-- Data: re.IGNORECASE\n\nPerform case-insensitive matching; expressions like '[A-Z]' will\nalso match lowercase letters.  Full Unicode matching (such as 'U\"'\nmatching 'u\"') also works unless the *note ASCII: 3f9. flag is used\nto disable non-ASCII matches.  The current locale does not change\nthe effect of this flag unless the *note LOCALE: 9ac. flag is also\nused.\n\nCorresponds to the inline flag '(?i)'.\n\nNote that when the Unicode patterns '[a-z]' or '[A-Z]' are used in\ncombination with the *note IGNORECASE: 1467. flag, they will match\nthe 52 ASCII letters and 4 additional non-ASCII letters: '??'\n(U+0130, Latin capital letter I with dot above), '??' (U+0131, Latin\nsmall letter dotless i), '??' (U+017F, Latin small letter long s)\nand '???' (U+212A, Kelvin sign).  If the *note ASCII: 3f9. flag is\nused, only letters 'a' to 'z' and 'A' to 'Z' are matched.\n\n-- Data: re.L\n-- Data: re.LOCALE\n\nMake '\\w', '\\W', '\\b', '\\B' and case-insensitive matching dependent\non the current locale.  This flag can be used only with bytes\npatterns.\n\nCorresponds to the inline flag '(?L)'.\n\nWarning: This flag is discouraged; consider Unicode matching\ninstead.  The locale mechanism is very unreliable as it only\nhandles one \"culture\" at a time and only works with 8-bit\nlocales.  Unicode matching is enabled by default for Unicode\n(str) patterns and it is able to handle different locales and\nlanguages.\n\nChanged in version 3.6: *note LOCALE: 9ac. can be used only with\nbytes patterns and is not compatible with *note ASCII: 3f9.\n\nChanged in version 3.7: Compiled regular expression objects with\nthe *note LOCALE: 9ac. flag no longer depend on the locale at\ncompile time.  Only the locale at matching time affects the result\nof matching.\n\n-- Data: re.M\n-- Data: re.MULTILINE\n\nWhen specified, the pattern character ''^'' matches at the\nbeginning of the string and at the beginning of each line\n(immediately following each newline); and the pattern character\n''$'' matches at the end of the string and at the end of each line\n(immediately preceding each newline).  By default, ''^'' matches\nonly at the beginning of the string, and ''$'' only at the end of\nthe string and immediately before the newline (if any) at the end\nof the string.\n\nCorresponds to the inline flag '(?m)'.\n\n-- Data: re.NOFLAG\n\nIndicates no flag being applied, the value is '0'.  This flag may\nbe used as a default value for a function keyword argument or as a\nbase value that will be conditionally ORed with other flags.\nExample of use as a default value:\n\ndef myfunc(text, flag=re.NOFLAG):\nreturn re.match(text, flag)\n\nNew in version 3.11.\n\n-- Data: re.S\n-- Data: re.DOTALL\n\nMake the ''.'' special character match any character at all,\nincluding a newline; without this flag, ''.'' will match anything\n'except' a newline.\n\nCorresponds to the inline flag '(?s)'.\n\n-- Data: re.U\n-- Data: re.UNICODE\n\nIn Python 3, Unicode characters are matched by default for 'str'\npatterns.  This flag is therefore redundant with 'no effect' and is\nonly kept for backward compatibility.\n\nSee *note ASCII: 3f9. to restrict matching to ASCII characters\ninstead.\n\n-- Data: re.X\n-- Data: re.VERBOSE\n\nThis flag allows you to write regular expressions that look nicer\nand are more readable by allowing you to visually separate logical\nsections of the pattern and add comments.  Whitespace within the\npattern is ignored, except when in a character class, or when\npreceded by an unescaped backslash, or within tokens like '*?',\n'(?:' or '(?P<...>'.  For example, '(? :' and '* ?' are not\nallowed.  When a line contains a '#' that is not in a character\nclass and is not preceded by an unescaped backslash, all characters\nfrom the leftmost such '#' through the end of the line are ignored.\n\nThis means that the two following regular expression objects that\nmatch a decimal number are functionally equal:\n\na = re.compile(r\"\"\"\\d +  # the integral part\n\\.    # the decimal point\n\\d *  # some fractional digits\"\"\", re.X)\nb = re.compile(r\"\\d+\\.\\d*\")\n\nCorresponds to the inline flag '(?x)'.\n\nFile: python3.12.info,  Node: Functions<2>,  Next: Exceptions<3>,  Prev: Flags,  Up: Module Contents\n\n5.6.2.4 Functions\n.................\n\n-- Function: re.compile (pattern, flags=0)\n\nCompile a regular expression pattern into a *note regular\nexpression object: df6, which can be used for matching using its\n*note match(): 2010, *note search(): 2011. and other methods,\ndescribed below.\n\nThe expression's behaviour can be modified by specifying a 'flags'\nvalue.  Values can be any of the *note flags: 2000. variables,\ncombined using bitwise OR (the '|' operator).\n\nThe sequence\n\nprog = re.compile(pattern)\nresult = prog.match(string)\n\nis equivalent to\n\nresult = re.match(pattern, string)\n\nbut using *note re.compile(): a17. and saving the resulting regular\nexpression object for reuse is more efficient when the expression\nwill be used several times in a single program.\n\nNote: The compiled versions of the most recent patterns passed\nto *note re.compile(): a17. and the module-level matching\nfunctions are cached, so programs that use only a few regular\nexpressions at a time needn't worry about compiling regular\nexpressions.\n\n-- Function: re.search (pattern, string, flags=0)\n\nScan through 'string' looking for the first location where the\nregular expression 'pattern' produces a match, and return a\ncorresponding *note Match: b17.  Return 'None' if no position in\nthe string matches the pattern; note that this is different from\nfinding a zero-length match at some point in the string.\n\n-- Function: re.match (pattern, string, flags=0)\n\nIf zero or more characters at the beginning of 'string' match the\nregular expression 'pattern', return a corresponding *note Match:\nb17.  Return 'None' if the string does not match the pattern; note\nthat this is different from a zero-length match.\n\nNote that even in *note MULTILINE: 1fff. mode, *note re.match():\n10a3. will only match at the beginning of the string and not at the\nbeginning of each line.\n\nIf you want to locate a match anywhere in 'string', use *note\nsearch(): 10a2. instead (see also *note search() vs.  match():\n2012.).\n\n-- Function: re.fullmatch (pattern, string, flags=0)\n\nIf the whole 'string' matches the regular expression 'pattern',\nreturn a corresponding *note Match: b17.  Return 'None' if the\nstring does not match the pattern; note that this is different from\na zero-length match.\n\nNew in version 3.4.\n\n-- Function: re.split (pattern, string, maxsplit=0, flags=0)\n\nSplit 'string' by the occurrences of 'pattern'.  If capturing\nparentheses are used in 'pattern', then the text of all groups in\nthe pattern are also returned as part of the resulting list.  If\n'maxsplit' is nonzero, at most 'maxsplit' splits occur, and the\nremainder of the string is returned as the final element of the\nlist.\n\n>>> re.split(r'\\W+', 'Words, words, words.')\n['Words', 'words', 'words', '']\n>>> re.split(r'(\\W+)', 'Words, words, words.')\n['Words', ', ', 'words', ', ', 'words', '.', '']\n>>> re.split(r'\\W+', 'Words, words, words.', 1)\n['Words', 'words, words.']\n>>> re.split('[a-f]+', '0a3B9', flags=re.IGNORECASE)\n['0', '3', '9']\n\nIf there are capturing groups in the separator and it matches at\nthe start of the string, the result will start with an empty\nstring.  The same holds for the end of the string:\n\n>>> re.split(r'(\\W+)', '...words, words...')\n['', '...', 'words', ', ', 'words', '...', '']\n\nThat way, separator components are always found at the same\nrelative indices within the result list.\n\nEmpty matches for the pattern split the string only when not\nadjacent to a previous empty match.\n\n>>> re.split(r'\\b', 'Words, words, words.')\n['', 'Words', ', ', 'words', ', ', 'words', '.']\n>>> re.split(r'\\W*', '...words...')\n['', '', 'w', 'o', 'r', 'd', 's', '', '']\n>>> re.split(r'(\\W*)', '...words...')\n['', '...', '', '', 'w', '', 'o', '', 'r', '', 'd', '', 's', '...', '', '', '']\n\nChanged in version 3.1: Added the optional flags argument.\n\nChanged in version 3.7: Added support of splitting on a pattern\nthat could match an empty string.\n\n-- Function: re.findall (pattern, string, flags=0)\n\nReturn all non-overlapping matches of 'pattern' in 'string', as a\nlist of strings or tuples.  The 'string' is scanned left-to-right,\nand matches are returned in the order found.  Empty matches are\nincluded in the result.\n\nThe result depends on the number of capturing groups in the\npattern.  If there are no groups, return a list of strings matching\nthe whole pattern.  If there is exactly one group, return a list of\nstrings matching that group.  If multiple groups are present,\nreturn a list of tuples of strings matching the groups.\nNon-capturing groups do not affect the form of the result.\n\n>>> re.findall(r'\\bf[a-z]*', 'which foot or hand fell fastest')\n['foot', 'fell', 'fastest']\n>>> re.findall(r'(\\w+)=(\\d+)', 'set width=20 and height=10')\n[('width', '20'), ('height', '10')]\n\nChanged in version 3.7: Non-empty matches can now start just after\na previous empty match.\n\n-- Function: re.finditer (pattern, string, flags=0)\n\nReturn an *note iterator: 16a9. yielding *note Match: b17. objects\nover all non-overlapping matches for the RE 'pattern' in 'string'.\nThe 'string' is scanned left-to-right, and matches are returned in\nthe order found.  Empty matches are included in the result.\n\nChanged in version 3.7: Non-empty matches can now start just after\na previous empty match.\n\n-- Function: re.sub (pattern, repl, string, count=0, flags=0)\n\nReturn the string obtained by replacing the leftmost\nnon-overlapping occurrences of 'pattern' in 'string' by the\nreplacement 'repl'.  If the pattern isn't found, 'string' is\nreturned unchanged.  'repl' can be a string or a function; if it is\na string, any backslash escapes in it are processed.  That is, '\\n'\nis converted to a single newline character, '\\r' is converted to a\ncarriage return, and so forth.  Unknown escapes of ASCII letters\nare reserved for future use and treated as errors.  Other unknown\nescapes such as '\\&' are left alone.  Backreferences, such as '\\6',\nare replaced with the substring matched by group 6 in the pattern.\nFor example:\n\n>>> re.sub(r'def\\s+([a-zA-Z][a-zA-Z0-9]*)\\s*\\(\\s*\\):',\n...        r'static PyObject*\\npy\\1(void)\\n{',\n...        'def myfunc():')\n'static PyObject*\\npymyfunc(void)\\n{'\n\nIf 'repl' is a function, it is called for every non-overlapping\noccurrence of 'pattern'.  The function takes a single *note Match:\nb17. argument, and returns the replacement string.  For example:\n\n>>> def dashrepl(matchobj):\n...     if matchobj.group(0) == '-': return ' '\n...     else: return '-'\n...\n>>> re.sub('-{1,2}', dashrepl, 'pro----gram-files')\n'pro--gram files'\n>>> re.sub(r'\\sAND\\s', ' & ', 'Baked Beans And Spam', flags=re.IGNORECASE)\n'Baked Beans & Spam'\n\nThe pattern may be a string or a *note Pattern: 1451.\n\nThe optional argument 'count' is the maximum number of pattern\noccurrences to be replaced; 'count' must be a non-negative integer.\nIf omitted or zero, all occurrences will be replaced.  Empty\nmatches for the pattern are replaced only when not adjacent to a\nprevious empty match, so 'sub('x*', '-', 'abxd')' returns\n''-a-b--d-''.\n\nIn string-type 'repl' arguments, in addition to the character\nescapes and backreferences described above, '\\g<name>' will use the\nsubstring matched by the group named 'name', as defined by the\n'(?P<name>...)' syntax.  '\\g<number>' uses the corresponding group\nnumber; '\\g<2>' is therefore equivalent to '\\2', but isn't\nambiguous in a replacement such as '\\g<2>0'.  '\\20' would be\ninterpreted as a reference to group 20, not a reference to group 2\nfollowed by the literal character ''0''.  The backreference '\\g<0>'\nsubstitutes in the entire substring matched by the RE.\n\nChanged in version 3.1: Added the optional flags argument.\n\nChanged in version 3.5: Unmatched groups are replaced with an empty\nstring.\n\nChanged in version 3.6: Unknown escapes in 'pattern' consisting of\n''\\'' and an ASCII letter now are errors.\n\nChanged in version 3.7: Unknown escapes in 'repl' consisting of\n''\\'' and an ASCII letter now are errors.\n\nChanged in version 3.7: Empty matches for the pattern are replaced\nwhen adjacent to a previous non-empty match.\n\nChanged in version 3.12: Group 'id' can only contain ASCII digits.\nIn *note bytes: 295. replacement strings, group 'name' can only\ncontain bytes in the ASCII range ('b'\\x00''-'b'\\x7f'').\n\n-- Function: re.subn (pattern, repl, string, count=0, flags=0)\n\nPerform the same operation as *note sub(): 1ff, but return a tuple\n'(newstring, numberofsubsmade)'.\n\nChanged in version 3.1: Added the optional flags argument.\n\nChanged in version 3.5: Unmatched groups are replaced with an empty\nstring.\n\n-- Function: re.escape (pattern)\n\nEscape special characters in 'pattern'.  This is useful if you want\nto match an arbitrary literal string that may have regular\nexpression metacharacters in it.  For example:\n\n>>> print(re.escape('https://www.python.org'))\nhttps://www\\.python\\.org\n\n>>> legalchars = string.asciilowercase + string.digits + \"!#$%&'*+-.^`|~:\"\n>>> print('[%s]+' % re.escape(legalchars))\n[abcdefghijklmnopqrstuvwxyz0123456789!\\#\\$%\\&'\\*\\+\\-\\.\\^`\\|\\~:]+\n\n>>> operators = ['+', '-', '*', '/', '']\n>>> print('|'.join(map(re.escape, sorted(operators, reverse=True))))\n/|\\-|\\+|\\*\\*|\\*\n\nThis function must not be used for the replacement string in *note\nsub(): 1ff. and *note subn(): 200, only backslashes should be\nescaped.  For example:\n\n>>> digitsre = r'\\d+'\n>>> sample = '/usr/sbin/sendmail - 0 errors, 12 warnings'\n>>> print(re.sub(digitsre, digitsre.replace('\\\\', r'\\\\'), sample))\n/usr/sbin/sendmail - \\d+ errors, \\d+ warnings\n\nChanged in version 3.3: The '''' character is no longer escaped.\n\nChanged in version 3.7: Only characters that can have special\nmeaning in a regular expression are escaped.  As a result, ''!'',\n''\"'', ''%'', '\"'\"', '','', ''/'', '':'', '';'', ''<'', ''='',\n''>'', ''@'', and '\"`\"' are no longer escaped.\n\n-- Function: re.purge ()\n\nClear the regular expression cache.\n\nFile: python3.12.info,  Node: Exceptions<3>,  Prev: Functions<2>,  Up: Module Contents\n\n5.6.2.5 Exceptions\n..................\n\n-- Exception: re.error (msg, pattern=None, pos=None)\n\nException raised when a string passed to one of the functions here\nis not a valid regular expression (for example, it might contain\nunmatched parentheses) or when some other error occurs during\ncompilation or matching.  It is never an error if a string contains\nno match for a pattern.  The error instance has the following\nadditional attributes:\n\n-- Attribute: msg\n\nThe unformatted error message.\n\n-- Attribute: pattern\n\nThe regular expression pattern.\n\n-- Attribute: pos\n\nThe index in 'pattern' where compilation failed (may be\n'None').\n\n-- Attribute: lineno\n\nThe line corresponding to 'pos' (may be 'None').\n\n-- Attribute: colno\n\nThe column corresponding to 'pos' (may be 'None').\n\nChanged in version 3.5: Added additional attributes.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Regular Expression Objects,  Next: Match Objects,  Prev: Module Contents,  Up: re -- Regular expression operations": {
            "content": "5.6.2.6 Regular Expression Objects\n..................................\n\n-- Class: re.Pattern\n\nCompiled regular expression object returned by *note re.compile():\na17.\n\nChanged in version 3.9: *note re.Pattern: 1451. supports '[]' to\nindicate a Unicode (str) or bytes pattern.  See *note Generic Alias\nType: 480.\n\n-- Method: Pattern.search (string[, pos[, endpos]])\n\nScan through 'string' looking for the first location where this\nregular expression produces a match, and return a corresponding\n*note Match: b17.  Return 'None' if no position in the string\nmatches the pattern; note that this is different from finding a\nzero-length match at some point in the string.\n\nThe optional second parameter 'pos' gives an index in the string\nwhere the search is to start; it defaults to '0'.  This is not\ncompletely equivalent to slicing the string; the ''^'' pattern\ncharacter matches at the real beginning of the string and at\npositions just after a newline, but not necessarily at the index\nwhere the search is to start.\n\nThe optional parameter 'endpos' limits how far the string will be\nsearched; it will be as if the string is 'endpos' characters long,\nso only the characters from 'pos' to 'endpos - 1' will be searched\nfor a match.  If 'endpos' is less than 'pos', no match will be\nfound; otherwise, if 'rx' is a compiled regular expression object,\n'rx.search(string, 0, 50)' is equivalent to 'rx.search(string[:50],\n0)'.\n\n>>> pattern = re.compile(\"d\")\n>>> pattern.search(\"dog\")     # Match at index 0\n<re.Match object; span=(0, 1), match='d'>\n>>> pattern.search(\"dog\", 1)  # No match; search doesn't include the \"d\"\n\n-- Method: Pattern.match (string[, pos[, endpos]])\n\nIf zero or more characters at the 'beginning' of 'string' match\nthis regular expression, return a corresponding *note Match: b17.\nReturn 'None' if the string does not match the pattern; note that\nthis is different from a zero-length match.\n\nThe optional 'pos' and 'endpos' parameters have the same meaning as\nfor the *note search(): 2011. method.\n\n>>> pattern = re.compile(\"o\")\n>>> pattern.match(\"dog\")      # No match as \"o\" is not at the start of \"dog\".\n>>> pattern.match(\"dog\", 1)   # Match as \"o\" is the 2nd character of \"dog\".\n<re.Match object; span=(1, 2), match='o'>\n\nIf you want to locate a match anywhere in 'string', use *note\nsearch(): 2011. instead (see also *note search() vs.  match():\n2012.).\n\n-- Method: Pattern.fullmatch (string[, pos[, endpos]])\n\nIf the whole 'string' matches this regular expression, return a\ncorresponding *note Match: b17.  Return 'None' if the string does\nnot match the pattern; note that this is different from a\nzero-length match.\n\nThe optional 'pos' and 'endpos' parameters have the same meaning as\nfor the *note search(): 2011. method.\n\n>>> pattern = re.compile(\"o[gh]\")\n>>> pattern.fullmatch(\"dog\")      # No match as \"o\" is not at the start of \"dog\".\n>>> pattern.fullmatch(\"ogre\")     # No match as not the full string matches.\n>>> pattern.fullmatch(\"doggie\", 1, 3)   # Matches within given limits.\n<re.Match object; span=(1, 3), match='og'>\n\nNew in version 3.4.\n\n-- Method: Pattern.split (string, maxsplit=0)\n\nIdentical to the *note split(): 9ae. function, using the compiled\npattern.\n\n-- Method: Pattern.findall (string[, pos[, endpos]])\n\nSimilar to the *note findall(): ea1. function, using the compiled\npattern, but also accepts optional 'pos' and 'endpos' parameters\nthat limit the search region like for *note search(): 10a2.\n\n-- Method: Pattern.finditer (string[, pos[, endpos]])\n\nSimilar to the *note finditer(): 1354. function, using the compiled\npattern, but also accepts optional 'pos' and 'endpos' parameters\nthat limit the search region like for *note search(): 10a2.\n\n-- Method: Pattern.sub (repl, string, count=0)\n\nIdentical to the *note sub(): 1ff. function, using the compiled\npattern.\n\n-- Method: Pattern.subn (repl, string, count=0)\n\nIdentical to the *note subn(): 200. function, using the compiled\npattern.\n\n-- Attribute: Pattern.flags\n\nThe regex matching flags.  This is a combination of the flags given\nto *note compile(): a17, any '(?...)' inline flags in the pattern,\nand implicit flags such as *note UNICODE: 9ad. if the pattern is a\nUnicode string.\n\n-- Attribute: Pattern.groups\n\nThe number of capturing groups in the pattern.\n\n-- Attribute: Pattern.groupindex\n\nA dictionary mapping any symbolic group names defined by '(?P<id>)'\nto group numbers.  The dictionary is empty if no symbolic groups\nwere used in the pattern.\n\n-- Attribute: Pattern.pattern\n\nThe pattern string from which the pattern object was compiled.\n\nChanged in version 3.7: Added support of *note copy.copy(): 289. and\n*note copy.deepcopy(): 9af.  Compiled regular expression objects are\nconsidered atomic.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Match Objects,  Next: Regular Expression Examples,  Prev: Regular Expression Objects,  Up: re -- Regular expression operations": {
            "content": "5.6.2.7 Match Objects\n.....................\n\nMatch objects always have a boolean value of 'True'.  Since *note\nmatch(): 2010. and *note search(): 2011. return 'None' when there is no\nmatch, you can test whether there was a match with a simple 'if'\nstatement:\n\nmatch = re.search(pattern, string)\nif match:\nprocess(match)\n\n-- Class: re.Match\n\nMatch object returned by successful 'match'es and 'search'es.\n\nChanged in version 3.9: *note re.Match: b17. supports '[]' to\nindicate a Unicode (str) or bytes match.  See *note Generic Alias\nType: 480.\n\n-- Method: Match.expand (template)\n\nReturn the string obtained by doing backslash substitution on the\ntemplate string 'template', as done by the *note sub(): 2019.\nmethod.  Escapes such as '\\n' are converted to the appropriate\ncharacters, and numeric backreferences ('\\1', '\\2') and named\nbackreferences ('\\g<1>', '\\g<name>') are replaced by the contents\nof the corresponding group.  The backreference '\\g<0>' will be\nreplaced by the entire match.\n\nChanged in version 3.5: Unmatched groups are replaced with an empty\nstring.\n\n-- Method: Match.group ([group1, ...])\n\nReturns one or more subgroups of the match.  If there is a single\nargument, the result is a single string; if there are multiple\narguments, the result is a tuple with one item per argument.\nWithout arguments, 'group1' defaults to zero (the whole match is\nreturned).  If a 'groupN' argument is zero, the corresponding\nreturn value is the entire matching string; if it is in the\ninclusive range [1..99], it is the string matching the\ncorresponding parenthesized group.  If a group number is negative\nor larger than the number of groups defined in the pattern, an\n*note IndexError: 138f. exception is raised.  If a group is\ncontained in a part of the pattern that did not match, the\ncorresponding result is 'None'.  If a group is contained in a part\nof the pattern that matched multiple times, the last match is\nreturned.\n\n>>> m = re.match(r\"(\\w+) (\\w+)\", \"Isaac Newton, physicist\")\n>>> m.group(0)       # The entire match\n'Isaac Newton'\n>>> m.group(1)       # The first parenthesized subgroup.\n'Isaac'\n>>> m.group(2)       # The second parenthesized subgroup.\n'Newton'\n>>> m.group(1, 2)    # Multiple arguments give us a tuple.\n('Isaac', 'Newton')\n\nIf the regular expression uses the '(?P<name>...)' syntax, the\n'groupN' arguments may also be strings identifying groups by their\ngroup name.  If a string argument is not used as a group name in\nthe pattern, an *note IndexError: 138f. exception is raised.\n\nA moderately complicated example:\n\n>>> m = re.match(r\"(?P<firstname>\\w+) (?P<lastname>\\w+)\", \"Malcolm Reynolds\")\n>>> m.group('firstname')\n'Malcolm'\n>>> m.group('lastname')\n'Reynolds'\n\nNamed groups can also be referred to by their index:\n\n>>> m.group(1)\n'Malcolm'\n>>> m.group(2)\n'Reynolds'\n\nIf a group matches multiple times, only the last match is\naccessible:\n\n>>> m = re.match(r\"(..)+\", \"a1b2c3\")  # Matches 3 times.\n>>> m.group(1)                        # Returns only the last match.\n'c3'\n\n-- Method: Match.getitem (g)\n\nThis is identical to 'm.group(g)'.  This allows easier access to an\nindividual group from a match:\n\n>>> m = re.match(r\"(\\w+) (\\w+)\", \"Isaac Newton, physicist\")\n>>> m[0]       # The entire match\n'Isaac Newton'\n>>> m[1]       # The first parenthesized subgroup.\n'Isaac'\n>>> m[2]       # The second parenthesized subgroup.\n'Newton'\n\nNamed groups are supported as well:\n\n>>> m = re.match(r\"(?P<firstname>\\w+) (?P<lastname>\\w+)\", \"Isaac Newton\")\n>>> m['firstname']\n'Isaac'\n>>> m['lastname']\n'Newton'\n\nNew in version 3.6.\n\n-- Method: Match.groups (default=None)\n\nReturn a tuple containing all the subgroups of the match, from 1 up\nto however many groups are in the pattern.  The 'default' argument\nis used for groups that did not participate in the match; it\ndefaults to 'None'.\n\nFor example:\n\n>>> m = re.match(r\"(\\d+)\\.(\\d+)\", \"24.1632\")\n>>> m.groups()\n('24', '1632')\n\nIf we make the decimal place and everything after it optional, not\nall groups might participate in the match.  These groups will\ndefault to 'None' unless the 'default' argument is given:\n\n>>> m = re.match(r\"(\\d+)\\.?(\\d+)?\", \"24\")\n>>> m.groups()      # Second group defaults to None.\n('24', None)\n>>> m.groups('0')   # Now, the second group defaults to '0'.\n('24', '0')\n\n-- Method: Match.groupdict (default=None)\n\nReturn a dictionary containing all the 'named' subgroups of the\nmatch, keyed by the subgroup name.  The 'default' argument is used\nfor groups that did not participate in the match; it defaults to\n'None'.  For example:\n\n>>> m = re.match(r\"(?P<firstname>\\w+) (?P<lastname>\\w+)\", \"Malcolm Reynolds\")\n>>> m.groupdict()\n{'firstname': 'Malcolm', 'lastname': 'Reynolds'}\n\n-- Method: Match.start ([group])\n-- Method: Match.end ([group])\n\nReturn the indices of the start and end of the substring matched by\n'group'; 'group' defaults to zero (meaning the whole matched\nsubstring).  Return '-1' if 'group' exists but did not contribute\nto the match.  For a match object 'm', and a group 'g' that did\ncontribute to the match, the substring matched by group 'g'\n(equivalent to 'm.group(g)') is\n\nm.string[m.start(g):m.end(g)]\n\nNote that 'm.start(group)' will equal 'm.end(group)' if 'group'\nmatched a null string.  For example, after 'm = re.search('b(c?)',\n'cba')', 'm.start(0)' is 1, 'm.end(0)' is 2, 'm.start(1)' and\n'm.end(1)' are both 2, and 'm.start(2)' raises an *note IndexError:\n138f. exception.\n\nAn example that will remove 'removethis' from email addresses:\n\n>>> email = \"tony@tiremovethisger.net\"\n>>> m = re.search(\"removethis\", email)\n>>> email[:m.start()] + email[m.end():]\n'tony@tiger.net'\n\n-- Method: Match.span ([group])\n\nFor a match 'm', return the 2-tuple '(m.start(group),\nm.end(group))'.  Note that if 'group' did not contribute to the\nmatch, this is '(-1, -1)'.  'group' defaults to zero, the entire\nmatch.\n\n-- Attribute: Match.pos\n\nThe value of 'pos' which was passed to the *note search(): 2011. or\n*note match(): 2010. method of a *note regex object: df6.  This is\nthe index into the string at which the RE engine started looking\nfor a match.\n\n-- Attribute: Match.endpos\n\nThe value of 'endpos' which was passed to the *note search(): 2011.\nor *note match(): 2010. method of a *note regex object: df6.  This\nis the index into the string beyond which the RE engine will not\ngo.\n\n-- Attribute: Match.lastindex\n\nThe integer index of the last matched capturing group, or 'None' if\nno group was matched at all.  For example, the expressions '(a)b',\n'((a)(b))', and '((ab))' will have 'lastindex == 1' if applied to\nthe string ''ab'', while the expression '(a)(b)' will have\n'lastindex == 2', if applied to the same string.\n\n-- Attribute: Match.lastgroup\n\nThe name of the last matched capturing group, or 'None' if the\ngroup didn't have a name, or if no group was matched at all.\n\n-- Attribute: Match.re\n\nThe *note regular expression object: df6. whose *note match():\n2010. or *note search(): 2011. method produced this match instance.\n\n-- Attribute: Match.string\n\nThe string passed to *note match(): 2010. or *note search(): 2011.\n\nChanged in version 3.7: Added support of *note copy.copy(): 289. and\n*note copy.deepcopy(): 9af.  Match objects are considered atomic.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Regular Expression Examples,  Prev: Match Objects,  Up: re -- Regular expression operations": {
            "content": "5.6.2.8 Regular Expression Examples\n...................................\n\n* Menu:\n\n* Checking for a Pair::\n* Simulating scanf(): Simulating scanf.\n* search() vs. match(): search vs match.\n* Making a Phonebook::\n* Text Munging::\n* Finding all Adverbs::\n* Finding all Adverbs and their Positions::\n* Raw String Notation::\n* Writing a Tokenizer::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Checking for a Pair,  Next: Simulating scanf,  Up: Regular Expression Examples": {
            "content": "5.6.2.9 Checking for a Pair\n...........................\n",
            "subsections": []
        },
        "In this example, we'll use the following helper function to display": {
            "content": "match objects a little more gracefully:\n\ndef displaymatch(match):\nif match is None:\nreturn None\nreturn '<Match: %r, groups=%r>' % (match.group(), match.groups())\n",
            "subsections": []
        },
        "Suppose you are writing a poker program where a player's hand is": {
            "content": "represented as a 5-character string with each character representing a\ncard, \"a\" for ace, \"k\" for king, \"q\" for queen, \"j\" for jack, \"t\" for\n10, and \"2\" through \"9\" representing the card with that value.\n\nTo see if a given string is a valid hand, one could do the following:\n\n>>> valid = re.compile(r\"^[a2-9tjqk]{5}$\")\n>>> displaymatch(valid.match(\"akt5q\"))  # Valid.\n\"<Match: 'akt5q', groups=()>\"\n>>> displaymatch(valid.match(\"akt5e\"))  # Invalid.\n>>> displaymatch(valid.match(\"akt\"))    # Invalid.\n>>> displaymatch(valid.match(\"727ak\"))  # Valid.\n\"<Match: '727ak', groups=()>\"\n\nThat last hand, '\"727ak\"', contained a pair, or two of the same valued\ncards.  To match this with a regular expression, one could use\nbackreferences as such:\n\n>>> pair = re.compile(r\".*(.).*\\1\")\n>>> displaymatch(pair.match(\"717ak\"))     # Pair of 7s.\n\"<Match: '717', groups=('7',)>\"\n>>> displaymatch(pair.match(\"718ak\"))     # No pairs.\n>>> displaymatch(pair.match(\"354aa\"))     # Pair of aces.\n\"<Match: '354aa', groups=('a',)>\"\n\nTo find out what card the pair consists of, one could use the *note\ngroup(): 2021. method of the match object in the following manner:\n\n>>> pair = re.compile(r\".*(.).*\\1\")\n>>> pair.match(\"717ak\").group(1)\n'7'\n\n# Error because re.match() returns None, which doesn't have a group() method:\n>>> pair.match(\"718ak\").group(1)\nTraceback (most recent call last):\nFile \"<pyshell#23>\", line 1, in <module>\nre.match(r\".*(.).*\\1\", \"718ak\").group(1)\nAttributeError: 'NoneType' object has no attribute 'group'\n\n>>> pair.match(\"354aa\").group(1)\n'a'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Simulating scanf,  Next: search vs match,  Prev: Checking for a Pair,  Up: Regular Expression Examples": {
            "content": "5.6.2.10 Simulating scanf()\n...........................\n",
            "subsections": []
        },
        "Python does not currently have an equivalent to 'scanf()'.  Regular": {
            "content": "expressions are generally more powerful, though also more verbose, than\n'scanf()' format strings.  The table below offers some more-or-less\nequivalent mappings between 'scanf()' format tokens and regular\nexpressions.\n\n'scanf()' Token                      Regular Expression\n\n---------------------------------------------------------------------------------------\n\n'%c'                                 '.'\n\n\n'%5c'                                '.{5}'\n\n\n'%d'                                 '[-+]?\\d+'\n\n\n'%e', '%E', '%f', '%g'               '[-+]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?'\n\n\n'%i'                                 '[-+]?(0[xX][\\dA-Fa-f]+|0[0-7]*|\\d+)'\n\n\n'%o'                                 '[-+]?[0-7]+'\n\n\n'%s'                                 '\\S+'\n\n\n'%u'                                 '\\d+'\n\n\n'%x', '%X'                           '[-+]?(0[xX])?[\\dA-Fa-f]+'\n\n",
            "subsections": []
        },
        "To extract the filename and numbers from a string like": {
            "content": "/usr/sbin/sendmail - 0 errors, 4 warnings\n\nyou would use a 'scanf()' format like\n\n%s - %d errors, %d warnings\n",
            "subsections": []
        },
        "The equivalent regular expression would be": {
            "content": "(\\S+) - (\\d+) errors, (\\d+) warnings\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: search vs match,  Next: Making a Phonebook,  Prev: Simulating scanf,  Up: Regular Expression Examples": {
            "content": "5.6.2.11 search() vs. match()\n.............................\n",
            "subsections": []
        },
        "Python offers different primitive operations based on regular": {
            "content": "expressions:\n\n+ *note re.match(): 10a3. checks for a match only at the beginning of\nthe string\n\n+ *note re.search(): 10a2. checks for a match anywhere in the string\n(this is what Perl does by default)\n\n+ *note re.fullmatch(): df5. checks for entire string to be a match\n\nFor example:\n\n>>> re.match(\"c\", \"abcdef\")    # No match\n>>> re.search(\"c\", \"abcdef\")   # Match\n<re.Match object; span=(2, 3), match='c'>\n>>> re.fullmatch(\"p.*n\", \"python\") # Match\n<re.Match object; span=(0, 6), match='python'>\n>>> re.fullmatch(\"r.*n\", \"python\") # No match\n\nRegular expressions beginning with ''^'' can be used with *note\nsearch(): 10a2. to restrict the match at the beginning of the string:\n\n>>> re.match(\"c\", \"abcdef\")    # No match\n>>> re.search(\"^c\", \"abcdef\")  # No match\n>>> re.search(\"^a\", \"abcdef\")  # Match\n<re.Match object; span=(0, 1), match='a'>\n\nNote however that in *note MULTILINE: 1fff. mode *note match(): 10a3.\nonly matches at the beginning of the string, whereas using *note\nsearch(): 10a2. with a regular expression beginning with ''^'' will\nmatch at the beginning of each line.\n\n>>> re.match(\"X\", \"A\\nB\\nX\", re.MULTILINE)  # No match\n>>> re.search(\"^X\", \"A\\nB\\nX\", re.MULTILINE)  # Match\n<re.Match object; span=(4, 5), match='X'>\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Making a Phonebook,  Next: Text Munging,  Prev: search vs match,  Up: Regular Expression Examples": {
            "content": "5.6.2.12 Making a Phonebook\n...........................\n\n*note split(): 9ae. splits a string into a list delimited by the passed\npattern.  The method is invaluable for converting textual data into data\nstructures that can be easily read and modified by Python as\ndemonstrated in the following example that creates a phonebook.\n",
            "subsections": []
        },
        "First, here is the input.  Normally it may come from a file, here we are": {
            "content": "using triple-quoted string syntax\n\n>>> text = \"\"\"Ross McFluff: 834.345.1254 155 Elm Street\n...\n... Ronald Heathmore: 892.345.3428 436 Finley Avenue\n... Frank Burger: 925.541.7625 662 South Dogwood Way\n...\n...\n... Heather Albrecht: 548.326.4584 919 Park Place\"\"\"\n",
            "subsections": []
        },
        "The entries are separated by one or more newlines.  Now we convert the": {
            "content": "string into a list with each nonempty line having its own entry:\n\n>>> entries = re.split(\"\\n+\", text)\n>>> entries\n['Ross McFluff: 834.345.1254 155 Elm Street',\n'Ronald Heathmore: 892.345.3428 436 Finley Avenue',\n'Frank Burger: 925.541.7625 662 South Dogwood Way',\n'Heather Albrecht: 548.326.4584 919 Park Place']\n",
            "subsections": []
        },
        "Finally, split each entry into a list with first name, last name,": {
            "content": "telephone number, and address.  We use the 'maxsplit' parameter of *note\nsplit(): 9ae. because the address has spaces, our splitting pattern, in\nit:\n\n>>> [re.split(\":? \", entry, 3) for entry in entries]\n[['Ross', 'McFluff', '834.345.1254', '155 Elm Street'],\n['Ronald', 'Heathmore', '892.345.3428', '436 Finley Avenue'],\n['Frank', 'Burger', '925.541.7625', '662 South Dogwood Way'],\n['Heather', 'Albrecht', '548.326.4584', '919 Park Place']]\n\nThe ':?' pattern matches the colon after the last name, so that it does\nnot occur in the result list.  With a 'maxsplit' of '4', we could\nseparate the house number from the street name:\n\n>>> [re.split(\":? \", entry, 4) for entry in entries]\n[['Ross', 'McFluff', '834.345.1254', '155', 'Elm Street'],\n['Ronald', 'Heathmore', '892.345.3428', '436', 'Finley Avenue'],\n['Frank', 'Burger', '925.541.7625', '662', 'South Dogwood Way'],\n['Heather', 'Albrecht', '548.326.4584', '919', 'Park Place']]\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Text Munging,  Next: Finding all Adverbs,  Prev: Making a Phonebook,  Up: Regular Expression Examples": {
            "content": "5.6.2.13 Text Munging\n.....................\n\n*note sub(): 1ff. replaces every occurrence of a pattern with a string\nor the result of a function.  This example demonstrates using *note\nsub(): 1ff. with a function to \"munge\" text, or randomize the order of\nall the characters in each word of a sentence except for the first and\nlast characters:\n\n>>> def repl(m):\n...     innerword = list(m.group(2))\n...     random.shuffle(innerword)\n...     return m.group(1) + \"\".join(innerword) + m.group(3)\n...\n>>> text = \"Professor Abdolmalek, please report your absences promptly.\"\n>>> re.sub(r\"(\\w)(\\w+)(\\w)\", repl, text)\n'Poefsrosr Aealmlobdk, pslaee reorpt your abnseces plmrptoy.'\n>>> re.sub(r\"(\\w)(\\w+)(\\w)\", repl, text)\n'Pofsroser Aodlambelk, plasee reoprt yuor asnebces potlmrpy.'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Finding all Adverbs,  Next: Finding all Adverbs and their Positions,  Prev: Text Munging,  Up: Regular Expression Examples": {
            "content": "5.6.2.14 Finding all Adverbs\n............................\n\n*note findall(): ea1. matches 'all' occurrences of a pattern, not just\nthe first one as *note search(): 10a2. does.  For example, if a writer\nwanted to find all of the adverbs in some text, they might use *note\nfindall(): ea1. in the following manner:\n\n>>> text = \"He was carefully disguised but captured quickly by police.\"\n>>> re.findall(r\"\\w+ly\\b\", text)\n['carefully', 'quickly']\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Finding all Adverbs and their Positions,  Next: Raw String Notation,  Prev: Finding all Adverbs,  Up: Regular Expression Examples": {
            "content": "5.6.2.15 Finding all Adverbs and their Positions\n................................................\n",
            "subsections": []
        },
        "If one wants more information about all matches of a pattern than the": {
            "content": "matched text, *note finditer(): 1354. is useful as it provides *note",
            "subsections": []
        },
        "Match: b17. objects instead of strings.  Continuing with the previous": {
            "content": "example, if a writer wanted to find all of the adverbs 'and their\npositions' in some text, they would use *note finditer(): 1354. in the\nfollowing manner:\n\n>>> text = \"He was carefully disguised but captured quickly by police.\"\n>>> for m in re.finditer(r\"\\w+ly\\b\", text):\n...     print('%02d-%02d: %s' % (m.start(), m.end(), m.group(0)))\n07-16: carefully\n40-47: quickly\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Raw String Notation,  Next: Writing a Tokenizer,  Prev: Finding all Adverbs and their Positions,  Up: Regular Expression Examples": {
            "content": "5.6.2.16 Raw String Notation\n............................\n\nRaw string notation ('r\"text\"') keeps regular expressions sane.  Without\nit, every backslash (''\\'') in a regular expression would have to be\nprefixed with another one to escape it.  For example, the two following\nlines of code are functionally identical:\n\n>>> re.match(r\"\\W(.)\\1\\W\", \" ff \")\n<re.Match object; span=(0, 4), match=' ff '>\n>>> re.match(\"\\\\W(.)\\\\1\\\\W\", \" ff \")\n<re.Match object; span=(0, 4), match=' ff '>\n",
            "subsections": []
        },
        "When one wants to match a literal backslash, it must be escaped in the": {
            "content": "regular expression.  With raw string notation, this means 'r\"\\\\\"'.\nWithout raw string notation, one must use '\"\\\\\\\\\"', making the following\nlines of code functionally identical:\n\n>>> re.match(r\"\\\\\", r\"\\\\\")\n<re.Match object; span=(0, 1), match='\\\\'>\n>>> re.match(\"\\\\\\\\\", r\"\\\\\")\n<re.Match object; span=(0, 1), match='\\\\'>\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Writing a Tokenizer,  Prev: Raw String Notation,  Up: Regular Expression Examples": {
            "content": "5.6.2.17 Writing a Tokenizer\n............................\n\nA tokenizer or scanner(1) analyzes a string to categorize groups of\ncharacters.  This is a useful first step in writing a compiler or\ninterpreter.\n",
            "subsections": []
        },
        "The text categories are specified with regular expressions.  The": {
            "content": "technique is to combine those into a single master regular expression\nand to loop over successive matches:\n\nfrom typing import NamedTuple\nimport re\n\nclass Token(NamedTuple):\ntype: str\nvalue: str\nline: int\ncolumn: int\n\ndef tokenize(code):\nkeywords = {'IF', 'THEN', 'ENDIF', 'FOR', 'NEXT', 'GOSUB', 'RETURN'}\ntokenspecification = [\n('NUMBER',   r'\\d+(\\.\\d*)?'),  # Integer or decimal number\n('ASSIGN',   r':='),           # Assignment operator\n('END',      r';'),            # Statement terminator\n('ID',       r'[A-Za-z]+'),    # Identifiers\n('OP',       r'[+\\-*/]'),      # Arithmetic operators\n('NEWLINE',  r'\\n'),           # Line endings\n('SKIP',     r'[ \\t]+'),       # Skip over spaces and tabs\n('MISMATCH', r'.'),            # Any other character\n]\ntokregex = '|'.join('(?P<%s>%s)' % pair for pair in tokenspecification)\nlinenum = 1\nlinestart = 0\nfor mo in re.finditer(tokregex, code):\nkind = mo.lastgroup\nvalue = mo.group()\ncolumn = mo.start() - linestart\nif kind == 'NUMBER':\nvalue = float(value) if '.' in value else int(value)\nelif kind == 'ID' and value in keywords:\nkind = value\nelif kind == 'NEWLINE':\nlinestart = mo.end()\nlinenum += 1\ncontinue\nelif kind == 'SKIP':\ncontinue\nelif kind == 'MISMATCH':\nraise RuntimeError(f'{value!r} unexpected on line {linenum}')\nyield Token(kind, value, linenum, column)\n\nstatements = '''\nIF quantity THEN\ntotal := total + price * quantity;\ntax := price * 0.05;\nENDIF;\n'''\n\nfor token in tokenize(statements):\nprint(token)\n\nThe tokenizer produces the following output:\n\nToken(type='IF', value='IF', line=2, column=4)\nToken(type='ID', value='quantity', line=2, column=7)\nToken(type='THEN', value='THEN', line=2, column=16)\nToken(type='ID', value='total', line=3, column=8)\nToken(type='ASSIGN', value=':=', line=3, column=14)\nToken(type='ID', value='total', line=3, column=17)\nToken(type='OP', value='+', line=3, column=23)\nToken(type='ID', value='price', line=3, column=25)\nToken(type='OP', value='*', line=3, column=31)\nToken(type='ID', value='quantity', line=3, column=33)\nToken(type='END', value=';', line=3, column=41)\nToken(type='ID', value='tax', line=4, column=8)\nToken(type='ASSIGN', value=':=', line=4, column=12)\nToken(type='ID', value='price', line=4, column=15)\nToken(type='OP', value='*', line=4, column=21)\nToken(type='NUMBER', value=0.05, line=4, column=23)\nToken(type='END', value=';', line=4, column=27)\nToken(type='ENDIF', value='ENDIF', line=5, column=4)\nToken(type='END', value=';', line=5, column=9)\n\n(Frie09) Friedl, Jeffrey.  Mastering Regular Expressions.  3rd ed.,\nO'Reilly Media, 2009.  The third edition of the book no longer covers",
            "subsections": []
        },
        "Python at all, but the first edition covered writing good regular": {
            "content": "expression patterns in great detail.\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Lexicalanalysis\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: difflib -- Helpers for computing deltas,  Next: textwrap -- Text wrapping and filling,  Prev: re -- Regular expression operations,  Up: Text Processing Services": {
            "content": "'Source code:' Lib/difflib.py(1)\n\n\n",
            "subsections": []
        },
        "This module provides classes and functions for comparing sequences.  It": {
            "content": "can be used for example, for comparing files, and can produce\ninformation about file differences in various formats, including HTML\nand context and unified diffs.  For comparing directories and files, see\nalso, the *note filecmp: 55. module.\n\n-- Class: difflib.SequenceMatcher\n\nThis is a flexible class for comparing pairs of sequences of any\ntype, so long as the sequence elements are *note hashable: 3db.\nThe basic algorithm predates, and is a little fancier than, an\nalgorithm published in the late 1980's by Ratcliff and Obershelp\nunder the hyperbolic name \"gestalt pattern matching.\" The idea is\nto find the longest contiguous matching subsequence that contains\nno \"junk\" elements; these \"junk\" elements are ones that are\nuninteresting in some sense, such as blank lines or whitespace.\n(Handling junk is an extension to the Ratcliff and Obershelp\nalgorithm.)  The same idea is then applied recursively to the\npieces of the sequences to the left and to the right of the\nmatching subsequence.  This does not yield minimal edit sequences,\nbut does tend to yield matches that \"look right\" to people.\n\n'Timing:' The basic Ratcliff-Obershelp algorithm is cubic time in\nthe worst case and quadratic time in the expected case.  *note\nSequenceMatcher: e8e. is quadratic time for the worst case and has\nexpected-case behavior dependent in a complicated way on how many\nelements the sequences have in common; best case time is linear.\n\n'Automatic junk heuristic:' *note SequenceMatcher: e8e. supports a\nheuristic that automatically treats certain sequence items as junk.\nThe heuristic counts how many times each individual item appears in\nthe sequence.  If an item's duplicates (after the first one)\naccount for more than 1% of the sequence and the sequence is at\nleast 200 items long, this item is marked as \"popular\" and is\ntreated as junk for the purpose of sequence matching.  This\nheuristic can be turned off by setting the 'autojunk' argument to\n'False' when creating the *note SequenceMatcher: e8e.\n\nChanged in version 3.2: Added the 'autojunk' parameter.\n\n-- Class: difflib.Differ\n\nThis is a class for comparing sequences of lines of text, and\nproducing human-readable differences or deltas.  Differ uses *note\nSequenceMatcher: e8e. both to compare sequences of lines, and to\ncompare sequences of characters within similar (near-matching)\nlines.\n\nEach line of a *note Differ: 203a. delta begins with a two-letter\ncode:\n\nCode           Meaning\n\n---------------------------------------------------------------\n\n''- ''         line unique to sequence 1\n\n\n''+ ''         line unique to sequence 2\n\n\n'' ''          line common to both sequences\n\n\n''? ''         line not present in either input sequence\n\n\nLines beginning with ''?'' attempt to guide the eye to intraline\ndifferences, and were not present in either input sequence.  These\nlines can be confusing if the sequences contain whitespace\ncharacters, such as spaces, tabs or line breaks.\n\n-- Class: difflib.HtmlDiff\n\nThis class can be used to create an HTML table (or a complete HTML\nfile containing the table) showing a side by side, line by line\ncomparison of text with inter-line and intra-line change\nhighlights.  The table can be generated in either full or\ncontextual difference mode.\n\nThe constructor for this class is:\n\n-- Method: init (tabsize=8, wrapcolumn=None, linejunk=None,\ncharjunk=ISCHARACTERJUNK)\n\nInitializes instance of *note HtmlDiff: 203b.\n\n'tabsize' is an optional keyword argument to specify tab stop\nspacing and defaults to '8'.\n\n'wrapcolumn' is an optional keyword to specify column number\nwhere lines are broken and wrapped, defaults to 'None' where\nlines are not wrapped.\n\n'linejunk' and 'charjunk' are optional keyword arguments\npassed into *note ndiff(): 203d. (used by *note HtmlDiff:\n203b. to generate the side by side HTML differences).  See\n*note ndiff(): 203d. documentation for argument default values\nand descriptions.\n\nThe following methods are public:\n\n-- Method: makefile (fromlines, tolines, fromdesc='', todesc='',\ncontext=False, numlines=5, *, charset='utf-8')\n\nCompares 'fromlines' and 'tolines' (lists of strings) and\nreturns a string which is a complete HTML file containing a\ntable showing line by line differences with inter-line and\nintra-line changes highlighted.\n\n'fromdesc' and 'todesc' are optional keyword arguments to\nspecify from/to file column header strings (both default to an\nempty string).\n\n'context' and 'numlines' are both optional keyword arguments.\nSet 'context' to 'True' when contextual differences are to be\nshown, else the default is 'False' to show the full files.\n'numlines' defaults to '5'.  When 'context' is 'True'\n'numlines' controls the number of context lines which surround\nthe difference highlights.  When 'context' is 'False'\n'numlines' controls the number of lines which are shown before\na difference highlight when using the \"next\" hyperlinks\n(setting to zero would cause the \"next\" hyperlinks to place\nthe next difference highlight at the top of the browser\nwithout any leading context).\n\nNote: 'fromdesc' and 'todesc' are interpreted as\nunescaped HTML and should be properly escaped while\nreceiving input from untrusted sources.\n\nChanged in version 3.5: 'charset' keyword-only argument was\nadded.  The default charset of HTML document changed from\n''ISO-8859-1'' to ''utf-8''.\n\n-- Method: maketable (fromlines, tolines, fromdesc='', todesc='',\ncontext=False, numlines=5)\n\nCompares 'fromlines' and 'tolines' (lists of strings) and\nreturns a string which is a complete HTML table showing line\nby line differences with inter-line and intra-line changes\nhighlighted.\n\nThe arguments for this method are the same as those for the\n*note makefile(): c4c. method.\n\n-- Function: difflib.contextdiff (a, b, fromfile='', tofile='',\nfromfiledate='', tofiledate='', n=3, lineterm='\\n')\n\nCompare 'a' and 'b' (lists of strings); return a delta (a *note\ngenerator: eda. generating the delta lines) in context diff format.\n\nContext diffs are a compact way of showing just the lines that have\nchanged plus a few lines of context.  The changes are shown in a\nbefore/after style.  The number of context lines is set by 'n'\nwhich defaults to three.\n\nBy default, the diff control lines (those with '*' or '---') are\ncreated with a trailing newline.  This is helpful so that inputs\ncreated from *note io.IOBase.readlines(): 2040. result in diffs\nthat are suitable for use with *note io.IOBase.writelines(): 2041.\nsince both the inputs and outputs have trailing newlines.\n\nFor inputs that do not have trailing newlines, set the 'lineterm'\nargument to '\"\"' so that the output will be uniformly newline free.\n\nThe context diff format normally has a header for filenames and\nmodification times.  Any or all of these may be specified using\nstrings for 'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'.\nThe modification times are normally expressed in the ISO 8601\nformat.  If not specified, the strings default to blanks.\n\n>>> import sys\n>>> from difflib import *\n>>> s1 = ['bacon\\n', 'eggs\\n', 'ham\\n', 'guido\\n']\n>>> s2 = ['python\\n', 'eggy\\n', 'hamster\\n', 'guido\\n']\n>>> sys.stdout.writelines(contextdiff(s1, s2, fromfile='before.py',\n...                        tofile='after.py'))\n* before.py",
            "subsections": []
        },
        "--- after.py": {
            "content": "* 1,4\n! bacon\n! eggs\n! ham\nguido\n--- 1,4 ----\n! python\n! eggy\n! hamster\nguido\n\nSee *note A command-line interface to difflib: 2042. for a more\ndetailed example.\n\n-- Function: difflib.getclosematches (word, possibilities, n=3,\ncutoff=0.6)\n\nReturn a list of the best \"good enough\" matches.  'word' is a\nsequence for which close matches are desired (typically a string),\nand 'possibilities' is a list of sequences against which to match\n'word' (typically a list of strings).\n\nOptional argument 'n' (default '3') is the maximum number of close\nmatches to return; 'n' must be greater than '0'.\n\nOptional argument 'cutoff' (default '0.6') is a float in the range\n[0, 1].  Possibilities that don't score at least that similar to\n'word' are ignored.\n\nThe best (no more than 'n') matches among the possibilities are\nreturned in a list, sorted by similarity score, most similar first.\n\n>>> getclosematches('appel', ['ape', 'apple', 'peach', 'puppy'])\n['apple', 'ape']\n>>> import keyword\n>>> getclosematches('wheel', keyword.kwlist)\n['while']\n>>> getclosematches('pineapple', keyword.kwlist)\n[]\n>>> getclosematches('accept', keyword.kwlist)\n['except']\n\n-- Function: difflib.ndiff (a, b, linejunk=None,\ncharjunk=ISCHARACTERJUNK)\n\nCompare 'a' and 'b' (lists of strings); return a *note Differ:\n203a.-style delta (a *note generator: eda. generating the delta\nlines).\n\nOptional keyword parameters 'linejunk' and 'charjunk' are filtering\nfunctions (or 'None'):\n\n'linejunk': A function that accepts a single string argument, and\nreturns true if the string is junk, or false if not.  The default\nis 'None'.  There is also a module-level function *note\nISLINEJUNK(): 2044, which filters out lines without visible\ncharacters, except for at most one pound character (''#'') -\nhowever the underlying *note SequenceMatcher: e8e. class does a\ndynamic analysis of which lines are so frequent as to constitute\nnoise, and this usually works better than using this function.\n\n'charjunk': A function that accepts a character (a string of length\n1), and returns if the character is junk, or false if not.  The\ndefault is module-level function *note ISCHARACTERJUNK(): 2045,\nwhich filters out whitespace characters (a blank or tab; it's a bad\nidea to include newline in this!).\n\n>>> diff = ndiff('one\\ntwo\\nthree\\n'.splitlines(keepends=True),\n...              'ore\\ntree\\nemu\\n'.splitlines(keepends=True))\n>>> print(''.join(diff), end=\"\")\n- one\n?  ^\n+ ore\n?  ^\n- two\n- three\n?  -\n+ tree\n+ emu\n\n-- Function: difflib.restore (sequence, which)\n\nReturn one of the two sequences that generated a delta.\n\nGiven a 'sequence' produced by *note Differ.compare(): 2047. or\n*note ndiff(): 203d, extract lines originating from file 1 or 2\n(parameter 'which'), stripping off line prefixes.\n\nExample:\n\n>>> diff = ndiff('one\\ntwo\\nthree\\n'.splitlines(keepends=True),\n...              'ore\\ntree\\nemu\\n'.splitlines(keepends=True))\n>>> diff = list(diff) # materialize the generated delta into a list\n>>> print(''.join(restore(diff, 1)), end=\"\")\none\ntwo\nthree\n>>> print(''.join(restore(diff, 2)), end=\"\")\nore\ntree\nemu\n\n-- Function: difflib.unifieddiff (a, b, fromfile='', tofile='',\nfromfiledate='', tofiledate='', n=3, lineterm='\\n')\n\nCompare 'a' and 'b' (lists of strings); return a delta (a *note\ngenerator: eda. generating the delta lines) in unified diff format.\n\nUnified diffs are a compact way of showing just the lines that have\nchanged plus a few lines of context.  The changes are shown in an\ninline style (instead of separate before/after blocks).  The number\nof context lines is set by 'n' which defaults to three.\n\nBy default, the diff control lines (those with '---', '+++', or\n'@@') are created with a trailing newline.  This is helpful so that\ninputs created from *note io.IOBase.readlines(): 2040. result in\ndiffs that are suitable for use with *note io.IOBase.writelines():\n2041. since both the inputs and outputs have trailing newlines.\n\nFor inputs that do not have trailing newlines, set the 'lineterm'\nargument to '\"\"' so that the output will be uniformly newline free.\n\nThe unified diff format normally has a header for filenames and\nmodification times.  Any or all of these may be specified using\nstrings for 'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'.\nThe modification times are normally expressed in the ISO 8601\nformat.  If not specified, the strings default to blanks.\n\n>>> s1 = ['bacon\\n', 'eggs\\n', 'ham\\n', 'guido\\n']\n>>> s2 = ['python\\n', 'eggy\\n', 'hamster\\n', 'guido\\n']\n>>> sys.stdout.writelines(unifieddiff(s1, s2, fromfile='before.py', tofile='after.py'))\n--- before.py\n+++ after.py\n@@ -1,4 +1,4 @@\n-bacon\n-eggs\n-ham\n+python\n+eggy\n+hamster\nguido\n\nSee *note A command-line interface to difflib: 2042. for a more\ndetailed example.\n\n-- Function: difflib.diffbytes (dfunc, a, b, fromfile=b'', tofile=b'',\nfromfiledate=b'', tofiledate=b'', n=3, lineterm=b'\\n')\n\nCompare 'a' and 'b' (lists of bytes objects) using 'dfunc'; yield a\nsequence of delta lines (also bytes) in the format returned by\n'dfunc'.  'dfunc' must be a callable, typically either *note\nunifieddiff(): 2048. or *note contextdiff(): 203f.\n\nAllows you to compare data with unknown or inconsistent encoding.\nAll inputs except 'n' must be bytes objects, not str.  Works by\nlosslessly converting all inputs (except 'n') to str, and calling\n'dfunc(a, b, fromfile, tofile, fromfiledate, tofiledate, n,\nlineterm)'.  The output of 'dfunc' is then converted back to bytes,\nso the delta lines that you receive have the same\nunknown/inconsistent encodings as 'a' and 'b'.\n\nNew in version 3.5.\n\n-- Function: difflib.ISLINEJUNK (line)\n\nReturn 'True' for ignorable lines.  The line 'line' is ignorable if\n'line' is blank or contains a single ''#'', otherwise it is not\nignorable.  Used as a default for parameter 'linejunk' in *note\nndiff(): 203d. in older versions.\n\n-- Function: difflib.ISCHARACTERJUNK (ch)\n\nReturn 'True' for ignorable characters.  The character 'ch' is\nignorable if 'ch' is a space or tab, otherwise it is not ignorable.\nUsed as a default for parameter 'charjunk' in *note ndiff(): 203d.\n\nSee also\n........\n",
            "subsections": []
        },
        "Pattern Matching: The Gestalt Approach(2)": {
            "content": "Discussion of a similar algorithm by John W. Ratcliff and D. E.\nMetzener.  This was published in Dr.  Dobb's Journal(3) in July,\n1988.\n\n* Menu:\n\n* SequenceMatcher Objects::\n* SequenceMatcher Examples::\n* Differ Objects::\n* Differ Example::\n* A command-line interface to difflib::\n* ndiff example::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/difflib.py\n\n(2)\nhttps://www.drdobbs.com/database/pattern-matching-the-gestalt-approach/184407970\n\n(3) https://www.drdobbs.com/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: SequenceMatcher Objects,  Next: SequenceMatcher Examples,  Up: difflib -- Helpers for computing deltas": {
            "content": "5.6.3.1 SequenceMatcher Objects\n...............................\n\nThe *note SequenceMatcher: e8e. class has this constructor:\n\n-- Class: difflib.SequenceMatcher (isjunk=None, a='', b='',\nautojunk=True)\n\nOptional argument 'isjunk' must be 'None' (the default) or a\none-argument function that takes a sequence element and returns\ntrue if and only if the element is \"junk\" and should be ignored.\nPassing 'None' for 'isjunk' is equivalent to passing 'lambda x:\nFalse'; in other words, no elements are ignored.  For example,\npass:\n\nlambda x: x in \" \\t\"\n\nif you're comparing lines as sequences of characters, and don't\nwant to synch up on blanks or hard tabs.\n\nThe optional arguments 'a' and 'b' are sequences to be compared;\nboth default to empty strings.  The elements of both sequences must\nbe *note hashable: 3db.\n\nThe optional argument 'autojunk' can be used to disable the\nautomatic junk heuristic.\n\nChanged in version 3.2: Added the 'autojunk' parameter.\n\nSequenceMatcher objects get three data attributes: 'bjunk' is the\nset of elements of 'b' for which 'isjunk' is 'True'; 'bpopular' is\nthe set of non-junk elements considered popular by the heuristic\n(if it is not disabled); 'b2j' is a dict mapping the remaining\nelements of 'b' to a list of positions where they occur.  All three\nare reset whenever 'b' is reset with *note setseqs(): 204b. or\n*note setseq2(): 204c.\n\nNew in version 3.2: The 'bjunk' and 'bpopular' attributes.\n\n*note SequenceMatcher: e8e. objects have the following methods:\n\n-- Method: setseqs (a, b)\n\nSet the two sequences to be compared.\n\n*note SequenceMatcher: e8e. computes and caches detailed\ninformation about the second sequence, so if you want to compare\none sequence against many sequences, use *note setseq2(): 204c. to\nset the commonly used sequence once and call *note setseq1():\n204d. repeatedly, once for each of the other sequences.\n\n-- Method: setseq1 (a)\n\nSet the first sequence to be compared.  The second sequence to\nbe compared is not changed.\n\n-- Method: setseq2 (b)\n\nSet the second sequence to be compared.  The first sequence to\nbe compared is not changed.\n\n-- Method: findlongestmatch (alo=0, ahi=None, blo=0, bhi=None)\n\nFind longest matching block in 'a[alo:ahi]' and 'b[blo:bhi]'.\n\nIf 'isjunk' was omitted or 'None', *note findlongestmatch():\n16c9. returns '(i, j, k)' such that 'a[i:i+k]' is equal to\n'b[j:j+k]', where 'alo <= i <= i+k <= ahi' and 'blo <= j <=\nj+k <= bhi'.  For all '(i', j', k')' meeting those conditions,\nthe additional conditions 'k >= k'', 'i <= i'', and if 'i ==\ni'', 'j <= j'' are also met.  In other words, of all maximal\nmatching blocks, return one that starts earliest in 'a', and\nof all those maximal matching blocks that start earliest in\n'a', return the one that starts earliest in 'b'.\n\n>>> s = SequenceMatcher(None, \" abcd\", \"abcd abcd\")\n>>> s.findlongestmatch(0, 5, 0, 9)\nMatch(a=0, b=4, size=5)\n\nIf 'isjunk' was provided, first the longest matching block is\ndetermined as above, but with the additional restriction that\nno junk element appears in the block.  Then that block is\nextended as far as possible by matching (only) junk elements\non both sides.  So the resulting block never matches on junk\nexcept as identical junk happens to be adjacent to an\ninteresting match.\n\nHere's the same example as before, but considering blanks to\nbe junk.  That prevents '' abcd'' from matching the '' abcd''\nat the tail end of the second sequence directly.  Instead only\nthe ''abcd'' can match, and matches the leftmost ''abcd'' in\nthe second sequence:\n\n>>> s = SequenceMatcher(lambda x: x==\" \", \" abcd\", \"abcd abcd\")\n>>> s.findlongestmatch(0, 5, 0, 9)\nMatch(a=1, b=0, size=4)\n\nIf no blocks match, this returns '(alo, blo, 0)'.\n\nThis method returns a *note named tuple: 417. 'Match(a, b,\nsize)'.\n\nChanged in version 3.9: Added default arguments.\n\n-- Method: getmatchingblocks ()\n\nReturn list of triples describing non-overlapping matching\nsubsequences.  Each triple is of the form '(i, j, n)', and\nmeans that 'a[i:i+n] == b[j:j+n]'.  The triples are\nmonotonically increasing in 'i' and 'j'.\n\nThe last triple is a dummy, and has the value '(len(a),\nlen(b), 0)'.  It is the only triple with 'n == 0'.  If '(i, j,\nn)' and '(i', j', n')' are adjacent triples in the list, and\nthe second is not the last triple in the list, then 'i+n < i''\nor 'j+n < j''; in other words, adjacent triples always\ndescribe non-adjacent equal blocks.\n\n>>> s = SequenceMatcher(None, \"abxcd\", \"abcd\")\n>>> s.getmatchingblocks()\n[Match(a=0, b=0, size=2), Match(a=3, b=2, size=2), Match(a=5, b=4, size=0)]\n\n-- Method: getopcodes ()\n\nReturn list of 5-tuples describing how to turn 'a' into 'b'.\nEach tuple is of the form '(tag, i1, i2, j1, j2)'.  The first\ntuple has 'i1 == j1 == 0', and remaining tuples have 'i1'\nequal to the 'i2' from the preceding tuple, and, likewise,\n'j1' equal to the previous 'j2'.\n\nThe 'tag' values are strings, with these meanings:\n\nValue               Meaning\n\n----------------------------------------------------------------------\n\n''replace''         'a[i1:i2]' should be replaced by 'b[j1:j2]'.\n\n\n''delete''          'a[i1:i2]' should be deleted.  Note that 'j1 ==\nj2' in this case.\n\n\n''insert''          'b[j1:j2]' should be inserted at 'a[i1:i1]'.\nNote that 'i1 == i2' in this case.\n\n\n''equal''           'a[i1:i2] == b[j1:j2]' (the sub-sequences are\nequal).\n\n\nFor example:\n\n>>> a = \"qabxcd\"\n>>> b = \"abycdf\"\n>>> s = SequenceMatcher(None, a, b)\n>>> for tag, i1, i2, j1, j2 in s.getopcodes():\n...     print('{:7}   a[{}:{}] --> b[{}:{}] {!r:>8} --> {!r}'.format(\n...         tag, i1, i2, j1, j2, a[i1:i2], b[j1:j2]))\ndelete    a[0:1] --> b[0:0]      'q' --> ''\nequal     a[1:3] --> b[0:2]     'ab' --> 'ab'\nreplace   a[3:4] --> b[2:3]      'x' --> 'y'\nequal     a[4:6] --> b[3:5]     'cd' --> 'cd'\ninsert    a[6:6] --> b[5:6]       '' --> 'f'\n\n-- Method: getgroupedopcodes (n=3)\n\nReturn a *note generator: eda. of groups with up to 'n' lines\nof context.\n\nStarting with the groups returned by *note getopcodes():\n204f, this method splits out smaller change clusters and\neliminates intervening ranges which have no changes.\n\nThe groups are returned in the same format as *note\ngetopcodes(): 204f.\n\n-- Method: ratio ()\n\nReturn a measure of the sequences' similarity as a float in\nthe range [0, 1].\n\nWhere T is the total number of elements in both sequences, and\nM is the number of matches, this is 2.0*M / T. Note that this\nis '1.0' if the sequences are identical, and '0.0' if they\nhave nothing in common.\n\nThis is expensive to compute if *note getmatchingblocks():\n204e. or *note getopcodes(): 204f. hasn't already been\ncalled, in which case you may want to try *note quickratio():\n2052. or *note realquickratio(): 2053. first to get an upper\nbound.\n\nNote: Caution: The result of a *note ratio(): 2051. call\nmay depend on the order of the arguments.  For instance:\n\n>>> SequenceMatcher(None, 'tide', 'diet').ratio()\n0.25\n>>> SequenceMatcher(None, 'diet', 'tide').ratio()\n0.5\n\n-- Method: quickratio ()\n\nReturn an upper bound on *note ratio(): 2051. relatively\nquickly.\n\n-- Method: realquickratio ()\n\nReturn an upper bound on *note ratio(): 2051. very quickly.\n",
            "subsections": []
        },
        "The three methods that return the ratio of matching to total characters": {
            "content": "can give different results due to differing levels of approximation,\nalthough *note quickratio(): 2052. and *note realquickratio(): 2053.\nare always at least as large as *note ratio(): 2051.:\n\n>>> s = SequenceMatcher(None, \"abcd\", \"bcde\")\n>>> s.ratio()\n0.75\n>>> s.quickratio()\n0.75\n>>> s.realquickratio()\n1.0\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: SequenceMatcher Examples,  Next: Differ Objects,  Prev: SequenceMatcher Objects,  Up: difflib -- Helpers for computing deltas": {
            "content": "5.6.3.2 SequenceMatcher Examples\n................................\n\nThis example compares two strings, considering blanks to be \"junk\":\n\n>>> s = SequenceMatcher(lambda x: x == \" \",\n...                     \"private Thread currentThread;\",\n...                     \"private volatile Thread currentThread;\")\n\n*note ratio(): 2051. returns a float in [0, 1], measuring the similarity\nof the sequences.  As a rule of thumb, a *note ratio(): 2051. value over\n0.6 means the sequences are close matches:\n\n>>> print(round(s.ratio(), 3))\n0.866\n\nIf you're only interested in where the sequences match, *note\ngetmatchingblocks(): 204e. is handy:\n\n>>> for block in s.getmatchingblocks():\n...     print(\"a[%d] and b[%d] match for %d elements\" % block)\na[0] and b[0] match for 8 elements\na[8] and b[17] match for 21 elements\na[29] and b[38] match for 0 elements\n\nNote that the last tuple returned by *note getmatchingblocks(): 204e.\nis always a dummy, '(len(a), len(b), 0)', and this is the only case in\nwhich the last tuple element (number of elements matched) is '0'.\n",
            "subsections": []
        },
        "If you want to know how to change the first sequence into the second,": {
            "content": "use *note getopcodes(): 204f.:\n\n>>> for opcode in s.getopcodes():\n...     print(\"%6s a[%d:%d] b[%d:%d]\" % opcode)\nequal a[0:8] b[0:8]\ninsert a[8:8] b[8:17]\nequal a[8:29] b[17:38]\n\nSee also\n........\n\n* The *note getclosematches(): 2043. function in this module which\nshows how simple code building on *note SequenceMatcher: e8e. can\nbe used to do useful work.\n\n* Simple version control recipe(1) for a small application built with\n*note SequenceMatcher: e8e.\n\n---------- Footnotes ----------\n\n(1) https://code.activestate.com/recipes/576729/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Differ Objects,  Next: Differ Example,  Prev: SequenceMatcher Examples,  Up: difflib -- Helpers for computing deltas": {
            "content": "5.6.3.3 Differ Objects\n......................\n\nNote that *note Differ: 203a.-generated deltas make no claim to be\n'minimal' diffs.  To the contrary, minimal diffs are often\ncounter-intuitive, because they synch up anywhere possible, sometimes\naccidental matches 100 pages apart.  Restricting synch points to\ncontiguous matches preserves some notion of locality, at the occasional\ncost of producing a longer diff.\n\nThe *note Differ: 203a. class has this constructor:\n\n-- Class: difflib.Differ (linejunk=None, charjunk=None)\n\nOptional keyword parameters 'linejunk' and 'charjunk' are for\nfilter functions (or 'None'):\n\n'linejunk': A function that accepts a single string argument, and\nreturns true if the string is junk.  The default is 'None', meaning\nthat no line is considered junk.\n\n'charjunk': A function that accepts a single character argument (a\nstring of length 1), and returns true if the character is junk.\nThe default is 'None', meaning that no character is considered\njunk.\n\nThese junk-filtering functions speed up matching to find\ndifferences and do not cause any differing lines or characters to\nbe ignored.  Read the description of the *note\nfindlongestmatch(): 16c9. method's 'isjunk' parameter for an\nexplanation.\n\n*note Differ: 203a. objects are used (deltas generated) via a\nsingle method:\n\n-- Method: compare (a, b)\n\nCompare two sequences of lines, and generate the delta (a\nsequence of lines).\n\nEach sequence must contain individual single-line strings\nending with newlines.  Such sequences can be obtained from the\n*note readlines(): 2040. method of file-like objects.  The\ndelta generated also consists of newline-terminated strings,\nready to be printed as-is via the *note writelines(): 2041.\nmethod of a file-like object.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Differ Example,  Next: A command-line interface to difflib,  Prev: Differ Objects,  Up: difflib -- Helpers for computing deltas": {
            "content": "5.6.3.4 Differ Example\n......................\n",
            "subsections": []
        },
        "This example compares two texts.  First we set up the texts, sequences": {
            "content": "of individual single-line strings ending with newlines (such sequences\ncan also be obtained from the *note readlines(): 2040. method of\nfile-like objects):\n\n>>> text1 = '''  1. Beautiful is better than ugly.\n...   2. Explicit is better than implicit.\n...   3. Simple is better than complex.\n...   4. Complex is better than complicated.\n... '''.splitlines(keepends=True)\n>>> len(text1)\n4\n>>> text1[0][-1]\n'\\n'\n>>> text2 = '''  1. Beautiful is better than ugly.\n...   3.   Simple is better than complex.\n...   4. Complicated is better than complex.\n...   5. Flat is better than nested.\n... '''.splitlines(keepends=True)\n\nNext we instantiate a Differ object:\n\n>>> d = Differ()\n\nNote that when instantiating a *note Differ: 203a. object we may pass\nfunctions to filter out line and character \"junk.\" See the *note\nDiffer(): 203a. constructor for details.\n\nFinally, we compare the two:\n\n>>> result = list(d.compare(text1, text2))\n\n'result' is a list of strings, so let's pretty-print it:\n\n>>> from pprint import pprint\n>>> pprint(result)\n['    1. Beautiful is better than ugly.\\n',\n'-   2. Explicit is better than implicit.\\n',\n'-   3. Simple is better than complex.\\n',\n'+   3.   Simple is better than complex.\\n',\n'?     ++\\n',\n'-   4. Complex is better than complicated.\\n',\n'?            ^                     ---- ^\\n',\n'+   4. Complicated is better than complex.\\n',\n'?           ++++ ^                      ^\\n',\n'+   5. Flat is better than nested.\\n']\n\nAs a single multi-line string it looks like this:\n\n>>> import sys\n>>> sys.stdout.writelines(result)\n1. Beautiful is better than ugly.\n-   2. Explicit is better than implicit.\n-   3. Simple is better than complex.\n+   3.   Simple is better than complex.\n?     ++\n-   4. Complex is better than complicated.\n?            ^                     ---- ^\n+   4. Complicated is better than complex.\n?           ++++ ^                      ^\n+   5. Flat is better than nested.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: A command-line interface to difflib,  Next: ndiff example,  Prev: Differ Example,  Up: difflib -- Helpers for computing deltas": {
            "content": "5.6.3.5 A command-line interface to difflib\n...........................................\n\nThis example shows how to use difflib to create a 'diff'-like utility.\n\n\"\"\" Command line interface to difflib.py providing diffs in four formats:\n\n* ndiff:    lists every line and highlights interline changes.\n* context:  highlights clusters of changes in a before/after format.\n* unified:  highlights clusters of changes in an inline format.\n* html:     generates side by side comparison with change highlights.\n\n\"\"\"\n\nimport sys, os, difflib, argparse\nfrom datetime import datetime, timezone\n\ndef filemtime(path):\nt = datetime.fromtimestamp(os.stat(path).stmtime,\ntimezone.utc)\nreturn t.astimezone().isoformat()\n\ndef main():\n\nparser = argparse.ArgumentParser()\nparser.addargument('-c', action='storetrue', default=False,\nhelp='Produce a context format diff (default)')\nparser.addargument('-u', action='storetrue', default=False,\nhelp='Produce a unified format diff')\nparser.addargument('-m', action='storetrue', default=False,\nhelp='Produce HTML side by side diff '\n'(can use -c and -l in conjunction)')\nparser.addargument('-n', action='storetrue', default=False,\nhelp='Produce a ndiff format diff')\nparser.addargument('-l', '--lines', type=int, default=3,\nhelp='Set number of context lines (default 3)')\nparser.addargument('fromfile')\nparser.addargument('tofile')\noptions = parser.parseargs()\n\nn = options.lines\nfromfile = options.fromfile\ntofile = options.tofile\n\nfromdate = filemtime(fromfile)\ntodate = filemtime(tofile)\nwith open(fromfile) as ff:\nfromlines = ff.readlines()\nwith open(tofile) as tf:\ntolines = tf.readlines()\n\nif options.u:\ndiff = difflib.unifieddiff(fromlines, tolines, fromfile, tofile, fromdate, todate, n=n)\nelif options.n:\ndiff = difflib.ndiff(fromlines, tolines)\nelif options.m:\ndiff = difflib.HtmlDiff().makefile(fromlines,tolines,fromfile,tofile,context=options.c,numlines=n)\nelse:\ndiff = difflib.contextdiff(fromlines, tolines, fromfile, tofile, fromdate, todate, n=n)\n\nsys.stdout.writelines(diff)\n\nif name == 'main':\nmain()\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ndiff example,  Prev: A command-line interface to difflib,  Up: difflib -- Helpers for computing deltas": {
            "content": "5.6.3.6 ndiff example\n.....................\n\nThis example shows how to use *note difflib.ndiff(): 203d.\n\n\"\"\"ndiff [-q] file1 file2\nor\nndiff (-r1 | -r2) < ndiffoutput > file1orfile2\n\nPrint a human-friendly file difference report to stdout.  Both inter-\nand intra-line differences are noted.  In the second form, recreate file1\n(-r1) or file2 (-r2) on stdout, from an ndiff report on stdin.\n\nIn the first form, if -q (\"quiet\") is not specified, the first two lines\nof output are\n\n-: file1\n+: file2\n\nEach remaining line begins with a two-letter code:\n\n\"- \"    line unique to file1\n\"+ \"    line unique to file2\n\"  \"    line common to both files\n\"? \"    line not present in either input file\n\nLines beginning with \"? \" attempt to guide the eye to intraline\ndifferences, and were not present in either input file.  These lines can be\nconfusing if the source files contain tab characters.\n\nThe first file can be recovered by retaining only lines that begin with\n\"  \" or \"- \", and deleting those 2-character prefixes; use ndiff with -r1.\n\nThe second file can be recovered similarly, but by retaining only \"  \" and\n\"+ \" lines; use ndiff with -r2; or, on Unix, the second file can be\nrecovered by piping the output through\n\nsed -n '/^[+ ] /s/^..//p'\n\"\"\"\n\nversion = 1, 7, 0\n\nimport difflib, sys\n\ndef fail(msg):\nout = sys.stderr.write\nout(msg + \"\\n\\n\")\nout(doc)\nreturn 0\n\n# open a file & return the file object; gripe and return 0 if it\n# couldn't be opened\ndef fopen(fname):\ntry:\nreturn open(fname)\nexcept IOError as detail:\nreturn fail(\"couldn't open \" + fname + \": \" + str(detail))\n\n# open two files & spray the diff to stdout; return false iff a problem\ndef fcompare(f1name, f2name):\nf1 = fopen(f1name)\nf2 = fopen(f2name)\nif not f1 or not f2:\nreturn 0\n\na = f1.readlines(); f1.close()\nb = f2.readlines(); f2.close()\nfor line in difflib.ndiff(a, b):\nprint(line, end=' ')\n\nreturn 1\n\n# crack args (sys.argv[1:] is normal) & compare;\n# return false iff a problem\n\ndef main(args):\nimport getopt\ntry:\nopts, args = getopt.getopt(args, \"qr:\")\nexcept getopt.error as detail:\nreturn fail(str(detail))\nnoisy = 1\nqseen = rseen = 0\nfor opt, val in opts:\nif opt == \"-q\":\nqseen = 1\nnoisy = 0\nelif opt == \"-r\":\nrseen = 1\nwhichfile = val\nif qseen and rseen:\nreturn fail(\"can't specify both -q and -r\")\nif rseen:\nif args:\nreturn fail(\"no args allowed with -r option\")\nif whichfile in (\"1\", \"2\"):\nrestore(whichfile)\nreturn 1\nreturn fail(\"-r value must be 1 or 2\")\nif len(args) != 2:\nreturn fail(\"need 2 filename args\")\nf1name, f2name = args\nif noisy:\nprint('-:', f1name)\nprint('+:', f2name)\nreturn fcompare(f1name, f2name)\n\n# read ndiff output from stdin, and print file1 (which=='1') or\n# file2 (which=='2') to stdout\n\ndef restore(which):\nrestored = difflib.restore(sys.stdin.readlines(), which)\nsys.stdout.writelines(restored)\n\nif name == 'main':\nmain(sys.argv[1:])\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: textwrap -- Text wrapping and filling,  Next: unicodedata -- Unicode Database,  Prev: difflib -- Helpers for computing deltas,  Up: Text Processing Services": {
            "content": "'Source code:' Lib/textwrap.py(1)\n\n\n\nThe *note textwrap: e6. module provides some convenience functions, as\nwell as *note TextWrapper: e40, the class that does all the work.  If\nyou're just wrapping or filling one or two text strings, the convenience\nfunctions should be good enough; otherwise, you should use an instance\nof *note TextWrapper: e40. for efficiency.\n\n-- Function: textwrap.wrap (text, width=70, *, initialindent='',\nsubsequentindent='', expandtabs=True,\nreplacewhitespace=True, fixsentenceendings=False,\nbreaklongwords=True, dropwhitespace=True,\nbreakonhyphens=True, tabsize=8, maxlines=None,\nplaceholder=' [...]')\n\nWraps the single paragraph in 'text' (a string) so every line is at\nmost 'width' characters long.  Returns a list of output lines,\nwithout final newlines.\n\nOptional keyword arguments correspond to the instance attributes of\n*note TextWrapper: e40, documented below.\n\nSee the *note TextWrapper.wrap(): 205e. method for additional\ndetails on how *note wrap(): 131e. behaves.\n\n-- Function: textwrap.fill (text, width=70, *, initialindent='',\nsubsequentindent='', expandtabs=True,\nreplacewhitespace=True, fixsentenceendings=False,\nbreaklongwords=True, dropwhitespace=True,\nbreakonhyphens=True, tabsize=8, maxlines=None,\nplaceholder=' [...]')\n\nWraps the single paragraph in 'text', and returns a single string\ncontaining the wrapped paragraph.  *note fill(): 131d. is shorthand\nfor\n\n\"\\n\".join(wrap(text, ...))\n\nIn particular, *note fill(): 131d. accepts exactly the same keyword\narguments as *note wrap(): 131e.\n\n-- Function: textwrap.shorten (text, width, *,\nfixsentenceendings=False, breaklongwords=True,\nbreakonhyphens=True, placeholder=' [...]')\n\nCollapse and truncate the given 'text' to fit in the given 'width'.\n\nFirst the whitespace in 'text' is collapsed (all whitespace is\nreplaced by single spaces).  If the result fits in the 'width', it\nis returned.  Otherwise, enough words are dropped from the end so\nthat the remaining words plus the 'placeholder' fit within 'width':\n\n>>> textwrap.shorten(\"Hello  world!\", width=12)\n'Hello world!'\n>>> textwrap.shorten(\"Hello  world!\", width=11)\n'Hello [...]'\n>>> textwrap.shorten(\"Hello world\", width=10, placeholder=\"...\")\n'Hello...'\n\nOptional keyword arguments correspond to the instance attributes of\n*note TextWrapper: e40, documented below.  Note that the whitespace\nis collapsed before the text is passed to the *note TextWrapper:\ne40. *note fill(): 131d. function, so changing the value of *note\ntabsize: 205f, *note expandtabs: 2060, *note dropwhitespace:\n2061, and *note replacewhitespace: 2062. will have no effect.\n\nNew in version 3.4.\n\n-- Function: textwrap.dedent (text)\n\nRemove any common leading whitespace from every line in 'text'.\n\nThis can be used to make triple-quoted strings line up with the\nleft edge of the display, while still presenting them in the source\ncode in indented form.\n\nNote that tabs and spaces are both treated as whitespace, but they\nare not equal: the lines '\" hello\"' and '\"\\thello\"' are considered\nto have no common leading whitespace.\n\nLines containing only whitespace are ignored in the input and\nnormalized to a single newline character in the output.\n\nFor example:\n\ndef test():\n# end first line with \\ to avoid the empty line!\ns = '''\\\nhello\nworld\n'''\nprint(repr(s))          # prints '    hello\\n      world\\n    '\nprint(repr(dedent(s)))  # prints 'hello\\n  world\\n'\n\n-- Function: textwrap.indent (text, prefix, predicate=None)\n\nAdd 'prefix' to the beginning of selected lines in 'text'.\n\nLines are separated by calling 'text.splitlines(True)'.\n\nBy default, 'prefix' is added to all lines that do not consist\nsolely of whitespace (including any line endings).\n\nFor example:\n\n>>> s = 'hello\\n\\n \\nworld'\n>>> indent(s, '  ')\n'  hello\\n\\n \\n  world'\n\nThe optional 'predicate' argument can be used to control which\nlines are indented.  For example, it is easy to add 'prefix' to\neven empty and whitespace-only lines:\n\n>>> print(indent(s, '+ ', lambda line: True))\n+ hello\n+\n+\n+ world\n\nNew in version 3.3.\n\n*note wrap(): 131e, *note fill(): 131d. and *note shorten(): e43. work\nby creating a *note TextWrapper: e40. instance and calling a single\nmethod on it.  That instance is not reused, so for applications that\nprocess many text strings using *note wrap(): 131e. and/or *note fill():\n131d, it may be more efficient to create your own *note TextWrapper:\ne40. object.\n",
            "subsections": []
        },
        "Text is preferably wrapped on whitespaces and right after the hyphens in": {
            "content": "hyphenated words; only then will long words be broken if necessary,\nunless *note TextWrapper.breaklongwords: 2064. is set to false.\n\n-- Class: textwrap.TextWrapper (kwargs)\n\nThe *note TextWrapper: e40. constructor accepts a number of\noptional keyword arguments.  Each keyword argument corresponds to\nan instance attribute, so for example\n\nwrapper = TextWrapper(initialindent=\"* \")\n\nis the same as\n\nwrapper = TextWrapper()\nwrapper.initialindent = \"* \"\n\nYou can re-use the same *note TextWrapper: e40. object many times,\nand you can change any of its options through direct assignment to\ninstance attributes between uses.\n\nThe *note TextWrapper: e40. instance attributes (and keyword\narguments to the constructor) are as follows:\n\n-- Attribute: width\n\n(default: '70') The maximum length of wrapped lines.  As long\nas there are no individual words in the input text longer than\n*note width: 2065, *note TextWrapper: e40. guarantees that no\noutput line will be longer than *note width: 2065. characters.\n\n-- Attribute: expandtabs\n\n(default: 'True') If true, then all tab characters in 'text'\nwill be expanded to spaces using the *note expandtabs(): 1ec8.\nmethod of 'text'.\n\n-- Attribute: tabsize\n\n(default: '8') If *note expandtabs: 2060. is true, then all\ntab characters in 'text' will be expanded to zero or more\nspaces, depending on the current column and the given tab\nsize.\n\nNew in version 3.3.\n\n-- Attribute: replacewhitespace\n\n(default: 'True') If true, after tab expansion but before\nwrapping, the *note wrap(): 131e. method will replace each\nwhitespace character with a single space.  The whitespace\ncharacters replaced are as follows: tab, newline, vertical\ntab, formfeed, and carriage return (''\\t\\n\\v\\f\\r'').\n\nNote: If *note expandtabs: 2060. is false and *note\nreplacewhitespace: 2062. is true, each tab character\nwill be replaced by a single space, which is 'not' the\nsame as tab expansion.\n\nNote: If *note replacewhitespace: 2062. is false,\nnewlines may appear in the middle of a line and cause\nstrange output.  For this reason, text should be split\ninto paragraphs (using *note str.splitlines(): 10ce. or\nsimilar) which are wrapped separately.\n\n-- Attribute: dropwhitespace\n\n(default: 'True') If true, whitespace at the beginning and\nending of every line (after wrapping but before indenting) is\ndropped.  Whitespace at the beginning of the paragraph,\nhowever, is not dropped if non-whitespace follows it.  If\nwhitespace being dropped takes up an entire line, the whole\nline is dropped.\n\n-- Attribute: initialindent\n\n(default: '''') String that will be prepended to the first\nline of wrapped output.  Counts towards the length of the\nfirst line.  The empty string is not indented.\n\n-- Attribute: subsequentindent\n\n(default: '''') String that will be prepended to all lines of\nwrapped output except the first.  Counts towards the length of\neach line except the first.\n\n-- Attribute: fixsentenceendings\n\n(default: 'False') If true, *note TextWrapper: e40. attempts\nto detect sentence endings and ensure that sentences are\nalways separated by exactly two spaces.  This is generally\ndesired for text in a monospaced font.  However, the sentence\ndetection algorithm is imperfect: it assumes that a sentence\nending consists of a lowercase letter followed by one of\n''.'', ''!'', or ''?'', possibly followed by one of ''\"'' or\n'\"'\"', followed by a space.  One problem with this algorithm\nis that it is unable to detect the difference between \"Dr.\" in\n\n[...] Dr. Frankenstein's monster [...]\n\nand \"Spot.\" in\n\n[...] See Spot. See Spot run [...]\n\n*note fixsentenceendings: 2068. is false by default.\n\nSince the sentence detection algorithm relies on\n'string.lowercase' for the definition of \"lowercase letter\",\nand a convention of using two spaces after a period to\nseparate sentences on the same line, it is specific to\nEnglish-language texts.\n\n-- Attribute: breaklongwords\n\n(default: 'True') If true, then words longer than *note width:\n2065. will be broken in order to ensure that no lines are\nlonger than *note width: 2065.  If it is false, long words\nwill not be broken, and some lines may be longer than *note\nwidth: 2065.  (Long words will be put on a line by themselves,\nin order to minimize the amount by which *note width: 2065. is\nexceeded.)\n\n-- Attribute: breakonhyphens\n\n(default: 'True') If true, wrapping will occur preferably on\nwhitespaces and right after hyphens in compound words, as it\nis customary in English.  If false, only whitespaces will be\nconsidered as potentially good places for line breaks, but you\nneed to set *note breaklongwords: 2064. to false if you want\ntruly insecable words.  Default behaviour in previous versions\nwas to always allow breaking hyphenated words.\n\n-- Attribute: maxlines\n\n(default: 'None') If not 'None', then the output will contain\nat most 'maxlines' lines, with 'placeholder' appearing at the\nend of the output.\n\nNew in version 3.4.\n\n-- Attribute: placeholder\n\n(default: '' [...]'') String that will appear at the end of\nthe output text if it has been truncated.\n\nNew in version 3.4.\n\n*note TextWrapper: e40. also provides some public methods,\nanalogous to the module-level convenience functions:\n\n-- Method: wrap (text)\n\nWraps the single paragraph in 'text' (a string) so every line\nis at most *note width: 2065. characters long.  All wrapping\noptions are taken from instance attributes of the *note\nTextWrapper: e40. instance.  Returns a list of output lines,\nwithout final newlines.  If the wrapped output has no content,\nthe returned list is empty.\n\n-- Method: fill (text)\n\nWraps the single paragraph in 'text', and returns a single\nstring containing the wrapped paragraph.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/textwrap.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: unicodedata -- Unicode Database,  Next: stringprep -- Internet String Preparation,  Prev: textwrap -- Text wrapping and filling,  Up: Text Processing Services": {
            "content": "",
            "subsections": []
        },
        "This module provides access to the Unicode Character Database (UCD)": {
            "content": "which defines character properties for all Unicode characters.  The data\ncontained in this database is compiled from the UCD version 15.0.0(1).\n",
            "subsections": []
        },
        "The module uses the same names and symbols as defined by Unicode": {
            "content": "Standard Annex #44, \"Unicode Character Database\"(2).  It defines the\nfollowing functions:\n\n-- Function: unicodedata.lookup (name)\n\nLook up character by name.  If a character with the given name is\nfound, return the corresponding character.  If not found, *note\nKeyError: 8cf. is raised.\n\nChanged in version 3.3: Support for name aliases (3) and named\nsequences (4) has been added.\n\n-- Function: unicodedata.name (chr[, default])\n\nReturns the name assigned to the character 'chr' as a string.  If\nno name is defined, 'default' is returned, or, if not given, *note\nValueError: 183. is raised.\n\n-- Function: unicodedata.decimal (chr[, default])\n\nReturns the decimal value assigned to the character 'chr' as\ninteger.  If no such value is defined, 'default' is returned, or,\nif not given, *note ValueError: 183. is raised.\n\n-- Function: unicodedata.digit (chr[, default])\n\nReturns the digit value assigned to the character 'chr' as integer.\nIf no such value is defined, 'default' is returned, or, if not\ngiven, *note ValueError: 183. is raised.\n\n-- Function: unicodedata.numeric (chr[, default])\n\nReturns the numeric value assigned to the character 'chr' as float.\nIf no such value is defined, 'default' is returned, or, if not\ngiven, *note ValueError: 183. is raised.\n\n-- Function: unicodedata.category (chr)\n\nReturns the general category assigned to the character 'chr' as\nstring.\n\n-- Function: unicodedata.bidirectional (chr)\n\nReturns the bidirectional class assigned to the character 'chr' as\nstring.  If no such value is defined, an empty string is returned.\n\n-- Function: unicodedata.combining (chr)\n\nReturns the canonical combining class assigned to the character\n'chr' as integer.  Returns '0' if no combining class is defined.\n\n-- Function: unicodedata.eastasianwidth (chr)\n\nReturns the east asian width assigned to the character 'chr' as\nstring.\n\n-- Function: unicodedata.mirrored (chr)\n\nReturns the mirrored property assigned to the character 'chr' as\ninteger.  Returns '1' if the character has been identified as a\n\"mirrored\" character in bidirectional text, '0' otherwise.\n\n-- Function: unicodedata.decomposition (chr)\n\nReturns the character decomposition mapping assigned to the\ncharacter 'chr' as string.  An empty string is returned in case no\nsuch mapping is defined.\n\n-- Function: unicodedata.normalize (form, unistr)\n\nReturn the normal form 'form' for the Unicode string 'unistr'.\nValid values for 'form' are 'NFC', 'NFKC', 'NFD', and 'NFKD'.\n\nThe Unicode standard defines various normalization forms of a\nUnicode string, based on the definition of canonical equivalence\nand compatibility equivalence.  In Unicode, several characters can\nbe expressed in various way.  For example, the character U+00C7\n(LATIN CAPITAL LETTER C WITH CEDILLA) can also be expressed as the\nsequence U+0043 (LATIN CAPITAL LETTER C) U+0327 (COMBINING\nCEDILLA).\n\nFor each character, there are two normal forms: normal form C and\nnormal form D. Normal form D (NFD) is also known as canonical\ndecomposition, and translates each character into its decomposed\nform.  Normal form C (NFC) first applies a canonical decomposition,\nthen composes pre-combined characters again.\n\nIn addition to these two forms, there are two additional normal\nforms based on compatibility equivalence.  In Unicode, certain\ncharacters are supported which normally would be unified with other\ncharacters.  For example, U+2160 (ROMAN NUMERAL ONE) is really the\nsame thing as U+0049 (LATIN CAPITAL LETTER I). However, it is\nsupported in Unicode for compatibility with existing character sets\n(e.g.  gb2312).\n\nThe normal form KD (NFKD) will apply the compatibility\ndecomposition, i.e.  replace all compatibility characters with\ntheir equivalents.  The normal form KC (NFKC) first applies the\ncompatibility decomposition, followed by the canonical composition.\n\nEven if two unicode strings are normalized and look the same to a\nhuman reader, if one has combining characters and the other\ndoesn't, they may not compare equal.\n\n-- Function: unicodedata.isnormalized (form, unistr)\n\nReturn whether the Unicode string 'unistr' is in the normal form\n'form'.  Valid values for 'form' are 'NFC', 'NFKC', 'NFD', and\n'NFKD'.\n\nNew in version 3.8.\n\nIn addition, the module exposes the following constant:\n\n-- Data: unicodedata.unidataversion\n\nThe version of the Unicode database used in this module.\n\n-- Data: unicodedata.ucd320\n\nThis is an object that has the same methods as the entire module,\nbut uses the Unicode database version 3.2 instead, for applications\nthat require this specific version of the Unicode database (such as\nIDNA).\n\nExamples:\n\n>>> import unicodedata\n>>> unicodedata.lookup('LEFT CURLY BRACKET')\n'{'\n>>> unicodedata.name('/')\n'SOLIDUS'\n>>> unicodedata.decimal('9')\n9\n>>> unicodedata.decimal('a')\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nValueError: not a decimal\n>>> unicodedata.category('A')  # 'L'etter, 'u'ppercase\n'Lu'\n>>> unicodedata.bidirectional('\\u0660') # 'A'rabic, 'N'umber\n'AN'\n\n---------- Footnotes ----------\n\n(1) https://www.unicode.org/Public/15.0.0/ucd\n\n(2) https://www.unicode.org/reports/tr44/\n\n(3) 'https://www.unicode.org/Public/15.0.0/ucd/NameAliases.txt'\n\n(4) 'https://www.unicode.org/Public/15.0.0/ucd/NamedSequences.txt'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: stringprep -- Internet String Preparation,  Next: readline -- GNU readline interface,  Prev: unicodedata -- Unicode Database,  Up: Text Processing Services": {
            "content": "'Source code:' Lib/stringprep.py(1)\n\n\n",
            "subsections": []
        },
        "When identifying things (such as host names) in the internet, it is": {
            "content": "often necessary to compare such identifications for \"equality\".  Exactly\nhow this comparison is executed may depend on the application domain,\ne.g.  whether it should be case-insensitive or not.  It may be also\nnecessary to restrict the possible identifications, to allow only\nidentifications consisting of \"printable\" characters.\n\nRFC 3454(2) defines a procedure for \"preparing\" Unicode strings in\ninternet protocols.  Before passing strings onto the wire, they are\nprocessed with the preparation procedure, after which they have a\ncertain normalized form.  The RFC defines a set of tables, which can be\ncombined into profiles.  Each profile must define which tables it uses,\nand what other optional parts of the 'stringprep' procedure are part of\nthe profile.  One example of a 'stringprep' profile is 'nameprep', which\nis used for internationalized domain names.\n\nThe module *note stringprep: ce. only exposes the tables from RFC\n3454(3).  As these tables would be very large to represent as\ndictionaries or lists, the module uses the Unicode character database\ninternally.  The module source code itself was generated using the\n'mkstringprep.py' utility.\n",
            "subsections": []
        },
        "As a result, these tables are exposed as functions, not as data": {
            "content": "structures.  There are two kinds of tables in the RFC: sets and\nmappings.  For a set, *note stringprep: ce. provides the \"characteristic\nfunction\", i.e.  a function that returns 'True' if the parameter is part\nof the set.  For mappings, it provides the mapping function: given the\nkey, it returns the associated value.  Below is a list of all functions\navailable in the module.\n\n-- Function: stringprep.intablea1 (code)\n\nDetermine whether 'code' is in tableA.1 (Unassigned code points in\nUnicode 3.2).\n\n-- Function: stringprep.intableb1 (code)\n\nDetermine whether 'code' is in tableB.1 (Commonly mapped to\nnothing).\n\n-- Function: stringprep.maptableb2 (code)\n\nReturn the mapped value for 'code' according to tableB.2 (Mapping\nfor case-folding used with NFKC).\n\n-- Function: stringprep.maptableb3 (code)\n\nReturn the mapped value for 'code' according to tableB.3 (Mapping\nfor case-folding used with no normalization).\n\n-- Function: stringprep.intablec11 (code)\n\nDetermine whether 'code' is in tableC.1.1 (ASCII space characters).\n\n-- Function: stringprep.intablec12 (code)\n\nDetermine whether 'code' is in tableC.1.2 (Non-ASCII space\ncharacters).\n\n-- Function: stringprep.intablec11c12 (code)\n\nDetermine whether 'code' is in tableC.1 (Space characters, union of\nC.1.1 and C.1.2).\n\n-- Function: stringprep.intablec21 (code)\n\nDetermine whether 'code' is in tableC.2.1 (ASCII control\ncharacters).\n\n-- Function: stringprep.intablec22 (code)\n\nDetermine whether 'code' is in tableC.2.2 (Non-ASCII control\ncharacters).\n\n-- Function: stringprep.intablec21c22 (code)\n\nDetermine whether 'code' is in tableC.2 (Control characters, union\nof C.2.1 and C.2.2).\n\n-- Function: stringprep.intablec3 (code)\n\nDetermine whether 'code' is in tableC.3 (Private use).\n\n-- Function: stringprep.intablec4 (code)\n\nDetermine whether 'code' is in tableC.4 (Non-character code\npoints).\n\n-- Function: stringprep.intablec5 (code)\n\nDetermine whether 'code' is in tableC.5 (Surrogate codes).\n\n-- Function: stringprep.intablec6 (code)\n\nDetermine whether 'code' is in tableC.6 (Inappropriate for plain\ntext).\n\n-- Function: stringprep.intablec7 (code)\n\nDetermine whether 'code' is in tableC.7 (Inappropriate for\ncanonical representation).\n\n-- Function: stringprep.intablec8 (code)\n\nDetermine whether 'code' is in tableC.8 (Change display properties\nor are deprecated).\n\n-- Function: stringprep.intablec9 (code)\n\nDetermine whether 'code' is in tableC.9 (Tagging characters).\n\n-- Function: stringprep.intabled1 (code)\n\nDetermine whether 'code' is in tableD.1 (Characters with\nbidirectional property \"R\" or \"AL\").\n\n-- Function: stringprep.intabled2 (code)\n\nDetermine whether 'code' is in tableD.2 (Characters with\nbidirectional property \"L\").\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/stringprep.py\n\n(2) https://datatracker.ietf.org/doc/html/rfc3454.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc3454.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: readline -- GNU readline interface,  Next: rlcompleter -- Completion function for GNU readline,  Prev: stringprep -- Internet String Preparation,  Up: Text Processing Services": {
            "content": "The *note readline: b5. module defines a number of functions to\nfacilitate completion and reading/writing of history files from the\nPython interpreter.  This module can be used directly, or via the *note\nrlcompleter: b8. module, which supports completion of Python identifiers\nat the interactive prompt.  Settings made using this module affect the\nbehaviour of both the interpreter's interactive prompt and the prompts\noffered by the built-in *note input(): 114d. function.\n",
            "subsections": []
        },
        "Readline keybindings may be configured via an initialization file,": {
            "content": "typically '.inputrc' in your home directory.  See Readline Init File(1)\nin the GNU Readline manual for information about the format and\nallowable constructs of that file, and the capabilities of the Readline\nlibrary in general.\n\nNote: The underlying Readline library API may be implemented by the\n'libedit' library instead of GNU readline.  On macOS the *note\nreadline: b5. module detects which library is being used at run\ntime.\n\nThe configuration file for 'libedit' is different from that of GNU\nreadline.  If you programmatically load configuration strings you\ncan check for the text \"libedit\" in 'readline.doc' to\ndifferentiate between GNU readline and libedit.\n\nIf you use 'editline'/'libedit' readline emulation on macOS, the\ninitialization file located in your home directory is named\n'.editrc'.  For example, the following content in '~/.editrc' will\nturn ON 'vi' keybindings and TAB completion:\n\npython:bind -v\npython:bind ^I rlcomplete\n\n* Menu:\n\n* Init file::\n* Line buffer::\n* History file::\n* History list::\n* Startup hooks::\n* Completion::\n* Example::\n\n---------- Footnotes ----------\n\n(1)\nhttps://tiswww.cwru.edu/php/chet/readline/rluserman.html#Readline-Init-File\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Init file,  Next: Line buffer,  Up: readline -- GNU readline interface": {
            "content": "5.6.7.1 Init file\n.................\n\nThe following functions relate to the init file and user configuration:\n\n-- Function: readline.parseandbind (string)\n\nExecute the init line provided in the 'string' argument.  This\ncalls 'rlparseandbind()' in the underlying library.\n\n-- Function: readline.readinitfile ([filename])\n\nExecute a readline initialization file.  The default filename is\nthe last filename used.  This calls 'rlreadinitfile()' in the\nunderlying library.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Line buffer,  Next: History file,  Prev: Init file,  Up: readline -- GNU readline interface": {
            "content": "5.6.7.2 Line buffer\n...................\n\nThe following functions operate on the line buffer:\n\n-- Function: readline.getlinebuffer ()\n\nReturn the current contents of the line buffer ('rllinebuffer' in\nthe underlying library).\n\n-- Function: readline.inserttext (string)\n\nInsert text into the line buffer at the cursor position.  This\ncalls 'rlinserttext()' in the underlying library, but ignores the\nreturn value.\n\n-- Function: readline.redisplay ()\n\nChange what's displayed on the screen to reflect the current\ncontents of the line buffer.  This calls 'rlredisplay()' in the\nunderlying library.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: History file,  Next: History list,  Prev: Line buffer,  Up: readline -- GNU readline interface": {
            "content": "5.6.7.3 History file\n....................\n\nThe following functions operate on a history file:\n\n-- Function: readline.readhistoryfile ([filename])\n\nLoad a readline history file, and append it to the history list.\nThe default filename is '~/.history'.  This calls 'readhistory()'\nin the underlying library.\n\n-- Function: readline.writehistoryfile ([filename])\n\nSave the history list to a readline history file, overwriting any\nexisting file.  The default filename is '~/.history'.  This calls\n'writehistory()' in the underlying library.\n\n-- Function: readline.appendhistoryfile (nelements[, filename])\n\nAppend the last 'nelements' items of history to a file.  The\ndefault filename is '~/.history'.  The file must already exist.\nThis calls 'appendhistory()' in the underlying library.  This\nfunction only exists if Python was compiled for a version of the\nlibrary that supports it.\n\nNew in version 3.5.\n\n-- Function: readline.gethistorylength ()\n-- Function: readline.sethistorylength (length)\n\nSet or return the desired number of lines to save in the history\nfile.  The *note writehistoryfile(): 2096. function uses this\nvalue to truncate the history file, by calling\n'historytruncatefile()' in the underlying library.  Negative\nvalues imply unlimited history file size.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: History list,  Next: Startup hooks,  Prev: History file,  Up: readline -- GNU readline interface": {
            "content": "5.6.7.4 History list\n....................\n\nThe following functions operate on a global history list:\n\n-- Function: readline.clearhistory ()\n\nClear the current history.  This calls 'clearhistory()' in the\nunderlying library.  The Python function only exists if Python was\ncompiled for a version of the library that supports it.\n\n-- Function: readline.getcurrenthistorylength ()\n\nReturn the number of items currently in the history.  (This is\ndifferent from *note gethistorylength(): 2097, which returns the\nmaximum number of lines that will be written to a history file.)\n\n-- Function: readline.gethistoryitem (index)\n\nReturn the current contents of history item at 'index'.  The item\nindex is one-based.  This calls 'historyget()' in the underlying\nlibrary.\n\n-- Function: readline.removehistoryitem (pos)\n\nRemove history item specified by its position from the history.\nThe position is zero-based.  This calls 'removehistory()' in the\nunderlying library.\n\n-- Function: readline.replacehistoryitem (pos, line)\n\nReplace history item specified by its position with 'line'.  The\nposition is zero-based.  This calls 'replacehistoryentry()' in\nthe underlying library.\n\n-- Function: readline.addhistory (line)\n\nAppend 'line' to the history buffer, as if it was the last line\ntyped.  This calls 'addhistory()' in the underlying library.\n\n-- Function: readline.setautohistory (enabled)\n\nEnable or disable automatic calls to 'addhistory()' when reading\ninput via readline.  The 'enabled' argument should be a Boolean\nvalue that when true, enables auto history, and that when false,\ndisables auto history.\n\nNew in version 3.6.\n\n'CPython implementation detail:' Auto history is enabled by\ndefault, and changes to this do not persist across multiple\nsessions.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Startup hooks,  Next: Completion,  Prev: History list,  Up: readline -- GNU readline interface": {
            "content": "5.6.7.5 Startup hooks\n.....................\n\n-- Function: readline.setstartuphook ([function])\n\nSet or remove the function invoked by the 'rlstartuphook'\ncallback of the underlying library.  If 'function' is specified, it\nwill be used as the new hook function; if omitted or 'None', any\nfunction already installed is removed.  The hook is called with no\narguments just before readline prints the first prompt.\n\n-- Function: readline.setpreinputhook ([function])\n\nSet or remove the function invoked by the 'rlpreinputhook'\ncallback of the underlying library.  If 'function' is specified, it\nwill be used as the new hook function; if omitted or 'None', any\nfunction already installed is removed.  The hook is called with no\narguments after the first prompt has been printed and just before\nreadline starts reading input characters.  This function only\nexists if Python was compiled for a version of the library that\nsupports it.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Completion,  Next: Example,  Prev: Startup hooks,  Up: readline -- GNU readline interface": {
            "content": "5.6.7.6 Completion\n..................\n",
            "subsections": []
        },
        "The following functions relate to implementing a custom word completion": {
            "content": "function.  This is typically operated by the Tab key, and can suggest\nand automatically complete a word being typed.  By default, Readline is\nset up to be used by *note rlcompleter: b8. to complete Python\nidentifiers for the interactive interpreter.  If the *note readline: b5.\nmodule is to be used with a custom completer, a different set of word\ndelimiters should be set.\n\n-- Function: readline.setcompleter ([function])\n\nSet or remove the completer function.  If 'function' is specified,\nit will be used as the new completer function; if omitted or\n'None', any completer function already installed is removed.  The\ncompleter function is called as 'function(text, state)', for\n'state' in '0', '1', '2', ..., until it returns a non-string value.\nIt should return the next possible completion starting with 'text'.\n\nThe installed completer function is invoked by the 'entryfunc'\ncallback passed to 'rlcompletionmatches()' in the underlying\nlibrary.  The 'text' string comes from the first parameter to the\n'rlattemptedcompletionfunction' callback of the underlying\nlibrary.\n\n-- Function: readline.getcompleter ()\n\nGet the completer function, or 'None' if no completer function has\nbeen set.\n\n-- Function: readline.getcompletiontype ()\n\nGet the type of completion being attempted.  This returns the\n'rlcompletiontype' variable in the underlying library as an\ninteger.\n\n-- Function: readline.getbegidx ()\n-- Function: readline.getendidx ()\n\nGet the beginning or ending index of the completion scope.  These\nindexes are the 'start' and 'end' arguments passed to the\n'rlattemptedcompletionfunction' callback of the underlying\nlibrary.  The values may be different in the same input editing\nscenario based on the underlying C readline implementation.  Ex:\nlibedit is known to behave differently than libreadline.\n\n-- Function: readline.setcompleterdelims (string)\n-- Function: readline.getcompleterdelims ()\n\nSet or get the word delimiters for completion.  These determine the\nstart of the word to be considered for completion (the completion\nscope).  These functions access the\n'rlcompleterwordbreakcharacters' variable in the underlying\nlibrary.\n\n-- Function: readline.setcompletiondisplaymatcheshook ([function])\n\nSet or remove the completion display function.  If 'function' is\nspecified, it will be used as the new completion display function;\nif omitted or 'None', any completion display function already\ninstalled is removed.  This sets or clears the\n'rlcompletiondisplaymatcheshook' callback in the underlying\nlibrary.  The completion display function is called as\n'function(substitution, [matches], longestmatchlength)' once each\ntime matches need to be displayed.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Example,  Prev: Completion,  Up: readline -- GNU readline interface": {
            "content": "5.6.7.7 Example\n...............\n\nThe following example demonstrates how to use the *note readline: b5.\nmodule's history reading and writing functions to automatically load and\nsave a history file named '.pythonhistory' from the user's home\ndirectory.  The code below would normally be executed automatically\nduring interactive sessions from the user's *note PYTHONSTARTUP: e3b.\nfile.\n\nimport atexit\nimport os\nimport readline\n\nhistfile = os.path.join(os.path.expanduser(\"~\"), \".pythonhistory\")\ntry:\nreadline.readhistoryfile(histfile)\n# default history len is -1 (infinite), which may grow unruly\nreadline.sethistorylength(1000)\nexcept FileNotFoundError:\npass\n\natexit.register(readline.writehistoryfile, histfile)\n\nThis code is actually automatically run when Python is run in *note\ninteractive mode: e39. (see *note Readline configuration: e3c.).\n",
            "subsections": []
        },
        "The following example achieves the same goal but supports concurrent": {
            "content": "interactive sessions, by only appending the new history.\n\nimport atexit\nimport os\nimport readline\nhistfile = os.path.join(os.path.expanduser(\"~\"), \".pythonhistory\")\n\ntry:\nreadline.readhistoryfile(histfile)\nhlen = readline.getcurrenthistorylength()\nexcept FileNotFoundError:\nopen(histfile, 'wb').close()\nhlen = 0\n\ndef save(prevhlen, histfile):\nnewhlen = readline.getcurrenthistorylength()\nreadline.sethistorylength(1000)\nreadline.appendhistoryfile(newhlen - prevhlen, histfile)\natexit.register(save, hlen, histfile)\n\nThe following example extends the *note code.InteractiveConsole: 20aa.\nclass to support history save/restore.\n\nimport atexit\nimport code\nimport os\nimport readline\n\nclass HistoryConsole(code.InteractiveConsole):\ndef init(self, locals=None, filename=\"<console>\",\nhistfile=os.path.expanduser(\"~/.console-history\")):\ncode.InteractiveConsole.init(self, locals, filename)\nself.inithistory(histfile)\n\ndef inithistory(self, histfile):\nreadline.parseandbind(\"tab: complete\")\nif hasattr(readline, \"readhistoryfile\"):\ntry:\nreadline.readhistoryfile(histfile)\nexcept FileNotFoundError:\npass\natexit.register(self.savehistory, histfile)\n\ndef savehistory(self, histfile):\nreadline.sethistorylength(1000)\nreadline.writehistoryfile(histfile)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: rlcompleter -- Completion function for GNU readline,  Prev: readline -- GNU readline interface,  Up: Text Processing Services": {
            "content": "'Source code:' Lib/rlcompleter.py(1)\n\n\n",
            "subsections": []
        },
        "The 'rlcompleter' module defines a completion function suitable to be": {
            "content": "passed to *note setcompleter(): 20a3. in the *note readline: b5.\nmodule.\n\nWhen this module is imported on a Unix platform with the *note readline:\nb5. module available, an instance of the *note Completer: 16ab. class is\nautomatically created and its *note complete(): 20ad. method is set as\nthe *note readline completer: 20a2.  The method provides completion of\nvalid Python *note identifiers and keywords: 1bb5.\n\nExample:\n\n>>> import rlcompleter\n>>> import readline\n>>> readline.parseandbind(\"tab: complete\")\n>>> readline. <TAB PRESSED>\nreadline.doc          readline.getlinebuffer(  readline.readinitfile(\nreadline.file         readline.inserttext(      readline.setcompleter(\nreadline.name         readline.parseandbind(\n>>> readline.\n\nThe 'rlcompleter' module is designed for use with Python's *note\ninteractive mode: e39.  Unless Python is run with the *note -S: 101c.\noption, the module is automatically imported and configured (see *note\nReadline configuration: e3c.).\n\nOn platforms without *note readline: b5, the *note Completer: 16ab.\nclass defined by this module can still be used for custom purposes.\n\n-- Class: rlcompleter.Completer\n\nCompleter objects have the following method:\n\n-- Method: complete (text, state)\n\nReturn the next possible completion for 'text'.\n\nWhen called by the *note readline: b5. module, this method is\ncalled successively with 'state == 0, 1, 2, ...' until the\nmethod returns 'None'.\n\nIf called for 'text' that doesn't include a period character\n(''.''), it will complete from names currently defined in\n*note main: 1, *note builtins: 10. and keywords (as\ndefined by the *note keyword: 7e. module).\n\nIf called for a dotted name, it will try to evaluate anything\nwithout obvious side-effects (functions will not be evaluated,\nbut it can generate calls to *note getattr(): 1f8.) up to\nthe last part, and find matches for the rest via the *note\ndir(): 3ff. function.  Any exception raised during the\nevaluation of the expression is caught, silenced and *note\nNone: 43f. is returned.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/rlcompleter.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Binary Data Services,  Next: Data Types,  Prev: Text Processing Services,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.7 Binary Data Services",
                    "content": ""
                }
            ]
        },
        "The modules described in this chapter provide some basic services": {
            "content": "operations for manipulation of binary data.  Other operations on binary\ndata, specifically in relation to file formats and network protocols,\nare described in the relevant sections.\n\nSome libraries described under *note Text Processing Services: 1ec5.\nalso work with either ASCII-compatible binary formats (for example,\n*note re: b4.) or all binary data (for example, *note difflib: 34.).\n",
            "subsections": []
        },
        "In addition, see the documentation for Python's built-in binary data": {
            "content": "types in *note Binary Sequence Types -- bytes, bytearray, memoryview:\n1e6a.\n\n* Menu:\n\n* struct -- Interpret bytes as packed binary data::\n* codecs -- Codec registry and base classes::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: struct -- Interpret bytes as packed binary data,  Next: codecs -- Codec registry and base classes,  Up: Binary Data Services": {
            "content": "'Source code:' Lib/struct.py(1)\n\n\n",
            "subsections": []
        },
        "This module converts between Python values and C structs represented as": {
            "content": "Python *note bytes: 295. objects.  Compact *note format strings: 20b3.\ndescribe the intended conversions to/from Python values.  The module's\nfunctions and objects can be used for two largely distinct applications,\ndata exchange with external sources (files or network connections), or\ndata transfer between the Python application and the C layer.\n\nNote: When no prefix character is given, native mode is the\ndefault.  It packs or unpacks data based on the platform and\ncompiler on which the Python interpreter was built.  The result of\npacking a given C struct includes pad bytes which maintain proper\nalignment for the C types involved; similarly, alignment is taken\ninto account when unpacking.  In contrast, when communicating data\nbetween external sources, the programmer is responsible for\ndefining byte ordering and padding between elements.  See *note\nByte Order, Size, and Alignment: 20b4. for details.\n\nSeveral *note struct: cf. functions (and methods of *note Struct: 13e7.)\ntake a 'buffer' argument.  This refers to objects that implement the\n*note Buffer Protocol: 148. and provide either a readable or\nread-writable buffer.  The most common types used for that purpose are\n*note bytes: 295. and *note bytearray: 294, but many other types that\ncan be viewed as an array of bytes implement the buffer protocol, so\nthat they can be read/filled without additional copying from a *note\nbytes: 295. object.\n\n* Menu:\n\n* Functions and Exceptions::\n* Format Strings::\n* Applications::\n* Classes: Classes<3>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/struct.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Functions and Exceptions,  Next: Format Strings,  Up: struct -- Interpret bytes as packed binary data": {
            "content": "5.7.1.1 Functions and Exceptions\n................................\n\nThe module defines the following exception and functions:\n\n-- Exception: struct.error\n\nException raised on various occasions; argument is a string\ndescribing what is wrong.\n\n-- Function: struct.pack (format, v1, v2, ...)\n\nReturn a bytes object containing the values 'v1', 'v2', ... packed\naccording to the format string 'format'.  The arguments must match\nthe values required by the format exactly.\n\n-- Function: struct.packinto (format, buffer, offset, v1, v2, ...)\n\nPack the values 'v1', 'v2', ... according to the format string\n'format' and write the packed bytes into the writable buffer\n'buffer' starting at position 'offset'.  Note that 'offset' is a\nrequired argument.\n\n-- Function: struct.unpack (format, buffer)\n\nUnpack from the buffer 'buffer' (presumably packed by 'pack(format,\n...)') according to the format string 'format'.  The result is a\ntuple even if it contains exactly one item.  The buffer's size in\nbytes must match the size required by the format, as reflected by\n*note calcsize(): 1733.\n\n-- Function: struct.unpackfrom (format, /, buffer, offset=0)\n\nUnpack from 'buffer' starting at position 'offset', according to\nthe format string 'format'.  The result is a tuple even if it\ncontains exactly one item.  The buffer's size in bytes, starting at\nposition 'offset', must be at least the size required by the\nformat, as reflected by *note calcsize(): 1733.\n\n-- Function: struct.iterunpack (format, buffer)\n\nIteratively unpack from the buffer 'buffer' according to the format\nstring 'format'.  This function returns an iterator which will read\nequally sized chunks from the buffer until all its contents have\nbeen consumed.  The buffer's size in bytes must be a multiple of\nthe size required by the format, as reflected by *note calcsize():\n1733.\n\nEach iteration yields a tuple as specified by the format string.\n\nNew in version 3.4.\n\n-- Function: struct.calcsize (format)\n\nReturn the size of the struct (and hence of the bytes object\nproduced by 'pack(format, ...)') corresponding to the format string\n'format'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Format Strings,  Next: Applications,  Prev: Functions and Exceptions,  Up: struct -- Interpret bytes as packed binary data": {
            "content": "5.7.1.2 Format Strings\n......................\n\nFormat strings describe the data layout when packing and unpacking data.\nThey are built up from *note format characters: 20b9, which specify the\ntype of data being packed/unpacked.  In addition, special characters\ncontrol the *note byte order, size and alignment: 20b4.  Each format\nstring consists of an optional prefix character which describes the\noverall properties of the data and one or more format characters which\ndescribe the actual data values and padding.\n\n* Menu:\n\n* Byte Order, Size, and Alignment: Byte Order Size and Alignment.\n* Format Characters::\n* Examples: Examples<2>.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Byte Order Size and Alignment,  Next: Format Characters,  Up: Format Strings": {
            "content": "5.7.1.3 Byte Order, Size, and Alignment\n.......................................\n",
            "subsections": []
        },
        "By default, C types are represented in the machine's native format and": {
            "content": "byte order, and properly aligned by skipping pad bytes if necessary\n(according to the rules used by the C compiler).  This behavior is\nchosen so that the bytes of a packed struct correspond exactly to the\nmemory layout of the corresponding C struct.  Whether to use native byte\nordering and padding or standard formats depends on the application.\n",
            "subsections": []
        },
        "Alternatively, the first character of the format string can be used to": {
            "content": "indicate the byte order, size and alignment of the packed data,\naccording to the following table:\n",
            "subsections": []
        },
        "Character       Byte order                   Size           Alignment": {
            "content": "----------------------------------------------------------------------------\n\n'@'             native                       native         native\n\n\n'='             native                       standard       none\n\n\n'<'             little-endian                standard       none\n\n\n'>'             big-endian                   standard       none\n\n\n'!'             network (= big-endian)       standard       none\n\n\nIf the first character is not one of these, ''@'' is assumed.\n\nNote: The number 1023 ('0x3ff' in hexadecimal) has the following\nbyte representations:\n\n* '03 ff' in big-endian ('>')\n\n* 'ff 03' in little-endian ('<')\n\nPython example:\n\n>>> import struct\n>>> struct.pack('>h', 1023)\nb'\\x03\\xff'\n>>> struct.pack('<h', 1023)\nb'\\xff\\x03'\n",
            "subsections": []
        },
        "Native byte order is big-endian or little-endian, depending on the host": {
            "content": "system.  For example, Intel x86, AMD64 (x86-64), and Apple M1 are\nlittle-endian; IBM z and many legacy architectures are big-endian.  Use\n*note sys.byteorder: 1ea6. to check the endianness of your system.\n",
            "subsections": []
        },
        "Native size and alignment are determined using the C compiler's 'sizeof'": {
            "content": "expression.  This is always combined with native byte order.\n",
            "subsections": []
        },
        "Standard size depends only on the format character; see the table in the": {
            "content": "*note Format Characters: 20b9. section.\n\nNote the difference between ''@'' and ''='': both use native byte order,\nbut the size and alignment of the latter is standardized.\n\nThe form ''!'' represents the network byte order which is always\nbig-endian as defined in IETF RFC 1700(1).\n",
            "subsections": []
        },
        "There is no way to indicate non-native byte order (force byte-swapping);": {
            "content": "use the appropriate choice of ''<'' or ''>''.\n\nNotes:\n\n1. Padding is only automatically added between successive structure\nmembers.  No padding is added at the beginning or the end of the\nencoded struct.\n\n2. No padding is added when using non-native size and alignment, e.g.\nwith '<', '>', '=', and '!'.\n\n3. To align the end of a structure to the alignment requirement of a\nparticular type, end the format with the code for that type with a\nrepeat count of zero.  See *note Examples: 20bb.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc1700\n\nFile: python3.12.info,  Node: Format Characters,  Next: Examples<2>,  Prev: Byte Order Size and Alignment,  Up: Format Strings\n\n5.7.1.4 Format Characters\n.........................\n",
            "subsections": []
        },
        "Format characters have the following meaning; the conversion between C": {
            "content": "and Python values should be obvious given their types.  The 'Standard\nsize' column refers to the size of the packed value in bytes when using\nstandard size; that is, when the format string starts with one of ''<'',\n''>'', ''!'' or ''=''.  When using native size, the size of the packed\nvalue is platform-dependent.\n",
            "subsections": []
        },
        "Format       C Type                         Python type              Standard size        Notes": {
            "content": "-----------------------------------------------------------------------------------------------------------\n\n'x'          pad byte                       no value                                      (7)\n\n\n'c'          char                           bytes of length 1        1\n\n\n'b'          signed char                    integer                  1                    (1), (2)\n\n\n'B'          unsigned char                  integer                  1                    (2)\n\n\n'?'          Bool                          bool                     1                    (1)\n\n\n'h'          short                          integer                  2                    (2)\n\n\n'H'          unsigned short                 integer                  2                    (2)\n\n\n'i'          int                            integer                  4                    (2)\n\n\n'I'          unsigned int                   integer                  4                    (2)\n\n\n'l'          long                           integer                  4                    (2)\n\n\n'L'          unsigned long                  integer                  4                    (2)\n\n\n'q'          long long                      integer                  8                    (2)\n\n\n'Q'          unsigned long long             integer                  8                    (2)\n\n\n'n'          'ssizet'                      integer                                       (3)\n\n\n'N'          'sizet'                       integer                                       (3)\n\n\n'e'          (6)                            float                    2                    (4)\n\n\n'f'          float                          float                    4                    (4)\n\n\n'd'          double                         float                    8                    (4)\n\n\n's'          char[]                         bytes                                         (9)\n\n\n'p'          char[]                         bytes                                         (8)\n\n\n'P'          void*                          integer                                       (5)\n\n\nChanged in version 3.3: Added support for the ''n'' and ''N'' formats.\n\nChanged in version 3.6: Added support for the ''e'' format.\n\nNotes:\n\n1.\nThe ''?'' conversion code corresponds to the Bool type defined by\nC99.  If this type is not available, it is simulated using a char.\nIn standard mode, it is always represented by one byte.\n\n2. When attempting to pack a non-integer using any of the integer\nconversion codes, if the non-integer has a *note index(): 4f1.\nmethod then that method is called to convert the argument to an\ninteger before packing.\n\nChanged in version 3.2: Added use of the *note index(): 4f1.\nmethod for non-integers.\n\n3. The ''n'' and ''N'' conversion codes are only available for the\nnative size (selected as the default or with the ''@'' byte order\ncharacter).  For the standard size, you can use whichever of the\nother integer formats fits your application.\n\n4. For the ''f'', ''d'' and ''e'' conversion codes, the packed\nrepresentation uses the IEEE 754 binary32, binary64 or binary16\nformat (for ''f'', ''d'' or ''e'' respectively), regardless of the\nfloating-point format used by the platform.\n\n5. The ''P'' format character is only available for the native byte\nordering (selected as the default or with the ''@'' byte order\ncharacter).  The byte order character ''='' chooses to use little-\nor big-endian ordering based on the host system.  The struct module\ndoes not interpret this as native ordering, so the ''P'' format is\nnot available.\n\n6. The IEEE 754 binary16 \"half precision\" type was introduced in the\n2008 revision of the IEEE 754 standard(1).  It has a sign bit, a\n5-bit exponent and 11-bit precision (with 10 bits explicitly\nstored), and can represent numbers between approximately '6.1e-05'\nand '6.5e+04' at full precision.  This type is not widely supported\nby C compilers: on a typical machine, an unsigned short can be used\nfor storage, but not for math operations.  See the Wikipedia page\non the half-precision floating-point format(2) for more\ninformation.\n\n7. When packing, ''x'' inserts one NUL byte.\n\n8. The ''p'' format character encodes a \"Pascal string\", meaning a\nshort variable-length string stored in a 'fixed number of bytes',\ngiven by the count.  The first byte stored is the length of the\nstring, or 255, whichever is smaller.  The bytes of the string\nfollow.  If the string passed in to *note pack(): 10ef. is too long\n(longer than the count minus 1), only the leading 'count-1' bytes\nof the string are stored.  If the string is shorter than 'count-1',\nit is padded with null bytes so that exactly count bytes in all are\nused.  Note that for *note unpack(): 1520, the ''p'' format\ncharacter consumes 'count' bytes, but that the string returned can\nnever contain more than 255 bytes.\n\n9. For the ''s'' format character, the count is interpreted as the\nlength of the bytes, not a repeat count like for the other format\ncharacters; for example, ''10s'' means a single 10-byte string\nmapping to or from a single Python byte string, while ''10c'' means\n10 separate one byte character elements (e.g., 'cccccccccc')\nmapping to or from ten different Python byte objects.  (See *note\nExamples: 20bb. for a concrete demonstration of the difference.)\nIf a count is not given, it defaults to 1.  For packing, the string\nis truncated or padded with null bytes as appropriate to make it\nfit.  For unpacking, the resulting bytes object always has exactly\nthe specified number of bytes.  As a special case, ''0s'' means a\nsingle, empty string (while ''0c'' means 0 characters).\n\nA format character may be preceded by an integral repeat count.  For\nexample, the format string ''4h'' means exactly the same as ''hhhh''.\n",
            "subsections": []
        },
        "Whitespace characters between formats are ignored; a count and its": {
            "content": "format must not contain whitespace though.\n",
            "subsections": []
        },
        "When packing a value 'x' using one of the integer formats (''b'', ''B'',": {
            "content": "''h'', ''H'', ''i'', ''I'', ''l'', ''L'', ''q'', ''Q''), if 'x' is\noutside the valid range for that format then *note struct.error: 119b.\nis raised.\n",
            "subsections": []
        },
        "Changed in version 3.1: Previously, some of the integer formats wrapped": {
            "content": "out-of-range values and raised *note DeprecationWarning: 179. instead of\n*note struct.error: 119b.\n\nFor the ''?'' format character, the return value is either *note True:\na53. or *note False: 971.  When packing, the truth value of the argument\nobject is used.  Either 0 or 1 in the native or standard bool\nrepresentation will be packed, and any non-zero value will be 'True'\nwhen unpacking.\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/IEEE754-2008revision\n\n(2)\nhttps://en.wikipedia.org/wiki/Half-precisionfloating-pointformat\n\nFile: python3.12.info,  Node: Examples<2>,  Prev: Format Characters,  Up: Format Strings\n\n5.7.1.5 Examples\n................\n\nNote: Native byte order examples (designated by the ''@'' format\nprefix or lack of any prefix character) may not match what the\nreader's machine produces as that depends on the platform and\ncompiler.\n",
            "subsections": []
        },
        "Pack and unpack integers of three different sizes, using big endian": {
            "content": "ordering:\n\n>>> from struct import *\n>>> pack(\">bhl\", 1, 2, 3)\nb'\\x01\\x00\\x02\\x00\\x00\\x00\\x03'\n>>> unpack('>bhl', b'\\x01\\x00\\x02\\x00\\x00\\x00\\x03')\n(1, 2, 3)\n>>> calcsize('>bhl')\n7\n\nAttempt to pack an integer which is too large for the defined field:\n\n>>> pack(\">h\", 99999)\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nstruct.error: 'h' format requires -32768 <= number <= 32767\n\nDemonstrate the difference between ''s'' and ''c'' format characters:\n\n>>> pack(\"@ccc\", b'1', b'2', b'3')\nb'123'\n>>> pack(\"@3s\", b'123')\nb'123'\n",
            "subsections": []
        },
        "Unpacked fields can be named by assigning them to variables or by": {
            "content": "wrapping the result in a named tuple:\n\n>>> record = b'raymond   \\x32\\x12\\x08\\x01\\x08'\n>>> name, serialnum, school, gradelevel = unpack('<10sHHb', record)\n\n>>> from collections import namedtuple\n>>> Student = namedtuple('Student', 'name serialnum school gradelevel')\n>>> Student.make(unpack('<10sHHb', record))\nStudent(name=b'raymond   ', serialnum=4658, school=264, gradelevel=8)\n",
            "subsections": []
        },
        "The ordering of format characters may have an impact on size in native": {
            "content": "mode since padding is implicit.  In standard mode, the user is\nresponsible for inserting any desired padding.  Note in the first 'pack'\ncall below that three NUL bytes were added after the packed ''#'' to\nalign the following integer on a four-byte boundary.  In this example,\nthe output was produced on a little endian machine:\n\n>>> pack('@ci', b'#', 0x12131415)\nb'#\\x00\\x00\\x00\\x15\\x14\\x13\\x12'\n>>> pack('@ic', 0x12131415, b'#')\nb'\\x15\\x14\\x13\\x12#'\n>>> calcsize('@ci')\n8\n>>> calcsize('@ic')\n5\n",
            "subsections": []
        },
        "The following format ''llh0l'' results in two pad bytes being added at": {
            "content": "the end, assuming the platform's longs are aligned on 4-byte boundaries:\n\n>>> pack('@llh0l', 1, 2, 3)\nb'\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x02\\x00\\x03\\x00\\x00'\n\nSee also\n........\n\nModule *note array: 7.\n\nPacked binary storage of homogeneous data.\n\nModule *note json: 7c.\n\nJSON encoder and decoder.\n\nModule *note pickle: a1.\n\nPython object serialization.\n\nFile: python3.12.info,  Node: Applications,  Next: Classes<3>,  Prev: Format Strings,  Up: struct -- Interpret bytes as packed binary data\n\n5.7.1.6 Applications\n....................\n\nTwo main applications for the *note struct: cf. module exist, data\ninterchange between Python and C code within an application or another\napplication compiled using the same compiler (*note native formats:\n20c0.), and data interchange between applications using agreed upon data\nlayout (*note standard formats: 20c1.).  Generally speaking, the format\nstrings constructed for these two domains are distinct.\n\n* Menu:\n\n* Native Formats::\n* Standard Formats::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Native Formats,  Next: Standard Formats,  Up: Applications": {
            "content": "5.7.1.7 Native Formats\n......................\n",
            "subsections": []
        },
        "When constructing format strings which mimic native layouts, the": {
            "content": "compiler and machine architecture determine byte ordering and padding.\nIn such cases, the '@' format character should be used to specify native\nbyte ordering and data sizes.  Internal pad bytes are normally inserted\nautomatically.  It is possible that a zero-repeat format code will be\nneeded at the end of a format string to round up to the correct byte\nboundary for proper alignment of consecutive chunks of data.\n\nConsider these two simple examples (on a 64-bit, little-endian machine):\n\n>>> calcsize('@lhl')\n24\n>>> calcsize('@llh')\n18\n",
            "subsections": []
        },
        "Data is not padded to an 8-byte boundary at the end of the second format": {
            "content": "string without the use of extra padding.  A zero-repeat format code\nsolves that problem:\n\n>>> calcsize('@llh0l')\n24\n",
            "subsections": []
        },
        "The ''x'' format code can be used to specify the repeat, but for native": {
            "content": "formats it is better to use a zero-repeat format like ''0l''.\n",
            "subsections": []
        },
        "By default, native byte ordering and alignment is used, but it is better": {
            "content": "to be explicit and use the ''@'' prefix character.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Standard Formats,  Prev: Native Formats,  Up: Applications": {
            "content": "5.7.1.8 Standard Formats\n........................\n",
            "subsections": []
        },
        "When exchanging data beyond your process such as networking or storage,": {
            "content": "be precise.  Specify the exact byte order, size, and alignment.  Do not\nassume they match the native order of a particular machine.  For\nexample, network byte order is big-endian, while many popular CPUs are\nlittle-endian.  By defining this explicitly, the user need not care\nabout the specifics of the platform their code is running on.  The first\ncharacter should typically be '<' or '>' (or '!').  Padding is the\nresponsibility of the programmer.  The zero-repeat format character\nwon't work.  Instead, the user must explicitly add ''x'' pad bytes where\nneeded.  Revisiting the examples from the previous section, we have:\n\n>>> calcsize('<qh6xq')\n24\n>>> pack('<qh6xq', 1, 2, 3) == pack('@lhl', 1, 2, 3)\nTrue\n>>> calcsize('@llh')\n18\n>>> pack('@llh', 1, 2, 3) == pack('<qqh', 1, 2, 3)\nTrue\n>>> calcsize('<qqh6x')\n24\n>>> calcsize('@llh0l')\n24\n>>> pack('@llh0l', 1, 2, 3) == pack('<qqh6x', 1, 2, 3)\nTrue\n",
            "subsections": []
        },
        "The above results (executed on a 64-bit machine) aren't guaranteed to": {
            "content": "match when executed on different machines.  For example, the examples\nbelow were executed on a 32-bit machine:\n\n>>> calcsize('<qqh6x')\n24\n>>> calcsize('@llh0l')\n12\n>>> pack('@llh0l', 1, 2, 3) == pack('<qqh6x', 1, 2, 3)\nFalse\n\nFile: python3.12.info,  Node: Classes<3>,  Prev: Applications,  Up: struct -- Interpret bytes as packed binary data\n\n5.7.1.9 Classes\n...............\n\nThe *note struct: cf. module also defines the following type:\n\n-- Class: struct.Struct (format)\n\nReturn a new Struct object which writes and reads binary data\naccording to the format string 'format'.  Creating a 'Struct'\nobject once and calling its methods is more efficient than calling\nmodule-level functions with the same format since the format string\nis only compiled once.\n\nNote: The compiled versions of the most recent format strings\npassed to the module-level functions are cached, so programs\nthat use only a few format strings needn't worry about reusing\na single *note Struct: 13e7. instance.\n\nCompiled Struct objects support the following methods and\nattributes:\n\n-- Method: pack (v1, v2, ...)\n\nIdentical to the *note pack(): 10ef. function, using the\ncompiled format.  ('len(result)' will equal *note size: 20c7.)\n\n-- Method: packinto (buffer, offset, v1, v2, ...)\n\nIdentical to the *note packinto(): 20b6. function, using the\ncompiled format.\n\n-- Method: unpack (buffer)\n\nIdentical to the *note unpack(): 1520. function, using the\ncompiled format.  The buffer's size in bytes must equal *note\nsize: 20c7.\n\n-- Method: unpackfrom (buffer, offset=0)\n\nIdentical to the *note unpackfrom(): 20b7. function, using\nthe compiled format.  The buffer's size in bytes, starting at\nposition 'offset', must be at least *note size: 20c7.\n\n-- Method: iterunpack (buffer)\n\nIdentical to the *note iterunpack(): e2e. function, using the\ncompiled format.  The buffer's size in bytes must be a\nmultiple of *note size: 20c7.\n\nNew in version 3.4.\n\n-- Attribute: format\n\nThe format string used to construct this Struct object.\n\nChanged in version 3.7: The format string type is now *note\nstr: 157. instead of *note bytes: 295.\n\n-- Attribute: size\n\nThe calculated size of the struct (and hence of the bytes\nobject produced by the *note pack(): 10ef. method)\ncorresponding to *note format: 3eb.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: codecs -- Codec registry and base classes,  Prev: struct -- Interpret bytes as packed binary data,  Up: Binary Data Services": {
            "content": "'Source code:' Lib/codecs.py(1)\n\n\n",
            "subsections": []
        },
        "This module defines base classes for standard Python codecs (encoders": {
            "content": "and decoders) and provides access to the internal Python codec registry,\nwhich manages the codec and error handling lookup process.  Most\nstandard codecs are *note text encodings: 1e83, which encode text to\nbytes (and decode bytes to text), but there are also codecs provided\nthat encode text to text, and bytes to bytes.  Custom codecs may encode\nand decode between arbitrary types, but some module features are\nrestricted to be used specifically with *note text encodings: 1e83. or\nwith codecs that encode to *note bytes: 295.\n",
            "subsections": []
        },
        "The module defines the following functions for encoding and decoding": {
            "content": "with any codec:\n\n-- Function: codecs.encode (obj, encoding='utf-8', errors='strict')\n\nEncodes 'obj' using the codec registered for 'encoding'.\n\n'Errors' may be given to set the desired error handling scheme.\nThe default error handler is ''strict'' meaning that encoding\nerrors raise *note ValueError: 183. (or a more codec specific\nsubclass, such as *note UnicodeEncodeError: 442.).  Refer to *note\nCodec Base Classes: 20cd. for more information on codec error\nhandling.\n\n-- Function: codecs.decode (obj, encoding='utf-8', errors='strict')\n\nDecodes 'obj' using the codec registered for 'encoding'.\n\n'Errors' may be given to set the desired error handling scheme.\nThe default error handler is ''strict'' meaning that decoding\nerrors raise *note ValueError: 183. (or a more codec specific\nsubclass, such as *note UnicodeDecodeError: 83c.).  Refer to *note\nCodec Base Classes: 20cd. for more information on codec error\nhandling.\n\nThe full details for each codec can also be looked up directly:\n\n-- Function: codecs.lookup (encoding)\n\nLooks up the codec info in the Python codec registry and returns a\n*note CodecInfo: 20ce. object as defined below.\n\nEncodings are first looked up in the registry's cache.  If not\nfound, the list of registered search functions is scanned.  If no\n*note CodecInfo: 20ce. object is found, a *note LookupError: 1ed9.\nis raised.  Otherwise, the *note CodecInfo: 20ce. object is stored\nin the cache and returned to the caller.\n\n-- Class: codecs.CodecInfo (encode, decode, streamreader=None,\nstreamwriter=None, incrementalencoder=None,\nincrementaldecoder=None, name=None)\n\nCodec details when looking up the codec registry.  The constructor\narguments are stored in attributes of the same name:\n\n-- Attribute: name\n\nThe name of the encoding.\n\n-- Attribute: encode\n-- Attribute: decode\n\nThe stateless encoding and decoding functions.  These must be\nfunctions or methods which have the same interface as the\n*note encode(): 20d2. and *note decode(): 20d3. methods of\nCodec instances (see *note Codec Interface: 20d4.).  The\nfunctions or methods are expected to work in a stateless mode.\n\n-- Attribute: incrementalencoder\n-- Attribute: incrementaldecoder\n\nIncremental encoder and decoder classes or factory functions.\nThese have to provide the interface defined by the base\nclasses *note IncrementalEncoder: 20d7. and *note\nIncrementalDecoder: 20d8, respectively.  Incremental codecs\ncan maintain state.\n\n-- Attribute: streamwriter\n-- Attribute: streamreader\n\nStream writer and reader classes or factory functions.  These\nhave to provide the interface defined by the base classes\n*note StreamWriter: 20db. and *note StreamReader: 20dc,\nrespectively.  Stream codecs can maintain state.\n",
            "subsections": []
        },
        "To simplify access to the various codec components, the module provides": {
            "content": "these additional functions which use *note lookup(): 784. for the codec\nlookup:\n\n-- Function: codecs.getencoder (encoding)\n\nLook up the codec for the given encoding and return its encoder\nfunction.\n\nRaises a *note LookupError: 1ed9. in case the encoding cannot be\nfound.\n\n-- Function: codecs.getdecoder (encoding)\n\nLook up the codec for the given encoding and return its decoder\nfunction.\n\nRaises a *note LookupError: 1ed9. in case the encoding cannot be\nfound.\n\n-- Function: codecs.getincrementalencoder (encoding)\n\nLook up the codec for the given encoding and return its incremental\nencoder class or factory function.\n\nRaises a *note LookupError: 1ed9. in case the encoding cannot be\nfound or the codec doesn't support an incremental encoder.\n\n-- Function: codecs.getincrementaldecoder (encoding)\n\nLook up the codec for the given encoding and return its incremental\ndecoder class or factory function.\n\nRaises a *note LookupError: 1ed9. in case the encoding cannot be\nfound or the codec doesn't support an incremental decoder.\n\n-- Function: codecs.getreader (encoding)\n\nLook up the codec for the given encoding and return its *note\nStreamReader: 20dc. class or factory function.\n\nRaises a *note LookupError: 1ed9. in case the encoding cannot be\nfound.\n\n-- Function: codecs.getwriter (encoding)\n\nLook up the codec for the given encoding and return its *note\nStreamWriter: 20db. class or factory function.\n\nRaises a *note LookupError: 1ed9. in case the encoding cannot be\nfound.\n",
            "subsections": []
        },
        "Custom codecs are made available by registering a suitable codec search": {
            "content": "function:\n\n-- Function: codecs.register (searchfunction)\n\nRegister a codec search function.  Search functions are expected to\ntake one argument, being the encoding name in all lower case\nletters with hyphens and spaces converted to underscores, and\nreturn a *note CodecInfo: 20ce. object.  In case a search function\ncannot find a given encoding, it should return 'None'.\n\nChanged in version 3.9: Hyphens and spaces are converted to\nunderscore.\n\n-- Function: codecs.unregister (searchfunction)\n\nUnregister a codec search function and clear the registry's cache.\nIf the search function is not registered, do nothing.\n\nNew in version 3.10.\n\nWhile the builtin *note open(): 26e. and the associated *note io: 79.\nmodule are the recommended approach for working with encoded text files,\nthis module provides additional utility functions and classes that allow\nthe use of a wider range of codecs when working with binary files:\n\n-- Function: codecs.open (filename, mode='r', encoding=None,\nerrors='strict', buffering=-1)\n\nOpen an encoded file using the given 'mode' and return an instance\nof *note StreamReaderWriter: 20e4, providing transparent\nencoding/decoding.  The default file mode is ''r'', meaning to open\nthe file in read mode.\n\nNote: If 'encoding' is not 'None', then the underlying encoded\nfiles are always opened in binary mode.  No automatic\nconversion of ''\\n'' is done on reading and writing.  The\n'mode' argument may be any binary mode acceptable to the\nbuilt-in *note open(): 26e. function; the ''b'' is\nautomatically added.\n\n'encoding' specifies the encoding which is to be used for the file.\nAny encoding that encodes to and decodes from bytes is allowed, and\nthe data types supported by the file methods depend on the codec\nused.\n\n'errors' may be given to define the error handling.  It defaults to\n''strict'' which causes a *note ValueError: 183. to be raised in\ncase an encoding error occurs.\n\n'buffering' has the same meaning as for the built-in *note open():\n26e. function.  It defaults to -1 which means that the default\nbuffer size will be used.\n\nChanged in version 3.11: The ''U'' mode has been removed.\n\n-- Function: codecs.EncodedFile (file, dataencoding,\nfileencoding=None, errors='strict')\n\nReturn a *note StreamRecoder: 1768. instance, a wrapped version of\n'file' which provides transparent transcoding.  The original file\nis closed when the wrapped version is closed.\n\nData written to the wrapped file is decoded according to the given\n'dataencoding' and then written to the original file as bytes\nusing 'fileencoding'.  Bytes read from the original file are\ndecoded according to 'fileencoding', and the result is encoded\nusing 'dataencoding'.\n\nIf 'fileencoding' is not given, it defaults to 'dataencoding'.\n\n'errors' may be given to define the error handling.  It defaults to\n''strict'', which causes *note ValueError: 183. to be raised in\ncase an encoding error occurs.\n\n-- Function: codecs.iterencode (iterator, encoding, errors='strict',\nkwargs)\n\nUses an incremental encoder to iteratively encode the input\nprovided by 'iterator'.  This function is a *note generator: eda.\nThe 'errors' argument (as well as any other keyword argument) is\npassed through to the incremental encoder.\n\nThis function requires that the codec accept text *note str: 157.\nobjects to encode.  Therefore it does not support bytes-to-bytes\nencoders such as 'base64codec'.\n\n-- Function: codecs.iterdecode (iterator, encoding, errors='strict',\nkwargs)\n\nUses an incremental decoder to iteratively decode the input\nprovided by 'iterator'.  This function is a *note generator: eda.\nThe 'errors' argument (as well as any other keyword argument) is\npassed through to the incremental decoder.\n\nThis function requires that the codec accept *note bytes: 295.\nobjects to decode.  Therefore it does not support text-to-text\nencoders such as 'rot13', although 'rot13' may be used\nequivalently with *note iterencode(): 20e6.\n",
            "subsections": []
        },
        "The module also provides the following constants which are useful for": {
            "content": "reading and writing to platform dependent files:\n\n-- Data: codecs.BOM\n-- Data: codecs.BOMBE\n-- Data: codecs.BOMLE\n-- Data: codecs.BOMUTF8\n-- Data: codecs.BOMUTF16\n-- Data: codecs.BOMUTF16BE\n-- Data: codecs.BOMUTF16LE\n-- Data: codecs.BOMUTF32\n-- Data: codecs.BOMUTF32BE\n-- Data: codecs.BOMUTF32LE\n\nThese constants define various byte sequences, being Unicode byte\norder marks (BOMs) for several encodings.  They are used in UTF-16\nand UTF-32 data streams to indicate the byte order used, and in\nUTF-8 as a Unicode signature.  *note BOMUTF16: 20ec. is either\n*note BOMUTF16BE: 20ed. or *note BOMUTF16LE: 20ee. depending on\nthe platform's native byte order, *note BOM: 20e8. is an alias for\n*note BOMUTF16: 20ec, *note BOMLE: 20ea. for *note BOMUTF16LE:\n20ee. and *note BOMBE: 20e9. for *note BOMUTF16BE: 20ed.  The\nothers represent the BOM in UTF-8 and UTF-32 encodings.\n\n* Menu:\n\n* Codec Base Classes::\n* Encodings and Unicode::\n* Standard Encodings::\n* Python Specific Encodings::\n* encodings.idna -- Internationalized Domain Names in Applications: encodings idna -- Internationalized Domain Names in Applications.\n* encodings.mbcs -- Windows ANSI codepage: encodings mbcs -- Windows ANSI codepage.\n* encodings.utf8sig -- UTF-8 codec with BOM signature: encodings utf8sig -- UTF-8 codec with BOM signature.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/codecs.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Codec Base Classes,  Next: Encodings and Unicode,  Up: codecs -- Codec registry and base classes": {
            "content": "5.7.2.1 Codec Base Classes\n..........................\n\nThe *note codecs: 19. module defines a set of base classes which define\nthe interfaces for working with codec objects, and can also be used as\nthe basis for custom codec implementations.\n",
            "subsections": []
        },
        "Each codec has to define four interfaces to make it usable as codec in": {
            "content": "",
            "subsections": []
        },
        "Python: stateless encoder, stateless decoder, stream reader and stream": {
            "content": "writer.  The stream reader and writers typically reuse the stateless\nencoder/decoder to implement the file protocols.  Codec authors also\nneed to define how the codec will handle encoding and decoding errors.\n* Menu:\n\n* Error Handlers::\n* Stateless Encoding and Decoding::\n* Incremental Encoding and Decoding::\n* Stream Encoding and Decoding::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Error Handlers,  Next: Stateless Encoding and Decoding,  Up: Codec Base Classes": {
            "content": "5.7.2.2 Error Handlers\n......................\n",
            "subsections": []
        },
        "To simplify and standardize error handling, codecs may implement": {
            "content": "different error handling schemes by accepting the 'errors' string\nargument:\n\n>>> 'German ss, ???'.encode(encoding='ascii', errors='backslashreplace')\nb'German \\\\xdf, \\\\u266c'\n>>> 'German ss, ???'.encode(encoding='ascii', errors='xmlcharrefreplace')\nb'German &#223;, &#9836;'\n\nThe following error handlers can be used with all Python *note Standard\nEncodings: c15. codecs:\n",
            "subsections": []
        },
        "Value                         Meaning": {
            "content": "----------------------------------------------------------------------------------\n\n''xmlcharrefreplace''         Replace with XML/HTML numeric character\nreference, which is a decimal form of Unicode\ncode point with format '&#NUM;'.  Implemented in\n*note xmlcharrefreplaceerrors(): 20f9.\n\n\n''namereplace''               Replace with '\\N{...}' escape sequences, what\nappears in the braces is the Name property from\nUnicode Character Database.  Implemented in\n*note namereplaceerrors(): 20fa.\n\n",
            "subsections": []
        },
        "The following error handlers are only applicable to encoding (within": {
            "content": "*note text encodings: 1e83.):\n",
            "subsections": []
        },
        "In addition, the following error handler is specific to the given": {
            "content": "codecs:\n",
            "subsections": []
        },
        "Value                   Codecs                       Meaning": {
            "content": "-----------------------------------------------------------------------------------------------------\n\n''surrogatepass''       utf-8, utf-16, utf-32,       Allow encoding and decoding surrogate code\nutf-16-be, utf-16-le,        point ('U+D800' - 'U+DFFF') as normal code\nutf-32-be, utf-32-le         point.  Otherwise these codecs treat the\npresence of surrogate code point in\n*note str: 157. as an error.\n\n",
            "subsections": []
        },
        "New in version 3.1: The ''surrogateescape'' and ''surrogatepass'' error": {
            "content": "handlers.\n",
            "subsections": []
        },
        "Changed in version 3.4: The ''surrogatepass'' error handler now works": {
            "content": "with utf-16* and utf-32* codecs.\n\nNew in version 3.5: The ''namereplace'' error handler.\n",
            "subsections": []
        },
        "Changed in version 3.5: The ''backslashreplace'' error handler now works": {
            "content": "with decoding and translating.\n",
            "subsections": []
        },
        "The set of allowed values can be extended by registering a new named": {
            "content": "error handler:\n\n-- Function: codecs.registererror (name, errorhandler)\n\nRegister the error handling function 'errorhandler' under the name\n'name'.  The 'errorhandler' argument will be called during\nencoding and decoding in case of an error, when 'name' is specified\nas the errors parameter.\n\nFor encoding, 'errorhandler' will be called with a *note\nUnicodeEncodeError: 442. instance, which contains information about\nthe location of the error.  The error handler must either raise\nthis or a different exception, or return a tuple with a replacement\nfor the unencodable part of the input and a position where encoding\nshould continue.  The replacement may be either *note str: 157. or\n*note bytes: 295.  If the replacement is bytes, the encoder will\nsimply copy them into the output buffer.  If the replacement is a\nstring, the encoder will encode the replacement.  Encoding\ncontinues on original input at the specified position.  Negative\nposition values will be treated as being relative to the end of the\ninput string.  If the resulting position is out of bound an *note\nIndexError: 138f. will be raised.\n\nDecoding and translating works similarly, except *note\nUnicodeDecodeError: 83c. or *note UnicodeTranslateError: 1fac. will\nbe passed to the handler and that the replacement from the error\nhandler will be put into the output directly.\n",
            "subsections": []
        },
        "Previously registered error handlers (including the standard error": {
            "content": "handlers) can be looked up by name:\n\n-- Function: codecs.lookuperror (name)\n\nReturn the error handler previously registered under the name\n'name'.\n\nRaises a *note LookupError: 1ed9. in case the handler cannot be\nfound.\n",
            "subsections": []
        },
        "The following standard error handlers are also made available as module": {
            "content": "level functions:\n\n-- Function: codecs.stricterrors (exception)\n\nImplements the ''strict'' error handling.\n\nEach encoding or decoding error raises a *note UnicodeError: 111b.\n\n-- Function: codecs.ignoreerrors (exception)\n\nImplements the ''ignore'' error handling.\n\nMalformed data is ignored; encoding or decoding is continued\nwithout further notice.\n\n-- Function: codecs.replaceerrors (exception)\n\nImplements the ''replace'' error handling.\n\nSubstitutes '?' (ASCII character) for encoding errors or '???'\n(U+FFFD, the official REPLACEMENT CHARACTER) for decoding errors.\n\n-- Function: codecs.backslashreplaceerrors (exception)\n\nImplements the ''backslashreplace'' error handling.\n\nMalformed data is replaced by a backslashed escape sequence.  On\nencoding, use the hexadecimal form of Unicode code point with\nformats '\\xHH' '\\uXXXX' '\\UXXXXXXXX'.  On decoding, use the\nhexadecimal form of byte value with format '\\xHH'.\n\nChanged in version 3.5: Works with decoding and translating.\n\n-- Function: codecs.xmlcharrefreplaceerrors (exception)\n\nImplements the ''xmlcharrefreplace'' error handling (for encoding\nwithin *note text encoding: 1e83. only).\n\nThe unencodable character is replaced by an appropriate XML/HTML\nnumeric character reference, which is a decimal form of Unicode\ncode point with format '&#NUM;' .\n\n-- Function: codecs.namereplaceerrors (exception)\n\nImplements the ''namereplace'' error handling (for encoding within\n*note text encoding: 1e83. only).\n\nThe unencodable character is replaced by a '\\N{...}' escape\nsequence.  The set of characters that appear in the braces is the\nName property from Unicode Character Database.  For example, the\nGerman lowercase letter ''ss'' will be converted to byte sequence\n'\\N{LATIN SMALL LETTER SHARP S}' .\n\nNew in version 3.5.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0383/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Stateless Encoding and Decoding,  Next: Incremental Encoding and Decoding,  Prev: Error Handlers,  Up: Codec Base Classes": {
            "content": "5.7.2.3 Stateless Encoding and Decoding\n.......................................\n\nThe base *note Codec: 20fc. class defines these methods which also\ndefine the function interfaces of the stateless encoder and decoder:\n\n-- Class: codecs.Codec\n\n-- Method: encode (input, errors='strict')\n\nEncodes the object 'input' and returns a tuple (output object,\nlength consumed).  For instance, *note text encoding: 1e83.\nconverts a string object to a bytes object using a particular\ncharacter set encoding (e.g., 'cp1252' or 'iso-8859-1').\n\nThe 'errors' argument defines the error handling to apply.  It\ndefaults to ''strict'' handling.\n\nThe method may not store state in the *note Codec: 20fc.\ninstance.  Use *note StreamWriter: 20db. for codecs which have\nto keep state in order to make encoding efficient.\n\nThe encoder must be able to handle zero length input and\nreturn an empty object of the output object type in this\nsituation.\n\n-- Method: decode (input, errors='strict')\n\nDecodes the object 'input' and returns a tuple (output object,\nlength consumed).  For instance, for a *note text encoding:\n1e83, decoding converts a bytes object encoded using a\nparticular character set encoding to a string object.\n\nFor text encodings and bytes-to-bytes codecs, 'input' must be\na bytes object or one which provides the read-only buffer\ninterface - for example, buffer objects and memory mapped\nfiles.\n\nThe 'errors' argument defines the error handling to apply.  It\ndefaults to ''strict'' handling.\n\nThe method may not store state in the *note Codec: 20fc.\ninstance.  Use *note StreamReader: 20dc. for codecs which have\nto keep state in order to make decoding efficient.\n\nThe decoder must be able to handle zero length input and\nreturn an empty object of the output object type in this\nsituation.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Incremental Encoding and Decoding,  Next: Stream Encoding and Decoding,  Prev: Stateless Encoding and Decoding,  Up: Codec Base Classes": {
            "content": "5.7.2.4 Incremental Encoding and Decoding\n.........................................\n\nThe *note IncrementalEncoder: 20d7. and *note IncrementalDecoder: 20d8.\nclasses provide the basic interface for incremental encoding and\ndecoding.  Encoding/decoding the input isn't done with one call to the\nstateless encoder/decoder function, but with multiple calls to the *note\nencode(): 20fe./*note decode(): 20ff. method of the incremental\nencoder/decoder.  The incremental encoder/decoder keeps track of the\nencoding/decoding process during method calls.\n\nThe joined output of calls to the *note encode(): 20fe./*note decode():\n20ff. method is the same as if all the single inputs were joined into\none, and this input was encoded/decoded with the stateless\nencoder/decoder.\n\n* Menu:\n\n* IncrementalEncoder Objects::\n* IncrementalDecoder Objects::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: IncrementalEncoder Objects,  Next: IncrementalDecoder Objects,  Up: Incremental Encoding and Decoding": {
            "content": "5.7.2.5 IncrementalEncoder Objects\n..................................\n\nThe *note IncrementalEncoder: 20d7. class is used for encoding an input\nin multiple steps.  It defines the following methods which every\nincremental encoder must define in order to be compatible with the\nPython codec registry.\n\n-- Class: codecs.IncrementalEncoder (errors='strict')\n\nConstructor for an *note IncrementalEncoder: 20d7. instance.\n\nAll incremental encoders must provide this constructor interface.\nThey are free to add additional keyword arguments, but only the\nones defined here are used by the Python codec registry.\n\nThe *note IncrementalEncoder: 20d7. may implement different error\nhandling schemes by providing the 'errors' keyword argument.  See\n*note Error Handlers: 1543. for possible values.\n\nThe 'errors' argument will be assigned to an attribute of the same\nname.  Assigning to this attribute makes it possible to switch\nbetween different error handling strategies during the lifetime of\nthe *note IncrementalEncoder: 20d7. object.\n\n-- Method: encode (object, final=False)\n\nEncodes 'object' (taking the current state of the encoder into\naccount) and returns the resulting encoded object.  If this is\nthe last call to *note encode(): d68. 'final' must be true\n(the default is false).\n\n-- Method: reset ()\n\nReset the encoder to the initial state.  The output is\ndiscarded: call '.encode(object, final=True)', passing an\nempty byte or text string if necessary, to reset the encoder\nand to get the output.\n\n-- Method: getstate ()\n\nReturn the current state of the encoder which must be an\ninteger.  The implementation should make sure that '0' is the\nmost common state.  (States that are more complicated than\nintegers can be converted into an integer by\nmarshaling/pickling the state and encoding the bytes of the\nresulting string into an integer.)\n\n-- Method: setstate (state)\n\nSet the state of the encoder to 'state'.  'state' must be an\nencoder state returned by *note getstate(): 2103.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: IncrementalDecoder Objects,  Prev: IncrementalEncoder Objects,  Up: Incremental Encoding and Decoding": {
            "content": "5.7.2.6 IncrementalDecoder Objects\n..................................\n\nThe *note IncrementalDecoder: 20d8. class is used for decoding an input\nin multiple steps.  It defines the following methods which every\nincremental decoder must define in order to be compatible with the\nPython codec registry.\n\n-- Class: codecs.IncrementalDecoder (errors='strict')\n\nConstructor for an *note IncrementalDecoder: 20d8. instance.\n\nAll incremental decoders must provide this constructor interface.\nThey are free to add additional keyword arguments, but only the\nones defined here are used by the Python codec registry.\n\nThe *note IncrementalDecoder: 20d8. may implement different error\nhandling schemes by providing the 'errors' keyword argument.  See\n*note Error Handlers: 1543. for possible values.\n\nThe 'errors' argument will be assigned to an attribute of the same\nname.  Assigning to this attribute makes it possible to switch\nbetween different error handling strategies during the lifetime of\nthe *note IncrementalDecoder: 20d8. object.\n\n-- Method: decode (object, final=False)\n\nDecodes 'object' (taking the current state of the decoder into\naccount) and returns the resulting decoded object.  If this is\nthe last call to *note decode(): d69. 'final' must be true\n(the default is false).  If 'final' is true the decoder must\ndecode the input completely and must flush all buffers.  If\nthis isn't possible (e.g.  because of incomplete byte\nsequences at the end of the input) it must initiate error\nhandling just like in the stateless case (which might raise an\nexception).\n\n-- Method: reset ()\n\nReset the decoder to the initial state.\n\n-- Method: getstate ()\n\nReturn the current state of the decoder.  This must be a tuple\nwith two items, the first must be the buffer containing the\nstill undecoded input.  The second must be an integer and can\nbe additional state info.  (The implementation should make\nsure that '0' is the most common additional state info.)  If\nthis additional state info is '0' it must be possible to set\nthe decoder to the state which has no input buffered and '0'\nas the additional state info, so that feeding the previously\nbuffered input to the decoder returns it to the previous state\nwithout producing any output.  (Additional state info that is\nmore complicated than integers can be converted into an\ninteger by marshaling/pickling the info and encoding the bytes\nof the resulting string into an integer.)\n\n-- Method: setstate (state)\n\nSet the state of the decoder to 'state'.  'state' must be a\ndecoder state returned by *note getstate(): 2108.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Stream Encoding and Decoding,  Prev: Incremental Encoding and Decoding,  Up: Codec Base Classes": {
            "content": "5.7.2.7 Stream Encoding and Decoding\n....................................\n\nThe *note StreamWriter: 20db. and *note StreamReader: 20dc. classes\nprovide generic working interfaces which can be used to implement new\nencoding submodules very easily.  See 'encodings.utf8' for an example\nof how this is done.\n\n* Menu:\n\n* StreamWriter Objects::\n* StreamReader Objects::\n* StreamReaderWriter Objects::\n* StreamRecoder Objects::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: StreamWriter Objects,  Next: StreamReader Objects,  Up: Stream Encoding and Decoding": {
            "content": "5.7.2.8 StreamWriter Objects\n............................\n\nThe *note StreamWriter: 20db. class is a subclass of *note Codec: 20fc.\nand defines the following methods which every stream writer must define\nin order to be compatible with the Python codec registry.\n\n-- Class: codecs.StreamWriter (stream, errors='strict')\n\nConstructor for a *note StreamWriter: 20db. instance.\n\nAll stream writers must provide this constructor interface.  They\nare free to add additional keyword arguments, but only the ones\ndefined here are used by the Python codec registry.\n\nThe 'stream' argument must be a file-like object open for writing\ntext or binary data, as appropriate for the specific codec.\n\nThe *note StreamWriter: 20db. may implement different error\nhandling schemes by providing the 'errors' keyword argument.  See\n*note Error Handlers: 1543. for the standard error handlers the\nunderlying stream codec may support.\n\nThe 'errors' argument will be assigned to an attribute of the same\nname.  Assigning to this attribute makes it possible to switch\nbetween different error handling strategies during the lifetime of\nthe *note StreamWriter: 20db. object.\n\n-- Method: write (object)\n\nWrites the object's contents encoded to the stream.\n\n-- Method: writelines (list)\n\nWrites the concatenated iterable of strings to the stream\n(possibly by reusing the *note write(): 210d. method).\nInfinite or very large iterables are not supported.  The\nstandard bytes-to-bytes codecs do not support this method.\n\n-- Method: reset ()\n\nResets the codec buffers used for keeping internal state.\n\nCalling this method should ensure that the data on the output\nis put into a clean state that allows appending of new fresh\ndata without having to rescan the whole stream to recover\nstate.\n\nIn addition to the above methods, the *note StreamWriter: 20db. must\nalso inherit all other methods and attributes from the underlying\nstream.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: StreamReader Objects,  Next: StreamReaderWriter Objects,  Prev: StreamWriter Objects,  Up: Stream Encoding and Decoding": {
            "content": "5.7.2.9 StreamReader Objects\n............................\n\nThe *note StreamReader: 20dc. class is a subclass of *note Codec: 20fc.\nand defines the following methods which every stream reader must define\nin order to be compatible with the Python codec registry.\n\n-- Class: codecs.StreamReader (stream, errors='strict')\n\nConstructor for a *note StreamReader: 20dc. instance.\n\nAll stream readers must provide this constructor interface.  They\nare free to add additional keyword arguments, but only the ones\ndefined here are used by the Python codec registry.\n\nThe 'stream' argument must be a file-like object open for reading\ntext or binary data, as appropriate for the specific codec.\n\nThe *note StreamReader: 20dc. may implement different error\nhandling schemes by providing the 'errors' keyword argument.  See\n*note Error Handlers: 1543. for the standard error handlers the\nunderlying stream codec may support.\n\nThe 'errors' argument will be assigned to an attribute of the same\nname.  Assigning to this attribute makes it possible to switch\nbetween different error handling strategies during the lifetime of\nthe *note StreamReader: 20dc. object.\n\nThe set of allowed values for the 'errors' argument can be extended\nwith *note registererror(): 12f0.\n\n-- Method: read (size=-1, chars=-1, firstline=False)\n\nDecodes data from the stream and returns the resulting object.\n\nThe 'chars' argument indicates the number of decoded code\npoints or bytes to return.  The *note read(): 2112. method\nwill never return more data than requested, but it might\nreturn less, if there is not enough available.\n\nThe 'size' argument indicates the approximate maximum number\nof encoded bytes or code points to read for decoding.  The\ndecoder can modify this setting as appropriate.  The default\nvalue -1 indicates to read and decode as much as possible.\nThis parameter is intended to prevent having to decode huge\nfiles in one step.\n\nThe 'firstline' flag indicates that it would be sufficient to\nonly return the first line, if there are decoding errors on\nlater lines.\n\nThe method should use a greedy read strategy meaning that it\nshould read as much data as is allowed within the definition\nof the encoding and the given size, e.g.  if optional encoding\nendings or state markers are available on the stream, these\nshould be read too.\n\n-- Method: readline (size=None, keepends=True)\n\nRead one line from the input stream and return the decoded\ndata.\n\n'size', if given, is passed as size argument to the stream's\n*note read(): 2112. method.\n\nIf 'keepends' is false line-endings will be stripped from the\nlines returned.\n\n-- Method: readlines (sizehint=None, keepends=True)\n\nRead all lines available on the input stream and return them\nas a list of lines.\n\nLine-endings are implemented using the codec's *note decode():\nd69. method and are included in the list entries if 'keepends'\nis true.\n\n'sizehint', if given, is passed as the 'size' argument to the\nstream's *note read(): 2112. method.\n\n-- Method: reset ()\n\nResets the codec buffers used for keeping internal state.\n\nNote that no stream repositioning should take place.  This\nmethod is primarily intended to be able to recover from\ndecoding errors.\n\nIn addition to the above methods, the *note StreamReader: 20dc. must\nalso inherit all other methods and attributes from the underlying\nstream.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: StreamReaderWriter Objects,  Next: StreamRecoder Objects,  Prev: StreamReader Objects,  Up: Stream Encoding and Decoding": {
            "content": "5.7.2.10 StreamReaderWriter Objects\n...................................\n\nThe *note StreamReaderWriter: 20e4. is a convenience class that allows\nwrapping streams which work in both read and write modes.\n",
            "subsections": []
        },
        "The design is such that one can use the factory functions returned by": {
            "content": "the *note lookup(): 784. function to construct the instance.\n\n-- Class: codecs.StreamRecoder (stream, encode, decode, Reader, Writer,\nerrors='strict')\n\nCreates a *note StreamRecoder: 1768. instance which implements a\ntwo-way conversion: 'encode' and 'decode' work on the frontend --\nthe data visible to code calling *note read(): 2112. and *note\nwrite(): 210d, while 'Reader' and 'Writer' work on the backend --\nthe data in 'stream'.\n\nYou can use these objects to do transparent transcodings, e.g.,\nfrom Latin-1 to UTF-8 and back.\n\nThe 'stream' argument must be a file-like object.\n\nThe 'encode' and 'decode' arguments must adhere to the *note Codec:\n20fc. interface.  'Reader' and 'Writer' must be factory functions\nor classes providing objects of the *note StreamReader: 20dc. and\n*note StreamWriter: 20db. interface respectively.\n\nError handling is done in the same way as defined for the stream\nreaders and writers.\n\n*note StreamRecoder: 1768. instances define the combined interfaces of\n*note StreamReader: 20dc. and *note StreamWriter: 20db. classes.  They\ninherit all other methods and attributes from the underlying stream.\n",
            "subsections": []
        },
        "They inherit all other methods and attributes from the underlying": {
            "content": "stream.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: StreamRecoder Objects,  Prev: StreamReaderWriter Objects,  Up: Stream Encoding and Decoding": {
            "content": "5.7.2.11 StreamRecoder Objects\n..............................\n\nThe *note StreamRecoder: 1768. translates data from one encoding to\nanother, which is sometimes useful when dealing with different encoding\nenvironments.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Encodings and Unicode,  Next: Standard Encodings,  Prev: Codec Base Classes,  Up: codecs -- Codec registry and base classes": {
            "content": "5.7.2.12 Encodings and Unicode\n..............................\n",
            "subsections": []
        },
        "Strings are stored internally as sequences of code points in range": {
            "content": "'U+0000'-'U+10FFFF'.  (See PEP 393(1) for more details about the\nimplementation.)  Once a string object is used outside of CPU and\nmemory, endianness and how these arrays are stored as bytes become an\nissue.  As with other codecs, serialising a string into a sequence of\nbytes is known as 'encoding', and recreating the string from the\nsequence of bytes is known as 'decoding'.  There are a variety of\ndifferent text serialisation codecs, which are collectivity referred to\nas *note text encodings: 1e83.\n",
            "subsections": []
        },
        "The simplest text encoding (called ''latin-1'' or ''iso-8859-1'') maps": {
            "content": "the code points 0-255 to the bytes '0x0'-'0xff', which means that a\nstring object that contains code points above 'U+00FF' can't be encoded\nwith this codec.  Doing so will raise a *note UnicodeEncodeError: 442.\nthat looks like the following (although the details of the error message\nmay differ): 'UnicodeEncodeError: 'latin-1' codec can't encode character\n'\\u1234' in position 3: ordinal not in range(256)'.\n",
            "subsections": []
        },
        "There's another group of encodings (the so called charmap encodings)": {
            "content": "that choose a different subset of all Unicode code points and how these\ncode points are mapped to the bytes '0x0'-'0xff'.  To see how this is\ndone simply open e.g.  'encodings/cp1252.py' (which is an encoding that\nis used primarily on Windows).  There's a string constant with 256\ncharacters that shows you which character is mapped to which byte value.\n",
            "subsections": []
        },
        "All of these encodings can only encode 256 of the 1114112 code points": {
            "content": "defined in Unicode.  A simple and straightforward way that can store\neach Unicode code point, is to store each code point as four consecutive\nbytes.  There are two possibilities: store the bytes in big endian or in\nlittle endian order.  These two encodings are called 'UTF-32-BE' and\n'UTF-32-LE' respectively.  Their disadvantage is that if e.g.  you use\n'UTF-32-BE' on a little endian machine you will always have to swap\nbytes on encoding and decoding.  'UTF-32' avoids this problem: bytes\nwill always be in natural endianness.  When these bytes are read by a\nCPU with a different endianness, then bytes have to be swapped though.",
            "subsections": []
        },
        "To be able to detect the endianness of a 'UTF-16' or 'UTF-32' byte": {
            "content": "sequence, there's the so called BOM (\"Byte Order Mark\").  This is the\nUnicode character 'U+FEFF'.  This character can be prepended to every\n'UTF-16' or 'UTF-32' byte sequence.  The byte swapped version of this\ncharacter ('0xFFFE') is an illegal character that may not appear in a",
            "subsections": []
        },
        "Unicode text.  So when the first character in a 'UTF-16' or 'UTF-32'": {
            "content": "byte sequence appears to be a 'U+FFFE' the bytes have to be swapped on\ndecoding.  Unfortunately the character 'U+FEFF' had a second purpose as\na 'ZERO WIDTH NO-BREAK SPACE': a character that has no width and doesn't\nallow a word to be split.  It can e.g.  be used to give hints to a\nligature algorithm.  With Unicode 4.0 using 'U+FEFF' as a 'ZERO WIDTH\nNO-BREAK SPACE' has been deprecated (with 'U+2060' ('WORD JOINER')\nassuming this role).  Nevertheless Unicode software still must be able\nto handle 'U+FEFF' in both roles: as a BOM it's a device to determine\nthe storage layout of the encoded bytes, and vanishes once the byte\nsequence has been decoded into a string; as a 'ZERO WIDTH NO-BREAK\nSPACE' it's a normal character that will be decoded like any other.\n",
            "subsections": []
        },
        "There's another encoding that is able to encode the full range of": {
            "content": "",
            "subsections": []
        },
        "Unicode characters: UTF-8.  UTF-8 is an 8-bit encoding, which means": {
            "content": "there are no issues with byte order in UTF-8.  Each byte in a UTF-8 byte\nsequence consists of two parts: marker bits (the most significant bits)\nand payload bits.  The marker bits are a sequence of zero to four '1'\nbits followed by a '0' bit.  Unicode characters are encoded like this\n(with x being payload bits, which when concatenated give the Unicode\ncharacter):\n",
            "subsections": []
        },
        "Range                                   Encoding": {
            "content": "-------------------------------------------------------------------------------------------\n\n'U-00000000' ... 'U-0000007F'             0xxxxxxx\n\n\n'U-00000080' ... 'U-000007FF'             110xxxxx 10xxxxxx\n\n\n'U-00000800' ... 'U-0000FFFF'             1110xxxx 10xxxxxx 10xxxxxx\n\n\n'U-00010000' ... 'U-0010FFFF'             11110xxx 10xxxxxx 10xxxxxx 10xxxxxx\n\n",
            "subsections": []
        },
        "The least significant bit of the Unicode character is the rightmost x": {
            "content": "bit.\n\nAs UTF-8 is an 8-bit encoding no BOM is required and any 'U+FEFF'\ncharacter in the decoded string (even if it's the first character) is\ntreated as a 'ZERO WIDTH NO-BREAK SPACE'.\n",
            "subsections": []
        },
        "Without external information it's impossible to reliably determine which": {
            "content": "encoding was used for encoding a string.  Each charmap encoding can\ndecode any random byte sequence.  However that's not possible with\nUTF-8, as UTF-8 byte sequences have a structure that doesn't allow\narbitrary byte sequences.  To increase the reliability with which a\nUTF-8 encoding can be detected, Microsoft invented a variant of UTF-8\n(that Python calls '\"utf-8-sig\"') for its Notepad program: Before any of\nthe Unicode characters is written to the file, a UTF-8 encoded BOM\n(which looks like this as a byte sequence: '0xef', '0xbb', '0xbf') is\nwritten.  As it's rather improbable that any charmap encoded file starts\nwith these byte values (which would e.g.  map to\n\nLATIN SMALL LETTER I WITH DIAERESIS\nRIGHT-POINTING DOUBLE ANGLE QUOTATION MARK\nINVERTED QUESTION MARK\n\nin iso-8859-1), this increases the probability that a 'utf-8-sig'\nencoding can be correctly guessed from the byte sequence.  So here the\nBOM is not used to be able to determine the byte order used for\ngenerating the byte sequence, but as a signature that helps in guessing\nthe encoding.  On encoding the utf-8-sig codec will write '0xef',\n'0xbb', '0xbf' as the first three bytes to the file.  On decoding\n'utf-8-sig' will skip those three bytes if they appear as the first\nthree bytes in the file.  In UTF-8, the use of the BOM is discouraged\nand should generally be avoided.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0393/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Standard Encodings,  Next: Python Specific Encodings,  Prev: Encodings and Unicode,  Up: codecs -- Codec registry and base classes": {
            "content": "5.7.2.13 Standard Encodings\n...........................\n",
            "subsections": []
        },
        "Python comes with a number of codecs built-in, either implemented as C": {
            "content": "functions or with dictionaries as mapping tables.  The following table\nlists the codecs by name, together with a few common aliases, and the\nlanguages for which the encoding is likely used.  Neither the list of\naliases nor the list of languages is meant to be exhaustive.  Notice\nthat spelling alternatives that only differ in case or use a hyphen\ninstead of an underscore are also valid aliases; therefore, e.g.\n''utf-8'' is a valid alias for the ''utf8'' codec.\n\n'CPython implementation detail:' Some common encodings can bypass the\ncodecs lookup machinery to improve performance.  These optimization\nopportunities are only recognized by CPython for a limited set of (case\ninsensitive) aliases: utf-8, utf8, latin-1, latin1, iso-8859-1,\niso8859-1, mbcs (Windows only), ascii, us-ascii, utf-16, utf16, utf-32,\nutf32, and the same using underscores instead of dashes.  Using\nalternative aliases for these encodings may result in slower execution.\n",
            "subsections": []
        },
        "Changed in version 3.6: Optimization opportunity recognized for": {
            "content": "us-ascii.\n",
            "subsections": []
        },
        "Many of the character sets support the same languages.  They vary in": {
            "content": "individual characters (e.g.  whether the EURO SIGN is supported or not),\nand in the assignment of characters to code positions.  For the European\nlanguages in particular, the following variants typically exist:\n\n* an ISO 8859 codeset\n\n* a Microsoft Windows code page, which is typically derived from an\n8859 codeset, but replaces control characters with additional\ngraphic characters\n\n* an IBM EBCDIC code page\n\n* an IBM PC code page, which is ASCII compatible\n",
            "subsections": []
        },
        "Codec                 Aliases                              Languages": {
            "content": "------------------------------------------------------------------------------------------------\n\nascii                 646, us-ascii                        English\n\n\nbig5                  big5-tw, csbig5                      Traditional Chinese\n\n\nbig5hkscs             big5-hkscs, hkscs                    Traditional Chinese\n\n\ncp037                 IBM037, IBM039                       English\n\n\ncp273                 273, IBM273, csIBM273                German\n\nNew in version 3.4.\n\n\ncp424                 EBCDIC-CP-HE, IBM424                 Hebrew\n\n\ncp437                 437, IBM437                          English\n\n\ncp500                 EBCDIC-CP-BE, EBCDIC-CP-CH, IBM500   Western Europe\n\n\ncp720                                                      Arabic\n\n\ncp737                                                      Greek\n\n\ncp775                 IBM775                               Baltic languages\n\n\ncp850                 850, IBM850                          Western Europe\n\n\ncp852                 852, IBM852                          Central and Eastern Europe\n\n\ncp855                 855, IBM855                          Bulgarian, Byelorussian,\nMacedonian, Russian, Serbian\n\n\ncp856                                                      Hebrew\n\n\ncp857                 857, IBM857                          Turkish\n\n\ncp858                 858, IBM858                          Western Europe\n\n\ncp860                 860, IBM860                          Portuguese\n\n\ncp861                 861, CP-IS, IBM861                   Icelandic\n\n\ncp862                 862, IBM862                          Hebrew\n\n\ncp863                 863, IBM863                          Canadian\n\n\ncp864                 IBM864                               Arabic\n\n\ncp865                 865, IBM865                          Danish, Norwegian\n\n\ncp866                 866, IBM866                          Russian\n\n\ncp869                 869, CP-GR, IBM869                   Greek\n\n\ncp874                                                      Thai\n\n\ncp875                                                      Greek\n\n\ncp932                 932, ms932, mskanji, ms-kanji        Japanese\n\n\ncp949                 949, ms949, uhc                      Korean\n\n\ncp950                 950, ms950                           Traditional Chinese\n\n\ncp1006                                                     Urdu\n\n\ncp1026                ibm1026                              Turkish\n\n\ncp1125                1125, ibm1125, cp866u, ruscii        Ukrainian\n\nNew in version 3.4.\n\n\ncp1140                ibm1140                              Western Europe\n\n\ncp1250                windows-1250                         Central and Eastern Europe\n\n\ncp1251                windows-1251                         Bulgarian, Byelorussian,\nMacedonian, Russian, Serbian\n\n\ncp1252                windows-1252                         Western Europe\n\n\ncp1253                windows-1253                         Greek\n\n\ncp1254                windows-1254                         Turkish\n\n\ncp1255                windows-1255                         Hebrew\n\n\ncp1256                windows-1256                         Arabic\n\n\ncp1257                windows-1257                         Baltic languages\n\n\ncp1258                windows-1258                         Vietnamese\n\n\neucjp                eucjp, ujis, u-jis                   Japanese\n\n\neucjis2004          jisx0213, eucjis2004                 Japanese\n\n\neucjisx0213          eucjisx0213                          Japanese\n\n\neuckr                euckr, korean, ksc5601, ksc-5601,   Korean\nksc-5601-1987, ksx1001, ksx-1001\n\n\ngb2312                chinese, csiso58gb231280, euc-cn,    Simplified Chinese\neuccn, eucgb2312-cn, gb2312-1980,\ngb2312-80, iso-ir-58\n\n\ngbk                   936, cp936, ms936                    Unified Chinese\n\n\ngb18030               gb18030-2000                         Unified Chinese\n\n\nhz                    hzgb, hz-gb, hz-gb-2312              Simplified Chinese\n\n\niso2022jp            csiso2022jp, iso2022jp,              Japanese\niso-2022-jp\n\n\niso2022jp1          iso2022jp-1, iso-2022-jp-1           Japanese\n\n\niso2022jp2          iso2022jp-2, iso-2022-jp-2           Japanese, Korean, Simplified\nChinese, Western Europe, Greek\n\n\niso2022jp2004       iso2022jp-2004, iso-2022-jp-2004     Japanese\n\n\niso2022jp3          iso2022jp-3, iso-2022-jp-3           Japanese\n\n\niso2022jpext        iso2022jp-ext, iso-2022-jp-ext       Japanese\n\n\niso2022kr            csiso2022kr, iso2022kr,              Korean\niso-2022-kr\n\n\nlatin1               iso-8859-1, iso8859-1, 8859,         Western Europe\ncp819, latin, latin1, L1\n\n\niso88592             iso-8859-2, latin2, L2               Central and Eastern Europe\n\n\niso88593             iso-8859-3, latin3, L3               Esperanto, Maltese\n\n\niso88594             iso-8859-4, latin4, L4               Baltic languages\n\n\niso88595             iso-8859-5, cyrillic                 Bulgarian, Byelorussian,\nMacedonian, Russian, Serbian\n\n\niso88596             iso-8859-6, arabic                   Arabic\n\n\niso88597             iso-8859-7, greek, greek8            Greek\n\n\niso88598             iso-8859-8, hebrew                   Hebrew\n\n\niso88599             iso-8859-9, latin5, L5               Turkish\n\n\niso885910            iso-8859-10, latin6, L6              Nordic languages\n\n\niso885911            iso-8859-11, thai                    Thai languages\n\n\niso885913            iso-8859-13, latin7, L7              Baltic languages\n\n\niso885914            iso-8859-14, latin8, L8              Celtic languages\n\n\niso885915            iso-8859-15, latin9, L9              Western Europe\n\n\niso885916            iso-8859-16, latin10, L10            South-Eastern Europe\n\n\njohab                 cp1361, ms1361                       Korean\n\n\nkoi8r                                                     Russian\n\n\nkoi8t                                                     Tajik\n\nNew in version 3.5.\n\n\nkoi8u                                                     Ukrainian\n\n\nkz1048                kz1048, strk10482002, rk1048       Kazakh\n\nNew in version 3.5.\n\n\nmaccyrillic          maccyrillic                          Bulgarian, Byelorussian,\nMacedonian, Russian, Serbian\n\n\nmacgreek             macgreek                             Greek\n\n\nmaciceland           maciceland                           Icelandic\n\n\nmaclatin2            maclatin2, maccentraleurope,         Central and Eastern Europe\nmaccenteuro\n\n\nmacroman             macroman, macintosh                  Western Europe\n\n\nmacturkish           macturkish                           Turkish\n\n\nptcp154               csptcp154, pt154, cp154,             Kazakh\ncyrillic-asian\n\n\nshiftjis             csshiftjis, shiftjis, sjis, sjis    Japanese\n\n\nshiftjis2004        shiftjis2004, sjis2004, sjis2004    Japanese\n\n\nshiftjisx0213        shiftjisx0213, sjisx0213,            Japanese\nsjisx0213\n\n\nutf32                U32, utf32                           all languages\n\n\nutf32be             UTF-32BE                             all languages\n\n\nutf32le             UTF-32LE                             all languages\n\n\nutf16                U16, utf16                           all languages\n\n\nutf16be             UTF-16BE                             all languages\n\n\nutf16le             UTF-16LE                             all languages\n\n\nutf7                 U7, unicode-1-1-utf-7                all languages\n\n\nutf8                 U8, UTF, utf8, cp65001               all languages\n\n\nutf8sig                                                  all languages\n\n\nChanged in version 3.4: The utf-16* and utf-32* encoders no longer allow\nsurrogate code points ('U+D800'-'U+DFFF') to be encoded.  The utf-32*\ndecoders no longer decode byte sequences that correspond to surrogate\ncode points.\n\nChanged in version 3.8: 'cp65001' is now an alias to 'utf8'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python Specific Encodings,  Next: encodings idna -- Internationalized Domain Names in Applications,  Prev: Standard Encodings,  Up: codecs -- Codec registry and base classes": {
            "content": "5.7.2.14 Python Specific Encodings\n..................................\n\nA number of predefined codecs are specific to Python, so their codec\nnames have no meaning outside Python.  These are listed in the tables\nbelow based on the expected input and output types (note that while text\nencodings are the most common use case for codecs, the underlying codec\ninfrastructure supports arbitrary data transforms rather than just text\nencodings).  For asymmetric codecs, the stated meaning describes the\nencoding direction.\n\n* Menu:\n\n* Text Encodings::\n* Binary Transforms::\n* Text Transforms::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Text Encodings,  Next: Binary Transforms,  Up: Python Specific Encodings": {
            "content": "5.7.2.15 Text Encodings\n.......................\n\nThe following codecs provide *note str: 157. to *note bytes: 295.\nencoding and *note bytes-like object: b82. to *note str: 157. decoding,\nsimilar to the Unicode text encodings.\n",
            "subsections": []
        },
        "Codec                    Aliases       Meaning": {
            "content": "-----------------------------------------------------------------------\n\nrot13                   rot13         Return the Caesar-cypher\nencryption of the operand.\n\n\nNew in version 3.2: Restoration of the 'rot13' text transform.\n\nChanged in version 3.4: Restoration of the 'rot13' alias.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Binary Transforms,  Next: Text Transforms,  Prev: Text Encodings,  Up: Python Specific Encodings": {
            "content": "5.7.2.16 Binary Transforms\n..........................\n\nThe following codecs provide binary transforms: *note bytes-like object:\nb82. to *note bytes: 295. mappings.  They are not supported by *note\nbytes.decode(): 6ef. (which only produces *note str: 157. output).\n",
            "subsections": []
        },
        "Codec                      Aliases                Meaning                            Encoder / decoder": {
            "content": "------------------------------------------------------------------------------------------------------------------------\n\nbase64codec (1)           base64, base64        Convert the operand to multiline   *note base64.encodebytes(): 773.\nMIME base64 (the result always     /\nincludes a trailing ''\\n'').       *note base64.decodebytes(): 774.\n\nChanged in version 3.4: accepts\nany\n*note bytes-like object: b82. as\ninput for encoding and decoding\n\n\nbz2codec                  bz2                    Compress the operand using bz2.    *note bz2.compress(): 2120. /\n*note bz2.decompress(): f06.\n\n\nhexcodec                  hex                    Convert the operand to             *note binascii.b2ahex(): 2121.\nhexadecimal representation, with   /\ntwo digits per byte.               *note binascii.a2bhex(): 2122.\n\n\nquopricodec               quopri,                Convert the operand to MIME        *note quopri.encode(): 2123.\nquotedprintable,       quoted printable.                  with 'quotetabs=True' /\nquotedprintable                                          *note quopri.decode(): 2124.\n\n\nuucodec                   uu                     Convert the operand using          'uu.encode()' / 'uu.decode()'\nuuencode.                          (Note: *note uu: 10a. is\ndeprecated.)\n\n\nzlibcodec                 zip, zlib              Compress the operand using gzip.   *note zlib.compress(): b5e. /\n*note zlib.decompress(): b5f.\n\n\nNew in version 3.2: Restoration of the binary transforms.\n",
            "subsections": []
        },
        "Changed in version 3.4: Restoration of the aliases for the binary": {
            "content": "transforms.\n\n---------- Footnotes ----------\n\n(1) In addition to *note bytes-like objects: b82, ''base64codec''\nalso accepts ASCII-only instances of *note str: 157. for decoding\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Text Transforms,  Prev: Binary Transforms,  Up: Python Specific Encodings": {
            "content": "5.7.2.17 Text Transforms\n........................\n\nThe following codec provides a text transform: a *note str: 157. to\n*note str: 157. mapping.  It is not supported by *note str.encode():\n6ee. (which only produces *note bytes: 295. output).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: encodings idna -- Internationalized Domain Names in Applications,  Next: encodings mbcs -- Windows ANSI codepage,  Prev: Python Specific Encodings,  Up: codecs -- Codec registry and base classes": {
            "content": "5.7.2.18 'encodings.idna' -- Internationalized Domain Names in Applications\n..........................................................................\n",
            "subsections": []
        },
        "This module implements RFC 3490(1) (Internationalized Domain Names in": {
            "content": "",
            "subsections": []
        },
        "Applications) and RFC 3492(2) (Nameprep: A Stringprep Profile for": {
            "content": "",
            "subsections": []
        },
        "Internationalized Domain Names (IDN)). It builds upon the 'punycode'": {
            "content": "encoding and *note stringprep: ce.\n",
            "subsections": []
        },
        "If you need the IDNA 2008 standard from RFC 5891(3) and RFC 5895(4), use": {
            "content": "the third-party idna module(5).\n",
            "subsections": []
        },
        "These RFCs together define a protocol to support non-ASCII characters in": {
            "content": "domain names.  A domain name containing non-ASCII characters (such as\n'www.Alliancefranc,aise.nu') is converted into an ASCII-compatible\nencoding (ACE, such as 'www.xn--alliancefranaise-npb.nu').  The ACE form\nof the domain name is then used in all places where arbitrary characters\nare not allowed by the protocol, such as DNS queries, HTTP 'Host'\nfields, and so on.  This conversion is carried out in the application;\nif possible invisible to the user: The application should transparently\nconvert Unicode domain labels to IDNA on the wire, and convert back ACE\nlabels to Unicode before presenting them to the user.\n",
            "subsections": []
        },
        "Python supports this conversion in several ways: the 'idna' codec": {
            "content": "performs conversion between Unicode and ACE, separating an input string\ninto labels based on the separator characters defined in section 3.1 of\nRFC 3490(6) and converting each label to ACE as required, and conversely\nseparating an input byte string into labels based on the '.' separator\nand converting any ACE labels found into unicode.  Furthermore, the\n*note socket: c6. module transparently converts Unicode host names to\nACE, so that applications need not be concerned about converting host\nnames themselves when they pass them to the socket module.  On top of\nthat, modules that have host names as function parameters, such as *note\nhttp.client: 6a. and *note ftplib: 59, accept Unicode host names (*note\nhttp.client: 6a. then also transparently sends an IDNA hostname in the\n'Host' field if it sends that field at all).\n",
            "subsections": []
        },
        "When receiving host names from the wire (such as in reverse name": {
            "content": "lookup), no automatic conversion to Unicode is performed: applications\nwishing to present such host names to the user should decode them to\nUnicode.\n\nThe module *note encodings.idna: 4d. also implements the nameprep\nprocedure, which performs certain normalizations on host names, to\nachieve case-insensitivity of international domain names, and to unify\nsimilar characters.  The nameprep functions can be used directly if\ndesired.\n\n-- Function: encodings.idna.nameprep (label)\n\nReturn the nameprepped version of 'label'.  The implementation\ncurrently assumes query strings, so 'AllowUnassigned' is true.\n\n-- Function: encodings.idna.ToASCII (label)\n\nConvert a label to ASCII, as specified in RFC 3490(7).\n'UseSTD3ASCIIRules' is assumed to be false.\n\n-- Function: encodings.idna.ToUnicode (label)\n\nConvert a label to Unicode, as specified in RFC 3490(8).\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc3490.html\n\n(2) https://datatracker.ietf.org/doc/html/rfc3492.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc5891.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc5895.html\n\n(5) https://pypi.org/project/idna/\n\n(6) https://datatracker.ietf.org/doc/html/rfc3490.html#section-3.1\n\n(7) https://datatracker.ietf.org/doc/html/rfc3490.html\n\n(8) https://datatracker.ietf.org/doc/html/rfc3490.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: encodings mbcs -- Windows ANSI codepage,  Next: encodings utf8sig -- UTF-8 codec with BOM signature,  Prev: encodings idna -- Internationalized Domain Names in Applications,  Up: codecs -- Codec registry and base classes": {
            "content": "5.7.2.19 'encodings.mbcs' -- Windows ANSI codepage\n.................................................\n\nThis module implements the ANSI codepage (CPACP).\n\n*note Availability: 1ad3.: Windows.\n",
            "subsections": []
        },
        "Changed in version 3.2: Before 3.2, the 'errors' argument was ignored;": {
            "content": "''replace'' was always used to encode, and ''ignore'' to decode.\n\nChanged in version 3.3: Support any error handler.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: encodings utf8sig -- UTF-8 codec with BOM signature,  Prev: encodings mbcs -- Windows ANSI codepage,  Up: codecs -- Codec registry and base classes": {
            "content": "5.7.2.20 'encodings.utf8sig' -- UTF-8 codec with BOM signature\n...............................................................\n",
            "subsections": []
        },
        "This module implements a variant of the UTF-8 codec.  On encoding, a": {
            "content": "UTF-8 encoded BOM will be prepended to the UTF-8 encoded bytes.  For the\nstateful encoder this is only done once (on the first write to the byte\nstream).  On decoding, an optional UTF-8 encoded BOM at the start of the\ndata will be skipped.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Data Types,  Next: Numeric and Mathematical Modules,  Prev: Binary Data Services,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.8 Data Types",
                    "content": ""
                }
            ]
        },
        "The modules described in this chapter provide a variety of specialized": {
            "content": "data types such as dates and times, fixed-type arrays, heap queues,\ndouble-ended queues, and enumerations.\n\nPython also provides some built-in data types, in particular, *note\ndict: 237, *note list: 3dc, *note set: 39d. and *note frozenset: 39e,\nand *note tuple: 4b8.  The *note str: 157. class is used to hold Unicode\nstrings, and the *note bytes: 295. and *note bytearray: 294. classes are\nused to hold binary data.\n\nThe following modules are documented in this chapter:\n\n* Menu:\n\n* datetime -- Basic date and time types::\n* zoneinfo -- IANA time zone support::\n* calendar -- General calendar-related functions::\n* collections -- Container datatypes::\n* collections.abc -- Abstract Base Classes for Containers: collections abc -- Abstract Base Classes for Containers.\n* heapq -- Heap queue algorithm::\n* bisect -- Array bisection algorithm::\n* array -- Efficient arrays of numeric values::\n* weakref -- Weak references::\n* types -- Dynamic type creation and names for built-in types::\n* copy -- Shallow and deep copy operations::\n* pprint -- Data pretty printer::\n* reprlib -- Alternate repr() implementation: reprlib -- Alternate repr implementation.\n* enum -- Support for enumerations::\n* graphlib -- Functionality to operate with graph-like structures::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: datetime -- Basic date and time types,  Next: zoneinfo -- IANA time zone support,  Up: Data Types": {
            "content": "'Source code:' Lib/datetime.py(1)\n\n\n\nThe 'datetime' module supplies classes for manipulating dates and times.\n",
            "subsections": []
        },
        "While date and time arithmetic is supported, the focus of the": {
            "content": "implementation is on efficient attribute extraction for output\nformatting and manipulation.\n\nTip: Skip to *note the format codes: 2131.\n\nSee also\n........\n\nModule *note calendar: 12.\n\nGeneral calendar related functions.\n\nModule *note time: e8.\n\nTime access and conversions.\n\nModule *note zoneinfo: 12e.\n\nConcrete time zones representing the IANA time zone database.\n",
            "subsections": []
        },
        "Package dateutil(2)": {
            "content": "Third-party library with expanded time zone and parsing support.\n",
            "subsections": []
        },
        "Package DateType(3)": {
            "content": "Third-party library that introduces distinct static types to e.g.\nallow *note static type checkers: 2132. to differentiate between\nnaive and aware datetimes.\n\n* Menu:\n\n* Aware and Naive Objects::\n* Constants::\n* Available Types::\n* timedelta Objects::\n* date Objects::\n* datetime Objects::\n* time Objects::\n* tzinfo Objects::\n* timezone Objects::\n* strftime() and strptime() Behavior: strftime and strptime Behavior.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/datetime.py\n\n(2) https://dateutil.readthedocs.io/en/stable/\n\n(3) https://pypi.org/project/datetype/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Aware and Naive Objects,  Next: Constants,  Up: datetime -- Basic date and time types": {
            "content": "5.8.1.1 Aware and Naive Objects\n...............................\n\nDate and time objects may be categorized as \"aware\" or \"naive\" depending\non whether or not they include timezone information.\n",
            "subsections": []
        },
        "With sufficient knowledge of applicable algorithmic and political time": {
            "content": "adjustments, such as time zone and daylight saving time information, an\n'aware' object can locate itself relative to other aware objects.  An\naware object represents a specific moment in time that is not open to\ninterpretation.  (1)\n\nA 'naive' object does not contain enough information to unambiguously\nlocate itself relative to other date/time objects.  Whether a naive\nobject represents Coordinated Universal Time (UTC), local time, or time\nin some other timezone is purely up to the program, just like it is up\nto the program whether a particular number represents metres, miles, or\nmass.  Naive objects are easy to understand and to work with, at the\ncost of ignoring some aspects of reality.\n\nFor applications requiring aware objects, *note datetime: 222. and *note\ntime: 6a5. objects have an optional time zone information attribute,\n'tzinfo', that can be set to an instance of a subclass of the abstract\n*note tzinfo: 3a2. class.  These *note tzinfo: 3a2. objects capture\ninformation about the offset from UTC time, the time zone name, and\nwhether daylight saving time is in effect.\n\nOnly one concrete *note tzinfo: 3a2. class, the *note timezone: f2f.\nclass, is supplied by the 'datetime' module.  The *note timezone: f2f.\nclass can represent simple timezones with fixed offsets from UTC, such\nas UTC itself or North American EST and EDT timezones.  Supporting\ntimezones at deeper levels of detail is up to the application.  The\nrules for time adjustment across the world are more political than\nrational, change frequently, and there is no standard suitable for every\napplication aside from UTC.\n\n---------- Footnotes ----------\n\n(1) If, that is, we ignore the effects of Relativity\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Constants,  Next: Available Types,  Prev: Aware and Naive Objects,  Up: datetime -- Basic date and time types": {
            "content": "5.8.1.2 Constants\n.................\n\nThe 'datetime' module exports the following constants:\n\n-- Data: datetime.MINYEAR\n\nThe smallest year number allowed in a *note date: 70f. or *note\ndatetime: 222. object.  *note MINYEAR: 2136. is '1'.\n\n-- Data: datetime.MAXYEAR\n\nThe largest year number allowed in a *note date: 70f. or *note\ndatetime: 222. object.  *note MAXYEAR: 2137. is '9999'.\n\n-- Attribute: datetime.UTC\n\nAlias for the UTC timezone singleton *note datetime.timezone.utc:\n3df.\n\nNew in version 3.11.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Available Types,  Next: timedelta Objects,  Prev: Constants,  Up: datetime -- Basic date and time types": {
            "content": "5.8.1.3 Available Types\n.......................\n\n-- Class: datetime.date\n\nAn idealized naive date, assuming the current Gregorian calendar\nalways was, and always will be, in effect.  Attributes: *note year:\n2139, *note month: 213a, and *note day: 213b.\n\n-- Class: datetime.time\n\nAn idealized time, independent of any particular day, assuming that\nevery day has exactly 24*60*60 seconds.  (There is no notion of\n\"leap seconds\" here.)  Attributes: *note hour: 213c, *note minute:\n213d, *note second: 213e, *note microsecond: 213f, and *note\ntzinfo: 2140.\n\n-- Class: datetime.datetime\n\nA combination of a date and a time.  Attributes: *note year: 2141,\n*note month: 2142, *note day: 2143, *note hour: 2144, *note minute:\n2145, *note second: 2146, *note microsecond: 2147, and *note\ntzinfo: 2148.\n\n-- Class: datetime.timedelta\n\nA duration expressing the difference between two *note datetime:\n222. or *note date: 70f. instances to microsecond resolution.\n\n-- Class: datetime.tzinfo\n\nAn abstract base class for time zone information objects.  These\nare used by the *note datetime: 222. and *note time: 6a5. classes\nto provide a customizable notion of time adjustment (for example,\nto account for time zone and/or daylight saving time).\n\n-- Class: datetime.timezone\n\nA class that implements the *note tzinfo: 3a2. abstract base class\nas a fixed offset from the UTC.\n\nNew in version 3.2.\n\nObjects of these types are immutable.\n\nSubclass relationships:\n\nobject\ntimedelta\ntzinfo\ntimezone\ntime\ndate\ndatetime\n\n* Menu:\n\n* Common Properties::\n* Determining if an Object is Aware or Naive::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Common Properties,  Next: Determining if an Object is Aware or Naive,  Up: Available Types": {
            "content": "5.8.1.4 Common Properties\n.........................\n\nThe *note date: 70f, *note datetime: 222, *note time: 6a5, and *note\ntimezone: f2f. types share these common features:\n\n- Objects of these types are immutable.\n\n- Objects of these types are *note hashable: 3db, meaning that they\ncan be used as dictionary keys.\n\n- Objects of these types support efficient pickling via the *note\npickle: a1. module.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Determining if an Object is Aware or Naive,  Prev: Common Properties,  Up: Available Types": {
            "content": "5.8.1.5 Determining if an Object is Aware or Naive\n..................................................\n\nObjects of the *note date: 70f. type are always naive.\n\nAn object of type *note time: 6a5. or *note datetime: 222. may be aware\nor naive.\n\nA *note datetime: 222. object 'd' is aware if both of the following\nhold:\n\n1. 'd.tzinfo' is not 'None'\n\n2. 'd.tzinfo.utcoffset(d)' does not return 'None'\n\nOtherwise, 'd' is naive.\n\nA *note time: 6a5. object 't' is aware if both of the following hold:\n\n1. 't.tzinfo' is not 'None'\n\n2. 't.tzinfo.utcoffset(None)' does not return 'None'.\n\nOtherwise, 't' is naive.\n\nThe distinction between aware and naive doesn't apply to *note\ntimedelta: 7f3. objects.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: timedelta Objects,  Next: date Objects,  Prev: Available Types,  Up: datetime -- Basic date and time types": {
            "content": "5.8.1.6 'timedelta' Objects\n...........................\n\nA *note timedelta: 7f3. object represents a duration, the difference\nbetween two *note datetime: 222. or *note date: 70f. instances.\n\n-- Class: datetime.timedelta (days=0, seconds=0, microseconds=0,\nmilliseconds=0, minutes=0, hours=0, weeks=0)\n\nAll arguments are optional and default to '0'.  Arguments may be\nintegers or floats, and may be positive or negative.\n\nOnly 'days', 'seconds' and 'microseconds' are stored internally.\nArguments are converted to those units:\n\n* A millisecond is converted to 1000 microseconds.\n\n* A minute is converted to 60 seconds.\n\n* An hour is converted to 3600 seconds.\n\n* A week is converted to 7 days.\n\nand days, seconds and microseconds are then normalized so that the\nrepresentation is unique, with\n\n* '0 <= microseconds < 1000000'\n\n* '0 <= seconds < 3600*24' (the number of seconds in one day)\n\n* '-999999999 <= days <= 999999999'\n\nThe following example illustrates how any arguments besides 'days',\n'seconds' and 'microseconds' are \"merged\" and normalized into those\nthree resulting attributes:\n\n>>> from datetime import timedelta\n>>> delta = timedelta(\n...     days=50,\n...     seconds=27,\n...     microseconds=10,\n...     milliseconds=29000,\n...     minutes=5,\n...     hours=8,\n...     weeks=2\n... )\n>>> # Only days, seconds, and microseconds remain\n>>> delta\ndatetime.timedelta(days=64, seconds=29156, microseconds=10)\n\nIf any argument is a float and there are fractional microseconds,\nthe fractional microseconds left over from all arguments are\ncombined and their sum is rounded to the nearest microsecond using\nround-half-to-even tiebreaker.  If no argument is a float, the\nconversion and normalization processes are exact (no information is\nlost).\n\nIf the normalized value of days lies outside the indicated range,\n*note OverflowError: 68d. is raised.\n\nNote that normalization of negative values may be surprising at\nfirst.  For example:\n\n>>> from datetime import timedelta\n>>> d = timedelta(microseconds=-1)\n>>> (d.days, d.seconds, d.microseconds)\n(-1, 86399, 999999)\n\nClass attributes:\n\n-- Attribute: timedelta.min\n\nThe most negative *note timedelta: 7f3. object,\n'timedelta(-999999999)'.\n\n-- Attribute: timedelta.max\n\nThe most positive *note timedelta: 7f3. object,\n'timedelta(days=999999999, hours=23, minutes=59, seconds=59,\nmicroseconds=999999)'.\n\n-- Attribute: timedelta.resolution\n\nThe smallest possible difference between non-equal *note timedelta:\n7f3. objects, 'timedelta(microseconds=1)'.\n\nNote that, because of normalization, 'timedelta.max' > '-timedelta.min'.\n'-timedelta.max' is not representable as a *note timedelta: 7f3. object.\n\nInstance attributes (read-only):\n",
            "subsections": []
        },
        "Attribute              Value": {
            "content": "------------------------------------------------------------------------\n\n'days'                 Between -999999999 and 999999999 inclusive\n\n\n'seconds'              Between 0 and 86399 inclusive\n\n\n'microseconds'         Between 0 and 999999 inclusive\n\n\nSupported operations:\n",
            "subsections": []
        },
        "Operation                            Result": {
            "content": "-----------------------------------------------------------------------------------------\n\n't1 = t2 + t3'                       Sum of 't2' and 't3'.  Afterwards 't1'-'t2' ==\n't3' and 't1'-'t3' == 't2' are true.  (1)\n\n\n't1 = t2 - t3'                       Difference of 't2' and 't3'.  Afterwards 't1' ==\n't2' - 't3' and 't2' == 't1' + 't3' are true.\n(1)(6)\n\n\n't1 = t2 * i or t1 = i * t2'         Delta multiplied by an integer.  Afterwards 't1'\n// i == 't2' is true, provided 'i != 0'.\n\n\nIn general, 't1' * i == 't1' * (i-1) + 't1' is\ntrue.  (1)\n\n\n't1 = t2 * f or t1 = f * t2'         Delta multiplied by a float.  The result is\nrounded to the nearest multiple of\ntimedelta.resolution using round-half-to-even.\n\n\n'f = t2 / t3'                        Division (3) of overall duration 't2' by interval\nunit 't3'.  Returns a *note float: 4b7. object.\n\n\n't1 = t2 / f or t1 = t2 / i'         Delta divided by a float or an int.  The result\nis rounded to the nearest multiple of\ntimedelta.resolution using round-half-to-even.\n\n\n't1 = t2 // i' or 't1 = t2 // t3'    The floor is computed and the remainder (if any)\nis thrown away.  In the second case, an integer\nis returned.  (3)\n\n\n't1 = t2 % t3'                       The remainder is computed as a\n*note timedelta: 7f3. object.  (3)\n\n\n'q, r = divmod(t1, t2)'              Computes the quotient and the remainder: 'q = t1\n// t2' (3) and 'r = t1 % t2'.  q is an integer\nand r is a *note timedelta: 7f3. object.\n\n\n'+t1'                                Returns a *note timedelta: 7f3. object with the\nsame value.  (2)\n\n\n'-t1'                                equivalent to *note timedelta: 7f3.(-'t1.days',\n-'t1.seconds', -'t1.microseconds'), and to 't1'*\n-1.  (1)(4)\n\n\n'abs(t)'                             equivalent to +'t' when 't.days >= 0', and to\n-'t' when 't.days < 0'.  (2)\n\n\n'str(t)'                             Returns a string in the form '[D day[s],\n][H]H:MM:SS[.UUUUUU]', where D is negative for\nnegative 't'.  (5)\n\n\n'repr(t)'                            Returns a string representation of the\n*note timedelta: 7f3. object as a constructor\ncall with canonical attribute values.\n\n\nNotes:\n\n1. This is exact but may overflow.\n\n2. This is exact and cannot overflow.\n\n3. Division by 0 raises *note ZeroDivisionError: 763.\n\n4. -'timedelta.max' is not representable as a *note timedelta: 7f3.\nobject.\n\n5. String representations of *note timedelta: 7f3. objects are\nnormalized similarly to their internal representation.  This leads\nto somewhat unusual results for negative timedeltas.  For example:\n\n>>> timedelta(hours=-5)\ndatetime.timedelta(days=-1, seconds=68400)\n>>> print()\n-1 day, 19:00:00\n\n6. The expression 't2 - t3' will always be equal to the expression 't2\n+ (-t3)' except when t3 is equal to 'timedelta.max'; in that case\nthe former will produce a result while the latter will overflow.\n\nIn addition to the operations listed above, *note timedelta: 7f3.\nobjects support certain additions and subtractions with *note date: 70f.\nand *note datetime: 222. objects (see below).\n\nChanged in version 3.2: Floor division and true division of a *note\ntimedelta: 7f3. object by another *note timedelta: 7f3. object are now\nsupported, as are remainder operations and the *note divmod(): 7c5.\nfunction.  True division and multiplication of a *note timedelta: 7f3.\nobject by a *note float: 4b7. object are now supported.\n\n*note timedelta: 7f3. objects support equality and order comparisons.\n\nIn Boolean contexts, a *note timedelta: 7f3. object is considered to be\ntrue if and only if it isn't equal to 'timedelta(0)'.\n\nInstance methods:\n\n-- Method: timedelta.totalseconds ()\n\nReturn the total number of seconds contained in the duration.\nEquivalent to 'td / timedelta(seconds=1)'.  For interval units\nother than seconds, use the division form directly (e.g.  'td /\ntimedelta(microseconds=1)').\n\nNote that for very large time intervals (greater than 270 years on\nmost platforms) this method will lose microsecond accuracy.\n\nNew in version 3.2.\n\n* Menu:\n\n* Examples of usage; timedelta: Examples of usage timedelta.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Examples of usage timedelta,  Up: timedelta Objects": {
            "content": "5.8.1.7 Examples of usage: 'timedelta'\n......................................\n\nAn additional example of normalization:\n\n>>> # Components of anotheryear add up to exactly 365 days\n>>> from datetime import timedelta\n>>> year = timedelta(days=365)\n>>> anotheryear = timedelta(weeks=40, days=84, hours=23,\n...                          minutes=50, seconds=600)\n>>> year == anotheryear\nTrue\n>>> year.totalseconds()\n31536000.0\n\nExamples of *note timedelta: 7f3. arithmetic:\n\n>>> from datetime import timedelta\n>>> year = timedelta(days=365)\n>>> tenyears = 10 * year\n>>> tenyears\ndatetime.timedelta(days=3650)\n>>> tenyears.days // 365\n10\n>>> nineyears = tenyears - year\n>>> nineyears\ndatetime.timedelta(days=3285)\n>>> threeyears = nineyears // 3\n>>> threeyears, threeyears.days // 365\n(datetime.timedelta(days=1095), 3)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: date Objects,  Next: datetime Objects,  Prev: timedelta Objects,  Up: datetime -- Basic date and time types": {
            "content": "5.8.1.8 'date' Objects\n......................\n\nA *note date: 70f. object represents a date (year, month and day) in an\nidealized calendar, the current Gregorian calendar indefinitely extended\nin both directions.\n",
            "subsections": []
        },
        "January 1 of year 1 is called day number 1, January 2 of year 1 is": {
            "content": "called day number 2, and so on.  (1)\n\n-- Class: datetime.date (year, month, day)\n\nAll arguments are required.  Arguments must be integers, in the\nfollowing ranges:\n\n* 'MINYEAR <= year <= MAXYEAR'\n\n* '1 <= month <= 12'\n\n* '1 <= day <= number of days in the given month and year'\n\nIf an argument outside those ranges is given, *note ValueError:\n183. is raised.\n\nOther constructors, all class methods:\n\n-- Method: classmethod date.today ()\n\nReturn the current local date.\n\nThis is equivalent to 'date.fromtimestamp(time.time())'.\n\n-- Method: classmethod date.fromtimestamp (timestamp)\n\nReturn the local date corresponding to the POSIX timestamp, such as\nis returned by *note time.time(): 918.\n\nThis may raise *note OverflowError: 68d, if the timestamp is out of\nthe range of values supported by the platform C 'localtime()'\nfunction, and *note OSError: 613. on 'localtime()' failure.  It's\ncommon for this to be restricted to years from 1970 through 2038.\nNote that on non-POSIX systems that include leap seconds in their\nnotion of a timestamp, leap seconds are ignored by *note\nfromtimestamp(): 2153.\n\nChanged in version 3.3: Raise *note OverflowError: 68d. instead of\n*note ValueError: 183. if the timestamp is out of the range of\nvalues supported by the platform C 'localtime()' function.  Raise\n*note OSError: 613. instead of *note ValueError: 183. on\n'localtime()' failure.\n\n-- Method: classmethod date.fromordinal (ordinal)\n\nReturn the date corresponding to the proleptic Gregorian ordinal,\nwhere January 1 of year 1 has ordinal 1.\n\n*note ValueError: 183. is raised unless '1 <= ordinal <=\ndate.max.toordinal()'.  For any date 'd',\n'date.fromordinal(d.toordinal()) == d'.\n\n-- Method: classmethod date.fromisoformat (datestring)\n\nReturn a *note date: 70f. corresponding to a 'datestring' given in\nany valid ISO 8601 format, with the following exceptions:\n\n1. Reduced precision dates are not currently supported\n('YYYY-MM', 'YYYY').\n\n2. Extended date representations are not currently supported\n('??YYYYYY-MM-DD').\n\n3. Ordinal dates are not currently supported ('YYYY-OOO').\n\nExamples:\n\n>>> from datetime import date\n>>> date.fromisoformat('2019-12-04')\ndatetime.date(2019, 12, 4)\n>>> date.fromisoformat('20191204')\ndatetime.date(2019, 12, 4)\n>>> date.fromisoformat('2021-W01-1')\ndatetime.date(2021, 1, 4)\n\nNew in version 3.7.\n\nChanged in version 3.11: Previously, this method only supported the\nformat 'YYYY-MM-DD'.\n\n-- Method: classmethod date.fromisocalendar (year, week, day)\n\nReturn a *note date: 70f. corresponding to the ISO calendar date\nspecified by year, week and day.  This is the inverse of the\nfunction *note date.isocalendar(): 70e.\n\nNew in version 3.8.\n\nClass attributes:\n\n-- Attribute: date.min\n\nThe earliest representable date, 'date(MINYEAR, 1, 1)'.\n\n-- Attribute: date.max\n\nThe latest representable date, 'date(MAXYEAR, 12, 31)'.\n\n-- Attribute: date.resolution\n\nThe smallest possible difference between non-equal date objects,\n'timedelta(days=1)'.\n\nInstance attributes (read-only):\n\n-- Attribute: date.year\n\nBetween *note MINYEAR: 2136. and *note MAXYEAR: 2137. inclusive.\n\n-- Attribute: date.month\n\nBetween 1 and 12 inclusive.\n\n-- Attribute: date.day\n\nBetween 1 and the number of days in the given month of the given\nyear.\n\nSupported operations:\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Examples of Usage date,  Up: date Objects": {
            "content": "5.8.1.9 Examples of Usage: 'date'\n.................................\n\nExample of counting days to an event:\n\n>>> import time\n>>> from datetime import date\n>>> today = date.today()\n>>> today\ndatetime.date(2007, 12, 5)\n>>> today == date.fromtimestamp(time.time())\nTrue\n>>> mybirthday = date(today.year, 6, 24)\n>>> if mybirthday < today:\n...     mybirthday = mybirthday.replace(year=today.year + 1)\n...\n>>> mybirthday\ndatetime.date(2008, 6, 24)\n>>> timetobirthday = abs(mybirthday - today)\n>>> timetobirthday.days\n202\n\nMore examples of working with *note date: 70f.:\n\n>>> from datetime import date\n>>> d = date.fromordinal(730920) # 730920th day after 1. 1. 0001\n>>> d\ndatetime.date(2002, 3, 11)\n\n>>> # Methods related to formatting string output\n>>> d.isoformat()\n'2002-03-11'\n>>> d.strftime(\"%d/%m/%y\")\n'11/03/02'\n>>> d.strftime(\"%A %d. %B %Y\")\n'Monday 11. March 2002'\n>>> d.ctime()\n'Mon Mar 11 00:00:00 2002'\n>>> 'The {1} is {0:%d}, the {2} is {0:%B}.'.format(d, \"day\", \"month\")\n'The day is 11, the month is March.'\n\n>>> # Methods for to extracting 'components' under different calendars\n>>> t = d.timetuple()\n>>> for i in t:\n...     print(i)\n2002                # year\n3                   # month\n11                  # day\n0\n0\n0\n0                   # weekday (0 = Monday)\n70                  # 70th day in the year\n-1\n>>> ic = d.isocalendar()\n>>> for i in ic:\n...     print(i)\n2002                # ISO year\n11                  # ISO week number\n1                   # ISO day number ( 1 = Monday )\n\n>>> # A date object is immutable; all operations produce a new object\n>>> d.replace(year=2005)\ndatetime.date(2005, 3, 11)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: datetime Objects,  Next: time Objects,  Prev: date Objects,  Up: datetime -- Basic date and time types": {
            "content": "5.8.1.10 'datetime' Objects\n...........................\n\nA *note datetime: 222. object is a single object containing all the\ninformation from a *note date: 70f. object and a *note time: 6a5.\nobject.\n\nLike a *note date: 70f. object, *note datetime: 222. assumes the current\nGregorian calendar extended in both directions; like a *note time: 6a5.\nobject, *note datetime: 222. assumes there are exactly 3600*24 seconds\nin every day.\n\nConstructor:\n\n-- Class: datetime.datetime (year, month, day, hour=0, minute=0,\nsecond=0, microsecond=0, tzinfo=None, *, fold=0)\n\nThe 'year', 'month' and 'day' arguments are required.  'tzinfo' may\nbe 'None', or an instance of a *note tzinfo: 3a2. subclass.  The\nremaining arguments must be integers in the following ranges:\n\n* 'MINYEAR <= year <= MAXYEAR',\n\n* '1 <= month <= 12',\n\n* '1 <= day <= number of days in the given month and year',\n\n* '0 <= hour < 24',\n\n* '0 <= minute < 60',\n\n* '0 <= second < 60',\n\n* '0 <= microsecond < 1000000',\n\n* 'fold in [0, 1]'.\n\nIf an argument outside those ranges is given, *note ValueError:\n183. is raised.\n\nChanged in version 3.6: Added the 'fold' parameter.\n\nOther constructors, all class methods:\n\n-- Method: classmethod datetime.today ()\n\nReturn the current local datetime, with *note tzinfo: 2148. 'None'.\n\nEquivalent to:\n\ndatetime.fromtimestamp(time.time())\n\nSee also *note now(): 225, *note fromtimestamp(): 226.\n\nThis method is functionally equivalent to *note now(): 225, but\nwithout a 'tz' parameter.\n\n-- Method: classmethod datetime.now (tz=None)\n\nReturn the current local date and time.\n\nIf optional argument 'tz' is 'None' or not specified, this is like\n*note today(): 2165, but, if possible, supplies more precision than\ncan be gotten from going through a *note time.time(): 918.\ntimestamp (for example, this may be possible on platforms supplying\nthe C 'gettimeofday()' function).\n\nIf 'tz' is not 'None', it must be an instance of a *note tzinfo:\n3a2. subclass, and the current date and time are converted to\n'tz''s time zone.\n\nThis function is preferred over *note today(): 2165. and *note\nutcnow(): 223.\n\n-- Method: classmethod datetime.utcnow ()\n\nReturn the current UTC date and time, with *note tzinfo: 2148.\n'None'.\n\nThis is like *note now(): 225, but returns the current UTC date and\ntime, as a naive *note datetime: 222. object.  An aware current UTC\ndatetime can be obtained by calling 'datetime.now(timezone.utc)'.\nSee also *note now(): 225.\n\nWarning: Because naive 'datetime' objects are treated by many\n'datetime' methods as local times, it is preferred to use\naware datetimes to represent times in UTC. As such, the\nrecommended way to create an object representing the current\ntime in UTC is by calling 'datetime.now(timezone.utc)'.\n\nDeprecated since version 3.12: Use *note datetime.now(): 225. with\n*note UTC: 227. instead.\n\n-- Method: classmethod datetime.fromtimestamp (timestamp, tz=None)\n\nReturn the local date and time corresponding to the POSIX\ntimestamp, such as is returned by *note time.time(): 918.  If\noptional argument 'tz' is 'None' or not specified, the timestamp is\nconverted to the platform's local date and time, and the returned\n*note datetime: 222. object is naive.\n\nIf 'tz' is not 'None', it must be an instance of a *note tzinfo:\n3a2. subclass, and the timestamp is converted to 'tz''s time zone.\n\n*note fromtimestamp(): 226. may raise *note OverflowError: 68d, if\nthe timestamp is out of the range of values supported by the\nplatform C 'localtime()' or 'gmtime()' functions, and *note\nOSError: 613. on 'localtime()' or 'gmtime()' failure.  It's common\nfor this to be restricted to years in 1970 through 2038.  Note that\non non-POSIX systems that include leap seconds in their notion of a\ntimestamp, leap seconds are ignored by *note fromtimestamp(): 226,\nand then it's possible to have two timestamps differing by a second\nthat yield identical *note datetime: 222. objects.  This method is\npreferred over *note utcfromtimestamp(): 224.\n\nChanged in version 3.3: Raise *note OverflowError: 68d. instead of\n*note ValueError: 183. if the timestamp is out of the range of\nvalues supported by the platform C 'localtime()' or 'gmtime()'\nfunctions.  Raise *note OSError: 613. instead of *note ValueError:\n183. on 'localtime()' or 'gmtime()' failure.\n\nChanged in version 3.6: *note fromtimestamp(): 226. may return\ninstances with *note fold: aa0. set to 1.\n\n-- Method: classmethod datetime.utcfromtimestamp (timestamp)\n\nReturn the UTC *note datetime: 222. corresponding to the POSIX\ntimestamp, with *note tzinfo: 2148. 'None'.  (The resulting object\nis naive.)\n\nThis may raise *note OverflowError: 68d, if the timestamp is out of\nthe range of values supported by the platform C 'gmtime()'\nfunction, and *note OSError: 613. on 'gmtime()' failure.  It's\ncommon for this to be restricted to years in 1970 through 2038.\n\nTo get an aware *note datetime: 222. object, call *note\nfromtimestamp(): 226.:\n\ndatetime.fromtimestamp(timestamp, timezone.utc)\n\nOn the POSIX compliant platforms, it is equivalent to the following\nexpression:\n\ndatetime(1970, 1, 1, tzinfo=timezone.utc) + timedelta(seconds=timestamp)\n\nexcept the latter formula always supports the full years range:\nbetween *note MINYEAR: 2136. and *note MAXYEAR: 2137. inclusive.\n\nWarning: Because naive 'datetime' objects are treated by many\n'datetime' methods as local times, it is preferred to use\naware datetimes to represent times in UTC. As such, the\nrecommended way to create an object representing a specific\ntimestamp in UTC is by calling\n'datetime.fromtimestamp(timestamp, tz=timezone.utc)'.\n\nChanged in version 3.3: Raise *note OverflowError: 68d. instead of\n*note ValueError: 183. if the timestamp is out of the range of\nvalues supported by the platform C 'gmtime()' function.  Raise\n*note OSError: 613. instead of *note ValueError: 183. on 'gmtime()'\nfailure.\n\nDeprecated since version 3.12: Use *note datetime.fromtimestamp():\n226. with *note UTC: 227. instead.\n\n-- Method: classmethod datetime.fromordinal (ordinal)\n\nReturn the *note datetime: 222. corresponding to the proleptic\nGregorian ordinal, where January 1 of year 1 has ordinal 1.  *note\nValueError: 183. is raised unless '1 <= ordinal <=\ndatetime.max.toordinal()'.  The hour, minute, second and\nmicrosecond of the result are all 0, and *note tzinfo: 2148. is\n'None'.\n\n-- Method: classmethod datetime.combine (date, time,\ntzinfo=time.tzinfo)\n\nReturn a new *note datetime: 222. object whose date components are\nequal to the given *note date: 70f. object's, and whose time\ncomponents are equal to the given *note time: 6a5. object's.  If\nthe 'tzinfo' argument is provided, its value is used to set the\n*note tzinfo: 2148. attribute of the result, otherwise the *note\ntzinfo: 2140. attribute of the 'time' argument is used.  If the\n'date' argument is a *note datetime: 222. object, its time\ncomponents and *note tzinfo: 2148. attributes are ignored.\n\nFor any *note datetime: 222. object 'd', 'd ==\ndatetime.combine(d.date(), d.time(), d.tzinfo)'.\n\nChanged in version 3.6: Added the 'tzinfo' argument.\n\n-- Method: classmethod datetime.fromisoformat (datestring)\n\nReturn a *note datetime: 222. corresponding to a 'datestring' in\nany valid ISO 8601 format, with the following exceptions:\n\n1. Time zone offsets may have fractional seconds.\n\n2. The 'T' separator may be replaced by any single unicode\ncharacter.\n\n3. Fractional hours and minutes are not supported.\n\n4. Reduced precision dates are not currently supported\n('YYYY-MM', 'YYYY').\n\n5. Extended date representations are not currently supported\n('??YYYYYY-MM-DD').\n\n6. Ordinal dates are not currently supported ('YYYY-OOO').\n\nExamples:\n\n>>> from datetime import datetime\n>>> datetime.fromisoformat('2011-11-04')\ndatetime.datetime(2011, 11, 4, 0, 0)\n>>> datetime.fromisoformat('20111104')\ndatetime.datetime(2011, 11, 4, 0, 0)\n>>> datetime.fromisoformat('2011-11-04T00:05:23')\ndatetime.datetime(2011, 11, 4, 0, 5, 23)\n>>> datetime.fromisoformat('2011-11-04T00:05:23Z')\ndatetime.datetime(2011, 11, 4, 0, 5, 23, tzinfo=datetime.timezone.utc)\n>>> datetime.fromisoformat('20111104T000523')\ndatetime.datetime(2011, 11, 4, 0, 5, 23)\n>>> datetime.fromisoformat('2011-W01-2T00:05:23.283')\ndatetime.datetime(2011, 1, 4, 0, 5, 23, 283000)\n>>> datetime.fromisoformat('2011-11-04 00:05:23.283')\ndatetime.datetime(2011, 11, 4, 0, 5, 23, 283000)\n>>> datetime.fromisoformat('2011-11-04 00:05:23.283+00:00')\ndatetime.datetime(2011, 11, 4, 0, 5, 23, 283000, tzinfo=datetime.timezone.utc)\n>>> datetime.fromisoformat('2011-11-04T00:05:23+04:00')\ndatetime.datetime(2011, 11, 4, 0, 5, 23,\ntzinfo=datetime.timezone(datetime.timedelta(seconds=14400)))\n\nNew in version 3.7.\n\nChanged in version 3.11: Previously, this method only supported\nformats that could be emitted by *note date.isoformat(): 215d. or\n*note datetime.isoformat(): 96a.\n\n-- Method: classmethod datetime.fromisocalendar (year, week, day)\n\nReturn a *note datetime: 222. corresponding to the ISO calendar\ndate specified by year, week and day.  The non-date components of\nthe datetime are populated with their normal default values.  This\nis the inverse of the function *note datetime.isocalendar(): 710.\n\nNew in version 3.8.\n\n-- Method: classmethod datetime.strptime (datestring, format)\n\nReturn a *note datetime: 222. corresponding to 'datestring',\nparsed according to 'format'.\n\nIf 'format' does not contain microseconds or timezone information,\nthis is equivalent to:\n\ndatetime(*(time.strptime(datestring, format)[0:6]))\n\n*note ValueError: 183. is raised if the datestring and format\ncan't be parsed by *note time.strptime(): 1283. or if it returns a\nvalue which isn't a time tuple.  See also *note strftime() and\nstrptime() Behavior: 1523. and *note datetime.fromisoformat(): 3e2.\n\nClass attributes:\n\n-- Attribute: datetime.min\n\nThe earliest representable *note datetime: 222, 'datetime(MINYEAR,\n1, 1, tzinfo=None)'.\n\n-- Attribute: datetime.max\n\nThe latest representable *note datetime: 222, 'datetime(MAXYEAR,\n12, 31, 23, 59, 59, 999999, tzinfo=None)'.\n\n-- Attribute: datetime.resolution\n\nThe smallest possible difference between non-equal *note datetime:\n222. objects, 'timedelta(microseconds=1)'.\n\nInstance attributes (read-only):\n\n-- Attribute: datetime.year\n\nBetween *note MINYEAR: 2136. and *note MAXYEAR: 2137. inclusive.\n\n-- Attribute: datetime.month\n\nBetween 1 and 12 inclusive.\n\n-- Attribute: datetime.day\n\nBetween 1 and the number of days in the given month of the given\nyear.\n\n-- Attribute: datetime.hour\n\nIn 'range(24)'.\n\n-- Attribute: datetime.minute\n\nIn 'range(60)'.\n\n-- Attribute: datetime.second\n\nIn 'range(60)'.\n\n-- Attribute: datetime.microsecond\n\nIn 'range(1000000)'.\n\n-- Attribute: datetime.tzinfo\n\nThe object passed as the 'tzinfo' argument to the *note datetime:\n222. constructor, or 'None' if none was passed.\n\n-- Attribute: datetime.fold\n\nIn '[0, 1]'.  Used to disambiguate wall times during a repeated\ninterval.  (A repeated interval occurs when clocks are rolled back\nat the end of daylight saving time or when the UTC offset for the\ncurrent zone is decreased for political reasons.)  The value 0 (1)\nrepresents the earlier (later) of the two moments with the same\nwall time representation.\n\nNew in version 3.6.\n\nSupported operations:\n",
            "subsections": []
        },
        "Operation                                   Result": {
            "content": "---------------------------------------------------------------------------------\n\n'datetime2 = datetime1 + timedelta'         (1)\n\n\n'datetime2 = datetime1 - timedelta'         (2)\n\n\n'timedelta = datetime1 - datetime2'         (3)\n\n\n'datetime1 == datetime2'               Equality comparison.  (4)\n'datetime1 != datetime2'\n\n'datetime1 < datetime2'                Order comparison.  (5)\n'datetime1 > datetime2'\n'datetime1 <= datetime2'\n'datetime1 >= datetime2'\n\n1. datetime2 is a duration of timedelta removed from datetime1, moving\nforward in time if 'timedelta.days' > 0, or backward if\n'timedelta.days' < 0.  The result has the same *note tzinfo: 2148.\nattribute as the input datetime, and datetime2 - datetime1 ==\ntimedelta after.  *note OverflowError: 68d. is raised if\ndatetime2.year would be smaller than *note MINYEAR: 2136. or larger\nthan *note MAXYEAR: 2137.  Note that no time zone adjustments are\ndone even if the input is an aware object.\n\n2. Computes the datetime2 such that datetime2 + timedelta ==\ndatetime1.  As for addition, the result has the same *note tzinfo:\n2148. attribute as the input datetime, and no time zone adjustments\nare done even if the input is aware.\n\n3. Subtraction of a *note datetime: 222. from a *note datetime: 222.\nis defined only if both operands are naive, or if both are aware.\nIf one is aware and the other is naive, *note TypeError: 28e. is\nraised.\n\nIf both are naive, or both are aware and have the same *note\ntzinfo: 2148. attribute, the *note tzinfo: 2148. attributes are\nignored, and the result is a *note timedelta: 7f3. object 't' such\nthat 'datetime2 + t == datetime1'.  No time zone adjustments are\ndone in this case.\n\nIf both are aware and have different *note tzinfo: 2148.\nattributes, 'a-b' acts as if 'a' and 'b' were first converted to\nnaive UTC datetimes.  The result is '(a.replace(tzinfo=None) -\na.utcoffset()) - (b.replace(tzinfo=None) - b.utcoffset())' except\nthat the implementation never overflows.\n\n4. *note datetime: 222. objects are equal if they represent the same\ndate and time, taking into account the time zone.\n\nNaive and aware 'datetime' objects are never equal.  'datetime'\nobjects are never equal to *note date: 70f. objects that are not\nalso 'datetime' instances, even if they represent the same date.\n\nIf both comparands are aware, and have the same 'tzinfo' attribute,\nthe 'tzinfo' and *note fold: aa0. attributes are ignored and the\nbase datetimes are compared.  If both comparands are aware and have\ndifferent *note tzinfo: 2148. attributes, the comparison acts as\ncomparands were first converted to UTC datetimes except that the\nimplementation never overflows.  'datetime' instances in a repeated\ninterval are never equal to 'datetime' instances in other time\nzone.\n\n5. 'datetime1' is considered less than 'datetime2' when 'datetime1'\nprecedes 'datetime2' in time, taking into account the time zone.\n\nOrder comparison between naive and aware *note datetime: 222.\nobjects, as well as a 'datetime' object and a 'date' object that is\nnot also a 'datetime' instance, raises *note TypeError: 28e.\n\nIf both comparands are aware, and have the same 'tzinfo' attribute,\nthe 'tzinfo' and *note fold: aa0. attributes are ignored and the\nbase datetimes are compared.  If both comparands are aware and have\ndifferent *note tzinfo: 2148. attributes, the comparison acts as\ncomparands were first converted to UTC datetimes except that the\nimplementation never overflows.\n",
            "subsections": []
        },
        "Changed in version 3.3: Equality comparisons between aware and naive": {
            "content": "*note time: 6a5. instances don't raise *note TypeError: 28e.\n\nIn Boolean contexts, a *note time: 6a5. object is always considered to\nbe true.\n\nChanged in version 3.5: Before Python 3.5, a *note time: 6a5. object was\nconsidered to be false if it represented midnight in UTC. This behavior\nwas considered obscure and error-prone and has been removed in Python\n3.5.  See bpo-13936(1) for full details.\n\nOther constructor:\n\n-- Method: classmethod time.fromisoformat (timestring)\n\nReturn a *note time: 6a5. corresponding to a 'timestring' in any\nvalid ISO 8601 format, with the following exceptions:\n\n1. Time zone offsets may have fractional seconds.\n\n2. The leading 'T', normally required in cases where there may be\nambiguity between a date and a time, is not required.\n\n3. Fractional seconds may have any number of digits (anything\nbeyond 6 will be truncated).\n\n4. Fractional hours and minutes are not supported.\n\nExamples:\n\n>>> from datetime import time\n>>> time.fromisoformat('04:23:01')\ndatetime.time(4, 23, 1)\n>>> time.fromisoformat('T04:23:01')\ndatetime.time(4, 23, 1)\n>>> time.fromisoformat('T042301')\ndatetime.time(4, 23, 1)\n>>> time.fromisoformat('04:23:01.000384')\ndatetime.time(4, 23, 1, 384)\n>>> time.fromisoformat('04:23:01,000384')\ndatetime.time(4, 23, 1, 384)\n>>> time.fromisoformat('04:23:01+04:00')\ndatetime.time(4, 23, 1, tzinfo=datetime.timezone(datetime.timedelta(seconds=14400)))\n>>> time.fromisoformat('04:23:01Z')\ndatetime.time(4, 23, 1, tzinfo=datetime.timezone.utc)\n>>> time.fromisoformat('04:23:01+00:00')\ndatetime.time(4, 23, 1, tzinfo=datetime.timezone.utc)\n\nNew in version 3.7.\n\nChanged in version 3.11: Previously, this method only supported\nformats that could be emitted by *note time.isoformat(): 2180.\n\nInstance methods:\n\n-- Method: time.replace (hour=self.hour, minute=self.minute,\nsecond=self.second, microsecond=self.microsecond,\ntzinfo=self.tzinfo, *, fold=0)\n\nReturn a *note time: 6a5. with the same value, except for those\nattributes given new values by whichever keyword arguments are\nspecified.  Note that 'tzinfo=None' can be specified to create a\nnaive *note time: 6a5. from an aware *note time: 6a5, without\nconversion of the time data.\n\nChanged in version 3.6: Added the 'fold' parameter.\n\n-- Method: time.isoformat (timespec='auto')\n\nReturn a string representing the time in ISO 8601 format, one of:\n\n- 'HH:MM:SS.ffffff', if *note microsecond: 213f. is not 0\n\n- 'HH:MM:SS', if *note microsecond: 213f. is 0\n\n- 'HH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]', if *note utcoffset():\n2182. does not return 'None'\n\n- 'HH:MM:SS+HH:MM[:SS[.ffffff]]', if *note microsecond: 213f. is\n0 and *note utcoffset(): 2182. does not return 'None'\n\nThe optional argument 'timespec' specifies the number of additional\ncomponents of the time to include (the default is ''auto'').  It\ncan be one of the following:\n\n- ''auto'': Same as ''seconds'' if *note microsecond: 213f. is\n0, same as ''microseconds'' otherwise.\n\n- ''hours'': Include the *note hour: 213c. in the two-digit 'HH'\nformat.\n\n- ''minutes'': Include *note hour: 213c. and *note minute: 213d.\nin 'HH:MM' format.\n\n- ''seconds'': Include *note hour: 213c, *note minute: 213d, and\n*note second: 213e. in 'HH:MM:SS' format.\n\n- ''milliseconds'': Include full time, but truncate fractional\nsecond part to milliseconds.  'HH:MM:SS.sss' format.\n\n- ''microseconds'': Include full time in 'HH:MM:SS.ffffff'\nformat.\n\nNote: Excluded time components are truncated, not rounded.\n\n*note ValueError: 183. will be raised on an invalid 'timespec'\nargument.\n\nExample:\n\n>>> from datetime import time\n>>> time(hour=12, minute=34, second=56, microsecond=123456).isoformat(timespec='minutes')\n'12:34'\n>>> dt = time(hour=12, minute=34, second=56, microsecond=0)\n>>> dt.isoformat(timespec='microseconds')\n'12:34:56.000000'\n>>> dt.isoformat(timespec='auto')\n'12:34:56'\n\nChanged in version 3.6: Added the 'timespec' parameter.\n\n-- Method: time.str ()\n\nFor a time 't', 'str(t)' is equivalent to 't.isoformat()'.\n\n-- Method: time.strftime (format)\n\nReturn a string representing the time, controlled by an explicit\nformat string.  See also *note strftime() and strptime() Behavior:\n1523. and *note time.isoformat(): 2180.\n\n-- Method: time.format (format)\n\nSame as *note time.strftime(): 14d5.  This makes it possible to\nspecify a format string for a *note time: 6a5. object in *note\nformatted string literals: 7cd. and when using *note str.format():\n3ed.  See also *note strftime() and strptime() Behavior: 1523. and\n*note time.isoformat(): 2180.\n\n-- Method: time.utcoffset ()\n\nIf *note tzinfo: 2140. is 'None', returns 'None', else returns\n'self.tzinfo.utcoffset(None)', and raises an exception if the\nlatter doesn't return 'None' or a *note timedelta: 7f3. object with\nmagnitude less than one day.\n\nChanged in version 3.7: The UTC offset is not restricted to a whole\nnumber of minutes.\n\n-- Method: time.dst ()\n\nIf *note tzinfo: 2140. is 'None', returns 'None', else returns\n'self.tzinfo.dst(None)', and raises an exception if the latter\ndoesn't return 'None', or a *note timedelta: 7f3. object with\nmagnitude less than one day.\n\nChanged in version 3.7: The DST offset is not restricted to a whole\nnumber of minutes.\n\n-- Method: time.tzname ()\n\nIf *note tzinfo: 2140. is 'None', returns 'None', else returns\n'self.tzinfo.tzname(None)', or raises an exception if the latter\ndoesn't return 'None' or a string object.\n\n* Menu:\n\n* Examples of Usage; time: Examples of Usage time.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=13936\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Examples of Usage datetime,  Up: datetime Objects": {
            "content": "5.8.1.11 Examples of Usage: 'datetime'\n......................................\n\nExamples of working with *note datetime: 222. objects:\n\n>>> from datetime import datetime, date, time, timezone\n\n>>> # Using datetime.combine()\n>>> d = date(2005, 7, 14)\n>>> t = time(12, 30)\n>>> datetime.combine(d, t)\ndatetime.datetime(2005, 7, 14, 12, 30)\n\n>>> # Using datetime.now()\n>>> datetime.now()\ndatetime.datetime(2007, 12, 6, 16, 29, 43, 79043)   # GMT +1\n>>> datetime.now(timezone.utc)\ndatetime.datetime(2007, 12, 6, 15, 29, 43, 79060, tzinfo=datetime.timezone.utc)\n\n>>> # Using datetime.strptime()\n>>> dt = datetime.strptime(\"21/11/06 16:30\", \"%d/%m/%y %H:%M\")\n>>> dt\ndatetime.datetime(2006, 11, 21, 16, 30)\n\n>>> # Using datetime.timetuple() to get tuple of all attributes\n>>> tt = dt.timetuple()\n>>> for it in tt:\n...     print(it)\n...\n2006    # year\n11      # month\n21      # day\n16      # hour\n30      # minute\n0       # second\n1       # weekday (0 = Monday)\n325     # number of days since 1st January\n-1      # dst - method tzinfo.dst() returned None\n\n>>> # Date in ISO format\n>>> ic = dt.isocalendar()\n>>> for it in ic:\n...     print(it)\n...\n2006    # ISO year\n47      # ISO week\n2       # ISO weekday\n\n>>> # Formatting a datetime\n>>> dt.strftime(\"%A, %d. %B %Y %I:%M%p\")\n'Tuesday, 21. November 2006 04:30PM'\n>>> 'The {1} is {0:%d}, the {2} is {0:%B}, the {3} is {0:%I:%M%p}.'.format(dt, \"day\", \"month\", \"time\")\n'The day is 21, the month is November, the time is 04:30PM.'\n\nThe example below defines a *note tzinfo: 3a2. subclass capturing time\nzone information for Kabul, Afghanistan, which used +4 UTC until 1945\nand then +4:30 UTC thereafter:\n\nfrom datetime import timedelta, datetime, tzinfo, timezone\n\nclass KabulTz(tzinfo):\n# Kabul used +4 until 1945, when they moved to +4:30\nUTCMOVEDATE = datetime(1944, 12, 31, 20, tzinfo=timezone.utc)\n\ndef utcoffset(self, dt):\nif dt.year < 1945:\nreturn timedelta(hours=4)\nelif (1945, 1, 1, 0, 0) <= dt.timetuple()[:5] < (1945, 1, 1, 0, 30):\n# An ambiguous (\"imaginary\") half-hour range representing\n# a 'fold' in time due to the shift from +4 to +4:30.\n# If dt falls in the imaginary range, use fold to decide how\n# to resolve. See PEP495.\nreturn timedelta(hours=4, minutes=(30 if dt.fold else 0))\nelse:\nreturn timedelta(hours=4, minutes=30)\n\ndef fromutc(self, dt):\n# Follow same validations as in datetime.tzinfo\nif not isinstance(dt, datetime):\nraise TypeError(\"fromutc() requires a datetime argument\")\nif dt.tzinfo is not self:\nraise ValueError(\"dt.tzinfo is not self\")\n\n# A custom implementation is required for fromutc as\n# the input to this function is a datetime with utc values\n# but with a tzinfo set to self.\n# See datetime.astimezone or fromtimestamp.\nif dt.replace(tzinfo=timezone.utc) >= self.UTCMOVEDATE:\nreturn dt + timedelta(hours=4, minutes=30)\nelse:\nreturn dt + timedelta(hours=4)\n\ndef dst(self, dt):\n# Kabul does not observe daylight saving time.\nreturn timedelta(0)\n\ndef tzname(self, dt):\nif dt >= self.UTCMOVEDATE:\nreturn \"+04:30\"\nreturn \"+04\"\n\nUsage of 'KabulTz' from above:\n\n>>> tz1 = KabulTz()\n\n>>> # Datetime before the change\n>>> dt1 = datetime(1900, 11, 21, 16, 30, tzinfo=tz1)\n>>> print(dt1.utcoffset())\n4:00:00\n\n>>> # Datetime after the change\n>>> dt2 = datetime(2006, 6, 14, 13, 0, tzinfo=tz1)\n>>> print(dt2.utcoffset())\n4:30:00\n\n>>> # Convert datetime to another time zone\n>>> dt3 = dt2.astimezone(timezone.utc)\n>>> dt3\ndatetime.datetime(2006, 6, 14, 8, 30, tzinfo=datetime.timezone.utc)\n>>> dt2\ndatetime.datetime(2006, 6, 14, 13, 0, tzinfo=KabulTz())\n>>> dt2 == dt3\nTrue\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: time Objects,  Next: tzinfo Objects,  Prev: datetime Objects,  Up: datetime -- Basic date and time types": {
            "content": "5.8.1.12 'time' Objects\n.......................\n\nA *note time: 6a5. object represents a (local) time of day, independent\nof any particular day, and subject to adjustment via a *note tzinfo:\n3a2. object.\n\n-- Class: datetime.time (hour=0, minute=0, second=0, microsecond=0,\ntzinfo=None, *, fold=0)\n\nAll arguments are optional.  'tzinfo' may be 'None', or an instance\nof a *note tzinfo: 3a2. subclass.  The remaining arguments must be\nintegers in the following ranges:\n\n* '0 <= hour < 24',\n\n* '0 <= minute < 60',\n\n* '0 <= second < 60',\n\n* '0 <= microsecond < 1000000',\n\n* 'fold in [0, 1]'.\n\nIf an argument outside those ranges is given, *note ValueError:\n183. is raised.  All default to '0' except 'tzinfo', which defaults\nto *note None: 43f.\n\nClass attributes:\n\n-- Attribute: time.min\n\nThe earliest representable *note time: 6a5, 'time(0, 0, 0, 0)'.\n\n-- Attribute: time.max\n\nThe latest representable *note time: 6a5, 'time(23, 59, 59,\n999999)'.\n\n-- Attribute: time.resolution\n\nThe smallest possible difference between non-equal *note time: 6a5.\nobjects, 'timedelta(microseconds=1)', although note that arithmetic\non *note time: 6a5. objects is not supported.\n\nInstance attributes (read-only):\n\n-- Attribute: time.hour\n\nIn 'range(24)'.\n\n-- Attribute: time.minute\n\nIn 'range(60)'.\n\n-- Attribute: time.second\n\nIn 'range(60)'.\n\n-- Attribute: time.microsecond\n\nIn 'range(1000000)'.\n\n-- Attribute: time.tzinfo\n\nThe object passed as the tzinfo argument to the *note time: 6a5.\nconstructor, or 'None' if none was passed.\n\n-- Attribute: time.fold\n\nIn '[0, 1]'.  Used to disambiguate wall times during a repeated\ninterval.  (A repeated interval occurs when clocks are rolled back\nat the end of daylight saving time or when the UTC offset for the\ncurrent zone is decreased for political reasons.)  The value 0 (1)\nrepresents the earlier (later) of the two moments with the same\nwall time representation.\n\nNew in version 3.6.\n\n*note time: 6a5. objects support equality and order comparisons, where\n'a' is considered less than 'b' when 'a' precedes 'b' in time.\n",
            "subsections": []
        },
        "Naive and aware 'time' objects are never equal.  Order comparison": {
            "content": "between naive and aware 'time' objects raises *note TypeError: 28e.\n\nIf both comparands are aware, and have the same *note tzinfo: 2140.\nattribute, the 'tzinfo' and 'fold' attributes are ignored and the base\ntimes are compared.  If both comparands are aware and have different\n'tzinfo' attributes, the comparands are first adjusted by subtracting\ntheir UTC offsets (obtained from 'self.utcoffset()').\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Examples of Usage time,  Up: time Objects": {
            "content": "5.8.1.13 Examples of Usage: 'time'\n..................................\n\nExamples of working with a *note time: 6a5. object:\n\n>>> from datetime import time, tzinfo, timedelta\n>>> class TZ1(tzinfo):\n...     def utcoffset(self, dt):\n...         return timedelta(hours=1)\n...     def dst(self, dt):\n...         return timedelta(0)\n...     def tzname(self,dt):\n...         return \"+01:00\"\n...     def  repr(self):\n...         return f\"{self.class.name}()\"\n...\n>>> t = time(12, 10, 30, tzinfo=TZ1())\n>>> t\ndatetime.time(12, 10, 30, tzinfo=TZ1())\n>>> t.isoformat()\n'12:10:30+01:00'\n>>> t.dst()\ndatetime.timedelta(0)\n>>> t.tzname()\n'+01:00'\n>>> t.strftime(\"%H:%M:%S %Z\")\n'12:10:30 +01:00'\n>>> 'The {} is {:%H:%M}.'.format(\"time\", t)\n'The time is 12:10.'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: tzinfo Objects,  Next: timezone Objects,  Prev: time Objects,  Up: datetime -- Basic date and time types": {
            "content": "5.8.1.14 'tzinfo' Objects\n.........................\n\n-- Class: datetime.tzinfo\n\nThis is an abstract base class, meaning that this class should not\nbe instantiated directly.  Define a subclass of *note tzinfo: 3a2.\nto capture information about a particular time zone.\n\nAn instance of (a concrete subclass of) *note tzinfo: 3a2. can be\npassed to the constructors for *note datetime: 222. and *note time:\n6a5. objects.  The latter objects view their attributes as being in\nlocal time, and the *note tzinfo: 3a2. object supports methods\nrevealing offset of local time from UTC, the name of the time zone,\nand DST offset, all relative to a date or time object passed to\nthem.\n\nYou need to derive a concrete subclass, and (at least) supply\nimplementations of the standard *note tzinfo: 3a2. methods needed\nby the *note datetime: 222. methods you use.  The 'datetime' module\nprovides *note timezone: f2f, a simple concrete subclass of *note\ntzinfo: 3a2. which can represent timezones with fixed offset from\nUTC such as UTC itself or North American EST and EDT.\n\nSpecial requirement for pickling: A *note tzinfo: 3a2. subclass\nmust have an *note init(): 47d. method that can be called with\nno arguments, otherwise it can be pickled but possibly not\nunpickled again.  This is a technical requirement that may be\nrelaxed in the future.\n\nA concrete subclass of *note tzinfo: 3a2. may need to implement the\nfollowing methods.  Exactly which methods are needed depends on the\nuses made of aware 'datetime' objects.  If in doubt, simply\nimplement all of them.\n\n-- Method: tzinfo.utcoffset (dt)\n\nReturn offset of local time from UTC, as a *note timedelta: 7f3.\nobject that is positive east of UTC. If local time is west of UTC,\nthis should be negative.\n\nThis represents the 'total' offset from UTC; for example, if a\n*note tzinfo: 3a2. object represents both time zone and DST\nadjustments, *note utcoffset(): 218a. should return their sum.  If\nthe UTC offset isn't known, return 'None'.  Else the value returned\nmust be a *note timedelta: 7f3. object strictly between\n'-timedelta(hours=24)' and 'timedelta(hours=24)' (the magnitude of\nthe offset must be less than one day).  Most implementations of\n*note utcoffset(): 218a. will probably look like one of these two:\n\nreturn CONSTANT                 # fixed-offset class\nreturn CONSTANT + self.dst(dt)  # daylight-aware class\n\nIf *note utcoffset(): 218a. does not return 'None', *note dst():\n218b. should not return 'None' either.\n\nThe default implementation of *note utcoffset(): 218a. raises *note\nNotImplementedError: ba5.\n\nChanged in version 3.7: The UTC offset is not restricted to a whole\nnumber of minutes.\n\n-- Method: tzinfo.dst (dt)\n\nReturn the daylight saving time (DST) adjustment, as a *note\ntimedelta: 7f3. object or 'None' if DST information isn't known.\n\nReturn 'timedelta(0)' if DST is not in effect.  If DST is in\neffect, return the offset as a *note timedelta: 7f3. object (see\n*note utcoffset(): 218a. for details).  Note that DST offset, if\napplicable, has already been added to the UTC offset returned by\n*note utcoffset(): 218a, so there's no need to consult *note dst():\n218b. unless you're interested in obtaining DST info separately.\nFor example, *note datetime.timetuple(): 2170. calls its *note\ntzinfo: 2148. attribute's *note dst(): 218b. method to determine\nhow the *note tmisdst: 2171. flag should be set, and *note\ntzinfo.fromutc(): 216e. calls *note dst(): 218b. to account for DST\nchanges when crossing time zones.\n\nAn instance 'tz' of a *note tzinfo: 3a2. subclass that models both\nstandard and daylight times must be consistent in this sense:\n\n'tz.utcoffset(dt) - tz.dst(dt)'\n\nmust return the same result for every *note datetime: 222. 'dt'\nwith 'dt.tzinfo == tz' For sane *note tzinfo: 3a2. subclasses, this\nexpression yields the time zone's \"standard offset\", which should\nnot depend on the date or the time, but only on geographic\nlocation.  The implementation of *note datetime.astimezone(): 7f4.\nrelies on this, but cannot detect violations; it's the programmer's\nresponsibility to ensure it.  If a *note tzinfo: 3a2. subclass\ncannot guarantee this, it may be able to override the default\nimplementation of *note tzinfo.fromutc(): 216e. to work correctly\nwith *note astimezone(): 7f4. regardless.\n\nMost implementations of *note dst(): 218b. will probably look like\none of these two:\n\ndef dst(self, dt):\n# a fixed-offset class:  doesn't account for DST\nreturn timedelta(0)\n\nor:\n\ndef dst(self, dt):\n# Code to set dston and dstoff to the time zone's DST\n# transition times based on the input dt.year, and expressed\n# in standard local time.\n\nif dston <= dt.replace(tzinfo=None) < dstoff:\nreturn timedelta(hours=1)\nelse:\nreturn timedelta(0)\n\nThe default implementation of *note dst(): 218b. raises *note\nNotImplementedError: ba5.\n\nChanged in version 3.7: The DST offset is not restricted to a whole\nnumber of minutes.\n\n-- Method: tzinfo.tzname (dt)\n\nReturn the time zone name corresponding to the *note datetime: 222.\nobject 'dt', as a string.  Nothing about string names is defined by\nthe 'datetime' module, and there's no requirement that it mean\nanything in particular.  For example, \"GMT\", \"UTC\", \"-500\",\n\"-5:00\", \"EDT\", \"US/Eastern\", \"America/New York\" are all valid\nreplies.  Return 'None' if a string name isn't known.  Note that\nthis is a method rather than a fixed string primarily because some\n*note tzinfo: 3a2. subclasses will wish to return different names\ndepending on the specific value of 'dt' passed, especially if the\n*note tzinfo: 3a2. class is accounting for daylight time.\n\nThe default implementation of *note tzname(): 218c. raises *note\nNotImplementedError: ba5.\n\nThese methods are called by a *note datetime: 222. or *note time: 6a5.\nobject, in response to their methods of the same names.  A *note\ndatetime: 222. object passes itself as the argument, and a *note time:\n6a5. object passes 'None' as the argument.  A *note tzinfo: 3a2.\nsubclass's methods should therefore be prepared to accept a 'dt'\nargument of 'None', or of class *note datetime: 222.\n",
            "subsections": []
        },
        "When 'None' is passed, it's up to the class designer to decide the best": {
            "content": "response.  For example, returning 'None' is appropriate if the class\nwishes to say that time objects don't participate in the *note tzinfo:\n3a2. protocols.  It may be more useful for 'utcoffset(None)' to return\nthe standard UTC offset, as there is no other convention for discovering\nthe standard offset.\n\nWhen a *note datetime: 222. object is passed in response to a *note\ndatetime: 222. method, 'dt.tzinfo' is the same object as 'self'.  *note\ntzinfo: 3a2. methods can rely on this, unless user code calls *note\ntzinfo: 3a2. methods directly.  The intent is that the *note tzinfo:\n3a2. methods interpret 'dt' as being in local time, and not need worry\nabout objects in other timezones.\n\nThere is one more *note tzinfo: 3a2. method that a subclass may wish to\noverride:\n\n-- Method: tzinfo.fromutc (dt)\n\nThis is called from the default *note datetime.astimezone(): 7f4.\nimplementation.  When called from that, 'dt.tzinfo' is 'self', and\n'dt''s date and time data are to be viewed as expressing a UTC\ntime.  The purpose of *note fromutc(): 216e. is to adjust the date\nand time data, returning an equivalent datetime in 'self''s local\ntime.\n\nMost *note tzinfo: 3a2. subclasses should be able to inherit the\ndefault *note fromutc(): 216e. implementation without problems.\nIt's strong enough to handle fixed-offset time zones, and time\nzones accounting for both standard and daylight time, and the\nlatter even if the DST transition times differ in different years.\nAn example of a time zone the default *note fromutc(): 216e.\nimplementation may not handle correctly in all cases is one where\nthe standard offset (from UTC) depends on the specific date and\ntime passed, which can happen for political reasons.  The default\nimplementations of *note astimezone(): 7f4. and *note fromutc():\n216e. may not produce the result you want if the result is one of\nthe hours straddling the moment the standard offset changes.\n\nSkipping code for error cases, the default *note fromutc(): 216e.\nimplementation acts like:\n\ndef fromutc(self, dt):\n# raise ValueError error if dt.tzinfo is not self\ndtoff = dt.utcoffset()\ndtdst = dt.dst()\n# raise ValueError if dtoff is None or dtdst is None\ndelta = dtoff - dtdst  # this is self's standard offset\nif delta:\ndt += delta   # convert to standard local time\ndtdst = dt.dst()\n# raise ValueError if dtdst is None\nif dtdst:\nreturn dt + dtdst\nelse:\nreturn dt\n",
            "subsections": []
        },
        "In the following 'tzinfoexamples.py' file there are some examples of": {
            "content": "*note tzinfo: 3a2. classes:\n\nfrom datetime import tzinfo, timedelta, datetime\n\nZERO = timedelta(0)\nHOUR = timedelta(hours=1)\nSECOND = timedelta(seconds=1)\n\n# A class capturing the platform's idea of local time.\n# (May result in wrong values on historical times in\n#  timezones where UTC offset and/or the DST rules had\n#  changed in the past.)\nimport time as time\n\nSTDOFFSET = timedelta(seconds = -time.timezone)\nif time.daylight:\nDSTOFFSET = timedelta(seconds = -time.altzone)\nelse:\nDSTOFFSET = STDOFFSET\n\nDSTDIFF = DSTOFFSET - STDOFFSET\n\nclass LocalTimezone(tzinfo):\n\ndef fromutc(self, dt):\nassert dt.tzinfo is self\nstamp = (dt - datetime(1970, 1, 1, tzinfo=self)) // SECOND\nargs = time.localtime(stamp)[:6]\ndstdiff = DSTDIFF // SECOND\n# Detect fold\nfold = (args == time.localtime(stamp - dstdiff))\nreturn datetime(*args, microsecond=dt.microsecond,\ntzinfo=self, fold=fold)\n\ndef utcoffset(self, dt):\nif self.isdst(dt):\nreturn DSTOFFSET\nelse:\nreturn STDOFFSET\n\ndef dst(self, dt):\nif self.isdst(dt):\nreturn DSTDIFF\nelse:\nreturn ZERO\n\ndef tzname(self, dt):\nreturn time.tzname[self.isdst(dt)]\n\ndef isdst(self, dt):\ntt = (dt.year, dt.month, dt.day,\ndt.hour, dt.minute, dt.second,\ndt.weekday(), 0, 0)\nstamp = time.mktime(tt)\ntt = time.localtime(stamp)\nreturn tt.tmisdst > 0\n\nLocal = LocalTimezone()\n\n\n# A complete implementation of current DST rules for major US time zones.\n\ndef firstsundayonorafter(dt):\ndaystogo = 6 - dt.weekday()\nif daystogo:\ndt += timedelta(daystogo)\nreturn dt\n\n\n# US DST Rules\n#\n# This is a simplified (i.e., wrong for a few cases) set of rules for US\n# DST start and end times. For a complete and up-to-date set of DST rules\n# and timezone definitions, visit the Olson Database (or try pytz):\n# http://www.twinsun.com/tz/tz-link.htm\n# https://sourceforge.net/projects/pytz/ (might not be up-to-date)\n#\n# In the US, since 2007, DST starts at 2am (standard time) on the second\n# Sunday in March, which is the first Sunday on or after Mar 8.\nDSTSTART2007 = datetime(1, 3, 8, 2)\n# and ends at 2am (DST time) on the first Sunday of Nov.\nDSTEND2007 = datetime(1, 11, 1, 2)\n# From 1987 to 2006, DST used to start at 2am (standard time) on the first\n# Sunday in April and to end at 2am (DST time) on the last\n# Sunday of October, which is the first Sunday on or after Oct 25.\nDSTSTART19872006 = datetime(1, 4, 1, 2)\nDSTEND19872006 = datetime(1, 10, 25, 2)\n# From 1967 to 1986, DST used to start at 2am (standard time) on the last\n# Sunday in April (the one on or after April 24) and to end at 2am (DST time)\n# on the last Sunday of October, which is the first Sunday\n# on or after Oct 25.\nDSTSTART19671986 = datetime(1, 4, 24, 2)\nDSTEND19671986 = DSTEND19872006\n\ndef usdstrange(year):\n# Find start and end times for US DST. For years before 1967, return\n# start = end for no DST.\nif 2006 < year:\ndststart, dstend = DSTSTART2007, DSTEND2007\nelif 1986 < year < 2007:\ndststart, dstend = DSTSTART19872006, DSTEND19872006\nelif 1966 < year < 1987:\ndststart, dstend = DSTSTART19671986, DSTEND19671986\nelse:\nreturn (datetime(year, 1, 1), ) * 2\n\nstart = firstsundayonorafter(dststart.replace(year=year))\nend = firstsundayonorafter(dstend.replace(year=year))\nreturn start, end\n\n\nclass USTimeZone(tzinfo):\n\ndef init(self, hours, reprname, stdname, dstname):\nself.stdoffset = timedelta(hours=hours)\nself.reprname = reprname\nself.stdname = stdname\nself.dstname = dstname\n\ndef repr(self):\nreturn self.reprname\n\ndef tzname(self, dt):\nif self.dst(dt):\nreturn self.dstname\nelse:\nreturn self.stdname\n\ndef utcoffset(self, dt):\nreturn self.stdoffset + self.dst(dt)\n\ndef dst(self, dt):\nif dt is None or dt.tzinfo is None:\n# An exception may be sensible here, in one or both cases.\n# It depends on how you want to treat them.  The default\n# fromutc() implementation (called by the default astimezone()\n# implementation) passes a datetime with dt.tzinfo is self.\nreturn ZERO\nassert dt.tzinfo is self\nstart, end = usdstrange(dt.year)\n# Can't compare naive to aware objects, so strip the timezone from\n# dt first.\ndt = dt.replace(tzinfo=None)\nif start + HOUR <= dt < end - HOUR:\n# DST is in effect.\nreturn HOUR\nif end - HOUR <= dt < end:\n# Fold (an ambiguous hour): use dt.fold to disambiguate.\nreturn ZERO if dt.fold else HOUR\nif start <= dt < start + HOUR:\n# Gap (a non-existent hour): reverse the fold rule.\nreturn HOUR if dt.fold else ZERO\n# DST is off.\nreturn ZERO\n\ndef fromutc(self, dt):\nassert dt.tzinfo is self\nstart, end = usdstrange(dt.year)\nstart = start.replace(tzinfo=self)\nend = end.replace(tzinfo=self)\nstdtime = dt + self.stdoffset\ndsttime = stdtime + HOUR\nif end <= dsttime < end + HOUR:\n# Repeated hour\nreturn stdtime.replace(fold=1)\nif stdtime < start or dsttime >= end:\n# Standard time\nreturn stdtime\nif start <= stdtime < end - HOUR:\n# Daylight saving time\nreturn dsttime\n\n\nEastern  = USTimeZone(-5, \"Eastern\",  \"EST\", \"EDT\")\nCentral  = USTimeZone(-6, \"Central\",  \"CST\", \"CDT\")\nMountain = USTimeZone(-7, \"Mountain\", \"MST\", \"MDT\")\nPacific  = USTimeZone(-8, \"Pacific\",  \"PST\", \"PDT\")\n\nNote that there are unavoidable subtleties twice per year in a *note\ntzinfo: 3a2. subclass accounting for both standard and daylight time, at\nthe DST transition points.  For concreteness, consider US Eastern (UTC\n-0500), where EDT begins the minute after 1:59 (EST) on the second",
            "subsections": []
        },
        "Sunday in March, and ends the minute after 1:59 (EDT) on the first": {
            "content": "Sunday in November:\n\nUTC   3:MM  4:MM  5:MM  6:MM  7:MM  8:MM\nEST  22:MM 23:MM  0:MM  1:MM  2:MM  3:MM\nEDT  23:MM  0:MM  1:MM  2:MM  3:MM  4:MM\n\nstart  22:MM 23:MM  0:MM  1:MM  3:MM  4:MM\n\nend  23:MM  0:MM  1:MM  1:MM  2:MM  3:MM\n\nWhen DST starts (the \"start\" line), the local wall clock leaps from 1:59\nto 3:00.  A wall time of the form 2:MM doesn't really make sense on that\nday, so 'astimezone(Eastern)' won't deliver a result with 'hour == 2' on\nthe day DST begins.  For example, at the Spring forward transition of\n2016, we get:\n\n>>> from datetime import datetime, timezone\n>>> from tzinfoexamples import HOUR, Eastern\n>>> u0 = datetime(2016, 3, 13, 5, tzinfo=timezone.utc)\n>>> for i in range(4):\n...     u = u0 + i*HOUR\n...     t = u.astimezone(Eastern)\n...     print(u.time(), 'UTC =', t.time(), t.tzname())\n...\n05:00:00 UTC = 00:00:00 EST\n06:00:00 UTC = 01:00:00 EST\n07:00:00 UTC = 03:00:00 EDT\n08:00:00 UTC = 04:00:00 EDT\n\nWhen DST ends (the \"end\" line), there's a potentially worse problem:\nthere's an hour that can't be spelled unambiguously in local wall time:\nthe last hour of daylight time.  In Eastern, that's times of the form\n5:MM UTC on the day daylight time ends.  The local wall clock leaps from\n1:59 (daylight time) back to 1:00 (standard time) again.  Local times of\nthe form 1:MM are ambiguous.  *note astimezone(): 7f4. mimics the local\nclock's behavior by mapping two adjacent UTC hours into the same local\nhour then.  In the Eastern example, UTC times of the form 5:MM and 6:MM\nboth map to 1:MM when converted to Eastern, but earlier times have the\n*note fold: aa0. attribute set to 0 and the later times have it set to\n1.  For example, at the Fall back transition of 2016, we get:\n\n>>> u0 = datetime(2016, 11, 6, 4, tzinfo=timezone.utc)\n>>> for i in range(4):\n...     u = u0 + i*HOUR\n...     t = u.astimezone(Eastern)\n...     print(u.time(), 'UTC =', t.time(), t.tzname(), t.fold)\n...\n04:00:00 UTC = 00:00:00 EDT 0\n05:00:00 UTC = 01:00:00 EDT 0\n06:00:00 UTC = 01:00:00 EST 1\n07:00:00 UTC = 02:00:00 EST 0\n\nNote that the *note datetime: 222. instances that differ only by the\nvalue of the *note fold: aa0. attribute are considered equal in\ncomparisons.\n",
            "subsections": []
        },
        "Applications that can't bear wall-time ambiguities should explicitly": {
            "content": "check the value of the *note fold: aa0. attribute or avoid using hybrid\n*note tzinfo: 3a2. subclasses; there are no ambiguities when using *note\ntimezone: f2f, or any other fixed-offset *note tzinfo: 3a2. subclass\n(such as a class representing only EST (fixed offset -5 hours), or only\nEDT (fixed offset -4 hours)).\n\nSee also\n........\n\n*note zoneinfo: 12e.\n\nThe 'datetime' module has a basic *note timezone: f2f. class\n(for handling arbitrary fixed offsets from UTC) and its *note\ntimezone.utc: 3df. attribute (a UTC timezone instance).\n\n'zoneinfo' brings the 'IANA timezone database' (also known as\nthe Olson database) to Python, and its usage is recommended.\n\nIANA timezone database(1)\n\nThe Time Zone Database (often called tz, tzdata or zoneinfo)\ncontains code and data that represent the history of local time for\nmany representative locations around the globe.  It is updated\nperiodically to reflect changes made by political bodies to time\nzone boundaries, UTC offsets, and daylight-saving rules.\n\n---------- Footnotes ----------\n\n(1) https://www.iana.org/time-zones\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: timezone Objects,  Next: strftime and strptime Behavior,  Prev: tzinfo Objects,  Up: datetime -- Basic date and time types": {
            "content": "5.8.1.15 'timezone' Objects\n...........................\n\nThe *note timezone: f2f. class is a subclass of *note tzinfo: 3a2, each\ninstance of which represents a timezone defined by a fixed offset from\nUTC.\n",
            "subsections": []
        },
        "Objects of this class cannot be used to represent timezone information": {
            "content": "in the locations where different offsets are used in different days of\nthe year or where historical changes have been made to civil time.\n\n-- Class: datetime.timezone (offset, name=None)\n\nThe 'offset' argument must be specified as a *note timedelta: 7f3.\nobject representing the difference between the local time and UTC.\nIt must be strictly between '-timedelta(hours=24)' and\n'timedelta(hours=24)', otherwise *note ValueError: 183. is raised.\n\nThe 'name' argument is optional.  If specified it must be a string\nthat will be used as the value returned by the *note\ndatetime.tzname(): 216f. method.\n\nNew in version 3.2.\n\nChanged in version 3.7: The UTC offset is not restricted to a whole\nnumber of minutes.\n\n-- Method: timezone.utcoffset (dt)\n\nReturn the fixed value specified when the *note timezone: f2f.\ninstance is constructed.\n\nThe 'dt' argument is ignored.  The return value is a *note\ntimedelta: 7f3. instance equal to the difference between the local\ntime and UTC.\n\nChanged in version 3.7: The UTC offset is not restricted to a whole\nnumber of minutes.\n\n-- Method: timezone.tzname (dt)\n\nReturn the fixed value specified when the *note timezone: f2f.\ninstance is constructed.\n\nIf 'name' is not provided in the constructor, the name returned by\n'tzname(dt)' is generated from the value of the 'offset' as\nfollows.  If 'offset' is 'timedelta(0)', the name is \"UTC\",\notherwise it is a string in the format 'UTC??HH:MM', where ?? is the\nsign of 'offset', HH and MM are two digits of 'offset.hours' and\n'offset.minutes' respectively.\n\nChanged in version 3.6: Name generated from 'offset=timedelta(0)'\nis now plain ''UTC'', not ''UTC+00:00''.\n\n-- Method: timezone.dst (dt)\n\nAlways returns 'None'.\n\n-- Method: timezone.fromutc (dt)\n\nReturn 'dt + offset'.  The 'dt' argument must be an aware *note\ndatetime: 222. instance, with 'tzinfo' set to 'self'.\n\nClass attributes:\n\n-- Attribute: timezone.utc\n\nThe UTC timezone, 'timezone(timedelta(0))'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: strftime and strptime Behavior,  Prev: timezone Objects,  Up: datetime -- Basic date and time types": {
            "content": "5.8.1.16 'strftime()' and 'strptime()' Behavior\n...............................................\n\n*note date: 70f, *note datetime: 222, and *note time: 6a5. objects all\nsupport a 'strftime(format)' method, to create a string representing the\ntime under the control of an explicit format string.\n\nConversely, the *note datetime.strptime(): 146c. class method creates a\n*note datetime: 222. object from a string representing a date and time\nand a corresponding format string.\n\nThe table below provides a high-level comparison of *note strftime():\nadd. versus *note strptime(): 146c.:\n\n'strftime'                                                   'strptime'\n\n---------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\nUsage                Convert object to a string according to a given format       Parse a string into a *note datetime: 222. object given a corresponding format\n\n",
            "subsections": []
        },
        "Type of method       Instance method                                              Class method": {
            "content": "Method of            *note date: 70f.; *note datetime: 222.; *note time: 6a5.     *note datetime: 222.\n\n",
            "subsections": []
        },
        "Signature            'strftime(format)'                                           'strptime(datestring, format)'": {
            "content": "* Menu:\n\n* strftime() and strptime() Format Codes: strftime and strptime Format Codes.\n* Technical Detail::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: strftime and strptime Format Codes,  Next: Technical Detail,  Up: strftime and strptime Behavior": {
            "content": "5.8.1.17 'strftime()' and 'strptime()' Format Codes\n...................................................\n",
            "subsections": []
        },
        "These methods accept format codes that can be used to parse and format": {
            "content": "dates:\n\n>>> datetime.strptime('31/01/22 23:59:59.999999',\n...                   '%d/%m/%y %H:%M:%S.%f')\ndatetime.datetime(2022, 1, 31, 23, 59, 59, 999999)\n>>> .strftime('%a %d %b %Y, %I:%M%p')\n'Mon 31 Jan 2022, 11:59PM'\n",
            "subsections": []
        },
        "The following is a list of all the format codes that the 1989 C standard": {
            "content": "requires, and these work on all platforms with a standard C\nimplementation.\n",
            "subsections": []
        },
        "Directive       Meaning                              Example                      Notes": {
            "content": "----------------------------------------------------------------------------------------------\n\n'%G'            ISO 8601 year with century           0001, 0002, ..., 2013, 2014,   (8)\nrepresenting the year that           ..., 9998, 9999\ncontains the greater part of the\nISO week ('%V').\n\n\n'%u'            ISO 8601 weekday as a decimal        1, 2, ..., 7\nnumber where 1 is Monday.\n\n\n'%V'            ISO 8601 week as a decimal number    01, 02, ..., 53                (8), (9)\nwith Monday as the first day of\nthe week.  Week 01 is the week\ncontaining Jan 4.\n\n\n'%:z'           UTC offset in the form               (empty), +00:00, -04:00,     (6)\n'??HH:MM[:SS[.ffffff]]' (empty        +10:30, +06:34:15,\nstring if the object is naive).      -03:07:12.345216\n\n\nThese may not be available on all platforms when used with the *note\nstrftime(): add. method.  The ISO 8601 year and ISO 8601 week directives\nare not interchangeable with the year and week number directives above.\nCalling *note strptime(): 146c. with incomplete or ambiguous ISO 8601\ndirectives will raise a *note ValueError: 183.\n",
            "subsections": []
        },
        "Several additional directives not required by the C89 standard are": {
            "content": "included for convenience.  These parameters all correspond to ISO 8601\ndate values.\n",
            "subsections": []
        },
        "The full set of format codes supported varies across platforms, because": {
            "content": "",
            "subsections": []
        },
        "Python calls the platform C library's 'strftime()' function, and": {
            "content": "platform variations are common.  To see the full set of format codes\nsupported on your platform, consult the 'strftime(3)' documentation.",
            "subsections": []
        },
        "There are also differences between platforms in handling of unsupported": {
            "content": "format specifiers.\n\nNew in version 3.6: '%G', '%u' and '%V' were added.\n\nNew in version 3.12: '%:z' was added.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Technical Detail,  Prev: strftime and strptime Format Codes,  Up: strftime and strptime Behavior": {
            "content": "5.8.1.18 Technical Detail\n.........................\n\nBroadly speaking, 'd.strftime(fmt)' acts like the *note time: e8.\nmodule's 'time.strftime(fmt, d.timetuple())' although not all objects\nsupport a *note timetuple(): 2159. method.\n\nFor the *note datetime.strptime(): 146c. class method, the default value\nis '1900-01-01T00:00:00.000': any components not specified in the format\nstring will be pulled from the default value.  (1)\n\nUsing 'datetime.strptime(datestring, format)' is equivalent to:\n\ndatetime(*(time.strptime(datestring, format)[0:6]))\n\nexcept when the format includes sub-second components or timezone offset\ninformation, which are supported in 'datetime.strptime' but are\ndiscarded by 'time.strptime'.\n\nFor *note time: 6a5. objects, the format codes for year, month, and day\nshould not be used, as 'time' objects have no such values.  If they're\nused anyway, '1900' is substituted for the year, and '1' for the month\nand day.\n\nFor *note date: 70f. objects, the format codes for hours, minutes,\nseconds, and microseconds should not be used, as *note date: 70f.\nobjects have no such values.  If they're used anyway, '0' is substituted\nfor them.\n",
            "subsections": []
        },
        "For the same reason, handling of format strings containing Unicode code": {
            "content": "points that can't be represented in the charset of the current locale is\nalso platform-dependent.  On some platforms such code points are\npreserved intact in the output, while on others 'strftime' may raise\n*note UnicodeError: 111b. or return an empty string instead.\n\nNotes:\n\n1. Because the format depends on the current locale, care should be\ntaken when making assumptions about the output value.  Field\norderings will vary (for example, \"month/day/year\" versus\n\"day/month/year\"), and the output may contain non-ASCII characters.\n\n2. The *note strptime(): 146c. method can parse years in the full [1,\n9999] range, but years < 1000 must be zero-filled to 4-digit width.\n\nChanged in version 3.2: In previous versions, *note strftime():\nadd. method was restricted to years >= 1900.\n\nChanged in version 3.3: In version 3.2, *note strftime(): add.\nmethod was restricted to years >= 1000.\n\n3. When used with the *note strptime(): 146c. method, the '%p'\ndirective only affects the output hour field if the '%I' directive\nis used to parse the hour.\n\n4. Unlike the *note time: e8. module, the 'datetime' module does not\nsupport leap seconds.\n\n5. When used with the *note strptime(): 146c. method, the '%f'\ndirective accepts from one to six digits and zero pads on the\nright.  '%f' is an extension to the set of format characters in the\nC standard (but implemented separately in datetime objects, and\ntherefore always available).\n\n6. For a naive object, the '%z', '%:z' and '%Z' format codes are\nreplaced by empty strings.\n\nFor an aware object:\n\n'%z'\n\n*note utcoffset(): 216c. is transformed into a string of the\nform '??HHMM[SS[.ffffff]]', where 'HH' is a 2-digit string\ngiving the number of UTC offset hours, 'MM' is a 2-digit\nstring giving the number of UTC offset minutes, 'SS' is a\n2-digit string giving the number of UTC offset seconds and\n'ffffff' is a 6-digit string giving the number of UTC offset\nmicroseconds.  The 'ffffff' part is omitted when the offset is\na whole number of seconds and both the 'ffffff' and the 'SS'\npart is omitted when the offset is a whole number of minutes.\nFor example, if *note utcoffset(): 216c. returns\n'timedelta(hours=-3, minutes=-30)', '%z' is replaced with the\nstring ''-0330''.\n\nChanged in version 3.7: The UTC offset is not restricted to a whole\nnumber of minutes.\n\nChanged in version 3.7: When the '%z' directive is provided to the\n*note strptime(): 146c. method, the UTC offsets can have a colon as\na separator between hours, minutes and seconds.  For example,\n''+01:00:00'' will be parsed as an offset of one hour.  In\naddition, providing ''Z'' is identical to ''+00:00''.\n\n'%:z'\n\nBehaves exactly as '%z', but has a colon separator added\nbetween hours, minutes and seconds.\n\n'%Z'\n\nIn *note strftime(): add, '%Z' is replaced by an empty string\nif *note tzname(): 216f. returns 'None'; otherwise '%Z' is\nreplaced by the returned value, which must be a string.\n\n*note strptime(): 146c. only accepts certain values for '%Z':\n\n1. any value in 'time.tzname' for your machine's locale\n\n2. the hard-coded values 'UTC' and 'GMT'\n\nSo someone living in Japan may have 'JST', 'UTC', and 'GMT' as\nvalid values, but probably not 'EST'.  It will raise\n'ValueError' for invalid values.\n\nChanged in version 3.2: When the '%z' directive is provided to the\n*note strptime(): 146c. method, an aware *note datetime: 222.\nobject will be produced.  The 'tzinfo' of the result will be set to\na *note timezone: f2f. instance.\n\n7. When used with the *note strptime(): 146c. method, '%U' and '%W'\nare only used in calculations when the day of the week and the\ncalendar year ('%Y') are specified.\n\n8. Similar to '%U' and '%W', '%V' is only used in calculations when\nthe day of the week and the ISO year ('%G') are specified in a\n*note strptime(): 146c. format string.  Also note that '%G' and\n'%Y' are not interchangeable.\n\n9. When used with the *note strptime(): 146c. method, the leading zero\nis optional for formats '%d', '%m', '%H', '%I', '%M', '%S', '%j',\n'%U', '%W', and '%V'.  Format '%y' does require a leading zero.\n\n---------- Footnotes ----------\n\n(1) Passing 'datetime.strptime('Feb 29', '%b %d')' will fail since\n'1900' is not a leap year.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: zoneinfo -- IANA time zone support,  Next: calendar -- General calendar-related functions,  Prev: datetime -- Basic date and time types,  Up: Data Types": {
            "content": "New in version 3.9.\n\n'Source code:' Lib/zoneinfo(1)\n\n\n\nThe *note zoneinfo: 12e. module provides a concrete time zone\nimplementation to support the IANA time zone database as originally\nspecified in PEP 615(2).  By default, *note zoneinfo: 12e. uses the\nsystem's time zone data if available; if no system time zone data is\navailable, the library will fall back to using the first-party tzdata(3)\npackage available on PyPI.\n\nSee also\n........\n\nModule: *note datetime: 2e.\n\nProvides the *note time: 6a5. and *note datetime: 222. types with\nwhich the *note ZoneInfo: 6f8. class is designed to be used.\n",
            "subsections": []
        },
        "Package tzdata(4)": {
            "content": "First-party package maintained by the CPython core developers to\nsupply time zone data via PyPI.\n\n*note Availability: 1ad3.: not Emscripten, not WASI.\n",
            "subsections": []
        },
        "This module does not work or is not available on WebAssembly platforms": {
            "content": "'wasm32-emscripten' and 'wasm32-wasi'.  See *note WebAssembly platforms:\n153e. for more information.\n\n-- Class: telnetlib.Telnet (host=None, port=0[, timeout])\n\n*note Telnet: b38. represents a connection to a Telnet server.  The\ninstance is initially not connected by default; the *note open():\n3e81. method must be used to establish a connection.\nAlternatively, the host name and optional port number can be passed\nto the constructor too, in which case the connection to the server\nwill be established before the constructor returns.  The optional\n'timeout' parameter specifies a timeout in seconds for blocking\noperations like the connection attempt (if not specified, the\nglobal default timeout setting will be used).\n\nDo not reopen an already connected instance.\n\nThis class has many 'read*()' methods.  Note that some of them\nraise *note EOFError: 114e. when the end of the connection is read,\nbecause they can return an empty string for other reasons.  See the\nindividual descriptions below.\n\nA *note Telnet: b38. object is a context manager and can be used in\na *note with: 396. statement.  When the 'with' block ends, the\n*note close(): 464c. method is called:\n\n>>> from telnetlib import Telnet\n>>> with Telnet('localhost', 23) as tn:\n...     tn.interact()\n...\n\nChanged in version 3.6: Context manager support added\n\nSee also\n........\n\nRFC 854(4) - Telnet Protocol Specification\n\nDefinition of the Telnet protocol.\n\n* Menu:\n\n* Telnet Objects::\n* Telnet Example::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/telnetlib.py\n\n(2) https://peps.python.org/pep-0594/#telnetlib\n\n(3) https://datatracker.ietf.org/doc/html/rfc854.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc854.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using ZoneInfo,  Next: Data sources,  Up: zoneinfo -- IANA time zone support": {
            "content": "5.8.2.1 Using 'ZoneInfo'\n........................\n\n*note ZoneInfo: 6f8. is a concrete implementation of the *note\ndatetime.tzinfo: 3a2. abstract base class, and is intended to be\nattached to 'tzinfo', either via the constructor, the *note\ndatetime.replace: 1326. method or *note datetime.astimezone: 7f4.:\n\n>>> from zoneinfo import ZoneInfo\n>>> from datetime import datetime, timedelta\n\n>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo(\"America/LosAngeles\"))\n>>> print(dt)\n2020-10-31 12:00:00-07:00\n\n>>> dt.tzname()\n'PDT'\n",
            "subsections": []
        },
        "Datetimes constructed in this way are compatible with datetime": {
            "content": "arithmetic and handle daylight saving time transitions with no further\nintervention:\n\n>>> dtadd = dt + timedelta(days=1)\n\n>>> print(dtadd)\n2020-11-01 12:00:00-08:00\n\n>>> dtadd.tzname()\n'PST'\n\nThese time zones also support the *note fold: aa0. attribute introduced\nin PEP 495(1).  During offset transitions which induce ambiguous times\n(such as a daylight saving time to standard time transition), the offset\nfrom 'before' the transition is used when 'fold=0', and the offset\n'after' the transition is used when 'fold=1', for example:\n\n>>> dt = datetime(2020, 11, 1, 1, tzinfo=ZoneInfo(\"America/LosAngeles\"))\n>>> print(dt)\n2020-11-01 01:00:00-07:00\n\n>>> print(dt.replace(fold=1))\n2020-11-01 01:00:00-08:00\n",
            "subsections": []
        },
        "When converting from another time zone, the fold will be set to the": {
            "content": "correct value:\n\n>>> from datetime import timezone\n>>> LOSANGELES = ZoneInfo(\"America/LosAngeles\")\n>>> dtutc = datetime(2020, 11, 1, 8, tzinfo=timezone.utc)\n\n>>> # Before the PDT -> PST transition\n>>> print(dtutc.astimezone(LOSANGELES))\n2020-11-01 01:00:00-07:00\n\n>>> # After the PDT -> PST transition\n>>> print((dtutc + timedelta(hours=1)).astimezone(LOSANGELES))\n2020-11-01 01:00:00-08:00\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0495/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Data sources,  Next: The ZoneInfo class,  Prev: Using ZoneInfo,  Up: zoneinfo -- IANA time zone support": {
            "content": "5.8.2.2 Data sources\n....................\n",
            "subsections": []
        },
        "The 'zoneinfo' module does not directly provide time zone data, and": {
            "content": "instead pulls time zone information from the system time zone database\nor the first-party PyPI package tzdata(1), if available.  Some systems,\nincluding notably Windows systems, do not have an IANA database\navailable, and so for projects targeting cross-platform compatibility\nthat require time zone data, it is recommended to declare a dependency\non tzdata.  If neither system data nor tzdata are available, all calls\nto *note ZoneInfo: 6f8. will raise *note ZoneInfoNotFoundError: 219a.\n\n* Menu:\n\n* Configuring the data sources::\n\n---------- Footnotes ----------\n\n(1) https://pypi.org/project/tzdata/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Configuring the data sources,  Up: Data sources": {
            "content": "5.8.2.3 Configuring the data sources\n....................................\n",
            "subsections": []
        },
        "When 'ZoneInfo(key)' is called, the constructor first searches the": {
            "content": "directories specified in *note TZPATH: 1af0. for a file matching 'key',\nand on failure looks for a match in the tzdata package.  This behavior\ncan be configured in three ways:\n\n1. The default *note TZPATH: 1af0. when not otherwise specified can be\nconfigured at *note compile time: 1af1.\n\n2. *note TZPATH: 1af0. can be configured using *note an environment\nvariable: 219d.\n\n3. At *note runtime: 219e, the search path can be manipulated using\nthe *note resettzpath(): 219f. function.\n\n* Menu:\n\n* Compile-time configuration::\n* Environment configuration::\n* Runtime configuration::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Compile-time configuration,  Next: Environment configuration,  Up: Configuring the data sources": {
            "content": "5.8.2.4 Compile-time configuration\n..................................\n\nThe default *note TZPATH: 1af0. includes several common deployment\nlocations for the time zone database (except on Windows, where there are\nno \"well-known\" locations for time zone data).  On POSIX systems,\ndownstream distributors and those building Python from source who know\nwhere their system time zone data is deployed may change the default\ntime zone path by specifying the compile-time option 'TZPATH' (or, more\nlikely, the *note configure flag -with-tzpath: 1aef.), which should be a\nstring delimited by *note os.pathsep: 1ac4.\n",
            "subsections": []
        },
        "On all platforms, the configured value is available as the 'TZPATH' key": {
            "content": "in *note sysconfig.getconfigvar(): ea2.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Environment configuration,  Next: Runtime configuration,  Prev: Compile-time configuration,  Up: Configuring the data sources": {
            "content": "5.8.2.5 Environment configuration\n.................................\n\nWhen initializing *note TZPATH: 1af0. (either at import time or whenever\n*note resettzpath(): 219f. is called with no arguments), the 'zoneinfo'\nmodule will use the environment variable 'PYTHONTZPATH', if it exists,\nto set the search path.\n\n-- Environment Variable: PYTHONTZPATH\n\nThis is an *note os.pathsep: 1ac4.-separated string containing the\ntime zone search path to use.  It must consist of only absolute\nrather than relative paths.  Relative components specified in\n'PYTHONTZPATH' will not be used, but otherwise the behavior when a\nrelative path is specified is implementation-defined; CPython will\nraise *note InvalidTZPathWarning: 21a3, but other implementations\nare free to silently ignore the erroneous component or raise an\nexception.\n",
            "subsections": []
        },
        "To set the system to ignore the system data and use the tzdata package": {
            "content": "instead, set 'PYTHONTZPATH=\"\"'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Runtime configuration,  Prev: Environment configuration,  Up: Configuring the data sources": {
            "content": "5.8.2.6 Runtime configuration\n.............................\n\nThe TZ search path can also be configured at runtime using the *note\nresettzpath(): 219f. function.  This is generally not an advisable\noperation, though it is reasonable to use it in test functions that\nrequire the use of a specific time zone path (or require disabling\naccess to the system time zones).\n\nFile: python3.12.info,  Node: The ZoneInfo class,  Next: Functions<3>,  Prev: Data sources,  Up: zoneinfo -- IANA time zone support\n\n5.8.2.7 The 'ZoneInfo' class\n............................\n\n-- Class: zoneinfo.ZoneInfo (key)\n\nA concrete *note datetime.tzinfo: 3a2. subclass that represents an\nIANA time zone specified by the string 'key'.  Calls to the primary\nconstructor will always return objects that compare identically;\nput another way, barring cache invalidation via *note\nZoneInfo.clearcache(): 21a6, for all values of 'key', the\nfollowing assertion will always be true:\n\na = ZoneInfo(key)\nb = ZoneInfo(key)\nassert a is b\n\n'key' must be in the form of a relative, normalized POSIX path,\nwith no up-level references.  The constructor will raise *note\nValueError: 183. if a non-conforming key is passed.\n\nIf no file matching 'key' is found, the constructor will raise\n*note ZoneInfoNotFoundError: 219a.\n\nThe 'ZoneInfo' class has two alternate constructors:\n\n-- Method: classmethod ZoneInfo.fromfile (fobj, /, key=None)\n\nConstructs a 'ZoneInfo' object from a file-like object returning\nbytes (e.g.  a file opened in binary mode or an *note io.BytesIO:\nd08. object).  Unlike the primary constructor, this always\nconstructs a new object.\n\nThe 'key' parameter sets the name of the zone for the purposes of\n*note str(): 3e9. and *note repr(): 3e8.\n\nObjects created via this constructor cannot be pickled (see *note\npickling: 21a8.).\n\n-- Method: classmethod ZoneInfo.nocache (key)\n\nAn alternate constructor that bypasses the constructor's cache.  It\nis identical to the primary constructor, but returns a new object\non each call.  This is most likely to be useful for testing or\ndemonstration purposes, but it can also be used to create a system\nwith a different cache invalidation strategy.\n\nObjects created via this constructor will also bypass the cache of\na deserializing process when unpickled.\n\nCaution: Using this constructor may change the semantics of\nyour datetimes in surprising ways, only use it if you know\nthat you need to.\n\nThe following class methods are also available:\n\n-- Method: classmethod ZoneInfo.clearcache (*, onlykeys=None)\n\nA method for invalidating the cache on the 'ZoneInfo' class.  If no\narguments are passed, all caches are invalidated and the next call\nto the primary constructor for each key will return a new instance.\n\nIf an iterable of key names is passed to the 'onlykeys' parameter,\nonly the specified keys will be removed from the cache.  Keys\npassed to 'onlykeys' but not found in the cache are ignored.\n\nWarning: Invoking this function may change the semantics of\ndatetimes using 'ZoneInfo' in surprising ways; this modifies\nmodule state and thus may have wide-ranging effects.  Only use\nit if you know that you need to.\n\nThe class has one attribute:\n\n-- Attribute: ZoneInfo.key\n\nThis is a read-only *note attribute: 21ab. that returns the value\nof 'key' passed to the constructor, which should be a lookup key in\nthe IANA time zone database (e.g.  'America/NewYork',\n'Europe/Paris' or 'Asia/Tokyo').\n\nFor zones constructed from file without specifying a 'key'\nparameter, this will be set to 'None'.\n\nNote: Although it is a somewhat common practice to expose\nthese to end users, these values are designed to be primary\nkeys for representing the relevant zones and not necessarily\nuser-facing elements.  Projects like CLDR (the Unicode Common\nLocale Data Repository) can be used to get more user-friendly\nstrings from these keys.\n\n* Menu:\n\n* String representations::\n* Pickle serialization::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: String representations,  Next: Pickle serialization,  Up: The ZoneInfo class": {
            "content": "5.8.2.8 String representations\n..............................\n\nThe string representation returned when calling *note str: 157. on a\n*note ZoneInfo: 6f8. object defaults to using the *note ZoneInfo.key:\n21aa. attribute (see the note on usage in the attribute documentation):\n\n>>> zone = ZoneInfo(\"Pacific/Kwajalein\")\n>>> str(zone)\n'Pacific/Kwajalein'\n\n>>> dt = datetime(2020, 4, 1, 3, 15, tzinfo=zone)\n>>> f\"{dt.isoformat()} [{dt.tzinfo}]\"\n'2020-04-01T03:15:00+12:00 [Pacific/Kwajalein]'\n",
            "subsections": []
        },
        "For objects constructed from a file without specifying a 'key'": {
            "content": "parameter, 'str' falls back to calling *note repr(): 5f0.  'ZoneInfo''s\n'repr' is implementation-defined and not necessarily stable between\nversions, but it is guaranteed not to be a valid 'ZoneInfo' key.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Pickle serialization,  Prev: String representations,  Up: The ZoneInfo class": {
            "content": "5.8.2.9 Pickle serialization\n............................\n",
            "subsections": []
        },
        "Rather than serializing all transition data, 'ZoneInfo' objects are": {
            "content": "serialized by key, and 'ZoneInfo' objects constructed from files (even\nthose with a value for 'key' specified) cannot be pickled.\n\nThe behavior of a 'ZoneInfo' file depends on how it was constructed:\n\n1. 'ZoneInfo(key)': When constructed with the primary constructor, a\n'ZoneInfo' object is serialized by key, and when deserialized, the\ndeserializing process uses the primary and thus it is expected that\nthese are expected to be the same object as other references to the\nsame time zone.  For example, if 'europeberlinpkl' is a string\ncontaining a pickle constructed from 'ZoneInfo(\"Europe/Berlin\")',\none would expect the following behavior:\n\n>>> a = ZoneInfo(\"Europe/Berlin\")\n>>> b = pickle.loads(europeberlinpkl)\n>>> a is b\nTrue\n\n2. 'ZoneInfo.nocache(key)': When constructed from the cache-bypassing\nconstructor, the 'ZoneInfo' object is also serialized by key, but\nwhen deserialized, the deserializing process uses the cache\nbypassing constructor.  If 'europeberlinpklnc' is a string\ncontaining a pickle constructed from\n'ZoneInfo.nocache(\"Europe/Berlin\")', one would expect the\nfollowing behavior:\n\n>>> a = ZoneInfo(\"Europe/Berlin\")\n>>> b = pickle.loads(europeberlinpklnc)\n>>> a is b\nFalse\n\n3. 'ZoneInfo.fromfile(fobj, /, key=None)': When constructed from a\nfile, the 'ZoneInfo' object raises an exception on pickling.  If an\nend user wants to pickle a 'ZoneInfo' constructed from a file, it\nis recommended that they use a wrapper type or a custom\nserialization function: either serializing by key or storing the\ncontents of the file object and serializing that.\n",
            "subsections": []
        },
        "This method of serialization requires that the time zone data for the": {
            "content": "required key be available on both the serializing and deserializing\nside, similar to the way that references to classes and functions are\nexpected to exist in both the serializing and deserializing\nenvironments.  It also means that no guarantees are made about the\nconsistency of results when unpickling a 'ZoneInfo' pickled in an\nenvironment with a different version of the time zone data.\n\nFile: python3.12.info,  Node: Functions<3>,  Next: Globals,  Prev: The ZoneInfo class,  Up: zoneinfo -- IANA time zone support\n\n5.8.2.10 Functions\n..................\n\n-- Function: zoneinfo.availabletimezones ()\n\nGet a set containing all the valid keys for IANA time zones\navailable anywhere on the time zone path.  This is recalculated on\nevery call to the function.\n\nThis function only includes canonical zone names and does not\ninclude \"special\" zones such as those under the 'posix/' and\n'right/' directories, or the 'posixrules' zone.\n\nCaution: This function may open a large number of files, as\nthe best way to determine if a file on the time zone path is a\nvalid time zone is to read the \"magic string\" at the\nbeginning.\n\nNote: These values are not designed to be exposed to\nend-users; for user facing elements, applications should use\nsomething like CLDR (the Unicode Common Locale Data\nRepository) to get more user-friendly strings.  See also the\ncautionary note on *note ZoneInfo.key: 21aa.\n\n-- Function: zoneinfo.resettzpath (to=None)\n\nSets or resets the time zone search path (*note TZPATH: 1af0.) for\nthe module.  When called with no arguments, *note TZPATH: 1af0. is\nset to the default value.\n\nCalling 'resettzpath' will not invalidate the *note ZoneInfo: 6f8.\ncache, and so calls to the primary 'ZoneInfo' constructor will only\nuse the new 'TZPATH' in the case of a cache miss.\n\nThe 'to' parameter must be a *note sequence: 236. of strings or\n*note os.PathLike: a9a. and not a string, all of which must be\nabsolute paths.  *note ValueError: 183. will be raised if something\nother than an absolute path is passed.\n\nFile: python3.12.info,  Node: Globals,  Next: Exceptions and warnings,  Prev: Functions<3>,  Up: zoneinfo -- IANA time zone support\n\n5.8.2.11 Globals\n................\n\n-- Data: zoneinfo.TZPATH\n\nA read-only sequence representing the time zone search path - when\nconstructing a 'ZoneInfo' from a key, the key is joined to each\nentry in the 'TZPATH', and the first file found is used.\n\n'TZPATH' may contain only absolute paths, never relative paths,\nregardless of how it is configured.\n\nThe object that 'zoneinfo.TZPATH' points to may change in response\nto a call to *note resettzpath(): 219f, so it is recommended to\nuse 'zoneinfo.TZPATH' rather than importing 'TZPATH' from\n'zoneinfo' or assigning a long-lived variable to 'zoneinfo.TZPATH'.\n\nFor more information on configuring the time zone search path, see\n*note Configuring the data sources: 219c.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Exceptions and warnings,  Prev: Globals,  Up: zoneinfo -- IANA time zone support": {
            "content": "5.8.2.12 Exceptions and warnings\n................................\n\n-- Exception: zoneinfo.ZoneInfoNotFoundError\n\nRaised when construction of a *note ZoneInfo: 6f8. object fails\nbecause the specified key could not be found on the system.  This\nis a subclass of *note KeyError: 8cf.\n\n-- Exception: zoneinfo.InvalidTZPathWarning\n\nRaised when *note PYTHONTZPATH: 21a2. contains an invalid component\nthat will be filtered out, such as a relative path.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: calendar -- General calendar-related functions,  Next: collections -- Container datatypes,  Prev: zoneinfo -- IANA time zone support,  Up: Data Types": {
            "content": "'Source code:' Lib/calendar.py(1)\n\n\n",
            "subsections": []
        },
        "This module allows you to output calendars like the Unix 'cal' program,": {
            "content": "and provides additional useful functions related to the calendar.  By\ndefault, these calendars have Monday as the first day of the week, and\nSunday as the last (the European convention).  Use *note\nsetfirstweekday(): 21b3. to set the first day of the week to Sunday (6)\nor to any other weekday.  Parameters that specify dates are given as\nintegers.  For related functionality, see also the *note datetime: 2e.\nand *note time: e8. modules.\n",
            "subsections": []
        },
        "The functions and classes defined in this module use an idealized": {
            "content": "calendar, the current Gregorian calendar extended indefinitely in both\ndirections.  This matches the definition of the \"proleptic Gregorian\"\ncalendar in Dershowitz and Reingold's book \"Calendrical Calculations\",\nwhere it's the base calendar for all computations.  Zero and negative\nyears are interpreted as prescribed by the ISO 8601 standard.  Year 0 is\n1 BC, year -1 is 2 BC, and so on.\n\n-- Class: calendar.Calendar (firstweekday=0)\n\nCreates a *note Calendar: 21b4. object.  'firstweekday' is an\ninteger specifying the first day of the week.  *note MONDAY: 21b5.\nis '0' (the default), *note SUNDAY: 21b6. is '6'.\n\nA *note Calendar: 21b4. object provides several methods that can be\nused for preparing the calendar data for formatting.  This class\ndoesn't do any formatting itself.  This is the job of subclasses.\n\n*note Calendar: 21b4. instances have the following methods:\n\n-- Method: iterweekdays ()\n\nReturn an iterator for the week day numbers that will be used\nfor one week.  The first value from the iterator will be the\nsame as the value of the *note firstweekday: 21b8. property.\n\n-- Method: itermonthdates (year, month)\n\nReturn an iterator for the month 'month' (1-12) in the year\n'year'.  This iterator will return all days (as *note\ndatetime.date: 70f. objects) for the month and all days before\nthe start of the month or after the end of the month that are\nrequired to get a complete week.\n\n-- Method: itermonthdays (year, month)\n\nReturn an iterator for the month 'month' in the year 'year'\nsimilar to *note itermonthdates(): a5f, but not restricted by\nthe *note datetime.date: 70f. range.  Days returned will\nsimply be day of the month numbers.  For the days outside of\nthe specified month, the day number is '0'.\n\n-- Method: itermonthdays2 (year, month)\n\nReturn an iterator for the month 'month' in the year 'year'\nsimilar to *note itermonthdates(): a5f, but not restricted by\nthe *note datetime.date: 70f. range.  Days returned will be\ntuples consisting of a day of the month number and a week day\nnumber.\n\n-- Method: itermonthdays3 (year, month)\n\nReturn an iterator for the month 'month' in the year 'year'\nsimilar to *note itermonthdates(): a5f, but not restricted by\nthe *note datetime.date: 70f. range.  Days returned will be\ntuples consisting of a year, a month and a day of the month\nnumbers.\n\nNew in version 3.7.\n\n-- Method: itermonthdays4 (year, month)\n\nReturn an iterator for the month 'month' in the year 'year'\nsimilar to *note itermonthdates(): a5f, but not restricted by\nthe *note datetime.date: 70f. range.  Days returned will be\ntuples consisting of a year, a month, a day of the month, and\na day of the week numbers.\n\nNew in version 3.7.\n\n-- Method: monthdatescalendar (year, month)\n\nReturn a list of the weeks in the month 'month' of the 'year'\nas full weeks.  Weeks are lists of seven *note datetime.date:\n70f. objects.\n\n-- Method: monthdays2calendar (year, month)\n\nReturn a list of the weeks in the month 'month' of the 'year'\nas full weeks.  Weeks are lists of seven tuples of day numbers\nand weekday numbers.\n\n-- Method: monthdayscalendar (year, month)\n\nReturn a list of the weeks in the month 'month' of the 'year'\nas full weeks.  Weeks are lists of seven day numbers.\n\n-- Method: yeardatescalendar (year, width=3)\n\nReturn the data for the specified year ready for formatting.\nThe return value is a list of month rows.  Each month row\ncontains up to 'width' months (defaulting to 3).  Each month\ncontains between 4 and 6 weeks and each week contains 1-7\ndays.  Days are *note datetime.date: 70f. objects.\n\n-- Method: yeardays2calendar (year, width=3)\n\nReturn the data for the specified year ready for formatting\n(similar to *note yeardatescalendar(): 21be.).  Entries in the\nweek lists are tuples of day numbers and weekday numbers.  Day\nnumbers outside this month are zero.\n\n-- Method: yeardayscalendar (year, width=3)\n\nReturn the data for the specified year ready for formatting\n(similar to *note yeardatescalendar(): 21be.).  Entries in the\nweek lists are day numbers.  Day numbers outside this month\nare zero.\n\n-- Class: calendar.TextCalendar (firstweekday=0)\n\nThis class can be used to generate plain text calendars.\n\n*note TextCalendar: 21c1. instances have the following methods:\n\n-- Method: formatmonth (theyear, themonth, w=0, l=0)\n\nReturn a month's calendar in a multi-line string.  If 'w' is\nprovided, it specifies the width of the date columns, which\nare centered.  If 'l' is given, it specifies the number of\nlines that each week will use.  Depends on the first weekday\nas specified in the constructor or set by the *note\nsetfirstweekday(): 21b3. method.\n\n-- Method: prmonth (theyear, themonth, w=0, l=0)\n\nPrint a month's calendar as returned by *note formatmonth():\n21c2.\n\n-- Method: formatyear (theyear, w=2, l=1, c=6, m=3)\n\nReturn a 'm'-column calendar for an entire year as a\nmulti-line string.  Optional parameters 'w', 'l', and 'c' are\nfor date column width, lines per week, and number of spaces\nbetween month columns, respectively.  Depends on the first\nweekday as specified in the constructor or set by the *note\nsetfirstweekday(): 21b3. method.  The earliest year for which\na calendar can be generated is platform-dependent.\n\n-- Method: pryear (theyear, w=2, l=1, c=6, m=3)\n\nPrint the calendar for an entire year as returned by *note\nformatyear(): 21c4.\n\n-- Class: calendar.HTMLCalendar (firstweekday=0)\n\nThis class can be used to generate HTML calendars.\n\n'HTMLCalendar' instances have the following methods:\n\n-- Method: formatmonth (theyear, themonth, withyear=True)\n\nReturn a month's calendar as an HTML table.  If 'withyear' is\ntrue the year will be included in the header, otherwise just\nthe month name will be used.\n\n-- Method: formatyear (theyear, width=3)\n\nReturn a year's calendar as an HTML table.  'width'\n(defaulting to 3) specifies the number of months per row.\n\n-- Method: formatyearpage (theyear, width=3, css='calendar.css',\nencoding=None)\n\nReturn a year's calendar as a complete HTML page.  'width'\n(defaulting to 3) specifies the number of months per row.\n'css' is the name for the cascading style sheet to be used.\n*note None: 43f. can be passed if no style sheet should be\nused.  'encoding' specifies the encoding to be used for the\noutput (defaulting to the system default encoding).\n\n-- Method: formatmonthname (theyear, themonth, withyear=True)\n\nReturn a month name as an HTML table row.  If 'withyear' is\ntrue the year will be included in the row, otherwise just the\nmonth name will be used.\n\n'HTMLCalendar' has the following attributes you can override to\ncustomize the CSS classes used by the calendar:\n\n-- Attribute: cssclasses\n\nA list of CSS classes used for each weekday.  The default\nclass list is:\n\ncssclasses = [\"mon\", \"tue\", \"wed\", \"thu\", \"fri\", \"sat\", \"sun\"]\n\nmore styles can be added for each day:\n\ncssclasses = [\"mon text-bold\", \"tue\", \"wed\", \"thu\", \"fri\", \"sat\", \"sun red\"]\n\nNote that the length of this list must be seven items.\n\n-- Attribute: cssclassnoday\n\nThe CSS class for a weekday occurring in the previous or\ncoming month.\n\nNew in version 3.7.\n\n-- Attribute: cssclassesweekdayhead\n\nA list of CSS classes used for weekday names in the header\nrow.  The default is the same as *note cssclasses: 21ca.\n\nNew in version 3.7.\n\n-- Attribute: cssclassmonthhead\n\nThe month's head CSS class (used by *note formatmonthname():\n21c9.).  The default value is '\"month\"'.\n\nNew in version 3.7.\n\n-- Attribute: cssclassmonth\n\nThe CSS class for the whole month's table (used by *note\nformatmonth(): 21c6.).  The default value is '\"month\"'.\n\nNew in version 3.7.\n\n-- Attribute: cssclassyear\n\nThe CSS class for the whole year's table of tables (used by\n*note formatyear(): 21c7.).  The default value is '\"year\"'.\n\nNew in version 3.7.\n\n-- Attribute: cssclassyearhead\n\nThe CSS class for the table head for the whole year (used by\n*note formatyear(): 21c7.).  The default value is '\"year\"'.\n\nNew in version 3.7.\n\nNote that although the naming for the above described class\nattributes is singular (e.g.  'cssclassmonth' 'cssclassnoday'),\none can replace the single CSS class with a space separated list of\nCSS classes, for example:\n\n\"text-bold text-red\"\n\nHere is an example how 'HTMLCalendar' can be customized:\n\nclass CustomHTMLCal(calendar.HTMLCalendar):\ncssclasses = [style + \" text-nowrap\" for style in\ncalendar.HTMLCalendar.cssclasses]\ncssclassmonthhead = \"text-center month-head\"\ncssclassmonth = \"text-center month\"\ncssclassyear = \"text-italic lead\"\n\n-- Class: calendar.LocaleTextCalendar (firstweekday=0, locale=None)\n\nThis subclass of *note TextCalendar: 21c1. can be passed a locale\nname in the constructor and will return month and weekday names in\nthe specified locale.\n\n-- Class: calendar.LocaleHTMLCalendar (firstweekday=0, locale=None)\n\nThis subclass of *note HTMLCalendar: 95c. can be passed a locale\nname in the constructor and will return month and weekday names in\nthe specified locale.\n\nNote: The constructor, 'formatweekday()' and 'formatmonthname()'\nmethods of these two classes temporarily change the 'LCTIME'\nlocale to the given 'locale'.  Because the current locale is a\nprocess-wide setting, they are not thread-safe.\n\nFor simple text calendars this module provides the following functions.\n\n-- Function: calendar.setfirstweekday (weekday)\n\nSets the weekday ('0' is Monday, '6' is Sunday) to start each week.\nThe values *note MONDAY: 21b5, *note TUESDAY: 21d1, *note\nWEDNESDAY: 21d2, *note THURSDAY: 21d3, *note FRIDAY: 21d4, *note\nSATURDAY: 21d5, and *note SUNDAY: 21b6. are provided for\nconvenience.  For example, to set the first weekday to Sunday:\n\nimport calendar\ncalendar.setfirstweekday(calendar.SUNDAY)\n\n-- Function: calendar.firstweekday ()\n\nReturns the current setting for the weekday to start each week.\n\n-- Function: calendar.isleap (year)\n\nReturns *note True: a53. if 'year' is a leap year, otherwise *note\nFalse: 971.\n\n-- Function: calendar.leapdays (y1, y2)\n\nReturns the number of leap years in the range from 'y1' to 'y2'\n(exclusive), where 'y1' and 'y2' are years.\n\nThis function works for ranges spanning a century change.\n\n-- Function: calendar.weekday (year, month, day)\n\nReturns the day of the week ('0' is Monday) for 'year' ('1970'-...),\n'month' ('1'-'12'), 'day' ('1'-'31').\n\n-- Function: calendar.weekheader (n)\n\nReturn a header containing abbreviated weekday names.  'n'\nspecifies the width in characters for one weekday.\n\n-- Function: calendar.monthrange (year, month)\n\nReturns weekday of first day of the month and number of days in\nmonth, for the specified 'year' and 'month'.\n\n-- Function: calendar.monthcalendar (year, month)\n\nReturns a matrix representing a month's calendar.  Each row\nrepresents a week; days outside of the month are represented by\nzeros.  Each week begins with Monday unless set by *note\nsetfirstweekday(): 21b3.\n\n-- Function: calendar.prmonth (theyear, themonth, w=0, l=0)\n\nPrints a month's calendar as returned by *note month(): 21dd.\n\n-- Function: calendar.month (theyear, themonth, w=0, l=0)\n\nReturns a month's calendar in a multi-line string using the *note\nformatmonth(): 21c2. of the *note TextCalendar: 21c1. class.\n\n-- Function: calendar.prcal (year, w=0, l=0, c=6, m=3)\n\nPrints the calendar for an entire year as returned by *note\ncalendar(): 12.\n\n-- Function: calendar.calendar (year, w=2, l=1, c=6, m=3)\n\nReturns a 3-column calendar for an entire year as a multi-line\nstring using the *note formatyear(): 21c4. of the *note\nTextCalendar: 21c1. class.\n\n-- Function: calendar.timegm (tuple)\n\nAn unrelated but handy function that takes a time tuple such as\nreturned by the *note gmtime(): 1034. function in the *note time:\ne8. module, and returns the corresponding Unix timestamp value,\nassuming an epoch of 1970, and the POSIX encoding.  In fact, *note\ntime.gmtime(): 1034. and *note timegm(): 21e0. are each others'\ninverse.\n\nThe *note calendar: 12. module exports the following data attributes:\n\n-- Data: calendar.dayname\n\nAn array that represents the days of the week in the current\nlocale.\n\n-- Data: calendar.dayabbr\n\nAn array that represents the abbreviated days of the week in the\ncurrent locale.\n\n-- Data: calendar.MONDAY\n-- Data: calendar.TUESDAY\n-- Data: calendar.WEDNESDAY\n-- Data: calendar.THURSDAY\n-- Data: calendar.FRIDAY\n-- Data: calendar.SATURDAY\n-- Data: calendar.SUNDAY\n\nAliases for the days of the week, where 'MONDAY' is '0' and\n'SUNDAY' is '6'.\n\nNew in version 3.12.\n\n-- Class: calendar.Day\n\nEnumeration defining days of the week as integer constants.  The\nmembers of this enumeration are exported to the module scope as\n*note MONDAY: 21b5. through *note SUNDAY: 21b6.\n\nNew in version 3.12.\n\n-- Data: calendar.monthname\n\nAn array that represents the months of the year in the current\nlocale.  This follows normal convention of January being month\nnumber 1, so it has a length of 13 and 'monthname[0]' is the empty\nstring.\n\n-- Data: calendar.monthabbr\n\nAn array that represents the abbreviated months of the year in the\ncurrent locale.  This follows normal convention of January being\nmonth number 1, so it has a length of 13 and 'monthabbr[0]' is the\nempty string.\n\n-- Data: calendar.JANUARY\n-- Data: calendar.FEBRUARY\n-- Data: calendar.MARCH\n-- Data: calendar.APRIL\n-- Data: calendar.MAY\n-- Data: calendar.JUNE\n-- Data: calendar.JULY\n-- Data: calendar.AUGUST\n-- Data: calendar.SEPTEMBER\n-- Data: calendar.OCTOBER\n-- Data: calendar.NOVEMBER\n-- Data: calendar.DECEMBER\n\nAliases for the months of the year, where 'JANUARY' is '1' and\n'DECEMBER' is '12'.\n\nNew in version 3.12.\n\n-- Class: calendar.Month\n\nEnumeration defining months of the year as integer constants.  The\nmembers of this enumeration are exported to the module scope as\n*note JANUARY: 21f. through *note DECEMBER: 21ee.\n\nNew in version 3.12.\n\nThe *note calendar: 12. module defines the following exceptions:\n\n-- Exception: calendar.IllegalMonthError (month)\n\nA subclass of *note ValueError: 183, raised when the given month\nnumber is outside of the range 1-12 (inclusive).\n\n-- Attribute: month\n\nThe invalid month number.\n\n-- Exception: calendar.IllegalWeekdayError (weekday)\n\nA subclass of *note ValueError: 183, raised when the given weekday\nnumber is outside of the range 0-6 (inclusive).\n\n-- Attribute: weekday\n\nThe invalid weekday number.\n\nSee also\n........\n\nModule *note datetime: 2e.\n\nObject-oriented interface to dates and times with similar\nfunctionality to the *note time: e8. module.\n\nModule *note time: e8.\n\nLow-level time related functions.\n\n* Menu:\n\n* Command-Line Usage::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/calendar.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Command-Line Usage,  Up: calendar -- General calendar-related functions": {
            "content": "5.8.3.1 Command-Line Usage\n..........................\n\nNew in version 2.5.\n\nThe *note calendar: 12. module can be executed as a script from the\ncommand line to interactively print a calendar.\n\npython -m calendar [-h] [-L LOCALE] [-e ENCODING] [-t {text,html}]\n[-w WIDTH] [-l LINES] [-s SPACING] [-m MONTHS] [-c CSS]\n[year] [month]\n\nFor example, to print a calendar for the year 2000:\n\n$ python -m calendar 2000\n2000\n\nJanuary                   February                   March\nMo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su\n1  2          1  2  3  4  5  6             1  2  3  4  5\n3  4  5  6  7  8  9       7  8  9 10 11 12 13       6  7  8  9 10 11 12\n10 11 12 13 14 15 16      14 15 16 17 18 19 20      13 14 15 16 17 18 19\n17 18 19 20 21 22 23      21 22 23 24 25 26 27      20 21 22 23 24 25 26\n24 25 26 27 28 29 30      28 29                     27 28 29 30 31\n31\n\nApril                      May                       June\nMo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su\n1  2       1  2  3  4  5  6  7                1  2  3  4\n3  4  5  6  7  8  9       8  9 10 11 12 13 14       5  6  7  8  9 10 11\n10 11 12 13 14 15 16      15 16 17 18 19 20 21      12 13 14 15 16 17 18\n17 18 19 20 21 22 23      22 23 24 25 26 27 28      19 20 21 22 23 24 25\n24 25 26 27 28 29 30      29 30 31                  26 27 28 29 30\n\nJuly                     August                  September\nMo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su\n1  2          1  2  3  4  5  6                   1  2  3\n3  4  5  6  7  8  9       7  8  9 10 11 12 13       4  5  6  7  8  9 10\n10 11 12 13 14 15 16      14 15 16 17 18 19 20      11 12 13 14 15 16 17\n17 18 19 20 21 22 23      21 22 23 24 25 26 27      18 19 20 21 22 23 24\n24 25 26 27 28 29 30      28 29 30 31               25 26 27 28 29 30\n31\n\nOctober                   November                  December\nMo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su\n1             1  2  3  4  5                   1  2  3\n2  3  4  5  6  7  8       6  7  8  9 10 11 12       4  5  6  7  8  9 10\n9 10 11 12 13 14 15      13 14 15 16 17 18 19      11 12 13 14 15 16 17\n16 17 18 19 20 21 22      20 21 22 23 24 25 26      18 19 20 21 22 23 24\n23 24 25 26 27 28 29      27 28 29 30               25 26 27 28 29 30 31\n30 31\n\nThe following options are accepted:\n\n-- Option: --help, -h\n\nShow the help message and exit.\n\n-- Option: --locale LOCALE, -L LOCALE\n\nThe locale to use for month and weekday names.  Defaults to\nEnglish.\n\n-- Option: --encoding ENCODING, -e ENCODING\n\nThe encoding to use for output.  *note -encoding: 21f9. is required\nif *note -locale: 21f7. is set.\n\n-- Option: --type {text,html}, -t {text,html}\n\nPrint the calendar to the terminal as text, or as an HTML document.\n\n-- Option: year\n\nThe year to print the calendar for.  Must be a number between 1 and\n9999.  Defaults to the current year.\n\n-- Option: month\n\nThe month of the specified *note year: 21fd. to print the calendar\nfor.  Must be a number between 1 and 12, and may only be used in\ntext mode.  Defaults to printing a calendar for the full year.\n\n'Text-mode options:'\n\n-- Option: --width WIDTH, -w WIDTH\n\nThe width of the date column in terminal columns.  The date is\nprinted centred in the column.  Any value lower than 2 is ignored.\nDefaults to 2.\n\n-- Option: --lines LINES, -l LINES\n\nThe number of lines for each week in terminal rows.  The date is\nprinted top-aligned.  Any value lower than 1 is ignored.  Defaults\nto 1.\n\n-- Option: --spacing SPACING, -s SPACING\n\nThe space between months in columns.  Any value lower than 2 is\nignored.  Defaults to 6.\n\n-- Option: --months MONTHS, -m MONTHS\n\nThe number of months printed per row.  Defaults to 3.\n\n'HTML-mode options:'\n\n-- Option: --css CSS, -c CSS\n\nThe path of a CSS stylesheet to use for the calendar.  This must\neither be relative to the generated HTML, or an absolute HTTP or\n'file:///' URL.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: collections -- Container datatypes,  Next: collections abc -- Abstract Base Classes for Containers,  Prev: calendar -- General calendar-related functions,  Up: Data Types": {
            "content": "'Source code:' Lib/collections/init.py(1)\n\n\n",
            "subsections": []
        },
        "This module implements specialized container datatypes providing": {
            "content": "alternatives to Python's general purpose built-in containers, *note\ndict: 237, *note list: 3dc, *note set: 39d, and *note tuple: 4b8.\n\n*note namedtuple(): 711.  factory function for creating tuple subclasses with named fields\n\n\n*note deque: 3a0.         list-like container with fast appends and pops on either end\n\n\n*note ChainMap: a62.      dict-like class for creating a single view of multiple mappings\n\n\n*note Counter: f09.       dict subclass for counting *note hashable: 3db. objects\n\n\n*note OrderedDict: 39f.   dict subclass that remembers the order entries were added\n\n\n*note defaultdict: 1031.  dict subclass that calls a factory function to supply missing values\n\n\n*note UserDict: 1702.     wrapper around dictionary objects for easier dict subclassing\n\n\n*note UserList: 133e.     wrapper around list objects for easier list subclassing\n\n\n*note UserString: c32.    wrapper around string objects for easier string subclassing\n\n\n* Menu:\n\n* ChainMap objects::\n* Counter objects::\n* deque objects::\n* defaultdict objects::\n* namedtuple() Factory Function for Tuples with Named Fields: namedtuple Factory Function for Tuples with Named Fields.\n* OrderedDict objects::\n* UserDict objects::\n* UserList objects::\n* UserString objects::\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/collections/init.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ChainMap objects,  Next: Counter objects,  Up: collections -- Container datatypes": {
            "content": "5.8.4.1 'ChainMap' objects\n..........................\n\nNew in version 3.3.\n\nA *note ChainMap: a62. class is provided for quickly linking a number of\nmappings so they can be treated as a single unit.  It is often much\nfaster than creating a new dictionary and running multiple *note\nupdate(): 12ba. calls.\n",
            "subsections": []
        },
        "The class can be used to simulate nested scopes and is useful in": {
            "content": "templating.\n\n-- Class: collections.ChainMap (*maps)\n\nA *note ChainMap: a62. groups multiple dicts or other mappings\ntogether to create a single, updateable view.  If no 'maps' are\nspecified, a single empty dictionary is provided so that a new\nchain always has at least one mapping.\n\nThe underlying mappings are stored in a list.  That list is public\nand can be accessed or updated using the 'maps' attribute.  There\nis no other state.\n\nLookups search the underlying mappings successively until a key is\nfound.  In contrast, writes, updates, and deletions only operate on\nthe first mapping.\n\nA *note ChainMap: a62. incorporates the underlying mappings by\nreference.  So, if one of the underlying mappings gets updated,\nthose changes will be reflected in *note ChainMap: a62.\n\nAll of the usual dictionary methods are supported.  In addition,\nthere is a 'maps' attribute, a method for creating new subcontexts,\nand a property for accessing all but the first mapping:\n\n-- Attribute: maps\n\nA user updateable list of mappings.  The list is ordered from\nfirst-searched to last-searched.  It is the only stored state\nand can be modified to change which mappings are searched.\nThe list should always contain at least one mapping.\n\n-- Method: newchild (m=None, kwargs)\n\nReturns a new *note ChainMap: a62. containing a new map\nfollowed by all of the maps in the current instance.  If 'm'\nis specified, it becomes the new map at the front of the list\nof mappings; if not specified, an empty dict is used, so that\na call to 'd.newchild()' is equivalent to: 'ChainMap({},\n*d.maps)'.  If any keyword arguments are specified, they\nupdate passed map or new empty dict.  This method is used for\ncreating subcontexts that can be updated without altering\nvalues in any of the parent mappings.\n\nChanged in version 3.4: The optional 'm' parameter was added.\n\nChanged in version 3.10: Keyword arguments support was added.\n\n-- Attribute: parents\n\nProperty returning a new *note ChainMap: a62. containing all\nof the maps in the current instance except the first one.\nThis is useful for skipping the first map in the search.  Use\ncases are similar to those for the *note nonlocal: 111f.\nkeyword used in *note nested scopes: 1e71.  The use cases also\nparallel those for the built-in *note super(): 204. function.\nA reference to 'd.parents' is equivalent to:\n'ChainMap(*d.maps[1:])'.\n\nNote, the iteration order of a *note ChainMap(): a62. is determined\nby scanning the mappings last to first:\n\n>>> baseline = {'music': 'bach', 'art': 'rembrandt'}\n>>> adjustments = {'art': 'van gogh', 'opera': 'carmen'}\n>>> list(ChainMap(adjustments, baseline))\n['music', 'art', 'opera']\n\nThis gives the same ordering as a series of *note dict.update():\n12ba. calls starting with the last mapping:\n\n>>> combined = baseline.copy()\n>>> combined.update(adjustments)\n>>> list(combined)\n['music', 'art', 'opera']\n\nChanged in version 3.9: Added support for '|' and '|=' operators,\nspecified in PEP 584(1).\n\nSee also\n........\n\n* The MultiContext class(2) in the Enthought CodeTools package(3) has\noptions to support writing to any mapping in the chain.\n\n* Django's Context class(4) for templating is a read-only chain of\nmappings.  It also features pushing and popping of contexts similar\nto the *note newchild(): d90. method and the *note parents: 220d.\nproperty.\n\n* The Nested Contexts recipe(5) has options to control whether writes\nand other mutations apply only to the first mapping or to any\nmapping in the chain.\n\n* A greatly simplified read-only version of Chainmap(6).\n\n* Menu:\n\n* ChainMap Examples and Recipes::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0584/\n\n(2)\nhttps://github.com/enthought/codetools/blob/4.0.0/codetools/contexts/multicontext.py\n\n(3) https://github.com/enthought/codetools\n\n(4)\nhttps://github.com/django/django/blob/main/django/template/context.py\n\n(5) https://code.activestate.com/recipes/577434/\n\n(6) https://code.activestate.com/recipes/305268/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ChainMap Examples and Recipes,  Up: ChainMap objects": {
            "content": "5.8.4.2 'ChainMap' Examples and Recipes\n.......................................\n\nThis section shows various approaches to working with chained maps.\n\nExample of simulating Python's internal lookup chain:\n\nimport builtins\npylookup = ChainMap(locals(), globals(), vars(builtins))\n",
            "subsections": []
        },
        "Example of letting user specified command-line arguments take precedence": {
            "content": "over environment variables which in turn take precedence over default\nvalues:\n\nimport os, argparse\n\ndefaults = {'color': 'red', 'user': 'guest'}\n\nparser = argparse.ArgumentParser()\nparser.addargument('-u', '--user')\nparser.addargument('-c', '--color')\nnamespace = parser.parseargs()\ncommandlineargs = {k: v for k, v in vars(namespace).items() if v is not None}\n\ncombined = ChainMap(commandlineargs, os.environ, defaults)\nprint(combined['color'])\nprint(combined['user'])\n\nExample patterns for using the *note ChainMap: a62. class to simulate\nnested contexts:\n\nc = ChainMap()        # Create root context\nd = c.newchild()     # Create nested child context\ne = c.newchild()     # Child of c, independent from d\ne.maps[0]             # Current context dictionary -- like Python's locals()\ne.maps[-1]            # Root context -- like Python's globals()\ne.parents             # Enclosing context chain -- like Python's nonlocals\n\nd['x'] = 1            # Set value in current context\nd['x']                # Get first key in the chain of contexts\ndel d['x']            # Delete from current context\nlist(d)               # All nested values\nk in d                # Check all nested values\nlen(d)                # Number of nested values\nd.items()             # All nested items\ndict(d)               # Flatten into a regular dictionary\n\nThe *note ChainMap: a62. class only makes updates (writes and deletions)\nto the first mapping in the chain while lookups will search the full\nchain.  However, if deep writes and deletions are desired, it is easy to\nmake a subclass that updates keys found deeper in the chain:\n\nclass DeepChainMap(ChainMap):\n'Variant of ChainMap that allows direct updates to inner scopes'\n\ndef setitem(self, key, value):\nfor mapping in self.maps:\nif key in mapping:\nmapping[key] = value\nreturn\nself.maps[0][key] = value\n\ndef delitem(self, key):\nfor mapping in self.maps:\nif key in mapping:\ndel mapping[key]\nreturn\nraise KeyError(key)\n\n>>> d = DeepChainMap({'zebra': 'black'}, {'elephant': 'blue'}, {'lion': 'yellow'})\n>>> d['lion'] = 'orange'         # update an existing key two levels down\n>>> d['snake'] = 'red'           # new keys get added to the topmost dict\n>>> del d['elephant']            # remove an existing key one level down\n>>> d                            # display result\nDeepChainMap({'zebra': 'black', 'snake': 'red'}, {}, {'lion': 'orange'})\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Counter objects,  Next: deque objects,  Prev: ChainMap objects,  Up: collections -- Container datatypes": {
            "content": "5.8.4.3 'Counter' objects\n.........................\n\nA counter tool is provided to support convenient and rapid tallies.  For\nexample:\n\n>>> # Tally occurrences of words in a list\n>>> cnt = Counter()\n>>> for word in ['red', 'blue', 'red', 'green', 'blue', 'blue']:\n...     cnt[word] += 1\n...\n>>> cnt\nCounter({'blue': 3, 'red': 2, 'green': 1})\n\n>>> # Find the ten most common words in Hamlet\n>>> import re\n>>> words = re.findall(r'\\w+', open('hamlet.txt').read().lower())\n>>> Counter(words).mostcommon(10)\n[('the', 1143), ('and', 966), ('to', 762), ('of', 669), ('i', 631),\n('you', 554),  ('a', 546), ('my', 514), ('hamlet', 471), ('in', 451)]\n\n-- Class: collections.Counter ([iterable-or-mapping])\n\nA *note Counter: f09. is a *note dict: 237. subclass for counting\n*note hashable: 3db. objects.  It is a collection where elements\nare stored as dictionary keys and their counts are stored as\ndictionary values.  Counts are allowed to be any integer value\nincluding zero or negative counts.  The *note Counter: f09. class\nis similar to bags or multisets in other languages.\n\nElements are counted from an 'iterable' or initialized from another\n'mapping' (or counter):\n\n>>> c = Counter()                           # a new, empty counter\n>>> c = Counter('gallahad')                 # a new counter from an iterable\n>>> c = Counter({'red': 4, 'blue': 2})      # a new counter from a mapping\n>>> c = Counter(cats=4, dogs=8)             # a new counter from keyword args\n\nCounter objects have a dictionary interface except that they return\na zero count for missing items instead of raising a *note KeyError:\n8cf.:\n\n>>> c = Counter(['eggs', 'ham'])\n>>> c['bacon']                              # count of a missing element is zero\n0\n\nSetting a count to zero does not remove an element from a counter.\nUse 'del' to remove it entirely:\n\n>>> c['sausage'] = 0                        # counter entry with a zero count\n>>> del c['sausage']                        # del actually removes the entry\n\nNew in version 3.1.\n\nChanged in version 3.7: As a *note dict: 237. subclass, *note\nCounter: f09. inherited the capability to remember insertion order.\nMath operations on 'Counter' objects also preserve order.  Results\nare ordered according to when an element is first encountered in\nthe left operand and then by the order encountered in the right\noperand.\n\nCounter objects support additional methods beyond those available\nfor all dictionaries:\n\n-- Method: elements ()\n\nReturn an iterator over elements repeating each as many times\nas its count.  Elements are returned in the order first\nencountered.  If an element's count is less than one, *note\nelements(): 1179. will ignore it.\n\n>>> c = Counter(a=4, b=2, c=0, d=-2)\n>>> sorted(c.elements())\n['a', 'a', 'a', 'a', 'b', 'b']\n\n-- Method: mostcommon ([n])\n\nReturn a list of the 'n' most common elements and their counts\nfrom the most common to the least.  If 'n' is omitted or\n'None', *note mostcommon(): 1178. returns 'all' elements in\nthe counter.  Elements with equal counts are ordered in the\norder first encountered:\n\n>>> Counter('abracadabra').mostcommon(3)\n[('a', 5), ('b', 2), ('r', 2)]\n\n-- Method: subtract ([iterable-or-mapping])\n\nElements are subtracted from an 'iterable' or from another\n'mapping' (or counter).  Like *note dict.update(): 12ba. but\nsubtracts counts instead of replacing them.  Both inputs and\noutputs may be zero or negative.\n\n>>> c = Counter(a=4, b=2, c=0, d=-2)\n>>> d = Counter(a=1, b=2, c=3, d=4)\n>>> c.subtract(d)\n>>> c\nCounter({'a': 3, 'b': 0, 'c': -3, 'd': -6})\n\nNew in version 3.2.\n\n-- Method: total ()\n\nCompute the sum of the counts.\n\n>>> c = Counter(a=10, b=5, c=0)\n>>> c.total()\n15\n\nNew in version 3.10.\n\nThe usual dictionary methods are available for *note Counter: f09.\nobjects except for two which work differently for counters.\n\n-- Method: fromkeys (iterable)\n\nThis class method is not implemented for *note Counter: f09.\nobjects.\n\n-- Method: update ([iterable-or-mapping])\n\nElements are counted from an 'iterable' or added-in from\nanother 'mapping' (or counter).  Like *note dict.update():\n12ba. but adds counts instead of replacing them.  Also, the\n'iterable' is expected to be a sequence of elements, not a\nsequence of '(key, value)' pairs.\n",
            "subsections": []
        },
        "Counters support rich comparison operators for equality, subset, and": {
            "content": "superset relationships: '==', '!=', '<', '<=', '>', '>='.  All of those\ntests treat missing elements as having zero counts so that 'Counter(a=1)\n== Counter(a=1, b=0)' returns true.\n\nChanged in version 3.10: Rich comparison operations were added.\n",
            "subsections": []
        },
        "Changed in version 3.10: In equality tests, missing elements are treated": {
            "content": "as having zero counts.  Formerly, 'Counter(a=3)' and 'Counter(a=3, b=0)'\nwere considered distinct.\n\nCommon patterns for working with *note Counter: f09. objects:\n\nc.total()                       # total of all counts\nc.clear()                       # reset all counts\nlist(c)                         # list unique elements\nset(c)                          # convert to a set\ndict(c)                         # convert to a regular dictionary\nc.items()                       # convert to a list of (elem, cnt) pairs\nCounter(dict(listofpairs))    # convert from a list of (elem, cnt) pairs\nc.mostcommon()[:-n-1:-1]       # n least common elements\n+c                              # remove zero and negative counts\n\nSeveral mathematical operations are provided for combining *note",
            "subsections": []
        },
        "Counter: f09. objects to produce multisets (counters that have counts": {
            "content": "greater than zero).  Addition and subtraction combine counters by adding\nor subtracting the counts of corresponding elements.  Intersection and\nunion return the minimum and maximum of corresponding counts.  Equality\nand inclusion compare corresponding counts.  Each operation can accept\ninputs with signed counts, but the output will exclude results with\ncounts of zero or less.\n\n>>> c = Counter(a=3, b=1)\n>>> d = Counter(a=1, b=2)\n>>> c + d                       # add two counters together:  c[x] + d[x]\nCounter({'a': 4, 'b': 3})\n>>> c - d                       # subtract (keeping only positive counts)\nCounter({'a': 2})\n>>> c & d                       # intersection:  min(c[x], d[x])\nCounter({'a': 1, 'b': 1})\n>>> c | d                       # union:  max(c[x], d[x])\nCounter({'a': 3, 'b': 2})\n>>> c == d                      # equality:  c[x] == d[x]\nFalse\n>>> c <= d                      # inclusion:  c[x] <= d[x]\nFalse\n",
            "subsections": []
        },
        "Unary addition and subtraction are shortcuts for adding an empty counter": {
            "content": "or subtracting from an empty counter.\n\n>>> c = Counter(a=2, b=-4)\n>>> +c\nCounter({'a': 2})\n>>> -c\nCounter({'b': 4})\n",
            "subsections": []
        },
        "New in version 3.3: Added support for unary plus, unary minus, and": {
            "content": "in-place multiset operations.\n\nNote: Counters were primarily designed to work with positive\nintegers to represent running counts; however, care was taken to\nnot unnecessarily preclude use cases needing other types or\nnegative values.  To help with those use cases, this section\ndocuments the minimum range and type restrictions.\n\n* The *note Counter: f09. class itself is a dictionary subclass\nwith no restrictions on its keys and values.  The values are\nintended to be numbers representing counts, but you 'could'\nstore anything in the value field.\n\n* The *note mostcommon(): 1178. method requires only that the\nvalues be orderable.\n\n* For in-place operations such as 'c[key] += 1', the value type\nneed only support addition and subtraction.  So fractions,\nfloats, and decimals would work and negative values are\nsupported.  The same is also true for *note update(): 2212.\nand *note subtract(): 1052. which allow negative and zero\nvalues for both inputs and outputs.\n\n* The multiset methods are designed only for use cases with\npositive values.  The inputs may be negative or zero, but only\noutputs with positive values are created.  There are no type\nrestrictions, but the value type needs to support addition,\nsubtraction, and comparison.\n\n* The *note elements(): 1179. method requires integer counts.\nIt ignores zero and negative counts.\n\nSee also\n........\n\n* Bag class(1) in Smalltalk.\n\n* Wikipedia entry for Multisets(2).\n\n* C++ multisets(3) tutorial with examples.\n\n* For mathematical operations on multisets and their use cases, see\n'Knuth, Donald.  The Art of Computer Programming Volume II, Section\n4.6.3, Exercise 19'.\n\n* To enumerate all distinct multisets of a given size over a given\nset of elements, see *note\nitertools.combinationswithreplacement(): 10fa.:\n\nmap(Counter, combinationswithreplacement('ABC', 2)) # --> AA AB AC BB BC CC\n\n---------- Footnotes ----------\n\n(1)\nhttps://www.gnu.org/software/smalltalk/manual-base/htmlnode/Bag.html\n\n(2) https://en.wikipedia.org/wiki/Multiset\n\n(3)\nhttp://www.java2s.com/Tutorial/Cpp/0380set-multiset/Catalog0380set-multiset.htm\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: deque objects,  Next: defaultdict objects,  Prev: Counter objects,  Up: collections -- Container datatypes": {
            "content": "5.8.4.4 'deque' objects\n.......................\n\n-- Class: collections.deque ([iterable[, maxlen]])\n\nReturns a new deque object initialized left-to-right (using *note\nappend(): 2214.) with data from 'iterable'.  If 'iterable' is not\nspecified, the new deque is empty.\n\nDeques are a generalization of stacks and queues (the name is\npronounced \"deck\" and is short for \"double-ended queue\").  Deques\nsupport thread-safe, memory efficient appends and pops from either\nside of the deque with approximately the same 'O'(1) performance in\neither direction.\n\nThough *note list: 3dc. objects support similar operations, they\nare optimized for fast fixed-length operations and incur 'O'('n')\nmemory movement costs for 'pop(0)' and 'insert(0, v)' operations\nwhich change both the size and position of the underlying data\nrepresentation.\n\nIf 'maxlen' is not specified or is 'None', deques may grow to an\narbitrary length.  Otherwise, the deque is bounded to the specified\nmaximum length.  Once a bounded length deque is full, when new\nitems are added, a corresponding number of items are discarded from\nthe opposite end.  Bounded length deques provide functionality\nsimilar to the 'tail' filter in Unix.  They are also useful for\ntracking transactions and other pools of data where only the most\nrecent activity is of interest.\n\nDeque objects support the following methods:\n\n-- Method: append (x)\n\nAdd 'x' to the right side of the deque.\n\n-- Method: appendleft (x)\n\nAdd 'x' to the left side of the deque.\n\n-- Method: clear ()\n\nRemove all elements from the deque leaving it with length 0.\n\n-- Method: copy ()\n\nCreate a shallow copy of the deque.\n\nNew in version 3.5.\n\n-- Method: count (x)\n\nCount the number of deque elements equal to 'x'.\n\nNew in version 3.2.\n\n-- Method: extend (iterable)\n\nExtend the right side of the deque by appending elements from\nthe iterable argument.\n\n-- Method: extendleft (iterable)\n\nExtend the left side of the deque by appending elements from\n'iterable'.  Note, the series of left appends results in\nreversing the order of elements in the iterable argument.\n\n-- Method: index (x[, start[, stop]])\n\nReturn the position of 'x' in the deque (at or after index\n'start' and before index 'stop').  Returns the first match or\nraises *note ValueError: 183. if not found.\n\nNew in version 3.5.\n\n-- Method: insert (i, x)\n\nInsert 'x' into the deque at position 'i'.\n\nIf the insertion would cause a bounded deque to grow beyond\n'maxlen', an *note IndexError: 138f. is raised.\n\nNew in version 3.5.\n\n-- Method: pop ()\n\nRemove and return an element from the right side of the deque.\nIf no elements are present, raises an *note IndexError: 138f.\n\n-- Method: popleft ()\n\nRemove and return an element from the left side of the deque.\nIf no elements are present, raises an *note IndexError: 138f.\n\n-- Method: remove (value)\n\nRemove the first occurrence of 'value'.  If not found, raises\na *note ValueError: 183.\n\n-- Method: reverse ()\n\nReverse the elements of the deque in-place and then return\n'None'.\n\nNew in version 3.2.\n\n-- Method: rotate (n=1)\n\nRotate the deque 'n' steps to the right.  If 'n' is negative,\nrotate to the left.\n\nWhen the deque is not empty, rotating one step to the right is\nequivalent to 'd.appendleft(d.pop())', and rotating one step\nto the left is equivalent to 'd.append(d.popleft())'.\n\nDeque objects also provide one read-only attribute:\n\n-- Attribute: maxlen\n\nMaximum size of a deque or 'None' if unbounded.\n\nNew in version 3.1.\n",
            "subsections": []
        },
        "In addition to the above, deques support iteration, pickling, 'len(d)',": {
            "content": "'reversed(d)', 'copy.copy(d)', 'copy.deepcopy(d)', membership testing\nwith the *note in: 250. operator, and subscript references such as\n'd[0]' to access the first element.  Indexed access is 'O'(1) at both\nends but slows to 'O'('n') in the middle.  For fast random access, use\nlists instead.\n",
            "subsections": []
        },
        "Starting in version 3.5, deques support 'add()', 'mul()', and": {
            "content": "'imul()'.\n\nExample:\n\n>>> from collections import deque\n>>> d = deque('ghi')                 # make a new deque with three items\n>>> for elem in d:                   # iterate over the deque's elements\n...     print(elem.upper())\nG\nH\nI\n\n>>> d.append('j')                    # add a new entry to the right side\n>>> d.appendleft('f')                # add a new entry to the left side\n>>> d                                # show the representation of the deque\ndeque(['f', 'g', 'h', 'i', 'j'])\n\n>>> d.pop()                          # return and remove the rightmost item\n'j'\n>>> d.popleft()                      # return and remove the leftmost item\n'f'\n>>> list(d)                          # list the contents of the deque\n['g', 'h', 'i']\n>>> d[0]                             # peek at leftmost item\n'g'\n>>> d[-1]                            # peek at rightmost item\n'i'\n\n>>> list(reversed(d))                # list the contents of a deque in reverse\n['i', 'h', 'g']\n>>> 'h' in d                         # search the deque\nTrue\n>>> d.extend('jkl')                  # add multiple elements at once\n>>> d\ndeque(['g', 'h', 'i', 'j', 'k', 'l'])\n>>> d.rotate(1)                      # right rotation\n>>> d\ndeque(['l', 'g', 'h', 'i', 'j', 'k'])\n>>> d.rotate(-1)                     # left rotation\n>>> d\ndeque(['g', 'h', 'i', 'j', 'k', 'l'])\n\n>>> deque(reversed(d))               # make a new deque in reverse order\ndeque(['l', 'k', 'j', 'i', 'h', 'g'])\n>>> d.clear()                        # empty the deque\n>>> d.pop()                          # cannot pop from an empty deque\nTraceback (most recent call last):\nFile \"<pyshell#6>\", line 1, in -toplevel-\nd.pop()\nIndexError: pop from an empty deque\n\n>>> d.extendleft('abc')              # extendleft() reverses the input order\n>>> d\ndeque(['c', 'b', 'a'])\n\n* Menu:\n\n* deque Recipes::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: deque Recipes,  Up: deque objects": {
            "content": "5.8.4.5 'deque' Recipes\n.......................\n\nThis section shows various approaches to working with deques.\n",
            "subsections": []
        },
        "Bounded length deques provide functionality similar to the 'tail' filter": {
            "content": "in Unix:\n\ndef tail(filename, n=10):\n'Return the last n lines of a file'\nwith open(filename) as f:\nreturn deque(f, n)\n",
            "subsections": []
        },
        "Another approach to using deques is to maintain a sequence of recently": {
            "content": "added elements by appending to the right and popping to the left:\n\ndef movingaverage(iterable, n=3):\n# movingaverage([40, 30, 50, 46, 39, 44]) --> 40.0 42.0 45.0 43.0\n# https://en.wikipedia.org/wiki/Movingaverage\nit = iter(iterable)\nd = deque(itertools.islice(it, n-1))\nd.appendleft(0)\ns = sum(d)\nfor elem in it:\ns += elem - d.popleft()\nd.append(elem)\nyield s / n\n\nA round-robin scheduler(1) can be implemented with input iterators\nstored in a *note deque: 3a0.  Values are yielded from the active\niterator in position zero.  If that iterator is exhausted, it can be\nremoved with *note popleft(): 221a.; otherwise, it can be cycled back to\nthe end with the *note rotate(): 163b. method:\n\ndef roundrobin(*iterables):\n\"roundrobin('ABC', 'D', 'EF') --> A D E B F C\"\niterators = deque(map(iter, iterables))\nwhile iterators:\ntry:\nwhile True:\nyield next(iterators[0])\niterators.rotate(-1)\nexcept StopIteration:\n# Remove an exhausted iterator.\niterators.popleft()\n\nThe *note rotate(): 163b. method provides a way to implement *note\ndeque: 3a0. slicing and deletion.  For example, a pure Python\nimplementation of 'del d[n]' relies on the 'rotate()' method to position\nelements to be popped:\n\ndef deletenth(d, n):\nd.rotate(-n)\nd.popleft()\nd.rotate(n)\n\nTo implement *note deque: 3a0. slicing, use a similar approach applying\n*note rotate(): 163b. to bring a target element to the left side of the\ndeque.  Remove old entries with *note popleft(): 221a, add new entries\nwith *note extend(): 2217, and then reverse the rotation.  With minor\nvariations on that approach, it is easy to implement Forth style stack\nmanipulations such as 'dup', 'drop', 'swap', 'over', 'pick', 'rot', and\n'roll'.\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Round-robinscheduling\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: defaultdict objects,  Next: namedtuple Factory Function for Tuples with Named Fields,  Prev: deque objects,  Up: collections -- Container datatypes": {
            "content": "5.8.4.6 'defaultdict' objects\n.............................\n\n-- Class: collections.defaultdict (defaultfactory=None, /[, ...])\n\nReturn a new dictionary-like object.  *note defaultdict: 1031. is a\nsubclass of the built-in *note dict: 237. class.  It overrides one\nmethod and adds one writable instance variable.  The remaining\nfunctionality is the same as for the *note dict: 237. class and is\nnot documented here.\n\nThe first argument provides the initial value for the *note\ndefaultfactory: 221d. attribute; it defaults to 'None'.  All\nremaining arguments are treated the same as if they were passed to\nthe *note dict: 237. constructor, including keyword arguments.\n\n*note defaultdict: 1031. objects support the following method in\naddition to the standard *note dict: 237. operations:\n\n-- Method: missing (key)\n\nIf the *note defaultfactory: 221d. attribute is 'None', this\nraises a *note KeyError: 8cf. exception with the 'key' as\nargument.\n\nIf *note defaultfactory: 221d. is not 'None', it is called\nwithout arguments to provide a default value for the given\n'key', this value is inserted in the dictionary for the 'key',\nand returned.\n\nIf calling *note defaultfactory: 221d. raises an exception\nthis exception is propagated unchanged.\n\nThis method is called by the *note getitem(): 4b9. method\nof the *note dict: 237. class when the requested key is not\nfound; whatever it returns or raises is then returned or\nraised by *note getitem(): 4b9.\n\nNote that *note missing(): 221e. is 'not' called for any\noperations besides *note getitem(): 4b9.  This means that\n'get()' will, like normal dictionaries, return 'None' as a\ndefault rather than using *note defaultfactory: 221d.\n\n*note defaultdict: 1031. objects support the following instance\nvariable:\n\n-- Attribute: defaultfactory\n\nThis attribute is used by the *note missing(): 221e.\nmethod; it is initialized from the first argument to the\nconstructor, if present, or to 'None', if absent.\n\nChanged in version 3.9: Added merge ('|') and update ('|=')\noperators, specified in PEP 584(1).\n\n* Menu:\n\n* defaultdict Examples::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0584/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: defaultdict Examples,  Up: defaultdict objects": {
            "content": "5.8.4.7 'defaultdict' Examples\n..............................\n\nUsing *note list: 3dc. as the *note defaultfactory: 221d, it is easy to\ngroup a sequence of key-value pairs into a dictionary of lists:\n\n>>> s = [('yellow', 1), ('blue', 2), ('yellow', 3), ('blue', 4), ('red', 1)]\n>>> d = defaultdict(list)\n>>> for k, v in s:\n...     d[k].append(v)\n...\n>>> sorted(d.items())\n[('blue', [2, 4]), ('red', [1]), ('yellow', [1, 3])]\n",
            "subsections": []
        },
        "When each key is encountered for the first time, it is not already in": {
            "content": "the mapping; so an entry is automatically created using the *note\ndefaultfactory: 221d. function which returns an empty *note list: 3dc.\nThe 'list.append()' operation then attaches the value to the new list.",
            "subsections": []
        },
        "When keys are encountered again, the look-up proceeds normally": {
            "content": "(returning the list for that key) and the 'list.append()' operation adds\nanother value to the list.  This technique is simpler and faster than an\nequivalent technique using *note dict.setdefault(): ef0.:\n\n>>> d = {}\n>>> for k, v in s:\n...     d.setdefault(k, []).append(v)\n...\n>>> sorted(d.items())\n[('blue', [2, 4]), ('red', [1]), ('yellow', [1, 3])]\n\nSetting the *note defaultfactory: 221d. to *note int: 17e. makes the\n*note defaultdict: 1031. useful for counting (like a bag or multiset in\nother languages):\n\n>>> s = 'mississippi'\n>>> d = defaultdict(int)\n>>> for k in s:\n...     d[k] += 1\n...\n>>> sorted(d.items())\n[('i', 4), ('m', 1), ('p', 2), ('s', 4)]\n",
            "subsections": []
        },
        "When a letter is first encountered, it is missing from the mapping, so": {
            "content": "the *note defaultfactory: 221d. function calls *note int(): 17e. to\nsupply a default count of zero.  The increment operation then builds up\nthe count for each letter.\n\nThe function *note int(): 17e. which always returns zero is just a\nspecial case of constant functions.  A faster and more flexible way to\ncreate constant functions is to use a lambda function which can supply\nany constant value (not just zero):\n\n>>> def constantfactory(value):\n...     return lambda: value\n...\n>>> d = defaultdict(constantfactory('<missing>'))\n>>> d.update(name='John', action='ran')\n>>> '%(name)s %(action)s to %(object)s' % d\n'John ran to <missing>'\n\nSetting the *note defaultfactory: 221d. to *note set: 39d. makes the\n*note defaultdict: 1031. useful for building a dictionary of sets:\n\n>>> s = [('red', 1), ('blue', 2), ('red', 3), ('blue', 4), ('red', 1), ('blue', 4)]\n>>> d = defaultdict(set)\n>>> for k, v in s:\n...     d[k].add(v)\n...\n>>> sorted(d.items())\n[('blue', {2, 4}), ('red', {1, 3})]\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: namedtuple Factory Function for Tuples with Named Fields,  Next: OrderedDict objects,  Prev: defaultdict objects,  Up: collections -- Container datatypes": {
            "content": "5.8.4.8 'namedtuple()' Factory Function for Tuples with Named Fields\n....................................................................\n",
            "subsections": []
        },
        "Named tuples assign meaning to each position in a tuple and allow for": {
            "content": "more readable, self-documenting code.  They can be used wherever regular\ntuples are used, and they add the ability to access fields by name\ninstead of position index.\n\n-- Function: collections.namedtuple (typename, fieldnames, *,\nrename=False, defaults=None, module=None)\n\nReturns a new tuple subclass named 'typename'.  The new subclass is\nused to create tuple-like objects that have fields accessible by\nattribute lookup as well as being indexable and iterable.\nInstances of the subclass also have a helpful docstring (with\ntypename and fieldnames) and a helpful 'repr()' method which\nlists the tuple contents in a 'name=value' format.\n\nThe 'fieldnames' are a sequence of strings such as '['x', 'y']'.\nAlternatively, 'fieldnames' can be a single string with each\nfieldname separated by whitespace and/or commas, for example ''x\ny'' or ''x, y''.\n\nAny valid Python identifier may be used for a fieldname except for\nnames starting with an underscore.  Valid identifiers consist of\nletters, digits, and underscores but do not start with a digit or\nunderscore and cannot be a *note keyword: 7e. such as 'class',\n'for', 'return', 'global', 'pass', or 'raise'.\n\nIf 'rename' is true, invalid fieldnames are automatically replaced\nwith positional names.  For example, '['abc', 'def', 'ghi', 'abc']'\nis converted to '['abc', '1', 'ghi', '3']', eliminating the\nkeyword 'def' and the duplicate fieldname 'abc'.\n\n'defaults' can be 'None' or an *note iterable: 109d. of default\nvalues.  Since fields with a default value must come after any\nfields without a default, the 'defaults' are applied to the\nrightmost parameters.  For example, if the fieldnames are '['x',\n'y', 'z']' and the defaults are '(1, 2)', then 'x' will be a\nrequired argument, 'y' will default to '1', and 'z' will default to\n'2'.\n\nIf 'module' is defined, the 'module' attribute of the named\ntuple is set to that value.\n\nNamed tuple instances do not have per-instance dictionaries, so\nthey are lightweight and require no more memory than regular\ntuples.\n\nTo support pickling, the named tuple class should be assigned to a\nvariable that matches 'typename'.\n\nChanged in version 3.1: Added support for 'rename'.\n\nChanged in version 3.6: The 'verbose' and 'rename' parameters\nbecame *note keyword-only arguments: 8b8.\n\nChanged in version 3.6: Added the 'module' parameter.\n\nChanged in version 3.7: Removed the 'verbose' parameter and the\n'source' attribute.\n\nChanged in version 3.7: Added the 'defaults' parameter and the\n'fielddefaults' attribute.\n\n>>> # Basic example\n>>> Point = namedtuple('Point', ['x', 'y'])\n>>> p = Point(11, y=22)     # instantiate with positional or keyword arguments\n>>> p[0] + p[1]             # indexable like the plain tuple (11, 22)\n33\n>>> x, y = p                # unpack like a regular tuple\n>>> x, y\n(11, 22)\n>>> p.x + p.y               # fields also accessible by name\n33\n>>> p                       # readable repr with a name=value style\nPoint(x=11, y=22)\n",
            "subsections": []
        },
        "Named tuples are especially useful for assigning field names to result": {
            "content": "tuples returned by the *note csv: 27. or *note sqlite3: c9. modules:\n\nEmployeeRecord = namedtuple('EmployeeRecord', 'name, age, title, department, paygrade')\n\nimport csv\nfor emp in map(EmployeeRecord.make, csv.reader(open(\"employees.csv\", \"rb\"))):\nprint(emp.name, emp.title)\n\nimport sqlite3\nconn = sqlite3.connect('/companydata')\ncursor = conn.cursor()\ncursor.execute('SELECT name, age, title, department, paygrade FROM employees')\nfor emp in map(EmployeeRecord.make, cursor.fetchall()):\nprint(emp.name, emp.title)\n",
            "subsections": []
        },
        "In addition to the methods inherited from tuples, named tuples support": {
            "content": "three additional methods and two attributes.  To prevent conflicts with\nfield names, the method and attribute names start with an underscore.\n\n-- Method: classmethod somenamedtuple.make (iterable)\n\nClass method that makes a new instance from an existing sequence or\niterable.\n\n>>> t = [11, 22]\n>>> Point.make(t)\nPoint(x=11, y=22)\n\n-- Method: somenamedtuple.asdict ()\n\nReturn a new *note dict: 237. which maps field names to their\ncorresponding values:\n\n>>> p = Point(x=11, y=22)\n>>> p.asdict()\n{'x': 11, 'y': 22}\n\nChanged in version 3.1: Returns an *note OrderedDict: 39f. instead\nof a regular *note dict: 237.\n\nChanged in version 3.8: Returns a regular *note dict: 237. instead\nof an *note OrderedDict: 39f.  As of Python 3.7, regular dicts are\nguaranteed to be ordered.  If the extra features of *note\nOrderedDict: 39f. are required, the suggested remediation is to\ncast the result to the desired type: 'OrderedDict(nt.asdict())'.\n\n-- Method: somenamedtuple.replace (kwargs)\n\nReturn a new instance of the named tuple replacing specified fields\nwith new values:\n\n>>> p = Point(x=11, y=22)\n>>> p.replace(x=33)\nPoint(x=33, y=22)\n\n>>> for partnum, record in inventory.items():\n...     inventory[partnum] = record.replace(price=newprices[partnum], timestamp=time.now())\n\n-- Attribute: somenamedtuple.fields\n\nTuple of strings listing the field names.  Useful for introspection\nand for creating new named tuple types from existing named tuples.\n\n>>> p.fields            # view the field names\n('x', 'y')\n\n>>> Color = namedtuple('Color', 'red green blue')\n>>> Pixel = namedtuple('Pixel', Point.fields + Color.fields)\n>>> Pixel(11, 22, 128, 255, 0)\nPixel(x=11, y=22, red=128, green=255, blue=0)\n\n-- Attribute: somenamedtuple.fielddefaults\n\nDictionary mapping field names to default values.\n\n>>> Account = namedtuple('Account', ['type', 'balance'], defaults=[0])\n>>> Account.fielddefaults\n{'balance': 0}\n>>> Account('premium')\nAccount(type='premium', balance=0)\n\nTo retrieve a field whose name is stored in a string, use the *note\ngetattr(): a15. function:\n\n>>> getattr(p, 'x')\n11\n",
            "subsections": []
        },
        "To convert a dictionary to a named tuple, use the double-star-operator": {
            "content": "(as described in *note Unpacking Argument Lists: 19b4.):\n\n>>> d = {'x': 11, 'y': 22}\n>>> Point(d)\nPoint(x=11, y=22)\n",
            "subsections": []
        },
        "Since a named tuple is a regular Python class, it is easy to add or": {
            "content": "change functionality with a subclass.  Here is how to add a calculated\nfield and a fixed-width print format:\n\n>>> class Point(namedtuple('Point', ['x', 'y'])):\n...     slots = ()\n...     @property\n...     def hypot(self):\n...         return (self.x  2 + self.y  2)  0.5\n...     def str(self):\n...         return 'Point: x=%6.3f  y=%6.3f  hypot=%6.3f' % (self.x, self.y, self.hypot)\n\n>>> for p in Point(3, 4), Point(14, 5/7):\n...     print(p)\nPoint: x= 3.000  y= 4.000  hypot= 5.000\nPoint: x=14.000  y= 0.714  hypot=14.018\n",
            "subsections": []
        },
        "The subclass shown above sets 'slots' to an empty tuple.  This helps": {
            "content": "keep memory requirements low by preventing the creation of instance\ndictionaries.\n",
            "subsections": []
        },
        "Subclassing is not useful for adding new, stored fields.  Instead,": {
            "content": "simply create a new named tuple type from the *note fields: 2223.\nattribute:\n\n>>> Point3D = namedtuple('Point3D', Point.fields + ('z',))\n",
            "subsections": []
        },
        "Docstrings can be customized by making direct assignments to the": {
            "content": "'doc' fields:\n\n>>> Book = namedtuple('Book', ['id', 'title', 'authors'])\n>>> Book.doc += ': Hardcover book in active collection'\n>>> Book.id.doc = '13-digit ISBN'\n>>> Book.title.doc = 'Title of first printing'\n>>> Book.authors.doc = 'List of authors sorted by last name'\n\nChanged in version 3.5: Property docstrings became writeable.\n\nSee also\n........\n\n* See *note typing.NamedTuple: 1f9. for a way to add type hints for\nnamed tuples.  It also provides an elegant notation using the *note\nclass: 114c. keyword:\n\nclass Component(NamedTuple):\npartnumber: int\nweight: float\ndescription: Optional[str] = None\n\n* See *note types.SimpleNamespace(): 745. for a mutable namespace\nbased on an underlying dictionary instead of a tuple.\n\n* The *note dataclasses: 2d. module provides a decorator and\nfunctions for automatically adding generated special methods to\nuser-defined classes.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: OrderedDict objects,  Next: UserDict objects,  Prev: namedtuple Factory Function for Tuples with Named Fields,  Up: collections -- Container datatypes": {
            "content": "5.8.4.9 'OrderedDict' objects\n.............................\n",
            "subsections": []
        },
        "Ordered dictionaries are just like regular dictionaries but have some": {
            "content": "extra capabilities relating to ordering operations.  They have become\nless important now that the built-in *note dict: 237. class gained the\nability to remember insertion order (this new behavior became guaranteed\nin Python 3.7).\n\nSome differences from *note dict: 237. still remain:\n\n* The regular *note dict: 237. was designed to be very good at\nmapping operations.  Tracking insertion order was secondary.\n\n* The *note OrderedDict: 39f. was designed to be good at reordering\noperations.  Space efficiency, iteration speed, and the performance\nof update operations were secondary.\n\n* The *note OrderedDict: 39f. algorithm can handle frequent\nreordering operations better than *note dict: 237.  As shown in the\nrecipes below, this makes it suitable for implementing various\nkinds of LRU caches.\n\n* The equality operation for *note OrderedDict: 39f. checks for\nmatching order.\n\nA regular *note dict: 237. can emulate the order sensitive equality\ntest with 'p == q and all(k1 == k2 for k1, k2 in zip(p, q))'.\n\n* The 'popitem()' method of *note OrderedDict: 39f. has a different\nsignature.  It accepts an optional argument to specify which item\nis popped.\n\nA regular *note dict: 237. can emulate OrderedDict's\n'od.popitem(last=True)' with 'd.popitem()' which is guaranteed to\npop the rightmost (last) item.\n\nA regular *note dict: 237. can emulate OrderedDict's\n'od.popitem(last=False)' with '(k := next(iter(d)), d.pop(k))'\nwhich will return and remove the leftmost (first) item if it\nexists.\n\n* *note OrderedDict: 39f. has a 'movetoend()' method to efficiently\nreposition an element to an endpoint.\n\nA regular *note dict: 237. can emulate OrderedDict's\n'od.movetoend(k, last=True)' with 'd[k] = d.pop(k)' which will\nmove the key and its associated value to the rightmost (last)\nposition.\n\nA regular *note dict: 237. does not have an efficient equivalent\nfor OrderedDict's 'od.movetoend(k, last=False)' which moves the\nkey and its associated value to the leftmost (first) position.\n\n* Until Python 3.8, *note dict: 237. lacked a 'reversed()'\nmethod.\n\n-- Class: collections.OrderedDict ([items])\n\nReturn an instance of a *note dict: 237. subclass that has methods\nspecialized for rearranging dictionary order.\n\nNew in version 3.1.\n\n-- Method: popitem (last=True)\n\nThe *note popitem(): 1162. method for ordered dictionaries\nreturns and removes a (key, value) pair.  The pairs are\nreturned in LIFO order if 'last' is true or FIFO (first-in,\nfirst-out) order if false.\n\n-- Method: movetoend (key, last=True)\n\nMove an existing 'key' to either end of an ordered dictionary.\nThe item is moved to the right end if 'last' is true (the\ndefault) or to the beginning if 'last' is false.  Raises *note\nKeyError: 8cf. if the 'key' does not exist:\n\n>>> d = OrderedDict.fromkeys('abcde')\n>>> d.movetoend('b')\n>>> ''.join(d)\n'acdeb'\n>>> d.movetoend('b', last=False)\n>>> ''.join(d)\n'bacde'\n\nNew in version 3.2.\n",
            "subsections": []
        },
        "In addition to the usual mapping methods, ordered dictionaries also": {
            "content": "support reverse iteration using *note reversed(): 661.\n\nEquality tests between *note OrderedDict: 39f. objects are\norder-sensitive and are implemented as\n'list(od1.items())==list(od2.items())'.  Equality tests between *note\nOrderedDict: 39f. objects and other *note Mapping: 6e2. objects are\norder-insensitive like regular dictionaries.  This allows *note",
            "subsections": []
        },
        "OrderedDict: 39f. objects to be substituted anywhere a regular": {
            "content": "dictionary is used.\n\nChanged in version 3.5: The items, keys, and values *note views: 2226.\nof *note OrderedDict: 39f. now support reverse iteration using *note\nreversed(): 661.\n",
            "subsections": []
        },
        "Changed in version 3.6: With the acceptance of PEP 468(1), order is": {
            "content": "retained for keyword arguments passed to the *note OrderedDict: 39f.\nconstructor and its 'update()' method.\n\nChanged in version 3.9: Added merge ('|') and update ('|=') operators,\nspecified in PEP 584(2).\n\n* Menu:\n\n* OrderedDict Examples and Recipes::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0468/\n\n(2) https://peps.python.org/pep-0584/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: OrderedDict Examples and Recipes,  Up: OrderedDict objects": {
            "content": "5.8.4.10 'OrderedDict' Examples and Recipes\n...........................................\n",
            "subsections": []
        },
        "It is straightforward to create an ordered dictionary variant that": {
            "content": "remembers the order the keys were 'last' inserted.  If a new entry\noverwrites an existing entry, the original insertion position is changed\nand moved to the end:\n\nclass LastUpdatedOrderedDict(OrderedDict):\n'Store items in the order the keys were last added'\n\ndef setitem(self, key, value):\nsuper().setitem(key, value)\nself.movetoend(key)\n\nAn *note OrderedDict: 39f. would also be useful for implementing\nvariants of *note functools.lrucache(): 815.:\n\nfrom collections import OrderedDict\nfrom time import time\n\nclass TimeBoundedLRU:\n\"LRU Cache that invalidates and refreshes old entries.\"\n\ndef init(self, func, maxsize=128, maxage=30):\nself.cache = OrderedDict()      # { args : (timestamp, result)}\nself.func = func\nself.maxsize = maxsize\nself.maxage = maxage\n\ndef call(self, *args):\nif args in self.cache:\nself.cache.movetoend(args)\ntimestamp, result = self.cache[args]\nif time() - timestamp <= self.maxage:\nreturn result\nresult = self.func(*args)\nself.cache[args] = time(), result\nif len(self.cache) > self.maxsize:\nself.cache.popitem(0)\nreturn result\n\nclass MultiHitLRUCache:\n\"\"\" LRU cache that defers caching a result until\nit has been requested multiple times.\n\nTo avoid flushing the LRU cache with one-time requests,\nwe don't cache until a request has been made more than once.\n\n\"\"\"\n\ndef init(self, func, maxsize=128, maxrequests=4096, cacheafter=1):\nself.requests = OrderedDict()   # { uncachedkey : requestcount }\nself.cache = OrderedDict()      # { cachedkey : functionresult }\nself.func = func\nself.maxrequests = maxrequests  # max number of uncached requests\nself.maxsize = maxsize          # max number of stored return values\nself.cacheafter = cacheafter\n\ndef call(self, *args):\nif args in self.cache:\nself.cache.movetoend(args)\nreturn self.cache[args]\nresult = self.func(*args)\nself.requests[args] = self.requests.get(args, 0) + 1\nif self.requests[args] <= self.cacheafter:\nself.requests.movetoend(args)\nif len(self.requests) > self.maxrequests:\nself.requests.popitem(0)\nelse:\nself.requests.pop(args, None)\nself.cache[args] = result\nif len(self.cache) > self.maxsize:\nself.cache.popitem(0)\nreturn result\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: UserDict objects,  Next: UserList objects,  Prev: OrderedDict objects,  Up: collections -- Container datatypes": {
            "content": "5.8.4.11 'UserDict' objects\n...........................\n\nThe class, *note UserDict: 1702. acts as a wrapper around dictionary\nobjects.  The need for this class has been partially supplanted by the\nability to subclass directly from *note dict: 237.; however, this class\ncan be easier to work with because the underlying dictionary is\naccessible as an attribute.\n\n-- Class: collections.UserDict ([initialdata])\n\nClass that simulates a dictionary.  The instance's contents are\nkept in a regular dictionary, which is accessible via the *note\ndata: 2229. attribute of *note UserDict: 1702. instances.  If\n'initialdata' is provided, *note data: 2229. is initialized with\nits contents; note that a reference to 'initialdata' will not be\nkept, allowing it to be used for other purposes.\n\nIn addition to supporting the methods and operations of mappings,\n*note UserDict: 1702. instances provide the following attribute:\n\n-- Attribute: data\n\nA real dictionary used to store the contents of the *note\nUserDict: 1702. class.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: UserList objects,  Next: UserString objects,  Prev: UserDict objects,  Up: collections -- Container datatypes": {
            "content": "5.8.4.12 'UserList' objects\n...........................\n",
            "subsections": []
        },
        "This class acts as a wrapper around list objects.  It is a useful base": {
            "content": "class for your own list-like classes which can inherit from them and\noverride existing methods or add new ones.  In this way, one can add new\nbehaviors to lists.\n",
            "subsections": []
        },
        "The need for this class has been partially supplanted by the ability to": {
            "content": "subclass directly from *note list: 3dc.; however, this class can be\neasier to work with because the underlying list is accessible as an\nattribute.\n\n-- Class: collections.UserList ([list])\n\nClass that simulates a list.  The instance's contents are kept in a\nregular list, which is accessible via the *note data: 222b.\nattribute of *note UserList: 133e. instances.  The instance's\ncontents are initially set to a copy of 'list', defaulting to the\nempty list '[]'.  'list' can be any iterable, for example a real\nPython list or a *note UserList: 133e. object.\n\nIn addition to supporting the methods and operations of mutable\nsequences, *note UserList: 133e. instances provide the following\nattribute:\n\n-- Attribute: data\n\nA real *note list: 3dc. object used to store the contents of\nthe *note UserList: 133e. class.\n\n'Subclassing requirements:' Subclasses of *note UserList: 133e. are\nexpected to offer a constructor which can be called with either no\narguments or one argument.  List operations which return a new sequence\nattempt to create an instance of the actual implementation class.  To do\nso, it assumes that the constructor can be called with a single\nparameter, which is a sequence object used as a data source.\n",
            "subsections": []
        },
        "If a derived class does not wish to comply with this requirement, all of": {
            "content": "the special methods supported by this class will need to be overridden;\nplease consult the sources for information about the methods which need\nto be provided in that case.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: UserString objects,  Prev: UserList objects,  Up: collections -- Container datatypes": {
            "content": "5.8.4.13 'UserString' objects\n.............................\n\nThe class, *note UserString: c32. acts as a wrapper around string\nobjects.  The need for this class has been partially supplanted by the\nability to subclass directly from *note str: 157.; however, this class\ncan be easier to work with because the underlying string is accessible\nas an attribute.\n\n-- Class: collections.UserString (seq)\n\nClass that simulates a string object.  The instance's content is\nkept in a regular string object, which is accessible via the *note\ndata: 222d. attribute of *note UserString: c32. instances.  The\ninstance's contents are initially set to a copy of 'seq'.  The\n'seq' argument can be any object which can be converted into a\nstring using the built-in *note str(): 157. function.\n\nIn addition to supporting the methods and operations of strings,\n*note UserString: c32. instances provide the following attribute:\n\n-- Attribute: data\n\nA real *note str: 157. object used to store the contents of\nthe *note UserString: c32. class.\n\nChanged in version 3.5: New methods 'getnewargs', 'rmod',\n'casefold', 'formatmap', 'isprintable', and 'maketrans'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: collections abc -- Abstract Base Classes for Containers,  Next: heapq -- Heap queue algorithm,  Prev: collections -- Container datatypes,  Up: Data Types": {
            "content": "New in version 3.3: Formerly, this module was part of the *note\ncollections: 1b. module.\n\n'Source code:' Lib/collectionsabc.py(1)\n\n\n\nThis module provides *note abstract base classes: 102a. that can be used\nto test whether a class provides a particular interface; for example,\nwhether it is *note hashable: 3db. or whether it is a *note mapping:\n1030.\n\nAn *note issubclass(): 5b4. or *note isinstance(): 14b. test for an\ninterface works in one of three ways.\n\n1) A newly written class can inherit directly from one of the abstract\nbase classes.  The class must supply the required abstract methods.  The\nremaining mixin methods come from inheritance and can be overridden if\ndesired.  Other methods may be added as needed:\n\nclass C(Sequence):                      # Direct inheritance\ndef init(self): ...             # Extra method not required by the ABC\ndef getitem(self, index):  ...  # Required abstract method\ndef len(self):  ...             # Required abstract method\ndef count(self, value): ...         # Optionally override a mixin method\n\n>>> issubclass(C, Sequence)\nTrue\n>>> isinstance(C(), Sequence)\nTrue\n\n2) Existing classes and built-in classes can be registered as \"virtual\nsubclasses\" of the ABCs.  Those classes should define the full API\nincluding all of the abstract methods and all of the mixin methods.\nThis lets users rely on *note issubclass(): 5b4. or *note isinstance():\n14b. tests to determine whether the full interface is supported.  The\nexception to this rule is for methods that are automatically inferred\nfrom the rest of the API:\n\nclass D:                                 # No inheritance\ndef init(self): ...              # Extra method not required by the ABC\ndef getitem(self, index):  ...   # Abstract method\ndef len(self):  ...              # Abstract method\ndef count(self, value): ...          # Mixin method\ndef index(self, value): ...          # Mixin method\n\nSequence.register(D)                     # Register instead of inherit\n\n>>> issubclass(D, Sequence)\nTrue\n>>> isinstance(D(), Sequence)\nTrue\n",
            "subsections": []
        },
        "In this example, class 'D' does not need to define 'contains',": {
            "content": "'iter', and 'reversed' because the *note in-operator: 1d7f, the\n*note iteration: 109d. logic, and the *note reversed(): 661. function\nautomatically fall back to using 'getitem' and 'len'.\n\n3) Some simple interfaces are directly recognizable by the presence of\nthe required methods (unless those methods have been set to *note None:\n43f.):\n\nclass E:\ndef iter(self): ...\ndef next(self): ...\n\n>>> issubclass(E, Iterable)\nTrue\n>>> isinstance(E(), Iterable)\nTrue\n",
            "subsections": []
        },
        "Complex interfaces do not support this last technique because an": {
            "content": "interface is more than just the presence of method names.  Interfaces\nspecify semantics and relationships between methods that cannot be\ninferred solely from the presence of specific method names.  For\nexample, knowing that a class supplies 'getitem', 'len', and\n'iter' is insufficient for distinguishing a *note Sequence: 1038.\nfrom a *note Mapping: 6e2.\n\nNew in version 3.9: These abstract classes now support '[]'.  See *note\nGeneric Alias Type: 480. and PEP 585(2).\n\n* Menu:\n\n* Collections Abstract Base Classes::\n* Collections Abstract Base Classes - Detailed Descriptions::\n* Examples and Recipes::\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/collectionsabc.py\n\n(2) https://peps.python.org/pep-0585/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Collections Abstract Base Classes,  Next: Collections Abstract Base Classes - Detailed Descriptions,  Up: collections abc -- Abstract Base Classes for Containers": {
            "content": "5.8.5.1 Collections Abstract Base Classes\n.........................................\n\nThe collections module offers the following *note ABCs: 102a.:\n\nABC                                Inherits from              Abstract Methods            Mixin Methods\n\n---------------------------------------------------------------------------------------------------------------------------------------------------\n\n*note Container: 1f5d. (1)                                    'contains'\n\n\n*note Hashable: 23b. (2)                                      'hash'\n\n\n*note Iterable: 1f5b. (3) (4)                                 'iter'\n\n\n*note Iterator: 1f5c. (5)          *note Iterable: 1f5b.      'next'                  'iter'\n\n\n*note Reversible: ad6. (6)         *note Iterable: 1f5b.      'reversed'\n\n\n*note Generator: c38. (7)          *note Iterator: 1f5c.      'send', 'throw'             'close', 'iter', 'next'\n\n\n*note Sized: 23c. (8)                                         'len'\n\n\n*note Callable: 5de. (9)                                      'call'\n\n\n*note Collection: ad5. (10)        *note Sized: 23c,          'contains',\n*note Iterable: 1f5b,      'iter', 'len'\n*note Container: 1f5d.\n\n\n*note Sequence: 1038.              *note Reversible: ad6,     'getitem', 'len'    'contains', 'iter', 'reversed', 'index',\n*note Collection: ad5.                                 and 'count'\n\n\n*note MutableSequence: c31.        *note Sequence: 1038.      'getitem',              Inherited *note Sequence: 1038. methods and 'append',\n'setitem',              'clear', 'reverse', 'extend', 'pop', 'remove', and\n'delitem', 'len',   'iadd'\n'insert'\n\n\n*note ByteString: 221.             *note Sequence: 1038.      'getitem', 'len'    Inherited *note Sequence: 1038. methods\n\n\n*note Set: 1f53.                   *note Collection: ad5.     'contains',             'le', 'lt', 'eq', 'ne', 'gt',\n'iter', 'len'       'ge', 'and', 'or', 'sub', 'xor',\nand 'isdisjoint'\n\n\n*note MutableSet: 1f5e.            *note Set: 1f53.           'contains',             Inherited *note Set: 1f53. methods and 'clear', 'pop',\n'iter', 'len',      'remove', 'ior', 'iand', 'ixor', and\n'add', 'discard'            'isub'\n\n\n*note Mapping: 6e2.                *note Collection: ad5.     'getitem',              'contains', 'keys', 'items', 'values', 'get',\n'iter', 'len'       'eq', and 'ne'\n\n\n*note MutableMapping: f1e.         *note Mapping: 6e2.        'getitem',              Inherited *note Mapping: 6e2. methods and 'pop',\n'setitem',              'popitem', 'clear', 'update', and 'setdefault'\n'delitem',\n'iter', 'len'\n\n\n*note MappingView: 1f5f.           *note Sized: 23c.                                      'len'\n\n\n*note ItemsView: 1f61.             *note MappingView: 1f5f,                               'contains', 'iter'\n*note Set: 1f53.\n\n\n*note KeysView: 1f60.              *note MappingView: 1f5f,                               'contains', 'iter'\n*note Set: 1f53.\n\n\n*note ValuesView: 1f62.            *note MappingView: 1f5f,                               'contains', 'iter'\n*note Collection: ad5.\n\n\n*note Awaitable: c39. (11)                                    'await'\n\n\n*note Coroutine: c3a. (12)         *note Awaitable: c39.      'send', 'throw'             'close'\n\n\n*note AsyncIterable: c3c. (13)                                'aiter'\n\n\n*note AsyncIterator: c3b. (14)     *note AsyncIterable: c3c.  'anext'                 'aiter'\n\n\n*note AsyncGenerator: ad7. (15)    *note AsyncIterator: c3b.  'asend', 'athrow'           'aclose', 'aiter', 'anext'\n\n\n*note Buffer: 170. (16)                                       'buffer'\n\n\n---------- Footnotes ----------\n\n(1) These ABCs override *note subclasshook(): 2231. to support\ntesting an interface by verifying the required methods are present and\nhave not been set to *note None: 43f.  This only works for simple\ninterfaces.  More complex interfaces require registration or direct\nsubclassing.\n\n(2) These ABCs override *note subclasshook(): 2231. to support\ntesting an interface by verifying the required methods are present and\nhave not been set to *note None: 43f.  This only works for simple\ninterfaces.  More complex interfaces require registration or direct\nsubclassing.\n\n(3) These ABCs override *note subclasshook(): 2231. to support\ntesting an interface by verifying the required methods are present and\nhave not been set to *note None: 43f.  This only works for simple\ninterfaces.  More complex interfaces require registration or direct\nsubclassing.\n\n(4) Checking 'isinstance(obj, Iterable)' detects classes that are\nregistered as *note Iterable: 1f5b. or that have an *note iter():\n1a45. method, but it does not detect classes that iterate with the *note\ngetitem(): 4b9. method.  The only reliable way to determine whether\nan object is *note iterable: 109d. is to call 'iter(obj)'.\n\n(5) These ABCs override *note subclasshook(): 2231. to support\ntesting an interface by verifying the required methods are present and\nhave not been set to *note None: 43f.  This only works for simple\ninterfaces.  More complex interfaces require registration or direct\nsubclassing.\n\n(6) These ABCs override *note subclasshook(): 2231. to support\ntesting an interface by verifying the required methods are present and\nhave not been set to *note None: 43f.  This only works for simple\ninterfaces.  More complex interfaces require registration or direct\nsubclassing.\n\n(7) These ABCs override *note subclasshook(): 2231. to support\ntesting an interface by verifying the required methods are present and\nhave not been set to *note None: 43f.  This only works for simple\ninterfaces.  More complex interfaces require registration or direct\nsubclassing.\n\n(8) These ABCs override *note subclasshook(): 2231. to support\ntesting an interface by verifying the required methods are present and\nhave not been set to *note None: 43f.  This only works for simple\ninterfaces.  More complex interfaces require registration or direct\nsubclassing.\n\n(9) These ABCs override *note subclasshook(): 2231. to support\ntesting an interface by verifying the required methods are present and\nhave not been set to *note None: 43f.  This only works for simple\ninterfaces.  More complex interfaces require registration or direct\nsubclassing.\n\n(10) These ABCs override *note subclasshook(): 2231. to support\ntesting an interface by verifying the required methods are present and\nhave not been set to *note None: 43f.  This only works for simple\ninterfaces.  More complex interfaces require registration or direct\nsubclassing.\n\n(11) These ABCs override *note subclasshook(): 2231. to support\ntesting an interface by verifying the required methods are present and\nhave not been set to *note None: 43f.  This only works for simple\ninterfaces.  More complex interfaces require registration or direct\nsubclassing.\n\n(12) These ABCs override *note subclasshook(): 2231. to support\ntesting an interface by verifying the required methods are present and\nhave not been set to *note None: 43f.  This only works for simple\ninterfaces.  More complex interfaces require registration or direct\nsubclassing.\n\n(13) These ABCs override *note subclasshook(): 2231. to support\ntesting an interface by verifying the required methods are present and\nhave not been set to *note None: 43f.  This only works for simple\ninterfaces.  More complex interfaces require registration or direct\nsubclassing.\n\n(14) These ABCs override *note subclasshook(): 2231. to support\ntesting an interface by verifying the required methods are present and\nhave not been set to *note None: 43f.  This only works for simple\ninterfaces.  More complex interfaces require registration or direct\nsubclassing.\n\n(15) These ABCs override *note subclasshook(): 2231. to support\ntesting an interface by verifying the required methods are present and\nhave not been set to *note None: 43f.  This only works for simple\ninterfaces.  More complex interfaces require registration or direct\nsubclassing.\n\n(16) These ABCs override *note subclasshook(): 2231. to support\ntesting an interface by verifying the required methods are present and\nhave not been set to *note None: 43f.  This only works for simple\ninterfaces.  More complex interfaces require registration or direct\nsubclassing.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Collections Abstract Base Classes - Detailed Descriptions,  Next: Examples and Recipes,  Prev: Collections Abstract Base Classes,  Up: collections abc -- Abstract Base Classes for Containers": {
            "content": "5.8.5.2 Collections Abstract Base Classes - Detailed Descriptions\n.................................................................\n\n-- Class: collections.abc.Container\n\nABC for classes that provide the *note contains(): 1c63.\nmethod.\n\n-- Class: collections.abc.Hashable\n\nABC for classes that provide the *note hash(): 932. method.\n\n-- Class: collections.abc.Sized\n\nABC for classes that provide the *note len(): 1c68. method.\n\n-- Class: collections.abc.Callable\n\nABC for classes that provide the *note call(): 2b1. method.\n\n-- Class: collections.abc.Iterable\n\nABC for classes that provide the *note iter(): 1a45. method.\n\nChecking 'isinstance(obj, Iterable)' detects classes that are\nregistered as *note Iterable: 1f5b. or that have an *note\niter(): 1a45. method, but it does not detect classes that\niterate with the *note getitem(): 4b9. method.  The only\nreliable way to determine whether an object is *note iterable:\n109d. is to call 'iter(obj)'.\n\n-- Class: collections.abc.Collection\n\nABC for sized iterable container classes.\n\nNew in version 3.6.\n\n-- Class: collections.abc.Iterator\n\nABC for classes that provide the *note iter(): 1a48. and *note\nnext(): 1141. methods.  See also the definition of *note\niterator: 16a9.\n\n-- Class: collections.abc.Reversible\n\nABC for iterable classes that also provide the *note\nreversed(): 1c62. method.\n\nNew in version 3.6.\n\n-- Class: collections.abc.Generator\n\nABC for *note generator: eda. classes that implement the protocol\ndefined in PEP 342(1) that extends *note iterators: 16a9. with the\n*note send(): 1cd3, *note throw(): 241. and *note close(): 1517.\nmethods.\n\nNew in version 3.5.\n\n-- Class: collections.abc.Sequence\n-- Class: collections.abc.MutableSequence\n-- Class: collections.abc.ByteString\n\nABCs for read-only and mutable *note sequences: 236.\n\nImplementation note: Some of the mixin methods, such as *note\niter(): 1a45, *note reversed(): 1c62. and 'index()', make\nrepeated calls to the underlying *note getitem(): 4b9. method.\nConsequently, if *note getitem(): 4b9. is implemented with\nconstant access speed, the mixin methods will have linear\nperformance; however, if the underlying method is linear (as it\nwould be with a linked list), the mixins will have quadratic\nperformance and will likely need to be overridden.\n\nChanged in version 3.5: The index() method added support for 'stop'\nand 'start' arguments.\n\nDeprecated since version 3.12, will be removed in version 3.14: The\n*note ByteString: 221. ABC has been deprecated.  For use in typing,\nprefer a union, like 'bytes | bytearray', or *note\ncollections.abc.Buffer: 170.  For use as an ABC, prefer *note\nSequence: 1038. or *note collections.abc.Buffer: 170.\n\n-- Class: collections.abc.Set\n-- Class: collections.abc.MutableSet\n\nABCs for read-only and mutable *note sets: 1e7c.\n\n-- Class: collections.abc.Mapping\n-- Class: collections.abc.MutableMapping\n\nABCs for read-only and mutable *note mappings: 1030.\n\n-- Class: collections.abc.MappingView\n-- Class: collections.abc.ItemsView\n-- Class: collections.abc.KeysView\n-- Class: collections.abc.ValuesView\n\nABCs for mapping, items, keys, and values *note views: 2226.\n\n-- Class: collections.abc.Awaitable\n\nABC for *note awaitable: ac3. objects, which can be used in *note\nawait: 516. expressions.  Custom implementations must provide the\n*note await(): 1cce. method.\n\n*note Coroutine: 1ae. objects and instances of the *note Coroutine:\nc3a. ABC are all instances of this ABC.\n\nNote: In CPython, generator-based coroutines (*note\ngenerators: eda. decorated with *note @types.coroutine: ced.)\nare 'awaitables', even though they do not have an *note\nawait(): 1cce. method.  Using 'isinstance(gencoro,\nAwaitable)' for them will return 'False'.  Use *note\ninspect.isawaitable(): c76. to detect them.\n\nNew in version 3.5.\n\n-- Class: collections.abc.Coroutine\n\nABC for *note coroutine: 1ae. compatible classes.  These implement\nthe following methods, defined in *note Coroutine Objects: 1c28.:\n*note send(): 1cd2, *note throw(): 240, and *note close(): 1cd4.\nCustom implementations must also implement *note await(): 1cce.\nAll *note Coroutine: c3a. instances are also instances of *note\nAwaitable: c39.\n\nNote: In CPython, generator-based coroutines (*note\ngenerators: eda. decorated with *note @types.coroutine: ced.)\nare 'awaitables', even though they do not have an *note\nawait(): 1cce. method.  Using 'isinstance(gencoro,\nCoroutine)' for them will return 'False'.  Use *note\ninspect.isawaitable(): c76. to detect them.\n\nNew in version 3.5.\n\n-- Class: collections.abc.AsyncIterable\n\nABC for classes that provide an 'aiter' method.  See also the\ndefinition of *note asynchronous iterable: bd2.\n\nNew in version 3.5.\n\n-- Class: collections.abc.AsyncIterator\n\nABC for classes that provide 'aiter' and 'anext' methods.\nSee also the definition of *note asynchronous iterator: bd4.\n\nNew in version 3.5.\n\n-- Class: collections.abc.AsyncGenerator\n\nABC for *note asynchronous generator: 1d47. classes that implement\nthe protocol defined in PEP 525(2) and PEP 492(3).\n\nNew in version 3.6.\n\n-- Class: collections.abc.Buffer\n\nABC for classes that provide the *note buffer(): 16f. method,\nimplementing the *note buffer protocol: 148.  See PEP 688(4).\n\nNew in version 3.12.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0342/\n\n(2) https://peps.python.org/pep-0525/\n\n(3) https://peps.python.org/pep-0492/\n\n(4) https://peps.python.org/pep-0688/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Examples and Recipes,  Prev: Collections Abstract Base Classes - Detailed Descriptions,  Up: collections abc -- Abstract Base Classes for Containers": {
            "content": "5.8.5.3 Examples and Recipes\n............................\n\nABCs allow us to ask classes or instances if they provide particular\nfunctionality, for example:\n\nsize = None\nif isinstance(myvar, collections.abc.Sized):\nsize = len(myvar)\n",
            "subsections": []
        },
        "Several of the ABCs are also useful as mixins that make it easier to": {
            "content": "develop classes supporting container APIs.  For example, to write a\nclass supporting the full *note Set: 1f53. API, it is only necessary to\nsupply the three underlying abstract methods: *note contains():\n1c63, *note iter(): 1a45, and *note len(): 1c68.  The ABC\nsupplies the remaining methods such as 'and()' and *note\nisdisjoint(): 1f3f.:\n\nclass ListBasedSet(collections.abc.Set):\n''' Alternate set implementation favoring space over speed\nand not requiring the set elements to be hashable. '''\ndef init(self, iterable):\nself.elements = lst = []\nfor value in iterable:\nif value not in lst:\nlst.append(value)\n\ndef iter(self):\nreturn iter(self.elements)\n\ndef contains(self, value):\nreturn value in self.elements\n\ndef len(self):\nreturn len(self.elements)\n\ns1 = ListBasedSet('abcdef')\ns2 = ListBasedSet('defghi')\noverlap = s1 & s2            # The and() method is supported automatically\n\nNotes on using *note Set: 1f53. and *note MutableSet: 1f5e. as a mixin:\n\n1. Since some set operations create new sets, the default mixin\nmethods need a way to create new instances from an *note iterable:\n109d.  The class constructor is assumed to have a signature in the\nform 'ClassName(iterable)'.  That assumption is factored-out to an\ninternal *note classmethod: 246. called 'fromiterable()' which\ncalls 'cls(iterable)' to produce a new set.  If the *note Set:\n1f53. mixin is being used in a class with a different constructor\nsignature, you will need to override 'fromiterable()' with a\nclassmethod or regular method that can construct new instances from\nan iterable argument.\n\n2. To override the comparisons (presumably for speed, as the semantics\nare fixed), redefine *note le(): 1181. and *note ge():\n1183, then the other operations will automatically follow suit.\n\n3. The *note Set: 1f53. mixin provides a 'hash()' method to compute a\nhash value for the set; however, *note hash(): 932. is not\ndefined because not all sets are *note hashable: 3db. or immutable.\nTo add set hashability using mixins, inherit from both *note Set():\n1f53. and *note Hashable(): 23b, then define 'hash =\nSet.hash'.\n\nSee also\n........\n\n* OrderedSet recipe(1) for an example built on *note MutableSet:\n1f5e.\n\n* For more about ABCs, see the *note abc: 4. module and PEP 3119(2).\n\n---------- Footnotes ----------\n\n(1) https://code.activestate.com/recipes/576694/\n\n(2) https://peps.python.org/pep-3119/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: heapq -- Heap queue algorithm,  Next: bisect -- Array bisection algorithm,  Prev: collections abc -- Abstract Base Classes for Containers,  Up: Data Types": {
            "content": "'Source code:' Lib/heapq.py(1)\n\n\n",
            "subsections": []
        },
        "This module provides an implementation of the heap queue algorithm, also": {
            "content": "known as the priority queue algorithm.\n",
            "subsections": []
        },
        "Heaps are binary trees for which every parent node has a value less than": {
            "content": "or equal to any of its children.  This implementation uses arrays for\nwhich 'heap[k] <= heap[2*k+1]' and 'heap[k] <= heap[2*k+2]' for all 'k',\ncounting elements from zero.  For the sake of comparison, non-existing\nelements are considered to be infinite.  The interesting property of a\nheap is that its smallest element is always the root, 'heap[0]'.\n",
            "subsections": []
        },
        "The API below differs from textbook heap algorithms in two aspects: (a)": {
            "content": "",
            "subsections": []
        },
        "We use zero-based indexing.  This makes the relationship between the": {
            "content": "index for a node and the indexes for its children slightly less obvious,\nbut is more suitable since Python uses zero-based indexing.  (b) Our pop\nmethod returns the smallest item, not the largest (called a \"min heap\"\nin textbooks; a \"max heap\" is more common in texts because of its\nsuitability for in-place sorting).\n",
            "subsections": []
        },
        "These two make it possible to view the heap as a regular Python list": {
            "content": "without surprises: 'heap[0]' is the smallest item, and 'heap.sort()'\nmaintains the heap invariant!\n\nTo create a heap, use a list initialized to '[]', or you can transform a\npopulated list into a heap via function *note heapify(): 2236.\n\nThe following functions are provided:\n\n-- Function: heapq.heappush (heap, item)\n\nPush the value 'item' onto the 'heap', maintaining the heap\ninvariant.\n\n-- Function: heapq.heappop (heap)\n\nPop and return the smallest item from the 'heap', maintaining the\nheap invariant.  If the heap is empty, *note IndexError: 138f. is\nraised.  To access the smallest item without popping it, use\n'heap[0]'.\n\n-- Function: heapq.heappushpop (heap, item)\n\nPush 'item' on the heap, then pop and return the smallest item from\nthe 'heap'.  The combined action runs more efficiently than *note\nheappush(): 1313. followed by a separate call to *note heappop():\n1314.\n\n-- Function: heapq.heapify (x)\n\nTransform list 'x' into a heap, in-place, in linear time.\n\n-- Function: heapq.heapreplace (heap, item)\n\nPop and return the smallest item from the 'heap', and also push the\nnew 'item'.  The heap size doesn't change.  If the heap is empty,\n*note IndexError: 138f. is raised.\n\nThis one step operation is more efficient than a *note heappop():\n1314. followed by *note heappush(): 1313. and can be more\nappropriate when using a fixed-size heap.  The pop/push combination\nalways returns an element from the heap and replaces it with\n'item'.\n\nThe value returned may be larger than the 'item' added.  If that\nisn't desired, consider using *note heappushpop(): 2237. instead.\nIts push/pop combination returns the smaller of the two values,\nleaving the larger value on the heap.\n\nThe module also offers three general purpose functions based on heaps.\n\n-- Function: heapq.merge (*iterables, key=None, reverse=False)\n\nMerge multiple sorted inputs into a single sorted output (for\nexample, merge timestamped entries from multiple log files).\nReturns an *note iterator: 16a9. over the sorted values.\n\nSimilar to 'sorted(itertools.chain(*iterables))' but returns an\niterable, does not pull the data into memory all at once, and\nassumes that each of the input streams is already sorted (smallest\nto largest).\n\nHas two optional arguments which must be specified as keyword\narguments.\n\n'key' specifies a *note key function: c62. of one argument that is\nused to extract a comparison key from each input element.  The\ndefault value is 'None' (compare the elements directly).\n\n'reverse' is a boolean value.  If set to 'True', then the input\nelements are merged as if each comparison were reversed.  To\nachieve behavior similar to 'sorted(itertools.chain(*iterables),\nreverse=True)', all iterables must be sorted from largest to\nsmallest.\n\nChanged in version 3.5: Added the optional 'key' and 'reverse'\nparameters.\n\n-- Function: heapq.nlargest (n, iterable, key=None)\n\nReturn a list with the 'n' largest elements from the dataset\ndefined by 'iterable'.  'key', if provided, specifies a function of\none argument that is used to extract a comparison key from each\nelement in 'iterable' (for example, 'key=str.lower').  Equivalent\nto: 'sorted(iterable, key=key, reverse=True)[:n]'.\n\n-- Function: heapq.nsmallest (n, iterable, key=None)\n\nReturn a list with the 'n' smallest elements from the dataset\ndefined by 'iterable'.  'key', if provided, specifies a function of\none argument that is used to extract a comparison key from each\nelement in 'iterable' (for example, 'key=str.lower').  Equivalent\nto: 'sorted(iterable, key=key)[:n]'.\n",
            "subsections": []
        },
        "The latter two functions perform best for smaller values of 'n'.  For": {
            "content": "larger values, it is more efficient to use the *note sorted(): a12.\nfunction.  Also, when 'n==1', it is more efficient to use the built-in\n*note min(): d6f. and *note max(): d70. functions.  If repeated usage of\nthese functions is required, consider turning the iterable into an\nactual heap.\n\n* Menu:\n\n* Basic Examples::\n* Priority Queue Implementation Notes::\n* Theory::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/heapq.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Basic Examples,  Next: Priority Queue Implementation Notes,  Up: heapq -- Heap queue algorithm": {
            "content": "5.8.6.1 Basic Examples\n......................\n\nA heapsort(1) can be implemented by pushing all values onto a heap and\nthen popping off the smallest values one at a time:\n\n>>> def heapsort(iterable):\n...     h = []\n...     for value in iterable:\n...         heappush(h, value)\n...     return [heappop(h) for i in range(len(h))]\n...\n>>> heapsort([1, 3, 5, 7, 9, 2, 4, 6, 8, 0])\n[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n\nThis is similar to 'sorted(iterable)', but unlike *note sorted(): a12,\nthis implementation is not stable.\n",
            "subsections": []
        },
        "Heap elements can be tuples.  This is useful for assigning comparison": {
            "content": "values (such as task priorities) alongside the main record being\ntracked:\n\n>>> h = []\n>>> heappush(h, (5, 'write code'))\n>>> heappush(h, (7, 'release product'))\n>>> heappush(h, (1, 'write spec'))\n>>> heappush(h, (3, 'create tests'))\n>>> heappop(h)\n(1, 'write spec')\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Heapsort\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Priority Queue Implementation Notes,  Next: Theory,  Prev: Basic Examples,  Up: heapq -- Heap queue algorithm": {
            "content": "5.8.6.2 Priority Queue Implementation Notes\n...........................................\n\nA priority queue(1) is common use for a heap, and it presents several\nimplementation challenges:\n\n* Sort stability: how do you get two tasks with equal priorities to\nbe returned in the order they were originally added?\n\n* Tuple comparison breaks for (priority, task) pairs if the\npriorities are equal and the tasks do not have a default comparison\norder.\n\n* If the priority of a task changes, how do you move it to a new\nposition in the heap?\n\n* Or if a pending task needs to be deleted, how do you find it and\nremove it from the queue?\n\nA solution to the first two challenges is to store entries as 3-element\nlist including the priority, an entry count, and the task.  The entry\ncount serves as a tie-breaker so that two tasks with the same priority\nare returned in the order they were added.  And since no two entry\ncounts are the same, the tuple comparison will never attempt to directly\ncompare two tasks.\n",
            "subsections": []
        },
        "Another solution to the problem of non-comparable tasks is to create a": {
            "content": "wrapper class that ignores the task item and only compares the priority\nfield:\n\nfrom dataclasses import dataclass, field\nfrom typing import Any\n\n@dataclass(order=True)\nclass PrioritizedItem:\npriority: int\nitem: Any=field(compare=False)\n",
            "subsections": []
        },
        "The remaining challenges revolve around finding a pending task and": {
            "content": "making changes to its priority or removing it entirely.  Finding a task\ncan be done with a dictionary pointing to an entry in the queue.\n",
            "subsections": []
        },
        "Removing the entry or changing its priority is more difficult because it": {
            "content": "would break the heap structure invariants.  So, a possible solution is\nto mark the entry as removed and add a new entry with the revised\npriority:\n\npq = []                         # list of entries arranged in a heap\nentryfinder = {}               # mapping of tasks to entries\nREMOVED = '<removed-task>'      # placeholder for a removed task\ncounter = itertools.count()     # unique sequence count\n\ndef addtask(task, priority=0):\n'Add a new task or update the priority of an existing task'\nif task in entryfinder:\nremovetask(task)\ncount = next(counter)\nentry = [priority, count, task]\nentryfinder[task] = entry\nheappush(pq, entry)\n\ndef removetask(task):\n'Mark an existing task as REMOVED.  Raise KeyError if not found.'\nentry = entryfinder.pop(task)\nentry[-1] = REMOVED\n\ndef poptask():\n'Remove and return the lowest priority task. Raise KeyError if empty.'\nwhile pq:\npriority, count, task = heappop(pq)\nif task is not REMOVED:\ndel entryfinder[task]\nreturn task\nraise KeyError('pop from an empty priority queue')\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Priorityqueue\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Theory,  Prev: Priority Queue Implementation Notes,  Up: heapq -- Heap queue algorithm": {
            "content": "5.8.6.3 Theory\n..............\n\nHeaps are arrays for which 'a[k] <= a[2*k+1]' and 'a[k] <= a[2*k+2]' for\nall 'k', counting elements from 0.  For the sake of comparison,\nnon-existing elements are considered to be infinite.  The interesting\nproperty of a heap is that 'a[0]' is always its smallest element.\n",
            "subsections": []
        },
        "The strange invariant above is meant to be an efficient memory": {
            "content": "representation for a tournament.  The numbers below are 'k', not 'a[k]':\n\n0\n\n1                                 2\n\n3               4                5               6\n\n7       8       9       10      11      12      13      14\n\n15 16   17 18   19 20   21 22   23 24   25 26   27 28   29 30\n\nIn the tree above, each cell 'k' is topping '2*k+1' and '2*k+2'.  In a\nusual binary tournament we see in sports, each cell is the winner over\nthe two cells it tops, and we can trace the winner down the tree to see\nall opponents s/he had.  However, in many computer applications of such\ntournaments, we do not need to trace the history of a winner.  To be\nmore memory efficient, when a winner is promoted, we try to replace it\nby something else at a lower level, and the rule becomes that a cell and\nthe two cells it tops contain three different items, but the top cell\n\"wins\" over the two topped cells.\n",
            "subsections": []
        },
        "If this heap invariant is protected at all time, index 0 is clearly the": {
            "content": "overall winner.  The simplest algorithmic way to remove it and find the\n\"next\" winner is to move some loser (let's say cell 30 in the diagram\nabove) into the 0 position, and then percolate this new 0 down the tree,\nexchanging values, until the invariant is re-established.  This is\nclearly logarithmic on the total number of items in the tree.  By\niterating over all items, you get an 'O'('n' log 'n') sort.\n\nA nice feature of this sort is that you can efficiently insert new items\nwhile the sort is going on, provided that the inserted items are not\n\"better\" than the last 0'th element you extracted.  This is especially\nuseful in simulation contexts, where the tree holds all incoming events,\nand the \"win\" condition means the smallest scheduled time.  When an\nevent schedules other events for execution, they are scheduled into the\nfuture, so they can easily go into the heap.  So, a heap is a good\nstructure for implementing schedulers (this is what I used for my MIDI\nsequencer :-).\n",
            "subsections": []
        },
        "Various structures for implementing schedulers have been extensively": {
            "content": "studied, and heaps are good for this, as they are reasonably speedy, the\nspeed is almost constant, and the worst case is not much different than\nthe average case.  However, there are other representations which are\nmore efficient overall, yet the worst cases might be terrible.\n",
            "subsections": []
        },
        "Heaps are also very useful in big disk sorts.  You most probably all": {
            "content": "know that a big sort implies producing \"runs\" (which are pre-sorted\nsequences, whose size is usually related to the amount of CPU memory),\nfollowed by a merging passes for these runs, which merging is often very\ncleverly organised (1).  It is very important that the initial sort\nproduces the longest runs possible.  Tournaments are a good way to\nachieve that.  If, using all the memory available to hold a tournament,\nyou replace and percolate items that happen to fit the current run,\nyou'll produce runs which are twice the size of the memory for random\ninput, and much better for input fuzzily ordered.\n",
            "subsections": []
        },
        "Moreover, if you output the 0'th item on disk and get an input which may": {
            "content": "not fit in the current tournament (because the value \"wins\" over the\nlast output value), it cannot fit in the heap, so the size of the heap\ndecreases.  The freed memory could be cleverly reused immediately for\nprogressively building a second heap, which grows at exactly the same\nrate the first heap is melting.  When the first heap completely\nvanishes, you switch heaps and start a new run.  Clever and quite\neffective!\n",
            "subsections": []
        },
        "In a word, heaps are useful memory structures to know.  I use them in a": {
            "content": "few applications, and I think it is good to keep a 'heap' module around.\n:-)\n\n---------- Footnotes ----------\n\n(1) The disk balancing algorithms which are current, nowadays, are\nmore annoying than clever, and this is a consequence of the seeking\ncapabilities of the disks.  On devices which cannot seek, like big tape\ndrives, the story was quite different, and one had to be very clever to\nensure (far in advance) that each tape movement will be the most\neffective possible (that is, will best participate at \"progressing\" the\nmerge).  Some tapes were even able to read backwards, and this was also\nused to avoid the rewinding time.  Believe me, real good tape sorts were\nquite spectacular to watch!  From all times, sorting has always been a\nGreat Art!  :-)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: bisect -- Array bisection algorithm,  Next: array -- Efficient arrays of numeric values,  Prev: heapq -- Heap queue algorithm,  Up: Data Types": {
            "content": "'Source code:' Lib/bisect.py(1)\n\n\n",
            "subsections": []
        },
        "This module provides support for maintaining a list in sorted order": {
            "content": "without having to sort the list after each insertion.  For long lists of\nitems with expensive comparison operations, this can be an improvement\nover linear searches or frequent resorting.\n\nThe module is called *note bisect: f. because it uses a basic bisection\nalgorithm to do its work.  Unlike other bisection tools that search for\na specific value, the functions in this module are designed to locate an\ninsertion point.  Accordingly, the functions never call an *note\neq(): 931. method to determine whether a value has been found.\nInstead, the functions only call the *note lt(): 1180. method and\nwill return an insertion point between values in an array.  The\nfollowing functions are provided:\n\n-- Function: bisect.bisectleft (a, x, lo=0, hi=len(a), *, key=None)\n\nLocate the insertion point for 'x' in 'a' to maintain sorted order.\nThe parameters 'lo' and 'hi' may be used to specify a subset of the\nlist which should be considered; by default the entire list is\nused.  If 'x' is already present in 'a', the insertion point will\nbe before (to the left of) any existing entries.  The return value\nis suitable for use as the first parameter to 'list.insert()'\nassuming that 'a' is already sorted.\n\nThe returned insertion point 'ip' partitions the array 'a' into two\nslices such that 'all(elem < x for elem in a[lo : ip])' is true for\nthe left slice and 'all(elem >= x for elem in a[ip : hi])' is true\nfor the right slice.\n\n'key' specifies a *note key function: c62. of one argument that is\nused to extract a comparison key from each element in the array.\nTo support searching complex records, the key function is not\napplied to the 'x' value.\n\nIf 'key' is 'None', the elements are compared directly and no key\nfunction is called.\n\nChanged in version 3.10: Added the 'key' parameter.\n\n-- Function: bisect.bisectright (a, x, lo=0, hi=len(a), *, key=None)\n-- Function: bisect.bisect (a, x, lo=0, hi=len(a), *, key=None)\n\nSimilar to *note bisectleft(): 2241, but returns an insertion\npoint which comes after (to the right of) any existing entries of\n'x' in 'a'.\n\nThe returned insertion point 'ip' partitions the array 'a' into two\nslices such that 'all(elem <= x for elem in a[lo : ip])' is true\nfor the left slice and 'all(elem > x for elem in a[ip : hi])' is\ntrue for the right slice.\n\nChanged in version 3.10: Added the 'key' parameter.\n\n-- Function: bisect.insortleft (a, x, lo=0, hi=len(a), *, key=None)\n\nInsert 'x' in 'a' in sorted order.\n\nThis function first runs *note bisectleft(): 2241. to locate an\ninsertion point.  Next, it runs the 'insert()' method on 'a' to\ninsert 'x' at the appropriate position to maintain sort order.\n\nTo support inserting records in a table, the 'key' function (if\nany) is applied to 'x' for the search step but not for the\ninsertion step.\n\nKeep in mind that the 'O'(log 'n') search is dominated by the slow\n'O'('n') insertion step.\n\nChanged in version 3.10: Added the 'key' parameter.\n\n-- Function: bisect.insortright (a, x, lo=0, hi=len(a), *, key=None)\n-- Function: bisect.insort (a, x, lo=0, hi=len(a), *, key=None)\n\nSimilar to *note insortleft(): 2244, but inserting 'x' in 'a'\nafter any existing entries of 'x'.\n\nThis function first runs *note bisectright(): 2242. to locate an\ninsertion point.  Next, it runs the 'insert()' method on 'a' to\ninsert 'x' at the appropriate position to maintain sort order.\n\nTo support inserting records in a table, the 'key' function (if\nany) is applied to 'x' for the search step but not for the\ninsertion step.\n\nKeep in mind that the 'O'(log 'n') search is dominated by the slow\n'O'('n') insertion step.\n\nChanged in version 3.10: Added the 'key' parameter.\n\n* Menu:\n\n* Performance Notes::\n* Searching Sorted Lists::\n* Examples: Examples<3>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/bisect.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Performance Notes,  Next: Searching Sorted Lists,  Up: bisect -- Array bisection algorithm": {
            "content": "5.8.7.1 Performance Notes\n.........................\n",
            "subsections": []
        },
        "When writing time sensitive code using 'bisect()' and 'insort()', keep": {
            "content": "these thoughts in mind:\n\n* Bisection is effective for searching ranges of values.  For\nlocating specific values, dictionaries are more performant.\n\n* The 'insort()' functions are 'O'('n') because the logarithmic\nsearch step is dominated by the linear time insertion step.\n\n* The search functions are stateless and discard key function results\nafter they are used.  Consequently, if the search functions are\nused in a loop, the key function may be called again and again on\nthe same array elements.  If the key function isn't fast, consider\nwrapping it with *note functools.cache(): 2248. to avoid duplicate\ncomputations.  Alternatively, consider searching an array of\nprecomputed keys to locate the insertion point (as shown in the\nexamples section below).\n\nSee also\n........\n\n* Sorted Collections(1) is a high performance module that uses\n'bisect' to managed sorted collections of data.\n\n* The SortedCollection recipe(2) uses bisect to build a full-featured\ncollection class with straight-forward search methods and support\nfor a key-function.  The keys are precomputed to save unnecessary\ncalls to the key function during searches.\n\n---------- Footnotes ----------\n\n(1) https://grantjenks.com/docs/sortedcollections/\n\n(2) https://code.activestate.com/recipes/577197-sortedcollection/\n\nFile: python3.12.info,  Node: Searching Sorted Lists,  Next: Examples<3>,  Prev: Performance Notes,  Up: bisect -- Array bisection algorithm\n\n5.8.7.2 Searching Sorted Lists\n..............................\n\nThe above *note bisect functions: 2240. are useful for finding insertion\npoints but can be tricky or awkward to use for common searching tasks.",
            "subsections": []
        },
        "The following five functions show how to transform them into the": {
            "content": "standard lookups for sorted lists:\n\ndef index(a, x):\n'Locate the leftmost value exactly equal to x'\ni = bisectleft(a, x)\nif i != len(a) and a[i] == x:\nreturn i\nraise ValueError\n\ndef findlt(a, x):\n'Find rightmost value less than x'\ni = bisectleft(a, x)\nif i:\nreturn a[i-1]\nraise ValueError\n\ndef findle(a, x):\n'Find rightmost value less than or equal to x'\ni = bisectright(a, x)\nif i:\nreturn a[i-1]\nraise ValueError\n\ndef findgt(a, x):\n'Find leftmost value greater than x'\ni = bisectright(a, x)\nif i != len(a):\nreturn a[i]\nraise ValueError\n\ndef findge(a, x):\n'Find leftmost item greater than or equal to x'\ni = bisectleft(a, x)\nif i != len(a):\nreturn a[i]\nraise ValueError\n\nFile: python3.12.info,  Node: Examples<3>,  Prev: Searching Sorted Lists,  Up: bisect -- Array bisection algorithm\n\n5.8.7.3 Examples\n................\n\nThe *note bisect(): 2243. function can be useful for numeric table\nlookups.  This example uses *note bisect(): 2243. to look up a letter\ngrade for an exam score (say) based on a set of ordered numeric\nbreakpoints: 90 and up is an 'A', 80 to 89 is a 'B', and so on:\n\n>>> def grade(score, breakpoints=[60, 70, 80, 90], grades='FDCBA'):\n...     i = bisect(breakpoints, score)\n...     return grades[i]\n...\n>>> [grade(score) for score in [33, 99, 77, 70, 89, 90, 100]]\n['F', 'A', 'C', 'C', 'B', 'A', 'A']\n\nThe *note bisect(): 2243. and *note insort(): 2246. functions also work\nwith lists of tuples.  The 'key' argument can serve to extract the field\nused for ordering records in a table:\n\n>>> from collections import namedtuple\n>>> from operator import attrgetter\n>>> from bisect import bisect, insort\n>>> from pprint import pprint\n\n>>> Movie = namedtuple('Movie', ('name', 'released', 'director'))\n\n>>> movies = [\n...     Movie('Jaws', 1975, 'Spielberg'),\n...     Movie('Titanic', 1997, 'Cameron'),\n...     Movie('The Birds', 1963, 'Hitchcock'),\n...     Movie('Aliens', 1986, 'Cameron')\n... ]\n\n>>> # Find the first movie released after 1960\n>>> byyear = attrgetter('released')\n>>> movies.sort(key=byyear)\n>>> movies[bisect(movies, 1960, key=byyear)]\nMovie(name='The Birds', released=1963, director='Hitchcock')\n\n>>> # Insert a movie while maintaining sort order\n>>> romance = Movie('Love Story', 1970, 'Hiller')\n>>> insort(movies, romance, key=byyear)\n>>> pprint(movies)\n[Movie(name='The Birds', released=1963, director='Hitchcock'),\nMovie(name='Love Story', released=1970, director='Hiller'),\nMovie(name='Jaws', released=1975, director='Spielberg'),\nMovie(name='Aliens', released=1986, director='Cameron'),\nMovie(name='Titanic', released=1997, director='Cameron')]\n",
            "subsections": []
        },
        "If the key function is expensive, it is possible to avoid repeated": {
            "content": "function calls by searching a list of precomputed keys to find the index\nof a record:\n\n>>> data = [('red', 5), ('blue', 1), ('yellow', 8), ('black', 0)]\n>>> data.sort(key=lambda r: r[1])       # Or use operator.itemgetter(1).\n>>> keys = [r[1] for r in data]         # Precompute a list of keys.\n>>> data[bisectleft(keys, 0)]\n('black', 0)\n>>> data[bisectleft(keys, 1)]\n('blue', 1)\n>>> data[bisectleft(keys, 5)]\n('red', 5)\n>>> data[bisectleft(keys, 8)]\n('yellow', 8)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: array -- Efficient arrays of numeric values,  Next: weakref -- Weak references,  Prev: bisect -- Array bisection algorithm,  Up: Data Types": {
            "content": "",
            "subsections": []
        },
        "This module defines an object type which can compactly represent an": {
            "content": "array of basic values: characters, integers, floating point numbers.",
            "subsections": []
        },
        "Arrays are sequence types and behave very much like lists, except that": {
            "content": "the type of objects stored in them is constrained.  The type is\nspecified at object creation time by using a 'type code', which is a\nsingle character.  The following type codes are defined:\n",
            "subsections": []
        },
        "Type code       C Type                   Python Type             Minimum size in bytes       Notes": {
            "content": "---------------------------------------------------------------------------------------------------------\n\n''b''           signed char              int                     1\n\n\n''B''           unsigned char            int                     1\n\n\n''u''           wchart                  Unicode character       2                           (1)\n\n\n''h''           signed short             int                     2\n\n\n''H''           unsigned short           int                     2\n\n\n''i''           signed int               int                     2\n\n\n''I''           unsigned int             int                     2\n\n\n''l''           signed long              int                     4\n\n\n''L''           unsigned long            int                     4\n\n\n''q''           signed long long         int                     8\n\n\n''Q''           unsigned long long       int                     8\n\n\n''f''           float                    float                   4\n\n\n''d''           double                   float                   8\n\n\nNotes:\n\n1. It can be 16 bits or 32 bits depending on the platform.\n\nChanged in version 3.9: 'array('u')' now uses 'wchart' as C type\ninstead of deprecated 'PyUNICODE'.  This change doesn't affect its\nbehavior because 'PyUNICODE' is alias of 'wchart' since Python\n3.3.\n\nDeprecated since version 3.3, will be removed in version 4.0.\n",
            "subsections": []
        },
        "The actual representation of values is determined by the machine": {
            "content": "architecture (strictly speaking, by the C implementation).  The actual\nsize can be accessed through the *note array.itemsize: 224e. attribute.\n\nThe module defines the following item:\n\n-- Data: array.typecodes\n\nA string with all available type codes.\n\nThe module defines the following type:\n\n-- Class: array.array (typecode[, initializer])\n\nA new array whose items are restricted by 'typecode', and\ninitialized from the optional 'initializer' value, which must be a\n*note bytes: 295. or *note bytearray: 294. object, a Unicode\nstring, or iterable over elements of the appropriate type.\n\nIf given a *note bytes: 295. or *note bytearray: 294. object, the\ninitializer is passed to the new array's *note frombytes(): 10ea.\nmethod; if given a Unicode string, the initializer is passed to the\n*note fromunicode(): 2250. method; otherwise, the initializer's\niterator is passed to the *note extend(): 2251. method to add\ninitial items to the array.\n\nArray objects support the ordinary sequence operations of indexing,\nslicing, concatenation, and multiplication.  When using slice\nassignment, the assigned value must be an array object with the\nsame type code; in all other cases, *note TypeError: 28e. is\nraised.  Array objects also implement the buffer interface, and may\nbe used wherever *note bytes-like objects: b82. are supported.\n\nRaises an *note auditing event: 161d. 'array.new' with\narguments 'typecode', 'initializer'.\n\n-- Attribute: typecode\n\nThe typecode character used to create the array.\n\n-- Attribute: itemsize\n\nThe length in bytes of one array item in the internal\nrepresentation.\n\n-- Method: append (x)\n\nAppend a new item with value 'x' to the end of the array.\n\n-- Method: bufferinfo ()\n\nReturn a tuple '(address, length)' giving the current memory\naddress and the length in elements of the buffer used to hold\narray's contents.  The size of the memory buffer in bytes can\nbe computed as 'array.bufferinfo()[1] * array.itemsize'.\nThis is occasionally useful when working with low-level (and\ninherently unsafe) I/O interfaces that require memory\naddresses, such as certain 'ioctl()' operations.  The returned\nnumbers are valid as long as the array exists and no\nlength-changing operations are applied to it.\n\nNote: When using array objects from code written in C or\nC++ (the only way to effectively make use of this\ninformation), it makes more sense to use the buffer\ninterface supported by array objects.  This method is\nmaintained for backward compatibility and should be\navoided in new code.  The buffer interface is documented\nin *note Buffer Protocol: 148.\n\n-- Method: byteswap ()\n\n\"Byteswap\" all items of the array.  This is only supported for\nvalues which are 1, 2, 4, or 8 bytes in size; for other types\nof values, *note RuntimeError: 17a. is raised.  It is useful\nwhen reading data from a file written on a machine with a\ndifferent byte order.\n\n-- Method: count (x)\n\nReturn the number of occurrences of 'x' in the array.\n\n-- Method: extend (iterable)\n\nAppend items from 'iterable' to the end of the array.  If\n'iterable' is another array, it must have 'exactly' the same\ntype code; if not, *note TypeError: 28e. will be raised.  If\n'iterable' is not an array, it must be iterable and its\nelements must be the right type to be appended to the array.\n\n-- Method: frombytes (buffer)\n\nAppends items from the *note bytes-like object: b82,\ninterpreting its content as an array of machine values (as if\nit had been read from a file using the *note fromfile(): 2257.\nmethod).\n\nNew in version 3.2: 'fromstring()' is renamed to *note\nfrombytes(): 10ea. for clarity.\n\n-- Method: fromfile (f, n)\n\nRead 'n' items (as machine values) from the *note file object:\n1037. 'f' and append them to the end of the array.  If less\nthan 'n' items are available, *note EOFError: 114e. is raised,\nbut the items that were available are still inserted into the\narray.\n\n-- Method: fromlist (list)\n\nAppend items from the list.  This is equivalent to 'for x in\nlist: a.append(x)' except that if there is a type error, the\narray is unchanged.\n\n-- Method: fromunicode (s)\n\nExtends this array with data from the given Unicode string.\nThe array must have type code ''u''; otherwise a *note\nValueError: 183. is raised.  Use\n'array.frombytes(unicodestring.encode(enc))' to append Unicode\ndata to an array of some other type.\n\n-- Method: index (x[, start[, stop]])\n\nReturn the smallest 'i' such that 'i' is the index of the\nfirst occurrence of 'x' in the array.  The optional arguments\n'start' and 'stop' can be specified to search for 'x' within a\nsubsection of the array.  Raise *note ValueError: 183. if 'x'\nis not found.\n\nChanged in version 3.10: Added optional 'start' and 'stop'\nparameters.\n\n-- Method: insert (i, x)\n\nInsert a new item with value 'x' in the array before position\n'i'.  Negative values are treated as being relative to the end\nof the array.\n\n-- Method: pop ([i])\n\nRemoves the item with the index 'i' from the array and returns\nit.  The optional argument defaults to '-1', so that by\ndefault the last item is removed and returned.\n\n-- Method: remove (x)\n\nRemove the first occurrence of 'x' from the array.\n\n-- Method: reverse ()\n\nReverse the order of the items in the array.\n\n-- Method: tobytes ()\n\nConvert the array to an array of machine values and return the\nbytes representation (the same sequence of bytes that would be\nwritten to a file by the *note tofile(): 225d. method.)\n\nNew in version 3.2: 'tostring()' is renamed to *note\ntobytes(): 10e9. for clarity.\n\n-- Method: tofile (f)\n\nWrite all items (as machine values) to the *note file object:\n1037. 'f'.\n\n-- Method: tolist ()\n\nConvert the array to an ordinary list with the same items.\n\n-- Method: tounicode ()\n\nConvert the array to a Unicode string.  The array must have a\ntype ''u''; otherwise a *note ValueError: 183. is raised.  Use\n'array.tobytes().decode(enc)' to obtain a Unicode string from\nan array of some other type.\n",
            "subsections": []
        },
        "The string representation of array objects has the form 'array(typecode,": {
            "content": "initializer)'.  The 'initializer' is omitted if the array is empty,\notherwise it is a Unicode string if the 'typecode' is ''u'', otherwise\nit is a list of numbers.  The string representation is guaranteed to be\nable to be converted back to an array with the same type and value using\n*note eval(): 690, so long as the *note array: 18f. class has been\nimported using 'from array import array'.  Variables 'inf' and 'nan'\nmust also be defined if it contains corresponding floating point values.\nExamples:\n\narray('l')\narray('u', 'hello \\u2641')\narray('l', [1, 2, 3, 4, 5])\narray('d', [1.0, 2.0, 3.14, -inf, nan])\n\nSee also\n........\n\nModule *note struct: cf.\n\nPacking and unpacking of heterogeneous binary data.\n\nModule *note xdrlib: 11a.\n\nPacking and unpacking of External Data Representation (XDR) data as\nused in some remote procedure call systems.\n",
            "subsections": []
        },
        "NumPy(1)": {
            "content": "The NumPy package defines another array type.\n\n---------- Footnotes ----------\n\n(1) https://numpy.org/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: weakref -- Weak references,  Next: types -- Dynamic type creation and names for built-in types,  Prev: array -- Efficient arrays of numeric values,  Up: Data Types": {
            "content": "'Source code:' Lib/weakref.py(1)\n\n\n\nThe *note weakref: 10f. module allows the Python programmer to create\n'weak references' to objects.\n",
            "subsections": []
        },
        "In the following, the term 'referent' means the object which is referred": {
            "content": "to by a weak reference.\n\nA weak reference to an object is not enough to keep the object alive:\nwhen the only remaining references to a referent are weak references,\n*note garbage collection: 167e. is free to destroy the referent and\nreuse its memory for something else.  However, until the object is\nactually destroyed the weak reference may return the object even if\nthere are no strong references to it.\n\nA primary use for weak references is to implement caches or mappings\nholding large objects, where it's desired that a large object not be\nkept alive solely because it appears in a cache or mapping.\n",
            "subsections": []
        },
        "For example, if you have a number of large binary image objects, you may": {
            "content": "wish to associate a name with each.  If you used a Python dictionary to\nmap names to images, or images to names, the image objects would remain\nalive just because they appeared as values or keys in the dictionaries.\nThe *note WeakKeyDictionary: 16da. and *note WeakValueDictionary: 16d9.\nclasses supplied by the *note weakref: 10f. module are an alternative,\nusing weak references to construct mappings that don't keep objects\nalive solely because they appear in the mapping objects.  If, for\nexample, an image object is a value in a *note WeakValueDictionary:\n16d9, then when the last remaining references to that image object are\nthe weak references held by weak mappings, garbage collection can\nreclaim the object, and its corresponding entries in weak mappings are\nsimply deleted.\n\n*note WeakKeyDictionary: 16da. and *note WeakValueDictionary: 16d9. use\nweak references in their implementation, setting up callback functions\non the weak references that notify the weak dictionaries when a key or\nvalue has been reclaimed by garbage collection.  *note WeakSet: 3a1.\nimplements the *note set: 39d. interface, but keeps weak references to\nits elements, just like a *note WeakKeyDictionary: 16da. does.\n\n*note finalize: 8aa. provides a straight forward way to register a\ncleanup function to be called when an object is garbage collected.  This\nis simpler to use than setting up a callback function on a raw weak\nreference, since the module automatically ensures that the finalizer\nremains alive until the object is collected.\n",
            "subsections": []
        },
        "Most programs should find that using one of these weak container types": {
            "content": "or *note finalize: 8aa. is all they need - it's not usually necessary to\ncreate your own weak references directly.  The low-level machinery is\nexposed by the *note weakref: 10f. module for the benefit of advanced\nuses.\n",
            "subsections": []
        },
        "Not all objects can be weakly referenced.  Objects which support weak": {
            "content": "references include class instances, functions written in Python (but not\nin C), instance methods, sets, frozensets, some *note file objects:\n1037, *note generators: eda, type objects, sockets, arrays, deques,\nregular expression pattern objects, and code objects.\n",
            "subsections": []
        },
        "Changed in version 3.2: Added support for thread.lock, threading.Lock,": {
            "content": "and code objects.\n\nSeveral built-in types such as *note list: 3dc. and *note dict: 237. do\nnot directly support weak references but can add support through\nsubclassing:\n\nclass Dict(dict):\npass\n\nobj = Dict(red=1, green=2, blue=3)   # this object is weak referenceable\n\n'CPython implementation detail:' Other built-in types such as *note\ntuple: 4b8. and *note int: 17e. do not support weak references even when\nsubclassed.\n\nExtension types can easily be made to support weak references; see *note\nWeak Reference Support: 2262.\n",
            "subsections": []
        },
        "When 'slots' are defined for a given type, weak reference support is": {
            "content": "disabled unless a ''weakref'' string is also present in the sequence\nof strings in the 'slots' declaration.  See *note slots\ndocumentation: 1c75. for details.\n\n-- Class: weakref.ref (object[, callback])\n\nReturn a weak reference to 'object'.  The original object can be\nretrieved by calling the reference object if the referent is still\nalive; if the referent is no longer alive, calling the reference\nobject will cause *note None: 43f. to be returned.  If 'callback'\nis provided and not *note None: 43f, and the returned weakref\nobject is still alive, the callback will be called when the object\nis about to be finalized; the weak reference object will be passed\nas the only parameter to the callback; the referent will no longer\nbe available.\n\nIt is allowable for many weak references to be constructed for the\nsame object.  Callbacks registered for each weak reference will be\ncalled from the most recently registered callback to the oldest\nregistered callback.\n\nExceptions raised by the callback will be noted on the standard\nerror output, but cannot be propagated; they are handled in exactly\nthe same way as exceptions raised from an object's *note del():\n1c66. method.\n\nWeak references are *note hashable: 3db. if the 'object' is\nhashable.  They will maintain their hash value even after the\n'object' was deleted.  If *note hash(): 3b1. is called the first\ntime only after the 'object' was deleted, the call will raise *note\nTypeError: 28e.\n\nWeak references support tests for equality, but not ordering.  If\nthe referents are still alive, two references have the same\nequality relationship as their referents (regardless of the\n'callback').  If either referent has been deleted, the references\nare equal only if the reference objects are the same object.\n\nThis is a subclassable type rather than a factory function.\n\n-- Attribute: callback\n\nThis read-only attribute returns the callback currently\nassociated to the weakref.  If there is no callback or if the\nreferent of the weakref is no longer alive then this attribute\nwill have value 'None'.\n\nChanged in version 3.4: Added the *note callback: e64.\nattribute.\n\n-- Function: weakref.proxy (object[, callback])\n\nReturn a proxy to 'object' which uses a weak reference.  This\nsupports use of the proxy in most contexts instead of requiring the\nexplicit dereferencing used with weak reference objects.  The\nreturned object will have a type of either 'ProxyType' or\n'CallableProxyType', depending on whether 'object' is callable.\nProxy objects are not *note hashable: 3db. regardless of the\nreferent; this avoids a number of problems related to their\nfundamentally mutable nature, and prevents their use as dictionary\nkeys.  'callback' is the same as the parameter of the same name to\nthe *note ref(): e63. function.\n\nAccessing an attribute of the proxy object after the referent is\ngarbage collected raises *note ReferenceError: 1369.\n\nChanged in version 3.8: Extended the operator support on proxy\nobjects to include the matrix multiplication operators '@' and\n'@='.\n\n-- Function: weakref.getweakrefcount (object)\n\nReturn the number of weak references and proxies which refer to\n'object'.\n\n-- Function: weakref.getweakrefs (object)\n\nReturn a list of all weak reference and proxy objects which refer\nto 'object'.\n\n-- Class: weakref.WeakKeyDictionary ([dict])\n\nMapping class that references keys weakly.  Entries in the\ndictionary will be discarded when there is no longer a strong\nreference to the key.  This can be used to associate additional\ndata with an object owned by other parts of an application without\nadding attributes to those objects.  This can be especially useful\nwith objects that override attribute accesses.\n\nNote that when a key with equal value to an existing key (but not\nequal identity) is inserted into the dictionary, it replaces the\nvalue but does not replace the existing key.  Due to this, when the\nreference to the original key is deleted, it also deletes the entry\nin the dictionary:\n\n>>> class T(str): pass\n...\n>>> k1, k2 = T(), T()\n>>> d = weakref.WeakKeyDictionary()\n>>> d[k1] = 1   # d = {k1: 1}\n>>> d[k2] = 2   # d = {k1: 2}\n>>> del k1      # d = {}\n\nA workaround would be to remove the key prior to reassignment:\n\n>>> class T(str): pass\n...\n>>> k1, k2 = T(), T()\n>>> d = weakref.WeakKeyDictionary()\n>>> d[k1] = 1   # d = {k1: 1}\n>>> del d[k1]\n>>> d[k2] = 2   # d = {k2: 2}\n>>> del k1      # d = {k2: 2}\n\nChanged in version 3.9: Added support for '|' and '|=' operators,\nspecified in PEP 584(2).\n\n*note WeakKeyDictionary: 16da. objects have an additional method that\nexposes the internal references directly.  The references are not\nguaranteed to be \"live\" at the time they are used, so the result of\ncalling the references needs to be checked before being used.  This can\nbe used to avoid creating references that will cause the garbage\ncollector to keep the keys around longer than needed.\n\n-- Method: WeakKeyDictionary.keyrefs ()\n\nReturn an iterable of the weak references to the keys.\n\n-- Class: weakref.WeakValueDictionary ([dict])\n\nMapping class that references values weakly.  Entries in the\ndictionary will be discarded when no strong reference to the value\nexists any more.\n\nChanged in version 3.9: Added support for '|' and '|=' operators,\nas specified in PEP 584(3).\n\n*note WeakValueDictionary: 16d9. objects have an additional method that\nhas the same issues as the *note WeakKeyDictionary.keyrefs(): 2265.\nmethod.\n\n-- Method: WeakValueDictionary.valuerefs ()\n\nReturn an iterable of the weak references to the values.\n\n-- Class: weakref.WeakSet ([elements])\n\nSet class that keeps weak references to its elements.  An element\nwill be discarded when no strong reference to it exists any more.\n\n-- Class: weakref.WeakMethod (method[, callback])\n\nA custom *note ref: e63. subclass which simulates a weak reference\nto a bound method (i.e., a method defined on a class and looked up\non an instance).  Since a bound method is ephemeral, a standard\nweak reference cannot keep hold of it.  *note WeakMethod: e62. has\nspecial code to recreate the bound method until either the object\nor the original function dies:\n\n>>> class C:\n...     def method(self):\n...         print(\"method called!\")\n...\n>>> c = C()\n>>> r = weakref.ref(c.method)\n>>> r()\n>>> r = weakref.WeakMethod(c.method)\n>>> r()\n<bound method C.method of <main.C object at 0x7fc859830220>>\n>>> r()()\nmethod called!\n>>> del c\n>>> gc.collect()\n0\n>>> r()\n>>>\n\n'callback' is the same as the parameter of the same name to the\n*note ref(): e63. function.\n\nNew in version 3.4.\n\n-- Class: weakref.finalize (obj, func, /, *args, kwargs)\n\nReturn a callable finalizer object which will be called when 'obj'\nis garbage collected.  Unlike an ordinary weak reference, a\nfinalizer will always survive until the reference object is\ncollected, greatly simplifying lifecycle management.\n\nA finalizer is considered 'alive' until it is called (either\nexplicitly or at garbage collection), and after that it is 'dead'.\nCalling a live finalizer returns the result of evaluating\n'func(*arg, kwargs)', whereas calling a dead finalizer returns\n*note None: 43f.\n\nExceptions raised by finalizer callbacks during garbage collection\nwill be shown on the standard error output, but cannot be\npropagated.  They are handled in the same way as exceptions raised\nfrom an object's *note del(): 1c66. method or a weak\nreference's callback.\n\nWhen the program exits, each remaining live finalizer is called\nunless its *note atexit: a. attribute has been set to false.  They\nare called in reverse order of creation.\n\nA finalizer will never invoke its callback during the later part of\nthe *note interpreter shutdown: cd8. when module globals are liable\nto have been replaced by *note None: 43f.\n\n-- Method: call ()\n\nIf 'self' is alive then mark it as dead and return the result\nof calling 'func(*args, kwargs)'.  If 'self' is dead then\nreturn *note None: 43f.\n\n-- Method: detach ()\n\nIf 'self' is alive then mark it as dead and return the tuple\n'(obj, func, args, kwargs)'.  If 'self' is dead then return\n*note None: 43f.\n\n-- Method: peek ()\n\nIf 'self' is alive then return the tuple '(obj, func, args,\nkwargs)'.  If 'self' is dead then return *note None: 43f.\n\n-- Attribute: alive\n\nProperty which is true if the finalizer is alive, false\notherwise.\n\n-- Attribute: atexit\n\nA writable boolean property which by default is true.  When\nthe program exits, it calls all remaining live finalizers for\nwhich *note atexit: 226b. is true.  They are called in reverse\norder of creation.\n\nNote: It is important to ensure that 'func', 'args' and\n'kwargs' do not own any references to 'obj', either directly\nor indirectly, since otherwise 'obj' will never be garbage\ncollected.  In particular, 'func' should not be a bound method\nof 'obj'.\n\nNew in version 3.4.\n\n-- Data: weakref.ReferenceType\n\nThe type object for weak references objects.\n\n-- Data: weakref.ProxyType\n\nThe type object for proxies of objects which are not callable.\n\n-- Data: weakref.CallableProxyType\n\nThe type object for proxies of callable objects.\n\n-- Data: weakref.ProxyTypes\n\nSequence containing all the type objects for proxies.  This can\nmake it simpler to test if an object is a proxy without being\ndependent on naming both proxy types.\n\nSee also\n........\n\nPEP 205(4) - Weak References\n\nThe proposal and rationale for this feature, including links to\nearlier implementations and information about similar features in\nother languages.\n\n* Menu:\n\n* Weak Reference Objects::\n* Example: Example<2>.\n* Finalizer Objects::\n* Comparing finalizers with del() methods: Comparing finalizers with del methods.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/weakref.py\n\n(2) https://peps.python.org/pep-0584/\n\n(3) https://peps.python.org/pep-0584/\n\n(4) https://peps.python.org/pep-0205/\n\nFile: python3.12.info,  Node: Weak Reference Objects,  Next: Example<2>,  Up: weakref -- Weak references\n\n5.8.9.1 Weak Reference Objects\n..............................\n\nWeak reference objects have no methods and no attributes besides *note\nref.callback: e64.  A weak reference object allows the referent to\nbe obtained, if it still exists, by calling it:\n\n>>> import weakref\n>>> class Object:\n...     pass\n...\n>>> o = Object()\n>>> r = weakref.ref(o)\n>>> o2 = r()\n>>> o is o2\nTrue\n",
            "subsections": []
        },
        "If the referent no longer exists, calling the reference object returns": {
            "content": "*note None: 43f.:\n\n>>> del o, o2\n>>> print(r())\nNone\n",
            "subsections": []
        },
        "Testing that a weak reference object is still live should be done using": {
            "content": "the expression 'ref() is not None'.  Normally, application code that\nneeds to use a reference object should follow this pattern:\n\n# r is a weak reference object\no = r()\nif o is None:\n# referent has been garbage collected\nprint(\"Object has been deallocated; can't frobnicate.\")\nelse:\nprint(\"Object is still live!\")\no.dosomethinguseful()\n\nUsing a separate test for \"liveness\" creates race conditions in threaded\napplications; another thread can cause a weak reference to become\ninvalidated before the weak reference is called; the idiom shown above\nis safe in threaded applications as well as single-threaded\napplications.\n\nSpecialized versions of *note ref: e63. objects can be created through\nsubclassing.  This is used in the implementation of the *note",
            "subsections": []
        },
        "WeakValueDictionary: 16d9. to reduce the memory overhead for each entry": {
            "content": "in the mapping.  This may be most useful to associate additional\ninformation with a reference, but could also be used to insert\nadditional processing on calls to retrieve the referent.\n\nThis example shows how a subclass of *note ref: e63. can be used to\nstore additional information about an object and affect the value that's\nreturned when the referent is accessed:\n\nimport weakref\n\nclass ExtendedRef(weakref.ref):\ndef init(self, ob, callback=None, /, annotations):\nsuper().init(ob, callback)\nself.counter = 0\nfor k, v in annotations.items():\nsetattr(self, k, v)\n\ndef call(self):\n\"\"\"Return a pair containing the referent and the number of\ntimes the reference has been called.\n\"\"\"\nob = super().call()\nif ob is not None:\nself.counter += 1\nob = (ob, self.counter)\nreturn ob\n\nFile: python3.12.info,  Node: Example<2>,  Next: Finalizer Objects,  Prev: Weak Reference Objects,  Up: weakref -- Weak references\n\n5.8.9.2 Example\n...............\n",
            "subsections": []
        },
        "This simple example shows how an application can use object IDs to": {
            "content": "retrieve objects that it has seen before.  The IDs of the objects can\nthen be used in other data structures without forcing the objects to\nremain alive, but the objects can still be retrieved by ID if they do.\n\nimport weakref\n\nid2objdict = weakref.WeakValueDictionary()\n\ndef remember(obj):\noid = id(obj)\nid2objdict[oid] = obj\nreturn oid\n\ndef id2obj(oid):\nreturn id2objdict[oid]\n\nFile: python3.12.info,  Node: Finalizer Objects,  Next: Comparing finalizers with del methods,  Prev: Example<2>,  Up: weakref -- Weak references\n\n5.8.9.3 Finalizer Objects\n.........................\n\nThe main benefit of using *note finalize: 8aa. is that it makes it\nsimple to register a callback without needing to preserve the returned\nfinalizer object.  For instance\n\n>>> import weakref\n>>> class Object:\n...     pass\n...\n>>> kenny = Object()\n>>> weakref.finalize(kenny, print, \"You killed Kenny!\")\n<finalize object at ...; for 'Object' at ...>\n>>> del kenny\nYou killed Kenny!\n",
            "subsections": []
        },
        "The finalizer can be called directly as well.  However the finalizer": {
            "content": "will invoke the callback at most once.\n\n>>> def callback(x, y, z):\n...     print(\"CALLBACK\")\n...     return x + y + z\n...\n>>> obj = Object()\n>>> f = weakref.finalize(obj, callback, 1, 2, z=3)\n>>> assert f.alive\n>>> assert f() == 6\nCALLBACK\n>>> assert not f.alive\n>>> f()                     # callback not called because finalizer dead\n>>> del obj                 # callback not called because finalizer dead\n\nYou can unregister a finalizer using its *note detach(): 2268. method.",
            "subsections": []
        },
        "This kills the finalizer and returns the arguments passed to the": {
            "content": "constructor when it was created.\n\n>>> obj = Object()\n>>> f = weakref.finalize(obj, callback, 1, 2, z=3)\n>>> f.detach()\n(<...Object object ...>, <function callback ...>, (1, 2), {'z': 3})\n>>> newobj, func, args, kwargs =\n>>> assert not f.alive\n>>> assert newobj is obj\n>>> assert func(*args, kwargs) == 6\nCALLBACK\n\nUnless you set the *note atexit: 226b. attribute to *note False: 971, a\nfinalizer will be called when the program exits if it is still alive.",
            "subsections": []
        },
        "For instance": {
            "content": ">>> obj = Object()\n>>> weakref.finalize(obj, print, \"obj dead or exiting\")\n<finalize object at ...; for 'Object' at ...>\n>>> exit()\nobj dead or exiting\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Comparing finalizers with del methods,  Prev: Finalizer Objects,  Up: weakref -- Weak references": {
            "content": "5.8.9.4 Comparing finalizers with 'del()' methods\n.....................................................\n",
            "subsections": []
        },
        "Suppose we want to create a class whose instances represent temporary": {
            "content": "directories.  The directories should be deleted with their contents when\nthe first of the following events occurs:\n\n* the object is garbage collected,\n\n* the object's 'remove()' method is called, or\n\n* the program exits.\n\nWe might try to implement the class using a *note del(): 1c66.\nmethod as follows:\n\nclass TempDir:\ndef init(self):\nself.name = tempfile.mkdtemp()\n\ndef remove(self):\nif self.name is not None:\nshutil.rmtree(self.name)\nself.name = None\n\n@property\ndef removed(self):\nreturn self.name is None\n\ndef del(self):\nself.remove()\n\nStarting with Python 3.4, *note del(): 1c66. methods no longer\nprevent reference cycles from being garbage collected, and module\nglobals are no longer forced to *note None: 43f. during *note\ninterpreter shutdown: cd8.  So this code should work without any issues\non CPython.\n\nHowever, handling of *note del(): 1c66. methods is notoriously\nimplementation specific, since it depends on internal details of the\ninterpreter's garbage collector implementation.\n\nA more robust alternative can be to define a finalizer which only\nreferences the specific functions and objects that it needs, rather than\nhaving access to the full state of the object:\n\nclass TempDir:\ndef init(self):\nself.name = tempfile.mkdtemp()\nself.finalizer = weakref.finalize(self, shutil.rmtree, self.name)\n\ndef remove(self):\nself.finalizer()\n\n@property\ndef removed(self):\nreturn not self.finalizer.alive\n",
            "subsections": []
        },
        "Defined like this, our finalizer only receives a reference to the": {
            "content": "details it needs to clean up the directory appropriately.  If the object\nnever gets garbage collected the finalizer will still be called at exit.\n",
            "subsections": []
        },
        "The other advantage of weakref based finalizers is that they can be used": {
            "content": "to register finalizers for classes where the definition is controlled by\na third party, such as running code when a module is unloaded:\n\nimport weakref, sys\ndef unloadingmodule():\n# implicit reference to the module globals from the function body\nweakref.finalize(sys.modules[name], unloadingmodule)\n\nNote: If you create a finalizer object in a daemonic thread just as\nthe program exits then there is the possibility that the finalizer\ndoes not get called at exit.  However, in a daemonic thread *note\natexit.register(): 689, 'try: ... finally: ...' and 'with: ...' do\nnot guarantee that cleanup occurs either.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: types -- Dynamic type creation and names for built-in types,  Next: copy -- Shallow and deep copy operations,  Prev: weakref -- Weak references,  Up: Data Types": {
            "content": "'Source code:' Lib/types.py(1)\n\n\n",
            "subsections": []
        },
        "This module defines utility functions to assist in dynamic creation of": {
            "content": "new types.\n",
            "subsections": []
        },
        "It also defines names for some object types that are used by the": {
            "content": "standard Python interpreter, but not exposed as builtins like *note int:\n17e. or *note str: 157. are.\n",
            "subsections": []
        },
        "Finally, it provides some additional type-related utility classes and": {
            "content": "functions that are not fundamental enough to be builtins.\n\n* Menu:\n\n* Dynamic Type Creation::\n* Standard Interpreter Types::\n* Additional Utility Classes and Functions::\n* Coroutine Utility Functions::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/types.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Dynamic Type Creation,  Next: Standard Interpreter Types,  Up: types -- Dynamic type creation and names for built-in types": {
            "content": "5.8.10.1 Dynamic Type Creation\n..............................\n\n-- Function: types.newclass (name, bases=(), kwds=None,\nexecbody=None)\n\nCreates a class object dynamically using the appropriate metaclass.\n\nThe first three arguments are the components that make up a class\ndefinition header: the class name, the base classes (in order), the\nkeyword arguments (such as 'metaclass').\n\nThe 'execbody' argument is a callback that is used to populate the\nfreshly created class namespace.  It should accept the class\nnamespace as its sole argument and update the namespace directly\nwith the class contents.  If no callback is provided, it has the\nsame effect as passing in 'lambda ns: None'.\n\nNew in version 3.3.\n\n-- Function: types.prepareclass (name, bases=(), kwds=None)\n\nCalculates the appropriate metaclass and creates the class\nnamespace.\n\nThe arguments are the components that make up a class definition\nheader: the class name, the base classes (in order) and the keyword\narguments (such as 'metaclass').\n\nThe return value is a 3-tuple: 'metaclass, namespace, kwds'\n\n'metaclass' is the appropriate metaclass, 'namespace' is the\nprepared class namespace and 'kwds' is an updated copy of the\npassed in 'kwds' argument with any ''metaclass'' entry removed.  If\nno 'kwds' argument is passed in, this will be an empty dict.\n\nNew in version 3.3.\n\nChanged in version 3.6: The default value for the 'namespace'\nelement of the returned tuple has changed.  Now an\ninsertion-order-preserving mapping is used when the metaclass does\nnot have a 'prepare' method.\n\nSee also\n........\n\n*note Metaclasses: 1c7b.\n\nFull details of the class creation process supported by these\nfunctions\n\nPEP 3115(1) - Metaclasses in Python 3000\n\nIntroduced the 'prepare' namespace hook\n\n-- Function: types.resolvebases (bases)\n\nResolve MRO entries dynamically as specified by PEP 560(2).\n\nThis function looks for items in 'bases' that are not instances of\n*note type: ba0, and returns a tuple where each such object that\nhas an *note mroentries(): 1c7d. method is replaced with an\nunpacked result of calling this method.  If a 'bases' item is an\ninstance of *note type: ba0, or it doesn't have an\n'mroentries()' method, then it is included in the return tuple\nunchanged.\n\nNew in version 3.7.\n\n-- Function: types.getoriginalbases (cls, /)\n\nReturn the tuple of objects originally given as the bases of 'cls'\nbefore the *note mroentries(): 1c7d. method has been called on\nany bases (following the mechanisms laid out in PEP 560(3)).  This\nis useful for introspecting *note Generics: 1f5.\n\nFor classes that have an 'origbases' attribute, this function\nreturns the value of 'cls.origbases'.  For classes without the\n'origbases' attribute, 'cls.bases' is returned.\n\nExamples:\n\nfrom typing import TypeVar, Generic, NamedTuple, TypedDict\n\nT = TypeVar(\"T\")\nclass Foo(Generic[T]): ...\nclass Bar(Foo[int], float): ...\nclass Baz(list[str]): ...\nEggs = NamedTuple(\"Eggs\", [(\"a\", int), (\"b\", str)])\nSpam = TypedDict(\"Spam\", {\"a\": int, \"b\": str})\n\nassert Bar.bases == (Foo, float)\nassert getoriginalbases(Bar) == (Foo[int], float)\n\nassert Baz.bases == (list,)\nassert getoriginalbases(Baz) == (list[str],)\n\nassert Eggs.bases == (tuple,)\nassert getoriginalbases(Eggs) == (NamedTuple,)\n\nassert Spam.bases == (dict,)\nassert getoriginalbases(Spam) == (TypedDict,)\n\nassert int.bases == (object,)\nassert getoriginalbases(int) == (object,)\n\nNew in version 3.12.\n\nSee also\n........\n\nPEP 560(4) - Core support for typing module and generic types\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3115/\n\n(2) https://peps.python.org/pep-0560/\n\n(3) https://peps.python.org/pep-0560/\n\n(4) https://peps.python.org/pep-0560/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Standard Interpreter Types,  Next: Additional Utility Classes and Functions,  Prev: Dynamic Type Creation,  Up: types -- Dynamic type creation and names for built-in types": {
            "content": "5.8.10.2 Standard Interpreter Types\n...................................\n",
            "subsections": []
        },
        "This module provides names for many of the types that are required to": {
            "content": "implement a Python interpreter.  It deliberately avoids including some\nof the types that arise only incidentally during processing such as the\n'listiterator' type.\n\nTypical use of these names is for *note isinstance(): 14b. or *note\nissubclass(): 5b4. checks.\n",
            "subsections": []
        },
        "If you instantiate any of these types, note that signatures may vary": {
            "content": "between Python versions.\n\nStandard names are defined for the following types:\n\n-- Data: types.NoneType\n\nThe type of *note None: 43f.\n\nNew in version 3.10.\n\n-- Data: types.FunctionType\n-- Data: types.LambdaType\n\nThe type of user-defined functions and functions created by *note\nlambda: 1115. expressions.\n\nRaises an *note auditing event: 161d. 'function.new' with\nargument 'code'.\n\nThe audit event only occurs for direct instantiation of function\nobjects, and is not raised for normal compilation.\n\n-- Data: types.GeneratorType\n\nThe type of *note generator: eda.-iterator objects, created by\ngenerator functions.\n\n-- Data: types.CoroutineType\n\nThe type of *note coroutine: 1ae. objects, created by *note async\ndef: 394. functions.\n\nNew in version 3.5.\n\n-- Data: types.AsyncGeneratorType\n\nThe type of *note asynchronous generator: 1d47.-iterator objects,\ncreated by asynchronous generator functions.\n\nNew in version 3.6.\n\n-- Class: types.CodeType (kwargs)\n\nThe type of *note code objects: 59f. such as returned by *note\ncompile(): 528.\n\nRaises an *note auditing event: 161d. 'code.new' with arguments\n'code', 'filename', 'name', 'argcount', 'posonlyargcount',\n'kwonlyargcount', 'nlocals', 'stacksize', 'flags'.\n\nNote that the audited arguments may not match the names or\npositions required by the initializer.  The audit event only occurs\nfor direct instantiation of code objects, and is not raised for\nnormal compilation.\n\n-- Data: types.CellType\n\nThe type for cell objects: such objects are used as containers for\na function's free variables.\n\nNew in version 3.8.\n\n-- Data: types.MethodType\n\nThe type of methods of user-defined class instances.\n\n-- Data: types.BuiltinFunctionType\n-- Data: types.BuiltinMethodType\n\nThe type of built-in functions like *note len(): 3fb. or *note\nsys.exit(): 11c2, and methods of built-in classes.  (Here, the term\n\"built-in\" means \"written in C\".)\n\n-- Data: types.WrapperDescriptorType\n\nThe type of methods of some built-in data types and base classes\nsuch as *note object.init(): 47d. or *note object.lt():\n1180.\n\nNew in version 3.7.\n\n-- Data: types.MethodWrapperType\n\nThe type of 'bound' methods of some built-in data types and base\nclasses.  For example it is the type of 'object().str'.\n\nNew in version 3.7.\n\n-- Data: types.NotImplementedType\n\nThe type of *note NotImplemented: 5c5.\n\nNew in version 3.10.\n\n-- Data: types.MethodDescriptorType\n\nThe type of methods of some built-in data types such as *note\nstr.join(): 1eb6.\n\nNew in version 3.7.\n\n-- Data: types.ClassMethodDescriptorType\n\nThe type of 'unbound' class methods of some built-in data types\nsuch as 'dict.dict['fromkeys']'.\n\nNew in version 3.7.\n\n-- Class: types.ModuleType (name, doc=None)\n\nThe type of *note modules: 1463.  The constructor takes the name of\nthe module to be created and optionally its *note docstring: 1e2f.\n\nNote: Use *note importlib.util.modulefromspec(): c70. to\ncreate a new module if you wish to set the various\nimport-controlled attributes.\n\n-- Attribute: doc\n\nThe *note docstring: 1e2f. of the module.  Defaults to 'None'.\n\n-- Attribute: loader\n\nThe *note loader: 13e6. which loaded the module.  Defaults to\n'None'.\n\nThis attribute is to match *note\nimportlib.machinery.ModuleSpec.loader: 2280. as stored in the\n*note spec: 1d09. object.\n\nNote: A future version of Python may stop setting this\nattribute by default.  To guard against this potential\nchange, preferably read from the *note spec: 1d09.\nattribute instead or use 'getattr(module, \"loader\",\nNone)' if you explicitly need to use this attribute.\n\nChanged in version 3.4: Defaults to 'None'.  Previously the\nattribute was optional.\n\n-- Attribute: name\n\nThe name of the module.  Expected to match *note\nimportlib.machinery.ModuleSpec.name: 2282.\n\n-- Attribute: package\n\nWhich *note package: 1cf3. a module belongs to.  If the module\nis top-level (i.e.  not a part of any specific package) then\nthe attribute should be set to '''', else it should be set to\nthe name of the package (which can be *note name: 11fd. if\nthe module is a package itself).  Defaults to 'None'.\n\nThis attribute is to match *note\nimportlib.machinery.ModuleSpec.parent: 1d0a. as stored in the\n*note spec: 1d09. object.\n\nNote: A future version of Python may stop setting this\nattribute by default.  To guard against this potential\nchange, preferably read from the *note spec: 1d09.\nattribute instead or use 'getattr(module, \"package\",\nNone)' if you explicitly need to use this attribute.\n\nChanged in version 3.4: Defaults to 'None'.  Previously the\nattribute was optional.\n\n-- Attribute: spec\n\nA record of the module's import-system-related state.\nExpected to be an instance of *note\nimportlib.machinery.ModuleSpec: 1d07.\n\nNew in version 3.4.\n\n-- Data: types.EllipsisType\n\nThe type of *note Ellipsis: 1e91.\n\nNew in version 3.10.\n\n-- Class: types.GenericAlias (torigin, targs)\n\nThe type of *note parameterized generics: 480. such as 'list[int]'.\n\n'torigin' should be a non-parameterized generic class, such as\n'list', 'tuple' or 'dict'.  'targs' should be a *note tuple: 4b8.\n(possibly of length 1) of types which parameterize 'torigin':\n\n>>> from types import GenericAlias\n\n>>> list[int] == GenericAlias(list, (int,))\nTrue\n>>> dict[str, int] == GenericAlias(dict, (str, int))\nTrue\n\nNew in version 3.9.\n\nChanged in version 3.9.2: This type can now be subclassed.\n\nSee also\n........\n\n*note Generic Alias Types: 480.\n\nIn-depth documentation on instances of 'types.GenericAlias'\n\nPEP 585(1) - Type Hinting Generics In Standard Collections\n\nIntroducing the 'types.GenericAlias' class\n\n-- Class: types.UnionType\n\nThe type of *note union type expressions: 5b5.\n\nNew in version 3.10.\n\n-- Class: types.TracebackType (tbnext, tbframe, tblasti, tblineno)\n\nThe type of traceback objects such as found in\n'sys.exception().traceback'.\n\nSee *note the language reference: 92b. for details of the available\nattributes and operations, and guidance on creating tracebacks\ndynamically.\n\n-- Data: types.FrameType\n\nThe type of *note frame objects: 4af. such as found in *note\ntb.tbframe: 1c57. if 'tb' is a traceback object.\n\n-- Data: types.GetSetDescriptorType\n\nThe type of objects defined in extension modules with\n'PyGetSetDef', such as *note FrameType.flocals: 579. or\n'array.array.typecode'.  This type is used as descriptor for object\nattributes; it has the same purpose as the *note property: 3f6.\ntype, but for classes defined in extension modules.\n\n-- Data: types.MemberDescriptorType\n\nThe type of objects defined in extension modules with\n'PyMemberDef', such as 'datetime.timedelta.days'.  This type is\nused as descriptor for simple C data members which use standard\nconversion functions; it has the same purpose as the *note\nproperty: 3f6. type, but for classes defined in extension modules.\n\nIn addition, when a class is defined with a *note slots: 1344.\nattribute, then for each slot, an instance of\n'MemberDescriptorType' will be added as an attribute on the class.\nThis allows the slot to appear in the class's *note dict: aa8.\n\n'CPython implementation detail:' In other implementations of\nPython, this type may be identical to 'GetSetDescriptorType'.\n\n-- Class: types.MappingProxyType (mapping)\n\nRead-only proxy of a mapping.  It provides a dynamic view on the\nmapping's entries, which means that when the mapping changes, the\nview reflects these changes.\n\nNew in version 3.3.\n\nChanged in version 3.9: Updated to support the new union ('|')\noperator from PEP 584(2), which simply delegates to the underlying\nmapping.\n\n-- Describe: key in proxy\n\nReturn 'True' if the underlying mapping has a key 'key', else\n'False'.\n\n-- Describe: proxy[key]\n\nReturn the item of the underlying mapping with key 'key'.\nRaises a *note KeyError: 8cf. if 'key' is not in the\nunderlying mapping.\n\n-- Describe: iter(proxy)\n\nReturn an iterator over the keys of the underlying mapping.\nThis is a shortcut for 'iter(proxy.keys())'.\n\n-- Describe: len(proxy)\n\nReturn the number of items in the underlying mapping.\n\n-- Method: copy ()\n\nReturn a shallow copy of the underlying mapping.\n\n-- Method: get (key[, default])\n\nReturn the value for 'key' if 'key' is in the underlying\nmapping, else 'default'.  If 'default' is not given, it\ndefaults to 'None', so that this method never raises a *note\nKeyError: 8cf.\n\n-- Method: items ()\n\nReturn a new view of the underlying mapping's items ('(key,\nvalue)' pairs).\n\n-- Method: keys ()\n\nReturn a new view of the underlying mapping's keys.\n\n-- Method: values ()\n\nReturn a new view of the underlying mapping's values.\n\n-- Describe: reversed(proxy)\n\nReturn a reverse iterator over the keys of the underlying\nmapping.\n\nNew in version 3.9.\n\n-- Describe: hash(proxy)\n\nReturn a hash of the underlying mapping.\n\nNew in version 3.12.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0585/\n\n(2) https://peps.python.org/pep-0584/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Additional Utility Classes and Functions,  Next: Coroutine Utility Functions,  Prev: Standard Interpreter Types,  Up: types -- Dynamic type creation and names for built-in types": {
            "content": "5.8.10.3 Additional Utility Classes and Functions\n.................................................\n\n-- Class: types.SimpleNamespace\n\nA simple *note object: 8bb. subclass that provides attribute access\nto its namespace, as well as a meaningful repr.\n\nUnlike *note object: 8bb, with 'SimpleNamespace' you can add and\nremove attributes.  If a 'SimpleNamespace' object is initialized\nwith keyword arguments, those are directly added to the underlying\nnamespace.\n\nThe type is roughly equivalent to the following code:\n\nclass SimpleNamespace:\ndef init(self, /, kwargs):\nself.dict.update(kwargs)\n\ndef repr(self):\nitems = (f\"{k}={v!r}\" for k, v in self.dict.items())\nreturn \"{}({})\".format(type(self).name, \", \".join(items))\n\ndef eq(self, other):\nif isinstance(self, SimpleNamespace) and isinstance(other, SimpleNamespace):\nreturn self.dict == other.dict\nreturn NotImplemented\n\n'SimpleNamespace' may be useful as a replacement for 'class NS:\npass'.  However, for a structured record type use *note\nnamedtuple(): 711. instead.\n\nNew in version 3.3.\n\nChanged in version 3.9: Attribute order in the repr changed from\nalphabetical to insertion (like 'dict').\n\n-- Function: types.DynamicClassAttribute (fget=None, fset=None,\nfdel=None, doc=None)\n\nRoute attribute access on a class to getattr.\n\nThis is a descriptor, used to define attributes that act\ndifferently when accessed through an instance and through a class.\nInstance access remains normal, but access to an attribute through\na class will be routed to the class's getattr method; this is\ndone by raising AttributeError.\n\nThis allows one to have properties active on an instance, and have\nvirtual attributes on the class with the same name (see *note\nenum.Enum: 3fd. for an example).\n\nNew in version 3.4.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Coroutine Utility Functions,  Prev: Additional Utility Classes and Functions,  Up: types -- Dynamic type creation and names for built-in types": {
            "content": "5.8.10.4 Coroutine Utility Functions\n....................................\n\n-- Function: types.coroutine (genfunc)\n\nThis function transforms a *note generator: eda. function into a\n*note coroutine function: bd1. which returns a generator-based\ncoroutine.  The generator-based coroutine is still a *note\ngenerator iterator: a22, but is also considered to be a *note\ncoroutine: 1ae. object and is *note awaitable: ac3.  However, it\nmay not necessarily implement the *note await(): 1cce. method.\n\nIf 'genfunc' is a generator function, it will be modified\nin-place.\n\nIf 'genfunc' is not a generator function, it will be wrapped.  If\nit returns an instance of *note collections.abc.Generator: c38, the\ninstance will be wrapped in an 'awaitable' proxy object.  All other\ntypes of objects will be returned as is.\n\nNew in version 3.5.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: copy -- Shallow and deep copy operations,  Next: pprint -- Data pretty printer,  Prev: types -- Dynamic type creation and names for built-in types,  Up: Data Types": {
            "content": "'Source code:' Lib/copy.py(1)\n\n\n",
            "subsections": []
        },
        "Assignment statements in Python do not copy objects, they create": {
            "content": "bindings between a target and an object.  For collections that are\nmutable or contain mutable items, a copy is sometimes needed so one can\nchange one copy without changing the other.  This module provides\ngeneric shallow and deep copy operations (explained below).\n\nInterface summary:\n\n-- Function: copy.copy (x)\n\nReturn a shallow copy of 'x'.\n\n-- Function: copy.deepcopy (x[, memo])\n\nReturn a deep copy of 'x'.\n\n-- Exception: copy.Error\n\nRaised for module specific errors.",
            "subsections": []
        },
        "The difference between shallow and deep copying is only relevant for": {
            "content": "compound objects (objects that contain other objects, like lists or\nclass instances):\n\n* A 'shallow copy' constructs a new compound object and then (to the\nextent possible) inserts 'references' into it to the objects found\nin the original.\n\n* A 'deep copy' constructs a new compound object and then,\nrecursively, inserts 'copies' into it of the objects found in the\noriginal.\n",
            "subsections": []
        },
        "Two problems often exist with deep copy operations that don't exist with": {
            "content": "shallow copy operations:\n\n* Recursive objects (compound objects that, directly or indirectly,\ncontain a reference to themselves) may cause a recursive loop.\n\n* Because deep copy copies everything it may copy too much, such as\ndata which is intended to be shared between copies.\n\nThe *note deepcopy(): 9af. function avoids these problems by:\n\n* keeping a 'memo' dictionary of objects already copied during the\ncurrent copying pass; and\n\n* letting user-defined classes override the copying operation or the\nset of components copied.\n",
            "subsections": []
        },
        "This module does not copy types like module, method, stack trace, stack": {
            "content": "frame, file, socket, window, or any similar types.  It does \"copy\"\nfunctions and classes (shallow and deeply), by returning the original\nobject unchanged; this is compatible with the way these are treated by\nthe *note pickle: a1. module.\n\nShallow copies of dictionaries can be made using *note dict.copy(): a14,\nand of lists by assigning a slice of the entire list, for example,\n'copiedlist = originallist[:]'.\n",
            "subsections": []
        },
        "Classes can use the same interfaces to control copying that they use to": {
            "content": "control pickling.  See the description of module *note pickle: a1. for\ninformation on these methods.  In fact, the *note copy: 23. module uses\nthe registered pickle functions from the *note copyreg: 24. module.\n",
            "subsections": []
        },
        "In order for a class to define its own copy implementation, it can": {
            "content": "define special methods 'copy()' and 'deepcopy()'.  The former is\ncalled to implement the shallow copy operation; no additional arguments\nare passed.  The latter is called to implement the deep copy operation;\nit is passed one argument, the 'memo' dictionary.  If the\n'deepcopy()' implementation needs to make a deep copy of a\ncomponent, it should call the *note deepcopy(): 9af. function with the\ncomponent as first argument and the memo dictionary as second argument.\nThe memo dictionary should be treated as an opaque object.\n\nSee also\n........\n\nModule *note pickle: a1.\n\nDiscussion of the special methods used to support object state\nretrieval and restoration.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/copy.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: pprint -- Data pretty printer,  Next: reprlib -- Alternate repr implementation,  Prev: copy -- Shallow and deep copy operations,  Up: Data Types": {
            "content": "'Source code:' Lib/pprint.py(1)\n\n\n\nThe *note pprint: a9. module provides a capability to \"pretty-print\"\narbitrary Python data structures in a form which can be used as input to\nthe interpreter.  If the formatted structures include objects which are\nnot fundamental Python types, the representation may not be loadable.",
            "subsections": []
        },
        "This may be the case if objects such as files, sockets or classes are": {
            "content": "included, as well as many other objects which are not representable as\nPython literals.\n",
            "subsections": []
        },
        "The formatted representation keeps objects on a single line if it can,": {
            "content": "and breaks them onto multiple lines if they don't fit within the allowed\nwidth.  Construct *note PrettyPrinter: def. objects explicitly if you\nneed to adjust the width constraint.\n\nDictionaries are sorted by key before the display is computed.\n\nChanged in version 3.9: Added support for pretty-printing *note\ntypes.SimpleNamespace: 745.\n\nChanged in version 3.10: Added support for pretty-printing *note\ndataclasses.dataclass: 38d.\n\n* Menu:\n\n* Functions: Functions<4>.\n* PrettyPrinter Objects::\n* Example: Example<3>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/pprint.py\n\nFile: python3.12.info,  Node: Functions<4>,  Next: PrettyPrinter Objects,  Up: pprint -- Data pretty printer\n\n5.8.12.1 Functions\n..................\n\n-- Function: pprint.pp (object, *args, sortdicts=False, kwargs)\n\nPrints the formatted representation of 'object' followed by a\nnewline.  If 'sortdicts' is false (the default), dictionaries will\nbe displayed with their keys in insertion order, otherwise the dict\nkeys will be sorted.  'args' and 'kwargs' will be passed to *note\npprint(): 61d. as formatting parameters.\n\n>>> import pprint\n>>> stuff = ['spam', 'eggs', 'lumberjack', 'knights', 'ni']\n>>> stuff.insert(0, stuff)\n>>> pprint.pp(stuff)\n[<Recursion on list with id=...>,\n'spam',\n'eggs',\n'lumberjack',\n'knights',\n'ni']\n\nNew in version 3.8.\n\n-- Function: pprint.pprint (object, stream=None, indent=1, width=80,\ndepth=None, *, compact=False, sortdicts=True,\nunderscorenumbers=False)\n\nPrints the formatted representation of 'object' on 'stream',\nfollowed by a newline.  If 'stream' is 'None', *note sys.stdout:\n90c. is used.  This may be used in the interactive interpreter\ninstead of the *note print(): de5. function for inspecting values\n(you can even reassign 'print = pprint.pprint' for use within a\nscope).\n\nThe configuration parameters 'stream', 'indent', 'width', 'depth',\n'compact', 'sortdicts' and 'underscorenumbers' are passed to the\n*note PrettyPrinter: def. constructor and their meanings are as\ndescribed in its documentation below.\n\nNote that 'sortdicts' is 'True' by default and you might want to\nuse *note pp(): 84e. instead where it is 'False' by default.\n\n-- Function: pprint.pformat (object, indent=1, width=80, depth=None, *,\ncompact=False, sortdicts=True, underscorenumbers=False)\n\nReturn the formatted representation of 'object' as a string.\n'indent', 'width', 'depth', 'compact', 'sortdicts' and\n'underscorenumbers' are passed to the *note PrettyPrinter: def.\nconstructor as formatting parameters and their meanings are as\ndescribed in its documentation below.\n\n-- Function: pprint.isreadable (object)\n\nDetermine if the formatted representation of 'object' is\n\"readable\", or can be used to reconstruct the value using *note\neval(): 690.  This always returns 'False' for recursive objects.\n\n>>> pprint.isreadable(stuff)\nFalse\n\n-- Function: pprint.isrecursive (object)\n\nDetermine if 'object' requires a recursive representation.  This\nfunction is subject to the same limitations as noted in *note\nsaferepr(): 2297. below and may raise an *note RecursionError: bc6.\nif it fails to detect a recursive object.\n\n-- Function: pprint.saferepr (object)\n\nReturn a string representation of 'object', protected against\nrecursion in some common data structures, namely instances of *note\ndict: 237, *note list: 3dc. and *note tuple: 4b8. or subclasses\nwhose 'repr' has not been overridden.  If the representation of\nobject exposes a recursive entry, the recursive reference will be\nrepresented as '<Recursion on typename with id=number>'.  The\nrepresentation is not otherwise formatted.\n\n>>> pprint.saferepr(stuff)\n\"[<Recursion on list with id=...>, 'spam', 'eggs', 'lumberjack', 'knights', 'ni']\"\n\nFile: python3.12.info,  Node: PrettyPrinter Objects,  Next: Example<3>,  Prev: Functions<4>,  Up: pprint -- Data pretty printer\n\n5.8.12.2 PrettyPrinter Objects\n..............................\n\nThis module defines one class:\n\n-- Class: pprint.PrettyPrinter (indent=1, width=80, depth=None,\nstream=None, *, compact=False, sortdicts=True,\nunderscorenumbers=False)\n\nConstruct a *note PrettyPrinter: def. instance.  This constructor\nunderstands several keyword parameters.\n\n'stream' (default 'sys.stdout') is a *note file-like object: 229a.\nto which the output will be written by calling its 'write()'\nmethod.  If both 'stream' and 'sys.stdout' are 'None', then *note\npprint(): 229b. silently returns.\n\nOther values configure the manner in which nesting of complex data\nstructures is displayed.\n\n'indent' (default 1) specifies the amount of indentation added for\neach nesting level.\n\n'depth' controls the number of nesting levels which may be printed;\nif the data structure being printed is too deep, the next contained\nlevel is replaced by '...'.  By default, there is no constraint on\nthe depth of the objects being formatted.\n\n'width' (default 80) specifies the desired maximum number of\ncharacters per line in the output.  If a structure cannot be\nformatted within the width constraint, a best effort will be made.\n\n'compact' impacts the way that long sequences (lists, tuples, sets,\netc) are formatted.  If 'compact' is false (the default) then each\nitem of a sequence will be formatted on a separate line.  If\n'compact' is true, as many items as will fit within the 'width'\nwill be formatted on each output line.\n\nIf 'sortdicts' is true (the default), dictionaries will be\nformatted with their keys sorted, otherwise they will display in\ninsertion order.\n\nIf 'underscorenumbers' is true, integers will be formatted with\nthe '' character for a thousands separator, otherwise underscores\nare not displayed (the default).\n\nChanged in version 3.4: Added the 'compact' parameter.\n\nChanged in version 3.8: Added the 'sortdicts' parameter.\n\nChanged in version 3.10: Added the 'underscorenumbers' parameter.\n\nChanged in version 3.11: No longer attempts to write to\n'sys.stdout' if it is 'None'.\n\n>>> import pprint\n>>> stuff = ['spam', 'eggs', 'lumberjack', 'knights', 'ni']\n>>> stuff.insert(0, stuff[:])\n>>> pp = pprint.PrettyPrinter(indent=4)\n>>> pp.pprint(stuff)\n[   ['spam', 'eggs', 'lumberjack', 'knights', 'ni'],\n'spam',\n'eggs',\n'lumberjack',\n'knights',\n'ni']\n>>> pp = pprint.PrettyPrinter(width=41, compact=True)\n>>> pp.pprint(stuff)\n[['spam', 'eggs', 'lumberjack',\n'knights', 'ni'],\n'spam', 'eggs', 'lumberjack', 'knights',\n'ni']\n>>> tup = ('spam', ('eggs', ('lumberjack', ('knights', ('ni', ('dead',\n... ('parrot', ('fresh fruit',))))))))\n>>> pp = pprint.PrettyPrinter(depth=6)\n>>> pp.pprint(tup)\n('spam', ('eggs', ('lumberjack', ('knights', ('ni', ('dead', (...)))))))\n\n*note PrettyPrinter: def. instances have the following methods:\n\n-- Method: PrettyPrinter.pformat (object)\n\nReturn the formatted representation of 'object'.  This takes into\naccount the options passed to the *note PrettyPrinter: def.\nconstructor.\n\n-- Method: PrettyPrinter.pprint (object)\n\nPrint the formatted representation of 'object' on the configured\nstream, followed by a newline.\n",
            "subsections": []
        },
        "The following methods provide the implementations for the corresponding": {
            "content": "functions of the same names.  Using these methods on an instance is\nslightly more efficient since new *note PrettyPrinter: def. objects\ndon't need to be created.\n\n-- Method: PrettyPrinter.isreadable (object)\n\nDetermine if the formatted representation of the object is\n\"readable,\" or can be used to reconstruct the value using *note\neval(): 690.  Note that this returns 'False' for recursive objects.\nIf the 'depth' parameter of the *note PrettyPrinter: def. is set\nand the object is deeper than allowed, this returns 'False'.\n\n-- Method: PrettyPrinter.isrecursive (object)\n\nDetermine if the object requires a recursive representation.\n",
            "subsections": []
        },
        "This method is provided as a hook to allow subclasses to modify the way": {
            "content": "objects are converted to strings.  The default implementation uses the\ninternals of the *note saferepr(): 2297. implementation.\n\n-- Method: PrettyPrinter.format (object, context, maxlevels, level)\n\nReturns three values: the formatted version of 'object' as a\nstring, a flag indicating whether the result is readable, and a\nflag indicating whether recursion was detected.  The first argument\nis the object to be presented.  The second is a dictionary which\ncontains the *note id(): 1279. of objects that are part of the\ncurrent presentation context (direct and indirect containers for\n'object' that are affecting the presentation) as the keys; if an\nobject needs to be presented which is already represented in\n'context', the third return value should be 'True'.  Recursive\ncalls to the *note format(): 1683. method should add additional\nentries for containers to this dictionary.  The third argument,\n'maxlevels', gives the requested limit to recursion; this will be\n'0' if there is no requested limit.  This argument should be passed\nunmodified to recursive calls.  The fourth argument, 'level', gives\nthe current level; recursive calls should be passed a value less\nthan that of the current call.\n\nFile: python3.12.info,  Node: Example<3>,  Prev: PrettyPrinter Objects,  Up: pprint -- Data pretty printer\n\n5.8.12.3 Example\n................\n\nTo demonstrate several uses of the *note pp(): 84e. function and its\nparameters, let's fetch information about a project from PyPI(1):\n\n>>> import json\n>>> import pprint\n>>> from urllib.request import urlopen\n>>> with urlopen('https://pypi.org/pypi/sampleproject/json') as resp:\n...     projectinfo = json.load(resp)['info']\n\nIn its basic form, *note pp(): 84e. shows the whole object:\n\n>>> pprint.pp(projectinfo)\n{'author': 'The Python Packaging Authority',\n'authoremail': 'pypa-dev@googlegroups.com',\n'bugtrackurl': None,\n'classifiers': ['Development Status :: 3 - Alpha',\n'Intended Audience :: Developers',\n'License :: OSI Approved :: MIT License',\n'Programming Language :: Python :: 2',\n'Programming Language :: Python :: 2.6',\n'Programming Language :: Python :: 2.7',\n'Programming Language :: Python :: 3',\n'Programming Language :: Python :: 3.2',\n'Programming Language :: Python :: 3.3',\n'Programming Language :: Python :: 3.4',\n'Topic :: Software Development :: Build Tools'],\n'description': 'A sample Python project\\n'\n'=======================\\n'\n'\\n'\n'This is the description file for the project.\\n'\n'\\n'\n'The file should use UTF-8 encoding and be written using '\n'ReStructured Text. It\\n'\n'will be used to generate the project webpage on PyPI, and '\n'should be written for\\n'\n'that purpose.\\n'\n'\\n'\n'Typical contents for this file would include an overview of '\n'the project, basic\\n'\n'usage examples, etc. Generally, including the project '\n'changelog in here is not\\n'\n'a good idea, although a simple \"What\\'s New\" section for the '\n'most recent version\\n'\n'may be appropriate.',\n'descriptioncontenttype': None,\n'docsurl': None,\n'downloadurl': 'UNKNOWN',\n'downloads': {'lastday': -1, 'lastmonth': -1, 'lastweek': -1},\n'homepage': 'https://github.com/pypa/sampleproject',\n'keywords': 'sample setuptools development',\n'license': 'MIT',\n'maintainer': None,\n'maintaineremail': None,\n'name': 'sampleproject',\n'packageurl': 'https://pypi.org/project/sampleproject/',\n'platform': 'UNKNOWN',\n'projecturl': 'https://pypi.org/project/sampleproject/',\n'projecturls': {'Download': 'UNKNOWN',\n'Homepage': 'https://github.com/pypa/sampleproject'},\n'releaseurl': 'https://pypi.org/project/sampleproject/1.2.0/',\n'requiresdist': None,\n'requirespython': None,\n'summary': 'A sample Python project',\n'version': '1.2.0'}\n",
            "subsections": []
        },
        "The result can be limited to a certain 'depth' (ellipsis is used for": {
            "content": "deeper contents):\n\n>>> pprint.pp(projectinfo, depth=1)\n{'author': 'The Python Packaging Authority',\n'authoremail': 'pypa-dev@googlegroups.com',\n'bugtrackurl': None,\n'classifiers': [...],\n'description': 'A sample Python project\\n'\n'=======================\\n'\n'\\n'\n'This is the description file for the project.\\n'\n'\\n'\n'The file should use UTF-8 encoding and be written using '\n'ReStructured Text. It\\n'\n'will be used to generate the project webpage on PyPI, and '\n'should be written for\\n'\n'that purpose.\\n'\n'\\n'\n'Typical contents for this file would include an overview of '\n'the project, basic\\n'\n'usage examples, etc. Generally, including the project '\n'changelog in here is not\\n'\n'a good idea, although a simple \"What\\'s New\" section for the '\n'most recent version\\n'\n'may be appropriate.',\n'descriptioncontenttype': None,\n'docsurl': None,\n'downloadurl': 'UNKNOWN',\n'downloads': {...},\n'homepage': 'https://github.com/pypa/sampleproject',\n'keywords': 'sample setuptools development',\n'license': 'MIT',\n'maintainer': None,\n'maintaineremail': None,\n'name': 'sampleproject',\n'packageurl': 'https://pypi.org/project/sampleproject/',\n'platform': 'UNKNOWN',\n'projecturl': 'https://pypi.org/project/sampleproject/',\n'projecturls': {...},\n'releaseurl': 'https://pypi.org/project/sampleproject/1.2.0/',\n'requiresdist': None,\n'requirespython': None,\n'summary': 'A sample Python project',\n'version': '1.2.0'}\n",
            "subsections": []
        },
        "Additionally, maximum character 'width' can be suggested.  If a long": {
            "content": "object cannot be split, the specified width will be exceeded:\n\n>>> pprint.pp(projectinfo, depth=1, width=60)\n{'author': 'The Python Packaging Authority',\n'authoremail': 'pypa-dev@googlegroups.com',\n'bugtrackurl': None,\n'classifiers': [...],\n'description': 'A sample Python project\\n'\n'=======================\\n'\n'\\n'\n'This is the description file for the '\n'project.\\n'\n'\\n'\n'The file should use UTF-8 encoding and be '\n'written using ReStructured Text. It\\n'\n'will be used to generate the project '\n'webpage on PyPI, and should be written '\n'for\\n'\n'that purpose.\\n'\n'\\n'\n'Typical contents for this file would '\n'include an overview of the project, '\n'basic\\n'\n'usage examples, etc. Generally, including '\n'the project changelog in here is not\\n'\n'a good idea, although a simple \"What\\'s '\n'New\" section for the most recent version\\n'\n'may be appropriate.',\n'descriptioncontenttype': None,\n'docsurl': None,\n'downloadurl': 'UNKNOWN',\n'downloads': {...},\n'homepage': 'https://github.com/pypa/sampleproject',\n'keywords': 'sample setuptools development',\n'license': 'MIT',\n'maintainer': None,\n'maintaineremail': None,\n'name': 'sampleproject',\n'packageurl': 'https://pypi.org/project/sampleproject/',\n'platform': 'UNKNOWN',\n'projecturl': 'https://pypi.org/project/sampleproject/',\n'projecturls': {...},\n'releaseurl': 'https://pypi.org/project/sampleproject/1.2.0/',\n'requiresdist': None,\n'requirespython': None,\n'summary': 'A sample Python project',\n'version': '1.2.0'}\n\n---------- Footnotes ----------\n\n(1) https://pypi.org\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: reprlib -- Alternate repr implementation,  Next: enum -- Support for enumerations,  Prev: pprint -- Data pretty printer,  Up: Data Types": {
            "content": "'Source code:' Lib/reprlib.py(1)\n\n\n",
            "subsections": []
        },
        "The 'reprlib' module provides a means for producing object": {
            "content": "representations with limits on the size of the resulting strings.  This\nis used in the Python debugger and may be useful in other contexts as\nwell.\n\nThis module provides a class, an instance, and a function:\n\n-- Class: reprlib.Repr (*, maxlevel=6, maxtuple=6, maxlist=6,\nmaxarray=5, maxdict=4, maxset=6, maxfrozenset=6, maxdeque=6,\nmaxstring=30, maxlong=40, maxother=30, fillvalue='...',\nindent=None)\n\nClass which provides formatting services useful in implementing\nfunctions similar to the built-in *note repr(): 5f0.; size limits\nfor different object types are added to avoid the generation of\nrepresentations which are excessively long.\n\nThe keyword arguments of the constructor can be used as a shortcut\nto set the attributes of the *note Repr: 22a3. instance.  Which\nmeans that the following initialization:\n\naRepr = reprlib.Repr(maxlevel=3)\n\nIs equivalent to:\n\naRepr = reprlib.Repr()\naRepr.maxlevel = 3\n\nSee section *note Repr Objects: 22a4. for more information about\n*note Repr: 22a3. attributes.\n\nChanged in version 3.12: Allow attributes to be set via keyword\narguments.\n\n-- Data: reprlib.aRepr\n\nThis is an instance of *note Repr: 22a3. which is used to provide\nthe *note repr(): 22a6. function described below.  Changing the\nattributes of this object will affect the size limits used by *note\nrepr(): 22a6. and the Python debugger.\n\n-- Function: reprlib.repr (obj)\n\nThis is the *note repr(): 22a7. method of 'aRepr'.  It returns a\nstring similar to that returned by the built-in function of the\nsame name, but with limits on most sizes.\n",
            "subsections": []
        },
        "In addition to size-limiting tools, the module also provides a decorator": {
            "content": "for detecting recursive calls to *note repr(): 3e8. and substituting\na placeholder string instead.\n\n-- Function: @reprlib.recursiverepr (fillvalue='...')\n\nDecorator for *note repr(): 3e8. methods to detect recursive\ncalls within the same thread.  If a recursive call is made, the\n'fillvalue' is returned, otherwise, the usual 'repr()' call is\nmade.  For example:\n\n>>> from reprlib import recursiverepr\n>>> class MyList(list):\n...     @recursiverepr()\n...     def repr(self):\n...         return '<' + '|'.join(map(repr, self)) + '>'\n...\n>>> m = MyList('abc')\n>>> m.append(m)\n>>> m.append('x')\n>>> print(m)\n<'a'|'b'|'c'|...|'x'>\n\nNew in version 3.2.\n\n* Menu:\n\n* Repr Objects::\n* Subclassing Repr Objects::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/reprlib.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Repr Objects,  Next: Subclassing Repr Objects,  Up: reprlib -- Alternate repr implementation": {
            "content": "5.8.13.1 Repr Objects\n.....................\n\n*note Repr: 22a3. instances provide several attributes which can be used\nto provide size limits for the representations of different object\ntypes, and methods which format specific object types.\n\n-- Attribute: Repr.fillvalue\n\nThis string is displayed for recursive references.  It defaults to\n'...'.\n\nNew in version 3.11.\n\n-- Attribute: Repr.maxlevel\n\nDepth limit on the creation of recursive representations.  The\ndefault is '6'.\n\n-- Attribute: Repr.maxdict\n-- Attribute: Repr.maxlist\n-- Attribute: Repr.maxtuple\n-- Attribute: Repr.maxset\n-- Attribute: Repr.maxfrozenset\n-- Attribute: Repr.maxdeque\n-- Attribute: Repr.maxarray\n\nLimits on the number of entries represented for the named object\ntype.  The default is '4' for *note maxdict: 22ab, '5' for *note\nmaxarray: 22b1, and '6' for the others.\n\n-- Attribute: Repr.maxlong\n\nMaximum number of characters in the representation for an integer.\nDigits are dropped from the middle.  The default is '40'.\n\n-- Attribute: Repr.maxstring\n\nLimit on the number of characters in the representation of the\nstring.  Note that the \"normal\" representation of the string is\nused as the character source: if escape sequences are needed in the\nrepresentation, these may be mangled when the representation is\nshortened.  The default is '30'.\n\n-- Attribute: Repr.maxother\n\nThis limit is used to control the size of object types for which no\nspecific formatting method is available on the *note Repr: 22a3.\nobject.  It is applied in a similar manner as *note maxstring:\n22b3.  The default is '20'.\n\n-- Attribute: Repr.indent\n\nIf this attribute is set to 'None' (the default), the output is\nformatted with no line breaks or indentation, like the standard\n*note repr(): 5f0.  For example:\n\n>>> example = [\n...     1, 'spam', {'a': 2, 'b': 'spam eggs', 'c': {3: 4.5, 6: []}}, 'ham']\n>>> import reprlib\n>>> aRepr = reprlib.Repr()\n>>> print(aRepr.repr(example))\n[1, 'spam', {'a': 2, 'b': 'spam eggs', 'c': {3: 4.5, 6: []}}, 'ham']\n\nIf *note indent: 22b5. is set to a string, each recursion level is\nplaced on its own line, indented by that string:\n\n>>> aRepr.indent = '-->'\n>>> print(aRepr.repr(example))\n[\n-->1,\n-->'spam',\n-->{\n-->-->'a': 2,\n-->-->'b': 'spam eggs',\n-->-->'c': {\n-->-->-->3: 4.5,\n-->-->-->6: [],\n-->-->},\n-->},\n-->'ham',\n]\n\nSetting *note indent: 22b5. to a positive integer value behaves as\nif it was set to a string with that number of spaces:\n\n>>> aRepr.indent = 4\n>>> print(aRepr.repr(example))\n[\n1,\n'spam',\n{\n'a': 2,\n'b': 'spam eggs',\n'c': {\n3: 4.5,\n6: [],\n},\n},\n'ham',\n]\n\nNew in version 3.12.\n\n-- Method: Repr.repr (obj)\n\nThe equivalent to the built-in *note repr(): 5f0. that uses the\nformatting imposed by the instance.\n\n-- Method: Repr.repr1 (obj, level)\n\nRecursive implementation used by *note repr(): 22a7.  This uses the\ntype of 'obj' to determine which formatting method to call, passing\nit 'obj' and 'level'.  The type-specific methods should call *note\nrepr1(): 22b6. to perform recursive formatting, with 'level - 1'\nfor the value of 'level' in the recursive call.\n\n-- Method: Repr.reprTYPE (obj, level)\n\nFormatting methods for specific types are implemented as methods\nwith a name based on the type name.  In the method name, 'TYPE' is\nreplaced by '''.join(type(obj).name.split())'.  Dispatch to\nthese methods is handled by *note repr1(): 22b6.  Type-specific\nmethods which need to recursively format a value should call\n'self.repr1(subobj, level - 1)'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Subclassing Repr Objects,  Prev: Repr Objects,  Up: reprlib -- Alternate repr implementation": {
            "content": "5.8.13.2 Subclassing Repr Objects\n.................................\n\nThe use of dynamic dispatching by *note Repr.repr1(): 22b6. allows\nsubclasses of *note Repr: 22a3. to add support for additional built-in\nobject types or to modify the handling of types already supported.  This\nexample shows how special support for file objects could be added:\n\nimport reprlib\nimport sys\n\nclass MyRepr(reprlib.Repr):\n\ndef reprTextIOWrapper(self, obj, level):\nif obj.name in {'<stdin>', '<stdout>', '<stderr>'}:\nreturn obj.name\nreturn repr(obj)\n\naRepr = MyRepr()\nprint(aRepr.repr(sys.stdin))         # prints '<stdin>'\n\n<stdin>\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: enum -- Support for enumerations,  Next: graphlib -- Functionality to operate with graph-like structures,  Prev: reprlib -- Alternate repr implementation,  Up: Data Types": {
            "content": "New in version 3.4.\n\n'Source code:' Lib/enum.py(1)\n",
            "subsections": []
        },
        "Important": {
            "content": ".........\n",
            "subsections": []
        },
        "This page contains the API reference information.  For tutorial": {
            "content": "information and discussion of more advanced topics, see\n\n* *note Basic Tutorial: 1069.\n\n* *note Advanced Tutorial: 106a.\n\n* *note Logging Cookbook: 106b.\n\n\n",
            "subsections": []
        },
        "New in version 3.6: 'Flag', 'IntFlag', 'auto'": {
            "content": "",
            "subsections": []
        },
        "New in version 3.11: 'StrEnum', 'EnumCheck', 'ReprEnum', 'FlagBoundary',": {
            "content": "'property', 'member', 'nonmember', 'globalenum', 'showflagvalues'\n\n\n\nFile: python3.12.info,  Node: Data Types<2>,  Next: Utilities and Decorators,  Prev: Module Contents<2>,  Up: enum -- Support for enumerations\n\n5.8.14.2 Data Types\n...................\n\n-- Class: enum.EnumType\n\n'EnumType' is the *note metaclass: 1c8e. for 'enum' enumerations.\nIt is possible to subclass 'EnumType' - see *note Subclassing\nEnumType: 22c4. for details.\n\n'EnumType' is responsible for setting the correct 'repr()',\n'str()', 'format()', and 'reduce()' methods on the\nfinal 'enum', as well as creating the enum members, properly\nhandling duplicates, providing iteration over the enum class, etc.\n\n-- Method: call (cls, value, names=None, *, module=None,\nqualname=None, type=None, start=1, boundary=None)\n\nThis method is called in two different ways:\n\n* to look up an existing member:\n\n\ncls: The enum class being called.\n\n\nvalue: The value to lookup.\n\n* to use the 'cls' enum to create a new enum (only if the\nexisting enum does not have any members):\n\n\ncls: The enum class being called.\n\n\nvalue: The name of the new Enum to create.\n\n\nnames: The names/values of the members for the new\nEnum.\n\n\nmodule: The name of the module the new Enum is\ncreated in.\n\n\nqualname: The actual location in the module where\nthis Enum can be found.\n\n\ntype: A mix-in type for the new Enum.\n\n\nstart: The first integer value for the Enum (used by\n*note auto: aeb.).\n\n\nboundary: How to handle out-of-range values from bit\noperations (*note Flag: 3ef. only).\n\n-- Method: contains (cls, member)\n\nReturns 'True' if member belongs to the 'cls':\n\n>>> somevar = Color.RED\n>>> somevar in Color\nTrue\n>>> Color.RED.value in Color\nTrue\n\nChanged in version 3.12: Before Python 3.12, a 'TypeError' is\nraised if a non-Enum-member is used in a containment check.\n\n-- Method: dir (cls)\n\nReturns '['class', 'doc', 'members',\n'module']' and the names of the members in 'cls':\n\n>>> dir(Color)\n['BLUE', 'GREEN', 'RED', 'class', 'contains', 'doc', 'getitem', 'initsubclass', 'iter', 'len', 'members', 'module', 'name', 'qualname']\n\n-- Method: getitem (cls, name)\n\nReturns the Enum member in 'cls' matching 'name', or raises a\n*note KeyError: 8cf.:\n\n>>> Color['BLUE']\n<Color.BLUE: 3>\n\n-- Method: iter (cls)\n\nReturns each member in 'cls' in definition order:\n\n>>> list(Color)\n[<Color.RED: 1>, <Color.GREEN: 2>, <Color.BLUE: 3>]\n\n-- Method: len (cls)\n\nReturns the number of member in 'cls':\n\n>>> len(Color)\n3\n\n-- Attribute: members\n\nReturns a mapping of every enum name to its member, including\naliases\n\n-- Method: reversed (cls)\n\nReturns each member in 'cls' in reverse definition order:\n\n>>> list(reversed(Color))\n[<Color.BLUE: 3>, <Color.GREEN: 2>, <Color.RED: 1>]\n\nNew in version 3.11: Before 3.11 'enum' used 'EnumMeta' type, which\nis kept as an alias.\n\n-- Class: enum.Enum\n\n'Enum' is the base class for all 'enum' enumerations.\n\n-- Attribute: name\n\nThe name used to define the 'Enum' member:\n\n>>> Color.BLUE.name\n'BLUE'\n\n-- Attribute: value\n\nThe value given to the 'Enum' member:\n\n>>> Color.RED.value\n1\n\nValue of the member, can be set in *note new(): 2e2.\n\nNote: Enum member values\n\nMember values can be anything: *note int: 17e, *note str:\n157, etc.  If the exact value is unimportant you may use\n*note auto: aeb. instances and an appropriate value will\nbe chosen for you.  See *note auto: aeb. for the details.\n\nWhile mutable/unhashable values, such as *note dict: 237,\n*note list: 3dc. or a mutable *note dataclass: 38d, can\nbe used, they will have a quadratic performance impact\nduring creation relative to the total number of\nmutable/unhashable values in the enum.\n\n-- Attribute: name\n\nName of the member.\n\n-- Attribute: value\n\nValue of the member, can be set in *note new(): 2e2.\n\n-- Attribute: order\n\nNo longer used, kept for backward compatibility.  (class\nattribute, removed during class creation).\n\n-- Attribute: ignore\n\n'ignore' is only used during creation and is removed from\nthe enumeration once creation is complete.\n\n'ignore' is a list of names that will not become members,\nand whose names will also be removed from the completed\nenumeration.  See *note TimePeriod: 22d3. for an example.\n\n-- Method: dir (self)\n\nReturns '['class', 'doc', 'module', 'name',\n'value']' and any public methods defined on 'self.class':\n\n>>> from datetime import date\n>>> class Weekday(Enum):\n...     MONDAY = 1\n...     TUESDAY = 2\n...     WEDNESDAY = 3\n...     THURSDAY = 4\n...     FRIDAY = 5\n...     SATURDAY = 6\n...     SUNDAY = 7\n...     @classmethod\n...     def today(cls):\n...         print('today is %s' % cls(date.today().isoweekday()).name)\n...\n>>> dir(Weekday.SATURDAY)\n['class', 'doc', 'eq', 'hash', 'module', 'name', 'today', 'value']\n\n-- Method: generatenextvalue (name, start, count, lastvalues)\n\n\nname: The name of the member being defined (e.g.  'RED').\n\n\nstart: The start value for the Enum; the default is 1.\n\n\ncount: The number of members currently defined, not\nincluding this one.\n\n\nlastvalues: A list of the previous values.\n\nA 'staticmethod' that is used to determine the next value\nreturned by *note auto: aeb.:\n\n>>> from enum import auto\n>>> class PowersOfThree(Enum):\n...     @staticmethod\n...     def generatenextvalue(name, start, count, lastvalues):\n...         return 3  (count + 1)\n...     FIRST = auto()\n...     SECOND = auto()\n...\n>>> PowersOfThree.SECOND.value\n9\n\n-- Method: init (self, *args, kwds)\n\nBy default, does nothing.  If multiple values are given in the\nmember assignment, those values become separate arguments to\n'init'; e.g.\n\n>>> from enum import Enum\n>>> class Weekday(Enum):\n...     MONDAY = 1, 'Mon'\n\n'Weekday.init()' would be called as\n'Weekday.init(self, 1, 'Mon')'\n\n-- Method: initsubclass (cls, kwds)\n\nA 'classmethod' that is used to further configure subsequent\nsubclasses.  By default, does nothing.\n\n-- Method: missing (cls, value)\n\nA 'classmethod' for looking up values not found in 'cls'.  By\ndefault it does nothing, but can be overridden to implement\ncustom search behavior:\n\n>>> from enum import StrEnum\n>>> class Build(StrEnum):\n...     DEBUG = auto()\n...     OPTIMIZED = auto()\n...     @classmethod\n...     def missing(cls, value):\n...         value = value.lower()\n...         for member in cls:\n...             if member.value == value:\n...                 return member\n...         return None\n...\n>>> Build.DEBUG.value\n'debug'\n>>> Build('deBUG')\n<Build.DEBUG: 'debug'>\n\n-- Method: new (cls, *args, kwds)\n\nBy default, doesn't exist.  If specified, either in the enum\nclass definition or in a mixin class (such as 'int'), all\nvalues given in the member assignment will be passed; e.g.\n\n>>> from enum import Enum\n>>> class MyIntEnum(Enum):\n...     SEVENTEEN = '1a', 16\n\nresults in the call 'int('1a', 16)' and a value of '17' for\nthe member.\n\n..note:: When writing a custom 'new', do not use 'super().new' -\n\ncall the appropriate 'new' instead.\n\n-- Method: repr (self)\n\nReturns the string used for 'repr()' calls.  By default,\nreturns the 'Enum' name, member name, and value, but can be\noverridden:\n\n>>> class OtherStyle(Enum):\n...     ALTERNATE = auto()\n...     OTHER = auto()\n...     SOMETHINGELSE = auto()\n...     def repr(self):\n...         clsname = self.class.name\n...         return f'{clsname}.{self.name}'\n...\n>>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), f\"{OtherStyle.ALTERNATE}\"\n(OtherStyle.ALTERNATE, 'OtherStyle.ALTERNATE', 'OtherStyle.ALTERNATE')\n\n-- Method: str (self)\n\nReturns the string used for 'str()' calls.  By default,\nreturns the 'Enum' name and member name, but can be\noverridden:\n\n>>> class OtherStyle(Enum):\n...     ALTERNATE = auto()\n...     OTHER = auto()\n...     SOMETHINGELSE = auto()\n...     def str(self):\n...         return f'{self.name}'\n...\n>>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), f\"{OtherStyle.ALTERNATE}\"\n(<OtherStyle.ALTERNATE: 1>, 'ALTERNATE', 'ALTERNATE')\n\n-- Method: format (self)\n\nReturns the string used for 'format()' and 'f-string' calls.\nBy default, returns *note str(): 3ee. return value, but\ncan be overridden:\n\n>>> class OtherStyle(Enum):\n...     ALTERNATE = auto()\n...     OTHER = auto()\n...     SOMETHINGELSE = auto()\n...     def format(self, spec):\n...         return f'{self.name}'\n...\n>>> OtherStyle.ALTERNATE, str(OtherStyle.ALTERNATE), f\"{OtherStyle.ALTERNATE}\"\n(<OtherStyle.ALTERNATE: 1>, 'OtherStyle.ALTERNATE', 'ALTERNATE')\n\nNote: Using *note auto: aeb. with *note Enum: 3fd. results in\nintegers of increasing value, starting with '1'.\n\nChanged in version 3.12: Added *note Dataclass support: 14d6.\n\n-- Class: enum.IntEnum\n\n'IntEnum' is the same as 'Enum', but its members are also integers\nand can be used anywhere that an integer can be used.  If any\ninteger operation is performed with an 'IntEnum' member, the\nresulting value loses its enumeration status.\n\n>>> from enum import IntEnum\n>>> class Number(IntEnum):\n...     ONE = 1\n...     TWO = 2\n...     THREE = 3\n...\n>>> Number.THREE\n<Number.THREE: 3>\n>>> Number.ONE + Number.TWO\n3\n>>> Number.THREE + 5\n8\n>>> Number.THREE == 3\nTrue\n\nNote: Using *note auto: aeb. with *note IntEnum: b2e. results\nin integers of increasing value, starting with '1'.\n\nChanged in version 3.11: *note str(): 3e9. is now\n'int.str()' to better support the 'replacement of existing\nconstants' use-case.  *note format(): 3ea. was already\n'int.format()' for that same reason.\n\n-- Class: enum.StrEnum\n\n'StrEnum' is the same as 'Enum', but its members are also strings\nand can be used in most of the same places that a string can be\nused.  The result of any string operation performed on or with a\n'StrEnum' member is not part of the enumeration.\n\nNote: There are places in the stdlib that check for an exact\n*note str: 157. instead of a *note str: 157. subclass (i.e.\n'type(unknown) == str' instead of 'isinstance(unknown, str)'),\nand in those locations you will need to use\n'str(StrEnum.member)'.\n\nNote: Using *note auto: aeb. with *note StrEnum: 3e6. results\nin the lower-cased member name as the value.\n\nNote: *note str(): 3e9. is 'str.str()' to better\nsupport the 'replacement of existing constants' use-case.\n*note format(): 3ea. is likewise 'str.format()' for\nthat same reason.\n\nNew in version 3.11.\n\n-- Class: enum.Flag\n\n'Flag' is the same as *note Enum: 3fd, but its members support the\nbitwise operators '&' ('AND'), '|' ('OR'), '^' ('XOR'), and '~'\n('INVERT'); the results of those operators are members of the\nenumeration.\n\n-- Method: contains (self, value)\n\nReturns 'True' if value is in self:\n\n>>> from enum import Flag, auto\n>>> class Color(Flag):\n...     RED = auto()\n...     GREEN = auto()\n...     BLUE = auto()\n...\n>>> purple = Color.RED | Color.BLUE\n>>> white = Color.RED | Color.GREEN | Color.BLUE\n>>> Color.GREEN in purple\nFalse\n>>> Color.GREEN in white\nTrue\n>>> purple in white\nTrue\n>>> white in purple\nFalse\n\n-- Method: iter(self):\n\nReturns all contained non-alias members:\n\n>>> list(Color.RED)\n[<Color.RED: 1>]\n>>> list(purple)\n[<Color.RED: 1>, <Color.BLUE: 4>]\n\nNew in version 3.11.\n\n-- Method: len(self):\n\nReturns number of members in flag:\n\n>>> len(Color.GREEN)\n1\n>>> len(white)\n3\n\n-- Method: bool(self):\n\nReturns 'True' if any members in flag, 'False' otherwise:\n\n>>> bool(Color.GREEN)\nTrue\n>>> bool(white)\nTrue\n>>> black = Color(0)\n>>> bool(black)\nFalse\n\n-- Method: or (self, other)\n\nReturns current flag binary or'ed with other:\n\n>>> Color.RED | Color.GREEN\n<Color.RED|GREEN: 3>\n\n-- Method: and (self, other)\n\nReturns current flag binary and'ed with other:\n\n>>> purple & white\n<Color.RED|BLUE: 5>\n>>> purple & Color.GREEN\n<Color: 0>\n\n-- Method: xor (self, other)\n\nReturns current flag binary xor'ed with other:\n\n>>> purple ^ white\n<Color.GREEN: 2>\n>>> purple ^ Color.GREEN\n<Color.RED|GREEN|BLUE: 7>\n\n-- Method: invert(self):\n\nReturns all the flags in 'type(self)' that are not in self:\n\n>>> ~white\n<Color: 0>\n>>> ~purple\n<Color.GREEN: 2>\n>>> ~Color.RED\n<Color.GREEN|BLUE: 6>\n\n-- Method: numericrepr ()\n\nFunction used to format any remaining unnamed numeric values.\nDefault is the value's repr; common choices are *note hex():\n1143. and *note oct(): 1142.\n\nNote: Using *note auto: aeb. with *note Flag: 3ef. results in\nintegers that are powers of two, starting with '1'.\n\nChanged in version 3.11: The 'repr()' of zero-valued flags has\nchanged.  It is now::\n\n>>> Color(0)\n<Color: 0>\n\n-- Class: enum.IntFlag\n\n'IntFlag' is the same as 'Flag', but its members are also integers\nand can be used anywhere that an integer can be used.\n\n>>> from enum import IntFlag, auto\n>>> class Color(IntFlag):\n...     RED = auto()\n...     GREEN = auto()\n...     BLUE = auto()\n...\n>>> Color.RED & 2\n<Color: 0>\n>>> Color.RED | 2\n<Color.RED|GREEN: 3>\n\nIf any integer operation is performed with an 'IntFlag' member, the\nresult is not an 'IntFlag':\n\n>>> Color.RED + 2\n3\n\nIf a 'Flag' operation is performed with an 'IntFlag' member and:\n\n* the result is a valid 'IntFlag': an 'IntFlag' is returned\n\n* the result is not a valid 'IntFlag': the result depends on the\n'FlagBoundary' setting\n\nThe 'repr()' of unnamed zero-valued flags has changed.  It is now:\n\n>>> Color(0)\n<Color: 0>\n\nNote: Using *note auto: aeb. with *note IntFlag: 200b. results\nin integers that are powers of two, starting with '1'.\n\nChanged in version 3.11: *note str(): 3e9. is now\n'int.str()' to better support the 'replacement of existing\nconstants' use-case.  *note format(): 3ea. was already\n'int.format()' for that same reason.\n\nInversion of an 'IntFlag' now returns a positive value that is the\nunion of all flags not in the given flag, rather than a negative\nvalue.  This matches the existing *note Flag: 3ef. behavior.\n\n-- Class: enum.ReprEnum\n\n'ReprEnum' uses the *note repr(): 14d7. of *note Enum: 3fd, but the\n*note str(): 157. of the mixed-in data type:\n\n* 'int.str()' for *note IntEnum: b2e. and *note IntFlag:\n200b.\n\n* 'str.str()' for *note StrEnum: 3e6.\n\nInherit from 'ReprEnum' to keep the *note str(): 157. / *note\nformat(): 3eb. of the mixed-in data type instead of using the *note\nEnum: 3fd.-default *note str(): 3ee.\n\nNew in version 3.11.\n\n-- Class: enum.EnumCheck\n\n'EnumCheck' contains the options used by the *note verify(): 3f1.\ndecorator to ensure various constraints; failed constraints result\nin a *note ValueError: 183.\n\n-- Attribute: UNIQUE\n\nEnsure that each value has only one name:\n\n>>> from enum import Enum, verify, UNIQUE\n>>> @verify(UNIQUE)\n... class Color(Enum):\n...     RED = 1\n...     GREEN = 2\n...     BLUE = 3\n...     CRIMSON = 1\nTraceback (most recent call last):\n...\nValueError: aliases found in <enum 'Color'>: CRIMSON -> RED\n\n-- Attribute: CONTINUOUS\n\nEnsure that there are no missing values between the\nlowest-valued member and the highest-valued member:\n\n>>> from enum import Enum, verify, CONTINUOUS\n>>> @verify(CONTINUOUS)\n... class Color(Enum):\n...     RED = 1\n...     GREEN = 2\n...     BLUE = 5\nTraceback (most recent call last):\n...\nValueError: invalid enum 'Color': missing values 3, 4\n\n-- Attribute: NAMEDFLAGS\n\nEnsure that any flag groups/masks contain only named flags -\nuseful when values are specified instead of being generated by\n*note auto(): aeb.:\n\n>>> from enum import Flag, verify, NAMEDFLAGS\n>>> @verify(NAMEDFLAGS)\n... class Color(Flag):\n...     RED = 1\n...     GREEN = 2\n...     BLUE = 4\n...     WHITE = 15\n...     NEON = 31\nTraceback (most recent call last):\n...\nValueError: invalid Flag 'Color': aliases WHITE and NEON are missing combined values of 0x18 [use enum.showflagvalues(value) for details]\n\nNote: CONTINUOUS and NAMEDFLAGS are designed to work with\ninteger-valued members.\n\nNew in version 3.11.\n\n-- Class: enum.FlagBoundary\n\n'FlagBoundary' controls how out-of-range values are handled in\n'Flag' and its subclasses.\n\n-- Attribute: STRICT\n\nOut-of-range values cause a *note ValueError: 183. to be\nraised.  This is the default for *note Flag: 3ef.:\n\n>>> from enum import Flag, STRICT, auto\n>>> class StrictFlag(Flag, boundary=STRICT):\n...     RED = auto()\n...     GREEN = auto()\n...     BLUE = auto()\n...\n>>> StrictFlag(22 + 24)\nTraceback (most recent call last):\n...\nValueError: <flag 'StrictFlag'> invalid value 20\ngiven 0b0 10100\nallowed 0b0 00111\n\n-- Attribute: CONFORM\n\nOut-of-range values have invalid values removed, leaving a\nvalid 'Flag' value:\n\n>>> from enum import Flag, CONFORM, auto\n>>> class ConformFlag(Flag, boundary=CONFORM):\n...     RED = auto()\n...     GREEN = auto()\n...     BLUE = auto()\n...\n>>> ConformFlag(22 + 24)\n<ConformFlag.BLUE: 4>\n\n-- Attribute: EJECT\n\nOut-of-range values lose their 'Flag' membership and revert to\n*note int: 17e.\n\n>>> from enum import Flag, EJECT, auto\n>>> class EjectFlag(Flag, boundary=EJECT):\n...     RED = auto()\n...     GREEN = auto()\n...     BLUE = auto()\n...\n>>> EjectFlag(22 + 24)\n20\n\n-- Attribute: KEEP\n\nOut-of-range values are kept, and the 'Flag' membership is\nkept.  This is the default for *note IntFlag: 200b.:\n\n>>> from enum import Flag, KEEP, auto\n>>> class KeepFlag(Flag, boundary=KEEP):\n...     RED = auto()\n...     GREEN = auto()\n...     BLUE = auto()\n...\n>>> KeepFlag(22 + 24)\n<KeepFlag.BLUE|16: 20>\n\nNew in version 3.11.\n\n\n\n* Menu:\n\n* Supported dunder names::\n* Supported sunder names::\n\nFile: python3.12.info,  Node: Supported dunder names,  Next: Supported sunder names,  Up: Data Types<2>\n\n5.8.14.3 Supported 'dunder' names\n.....................................\n\n*note members: 22cb. is a read-only ordered mapping of\n'membername':'member' items.  It is only available on the class.\n\n*note new(): 2e2, if specified, must create and return the enum\nmembers; it is also a very good idea to set the member's 'value'\nappropriately.  Once all the members are created it is no longer used.\n\nFile: python3.12.info,  Node: Supported sunder names,  Prev: Supported dunder names,  Up: Data Types<2>\n\n5.8.14.4 Supported 'sunder' names\n...................................\n\n- *note name: 22cf. - name of the member\n\n- *note value: 22d0. - value of the member; can be set in 'new'\n\n- *note missing(): 22d7. - a lookup function used when a value is\nnot found; may be overridden\n\n- *note ignore: 22d2. - a list of names, either as a *note list:\n3dc. or a *note str: 157, that will not be transformed into\nmembers, and will be removed from the final class\n\n- *note order: 22d1. - no longer used, kept for backward\ncompatibility (class attribute, removed during class creation)\n\n- *note generatenextvalue(): 22d4. - used to get an appropriate\nvalue for an enum member; may be overridden\n\nNote: For standard *note Enum: 3fd. classes the next value\nchosen is the last value seen incremented by one.\n\nFor *note Flag: 3ef. classes the next value chosen will be the\nnext highest power-of-two, regardless of the last value seen.\n",
            "subsections": []
        },
        "New in version 3.6: 'missing', 'order', 'generatenextvalue'": {
            "content": "",
            "subsections": []
        },
        "New in version 3.7: 'ignore'": {
            "content": "",
            "subsections": []
        },
        "File: python3.12.info,  Node: Notes,  Prev: Utilities and Decorators,  Up: enum -- Support for enumerations": {
            "content": "5.8.14.6 Notes\n..............\n\n*note IntEnum: b2e, *note StrEnum: 3e6, and *note IntFlag: 200b.\n\nThese three enum types are designed to be drop-in replacements for\nexisting integer- and string-based values; as such, they have extra\nlimitations:\n\n- 'str' uses the value and not the name of the enum member\n\n- 'format', because it uses 'str', will also use the\nvalue of the enum member instead of its name\n\nIf you do not need/want those limitations, you can either create\nyour own base class by mixing in the 'int' or 'str' type yourself:\n\n>>> from enum import Enum\n>>> class MyIntEnum(int, Enum):\n...     pass\n\nor you can reassign the appropriate *note str(): 157, etc., in your\nenum:\n\n>>> from enum import Enum, IntEnum\n>>> class MyIntEnum(IntEnum):\n...     str = Enum.str\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: graphlib -- Functionality to operate with graph-like structures,  Prev: enum -- Support for enumerations,  Up: Data Types": {
            "content": "'Source code:' Lib/graphlib.py(1)\n\n\n\n-- Class: graphlib.TopologicalSorter (graph=None)\n\nProvides functionality to topologically sort a graph of *note\nhashable: 3db. nodes.\n\nA topological order is a linear ordering of the vertices in a graph\nsuch that for every directed edge u -> v from vertex u to vertex v,\nvertex u comes before vertex v in the ordering.  For instance, the\nvertices of the graph may represent tasks to be performed, and the\nedges may represent constraints that one task must be performed\nbefore another; in this example, a topological ordering is just a\nvalid sequence for the tasks.  A complete topological ordering is\npossible if and only if the graph has no directed cycles, that is,\nif it is a directed acyclic graph.\n\nIf the optional 'graph' argument is provided it must be a\ndictionary representing a directed acyclic graph where the keys are\nnodes and the values are iterables of all predecessors of that node\nin the graph (the nodes that have edges that point to the value in\nthe key).  Additional nodes can be added to the graph using the\n*note add(): 22ea. method.\n\nIn the general case, the steps required to perform the sorting of a\ngiven graph are as follows:\n\n* Create an instance of the *note TopologicalSorter: 6fa. with\nan optional initial graph.\n\n* Add additional nodes to the graph.\n\n* Call *note prepare(): 22eb. on the graph.\n\n* While *note isactive(): 22ec. is 'True', iterate over the\nnodes returned by *note getready(): 22ed. and process them.\nCall *note done(): 22ee. on each node as it finishes\nprocessing.\n\nIn case just an immediate sorting of the nodes in the graph is\nrequired and no parallelism is involved, the convenience method\n*note TopologicalSorter.staticorder(): 22ef. can be used directly:\n\n>>> graph = {\"D\": {\"B\", \"C\"}, \"C\": {\"A\"}, \"B\": {\"A\"}}\n>>> ts = TopologicalSorter(graph)\n>>> tuple(ts.staticorder())\n('A', 'C', 'B', 'D')\n\nThe class is designed to easily support parallel processing of the\nnodes as they become ready.  For instance:\n\ntopologicalsorter = TopologicalSorter()\n\n# Add nodes to 'topologicalsorter'...\n\ntopologicalsorter.prepare()\nwhile topologicalsorter.isactive():\nfor node in topologicalsorter.getready():\n# Worker threads or processes take nodes to work on off the\n# 'taskqueue' queue.\ntaskqueue.put(node)\n\n# When the work for a node is done, workers put the node in\n# 'finalizedtasksqueue' so we can get more nodes to work on.\n# The definition of 'isactive()' guarantees that, at this point, at\n# least one node has been placed on 'taskqueue' that hasn't yet\n# been passed to 'done()', so this blocking 'get()' must (eventually)\n# succeed.  After calling 'done()', we loop back to call 'getready()'\n# again, so put newly freed nodes on 'taskqueue' as soon as\n# logically possible.\nnode = finalizedtasksqueue.get()\ntopologicalsorter.done(node)\n\n-- Method: add (node, *predecessors)\n\nAdd a new node and its predecessors to the graph.  Both the\n'node' and all elements in 'predecessors' must be *note\nhashable: 3db.\n\nIf called multiple times with the same node argument, the set\nof dependencies will be the union of all dependencies passed\nin.\n\nIt is possible to add a node with no dependencies\n('predecessors' is not provided) or to provide a dependency\ntwice.  If a node that has not been provided before is\nincluded among 'predecessors' it will be automatically added\nto the graph with no predecessors of its own.\n\nRaises *note ValueError: 183. if called after *note prepare():\n22eb.\n\n-- Method: prepare ()\n\nMark the graph as finished and check for cycles in the graph.\nIf any cycle is detected, *note CycleError: 22f0. will be\nraised, but *note getready(): 22ed. can still be used to\nobtain as many nodes as possible until cycles block more\nprogress.  After a call to this function, the graph cannot be\nmodified, and therefore no more nodes can be added using *note\nadd(): 22ea.\n\n-- Method: isactive ()\n\nReturns 'True' if more progress can be made and 'False'\notherwise.  Progress can be made if cycles do not block the\nresolution and either there are still nodes ready that haven't\nyet been returned by *note TopologicalSorter.getready():\n22ed. or the number of nodes marked *note\nTopologicalSorter.done(): 22ee. is less than the number that\nhave been returned by *note TopologicalSorter.getready():\n22ed.\n\nThe *note bool(): 114a. method of this class defers to\nthis function, so instead of:\n\nif ts.isactive():\n...\n\nit is possible to simply do:\n\nif ts:\n...\n\nRaises *note ValueError: 183. if called without calling *note\nprepare(): 22eb. previously.\n\n-- Method: done (*nodes)\n\nMarks a set of nodes returned by *note\nTopologicalSorter.getready(): 22ed. as processed, unblocking\nany successor of each node in 'nodes' for being returned in\nthe future by a call to *note TopologicalSorter.getready():\n22ed.\n\nRaises *note ValueError: 183. if any node in 'nodes' has\nalready been marked as processed by a previous call to this\nmethod or if a node was not added to the graph by using *note\nTopologicalSorter.add(): 22ea, if called without calling *note\nprepare(): 22eb. or if node has not yet been returned by *note\ngetready(): 22ed.\n\n-- Method: getready ()\n\nReturns a 'tuple' with all the nodes that are ready.\nInitially it returns all nodes with no predecessors, and once\nthose are marked as processed by calling *note\nTopologicalSorter.done(): 22ee, further calls will return all\nnew nodes that have all their predecessors already processed.\nOnce no more progress can be made, empty tuples are returned.\n\nRaises *note ValueError: 183. if called without calling *note\nprepare(): 22eb. previously.\n\n-- Method: staticorder ()\n\nReturns an iterator object which will iterate over nodes in a\ntopological order.  When using this method, *note prepare():\n22eb. and *note done(): 22ee. should not be called.  This\nmethod is equivalent to:\n\ndef staticorder(self):\nself.prepare()\nwhile self.isactive():\nnodegroup = self.getready()\nyield from nodegroup\nself.done(*nodegroup)\n\nThe particular order that is returned may depend on the\nspecific order in which the items were inserted in the graph.\nFor example:\n\n>>> ts = TopologicalSorter()\n>>> ts.add(3, 2, 1)\n>>> ts.add(1, 0)\n>>> print([*ts.staticorder()])\n[2, 0, 1, 3]\n\n>>> ts2 = TopologicalSorter()\n>>> ts2.add(1, 0)\n>>> ts2.add(3, 2, 1)\n>>> print([*ts2.staticorder()])\n[0, 2, 1, 3]\n\nThis is due to the fact that \"0\" and \"2\" are in the same level\nin the graph (they would have been returned in the same call\nto *note getready(): 22ed.) and the order between them is\ndetermined by the order of insertion.\n\nIf any cycle is detected, *note CycleError: 22f0. will be\nraised.\n\nNew in version 3.9.\n\n* Menu:\n\n* Exceptions: Exceptions<4>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/graphlib.py\n\nFile: python3.12.info,  Node: Exceptions<4>,  Up: graphlib -- Functionality to operate with graph-like structures\n\n5.8.15.1 Exceptions\n...................\n\nThe *note graphlib: 60. module defines the following exception classes:\n\n-- Exception: graphlib.CycleError\n\nSubclass of *note ValueError: 183. raised by *note\nTopologicalSorter.prepare(): 22eb. if cycles exist in the working\ngraph.  If multiple cycles exist, only one undefined choice among\nthem will be reported and included in the exception.\n\nThe detected cycle can be accessed via the second element in the\n*note args: 2cb. attribute of the exception instance and consists\nin a list of nodes, such that each node is, in the graph, an\nimmediate predecessor of the next node in the list.  In the\nreported list, the first and the last node will be the same, to\nmake it clear that it is cyclic.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Numeric and Mathematical Modules,  Next: Functional Programming Modules,  Prev: Data Types,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.9 Numeric and Mathematical Modules",
                    "content": ""
                }
            ]
        },
        "The modules described in this chapter provide numeric and math-related": {
            "content": "functions and data types.  The *note numbers: 99. module defines an\nabstract hierarchy of numeric types.  The *note math: 89. and *note\ncmath: 16. modules contain various mathematical functions for\nfloating-point and complex numbers.  The *note decimal: 33. module\nsupports exact representations of decimal numbers, using arbitrary\nprecision arithmetic.\n\nThe following modules are documented in this chapter:\n\n* Menu:\n\n* numbers -- Numeric abstract base classes::\n* math -- Mathematical functions::\n* cmath -- Mathematical functions for complex numbers::\n* decimal -- Decimal fixed point and floating point arithmetic::\n* fractions -- Rational numbers::\n* random -- Generate pseudo-random numbers::\n* statistics -- Mathematical statistics functions::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: numbers -- Numeric abstract base classes,  Next: math -- Mathematical functions,  Up: Numeric and Mathematical Modules": {
            "content": "'Source code:' Lib/numbers.py(1)\n\n\n\nThe 'numbers' module ( PEP 3141(2)) defines a hierarchy of numeric *note\nabstract base classes: 102a. which progressively define more operations.",
            "subsections": []
        },
        "None of the types defined in this module are intended to be": {
            "content": "instantiated.\n\n-- Class: numbers.Number\n\nThe root of the numeric hierarchy.  If you just want to check if an\nargument 'x' is a number, without caring what kind, use\n'isinstance(x, Number)'.\n\n* Menu:\n\n* The numeric tower::\n* Notes for type implementors::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/numbers.py\n\n(2) https://peps.python.org/pep-3141/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The numeric tower,  Next: Notes for type implementors,  Up: numbers -- Numeric abstract base classes": {
            "content": "5.9.1.1 The numeric tower\n.........................\n\n-- Class: numbers.Complex\n\nSubclasses of this type describe complex numbers and include the\noperations that work on the built-in *note complex: 3ad. type.\nThese are: conversions to *note complex: 3ad. and *note bool: 17d,\n*note real: 22fa, *note imag: 22fb, '+', '-', '*', '/', '', *note\nabs(): 1a29, *note conjugate(): 22fc, '==', and '!='.  All except\n'-' and '!=' are abstract.\n\n-- Attribute: real\n\nAbstract.  Retrieves the real component of this number.\n\n-- Attribute: imag\n\nAbstract.  Retrieves the imaginary component of this number.\n\n-- Method: abstractmethod conjugate ()\n\nAbstract.  Returns the complex conjugate.  For example,\n'(1+3j).conjugate() == (1-3j)'.\n\n-- Class: numbers.Real\n\nTo *note Complex: 22f9, 'Real' adds the operations that work on\nreal numbers.\n\nIn short, those are: a conversion to *note float: 4b7, *note\nmath.trunc(): 1218, *note round(): 114f, *note math.floor(): 1216,\n*note math.ceil(): 1217, *note divmod(): 7c5, '//', '%', '<', '<=',\n'>', and '>='.\n\nReal also provides defaults for *note complex(): 3ad, *note real:\n22fa, *note imag: 22fb, and *note conjugate(): 22fc.\n\n-- Class: numbers.Rational\n\nSubtypes *note Real: 1ea1. and adds *note numerator: 22fd. and\n*note denominator: 22fe. properties.  It also provides a default\nfor *note float(): 4b7.\n\nThe *note numerator: 22fd. and *note denominator: 22fe. values\nshould be instances of *note Integral: 1cc3. and should be in\nlowest terms with *note denominator: 22fe. positive.\n\n-- Attribute: numerator\n\nAbstract.\n\n-- Attribute: denominator\n\nAbstract.\n\n-- Class: numbers.Integral\n\nSubtypes *note Rational: 1136. and adds a conversion to *note int:\n17e.  Provides defaults for *note float(): 4b7, *note numerator:\n22fd, and *note denominator: 22fe.  Adds abstract methods for *note\npow(): 7f7. with modulus and bit-string operations: '<<', '>>',\n'&', '^', '|', '~'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Notes for type implementors,  Prev: The numeric tower,  Up: numbers -- Numeric abstract base classes": {
            "content": "5.9.1.2 Notes for type implementors\n...................................\n",
            "subsections": []
        },
        "Implementors should be careful to make equal numbers equal and hash them": {
            "content": "to the same values.  This may be subtle if there are two different\nextensions of the real numbers.  For example, *note fractions.Fraction:\n1a8. implements *note hash(): 3b1. as follows:\n\ndef hash(self):\nif self.denominator == 1:\n# Get integers right.\nreturn hash(self.numerator)\n# Expensive check, but definitely correct.\nif self == float(self):\nreturn hash(float(self))\nelse:\n# Use tuple's hash to avoid a high collision rate on\n# simple fractions.\nreturn hash((self.numerator, self.denominator))\n\n* Menu:\n\n* Adding More Numeric ABCs::\n* Implementing the arithmetic operations::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Adding More Numeric ABCs,  Next: Implementing the arithmetic operations,  Up: Notes for type implementors": {
            "content": "5.9.1.3 Adding More Numeric ABCs\n................................\n",
            "subsections": []
        },
        "There are, of course, more possible ABCs for numbers, and this would be": {
            "content": "a poor hierarchy if it precluded the possibility of adding those.  You\ncan add 'MyFoo' between *note Complex: 22f9. and *note Real: 1ea1. with:\n\nclass MyFoo(Complex): ...\nMyFoo.register(Real)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Implementing the arithmetic operations,  Prev: Adding More Numeric ABCs,  Up: Notes for type implementors": {
            "content": "5.9.1.4 Implementing the arithmetic operations\n..............................................\n",
            "subsections": []
        },
        "We want to implement the arithmetic operations so that mixed-mode": {
            "content": "operations either call an implementation whose author knew about the\ntypes of both arguments, or convert both to the nearest built in type\nand do the operation there.  For subtypes of *note Integral: 1cc3, this\nmeans that *note add(): 1c93. and *note radd(): 1c94. should be\ndefined as:\n\nclass MyIntegral(Integral):\n\ndef add(self, other):\nif isinstance(other, MyIntegral):\nreturn domyaddingstuff(self, other)\nelif isinstance(other, OtherTypeIKnowAbout):\nreturn domyotheraddingstuff(self, other)\nelse:\nreturn NotImplemented\n\ndef radd(self, other):\nif isinstance(other, MyIntegral):\nreturn domyaddingstuff(other, self)\nelif isinstance(other, OtherTypeIKnowAbout):\nreturn domyotheraddingstuff(other, self)\nelif isinstance(other, Integral):\nreturn int(other) + int(self)\nelif isinstance(other, Real):\nreturn float(other) + float(self)\nelif isinstance(other, Complex):\nreturn complex(other) + complex(self)\nelse:\nreturn NotImplemented\n",
            "subsections": []
        },
        "There are 5 different cases for a mixed-type operation on subclasses of": {
            "content": "*note Complex: 22f9.  I'll refer to all of the above code that doesn't\nrefer to 'MyIntegral' and 'OtherTypeIKnowAbout' as \"boilerplate\".  'a'\nwill be an instance of 'A', which is a subtype of *note Complex: 22f9.\n('a : A <: Complex'), and 'b : B <: Complex'.  I'll consider 'a + b':\n\n1. If 'A' defines an *note add(): 1c93. which accepts 'b', all is\nwell.\n\n2. If 'A' falls back to the boilerplate code, and it were to return a\nvalue from *note add(): 1c93, we'd miss the possibility that\n'B' defines a more intelligent *note radd(): 1c94, so the\nboilerplate should return *note NotImplemented: 5c5. from\n'add()'.  (Or 'A' may not implement 'add()' at all.)\n\n3. Then 'B''s *note radd(): 1c94. gets a chance.  If it accepts\n'a', all is well.\n\n4. If it falls back to the boilerplate, there are no more possible\nmethods to try, so this is where the default implementation should\nlive.\n\n5. If 'B <: A', Python tries 'B.radd' before 'A.add'.  This is\nok, because it was implemented with knowledge of 'A', so it can\nhandle those instances before delegating to *note Complex: 22f9.\n\nIf 'A <: Complex' and 'B <: Real' without sharing any other knowledge,\nthen the appropriate shared operation is the one involving the built in\n*note complex: 3ad, and both *note radd(): 1c94. s land there, so\n'a+b == b+a'.\n",
            "subsections": []
        },
        "Because most of the operations on any given type will be very similar,": {
            "content": "it can be useful to define a helper function which generates the forward\nand reverse instances of any given operator.  For example, *note\nfractions.Fraction: 1a8. uses:\n\ndef operatorfallbacks(monomorphicoperator, fallbackoperator):\ndef forward(a, b):\nif isinstance(b, (int, Fraction)):\nreturn monomorphicoperator(a, b)\nelif isinstance(b, float):\nreturn fallbackoperator(float(a), b)\nelif isinstance(b, complex):\nreturn fallbackoperator(complex(a), b)\nelse:\nreturn NotImplemented\nforward.name = '' + fallbackoperator.name + ''\nforward.doc = monomorphicoperator.doc\n\ndef reverse(b, a):\nif isinstance(a, Rational):\n# Includes ints.\nreturn monomorphicoperator(a, b)\nelif isinstance(a, Real):\nreturn fallbackoperator(float(a), float(b))\nelif isinstance(a, Complex):\nreturn fallbackoperator(complex(a), complex(b))\nelse:\nreturn NotImplemented\nreverse.name = 'r' + fallbackoperator.name + ''\nreverse.doc = monomorphicoperator.doc\n\nreturn forward, reverse\n\ndef add(a, b):\n\"\"\"a + b\"\"\"\nreturn Fraction(a.numerator * b.denominator +\nb.numerator * a.denominator,\na.denominator * b.denominator)\n\nadd, radd = operatorfallbacks(add, operator.add)\n\n# ...\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: math -- Mathematical functions,  Next: cmath -- Mathematical functions for complex numbers,  Prev: numbers -- Numeric abstract base classes,  Up: Numeric and Mathematical Modules": {
            "content": "",
            "subsections": []
        },
        "This module provides access to the mathematical functions defined by the": {
            "content": "C standard.\n",
            "subsections": []
        },
        "These functions cannot be used with complex numbers; use the functions": {
            "content": "of the same name from the *note cmath: 16. module if you require support\nfor complex numbers.  The distinction between functions which support\ncomplex numbers and those which don't is made since most users do not\nwant to learn quite as much mathematics as required to understand\ncomplex numbers.  Receiving an exception instead of a complex result\nallows earlier detection of the unexpected complex number used as a\nparameter, so that the programmer can determine how and why it was\ngenerated in the first place.\n",
            "subsections": []
        },
        "The following functions are provided by this module.  Except when": {
            "content": "explicitly noted otherwise, all return values are floats.\n\n* Menu:\n\n* Number-theoretic and representation functions::\n* Power and logarithmic functions::\n* Trigonometric functions::\n* Angular conversion::\n* Hyperbolic functions::\n* Special functions::\n* Constants: Constants<2>.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Number-theoretic and representation functions,  Next: Power and logarithmic functions,  Up: math -- Mathematical functions": {
            "content": "5.9.2.1 Number-theoretic and representation functions\n.....................................................\n\n-- Function: math.ceil (x)\n\nReturn the ceiling of 'x', the smallest integer greater than or\nequal to 'x'.  If 'x' is not a float, delegates to *note\nx.ceil: 1cc2, which should return an *note Integral: 1cc3.\nvalue.\n\n-- Function: math.comb (n, k)\n\nReturn the number of ways to choose 'k' items from 'n' items\nwithout repetition and without order.\n\nEvaluates to 'n! / (k! * (n - k)!)' when 'k <= n' and evaluates to\nzero when 'k > n'.\n\nAlso called the binomial coefficient because it is equivalent to\nthe coefficient of k-th term in polynomial expansion of '(1 + x)???'.\n\nRaises *note TypeError: 28e. if either of the arguments are not\nintegers.  Raises *note ValueError: 183. if either of the arguments\nare negative.\n\nNew in version 3.8.\n\n-- Function: math.copysign (x, y)\n\nReturn a float with the magnitude (absolute value) of 'x' but the\nsign of 'y'.  On platforms that support signed zeros,\n'copysign(1.0, -0.0)' returns '-1.0'.\n\n-- Function: math.fabs (x)\n\nReturn the absolute value of 'x'.\n\n-- Function: math.factorial (n)\n\nReturn 'n' factorial as an integer.  Raises *note ValueError: 183.\nif 'n' is not integral or is negative.\n\nDeprecated since version 3.9: Accepting floats with integral values\n(like '5.0') is deprecated.\n\n-- Function: math.floor (x)\n\nReturn the floor of 'x', the largest integer less than or equal to\n'x'.  If 'x' is not a float, delegates to *note x.floor: 1cc1,\nwhich should return an *note Integral: 1cc3. value.\n\n-- Function: math.fmod (x, y)\n\nReturn 'fmod(x, y)', as defined by the platform C library.  Note\nthat the Python expression 'x % y' may not return the same result.\nThe intent of the C standard is that 'fmod(x, y)' be exactly\n(mathematically; to infinite precision) equal to 'x - n*y' for some\ninteger 'n' such that the result has the same sign as 'x' and\nmagnitude less than 'abs(y)'.  Python's 'x % y' returns a result\nwith the sign of 'y' instead, and may not be exactly computable for\nfloat arguments.  For example, 'fmod(-1e-100, 1e100)' is '-1e-100',\nbut the result of Python's '-1e-100 % 1e100' is '1e100-1e-100',\nwhich cannot be represented exactly as a float, and rounds to the\nsurprising '1e100'.  For this reason, function *note fmod(): 1d76.\nis generally preferred when working with floats, while Python's 'x\n% y' is preferred when working with integers.\n\n-- Function: math.frexp (x)\n\nReturn the mantissa and exponent of 'x' as the pair '(m, e)'.  'm'\nis a float and 'e' is an integer such that 'x == m * 2e' exactly.\nIf 'x' is zero, returns '(0.0, 0)', otherwise '0.5 <= abs(m) < 1'.\nThis is used to \"pick apart\" the internal representation of a float\nin a portable way.\n\n-- Function: math.fsum (iterable)\n\nReturn an accurate floating point sum of values in the iterable.\nAvoids loss of precision by tracking multiple intermediate partial\nsums.\n\nThe algorithm's accuracy depends on IEEE-754 arithmetic guarantees\nand the typical case where the rounding mode is half-even.  On some\nnon-Windows builds, the underlying C library uses extended\nprecision addition and may occasionally double-round an\nintermediate sum causing it to be off in its least significant bit.\n\nFor further discussion and two alternative approaches, see the ASPN\ncookbook recipes for accurate floating point summation(1).\n\n-- Function: math.gcd (*integers)\n\nReturn the greatest common divisor of the specified integer\narguments.  If any of the arguments is nonzero, then the returned\nvalue is the largest positive integer that is a divisor of all\narguments.  If all arguments are zero, then the returned value is\n'0'.  'gcd()' without arguments returns '0'.\n\nNew in version 3.5.\n\nChanged in version 3.9: Added support for an arbitrary number of\narguments.  Formerly, only two arguments were supported.\n\n-- Function: math.isclose (a, b, *, reltol=1e-09, abstol=0.0)\n\nReturn 'True' if the values 'a' and 'b' are close to each other and\n'False' otherwise.\n\nWhether or not two values are considered close is determined\naccording to given absolute and relative tolerances.\n\n'reltol' is the relative tolerance - it is the maximum allowed\ndifference between 'a' and 'b', relative to the larger absolute\nvalue of 'a' or 'b'.  For example, to set a tolerance of 5%, pass\n'reltol=0.05'.  The default tolerance is '1e-09', which assures\nthat the two values are the same within about 9 decimal digits.\n'reltol' must be greater than zero.\n\n'abstol' is the minimum absolute tolerance - useful for\ncomparisons near zero.  'abstol' must be at least zero.\n\nIf no errors occur, the result will be: 'abs(a-b) <= max(reltol *\nmax(abs(a), abs(b)), abstol)'.\n\nThe IEEE 754 special values of 'NaN', 'inf', and '-inf' will be\nhandled according to IEEE rules.  Specifically, 'NaN' is not\nconsidered close to any other value, including 'NaN'.  'inf' and\n'-inf' are only considered close to themselves.\n\nNew in version 3.5.\n\nSee also\n........\n\nPEP 485(2) - A function for testing approximate equality\n\n-- Function: math.isfinite (x)\n\nReturn 'True' if 'x' is neither an infinity nor a NaN, and 'False'\notherwise.  (Note that '0.0' 'is' considered finite.)\n\nNew in version 3.2.\n\n-- Function: math.isinf (x)\n\nReturn 'True' if 'x' is a positive or negative infinity, and\n'False' otherwise.\n\n-- Function: math.isnan (x)\n\nReturn 'True' if 'x' is a NaN (not a number), and 'False'\notherwise.\n\n-- Function: math.isqrt (n)\n\nReturn the integer square root of the nonnegative integer 'n'.\nThis is the floor of the exact square root of 'n', or equivalently\nthe greatest integer 'a' such that 'a'?????????'n'.\n\nFor some applications, it may be more convenient to have the least\ninteger 'a' such that 'n'???????'a'??, or in other words the ceiling of\nthe exact square root of 'n'.  For positive 'n', this can be\ncomputed using 'a = 1 + isqrt(n - 1)'.\n\nNew in version 3.8.\n\n-- Function: math.lcm (*integers)\n\nReturn the least common multiple of the specified integer\narguments.  If all arguments are nonzero, then the returned value\nis the smallest positive integer that is a multiple of all\narguments.  If any of the arguments is zero, then the returned\nvalue is '0'.  'lcm()' without arguments returns '1'.\n\nNew in version 3.9.\n\n-- Function: math.ldexp (x, i)\n\nReturn 'x * (2i)'.  This is essentially the inverse of function\n*note frexp(): 2306.\n\n-- Function: math.modf (x)\n\nReturn the fractional and integer parts of 'x'.  Both results carry\nthe sign of 'x' and are floats.\n\n-- Function: math.nextafter (x, y, steps=1)\n\nReturn the floating-point value 'steps' steps after 'x' towards\n'y'.\n\nIf 'x' is equal to 'y', return 'y', unless 'steps' is zero.\n\nExamples:\n\n* 'math.nextafter(x, math.inf)' goes up: towards positive\ninfinity.\n\n* 'math.nextafter(x, -math.inf)' goes down: towards minus\ninfinity.\n\n* 'math.nextafter(x, 0.0)' goes towards zero.\n\n* 'math.nextafter(x, math.copysign(math.inf, x))' goes away from\nzero.\n\nSee also *note math.ulp(): 72e.\n\nNew in version 3.9.\n\nChanged in version 3.12: Added the 'steps' argument.\n\n-- Function: math.perm (n, k=None)\n\nReturn the number of ways to choose 'k' items from 'n' items\nwithout repetition and with order.\n\nEvaluates to 'n! / (n - k)!' when 'k <= n' and evaluates to zero\nwhen 'k > n'.\n\nIf 'k' is not specified or is None, then 'k' defaults to 'n' and\nthe function returns 'n!'.\n\nRaises *note TypeError: 28e. if either of the arguments are not\nintegers.  Raises *note ValueError: 183. if either of the arguments\nare negative.\n\nNew in version 3.8.\n\n-- Function: math.prod (iterable, *, start=1)\n\nCalculate the product of all the elements in the input 'iterable'.\nThe default 'start' value for the product is '1'.\n\nWhen the iterable is empty, return the start value.  This function\nis intended specifically for use with numeric values and may reject\nnon-numeric types.\n\nNew in version 3.8.\n\n-- Function: math.remainder (x, y)\n\nReturn the IEEE 754-style remainder of 'x' with respect to 'y'.\nFor finite 'x' and finite nonzero 'y', this is the difference 'x -\nn*y', where 'n' is the closest integer to the exact value of the\nquotient 'x / y'.  If 'x / y' is exactly halfway between two\nconsecutive integers, the nearest 'even' integer is used for 'n'.\nThe remainder 'r = remainder(x, y)' thus always satisfies 'abs(r)\n<= 0.5 * abs(y)'.\n\nSpecial cases follow IEEE 754: in particular, 'remainder(x,\nmath.inf)' is 'x' for any finite 'x', and 'remainder(x, 0)' and\n'remainder(math.inf, x)' raise *note ValueError: 183. for any\nnon-NaN 'x'.  If the result of the remainder operation is zero,\nthat zero will have the same sign as 'x'.\n\nOn platforms using IEEE 754 binary floating-point, the result of\nthis operation is always exactly representable: no rounding error\nis introduced.\n\nNew in version 3.7.\n\n-- Function: math.sumprod (p, q)\n\nReturn the sum of products of values from two iterables 'p' and\n'q'.\n\nRaises *note ValueError: 183. if the inputs do not have the same\nlength.\n\nRoughly equivalent to:\n\nsum(itertools.starmap(operator.mul, zip(p, q, strict=True)))\n\nFor float and mixed int/float inputs, the intermediate products and\nsums are computed with extended precision.\n\nNew in version 3.12.\n\n-- Function: math.trunc (x)\n\nReturn 'x' with the fractional part removed, leaving the integer\npart.  This rounds toward 0: 'trunc()' is equivalent to *note\nfloor(): 1216. for positive 'x', and equivalent to *note ceil():\n1217. for negative 'x'.  If 'x' is not a float, delegates to *note\nx.trunc: 4ef, which should return an *note Integral: 1cc3.\nvalue.\n\n-- Function: math.ulp (x)\n\nReturn the value of the least significant bit of the float 'x':\n\n* If 'x' is a NaN (not a number), return 'x'.\n\n* If 'x' is negative, return 'ulp(-x)'.\n\n* If 'x' is a positive infinity, return 'x'.\n\n* If 'x' is equal to zero, return the smallest positive\n'denormalized' representable float (smaller than the minimum\npositive 'normalized' float, *note sys.floatinfo.min: 175f.).\n\n* If 'x' is equal to the largest positive representable float,\nreturn the value of the least significant bit of 'x', such\nthat the first float smaller than 'x' is 'x - ulp(x)'.\n\n* Otherwise ('x' is a positive finite number), return the value\nof the least significant bit of 'x', such that the first float\nbigger than 'x' is 'x + ulp(x)'.\n\nULP stands for \"Unit in the Last Place\".\n\nSee also *note math.nextafter(): 1b7. and *note\nsys.floatinfo.epsilon: 175f.\n\nNew in version 3.9.\n\nNote that *note frexp(): 2306. and *note modf(): 2308. have a different\ncall/return pattern than their C equivalents: they take a single\nargument and return a pair of values, rather than returning their second\nreturn value through an 'output parameter' (there is no such thing in\nPython).\n\nFor the *note ceil(): 1217, *note floor(): 1216, and *note modf(): 2308.\nfunctions, note that 'all' floating-point numbers of sufficiently large\nmagnitude are exact integers.  Python floats typically carry no more\nthan 53 bits of precision (the same as the platform C double type), in\nwhich case any float 'x' with 'abs(x) >= 252' necessarily has no\nfractional bits.\n\n---------- Footnotes ----------\n\n(1) https://code.activestate.com/recipes/393090/\n\n(2) https://peps.python.org/pep-0485/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Power and logarithmic functions,  Next: Trigonometric functions,  Prev: Number-theoretic and representation functions,  Up: math -- Mathematical functions": {
            "content": "5.9.2.2 Power and logarithmic functions\n.......................................\n\n-- Function: math.cbrt (x)\n\nReturn the cube root of 'x'.\n\nNew in version 3.11.\n\n-- Function: math.exp (x)\n\nReturn 'e' raised to the power 'x', where 'e' = 2.718281... is the\nbase of natural logarithms.  This is usually more accurate than\n'math.e  x' or 'pow(math.e, x)'.\n\n-- Function: math.exp2 (x)\n\nReturn '2' raised to the power 'x'.\n\nNew in version 3.11.\n\n-- Function: math.expm1 (x)\n\nReturn 'e' raised to the power 'x', minus 1.  Here 'e' is the base\nof natural logarithms.  For small floats 'x', the subtraction in\n'exp(x) - 1' can result in a significant loss of precision(1); the\n*note expm1(): 1060. function provides a way to compute this\nquantity to full precision:\n\n>>> from math import exp, expm1\n>>> exp(1e-5) - 1  # gives result accurate to 11 places\n1.0000050000069649e-05\n>>> expm1(1e-5)    # result accurate to full precision\n1.0000050000166668e-05\n\nNew in version 3.2.\n\n-- Function: math.log (x[, base])\n\nWith one argument, return the natural logarithm of 'x' (to base\n'e').\n\nWith two arguments, return the logarithm of 'x' to the given\n'base', calculated as 'log(x)/log(base)'.\n\n-- Function: math.log1p (x)\n\nReturn the natural logarithm of '1+x' (base 'e').  The result is\ncalculated in a way which is accurate for 'x' near zero.\n\n-- Function: math.log2 (x)\n\nReturn the base-2 logarithm of 'x'.  This is usually more accurate\nthan 'log(x, 2)'.\n\nNew in version 3.3.\n\nSee also\n........\n\n*note int.bitlength(): 1ea5. returns the number of bits necessary\nto represent an integer in binary, excluding the sign and leading\nzeros.\n\n-- Function: math.log10 (x)\n\nReturn the base-10 logarithm of 'x'.  This is usually more accurate\nthan 'log(x, 10)'.\n\n-- Function: math.pow (x, y)\n\nReturn 'x' raised to the power 'y'.  Exceptional cases follow the\nIEEE 754 standard as far as possible.  In particular, 'pow(1.0, x)'\nand 'pow(x, 0.0)' always return '1.0', even when 'x' is a zero or a\nNaN. If both 'x' and 'y' are finite, 'x' is negative, and 'y' is\nnot an integer then 'pow(x, y)' is undefined, and raises *note\nValueError: 183.\n\nUnlike the built-in '' operator, *note math.pow(): 42c. converts\nboth its arguments to type *note float: 4b7.  Use '' or the\nbuilt-in *note pow(): 7f7. function for computing exact integer\npowers.\n\nChanged in version 3.11: The special cases 'pow(0.0, -inf)' and\n'pow(-0.0, -inf)' were changed to return 'inf' instead of raising\n*note ValueError: 183, for consistency with IEEE 754.\n\n-- Function: math.sqrt (x)\n\nReturn the square root of 'x'.\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Lossofsignificance\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Trigonometric functions,  Next: Angular conversion,  Prev: Power and logarithmic functions,  Up: math -- Mathematical functions": {
            "content": "5.9.2.3 Trigonometric functions\n...............................\n\n-- Function: math.acos (x)\n\nReturn the arc cosine of 'x', in radians.  The result is between\n'0' and 'pi'.\n\n-- Function: math.asin (x)\n\nReturn the arc sine of 'x', in radians.  The result is between\n'-pi/2' and 'pi/2'.\n\n-- Function: math.atan (x)\n\nReturn the arc tangent of 'x', in radians.  The result is between\n'-pi/2' and 'pi/2'.\n\n-- Function: math.atan2 (y, x)\n\nReturn 'atan(y / x)', in radians.  The result is between '-pi' and\n'pi'.  The vector in the plane from the origin to point '(x, y)'\nmakes this angle with the positive X axis.  The point of *note\natan2(): 230f. is that the signs of both inputs are known to it, so\nit can compute the correct quadrant for the angle.  For example,\n'atan(1)' and 'atan2(1, 1)' are both 'pi/4', but 'atan2(-1, -1)' is\n'-3*pi/4'.\n\n-- Function: math.cos (x)\n\nReturn the cosine of 'x' radians.\n\n-- Function: math.dist (p, q)\n\nReturn the Euclidean distance between two points 'p' and 'q', each\ngiven as a sequence (or iterable) of coordinates.  The two points\nmust have the same dimension.\n\nRoughly equivalent to:\n\nsqrt(sum((px - qx)  2.0 for px, qx in zip(p, q)))\n\nNew in version 3.8.\n\n-- Function: math.hypot (*coordinates)\n\nReturn the Euclidean norm, 'sqrt(sum(x2 for x in coordinates))'.\nThis is the length of the vector from the origin to the point given\nby the coordinates.\n\nFor a two dimensional point '(x, y)', this is equivalent to\ncomputing the hypotenuse of a right triangle using the Pythagorean\ntheorem, 'sqrt(x*x + y*y)'.\n\nChanged in version 3.8: Added support for n-dimensional points.\nFormerly, only the two dimensional case was supported.\n\nChanged in version 3.10: Improved the algorithm's accuracy so that\nthe maximum error is under 1 ulp (unit in the last place).  More\ntypically, the result is almost always correctly rounded to within\n1/2 ulp.\n\n-- Function: math.sin (x)\n\nReturn the sine of 'x' radians.\n\n-- Function: math.tan (x)\n\nReturn the tangent of 'x' radians.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Angular conversion,  Next: Hyperbolic functions,  Prev: Trigonometric functions,  Up: math -- Mathematical functions": {
            "content": "5.9.2.4 Angular conversion\n..........................\n\n-- Function: math.degrees (x)\n\nConvert angle 'x' from radians to degrees.\n\n-- Function: math.radians (x)\n\nConvert angle 'x' from degrees to radians.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Hyperbolic functions,  Next: Special functions,  Prev: Angular conversion,  Up: math -- Mathematical functions": {
            "content": "5.9.2.5 Hyperbolic functions\n............................\n",
            "subsections": []
        },
        "Hyperbolic functions(1) are analogs of trigonometric functions that are": {
            "content": "based on hyperbolas instead of circles.\n\n-- Function: math.acosh (x)\n\nReturn the inverse hyperbolic cosine of 'x'.\n\n-- Function: math.asinh (x)\n\nReturn the inverse hyperbolic sine of 'x'.\n\n-- Function: math.atanh (x)\n\nReturn the inverse hyperbolic tangent of 'x'.\n\n-- Function: math.cosh (x)\n\nReturn the hyperbolic cosine of 'x'.\n\n-- Function: math.sinh (x)\n\nReturn the hyperbolic sine of 'x'.\n\n-- Function: math.tanh (x)\n\nReturn the hyperbolic tangent of 'x'.\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Hyperbolicfunctions\n\nFile: python3.12.info,  Node: Special functions,  Next: Constants<2>,  Prev: Hyperbolic functions,  Up: math -- Mathematical functions\n\n5.9.2.6 Special functions\n.........................\n\n-- Function: math.erf (x)\n\nReturn the error function(1) at 'x'.\n\nThe *note erf(): a1c. function can be used to compute traditional\nstatistical functions such as the cumulative standard normal\ndistribution(2):\n\ndef phi(x):\n'Cumulative distribution function for the standard normal distribution'\nreturn (1.0 + erf(x / sqrt(2.0))) / 2.0\n\nNew in version 3.2.\n\n-- Function: math.erfc (x)\n\nReturn the complementary error function at 'x'.  The complementary\nerror function(3) is defined as '1.0 - erf(x)'.  It is used for\nlarge values of 'x' where a subtraction from one would cause a loss\nof significance(4).\n\nNew in version 3.2.\n\n-- Function: math.gamma (x)\n\nReturn the Gamma function(5) at 'x'.\n\nNew in version 3.2.\n\n-- Function: math.lgamma (x)\n\nReturn the natural logarithm of the absolute value of the Gamma\nfunction at 'x'.\n\nNew in version 3.2.\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Errorfunction\n\n(2) https://en.wikipedia.org/wiki/Cumulativedistributionfunction\n\n(3) https://en.wikipedia.org/wiki/Errorfunction\n\n(4) https://en.wikipedia.org/wiki/Lossofsignificance\n\n(5) https://en.wikipedia.org/wiki/Gammafunction\n\nFile: python3.12.info,  Node: Constants<2>,  Prev: Special functions,  Up: math -- Mathematical functions\n\n5.9.2.7 Constants\n.................\n\n-- Data: math.pi\n\nThe mathematical constant '??' = 3.141592..., to available precision.\n\n-- Data: math.e\n\nThe mathematical constant 'e' = 2.718281..., to available precision.\n\n-- Data: math.tau\n\nThe mathematical constant '??' = 6.283185..., to available precision.\nTau is a circle constant equal to 2'??', the ratio of a circle's\ncircumference to its radius.  To learn more about Tau, check out Vi\nHart's video Pi is (still) Wrong(1), and start celebrating Tau\nday(2) by eating twice as much pie!\n\nNew in version 3.6.\n\n-- Data: math.inf\n\nA floating-point positive infinity.  (For negative infinity, use\n'-math.inf'.)  Equivalent to the output of 'float('inf')'.\n\nNew in version 3.5.\n\n-- Data: math.nan\n\nA floating-point \"not a number\" (NaN) value.  Equivalent to the\noutput of 'float('nan')'.  Due to the requirements of the IEEE-754\nstandard(3), 'math.nan' and 'float('nan')' are not considered to\nequal to any other numeric value, including themselves.  To check\nwhether a number is a NaN, use the *note isnan(): 1227. function to\ntest for NaNs instead of 'is' or '=='.  Example:\n\n>>> import math\n>>> math.nan == math.nan\nFalse\n>>> float('nan') == float('nan')\nFalse\n>>> math.isnan(math.nan)\nTrue\n>>> math.isnan(float('nan'))\nTrue\n\nNew in version 3.5.\n\nChanged in version 3.11: It is now always available.\n\n'CPython implementation detail:' The *note math: 89. module consists\nmostly of thin wrappers around the platform C math library functions.",
            "subsections": []
        },
        "Behavior in exceptional cases follows Annex F of the C99 standard where": {
            "content": "appropriate.  The current implementation will raise *note ValueError:\n183. for invalid operations like 'sqrt(-1.0)' or 'log(0.0)' (where C99",
            "subsections": []
        },
        "Annex F recommends signaling invalid operation or divide-by-zero), and": {
            "content": "*note OverflowError: 68d. for results that overflow (for example,\n'exp(1000.0)').  A NaN will not be returned from any of the functions\nabove unless one or more of the input arguments was a NaN; in that case,\nmost functions will return a NaN, but (again following C99 Annex F)\nthere are some exceptions to this rule, for example 'pow(float('nan'),\n0.0)' or 'hypot(float('nan'), float('inf'))'.\n",
            "subsections": []
        },
        "Note that Python makes no effort to distinguish signaling NaNs from": {
            "content": "quiet NaNs, and behavior for signaling NaNs remains unspecified.\nTypical behavior is to treat all NaNs as though they were quiet.\n\nSee also\n........\n\nModule *note cmath: 16.\n\nComplex number versions of many of these functions.\n\n---------- Footnotes ----------\n\n(1) https://www.youtube.com/watch?v=jG7vhMMXagQ\n\n(2) https://tauday.com/\n\n(3) https://en.wikipedia.org/wiki/IEEE754\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: cmath -- Mathematical functions for complex numbers,  Next: decimal -- Decimal fixed point and floating point arithmetic,  Prev: math -- Mathematical functions,  Up: Numeric and Mathematical Modules": {
            "content": "",
            "subsections": []
        },
        "This module provides access to mathematical functions for complex": {
            "content": "numbers.  The functions in this module accept integers, floating-point\nnumbers or complex numbers as arguments.  They will also accept any\nPython object that has either a *note complex(): 3ac. or a *note\nfloat(): 7f0. method: these methods are used to convert the object\nto a complex or floating-point number, respectively, and the function is\nthen applied to the result of the conversion.\n\nNote: For functions involving branch cuts, we have the problem of\ndeciding how to define those functions on the cut itself.\nFollowing Kahan's \"Branch cuts for complex elementary functions\"\npaper, as well as Annex G of C99 and later C standards, we use the\nsign of zero to distinguish one side of the branch cut from the\nother: for a branch cut along (a portion of) the real axis we look\nat the sign of the imaginary part, while for a branch cut along the\nimaginary axis we look at the sign of the real part.\n\nFor example, the *note cmath.sqrt(): 231f. function has a branch\ncut along the negative real axis.  An argument of 'complex(-2.0,\n-0.0)' is treated as though it lies 'below' the branch cut, and so\ngives a result on the negative imaginary axis:\n\n>>> cmath.sqrt(complex(-2.0, -0.0))\n-1.4142135623730951j\n\nBut an argument of 'complex(-2.0, 0.0)' is treated as though it\nlies above the branch cut:\n\n>>> cmath.sqrt(complex(-2.0, 0.0))\n1.4142135623730951j\n\n* Menu:\n\n* Conversions to and from polar coordinates::\n* Power and logarithmic functions: Power and logarithmic functions<2>.\n* Trigonometric functions: Trigonometric functions<2>.\n* Hyperbolic functions: Hyperbolic functions<2>.\n* Classification functions::\n* Constants: Constants<3>.\n\nFile: python3.12.info,  Node: Conversions to and from polar coordinates,  Next: Power and logarithmic functions<2>,  Up: cmath -- Mathematical functions for complex numbers\n\n5.9.3.1 Conversions to and from polar coordinates\n.................................................\n\nA Python complex number 'z' is stored internally using 'rectangular' or\n'Cartesian' coordinates.  It is completely determined by its 'real part'\n'z.real' and its 'imaginary part' 'z.imag'.  In other words:\n\nz == z.real + z.imag*1j\n\n'Polar coordinates' give an alternative way to represent a complex\nnumber.  In polar coordinates, a complex number 'z' is defined by the\nmodulus 'r' and the phase angle 'phi'.  The modulus 'r' is the distance\nfrom 'z' to the origin, while the phase 'phi' is the counterclockwise\nangle, measured in radians, from the positive x-axis to the line segment\nthat joins the origin to 'z'.\n",
            "subsections": []
        },
        "The following functions can be used to convert from the native": {
            "content": "rectangular coordinates to polar coordinates and back.\n\n-- Function: cmath.phase (x)\n\nReturn the phase of 'x' (also known as the 'argument' of 'x'), as a\nfloat.  'phase(x)' is equivalent to 'math.atan2(x.imag, x.real)'.\nThe result lies in the range [-'??', '??'], and the branch cut for\nthis operation lies along the negative real axis.  The sign of the\nresult is the same as the sign of 'x.imag', even when 'x.imag' is\nzero:\n\n>>> phase(complex(-1.0, 0.0))\n3.141592653589793\n>>> phase(complex(-1.0, -0.0))\n-3.141592653589793\n\nNote: The modulus (absolute value) of a complex number 'x' can be\ncomputed using the built-in *note abs(): 1a29. function.  There is\nno separate *note cmath: 16. module function for this operation.\n\n-- Function: cmath.polar (x)\n\nReturn the representation of 'x' in polar coordinates.  Returns a\npair '(r, phi)' where 'r' is the modulus of 'x' and phi is the\nphase of 'x'.  'polar(x)' is equivalent to '(abs(x), phase(x))'.\n\n-- Function: cmath.rect (r, phi)\n\nReturn the complex number 'x' with polar coordinates 'r' and 'phi'.\nEquivalent to 'r * (math.cos(phi) + math.sin(phi)*1j)'.\n\nFile: python3.12.info,  Node: Power and logarithmic functions<2>,  Next: Trigonometric functions<2>,  Prev: Conversions to and from polar coordinates,  Up: cmath -- Mathematical functions for complex numbers\n\n5.9.3.2 Power and logarithmic functions\n.......................................\n\n-- Function: cmath.exp (x)\n\nReturn 'e' raised to the power 'x', where 'e' is the base of\nnatural logarithms.\n\n-- Function: cmath.log (x[, base])\n\nReturns the logarithm of 'x' to the given 'base'.  If the 'base' is\nnot specified, returns the natural logarithm of 'x'.  There is one\nbranch cut, from 0 along the negative real axis to -???.\n\n-- Function: cmath.log10 (x)\n\nReturn the base-10 logarithm of 'x'.  This has the same branch cut\nas *note log(): 2326.\n\n-- Function: cmath.sqrt (x)\n\nReturn the square root of 'x'.  This has the same branch cut as\n*note log(): 2326.\n\nFile: python3.12.info,  Node: Trigonometric functions<2>,  Next: Hyperbolic functions<2>,  Prev: Power and logarithmic functions<2>,  Up: cmath -- Mathematical functions for complex numbers\n\n5.9.3.3 Trigonometric functions\n...............................\n\n-- Function: cmath.acos (x)\n\nReturn the arc cosine of 'x'.  There are two branch cuts: One\nextends right from 1 along the real axis to ???.  The other extends\nleft from -1 along the real axis to -???.\n\n-- Function: cmath.asin (x)\n\nReturn the arc sine of 'x'.  This has the same branch cuts as *note\nacos(): 2329.\n\n-- Function: cmath.atan (x)\n\nReturn the arc tangent of 'x'.  There are two branch cuts: One\nextends from '1j' along the imaginary axis to '???j'.  The other\nextends from '-1j' along the imaginary axis to '-???j'.\n\n-- Function: cmath.cos (x)\n\nReturn the cosine of 'x'.\n\n-- Function: cmath.sin (x)\n\nReturn the sine of 'x'.\n\n-- Function: cmath.tan (x)\n\nReturn the tangent of 'x'.\n\nFile: python3.12.info,  Node: Hyperbolic functions<2>,  Next: Classification functions,  Prev: Trigonometric functions<2>,  Up: cmath -- Mathematical functions for complex numbers\n\n5.9.3.4 Hyperbolic functions\n............................\n\n-- Function: cmath.acosh (x)\n\nReturn the inverse hyperbolic cosine of 'x'.  There is one branch\ncut, extending left from 1 along the real axis to -???.\n\n-- Function: cmath.asinh (x)\n\nReturn the inverse hyperbolic sine of 'x'.  There are two branch\ncuts: One extends from '1j' along the imaginary axis to '???j'.  The\nother extends from '-1j' along the imaginary axis to '-???j'.\n\n-- Function: cmath.atanh (x)\n\nReturn the inverse hyperbolic tangent of 'x'.  There are two branch\ncuts: One extends from '1' along the real axis to '???'.  The other\nextends from '-1' along the real axis to '-???'.\n\n-- Function: cmath.cosh (x)\n\nReturn the hyperbolic cosine of 'x'.\n\n-- Function: cmath.sinh (x)\n\nReturn the hyperbolic sine of 'x'.\n\n-- Function: cmath.tanh (x)\n\nReturn the hyperbolic tangent of 'x'.\n\nFile: python3.12.info,  Node: Classification functions,  Next: Constants<3>,  Prev: Hyperbolic functions<2>,  Up: cmath -- Mathematical functions for complex numbers\n\n5.9.3.5 Classification functions\n................................\n\n-- Function: cmath.isfinite (x)\n\nReturn 'True' if both the real and imaginary parts of 'x' are\nfinite, and 'False' otherwise.\n\nNew in version 3.2.\n\n-- Function: cmath.isinf (x)\n\nReturn 'True' if either the real or the imaginary part of 'x' is an\ninfinity, and 'False' otherwise.\n\n-- Function: cmath.isnan (x)\n\nReturn 'True' if either the real or the imaginary part of 'x' is a\nNaN, and 'False' otherwise.\n\n-- Function: cmath.isclose (a, b, *, reltol=1e-09, abstol=0.0)\n\nReturn 'True' if the values 'a' and 'b' are close to each other and\n'False' otherwise.\n\nWhether or not two values are considered close is determined\naccording to given absolute and relative tolerances.\n\n'reltol' is the relative tolerance - it is the maximum allowed\ndifference between 'a' and 'b', relative to the larger absolute\nvalue of 'a' or 'b'.  For example, to set a tolerance of 5%, pass\n'reltol=0.05'.  The default tolerance is '1e-09', which assures\nthat the two values are the same within about 9 decimal digits.\n'reltol' must be greater than zero.\n\n'abstol' is the minimum absolute tolerance - useful for\ncomparisons near zero.  'abstol' must be at least zero.\n\nIf no errors occur, the result will be: 'abs(a-b) <= max(reltol *\nmax(abs(a), abs(b)), abstol)'.\n\nThe IEEE 754 special values of 'NaN', 'inf', and '-inf' will be\nhandled according to IEEE rules.  Specifically, 'NaN' is not\nconsidered close to any other value, including 'NaN'.  'inf' and\n'-inf' are only considered close to themselves.\n\nNew in version 3.5.\n\nSee also\n........\n\nPEP 485(1) - A function for testing approximate equality\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0485/\n\nFile: python3.12.info,  Node: Constants<3>,  Prev: Classification functions,  Up: cmath -- Mathematical functions for complex numbers\n\n5.9.3.6 Constants\n.................\n\n-- Data: cmath.pi\n\nThe mathematical constant '??', as a float.\n\n-- Data: cmath.e\n\nThe mathematical constant 'e', as a float.\n\n-- Data: cmath.tau\n\nThe mathematical constant '??', as a float.\n\nNew in version 3.6.\n\n-- Data: cmath.inf\n\nFloating-point positive infinity.  Equivalent to 'float('inf')'.\n\nNew in version 3.6.\n\n-- Data: cmath.infj\n\nComplex number with zero real part and positive infinity imaginary\npart.  Equivalent to 'complex(0.0, float('inf'))'.\n\nNew in version 3.6.\n\n-- Data: cmath.nan\n\nA floating-point \"not a number\" (NaN) value.  Equivalent to\n'float('nan')'.\n\nNew in version 3.6.\n\n-- Data: cmath.nanj\n\nComplex number with zero real part and NaN imaginary part.\nEquivalent to 'complex(0.0, float('nan'))'.\n\nNew in version 3.6.\n",
            "subsections": []
        },
        "Note that the selection of functions is similar, but not identical, to": {
            "content": "that in module *note math: 89.  The reason for having two modules is\nthat some users aren't interested in complex numbers, and perhaps don't\neven know what they are.  They would rather have 'math.sqrt(-1)' raise\nan exception than return a complex number.  Also note that the functions\ndefined in *note cmath: 16. always return a complex number, even if the\nanswer can be expressed as a real number (in which case the complex\nnumber has an imaginary part of zero).\n\nA note on branch cuts: They are curves along which the given function\nfails to be continuous.  They are a necessary feature of many complex\nfunctions.  It is assumed that if you need to compute with complex\nfunctions, you will understand about branch cuts.  Consult almost any\n(not too elementary) book on complex variables for enlightenment.  For\ninformation of the proper choice of branch cuts for numerical purposes,\na good reference should be the following:\n\nSee also\n........\n",
            "subsections": []
        },
        "Kahan, W: Branch cuts for complex elementary functions; or, Much ado": {
            "content": "about nothing's sign bit.  In Iserles, A., and Powell, M. (eds.), The\nstate of the art in numerical analysis.  Clarendon Press (1987)\npp165-211.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: decimal -- Decimal fixed point and floating point arithmetic,  Next: fractions -- Rational numbers,  Prev: cmath -- Mathematical functions for complex numbers,  Up: Numeric and Mathematical Modules": {
            "content": "'Source code:' Lib/decimal.py(1)\n\n\n\nThe *note decimal: 33. module provides support for fast correctly\nrounded decimal floating point arithmetic.  It offers several advantages\nover the *note float: 4b7. datatype:\n\n* Decimal \"is based on a floating-point model which was designed with\npeople in mind, and necessarily has a paramount guiding principle -\ncomputers must provide an arithmetic that works in the same way as\nthe arithmetic that people learn at school.\" - excerpt from the\ndecimal arithmetic specification.\n\n* Decimal numbers can be represented exactly.  In contrast, numbers\nlike '1.1' and '2.2' do not have exact representations in binary\nfloating point.  End users typically would not expect '1.1 + 2.2'\nto display as '3.3000000000000003' as it does with binary floating\npoint.\n\n* The exactness carries over into arithmetic.  In decimal floating\npoint, '0.1 + 0.1 + 0.1 - 0.3' is exactly equal to zero.  In binary\nfloating point, the result is '5.5511151231257827e-017'.  While\nnear to zero, the differences prevent reliable equality testing and\ndifferences can accumulate.  For this reason, decimal is preferred\nin accounting applications which have strict equality invariants.\n\n* The decimal module incorporates a notion of significant places so\nthat '1.30 + 1.20' is '2.50'.  The trailing zero is kept to\nindicate significance.  This is the customary presentation for\nmonetary applications.  For multiplication, the \"schoolbook\"\napproach uses all the figures in the multiplicands.  For instance,\n'1.3 * 1.2' gives '1.56' while '1.30 * 1.20' gives '1.5600'.\n\n* Unlike hardware based binary floating point, the decimal module has\na user alterable precision (defaulting to 28 places) which can be\nas large as needed for a given problem:\n\n>>> from decimal import *\n>>> getcontext().prec = 6\n>>> Decimal(1) / Decimal(7)\nDecimal('0.142857')\n>>> getcontext().prec = 28\n>>> Decimal(1) / Decimal(7)\nDecimal('0.1428571428571428571428571429')\n\n* Both binary and decimal floating point are implemented in terms of\npublished standards.  While the built-in float type exposes only a\nmodest portion of its capabilities, the decimal module exposes all\nrequired parts of the standard.  When needed, the programmer has\nfull control over rounding and signal handling.  This includes an\noption to enforce exact arithmetic by using exceptions to block any\ninexact operations.\n\n* The decimal module was designed to support \"without prejudice, both\nexact unrounded decimal arithmetic (sometimes called fixed-point\narithmetic) and rounded floating-point arithmetic.\" - excerpt from\nthe decimal arithmetic specification.\n",
            "subsections": []
        },
        "The module design is centered around three concepts: the decimal number,": {
            "content": "the context for arithmetic, and signals.\n\nA decimal number is immutable.  It has a sign, coefficient digits, and\nan exponent.  To preserve significance, the coefficient digits do not\ntruncate trailing zeros.  Decimals also include special values such as\n'Infinity', '-Infinity', and 'NaN'.  The standard also differentiates\n'-0' from '+0'.\n",
            "subsections": []
        },
        "The context for arithmetic is an environment specifying precision,": {
            "content": "rounding rules, limits on exponents, flags indicating the results of\noperations, and trap enablers which determine whether signals are\ntreated as exceptions.  Rounding options include *note ROUNDCEILING:\n233f, *note ROUNDDOWN: 2340, *note ROUNDFLOOR: 2341, *note\nROUNDHALFDOWN: 2342, *note ROUNDHALFEVEN: 2343, *note ROUNDHALFUP:\n2344, *note ROUNDUP: 2345, and *note ROUND05UP: 2346.\n",
            "subsections": []
        },
        "Signals are groups of exceptional conditions arising during the course": {
            "content": "of computation.  Depending on the needs of the application, signals may\nbe ignored, considered as informational, or treated as exceptions.  The\nsignals in the decimal module are: *note Clamped: 2347, *note\nInvalidOperation: f1a, *note DivisionByZero: 2348, *note Inexact: 2349,\n*note Rounded: 234a, *note Subnormal: 234b, *note Overflow: 234c, *note\nUnderflow: 234d. and *note FloatOperation: f14.\n",
            "subsections": []
        },
        "For each signal there is a flag and a trap enabler.  When a signal is": {
            "content": "encountered, its flag is set to one, then, if the trap enabler is set to\none, an exception is raised.  Flags are sticky, so the user needs to\nreset them before monitoring a calculation.\n\nSee also\n........\n\n* IBM's General Decimal Arithmetic Specification, The General Decimal\nArithmetic Specification(2).\n\n* Menu:\n\n* Quick-start Tutorial::\n* Decimal objects::\n* Context objects::\n* Constants: Constants<4>.\n* Rounding modes::\n* Signals::\n* Floating Point Notes::\n* Working with threads::\n* Recipes::\n* Decimal FAQ::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/decimal.py\n\n(2) https://speleotrove.com/decimal/decarith.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Quick-start Tutorial,  Next: Decimal objects,  Up: decimal -- Decimal fixed point and floating point arithmetic": {
            "content": "5.9.4.1 Quick-start Tutorial\n............................\n",
            "subsections": []
        },
        "The usual start to using decimals is importing the module, viewing the": {
            "content": "current context with *note getcontext(): 2350. and, if necessary,\nsetting new values for precision, rounding, or enabled traps:\n\n>>> from decimal import *\n>>> getcontext()\nContext(prec=28, rounding=ROUNDHALFEVEN, Emin=-999999, Emax=999999,\ncapitals=1, clamp=0, flags=[], traps=[Overflow, DivisionByZero,\nInvalidOperation])\n\n>>> getcontext().prec = 7       # Set a new precision\n",
            "subsections": []
        },
        "Decimal instances can be constructed from integers, strings, floats, or": {
            "content": "tuples.  Construction from an integer or a float performs an exact\nconversion of the value of that integer or float.  Decimal numbers\ninclude special values such as 'NaN' which stands for \"Not a number\",\npositive and negative 'Infinity', and '-0':\n\n>>> getcontext().prec = 28\n>>> Decimal(10)\nDecimal('10')\n>>> Decimal('3.14')\nDecimal('3.14')\n>>> Decimal(3.14)\nDecimal('3.140000000000000124344978758017532527446746826171875')\n>>> Decimal((0, (3, 1, 4), -2))\nDecimal('3.14')\n>>> Decimal(str(2.0  0.5))\nDecimal('1.4142135623730951')\n>>> Decimal(2)  Decimal('0.5')\nDecimal('1.414213562373095048801688724')\n>>> Decimal('NaN')\nDecimal('NaN')\n>>> Decimal('-Infinity')\nDecimal('-Infinity')\n\nIf the *note FloatOperation: f14. signal is trapped, accidental mixing\nof decimals and floats in constructors or ordering comparisons raises an\nexception:\n\n>>> c = getcontext()\n>>> c.traps[FloatOperation] = True\n>>> Decimal(3.14)\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\ndecimal.FloatOperation: [<class 'decimal.FloatOperation'>]\n>>> Decimal('3.5') < 3.7\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\ndecimal.FloatOperation: [<class 'decimal.FloatOperation'>]\n>>> Decimal('3.5') == 3.5\nTrue\n\nNew in version 3.3.\n",
            "subsections": []
        },
        "The significance of a new Decimal is determined solely by the number of": {
            "content": "digits input.  Context precision and rounding only come into play during\narithmetic operations.\n\n>>> getcontext().prec = 6\n>>> Decimal('3.0')\nDecimal('3.0')\n>>> Decimal('3.1415926535')\nDecimal('3.1415926535')\n>>> Decimal('3.1415926535') + Decimal('2.7182818285')\nDecimal('5.85987')\n>>> getcontext().rounding = ROUNDUP\n>>> Decimal('3.1415926535') + Decimal('2.7182818285')\nDecimal('5.85988')\n",
            "subsections": []
        },
        "If the internal limits of the C version are exceeded, constructing a": {
            "content": "decimal raises *note InvalidOperation: f1a.:\n\n>>> Decimal(\"1e9999999999999999999\")\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\ndecimal.InvalidOperation: [<class 'decimal.InvalidOperation'>]\n\nChanged in version 3.3.\n",
            "subsections": []
        },
        "Decimals interact well with much of the rest of Python.  Here is a small": {
            "content": "decimal floating point flying circus:\n\n>>> data = list(map(Decimal, '1.34 1.87 3.45 2.35 1.00 0.03 9.25'.split()))\n>>> max(data)\nDecimal('9.25')\n>>> min(data)\nDecimal('0.03')\n>>> sorted(data)\n[Decimal('0.03'), Decimal('1.00'), Decimal('1.34'), Decimal('1.87'),\nDecimal('2.35'), Decimal('3.45'), Decimal('9.25')]\n>>> sum(data)\nDecimal('19.29')\n>>> a,b,c = data[:3]\n>>> str(a)\n'1.34'\n>>> float(a)\n1.34\n>>> round(a, 1)\nDecimal('1.3')\n>>> int(a)\n1\n>>> a * 5\nDecimal('6.70')\n>>> a * b\nDecimal('2.5058')\n>>> c % a\nDecimal('0.77')\n\nAnd some mathematical functions are also available to Decimal:\n\n>>> getcontext().prec = 28\n>>> Decimal(2).sqrt()\nDecimal('1.414213562373095048801688724')\n>>> Decimal(1).exp()\nDecimal('2.718281828459045235360287471')\n>>> Decimal('10').ln()\nDecimal('2.302585092994045684017991455')\n>>> Decimal('10').log10()\nDecimal('1')\n\nThe *note quantize(): f20. method rounds a number to a fixed exponent.",
            "subsections": []
        },
        "This method is useful for monetary applications that often round results": {
            "content": "to a fixed number of places:\n\n>>> Decimal('7.325').quantize(Decimal('.01'), rounding=ROUNDDOWN)\nDecimal('7.32')\n>>> Decimal('7.325').quantize(Decimal('1.'), rounding=ROUNDUP)\nDecimal('8')\n\nAs shown above, the *note getcontext(): 2350. function accesses the\ncurrent context and allows the settings to be changed.  This approach\nmeets the needs of most applications.\n",
            "subsections": []
        },
        "For more advanced work, it may be useful to create alternate contexts": {
            "content": "using the Context() constructor.  To make an alternate active, use the\n*note setcontext(): 2351. function.\n\nIn accordance with the standard, the *note decimal: 33. module provides\ntwo ready to use standard contexts, *note BasicContext: f18. and *note",
            "subsections": []
        },
        "ExtendedContext: f19.  The former is especially useful for debugging": {
            "content": "because many of the traps are enabled:\n\n>>> myothercontext = Context(prec=60, rounding=ROUNDHALFDOWN)\n>>> setcontext(myothercontext)\n>>> Decimal(1) / Decimal(7)\nDecimal('0.142857142857142857142857142857142857142857142857142857142857')\n\n>>> ExtendedContext\nContext(prec=9, rounding=ROUNDHALFEVEN, Emin=-999999, Emax=999999,\ncapitals=1, clamp=0, flags=[], traps=[])\n>>> setcontext(ExtendedContext)\n>>> Decimal(1) / Decimal(7)\nDecimal('0.142857143')\n>>> Decimal(42) / Decimal(0)\nDecimal('Infinity')\n\n>>> setcontext(BasicContext)\n>>> Decimal(42) / Decimal(0)\nTraceback (most recent call last):\nFile \"<pyshell#143>\", line 1, in -toplevel-\nDecimal(42) / Decimal(0)\nDivisionByZero: x / 0\n",
            "subsections": []
        },
        "Contexts also have signal flags for monitoring exceptional conditions": {
            "content": "encountered during computations.  The flags remain set until explicitly\ncleared, so it is best to clear the flags before each set of monitored\ncomputations by using the *note clearflags(): 2352. method.\n\n>>> setcontext(ExtendedContext)\n>>> getcontext().clearflags()\n>>> Decimal(355) / Decimal(113)\nDecimal('3.14159292')\n>>> getcontext()\nContext(prec=9, rounding=ROUNDHALFEVEN, Emin=-999999, Emax=999999,\ncapitals=1, clamp=0, flags=[Inexact, Rounded], traps=[])\n",
            "subsections": []
        },
        "The 'flags' entry shows that the rational approximation to pi was": {
            "content": "rounded (digits beyond the context precision were thrown away) and that\nthe result is inexact (some of the discarded digits were non-zero).\n",
            "subsections": []
        },
        "Individual traps are set using the dictionary in the 'traps' attribute": {
            "content": "of a context:\n\n>>> setcontext(ExtendedContext)\n>>> Decimal(1) / Decimal(0)\nDecimal('Infinity')\n>>> getcontext().traps[DivisionByZero] = 1\n>>> Decimal(1) / Decimal(0)\nTraceback (most recent call last):\nFile \"<pyshell#112>\", line 1, in -toplevel-\nDecimal(1) / Decimal(0)\nDivisionByZero: x / 0\n",
            "subsections": []
        },
        "Most programs adjust the current context only once, at the beginning of": {
            "content": "the program.  And, in many applications, data is converted to *note",
            "subsections": []
        },
        "Decimal: 5c3. with a single cast inside a loop.  With context set and": {
            "content": "decimals created, the bulk of the program manipulates the data no\ndifferently than with other Python numeric types.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Decimal objects,  Next: Context objects,  Prev: Quick-start Tutorial,  Up: decimal -- Decimal fixed point and floating point arithmetic": {
            "content": "5.9.4.2 Decimal objects\n.......................\n\n-- Class: decimal.Decimal (value='0', context=None)\n\nConstruct a new *note Decimal: 5c3. object based from 'value'.\n\n'value' can be an integer, string, tuple, *note float: 4b7, or\nanother *note Decimal: 5c3. object.  If no 'value' is given,\nreturns 'Decimal('0')'.  If 'value' is a string, it should conform\nto the decimal numeric string syntax after leading and trailing\nwhitespace characters, as well as underscores throughout, are\nremoved:\n\nsign           ::=  '+' | '-'\ndigit          ::=  '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'\nindicator      ::=  'e' | 'E'\ndigits         ::=  digit [digit]...\ndecimal-part   ::=  digits '.' [digits] | ['.'] digits\nexponent-part  ::=  indicator [sign] digits\ninfinity       ::=  'Infinity' | 'Inf'\nnan            ::=  'NaN' [digits] | 'sNaN' [digits]\nnumeric-value  ::=  decimal-part [exponent-part] | infinity\nnumeric-string ::=  [sign] numeric-value | [sign] nan\n\nOther Unicode decimal digits are also permitted where 'digit'\nappears above.  These include decimal digits from various other\nalphabets (for example, Arabic-Indic and Devan??gar?? digits) along\nwith the fullwidth digits ''\\uff10'' through ''\\uff19''.\n\nIf 'value' is a *note tuple: 4b8, it should have three components,\na sign ('0' for positive or '1' for negative), a *note tuple: 4b8.\nof digits, and an integer exponent.  For example, 'Decimal((0, (1,\n4, 1, 4), -3))' returns 'Decimal('1.414')'.\n\nIf 'value' is a *note float: 4b7, the binary floating point value\nis losslessly converted to its exact decimal equivalent.  This\nconversion can often require 53 or more digits of precision.  For\nexample, 'Decimal(float('1.1'))' converts to\n'Decimal('1.100000000000000088817841970012523233890533447265625')'.\n\nThe 'context' precision does not affect how many digits are stored.\nThat is determined exclusively by the number of digits in 'value'.\nFor example, 'Decimal('3.00000')' records all five zeros even if\nthe context precision is only three.\n\nThe purpose of the 'context' argument is determining what to do if\n'value' is a malformed string.  If the context traps *note\nInvalidOperation: f1a, an exception is raised; otherwise, the\nconstructor returns a new Decimal with the value of 'NaN'.\n\nOnce constructed, *note Decimal: 5c3. objects are immutable.\n\nChanged in version 3.2: The argument to the constructor is now\npermitted to be a *note float: 4b7. instance.\n\nChanged in version 3.3: *note float: 4b7. arguments raise an\nexception if the *note FloatOperation: f14. trap is set.  By\ndefault the trap is off.\n\nChanged in version 3.6: Underscores are allowed for grouping, as\nwith integral and floating-point literals in code.\n\nDecimal floating point objects share many properties with the other\nbuilt-in numeric types such as *note float: 4b7. and *note int:\n17e.  All of the usual math operations and special methods apply.\nLikewise, decimal objects can be copied, pickled, printed, used as\ndictionary keys, used as set elements, compared, sorted, and\ncoerced to another type (such as *note float: 4b7. or *note int:\n17e.).\n\nThere are some small differences between arithmetic on Decimal\nobjects and arithmetic on integers and floats.  When the remainder\noperator '%' is applied to Decimal objects, the sign of the result\nis the sign of the 'dividend' rather than the sign of the divisor:\n\n>>> (-7) % 4\n1\n>>> Decimal(-7) % Decimal(4)\nDecimal('-3')\n\nThe integer division operator '//' behaves analogously, returning\nthe integer part of the true quotient (truncating towards zero)\nrather than its floor, so as to preserve the usual identity 'x ==\n(x // y) * y + x % y':\n\n>>> -7 // 4\n-2\n>>> Decimal(-7) // Decimal(4)\nDecimal('-1')\n\nThe '%' and '//' operators implement the 'remainder' and\n'divide-integer' operations (respectively) as described in the\nspecification.\n\nDecimal objects cannot generally be combined with floats or\ninstances of *note fractions.Fraction: 1a8. in arithmetic\noperations: an attempt to add a *note Decimal: 5c3. to a *note\nfloat: 4b7, for example, will raise a *note TypeError: 28e.\nHowever, it is possible to use Python's comparison operators to\ncompare a *note Decimal: 5c3. instance 'x' with another number 'y'.\nThis avoids confusing results when doing equality comparisons\nbetween numbers of different types.\n\nChanged in version 3.2: Mixed-type comparisons between *note\nDecimal: 5c3. instances and other numeric types are now fully\nsupported.\n\nIn addition to the standard numeric properties, decimal floating\npoint objects also have a number of specialized methods:\n\n-- Method: adjusted ()\n\nReturn the adjusted exponent after shifting out the\ncoefficient's rightmost digits until only the lead digit\nremains: 'Decimal('321e+5').adjusted()' returns seven.  Used\nfor determining the position of the most significant digit\nwith respect to the decimal point.\n\n-- Method: asintegerratio ()\n\nReturn a pair '(n, d)' of integers that represent the given\n*note Decimal: 5c3. instance as a fraction, in lowest terms\nand with a positive denominator:\n\n>>> Decimal('-3.14').asintegerratio()\n(-157, 50)\n\nThe conversion is exact.  Raise OverflowError on infinities\nand ValueError on NaNs.\n\nNew in version 3.6.\n\n-- Method: astuple ()\n\nReturn a *note named tuple: 417. representation of the number:\n'DecimalTuple(sign, digits, exponent)'.\n\n-- Method: canonical ()\n\nReturn the canonical encoding of the argument.  Currently, the\nencoding of a *note Decimal: 5c3. instance is always\ncanonical, so this operation returns its argument unchanged.\n\n-- Method: compare (other, context=None)\n\nCompare the values of two Decimal instances.  *note compare():\n2358. returns a Decimal instance, and if either operand is a\nNaN then the result is a NaN:\n\na or b is a NaN  ==> Decimal('NaN')\na < b            ==> Decimal('-1')\na == b           ==> Decimal('0')\na > b            ==> Decimal('1')\n\n-- Method: comparesignal (other, context=None)\n\nThis operation is identical to the *note compare(): 2358.\nmethod, except that all NaNs signal.  That is, if neither\noperand is a signaling NaN then any quiet NaN operand is\ntreated as though it were a signaling NaN.\n\n-- Method: comparetotal (other, context=None)\n\nCompare two operands using their abstract representation\nrather than their numerical value.  Similar to the *note\ncompare(): 2358. method, but the result gives a total ordering\non *note Decimal: 5c3. instances.  Two *note Decimal: 5c3.\ninstances with the same numeric value but different\nrepresentations compare unequal in this ordering:\n\n>>> Decimal('12.0').comparetotal(Decimal('12'))\nDecimal('-1')\n\nQuiet and signaling NaNs are also included in the total\nordering.  The result of this function is 'Decimal('0')' if\nboth operands have the same representation, 'Decimal('-1')' if\nthe first operand is lower in the total order than the second,\nand 'Decimal('1')' if the first operand is higher in the total\norder than the second operand.  See the specification for\ndetails of the total order.\n\nThis operation is unaffected by context and is quiet: no flags\nare changed and no rounding is performed.  As an exception,\nthe C version may raise InvalidOperation if the second operand\ncannot be converted exactly.\n\n-- Method: comparetotalmag (other, context=None)\n\nCompare two operands using their abstract representation\nrather than their value as in *note comparetotal(): 235a, but\nignoring the sign of each operand.  'x.comparetotalmag(y)'\nis equivalent to 'x.copyabs().comparetotal(y.copyabs())'.\n\nThis operation is unaffected by context and is quiet: no flags\nare changed and no rounding is performed.  As an exception,\nthe C version may raise InvalidOperation if the second operand\ncannot be converted exactly.\n\n-- Method: conjugate ()\n\nJust returns self, this method is only to comply with the\nDecimal Specification.\n\n-- Method: copyabs ()\n\nReturn the absolute value of the argument.  This operation is\nunaffected by the context and is quiet: no flags are changed\nand no rounding is performed.\n\n-- Method: copynegate ()\n\nReturn the negation of the argument.  This operation is\nunaffected by the context and is quiet: no flags are changed\nand no rounding is performed.\n\n-- Method: copysign (other, context=None)\n\nReturn a copy of the first operand with the sign set to be the\nsame as the sign of the second operand.  For example:\n\n>>> Decimal('2.3').copysign(Decimal('-1.5'))\nDecimal('-2.3')\n\nThis operation is unaffected by context and is quiet: no flags\nare changed and no rounding is performed.  As an exception,\nthe C version may raise InvalidOperation if the second operand\ncannot be converted exactly.\n\n-- Method: exp (context=None)\n\nReturn the value of the (natural) exponential function 'ex'\nat the given number.  The result is correctly rounded using\nthe *note ROUNDHALFEVEN: 2343. rounding mode.\n\n>>> Decimal(1).exp()\nDecimal('2.718281828459045235360287471')\n>>> Decimal(321).exp()\nDecimal('2.561702493119680037517373933E+139')\n\n-- Method: classmethod fromfloat (f)\n\nAlternative constructor that only accepts instances of *note\nfloat: 4b7. or *note int: 17e.\n\nNote 'Decimal.fromfloat(0.1)' is not the same as\n'Decimal('0.1')'.  Since 0.1 is not exactly representable in\nbinary floating point, the value is stored as the nearest\nrepresentable value which is '0x1.999999999999ap-4'.  That\nequivalent value in decimal is\n'0.1000000000000000055511151231257827021181583404541015625'.\n\nNote: From Python 3.2 onwards, a *note Decimal: 5c3.\ninstance can also be constructed directly from a *note\nfloat: 4b7.\n\n>>> Decimal.fromfloat(0.1)\nDecimal('0.1000000000000000055511151231257827021181583404541015625')\n>>> Decimal.fromfloat(float('nan'))\nDecimal('NaN')\n>>> Decimal.fromfloat(float('inf'))\nDecimal('Infinity')\n>>> Decimal.fromfloat(float('-inf'))\nDecimal('-Infinity')\n\nNew in version 3.1.\n\n-- Method: fma (other, third, context=None)\n\nFused multiply-add.  Return self*other+third with no rounding\nof the intermediate product self*other.\n\n>>> Decimal(2).fma(3, 5)\nDecimal('11')\n\n-- Method: iscanonical ()\n\nReturn *note True: a53. if the argument is canonical and *note\nFalse: 971. otherwise.  Currently, a *note Decimal: 5c3.\ninstance is always canonical, so this operation always returns\n*note True: a53.\n\n-- Method: isfinite ()\n\nReturn *note True: a53. if the argument is a finite number,\nand *note False: 971. if the argument is an infinity or a NaN.\n\n-- Method: isinfinite ()\n\nReturn *note True: a53. if the argument is either positive or\nnegative infinity and *note False: 971. otherwise.\n\n-- Method: isnan ()\n\nReturn *note True: a53. if the argument is a (quiet or\nsignaling) NaN and *note False: 971. otherwise.\n\n-- Method: isnormal (context=None)\n\nReturn *note True: a53. if the argument is a 'normal' finite\nnumber.  Return *note False: 971. if the argument is zero,\nsubnormal, infinite or a NaN.\n\n-- Method: isqnan ()\n\nReturn *note True: a53. if the argument is a quiet NaN, and\n*note False: 971. otherwise.\n\n-- Method: issigned ()\n\nReturn *note True: a53. if the argument has a negative sign\nand *note False: 971. otherwise.  Note that zeros and NaNs can\nboth carry signs.\n\n-- Method: issnan ()\n\nReturn *note True: a53. if the argument is a signaling NaN and\n*note False: 971. otherwise.\n\n-- Method: issubnormal (context=None)\n\nReturn *note True: a53. if the argument is subnormal, and\n*note False: 971. otherwise.\n\n-- Method: iszero ()\n\nReturn *note True: a53. if the argument is a (positive or\nnegative) zero and *note False: 971. otherwise.\n\n-- Method: ln (context=None)\n\nReturn the natural (base e) logarithm of the operand.  The\nresult is correctly rounded using the *note ROUNDHALFEVEN:\n2343. rounding mode.\n\n-- Method: log10 (context=None)\n\nReturn the base ten logarithm of the operand.  The result is\ncorrectly rounded using the *note ROUNDHALFEVEN: 2343.\nrounding mode.\n\n-- Method: logb (context=None)\n\nFor a nonzero number, return the adjusted exponent of its\noperand as a *note Decimal: 5c3. instance.  If the operand is\na zero then 'Decimal('-Infinity')' is returned and the *note\nDivisionByZero: 2348. flag is raised.  If the operand is an\ninfinity then 'Decimal('Infinity')' is returned.\n\n-- Method: logicaland (other, context=None)\n\n*note logicaland(): 236d. is a logical operation which takes\ntwo 'logical operands' (see *note Logical operands: 236e.).\nThe result is the digit-wise 'and' of the two operands.\n\n-- Method: logicalinvert (context=None)\n\n*note logicalinvert(): 236f. is a logical operation.  The\nresult is the digit-wise inversion of the operand.\n\n-- Method: logicalor (other, context=None)\n\n*note logicalor(): 2370. is a logical operation which takes\ntwo 'logical operands' (see *note Logical operands: 236e.).\nThe result is the digit-wise 'or' of the two operands.\n\n-- Method: logicalxor (other, context=None)\n\n*note logicalxor(): 2371. is a logical operation which takes\ntwo 'logical operands' (see *note Logical operands: 236e.).\nThe result is the digit-wise exclusive or of the two operands.\n\n-- Method: max (other, context=None)\n\nLike 'max(self, other)' except that the context rounding rule\nis applied before returning and that 'NaN' values are either\nsignaled or ignored (depending on the context and whether they\nare signaling or quiet).\n\n-- Method: maxmag (other, context=None)\n\nSimilar to the *note max(): 2372. method, but the comparison\nis done using the absolute values of the operands.\n\n-- Method: min (other, context=None)\n\nLike 'min(self, other)' except that the context rounding rule\nis applied before returning and that 'NaN' values are either\nsignaled or ignored (depending on the context and whether they\nare signaling or quiet).\n\n-- Method: minmag (other, context=None)\n\nSimilar to the *note min(): 2374. method, but the comparison\nis done using the absolute values of the operands.\n\n-- Method: nextminus (context=None)\n\nReturn the largest number representable in the given context\n(or in the current thread's context if no context is given)\nthat is smaller than the given operand.\n\n-- Method: nextplus (context=None)\n\nReturn the smallest number representable in the given context\n(or in the current thread's context if no context is given)\nthat is larger than the given operand.\n\n-- Method: nexttoward (other, context=None)\n\nIf the two operands are unequal, return the number closest to\nthe first operand in the direction of the second operand.  If\nboth operands are numerically equal, return a copy of the\nfirst operand with the sign set to be the same as the sign of\nthe second operand.\n\n-- Method: normalize (context=None)\n\nUsed for producing canonical values of an equivalence class\nwithin either the current context or the specified context.\n\nThis has the same semantics as the unary plus operation,\nexcept that if the final result is finite it is reduced to its\nsimplest form, with all trailing zeros removed and its sign\npreserved.  That is, while the coefficient is non-zero and a\nmultiple of ten the coefficient is divided by ten and the\nexponent is incremented by 1.  Otherwise (the coefficient is\nzero) the exponent is set to 0.  In all cases the sign is\nunchanged.\n\nFor example, 'Decimal('32.100')' and 'Decimal('0.321000e+2')'\nboth normalize to the equivalent value 'Decimal('32.1')'.\n\nNote that rounding is applied 'before' reducing to simplest\nform.\n\nIn the latest versions of the specification, this operation is\nalso known as 'reduce'.\n\n-- Method: numberclass (context=None)\n\nReturn a string describing the 'class' of the operand.  The\nreturned value is one of the following ten strings.\n\n* '\"-Infinity\"', indicating that the operand is negative\ninfinity.\n\n* '\"-Normal\"', indicating that the operand is a negative\nnormal number.\n\n* '\"-Subnormal\"', indicating that the operand is negative\nand subnormal.\n\n* '\"-Zero\"', indicating that the operand is a negative\nzero.\n\n* '\"+Zero\"', indicating that the operand is a positive\nzero.\n\n* '\"+Subnormal\"', indicating that the operand is positive\nand subnormal.\n\n* '\"+Normal\"', indicating that the operand is a positive\nnormal number.\n\n* '\"+Infinity\"', indicating that the operand is positive\ninfinity.\n\n* '\"NaN\"', indicating that the operand is a quiet NaN (Not\na Number).\n\n* '\"sNaN\"', indicating that the operand is a signaling NaN.\n\n-- Method: quantize (exp, rounding=None, context=None)\n\nReturn a value equal to the first operand after rounding and\nhaving the exponent of the second operand.\n\n>>> Decimal('1.41421356').quantize(Decimal('1.000'))\nDecimal('1.414')\n\nUnlike other operations, if the length of the coefficient\nafter the quantize operation would be greater than precision,\nthen an *note InvalidOperation: f1a. is signaled.  This\nguarantees that, unless there is an error condition, the\nquantized exponent is always equal to that of the right-hand\noperand.\n\nAlso unlike other operations, quantize never signals\nUnderflow, even if the result is subnormal and inexact.\n\nIf the exponent of the second operand is larger than that of\nthe first then rounding may be necessary.  In this case, the\nrounding mode is determined by the 'rounding' argument if\ngiven, else by the given 'context' argument; if neither\nargument is given the rounding mode of the current thread's\ncontext is used.\n\nAn error is returned whenever the resulting exponent is\ngreater than 'Emax' or less than *note Etiny(): 237b.\n\n-- Method: radix ()\n\nReturn 'Decimal(10)', the radix (base) in which the *note\nDecimal: 5c3. class does all its arithmetic.  Included for\ncompatibility with the specification.\n\n-- Method: remaindernear (other, context=None)\n\nReturn the remainder from dividing 'self' by 'other'.  This\ndiffers from 'self % other' in that the sign of the remainder\nis chosen so as to minimize its absolute value.  More\nprecisely, the return value is 'self - n * other' where 'n' is\nthe integer nearest to the exact value of 'self / other', and\nif two integers are equally near then the even one is chosen.\n\nIf the result is zero then its sign will be the sign of\n'self'.\n\n>>> Decimal(18).remaindernear(Decimal(10))\nDecimal('-2')\n>>> Decimal(25).remaindernear(Decimal(10))\nDecimal('5')\n>>> Decimal(35).remaindernear(Decimal(10))\nDecimal('-5')\n\n-- Method: rotate (other, context=None)\n\nReturn the result of rotating the digits of the first operand\nby an amount specified by the second operand.  The second\noperand must be an integer in the range -precision through\nprecision.  The absolute value of the second operand gives the\nnumber of places to rotate.  If the second operand is positive\nthen rotation is to the left; otherwise rotation is to the\nright.  The coefficient of the first operand is padded on the\nleft with zeros to length precision if necessary.  The sign\nand exponent of the first operand are unchanged.\n\n-- Method: samequantum (other, context=None)\n\nTest whether self and other have the same exponent or whether\nboth are 'NaN'.\n\nThis operation is unaffected by context and is quiet: no flags\nare changed and no rounding is performed.  As an exception,\nthe C version may raise InvalidOperation if the second operand\ncannot be converted exactly.\n\n-- Method: scaleb (other, context=None)\n\nReturn the first operand with exponent adjusted by the second.\nEquivalently, return the first operand multiplied by\n'10other'.  The second operand must be an integer.\n\n-- Method: shift (other, context=None)\n\nReturn the result of shifting the digits of the first operand\nby an amount specified by the second operand.  The second\noperand must be an integer in the range -precision through\nprecision.  The absolute value of the second operand gives the\nnumber of places to shift.  If the second operand is positive\nthen the shift is to the left; otherwise the shift is to the\nright.  Digits shifted into the coefficient are zeros.  The\nsign and exponent of the first operand are unchanged.\n\n-- Method: sqrt (context=None)\n\nReturn the square root of the argument to full precision.\n\n-- Method: toengstring (context=None)\n\nConvert to a string, using engineering notation if an exponent\nis needed.\n\nEngineering notation has an exponent which is a multiple of 3.\nThis can leave up to 3 digits to the left of the decimal place\nand may require the addition of either one or two trailing\nzeros.\n\nFor example, this converts 'Decimal('123E+1')' to\n'Decimal('1.23E+3')'.\n\n-- Method: tointegral (rounding=None, context=None)\n\nIdentical to the *note tointegralvalue(): 2385. method.  The\n'tointegral' name has been kept for compatibility with older\nversions.\n\n-- Method: tointegralexact (rounding=None, context=None)\n\nRound to the nearest integer, signaling *note Inexact: 2349.\nor *note Rounded: 234a. as appropriate if rounding occurs.\nThe rounding mode is determined by the 'rounding' parameter if\ngiven, else by the given 'context'.  If neither parameter is\ngiven then the rounding mode of the current context is used.\n\n-- Method: tointegralvalue (rounding=None, context=None)\n\nRound to the nearest integer without signaling *note Inexact:\n2349. or *note Rounded: 234a.  If given, applies 'rounding';\notherwise, uses the rounding method in either the supplied\n'context' or the current context.\n\n* Menu:\n\n* Logical operands::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Logical operands,  Up: Decimal objects": {
            "content": "5.9.4.3 Logical operands\n........................\n\nThe *note logicaland(): 236d, *note logicalinvert(): 236f, *note\nlogicalor(): 2370, and *note logicalxor(): 2371. methods expect their\narguments to be 'logical operands'.  A 'logical operand' is a *note",
            "subsections": []
        },
        "Decimal: 5c3. instance whose exponent and sign are both zero, and whose": {
            "content": "digits are all either '0' or '1'.\n\nFile: python3.12.info,  Node: Context objects,  Next: Constants<4>,  Prev: Decimal objects,  Up: decimal -- Decimal fixed point and floating point arithmetic\n\n5.9.4.4 Context objects\n.......................\n",
            "subsections": []
        },
        "Contexts are environments for arithmetic operations.  They govern": {
            "content": "precision, set rules for rounding, determine which signals are treated\nas exceptions, and limit the range for exponents.\n",
            "subsections": []
        },
        "Each thread has its own current context which is accessed or changed": {
            "content": "using the *note getcontext(): 2350. and *note setcontext(): 2351.\nfunctions:\n\n-- Function: decimal.getcontext ()\n\nReturn the current context for the active thread.\n\n-- Function: decimal.setcontext (c)\n\nSet the current context for the active thread to 'c'.\n\nYou can also use the *note with: 396. statement and the *note\nlocalcontext(): 1562. function to temporarily change the active context.\n\n-- Function: decimal.localcontext (ctx=None, kwargs)\n\nReturn a context manager that will set the current context for the\nactive thread to a copy of 'ctx' on entry to the with-statement and\nrestore the previous context when exiting the with-statement.  If\nno context is specified, a copy of the current context is used.\nThe 'kwargs' argument is used to set the attributes of the new\ncontext.\n\nFor example, the following code sets the current decimal precision\nto 42 places, performs a calculation, and then automatically\nrestores the previous context:\n\nfrom decimal import localcontext\n\nwith localcontext() as ctx:\nctx.prec = 42   # Perform a high precision calculation\ns = calculatesomething()\ns = +s  # Round the final result back to the default precision\n\nUsing keyword arguments, the code would be the following:\n\nfrom decimal import localcontext\n\nwith localcontext(prec=42) as ctx:\ns = calculatesomething()\ns = +s\n\nRaises *note TypeError: 28e. if 'kwargs' supplies an attribute that\n*note Context: f1f. doesn't support.  Raises either *note\nTypeError: 28e. or *note ValueError: 183. if 'kwargs' supplies an\ninvalid value for an attribute.\n\nChanged in version 3.11: *note localcontext(): 1562. now supports\nsetting context attributes through the use of keyword arguments.\n\nNew contexts can also be created using the *note Context: f1f.\nconstructor described below.  In addition, the module provides three\npre-made contexts:\n\n-- Class: decimal.BasicContext\n\nThis is a standard context defined by the General Decimal\nArithmetic Specification.  Precision is set to nine.  Rounding is\nset to *note ROUNDHALFUP: 2344.  All flags are cleared.  All\ntraps are enabled (treated as exceptions) except *note Inexact:\n2349, *note Rounded: 234a, and *note Subnormal: 234b.\n\nBecause many of the traps are enabled, this context is useful for\ndebugging.\n\n-- Class: decimal.ExtendedContext\n\nThis is a standard context defined by the General Decimal\nArithmetic Specification.  Precision is set to nine.  Rounding is\nset to *note ROUNDHALFEVEN: 2343.  All flags are cleared.  No\ntraps are enabled (so that exceptions are not raised during\ncomputations).\n\nBecause the traps are disabled, this context is useful for\napplications that prefer to have result value of 'NaN' or\n'Infinity' instead of raising exceptions.  This allows an\napplication to complete a run in the presence of conditions that\nwould otherwise halt the program.\n\n-- Class: decimal.DefaultContext\n\nThis context is used by the *note Context: f1f. constructor as a\nprototype for new contexts.  Changing a field (such a precision)\nhas the effect of changing the default for new contexts created by\nthe *note Context: f1f. constructor.\n\nThis context is most useful in multi-threaded environments.\nChanging one of the fields before threads are started has the\neffect of setting system-wide defaults.  Changing the fields after\nthreads have started is not recommended as it would require thread\nsynchronization to prevent race conditions.\n\nIn single threaded environments, it is preferable to not use this\ncontext at all.  Instead, simply create contexts explicitly as\ndescribed below.\n\nThe default values are 'Context.prec'='28',\n'Context.rounding'=*note ROUNDHALFEVEN: 2343, and enabled traps\nfor *note Overflow: 234c, *note InvalidOperation: f1a, and *note\nDivisionByZero: 2348.\n",
            "subsections": []
        },
        "In addition to the three supplied contexts, new contexts can be created": {
            "content": "with the *note Context: f1f. constructor.\n\n-- Class: decimal.Context (prec=None, rounding=None, Emin=None,\nEmax=None, capitals=None, clamp=None, flags=None, traps=None)\n\nCreates a new context.  If a field is not specified or is *note\nNone: 43f, the default values are copied from the *note\nDefaultContext: f17.  If the 'flags' field is not specified or is\n*note None: 43f, all flags are cleared.\n\n'prec' is an integer in the range ['1', *note MAXPREC: 238a.] that\nsets the precision for arithmetic operations in the context.\n\nThe 'rounding' option is one of the constants listed in the section\n*note Rounding Modes: 238b.\n\nThe 'traps' and 'flags' fields list any signals to be set.\nGenerally, new contexts should only set traps and leave the flags\nclear.\n\nThe 'Emin' and 'Emax' fields are integers specifying the outer\nlimits allowable for exponents.  'Emin' must be in the range [*note\nMINEMIN: 238c, '0'], 'Emax' in the range ['0', *note MAXEMAX:\n238d.].\n\nThe 'capitals' field is either '0' or '1' (the default).  If set to\n'1', exponents are printed with a capital 'E'; otherwise, a\nlowercase 'e' is used: 'Decimal('6.02e+23')'.\n\nThe 'clamp' field is either '0' (the default) or '1'.  If set to\n'1', the exponent 'e' of a *note Decimal: 5c3. instance\nrepresentable in this context is strictly limited to the range\n'Emin - prec + 1 <= e <= Emax - prec + 1'.  If 'clamp' is '0' then\na weaker condition holds: the adjusted exponent of the *note\nDecimal: 5c3. instance is at most 'Emax'.  When 'clamp' is '1', a\nlarge normal number will, where possible, have its exponent reduced\nand a corresponding number of zeros added to its coefficient, in\norder to fit the exponent constraints; this preserves the value of\nthe number but loses information about significant trailing zeros.\nFor example:\n\n>>> Context(prec=6, Emax=999, clamp=1).createdecimal('1.23e999')\nDecimal('1.23000E+999')\n\nA 'clamp' value of '1' allows compatibility with the fixed-width\ndecimal interchange formats specified in IEEE 754.\n\nThe *note Context: f1f. class defines several general purpose\nmethods as well as a large number of methods for doing arithmetic\ndirectly in a given context.  In addition, for each of the *note\nDecimal: 5c3. methods described above (with the exception of the\n*note adjusted(): 2355. and *note astuple(): 2356. methods) there\nis a corresponding *note Context: f1f. method.  For example, for a\n*note Context: f1f. instance 'C' and *note Decimal: 5c3. instance\n'x', 'C.exp(x)' is equivalent to 'x.exp(context=C)'.  Each *note\nContext: f1f. method accepts a Python integer (an instance of *note\nint: 17e.) anywhere that a Decimal instance is accepted.\n\n-- Method: clearflags ()\n\nResets all of the flags to '0'.\n\n-- Method: cleartraps ()\n\nResets all of the traps to '0'.\n\nNew in version 3.3.\n\n-- Method: copy ()\n\nReturn a duplicate of the context.\n\n-- Method: copydecimal (num)\n\nReturn a copy of the Decimal instance num.\n\n-- Method: createdecimal (num)\n\nCreates a new Decimal instance from 'num' but using 'self' as\ncontext.  Unlike the *note Decimal: 5c3. constructor, the\ncontext precision, rounding method, flags, and traps are\napplied to the conversion.\n\nThis is useful because constants are often given to a greater\nprecision than is needed by the application.  Another benefit\nis that rounding immediately eliminates unintended effects\nfrom digits beyond the current precision.  In the following\nexample, using unrounded inputs means that adding zero to a\nsum can change the result:\n\n>>> getcontext().prec = 3\n>>> Decimal('3.4445') + Decimal('1.0023')\nDecimal('4.45')\n>>> Decimal('3.4445') + Decimal(0) + Decimal('1.0023')\nDecimal('4.44')\n\nThis method implements the to-number operation of the IBM\nspecification.  If the argument is a string, no leading or\ntrailing whitespace or underscores are permitted.\n\n-- Method: createdecimalfromfloat (f)\n\nCreates a new Decimal instance from a float 'f' but rounding\nusing 'self' as the context.  Unlike the *note\nDecimal.fromfloat(): 1078. class method, the context\nprecision, rounding method, flags, and traps are applied to\nthe conversion.\n\n>>> context = Context(prec=5, rounding=ROUNDDOWN)\n>>> context.createdecimalfromfloat(math.pi)\nDecimal('3.1415')\n>>> context = Context(prec=5, traps=[Inexact])\n>>> context.createdecimalfromfloat(math.pi)\nTraceback (most recent call last):\n...\ndecimal.Inexact: None\n\nNew in version 3.1.\n\n-- Method: Etiny ()\n\nReturns a value equal to 'Emin - prec + 1' which is the\nminimum exponent value for subnormal results.  When underflow\noccurs, the exponent is set to *note Etiny: 237b.\n\n-- Method: Etop ()\n\nReturns a value equal to 'Emax - prec + 1'.\n\nThe usual approach to working with decimals is to create *note\nDecimal: 5c3. instances and then apply arithmetic operations which\ntake place within the current context for the active thread.  An\nalternative approach is to use context methods for calculating\nwithin a specific context.  The methods are similar to those for\nthe *note Decimal: 5c3. class and are only briefly recounted here.\n\n-- Method: abs (x)\n\nReturns the absolute value of 'x'.\n\n-- Method: add (x, y)\n\nReturn the sum of 'x' and 'y'.\n\n-- Method: canonical (x)\n\nReturns the same Decimal object 'x'.\n\n-- Method: compare (x, y)\n\nCompares 'x' and 'y' numerically.\n\n-- Method: comparesignal (x, y)\n\nCompares the values of the two operands numerically.\n\n-- Method: comparetotal (x, y)\n\nCompares two operands using their abstract representation.\n\n-- Method: comparetotalmag (x, y)\n\nCompares two operands using their abstract representation,\nignoring sign.\n\n-- Method: copyabs (x)\n\nReturns a copy of 'x' with the sign set to 0.\n\n-- Method: copynegate (x)\n\nReturns a copy of 'x' with the sign inverted.\n\n-- Method: copysign (x, y)\n\nCopies the sign from 'y' to 'x'.\n\n-- Method: divide (x, y)\n\nReturn 'x' divided by 'y'.\n\n-- Method: divideint (x, y)\n\nReturn 'x' divided by 'y', truncated to an integer.\n\n-- Method: divmod (x, y)\n\nDivides two numbers and returns the integer part of the\nresult.\n\n-- Method: exp (x)\n\nReturns 'e  x'.\n\n-- Method: fma (x, y, z)\n\nReturns 'x' multiplied by 'y', plus 'z'.\n\n-- Method: iscanonical (x)\n\nReturns 'True' if 'x' is canonical; otherwise returns 'False'.\n\n-- Method: isfinite (x)\n\nReturns 'True' if 'x' is finite; otherwise returns 'False'.\n\n-- Method: isinfinite (x)\n\nReturns 'True' if 'x' is infinite; otherwise returns 'False'.\n\n-- Method: isnan (x)\n\nReturns 'True' if 'x' is a qNaN or sNaN; otherwise returns\n'False'.\n\n-- Method: isnormal (x)\n\nReturns 'True' if 'x' is a normal number; otherwise returns\n'False'.\n\n-- Method: isqnan (x)\n\nReturns 'True' if 'x' is a quiet NaN; otherwise returns\n'False'.\n\n-- Method: issigned (x)\n\nReturns 'True' if 'x' is negative; otherwise returns 'False'.\n\n-- Method: issnan (x)\n\nReturns 'True' if 'x' is a signaling NaN; otherwise returns\n'False'.\n\n-- Method: issubnormal (x)\n\nReturns 'True' if 'x' is subnormal; otherwise returns 'False'.\n\n-- Method: iszero (x)\n\nReturns 'True' if 'x' is a zero; otherwise returns 'False'.\n\n-- Method: ln (x)\n\nReturns the natural (base e) logarithm of 'x'.\n\n-- Method: log10 (x)\n\nReturns the base 10 logarithm of 'x'.\n\n-- Method: logb (x)\n\nReturns the exponent of the magnitude of the operand's MSD.\n\n-- Method: logicaland (x, y)\n\nApplies the logical operation 'and' between each operand's\ndigits.\n\n-- Method: logicalinvert (x)\n\nInvert all the digits in 'x'.\n\n-- Method: logicalor (x, y)\n\nApplies the logical operation 'or' between each operand's\ndigits.\n\n-- Method: logicalxor (x, y)\n\nApplies the logical operation 'xor' between each operand's\ndigits.\n\n-- Method: max (x, y)\n\nCompares two values numerically and returns the maximum.\n\n-- Method: maxmag (x, y)\n\nCompares the values numerically with their sign ignored.\n\n-- Method: min (x, y)\n\nCompares two values numerically and returns the minimum.\n\n-- Method: minmag (x, y)\n\nCompares the values numerically with their sign ignored.\n\n-- Method: minus (x)\n\nMinus corresponds to the unary prefix minus operator in\nPython.\n\n-- Method: multiply (x, y)\n\nReturn the product of 'x' and 'y'.\n\n-- Method: nextminus (x)\n\nReturns the largest representable number smaller than 'x'.\n\n-- Method: nextplus (x)\n\nReturns the smallest representable number larger than 'x'.\n\n-- Method: nexttoward (x, y)\n\nReturns the number closest to 'x', in direction towards 'y'.\n\n-- Method: normalize (x)\n\nReduces 'x' to its simplest form.\n\n-- Method: numberclass (x)\n\nReturns an indication of the class of 'x'.\n\n-- Method: plus (x)\n\nPlus corresponds to the unary prefix plus operator in Python.\nThis operation applies the context precision and rounding, so\nit is 'not' an identity operation.\n\n-- Method: power (x, y, modulo=None)\n\nReturn 'x' to the power of 'y', reduced modulo 'modulo' if\ngiven.\n\nWith two arguments, compute 'xy'.  If 'x' is negative then\n'y' must be integral.  The result will be inexact unless 'y'\nis integral and the result is finite and can be expressed\nexactly in 'precision' digits.  The rounding mode of the\ncontext is used.  Results are always correctly rounded in the\nPython version.\n\n'Decimal(0)  Decimal(0)' results in 'InvalidOperation', and\nif 'InvalidOperation' is not trapped, then results in\n'Decimal('NaN')'.\n\nChanged in version 3.3: The C module computes *note power():\n23bd. in terms of the correctly rounded *note exp(): 239f. and\n*note ln(): 23aa. functions.  The result is well-defined but\nonly \"almost always correctly rounded\".\n\nWith three arguments, compute '(xy) % modulo'.  For the\nthree argument form, the following restrictions on the\narguments hold:\n\n- all three arguments must be integral\n\n- 'y' must be nonnegative\n\n- at least one of 'x' or 'y' must be nonzero\n\n- 'modulo' must be nonzero and have at most 'precision'\ndigits\n\nThe value resulting from 'Context.power(x, y, modulo)' is\nequal to the value that would be obtained by computing '(xy)\n% modulo' with unbounded precision, but is computed more\nefficiently.  The exponent of the result is zero, regardless\nof the exponents of 'x', 'y' and 'modulo'.  The result is\nalways exact.\n\n-- Method: quantize (x, y)\n\nReturns a value equal to 'x' (rounded), having the exponent of\n'y'.\n\n-- Method: radix ()\n\nJust returns 10, as this is Decimal, :)\n\n-- Method: remainder (x, y)\n\nReturns the remainder from integer division.\n\nThe sign of the result, if non-zero, is the same as that of\nthe original dividend.\n\n-- Method: remaindernear (x, y)\n\nReturns 'x - y * n', where 'n' is the integer nearest the\nexact value of 'x / y' (if the result is 0 then its sign will\nbe the sign of 'x').\n\n-- Method: rotate (x, y)\n\nReturns a rotated copy of 'x', 'y' times.\n\n-- Method: samequantum (x, y)\n\nReturns 'True' if the two operands have the same exponent.\n\n-- Method: scaleb (x, y)\n\nReturns the first operand after adding the second value its\nexp.\n\n-- Method: shift (x, y)\n\nReturns a shifted copy of 'x', 'y' times.\n\n-- Method: sqrt (x)\n\nSquare root of a non-negative number to context precision.\n\n-- Method: subtract (x, y)\n\nReturn the difference between 'x' and 'y'.\n\n-- Method: toengstring (x)\n\nConvert to a string, using engineering notation if an exponent\nis needed.\n\nEngineering notation has an exponent which is a multiple of 3.\nThis can leave up to 3 digits to the left of the decimal place\nand may require the addition of either one or two trailing\nzeros.\n\n-- Method: tointegralexact (x)\n\nRounds to an integer.\n\n-- Method: toscistring (x)\n\nConverts a number to a string using scientific notation.\n\nFile: python3.12.info,  Node: Constants<4>,  Next: Rounding modes,  Prev: Context objects,  Up: decimal -- Decimal fixed point and floating point arithmetic\n\n5.9.4.5 Constants\n.................\n",
            "subsections": []
        },
        "The constants in this section are only relevant for the C module.  They": {
            "content": "are also included in the pure Python version for compatibility.\n\n32-bit                    64-bit\n\n----------------------------------------------------------------------------------------\n\n-- Data:                 '425000000'               '999999999999999999'\ndecimal.MAXPREC\n\n-- Data:                 '425000000'               '999999999999999999'\ndecimal.MAXEMAX\n\n-- Data:                 '-425000000'              '-999999999999999999'\ndecimal.MINEMIN\n\n-- Data:                 '-849999999'              '-1999999999999999997'\ndecimal.MINETINY\n\n-- Data: decimal.HAVETHREADS\n\nThe value is 'True'.  Deprecated, because Python now always has\nthreads.\n\nDeprecated since version 3.9.\n\n-- Data: decimal.HAVECONTEXTVAR\n\nThe default value is 'True'.  If Python is *note configured using\nthe -without-decimal-contextvar option: 1af2, the C version uses a\nthread-local rather than a coroutine-local context and the value is\n'False'.  This is slightly faster in some nested context scenarios.\n\nNew in version 3.8.3.\n\nFile: python3.12.info,  Node: Rounding modes,  Next: Signals,  Prev: Constants<4>,  Up: decimal -- Decimal fixed point and floating point arithmetic\n\n5.9.4.6 Rounding modes\n......................\n\n-- Data: decimal.ROUNDCEILING\n\nRound towards 'Infinity'.\n\n-- Data: decimal.ROUNDDOWN\n\nRound towards zero.\n\n-- Data: decimal.ROUNDFLOOR\n\nRound towards '-Infinity'.\n\n-- Data: decimal.ROUNDHALFDOWN\n\nRound to nearest with ties going towards zero.\n\n-- Data: decimal.ROUNDHALFEVEN\n\nRound to nearest with ties going to nearest even integer.\n\n-- Data: decimal.ROUNDHALFUP\n\nRound to nearest with ties going away from zero.\n\n-- Data: decimal.ROUNDUP\n\nRound away from zero.\n\n-- Data: decimal.ROUND05UP\n\nRound away from zero if last digit after rounding towards zero\nwould have been 0 or 5; otherwise round towards zero.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Signals,  Next: Floating Point Notes,  Prev: Rounding modes,  Up: decimal -- Decimal fixed point and floating point arithmetic": {
            "content": "5.9.4.7 Signals\n...............\n",
            "subsections": []
        },
        "Signals represent conditions that arise during computation.  Each": {
            "content": "corresponds to one context flag and one context trap enabler.\n",
            "subsections": []
        },
        "The context flag is set whenever the condition is encountered.  After": {
            "content": "the computation, flags may be checked for informational purposes (for\ninstance, to determine whether a computation was exact).  After checking\nthe flags, be sure to clear all flags before starting the next\ncomputation.\n",
            "subsections": []
        },
        "If the context's trap enabler is set for the signal, then the condition": {
            "content": "causes a Python exception to be raised.  For example, if the *note\nDivisionByZero: 2348. trap is set, then a *note DivisionByZero: 2348.\nexception is raised upon encountering the condition.\n\n-- Class: decimal.Clamped\n\nAltered an exponent to fit representation constraints.\n\nTypically, clamping occurs when an exponent falls outside the\ncontext's 'Emin' and 'Emax' limits.  If possible, the exponent is\nreduced to fit by adding zeros to the coefficient.\n\n-- Class: decimal.DecimalException\n\nBase class for other signals and a subclass of *note\nArithmeticError: 1f93.\n\n-- Class: decimal.DivisionByZero\n\nSignals the division of a non-infinite number by zero.\n\nCan occur with division, modulo division, or when raising a number\nto a negative power.  If this signal is not trapped, returns\n'Infinity' or '-Infinity' with the sign determined by the inputs to\nthe calculation.\n\n-- Class: decimal.Inexact\n\nIndicates that rounding occurred and the result is not exact.\n\nSignals when non-zero digits were discarded during rounding.  The\nrounded result is returned.  The signal flag or trap is used to\ndetect when results are inexact.\n\n-- Class: decimal.InvalidOperation\n\nAn invalid operation was performed.\n\nIndicates that an operation was requested that does not make sense.\nIf not trapped, returns 'NaN'.  Possible causes include:\n\nInfinity - Infinity\n0 * Infinity\nInfinity / Infinity\nx % 0\nInfinity % x\nsqrt(-x) and x > 0\n0  0\nx  (non-integer)\nx  Infinity\n\n-- Class: decimal.Overflow\n\nNumerical overflow.\n\nIndicates the exponent is larger than 'Context.Emax' after rounding\nhas occurred.  If not trapped, the result depends on the rounding\nmode, either pulling inward to the largest representable finite\nnumber or rounding outward to 'Infinity'.  In either case, *note\nInexact: 2349. and *note Rounded: 234a. are also signaled.\n\n-- Class: decimal.Rounded\n\nRounding occurred though possibly no information was lost.\n\nSignaled whenever rounding discards digits; even if those digits\nare zero (such as rounding '5.00' to '5.0').  If not trapped,\nreturns the result unchanged.  This signal is used to detect loss\nof significant digits.\n\n-- Class: decimal.Subnormal\n\nExponent was lower than 'Emin' prior to rounding.\n\nOccurs when an operation result is subnormal (the exponent is too\nsmall).  If not trapped, returns the result unchanged.\n\n-- Class: decimal.Underflow\n\nNumerical underflow with result rounded to zero.\n\nOccurs when a subnormal result is pushed to zero by rounding.\n*note Inexact: 2349. and *note Subnormal: 234b. are also signaled.\n\n-- Class: decimal.FloatOperation\n\nEnable stricter semantics for mixing floats and Decimals.\n\nIf the signal is not trapped (default), mixing floats and Decimals\nis permitted in the *note Decimal: 5c3. constructor, *note\ncreatedecimal(): f1b. and all comparison operators.  Both\nconversion and comparisons are exact.  Any occurrence of a mixed\noperation is silently recorded by setting *note FloatOperation:\nf14. in the context flags.  Explicit conversions with *note\nfromfloat(): 1078. or *note createdecimalfromfloat(): 2391. do\nnot set the flag.\n\nOtherwise (the signal is trapped), only equality comparisons and\nexplicit conversions are silent.  All other mixed operations raise\n*note FloatOperation: f14.\n\nThe following table summarizes the hierarchy of signals:\n\nexceptions.ArithmeticError(exceptions.Exception)\nDecimalException\nClamped\nDivisionByZero(DecimalException, exceptions.ZeroDivisionError)\nInexact\nOverflow(Inexact, Rounded)\nUnderflow(Inexact, Rounded, Subnormal)\nInvalidOperation\nRounded\nSubnormal\nFloatOperation(DecimalException, exceptions.TypeError)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Floating Point Notes,  Next: Working with threads,  Prev: Signals,  Up: decimal -- Decimal fixed point and floating point arithmetic": {
            "content": "5.9.4.8 Floating Point Notes\n............................\n\n* Menu:\n\n* Mitigating round-off error with increased precision::\n* Special values::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Mitigating round-off error with increased precision,  Next: Special values,  Up: Floating Point Notes": {
            "content": "5.9.4.9 Mitigating round-off error with increased precision\n...........................................................\n",
            "subsections": []
        },
        "The use of decimal floating point eliminates decimal representation": {
            "content": "error (making it possible to represent '0.1' exactly); however, some\noperations can still incur round-off error when non-zero digits exceed\nthe fixed precision.\n",
            "subsections": []
        },
        "The effects of round-off error can be amplified by the addition or": {
            "content": "subtraction of nearly offsetting quantities resulting in loss of\nsignificance.  Knuth provides two instructive examples where rounded\nfloating point arithmetic with insufficient precision causes the\nbreakdown of the associative and distributive properties of addition:\n\n# Examples from Seminumerical Algorithms, Section 4.2.2.\n>>> from decimal import Decimal, getcontext\n>>> getcontext().prec = 8\n\n>>> u, v, w = Decimal(11111113), Decimal(-11111111), Decimal('7.51111111')\n>>> (u + v) + w\nDecimal('9.5111111')\n>>> u + (v + w)\nDecimal('10')\n\n>>> u, v, w = Decimal(20000), Decimal(-6), Decimal('6.0000003')\n>>> (u*v) + (u*w)\nDecimal('0.01')\n>>> u * (v+w)\nDecimal('0.0060000')\n\nThe *note decimal: 33. module makes it possible to restore the\nidentities by expanding the precision sufficiently to avoid loss of\nsignificance:\n\n>>> getcontext().prec = 20\n>>> u, v, w = Decimal(11111113), Decimal(-11111111), Decimal('7.51111111')\n>>> (u + v) + w\nDecimal('9.51111111')\n>>> u + (v + w)\nDecimal('9.51111111')\n>>>\n>>> u, v, w = Decimal(20000), Decimal(-6), Decimal('6.0000003')\n>>> (u*v) + (u*w)\nDecimal('0.0060000')\n>>> u * (v+w)\nDecimal('0.0060000')\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Special values,  Prev: Mitigating round-off error with increased precision,  Up: Floating Point Notes": {
            "content": "5.9.4.10 Special values\n.......................\n\nThe number system for the *note decimal: 33. module provides special\nvalues including 'NaN', 'sNaN', '-Infinity', 'Infinity', and two zeros,\n'+0' and '-0'.\n\nInfinities can be constructed directly with: 'Decimal('Infinity')'.\nAlso, they can arise from dividing by zero when the *note\nDivisionByZero: 2348. signal is not trapped.  Likewise, when the *note",
            "subsections": []
        },
        "Overflow: 234c. signal is not trapped, infinity can result from rounding": {
            "content": "beyond the limits of the largest representable number.\n",
            "subsections": []
        },
        "The infinities are signed (affine) and can be used in arithmetic": {
            "content": "operations where they get treated as very large, indeterminate numbers.",
            "subsections": []
        },
        "For instance, adding a constant to infinity gives another infinite": {
            "content": "result.\n\nSome operations are indeterminate and return 'NaN', or if the *note",
            "subsections": []
        },
        "InvalidOperation: f1a. signal is trapped, raise an exception.  For": {
            "content": "example, '0/0' returns 'NaN' which means \"not a number\".  This variety\nof 'NaN' is quiet and, once created, will flow through other\ncomputations always resulting in another 'NaN'.  This behavior can be\nuseful for a series of computations that occasionally have missing\ninputs -- it allows the calculation to proceed while flagging specific\nresults as invalid.\n\nA variant is 'sNaN' which signals rather than remaining quiet after\nevery operation.  This is a useful return value when an invalid result\nneeds to interrupt a calculation for special handling.\n",
            "subsections": []
        },
        "The behavior of Python's comparison operators can be a little surprising": {
            "content": "where a 'NaN' is involved.  A test for equality where one of the\noperands is a quiet or signaling 'NaN' always returns *note False: 971.\n(even when doing 'Decimal('NaN')==Decimal('NaN')'), while a test for\ninequality always returns *note True: a53.  An attempt to compare two\nDecimals using any of the '<', '<=', '>' or '>=' operators will raise\nthe *note InvalidOperation: f1a. signal if either operand is a 'NaN',\nand return *note False: 971. if this signal is not trapped.  Note that\nthe General Decimal Arithmetic specification does not specify the\nbehavior of direct comparisons; these rules for comparisons involving a\n'NaN' were taken from the IEEE 854 standard (see Table 3 in section\n5.7).  To ensure strict standards-compliance, use the *note compare():\n2358. and *note comparesignal(): 2359. methods instead.\n",
            "subsections": []
        },
        "The signed zeros can result from calculations that underflow.  They keep": {
            "content": "the sign that would have resulted if the calculation had been carried\nout to greater precision.  Since their magnitude is zero, both positive\nand negative zeros are treated as equal and their sign is informational.\n",
            "subsections": []
        },
        "In addition to the two signed zeros which are distinct yet equal, there": {
            "content": "are various representations of zero with differing precisions yet\nequivalent in value.  This takes a bit of getting used to.  For an eye\naccustomed to normalized floating point representations, it is not\nimmediately obvious that the following calculation returns a value equal\nto zero:\n\n>>> 1 / Decimal('Infinity')\nDecimal('0E-1000026')\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Working with threads,  Next: Recipes,  Prev: Floating Point Notes,  Up: decimal -- Decimal fixed point and floating point arithmetic": {
            "content": "5.9.4.11 Working with threads\n.............................\n\nThe *note getcontext(): 2350. function accesses a different *note",
            "subsections": []
        },
        "Context: f1f. object for each thread.  Having separate thread contexts": {
            "content": "means that threads may make changes (such as 'getcontext().prec=10')\nwithout interfering with other threads.\n\nLikewise, the *note setcontext(): 2351. function automatically assigns\nits target to the current thread.\n\nIf *note setcontext(): 2351. has not been called before *note\ngetcontext(): 2350, then *note getcontext(): 2350. will automatically\ncreate a new context for use in the current thread.\n",
            "subsections": []
        },
        "The new context is copied from a prototype context called": {
            "content": "'DefaultContext'.  To control the defaults so that each thread will use\nthe same values throughout the application, directly modify the\n'DefaultContext' object.  This should be done 'before' any threads are\nstarted so that there won't be a race condition between threads calling\n*note getcontext(): 2350.  For example:\n\n# Set applicationwide defaults for all threads about to be launched\nDefaultContext.prec = 12\nDefaultContext.rounding = ROUNDDOWN\nDefaultContext.traps = ExtendedContext.traps.copy()\nDefaultContext.traps[InvalidOperation] = 1\nsetcontext(DefaultContext)\n\n# Afterwards, the threads can be started\nt1.start()\nt2.start()\nt3.start()\n. . .\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Recipes,  Next: Decimal FAQ,  Prev: Working with threads,  Up: decimal -- Decimal fixed point and floating point arithmetic": {
            "content": "5.9.4.12 Recipes\n................\n",
            "subsections": []
        },
        "Here are a few recipes that serve as utility functions and that": {
            "content": "demonstrate ways to work with the *note Decimal: 5c3. class:\n\ndef moneyfmt(value, places=2, curr='', sep=',', dp='.',\npos='', neg='-', trailneg=''):\n\"\"\"Convert Decimal to a money formatted string.\n\nplaces:  required number of places after the decimal point\ncurr:    optional currency symbol before the sign (may be blank)\nsep:     optional grouping separator (comma, period, space, or blank)\ndp:      decimal point indicator (comma or period)\nonly specify as blank when places is zero\npos:     optional sign for positive numbers: '+', space or blank\nneg:     optional sign for negative numbers: '-', '(', space or blank\ntrailneg:optional trailing minus indicator:  '-', ')', space or blank\n\n>>> d = Decimal('-1234567.8901')\n>>> moneyfmt(d, curr='$')\n'-$1,234,567.89'\n>>> moneyfmt(d, places=0, sep='.', dp='', neg='', trailneg='-')\n'1.234.568-'\n>>> moneyfmt(d, curr='$', neg='(', trailneg=')')\n'($1,234,567.89)'\n>>> moneyfmt(Decimal(123456789), sep=' ')\n'123 456 789.00'\n>>> moneyfmt(Decimal('-0.02'), neg='<', trailneg='>')\n'<0.02>'\n\n\"\"\"\nq = Decimal(10)  -places      # 2 places --> '0.01'\nsign, digits, exp = value.quantize(q).astuple()\nresult = []\ndigits = list(map(str, digits))\nbuild, next = result.append, digits.pop\nif sign:\nbuild(trailneg)\nfor i in range(places):\nbuild(next() if digits else '0')\nif places:\nbuild(dp)\nif not digits:\nbuild('0')\ni = 0\nwhile digits:\nbuild(next())\ni += 1\nif i == 3 and digits:\ni = 0\nbuild(sep)\nbuild(curr)\nbuild(neg if sign else pos)\nreturn ''.join(reversed(result))\n\ndef pi():\n\"\"\"Compute Pi to the current precision.\n\n>>> print(pi())\n3.141592653589793238462643383\n\n\"\"\"\ngetcontext().prec += 2  # extra digits for intermediate steps\nthree = Decimal(3)      # substitute \"three=3.0\" for regular floats\nlasts, t, s, n, na, d, da = 0, three, 3, 1, 0, 0, 24\nwhile s != lasts:\nlasts = s\nn, na = n+na, na+8\nd, da = d+da, da+32\nt = (t * n) / d\ns += t\ngetcontext().prec -= 2\nreturn +s               # unary plus applies the new precision\n\ndef exp(x):\n\"\"\"Return e raised to the power of x.  Result type matches input type.\n\n>>> print(exp(Decimal(1)))\n2.718281828459045235360287471\n>>> print(exp(Decimal(2)))\n7.389056098930650227230427461\n>>> print(exp(2.0))\n7.38905609893\n>>> print(exp(2+0j))\n(7.38905609893+0j)\n\n\"\"\"\ngetcontext().prec += 2\ni, lasts, s, fact, num = 0, 0, 1, 1, 1\nwhile s != lasts:\nlasts = s\ni += 1\nfact *= i\nnum *= x\ns += num / fact\ngetcontext().prec -= 2\nreturn +s\n\ndef cos(x):\n\"\"\"Return the cosine of x as measured in radians.\n\nThe Taylor series approximation works best for a small value of x.\nFor larger values, first compute x = x % (2 * pi).\n\n>>> print(cos(Decimal('0.5')))\n0.8775825618903727161162815826\n>>> print(cos(0.5))\n0.87758256189\n>>> print(cos(0.5+0j))\n(0.87758256189+0j)\n\n\"\"\"\ngetcontext().prec += 2\ni, lasts, s, fact, num, sign = 0, 0, 1, 1, 1, 1\nwhile s != lasts:\nlasts = s\ni += 2\nfact *= i * (i-1)\nnum *= x * x\nsign *= -1\ns += num / fact * sign\ngetcontext().prec -= 2\nreturn +s\n\ndef sin(x):\n\"\"\"Return the sine of x as measured in radians.\n\nThe Taylor series approximation works best for a small value of x.\nFor larger values, first compute x = x % (2 * pi).\n\n>>> print(sin(Decimal('0.5')))\n0.4794255386042030002732879352\n>>> print(sin(0.5))\n0.479425538604\n>>> print(sin(0.5+0j))\n(0.479425538604+0j)\n\n\"\"\"\ngetcontext().prec += 2\ni, lasts, s, fact, num, sign = 1, 0, x, 1, x, 1\nwhile s != lasts:\nlasts = s\ni += 2\nfact *= i * (i-1)\nnum *= x * x\nsign *= -1\ns += num / fact * sign\ngetcontext().prec -= 2\nreturn +s\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Decimal FAQ,  Prev: Recipes,  Up: decimal -- Decimal fixed point and floating point arithmetic": {
            "content": "5.9.4.13 Decimal FAQ\n....................\n\nQ. It is cumbersome to type 'decimal.Decimal('1234.5')'.  Is there a way\nto minimize typing when using the interactive interpreter?\n\nA. Some users abbreviate the constructor to just a single letter:\n\n>>> D = decimal.Decimal\n>>> D('1.23') + D('3.45')\nDecimal('4.68')\n\nQ. In a fixed-point application with two decimal places, some inputs\nhave many places and need to be rounded.  Others are not supposed to\nhave excess digits and need to be validated.  What methods should be\nused?\n\nA. The *note quantize(): f20. method rounds to a fixed number of decimal\nplaces.  If the *note Inexact: 2349. trap is set, it is also useful for\nvalidation:\n\n>>> TWOPLACES = Decimal(10)  -2       # same as Decimal('0.01')\n\n>>> # Round to two places\n>>> Decimal('3.214').quantize(TWOPLACES)\nDecimal('3.21')\n\n>>> # Validate that a number does not exceed two places\n>>> Decimal('3.21').quantize(TWOPLACES, context=Context(traps=[Inexact]))\nDecimal('3.21')\n\n>>> Decimal('3.214').quantize(TWOPLACES, context=Context(traps=[Inexact]))\nTraceback (most recent call last):\n...\nInexact: None\n\nQ. Once I have valid two place inputs, how do I maintain that invariant\nthroughout an application?\n\nA. Some operations like addition, subtraction, and multiplication by an\ninteger will automatically preserve fixed point.  Others operations,\nlike division and non-integer multiplication, will change the number of\ndecimal places and need to be followed-up with a *note quantize(): f20.\nstep:\n\n>>> a = Decimal('102.72')           # Initial fixed-point values\n>>> b = Decimal('3.17')\n>>> a + b                           # Addition preserves fixed-point\nDecimal('105.89')\n>>> a - b\nDecimal('99.55')\n>>> a * 42                          # So does integer multiplication\nDecimal('4314.24')\n>>> (a * b).quantize(TWOPLACES)     # Must quantize non-integer multiplication\nDecimal('325.62')\n>>> (b / a).quantize(TWOPLACES)     # And quantize division\nDecimal('0.03')\n",
            "subsections": []
        },
        "In developing fixed-point applications, it is convenient to define": {
            "content": "functions to handle the *note quantize(): f20. step:\n\n>>> def mul(x, y, fp=TWOPLACES):\n...     return (x * y).quantize(fp)\n...\n>>> def div(x, y, fp=TWOPLACES):\n...     return (x / y).quantize(fp)\n\n>>> mul(a, b)                       # Automatically preserve fixed-point\nDecimal('325.62')\n>>> div(b, a)\nDecimal('0.03')\n\nQ. There are many ways to express the same value.  The numbers '200',\n'200.000', '2E2', and '.02E+4' all have the same value at various\nprecisions.  Is there a way to transform them to a single recognizable\ncanonical value?\n\nA. The *note normalize(): 2379. method maps all equivalent values to a\nsingle representative:\n\n>>> values = map(Decimal, '200 200.000 2E2 .02E+4'.split())\n>>> [v.normalize() for v in values]\n[Decimal('2E+2'), Decimal('2E+2'), Decimal('2E+2'), Decimal('2E+2')]\n\nQ. When does rounding occur in a computation?\n\nA. It occurs 'after' the computation.  The philosophy of the decimal\nspecification is that numbers are considered exact and are created\nindependent of the current context.  They can even have greater\nprecision than current context.  Computations process with those exact\ninputs and then rounding (or other context operations) is applied to the\n'result' of the computation:\n\n>>> getcontext().prec = 5\n>>> pi = Decimal('3.1415926535')   # More than 5 digits\n>>> pi                             # All digits are retained\nDecimal('3.1415926535')\n>>> pi + 0                         # Rounded after an addition\nDecimal('3.1416')\n>>> pi - Decimal('0.00005')        # Subtract unrounded numbers, then round\nDecimal('3.1415')\n>>> pi + 0 - Decimal('0.00005').   # Intermediate values are rounded\nDecimal('3.1416')\n\nQ. Some decimal values always print with exponential notation.  Is there\na way to get a non-exponential representation?\n\nA. For some values, exponential notation is the only way to express the\nnumber of significant places in the coefficient.  For example,\nexpressing '5.0E+3' as '5000' keeps the value constant but cannot show\nthe original's two-place significance.\n",
            "subsections": []
        },
        "If an application does not care about tracking significance, it is easy": {
            "content": "to remove the exponent and trailing zeroes, losing significance, but\nkeeping the value unchanged:\n\n>>> def removeexponent(d):\n...     return d.quantize(Decimal(1)) if d == d.tointegral() else d.normalize()\n\n>>> removeexponent(Decimal('5E+3'))\nDecimal('5000')\n\nQ. Is there a way to convert a regular float to a *note Decimal: 5c3.?\n\nA. Yes, any binary floating point number can be exactly expressed as a",
            "subsections": []
        },
        "Decimal though an exact conversion may take more precision than": {
            "content": "intuition would suggest:\n\n>>> Decimal(math.pi)\nDecimal('3.141592653589793115997963468544185161590576171875')\n\nQ. Within a complex calculation, how can I make sure that I haven't\ngotten a spurious result because of insufficient precision or rounding\nanomalies.\n\nA. The decimal module makes it easy to test results.  A best practice is\nto re-run calculations using greater precision and with various rounding\nmodes.  Widely differing results indicate insufficient precision,\nrounding mode issues, ill-conditioned inputs, or a numerically unstable\nalgorithm.\n\nQ. I noticed that context precision is applied to the results of\noperations but not to the inputs.  Is there anything to watch out for\nwhen mixing values of different precisions?\n\nA. Yes.  The principle is that all values are considered to be exact and\nso is the arithmetic on those values.  Only the results are rounded.\nThe advantage for inputs is that \"what you type is what you get\".  A\ndisadvantage is that the results can look odd if you forget that the\ninputs haven't been rounded:\n\n>>> getcontext().prec = 3\n>>> Decimal('3.104') + Decimal('2.104')\nDecimal('5.21')\n>>> Decimal('3.104') + Decimal('0.000') + Decimal('2.104')\nDecimal('5.20')\n",
            "subsections": []
        },
        "The solution is either to increase precision or to force rounding of": {
            "content": "inputs using the unary plus operation:\n\n>>> getcontext().prec = 3\n>>> +Decimal('1.23456789')      # unary plus triggers rounding\nDecimal('1.23')\n\nAlternatively, inputs can be rounded upon creation using the *note\nContext.createdecimal(): f1b. method:\n\n>>> Context(prec=5, rounding=ROUNDDOWN).createdecimal('1.2345678')\nDecimal('1.2345')\n\nQ. Is the CPython implementation fast for large numbers?\n\nA. Yes.  In the CPython and PyPy3 implementations, the C/CFFI versions\nof the decimal module integrate the high speed libmpdec(1) library for\narbitrary precision correctly rounded decimal floating point arithmetic\n(2).  'libmpdec' uses Karatsuba multiplication(3) for medium-sized\nnumbers and the Number Theoretic Transform(4) for very large numbers.\n\nThe context must be adapted for exact arbitrary precision arithmetic.\n'Emin' and 'Emax' should always be set to the maximum values, 'clamp'\nshould always be 0 (the default).  Setting 'prec' requires some care.\n",
            "subsections": []
        },
        "The easiest approach for trying out bignum arithmetic is to use the": {
            "content": "maximum value for 'prec' as well (5):\n\n>>> setcontext(Context(prec=MAXPREC, Emax=MAXEMAX, Emin=MINEMIN))\n>>> x = Decimal(2)  256\n>>> x / 128\nDecimal('904625697166532776746648320380374280103671755200316906558262375061821325312')\n\nFor inexact results, *note MAXPREC: 238a. is far too large on 64-bit\nplatforms and the available memory will be insufficient:\n\n>>> Decimal(1) / 3\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nMemoryError\n",
            "subsections": []
        },
        "On systems with overallocation (e.g.  Linux), a more sophisticated": {
            "content": "approach is to adjust 'prec' to the amount of available RAM. Suppose\nthat you have 8GB of RAM and expect 10 simultaneous operands using a\nmaximum of 500MB each:\n\n>>> import sys\n>>>\n>>> # Maximum number of digits for a single operand using 500MB in 8-byte words\n>>> # with 19 digits per word (4-byte and 9 digits for the 32-bit build):\n>>> maxdigits = 19 * ((500 * 10242) // 8)\n>>>\n>>> # Check that this works:\n>>> c = Context(prec=maxdigits, Emax=MAXEMAX, Emin=MINEMIN)\n>>> c.traps[Inexact] = True\n>>> setcontext(c)\n>>>\n>>> # Fill the available precision with nines:\n>>> x = Decimal(0).logicalinvert() * 9\n>>> sys.getsizeof(x)\n524288112\n>>> x + 2\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\ndecimal.Inexact: [<class 'decimal.Inexact'>]\n",
            "subsections": []
        },
        "In general (and especially on systems without overallocation), it is": {
            "content": "recommended to estimate even tighter bounds and set the *note Inexact:\n2349. trap if all calculations are expected to be exact.\n\n---------- Footnotes ----------\n\n(1) https://www.bytereef.org/mpdecimal/doc/libmpdec/index.html\n\n(2)\nNew in version 3.3.\n\n(3) https://en.wikipedia.org/wiki/Karatsubaalgorithm\n\n(4)\nhttps://en.wikipedia.org/wiki/DiscreteFouriertransform(general)#Number-theoretictransform\n\n(5)",
            "subsections": []
        },
        "Changed in version 3.9: This approach now works for all exact results": {
            "content": "except for non-integer powers.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: fractions -- Rational numbers,  Next: random -- Generate pseudo-random numbers,  Prev: decimal -- Decimal fixed point and floating point arithmetic,  Up: Numeric and Mathematical Modules": {
            "content": "'Source code:' Lib/fractions.py(1)\n\n\n\nThe *note fractions: 58. module provides support for rational number\narithmetic.\n\nA Fraction instance can be constructed from a pair of integers, from\nanother rational number, or from a string.\n\n-- Class: fractions.Fraction (numerator=0, denominator=1)\n\n-- Class: fractions.Fraction (otherfraction)\n\n-- Class: fractions.Fraction (float)\n\n-- Class: fractions.Fraction (decimal)\n\n-- Class: fractions.Fraction (string)\n\nThe first version requires that 'numerator' and 'denominator' are\ninstances of *note numbers.Rational: 1136. and returns a new *note\nFraction: 1a8. instance with value 'numerator/denominator'.  If\n'denominator' is '0', it raises a *note ZeroDivisionError: 763.\nThe second version requires that 'otherfraction' is an instance of\n*note numbers.Rational: 1136. and returns a *note Fraction: 1a8.\ninstance with the same value.  The next two versions accept either\na *note float: 4b7. or a *note decimal.Decimal: 5c3. instance, and\nreturn a *note Fraction: 1a8. instance with exactly the same value.\nNote that due to the usual issues with binary floating-point (see\n*note Floating Point Arithmetic; Issues and Limitations: 1a94.),\nthe argument to 'Fraction(1.1)' is not exactly equal to 11/10, and\nso 'Fraction(1.1)' does 'not' return 'Fraction(11, 10)' as one\nmight expect.  (But see the documentation for the *note\nlimitdenominator(): 23dd. method below.)  The last version of the\nconstructor expects a string or unicode instance.  The usual form\nfor this instance is:\n\n[sign] numerator ['/' denominator]\n\nwhere the optional 'sign' may be either '+' or '-' and 'numerator'\nand 'denominator' (if present) are strings of decimal digits\n(underscores may be used to delimit digits as with integral\nliterals in code).  In addition, any string that represents a\nfinite value and is accepted by the *note float: 4b7. constructor\nis also accepted by the *note Fraction: 1a8. constructor.  In\neither form the input string may also have leading and/or trailing\nwhitespace.  Here are some examples:\n\n>>> from fractions import Fraction\n>>> Fraction(16, -10)\nFraction(-8, 5)\n>>> Fraction(123)\nFraction(123, 1)\n>>> Fraction()\nFraction(0, 1)\n>>> Fraction('3/7')\nFraction(3, 7)\n>>> Fraction(' -3/7 ')\nFraction(-3, 7)\n>>> Fraction('1.414213 \\t\\n')\nFraction(1414213, 1000000)\n>>> Fraction('-.125')\nFraction(-1, 8)\n>>> Fraction('7e-6')\nFraction(7, 1000000)\n>>> Fraction(2.25)\nFraction(9, 4)\n>>> Fraction(1.1)\nFraction(2476979795053773, 2251799813685248)\n>>> from decimal import Decimal\n>>> Fraction(Decimal('1.1'))\nFraction(11, 10)\n\nThe *note Fraction: 1a8. class inherits from the abstract base\nclass *note numbers.Rational: 1136, and implements all of the\nmethods and operations from that class.  *note Fraction: 1a8.\ninstances are *note hashable: 3db, and should be treated as\nimmutable.  In addition, *note Fraction: 1a8. has the following\nproperties and methods:\n\nChanged in version 3.2: The *note Fraction: 1a8. constructor now\naccepts *note float: 4b7. and *note decimal.Decimal: 5c3.\ninstances.\n\nChanged in version 3.9: The *note math.gcd(): 72c. function is now\nused to normalize the 'numerator' and 'denominator'.  *note\nmath.gcd(): 72c. always return a *note int: 17e. type.  Previously,\nthe GCD type depended on 'numerator' and 'denominator'.\n\nChanged in version 3.11: Underscores are now permitted when\ncreating a *note Fraction: 1a8. instance from a string, following\nPEP 515(2) rules.\n\nChanged in version 3.11: *note Fraction: 1a8. implements 'int'\nnow to satisfy 'typing.SupportsInt' instance checks.\n\nChanged in version 3.12: Space is allowed around the slash for\nstring inputs: 'Fraction('2 / 3')'.\n\nChanged in version 3.12: *note Fraction: 1a8. instances now support\nfloat-style formatting, with presentation types '\"e\"', '\"E\"',\n'\"f\"', '\"F\"', '\"g\"', '\"G\"' and '\"%\"\"'.\n\n-- Attribute: numerator\n\nNumerator of the Fraction in lowest term.\n\n-- Attribute: denominator\n\nDenominator of the Fraction in lowest term.\n\n-- Method: asintegerratio ()\n\nReturn a tuple of two integers, whose ratio is equal to the\noriginal Fraction.  The ratio is in lowest terms and has a\npositive denominator.\n\nNew in version 3.8.\n\n-- Method: isinteger ()\n\nReturn 'True' if the Fraction is an integer.\n\nNew in version 3.12.\n\n-- Method: classmethod fromfloat (flt)\n\nAlternative constructor which only accepts instances of *note\nfloat: 4b7. or *note numbers.Integral: 1cc3.  Beware that\n'Fraction.fromfloat(0.3)' is not the same value as\n'Fraction(3, 10)'.\n\nNote: From Python 3.2 onwards, you can also construct a\n*note Fraction: 1a8. instance directly from a *note\nfloat: 4b7.\n\n-- Method: classmethod fromdecimal (dec)\n\nAlternative constructor which only accepts instances of *note\ndecimal.Decimal: 5c3. or *note numbers.Integral: 1cc3.\n\nNote: From Python 3.2 onwards, you can also construct a\n*note Fraction: 1a8. instance directly from a *note\ndecimal.Decimal: 5c3. instance.\n\n-- Method: limitdenominator (maxdenominator=1000000)\n\nFinds and returns the closest *note Fraction: 1a8. to 'self'\nthat has denominator at most maxdenominator.  This method is\nuseful for finding rational approximations to a given\nfloating-point number:\n\n>>> from fractions import Fraction\n>>> Fraction('3.1415926535897932').limitdenominator(1000)\nFraction(355, 113)\n\nor for recovering a rational number that's represented as a\nfloat:\n\n>>> from math import pi, cos\n>>> Fraction(cos(pi/3))\nFraction(4503599627370497, 9007199254740992)\n>>> Fraction(cos(pi/3)).limitdenominator()\nFraction(1, 2)\n>>> Fraction(1.1).limitdenominator()\nFraction(11, 10)\n\n-- Method: floor ()\n\nReturns the greatest *note int: 17e. '<= self'.  This method\ncan also be accessed through the *note math.floor(): 1216.\nfunction:\n\n>>> from math import floor\n>>> floor(Fraction(355, 113))\n3\n\n-- Method: ceil ()\n\nReturns the least *note int: 17e. '>= self'.  This method can\nalso be accessed through the *note math.ceil(): 1217.\nfunction.\n\n-- Method: round ()\n\n-- Method: round (ndigits)\n\nThe first version returns the nearest *note int: 17e. to\n'self', rounding half to even.  The second version rounds\n'self' to the nearest multiple of 'Fraction(1, 10ndigits)'\n(logically, if 'ndigits' is negative), again rounding half\ntoward even.  This method can also be accessed through the\n*note round(): 114f. function.\n\n-- Method: format (formatspec, /)\n\nProvides support for float-style formatting of *note Fraction:\n1a8. instances via the *note str.format(): 3ed. method, the\n*note format(): 3eb. built-in function, or *note Formatted\nstring literals: 7cd.  The presentation types '\"e\"', '\"E\"',\n'\"f\"', '\"F\"', '\"g\"', '\"G\"' and '\"%\"' are supported.  For these\npresentation types, formatting for a *note Fraction: 1a8.\nobject 'x' follows the rules outlined for the *note float:\n4b7. type in the *note Format Specification Mini-Language:\n3a7. section.\n\nHere are some examples:\n\n>>> from fractions import Fraction\n>>> format(Fraction(1, 7), '.40g')\n'0.1428571428571428571428571428571428571429'\n>>> format(Fraction('1234567.855'), '.2f')\n'1234567.86'\n>>> f\"{Fraction(355, 113):*>20.6e}\"\n'3.141593e+00'\n>>> oldprice, newprice = 499, 672\n>>> \"{:.2%} price increase\".format(Fraction(newprice, oldprice) - 1)\n'34.67% price increase'\n\nSee also\n........\n\nModule *note numbers: 99.\n\nThe abstract base classes making up the numeric tower.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/fractions.py\n\n(2) https://peps.python.org/pep-0515/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: random -- Generate pseudo-random numbers,  Next: statistics -- Mathematical statistics functions,  Prev: fractions -- Rational numbers,  Up: Numeric and Mathematical Modules": {
            "content": "'Source code:' Lib/random.py(1)\n\n\n",
            "subsections": []
        },
        "This module implements pseudo-random number generators for various": {
            "content": "distributions.\n",
            "subsections": []
        },
        "For integers, there is uniform selection from a range.  For sequences,": {
            "content": "there is uniform selection of a random element, a function to generate a\nrandom permutation of a list in-place, and a function for random\nsampling without replacement.\n",
            "subsections": []
        },
        "On the real line, there are functions to compute uniform, normal": {
            "content": "(Gaussian), lognormal, negative exponential, gamma, and beta\ndistributions.  For generating distributions of angles, the von Mises\ndistribution is available.\n\nAlmost all module functions depend on the basic function *note random():\n52f, which generates a random float uniformly in the half-open range\n'0.0 <= X < 1.0'.  Python uses the Mersenne Twister as the core\ngenerator.  It produces 53-bit precision floats and has a period of\n219937-1.  The underlying implementation in C is both fast and\nthreadsafe.  The Mersenne Twister is one of the most extensively tested\nrandom number generators in existence.  However, being completely\ndeterministic, it is not suitable for all purposes, and is completely\nunsuitable for cryptographic purposes.\n",
            "subsections": []
        },
        "The functions supplied by this module are actually bound methods of a": {
            "content": "hidden instance of the *note random.Random: 1608. class.  You can\ninstantiate your own instances of *note Random: 1608. to get generators\nthat don't share state.\n\nClass *note Random: 1608. can also be subclassed if you want to use a\ndifferent basic generator of your own devising: see the documentation on\nthat class for more details.\n\nThe *note random: b3. module also provides the *note SystemRandom: 23e5.\nclass which uses the system function *note os.urandom(): 276. to\ngenerate random numbers from sources provided by the operating system.\n\nWarning: The pseudo-random generators of this module should not be\nused for security purposes.  For security or cryptographic uses,\nsee the *note secrets: bb. module.\n\nSee also\n........\n\nM. Matsumoto and T. Nishimura, \"Mersenne Twister: A 623-dimensionally\nequidistributed uniform pseudorandom number generator\", ACM Transactions\non Modeling and Computer Simulation Vol.  8, No.  1, January pp.3-30\n1998.\n",
            "subsections": []
        },
        "Complementary-Multiply-with-Carry recipe(2) for a compatible alternative": {
            "content": "random number generator with a long period and comparatively simple\nupdate operations.\n\n* Menu:\n\n* Bookkeeping functions::\n* Functions for bytes::\n* Functions for integers::\n* Functions for sequences::\n* Discrete distributions::\n* Real-valued distributions::\n* Alternative Generator::\n* Notes on Reproducibility::\n* Examples: Examples<4>.\n* Recipes: Recipes<2>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/random.py\n\n(2) https://code.activestate.com/recipes/576707/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Bookkeeping functions,  Next: Functions for bytes,  Up: random -- Generate pseudo-random numbers": {
            "content": "5.9.6.1 Bookkeeping functions\n.............................\n\n-- Function: random.seed (a=None, version=2)\n\nInitialize the random number generator.\n\nIf 'a' is omitted or 'None', the current system time is used.  If\nrandomness sources are provided by the operating system, they are\nused instead of the system time (see the *note os.urandom(): 276.\nfunction for details on availability).\n\nIf 'a' is an int, it is used directly.\n\nWith version 2 (the default), a *note str: 157, *note bytes: 295,\nor *note bytearray: 294. object gets converted to an *note int:\n17e. and all of its bits are used.\n\nWith version 1 (provided for reproducing random sequences from\nolder versions of Python), the algorithm for *note str: 157. and\n*note bytes: 295. generates a narrower range of seeds.\n\nChanged in version 3.2: Moved to the version 2 scheme which uses\nall of the bits in a string seed.\n\nChanged in version 3.11: The 'seed' must be one of the following\ntypes: 'None', *note int: 17e, *note float: 4b7, *note str: 157,\n*note bytes: 295, or *note bytearray: 294.\n\n-- Function: random.getstate ()\n\nReturn an object capturing the current internal state of the\ngenerator.  This object can be passed to *note setstate(): 23e8. to\nrestore the state.\n\n-- Function: random.setstate (state)\n\n'state' should have been obtained from a previous call to *note\ngetstate(): 23e7, and *note setstate(): 23e8. restores the internal\nstate of the generator to what it was at the time *note getstate():\n23e7. was called.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Functions for bytes,  Next: Functions for integers,  Prev: Bookkeeping functions,  Up: random -- Generate pseudo-random numbers": {
            "content": "5.9.6.2 Functions for bytes\n...........................\n\n-- Function: random.randbytes (n)\n\nGenerate 'n' random bytes.\n\nThis method should not be used for generating security tokens.  Use\n*note secrets.tokenbytes(): 23ea. instead.\n\nNew in version 3.9.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Functions for integers,  Next: Functions for sequences,  Prev: Functions for bytes,  Up: random -- Generate pseudo-random numbers": {
            "content": "5.9.6.3 Functions for integers\n..............................\n\n-- Function: random.randrange (stop)\n\n-- Function: random.randrange (start, stop[, step])\n\nReturn a randomly selected element from 'range(start, stop, step)'.\n\nThis is roughly equivalent to 'choice(range(start, stop, step))'\nbut supports arbitrarily large ranges and is optimized for common\ncases.\n\nThe positional argument pattern matches the *note range(): 761.\nfunction.\n\nKeyword arguments should not be used because they can be\ninterpreted in unexpected ways.  For example 'randrange(start=100)'\nis interpreted as 'randrange(0, 100, 1)'.\n\nChanged in version 3.2: *note randrange(): 665. is more\nsophisticated about producing equally distributed values.  Formerly\nit used a style like 'int(random()*n)' which could produce slightly\nuneven distributions.\n\nChanged in version 3.12: Automatic conversion of non-integer types\nis no longer supported.  Calls such as 'randrange(10.0)' and\n'randrange(Fraction(10, 1))' now raise a *note TypeError: 28e.\n\n-- Function: random.randint (a, b)\n\nReturn a random integer 'N' such that 'a <= N <= b'.  Alias for\n'randrange(a, b+1)'.\n\n-- Function: random.getrandbits (k)\n\nReturns a non-negative Python integer with 'k' random bits.  This\nmethod is supplied with the Mersenne Twister generator and some\nother generators may also provide it as an optional part of the\nAPI.  When available, *note getrandbits(): e81. enables *note\nrandrange(): 665. to handle arbitrarily large ranges.\n\nChanged in version 3.9: This method now accepts zero for 'k'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Functions for sequences,  Next: Discrete distributions,  Prev: Functions for integers,  Up: random -- Generate pseudo-random numbers": {
            "content": "5.9.6.4 Functions for sequences\n...............................\n\n-- Function: random.choice (seq)\n\nReturn a random element from the non-empty sequence 'seq'.  If\n'seq' is empty, raises *note IndexError: 138f.\n\n-- Function: random.choices (population, weights=None, *,\ncumweights=None, k=1)\n\nReturn a 'k' sized list of elements chosen from the 'population'\nwith replacement.  If the 'population' is empty, raises *note\nIndexError: 138f.\n\nIf a 'weights' sequence is specified, selections are made according\nto the relative weights.  Alternatively, if a 'cumweights'\nsequence is given, the selections are made according to the\ncumulative weights (perhaps computed using *note\nitertools.accumulate(): 825.).  For example, the relative weights\n'[10, 5, 30, 5]' are equivalent to the cumulative weights '[10, 15,\n45, 50]'.  Internally, the relative weights are converted to\ncumulative weights before making selections, so supplying the\ncumulative weights saves work.\n\nIf neither 'weights' nor 'cumweights' are specified, selections\nare made with equal probability.  If a weights sequence is\nsupplied, it must be the same length as the 'population' sequence.\nIt is a *note TypeError: 28e. to specify both 'weights' and\n'cumweights'.\n\nThe 'weights' or 'cumweights' can use any numeric type that\ninteroperates with the *note float: 4b7. values returned by *note\nrandom(): b3. (that includes integers, floats, and fractions but\nexcludes decimals).  Weights are assumed to be non-negative and\nfinite.  A *note ValueError: 183. is raised if all weights are\nzero.\n\nFor a given seed, the *note choices(): b15. function with equal\nweighting typically produces a different sequence than repeated\ncalls to *note choice(): 10a6.  The algorithm used by *note\nchoices(): b15. uses floating point arithmetic for internal\nconsistency and speed.  The algorithm used by *note choice(): 10a6.\ndefaults to integer arithmetic with repeated selections to avoid\nsmall biases from round-off error.\n\nNew in version 3.6.\n\nChanged in version 3.9: Raises a *note ValueError: 183. if all\nweights are zero.\n\n-- Function: random.shuffle (x)\n\nShuffle the sequence 'x' in place.\n\nTo shuffle an immutable sequence and return a new shuffled list,\nuse 'sample(x, k=len(x))' instead.\n\nNote that even for small 'len(x)', the total number of permutations\nof 'x' can quickly grow larger than the period of most random\nnumber generators.  This implies that most permutations of a long\nsequence can never be generated.  For example, a sequence of length\n2080 is the largest that can fit within the period of the Mersenne\nTwister random number generator.\n\nChanged in version 3.11: Removed the optional parameter 'random'.\n\n-- Function: random.sample (population, k, *, counts=None)\n\nReturn a 'k' length list of unique elements chosen from the\npopulation sequence.  Used for random sampling without replacement.\n\nReturns a new list containing elements from the population while\nleaving the original population unchanged.  The resulting list is\nin selection order so that all sub-slices will also be valid random\nsamples.  This allows raffle winners (the sample) to be partitioned\ninto grand prize and second place winners (the subslices).\n\nMembers of the population need not be *note hashable: 3db. or\nunique.  If the population contains repeats, then each occurrence\nis a possible selection in the sample.\n\nRepeated elements can be specified one at a time or with the\noptional keyword-only 'counts' parameter.  For example,\n'sample(['red', 'blue'], counts=[4, 2], k=5)' is equivalent to\n'sample(['red', 'red', 'red', 'red', 'blue', 'blue'], k=5)'.\n\nTo choose a sample from a range of integers, use a *note range():\n761. object as an argument.  This is especially fast and space\nefficient for sampling from a large population:\n'sample(range(10000000), k=60)'.\n\nIf the sample size is larger than the population size, a *note\nValueError: 183. is raised.\n\nChanged in version 3.9: Added the 'counts' parameter.\n\nChanged in version 3.11: The 'population' must be a sequence.\nAutomatic conversion of sets to lists is no longer supported.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Discrete distributions,  Next: Real-valued distributions,  Prev: Functions for sequences,  Up: random -- Generate pseudo-random numbers": {
            "content": "5.9.6.5 Discrete distributions\n..............................\n\nThe following function generates a discrete distribution.\n\n-- Function: random.binomialvariate (n=1, p=0.5)\n\nBinomial distribution(1).  Return the number of successes for 'n'\nindependent trials with the probability of success in each trial\nbeing 'p':\n\nMathematically equivalent to:\n\nsum(random() < p for i in range(n))\n\nThe number of trials 'n' should be a non-negative integer.  The\nprobability of success 'p' should be between '0.0 <= p <= 1.0'.\nThe result is an integer in the range '0 <= X <= n'.\n\nNew in version 3.12.\n\n---------- Footnotes ----------\n\n(1) https://mathworld.wolfram.com/BinomialDistribution.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Real-valued distributions,  Next: Alternative Generator,  Prev: Discrete distributions,  Up: random -- Generate pseudo-random numbers": {
            "content": "5.9.6.6 Real-valued distributions\n.................................\n\nThe following functions generate specific real-valued distributions.",
            "subsections": []
        },
        "Function parameters are named after the corresponding variables in the": {
            "content": "distribution's equation, as used in common mathematical practice; most\nof these equations can be found in any statistics text.\n\n-- Function: random.random ()\n\nReturn the next random floating point number in the range '0.0 <= X\n< 1.0'\n\n-- Function: random.uniform (a, b)\n\nReturn a random floating point number 'N' such that 'a <= N <= b'\nfor 'a <= b' and 'b <= N <= a' for 'b < a'.\n\nThe end-point value 'b' may or may not be included in the range\ndepending on floating-point rounding in the expression 'a + (b-a) *\nrandom()'.\n\n-- Function: random.triangular (low, high, mode)\n\nReturn a random floating point number 'N' such that 'low <= N <=\nhigh' and with the specified 'mode' between those bounds.  The\n'low' and 'high' bounds default to zero and one.  The 'mode'\nargument defaults to the midpoint between the bounds, giving a\nsymmetric distribution.\n\n-- Function: random.betavariate (alpha, beta)\n\nBeta distribution.  Conditions on the parameters are 'alpha > 0'\nand 'beta > 0'.  Returned values range between 0 and 1.\n\n-- Function: random.expovariate (lambd=1.0)\n\nExponential distribution.  'lambd' is 1.0 divided by the desired\nmean.  It should be nonzero.  (The parameter would be called\n\"lambda\", but that is a reserved word in Python.)  Returned values\nrange from 0 to positive infinity if 'lambd' is positive, and from\nnegative infinity to 0 if 'lambd' is negative.\n\nChanged in version 3.12: Added the default value for 'lambd'.\n\n-- Function: random.gammavariate (alpha, beta)\n\nGamma distribution.  ('Not' the gamma function!)  The shape and\nscale parameters, 'alpha' and 'beta', must have positive values.\n(Calling conventions vary and some sources define 'beta' as the\ninverse of the scale).\n\nThe probability distribution function is:\n\nx  (alpha - 1) * math.exp(-x / beta)\npdf(x) =  --------------------------------------\nmath.gamma(alpha) * beta  alpha\n\n-- Function: random.gauss (mu=0.0, sigma=1.0)\n\nNormal distribution, also called the Gaussian distribution.  'mu'\nis the mean, and 'sigma' is the standard deviation.  This is\nslightly faster than the *note normalvariate(): 15a5. function\ndefined below.\n\nMultithreading note: When two threads call this function\nsimultaneously, it is possible that they will receive the same\nreturn value.  This can be avoided in three ways.  1) Have each\nthread use a different instance of the random number generator.  2)\nPut locks around all calls.  3) Use the slower, but thread-safe\n*note normalvariate(): 15a5. function instead.\n\nChanged in version 3.11: 'mu' and 'sigma' now have default\narguments.\n\n-- Function: random.lognormvariate (mu, sigma)\n\nLog normal distribution.  If you take the natural logarithm of this\ndistribution, you'll get a normal distribution with mean 'mu' and\nstandard deviation 'sigma'.  'mu' can have any value, and 'sigma'\nmust be greater than zero.\n\n-- Function: random.normalvariate (mu=0.0, sigma=1.0)\n\nNormal distribution.  'mu' is the mean, and 'sigma' is the standard\ndeviation.\n\nChanged in version 3.11: 'mu' and 'sigma' now have default\narguments.\n\n-- Function: random.vonmisesvariate (mu, kappa)\n\n'mu' is the mean angle, expressed in radians between 0 and 2*'pi',\nand 'kappa' is the concentration parameter, which must be greater\nthan or equal to zero.  If 'kappa' is equal to zero, this\ndistribution reduces to a uniform random angle over the range 0 to\n2*'pi'.\n\n-- Function: random.paretovariate (alpha)\n\nPareto distribution.  'alpha' is the shape parameter.\n\n-- Function: random.weibullvariate (alpha, beta)\n\nWeibull distribution.  'alpha' is the scale parameter and 'beta' is\nthe shape parameter.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Alternative Generator,  Next: Notes on Reproducibility,  Prev: Real-valued distributions,  Up: random -- Generate pseudo-random numbers": {
            "content": "5.9.6.7 Alternative Generator\n.............................\n\n-- Class: random.Random ([seed])\n\nClass that implements the default pseudo-random number generator\nused by the *note random: b3. module.\n\nChanged in version 3.11: Formerly the 'seed' could be any hashable\nobject.  Now it is limited to: 'None', *note int: 17e, *note float:\n4b7, *note str: 157, *note bytes: 295, or *note bytearray: 294.\n\nSubclasses of 'Random' should override the following methods if\nthey wish to make use of a different basic generator:\n\n-- Method: seed (a=None, version=2)\n\nOverride this method in subclasses to customise the *note\nseed(): 10ec. behaviour of 'Random' instances.\n\n-- Method: getstate ()\n\nOverride this method in subclasses to customise the *note\ngetstate(): 23e7. behaviour of 'Random' instances.\n\n-- Method: setstate (state)\n\nOverride this method in subclasses to customise the *note\nsetstate(): 23e8. behaviour of 'Random' instances.\n\n-- Method: random ()\n\nOverride this method in subclasses to customise the *note\nrandom(): 52f. behaviour of 'Random' instances.\n\nOptionally, a custom generator subclass can also supply the\nfollowing method:\n\n-- Method: getrandbits (k)\n\nOverride this method in subclasses to customise the *note\ngetrandbits(): e81. behaviour of 'Random' instances.\n\n-- Class: random.SystemRandom ([seed])\n\nClass that uses the *note os.urandom(): 276. function for\ngenerating random numbers from sources provided by the operating\nsystem.  Not available on all systems.  Does not rely on software\nstate, and sequences are not reproducible.  Accordingly, the *note\nseed(): 10ec. method has no effect and is ignored.  The *note\ngetstate(): 23e7. and *note setstate(): 23e8. methods raise *note\nNotImplementedError: ba5. if called.\n\nFile: python3.12.info,  Node: Notes on Reproducibility,  Next: Examples<4>,  Prev: Alternative Generator,  Up: random -- Generate pseudo-random numbers\n\n5.9.6.8 Notes on Reproducibility\n................................\n",
            "subsections": []
        },
        "Sometimes it is useful to be able to reproduce the sequences given by a": {
            "content": "pseudo-random number generator.  By reusing a seed value, the same\nsequence should be reproducible from run to run as long as multiple\nthreads are not running.\n",
            "subsections": []
        },
        "Most of the random module's algorithms and seeding functions are subject": {
            "content": "to change across Python versions, but two aspects are guaranteed not to\nchange:\n\n* If a new seeding method is added, then a backward compatible seeder\nwill be offered.\n\n* The generator's *note random(): 23fb. method will continue to\nproduce the same sequence when the compatible seeder is given the\nsame seed.\n\nFile: python3.12.info,  Node: Examples<4>,  Next: Recipes<2>,  Prev: Notes on Reproducibility,  Up: random -- Generate pseudo-random numbers\n\n5.9.6.9 Examples\n................\n\nBasic examples:\n\n>>> random()                          # Random float:  0.0 <= x < 1.0\n0.37444887175646646\n\n>>> uniform(2.5, 10.0)                # Random float:  2.5 <= x <= 10.0\n3.1800146073117523\n\n>>> expovariate(1 / 5)                # Interval between arrivals averaging 5 seconds\n5.148957571865031\n\n>>> randrange(10)                     # Integer from 0 to 9 inclusive\n7\n\n>>> randrange(0, 101, 2)              # Even integer from 0 to 100 inclusive\n26\n\n>>> choice(['win', 'lose', 'draw'])   # Single random element from a sequence\n'draw'\n\n>>> deck = 'ace two three four'.split()\n>>> shuffle(deck)                     # Shuffle a list\n>>> deck\n['four', 'two', 'ace', 'three']\n\n>>> sample([10, 20, 30, 40, 50], k=4) # Four samples without replacement\n[40, 10, 50, 30]\n\nSimulations:\n\n>>> # Six roulette wheel spins (weighted sampling with replacement)\n>>> choices(['red', 'black', 'green'], [18, 18, 2], k=6)\n['red', 'green', 'black', 'black', 'red', 'black']\n\n>>> # Deal 20 cards without replacement from a deck\n>>> # of 52 playing cards, and determine the proportion of cards\n>>> # with a ten-value:  ten, jack, queen, or king.\n>>> deal = sample(['tens', 'low cards'], counts=[16, 36], k=20)\n>>> deal.count('tens') / 20\n0.15\n\n>>> # Estimate the probability of getting 5 or more heads from 7 spins\n>>> # of a biased coin that settles on heads 60% of the time.\n>>> sum(binomialvariate(n=7, p=0.6) >= 5 for i in range(10000)) / 10000\n0.4169\n\n>>> # Probability of the median of 5 samples being in middle two quartiles\n>>> def trial():\n...     return 2500 <= sorted(choices(range(10000), k=5))[2] < 7500\n...\n>>> sum(trial() for i in range(10000)) / 10000\n0.7958\n",
            "subsections": []
        },
        "Example of statistical bootstrapping(1) using resampling with": {
            "content": "replacement to estimate a confidence interval for the mean of a sample:\n\n# https://www.thoughtco.com/example-of-bootstrapping-3126155\nfrom statistics import fmean as mean\nfrom random import choices\n\ndata = [41, 50, 29, 37, 81, 30, 73, 63, 20, 35, 68, 22, 60, 31, 95]\nmeans = sorted(mean(choices(data, k=len(data))) for i in range(100))\nprint(f'The sample mean of {mean(data):.1f} has a 90% confidence '\nf'interval from {means[5]:.1f} to {means[94]:.1f}')\n",
            "subsections": []
        },
        "Example of a resampling permutation test(2) to determine the statistical": {
            "content": "significance or p-value(3) of an observed difference between the effects\nof a drug versus a placebo:\n\n# Example from \"Statistics is Easy\" by Dennis Shasha and Manda Wilson\nfrom statistics import fmean as mean\nfrom random import shuffle\n\ndrug = [54, 73, 53, 70, 73, 68, 52, 65, 65]\nplacebo = [54, 51, 58, 44, 55, 52, 42, 47, 58, 46]\nobserveddiff = mean(drug) - mean(placebo)\n\nn = 10000\ncount = 0\ncombined = drug + placebo\nfor i in range(n):\nshuffle(combined)\nnewdiff = mean(combined[:len(drug)]) - mean(combined[len(drug):])\ncount += (newdiff >= observeddiff)\n\nprint(f'{n} label reshufflings produced only {count} instances with a difference')\nprint(f'at least as extreme as the observed difference of {observeddiff:.1f}.')\nprint(f'The one-sided p-value of {count / n:.4f} leads us to reject the null')\nprint(f'hypothesis that there is no difference between the drug and the placebo.')\n",
            "subsections": []
        },
        "Simulation of arrival times and service deliveries for a multiserver": {
            "content": "queue:\n\nfrom heapq import heapify, heapreplace\nfrom random import expovariate, gauss\nfrom statistics import mean, quantiles\n\naveragearrivalinterval = 5.6\naverageservicetime = 15.0\nstdevservicetime = 3.5\nnumservers = 3\n\nwaits = []\narrivaltime = 0.0\nservers = [0.0] * numservers  # time when each server becomes available\nheapify(servers)\nfor i in range(1000000):\narrivaltime += expovariate(1.0 / averagearrivalinterval)\nnextserveravailable = servers[0]\nwait = max(0.0, nextserveravailable - arrivaltime)\nwaits.append(wait)\nserviceduration = max(0.0, gauss(averageservicetime, stdevservicetime))\nservicecompleted = arrivaltime + wait + serviceduration\nheapreplace(servers, servicecompleted)\n\nprint(f'Mean wait: {mean(waits):.1f}   Max wait: {max(waits):.1f}')\nprint('Quartiles:', [round(q, 1) for q in quantiles(waits)])\n\nSee also\n........\n",
            "subsections": []
        },
        "Statistics for Hackers(4) a video tutorial by Jake Vanderplas(5) on": {
            "content": "statistical analysis using just a few fundamental concepts including\nsimulation, sampling, shuffling, and cross-validation.\n",
            "subsections": []
        },
        "Economics Simulation(6) a simulation of a marketplace by Peter Norvig(7)": {
            "content": "that shows effective use of many of the tools and distributions provided\nby this module (gauss, uniform, sample, betavariate, choice, triangular,\nand randrange).\n\nA Concrete Introduction to Probability (using Python)(8) a tutorial by",
            "subsections": []
        },
        "Peter Norvig(9) covering the basics of probability theory, how to write": {
            "content": "simulations, and how to perform data analysis using Python.\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Bootstrapping(statistics)\n\n(2)\nhttps://en.wikipedia.org/wiki/Resampling(statistics)#Permutationtests\n\n(3) https://en.wikipedia.org/wiki/P-value\n\n(4) https://www.youtube.com/watch?v=Iq9DzN6mvYA\n\n(5) https://us.pycon.org/2016/speaker/profile/295/\n\n(6) https://nbviewer.org/url/norvig.com/ipython/Economics.ipynb\n\n(7) https://norvig.com/bio.html\n\n(8) https://nbviewer.org/url/norvig.com/ipython/Probability.ipynb\n\n(9) https://norvig.com/bio.html\n\nFile: python3.12.info,  Node: Recipes<2>,  Prev: Examples<4>,  Up: random -- Generate pseudo-random numbers\n\n5.9.6.10 Recipes\n................\n",
            "subsections": []
        },
        "These recipes show how to efficiently make random selections from the": {
            "content": "combinatoric iterators in the *note itertools: 7b. module:\n\ndef randomproduct(*args, repeat=1):\n\"Random selection from itertools.product(*args, kwds)\"\npools = [tuple(pool) for pool in args] * repeat\nreturn tuple(map(random.choice, pools))\n\ndef randompermutation(iterable, r=None):\n\"Random selection from itertools.permutations(iterable, r)\"\npool = tuple(iterable)\nr = len(pool) if r is None else r\nreturn tuple(random.sample(pool, r))\n\ndef randomcombination(iterable, r):\n\"Random selection from itertools.combinations(iterable, r)\"\npool = tuple(iterable)\nn = len(pool)\nindices = sorted(random.sample(range(n), r))\nreturn tuple(pool[i] for i in indices)\n\ndef randomcombinationwithreplacement(iterable, r):\n\"Choose r elements with replacement.  Order the result to match the iterable.\"\n# Result will be in set(itertools.combinationswithreplacement(iterable, r)).\npool = tuple(iterable)\nn = len(pool)\nindices = sorted(random.choices(range(n), k=r))\nreturn tuple(pool[i] for i in indices)\n\nThe default *note random(): 52f. returns multiples of 2???????? in the range\n'0.0 ??? x < 1.0'.  All such numbers are evenly spaced and are exactly\nrepresentable as Python floats.  However, many other representable\nfloats in that interval are not possible selections.  For example,\n'0.05954861408025609' isn't an integer multiple of 2????????.\n",
            "subsections": []
        },
        "The following recipe takes a different approach.  All floats in the": {
            "content": "interval are possible selections.  The mantissa comes from a uniform\ndistribution of integers in the range '2????? ??? mantissa < 2?????'.  The\nexponent comes from a geometric distribution where exponents smaller\nthan '-53' occur half as often as the next larger exponent.\n\nfrom random import Random\nfrom math import ldexp\n\nclass FullRandom(Random):\n\ndef random(self):\nmantissa = 0x10000000000000 | self.getrandbits(52)\nexponent = -53\nx = 0\nwhile not x:\nx = self.getrandbits(32)\nexponent += x.bitlength() - 32\nreturn ldexp(mantissa, exponent)\n\nAll *note real valued distributions: 23ef. in the class will use the new\nmethod:\n\n>>> fr = FullRandom()\n>>> fr.random()\n0.05954861408025609\n>>> fr.expovariate(0.25)\n8.87925541791544\n",
            "subsections": []
        },
        "The recipe is conceptually equivalent to an algorithm that chooses from": {
            "content": "all the multiples of 2?????????????? in the range '0.0 ??? x < 1.0'.  All such\nnumbers are evenly spaced, but most have to be rounded down to the\nnearest representable Python float.  (The value 2?????????????? is the smallest\npositive unnormalized float and is equal to 'math.ulp(0.0)'.)\n\nSee also\n........\n\nGenerating Pseudo-random Floating-Point Values(1) a paper by Allen B.",
            "subsections": []
        },
        "Downey describing ways to generate more fine-grained floats than": {
            "content": "normally generated by *note random(): 52f.\n\n---------- Footnotes ----------\n\n(1) https://allendowney.com/research/rand/downey07randfloat.pdf\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: statistics -- Mathematical statistics functions,  Prev: random -- Generate pseudo-random numbers,  Up: Numeric and Mathematical Modules": {
            "content": "New in version 3.4.\n\n'Source code:' Lib/statistics.py(1)\n\n\n",
            "subsections": []
        },
        "This module provides functions for calculating mathematical statistics": {
            "content": "of numeric (*note Real: 1ea1.-valued) data.\n",
            "subsections": []
        },
        "The module is not intended to be a competitor to third-party libraries": {
            "content": "such as NumPy(2), SciPy(3), or proprietary full-featured statistics\npackages aimed at professional statisticians such as Minitab, SAS and",
            "subsections": []
        },
        "Matlab.  It is aimed at the level of graphing and scientific": {
            "content": "calculators.\n\nUnless explicitly noted, these functions support *note int: 17e, *note\nfloat: 4b7, *note Decimal: 5c3. and *note Fraction: 1a8.  Behaviour with\nother types (whether in the numeric tower or not) is currently\nunsupported.  Collections with a mix of types are also undefined and\nimplementation-dependent.  If your input data consists of mixed types,\nyou may be able to use *note map(): 65f. to ensure a consistent result,\nfor example: 'map(float, inputdata)'.\n\nSome datasets use 'NaN' (not a number) values to represent missing data.",
            "subsections": []
        },
        "Since NaNs have unusual comparison semantics, they cause surprising or": {
            "content": "undefined behaviors in the statistics functions that sort data or that\ncount occurrences.  The functions affected are 'median()',\n'medianlow()', 'medianhigh()', 'mediangrouped()', 'mode()',\n'multimode()', and 'quantiles()'.  The 'NaN' values should be stripped\nbefore calling these functions:\n\n>>> from statistics import median\n>>> from math import isnan\n>>> from itertools import filterfalse\n\n>>> data = [20.7, float('NaN'),19.2, 18.3, float('NaN'), 14.4]\n>>> sorted(data)  # This has surprising behavior\n[20.7, nan, 14.4, 18.3, 19.2, nan]\n>>> median(data)  # This result is unexpected\n16.35\n\n>>> sum(map(isnan, data))    # Number of missing values\n2\n>>> clean = list(filterfalse(isnan, data))  # Strip NaN values\n>>> clean\n[20.7, 19.2, 18.3, 14.4]\n>>> sorted(clean)  # Sorting now works as expected\n[14.4, 18.3, 19.2, 20.7]\n>>> median(clean)       # This result is now well defined\n18.75\n\n* Menu:\n\n* Averages and measures of central location::\n* Measures of spread::\n* Statistics for relations between two inputs::\n* Function details::\n* Exceptions: Exceptions<5>.\n* NormalDist objects::\n* Examples and Recipes: Examples and Recipes<2>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/statistics.py\n\n(2) https://numpy.org\n\n(3) https://scipy.org/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Averages and measures of central location,  Next: Measures of spread,  Up: statistics -- Mathematical statistics functions": {
            "content": "5.9.7.1 Averages and measures of central location\n.................................................\n",
            "subsections": []
        },
        "These functions calculate an average or typical value from a population": {
            "content": "or sample.\n\n*note mean(): 4a1.          Arithmetic mean (\"average\") of data.\n\n\n*note fmean(): 85f.         Fast, floating point arithmetic mean, with optional weighting.\n\n\n*note geometricmean(): 860.Geometric mean of data.\n\n\n*note harmonicmean(): b30. Harmonic mean of data.\n\n\n*note median(): 2403.       Median (middle value) of data.\n\n\n*note medianlow(): 2404.   Low median of data.\n\n\n*note medianhigh(): 2405.  High median of data.\n\n\n*note mediangrouped(): 2406.Median (50th percentile) of grouped data.\n\n\n*note mode(): 8c4.          Single mode (most common value) of discrete or nominal data.\n\n\n*note multimode(): 861.     List of modes (most common values) of discrete or nominal data.\n\n\n*note quantiles(): 862.     Divide data into intervals with equal probability.\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Measures of spread,  Next: Statistics for relations between two inputs,  Prev: Averages and measures of central location,  Up: statistics -- Mathematical statistics functions": {
            "content": "5.9.7.2 Measures of spread\n..........................\n",
            "subsections": []
        },
        "These functions calculate a measure of how much the population or sample": {
            "content": "tends to deviate from the typical or average values.\n\n*note pstdev(): 2408.       Population standard deviation of data.\n\n\n*note pvariance(): 2409.    Population variance of data.\n\n\n*note stdev(): 4a3.         Sample standard deviation of data.\n\n\n*note variance(): 4a2.      Sample variance of data.\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Statistics for relations between two inputs,  Next: Function details,  Prev: Measures of spread,  Up: statistics -- Mathematical statistics functions": {
            "content": "5.9.7.3 Statistics for relations between two inputs\n...................................................\n",
            "subsections": []
        },
        "These functions calculate statistics regarding relations between two": {
            "content": "inputs.\n\n*note covariance(): 625.      Sample covariance for two variables.\n\n\n*note correlation(): 1e0.     Pearson and Spearman's correlation coefficients.\n\n\n*note linearregression(): 626.Slope and intercept for simple linear regression.\n\n\nFile: python3.12.info,  Node: Function details,  Next: Exceptions<5>,  Prev: Statistics for relations between two inputs,  Up: statistics -- Mathematical statistics functions\n\n5.9.7.4 Function details\n........................\n\nNote: The functions do not require the data given to them to be sorted.",
            "subsections": []
        },
        "However, for reading convenience, most of the examples show sorted": {
            "content": "sequences.\n\n-- Function: statistics.mean (data)\n\nReturn the sample arithmetic mean of 'data' which can be a sequence\nor iterable.\n\nThe arithmetic mean is the sum of the data divided by the number of\ndata points.  It is commonly called \"the average\", although it is\nonly one of many different mathematical averages.  It is a measure\nof the central location of the data.\n\nIf 'data' is empty, *note StatisticsError: 240c. will be raised.\n\nSome examples of use:\n\n>>> mean([1, 2, 3, 4, 4])\n2.8\n>>> mean([-1.0, 2.5, 3.25, 5.75])\n2.625\n\n>>> from fractions import Fraction as F\n>>> mean([F(3, 7), F(1, 21), F(5, 3), F(1, 3)])\nFraction(13, 21)\n\n>>> from decimal import Decimal as D\n>>> mean([D(\"0.5\"), D(\"0.75\"), D(\"0.625\"), D(\"0.375\")])\nDecimal('0.5625')\n\nNote: The mean is strongly affected by outliers(1) and is not\nnecessarily a typical example of the data points.  For a more\nrobust, although less efficient, measure of central\ntendency(2), see *note median(): 2403.\n\nThe sample mean gives an unbiased estimate of the true\npopulation mean, so that when taken on average over all the\npossible samples, 'mean(sample)' converges on the true mean of\nthe entire population.  If 'data' represents the entire\npopulation rather than a sample, then 'mean(data)' is\nequivalent to calculating the true population mean ??.\n\n-- Function: statistics.fmean (data, weights=None)\n\nConvert 'data' to floats and compute the arithmetic mean.\n\nThis runs faster than the *note mean(): 4a1. function and it always\nreturns a *note float: 4b7.  The 'data' may be a sequence or\niterable.  If the input dataset is empty, raises a *note\nStatisticsError: 240c.\n\n>>> fmean([3.5, 4.0, 5.25])\n4.25\n\nOptional weighting is supported.  For example, a professor assigns\na grade for a course by weighting quizzes at 20%, homework at 20%,\na midterm exam at 30%, and a final exam at 30%:\n\n>>> grades = [85, 92, 83, 91]\n>>> weights = [0.20, 0.20, 0.30, 0.30]\n>>> fmean(grades, weights)\n87.6\n\nIf 'weights' is supplied, it must be the same length as the 'data'\nor a *note ValueError: 183. will be raised.\n\nNew in version 3.8.\n\nChanged in version 3.11: Added support for 'weights'.\n\n-- Function: statistics.geometricmean (data)\n\nConvert 'data' to floats and compute the geometric mean.\n\nThe geometric mean indicates the central tendency or typical value\nof the 'data' using the product of the values (as opposed to the\narithmetic mean which uses their sum).\n\nRaises a *note StatisticsError: 240c. if the input dataset is\nempty, if it contains a zero, or if it contains a negative value.\nThe 'data' may be a sequence or iterable.\n\nNo special efforts are made to achieve exact results.  (However,\nthis may change in the future.)\n\n>>> round(geometricmean([54, 24, 36]), 1)\n36.0\n\nNew in version 3.8.\n\n-- Function: statistics.harmonicmean (data, weights=None)\n\nReturn the harmonic mean of 'data', a sequence or iterable of\nreal-valued numbers.  If 'weights' is omitted or 'None', then equal\nweighting is assumed.\n\nThe harmonic mean is the reciprocal of the arithmetic *note mean():\n4a1. of the reciprocals of the data.  For example, the harmonic\nmean of three values 'a', 'b' and 'c' will be equivalent to '3/(1/a\n+ 1/b + 1/c)'.  If one of the values is zero, the result will be\nzero.\n\nThe harmonic mean is a type of average, a measure of the central\nlocation of the data.  It is often appropriate when averaging\nratios or rates, for example speeds.\n\nSuppose a car travels 10 km at 40 km/hr, then another 10 km at 60\nkm/hr.  What is the average speed?\n\n>>> harmonicmean([40, 60])\n48.0\n\nSuppose a car travels 40 km/hr for 5 km, and when traffic clears,\nspeeds-up to 60 km/hr for the remaining 30 km of the journey.  What\nis the average speed?\n\n>>> harmonicmean([40, 60], weights=[5, 30])\n56.0\n\n*note StatisticsError: 240c. is raised if 'data' is empty, any\nelement is less than zero, or if the weighted sum isn't positive.\n\nThe current algorithm has an early-out when it encounters a zero in\nthe input.  This means that the subsequent inputs are not tested\nfor validity.  (This behavior may change in the future.)\n\nNew in version 3.6.\n\nChanged in version 3.10: Added support for 'weights'.\n\n-- Function: statistics.median (data)\n\nReturn the median (middle value) of numeric data, using the common\n\"mean of middle two\" method.  If 'data' is empty, *note\nStatisticsError: 240c. is raised.  'data' can be a sequence or\niterable.\n\nThe median is a robust measure of central location and is less\naffected by the presence of outliers.  When the number of data\npoints is odd, the middle data point is returned:\n\n>>> median([1, 3, 5])\n3\n\nWhen the number of data points is even, the median is interpolated\nby taking the average of the two middle values:\n\n>>> median([1, 3, 5, 7])\n4.0\n\nThis is suited for when your data is discrete, and you don't mind\nthat the median may not be an actual data point.\n\nIf the data is ordinal (supports order operations) but not numeric\n(doesn't support addition), consider using *note medianlow():\n2404. or *note medianhigh(): 2405. instead.\n\n-- Function: statistics.medianlow (data)\n\nReturn the low median of numeric data.  If 'data' is empty, *note\nStatisticsError: 240c. is raised.  'data' can be a sequence or\niterable.\n\nThe low median is always a member of the data set.  When the number\nof data points is odd, the middle value is returned.  When it is\neven, the smaller of the two middle values is returned.\n\n>>> medianlow([1, 3, 5])\n3\n>>> medianlow([1, 3, 5, 7])\n3\n\nUse the low median when your data are discrete and you prefer the\nmedian to be an actual data point rather than interpolated.\n\n-- Function: statistics.medianhigh (data)\n\nReturn the high median of data.  If 'data' is empty, *note\nStatisticsError: 240c. is raised.  'data' can be a sequence or\niterable.\n\nThe high median is always a member of the data set.  When the\nnumber of data points is odd, the middle value is returned.  When\nit is even, the larger of the two middle values is returned.\n\n>>> medianhigh([1, 3, 5])\n3\n>>> medianhigh([1, 3, 5, 7])\n5\n\nUse the high median when your data are discrete and you prefer the\nmedian to be an actual data point rather than interpolated.\n\n-- Function: statistics.mediangrouped (data, interval=1.0)\n\nEstimates the median for numeric data that has been grouped or\nbinned(3) around the midpoints of consecutive, fixed-width\nintervals.\n\nThe 'data' can be any iterable of numeric data with each value\nbeing exactly the midpoint of a bin.  At least one value must be\npresent.\n\nThe 'interval' is the width of each bin.\n\nFor example, demographic information may have been summarized into\nconsecutive ten-year age groups with each group being represented\nby the 5-year midpoints of the intervals:\n\n>>> from collections import Counter\n>>> demographics = Counter({\n...    25: 172,   # 20 to 30 years old\n...    35: 484,   # 30 to 40 years old\n...    45: 387,   # 40 to 50 years old\n...    55:  22,   # 50 to 60 years old\n...    65:   6,   # 60 to 70 years old\n... })\n...\n\nThe 50th percentile (median) is the 536th person out of the 1071\nmember cohort.  That person is in the 30 to 40 year old age group.\n\nThe regular *note median(): 2403. function would assume that\neveryone in the tricenarian age group was exactly 35 years old.  A\nmore tenable assumption is that the 484 members of that age group\nare evenly distributed between 30 and 40.  For that, we use *note\nmediangrouped(): 2406.:\n\n>>> data = list(demographics.elements())\n>>> median(data)\n35\n>>> round(mediangrouped(data, interval=10), 1)\n37.5\n\nThe caller is responsible for making sure the data points are\nseparated by exact multiples of 'interval'.  This is essential for\ngetting a correct result.  The function does not check this\nprecondition.\n\nInputs may be any numeric type that can be coerced to a float\nduring the interpolation step.\n\n-- Function: statistics.mode (data)\n\nReturn the single most common data point from discrete or nominal\n'data'.  The mode (when it exists) is the most typical value and\nserves as a measure of central location.\n\nIf there are multiple modes with the same frequency, returns the\nfirst one encountered in the 'data'.  If the smallest or largest of\nthose is desired instead, use 'min(multimode(data))' or\n'max(multimode(data))'.  If the input 'data' is empty, *note\nStatisticsError: 240c. is raised.\n\n'mode' assumes discrete data and returns a single value.  This is\nthe standard treatment of the mode as commonly taught in schools:\n\n>>> mode([1, 1, 2, 3, 3, 3, 3, 4])\n3\n\nThe mode is unique in that it is the only statistic in this package\nthat also applies to nominal (non-numeric) data:\n\n>>> mode([\"red\", \"blue\", \"blue\", \"red\", \"green\", \"red\", \"red\"])\n'red'\n\nChanged in version 3.8: Now handles multimodal datasets by\nreturning the first mode encountered.  Formerly, it raised *note\nStatisticsError: 240c. when more than one mode was found.\n\n-- Function: statistics.multimode (data)\n\nReturn a list of the most frequently occurring values in the order\nthey were first encountered in the 'data'.  Will return more than\none result if there are multiple modes or an empty list if the\n'data' is empty:\n\n>>> multimode('aabbbbccddddeeffffgg')\n['b', 'd', 'f']\n>>> multimode('')\n[]\n\nNew in version 3.8.\n\n-- Function: statistics.pstdev (data, mu=None)\n\nReturn the population standard deviation (the square root of the\npopulation variance).  See *note pvariance(): 2409. for arguments\nand other details.\n\n>>> pstdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75])\n0.986893273527251\n\n-- Function: statistics.pvariance (data, mu=None)\n\nReturn the population variance of 'data', a non-empty sequence or\niterable of real-valued numbers.  Variance, or second moment about\nthe mean, is a measure of the variability (spread or dispersion) of\ndata.  A large variance indicates that the data is spread out; a\nsmall variance indicates it is clustered closely around the mean.\n\nIf the optional second argument 'mu' is given, it is typically the\nmean of the 'data'.  It can also be used to compute the second\nmoment around a point that is not the mean.  If it is missing or\n'None' (the default), the arithmetic mean is automatically\ncalculated.\n\nUse this function to calculate the variance from the entire\npopulation.  To estimate the variance from a sample, the *note\nvariance(): 4a2. function is usually a better choice.\n\nRaises *note StatisticsError: 240c. if 'data' is empty.\n\nExamples:\n\n>>> data = [0.0, 0.25, 0.25, 1.25, 1.5, 1.75, 2.75, 3.25]\n>>> pvariance(data)\n1.25\n\nIf you have already calculated the mean of your data, you can pass\nit as the optional second argument 'mu' to avoid recalculation:\n\n>>> mu = mean(data)\n>>> pvariance(data, mu)\n1.25\n\nDecimals and Fractions are supported:\n\n>>> from decimal import Decimal as D\n>>> pvariance([D(\"27.5\"), D(\"30.25\"), D(\"30.25\"), D(\"34.5\"), D(\"41.75\")])\nDecimal('24.815')\n\n>>> from fractions import Fraction as F\n>>> pvariance([F(1, 4), F(5, 4), F(1, 2)])\nFraction(13, 72)\n\nNote: When called with the entire population, this gives the\npopulation variance ????.  When called on a sample instead, this\nis the biased sample variance s??, also known as variance with\nN degrees of freedom.\n\nIf you somehow know the true population mean ??, you may use\nthis function to calculate the variance of a sample, giving\nthe known population mean as the second argument.  Provided\nthe data points are a random sample of the population, the\nresult will be an unbiased estimate of the population\nvariance.\n\n-- Function: statistics.stdev (data, xbar=None)\n\nReturn the sample standard deviation (the square root of the sample\nvariance).  See *note variance(): 4a2. for arguments and other\ndetails.\n\n>>> stdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75])\n1.0810874155219827\n\n-- Function: statistics.variance (data, xbar=None)\n\nReturn the sample variance of 'data', an iterable of at least two\nreal-valued numbers.  Variance, or second moment about the mean, is\na measure of the variability (spread or dispersion) of data.  A\nlarge variance indicates that the data is spread out; a small\nvariance indicates it is clustered closely around the mean.\n\nIf the optional second argument 'xbar' is given, it should be the\nmean of 'data'.  If it is missing or 'None' (the default), the mean\nis automatically calculated.\n\nUse this function when your data is a sample from a population.  To\ncalculate the variance from the entire population, see *note\npvariance(): 2409.\n\nRaises *note StatisticsError: 240c. if 'data' has fewer than two\nvalues.\n\nExamples:\n\n>>> data = [2.75, 1.75, 1.25, 0.25, 0.5, 1.25, 3.5]\n>>> variance(data)\n1.3720238095238095\n\nIf you have already calculated the mean of your data, you can pass\nit as the optional second argument 'xbar' to avoid recalculation:\n\n>>> m = mean(data)\n>>> variance(data, m)\n1.3720238095238095\n\nThis function does not attempt to verify that you have passed the\nactual mean as 'xbar'.  Using arbitrary values for 'xbar' can lead\nto invalid or impossible results.\n\nDecimal and Fraction values are supported:\n\n>>> from decimal import Decimal as D\n>>> variance([D(\"27.5\"), D(\"30.25\"), D(\"30.25\"), D(\"34.5\"), D(\"41.75\")])\nDecimal('31.01875')\n\n>>> from fractions import Fraction as F\n>>> variance([F(1, 6), F(1, 2), F(5, 3)])\nFraction(67, 108)\n\nNote: This is the sample variance s?? with Bessel's correction,\nalso known as variance with N-1 degrees of freedom.  Provided\nthat the data points are representative (e.g.  independent and\nidentically distributed), the result should be an unbiased\nestimate of the true population variance.\n\nIf you somehow know the actual population mean ?? you should\npass it to the *note pvariance(): 2409. function as the 'mu'\nparameter to get the variance of a sample.\n\n-- Function: statistics.quantiles (data, *, n=4, method='exclusive')\n\nDivide 'data' into 'n' continuous intervals with equal probability.\nReturns a list of 'n - 1' cut points separating the intervals.\n\nSet 'n' to 4 for quartiles (the default).  Set 'n' to 10 for\ndeciles.  Set 'n' to 100 for percentiles which gives the 99 cuts\npoints that separate 'data' into 100 equal sized groups.  Raises\n*note StatisticsError: 240c. if 'n' is not least 1.\n\nThe 'data' can be any iterable containing sample data.  For\nmeaningful results, the number of data points in 'data' should be\nlarger than 'n'.  Raises *note StatisticsError: 240c. if there are\nnot at least two data points.\n\nThe cut points are linearly interpolated from the two nearest data\npoints.  For example, if a cut point falls one-third of the\ndistance between two sample values, '100' and '112', the cut-point\nwill evaluate to '104'.\n\nThe 'method' for computing quantiles can be varied depending on\nwhether the 'data' includes or excludes the lowest and highest\npossible values from the population.\n\nThe default 'method' is \"exclusive\" and is used for data sampled\nfrom a population that can have more extreme values than found in\nthe samples.  The portion of the population falling below the\n'i-th' of 'm' sorted data points is computed as 'i / (m + 1)'.\nGiven nine sample values, the method sorts them and assigns the\nfollowing percentiles: 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%.\n\nSetting the 'method' to \"inclusive\" is used for describing\npopulation data or for samples that are known to include the most\nextreme values from the population.  The minimum value in 'data' is\ntreated as the 0th percentile and the maximum value is treated as\nthe 100th percentile.  The portion of the population falling below\nthe 'i-th' of 'm' sorted data points is computed as '(i - 1) / (m -\n1)'.  Given 11 sample values, the method sorts them and assigns the\nfollowing percentiles: 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%,\n90%, 100%.\n\n# Decile cut points for empirically sampled data\n>>> data = [105, 129, 87, 86, 111, 111, 89, 81, 108, 92, 110,\n...         100, 75, 105, 103, 109, 76, 119, 99, 91, 103, 129,\n...         106, 101, 84, 111, 74, 87, 86, 103, 103, 106, 86,\n...         111, 75, 87, 102, 121, 111, 88, 89, 101, 106, 95,\n...         103, 107, 101, 81, 109, 104]\n>>> [round(q, 1) for q in quantiles(data, n=10)]\n[81.0, 86.2, 89.0, 99.4, 102.5, 103.6, 106.0, 109.8, 111.0]\n\nNew in version 3.8.\n\n-- Function: statistics.covariance (x, y, /)\n\nReturn the sample covariance of two inputs 'x' and 'y'.  Covariance\nis a measure of the joint variability of two inputs.\n\nBoth inputs must be of the same length (no less than two),\notherwise *note StatisticsError: 240c. is raised.\n\nExamples:\n\n>>> x = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n>>> y = [1, 2, 3, 1, 2, 3, 1, 2, 3]\n>>> covariance(x, y)\n0.75\n>>> z = [9, 8, 7, 6, 5, 4, 3, 2, 1]\n>>> covariance(x, z)\n-7.5\n>>> covariance(z, x)\n-7.5\n\nNew in version 3.10.\n\n-- Function: statistics.correlation (x, y, /, *, method='linear')\n\nReturn the Pearson's correlation coefficient(4) for two inputs.\nPearson's correlation coefficient 'r' takes values between -1 and\n+1.  It measures the strength and direction of a linear\nrelationship.\n\nIf 'method' is \"ranked\", computes Spearman's rank correlation\ncoefficient(5) for two inputs.  The data is replaced by ranks.\nTies are averaged so that equal values receive the same rank.  The\nresulting coefficient measures the strength of a monotonic\nrelationship.\n\nSpearman's correlation coefficient is appropriate for ordinal data\nor for continuous data that doesn't meet the linear proportion\nrequirement for Pearson's correlation coefficient.\n\nBoth inputs must be of the same length (no less than two), and need\nnot to be constant, otherwise *note StatisticsError: 240c. is\nraised.\n\nExample with Kepler's laws of planetary motion(6):\n\n>>> # Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, and  Neptune\n>>> orbitalperiod = [88, 225, 365, 687, 4331, 10756, 30687, 60190]    # days\n>>> distfromsun = [58, 108, 150, 228, 778, 1400, 2900, 4500] # million km\n\n>>> # Show that a perfect monotonic relationship exists\n>>> correlation(orbitalperiod, distfromsun, method='ranked')\n1.0\n\n>>> # Observe that a linear relationship is imperfect\n>>> round(correlation(orbitalperiod, distfromsun), 4)\n0.9882\n\n>>> # Demonstrate Kepler's third law: There is a linear correlation\n>>> # between the square of the orbital period and the cube of the\n>>> # distance from the sun.\n>>> periodsquared = [p * p for p in orbitalperiod]\n>>> distcubed = [d * d * d for d in distfromsun]\n>>> round(correlation(periodsquared, distcubed), 4)\n1.0\n\nNew in version 3.10.\n\nChanged in version 3.12: Added support for Spearman's rank\ncorrelation coefficient.\n\n-- Function: statistics.linearregression (x, y, /, *,\nproportional=False)\n\nReturn the slope and intercept of simple linear regression(7)\nparameters estimated using ordinary least squares.  Simple linear\nregression describes the relationship between an independent\nvariable 'x' and a dependent variable 'y' in terms of this linear\nfunction:\n\n'y = slope * x + intercept + noise'\n\nwhere 'slope' and 'intercept' are the regression parameters that\nare estimated, and 'noise' represents the variability of the data\nthat was not explained by the linear regression (it is equal to the\ndifference between predicted and actual values of the dependent\nvariable).\n\nBoth inputs must be of the same length (no less than two), and the\nindependent variable 'x' cannot be constant; otherwise a *note\nStatisticsError: 240c. is raised.\n\nFor example, we can use the release dates of the Monty Python\nfilms(8) to predict the cumulative number of Monty Python films\nthat would have been produced by 2019 assuming that they had kept\nthe pace.\n\n>>> year = [1971, 1975, 1979, 1982, 1983]\n>>> filmstotal = [1, 2, 3, 4, 5]\n>>> slope, intercept = linearregression(year, filmstotal)\n>>> round(slope * 2019 + intercept)\n16\n\nIf 'proportional' is true, the independent variable 'x' and the\ndependent variable 'y' are assumed to be directly proportional.\nThe data is fit to a line passing through the origin.  Since the\n'intercept' will always be 0.0, the underlying linear function\nsimplifies to:\n\n'y = slope * x + noise'\n\nContinuing the example from *note correlation(): 1e0, we look to\nsee how well a model based on major planets can predict the orbital\ndistances for dwarf planets:\n\n>>> model = linearregression(periodsquared, distcubed, proportional=True)\n>>> slope = model.slope\n\n>>> # Dwarf planets:   Pluto,  Eris,    Makemake, Haumea, Ceres\n>>> orbitalperiods = [90560, 204199, 111845, 103410, 1680]  # days\n>>> predicteddist = [math.cbrt(slope * (p * p)) for p in orbitalperiods]\n>>> list(map(round, predicteddist))\n[5912, 10166, 6806, 6459, 414]\n\n>>> [5906, 10152, 6796, 6450, 414]  # actual distance in million km\n[5906, 10152, 6796, 6450, 414]\n\nNew in version 3.10.\n\nChanged in version 3.11: Added support for 'proportional'.\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Outlier\n\n(2) https://en.wikipedia.org/wiki/Centraltendency\n\n(3) https://en.wikipedia.org/wiki/Databinning\n\n(4) https://en.wikipedia.org/wiki/Pearsoncorrelationcoefficient\n\n(5)\nhttps://en.wikipedia.org/wiki/Spearman%27srankcorrelationcoefficient\n\n(6) https://en.wikipedia.org/wiki/Kepler'slawsofplanetarymotion\n\n(7) https://en.wikipedia.org/wiki/Simplelinearregression\n\n(8) https://en.wikipedia.org/wiki/MontyPython#Films\n\nFile: python3.12.info,  Node: Exceptions<5>,  Next: NormalDist objects,  Prev: Function details,  Up: statistics -- Mathematical statistics functions\n\n5.9.7.5 Exceptions\n..................\n\nA single exception is defined:\n\n-- Exception: statistics.StatisticsError\n\nSubclass of *note ValueError: 183. for statistics-related\nexceptions.\n\nFile: python3.12.info,  Node: NormalDist objects,  Next: Examples and Recipes<2>,  Prev: Exceptions<5>,  Up: statistics -- Mathematical statistics functions\n\n5.9.7.6 'NormalDist' objects\n............................\n\n*note NormalDist: 863. is a tool for creating and manipulating normal\ndistributions of a random variable(1).  It is a class that treats the\nmean and standard deviation of data measurements as a single entity.\n",
            "subsections": []
        },
        "Normal distributions arise from the Central Limit Theorem(2) and have a": {
            "content": "wide range of applications in statistics.\n\n-- Class: statistics.NormalDist (mu=0.0, sigma=1.0)\n\nReturns a new 'NormalDist' object where 'mu' represents the\narithmetic mean(3) and 'sigma' represents the standard\ndeviation(4).\n\nIf 'sigma' is negative, raises *note StatisticsError: 240c.\n\n-- Attribute: mean\n\nA read-only property for the arithmetic mean(5) of a normal\ndistribution.\n\n-- Attribute: median\n\nA read-only property for the median(6) of a normal\ndistribution.\n\n-- Attribute: mode\n\nA read-only property for the mode(7) of a normal distribution.\n\n-- Attribute: stdev\n\nA read-only property for the standard deviation(8) of a normal\ndistribution.\n\n-- Attribute: variance\n\nA read-only property for the variance(9) of a normal\ndistribution.  Equal to the square of the standard deviation.\n\n-- Method: classmethod fromsamples (data)\n\nMakes a normal distribution instance with 'mu' and 'sigma'\nparameters estimated from the 'data' using *note fmean(): 85f.\nand *note stdev(): 4a3.\n\nThe 'data' can be any *note iterable: 109d. and should consist\nof values that can be converted to type *note float: 4b7.  If\n'data' does not contain at least two elements, raises *note\nStatisticsError: 240c. because it takes at least one point to\nestimate a central value and at least two points to estimate\ndispersion.\n\n-- Method: samples (n, *, seed=None)\n\nGenerates 'n' random samples for a given mean and standard\ndeviation.  Returns a *note list: 3dc. of *note float: 4b7.\nvalues.\n\nIf 'seed' is given, creates a new instance of the underlying\nrandom number generator.  This is useful for creating\nreproducible results, even in a multi-threading context.\n\n-- Method: pdf (x)\n\nUsing a probability density function (pdf)(10), compute the\nrelative likelihood that a random variable 'X' will be near\nthe given value 'x'.  Mathematically, it is the limit of the\nratio 'P(x <= X < x+dx) / dx' as 'dx' approaches zero.\n\nThe relative likelihood is computed as the probability of a\nsample occurring in a narrow range divided by the width of the\nrange (hence the word \"density\").  Since the likelihood is\nrelative to other points, its value can be greater than '1.0'.\n\n-- Method: cdf (x)\n\nUsing a cumulative distribution function (cdf)(11), compute\nthe probability that a random variable 'X' will be less than\nor equal to 'x'.  Mathematically, it is written 'P(X <= x)'.\n\n-- Method: invcdf (p)\n\nCompute the inverse cumulative distribution function, also\nknown as the quantile function(12) or the percent-point(13)\nfunction.  Mathematically, it is written 'x : P(X <= x) = p'.\n\nFinds the value 'x' of the random variable 'X' such that the\nprobability of the variable being less than or equal to that\nvalue equals the given probability 'p'.\n\n-- Method: overlap (other)\n\nMeasures the agreement between two normal probability\ndistributions.  Returns a value between 0.0 and 1.0 giving the\noverlapping area for the two probability density\nfunctions(14).\n\n-- Method: quantiles (n=4)\n\nDivide the normal distribution into 'n' continuous intervals\nwith equal probability.  Returns a list of (n - 1) cut points\nseparating the intervals.\n\nSet 'n' to 4 for quartiles (the default).  Set 'n' to 10 for\ndeciles.  Set 'n' to 100 for percentiles which gives the 99\ncuts points that separate the normal distribution into 100\nequal sized groups.\n\n-- Method: zscore (x)\n\nCompute the Standard Score(15) describing 'x' in terms of the\nnumber of standard deviations above or below the mean of the\nnormal distribution: '(x - mean) / stdev'.\n\nNew in version 3.9.\n\nInstances of *note NormalDist: 863. support addition, subtraction,\nmultiplication and division by a constant.  These operations are\nused for translation and scaling.  For example:\n\n>>> temperaturefebruary = NormalDist(5, 2.5)             # Celsius\n>>> temperaturefebruary * (9/5) + 32                     # Fahrenheit\nNormalDist(mu=41.0, sigma=4.5)\n\nDividing a constant by an instance of *note NormalDist: 863. is not\nsupported because the result wouldn't be normally distributed.\n\nSince normal distributions arise from additive effects of\nindependent variables, it is possible to add and subtract two\nindependent normally distributed random variables(16) represented\nas instances of *note NormalDist: 863.  For example:\n\n>>> birthweights = NormalDist.fromsamples([2.5, 3.1, 2.1, 2.4, 2.7, 3.5])\n>>> drugeffects = NormalDist(0.4, 0.15)\n>>> combined = birthweights + drugeffects\n>>> round(combined.mean, 1)\n3.1\n>>> round(combined.stdev, 1)\n0.5\n\nNew in version 3.8.\n\n---------- Footnotes ----------\n\n(1) http://www.stat.yale.edu/Courses/1997-98/101/ranvar.htm\n\n(2) https://en.wikipedia.org/wiki/Centrallimittheorem\n\n(3) https://en.wikipedia.org/wiki/Arithmeticmean\n\n(4) https://en.wikipedia.org/wiki/Standarddeviation\n\n(5) https://en.wikipedia.org/wiki/Arithmeticmean\n\n(6) https://en.wikipedia.org/wiki/Median\n\n(7) https://en.wikipedia.org/wiki/Mode(statistics)\n\n(8) https://en.wikipedia.org/wiki/Standarddeviation\n\n(9) https://en.wikipedia.org/wiki/Variance\n\n(10) https://en.wikipedia.org/wiki/Probabilitydensityfunction\n\n(11) https://en.wikipedia.org/wiki/Cumulativedistributionfunction\n\n(12) https://en.wikipedia.org/wiki/Quantilefunction\n\n(13)\nhttps://web.archive.org/web/20190203145224/https://www.statisticshowto.datasciencecentral.com/inverse-distribution-function/\n\n(14) https://www.rasch.org/rmt/rmt101r.htm\n\n(15)\nhttps://www.statisticshowto.com/probability-and-statistics/z-score/\n\n(16)\nhttps://en.wikipedia.org/wiki/Sumofnormallydistributedrandomvariables\n\nFile: python3.12.info,  Node: Examples and Recipes<2>,  Prev: NormalDist objects,  Up: statistics -- Mathematical statistics functions\n\n5.9.7.7 Examples and Recipes\n............................\n\n* Menu:\n\n* Classic probability problems::\n* Monte Carlo inputs for simulations::\n* Approximating binomial distributions::\n* Naive bayesian classifier::\n* Kernel density estimation::\n\nFile: python3.12.info,  Node: Classic probability problems,  Next: Monte Carlo inputs for simulations,  Up: Examples and Recipes<2>\n\n5.9.7.8 Classic probability problems\n....................................\n\n*note NormalDist: 863. readily solves classic probability problems.\n",
            "subsections": []
        },
        "For example, given historical data for SAT exams(1) showing that scores": {
            "content": "are normally distributed with a mean of 1060 and a standard deviation of\n195, determine the percentage of students with test scores between 1100\nand 1200, after rounding to the nearest whole number:\n\n>>> sat = NormalDist(1060, 195)\n>>> fraction = sat.cdf(1200 + 0.5) - sat.cdf(1100 - 0.5)\n>>> round(fraction * 100.0, 1)\n18.4\n\nFind the quartiles(2) and deciles(3) for the SAT scores:\n\n>>> list(map(round, sat.quantiles()))\n[928, 1060, 1192]\n>>> list(map(round, sat.quantiles(n=10)))\n[810, 896, 958, 1011, 1060, 1109, 1162, 1224, 1310]\n\n---------- Footnotes ----------\n\n(1) https://nces.ed.gov/programs/digest/d17/tables/dt17226.40.asp\n\n(2) https://en.wikipedia.org/wiki/Quartile\n\n(3) https://en.wikipedia.org/wiki/Decile\n\nFile: python3.12.info,  Node: Monte Carlo inputs for simulations,  Next: Approximating binomial distributions,  Prev: Classic probability problems,  Up: Examples and Recipes<2>\n\n5.9.7.9 Monte Carlo inputs for simulations\n..........................................\n",
            "subsections": []
        },
        "To estimate the distribution for a model that isn't easy to solve": {
            "content": "analytically, *note NormalDist: 863. can generate input samples for a\nMonte Carlo simulation(1):\n\n>>> def model(x, y, z):\n...     return (3*x + 7*x*y - 5*y) / (11 * z)\n...\n>>> n = 100000\n>>> X = NormalDist(10, 2.5).samples(n, seed=3652260728)\n>>> Y = NormalDist(15, 1.75).samples(n, seed=4582495471)\n>>> Z = NormalDist(50, 1.25).samples(n, seed=6582483453)\n>>> quantiles(map(model, X, Y, Z))\n[1.4591308524824727, 1.8035946855390597, 2.175091447274739]\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/MonteCarlomethod\n\nFile: python3.12.info,  Node: Approximating binomial distributions,  Next: Naive bayesian classifier,  Prev: Monte Carlo inputs for simulations,  Up: Examples and Recipes<2>\n\n5.9.7.10 Approximating binomial distributions\n.............................................\n",
            "subsections": []
        },
        "Normal distributions can be used to approximate Binomial": {
            "content": "distributions(1) when the sample size is large and when the probability\nof a successful trial is near 50%.\n",
            "subsections": []
        },
        "For example, an open source conference has 750 attendees and two rooms": {
            "content": "with a 500 person capacity.  There is a talk about Python and another\nabout Ruby.  In previous conferences, 65% of the attendees preferred to\nlisten to Python talks.  Assuming the population preferences haven't\nchanged, what is the probability that the Python room will stay within\nits capacity limits?\n\n>>> n = 750             # Sample size\n>>> p = 0.65            # Preference for Python\n>>> q = 1.0 - p         # Preference for Ruby\n>>> k = 500             # Room capacity\n\n>>> # Approximation using the cumulative normal distribution\n>>> from math import sqrt\n>>> round(NormalDist(mu=n*p, sigma=sqrt(n*p*q)).cdf(k + 0.5), 4)\n0.8402\n\n>>> # Exact solution using the cumulative binomial distribution\n>>> from math import comb, fsum\n>>> round(fsum(comb(n, r) * pr * q(n-r) for r in range(k+1)), 4)\n0.8402\n\n>>> # Approximation using a simulation\n>>> from random import seed, binomialvariate\n>>> seed(8675309)\n>>> mean(binomialvariate(n, p) <= k for i in range(10000))\n0.8406\n\n---------- Footnotes ----------\n\n(1) https://mathworld.wolfram.com/BinomialDistribution.html\n\nFile: python3.12.info,  Node: Naive bayesian classifier,  Next: Kernel density estimation,  Prev: Approximating binomial distributions,  Up: Examples and Recipes<2>\n\n5.9.7.11 Naive bayesian classifier\n..................................\n\nNormal distributions commonly arise in machine learning problems.\n",
            "subsections": []
        },
        "Wikipedia has a nice example of a Naive Bayesian Classifier(1).  The": {
            "content": "challenge is to predict a person's gender from measurements of normally\ndistributed features including height, weight, and foot size.\n",
            "subsections": []
        },
        "We're given a training dataset with measurements for eight people.  The": {
            "content": "measurements are assumed to be normally distributed, so we summarize the\ndata with *note NormalDist: 863.:\n\n>>> heightmale = NormalDist.fromsamples([6, 5.92, 5.58, 5.92])\n>>> heightfemale = NormalDist.fromsamples([5, 5.5, 5.42, 5.75])\n>>> weightmale = NormalDist.fromsamples([180, 190, 170, 165])\n>>> weightfemale = NormalDist.fromsamples([100, 150, 130, 150])\n>>> footsizemale = NormalDist.fromsamples([12, 11, 12, 10])\n>>> footsizefemale = NormalDist.fromsamples([6, 8, 7, 9])\n",
            "subsections": []
        },
        "Next, we encounter a new person whose feature measurements are known but": {
            "content": "whose gender is unknown:\n\n>>> ht = 6.0        # height\n>>> wt = 130        # weight\n>>> fs = 8          # foot size\n\nStarting with a 50% prior probability(2) of being male or female, we\ncompute the posterior as the prior times the product of likelihoods for\nthe feature measurements given the gender:\n\n>>> priormale = 0.5\n>>> priorfemale = 0.5\n>>> posteriormale = (priormale * heightmale.pdf(ht) *\n...                   weightmale.pdf(wt) * footsizemale.pdf(fs))\n\n>>> posteriorfemale = (priorfemale * heightfemale.pdf(ht) *\n...                     weightfemale.pdf(wt) * footsizefemale.pdf(fs))\n",
            "subsections": []
        },
        "The final prediction goes to the largest posterior.  This is known as": {
            "content": "the maximum a posteriori(3) or MAP:\n\n>>> 'male' if posteriormale > posteriorfemale else 'female'\n'female'\n\n---------- Footnotes ----------\n\n(1)\nhttps://en.wikipedia.org/wiki/NaiveBayesclassifier#Personclassification\n\n(2) https://en.wikipedia.org/wiki/Priorprobability\n\n(3) https://en.wikipedia.org/wiki/Maximumaposterioriestimation\n\nFile: python3.12.info,  Node: Kernel density estimation,  Prev: Naive bayesian classifier,  Up: Examples and Recipes<2>\n\n5.9.7.12 Kernel density estimation\n..................................\n",
            "subsections": []
        },
        "It is possible to estimate a continuous probability density function": {
            "content": "from a fixed number of discrete samples.\n",
            "subsections": []
        },
        "The basic idea is to smooth the data using a kernel function such as a": {
            "content": "normal distribution, triangular distribution, or uniform\ndistribution(1).  The degree of smoothing is controlled by a scaling\nparameter, 'h', which is called the 'bandwidth'.\n\ndef kdenormal(sample, h):\n\"Create a continuous probability density function from a sample.\"\n# Smooth the sample with a normal distribution kernel scaled by h.\nkernelh = NormalDist(0.0, h).pdf\nn = len(sample)\ndef pdf(x):\nreturn sum(kernelh(x - xi) for xi in sample) / n\nreturn pdf\n",
            "subsections": []
        },
        "Wikipedia has an example(2) where we can use the 'kdenormal()' recipe": {
            "content": "to generate and plot a probability density function estimated from a\nsmall sample:\n\n>>> sample = [-2.1, -1.3, -0.4, 1.9, 5.1, 6.2]\n>>> fhat = kdenormal(sample, h=1.5)\n>>> xarr = [i/100 for i in range(-750, 1100)]\n>>> yarr = [fhat(x) for x in xarr]\n\nThe points in 'xarr' and 'yarr' can be used to make a PDF plot:\n\nScatter plot of the estimated probability density function.\n\n\n---------- Footnotes ----------\n\n(1)\nhttps://en.wikipedia.org/wiki/Kernel(statistics)#Kernelfunctionsincommonuse\n\n(2) https://en.wikipedia.org/wiki/Kerneldensityestimation#Example\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Functional Programming Modules,  Next: File and Directory Access,  Prev: Numeric and Mathematical Modules,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.10 Functional Programming Modules",
                    "content": ""
                }
            ]
        },
        "The modules described in this chapter provide functions and classes that": {
            "content": "support a functional programming style, and general operations on\ncallables.\n\nThe following modules are documented in this chapter:\n\n* Menu:\n\n* itertools -- Functions creating iterators for efficient looping::\n* functools -- Higher-order functions and operations on callable objects::\n* operator -- Standard operators as functions::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: itertools -- Functions creating iterators for efficient looping,  Next: functools -- Higher-order functions and operations on callable objects,  Up: Functional Programming Modules": {
            "content": "This module implements a number of *note iterator: 16a9. building blocks\ninspired by constructs from APL, Haskell, and SML. Each has been recast\nin a form suitable for Python.\n",
            "subsections": []
        },
        "The module standardizes a core set of fast, memory efficient tools that": {
            "content": "are useful by themselves or in combination.  Together, they form an\n\"iterator algebra\" making it possible to construct specialized tools\nsuccinctly and efficiently in pure Python.\n",
            "subsections": []
        },
        "For instance, SML provides a tabulation tool: 'tabulate(f)' which": {
            "content": "produces a sequence 'f(0), f(1), ...'.  The same effect can be achieved\nin Python by combining *note map(): 65f. and *note count(): 10fc. to\nform 'map(f, count())'.\n",
            "subsections": []
        },
        "These tools and their built-in counterparts also work well with the": {
            "content": "high-speed functions in the *note operator: 9a. module.  For example,\nthe multiplication operator can be mapped across two vectors to form an\nefficient dot-product: 'sum(starmap(operator.mul, zip(vec1, vec2,\nstrict=True)))'.\n\n'Infinite iterators:'\n",
            "subsections": []
        },
        "Iterator               Arguments             Results                                               Example": {
            "content": "-------------------------------------------------------------------------------------------------------------------------------------------------\n\n*note count(): 10fc.   [start[, step]]       start, start+step, start+2*step, ...                    'count(10) -> 10 11 12 13 14 ...'\n\n\n*note cycle(): 2426.   p                     p0, p1, ... plast, p0, p1, ...                            'cycle('ABCD') -> A B C D A B C D ...'\n\n\n*note repeat(): 2427.  elem [,n]             elem, elem, elem, ... endlessly or up to n times        'repeat(10, 3) -> 10 10 10'\n\n\n'Iterators terminating on the shortest input sequence:'\n",
            "subsections": []
        },
        "Iterator                         Arguments                        Results                                               Example": {
            "content": "------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\n*note accumulate(): 825.         p [,func]                        p0, p0+p1, p0+p1+p2, ...                                'accumulate([1,2,3,4,5]) -> 1 3 6 10 15'\n\n\n*note batched(): 1b4.            p, n                             (p0, p1, ..., pn-1), ...                                 'batched('ABCDEFG', n=3) -> ABC DEF G'\n\n\n*note chain(): 1e8a.             p, q, ...                          p0, p1, ... plast, q0, q1, ...                            'chain('ABC', 'DEF') -> A B C D E F'\n\n\n*note chain.fromiterable(): 2428.iterable                        p0, p1, ... plast, q0, q1, ...                            'chain.fromiterable(['ABC', 'DEF']) -> A B C D E F'\n\n\n*note compress(): 10fb.          data, selectors                  (d[0] if s[0]), (d[1] if s[1]), ...                     'compress('ABCDEF', [1,0,1,0,1,1]) -> A C E F'\n\n\n*note dropwhile(): 2429.         predicate, seq                   seq[n], seq[n+1], starting when predicate fails       'dropwhile(lambda x: x<5, [1,4,6,4,1]) -> 6 4 1'\n\n\n*note filterfalse(): 1e72.       predicate, seq                   elements of seq where predicate(elem) fails           'filterfalse(lambda x: x%2, range(10)) -> 0 2 4 6 8'\n\n\n*note groupby(): 242a.           iterable[, key]                  sub-iterators grouped by value of key(v)\n\n\n*note islice(): 988.             seq, [start,] stop [, step]      elements from seq[start:stop:step]                    'islice('ABCDEFG', 2, None) -> C D E F G'\n\n\n*note pairwise(): 608.           iterable                         (p[0], p[1]), (p[1], p[2])                            'pairwise('ABCDEFG') -> AB BC CD DE EF FG'\n\n\n*note starmap(): f53.            func, seq                        func(*seq[0]), func(*seq[1]), ...                       'starmap(pow, [(2,5), (3,2), (10,3)]) -> 32 9 1000'\n\n\n*note takewhile(): 242b.         predicate, seq                   seq[0], seq[1], until predicate fails                 'takewhile(lambda x: x<5, [1,4,6,4,1]) -> 1 4'\n\n\n*note tee(): 242c.               it, n                            it1, it2, ... itn splits one iterator into n\n\n\n*note ziplongest(): 1116.       p, q, ...                          (p[0], q[0]), (p[1], q[1]), ...                         'ziplongest('ABCD', 'xy', fillvalue='-') -> Ax By C- D-'\n\n\n'Combinatoric iterators:'\n",
            "subsections": []
        },
        "Iterator                                           Arguments                Results": {
            "content": "----------------------------------------------------------------------------------------------------------------------------------------------\n\n*note product(): 1189.                             p, q, ... [repeat=1]       cartesian product, equivalent to a nested for-loop\n\n\n*note permutations(): 167f.                        p[, r]                   r-length tuples, all possible orderings, no repeated elements\n\n\n*note combinations(): 1188.                        p, r                     r-length tuples, in sorted order, no repeated elements\n\n\n*note combinationswithreplacement(): 10fa.       p, r                     r-length tuples, in sorted order, with repeated elements\n\n",
            "subsections": []
        },
        "Examples                                           Results": {
            "content": "---------------------------------------------------------------------------------------------------------------------\n\n'product('ABCD', repeat=2)'                        'AA AB AC AD BA BB BC BD CA CB CC CD DA DB DC DD'\n\n\n'permutations('ABCD', 2)'                          'AB AC AD BA BC BD CA CB CD DA DB DC'\n\n\n'combinations('ABCD', 2)'                          'AB AC AD BC BD CD'\n\n\n'combinationswithreplacement('ABCD',??2)'         'AA AB AC AD BB BC BD CC CD DD'\n\n\n* Menu:\n\n* Itertool Functions::\n* Itertools Recipes::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Itertool Functions,  Next: Itertools Recipes,  Up: itertools -- Functions creating iterators for efficient looping": {
            "content": "5.10.1.1 Itertool Functions\n...........................\n",
            "subsections": []
        },
        "The following module functions all construct and return iterators.  Some": {
            "content": "provide streams of infinite length, so they should only be accessed by\nfunctions or loops that truncate the stream.\n\n-- Function: itertools.accumulate (iterable[, func, *, initial=None])\n\nMake an iterator that returns accumulated sums, or accumulated\nresults of other binary functions (specified via the optional\n'func' argument).\n\nIf 'func' is supplied, it should be a function of two arguments.\nElements of the input 'iterable' may be any type that can be\naccepted as arguments to 'func'.  (For example, with the default\noperation of addition, elements may be any addable type including\n*note Decimal: 5c3. or *note Fraction: 1a8.)\n\nUsually, the number of elements output matches the input iterable.\nHowever, if the keyword argument 'initial' is provided, the\naccumulation leads off with the 'initial' value so that the output\nhas one more element than the input iterable.\n\nRoughly equivalent to:\n\ndef accumulate(iterable, func=operator.add, *, initial=None):\n'Return running totals'\n# accumulate([1,2,3,4,5]) -> 1 3 6 10 15\n# accumulate([1,2,3,4,5], initial=100) -> 100 101 103 106 110 115\n# accumulate([1,2,3,4,5], operator.mul) -> 1 2 6 24 120\nit = iter(iterable)\ntotal = initial\nif initial is None:\ntry:\ntotal = next(it)\nexcept StopIteration:\nreturn\nyield total\nfor element in it:\ntotal = func(total, element)\nyield total\n\nThere are a number of uses for the 'func' argument.  It can be set\nto *note min(): d6f. for a running minimum, *note max(): d70. for a\nrunning maximum, or *note operator.mul(): 242f. for a running\nproduct.  Amortization tables can be built by accumulating interest\nand applying payments:\n\n>>> data = [3, 4, 6, 2, 1, 9, 0, 7, 5, 8]\n>>> list(accumulate(data, operator.mul))     # running product\n[3, 12, 72, 144, 144, 1296, 0, 0, 0, 0]\n>>> list(accumulate(data, max))              # running maximum\n[3, 4, 6, 6, 6, 9, 9, 9, 9, 9]\n\n# Amortize a 5% loan of 1000 with 10 annual payments of 90\n>>> accountupdate = lambda bal, pmt: round(bal * 1.05) + pmt\n>>> list(accumulate(repeat(-90, 10), accountupdate, initial=1000))\n[1000, 960, 918, 874, 828, 779, 728, 674, 618, 559, 497]\n\nSee *note functools.reduce(): 1151. for a similar function that\nreturns only the final accumulated value.\n\nNew in version 3.2.\n\nChanged in version 3.3: Added the optional 'func' parameter.\n\nChanged in version 3.8: Added the optional 'initial' parameter.\n\n-- Function: itertools.batched (iterable, n)\n\nBatch data from the 'iterable' into tuples of length 'n'.  The last\nbatch may be shorter than 'n'.\n\nLoops over the input iterable and accumulates data into tuples up\nto size 'n'.  The input is consumed lazily, just enough to fill a\nbatch.  The result is yielded as soon as the batch is full or when\nthe input iterable is exhausted:\n\n>>> flatteneddata = ['roses', 'red', 'violets', 'blue', 'sugar', 'sweet']\n>>> unflattened = list(batched(flatteneddata, 2))\n>>> unflattened\n[('roses', 'red'), ('violets', 'blue'), ('sugar', 'sweet')]\n\n>>> for batch in batched('ABCDEFG', 3):\n...     print(batch)\n...\n('A', 'B', 'C')\n('D', 'E', 'F')\n('G',)\n\nRoughly equivalent to:\n\ndef batched(iterable, n):\n# batched('ABCDEFG', 3) -> ABC DEF G\nif n < 1:\nraise ValueError('n must be at least one')\nit = iter(iterable)\nwhile batch := tuple(islice(it, n)):\nyield batch\n\nNew in version 3.12.\n\n-- Function: itertools.chain (*iterables)\n\nMake an iterator that returns elements from the first iterable\nuntil it is exhausted, then proceeds to the next iterable, until\nall of the iterables are exhausted.  Used for treating consecutive\nsequences as a single sequence.  Roughly equivalent to:\n\ndef chain(*iterables):\n# chain('ABC', 'DEF') -> A B C D E F\nfor it in iterables:\nfor element in it:\nyield element\n\n-- Method: classmethod chain.fromiterable (iterable)\n\nAlternate constructor for *note chain(): 1e8a.  Gets chained inputs\nfrom a single iterable argument that is evaluated lazily.  Roughly\nequivalent to:\n\ndef fromiterable(iterables):\n# chain.fromiterable(['ABC', 'DEF']) -> A B C D E F\nfor it in iterables:\nfor element in it:\nyield element\n\n-- Function: itertools.combinations (iterable, r)\n\nReturn 'r' length subsequences of elements from the input\n'iterable'.\n\nThe combination tuples are emitted in lexicographic ordering\naccording to the order of the input 'iterable'.  So, if the input\n'iterable' is sorted, the output tuples will be produced in sorted\norder.\n\nElements are treated as unique based on their position, not on\ntheir value.  So if the input elements are unique, there will be no\nrepeated values in each combination.\n\nRoughly equivalent to:\n\ndef combinations(iterable, r):\n# combinations('ABCD', 2) -> AB AC AD BC BD CD\n# combinations(range(4), 3) -> 012 013 023 123\npool = tuple(iterable)\nn = len(pool)\nif r > n:\nreturn\nindices = list(range(r))\nyield tuple(pool[i] for i in indices)\nwhile True:\nfor i in reversed(range(r)):\nif indices[i] != i + n - r:\nbreak\nelse:\nreturn\nindices[i] += 1\nfor j in range(i+1, r):\nindices[j] = indices[j-1] + 1\nyield tuple(pool[i] for i in indices)\n\nThe code for *note combinations(): 1188. can be also expressed as a\nsubsequence of *note permutations(): 167f. after filtering entries\nwhere the elements are not in sorted order (according to their\nposition in the input pool):\n\ndef combinations(iterable, r):\npool = tuple(iterable)\nn = len(pool)\nfor indices in permutations(range(n), r):\nif sorted(indices) == list(indices):\nyield tuple(pool[i] for i in indices)\n\nThe number of items returned is 'n! / r! / (n-r)!' when '0 <= r <=\nn' or zero when 'r > n'.\n\n-- Function: itertools.combinationswithreplacement (iterable, r)\n\nReturn 'r' length subsequences of elements from the input\n'iterable' allowing individual elements to be repeated more than\nonce.\n\nThe combination tuples are emitted in lexicographic ordering\naccording to the order of the input 'iterable'.  So, if the input\n'iterable' is sorted, the output tuples will be produced in sorted\norder.\n\nElements are treated as unique based on their position, not on\ntheir value.  So if the input elements are unique, the generated\ncombinations will also be unique.\n\nRoughly equivalent to:\n\ndef combinationswithreplacement(iterable, r):\n# combinationswithreplacement('ABC', 2) -> AA AB AC BB BC CC\npool = tuple(iterable)\nn = len(pool)\nif not n and r:\nreturn\nindices = [0] * r\nyield tuple(pool[i] for i in indices)\nwhile True:\nfor i in reversed(range(r)):\nif indices[i] != n - 1:\nbreak\nelse:\nreturn\nindices[i:] = [indices[i] + 1] * (r - i)\nyield tuple(pool[i] for i in indices)\n\nThe code for *note combinationswithreplacement(): 10fa. can be\nalso expressed as a subsequence of *note product(): 1189. after\nfiltering entries where the elements are not in sorted order\n(according to their position in the input pool):\n\ndef combinationswithreplacement(iterable, r):\npool = tuple(iterable)\nn = len(pool)\nfor indices in product(range(n), repeat=r):\nif sorted(indices) == list(indices):\nyield tuple(pool[i] for i in indices)\n\nThe number of items returned is '(n+r-1)! / r! / (n-1)!' when 'n >\n0'.\n\nNew in version 3.1.\n\n-- Function: itertools.compress (data, selectors)\n\nMake an iterator that filters elements from 'data' returning only\nthose that have a corresponding element in 'selectors' that\nevaluates to 'True'.  Stops when either the 'data' or 'selectors'\niterables has been exhausted.  Roughly equivalent to:\n\ndef compress(data, selectors):\n# compress('ABCDEF', [1,0,1,0,1,1]) -> A C E F\nreturn (d for d, s in zip(data, selectors) if s)\n\nNew in version 3.1.\n\n-- Function: itertools.count (start=0, step=1)\n\nMake an iterator that returns evenly spaced values starting with\nnumber 'start'.  Often used as an argument to *note map(): 65f. to\ngenerate consecutive data points.  Also, used with *note zip():\n5c2. to add sequence numbers.  Roughly equivalent to:\n\ndef count(start=0, step=1):\n# count(10) -> 10 11 12 13 14 ...\n# count(2.5, 0.5) -> 2.5 3.0 3.5 ...\nn = start\nwhile True:\nyield n\nn += step\n\nWhen counting with floating point numbers, better accuracy can\nsometimes be achieved by substituting multiplicative code such as:\n'(start + step * i for i in count())'.\n\nChanged in version 3.1: Added 'step' argument and allowed\nnon-integer arguments.\n\n-- Function: itertools.cycle (iterable)\n\nMake an iterator returning elements from the iterable and saving a\ncopy of each.  When the iterable is exhausted, return elements from\nthe saved copy.  Repeats indefinitely.  Roughly equivalent to:\n\ndef cycle(iterable):\n# cycle('ABCD') -> A B C D A B C D A B C D ...\nsaved = []\nfor element in iterable:\nyield element\nsaved.append(element)\nwhile saved:\nfor element in saved:\nyield element\n\nNote, this member of the toolkit may require significant auxiliary\nstorage (depending on the length of the iterable).\n\n-- Function: itertools.dropwhile (predicate, iterable)\n\nMake an iterator that drops elements from the iterable as long as\nthe predicate is true; afterwards, returns every element.  Note,\nthe iterator does not produce 'any' output until the predicate\nfirst becomes false, so it may have a lengthy start-up time.\nRoughly equivalent to:\n\ndef dropwhile(predicate, iterable):\n# dropwhile(lambda x: x<5, [1,4,6,4,1]) -> 6 4 1\niterable = iter(iterable)\nfor x in iterable:\nif not predicate(x):\nyield x\nbreak\nfor x in iterable:\nyield x\n\n-- Function: itertools.filterfalse (predicate, iterable)\n\nMake an iterator that filters elements from iterable returning only\nthose for which the predicate is false.  If 'predicate' is 'None',\nreturn the items that are false.  Roughly equivalent to:\n\ndef filterfalse(predicate, iterable):\n# filterfalse(lambda x: x%2, range(10)) -> 0 2 4 6 8\nif predicate is None:\npredicate = bool\nfor x in iterable:\nif not predicate(x):\nyield x\n\n-- Function: itertools.groupby (iterable, key=None)\n\nMake an iterator that returns consecutive keys and groups from the\n'iterable'.  The 'key' is a function computing a key value for each\nelement.  If not specified or is 'None', 'key' defaults to an\nidentity function and returns the element unchanged.  Generally,\nthe iterable needs to already be sorted on the same key function.\n\nThe operation of *note groupby(): 242a. is similar to the 'uniq'\nfilter in Unix.  It generates a break or new group every time the\nvalue of the key function changes (which is why it is usually\nnecessary to have sorted the data using the same key function).\nThat behavior differs from SQL's GROUP BY which aggregates common\nelements regardless of their input order.\n\nThe returned group is itself an iterator that shares the underlying\niterable with *note groupby(): 242a.  Because the source is shared,\nwhen the *note groupby(): 242a. object is advanced, the previous\ngroup is no longer visible.  So, if that data is needed later, it\nshould be stored as a list:\n\ngroups = []\nuniquekeys = []\ndata = sorted(data, key=keyfunc)\nfor k, g in groupby(data, keyfunc):\ngroups.append(list(g))      # Store group iterator as a list\nuniquekeys.append(k)\n\n*note groupby(): 242a. is roughly equivalent to:\n\nclass groupby:\n# [k for k, g in groupby('AAAABBBCCDAABBB')] -> A B C D A B\n# [list(g) for k, g in groupby('AAAABBBCCD')] -> AAAA BBB CC D\n\ndef init(self, iterable, key=None):\nif key is None:\nkey = lambda x: x\nself.keyfunc = key\nself.it = iter(iterable)\nself.tgtkey = self.currkey = self.currvalue = object()\n\ndef iter(self):\nreturn self\n\ndef next(self):\nself.id = object()\nwhile self.currkey == self.tgtkey:\nself.currvalue = next(self.it)    # Exit on StopIteration\nself.currkey = self.keyfunc(self.currvalue)\nself.tgtkey = self.currkey\nreturn (self.currkey, self.grouper(self.tgtkey, self.id))\n\ndef grouper(self, tgtkey, id):\nwhile self.id is id and self.currkey == tgtkey:\nyield self.currvalue\ntry:\nself.currvalue = next(self.it)\nexcept StopIteration:\nreturn\nself.currkey = self.keyfunc(self.currvalue)\n\n-- Function: itertools.islice (iterable, stop)\n\n-- Function: itertools.islice (iterable, start, stop[, step])\n\nMake an iterator that returns selected elements from the iterable.\nIf 'start' is non-zero, then elements from the iterable are skipped\nuntil start is reached.  Afterward, elements are returned\nconsecutively unless 'step' is set higher than one which results in\nitems being skipped.  If 'stop' is 'None', then iteration continues\nuntil the iterator is exhausted, if at all; otherwise, it stops at\nthe specified position.\n\nIf 'start' is 'None', then iteration starts at zero.  If 'step' is\n'None', then the step defaults to one.\n\nUnlike regular slicing, *note islice(): 988. does not support\nnegative values for 'start', 'stop', or 'step'.  Can be used to\nextract related fields from data where the internal structure has\nbeen flattened (for example, a multi-line report may list a name\nfield on every third line).\n\nRoughly equivalent to:\n\ndef islice(iterable, *args):\n# islice('ABCDEFG', 2) -> A B\n# islice('ABCDEFG', 2, 4) -> C D\n# islice('ABCDEFG', 2, None) -> C D E F G\n# islice('ABCDEFG', 0, None, 2) -> A C E G\ns = slice(*args)\nstart, stop, step = s.start or 0, s.stop or sys.maxsize, s.step or 1\nit = iter(range(start, stop, step))\ntry:\nnexti = next(it)\nexcept StopIteration:\n# Consume *iterable* up to the *start* position.\nfor i, element in zip(range(start), iterable):\npass\nreturn\ntry:\nfor i, element in enumerate(iterable):\nif i == nexti:\nyield element\nnexti = next(it)\nexcept StopIteration:\n# Consume to *stop*.\nfor i, element in zip(range(i + 1, stop), iterable):\npass\n\n-- Function: itertools.pairwise (iterable)\n\nReturn successive overlapping pairs taken from the input\n'iterable'.\n\nThe number of 2-tuples in the output iterator will be one fewer\nthan the number of inputs.  It will be empty if the input iterable\nhas fewer than two values.\n\nRoughly equivalent to:\n\ndef pairwise(iterable):\n# pairwise('ABCDEFG') -> AB BC CD DE EF FG\niterator = iter(iterable)\na = next(iterator, None)\nfor b in iterator:\nyield a, b\na = b\n\nNew in version 3.10.\n\n-- Function: itertools.permutations (iterable, r=None)\n\nReturn successive 'r' length permutations of elements in the\n'iterable'.\n\nIf 'r' is not specified or is 'None', then 'r' defaults to the\nlength of the 'iterable' and all possible full-length permutations\nare generated.\n\nThe permutation tuples are emitted in lexicographic order according\nto the order of the input 'iterable'.  So, if the input 'iterable'\nis sorted, the output tuples will be produced in sorted order.\n\nElements are treated as unique based on their position, not on\ntheir value.  So if the input elements are unique, there will be no\nrepeated values within a permutation.\n\nRoughly equivalent to:\n\ndef permutations(iterable, r=None):\n# permutations('ABCD', 2) -> AB AC AD BA BC BD CA CB CD DA DB DC\n# permutations(range(3)) -> 012 021 102 120 201 210\npool = tuple(iterable)\nn = len(pool)\nr = n if r is None else r\nif r > n:\nreturn\nindices = list(range(n))\ncycles = list(range(n, n-r, -1))\nyield tuple(pool[i] for i in indices[:r])\nwhile n:\nfor i in reversed(range(r)):\ncycles[i] -= 1\nif cycles[i] == 0:\nindices[i:] = indices[i+1:] + indices[i:i+1]\ncycles[i] = n - i\nelse:\nj = cycles[i]\nindices[i], indices[-j] = indices[-j], indices[i]\nyield tuple(pool[i] for i in indices[:r])\nbreak\nelse:\nreturn\n\nThe code for *note permutations(): 167f. can be also expressed as a\nsubsequence of *note product(): 1189, filtered to exclude entries\nwith repeated elements (those from the same position in the input\npool):\n\ndef permutations(iterable, r=None):\npool = tuple(iterable)\nn = len(pool)\nr = n if r is None else r\nfor indices in product(range(n), repeat=r):\nif len(set(indices)) == r:\nyield tuple(pool[i] for i in indices)\n\nThe number of items returned is 'n! / (n-r)!' when '0 <= r <= n' or\nzero when 'r > n'.\n\n-- Function: itertools.product (*iterables, repeat=1)\n\nCartesian product of input iterables.\n\nRoughly equivalent to nested for-loops in a generator expression.\nFor example, 'product(A, B)' returns the same as '((x,y) for x in A\nfor y in B)'.\n\nThe nested loops cycle like an odometer with the rightmost element\nadvancing on every iteration.  This pattern creates a lexicographic\nordering so that if the input's iterables are sorted, the product\ntuples are emitted in sorted order.\n\nTo compute the product of an iterable with itself, specify the\nnumber of repetitions with the optional 'repeat' keyword argument.\nFor example, 'product(A, repeat=4)' means the same as 'product(A,\nA, A, A)'.\n\nThis function is roughly equivalent to the following code, except\nthat the actual implementation does not build up intermediate\nresults in memory:\n\ndef product(*args, repeat=1):\n# product('ABCD', 'xy') -> Ax Ay Bx By Cx Cy Dx Dy\n# product(range(2), repeat=3) -> 000 001 010 011 100 101 110 111\npools = [tuple(pool) for pool in args] * repeat\nresult = [[]]\nfor pool in pools:\nresult = [x+[y] for x in result for y in pool]\nfor prod in result:\nyield tuple(prod)\n\nBefore *note product(): 1189. runs, it completely consumes the\ninput iterables, keeping pools of values in memory to generate the\nproducts.  Accordingly, it is only useful with finite inputs.\n\n-- Function: itertools.repeat (object[, times])\n\nMake an iterator that returns 'object' over and over again.  Runs\nindefinitely unless the 'times' argument is specified.\n\nRoughly equivalent to:\n\ndef repeat(object, times=None):\n# repeat(10, 3) -> 10 10 10\nif times is None:\nwhile True:\nyield object\nelse:\nfor i in range(times):\nyield object\n\nA common use for 'repeat' is to supply a stream of constant values\nto 'map' or 'zip':\n\n>>> list(map(pow, range(10), repeat(2)))\n[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]\n\n-- Function: itertools.starmap (function, iterable)\n\nMake an iterator that computes the function using arguments\nobtained from the iterable.  Used instead of *note map(): 65f. when\nargument parameters are already grouped in tuples from a single\niterable (when the data has been \"pre-zipped\").\n\nThe difference between *note map(): 65f. and *note starmap(): f53.\nparallels the distinction between 'function(a,b)' and\n'function(*c)'.  Roughly equivalent to:\n\ndef starmap(function, iterable):\n# starmap(pow, [(2,5), (3,2), (10,3)]) -> 32 9 1000\nfor args in iterable:\nyield function(*args)\n\n-- Function: itertools.takewhile (predicate, iterable)\n\nMake an iterator that returns elements from the iterable as long as\nthe predicate is true.  Roughly equivalent to:\n\ndef takewhile(predicate, iterable):\n# takewhile(lambda x: x<5, [1,4,6,4,1]) -> 1 4\nfor x in iterable:\nif predicate(x):\nyield x\nelse:\nbreak\n\nNote, the element that first fails the predicate condition is\nconsumed from the input iterator and there is no way to access it.\nThis could be an issue if an application wants to further consume\nthe input iterator after takewhile has been run to exhaustion.  To\nwork around this problem, consider using more-iterools\nbeforeandafter()(1) instead.\n\n-- Function: itertools.tee (iterable, n=2)\n\nReturn 'n' independent iterators from a single iterable.\n\nThe following Python code helps explain what 'tee' does (although\nthe actual implementation is more complex and uses only a single\nunderlying FIFO queue):\n\ndef tee(iterable, n=2):\nit = iter(iterable)\ndeques = [collections.deque() for i in range(n)]\ndef gen(mydeque):\nwhile True:\nif not mydeque:             # when the local deque is empty\ntry:\nnewval = next(it)   # fetch a new value and\nexcept StopIteration:\nreturn\nfor d in deques:        # load it to all the deques\nd.append(newval)\nyield mydeque.popleft()\nreturn tuple(gen(d) for d in deques)\n\nOnce a *note tee(): 242c. has been created, the original 'iterable'\nshould not be used anywhere else; otherwise, the 'iterable' could\nget advanced without the tee objects being informed.\n\n'tee' iterators are not threadsafe.  A *note RuntimeError: 17a. may\nbe raised when simultaneously using iterators returned by the same\n*note tee(): 242c. call, even if the original 'iterable' is\nthreadsafe.\n\nThis itertool may require significant auxiliary storage (depending\non how much temporary data needs to be stored).  In general, if one\niterator uses most or all of the data before another iterator\nstarts, it is faster to use *note list(): 3dc. instead of *note\ntee(): 242c.\n\n-- Function: itertools.ziplongest (*iterables, fillvalue=None)\n\nMake an iterator that aggregates elements from each of the\niterables.  If the iterables are of uneven length, missing values\nare filled-in with 'fillvalue'.  Iteration continues until the\nlongest iterable is exhausted.  Roughly equivalent to:\n\ndef ziplongest(*args, fillvalue=None):\n# ziplongest('ABCD', 'xy', fillvalue='-') -> Ax By C- D-\niterators = [iter(it) for it in args]\nnumactive = len(iterators)\nif not numactive:\nreturn\nwhile True:\nvalues = []\nfor i, it in enumerate(iterators):\ntry:\nvalue = next(it)\nexcept StopIteration:\nnumactive -= 1\nif not numactive:\nreturn\niterators[i] = repeat(fillvalue)\nvalue = fillvalue\nvalues.append(value)\nyield tuple(values)\n\nIf one of the iterables is potentially infinite, then the *note\nziplongest(): 1116. function should be wrapped with something that\nlimits the number of calls (for example *note islice(): 988. or\n*note takewhile(): 242b.).  If not specified, 'fillvalue' defaults\nto 'None'.\n\n---------- Footnotes ----------\n\n(1)\nhttps://more-itertools.readthedocs.io/en/stable/api.html#moreitertools.beforeandafter\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Itertools Recipes,  Prev: Itertool Functions,  Up: itertools -- Functions creating iterators for efficient looping": {
            "content": "5.10.1.2 Itertools Recipes\n..........................\n",
            "subsections": []
        },
        "This section shows recipes for creating an extended toolset using the": {
            "content": "existing itertools as building blocks.\n",
            "subsections": []
        },
        "The primary purpose of the itertools recipes is educational.  The": {
            "content": "recipes show various ways of thinking about individual tools -- for\nexample, that 'chain.fromiterable' is related to the concept of\nflattening.  The recipes also give ideas about ways that the tools can\nbe combined -- for example, how 'starmap()' and 'repeat()' can work\ntogether.  The recipes also show patterns for using itertools with the\n*note operator: 9a. and *note collections: 1b. modules as well as with\nthe built-in itertools such as 'map()', 'filter()', 'reversed()', and\n'enumerate()'.\n\nA secondary purpose of the recipes is to serve as an incubator.  The\n'accumulate()', 'compress()', and 'pairwise()' itertools started out as\nrecipes.  Currently, the 'slidingwindow()', 'iterindex()', and\n'sieve()' recipes are being tested to see whether they prove their\nworth.\n",
            "subsections": []
        },
        "Substantially all of these recipes and many, many others can be": {
            "content": "installed from the more-itertools project(1) found on the Python Package\nIndex:\n\npython -m pip install more-itertools\n",
            "subsections": []
        },
        "Many of the recipes offer the same high performance as the underlying": {
            "content": "toolset.  Superior memory performance is kept by processing elements one\nat a time rather than bringing the whole iterable into memory all at\nonce.  Code volume is kept small by linking the tools together in a\nfunctional style(2).  High speed is retained by preferring \"vectorized\"\nbuilding blocks over the use of for-loops and *note generators: eda.\nwhich incur interpreter overhead.\n\nimport collections\nimport functools\nimport math\nimport operator\nimport random\n\ndef take(n, iterable):\n\"Return first n items of the iterable as a list.\"\nreturn list(islice(iterable, n))\n\ndef prepend(value, iterable):\n\"Prepend a single value in front of an iterable.\"\n# prepend(1, [2, 3, 4]) -> 1 2 3 4\nreturn chain([value], iterable)\n\ndef tabulate(function, start=0):\n\"Return function(0), function(1), ...\"\nreturn map(function, count(start))\n\ndef repeatfunc(func, times=None, *args):\n\"\"\"Repeat calls to func with specified arguments.\n\nExample:  repeatfunc(random.random)\n\"\"\"\nif times is None:\nreturn starmap(func, repeat(args))\nreturn starmap(func, repeat(args, times))\n\ndef flatten(listoflists):\n\"Flatten one level of nesting.\"\nreturn chain.fromiterable(listoflists)\n\ndef ncycles(iterable, n):\n\"Returns the sequence elements n times.\"\nreturn chain.fromiterable(repeat(tuple(iterable), n))\n\ndef tail(n, iterable):\n\"Return an iterator over the last n items.\"\n# tail(3, 'ABCDEFG') -> E F G\nreturn iter(collections.deque(iterable, maxlen=n))\n\ndef consume(iterator, n=None):\n\"Advance the iterator n-steps ahead. If n is None, consume entirely.\"\n# Use functions that consume iterators at C speed.\nif n is None:\n# feed the entire iterator into a zero-length deque\ncollections.deque(iterator, maxlen=0)\nelse:\n# advance to the empty slice starting at position n\nnext(islice(iterator, n, n), None)\n\ndef nth(iterable, n, default=None):\n\"Returns the nth item or a default value.\"\nreturn next(islice(iterable, n, None), default)\n\ndef quantify(iterable, predicate=bool):\n\"Given a predicate that returns True or False, count the True results.\"\nreturn sum(map(predicate, iterable))\n\ndef firsttrue(iterable, default=False, predicate=None):\n\"Returns the first true value or the *default* if there is no true value.\"\n# firsttrue([a,b,c], x) -> a or b or c or x\n# firsttrue([a,b], x, f) -> a if f(a) else b if f(b) else x\nreturn next(filter(predicate, iterable), default)\n\ndef allequal(iterable, key=None):\n\"Returns True if all the elements are equal to each other.\"\n# allequal('4???????????', key=int) -> True\nreturn len(take(2, groupby(iterable, key))) <= 1\n\ndef uniquejustseen(iterable, key=None):\n\"List unique elements, preserving order. Remember only the element just seen.\"\n# uniquejustseen('AAAABBBCCDAABBB') -> A B C D A B\n# uniquejustseen('ABBcCAD', str.casefold) -> A B c A D\nif key is None:\nreturn map(operator.itemgetter(0), groupby(iterable))\nreturn map(next, map(operator.itemgetter(1), groupby(iterable, key)))\n\ndef uniqueeverseen(iterable, key=None):\n\"List unique elements, preserving order. Remember all elements ever seen.\"\n# uniqueeverseen('AAAABBBCCDAABBB') -> A B C D\n# uniqueeverseen('ABBcCAD', str.casefold) -> A B c D\nseen = set()\nif key is None:\nfor element in filterfalse(seen.contains, iterable):\nseen.add(element)\nyield element\nelse:\nfor element in iterable:\nk = key(element)\nif k not in seen:\nseen.add(k)\nyield element\n\ndef slidingwindow(iterable, n):\n\"Collect data into overlapping fixed-length chunks or blocks.\"\n# slidingwindow('ABCDEFG', 4) -> ABCD BCDE CDEF DEFG\nit = iter(iterable)\nwindow = collections.deque(islice(it, n-1), maxlen=n)\nfor x in it:\nwindow.append(x)\nyield tuple(window)\n\ndef grouper(iterable, n, *, incomplete='fill', fillvalue=None):\n\"Collect data into non-overlapping fixed-length chunks or blocks.\"\n# grouper('ABCDEFG', 3, fillvalue='x') -> ABC DEF Gxx\n# grouper('ABCDEFG', 3, incomplete='strict') -> ABC DEF ValueError\n# grouper('ABCDEFG', 3, incomplete='ignore') -> ABC DEF\niterators = [iter(iterable)] * n\nmatch incomplete:\ncase 'fill':\nreturn ziplongest(*iterators, fillvalue=fillvalue)\ncase 'strict':\nreturn zip(*iterators, strict=True)\ncase 'ignore':\nreturn zip(*iterators)\ncase :\nraise ValueError('Expected fill, strict, or ignore')\n\ndef roundrobin(*iterables):\n\"Visit input iterables in a cycle until each is exhausted.\"\n# roundrobin('ABC', 'D', 'EF') -> A D E B F C\n# Algorithm credited to George Sakkis\niterators = map(iter, iterables)\nfor numactive in range(len(iterables), 0, -1):\niterators = cycle(islice(iterators, numactive))\nyield from map(next, iterators)\n\ndef partition(predicate, iterable):\n\"\"\"Partition entries into false entries and true entries.\n\nIf *predicate* is slow, consider wrapping it with functools.lrucache().\n\"\"\"\n# partition(isodd, range(10)) -> 0 2 4 6 8   and  1 3 5 7 9\nt1, t2 = tee(iterable)\nreturn filterfalse(predicate, t1), filter(predicate, t2)\n\ndef subslices(seq):\n\"Return all contiguous non-empty subslices of a sequence.\"\n# subslices('ABCD') -> A AB ABC ABCD B BC BCD C CD D\nslices = starmap(slice, combinations(range(len(seq) + 1), 2))\nreturn map(operator.getitem, repeat(seq), slices)\n\ndef iterindex(iterable, value, start=0, stop=None):\n\"Return indices where a value occurs in a sequence or iterable.\"\n# iterindex('AABCADEAF', 'A') -> 0 1 4 7\nseqindex = getattr(iterable, 'index', None)\nif seqindex is None:\n# Path for general iterables\nit = islice(iterable, start, stop)\nfor i, element in enumerate(it, start):\nif element is value or element == value:\nyield i\nelse:\n# Path for sequences with an index() method\nstop = len(iterable) if stop is None else stop\ni = start\ntry:\nwhile True:\nyield (i := seqindex(value, i, stop))\ni += 1\nexcept ValueError:\npass\n\ndef iterexcept(func, exception, first=None):\n\"\"\" Call a function repeatedly until an exception is raised.\n\nConverts a call-until-exception interface to an iterator interface.\n\"\"\"\n# iterexcept(d.popitem, KeyError) -> non-blocking dictionary iterator\ntry:\nif first is not None:\nyield first()\nwhile True:\nyield func()\nexcept exception:\npass\n\nThe following recipes have a more mathematical flavor:\n\ndef powerset(iterable):\n\"powerset([1,2,3]) -> () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)\"\ns = list(iterable)\nreturn chain.fromiterable(combinations(s, r) for r in range(len(s)+1))\n\ndef sumofsquares(iterable):\n\"Add up the squares of the input values.\"\n# sumofsquares([10, 20, 30]) -> 1400\nreturn math.sumprod(*tee(iterable))\n\ndef reshape(matrix, cols):\n\"Reshape a 2-D matrix to have a given number of columns.\"\n# reshape([(0, 1), (2, 3), (4, 5)], 3) ->  (0, 1, 2), (3, 4, 5)\nreturn batched(chain.fromiterable(matrix), cols)\n\ndef transpose(matrix):\n\"Swap the rows and columns of a 2-D matrix.\"\n# transpose([(1, 2, 3), (11, 22, 33)]) -> (1, 11) (2, 22) (3, 33)\nreturn zip(*matrix, strict=True)\n\ndef matmul(m1, m2):\n\"Multiply two matrices.\"\n# matmul([(7, 5), (3, 5)], [(2, 5), (7, 9)]) -> (49, 80), (41, 60)\nn = len(m2[0])\nreturn batched(starmap(math.sumprod, product(m1, transpose(m2))), n)\n\ndef convolve(signal, kernel):\n\"\"\"Discrete linear convolution of two iterables.\nEquivalent to polynomial multiplication.\n\nConvolutions are mathematically commutative; however, the inputs are\nevaluated differently.  The signal is consumed lazily and can be\ninfinite. The kernel is fully consumed before the calculations begin.\n\nArticle:  https://betterexplained.com/articles/intuitive-convolution/\nVideo:    https://www.youtube.com/watch?v=KuXjwB4LzSA\n\"\"\"\n# convolve([1, -1, -20], [1, -3]) -> 1 -4 -17 60\n# convolve(data, [0.25, 0.25, 0.25, 0.25]) -> Moving average (blur)\n# convolve(data, [1/2, 0, -1/2]) -> 1st derivative estimate\n# convolve(data, [1, -2, 1]) -> 2nd derivative estimate\nkernel = tuple(kernel)[::-1]\nn = len(kernel)\npaddedsignal = chain(repeat(0, n-1), signal, repeat(0, n-1))\nwindowedsignal = slidingwindow(paddedsignal, n)\nreturn map(math.sumprod, repeat(kernel), windowedsignal)\n\ndef polynomialfromroots(roots):\n\"\"\"Compute a polynomial's coefficients from its roots.\n\n(x - 5) (x + 4) (x - 3)  expands to:   x?? -4x?? -17x + 60\n\"\"\"\n# polynomialfromroots([5, -4, 3]) -> [1, -4, -17, 60]\nfactors = zip(repeat(1), map(operator.neg, roots))\nreturn list(functools.reduce(convolve, factors, [1]))\n\ndef polynomialeval(coefficients, x):\n\"\"\"Evaluate a polynomial at a specific value.\n\nComputes with better numeric stability than Horner's method.\n\"\"\"\n# Evaluate x?? -4x?? -17x + 60 at x = 5\n# polynomialeval([1, -4, -17, 60], x=5) -> 0\nn = len(coefficients)\nif not n:\nreturn type(x)(0)\npowers = map(pow, repeat(x), reversed(range(n)))\nreturn math.sumprod(coefficients, powers)\n\ndef polynomialderivative(coefficients):\n\"\"\"Compute the first derivative of a polynomial.\n\nf(x)  =  x?? -4x?? -17x + 60\nf'(x) = 3x?? -8x  -17\n\"\"\"\n# polynomialderivative([1, -4, -17, 60]) -> [3, -8, -17]\nn = len(coefficients)\npowers = reversed(range(1, n))\nreturn list(map(operator.mul, coefficients, powers))\n\ndef sieve(n):\n\"Primes less than n.\"\n# sieve(30) -> 2 3 5 7 11 13 17 19 23 29\nif n > 2:\nyield 2\nstart = 3\ndata = bytearray((0, 1)) * (n // 2)\nlimit = math.isqrt(n) + 1\nfor p in iterindex(data, 1, start, limit):\nyield from iterindex(data, 1, start, p*p)\ndata[p*p : n : p+p] = bytes(len(range(p*p, n, p+p)))\nstart = p*p\nyield from iterindex(data, 1, start)\n\ndef factor(n):\n\"Prime factors of n.\"\n# factor(99) -> 3 3 11\n# factor(1000000000000007) -> 47 59 360620266859\n# factor(1000000000000403) -> 1000000000000403\nfor prime in sieve(math.isqrt(n) + 1):\nwhile not n % prime:\nyield prime\nn //= prime\nif n == 1:\nreturn\nif n > 1:\nyield n\n\ndef totient(n):\n\"Count of natural numbers up to n that are coprime to n.\"\n# https://mathworld.wolfram.com/TotientFunction.html\n# totient(12) -> 4 because len([1, 5, 7, 11]) == 4\nfor p in uniquejustseen(factor(n)):\nn -= n // p\nreturn n\n\n---------- Footnotes ----------\n\n(1) https://pypi.org/project/more-itertools/\n\n(2) https://www.cs.kent.ac.uk/people/staff/dat/miranda/whyfp90.pdf\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: functools -- Higher-order functions and operations on callable objects,  Next: operator -- Standard operators as functions,  Prev: itertools -- Functions creating iterators for efficient looping,  Up: Functional Programming Modules": {
            "content": "'Source code:' Lib/functools.py(1)\n\n\n\nThe *note functools: 5a. module is for higher-order functions: functions\nthat act on or return other functions.  In general, any callable object\ncan be treated as a function for the purposes of this module.\n\nThe *note functools: 5a. module defines the following functions:\n\n-- Function: @functools.cache (userfunction)\n\nSimple lightweight unbounded function cache.  Sometimes called\n\"memoize\"(2).\n\nReturns the same as 'lrucache(maxsize=None)', creating a thin\nwrapper around a dictionary lookup for the function arguments.\nBecause it never needs to evict old values, this is smaller and\nfaster than *note lrucache(): 815. with a size limit.\n\nFor example:\n\n@cache\ndef factorial(n):\nreturn n * factorial(n-1) if n else 1\n\n>>> factorial(10)      # no previously cached result, makes 11 recursive calls\n3628800\n>>> factorial(5)       # just looks up cached value result\n120\n>>> factorial(12)      # makes two new recursive calls, the other 10 are cached\n479001600\n\nThe cache is threadsafe so that the wrapped function can be used in\nmultiple threads.  This means that the underlying data structure\nwill remain coherent during concurrent updates.\n\nIt is possible for the wrapped function to be called more than once\nif another thread makes an additional call before the initial call\nhas been completed and cached.\n\nNew in version 3.9.\n\n-- Function: @functools.cachedproperty (func)\n\nTransform a method of a class into a property whose value is\ncomputed once and then cached as a normal attribute for the life of\nthe instance.  Similar to *note property(): 3f6, with the addition\nof caching.  Useful for expensive computed properties of instances\nthat are otherwise effectively immutable.\n\nExample:\n\nclass DataSet:\n\ndef init(self, sequenceofnumbers):\nself.data = tuple(sequenceofnumbers)\n\n@cachedproperty\ndef stdev(self):\nreturn statistics.stdev(self.data)\n\nThe mechanics of *note cachedproperty(): 299. are somewhat\ndifferent from *note property(): 3f6.  A regular property blocks\nattribute writes unless a setter is defined.  In contrast, a\n'cachedproperty' allows writes.\n\nThe 'cachedproperty' decorator only runs on lookups and only when\nan attribute of the same name doesn't exist.  When it does run, the\n'cachedproperty' writes to the attribute with the same name.\nSubsequent attribute reads and writes take precedence over the\n'cachedproperty' method and it works like a normal attribute.\n\nThe cached value can be cleared by deleting the attribute.  This\nallows the 'cachedproperty' method to run again.\n\nThe 'cachedproperty' does not prevent a possible race condition in\nmulti-threaded usage.  The getter function could run more than once\non the same instance, with the latest run setting the cached value.\nIf the cached property is idempotent or otherwise not harmful to\nrun more than once on an instance, this is fine.  If\nsynchronization is needed, implement the necessary locking inside\nthe decorated getter function or around the cached property access.\n\nNote, this decorator interferes with the operation of PEP 412(3)\nkey-sharing dictionaries.  This means that instance dictionaries\ncan take more space than usual.\n\nAlso, this decorator requires that the 'dict' attribute on each\ninstance be a mutable mapping.  This means it will not work with\nsome types, such as metaclasses (since the 'dict' attributes on\ntype instances are read-only proxies for the class namespace), and\nthose that specify 'slots' without including 'dict' as one\nof the defined slots (as such classes don't provide a 'dict'\nattribute at all).\n\nIf a mutable mapping is not available or if space-efficient key\nsharing is desired, an effect similar to *note cachedproperty():\n299. can also be achieved by stacking *note property(): 3f6. on top\nof *note lrucache(): 815.  See *note How do I cache method calls?:\n2433. for more details on how this differs from *note\ncachedproperty(): 299.\n\nNew in version 3.8.\n\nChanged in version 3.12: Prior to Python 3.12, 'cachedproperty'\nincluded an undocumented lock to ensure that in multi-threaded\nusage the getter function was guaranteed to run only once per\ninstance.  However, the lock was per-property, not per-instance,\nwhich could result in unacceptably high lock contention.  In Python\n3.12+ this locking is removed.\n\n-- Function: functools.cmptokey (func)\n\nTransform an old-style comparison function to a *note key function:\nc62.  Used with tools that accept key functions (such as *note\nsorted(): a12, *note min(): d6f, *note max(): d70, *note\nheapq.nlargest(): 2239, *note heapq.nsmallest(): 223a, *note\nitertools.groupby(): 242a.).  This function is primarily used as a\ntransition tool for programs being converted from Python 2 which\nsupported the use of comparison functions.\n\nA comparison function is any callable that accepts two arguments,\ncompares them, and returns a negative number for less-than, zero\nfor equality, or a positive number for greater-than.  A key\nfunction is a callable that accepts one argument and returns\nanother value to be used as the sort key.\n\nExample:\n\nsorted(iterable, key=cmptokey(locale.strcoll))  # locale-aware sort order\n\nFor sorting examples and a brief sorting tutorial, see *note\nSorting Techniques: 1e89.\n\nNew in version 3.2.\n\n-- Function: @functools.lrucache (userfunction)\n\n-- Function: @functools.lrucache (maxsize=128, typed=False)\n\nDecorator to wrap a function with a memoizing callable that saves\nup to the 'maxsize' most recent calls.  It can save time when an\nexpensive or I/O bound function is periodically called with the\nsame arguments.\n\nThe cache is threadsafe so that the wrapped function can be used in\nmultiple threads.  This means that the underlying data structure\nwill remain coherent during concurrent updates.\n\nIt is possible for the wrapped function to be called more than once\nif another thread makes an additional call before the initial call\nhas been completed and cached.\n\nSince a dictionary is used to cache results, the positional and\nkeyword arguments to the function must be *note hashable: 3db.\n\nDistinct argument patterns may be considered to be distinct calls\nwith separate cache entries.  For example, 'f(a=1, b=2)' and\n'f(b=2, a=1)' differ in their keyword argument order and may have\ntwo separate cache entries.\n\nIf 'userfunction' is specified, it must be a callable.  This\nallows the 'lrucache' decorator to be applied directly to a user\nfunction, leaving the 'maxsize' at its default value of 128:\n\n@lrucache\ndef countvowels(sentence):\nreturn sum(sentence.count(vowel) for vowel in 'AEIOUaeiou')\n\nIf 'maxsize' is set to 'None', the LRU feature is disabled and the\ncache can grow without bound.\n\nIf 'typed' is set to true, function arguments of different types\nwill be cached separately.  If 'typed' is false, the implementation\nwill usually regard them as equivalent calls and only cache a\nsingle result.  (Some types such as 'str' and 'int' may be cached\nseparately even when 'typed' is false.)\n\nNote, type specificity applies only to the function's immediate\narguments rather than their contents.  The scalar arguments,\n'Decimal(42)' and 'Fraction(42)' are be treated as distinct calls\nwith distinct results.  In contrast, the tuple arguments\n'('answer', Decimal(42))' and '('answer', Fraction(42))' are\ntreated as equivalent.\n\nThe wrapped function is instrumented with a 'cacheparameters()'\nfunction that returns a new *note dict: 237. showing the values for\n'maxsize' and 'typed'.  This is for information purposes only.\nMutating the values has no effect.\n\nTo help measure the effectiveness of the cache and tune the\n'maxsize' parameter, the wrapped function is instrumented with a\n'cacheinfo()' function that returns a *note named tuple: 417.\nshowing 'hits', 'misses', 'maxsize' and 'currsize'.\n\nThe decorator also provides a 'cacheclear()' function for clearing\nor invalidating the cache.\n\nThe original underlying function is accessible through the\n'wrapped' attribute.  This is useful for introspection, for\nbypassing the cache, or for rewrapping the function with a\ndifferent cache.\n\nThe cache keeps references to the arguments and return values until\nthey age out of the cache or until the cache is cleared.\n\nIf a method is cached, the 'self' instance argument is included in\nthe cache.  See *note How do I cache method calls?: 2433.\n\nAn LRU (least recently used) cache(4) works best when the most\nrecent calls are the best predictors of upcoming calls (for\nexample, the most popular articles on a news server tend to change\neach day).  The cache's size limit assures that the cache does not\ngrow without bound on long-running processes such as web servers.\n\nIn general, the LRU cache should only be used when you want to\nreuse previously computed values.  Accordingly, it doesn't make\nsense to cache functions with side-effects, functions that need to\ncreate distinct mutable objects on each call (such as generators\nand async functions), or impure functions such as time() or\nrandom().\n\nExample of an LRU cache for static web content:\n\n@lrucache(maxsize=32)\ndef getpep(num):\n'Retrieve text of a Python Enhancement Proposal'\nresource = f'https://peps.python.org/pep-{num:04d}'\ntry:\nwith urllib.request.urlopen(resource) as s:\nreturn s.read()\nexcept urllib.error.HTTPError:\nreturn 'Not Found'\n\n>>> for n in 8, 290, 308, 320, 8, 218, 320, 279, 289, 320, 9991:\n...     pep = getpep(n)\n...     print(n, len(pep))\n\n>>> getpep.cacheinfo()\nCacheInfo(hits=3, misses=8, maxsize=32, currsize=8)\n\nExample of efficiently computing Fibonacci numbers(5) using a cache\nto implement a dynamic programming(6) technique:\n\n@lrucache(maxsize=None)\ndef fib(n):\nif n < 2:\nreturn n\nreturn fib(n-1) + fib(n-2)\n\n>>> [fib(n) for n in range(16)]\n[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610]\n\n>>> fib.cacheinfo()\nCacheInfo(hits=28, misses=16, maxsize=None, currsize=16)\n\nNew in version 3.2.\n\nChanged in version 3.3: Added the 'typed' option.\n\nChanged in version 3.8: Added the 'userfunction' option.\n\nChanged in version 3.9: Added the function 'cacheparameters()'\n\n-- Function: @functools.totalordering\n\nGiven a class defining one or more rich comparison ordering\nmethods, this class decorator supplies the rest.  This simplifies\nthe effort involved in specifying all of the possible rich\ncomparison operations:\n\nThe class must define one of 'lt()', 'le()', 'gt()', or\n'ge()'.  In addition, the class should supply an 'eq()'\nmethod.\n\nFor example:\n\n@totalordering\nclass Student:\ndef isvalidoperand(self, other):\nreturn (hasattr(other, \"lastname\") and\nhasattr(other, \"firstname\"))\ndef eq(self, other):\nif not self.isvalidoperand(other):\nreturn NotImplemented\nreturn ((self.lastname.lower(), self.firstname.lower()) ==\n(other.lastname.lower(), other.firstname.lower()))\ndef lt(self, other):\nif not self.isvalidoperand(other):\nreturn NotImplemented\nreturn ((self.lastname.lower(), self.firstname.lower()) <\n(other.lastname.lower(), other.firstname.lower()))\n\nNote: While this decorator makes it easy to create well\nbehaved totally ordered types, it 'does' come at the cost of\nslower execution and more complex stack traces for the derived\ncomparison methods.  If performance benchmarking indicates\nthis is a bottleneck for a given application, implementing all\nsix rich comparison methods instead is likely to provide an\neasy speed boost.\n\nNote: This decorator makes no attempt to override methods that\nhave been declared in the class 'or its superclasses'.\nMeaning that if a superclass defines a comparison operator,\n'totalordering' will not implement it again, even if the\noriginal method is abstract.\n\nNew in version 3.2.\n\nChanged in version 3.4: Returning NotImplemented from the\nunderlying comparison function for unrecognised types is now\nsupported.\n\n-- Function: functools.partial (func, /, *args, keywords)\n\nReturn a new *note partial object: 2434. which when called will\nbehave like 'func' called with the positional arguments 'args' and\nkeyword arguments 'keywords'.  If more arguments are supplied to\nthe call, they are appended to 'args'.  If additional keyword\narguments are supplied, they extend and override 'keywords'.\nRoughly equivalent to:\n\ndef partial(func, /, *args, keywords):\ndef newfunc(*fargs, fkeywords):\nnewkeywords = {keywords, fkeywords}\nreturn func(*args, *fargs, newkeywords)\nnewfunc.func = func\nnewfunc.args = args\nnewfunc.keywords = keywords\nreturn newfunc\n\nThe *note partial(): d31. is used for partial function application\nwhich \"freezes\" some portion of a function's arguments and/or\nkeywords resulting in a new object with a simplified signature.\nFor example, *note partial(): d31. can be used to create a callable\nthat behaves like the *note int(): 17e. function where the 'base'\nargument defaults to two:\n\n>>> from functools import partial\n>>> basetwo = partial(int, base=2)\n>>> basetwo.doc = 'Convert base 2 string to an int.'\n>>> basetwo('10010')\n18\n\n-- Class: functools.partialmethod (func, /, *args, keywords)\n\nReturn a new *note partialmethod: 8a9. descriptor which behaves\nlike *note partial: d31. except that it is designed to be used as a\nmethod definition rather than being directly callable.\n\n'func' must be a *note descriptor: 1c78. or a callable (objects\nwhich are both, like normal functions, are handled as descriptors).\n\nWhen 'func' is a descriptor (such as a normal Python function,\n*note classmethod(): 246, *note staticmethod(): 5cc,\n'abstractmethod()' or another instance of *note partialmethod:\n8a9.), calls to 'get' are delegated to the underlying\ndescriptor, and an appropriate *note partial object: 2434. returned\nas the result.\n\nWhen 'func' is a non-descriptor callable, an appropriate bound\nmethod is created dynamically.  This behaves like a normal Python\nfunction when used as a method: the 'self' argument will be\ninserted as the first positional argument, even before the 'args'\nand 'keywords' supplied to the *note partialmethod: 8a9.\nconstructor.\n\nExample:\n\n>>> class Cell:\n...     def init(self):\n...         self.alive = False\n...     @property\n...     def alive(self):\n...         return self.alive\n...     def setstate(self, state):\n...         self.alive = bool(state)\n...     setalive = partialmethod(setstate, True)\n...     setdead = partialmethod(setstate, False)\n...\n>>> c = Cell()\n>>> c.alive\nFalse\n>>> c.setalive()\n>>> c.alive\nTrue\n\nNew in version 3.4.\n\n-- Function: functools.reduce (function, iterable[, initializer])\n\nApply 'function' of two arguments cumulatively to the items of\n'iterable', from left to right, so as to reduce the iterable to a\nsingle value.  For example, 'reduce(lambda x, y: x+y, [1, 2, 3, 4,\n5])' calculates '((((1+2)+3)+4)+5)'.  The left argument, 'x', is\nthe accumulated value and the right argument, 'y', is the update\nvalue from the 'iterable'.  If the optional 'initializer' is\npresent, it is placed before the items of the iterable in the\ncalculation, and serves as a default when the iterable is empty.\nIf 'initializer' is not given and 'iterable' contains only one\nitem, the first item is returned.\n\nRoughly equivalent to:\n\ndef reduce(function, iterable, initializer=None):\nit = iter(iterable)\nif initializer is None:\nvalue = next(it)\nelse:\nvalue = initializer\nfor element in it:\nvalue = function(value, element)\nreturn value\n\nSee *note itertools.accumulate(): 825. for an iterator that yields\nall intermediate values.\n\n-- Function: @functools.singledispatch\n\nTransform a function into a *note single-dispatch: 818. *note\ngeneric function: 817.\n\nTo define a generic function, decorate it with the\n'@singledispatch' decorator.  When defining a function using\n'@singledispatch', note that the dispatch happens on the type of\nthe first argument:\n\n>>> from functools import singledispatch\n>>> @singledispatch\n... def fun(arg, verbose=False):\n...     if verbose:\n...         print(\"Let me just say,\", end=\" \")\n...     print(arg)\n\nTo add overloaded implementations to the function, use the\n'register()' attribute of the generic function, which can be used\nas a decorator.  For functions annotated with types, the decorator\nwill infer the type of the first argument automatically:\n\n>>> @fun.register\n... def (arg: int, verbose=False):\n...     if verbose:\n...         print(\"Strength in numbers, eh?\", end=\" \")\n...     print(arg)\n...\n>>> @fun.register\n... def (arg: list, verbose=False):\n...     if verbose:\n...         print(\"Enumerate this:\")\n...     for i, elem in enumerate(arg):\n...         print(i, elem)\n\n*note types.UnionType: 407. and *note typing.Union: 408. can also\nbe used:\n\n>>> @fun.register\n... def (arg: int | float, verbose=False):\n...     if verbose:\n...         print(\"Strength in numbers, eh?\", end=\" \")\n...     print(arg)\n...\n>>> from typing import Union\n>>> @fun.register\n... def (arg: Union[list, set], verbose=False):\n...     if verbose:\n...         print(\"Enumerate this:\")\n...     for i, elem in enumerate(arg):\n...         print(i, elem)\n...\n\nFor code which doesn't use type annotations, the appropriate type\nargument can be passed explicitly to the decorator itself:\n\n>>> @fun.register(complex)\n... def (arg, verbose=False):\n...     if verbose:\n...         print(\"Better than complicated.\", end=\" \")\n...     print(arg.real, arg.imag)\n...\n\nTo enable registering *note lambdas: 2435. and pre-existing\nfunctions, the 'register()' attribute can also be used in a\nfunctional form:\n\n>>> def nothing(arg, verbose=False):\n...     print(\"Nothing.\")\n...\n>>> fun.register(type(None), nothing)\n\nThe 'register()' attribute returns the undecorated function.  This\nenables decorator stacking, *note pickling: a1, and the creation of\nunit tests for each variant independently:\n\n>>> @fun.register(float)\n... @fun.register(Decimal)\n... def funnum(arg, verbose=False):\n...     if verbose:\n...         print(\"Half of your number:\", end=\" \")\n...     print(arg / 2)\n...\n>>> funnum is fun\nFalse\n\nWhen called, the generic function dispatches on the type of the\nfirst argument:\n\n>>> fun(\"Hello, world.\")\nHello, world.\n>>> fun(\"test.\", verbose=True)\nLet me just say, test.\n>>> fun(42, verbose=True)\nStrength in numbers, eh? 42\n>>> fun(['spam', 'spam', 'eggs', 'spam'], verbose=True)\nEnumerate this:\n0 spam\n1 spam\n2 eggs\n3 spam\n>>> fun(None)\nNothing.\n>>> fun(1.23)\n0.615\n\nWhere there is no registered implementation for a specific type,\nits method resolution order is used to find a more generic\nimplementation.  The original function decorated with\n'@singledispatch' is registered for the base *note object: 8bb.\ntype, which means it is used if no better implementation is found.\n\nIf an implementation is registered to an *note abstract base class:\n102a, virtual subclasses of the base class will be dispatched to\nthat implementation:\n\n>>> from collections.abc import Mapping\n>>> @fun.register\n... def (arg: Mapping, verbose=False):\n...     if verbose:\n...         print(\"Keys & Values\")\n...     for key, value in arg.items():\n...         print(key, \"=>\", value)\n...\n>>> fun({\"a\": \"b\"})\na => b\n\nTo check which implementation the generic function will choose for\na given type, use the 'dispatch()' attribute:\n\n>>> fun.dispatch(float)\n<function funnum at 0x1035a2840>\n>>> fun.dispatch(dict)    # note: default implementation\n<function fun at 0x103fe0000>\n\nTo access all registered implementations, use the read-only\n'registry' attribute:\n\n>>> fun.registry.keys()\ndictkeys([<class 'NoneType'>, <class 'int'>, <class 'object'>,\n<class 'decimal.Decimal'>, <class 'list'>,\n<class 'float'>])\n>>> fun.registry[float]\n<function funnum at 0x1035a2840>\n>>> fun.registry[object]\n<function fun at 0x103fe0000>\n\nNew in version 3.4.\n\nChanged in version 3.7: The 'register()' attribute now supports\nusing type annotations.\n\nChanged in version 3.11: The 'register()' attribute now supports\n*note types.UnionType: 407. and *note typing.Union: 408. as type\nannotations.\n\n-- Class: functools.singledispatchmethod (func)\n\nTransform a method into a *note single-dispatch: 818. *note generic\nfunction: 817.\n\nTo define a generic method, decorate it with the\n'@singledispatchmethod' decorator.  When defining a function using\n'@singledispatchmethod', note that the dispatch happens on the type\nof the first non-'self' or non-'cls' argument:\n\nclass Negator:\n@singledispatchmethod\ndef neg(self, arg):\nraise NotImplementedError(\"Cannot negate a\")\n\n@neg.register\ndef (self, arg: int):\nreturn -arg\n\n@neg.register\ndef (self, arg: bool):\nreturn not arg\n\n'@singledispatchmethod' supports nesting with other decorators such\nas *note @classmethod: 246.  Note that to allow for\n'dispatcher.register', 'singledispatchmethod' must be the 'outer\nmost' decorator.  Here is the 'Negator' class with the 'neg'\nmethods bound to the class, rather than an instance of the class:\n\nclass Negator:\n@singledispatchmethod\n@classmethod\ndef neg(cls, arg):\nraise NotImplementedError(\"Cannot negate a\")\n\n@neg.register\n@classmethod\ndef (cls, arg: int):\nreturn -arg\n\n@neg.register\n@classmethod\ndef (cls, arg: bool):\nreturn not arg\n\nThe same pattern can be used for other similar decorators: *note\n@staticmethod: 5cc, *note @abstractmethod: efd, and others.\n\nNew in version 3.8.\n\n-- Function: functools.updatewrapper (wrapper, wrapped,\nassigned=WRAPPERASSIGNMENTS, updated=WRAPPERUPDATES)\n\nUpdate a 'wrapper' function to look like the 'wrapped' function.\nThe optional arguments are tuples to specify which attributes of\nthe original function are assigned directly to the matching\nattributes on the wrapper function and which attributes of the\nwrapper function are updated with the corresponding attributes from\nthe original function.  The default values for these arguments are\nthe module level constants 'WRAPPERASSIGNMENTS' (which assigns to\nthe wrapper function's 'module', 'name', 'qualname',\n'annotations' and 'doc', the documentation string) and\n'WRAPPERUPDATES' (which updates the wrapper function's 'dict',\ni.e.  the instance dictionary).\n\nTo allow access to the original function for introspection and\nother purposes (e.g.  bypassing a caching decorator such as *note\nlrucache(): 815.), this function automatically adds a\n'wrapped' attribute to the wrapper that refers to the function\nbeing wrapped.\n\nThe main intended use for this function is in *note decorator: 514.\nfunctions which wrap the decorated function and return the wrapper.\nIf the wrapper function is not updated, the metadata of the\nreturned function will reflect the wrapper definition rather than\nthe original function definition, which is typically less than\nhelpful.\n\n*note updatewrapper(): e99. may be used with callables other than\nfunctions.  Any attributes named in 'assigned' or 'updated' that\nare missing from the object being wrapped are ignored (i.e.  this\nfunction will not attempt to set them on the wrapper function).\n*note AttributeError: 395. is still raised if the wrapper function\nitself is missing any attributes named in 'updated'.\n\nChanged in version 3.2: The 'wrapped' attribute is now\nautomatically added.  The 'annotations' attribute is now copied\nby default.  Missing attributes no longer trigger an *note\nAttributeError: 395.\n\nChanged in version 3.4: The 'wrapped' attribute now always\nrefers to the wrapped function, even if that function defined a\n'wrapped' attribute.  (see bpo-17482(7))\n\n-- Function: @functools.wraps (wrapped, assigned=WRAPPERASSIGNMENTS,\nupdated=WRAPPERUPDATES)\n\nThis is a convenience function for invoking *note updatewrapper():\ne99. as a function decorator when defining a wrapper function.  It\nis equivalent to 'partial(updatewrapper, wrapped=wrapped,\nassigned=assigned, updated=updated)'.  For example:\n\n>>> from functools import wraps\n>>> def mydecorator(f):\n...     @wraps(f)\n...     def wrapper(*args, kwds):\n...         print('Calling decorated function')\n...         return f(*args, kwds)\n...     return wrapper\n...\n>>> @mydecorator\n... def example():\n...     \"\"\"Docstring\"\"\"\n...     print('Called example function')\n...\n>>> example()\nCalling decorated function\nCalled example function\n>>> example.name\n'example'\n>>> example.doc\n'Docstring'\n\nWithout the use of this decorator factory, the name of the example\nfunction would have been ''wrapper'', and the docstring of the\noriginal 'example()' would have been lost.\n\n* Menu:\n\n* partial Objects::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/functools.py\n\n(2) https://en.wikipedia.org/wiki/Memoization\n\n(3) https://peps.python.org/pep-0412/\n\n(4)\nhttps://en.wikipedia.org/wiki/Cachereplacementpolicies#Leastrecentlyused(LRU)\n\n(5) https://en.wikipedia.org/wiki/Fibonaccinumber\n\n(6) https://en.wikipedia.org/wiki/Dynamicprogramming\n\n(7) https://bugs.python.org/issue?@action=redirect&bpo=17482\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: partial Objects,  Up: functools -- Higher-order functions and operations on callable objects": {
            "content": "5.10.2.1 'partial' Objects\n..........................\n\n*note partial: d31. objects are callable objects created by *note\npartial(): d31.  They have three read-only attributes:\n\n-- Attribute: partial.func\n\nA callable object or function.  Calls to the *note partial: d31.\nobject will be forwarded to *note func: 2437. with new arguments\nand keywords.\n\n-- Attribute: partial.args\n\nThe leftmost positional arguments that will be prepended to the\npositional arguments provided to a *note partial: d31. object call.\n\n-- Attribute: partial.keywords\n\nThe keyword arguments that will be supplied when the *note partial:\nd31. object is called.\n\n*note partial: d31. objects are like 'function' objects in that they are\ncallable, weak referenceable, and can have attributes.  There are some\nimportant differences.  For instance, the *note name: 1302. and\n'doc' attributes are not created automatically.  Also, *note\npartial: d31. objects defined in classes behave like static methods and\ndo not transform into bound methods during instance attribute look-up.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: operator -- Standard operators as functions,  Prev: functools -- Higher-order functions and operations on callable objects,  Up: Functional Programming Modules": {
            "content": "'Source code:' Lib/operator.py(1)\n\n\n\nThe *note operator: 9a. module exports a set of efficient functions\ncorresponding to the intrinsic operators of Python.  For example,\n'operator.add(x, y)' is equivalent to the expression 'x+y'.  Many\nfunction names are those used for special methods, without the double\nunderscores.  For backward compatibility, many of these have a variant\nwith the double underscores kept.  The variants without the double\nunderscores are preferred for clarity.\n",
            "subsections": []
        },
        "The functions fall into categories that perform object comparisons,": {
            "content": "logical operations, mathematical operations and sequence operations.\n",
            "subsections": []
        },
        "The object comparison functions are useful for all objects, and are": {
            "content": "named after the rich comparison operators they support:\n\n-- Function: operator.lt (a, b)\n-- Function: operator.le (a, b)\n-- Function: operator.eq (a, b)\n-- Function: operator.ne (a, b)\n-- Function: operator.ge (a, b)\n-- Function: operator.gt (a, b)\n-- Function: operator.lt (a, b)\n-- Function: operator.le (a, b)\n-- Function: operator.eq (a, b)\n-- Function: operator.ne (a, b)\n-- Function: operator.ge (a, b)\n-- Function: operator.gt (a, b)\n\nPerform \"rich comparisons\" between 'a' and 'b'.  Specifically,\n'lt(a, b)' is equivalent to 'a < b', 'le(a, b)' is equivalent to 'a\n<= b', 'eq(a, b)' is equivalent to 'a == b', 'ne(a, b)' is\nequivalent to 'a != b', 'gt(a, b)' is equivalent to 'a > b' and\n'ge(a, b)' is equivalent to 'a >= b'.  Note that these functions\ncan return any value, which may or may not be interpretable as a\nBoolean value.  See *note Comparisons: 1d7f. for more information\nabout rich comparisons.\n",
            "subsections": []
        },
        "The logical operations are also generally applicable to all objects, and": {
            "content": "support truth tests, identity tests, and boolean operations:\n\n-- Function: operator.not (obj)\n-- Function: operator.not (obj)\n\nReturn the outcome of *note not: 1d89. 'obj'.  (Note that there is\nno 'not()' method for object instances; only the interpreter\ncore defines this operation.  The result is affected by the *note\nbool(): 114a. and *note len(): 1c68. methods.)\n\n-- Function: operator.truth (obj)\n\nReturn *note True: a53. if 'obj' is true, and *note False: 971.\notherwise.  This is equivalent to using the *note bool: 17d.\nconstructor.\n\n-- Function: operator.is (a, b)\n\nReturn 'a is b'.  Tests object identity.\n\n-- Function: operator.isnot (a, b)\n\nReturn 'a is not b'.  Tests object identity.\n\nThe mathematical and bitwise operations are the most numerous:\n\n-- Function: operator.abs (obj)\n-- Function: operator.abs (obj)\n\nReturn the absolute value of 'obj'.\n\n-- Function: operator.add (a, b)\n-- Function: operator.add (a, b)\n\nReturn 'a + b', for 'a' and 'b' numbers.\n\n-- Function: operator.and (a, b)\n-- Function: operator.and (a, b)\n\nReturn the bitwise and of 'a' and 'b'.\n\n-- Function: operator.floordiv (a, b)\n-- Function: operator.floordiv (a, b)\n\nReturn 'a // b'.\n\n-- Function: operator.index (a)\n-- Function: operator.index (a)\n\nReturn 'a' converted to an integer.  Equivalent to 'a.index()'.\n\nChanged in version 3.10: The result always has exact type *note\nint: 17e.  Previously, the result could have been an instance of a\nsubclass of 'int'.\n\n-- Function: operator.inv (obj)\n-- Function: operator.invert (obj)\n-- Function: operator.inv (obj)\n-- Function: operator.invert (obj)\n\nReturn the bitwise inverse of the number 'obj'.  This is equivalent\nto '~obj'.\n\n-- Function: operator.lshift (a, b)\n-- Function: operator.lshift (a, b)\n\nReturn 'a' shifted left by 'b'.\n\n-- Function: operator.mod (a, b)\n-- Function: operator.mod (a, b)\n\nReturn 'a % b'.\n\n-- Function: operator.mul (a, b)\n-- Function: operator.mul (a, b)\n\nReturn 'a * b', for 'a' and 'b' numbers.\n\n-- Function: operator.matmul (a, b)\n-- Function: operator.matmul (a, b)\n\nReturn 'a @ b'.\n\nNew in version 3.5.\n\n-- Function: operator.neg (obj)\n-- Function: operator.neg (obj)\n\nReturn 'obj' negated ('-obj').\n\n-- Function: operator.or (a, b)\n-- Function: operator.or (a, b)\n\nReturn the bitwise or of 'a' and 'b'.\n\n-- Function: operator.pos (obj)\n-- Function: operator.pos (obj)\n\nReturn 'obj' positive ('+obj').\n\n-- Function: operator.pow (a, b)\n-- Function: operator.pow (a, b)\n\nReturn 'a  b', for 'a' and 'b' numbers.\n\n-- Function: operator.rshift (a, b)\n-- Function: operator.rshift (a, b)\n\nReturn 'a' shifted right by 'b'.\n\n-- Function: operator.sub (a, b)\n-- Function: operator.sub (a, b)\n\nReturn 'a - b'.\n\n-- Function: operator.truediv (a, b)\n-- Function: operator.truediv (a, b)\n\nReturn 'a / b' where 2/3 is .66 rather than 0.  This is also known\nas \"true\" division.\n\n-- Function: operator.xor (a, b)\n-- Function: operator.xor (a, b)\n\nReturn the bitwise exclusive or of 'a' and 'b'.\n",
            "subsections": []
        },
        "Operations which work with sequences (some of them with mappings too)": {
            "content": "include:\n\n-- Function: operator.concat (a, b)\n-- Function: operator.concat (a, b)\n\nReturn 'a + b' for 'a' and 'b' sequences.\n\n-- Function: operator.contains (a, b)\n-- Function: operator.contains (a, b)\n\nReturn the outcome of the test 'b in a'.  Note the reversed\noperands.\n\n-- Function: operator.countOf (a, b)\n\nReturn the number of occurrences of 'b' in 'a'.\n\n-- Function: operator.delitem (a, b)\n-- Function: operator.delitem (a, b)\n\nRemove the value of 'a' at index 'b'.\n\n-- Function: operator.getitem (a, b)\n-- Function: operator.getitem (a, b)\n\nReturn the value of 'a' at index 'b'.\n\n-- Function: operator.indexOf (a, b)\n\nReturn the index of the first of occurrence of 'b' in 'a'.\n\n-- Function: operator.setitem (a, b, c)\n-- Function: operator.setitem (a, b, c)\n\nSet the value of 'a' at index 'b' to 'c'.\n\n-- Function: operator.lengthhint (obj, default=0)\n\nReturn an estimated length for the object 'obj'.  First try to\nreturn its actual length, then an estimate using *note\nobject.lengthhint(): d73, and finally return the default\nvalue.\n\nNew in version 3.4.\n\nThe following operation works with callables:\n\n-- Function: operator.call (obj, /, *args, kwargs)\n-- Function: operator.call (obj, /, *args, kwargs)\n\nReturn 'obj(*args, kwargs)'.\n\nNew in version 3.11.\n\nThe *note operator: 9a. module also defines tools for generalized\nattribute and item lookups.  These are useful for making fast field\nextractors as arguments for *note map(): 65f, *note sorted(): a12, *note\nitertools.groupby(): 242a, or other functions that expect a function\nargument.\n\n-- Function: operator.attrgetter (attr)\n\n-- Function: operator.attrgetter (*attrs)\n\nReturn a callable object that fetches 'attr' from its operand.  If\nmore than one attribute is requested, returns a tuple of\nattributes.  The attribute names can also contain dots.  For\nexample:\n\n* After 'f = attrgetter('name')', the call 'f(b)' returns\n'b.name'.\n\n* After 'f = attrgetter('name', 'date')', the call 'f(b)'\nreturns '(b.name, b.date)'.\n\n* After 'f = attrgetter('name.first', 'name.last')', the call\n'f(b)' returns '(b.name.first, b.name.last)'.\n\nEquivalent to:\n\ndef attrgetter(*items):\nif any(not isinstance(item, str) for item in items):\nraise TypeError('attribute name must be a string')\nif len(items) == 1:\nattr = items[0]\ndef g(obj):\nreturn resolveattr(obj, attr)\nelse:\ndef g(obj):\nreturn tuple(resolveattr(obj, attr) for attr in items)\nreturn g\n\ndef resolveattr(obj, attr):\nfor name in attr.split(\".\"):\nobj = getattr(obj, name)\nreturn obj\n\n-- Function: operator.itemgetter (item)\n\n-- Function: operator.itemgetter (*items)\n\nReturn a callable object that fetches 'item' from its operand using\nthe operand's *note getitem(): 4b9. method.  If multiple items\nare specified, returns a tuple of lookup values.  For example:\n\n* After 'f = itemgetter(2)', the call 'f(r)' returns 'r[2]'.\n\n* After 'g = itemgetter(2, 5, 3)', the call 'g(r)' returns\n'(r[2], r[5], r[3])'.\n\nEquivalent to:\n\ndef itemgetter(*items):\nif len(items) == 1:\nitem = items[0]\ndef g(obj):\nreturn obj[item]\nelse:\ndef g(obj):\nreturn tuple(obj[item] for item in items)\nreturn g\n\nThe items can be any type accepted by the operand's *note\ngetitem(): 4b9. method.  Dictionaries accept any *note\nhashable: 3db. value.  Lists, tuples, and strings accept an index\nor a slice:\n\n>>> itemgetter(1)('ABCDEFG')\n'B'\n>>> itemgetter(1, 3, 5)('ABCDEFG')\n('B', 'D', 'F')\n>>> itemgetter(slice(2, None))('ABCDEFG')\n'CDEFG'\n>>> soldier = dict(rank='captain', name='dotterbart')\n>>> itemgetter('rank')(soldier)\n'captain'\n\nExample of using *note itemgetter(): 88f. to retrieve specific\nfields from a tuple record:\n\n>>> inventory = [('apple', 3), ('banana', 2), ('pear', 5), ('orange', 1)]\n>>> getcount = itemgetter(1)\n>>> list(map(getcount, inventory))\n[3, 2, 5, 1]\n>>> sorted(inventory, key=getcount)\n[('orange', 1), ('banana', 2), ('apple', 3), ('pear', 5)]\n\n-- Function: operator.methodcaller (name, /, *args, kwargs)\n\nReturn a callable object that calls the method 'name' on its\noperand.  If additional arguments and/or keyword arguments are\ngiven, they will be given to the method as well.  For example:\n\n* After 'f = methodcaller('name')', the call 'f(b)' returns\n'b.name()'.\n\n* After 'f = methodcaller('name', 'foo', bar=1)', the call\n'f(b)' returns 'b.name('foo', bar=1)'.\n\nEquivalent to:\n\ndef methodcaller(name, /, *args, kwargs):\ndef caller(obj):\nreturn getattr(obj, name)(*args, kwargs)\nreturn caller\n\n* Menu:\n\n* Mapping Operators to Functions::\n* In-place Operators::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/operator.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Mapping Operators to Functions,  Next: In-place Operators,  Up: operator -- Standard operators as functions": {
            "content": "5.10.3.1 Mapping Operators to Functions\n.......................................\n",
            "subsections": []
        },
        "This table shows how abstract operations correspond to operator symbols": {
            "content": "in the Python syntax and the functions in the *note operator: 9a.\nmodule.\n",
            "subsections": []
        },
        "Operation                   Syntax                        Function": {
            "content": "------------------------------------------------------------------------------------------------------\n\nAddition                    'a + b'                       'add(a, b)'\n\n\nConcatenation               'seq1 + seq2'                 'concat(seq1, seq2)'\n\n",
            "subsections": []
        },
        "Containment Test            'obj in seq'                  'contains(seq, obj)'": {
            "content": "",
            "subsections": []
        },
        "Division                    'a / b'                       'truediv(a, b)'": {
            "content": "",
            "subsections": []
        },
        "Division                    'a // b'                      'floordiv(a, b)'": {
            "content": "Bitwise And                 'a & b'                       'and(a, b)'\n\n\nBitwise Exclusive Or        'a ^ b'                       'xor(a, b)'\n\n\nBitwise Inversion           '~ a'                         'invert(a)'\n\n\nBitwise Or                  'a | b'                       'or(a, b)'\n\n",
            "subsections": []
        },
        "Exponentiation              'a  b'                      'pow(a, b)'": {
            "content": "",
            "subsections": []
        },
        "Identity                    'a is b'                      'is(a, b)'": {
            "content": "",
            "subsections": []
        },
        "Identity                    'a is not b'                  'isnot(a, b)'": {
            "content": "Indexed Assignment          'obj[k] = v'                  'setitem(obj, k, v)'\n\n\nIndexed Deletion            'del obj[k]'                  'delitem(obj, k)'\n\n\nIndexing                    'obj[k]'                      'getitem(obj, k)'\n\n\nLeft Shift                  'a << b'                      'lshift(a, b)'\n\n\nModulo                      'a % b'                       'mod(a, b)'\n\n\nMultiplication              'a * b'                       'mul(a, b)'\n\n\nMatrix Multiplication       'a @ b'                       'matmul(a, b)'\n\n",
            "subsections": []
        },
        "Negation (Arithmetic)       '- a'                         'neg(a)'": {
            "content": "",
            "subsections": []
        },
        "Negation (Logical)          'not a'                       'not(a)'": {
            "content": "Positive                    '+ a'                         'pos(a)'\n\n\nRight Shift                 'a >> b'                      'rshift(a, b)'\n\n\nSlice Assignment            'seq[i:j] = values'           'setitem(seq, slice(i, j), values)'\n\n\nSlice Deletion              'del seq[i:j]'                'delitem(seq, slice(i, j))'\n\n\nSlicing                     'seq[i:j]'                    'getitem(seq, slice(i, j))'\n\n\nString Formatting           's % obj'                     'mod(s, obj)'\n\n",
            "subsections": []
        },
        "Subtraction                 'a - b'                       'sub(a, b)'": {
            "content": "",
            "subsections": []
        },
        "Truth Test                  'obj'                         'truth(obj)'": {
            "content": "Ordering                    'a < b'                       'lt(a, b)'\n\n\nOrdering                    'a <= b'                      'le(a, b)'\n\n\nEquality                    'a == b'                      'eq(a, b)'\n\n\nDifference                  'a != b'                      'ne(a, b)'\n\n\nOrdering                    'a >= b'                      'ge(a, b)'\n\n\nOrdering                    'a > b'                       'gt(a, b)'\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: In-place Operators,  Prev: Mapping Operators to Functions,  Up: operator -- Standard operators as functions": {
            "content": "5.10.3.2 In-place Operators\n...........................\n\nMany operations have an \"in-place\" version.  Listed below are functions\nproviding a more primitive access to in-place operators than the usual\nsyntax does; for example, the *note statement: 247d. 'x += y' is\nequivalent to 'x = operator.iadd(x, y)'.  Another way to put it is to\nsay that 'z = operator.iadd(x, y)' is equivalent to the compound\nstatement 'z = x; z += y'.\n",
            "subsections": []
        },
        "In those examples, note that when an in-place method is called, the": {
            "content": "computation and assignment are performed in two separate steps.  The\nin-place functions listed below only do the first step, calling the\nin-place method.  The second step, assignment, is not handled.\n",
            "subsections": []
        },
        "For immutable targets such as strings, numbers, and tuples, the updated": {
            "content": "value is computed, but not assigned back to the input variable:\n\n>>> a = 'hello'\n>>> iadd(a, ' world')\n'hello world'\n>>> a\n'hello'\n",
            "subsections": []
        },
        "For mutable targets such as lists and dictionaries, the in-place method": {
            "content": "will perform the update, so no subsequent assignment is necessary:\n\n>>> s = ['h', 'e', 'l', 'l', 'o']\n>>> iadd(s, [' ', 'w', 'o', 'r', 'l', 'd'])\n['h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd']\n>>> s\n['h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd']\n\n-- Function: operator.iadd (a, b)\n-- Function: operator.iadd (a, b)\n\n'a = iadd(a, b)' is equivalent to 'a += b'.\n\n-- Function: operator.iand (a, b)\n-- Function: operator.iand (a, b)\n\n'a = iand(a, b)' is equivalent to 'a &= b'.\n\n-- Function: operator.iconcat (a, b)\n-- Function: operator.iconcat (a, b)\n\n'a = iconcat(a, b)' is equivalent to 'a += b' for 'a' and 'b'\nsequences.\n\n-- Function: operator.ifloordiv (a, b)\n-- Function: operator.ifloordiv (a, b)\n\n'a = ifloordiv(a, b)' is equivalent to 'a //= b'.\n\n-- Function: operator.ilshift (a, b)\n-- Function: operator.ilshift (a, b)\n\n'a = ilshift(a, b)' is equivalent to 'a <<= b'.\n\n-- Function: operator.imod (a, b)\n-- Function: operator.imod (a, b)\n\n'a = imod(a, b)' is equivalent to 'a %= b'.\n\n-- Function: operator.imul (a, b)\n-- Function: operator.imul (a, b)\n\n'a = imul(a, b)' is equivalent to 'a *= b'.\n\n-- Function: operator.imatmul (a, b)\n-- Function: operator.imatmul (a, b)\n\n'a = imatmul(a, b)' is equivalent to 'a @= b'.\n\nNew in version 3.5.\n\n-- Function: operator.ior (a, b)\n-- Function: operator.ior (a, b)\n\n'a = ior(a, b)' is equivalent to 'a |= b'.\n\n-- Function: operator.ipow (a, b)\n-- Function: operator.ipow (a, b)\n\n'a = ipow(a, b)' is equivalent to 'a = b'.\n\n-- Function: operator.irshift (a, b)\n-- Function: operator.irshift (a, b)\n\n'a = irshift(a, b)' is equivalent to 'a >>= b'.\n\n-- Function: operator.isub (a, b)\n-- Function: operator.isub (a, b)\n\n'a = isub(a, b)' is equivalent to 'a -= b'.\n\n-- Function: operator.itruediv (a, b)\n-- Function: operator.itruediv (a, b)\n\n'a = itruediv(a, b)' is equivalent to 'a /= b'.\n\n-- Function: operator.ixor (a, b)\n-- Function: operator.ixor (a, b)\n\n'a = ixor(a, b)' is equivalent to 'a ^= b'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: File and Directory Access,  Next: Data Persistence,  Prev: Functional Programming Modules,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.11 File and Directory Access",
                    "content": ""
                }
            ]
        },
        "The modules described in this chapter deal with disk files and": {
            "content": "directories.  For example, there are modules for reading the properties\nof files, manipulating paths in a portable way, and creating temporary\nfiles.  The full list of modules in this chapter is:\n\n* Menu:\n\n* pathlib -- Object-oriented filesystem paths::\n* os.path -- Common pathname manipulations: os path -- Common pathname manipulations.\n* fileinput -- Iterate over lines from multiple input streams::\n* stat -- Interpreting stat() results: stat -- Interpreting stat results.\n* filecmp -- File and Directory Comparisons::\n* tempfile -- Generate temporary files and directories::\n* glob -- Unix style pathname pattern expansion::\n* fnmatch -- Unix filename pattern matching::\n* linecache -- Random access to text lines::\n* shutil -- High-level file operations::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: pathlib -- Object-oriented filesystem paths,  Next: os path -- Common pathname manipulations,  Up: File and Directory Access": {
            "content": "New in version 3.4.\n\n'Source code:' Lib/pathlib.py(1)\n\n\n",
            "subsections": []
        },
        "This module offers classes representing filesystem paths with semantics": {
            "content": "appropriate for different operating systems.  Path classes are divided\nbetween *note pure paths: 249e, which provide purely computational\noperations without I/O, and *note concrete paths: 249f, which inherit\nfrom pure paths but also provide I/O operations.\n\n\n\n",
            "subsections": []
        },
        "If you've never used this module before or just aren't sure which class": {
            "content": "is right for your task, *note Path: 149. is most likely what you need.\nIt instantiates a *note concrete path: 249f. for the platform the code\nis running on.\n\nPure paths are useful in some special cases; for example:\n\n1. If you want to manipulate Windows paths on a Unix machine (or vice\nversa).  You cannot instantiate a *note WindowsPath: 24a0. when\nrunning on Unix, but you can instantiate *note PureWindowsPath:\n1452.\n\n2. You want to make sure that your code only manipulates paths without\nactually accessing the OS. In this case, instantiating one of the\npure classes may be useful since those simply don't have any\nOS-accessing operations.\n\nSee also\n........\n\nPEP 428(2): The pathlib module - object-oriented filesystem paths.\n\nSee also\n........\n\nFor low-level path manipulation on strings, you can also use the *note\nos.path: 9d. module.\n\n* Menu:\n\n* Basic use::\n* Pure paths::\n* Concrete paths::\n* Correspondence to tools in the os module::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/pathlib.py\n\n(2) https://peps.python.org/pep-0428/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Basic use,  Next: Pure paths,  Up: pathlib -- Object-oriented filesystem paths": {
            "content": "5.11.1.1 Basic use\n..................\n\nImporting the main class:\n\n>>> from pathlib import Path\n\nListing subdirectories:\n\n>>> p = Path('.')\n>>> [x for x in p.iterdir() if x.isdir()]\n[PosixPath('.hg'), PosixPath('docs'), PosixPath('dist'),\nPosixPath('pycache'), PosixPath('build')]\n\nListing Python source files in this directory tree:\n\n>>> list(p.glob('/*.py'))\n[PosixPath('testpathlib.py'), PosixPath('setup.py'),\nPosixPath('pathlib.py'), PosixPath('docs/conf.py'),\nPosixPath('build/lib/pathlib.py')]\n\nNavigating inside a directory tree:\n\n>>> p = Path('/etc')\n>>> q = p / 'init.d' / 'reboot'\n>>> q\nPosixPath('/etc/init.d/reboot')\n>>> q.resolve()\nPosixPath('/etc/rc.d/init.d/halt')\n\nQuerying path properties:\n\n>>> q.exists()\nTrue\n>>> q.isdir()\nFalse\n\nOpening a file:\n\n>>> with q.open() as f: f.readline()\n...\n'#!/bin/bash\\n'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Pure paths,  Next: Concrete paths,  Prev: Basic use,  Up: pathlib -- Object-oriented filesystem paths": {
            "content": "5.11.1.2 Pure paths\n...................\n",
            "subsections": []
        },
        "Pure path objects provide path-handling operations which don't actually": {
            "content": "access a filesystem.  There are three ways to access these classes,\nwhich we also call 'flavours':\n\n-- Class: pathlib.PurePath (*pathsegments)\n\nA generic class that represents the system's path flavour\n(instantiating it creates either a *note PurePosixPath: 24a3. or a\n*note PureWindowsPath: 1452.):\n\n>>> PurePath('setup.py')      # Running on a Unix machine\nPurePosixPath('setup.py')\n\nEach element of 'pathsegments' can be either a string representing\na path segment, or an object implementing the *note os.PathLike:\na9a. interface where the *note fspath(): a9b. method returns a\nstring, such as another path object:\n\n>>> PurePath('foo', 'some/path', 'bar')\nPurePosixPath('foo/some/path/bar')\n>>> PurePath(Path('foo'), Path('bar'))\nPurePosixPath('foo/bar')\n\nWhen 'pathsegments' is empty, the current directory is assumed:\n\n>>> PurePath()\nPurePosixPath('.')\n\nIf a segment is an absolute path, all previous segments are ignored\n(like *note os.path.join(): 1474.):\n\n>>> PurePath('/etc', '/usr', 'lib64')\nPurePosixPath('/usr/lib64')\n>>> PureWindowsPath('c:/Windows', 'd:bar')\nPureWindowsPath('d:bar')\n\nOn Windows, the drive is not reset when a rooted relative path\nsegment (e.g., 'r'\\foo'') is encountered:\n\n>>> PureWindowsPath('c:/Windows', '/Program Files')\nPureWindowsPath('c:/Program Files')\n\nSpurious slashes and single dots are collapsed, but double dots\n(''..'') and leading double slashes (''//'') are not, since this\nwould change the meaning of a path for various reasons (e.g.\nsymbolic links, UNC paths):\n\n>>> PurePath('foo//bar')\nPurePosixPath('foo/bar')\n>>> PurePath('//foo/bar')\nPurePosixPath('//foo/bar')\n>>> PurePath('foo/./bar')\nPurePosixPath('foo/bar')\n>>> PurePath('foo/../bar')\nPurePosixPath('foo/../bar')\n\n(a na??ve approach would make 'PurePosixPath('foo/../bar')'\nequivalent to 'PurePosixPath('bar')', which is wrong if 'foo' is a\nsymbolic link to another directory)\n\nPure path objects implement the *note os.PathLike: a9a. interface,\nallowing them to be used anywhere the interface is accepted.\n\nChanged in version 3.6: Added support for the *note os.PathLike:\na9a. interface.\n\n-- Class: pathlib.PurePosixPath (*pathsegments)\n\nA subclass of *note PurePath: 1c5, this path flavour represents\nnon-Windows filesystem paths:\n\n>>> PurePosixPath('/etc')\nPurePosixPath('/etc')\n\n'pathsegments' is specified similarly to *note PurePath: 1c5.\n\n-- Class: pathlib.PureWindowsPath (*pathsegments)\n\nA subclass of *note PurePath: 1c5, this path flavour represents\nWindows filesystem paths, including UNC paths(1):\n\n>>> PureWindowsPath('c:/Program Files/')\nPureWindowsPath('c:/Program Files')\n>>> PureWindowsPath('//server/share/file')\nPureWindowsPath('//server/share/file')\n\n'pathsegments' is specified similarly to *note PurePath: 1c5.\n",
            "subsections": []
        },
        "Regardless of the system you're running on, you can instantiate all of": {
            "content": "these classes, since they don't provide any operation that does system\ncalls.\n\n* Menu:\n\n* General properties::\n* Operators: Operators<2>.\n* Accessing individual parts::\n* Methods and properties::\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Path(computing)#UNC\n\nFile: python3.12.info,  Node: General properties,  Next: Operators<2>,  Up: Pure paths\n\n5.11.1.3 General properties\n...........................\n\nPaths are immutable and *note hashable: 3db.  Paths of a same flavour\nare comparable and orderable.  These properties respect the flavour's\ncase-folding semantics:\n\n>>> PurePosixPath('foo') == PurePosixPath('FOO')\nFalse\n>>> PureWindowsPath('foo') == PureWindowsPath('FOO')\nTrue\n>>> PureWindowsPath('FOO') in { PureWindowsPath('foo') }\nTrue\n>>> PureWindowsPath('C:') < PureWindowsPath('d:')\nTrue\n\nPaths of a different flavour compare unequal and cannot be ordered:\n\n>>> PureWindowsPath('foo') == PurePosixPath('foo')\nFalse\n>>> PureWindowsPath('foo') < PurePosixPath('foo')\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nTypeError: '<' not supported between instances of 'PureWindowsPath' and 'PurePosixPath'\n\nFile: python3.12.info,  Node: Operators<2>,  Next: Accessing individual parts,  Prev: General properties,  Up: Pure paths\n\n5.11.1.4 Operators\n..................\n\nThe slash operator helps create child paths, like *note os.path.join():\n1474.  If the argument is an absolute path, the previous path is\nignored.  On Windows, the drive is not reset when the argument is a\nrooted relative path (e.g., 'r'\\foo''):\n\n>>> p = PurePath('/etc')\n>>> p\nPurePosixPath('/etc')\n>>> p / 'init.d' / 'apache2'\nPurePosixPath('/etc/init.d/apache2')\n>>> q = PurePath('bin')\n>>> '/usr' / q\nPurePosixPath('/usr/bin')\n>>> p / '/anabsolutepath'\nPurePosixPath('/anabsolutepath')\n>>> PureWindowsPath('c:/Windows', '/Program Files')\nPureWindowsPath('c:/Program Files')\n\nA path object can be used anywhere an object implementing *note\nos.PathLike: a9a. is accepted:\n\n>>> import os\n>>> p = PurePath('/etc')\n>>> os.fspath(p)\n'/etc'\n",
            "subsections": []
        },
        "The string representation of a path is the raw filesystem path itself": {
            "content": "(in native form, e.g.  with backslashes under Windows), which you can\npass to any function taking a file path as a string:\n\n>>> p = PurePath('/etc')\n>>> str(p)\n'/etc'\n>>> p = PureWindowsPath('c:/Program Files')\n>>> str(p)\n'c:\\\\Program Files'\n\nSimilarly, calling *note bytes: 295. on a path gives the raw filesystem\npath as a bytes object, as encoded by *note os.fsencode(): a9e.:\n\n>>> bytes(p)\nb'/etc'\n\nNote: Calling *note bytes: 295. is only recommended under Unix.\nUnder Windows, the unicode form is the canonical representation of\nfilesystem paths.\n\nFile: python3.12.info,  Node: Accessing individual parts,  Next: Methods and properties,  Prev: Operators<2>,  Up: Pure paths\n\n5.11.1.5 Accessing individual parts\n...................................\n\nTo access the individual \"parts\" (components) of a path, use the\nfollowing property:\n\n-- Attribute: PurePath.parts\n\nA tuple giving access to the path's various components:\n\n>>> p = PurePath('/usr/bin/python3')\n>>> p.parts\n('/', 'usr', 'bin', 'python3')\n\n>>> p = PureWindowsPath('c:/Program Files/PSF')\n>>> p.parts\n('c:\\\\', 'Program Files', 'PSF')\n\n(note how the drive and local root are regrouped in a single part)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Methods and properties,  Prev: Accessing individual parts,  Up: Pure paths": {
            "content": "5.11.1.6 Methods and properties\n...............................\n\nPure paths provide the following methods and properties:\n\n-- Attribute: PurePath.drive\n\nA string representing the drive letter or name, if any:\n\n>>> PureWindowsPath('c:/Program Files/').drive\n'c:'\n>>> PureWindowsPath('/Program Files/').drive\n''\n>>> PurePosixPath('/etc').drive\n''\n\nUNC shares are also considered drives:\n\n>>> PureWindowsPath('//host/share/foo.txt').drive\n'\\\\\\\\host\\\\share'\n\n-- Attribute: PurePath.root\n\nA string representing the (local or global) root, if any:\n\n>>> PureWindowsPath('c:/Program Files/').root\n'\\\\'\n>>> PureWindowsPath('c:Program Files/').root\n''\n>>> PurePosixPath('/etc').root\n'/'\n\nUNC shares always have a root:\n\n>>> PureWindowsPath('//host/share').root\n'\\\\'\n\nIf the path starts with more than two successive slashes, *note\nPurePosixPath: 24a3. collapses them:\n\n>>> PurePosixPath('//etc').root\n'//'\n>>> PurePosixPath('///etc').root\n'/'\n>>> PurePosixPath('////etc').root\n'/'\n\nNote: This behavior conforms to 'The Open Group Base\nSpecifications Issue 6', paragraph 4.11 Pathname\nResolution(1):\n\n'\"A pathname that begins with two successive slashes may be\ninterpreted in an implementation-defined manner, although more\nthan two leading slashes shall be treated as a single slash.\"'\n\n-- Attribute: PurePath.anchor\n\nThe concatenation of the drive and root:\n\n>>> PureWindowsPath('c:/Program Files/').anchor\n'c:\\\\'\n>>> PureWindowsPath('c:Program Files/').anchor\n'c:'\n>>> PurePosixPath('/etc').anchor\n'/'\n>>> PureWindowsPath('//host/share').anchor\n'\\\\\\\\host\\\\share\\\\'\n\n-- Attribute: PurePath.parents\n\nAn immutable sequence providing access to the logical ancestors of\nthe path:\n\n>>> p = PureWindowsPath('c:/foo/bar/setup.py')\n>>> p.parents[0]\nPureWindowsPath('c:/foo/bar')\n>>> p.parents[1]\nPureWindowsPath('c:/foo')\n>>> p.parents[2]\nPureWindowsPath('c:/')\n\nChanged in version 3.10: The parents sequence now supports *note\nslices: 1e88. and negative index values.\n\n-- Attribute: PurePath.parent\n\nThe logical parent of the path:\n\n>>> p = PurePosixPath('/a/b/c/d')\n>>> p.parent\nPurePosixPath('/a/b/c')\n\nYou cannot go past an anchor, or empty path:\n\n>>> p = PurePosixPath('/')\n>>> p.parent\nPurePosixPath('/')\n>>> p = PurePosixPath('.')\n>>> p.parent\nPurePosixPath('.')\n\nNote: This is a purely lexical operation, hence the following\nbehaviour:\n\n>>> p = PurePosixPath('foo/..')\n>>> p.parent\nPurePosixPath('foo')\n\nIf you want to walk an arbitrary filesystem path upwards, it\nis recommended to first call *note Path.resolve(): 24ac. so as\nto resolve symlinks and eliminate '\"..\"' components.\n\n-- Attribute: PurePath.name\n\nA string representing the final path component, excluding the drive\nand root, if any:\n\n>>> PurePosixPath('my/library/setup.py').name\n'setup.py'\n\nUNC drive names are not considered:\n\n>>> PureWindowsPath('//some/share/setup.py').name\n'setup.py'\n>>> PureWindowsPath('//some/share').name\n''\n\n-- Attribute: PurePath.suffix\n\nThe file extension of the final component, if any:\n\n>>> PurePosixPath('my/library/setup.py').suffix\n'.py'\n>>> PurePosixPath('my/library.tar.gz').suffix\n'.gz'\n>>> PurePosixPath('my/library').suffix\n''\n\n-- Attribute: PurePath.suffixes\n\nA list of the path's file extensions:\n\n>>> PurePosixPath('my/library.tar.gar').suffixes\n['.tar', '.gar']\n>>> PurePosixPath('my/library.tar.gz').suffixes\n['.tar', '.gz']\n>>> PurePosixPath('my/library').suffixes\n[]\n\n-- Attribute: PurePath.stem\n\nThe final path component, without its suffix:\n\n>>> PurePosixPath('my/library.tar.gz').stem\n'library.tar'\n>>> PurePosixPath('my/library.tar').stem\n'library'\n>>> PurePosixPath('my/library').stem\n'library'\n\n-- Method: PurePath.asposix ()\n\nReturn a string representation of the path with forward slashes\n('/'):\n\n>>> p = PureWindowsPath('c:\\\\windows')\n>>> str(p)\n'c:\\\\windows'\n>>> p.asposix()\n'c:/windows'\n\n-- Method: PurePath.asuri ()\n\nRepresent the path as a 'file' URI. *note ValueError: 183. is\nraised if the path isn't absolute.\n\n>>> p = PurePosixPath('/etc/passwd')\n>>> p.asuri()\n'file:///etc/passwd'\n>>> p = PureWindowsPath('c:/Windows')\n>>> p.asuri()\n'file:///c:/Windows'\n\n-- Method: PurePath.isabsolute ()\n\nReturn whether the path is absolute or not.  A path is considered\nabsolute if it has both a root and (if the flavour allows) a drive:\n\n>>> PurePosixPath('/a/b').isabsolute()\nTrue\n>>> PurePosixPath('a/b').isabsolute()\nFalse\n\n>>> PureWindowsPath('c:/a/b').isabsolute()\nTrue\n>>> PureWindowsPath('/a/b').isabsolute()\nFalse\n>>> PureWindowsPath('c:').isabsolute()\nFalse\n>>> PureWindowsPath('//some/share').isabsolute()\nTrue\n\n-- Method: PurePath.isrelativeto (other)\n\nReturn whether or not this path is relative to the 'other' path.\n\n>>> p = PurePath('/etc/passwd')\n>>> p.isrelativeto('/etc')\nTrue\n>>> p.isrelativeto('/usr')\nFalse\n\nThis method is string-based; it neither accesses the filesystem nor\ntreats \"'..'\" segments specially.  The following code is\nequivalent:\n\n>>> u = PurePath('/usr')\n>>> u == p or u in p.parents\nFalse\n\nNew in version 3.9.\n\nDeprecated since version 3.12, will be removed in version 3.14:\nPassing additional arguments is deprecated; if supplied, they are\njoined with 'other'.\n\n-- Method: PurePath.isreserved ()\n\nWith *note PureWindowsPath: 1452, return 'True' if the path is\nconsidered reserved under Windows, 'False' otherwise.  With *note\nPurePosixPath: 24a3, 'False' is always returned.\n\n>>> PureWindowsPath('nul').isreserved()\nTrue\n>>> PurePosixPath('nul').isreserved()\nFalse\n\nFile system calls on reserved paths can fail mysteriously or have\nunintended effects.\n\n-- Method: PurePath.joinpath (*pathsegments)\n\nCalling this method is equivalent to combining the path with each\nof the given 'pathsegments' in turn:\n\n>>> PurePosixPath('/etc').joinpath('passwd')\nPurePosixPath('/etc/passwd')\n>>> PurePosixPath('/etc').joinpath(PurePosixPath('passwd'))\nPurePosixPath('/etc/passwd')\n>>> PurePosixPath('/etc').joinpath('init.d', 'apache2')\nPurePosixPath('/etc/init.d/apache2')\n>>> PureWindowsPath('c:').joinpath('/Program Files')\nPureWindowsPath('c:/Program Files')\n\n-- Method: PurePath.match (pattern, *, casesensitive=None)\n\nMatch this path against the provided glob-style pattern.  Return\n'True' if matching is successful, 'False' otherwise.\n\nIf 'pattern' is relative, the path can be either relative or\nabsolute, and matching is done from the right:\n\n>>> PurePath('a/b.py').match('*.py')\nTrue\n>>> PurePath('/a/b/c.py').match('b/*.py')\nTrue\n>>> PurePath('/a/b/c.py').match('a/*.py')\nFalse\n\nIf 'pattern' is absolute, the path must be absolute, and the whole\npath must match:\n\n>>> PurePath('/a.py').match('/*.py')\nTrue\n>>> PurePath('a/b.py').match('/*.py')\nFalse\n\nThe 'pattern' may be another path object; this speeds up matching\nthe same pattern against multiple files:\n\n>>> pattern = PurePath('*.py')\n>>> PurePath('a/b.py').match(pattern)\nTrue\n\nChanged in version 3.12: Accepts an object implementing the *note\nos.PathLike: a9a. interface.\n\nAs with other methods, case-sensitivity follows platform defaults:\n\n>>> PurePosixPath('b.py').match('*.PY')\nFalse\n>>> PureWindowsPath('b.py').match('*.PY')\nTrue\n\nSet 'casesensitive' to 'True' or 'False' to override this\nbehaviour.\n\nChanged in version 3.12: The 'casesensitive' parameter was added.\n\n-- Method: PurePath.relativeto (other, walkup=False)\n\nCompute a version of this path relative to the path represented by\n'other'.  If it's impossible, *note ValueError: 183. is raised:\n\n>>> p = PurePosixPath('/etc/passwd')\n>>> p.relativeto('/')\nPurePosixPath('etc/passwd')\n>>> p.relativeto('/etc')\nPurePosixPath('passwd')\n>>> p.relativeto('/usr')\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nFile \"pathlib.py\", line 941, in relativeto\nraise ValueError(errormessage.format(str(self), str(formatted)))\nValueError: '/etc/passwd' is not in the subpath of '/usr' OR one path is relative and the other is absolute.\n\nWhen 'walkup' is False (the default), the path must start with\n'other'.  When the argument is True, '..' entries may be added to\nform the relative path.  In all other cases, such as the paths\nreferencing different drives, *note ValueError: 183. is raised.:\n\n>>> p.relativeto('/usr', walkup=True)\nPurePosixPath('../etc/passwd')\n>>> p.relativeto('foo', walkup=True)\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nFile \"pathlib.py\", line 941, in relativeto\nraise ValueError(errormessage.format(str(self), str(formatted)))\nValueError: '/etc/passwd' is not on the same drive as 'foo' OR one path is relative and the other is absolute.\n\nWarning: This function is part of *note PurePath: 1c5. and\nworks with strings.  It does not check or access the\nunderlying file structure.  This can impact the 'walkup'\noption as it assumes that no symlinks are present in the path;\ncall *note resolve(): 24ac. first if necessary to resolve\nsymlinks.\n\nChanged in version 3.12: The 'walkup' parameter was added (old\nbehavior is the same as 'walkup=False').\n\nDeprecated since version 3.12, will be removed in version 3.14:\nPassing additional positional arguments is deprecated; if supplied,\nthey are joined with 'other'.\n\n-- Method: PurePath.withname (name)\n\nReturn a new path with the *note name: 24ad. changed.  If the\noriginal path doesn't have a name, ValueError is raised:\n\n>>> p = PureWindowsPath('c:/Downloads/pathlib.tar.gz')\n>>> p.withname('setup.py')\nPureWindowsPath('c:/Downloads/setup.py')\n>>> p = PureWindowsPath('c:/')\n>>> p.withname('setup.py')\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nFile \"/home/antoine/cpython/default/Lib/pathlib.py\", line 751, in withname\nraise ValueError(\"%r has an empty name\" % (self,))\nValueError: PureWindowsPath('c:/') has an empty name\n\n-- Method: PurePath.withstem (stem)\n\nReturn a new path with the *note stem: 24b0. changed.  If the\noriginal path doesn't have a name, ValueError is raised:\n\n>>> p = PureWindowsPath('c:/Downloads/draft.txt')\n>>> p.withstem('final')\nPureWindowsPath('c:/Downloads/final.txt')\n>>> p = PureWindowsPath('c:/Downloads/pathlib.tar.gz')\n>>> p.withstem('lib')\nPureWindowsPath('c:/Downloads/lib.gz')\n>>> p = PureWindowsPath('c:/')\n>>> p.withstem('')\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nFile \"/home/antoine/cpython/default/Lib/pathlib.py\", line 861, in withstem\nreturn self.withname(stem + self.suffix)\nFile \"/home/antoine/cpython/default/Lib/pathlib.py\", line 851, in withname\nraise ValueError(\"%r has an empty name\" % (self,))\nValueError: PureWindowsPath('c:/') has an empty name\n\nNew in version 3.9.\n\n-- Method: PurePath.withsuffix (suffix)\n\nReturn a new path with the *note suffix: 24ae. changed.  If the\noriginal path doesn't have a suffix, the new 'suffix' is appended\ninstead.  If the 'suffix' is an empty string, the original suffix\nis removed:\n\n>>> p = PureWindowsPath('c:/Downloads/pathlib.tar.gz')\n>>> p.withsuffix('.bz2')\nPureWindowsPath('c:/Downloads/pathlib.tar.bz2')\n>>> p = PureWindowsPath('README')\n>>> p.withsuffix('.txt')\nPureWindowsPath('README.txt')\n>>> p = PureWindowsPath('README.txt')\n>>> p.withsuffix('')\nPureWindowsPath('README')\n\n-- Method: PurePath.withsegments (*pathsegments)\n\nCreate a new path object of the same type by combining the given\n'pathsegments'.  This method is called whenever a derivative path\nis created, such as from *note parent: 1473. and *note\nrelativeto(): 1c9.  Subclasses may override this method to pass\ninformation to derivative paths, for example:\n\nfrom pathlib import PurePosixPath\n\nclass MyPath(PurePosixPath):\ndef init(self, *pathsegments, sessionid):\nsuper().init(*pathsegments)\nself.sessionid = sessionid\n\ndef withsegments(self, *pathsegments):\nreturn type(self)(*pathsegments, sessionid=self.sessionid)\n\netc = MyPath('/etc', sessionid=42)\nhosts = etc / 'hosts'\nprint(hosts.sessionid)  # 42\n\nNew in version 3.12.\n\n---------- Footnotes ----------\n\n(1)\nhttps://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbdchap04.html#tag0411\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Concrete paths,  Next: Correspondence to tools in the os module,  Prev: Pure paths,  Up: pathlib -- Object-oriented filesystem paths": {
            "content": "5.11.1.7 Concrete paths\n.......................\n",
            "subsections": []
        },
        "Concrete paths are subclasses of the pure path classes.  In addition to": {
            "content": "operations provided by the latter, they also provide methods to do\nsystem calls on path objects.  There are three ways to instantiate\nconcrete paths:\n\n-- Class: pathlib.Path (*pathsegments)\n\nA subclass of *note PurePath: 1c5, this class represents concrete\npaths of the system's path flavour (instantiating it creates either\na *note PosixPath: 24b7. or a *note WindowsPath: 24a0.):\n\n>>> Path('setup.py')\nPosixPath('setup.py')\n\n'pathsegments' is specified similarly to *note PurePath: 1c5.\n\n-- Class: pathlib.PosixPath (*pathsegments)\n\nA subclass of *note Path: 149. and *note PurePosixPath: 24a3, this\nclass represents concrete non-Windows filesystem paths:\n\n>>> PosixPath('/etc')\nPosixPath('/etc')\n\n'pathsegments' is specified similarly to *note PurePath: 1c5.\n\n-- Class: pathlib.WindowsPath (*pathsegments)\n\nA subclass of *note Path: 149. and *note PureWindowsPath: 1452,\nthis class represents concrete Windows filesystem paths:\n\n>>> WindowsPath('c:/Program Files/')\nWindowsPath('c:/Program Files')\n\n'pathsegments' is specified similarly to *note PurePath: 1c5.\n",
            "subsections": []
        },
        "You can only instantiate the class flavour that corresponds to your": {
            "content": "system (allowing system calls on non-compatible path flavours could lead\nto bugs or failures in your application):\n\n>>> import os\n>>> os.name\n'posix'\n>>> Path('setup.py')\nPosixPath('setup.py')\n>>> PosixPath('setup.py')\nPosixPath('setup.py')\n>>> WindowsPath('setup.py')\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nFile \"pathlib.py\", line 798, in new\n% (cls.name,))\nNotImplementedError: cannot instantiate 'WindowsPath' on your system\n\n* Menu:\n\n* Methods: Methods<2>.\n\nFile: python3.12.info,  Node: Methods<2>,  Up: Concrete paths\n\n5.11.1.8 Methods\n................\n",
            "subsections": []
        },
        "Concrete paths provide the following methods in addition to pure paths": {
            "content": "methods.  Many of these methods can raise an *note OSError: 613. if a\nsystem call fails (for example because the path doesn't exist).\n\nChanged in version 3.8: *note exists(): 83f, *note isdir(): 840, *note\nisfile(): 841, *note ismount(): 842, *note issymlink(): 843, *note\nisblockdevice(): 844, *note ischardevice(): 845, *note isfifo():\n846, *note issocket(): 847. now return 'False' instead of raising an\nexception for paths that contain characters unrepresentable at the OS\nlevel.\n\n-- Method: classmethod Path.cwd ()\n\nReturn a new path object representing the current directory (as\nreturned by *note os.getcwd(): 1779.):\n\n>>> Path.cwd()\nPosixPath('/home/antoine/pathlib')\n\n-- Method: classmethod Path.home ()\n\nReturn a new path object representing the user's home directory (as\nreturned by *note os.path.expanduser(): 83d. with '~' construct).\nIf the home directory can't be resolved, *note RuntimeError: 17a.\nis raised.\n\n>>> Path.home()\nPosixPath('/home/antoine')\n\nNew in version 3.5.\n\n-- Method: Path.stat (*, followsymlinks=True)\n\nReturn a *note os.statresult: 1318. object containing information\nabout this path, like *note os.stat(): 1bf.  The result is looked\nup at each call to this method.\n\nThis method normally follows symlinks; to stat a symlink add the\nargument 'followsymlinks=False', or use *note lstat(): 24b9.\n\n>>> p = Path('setup.py')\n>>> p.stat().stsize\n956\n>>> p.stat().stmtime\n1327883547.852554\n\nChanged in version 3.10: The 'followsymlinks' parameter was added.\n\n-- Method: Path.chmod (mode, *, followsymlinks=True)\n\nChange the file mode and permissions, like *note os.chmod(): f5d.\n\nThis method normally follows symlinks.  Some Unix flavours support\nchanging permissions on the symlink itself; on these platforms you\nmay add the argument 'followsymlinks=False', or use *note\nlchmod(): 24ba.\n\n>>> p = Path('setup.py')\n>>> p.stat().stmode\n33277\n>>> p.chmod(0o444)\n>>> p.stat().stmode\n33060\n\nChanged in version 3.10: The 'followsymlinks' parameter was added.\n\n-- Method: Path.exists (*, followsymlinks=True)\n\nReturn 'True' if the path points to an existing file or directory.\n\nThis method normally follows symlinks; to check if a symlink\nexists, add the argument 'followsymlinks=False'.\n\n>>> Path('.').exists()\nTrue\n>>> Path('setup.py').exists()\nTrue\n>>> Path('/etc').exists()\nTrue\n>>> Path('nonexistentfile').exists()\nFalse\n\nChanged in version 3.12: The 'followsymlinks' parameter was added.\n\n-- Method: Path.expanduser ()\n\nReturn a new path with expanded '~' and '~user' constructs, as\nreturned by *note os.path.expanduser(): 83d.  If a home directory\ncan't be resolved, *note RuntimeError: 17a. is raised.\n\n>>> p = PosixPath('~/films/Monty Python')\n>>> p.expanduser()\nPosixPath('/home/eric/films/Monty Python')\n\nNew in version 3.5.\n\n-- Method: Path.glob (pattern, *, casesensitive=None)\n\nGlob the given relative 'pattern' in the directory represented by\nthis path, yielding all matching files (of any kind):\n\n>>> sorted(Path('.').glob('*.py'))\n[PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('testpathlib.py')]\n>>> sorted(Path('.').glob('*/*.py'))\n[PosixPath('docs/conf.py')]\n\nPatterns are the same as for *note fnmatch: 57, with the addition\nof \"''\" which means \"this directory and all subdirectories,\nrecursively\".  In other words, it enables recursive globbing:\n\n>>> sorted(Path('.').glob('/*.py'))\n[PosixPath('build/lib/pathlib.py'),\nPosixPath('docs/conf.py'),\nPosixPath('pathlib.py'),\nPosixPath('setup.py'),\nPosixPath('testpathlib.py')]\n\nThis method calls *note Path.isdir(): 840. on the top-level\ndirectory and propagates any *note OSError: 613. exception that is\nraised.  Subsequent *note OSError: 613. exceptions from scanning\ndirectories are suppressed.\n\nBy default, or when the 'casesensitive' keyword-only argument is\nset to 'None', this method matches paths using platform-specific\ncasing rules: typically, case-sensitive on POSIX, and\ncase-insensitive on Windows.  Set 'casesensitive' to 'True' or\n'False' to override this behaviour.\n\nNote: Using the \"''\" pattern in large directory trees may\nconsume an inordinate amount of time.\n\nRaises an *note auditing event: 161d. 'pathlib.Path.glob' with\narguments 'self', 'pattern'.\n\nChanged in version 3.11: Return only directories if 'pattern' ends\nwith a pathname components separator (*note sep: 434. or *note\naltsep: 435.).\n\nChanged in version 3.12: The 'casesensitive' parameter was added.\n\n-- Method: Path.group ()\n\nReturn the name of the group owning the file.  *note KeyError: 8cf.\nis raised if the file's gid isn't found in the system database.\n\n-- Method: Path.isdir ()\n\nReturn 'True' if the path points to a directory (or a symbolic link\npointing to a directory), 'False' if it points to another kind of\nfile.\n\n'False' is also returned if the path doesn't exist or is a broken\nsymlink; other errors (such as permission errors) are propagated.\n\n-- Method: Path.isfile ()\n\nReturn 'True' if the path points to a regular file (or a symbolic\nlink pointing to a regular file), 'False' if it points to another\nkind of file.\n\n'False' is also returned if the path doesn't exist or is a broken\nsymlink; other errors (such as permission errors) are propagated.\n\n-- Method: Path.isjunction ()\n\nReturn 'True' if the path points to a junction, and 'False' for any\nother type of file.  Currently only Windows supports junctions.\n\nNew in version 3.12.\n\n-- Method: Path.ismount ()\n\nReturn 'True' if the path is a 'mount point': a point in a file\nsystem where a different file system has been mounted.  On POSIX,\nthe function checks whether 'path''s parent, 'path/..', is on a\ndifferent device than 'path', or whether 'path/..' and 'path' point\nto the same i-node on the same device -- this should detect mount\npoints for all Unix and POSIX variants.  On Windows, a mount point\nis considered to be a drive letter root (e.g.  'c:\\'), a UNC share\n(e.g.  '\\\\server\\share'), or a mounted filesystem directory.\n\nNew in version 3.7.\n\nChanged in version 3.12: Windows support was added.\n\n-- Method: Path.issymlink ()\n\nReturn 'True' if the path points to a symbolic link, 'False'\notherwise.\n\n'False' is also returned if the path doesn't exist; other errors\n(such as permission errors) are propagated.\n\n-- Method: Path.issocket ()\n\nReturn 'True' if the path points to a Unix socket (or a symbolic\nlink pointing to a Unix socket), 'False' if it points to another\nkind of file.\n\n'False' is also returned if the path doesn't exist or is a broken\nsymlink; other errors (such as permission errors) are propagated.\n\n-- Method: Path.isfifo ()\n\nReturn 'True' if the path points to a FIFO (or a symbolic link\npointing to a FIFO), 'False' if it points to another kind of file.\n\n'False' is also returned if the path doesn't exist or is a broken\nsymlink; other errors (such as permission errors) are propagated.\n\n-- Method: Path.isblockdevice ()\n\nReturn 'True' if the path points to a block device (or a symbolic\nlink pointing to a block device), 'False' if it points to another\nkind of file.\n\n'False' is also returned if the path doesn't exist or is a broken\nsymlink; other errors (such as permission errors) are propagated.\n\n-- Method: Path.ischardevice ()\n\nReturn 'True' if the path points to a character device (or a\nsymbolic link pointing to a character device), 'False' if it points\nto another kind of file.\n\n'False' is also returned if the path doesn't exist or is a broken\nsymlink; other errors (such as permission errors) are propagated.\n\n-- Method: Path.iterdir ()\n\nWhen the path points to a directory, yield path objects of the\ndirectory contents:\n\n>>> p = Path('docs')\n>>> for child in p.iterdir(): child\n...\nPosixPath('docs/conf.py')\nPosixPath('docs/templates')\nPosixPath('docs/make.bat')\nPosixPath('docs/index.rst')\nPosixPath('docs/build')\nPosixPath('docs/static')\nPosixPath('docs/Makefile')\n\nThe children are yielded in arbitrary order, and the special\nentries ''.'' and ''..'' are not included.  If a file is removed\nfrom or added to the directory after creating the iterator, whether\na path object for that file be included is unspecified.\n\n-- Method: Path.walk (topdown=True, onerror=None,\nfollowsymlinks=False)\n\nGenerate the file names in a directory tree by walking the tree\neither top-down or bottom-up.\n\nFor each directory in the directory tree rooted at 'self'\n(including 'self' but excluding '.' and '..'), the method yields a\n3-tuple of '(dirpath, dirnames, filenames)'.\n\n'dirpath' is a *note Path: 149. to the directory currently being\nwalked, 'dirnames' is a list of strings for the names of\nsubdirectories in 'dirpath' (excluding ''.'' and ''..''), and\n'filenames' is a list of strings for the names of the non-directory\nfiles in 'dirpath'.  To get a full path (which begins with 'self')\nto a file or directory in 'dirpath', do 'dirpath / name'.  Whether\nor not the lists are sorted is file system-dependent.\n\nIf the optional argument 'topdown' is true (which is the default),\nthe triple for a directory is generated before the triples for any\nof its subdirectories (directories are walked top-down).  If\n'topdown' is false, the triple for a directory is generated after\nthe triples for all of its subdirectories (directories are walked\nbottom-up).  No matter the value of 'topdown', the list of\nsubdirectories is retrieved before the triples for the directory\nand its subdirectories are walked.\n\nWhen 'topdown' is true, the caller can modify the 'dirnames' list\nin-place (for example, using *note del: 14fb. or slice assignment),\nand *note Path.walk(): 1c7. will only recurse into the\nsubdirectories whose names remain in 'dirnames'.  This can be used\nto prune the search, or to impose a specific order of visiting, or\neven to inform *note Path.walk(): 1c7. about directories the caller\ncreates or renames before it resumes *note Path.walk(): 1c7. again.\nModifying 'dirnames' when 'topdown' is false has no effect on the\nbehavior of *note Path.walk(): 1c7. since the directories in\n'dirnames' have already been generated by the time 'dirnames' is\nyielded to the caller.\n\nBy default, errors from *note os.scandir(): 88c. are ignored.  If\nthe optional argument 'onerror' is specified, it should be a\ncallable; it will be called with one argument, an *note OSError:\n613. instance.  The callable can handle the error to continue the\nwalk or re-raise it to stop the walk.  Note that the filename is\navailable as the 'filename' attribute of the exception object.\n\nBy default, *note Path.walk(): 1c7. does not follow symbolic links,\nand instead adds them to the 'filenames' list.  Set\n'followsymlinks' to true to resolve symlinks and place them in\n'dirnames' and 'filenames' as appropriate for their targets, and\nconsequently visit directories pointed to by symlinks (where\nsupported).\n\nNote: Be aware that setting 'followsymlinks' to true can lead\nto infinite recursion if a link points to a parent directory\nof itself.  *note Path.walk(): 1c7. does not keep track of the\ndirectories it has already visited.\n\nNote: *note Path.walk(): 1c7. assumes the directories it walks\nare not modified during execution.  For example, if a\ndirectory from 'dirnames' has been replaced with a symlink and\n'followsymlinks' is false, *note Path.walk(): 1c7. will still\ntry to descend into it.  To prevent such behavior, remove\ndirectories from 'dirnames' as appropriate.\n\nNote: Unlike *note os.walk(): 1c8, *note Path.walk(): 1c7.\nlists symlinks to directories in 'filenames' if\n'followsymlinks' is false.\n\nThis example displays the number of bytes used by all files in each\ndirectory, while ignoring 'pycache' directories:\n\nfrom pathlib import Path\nfor root, dirs, files in Path(\"cpython/Lib/concurrent\").walk(onerror=print):\nprint(\nroot,\n\"consumes\",\nsum((root / file).stat().stsize for file in files),\n\"bytes in\",\nlen(files),\n\"non-directory files\"\n)\nif 'pycache' in dirs:\ndirs.remove('pycache')\n\nThis next example is a simple implementation of *note\nshutil.rmtree(): 1d5.  Walking the tree bottom-up is essential as\n*note rmdir(): 24bc. doesn't allow deleting a directory before it\nis empty:\n\n# Delete everything reachable from the directory \"top\".\n# CAUTION:  This is dangerous! For example, if top == Path('/'),\n# it could delete all of your files.\nfor root, dirs, files in top.walk(topdown=False):\nfor name in files:\n(root / name).unlink()\nfor name in dirs:\n(root / name).rmdir()\n\nNew in version 3.12.\n\n-- Method: Path.lchmod (mode)\n\nLike *note Path.chmod(): 619. but, if the path points to a symbolic\nlink, the symbolic link's mode is changed rather than its target's.\n\n-- Method: Path.lstat ()\n\nLike *note Path.stat(): 618. but, if the path points to a symbolic\nlink, return the symbolic link's information rather than its\ntarget's.\n\n-- Method: Path.mkdir (mode=0o777, parents=False, existok=False)\n\nCreate a new directory at this given path.  If 'mode' is given, it\nis combined with the process' 'umask' value to determine the file\nmode and access flags.  If the path already exists, *note\nFileExistsError: e97. is raised.\n\nIf 'parents' is true, any missing parents of this path are created\nas needed; they are created with the default permissions without\ntaking 'mode' into account (mimicking the POSIX 'mkdir -p'\ncommand).\n\nIf 'parents' is false (the default), a missing parent raises *note\nFileNotFoundError: 353.\n\nIf 'existok' is false (the default), *note FileExistsError: e97.\nis raised if the target directory already exists.\n\nIf 'existok' is true, *note FileExistsError: e97. will not be\nraised unless the given path already exists in the file system and\nis not a directory (same behavior as the POSIX 'mkdir -p' command).\n\nChanged in version 3.5: The 'existok' parameter was added.\n\n-- Method: Path.open (mode='r', buffering=-1, encoding=None,\nerrors=None, newline=None)\n\nOpen the file pointed to by the path, like the built-in *note\nopen(): 26e. function does:\n\n>>> p = Path('setup.py')\n>>> with p.open() as f:\n...     f.readline()\n...\n'#!/usr/bin/env python3\\n'\n\n-- Method: Path.owner ()\n\nReturn the name of the user owning the file.  *note KeyError: 8cf.\nis raised if the file's uid isn't found in the system database.\n\n-- Method: Path.readbytes ()\n\nReturn the binary contents of the pointed-to file as a bytes\nobject:\n\n>>> p = Path('mybinaryfile')\n>>> p.writebytes(b'Binary file contents')\n20\n>>> p.readbytes()\nb'Binary file contents'\n\nNew in version 3.5.\n\n-- Method: Path.readtext (encoding=None, errors=None)\n\nReturn the decoded contents of the pointed-to file as a string:\n\n>>> p = Path('mytextfile')\n>>> p.writetext('Text file contents')\n18\n>>> p.readtext()\n'Text file contents'\n\nThe file is opened and then closed.  The optional parameters have\nthe same meaning as in *note open(): 26e.\n\nNew in version 3.5.\n\n-- Method: Path.readlink ()\n\nReturn the path to which the symbolic link points (as returned by\n*note os.readlink(): 73e.):\n\n>>> p = Path('mylink')\n>>> p.symlinkto('setup.py')\n>>> p.readlink()\nPosixPath('setup.py')\n\nNew in version 3.9.\n\n-- Method: Path.rename (target)\n\nRename this file or directory to the given 'target', and return a\nnew Path instance pointing to 'target'.  On Unix, if 'target'\nexists and is a file, it will be replaced silently if the user has\npermission.  On Windows, if 'target' exists, *note FileExistsError:\ne97. will be raised.  'target' can be either a string or another\npath object:\n\n>>> p = Path('foo')\n>>> p.open('w').write('some text')\n9\n>>> target = Path('bar')\n>>> p.rename(target)\nPosixPath('bar')\n>>> target.open().read()\n'some text'\n\nThe target path may be absolute or relative.  Relative paths are\ninterpreted relative to the current working directory, 'not' the\ndirectory of the Path object.\n\nIt is implemented in terms of *note os.rename(): f62. and gives the\nsame guarantees.\n\nChanged in version 3.8: Added return value, return the new Path\ninstance.\n\n-- Method: Path.replace (target)\n\nRename this file or directory to the given 'target', and return a\nnew Path instance pointing to 'target'.  If 'target' points to an\nexisting file or empty directory, it will be unconditionally\nreplaced.\n\nThe target path may be absolute or relative.  Relative paths are\ninterpreted relative to the current working directory, 'not' the\ndirectory of the Path object.\n\nChanged in version 3.8: Added return value, return the new Path\ninstance.\n\n-- Method: Path.absolute ()\n\nMake the path absolute, without normalization or resolving\nsymlinks.  Returns a new path object:\n\n>>> p = Path('tests')\n>>> p\nPosixPath('tests')\n>>> p.absolute()\nPosixPath('/home/antoine/pathlib/tests')\n\n-- Method: Path.resolve (strict=False)\n\nMake the path absolute, resolving any symlinks.  A new path object\nis returned:\n\n>>> p = Path()\n>>> p\nPosixPath('.')\n>>> p.resolve()\nPosixPath('/home/antoine/pathlib')\n\n\"'..'\" components are also eliminated (this is the only method to\ndo so):\n\n>>> p = Path('docs/../setup.py')\n>>> p.resolve()\nPosixPath('/home/antoine/pathlib/setup.py')\n\nIf the path doesn't exist and 'strict' is 'True', *note\nFileNotFoundError: 353. is raised.  If 'strict' is 'False', the\npath is resolved as far as possible and any remainder is appended\nwithout checking whether it exists.  If an infinite loop is\nencountered along the resolution path, *note RuntimeError: 17a. is\nraised.\n\nChanged in version 3.6: The 'strict' parameter was added (pre-3.6\nbehavior is strict).\n\n-- Method: Path.rglob (pattern, *, casesensitive=None)\n\nGlob the given relative 'pattern' recursively.  This is like\ncalling *note Path.glob(): 1cc. with \"'/'\" added in front of the\n'pattern', where 'patterns' are the same as for *note fnmatch: 57.:\n\n>>> sorted(Path().rglob(\"*.py\"))\n[PosixPath('build/lib/pathlib.py'),\nPosixPath('docs/conf.py'),\nPosixPath('pathlib.py'),\nPosixPath('setup.py'),\nPosixPath('testpathlib.py')]\n\nBy default, or when the 'casesensitive' keyword-only argument is\nset to 'None', this method matches paths using platform-specific\ncasing rules: typically, case-sensitive on POSIX, and\ncase-insensitive on Windows.  Set 'casesensitive' to 'True' or\n'False' to override this behaviour.\n\nRaises an *note auditing event: 161d. 'pathlib.Path.rglob' with\narguments 'self', 'pattern'.\n\nChanged in version 3.11: Return only directories if 'pattern' ends\nwith a pathname components separator (*note sep: 434. or *note\naltsep: 435.).\n\nChanged in version 3.12: The 'casesensitive' parameter was added.\n\n-- Method: Path.rmdir ()\n\nRemove this directory.  The directory must be empty.\n\n-- Method: Path.samefile (otherpath)\n\nReturn whether this path points to the same file as 'otherpath',\nwhich can be either a Path object, or a string.  The semantics are\nsimilar to *note os.path.samefile(): de1. and *note\nos.path.samestat(): de0.\n\nAn *note OSError: 613. can be raised if either file cannot be\naccessed for some reason.\n\n>>> p = Path('spam')\n>>> q = Path('eggs')\n>>> p.samefile(q)\nFalse\n>>> p.samefile('spam')\nTrue\n\nNew in version 3.5.\n\n-- Method: Path.symlinkto (target, targetisdirectory=False)\n\nMake this path a symbolic link pointing to 'target'.\n\nOn Windows, a symlink represents either a file or a directory, and\ndoes not morph to the target dynamically.  If the target is\npresent, the type of the symlink will be created to match.\nOtherwise, the symlink will be created as a directory if\n'targetisdirectory' is 'True' or a file symlink (the default)\notherwise.  On non-Windows platforms, 'targetisdirectory' is\nignored.\n\n>>> p = Path('mylink')\n>>> p.symlinkto('setup.py')\n>>> p.resolve()\nPosixPath('/home/antoine/pathlib/setup.py')\n>>> p.stat().stsize\n956\n>>> p.lstat().stsize\n8\n\nNote: The order of arguments (link, target) is the reverse of\n*note os.symlink(): f65.'s.\n\n-- Method: Path.hardlinkto (target)\n\nMake this path a hard link to the same file as 'target'.\n\nNote: The order of arguments (link, target) is the reverse of\n*note os.link(): f5f.'s.\n\nNew in version 3.10.\n\n-- Method: Path.touch (mode=0o666, existok=True)\n\nCreate a file at this given path.  If 'mode' is given, it is\ncombined with the process' 'umask' value to determine the file mode\nand access flags.  If the file already exists, the function\nsucceeds if 'existok' is true (and its modification time is\nupdated to the current time), otherwise *note FileExistsError: e97.\nis raised.\n\n-- Method: Path.unlink (missingok=False)\n\nRemove this file or symbolic link.  If the path points to a\ndirectory, use *note Path.rmdir(): 24bc. instead.\n\nIf 'missingok' is false (the default), *note FileNotFoundError:\n353. is raised if the path does not exist.\n\nIf 'missingok' is true, *note FileNotFoundError: 353. exceptions\nwill be ignored (same behavior as the POSIX 'rm -f' command).\n\nChanged in version 3.8: The 'missingok' parameter was added.\n\n-- Method: Path.writebytes (data)\n\nOpen the file pointed to in bytes mode, write 'data' to it, and\nclose the file:\n\n>>> p = Path('mybinaryfile')\n>>> p.writebytes(b'Binary file contents')\n20\n>>> p.readbytes()\nb'Binary file contents'\n\nAn existing file of the same name is overwritten.\n\nNew in version 3.5.\n\n-- Method: Path.writetext (data, encoding=None, errors=None,\nnewline=None)\n\nOpen the file pointed to in text mode, write 'data' to it, and\nclose the file:\n\n>>> p = Path('mytextfile')\n>>> p.writetext('Text file contents')\n18\n>>> p.readtext()\n'Text file contents'\n\nAn existing file of the same name is overwritten.  The optional\nparameters have the same meaning as in *note open(): 26e.\n\nNew in version 3.5.\n\nChanged in version 3.10: The 'newline' parameter was added.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Correspondence to tools in the os module,  Prev: Concrete paths,  Up: pathlib -- Object-oriented filesystem paths": {
            "content": "5.11.1.9 Correspondence to tools in the 'os' module\n...................................................\n\nBelow is a table mapping various *note os: 9c. functions to their\ncorresponding *note PurePath: 1c5./*note Path: 149. equivalent.\n\nNote: Not all pairs of functions/methods below are equivalent.\nSome of them, despite having some overlapping use-cases, have\ndifferent semantics.  They include *note os.path.abspath(): 1192.\nand *note Path.absolute(): 146f, *note os.path.relpath(): 1ca. and\n*note PurePath.relativeto(): 1c9.\n\n*note os: 9c. and *note os.path: 9d.     *note pathlib: 9f.\n\n-------------------------------------------------------------------------------\n\n*note os.path.abspath(): 1192.           *note Path.absolute(): 146f. (1)\n\n\n*note os.path.realpath(): 351.           *note Path.resolve(): 24ac.\n\n\n*note os.chmod(): f5d.                   *note Path.chmod(): 619.\n\n\n*note os.mkdir(): f60.                   *note Path.mkdir(): ca0.\n\n\n*note os.makedirs(): 9a1.                *note Path.mkdir(): ca0.\n\n\n*note os.rename(): f62.                  *note Path.rename(): 24bf.\n\n\n*note os.replace(): f63.                 *note Path.replace(): 24c0.\n\n\n*note os.rmdir(): f64.                   *note Path.rmdir(): 24bc.\n\n\n*note os.remove(): f61,                  *note Path.unlink(): 1769.\n*note os.unlink(): f66.\n\n*note os.getcwd(): 1779.                 *note Path.cwd(): 1470.\n\n\n*note os.path.exists(): 837.             *note Path.exists(): 83f.\n\n\n*note os.path.expanduser(): 83d.         *note Path.expanduser(): ca1. and\n*note Path.home(): ca2.\n\n\n*note os.listdir(): f6a.                 *note Path.iterdir(): 1505.\n\n\n*note os.walk(): 1c8.                    *note Path.walk(): 1c7.\n\n\n*note os.path.isdir(): 839.              *note Path.isdir(): 840.\n\n\n*note os.path.isfile(): 83a.             *note Path.isfile(): 841.\n\n\n*note os.path.islink(): 835.             *note Path.issymlink(): 843.\n\n\n*note os.link(): f5f.                    *note Path.hardlinkto(): 616.\n\n\n*note os.symlink(): f65.                 *note Path.symlinkto(): 617.\n\n\n*note os.readlink(): 73e.                *note Path.readlink(): 73d.\n\n\n*note os.path.relpath(): 1ca.            *note PurePath.relativeto(): 1c9.\n(2)\n\n\n*note os.stat(): 1bf.                    *note Path.stat(): 618,\n*note Path.owner(): 24be,\n*note Path.group(): 24bb.\n\n\n*note os.path.isabs(): 24c3.             *note PurePath.isabsolute(): 1471.\n\n\n*note os.path.join(): 1474.              *note PurePath.joinpath(): 24b4.\n\n\n*note os.path.basename(): 24c4.          *note PurePath.name: 24ad.\n\n\n*note os.path.dirname(): 24c5.           *note PurePath.parent: 1473.\n\n\n*note os.path.samefile(): de1.           *note Path.samefile(): c9f.\n\n\n*note os.path.splitext(): 24c6.          *note PurePath.stem: 24b0. and\n*note PurePath.suffix: 24ae.\n\n\n---------- Footnotes ----------\n\n(1) *note os.path.abspath(): 1192. normalizes the resulting path,\nwhich may change its meaning in the presence of symlinks, while *note\nPath.absolute(): 146f. does not.\n\n(2) *note PurePath.relativeto(): 1c9. requires 'self' to be the\nsubpath of the argument, but *note os.path.relpath(): 1ca. does not.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: os path -- Common pathname manipulations,  Next: fileinput -- Iterate over lines from multiple input streams,  Prev: pathlib -- Object-oriented filesystem paths,  Up: File and Directory Access": {
            "content": "'Source code:' Lib/posixpath.py(1) (for POSIX) and Lib/ntpath.py(2) (for\nWindows).\n\n\n",
            "subsections": []
        },
        "This module implements some useful functions on pathnames.  To read or": {
            "content": "write files see *note open(): 26e, and for accessing the filesystem see\nthe *note os: 9c. module.  The path parameters can be passed as strings,\nor bytes, or any object implementing the *note os.PathLike: a9a.\nprotocol.\n\nUnlike a Unix shell, Python does not do any 'automatic' path expansions.\nFunctions such as *note expanduser(): 83d. and *note expandvars(): 122e.\ncan be invoked explicitly when an application desires shell-like path\nexpansion.  (See also the *note glob: 5f. module.)\n\nSee also\n........\n\nThe *note pathlib: 9f. module offers high-level path objects.\n\nNote: All of these functions accept either only bytes or only\nstring objects as their parameters.  The result is an object of the\nsame type, if a path or file name is returned.\n\nNote: Since different operating systems have different path name\nconventions, there are several versions of this module in the\nstandard library.  The *note os.path: 9d. module is always the path\nmodule suitable for the operating system Python is running on, and\ntherefore usable for local paths.  However, you can also import and\nuse the individual modules if you want to manipulate a path that is\n'always' in one of the different formats.  They all have the same\ninterface:\n\n* 'posixpath' for UNIX-style paths\n\n* 'ntpath' for Windows paths\n\nChanged in version 3.8: *note exists(): 837, *note lexists(): 838, *note\nisdir(): 839, *note isfile(): 83a, *note islink(): 835, and *note\nismount(): 83b. now return 'False' instead of raising an exception for\npaths that contain characters or bytes unrepresentable at the OS level.\n\n-- Function: os.path.abspath (path)\n\nReturn a normalized absolutized version of the pathname 'path'.  On\nmost platforms, this is equivalent to calling the function *note\nnormpath(): 1191. as follows: 'normpath(join(os.getcwd(), path))'.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.path.basename (path)\n\nReturn the base name of pathname 'path'.  This is the second\nelement of the pair returned by passing 'path' to the function\n*note split(): 24c9.  Note that the result of this function is\ndifferent from the Unix 'basename' program; where 'basename' for\n''/foo/bar/'' returns ''bar'', the *note basename(): 24c4. function\nreturns an empty string ('''').\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.path.commonpath (paths)\n\nReturn the longest common sub-path of each pathname in the sequence\n'paths'.  Raise *note ValueError: 183. if 'paths' contain both\nabsolute and relative pathnames, the 'paths' are on the different\ndrives or if 'paths' is empty.  Unlike *note commonprefix(): c9d,\nthis returns a valid path.\n\n*note Availability: 1ad3.: Unix, Windows.\n\nNew in version 3.5.\n\nChanged in version 3.6: Accepts a sequence of *note path-like\nobjects: 957.\n\n-- Function: os.path.commonprefix (list)\n\nReturn the longest path prefix (taken character-by-character) that\nis a prefix of all paths in 'list'.  If 'list' is empty, return the\nempty string ('''').\n\nNote: This function may return invalid paths because it works\na character at a time.  To obtain a valid path, see *note\ncommonpath(): c9c.\n\n>>> os.path.commonprefix(['/usr/lib', '/usr/local/lib'])\n'/usr/l'\n\n>>> os.path.commonpath(['/usr/lib', '/usr/local/lib'])\n'/usr'\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.path.dirname (path)\n\nReturn the directory name of pathname 'path'.  This is the first\nelement of the pair returned by passing 'path' to the function\n*note split(): 24c9.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.path.exists (path)\n\nReturn 'True' if 'path' refers to an existing path or an open file\ndescriptor.  Returns 'False' for broken symbolic links.  On some\nplatforms, this function may return 'False' if permission is not\ngranted to execute *note os.stat(): 1bf. on the requested file,\neven if the 'path' physically exists.\n\nChanged in version 3.3: 'path' can now be an integer: 'True' is\nreturned if it is an open file descriptor, 'False' otherwise.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.path.lexists (path)\n\nReturn 'True' if 'path' refers to an existing path.  Returns 'True'\nfor broken symbolic links.  Equivalent to *note exists(): 837. on\nplatforms lacking *note os.lstat(): 1c0.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.path.expanduser (path)\n\nOn Unix and Windows, return the argument with an initial component\nof '~' or '~user' replaced by that 'user''s home directory.\n\nOn Unix, an initial '~' is replaced by the environment variable\n'HOME' if it is set; otherwise the current user's home directory is\nlooked up in the password directory through the built-in module\n*note pwd: ad.  An initial '~user' is looked up directly in the\npassword directory.\n\nOn Windows, 'USERPROFILE' will be used if set, otherwise a\ncombination of 'HOMEPATH' and 'HOMEDRIVE' will be used.  An initial\n'~user' is handled by checking that the last directory component of\nthe current user's home directory matches 'USERNAME', and replacing\nit if so.\n\nIf the expansion fails or if the path does not begin with a tilde,\nthe path is returned unchanged.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\nChanged in version 3.8: No longer uses 'HOME' on Windows.\n\n-- Function: os.path.expandvars (path)\n\nReturn the argument with environment variables expanded.\nSubstrings of the form '$name' or '${name}' are replaced by the\nvalue of environment variable 'name'.  Malformed variable names and\nreferences to non-existing variables are left unchanged.\n\nOn Windows, '%name%' expansions are supported in addition to\n'$name' and '${name}'.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.path.getatime (path)\n\nReturn the time of last access of 'path'.  The return value is a\nfloating point number giving the number of seconds since the epoch\n(see the *note time: e8. module).  Raise *note OSError: 613. if the\nfile does not exist or is inaccessible.\n\n-- Function: os.path.getmtime (path)\n\nReturn the time of last modification of 'path'.  The return value\nis a floating point number giving the number of seconds since the\nepoch (see the *note time: e8. module).  Raise *note OSError: 613.\nif the file does not exist or is inaccessible.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.path.getctime (path)\n\nReturn the system's ctime which, on some systems (like Unix) is the\ntime of the last metadata change, and, on others (like Windows), is\nthe creation time for 'path'.  The return value is a number giving\nthe number of seconds since the epoch (see the *note time: e8.\nmodule).  Raise *note OSError: 613. if the file does not exist or\nis inaccessible.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.path.getsize (path)\n\nReturn the size, in bytes, of 'path'.  Raise *note OSError: 613. if\nthe file does not exist or is inaccessible.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.path.isabs (path)\n\nReturn 'True' if 'path' is an absolute pathname.  On Unix, that\nmeans it begins with a slash, on Windows that it begins with a\n(back)slash after chopping off a potential drive letter.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.path.isfile (path)\n\nReturn 'True' if 'path' is an *note existing: 837. regular file.\nThis follows symbolic links, so both *note islink(): 835. and *note\nisfile(): 83a. can be true for the same path.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.path.isdir (path)\n\nReturn 'True' if 'path' is an *note existing: 837. directory.  This\nfollows symbolic links, so both *note islink(): 835. and *note\nisdir(): 839. can be true for the same path.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.path.isjunction (path)\n\nReturn 'True' if 'path' refers to an *note existing: 838. directory\nentry that is a junction.  Always return 'False' if junctions are\nnot supported on the current platform.\n\nNew in version 3.12.\n\n-- Function: os.path.islink (path)\n\nReturn 'True' if 'path' refers to an *note existing: 837. directory\nentry that is a symbolic link.  Always 'False' if symbolic links\nare not supported by the Python runtime.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.path.ismount (path)\n\nReturn 'True' if pathname 'path' is a 'mount point': a point in a\nfile system where a different file system has been mounted.  On\nPOSIX, the function checks whether 'path''s parent, '`path'/..', is\non a different device than 'path', or whether '`path'/..' and\n'path' point to the same i-node on the same device -- this should\ndetect mount points for all Unix and POSIX variants.  It is not\nable to reliably detect bind mounts on the same filesystem.  On\nWindows, a drive letter root and a share UNC are always mount\npoints, and for any other path 'GetVolumePathName' is called to see\nif it is different from the input path.\n\nNew in version 3.4: Support for detecting non-root mount points on\nWindows.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.path.isdevdrive (path)\n\nReturn 'True' if pathname 'path' is located on a Windows Dev Drive.\nA Dev Drive is optimized for developer scenarios, and offers faster\nperformance for reading and writing files.  It is recommended for\nuse for source code, temporary build directories, package caches,\nand other IO-intensive operations.\n\nMay raise an error for an invalid path, for example, one without a\nrecognizable drive, but returns 'False' on platforms that do not\nsupport Dev Drives.  See the Windows documentation(3) for\ninformation on enabling and creating Dev Drives.\n\n*note Availability: 1ad3.: Windows.\n\nNew in version 3.12.\n\n-- Function: os.path.join (path, *paths)\n\nJoin one or more path segments intelligently.  The return value is\nthe concatenation of 'path' and all members of '*paths', with\nexactly one directory separator following each non-empty part,\nexcept the last.  That is, the result will only end in a separator\nif the last part is either empty or ends in a separator.  If a\nsegment is an absolute path (which on Windows requires both a drive\nand a root), then all previous segments are ignored and joining\ncontinues from the absolute path segment.\n\nOn Windows, the drive is not reset when a rooted path segment\n(e.g., 'r'\\foo'') is encountered.  If a segment is on a different\ndrive or is an absolute path, all previous segments are ignored and\nthe drive is reset.  Note that since there is a current directory\nfor each drive, 'os.path.join(\"c:\", \"foo\")' represents a path\nrelative to the current directory on drive 'C:' ('c:foo'), not\n'c:\\foo'.\n\nChanged in version 3.6: Accepts a *note path-like object: 957. for\n'path' and 'paths'.\n\n-- Function: os.path.normcase (path)\n\nNormalize the case of a pathname.  On Windows, convert all\ncharacters in the pathname to lowercase, and also convert forward\nslashes to backward slashes.  On other operating systems, return\nthe path unchanged.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.path.normpath (path)\n\nNormalize a pathname by collapsing redundant separators and\nup-level references so that 'A//B', 'A/B/', 'A/./B' and\n'A/foo/../B' all become 'A/B'.  This string manipulation may\nchange the meaning of a path that contains symbolic links.  On\nWindows, it converts forward slashes to backward slashes.  To\nnormalize case, use *note normcase(): 24ce.\n\nNote:\nOn POSIX systems, in accordance with IEEE Std 1003.1 2013\nEdition; 4.13 Pathname Resolution(4), if a pathname\nbegins with exactly two slashes, the first component\nfollowing the leading characters may be interpreted in an\nimplementation-defined manner, although more than two\nleading characters shall be treated as a single\ncharacter.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.path.realpath (path, *, strict=False)\n\nReturn the canonical path of the specified filename, eliminating\nany symbolic links encountered in the path (if they are supported\nby the operating system).\n\nBy default, the path is evaluated up to the first component that\ndoes not exist, is a symlink loop, or whose evaluation raises *note\nOSError: 613.  All such components are appended unchanged to the\nexisting part of the path.\n\nSome errors that are handled this way include \"access denied\", \"not\na directory\", or \"bad argument to internal function\".  Thus, the\nresulting path may be missing or inaccessible, may still contain\nlinks or loops, and may traverse non-directories.\n\nThis behavior can be modified by keyword arguments:\n\nIf 'strict' is 'True', the first error encountered when evaluating\nthe path is re-raised.  In particular, *note FileNotFoundError:\n353. is raised if 'path' does not exist, or another *note OSError:\n613. if it is otherwise inaccessible.\n\nIf 'strict' is *note os.path.ALLOWMISSING: 352, errors other than\n*note FileNotFoundError: 353. are re-raised (as with\n'strict=True').  Thus, the returned path will not contain any\nsymbolic links, but the named file and some of its parent\ndirectories may be missing.\n\nNote: This function emulates the operating system's procedure\nfor making a path canonical, which differs slightly between\nWindows and UNIX with respect to how links and subsequent path\ncomponents interact.\n\nOperating system APIs make paths canonical as needed, so it's\nnot normally necessary to call this function.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\nChanged in version 3.8: Symbolic links and junctions are now\nresolved on Windows.\n\nChanged in version 3.10: The 'strict' parameter was added.\n\nChanged in version next: The *note ALLOWMISSING: 352. value for\nthe 'strict' parameter was added.\n\n-- Data: os.path.ALLOWMISSING\n\nSpecial value used for the 'strict' argument in *note realpath():\n351.\n\nNew in version next.\n\n-- Function: os.path.relpath (path, start=os.curdir)\n\nReturn a relative filepath to 'path' either from the current\ndirectory or from an optional 'start' directory.  This is a path\ncomputation: the filesystem is not accessed to confirm the\nexistence or nature of 'path' or 'start'.  On Windows, *note\nValueError: 183. is raised when 'path' and 'start' are on different\ndrives.\n\n'start' defaults to *note os.curdir: 24cf.\n\n*note Availability: 1ad3.: Unix, Windows.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.path.samefile (path1, path2)\n\nReturn 'True' if both pathname arguments refer to the same file or\ndirectory.  This is determined by the device number and i-node\nnumber and raises an exception if an *note os.stat(): 1bf. call on\neither pathname fails.\n\n*note Availability: 1ad3.: Unix, Windows.\n\nChanged in version 3.2: Added Windows support.\n\nChanged in version 3.4: Windows now uses the same implementation as\nall other platforms.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.path.sameopenfile (fp1, fp2)\n\nReturn 'True' if the file descriptors 'fp1' and 'fp2' refer to the\nsame file.\n\n*note Availability: 1ad3.: Unix, Windows.\n\nChanged in version 3.2: Added Windows support.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.path.samestat (stat1, stat2)\n\nReturn 'True' if the stat tuples 'stat1' and 'stat2' refer to the\nsame file.  These structures may have been returned by *note\nos.fstat(): be8, *note os.lstat(): 1c0, or *note os.stat(): 1bf.\nThis function implements the underlying comparison used by *note\nsamefile(): de1. and *note sameopenfile(): 24d0.\n\n*note Availability: 1ad3.: Unix, Windows.\n\nChanged in version 3.4: Added Windows support.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.path.split (path)\n\nSplit the pathname 'path' into a pair, '(head, tail)' where 'tail'\nis the last pathname component and 'head' is everything leading up\nto that.  The 'tail' part will never contain a slash; if 'path'\nends in a slash, 'tail' will be empty.  If there is no slash in\n'path', 'head' will be empty.  If 'path' is empty, both 'head' and\n'tail' are empty.  Trailing slashes are stripped from 'head' unless\nit is the root (one or more slashes only).  In all cases,\n'join(head, tail)' returns a path to the same location as 'path'\n(but the strings may differ).  Also see the functions *note\ndirname(): 24c5. and *note basename(): 24c4.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.path.splitdrive (path)\n\nSplit the pathname 'path' into a pair '(drive, tail)' where 'drive'\nis either a mount point or the empty string.  On systems which do\nnot use drive specifications, 'drive' will always be the empty\nstring.  In all cases, 'drive + tail' will be the same as 'path'.\n\nOn Windows, splits a pathname into drive/UNC sharepoint and\nrelative path.\n\nIf the path contains a drive letter, drive will contain everything\nup to and including the colon:\n\n>>> splitdrive(\"c:/dir\")\n(\"c:\", \"/dir\")\n\nIf the path contains a UNC path, drive will contain the host name\nand share:\n\n>>> splitdrive(\"//host/computer/dir\")\n(\"//host/computer\", \"/dir\")\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.path.splitroot (path)\n\nSplit the pathname 'path' into a 3-item tuple '(drive, root, tail)'\nwhere 'drive' is a device name or mount point, 'root' is a string\nof separators after the drive, and 'tail' is everything after the\nroot.  Any of these items may be the empty string.  In all cases,\n'drive + root + tail' will be the same as 'path'.\n\nOn POSIX systems, 'drive' is always empty.  The 'root' may be empty\n(if 'path' is relative), a single forward slash (if 'path' is\nabsolute), or two forward slashes (implementation-defined per IEEE\nStd 1003.1-2017; 4.13 Pathname Resolution(5).)  For example:\n\n>>> splitroot('/home/sam')\n('', '/', 'home/sam')\n>>> splitroot('//home/sam')\n('', '//', 'home/sam')\n>>> splitroot('///home/sam')\n('', '/', '//home/sam')\n\nOn Windows, 'drive' may be empty, a drive-letter name, a UNC share,\nor a device name.  The 'root' may be empty, a forward slash, or a\nbackward slash.  For example:\n\n>>> splitroot('C:/Users/Sam')\n('C:', '/', 'Users/Sam')\n>>> splitroot('//Server/Share/Users/Sam')\n('//Server/Share', '/', 'Users/Sam')\n\nNew in version 3.12.\n\n-- Function: os.path.splitext (path)\n\nSplit the pathname 'path' into a pair '(root, ext)' such that 'root\n+ ext == path', and the extension, 'ext', is empty or begins with a\nperiod and contains at most one period.\n\nIf the path contains no extension, 'ext' will be '''':\n\n>>> splitext('bar')\n('bar', '')\n\nIf the path contains an extension, then 'ext' will be set to this\nextension, including the leading period.  Note that previous\nperiods will be ignored:\n\n>>> splitext('foo.bar.exe')\n('foo.bar', '.exe')\n>>> splitext('/foo/bar.exe')\n('/foo/bar', '.exe')\n\nLeading periods of the last component of the path are considered to\nbe part of the root:\n\n>>> splitext('.cshrc')\n('.cshrc', '')\n>>> splitext('/foo/....jpg')\n('/foo/....jpg', '')\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Data: os.path.supportsunicodefilenames\n\n'True' if arbitrary Unicode strings can be used as file names\n(within limitations imposed by the file system).\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/posixpath.py\n\n(2) https://github.com/python/cpython/tree/3.12/Lib/ntpath.py\n\n(3) https://learn.microsoft.com/windows/dev-drive/\n\n(4)\nhttps://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1chap04.html#tag0413\n\n(5)\nhttps://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1chap04.html#tag0413\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: fileinput -- Iterate over lines from multiple input streams,  Next: stat -- Interpreting stat results,  Prev: os path -- Common pathname manipulations,  Up: File and Directory Access": {
            "content": "'Source code:' Lib/fileinput.py(1)\n\n\n",
            "subsections": []
        },
        "This module implements a helper class and functions to quickly write a": {
            "content": "loop over standard input or a list of files.  If you just want to read\nor write one file see *note open(): 26e.\n\nThe typical use is:\n\nimport fileinput\nfor line in fileinput.input(encoding=\"utf-8\"):\nprocess(line)\n\nThis iterates over the lines of all files listed in 'sys.argv[1:]',\ndefaulting to 'sys.stdin' if the list is empty.  If a filename is ''-'',\nit is also replaced by 'sys.stdin' and the optional arguments 'mode' and\n'openhook' are ignored.  To specify an alternative list of filenames,\npass it as the first argument to *note input(): 5f2.  A single file name\nis also allowed.\n",
            "subsections": []
        },
        "All files are opened in text mode by default, but you can override this": {
            "content": "by specifying the 'mode' parameter in the call to *note input(): 5f2. or\n*note FileInput: 51b.  If an I/O error occurs during opening or reading\na file, *note OSError: 613. is raised.\n\nChanged in version 3.3: *note IOError: ecb. used to be raised; it is now\nan alias of *note OSError: 613.\n",
            "subsections": []
        },
        "If 'sys.stdin' is used more than once, the second and further use will": {
            "content": "return no lines, except perhaps for interactive use, or if it has been\nexplicitly reset (e.g.  using 'sys.stdin.seek(0)').\n",
            "subsections": []
        },
        "Empty files are opened and immediately closed; the only time their": {
            "content": "presence in the list of filenames is noticeable at all is when the last\nfile opened is empty.\n",
            "subsections": []
        },
        "Lines are returned with any newlines intact, which means that the last": {
            "content": "line in a file may not have one.\n",
            "subsections": []
        },
        "You can control how files are opened by providing an opening hook via": {
            "content": "the 'openhook' parameter to *note fileinput.input(): 5f2. or *note",
            "subsections": []
        },
        "FileInput(): 51b.  The hook must be a function that takes two arguments,": {
            "content": "'filename' and 'mode', and returns an accordingly opened file-like\nobject.  If 'encoding' and/or 'errors' are specified, they will be\npassed to the hook as additional keyword arguments.  This module\nprovides a *note hookcompressed(): 5f3. to support compressed files.\n\nThe following function is the primary interface of this module:\n\n-- Function: fileinput.input (files=None, inplace=False, backup='', *,\nmode='r', openhook=None, encoding=None, errors=None)\n\nCreate an instance of the *note FileInput: 51b. class.  The\ninstance will be used as global state for the functions of this\nmodule, and is also returned to use during iteration.  The\nparameters to this function will be passed along to the constructor\nof the *note FileInput: 51b. class.\n\nThe *note FileInput: 51b. instance can be used as a context manager\nin the *note with: 396. statement.  In this example, 'input' is\nclosed after the 'with' statement is exited, even if an exception\noccurs:\n\nwith fileinput.input(files=('spam.txt', 'eggs.txt'), encoding=\"utf-8\") as f:\nfor line in f:\nprocess(line)\n\nChanged in version 3.2: Can be used as a context manager.\n\nChanged in version 3.8: The keyword parameters 'mode' and\n'openhook' are now keyword-only.\n\nChanged in version 3.10: The keyword-only parameter 'encoding' and\n'errors' are added.\n\nThe following functions use the global state created by *note\nfileinput.input(): 5f2.; if there is no active state, *note\nRuntimeError: 17a. is raised.\n\n-- Function: fileinput.filename ()\n\nReturn the name of the file currently being read.  Before the first\nline has been read, returns 'None'.\n\n-- Function: fileinput.fileno ()\n\nReturn the integer \"file descriptor\" for the current file.  When no\nfile is opened (before the first line and between files), returns\n'-1'.\n\n-- Function: fileinput.lineno ()\n\nReturn the cumulative line number of the line that has just been\nread.  Before the first line has been read, returns '0'.  After the\nlast line of the last file has been read, returns the line number\nof that line.\n\n-- Function: fileinput.filelineno ()\n\nReturn the line number in the current file.  Before the first line\nhas been read, returns '0'.  After the last line of the last file\nhas been read, returns the line number of that line within the\nfile.\n\n-- Function: fileinput.isfirstline ()\n\nReturn 'True' if the line just read is the first line of its file,\notherwise return 'False'.\n\n-- Function: fileinput.isstdin ()\n\nReturn 'True' if the last line was read from 'sys.stdin', otherwise\nreturn 'False'.\n\n-- Function: fileinput.nextfile ()\n\nClose the current file so that the next iteration will read the\nfirst line from the next file (if any); lines not read from the\nfile will not count towards the cumulative line count.  The\nfilename is not changed until after the first line of the next file\nhas been read.  Before the first line has been read, this function\nhas no effect; it cannot be used to skip the first file.  After the\nlast line of the last file has been read, this function has no\neffect.\n\n-- Function: fileinput.close ()\n\nClose the sequence.\n",
            "subsections": []
        },
        "The class which implements the sequence behavior provided by the module": {
            "content": "is available for subclassing as well:\n\n-- Class: fileinput.FileInput (files=None, inplace=False, backup='', *,\nmode='r', openhook=None, encoding=None, errors=None)\n\nClass *note FileInput: 51b. is the implementation; its methods\n*note filename(): 24d3, *note fileno(): 1284, *note lineno(): 24d4,\n*note filelineno(): 24d5, *note isfirstline(): 24d6, *note\nisstdin(): 24d7, *note nextfile(): 24d8. and *note close(): 24d9.\ncorrespond to the functions of the same name in the module.  In\naddition it is *note iterable: 109d. and has a *note readline():\n1a40. method which returns the next input line.  The sequence must\nbe accessed in strictly sequential order; random access and *note\nreadline(): 1a40. cannot be mixed.\n\nWith 'mode' you can specify which file mode will be passed to *note\nopen(): 26e.  It must be one of ''r'' and ''rb''.\n\nThe 'openhook', when given, must be a function that takes two\narguments, 'filename' and 'mode', and returns an accordingly opened\nfile-like object.  You cannot use 'inplace' and 'openhook'\ntogether.\n\nYou can specify 'encoding' and 'errors' that is passed to *note\nopen(): 26e. or 'openhook'.\n\nA *note FileInput: 51b. instance can be used as a context manager\nin the *note with: 396. statement.  In this example, 'input' is\nclosed after the 'with' statement is exited, even if an exception\noccurs:\n\nwith FileInput(files=('spam.txt', 'eggs.txt')) as input:\nprocess(input)\n\nChanged in version 3.2: Can be used as a context manager.\n\nChanged in version 3.8: The keyword parameter 'mode' and 'openhook'\nare now keyword-only.\n\nChanged in version 3.10: The keyword-only parameter 'encoding' and\n'errors' are added.\n\nChanged in version 3.11: The ''rU'' and ''U'' modes and the\n'getitem()' method have been removed.\n\n'Optional in-place filtering:' if the keyword argument 'inplace=True' is\npassed to *note fileinput.input(): 5f2. or to the *note FileInput: 51b.\nconstructor, the file is moved to a backup file and standard output is\ndirected to the input file (if a file of the same name as the backup\nfile already exists, it will be replaced silently).  This makes it\npossible to write a filter that rewrites its input file in place.  If\nthe 'backup' parameter is given (typically as 'backup='.<some\nextension>''), it specifies the extension for the backup file, and the\nbackup file remains around; by default, the extension is ''.bak'' and it\nis deleted when the output file is closed.  In-place filtering is\ndisabled when standard input is read.\n\nThe two following opening hooks are provided by this module:\n\n-- Function: fileinput.hookcompressed (filename, mode, *,\nencoding=None, errors=None)\n\nTransparently opens files compressed with gzip and bzip2\n(recognized by the extensions ''.gz'' and ''.bz2'') using the *note\ngzip: 62. and *note bz2: 11. modules.  If the filename extension is\nnot ''.gz'' or ''.bz2'', the file is opened normally (ie, using\n*note open(): 26e. without any decompression).\n\nThe 'encoding' and 'errors' values are passed to *note\nio.TextIOWrapper: b8f. for compressed files and open for normal\nfiles.\n\nUsage example: 'fi =\nfileinput.FileInput(openhook=fileinput.hookcompressed,\nencoding=\"utf-8\")'\n\nChanged in version 3.10: The keyword-only parameter 'encoding' and\n'errors' are added.\n\n-- Function: fileinput.hookencoded (encoding, errors=None)\n\nReturns a hook which opens each file with *note open(): 26e, using\nthe given 'encoding' and 'errors' to read the file.\n\nUsage example: 'fi =\nfileinput.FileInput(openhook=fileinput.hookencoded(\"utf-8\",\n\"surrogateescape\"))'\n\nChanged in version 3.6: Added the optional 'errors' parameter.\n\nDeprecated since version 3.10: This function is deprecated since\n*note fileinput.input(): 5f2. and *note FileInput: 51b. now have\n'encoding' and 'errors' parameters.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/fileinput.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: stat -- Interpreting stat results,  Next: filecmp -- File and Directory Comparisons,  Prev: fileinput -- Iterate over lines from multiple input streams,  Up: File and Directory Access": {
            "content": "'Source code:' Lib/stat.py(1)\n\n\n\nThe *note stat: cb. module defines constants and functions for\ninterpreting the results of *note os.stat(): 1bf, *note os.fstat(): be8.\nand *note os.lstat(): 1c0. (if they exist).  For complete details about\nthe 'stat()', 'fstat()' and 'lstat()' calls, consult the documentation\nfor your system.\n\nChanged in version 3.4: The stat module is backed by a C implementation.\n\nThe *note stat: cb. module defines the following functions to test for\nspecific file types:\n\n-- Function: stat.SISDIR (mode)\n\nReturn non-zero if the mode is from a directory.\n\n-- Function: stat.SISCHR (mode)\n\nReturn non-zero if the mode is from a character special device\nfile.\n\n-- Function: stat.SISBLK (mode)\n\nReturn non-zero if the mode is from a block special device file.\n\n-- Function: stat.SISREG (mode)\n\nReturn non-zero if the mode is from a regular file.\n\n-- Function: stat.SISFIFO (mode)\n\nReturn non-zero if the mode is from a FIFO (named pipe).\n\n-- Function: stat.SISLNK (mode)\n\nReturn non-zero if the mode is from a symbolic link.\n\n-- Function: stat.SISSOCK (mode)\n\nReturn non-zero if the mode is from a socket.\n\n-- Function: stat.SISDOOR (mode)\n\nReturn non-zero if the mode is from a door.\n\nNew in version 3.4.\n\n-- Function: stat.SISPORT (mode)\n\nReturn non-zero if the mode is from an event port.\n\nNew in version 3.4.\n\n-- Function: stat.SISWHT (mode)\n\nReturn non-zero if the mode is from a whiteout.\n\nNew in version 3.4.\n",
            "subsections": []
        },
        "Two additional functions are defined for more general manipulation of": {
            "content": "the file's mode:\n\n-- Function: stat.SIMODE (mode)\n\nReturn the portion of the file's mode that can be set by *note\nos.chmod(): f5d.--that is, the file's permission bits, plus the\nsticky bit, set-group-id, and set-user-id bits (on systems that\nsupport them).\n\n-- Function: stat.SIFMT (mode)\n\nReturn the portion of the file's mode that describes the file type\n(used by the 'SIS*()' functions above).\n\nNormally, you would use the 'os.path.is*()' functions for testing the\ntype of a file; the functions here are useful when you are doing\nmultiple tests of the same file and wish to avoid the overhead of the\n'stat()' system call for each test.  These are also useful when checking\nfor information about a file that isn't handled by *note os.path: 9d,\nlike the tests for block and character devices.\n\nExample:\n\nimport os, sys\nfrom stat import *\n\ndef walktree(top, callback):\n'''recursively descend the directory tree rooted at top,\ncalling the callback function for each regular file'''\n\nfor f in os.listdir(top):\npathname = os.path.join(top, f)\nmode = os.lstat(pathname).stmode\nif SISDIR(mode):\n# It's a directory, recurse into it\nwalktree(pathname, callback)\nelif SISREG(mode):\n# It's a file, call the callback function\ncallback(pathname)\nelse:\n# Unknown file type, print a message\nprint('Skipping %s' % pathname)\n\ndef visitfile(file):\nprint('visiting', file)\n\nif name == 'main':\nwalktree(sys.argv[1], visitfile)\n",
            "subsections": []
        },
        "An additional utility function is provided to convert a file's mode in a": {
            "content": "human readable string:\n\n-- Function: stat.filemode (mode)\n\nConvert a file's mode to a string of the form '-rwxrwxrwx'.\n\nNew in version 3.3.\n\nChanged in version 3.4: The function supports *note SIFDOOR: e2a,\n*note SIFPORT: e2b. and *note SIFWHT: e2c.\n",
            "subsections": []
        },
        "All the variables below are simply symbolic indexes into the 10-tuple": {
            "content": "returned by *note os.stat(): 1bf, *note os.fstat(): be8. or *note\nos.lstat(): 1c0.\n\n-- Data: stat.STMODE\n\nInode protection mode.\n\n-- Data: stat.STINO\n\nInode number.\n\n-- Data: stat.STDEV\n\nDevice inode resides on.\n\n-- Data: stat.STNLINK\n\nNumber of links to the inode.\n\n-- Data: stat.STUID\n\nUser id of the owner.\n\n-- Data: stat.STGID\n\nGroup id of the owner.\n\n-- Data: stat.STSIZE\n\nSize in bytes of a plain file; amount of data waiting on some\nspecial files.\n\n-- Data: stat.STATIME\n\nTime of last access.\n\n-- Data: stat.STMTIME\n\nTime of last modification.\n\n-- Data: stat.STCTIME\n\nThe \"ctime\" as reported by the operating system.  On some systems\n(like Unix) is the time of the last metadata change, and, on others\n(like Windows), is the creation time (see platform documentation\nfor details).\n\nThe interpretation of \"file size\" changes according to the file type.",
            "subsections": []
        },
        "For plain files this is the size of the file in bytes.  For FIFOs and": {
            "content": "sockets under most flavors of Unix (including Linux in particular), the\n\"size\" is the number of bytes waiting to be read at the time of the call\nto *note os.stat(): 1bf, *note os.fstat(): be8, or *note os.lstat():\n1c0.; this can sometimes be useful, especially for polling one of these\nspecial files after a non-blocking open.  The meaning of the size field\nfor other character and block devices varies more, depending on the\nimplementation of the underlying system call.\n\nThe variables below define the flags used in the *note STMODE: e29.\nfield.\n",
            "subsections": []
        },
        "Use of the functions above is more portable than use of the first set of": {
            "content": "flags:\n\n-- Data: stat.SIFSOCK\n\nSocket.\n\n-- Data: stat.SIFLNK\n\nSymbolic link.\n\n-- Data: stat.SIFREG\n\nRegular file.\n\n-- Data: stat.SIFBLK\n\nBlock device.\n\n-- Data: stat.SIFDIR\n\nDirectory.\n\n-- Data: stat.SIFCHR\n\nCharacter device.\n\n-- Data: stat.SIFIFO\n\nFIFO.\n\n-- Data: stat.SIFDOOR\n\nDoor.\n\nNew in version 3.4.\n\n-- Data: stat.SIFPORT\n\nEvent port.\n\nNew in version 3.4.\n\n-- Data: stat.SIFWHT\n\nWhiteout.\n\nNew in version 3.4.\n\nNote: *note SIFDOOR: e2a, *note SIFPORT: e2b. or *note SIFWHT:\ne2c. are defined as 0 when the platform does not have support for\nthe file types.\n\nThe following flags can also be used in the 'mode' argument of *note\nos.chmod(): f5d.:\n\n-- Data: stat.SISUID\n\nSet UID bit.\n\n-- Data: stat.SISGID\n\nSet-group-ID bit.  This bit has several special uses.  For a\ndirectory it indicates that BSD semantics is to be used for that\ndirectory: files created there inherit their group ID from the\ndirectory, not from the effective group ID of the creating process,\nand directories created there will also get the *note SISGID:\n24f6. bit set.  For a file that does not have the group execution\nbit (*note SIXGRP: 24f7.) set, the set-group-ID bit indicates\nmandatory file/record locking (see also *note SENFMT: 24f8.).\n\n-- Data: stat.SISVTX\n\nSticky bit.  When this bit is set on a directory it means that a\nfile in that directory can be renamed or deleted only by the owner\nof the file, by the owner of the directory, or by a privileged\nprocess.\n\n-- Data: stat.SIRWXU\n\nMask for file owner permissions.\n\n-- Data: stat.SIRUSR\n\nOwner has read permission.\n\n-- Data: stat.SIWUSR\n\nOwner has write permission.\n\n-- Data: stat.SIXUSR\n\nOwner has execute permission.\n\n-- Data: stat.SIRWXG\n\nMask for group permissions.\n\n-- Data: stat.SIRGRP\n\nGroup has read permission.\n\n-- Data: stat.SIWGRP\n\nGroup has write permission.\n\n-- Data: stat.SIXGRP\n\nGroup has execute permission.\n\n-- Data: stat.SIRWXO\n\nMask for permissions for others (not in group).\n\n-- Data: stat.SIROTH\n\nOthers have read permission.\n\n-- Data: stat.SIWOTH\n\nOthers have write permission.\n\n-- Data: stat.SIXOTH\n\nOthers have execute permission.\n\n-- Data: stat.SENFMT\n\nSystem V file locking enforcement.  This flag is shared with *note\nSISGID: 24f6.: file/record locking is enforced on files that do\nnot have the group execution bit (*note SIXGRP: 24f7.) set.\n\n-- Data: stat.SIREAD\n\nUnix V7 synonym for *note SIRUSR: 24fb.\n\n-- Data: stat.SIWRITE\n\nUnix V7 synonym for *note SIWUSR: 24fc.\n\n-- Data: stat.SIEXEC\n\nUnix V7 synonym for *note SIXUSR: 24fd.\n\nThe following flags can be used in the 'flags' argument of *note\nos.chflags(): f5c.:\n\n-- Data: stat.UFNODUMP\n\nDo not dump the file.\n\n-- Data: stat.UFIMMUTABLE\n\nThe file may not be changed.\n\n-- Data: stat.UFAPPEND\n\nThe file may only be appended to.\n\n-- Data: stat.UFOPAQUE\n\nThe directory is opaque when viewed through a union stack.\n\n-- Data: stat.UFNOUNLINK\n\nThe file may not be renamed or deleted.\n\n-- Data: stat.UFCOMPRESSED\n\nThe file is stored compressed (macOS 10.6+).\n\n-- Data: stat.UFHIDDEN\n\nThe file should not be displayed in a GUI (macOS 10.5+).\n\n-- Data: stat.SFARCHIVED\n\nThe file may be archived.\n\n-- Data: stat.SFIMMUTABLE\n\nThe file may not be changed.\n\n-- Data: stat.SFAPPEND\n\nThe file may only be appended to.\n\n-- Data: stat.SFNOUNLINK\n\nThe file may not be renamed or deleted.\n\n-- Data: stat.SFSNAPSHOT\n\nThe file is a snapshot file.\n\nSee the *BSD or macOS systems man page 'chflags(2)' for more\ninformation.\n",
            "subsections": []
        },
        "On Windows, the following file attribute constants are available for use": {
            "content": "when testing bits in the 'stfileattributes' member returned by *note\nos.stat(): 1bf.  See the Windows API documentation(2) for more detail on\nthe meaning of these constants.\n\n-- Data: stat.FILEATTRIBUTEARCHIVE\n-- Data: stat.FILEATTRIBUTECOMPRESSED\n-- Data: stat.FILEATTRIBUTEDEVICE\n-- Data: stat.FILEATTRIBUTEDIRECTORY\n-- Data: stat.FILEATTRIBUTEENCRYPTED\n-- Data: stat.FILEATTRIBUTEHIDDEN\n-- Data: stat.FILEATTRIBUTEINTEGRITYSTREAM\n-- Data: stat.FILEATTRIBUTENORMAL\n-- Data: stat.FILEATTRIBUTENOTCONTENTINDEXED\n-- Data: stat.FILEATTRIBUTENOSCRUBDATA\n-- Data: stat.FILEATTRIBUTEOFFLINE\n-- Data: stat.FILEATTRIBUTEREADONLY\n-- Data: stat.FILEATTRIBUTEREPARSEPOINT\n-- Data: stat.FILEATTRIBUTESPARSEFILE\n-- Data: stat.FILEATTRIBUTESYSTEM\n-- Data: stat.FILEATTRIBUTETEMPORARY\n-- Data: stat.FILEATTRIBUTEVIRTUAL\n\nNew in version 3.5.\n",
            "subsections": []
        },
        "On Windows, the following constants are available for comparing against": {
            "content": "the 'streparsetag' member returned by *note os.lstat(): 1c0.  These\nare well-known constants, but are not an exhaustive list.\n\n-- Data: stat.IOREPARSETAGSYMLINK\n-- Data: stat.IOREPARSETAGMOUNTPOINT\n-- Data: stat.IOREPARSETAGAPPEXECLINK\n\nNew in version 3.8.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/stat.py\n\n(2)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/gg258117.aspx\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: filecmp -- File and Directory Comparisons,  Next: tempfile -- Generate temporary files and directories,  Prev: stat -- Interpreting stat results,  Up: File and Directory Access": {
            "content": "'Source code:' Lib/filecmp.py(1)\n\n\n\nThe *note filecmp: 55. module defines functions to compare files and\ndirectories, with various optional time/correctness trade-offs.  For\ncomparing files, see also the *note difflib: 34. module.\n\nThe *note filecmp: 55. module defines the following functions:\n\n-- Function: filecmp.cmp (f1, f2, shallow=True)\n\nCompare the files named 'f1' and 'f2', returning 'True' if they\nseem equal, 'False' otherwise.\n\nIf 'shallow' is true and the *note os.stat(): 1bf. signatures (file\ntype, size, and modification time) of both files are identical, the\nfiles are taken to be equal.\n\nOtherwise, the files are treated as different if their sizes or\ncontents differ.\n\nNote that no external programs are called from this function,\ngiving it portability and efficiency.\n\nThis function uses a cache for past comparisons and the results,\nwith cache entries invalidated if the *note os.stat(): 1bf.\ninformation for the file changes.  The entire cache may be cleared\nusing *note clearcache(): dae.\n\n-- Function: filecmp.cmpfiles (dir1, dir2, common, shallow=True)\n\nCompare the files in the two directories 'dir1' and 'dir2' whose\nnames are given by 'common'.\n\nReturns three lists of file names: 'match', 'mismatch', 'errors'.\n'match' contains the list of files that match, 'mismatch' contains\nthe names of those that don't, and 'errors' lists the names of\nfiles which could not be compared.  Files are listed in 'errors' if\nthey don't exist in one of the directories, the user lacks\npermission to read them or if the comparison could not be done for\nsome other reason.\n\nThe 'shallow' parameter has the same meaning and default value as\nfor *note filecmp.cmp(): 160e.\n\nFor example, 'cmpfiles('a', 'b', ['c', 'd/e'])' will compare 'a/c'\nwith 'b/c' and 'a/d/e' with 'b/d/e'.  ''c'' and ''d/e'' will each\nbe in one of the three returned lists.\n\n-- Function: filecmp.clearcache ()\n\nClear the filecmp cache.  This may be useful if a file is compared\nso quickly after it is modified that it is within the mtime\nresolution of the underlying filesystem.\n\nNew in version 3.4.\n\n* Menu:\n\n* The dircmp class::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/filecmp.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The dircmp class,  Up: filecmp -- File and Directory Comparisons": {
            "content": "5.11.5.1 The 'dircmp' class\n...........................\n\n-- Class: filecmp.dircmp (a, b, ignore=None, hide=None)\n\nConstruct a new directory comparison object, to compare the\ndirectories 'a' and 'b'.  'ignore' is a list of names to ignore,\nand defaults to *note filecmp.DEFAULTIGNORES: daf.  'hide' is a\nlist of names to hide, and defaults to '[os.curdir, os.pardir]'.\n\nThe *note dircmp: db0. class compares files by doing 'shallow'\ncomparisons as described for *note filecmp.cmp(): 160e.\n\nThe *note dircmp: db0. class provides the following methods:\n\n-- Method: report ()\n\nPrint (to *note sys.stdout: 90c.) a comparison between 'a' and\n'b'.\n\n-- Method: reportpartialclosure ()\n\nPrint a comparison between 'a' and 'b' and common immediate\nsubdirectories.\n\n-- Method: reportfullclosure ()\n\nPrint a comparison between 'a' and 'b' and common\nsubdirectories (recursively).\n\nThe *note dircmp: db0. class offers a number of interesting\nattributes that may be used to get various bits of information\nabout the directory trees being compared.\n\nNote that via *note getattr(): 1f8. hooks, all attributes are\ncomputed lazily, so there is no speed penalty if only those\nattributes which are lightweight to compute are used.\n\n-- Attribute: left\n\nThe directory 'a'.\n\n-- Attribute: right\n\nThe directory 'b'.\n\n-- Attribute: leftlist\n\nFiles and subdirectories in 'a', filtered by 'hide' and\n'ignore'.\n\n-- Attribute: rightlist\n\nFiles and subdirectories in 'b', filtered by 'hide' and\n'ignore'.\n\n-- Attribute: common\n\nFiles and subdirectories in both 'a' and 'b'.\n\n-- Attribute: leftonly\n\nFiles and subdirectories only in 'a'.\n\n-- Attribute: rightonly\n\nFiles and subdirectories only in 'b'.\n\n-- Attribute: commondirs\n\nSubdirectories in both 'a' and 'b'.\n\n-- Attribute: commonfiles\n\nFiles in both 'a' and 'b'.\n\n-- Attribute: commonfunny\n\nNames in both 'a' and 'b', such that the type differs between\nthe directories, or names for which *note os.stat(): 1bf.\nreports an error.\n\n-- Attribute: samefiles\n\nFiles which are identical in both 'a' and 'b', using the\nclass's file comparison operator.\n\n-- Attribute: difffiles\n\nFiles which are in both 'a' and 'b', whose contents differ\naccording to the class's file comparison operator.\n\n-- Attribute: funnyfiles\n\nFiles which are in both 'a' and 'b', but could not be\ncompared.\n\n-- Attribute: subdirs\n\nA dictionary mapping names in *note commondirs: 2537. to\n*note dircmp: db0. instances (or MyDirCmp instances if this\ninstance is of type MyDirCmp, a subclass of *note dircmp:\ndb0.).\n\nChanged in version 3.10: Previously entries were always *note\ndircmp: db0. instances.  Now entries are the same type as\n'self', if 'self' is a subclass of *note dircmp: db0.\n\n-- Attribute: filecmp.DEFAULTIGNORES\n\nNew in version 3.4.\n\nList of directories ignored by *note dircmp: db0. by default.\n",
            "subsections": []
        },
        "Here is a simplified example of using the 'subdirs' attribute to search": {
            "content": "recursively through two directories to show common different files:\n\n>>> from filecmp import dircmp\n>>> def printdifffiles(dcmp):\n...     for name in dcmp.difffiles:\n...         print(\"difffile %s found in %s and %s\" % (name, dcmp.left,\n...               dcmp.right))\n...     for subdcmp in dcmp.subdirs.values():\n...         printdifffiles(subdcmp)\n...\n>>> dcmp = dircmp('dir1', 'dir2')\n>>> printdifffiles(dcmp)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: tempfile -- Generate temporary files and directories,  Next: glob -- Unix style pathname pattern expansion,  Prev: filecmp -- File and Directory Comparisons,  Up: File and Directory Access": {
            "content": "'Source code:' Lib/tempfile.py(1)\n\n\n",
            "subsections": []
        },
        "This module creates temporary files and directories.  It works on all": {
            "content": "supported platforms.  *note TemporaryFile: 253f, *note\nNamedTemporaryFile: 1ea, *note TemporaryDirectory: 10aa, and *note",
            "subsections": []
        },
        "SpooledTemporaryFile: 45f. are high-level interfaces which provide": {
            "content": "automatic cleanup and can be used as *note context managers: 398.  *note\nmkstemp(): 2540. and *note mkdtemp(): 1eb. are lower-level functions\nwhich require manual cleanup.\n",
            "subsections": []
        },
        "All the user-callable functions and constructors take additional": {
            "content": "arguments which allow direct control over the location and name of\ntemporary files and directories.  Files names used by this module\ninclude a string of random characters which allows those files to be\nsecurely created in shared temporary directories.  To maintain backward\ncompatibility, the argument order is somewhat odd; it is recommended to\nuse keyword arguments for clarity.\n\nThe module defines the following user-callable items:\n\n-- Function: tempfile.TemporaryFile (mode='w+b', buffering=-1,\nencoding=None, newline=None, suffix=None, prefix=None,\ndir=None, *, errors=None)\n\nReturn a *note file-like object: 229a. that can be used as a\ntemporary storage area.  The file is created securely, using the\nsame rules as *note mkstemp(): 2540.  It will be destroyed as soon\nas it is closed (including an implicit close when the object is\ngarbage collected).  Under Unix, the directory entry for the file\nis either not created at all or is removed immediately after the\nfile is created.  Other platforms do not support this; your code\nshould not rely on a temporary file created using this function\nhaving or not having a visible name in the file system.\n\nThe resulting object can be used as a *note context manager: 398.\n(see *note Examples: 2541.).  On completion of the context or\ndestruction of the file object the temporary file will be removed\nfrom the filesystem.\n\nThe 'mode' parameter defaults to ''w+b'' so that the file created\ncan be read and written without being closed.  Binary mode is used\nso that it behaves consistently on all platforms without regard for\nthe data that is stored.  'buffering', 'encoding', 'errors' and\n'newline' are interpreted as for *note open(): 26e.\n\nThe 'dir', 'prefix' and 'suffix' parameters have the same meaning\nand defaults as with *note mkstemp(): 2540.\n\nThe returned object is a true file object on POSIX platforms.  On\nother platforms, it is a file-like object whose 'file' attribute is\nthe underlying true file object.\n\nThe *note os.OTMPFILE: de3. flag is used if it is available and\nworks (Linux-specific, requires Linux kernel 3.11 or later).\n\nOn platforms that are neither Posix nor Cygwin, TemporaryFile is an\nalias for NamedTemporaryFile.\n\nRaises an *note auditing event: 161d. 'tempfile.mkstemp' with\nargument 'fullpath'.\n\nChanged in version 3.5: The *note os.OTMPFILE: de3. flag is now\nused if available.\n\nChanged in version 3.8: Added 'errors' parameter.\n\n-- Function: tempfile.NamedTemporaryFile (mode='w+b', buffering=-1,\nencoding=None, newline=None, suffix=None, prefix=None,\ndir=None, delete=True, *, errors=None, deleteonclose=True)\n\nThis function operates exactly as *note TemporaryFile(): 253f.\ndoes, except the following differences:\n\n* This function returns a file that is guaranteed to have a\nvisible name in the file system.\n\n* To manage the named file, it extends the parameters of *note\nTemporaryFile(): 253f. with 'delete' and 'deleteonclose'\nparameters that determine whether and how the named file\nshould be automatically deleted.\n\nThe returned object is always a *note file-like object: 229a. whose\n'file' attribute is the underlying true file object.  This\nfile-like object can be used in a *note with: 396. statement, just\nlike a normal file.  The name of the temporary file can be\nretrieved from the 'name' attribute of the returned file-like\nobject.  On Unix, unlike with the *note TemporaryFile(): 253f, the\ndirectory entry does not get unlinked immediately after the file\ncreation.\n\nIf 'delete' is true (the default) and 'deleteonclose' is true\n(the default), the file is deleted as soon as it is closed.  If\n'delete' is true and 'deleteonclose' is false, the file is\ndeleted on context manager exit only, or else when the *note\nfile-like object: 229a. is finalized.  Deletion is not always\nguaranteed in this case (see *note object.del(): 1c66.).  If\n'delete' is false, the value of 'deleteonclose' is ignored.\n\nTherefore to use the name of the temporary file to reopen the file\nafter closing it, either make sure not to delete the file upon\nclosure (set the 'delete' parameter to be false) or, in case the\ntemporary file is created in a *note with: 396. statement, set the\n'deleteonclose' parameter to be false.  The latter approach is\nrecommended as it provides assistance in automatic cleaning of the\ntemporary file upon the context manager exit.\n\nOpening the temporary file again by its name while it is still open\nworks as follows:\n\n* On POSIX the file can always be opened again.\n\n* On Windows, make sure that at least one of the following\nconditions are fulfilled:\n\n* 'delete' is false\n\n* additional open shares delete access (e.g.  by calling\n*note os.open(): bee. with the flag 'OTEMPORARY')\n\n* 'delete' is true but 'deleteonclose' is false.  Note,\nthat in this case the additional opens that do not share\ndelete access (e.g.  created via builtin *note open():\n26e.) must be closed before exiting the context manager,\nelse the *note os.unlink(): f66. call on context manager\nexit will fail with a *note PermissionError: b9a.\n\nOn Windows, if 'deleteonclose' is false, and the file is created\nin a directory for which the user lacks delete access, then the\n*note os.unlink(): f66. call on exit of the context manager will\nfail with a *note PermissionError: b9a.  This cannot happen when\n'deleteonclose' is true because delete access is requested by the\nopen, which fails immediately if the requested access is not\ngranted.\n\nOn POSIX (only), a process that is terminated abruptly with SIGKILL\ncannot automatically delete any NamedTemporaryFiles it created.\n\nRaises an *note auditing event: 161d. 'tempfile.mkstemp' with\nargument 'fullpath'.\n\nChanged in version 3.8: Added 'errors' parameter.\n\nChanged in version 3.12: Added 'deleteonclose' parameter.\n\n-- Class: tempfile.SpooledTemporaryFile (maxsize=0, mode='w+b',\nbuffering=-1, encoding=None, newline=None, suffix=None,\nprefix=None, dir=None, *, errors=None)\n\nThis class operates exactly as *note TemporaryFile(): 253f. does,\nexcept that data is spooled in memory until the file size exceeds\n'maxsize', or until the file's *note fileno(): 2542. method is\ncalled, at which point the contents are written to disk and\noperation proceeds as with *note TemporaryFile(): 253f.\n\n-- Method: rollover ()\n\nThe resulting file has one additional method, 'rollover()',\nwhich causes the file to roll over to an on-disk file\nregardless of its size.\n\nThe returned object is a file-like object whose 'file' attribute\nis either an *note io.BytesIO: d08. or *note io.TextIOWrapper: b8f.\nobject (depending on whether binary or text 'mode' was specified)\nor a true file object, depending on whether *note rollover(): 2543.\nhas been called.  This file-like object can be used in a *note\nwith: 396. statement, just like a normal file.\n\nChanged in version 3.3: the truncate method now accepts a 'size'\nargument.\n\nChanged in version 3.8: Added 'errors' parameter.\n\nChanged in version 3.11: Fully implements the *note\nio.BufferedIOBase: 460. and *note io.TextIOBase: 461. abstract base\nclasses (depending on whether binary or text 'mode' was specified).\n\n-- Class: tempfile.TemporaryDirectory (suffix=None, prefix=None,\ndir=None, ignorecleanuperrors=False, *, delete=True)\n\nThis class securely creates a temporary directory using the same\nrules as *note mkdtemp(): 1eb.  The resulting object can be used as\na *note context manager: 398. (see *note Examples: 2541.).  On\ncompletion of the context or destruction of the temporary directory\nobject, the newly created temporary directory and all its contents\nare removed from the filesystem.\n\n-- Attribute: name\n\nThe directory name can be retrieved from the 'name' attribute\nof the returned object.  When the returned object is used as a\n*note context manager: 398, the 'name' will be assigned to the\ntarget of the 'as' clause in the *note with: 396. statement,\nif there is one.\n\n-- Method: cleanup ()\n\nThe directory can be explicitly cleaned up by calling the\n'cleanup()' method.  If 'ignorecleanuperrors' is true, any\nunhandled exceptions during explicit or implicit cleanup (such\nas a *note PermissionError: b9a. removing open files on\nWindows) will be ignored, and the remaining removable items\ndeleted on a \"best-effort\" basis.  Otherwise, errors will be\nraised in whatever context cleanup occurs (the 'cleanup()'\ncall, exiting the context manager, when the object is\ngarbage-collected or during interpreter shutdown).\n\nThe 'delete' parameter can be used to disable cleanup of the\ndirectory tree upon exiting the context.  While it may seem unusual\nfor a context manager to disable the action taken when exiting the\ncontext, it can be useful during debugging or when you need your\ncleanup behavior to be conditional based on other logic.\n\nRaises an *note auditing event: 161d. 'tempfile.mkdtemp' with\nargument 'fullpath'.\n\nNew in version 3.2.\n\nChanged in version 3.10: Added 'ignorecleanuperrors' parameter.\n\nChanged in version 3.12: Added the 'delete' parameter.\n\n-- Function: tempfile.mkstemp (suffix=None, prefix=None, dir=None,\ntext=False)\n\nCreates a temporary file in the most secure manner possible.  There\nare no race conditions in the file's creation, assuming that the\nplatform properly implements the *note os.OEXCL: 2546. flag for\n*note os.open(): bee.  The file is readable and writable only by\nthe creating user ID. If the platform uses permission bits to\nindicate whether a file is executable, the file is executable by no\none.  The file descriptor is not inherited by child processes.\n\nUnlike *note TemporaryFile(): 253f, the user of *note mkstemp():\n2540. is responsible for deleting the temporary file when done with\nit.\n\nIf 'suffix' is not 'None', the file name will end with that suffix,\notherwise there will be no suffix.  *note mkstemp(): 2540. does not\nput a dot between the file name and the suffix; if you need one,\nput it at the beginning of 'suffix'.\n\nIf 'prefix' is not 'None', the file name will begin with that\nprefix; otherwise, a default prefix is used.  The default is the\nreturn value of *note gettempprefix(): 2547. or *note\ngettempprefixb(): 2548, as appropriate.\n\nIf 'dir' is not 'None', the file will be created in that directory;\notherwise, a default directory is used.  The default directory is\nchosen from a platform-dependent list, but the user of the\napplication can control the directory location by setting the\n'TMPDIR', 'TEMP' or 'TMP' environment variables.  There is thus no\nguarantee that the generated filename will have any nice\nproperties, such as not requiring quoting when passed to external\ncommands via 'os.popen()'.\n\nIf any of 'suffix', 'prefix', and 'dir' are not 'None', they must\nbe the same type.  If they are bytes, the returned name will be\nbytes instead of str.  If you want to force a bytes return value\nwith otherwise default behavior, pass 'suffix=b'''.\n\nIf 'text' is specified and true, the file is opened in text mode.\nOtherwise, (the default) the file is opened in binary mode.\n\n*note mkstemp(): 2540. returns a tuple containing an OS-level\nhandle to an open file (as would be returned by *note os.open():\nbee.) and the absolute pathname of that file, in that order.\n\nRaises an *note auditing event: 161d. 'tempfile.mkstemp' with\nargument 'fullpath'.\n\nChanged in version 3.5: 'suffix', 'prefix', and 'dir' may now be\nsupplied in bytes in order to obtain a bytes return value.  Prior\nto this, only str was allowed.  'suffix' and 'prefix' now accept\nand default to 'None' to cause an appropriate default value to be\nused.\n\nChanged in version 3.6: The 'dir' parameter now accepts a *note\npath-like object: 957.\n\n-- Function: tempfile.mkdtemp (suffix=None, prefix=None, dir=None)\n\nCreates a temporary directory in the most secure manner possible.\nThere are no race conditions in the directory's creation.  The\ndirectory is readable, writable, and searchable only by the\ncreating user ID.\n\nThe user of *note mkdtemp(): 1eb. is responsible for deleting the\ntemporary directory and its contents when done with it.\n\nThe 'prefix', 'suffix', and 'dir' arguments are the same as for\n*note mkstemp(): 2540.\n\n*note mkdtemp(): 1eb. returns the absolute pathname of the new\ndirectory.\n\nRaises an *note auditing event: 161d. 'tempfile.mkdtemp' with\nargument 'fullpath'.\n\nChanged in version 3.5: 'suffix', 'prefix', and 'dir' may now be\nsupplied in bytes in order to obtain a bytes return value.  Prior\nto this, only str was allowed.  'suffix' and 'prefix' now accept\nand default to 'None' to cause an appropriate default value to be\nused.\n\nChanged in version 3.6: The 'dir' parameter now accepts a *note\npath-like object: 957.\n\nChanged in version 3.12: *note mkdtemp(): 1eb. now always returns\nan absolute path, even if 'dir' is relative.\n\n-- Function: tempfile.gettempdir ()\n\nReturn the name of the directory used for temporary files.  This\ndefines the default value for the 'dir' argument to all functions\nin this module.\n\nPython searches a standard list of directories to find one which\nthe calling user can create files in.  The list is:\n\n1. The directory named by the 'TMPDIR' environment variable.\n\n2. The directory named by the 'TEMP' environment variable.\n\n3. The directory named by the 'TMP' environment variable.\n\n4. A platform-specific location:\n\n* On Windows, the directories 'C:\\TEMP', 'C:\\TMP', '\\TEMP',\nand '\\TMP', in that order.\n\n* On all other platforms, the directories '/tmp',\n'/var/tmp', and '/usr/tmp', in that order.\n\n5. As a last resort, the current working directory.\n\nThe result of this search is cached, see the description of *note\ntempdir: 163d. below.\n\nChanged in version 3.10: Always returns a str.  Previously it would\nreturn any *note tempdir: 163d. value regardless of type so long as\nit was not 'None'.\n\n-- Function: tempfile.gettempdirb ()\n\nSame as *note gettempdir(): 163e. but the return value is in bytes.\n\nNew in version 3.5.\n\n-- Function: tempfile.gettempprefix ()\n\nReturn the filename prefix used to create temporary files.  This\ndoes not contain the directory component.\n\n-- Function: tempfile.gettempprefixb ()\n\nSame as *note gettempprefix(): 2547. but the return value is in\nbytes.\n\nNew in version 3.5.\n",
            "subsections": []
        },
        "The module uses a global variable to store the name of the directory": {
            "content": "used for temporary files returned by *note gettempdir(): 163e.  It can\nbe set directly to override the selection process, but this is\ndiscouraged.  All functions in this module take a 'dir' argument which\ncan be used to specify the directory.  This is the recommended approach\nthat does not surprise other unsuspecting code by changing global API\nbehavior.\n\n-- Data: tempfile.tempdir\n\nWhen set to a value other than 'None', this variable defines the\ndefault value for the 'dir' argument to the functions defined in\nthis module, including its type, bytes or str.  It cannot be a\n*note path-like object: 957.\n\nIf 'tempdir' is 'None' (the default) at any call to any of the\nabove functions except *note gettempprefix(): 2547. it is\ninitialized following the algorithm described in *note\ngettempdir(): 163e.\n\nNote: Beware that if you set 'tempdir' to a bytes value, there\nis a nasty side effect: The global default return type of\n*note mkstemp(): 2540. and *note mkdtemp(): 1eb. changes to\nbytes when no explicit 'prefix', 'suffix', or 'dir' arguments\nof type str are supplied.  Please do not write code expecting\nor depending on this.  This awkward behavior is maintained for\ncompatibility with the historical implementation.\n\n* Menu:\n\n* Examples: Examples<5>.\n* Deprecated functions and variables::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/tempfile.py\n\nFile: python3.12.info,  Node: Examples<5>,  Next: Deprecated functions and variables,  Up: tempfile -- Generate temporary files and directories\n\n5.11.6.1 Examples\n.................\n\nHere are some examples of typical usage of the *note tempfile: da.\nmodule:\n\n>>> import tempfile\n\n# create a temporary file and write some data to it\n>>> fp = tempfile.TemporaryFile()\n>>> fp.write(b'Hello world!')\n# read data from file\n>>> fp.seek(0)\n>>> fp.read()\nb'Hello world!'\n# close the file, it will be removed\n>>> fp.close()\n\n# create a temporary file using a context manager\n>>> with tempfile.TemporaryFile() as fp:\n...     fp.write(b'Hello world!')\n...     fp.seek(0)\n...     fp.read()\nb'Hello world!'\n>>>\n# file is now closed and removed\n\n# create a temporary file using a context manager\n# close the file, use the name to open the file again\n>>> with tempfile.NamedTemporaryFile(deleteonclose=False) as fp:\n...     fp.write(b'Hello world!')\n...     fp.close()\n... # the file is closed, but not removed\n... # open the file again by using its name\n...     with open(fp.name, mode='rb') as f:\n...         f.read()\nb'Hello world!'\n>>>\n# file is now removed\n\n# create a temporary directory using the context manager\n>>> with tempfile.TemporaryDirectory() as tmpdirname:\n...     print('created temporary directory', tmpdirname)\n>>>\n# directory and contents have been removed\n\nFile: python3.12.info,  Node: Deprecated functions and variables,  Prev: Examples<5>,  Up: tempfile -- Generate temporary files and directories\n\n5.11.6.2 Deprecated functions and variables\n...........................................\n\nA historical way to create temporary files was to first generate a file\nname with the *note mktemp(): 15f0. function and then create a file\nusing this name.  Unfortunately this is not secure, because a different\nprocess may create a file with this name in the time between the call to\n*note mktemp(): 15f0. and the subsequent attempt to create the file by\nthe first process.  The solution is to combine the two steps and create\nthe file immediately.  This approach is used by *note mkstemp(): 2540.\nand the other functions described above.\n\n-- Function: tempfile.mktemp (suffix='', prefix='tmp', dir=None)\n\nDeprecated since version 2.3: Use *note mkstemp(): 2540. instead.\n\nReturn an absolute pathname of a file that did not exist at the\ntime the call is made.  The 'prefix', 'suffix', and 'dir' arguments\nare similar to those of *note mkstemp(): 2540, except that bytes\nfile names, 'suffix=None' and 'prefix=None' are not supported.\n\nWarning: Use of this function may introduce a security hole in\nyour program.  By the time you get around to doing anything\nwith the file name it returns, someone else may have beaten\nyou to the punch.  *note mktemp(): 15f0. usage can be replaced\neasily with *note NamedTemporaryFile(): 1ea, passing it the\n'delete=False' parameter:\n\n>>> f = NamedTemporaryFile(delete=False)\n>>> f.name\n'/tmp/tmptjujjt'\n>>> f.write(b\"Hello World!\\n\")\n13\n>>> f.close()\n>>> os.unlink(f.name)\n>>> os.path.exists(f.name)\nFalse\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: glob -- Unix style pathname pattern expansion,  Next: fnmatch -- Unix filename pattern matching,  Prev: tempfile -- Generate temporary files and directories,  Up: File and Directory Access": {
            "content": "'Source code:' Lib/glob.py(1)\n\n\n\nThe *note glob: 5f. module finds all the pathnames matching a specified\npattern according to the rules used by the Unix shell, although results\nare returned in arbitrary order.  No tilde expansion is done, but '*',\n'?', and character ranges expressed with '[]' will be correctly matched.\nThis is done by using the *note os.scandir(): 88c. and *note\nfnmatch.fnmatch(): 1601. functions in concert, and not by actually\ninvoking a subshell.\n",
            "subsections": []
        },
        "Note that files beginning with a dot ('.') can only be matched by": {
            "content": "patterns that also start with a dot, unlike *note fnmatch.fnmatch():\n1601. or *note pathlib.Path.glob(): 1cc.  (For tilde and shell variable\nexpansion, use *note os.path.expanduser(): 83d. and *note\nos.path.expandvars(): 122e.)\n",
            "subsections": []
        },
        "For a literal match, wrap the meta-characters in brackets.  For example,": {
            "content": "''[?]'' matches the character ''?''.\n",
            "subsections": []
        },
        "If the directory contains files starting with '.' they won't be matched": {
            "content": "by default.  For example, consider a directory containing 'card.gif' and\n'.card.gif':\n\n>>> import glob\n>>> glob.glob('*.gif')\n['card.gif']\n>>> glob.glob('.c*')\n['.card.gif']\n\nSee also\n........\n\nModule *note fnmatch: 57.\n\nShell-style filename (not path) expansion\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/glob.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: fnmatch -- Unix filename pattern matching,  Next: linecache -- Random access to text lines,  Prev: glob -- Unix style pathname pattern expansion,  Up: File and Directory Access": {
            "content": "'Source code:' Lib/fnmatch.py(1)\n\n\n",
            "subsections": []
        },
        "This module provides support for Unix shell-style wildcards, which are": {
            "content": "'not' the same as regular expressions (which are documented in the *note\nre: b4. module).  The special characters used in shell-style wildcards\nare:\n",
            "subsections": []
        },
        "Pattern          Meaning": {
            "content": "----------------------------------------------------------\n\n'*'              matches everything\n\n\n'?'              matches any single character\n\n\n'[seq]'          matches any character in 'seq'\n\n\n'[!seq]'         matches any character not in 'seq'\n\n",
            "subsections": []
        },
        "Note that the filename separator (''/'' on Unix) is 'not' special to": {
            "content": "this module.  See module *note glob: 5f. for pathname expansion (*note\nglob: 5f. uses *note filter(): 1603. to match pathname segments).",
            "subsections": []
        },
        "Similarly, filenames starting with a period are not special for this": {
            "content": "module, and are matched by the '*' and '?' patterns.\n\nAlso note that *note functools.lrucache(): 815. with the 'maxsize' of\n32768 is used to cache the compiled regex patterns in the following\nfunctions: *note fnmatch(): 57, *note fnmatchcase(): 1602, *note\nfilter(): 1603.\n\n-- Function: fnmatch.fnmatch (name, pat)\n\nTest whether the filename string 'name' matches the pattern string\n'pat', returning 'True' or 'False'.  Both parameters are\ncase-normalized using *note os.path.normcase(): 24ce.  *note\nfnmatchcase(): 1602. can be used to perform a case-sensitive\ncomparison, regardless of whether that's standard for the operating\nsystem.\n\nThis example will print all file names in the current directory\nwith the extension '.txt':\n\nimport fnmatch\nimport os\n\nfor file in os.listdir('.'):\nif fnmatch.fnmatch(file, '*.txt'):\nprint(file)\n\n-- Function: fnmatch.fnmatchcase (name, pat)\n\nTest whether the filename string 'name' matches the pattern string\n'pat', returning 'True' or 'False'; the comparison is\ncase-sensitive and does not apply *note os.path.normcase(): 24ce.\n\n-- Function: fnmatch.filter (names, pat)\n\nConstruct a list from those elements of the *note iterable: 109d.\n'names' that match pattern 'pat'.  It is the same as '[n for n in\nnames if fnmatch(n, pat)]', but implemented more efficiently.\n\n-- Function: fnmatch.translate (pat)\n\nReturn the shell-style pattern 'pat' converted to a regular\nexpression for using with *note re.match(): 10a3.\n\nExample:\n\n>>> import fnmatch, re\n>>>\n>>> regex = fnmatch.translate('*.txt')\n>>> regex\n'(?s:.*\\\\.txt)\\\\Z'\n>>> reobj = re.compile(regex)\n>>> reobj.match('foobar.txt')\n<re.Match object; span=(0, 10), match='foobar.txt'>\n\nSee also\n........\n\nModule *note glob: 5f.\n\nUnix shell-style path expansion.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/fnmatch.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: linecache -- Random access to text lines,  Next: shutil -- High-level file operations,  Prev: fnmatch -- Unix filename pattern matching,  Up: File and Directory Access": {
            "content": "'Source code:' Lib/linecache.py(1)\n\n\n\nThe *note linecache: 80. module allows one to get any line from a Python\nsource file, while attempting to optimize internally, using a cache, the\ncommon case where many lines are read from a single file.  This is used\nby the *note traceback: f9. module to retrieve source lines for\ninclusion in the formatted traceback.\n\nThe *note tokenize.open(): 2552. function is used to open files.  This\nfunction uses *note tokenize.detectencoding(): 2553. to get the\nencoding of the file; in the absence of an encoding token, the file\nencoding defaults to UTF-8.\n\nThe *note linecache: 80. module defines the following functions:\n\n-- Function: linecache.getline (filename, lineno, moduleglobals=None)\n\nGet line 'lineno' from file named 'filename'.  This function will\nnever raise an exception -- it will return '''' on errors (the\nterminating newline character will be included for lines that are\nfound).\n\nIf a file named 'filename' is not found, the function first checks\nfor a PEP 302(2) 'loader' in 'moduleglobals'.  If there is\nsuch a loader and it defines a 'getsource' method, then that\ndetermines the source lines (if 'getsource()' returns 'None', then\n'''' is returned).  Finally, if 'filename' is a relative filename,\nit is looked up relative to the entries in the module search path,\n'sys.path'.\n\n-- Function: linecache.clearcache ()\n\nClear the cache.  Use this function if you no longer need lines\nfrom files previously read using *note getline(): c82.\n\n-- Function: linecache.checkcache (filename=None)\n\nCheck the cache for validity.  Use this function if files in the\ncache may have changed on disk, and you require the updated\nversion.  If 'filename' is omitted, it will check all the entries\nin the cache.\n\n-- Function: linecache.lazycache (filename, moduleglobals)\n\nCapture enough detail about a non-file-based module to permit\ngetting its lines later via *note getline(): c82. even if\n'moduleglobals' is 'None' in the later call.  This avoids doing\nI/O until a line is actually needed, without having to carry the\nmodule globals around indefinitely.\n\nNew in version 3.5.\n\nExample:\n\n>>> import linecache\n>>> linecache.getline(linecache.file, 8)\n'import sys\\n'\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/linecache.py\n\n(2) https://peps.python.org/pep-0302/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: shutil -- High-level file operations,  Prev: linecache -- Random access to text lines,  Up: File and Directory Access": {
            "content": "'Source code:' Lib/shutil.py(1)\n\n\n\nThe *note shutil: c0. module offers a number of high-level operations on\nfiles and collections of files.  In particular, functions are provided\nwhich support file copying and removal.  For operations on individual\nfiles, see also the *note os: 9c. module.\n\nWarning: Even the higher-level file copying functions (*note\nshutil.copy(): 887, *note shutil.copy2(): 888.) cannot copy all\nfile metadata.\n\nOn POSIX platforms, this means that file owner and group are lost\nas well as ACLs.  On Mac OS, the resource fork and other metadata\nare not used.  This means that resources will be lost and file type\nand creator codes will not be correct.  On Windows, file owners,\nACLs and alternate data streams are not copied.\n\n* Menu:\n\n* Directory and files operations::\n* Archiving operations::\n* Querying the size of the output terminal::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/shutil.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Directory and files operations,  Next: Archiving operations,  Up: shutil -- High-level file operations": {
            "content": "5.11.10.1 Directory and files operations\n........................................\n\n-- Function: shutil.copyfileobj (fsrc, fdst[, length])\n\nCopy the contents of the *note file-like object: 1037. 'fsrc' to\nthe file-like object 'fdst'.  The integer 'length', if given, is\nthe buffer size.  In particular, a negative 'length' value means to\ncopy the data without looping over the source data in chunks; by\ndefault the data is read in chunks to avoid uncontrolled memory\nconsumption.  Note that if the current file position of the 'fsrc'\nobject is not 0, only the contents from the current file position\nto the end of the file will be copied.\n\n-- Function: shutil.copyfile (src, dst, *, followsymlinks=True)\n\nCopy the contents (no metadata) of the file named 'src' to a file\nnamed 'dst' and return 'dst' in the most efficient way possible.\n'src' and 'dst' are *note path-like objects: 957. or path names\ngiven as strings.\n\n'dst' must be the complete target file name; look at *note copy():\n887. for a copy that accepts a target directory path.  If 'src' and\n'dst' specify the same file, *note SameFileError: e0d. is raised.\n\nThe destination location must be writable; otherwise, an *note\nOSError: 613. exception will be raised.  If 'dst' already exists,\nit will be replaced.  Special files such as character or block\ndevices and pipes cannot be copied with this function.\n\nIf 'followsymlinks' is false and 'src' is a symbolic link, a new\nsymbolic link will be created instead of copying the file 'src'\npoints to.\n\nRaises an *note auditing event: 161d. 'shutil.copyfile' with\narguments 'src', 'dst'.\n\nChanged in version 3.3: *note IOError: ecb. used to be raised\ninstead of *note OSError: 613.  Added 'followsymlinks' argument.\nNow returns 'dst'.\n\nChanged in version 3.4: Raise *note SameFileError: e0d. instead of\n*note Error: e0c.  Since the former is a subclass of the latter,\nthis change is backward compatible.\n\nChanged in version 3.8: Platform-specific fast-copy syscalls may be\nused internally in order to copy the file more efficiently.  See\n*note Platform-dependent efficient copy operations: 88b. section.\n\n-- Exception: shutil.SameFileError\n\nThis exception is raised if source and destination in *note\ncopyfile(): 886. are the same file.\n\nNew in version 3.4.\n\n-- Function: shutil.copymode (src, dst, *, followsymlinks=True)\n\nCopy the permission bits from 'src' to 'dst'.  The file contents,\nowner, and group are unaffected.  'src' and 'dst' are *note\npath-like objects: 957. or path names given as strings.  If\n'followsymlinks' is false, and both 'src' and 'dst' are symbolic\nlinks, *note copymode(): 13cc. will attempt to modify the mode of\n'dst' itself (rather than the file it points to).  This\nfunctionality is not available on every platform; please see *note\ncopystat(): fa0. for more information.  If *note copymode(): 13cc.\ncannot modify symbolic links on the local platform, and it is asked\nto do so, it will do nothing and return.\n\nRaises an *note auditing event: 161d. 'shutil.copymode' with\narguments 'src', 'dst'.\n\nChanged in version 3.3: Added 'followsymlinks' argument.\n\n-- Function: shutil.copystat (src, dst, *, followsymlinks=True)\n\nCopy the permission bits, last access time, last modification time,\nand flags from 'src' to 'dst'.  On Linux, *note copystat(): fa0.\nalso copies the \"extended attributes\" where possible.  The file\ncontents, owner, and group are unaffected.  'src' and 'dst' are\n*note path-like objects: 957. or path names given as strings.\n\nIf 'followsymlinks' is false, and 'src' and 'dst' both refer to\nsymbolic links, *note copystat(): fa0. will operate on the symbolic\nlinks themselves rather than the files the symbolic links refer\nto--reading the information from the 'src' symbolic link, and\nwriting the information to the 'dst' symbolic link.\n\nNote: Not all platforms provide the ability to examine and\nmodify symbolic links.  Python itself can tell you what\nfunctionality is locally available.\n\n* If 'os.chmod in os.supportsfollowsymlinks' is 'True',\n*note copystat(): fa0. can modify the permission bits of\na symbolic link.\n\n* If 'os.utime in os.supportsfollowsymlinks' is 'True',\n*note copystat(): fa0. can modify the last access and\nmodification times of a symbolic link.\n\n* If 'os.chflags in os.supportsfollowsymlinks' is 'True',\n*note copystat(): fa0. can modify the flags of a symbolic\nlink.  ('os.chflags' is not available on all platforms.)\n\nOn platforms where some or all of this functionality is\nunavailable, when asked to modify a symbolic link, *note\ncopystat(): fa0. will copy everything it can.  *note\ncopystat(): fa0. never returns failure.\n\nPlease see *note os.supportsfollowsymlinks: 255a. for more\ninformation.\n\nRaises an *note auditing event: 161d. 'shutil.copystat' with\narguments 'src', 'dst'.\n\nChanged in version 3.3: Added 'followsymlinks' argument and\nsupport for Linux extended attributes.\n\n-- Function: shutil.copy (src, dst, *, followsymlinks=True)\n\nCopies the file 'src' to the file or directory 'dst'.  'src' and\n'dst' should be *note path-like objects: 957. or strings.  If 'dst'\nspecifies a directory, the file will be copied into 'dst' using the\nbase filename from 'src'.  If 'dst' specifies a file that already\nexists, it will be replaced.  Returns the path to the newly created\nfile.\n\nIf 'followsymlinks' is false, and 'src' is a symbolic link, 'dst'\nwill be created as a symbolic link.  If 'followsymlinks' is true\nand 'src' is a symbolic link, 'dst' will be a copy of the file\n'src' refers to.\n\n*note copy(): 887. copies the file data and the file's permission\nmode (see *note os.chmod(): f5d.).  Other metadata, like the file's\ncreation and modification times, is not preserved.  To preserve all\nfile metadata from the original, use *note copy2(): 888. instead.\n\nRaises an *note auditing event: 161d. 'shutil.copyfile' with\narguments 'src', 'dst'.\n\nRaises an *note auditing event: 161d. 'shutil.copymode' with\narguments 'src', 'dst'.\n\nChanged in version 3.3: Added 'followsymlinks' argument.  Now\nreturns path to the newly created file.\n\nChanged in version 3.8: Platform-specific fast-copy syscalls may be\nused internally in order to copy the file more efficiently.  See\n*note Platform-dependent efficient copy operations: 88b. section.\n\n-- Function: shutil.copy2 (src, dst, *, followsymlinks=True)\n\nIdentical to *note copy(): 887. except that *note copy2(): 888.\nalso attempts to preserve file metadata.\n\nWhen 'followsymlinks' is false, and 'src' is a symbolic link,\n*note copy2(): 888. attempts to copy all metadata from the 'src'\nsymbolic link to the newly created 'dst' symbolic link.  However,\nthis functionality is not available on all platforms.  On platforms\nwhere some or all of this functionality is unavailable, *note\ncopy2(): 888. will preserve all the metadata it can; *note copy2():\n888. never raises an exception because it cannot preserve file\nmetadata.\n\n*note copy2(): 888. uses *note copystat(): fa0. to copy the file\nmetadata.  Please see *note copystat(): fa0. for more information\nabout platform support for modifying symbolic link metadata.\n\nRaises an *note auditing event: 161d. 'shutil.copyfile' with\narguments 'src', 'dst'.\n\nRaises an *note auditing event: 161d. 'shutil.copystat' with\narguments 'src', 'dst'.\n\nChanged in version 3.3: Added 'followsymlinks' argument, try to\ncopy extended file system attributes too (currently Linux only).\nNow returns path to the newly created file.\n\nChanged in version 3.8: Platform-specific fast-copy syscalls may be\nused internally in order to copy the file more efficiently.  See\n*note Platform-dependent efficient copy operations: 88b. section.\n\n-- Function: shutil.ignorepatterns (*patterns)\n\nThis factory function creates a function that can be used as a\ncallable for *note copytree(): 854.'s 'ignore' argument, ignoring\nfiles and directories that match one of the glob-style 'patterns'\nprovided.  See the example below.\n\n-- Function: shutil.copytree (src, dst, symlinks=False, ignore=None,\ncopyfunction=copy2, ignoredanglingsymlinks=False,\ndirsexistok=False)\n\nRecursively copy an entire directory tree rooted at 'src' to a\ndirectory named 'dst' and return the destination directory.  All\nintermediate directories needed to contain 'dst' will also be\ncreated by default.\n\nPermissions and times of directories are copied with *note\ncopystat(): fa0, individual files are copied using *note copy2():\n888.\n\nIf 'symlinks' is true, symbolic links in the source tree are\nrepresented as symbolic links in the new tree and the metadata of\nthe original links will be copied as far as the platform allows; if\nfalse or omitted, the contents and metadata of the linked files are\ncopied to the new tree.\n\nWhen 'symlinks' is false, if the file pointed by the symlink\ndoesn't exist, an exception will be added in the list of errors\nraised in an *note Error: e0c. exception at the end of the copy\nprocess.  You can set the optional 'ignoredanglingsymlinks' flag\nto true if you want to silence this exception.  Notice that this\noption has no effect on platforms that don't support *note\nos.symlink(): f65.\n\nIf 'ignore' is given, it must be a callable that will receive as\nits arguments the directory being visited by *note copytree(): 854,\nand a list of its contents, as returned by *note os.listdir(): f6a.\nSince *note copytree(): 854. is called recursively, the 'ignore'\ncallable will be called once for each directory that is copied.\nThe callable must return a sequence of directory and file names\nrelative to the current directory (i.e.  a subset of the items in\nits second argument); these names will then be ignored in the copy\nprocess.  *note ignorepatterns(): 255b. can be used to create such\na callable that ignores names based on glob-style patterns.\n\nIf exception(s) occur, an *note Error: e0c. is raised with a list\nof reasons.\n\nIf 'copyfunction' is given, it must be a callable that will be\nused to copy each file.  It will be called with the source path and\nthe destination path as arguments.  By default, *note copy2(): 888.\nis used, but any function that supports the same signature (like\n*note copy(): 887.) can be used.\n\nIf 'dirsexistok' is false (the default) and 'dst' already exists,\na *note FileExistsError: e97. is raised.  If 'dirsexistok' is\ntrue, the copying operation will continue if it encounters existing\ndirectories, and files within the 'dst' tree will be overwritten by\ncorresponding files from the 'src' tree.\n\nRaises an *note auditing event: 161d. 'shutil.copytree' with\narguments 'src', 'dst'.\n\nChanged in version 3.2: Added the 'copyfunction' argument to be\nable to provide a custom copy function.  Added the\n'ignoredanglingsymlinks' argument to silence dangling symlinks\nerrors when 'symlinks' is false.\n\nChanged in version 3.3: Copy metadata when 'symlinks' is false.\nNow returns 'dst'.\n\nChanged in version 3.8: Platform-specific fast-copy syscalls may be\nused internally in order to copy the file more efficiently.  See\n*note Platform-dependent efficient copy operations: 88b. section.\n\nChanged in version 3.8: Added the 'dirsexistok' parameter.\n\n-- Function: shutil.rmtree (path, ignoreerrors=False, onerror=None, *,\nonexc=None, dirfd=None)\n\nDelete an entire directory tree; 'path' must point to a directory\n(but not a symbolic link to a directory).  If 'ignoreerrors' is\ntrue, errors resulting from failed removals will be ignored; if\nfalse or omitted, such errors are handled by calling a handler\nspecified by 'onexc' or 'onerror' or, if both are omitted,\nexceptions are propagated to the caller.\n\nThis function can support *note paths relative to directory\ndescriptors: f59.\n\nNote: On platforms that support the necessary fd-based\nfunctions a symlink attack resistant version of *note\nrmtree(): 1d5. is used by default.  On other platforms, the\n*note rmtree(): 1d5. implementation is susceptible to a\nsymlink attack: given proper timing and circumstances,\nattackers can manipulate symlinks on the filesystem to delete\nfiles they wouldn't be able to access otherwise.  Applications\ncan use the *note rmtree.avoidssymlinkattacks: 255c.\nfunction attribute to determine which case applies.\n\nIf 'onexc' is provided, it must be a callable that accepts three\nparameters: 'function', 'path', and 'excinfo'.\n\nThe first parameter, 'function', is the function which raised the\nexception; it depends on the platform and implementation.  The\nsecond parameter, 'path', will be the path name passed to\n'function'.  The third parameter, 'excinfo', is the exception that\nwas raised.  Exceptions raised by 'onexc' will not be caught.\n\nThe deprecated 'onerror' is similar to 'onexc', except that the\nthird parameter it receives is the tuple returned from *note\nsys.excinfo(): 456.\n\nRaises an *note auditing event: 161d. 'shutil.rmtree' with\narguments 'path', 'dirfd'.\n\nChanged in version 3.3: Added a symlink attack resistant version\nthat is used automatically if platform supports fd-based functions.\n\nChanged in version 3.8: On Windows, will no longer delete the\ncontents of a directory junction before removing the junction.\n\nChanged in version 3.11: The 'dirfd' parameter.\n\nChanged in version 3.12: Added the 'onexc' parameter, deprecated\n'onerror'.\n\n-- Attribute: rmtree.avoidssymlinkattacks\n\nIndicates whether the current platform and implementation\nprovides a symlink attack resistant version of *note rmtree():\n1d5.  Currently this is only true for platforms supporting\nfd-based directory access functions.\n\nNew in version 3.3.\n\n-- Function: shutil.move (src, dst, copyfunction=copy2)\n\nRecursively move a file or directory ('src') to another location\nand return the destination.\n\nIf 'dst' is an existing directory or a symlink to a directory, then\n'src' is moved inside that directory.  The destination path in that\ndirectory must not already exist.\n\nIf 'dst' already exists but is not a directory, it may be\noverwritten depending on *note os.rename(): f62. semantics.\n\nIf the destination is on the current filesystem, then *note\nos.rename(): f62. is used.  Otherwise, 'src' is copied to the\ndestination using 'copyfunction' and then removed.  In case of\nsymlinks, a new symlink pointing to the target of 'src' will be\ncreated as the destination and 'src' will be removed.\n\nIf 'copyfunction' is given, it must be a callable that takes two\narguments, 'src' and the destination, and will be used to copy\n'src' to the destination if *note os.rename(): f62. cannot be used.\nIf the source is a directory, *note copytree(): 854. is called,\npassing it the 'copyfunction'.  The default 'copyfunction' is\n*note copy2(): 888.  Using *note copy(): 887. as the\n'copyfunction' allows the move to succeed when it is not possible\nto also copy the metadata, at the expense of not copying any of the\nmetadata.\n\nRaises an *note auditing event: 161d. 'shutil.move' with arguments\n'src', 'dst'.\n\nChanged in version 3.3: Added explicit symlink handling for foreign\nfilesystems, thus adapting it to the behavior of GNU's 'mv'.  Now\nreturns 'dst'.\n\nChanged in version 3.5: Added the 'copyfunction' keyword argument.\n\nChanged in version 3.8: Platform-specific fast-copy syscalls may be\nused internally in order to copy the file more efficiently.  See\n*note Platform-dependent efficient copy operations: 88b. section.\n\nChanged in version 3.9: Accepts a *note path-like object: 957. for\nboth 'src' and 'dst'.\n\n-- Function: shutil.diskusage (path)\n\nReturn disk usage statistics about the given path as a *note named\ntuple: 417. with the attributes 'total', 'used' and 'free', which\nare the amount of total, used and free space, in bytes.  'path' may\nbe a file or a directory.\n\nNote: On Unix filesystems, 'path' must point to a path within\na 'mounted' filesystem partition.  On those platforms, CPython\ndoesn't attempt to retrieve disk usage information from\nnon-mounted filesystems.\n\nNew in version 3.3.\n\nChanged in version 3.8: On Windows, 'path' can now be a file or\ndirectory.\n\n*note Availability: 1ad3.: Unix, Windows.\n\n-- Function: shutil.chown (path, user=None, group=None)\n\nChange owner 'user' and/or 'group' of the given 'path'.\n\n'user' can be a system user name or a uid; the same applies to\n'group'.  At least one argument is required.\n\nSee also *note os.chown(): f5e, the underlying function.\n\nRaises an *note auditing event: 161d. 'shutil.chown' with arguments\n'path', 'user', 'group'.\n\n*note Availability: 1ad3.: Unix.\n\nNew in version 3.3.\n\n-- Function: shutil.which (cmd, mode=os.FOK | os.XOK, path=None)\n\nReturn the path to an executable which would be run if the given\n'cmd' was called.  If no 'cmd' would be called, return 'None'.\n\n'mode' is a permission mask passed to *note os.access(): f5b, by\ndefault determining if the file exists and executable.\n\nWhen no 'path' is specified, the results of *note os.environ():\n102e. are used, returning either the \"PATH\" value or a fallback of\n*note os.defpath: 177a.\n\nOn Windows, the current directory is prepended to the 'path' if\n'mode' does not include 'os.XOK'.  When the 'mode' does include\n'os.XOK', the Windows API 'NeedCurrentDirectoryForExePathW' will\nbe consulted to determine if the current directory should be\nprepended to 'path'.  To avoid consulting the current working\ndirectory for executables: set the environment variable\n'NoDefaultCurrentDirectoryInExePath'.\n\nAlso on Windows, the 'PATHEXT' variable is used to resolve commands\nthat may not already include an extension.  For example, if you\ncall 'shutil.which(\"python\")', *note which(): 1d6. will search\n'PATHEXT' to know that it should look for 'python.exe' within the\n'path' directories.  For example, on Windows:\n\n>>> shutil.which(\"python\")\n'C:\\\\Python33\\\\python.EXE'\n\nThis is also applied when 'cmd' is a path that contains a directory\ncomponent:\n\n>> shutil.which(\"C:\\\\Python33\\\\python\")\n'C:\\\\Python33\\\\python.EXE'\n\nNew in version 3.3.\n\nChanged in version 3.8: The *note bytes: 295. type is now accepted.\nIf 'cmd' type is *note bytes: 295, the result type is also *note\nbytes: 295.\n\nChanged in version 3.12: On Windows, the current directory is no\nlonger prepended to the search path if 'mode' includes 'os.XOK'\nand WinAPI 'NeedCurrentDirectoryForExePathW(cmd)' is false, else\nthe current directory is prepended even if it is already in the\nsearch path; 'PATHEXT' is used now even when 'cmd' includes a\ndirectory component or ends with an extension that is in 'PATHEXT';\nand filenames that have no extension can now be found.\n\nChanged in version 3.12.1: On Windows, if 'mode' includes\n'os.XOK', executables with an extension in 'PATHEXT' will be\npreferred over executables without a matching extension.  This\nbrings behavior closer to that of Python 3.11.\n\n-- Exception: shutil.Error\n\nThis exception collects exceptions that are raised during a\nmulti-file operation.  For *note copytree(): 854, the exception\nargument is a list of 3-tuples ('srcname', 'dstname', 'exception').\n\n* Menu:\n\n* Platform-dependent efficient copy operations::\n* copytree example::\n* rmtree example::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Platform-dependent efficient copy operations,  Next: copytree example,  Up: Directory and files operations": {
            "content": "5.11.10.2 Platform-dependent efficient copy operations\n......................................................\n\nStarting from Python 3.8, all functions involving a file copy (*note\ncopyfile(): 886, *note copy(): 887, *note copy2(): 888, *note\ncopytree(): 854, and *note move(): 889.) may use platform-specific\n\"fast-copy\" syscalls in order to copy the file more efficiently (see\nbpo-33671(1)).  \"fast-copy\" means that the copying operation occurs\nwithin the kernel, avoiding the use of userspace buffers in Python as in\n\"'outfd.write(infd.read())'\".\n\nOn macOS fcopyfile(2) is used to copy the file content (not metadata).\n\nOn Linux *note os.sendfile(): 946. is used.\n\nOn Windows *note shutil.copyfile(): 886. uses a bigger default buffer\nsize (1 MiB instead of 64 KiB) and a *note memoryview(): 17f.-based\nvariant of *note shutil.copyfileobj(): 88a. is used.\n",
            "subsections": []
        },
        "If the fast-copy operation fails and no data was written in the": {
            "content": "destination file then shutil will silently fallback on using less\nefficient *note copyfileobj(): 88a. function internally.\n\nChanged in version 3.8.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33671\n\n(2) http://www.manpagez.com/man/3/copyfile/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: copytree example,  Next: rmtree example,  Prev: Platform-dependent efficient copy operations,  Up: Directory and files operations": {
            "content": "5.11.10.3 copytree example\n..........................\n\nAn example that uses the *note ignorepatterns(): 255b. helper:\n\nfrom shutil import copytree, ignorepatterns\n\ncopytree(source, destination, ignore=ignorepatterns('*.pyc', 'tmp*'))\n",
            "subsections": []
        },
        "This will copy everything except '.pyc' files and files or directories": {
            "content": "whose name starts with 'tmp'.\n\nAnother example that uses the 'ignore' argument to add a logging call:\n\nfrom shutil import copytree\nimport logging\n\ndef logpath(path, names):\nlogging.info('Working in %s', path)\nreturn []   # nothing will be ignored\n\ncopytree(source, destination, ignore=logpath)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: rmtree example,  Prev: copytree example,  Up: Directory and files operations": {
            "content": "5.11.10.4 rmtree example\n........................\n",
            "subsections": []
        },
        "This example shows how to remove a directory tree on Windows where some": {
            "content": "of the files have their read-only bit set.  It uses the onexc callback\nto clear the readonly bit and reattempt the remove.  Any subsequent\nfailure will propagate.\n\nimport os, stat\nimport shutil\n\ndef removereadonly(func, path, ):\n\"Clear the readonly bit and reattempt the removal\"\nos.chmod(path, stat.SIWRITE)\nfunc(path)\n\nshutil.rmtree(directory, onexc=removereadonly)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Archiving operations,  Next: Querying the size of the output terminal,  Prev: Directory and files operations,  Up: shutil -- High-level file operations": {
            "content": "5.11.10.5 Archiving operations\n..............................\n\nNew in version 3.2.\n\nChanged in version 3.5: Added support for the 'xztar' format.\n",
            "subsections": []
        },
        "High-level utilities to create and read compressed and archived files": {
            "content": "are also provided.  They rely on the *note zipfile: 12b. and *note\ntarfile: d8. modules.\n\n-- Function: shutil.makearchive (basename, format[, rootdir[,\nbasedir[, verbose[, dryrun[, owner[, group[, logger]]]]]]])\n\nCreate an archive file (such as zip or tar) and return its name.\n\n'basename' is the name of the file to create, including the path,\nminus any format-specific extension.\n\n'format' is the archive format: one of \"zip\" (if the *note zlib:\n12d. module is available), \"tar\", \"gztar\" (if the *note zlib: 12d.\nmodule is available), \"bztar\" (if the *note bz2: 11. module is\navailable), or \"xztar\" (if the *note lzma: 85. module is\navailable).\n\n'rootdir' is a directory that will be the root directory of the\narchive, all paths in the archive will be relative to it; for\nexample, we typically chdir into 'rootdir' before creating the\narchive.\n\n'basedir' is the directory where we start archiving from; i.e.\n'basedir' will be the common prefix of all files and directories\nin the archive.  'basedir' must be given relative to 'rootdir'.\nSee *note Archiving example with basedir: 2563. for how to use\n'basedir' and 'rootdir' together.\n\n'rootdir' and 'basedir' both default to the current directory.\n\nIf 'dryrun' is true, no archive is created, but the operations\nthat would be executed are logged to 'logger'.\n\n'owner' and 'group' are used when creating a tar archive.  By\ndefault, uses the current owner and group.\n\n'logger' must be an object compatible with PEP 282(1), usually an\ninstance of *note logging.Logger: 98b.\n\nThe 'verbose' argument is unused and deprecated.\n\nRaises an *note auditing event: 161d. 'shutil.makearchive' with\narguments 'basename', 'format', 'rootdir', 'basedir'.\n\nNote: This function is not thread-safe when custom archivers\nregistered with *note registerarchiveformat(): 2564. do not\nsupport the 'rootdir' argument.  In this case it temporarily\nchanges the current working directory of the process to\n'rootdir' to perform archiving.\n\nChanged in version 3.8: The modern pax (POSIX.1-2001) format is now\nused instead of the legacy GNU format for archives created with\n'format=\"tar\"'.\n\nChanged in version 3.10.6: This function is now made thread-safe\nduring creation of standard '.zip' and tar archives.\n\n-- Function: shutil.getarchiveformats ()\n\nReturn a list of supported formats for archiving.  Each element of\nthe returned sequence is a tuple '(name, description)'.\n\nBy default *note shutil: c0. provides these formats:\n\n- 'zip': ZIP file (if the *note zlib: 12d. module is available).\n\n- 'tar': Uncompressed tar file.  Uses POSIX.1-2001 pax format\nfor new archives.\n\n- 'gztar': gzip'ed tar-file (if the *note zlib: 12d. module is\navailable).\n\n- 'bztar': bzip2'ed tar-file (if the *note bz2: 11. module is\navailable).\n\n- 'xztar': xz'ed tar-file (if the *note lzma: 85. module is\navailable).\n\nYou can register new formats or provide your own archiver for any\nexisting formats, by using *note registerarchiveformat(): 2564.\n\n-- Function: shutil.registerarchiveformat (name, function[,\nextraargs[, description]])\n\nRegister an archiver for the format 'name'.\n\n'function' is the callable that will be used to unpack archives.\nThe callable will receive the 'basename' of the file to create,\nfollowed by the 'basedir' (which defaults to *note os.curdir:\n24cf.) to start archiving from.  Further arguments are passed as\nkeyword arguments: 'owner', 'group', 'dryrun' and 'logger' (as\npassed in *note makearchive(): 1d4.).\n\nIf 'function' has the custom attribute 'function.supportsrootdir'\nset to 'True', the 'rootdir' argument is passed as a keyword\nargument.  Otherwise the current working directory of the process\nis temporarily changed to 'rootdir' before calling 'function'.  In\nthis case *note makearchive(): 1d4. is not thread-safe.\n\nIf given, 'extraargs' is a sequence of '(name, value)' pairs that\nwill be used as extra keywords arguments when the archiver callable\nis used.\n\n'description' is used by *note getarchiveformats(): 2565. which\nreturns the list of archivers.  Defaults to an empty string.\n\nChanged in version 3.12: Added support for functions supporting the\n'rootdir' argument.\n\n-- Function: shutil.unregisterarchiveformat (name)\n\nRemove the archive format 'name' from the list of supported\nformats.\n\n-- Function: shutil.unpackarchive (filename[, extractdir[, format[,\nfilter]]])\n\nUnpack an archive.  'filename' is the full path of the archive.\n\n'extractdir' is the name of the target directory where the archive\nis unpacked.  If not provided, the current working directory is\nused.\n\n'format' is the archive format: one of \"zip\", \"tar\", \"gztar\",\n\"bztar\", or \"xztar\".  Or any other format registered with *note\nregisterunpackformat(): 2567.  If not provided, *note\nunpackarchive(): 184. will use the archive file name extension and\nsee if an unpacker was registered for that extension.  In case none\nis found, a *note ValueError: 183. is raised.\n\nThe keyword-only 'filter' argument is passed to the underlying\nunpacking function.  For zip files, 'filter' is not accepted.  For\ntar files, it is recommended to set it to ''data'', unless using\nfeatures specific to tar and UNIX-like filesystems.  (See *note\nExtraction filters: 185. for details.)  The ''data'' filter will\nbecome the default for tar files in Python 3.14.\n\nRaises an *note auditing event: 161d. 'shutil.unpackarchive' with\narguments 'filename', 'extractdir', 'format'.\n\nWarning: Never extract archives from untrusted sources without\nprior inspection.  It is possible that files are created\noutside of the path specified in the 'extractdir' argument,\ne.g.  members that have absolute filenames starting with \"/\"\nor filenames with two dots \"..\".\n\nChanged in version 3.7: Accepts a *note path-like object: 957. for\n'filename' and 'extractdir'.\n\nChanged in version 3.12: Added the 'filter' argument.\n\n-- Function: shutil.registerunpackformat (name, extensions,\nfunction[, extraargs[, description]])\n\nRegisters an unpack format.  'name' is the name of the format and\n'extensions' is a list of extensions corresponding to the format,\nlike '.zip' for Zip files.\n\n'function' is the callable that will be used to unpack archives.\nThe callable will receive:\n\n- the path of the archive, as a positional argument;\n\n- the directory the archive must be extracted to, as a\npositional argument;\n\n- possibly a 'filter' keyword argument, if it was given to *note\nunpackarchive(): 184.;\n\n- additional keyword arguments, specified by 'extraargs' as a\nsequence of '(name, value)' tuples.\n\n'description' can be provided to describe the format, and will be\nreturned by the *note getunpackformats(): 2568. function.\n\n-- Function: shutil.unregisterunpackformat (name)\n\nUnregister an unpack format.  'name' is the name of the format.\n\n-- Function: shutil.getunpackformats ()\n\nReturn a list of all registered formats for unpacking.  Each\nelement of the returned sequence is a tuple '(name, extensions,\ndescription)'.\n\nBy default *note shutil: c0. provides these formats:\n\n- 'zip': ZIP file (unpacking compressed files works only if the\ncorresponding module is available).\n\n- 'tar': uncompressed tar file.\n\n- 'gztar': gzip'ed tar-file (if the *note zlib: 12d. module is\navailable).\n\n- 'bztar': bzip2'ed tar-file (if the *note bz2: 11. module is\navailable).\n\n- 'xztar': xz'ed tar-file (if the *note lzma: 85. module is\navailable).\n\nYou can register new formats or provide your own unpacker for any\nexisting formats, by using *note registerunpackformat(): 2567.\n\n* Menu:\n\n* Archiving example::\n* Archiving example with basedir::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0282/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Archiving example,  Next: Archiving example with basedir,  Up: Archiving operations": {
            "content": "5.11.10.6 Archiving example\n...........................\n",
            "subsections": []
        },
        "In this example, we create a gzip'ed tar-file archive containing all": {
            "content": "files found in the '.ssh' directory of the user:\n\n>>> from shutil import makearchive\n>>> import os\n>>> archivename = os.path.expanduser(os.path.join('~', 'myarchive'))\n>>> rootdir = os.path.expanduser(os.path.join('~', '.ssh'))\n>>> makearchive(archivename, 'gztar', rootdir)\n'/Users/tarek/myarchive.tar.gz'\n\nThe resulting archive contains:\n\n$ tar -tzvf /Users/tarek/myarchive.tar.gz\ndrwx------ tarek/staff       0 2010-02-01 16:23:40 ./\n-rw-r--r-- tarek/staff     609 2008-06-09 13:26:54 ./authorizedkeys\n-rwxr-xr-x tarek/staff      65 2008-06-09 13:26:54 ./config\n-rwx------ tarek/staff     668 2008-06-09 13:26:54 ./iddsa\n-rwxr-xr-x tarek/staff     609 2008-06-09 13:26:54 ./iddsa.pub\n-rw------- tarek/staff    1675 2008-06-09 13:26:54 ./idrsa\n-rw-r--r-- tarek/staff     397 2008-06-09 13:26:54 ./idrsa.pub\n-rw-r--r-- tarek/staff   37192 2010-02-06 18:23:10 ./knownhosts\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Archiving example with basedir,  Prev: Archiving example,  Up: Archiving operations": {
            "content": "5.11.10.7 Archiving example with 'basedir'\n...........................................\n\nIn this example, similar to the *note one above: 256b, we show how to\nuse *note makearchive(): 1d4, but this time with the usage of\n'basedir'.  We now have the following directory structure:\n\n$ tree tmp\ntmp\n????????? root\n????????? structure\n????????? content\n????????? pleaseadd.txt\n????????? donotadd.txt\n",
            "subsections": []
        },
        "In the final archive, 'pleaseadd.txt' should be included, but": {
            "content": "'donotadd.txt' should not.  Therefore we use the following:\n\n>>> from shutil import makearchive\n>>> import os\n>>> archivename = os.path.expanduser(os.path.join('~', 'myarchive'))\n>>> makearchive(\n...     archivename,\n...     'tar',\n...     rootdir='tmp/root',\n...     basedir='structure/content',\n... )\n'/Users/tarek/myarchive.tar'\n\nListing the files in the resulting archive gives us:\n\n$ python -m tarfile -l /Users/tarek/myarchive.tar\nstructure/content/\nstructure/content/pleaseadd.txt\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Querying the size of the output terminal,  Prev: Archiving operations,  Up: shutil -- High-level file operations": {
            "content": "5.11.10.8 Querying the size of the output terminal\n..................................................\n\n-- Function: shutil.getterminalsize (fallback=(columns, lines))\n\nGet the size of the terminal window.\n\nFor each of the two dimensions, the environment variable, 'COLUMNS'\nand 'LINES' respectively, is checked.  If the variable is defined\nand the value is a positive integer, it is used.\n\nWhen 'COLUMNS' or 'LINES' is not defined, which is the common case,\nthe terminal connected to *note sys.stdout: 256e. is queried by\ninvoking *note os.getterminalsize(): f72.\n\nIf the terminal size cannot be successfully queried, either because\nthe system doesn't support querying, or because we are not\nconnected to a terminal, the value given in 'fallback' parameter is\nused.  'fallback' defaults to '(80, 24)' which is the default size\nused by many terminal emulators.\n\nThe value returned is a named tuple of type *note os.terminalsize:\n256f.\n\nSee also: The Single UNIX Specification, Version 2, Other\nEnvironment Variables(1).\n\nNew in version 3.3.\n\nChanged in version 3.11: The 'fallback' values are also used if\n*note os.getterminalsize(): f72. returns zeroes.\n\nSee also\n........\n\nModule *note os: 9c.\n\nOperating system interfaces, including functions to work with files\nat a lower level than Python *note file objects: 1037.\n\nModule *note io: 79.\n\nPython's built-in I/O library, including both abstract classes and\nsome concrete classes such as file I/O.\n\nBuilt-in function *note open(): 26e.\n\nThe standard way to open files for reading and writing with Python.\n\n---------- Footnotes ----------\n\n(1)\nhttps://pubs.opengroup.org/onlinepubs/7908799/xbd/envvar.html#tag002003\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Data Persistence,  Next: Data Compression and Archiving,  Prev: File and Directory Access,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.12 Data Persistence",
                    "content": ""
                }
            ]
        },
        "The modules described in this chapter support storing Python data in a": {
            "content": "persistent form on disk.  The *note pickle: a1. and *note marshal: 88.\nmodules can turn many Python data types into a stream of bytes and then\nrecreate the objects from the bytes.  The various DBM-related modules\nsupport a family of hash-based file formats that store a mapping of\nstrings to other strings.\n\nThe list of modules described in this chapter is:\n\n* Menu:\n\n* pickle -- Python object serialization::\n* copyreg -- Register pickle support functions::\n* shelve -- Python object persistence::\n* marshal -- Internal Python object serialization::\n* dbm -- Interfaces to Unix \"databases\"::\n* sqlite3 -- DB-API 2.0 interface for SQLite databases: sqlite3 -- DB-API 2 0 interface for SQLite databases.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: pickle -- Python object serialization,  Next: copyreg -- Register pickle support functions,  Up: Data Persistence": {
            "content": "'Source code:' Lib/pickle.py(1)\n\n\n\nThe *note pickle: a1. module implements binary protocols for serializing\nand de-serializing a Python object structure.  '\"Pickling\"' is the\nprocess whereby a Python object hierarchy is converted into a byte\nstream, and '\"unpickling\"' is the inverse operation, whereby a byte\nstream (from a *note binary file: 1a0c. or *note bytes-like object:\nb82.) is converted back into an object hierarchy.  Pickling (and\nunpickling) is alternatively known as \"serialization\", \"marshalling,\"\n(2) or \"flattening\"; however, to avoid confusion, the terms used here\nare \"pickling\" and \"unpickling\".\n\nWarning: The 'pickle' module 'is not secure'.  Only unpickle data\nyou trust.\n\nIt is possible to construct malicious pickle data which will\n'execute arbitrary code during unpickling'.  Never unpickle data\nthat could have come from an untrusted source, or that could have\nbeen tampered with.\n\nConsider signing data with *note hmac: 65. if you need to ensure\nthat it has not been tampered with.\n\nSafer serialization formats such as *note json: 7c. may be more\nappropriate if you are processing untrusted data.  See *note\nComparison with json: 2575.\n\n* Menu:\n\n* Relationship to other Python modules::\n* Data stream format::\n* Module Interface::\n* What can be pickled and unpickled?::\n* Pickling Class Instances::\n* Custom Reduction for Types, Functions, and Other Objects: Custom Reduction for Types Functions and Other Objects.\n* Out-of-band Buffers::\n* Restricting Globals::\n* Performance: Performance<2>.\n* Examples: Examples<6>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/pickle.py\n\n(2) Don't confuse this with the *note marshal: 88. module\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Relationship to other Python modules,  Next: Data stream format,  Up: pickle -- Python object serialization": {
            "content": "5.12.1.1 Relationship to other Python modules\n.............................................\n\n* Menu:\n\n* Comparison with marshal::\n* Comparison with json::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Comparison with marshal,  Next: Comparison with json,  Up: Relationship to other Python modules": {
            "content": "5.12.1.2 Comparison with 'marshal'\n..................................\n\nPython has a more primitive serialization module called *note marshal:\n88, but in general *note pickle: a1. should always be the preferred way\nto serialize Python objects.  *note marshal: 88. exists primarily to\nsupport Python's '.pyc' files.\n\nThe *note pickle: a1. module differs from *note marshal: 88. in several\nsignificant ways:\n\n* The *note pickle: a1. module keeps track of the objects it has\nalready serialized, so that later references to the same object\nwon't be serialized again.  *note marshal: 88. doesn't do this.\n\nThis has implications both for recursive objects and object\nsharing.  Recursive objects are objects that contain references to\nthemselves.  These are not handled by marshal, and in fact,\nattempting to marshal recursive objects will crash your Python\ninterpreter.  Object sharing happens when there are multiple\nreferences to the same object in different places in the object\nhierarchy being serialized.  *note pickle: a1. stores such objects\nonly once, and ensures that all other references point to the\nmaster copy.  Shared objects remain shared, which can be very\nimportant for mutable objects.\n\n* *note marshal: 88. cannot be used to serialize user-defined classes\nand their instances.  *note pickle: a1. can save and restore class\ninstances transparently, however the class definition must be\nimportable and live in the same module as when the object was\nstored.\n\n* The *note marshal: 88. serialization format is not guaranteed to be\nportable across Python versions.  Because its primary job in life\nis to support '.pyc' files, the Python implementers reserve the\nright to change the serialization format in non-backwards\ncompatible ways should the need arise.  The *note pickle: a1.\nserialization format is guaranteed to be backwards compatible\nacross Python releases provided a compatible pickle protocol is\nchosen and pickling and unpickling code deals with Python 2 to\nPython 3 type differences if your data is crossing that unique\nbreaking change language boundary.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Comparison with json,  Prev: Comparison with marshal,  Up: Relationship to other Python modules": {
            "content": "5.12.1.3 Comparison with 'json'\n...............................\n",
            "subsections": []
        },
        "There are fundamental differences between the pickle protocols and JSON": {
            "content": "(JavaScript Object Notation)(1):\n\n* JSON is a text serialization format (it outputs unicode text,\nalthough most of the time it is then encoded to 'utf-8'), while\npickle is a binary serialization format;\n\n* JSON is human-readable, while pickle is not;\n\n* JSON is interoperable and widely used outside of the Python\necosystem, while pickle is Python-specific;\n\n* JSON, by default, can only represent a subset of the Python\nbuilt-in types, and no custom classes; pickle can represent an\nextremely large number of Python types (many of them automatically,\nby clever usage of Python's introspection facilities; complex cases\ncan be tackled by implementing *note specific object APIs: 2579.);\n\n* Unlike pickle, deserializing untrusted JSON does not in itself\ncreate an arbitrary code execution vulnerability.\n\nSee also\n........\n\nThe *note json: 7c. module: a standard library module allowing JSON\nserialization and deserialization.\n\n---------- Footnotes ----------\n\n(1) https://json.org\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Data stream format,  Next: Module Interface,  Prev: Relationship to other Python modules,  Up: pickle -- Python object serialization": {
            "content": "5.12.1.4 Data stream format\n...........................\n\nThe data format used by *note pickle: a1. is Python-specific.  This has\nthe advantage that there are no restrictions imposed by external\nstandards such as JSON or XDR (which can't represent pointer sharing);\nhowever it means that non-Python programs may not be able to reconstruct\npickled Python objects.\n\nBy default, the *note pickle: a1. data format uses a relatively compact\nbinary representation.  If you need optimal size characteristics, you\ncan efficiently *note compress: 257b. pickled data.\n\nThe module *note pickletools: a2. contains tools for analyzing data\nstreams generated by *note pickle: a1.  *note pickletools: a2. source\ncode has extensive comments about opcodes used by pickle protocols.\n",
            "subsections": []
        },
        "There are currently 6 different protocols which can be used for": {
            "content": "pickling.  The higher the protocol used, the more recent the version of\nPython needed to read the pickle produced.\n\n* Protocol version 0 is the original \"human-readable\" protocol and is\nbackwards compatible with earlier versions of Python.\n\n* Protocol version 1 is an old binary format which is also compatible\nwith earlier versions of Python.\n\n* Protocol version 2 was introduced in Python 2.3.  It provides much\nmore efficient pickling of *note new-style classes: 257c.  Refer to\nPEP 307(1) for information about improvements brought by protocol\n2.\n\n* Protocol version 3 was added in Python 3.0.  It has explicit\nsupport for *note bytes: 295. objects and cannot be unpickled by\nPython 2.x.  This was the default protocol in Python 3.0-3.7.\n\n* Protocol version 4 was added in Python 3.4.  It adds support for\nvery large objects, pickling more kinds of objects, and some data\nformat optimizations.  It is the default protocol starting with\nPython 3.8.  Refer to PEP 3154(2) for information about\nimprovements brought by protocol 4.\n\n* Protocol version 5 was added in Python 3.8.  It adds support for\nout-of-band data and speedup for in-band data.  Refer to PEP 574(3)\nfor information about improvements brought by protocol 5.\n\nNote: Serialization is a more primitive notion than persistence;\nalthough *note pickle: a1. reads and writes file objects, it does\nnot handle the issue of naming persistent objects, nor the (even\nmore complicated) issue of concurrent access to persistent objects.\nThe *note pickle: a1. module can transform a complex object into a\nbyte stream and it can transform the byte stream into an object\nwith the same internal structure.  Perhaps the most obvious thing\nto do with these byte streams is to write them onto a file, but it\nis also conceivable to send them across a network or store them in\na database.  The *note shelve: be. module provides a simple\ninterface to pickle and unpickle objects on DBM-style database\nfiles.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0307/\n\n(2) https://peps.python.org/pep-3154/\n\n(3) https://peps.python.org/pep-0574/\n\nFile: python3.12.info,  Node: Module Interface,  Next: What can be pickled and unpickled?,  Prev: Data stream format,  Up: pickle -- Python object serialization\n\n5.12.1.5 Module Interface\n.........................\n\nTo serialize an object hierarchy, you simply call the *note dumps():\n12fa. function.  Similarly, to de-serialize a data stream, you call the\n*note loads(): b63. function.  However, if you want more control over\nserialization and de-serialization, you can create a *note Pickler: 849.\nor an *note Unpickler: 13f8. object, respectively.\n\nThe *note pickle: a1. module provides the following constants:\n\n-- Data: pickle.HIGHESTPROTOCOL\n\nAn integer, the highest *note protocol version: b10. available.\nThis value can be passed as a 'protocol' value to functions *note\ndump(): 257e. and *note dumps(): 12fa. as well as the *note\nPickler: 849. constructor.\n\n-- Data: pickle.DEFAULTPROTOCOL\n\nAn integer, the default *note protocol version: b10. used for\npickling.  May be less than *note HIGHESTPROTOCOL: 12fb.\nCurrently the default protocol is 4, first introduced in Python 3.4\nand incompatible with previous versions.\n\nChanged in version 3.0: The default protocol is 3.\n\nChanged in version 3.8: The default protocol is 4.\n\nThe *note pickle: a1. module provides the following functions to make\nthe pickling process more convenient:\n\n-- Function: pickle.dump (obj, file, protocol=None, *,\nfiximports=True, buffercallback=None)\n\nWrite the pickled representation of the object 'obj' to the open\n*note file object: 1037. 'file'.  This is equivalent to\n'Pickler(file, protocol).dump(obj)'.\n\nArguments 'file', 'protocol', 'fiximports' and 'buffercallback'\nhave the same meaning as in the *note Pickler: 849. constructor.\n\nChanged in version 3.8: The 'buffercallback' argument was added.\n\n-- Function: pickle.dumps (obj, protocol=None, *, fiximports=True,\nbuffercallback=None)\n\nReturn the pickled representation of the object 'obj' as a *note\nbytes: 295. object, instead of writing it to a file.\n\nArguments 'protocol', 'fiximports' and 'buffercallback' have the\nsame meaning as in the *note Pickler: 849. constructor.\n\nChanged in version 3.8: The 'buffercallback' argument was added.\n\n-- Function: pickle.load (file, *, fiximports=True, encoding='ASCII',\nerrors='strict', buffers=None)\n\nRead the pickled representation of an object from the open *note\nfile object: 1037. 'file' and return the reconstituted object\nhierarchy specified therein.  This is equivalent to\n'Unpickler(file).load()'.\n\nThe protocol version of the pickle is detected automatically, so no\nprotocol argument is needed.  Bytes past the pickled representation\nof the object are ignored.\n\nArguments 'file', 'fiximports', 'encoding', 'errors', 'strict' and\n'buffers' have the same meaning as in the *note Unpickler: 13f8.\nconstructor.\n\nChanged in version 3.8: The 'buffers' argument was added.\n\n-- Function: pickle.loads (data, /, *, fiximports=True,\nencoding='ASCII', errors='strict', buffers=None)\n\nReturn the reconstituted object hierarchy of the pickled\nrepresentation 'data' of an object.  'data' must be a *note\nbytes-like object: b82.\n\nThe protocol version of the pickle is detected automatically, so no\nprotocol argument is needed.  Bytes past the pickled representation\nof the object are ignored.\n\nArguments 'fiximports', 'encoding', 'errors', 'strict' and\n'buffers' have the same meaning as in the *note Unpickler: 13f8.\nconstructor.\n\nChanged in version 3.8: The 'buffers' argument was added.\n\nThe *note pickle: a1. module defines three exceptions:\n\n-- Exception: pickle.PickleError\n\nCommon base class for the other pickling exceptions.  It inherits\nfrom *note Exception: 7ff.\n\n-- Exception: pickle.PicklingError\n\nError raised when an unpicklable object is encountered by *note\nPickler: 849.  It inherits from *note PickleError: 257f.\n\nRefer to *note What can be pickled and unpickled?: 2581. to learn\nwhat kinds of objects can be pickled.\n\n-- Exception: pickle.UnpicklingError\n\nError raised when there is a problem unpickling an object, such as\na data corruption or a security violation.  It inherits from *note\nPickleError: 257f.\n\nNote that other exceptions may also be raised during unpickling,\nincluding (but not necessarily limited to) AttributeError,\nEOFError, ImportError, and IndexError.\n\nThe *note pickle: a1. module exports three classes, *note Pickler: 849,\n*note Unpickler: 13f8. and *note PickleBuffer: 1557.:\n\n-- Class: pickle.Pickler (file, protocol=None, *, fiximports=True,\nbuffercallback=None)\n\nThis takes a binary file for writing a pickle data stream.\n\nThe optional 'protocol' argument, an integer, tells the pickler to\nuse the given protocol; supported protocols are 0 to *note\nHIGHESTPROTOCOL: 12fb.  If not specified, the default is *note\nDEFAULTPROTOCOL: 623.  If a negative number is specified, *note\nHIGHESTPROTOCOL: 12fb. is selected.\n\nThe 'file' argument must have a write() method that accepts a\nsingle bytes argument.  It can thus be an on-disk file opened for\nbinary writing, an *note io.BytesIO: d08. instance, or any other\ncustom object that meets this interface.\n\nIf 'fiximports' is true and 'protocol' is less than 3, pickle will\ntry to map the new Python 3 names to the old module names used in\nPython 2, so that the pickle data stream is readable with Python 2.\n\nIf 'buffercallback' is None (the default), buffer views are\nserialized into 'file' as part of the pickle stream.\n\nIf 'buffercallback' is not None, then it can be called any number\nof times with a buffer view.  If the callback returns a false value\n(such as None), the given buffer is *note out-of-band: 2583.;\notherwise the buffer is serialized in-band, i.e.  inside the pickle\nstream.\n\nIt is an error if 'buffercallback' is not None and 'protocol' is\nNone or smaller than 5.\n\nChanged in version 3.8: The 'buffercallback' argument was added.\n\n-- Method: dump (obj)\n\nWrite the pickled representation of 'obj' to the open file\nobject given in the constructor.\n\n-- Method: persistentid (obj)\n\nDo nothing by default.  This exists so a subclass can override\nit.\n\nIf *note persistentid(): 2584. returns 'None', 'obj' is\npickled as usual.  Any other value causes *note Pickler: 849.\nto emit the returned value as a persistent ID for 'obj'.  The\nmeaning of this persistent ID should be defined by *note\nUnpickler.persistentload(): 2585.  Note that the value\nreturned by *note persistentid(): 2584. cannot itself have a\npersistent ID.\n\nSee *note Persistence of External Objects: 2586. for details\nand examples of uses.\n\n-- Attribute: dispatchtable\n\nA pickler object's dispatch table is a registry of 'reduction\nfunctions' of the kind which can be declared using *note\ncopyreg.pickle(): 2587.  It is a mapping whose keys are\nclasses and whose values are reduction functions.  A reduction\nfunction takes a single argument of the associated class and\nshould conform to the same interface as a *note reduce():\n7f8. method.\n\nBy default, a pickler object will not have a *note\ndispatchtable: f92. attribute, and it will instead use the\nglobal dispatch table managed by the *note copyreg: 24.\nmodule.  However, to customize the pickling for a specific\npickler object one can set the *note dispatchtable: f92.\nattribute to a dict-like object.  Alternatively, if a subclass\nof *note Pickler: 849. has a *note dispatchtable: f92.\nattribute then this will be used as the default dispatch table\nfor instances of that class.\n\nSee *note Dispatch Tables: 2588. for usage examples.\n\nNew in version 3.3.\n\n-- Method: reduceroverride (obj)\n\nSpecial reducer that can be defined in *note Pickler: 849.\nsubclasses.  This method has priority over any reducer in the\n*note dispatchtable: f92.  It should conform to the same\ninterface as a *note reduce(): 7f8. method, and can\noptionally return *note NotImplemented: 5c5. to fallback on\n*note dispatchtable: f92.-registered reducers to pickle\n'obj'.\n\nFor a detailed example, see *note Custom Reduction for Types,\nFunctions, and Other Objects: 2589.\n\nNew in version 3.8.\n\n-- Attribute: fast\n\nDeprecated.  Enable fast mode if set to a true value.  The\nfast mode disables the usage of memo, therefore speeding the\npickling process by not generating superfluous PUT opcodes.\nIt should not be used with self-referential objects, doing\notherwise will cause *note Pickler: 849. to recurse\ninfinitely.\n\nUse *note pickletools.optimize(): 258b. if you need more\ncompact pickles.\n\n-- Class: pickle.Unpickler (file, *, fiximports=True,\nencoding='ASCII', errors='strict', buffers=None)\n\nThis takes a binary file for reading a pickle data stream.\n\nThe protocol version of the pickle is detected automatically, so no\nprotocol argument is needed.\n\nThe argument 'file' must have three methods, a read() method that\ntakes an integer argument, a readinto() method that takes a buffer\nargument and a readline() method that requires no arguments, as in\nthe *note io.BufferedIOBase: 460. interface.  Thus 'file' can be an\non-disk file opened for binary reading, an *note io.BytesIO: d08.\nobject, or any other custom object that meets this interface.\n\nThe optional arguments 'fiximports', 'encoding' and 'errors' are\nused to control compatibility support for pickle stream generated\nby Python 2.  If 'fiximports' is true, pickle will try to map the\nold Python 2 names to the new names used in Python 3.  The\n'encoding' and 'errors' tell pickle how to decode 8-bit string\ninstances pickled by Python 2; these default to 'ASCII' and\n'strict', respectively.  The 'encoding' can be 'bytes' to read\nthese 8-bit string instances as bytes objects.  Using\n'encoding='latin1'' is required for unpickling NumPy arrays and\ninstances of *note datetime: 222, *note date: 70f. and *note time:\n6a5. pickled by Python 2.\n\nIf 'buffers' is None (the default), then all data necessary for\ndeserialization must be contained in the pickle stream.  This means\nthat the 'buffercallback' argument was None when a *note Pickler:\n849. was instantiated (or when *note dump(): 257e. or *note\ndumps(): 12fa. was called).\n\nIf 'buffers' is not None, it should be an iterable of\nbuffer-enabled objects that is consumed each time the pickle stream\nreferences an *note out-of-band: 2583. buffer view.  Such buffers\nhave been given in order to the 'buffercallback' of a Pickler\nobject.\n\nChanged in version 3.8: The 'buffers' argument was added.\n\n-- Method: load ()\n\nRead the pickled representation of an object from the open\nfile object given in the constructor, and return the\nreconstituted object hierarchy specified therein.  Bytes past\nthe pickled representation of the object are ignored.\n\n-- Method: persistentload (pid)\n\nRaise an *note UnpicklingError: 2582. by default.\n\nIf defined, *note persistentload(): 2585. should return the\nobject specified by the persistent ID 'pid'.  If an invalid\npersistent ID is encountered, an *note UnpicklingError: 2582.\nshould be raised.\n\nSee *note Persistence of External Objects: 2586. for details\nand examples of uses.\n\n-- Method: findclass (module, name)\n\nImport 'module' if necessary and return the object called\n'name' from it, where the 'module' and 'name' arguments are\n*note str: 157. objects.  Note, unlike its name suggests,\n*note findclass(): 258d. is also used for finding functions.\n\nSubclasses may override this to gain control over what type of\nobjects and how they can be loaded, potentially reducing\nsecurity risks.  Refer to *note Restricting Globals: 258e. for\ndetails.\n\nRaises an *note auditing event: 161d. 'pickle.findclass' with\narguments 'module', 'name'.\n\n-- Class: pickle.PickleBuffer (buffer)\n\nA wrapper for a buffer representing picklable data.  'buffer' must\nbe a *note buffer-providing: 148. object, such as a *note\nbytes-like object: b82. or a N-dimensional array.\n\n*note PickleBuffer: 1557. is itself a buffer provider, therefore it\nis possible to pass it to other APIs expecting a buffer-providing\nobject, such as *note memoryview: 17f.\n\n*note PickleBuffer: 1557. objects can only be serialized using\npickle protocol 5 or higher.  They are eligible for *note\nout-of-band serialization: 2583.\n\nNew in version 3.8.\n\n-- Method: raw ()\n\nReturn a *note memoryview: 17f. of the memory area underlying\nthis buffer.  The returned object is a one-dimensional,\nC-contiguous memoryview with format 'B' (unsigned bytes).\n*note BufferError: 1586. is raised if the buffer is neither C-\nnor Fortran-contiguous.\n\n-- Method: release ()\n\nRelease the underlying buffer exposed by the PickleBuffer\nobject.\n\nFile: python3.12.info,  Node: What can be pickled and unpickled?,  Next: Pickling Class Instances,  Prev: Module Interface,  Up: pickle -- Python object serialization\n\n5.12.1.6 What can be pickled and unpickled?\n...........................................\n\nThe following types can be pickled:\n\n* built-in constants ('None', 'True', 'False', 'Ellipsis', and *note\nNotImplemented: 5c5.);\n\n* integers, floating-point numbers, complex numbers;\n\n* strings, bytes, bytearrays;\n\n* tuples, lists, sets, and dictionaries containing only picklable\nobjects;\n\n* functions (built-in and user-defined) accessible from the top level\nof a module (using *note def: 12af, not *note lambda: 1115.);\n\n* classes accessible from the top level of a module;\n\n* instances of such classes whose the result of calling *note\ngetstate(): 39c. is picklable (see section *note Pickling Class\nInstances: 2579. for details).\n\nAttempts to pickle unpicklable objects will raise the *note",
            "subsections": []
        },
        "PicklingError: 2580. exception; when this happens, an unspecified number": {
            "content": "of bytes may have already been written to the underlying file.  Trying\nto pickle a highly recursive data structure may exceed the maximum\nrecursion depth, a *note RecursionError: bc6. will be raised in this\ncase.  You can carefully raise this limit with *note\nsys.setrecursionlimit(): 1e7.\n",
            "subsections": []
        },
        "Note that functions (built-in and user-defined) are pickled by fully": {
            "content": "*note qualified name: 16a7, not by value.  (1)  This means that only the\nfunction name is pickled, along with the name of the containing module\nand classes.  Neither the function's code, nor any of its function\nattributes are pickled.  Thus the defining module must be importable in\nthe unpickling environment, and the module must contain the named\nobject, otherwise an exception will be raised.  (2)\n",
            "subsections": []
        },
        "Similarly, classes are pickled by fully qualified name, so the same": {
            "content": "restrictions in the unpickling environment apply.  Note that none of the\nclass's code or data is pickled, so in the following example the class\nattribute 'attr' is not restored in the unpickling environment:\n\nclass Foo:\nattr = 'A class attribute'\n\npicklestring = pickle.dumps(Foo)\n",
            "subsections": []
        },
        "These restrictions are why picklable functions and classes must be": {
            "content": "defined at the top level of a module.\n",
            "subsections": []
        },
        "Similarly, when class instances are pickled, their class's code and data": {
            "content": "are not pickled along with them.  Only the instance data are pickled.",
            "subsections": []
        },
        "This is done on purpose, so you can fix bugs in a class or add methods": {
            "content": "to the class and still load objects that were created with an earlier\nversion of the class.  If you plan to have long-lived objects that will\nsee many versions of a class, it may be worthwhile to put a version\nnumber in the objects so that suitable conversions can be made by the\nclass's *note setstate(): 12fc. method.\n\n---------- Footnotes ----------\n\n(1) This is why *note lambda: 1115. functions cannot be pickled: all\n'lambda' functions share the same name: '<lambda>'.\n\n(2) The exception raised will likely be an *note ImportError: 145. or\nan *note AttributeError: 395. but it could be something else.\n\nFile: python3.12.info,  Node: Pickling Class Instances,  Next: Custom Reduction for Types Functions and Other Objects,  Prev: What can be pickled and unpickled?,  Up: pickle -- Python object serialization\n\n5.12.1.7 Pickling Class Instances\n.................................\n",
            "subsections": []
        },
        "In this section, we describe the general mechanisms available to you to": {
            "content": "define, customize, and control how class instances are pickled and\nunpickled.\n\nIn most cases, no additional code is needed to make instances picklable.",
            "subsections": []
        },
        "By default, pickle will retrieve the class and the attributes of an": {
            "content": "instance via introspection.  When a class instance is unpickled, its\n*note init(): 47d. method is usually 'not' invoked.  The default\nbehaviour first creates an uninitialized instance and then restores the\nsaved attributes.  The following code shows an implementation of this\nbehaviour:\n\ndef save(obj):\nreturn (obj.class, obj.dict)\n\ndef restore(cls, attributes):\nobj = cls.new(cls)\nobj.dict.update(attributes)\nreturn obj\n",
            "subsections": []
        },
        "Classes can alter the default behaviour by providing one or several": {
            "content": "special methods:\n\n-- Method: object.getnewargsex ()\n\nIn protocols 2 and newer, classes that implements the *note\ngetnewargsex(): 2593. method can dictate the values passed to\nthe *note new(): 2e2. method upon unpickling.  The method must\nreturn a pair '(args, kwargs)' where 'args' is a tuple of\npositional arguments and 'kwargs' a dictionary of named arguments\nfor constructing the object.  Those will be passed to the *note\nnew(): 2e2. method upon unpickling.\n\nYou should implement this method if the *note new(): 2e2.\nmethod of your class requires keyword-only arguments.  Otherwise,\nit is recommended for compatibility to implement *note\ngetnewargs(): 12fd.\n\nChanged in version 3.6: *note getnewargsex(): 2593. is now\nused in protocols 2 and 3.\n\n-- Method: object.getnewargs ()\n\nThis method serves a similar purpose as *note getnewargsex():\n2593, but supports only positional arguments.  It must return a\ntuple of arguments 'args' which will be passed to the *note\nnew(): 2e2. method upon unpickling.\n\n*note getnewargs(): 12fd. will not be called if *note\ngetnewargsex(): 2593. is defined.\n\nChanged in version 3.6: Before Python 3.6, *note getnewargs():\n12fd. was called instead of *note getnewargsex(): 2593. in\nprotocols 2 and 3.\n\n-- Method: object.getstate ()\n\nClasses can further influence how their instances are pickled by\noverriding the method *note getstate(): 39c.  It is called and\nthe returned object is pickled as the contents for the instance,\ninstead of a default state.  There are several cases:\n\n* For a class that has no instance *note dict: aa8. and no\n*note slots: 1344, the default state is 'None'.\n\n* For a class that has an instance *note dict: aa8. and no\n*note slots: 1344, the default state is 'self.dict'.\n\n* For a class that has an instance *note dict: aa8. and\n*note slots: 1344, the default state is a tuple consisting\nof two dictionaries: 'self.dict', and a dictionary mapping\nslot names to slot values.  Only slots that have a value are\nincluded in the latter.\n\n* For a class that has *note slots: 1344. and no instance\n*note dict: aa8, the default state is a tuple whose first\nitem is 'None' and whose second item is a dictionary mapping\nslot names to slot values described in the previous bullet.\n\nChanged in version 3.11: Added the default implementation of the\n'getstate()' method in the *note object: 8bb. class.\n\n-- Method: object.setstate (state)\n\nUpon unpickling, if the class defines *note setstate(): 12fc,\nit is called with the unpickled state.  In that case, there is no\nrequirement for the state object to be a dictionary.  Otherwise,\nthe pickled state must be a dictionary and its items are assigned\nto the new instance's dictionary.\n\nNote: If *note reduce(): 7f8. returns a state with value\n'None' at pickling, the *note setstate(): 12fc. method\nwill not be called upon unpickling.\n\nRefer to the section *note Handling Stateful Objects: 2594. for more\ninformation about how to use the methods *note getstate(): 39c. and\n*note setstate(): 12fc.\n\nNote: At unpickling time, some methods like *note getattr():\n1f8, *note getattribute(): a16, or *note setattr(): 1c35.\nmay be called upon the instance.  In case those methods rely on\nsome internal invariant being true, the type should implement *note\nnew(): 2e2. to establish such an invariant, as *note\ninit(): 47d. is not called when unpickling an instance.\n",
            "subsections": []
        },
        "As we shall see, pickle does not use directly the methods described": {
            "content": "above.  In fact, these methods are part of the copy protocol which\nimplements the *note reduce(): 7f8. special method.  The copy\nprotocol provides a unified interface for retrieving the data necessary\nfor pickling and copying objects.  (1)\n\nAlthough powerful, implementing *note reduce(): 7f8. directly in\nyour classes is error prone.  For this reason, class designers should\nuse the high-level interface (i.e., *note getnewargsex(): 2593,\n*note getstate(): 39c. and *note setstate(): 12fc.) whenever\npossible.  We will show, however, cases where using 'reduce()' is\nthe only option or leads to more efficient pickling or both.\n\n-- Method: object.reduce ()\n\nThe interface is currently defined as follows.  The *note\nreduce(): 7f8. method takes no argument and shall return either\na string or preferably a tuple (the returned object is often\nreferred to as the \"reduce value\").\n\nIf a string is returned, the string should be interpreted as the\nname of a global variable.  It should be the object's local name\nrelative to its module; the pickle module searches the module\nnamespace to determine the object's module.  This behaviour is\ntypically useful for singletons.\n\nWhen a tuple is returned, it must be between two and six items\nlong.  Optional items can either be omitted, or 'None' can be\nprovided as their value.  The semantics of each item are in order:\n\n* A callable object that will be called to create the initial\nversion of the object.\n\n* A tuple of arguments for the callable object.  An empty tuple\nmust be given if the callable does not accept any argument.\n\n* Optionally, the object's state, which will be passed to the\nobject's *note setstate(): 12fc. method as previously\ndescribed.  If the object has no such method then, the value\nmust be a dictionary and it will be added to the object's\n*note dict: aa8. attribute.\n\n* Optionally, an iterator (and not a sequence) yielding\nsuccessive items.  These items will be appended to the object\neither using 'obj.append(item)' or, in batch, using\n'obj.extend(listofitems)'.  This is primarily used for list\nsubclasses, but may be used by other classes as long as they\nhave *note append and extend methods: 1eb4. with the\nappropriate signature.  (Whether 'append()' or 'extend()' is\nused depends on which pickle protocol version is used as well\nas the number of items to append, so both must be supported.)\n\n* Optionally, an iterator (not a sequence) yielding successive\nkey-value pairs.  These items will be stored to the object\nusing 'obj[key] = value'.  This is primarily used for\ndictionary subclasses, but may be used by other classes as\nlong as they implement *note setitem(): 1320.\n\n* Optionally, a callable with a '(obj, state)' signature.  This\ncallable allows the user to programmatically control the\nstate-updating behavior of a specific object, instead of using\n'obj''s static *note setstate(): 12fc. method.  If not\n'None', this callable will have priority over 'obj''s *note\nsetstate(): 12fc.\n\nNew in version 3.8: The optional sixth tuple item, '(obj,\nstate)', was added.\n\n-- Method: object.reduceex (protocol)\n\nAlternatively, a *note reduceex(): 2595. method may be\ndefined.  The only difference is this method should take a single\ninteger argument, the protocol version.  When defined, pickle will\nprefer it over the *note reduce(): 7f8. method.  In addition,\n*note reduce(): 7f8. automatically becomes a synonym for the\nextended version.  The main use for this method is to provide\nbackwards-compatible reduce values for older Python releases.\n\n* Menu:\n\n* Persistence of External Objects::\n* Dispatch Tables::\n* Handling Stateful Objects::\n\n---------- Footnotes ----------\n\n(1) The *note copy: 23. module uses this protocol for shallow and\ndeep copying operations.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Persistence of External Objects,  Next: Dispatch Tables,  Up: Pickling Class Instances": {
            "content": "5.12.1.8 Persistence of External Objects\n........................................\n\nFor the benefit of object persistence, the *note pickle: a1. module\nsupports the notion of a reference to an object outside the pickled data\nstream.  Such objects are referenced by a persistent ID, which should be\neither a string of alphanumeric characters (for protocol 0) (1) or just\nan arbitrary object (for any newer protocol).\n\nThe resolution of such persistent IDs is not defined by the *note\npickle: a1. module; it will delegate this resolution to the user-defined\nmethods on the pickler and unpickler, *note persistentid(): 2584. and\n*note persistentload(): 2585. respectively.\n",
            "subsections": []
        },
        "To pickle objects that have an external persistent ID, the pickler must": {
            "content": "have a custom *note persistentid(): 2584. method that takes an object\nas an argument and returns either 'None' or the persistent ID for that\nobject.  When 'None' is returned, the pickler simply pickles the object\nas normal.  When a persistent ID string is returned, the pickler will\npickle that object, along with a marker so that the unpickler will\nrecognize it as a persistent ID.\n\nTo unpickle external objects, the unpickler must have a custom *note\npersistentload(): 2585. method that takes a persistent ID object and\nreturns the referenced object.\n",
            "subsections": []
        },
        "Here is a comprehensive example presenting how persistent ID can be used": {
            "content": "to pickle external objects by reference.\n\n# Simple example presenting how persistent ID can be used to pickle\n# external objects by reference.\n\nimport pickle\nimport sqlite3\nfrom collections import namedtuple\n\n# Simple class representing a record in our database.\nMemoRecord = namedtuple(\"MemoRecord\", \"key, task\")\n\nclass DBPickler(pickle.Pickler):\n\ndef persistentid(self, obj):\n# Instead of pickling MemoRecord as a regular class instance, we emit a\n# persistent ID.\nif isinstance(obj, MemoRecord):\n# Here, our persistent ID is simply a tuple, containing a tag and a\n# key, which refers to a specific record in the database.\nreturn (\"MemoRecord\", obj.key)\nelse:\n# If obj does not have a persistent ID, return None. This means obj\n# needs to be pickled as usual.\nreturn None\n\n\nclass DBUnpickler(pickle.Unpickler):\n\ndef init(self, file, connection):\nsuper().init(file)\nself.connection = connection\n\ndef persistentload(self, pid):\n# This method is invoked whenever a persistent ID is encountered.\n# Here, pid is the tuple returned by DBPickler.\ncursor = self.connection.cursor()\ntypetag, keyid = pid\nif typetag == \"MemoRecord\":\n# Fetch the referenced record from the database and return it.\ncursor.execute(\"SELECT * FROM memos WHERE key=?\", (str(keyid),))\nkey, task = cursor.fetchone()\nreturn MemoRecord(key, task)\nelse:\n# Always raises an error if you cannot return the correct object.\n# Otherwise, the unpickler will think None is the object referenced\n# by the persistent ID.\nraise pickle.UnpicklingError(\"unsupported persistent object\")\n\n\ndef main():\nimport io\nimport pprint\n\n# Initialize and populate our database.\nconn = sqlite3.connect(\":memory:\")\ncursor = conn.cursor()\ncursor.execute(\"CREATE TABLE memos(key INTEGER PRIMARY KEY, task TEXT)\")\ntasks = (\n'give food to fish',\n'prepare group meeting',\n'fight with a zebra',\n)\nfor task in tasks:\ncursor.execute(\"INSERT INTO memos VALUES(NULL, ?)\", (task,))\n\n# Fetch the records to be pickled.\ncursor.execute(\"SELECT * FROM memos\")\nmemos = [MemoRecord(key, task) for key, task in cursor]\n# Save the records using our custom DBPickler.\nfile = io.BytesIO()\nDBPickler(file).dump(memos)\n\nprint(\"Pickled records:\")\npprint.pprint(memos)\n\n# Update a record, just for good measure.\ncursor.execute(\"UPDATE memos SET task='learn italian' WHERE key=1\")\n\n# Load the records from the pickle data stream.\nfile.seek(0)\nmemos = DBUnpickler(file, conn).load()\n\nprint(\"Unpickled records:\")\npprint.pprint(memos)\n\n\nif name == 'main':\nmain()\n\n---------- Footnotes ----------\n\n(1) The limitation on alphanumeric characters is due to the fact that\npersistent IDs in protocol 0 are delimited by the newline character.",
            "subsections": []
        },
        "Therefore if any kind of newline characters occurs in persistent IDs,": {
            "content": "the resulting pickled data will become unreadable.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Dispatch Tables,  Next: Handling Stateful Objects,  Prev: Persistence of External Objects,  Up: Pickling Class Instances": {
            "content": "5.12.1.9 Dispatch Tables\n........................\n",
            "subsections": []
        },
        "If one wants to customize pickling of some classes without disturbing": {
            "content": "any other code which depends on pickling, then one can create a pickler\nwith a private dispatch table.\n\nThe global dispatch table managed by the *note copyreg: 24. module is\navailable as 'copyreg.dispatchtable'.  Therefore, one may choose to use\na modified copy of 'copyreg.dispatchtable' as a private dispatch table.\n",
            "subsections": []
        },
        "For example": {
            "content": "f = io.BytesIO()\np = pickle.Pickler(f)\np.dispatchtable = copyreg.dispatchtable.copy()\np.dispatchtable[SomeClass] = reduceSomeClass\n\ncreates an instance of *note pickle.Pickler: 849. with a private\ndispatch table which handles the 'SomeClass' class specially.",
            "subsections": []
        },
        "Alternatively, the code": {
            "content": "class MyPickler(pickle.Pickler):\ndispatchtable = copyreg.dispatchtable.copy()\ndispatchtable[SomeClass] = reduceSomeClass\nf = io.BytesIO()\np = MyPickler(f)\n\ndoes the same but all instances of 'MyPickler' will by default share the\nprivate dispatch table.  On the other hand, the code\n\ncopyreg.pickle(SomeClass, reduceSomeClass)\nf = io.BytesIO()\np = pickle.Pickler(f)\n\nmodifies the global dispatch table shared by all users of the *note\ncopyreg: 24. module.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Handling Stateful Objects,  Prev: Dispatch Tables,  Up: Pickling Class Instances": {
            "content": "5.12.1.10 Handling Stateful Objects\n...................................\n",
            "subsections": []
        },
        "Here's an example that shows how to modify pickling behavior for a": {
            "content": "class.  The 'TextReader' class below opens a text file, and returns the\nline number and line contents each time its 'readline()' method is\ncalled.  If a 'TextReader' instance is pickled, all attributes 'except'\nthe file object member are saved.  When the instance is unpickled, the\nfile is reopened, and reading resumes from the last location.  The\n'setstate()' and 'getstate()' methods are used to implement this\nbehavior.\n\nclass TextReader:\n\"\"\"Print and number lines in a text file.\"\"\"\n\ndef init(self, filename):\nself.filename = filename\nself.file = open(filename)\nself.lineno = 0\n\ndef readline(self):\nself.lineno += 1\nline = self.file.readline()\nif not line:\nreturn None\nif line.endswith('\\n'):\nline = line[:-1]\nreturn \"%i: %s\" % (self.lineno, line)\n\ndef getstate(self):\n# Copy the object's state from self.dict which contains\n# all our instance attributes. Always use the dict.copy()\n# method to avoid modifying the original state.\nstate = self.dict.copy()\n# Remove the unpicklable entries.\ndel state['file']\nreturn state\n\ndef setstate(self, state):\n# Restore instance attributes (i.e., filename and lineno).\nself.dict.update(state)\n# Restore the previously opened file's state. To do so, we need to\n# reopen it and read from it until the line count is restored.\nfile = open(self.filename)\nfor  in range(self.lineno):\nfile.readline()\n# Finally, save the file.\nself.file = file\n\nA sample usage might be something like this:\n\n>>> reader = TextReader(\"hello.txt\")\n>>> reader.readline()\n'1: Hello world!'\n>>> reader.readline()\n'2: I am line number two.'\n>>> newreader = pickle.loads(pickle.dumps(reader))\n>>> newreader.readline()\n'3: Goodbye!'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Custom Reduction for Types Functions and Other Objects,  Next: Out-of-band Buffers,  Prev: Pickling Class Instances,  Up: pickle -- Python object serialization": {
            "content": "5.12.1.11 Custom Reduction for Types, Functions, and Other Objects\n..................................................................\n\nNew in version 3.8.\n\nSometimes, *note dispatchtable: f92. may not be flexible enough.  In\nparticular we may want to customize pickling based on another criterion\nthan the object's type, or we may want to customize the pickling of\nfunctions and classes.\n\nFor those cases, it is possible to subclass from the *note Pickler: 849.\nclass and implement a *note reduceroverride(): 84a. method.  This\nmethod can return an arbitrary reduction tuple (see *note reduce():\n7f8.).  It can alternatively return *note NotImplemented: 5c5. to\nfallback to the traditional behavior.\n\nIf both the *note dispatchtable: f92. and *note reduceroverride():\n84a. are defined, then *note reduceroverride(): 84a. method takes\npriority.\n\nNote: For performance reasons, *note reduceroverride(): 84a. may\nnot be called for the following objects: 'None', 'True', 'False',\nand exact instances of *note int: 17e, *note float: 4b7, *note\nbytes: 295, *note str: 157, *note dict: 237, *note set: 39d, *note\nfrozenset: 39e, *note list: 3dc. and *note tuple: 4b8.\n",
            "subsections": []
        },
        "Here is a simple example where we allow pickling and reconstructing a": {
            "content": "given class:\n\nimport io\nimport pickle\n\nclass MyClass:\nmyattribute = 1\n\nclass MyPickler(pickle.Pickler):\ndef reduceroverride(self, obj):\n\"\"\"Custom reducer for MyClass.\"\"\"\nif getattr(obj, \"name\", None) == \"MyClass\":\nreturn type, (obj.name, obj.bases,\n{'myattribute': obj.myattribute})\nelse:\n# For any other object, fallback to usual reduction\nreturn NotImplemented\n\nf = io.BytesIO()\np = MyPickler(f)\np.dump(MyClass)\n\ndel MyClass\n\nunpickledclass = pickle.loads(f.getvalue())\n\nassert isinstance(unpickledclass, type)\nassert unpickledclass.name == \"MyClass\"\nassert unpickledclass.myattribute == 1\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Out-of-band Buffers,  Next: Restricting Globals,  Prev: Custom Reduction for Types Functions and Other Objects,  Up: pickle -- Python object serialization": {
            "content": "5.12.1.12 Out-of-band Buffers\n.............................\n\nNew in version 3.8.\n\nIn some contexts, the *note pickle: a1. module is used to transfer\nmassive amounts of data.  Therefore, it can be important to minimize the\nnumber of memory copies, to preserve performance and resource\nconsumption.  However, normal operation of the *note pickle: a1. module,\nas it transforms a graph-like structure of objects into a sequential\nstream of bytes, intrinsically involves copying data to and from the\npickle stream.\n",
            "subsections": []
        },
        "This constraint can be eschewed if both the 'provider' (the": {
            "content": "implementation of the object types to be transferred) and the 'consumer'\n(the implementation of the communications system) support the\nout-of-band transfer facilities provided by pickle protocol 5 and\nhigher.\n\n* Menu:\n\n* Provider API::\n* Consumer API::\n* Example: Example<4>.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Provider API,  Next: Consumer API,  Up: Out-of-band Buffers": {
            "content": "5.12.1.13 Provider API\n......................\n\nThe large data objects to be pickled must implement a *note\nreduceex(): 2595. method specialized for protocol 5 and higher,\nwhich returns a *note PickleBuffer: 1557. instance (instead of e.g.  a\n*note bytes: 295. object) for any large data.\n\nA *note PickleBuffer: 1557. object 'signals' that the underlying buffer\nis eligible for out-of-band data transfer.  Those objects remain\ncompatible with normal usage of the *note pickle: a1. module.  However,\nconsumers can also opt-in to tell *note pickle: a1. that they will\nhandle those buffers by themselves.\n\nFile: python3.12.info,  Node: Consumer API,  Next: Example<4>,  Prev: Provider API,  Up: Out-of-band Buffers\n\n5.12.1.14 Consumer API\n......................\n\nA communications system can enable custom handling of the *note\nPickleBuffer: 1557. objects generated when serializing an object graph.\n",
            "subsections": []
        },
        "On the sending side, it needs to pass a 'buffercallback' argument to": {
            "content": "*note Pickler: 849. (or to the *note dump(): 257e. or *note dumps():\n12fa. function), which will be called with each *note PickleBuffer:\n1557. generated while pickling the object graph.  Buffers accumulated by\nthe 'buffercallback' will not see their data copied into the pickle\nstream, only a cheap marker will be inserted.\n\nOn the receiving side, it needs to pass a 'buffers' argument to *note\nUnpickler: 13f8. (or to the *note load(): b62. or *note loads(): b63.\nfunction), which is an iterable of the buffers which were passed to\n'buffercallback'.  That iterable should produce buffers in the same\norder as they were passed to 'buffercallback'.  Those buffers will\nprovide the data expected by the reconstructors of the objects whose\npickling produced the original *note PickleBuffer: 1557. objects.\n",
            "subsections": []
        },
        "Between the sending side and the receiving side, the communications": {
            "content": "system is free to implement its own transfer mechanism for out-of-band\nbuffers.  Potential optimizations include the use of shared memory or\ndatatype-dependent compression.\n\nFile: python3.12.info,  Node: Example<4>,  Prev: Consumer API,  Up: Out-of-band Buffers\n\n5.12.1.15 Example\n.................\n\nHere is a trivial example where we implement a *note bytearray: 294.\nsubclass able to participate in out-of-band buffer pickling:\n\nclass ZeroCopyByteArray(bytearray):\n\ndef reduceex(self, protocol):\nif protocol >= 5:\nreturn type(self).reconstruct, (PickleBuffer(self),), None\nelse:\n# PickleBuffer is forbidden with pickle protocols <= 4.\nreturn type(self).reconstruct, (bytearray(self),)\n\n@classmethod\ndef reconstruct(cls, obj):\nwith memoryview(obj) as m:\n# Get a handle over the original buffer object\nobj = m.obj\nif type(obj) is cls:\n# Original buffer object is a ZeroCopyByteArray, return it\n# as-is.\nreturn obj\nelse:\nreturn cls(obj)\n",
            "subsections": []
        },
        "The reconstructor (the 'reconstruct' class method) returns the buffer's": {
            "content": "providing object if it has the right type.  This is an easy way to\nsimulate zero-copy behaviour on this toy example.\n",
            "subsections": []
        },
        "On the consumer side, we can pickle those objects the usual way, which": {
            "content": "when unserialized will give us a copy of the original object:\n\nb = ZeroCopyByteArray(b\"abc\")\ndata = pickle.dumps(b, protocol=5)\nnewb = pickle.loads(data)\nprint(b == newb)  # True\nprint(b is newb)  # False: a copy was made\n",
            "subsections": []
        },
        "But if we pass a 'buffercallback' and then give back the accumulated": {
            "content": "buffers when unserializing, we are able to get back the original object:\n\nb = ZeroCopyByteArray(b\"abc\")\nbuffers = []\ndata = pickle.dumps(b, protocol=5, buffercallback=buffers.append)\nnewb = pickle.loads(data, buffers=buffers)\nprint(b == newb)  # True\nprint(b is newb)  # True: no copy was made\n\nThis example is limited by the fact that *note bytearray: 294. allocates\nits own memory: you cannot create a *note bytearray: 294. instance that\nis backed by another object's memory.  However, third-party datatypes\nsuch as NumPy arrays do not have this limitation, and allow use of\nzero-copy pickling (or making as few copies as possible) when\ntransferring between distinct processes or systems.\n\nSee also\n........\n\nPEP 574(1) - Pickle protocol 5 with out-of-band data\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0574/\n\nFile: python3.12.info,  Node: Restricting Globals,  Next: Performance<2>,  Prev: Out-of-band Buffers,  Up: pickle -- Python object serialization\n\n5.12.1.16 Restricting Globals\n.............................\n",
            "subsections": []
        },
        "By default, unpickling will import any class or function that it finds": {
            "content": "in the pickle data.  For many applications, this behaviour is\nunacceptable as it permits the unpickler to import and invoke arbitrary\ncode.  Just consider what this hand-crafted pickle data stream does when\nloaded:\n\n>>> import pickle\n>>> pickle.loads(b\"cos\\nsystem\\n(S'echo hello world'\\ntR.\")\nhello world\n0\n\nIn this example, the unpickler imports the *note os.system(): 12b2.\nfunction and then apply the string argument \"echo hello world\".",
            "subsections": []
        },
        "Although this example is inoffensive, it is not difficult to imagine one": {
            "content": "that could damage your system.\n",
            "subsections": []
        },
        "For this reason, you may want to control what gets unpickled by": {
            "content": "customizing *note Unpickler.findclass(): 258d.  Unlike its name\nsuggests, *note Unpickler.findclass(): 258d. is called whenever a\nglobal (i.e., a class or a function) is requested.  Thus it is possible\nto either completely forbid globals or restrict them to a safe subset.\n",
            "subsections": []
        },
        "Here is an example of an unpickler allowing only few safe classes from": {
            "content": "the *note builtins: 10. module to be loaded:\n\nimport builtins\nimport io\nimport pickle\n\nsafebuiltins = {\n'range',\n'complex',\n'set',\n'frozenset',\n'slice',\n}\n\nclass RestrictedUnpickler(pickle.Unpickler):\n\ndef findclass(self, module, name):\n# Only allow safe classes from builtins.\nif module == \"builtins\" and name in safebuiltins:\nreturn getattr(builtins, name)\n# Forbid everything else.\nraise pickle.UnpicklingError(\"global '%s.%s' is forbidden\" %\n(module, name))\n\ndef restrictedloads(s):\n\"\"\"Helper function analogous to pickle.loads().\"\"\"\nreturn RestrictedUnpickler(io.BytesIO(s)).load()\n\nA sample usage of our unpickler working as intended:\n\n>>> restrictedloads(pickle.dumps([1, 2, range(15)]))\n[1, 2, range(0, 15)]\n>>> restrictedloads(b\"cos\\nsystem\\n(S'echo hello world'\\ntR.\")\nTraceback (most recent call last):\n...\npickle.UnpicklingError: global 'os.system' is forbidden\n>>> restrictedloads(b'cbuiltins\\neval\\n'\n...                  b'(S\\'getattr(import(\"os\"), \"system\")'\n...                  b'(\"echo hello world\")\\'\\ntR.')\nTraceback (most recent call last):\n...\npickle.UnpicklingError: global 'builtins.eval' is forbidden\n",
            "subsections": []
        },
        "As our examples shows, you have to be careful with what you allow to be": {
            "content": "unpickled.  Therefore if security is a concern, you may want to consider\nalternatives such as the marshalling API in *note xmlrpc.client: 128. or\nthird-party solutions.\n\nFile: python3.12.info,  Node: Performance<2>,  Next: Examples<6>,  Prev: Restricting Globals,  Up: pickle -- Python object serialization\n\n5.12.1.17 Performance\n.....................\n",
            "subsections": []
        },
        "Recent versions of the pickle protocol (from protocol 2 and upwards)": {
            "content": "feature efficient binary encodings for several common features and\nbuilt-in types.  Also, the *note pickle: a1. module has a transparent\noptimizer written in C.\n\nFile: python3.12.info,  Node: Examples<6>,  Prev: Performance<2>,  Up: pickle -- Python object serialization\n\n5.12.1.18 Examples\n..................\n\nFor the simplest code, use the *note dump(): 257e. and *note load():\nb62. functions.\n\nimport pickle\n\n# An arbitrary collection of objects supported by pickle.\ndata = {\n'a': [1, 2.0, 3+4j],\n'b': (\"character string\", b\"byte string\"),\n'c': {None, True, False}\n}\n\nwith open('data.pickle', 'wb') as f:\n# Pickle the 'data' dictionary using the highest protocol available.\npickle.dump(data, f, pickle.HIGHESTPROTOCOL)\n\nThe following example reads the resulting pickled data.\n\nimport pickle\n\nwith open('data.pickle', 'rb') as f:\n# The protocol version used is detected automatically, so we do not\n# have to specify it.\ndata = pickle.load(f)\n\nSee also\n........\n\nModule *note copyreg: 24.\n\nPickle interface constructor registration for extension types.\n\nModule *note pickletools: a2.\n\nTools for working with and analyzing pickled data.\n\nModule *note shelve: be.\n\nIndexed databases of objects; uses *note pickle: a1.\n\nModule *note copy: 23.\n\nShallow and deep object copying.\n\nModule *note marshal: 88.\n\nHigh-performance serialization of built-in types.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: copyreg -- Register pickle support functions,  Next: shelve -- Python object persistence,  Prev: pickle -- Python object serialization,  Up: Data Persistence": {
            "content": "'Source code:' Lib/copyreg.py(1)\n\n\n\nThe *note copyreg: 24. module offers a way to define functions used\nwhile pickling specific objects.  The *note pickle: a1. and *note copy:\n23. modules use those functions when pickling/copying those objects.",
            "subsections": []
        },
        "The module provides configuration information about object constructors": {
            "content": "which are not classes.  Such constructors may be factory functions or\nclass instances.\n\n-- Function: copyreg.constructor (object)\n\nDeclares 'object' to be a valid constructor.  If 'object' is not\ncallable (and hence not valid as a constructor), raises *note\nTypeError: 28e.\n\n-- Function: copyreg.pickle (type, function, constructorob=None)\n\nDeclares that 'function' should be used as a \"reduction\" function\nfor objects of type 'type'.  'function' must return either a string\nor a tuple containing between two and six elements.  See the *note\ndispatchtable: f92. for more details on the interface of\n'function'.\n\nThe 'constructorob' parameter is a legacy feature and is now\nignored, but if passed it must be a callable.\n\nNote that the *note dispatchtable: f92. attribute of a pickler\nobject or subclass of *note pickle.Pickler: 849. can also be used\nfor declaring reduction functions.\n\n* Menu:\n\n* Example: Example<5>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/copyreg.py\n\nFile: python3.12.info,  Node: Example<5>,  Up: copyreg -- Register pickle support functions\n\n5.12.2.1 Example\n................\n",
            "subsections": []
        },
        "The example below would like to show how to register a pickle function": {
            "content": "and how it will be used:\n\n>>> import copyreg, copy, pickle\n>>> class C:\n...     def init(self, a):\n...         self.a = a\n...\n>>> def picklec(c):\n...     print(\"pickling a C instance...\")\n...     return C, (c.a,)\n...\n>>> copyreg.pickle(C, picklec)\n>>> c = C(1)\n>>> d = copy.copy(c)\npickling a C instance...\n>>> p = pickle.dumps(c)\npickling a C instance...\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: shelve -- Python object persistence,  Next: marshal -- Internal Python object serialization,  Prev: copyreg -- Register pickle support functions,  Up: Data Persistence": {
            "content": "'Source code:' Lib/shelve.py(1)\n\n\n\nA \"shelf\" is a persistent, dictionary-like object.  The difference with\n\"dbm\" databases is that the values (not the keys!)  in a shelf can be\nessentially arbitrary Python objects -- anything that the *note pickle:\na1. module can handle.  This includes most class instances, recursive\ndata types, and objects containing lots of shared sub-objects.  The keys\nare ordinary strings.\n\n-- Function: shelve.open (filename, flag='c', protocol=None,\nwriteback=False)\n\nOpen a persistent dictionary.  The filename specified is the base\nfilename for the underlying database.  As a side-effect, an\nextension may be added to the filename and more than one file may\nbe created.  By default, the underlying database file is opened for\nreading and writing.  The optional 'flag' parameter has the same\ninterpretation as the 'flag' parameter of *note dbm.open(): d97.\n\nBy default, pickles created with *note pickle.DEFAULTPROTOCOL:\n623. are used to serialize values.  The version of the pickle\nprotocol can be specified with the 'protocol' parameter.\n\nBecause of Python semantics, a shelf cannot know when a mutable\npersistent-dictionary entry is modified.  By default modified\nobjects are written 'only' when assigned to the shelf (see *note\nExample: 25a9.).  If the optional 'writeback' parameter is set to\n'True', all entries accessed are also cached in memory, and written\nback on *note sync(): 25aa. and *note close(): 25ab.; this can make\nit handier to mutate mutable entries in the persistent dictionary,\nbut, if many entries are accessed, it can consume vast amounts of\nmemory for the cache, and it can make the close operation very slow\nsince all accessed entries are written back (there is no way to\ndetermine which accessed entries are mutable, nor which ones were\nactually mutated).\n\nChanged in version 3.10: *note pickle.DEFAULTPROTOCOL: 623. is now\nused as the default pickle protocol.\n\nChanged in version 3.11: Accepts *note path-like object: 957. for\nfilename.\n\nNote: Do not rely on the shelf being closed automatically;\nalways call *note close(): 25ab. explicitly when you don't\nneed it any more, or use *note shelve.open(): 25a8. as a\ncontext manager:\n\nwith shelve.open('spam') as db:\ndb['eggs'] = 'eggs'\nWarning: Because the *note shelve: be. module is backed by *note\npickle: a1, it is insecure to load a shelf from an untrusted\nsource.  Like with pickle, loading a shelf can execute arbitrary\ncode.\n",
            "subsections": []
        },
        "Shelf objects support most of methods and operations supported by": {
            "content": "dictionaries (except copying, constructors and operators '|' and '|=').",
            "subsections": []
        },
        "This eases the transition from dictionary based scripts to those": {
            "content": "requiring persistent storage.\n\nTwo additional methods are supported:\n\n-- Method: Shelf.sync ()\n\nWrite back all entries in the cache if the shelf was opened with\n'writeback' set to *note True: a53.  Also empty the cache and\nsynchronize the persistent dictionary on disk, if feasible.  This\nis called automatically when the shelf is closed with *note\nclose(): 25ab.\n\n-- Method: Shelf.close ()\n\nSynchronize and close the persistent 'dict' object.  Operations on\na closed shelf will fail with a *note ValueError: 183.\n\nSee also\n........\n",
            "subsections": []
        },
        "Persistent dictionary recipe(2) with widely supported storage formats": {
            "content": "and having the speed of native dictionaries.\n\n* Menu:\n\n* Restrictions::\n* Example: Example<6>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/shelve.py\n\n(2) https://code.activestate.com/recipes/576642/\n\nFile: python3.12.info,  Node: Restrictions,  Next: Example<6>,  Up: shelve -- Python object persistence\n\n5.12.3.1 Restrictions\n.....................\n\n* The choice of which database package will be used (such as *note\ndbm.ndbm: 32. or *note dbm.gnu: 31.) depends on which interface is\navailable.  Therefore it is not safe to open the database directly\nusing *note dbm: 2f.  The database is also (unfortunately) subject\nto the limitations of *note dbm: 2f, if it is used -- this means\nthat (the pickled representation of) the objects stored in the\ndatabase should be fairly small, and in rare cases key collisions\nmay cause the database to refuse updates.\n\n* The *note shelve: be. module does not support 'concurrent'\nread/write access to shelved objects.  (Multiple simultaneous read\naccesses are safe.)  When a program has a shelf open for writing,\nno other program should have it open for reading or writing.  Unix\nfile locking can be used to solve this, but this differs across\nUnix versions and requires knowledge about the database\nimplementation used.\n\n* On macOS *note dbm.ndbm: 32. can silently corrupt the database file\non updates, which can cause hard crashes when trying to read from\nthe database.\n\n-- Class: shelve.Shelf (dict, protocol=None, writeback=False,\nkeyencoding='utf-8')\n\nA subclass of *note collections.abc.MutableMapping: f1e. which\nstores pickled values in the 'dict' object.\n\nBy default, pickles created with *note pickle.DEFAULTPROTOCOL:\n623. are used to serialize values.  The version of the pickle\nprotocol can be specified with the 'protocol' parameter.  See the\n*note pickle: a1. documentation for a discussion of the pickle\nprotocols.\n\nIf the 'writeback' parameter is 'True', the object will hold a\ncache of all entries accessed and write them back to the 'dict' at\nsync and close times.  This allows natural operations on mutable\nentries, but can consume much more memory and make sync and close\ntake a long time.\n\nThe 'keyencoding' parameter is the encoding used to encode keys\nbefore they are used with the underlying dict.\n\nA *note Shelf: e0a. object can also be used as a context manager,\nin which case it will be automatically closed when the *note with:\n396. block ends.\n\nChanged in version 3.2: Added the 'keyencoding' parameter;\npreviously, keys were always encoded in UTF-8.\n\nChanged in version 3.4: Added context manager support.\n\nChanged in version 3.10: *note pickle.DEFAULTPROTOCOL: 623. is now\nused as the default pickle protocol.\n\n-- Class: shelve.BsdDbShelf (dict, protocol=None, writeback=False,\nkeyencoding='utf-8')\n\nA subclass of *note Shelf: e0a. which exposes 'first()', 'next()',\n'previous()', 'last()' and 'setlocation()' methods.  These are\navailable in the third-party 'bsddb' module from pybsddb(1) but not\nin other database modules.  The 'dict' object passed to the\nconstructor must support those methods.  This is generally\naccomplished by calling one of 'bsddb.hashopen()', 'bsddb.btopen()'\nor 'bsddb.rnopen()'.  The optional 'protocol', 'writeback', and\n'keyencoding' parameters have the same interpretation as for the\n*note Shelf: e0a. class.\n\n-- Class: shelve.DbfilenameShelf (filename, flag='c', protocol=None,\nwriteback=False)\n\nA subclass of *note Shelf: e0a. which accepts a 'filename' instead\nof a dict-like object.  The underlying file will be opened using\n*note dbm.open(): d97.  By default, the file will be created and\nopened for both read and write.  The optional 'flag' parameter has\nthe same interpretation as for the *note open(): 25a8. function.\nThe optional 'protocol' and 'writeback' parameters have the same\ninterpretation as for the *note Shelf: e0a. class.\n\n---------- Footnotes ----------\n\n(1) https://www.jcea.es/programacion/pybsddb.htm\n\nFile: python3.12.info,  Node: Example<6>,  Prev: Restrictions,  Up: shelve -- Python object persistence\n\n5.12.3.2 Example\n................\n",
            "subsections": []
        },
        "To summarize the interface ('key' is a string, 'data' is an arbitrary": {
            "content": "object):\n\nimport shelve\n\nd = shelve.open(filename)  # open -- file may get suffix added by low-level\n# library\n\nd[key] = data              # store data at key (overwrites old data if\n# using an existing key)\ndata = d[key]              # retrieve a COPY of data at key (raise KeyError\n# if no such key)\ndel d[key]                 # delete data stored at key (raises KeyError\n# if no such key)\n\nflag = key in d            # true if the key exists\nklist = list(d.keys())     # a list of all existing keys (slow!)\n\n# as d was opened WITHOUT writeback=True, beware:\nd['xx'] = [0, 1, 2]        # this works as expected, but...\nd['xx'].append(3)          # *this doesn't!* -- d['xx'] is STILL [0, 1, 2]!\n\n# having opened d without writeback=True, you need to code carefully:\ntemp = d['xx']             # extracts the copy\ntemp.append(5)             # mutates the copy\nd['xx'] = temp             # stores the copy right back, to persist it\n\n# or, d=shelve.open(filename,writeback=True) would let you just code\n# d['xx'].append(5) and have it work as expected, BUT it would also\n# consume more memory and make the d.close() operation slower.\n\nd.close()                  # close it\n\nSee also\n........\n\nModule *note dbm: 2f.\n\nGeneric interface to 'dbm'-style databases.\n\nModule *note pickle: a1.\n\nObject serialization used by *note shelve: be.\n\nFile: python3.12.info,  Node: marshal -- Internal Python object serialization,  Next: dbm -- Interfaces to Unix \"databases\",  Prev: shelve -- Python object persistence,  Up: Data Persistence\n\n\n\n",
            "subsections": []
        },
        "This module contains functions that can read and write Python values in": {
            "content": "a binary format.  The format is specific to Python, but independent of\nmachine architecture issues (e.g., you can write a Python value to a\nfile on a PC, transport the file to a Sun, and read it back there).",
            "subsections": []
        },
        "Details of the format are undocumented on purpose; it may change between": {
            "content": "",
            "subsections": []
        },
        "Python versions (although it rarely does).  (1)": {
            "content": "This is not a general \"persistence\" module.  For general persistence and\ntransfer of Python objects through RPC calls, see the modules *note\npickle: a1. and *note shelve: be.  The *note marshal: 88. module exists\nmainly to support reading and writing the \"pseudo-compiled\" code for",
            "subsections": []
        },
        "Python modules of '.pyc' files.  Therefore, the Python maintainers": {
            "content": "reserve the right to modify the marshal format in backward incompatible\nways should the need arise.  If you're serializing and de-serializing\nPython objects, use the *note pickle: a1. module instead - the\nperformance is comparable, version independence is guaranteed, and\npickle supports a substantially wider range of objects than marshal.\n\nWarning: The *note marshal: 88. module is not intended to be secure\nagainst erroneous or maliciously constructed data.  Never unmarshal\ndata received from an untrusted or unauthenticated source.\n",
            "subsections": []
        },
        "Not all Python object types are supported; in general, only objects": {
            "content": "whose value is independent from a particular invocation of Python can be\nwritten and read by this module.  The following types are supported:\nbooleans, integers, floating point numbers, complex numbers, strings,\nbytes, bytearrays, tuples, lists, sets, frozensets, dictionaries, and\ncode objects, where it should be understood that tuples, lists, sets,\nfrozensets and dictionaries are only supported as long as the values\ncontained therein are themselves supported.  The singletons *note None:\n43f, *note Ellipsis: 1e91. and *note StopIteration: a40. can also be\nmarshalled and unmarshalled.  For format 'version' lower than 3,\nrecursive lists, sets and dictionaries cannot be written (see below).\n",
            "subsections": []
        },
        "There are functions that read/write files as well as functions operating": {
            "content": "on bytes-like objects.\n\nThe module defines these functions:\n\n-- Function: marshal.dump (value, file[, version])\n\nWrite the value on the open file.  The value must be a supported\ntype.  The file must be a writeable *note binary file: 1a0c.\n\nIf the value has (or contains an object that has) an unsupported\ntype, a *note ValueError: 183. exception is raised -- but garbage\ndata will also be written to the file.  The object will not be\nproperly read back by *note load(): 178b.\n\nThe 'version' argument indicates the data format that 'dump' should\nuse (see below).\n\nRaises an *note auditing event: 161d. 'marshal.dumps' with\narguments 'value', 'version'.\n\n-- Function: marshal.load (file)\n\nRead one value from the open file and return it.  If no valid value\nis read (e.g.  because the data has a different Python version's\nincompatible marshal format), raise *note EOFError: 114e, *note\nValueError: 183. or *note TypeError: 28e.  The file must be a\nreadable *note binary file: 1a0c.\n\nRaises an *note auditing event: 161d. 'marshal.load' with no\narguments.\n\nNote: If an object containing an unsupported type was\nmarshalled with *note dump(): 25b1, *note load(): 178b. will\nsubstitute 'None' for the unmarshallable type.\n\nChanged in version 3.10: This call used to raise a 'code.new'\naudit event for each code object.  Now it raises a single\n'marshal.load' event for the entire load operation.\n\n-- Function: marshal.dumps (value[, version])\n\nReturn the bytes object that would be written to a file by\n'dump(value, file)'.  The value must be a supported type.  Raise a\n*note ValueError: 183. exception if value has (or contains an\nobject that has) an unsupported type.\n\nThe 'version' argument indicates the data format that 'dumps'\nshould use (see below).\n\nRaises an *note auditing event: 161d. 'marshal.dumps' with\narguments 'value', 'version'.\n\n-- Function: marshal.loads (bytes)\n\nConvert the *note bytes-like object: b82. to a value.  If no valid\nvalue is found, raise *note EOFError: 114e, *note ValueError: 183.\nor *note TypeError: 28e.  Extra bytes in the input are ignored.\n\nRaises an *note auditing event: 161d. 'marshal.loads' with argument\n'bytes'.\n\nChanged in version 3.10: This call used to raise a 'code.new'\naudit event for each code object.  Now it raises a single\n'marshal.loads' event for the entire load operation.\n\nIn addition, the following constants are defined:\n\n-- Data: marshal.version\n\nIndicates the format that the module uses.  Version 0 is the\nhistorical format, version 1 shares interned strings and version 2\nuses a binary format for floating point numbers.  Version 3 adds\nsupport for object instancing and recursion.  The current version\nis 4.\n\n---------- Footnotes ----------\n\n(1) The name of this module stems from a bit of terminology used by\nthe designers of Modula-3 (amongst others), who use the term\n\"marshalling\" for shipping of data around in a self-contained form.\nStrictly speaking, \"to marshal\" means to convert some data from internal\nto external form (in an RPC buffer for instance) and \"unmarshalling\" for\nthe reverse process.\n\nFile: python3.12.info,  Node: dbm -- Interfaces to Unix \"databases\",  Next: sqlite3 -- DB-API 2 0 interface for SQLite databases,  Prev: marshal -- Internal Python object serialization,  Up: Data Persistence\n\n\n'Source code:' Lib/dbm/init.py(1)\n\n\n\n*note dbm: 2f. is a generic interface to variants of the DBM database --\n*note dbm.gnu: 31. or *note dbm.ndbm: 32.  If none of these modules is\ninstalled, the slow-but-simple implementation in module *note dbm.dumb:\n30. will be used.  There is a third party interface(2) to the Oracle\nBerkeley DB.\n\n-- Exception: dbm.error\n\nA tuple containing the exceptions that can be raised by each of the\nsupported modules, with a unique exception also named *note\ndbm.error: 25b6. as the first item -- the latter is used when *note\ndbm.error: 25b6. is raised.\n\n-- Function: dbm.whichdb (filename)\n\nThis function attempts to guess which of the several simple\ndatabase modules available -- *note dbm.gnu: 31, *note dbm.ndbm: 32.\nor *note dbm.dumb: 30. -- should be used to open a given file.\n\nReturn one of the following values:\n\n* 'None' if the file can't be opened because it's unreadable or\ndoesn't exist\n\n* the empty string ('''') if the file's format can't be guessed\n\n* a string containing the required module name, such as\n''dbm.ndbm'' or ''dbm.gnu''\n\nChanged in version 3.11: 'filename' accepts a *note path-like\nobject: 957.\n\n-- Function: dbm.open (file, flag='r', mode=0o666)\n\nOpen a database and return the corresponding database object.\n\n\nParameters:\n\n* 'file' (*note path-like object: 957.) - The database file to\nopen.\n\nIf the database file already exists, the *note whichdb():\n25b7. function is used to determine its type and the\nappropriate module is used; if it does not exist, the first\nsubmodule listed above that can be imported is used.\n\n* 'flag' (*note str: 157.) -\n\n* ''r'' (default): Open existing database for reading only.\n\n* ''w'': Open existing database for reading and writing.\n\n* ''c'': Open database for reading and writing, creating it\nif it doesn't exist.\n\n* ''n'': Always create a new, empty database, open for\nreading and writing.\n\n* 'mode' (*note int: 17e.) - The Unix file access mode of the\nfile (default: octal '0o666'), used only when the database has\nto be created.\n\nChanged in version 3.11: 'file' accepts a *note path-like object:\n957.\n\nThe object returned by *note open(): d97. supports the same basic\nfunctionality as a *note dict: 237.; keys and their corresponding values\ncan be stored, retrieved, and deleted, and the *note in: 250. operator\nand the 'keys()' method are available, as well as 'get()' and\n'setdefault()' methods.\n\nKey and values are always stored as *note bytes: 295.  This means that\nwhen strings are used they are implicitly converted to the default\nencoding before being stored.\n\nThese objects also support being used in a *note with: 396. statement,\nwhich will automatically close them when done.\n",
            "subsections": []
        },
        "Changed in version 3.2: 'get()' and 'setdefault()' methods are now": {
            "content": "available for all *note dbm: 2f. backends.\n",
            "subsections": []
        },
        "Changed in version 3.4: Added native support for the context management": {
            "content": "protocol to the objects returned by *note open(): d97.\n",
            "subsections": []
        },
        "Changed in version 3.8: Deleting a key from a read-only database raises": {
            "content": "a database module specific exception instead of *note KeyError: 8cf.\n",
            "subsections": []
        },
        "The following example records some hostnames and a corresponding title,": {
            "content": "and then prints out the contents of the database:\n\nimport dbm\n\n# Open database, creating it if necessary.\nwith dbm.open('cache', 'c') as db:\n\n# Record some values\ndb[b'hello'] = b'there'\ndb['www.python.org'] = 'Python Website'\ndb['www.cnn.com'] = 'Cable News Network'\n\n# Note that the keys are considered bytes now.\nassert db[b'www.python.org'] == b'Python Website'\n# Notice how the value is now in bytes.\nassert db['www.cnn.com'] == b'Cable News Network'\n\n# Often-used methods of the dict interface work too.\nprint(db.get('python.org', b'not present'))\n\n# Storing a non-string key or value will raise an exception (most\n# likely a TypeError).\ndb['www.yahoo.com'] = 4\n\n# db is automatically closed when leaving the with statement.\n\nSee also\n........\n\nModule *note shelve: be.\n\nPersistence module which stores non-string data.\n\nThe individual submodules are described in the following sections.\n\n* Menu:\n\n* dbm.gnu -- GNU database manager: dbm gnu -- GNU database manager.\n* dbm.ndbm -- New Database Manager: dbm ndbm -- New Database Manager.\n* dbm.dumb -- Portable DBM implementation: dbm dumb -- Portable DBM implementation.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/dbm/init.py\n\n(2) https://www.jcea.es/programacion/pybsddb.htm\n\nFile: python3.12.info,  Node: dbm gnu -- GNU database manager,  Next: dbm ndbm -- New Database Manager,  Up: dbm -- Interfaces to Unix \"databases\"\n\n5.12.5.1 'dbm.gnu' -- GNU database manager\n.........................................\n\n'Source code:' Lib/dbm/gnu.py(1)\n\n\n\nThe *note dbm.gnu: 31. module provides an interface to the GDBM (GNU\ndbm) library, similar to the *note dbm.ndbm: 32. module, but with\nadditional functionality like crash tolerance.\n\nNote: The file formats created by *note dbm.gnu: 31. and *note\ndbm.ndbm: 32. are incompatible and can not be used interchangeably.\n\n-- Exception: dbm.gnu.error\n\nRaised on *note dbm.gnu: 31.-specific errors, such as I/O errors.\n*note KeyError: 8cf. is raised for general mapping errors like\nspecifying an incorrect key.\n\n-- Function: dbm.gnu.open (filename, flag='r', mode=0o666, /)\n\nOpen a GDBM database and return a 'gdbm' object.\n\n\nParameters:\n\n* 'filename' (*note path-like object: 957.) - The database file\nto open.\n\n* 'flag' (*note str: 157.) -\n\n* ''r'' (default): Open existing database for reading only.\n\n* ''w'': Open existing database for reading and writing.\n\n* ''c'': Open database for reading and writing, creating it\nif it doesn't exist.\n\n* ''n'': Always create a new, empty database, open for\nreading and writing.\n\nThe following additional characters may be appended to control\nhow the database is opened:\n\n* ''f'': Open the database in fast mode.  Writes to the\ndatabase will not be synchronized.\n\n* ''s'': Synchronized mode.  Changes to the database will\nbe written immediately to the file.\n\n* ''u'': Do not lock database.\n\nNot all flags are valid for all versions of GDBM. See the\n*note openflags: 25b9. member for a list of supported flag\ncharacters.\n\n* 'mode' (*note int: 17e.) - The Unix file access mode of the\nfile (default: octal '0o666'), used only when the database has\nto be created.\n\n\nRaises: *note error: 8cd. - If an invalid 'flag' argument is\npassed.\n\nChanged in version 3.11: 'filename' accepts a *note path-like\nobject: 957.\n\n-- Data: dbm.gnu.openflags\n\nA string of characters the 'flag' parameter of *note open():\n17bd. supports.\n\n'gdbm' objects behave similar to *note mappings: 1030, but\n'items()' and 'values()' methods are not supported.  The following\nmethods are also provided:\n\n-- Method: gdbm.firstkey ()\n\nIt's possible to loop over every key in the database using\nthis method and the *note nextkey(): 25bb. method.  The\ntraversal is ordered by GDBM's internal hash values, and won't\nbe sorted by the key values.  This method returns the starting\nkey.\n\n-- Method: gdbm.nextkey (key)\n\nReturns the key that follows 'key' in the traversal.  The\nfollowing code prints every key in the database 'db', without\nhaving to create a list in memory that contains them all:\n\nk = db.firstkey()\nwhile k is not None:\nprint(k)\nk = db.nextkey(k)\n\n-- Method: gdbm.reorganize ()\n\nIf you have carried out a lot of deletions and would like to\nshrink the space used by the GDBM file, this routine will\nreorganize the database.  'gdbm' objects will not shorten the\nlength of a database file except by using this reorganization;\notherwise, deleted file space will be kept and reused as new\n(key, value) pairs are added.\n\n-- Method: gdbm.sync ()\n\nWhen the database has been opened in fast mode, this method\nforces any unwritten data to be written to the disk.\n\n-- Method: gdbm.close ()\n\nClose the GDBM database.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/dbm/gnu.py\n\nFile: python3.12.info,  Node: dbm ndbm -- New Database Manager,  Next: dbm dumb -- Portable DBM implementation,  Prev: dbm gnu -- GNU database manager,  Up: dbm -- Interfaces to Unix \"databases\"\n\n5.12.5.2 'dbm.ndbm' -- New Database Manager\n..........................................\n\n'Source code:' Lib/dbm/ndbm.py(1)\n\n\n\nThe *note dbm.ndbm: 32. module provides an interface to the NDBM (New\nDatabase Manager) library.  This module can be used with the \"classic\"\nNDBM interface or the GDBM compatibility interface.\n\nNote: The file formats created by *note dbm.gnu: 31. and *note\ndbm.ndbm: 32. are incompatible and can not be used interchangeably.\n\nWarning: The NDBM library shipped as part of macOS has an\nundocumented limitation on the size of values, which can result in\ncorrupted database files when storing values larger than this\nlimit.  Reading such corrupted files can result in a hard crash\n(segmentation fault).\n\n-- Exception: dbm.ndbm.error\n\nRaised on *note dbm.ndbm: 32.-specific errors, such as I/O errors.\n*note KeyError: 8cf. is raised for general mapping errors like\nspecifying an incorrect key.\n\n-- Data: dbm.ndbm.library\n\nName of the NDBM implementation library used.\n\n-- Function: dbm.ndbm.open (filename, flag='r', mode=0o666, /)\n\nOpen an NDBM database and return an 'ndbm' object.\n\n\nParameters:\n\n* 'filename' (*note path-like object: 957.) - The basename of\nthe database file (without the '.dir' or '.pag' extensions).\n\n* 'flag' (*note str: 157.) -\n\n* ''r'' (default): Open existing database for reading only.\n\n* ''w'': Open existing database for reading and writing.\n\n* ''c'': Open database for reading and writing, creating it\nif it doesn't exist.\n\n* ''n'': Always create a new, empty database, open for\nreading and writing.\n\n* 'mode' (*note int: 17e.) - The Unix file access mode of the\nfile (default: octal '0o666'), used only when the database has\nto be created.\n\n'ndbm' objects behave similar to *note mappings: 1030, but\n'items()' and 'values()' methods are not supported.  The following\nmethods are also provided:\n\nChanged in version 3.11: Accepts *note path-like object: 957. for\nfilename.\n\n-- Method: ndbm.close ()\n\nClose the NDBM database.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/dbm/ndbm.py\n\nFile: python3.12.info,  Node: dbm dumb -- Portable DBM implementation,  Prev: dbm ndbm -- New Database Manager,  Up: dbm -- Interfaces to Unix \"databases\"\n\n5.12.5.3 'dbm.dumb' -- Portable DBM implementation\n.................................................\n\n'Source code:' Lib/dbm/dumb.py(1)\n\nNote: The *note dbm.dumb: 30. module is intended as a last resort\nfallback for the *note dbm: 2f. module when a more robust module is\nnot available.  The *note dbm.dumb: 30. module is not written for\nspeed and is not nearly as heavily used as the other database\nmodules.\n\n\n\nThe *note dbm.dumb: 30. module provides a persistent *note dict:\n237.-like interface which is written entirely in Python.  Unlike other\n*note dbm: 2f. backends, such as *note dbm.gnu: 31, no external library\nis required.\n\nThe 'dbm.dumb' module defines the following:\n\n-- Exception: dbm.dumb.error\n\nRaised on *note dbm.dumb: 30.-specific errors, such as I/O errors.\n*note KeyError: 8cf. is raised for general mapping errors like\nspecifying an incorrect key.\n\n-- Function: dbm.dumb.open (filename, flag='c', mode=0o666)\n\nOpen a 'dbm.dumb' database.  The returned database object behaves\nsimilar to a *note mapping: 1030, in addition to providing *note\nsync(): 25c3. and *note close(): 25c4. methods.\n\n\nParameters:\n\n* 'filename' - The basename of the database file (without\nextensions).  A new database creates the following files:\n\n- '`filename'.dat'\n\n- '`filename'.dir'\n\n* 'flag' (*note str: 157.) -\n\n* ''r'': Open existing database for reading only.\n\n* ''w'': Open existing database for reading and writing.\n\n* ''c'' (default): Open database for reading and writing,\ncreating it if it doesn't exist.\n\n* ''n'': Always create a new, empty database, open for\nreading and writing.\n\n* 'mode' (*note int: 17e.) - The Unix file access mode of the\nfile (default: octal '0o666'), used only when the database has\nto be created.\n\nWarning: It is possible to crash the Python interpreter when\nloading a database with a sufficiently large/complex entry due\nto stack depth limitations in Python's AST compiler.\n\nChanged in version 3.5: *note open(): 8c8. always creates a new\ndatabase when 'flag' is ''n''.\n\nChanged in version 3.8: A database opened read-only if 'flag' is\n''r''.  A database is not created if it does not exist if 'flag' is\n''r'' or ''w''.\n\nChanged in version 3.11: 'filename' accepts a *note path-like\nobject: 957.\n\nIn addition to the methods provided by the *note\ncollections.abc.MutableMapping: f1e. class, the following methods\nare provided:\n\n-- Method: dumbdbm.sync ()\n\nSynchronize the on-disk directory and data files.  This method\nis called by the 'Shelve.sync()' method.\n\n-- Method: dumbdbm.close ()\n\nClose the database.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/dbm/dumb.py\n\nFile: python3.12.info,  Node: sqlite3 -- DB-API 2 0 interface for SQLite databases,  Prev: dbm -- Interfaces to Unix \"databases\",  Up: Data Persistence\n\n\n'Source code:' Lib/sqlite3/(1)\n\nSQLite is a C library that provides a lightweight disk-based database\nthat doesn't require a separate server process and allows accessing the\ndatabase using a nonstandard variant of the SQL query language.  Some\napplications can use SQLite for internal data storage.  It's also\npossible to prototype an application using SQLite and then port the code\nto a larger database such as PostgreSQL or Oracle.\n\nThe 'sqlite3' module was written by Gerhard Ha\"ring.  It provides an SQL\ninterface compliant with the DB-API 2.0 specification described by PEP\n249(2), and requires SQLite 3.7.15 or newer.\n\nThis document includes four main sections:\n\n* *note Tutorial: 25c8. teaches how to use the 'sqlite3' module.\n\n* *note Reference: 25c9. describes the classes and functions this\nmodule defines.\n\n* *note How-to guides: 25ca. details how to handle specific tasks.\n\n* *note Explanation: 25cb. provides in-depth background on\ntransaction control.\n\nSee also\n........\n\n'https://www.sqlite.org'\n\nThe SQLite web page; the documentation describes the syntax and the\navailable data types for the supported SQL dialect.\n\n'https://www.w3schools.com/sql/'\n\nTutorial, reference and examples for learning SQL syntax.\n\nPEP 249(3) - Database API Specification 2.0\n\nPEP written by Marc-Andre' Lemburg.\n\n* Menu:\n\n* Tutorial::\n* Reference::\n* How-to guides::\n* Explanation::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/sqlite3/\n\n(2) https://peps.python.org/pep-0249/\n\n(3) https://peps.python.org/pep-0249/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Tutorial,  Next: Reference,  Up: sqlite3 -- DB-API 2 0 interface for SQLite databases": {
            "content": "5.12.6.1 Tutorial\n.................\n",
            "subsections": []
        },
        "In this tutorial, you will create a database of Monty Python movies": {
            "content": "using basic 'sqlite3' functionality.  It assumes a fundamental\nunderstanding of database concepts, including cursors(1) and\ntransactions(2).\n",
            "subsections": []
        },
        "First, we need to create a new database and open a database connection": {
            "content": "to allow 'sqlite3' to work with it.  Call *note sqlite3.connect(): 1da.\nto create a connection to the database 'tutorial.db' in the current\nworking directory, implicitly creating it if it does not exist:\n\nimport sqlite3\ncon = sqlite3.connect(\"tutorial.db\")\n\nThe returned *note Connection: 1d9. object 'con' represents the\nconnection to the on-disk database.\n",
            "subsections": []
        },
        "In order to execute SQL statements and fetch results from SQL queries,": {
            "content": "we will need to use a database cursor.  Call *note con.cursor(): 25cd.\nto create the *note Cursor: 25ce.:\n\ncur = con.cursor()\n",
            "subsections": []
        },
        "Now that we've got a database connection and a cursor, we can create a": {
            "content": "database table 'movie' with columns for title, release year, and review\nscore.  For simplicity, we can just use column names in the table\ndeclaration - thanks to the flexible typing(3) feature of SQLite,\nspecifying the data types is optional.  Execute the 'CREATE TABLE'\nstatement by calling *note cur.execute(...): 234.:\n\ncur.execute(\"CREATE TABLE movie(title, year, score)\")\n",
            "subsections": []
        },
        "We can verify that the new table has been created by querying the": {
            "content": "'sqlitemaster' table built-in to SQLite, which should now contain an\nentry for the 'movie' table definition (see The Schema Table(4) for\ndetails).  Execute that query by calling *note cur.execute(...): 234,\nassign the result to 'res', and call *note res.fetchone(): 25cf. to\nfetch the resulting row:\n\n>>> res = cur.execute(\"SELECT name FROM sqlitemaster\")\n>>> res.fetchone()\n('movie',)\n\nWe can see that the table has been created, as the query returns a *note\ntuple: 4b8. containing the table's name.  If we query 'sqlitemaster'\nfor a non-existent table 'spam', 'res.fetchone()' will return 'None':\n\n>>> res = cur.execute(\"SELECT name FROM sqlitemaster WHERE name='spam'\")\n>>> res.fetchone() is None\nTrue\n",
            "subsections": []
        },
        "Now, add two rows of data supplied as SQL literals by executing an": {
            "content": "'INSERT' statement, once again by calling *note cur.execute(...): 234.:\n\ncur.execute(\"\"\"\nINSERT INTO movie VALUES\n('Monty Python and the Holy Grail', 1975, 8.2),\n('And Now for Something Completely Different', 1971, 7.5)\n\"\"\")\n",
            "subsections": []
        },
        "The 'INSERT' statement implicitly opens a transaction, which needs to be": {
            "content": "committed before changes are saved in the database (see *note\nTransaction control: 25d0. for details).  Call *note con.commit(): 25d1.\non the connection object to commit the transaction:\n\ncon.commit()\n",
            "subsections": []
        },
        "We can verify that the data was inserted correctly by executing a": {
            "content": "'SELECT' query.  Use the now-familiar *note cur.execute(...): 234. to\nassign the result to 'res', and call *note res.fetchall(): 25d2. to\nreturn all resulting rows:\n\n>>> res = cur.execute(\"SELECT score FROM movie\")\n>>> res.fetchall()\n[(8.2,), (7.5,)]\n\nThe result is a *note list: 3dc. of two 'tuple's, one per row, each\ncontaining that row's 'score' value.\n\nNow, insert three more rows by calling *note cur.executemany(...):\n25d3.:\n\ndata = [\n(\"Monty Python Live at the Hollywood Bowl\", 1982, 7.9),\n(\"Monty Python's The Meaning of Life\", 1983, 7.5),\n(\"Monty Python's Life of Brian\", 1979, 8.0),\n]\ncur.executemany(\"INSERT INTO movie VALUES(?, ?, ?)\", data)\ncon.commit()  # Remember to commit the transaction after executing INSERT.\n\nNotice that '?' placeholders are used to bind 'data' to the query.\nAlways use placeholders instead of *note string formatting: 19f8. to\nbind Python values to SQL statements, to avoid SQL injection attacks(5)\n(see *note How to use placeholders to bind values in SQL queries: 235.\nfor more details).\n",
            "subsections": []
        },
        "We can verify that the new rows were inserted by executing a 'SELECT'": {
            "content": "query, this time iterating over the results of the query:\n\n>>> for row in cur.execute(\"SELECT year, title FROM movie ORDER BY year\"):\n...     print(row)\n(1971, 'And Now for Something Completely Different')\n(1975, 'Monty Python and the Holy Grail')\n(1979, \"Monty Python's Life of Brian\")\n(1982, 'Monty Python Live at the Hollywood Bowl')\n(1983, \"Monty Python's The Meaning of Life\")\n\nEach row is a two-item *note tuple: 4b8. of '(year, title)', matching\nthe columns selected in the query.\n",
            "subsections": []
        },
        "Finally, verify that the database has been written to disk by calling": {
            "content": "*note con.close(): 1416. to close the existing connection, opening a new\none, creating a new cursor, then querying the database:\n\n>>> con.close()\n>>> newcon = sqlite3.connect(\"tutorial.db\")\n>>> newcur = newcon.cursor()\n>>> res = newcur.execute(\"SELECT title, year FROM movie ORDER BY score DESC\")\n>>> title, year = res.fetchone()\n>>> print(f'The highest scoring Monty Python movie is {title!r}, released in {year}')\nThe highest scoring Monty Python movie is 'Monty Python and the Holy Grail', released in 1975\n>>> newcon.close()\n",
            "subsections": []
        },
        "You've now created an SQLite database using the 'sqlite3' module,": {
            "content": "inserted data and retrieved values from it in multiple ways.\n\nSee also\n........\n\n* *note How-to guides: 25ca. for further reading:\n\n* *note How to use placeholders to bind values in SQL queries:\n235.\n\n* *note How to adapt custom Python types to SQLite values: 25d4.\n\n* *note How to convert SQLite values to custom Python types:\n25d5.\n\n* *note How to use the connection context manager: 1540.\n\n* *note How to create and use row factories: 25d6.\n\n* *note Explanation: 25cb. for in-depth background on transaction\ncontrol.\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Cursor(databases)\n\n(2) https://en.wikipedia.org/wiki/Databasetransaction\n\n(3) https://www.sqlite.org/flextypegood.html\n\n(4) https://www.sqlite.org/schematab.html\n\n(5) https://en.wikipedia.org/wiki/SQLinjection\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Reference,  Next: How-to guides,  Prev: Tutorial,  Up: sqlite3 -- DB-API 2 0 interface for SQLite databases": {
            "content": "5.12.6.2 Reference\n..................\n\n* Menu:\n\n* Module functions::\n* Module constants::\n* Connection objects::\n* Cursor objects::\n* Row objects::\n* Blob objects::\n* PrepareProtocol objects::\n* Exceptions: Exceptions<6>.\n* SQLite and Python types::\n* Default adapters and converters (deprecated): Default adapters and converters deprecated.\n* Command-line interface::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Module functions,  Next: Module constants,  Up: Reference": {
            "content": "5.12.6.3 Module functions\n.........................\n\n-- Function: sqlite3.connect (database, timeout=5.0, detecttypes=0,\nisolationlevel='DEFERRED', checksamethread=True,\nfactory=sqlite3.Connection, cachedstatements=128, uri=False,\n*, autocommit=sqlite3.LEGACYTRANSACTIONCONTROL)\n\nOpen a connection to an SQLite database.\n\n\nParameters:\n\n* 'database' (*note path-like object: 957.) - The path to the\ndatabase file to be opened.  You can pass '\":memory:\"' to\ncreate an SQLite database existing only in memory(1), and open\na connection to it.\n\n* 'timeout' (*note float: 4b7.) - How many seconds the\nconnection should wait before raising an *note\nOperationalError: 15ff. when a table is locked.  If another\nconnection opens a transaction to modify a table, that table\nwill be locked until the transaction is committed.  Default\nfive seconds.\n\n* 'detecttypes' (*note int: 17e.) - Control whether and how\ndata types not *note natively supported by SQLite: 25db. are\nlooked up to be converted to Python types, using the\nconverters registered with *note registerconverter(): 25dc.\nSet it to any combination (using '|', bitwise or) of *note\nPARSEDECLTYPES: 25dd. and *note PARSECOLNAMES: 25de. to\nenable this.  Column names takes precedence over declared\ntypes if both flags are set.  Types cannot be detected for\ngenerated fields (for example 'max(data)'), even when the\n'detecttypes' parameter is set; *note str: 157. will be\nreturned instead.  By default ('0'), type detection is\ndisabled.\n\n* 'isolationlevel' (*note str: 157.' | ''None') - Control\nlegacy transaction handling behaviour.  See *note\nConnection.isolationlevel: 25df. and *note Transaction\ncontrol via the isolationlevel attribute: 25e0. for more\ninformation.  Can be '\"DEFERRED\"' (default), '\"EXCLUSIVE\"' or\n'\"IMMEDIATE\"'; or 'None' to disable opening transactions\nimplicitly.  Has no effect unless *note Connection.autocommit:\n1d8. is set to *note LEGACYTRANSACTIONCONTROL: 25e1. (the\ndefault).\n\n* 'checksamethread' (*note bool: 17d.) - If 'True' (default),\n*note ProgrammingError: 238. will be raised if the database\nconnection is used by a thread other than the one that created\nit.  If 'False', the connection may be accessed in multiple\nthreads; write operations may need to be serialized by the\nuser to avoid data corruption.  See *note threadsafety: 447.\nfor more information.\n\n* 'factory' (*note Connection: 1d9.) - A custom subclass of\n*note Connection: 1d9. to create the connection with, if not\nthe default *note Connection: 1d9. class.\n\n* 'cachedstatements' (*note int: 17e.) - The number of\nstatements that 'sqlite3' should internally cache for this\nconnection, to avoid parsing overhead.  By default, 128\nstatements.\n\n* 'uri' (*note bool: 17d.) - If set to 'True', 'database' is\ninterpreted as a URI (Uniform Resource Identifier) with a file\npath and an optional query string.  The scheme part 'must' be\n'\"file:\"', and the path can be relative or absolute.  The\nquery string allows passing parameters to SQLite, enabling\nvarious *note How to work with SQLite URIs: 25e2.\n\n* 'autocommit' (*note bool: 17d.) - Control PEP 249(2)\ntransaction handling behaviour.  See *note\nConnection.autocommit: 1d8. and *note Transaction control via\nthe autocommit attribute: 1db. for more information.\n'autocommit' currently defaults to *note\nLEGACYTRANSACTIONCONTROL: 25e1.  The default will change to\n'False' in a future Python release.\n\n\nReturn type: *note Connection: 1d9.\n\nRaises an *note auditing event: 161d. 'sqlite3.connect' with\nargument 'database'.\n\nRaises an *note auditing event: 161d. 'sqlite3.connect/handle' with\nargument 'connectionhandle'.\n\nChanged in version 3.4: Added the 'uri' parameter.\n\nChanged in version 3.7: 'database' can now also be a *note\npath-like object: 957, not only a string.\n\nChanged in version 3.10: Added the 'sqlite3.connect/handle'\nauditing event.\n\nChanged in version 3.12: Added the 'autocommit' parameter.\n\n-- Function: sqlite3.completestatement (statement)\n\nReturn 'True' if the string 'statement' appears to contain one or\nmore complete SQL statements.  No syntactic verification or parsing\nof any kind is performed, other than checking that there are no\nunclosed string literals and the statement is terminated by a\nsemicolon.\n\nFor example:\n\n>>> sqlite3.completestatement(\"SELECT foo FROM bar;\")\nTrue\n>>> sqlite3.completestatement(\"SELECT foo\")\nFalse\n\nThis function may be useful during command-line input to determine\nif the entered text seems to form a complete SQL statement, or if\nadditional input is needed before calling *note execute(): 234.\n\nSee 'runsource()' in Lib/sqlite3/main.py(3) for real-world use.\n\n-- Function: sqlite3.enablecallbacktracebacks (flag, /)\n\nEnable or disable callback tracebacks.  By default you will not get\nany tracebacks in user-defined functions, aggregates, converters,\nauthorizer callbacks etc.  If you want to debug them, you can call\nthis function with 'flag' set to 'True'.  Afterwards, you will get\ntracebacks from callbacks on *note sys.stderr: 757.  Use 'False' to\ndisable the feature again.\n\nNote: Errors in user-defined function callbacks are logged as\nunraisable exceptions.  Use an *note unraisable hook handler:\n448. for introspection of the failed callback.\n\n-- Function: sqlite3.registeradapter (type, adapter, /)\n\nRegister an 'adapter' *note callable: 25e6. to adapt the Python\ntype 'type' into an SQLite type.  The adapter is called with a\nPython object of type 'type' as its sole argument, and must return\na value of a *note type that SQLite natively understands: 25db.\n\n-- Function: sqlite3.registerconverter (typename, converter, /)\n\nRegister the 'converter' *note callable: 25e6. to convert SQLite\nobjects of type 'typename' into a Python object of a specific type.\nThe converter is invoked for all SQLite values of type 'typename';\nit is passed a *note bytes: 295. object and should return an object\nof the desired Python type.  Consult the parameter 'detecttypes'\nof *note connect(): 1da. for information regarding how type\ndetection works.\n\nNote: 'typename' and the name of the type in your query are matched\ncase-insensitively.\n\n---------- Footnotes ----------\n\n(1) https://sqlite.org/inmemorydb.html\n\n(2) https://peps.python.org/pep-0249/\n\n(3)\nhttps://github.com/python/cpython/tree/3.12/Lib/sqlite3/main.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Module constants,  Next: Connection objects,  Prev: Module functions,  Up: Reference": {
            "content": "5.12.6.4 Module constants\n.........................\n\n-- Data: sqlite3.LEGACYTRANSACTIONCONTROL\n\nSet *note autocommit: 1d8. to this constant to select old style\n(pre-Python 3.12) transaction control behaviour.  See *note\nTransaction control via the isolationlevel attribute: 25e0. for\nmore information.\n\n-- Data: sqlite3.PARSECOLNAMES\n\nPass this flag value to the 'detecttypes' parameter of *note\nconnect(): 1da. to look up a converter function by using the type\nname, parsed from the query column name, as the converter\ndictionary key.  The type name must be wrapped in square brackets\n('[]').\n\nSELECT p as \"p [point]\" FROM test;  ! will look up converter \"point\"\n\nThis flag may be combined with *note PARSEDECLTYPES: 25dd. using\nthe '|' (bitwise or) operator.\n\n-- Data: sqlite3.PARSEDECLTYPES\n\nPass this flag value to the 'detecttypes' parameter of *note\nconnect(): 1da. to look up a converter function using the declared\ntypes for each column.  The types are declared when the database\ntable is created.  'sqlite3' will look up a converter function\nusing the first word of the declared type as the converter\ndictionary key.  For example:\n\nCREATE TABLE test(\ni integer primary key,  ! will look up a converter named \"integer\"\np point,                ! will look up a converter named \"point\"\nn number(10)            ! will look up a converter named \"number\"\n)\n\nThis flag may be combined with *note PARSECOLNAMES: 25de. using\nthe '|' (bitwise or) operator.\n\n-- Data: sqlite3.SQLITEOK\n-- Data: sqlite3.SQLITEDENY\n-- Data: sqlite3.SQLITEIGNORE\n\nFlags that should be returned by the 'authorizercallback' *note\ncallable: 25e6. passed to *note Connection.setauthorizer(): 440,\nto indicate whether:\n\n* Access is allowed ('SQLITEOK'),\n\n* The SQL statement should be aborted with an error\n('SQLITEDENY')\n\n* The column should be treated as a 'NULL' value\n('SQLITEIGNORE')\n\n-- Data: sqlite3.apilevel\n\nString constant stating the supported DB-API level.  Required by\nthe DB-API. Hard-coded to '\"2.0\"'.\n\n-- Data: sqlite3.paramstyle\n\nString constant stating the type of parameter marker formatting\nexpected by the 'sqlite3' module.  Required by the DB-API.\nHard-coded to '\"qmark\"'.\n\nNote: The 'named' DB-API parameter style is also supported.\n\n-- Data: sqlite3.sqliteversion\n\nVersion number of the runtime SQLite library as a *note string:\n157.\n\n-- Data: sqlite3.sqliteversioninfo\n\nVersion number of the runtime SQLite library as a *note tuple: 4b8.\nof *note integers: 17e.\n\n-- Data: sqlite3.threadsafety\n\nInteger constant required by the DB-API 2.0, stating the level of\nthread safety the 'sqlite3' module supports.  This attribute is set\nbased on the default threading mode(1) the underlying SQLite\nlibrary is compiled with.  The SQLite threading modes are:\n\n1. 'Single-thread': In this mode, all mutexes are disabled and\nSQLite is unsafe to use in more than a single thread at once.\n\n2. 'Multi-thread': In this mode, SQLite can be safely used by\nmultiple threads provided that no single database connection\nis used simultaneously in two or more threads.\n\n3. 'Serialized': In serialized mode, SQLite can be safely used by\nmultiple threads with no restriction.\n\nThe mappings from SQLite threading modes to DB-API 2.0 threadsafety\nlevels are as follows:\n\nSQLite threading       threadsafety(2)       SQLITETHREADSAFE(3)       DB-API 2.0 meaning\nmode\n\n------------------------------------------------------------------------------------------------------------\n\nsingle-thread          0                     0                          Threads may not share the module\n\n\nmulti-thread           1                     2                          Threads may share the module, but\nnot connections\n\n\nserialized             3                     1                          Threads may share the module,\nconnections and cursors\n\n\nChanged in version 3.11: Set 'threadsafety' dynamically instead of\nhard-coding it to '1'.\n\n-- Data: sqlite3.version\n\nVersion number of this module as a *note string: 157.  This is not\nthe version of the SQLite library.\n\nDeprecated since version 3.12, will be removed in version 3.14:\nThis constant used to reflect the version number of the 'pysqlite'\npackage, a third-party library which used to upstream changes to\n'sqlite3'.  Today, it carries no meaning or practical value.\n\n-- Data: sqlite3.versioninfo\n\nVersion number of this module as a *note tuple: 4b8. of *note\nintegers: 17e.  This is not the version of the SQLite library.\n\nDeprecated since version 3.12, will be removed in version 3.14:\nThis constant used to reflect the version number of the 'pysqlite'\npackage, a third-party library which used to upstream changes to\n'sqlite3'.  Today, it carries no meaning or practical value.\n\n-- Data: sqlite3.SQLITEDBCONFIGDEFENSIVE\n-- Data: sqlite3.SQLITEDBCONFIGDQSDDL\n-- Data: sqlite3.SQLITEDBCONFIGDQSDML\n-- Data: sqlite3.SQLITEDBCONFIGENABLEFKEY\n-- Data: sqlite3.SQLITEDBCONFIGENABLEFTS3TOKENIZER\n-- Data: sqlite3.SQLITEDBCONFIGENABLELOADEXTENSION\n-- Data: sqlite3.SQLITEDBCONFIGENABLEQPSG\n-- Data: sqlite3.SQLITEDBCONFIGENABLETRIGGER\n-- Data: sqlite3.SQLITEDBCONFIGENABLEVIEW\n-- Data: sqlite3.SQLITEDBCONFIGLEGACYALTERTABLE\n-- Data: sqlite3.SQLITEDBCONFIGLEGACYFILEFORMAT\n-- Data: sqlite3.SQLITEDBCONFIGNOCKPTONCLOSE\n-- Data: sqlite3.SQLITEDBCONFIGRESETDATABASE\n-- Data: sqlite3.SQLITEDBCONFIGTRIGGEREQP\n-- Data: sqlite3.SQLITEDBCONFIGTRUSTEDSCHEMA\n-- Data: sqlite3.SQLITEDBCONFIGWRITABLESCHEMA\n\nThese constants are used for the *note Connection.setconfig(): 1de.\nand *note getconfig(): 1dd. methods.\n\nThe availability of these constants varies depending on the version\nof SQLite Python was compiled with.\n\nNew in version 3.12.\n\nSee also\n........\n\n'https://www.sqlite.org/c3ref/cdbconfigdefensive.html'\n\nSQLite docs: Database Connection Configuration Options\n\n---------- Footnotes ----------\n\n(1) https://sqlite.org/threadsafe.html\n\n(2) https://peps.python.org/pep-0249/#threadsafety\n\n(3) https://sqlite.org/compile.html#threadsafe\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Connection objects,  Next: Cursor objects,  Prev: Module constants,  Up: Reference": {
            "content": "5.12.6.5 Connection objects\n...........................\n\n-- Class: sqlite3.Connection\n\nEach open SQLite database is represented by a 'Connection' object,\nwhich is created using *note sqlite3.connect(): 1da.  Their main\npurpose is creating *note Cursor: 25ce. objects, and *note\nTransaction control: 25d0.\n\nSee also\n........\n\n* *note How to use connection shortcut methods: 2603.\n\n* *note How to use the connection context manager: 1540.\n\nAn SQLite database connection has the following attributes and\nmethods:\n\n-- Method: cursor (factory=Cursor)\n\nCreate and return a *note Cursor: 25ce. object.  The cursor\nmethod accepts a single optional parameter 'factory'.  If\nsupplied, this must be a *note callable: 25e6. returning an\ninstance of *note Cursor: 25ce. or its subclasses.\n\n-- Method: blobopen (table, column, row, /, *, readonly=False,\nname='main')\n\nOpen a *note Blob: 44e. handle to an existing BLOB (Binary\nLarge OBject).\n\n\nParameters:\n\n* 'table' (*note str: 157.) - The name of the table where\nthe blob is located.\n\n* 'column' (*note str: 157.) - The name of the column where\nthe blob is located.\n\n* 'row' (*note str: 157.) - The name of the row where the\nblob is located.\n\n* 'readonly' (*note bool: 17d.) - Set to 'True' if the blob\nshould be opened without write permissions.  Defaults to\n'False'.\n\n* 'name' (*note str: 157.) - The name of the database where\nthe blob is located.  Defaults to '\"main\"'.\n\n\nRaises: *note OperationalError: 15ff. - When trying to open a\nblob in a 'WITHOUT ROWID' table.\n\n\nReturn type: *note Blob: 44e.\n\nNote: The blob size cannot be changed using the *note\nBlob: 44e. class.  Use the SQL function 'zeroblob' to\ncreate a blob with a fixed size.\n\nNew in version 3.11.\n\n-- Method: commit ()\n\nCommit any pending transaction to the database.  If *note\nautocommit: 1d8. is 'True', or there is no open transaction,\nthis method does nothing.  If 'autocommit' is 'False', a new\ntransaction is implicitly opened if a pending transaction was\ncommitted by this method.\n\n-- Method: rollback ()\n\nRoll back to the start of any pending transaction.  If *note\nautocommit: 1d8. is 'True', or there is no open transaction,\nthis method does nothing.  If 'autocommit' is 'False', a new\ntransaction is implicitly opened if a pending transaction was\nrolled back by this method.\n\n-- Method: close ()\n\nClose the database connection.  If *note autocommit: 1d8. is\n'False', any pending transaction is implicitly rolled back.\nIf 'autocommit' is 'True' or *note LEGACYTRANSACTIONCONTROL:\n25e1, no implicit transaction control is executed.  Make sure\nto *note commit(): 25d1. before closing to avoid losing\npending changes.\n\n-- Method: execute (sql, parameters=(), /)\n\nCreate a new *note Cursor: 25ce. object and call *note\nexecute(): 234. on it with the given 'sql' and 'parameters'.\nReturn the new cursor object.\n\n-- Method: executemany (sql, parameters, /)\n\nCreate a new *note Cursor: 25ce. object and call *note\nexecutemany(): 25d3. on it with the given 'sql' and\n'parameters'.  Return the new cursor object.\n\n-- Method: executescript (sqlscript, /)\n\nCreate a new *note Cursor: 25ce. object and call *note\nexecutescript(): 2608. on it with the given 'sqlscript'.\nReturn the new cursor object.\n\n-- Method: createfunction (name, narg, func, *,\ndeterministic=False)\n\nCreate or remove a user-defined SQL function.\n\n\nParameters:\n\n* 'name' (*note str: 157.) - The name of the SQL function.\n\n* 'narg' (*note int: 17e.) - The number of arguments the\nSQL function can accept.  If '-1', it may take any number\nof arguments.\n\n* 'func' (*note callback: 2609. | None) - A *note callable:\n25e6. that is called when the SQL function is invoked.\nThe callable must return *note a type natively supported\nby SQLite: 25db.  Set to 'None' to remove an existing SQL\nfunction.\n\n* 'deterministic' (*note bool: 17d.) - If 'True', the\ncreated SQL function is marked as deterministic(1), which\nallows SQLite to perform additional optimizations.\n\n\nRaises: *note NotSupportedError: 260a. - If 'deterministic' is\nused with SQLite versions older than 3.8.3.\n\nChanged in version 3.8: Added the 'deterministic' parameter.\n\nExample:\n\n>>> import hashlib\n>>> def md5sum(t):\n...     return hashlib.md5(t).hexdigest()\n>>> con = sqlite3.connect(\":memory:\")\n>>> con.createfunction(\"md5\", 1, md5sum)\n>>> for row in con.execute(\"SELECT md5(?)\", (b\"foo\",)):\n...     print(row)\n('acbd18db4cc2f85cedef654fccc4a4d8',)\n>>> con.close()\n\n-- Method: createaggregate (name, narg, aggregateclass)\n\nCreate or remove a user-defined SQL aggregate function.\n\n\nParameters:\n\n* 'name' (*note str: 157.) - The name of the SQL aggregate\nfunction.\n\n* 'narg' (*note int: 17e.) - The number of arguments the\nSQL aggregate function can accept.  If '-1', it may take\nany number of arguments.\n\n* 'aggregateclass' (*note class: 1698. | None) - A class\nmust implement the following methods:\n\n* 'step()': Add a row to the aggregate.\n\n* 'finalize()': Return the final result of the\naggregate as *note a type natively supported by\nSQLite: 25db.\n\nThe number of arguments that the 'step()' method must\naccept is controlled by 'narg'.\n\nSet to 'None' to remove an existing SQL aggregate\nfunction.\n\nExample:\n\nclass MySum:\ndef init(self):\nself.count = 0\n\ndef step(self, value):\nself.count += value\n\ndef finalize(self):\nreturn self.count\n\ncon = sqlite3.connect(\":memory:\")\ncon.createaggregate(\"mysum\", 1, MySum)\ncur = con.execute(\"CREATE TABLE test(i)\")\ncur.execute(\"INSERT INTO test(i) VALUES(1)\")\ncur.execute(\"INSERT INTO test(i) VALUES(2)\")\ncur.execute(\"SELECT mysum(i) FROM test\")\nprint(cur.fetchone()[0])\n\ncon.close()\n\n-- Method: createwindowfunction (name, numparams,\naggregateclass, /)\n\nCreate or remove a user-defined aggregate window function.\n\n\nParameters:\n\n* 'name' (*note str: 157.) - The name of the SQL aggregate\nwindow function to create or remove.\n\n* 'numparams' (*note int: 17e.) - The number of arguments\nthe SQL aggregate window function can accept.  If '-1',\nit may take any number of arguments.\n\n* 'aggregateclass' (*note class: 1698. | None) - A class\nthat must implement the following methods:\n\n* 'step()': Add a row to the current window.\n\n* 'value()': Return the current value of the\naggregate.\n\n* 'inverse()': Remove a row from the current window.\n\n* 'finalize()': Return the final result of the\naggregate as *note a type natively supported by\nSQLite: 25db.\n\nThe number of arguments that the 'step()' and 'value()'\nmethods must accept is controlled by 'numparams'.\n\nSet to 'None' to remove an existing SQL aggregate window\nfunction.\n\n\nRaises: *note NotSupportedError: 260a. - If used with a\nversion of SQLite older than 3.25.0, which does not support\naggregate window functions.\n\nNew in version 3.11.\n\nExample:\n\n# Example taken from https://www.sqlite.org/windowfunctions.html#udfwinfunc\nclass WindowSumInt:\ndef init(self):\nself.count = 0\n\ndef step(self, value):\n\"\"\"Add a row to the current window.\"\"\"\nself.count += value\n\ndef value(self):\n\"\"\"Return the current value of the aggregate.\"\"\"\nreturn self.count\n\ndef inverse(self, value):\n\"\"\"Remove a row from the current window.\"\"\"\nself.count -= value\n\ndef finalize(self):\n\"\"\"Return the final value of the aggregate.\n\nAny clean-up actions should be placed here.\n\"\"\"\nreturn self.count\n\n\ncon = sqlite3.connect(\":memory:\")\ncur = con.execute(\"CREATE TABLE test(x, y)\")\nvalues = [\n(\"a\", 4),\n(\"b\", 5),\n(\"c\", 3),\n(\"d\", 8),\n(\"e\", 1),\n]\ncur.executemany(\"INSERT INTO test VALUES(?, ?)\", values)\ncon.createwindowfunction(\"sumint\", 1, WindowSumInt)\ncur.execute(\"\"\"\nSELECT x, sumint(y) OVER (\nORDER BY x ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING\n) AS sumy\nFROM test ORDER BY x\n\"\"\")\nprint(cur.fetchall())\ncon.close()\n\n-- Method: createcollation (name, callable, /)\n\nCreate a collation named 'name' using the collating function\n'callable'.  'callable' is passed two *note string: 157.\narguments, and it should return an *note integer: 17e.:\n\n* '1' if the first is ordered higher than the second\n\n* '-1' if the first is ordered lower than the second\n\n* '0' if they are ordered equal\n\nThe following example shows a reverse sorting collation:\n\ndef collatereverse(string1, string2):\nif string1 == string2:\nreturn 0\nelif string1 < string2:\nreturn 1\nelse:\nreturn -1\n\ncon = sqlite3.connect(\":memory:\")\ncon.createcollation(\"reverse\", collatereverse)\n\ncur = con.execute(\"CREATE TABLE test(x)\")\ncur.executemany(\"INSERT INTO test(x) VALUES(?)\", [(\"a\",), (\"b\",)])\ncur.execute(\"SELECT x FROM test ORDER BY x COLLATE reverse\")\nfor row in cur:\nprint(row)\ncon.close()\n\nRemove a collation function by setting 'callable' to 'None'.\n\nChanged in version 3.11: The collation name can contain any\nUnicode character.  Earlier, only ASCII characters were\nallowed.\n\n-- Method: interrupt ()\n\nCall this method from a different thread to abort any queries\nthat might be executing on the connection.  Aborted queries\nwill raise an *note OperationalError: 15ff.\n\n-- Method: setauthorizer (authorizercallback)\n\nRegister *note callable: 25e6. 'authorizercallback' to be\ninvoked for each attempt to access a column of a table in the\ndatabase.  The callback should return one of *note SQLITEOK:\n25e9, *note SQLITEDENY: 25ea, or *note SQLITEIGNORE: 25eb.\nto signal how access to the column should be handled by the\nunderlying SQLite library.\n\nThe first argument to the callback signifies what kind of\noperation is to be authorized.  The second and third argument\nwill be arguments or 'None' depending on the first argument.\nThe 4th argument is the name of the database (\"main\", \"temp\",\netc.)  if applicable.  The 5th argument is the name of the\ninner-most trigger or view that is responsible for the access\nattempt or 'None' if this access attempt is directly from\ninput SQL code.\n\nPlease consult the SQLite documentation about the possible\nvalues for the first argument and the meaning of the second\nand third argument depending on the first one.  All necessary\nconstants are available in the 'sqlite3' module.\n\nPassing 'None' as 'authorizercallback' will disable the\nauthorizer.\n\nChanged in version 3.11: Added support for disabling the\nauthorizer using 'None'.\n\n-- Method: setprogresshandler (progresshandler, n)\n\nRegister *note callable: 25e6. 'progresshandler' to be\ninvoked for every 'n' instructions of the SQLite virtual\nmachine.  This is useful if you want to get called from SQLite\nduring long-running operations, for example to update a GUI.\n\nIf you want to clear any previously installed progress\nhandler, call the method with 'None' for 'progresshandler'.\n\nReturning a non-zero value from the handler function will\nterminate the currently executing query and cause it to raise\na *note DatabaseError: 260c. exception.\n\n-- Method: settracecallback (tracecallback)\n\nRegister *note callable: 25e6. 'tracecallback' to be invoked\nfor each SQL statement that is actually executed by the SQLite\nbackend.\n\nThe only argument passed to the callback is the statement (as\n*note str: 157.) that is being executed.  The return value of\nthe callback is ignored.  Note that the backend does not only\nrun statements passed to the *note Cursor.execute(): 234.\nmethods.  Other sources include the *note transaction\nmanagement: 25d0. of the 'sqlite3' module and the execution of\ntriggers defined in the current database.\n\nPassing 'None' as 'tracecallback' will disable the trace\ncallback.\n\nNote: Exceptions raised in the trace callback are not\npropagated.  As a development and debugging aid, use\n*note enablecallbacktracebacks(): 25e4. to enable\nprinting tracebacks from exceptions raised in the trace\ncallback.\n\nNew in version 3.3.\n\n-- Method: enableloadextension (enabled, /)\n\nEnable the SQLite engine to load SQLite extensions from shared\nlibraries if 'enabled' is 'True'; else, disallow loading\nSQLite extensions.  SQLite extensions can define new\nfunctions, aggregates or whole new virtual table\nimplementations.  One well-known extension is the\nfulltext-search extension distributed with SQLite.\n\nNote: The 'sqlite3' module is not built with loadable\nextension support by default, because some platforms\n(notably macOS) have SQLite libraries which are compiled\nwithout this feature.  To get loadable extension support,\nyou must pass the *note\n-enable-loadable-sqlite-extensions: 1aec. option to\n'configure'.\n\nRaises an *note auditing event: 161d.\n'sqlite3.enableloadextension' with arguments 'connection',\n'enabled'.\n\nNew in version 3.2.\n\nChanged in version 3.10: Added the\n'sqlite3.enableloadextension' auditing event.\n\ncon.enableloadextension(True)\n\n# Load the fulltext search extension\ncon.execute(\"select loadextension('./fts3.so')\")\n\n# alternatively you can load the extension using an API call:\n# con.loadextension(\"./fts3.so\")\n\n# disable extension loading again\ncon.enableloadextension(False)\n\n# example from SQLite wiki\ncon.execute(\"CREATE VIRTUAL TABLE recipe USING fts3(name, ingredients)\")\ncon.executescript(\"\"\"\nINSERT INTO recipe (name, ingredients) VALUES('broccoli stew', 'broccoli peppers cheese tomatoes');\nINSERT INTO recipe (name, ingredients) VALUES('pumpkin stew', 'pumpkin onions garlic celery');\nINSERT INTO recipe (name, ingredients) VALUES('broccoli pie', 'broccoli cheese onions flour');\nINSERT INTO recipe (name, ingredients) VALUES('pumpkin pie', 'pumpkin sugar flour butter');\n\"\"\")\nfor row in con.execute(\"SELECT rowid, name, ingredients FROM recipe WHERE name MATCH 'pie'\"):\nprint(row)\n\n-- Method: loadextension (path, /, *, entrypoint=None)\n\nLoad an SQLite extension from a shared library.  Enable\nextension loading with *note enableloadextension(): 634.\nbefore calling this method.\n\n\nParameters:\n\n* 'path' (*note str: 157.) - The path to the SQLite\nextension.\n\n* 'entrypoint' (*note str: 157.' | ''None') - Entry point\nname.  If 'None' (the default), SQLite will come up with\nan entry point name of its own; see the SQLite docs\nLoading an Extension(2) for details.\n\nRaises an *note auditing event: 161d. 'sqlite3.loadextension'\nwith arguments 'connection', 'path'.\n\nNew in version 3.2.\n\nChanged in version 3.10: Added the 'sqlite3.loadextension'\nauditing event.\n\nChanged in version 3.12: Added the 'entrypoint' parameter.\n\n-- Method: iterdump ()\n\nReturn an *note iterator: 16a9. to dump the database as SQL\nsource code.  Useful when saving an in-memory database for\nlater restoration.  Similar to the '.dump' command in the\n'sqlite3' shell.\n\nExample:\n\n# Convert file example.db to SQL dump file dump.sql\ncon = sqlite3.connect('example.db')\nwith open('dump.sql', 'w') as f:\nfor line in con.iterdump():\nf.write('%s\\n' % line)\ncon.close()\n\nSee also\n........\n\n*note How to handle non-UTF-8 text encodings: 260d.\n\n-- Method: backup (target, *, pages=-1, progress=None,\nname='main', sleep=0.250)\n\nCreate a backup of an SQLite database.\n\nWorks even if the database is being accessed by other clients\nor concurrently by the same connection.\n\n\nParameters:\n\n* 'target' (*note Connection: 1d9.) - The database\nconnection to save the backup to.\n\n* 'pages' (*note int: 17e.) - The number of pages to copy\nat a time.  If equal to or less than '0', the entire\ndatabase is copied in a single step.  Defaults to '-1'.\n\n* 'progress' (*note callback: 2609. |??None) - If set to a\n*note callable: 25e6, it is invoked with three integer\narguments for every backup iteration: the 'status' of the\nlast iteration, the 'remaining' number of pages still to\nbe copied, and the 'total' number of pages.  Defaults to\n'None'.\n\n* 'name' (*note str: 157.) - The name of the database to\nback up.  Either '\"main\"' (the default) for the main\ndatabase, '\"temp\"' for the temporary database, or the\nname of a custom database as attached using the 'ATTACH\nDATABASE' SQL statement.\n\n* 'sleep' (*note float: 4b7.) - The number of seconds to\nsleep between successive attempts to back up remaining\npages.\n\nExample 1, copy an existing database into another:\n\ndef progress(status, remaining, total):\nprint(f'Copied {total-remaining} of {total} pages...')\n\nsrc = sqlite3.connect('example.db')\ndst = sqlite3.connect('backup.db')\nwith dst:\nsrc.backup(dst, pages=1, progress=progress)\ndst.close()\nsrc.close()\n\nExample 2, copy an existing database into a transient copy:\n\nsrc = sqlite3.connect('example.db')\ndst = sqlite3.connect(':memory:')\nsrc.backup(dst)\ndst.close()\nsrc.close()\n\nNew in version 3.7.\n\nSee also\n........\n\n*note How to handle non-UTF-8 text encodings: 260d.\n\n-- Method: getlimit (category, /)\n\nGet a connection runtime limit.\n\n\nParameters: 'category' (*note int: 17e.) - The SQLite limit\ncategory(3) to be queried.\n\n\nReturn type: *note int: 17e.\n\n\nRaises: *note ProgrammingError: 238. - If 'category' is not\nrecognised by the underlying SQLite library.\n\nExample, query the maximum length of an SQL statement for\n*note Connection: 1d9. 'con' (the default is 1000000000):\n\n>>> con.getlimit(sqlite3.SQLITELIMITSQLLENGTH)\n1000000000\n\nNew in version 3.11.\n\n-- Method: setlimit (category, limit, /)\n\nSet a connection runtime limit.  Attempts to increase a limit\nabove its hard upper bound are silently truncated to the hard\nupper bound.  Regardless of whether or not the limit was\nchanged, the prior value of the limit is returned.\n\n\nParameters:\n\n* 'category' (*note int: 17e.) - The SQLite limit\ncategory(4) to be set.\n\n* 'limit' (*note int: 17e.) - The value of the new limit.\nIf negative, the current limit is unchanged.\n\n\nReturn type: *note int: 17e.\n\n\nRaises: *note ProgrammingError: 238. - If 'category' is not\nrecognised by the underlying SQLite library.\n\nExample, limit the number of attached databases to 1 for *note\nConnection: 1d9. 'con' (the default limit is 10):\n\n>>> con.setlimit(sqlite3.SQLITELIMITATTACHED, 1)\n10\n>>> con.getlimit(sqlite3.SQLITELIMITATTACHED)\n1\n\nNew in version 3.11.\n\n-- Method: getconfig (op, /)\n\nQuery a boolean connection configuration option.\n\n\nParameters: 'op' (*note int: 17e.) - A *note SQLITEDBCONFIG\ncode: 25f0.\n\n\nReturn type: *note bool: 17d.\n\nNew in version 3.12.\n\n-- Method: setconfig (op, enable=True, /)\n\nSet a boolean connection configuration option.\n\n\nParameters:\n\n* 'op' (*note int: 17e.) - A *note SQLITEDBCONFIG code:\n25f0.\n\n* 'enable' (*note bool: 17d.) - 'True' if the configuration\noption should be enabled (default); 'False' if it should\nbe disabled.\n\nNew in version 3.12.\n\n-- Method: serialize (*, name='main')\n\nSerialize a database into a *note bytes: 295. object.  For an\nordinary on-disk database file, the serialization is just a\ncopy of the disk file.  For an in-memory database or a \"temp\"\ndatabase, the serialization is the same sequence of bytes\nwhich would be written to disk if that database were backed up\nto disk.\n\n\nParameters: 'name' (*note str: 157.) - The database name to be\nserialized.  Defaults to '\"main\"'.\n\n\nReturn type: *note bytes: 295.\n\nNote: This method is only available if the underlying\nSQLite library has the serialize API.\n\nNew in version 3.11.\n\n-- Method: deserialize (data, /, *, name='main')\n\nDeserialize a *note serialized: 44a. database into a *note\nConnection: 1d9.  This method causes the database connection\nto disconnect from database 'name', and reopen 'name' as an\nin-memory database based on the serialization contained in\n'data'.\n\n\nParameters:\n\n* 'data' (*note bytes: 295.) - A serialized database.\n\n* 'name' (*note str: 157.) - The database name to\ndeserialize into.  Defaults to '\"main\"'.\n\n\nRaises:\n\n* *note OperationalError: 15ff. - If the database\nconnection is currently involved in a read transaction or\na backup operation.\n\n* *note DatabaseError: 260c. - If 'data' does not contain a\nvalid SQLite database.\n\n* *note OverflowError: 68d. - If *note len(data): 3fb. is\nlarger than '263 - 1'.\n\nNote: This method is only available if the underlying\nSQLite library has the deserialize API.\n\nNew in version 3.11.\n\n-- Attribute: autocommit\n\nThis attribute controls PEP 249(5)-compliant transaction\nbehaviour.  'autocommit' has three allowed values:\n\n* 'False': Select PEP 249(6)-compliant transaction\nbehaviour, implying that 'sqlite3' ensures a transaction\nis always open.  Use *note commit(): 25d1. and *note\nrollback(): 2604. to close transactions.\n\nThis is the recommended value of 'autocommit'.\n\n* 'True': Use SQLite's autocommit mode(7).  *note commit():\n25d1. and *note rollback(): 2604. have no effect in this\nmode.\n\n* *note LEGACYTRANSACTIONCONTROL: 25e1.: Pre-Python 3.12\n(non- PEP 249(8)-compliant) transaction control.  See\n*note isolationlevel: 25df. for more details.\n\nThis is currently the default value of 'autocommit'.\n\nChanging 'autocommit' to 'False' will open a new transaction,\nand changing it to 'True' will commit any pending transaction.\n\nSee *note Transaction control via the autocommit attribute:\n1db. for more details.\n\nNote: The *note isolationlevel: 25df. attribute has no\neffect unless *note autocommit: 1d8. is *note\nLEGACYTRANSACTIONCONTROL: 25e1.\n\nNew in version 3.12.\n\n-- Attribute: intransaction\n\nThis read-only attribute corresponds to the low-level SQLite\nautocommit mode(9).\n\n'True' if a transaction is active (there are uncommitted\nchanges), 'False' otherwise.\n\nNew in version 3.2.\n\n-- Attribute: isolationlevel\n\nControls the *note legacy transaction handling mode: 25e0. of\n'sqlite3'.  If set to 'None', transactions are never\nimplicitly opened.  If set to one of '\"DEFERRED\"',\n'\"IMMEDIATE\"', or '\"EXCLUSIVE\"', corresponding to the\nunderlying SQLite transaction behaviour(10), *note implicit\ntransaction management: 25e0. is performed.\n\nIf not overridden by the 'isolationlevel' parameter of *note\nconnect(): 1da, the default is '\"\"', which is an alias for\n'\"DEFERRED\"'.\n\nNote: Using *note autocommit: 1d8. to control transaction\nhandling is recommended over using 'isolationlevel'.\n'isolationlevel' has no effect unless *note autocommit:\n1d8. is set to *note LEGACYTRANSACTIONCONTROL: 25e1.\n(the default).\n\n-- Attribute: rowfactory\n\nThe initial *note rowfactory: 2610. for *note Cursor: 25ce.\nobjects created from this connection.  Assigning to this\nattribute does not affect the 'rowfactory' of existing\ncursors belonging to this connection, only new ones.  Is\n'None' by default, meaning each row is returned as a *note\ntuple: 4b8.\n\nSee *note How to create and use row factories: 25d6. for more\ndetails.\n\n-- Attribute: textfactory\n\nA *note callable: 25e6. that accepts a *note bytes: 295.\nparameter and returns a text representation of it.  The\ncallable is invoked for SQLite values with the 'TEXT' data\ntype.  By default, this attribute is set to *note str: 157.\n\nSee *note How to handle non-UTF-8 text encodings: 260d. for\nmore details.\n\n-- Attribute: totalchanges\n\nReturn the total number of database rows that have been\nmodified, inserted, or deleted since the database connection\nwas opened.\n\n---------- Footnotes ----------\n\n(1) https://sqlite.org/deterministic.html\n\n(2) https://www.sqlite.org/loadext.html#loadinganextension\n\n(3) https://www.sqlite.org/c3ref/climitattached.html\n\n(4) https://www.sqlite.org/c3ref/climitattached.html\n\n(5) https://peps.python.org/pep-0249/\n\n(6) https://peps.python.org/pep-0249/\n\n(7)\nhttps://www.sqlite.org/langtransaction.html#implicitversusexplicittransactions\n\n(8) https://peps.python.org/pep-0249/\n\n(9)\nhttps://www.sqlite.org/langtransaction.html#implicitversusexplicittransactions\n\n(10)\nhttps://www.sqlite.org/langtransaction.html#deferredimmediateandexclusivetransactions\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Cursor objects,  Next: Row objects,  Prev: Connection objects,  Up: Reference": {
            "content": "5.12.6.6 Cursor objects\n.......................\n\nA 'Cursor' object represents a database cursor(1) which is used to\nexecute SQL statements, and manage the context of a fetch\noperation.  Cursors are created using *note Connection.cursor():\n25cd, or by using any of the *note connection shortcut methods:\n2603.\n\nCursor objects are *note iterators: 16a9, meaning that if you *note\nexecute(): 234. a 'SELECT' query, you can simply iterate over the\ncursor to fetch the resulting rows:\n\nfor row in cur.execute(\"SELECT t FROM data\"):\nprint(row)\n\n-- Class: sqlite3.Cursor\n\nA *note Cursor: 25ce. instance has the following attributes and\nmethods.\n\n-- Method: execute (sql, parameters=(), /)\n\nExecute a single SQL statement, optionally binding Python\nvalues using *note placeholders: 235.\n\n\nParameters:\n\n* 'sql' (*note str: 157.) - A single SQL statement.\n\n* 'parameters' (*note dict: 237. | *note sequence: 236.) -\nPython values to bind to placeholders in 'sql'.  A 'dict'\nif named placeholders are used.  A sequence if unnamed\nplaceholders are used.  See *note How to use placeholders\nto bind values in SQL queries: 235.\n\n\nRaises: *note ProgrammingError: 238. - If 'sql' contains more\nthan one SQL statement.\n\nIf *note autocommit: 1d8. is *note LEGACYTRANSACTIONCONTROL:\n25e1, *note isolationlevel: 25df. is not 'None', 'sql' is an\n'INSERT', 'UPDATE', 'DELETE', or 'REPLACE' statement, and\nthere is no open transaction, a transaction is implicitly\nopened before executing 'sql'.\n\nDeprecated since version 3.12, will be removed in version\n3.14: *note DeprecationWarning: 179. is emitted if *note named\nplaceholders: 235. are used and 'parameters' is a sequence\ninstead of a *note dict: 237.  Starting with Python 3.14,\n*note ProgrammingError: 238. will be raised instead.\n\nUse *note executescript(): 2608. to execute multiple SQL\nstatements.\n\n-- Method: executemany (sql, parameters, /)\n\nFor every item in 'parameters', repeatedly execute the *note\nparameterized: 235. DML (Data Manipulation Language) SQL\nstatement 'sql'.\n\nUses the same implicit transaction handling as *note\nexecute(): 234.\n\n\nParameters:\n\n* 'sql' (*note str: 157.) - A single SQL DML statement.\n\n* 'parameters' (*note iterable: 109d.) - An iterable of\nparameters to bind with the placeholders in 'sql'.  See\n*note How to use placeholders to bind values in SQL\nqueries: 235.\n\n\nRaises: *note ProgrammingError: 238. - If 'sql' contains more\nthan one SQL statement, or is not a DML statement.\n\nExample:\n\nrows = [\n(\"row1\",),\n(\"row2\",),\n]\n# cur is an sqlite3.Cursor object\ncur.executemany(\"INSERT INTO data VALUES(?)\", rows)\n\nNote: Any resulting rows are discarded, including DML\nstatements with RETURNING clauses(2).\n\nDeprecated since version 3.12, will be removed in version\n3.14: *note DeprecationWarning: 179. is emitted if *note named\nplaceholders: 235. are used and the items in 'parameters' are\nsequences instead of *note dict: 237.s.  Starting with Python\n3.14, *note ProgrammingError: 238. will be raised instead.\n\n-- Method: executescript (sqlscript, /)\n\nExecute the SQL statements in 'sqlscript'.  If the *note\nautocommit: 1d8. is *note LEGACYTRANSACTIONCONTROL: 25e1.\nand there is a pending transaction, an implicit 'COMMIT'\nstatement is executed first.  No other implicit transaction\ncontrol is performed; any transaction control must be added to\n'sqlscript'.\n\n'sqlscript' must be a *note string: 157.\n\nExample:\n\n# cur is an sqlite3.Cursor object\ncur.executescript(\"\"\"\nBEGIN;\nCREATE TABLE person(firstname, lastname, age);\nCREATE TABLE book(title, author, published);\nCREATE TABLE publisher(name, address);\nCOMMIT;\n\"\"\")\n\n-- Method: fetchone ()\n\nIf *note rowfactory: 2610. is 'None', return the next row\nquery result set as a *note tuple: 4b8.  Else, pass it to the\nrow factory and return its result.  Return 'None' if no more\ndata is available.\n\n-- Method: fetchmany (size=cursor.arraysize)\n\nReturn the next set of rows of a query result as a *note list:\n3dc.  Return an empty list if no more rows are available.\n\nThe number of rows to fetch per call is specified by the\n'size' parameter.  If 'size' is not given, *note arraysize:\n2616. determines the number of rows to be fetched.  If fewer\nthan 'size' rows are available, as many rows as are available\nare returned.\n\nNote there are performance considerations involved with the\n'size' parameter.  For optimal performance, it is usually best\nto use the arraysize attribute.  If the 'size' parameter is\nused, then it is best for it to retain the same value from one\n*note fetchmany(): 2615. call to the next.\n\n-- Method: fetchall ()\n\nReturn all (remaining) rows of a query result as a *note list:\n3dc.  Return an empty list if no rows are available.  Note\nthat the *note arraysize: 2616. attribute can affect the\nperformance of this operation.\n\n-- Method: close ()\n\nClose the cursor now (rather than whenever 'del' is\ncalled).\n\nThe cursor will be unusable from this point forward; a *note\nProgrammingError: 238. exception will be raised if any\noperation is attempted with the cursor.\n\n-- Method: setinputsizes (sizes, /)\n\nRequired by the DB-API. Does nothing in 'sqlite3'.\n\n-- Method: setoutputsize (size, column=None, /)\n\nRequired by the DB-API. Does nothing in 'sqlite3'.\n\n-- Attribute: arraysize\n\nRead/write attribute that controls the number of rows returned\nby *note fetchmany(): 2615.  The default value is 1 which\nmeans a single row would be fetched per call.\n\n-- Attribute: connection\n\nRead-only attribute that provides the SQLite database *note\nConnection: 1d9. belonging to the cursor.  A *note Cursor:\n25ce. object created by calling *note con.cursor(): 25cd. will\nhave a *note connection: 261a. attribute that refers to 'con':\n\n>>> con = sqlite3.connect(\":memory:\")\n>>> cur = con.cursor()\n>>> cur.connection == con\nTrue\n>>> con.close()\n\n-- Attribute: description\n\nRead-only attribute that provides the column names of the last\nquery.  To remain compatible with the Python DB API, it\nreturns a 7-tuple for each column where the last six items of\neach tuple are 'None'.\n\nIt is set for 'SELECT' statements without any matching rows as\nwell.\n\n-- Attribute: lastrowid\n\nRead-only attribute that provides the row id of the last\ninserted row.  It is only updated after successful 'INSERT' or\n'REPLACE' statements using the *note execute(): 234. method.\nFor other statements, after *note executemany(): 25d3. or\n*note executescript(): 2608, or if the insertion failed, the\nvalue of 'lastrowid' is left unchanged.  The initial value of\n'lastrowid' is 'None'.\n\nNote: Inserts into 'WITHOUT ROWID' tables are not\nrecorded.\n\nChanged in version 3.6: Added support for the 'REPLACE'\nstatement.\n\n-- Attribute: rowcount\n\nRead-only attribute that provides the number of modified rows\nfor 'INSERT', 'UPDATE', 'DELETE', and 'REPLACE' statements; is\n'-1' for other statements, including CTE (Common Table\nExpression) queries.  It is only updated by the *note\nexecute(): 234. and *note executemany(): 25d3. methods, after\nthe statement has run to completion.  This means that any\nresulting rows must be fetched in order for 'rowcount' to be\nupdated.\n\n-- Attribute: rowfactory\n\nControl how a row fetched from this 'Cursor' is represented.\nIf 'None', a row is represented as a *note tuple: 4b8.  Can be\nset to the included *note sqlite3.Row: cd4.; or a *note\ncallable: 25e6. that accepts two arguments, a *note Cursor:\n25ce. object and the 'tuple' of row values, and returns a\ncustom object representing an SQLite row.\n\nDefaults to what *note Connection.rowfactory: 260f. was set\nto when the 'Cursor' was created.  Assigning to this attribute\ndoes not affect *note Connection.rowfactory: 260f. of the\nparent connection.\n\nSee *note How to create and use row factories: 25d6. for more\ndetails.\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Cursor(databases)\n\n(2) https://www.sqlite.org/langreturning.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Row objects,  Next: Blob objects,  Prev: Cursor objects,  Up: Reference": {
            "content": "5.12.6.7 Row objects\n....................\n\n-- Class: sqlite3.Row\n\nA 'Row' instance serves as a highly optimized *note rowfactory:\n260f. for *note Connection: 1d9. objects.  It supports iteration,\nequality testing, *note len(): 3fb, and *note mapping: 1030. access\nby column name and index.\n\nTwo 'Row' objects compare equal if they have identical column names\nand values.\n\nSee *note How to create and use row factories: 25d6. for more\ndetails.\n\n-- Method: keys ()\n\nReturn a *note list: 3dc. of column names as *note strings:\n157.  Immediately after a query, it is the first member of\neach tuple in *note Cursor.description: 261b.\n\nChanged in version 3.5: Added support of slicing.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Blob objects,  Next: PrepareProtocol objects,  Prev: Row objects,  Up: Reference": {
            "content": "5.12.6.8 Blob objects\n.....................\n\n-- Class: sqlite3.Blob\n\nNew in version 3.11.\n\nA *note Blob: 44e. instance is a *note file-like object: 229a. that\ncan read and write data in an SQLite BLOB.  Call *note len(blob):\n3fb. to get the size (number of bytes) of the blob.  Use indices\nand *note slices: 1e88. for direct access to the blob data.\n\nUse the *note Blob: 44e. as a *note context manager: 398. to ensure\nthat the blob handle is closed after use.\n\ncon = sqlite3.connect(\":memory:\")\ncon.execute(\"CREATE TABLE test(blobcol blob)\")\ncon.execute(\"INSERT INTO test(blobcol) VALUES(zeroblob(13))\")\n\n# Write to our blob, using two write operations:\nwith con.blobopen(\"test\", \"blobcol\", 1) as blob:\nblob.write(b\"hello, \")\nblob.write(b\"world.\")\n# Modify the first and last bytes of our blob\nblob[0] = ord(\"H\")\nblob[-1] = ord(\"!\")\n\n# Read the contents of our blob\nwith con.blobopen(\"test\", \"blobcol\", 1) as blob:\ngreeting = blob.read()\n\nprint(greeting)  # outputs \"b'Hello, world!'\"\ncon.close()\n\n-- Method: close ()\n\nClose the blob.\n\nThe blob will be unusable from this point onward.  An *note\nError: 15e3. (or subclass) exception will be raised if any\nfurther operation is attempted with the blob.\n\n-- Method: read (length=-1, /)\n\nRead 'length' bytes of data from the blob at the current\noffset position.  If the end of the blob is reached, the data\nup to EOF (End of File) will be returned.  When 'length' is\nnot specified, or is negative, *note read(): 2623. will read\nuntil the end of the blob.\n\n-- Method: write (data, /)\n\nWrite 'data' to the blob at the current offset.  This function\ncannot change the blob length.  Writing beyond the end of the\nblob will raise *note ValueError: 183.\n\n-- Method: tell ()\n\nReturn the current access position of the blob.\n\n-- Method: seek (offset, origin=os.SEEKSET, /)\n\nSet the current access position of the blob to 'offset'.  The\n'origin' argument defaults to *note os.SEEKSET: 1106.\n(absolute blob positioning).  Other values for 'origin' are\n*note os.SEEKCUR: 1107. (seek relative to the current\nposition) and *note os.SEEKEND: 1108. (seek relative to the\nblob's end).\n\nFile: python3.12.info,  Node: PrepareProtocol objects,  Next: Exceptions<6>,  Prev: Blob objects,  Up: Reference\n\n5.12.6.9 PrepareProtocol objects\n................................\n\n-- Class: sqlite3.PrepareProtocol\n\nThe PrepareProtocol type's single purpose is to act as a PEP 246(1)\nstyle adaption protocol for objects that can *note adapt\nthemselves: 2628. to *note native SQLite types: 25db.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0246/\n\nFile: python3.12.info,  Node: Exceptions<6>,  Next: SQLite and Python types,  Prev: PrepareProtocol objects,  Up: Reference\n\n5.12.6.10 Exceptions\n....................\n\nThe exception hierarchy is defined by the DB-API 2.0 ( PEP 249(1)).\n\n-- Exception: sqlite3.Warning\n\nThis exception is not currently raised by the 'sqlite3' module, but\nmay be raised by applications using 'sqlite3', for example if a\nuser-defined function truncates data while inserting.  'Warning' is\na subclass of *note Exception: 7ff.\n\n-- Exception: sqlite3.Error\n\nThe base class of the other exceptions in this module.  Use this to\ncatch all errors with one single *note except: 379. statement.\n'Error' is a subclass of *note Exception: 7ff.\n\nIf the exception originated from within the SQLite library, the\nfollowing two attributes are added to the exception:\n\n-- Attribute: sqliteerrorcode\n\nThe numeric error code from the SQLite API(2)\n\nNew in version 3.11.\n\n-- Attribute: sqliteerrorname\n\nThe symbolic name of the numeric error code from the SQLite\nAPI(3)\n\nNew in version 3.11.\n\n-- Exception: sqlite3.InterfaceError\n\nException raised for misuse of the low-level SQLite C API. In other\nwords, if this exception is raised, it probably indicates a bug in\nthe 'sqlite3' module.  'InterfaceError' is a subclass of *note\nError: 15e3.\n\n-- Exception: sqlite3.DatabaseError\n\nException raised for errors that are related to the database.  This\nserves as the base exception for several types of database errors.\nIt is only raised implicitly through the specialised subclasses.\n'DatabaseError' is a subclass of *note Error: 15e3.\n\n-- Exception: sqlite3.DataError\n\nException raised for errors caused by problems with the processed\ndata, like numeric values out of range, and strings which are too\nlong.  'DataError' is a subclass of *note DatabaseError: 260c.\n\n-- Exception: sqlite3.OperationalError\n\nException raised for errors that are related to the database's\noperation, and not necessarily under the control of the programmer.\nFor example, the database path is not found, or a transaction could\nnot be processed.  'OperationalError' is a subclass of *note\nDatabaseError: 260c.\n\n-- Exception: sqlite3.IntegrityError\n\nException raised when the relational integrity of the database is\naffected, e.g.  a foreign key check fails.  It is a subclass of\n*note DatabaseError: 260c.\n\n-- Exception: sqlite3.InternalError\n\nException raised when SQLite encounters an internal error.  If this\nis raised, it may indicate that there is a problem with the runtime\nSQLite library.  'InternalError' is a subclass of *note\nDatabaseError: 260c.\n\n-- Exception: sqlite3.ProgrammingError\n\nException raised for 'sqlite3' API programming errors, for example\nsupplying the wrong number of bindings to a query, or trying to\noperate on a closed *note Connection: 1d9.  'ProgrammingError' is a\nsubclass of *note DatabaseError: 260c.\n\n-- Exception: sqlite3.NotSupportedError\n\nException raised in case a method or database API is not supported\nby the underlying SQLite library.  For example, setting\n'deterministic' to 'True' in *note createfunction(): 173f, if the\nunderlying SQLite library does not support deterministic functions.\n'NotSupportedError' is a subclass of *note DatabaseError: 260c.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0249/\n\n(2) https://sqlite.org/rescode.html\n\n(3) https://sqlite.org/rescode.html\n\nFile: python3.12.info,  Node: SQLite and Python types,  Next: Default adapters and converters deprecated,  Prev: Exceptions<6>,  Up: Reference\n\n5.12.6.11 SQLite and Python types\n.................................\n\nSQLite natively supports the following types: 'NULL', 'INTEGER', 'REAL',\n'TEXT', 'BLOB'.\n",
            "subsections": []
        },
        "The following Python types can thus be sent to SQLite without any": {
            "content": "problem:\n",
            "subsections": []
        },
        "Python type                         SQLite type": {
            "content": "------------------------------------------------------\n\n'None'                              'NULL'\n\n\n*note int: 17e.                     'INTEGER'\n\n\n*note float: 4b7.                   'REAL'\n\n\n*note str: 157.                     'TEXT'\n\n\n*note bytes: 295.                   'BLOB'\n\n\nThis is how SQLite types are converted to Python types by default:\n\nSQLite type       Python type\n\n---------------------------------------------------------------------\n\n'NULL'            'None'\n\n\n'INTEGER'         *note int: 17e.\n\n\n'REAL'            *note float: 4b7.\n\n\n'TEXT'            depends on *note textfactory: 2611,\n*note str: 157. by default\n\n\n'BLOB'            *note bytes: 295.\n\n",
            "subsections": []
        },
        "The type system of the 'sqlite3' module is extensible in two ways: you": {
            "content": "can store additional Python types in an SQLite database via *note object\nadapters: 25d4, and you can let the 'sqlite3' module convert SQLite\ntypes to Python types via *note converters: 25d5.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Default adapters and converters deprecated,  Next: Command-line interface,  Prev: SQLite and Python types,  Up: Reference": {
            "content": "5.12.6.12 Default adapters and converters (deprecated)\n......................................................\n\nNote: The default adapters and converters are deprecated as of\nPython 3.12.  Instead, use the *note Adapter and converter recipes:\n233. and tailor them to your needs.\n\nThe deprecated default adapters and converters consist of:\n\n* An adapter for *note datetime.date: 70f. objects to *note strings:\n157. in ISO 8601(1) format.\n\n* An adapter for *note datetime.datetime: 222. objects to strings in\nISO 8601 format.\n\n* A converter for *note declared: 25d5. \"date\" types to *note\ndatetime.date: 70f. objects.\n\n* A converter for declared \"timestamp\" types to *note\ndatetime.datetime: 222. objects.  Fractional parts will be\ntruncated to 6 digits (microsecond precision).\n\nNote: The default \"timestamp\" converter ignores UTC offsets in the\ndatabase and always returns a naive *note datetime.datetime: 222.\nobject.  To preserve UTC offsets in timestamps, either leave\nconverters disabled, or register an offset-aware converter with\n*note registerconverter(): 25dc.\n\nDeprecated since version 3.12.\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/ISO8601\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Command-line interface,  Prev: Default adapters and converters deprecated,  Up: Reference": {
            "content": "5.12.6.13 Command-line interface\n................................\n",
            "subsections": []
        },
        "The 'sqlite3' module can be invoked as a script, using the interpreter's": {
            "content": "*note -m: 3a5. switch, in order to provide a simple SQLite shell.  The\nargument signature is as follows:\n\npython -m sqlite3 [-h] [-v] [filename] [sql]\n\nType '.quit' or CTRL-D to exit the shell.\n\n-- Option: -h, --help\n\nPrint CLI help.\n\n-- Option: -v, --version\n\nPrint underlying SQLite library version.\n\nNew in version 3.12.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: How-to guides,  Next: Explanation,  Prev: Reference,  Up: sqlite3 -- DB-API 2 0 interface for SQLite databases": {
            "content": "5.12.6.14 How-to guides\n.......................\n\n* Menu:\n\n* How to use placeholders to bind values in SQL queries::\n* How to adapt custom Python types to SQLite values::\n* How to convert SQLite values to custom Python types::\n* Adapter and converter recipes::\n* How to use connection shortcut methods::\n* How to use the connection context manager::\n* How to work with SQLite URIs::\n* How to create and use row factories::\n* How to handle non-UTF-8 text encodings::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: How to use placeholders to bind values in SQL queries,  Next: How to adapt custom Python types to SQLite values,  Up: How-to guides": {
            "content": "5.12.6.15 How to use placeholders to bind values in SQL queries\n...............................................................\n\nSQL operations usually need to use values from Python variables.",
            "subsections": []
        },
        "However, beware of using Python's string operations to assemble queries,": {
            "content": "as they are vulnerable to SQL injection attacks(1).  For example, an\nattacker can simply close the single quote and inject 'OR TRUE' to\nselect all rows:\n\n>>> # Never do this -- insecure!\n>>> symbol = input()\n' OR TRUE; --\n>>> sql = \"SELECT * FROM stocks WHERE symbol = '%s'\" % symbol\n>>> print(sql)\nSELECT * FROM stocks WHERE symbol = '' OR TRUE; --'\n>>> cur.execute(sql)\n",
            "subsections": []
        },
        "Instead, use the DB-API's parameter substitution.  To insert a variable": {
            "content": "into a query string, use a placeholder in the string, and substitute the\nactual values into the query by providing them as a *note tuple: 4b8. of\nvalues to the second argument of the cursor's *note execute(): 234.\nmethod.\n",
            "subsections": []
        },
        "An SQL statement may use one of two kinds of placeholders: question": {
            "content": "marks (qmark style) or named placeholders (named style).  For the qmark\nstyle, 'parameters' must be a *note sequence: 236. whose length must\nmatch the number of placeholders, or a *note ProgrammingError: 238. is\nraised.  For the named style, 'parameters' must be an instance of a\n*note dict: 237. (or a subclass), which must contain keys for all named\nparameters; any extra items are ignored.  Here's an example of both\nstyles:\n\ncon = sqlite3.connect(\":memory:\")\ncur = con.execute(\"CREATE TABLE lang(name, firstappeared)\")\n\n# This is the named style used with executemany():\ndata = (\n{\"name\": \"C\", \"year\": 1972},\n{\"name\": \"Fortran\", \"year\": 1957},\n{\"name\": \"Python\", \"year\": 1991},\n{\"name\": \"Go\", \"year\": 2009},\n)\ncur.executemany(\"INSERT INTO lang VALUES(:name, :year)\", data)\n\n# This is the qmark style used in a SELECT query:\nparams = (1972,)\ncur.execute(\"SELECT * FROM lang WHERE firstappeared = ?\", params)\nprint(cur.fetchall())\ncon.close()\n\nNote: PEP 249(2) numeric placeholders are 'not' supported.  If\nused, they will be interpreted as named placeholders.\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/SQLinjection\n\n(2) https://peps.python.org/pep-0249/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: How to adapt custom Python types to SQLite values,  Next: How to convert SQLite values to custom Python types,  Prev: How to use placeholders to bind values in SQL queries,  Up: How-to guides": {
            "content": "5.12.6.16 How to adapt custom Python types to SQLite values\n...........................................................\n\nSQLite supports only a limited set of data types natively.  To store\ncustom Python types in SQLite databases, 'adapt' them to one of the\n*note Python types SQLite natively understands: 25db.\n",
            "subsections": []
        },
        "There are two ways to adapt Python objects to SQLite types: letting your": {
            "content": "object adapt itself, or using an 'adapter callable'.  The latter will\ntake precedence above the former.  For a library that exports a custom\ntype, it may make sense to enable that type to adapt itself.  As an\napplication developer, it may make more sense to take direct control by\nregistering custom adapter functions.\n\n* Menu:\n\n* How to write adaptable objects::\n* How to register adapter callables::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: How to write adaptable objects,  Next: How to register adapter callables,  Up: How to adapt custom Python types to SQLite values": {
            "content": "5.12.6.17 How to write adaptable objects\n........................................\n",
            "subsections": []
        },
        "Suppose we have a 'Point' class that represents a pair of coordinates,": {
            "content": "'x' and 'y', in a Cartesian coordinate system.  The coordinate pair will\nbe stored as a text string in the database, using a semicolon to\nseparate the coordinates.  This can be implemented by adding a\n'conform(self, protocol)' method which returns the adapted value.\nThe object passed to 'protocol' will be of type *note PrepareProtocol:\n153f.\n\nclass Point:\ndef init(self, x, y):\nself.x, self.y = x, y\n\ndef conform(self, protocol):\nif protocol is sqlite3.PrepareProtocol:\nreturn f\"{self.x};{self.y}\"\n\ncon = sqlite3.connect(\":memory:\")\ncur = con.cursor()\n\ncur.execute(\"SELECT ?\", (Point(4.0, -3.2),))\nprint(cur.fetchone()[0])\ncon.close()\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: How to register adapter callables,  Prev: How to write adaptable objects,  Up: How to adapt custom Python types to SQLite values": {
            "content": "5.12.6.18 How to register adapter callables\n...........................................\n",
            "subsections": []
        },
        "The other possibility is to create a function that converts the Python": {
            "content": "object to an SQLite-compatible type.  This function can then be\nregistered using *note registeradapter(): 25e5.\n\nclass Point:\ndef init(self, x, y):\nself.x, self.y = x, y\n\ndef adaptpoint(point):\nreturn f\"{point.x};{point.y}\"\n\nsqlite3.registeradapter(Point, adaptpoint)\n\ncon = sqlite3.connect(\":memory:\")\ncur = con.cursor()\n\ncur.execute(\"SELECT ?\", (Point(1.0, 2.5),))\nprint(cur.fetchone()[0])\ncon.close()\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: How to convert SQLite values to custom Python types,  Next: Adapter and converter recipes,  Prev: How to adapt custom Python types to SQLite values,  Up: How-to guides": {
            "content": "5.12.6.19 How to convert SQLite values to custom Python types\n.............................................................\n",
            "subsections": []
        },
        "Writing an adapter lets you convert 'from' custom Python types 'to'": {
            "content": "SQLite values.  To be able to convert 'from' SQLite values 'to' custom\nPython types, we use 'converters'.\n",
            "subsections": []
        },
        "Let's go back to the 'Point' class.  We stored the x and y coordinates": {
            "content": "separated via semicolons as strings in SQLite.\n",
            "subsections": []
        },
        "First, we'll define a converter function that accepts the string as a": {
            "content": "parameter and constructs a 'Point' object from it.\n\nNote: Converter functions are 'always' passed a *note bytes: 295.\nobject, no matter the underlying SQLite data type.\n\ndef convertpoint(s):\nx, y = map(float, s.split(b\";\"))\nreturn Point(x, y)\n",
            "subsections": []
        },
        "We now need to tell 'sqlite3' when it should convert a given SQLite": {
            "content": "value.  This is done when connecting to a database, using the\n'detecttypes' parameter of *note connect(): 1da.  There are three\noptions:\n\n* Implicit: set 'detecttypes' to *note PARSEDECLTYPES: 25dd.\n\n* Explicit: set 'detecttypes' to *note PARSECOLNAMES: 25de.\n\n* Both: set 'detecttypes' to 'sqlite3.PARSEDECLTYPES |\nsqlite3.PARSECOLNAMES'.  Column names take precedence over\ndeclared types.\n\nThe following example illustrates the implicit and explicit approaches:\n\nclass Point:\ndef init(self, x, y):\nself.x, self.y = x, y\n\ndef repr(self):\nreturn f\"Point({self.x}, {self.y})\"\n\ndef adaptpoint(point):\nreturn f\"{point.x};{point.y}\"\n\ndef convertpoint(s):\nx, y = list(map(float, s.split(b\";\")))\nreturn Point(x, y)\n\n# Register the adapter and converter\nsqlite3.registeradapter(Point, adaptpoint)\nsqlite3.registerconverter(\"point\", convertpoint)\n\n# 1) Parse using declared types\np = Point(4.0, -3.2)\ncon = sqlite3.connect(\":memory:\", detecttypes=sqlite3.PARSEDECLTYPES)\ncur = con.execute(\"CREATE TABLE test(p point)\")\n\ncur.execute(\"INSERT INTO test(p) VALUES(?)\", (p,))\ncur.execute(\"SELECT p FROM test\")\nprint(\"with declared types:\", cur.fetchone()[0])\ncur.close()\ncon.close()\n\n# 2) Parse using column names\ncon = sqlite3.connect(\":memory:\", detecttypes=sqlite3.PARSECOLNAMES)\ncur = con.execute(\"CREATE TABLE test(p)\")\n\ncur.execute(\"INSERT INTO test(p) VALUES(?)\", (p,))\ncur.execute('SELECT p AS \"p [point]\" FROM test')\nprint(\"with column names:\", cur.fetchone()[0])\ncur.close()\ncon.close()\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Adapter and converter recipes,  Next: How to use connection shortcut methods,  Prev: How to convert SQLite values to custom Python types,  Up: How-to guides": {
            "content": "5.12.6.20 Adapter and converter recipes\n.......................................\n\nThis section shows recipes for common adapters and converters.\n\nimport datetime\nimport sqlite3\n\ndef adaptdateiso(val):\n\"\"\"Adapt datetime.date to ISO 8601 date.\"\"\"\nreturn val.isoformat()\n\ndef adaptdatetimeiso(val):\n\"\"\"Adapt datetime.datetime to timezone-naive ISO 8601 date.\"\"\"\nreturn val.isoformat()\n\ndef adaptdatetimeepoch(val):\n\"\"\"Adapt datetime.datetime to Unix timestamp.\"\"\"\nreturn int(val.timestamp())\n\nsqlite3.registeradapter(datetime.date, adaptdateiso)\nsqlite3.registeradapter(datetime.datetime, adaptdatetimeiso)\nsqlite3.registeradapter(datetime.datetime, adaptdatetimeepoch)\n\ndef convertdate(val):\n\"\"\"Convert ISO 8601 date to datetime.date object.\"\"\"\nreturn datetime.date.fromisoformat(val.decode())\n\ndef convertdatetime(val):\n\"\"\"Convert ISO 8601 datetime to datetime.datetime object.\"\"\"\nreturn datetime.datetime.fromisoformat(val.decode())\n\ndef converttimestamp(val):\n\"\"\"Convert Unix epoch timestamp to datetime.datetime object.\"\"\"\nreturn datetime.datetime.fromtimestamp(int(val))\n\nsqlite3.registerconverter(\"date\", convertdate)\nsqlite3.registerconverter(\"datetime\", convertdatetime)\nsqlite3.registerconverter(\"timestamp\", converttimestamp)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: How to use connection shortcut methods,  Next: How to use the connection context manager,  Prev: Adapter and converter recipes,  Up: How-to guides": {
            "content": "5.12.6.21 How to use connection shortcut methods\n................................................\n\nUsing the *note execute(): 2605, *note executemany(): 2606, and *note\nexecutescript(): 2607. methods of the *note Connection: 1d9. class, your\ncode can be written more concisely because you don't have to create the\n(often superfluous) *note Cursor: 25ce. objects explicitly.  Instead,\nthe *note Cursor: 25ce. objects are created implicitly and these\nshortcut methods return the cursor objects.  This way, you can execute a\n'SELECT' statement and iterate over it directly using only a single call\non the *note Connection: 1d9. object.\n\n# Create and fill the table.\ncon = sqlite3.connect(\":memory:\")\ncon.execute(\"CREATE TABLE lang(name, firstappeared)\")\ndata = [\n(\"C++\", 1985),\n(\"Objective-C\", 1984),\n]\ncon.executemany(\"INSERT INTO lang(name, firstappeared) VALUES(?, ?)\", data)\n\n# Print the table contents\nfor row in con.execute(\"SELECT name, firstappeared FROM lang\"):\nprint(row)\n\nprint(\"I just deleted\", con.execute(\"DELETE FROM lang\").rowcount, \"rows\")\n\n# close() is not a shortcut method and it's not called automatically;\n# the connection object should be closed manually\ncon.close()\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: How to use the connection context manager,  Next: How to work with SQLite URIs,  Prev: How to use connection shortcut methods,  Up: How-to guides": {
            "content": "5.12.6.22 How to use the connection context manager\n...................................................\n\nA *note Connection: 1d9. object can be used as a context manager that\nautomatically commits or rolls back open transactions when leaving the\nbody of the context manager.  If the body of the *note with: 396.\nstatement finishes without exceptions, the transaction is committed.  If\nthis commit fails, or if the body of the 'with' statement raises an\nuncaught exception, the transaction is rolled back.  If *note\nautocommit: 1d8. is 'False', a new transaction is implicitly opened\nafter committing or rolling back.\n",
            "subsections": []
        },
        "If there is no open transaction upon leaving the body of the 'with'": {
            "content": "statement, or if *note autocommit: 1d8. is 'True', the context manager\ndoes nothing.\n\nNote: The context manager neither implicitly opens a new\ntransaction nor closes the connection.  If you need a closing\ncontext manager, consider using *note contextlib.closing(): 263d.\n\ncon = sqlite3.connect(\":memory:\")\ncon.execute(\"CREATE TABLE lang(id INTEGER PRIMARY KEY, name VARCHAR UNIQUE)\")\n\n# Successful, con.commit() is called automatically afterwards\nwith con:\ncon.execute(\"INSERT INTO lang(name) VALUES(?)\", (\"Python\",))\n\n# con.rollback() is called after the with block finishes with an exception,\n# the exception is still raised and must be caught\ntry:\nwith con:\ncon.execute(\"INSERT INTO lang(name) VALUES(?)\", (\"Python\",))\nexcept sqlite3.IntegrityError:\nprint(\"couldn't add Python twice\")\n\n# Connection object used as context manager only commits or rollbacks transactions,\n# so the connection object should be closed manually\ncon.close()\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: How to work with SQLite URIs,  Next: How to create and use row factories,  Prev: How to use the connection context manager,  Up: How-to guides": {
            "content": "5.12.6.23 How to work with SQLite URIs\n......................................\n\nSome useful URI tricks include:\n\n* Open a database in read-only mode:\n\n>>> con = sqlite3.connect(\"file:tutorial.db?mode=ro\", uri=True)\n>>> con.execute(\"CREATE TABLE readonly(data)\")\nTraceback (most recent call last):\nOperationalError: attempt to write a readonly database\n\n* Do not implicitly create a new database file if it does not already\nexist; will raise *note OperationalError: 15ff. if unable to create\na new file:\n\n>>> con = sqlite3.connect(\"file:nosuchdb.db?mode=rw\", uri=True)\nTraceback (most recent call last):\nOperationalError: unable to open database file\n\n* Create a shared named in-memory database:\n\ndb = \"file:mem1?mode=memory&cache=shared\"\ncon1 = sqlite3.connect(db, uri=True)\ncon2 = sqlite3.connect(db, uri=True)\nwith con1:\ncon1.execute(\"CREATE TABLE shared(data)\")\ncon1.execute(\"INSERT INTO shared VALUES(28)\")\nres = con2.execute(\"SELECT data FROM shared\")\nassert res.fetchone() == (28,)\n\ncon1.close()\ncon2.close()\n",
            "subsections": []
        },
        "More information about this feature, including a list of parameters, can": {
            "content": "be found in the SQLite URI documentation(1).\n\n---------- Footnotes ----------\n\n(1) https://www.sqlite.org/uri.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: How to create and use row factories,  Next: How to handle non-UTF-8 text encodings,  Prev: How to work with SQLite URIs,  Up: How-to guides": {
            "content": "5.12.6.24 How to create and use row factories\n.............................................\n\nBy default, 'sqlite3' represents each row as a *note tuple: 4b8.  If a\n'tuple' does not suit your needs, you can use the *note sqlite3.Row:\ncd4. class or a custom *note rowfactory: 2610.\n\nWhile 'rowfactory' exists as an attribute both on the *note Cursor:\n25ce. and the *note Connection: 1d9, it is recommended to set *note",
            "subsections": []
        },
        "Connection.rowfactory: 260f, so all cursors created from the connection": {
            "content": "will use the same row factory.\n\n'Row' provides indexed and case-insensitive named access to columns,\nwith minimal memory overhead and performance impact over a 'tuple'.  To\nuse 'Row' as a row factory, assign it to the 'rowfactory' attribute:\n\n>>> con = sqlite3.connect(\":memory:\")\n>>> con.rowfactory = sqlite3.Row\n\nQueries now return 'Row' objects:\n\n>>> res = con.execute(\"SELECT 'Earth' AS name, 6378 AS radius\")\n>>> row = res.fetchone()\n>>> row.keys()\n['name', 'radius']\n>>> row[0]         # Access by index.\n'Earth'\n>>> row[\"name\"]    # Access by name.\n'Earth'\n>>> row[\"RADIUS\"]  # Column names are case-insensitive.\n6378\n>>> con.close()\n\nNote: The 'FROM' clause can be omitted in the 'SELECT' statement,\nas in the above example.  In such cases, SQLite returns a single\nrow with columns defined by expressions, e.g.  literals, with the\ngiven aliases 'expr AS alias'.\n\nYou can create a custom *note rowfactory: 2610. that returns each row\nas a *note dict: 237, with column names mapped to values:\n\ndef dictfactory(cursor, row):\nfields = [column[0] for column in cursor.description]\nreturn {key: value for key, value in zip(fields, row)}\n\nUsing it, queries now return a 'dict' instead of a 'tuple':\n\n>>> con = sqlite3.connect(\":memory:\")\n>>> con.rowfactory = dictfactory\n>>> for row in con.execute(\"SELECT 1 AS a, 2 AS b\"):\n...     print(row)\n{'a': 1, 'b': 2}\n>>> con.close()\n\nThe following row factory returns a *note named tuple: 417.:\n\nfrom collections import namedtuple\n\ndef namedtuplefactory(cursor, row):\nfields = [column[0] for column in cursor.description]\ncls = namedtuple(\"Row\", fields)\nreturn cls.make(row)\n\n'namedtuplefactory()' can be used as follows:\n\n>>> con = sqlite3.connect(\":memory:\")\n>>> con.rowfactory = namedtuplefactory\n>>> cur = con.execute(\"SELECT 1 AS a, 2 AS b\")\n>>> row = cur.fetchone()\n>>> row\nRow(a=1, b=2)\n>>> row[0]  # Indexed access.\n1\n>>> row.b   # Attribute access.\n2\n>>> con.close()\n\nWith some adjustments, the above recipe can be adapted to use a *note\ndataclass: 38d, or any other custom class, instead of a *note\nnamedtuple: 711.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: How to handle non-UTF-8 text encodings,  Prev: How to create and use row factories,  Up: How-to guides": {
            "content": "5.12.6.25 How to handle non-UTF-8 text encodings\n................................................\n\nBy default, 'sqlite3' uses *note str: 157. to adapt SQLite values with\nthe 'TEXT' data type.  This works well for UTF-8 encoded text, but it\nmight fail for other encodings and invalid UTF-8.  You can use a custom\n*note textfactory: 2611. to handle such cases.\n",
            "subsections": []
        },
        "Because of SQLite's flexible typing(1), it is not uncommon to encounter": {
            "content": "table columns with the 'TEXT' data type containing non-UTF-8 encodings,\nor even arbitrary data.  To demonstrate, let's assume we have a database\nwith ISO-8859-2 (Latin-2) encoded text, for example a table of\nCzech-English dictionary entries.  Assuming we now have a *note",
            "subsections": []
        },
        "Connection: 1d9. instance 'con' connected to this database, we can": {
            "content": "decode the Latin-2 encoded text using this *note textfactory: 2611.:\n\ncon.textfactory = lambda data: str(data, encoding=\"latin2\")\n",
            "subsections": []
        },
        "For invalid UTF-8 or arbitrary data in stored in 'TEXT' table columns,": {
            "content": "you can use the following technique, borrowed from the *note Unicode\nHOWTO: 111c.:\n\ncon.textfactory = lambda data: str(data, errors=\"surrogateescape\")\n\nNote: The 'sqlite3' module API does not support strings containing\nsurrogates.\n\nSee also\n........\n\n*note Unicode HOWTO: 111c.\n\n---------- Footnotes ----------\n\n(1) https://www.sqlite.org/flextypegood.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Explanation,  Prev: How-to guides,  Up: sqlite3 -- DB-API 2 0 interface for SQLite databases": {
            "content": "5.12.6.26 Explanation\n.....................\n\n* Menu:\n\n* Transaction control::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Transaction control,  Up: Explanation": {
            "content": "5.12.6.27 Transaction control\n.............................\n\n'sqlite3' offers multiple methods of controlling whether, when and how\ndatabase transactions are opened and closed.  *note Transaction control\nvia the autocommit attribute: 1db. is recommended, while *note",
            "subsections": []
        },
        "Transaction control via the isolationlevel attribute: 25e0. retains the": {
            "content": "pre-Python 3.12 behaviour.\n\n* Menu:\n\n* Transaction control via the autocommit attribute::\n* Transaction control via the isolationlevel attribute::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Transaction control via the autocommit attribute,  Next: Transaction control via the isolationlevel attribute,  Up: Transaction control": {
            "content": "5.12.6.28 Transaction control via the 'autocommit' attribute\n............................................................\n",
            "subsections": []
        },
        "The recommended way of controlling transaction behaviour is through the": {
            "content": "*note Connection.autocommit: 1d8. attribute, which should preferably be\nset using the 'autocommit' parameter of *note connect(): 1da.\n",
            "subsections": []
        },
        "It is suggested to set 'autocommit' to 'False', which implies PEP": {
            "content": "249(1)-compliant transaction control.  This means:\n\n* 'sqlite3' ensures that a transaction is always open, so *note\nconnect(): 1da, *note Connection.commit(): 25d1, and *note\nConnection.rollback(): 2604. will implicitly open a new transaction\n(immediately after closing the pending one, for the latter two).\n'sqlite3' uses 'BEGIN DEFERRED' statements when opening\ntransactions.\n\n* Transactions should be committed explicitly using 'commit()'.\n\n* Transactions should be rolled back explicitly using 'rollback()'.\n\n* An implicit rollback is performed if the database is *note close():\n1416.-ed with pending changes.\n",
            "subsections": []
        },
        "Set 'autocommit' to 'True' to enable SQLite's autocommit mode(2).  In": {
            "content": "this mode, *note Connection.commit(): 25d1. and *note",
            "subsections": []
        },
        "Connection.rollback(): 2604. have no effect.  Note that SQLite's": {
            "content": "autocommit mode is distinct from the PEP 249(3)-compliant *note\nConnection.autocommit: 1d8. attribute; use *note",
            "subsections": []
        },
        "Connection.intransaction: 260e. to query the low-level SQLite": {
            "content": "autocommit mode.\n\nSet 'autocommit' to *note LEGACYTRANSACTIONCONTROL: 25e1. to leave\ntransaction control behaviour to the *note Connection.isolationlevel:\n25df. attribute.  See *note Transaction control via the isolationlevel\nattribute: 25e0. for more information.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0249/\n\n(2)\nhttps://www.sqlite.org/langtransaction.html#implicitversusexplicittransactions\n\n(3) https://peps.python.org/pep-0249/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Transaction control via the isolationlevel attribute,  Prev: Transaction control via the autocommit attribute,  Up: Transaction control": {
            "content": "5.12.6.29 Transaction control via the 'isolationlevel' attribute\n.................................................................\n\nNote: The recommended way of controlling transactions is via the\n*note autocommit: 1d8. attribute.  See *note Transaction control\nvia the autocommit attribute: 1db.\n\nIf *note Connection.autocommit: 1d8. is set to *note\nLEGACYTRANSACTIONCONTROL: 25e1. (the default), transaction behaviour\nis controlled using the *note Connection.isolationlevel: 25df.\nattribute.  Otherwise, 'isolationlevel' has no effect.\n\nIf the connection attribute *note isolationlevel: 25df. is not 'None',\nnew transactions are implicitly opened before *note execute(): 234. and\n*note executemany(): 25d3. executes 'INSERT', 'UPDATE', 'DELETE', or\n'REPLACE' statements; for other statements, no implicit transaction\nhandling is performed.  Use the *note commit(): 25d1. and *note\nrollback(): 2604. methods to respectively commit and roll back pending\ntransactions.  You can choose the underlying SQLite transaction\nbehaviour(1) -- that is, whether and what type of 'BEGIN' statements\n'sqlite3' implicitly executes - via the *note isolationlevel: 25df.\nattribute.\n\nIf *note isolationlevel: 25df. is set to 'None', no transactions are\nimplicitly opened at all.  This leaves the underlying SQLite library in\nautocommit mode(2), but also allows the user to perform their own\ntransaction handling using explicit SQL statements.  The underlying\nSQLite library autocommit mode can be queried using the *note\nintransaction: 260e. attribute.\n\nThe *note executescript(): 2608. method implicitly commits any pending\ntransaction before execution of the given SQL script, regardless of the\nvalue of *note isolationlevel: 25df.\n",
            "subsections": []
        },
        "Changed in version 3.6: 'sqlite3' used to implicitly commit an open": {
            "content": "transaction before DDL statements.  This is no longer the case.\n",
            "subsections": []
        },
        "Changed in version 3.12: The recommended way of controlling transactions": {
            "content": "is now via the *note autocommit: 1d8. attribute.\n\n---------- Footnotes ----------\n\n(1)\nhttps://www.sqlite.org/langtransaction.html#deferredimmediateandexclusivetransactions\n\n(2)\nhttps://www.sqlite.org/langtransaction.html#implicitversusexplicittransactions\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Data Compression and Archiving,  Next: File Formats,  Prev: Data Persistence,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.13 Data Compression and Archiving",
                    "content": ""
                }
            ]
        },
        "The modules described in this chapter support data compression with the": {
            "content": "zlib, gzip, bzip2 and lzma algorithms, and the creation of ZIP- and\ntar-format archives.  See also *note Archiving operations: 108d.\nprovided by the *note shutil: c0. module.\n\n* Menu:\n\n* zlib -- Compression compatible with gzip::\n* gzip -- Support for gzip files::\n* bz2 -- Support for bzip2 compression::\n* lzma -- Compression using the LZMA algorithm::\n* zipfile -- Work with ZIP archives::\n* tarfile -- Read and write tar archive files::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: zlib -- Compression compatible with gzip,  Next: gzip -- Support for gzip files,  Up: Data Compression and Archiving": {
            "content": "",
            "subsections": []
        },
        "For applications that require data compression, the functions in this": {
            "content": "module allow compression and decompression, using the zlib library.  The\nzlib library has its own home page at 'https://www.zlib.net'.  There are\nknown incompatibilities between the Python module and versions of the\nzlib library earlier than 1.1.3; 1.1.3 has a security vulnerability(1),\nso we recommend using 1.1.4 or later.\n\nzlib's functions have many options and often need to be used in a\nparticular order.  This documentation doesn't attempt to cover all of\nthe permutations; consult the zlib manual at\n'http://www.zlib.net/manual.html' for authoritative information.\n\nFor reading and writing '.gz' files see the *note gzip: 62. module.\n\nThe available exception and functions in this module are:\n\n-- Exception: zlib.error\n\nException raised on compression and decompression errors.\n\n-- Function: zlib.adler32 (data[, value])\n\nComputes an Adler-32 checksum of 'data'.  (An Adler-32 checksum is\nalmost as reliable as a CRC32 but can be computed much more\nquickly.)  The result is an unsigned 32-bit integer.  If 'value' is\npresent, it is used as the starting value of the checksum;\notherwise, a default value of 1 is used.  Passing in 'value' allows\ncomputing a running checksum over the concatenation of several\ninputs.  The algorithm is not cryptographically strong, and should\nnot be used for authentication or digital signatures.  Since the\nalgorithm is designed for use as a checksum algorithm, it is not\nsuitable for use as a general hash algorithm.\n\nChanged in version 3.0: The result is always unsigned.\n\n-- Function: zlib.compress (data, /, level=-1, wbits=MAXWBITS)\n\nCompresses the bytes in 'data', returning a bytes object containing\ncompressed data.  'level' is an integer from '0' to '9' or '-1'\ncontrolling the level of compression; '1' (ZBESTSPEED) is fastest\nand produces the least compression, '9' (ZBESTCOMPRESSION) is\nslowest and produces the most.  '0' (ZNOCOMPRESSION) is no\ncompression.  The default value is '-1' (ZDEFAULTCOMPRESSION).\nZDEFAULTCOMPRESSION represents a default compromise between speed\nand compression (currently equivalent to level 6).  The 'wbits'\nargument controls the size of the history buffer (or the \"window\nsize\") used when compressing data, and whether a header and trailer\nis included in the output.  It can take several ranges of values,\ndefaulting to '15' (MAXWBITS):\n\n* +9 to +15: The base-two logarithm of the window size, which\ntherefore ranges between 512 and 32768.  Larger values produce\nbetter compression at the expense of greater memory usage.\nThe resulting output will include a zlib-specific header and\ntrailer.\n\n* -9 to -15: Uses the absolute value of 'wbits' as the window\nsize logarithm, while producing a raw output stream with no\nheader or trailing checksum.\n\n* +25 to +31 = 16 + (9 to 15): Uses the low 4 bits of the value\nas the window size logarithm, while including a basic 'gzip'\nheader and trailing checksum in the output.\n\nRaises the *note error: 264a. exception if any error occurs.\n\nChanged in version 3.6: 'level' can now be used as a keyword\nparameter.\n\nChanged in version 3.11: The 'wbits' parameter is now available to\nset window bits and compression type.\n\n-- Function: zlib.compressobj (level=-1, method=DEFLATED,\nwbits=MAXWBITS, memLevel=DEFMEMLEVEL,\nstrategy=ZDEFAULTSTRATEGY[, zdict])\n\nReturns a compression object, to be used for compressing data\nstreams that won't fit into memory at once.\n\n'level' is the compression level - an integer from '0' to '9' or\n'-1'.  A value of '1' (ZBESTSPEED) is fastest and produces the\nleast compression, while a value of '9' (ZBESTCOMPRESSION) is\nslowest and produces the most.  '0' (ZNOCOMPRESSION) is no\ncompression.  The default value is '-1' (ZDEFAULTCOMPRESSION).\nZDEFAULTCOMPRESSION represents a default compromise between speed\nand compression (currently equivalent to level 6).\n\n'method' is the compression algorithm.  Currently, the only\nsupported value is 'DEFLATED'.\n\nThe 'wbits' parameter controls the size of the history buffer (or\nthe \"window size\"), and what header and trailer format will be\nused.  It has the same meaning as *note described for compress():\n264b.\n\nThe 'memLevel' argument controls the amount of memory used for the\ninternal compression state.  Valid values range from '1' to '9'.\nHigher values use more memory, but are faster and produce smaller\noutput.\n\n'strategy' is used to tune the compression algorithm.  Possible\nvalues are 'ZDEFAULTSTRATEGY', 'ZFILTERED', 'ZHUFFMANONLY',\n'ZRLE' (zlib 1.2.0.1) and 'ZFIXED' (zlib 1.2.2.2).\n\n'zdict' is a predefined compression dictionary.  This is a sequence\nof bytes (such as a *note bytes: 295. object) containing\nsubsequences that are expected to occur frequently in the data that\nis to be compressed.  Those subsequences that are expected to be\nmost common should come at the end of the dictionary.\n\nChanged in version 3.3: Added the 'zdict' parameter and keyword\nargument support.\n\n-- Function: zlib.crc32 (data[, value])\n\nComputes a CRC (Cyclic Redundancy Check) checksum of 'data'.  The\nresult is an unsigned 32-bit integer.  If 'value' is present, it is\nused as the starting value of the checksum; otherwise, a default\nvalue of 0 is used.  Passing in 'value' allows computing a running\nchecksum over the concatenation of several inputs.  The algorithm\nis not cryptographically strong, and should not be used for\nauthentication or digital signatures.  Since the algorithm is\ndesigned for use as a checksum algorithm, it is not suitable for\nuse as a general hash algorithm.\n\nChanged in version 3.0: The result is always unsigned.\n\n-- Function: zlib.decompress (data, /, wbits=MAXWBITS,\nbufsize=DEFBUFSIZE)\n\nDecompresses the bytes in 'data', returning a bytes object\ncontaining the uncompressed data.  The 'wbits' parameter depends on\nthe format of 'data', and is discussed further below.  If 'bufsize'\nis given, it is used as the initial size of the output buffer.\nRaises the *note error: 264a. exception if any error occurs.  The\n'wbits' parameter controls the size of the history buffer (or\n\"window size\"), and what header and trailer format is expected.  It\nis similar to the parameter for *note compressobj(): 264c, but\naccepts more ranges of values:\n\n* +8 to +15: The base-two logarithm of the window size.  The\ninput must include a zlib header and trailer.\n\n* 0: Automatically determine the window size from the zlib\nheader.  Only supported since zlib 1.2.3.5.\n\n* -8 to -15: Uses the absolute value of 'wbits' as the window\nsize logarithm.  The input must be a raw stream with no header\nor trailer.\n\n* +24 to +31 = 16 + (8 to 15): Uses the low 4 bits of the value\nas the window size logarithm.  The input must include a gzip\nheader and trailer.\n\n* +40 to +47 = 32 + (8 to 15): Uses the low 4 bits of the value\nas the window size logarithm, and automatically accepts either\nthe zlib or gzip format.\n\nWhen decompressing a stream, the window size must not be smaller\nthan the size originally used to compress the stream; using a\ntoo-small value may result in an *note error: 264a. exception.  The\ndefault 'wbits' value corresponds to the largest window size and\nrequires a zlib header and trailer to be included.\n\n'bufsize' is the initial size of the buffer used to hold\ndecompressed data.  If more space is required, the buffer size will\nbe increased as needed, so you don't have to get this value exactly\nright; tuning it will only save a few calls to 'malloc()'.\n\nChanged in version 3.6: 'wbits' and 'bufsize' can be used as\nkeyword arguments.\n\n-- Function: zlib.decompressobj (wbits=MAXWBITS[, zdict])\n\nReturns a decompression object, to be used for decompressing data\nstreams that won't fit into memory at once.\n\nThe 'wbits' parameter controls the size of the history buffer (or\nthe \"window size\"), and what header and trailer format is expected.\nIt has the same meaning as *note described for decompress(): 264d.\n\nThe 'zdict' parameter specifies a predefined compression\ndictionary.  If provided, this must be the same dictionary as was\nused by the compressor that produced the data that is to be\ndecompressed.\n\nNote: If 'zdict' is a mutable object (such as a *note\nbytearray: 294.), you must not modify its contents between the\ncall to *note decompressobj(): 264e. and the first call to the\ndecompressor's 'decompress()' method.\n\nChanged in version 3.3: Added the 'zdict' parameter.\n\nCompression objects support the following methods:\n\n-- Method: Compress.compress (data)\n\nCompress 'data', returning a bytes object containing compressed\ndata for at least part of the data in 'data'.  This data should be\nconcatenated to the output produced by any preceding calls to the\n*note compress(): b5e. method.  Some input may be kept in internal\nbuffers for later processing.\n\n-- Method: Compress.flush ([mode])\n\nAll pending input is processed, and a bytes object containing the\nremaining compressed output is returned.  'mode' can be selected\nfrom the constants 'ZNOFLUSH', 'ZPARTIALFLUSH', 'ZSYNCFLUSH',\n'ZFULLFLUSH', 'ZBLOCK' (zlib 1.2.3.4), or 'ZFINISH', defaulting\nto 'ZFINISH'.  Except 'ZFINISH', all constants allow compressing\nfurther bytestrings of data, while 'ZFINISH' finishes the\ncompressed stream and prevents compressing any more data.  After\ncalling *note flush(): 2650. with 'mode' set to 'ZFINISH', the\n*note compress(): b5e. method cannot be called again; the only\nrealistic action is to delete the object.\n\n-- Method: Compress.copy ()\n\nReturns a copy of the compression object.  This can be used to\nefficiently compress a set of data that share a common initial\nprefix.\n\nChanged in version 3.8: Added *note copy.copy(): 289. and *note\ncopy.deepcopy(): 9af. support to compression objects.\n\nDecompression objects support the following methods and attributes:\n\n-- Attribute: Decompress.unuseddata\n\nA bytes object which contains any bytes past the end of the\ncompressed data.  That is, this remains 'b\"\"' until the last byte\nthat contains compression data is available.  If the whole\nbytestring turned out to contain compressed data, this is 'b\"\"', an\nempty bytes object.\n\n-- Attribute: Decompress.unconsumedtail\n\nA bytes object that contains any data that was not consumed by the\nlast *note decompress(): b5f. call because it exceeded the limit\nfor the uncompressed data buffer.  This data has not yet been seen\nby the zlib machinery, so you must feed it (possibly with further\ndata concatenated to it) back to a subsequent *note decompress():\nb5f. method call in order to get correct output.\n\n-- Attribute: Decompress.eof\n\nA boolean indicating whether the end of the compressed data stream\nhas been reached.\n\nThis makes it possible to distinguish between a properly formed\ncompressed stream, and an incomplete or truncated one.\n\nNew in version 3.3.\n\n-- Method: Decompress.decompress (data, maxlength=0)\n\nDecompress 'data', returning a bytes object containing the\nuncompressed data corresponding to at least part of the data in\n'string'.  This data should be concatenated to the output produced\nby any preceding calls to the *note decompress(): b5f. method.\nSome of the input data may be preserved in internal buffers for\nlater processing.\n\nIf the optional parameter 'maxlength' is non-zero then the return\nvalue will be no longer than 'maxlength'.  This may mean that not\nall of the compressed input can be processed; and unconsumed data\nwill be stored in the attribute *note unconsumedtail: 2653.  This\nbytestring must be passed to a subsequent call to *note\ndecompress(): b5f. if decompression is to continue.  If\n'maxlength' is zero then the whole input is decompressed, and\n*note unconsumedtail: 2653. is empty.\n\nChanged in version 3.6: 'maxlength' can be used as a keyword\nargument.\n\n-- Method: Decompress.flush ([length])\n\nAll pending input is processed, and a bytes object containing the\nremaining uncompressed output is returned.  After calling *note\nflush(): 2655, the *note decompress(): b5f. method cannot be called\nagain; the only realistic action is to delete the object.\n\nThe optional parameter 'length' sets the initial size of the output\nbuffer.\n\n-- Method: Decompress.copy ()\n\nReturns a copy of the decompression object.  This can be used to\nsave the state of the decompressor midway through the data stream\nin order to speed up random seeks into the stream at a future\npoint.\n\nChanged in version 3.8: Added *note copy.copy(): 289. and *note\ncopy.deepcopy(): 9af. support to decompression objects.\n",
            "subsections": []
        },
        "Information about the version of the zlib library in use is available": {
            "content": "through the following constants:\n\n-- Data: zlib.ZLIBVERSION\n\nThe version string of the zlib library that was used for building\nthe module.  This may be different from the zlib library actually\nused at runtime, which is available as *note ZLIBRUNTIMEVERSION:\nfe3.\n\n-- Data: zlib.ZLIBRUNTIMEVERSION\n\nThe version string of the zlib library actually loaded by the\ninterpreter.\n\nNew in version 3.3.\n\nSee also\n........\n\nModule *note gzip: 62.\n\nReading and writing 'gzip'-format files.\n\n'http://www.zlib.net'\n\nThe zlib library home page.\n\n'http://www.zlib.net/manual.html'\n\nThe zlib manual explains the semantics and usage of the library's\nmany functions.\n\n---------- Footnotes ----------\n\n(1) https://zlib.net/zlibfaq.html#faq33\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: gzip -- Support for gzip files,  Next: bz2 -- Support for bzip2 compression,  Prev: zlib -- Compression compatible with gzip,  Up: Data Compression and Archiving": {
            "content": "'Source code:' Lib/gzip.py(1)\n\n\n",
            "subsections": []
        },
        "This module provides a simple interface to compress and decompress files": {
            "content": "just like the GNU programs 'gzip' and 'gunzip' would.\n\nThe data compression is provided by the *note zlib: 12d. module.\n\nThe *note gzip: 62. module provides the *note GzipFile: 25e. class, as\nwell as the *note open(): 265a, *note compress(): 81d. and *note\ndecompress(): 1081. convenience functions.  The *note GzipFile: 25e.\nclass reads and writes 'gzip'-format files, automatically compressing or\ndecompressing the data so that it looks like an ordinary *note file\nobject: 1037.\n",
            "subsections": []
        },
        "Note that additional file formats which can be decompressed by the": {
            "content": "'gzip' and 'gunzip' programs, such as those produced by 'compress' and\n'pack', are not supported by this module.\n\nThe module defines the following items:\n\n-- Function: gzip.open (filename, mode='rb', compresslevel=9,\nencoding=None, errors=None, newline=None)\n\nOpen a gzip-compressed file in binary or text mode, returning a\n*note file object: 1037.\n\nThe 'filename' argument can be an actual filename (a *note str:\n157. or *note bytes: 295. object), or an existing file object to\nread from or write to.\n\nThe 'mode' argument can be any of ''r'', ''rb'', ''a'', ''ab'',\n''w'', ''wb'', ''x'' or ''xb'' for binary mode, or ''rt'', ''at'',\n''wt'', or ''xt'' for text mode.  The default is ''rb''.\n\nThe 'compresslevel' argument is an integer from 0 to 9, as for the\n*note GzipFile: 25e. constructor.\n\nFor binary mode, this function is equivalent to the *note GzipFile:\n25e. constructor: 'GzipFile(filename, mode, compresslevel)'.  In\nthis case, the 'encoding', 'errors' and 'newline' arguments must\nnot be provided.\n\nFor text mode, a *note GzipFile: 25e. object is created, and\nwrapped in an *note io.TextIOWrapper: b8f. instance with the\nspecified encoding, error handling behavior, and line ending(s).\n\nChanged in version 3.3: Added support for 'filename' being a file\nobject, support for text mode, and the 'encoding', 'errors' and\n'newline' arguments.\n\nChanged in version 3.4: Added support for the ''x'', ''xb'' and\n''xt'' modes.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Exception: gzip.BadGzipFile\n\nAn exception raised for invalid gzip files.  It inherits from *note\nOSError: 613.  *note EOFError: 114e. and *note zlib.error: 264a.\ncan also be raised for invalid gzip files.\n\nNew in version 3.8.\n\n-- Class: gzip.GzipFile (filename=None, mode=None, compresslevel=9,\nfileobj=None, mtime=None)\n\nConstructor for the *note GzipFile: 25e. class, which simulates\nmost of the methods of a *note file object: 1037, with the\nexception of the *note truncate(): 1187. method.  At least one of\n'fileobj' and 'filename' must be given a non-trivial value.\n\nThe new class instance is based on 'fileobj', which can be a\nregular file, an *note io.BytesIO: d08. object, or any other object\nwhich simulates a file.  It defaults to 'None', in which case\n'filename' is opened to provide a file object.\n\nWhen 'fileobj' is not 'None', the 'filename' argument is only used\nto be included in the 'gzip' file header, which may include the\noriginal filename of the uncompressed file.  It defaults to the\nfilename of 'fileobj', if discernible; otherwise, it defaults to\nthe empty string, and in this case the original filename is not\nincluded in the header.\n\nThe 'mode' argument can be any of ''r'', ''rb'', ''a'', ''ab'',\n''w'', ''wb'', ''x'', or ''xb'', depending on whether the file will\nbe read or written.  The default is the mode of 'fileobj' if\ndiscernible; otherwise, the default is ''rb''.  In future Python\nreleases the mode of 'fileobj' will not be used.  It is better to\nalways specify 'mode' for writing.\n\nNote that the file is always opened in binary mode.  To open a\ncompressed file in text mode, use *note open(): 265a. (or wrap your\n*note GzipFile: 25e. with an *note io.TextIOWrapper: b8f.).\n\nThe 'compresslevel' argument is an integer from '0' to '9'\ncontrolling the level of compression; '1' is fastest and produces\nthe least compression, and '9' is slowest and produces the most\ncompression.  '0' is no compression.  The default is '9'.\n\nThe 'mtime' argument is an optional numeric timestamp to be written\nto the last modification time field in the stream when compressing.\nIt should only be provided in compression mode.  If omitted or\n'None', the current time is used.  See the *note mtime: 265b.\nattribute for more details.\n\nCalling a *note GzipFile: 25e. object's 'close()' method does not\nclose 'fileobj', since you might wish to append more material after\nthe compressed data.  This also allows you to pass an *note\nio.BytesIO: d08. object opened for writing as 'fileobj', and\nretrieve the resulting memory buffer using the *note io.BytesIO:\nd08. object's *note getvalue(): 265c. method.\n\n*note GzipFile: 25e. supports the *note io.BufferedIOBase: 460.\ninterface, including iteration and the *note with: 396. statement.\nOnly the *note truncate(): 1187. method isn't implemented.\n\n*note GzipFile: 25e. also provides the following method and\nattribute:\n\n-- Method: peek (n)\n\nRead 'n' uncompressed bytes without advancing the file\nposition.  At most one single read on the compressed stream is\ndone to satisfy the call.  The number of bytes returned may be\nmore or less than requested.\n\nNote: While calling *note peek(): 1080. does not change\nthe file position of the *note GzipFile: 25e, it may\nchange the position of the underlying file object (e.g.\nif the *note GzipFile: 25e. was constructed with the\n'fileobj' parameter).\n\nNew in version 3.2.\n\n-- Attribute: mtime\n\nWhen decompressing, the value of the last modification time\nfield in the most recently read header may be read from this\nattribute, as an integer.  The initial value before reading\nany headers is 'None'.\n\nAll 'gzip' compressed streams are required to contain this\ntimestamp field.  Some programs, such as 'gunzip', make use of\nthe timestamp.  The format is the same as the return value of\n*note time.time(): 918. and the *note stmtime: 265d.\nattribute of the object returned by *note os.stat(): 1bf.\n\n-- Attribute: name\n\nThe path to the gzip file on disk, as a *note str: 157. or\n*note bytes: 295.  Equivalent to the output of *note\nos.fspath(): a9c. on the original input path, with no other\nnormalization, resolution or expansion.\n\nChanged in version 3.1: Support for the *note with: 396. statement\nwas added, along with the 'mtime' constructor argument and *note\nmtime: 265b. attribute.\n\nChanged in version 3.2: Support for zero-padded and unseekable\nfiles was added.\n\nChanged in version 3.3: The *note io.BufferedIOBase.read1(): 265e.\nmethod is now implemented.\n\nChanged in version 3.4: Added support for the ''x'' and ''xb''\nmodes.\n\nChanged in version 3.5: Added support for writing arbitrary *note\nbytes-like objects: b82.  The *note read(): 11a0. method now\naccepts an argument of 'None'.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\nChanged in version 3.12: Remove the 'filename' attribute, use the\n*note name: 25f. attribute instead.\n\nDeprecated since version 3.9: Opening *note GzipFile: 25e. for\nwriting without specifying the 'mode' argument is deprecated.\n\n-- Function: gzip.compress (data, compresslevel=9, *, mtime=None)\n\nCompress the 'data', returning a *note bytes: 295. object\ncontaining the compressed data.  'compresslevel' and 'mtime' have\nthe same meaning as in the *note GzipFile: 25e. constructor above.\nWhen 'mtime' is set to '0', this function is equivalent to *note\nzlib.compress(): b5e. with 'wbits' set to '31'.  The zlib function\nis faster.\n\nNew in version 3.2.\n\nChanged in version 3.8: Added the 'mtime' parameter for\nreproducible output.\n\nChanged in version 3.11: Speed is improved by compressing all data\nat once instead of in a streamed fashion.  Calls with 'mtime' set\nto '0' are delegated to *note zlib.compress(): b5e. for better\nspeed.\n\n-- Function: gzip.decompress (data)\n\nDecompress the 'data', returning a *note bytes: 295. object\ncontaining the uncompressed data.  This function is capable of\ndecompressing multi-member gzip data (multiple gzip blocks\nconcatenated together).  When the data is certain to contain only\none member the *note zlib.decompress(): b5f. function with 'wbits'\nset to 31 is faster.\n\nNew in version 3.2.\n\nChanged in version 3.11: Speed is improved by decompressing members\nat once in memory instead of in a streamed fashion.\n\n* Menu:\n\n* Examples of usage::\n* Command Line Interface::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/gzip.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Examples of usage,  Next: Command Line Interface,  Up: gzip -- Support for gzip files": {
            "content": "5.13.2.1 Examples of usage\n..........................\n\nExample of how to read a compressed file:\n\nimport gzip\nwith gzip.open('/home/joe/file.txt.gz', 'rb') as f:\nfilecontent = f.read()\n\nExample of how to create a compressed GZIP file:\n\nimport gzip\ncontent = b\"Lots of content here\"\nwith gzip.open('/home/joe/file.txt.gz', 'wb') as f:\nf.write(content)\n\nExample of how to GZIP compress an existing file:\n\nimport gzip\nimport shutil\nwith open('/home/joe/file.txt', 'rb') as fin:\nwith gzip.open('/home/joe/file.txt.gz', 'wb') as fout:\nshutil.copyfileobj(fin, fout)\n\nExample of how to GZIP compress a binary string:\n\nimport gzip\nsin = b\"Lots of content here\"\nsout = gzip.compress(sin)\n\nSee also\n........\n\nModule *note zlib: 12d.\n\nThe basic data compression module needed to support the 'gzip' file\nformat.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Command Line Interface,  Prev: Examples of usage,  Up: gzip -- Support for gzip files": {
            "content": "5.13.2.2 Command Line Interface\n...............................\n\nThe *note gzip: 62. module provides a simple command line interface to\ncompress or decompress files.\n\nOnce executed the *note gzip: 62. module keeps the input file(s).\n\nChanged in version 3.8: Add a new command line interface with a usage.",
            "subsections": []
        },
        "By default, when you will execute the CLI, the default compression level": {
            "content": "is 6.\n\n* Menu:\n\n* Command line options::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Command line options,  Up: Command Line Interface": {
            "content": "5.13.2.3 Command line options\n.............................\n\n-- Option: file\n\nIf 'file' is not specified, read from *note sys.stdin: 293.\n\n-- Option: --fast\n\nIndicates the fastest compression method (less compression).\n\n-- Option: --best\n\nIndicates the slowest compression method (best compression).\n\n-- Option: -d, --decompress\n\nDecompress the given file.\n\n-- Option: -h, --help\n\nShow the help message.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: bz2 -- Support for bzip2 compression,  Next: lzma -- Compression using the LZMA algorithm,  Prev: gzip -- Support for gzip files,  Up: Data Compression and Archiving": {
            "content": "'Source code:' Lib/bz2.py(1)\n\n\n",
            "subsections": []
        },
        "This module provides a comprehensive interface for compressing and": {
            "content": "decompressing data using the bzip2 compression algorithm.\n\nThe *note bz2: 11. module contains:\n\n* The *note open(): f05. function and *note BZ2File: 775. class for\nreading and writing compressed files.\n\n* The *note BZ2Compressor: 14ac. and *note BZ2Decompressor: 14aa.\nclasses for incremental (de)compression.\n\n* The *note compress(): 2120. and *note decompress(): f06. functions\nfor one-shot (de)compression.\n\n* Menu:\n\n* (De)compression of files: De compression of files.\n* Incremental (de)compression: Incremental de compression.\n* One-shot (de)compression: One-shot de compression.\n* Examples of usage: Examples of usage<2>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/bz2.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: De compression of files,  Next: Incremental de compression,  Up: bz2 -- Support for bzip2 compression": {
            "content": "5.13.3.1 (De)compression of files\n.................................\n\n-- Function: bz2.open (filename, mode='rb', compresslevel=9,\nencoding=None, errors=None, newline=None)\n\nOpen a bzip2-compressed file in binary or text mode, returning a\n*note file object: 1037.\n\nAs with the constructor for *note BZ2File: 775, the 'filename'\nargument can be an actual filename (a *note str: 157. or *note\nbytes: 295. object), or an existing file object to read from or\nwrite to.\n\nThe 'mode' argument can be any of ''r'', ''rb'', ''w'', ''wb'',\n''x'', ''xb'', ''a'' or ''ab'' for binary mode, or ''rt'', ''wt'',\n''xt'', or ''at'' for text mode.  The default is ''rb''.\n\nThe 'compresslevel' argument is an integer from 1 to 9, as for the\n*note BZ2File: 775. constructor.\n\nFor binary mode, this function is equivalent to the *note BZ2File:\n775. constructor: 'BZ2File(filename, mode,\ncompresslevel=compresslevel)'.  In this case, the 'encoding',\n'errors' and 'newline' arguments must not be provided.\n\nFor text mode, a *note BZ2File: 775. object is created, and wrapped\nin an *note io.TextIOWrapper: b8f. instance with the specified\nencoding, error handling behavior, and line ending(s).\n\nNew in version 3.3.\n\nChanged in version 3.4: The ''x'' (exclusive creation) mode was\nadded.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Class: bz2.BZ2File (filename, mode='r', *, compresslevel=9)\n\nOpen a bzip2-compressed file in binary mode.\n\nIf 'filename' is a *note str: 157. or *note bytes: 295. object,\nopen the named file directly.  Otherwise, 'filename' should be a\n*note file object: 1037, which will be used to read or write the\ncompressed data.\n\nThe 'mode' argument can be either ''r'' for reading (default),\n''w'' for overwriting, ''x'' for exclusive creation, or ''a'' for\nappending.  These can equivalently be given as ''rb'', ''wb'',\n''xb'' and ''ab'' respectively.\n\nIf 'filename' is a file object (rather than an actual file name), a\nmode of ''w'' does not truncate the file, and is instead equivalent\nto ''a''.\n\nIf 'mode' is ''w'' or ''a'', 'compresslevel' can be an integer\nbetween '1' and '9' specifying the level of compression: '1'\nproduces the least compression, and '9' (default) produces the most\ncompression.\n\nIf 'mode' is ''r'', the input file may be the concatenation of\nmultiple compressed streams.\n\n*note BZ2File: 775. provides all of the members specified by the\n*note io.BufferedIOBase: 460, except for *note detach(): 266e. and\n*note truncate(): 1187.  Iteration and the *note with: 396.\nstatement are supported.\n\n*note BZ2File: 775. also provides the following methods:\n\n-- Method: peek ([n])\n\nReturn buffered data without advancing the file position.  At\nleast one byte of data will be returned (unless at EOF). The\nexact number of bytes returned is unspecified.\n\nNote: While calling *note peek(): 266f. does not change\nthe file position of the *note BZ2File: 775, it may\nchange the position of the underlying file object (e.g.\nif the *note BZ2File: 775. was constructed by passing a\nfile object for 'filename').\n\nNew in version 3.3.\n\n-- Method: fileno ()\n\nReturn the file descriptor for the underlying file.\n\nNew in version 3.3.\n\n-- Method: readable ()\n\nReturn whether the file was opened for reading.\n\nNew in version 3.3.\n\n-- Method: seekable ()\n\nReturn whether the file supports seeking.\n\nNew in version 3.3.\n\n-- Method: writable ()\n\nReturn whether the file was opened for writing.\n\nNew in version 3.3.\n\n-- Method: read1 (size=-1)\n\nRead up to 'size' uncompressed bytes, while trying to avoid\nmaking multiple reads from the underlying stream.  Reads up to\na buffer's worth of data if size is negative.\n\nReturns 'b''' if the file is at EOF.\n\nNew in version 3.3.\n\n-- Method: readinto (b)\n\nRead bytes into 'b'.\n\nReturns the number of bytes read (0 for EOF).\n\nNew in version 3.3.\n\nChanged in version 3.1: Support for the *note with: 396. statement\nwas added.\n\nChanged in version 3.3: Support was added for 'filename' being a\n*note file object: 1037. instead of an actual filename.\n\nThe ''a'' (append) mode was added, along with support for reading\nmulti-stream files.\n\nChanged in version 3.4: The ''x'' (exclusive creation) mode was\nadded.\n\nChanged in version 3.5: The *note read(): 11a0. method now accepts\nan argument of 'None'.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\nChanged in version 3.9: The 'buffering' parameter has been removed.\nIt was ignored and deprecated since Python 3.0.  Pass an open file\nobject to control how the file is opened.\n\nThe 'compresslevel' parameter became keyword-only.\n\nChanged in version 3.10: This class is thread unsafe in the face of\nmultiple simultaneous readers or writers, just like its equivalent\nclasses in *note gzip: 62. and *note lzma: 85. have always been.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Incremental de compression,  Next: One-shot de compression,  Prev: De compression of files,  Up: bz2 -- Support for bzip2 compression": {
            "content": "5.13.3.2 Incremental (de)compression\n....................................\n\n-- Class: bz2.BZ2Compressor (compresslevel=9)\n\nCreate a new compressor object.  This object may be used to\ncompress data incrementally.  For one-shot compression, use the\n*note compress(): 2120. function instead.\n\n'compresslevel', if given, must be an integer between '1' and '9'.\nThe default is '9'.\n\n-- Method: compress (data)\n\nProvide data to the compressor object.  Returns a chunk of\ncompressed data if possible, or an empty byte string\notherwise.\n\nWhen you have finished providing data to the compressor, call\nthe *note flush(): 2678. method to finish the compression\nprocess.\n\n-- Method: flush ()\n\nFinish the compression process.  Returns the compressed data\nleft in internal buffers.\n\nThe compressor object may not be used after this method has\nbeen called.\n\n-- Class: bz2.BZ2Decompressor\n\nCreate a new decompressor object.  This object may be used to\ndecompress data incrementally.  For one-shot compression, use the\n*note decompress(): f06. function instead.\n\nNote: This class does not transparently handle inputs\ncontaining multiple compressed streams, unlike *note\ndecompress(): f06. and *note BZ2File: 775.  If you need to\ndecompress a multi-stream input with *note BZ2Decompressor:\n14aa, you must use a new decompressor for each stream.\n\n-- Method: decompress (data, maxlength=-1)\n\nDecompress 'data' (a *note bytes-like object: b82.), returning\nuncompressed data as bytes.  Some of 'data' may be buffered\ninternally, for use in later calls to *note decompress(): f06.\nThe returned data should be concatenated with the output of\nany previous calls to *note decompress(): f06.\n\nIf 'maxlength' is nonnegative, returns at most 'maxlength'\nbytes of decompressed data.  If this limit is reached and\nfurther output can be produced, the *note needsinput: 2679.\nattribute will be set to 'False'.  In this case, the next call\nto *note decompress(): c28. may provide 'data' as 'b''' to\nobtain more of the output.\n\nIf all of the input data was decompressed and returned (either\nbecause this was less than 'maxlength' bytes, or because\n'maxlength' was negative), the *note needsinput: 2679.\nattribute will be set to 'True'.\n\nAttempting to decompress data after the end of stream is\nreached raises an *note EOFError: 114e.  Any data found after\nthe end of the stream is ignored and saved in the *note\nunuseddata: 267a. attribute.\n\nChanged in version 3.5: Added the 'maxlength' parameter.\n\n-- Attribute: eof\n\n'True' if the end-of-stream marker has been reached.\n\nNew in version 3.3.\n\n-- Attribute: unuseddata\n\nData found after the end of the compressed stream.\n\nIf this attribute is accessed before the end of the stream has\nbeen reached, its value will be 'b'''.\n\n-- Attribute: needsinput\n\n'False' if the *note decompress(): c28. method can provide\nmore decompressed data before requiring new uncompressed\ninput.\n\nNew in version 3.5.\n\nFile: python3.12.info,  Node: One-shot de compression,  Next: Examples of usage<2>,  Prev: Incremental de compression,  Up: bz2 -- Support for bzip2 compression\n\n5.13.3.3 One-shot (de)compression\n.................................\n\n-- Function: bz2.compress (data, compresslevel=9)\n\nCompress 'data', a *note bytes-like object: b82.\n\n'compresslevel', if given, must be an integer between '1' and '9'.\nThe default is '9'.\n\nFor incremental compression, use a *note BZ2Compressor: 14ac.\ninstead.\n\n-- Function: bz2.decompress (data)\n\nDecompress 'data', a *note bytes-like object: b82.\n\nIf 'data' is the concatenation of multiple compressed streams,\ndecompress all of the streams.\n\nFor incremental decompression, use a *note BZ2Decompressor: 14aa.\ninstead.\n\nChanged in version 3.3: Support for multi-stream inputs was added.\n\nFile: python3.12.info,  Node: Examples of usage<2>,  Prev: One-shot de compression,  Up: bz2 -- Support for bzip2 compression\n\n5.13.3.4 Examples of usage\n..........................\n\nBelow are some examples of typical usage of the *note bz2: 11. module.\n\nUsing *note compress(): 2120. and *note decompress(): f06. to\ndemonstrate round-trip compression:\n\n>>> import bz2\n>>> data = b\"\"\"\\\n... Donec rhoncus quis sapien sit amet molestie. Fusce scelerisque vel augue\n... nec ullamcorper. Nam rutrum pretium placerat. Aliquam vel tristique lorem,\n... sit amet cursus ante. In interdum laoreet mi, sit amet ultrices purus\n... pulvinar a. Nam gravida euismod magna, non varius justo tincidunt feugiat.\n... Aliquam pharetra lacus non risus vehicula rutrum. Maecenas aliquam leo\n... felis. Pellentesque semper nunc sit amet nibh ullamcorper, ac elementum\n... dolor luctus. Curabitur lacinia mi ornare consectetur vestibulum.\"\"\"\n>>> c = bz2.compress(data)\n>>> len(data) / len(c)  # Data compression ratio\n1.513595166163142\n>>> d = bz2.decompress(c)\n>>> data == d  # Check equality to original object after round-trip\nTrue\n\nUsing *note BZ2Compressor: 14ac. for incremental compression:\n\n>>> import bz2\n>>> def gendata(chunks=10, chunksize=1000):\n...     \"\"\"Yield incremental blocks of chunksize bytes.\"\"\"\n...     for  in range(chunks):\n...         yield b\"z\" * chunksize\n...\n>>> comp = bz2.BZ2Compressor()\n>>> out = b\"\"\n>>> for chunk in gendata():\n...     # Provide data to the compressor object\n...     out = out + comp.compress(chunk)\n...\n>>> # Finish the compression process.  Call this once you have\n>>> # finished providing data to the compressor.\n>>> out = out + comp.flush()\n\nThe example above uses a very \"nonrandom\" stream of data (a stream of\n'b\"z\"' chunks).  Random data tends to compress poorly, while ordered,\nrepetitive data usually yields a high compression ratio.\n\nWriting and reading a bzip2-compressed file in binary mode:\n\n>>> import bz2\n>>> data = b\"\"\"\\\n... Donec rhoncus quis sapien sit amet molestie. Fusce scelerisque vel augue\n... nec ullamcorper. Nam rutrum pretium placerat. Aliquam vel tristique lorem,\n... sit amet cursus ante. In interdum laoreet mi, sit amet ultrices purus\n... pulvinar a. Nam gravida euismod magna, non varius justo tincidunt feugiat.\n... Aliquam pharetra lacus non risus vehicula rutrum. Maecenas aliquam leo\n... felis. Pellentesque semper nunc sit amet nibh ullamcorper, ac elementum\n... dolor luctus. Curabitur lacinia mi ornare consectetur vestibulum.\"\"\"\n>>> with bz2.open(\"myfile.bz2\", \"wb\") as f:\n...     # Write compressed data to file\n...     unused = f.write(data)\n...\n>>> with bz2.open(\"myfile.bz2\", \"rb\") as f:\n...     # Decompress data from file\n...     content = f.read()\n...\n>>> content == data  # Check equality to original object after round-trip\nTrue\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: lzma -- Compression using the LZMA algorithm,  Next: zipfile -- Work with ZIP archives,  Prev: bz2 -- Support for bzip2 compression,  Up: Data Compression and Archiving": {
            "content": "New in version 3.3.\n\n'Source code:' Lib/lzma.py(1)\n\n\n",
            "subsections": []
        },
        "This module provides classes and convenience functions for compressing": {
            "content": "and decompressing data using the LZMA compression algorithm.  Also\nincluded is a file interface supporting the '.xz' and legacy '.lzma'\nfile formats used by the 'xz' utility, as well as raw compressed\nstreams.\n",
            "subsections": []
        },
        "The interface provided by this module is very similar to that of the": {
            "content": "*note bz2: 11. module.  Note that *note LZMAFile: e80. and *note\nbz2.BZ2File: 775. are 'not' thread-safe, so if you need to use a single\n*note LZMAFile: e80. instance from multiple threads, it is necessary to\nprotect it with a lock.\n\n-- Exception: lzma.LZMAError\n\nThis exception is raised when an error occurs during compression or\ndecompression, or while initializing the compressor/decompressor\nstate.\n\n* Menu:\n\n* Reading and writing compressed files::\n* Compressing and decompressing data in memory::\n* Miscellaneous: Miscellaneous<2>.\n* Specifying custom filter chains::\n* Examples: Examples<7>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/lzma.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Reading and writing compressed files,  Next: Compressing and decompressing data in memory,  Up: lzma -- Compression using the LZMA algorithm": {
            "content": "5.13.4.1 Reading and writing compressed files\n.............................................\n\n-- Function: lzma.open (filename, mode='rb', *, format=None, check=-1,\npreset=None, filters=None, encoding=None, errors=None,\nnewline=None)\n\nOpen an LZMA-compressed file in binary or text mode, returning a\n*note file object: 1037.\n\nThe 'filename' argument can be either an actual file name (given as\na *note str: 157, *note bytes: 295. or *note path-like: 957.\nobject), in which case the named file is opened, or it can be an\nexisting file object to read from or write to.\n\nThe 'mode' argument can be any of '\"r\"', '\"rb\"', '\"w\"', '\"wb\"',\n'\"x\"', '\"xb\"', '\"a\"' or '\"ab\"' for binary mode, or '\"rt\"', '\"wt\"',\n'\"xt\"', or '\"at\"' for text mode.  The default is '\"rb\"'.\n\nWhen opening a file for reading, the 'format' and 'filters'\narguments have the same meanings as for *note LZMADecompressor:\n14a9.  In this case, the 'check' and 'preset' arguments should not\nbe used.\n\nWhen opening a file for writing, the 'format', 'check', 'preset'\nand 'filters' arguments have the same meanings as for *note\nLZMACompressor: 14ab.\n\nFor binary mode, this function is equivalent to the *note LZMAFile:\ne80. constructor: 'LZMAFile(filename, mode, ...)'.  In this case,\nthe 'encoding', 'errors' and 'newline' arguments must not be\nprovided.\n\nFor text mode, a *note LZMAFile: e80. object is created, and\nwrapped in an *note io.TextIOWrapper: b8f. instance with the\nspecified encoding, error handling behavior, and line ending(s).\n\nChanged in version 3.4: Added support for the '\"x\"', '\"xb\"' and\n'\"xt\"' modes.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Class: lzma.LZMAFile (filename=None, mode='r', *, format=None,\ncheck=-1, preset=None, filters=None)\n\nOpen an LZMA-compressed file in binary mode.\n\nAn *note LZMAFile: e80. can wrap an already-open *note file object:\n1037, or operate directly on a named file.  The 'filename' argument\nspecifies either the file object to wrap, or the name of the file\nto open (as a *note str: 157, *note bytes: 295. or *note path-like:\n957. object).  When wrapping an existing file object, the wrapped\nfile will not be closed when the *note LZMAFile: e80. is closed.\n\nThe 'mode' argument can be either '\"r\"' for reading (default),\n'\"w\"' for overwriting, '\"x\"' for exclusive creation, or '\"a\"' for\nappending.  These can equivalently be given as '\"rb\"', '\"wb\"',\n'\"xb\"' and '\"ab\"' respectively.\n\nIf 'filename' is a file object (rather than an actual file name), a\nmode of '\"w\"' does not truncate the file, and is instead equivalent\nto '\"a\"'.\n\nWhen opening a file for reading, the input file may be the\nconcatenation of multiple separate compressed streams.  These are\ntransparently decoded as a single logical stream.\n\nWhen opening a file for reading, the 'format' and 'filters'\narguments have the same meanings as for *note LZMADecompressor:\n14a9.  In this case, the 'check' and 'preset' arguments should not\nbe used.\n\nWhen opening a file for writing, the 'format', 'check', 'preset'\nand 'filters' arguments have the same meanings as for *note\nLZMACompressor: 14ab.\n\n*note LZMAFile: e80. supports all the members specified by *note\nio.BufferedIOBase: 460, except for *note detach(): 266e. and *note\ntruncate(): 1187.  Iteration and the *note with: 396. statement are\nsupported.\n\nThe following method is also provided:\n\n-- Method: peek (size=-1)\n\nReturn buffered data without advancing the file position.  At\nleast one byte of data will be returned, unless EOF has been\nreached.  The exact number of bytes returned is unspecified\n(the 'size' argument is ignored).\n\nNote: While calling *note peek(): 2684. does not change\nthe file position of the *note LZMAFile: e80, it may\nchange the position of the underlying file object (e.g.\nif the *note LZMAFile: e80. was constructed by passing a\nfile object for 'filename').\n\nChanged in version 3.4: Added support for the '\"x\"' and '\"xb\"'\nmodes.\n\nChanged in version 3.5: The *note read(): 11a0. method now accepts\nan argument of 'None'.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\nFile: python3.12.info,  Node: Compressing and decompressing data in memory,  Next: Miscellaneous<2>,  Prev: Reading and writing compressed files,  Up: lzma -- Compression using the LZMA algorithm\n\n5.13.4.2 Compressing and decompressing data in memory\n.....................................................\n\n-- Class: lzma.LZMACompressor (format=FORMATXZ, check=-1, preset=None,\nfilters=None)\n\nCreate a compressor object, which can be used to compress data\nincrementally.\n\nFor a more convenient way of compressing a single chunk of data,\nsee *note compress(): 2686.\n\nThe 'format' argument specifies what container format should be\nused.  Possible values are:\n\n*\n'FORMATXZ': The '.xz' container format.\n\nThis is the default format.\n\n*\n'FORMATALONE': The legacy '.lzma' container format.\n\nThis format is more limited than '.xz' - it does not\nsupport integrity checks or multiple filters.\n\n*\n'FORMATRAW': A raw data stream, not using any container format.\n\nThis format specifier does not support integrity checks,\nand requires that you always specify a custom filter\nchain (for both compression and decompression).\nAdditionally, data compressed in this manner cannot be\ndecompressed using 'FORMATAUTO' (see *note\nLZMADecompressor: 14a9.).\n\nThe 'check' argument specifies the type of integrity check to\ninclude in the compressed data.  This check is used when\ndecompressing, to ensure that the data has not been corrupted.\nPossible values are:\n\n* 'CHECKNONE': No integrity check.  This is the default (and\nthe only acceptable value) for 'FORMATALONE' and\n'FORMATRAW'.\n\n* 'CHECKCRC32': 32-bit Cyclic Redundancy Check.\n\n* 'CHECKCRC64': 64-bit Cyclic Redundancy Check.  This is the\ndefault for 'FORMATXZ'.\n\n* 'CHECKSHA256': 256-bit Secure Hash Algorithm.\n\nIf the specified check is not supported, an *note LZMAError: 2681.\nis raised.\n\nThe compression settings can be specified either as a preset\ncompression level (with the 'preset' argument), or in detail as a\ncustom filter chain (with the 'filters' argument).\n\nThe 'preset' argument (if provided) should be an integer between\n'0' and '9' (inclusive), optionally OR-ed with the constant\n'PRESETEXTREME'.  If neither 'preset' nor 'filters' are given, the\ndefault behavior is to use 'PRESETDEFAULT' (preset level '6').\nHigher presets produce smaller output, but make the compression\nprocess slower.\n\nNote: In addition to being more CPU-intensive, compression\nwith higher presets also requires much more memory (and\nproduces output that needs more memory to decompress).  With\npreset '9' for example, the overhead for an *note\nLZMACompressor: 14ab. object can be as high as 800 MiB. For\nthis reason, it is generally best to stick with the default\npreset.\n\nThe 'filters' argument (if provided) should be a filter chain\nspecifier.  See *note Specifying custom filter chains: 2687. for\ndetails.\n\n-- Method: compress (data)\n\nCompress 'data' (a *note bytes: 295. object), returning a\n*note bytes: 295. object containing compressed data for at\nleast part of the input.  Some of 'data' may be buffered\ninternally, for use in later calls to *note compress(): 2686.\nand *note flush(): 2689.  The returned data should be\nconcatenated with the output of any previous calls to *note\ncompress(): 2686.\n\n-- Method: flush ()\n\nFinish the compression process, returning a *note bytes: 295.\nobject containing any data stored in the compressor's internal\nbuffers.\n\nThe compressor cannot be used after this method has been\ncalled.\n\n-- Class: lzma.LZMADecompressor (format=FORMATAUTO, memlimit=None,\nfilters=None)\n\nCreate a decompressor object, which can be used to decompress data\nincrementally.\n\nFor a more convenient way of decompressing an entire compressed\nstream at once, see *note decompress(): 268a.\n\nThe 'format' argument specifies the container format that should be\nused.  The default is 'FORMATAUTO', which can decompress both\n'.xz' and '.lzma' files.  Other possible values are 'FORMATXZ',\n'FORMATALONE', and 'FORMATRAW'.\n\nThe 'memlimit' argument specifies a limit (in bytes) on the amount\nof memory that the decompressor can use.  When this argument is\nused, decompression will fail with an *note LZMAError: 2681. if it\nis not possible to decompress the input within the given memory\nlimit.\n\nThe 'filters' argument specifies the filter chain that was used to\ncreate the stream being decompressed.  This argument is required if\n'format' is 'FORMATRAW', but should not be used for other formats.\nSee *note Specifying custom filter chains: 2687. for more\ninformation about filter chains.\n\nNote: This class does not transparently handle inputs\ncontaining multiple compressed streams, unlike *note\ndecompress(): 268a. and *note LZMAFile: e80.  To decompress a\nmulti-stream input with *note LZMADecompressor: 14a9, you must\ncreate a new decompressor for each stream.\n\n-- Method: decompress (data, maxlength=-1)\n\nDecompress 'data' (a *note bytes-like object: b82.), returning\nuncompressed data as bytes.  Some of 'data' may be buffered\ninternally, for use in later calls to *note decompress():\n268a.  The returned data should be concatenated with the\noutput of any previous calls to *note decompress(): 268a.\n\nIf 'maxlength' is nonnegative, returns at most 'maxlength'\nbytes of decompressed data.  If this limit is reached and\nfurther output can be produced, the *note needsinput: 268b.\nattribute will be set to 'False'.  In this case, the next call\nto *note decompress(): c8d. may provide 'data' as 'b''' to\nobtain more of the output.\n\nIf all of the input data was decompressed and returned (either\nbecause this was less than 'maxlength' bytes, or because\n'maxlength' was negative), the *note needsinput: 268b.\nattribute will be set to 'True'.\n\nAttempting to decompress data after the end of stream is\nreached raises an *note EOFError: 114e.  Any data found after\nthe end of the stream is ignored and saved in the *note\nunuseddata: 268c. attribute.\n\nChanged in version 3.5: Added the 'maxlength' parameter.\n\n-- Attribute: check\n\nThe ID of the integrity check used by the input stream.  This\nmay be 'CHECKUNKNOWN' until enough of the input has been\ndecoded to determine what integrity check it uses.\n\n-- Attribute: eof\n\n'True' if the end-of-stream marker has been reached.\n\n-- Attribute: unuseddata\n\nData found after the end of the compressed stream.\n\nBefore the end of the stream is reached, this will be 'b\"\"'.\n\n-- Attribute: needsinput\n\n'False' if the *note decompress(): c8d. method can provide\nmore decompressed data before requiring new uncompressed\ninput.\n\nNew in version 3.5.\n\n-- Function: lzma.compress (data, format=FORMATXZ, check=-1,\npreset=None, filters=None)\n\nCompress 'data' (a *note bytes: 295. object), returning the\ncompressed data as a *note bytes: 295. object.\n\nSee *note LZMACompressor: 14ab. above for a description of the\n'format', 'check', 'preset' and 'filters' arguments.\n\n-- Function: lzma.decompress (data, format=FORMATAUTO, memlimit=None,\nfilters=None)\n\nDecompress 'data' (a *note bytes: 295. object), returning the\nuncompressed data as a *note bytes: 295. object.\n\nIf 'data' is the concatenation of multiple distinct compressed\nstreams, decompress all of these streams, and return the\nconcatenation of the results.\n\nSee *note LZMADecompressor: 14a9. above for a description of the\n'format', 'memlimit' and 'filters' arguments.\n\nFile: python3.12.info,  Node: Miscellaneous<2>,  Next: Specifying custom filter chains,  Prev: Compressing and decompressing data in memory,  Up: lzma -- Compression using the LZMA algorithm\n\n5.13.4.3 Miscellaneous\n......................\n\n-- Function: lzma.ischecksupported (check)\n\nReturn 'True' if the given integrity check is supported on this\nsystem.\n\n'CHECKNONE' and 'CHECKCRC32' are always supported.  'CHECKCRC64'\nand 'CHECKSHA256' may be unavailable if you are using a version of\n'liblzma' that was compiled with a limited feature set.\n\nFile: python3.12.info,  Node: Specifying custom filter chains,  Next: Examples<7>,  Prev: Miscellaneous<2>,  Up: lzma -- Compression using the LZMA algorithm\n\n5.13.4.4 Specifying custom filter chains\n........................................\n\nA filter chain specifier is a sequence of dictionaries, where each\ndictionary contains the ID and options for a single filter.  Each\ndictionary must contain the key '\"id\"', and may contain additional keys\nto specify filter-dependent options.  Valid filter IDs are as follows:\n\n* Compression filters:\n\n* 'FILTERLZMA1' (for use with 'FORMATALONE')\n\n* 'FILTERLZMA2' (for use with 'FORMATXZ' and 'FORMATRAW')\n\n* Delta filter:\n\n* 'FILTERDELTA'\n\n* Branch-Call-Jump (BCJ) filters:\n\n* 'FILTERX86'\n\n* 'FILTERIA64'\n\n* 'FILTERARM'\n\n* 'FILTERARMTHUMB'\n\n* 'FILTERPOWERPC'\n\n* 'FILTERSPARC'\n\nA filter chain can consist of up to 4 filters, and cannot be empty.  The\nlast filter in the chain must be a compression filter, and any other\nfilters must be delta or BCJ filters.\n",
            "subsections": []
        },
        "Compression filters support the following options (specified as": {
            "content": "additional entries in the dictionary representing the filter):\n\n* 'preset': A compression preset to use as a source of default values\nfor options that are not specified explicitly.\n\n* 'dictsize': Dictionary size in bytes.  This should be between 4\nKiB and 1.5 GiB (inclusive).\n\n* 'lc': Number of literal context bits.\n\n* 'lp': Number of literal position bits.  The sum 'lc + lp' must be\nat most 4.\n\n* 'pb': Number of position bits; must be at most 4.\n\n* 'mode': 'MODEFAST' or 'MODENORMAL'.\n\n* 'nicelen': What should be considered a \"nice length\" for a match.\nThis should be 273 or less.\n\n* 'mf': What match finder to use - 'MFHC3', 'MFHC4', 'MFBT2',\n'MFBT3', or 'MFBT4'.\n\n* 'depth': Maximum search depth used by match finder.  0 (default)\nmeans to select automatically based on other filter options.\n",
            "subsections": []
        },
        "The delta filter stores the differences between bytes, producing more": {
            "content": "repetitive input for the compressor in certain circumstances.  It\nsupports one option, 'dist'.  This indicates the distance between bytes\nto be subtracted.  The default is 1, i.e.  take the differences between\nadjacent bytes.\n",
            "subsections": []
        },
        "The BCJ filters are intended to be applied to machine code.  They": {
            "content": "convert relative branches, calls and jumps in the code to use absolute\naddressing, with the aim of increasing the redundancy that can be\nexploited by the compressor.  These filters support one option,\n'startoffset'.  This specifies the address that should be mapped to the\nbeginning of the input data.  The default is 0.\n\nFile: python3.12.info,  Node: Examples<7>,  Prev: Specifying custom filter chains,  Up: lzma -- Compression using the LZMA algorithm\n\n5.13.4.5 Examples\n.................\n\nReading in a compressed file:\n\nimport lzma\nwith lzma.open(\"file.xz\") as f:\nfilecontent = f.read()\n\nCreating a compressed file:\n\nimport lzma\ndata = b\"Insert Data Here\"\nwith lzma.open(\"file.xz\", \"w\") as f:\nf.write(data)\n\nCompressing data in memory:\n\nimport lzma\ndatain = b\"Insert Data Here\"\ndataout = lzma.compress(datain)\n\nIncremental compression:\n\nimport lzma\nlzc = lzma.LZMACompressor()\nout1 = lzc.compress(b\"Some data\\n\")\nout2 = lzc.compress(b\"Another piece of data\\n\")\nout3 = lzc.compress(b\"Even more data\\n\")\nout4 = lzc.flush()\n# Concatenate all the partial results:\nresult = b\"\".join([out1, out2, out3, out4])\n\nWriting compressed data to an already-open file:\n\nimport lzma\nwith open(\"file.xz\", \"wb\") as f:\nf.write(b\"This data will not be compressed\\n\")\nwith lzma.open(f, \"w\") as lzf:\nlzf.write(b\"This *will* be compressed\\n\")\nf.write(b\"Not compressed\\n\")\n\nCreating a compressed file using a custom filter chain:\n\nimport lzma\nmyfilters = [\n{\"id\": lzma.FILTERDELTA, \"dist\": 5},\n{\"id\": lzma.FILTERLZMA2, \"preset\": 7 | lzma.PRESETEXTREME},\n]\nwith lzma.open(\"file.xz\", \"w\", filters=myfilters) as f:\nf.write(b\"blah blah blah\")\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: zipfile -- Work with ZIP archives,  Next: tarfile -- Read and write tar archive files,  Prev: lzma -- Compression using the LZMA algorithm,  Up: Data Compression and Archiving": {
            "content": "'Source code:' Lib/zipfile/(1)\n\n\n",
            "subsections": []
        },
        "The ZIP file format is a common archive and compression standard.  This": {
            "content": "module provides tools to create, read, write, append, and list a ZIP\nfile.  Any advanced use of this module will require an understanding of\nthe format, as defined in PKZIP Application Note(2).\n",
            "subsections": []
        },
        "This module does not currently handle multi-disk ZIP files.  It can": {
            "content": "handle ZIP files that use the ZIP64 extensions (that is ZIP files that\nare more than 4 GiB in size).  It supports decryption of encrypted files\nin ZIP archives, but it currently cannot create an encrypted file.",
            "subsections": []
        },
        "Decryption is extremely slow as it is implemented in native Python": {
            "content": "rather than C.\n\nThe module defines the following items:\n\n-- Exception: zipfile.BadZipFile\n\nThe error raised for bad ZIP files.\n\nNew in version 3.2.\n\n-- Exception: zipfile.BadZipfile\n\nAlias of *note BadZipFile: 153b, for compatibility with older\nPython versions.\n\nDeprecated since version 3.2.\n\n-- Exception: zipfile.LargeZipFile\n\nThe error raised when a ZIP file would require ZIP64 functionality\nbut that has not been enabled.\n\n-- Class: zipfile.ZipFile\n\nThe class for reading and writing ZIP files.  See section *note\nZipFile Objects: 2697. for constructor details.\n\n-- Class: zipfile.Path\n\nClass that implements a subset of the interface provided by *note\npathlib.Path: 149, including the full *note\nimportlib.resources.abc.Traversable: 229. interface.\n\nNew in version 3.8.\n\n-- Class: zipfile.PyZipFile\n\nClass for creating ZIP archives containing Python libraries.\n\n-- Class: zipfile.ZipInfo (filename='NoName', datetime=(1980, 1, 1, 0,\n0, 0))\n\nClass used to represent information about a member of an archive.\nInstances of this class are returned by the *note getinfo(): 2698.\nand *note infolist(): 2699. methods of *note ZipFile: 494. objects.\nMost users of the *note zipfile: 12b. module will not need to\ncreate these, but only use those created by this module.\n'filename' should be the full name of the archive member, and\n'datetime' should be a tuple containing six fields which describe\nthe time of the last modification to the file; the fields are\ndescribed in section *note ZipInfo Objects: 269a.\n\n-- Function: zipfile.iszipfile (filename)\n\nReturns 'True' if 'filename' is a valid ZIP file based on its magic\nnumber, otherwise returns 'False'.  'filename' may be a file or\nfile-like object too.\n\nChanged in version 3.1: Support for file and file-like objects.\n\n-- Data: zipfile.ZIPSTORED\n\nThe numeric constant for an uncompressed archive member.\n\n-- Data: zipfile.ZIPDEFLATED\n\nThe numeric constant for the usual ZIP compression method.  This\nrequires the *note zlib: 12d. module.\n\n-- Data: zipfile.ZIPBZIP2\n\nThe numeric constant for the BZIP2 compression method.  This\nrequires the *note bz2: 11. module.\n\nNew in version 3.3.\n\n-- Data: zipfile.ZIPLZMA\n\nThe numeric constant for the LZMA compression method.  This\nrequires the *note lzma: 85. module.\n\nNew in version 3.3.\n\nNote: The ZIP file format specification has included support\nfor bzip2 compression since 2001, and for LZMA compression\nsince 2006.  However, some tools (including older Python\nreleases) do not support these compression methods, and may\neither refuse to process the ZIP file altogether, or fail to\nextract individual files.\n\nSee also\n........\n\nPKZIP Application Note(3)\n\nDocumentation on the ZIP file format by Phil Katz, the creator of\nthe format and algorithms used.\n",
            "subsections": []
        },
        "Info-ZIP Home Page(4)": {
            "content": "Information about the Info-ZIP project's ZIP archive programs and\ndevelopment libraries.\n\n* Menu:\n\n* ZipFile Objects::\n* Path Objects::\n* PyZipFile Objects::\n* ZipInfo Objects::\n* Command-Line Interface::\n* Decompression pitfalls::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/zipfile/\n\n(2) https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT\n\n(3) https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT\n\n(4) https://infozip.sourceforge.net/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ZipFile Objects,  Next: Path Objects,  Up: zipfile -- Work with ZIP archives": {
            "content": "5.13.5.1 ZipFile Objects\n........................\n\n-- Class: zipfile.ZipFile (file, mode='r', compression=ZIPSTORED,\nallowZip64=True, compresslevel=None, *,\nstricttimestamps=True, metadataencoding=None)\n\nOpen a ZIP file, where 'file' can be a path to a file (a string), a\nfile-like object or a *note path-like object: 957.\n\nThe 'mode' parameter should be ''r'' to read an existing file,\n''w'' to truncate and write a new file, ''a'' to append to an\nexisting file, or ''x'' to exclusively create and write a new file.\nIf 'mode' is ''x'' and 'file' refers to an existing file, a *note\nFileExistsError: e97. will be raised.  If 'mode' is ''a'' and\n'file' refers to an existing ZIP file, then additional files are\nadded to it.  If 'file' does not refer to a ZIP file, then a new\nZIP archive is appended to the file.  This is meant for adding a\nZIP archive to another file (such as 'python.exe').  If 'mode' is\n''a'' and the file does not exist at all, it is created.  If 'mode'\nis ''r'' or ''a'', the file should be seekable.\n\n'compression' is the ZIP compression method to use when writing the\narchive, and should be *note ZIPSTORED: 269b, *note ZIPDEFLATED:\n269c, *note ZIPBZIP2: 269d. or *note ZIPLZMA: 269e.; unrecognized\nvalues will cause *note NotImplementedError: ba5. to be raised.  If\n*note ZIPDEFLATED: 269c, *note ZIPBZIP2: 269d. or *note ZIPLZMA:\n269e. is specified but the corresponding module (*note zlib: 12d,\n*note bz2: 11. or *note lzma: 85.) is not available, *note\nRuntimeError: 17a. is raised.  The default is *note ZIPSTORED:\n269b.\n\nIf 'allowZip64' is 'True' (the default) zipfile will create ZIP\nfiles that use the ZIP64 extensions when the zipfile is larger than\n4 GiB. If it is 'false' *note zipfile: 12b. will raise an exception\nwhen the ZIP file would require ZIP64 extensions.\n\nThe 'compresslevel' parameter controls the compression level to use\nwhen writing files to the archive.  When using *note ZIPSTORED:\n269b. or *note ZIPLZMA: 269e. it has no effect.  When using *note\nZIPDEFLATED: 269c. integers '0' through '9' are accepted (see\n*note zlib: 264c. for more information).  When using *note\nZIPBZIP2: 269d. integers '1' through '9' are accepted (see *note\nbz2: 775. for more information).\n\nThe 'stricttimestamps' argument, when set to 'False', allows to\nzip files older than 1980-01-01 at the cost of setting the\ntimestamp to 1980-01-01.  Similar behavior occurs with files newer\nthan 2107-12-31, the timestamp is also set to the limit.\n\nWhen mode is ''r'', 'metadataencoding' may be set to the name of a\ncodec, which will be used to decode metadata such as the names of\nmembers and ZIP comments.\n\nIf the file is created with mode ''w'', ''x'' or ''a'' and then\n*note closed: 26a0. without adding any files to the archive, the\nappropriate ZIP structures for an empty archive will be written to\nthe file.\n\nZipFile is also a context manager and therefore supports the *note\nwith: 396. statement.  In the example, 'myzip' is closed after the\n'with' statement's suite is finished--even if an exception occurs:\n\nwith ZipFile('spam.zip', 'w') as myzip:\nmyzip.write('eggs.txt')\n\nNote: 'metadataencoding' is an instance-wide setting for the\nZipFile.  It is not currently possible to set this on a\nper-member basis.\n\nThis attribute is a workaround for legacy implementations\nwhich produce archives with names in the current locale\nencoding or code page (mostly on Windows).  According to the\n.ZIP standard, the encoding of metadata may be specified to be\neither IBM code page (default) or UTF-8 by a flag in the\narchive header.  That flag takes precedence over\n'metadataencoding', which is a Python-specific extension.\n\nChanged in version 3.2: Added the ability to use *note ZipFile:\n494. as a context manager.\n\nChanged in version 3.3: Added support for *note bzip2: 11. and\n*note lzma: 85. compression.\n\nChanged in version 3.4: ZIP64 extensions are enabled by default.\n\nChanged in version 3.5: Added support for writing to unseekable\nstreams.  Added support for the ''x'' mode.\n\nChanged in version 3.6: Previously, a plain *note RuntimeError:\n17a. was raised for unrecognized compression values.\n\nChanged in version 3.6.2: The 'file' parameter accepts a *note\npath-like object: 957.\n\nChanged in version 3.7: Add the 'compresslevel' parameter.\n\nChanged in version 3.8: The 'stricttimestamps' keyword-only\nparameter.\n\nChanged in version 3.11: Added support for specifying member name\nencoding for reading metadata in the zipfile's directory and file\nheaders.\n\n-- Method: ZipFile.close ()\n\nClose the archive file.  You must call *note close(): 26a0. before\nexiting your program or essential records will not be written.\n\n-- Method: ZipFile.getinfo (name)\n\nReturn a *note ZipInfo: b5a. object with information about the\narchive member 'name'.  Calling *note getinfo(): 2698. for a name\nnot currently contained in the archive will raise a *note KeyError:\n8cf.\n\n-- Method: ZipFile.infolist ()\n\nReturn a list containing a *note ZipInfo: b5a. object for each\nmember of the archive.  The objects are in the same order as their\nentries in the actual ZIP file on disk if an existing archive was\nopened.\n\n-- Method: ZipFile.namelist ()\n\nReturn a list of archive members by name.\n\n-- Method: ZipFile.open (name, mode='r', pwd=None, *,\nforcezip64=False)\n\nAccess a member of the archive as a binary file-like object.\n'name' can be either the name of a file within the archive or a\n*note ZipInfo: b5a. object.  The 'mode' parameter, if included,\nmust be ''r'' (the default) or ''w''.  'pwd' is the password used\nto decrypt encrypted ZIP files as a *note bytes: 295. object.\n\n*note open(): b5c. is also a context manager and therefore supports\nthe *note with: 396. statement:\n\nwith ZipFile('spam.zip') as myzip:\nwith myzip.open('eggs.txt') as myfile:\nprint(myfile.read())\n\nWith 'mode' ''r'' the file-like object ('ZipExtFile') is read-only\nand provides the following methods: *note read(): 11a0, *note\nreadline(): 11a1, *note readlines(): 2040, *note seek(): 1105,\n*note tell(): 26a2, *note iter(): 1a45, *note next(): 1141.\nThese objects can operate independently of the ZipFile.\n\nWith 'mode='w'', a writable file handle is returned, which supports\nthe *note write(): b2a. method.  While a writable file handle is\nopen, attempting to read or write other files in the ZIP file will\nraise a *note ValueError: 183.\n\nWhen writing a file, if the file size is not known in advance but\nmay exceed 2 GiB, pass 'forcezip64=True' to ensure that the header\nformat is capable of supporting large files.  If the file size is\nknown in advance, construct a *note ZipInfo: b5a. object with *note\nfilesize: 26a3. set, and use that as the 'name' parameter.\n\nNote: The *note open(): b5c, *note read(): 26a4. and *note\nextract(): 26a5. methods can take a filename or a *note\nZipInfo: b5a. object.  You will appreciate this when trying to\nread a ZIP file that contains members with duplicate names.\n\nChanged in version 3.6: Removed support of 'mode='U''.  Use *note\nio.TextIOWrapper: b8f. for reading compressed text files in *note\nuniversal newlines: b90. mode.\n\nChanged in version 3.6: *note ZipFile.open(): b5c. can now be used\nto write files into the archive with the 'mode='w'' option.\n\nChanged in version 3.6: Calling *note open(): b5c. on a closed\nZipFile will raise a *note ValueError: 183.  Previously, a *note\nRuntimeError: 17a. was raised.\n\n-- Method: ZipFile.extract (member, path=None, pwd=None)\n\nExtract a member from the archive to the current working directory;\n'member' must be its full name or a *note ZipInfo: b5a. object.\nIts file information is extracted as accurately as possible.\n'path' specifies a different directory to extract to.  'member' can\nbe a filename or a *note ZipInfo: b5a. object.  'pwd' is the\npassword used for encrypted files as a *note bytes: 295. object.\n\nReturns the normalized path created (a directory or new file).\n\nNote: If a member filename is an absolute path, a drive/UNC\nsharepoint and leading (back)slashes will be stripped, e.g.:\n'///foo/bar' becomes 'foo/bar' on Unix, and 'C:\\foo\\bar'\nbecomes 'foo\\bar' on Windows.  And all '\"..\"' components in a\nmember filename will be removed, e.g.: '../../foo../../ba..r'\nbecomes 'foo../ba..r'.  On Windows illegal characters (':',\n'<', '>', '|', '\"', '?', and '*') replaced by underscore\n('').\n\nChanged in version 3.6: Calling *note extract(): 26a5. on a closed\nZipFile will raise a *note ValueError: 183.  Previously, a *note\nRuntimeError: 17a. was raised.\n\nChanged in version 3.6.2: The 'path' parameter accepts a *note\npath-like object: 957.\n\n-- Method: ZipFile.extractall (path=None, members=None, pwd=None)\n\nExtract all members from the archive to the current working\ndirectory.  'path' specifies a different directory to extract to.\n'members' is optional and must be a subset of the list returned by\n*note namelist(): 26a1.  'pwd' is the password used for encrypted\nfiles as a *note bytes: 295. object.\n\nWarning: Never extract archives from untrusted sources without\nprior inspection.  It is possible that files are created\noutside of 'path', e.g.  members that have absolute filenames\nstarting with '\"/\"' or filenames with two dots '\"..\"'.  This\nmodule attempts to prevent that.  See *note extract(): 26a5.\nnote.\n\nChanged in version 3.6: Calling *note extractall(): 26a6. on a\nclosed ZipFile will raise a *note ValueError: 183.  Previously, a\n*note RuntimeError: 17a. was raised.\n\nChanged in version 3.6.2: The 'path' parameter accepts a *note\npath-like object: 957.\n\n-- Method: ZipFile.printdir ()\n\nPrint a table of contents for the archive to 'sys.stdout'.\n\n-- Method: ZipFile.setpassword (pwd)\n\nSet 'pwd' (a *note bytes: 295. object) as default password to\nextract encrypted files.\n\n-- Method: ZipFile.read (name, pwd=None)\n\nReturn the bytes of the file 'name' in the archive.  'name' is the\nname of the file in the archive, or a *note ZipInfo: b5a. object.\nThe archive must be open for read or append.  'pwd' is the password\nused for encrypted files as a *note bytes: 295. object and, if\nspecified, overrides the default password set with *note\nsetpassword(): 26a8.  Calling *note read(): 26a4. on a ZipFile that\nuses a compression method other than *note ZIPSTORED: 269b, *note\nZIPDEFLATED: 269c, *note ZIPBZIP2: 269d. or *note ZIPLZMA: 269e.\nwill raise a *note NotImplementedError: ba5.  An error will also be\nraised if the corresponding compression module is not available.\n\nChanged in version 3.6: Calling *note read(): 26a4. on a closed\nZipFile will raise a *note ValueError: 183.  Previously, a *note\nRuntimeError: 17a. was raised.\n\n-- Method: ZipFile.testzip ()\n\nRead all the files in the archive and check their CRC's and file\nheaders.  Return the name of the first bad file, or else return\n'None'.\n\nChanged in version 3.6: Calling *note testzip(): 26a9. on a closed\nZipFile will raise a *note ValueError: 183.  Previously, a *note\nRuntimeError: 17a. was raised.\n\n-- Method: ZipFile.write (filename, arcname=None, compresstype=None,\ncompresslevel=None)\n\nWrite the file named 'filename' to the archive, giving it the\narchive name 'arcname' (by default, this will be the same as\n'filename', but without a drive letter and with leading path\nseparators removed).  If given, 'compresstype' overrides the value\ngiven for the 'compression' parameter to the constructor for the\nnew entry.  Similarly, 'compresslevel' will override the\nconstructor if given.  The archive must be open with mode ''w'',\n''x'' or ''a''.\n\nNote: The ZIP file standard historically did not specify a\nmetadata encoding, but strongly recommended CP437 (the\noriginal IBM PC encoding) for interoperability.  Recent\nversions allow use of UTF-8 (only).  In this module, UTF-8\nwill automatically be used to write the member names if they\ncontain any non-ASCII characters.  It is not possible to write\nmember names in any encoding other than ASCII or UTF-8.\n\nNote: Archive names should be relative to the archive root,\nthat is, they should not start with a path separator.\n\nNote: If 'arcname' (or 'filename', if 'arcname' is not given)\ncontains a null byte, the name of the file in the archive will\nbe truncated at the null byte.\n\nNote: A leading slash in the filename may lead to the archive\nbeing impossible to open in some zip programs on Windows\nsystems.\n\nChanged in version 3.6: Calling *note write(): ba6. on a ZipFile\ncreated with mode ''r'' or a closed ZipFile will raise a *note\nValueError: 183.  Previously, a *note RuntimeError: 17a. was\nraised.\n\n-- Method: ZipFile.writestr (zinfoorarcname, data,\ncompresstype=None, compresslevel=None)\n\nWrite a file into the archive.  The contents is 'data', which may\nbe either a *note str: 157. or a *note bytes: 295. instance; if it\nis a *note str: 157, it is encoded as UTF-8 first.\n'zinfoorarcname' is either the file name it will be given in the\narchive, or a *note ZipInfo: b5a. instance.  If it's an instance,\nat least the filename, date, and time must be given.  If it's a\nname, the date and time is set to the current date and time.  The\narchive must be opened with mode ''w'', ''x'' or ''a''.\n\nIf given, 'compresstype' overrides the value given for the\n'compression' parameter to the constructor for the new entry, or in\nthe 'zinfoorarcname' (if that is a *note ZipInfo: b5a. instance).\nSimilarly, 'compresslevel' will override the constructor if given.\n\nNote: When passing a *note ZipInfo: b5a. instance as the\n'zinfoorarcname' parameter, the compression method used will\nbe that specified in the 'compresstype' member of the given\n*note ZipInfo: b5a. instance.  By default, the *note ZipInfo:\nb5a. constructor sets this member to *note ZIPSTORED: 269b.\n\nChanged in version 3.2: The 'compresstype' argument.\n\nChanged in version 3.6: Calling *note writestr(): 11a3. on a\nZipFile created with mode ''r'' or a closed ZipFile will raise a\n*note ValueError: 183.  Previously, a *note RuntimeError: 17a. was\nraised.\n\n-- Method: ZipFile.mkdir (zinfoordirectory, mode=511)\n\nCreate a directory inside the archive.  If 'zinfoordirectory' is\na string, a directory is created inside the archive with the mode\nthat is specified in the 'mode' argument.  If, however,\n'zinfoordirectory' is a *note ZipInfo: b5a. instance then the\n'mode' argument is ignored.\n\nThe archive must be opened with mode ''w'', ''x'' or ''a''.\n\nNew in version 3.11.\n\nThe following data attributes are also available:\n\n-- Attribute: ZipFile.filename\n\nName of the ZIP file.\n\n-- Attribute: ZipFile.debug\n\nThe level of debug output to use.  This may be set from '0' (the\ndefault, no output) to '3' (the most output).  Debugging\ninformation is written to 'sys.stdout'.\n\n-- Attribute: ZipFile.comment\n\nThe comment associated with the ZIP file as a *note bytes: 295.\nobject.  If assigning a comment to a *note ZipFile: 494. instance\ncreated with mode ''w'', ''x'' or ''a'', it should be no longer\nthan 65535 bytes.  Comments longer than this will be truncated.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Path Objects,  Next: PyZipFile Objects,  Prev: ZipFile Objects,  Up: zipfile -- Work with ZIP archives": {
            "content": "5.13.5.2 Path Objects\n.....................\n\n-- Class: zipfile.Path (root, at='')\n\nConstruct a Path object from a 'root' zipfile (which may be a *note\nZipFile: 494. instance or 'file' suitable for passing to the *note\nZipFile: 494. constructor).\n\n'at' specifies the location of this Path within the zipfile, e.g.\n'dir/file.txt', 'dir/', or ''.  Defaults to the empty string,\nindicating the root.\n\nPath objects expose the following features of *note pathlib.Path: 149.\nobjects:\n\nPath objects are traversable using the '/' operator or 'joinpath'.\n\n-- Attribute: Path.name\n\nThe final path component.\n\n-- Method: Path.open (mode='r', *, pwd, )\n\nInvoke *note ZipFile.open(): b5c. on the current path.  Allows\nopening for read or write, text or binary through supported modes:\n'r', 'w', 'rb', 'wb'.  Positional and keyword arguments are passed\nthrough to *note io.TextIOWrapper: b8f. when opened as text and\nignored otherwise.  'pwd' is the 'pwd' parameter to *note\nZipFile.open(): b5c.\n\nChanged in version 3.9: Added support for text and binary modes for\nopen.  Default mode is now text.\n\nChanged in version 3.11.2: The 'encoding' parameter can be supplied\nas a positional argument without causing a *note TypeError: 28e.\nAs it could in 3.9.  Code needing to be compatible with unpatched\n3.10 and 3.11 versions must pass all *note io.TextIOWrapper: b8f.\narguments, 'encoding' included, as keywords.\n\n-- Method: Path.iterdir ()\n\nEnumerate the children of the current directory.\n\n-- Method: Path.isdir ()\n\nReturn 'True' if the current context references a directory.\n\n-- Method: Path.isfile ()\n\nReturn 'True' if the current context references a file.\n\n-- Method: Path.exists ()\n\nReturn 'True' if the current context references a file or directory\nin the zip file.\n\n-- Data: Path.suffix\n\nThe file extension of the final component.\n\nNew in version 3.11: Added *note Path.suffix: 497. property.\n\n-- Data: Path.stem\n\nThe final path component, without its suffix.\n\nNew in version 3.11: Added *note Path.stem: 496. property.\n\n-- Data: Path.suffixes\n\nA list of the path's file extensions.\n\nNew in version 3.11: Added *note Path.suffixes: 498. property.\n\n-- Method: Path.readtext (*, )\n\nRead the current file as unicode text.  Positional and keyword\narguments are passed through to *note io.TextIOWrapper: b8f.\n(except 'buffer', which is implied by the context).\n\nChanged in version 3.11.2: The 'encoding' parameter can be supplied\nas a positional argument without causing a *note TypeError: 28e.\nAs it could in 3.9.  Code needing to be compatible with unpatched\n3.10 and 3.11 versions must pass all *note io.TextIOWrapper: b8f.\narguments, 'encoding' included, as keywords.\n\n-- Method: Path.readbytes ()\n\nRead the current file as bytes.\n\n-- Method: Path.joinpath (*other)\n\nReturn a new Path object with each of the 'other' arguments joined.\nThe following are equivalent:\n\n>>> Path(...).joinpath('child').joinpath('grandchild')\n>>> Path(...).joinpath('child', 'grandchild')\n>>> Path(...) / 'child' / 'grandchild'\n\nChanged in version 3.10: Prior to 3.10, 'joinpath' was undocumented\nand accepted exactly one parameter.\n",
            "subsections": []
        },
        "The zipp(1) project provides backports of the latest path object": {
            "content": "functionality to older Pythons.  Use 'zipp.Path' in place of\n'zipfile.Path' for early access to changes.\n\n---------- Footnotes ----------\n\n(1) https://pypi.org/project/zipp\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: PyZipFile Objects,  Next: ZipInfo Objects,  Prev: Path Objects,  Up: zipfile -- Work with ZIP archives": {
            "content": "5.13.5.3 PyZipFile Objects\n..........................\n\nThe *note PyZipFile: e6d. constructor takes the same parameters as the\n*note ZipFile: 494. constructor, and one additional parameter,\n'optimize'.\n\n-- Class: zipfile.PyZipFile (file, mode='r', compression=ZIPSTORED,\nallowZip64=True, optimize=-1)\n\nChanged in version 3.2: Added the 'optimize' parameter.\n\nChanged in version 3.4: ZIP64 extensions are enabled by default.\n\nInstances have one method in addition to those of *note ZipFile:\n494. objects:\n\n-- Method: writepy (pathname, basename='', filterfunc=None)\n\nSearch for files '*.py' and add the corresponding file to the\narchive.\n\nIf the 'optimize' parameter to *note PyZipFile: e6d. was not\ngiven or '-1', the corresponding file is a '*.pyc' file,\ncompiling if necessary.\n\nIf the 'optimize' parameter to *note PyZipFile: e6d. was '0',\n'1' or '2', only files with that optimization level (see *note\ncompile(): 528.) are added to the archive, compiling if\nnecessary.\n\nIf 'pathname' is a file, the filename must end with '.py', and\njust the (corresponding '*.pyc') file is added at the top\nlevel (no path information).  If 'pathname' is a file that\ndoes not end with '.py', a *note RuntimeError: 17a. will be\nraised.  If it is a directory, and the directory is not a\npackage directory, then all the files '*.pyc' are added at the\ntop level.  If the directory is a package directory, then all\n'*.pyc' are added under the package name as a file path, and\nif any subdirectories are package directories, all of these\nare added recursively in sorted order.\n\n'basename' is intended for internal use only.\n\n'filterfunc', if given, must be a function taking a single\nstring argument.  It will be passed each path (including each\nindividual full file path) before it is added to the archive.\nIf 'filterfunc' returns a false value, the path will not be\nadded, and if it is a directory its contents will be ignored.\nFor example, if our test files are all either in 'test'\ndirectories or start with the string 'test', we can use a\n'filterfunc' to exclude them:\n\n>>> zf = PyZipFile('myprog.zip')\n>>> def notests(s):\n...     fn = os.path.basename(s)\n...     return (not (fn == 'test' or fn.startswith('test')))\n...\n>>> zf.writepy('myprog', filterfunc=notests)\n\nThe *note writepy(): e6c. method makes archives with file\nnames like this:\n\nstring.pyc                   # Top level name\ntest/init.pyc            # Package directory\ntest/testall.pyc             # Module test.testall\ntest/bogus/init.pyc      # Subpackage directory\ntest/bogus/myfile.pyc        # Submodule test.bogus.myfile\n\nChanged in version 3.4: Added the 'filterfunc' parameter.\n\nChanged in version 3.6.2: The 'pathname' parameter accepts a\n*note path-like object: 957.\n\nChanged in version 3.7: Recursion sorts directory entries.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ZipInfo Objects,  Next: Command-Line Interface,  Prev: PyZipFile Objects,  Up: zipfile -- Work with ZIP archives": {
            "content": "5.13.5.4 ZipInfo Objects\n........................\n\nInstances of the *note ZipInfo: b5a. class are returned by the *note\ngetinfo(): 2698. and *note infolist(): 2699. methods of *note ZipFile:\n494. objects.  Each object stores information about a single member of\nthe ZIP archive.\n\nThere is one classmethod to make a *note ZipInfo: b5a. instance for a\nfilesystem file:\n\n-- Method: classmethod ZipInfo.fromfile (filename, arcname=None, *,\nstricttimestamps=True)\n\nConstruct a *note ZipInfo: b5a. instance for a file on the\nfilesystem, in preparation for adding it to a zip file.\n\n'filename' should be the path to a file or directory on the\nfilesystem.\n\nIf 'arcname' is specified, it is used as the name within the\narchive.  If 'arcname' is not specified, the name will be the same\nas 'filename', but with any drive letter and leading path\nseparators removed.\n\nThe 'stricttimestamps' argument, when set to 'False', allows to\nzip files older than 1980-01-01 at the cost of setting the\ntimestamp to 1980-01-01.  Similar behavior occurs with files newer\nthan 2107-12-31, the timestamp is also set to the limit.\n\nNew in version 3.6.\n\nChanged in version 3.6.2: The 'filename' parameter accepts a *note\npath-like object: 957.\n\nChanged in version 3.8: Added the 'stricttimestamps' keyword-only\nparameter.\n\nInstances have the following methods and attributes:\n\n-- Method: ZipInfo.isdir ()\n\nReturn 'True' if this archive member is a directory.\n\nThis uses the entry's name: directories should always end with '/'.\n\nNew in version 3.6.\n\n-- Attribute: ZipInfo.filename\n\nName of the file in the archive.\n\n-- Attribute: ZipInfo.datetime\n\nThe time and date of the last modification to the archive member.\nThis is a tuple of six values:\n\nIndex       Value\n\n-------------------------------------------\n\n'0'         Year (>= 1980)\n\n\n'1'         Month (one-based)\n\n\n'2'         Day of month (one-based)\n\n\n'3'         Hours (zero-based)\n\n\n'4'         Minutes (zero-based)\n\n\n'5'         Seconds (zero-based)\n\n\nNote: The ZIP file format does not support timestamps before\n1980.\n\n-- Attribute: ZipInfo.compresstype\n\nType of compression for the archive member.\n\n-- Attribute: ZipInfo.comment\n\nComment for the individual archive member as a *note bytes: 295.\nobject.\n\n-- Attribute: ZipInfo.extra\n\nExpansion field data.  The PKZIP Application Note(1) contains some\ncomments on the internal structure of the data contained in this\n*note bytes: 295. object.\n\n-- Attribute: ZipInfo.createsystem\n\nSystem which created ZIP archive.\n\n-- Attribute: ZipInfo.createversion\n\nPKZIP version which created ZIP archive.\n\n-- Attribute: ZipInfo.extractversion\n\nPKZIP version needed to extract archive.\n\n-- Attribute: ZipInfo.reserved\n\nMust be zero.\n\n-- Attribute: ZipInfo.flagbits\n\nZIP flag bits.\n\n-- Attribute: ZipInfo.volume\n\nVolume number of file header.\n\n-- Attribute: ZipInfo.internalattr\n\nInternal attributes.\n\n-- Attribute: ZipInfo.externalattr\n\nExternal file attributes.\n\n-- Attribute: ZipInfo.headeroffset\n\nByte offset to the file header.\n\n-- Attribute: ZipInfo.CRC\n\nCRC-32 of the uncompressed file.\n\n-- Attribute: ZipInfo.compresssize\n\nSize of the compressed data.\n\n-- Attribute: ZipInfo.filesize\n\nSize of the uncompressed file.\n\n---------- Footnotes ----------\n\n(1) https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Command-Line Interface,  Next: Decompression pitfalls,  Prev: ZipInfo Objects,  Up: zipfile -- Work with ZIP archives": {
            "content": "5.13.5.5 Command-Line Interface\n...............................\n\nThe *note zipfile: 12b. module provides a simple command-line interface\nto interact with ZIP archives.\n",
            "subsections": []
        },
        "If you want to create a new ZIP archive, specify its name after the": {
            "content": "*note -c: 26cb. option and then list the filename(s) that should be\nincluded:\n\n$ python -m zipfile -c monty.zip spam.txt eggs.txt\n\nPassing a directory is also acceptable:\n\n$ python -m zipfile -c monty.zip life-of-brian1979/\n",
            "subsections": []
        },
        "If you want to extract a ZIP archive into the specified directory, use": {
            "content": "the *note -e: 26cc. option:\n\n$ python -m zipfile -e monty.zip target-dir/\n\nFor a list of the files in a ZIP archive, use the *note -l: 26cd.\noption:\n\n$ python -m zipfile -l monty.zip\n\n* Menu:\n\n* Command-line options::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Command-line options,  Up: Command-Line Interface": {
            "content": "5.13.5.6 Command-line options\n.............................\n\n-- Option: -l <zipfile>\n-- Option: --list <zipfile>\n\nList files in a zipfile.\n\n-- Option: -c <zipfile> <source1> ... <sourceN>\n-- Option: --create <zipfile> <source1> ... <sourceN>\n\nCreate zipfile from source files.\n\n-- Option: -e <zipfile> <outputdir>\n-- Option: --extract <zipfile> <outputdir>\n\nExtract zipfile into target directory.\n\n-- Option: -t <zipfile>\n-- Option: --test <zipfile>\n\nTest whether the zipfile is valid or not.\n\n-- Option: --metadata-encoding <encoding>\n\nSpecify encoding of member names for *note -l: 26cd, *note -e:\n26cc. and *note -t: 26d2.\n\nNew in version 3.11.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Decompression pitfalls,  Prev: Command-Line Interface,  Up: zipfile -- Work with ZIP archives": {
            "content": "5.13.5.7 Decompression pitfalls\n...............................\n",
            "subsections": []
        },
        "The extraction in zipfile module might fail due to some pitfalls listed": {
            "content": "below.\n\n* Menu:\n\n* From file itself::\n* File System limitations::\n* Resources limitations::\n* Interruption::\n* Default behaviors of extraction::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: From file itself,  Next: File System limitations,  Up: Decompression pitfalls": {
            "content": "5.13.5.8 From file itself\n.........................\n",
            "subsections": []
        },
        "Decompression may fail due to incorrect password / CRC checksum / ZIP": {
            "content": "format or unsupported compression method / decryption.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: File System limitations,  Next: Resources limitations,  Prev: From file itself,  Up: Decompression pitfalls": {
            "content": "5.13.5.9 File System limitations\n................................\n",
            "subsections": []
        },
        "Exceeding limitations on different file systems can cause decompression": {
            "content": "failed.  Such as allowable characters in the directory entries, length\nof the file name, length of the pathname, size of a single file, and\nnumber of files, etc.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Resources limitations,  Next: Interruption,  Prev: File System limitations,  Up: Decompression pitfalls": {
            "content": "5.13.5.10 Resources limitations\n...............................\n\nThe lack of memory or disk volume would lead to decompression failed.",
            "subsections": []
        },
        "For example, decompression bombs (aka ZIP bomb(1)) apply to zipfile": {
            "content": "library that can cause disk volume exhaustion.\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Zipbomb\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Interruption,  Next: Default behaviors of extraction,  Prev: Resources limitations,  Up: Decompression pitfalls": {
            "content": "5.13.5.11 Interruption\n......................\n",
            "subsections": []
        },
        "Interruption during the decompression, such as pressing control-C or": {
            "content": "killing the decompression process may result in incomplete decompression\nof the archive.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Default behaviors of extraction,  Prev: Interruption,  Up: Decompression pitfalls": {
            "content": "5.13.5.12 Default behaviors of extraction\n.........................................\n",
            "subsections": []
        },
        "Not knowing the default extraction behaviors can cause unexpected": {
            "content": "decompression results.  For example, when extracting the same archive\ntwice, it overwrites files without asking.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: tarfile -- Read and write tar archive files,  Prev: zipfile -- Work with ZIP archives,  Up: Data Compression and Archiving": {
            "content": "'Source code:' Lib/tarfile.py(1)\n\n\n\nThe *note tarfile: d8. module makes it possible to read and write tar\narchives, including those using gzip, bz2 and lzma compression.  Use the\n*note zipfile: 12b. module to read or write '.zip' files, or the\nhigher-level functions in *note shutil: 108d.\n\nSome facts and figures:\n\n* reads and writes *note gzip: 62, *note bz2: 11. and *note lzma: 85.\ncompressed archives if the respective modules are available.\n\n* read/write support for the POSIX.1-1988 (ustar) format.\n\n* read/write support for the GNU tar format including 'longname' and\n'longlink' extensions, read-only support for all variants of the\n'sparse' extension including restoration of sparse files.\n\n* read/write support for the POSIX.1-2001 (pax) format.\n\n* handles directories, regular files, hardlinks, symbolic links,\nfifos, character devices and block devices and is able to acquire\nand restore file information like timestamp, access permissions and\nowner.\n\nChanged in version 3.3: Added support for *note lzma: 85. compression.\n\nChanged in version 3.12: Archives are extracted using a *note filter:\n185, which makes it possible to either limit surprising/dangerous\nfeatures, or to acknowledge that they are expected and the archive is\nfully trusted.  By default, archives are fully trusted, but this default\nis deprecated and slated to change in Python 3.14.\n\n-- Function: tarfile.open (name=None, mode='r', fileobj=None,\nbufsize=10240, kwargs)\n\nReturn a *note TarFile: 1084. object for the pathname 'name'.  For\ndetailed information on *note TarFile: 1084. objects and the\nkeyword arguments that are allowed, see *note TarFile Objects:\n26de.\n\n'mode' has to be a string of the form ''filemode[:compression]'',\nit defaults to ''r''.  Here is a full list of mode combinations:\n\nmode                   action\n\n-------------------------------------------------------------------------\n\n''r' or 'r:*''         Open for reading with transparent compression\n(recommended).\n\n\n''r:''                 Open for reading exclusively without\ncompression.\n\n\n''r:gz''               Open for reading with gzip compression.\n\n\n''r:bz2''              Open for reading with bzip2 compression.\n\n\n''r:xz''               Open for reading with lzma compression.\n\n\n''x'' or ''x:''        Create a tarfile exclusively without\ncompression.  Raise a\n*note FileExistsError: e97. exception if it\nalready exists.\n\n\n''x:gz''               Create a tarfile with gzip compression.  Raise\na *note FileExistsError: e97. exception if it\nalready exists.\n\n\n''x:bz2''              Create a tarfile with bzip2 compression.  Raise\na *note FileExistsError: e97. exception if it\nalready exists.\n\n\n''x:xz''               Create a tarfile with lzma compression.  Raise\na *note FileExistsError: e97. exception if it\nalready exists.\n\n\n''a' or 'a:''          Open for appending with no compression.  The\nfile is created if it does not exist.\n\n\n''w' or 'w:''          Open for uncompressed writing.\n\n\n''w:gz''               Open for gzip compressed writing.\n\n\n''w:bz2''              Open for bzip2 compressed writing.\n\n\n''w:xz''               Open for lzma compressed writing.\n\n\nNote that ''a:gz'', ''a:bz2'' or ''a:xz'' is not possible.  If\n'mode' is not suitable to open a certain (compressed) file for\nreading, *note ReadError: 15fc. is raised.  Use 'mode' ''r'' to\navoid this.  If a compression method is not supported, *note\nCompressionError: 26df. is raised.\n\nIf 'fileobj' is specified, it is used as an alternative to a *note\nfile object: 1037. opened in binary mode for 'name'.  It is\nsupposed to be at position 0.\n\nFor modes ''w:gz'', ''x:gz'', ''w|gz'', ''w:bz2'', ''x:bz2'',\n''w|bz2'', *note tarfile.open(): cdb. accepts the keyword argument\n'compresslevel' (default '9') to specify the compression level of\nthe file.\n\nFor modes ''w:xz'' and ''x:xz'', *note tarfile.open(): cdb. accepts\nthe keyword argument 'preset' to specify the compression level of\nthe file.\n\nFor special purposes, there is a second format for 'mode':\n''filemode|[compression]''.  *note tarfile.open(): cdb. will return\na *note TarFile: 1084. object that processes its data as a stream\nof blocks.  No random seeking will be done on the file.  If given,\n'fileobj' may be any object that has a *note read(): c7b. or *note\nwrite(): 26e0. method (depending on the 'mode') that works with\nbytes.  'bufsize' specifies the blocksize and defaults to '20 *\n512' bytes.  Use this variant in combination with e.g.\n'sys.stdin.buffer', a socket *note file object: 1037. or a tape\ndevice.  However, such a *note TarFile: 1084. object is limited in\nthat it does not allow random access, see *note Examples: 26e1.\nThe currently possible modes:\n\nMode              Action\n\n-------------------------------------------------------------------\n\n''r|*''           Open a 'stream' of tar blocks for reading with\ntransparent compression.\n\n\n''r|''            Open a 'stream' of uncompressed tar blocks for\nreading.\n\n\n''r|gz''          Open a gzip compressed 'stream' for reading.\n\n\n''r|bz2''         Open a bzip2 compressed 'stream' for reading.\n\n\n''r|xz''          Open an lzma compressed 'stream' for reading.\n\n\n''w|''            Open an uncompressed 'stream' for writing.\n\n\n''w|gz''          Open a gzip compressed 'stream' for writing.\n\n\n''w|bz2''         Open a bzip2 compressed 'stream' for writing.\n\n\n''w|xz''          Open an lzma compressed 'stream' for writing.\n\n\nChanged in version 3.5: The ''x'' (exclusive creation) mode was\nadded.\n\nChanged in version 3.6: The 'name' parameter accepts a *note\npath-like object: 957.\n\nChanged in version 3.12: The 'compresslevel' keyword argument also\nworks for streams.\n\n-- Class: tarfile.TarFile\n\nClass for reading and writing tar archives.  Do not use this class\ndirectly: use *note tarfile.open(): cdb. instead.  See *note\nTarFile Objects: 26de.\n\n-- Function: tarfile.istarfile (name)\n\nReturn *note True: a53. if 'name' is a tar archive file, that the\n*note tarfile: d8. module can read.  'name' may be a *note str:\n157, file, or file-like object.\n\nChanged in version 3.9: Support for file and file-like objects.\n\nThe *note tarfile: d8. module defines the following exceptions:\n\n-- Exception: tarfile.TarError\n\nBase class for all *note tarfile: d8. exceptions.\n\n-- Exception: tarfile.ReadError\n\nIs raised when a tar archive is opened, that either cannot be\nhandled by the *note tarfile: d8. module or is somehow invalid.\n\n-- Exception: tarfile.CompressionError\n\nIs raised when a compression method is not supported or when the\ndata cannot be decoded properly.\n\n-- Exception: tarfile.StreamError\n\nIs raised for the limitations that are typical for stream-like\n*note TarFile: 1084. objects.\n\n-- Exception: tarfile.ExtractError\n\nIs raised for 'non-fatal' errors when using *note\nTarFile.extract(): 357, but only if *note TarFile.errorlevel:\n359.'== 2'.\n\n-- Exception: tarfile.HeaderError\n\nIs raised by *note TarInfo.frombuf(): 26e6. if the buffer it gets\nis invalid.\n\n-- Exception: tarfile.FilterError\n\nBase class for members *note refused: 26e8. by filters.\n\n-- Attribute: tarinfo\n\nInformation about the member that the filter refused to\nextract, as *note TarInfo: 26ea.\n\n-- Exception: tarfile.AbsolutePathError\n\nRaised to refuse extracting a member with an absolute path.\n\n-- Exception: tarfile.OutsideDestinationError\n\nRaised to refuse extracting a member outside the destination\ndirectory.\n\n-- Exception: tarfile.SpecialFileError\n\nRaised to refuse extracting a special file (e.g.  a device or\npipe).\n\n-- Exception: tarfile.AbsoluteLinkError\n\nRaised to refuse extracting a symbolic link with an absolute path.\n\n-- Exception: tarfile.LinkOutsideDestinationError\n\nRaised to refuse extracting a symbolic link pointing outside the\ndestination directory.\n\n-- Exception: tarfile.LinkFallbackError\n\nRaised to refuse emulating a link (hard or symbolic) by extracting\nanother archive member, when that member would be rejected by the\nfilter location.  The exception that was raised to reject the\nreplacement member is available as 'BaseException.context'.\n\nNew in version next.\n\nThe following constants are available at the module level:\n\n-- Data: tarfile.ENCODING\n\nThe default character encoding: ''utf-8'' on Windows, the value\nreturned by *note sys.getfilesystemencoding(): aa2. otherwise.\n\n-- Data: tarfile.REGTYPE\n-- Data: tarfile.AREGTYPE\n\nA regular file *note type: 26f3.\n\n-- Data: tarfile.LNKTYPE\n\nA link (inside tarfile) *note type: 26f3.\n\n-- Data: tarfile.SYMTYPE\n\nA symbolic link *note type: 26f3.\n\n-- Data: tarfile.CHRTYPE\n\nA character special device *note type: 26f3.\n\n-- Data: tarfile.BLKTYPE\n\nA block special device *note type: 26f3.\n\n-- Data: tarfile.DIRTYPE\n\nA directory *note type: 26f3.\n\n-- Data: tarfile.FIFOTYPE\n\nA FIFO special device *note type: 26f3.\n\n-- Data: tarfile.CONTTYPE\n\nA contiguous file *note type: 26f3.\n\n-- Data: tarfile.GNUTYPELONGNAME\n\nA GNU tar longname *note type: 26f3.\n\n-- Data: tarfile.GNUTYPELONGLINK\n\nA GNU tar longlink *note type: 26f3.\n\n-- Data: tarfile.GNUTYPESPARSE\n\nA GNU tar sparse file *note type: 26f3.\n",
            "subsections": []
        },
        "Each of the following constants defines a tar archive format that the": {
            "content": "*note tarfile: d8. module is able to create.  See section *note\nSupported tar formats: 26fe. for details.\n\n-- Data: tarfile.USTARFORMAT\n\nPOSIX.1-1988 (ustar) format.\n\n-- Data: tarfile.GNUFORMAT\n\nGNU tar format.\n\n-- Data: tarfile.PAXFORMAT\n\nPOSIX.1-2001 (pax) format.\n\n-- Data: tarfile.DEFAULTFORMAT\n\nThe default format for creating archives.  This is currently *note\nPAXFORMAT: 2701.\n\nChanged in version 3.8: The default format for new archives was\nchanged to *note PAXFORMAT: 2701. from *note GNUFORMAT: 2700.\n\nSee also\n........\n\nModule *note zipfile: 12b.\n\nDocumentation of the *note zipfile: 12b. standard module.\n\n*note Archiving operations: 108d.\n\nDocumentation of the higher-level archiving facilities provided by\nthe standard *note shutil: c0. module.\n\nGNU tar manual, Basic Tar Format(2)\n\nDocumentation for tar archive files, including GNU tar extensions.\n\n* Menu:\n\n* TarFile Objects::\n* TarInfo Objects::\n* Extraction filters::\n* Command-Line Interface: Command-Line Interface<2>.\n* Examples: Examples<8>.\n* Supported tar formats::\n* Unicode issues::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/tarfile.py\n\n(2) https://www.gnu.org/software/tar/manual/htmlnode/Standard.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: TarFile Objects,  Next: TarInfo Objects,  Up: tarfile -- Read and write tar archive files": {
            "content": "5.13.6.1 TarFile Objects\n........................\n\nThe *note TarFile: 1084. object provides an interface to a tar archive.\nA tar archive is a sequence of blocks.  An archive member (a stored\nfile) is made up of a header block followed by data blocks.  It is\npossible to store a file in a tar archive several times.  Each archive\nmember is represented by a *note TarInfo: 1085. object, see *note\nTarInfo Objects: 26ea. for details.\n\nA *note TarFile: 1084. object can be used as a context manager in a\n*note with: 396. statement.  It will automatically be closed when the\nblock is completed.  Please note that in the event of an exception an\narchive opened for writing will not be finalized; only the internally\nused file object will be closed.  See the *note Examples: 26e1. section\nfor a use case.\n\nNew in version 3.2: Added support for the context management protocol.\n\n-- Class: tarfile.TarFile (name=None, mode='r', fileobj=None,\nformat=DEFAULTFORMAT, tarinfo=TarInfo, dereference=False,\nignorezeros=False, encoding=ENCODING,\nerrors='surrogateescape', paxheaders=None, debug=0,\nerrorlevel=1)\n\nAll following arguments are optional and can be accessed as\ninstance attributes as well.\n\n'name' is the pathname of the archive.  'name' may be a *note\npath-like object: 957.  It can be omitted if 'fileobj' is given.\nIn this case, the file object's 'name' attribute is used if it\nexists.\n\n'mode' is either ''r'' to read from an existing archive, ''a'' to\nappend data to an existing file, ''w'' to create a new file\noverwriting an existing one, or ''x'' to create a new file only if\nit does not already exist.\n\nIf 'fileobj' is given, it is used for reading or writing data.  If\nit can be determined, 'mode' is overridden by 'fileobj''s mode.\n'fileobj' will be used from position 0.\n\nNote: 'fileobj' is not closed, when *note TarFile: 1084. is\nclosed.\n\n'format' controls the archive format for writing.  It must be one\nof the constants *note USTARFORMAT: 26ff, *note GNUFORMAT: 2700.\nor *note PAXFORMAT: 2701. that are defined at module level.  When\nreading, format will be automatically detected, even if different\nformats are present in a single archive.\n\nThe 'tarinfo' argument can be used to replace the default *note\nTarInfo: 1085. class with a different one.\n\nIf 'dereference' is *note False: 971, add symbolic and hard links\nto the archive.  If it is *note True: a53, add the content of the\ntarget files to the archive.  This has no effect on systems that do\nnot support symbolic links.\n\nIf 'ignorezeros' is *note False: 971, treat an empty block as the\nend of the archive.  If it is *note True: a53, skip empty (and\ninvalid) blocks and try to get as many members as possible.  This\nis only useful for reading concatenated or damaged archives.\n\n'debug' can be set from '0' (no debug messages) up to '3' (all\ndebug messages).  The messages are written to 'sys.stderr'.\n\n'errorlevel' controls how extraction errors are handled, see *note\nthe corresponding attribute: 359.\n\nThe 'encoding' and 'errors' arguments define the character encoding\nto be used for reading or writing the archive and how conversion\nerrors are going to be handled.  The default settings will work for\nmost users.  See section *note Unicode issues: 2704. for in-depth\ninformation.\n\nThe 'paxheaders' argument is an optional dictionary of strings\nwhich will be added as a pax global header if 'format' is *note\nPAXFORMAT: 2701.\n\nChanged in version 3.2: Use ''surrogateescape'' as the default for\nthe 'errors' argument.\n\nChanged in version 3.5: The ''x'' (exclusive creation) mode was\nadded.\n\nChanged in version 3.6: The 'name' parameter accepts a *note\npath-like object: 957.\n\n-- Method: classmethod TarFile.open (...)\n\nAlternative constructor.  The *note tarfile.open(): cdb. function\nis actually a shortcut to this classmethod.\n\n-- Method: TarFile.getmember (name)\n\nReturn a *note TarInfo: 1085. object for member 'name'.  If 'name'\ncan not be found in the archive, *note KeyError: 8cf. is raised.\n\nNote: If a member occurs more than once in the archive, its\nlast occurrence is assumed to be the most up-to-date version.\n\n-- Method: TarFile.getmembers ()\n\nReturn the members of the archive as a list of *note TarInfo: 1085.\nobjects.  The list has the same order as the members in the\narchive.\n\n-- Method: TarFile.getnames ()\n\nReturn the members as a list of their names.  It has the same order\nas the list returned by *note getmembers(): cdd.\n\n-- Method: TarFile.list (verbose=True, *, members=None)\n\nPrint a table of contents to 'sys.stdout'.  If 'verbose' is *note\nFalse: 971, only the names of the members are printed.  If it is\n*note True: a53, output similar to that of 'ls -l' is produced.  If\noptional 'members' is given, it must be a subset of the list\nreturned by *note getmembers(): cdd.\n\nChanged in version 3.5: Added the 'members' parameter.\n\n-- Method: TarFile.next ()\n\nReturn the next member of the archive as a *note TarInfo: 1085.\nobject, when *note TarFile: 1084. is opened for reading.  Return\n*note None: 43f. if there is no more available.\n\n-- Method: TarFile.extractall (path='.', members=None, *,\nnumericowner=False, filter=None)\n\nExtract all members from the archive to the current working\ndirectory or directory 'path'.  If optional 'members' is given, it\nmust be a subset of the list returned by *note getmembers(): cdd.\nDirectory information like owner, modification time and permissions\nare set after all members have been extracted.  This is done to\nwork around two problems: A directory's modification time is reset\neach time a file is created in it.  And, if a directory's\npermissions do not allow writing, extracting files to it will fail.\n\nIf 'numericowner' is *note True: a53, the uid and gid numbers from\nthe tarfile are used to set the owner/group for the extracted\nfiles.  Otherwise, the named values from the tarfile are used.\n\nThe 'filter' argument specifies how 'members' are modified or\nrejected before extraction.  See *note Extraction filters: 185. for\ndetails.  It is recommended to set this explicitly depending on\nwhich 'tar' features you need to support.\n\nWarning: Never extract archives from untrusted sources without\nprior inspection.  It is possible that files are created\noutside of 'path', e.g.  members that have absolute filenames\nstarting with '\"/\"' or filenames with two dots '\"..\"'.\n\nSet 'filter='data'' to prevent the most dangerous security\nissues, and read the *note Extraction filters: 185. section\nfor details.\n\nChanged in version 3.5: Added the 'numericowner' parameter.\n\nChanged in version 3.6: The 'path' parameter accepts a *note\npath-like object: 957.\n\nChanged in version 3.12: Added the 'filter' parameter.\n\n-- Method: TarFile.extract (member, path='', setattrs=True, *,\nnumericowner=False, filter=None)\n\nExtract a member from the archive to the current working directory,\nusing its full name.  Its file information is extracted as\naccurately as possible.  'member' may be a filename or a *note\nTarInfo: 1085. object.  You can specify a different directory using\n'path'.  'path' may be a *note path-like object: 957.  File\nattributes (owner, mtime, mode) are set unless 'setattrs' is\nfalse.\n\nThe 'numericowner' and 'filter' arguments are the same as for\n*note extractall(): 356.\n\nNote: The *note extract(): 357. method does not take care of\nseveral extraction issues.  In most cases you should consider\nusing the *note extractall(): 356. method.\n\nWarning: See the warning for *note extractall(): 356.\n\nSet 'filter='data'' to prevent the most dangerous security\nissues, and read the *note Extraction filters: 185. section\nfor details.\n\nChanged in version 3.2: Added the 'setattrs' parameter.\n\nChanged in version 3.5: Added the 'numericowner' parameter.\n\nChanged in version 3.6: The 'path' parameter accepts a *note\npath-like object: 957.\n\nChanged in version 3.12: Added the 'filter' parameter.\n\n-- Method: TarFile.extractfile (member)\n\nExtract a member from the archive as a file object.  'member' may\nbe a filename or a *note TarInfo: 1085. object.  If 'member' is a\nregular file or a link, an *note io.BufferedReader: 1082. object is\nreturned.  For all other existing members, *note None: 43f. is\nreturned.  If 'member' does not appear in the archive, *note\nKeyError: 8cf. is raised.\n\nChanged in version 3.3: Return an *note io.BufferedReader: 1082.\nobject.\n\n-- Attribute: TarFile.errorlevel: *note int: 17e.\n\nIf 'errorlevel' is '0', errors are ignored when using *note\nTarFile.extract(): 357. and *note TarFile.extractall(): 356.\nNevertheless, they appear as error messages in the debug output\nwhen 'debug' is greater than 0.  If '1' (the default), all 'fatal'\nerrors are raised as *note OSError: 613. or *note FilterError:\n26e7. exceptions.  If '2', all 'non-fatal' errors are raised as\n*note TarError: 26e2. exceptions as well.\n\nSome exceptions, e.g.  ones caused by wrong argument types or data\ncorruption, are always raised.\n\nCustom *note extraction filters: 185. should raise *note\nFilterError: 26e7. for 'fatal' errors and *note ExtractError: 26e4.\nfor 'non-fatal' ones.\n\nNote that when an exception is raised, the archive may be partially\nextracted.  It is the user's responsibility to clean up.\n\n-- Attribute: TarFile.extractionfilter\n\nNew in version 3.12.\n\nThe *note extraction filter: 185. used as a default for the\n'filter' argument of *note extract(): 357. and *note extractall():\n356.\n\nThe attribute may be 'None' or a callable.  String names are not\nallowed for this attribute, unlike the 'filter' argument to *note\nextract(): 357.\n\nIf 'extractionfilter' is 'None' (the default), calling an\nextraction method without a 'filter' argument will raise a\n'DeprecationWarning', and fall back to the *note fullytrusted:\n2709. filter, whose dangerous behavior matches previous versions of\nPython.\n\nIn Python 3.14+, leaving 'extractionfilter=None' will cause\nextraction methods to use the *note data: 355. filter by default.\n\nThe attribute may be set on instances or overridden in subclasses.\nIt also is possible to set it on the 'TarFile' class itself to set\na global default, although, since it affects all uses of 'tarfile',\nit is best practice to only do so in top-level applications or\n*note site configuration: c2.  To set a global default this way, a\nfilter function needs to be wrapped in *note staticmethod(): 5cc.\nto prevent injection of a 'self' argument.\n\n-- Method: TarFile.add (name, arcname=None, recursive=True, *,\nfilter=None)\n\nAdd the file 'name' to the archive.  'name' may be any type of file\n(directory, fifo, symbolic link, etc.).  If given, 'arcname'\nspecifies an alternative name for the file in the archive.\nDirectories are added recursively by default.  This can be avoided\nby setting 'recursive' to *note False: 971.  Recursion adds entries\nin sorted order.  If 'filter' is given, it should be a function\nthat takes a *note TarInfo: 1085. object argument and returns the\nchanged *note TarInfo: 1085. object.  If it instead returns *note\nNone: 43f. the *note TarInfo: 1085. object will be excluded from\nthe archive.  See *note Examples: 26e1. for an example.\n\nChanged in version 3.2: Added the 'filter' parameter.\n\nChanged in version 3.7: Recursion adds entries in sorted order.\n\n-- Method: TarFile.addfile (tarinfo, fileobj=None)\n\nAdd the *note TarInfo: 1085. object 'tarinfo' to the archive.  If\n'fileobj' is given, it should be a *note binary file: 1a0c, and\n'tarinfo.size' bytes are read from it and added to the archive.\nYou can create *note TarInfo: 1085. objects directly, or by using\n*note gettarinfo(): 270b.\n\n-- Method: TarFile.gettarinfo (name=None, arcname=None, fileobj=None)\n\nCreate a *note TarInfo: 1085. object from the result of *note\nos.stat(): 1bf. or equivalent on an existing file.  The file is\neither named by 'name', or specified as a *note file object: 1037.\n'fileobj' with a file descriptor.  'name' may be a *note path-like\nobject: 957.  If given, 'arcname' specifies an alternative name for\nthe file in the archive, otherwise, the name is taken from\n'fileobj''s *note name: 270c. attribute, or the 'name' argument.\nThe name should be a text string.\n\nYou can modify some of the *note TarInfo: 1085.'s attributes before\nyou add it using *note addfile(): 270a.  If the file object is not\nan ordinary file object positioned at the beginning of the file,\nattributes such as *note size: 270d. may need modifying.  This is\nthe case for objects such as *note GzipFile: 25e.  The *note name:\n270e. may also be modified, in which case 'arcname' could be a\ndummy string.\n\nChanged in version 3.6: The 'name' parameter accepts a *note\npath-like object: 957.\n\n-- Method: TarFile.close ()\n\nClose the *note TarFile: 1084.  In write mode, two finishing zero\nblocks are appended to the archive.\n\n-- Attribute: TarFile.paxheaders: *note dict: 237.\n\nA dictionary containing key-value pairs of pax global headers.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: TarInfo Objects,  Next: Extraction filters,  Prev: TarFile Objects,  Up: tarfile -- Read and write tar archive files": {
            "content": "5.13.6.2 TarInfo Objects\n........................\n\nA *note TarInfo: 1085. object represents one member in a *note TarFile:\n1084.  Aside from storing all required attributes of a file (like file\ntype, size, time, permissions, owner etc.), it provides some useful\nmethods to determine its type.  It does 'not' contain the file's data\nitself.\n\n*note TarInfo: 1085. objects are returned by *note TarFile: 1084.'s\nmethods *note getmember(): 15b6, *note getmembers(): cdd. and *note\ngettarinfo(): 270b.\n\nModifying the objects returned by *note getmember(): 15b6. or *note\ngetmembers(): cdd. will affect all subsequent operations on the archive.\nFor cases where this is unwanted, you can use *note copy.copy(): 23. or\ncall the *note replace(): 2712. method to create a modified copy in one\nstep.\n",
            "subsections": []
        },
        "Several attributes can be set to 'None' to indicate that a piece of": {
            "content": "metadata is unused or unknown.  Different *note TarInfo: 1085. methods\nhandle 'None' differently:\n\n- The *note extract(): 357. or *note extractall(): 356. methods will\nignore the corresponding metadata, leaving it set to a default.\n\n- *note addfile(): 270a. will fail.\n\n- *note list(): cdc. will print a placeholder string.\n\n-- Class: tarfile.TarInfo (name='')\n\nCreate a *note TarInfo: 1085. object.\n\n-- Method: classmethod TarInfo.frombuf (buf, encoding, errors)\n\nCreate and return a *note TarInfo: 1085. object from string buffer\n'buf'.\n\nRaises *note HeaderError: 26e5. if the buffer is invalid.\n\n-- Method: classmethod TarInfo.fromtarfile (tarfile)\n\nRead the next member from the *note TarFile: 1084. object 'tarfile'\nand return it as a *note TarInfo: 1085. object.\n\n-- Method: TarInfo.tobuf (format=DEFAULTFORMAT, encoding=ENCODING,\nerrors='surrogateescape')\n\nCreate a string buffer from a *note TarInfo: 1085. object.  For\ninformation on the arguments see the constructor of the *note\nTarFile: 1084. class.\n\nChanged in version 3.2: Use ''surrogateescape'' as the default for\nthe 'errors' argument.\n\nA 'TarInfo' object has the following public data attributes:\n\n-- Attribute: TarInfo.name: *note str: 157.\n\nName of the archive member.\n\n-- Attribute: TarInfo.size: *note int: 17e.\n\nSize in bytes.\n\n-- Attribute: TarInfo.mtime: *note int: 17e. | *note float: 4b7.\n\nTime of last modification in seconds since the *note epoch: 2716,\nas in *note os.statresult.stmtime: 265d.\n\nChanged in version 3.12: Can be set to 'None' for *note extract():\n357. and *note extractall(): 356, causing extraction to skip\napplying this attribute.\n\n-- Attribute: TarInfo.mode: *note int: 17e.\n\nPermission bits, as for *note os.chmod(): f5d.\n\nChanged in version 3.12: Can be set to 'None' for *note extract():\n357. and *note extractall(): 356, causing extraction to skip\napplying this attribute.\n\n-- Attribute: TarInfo.type\n\nFile type.  'type' is usually one of these constants: *note\nREGTYPE: 26f1, *note AREGTYPE: 26f2, *note LNKTYPE: 26f4, *note\nSYMTYPE: 26f5, *note DIRTYPE: 26f8, *note FIFOTYPE: 26f9, *note\nCONTTYPE: 26fa, *note CHRTYPE: 26f6, *note BLKTYPE: 26f7, *note\nGNUTYPESPARSE: 26fd.  To determine the type of a *note TarInfo:\n1085. object more conveniently, use the 'is*()' methods below.\n\n-- Attribute: TarInfo.linkname: *note str: 157.\n\nName of the target file name, which is only present in *note\nTarInfo: 1085. objects of type *note LNKTYPE: 26f4. and *note\nSYMTYPE: 26f5.\n\nFor symbolic links ('SYMTYPE'), the 'linkname' is relative to the\ndirectory that contains the link.  For hard links ('LNKTYPE'), the\n'linkname' is relative to the root of the archive.\n\n-- Attribute: TarInfo.uid: *note int: 17e.\n\nUser ID of the user who originally stored this member.\n\nChanged in version 3.12: Can be set to 'None' for *note extract():\n357. and *note extractall(): 356, causing extraction to skip\napplying this attribute.\n\n-- Attribute: TarInfo.gid: *note int: 17e.\n\nGroup ID of the user who originally stored this member.\n\nChanged in version 3.12: Can be set to 'None' for *note extract():\n357. and *note extractall(): 356, causing extraction to skip\napplying this attribute.\n\n-- Attribute: TarInfo.uname: *note str: 157.\n\nUser name.\n\nChanged in version 3.12: Can be set to 'None' for *note extract():\n357. and *note extractall(): 356, causing extraction to skip\napplying this attribute.\n\n-- Attribute: TarInfo.gname: *note str: 157.\n\nGroup name.\n\nChanged in version 3.12: Can be set to 'None' for *note extract():\n357. and *note extractall(): 356, causing extraction to skip\napplying this attribute.\n\n-- Attribute: TarInfo.chksum: *note int: 17e.\n\nHeader checksum.\n\n-- Attribute: TarInfo.devmajor: *note int: 17e.\n\nDevice major number.\n\n-- Attribute: TarInfo.devminor: *note int: 17e.\n\nDevice minor number.\n\n-- Attribute: TarInfo.offset: *note int: 17e.\n\nThe tar header starts here.\n\n-- Attribute: TarInfo.offsetdata: *note int: 17e.\n\nThe file's data starts here.\n\n-- Attribute: TarInfo.sparse\n\nSparse member information.\n\n-- Attribute: TarInfo.paxheaders: *note dict: 237.\n\nA dictionary containing key-value pairs of an associated pax\nextended header.\n\n-- Method: TarInfo.replace (name=..., mtime=..., mode=...,\nlinkname=..., uid=..., gid=..., uname=..., gname=...,\ndeep=True)\n\nNew in version 3.12.\n\nReturn a 'new' copy of the 'TarInfo' object with the given\nattributes changed.  For example, to return a 'TarInfo' with the\ngroup name set to ''staff'', use:\n\nnewtarinfo = oldtarinfo.replace(gname='staff')\n\nBy default, a deep copy is made.  If 'deep' is false, the copy is\nshallow, i.e.  'paxheaders' and any custom attributes are shared\nwith the original 'TarInfo' object.\n\nA *note TarInfo: 1085. object also provides some convenient query\nmethods:\n\n-- Method: TarInfo.isfile ()\n\nReturn *note True: a53. if the *note TarInfo: 1085. object is a\nregular file.\n\n-- Method: TarInfo.isreg ()\n\nSame as *note isfile(): 2724.\n\n-- Method: TarInfo.isdir ()\n\nReturn *note True: a53. if it is a directory.\n\n-- Method: TarInfo.issym ()\n\nReturn *note True: a53. if it is a symbolic link.\n\n-- Method: TarInfo.islnk ()\n\nReturn *note True: a53. if it is a hard link.\n\n-- Method: TarInfo.ischr ()\n\nReturn *note True: a53. if it is a character device.\n\n-- Method: TarInfo.isblk ()\n\nReturn *note True: a53. if it is a block device.\n\n-- Method: TarInfo.isfifo ()\n\nReturn *note True: a53. if it is a FIFO.\n\n-- Method: TarInfo.isdev ()\n\nReturn *note True: a53. if it is one of character device, block\ndevice or FIFO.\n\nFile: python3.12.info,  Node: Extraction filters,  Next: Command-Line Interface<2>,  Prev: TarInfo Objects,  Up: tarfile -- Read and write tar archive files\n\n5.13.6.3 Extraction filters\n...........................\n\nNew in version 3.12.\n",
            "subsections": []
        },
        "The 'tar' format is designed to capture all details of a UNIX-like": {
            "content": "filesystem, which makes it very powerful.  Unfortunately, the features\nmake it easy to create tar files that have unintended - and possibly\nmalicious - effects when extracted.  For example, extracting a tar file\ncan overwrite arbitrary files in various ways (e.g.  by using absolute\npaths, '..' path components, or symlinks that affect later members).\n",
            "subsections": []
        },
        "In most cases, the full functionality is not needed.  Therefore,": {
            "content": "'tarfile' supports extraction filters: a mechanism to limit\nfunctionality, and thus mitigate some of the security issues.\n\nSee also\n........\n\nPEP 706(1)\n\nContains further motivation and rationale behind the design.\n\nThe 'filter' argument to *note TarFile.extract(): 357. or *note\nextractall(): 356. can be:\n\n* the string ''fullytrusted'': Honor all metadata as specified in\nthe archive.  Should be used if the user trusts the archive\ncompletely, or implements their own complex verification.\n\n* the string ''tar'': Honor most 'tar'-specific features (i.e.\nfeatures of UNIX-like filesystems), but block features that are\nvery likely to be surprising or malicious.  See *note tarfilter():\n272e. for details.\n\n* the string ''data'': Ignore or block most features specific to\nUNIX-like filesystems.  Intended for extracting cross-platform data\narchives.  See *note datafilter(): 355. for details.\n\n* 'None' (default): Use *note TarFile.extractionfilter: 2708.\n\nIf that is also 'None' (the default), raise a 'DeprecationWarning',\nand fall back to the ''fullytrusted'' filter, whose dangerous\nbehavior matches previous versions of Python.\n\nIn Python 3.14, the ''data'' filter will become the default\ninstead.  It's possible to switch earlier; see *note\nTarFile.extractionfilter: 2708.\n\n* A callable which will be called for each extracted member with a\n*note TarInfo: 26ea. describing the member and the destination path\nto where the archive is extracted (i.e.  the same path is used for\nall members):\n\nfilter(member: TarInfo, path: str, /) -> TarInfo | None\n\nThe callable is called just before each member is extracted, so it\ncan take the current state of the disk into account.  It can:\n\n- return a *note TarInfo: 1085. object which will be used\ninstead of the metadata in the archive, or\n\n- return 'None', in which case the member will be skipped, or\n\n- raise an exception to abort the operation or skip the member,\ndepending on *note errorlevel: 359.  Note that when extraction\nis aborted, *note extractall(): 356. may leave the archive\npartially extracted.  It does not attempt to clean up.\n\n* Menu:\n\n* Default named filters::\n* Filter errors::\n* Hints for further verification::\n* Supporting older Python versions::\n* Stateful extraction filter example::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0706/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Default named filters,  Next: Filter errors,  Up: Extraction filters": {
            "content": "5.13.6.4 Default named filters\n..............................\n",
            "subsections": []
        },
        "The pre-defined, named filters are available as functions, so they can": {
            "content": "be reused in custom filters:\n\n-- Function: tarfile.fullytrustedfilter (member, path)\n\nReturn 'member' unchanged.\n\nThis implements the ''fullytrusted'' filter.\n\n-- Function: tarfile.tarfilter (member, path)\n\nImplements the ''tar'' filter.\n\n- Strip leading slashes ('/' and *note os.sep: 434.) from\nfilenames.\n\n- *note Refuse: 26e8. to extract files with absolute paths (in\ncase the name is absolute even after stripping slashes, e.g.\n'C:/foo' on Windows).  This raises *note AbsolutePathError:\n26eb.\n\n- *note Refuse: 26e8. to extract files whose absolute path\n(after following symlinks) would end up outside the\ndestination.  This raises *note OutsideDestinationError: 26ec.\n\n- Clear high mode bits (setuid, setgid, sticky) and group/other\nwrite bits (*note SIWGRP: 2500. | *note SIWOTH: 2503.).\n\nReturn the modified 'TarInfo' member.\n\n-- Function: tarfile.datafilter (member, path)\n\nImplements the ''data'' filter.  In addition to what 'tarfilter'\ndoes:\n\n- Normalize link targets (*note TarInfo.linkname: 2718.) using\n*note os.path.normpath(): 1191.  Note that this removes\ninternal '..' components, which may change the meaning of the\nlink if the path in 'TarInfo.linkname' traverses symbolic\nlinks.\n\n- *note Refuse: 26e8. to extract links (hard or soft) that link\nto absolute paths, or ones that link outside the destination.\n\nThis raises *note AbsoluteLinkError: 26ee. or *note\nLinkOutsideDestinationError: 26ef.\n\nNote that such files are refused even on platforms that do not\nsupport symbolic links.\n\n- *note Refuse: 26e8. to extract device files (including pipes).\nThis raises *note SpecialFileError: 26ed.\n\n- For regular files, including hard links:\n\n- Set the owner read and write permissions (*note SIRUSR:\n24fb. | *note SIWUSR: 24fc.).\n\n- Remove the group & other executable permission (*note\nSIXGRP: 24f7. | *note SIXOTH: 2504.) if the owner\ndoesn't have it (*note SIXUSR: 24fd.).\n\n- For other files (directories), set 'mode' to 'None', so that\nextraction methods skip applying permission bits.\n\n- Set user and group info ('uid', 'gid', 'uname', 'gname') to\n'None', so that extraction methods skip setting it.\n\nReturn the modified 'TarInfo' member.\n\nChanged in version next: Link targets are now normalized.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Filter errors,  Next: Hints for further verification,  Prev: Default named filters,  Up: Extraction filters": {
            "content": "5.13.6.5 Filter errors\n......................\n",
            "subsections": []
        },
        "When a filter refuses to extract a file, it will raise an appropriate": {
            "content": "exception, a subclass of *note FilterError: 26e7.  This will abort the\nextraction if *note TarFile.errorlevel: 359. is 1 or more.  With\n'errorlevel=0' the error will be logged and the member will be skipped,\nbut extraction will continue.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Hints for further verification,  Next: Supporting older Python versions,  Prev: Filter errors,  Up: Extraction filters": {
            "content": "5.13.6.6 Hints for further verification\n.......................................\n\nEven with 'filter='data'', 'tarfile' is not suited for extracting\nuntrusted files without prior inspection.  Among other issues, the\npre-defined filters do not prevent denial-of-service attacks.  Users\nshould do additional checks.\n\nHere is an incomplete list of things to consider:\n\n* Extract to a *note new temporary directory: 1eb. to prevent e.g.\nexploiting pre-existing links, and to make it easier to clean up\nafter a failed extraction.\n\n* Disallow symbolic links if you do not need the functionality.\n\n* When working with untrusted data, use external (e.g.  OS-level)\nlimits on disk, memory and CPU usage.\n\n* Check filenames against an allow-list of characters (to filter out\ncontrol characters, confusables, foreign path separators, etc.).\n\n* Check that filenames have expected extensions (discouraging files\nthat execute when you \"click on them\", or extension-less files like\nWindows special device names).\n\n* Limit the number of extracted files, total size of extracted data,\nfilename length (including symlink length), and size of individual\nfiles.\n\n* Check for files that would be shadowed on case-insensitive\nfilesystems.\n\nAlso note that:\n\n* Tar files may contain multiple versions of the same file.  Later\nones are expected to overwrite any earlier ones.  This feature is\ncrucial to allow updating tape archives, but can be abused\nmaliciously.\n\n* 'tarfile' does not protect against issues with \"live\" data, e.g.\nan attacker tinkering with the destination (or source) directory\nwhile extraction (or archiving) is in progress.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Supporting older Python versions,  Next: Stateful extraction filter example,  Prev: Hints for further verification,  Up: Extraction filters": {
            "content": "5.13.6.7 Supporting older Python versions\n.........................................\n",
            "subsections": []
        },
        "Extraction filters were added to Python 3.12, but may be backported to": {
            "content": "older versions as security updates.  To check whether the feature is\navailable, use e.g.  'hasattr(tarfile, 'datafilter')' rather than\nchecking the Python version.\n",
            "subsections": []
        },
        "The following examples show how to support Python versions with and": {
            "content": "without the feature.  Note that setting 'extractionfilter' will affect\nany subsequent operations.\n\n* Fully trusted archive:\n\nmytarfile.extractionfilter = (lambda member, path: member)\nmytarfile.extractall()\n\n* Use the ''data'' filter if available, but revert to Python 3.11\nbehavior (''fullytrusted'') if this feature is not available:\n\nmytarfile.extractionfilter = getattr(tarfile, 'datafilter',\n(lambda member, path: member))\nmytarfile.extractall()\n\n* Use the ''data'' filter; 'fail' if it is not available:\n\nmytarfile.extractall(filter=tarfile.datafilter)\n\nor:\n\nmytarfile.extractionfilter = tarfile.datafilter\nmytarfile.extractall()\n\n* Use the ''data'' filter; 'warn' if it is not available:\n\nif hasattr(tarfile, 'datafilter'):\nmytarfile.extractall(filter='data')\nelse:\n# remove this when no longer needed\nwarntheuser('Extracting may be unsafe; consider updating Python')\nmytarfile.extractall()\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Stateful extraction filter example,  Prev: Supporting older Python versions,  Up: Extraction filters": {
            "content": "5.13.6.8 Stateful extraction filter example\n...........................................\n",
            "subsections": []
        },
        "While 'tarfile''s extraction methods take a simple 'filter' callable,": {
            "content": "custom filters may be more complex objects with an internal state.  It\nmay be useful to write these as context managers, to be used like this:\n\nwith StatefulFilter() as filterfunc:\ntar.extractall(path, filter=filterfunc)\n\nSuch a filter can be written as, for example:\n\nclass StatefulFilter:\ndef init(self):\nself.filecount = 0\n\ndef enter(self):\nreturn self\n\ndef call(self, member, path):\nself.filecount += 1\nreturn member\n\ndef exit(self, *excinfo):\nprint(f'{self.filecount} files extracted')\n\nFile: python3.12.info,  Node: Command-Line Interface<2>,  Next: Examples<8>,  Prev: Extraction filters,  Up: tarfile -- Read and write tar archive files\n\n5.13.6.9 Command-Line Interface\n...............................\n\nNew in version 3.4.\n\nThe *note tarfile: d8. module provides a simple command-line interface\nto interact with tar archives.\n",
            "subsections": []
        },
        "If you want to create a new tar archive, specify its name after the": {
            "content": "*note -c: 2735. option and then list the filename(s) that should be\nincluded:\n\n$ python -m tarfile -c monty.tar  spam.txt eggs.txt\n\nPassing a directory is also acceptable:\n\n$ python -m tarfile -c monty.tar life-of-brian1979/\n",
            "subsections": []
        },
        "If you want to extract a tar archive into the current directory, use the": {
            "content": "*note -e: 2736. option:\n\n$ python -m tarfile -e monty.tar\n",
            "subsections": []
        },
        "You can also extract a tar archive into a different directory by passing": {
            "content": "the directory's name:\n\n$ python -m tarfile -e monty.tar  other-dir/\n\nFor a list of the files in a tar archive, use the *note -l: 2737.\noption:\n\n$ python -m tarfile -l monty.tar\n\n* Menu:\n\n* Command-line options: Command-line options<2>.\n\nFile: python3.12.info,  Node: Command-line options<2>,  Up: Command-Line Interface<2>\n\n5.13.6.10 Command-line options\n..............................\n\n-- Option: -l <tarfile>\n-- Option: --list <tarfile>\n\nList files in a tarfile.\n\n-- Option: -c <tarfile> <source1> ... <sourceN>\n-- Option: --create <tarfile> <source1> ... <sourceN>\n\nCreate tarfile from source files.\n\n-- Option: -e <tarfile> [<outputdir>]\n-- Option: --extract <tarfile> [<outputdir>]\n\nExtract tarfile into the current directory if 'outputdir' is not\nspecified.\n\n-- Option: -t <tarfile>\n-- Option: --test <tarfile>\n\nTest whether the tarfile is valid or not.\n\n-- Option: -v, --verbose\n\nVerbose output.\n\n-- Option: --filter <filtername>\n\nSpecifies the 'filter' for '--extract'.  See *note Extraction\nfilters: 185. for details.  Only string names are accepted (that\nis, 'fullytrusted', 'tar', and 'data').\n\nFile: python3.12.info,  Node: Examples<8>,  Next: Supported tar formats,  Prev: Command-Line Interface<2>,  Up: tarfile -- Read and write tar archive files\n\n5.13.6.11 Examples\n..................\n\nHow to extract an entire tar archive to the current working directory:\n\nimport tarfile\ntar = tarfile.open(\"sample.tar.gz\")\ntar.extractall(filter='data')\ntar.close()\n\nHow to extract a subset of a tar archive with *note\nTarFile.extractall(): 356. using a generator function instead of a list:\n\nimport os\nimport tarfile\n\ndef pyfiles(members):\nfor tarinfo in members:\nif os.path.splitext(tarinfo.name)[1] == \".py\":\nyield tarinfo\n\ntar = tarfile.open(\"sample.tar.gz\")\ntar.extractall(members=pyfiles(tar))\ntar.close()\n\nHow to create an uncompressed tar archive from a list of filenames:\n\nimport tarfile\ntar = tarfile.open(\"sample.tar\", \"w\")\nfor name in [\"foo\", \"bar\", \"quux\"]:\ntar.add(name)\ntar.close()\n\nThe same example using the *note with: 396. statement:\n\nimport tarfile\nwith tarfile.open(\"sample.tar\", \"w\") as tar:\nfor name in [\"foo\", \"bar\", \"quux\"]:\ntar.add(name)\n",
            "subsections": []
        },
        "How to read a gzip compressed tar archive and display some member": {
            "content": "information:\n\nimport tarfile\ntar = tarfile.open(\"sample.tar.gz\", \"r:gz\")\nfor tarinfo in tar:\nprint(tarinfo.name, \"is\", tarinfo.size, \"bytes in size and is \", end=\"\")\nif tarinfo.isreg():\nprint(\"a regular file.\")\nelif tarinfo.isdir():\nprint(\"a directory.\")\nelse:\nprint(\"something else.\")\ntar.close()\n",
            "subsections": []
        },
        "How to create an archive and reset the user information using the": {
            "content": "'filter' parameter in *note TarFile.add(): a39.:\n\nimport tarfile\ndef reset(tarinfo):\ntarinfo.uid = tarinfo.gid = 0\ntarinfo.uname = tarinfo.gname = \"root\"\nreturn tarinfo\ntar = tarfile.open(\"sample.tar.gz\", \"w:gz\")\ntar.add(\"foo\", filter=reset)\ntar.close()\n\nFile: python3.12.info,  Node: Supported tar formats,  Next: Unicode issues,  Prev: Examples<8>,  Up: tarfile -- Read and write tar archive files\n\n5.13.6.12 Supported tar formats\n...............................\n\nThere are three tar formats that can be created with the *note tarfile:\nd8. module:\n\n* The POSIX.1-1988 ustar format (*note USTARFORMAT: 26ff.).  It\nsupports filenames up to a length of at best 256 characters and\nlinknames up to 100 characters.  The maximum file size is 8 GiB.\nThis is an old and limited but widely supported format.\n\n* The GNU tar format (*note GNUFORMAT: 2700.).  It supports long\nfilenames and linknames, files bigger than 8 GiB and sparse files.\nIt is the de facto standard on GNU/Linux systems.  *note tarfile:\nd8. fully supports the GNU tar extensions for long names, sparse\nfile support is read-only.\n\n* The POSIX.1-2001 pax format (*note PAXFORMAT: 2701.).  It is the\nmost flexible format with virtually no limits.  It supports long\nfilenames and linknames, large files and stores pathnames in a\nportable way.  Modern tar implementations, including GNU tar,\nbsdtar/libarchive and star, fully support extended 'pax' features;\nsome old or unmaintained libraries may not, but should treat 'pax'\narchives as if they were in the universally supported 'ustar'\nformat.  It is the current default format for new archives.\n\nIt extends the existing 'ustar' format with extra headers for\ninformation that cannot be stored otherwise.  There are two\nflavours of pax headers: Extended headers only affect the\nsubsequent file header, global headers are valid for the complete\narchive and affect all following files.  All the data in a pax\nheader is encoded in 'UTF-8' for portability reasons.\n",
            "subsections": []
        },
        "There are some more variants of the tar format which can be read, but": {
            "content": "not created:\n\n* The ancient V7 format.  This is the first tar format from Unix\nSeventh Edition, storing only regular files and directories.  Names\nmust not be longer than 100 characters, there is no user/group name\ninformation.  Some archives have miscalculated header checksums in\ncase of fields with non-ASCII characters.\n\n* The SunOS tar extended format.  This format is a variant of the\nPOSIX.1-2001 pax format, but is not compatible.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Unicode issues,  Prev: Supported tar formats,  Up: tarfile -- Read and write tar archive files": {
            "content": "5.13.6.13 Unicode issues\n........................\n",
            "subsections": []
        },
        "The tar format was originally conceived to make backups on tape drives": {
            "content": "with the main focus on preserving file system information.  Nowadays tar\narchives are commonly used for file distribution and exchanging archives\nover networks.  One problem of the original format (which is the basis\nof all other formats) is that there is no concept of supporting\ndifferent character encodings.  For example, an ordinary tar archive\ncreated on a 'UTF-8' system cannot be read correctly on a 'Latin-1'\nsystem if it contains non-'ASCII' characters.  Textual metadata (like\nfilenames, linknames, user/group names) will appear damaged.\nUnfortunately, there is no way to autodetect the encoding of an archive.",
            "subsections": []
        },
        "The pax format was designed to solve this problem.  It stores non-ASCII": {
            "content": "metadata using the universal character encoding 'UTF-8'.\n\nThe details of character conversion in *note tarfile: d8. are controlled\nby the 'encoding' and 'errors' keyword arguments of the *note TarFile:\n1084. class.\n\n'encoding' defines the character encoding to use for the metadata in the\narchive.  The default value is *note sys.getfilesystemencoding(): aa2.\nor ''ascii'' as a fallback.  Depending on whether the archive is read or\nwritten, the metadata must be either decoded or encoded.  If 'encoding'\nis not set appropriately, this conversion may fail.\n",
            "subsections": []
        },
        "The 'errors' argument defines how characters are treated that cannot be": {
            "content": "converted.  Possible values are listed in section *note Error Handlers:\n1543.  The default scheme is ''surrogateescape'' which Python also uses\nfor its file system calls, see *note File Names, Command Line Arguments,\nand Environment Variables: 2744.\n\nFor *note PAXFORMAT: 2701. archives (the default), 'encoding' is\ngenerally not needed because all the metadata is stored using 'UTF-8'.\n'encoding' is only used in the rare cases when binary pax headers are\ndecoded or when strings with surrogate characters are stored.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: File Formats,  Next: Cryptographic Services,  Prev: Data Compression and Archiving,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.14 File Formats",
                    "content": ""
                }
            ]
        },
        "The modules described in this chapter parse various miscellaneous file": {
            "content": "formats that aren't markup languages and are not related to e-mail.\n\n* Menu:\n\n* csv -- CSV File Reading and Writing::\n* configparser -- Configuration file parser::\n* tomllib -- Parse TOML files::\n* netrc -- netrc file processing::\n* plistlib -- Generate and parse Apple .plist files: plistlib -- Generate and parse Apple plist files.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: csv -- CSV File Reading and Writing,  Next: configparser -- Configuration file parser,  Up: File Formats": {
            "content": "'Source code:' Lib/csv.py(1)\n\n\n",
            "subsections": []
        },
        "The so-called CSV (Comma Separated Values) format is the most common": {
            "content": "import and export format for spreadsheets and databases.  CSV format was\nused for many years prior to attempts to describe the format in a\nstandardized way in RFC 4180(2).  The lack of a well-defined standard\nmeans that subtle differences often exist in the data produced and\nconsumed by different applications.  These differences can make it\nannoying to process CSV files from multiple sources.  Still, while the\ndelimiters and quoting characters vary, the overall format is similar\nenough that it is possible to write a single module which can\nefficiently manipulate such data, hiding the details of reading and\nwriting the data from the programmer.\n\nThe *note csv: 27. module implements classes to read and write tabular\ndata in CSV format.  It allows programmers to say, \"write this data in\nthe format preferred by Excel,\" or \"read data from this file which was\ngenerated by Excel,\" without knowing the precise details of the CSV\nformat used by Excel.  Programmers can also describe the CSV formats\nunderstood by other applications or define their own special-purpose CSV\nformats.\n\nThe *note csv: 27. module's *note reader: 12f7. and *note writer: 1a2.\nobjects read and write sequences.  Programmers can also read and write\ndata in dictionary form using the *note DictReader: 80b. and *note\nDictWriter: 1072. classes.\n\nSee also\n........\n\nPEP 305(3) - CSV File API\n\nThe Python Enhancement Proposal which proposed this addition to\nPython.\n\n* Menu:\n\n* Module Contents: Module Contents<3>.\n* Dialects and Formatting Parameters::\n* Reader Objects::\n* Writer Objects::\n* Examples: Examples<9>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/csv.py\n\n(2) https://datatracker.ietf.org/doc/html/rfc4180.html\n\n(3) https://peps.python.org/pep-0305/\n\nFile: python3.12.info,  Node: Module Contents<3>,  Next: Dialects and Formatting Parameters,  Up: csv -- CSV File Reading and Writing\n\n5.14.1.1 Module Contents\n........................\n\nThe *note csv: 27. module defines the following functions:\n\n-- Function: csv.reader (csvfile, dialect='excel', fmtparams)\n\nReturn a *note reader object: 274c. that will process lines from\nthe given 'csvfile'.  A csvfile must be an iterable of strings,\neach in the reader's defined csv format.  A csvfile is most\ncommonly a file-like object or list.  If 'csvfile' is a file\nobject, it should be opened with 'newline='''.  (1)  An optional\n'dialect' parameter can be given which is used to define a set of\nparameters specific to a particular CSV dialect.  It may be an\ninstance of a subclass of the *note Dialect: 15e2. class or one of\nthe strings returned by the *note listdialects(): 1567. function.\nThe other optional 'fmtparams' keyword arguments can be given to\noverride individual formatting parameters in the current dialect.\nFor full details about the dialect and formatting parameters, see\nsection *note Dialects and Formatting Parameters: 274d.\n\nEach row read from the csv file is returned as a list of strings.\nNo automatic data type conversion is performed unless the\n'QUOTENONNUMERIC' format option is specified (in which case\nunquoted fields are transformed into floats).\n\nA short usage example:\n\n>>> import csv\n>>> with open('eggs.csv', newline='') as csvfile:\n...     spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|')\n...     for row in spamreader:\n...         print(', '.join(row))\nSpam, Spam, Spam, Spam, Spam, Baked Beans\nSpam, Lovely Spam, Wonderful Spam\n\n-- Function: csv.writer (csvfile, dialect='excel', fmtparams)\n\nReturn a writer object responsible for converting the user's data\ninto delimited strings on the given file-like object.  'csvfile'\ncan be any object with a *note write(): 19f9. method.  If 'csvfile'\nis a file object, it should be opened with 'newline=''' (2).  An\noptional 'dialect' parameter can be given which is used to define a\nset of parameters specific to a particular CSV dialect.  It may be\nan instance of a subclass of the *note Dialect: 15e2. class or one\nof the strings returned by the *note listdialects(): 1567.\nfunction.  The other optional 'fmtparams' keyword arguments can be\ngiven to override individual formatting parameters in the current\ndialect.  For full details about dialects and formatting\nparameters, see the *note Dialects and Formatting Parameters: 274d.\nsection.  To make it as easy as possible to interface with modules\nwhich implement the DB API, the value *note None: 43f. is written\nas the empty string.  While this isn't a reversible transformation,\nit makes it easier to dump SQL NULL data values to CSV files\nwithout preprocessing the data returned from a 'cursor.fetch*'\ncall.  All other non-string data are stringified with *note str():\n157. before being written.\n\nA short usage example:\n\nimport csv\nwith open('eggs.csv', 'w', newline='') as csvfile:\nspamwriter = csv.writer(csvfile, delimiter=' ',\nquotechar='|', quoting=csv.QUOTEMINIMAL)\nspamwriter.writerow(['Spam'] * 5 + ['Baked Beans'])\nspamwriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam'])\n\n-- Function: csv.registerdialect (name[, dialect[, fmtparams]])\n\nAssociate 'dialect' with 'name'.  'name' must be a string.  The\ndialect can be specified either by passing a sub-class of *note\nDialect: 15e2, or by 'fmtparams' keyword arguments, or both, with\nkeyword arguments overriding parameters of the dialect.  For full\ndetails about dialects and formatting parameters, see section *note\nDialects and Formatting Parameters: 274d.\n\n-- Function: csv.unregisterdialect (name)\n\nDelete the dialect associated with 'name' from the dialect\nregistry.  An *note Error: 274f. is raised if 'name' is not a\nregistered dialect name.\n\n-- Function: csv.getdialect (name)\n\nReturn the dialect associated with 'name'.  An *note Error: 274f.\nis raised if 'name' is not a registered dialect name.  This\nfunction returns an immutable *note Dialect: 15e2.\n\n-- Function: csv.listdialects ()\n\nReturn the names of all registered dialects.\n\n-- Function: csv.fieldsizelimit ([newlimit])\n\nReturns the current maximum field size allowed by the parser.  If\n'newlimit' is given, this becomes the new limit.\n\nThe *note csv: 27. module defines the following classes:\n\n-- Class: csv.DictReader (f, fieldnames=None, restkey=None,\nrestval=None, dialect='excel', *args, kwds)\n\nCreate an object that operates like a regular reader but maps the\ninformation in each row to a *note dict: 237. whose keys are given\nby the optional 'fieldnames' parameter.\n\nThe 'fieldnames' parameter is a *note sequence: 236.  If\n'fieldnames' is omitted, the values in the first row of file 'f'\nwill be used as the fieldnames.  Regardless of how the fieldnames\nare determined, the dictionary preserves their original ordering.\n\nIf a row has more fields than fieldnames, the remaining data is put\nin a list and stored with the fieldname specified by 'restkey'\n(which defaults to 'None').  If a non-blank row has fewer fields\nthan fieldnames, the missing values are filled-in with the value of\n'restval' (which defaults to 'None').\n\nAll other optional or keyword arguments are passed to the\nunderlying *note reader: 12f7. instance.\n\nIf the argument passed to 'fieldnames' is an iterator, it will be\ncoerced to a *note list: 3dc.\n\nChanged in version 3.6: Returned rows are now of type\n'OrderedDict'.\n\nChanged in version 3.8: Returned rows are now of type *note dict:\n237.\n\nA short usage example:\n\n>>> import csv\n>>> with open('names.csv', newline='') as csvfile:\n...     reader = csv.DictReader(csvfile)\n...     for row in reader:\n...         print(row['firstname'], row['lastname'])\n...\nEric Idle\nJohn Cleese\n\n>>> print(row)\n{'firstname': 'John', 'lastname': 'Cleese'}\n\n-- Class: csv.DictWriter (f, fieldnames, restval='',\nextrasaction='raise', dialect='excel', *args, kwds)\n\nCreate an object which operates like a regular writer but maps\ndictionaries onto output rows.  The 'fieldnames' parameter is a\n*note sequence: 1c. of keys that identify the order in which values\nin the dictionary passed to the *note writerow(): c47. method are\nwritten to file 'f'.  The optional 'restval' parameter specifies\nthe value to be written if the dictionary is missing a key in\n'fieldnames'.  If the dictionary passed to the *note writerow():\nc47. method contains a key not found in 'fieldnames', the optional\n'extrasaction' parameter indicates what action to take.  If it is\nset to ''raise'', the default value, a *note ValueError: 183. is\nraised.  If it is set to ''ignore'', extra values in the dictionary\nare ignored.  Any other optional or keyword arguments are passed to\nthe underlying *note writer: 1a2. instance.\n\nNote that unlike the *note DictReader: 80b. class, the 'fieldnames'\nparameter of the *note DictWriter: 1072. class is not optional.\n\nIf the argument passed to 'fieldnames' is an iterator, it will be\ncoerced to a *note list: 3dc.\n\nA short usage example:\n\nimport csv\n\nwith open('names.csv', 'w', newline='') as csvfile:\nfieldnames = ['firstname', 'lastname']\nwriter = csv.DictWriter(csvfile, fieldnames=fieldnames)\n\nwriter.writeheader()\nwriter.writerow({'firstname': 'Baked', 'lastname': 'Beans'})\nwriter.writerow({'firstname': 'Lovely', 'lastname': 'Spam'})\nwriter.writerow({'firstname': 'Wonderful', 'lastname': 'Spam'})\n\n-- Class: csv.Dialect\n\nThe *note Dialect: 15e2. class is a container class whose\nattributes contain information for how to handle doublequotes,\nwhitespace, delimiters, etc.  Due to the lack of a strict CSV\nspecification, different applications produce subtly different CSV\ndata.  *note Dialect: 15e2. instances define how *note reader:\n12f7. and *note writer: 1a2. instances behave.\n\nAll available *note Dialect: 15e2. names are returned by *note\nlistdialects(): 1567, and they can be registered with specific\n*note reader: 12f7. and *note writer: 1a2. classes through their\ninitializer ('init') functions like this:\n\nimport csv\n\nwith open('students.csv', 'w', newline='') as csvfile:\nwriter = csv.writer(csvfile, dialect='unix')\n\n-- Class: csv.excel\n\nThe *note excel: 2750. class defines the usual properties of an\nExcel-generated CSV file.  It is registered with the dialect name\n''excel''.\n\n-- Class: csv.exceltab\n\nThe *note exceltab: 2751. class defines the usual properties of an\nExcel-generated TAB-delimited file.  It is registered with the\ndialect name ''excel-tab''.\n\n-- Class: csv.unixdialect\n\nThe *note unixdialect: 1071. class defines the usual properties of\na CSV file generated on UNIX systems, i.e.  using ''\\n'' as line\nterminator and quoting all fields.  It is registered with the\ndialect name ''unix''.\n\nNew in version 3.2.\n\n-- Class: csv.Sniffer\n\nThe *note Sniffer: 2752. class is used to deduce the format of a\nCSV file.\n\nThe *note Sniffer: 2752. class provides two methods:\n\n-- Method: sniff (sample, delimiters=None)\n\nAnalyze the given 'sample' and return a *note Dialect: 15e2.\nsubclass reflecting the parameters found.  If the optional\n'delimiters' parameter is given, it is interpreted as a string\ncontaining possible valid delimiter characters.\n\n-- Method: hasheader (sample)\n\nAnalyze the sample text (presumed to be in CSV format) and\nreturn *note True: a53. if the first row appears to be a\nseries of column headers.  Inspecting each column, one of two\nkey criteria will be considered to estimate if the sample\ncontains a header:\n\n- the second through n-th rows contain numeric values\n\n- the second through n-th rows contain strings where at\nleast one value's length differs from that of the\nputative header of that column.\n\nTwenty rows after the first row are sampled; if more than half\nof columns + rows meet the criteria, *note True: a53. is\nreturned.\n\nNote: This method is a rough heuristic and may produce both\nfalse positives and negatives.\n\nAn example for *note Sniffer: 2752. use:\n\nwith open('example.csv', newline='') as csvfile:\ndialect = csv.Sniffer().sniff(csvfile.read(1024))\ncsvfile.seek(0)\nreader = csv.reader(csvfile, dialect)\n# ... process CSV file contents here ...\nThe *note csv: 27. module defines the following constants:\n\n-- Data: csv.QUOTEALL\n\nInstructs *note writer: 1a2. objects to quote all fields.\n\n-- Data: csv.QUOTEMINIMAL\n\nInstructs *note writer: 1a2. objects to only quote those fields\nwhich contain special characters such as 'delimiter', 'quotechar'\nor any of the characters in 'lineterminator'.\n\n-- Data: csv.QUOTENONNUMERIC\n\nInstructs *note writer: 1a2. objects to quote all non-numeric\nfields.\n\nInstructs *note reader: 12f7. objects to convert all non-quoted\nfields to type 'float'.\n\n-- Data: csv.QUOTENONE\n\nInstructs *note writer: 1a2. objects to never quote fields.  When\nthe current 'delimiter' occurs in output data it is preceded by the\ncurrent 'escapechar' character.  If 'escapechar' is not set, the\nwriter will raise *note Error: 274f. if any characters that require\nescaping are encountered.\n\nInstructs *note reader: 12f7. objects to perform no special\nprocessing of quote characters.\n\n-- Data: csv.QUOTENOTNULL\n\nInstructs *note writer: 1a2. objects to quote all fields which are\nnot 'None'.  This is similar to *note QUOTEALL: 2755, except that\nif a field value is 'None' an empty (unquoted) string is written.\n\nInstructs *note reader: 12f7. objects to interpret an empty\n(unquoted) field as None and to otherwise behave as *note\nQUOTEALL: 2755.\n\nNew in version 3.12.\n\n-- Data: csv.QUOTESTRINGS\n\nInstructs *note writer: 1a2. objects to always place quotes around\nfields which are strings.  This is similar to *note\nQUOTENONNUMERIC: 2757, except that if a field value is 'None' an\nempty (unquoted) string is written.\n\nInstructs *note reader: 12f7. objects to interpret an empty\n(unquoted) string as 'None' and to otherwise behave as *note\nQUOTENONNUMERIC: 2757.\n\nNew in version 3.12.\n\nThe *note csv: 27. module defines the following exception:\n\n-- Exception: csv.Error\n\nRaised by any of the functions when an error is detected.\n\n---------- Footnotes ----------\n\n(1) If 'newline=''' is not specified, newlines embedded inside quoted\nfields will not be interpreted correctly, and on platforms that use\n'\\r\\n' linendings on write an extra '\\r' will be added.  It should\nalways be safe to specify 'newline=''', since the csv module does its\nown (*note universal: b90.) newline handling.\n\n(2) If 'newline=''' is not specified, newlines embedded inside quoted\nfields will not be interpreted correctly, and on platforms that use\n'\\r\\n' linendings on write an extra '\\r' will be added.  It should\nalways be safe to specify 'newline=''', since the csv module does its\nown (*note universal: b90.) newline handling.\n\nFile: python3.12.info,  Node: Dialects and Formatting Parameters,  Next: Reader Objects,  Prev: Module Contents<3>,  Up: csv -- CSV File Reading and Writing\n\n5.14.1.2 Dialects and Formatting Parameters\n...........................................\n",
            "subsections": []
        },
        "To make it easier to specify the format of input and output records,": {
            "content": "specific formatting parameters are grouped together into dialects.  A\ndialect is a subclass of the *note Dialect: 15e2. class containing\nvarious attributes describing the format of the CSV file.  When creating\n*note reader: 12f7. or *note writer: 1a2. objects, the programmer can\nspecify a string or a subclass of the *note Dialect: 15e2. class as the\ndialect parameter.  In addition to, or instead of, the 'dialect'\nparameter, the programmer can also specify individual formatting\nparameters, which have the same names as the attributes defined below\nfor the *note Dialect: 15e2. class.\n\nDialects support the following attributes:\n\n-- Attribute: Dialect.delimiter\n\nA one-character string used to separate fields.  It defaults to\n'',''.\n\n-- Attribute: Dialect.doublequote\n\nControls how instances of 'quotechar' appearing inside a field\nshould themselves be quoted.  When *note True: a53, the character\nis doubled.  When *note False: 971, the 'escapechar' is used as a\nprefix to the 'quotechar'.  It defaults to *note True: a53.\n\nOn output, if 'doublequote' is *note False: 971. and no\n'escapechar' is set, *note Error: 274f. is raised if a 'quotechar'\nis found in a field.\n\n-- Attribute: Dialect.escapechar\n\nA one-character string used by the writer to escape the 'delimiter'\nif 'quoting' is set to *note QUOTENONE: 2758. and the 'quotechar'\nif 'doublequote' is *note False: 971.  On reading, the 'escapechar'\nremoves any special meaning from the following character.  It\ndefaults to *note None: 43f, which disables escaping.\n\nChanged in version 3.11: An empty 'escapechar' is not allowed.\n\n-- Attribute: Dialect.lineterminator\n\nThe string used to terminate lines produced by the *note writer:\n1a2.  It defaults to ''\\r\\n''.\n\nNote: The *note reader: 12f7. is hard-coded to recognise\neither ''\\r'' or ''\\n'' as end-of-line, and ignores\n'lineterminator'.  This behavior may change in the future.\n\n-- Attribute: Dialect.quotechar\n\nA one-character string used to quote fields containing special\ncharacters, such as the 'delimiter' or 'quotechar', or which\ncontain new-line characters.  It defaults to ''\"''.\n\nChanged in version 3.11: An empty 'quotechar' is not allowed.\n\n-- Attribute: Dialect.quoting\n\nControls when quotes should be generated by the writer and\nrecognised by the reader.  It can take on any of the *note QUOTE*\nconstants: 2754. and defaults to *note QUOTEMINIMAL: 2756.\n\n-- Attribute: Dialect.skipinitialspace\n\nWhen *note True: a53, spaces immediately following the 'delimiter'\nare ignored.  The default is *note False: 971.\n\n-- Attribute: Dialect.strict\n\nWhen 'True', raise exception *note Error: 274f. on bad CSV input.\nThe default is 'False'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Reader Objects,  Next: Writer Objects,  Prev: Dialects and Formatting Parameters,  Up: csv -- CSV File Reading and Writing": {
            "content": "5.14.1.3 Reader Objects\n.......................\n\nReader objects (*note DictReader: 80b. instances and objects returned by\nthe *note reader(): 12f7. function) have the following public methods:\n\n-- Method: csvreader.next ()\n\nReturn the next row of the reader's iterable object as a list (if\nthe object was returned from *note reader(): 12f7.) or a dict (if\nit is a *note DictReader: 80b. instance), parsed according to the\ncurrent *note Dialect: 15e2.  Usually you should call this as\n'next(reader)'.\n\nReader objects have the following public attributes:\n\n-- Attribute: csvreader.dialect\n\nA read-only description of the dialect in use by the parser.\n\n-- Attribute: csvreader.linenum\n\nThe number of lines read from the source iterator.  This is not the\nsame as the number of records returned, as records can span\nmultiple lines.\n\nDictReader objects have the following public attribute:\n\n-- Attribute: DictReader.fieldnames\n\nIf not passed as a parameter when creating the object, this\nattribute is initialized upon first access or when the first record\nis read from the file.\n\nFile: python3.12.info,  Node: Writer Objects,  Next: Examples<9>,  Prev: Reader Objects,  Up: csv -- CSV File Reading and Writing\n\n5.14.1.4 Writer Objects\n.......................\n\n*note writer: 1a2. objects (*note DictWriter: 1072. instances and\nobjects returned by the *note writer(): 1a2. function) have the\nfollowing public methods.  A 'row' must be an iterable of strings or\nnumbers for *note writer: 1a2. objects and a dictionary mapping\nfieldnames to strings or numbers (by passing them through *note str():\n157. first) for *note DictWriter: 1072. objects.  Note that complex\nnumbers are written out surrounded by parens.  This may cause some\nproblems for other programs which read CSV files (assuming they support\ncomplex numbers at all).\n\n-- Method: csvwriter.writerow (row)\n\nWrite the 'row' parameter to the writer's file object, formatted\naccording to the current *note Dialect: 15e2.  Return the return\nvalue of the call to the 'write' method of the underlying file\nobject.\n\nChanged in version 3.5: Added support of arbitrary iterables.\n\n-- Method: csvwriter.writerows (rows)\n\nWrite all elements in 'rows' (an iterable of 'row' objects as\ndescribed above) to the writer's file object, formatted according\nto the current dialect.\n\nWriter objects have the following public attribute:\n\n-- Attribute: csvwriter.dialect\n\nA read-only description of the dialect in use by the writer.\n\nDictWriter objects have the following public method:\n\n-- Method: DictWriter.writeheader ()\n\nWrite a row with the field names (as specified in the constructor)\nto the writer's file object, formatted according to the current\ndialect.  Return the return value of the *note\ncsvwriter.writerow(): c47. call used internally.\n\nNew in version 3.2.\n\nChanged in version 3.8: *note writeheader(): 1073. now also returns\nthe value returned by the *note csvwriter.writerow(): c47. method\nit uses internally.\n\nFile: python3.12.info,  Node: Examples<9>,  Prev: Writer Objects,  Up: csv -- CSV File Reading and Writing\n\n5.14.1.5 Examples\n.................\n\nThe simplest example of reading a CSV file:\n\nimport csv\nwith open('some.csv', newline='') as f:\nreader = csv.reader(f)\nfor row in reader:\nprint(row)\n\nReading a file with an alternate format:\n\nimport csv\nwith open('passwd', newline='') as f:\nreader = csv.reader(f, delimiter=':', quoting=csv.QUOTENONE)\nfor row in reader:\nprint(row)\n\nThe corresponding simplest possible writing example is:\n\nimport csv\nwith open('some.csv', 'w', newline='') as f:\nwriter = csv.writer(f)\nwriter.writerows(someiterable)\n\nSince *note open(): 26e. is used to open a CSV file for reading, the\nfile will by default be decoded into unicode using the system default\nencoding (see *note locale.getencoding(): 41f.).  To decode a file using\na different encoding, use the 'encoding' argument of open:\n\nimport csv\nwith open('some.csv', newline='', encoding='utf-8') as f:\nreader = csv.reader(f)\nfor row in reader:\nprint(row)\n",
            "subsections": []
        },
        "The same applies to writing in something other than the system default": {
            "content": "encoding: specify the encoding argument when opening the output file.\n\nRegistering a new dialect:\n\nimport csv\ncsv.registerdialect('unixpwd', delimiter=':', quoting=csv.QUOTENONE)\nwith open('passwd', newline='') as f:\nreader = csv.reader(f, 'unixpwd')\n\nA slightly more advanced use of the reader -- catching and reporting\nerrors:\n\nimport csv, sys\nfilename = 'some.csv'\nwith open(filename, newline='') as f:\nreader = csv.reader(f)\ntry:\nfor row in reader:\nprint(row)\nexcept csv.Error as e:\nsys.exit('file {}, line {}: {}'.format(filename, reader.linenum, e))\n",
            "subsections": []
        },
        "And while the module doesn't directly support parsing strings, it can": {
            "content": "easily be done:\n\nimport csv\nfor row in csv.reader(['one,two,three']):\nprint(row)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: configparser -- Configuration file parser,  Next: tomllib -- Parse TOML files,  Prev: csv -- CSV File Reading and Writing,  Up: File Formats": {
            "content": "'Source code:' Lib/configparser.py(1)\n\n\n\nThis module provides the *note ConfigParser: 257. class which implements\na basic configuration language which provides a structure similar to\nwhat's found in Microsoft Windows INI files.  You can use this to write\nPython programs which can be customized by end users easily.\n\nNote: This library does 'not' interpret or write the value-type\nprefixes used in the Windows Registry extended version of INI\nsyntax.\n\nSee also\n........\n\nModule *note tomllib: f7.\n\nTOML is a well-specified format for application configuration\nfiles.  It is specifically designed to be an improved version of\nINI.\n\nModule *note shlex: bf.\n\nSupport for creating Unix shell-like mini-languages which can also\nbe used for application configuration files.\n\nModule *note json: 7c.\n\nThe 'json' module implements a subset of JavaScript syntax which is\nsometimes used for configuration, but does not support comments.\n\n* Menu:\n\n* Quick Start::\n* Supported Datatypes::\n* Fallback Values::\n* Supported INI File Structure::\n* Interpolation of values::\n* Mapping Protocol Access::\n* Customizing Parser Behaviour::\n* Legacy API Examples::\n* ConfigParser Objects::\n* RawConfigParser Objects::\n* Exceptions: Exceptions<7>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/configparser.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Quick Start,  Next: Supported Datatypes,  Up: configparser -- Configuration file parser": {
            "content": "5.14.2.1 Quick Start\n....................\n\nLet's take a very basic configuration file that looks like this:\n\n[DEFAULT]\nServerAliveInterval = 45\nCompression = yes\nCompressionLevel = 9\nForwardX11 = yes\n\n[forge.example]\nUser = hg\n\n[topsecret.server.example]\nPort = 50022\nForwardX11 = no\n\nThe structure of INI files is described *note in the following section:\n276f.  Essentially, the file consists of sections, each of which\ncontains keys with values.  *note configparser: 20. classes can read and\nwrite such files.  Let's start by creating the above configuration file\nprogrammatically.\n\n>>> import configparser\n>>> config = configparser.ConfigParser()\n>>> config['DEFAULT'] = {'ServerAliveInterval': '45',\n...                      'Compression': 'yes',\n...                      'CompressionLevel': '9'}\n>>> config['forge.example'] = {}\n>>> config['forge.example']['User'] = 'hg'\n>>> config['topsecret.server.example'] = {}\n>>> topsecret = config['topsecret.server.example']\n>>> topsecret['Port'] = '50022'     # mutates the parser\n>>> topsecret['ForwardX11'] = 'no'  # same here\n>>> config['DEFAULT']['ForwardX11'] = 'yes'\n>>> with open('example.ini', 'w') as configfile:\n...   config.write(configfile)\n...\n\nAs you can see, we can treat a config parser much like a dictionary.\nThere are differences, *note outlined later: 2770, but the behavior is\nvery close to what you would expect from a dictionary.\n",
            "subsections": []
        },
        "Now that we have created and saved a configuration file, let's read it": {
            "content": "back and explore the data it holds.\n\n>>> config = configparser.ConfigParser()\n>>> config.sections()\n[]\n>>> config.read('example.ini')\n['example.ini']\n>>> config.sections()\n['forge.example', 'topsecret.server.example']\n>>> 'forge.example' in config\nTrue\n>>> 'python.org' in config\nFalse\n>>> config['forge.example']['User']\n'hg'\n>>> config['DEFAULT']['Compression']\n'yes'\n>>> topsecret = config['topsecret.server.example']\n>>> topsecret['ForwardX11']\n'no'\n>>> topsecret['Port']\n'50022'\n>>> for key in config['forge.example']:\n...     print(key)\nuser\ncompressionlevel\nserveraliveinterval\ncompression\nforwardx11\n>>> config['forge.example']['ForwardX11']\n'yes'\n",
            "subsections": []
        },
        "As we can see above, the API is pretty straightforward.  The only bit of": {
            "content": "magic involves the 'DEFAULT' section which provides default values for\nall other sections (1).  Note also that keys in sections are\ncase-insensitive and stored in lowercase (2).\n\nIt is possible to read several configurations into a single *note",
            "subsections": []
        },
        "ConfigParser: 257, where the most recently added configuration has the": {
            "content": "highest priority.  Any conflicting keys are taken from the more recent\nconfiguration while the previously existing keys are retained.\n\n>>> anotherconfig = configparser.ConfigParser()\n>>> anotherconfig.read('example.ini')\n['example.ini']\n>>> anotherconfig['topsecret.server.example']['Port']\n'50022'\n>>> anotherconfig.readstring(\"[topsecret.server.example]\\nPort=48484\")\n>>> anotherconfig['topsecret.server.example']['Port']\n'48484'\n>>> anotherconfig.readdict({\"topsecret.server.example\": {\"Port\": 21212}})\n>>> anotherconfig['topsecret.server.example']['Port']\n'21212'\n>>> anotherconfig['topsecret.server.example']['ForwardX11']\n'no'\n\nThis behaviour is equivalent to a *note ConfigParser.read(): 12bd. call\nwith several files passed to the 'filenames' parameter.\n\n---------- Footnotes ----------\n\n(1) Config parsers allow for heavy customization.  If you are\ninterested in changing the behaviour outlined by the footnote reference,\nconsult the *note Customizing Parser Behaviour: 2771. section.\n\n(2) Config parsers allow for heavy customization.  If you are\ninterested in changing the behaviour outlined by the footnote reference,\nconsult the *note Customizing Parser Behaviour: 2771. section.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Supported Datatypes,  Next: Fallback Values,  Prev: Quick Start,  Up: configparser -- Configuration file parser": {
            "content": "5.14.2.2 Supported Datatypes\n............................\n",
            "subsections": []
        },
        "Config parsers do not guess datatypes of values in configuration files,": {
            "content": "always storing them internally as strings.  This means that if you need\nother datatypes, you should convert on your own:\n\n>>> int(topsecret['Port'])\n50022\n>>> float(topsecret['CompressionLevel'])\n9.0\n",
            "subsections": []
        },
        "Since this task is so common, config parsers provide a range of handy": {
            "content": "getter methods to handle integers, floats and booleans.  The last one is\nthe most interesting because simply passing the value to 'bool()' would\ndo no good since 'bool('False')' is still 'True'.  This is why config\nparsers also provide *note getboolean(): 2773.  This method is\ncase-insensitive and recognizes Boolean values from ''yes''/''no'',\n''on''/''off'', ''true''/''false'' and ''1''/''0'' (1).  For example:\n\n>>> topsecret.getboolean('ForwardX11')\nFalse\n>>> config['forge.example'].getboolean('ForwardX11')\nTrue\n>>> config.getboolean('forge.example', 'Compression')\nTrue\n\nApart from *note getboolean(): 2773, config parsers also provide\nequivalent *note getint(): 2774. and *note getfloat(): 2775. methods.\nYou can register your own converters and customize the provided ones.\n(2)\n\n---------- Footnotes ----------\n\n(1) Config parsers allow for heavy customization.  If you are\ninterested in changing the behaviour outlined by the footnote reference,\nconsult the *note Customizing Parser Behaviour: 2771. section.\n\n(2) Config parsers allow for heavy customization.  If you are\ninterested in changing the behaviour outlined by the footnote reference,\nconsult the *note Customizing Parser Behaviour: 2771. section.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Fallback Values,  Next: Supported INI File Structure,  Prev: Supported Datatypes,  Up: configparser -- Configuration file parser": {
            "content": "5.14.2.3 Fallback Values\n........................\n\nAs with a dictionary, you can use a section's *note get(): 10e4. method\nto provide fallback values:\n\n>>> topsecret.get('Port')\n'50022'\n>>> topsecret.get('CompressionLevel')\n'9'\n>>> topsecret.get('Cipher')\n>>> topsecret.get('Cipher', '3des-cbc')\n'3des-cbc'\n\nPlease note that default values have precedence over fallback values.",
            "subsections": []
        },
        "For instance, in our example the ''CompressionLevel'' key was specified": {
            "content": "only in the ''DEFAULT'' section.  If we try to get it from the section\n''topsecret.server.example'', we will always get the default, even if we\nspecify a fallback:\n\n>>> topsecret.get('CompressionLevel', '3')\n'9'\n\nOne more thing to be aware of is that the parser-level *note get():\n10e4. method provides a custom, more complex interface, maintained for\nbackwards compatibility.  When using this method, a fallback value can\nbe provided via the 'fallback' keyword-only argument:\n\n>>> config.get('forge.example', 'monster',\n...            fallback='No such things as monsters')\n'No such things as monsters'\n\nThe same 'fallback' argument can be used with the *note getint(): 2774,\n*note getfloat(): 2775. and *note getboolean(): 2773. methods, for\nexample:\n\n>>> 'BatchMode' in topsecret\nFalse\n>>> topsecret.getboolean('BatchMode', fallback=True)\nTrue\n>>> config['DEFAULT']['BatchMode'] = 'no'\n>>> topsecret.getboolean('BatchMode', fallback=True)\nFalse\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Supported INI File Structure,  Next: Interpolation of values,  Prev: Fallback Values,  Up: configparser -- Configuration file parser": {
            "content": "5.14.2.4 Supported INI File Structure\n.....................................\n\nA configuration file consists of sections, each led by a '[section]'\nheader, followed by key/value entries separated by a specific string\n('=' or ':' by default (1)).  By default, section names are case\nsensitive but keys are not (2).  Leading and trailing whitespace is\nremoved from keys and values.  Values can be omitted if the parser is\nconfigured to allow it (3), in which case the key/value delimiter may\nalso be left out.  Values can also span multiple lines, as long as they\nare indented deeper than the first line of the value.  Depending on the\nparser's mode, blank lines may be treated as parts of multiline values\nor ignored.\n",
            "subsections": []
        },
        "By default, a valid section name can be any string that does not contain": {
            "content": "'\\n'.  To change this, see *note ConfigParser.SECTCRE: 2777.\n",
            "subsections": []
        },
        "Configuration files may include comments, prefixed by specific": {
            "content": "characters ('#' and ';' by default (4)).  Comments may appear on their\nown on an otherwise empty line, possibly indented.  (5)\n\nFor example:\n\n[Simple Values]\nkey=value\nspaces in keys=allowed\nspaces in values=allowed as well\nspaces around the delimiter = obviously\nyou can also use : to delimit keys from values\n\n[All Values Are Strings]\nvalues like this: 1000000\nor this: 3.14159265359\nare they treated as numbers? : no\nintegers, floats and booleans are held as: strings\ncan use the API to get converted values directly: true\n\n[Multiline Values]\nchorus: I'm a lumberjack, and I'm okay\nI sleep all night and I work all day\n\n[No Values]\nkeywithoutvalue\nempty string value here =\n\n[You can use comments]\n# like this\n; or this\n\n# By default only in an empty line.\n# Inline comments can be harmful because they prevent users\n# from using the delimiting characters as parts of values.\n# That being said, this can be customized.\n\n[Sections Can Be Indented]\ncanvaluesbeaswell = True\ndoesthatmeananythingspecial = False\npurpose = formatting for readability\nmultilinevalues = are\nhandled just fine as\nlong as they are indented\ndeeper than the first line\nof a value\n# Did I mention we can indent comments, too?\n\n---------- Footnotes ----------\n\n(1) Config parsers allow for heavy customization.  If you are\ninterested in changing the behaviour outlined by the footnote reference,\nconsult the *note Customizing Parser Behaviour: 2771. section.\n\n(2) Config parsers allow for heavy customization.  If you are\ninterested in changing the behaviour outlined by the footnote reference,\nconsult the *note Customizing Parser Behaviour: 2771. section.\n\n(3) Config parsers allow for heavy customization.  If you are\ninterested in changing the behaviour outlined by the footnote reference,\nconsult the *note Customizing Parser Behaviour: 2771. section.\n\n(4) Config parsers allow for heavy customization.  If you are\ninterested in changing the behaviour outlined by the footnote reference,\nconsult the *note Customizing Parser Behaviour: 2771. section.\n\n(5) Config parsers allow for heavy customization.  If you are\ninterested in changing the behaviour outlined by the footnote reference,\nconsult the *note Customizing Parser Behaviour: 2771. section.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Interpolation of values,  Next: Mapping Protocol Access,  Prev: Supported INI File Structure,  Up: configparser -- Configuration file parser": {
            "content": "5.14.2.5 Interpolation of values\n................................\n\nOn top of the core functionality, *note ConfigParser: 257. supports\ninterpolation.  This means values can be preprocessed before returning\nthem from 'get()' calls.\n\n-- Class: configparser.BasicInterpolation\n\nThe default implementation used by *note ConfigParser: 257.  It\nenables values to contain format strings which refer to other\nvalues in the same section, or values in the special default\nsection (1).  Additional default values can be provided on\ninitialization.\n\nFor example:\n\n[Paths]\nhomedir: /Users\nmydir: %(homedir)s/lumberjack\nmypictures: %(mydir)s/Pictures\n\n[Escape]\n# use a %% to escape the % sign (% is the only character that needs to be escaped):\ngain: 80%%\n\nIn the example above, *note ConfigParser: 257. with 'interpolation'\nset to 'BasicInterpolation()' would resolve '%(homedir)s' to the\nvalue of 'homedir' ('/Users' in this case).  '%(mydir)s' in\neffect would resolve to '/Users/lumberjack'.  All interpolations\nare done on demand so keys used in the chain of references do not\nhave to be specified in any specific order in the configuration\nfile.\n\nWith 'interpolation' set to 'None', the parser would simply return\n'%(mydir)s/Pictures' as the value of 'mypictures' and\n'%(homedir)s/lumberjack' as the value of 'mydir'.\n\n-- Class: configparser.ExtendedInterpolation\n\nAn alternative handler for interpolation which implements a more\nadvanced syntax, used for instance in 'zc.buildout'.  Extended\ninterpolation is using '${section:option}' to denote a value from a\nforeign section.  Interpolation can span multiple levels.  For\nconvenience, if the 'section:' part is omitted, interpolation\ndefaults to the current section (and possibly the default values\nfrom the special section).\n\nFor example, the configuration specified above with basic\ninterpolation, would look like this with extended interpolation:\n\n[Paths]\nhomedir: /Users\nmydir: ${homedir}/lumberjack\nmypictures: ${mydir}/Pictures\n\n[Escape]\n# use a $$ to escape the $ sign ($ is the only character that needs to be escaped):\ncost: $$80\n\nValues from other sections can be fetched as well:\n\n[Common]\nhomedir: /Users\nlibrarydir: /Library\nsystemdir: /System\nmacportsdir: /opt/local\n\n[Frameworks]\nPython: 3.2\npath: ${Common:systemdir}/Library/Frameworks/\n\n[Arthur]\nnickname: Two Sheds\nlastname: Jackson\nmydir: ${Common:homedir}/twosheds\nmypictures: ${mydir}/Pictures\npythondir: ${Frameworks:path}/Python/Versions/${Frameworks:Python}\n\n---------- Footnotes ----------\n\n(1) Config parsers allow for heavy customization.  If you are\ninterested in changing the behaviour outlined by the footnote reference,\nconsult the *note Customizing Parser Behaviour: 2771. section.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Mapping Protocol Access,  Next: Customizing Parser Behaviour,  Prev: Interpolation of values,  Up: configparser -- Configuration file parser": {
            "content": "5.14.2.6 Mapping Protocol Access\n................................\n\nNew in version 3.2.\n",
            "subsections": []
        },
        "Mapping protocol access is a generic name for functionality that enables": {
            "content": "using custom objects as if they were dictionaries.  In case of *note\nconfigparser: 20, the mapping interface implementation is using the\n'parser['section']['option']' notation.\n\n'parser['section']' in particular returns a proxy for the section's data\nin the parser.  This means that the values are not copied but they are\ntaken from the original parser on demand.  What's even more important is\nthat when values are changed on a section proxy, they are actually\nmutated in the original parser.\n\n*note configparser: 20. objects behave as close to actual dictionaries\nas possible.  The mapping interface is complete and adheres to the *note",
            "subsections": []
        },
        "MutableMapping: f1e. ABC. However, there are a few differences that": {
            "content": "should be taken into account:\n\n* By default, all keys in sections are accessible in a\ncase-insensitive manner (1).  E.g.  'for option in\nparser[\"section\"]' yields only 'optionxform''ed option key names.\nThis means lowercased keys by default.  At the same time, for a\nsection that holds the key ''a'', both expressions return 'True':\n\n\"a\" in parser[\"section\"]\n\"A\" in parser[\"section\"]\n\n* All sections include 'DEFAULTSECT' values as well which means that\n'.clear()' on a section may not leave the section visibly empty.\nThis is because default values cannot be deleted from the section\n(because technically they are not there).  If they are overridden\nin the section, deleting causes the default value to be visible\nagain.  Trying to delete a default value causes a *note KeyError:\n8cf.\n\n* 'DEFAULTSECT' cannot be removed from the parser:\n\n* trying to delete it raises *note ValueError: 183,\n\n* 'parser.clear()' leaves it intact,\n\n* 'parser.popitem()' never returns it.\n\n* 'parser.get(section, option, kwargs)' - the second argument is\n'not' a fallback value.  Note however that the section-level\n'get()' methods are compatible both with the mapping protocol and\nthe classic configparser API.\n\n* 'parser.items()' is compatible with the mapping protocol (returns a\nlist of 'sectionname', 'sectionproxy' pairs including the\nDEFAULTSECT). However, this method can also be invoked with\narguments: 'parser.items(section, raw, vars)'.  The latter call\nreturns a list of 'option', 'value' pairs for a specified\n'section', with all interpolations expanded (unless 'raw=True' is\nprovided).\n",
            "subsections": []
        },
        "The mapping protocol is implemented on top of the existing legacy API so": {
            "content": "that subclasses overriding the original interface still should have\nmappings working as expected.\n\n---------- Footnotes ----------\n\n(1) Config parsers allow for heavy customization.  If you are\ninterested in changing the behaviour outlined by the footnote reference,\nconsult the *note Customizing Parser Behaviour: 2771. section.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Customizing Parser Behaviour,  Next: Legacy API Examples,  Prev: Mapping Protocol Access,  Up: configparser -- Configuration file parser": {
            "content": "5.14.2.7 Customizing Parser Behaviour\n.....................................\n",
            "subsections": []
        },
        "There are nearly as many INI format variants as there are applications": {
            "content": "using it.  *note configparser: 20. goes a long way to provide support\nfor the largest sensible set of INI styles available.  The default\nfunctionality is mainly dictated by historical background and it's very\nlikely that you will want to customize some of the features.\n",
            "subsections": []
        },
        "The most common way to change the way a specific config parser works is": {
            "content": "to use the 'init()' options:\n\n* 'defaults', default value: 'None'\n\nThis option accepts a dictionary of key-value pairs which will be\ninitially put in the 'DEFAULT' section.  This makes for an elegant\nway to support concise configuration files that don't specify\nvalues which are the same as the documented default.\n\nHint: if you want to specify default values for a specific section,\nuse *note readdict(): 2779. before you read the actual file.\n\n* 'dicttype', default value: *note dict: 237.\n\nThis option has a major impact on how the mapping protocol will\nbehave and how the written configuration files look.  With the\nstandard dictionary, every section is stored in the order they were\nadded to the parser.  Same goes for options within sections.\n\nAn alternative dictionary type can be used for example to sort\nsections and options on write-back.\n\nPlease note: there are ways to add a set of key-value pairs in a\nsingle operation.  When you use a regular dictionary in those\noperations, the order of the keys will be ordered.  For example:\n\n>>> parser = configparser.ConfigParser()\n>>> parser.readdict({'section1': {'key1': 'value1',\n...                                'key2': 'value2',\n...                                'key3': 'value3'},\n...                   'section2': {'keyA': 'valueA',\n...                                'keyB': 'valueB',\n...                                'keyC': 'valueC'},\n...                   'section3': {'foo': 'x',\n...                                'bar': 'y',\n...                                'baz': 'z'}\n... })\n>>> parser.sections()\n['section1', 'section2', 'section3']\n>>> [option for option in parser['section3']]\n['foo', 'bar', 'baz']\n\n* 'allownovalue', default value: 'False'\n\nSome configuration files are known to include settings without\nvalues, but which otherwise conform to the syntax supported by\n*note configparser: 20.  The 'allownovalue' parameter to the\nconstructor can be used to indicate that such values should be\naccepted:\n\n>>> import configparser\n\n>>> sampleconfig = \"\"\"\n... [mysqld]\n...   user = mysql\n...   pid-file = /var/run/mysqld/mysqld.pid\n...   skip-external-locking\n...   oldpasswords = 1\n...   skip-bdb\n...   # we don't need ACID today\n...   skip-innodb\n... \"\"\"\n>>> config = configparser.ConfigParser(allownovalue=True)\n>>> config.readstring(sampleconfig)\n\n>>> # Settings with values are treated as before:\n>>> config[\"mysqld\"][\"user\"]\n'mysql'\n\n>>> # Settings without values provide None:\n>>> config[\"mysqld\"][\"skip-bdb\"]\n\n>>> # Settings which aren't specified still raise an error:\n>>> config[\"mysqld\"][\"does-not-exist\"]\nTraceback (most recent call last):\n...\nKeyError: 'does-not-exist'\n\n* 'delimiters', default value: '('=', ':')'\n\nDelimiters are substrings that delimit keys from values within a\nsection.  The first occurrence of a delimiting substring on a line\nis considered a delimiter.  This means values (but not keys) can\ncontain the delimiters.\n\nSee also the 'spacearounddelimiters' argument to *note\nConfigParser.write(): 277a.\n\n* 'commentprefixes', default value: '('#', ';')'\n\n* 'inlinecommentprefixes', default value: 'None'\n\nComment prefixes are strings that indicate the start of a valid\ncomment within a config file.  'commentprefixes' are used only on\notherwise empty lines (optionally indented) whereas\n'inlinecommentprefixes' can be used after every valid value (e.g.\nsection names, options and empty lines as well).  By default inline\ncomments are disabled and ''#'' and '';'' are used as prefixes for\nwhole line comments.\n\nChanged in version 3.2: In previous versions of *note configparser:\n20. behaviour matched 'commentprefixes=('#',';')' and\n'inlinecommentprefixes=(';',)'.\n\nPlease note that config parsers don't support escaping of comment\nprefixes so using 'inlinecommentprefixes' may prevent users from\nspecifying option values with characters used as comment prefixes.\nWhen in doubt, avoid setting 'inlinecommentprefixes'.  In any\ncircumstances, the only way of storing comment prefix characters at\nthe beginning of a line in multiline values is to interpolate the\nprefix, for example:\n\n>>> from configparser import ConfigParser, ExtendedInterpolation\n>>> parser = ConfigParser(interpolation=ExtendedInterpolation())\n>>> # the default BasicInterpolation could be used as well\n>>> parser.readstring(\"\"\"\n... [DEFAULT]\n... hash = #\n...\n... [hashes]\n... shebang =\n...   ${hash}!/usr/bin/env python\n...   ${hash} -*- coding: utf-8 -*-\n...\n... extensions =\n...   enabledextension\n...   anotherextension\n...   #disabledbycomment\n...   yetanotherextension\n...\n... interpolation not necessary = if # is not at line start\n... even in multiline values = line #1\n...   line #2\n...   line #3\n... \"\"\")\n>>> print(parser['hashes']['shebang'])\n\n#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n>>> print(parser['hashes']['extensions'])\n\nenabledextension\nanotherextension\nyetanotherextension\n>>> print(parser['hashes']['interpolation not necessary'])\nif # is not at line start\n>>> print(parser['hashes']['even in multiline values'])\nline #1\nline #2\nline #3\n\n* 'strict', default value: 'True'\n\nWhen set to 'True', the parser will not allow for any section or\noption duplicates while reading from a single source (using *note\nreadfile(): 258, *note readstring(): 277b. or *note readdict():\n2779.).  It is recommended to use strict parsers in new\napplications.\n\nChanged in version 3.2: In previous versions of *note configparser:\n20. behaviour matched 'strict=False'.\n\n* 'emptylinesinvalues', default value: 'True'\n\nIn config parsers, values can span multiple lines as long as they\nare indented more than the key that holds them.  By default parsers\nalso let empty lines to be parts of values.  At the same time, keys\ncan be arbitrarily indented themselves to improve readability.  In\nconsequence, when configuration files get big and complex, it is\neasy for the user to lose track of the file structure.  Take for\ninstance:\n\n[Section]\nkey = multiline\nvalue with a gotcha\n\nthis = is still a part of the multiline value of 'key'\n\nThis can be especially problematic for the user to see if she's\nusing a proportional font to edit the file.  That is why when your\napplication does not need values with empty lines, you should\nconsider disallowing them.  This will make empty lines split keys\nevery time.  In the example above, it would produce two keys, 'key'\nand 'this'.\n\n* 'defaultsection', default value: 'configparser.DEFAULTSECT' (that\nis: '\"DEFAULT\"')\n\nThe convention of allowing a special section of default values for\nother sections or interpolation purposes is a powerful concept of\nthis library, letting users create complex declarative\nconfigurations.  This section is normally called '\"DEFAULT\"' but\nthis can be customized to point to any other valid section name.\nSome typical values include: '\"general\"' or '\"common\"'.  The name\nprovided is used for recognizing default sections when reading from\nany source and is used when writing configuration back to a file.\nIts current value can be retrieved using the\n'parserinstance.defaultsection' attribute and may be modified at\nruntime (i.e.  to convert files from one format to another).\n\n* 'interpolation', default value: 'configparser.BasicInterpolation'\n\nInterpolation behaviour may be customized by providing a custom\nhandler through the 'interpolation' argument.  'None' can be used\nto turn off interpolation completely, 'ExtendedInterpolation()'\nprovides a more advanced variant inspired by 'zc.buildout'.  More\non the subject in the *note dedicated documentation section: 2778.\n*note RawConfigParser: dd4. has a default value of 'None'.\n\n* 'converters', default value: not set\n\nConfig parsers provide option value getters that perform type\nconversion.  By default *note getint(): 2774, *note getfloat():\n2775, and *note getboolean(): 2773. are implemented.  Should other\ngetters be desirable, users may define them in a subclass or pass a\ndictionary where each key is a name of the converter and each value\nis a callable implementing said conversion.  For instance, passing\n'{'decimal': decimal.Decimal}' would add 'getdecimal()' on both the\nparser object and all section proxies.  In other words, it will be\npossible to write both 'parserinstance.getdecimal('section',\n'key', fallback=0)' and\n'parserinstance['section'].getdecimal('key', 0)'.\n\nIf the converter needs to access the state of the parser, it can be\nimplemented as a method on a config parser subclass.  If the name\nof this method starts with 'get', it will be available on all\nsection proxies, in the dict-compatible form (see the\n'getdecimal()' example above).\n",
            "subsections": []
        },
        "More advanced customization may be achieved by overriding default values": {
            "content": "of these parser attributes.  The defaults are defined on the classes, so\nthey may be overridden by subclasses or by attribute assignment.\n\n-- Attribute: ConfigParser.BOOLEANSTATES\n\nBy default when using *note getboolean(): 2773, config parsers\nconsider the following values 'True': ''1'', ''yes'', ''true'',\n''on'' and the following values 'False': ''0'', ''no'', ''false'',\n''off''.  You can override this by specifying a custom dictionary\nof strings and their Boolean outcomes.  For example:\n\n>>> custom = configparser.ConfigParser()\n>>> custom['section1'] = {'funky': 'nope'}\n>>> custom['section1'].getboolean('funky')\nTraceback (most recent call last):\n...\nValueError: Not a boolean: nope\n>>> custom.BOOLEANSTATES = {'sure': True, 'nope': False}\n>>> custom['section1'].getboolean('funky')\nFalse\n\nOther typical Boolean pairs include 'accept'/'reject' or\n'enabled'/'disabled'.\n\n-- Method: ConfigParser.optionxform (option)\n\nThis method transforms option names on every read, get, or set\noperation.  The default converts the name to lowercase.  This also\nmeans that when a configuration file gets written, all keys will be\nlowercase.  Override this method if that's unsuitable.  For\nexample:\n\n>>> config = \"\"\"\n... [Section1]\n... Key = Value\n...\n... [Section2]\n... AnotherKey = Value\n... \"\"\"\n>>> typical = configparser.ConfigParser()\n>>> typical.readstring(config)\n>>> list(typical['Section1'].keys())\n['key']\n>>> list(typical['Section2'].keys())\n['anotherkey']\n>>> custom = configparser.RawConfigParser()\n>>> custom.optionxform = lambda option: option\n>>> custom.readstring(config)\n>>> list(custom['Section1'].keys())\n['Key']\n>>> list(custom['Section2'].keys())\n['AnotherKey']\n\nNote: The optionxform function transforms option names to a\ncanonical form.  This should be an idempotent function: if the\nname is already in canonical form, it should be returned\nunchanged.\n\n-- Attribute: ConfigParser.SECTCRE\n\nA compiled regular expression used to parse section headers.  The\ndefault matches '[section]' to the name '\"section\"'.  Whitespace is\nconsidered part of the section name, thus '[ larch ]' will be read\nas a section of name '\" larch \"'.  Override this attribute if\nthat's unsuitable.  For example:\n\n>>> import re\n>>> config = \"\"\"\n... [Section 1]\n... option = value\n...\n... [  Section 2  ]\n... another = val\n... \"\"\"\n>>> typical = configparser.ConfigParser()\n>>> typical.readstring(config)\n>>> typical.sections()\n['Section 1', '  Section 2  ']\n>>> custom = configparser.ConfigParser()\n>>> custom.SECTCRE = re.compile(r\"\\[ *(?P<header>[^]]+?) *\\]\")\n>>> custom.readstring(config)\n>>> custom.sections()\n['Section 1', 'Section 2']\n\nNote: While ConfigParser objects also use an 'OPTCRE'\nattribute for recognizing option lines, it's not recommended\nto override it because that would interfere with constructor\noptions 'allownovalue' and 'delimiters'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Legacy API Examples,  Next: ConfigParser Objects,  Prev: Customizing Parser Behaviour,  Up: configparser -- Configuration file parser": {
            "content": "5.14.2.8 Legacy API Examples\n............................\n\nMainly because of backwards compatibility concerns, *note configparser:\n20. provides also a legacy API with explicit 'get'/'set' methods.  While\nthere are valid use cases for the methods outlined below, mapping\nprotocol access is preferred for new projects.  The legacy API is at\ntimes more advanced, low-level and downright counterintuitive.\n\nAn example of writing to a configuration file:\n\nimport configparser\n\nconfig = configparser.RawConfigParser()\n\n# Please note that using RawConfigParser's set functions, you can assign\n# non-string values to keys internally, but will receive an error when\n# attempting to write to a file or when you get it in non-raw mode. Setting\n# values using the mapping protocol or ConfigParser's set() does not allow\n# such assignments to take place.\nconfig.addsection('Section1')\nconfig.set('Section1', 'anint', '15')\nconfig.set('Section1', 'abool', 'true')\nconfig.set('Section1', 'afloat', '3.1415')\nconfig.set('Section1', 'baz', 'fun')\nconfig.set('Section1', 'bar', 'Python')\nconfig.set('Section1', 'foo', '%(bar)s is %(baz)s!')\n\n# Writing our configuration file to 'example.cfg'\nwith open('example.cfg', 'w') as configfile:\nconfig.write(configfile)\n\nAn example of reading the configuration file again:\n\nimport configparser\n\nconfig = configparser.RawConfigParser()\nconfig.read('example.cfg')\n\n# getfloat() raises an exception if the value is not a float\n# getint() and getboolean() also do this for their respective types\nafloat = config.getfloat('Section1', 'afloat')\nanint = config.getint('Section1', 'anint')\nprint(afloat + anint)\n\n# Notice that the next output does not interpolate '%(bar)s' or '%(baz)s'.\n# This is because we are using a RawConfigParser().\nif config.getboolean('Section1', 'abool'):\nprint(config.get('Section1', 'foo'))\n\nTo get interpolation, use *note ConfigParser: 257.:\n\nimport configparser\n\ncfg = configparser.ConfigParser()\ncfg.read('example.cfg')\n\n# Set the optional *raw* argument of get() to True if you wish to disable\n# interpolation in a single get operation.\nprint(cfg.get('Section1', 'foo', raw=False))  # -> \"Python is fun!\"\nprint(cfg.get('Section1', 'foo', raw=True))   # -> \"%(bar)s is %(baz)s!\"\n\n# The optional *vars* argument is a dict with members that will take\n# precedence in interpolation.\nprint(cfg.get('Section1', 'foo', vars={'bar': 'Documentation',\n'baz': 'evil'}))\n\n# The optional *fallback* argument can be used to provide a fallback value\nprint(cfg.get('Section1', 'foo'))\n# -> \"Python is fun!\"\n\nprint(cfg.get('Section1', 'foo', fallback='Monty is not.'))\n# -> \"Python is fun!\"\n\nprint(cfg.get('Section1', 'monster', fallback='No such things as monsters.'))\n# -> \"No such things as monsters.\"\n\n# A bare print(cfg.get('Section1', 'monster')) would raise NoOptionError\n# but we can also use:\n\nprint(cfg.get('Section1', 'monster', fallback=None))\n# -> None\n",
            "subsections": []
        },
        "Default values are available in both types of ConfigParsers.  They are": {
            "content": "used in interpolation if an option used is not defined elsewhere.\n\nimport configparser\n\n# New instance with 'bar' and 'baz' defaulting to 'Life' and 'hard' each\nconfig = configparser.ConfigParser({'bar': 'Life', 'baz': 'hard'})\nconfig.read('example.cfg')\n\nprint(config.get('Section1', 'foo'))     # -> \"Python is fun!\"\nconfig.removeoption('Section1', 'bar')\nconfig.removeoption('Section1', 'baz')\nprint(config.get('Section1', 'foo'))     # -> \"Life is hard!\"\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ConfigParser Objects,  Next: RawConfigParser Objects,  Prev: Legacy API Examples,  Up: configparser -- Configuration file parser": {
            "content": "5.14.2.9 ConfigParser Objects\n.............................\n\n-- Class: configparser.ConfigParser (defaults=None, dicttype=dict,\nallownovalue=False, delimiters=('=', ':'),\ncommentprefixes=('#', ';'), inlinecommentprefixes=None,\nstrict=True, emptylinesinvalues=True,\ndefaultsection=configparser.DEFAULTSECT,\ninterpolation=BasicInterpolation(), converters={})\n\nThe main configuration parser.  When 'defaults' is given, it is\ninitialized into the dictionary of intrinsic defaults.  When\n'dicttype' is given, it will be used to create the dictionary\nobjects for the list of sections, for the options within a section,\nand for the default values.\n\nWhen 'delimiters' is given, it is used as the set of substrings\nthat divide keys from values.  When 'commentprefixes' is given, it\nwill be used as the set of substrings that prefix comments in\notherwise empty lines.  Comments can be indented.  When\n'inlinecommentprefixes' is given, it will be used as the set of\nsubstrings that prefix comments in non-empty lines.\n\nWhen 'strict' is 'True' (the default), the parser won't allow for\nany section or option duplicates while reading from a single source\n(file, string or dictionary), raising *note DuplicateSectionError:\n10e7. or *note DuplicateOptionError: 10e8.  When\n'emptylinesinvalues' is 'False' (default: 'True'), each empty\nline marks the end of an option.  Otherwise, internal empty lines\nof a multiline option are kept as part of the value.  When\n'allownovalue' is 'True' (default: 'False'), options without\nvalues are accepted; the value held for these is 'None' and they\nare serialized without the trailing delimiter.\n\nWhen 'defaultsection' is given, it specifies the name for the\nspecial section holding default values for other sections and\ninterpolation purposes (normally named '\"DEFAULT\"').  This value\ncan be retrieved and changed at runtime using the 'defaultsection'\ninstance attribute.  This won't re-evaluate an already parsed\nconfig file, but will be used when writing parsed settings to a new\nconfig file.\n\nInterpolation behaviour may be customized by providing a custom\nhandler through the 'interpolation' argument.  'None' can be used\nto turn off interpolation completely, 'ExtendedInterpolation()'\nprovides a more advanced variant inspired by 'zc.buildout'.  More\non the subject in the *note dedicated documentation section: 2778.\n\nAll option names used in interpolation will be passed through the\n*note optionxform(): 2780. method just like any other option name\nreference.  For example, using the default implementation of *note\noptionxform(): 2780. (which converts option names to lower case),\nthe values 'foo %(bar)s' and 'foo %(BAR)s' are equivalent.\n\nWhen 'converters' is given, it should be a dictionary where each\nkey represents the name of a type converter and each value is a\ncallable implementing the conversion from string to the desired\ndatatype.  Every converter gets its own corresponding 'get*()'\nmethod on the parser object and section proxies.\n\nChanged in version 3.1: The default 'dicttype' is *note\ncollections.OrderedDict: 39f.\n\nChanged in version 3.2: 'allownovalue', 'delimiters',\n'commentprefixes', 'strict', 'emptylinesinvalues',\n'defaultsection' and 'interpolation' were added.\n\nChanged in version 3.5: The 'converters' argument was added.\n\nChanged in version 3.7: The 'defaults' argument is read with *note\nreaddict(): 2779, providing consistent behavior across the parser:\nnon-string keys and values are implicitly converted to strings.\n\nChanged in version 3.8: The default 'dicttype' is *note dict: 237,\nsince it now preserves insertion order.\n\n-- Method: defaults ()\n\nReturn a dictionary containing the instance-wide defaults.\n\n-- Method: sections ()\n\nReturn a list of the sections available; the 'default section'\nis not included in the list.\n\n-- Method: addsection (section)\n\nAdd a section named 'section' to the instance.  If a section\nby the given name already exists, *note DuplicateSectionError:\n10e7. is raised.  If the 'default section' name is passed,\n*note ValueError: 183. is raised.  The name of the section\nmust be a string; if not, *note TypeError: 28e. is raised.\n\nChanged in version 3.2: Non-string section names raise *note\nTypeError: 28e.\n\n-- Method: hassection (section)\n\nIndicates whether the named 'section' is present in the\nconfiguration.  The 'default section' is not acknowledged.\n\n-- Method: options (section)\n\nReturn a list of options available in the specified 'section'.\n\n-- Method: hasoption (section, option)\n\nIf the given 'section' exists, and contains the given\n'option', return *note True: a53.; otherwise return *note\nFalse: 971.  If the specified 'section' is *note None: 43f. or\nan empty string, DEFAULT is assumed.\n\n-- Method: read (filenames, encoding=None)\n\nAttempt to read and parse an iterable of filenames, returning\na list of filenames which were successfully parsed.\n\nIf 'filenames' is a string, a *note bytes: 295. object or a\n*note path-like object: 957, it is treated as a single\nfilename.  If a file named in 'filenames' cannot be opened,\nthat file will be ignored.  This is designed so that you can\nspecify an iterable of potential configuration file locations\n(for example, the current directory, the user's home\ndirectory, and some system-wide directory), and all existing\nconfiguration files in the iterable will be read.\n\nIf none of the named files exist, the *note ConfigParser: 257.\ninstance will contain an empty dataset.  An application which\nrequires initial values to be loaded from a file should load\nthe required file or files using *note readfile(): 258.\nbefore calling *note read(): 12bd. for any optional files:\n\nimport configparser, os\n\nconfig = configparser.ConfigParser()\nconfig.readfile(open('defaults.cfg'))\nconfig.read(['site.cfg', os.path.expanduser('~/.myapp.cfg')],\nencoding='cp1250')\n\nChanged in version 3.2: Added the 'encoding' parameter.\nPreviously, all files were read using the default encoding for\n*note open(): 26e.\n\nChanged in version 3.6.1: The 'filenames' parameter accepts a\n*note path-like object: 957.\n\nChanged in version 3.7: The 'filenames' parameter accepts a\n*note bytes: 295. object.\n\n-- Method: readfile (f, source=None)\n\nRead and parse configuration data from 'f' which must be an\niterable yielding Unicode strings (for example files opened in\ntext mode).\n\nOptional argument 'source' specifies the name of the file\nbeing read.  If not given and 'f' has a 'name' attribute, that\nis used for 'source'; the default is ''<???>''.\n\nNew in version 3.2: Replaces 'readfp()'.\n\n-- Method: readstring (string, source='<string>')\n\nParse configuration data from a string.\n\nOptional argument 'source' specifies a context-specific name\nof the string passed.  If not given, ''<string>'' is used.\nThis should commonly be a filesystem path or a URL.\n\nNew in version 3.2.\n\n-- Method: readdict (dictionary, source='<dict>')\n\nLoad configuration from any object that provides a dict-like\n'items()' method.  Keys are section names, values are\ndictionaries with keys and values that should be present in\nthe section.  If the used dictionary type preserves order,\nsections and their keys will be added in order.  Values are\nautomatically converted to strings.\n\nOptional argument 'source' specifies a context-specific name\nof the dictionary passed.  If not given, '<dict>' is used.\n\nThis method can be used to copy state between parsers.\n\nNew in version 3.2.\n\n-- Method: get (section, option, *, raw=False, vars=None[,\nfallback])\n\nGet an 'option' value for the named 'section'.  If 'vars' is\nprovided, it must be a dictionary.  The 'option' is looked up\nin 'vars' (if provided), 'section', and in 'DEFAULTSECT' in\nthat order.  If the key is not found and 'fallback' is\nprovided, it is used as a fallback value.  'None' can be\nprovided as a 'fallback' value.\n\nAll the ''%'' interpolations are expanded in the return\nvalues, unless the 'raw' argument is true.  Values for\ninterpolation keys are looked up in the same manner as the\noption.\n\nChanged in version 3.2: Arguments 'raw', 'vars' and 'fallback'\nare keyword only to protect users from trying to use the third\nargument as the 'fallback' fallback (especially when using the\nmapping protocol).\n\n-- Method: getint (section, option, *, raw=False, vars=None[,\nfallback])\n\nA convenience method which coerces the 'option' in the\nspecified 'section' to an integer.  See *note get(): 10e4. for\nexplanation of 'raw', 'vars' and 'fallback'.\n\n-- Method: getfloat (section, option, *, raw=False, vars=None[,\nfallback])\n\nA convenience method which coerces the 'option' in the\nspecified 'section' to a floating point number.  See *note\nget(): 10e4. for explanation of 'raw', 'vars' and 'fallback'.\n\n-- Method: getboolean (section, option, *, raw=False, vars=None[,\nfallback])\n\nA convenience method which coerces the 'option' in the\nspecified 'section' to a Boolean value.  Note that the\naccepted values for the option are ''1'', ''yes'', ''true'',\nand ''on'', which cause this method to return 'True', and\n''0'', ''no'', ''false'', and ''off'', which cause it to\nreturn 'False'.  These string values are checked in a\ncase-insensitive manner.  Any other value will cause it to\nraise *note ValueError: 183.  See *note get(): 10e4. for\nexplanation of 'raw', 'vars' and 'fallback'.\n\n-- Method: items (raw=False, vars=None)\n\n-- Method: items (section, raw=False, vars=None)\n\nWhen 'section' is not given, return a list of 'sectionname',\n'sectionproxy' pairs, including DEFAULTSECT.\n\nOtherwise, return a list of 'name', 'value' pairs for the\noptions in the given 'section'.  Optional arguments have the\nsame meaning as for the *note get(): 10e4. method.\n\nChanged in version 3.8: Items present in 'vars' no longer\nappear in the result.  The previous behaviour mixed actual\nparser options with variables provided for interpolation.\n\n-- Method: set (section, option, value)\n\nIf the given section exists, set the given option to the\nspecified value; otherwise raise *note NoSectionError: 2787.\n'option' and 'value' must be strings; if not, *note TypeError:\n28e. is raised.\n\n-- Method: write (fileobject, spacearounddelimiters=True)\n\nWrite a representation of the configuration to the specified\n*note file object: 1037, which must be opened in text mode\n(accepting strings).  This representation can be parsed by a\nfuture *note read(): 12bd. call.  If 'spacearounddelimiters'\nis true, delimiters between keys and values are surrounded by\nspaces.\n\nNote: Comments in the original configuration file are not\npreserved when writing the configuration back.  What is\nconsidered a comment, depends on the given values for\n'commentprefix' and 'inlinecommentprefix'.\n\n-- Method: removeoption (section, option)\n\nRemove the specified 'option' from the specified 'section'.\nIf the section does not exist, raise *note NoSectionError:\n2787.  If the option existed to be removed, return *note True:\na53.; otherwise return *note False: 971.\n\n-- Method: removesection (section)\n\nRemove the specified 'section' from the configuration.  If the\nsection in fact existed, return 'True'.  Otherwise return\n'False'.\n\n-- Method: optionxform (option)\n\nTransforms the option name 'option' as found in an input file\nor as passed in by client code to the form that should be used\nin the internal structures.  The default implementation\nreturns a lower-case version of 'option'; subclasses may\noverride this or client code can set an attribute of this name\non instances to affect this behavior.\n\nYou don't need to subclass the parser to use this method, you\ncan also set it on an instance, to a function that takes a\nstring argument and returns a string.  Setting it to 'str',\nfor example, would make option names case sensitive:\n\ncfgparser = ConfigParser()\ncfgparser.optionxform = str\n\nNote that when reading configuration files, whitespace around\nthe option names is stripped before *note optionxform(): 2780.\nis called.\n\n-- Data: configparser.MAXINTERPOLATIONDEPTH\n\nThe maximum depth for recursive interpolation for *note get():\n10e4. when the 'raw' parameter is false.  This is relevant only\nwhen the default 'interpolation' is used.\n\nFile: python3.12.info,  Node: RawConfigParser Objects,  Next: Exceptions<7>,  Prev: ConfigParser Objects,  Up: configparser -- Configuration file parser\n\n5.14.2.10 RawConfigParser Objects\n.................................\n\n-- Class: configparser.RawConfigParser (defaults=None, dicttype=dict,\nallownovalue=False, *, delimiters=('=', ':'),\ncommentprefixes=('#', ';'), inlinecommentprefixes=None,\nstrict=True, emptylinesinvalues=True,\ndefaultsection=configparser.DEFAULTSECT[, interpolation])\n\nLegacy variant of the *note ConfigParser: 257.  It has\ninterpolation disabled by default and allows for non-string section\nnames, option names, and values via its unsafe 'addsection' and\n'set' methods, as well as the legacy 'defaults=' keyword argument\nhandling.\n\nChanged in version 3.8: The default 'dicttype' is *note dict: 237,\nsince it now preserves insertion order.\n\nNote: Consider using *note ConfigParser: 257. instead which\nchecks types of the values to be stored internally.  If you\ndon't want interpolation, you can use\n'ConfigParser(interpolation=None)'.\n\n-- Method: addsection (section)\n\nAdd a section named 'section' to the instance.  If a section\nby the given name already exists, *note DuplicateSectionError:\n10e7. is raised.  If the 'default section' name is passed,\n*note ValueError: 183. is raised.\n\nType of 'section' is not checked which lets users create\nnon-string named sections.  This behaviour is unsupported and\nmay cause internal errors.\n\n-- Method: set (section, option, value)\n\nIf the given section exists, set the given option to the\nspecified value; otherwise raise *note NoSectionError: 2787.\nWhile it is possible to use *note RawConfigParser: dd4. (or\n*note ConfigParser: 257. with 'raw' parameters set to true)\nfor 'internal' storage of non-string values, full\nfunctionality (including interpolation and output to files)\ncan only be achieved using string values.\n\nThis method lets users assign non-string values to keys\ninternally.  This behaviour is unsupported and will cause\nerrors when attempting to write to a file or get it in non-raw\nmode.  'Use the mapping protocol API' which does not allow\nsuch assignments to take place.\n\nFile: python3.12.info,  Node: Exceptions<7>,  Prev: RawConfigParser Objects,  Up: configparser -- Configuration file parser\n\n5.14.2.11 Exceptions\n....................\n\n-- Exception: configparser.Error\n\nBase class for all other *note configparser: 20. exceptions.\n\n-- Exception: configparser.NoSectionError\n\nException raised when a specified section is not found.\n\n-- Exception: configparser.DuplicateSectionError\n\nException raised if *note addsection(): 10e6. is called with the\nname of a section that is already present or in strict parsers when\na section if found more than once in a single input file, string or\ndictionary.\n\nChanged in version 3.2: Added the optional 'source' and 'lineno'\nattributes and parameters to 'init()'.\n\n-- Exception: configparser.DuplicateOptionError\n\nException raised by strict parsers if a single option appears twice\nduring reading from a single file, string or dictionary.  This\ncatches misspellings and case sensitivity-related errors, e.g.  a\ndictionary may have two keys representing the same case-insensitive\nconfiguration key.\n\n-- Exception: configparser.NoOptionError\n\nException raised when a specified option is not found in the\nspecified section.\n\n-- Exception: configparser.InterpolationError\n\nBase class for exceptions raised when problems occur performing\nstring interpolation.\n\n-- Exception: configparser.InterpolationDepthError\n\nException raised when string interpolation cannot be completed\nbecause the number of iterations exceeds *note\nMAXINTERPOLATIONDEPTH: 278a.  Subclass of *note\nInterpolationError: 2792.\n\n-- Exception: configparser.InterpolationMissingOptionError\n\nException raised when an option referenced from a value does not\nexist.  Subclass of *note InterpolationError: 2792.\n\n-- Exception: configparser.InterpolationSyntaxError\n\nException raised when the source text into which substitutions are\nmade does not conform to the required syntax.  Subclass of *note\nInterpolationError: 2792.\n\n-- Exception: configparser.MissingSectionHeaderError\n\nException raised when attempting to parse a file which has no\nsection headers.\n\n-- Exception: configparser.ParsingError\n\nException raised when errors occur attempting to parse a file.\n\nChanged in version 3.12: The 'filename' attribute and 'init()'\nconstructor argument were removed.  They have been available using\nthe name 'source' since 3.2.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: tomllib -- Parse TOML files,  Next: netrc -- netrc file processing,  Prev: configparser -- Configuration file parser,  Up: File Formats": {
            "content": "New in version 3.11.\n\n'Source code:' Lib/tomllib(1)\n\n\n",
            "subsections": []
        },
        "This module provides an interface for parsing TOML (Tom's Obvious": {
            "content": "",
            "subsections": []
        },
        "Minimal Language, https://toml.io(2)).  This module does not support": {
            "content": "writing TOML.\n\nSee also\n........\n",
            "subsections": []
        },
        "The Tomli-W package(3) is a TOML writer that can be used in conjunction": {
            "content": "with this module, providing a write API familiar to users of the\nstandard library *note marshal: 88. and *note pickle: a1. modules.\n\nSee also\n........\n",
            "subsections": []
        },
        "The TOML Kit package(4) is a style-preserving TOML library with both": {
            "content": "read and write capability.  It is a recommended replacement for this\nmodule for editing already existing TOML files.\n\nThis module defines the following functions:\n\n-- Function: tomllib.load (fp, /, *, parsefloat=float)\n\nRead a TOML file.  The first argument should be a readable and\nbinary file object.  Return a *note dict: 237.  Convert TOML types\nto Python using this *note conversion table: 279a.\n\n'parsefloat' will be called with the string of every TOML float to\nbe decoded.  By default, this is equivalent to 'float(numstr)'.\nThis can be used to use another datatype or parser for TOML floats\n(e.g.  *note decimal.Decimal: 5c3.).  The callable must not return\na *note dict: 237. or a *note list: 3dc, else a *note ValueError:\n183. is raised.\n\nA *note TOMLDecodeError: 279b. will be raised on an invalid TOML\ndocument.\n\n-- Function: tomllib.loads (s, /, *, parsefloat=float)\n\nLoad TOML from a *note str: 157. object.  Return a *note dict: 237.\nConvert TOML types to Python using this *note conversion table:\n279a.  The 'parsefloat' argument has the same meaning as in *note\nload(): 2799.\n\nA *note TOMLDecodeError: 279b. will be raised on an invalid TOML\ndocument.\n\nThe following exceptions are available:\n\n-- Exception: tomllib.TOMLDecodeError\n\nSubclass of *note ValueError: 183.\n\n* Menu:\n\n* Examples: Examples<10>.\n* Conversion Table::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/tomllib\n\n(2) https://toml.io/en/\n\n(3) https://pypi.org/project/tomli-w/\n\n(4) https://pypi.org/project/tomlkit/\n\nFile: python3.12.info,  Node: Examples<10>,  Next: Conversion Table,  Up: tomllib -- Parse TOML files\n\n5.14.3.1 Examples\n.................\n\nParsing a TOML file:\n\nimport tomllib\n\nwith open(\"pyproject.toml\", \"rb\") as f:\ndata = tomllib.load(f)\n\nParsing a TOML string:\n\nimport tomllib\n\ntomlstr = \"\"\"\npython-version = \"3.11.0\"\npython-implementation = \"CPython\"\n\"\"\"\n\ndata = tomllib.loads(tomlstr)\n\nFile: python3.12.info,  Node: Conversion Table,  Prev: Examples<10>,  Up: tomllib -- Parse TOML files\n\n5.14.3.2 Conversion Table\n.........................\n\nTOML                   Python\n\n------------------------------------------------------------------------------------------------------------------\n\nTOML document          dict\n\n\nstring                 str\n\n\ninteger                int\n\n\nfloat                  float (configurable with 'parsefloat')\n\n\nboolean                bool\n\n\noffset date-time       datetime.datetime ('tzinfo' attribute set to an instance of 'datetime.timezone')\n\n\nlocal date-time        datetime.datetime ('tzinfo' attribute set to 'None')\n\n\nlocal date             datetime.date\n\n\nlocal time             datetime.time\n\n\narray                  list\n\n\ntable                  dict\n\n\ninline table           dict\n\n\narray of tables        list of dicts\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: netrc -- netrc file processing,  Next: plistlib -- Generate and parse Apple plist files,  Prev: tomllib -- Parse TOML files,  Up: File Formats": {
            "content": "'Source code:' Lib/netrc.py(1)\n\n\n\nThe *note netrc: 1624. class parses and encapsulates the netrc file\nformat used by the Unix 'ftp' program and other FTP clients.\n\n-- Class: netrc.netrc ([file])\n\nA *note netrc: 1624. instance or subclass instance encapsulates\ndata from a netrc file.  The initialization argument, if present,\nspecifies the file to parse.  If no argument is given, the file\n'.netrc' in the user's home directory - as determined by *note\nos.path.expanduser(): 83d. - will be read.  Otherwise, a *note\nFileNotFoundError: 353. exception will be raised.  Parse errors\nwill raise *note NetrcParseError: 27a1. with diagnostic information\nincluding the file name, line number, and terminating token.  If no\nargument is specified on a POSIX system, the presence of passwords\nin the '.netrc' file will raise a *note NetrcParseError: 27a1. if\nthe file ownership or permissions are insecure (owned by a user\nother than the user running the process, or accessible for read or\nwrite by any other user).  This implements security behavior\nequivalent to that of ftp and other programs that use '.netrc'.\n\nChanged in version 3.4: Added the POSIX permission check.\n\nChanged in version 3.7: *note os.path.expanduser(): 83d. is used to\nfind the location of the '.netrc' file when 'file' is not passed as\nargument.\n\nChanged in version 3.10: *note netrc: 96. try UTF-8 encoding before\nusing locale specific encoding.  The entry in the netrc file no\nlonger needs to contain all tokens.  The missing tokens' value\ndefault to an empty string.  All the tokens and their values now\ncan contain arbitrary characters, like whitespace and non-ASCII\ncharacters.  If the login name is anonymous, it won't trigger the\nsecurity check.\n\n-- Exception: netrc.NetrcParseError\n\nException raised by the *note netrc: 1624. class when syntactical\nerrors are encountered in source text.  Instances of this exception\nprovide three interesting attributes:\n\n-- Attribute: msg\n\nTextual explanation of the error.\n\n-- Attribute: filename\n\nThe name of the source file.\n\n-- Attribute: lineno\n\nThe line number on which the error was found.\n\n* Menu:\n\n* netrc Objects::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/netrc.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: netrc Objects,  Up: netrc -- netrc file processing": {
            "content": "5.14.4.1 netrc Objects\n......................\n\nA *note netrc: 1624. instance has the following methods:\n\n-- Method: netrc.authenticators (host)\n\nReturn a 3-tuple '(login, account, password)' of authenticators for\n'host'.  If the netrc file did not contain an entry for the given\nhost, return the tuple associated with the 'default' entry.  If\nneither matching host nor default entry is available, return\n'None'.\n\n-- Method: netrc.repr ()\n\nDump the class data as a string in the format of a netrc file.\n(This discards comments and may reorder the entries.)\n\nInstances of *note netrc: 1624. have public instance variables:\n\n-- Attribute: netrc.hosts\n\nDictionary mapping host names to '(login, account, password)'\ntuples.  The 'default' entry, if any, is represented as a\npseudo-host by that name.\n\n-- Attribute: netrc.macros\n\nDictionary mapping macro names to string lists.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: plistlib -- Generate and parse Apple plist files,  Prev: netrc -- netrc file processing,  Up: File Formats": {
            "content": "'Source code:' Lib/plistlib.py(1)\n\n\n\nThis module provides an interface for reading and writing the \"property\nlist\" files used by Apple, primarily on macOS and iOS. This module\nsupports both binary and XML plist files.\n",
            "subsections": []
        },
        "The property list ('.plist') file format is a simple serialization": {
            "content": "supporting basic object types, like dictionaries, lists, numbers and\nstrings.  Usually the top level object is a dictionary.\n\nTo write out and to parse a plist file, use the *note dump(): 771. and\n*note load(): 76f. functions.\n\nTo work with plist data in bytes objects, use *note dumps(): 772. and\n*note loads(): 770.\n",
            "subsections": []
        },
        "Values can be strings, integers, floats, booleans, tuples, lists,": {
            "content": "dictionaries (but only with string keys), *note bytes: 295, *note\nbytearray: 294. or *note datetime.datetime: 222. objects.\n",
            "subsections": []
        },
        "Changed in version 3.4: New API, old API deprecated.  Support for binary": {
            "content": "format plists added.\n\nChanged in version 3.8: Support added for reading and writing *note UID:\n84c. tokens in binary plists as used by NSKeyedArchiver and\nNSKeyedUnarchiver.\n\nChanged in version 3.9: Old API removed.\n\nSee also\n........\n\nPList manual page(2)\n\nApple's documentation of the file format.\n\nThis module defines the following functions:\n\n-- Function: plistlib.load (fp, *, fmt=None, dicttype=dict)\n\nRead a plist file.  'fp' should be a readable and binary file\nobject.  Return the unpacked root object (which usually is a\ndictionary).\n\nThe 'fmt' is the format of the file and the following values are\nvalid:\n\n* *note None: 43f.: Autodetect the file format\n\n* *note FMTXML: de9.: XML file format\n\n* *note FMTBINARY: dea.: Binary plist format\n\nThe 'dicttype' is the type used for dictionaries that are read\nfrom the plist file.\n\nXML data for the *note FMTXML: de9. format is parsed using the\nExpat parser from *note xml.parsers.expat: 121. - see its\ndocumentation for possible exceptions on ill-formed XML. Unknown\nelements will simply be ignored by the plist parser.\n\nThe parser for the binary format raises 'InvalidFileException' when\nthe file cannot be parsed.\n\nNew in version 3.4.\n\n-- Function: plistlib.loads (data, *, fmt=None, dicttype=dict)\n\nLoad a plist from a bytes object.  See *note load(): 76f. for an\nexplanation of the keyword arguments.\n\nNew in version 3.4.\n\n-- Function: plistlib.dump (value, fp, *, fmt=FMTXML, sortkeys=True,\nskipkeys=False)\n\nWrite 'value' to a plist file.  'Fp' should be a writable, binary\nfile object.\n\nThe 'fmt' argument specifies the format of the plist file and can\nbe one of the following values:\n\n* *note FMTXML: de9.: XML formatted plist file\n\n* *note FMTBINARY: dea.: Binary formatted plist file\n\nWhen 'sortkeys' is true (the default) the keys for dictionaries\nwill be written to the plist in sorted order, otherwise they will\nbe written in the iteration order of the dictionary.\n\nWhen 'skipkeys' is false (the default) the function raises *note\nTypeError: 28e. when a key of a dictionary is not a string,\notherwise such keys are skipped.\n\nA *note TypeError: 28e. will be raised if the object is of an\nunsupported type or a container that contains objects of\nunsupported types.\n\nAn *note OverflowError: 68d. will be raised for integer values that\ncannot be represented in (binary) plist files.\n\nNew in version 3.4.\n\n-- Function: plistlib.dumps (value, *, fmt=FMTXML, sortkeys=True,\nskipkeys=False)\n\nReturn 'value' as a plist-formatted bytes object.  See the\ndocumentation for *note dump(): 771. for an explanation of the\nkeyword arguments of this function.\n\nNew in version 3.4.\n\nThe following classes are available:\n\n-- Class: plistlib.UID (data)\n\nWraps an *note int: 17e.  This is used when reading or writing\nNSKeyedArchiver encoded data, which contains UID (see PList\nmanual).\n\nIt has one attribute, 'data', which can be used to retrieve the int\nvalue of the UID. 'data' must be in the range '0 <= data < 264'.\n\nNew in version 3.8.\n\nThe following constants are available:\n\n-- Data: plistlib.FMTXML\n\nThe XML format for plist files.\n\nNew in version 3.4.\n\n-- Data: plistlib.FMTBINARY\n\nThe binary format for plist files\n\nNew in version 3.4.\n\n* Menu:\n\n* Examples: Examples<11>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/plistlib.py\n\n(2)\nhttps://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/PropertyLists/\n\nFile: python3.12.info,  Node: Examples<11>,  Up: plistlib -- Generate and parse Apple plist files\n\n5.14.5.1 Examples\n.................\n\nGenerating a plist:\n\nimport datetime\nimport plistlib\n\npl = dict(\naString = \"Doodah\",\naList = [\"A\", \"B\", 12, 32.1, [1, 2, 3]],\naFloat = 0.1,\nanInt = 728,\naDict = dict(\nanotherString = \"<hello & hi there!>\",\naThirdString = \"M\\xe4ssig, Ma\\xdf\",\naTrueValue = True,\naFalseValue = False,\n),\nsomeData = b\"<binary gunk>\",\nsomeMoreData = b\"<lots of binary gunk>\" * 10,\naDate = datetime.datetime.now()\n)\nprint(plistlib.dumps(pl).decode())\n\nParsing a plist:\n\nimport plistlib\n\nplist = b\"\"\"<plist version=\"1.0\">\n<dict>\n<key>foo</key>\n<string>bar</string>\n</dict>\n</plist>\"\"\"\npl = plistlib.loads(plist)\nprint(pl[\"foo\"])\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Cryptographic Services,  Next: Generic Operating System Services,  Prev: File Formats,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.15 Cryptographic Services",
                    "content": ""
                }
            ]
        },
        "The modules described in this chapter implement various algorithms of a": {
            "content": "cryptographic nature.  They are available at the discretion of the\ninstallation.  On Unix systems, the *note crypt: 26. module may also be\navailable.  Here's an overview:\n\n* Menu:\n\n* hashlib -- Secure hashes and message digests::\n* hmac -- Keyed-Hashing for Message Authentication::\n* secrets -- Generate secure random numbers for managing secrets::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: hashlib -- Secure hashes and message digests,  Next: hmac -- Keyed-Hashing for Message Authentication,  Up: Cryptographic Services": {
            "content": "'Source code:' Lib/hashlib.py(1)\n\n\n",
            "subsections": []
        },
        "This module implements a common interface to many different secure hash": {
            "content": "and message digest algorithms.  Included are the FIPS secure hash\nalgorithms SHA1, SHA224, SHA256, SHA384, SHA512, (defined in the FIPS\n180-4 standard(2)), the SHA-3 series (defined in the FIPS 202\nstandard(3)) as well as RSA's MD5 algorithm (defined in internet RFC\n1321(4)).  The terms \"secure hash\" and \"message digest\" are\ninterchangeable.  Older algorithms were called message digests.  The\nmodern term is secure hash.\n\nNote: If you want the adler32 or crc32 hash functions, they are\navailable in the *note zlib: 12d. module.\n\n* Menu:\n\n* Hash algorithms::\n* Usage::\n* Constructors::\n* Attributes::\n* Hash Objects::\n* SHAKE variable length digests::\n* File hashing::\n* Key derivation::\n* BLAKE2::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/hashlib.py\n\n(2) https://csrc.nist.gov/publications/detail/fips/180/4/final\n\n(3) https://csrc.nist.gov/publications/detail/fips/202/final\n\n(4) https://datatracker.ietf.org/doc/html/rfc1321.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Hash algorithms,  Next: Usage,  Up: hashlib -- Secure hashes and message digests": {
            "content": "5.15.1.1 Hash algorithms\n........................\n",
            "subsections": []
        },
        "There is one constructor method named for each type of 'hash'.  All": {
            "content": "return a hash object with the same simple interface.  For example: use\n*note sha256(): 27b5. to create a SHA-256 hash object.  You can now feed\nthis object with *note bytes-like objects: b82. (normally *note bytes:\n295.) using the *note update: 27b6. method.  At any point you can ask it\nfor the 'digest' of the concatenation of the data fed to it so far using\nthe *note digest(): 27b7. or *note hexdigest(): 27b8. methods.\n\nTo allow multithreading, the Python *note GIL: 6c0. is released while\ncomputing a hash supplied more than 2047 bytes of data at once in its\nconstructor or *note .update: 27b6. method.\n",
            "subsections": []
        },
        "Constructors for hash algorithms that are always present in this module": {
            "content": "are *note sha1(): 27b9, *note sha224(): 27ba, *note sha256(): 27b5,\n*note sha384(): 27bb, *note sha512(): 27bc, *note sha3224(): af1, *note\nsha3256(): af2, *note sha3384(): af3, *note sha3512(): af4, *note\nshake128(): af5, *note shake256(): af6, *note blake2b(): 40b, and\n*note blake2s(): 40c.  *note md5(): 27bd. is normally available as well,\nthough it may be missing or blocked if you are using a rare \"FIPS\ncompliant\" build of Python.  These correspond to *note\nalgorithmsguaranteed: 11e7.\n",
            "subsections": []
        },
        "Additional algorithms may also be available if your Python": {
            "content": "distribution's *note hashlib: 63. was linked against a build of OpenSSL\nthat provides others.  Others 'are not guaranteed available' on all\ninstallations and will only be accessible by name via *note new(): 16ae.\nSee *note algorithmsavailable: 11e8.\n\nWarning: Some algorithms have known hash collision weaknesses\n(including MD5 and SHA1).  Refer to Attacks on cryptographic hash\nalgorithms(1) and the *note hashlib-seealso: 27be. section at the\nend of this document.\n\nNew in version 3.6: SHA3 (Keccak) and SHAKE constructors *note\nsha3224(): af1, *note sha3256(): af2, *note sha3384(): af3, *note\nsha3512(): af4, *note shake128(): af5, *note shake256(): af6. were\nadded.  *note blake2b(): 40b. and *note blake2s(): 40c. were added.\n",
            "subsections": []
        },
        "Changed in version 3.9: All hashlib constructors take a keyword-only": {
            "content": "argument 'usedforsecurity' with default value 'True'.  A false value\nallows the use of insecure and blocked hashing algorithms in restricted\nenvironments.  'False' indicates that the hashing algorithm is not used\nin a security context, e.g.  as a non-cryptographic one-way compression\nfunction.\n",
            "subsections": []
        },
        "Changed in version 3.9: Hashlib now uses SHA3 and SHAKE from OpenSSL if": {
            "content": "it provides it.\n",
            "subsections": []
        },
        "Changed in version 3.12: For any of the MD5, SHA1, SHA2, or SHA3": {
            "content": "algorithms that the linked OpenSSL does not provide we fall back to a\nverified implementation from the HACL* project(2).\n\n---------- Footnotes ----------\n\n(1)\nhttps://en.wikipedia.org/wiki/Cryptographichashfunction#Attacksoncryptographichashalgorithms\n\n(2) https://github.com/hacl-star/hacl-star\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Usage,  Next: Constructors,  Prev: Hash algorithms,  Up: hashlib -- Secure hashes and message digests": {
            "content": "5.15.1.2 Usage\n..............\n\nTo obtain the digest of the byte string 'b\"Nobody inspects the spammish\nrepetition\"':\n\n>>> import hashlib\n>>> m = hashlib.sha256()\n>>> m.update(b\"Nobody inspects\")\n>>> m.update(b\" the spammish repetition\")\n>>> m.digest()\nb'\\x03\\x1e\\xdd}Ae\\x15\\x93\\xc5\\xfe\\\\\\x00o\\xa5u+7\\xfd\\xdf\\xf7\\xbcN\\x84:\\xa6\\xaf\\x0c\\x95\\x0fK\\x94\\x06'\n>>> m.hexdigest()\n'031edd7d41651593c5fe5c006fa5752b37fddff7bc4e843aa6af0c950f4b9406'\n\nMore condensed:\n\n>>> hashlib.sha256(b\"Nobody inspects the spammish repetition\").hexdigest()\n'031edd7d41651593c5fe5c006fa5752b37fddff7bc4e843aa6af0c950f4b9406'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Constructors,  Next: Attributes,  Prev: Usage,  Up: hashlib -- Secure hashes and message digests": {
            "content": "5.15.1.3 Constructors\n.....................\n\n-- Function: hashlib.new (name[, data], *, usedforsecurity=True)\n\nIs a generic constructor that takes the string 'name' of the\ndesired algorithm as its first parameter.  It also exists to allow\naccess to the above listed hashes as well as any other algorithms\nthat your OpenSSL library may offer.\n\nUsing *note new(): 16ae. with an algorithm name:\n\n>>> h = hashlib.new('sha256')\n>>> h.update(b\"Nobody inspects the spammish repetition\")\n>>> h.hexdigest()\n'031edd7d41651593c5fe5c006fa5752b37fddff7bc4e843aa6af0c950f4b9406'\n\n-- Function: hashlib.md5 ([data], *, usedforsecurity=True)\n\n-- Function: hashlib.sha1 ([data], *, usedforsecurity=True)\n\n-- Function: hashlib.sha224 ([data], *, usedforsecurity=True)\n\n-- Function: hashlib.sha256 ([data], *, usedforsecurity=True)\n\n-- Function: hashlib.sha384 ([data], *, usedforsecurity=True)\n\n-- Function: hashlib.sha512 ([data], *, usedforsecurity=True)\n\n-- Function: hashlib.sha3224 ([data], *, usedforsecurity=True)\n\n-- Function: hashlib.sha3256 ([data], *, usedforsecurity=True)\n\n-- Function: hashlib.sha3384 ([data], *, usedforsecurity=True)\n\n-- Function: hashlib.sha3512 ([data], *, usedforsecurity=True)\n",
            "subsections": []
        },
        "Named constructors such as these are faster than passing an algorithm": {
            "content": "name to *note new(): 16ae.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Attributes,  Next: Hash Objects,  Prev: Constructors,  Up: hashlib -- Secure hashes and message digests": {
            "content": "5.15.1.4 Attributes\n...................\n\nHashlib provides the following constant module attributes:\n\n-- Data: hashlib.algorithmsguaranteed\n\nA set containing the names of the hash algorithms guaranteed to be\nsupported by this module on all platforms.  Note that 'md5' is in\nthis list despite some upstream vendors offering an odd \"FIPS\ncompliant\" Python build that excludes it.\n\nNew in version 3.2.\n\n-- Data: hashlib.algorithmsavailable\n\nA set containing the names of the hash algorithms that are\navailable in the running Python interpreter.  These names will be\nrecognized when passed to *note new(): 16ae.  *note\nalgorithmsguaranteed: 11e7. will always be a subset.  The same\nalgorithm may appear multiple times in this set under different\nnames (thanks to OpenSSL).\n\nNew in version 3.2.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Hash Objects,  Next: SHAKE variable length digests,  Prev: Attributes,  Up: hashlib -- Secure hashes and message digests": {
            "content": "5.15.1.5 Hash Objects\n.....................\n",
            "subsections": []
        },
        "The following values are provided as constant attributes of the hash": {
            "content": "objects returned by the constructors:\n\n-- Data: hash.digestsize\n\nThe size of the resulting hash in bytes.\n\n-- Data: hash.blocksize\n\nThe internal block size of the hash algorithm in bytes.\n\nA hash object has the following attributes:\n\n-- Attribute: hash.name\n\nThe canonical name of this hash, always lowercase and always\nsuitable as a parameter to *note new(): 16ae. to create another\nhash of this type.\n\nChanged in version 3.4: The name attribute has been present in\nCPython since its inception, but until Python 3.4 was not formally\nspecified, so may not exist on some platforms.\n\nA hash object has the following methods:\n\n-- Method: hash.update (data)\n\nUpdate the hash object with the *note bytes-like object: b82.\nRepeated calls are equivalent to a single call with the\nconcatenation of all the arguments: 'm.update(a); m.update(b)' is\nequivalent to 'm.update(a+b)'.\n\n-- Method: hash.digest ()\n\nReturn the digest of the data passed to the *note update(): 27b6.\nmethod so far.  This is a bytes object of size *note digestsize:\n27c4. which may contain bytes in the whole range from 0 to 255.\n\n-- Method: hash.hexdigest ()\n\nLike *note digest(): 27b7. except the digest is returned as a\nstring object of double length, containing only hexadecimal digits.\nThis may be used to exchange the value safely in email or other\nnon-binary environments.\n\n-- Method: hash.copy ()\n\nReturn a copy (\"clone\") of the hash object.  This can be used to\nefficiently compute the digests of data sharing a common initial\nsubstring.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: SHAKE variable length digests,  Next: File hashing,  Prev: Hash Objects,  Up: hashlib -- Secure hashes and message digests": {
            "content": "5.15.1.6 SHAKE variable length digests\n......................................\n\n-- Function: hashlib.shake128 ([data], *, usedforsecurity=True)\n\n-- Function: hashlib.shake256 ([data], *, usedforsecurity=True)\n\nThe *note shake128(): af5. and *note shake256(): af6. algorithms\nprovide variable length digests with lengthinbits//2 up to 128 or 256\nbits of security.  As such, their digest methods require a length.\nMaximum length is not limited by the SHAKE algorithm.\n\n-- Method: shake.digest (length)\n\nReturn the digest of the data passed to the *note update(): 27b6.\nmethod so far.  This is a bytes object of size 'length' which may\ncontain bytes in the whole range from 0 to 255.\n\n-- Method: shake.hexdigest (length)\n\nLike *note digest(): 17b5. except the digest is returned as a\nstring object of double length, containing only hexadecimal digits.\nThis may be used to exchange the value in email or other non-binary\nenvironments.\n\nExample use:\n\n>>> h = hashlib.shake256(b'Nobody inspects the spammish repetition')\n>>> h.hexdigest(20)\n'44709d6fcb83d92a76dcb0b668c98e1b1d3dafe7'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: File hashing,  Next: Key derivation,  Prev: SHAKE variable length digests,  Up: hashlib -- Secure hashes and message digests": {
            "content": "5.15.1.7 File hashing\n.....................\n",
            "subsections": []
        },
        "The hashlib module provides a helper function for efficient hashing of a": {
            "content": "file or file-like object.\n\n-- Function: hashlib.filedigest (fileobj, digest, /)\n\nReturn a digest object that has been updated with contents of file\nobject.\n\n'fileobj' must be a file-like object opened for reading in binary\nmode.  It accepts file objects from builtin *note open(): 26e,\n*note BytesIO: d08. instances, SocketIO objects from *note\nsocket.socket.makefile(): 1013, and similar.  The function may\nbypass Python's I/O and use the file descriptor from *note\nfileno(): 2542. directly.  'fileobj' must be assumed to be in an\nunknown state after this function returns or raises.  It is up to\nthe caller to close 'fileobj'.\n\n'digest' must either be a hash algorithm name as a 'str', a hash\nconstructor, or a callable that returns a hash object.\n\nExample:\n\n>>> import io, hashlib, hmac\n>>> with open(hashlib.file, \"rb\") as f:\n...     digest = hashlib.filedigest(f, \"sha256\")\n...\n>>> digest.hexdigest()\n'...'\n\n>>> buf = io.BytesIO(b\"somedata\")\n>>> mac1 = hmac.HMAC(b\"key\", digestmod=hashlib.sha512)\n>>> digest = hashlib.filedigest(buf, lambda: mac1)\n\n>>> digest is mac1\nTrue\n>>> mac2 = hmac.HMAC(b\"key\", b\"somedata\", digestmod=hashlib.sha512)\n>>> mac1.digest() == mac2.digest()\nTrue\n\nNew in version 3.11.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Key derivation,  Next: BLAKE2,  Prev: File hashing,  Up: hashlib -- Secure hashes and message digests": {
            "content": "5.15.1.8 Key derivation\n.......................\n",
            "subsections": []
        },
        "Key derivation and key stretching algorithms are designed for secure": {
            "content": "password hashing.  Naive algorithms such as 'sha1(password)' are not\nresistant against brute-force attacks.  A good password hashing function\nmust be tunable, slow, and include a salt(1).\n\n-- Function: hashlib.pbkdf2hmac (hashname, password, salt,\niterations, dklen=None)\n\nThe function provides PKCS#5 password-based key derivation function\n2.  It uses HMAC as pseudorandom function.\n\nThe string 'hashname' is the desired name of the hash digest\nalgorithm for HMAC, e.g.  'sha1' or 'sha256'.  'password' and\n'salt' are interpreted as buffers of bytes.  Applications and\nlibraries should limit 'password' to a sensible length (e.g.\n1024).  'salt' should be about 16 or more bytes from a proper\nsource, e.g.  *note os.urandom(): 276.\n\nThe number of 'iterations' should be chosen based on the hash\nalgorithm and computing power.  As of 2022, hundreds of thousands\nof iterations of SHA-256 are suggested.  For rationale as to why\nand how to choose what is best for your application, read 'Appendix\nA.2.2' of NIST-SP-800-132(2).  The answers on the stackexchange\npbkdf2 iterations question(3) explain in detail.\n\n'dklen' is the length of the derived key.  If 'dklen' is 'None'\nthen the digest size of the hash algorithm 'hashname' is used,\ne.g.  64 for SHA-512.\n\n>>> from hashlib import pbkdf2hmac\n>>> ourappiters = 500000  # Application specific, read above.\n>>> dk = pbkdf2hmac('sha256', b'password', b'bad salt' * 2, ourappiters)\n>>> dk.hex()\n'15530bba69924174860db778f2c6f8104d3aaf9d26241840c8c4a641c8d000a9'\n\nFunction only available when Python is compiled with OpenSSL.\n\nNew in version 3.4.\n\nChanged in version 3.12: Function now only available when Python is\nbuilt with OpenSSL. The slow pure Python implementation has been\nremoved.\n\n-- Function: hashlib.scrypt (password, *, salt, n, r, p, maxmem=0,\ndklen=64)\n\nThe function provides scrypt password-based key derivation function\nas defined in RFC 7914(4).\n\n'password' and 'salt' must be *note bytes-like objects: b82.\nApplications and libraries should limit 'password' to a sensible\nlength (e.g.  1024).  'salt' should be about 16 or more bytes from\na proper source, e.g.  *note os.urandom(): 276.\n\n'n' is the CPU/Memory cost factor, 'r' the block size, 'p'\nparallelization factor and 'maxmem' limits memory (OpenSSL 1.1.0\ndefaults to 32 MiB). 'dklen' is the length of the derived key.\n\nNew in version 3.6.\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Salt%28cryptography%29\n\n(2)\nhttps://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf\n\n(3)\nhttps://security.stackexchange.com/questions/3959/recommended-of-iterations-when-using-pbkdf2-sha256/\n\n(4) https://datatracker.ietf.org/doc/html/rfc7914.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: BLAKE2,  Prev: Key derivation,  Up: hashlib -- Secure hashes and message digests": {
            "content": "5.15.1.9 BLAKE2\n...............\n\nBLAKE2(1) is a cryptographic hash function defined in RFC 7693(2) that\ncomes in two flavors:\n\n* 'BLAKE2b', optimized for 64-bit platforms and produces digests of\nany size between 1 and 64 bytes,\n\n* 'BLAKE2s', optimized for 8- to 32-bit platforms and produces\ndigests of any size between 1 and 32 bytes.\n\nBLAKE2 supports 'keyed mode' (a faster and simpler replacement for\nHMAC(3)), 'salted hashing', 'personalization', and 'tree hashing'.\n\nHash objects from this module follow the API of standard library's *note\nhashlib: 63. objects.\n\n* Menu:\n\n* Creating hash objects::\n* Constants: Constants<5>.\n* Examples: Examples<12>.\n* Credits::\n\n---------- Footnotes ----------\n\n(1) https://www.blake2.net\n\n(2) https://datatracker.ietf.org/doc/html/rfc7693.html\n\n(3)\nhttps://en.wikipedia.org/wiki/Hash-basedmessageauthenticationcode\n\nFile: python3.12.info,  Node: Creating hash objects,  Next: Constants<5>,  Up: BLAKE2\n\n5.15.1.10 Creating hash objects\n...............................\n\nNew hash objects are created by calling constructor functions:\n\n-- Function: hashlib.blake2b (data=b'', *, digestsize=64, key=b'',\nsalt=b'', person=b'', fanout=1, depth=1, leafsize=0,\nnodeoffset=0, nodedepth=0, innersize=0, lastnode=False,\nusedforsecurity=True)\n\n-- Function: hashlib.blake2s (data=b'', *, digestsize=32, key=b'',\nsalt=b'', person=b'', fanout=1, depth=1, leafsize=0,\nnodeoffset=0, nodedepth=0, innersize=0, lastnode=False,\nusedforsecurity=True)\n",
            "subsections": []
        },
        "These functions return the corresponding hash objects for calculating": {
            "content": "BLAKE2b or BLAKE2s.  They optionally take these general parameters:\n\n* 'data': initial chunk of data to hash, which must be *note\nbytes-like object: b82.  It can be passed only as positional\nargument.\n\n* 'digestsize': size of output digest in bytes.\n\n* 'key': key for keyed hashing (up to 64 bytes for BLAKE2b, up to 32\nbytes for BLAKE2s).\n\n* 'salt': salt for randomized hashing (up to 16 bytes for BLAKE2b, up\nto 8 bytes for BLAKE2s).\n\n* 'person': personalization string (up to 16 bytes for BLAKE2b, up to\n8 bytes for BLAKE2s).\n\nThe following table shows limits for general parameters (in bytes):\n\nHash        digestsize     len(key)     len(salt)     len(person)\n\n-----------------------------------------------------------------------\n\nBLAKE2b     64              64           16            16\n\n\nBLAKE2s     32              32           8             8\n\n\nNote: BLAKE2 specification defines constant lengths for salt and\npersonalization parameters, however, for convenience, this\nimplementation accepts byte strings of any size up to the specified\nlength.  If the length of the parameter is less than specified, it\nis padded with zeros, thus, for example, 'b'salt'' and\n'b'salt\\x00'' is the same value.  (This is not the case for 'key'.)\n\nThese sizes are available as module *note constants: 27cc. described\nbelow.\n\nConstructor functions also accept the following tree hashing parameters:\n\n* 'fanout': fanout (0 to 255, 0 if unlimited, 1 in sequential mode).\n\n* 'depth': maximal depth of tree (1 to 255, 255 if unlimited, 1 in\nsequential mode).\n\n* 'leafsize': maximal byte length of leaf (0 to '232-1', 0 if\nunlimited or in sequential mode).\n\n* 'nodeoffset': node offset (0 to '264-1' for BLAKE2b, 0 to\n'248-1' for BLAKE2s, 0 for the first, leftmost, leaf, or in\nsequential mode).\n\n* 'nodedepth': node depth (0 to 255, 0 for leaves, or in sequential\nmode).\n\n* 'innersize': inner digest size (0 to 64 for BLAKE2b, 0 to 32 for\nBLAKE2s, 0 in sequential mode).\n\n* 'lastnode': boolean indicating whether the processed node is the\nlast one ('False' for sequential mode).\n\nExplanation of tree mode parameters.\n\n",
            "subsections": []
        },
        "Figure": {
            "content": "-- Class: tkinter.messagebox.Message (master=None, options)\n\nCreate a message window with an application-specified message, an\nicon and a set of buttons.  Each of the buttons in the message\nwindow is identified by a unique symbolic name (see the 'type'\noptions).\n\nThe following options are supported:\n\n'command'\n\nSpecifies the function to invoke when the user closes the\ndialog.  The name of the button clicked by the user to\nclose the dialog is passed as argument.  This is only\navailable on macOS.\n\n'default'\n\nGives the *note symbolic name: 3ae3. of the default\nbutton for this message window (*note OK: 3ade, *note\nCANCEL: 3adf, and so on).  If this option is not\nspecified, the first button in the dialog will be made\nthe default.\n\n'detail'\n\nSpecifies an auxiliary message to the main message given\nby the 'message' option.  The message detail will be\npresented beneath the main message and, where supported\nby the OS, in a less emphasized font than the main\nmessage.\n\n'icon'\n\nSpecifies an *note icon: 3ae4. to display.  If this\noption is not specified, then the *note INFO: 3ae5. icon\nwill be displayed.\n\n'message'\n\nSpecifies the message to display in this message box.\nThe default value is an empty string.\n\n'parent'\n\nMakes the specified window the logical parent of the\nmessage box.  The message box is displayed on top of its\nparent window.\n\n'title'\n\nSpecifies a string to display as the title of the message\nbox.  This option is ignored on macOS, where platform\nguidelines forbid the use of a title on this kind of\ndialog.\n\n'type'\n\nArranges for a *note predefined set of buttons: 3ae6. to\nbe displayed.\n\n-- Method: show (options)\n\nDisplay a message window and wait for the user to select one\nof the buttons.  Then return the symbolic name of the selected\nbutton.  Keyword arguments can override options specified in\nthe constructor.\n\n'Information message box'\n\n-- Function: tkinter.messagebox.showinfo (title=None, message=None,\noptions)\n\nCreates and displays an information message box with the specified\ntitle and message.\n\n'Warning message boxes'\n\n-- Function: tkinter.messagebox.showwarning (title=None, message=None,\noptions)\n\nCreates and displays a warning message box with the specified title\nand message.\n\n-- Function: tkinter.messagebox.showerror (title=None, message=None,\noptions)\n\nCreates and displays an error message box with the specified title\nand message.\n\n'Question message boxes'\n\n-- Function: tkinter.messagebox.askquestion (title=None, message=None,\n*, type=YESNO, options)\n\nAsk a question.  By default shows buttons *note YES: 3ae0. and\n*note NO: 3ae1.  Returns the symbolic name of the selected button.\n\n-- Function: tkinter.messagebox.askokcancel (title=None, message=None,\noptions)\n\nAsk if operation should proceed.  Shows buttons *note OK: 3ade. and\n*note CANCEL: 3adf.  Returns 'True' if the answer is ok and 'False'\notherwise.\n\n-- Function: tkinter.messagebox.askretrycancel (title=None,\nmessage=None, options)\n\nAsk if operation should be retried.  Shows buttons *note RETRY:\n3aee. and *note CANCEL: 3adf.  Return 'True' if the answer is yes\nand 'False' otherwise.\n\n-- Function: tkinter.messagebox.askyesno (title=None, message=None,\noptions)\n\nAsk a question.  Shows buttons *note YES: 3ae0. and *note NO: 3ae1.\nReturns 'True' if the answer is yes and 'False' otherwise.\n\n-- Function: tkinter.messagebox.askyesnocancel (title=None,\nmessage=None, options)\n\nAsk a question.  Shows buttons *note YES: 3ae0, *note NO: 3ae1. and\n*note CANCEL: 3adf.  Return 'True' if the answer is yes, 'None' if\ncancelled, and 'False' otherwise.\nSymbolic names of buttons:\n\n-- Data: tkinter.messagebox.ABORT = 'abort'\n\n-- Data: tkinter.messagebox.RETRY = 'retry'\n\n-- Data: tkinter.messagebox.IGNORE = 'ignore'\n\n-- Data: tkinter.messagebox.OK = 'ok'\n\n-- Data: tkinter.messagebox.CANCEL = 'cancel'\n\n-- Data: tkinter.messagebox.YES = 'yes'\n\n-- Data: tkinter.messagebox.NO = 'no'\nPredefined sets of buttons:\n\n-- Data: tkinter.messagebox.ABORTRETRYIGNORE = 'abortretryignore'\n\nDisplays three buttons whose symbolic names are *note ABORT: 3af1,\n*note RETRY: 3aee. and *note IGNORE: 3af2.\n\n-- Data: tkinter.messagebox.OK = 'ok'\n\nDisplays one button whose symbolic name is *note OK: 3ade.\n\n-- Data: tkinter.messagebox.OKCANCEL = 'okcancel'\n\nDisplays two buttons whose symbolic names are *note OK: 3ade. and\n*note CANCEL: 3adf.\n\n-- Data: tkinter.messagebox.RETRYCANCEL = 'retrycancel'\n\nDisplays two buttons whose symbolic names are *note RETRY: 3aee.\nand *note CANCEL: 3adf.\n\n-- Data: tkinter.messagebox.YESNO = 'yesno'\n\nDisplays two buttons whose symbolic names are *note YES: 3ae0. and\n*note NO: 3ae1.\n\n-- Data: tkinter.messagebox.YESNOCANCEL = 'yesnocancel'\n\nDisplays three buttons whose symbolic names are *note YES: 3ae0,\n*note NO: 3ae1. and *note CANCEL: 3adf.\nIcon images:\n\n-- Data: tkinter.messagebox.ERROR = 'error'\n\n-- Data: tkinter.messagebox.INFO = 'info'\n\n-- Data: tkinter.messagebox.QUESTION = 'question'\n\n-- Data: tkinter.messagebox.WARNING = 'warning'\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/tkinter/messagebox.py\n",
            "subsections": []
        },
        "See section 2.10 in BLAKE2 specification(1) for comprehensive review of": {
            "content": "tree hashing.\n\n---------- Footnotes ----------\n\n(1) https://www.blake2.net/blake220130129.pdf\n\nFile: python3.12.info,  Node: Constants<5>,  Next: Examples<12>,  Prev: Creating hash objects,  Up: BLAKE2\n\n5.15.1.11 Constants\n...................\n\n-- Data: blake2b.SALTSIZE\n\n-- Data: blake2s.SALTSIZE\n\nSalt length (maximum length accepted by constructors).\n\n-- Data: blake2b.PERSONSIZE\n\n-- Data: blake2s.PERSONSIZE\n\nPersonalization string length (maximum length accepted by constructors).\n\n-- Data: blake2b.MAXKEYSIZE\n\n-- Data: blake2s.MAXKEYSIZE\n\nMaximum key size.\n\n-- Data: blake2b.MAXDIGESTSIZE\n\n-- Data: blake2s.MAXDIGESTSIZE\n\nMaximum digest size that the hash function can output.\n\nFile: python3.12.info,  Node: Examples<12>,  Next: Credits,  Prev: Constants<5>,  Up: BLAKE2\n\n5.15.1.12 Examples\n..................\n\n* Menu:\n\n* Simple hashing::\n* Using different digest sizes::\n* Keyed hashing::\n* Randomized hashing::\n* Personalization::\n* Tree mode::\n\nFile: python3.12.info,  Node: Simple hashing,  Next: Using different digest sizes,  Up: Examples<12>\n\n5.15.1.13 Simple hashing\n........................\n",
            "subsections": []
        },
        "To calculate hash of some data, you should first construct a hash object": {
            "content": "by calling the appropriate constructor function (*note blake2b(): 40b.\nor *note blake2s(): 40c.), then update it with the data by calling *note\nupdate(): 27b6. on the object, and, finally, get the digest out of the\nobject by calling *note digest(): 27b7. (or *note hexdigest(): 27b8. for\nhex-encoded string).\n\n>>> from hashlib import blake2b\n>>> h = blake2b()\n>>> h.update(b'Hello world')\n>>> h.hexdigest()\n'6ff843ba685842aa82031d3f53c48b66326df7639a63d128974c5c14f31a0f33343a8c65551134ed1ae0f2b0dd2bb495dc81039e3eeb0aa1bb0388bbeac29183'\n",
            "subsections": []
        },
        "As a shortcut, you can pass the first chunk of data to update directly": {
            "content": "to the constructor as the positional argument:\n\n>>> from hashlib import blake2b\n>>> blake2b(b'Hello world').hexdigest()\n'6ff843ba685842aa82031d3f53c48b66326df7639a63d128974c5c14f31a0f33343a8c65551134ed1ae0f2b0dd2bb495dc81039e3eeb0aa1bb0388bbeac29183'\n\nYou can call *note hash.update(): 27b6. as many times as you need to\niteratively update the hash:\n\n>>> from hashlib import blake2b\n>>> items = [b'Hello', b' ', b'world']\n>>> h = blake2b()\n>>> for item in items:\n...     h.update(item)\n...\n>>> h.hexdigest()\n'6ff843ba685842aa82031d3f53c48b66326df7639a63d128974c5c14f31a0f33343a8c65551134ed1ae0f2b0dd2bb495dc81039e3eeb0aa1bb0388bbeac29183'\n\nFile: python3.12.info,  Node: Using different digest sizes,  Next: Keyed hashing,  Prev: Simple hashing,  Up: Examples<12>\n\n5.15.1.14 Using different digest sizes\n......................................\n\nBLAKE2 has configurable size of digests up to 64 bytes for BLAKE2b and\nup to 32 bytes for BLAKE2s.  For example, to replace SHA-1 with BLAKE2b\nwithout changing the size of output, we can tell BLAKE2b to produce\n20-byte digests:\n\n>>> from hashlib import blake2b\n>>> h = blake2b(digestsize=20)\n>>> h.update(b'Replacing SHA1 with the more secure function')\n>>> h.hexdigest()\n'd24f26cf8de66472d58d4e1b1774b4c9158b1f4c'\n>>> h.digestsize\n20\n>>> len(h.digest())\n20\n",
            "subsections": []
        },
        "Hash objects with different digest sizes have completely different": {
            "content": "outputs (shorter hashes are 'not' prefixes of longer hashes); BLAKE2b\nand BLAKE2s produce different outputs even if the output length is the\nsame:\n\n>>> from hashlib import blake2b, blake2s\n>>> blake2b(digestsize=10).hexdigest()\n'6fa1d8fcfd719046d762'\n>>> blake2b(digestsize=11).hexdigest()\n'eb6ec15daf9546254f0809'\n>>> blake2s(digestsize=10).hexdigest()\n'1bf21a98c78a1c376ae9'\n>>> blake2s(digestsize=11).hexdigest()\n'567004bf96e4a25773ebf4'\n\nFile: python3.12.info,  Node: Keyed hashing,  Next: Randomized hashing,  Prev: Using different digest sizes,  Up: Examples<12>\n\n5.15.1.15 Keyed hashing\n.......................\n",
            "subsections": []
        },
        "Keyed hashing can be used for authentication as a faster and simpler": {
            "content": "replacement for Hash-based message authentication code(1) (HMAC). BLAKE2\ncan be securely used in prefix-MAC mode thanks to the\nindifferentiability property inherited from BLAKE.\n",
            "subsections": []
        },
        "This example shows how to get a (hex-encoded) 128-bit authentication": {
            "content": "code for message 'b'message data'' with key 'b'pseudorandom key'':\n\n>>> from hashlib import blake2b\n>>> h = blake2b(key=b'pseudorandom key', digestsize=16)\n>>> h.update(b'message data')\n>>> h.hexdigest()\n'3d363ff7401e02026f4a4687d4863ced'\n",
            "subsections": []
        },
        "As a practical example, a web application can symmetrically sign cookies": {
            "content": "sent to users and later verify them to make sure they weren't tampered\nwith:\n\n>>> from hashlib import blake2b\n>>> from hmac import comparedigest\n>>>\n>>> SECRETKEY = b'pseudorandomly generated server secret key'\n>>> AUTHSIZE = 16\n>>>\n>>> def sign(cookie):\n...     h = blake2b(digestsize=AUTHSIZE, key=SECRETKEY)\n...     h.update(cookie)\n...     return h.hexdigest().encode('utf-8')\n>>>\n>>> def verify(cookie, sig):\n...     goodsig = sign(cookie)\n...     return comparedigest(goodsig, sig)\n>>>\n>>> cookie = b'user-alice'\n>>> sig = sign(cookie)\n>>> print(\"{0},{1}\".format(cookie.decode('utf-8'), sig))\nuser-alice,b'43b3c982cf697e0c5ab22172d1ca7421'\n>>> verify(cookie, sig)\nTrue\n>>> verify(b'user-bob', sig)\nFalse\n>>> verify(cookie, b'0102030405060708090a0b0c0d0e0f00')\nFalse\n",
            "subsections": []
        },
        "Even though there's a native keyed hashing mode, BLAKE2 can, of course,": {
            "content": "be used in HMAC construction with *note hmac: 65. module:\n\n>>> import hmac, hashlib\n>>> m = hmac.new(b'secret key', digestmod=hashlib.blake2s)\n>>> m.update(b'message')\n>>> m.hexdigest()\n'e3c8102868d28b5ff85fc35dda07329970d1a01e273c37481326fe0c861c8142'\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/HMAC\n\nFile: python3.12.info,  Node: Randomized hashing,  Next: Personalization,  Prev: Keyed hashing,  Up: Examples<12>\n\n5.15.1.16 Randomized hashing\n............................\n",
            "subsections": []
        },
        "By setting 'salt' parameter users can introduce randomization to the": {
            "content": "hash function.  Randomized hashing is useful for protecting against\ncollision attacks on the hash function used in digital signatures.\n\nRandomized hashing is designed for situations where one party, the\nmessage preparer, generates all or part of a message to be signed\nby a second party, the message signer.  If the message preparer is\nable to find cryptographic hash function collisions (i.e., two\nmessages producing the same hash value), then they might prepare\nmeaningful versions of the message that would produce the same hash\nvalue and digital signature, but with different results (e.g.,\ntransferring $1,000,000 to an account, rather than $10).\nCryptographic hash functions have been designed with collision\nresistance as a major goal, but the current concentration on\nattacking cryptographic hash functions may result in a given\ncryptographic hash function providing less collision resistance\nthan expected.  Randomized hashing offers the signer additional\nprotection by reducing the likelihood that a preparer can generate\ntwo or more messages that ultimately yield the same hash value\nduring the digital signature generation process -- even if it is\npractical to find collisions for the hash function.  However, the\nuse of randomized hashing may reduce the amount of security\nprovided by a digital signature when all portions of the message\nare prepared by the signer.\n\n(NIST SP-800-106 \"Randomized Hashing for Digital Signatures\"(1))\n",
            "subsections": []
        },
        "In BLAKE2 the salt is processed as a one-time input to the hash function": {
            "content": "during initialization, rather than as an input to each compression\nfunction.\n\nWarning: 'Salted hashing' (or just hashing) with BLAKE2 or any\nother general-purpose cryptographic hash function, such as SHA-256,\nis not suitable for hashing passwords.  See BLAKE2 FAQ(2) for more\ninformation.\n\n>>> import os\n>>> from hashlib import blake2b\n>>> msg = b'some message'\n>>> # Calculate the first hash with a random salt.\n>>> salt1 = os.urandom(blake2b.SALTSIZE)\n>>> h1 = blake2b(salt=salt1)\n>>> h1.update(msg)\n>>> # Calculate the second hash with a different random salt.\n>>> salt2 = os.urandom(blake2b.SALTSIZE)\n>>> h2 = blake2b(salt=salt2)\n>>> h2.update(msg)\n>>> # The digests are different.\n>>> h1.digest() != h2.digest()\nTrue\n\n---------- Footnotes ----------\n\n(1)\nhttps://csrc.nist.gov/publications/detail/sp/800-106/archive/2009-02-25\n\n(2) https://www.blake2.net/#qa\n\nFile: python3.12.info,  Node: Personalization,  Next: Tree mode,  Prev: Randomized hashing,  Up: Examples<12>\n\n5.15.1.17 Personalization\n.........................\n",
            "subsections": []
        },
        "Sometimes it is useful to force hash function to produce different": {
            "content": "digests for the same input for different purposes.  Quoting the authors\nof the Skein hash function:\n\nWe recommend that all application designers seriously consider\ndoing this; we have seen many protocols where a hash that is\ncomputed in one part of the protocol can be used in an entirely\ndifferent part because two hash computations were done on similar\nor related data, and the attacker can force the application to make\nthe hash inputs the same.  Personalizing each hash function used in\nthe protocol summarily stops this type of attack.\n\n(The Skein Hash Function Family(1), p.  21)\n\nBLAKE2 can be personalized by passing bytes to the 'person' argument:\n\n>>> from hashlib import blake2b\n>>> FILESHASHPERSON = b'MyApp Files Hash'\n>>> BLOCKHASHPERSON = b'MyApp Block Hash'\n>>> h = blake2b(digestsize=32, person=FILESHASHPERSON)\n>>> h.update(b'the same content')\n>>> h.hexdigest()\n'20d9cd024d4fb086aae819a1432dd2466de12947831b75c5a30cf2676095d3b4'\n>>> h = blake2b(digestsize=32, person=BLOCKHASHPERSON)\n>>> h.update(b'the same content')\n>>> h.hexdigest()\n'cf68fb5761b9c44e7878bfb2c4c9aea52264a80b75005e65619778de59f383a3'\n",
            "subsections": []
        },
        "Personalization together with the keyed mode can also be used to derive": {
            "content": "different keys from a single one.\n\n>>> from hashlib import blake2s\n>>> from base64 import b64decode, b64encode\n>>> origkey = b64decode(b'Rm5EPJai72qcK3RGBpW3vPNfZy5OZothY+kHY6h21KM=')\n>>> enckey = blake2s(key=origkey, person=b'kEncrypt').digest()\n>>> mackey = blake2s(key=origkey, person=b'kMAC').digest()\n>>> print(b64encode(enckey).decode('utf-8'))\nrbPb15S/Z9t+agffno5wuhB77VbRi6F9Iv2qIxU7WHw=\n>>> print(b64encode(mackey).decode('utf-8'))\nG9GtHFE1YluXY1zWPlYk1e/nWfu0WSEb0KRcjhDeP/o=\n\n---------- Footnotes ----------\n\n(1) https://www.schneier.com/wp-content/uploads/2016/02/skein.pdf\n\nFile: python3.12.info,  Node: Tree mode,  Prev: Personalization,  Up: Examples<12>\n\n5.15.1.18 Tree mode\n...................\n\nHere's an example of hashing a minimal tree with two leaf nodes:\n\n10\n/  \\\n00  01\n",
            "subsections": []
        },
        "This example uses 64-byte internal digests, and returns the 32-byte": {
            "content": "final digest:\n\n>>> from hashlib import blake2b\n>>>\n>>> FANOUT = 2\n>>> DEPTH = 2\n>>> LEAFSIZE = 4096\n>>> INNERSIZE = 64\n>>>\n>>> buf = bytearray(6000)\n>>>\n>>> # Left leaf\n... h00 = blake2b(buf[0:LEAFSIZE], fanout=FANOUT, depth=DEPTH,\n...               leafsize=LEAFSIZE, innersize=INNERSIZE,\n...               nodeoffset=0, nodedepth=0, lastnode=False)\n>>> # Right leaf\n... h01 = blake2b(buf[LEAFSIZE:], fanout=FANOUT, depth=DEPTH,\n...               leafsize=LEAFSIZE, innersize=INNERSIZE,\n...               nodeoffset=1, nodedepth=0, lastnode=True)\n>>> # Root node\n... h10 = blake2b(digestsize=32, fanout=FANOUT, depth=DEPTH,\n...               leafsize=LEAFSIZE, innersize=INNERSIZE,\n...               nodeoffset=0, nodedepth=1, lastnode=True)\n>>> h10.update(h00.digest())\n>>> h10.update(h01.digest())\n>>> h10.hexdigest()\n'3ad2a9b37c6070e374c7a8c508fe20ca86b6ed54e286e93a0318e95e881db5aa'\n\nFile: python3.12.info,  Node: Credits,  Prev: Examples<12>,  Up: BLAKE2\n\n5.15.1.19 Credits\n.................\n\nBLAKE2(1) was designed by 'Jean-Philippe Aumasson', 'Samuel Neves',\n'Zooko Wilcox-O'Hearn', and 'Christian Winnerlein' based on SHA-3(2)\nfinalist BLAKE(3) created by 'Jean-Philippe Aumasson', 'Luca Henzen',\n'Willi Meier', and 'Raphael C.-W. Phan'.\n\nIt uses core algorithm from ChaCha(4) cipher designed by 'Daniel J.\nBernstein'.\n",
            "subsections": []
        },
        "The stdlib implementation is based on pyblake2(5) module.  It was": {
            "content": "written by 'Dmitry Chestnykh' based on C implementation written by\n'Samuel Neves'.  The documentation was copied from pyblake2(6) and\nwritten by 'Dmitry Chestnykh'.\n\nThe C code was partly rewritten for Python by 'Christian Heimes'.\n",
            "subsections": []
        },
        "The following public domain dedication applies for both C hash function": {
            "content": "implementation, extension code, and this documentation:\n\nTo the extent possible under law, the author(s) have dedicated all\ncopyright and related and neighboring rights to this software to\nthe public domain worldwide.  This software is distributed without\nany warranty.\n\nYou should have received a copy of the CC0 Public Domain Dedication\nalong with this software.  If not, see\n'https://creativecommons.org/publicdomain/zero/1.0/'.\n",
            "subsections": []
        },
        "The following people have helped with development or contributed their": {
            "content": "changes to the project and the public domain according to the Creative\nCommons Public Domain Dedication 1.0 Universal:\n\n* 'Alexandr Sokolovskiy'\n\nSee also\n........\n\nModule *note hmac: 65.\n\nA module to generate message authentication codes using hashes.\n\nModule *note base64: c.\n\nAnother way to encode binary hashes for non-binary environments.\n\n'https://nvlpubs.nist.gov/nistpubs/fips/nist.fips.180-4.pdf'\n\nThe FIPS 180-4 publication on Secure Hash Algorithms.\n\n'https://csrc.nist.gov/publications/detail/fips/202/final'\n\nThe FIPS 202 publication on the SHA-3 Standard.\n\n'https://www.blake2.net/'\n\nOfficial BLAKE2 website.\n\n'https://en.wikipedia.org/wiki/Cryptographichashfunction'\n\nWikipedia article with information on which algorithms have known\nissues and what that means regarding their use.\n\n'https://www.ietf.org/rfc/rfc8018.txt'\n\nPKCS #5: Password-Based Cryptography Specification Version 2.1\n\n'https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf'\n\nNIST Recommendation for Password-Based Key Derivation.\n\n---------- Footnotes ----------\n\n(1) https://www.blake2.net\n\n(2) https://en.wikipedia.org/wiki/SecureHashAlgorithms\n\n(3)\nhttps://web.archive.org/web/20200918190133/https://131002.net/blake/\n\n(4) https://cr.yp.to/chacha.html\n\n(5) https://pythonhosted.org/pyblake2/\n\n(6) https://pythonhosted.org/pyblake2/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: hmac -- Keyed-Hashing for Message Authentication,  Next: secrets -- Generate secure random numbers for managing secrets,  Prev: hashlib -- Secure hashes and message digests,  Up: Cryptographic Services": {
            "content": "'Source code:' Lib/hmac.py(1)\n\n\n\nThis module implements the HMAC algorithm as described by RFC 2104(2).\n\n-- Function: hmac.new (key, msg=None, digestmod)\n\nReturn a new hmac object.  'key' is a bytes or bytearray object\ngiving the secret key.  If 'msg' is present, the method call\n'update(msg)' is made.  'digestmod' is the digest name, digest\nconstructor or module for the HMAC object to use.  It may be any\nname suitable to *note hashlib.new(): 16ae.  Despite its argument\nposition, it is required.\n\nChanged in version 3.4: Parameter 'key' can be a bytes or bytearray\nobject.  Parameter 'msg' can be of any type supported by *note\nhashlib: 63.  Parameter 'digestmod' can be the name of a hash\nalgorithm.\n\nChanged in version 3.8: The 'digestmod' argument is now required.\nPass it as a keyword argument to avoid awkwardness when you do not\nhave an initial 'msg'.\n\n-- Function: hmac.digest (key, msg, digest)\n\nReturn digest of 'msg' for given secret 'key' and 'digest'.  The\nfunction is equivalent to 'HMAC(key, msg, digest).digest()', but\nuses an optimized C or inline implementation, which is faster for\nmessages that fit into memory.  The parameters 'key', 'msg', and\n'digest' have the same meaning as in *note new(): 8d3.\n\nCPython implementation detail, the optimized C implementation is\nonly used when 'digest' is a string and name of a digest algorithm,\nwhich is supported by OpenSSL.\n\nNew in version 3.7.\n\nAn HMAC object has the following methods:\n\n-- Method: HMAC.update (msg)\n\nUpdate the hmac object with 'msg'.  Repeated calls are equivalent\nto a single call with the concatenation of all the arguments:\n'm.update(a); m.update(b)' is equivalent to 'm.update(a + b)'.\n\nChanged in version 3.4: Parameter 'msg' can be of any type\nsupported by *note hashlib: 63.\n\n-- Method: HMAC.digest ()\n\nReturn the digest of the bytes passed to the *note update(): dba.\nmethod so far.  This bytes object will be the same length as the\n'digestsize' of the digest given to the constructor.  It may\ncontain non-ASCII bytes, including NUL bytes.\n\nWarning: When comparing the output of *note digest(): 978. to\nan externally supplied digest during a verification routine,\nit is recommended to use the *note comparedigest(): f39.\nfunction instead of the '==' operator to reduce the\nvulnerability to timing attacks.\n\n-- Method: HMAC.hexdigest ()\n\nLike *note digest(): 978. except the digest is returned as a string\ntwice the length containing only hexadecimal digits.  This may be\nused to exchange the value safely in email or other non-binary\nenvironments.\n\nWarning: When comparing the output of *note hexdigest(): 27e0.\nto an externally supplied digest during a verification\nroutine, it is recommended to use the *note comparedigest():\nf39. function instead of the '==' operator to reduce the\nvulnerability to timing attacks.\n\n-- Method: HMAC.copy ()\n\nReturn a copy (\"clone\") of the hmac object.  This can be used to\nefficiently compute the digests of strings that share a common\ninitial substring.\n\nA hash object has the following attributes:\n\n-- Attribute: HMAC.digestsize\n\nThe size of the resulting HMAC digest in bytes.\n\n-- Attribute: HMAC.blocksize\n\nThe internal block size of the hash algorithm in bytes.\n\nNew in version 3.4.\n\n-- Attribute: HMAC.name\n\nThe canonical name of this HMAC, always lowercase, e.g.\n'hmac-md5'.\n\nNew in version 3.4.\n",
            "subsections": []
        },
        "Changed in version 3.10: Removed the undocumented attributes": {
            "content": "'HMAC.digestcons', 'HMAC.inner', and 'HMAC.outer'.\n\nThis module also provides the following helper function:\n\n-- Function: hmac.comparedigest (a, b)\n\nReturn 'a == b'.  This function uses an approach designed to\nprevent timing analysis by avoiding content-based short circuiting\nbehaviour, making it appropriate for cryptography.  'a' and 'b'\nmust both be of the same type: either *note str: 157. (ASCII only,\nas e.g.  returned by *note HMAC.hexdigest(): 27e0.), or a *note\nbytes-like object: b82.\n\nNote: If 'a' and 'b' are of different lengths, or if an error\noccurs, a timing attack could theoretically reveal information\nabout the types and lengths of 'a' and 'b'--but not their\nvalues.\n\nNew in version 3.3.\n\nChanged in version 3.10: The function uses OpenSSL's\n'CRYPTOmemcmp()' internally when available.\n\nSee also\n........\n\nModule *note hashlib: 63.\n\nThe Python module providing secure hash functions.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/hmac.py\n\n(2) https://datatracker.ietf.org/doc/html/rfc2104.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: secrets -- Generate secure random numbers for managing secrets,  Prev: hmac -- Keyed-Hashing for Message Authentication,  Up: Cryptographic Services": {
            "content": "New in version 3.6.\n\n'Source code:' Lib/secrets.py(1)\n\n\n\nThe *note secrets: bb. module is used for generating cryptographically\nstrong random numbers suitable for managing data such as passwords,\naccount authentication, security tokens, and related secrets.\n\nIn particular, *note secrets: bb. should be used in preference to the\ndefault pseudo-random number generator in the *note random: b3. module,\nwhich is designed for modelling and simulation, not security or\ncryptography.\n\nSee also\n........\n\nPEP 506(2)\n\n* Menu:\n\n* Random numbers::\n* Generating tokens::\n* Other functions::\n* Recipes and best practices::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/secrets.py\n\n(2) https://peps.python.org/pep-0506/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Random numbers,  Next: Generating tokens,  Up: secrets -- Generate secure random numbers for managing secrets": {
            "content": "5.15.3.1 Random numbers\n.......................\n\nThe *note secrets: bb. module provides access to the most secure source\nof randomness that your operating system provides.\n\n-- Class: secrets.SystemRandom\n\nA class for generating random numbers using the highest-quality\nsources provided by the operating system.  See *note\nrandom.SystemRandom: 23e5. for additional details.\n\n-- Function: secrets.choice (sequence)\n\nReturn a randomly chosen element from a non-empty sequence.\n\n-- Function: secrets.randbelow (n)\n\nReturn a random int in the range [0, 'n').\n\n-- Function: secrets.randbits (k)\n\nReturn an int with 'k' random bits.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Generating tokens,  Next: Other functions,  Prev: Random numbers,  Up: secrets -- Generate secure random numbers for managing secrets": {
            "content": "5.15.3.2 Generating tokens\n..........................\n\nThe *note secrets: bb. module provides functions for generating secure\ntokens, suitable for applications such as password resets, hard-to-guess\nURLs, and similar.\n\n-- Function: secrets.tokenbytes ([nbytes=None])\n\nReturn a random byte string containing 'nbytes' number of bytes.\nIf 'nbytes' is 'None' or not supplied, a reasonable default is\nused.\n\n>>> tokenbytes(16)\nb'\\xebr\\x17D*t\\xae\\xd4\\xe3S\\xb6\\xe2\\xebP1\\x8b'\n\n-- Function: secrets.tokenhex ([nbytes=None])\n\nReturn a random text string, in hexadecimal.  The string has\n'nbytes' random bytes, each byte converted to two hex digits.  If\n'nbytes' is 'None' or not supplied, a reasonable default is used.\n\n>>> tokenhex(16)\n'f9bf78b9a18ce6d46a0cd2b0b86df9da'\n\n-- Function: secrets.tokenurlsafe ([nbytes=None])\n\nReturn a random URL-safe text string, containing 'nbytes' random\nbytes.  The text is Base64 encoded, so on average each byte results\nin approximately 1.3 characters.  If 'nbytes' is 'None' or not\nsupplied, a reasonable default is used.\n\n>>> tokenurlsafe(16)\n'Drmhze6EPcv0fN81Bj-nA'\n\n* Menu:\n\n* How many bytes should tokens use?::\n\nFile: python3.12.info,  Node: How many bytes should tokens use?,  Up: Generating tokens\n\n5.15.3.3 How many bytes should tokens use?\n..........................................\n",
            "subsections": []
        },
        "To be secure against brute-force attacks(1), tokens need to have": {
            "content": "sufficient randomness.  Unfortunately, what is considered sufficient\nwill necessarily increase as computers get more powerful and able to\nmake more guesses in a shorter period.  As of 2015, it is believed that\n32 bytes (256 bits) of randomness is sufficient for the typical use-case\nexpected for the *note secrets: bb. module.\n",
            "subsections": []
        },
        "For those who want to manage their own token length, you can explicitly": {
            "content": "specify how much randomness is used for tokens by giving an *note int:\n17e. argument to the various 'token*' functions.  That argument is\ntaken as the number of bytes of randomness to use.\n",
            "subsections": []
        },
        "Otherwise, if no argument is provided, or if the argument is 'None', the": {
            "content": "'token*' functions will use a reasonable default instead.\n\nNote: That default is subject to change at any time, including\nduring maintenance releases.\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Brute-forceattack\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Other functions,  Next: Recipes and best practices,  Prev: Generating tokens,  Up: secrets -- Generate secure random numbers for managing secrets": {
            "content": "5.15.3.4 Other functions\n........................\n\n-- Function: secrets.comparedigest (a, b)\n\nReturn 'True' if strings or *note bytes-like objects: b82. 'a' and\n'b' are equal, otherwise 'False', using a \"constant-time compare\"\nto reduce the risk of timing attacks(1).  See *note\nhmac.comparedigest(): f39. for additional details.\n\n---------- Footnotes ----------\n\n(1) https://codahale.com/a-lesson-in-timing-attacks/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Recipes and best practices,  Prev: Other functions,  Up: secrets -- Generate secure random numbers for managing secrets": {
            "content": "5.15.3.5 Recipes and best practices\n...................................\n\nThis section shows recipes and best practices for using *note secrets:\nbb. to manage a basic level of security.\n\nGenerate an eight-character alphanumeric password:\n\nimport string\nimport secrets\nalphabet = string.asciiletters + string.digits\npassword = ''.join(secrets.choice(alphabet) for i in range(8))\n\nNote: Applications should not store passwords in a recoverable\nformat(1), whether plain text or encrypted.  They should be salted\nand hashed using a cryptographically strong one-way (irreversible)\nhash function.\n",
            "subsections": []
        },
        "Generate a ten-character alphanumeric password with at least one": {
            "content": "lowercase character, at least one uppercase character, and at least\nthree digits:\n\nimport string\nimport secrets\nalphabet = string.asciiletters + string.digits\nwhile True:\npassword = ''.join(secrets.choice(alphabet) for i in range(10))\nif (any(c.islower() for c in password)\nand any(c.isupper() for c in password)\nand sum(c.isdigit() for c in password) >= 3):\nbreak\n\nGenerate an XKCD-style passphrase(2):\n\nimport secrets\n# On standard Linux systems, use a convenient dictionary file.\n# Other platforms may need to provide their own word-list.\nwith open('/usr/share/dict/words') as f:\nwords = [word.strip() for word in f]\npassword = ' '.join(secrets.choice(words) for i in range(4))\n",
            "subsections": []
        },
        "Generate a hard-to-guess temporary URL containing a security token": {
            "content": "suitable for password recovery applications:\n\nimport secrets\nurl = 'https://example.com/reset=' + secrets.tokenurlsafe()\n\n---------- Footnotes ----------\n\n(1) https://cwe.mitre.org/data/definitions/257.html\n\n(2) https://xkcd.com/936/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Generic Operating System Services,  Next: Concurrent Execution,  Prev: Cryptographic Services,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.16 Generic Operating System Services",
                    "content": ""
                }
            ]
        },
        "The modules described in this chapter provide interfaces to operating": {
            "content": "system features that are available on (almost) all operating systems,\nsuch as files and a clock.  The interfaces are generally modeled after\nthe Unix or C interfaces, but they are available on most other systems\nas well.  Here's an overview:\n\n* Menu:\n\n* os -- Miscellaneous operating system interfaces::\n* io -- Core tools for working with streams::\n* time -- Time access and conversions::\n* argparse -- Parser for command-line options, arguments and sub-commands: argparse -- Parser for command-line options arguments and sub-commands.\n* getopt -- C-style parser for command line options::\n* logging -- Logging facility for Python::\n* logging.config -- Logging configuration: logging config -- Logging configuration.\n* logging.handlers -- Logging handlers: logging handlers -- Logging handlers.\n* getpass -- Portable password input::\n* curses -- Terminal handling for character-cell displays::\n* curses.textpad -- Text input widget for curses programs: curses textpad -- Text input widget for curses programs.\n* curses.ascii -- Utilities for ASCII characters: curses ascii -- Utilities for ASCII characters.\n* curses.panel -- A panel stack extension for curses: curses panel -- A panel stack extension for curses.\n* platform -- Access to underlying platform's identifying data::\n* errno -- Standard errno system symbols::\n* ctypes -- A foreign function library for Python::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: os -- Miscellaneous operating system interfaces,  Next: io -- Core tools for working with streams,  Up: Generic Operating System Services": {
            "content": "'Source code:' Lib/os.py(1)\n\n\n",
            "subsections": []
        },
        "This module provides a portable way of using operating system dependent": {
            "content": "functionality.  If you just want to read or write a file see *note\nopen(): 26e, if you want to manipulate paths, see the *note os.path: 9d.\nmodule, and if you want to read all the lines in all the files on the\ncommand line see the *note fileinput: 56. module.  For creating\ntemporary files and directories see the *note tempfile: da. module, and\nfor high-level file and directory handling see the *note shutil: c0.\nmodule.\n\nNotes on the availability of these functions:\n\n* The design of all built-in operating system dependent modules of\nPython is such that as long as the same functionality is available,\nit uses the same interface; for example, the function\n'os.stat(path)' returns stat information about 'path' in the same\nformat (which happens to have originated with the POSIX interface).\n\n* Extensions peculiar to a particular operating system are also\navailable through the *note os: 9c. module, but using them is of\ncourse a threat to portability.\n\n* All functions accepting path or file names accept both bytes and\nstring objects, and result in an object of the same type, if a path\nor file name is returned.\n\n* On VxWorks, os.popen, os.fork, os.execv and os.spawn*p* are not\nsupported.\n\n* On WebAssembly platforms 'wasm32-emscripten' and 'wasm32-wasi',\nlarge parts of the *note os: 9c. module are not available or behave\ndifferently.  API related to processes (e.g.  *note fork(): 231,\n*note execve(): f69.), signals (e.g.  *note kill(): 11db, *note\nwait(): bf4.), and resources (e.g.  *note nice(): f71.) are not\navailable.  Others like *note getuid(): 27f4. and *note getpid():\n27f5. are emulated or stubs.\n\nNote: All functions in this module raise *note OSError: 613. (or\nsubclasses thereof) in the case of invalid or inaccessible file\nnames and paths, or other arguments that have the correct type, but\nare not accepted by the operating system.\n\n-- Exception: os.error\n\nAn alias for the built-in *note OSError: 613. exception.\n\n-- Data: os.name\n\nThe name of the operating system dependent module imported.  The\nfollowing names have currently been registered: ''posix'', ''nt'',\n''java''.\n\nSee also\n........\n\n*note sys.platform: 8bc. has a finer granularity.  *note\nos.uname(): f86. gives system-dependent version information.\n\nThe *note platform: a5. module provides detailed checks for the\nsystem's identity.\n\n* Menu:\n\n* File Names, Command Line Arguments, and Environment Variables: File Names Command Line Arguments and Environment Variables.\n* Python UTF-8 Mode::\n* Process Parameters::\n* File Object Creation::\n* File Descriptor Operations::\n* Files and Directories::\n* Process Management::\n* Interface to the scheduler::\n* Miscellaneous System Information::\n* Random numbers: Random numbers<2>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/os.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: File Names Command Line Arguments and Environment Variables,  Next: Python UTF-8 Mode,  Up: os -- Miscellaneous operating system interfaces": {
            "content": "5.16.1.1 File Names, Command Line Arguments, and Environment Variables\n......................................................................\n",
            "subsections": []
        },
        "In Python, file names, command line arguments, and environment variables": {
            "content": "are represented using the string type.  On some systems, decoding these\nstrings to and from bytes is necessary before passing them to the\noperating system.  Python uses the *note filesystem encoding and error\nhandler: 291. to perform this conversion (see *note\nsys.getfilesystemencoding(): aa2.).\n\nThe *note filesystem encoding and error handler: 291. are configured at\nPython startup by the *note PyConfigRead(): 57e. function: see *note\nfilesystemencoding: 313. and *note filesystemerrors: 314. members of\n*note PyConfig: 318.\n",
            "subsections": []
        },
        "Changed in version 3.1: On some systems, conversion using the file": {
            "content": "system encoding may fail.  In this case, Python uses the *note\nsurrogateescape encoding error handler: 20f3, which means that\nundecodable bytes are replaced by a Unicode character U+DC'xx' on\ndecoding, and these are again translated to the original byte on\nencoding.\n\nThe *note file system encoding: 291. must guarantee to successfully\ndecode all bytes below 128.  If the file system encoding fails to\nprovide this guarantee, API functions can raise *note UnicodeError:\n111b.\n\nSee also the *note locale encoding: 27fa.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python UTF-8 Mode,  Next: Process Parameters,  Prev: File Names Command Line Arguments and Environment Variables,  Up: os -- Miscellaneous operating system interfaces": {
            "content": "5.16.1.2 Python UTF-8 Mode\n..........................\n\nNew in version 3.7: See PEP 540(1) for more details.\n\nThe Python UTF-8 Mode ignores the *note locale encoding: 27fa. and\nforces the usage of the UTF-8 encoding:\n\n* Use UTF-8 as the *note filesystem encoding: 291.\n\n* *note sys.getfilesystemencoding(): aa2. returns ''utf-8''.\n\n* *note locale.getpreferredencoding(): 290. returns ''utf-8'' (the\n'dosetlocale' argument has no effect).\n\n* *note sys.stdin: 293, *note sys.stdout: 90c, and *note sys.stderr:\n757. all use UTF-8 as their text encoding, with the\n'surrogateescape' *note error handler: 1543. being enabled for\n*note sys.stdin: 293. and *note sys.stdout: 90c. (*note sys.stderr:\n757. continues to use 'backslashreplace' as it does in the default\nlocale-aware mode)\n\n* On Unix, *note os.deviceencoding(): 15f4. returns ''utf-8'' rather\nthan the device encoding.\n",
            "subsections": []
        },
        "Note that the standard stream settings in UTF-8 mode can be overridden": {
            "content": "by *note PYTHONIOENCODING: e7e. (just as they can be in the default\nlocale-aware mode).\n",
            "subsections": []
        },
        "As a consequence of the changes in those lower level APIs, other higher": {
            "content": "level APIs also exhibit different default behaviours:\n\n* Command line arguments, environment variables and filenames are\ndecoded to text using the UTF-8 encoding.\n\n* *note os.fsdecode(): a9d. and *note os.fsencode(): a9e. use the\nUTF-8 encoding.\n\n* *note open(): 26e, *note io.open(): 26f, and *note codecs.open():\n525. use the UTF-8 encoding by default.  However, they still use\nthe strict error handler by default so that attempting to open a\nbinary file in text mode is likely to raise an exception rather\nthan producing nonsense data.\n\nThe *note Python UTF-8 Mode: 420. is enabled if the LCCTYPE locale is\n'C' or 'POSIX' at Python startup (see the *note PyConfigRead(): 57e.\nfunction).\n\nIt can be enabled or disabled using the *note -X utf8: 188. command line\noption and the *note PYTHONUTF8: 90e. environment variable.\n\nIf the *note PYTHONUTF8: 90e. environment variable is not set at all,\nthen the interpreter defaults to using the current locale settings,\n'unless' the current locale is identified as a legacy ASCII-based locale\n(as described for *note PYTHONCOERCECLOCALE: 90b.), and locale coercion\nis either disabled or fails.  In such legacy locales, the interpreter\nwill default to enabling UTF-8 mode unless explicitly instructed not to\ndo so.\n",
            "subsections": []
        },
        "The Python UTF-8 Mode can only be enabled at the Python startup.  Its": {
            "content": "value can be read from *note sys.flags.utf8mode: 458.\n\nSee also the *note UTF-8 mode on Windows: 1b62. and the *note filesystem\nencoding and error handler: 291.\n\nSee also\n........\n\nPEP 686(2)\n\nPython 3.15 will make *note Python UTF-8 Mode: 420. default.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0540/\n\n(2) https://peps.python.org/pep-0686/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Process Parameters,  Next: File Object Creation,  Prev: Python UTF-8 Mode,  Up: os -- Miscellaneous operating system interfaces": {
            "content": "5.16.1.3 Process Parameters\n...........................\n",
            "subsections": []
        },
        "These functions and data items provide information and operate on the": {
            "content": "current process and user.\n\n-- Function: os.ctermid ()\n\nReturn the filename corresponding to the controlling terminal of\nthe process.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Data: os.environ\n\nA *note mapping: 1030. object where keys and values are strings\nthat represent the process environment.  For example,\n'environ['HOME']' is the pathname of your home directory (on some\nplatforms), and is equivalent to 'getenv(\"HOME\")' in C.\n\nThis mapping is captured the first time the *note os: 9c. module is\nimported, typically during Python startup as part of processing\n'site.py'.  Changes to the environment made after this time are not\nreflected in *note os.environ: 102e, except for changes made by\nmodifying *note os.environ: 102e. directly.\n\nThis mapping may be used to modify the environment as well as query\nthe environment.  *note putenv(): 73a. will be called automatically\nwhen the mapping is modified.\n\nOn Unix, keys and values use *note sys.getfilesystemencoding():\naa2. and ''surrogateescape'' error handler.  Use *note environb:\n108b. if you would like to use a different encoding.\n\nOn Windows, the keys are converted to uppercase.  This also applies\nwhen getting, setting, or deleting an item.  For example,\n'environ['monty'] = 'python'' maps the key ''MONTY'' to the value\n''python''.\n\nNote: Calling *note putenv(): 73a. directly does not change\n*note os.environ: 102e, so it's better to modify *note\nos.environ: 102e.\n\nNote: On some platforms, including FreeBSD and macOS, setting\n'environ' may cause memory leaks.  Refer to the system\ndocumentation for 'putenv()'.\n\nYou can delete items in this mapping to unset environment\nvariables.  *note unsetenv(): 739. will be called automatically\nwhen an item is deleted from *note os.environ: 102e, and when one\nof the 'pop()' or 'clear()' methods is called.\n\nChanged in version 3.9: Updated to support PEP 584(1)'s merge ('|')\nand update ('|=') operators.\n\n-- Data: os.environb\n\nBytes version of *note environ: 102e.: a *note mapping: 1030.\nobject where both keys and values are *note bytes: 295. objects\nrepresenting the process environment.  *note environ: 102e. and\n*note environb: 108b. are synchronized (modifying *note environb:\n108b. updates *note environ: 102e, and vice versa).\n\n*note environb: 108b. is only available if *note\nsupportsbytesenviron: 1089. is 'True'.\n\nNew in version 3.2.\n\nChanged in version 3.9: Updated to support PEP 584(2)'s merge ('|')\nand update ('|=') operators.\n\n-- Function: os.chdir (path)\n\n-- Function: os.fchdir (fd)\n\n-- Function: os.getcwd ()\n\nThese functions are described in *note Files and Directories: 27ff.\n\n-- Function: os.fsencode (filename)\n\nEncode *note path-like: 957. 'filename' to the *note filesystem\nencoding and error handler: 291.; return *note bytes: 295.\nunchanged.\n\n*note fsdecode(): a9d. is the reverse function.\n\nNew in version 3.2.\n\nChanged in version 3.6: Support added to accept objects\nimplementing the *note os.PathLike: a9a. interface.\n\n-- Function: os.fsdecode (filename)\n\nDecode the *note path-like: 957. 'filename' from the *note\nfilesystem encoding and error handler: 291.; return *note str: 157.\nunchanged.\n\n*note fsencode(): a9e. is the reverse function.\n\nNew in version 3.2.\n\nChanged in version 3.6: Support added to accept objects\nimplementing the *note os.PathLike: a9a. interface.\n\n-- Function: os.fspath (path)\n\nReturn the file system representation of the path.\n\nIf *note str: 157. or *note bytes: 295. is passed in, it is\nreturned unchanged.  Otherwise *note fspath(): a9b. is called\nand its value is returned as long as it is a *note str: 157. or\n*note bytes: 295. object.  In all other cases, *note TypeError:\n28e. is raised.\n\nNew in version 3.6.\n\n-- Class: os.PathLike\n\nAn *note abstract base class: 102a. for objects representing a file\nsystem path, e.g.  *note pathlib.PurePath: 1c5.\n\nNew in version 3.6.\n\n-- Method: abstractmethod fspath ()\n\nReturn the file system path representation of the object.\n\nThe method should only return a *note str: 157. or *note\nbytes: 295. object, with the preference being for *note str:\n157.\n\n-- Function: os.getenv (key, default=None)\n\nReturn the value of the environment variable 'key' as a string if\nit exists, or 'default' if it doesn't.  'key' is a string.  Note\nthat since *note getenv(): 2800. uses *note os.environ: 102e, the\nmapping of *note getenv(): 2800. is similarly also captured on\nimport, and the function may not reflect future environment\nchanges.\n\nOn Unix, keys and values are decoded with *note\nsys.getfilesystemencoding(): aa2. and ''surrogateescape'' error\nhandler.  Use *note os.getenvb(): 108a. if you would like to use a\ndifferent encoding.\n\n*note Availability: 1ad3.: Unix, Windows.\n\n-- Function: os.getenvb (key, default=None)\n\nReturn the value of the environment variable 'key' as bytes if it\nexists, or 'default' if it doesn't.  'key' must be bytes.  Note\nthat since *note getenvb(): 108a. uses *note os.environb: 108b, the\nmapping of *note getenvb(): 108a. is similarly also captured on\nimport, and the function may not reflect future environment\nchanges.\n\n*note getenvb(): 108a. is only available if *note\nsupportsbytesenviron: 1089. is 'True'.\n\n*note Availability: 1ad3.: Unix.\n\nNew in version 3.2.\n\n-- Function: os.getexecpath (env=None)\n\nReturns the list of directories that will be searched for a named\nexecutable, similar to a shell, when launching a process.  'env',\nwhen specified, should be an environment variable dictionary to\nlookup the PATH in.  By default, when 'env' is 'None', *note\nenviron: 102e. is used.\n\nNew in version 3.2.\n\n-- Function: os.getegid ()\n\nReturn the effective group id of the current process.  This\ncorresponds to the \"set id\" bit on the file being executed in the\ncurrent process.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Function: os.geteuid ()\n\nReturn the current process's effective user id.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Function: os.getgid ()\n\nReturn the real group id of the current process.\n\n*note Availability: 1ad3.: Unix.\n\nThe function is a stub on Emscripten and WASI, see *note\nWebAssembly platforms: 153e. for more information.\n\n-- Function: os.getgrouplist (user, group, /)\n\nReturn list of group ids that 'user' belongs to.  If 'group' is not\nin the list, it is included; typically, 'group' is specified as the\ngroup ID field from the password record for 'user', because that\ngroup ID will otherwise be potentially omitted.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nNew in version 3.3.\n\n-- Function: os.getgroups ()\n\nReturn list of supplemental group ids associated with the current\nprocess.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nNote: On macOS, *note getgroups(): 2804. behavior differs\nsomewhat from other Unix platforms.  If the Python interpreter\nwas built with a deployment target of '10.5' or earlier, *note\ngetgroups(): 2804. returns the list of effective group ids\nassociated with the current user process; this list is limited\nto a system-defined number of entries, typically 16, and may\nbe modified by calls to *note setgroups(): 2805. if suitably\nprivileged.  If built with a deployment target greater than\n'10.5', *note getgroups(): 2804. returns the current group\naccess list for the user associated with the effective user id\nof the process; the group access list may change over the\nlifetime of the process, it is not affected by calls to *note\nsetgroups(): 2805, and its length is not limited to 16.  The\ndeployment target value, 'MACOSXDEPLOYMENTTARGET', can be\nobtained with *note sysconfig.getconfigvar(): ea2.\n\n-- Function: os.getlogin ()\n\nReturn the name of the user logged in on the controlling terminal\nof the process.  For most purposes, it is more useful to use *note\ngetpass.getuser(): 2807. since the latter checks the environment\nvariables 'LOGNAME' or 'USERNAME' to find out who the user is, and\nfalls back to 'pwd.getpwuid(os.getuid())[0]' to get the login name\nof the current real user id.\n\n*note Availability: 1ad3.: Unix, Windows, not Emscripten, not WASI.\n\n-- Function: os.getpgid (pid)\n\nReturn the process group id of the process with process id 'pid'.\nIf 'pid' is 0, the process group id of the current process is\nreturned.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Function: os.getpgrp ()\n\nReturn the id of the current process group.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Function: os.getpid ()\n\nReturn the current process id.\n\nThe function is a stub on Emscripten and WASI, see *note\nWebAssembly platforms: 153e. for more information.\n\n-- Function: os.getppid ()\n\nReturn the parent's process id.  When the parent process has\nexited, on Unix the id returned is the one of the init process (1),\non Windows it is still the same id, which may be already reused by\nanother process.\n\n*note Availability: 1ad3.: Unix, Windows, not Emscripten, not WASI.\n\nChanged in version 3.2: Added support for Windows.\n\n-- Function: os.getpriority (which, who)\n\nGet program scheduling priority.  The value 'which' is one of *note\nPRIOPROCESS: 280b, *note PRIOPGRP: 280c, or *note PRIOUSER:\n280d, and 'who' is interpreted relative to 'which' (a process\nidentifier for *note PRIOPROCESS: 280b, process group identifier\nfor *note PRIOPGRP: 280c, and a user ID for *note PRIOUSER:\n280d.).  A zero value for 'who' denotes (respectively) the calling\nprocess, the process group of the calling process, or the real user\nID of the calling process.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nNew in version 3.3.\n\n-- Data: os.PRIOPROCESS\n-- Data: os.PRIOPGRP\n-- Data: os.PRIOUSER\n\nParameters for the *note getpriority(): f6f. and *note\nsetpriority(): f70. functions.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nNew in version 3.3.\n\n-- Data: os.PRIODARWINTHREAD\n-- Data: os.PRIODARWINPROCESS\n-- Data: os.PRIODARWINBG\n-- Data: os.PRIODARWINNONUI\n\nParameters for the *note getpriority(): f6f. and *note\nsetpriority(): f70. functions.\n\n*note Availability: 1ad3.: macOS\n\nNew in version 3.12.\n\n-- Function: os.getresuid ()\n\nReturn a tuple (ruid, euid, suid) denoting the current process's\nreal, effective, and saved user ids.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nNew in version 3.2.\n\n-- Function: os.getresgid ()\n\nReturn a tuple (rgid, egid, sgid) denoting the current process's\nreal, effective, and saved group ids.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nNew in version 3.2.\n\n-- Function: os.getuid ()\n\nReturn the current process's real user id.\n\n*note Availability: 1ad3.: Unix.\n\nThe function is a stub on Emscripten and WASI, see *note\nWebAssembly platforms: 153e. for more information.\n\n-- Function: os.initgroups (username, gid, /)\n\nCall the system initgroups() to initialize the group access list\nwith all of the groups of which the specified username is a member,\nplus the specified group id.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nNew in version 3.2.\n\n-- Function: os.putenv (key, value, /)\n\nSet the environment variable named 'key' to the string 'value'.\nSuch changes to the environment affect subprocesses started with\n*note os.system(): 12b2, *note popen(): 8b5. or *note fork(): 231.\nand *note execv(): 2812.\n\nAssignments to items in *note os.environ: 102e. are automatically\ntranslated into corresponding calls to *note putenv(): 73a.;\nhowever, calls to *note putenv(): 73a. don't update *note\nos.environ: 102e, so it is actually preferable to assign to items\nof *note os.environ: 102e.  This also applies to *note getenv():\n2800. and *note getenvb(): 108a, which respectively use *note\nos.environ: 102e. and *note os.environb: 108b. in their\nimplementations.\n\nNote: On some platforms, including FreeBSD and macOS, setting\n'environ' may cause memory leaks.  Refer to the system\ndocumentation for 'putenv()'.\n\nRaises an *note auditing event: 161d. 'os.putenv' with arguments\n'key', 'value'.\n\nChanged in version 3.9: The function is now always available.\n\n-- Function: os.setegid (egid, /)\n\nSet the current process's effective group id.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Function: os.seteuid (euid, /)\n\nSet the current process's effective user id.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Function: os.setgid (gid, /)\n\nSet the current process' group id.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Function: os.setgroups (groups, /)\n\nSet the list of supplemental group ids associated with the current\nprocess to 'groups'.  'groups' must be a sequence, and each element\nmust be an integer identifying a group.  This operation is\ntypically available only to the superuser.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nNote: On macOS, the length of 'groups' may not exceed the\nsystem-defined maximum number of effective group ids,\ntypically 16.  See the documentation for *note getgroups():\n2804. for cases where it may not return the same group list\nset by calling setgroups().\n\n-- Function: os.setns (fd, nstype=0)\n\nReassociate the current thread with a Linux namespace.  See the\n'setns(2)' and 'namespaces(7)' man pages for more details.\n\nIf 'fd' refers to a '/proc/`pid'/ns/' link, 'setns()' reassociates\nthe calling thread with the namespace associated with that link,\nand 'nstype' may be set to one of the *note CLONENEW* constants:\n2816. to impose constraints on the operation ('0' means no\nconstraints).\n\nSince Linux 5.8, 'fd' may refer to a PID file descriptor obtained\nfrom *note pidfdopen(): 195.  In this case, 'setns()' reassociates\nthe calling thread into one or more of the same namespaces as the\nthread referred to by 'fd'.  This is subject to any constraints\nimposed by 'nstype', which is a bit mask combining one or more of\nthe *note CLONENEW* constants: 2816, e.g.  'setns(fd,\nos.CLONENEWUTS | os.CLONENEWPID)'.  The caller's memberships in\nunspecified namespaces are left unchanged.\n\n'fd' can be any object with a *note fileno(): 2542. method, or a\nraw file descriptor.\n\nThis example reassociates the thread with the 'init' process's\nnetwork namespace:\n\nfd = os.open(\"/proc/1/ns/net\", os.ORDONLY)\nos.setns(fd, os.CLONENEWNET)\nos.close(fd)\n\n*note Availability: 1ad3.: Linux >= 3.0 with glibc >= 2.14.\n\nNew in version 3.12.\n\nSee also\n........\n\nThe *note unshare(): 151a. function.\n\n-- Function: os.setpgrp ()\n\nCall the system call 'setpgrp()' or 'setpgrp(0, 0)' depending on\nwhich version is implemented (if any).  See the Unix manual for the\nsemantics.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Function: os.setpgid (pid, pgrp, /)\n\nCall the system call 'setpgid()' to set the process group id of the\nprocess with id 'pid' to the process group with id 'pgrp'.  See the\nUnix manual for the semantics.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Function: os.setpriority (which, who, priority)\n\nSet program scheduling priority.  The value 'which' is one of *note\nPRIOPROCESS: 280b, *note PRIOPGRP: 280c, or *note PRIOUSER:\n280d, and 'who' is interpreted relative to 'which' (a process\nidentifier for *note PRIOPROCESS: 280b, process group identifier\nfor *note PRIOPGRP: 280c, and a user ID for *note PRIOUSER:\n280d.).  A zero value for 'who' denotes (respectively) the calling\nprocess, the process group of the calling process, or the real user\nID of the calling process.  'priority' is a value in the range -20\nto 19.  The default priority is 0; lower priorities cause more\nfavorable scheduling.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nNew in version 3.3.\n\n-- Function: os.setregid (rgid, egid, /)\n\nSet the current process's real and effective group ids.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Function: os.setresgid (rgid, egid, sgid, /)\n\nSet the current process's real, effective, and saved group ids.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nNew in version 3.2.\n\n-- Function: os.setresuid (ruid, euid, suid, /)\n\nSet the current process's real, effective, and saved user ids.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nNew in version 3.2.\n\n-- Function: os.setreuid (ruid, euid, /)\n\nSet the current process's real and effective user ids.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Function: os.getsid (pid, /)\n\nCall the system call 'getsid()'.  See the Unix manual for the\nsemantics.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Function: os.setsid ()\n\nCall the system call 'setsid()'.  See the Unix manual for the\nsemantics.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Function: os.setuid (uid, /)\n\nSet the current process's user id.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Function: os.strerror (code, /)\n\nReturn the error message corresponding to the error code in 'code'.\nOn platforms where 'strerror()' returns 'NULL' when given an\nunknown error number, *note ValueError: 183. is raised.\n\n-- Data: os.supportsbytesenviron\n\n'True' if the native OS type of the environment is bytes (eg.\n'False' on Windows).\n\nNew in version 3.2.\n\n-- Function: os.umask (mask, /)\n\nSet the current numeric umask and return the previous umask.\n\nThe function is a stub on Emscripten and WASI, see *note\nWebAssembly platforms: 153e. for more information.\n\n-- Function: os.uname ()\n\nReturns information identifying the current operating system.  The\nreturn value is an object with five attributes:\n\n* 'sysname' - operating system name\n\n* 'nodename' - name of machine on network\n(implementation-defined)\n\n* 'release' - operating system release\n\n* 'version' - operating system version\n\n* 'machine' - hardware identifier\n\nFor backwards compatibility, this object is also iterable, behaving\nlike a five-tuple containing 'sysname', 'nodename', 'release',\n'version', and 'machine' in that order.\n\nSome systems truncate 'nodename' to 8 characters or to the leading\ncomponent; a better way to get the hostname is *note\nsocket.gethostname(): 281f. or even\n'socket.gethostbyaddr(socket.gethostname())'.\n\n*note Availability: 1ad3.: Unix.\n\nChanged in version 3.3: Return type changed from a tuple to a\ntuple-like object with named attributes.\n\n-- Function: os.unsetenv (key, /)\n\nUnset (delete) the environment variable named 'key'.  Such changes\nto the environment affect subprocesses started with *note\nos.system(): 12b2, *note popen(): 8b5. or *note fork(): 231. and\n*note execv(): 2812.\n\nDeletion of items in *note os.environ: 102e. is automatically\ntranslated into a corresponding call to *note unsetenv(): 739.;\nhowever, calls to *note unsetenv(): 739. don't update *note\nos.environ: 102e, so it is actually preferable to delete items of\n*note os.environ: 102e.\n\nRaises an *note auditing event: 161d. 'os.unsetenv' with argument\n'key'.\n\nChanged in version 3.9: The function is now always available and is\nalso available on Windows.\n\n-- Function: os.unshare (flags)\n\nDisassociate parts of the process execution context, and move them\ninto a newly created namespace.  See the 'unshare(2)' man page for\nmore details.  The 'flags' argument is a bit mask, combining zero\nor more of the *note CLONE* constants: 2816, that specifies which\nparts of the execution context should be unshared from their\nexisting associations and moved to a new namespace.  If the 'flags'\nargument is '0', no changes are made to the calling process's\nexecution context.\n\n*note Availability: 1ad3.: Linux >= 2.6.16.\n\nNew in version 3.12.\n\nSee also\n........\n\nThe *note setns(): 1519. function.\n\nFlags to the *note unshare(): 151a. function, if the implementation\nsupports them.  See 'unshare(2)' in the Linux manual for their exact\neffect and availability.\n\n-- Data: os.CLONEFILES\n-- Data: os.CLONEFS\n-- Data: os.CLONENEWCGROUP\n-- Data: os.CLONENEWIPC\n-- Data: os.CLONENEWNET\n-- Data: os.CLONENEWNS\n-- Data: os.CLONENEWPID\n-- Data: os.CLONENEWTIME\n-- Data: os.CLONENEWUSER\n-- Data: os.CLONENEWUTS\n-- Data: os.CLONESIGHAND\n-- Data: os.CLONESYSVSEM\n-- Data: os.CLONETHREAD\n-- Data: os.CLONEVM\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0584/\n\n(2) https://peps.python.org/pep-0584/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: File Object Creation,  Next: File Descriptor Operations,  Prev: Process Parameters,  Up: os -- Miscellaneous operating system interfaces": {
            "content": "5.16.1.4 File Object Creation\n.............................\n\nThese functions create new *note file objects: 1037.  (See also *note\nopen(): bee. for opening file descriptors.)\n\n-- Function: os.fdopen (fd, *args, kwargs)\n\nReturn an open file object connected to the file descriptor 'fd'.\nThis is an alias of the *note open(): 26e. built-in function and\naccepts the same arguments.  The only difference is that the first\nargument of *note fdopen(): 1c38. must always be an integer.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: File Descriptor Operations,  Next: Files and Directories,  Prev: File Object Creation,  Up: os -- Miscellaneous operating system interfaces": {
            "content": "5.16.1.5 File Descriptor Operations\n...................................\n",
            "subsections": []
        },
        "These functions operate on I/O streams referenced using file": {
            "content": "descriptors.\n",
            "subsections": []
        },
        "File descriptors are small integers corresponding to a file that has": {
            "content": "been opened by the current process.  For example, standard input is\nusually file descriptor 0, standard output is 1, and standard error is\n2.  Further files opened by a process will then be assigned 3, 4, 5, and\nso forth.  The name \"file descriptor\" is slightly deceptive; on Unix\nplatforms, sockets and pipes are also referenced by file descriptors.\n\nThe *note fileno(): 2542. method can be used to obtain the file\ndescriptor associated with a *note file object: 1037. when required.",
            "subsections": []
        },
        "Note that using the file descriptor directly will bypass the file object": {
            "content": "methods, ignoring aspects such as internal buffering of data.\n\n-- Function: os.close (fd)\n\nClose file descriptor 'fd'.\n\nNote: This function is intended for low-level I/O and must be\napplied to a file descriptor as returned by *note os.open():\nbee. or *note pipe(): 1538.  To close a \"file object\" returned\nby the built-in function *note open(): 26e. or by *note\npopen(): 8b5. or *note fdopen(): 1c38, use its *note close():\n17a4. method.\n\n-- Function: os.closerange (fdlow, fdhigh, /)\n\nClose all file descriptors from 'fdlow' (inclusive) to 'fdhigh'\n(exclusive), ignoring errors.  Equivalent to (but much faster\nthan):\n\nfor fd in range(fdlow, fdhigh):\ntry:\nos.close(fd)\nexcept OSError:\npass\n\n-- Function: os.copyfilerange (src, dst, count, offsetsrc=None,\noffsetdst=None)\n\nCopy 'count' bytes from file descriptor 'src', starting from offset\n'offsetsrc', to file descriptor 'dst', starting from offset\n'offsetdst'.  If 'offsetsrc' is None, then 'src' is read from the\ncurrent position; respectively for 'offsetdst'.\n\nIn Linux kernel older than 5.3, the files pointed by 'src' and\n'dst' must reside in the same filesystem, otherwise an *note\nOSError: 613. is raised with *note errno: 1f9a. set to *note\nerrno.EXDEV: 2834.\n\nThis copy is done without the additional cost of transferring data\nfrom the kernel to user space and then back into the kernel.\nAdditionally, some filesystems could implement extra optimizations,\nsuch as the use of reflinks (i.e., two or more inodes that share\npointers to the same copy-on-write disk blocks; supported file\nsystems include btrfs and XFS) and server-side copy (in the case of\nNFS).\n\nThe function copies bytes between two file descriptors.  Text\noptions, like the encoding and the line ending, are ignored.\n\nThe return value is the amount of bytes copied.  This could be less\nthan the amount requested.\n\nNote: On Linux, *note os.copyfilerange(): 2833. should not\nbe used for copying a range of a pseudo file from a special\nfilesystem like procfs and sysfs.  It will always copy no\nbytes and return 0 as if the file was empty because of a known\nLinux kernel issue.\n\n*note Availability: 1ad3.: Linux >= 4.5 with glibc >= 2.27.\n\nNew in version 3.8.\n\n-- Function: os.deviceencoding (fd)\n\nReturn a string describing the encoding of the device associated\nwith 'fd' if it is connected to a terminal; else return *note None:\n43f.\n\nOn Unix, if the *note Python UTF-8 Mode: 420. is enabled, return\n''UTF-8'' rather than the device encoding.\n\nChanged in version 3.10: On Unix, the function now implements the\nPython UTF-8 Mode.\n\n-- Function: os.dup (fd, /)\n\nReturn a duplicate of file descriptor 'fd'.  The new file\ndescriptor is *note non-inheritable: d60.\n\nOn Windows, when duplicating a standard stream (0: stdin, 1:\nstdout, 2: stderr), the new file descriptor is *note inheritable:\nd60.\n\n*note Availability: 1ad3.: not WASI.\n\nChanged in version 3.4: The new file descriptor is now\nnon-inheritable.\n\n-- Function: os.dup2 (fd, fd2, inheritable=True)\n\nDuplicate file descriptor 'fd' to 'fd2', closing the latter first\nif necessary.  Return 'fd2'.  The new file descriptor is *note\ninheritable: d60. by default or non-inheritable if 'inheritable' is\n'False'.\n\n*note Availability: 1ad3.: not WASI.\n\nChanged in version 3.4: Add the optional 'inheritable' parameter.\n\nChanged in version 3.7: Return 'fd2' on success.  Previously,\n'None' was always returned.\n\n-- Function: os.fchmod (fd, mode)\n\nChange the mode of the file given by 'fd' to the numeric 'mode'.\nSee the docs for *note chmod(): f5d. for possible values of 'mode'.\nAs of Python 3.3, this is equivalent to 'os.chmod(fd, mode)'.\n\nRaises an *note auditing event: 161d. 'os.chmod' with arguments\n'path', 'mode', 'dirfd'.\n\n*note Availability: 1ad3.: Unix.\n\nThe function is limited on Emscripten and WASI, see *note\nWebAssembly platforms: 153e. for more information.\n\n-- Function: os.fchown (fd, uid, gid)\n\nChange the owner and group id of the file given by 'fd' to the\nnumeric 'uid' and 'gid'.  To leave one of the ids unchanged, set it\nto -1.  See *note chown(): f5e.  As of Python 3.3, this is\nequivalent to 'os.chown(fd, uid, gid)'.\n\nRaises an *note auditing event: 161d. 'os.chown' with arguments\n'path', 'uid', 'gid', 'dirfd'.\n\n*note Availability: 1ad3.: Unix.\n\nThe function is limited on Emscripten and WASI, see *note\nWebAssembly platforms: 153e. for more information.\n\n-- Function: os.fdatasync (fd)\n\nForce write of file with filedescriptor 'fd' to disk.  Does not\nforce update of metadata.\n\n*note Availability: 1ad3.: Unix.\n\nNote: This function is not available on MacOS.\n\n-- Function: os.fpathconf (fd, name, /)\n\nReturn system configuration information relevant to an open file.\n'name' specifies the configuration value to retrieve; it may be a\nstring which is the name of a defined system value; these names are\nspecified in a number of standards (POSIX.1, Unix 95, Unix 98, and\nothers).  Some platforms define additional names as well.  The\nnames known to the host operating system are given in the\n'pathconfnames' dictionary.  For configuration variables not\nincluded in that mapping, passing an integer for 'name' is also\naccepted.\n\nIf 'name' is a string and is not known, *note ValueError: 183. is\nraised.  If a specific value for 'name' is not supported by the\nhost system, even if it is included in 'pathconfnames', an *note\nOSError: 613. is raised with *note errno.EINVAL: 1766. for the\nerror number.\n\nAs of Python 3.3, this is equivalent to 'os.pathconf(fd, name)'.\n\n*note Availability: 1ad3.: Unix.\n\n-- Function: os.fstat (fd)\n\nGet the status of the file descriptor 'fd'.  Return a *note\nstatresult: 1318. object.\n\nAs of Python 3.3, this is equivalent to 'os.stat(fd)'.\n\nSee also\n........\n\nThe *note stat(): 1bf. function.\n\n-- Function: os.fstatvfs (fd, /)\n\nReturn information about the filesystem containing the file\nassociated with file descriptor 'fd', like *note statvfs(): f6c.\nAs of Python 3.3, this is equivalent to 'os.statvfs(fd)'.\n\n*note Availability: 1ad3.: Unix.\n\n-- Function: os.fsync (fd)\n\nForce write of file with filedescriptor 'fd' to disk.  On Unix,\nthis calls the native 'fsync()' function; on Windows, the MS\n'commit()' function.\n\nIf you're starting with a buffered Python *note file object: 1037.\n'f', first do 'f.flush()', and then do 'os.fsync(f.fileno())', to\nensure that all internal buffers associated with 'f' are written to\ndisk.\n\n*note Availability: 1ad3.: Unix, Windows.\n\n-- Function: os.ftruncate (fd, length, /)\n\nTruncate the file corresponding to file descriptor 'fd', so that it\nis at most 'length' bytes in size.  As of Python 3.3, this is\nequivalent to 'os.truncate(fd, length)'.\n\nRaises an *note auditing event: 161d. 'os.truncate' with arguments\n'fd', 'length'.\n\n*note Availability: 1ad3.: Unix, Windows.\n\nChanged in version 3.5: Added support for Windows\n\n-- Function: os.getblocking (fd, /)\n\nGet the blocking mode of the file descriptor: 'False' if the *note\nONONBLOCK: c9a. flag is set, 'True' if the flag is cleared.\n\nSee also *note setblocking(): c99. and *note\nsocket.socket.setblocking(): 2836.\n\n*note Availability: 1ad3.: Unix, Windows.\n\nThe function is limited on Emscripten and WASI, see *note\nWebAssembly platforms: 153e. for more information.\n\nOn Windows, this function is limited to pipes.\n\nNew in version 3.5.\n\nChanged in version 3.12: Added support for pipes on Windows.\n\n-- Function: os.isatty (fd, /)\n\nReturn 'True' if the file descriptor 'fd' is open and connected to\na tty(-like) device, else 'False'.\n\n-- Function: os.lockf (fd, cmd, len, /)\n\nApply, test or remove a POSIX lock on an open file descriptor.\n'fd' is an open file descriptor.  'cmd' specifies the command to\nuse - one of *note FLOCK: 2837, *note FTLOCK: 2838, *note\nFULOCK: 2839. or *note FTEST: 283a.  'len' specifies the section\nof the file to lock.\n\nRaises an *note auditing event: 161d. 'os.lockf' with arguments\n'fd', 'cmd', 'len'.\n\n*note Availability: 1ad3.: Unix.\n\nNew in version 3.3.\n\n-- Data: os.FLOCK\n-- Data: os.FTLOCK\n-- Data: os.FULOCK\n-- Data: os.FTEST\n\nFlags that specify what action *note lockf(): f83. will take.\n\n*note Availability: 1ad3.: Unix.\n\nNew in version 3.3.\n\n-- Function: os.logintty (fd, /)\n\nPrepare the tty of which fd is a file descriptor for a new login\nsession.  Make the calling process a session leader; make the tty\nthe controlling tty, the stdin, the stdout, and the stderr of the\ncalling process; close fd.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nNew in version 3.11.\n\n-- Function: os.lseek (fd, pos, whence, /)\n\nSet the current position of file descriptor 'fd' to position 'pos',\nmodified by 'whence', and return the new position in bytes relative\nto the start of the file.  Valid values for 'whence' are:\n\n* *note SEEKSET: 1106. or '0' - set 'pos' relative to the\nbeginning of the file\n\n* *note SEEKCUR: 1107. or '1' - set 'pos' relative to the\ncurrent file position\n\n* *note SEEKEND: 1108. or '2' - set 'pos' relative to the end\nof the file\n\n* *note SEEKHOLE: 283b. - set 'pos' to the next data location,\nrelative to 'pos'\n\n* *note SEEKDATA: 283c. - set 'pos' to the next data hole,\nrelative to 'pos'\n\nChanged in version 3.3: Add support for 'SEEKHOLE' and\n'SEEKDATA'.\n\n-- Data: os.SEEKSET\n-- Data: os.SEEKCUR\n-- Data: os.SEEKEND\n\nParameters to the *note lseek(): f87. function and the *note\nseek(): 1105. method on *note file-like objects: 1037, for whence\nto adjust the file position indicator.\n\n*note SEEKSET: 1106.\n\nAdjust the file position relative to the beginning of the\nfile.\n\n*note SEEKCUR: 1107.\n\nAdjust the file position relative to the current file\nposition.\n\n*note SEEKEND: 1108.\n\nAdjust the file position relative to the end of the file.\n\nTheir values are 0, 1, and 2, respectively.\n\n-- Data: os.SEEKHOLE\n-- Data: os.SEEKDATA\n\nParameters to the *note lseek(): f87. function and the *note\nseek(): 1105. method on *note file-like objects: 1037, for seeking\nfile data and holes on sparsely allocated files.\n\n'SEEKDATA'\n\nAdjust the file offset to the next location containing data,\nrelative to the seek position.\n\n'SEEKHOLE'\n\nAdjust the file offset to the next location containing a hole,\nrelative to the seek position.  A hole is defined as a\nsequence of zeros.\n\nNote: These operations only make sense for filesystems that\nsupport them.\n\n*note Availability: 1ad3.: Linux >= 3.1, macOS, Unix\n\nNew in version 3.3.\n\n-- Function: os.open (path, flags, mode=0o777, *, dirfd=None)\n\nOpen the file 'path' and set various flags according to 'flags' and\npossibly its mode according to 'mode'.  When computing 'mode', the\ncurrent umask value is first masked out.  Return the file\ndescriptor for the newly opened file.  The new file descriptor is\n*note non-inheritable: d60.\n\nFor a description of the flag and mode values, see the C run-time\ndocumentation; flag constants (like *note ORDONLY: 283d. and *note\nOWRONLY: 283e.) are defined in the *note os: 9c. module.  In\nparticular, on Windows adding *note OBINARY: 283f. is needed to\nopen files in binary mode.\n\nThis function can support *note paths relative to directory\ndescriptors: f59. with the 'dirfd' parameter.\n\nRaises an *note auditing event: 161d. 'open' with arguments 'path',\n'mode', 'flags'.\n\nChanged in version 3.4: The new file descriptor is now\nnon-inheritable.\n\nNote: This function is intended for low-level I/O. For normal\nusage, use the built-in function *note open(): 26e, which\nreturns a *note file object: 1037. with 'read()' and 'write()'\nmethods (and many more).  To wrap a file descriptor in a file\nobject, use *note fdopen(): 1c38.\n\nChanged in version 3.3: Added the 'dirfd' parameter.\n\nChanged in version 3.5: If the system call is interrupted and the\nsignal handler does not raise an exception, the function now\nretries the system call instead of raising an *note\nInterruptedError: be3. exception (see PEP 475(1) for the\nrationale).\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n",
            "subsections": []
        },
        "The following constants are options for the 'flags' parameter to the": {
            "content": "*note open(): bee. function.  They can be combined using the bitwise OR\noperator '|'.  Some of them are not available on all platforms.  For\ndescriptions of their availability and use, consult the 'open(2)' manual\npage on Unix or the MSDN(2) on Windows.\n\n-- Data: os.ORDONLY\n-- Data: os.OWRONLY\n-- Data: os.ORDWR\n-- Data: os.OAPPEND\n-- Data: os.OCREAT\n-- Data: os.OEXCL\n-- Data: os.OTRUNC\n\nThe above constants are available on Unix and Windows.\n\n-- Data: os.ODSYNC\n-- Data: os.ORSYNC\n-- Data: os.OSYNC\n-- Data: os.ONDELAY\n-- Data: os.ONONBLOCK\n-- Data: os.ONOCTTY\n-- Data: os.OCLOEXEC\n\nThe above constants are only available on Unix.\n\nChanged in version 3.3: Add *note OCLOEXEC: ef3. constant.\n\n-- Data: os.OBINARY\n-- Data: os.ONOINHERIT\n-- Data: os.OSHORTLIVED\n-- Data: os.OTEMPORARY\n-- Data: os.ORANDOM\n-- Data: os.OSEQUENTIAL\n-- Data: os.OTEXT\n\nThe above constants are only available on Windows.\n\n-- Data: os.OEVTONLY\n-- Data: os.OFSYNC\n-- Data: os.OSYMLINK\n-- Data: os.ONOFOLLOWANY\n\nThe above constants are only available on macOS.\n\nChanged in version 3.10: Add *note OEVTONLY: 60e, *note OFSYNC:\n60f, *note OSYMLINK: 610. and *note ONOFOLLOWANY: 611.\nconstants.\n\n-- Data: os.OASYNC\n-- Data: os.ODIRECT\n-- Data: os.ODIRECTORY\n-- Data: os.ONOFOLLOW\n-- Data: os.ONOATIME\n-- Data: os.OPATH\n-- Data: os.OTMPFILE\n-- Data: os.OSHLOCK\n-- Data: os.OEXLOCK\n\nThe above constants are extensions and not present if they are not\ndefined by the C library.\n\nChanged in version 3.4: Add *note OPATH: de2. on systems that\nsupport it.  Add *note OTMPFILE: de3, only available on Linux\nKernel 3.11 or newer.\n\n-- Function: os.openpty ()\n\nOpen a new pseudo-terminal pair.  Return a pair of file descriptors\n'(master, slave)' for the pty and the tty, respectively.  The new\nfile descriptors are *note non-inheritable: d60.  For a (slightly)\nmore portable approach, use the *note pty: ac. module.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nChanged in version 3.4: The new file descriptors are now\nnon-inheritable.\n\n-- Function: os.pipe ()\n\nCreate a pipe.  Return a pair of file descriptors '(r, w)' usable\nfor reading and writing, respectively.  The new file descriptor is\n*note non-inheritable: d60.\n\n*note Availability: 1ad3.: Unix, Windows.\n\nChanged in version 3.4: The new file descriptors are now\nnon-inheritable.\n\n-- Function: os.pipe2 (flags, /)\n\nCreate a pipe with 'flags' set atomically.  'flags' can be\nconstructed by ORing together one or more of these values: *note\nONONBLOCK: c9a, *note OCLOEXEC: ef3.  Return a pair of file\ndescriptors '(r, w)' usable for reading and writing, respectively.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nNew in version 3.3.\n\n-- Function: os.posixfallocate (fd, offset, len, /)\n\nEnsures that enough disk space is allocated for the file specified\nby 'fd' starting from 'offset' and continuing for 'len' bytes.\n\n*note Availability: 1ad3.: Unix, not Emscripten.\n\nNew in version 3.3.\n\n-- Function: os.posixfadvise (fd, offset, len, advice, /)\n\nAnnounces an intention to access data in a specific pattern thus\nallowing the kernel to make optimizations.  The advice applies to\nthe region of the file specified by 'fd' starting at 'offset' and\ncontinuing for 'len' bytes.  'advice' is one of *note\nPOSIXFADVNORMAL: 2855, *note POSIXFADVSEQUENTIAL: 2856, *note\nPOSIXFADVRANDOM: 2857, *note POSIXFADVNOREUSE: 2858, *note\nPOSIXFADVWILLNEED: 2859. or *note POSIXFADVDONTNEED: 285a.\n\n*note Availability: 1ad3.: Unix.\n\nNew in version 3.3.\n\n-- Data: os.POSIXFADVNORMAL\n-- Data: os.POSIXFADVSEQUENTIAL\n-- Data: os.POSIXFADVRANDOM\n-- Data: os.POSIXFADVNOREUSE\n-- Data: os.POSIXFADVWILLNEED\n-- Data: os.POSIXFADVDONTNEED\n\nFlags that can be used in 'advice' in *note posixfadvise(): bef.\nthat specify the access pattern that is likely to be used.\n\n*note Availability: 1ad3.: Unix.\n\nNew in version 3.3.\n\n-- Function: os.pread (fd, n, offset, /)\n\nRead at most 'n' bytes from file descriptor 'fd' at a position of\n'offset', leaving the file offset unchanged.\n\nReturn a bytestring containing the bytes read.  If the end of the\nfile referred to by 'fd' has been reached, an empty bytes object is\nreturned.\n\n*note Availability: 1ad3.: Unix.\n\nNew in version 3.3.\n\n-- Function: os.preadv (fd, buffers, offset, flags=0, /)\n\nRead from a file descriptor 'fd' at a position of 'offset' into\nmutable *note bytes-like objects: b82. 'buffers', leaving the file\noffset unchanged.  Transfer data into each buffer until it is full\nand then move on to the next buffer in the sequence to hold the\nrest of the data.\n\nThe flags argument contains a bitwise OR of zero or more of the\nfollowing flags:\n\n- *note RWFHIPRI: 285b.\n\n- *note RWFNOWAIT: 285c.\n\nReturn the total number of bytes actually read which can be less\nthan the total capacity of all the objects.\n\nThe operating system may set a limit (*note sysconf(): 285d. value\n''SCIOVMAX'') on the number of buffers that can be used.\n\nCombine the functionality of *note os.readv(): 99c. and *note\nos.pread(): 99d.\n\n*note Availability: 1ad3.: Linux >= 2.6.30, FreeBSD >= 6.0, OpenBSD\n>= 2.7, AIX >= 7.1.\n\nUsing flags requires Linux >= 4.6.\n\nNew in version 3.7.\n\n-- Data: os.RWFNOWAIT\n\nDo not wait for data which is not immediately available.  If this\nflag is specified, the system call will return instantly if it\nwould have to read data from the backing storage or wait for a\nlock.\n\nIf some data was successfully read, it will return the number of\nbytes read.  If no bytes were read, it will return '-1' and set\nerrno to *note errno.EAGAIN: 1fad.\n\n*note Availability: 1ad3.: Linux >= 4.14.\n\nNew in version 3.7.\n\n-- Data: os.RWFHIPRI\n\nHigh priority read/write.  Allows block-based filesystems to use\npolling of the device, which provides lower latency, but may use\nadditional resources.\n\nCurrently, on Linux, this feature is usable only on a file\ndescriptor opened using the *note ODIRECT: 2850. flag.\n\n*note Availability: 1ad3.: Linux >= 4.6.\n\nNew in version 3.7.\n\n-- Function: os.pwrite (fd, str, offset, /)\n\nWrite the bytestring in 'str' to file descriptor 'fd' at position\nof 'offset', leaving the file offset unchanged.\n\nReturn the number of bytes actually written.\n\n*note Availability: 1ad3.: Unix.\n\nNew in version 3.3.\n\n-- Function: os.pwritev (fd, buffers, offset, flags=0, /)\n\nWrite the 'buffers' contents to file descriptor 'fd' at a offset\n'offset', leaving the file offset unchanged.  'buffers' must be a\nsequence of *note bytes-like objects: b82.  Buffers are processed\nin array order.  Entire contents of the first buffer is written\nbefore proceeding to the second, and so on.\n\nThe flags argument contains a bitwise OR of zero or more of the\nfollowing flags:\n\n- *note RWFDSYNC: 285e.\n\n- *note RWFSYNC: 285f.\n\n- *note RWFAPPEND: 16ad.\n\nReturn the total number of bytes actually written.\n\nThe operating system may set a limit (*note sysconf(): 285d. value\n''SCIOVMAX'') on the number of buffers that can be used.\n\nCombine the functionality of *note os.writev(): 99f. and *note\nos.pwrite(): 9a0.\n\n*note Availability: 1ad3.: Linux >= 2.6.30, FreeBSD >= 6.0, OpenBSD\n>= 2.7, AIX >= 7.1.\n\nUsing flags requires Linux >= 4.6.\n\nNew in version 3.7.\n\n-- Data: os.RWFDSYNC\n\nProvide a per-write equivalent of the *note ODSYNC: 2844. *note\nos.open(): bee. flag.  This flag effect applies only to the data\nrange written by the system call.\n\n*note Availability: 1ad3.: Linux >= 4.7.\n\nNew in version 3.7.\n\n-- Data: os.RWFSYNC\n\nProvide a per-write equivalent of the *note OSYNC: 2846. *note\nos.open(): bee. flag.  This flag effect applies only to the data\nrange written by the system call.\n\n*note Availability: 1ad3.: Linux >= 4.7.\n\nNew in version 3.7.\n\n-- Data: os.RWFAPPEND\n\nProvide a per-write equivalent of the *note OAPPEND: 2841. *note\nos.open(): bee. flag.  This flag is meaningful only for *note\nos.pwritev(): 99e, and its effect applies only to the data range\nwritten by the system call.  The 'offset' argument does not affect\nthe write operation; the data is always appended to the end of the\nfile.  However, if the 'offset' argument is '-1', the current file\n'offset' is updated.\n\n*note Availability: 1ad3.: Linux >= 4.16.\n\nNew in version 3.10.\n\n-- Function: os.read (fd, n, /)\n\nRead at most 'n' bytes from file descriptor 'fd'.\n\nReturn a bytestring containing the bytes read.  If the end of the\nfile referred to by 'fd' has been reached, an empty bytes object is\nreturned.\n\nNote: This function is intended for low-level I/O and must be\napplied to a file descriptor as returned by *note os.open():\nbee. or *note pipe(): 1538.  To read a \"file object\" returned\nby the built-in function *note open(): 26e. or by *note\npopen(): 8b5. or *note fdopen(): 1c38, or *note sys.stdin:\n293, use its 'read()' or 'readline()' methods.\n\nChanged in version 3.5: If the system call is interrupted and the\nsignal handler does not raise an exception, the function now\nretries the system call instead of raising an *note\nInterruptedError: be3. exception (see PEP 475(3) for the\nrationale).\n\n-- Function: os.sendfile (outfd, infd, offset, count)\n\n-- Function: os.sendfile (outfd, infd, offset, count, headers=(),\ntrailers=(), flags=0)\n\nCopy 'count' bytes from file descriptor 'infd' to file descriptor\n'outfd' starting at 'offset'.  Return the number of bytes sent.\nWhen EOF is reached return '0'.\n\nThe first function notation is supported by all platforms that\ndefine *note sendfile(): 946.\n\nOn Linux, if 'offset' is given as 'None', the bytes are read from\nthe current position of 'infd' and the position of 'infd' is\nupdated.\n\nThe second case may be used on macOS and FreeBSD where 'headers'\nand 'trailers' are arbitrary sequences of buffers that are written\nbefore and after the data from 'infd' is written.  It returns the\nsame as the first case.\n\nOn macOS and FreeBSD, a value of '0' for 'count' specifies to send\nuntil the end of 'infd' is reached.\n\nAll platforms support sockets as 'outfd' file descriptor, and some\nplatforms allow other types (e.g.  regular file, pipe) as well.\n\nCross-platform applications should not use 'headers', 'trailers'\nand 'flags' arguments.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nNote: For a higher-level wrapper of *note sendfile(): 946, see\n*note socket.socket.sendfile(): cc0.\n\nNew in version 3.3.\n\nChanged in version 3.9: Parameters 'out' and 'in' was renamed to\n'outfd' and 'infd'.\n\n-- Data: os.SFNODISKIO\n-- Data: os.SFMNOWAIT\n-- Data: os.SFSYNC\n\nParameters to the *note sendfile(): 946. function, if the\nimplementation supports them.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nNew in version 3.3.\n\n-- Data: os.SFNOCACHE\n\nParameter to the *note sendfile(): 946. function, if the\nimplementation supports it.  The data won't be cached in the\nvirtual memory and will be freed afterwards.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nNew in version 3.11.\n\n-- Function: os.setblocking (fd, blocking, /)\n\nSet the blocking mode of the specified file descriptor.  Set the\n*note ONONBLOCK: c9a. flag if blocking is 'False', clear the flag\notherwise.\n\nSee also *note getblocking(): c98. and *note\nsocket.socket.setblocking(): 2836.\n\n*note Availability: 1ad3.: Unix, Windows.\n\nThe function is limited on Emscripten and WASI, see *note\nWebAssembly platforms: 153e. for more information.\n\nOn Windows, this function is limited to pipes.\n\nNew in version 3.5.\n\nChanged in version 3.12: Added support for pipes on Windows.\n\n-- Function: os.splice (src, dst, count, offsetsrc=None,\noffsetdst=None)\n\nTransfer 'count' bytes from file descriptor 'src', starting from\noffset 'offsetsrc', to file descriptor 'dst', starting from offset\n'offsetdst'.  At least one of the file descriptors must refer to a\npipe.  If 'offsetsrc' is None, then 'src' is read from the current\nposition; respectively for 'offsetdst'.  The offset associated to\nthe file descriptor that refers to a pipe must be 'None'.  The\nfiles pointed by 'src' and 'dst' must reside in the same\nfilesystem, otherwise an *note OSError: 613. is raised with *note\nerrno: 1f9a. set to *note errno.EXDEV: 2834.\n\nThis copy is done without the additional cost of transferring data\nfrom the kernel to user space and then back into the kernel.\nAdditionally, some filesystems could implement extra optimizations.\nThe copy is done as if both files are opened as binary.\n\nUpon successful completion, returns the number of bytes spliced to\nor from the pipe.  A return value of 0 means end of input.  If\n'src' refers to a pipe, then this means that there was no data to\ntransfer, and it would not make sense to block because there are no\nwriters connected to the write end of the pipe.\n\n*note Availability: 1ad3.: Linux >= 2.6.17 with glibc >= 2.5\n\nNew in version 3.10.\n\n-- Data: os.SPLICEFMOVE\n-- Data: os.SPLICEFNONBLOCK\n-- Data: os.SPLICEFMORE\n\nNew in version 3.10.\n\n-- Function: os.readv (fd, buffers, /)\n\nRead from a file descriptor 'fd' into a number of mutable *note\nbytes-like objects: b82. 'buffers'.  Transfer data into each buffer\nuntil it is full and then move on to the next buffer in the\nsequence to hold the rest of the data.\n\nReturn the total number of bytes actually read which can be less\nthan the total capacity of all the objects.\n\nThe operating system may set a limit (*note sysconf(): 285d. value\n''SCIOVMAX'') on the number of buffers that can be used.\n\n*note Availability: 1ad3.: Unix.\n\nNew in version 3.3.\n\n-- Function: os.tcgetpgrp (fd, /)\n\nReturn the process group associated with the terminal given by 'fd'\n(an open file descriptor as returned by *note os.open(): bee.).\n\n*note Availability: 1ad3.: Unix, not WASI.\n\n-- Function: os.tcsetpgrp (fd, pg, /)\n\nSet the process group associated with the terminal given by 'fd'\n(an open file descriptor as returned by *note os.open(): bee.) to\n'pg'.\n\n*note Availability: 1ad3.: Unix, not WASI.\n\n-- Function: os.ttyname (fd, /)\n\nReturn a string which specifies the terminal device associated with\nfile descriptor 'fd'.  If 'fd' is not associated with a terminal\ndevice, an exception is raised.\n\n*note Availability: 1ad3.: Unix.\n\n-- Function: os.write (fd, str, /)\n\nWrite the bytestring in 'str' to file descriptor 'fd'.\n\nReturn the number of bytes actually written.\n\nNote: This function is intended for low-level I/O and must be\napplied to a file descriptor as returned by *note os.open():\nbee. or *note pipe(): 1538.  To write a \"file object\" returned\nby the built-in function *note open(): 26e. or by *note\npopen(): 8b5. or *note fdopen(): 1c38, or *note sys.stdout:\n90c. or *note sys.stderr: 757, use its 'write()' method.\n\nChanged in version 3.5: If the system call is interrupted and the\nsignal handler does not raise an exception, the function now\nretries the system call instead of raising an *note\nInterruptedError: be3. exception (see PEP 475(4) for the\nrationale).\n\n-- Function: os.writev (fd, buffers, /)\n\nWrite the contents of 'buffers' to file descriptor 'fd'.  'buffers'\nmust be a sequence of *note bytes-like objects: b82.  Buffers are\nprocessed in array order.  Entire contents of the first buffer is\nwritten before proceeding to the second, and so on.\n\nReturns the total number of bytes actually written.\n\nThe operating system may set a limit (*note sysconf(): 285d. value\n''SCIOVMAX'') on the number of buffers that can be used.\n\n*note Availability: 1ad3.: Unix.\n\nNew in version 3.3.\n\n* Menu:\n\n* Querying the size of a terminal::\n* Inheritance of File Descriptors::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0475/\n\n(2) https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx\n\n(3) https://peps.python.org/pep-0475/\n\n(4) https://peps.python.org/pep-0475/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Querying the size of a terminal,  Next: Inheritance of File Descriptors,  Up: File Descriptor Operations": {
            "content": "5.16.1.6 Querying the size of a terminal\n........................................\n\nNew in version 3.3.\n\n-- Function: os.getterminalsize (fd=STDOUTFILENO, /)\n\nReturn the size of the terminal window as '(columns, lines)', tuple\nof type *note terminalsize: 256f.\n\nThe optional argument 'fd' (default 'STDOUTFILENO', or standard\noutput) specifies which file descriptor should be queried.\n\nIf the file descriptor is not connected to a terminal, an *note\nOSError: 613. is raised.\n\n*note shutil.getterminalsize(): f73. is the high-level function\nwhich should normally be used, 'os.getterminalsize' is the\nlow-level implementation.\n\n*note Availability: 1ad3.: Unix, Windows.\n\n-- Class: os.terminalsize\n\nA subclass of tuple, holding '(columns, lines)' of the terminal\nwindow size.\n\n-- Attribute: columns\n\nWidth of the terminal window in characters.\n\n-- Attribute: lines\n\nHeight of the terminal window in characters.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Inheritance of File Descriptors,  Prev: Querying the size of a terminal,  Up: File Descriptor Operations": {
            "content": "5.16.1.7 Inheritance of File Descriptors\n........................................\n\nNew in version 3.4.\n\nA file descriptor has an \"inheritable\" flag which indicates if the file\ndescriptor can be inherited by child processes.  Since Python 3.4, file\ndescriptors created by Python are non-inheritable by default.\n",
            "subsections": []
        },
        "On UNIX, non-inheritable file descriptors are closed in child processes": {
            "content": "at the execution of a new program, other file descriptors are inherited.\n",
            "subsections": []
        },
        "On Windows, non-inheritable handles and file descriptors are closed in": {
            "content": "child processes, except for standard streams (file descriptors 0, 1 and\n2: stdin, stdout and stderr), which are always inherited.  Using *note\nspawn*: 1479. functions, all inheritable handles and all inheritable\nfile descriptors are inherited.  Using the *note subprocess: d0. module,\nall file descriptors except standard streams are closed, and inheritable\nhandles are only inherited if the 'closefds' parameter is 'False'.\n",
            "subsections": []
        },
        "On WebAssembly platforms 'wasm32-emscripten' and 'wasm32-wasi', the file": {
            "content": "descriptor cannot be modified.\n\n-- Function: os.getinheritable (fd, /)\n\nGet the \"inheritable\" flag of the specified file descriptor (a\nboolean).\n\n-- Function: os.setinheritable (fd, inheritable, /)\n\nSet the \"inheritable\" flag of the specified file descriptor.\n\n-- Function: os.gethandleinheritable (handle, /)\n\nGet the \"inheritable\" flag of the specified handle (a boolean).\n\n*note Availability: 1ad3.: Windows.\n\n-- Function: os.sethandleinheritable (handle, inheritable, /)\n\nSet the \"inheritable\" flag of the specified handle.\n\n*note Availability: 1ad3.: Windows.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Files and Directories,  Next: Process Management,  Prev: File Descriptor Operations,  Up: os -- Miscellaneous operating system interfaces": {
            "content": "5.16.1.8 Files and Directories\n..............................\n",
            "subsections": []
        },
        "On some Unix platforms, many of these functions support one or more of": {
            "content": "these features:\n\n* 'specifying a file descriptor:' Normally the 'path' argument\nprovided to functions in the *note os: 9c. module must be a string\nspecifying a file path.  However, some functions now alternatively\naccept an open file descriptor for their 'path' argument.  The\nfunction will then operate on the file referred to by the\ndescriptor.  (For POSIX systems, Python will call the variant of\nthe function prefixed with 'f' (e.g.  call 'fchdir' instead of\n'chdir').)\n\nYou can check whether or not 'path' can be specified as a file\ndescriptor for a particular function on your platform using *note\nos.supportsfd: f6d.  If this functionality is unavailable, using\nit will raise a *note NotImplementedError: ba5.\n\nIf the function also supports 'dirfd' or 'followsymlinks'\narguments, it's an error to specify one of those when supplying\n'path' as a file descriptor.\n\n* 'paths relative to directory descriptors:' If 'dirfd' is not\n'None', it should be a file descriptor referring to a directory,\nand the path to operate on should be relative; path will then be\nrelative to that directory.  If the path is absolute, 'dirfd' is\nignored.  (For POSIX systems, Python will call the variant of the\nfunction with an 'at' suffix and possibly prefixed with 'f' (e.g.\ncall 'faccessat' instead of 'access').\n\nYou can check whether or not 'dirfd' is supported for a particular\nfunction on your platform using *note os.supportsdirfd: f68.  If\nit's unavailable, using it will raise a *note NotImplementedError:\nba5.\n\n* 'not following symlinks:' If 'followsymlinks' is 'False', and the\nlast element of the path to operate on is a symbolic link, the\nfunction will operate on the symbolic link itself rather than the\nfile pointed to by the link.  (For POSIX systems, Python will call\nthe 'l...' variant of the function.)\n\nYou can check whether or not 'followsymlinks' is supported for a\nparticular function on your platform using *note\nos.supportsfollowsymlinks: 255a.  If it's unavailable, using it\nwill raise a *note NotImplementedError: ba5.\n\n-- Function: os.access (path, mode, *, dirfd=None,\neffectiveids=False, followsymlinks=True)\n\nUse the real uid/gid to test for access to 'path'.  Note that most\noperations will use the effective uid/gid, therefore this routine\ncan be used in a suid/sgid environment to test if the invoking user\nhas the specified access to 'path'.  'mode' should be *note FOK:\n2870. to test the existence of 'path', or it can be the inclusive\nOR of one or more of *note ROK: 2871, *note WOK: 2872, and *note\nXOK: 2873. to test permissions.  Return *note True: a53. if access\nis allowed, *note False: 971. if not.  See the Unix man page\n'access(2)' for more information.\n\nThis function can support specifying *note paths relative to\ndirectory descriptors: f59. and *note not following symlinks: f5a.\n\nIf 'effectiveids' is 'True', *note access(): f5b. will perform its\naccess checks using the effective uid/gid instead of the real\nuid/gid.  'effectiveids' may not be supported on your platform;\nyou can check whether or not it is available using *note\nos.supportseffectiveids: f6e.  If it is unavailable, using it\nwill raise a *note NotImplementedError: ba5.\n\nNote: Using *note access(): f5b. to check if a user is\nauthorized to e.g.  open a file before actually doing so using\n*note open(): 26e. creates a security hole, because the user\nmight exploit the short time interval between checking and\nopening the file to manipulate it.  It's preferable to use\n*note EAFP: 2874. techniques.  For example:\n\nif os.access(\"myfile\", os.ROK):\nwith open(\"myfile\") as fp:\nreturn fp.read()\nreturn \"some default data\"\n\nis better written as:\n\ntry:\nfp = open(\"myfile\")\nexcept PermissionError:\nreturn \"some default data\"\nelse:\nwith fp:\nreturn fp.read()\n\nNote: I/O operations may fail even when *note access(): f5b.\nindicates that they would succeed, particularly for operations\non network filesystems which may have permissions semantics\nbeyond the usual POSIX permission-bit model.\n\nChanged in version 3.3: Added the 'dirfd', 'effectiveids', and\n'followsymlinks' parameters.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Data: os.FOK\n-- Data: os.ROK\n-- Data: os.WOK\n-- Data: os.XOK\n\nValues to pass as the 'mode' parameter of *note access(): f5b. to\ntest the existence, readability, writability and executability of\n'path', respectively.\n\n-- Function: os.chdir (path)\n\nChange the current working directory to 'path'.\n\nThis function can support *note specifying a file descriptor: 999.\nThe descriptor must refer to an opened directory, not an open file.\n\nThis function can raise *note OSError: 613. and subclasses such as\n*note FileNotFoundError: 353, *note PermissionError: b9a, and *note\nNotADirectoryError: ed3.\n\nRaises an *note auditing event: 161d. 'os.chdir' with argument\n'path'.\n\nChanged in version 3.3: Added support for specifying 'path' as a\nfile descriptor on some platforms.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.chflags (path, flags, *, followsymlinks=True)\n\nSet the flags of 'path' to the numeric 'flags'.  'flags' may take a\ncombination (bitwise OR) of the following values (as defined in the\n*note stat: cb. module):\n\n* *note stat.UFNODUMP: 2508.\n\n* *note stat.UFIMMUTABLE: 2509.\n\n* *note stat.UFAPPEND: 250a.\n\n* *note stat.UFOPAQUE: 250b.\n\n* *note stat.UFNOUNLINK: 250c.\n\n* *note stat.UFCOMPRESSED: 250d.\n\n* *note stat.UFHIDDEN: 250e.\n\n* *note stat.SFARCHIVED: 250f.\n\n* *note stat.SFIMMUTABLE: 2510.\n\n* *note stat.SFAPPEND: 2511.\n\n* *note stat.SFNOUNLINK: 2512.\n\n* *note stat.SFSNAPSHOT: 2513.\n\nThis function can support *note not following symlinks: f5a.\n\nRaises an *note auditing event: 161d. 'os.chflags' with arguments\n'path', 'flags'.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nChanged in version 3.3: Added the 'followsymlinks' parameter.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.chmod (path, mode, *, dirfd=None,\nfollowsymlinks=True)\n\nChange the mode of 'path' to the numeric 'mode'.  'mode' may take\none of the following values (as defined in the *note stat: cb.\nmodule) or bitwise ORed combinations of them:\n\n* *note stat.SISUID: 24f5.\n\n* *note stat.SISGID: 24f6.\n\n* *note stat.SENFMT: 24f8.\n\n* *note stat.SISVTX: 24f9.\n\n* *note stat.SIREAD: 2505.\n\n* *note stat.SIWRITE: 2506.\n\n* *note stat.SIEXEC: 2507.\n\n* *note stat.SIRWXU: 24fa.\n\n* *note stat.SIRUSR: 24fb.\n\n* *note stat.SIWUSR: 24fc.\n\n* *note stat.SIXUSR: 24fd.\n\n* *note stat.SIRWXG: 24fe.\n\n* *note stat.SIRGRP: 24ff.\n\n* *note stat.SIWGRP: 2500.\n\n* *note stat.SIXGRP: 24f7.\n\n* *note stat.SIRWXO: 2501.\n\n* *note stat.SIROTH: 2502.\n\n* *note stat.SIWOTH: 2503.\n\n* *note stat.SIXOTH: 2504.\n\nThis function can support *note specifying a file descriptor: 999,\n*note paths relative to directory descriptors: f59. and *note not\nfollowing symlinks: f5a.\n\nNote: Although Windows supports *note chmod(): f5d, you can\nonly set the file's read-only flag with it (via the\n'stat.SIWRITE' and 'stat.SIREAD' constants or a\ncorresponding integer value).  All other bits are ignored.\n\nThe function is limited on Emscripten and WASI, see *note\nWebAssembly platforms: 153e. for more information.\n\nRaises an *note auditing event: 161d. 'os.chmod' with arguments\n'path', 'mode', 'dirfd'.\n\nNew in version 3.3: Added support for specifying 'path' as an open\nfile descriptor, and the 'dirfd' and 'followsymlinks' arguments.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.chown (path, uid, gid, *, dirfd=None,\nfollowsymlinks=True)\n\nChange the owner and group id of 'path' to the numeric 'uid' and\n'gid'.  To leave one of the ids unchanged, set it to -1.\n\nThis function can support *note specifying a file descriptor: 999,\n*note paths relative to directory descriptors: f59. and *note not\nfollowing symlinks: f5a.\n\nSee *note shutil.chown(): f9f. for a higher-level function that\naccepts names in addition to numeric ids.\n\nRaises an *note auditing event: 161d. 'os.chown' with arguments\n'path', 'uid', 'gid', 'dirfd'.\n\n*note Availability: 1ad3.: Unix.\n\nThe function is limited on Emscripten and WASI, see *note\nWebAssembly platforms: 153e. for more information.\n\nNew in version 3.3: Added support for specifying 'path' as an open\nfile descriptor, and the 'dirfd' and 'followsymlinks' arguments.\n\nChanged in version 3.6: Supports a *note path-like object: 957.\n\n-- Function: os.chroot (path)\n\nChange the root directory of the current process to 'path'.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.fchdir (fd)\n\nChange the current working directory to the directory represented\nby the file descriptor 'fd'.  The descriptor must refer to an\nopened directory, not an open file.  As of Python 3.3, this is\nequivalent to 'os.chdir(fd)'.\n\nRaises an *note auditing event: 161d. 'os.chdir' with argument\n'path'.\n\n*note Availability: 1ad3.: Unix.\n\n-- Function: os.getcwd ()\n\nReturn a string representing the current working directory.\n\n-- Function: os.getcwdb ()\n\nReturn a bytestring representing the current working directory.\n\nChanged in version 3.8: The function now uses the UTF-8 encoding on\nWindows, rather than the ANSI code page: see PEP 529(1) for the\nrationale.  The function is no longer deprecated on Windows.\n\n-- Function: os.lchflags (path, flags)\n\nSet the flags of 'path' to the numeric 'flags', like *note\nchflags(): f5c, but do not follow symbolic links.  As of Python\n3.3, this is equivalent to 'os.chflags(path, flags,\nfollowsymlinks=False)'.\n\nRaises an *note auditing event: 161d. 'os.chflags' with arguments\n'path', 'flags'.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.lchmod (path, mode)\n\nChange the mode of 'path' to the numeric 'mode'.  If path is a\nsymlink, this affects the symlink rather than the target.  See the\ndocs for *note chmod(): f5d. for possible values of 'mode'.  As of\nPython 3.3, this is equivalent to 'os.chmod(path, mode,\nfollowsymlinks=False)'.\n\n'lchmod()' is not part of POSIX, but Unix implementations may have\nit if changing the mode of symbolic links is supported.\n\nRaises an *note auditing event: 161d. 'os.chmod' with arguments\n'path', 'mode', 'dirfd'.\n\n*note Availability: 1ad3.: Unix, not Linux, FreeBSD >= 1.3, NetBSD\n>= 1.3, not OpenBSD\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.lchown (path, uid, gid)\n\nChange the owner and group id of 'path' to the numeric 'uid' and\n'gid'.  This function will not follow symbolic links.  As of Python\n3.3, this is equivalent to 'os.chown(path, uid, gid,\nfollowsymlinks=False)'.\n\nRaises an *note auditing event: 161d. 'os.chown' with arguments\n'path', 'uid', 'gid', 'dirfd'.\n\n*note Availability: 1ad3.: Unix.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.link (src, dst, *, srcdirfd=None, dstdirfd=None,\nfollowsymlinks=True)\n\nCreate a hard link pointing to 'src' named 'dst'.\n\nThis function can support specifying 'srcdirfd' and/or\n'dstdirfd' to supply *note paths relative to directory\ndescriptors: f59, and *note not following symlinks: f5a.\n\nRaises an *note auditing event: 161d. 'os.link' with arguments\n'src', 'dst', 'srcdirfd', 'dstdirfd'.\n\n*note Availability: 1ad3.: Unix, Windows, not Emscripten.\n\nChanged in version 3.2: Added Windows support.\n\nChanged in version 3.3: Added the 'srcdirfd', 'dstdirfd', and\n'followsymlinks' parameters.\n\nChanged in version 3.6: Accepts a *note path-like object: 957. for\n'src' and 'dst'.\n\n-- Function: os.listdir (path='.')\n\nReturn a list containing the names of the entries in the directory\ngiven by 'path'.  The list is in arbitrary order, and does not\ninclude the special entries ''.'' and ''..'' even if they are\npresent in the directory.  If a file is removed from or added to\nthe directory during the call of this function, whether a name for\nthat file be included is unspecified.\n\n'path' may be a *note path-like object: 957.  If 'path' is of type\n'bytes' (directly or indirectly through the *note PathLike: a9a.\ninterface), the filenames returned will also be of type 'bytes'; in\nall other circumstances, they will be of type 'str'.\n\nThis function can also support *note specifying a file descriptor:\n999.; the file descriptor must refer to a directory.\n\nRaises an *note auditing event: 161d. 'os.listdir' with argument\n'path'.\n\nNote: To encode 'str' filenames to 'bytes', use *note\nfsencode(): a9e.\n\nSee also\n........\n\nThe *note scandir(): 88c. function returns directory entries along\nwith file attribute information, giving better performance for many\ncommon use cases.\n\nChanged in version 3.2: The 'path' parameter became optional.\n\nNew in version 3.3: Added support for specifying 'path' as an open\nfile descriptor.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.listdrives ()\n\nReturn a list containing the names of drives on a Windows system.\n\nA drive name typically looks like ''C:\\\\''.  Not every drive name\nwill be associated with a volume, and some may be inaccessible for\na variety of reasons, including permissions, network connectivity\nor missing media.  This function does not test for access.\n\nMay raise *note OSError: 613. if an error occurs collecting the\ndrive names.\n\nRaises an *note auditing event: 161d. 'os.listdrives' with no\narguments.\n\n*note Availability: 1ad3.: Windows\n\nNew in version 3.12.\n\n-- Function: os.listmounts (volume)\n\nReturn a list containing the mount points for a volume on a Windows\nsystem.\n\n'volume' must be represented as a GUID path, like those returned by\n*note os.listvolumes(): 1bd.  Volumes may be mounted in multiple\nlocations or not at all.  In the latter case, the list will be\nempty.  Mount points that are not associated with a volume will not\nbe returned by this function.\n\nThe mount points return by this function will be absolute paths,\nand may be longer than the drive name.\n\nRaises *note OSError: 613. if the volume is not recognized or if an\nerror occurs collecting the paths.\n\nRaises an *note auditing event: 161d. 'os.listmounts' with argument\n'volume'.\n\n*note Availability: 1ad3.: Windows\n\nNew in version 3.12.\n\n-- Function: os.listvolumes ()\n\nReturn a list containing the volumes in the system.\n\nVolumes are typically represented as a GUID path that looks like\n'\\\\?\\Volume{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}\\'.  Files can\nusually be accessed through a GUID path, permissions allowing.\nHowever, users are generally not familiar with them, and so the\nrecommended use of this function is to retrieve mount points using\n*note os.listmounts(): 1be.\n\nMay raise *note OSError: 613. if an error occurs collecting the\nvolumes.\n\nRaises an *note auditing event: 161d. 'os.listvolumes' with no\narguments.\n\n*note Availability: 1ad3.: Windows\n\nNew in version 3.12.\n\n-- Function: os.lstat (path, *, dirfd=None)\n\nPerform the equivalent of an 'lstat()' system call on the given\npath.  Similar to *note stat(): 1bf, but does not follow symbolic\nlinks.  Return a *note statresult: 1318. object.\n\nOn platforms that do not support symbolic links, this is an alias\nfor *note stat(): 1bf.\n\nAs of Python 3.3, this is equivalent to 'os.stat(path,\ndirfd=dirfd, followsymlinks=False)'.\n\nThis function can also support *note paths relative to directory\ndescriptors: f59.\n\nSee also\n........\n\nThe *note stat(): 1bf. function.\n\nChanged in version 3.2: Added support for Windows 6.0 (Vista)\nsymbolic links.\n\nChanged in version 3.3: Added the 'dirfd' parameter.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\nChanged in version 3.8: On Windows, now opens reparse points that\nrepresent another path (name surrogates), including symbolic links\nand directory junctions.  Other kinds of reparse points are\nresolved by the operating system as for *note stat(): 1bf.\n\n-- Function: os.mkdir (path, mode=0o777, *, dirfd=None)\n\nCreate a directory named 'path' with numeric mode 'mode'.\n\nIf the directory already exists, *note FileExistsError: e97. is\nraised.  If a parent directory in the path does not exist, *note\nFileNotFoundError: 353. is raised.  On some systems, 'mode' is\nignored.  Where it is used, the current umask value is first masked\nout.  If bits other than the last 9 (i.e.  the last 3 digits of the\noctal representation of the 'mode') are set, their meaning is\nplatform-dependent.  On some platforms, they are ignored and you\nshould call *note chmod(): f5d. explicitly to set them.\n\nThis function can also support *note paths relative to directory\ndescriptors: f59.\n\nIt is also possible to create temporary directories; see the *note\ntempfile: da. module's *note tempfile.mkdtemp(): 1eb. function.\n\nRaises an *note auditing event: 161d. 'os.mkdir' with arguments\n'path', 'mode', 'dirfd'.\n\nChanged in version 3.3: Added the 'dirfd' parameter.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.makedirs (name, mode=0o777, existok=False)\n\nRecursive directory creation function.  Like *note mkdir(): f60,\nbut makes all intermediate-level directories needed to contain the\nleaf directory.\n\nThe 'mode' parameter is passed to *note mkdir(): f60. for creating\nthe leaf directory; see *note the mkdir() description: 2877. for\nhow it is interpreted.  To set the file permission bits of any\nnewly created parent directories you can set the umask before\ninvoking *note makedirs(): 9a1.  The file permission bits of\nexisting parent directories are not changed.\n\nIf 'existok' is 'False' (the default), a *note FileExistsError:\ne97. is raised if the target directory already exists.\n\nNote: *note makedirs(): 9a1. will become confused if the path\nelements to create include *note pardir: 2878. (eg.  \"..\" on\nUNIX systems).\n\nThis function handles UNC paths correctly.\n\nRaises an *note auditing event: 161d. 'os.mkdir' with arguments\n'path', 'mode', 'dirfd'.\n\nChanged in version 3.2: Added the 'existok' parameter.\n\nChanged in version 3.4.1: Before Python 3.4.1, if 'existok' was\n'True' and the directory existed, *note makedirs(): 9a1. would\nstill raise an error if 'mode' did not match the mode of the\nexisting directory.  Since this behavior was impossible to\nimplement safely, it was removed in Python 3.4.1.  See\nbpo-21082(2).\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\nChanged in version 3.7: The 'mode' argument no longer affects the\nfile permission bits of newly created intermediate-level\ndirectories.\n\n-- Function: os.mkfifo (path, mode=0o666, *, dirfd=None)\n\nCreate a FIFO (a named pipe) named 'path' with numeric mode 'mode'.\nThe current umask value is first masked out from the mode.\n\nThis function can also support *note paths relative to directory\ndescriptors: f59.\n\nFIFOs are pipes that can be accessed like regular files.  FIFOs\nexist until they are deleted (for example with *note os.unlink():\nf66.).  Generally, FIFOs are used as rendezvous between \"client\"\nand \"server\" type processes: the server opens the FIFO for reading,\nand the client opens it for writing.  Note that *note mkfifo():\nbec. doesn't open the FIFO -- it just creates the rendezvous point.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nChanged in version 3.3: Added the 'dirfd' parameter.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.mknod (path, mode=0o600, device=0, *, dirfd=None)\n\nCreate a filesystem node (file, device special file or named pipe)\nnamed 'path'.  'mode' specifies both the permissions to use and the\ntype of node to be created, being combined (bitwise OR) with one of\n'stat.SIFREG', 'stat.SIFCHR', 'stat.SIFBLK', and 'stat.SIFIFO'\n(those constants are available in *note stat: cb.).  For\n'stat.SIFCHR' and 'stat.SIFBLK', 'device' defines the newly\ncreated device special file (probably using *note os.makedev():\n13d8.), otherwise it is ignored.\n\nThis function can also support *note paths relative to directory\ndescriptors: f59.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nChanged in version 3.3: Added the 'dirfd' parameter.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.major (device, /)\n\nExtract the device major number from a raw device number (usually\nthe 'stdev' or 'strdev' field from 'stat').\n\n-- Function: os.minor (device, /)\n\nExtract the device minor number from a raw device number (usually\nthe 'stdev' or 'strdev' field from 'stat').\n\n-- Function: os.makedev (major, minor, /)\n\nCompose a raw device number from the major and minor device\nnumbers.\n\n-- Function: os.pathconf (path, name)\n\nReturn system configuration information relevant to a named file.\n'name' specifies the configuration value to retrieve; it may be a\nstring which is the name of a defined system value; these names are\nspecified in a number of standards (POSIX.1, Unix 95, Unix 98, and\nothers).  Some platforms define additional names as well.  The\nnames known to the host operating system are given in the\n'pathconfnames' dictionary.  For configuration variables not\nincluded in that mapping, passing an integer for 'name' is also\naccepted.\n\nIf 'name' is a string and is not known, *note ValueError: 183. is\nraised.  If a specific value for 'name' is not supported by the\nhost system, even if it is included in 'pathconfnames', an *note\nOSError: 613. is raised with *note errno.EINVAL: 1766. for the\nerror number.\n\nThis function can support *note specifying a file descriptor: 999.\n\n*note Availability: 1ad3.: Unix.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Data: os.pathconfnames\n\nDictionary mapping names accepted by *note pathconf(): f6b. and\n*note fpathconf(): 2835. to the integer values defined for those\nnames by the host operating system.  This can be used to determine\nthe set of names known to the system.\n\n*note Availability: 1ad3.: Unix.\n\n-- Function: os.readlink (path, *, dirfd=None)\n\nReturn a string representing the path to which the symbolic link\npoints.  The result may be either an absolute or relative pathname;\nif it is relative, it may be converted to an absolute pathname\nusing 'os.path.join(os.path.dirname(path), result)'.\n\nIf the 'path' is a string object (directly or indirectly through a\n*note PathLike: a9a. interface), the result will also be a string\nobject, and the call may raise a UnicodeDecodeError.  If the 'path'\nis a bytes object (direct or indirectly), the result will be a\nbytes object.\n\nThis function can also support *note paths relative to directory\ndescriptors: f59.\n\nWhen trying to resolve a path that may contain links, use *note\nrealpath(): 351. to properly handle recursion and platform\ndifferences.\n\n*note Availability: 1ad3.: Unix, Windows.\n\nChanged in version 3.2: Added support for Windows 6.0 (Vista)\nsymbolic links.\n\nChanged in version 3.3: Added the 'dirfd' parameter.\n\nChanged in version 3.6: Accepts a *note path-like object: 957. on\nUnix.\n\nChanged in version 3.8: Accepts a *note path-like object: 957. and\na bytes object on Windows.\n\nAdded support for directory junctions, and changed to return the\nsubstitution path (which typically includes '\\\\?\\' prefix) rather\nthan the optional \"print name\" field that was previously returned.\n\n-- Function: os.remove (path, *, dirfd=None)\n\nRemove (delete) the file 'path'.  If 'path' is a directory, an\n*note OSError: 613. is raised.  Use *note rmdir(): f64. to remove\ndirectories.  If the file does not exist, a *note\nFileNotFoundError: 353. is raised.\n\nThis function can support *note paths relative to directory\ndescriptors: f59.\n\nOn Windows, attempting to remove a file that is in use causes an\nexception to be raised; on Unix, the directory entry is removed but\nthe storage allocated to the file is not made available until the\noriginal file is no longer in use.\n\nThis function is semantically identical to *note unlink(): f66.\n\nRaises an *note auditing event: 161d. 'os.remove' with arguments\n'path', 'dirfd'.\n\nChanged in version 3.3: Added the 'dirfd' parameter.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.removedirs (name)\n\nRemove directories recursively.  Works like *note rmdir(): f64.\nexcept that, if the leaf directory is successfully removed, *note\nremovedirs(): 287a. tries to successively remove every parent\ndirectory mentioned in 'path' until an error is raised (which is\nignored, because it generally means that a parent directory is not\nempty).  For example, 'os.removedirs('foo/bar/baz')' will first\nremove the directory ''foo/bar/baz'', and then remove ''foo/bar''\nand ''foo'' if they are empty.  Raises *note OSError: 613. if the\nleaf directory could not be successfully removed.\n\nRaises an *note auditing event: 161d. 'os.remove' with arguments\n'path', 'dirfd'.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.rename (src, dst, *, srcdirfd=None, dstdirfd=None)\n\nRename the file or directory 'src' to 'dst'.  If 'dst' exists, the\noperation will fail with an *note OSError: 613. subclass in a\nnumber of cases:\n\nOn Windows, if 'dst' exists a *note FileExistsError: e97. is always\nraised.  The operation may fail if 'src' and 'dst' are on different\nfilesystems.  Use *note shutil.move(): 889. to support moves to a\ndifferent filesystem.\n\nOn Unix, if 'src' is a file and 'dst' is a directory or vice-versa,\nan *note IsADirectoryError: ed2. or a *note NotADirectoryError:\ned3. will be raised respectively.  If both are directories and\n'dst' is empty, 'dst' will be silently replaced.  If 'dst' is a\nnon-empty directory, an *note OSError: 613. is raised.  If both are\nfiles, 'dst' will be replaced silently if the user has permission.\nThe operation may fail on some Unix flavors if 'src' and 'dst' are\non different filesystems.  If successful, the renaming will be an\natomic operation (this is a POSIX requirement).\n\nThis function can support specifying 'srcdirfd' and/or\n'dstdirfd' to supply *note paths relative to directory\ndescriptors: f59.\n\nIf you want cross-platform overwriting of the destination, use\n*note replace(): f63.\n\nRaises an *note auditing event: 161d. 'os.rename' with arguments\n'src', 'dst', 'srcdirfd', 'dstdirfd'.\n\nChanged in version 3.3: Added the 'srcdirfd' and 'dstdirfd'\nparameters.\n\nChanged in version 3.6: Accepts a *note path-like object: 957. for\n'src' and 'dst'.\n\n-- Function: os.renames (old, new)\n\nRecursive directory or file renaming function.  Works like *note\nrename(): f62, except creation of any intermediate directories\nneeded to make the new pathname good is attempted first.  After the\nrename, directories corresponding to rightmost path segments of the\nold name will be pruned away using *note removedirs(): 287a.\n\nNote: This function can fail with the new directory structure\nmade if you lack permissions needed to remove the leaf\ndirectory or file.\n\nRaises an *note auditing event: 161d. 'os.rename' with arguments\n'src', 'dst', 'srcdirfd', 'dstdirfd'.\n\nChanged in version 3.6: Accepts a *note path-like object: 957. for\n'old' and 'new'.\n\n-- Function: os.replace (src, dst, *, srcdirfd=None, dstdirfd=None)\n\nRename the file or directory 'src' to 'dst'.  If 'dst' is a\nnon-empty directory, *note OSError: 613. will be raised.  If 'dst'\nexists and is a file, it will be replaced silently if the user has\npermission.  The operation may fail if 'src' and 'dst' are on\ndifferent filesystems.  If successful, the renaming will be an\natomic operation (this is a POSIX requirement).\n\nThis function can support specifying 'srcdirfd' and/or\n'dstdirfd' to supply *note paths relative to directory\ndescriptors: f59.\n\nRaises an *note auditing event: 161d. 'os.rename' with arguments\n'src', 'dst', 'srcdirfd', 'dstdirfd'.\n\nNew in version 3.3.\n\nChanged in version 3.6: Accepts a *note path-like object: 957. for\n'src' and 'dst'.\n\n-- Function: os.rmdir (path, *, dirfd=None)\n\nRemove (delete) the directory 'path'.  If the directory does not\nexist or is not empty, a *note FileNotFoundError: 353. or an *note\nOSError: 613. is raised respectively.  In order to remove whole\ndirectory trees, *note shutil.rmtree(): 1d5. can be used.\n\nThis function can support *note paths relative to directory\ndescriptors: f59.\n\nRaises an *note auditing event: 161d. 'os.rmdir' with arguments\n'path', 'dirfd'.\n\nChanged in version 3.3: Added the 'dirfd' parameter.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.scandir (path='.')\n\nReturn an iterator of *note os.DirEntry: 1ba. objects corresponding\nto the entries in the directory given by 'path'.  The entries are\nyielded in arbitrary order, and the special entries ''.'' and\n''..'' are not included.  If a file is removed from or added to the\ndirectory after creating the iterator, whether an entry for that\nfile be included is unspecified.\n\nUsing *note scandir(): 88c. instead of *note listdir(): f6a. can\nsignificantly increase the performance of code that also needs file\ntype or file attribute information, because *note os.DirEntry: 1ba.\nobjects expose this information if the operating system provides it\nwhen scanning a directory.  All *note os.DirEntry: 1ba. methods may\nperform a system call, but *note isdir(): 287c. and *note\nisfile(): bdf. usually only require a system call for symbolic\nlinks; *note os.DirEntry.stat(): 13f5. always requires a system\ncall on Unix but only requires one for symbolic links on Windows.\n\n'path' may be a *note path-like object: 957.  If 'path' is of type\n'bytes' (directly or indirectly through the *note PathLike: a9a.\ninterface), the type of the *note name: 287d. and *note path: 287e.\nattributes of each *note os.DirEntry: 1ba. will be 'bytes'; in all\nother circumstances, they will be of type 'str'.\n\nThis function can also support *note specifying a file descriptor:\n999.; the file descriptor must refer to a directory.\n\nRaises an *note auditing event: 161d. 'os.scandir' with argument\n'path'.\n\nThe *note scandir(): 88c. iterator supports the *note context\nmanager: 398. protocol and has the following method:\n\n-- Method: scandir.close ()\n\nClose the iterator and free acquired resources.\n\nThis is called automatically when the iterator is exhausted or\ngarbage collected, or when an error happens during iterating.\nHowever it is advisable to call it explicitly or use the *note\nwith: 396. statement.\n\nNew in version 3.6.\n\nThe following example shows a simple use of *note scandir(): 88c.\nto display all the files (excluding directories) in the given\n'path' that don't start with ''.''.  The 'entry.isfile()' call\nwill generally not make an additional system call:\n\nwith os.scandir(path) as it:\nfor entry in it:\nif not entry.name.startswith('.') and entry.isfile():\nprint(entry.name)\n\nNote: On Unix-based systems, *note scandir(): 88c. uses the\nsystem's opendir()(3) and readdir()(4) functions.  On Windows,\nit uses the Win32 FindFirstFileW(5) and FindNextFileW(6)\nfunctions.\n\nNew in version 3.5.\n\nChanged in version 3.6: Added support for the *note context\nmanager: 398. protocol and the *note close(): b0b. method.  If a\n*note scandir(): 88c. iterator is neither exhausted nor explicitly\nclosed a *note ResourceWarning: a86. will be emitted in its\ndestructor.\n\nThe function accepts a *note path-like object: 957.\n\nChanged in version 3.7: Added support for *note file descriptors:\n999. on Unix.\n\n-- Class: os.DirEntry\n\nObject yielded by *note scandir(): 88c. to expose the file path and\nother file attributes of a directory entry.\n\n*note scandir(): 88c. will provide as much of this information as\npossible without making additional system calls.  When a 'stat()'\nor 'lstat()' system call is made, the 'os.DirEntry' object will\ncache the result.\n\n'os.DirEntry' instances are not intended to be stored in long-lived\ndata structures; if you know the file metadata has changed or if a\nlong time has elapsed since calling *note scandir(): 88c, call\n'os.stat(entry.path)' to fetch up-to-date information.\n\nBecause the 'os.DirEntry' methods can make operating system calls,\nthey may also raise *note OSError: 613.  If you need very\nfine-grained control over errors, you can catch *note OSError: 613.\nwhen calling one of the 'os.DirEntry' methods and handle as\nappropriate.\n\nTo be directly usable as a *note path-like object: 957,\n'os.DirEntry' implements the *note PathLike: a9a. interface.\n\nAttributes and methods on a 'os.DirEntry' instance are as follows:\n\n-- Attribute: name\n\nThe entry's base filename, relative to the *note scandir():\n88c. 'path' argument.\n\nThe *note name: 27f7. attribute will be 'bytes' if the *note\nscandir(): 88c. 'path' argument is of type 'bytes' and 'str'\notherwise.  Use *note fsdecode(): a9d. to decode byte\nfilenames.\n\n-- Attribute: path\n\nThe entry's full path name: equivalent to\n'os.path.join(scandirpath, entry.name)' where 'scandirpath'\nis the *note scandir(): 88c. 'path' argument.  The path is\nonly absolute if the *note scandir(): 88c. 'path' argument was\nabsolute.  If the *note scandir(): 88c. 'path' argument was a\n*note file descriptor: 999, the *note path: 9d. attribute is\nthe same as the *note name: 27f7. attribute.\n\nThe *note path: 9d. attribute will be 'bytes' if the *note\nscandir(): 88c. 'path' argument is of type 'bytes' and 'str'\notherwise.  Use *note fsdecode(): a9d. to decode byte\nfilenames.\n\n-- Method: inode ()\n\nReturn the inode number of the entry.\n\nThe result is cached on the 'os.DirEntry' object.  Use\n'os.stat(entry.path, followsymlinks=False).stino' to fetch\nup-to-date information.\n\nOn the first, uncached call, a system call is required on\nWindows but not on Unix.\n\n-- Method: isdir (*, followsymlinks=True)\n\nReturn 'True' if this entry is a directory or a symbolic link\npointing to a directory; return 'False' if the entry is or\npoints to any other kind of file, or if it doesn't exist\nanymore.\n\nIf 'followsymlinks' is 'False', return 'True' only if this\nentry is a directory (without following symlinks); return\n'False' if the entry is any other kind of file or if it\ndoesn't exist anymore.\n\nThe result is cached on the 'os.DirEntry' object, with a\nseparate cache for 'followsymlinks' 'True' and 'False'.  Call\n*note os.stat(): 1bf. along with *note stat.SISDIR(): 24dc.\nto fetch up-to-date information.\n\nOn the first, uncached call, no system call is required in\nmost cases.  Specifically, for non-symlinks, neither Windows\nor Unix require a system call, except on certain Unix file\nsystems, such as network file systems, that return\n'dirent.dtype == DTUNKNOWN'.  If the entry is a symlink, a\nsystem call will be required to follow the symlink unless\n'followsymlinks' is 'False'.\n\nThis method can raise *note OSError: 613, such as *note\nPermissionError: b9a, but *note FileNotFoundError: 353. is\ncaught and not raised.\n\n-- Method: isfile (*, followsymlinks=True)\n\nReturn 'True' if this entry is a file or a symbolic link\npointing to a file; return 'False' if the entry is or points\nto a directory or other non-file entry, or if it doesn't exist\nanymore.\n\nIf 'followsymlinks' is 'False', return 'True' only if this\nentry is a file (without following symlinks); return 'False'\nif the entry is a directory or other non-file entry, or if it\ndoesn't exist anymore.\n\nThe result is cached on the 'os.DirEntry' object.  Caching,\nsystem calls made, and exceptions raised are as per *note\nisdir(): 287c.\n\n-- Method: issymlink ()\n\nReturn 'True' if this entry is a symbolic link (even if\nbroken); return 'False' if the entry points to a directory or\nany kind of file, or if it doesn't exist anymore.\n\nThe result is cached on the 'os.DirEntry' object.  Call *note\nos.path.islink(): 835. to fetch up-to-date information.\n\nOn the first, uncached call, no system call is required in\nmost cases.  Specifically, neither Windows or Unix require a\nsystem call, except on certain Unix file systems, such as\nnetwork file systems, that return 'dirent.dtype ==\nDTUNKNOWN'.\n\nThis method can raise *note OSError: 613, such as *note\nPermissionError: b9a, but *note FileNotFoundError: 353. is\ncaught and not raised.\n\n-- Method: isjunction ()\n\nReturn 'True' if this entry is a junction (even if broken);\nreturn 'False' if the entry points to a regular directory, any\nkind of file, a symlink, or if it doesn't exist anymore.\n\nThe result is cached on the 'os.DirEntry' object.  Call *note\nos.path.isjunction(): 1c2. to fetch up-to-date information.\n\nNew in version 3.12.\n\n-- Method: stat (*, followsymlinks=True)\n\nReturn a *note statresult: 1318. object for this entry.  This\nmethod follows symbolic links by default; to stat a symbolic\nlink add the 'followsymlinks=False' argument.\n\nOn Unix, this method always requires a system call.  On\nWindows, it only requires a system call if 'followsymlinks'\nis 'True' and the entry is a reparse point (for example, a\nsymbolic link or directory junction).\n\nOn Windows, the 'stino', 'stdev' and 'stnlink' attributes\nof the *note statresult: 1318. are always set to zero.  Call\n*note os.stat(): 1bf. to get these attributes.\n\nThe result is cached on the 'os.DirEntry' object, with a\nseparate cache for 'followsymlinks' 'True' and 'False'.  Call\n*note os.stat(): 1bf. to fetch up-to-date information.\n\nNote that there is a nice correspondence between several attributes\nand methods of 'os.DirEntry' and of *note pathlib.Path: 149.  In\nparticular, the 'name' attribute has the same meaning, as do the\n'isdir()', 'isfile()', 'issymlink()', 'isjunction()', and\n'stat()' methods.\n\nNew in version 3.5.\n\nChanged in version 3.6: Added support for the *note PathLike: a9a.\ninterface.  Added support for *note bytes: 295. paths on Windows.\n\nChanged in version 3.12: The 'stctime' attribute of a stat result\nis deprecated on Windows.  The file creation time is properly\navailable as 'stbirthtime', and in the future 'stctime' may be\nchanged to return zero or the metadata change time, if available.\n\n-- Function: os.stat (path, *, dirfd=None, followsymlinks=True)\n\nGet the status of a file or a file descriptor.  Perform the\nequivalent of a 'stat()' system call on the given path.  'path' may\nbe specified as either a string or bytes - directly or indirectly\nthrough the *note PathLike: a9a. interface - or as an open file\ndescriptor.  Return a *note statresult: 1318. object.\n\nThis function normally follows symlinks; to stat a symlink add the\nargument 'followsymlinks=False', or use *note lstat(): 1c0.\n\nThis function can support *note specifying a file descriptor: 999.\nand *note not following symlinks: f5a.\n\nOn Windows, passing 'followsymlinks=False' will disable following\nall name-surrogate reparse points, which includes symlinks and\ndirectory junctions.  Other types of reparse points that do not\nresemble links or that the operating system is unable to follow\nwill be opened directly.  When following a chain of multiple links,\nthis may result in the original link being returned instead of the\nnon-link that prevented full traversal.  To obtain stat results for\nthe final path in this case, use the *note os.path.realpath(): 351.\nfunction to resolve the path name as far as possible and call *note\nlstat(): 1c0. on the result.  This does not apply to dangling\nsymlinks or junction points, which will raise the usual exceptions.\n\nExample:\n\n>>> import os\n>>> statinfo = os.stat('somefile.txt')\n>>> statinfo\nos.statresult(stmode=33188, stino=7876932, stdev=234881026,\nstnlink=1, stuid=501, stgid=501, stsize=264, statime=1297230295,\nstmtime=1297230027, stctime=1297230027)\n>>> statinfo.stsize\n264\n\nSee also\n........\n\n*note fstat(): be8. and *note lstat(): 1c0. functions.\n\nChanged in version 3.3: Added the 'dirfd' and 'followsymlinks'\nparameters, specifying a file descriptor instead of a path.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\nChanged in version 3.8: On Windows, all reparse points that can be\nresolved by the operating system are now followed, and passing\n'followsymlinks=False' disables following all name surrogate\nreparse points.  If the operating system reaches a reparse point\nthat it is not able to follow, 'stat' now returns the information\nfor the original path as if 'followsymlinks=False' had been\nspecified instead of raising an error.\n\n-- Class: os.statresult\n\nObject whose attributes correspond roughly to the members of the\n'stat' structure.  It is used for the result of *note os.stat():\n1bf, *note os.fstat(): be8. and *note os.lstat(): 1c0.\n\nAttributes:\n\n-- Attribute: stmode\n\nFile mode: file type and file mode bits (permissions).\n\n-- Attribute: stino\n\nPlatform dependent, but if non-zero, uniquely identifies the\nfile for a given value of 'stdev'.  Typically:\n\n* the inode number on Unix,\n\n* the file index(7) on Windows\n\n-- Attribute: stdev\n\nIdentifier of the device on which this file resides.\n\n-- Attribute: stnlink\n\nNumber of hard links.\n\n-- Attribute: stuid\n\nUser identifier of the file owner.\n\n-- Attribute: stgid\n\nGroup identifier of the file owner.\n\n-- Attribute: stsize\n\nSize of the file in bytes, if it is a regular file or a\nsymbolic link.  The size of a symbolic link is the length of\nthe pathname it contains, without a terminating null byte.\n\nTimestamps:\n\n-- Attribute: statime\n\nTime of most recent access expressed in seconds.\n\n-- Attribute: stmtime\n\nTime of most recent content modification expressed in seconds.\n\n-- Attribute: stctime\n\nTime of most recent metadata change expressed in seconds.\n\nChanged in version 3.12: 'stctime' is deprecated on Windows.\nUse 'stbirthtime' for the file creation time.  In the future,\n'stctime' will contain the time of the most recent metadata\nchange, as for other platforms.\n\n-- Attribute: statimens\n\nTime of most recent access expressed in nanoseconds as an\ninteger.\n\nNew in version 3.3.\n\n-- Attribute: stmtimens\n\nTime of most recent content modification expressed in\nnanoseconds as an integer.\n\nNew in version 3.3.\n\n-- Attribute: stctimens\n\nTime of most recent metadata change expressed in nanoseconds\nas an integer.\n\nNew in version 3.3.\n\nChanged in version 3.12: 'stctimens' is deprecated on\nWindows.  Use 'stbirthtimens' for the file creation time.\nIn the future, 'stctime' will contain the time of the most\nrecent metadata change, as for other platforms.\n\n-- Attribute: stbirthtime\n\nTime of file creation expressed in seconds.  This attribute is\nnot always available, and may raise *note AttributeError: 395.\n\nChanged in version 3.12: 'stbirthtime' is now available on\nWindows.\n\n-- Attribute: stbirthtimens\n\nTime of file creation expressed in nanoseconds as an integer.\nThis attribute is not always available, and may raise *note\nAttributeError: 395.\n\nNew in version 3.12.\n\nNote: The exact meaning and resolution of the *note statime:\n2887, *note stmtime: 265d, *note stctime: 2888. and *note\nstbirthtime: 288c. attributes depend on the operating system\nand the file system.  For example, on Windows systems using\nthe FAT32 file systems, *note stmtime: 265d. has 2-second\nresolution, and *note statime: 2887. has only 1-day\nresolution.  See your operating system documentation for\ndetails.\n\nSimilarly, although *note statimens: 2889, *note\nstmtimens: 288a, *note stctimens: 288b. and *note\nstbirthtimens: 288d. are always expressed in nanoseconds,\nmany systems do not provide nanosecond precision.  On systems\nthat do provide nanosecond precision, the floating-point\nobject used to store *note statime: 2887, *note stmtime:\n265d, *note stctime: 2888. and *note stbirthtime: 288c.\ncannot preserve all of it, and as such will be slightly\ninexact.  If you need the exact timestamps you should always\nuse *note statimens: 2889, *note stmtimens: 288a, *note\nstctimens: 288b. and *note stbirthtimens: 288d.\n\nOn some Unix systems (such as Linux), the following attributes may\nalso be available:\n\n-- Attribute: stblocks\n\nNumber of 512-byte blocks allocated for file.  This may be\nsmaller than *note stsize: 2886./512 when the file has holes.\n\n-- Attribute: stblksize\n\n\"Preferred\" blocksize for efficient file system I/O. Writing\nto a file in smaller chunks may cause an inefficient\nread-modify-rewrite.\n\n-- Attribute: strdev\n\nType of device if an inode device.\n\n-- Attribute: stflags\n\nUser defined flags for file.\n\nOn other Unix systems (such as FreeBSD), the following attributes\nmay be available (but may be only filled out if root tries to use\nthem):\n\n-- Attribute: stgen\n\nFile generation number.\n\nOn Solaris and derivatives, the following attributes may also be\navailable:\n\n-- Attribute: stfstype\n\nString that uniquely identifies the type of the filesystem\nthat contains the file.\n\nOn macOS systems, the following attributes may also be available:\n\n-- Attribute: strsize\n\nReal size of the file.\n\n-- Attribute: stcreator\n\nCreator of the file.\n\n-- Attribute: sttype\n\nFile type.\n\nOn Windows systems, the following attributes are also available:\n\n-- Attribute: stfileattributes\n\nWindows file attributes: 'dwFileAttributes' member of the\n'BYHANDLEFILEINFORMATION' structure returned by\n'GetFileInformationByHandle()'.  See the 'FILEATTRIBUTE*\n<stat.FILEATTRIBUTEARCHIVE>' constants in the *note stat:\ncb. module.\n\nNew in version 3.5.\n\n-- Attribute: streparsetag\n\nWhen *note stfileattributes: c97. has the *note\nFILEATTRIBUTEREPARSEPOINT: 2520. set, this field contains\nthe tag identifying the type of reparse point.  See the *note\nIOREPARSETAG*: 2525. constants in the *note stat: cb.\nmodule.\n\nThe standard module *note stat: cb. defines functions and constants\nthat are useful for extracting information from a 'stat' structure.\n(On Windows, some items are filled with dummy values.)\n\nFor backward compatibility, a *note statresult: 1318. instance is\nalso accessible as a tuple of at least 10 integers giving the most\nimportant (and portable) members of the 'stat' structure, in the\norder *note stmode: 2880, *note stino: 2881, *note stdev: 2882,\n*note stnlink: 2883, *note stuid: 2884, *note stgid: 2885, *note\nstsize: 2886, *note statime: 2887, *note stmtime: 265d, *note\nstctime: 2888.  More items may be added at the end by some\nimplementations.  For compatibility with older Python versions,\naccessing *note statresult: 1318. as a tuple always returns\nintegers.\n\nChanged in version 3.5: Windows now returns the file index as *note\nstino: 2881. when available.\n\nChanged in version 3.7: Added the *note stfstype: 9a3. member to\nSolaris/derivatives.\n\nChanged in version 3.8: Added the *note streparsetag: 2896.\nmember on Windows.\n\nChanged in version 3.8: On Windows, the *note stmode: 2880. member\nnow identifies special files as 'SIFCHR', 'SIFIFO' or 'SIFBLK'\nas appropriate.\n\nChanged in version 3.12: On Windows, *note stctime: 2888. is\ndeprecated.  Eventually, it will contain the last metadata change\ntime, for consistency with other platforms, but for now still\ncontains creation time.  Use *note stbirthtime: 288c. for the\ncreation time.\n\nOn Windows, *note stino: 2881. may now be up to 128 bits,\ndepending on the file system.  Previously it would not be above 64\nbits, and larger file identifiers would be arbitrarily packed.\n\nOn Windows, *note strdev: 2890. no longer returns a value.\nPreviously it would contain the same as *note stdev: 2882, which\nwas incorrect.\n\nAdded the *note stbirthtime: 288c. member on Windows.\n\n-- Function: os.statvfs (path)\n\nPerform a 'statvfs()' system call on the given path.  The return\nvalue is an object whose attributes describe the filesystem on the\ngiven path, and correspond to the members of the 'statvfs'\nstructure, namely: 'fbsize', 'ffrsize', 'fblocks', 'fbfree',\n'fbavail', 'ffiles', 'fffree', 'ffavail', 'fflag',\n'fnamemax', 'ffsid'.\n\nTwo module-level constants are defined for the 'fflag' attribute's\nbit-flags: if 'STRDONLY' is set, the filesystem is mounted\nread-only, and if 'STNOSUID' is set, the semantics of\nsetuid/setgid bits are disabled or not supported.\n\nAdditional module-level constants are defined for GNU/glibc based\nsystems.  These are 'STNODEV' (disallow access to device special\nfiles), 'STNOEXEC' (disallow program execution), 'STSYNCHRONOUS'\n(writes are synced at once), 'STMANDLOCK' (allow mandatory locks\non an FS), 'STWRITE' (write on file/directory/symlink),\n'STAPPEND' (append-only file), 'STIMMUTABLE' (immutable file),\n'STNOATIME' (do not update access times), 'STNODIRATIME' (do not\nupdate directory access times), 'STRELATIME' (update atime\nrelative to mtime/ctime).\n\nThis function can support *note specifying a file descriptor: 999.\n\n*note Availability: 1ad3.: Unix.\n\nChanged in version 3.2: The 'STRDONLY' and 'STNOSUID' constants\nwere added.\n\nChanged in version 3.3: Added support for specifying 'path' as an\nopen file descriptor.\n\nChanged in version 3.4: The 'STNODEV', 'STNOEXEC',\n'STSYNCHRONOUS', 'STMANDLOCK', 'STWRITE', 'STAPPEND',\n'STIMMUTABLE', 'STNOATIME', 'STNODIRATIME', and 'STRELATIME'\nconstants were added.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\nChanged in version 3.7: Added the 'ffsid' attribute.\n\n-- Data: os.supportsdirfd\n\nA *note set: 39d. object indicating which functions in the *note\nos: 9c. module accept an open file descriptor for their 'dirfd'\nparameter.  Different platforms provide different features, and the\nunderlying functionality Python uses to implement the 'dirfd'\nparameter is not available on all platforms Python supports.  For\nconsistency's sake, functions that may support 'dirfd' always\nallow specifying the parameter, but will throw an exception if the\nfunctionality is used when it's not locally available.  (Specifying\n'None' for 'dirfd' is always supported on all platforms.)\n\nTo check whether a particular function accepts an open file\ndescriptor for its 'dirfd' parameter, use the 'in' operator on\n'supportsdirfd'.  As an example, this expression evaluates to\n'True' if *note os.stat(): 1bf. accepts open file descriptors for\n'dirfd' on the local platform:\n\nos.stat in os.supportsdirfd\n\nCurrently 'dirfd' parameters only work on Unix platforms; none of\nthem work on Windows.\n\nNew in version 3.3.\n\n-- Data: os.supportseffectiveids\n\nA *note set: 39d. object indicating whether *note os.access(): f5b.\npermits specifying 'True' for its 'effectiveids' parameter on the\nlocal platform.  (Specifying 'False' for 'effectiveids' is always\nsupported on all platforms.)  If the local platform supports it,\nthe collection will contain *note os.access(): f5b.; otherwise it\nwill be empty.\n\nThis expression evaluates to 'True' if *note os.access(): f5b.\nsupports 'effectiveids=True' on the local platform:\n\nos.access in os.supportseffectiveids\n\nCurrently 'effectiveids' is only supported on Unix platforms; it\ndoes not work on Windows.\n\nNew in version 3.3.\n\n-- Data: os.supportsfd\n\nA *note set: 39d. object indicating which functions in the *note\nos: 9c. module permit specifying their 'path' parameter as an open\nfile descriptor on the local platform.  Different platforms provide\ndifferent features, and the underlying functionality Python uses to\naccept open file descriptors as 'path' arguments is not available\non all platforms Python supports.\n\nTo determine whether a particular function permits specifying an\nopen file descriptor for its 'path' parameter, use the 'in'\noperator on 'supportsfd'.  As an example, this expression\nevaluates to 'True' if *note os.chdir(): 3d8. accepts open file\ndescriptors for 'path' on your local platform:\n\nos.chdir in os.supportsfd\n\nNew in version 3.3.\n\n-- Data: os.supportsfollowsymlinks\n\nA *note set: 39d. object indicating which functions in the *note\nos: 9c. module accept 'False' for their 'followsymlinks' parameter\non the local platform.  Different platforms provide different\nfeatures, and the underlying functionality Python uses to implement\n'followsymlinks' is not available on all platforms Python\nsupports.  For consistency's sake, functions that may support\n'followsymlinks' always allow specifying the parameter, but will\nthrow an exception if the functionality is used when it's not\nlocally available.  (Specifying 'True' for 'followsymlinks' is\nalways supported on all platforms.)\n\nTo check whether a particular function accepts 'False' for its\n'followsymlinks' parameter, use the 'in' operator on\n'supportsfollowsymlinks'.  As an example, this expression\nevaluates to 'True' if you may specify 'followsymlinks=False' when\ncalling *note os.stat(): 1bf. on the local platform:\n\nos.stat in os.supportsfollowsymlinks\n\nNew in version 3.3.\n\n-- Function: os.symlink (src, dst, targetisdirectory=False, *,\ndirfd=None)\n\nCreate a symbolic link pointing to 'src' named 'dst'.\n\nOn Windows, a symlink represents either a file or a directory, and\ndoes not morph to the target dynamically.  If the target is\npresent, the type of the symlink will be created to match.\nOtherwise, the symlink will be created as a directory if\n'targetisdirectory' is 'True' or a file symlink (the default)\notherwise.  On non-Windows platforms, 'targetisdirectory' is\nignored.\n\nThis function can support *note paths relative to directory\ndescriptors: f59.\n\nNote: On newer versions of Windows 10, unprivileged accounts\ncan create symlinks if Developer Mode is enabled.  When\nDeveloper Mode is not available/enabled, the\n'SeCreateSymbolicLinkPrivilege' privilege is required, or the\nprocess must be run as an administrator.\n\n*note OSError: 613. is raised when the function is called by\nan unprivileged user.\n\nRaises an *note auditing event: 161d. 'os.symlink' with arguments\n'src', 'dst', 'dirfd'.\n\n*note Availability: 1ad3.: Unix, Windows.\n\nThe function is limited on Emscripten and WASI, see *note\nWebAssembly platforms: 153e. for more information.\n\nChanged in version 3.2: Added support for Windows 6.0 (Vista)\nsymbolic links.\n\nChanged in version 3.3: Added the 'dirfd' parameter, and now allow\n'targetisdirectory' on non-Windows platforms.\n\nChanged in version 3.6: Accepts a *note path-like object: 957. for\n'src' and 'dst'.\n\nChanged in version 3.8: Added support for unelevated symlinks on\nWindows with Developer Mode.\n\n-- Function: os.sync ()\n\nForce write of everything to disk.\n\n*note Availability: 1ad3.: Unix.\n\nNew in version 3.3.\n\n-- Function: os.truncate (path, length)\n\nTruncate the file corresponding to 'path', so that it is at most\n'length' bytes in size.\n\nThis function can support *note specifying a file descriptor: 999.\n\nRaises an *note auditing event: 161d. 'os.truncate' with arguments\n'path', 'length'.\n\n*note Availability: 1ad3.: Unix, Windows.\n\nNew in version 3.3.\n\nChanged in version 3.5: Added support for Windows\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.unlink (path, *, dirfd=None)\n\nRemove (delete) the file 'path'.  This function is semantically\nidentical to *note remove(): f61.; the 'unlink' name is its\ntraditional Unix name.  Please see the documentation for *note\nremove(): f61. for further information.\n\nRaises an *note auditing event: 161d. 'os.remove' with arguments\n'path', 'dirfd'.\n\nChanged in version 3.3: Added the 'dirfd' parameter.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.utime (path, times=None, *[, ns], dirfd=None,\nfollowsymlinks=True)\n\nSet the access and modified times of the file specified by 'path'.\n\n*note utime(): f67. takes two optional parameters, 'times' and\n'ns'.  These specify the times set on 'path' and are used as\nfollows:\n\n- If 'ns' is specified, it must be a 2-tuple of the form\n'(atimens, mtimens)' where each member is an int expressing\nnanoseconds.\n\n- If 'times' is not 'None', it must be a 2-tuple of the form\n'(atime, mtime)' where each member is an int or float\nexpressing seconds.\n\n- If 'times' is 'None' and 'ns' is unspecified, this is\nequivalent to specifying 'ns=(atimens, mtimens)' where both\ntimes are the current time.\n\nIt is an error to specify tuples for both 'times' and 'ns'.\n\nNote that the exact times you set here may not be returned by a\nsubsequent *note stat(): 1bf. call, depending on the resolution\nwith which your operating system records access and modification\ntimes; see *note stat(): 1bf.  The best way to preserve exact times\nis to use the 'statimens' and 'stmtimens' fields from the *note\nos.stat(): 1bf. result object with the 'ns' parameter to *note\nutime(): f67.\n\nThis function can support *note specifying a file descriptor: 999,\n*note paths relative to directory descriptors: f59. and *note not\nfollowing symlinks: f5a.\n\nRaises an *note auditing event: 161d. 'os.utime' with arguments\n'path', 'times', 'ns', 'dirfd'.\n\nChanged in version 3.3: Added support for specifying 'path' as an\nopen file descriptor, and the 'dirfd', 'followsymlinks', and 'ns'\nparameters.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.walk (top, topdown=True, onerror=None,\nfollowlinks=False)\n\nGenerate the file names in a directory tree by walking the tree\neither top-down or bottom-up.  For each directory in the tree\nrooted at directory 'top' (including 'top' itself), it yields a\n3-tuple '(dirpath, dirnames, filenames)'.\n\n'dirpath' is a string, the path to the directory.  'dirnames' is a\nlist of the names of the subdirectories in 'dirpath' (including\nsymlinks to directories, and excluding ''.'' and ''..'').\n'filenames' is a list of the names of the non-directory files in\n'dirpath'.  Note that the names in the lists contain no path\ncomponents.  To get a full path (which begins with 'top') to a file\nor directory in 'dirpath', do 'os.path.join(dirpath, name)'.\nWhether or not the lists are sorted depends on the file system.  If\na file is removed from or added to the 'dirpath' directory during\ngenerating the lists, whether a name for that file be included is\nunspecified.\n\nIf optional argument 'topdown' is 'True' or not specified, the\ntriple for a directory is generated before the triples for any of\nits subdirectories (directories are generated top-down).  If\n'topdown' is 'False', the triple for a directory is generated after\nthe triples for all of its subdirectories (directories are\ngenerated bottom-up).  No matter the value of 'topdown', the list\nof subdirectories is retrieved before the tuples for the directory\nand its subdirectories are generated.\n\nWhen 'topdown' is 'True', the caller can modify the 'dirnames' list\nin-place (perhaps using *note del: 14fb. or slice assignment), and\n*note walk(): 1c8. will only recurse into the subdirectories whose\nnames remain in 'dirnames'; this can be used to prune the search,\nimpose a specific order of visiting, or even to inform *note\nwalk(): 1c8. about directories the caller creates or renames before\nit resumes *note walk(): 1c8. again.  Modifying 'dirnames' when\n'topdown' is 'False' has no effect on the behavior of the walk,\nbecause in bottom-up mode the directories in 'dirnames' are\ngenerated before 'dirpath' itself is generated.\n\nBy default, errors from the *note scandir(): 88c. call are ignored.\nIf optional argument 'onerror' is specified, it should be a\nfunction; it will be called with one argument, an *note OSError:\n613. instance.  It can report the error to continue with the walk,\nor raise the exception to abort the walk.  Note that the filename\nis available as the 'filename' attribute of the exception object.\n\nBy default, *note walk(): 1c8. will not walk down into symbolic\nlinks that resolve to directories.  Set 'followlinks' to 'True' to\nvisit directories pointed to by symlinks, on systems that support\nthem.\n\nNote: Be aware that setting 'followlinks' to 'True' can lead\nto infinite recursion if a link points to a parent directory\nof itself.  *note walk(): 1c8. does not keep track of the\ndirectories it visited already.\n\nNote: If you pass a relative pathname, don't change the\ncurrent working directory between resumptions of *note walk():\n1c8.  *note walk(): 1c8. never changes the current directory,\nand assumes that its caller doesn't either.\n\nThis example displays the number of bytes taken by non-directory\nfiles in each directory under the starting directory, except that\nit doesn't look under any CVS subdirectory:\n\nimport os\nfrom os.path import join, getsize\nfor root, dirs, files in os.walk('python/Lib/email'):\nprint(root, \"consumes\", end=\" \")\nprint(sum(getsize(join(root, name)) for name in files), end=\" \")\nprint(\"bytes in\", len(files), \"non-directory files\")\nif 'CVS' in dirs:\ndirs.remove('CVS')  # don't visit CVS directories\n\nIn the next example (simple implementation of *note\nshutil.rmtree(): 1d5.), walking the tree bottom-up is essential,\n*note rmdir(): f64. doesn't allow deleting a directory before the\ndirectory is empty:\n\n# Delete everything reachable from the directory named in \"top\",\n# assuming there are no symbolic links.\n# CAUTION:  This is dangerous!  For example, if top == '/', it\n# could delete all your disk files.\nimport os\nfor root, dirs, files in os.walk(top, topdown=False):\nfor name in files:\nos.remove(os.path.join(root, name))\nfor name in dirs:\nos.rmdir(os.path.join(root, name))\n\nRaises an *note auditing event: 161d. 'os.walk' with arguments\n'top', 'topdown', 'onerror', 'followlinks'.\n\nChanged in version 3.5: This function now calls *note os.scandir():\n88c. instead of *note os.listdir(): f6a, making it faster by\nreducing the number of calls to *note os.stat(): 1bf.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.fwalk (top='.', topdown=True, onerror=None, *,\nfollowsymlinks=False, dirfd=None)\n\nThis behaves exactly like *note walk(): 1c8, except that it yields\na 4-tuple '(dirpath, dirnames, filenames, dirfd)', and it supports\n'dirfd'.\n\n'dirpath', 'dirnames' and 'filenames' are identical to *note\nwalk(): 1c8. output, and 'dirfd' is a file descriptor referring to\nthe directory 'dirpath'.\n\nThis function always supports *note paths relative to directory\ndescriptors: f59. and *note not following symlinks: f5a.  Note\nhowever that, unlike other functions, the *note fwalk(): 998.\ndefault value for 'followsymlinks' is 'False'.\n\nNote: Since *note fwalk(): 998. yields file descriptors, those\nare only valid until the next iteration step, so you should\nduplicate them (e.g.  with *note dup(): 1750.) if you want to\nkeep them longer.\n\nThis example displays the number of bytes taken by non-directory\nfiles in each directory under the starting directory, except that\nit doesn't look under any CVS subdirectory:\n\nimport os\nfor root, dirs, files, rootfd in os.fwalk('python/Lib/email'):\nprint(root, \"consumes\", end=\"\")\nprint(sum([os.stat(name, dirfd=rootfd).stsize for name in files]),\nend=\"\")\nprint(\"bytes in\", len(files), \"non-directory files\")\nif 'CVS' in dirs:\ndirs.remove('CVS')  # don't visit CVS directories\n\nIn the next example, walking the tree bottom-up is essential: *note\nrmdir(): f64. doesn't allow deleting a directory before the\ndirectory is empty:\n\n# Delete everything reachable from the directory named in \"top\",\n# assuming there are no symbolic links.\n# CAUTION:  This is dangerous!  For example, if top == '/', it\n# could delete all your disk files.\nimport os\nfor root, dirs, files, rootfd in os.fwalk(top, topdown=False):\nfor name in files:\nos.unlink(name, dirfd=rootfd)\nfor name in dirs:\nos.rmdir(name, dirfd=rootfd)\n\nRaises an *note auditing event: 161d. 'os.fwalk' with arguments\n'top', 'topdown', 'onerror', 'followsymlinks', 'dirfd'.\n\n*note Availability: 1ad3.: Unix.\n\nNew in version 3.3.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\nChanged in version 3.7: Added support for *note bytes: 295. paths.\n\n-- Function: os.memfdcreate (name[, flags=os.MFDCLOEXEC])\n\nCreate an anonymous file and return a file descriptor that refers\nto it.  'flags' must be one of the 'os.MFD*' constants available\non the system (or a bitwise ORed combination of them).  By default,\nthe new file descriptor is *note non-inheritable: d60.\n\nThe name supplied in 'name' is used as a filename and will be\ndisplayed as the target of the corresponding symbolic link in the\ndirectory '/proc/self/fd/'.  The displayed name is always prefixed\nwith 'memfd:' and serves only for debugging purposes.  Names do not\naffect the behavior of the file descriptor, and as such multiple\nfiles can have the same name without any side effects.\n\n*note Availability: 1ad3.: Linux >= 3.17 with glibc >= 2.27.\n\nNew in version 3.8.\n\n-- Data: os.MFDCLOEXEC\n-- Data: os.MFDALLOWSEALING\n-- Data: os.MFDHUGETLB\n-- Data: os.MFDHUGESHIFT\n-- Data: os.MFDHUGEMASK\n-- Data: os.MFDHUGE64KB\n-- Data: os.MFDHUGE512KB\n-- Data: os.MFDHUGE1MB\n-- Data: os.MFDHUGE2MB\n-- Data: os.MFDHUGE8MB\n-- Data: os.MFDHUGE16MB\n-- Data: os.MFDHUGE32MB\n-- Data: os.MFDHUGE256MB\n-- Data: os.MFDHUGE512MB\n-- Data: os.MFDHUGE1GB\n-- Data: os.MFDHUGE2GB\n-- Data: os.MFDHUGE16GB\n\nThese flags can be passed to *note memfdcreate(): 834.\n\n*note Availability: 1ad3.: Linux >= 3.17 with glibc >= 2.27\n\nThe 'MFDHUGE*' flags are only available since Linux 4.14.\n\nNew in version 3.8.\n\n-- Function: os.eventfd (initval[, flags=os.EFDCLOEXEC])\n\nCreate and return an event file descriptor.  The file descriptors\nsupports raw *note read(): bf1. and *note write(): bf7. with a\nbuffer size of 8, *note select(): bfc, *note poll(): 28a8. and\nsimilar.  See man page 'eventfd(2)' for more information.  By\ndefault, the new file descriptor is *note non-inheritable: d60.\n\n'initval' is the initial value of the event counter.  The initial\nvalue must be an 32 bit unsigned integer.  Please note that the\ninitial value is limited to a 32 bit unsigned int although the\nevent counter is an unsigned 64 bit integer with a maximum value of\n2^64-2.\n\n'flags' can be constructed from *note EFDCLOEXEC: 1529, *note\nEFDNONBLOCK: 152a, and *note EFDSEMAPHORE: 152b.\n\nIf *note EFDSEMAPHORE: 152b. is specified and the event counter is\nnon-zero, *note eventfdread(): 28a9. returns 1 and decrements the\ncounter by one.\n\nIf *note EFDSEMAPHORE: 152b. is not specified and the event\ncounter is non-zero, *note eventfdread(): 28a9. returns the\ncurrent event counter value and resets the counter to zero.\n\nIf the event counter is zero and *note EFDNONBLOCK: 152a. is not\nspecified, *note eventfdread(): 28a9. blocks.\n\n*note eventfdwrite(): 28aa. increments the event counter.  Write\nblocks if the write operation would increment the counter to a\nvalue larger than 2^64-2.\n\nExample:\n\nimport os\n\n# semaphore with start value '1'\nfd = os.eventfd(1, os.EFDSEMAPHORE | os.EFCCLOEXEC)\ntry:\n# acquire semaphore\nv = os.eventfdread(fd)\ntry:\ndowork()\nfinally:\n# release semaphore\nos.eventfdwrite(fd, v)\nfinally:\nos.close(fd)\n\n*note Availability: 1ad3.: Linux >= 2.6.27 with glibc >= 2.8\n\nNew in version 3.10.\n\n-- Function: os.eventfdread (fd)\n\nRead value from an *note eventfd(): 60c. file descriptor and return\na 64 bit unsigned int.  The function does not verify that 'fd' is\nan *note eventfd(): 60c.\n\n*note Availability: 1ad3.: Linux >= 2.6.27\n\nNew in version 3.10.\n\n-- Function: os.eventfdwrite (fd, value)\n\nAdd value to an *note eventfd(): 60c. file descriptor.  'value'\nmust be a 64 bit unsigned int.  The function does not verify that\n'fd' is an *note eventfd(): 60c.\n\n*note Availability: 1ad3.: Linux >= 2.6.27\n\nNew in version 3.10.\n\n-- Data: os.EFDCLOEXEC\n\nSet close-on-exec flag for new *note eventfd(): 60c. file\ndescriptor.\n\n*note Availability: 1ad3.: Linux >= 2.6.27\n\nNew in version 3.10.\n\n-- Data: os.EFDNONBLOCK\n\nSet *note ONONBLOCK: c9a. status flag for new *note eventfd():\n60c. file descriptor.\n\n*note Availability: 1ad3.: Linux >= 2.6.27\n\nNew in version 3.10.\n\n-- Data: os.EFDSEMAPHORE\n\nProvide semaphore-like semantics for reads from a *note eventfd():\n60c. file descriptor.  On read the internal counter is decremented\nby one.\n\n*note Availability: 1ad3.: Linux >= 2.6.30\n\nNew in version 3.10.\n\n* Menu:\n\n* Linux extended attributes::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0529/\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=21082\n\n(3)\nhttps://pubs.opengroup.org/onlinepubs/009695399/functions/opendir.html\n\n(4)\nhttps://pubs.opengroup.org/onlinepubs/009695399/functions/readdirr.html\n\n(5)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa364418(v=vs.85).aspx\n\n(6)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa364428(v=vs.85).aspx\n\n(7) https://msdn.microsoft.com/en-us/library/aa363788\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Linux extended attributes,  Up: Files and Directories": {
            "content": "5.16.1.9 Linux extended attributes\n..................................\n\nNew in version 3.3.\n\nThese functions are all available on Linux only.\n\n-- Function: os.getxattr (path, attribute, *, followsymlinks=True)\n\nReturn the value of the extended filesystem attribute 'attribute'\nfor 'path'.  'attribute' can be bytes or str (directly or\nindirectly through the *note PathLike: a9a. interface).  If it is\nstr, it is encoded with the filesystem encoding.\n\nThis function can support *note specifying a file descriptor: 999.\nand *note not following symlinks: f5a.\n\nRaises an *note auditing event: 161d. 'os.getxattr' with arguments\n'path', 'attribute'.\n\nChanged in version 3.6: Accepts a *note path-like object: 957. for\n'path' and 'attribute'.\n\n-- Function: os.listxattr (path=None, *, followsymlinks=True)\n\nReturn a list of the extended filesystem attributes on 'path'.  The\nattributes in the list are represented as strings decoded with the\nfilesystem encoding.  If 'path' is 'None', *note listxattr(): f75.\nwill examine the current directory.\n\nThis function can support *note specifying a file descriptor: 999.\nand *note not following symlinks: f5a.\n\nRaises an *note auditing event: 161d. 'os.listxattr' with argument\n'path'.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.removexattr (path, attribute, *, followsymlinks=True)\n\nRemoves the extended filesystem attribute 'attribute' from 'path'.\n'attribute' should be bytes or str (directly or indirectly through\nthe *note PathLike: a9a. interface).  If it is a string, it is\nencoded with the *note filesystem encoding and error handler: 291.\n\nThis function can support *note specifying a file descriptor: 999.\nand *note not following symlinks: f5a.\n\nRaises an *note auditing event: 161d. 'os.removexattr' with\narguments 'path', 'attribute'.\n\nChanged in version 3.6: Accepts a *note path-like object: 957. for\n'path' and 'attribute'.\n\n-- Function: os.setxattr (path, attribute, value, flags=0, *,\nfollowsymlinks=True)\n\nSet the extended filesystem attribute 'attribute' on 'path' to\n'value'.  'attribute' must be a bytes or str with no embedded NULs\n(directly or indirectly through the *note PathLike: a9a.\ninterface).  If it is a str, it is encoded with the *note\nfilesystem encoding and error handler: 291.  'flags' may be *note\nXATTRREPLACE: 28ac. or *note XATTRCREATE: 28ad.  If *note\nXATTRREPLACE: 28ac. is given and the attribute does not exist,\n'ENODATA' will be raised.  If *note XATTRCREATE: 28ad. is given\nand the attribute already exists, the attribute will not be created\nand 'EEXISTS' will be raised.\n\nThis function can support *note specifying a file descriptor: 999.\nand *note not following symlinks: f5a.\n\nNote: A bug in Linux kernel versions less than 2.6.39 caused\nthe flags argument to be ignored on some filesystems.\n\nRaises an *note auditing event: 161d. 'os.setxattr' with arguments\n'path', 'attribute', 'value', 'flags'.\n\nChanged in version 3.6: Accepts a *note path-like object: 957. for\n'path' and 'attribute'.\n\n-- Data: os.XATTRSIZEMAX\n\nThe maximum size the value of an extended attribute can be.\nCurrently, this is 64 KiB on Linux.\n\n-- Data: os.XATTRCREATE\n\nThis is a possible value for the flags argument in *note\nsetxattr(): f77.  It indicates the operation must create an\nattribute.\n\n-- Data: os.XATTRREPLACE\n\nThis is a possible value for the flags argument in *note\nsetxattr(): f77.  It indicates the operation must replace an\nexisting attribute.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Process Management,  Next: Interface to the scheduler,  Prev: Files and Directories,  Up: os -- Miscellaneous operating system interfaces": {
            "content": "5.16.1.10 Process Management\n............................\n\nThese functions may be used to create and manage processes.\n\nThe various *note exec*: 28b1. functions take a list of arguments for\nthe new program loaded into the process.  In each case, the first of\nthese arguments is passed to the new program as its own name rather than\nas an argument a user may have typed on a command line.  For the C\nprogrammer, this is the 'argv[0]' passed to a program's 'main()'.  For\nexample, 'os.execv('/bin/echo', ['foo', 'bar'])' will only print 'bar'\non standard output; 'foo' will seem to be ignored.\n\n-- Function: os.abort ()\n\nGenerate a 'SIGABRT' signal to the current process.  On Unix, the\ndefault behavior is to produce a core dump; on Windows, the process\nimmediately returns an exit code of '3'.  Be aware that calling\nthis function will not call the Python signal handler registered\nfor 'SIGABRT' with *note signal.signal(): fa6.\n\n-- Function: os.adddlldirectory (path)\n\nAdd a path to the DLL search path.\n\nThis search path is used when resolving dependencies for imported\nextension modules (the module itself is resolved through *note\nsys.path: 32c.), and also by *note ctypes: 28.\n\nRemove the directory by calling 'close()' on the returned object or\nusing it in a *note with: 396. statement.\n\nSee the Microsoft documentation(1) for more information about how\nDLLs are loaded.\n\nRaises an *note auditing event: 161d. 'os.adddlldirectory' with\nargument 'path'.\n\n*note Availability: 1ad3.: Windows.\n\nNew in version 3.8: Previous versions of CPython would resolve DLLs\nusing the default behavior for the current process.  This led to\ninconsistencies, such as only sometimes searching 'PATH' or the\ncurrent working directory, and OS functions such as\n'AddDllDirectory' having no effect.\n\nIn 3.8, the two primary ways DLLs are loaded now explicitly\noverride the process-wide behavior to ensure consistency.  See the\n*note porting notes: 8d2. for information on updating libraries.\n\n-- Function: os.execl (path, arg0, arg1, ...)\n-- Function: os.execle (path, arg0, arg1, ..., env)\n-- Function: os.execlp (file, arg0, arg1, ...)\n-- Function: os.execlpe (file, arg0, arg1, ..., env)\n-- Function: os.execv (path, args)\n-- Function: os.execve (path, args, env)\n-- Function: os.execvp (file, args)\n-- Function: os.execvpe (file, args, env)\n\nThese functions all execute a new program, replacing the current\nprocess; they do not return.  On Unix, the new executable is loaded\ninto the current process, and will have the same process id as the\ncaller.  Errors will be reported as *note OSError: 613. exceptions.\n\nThe current process is replaced immediately.  Open file objects and\ndescriptors are not flushed, so if there may be data buffered on\nthese open files, you should flush them using 'sys.stdout.flush()'\nor *note os.fsync(): bea. before calling an *note exec*: 28b1.\nfunction.\n\nThe \"l\" and \"v\" variants of the *note exec*: 28b1. functions differ\nin how command-line arguments are passed.  The \"l\" variants are\nperhaps the easiest to work with if the number of parameters is\nfixed when the code is written; the individual parameters simply\nbecome additional parameters to the 'execl*()' functions.  The \"v\"\nvariants are good when the number of parameters is variable, with\nthe arguments being passed in a list or tuple as the 'args'\nparameter.  In either case, the arguments to the child process\nshould start with the name of the command being run, but this is\nnot enforced.\n\nThe variants which include a \"p\" near the end (*note execlp():\n28b4, *note execlpe(): 28b5, *note execvp(): 28b6, and *note\nexecvpe(): 28b7.) will use the 'PATH' environment variable to\nlocate the program 'file'.  When the environment is being replaced\n(using one of the *note exec*e: 28b1. variants, discussed in the\nnext paragraph), the new environment is used as the source of the\n'PATH' variable.  The other variants, *note execl(): 28b1, *note\nexecle(): 28b3, *note execv(): 2812, and *note execve(): f69, will\nnot use the 'PATH' variable to locate the executable; 'path' must\ncontain an appropriate absolute or relative path.  Relative paths\nmust include at least one slash, even on Windows, as plain names\nwill not be resolved.\n\nFor *note execle(): 28b3, *note execlpe(): 28b5, *note execve():\nf69, and *note execvpe(): 28b7. (note that these all end in \"e\"),\nthe 'env' parameter must be a mapping which is used to define the\nenvironment variables for the new process (these are used instead\nof the current process' environment); the functions *note execl():\n28b1, *note execlp(): 28b4, *note execv(): 2812, and *note\nexecvp(): 28b6. all cause the new process to inherit the\nenvironment of the current process.\n\nFor *note execve(): f69. on some platforms, 'path' may also be\nspecified as an open file descriptor.  This functionality may not\nbe supported on your platform; you can check whether or not it is\navailable using *note os.supportsfd: f6d.  If it is unavailable,\nusing it will raise a *note NotImplementedError: ba5.\n\nRaises an *note auditing event: 161d. 'os.exec' with arguments\n'path', 'args', 'env'.\n\n*note Availability: 1ad3.: Unix, Windows, not Emscripten, not WASI.\n\nChanged in version 3.3: Added support for specifying 'path' as an\nopen file descriptor for *note execve(): f69.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: os.exit (n)\n\nExit the process with status 'n', without calling cleanup handlers,\nflushing stdio buffers, etc.\n\nNote: The standard way to exit is *note sys.exit(n): 11c2.\n'exit()' should normally only be used in the child process\nafter a *note fork(): 231.\n\nThe following exit codes are defined and can be used with *note exit():\n1fa5, although they are not required.  These are typically used for\nsystem programs written in Python, such as a mail server's external\ncommand delivery program.\n\nNote: Some of these may not be available on all Unix platforms,\nsince there is some variation.  These constants are defined where\nthey are defined by the underlying platform.\n\n-- Data: os.EXOK\n\nExit code that means no error occurred.  May be taken from the\ndefined value of 'EXITSUCCESS' on some platforms.  Generally has a\nvalue of zero.\n\n*note Availability: 1ad3.: Unix, Windows.\n\n-- Data: os.EXUSAGE\n\nExit code that means the command was used incorrectly, such as when\nthe wrong number of arguments are given.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Data: os.EXDATAERR\n\nExit code that means the input data was incorrect.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Data: os.EXNOINPUT\n\nExit code that means an input file did not exist or was not\nreadable.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Data: os.EXNOUSER\n\nExit code that means a specified user did not exist.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Data: os.EXNOHOST\n\nExit code that means a specified host did not exist.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Data: os.EXUNAVAILABLE\n\nExit code that means that a required service is unavailable.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Data: os.EXSOFTWARE\n\nExit code that means an internal software error was detected.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Data: os.EXOSERR\n\nExit code that means an operating system error was detected, such\nas the inability to fork or create a pipe.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Data: os.EXOSFILE\n\nExit code that means some system file did not exist, could not be\nopened, or had some other kind of error.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Data: os.EXCANTCREAT\n\nExit code that means a user specified output file could not be\ncreated.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Data: os.EXIOERR\n\nExit code that means that an error occurred while doing I/O on some\nfile.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Data: os.EXTEMPFAIL\n\nExit code that means a temporary failure occurred.  This indicates\nsomething that may not really be an error, such as a network\nconnection that couldn't be made during a retryable operation.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Data: os.EXPROTOCOL\n\nExit code that means that a protocol exchange was illegal, invalid,\nor not understood.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Data: os.EXNOPERM\n\nExit code that means that there were insufficient permissions to\nperform the operation (but not intended for file system problems).\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Data: os.EXCONFIG\n\nExit code that means that some kind of configuration error\noccurred.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Data: os.EXNOTFOUND\n\nExit code that means something like \"an entry was not found\".\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Function: os.fork ()\n\nFork a child process.  Return '0' in the child and the child's\nprocess id in the parent.  If an error occurs *note OSError: 613.\nis raised.\n\nNote that some platforms including FreeBSD <= 6.3 and Cygwin have\nknown issues when using 'fork()' from a thread.\n\nRaises an *note auditing event: 161d. 'os.fork' with no arguments.\n\nWarning: If you use TLS sockets in an application calling\n'fork()', see the warning in the *note ssl: ca. documentation.\n\nWarning: On macOS the use of this function is unsafe when\nmixed with using higher-level system APIs, and that includes\nusing *note urllib.request: 106.\n\nChanged in version 3.8: Calling 'fork()' in a subinterpreter is no\nlonger supported (*note RuntimeError: 17a. is raised).\n\nChanged in version 3.12: If Python is able to detect that your\nprocess has multiple threads, *note os.fork(): 231. now raises a\n*note DeprecationWarning: 179.\n\nWe chose to surface this as a warning, when detectable, to better\ninform developers of a design problem that the POSIX platform\nspecifically notes as not supported.  Even in code that 'appears'\nto work, it has never been safe to mix threading with *note\nos.fork(): 231. on POSIX platforms.  The CPython runtime itself has\nalways made API calls that are not safe for use in the child\nprocess when threads existed in the parent (such as 'malloc' and\n'free').\n\nUsers of macOS or users of libc or malloc implementations other\nthan those typically found in glibc to date are among those already\nmore likely to experience deadlocks running such code.\n\nSee this discussion on fork being incompatible with threads(2) for\ntechnical details of why we're surfacing this longstanding platform\ncompatibility problem to developers.\n\n*note Availability: 1ad3.: POSIX, not Emscripten, not WASI.\n\n-- Function: os.forkpty ()\n\nFork a child process, using a new pseudo-terminal as the child's\ncontrolling terminal.  Return a pair of '(pid, fd)', where 'pid' is\n'0' in the child, the new child's process id in the parent, and\n'fd' is the file descriptor of the master end of the\npseudo-terminal.  For a more portable approach, use the *note pty:\nac. module.  If an error occurs *note OSError: 613. is raised.\n\nRaises an *note auditing event: 161d. 'os.forkpty' with no\narguments.\n\nWarning: On macOS the use of this function is unsafe when\nmixed with using higher-level system APIs, and that includes\nusing *note urllib.request: 106.\n\nChanged in version 3.8: Calling 'forkpty()' in a subinterpreter is\nno longer supported (*note RuntimeError: 17a. is raised).\n\nChanged in version 3.12: If Python is able to detect that your\nprocess has multiple threads, this now raises a *note\nDeprecationWarning: 179.  See the longer explanation on *note\nos.fork(): 231.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Function: os.kill (pid, sig, /)\n\nSend signal 'sig' to the process 'pid'.  Constants for the specific\nsignals available on the host platform are defined in the *note\nsignal: c1. module.\n\nWindows: The *note signal.CTRLCEVENT: 11dc. and *note\nsignal.CTRLBREAKEVENT: 11dd. signals are special signals which\ncan only be sent to console processes which share a common console\nwindow, e.g., some subprocesses.  Any other value for 'sig' will\ncause the process to be unconditionally killed by the\nTerminateProcess API, and the exit code will be set to 'sig'.  The\nWindows version of *note kill(): 11db. additionally takes process\nhandles to be killed.\n\nSee also *note signal.pthreadkill(): fa3.\n\nRaises an *note auditing event: 161d. 'os.kill' with arguments\n'pid', 'sig'.\n\n*note Availability: 1ad3.: Unix, Windows, not Emscripten, not WASI.\n\nChanged in version 3.2: Added Windows support.\n\n-- Function: os.killpg (pgid, sig, /)\n\nSend the signal 'sig' to the process group 'pgid'.\n\nRaises an *note auditing event: 161d. 'os.killpg' with arguments\n'pgid', 'sig'.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Function: os.nice (increment, /)\n\nAdd 'increment' to the process's \"niceness\".  Return the new\nniceness.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Function: os.pidfdopen (pid, flags=0)\n\nReturn a file descriptor referring to the process 'pid' with\n'flags' set.  This descriptor can be used to perform process\nmanagement without races and signals.\n\nSee the 'pidfdopen(2)' man page for more details.\n\n*note Availability: 1ad3.: Linux >= 5.3\n\nNew in version 3.9.\n\n-- Data: os.PIDFDNONBLOCK\n\nThis flag indicates that the file descriptor will be\nnon-blocking.  If the process referred to by the file\ndescriptor has not yet terminated, then an attempt to wait on\nthe file descriptor using 'waitid(2)' will immediately return\nthe error *note EAGAIN: 1fad. rather than blocking.\n\n*note Availability: 1ad3.: Linux >= 5.10\n\nNew in version 3.12.\n\n-- Function: os.plock (op, /)\n\nLock program segments into memory.  The value of 'op' (defined in\n'<sys/lock.h>') determines which segments are locked.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Function: os.popen (cmd, mode='r', buffering=-1)\n\nOpen a pipe to or from command 'cmd'.  The return value is an open\nfile object connected to the pipe, which can be read or written\ndepending on whether 'mode' is ''r'' (default) or ''w''.  The\n'buffering' argument have the same meaning as the corresponding\nargument to the built-in *note open(): 26e. function.  The returned\nfile object reads or writes text strings rather than bytes.\n\nThe 'close' method returns *note None: 43f. if the subprocess\nexited successfully, or the subprocess's return code if there was\nan error.  On POSIX systems, if the return code is positive it\nrepresents the return value of the process left-shifted by one\nbyte.  If the return code is negative, the process was terminated\nby the signal given by the negated value of the return code.  (For\nexample, the return value might be '- signal.SIGKILL' if the\nsubprocess was killed.)  On Windows systems, the return value\ncontains the signed integer return code from the child process.\n\nOn Unix, *note waitstatustoexitcode(): 73b. can be used to\nconvert the 'close' method result (exit status) into an exit code\nif it is not 'None'.  On Windows, the 'close' method result is\ndirectly the exit code (or 'None').\n\nThis is implemented using *note subprocess.Popen: 8c3.; see that\nclass's documentation for more powerful ways to manage and\ncommunicate with subprocesses.\n\n*note Availability: 1ad3.: not Emscripten, not WASI.\n\nNote: The *note Python UTF-8 Mode: 420. affects encodings used\nfor 'cmd' and pipe contents.\n\n*note popen(): 8b5. is a simple wrapper around *note\nsubprocess.Popen: 8c3.  Use *note subprocess.Popen: 8c3. or\n*note subprocess.run(): 9c9. to control options like\nencodings.\n\n-- Function: os.posixspawn (path, argv, env, *, fileactions=None,\nsetpgroup=None, resetids=False, setsid=False, setsigmask=(),\nsetsigdef=(), scheduler=None)\n\nWraps the 'posixspawn()' C library API for use from Python.\n\nMost users should use *note subprocess.run(): 9c9. instead of *note\nposixspawn(): 885.\n\nThe positional-only arguments 'path', 'args', and 'env' are similar\nto *note execve(): f69.\n\nThe 'path' parameter is the path to the executable file.  The\n'path' should contain a directory.  Use *note posixspawnp(): 17a8.\nto pass an executable file without directory.\n\nThe 'fileactions' argument may be a sequence of tuples describing\nactions to take on specific file descriptors in the child process\nbetween the C library implementation's 'fork()' and 'exec()' steps.\nThe first item in each tuple must be one of the three type\nindicator listed below describing the remaining tuple elements:\n\n-- Data: os.POSIXSPAWNOPEN\n\n('os.POSIXSPAWNOPEN', 'fd', 'path', 'flags', 'mode')\n\nPerforms 'os.dup2(os.open(path, flags, mode), fd)'.\n\n-- Data: os.POSIXSPAWNCLOSE\n\n('os.POSIXSPAWNCLOSE', 'fd')\n\nPerforms 'os.close(fd)'.\n\n-- Data: os.POSIXSPAWNDUP2\n\n('os.POSIXSPAWNDUP2', 'fd', 'newfd')\n\nPerforms 'os.dup2(fd, newfd)'.\n\nThese tuples correspond to the C library\n'posixspawnfileactionsaddopen()',\n'posixspawnfileactionsaddclose()', and\n'posixspawnfileactionsadddup2()' API calls used to prepare for\nthe 'posixspawn()' call itself.\n\nThe 'setpgroup' argument will set the process group of the child to\nthe value specified.  If the value specified is 0, the child's\nprocess group ID will be made the same as its process ID. If the\nvalue of 'setpgroup' is not set, the child will inherit the\nparent's process group ID. This argument corresponds to the C\nlibrary 'POSIXSPAWNSETPGROUP' flag.\n\nIf the 'resetids' argument is 'True' it will reset the effective\nUID and GID of the child to the real UID and GID of the parent\nprocess.  If the argument is 'False', then the child retains the\neffective UID and GID of the parent.  In either case, if the\nset-user-ID and set-group-ID permission bits are enabled on the\nexecutable file, their effect will override the setting of the\neffective UID and GID. This argument corresponds to the C library\n'POSIXSPAWNRESETIDS' flag.\n\nIf the 'setsid' argument is 'True', it will create a new session ID\nfor 'posixspawn'.  'setsid' requires 'POSIXSPAWNSETSID' or\n'POSIXSPAWNSETSIDNP' flag.  Otherwise, *note\nNotImplementedError: ba5. is raised.\n\nThe 'setsigmask' argument will set the signal mask to the signal\nset specified.  If the parameter is not used, then the child\ninherits the parent's signal mask.  This argument corresponds to\nthe C library 'POSIXSPAWNSETSIGMASK' flag.\n\nThe 'sigdef' argument will reset the disposition of all signals in\nthe set specified.  This argument corresponds to the C library\n'POSIXSPAWNSETSIGDEF' flag.\n\nThe 'scheduler' argument must be a tuple containing the (optional)\nscheduler policy and an instance of *note schedparam: 28cd. with\nthe scheduler parameters.  A value of 'None' in the place of the\nscheduler policy indicates that is not being provided.  This\nargument is a combination of the C library\n'POSIXSPAWNSETSCHEDPARAM' and 'POSIXSPAWNSETSCHEDULER' flags.\n\nRaises an *note auditing event: 161d. 'os.posixspawn' with\narguments 'path', 'argv', 'env'.\n\nNew in version 3.8.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Function: os.posixspawnp (path, argv, env, *, fileactions=None,\nsetpgroup=None, resetids=False, setsid=False, setsigmask=(),\nsetsigdef=(), scheduler=None)\n\nWraps the 'posixspawnp()' C library API for use from Python.\n\nSimilar to *note posixspawn(): 885. except that the system\nsearches for the 'executable' file in the list of directories\nspecified by the 'PATH' environment variable (in the same way as\nfor 'execvp(3)').\n\nRaises an *note auditing event: 161d. 'os.posixspawn' with\narguments 'path', 'argv', 'env'.\n\nNew in version 3.8.\n\n*note Availability: 1ad3.: POSIX, not Emscripten, not WASI.\n\nSee *note posixspawn(): 885. documentation.\n\n-- Function: os.registeratfork (*, before=None, afterinparent=None,\nafterinchild=None)\n\nRegister callables to be executed when a new child process is\nforked using *note os.fork(): 231. or similar process cloning APIs.\nThe parameters are optional and keyword-only.  Each specifies a\ndifferent call point.\n\n* 'before' is a function called before forking a child process.\n\n* 'afterinparent' is a function called from the parent process\nafter forking a child process.\n\n* 'afterinchild' is a function called from the child process.\n\nThese calls are only made if control is expected to return to the\nPython interpreter.  A typical *note subprocess: d0. launch will\nnot trigger them as the child is not going to re-enter the\ninterpreter.\n\nFunctions registered for execution before forking are called in\nreverse registration order.  Functions registered for execution\nafter forking (either in the parent or in the child) are called in\nregistration order.\n\nNote that 'fork()' calls made by third-party C code may not call\nthose functions, unless it explicitly calls *note\nPyOSBeforeFork(): a03, *note PyOSAfterForkParent(): a04. and\n*note PyOSAfterForkChild(): 33b.\n\nThere is no way to unregister a function.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nNew in version 3.7.\n\n-- Function: os.spawnl (mode, path, ...)\n-- Function: os.spawnle (mode, path, ..., env)\n-- Function: os.spawnlp (mode, file, ...)\n-- Function: os.spawnlpe (mode, file, ..., env)\n-- Function: os.spawnv (mode, path, args)\n-- Function: os.spawnve (mode, path, args, env)\n-- Function: os.spawnvp (mode, file, args)\n-- Function: os.spawnvpe (mode, file, args, env)\n\nExecute the program 'path' in a new process.\n\n(Note that the *note subprocess: d0. module provides more powerful\nfacilities for spawning new processes and retrieving their results;\nusing that module is preferable to using these functions.  Check\nespecially the *note Replacing Older Functions with the subprocess\nModule: ffe. section.)\n\nIf 'mode' is *note PNOWAIT: 28d5, this function returns the\nprocess id of the new process; if 'mode' is *note PWAIT: 28d6,\nreturns the process's exit code if it exits normally, or '-signal',\nwhere 'signal' is the signal that killed the process.  On Windows,\nthe process id will actually be the process handle, so can be used\nwith the *note waitpid(): bf6. function.\n\nNote on VxWorks, this function doesn't return '-signal' when the\nnew process is killed.  Instead it raises OSError exception.\n\nThe \"l\" and \"v\" variants of the *note spawn*: 1479. functions\ndiffer in how command-line arguments are passed.  The \"l\" variants\nare perhaps the easiest to work with if the number of parameters is\nfixed when the code is written; the individual parameters simply\nbecome additional parameters to the 'spawnl*()' functions.  The \"v\"\nvariants are good when the number of parameters is variable, with\nthe arguments being passed in a list or tuple as the 'args'\nparameter.  In either case, the arguments to the child process must\nstart with the name of the command being run.\n\nThe variants which include a second \"p\" near the end (*note\nspawnlp(): 28cf, *note spawnlpe(): 28d0, *note spawnvp(): 28d3, and\n*note spawnvpe(): 28d4.) will use the 'PATH' environment variable\nto locate the program 'file'.  When the environment is being\nreplaced (using one of the *note spawn*e: 1479. variants, discussed\nin the next paragraph), the new environment is used as the source\nof the 'PATH' variable.  The other variants, *note spawnl(): 1479,\n*note spawnle(): 28ce, *note spawnv(): 28d1, and *note spawnve():\n28d2, will not use the 'PATH' variable to locate the executable;\n'path' must contain an appropriate absolute or relative path.\n\nFor *note spawnle(): 28ce, *note spawnlpe(): 28d0, *note spawnve():\n28d2, and *note spawnvpe(): 28d4. (note that these all end in \"e\"),\nthe 'env' parameter must be a mapping which is used to define the\nenvironment variables for the new process (they are used instead of\nthe current process' environment); the functions *note spawnl():\n1479, *note spawnlp(): 28cf, *note spawnv(): 28d1, and *note\nspawnvp(): 28d3. all cause the new process to inherit the\nenvironment of the current process.  Note that keys and values in\nthe 'env' dictionary must be strings; invalid keys or values will\ncause the function to fail, with a return value of '127'.\n\nAs an example, the following calls to *note spawnlp(): 28cf. and\n*note spawnvpe(): 28d4. are equivalent:\n\nimport os\nos.spawnlp(os.PWAIT, 'cp', 'cp', 'index.html', '/dev/null')\n\nL = ['cp', 'index.html', '/dev/null']\nos.spawnvpe(os.PWAIT, 'cp', L, os.environ)\n\nRaises an *note auditing event: 161d. 'os.spawn' with arguments\n'mode', 'path', 'args', 'env'.\n\n*note Availability: 1ad3.: Unix, Windows, not Emscripten, not WASI.\n\n*note spawnlp(): 28cf, *note spawnlpe(): 28d0, *note spawnvp():\n28d3. and *note spawnvpe(): 28d4. are not available on Windows.\n*note spawnle(): 28ce. and *note spawnve(): 28d2. are not\nthread-safe on Windows; we advise you to use the *note subprocess:\nd0. module instead.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Data: os.PNOWAIT\n-- Data: os.PNOWAITO\n\nPossible values for the 'mode' parameter to the *note spawn*: 1479.\nfamily of functions.  If either of these values is given, the *note\nspawn*: 1479. functions will return as soon as the new process has\nbeen created, with the process id as the return value.\n\n*note Availability: 1ad3.: Unix, Windows.\n\n-- Data: os.PWAIT\n\nPossible value for the 'mode' parameter to the *note spawn*: 1479.\nfamily of functions.  If this is given as 'mode', the *note spawn*:\n1479. functions will not return until the new process has run to\ncompletion and will return the exit code of the process the run is\nsuccessful, or '-signal' if a signal kills the process.\n\n*note Availability: 1ad3.: Unix, Windows.\n\n-- Data: os.PDETACH\n-- Data: os.POVERLAY\n\nPossible values for the 'mode' parameter to the *note spawn*: 1479.\nfamily of functions.  These are less portable than those listed\nabove.  *note PDETACH: 28d8. is similar to *note PNOWAIT: 28d5,\nbut the new process is detached from the console of the calling\nprocess.  If *note POVERLAY: 28d9. is used, the current process\nwill be replaced; the *note spawn*: 1479. function will not return.\n\n*note Availability: 1ad3.: Windows.\n\n-- Function: os.startfile (path[, operation][, arguments][, cwd][,\nshowcmd])\n\nStart a file with its associated application.\n\nWhen 'operation' is not specified, this acts like double-clicking\nthe file in Windows Explorer, or giving the file name as an\nargument to the 'start' command from the interactive command shell:\nthe file is opened with whatever application (if any) its extension\nis associated.\n\nWhen another 'operation' is given, it must be a \"command verb\" that\nspecifies what should be done with the file.  Common verbs\ndocumented by Microsoft are ''open'', ''print'' and ''edit'' (to be\nused on files) as well as ''explore'' and ''find'' (to be used on\ndirectories).\n\nWhen launching an application, specify 'arguments' to be passed as\na single string.  This argument may have no effect when using this\nfunction to launch a document.\n\nThe default working directory is inherited, but may be overridden\nby the 'cwd' argument.  This should be an absolute path.  A\nrelative 'path' will be resolved against this argument.\n\nUse 'showcmd' to override the default window style.  Whether this\nhas any effect will depend on the application being launched.\nValues are integers as supported by the Win32 'ShellExecute()'\nfunction.\n\n*note startfile(): 1630. returns as soon as the associated\napplication is launched.  There is no option to wait for the\napplication to close, and no way to retrieve the application's exit\nstatus.  The 'path' parameter is relative to the current directory\nor 'cwd'.  If you want to use an absolute path, make sure the first\ncharacter is not a slash (''/'') Use *note pathlib: 9f. or the\n*note os.path.normpath(): 1191. function to ensure that paths are\nproperly encoded for Win32.\n\nTo reduce interpreter startup overhead, the Win32 'ShellExecute()'\nfunction is not resolved until this function is first called.  If\nthe function cannot be resolved, *note NotImplementedError: ba5.\nwill be raised.\n\nRaises an *note auditing event: 161d. 'os.startfile' with arguments\n'path', 'operation'.\n\nRaises an *note auditing event: 161d. 'os.startfile/2' with\narguments 'path', 'operation', 'arguments', 'cwd', 'showcmd'.\n\n*note Availability: 1ad3.: Windows.\n\nChanged in version 3.10: Added the 'arguments', 'cwd' and\n'showcmd' arguments, and the 'os.startfile/2' audit event.\n\n-- Function: os.system (command)\n\nExecute the command (a string) in a subshell.  This is implemented\nby calling the Standard C function 'system()', and has the same\nlimitations.  Changes to *note sys.stdin: 293, etc.  are not\nreflected in the environment of the executed command.  If 'command'\ngenerates any output, it will be sent to the interpreter standard\noutput stream.  The C standard does not specify the meaning of the\nreturn value of the C function, so the return value of the Python\nfunction is system-dependent.\n\nOn Unix, the return value is the exit status of the process encoded\nin the format specified for *note wait(): bf4.\n\nOn Windows, the return value is that returned by the system shell\nafter running 'command'.  The shell is given by the Windows\nenvironment variable 'COMSPEC': it is usually 'cmd.exe', which\nreturns the exit status of the command run; on systems using a\nnon-native shell, consult your shell documentation.\n\nThe *note subprocess: d0. module provides more powerful facilities\nfor spawning new processes and retrieving their results; using that\nmodule is preferable to using this function.  See the *note\nReplacing Older Functions with the subprocess Module: ffe. section\nin the *note subprocess: d0. documentation for some helpful\nrecipes.\n\nOn Unix, *note waitstatustoexitcode(): 73b. can be used to\nconvert the result (exit status) into an exit code.  On Windows,\nthe result is directly the exit code.\n\nRaises an *note auditing event: 161d. 'os.system' with argument\n'command'.\n\n*note Availability: 1ad3.: Unix, Windows, not Emscripten, not WASI.\n\n-- Function: os.times ()\n\nReturns the current global process times.  The return value is an\nobject with five attributes:\n\n* 'user' - user time\n\n* 'system' - system time\n\n* 'childrenuser' - user time of all child processes\n\n* 'childrensystem' - system time of all child processes\n\n* 'elapsed' - elapsed real time since a fixed point in the past\n\nFor backwards compatibility, this object also behaves like a\nfive-tuple containing 'user', 'system', 'childrenuser',\n'childrensystem', and 'elapsed' in that order.\n\nSee the Unix manual page 'times(2)' and times(3)(3) manual page on\nUnix or the GetProcessTimes MSDN(4) on Windows.  On Windows, only\n'user' and 'system' are known; the other attributes are zero.\n\n*note Availability: 1ad3.: Unix, Windows.\n\nChanged in version 3.3: Return type changed from a tuple to a\ntuple-like object with named attributes.\n\n-- Function: os.wait ()\n\nWait for completion of a child process, and return a tuple\ncontaining its pid and exit status indication: a 16-bit number,\nwhose low byte is the signal number that killed the process, and\nwhose high byte is the exit status (if the signal number is zero);\nthe high bit of the low byte is set if a core file was produced.\n\nIf there are no children that could be waited for, *note\nChildProcessError: ed1. is raised.\n\n*note waitstatustoexitcode(): 73b. can be used to convert the\nexit status into an exit code.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nSee also\n........\n\nThe other 'wait*()' functions documented below can be used to wait\nfor the completion of a specific child process and have more\noptions.  *note waitpid(): bf6. is the only one also available on\nWindows.\n\n-- Function: os.waitid (idtype, id, options, /)\n\nWait for the completion of a child process.\n\n'idtype' can be *note PPID: 28da, *note PPGID: 28db, *note PALL:\n28dc, or (on Linux) *note PPIDFD: 738.  The interpretation of 'id'\ndepends on it; see their individual descriptions.\n\n'options' is an OR combination of flags.  At least one of *note\nWEXITED: 28dd, *note WSTOPPED: 28de. or *note WCONTINUED: 28df. is\nrequired; *note WNOHANG: 28e0. and *note WNOWAIT: 28e1. are\nadditional optional flags.\n\nThe return value is an object representing the data contained in\nthe 'siginfot' structure with the following attributes:\n\n* 'sipid' (process ID)\n\n* 'siuid' (real user ID of the child)\n\n* 'sisigno' (always *note SIGCHLD: 28e2.)\n\n* 'sistatus' (the exit status or signal number, depending on\n'sicode')\n\n* 'sicode' (see *note CLDEXITED: 28e3. for possible values)\n\nIf *note WNOHANG: 28e0. is specified and there are no matching\nchildren in the requested state, 'None' is returned.  Otherwise, if\nthere are no matching children that could be waited for, *note\nChildProcessError: ed1. is raised.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nNote: This function is not available on macOS.\n\nNew in version 3.3.\n\n-- Function: os.waitpid (pid, options, /)\n\nThe details of this function differ on Unix and Windows.\n\nOn Unix: Wait for completion of a child process given by process id\n'pid', and return a tuple containing its process id and exit status\nindication (encoded as for *note wait(): bf4.).  The semantics of\nthe call are affected by the value of the integer 'options', which\nshould be '0' for normal operation.\n\nIf 'pid' is greater than '0', *note waitpid(): bf6. requests status\ninformation for that specific process.  If 'pid' is '0', the\nrequest is for the status of any child in the process group of the\ncurrent process.  If 'pid' is '-1', the request pertains to any\nchild of the current process.  If 'pid' is less than '-1', status\nis requested for any process in the process group '-pid' (the\nabsolute value of 'pid').\n\n'options' is an OR combination of flags.  If it contains *note\nWNOHANG: 28e0. and there are no matching children in the requested\nstate, '(0, 0)' is returned.  Otherwise, if there are no matching\nchildren that could be waited for, *note ChildProcessError: ed1. is\nraised.  Other options that can be used are *note WUNTRACED: 28e4.\nand *note WCONTINUED: 28df.\n\nOn Windows: Wait for completion of a process given by process\nhandle 'pid', and return a tuple containing 'pid', and its exit\nstatus shifted left by 8 bits (shifting makes cross-platform use of\nthe function easier).  A 'pid' less than or equal to '0' has no\nspecial meaning on Windows, and raises an exception.  The value of\ninteger 'options' has no effect.  'pid' can refer to any process\nwhose id is known, not necessarily a child process.  The *note\nspawn*: 1479. functions called with *note PNOWAIT: 28d5. return\nsuitable process handles.\n\n*note waitstatustoexitcode(): 73b. can be used to convert the\nexit status into an exit code.\n\n*note Availability: 1ad3.: Unix, Windows, not Emscripten, not WASI.\n\nChanged in version 3.5: If the system call is interrupted and the\nsignal handler does not raise an exception, the function now\nretries the system call instead of raising an *note\nInterruptedError: be3. exception (see PEP 475(5) for the\nrationale).\n\n-- Function: os.wait3 (options)\n\nSimilar to *note waitpid(): bf6, except no process id argument is\ngiven and a 3-element tuple containing the child's process id, exit\nstatus indication, and resource usage information is returned.\nRefer to *note resource.getrusage(): 1289. for details on resource\nusage information.  The 'options' argument is the same as that\nprovided to *note waitpid(): bf6. and *note wait4(): bf3.\n\n*note waitstatustoexitcode(): 73b. can be used to convert the\nexit status into an exitcode.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Function: os.wait4 (pid, options)\n\nSimilar to *note waitpid(): bf6, except a 3-element tuple,\ncontaining the child's process id, exit status indication, and\nresource usage information is returned.  Refer to *note\nresource.getrusage(): 1289. for details on resource usage\ninformation.  The arguments to *note wait4(): bf3. are the same as\nthose provided to *note waitpid(): bf6.\n\n*note waitstatustoexitcode(): 73b. can be used to convert the\nexit status into an exitcode.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Data: os.PPID\n-- Data: os.PPGID\n-- Data: os.PALL\n-- Data: os.PPIDFD\n\nThese are the possible values for 'idtype' in *note waitid(): bf5.\nThey affect how 'id' is interpreted:\n\n* 'PPID' - wait for the child whose PID is 'id'.\n\n* 'PPGID' - wait for any child whose progress group ID is 'id'.\n\n* 'PALL' - wait for any child; 'id' is ignored.\n\n* 'PPIDFD' - wait for the child identified by the file\ndescriptor 'id' (a process file descriptor created with *note\npidfdopen(): 195.).\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nNote: 'PPIDFD' is only available on Linux >= 5.4.\n\nNew in version 3.3.\n\nNew in version 3.9: The 'PPIDFD' constant.\n\n-- Data: os.WCONTINUED\n\nThis 'options' flag for *note waitpid(): bf6, *note wait3(): bf2,\n*note wait4(): bf3, and *note waitid(): bf5. causes child processes\nto be reported if they have been continued from a job control stop\nsince they were last reported.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Data: os.WEXITED\n\nThis 'options' flag for *note waitid(): bf5. causes child processes\nthat have terminated to be reported.\n\nThe other 'wait*' functions always report children that have\nterminated, so this option is not available for them.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nNew in version 3.3.\n\n-- Data: os.WSTOPPED\n\nThis 'options' flag for *note waitid(): bf5. causes child processes\nthat have been stopped by the delivery of a signal to be reported.\n\nThis option is not available for the other 'wait*' functions.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nNew in version 3.3.\n\n-- Data: os.WUNTRACED\n\nThis 'options' flag for *note waitpid(): bf6, *note wait3(): bf2,\nand *note wait4(): bf3. causes child processes to also be reported\nif they have been stopped but their current state has not been\nreported since they were stopped.\n\nThis option is not available for *note waitid(): bf5.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Data: os.WNOHANG\n\nThis 'options' flag causes *note waitpid(): bf6, *note wait3():\nbf2, *note wait4(): bf3, and *note waitid(): bf5. to return right\naway if no child process status is available immediately.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Data: os.WNOWAIT\n\nThis 'options' flag causes *note waitid(): bf5. to leave the child\nin a waitable state, so that a later 'wait*()' call can be used to\nretrieve the child status information again.\n\nThis option is not available for the other 'wait*' functions.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Data: os.CLDEXITED\n-- Data: os.CLDKILLED\n-- Data: os.CLDDUMPED\n-- Data: os.CLDTRAPPED\n-- Data: os.CLDSTOPPED\n-- Data: os.CLDCONTINUED\n\nThese are the possible values for 'sicode' in the result returned\nby *note waitid(): bf5.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nNew in version 3.3.\n\nChanged in version 3.9: Added *note CLDKILLED: 736. and *note\nCLDSTOPPED: 737. values.\n\n-- Function: os.waitstatustoexitcode (status)\n\nConvert a wait status to an exit code.\n\nOn Unix:\n\n* If the process exited normally (if 'WIFEXITED(status)' is\ntrue), return the process exit status (return\n'WEXITSTATUS(status)'): result greater than or equal to 0.\n\n* If the process was terminated by a signal (if\n'WIFSIGNALED(status)' is true), return '-signum' where\n'signum' is the number of the signal that caused the process\nto terminate (return '-WTERMSIG(status)'): result less than 0.\n\n* Otherwise, raise a *note ValueError: 183.\n\nOn Windows, return 'status' shifted right by 8 bits.\n\nOn Unix, if the process is being traced or if *note waitpid(): bf6.\nwas called with *note WUNTRACED: 28e4. option, the caller must\nfirst check if 'WIFSTOPPED(status)' is true.  This function must\nnot be called if 'WIFSTOPPED(status)' is true.\n\nSee also\n........\n\n*note WIFEXITED(): 28e8, *note WEXITSTATUS(): 28e9, *note\nWIFSIGNALED(): 28ea, *note WTERMSIG(): 28eb, *note WIFSTOPPED():\n28ec, *note WSTOPSIG(): 28ed. functions.\n\n*note Availability: 1ad3.: Unix, Windows, not Emscripten, not WASI.\n\nNew in version 3.9.\n\nThe following functions take a process status code as returned by *note\nsystem(): 12b2, *note wait(): bf4, or *note waitpid(): bf6. as a\nparameter.  They may be used to determine the disposition of a process.\n\n-- Function: os.WCOREDUMP (status, /)\n\nReturn 'True' if a core dump was generated for the process,\notherwise return 'False'.\n\nThis function should be employed only if *note WIFSIGNALED(): 28ea.\nis true.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Function: os.WIFCONTINUED (status)\n\nReturn 'True' if a stopped child has been resumed by delivery of\n*note SIGCONT: 28f0. (if the process has been continued from a job\ncontrol stop), otherwise return 'False'.\n\nSee *note WCONTINUED: 28df. option.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Function: os.WIFSTOPPED (status)\n\nReturn 'True' if the process was stopped by delivery of a signal,\notherwise return 'False'.\n\n*note WIFSTOPPED(): 28ec. only returns 'True' if the *note\nwaitpid(): bf6. call was done using *note WUNTRACED: 28e4. option\nor when the process is being traced (see 'ptrace(2)').\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Function: os.WIFSIGNALED (status)\n\nReturn 'True' if the process was terminated by a signal, otherwise\nreturn 'False'.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Function: os.WIFEXITED (status)\n\nReturn 'True' if the process exited terminated normally, that is,\nby calling 'exit()' or 'exit()', or by returning from 'main()';\notherwise return 'False'.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Function: os.WEXITSTATUS (status)\n\nReturn the process exit status.\n\nThis function should be employed only if *note WIFEXITED(): 28e8.\nis true.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Function: os.WSTOPSIG (status)\n\nReturn the signal which caused the process to stop.\n\nThis function should be employed only if *note WIFSTOPPED(): 28ec.\nis true.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n-- Function: os.WTERMSIG (status)\n\nReturn the number of the signal that caused the process to\nterminate.\n\nThis function should be employed only if *note WIFSIGNALED(): 28ea.\nis true.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\n---------- Footnotes ----------\n\n(1) https://msdn.microsoft.com/44228cf2-6306-466c-8f16-f513cd3ba8b5\n\n(2) https://discuss.python.org/t/33555\n\n(3) https://man.freebsd.org/cgi/man.cgi?time(3)\n\n(4)\nhttps://docs.microsoft.com/windows/win32/api/processthreadsapi/nf-processthreadsapi-getprocesstimes\n\n(5) https://peps.python.org/pep-0475/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Interface to the scheduler,  Next: Miscellaneous System Information,  Prev: Process Management,  Up: os -- Miscellaneous operating system interfaces": {
            "content": "5.16.1.11 Interface to the scheduler\n....................................\n",
            "subsections": []
        },
        "These functions control how a process is allocated CPU time by the": {
            "content": "operating system.  They are only available on some Unix platforms.  For\nmore detailed information, consult your Unix manpages.\n\nNew in version 3.3.\n",
            "subsections": []
        },
        "The following scheduling policies are exposed if they are supported by": {
            "content": "the operating system.\n\n-- Data: os.SCHEDOTHER\n\nThe default scheduling policy.\n\n-- Data: os.SCHEDBATCH\n\nScheduling policy for CPU-intensive processes that tries to\npreserve interactivity on the rest of the computer.\n\n-- Data: os.SCHEDIDLE\n\nScheduling policy for extremely low priority background tasks.\n\n-- Data: os.SCHEDSPORADIC\n\nScheduling policy for sporadic server programs.\n\n-- Data: os.SCHEDFIFO\n\nA First In First Out scheduling policy.\n\n-- Data: os.SCHEDRR\n\nA round-robin scheduling policy.\n\n-- Data: os.SCHEDRESETONFORK\n\nThis flag can be OR'ed with any other scheduling policy.  When a\nprocess with this flag set forks, its child's scheduling policy and\npriority are reset to the default.\n\n-- Class: os.schedparam (schedpriority)\n\nThis class represents tunable scheduling parameters used in *note\nschedsetparam(): f7f, *note schedsetscheduler(): f80, and *note\nschedgetparam(): f7b.  It is immutable.\n\nAt the moment, there is only one possible parameter:\n\n-- Attribute: schedpriority\n\nThe scheduling priority for a scheduling policy.\n\n-- Function: os.schedgetprioritymin (policy)\n\nGet the minimum priority value for 'policy'.  'policy' is one of\nthe scheduling policy constants above.\n\n-- Function: os.schedgetprioritymax (policy)\n\nGet the maximum priority value for 'policy'.  'policy' is one of\nthe scheduling policy constants above.\n\n-- Function: os.schedsetscheduler (pid, policy, param, /)\n\nSet the scheduling policy for the process with PID 'pid'.  A 'pid'\nof 0 means the calling process.  'policy' is one of the scheduling\npolicy constants above.  'param' is a *note schedparam: 28cd.\ninstance.\n\n-- Function: os.schedgetscheduler (pid, /)\n\nReturn the scheduling policy for the process with PID 'pid'.  A\n'pid' of 0 means the calling process.  The result is one of the\nscheduling policy constants above.\n\n-- Function: os.schedsetparam (pid, param, /)\n\nSet the scheduling parameters for the process with PID 'pid'.  A\n'pid' of 0 means the calling process.  'param' is a *note\nschedparam: 28cd. instance.\n\n-- Function: os.schedgetparam (pid, /)\n\nReturn the scheduling parameters as a *note schedparam: 28cd.\ninstance for the process with PID 'pid'.  A 'pid' of 0 means the\ncalling process.\n\n-- Function: os.schedrrgetinterval (pid, /)\n\nReturn the round-robin quantum in seconds for the process with PID\n'pid'.  A 'pid' of 0 means the calling process.\n\n-- Function: os.schedyield ()\n\nVoluntarily relinquish the CPU.\n\n-- Function: os.schedsetaffinity (pid, mask, /)\n\nRestrict the process with PID 'pid' (or the current process if\nzero) to a set of CPUs.  'mask' is an iterable of integers\nrepresenting the set of CPUs to which the process should be\nrestricted.\n\n-- Function: os.schedgetaffinity (pid, /)\n\nReturn the set of CPUs the process with PID 'pid' is restricted to.\n\nIf 'pid' is zero, return the set of CPUs the calling thread of the\ncurrent process is restricted to.\n\nFile: python3.12.info,  Node: Miscellaneous System Information,  Next: Random numbers<2>,  Prev: Interface to the scheduler,  Up: os -- Miscellaneous operating system interfaces\n\n5.16.1.12 Miscellaneous System Information\n..........................................\n\n-- Function: os.confstr (name, /)\n\nReturn string-valued system configuration values.  'name' specifies\nthe configuration value to retrieve; it may be a string which is\nthe name of a defined system value; these names are specified in a\nnumber of standards (POSIX, Unix 95, Unix 98, and others).  Some\nplatforms define additional names as well.  The names known to the\nhost operating system are given as the keys of the 'confstrnames'\ndictionary.  For configuration variables not included in that\nmapping, passing an integer for 'name' is also accepted.\n\nIf the configuration value specified by 'name' isn't defined,\n'None' is returned.\n\nIf 'name' is a string and is not known, *note ValueError: 183. is\nraised.  If a specific value for 'name' is not supported by the\nhost system, even if it is included in 'confstrnames', an *note\nOSError: 613. is raised with *note errno.EINVAL: 1766. for the\nerror number.\n\n*note Availability: 1ad3.: Unix.\n\n-- Data: os.confstrnames\n\nDictionary mapping names accepted by *note confstr(): 28fc. to the\ninteger values defined for those names by the host operating\nsystem.  This can be used to determine the set of names known to\nthe system.\n\n*note Availability: 1ad3.: Unix.\n\n-- Function: os.cpucount ()\n\nReturn the number of logical CPUs in the system.  Returns 'None' if\nundetermined.\n\nThis number is not equivalent to the number of logical CPUs the\ncurrent process can use.  'len(os.schedgetaffinity(0))' gets the\nnumber of logical CPUs the calling thread of the current process is\nrestricted to\n\nNew in version 3.4.\n\n-- Function: os.getloadavg ()\n\nReturn the number of processes in the system run queue averaged\nover the last 1, 5, and 15 minutes or raises *note OSError: 613. if\nthe load average was unobtainable.\n\n*note Availability: 1ad3.: Unix.\n\n-- Function: os.sysconf (name, /)\n\nReturn integer-valued system configuration values.  If the\nconfiguration value specified by 'name' isn't defined, '-1' is\nreturned.  The comments regarding the 'name' parameter for *note\nconfstr(): 28fc. apply here as well; the dictionary that provides\ninformation on the known names is given by 'sysconfnames'.\n\n*note Availability: 1ad3.: Unix.\n\n-- Data: os.sysconfnames\n\nDictionary mapping names accepted by *note sysconf(): 285d. to the\ninteger values defined for those names by the host operating\nsystem.  This can be used to determine the set of names known to\nthe system.\n\n*note Availability: 1ad3.: Unix.\n\nChanged in version 3.11: Add ''SCMINSIGSTKSZ'' name.\n",
            "subsections": []
        },
        "The following data values are used to support path manipulation": {
            "content": "operations.  These are defined for all platforms.\n\nHigher-level operations on pathnames are defined in the *note os.path:\n9d. module.\n\n-- Data: os.curdir\n\nThe constant string used by the operating system to refer to the\ncurrent directory.  This is ''.'' for Windows and POSIX. Also\navailable via *note os.path: 9d.\n\n-- Data: os.pardir\n\nThe constant string used by the operating system to refer to the\nparent directory.  This is ''..'' for Windows and POSIX. Also\navailable via *note os.path: 9d.\n\n-- Data: os.sep\n\nThe character used by the operating system to separate pathname\ncomponents.  This is ''/'' for POSIX and ''\\\\'' for Windows.  Note\nthat knowing this is not sufficient to be able to parse or\nconcatenate pathnames -- use *note os.path.split(): 24c9. and *note\nos.path.join(): 1474. -- but it is occasionally useful.  Also\navailable via *note os.path: 9d.\n\n-- Data: os.altsep\n\nAn alternative character used by the operating system to separate\npathname components, or 'None' if only one separator character\nexists.  This is set to ''/'' on Windows systems where 'sep' is a\nbackslash.  Also available via *note os.path: 9d.\n\n-- Data: os.extsep\n\nThe character which separates the base filename from the extension;\nfor example, the ''.'' in 'os.py'.  Also available via *note\nos.path: 9d.\n\n-- Data: os.pathsep\n\nThe character conventionally used by the operating system to\nseparate search path components (as in 'PATH'), such as '':'' for\nPOSIX or '';'' for Windows.  Also available via *note os.path: 9d.\n\n-- Data: os.defpath\n\nThe default search path used by *note exec*p*: 28b1. and *note\nspawn*p*: 1479. if the environment doesn't have a ''PATH'' key.\nAlso available via *note os.path: 9d.\n\n-- Data: os.linesep\n\nThe string used to separate (or, rather, terminate) lines on the\ncurrent platform.  This may be a single character, such as ''\\n''\nfor POSIX, or multiple characters, for example, ''\\r\\n'' for\nWindows.  Do not use 'os.linesep' as a line terminator when writing\nfiles opened in text mode (the default); use a single ''\\n''\ninstead, on all platforms.\n\n-- Data: os.devnull\n\nThe file path of the null device.  For example: ''/dev/null'' for\nPOSIX, ''nul'' for Windows.  Also available via *note os.path: 9d.\n\n-- Data: os.RTLDLAZY\n-- Data: os.RTLDNOW\n-- Data: os.RTLDGLOBAL\n-- Data: os.RTLDLOCAL\n-- Data: os.RTLDNODELETE\n-- Data: os.RTLDNOLOAD\n-- Data: os.RTLDDEEPBIND\n\nFlags for use with the *note setdlopenflags(): f8f. and *note\ngetdlopenflags(): 136a. functions.  See the Unix manual page\n'dlopen(3)' for what the different flags mean.\n\nNew in version 3.3.\n\nFile: python3.12.info,  Node: Random numbers<2>,  Prev: Miscellaneous System Information,  Up: os -- Miscellaneous operating system interfaces\n\n5.16.1.13 Random numbers\n........................\n\n-- Function: os.getrandom (size, flags=0)\n\nGet up to 'size' random bytes.  The function can return less bytes\nthan requested.\n\nThese bytes can be used to seed user-space random number generators\nor for cryptographic purposes.\n\n'getrandom()' relies on entropy gathered from device drivers and\nother sources of environmental noise.  Unnecessarily reading large\nquantities of data will have a negative impact on other users of\nthe '/dev/random' and '/dev/urandom' devices.\n\nThe flags argument is a bit mask that can contain zero or more of\nthe following values ORed together: *note os.GRNDRANDOM: 2902. and\n*note GRNDNONBLOCK: 2903.\n\nSee also the Linux getrandom() manual page(1).\n\n*note Availability: 1ad3.: Linux >= 3.17.\n\nNew in version 3.6.\n\n-- Function: os.urandom (size, /)\n\nReturn a bytestring of 'size' random bytes suitable for\ncryptographic use.\n\nThis function returns random bytes from an OS-specific randomness\nsource.  The returned data should be unpredictable enough for\ncryptographic applications, though its exact quality depends on the\nOS implementation.\n\nOn Linux, if the 'getrandom()' syscall is available, it is used in\nblocking mode: block until the system urandom entropy pool is\ninitialized (128 bits of entropy are collected by the kernel).  See\nthe PEP 524(2) for the rationale.  On Linux, the *note getrandom():\nb0c. function can be used to get random bytes in non-blocking mode\n(using the *note GRNDNONBLOCK: 2903. flag) or to poll until the\nsystem urandom entropy pool is initialized.\n\nOn a Unix-like system, random bytes are read from the\n'/dev/urandom' device.  If the '/dev/urandom' device is not\navailable or not readable, the *note NotImplementedError: ba5.\nexception is raised.\n\nOn Windows, it will use 'BCryptGenRandom()'.\n\nSee also\n........\n\nThe *note secrets: bb. module provides higher level functions.  For\nan easy-to-use interface to the random number generator provided by\nyour platform, please see *note random.SystemRandom: 23e5.\n\nChanged in version 3.5: On Linux 3.17 and newer, the 'getrandom()'\nsyscall is now used when available.  On OpenBSD 5.6 and newer, the\nC 'getentropy()' function is now used.  These functions avoid the\nusage of an internal file descriptor.\n\nChanged in version 3.5.2: On Linux, if the 'getrandom()' syscall\nblocks (the urandom entropy pool is not initialized yet), fall back\non reading '/dev/urandom'.\n\nChanged in version 3.6: On Linux, 'getrandom()' is now used in\nblocking mode to increase the security.\n\nChanged in version 3.11: On Windows, 'BCryptGenRandom()' is used\ninstead of 'CryptGenRandom()' which is deprecated.\n\n-- Data: os.GRNDNONBLOCK\n\nBy default, when reading from '/dev/random', *note getrandom():\nb0c. blocks if no random bytes are available, and when reading from\n'/dev/urandom', it blocks if the entropy pool has not yet been\ninitialized.\n\nIf the *note GRNDNONBLOCK: 2903. flag is set, then *note\ngetrandom(): b0c. does not block in these cases, but instead\nimmediately raises *note BlockingIOError: ed0.\n\nNew in version 3.6.\n\n-- Data: os.GRNDRANDOM\n\nIf this bit is set, then random bytes are drawn from the\n'/dev/random' pool instead of the '/dev/urandom' pool.\n\nNew in version 3.6.\n\n---------- Footnotes ----------\n\n(1) https://man7.org/linux/man-pages/man2/getrandom.2.html\n\n(2) https://peps.python.org/pep-0524/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: io -- Core tools for working with streams,  Next: time -- Time access and conversions,  Prev: os -- Miscellaneous operating system interfaces,  Up: Generic Operating System Services": {
            "content": "'Source code:' Lib/io.py(1)\n\n\n\n* Menu:\n\n* Overview: Overview<2>.\n* Text Encoding::\n* High-level Module Interface::\n* Class hierarchy::\n* Performance: Performance<3>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/io.py\n\nFile: python3.12.info,  Node: Overview<2>,  Next: Text Encoding,  Up: io -- Core tools for working with streams\n\n5.16.2.1 Overview\n.................\n\nThe *note io: 79. module provides Python's main facilities for dealing\nwith various types of I/O. There are three main types of I/O: 'text\nI/O', 'binary I/O' and 'raw I/O'. These are generic categories, and\nvarious backing stores can be used for each of them.  A concrete object\nbelonging to any of these categories is called a *note file object:\n1037.  Other common terms are 'stream' and 'file-like object'.\n",
            "subsections": []
        },
        "Independent of its category, each concrete stream object will also have": {
            "content": "various capabilities: it can be read-only, write-only, or read-write.",
            "subsections": []
        },
        "It can also allow arbitrary random access (seeking forwards or backwards": {
            "content": "to any location), or only sequential access (for example in the case of\na socket or pipe).\n",
            "subsections": []
        },
        "All streams are careful about the type of data you give to them.  For": {
            "content": "example giving a *note str: 157. object to the 'write()' method of a\nbinary stream will raise a *note TypeError: 28e.  So will giving a *note\nbytes: 295. object to the 'write()' method of a text stream.\n\nChanged in version 3.3: Operations that used to raise *note IOError:\necb. now raise *note OSError: 613, since *note IOError: ecb. is now an\nalias of *note OSError: 613.\n\n* Menu:\n\n* Text I/O::\n* Binary I/O::\n* Raw I/O::\n\nFile: python3.12.info,  Node: Text I/O,  Next: Binary I/O,  Up: Overview<2>\n\n5.16.2.2 Text I/O\n.................\n\nText I/O expects and produces *note str: 157. objects.  This means that\nwhenever the backing store is natively made of bytes (such as in the\ncase of a file), encoding and decoding of data is made transparently as\nwell as optional translation of platform-specific newline characters.\n\nThe easiest way to create a text stream is with *note open(): 26e,\noptionally specifying an encoding:\n\nf = open(\"myfile.txt\", \"r\", encoding=\"utf-8\")\n\nIn-memory text streams are also available as *note StringIO: d94.\nobjects:\n\nf = io.StringIO(\"some initial text data\")\n\nThe text stream API is described in detail in the documentation of *note\nTextIOBase: 461.\n\nFile: python3.12.info,  Node: Binary I/O,  Next: Raw I/O,  Prev: Text I/O,  Up: Overview<2>\n\n5.16.2.3 Binary I/O\n...................\n\nBinary I/O (also called 'buffered I/O') expects *note bytes-like\nobjects: b82. and produces *note bytes: 295. objects.  No encoding,\ndecoding, or newline translation is performed.  This category of streams\ncan be used for all kinds of non-text data, and also when manual control\nover the handling of text data is desired.\n\nThe easiest way to create a binary stream is with *note open(): 26e.\nwith ''b'' in the mode string:\n\nf = open(\"myfile.jpg\", \"rb\")\n\nIn-memory binary streams are also available as *note BytesIO: d08.\nobjects:\n\nf = io.BytesIO(b\"some initial binary data: \\x00\\x01\")\n\nThe binary stream API is described in detail in the docs of *note\nBufferedIOBase: 460.\n",
            "subsections": []
        },
        "Other library modules may provide additional ways to create text or": {
            "content": "binary streams.  See *note socket.socket.makefile(): 1013. for example.\n\nFile: python3.12.info,  Node: Raw I/O,  Prev: Binary I/O,  Up: Overview<2>\n\n5.16.2.4 Raw I/O\n................\n",
            "subsections": []
        },
        "Raw I/O (also called 'unbuffered I/O') is generally used as a low-level": {
            "content": "building-block for binary and text streams; it is rarely useful to\ndirectly manipulate a raw stream from user code.  Nevertheless, you can\ncreate a raw stream by opening a file in binary mode with buffering\ndisabled:\n\nf = open(\"myfile.jpg\", \"rb\", buffering=0)\n\nThe raw stream API is described in detail in the docs of *note\nRawIOBase: f40.\n\nFile: python3.12.info,  Node: Text Encoding,  Next: High-level Module Interface,  Prev: Overview<2>,  Up: io -- Core tools for working with streams\n\n5.16.2.5 Text Encoding\n......................\n\nThe default encoding of *note TextIOWrapper: b8f. and *note open(): 26e.\nis locale-specific (*note locale.getencoding(): 41f.).\n",
            "subsections": []
        },
        "However, many developers forget to specify the encoding when opening": {
            "content": "text files encoded in UTF-8 (e.g.  JSON, TOML, Markdown, etc...) since\nmost Unix platforms use UTF-8 locale by default.  This causes bugs\nbecause the locale encoding is not UTF-8 for most Windows users.  For\nexample:\n\n# May not work on Windows when non-ASCII characters in the file.\nwith open(\"README.md\") as f:\nlongdescription = f.read()\n",
            "subsections": []
        },
        "Accordingly, it is highly recommended that you specify the encoding": {
            "content": "explicitly when opening text files.  If you want to use UTF-8, pass\n'encoding=\"utf-8\"'.  To use the current locale encoding,\n'encoding=\"locale\"' is supported since Python 3.10.\n\nSee also\n........\n\n*note Python UTF-8 Mode: 420.\n\nPython UTF-8 Mode can be used to change the default encoding to\nUTF-8 from locale-specific encoding.\n\nPEP 686(1)\n\nPython 3.15 will make *note Python UTF-8 Mode: 420. default.\n\n* Menu:\n\n* Opt-in EncodingWarning::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0686/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Opt-in EncodingWarning,  Up: Text Encoding": {
            "content": "5.16.2.6 Opt-in EncodingWarning\n...............................\n\nNew in version 3.10: See PEP 597(1) for more details.\n",
            "subsections": []
        },
        "To find where the default locale encoding is used, you can enable the": {
            "content": "*note -X warndefaultencoding: 188. command line option or set the\n*note PYTHONWARNDEFAULTENCODING: 5af. environment variable, which will\nemit an *note EncodingWarning: 1ac0. when the default encoding is used.\n\nIf you are providing an API that uses *note open(): 26e. or *note\nTextIOWrapper: b8f. and passes 'encoding=None' as a parameter, you can\nuse *note textencoding(): 13ea. so that callers of the API will emit an\n*note EncodingWarning: 1ac0. if they don't pass an 'encoding'.  However,\nplease consider using UTF-8 by default (i.e.  'encoding=\"utf-8\"') for\nnew APIs.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0597/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: High-level Module Interface,  Next: Class hierarchy,  Prev: Text Encoding,  Up: io -- Core tools for working with streams": {
            "content": "5.16.2.7 High-level Module Interface\n....................................\n\n-- Data: io.DEFAULTBUFFERSIZE\n\nAn int containing the default buffer size used by the module's\nbuffered I/O classes.  *note open(): 26e. uses the file's blksize\n(as obtained by *note os.stat(): 1bf.) if possible.\n\n-- Function: io.open (file, mode='r', buffering=-1, encoding=None,\nerrors=None, newline=None, closefd=True, opener=None)\n\nThis is an alias for the builtin *note open(): 26e. function.\n\nThis function raises an *note auditing event: 161d. 'open' with\narguments 'path', 'mode' and 'flags'.  The 'mode' and 'flags'\narguments may have been modified or inferred from the original\ncall.\n\n-- Function: io.opencode (path)\n\nOpens the provided file with mode ''rb''.  This function should be\nused when the intent is to treat the contents as executable code.\n\n'path' should be a *note str: 157. and an absolute path.\n\nThe behavior of this function may be overridden by an earlier call\nto the *note PyFileSetOpenCodeHook(): 146e.  However, assuming\nthat 'path' is a *note str: 157. and an absolute path,\n'opencode(path)' should always behave the same as 'open(path,\n'rb')'.  Overriding the behavior is intended for additional\nvalidation or preprocessing of the file.\n\nNew in version 3.8.\n\n-- Function: io.textencoding (encoding, stacklevel=2, /)\n\nThis is a helper function for callables that use *note open(): 26e.\nor *note TextIOWrapper: b8f. and have an 'encoding=None' parameter.\n\nThis function returns 'encoding' if it is not 'None'.  Otherwise,\nit returns '\"locale\"' or '\"utf-8\"' depending on *note UTF-8 Mode:\n420.\n\nThis function emits an *note EncodingWarning: 1ac0. if *note\nsys.flags.warndefaultencoding: 458. is true and 'encoding' is\n'None'.  'stacklevel' specifies where the warning is emitted.  For\nexample:\n\ndef readtext(path, encoding=None):\nencoding = io.textencoding(encoding)  # stacklevel=2\nwith open(path, encoding) as f:\nreturn f.read()\n\nIn this example, an *note EncodingWarning: 1ac0. is emitted for the\ncaller of 'readtext()'.\n\nSee *note Text Encoding: 5b0. for more information.\n\nNew in version 3.10.\n\nChanged in version 3.11: *note textencoding(): 13ea. returns\n\"utf-8\" when UTF-8 mode is enabled and 'encoding' is 'None'.\n\n-- Exception: io.BlockingIOError\n\nThis is a compatibility alias for the builtin *note\nBlockingIOError: ed0. exception.\n\n-- Exception: io.UnsupportedOperation\n\nAn exception inheriting *note OSError: 613. and *note ValueError:\n183. that is raised when an unsupported operation is called on a\nstream.\n\nSee also\n........\n\n*note sys: d3.\n\ncontains the standard IO streams: *note sys.stdin: 293, *note\nsys.stdout: 90c, and *note sys.stderr: 757.\n\nFile: python3.12.info,  Node: Class hierarchy,  Next: Performance<3>,  Prev: High-level Module Interface,  Up: io -- Core tools for working with streams\n\n5.16.2.8 Class hierarchy\n........................\n",
            "subsections": []
        },
        "The implementation of I/O streams is organized as a hierarchy of": {
            "content": "classes.  First *note abstract base classes: 102a. (ABCs), which are\nused to specify the various categories of streams, then concrete classes\nproviding the standard stream implementations.\n\nNote: The abstract base classes also provide default\nimplementations of some methods in order to help implementation of\nconcrete stream classes.  For example, *note BufferedIOBase: 460.\nprovides unoptimized implementations of 'readinto()' and\n'readline()'.\n\nAt the top of the I/O hierarchy is the abstract base class *note IOBase:\n823.  It defines the basic interface to a stream.  Note, however, that\nthere is no separation between reading and writing to streams;\nimplementations are allowed to raise *note UnsupportedOperation: 1704.\nif they do not support a given operation.\n\nThe *note RawIOBase: f40. ABC extends *note IOBase: 823.  It deals with\nthe reading and writing of bytes to a stream.  *note FileIO: 1186.\nsubclasses *note RawIOBase: f40. to provide an interface to files in the\nmachine's file system.\n\nThe *note BufferedIOBase: 460. ABC extends *note IOBase: 823.  It deals\nwith buffering on a raw binary stream (*note RawIOBase: f40.).  Its\nsubclasses, *note BufferedWriter: 1e85, *note BufferedReader: 1082, and\n*note BufferedRWPair: 290f. buffer raw binary streams that are writable,\nreadable, and both readable and writable, respectively.  *note\nBufferedRandom: 1e86. provides a buffered interface to seekable streams.\nAnother *note BufferedIOBase: 460. subclass, *note BytesIO: d08, is a\nstream of in-memory bytes.\n\nThe *note TextIOBase: 461. ABC extends *note IOBase: 823.  It deals with\nstreams whose bytes represent text, and handles encoding and decoding to\nand from strings.  *note TextIOWrapper: b8f, which extends *note",
            "subsections": []
        },
        "TextIOBase: 461, is a buffered text interface to a buffered raw stream": {
            "content": "(*note BufferedIOBase: 460.).  Finally, *note StringIO: d94. is an\nin-memory stream for text.\n",
            "subsections": []
        },
        "Argument names are not part of the specification, and only the arguments": {
            "content": "of *note open(): 26e. are intended to be used as keyword arguments.\n\nThe following table summarizes the ABCs provided by the *note io: 79.\nmodule:\n\nABC                           Inherits               Stub Methods                 Mixin Methods and Properties\n\n-----------------------------------------------------------------------------------------------------------------------------------------\n\n*note IOBase: 823.                                   'fileno', 'seek', and        'close', 'closed', 'enter', 'exit', 'flush',\n'truncate'                   'isatty', 'iter', 'next', 'readable',\n'readline', 'readlines', 'seekable', 'tell',\n'writable', and 'writelines'\n\n\n*note RawIOBase: f40.         *note IOBase: 823.     'readinto' and 'write'       Inherited *note IOBase: 823. methods, 'read', and\n'readall'\n\n\n*note BufferedIOBase: 460.    *note IOBase: 823.     'detach', 'read', 'read1',   Inherited *note IOBase: 823. methods, 'readinto',\nand 'write'                  and 'readinto1'\n\n\n*note TextIOBase: 461.        *note IOBase: 823.     'detach', 'read',            Inherited *note IOBase: 823. methods, 'encoding',\n'readline', and 'write'      'errors', and 'newlines'\n\n\n* Menu:\n\n* I/O Base Classes::\n* Raw File I/O::\n* Buffered Streams::\n* Text I/O: Text I/O<2>.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: I/O Base Classes,  Next: Raw File I/O,  Up: Class hierarchy": {
            "content": "5.16.2.9 I/O Base Classes\n.........................\n\n-- Class: io.IOBase\n\nThe abstract base class for all I/O classes.\n\nThis class provides empty abstract implementations for many methods\nthat derived classes can override selectively; the default\nimplementations represent a file that cannot be read, written or\nseeked.\n\nEven though *note IOBase: 823. does not declare 'read()' or\n'write()' because their signatures will vary, implementations and\nclients should consider those methods part of the interface.  Also,\nimplementations may raise a *note ValueError: 183. (or *note\nUnsupportedOperation: 1704.) when operations they do not support\nare called.\n\nThe basic type used for binary data read from or written to a file\nis *note bytes: 295.  Other *note bytes-like objects: b82. are\naccepted as method arguments too.  Text I/O classes work with *note\nstr: 157. data.\n\nNote that calling any method (even inquiries) on a closed stream is\nundefined.  Implementations may raise *note ValueError: 183. in\nthis case.\n\n*note IOBase: 823. (and its subclasses) supports the iterator\nprotocol, meaning that an *note IOBase: 823. object can be iterated\nover yielding the lines in a stream.  Lines are defined slightly\ndifferently depending on whether the stream is a binary stream\n(yielding bytes), or a text stream (yielding character strings).\nSee *note readline(): 11a1. below.\n\n*note IOBase: 823. is also a context manager and therefore supports\nthe *note with: 396. statement.  In this example, 'file' is closed\nafter the 'with' statement's suite is finished--even if an exception\noccurs:\n\nwith open('spam.txt', 'w') as file:\nfile.write('Spam and eggs!')\n\n*note IOBase: 823. provides these data attributes and methods:\n\n-- Method: close ()\n\nFlush and close this stream.  This method has no effect if the\nfile is already closed.  Once the file is closed, any\noperation on the file (e.g.  reading or writing) will raise a\n*note ValueError: 183.\n\nAs a convenience, it is allowed to call this method more than\nonce; only the first call, however, will have an effect.\n\n-- Attribute: closed\n\n'True' if the stream is closed.\n\n-- Method: fileno ()\n\nReturn the underlying file descriptor (an integer) of the\nstream if it exists.  An *note OSError: 613. is raised if the\nIO object does not use a file descriptor.\n\n-- Method: flush ()\n\nFlush the write buffers of the stream if applicable.  This\ndoes nothing for read-only and non-blocking streams.\n\n-- Method: isatty ()\n\nReturn 'True' if the stream is interactive (i.e., connected to\na terminal/tty device).\n\n-- Method: readable ()\n\nReturn 'True' if the stream can be read from.  If 'False',\n'read()' will raise *note OSError: 613.\n\n-- Method: readline (size=-1, /)\n\nRead and return one line from the stream.  If 'size' is\nspecified, at most 'size' bytes will be read.\n\nThe line terminator is always 'b'\\n'' for binary files; for\ntext files, the 'newline' argument to *note open(): 26e. can\nbe used to select the line terminator(s) recognized.\n\n-- Method: readlines (hint=-1, /)\n\nRead and return a list of lines from the stream.  'hint' can\nbe specified to control the number of lines read: no more\nlines will be read if the total size (in bytes/characters) of\nall lines so far exceeds 'hint'.\n\n'hint' values of '0' or less, as well as 'None', are treated\nas no hint.\n\nNote that it's already possible to iterate on file objects\nusing 'for line in file: ...' without calling\n'file.readlines()'.\n\n-- Method: seek (offset, whence=os.SEEKSET, /)\n\nChange the stream position to the given byte 'offset',\ninterpreted relative to the position indicated by 'whence',\nand return the new absolute position.  Values for 'whence'\nare:\n\n* *note os.SEEKSET: 1106. or '0' - start of the stream\n(the default); 'offset' should be zero or positive\n\n* *note os.SEEKCUR: 1107. or '1' - current stream\nposition; 'offset' may be negative\n\n* *note os.SEEKEND: 1108. or '2' - end of the stream;\n'offset' is usually negative\n\nNew in version 3.1: The 'SEEK*' constants.\n\nNew in version 3.3: Some operating systems could support\nadditional values, like *note os.SEEKHOLE: 283b. or *note\nos.SEEKDATA: 283c.  The valid values for a file could depend\non it being open in text or binary mode.\n\n-- Method: seekable ()\n\nReturn 'True' if the stream supports random access.  If\n'False', *note seek(): 1105, *note tell(): 26a2. and *note\ntruncate(): 1187. will raise *note OSError: 613.\n\n-- Method: tell ()\n\nReturn the current stream position.\n\n-- Method: truncate (size=None, /)\n\nResize the stream to the given 'size' in bytes (or the current\nposition if 'size' is not specified).  The current stream\nposition isn't changed.  This resizing can extend or reduce\nthe current file size.  In case of extension, the contents of\nthe new file area depend on the platform (on most systems,\nadditional bytes are zero-filled).  The new file size is\nreturned.\n\nChanged in version 3.5: Windows will now zero-fill files when\nextending.\n\n-- Method: writable ()\n\nReturn 'True' if the stream supports writing.  If 'False',\n'write()' and *note truncate(): 1187. will raise *note\nOSError: 613.\n\n-- Method: writelines (lines, /)\n\nWrite a list of lines to the stream.  Line separators are not\nadded, so it is usual for each of the lines provided to have a\nline separator at the end.\n\n-- Method: del ()\n\nPrepare for object destruction.  *note IOBase: 823. provides a\ndefault implementation of this method that calls the\ninstance's *note close(): 17a4. method.\n\n-- Class: io.RawIOBase\n\nBase class for raw binary streams.  It inherits from *note IOBase:\n823.\n\nRaw binary streams typically provide low-level access to an\nunderlying OS device or API, and do not try to encapsulate it in\nhigh-level primitives (this functionality is done at a higher-level\nin buffered binary streams and text streams, described later in\nthis page).\n\n*note RawIOBase: f40. provides these methods in addition to those\nfrom *note IOBase: 823.:\n\n-- Method: read (size=-1, /)\n\nRead up to 'size' bytes from the object and return them.  As a\nconvenience, if 'size' is unspecified or -1, all bytes until\nEOF are returned.  Otherwise, only one system call is ever\nmade.  Fewer than 'size' bytes may be returned if the\noperating system call returns fewer than 'size' bytes.\n\nIf 0 bytes are returned, and 'size' was not 0, this indicates\nend of file.  If the object is in non-blocking mode and no\nbytes are available, 'None' is returned.\n\nThe default implementation defers to *note readall(): 2916.\nand *note readinto(): c7c.\n\n-- Method: readall ()\n\nRead and return all the bytes from the stream until EOF, using\nmultiple calls to the stream if necessary.\n\n-- Method: readinto (b, /)\n\nRead bytes into a pre-allocated, writable *note bytes-like\nobject: b82. 'b', and return the number of bytes read.  For\nexample, 'b' might be a *note bytearray: 294.  If the object\nis in non-blocking mode and no bytes are available, 'None' is\nreturned.\n\n-- Method: write (b, /)\n\nWrite the given *note bytes-like object: b82, 'b', to the\nunderlying raw stream, and return the number of bytes written.\nThis can be less than the length of 'b' in bytes, depending on\nspecifics of the underlying raw stream, and especially if it\nis in non-blocking mode.  'None' is returned if the raw stream\nis set not to block and no single byte could be readily\nwritten to it.  The caller may release or mutate 'b' after\nthis method returns, so the implementation should only access\n'b' during the method call.\n\n-- Class: io.BufferedIOBase\n\nBase class for binary streams that support some kind of buffering.\nIt inherits from *note IOBase: 823.\n\nThe main difference with *note RawIOBase: f40. is that methods\n*note read(): 11a0, *note readinto(): 2917. and *note write(): b2a.\nwill try (respectively) to read as much input as requested or to\nconsume all given output, at the expense of making perhaps more\nthan one system call.\n\nIn addition, those methods can raise *note BlockingIOError: ed0. if\nthe underlying raw stream is in non-blocking mode and cannot take\nor give enough data; unlike their *note RawIOBase: f40.\ncounterparts, they will never return 'None'.\n\nBesides, the *note read(): 11a0. method does not have a default\nimplementation that defers to *note readinto(): 2917.\n\nA typical *note BufferedIOBase: 460. implementation should not\ninherit from a *note RawIOBase: f40. implementation, but wrap one,\nlike *note BufferedWriter: 1e85. and *note BufferedReader: 1082.\ndo.\n\n*note BufferedIOBase: 460. provides or overrides these data\nattributes and methods in addition to those from *note IOBase:\n823.:\n\n-- Attribute: raw\n\nThe underlying raw stream (a *note RawIOBase: f40. instance)\nthat *note BufferedIOBase: 460. deals with.  This is not part\nof the *note BufferedIOBase: 460. API and may not exist on\nsome implementations.\n\n-- Method: detach ()\n\nSeparate the underlying raw stream from the buffer and return\nit.\n\nAfter the raw stream has been detached, the buffer is in an\nunusable state.\n\nSome buffers, like *note BytesIO: d08, do not have the concept\nof a single raw stream to return from this method.  They raise\n*note UnsupportedOperation: 1704.\n\nNew in version 3.1.\n\n-- Method: read (size=-1, /)\n\nRead and return up to 'size' bytes.  If the argument is\nomitted, 'None', or negative, data is read and returned until\nEOF is reached.  An empty *note bytes: 295. object is returned\nif the stream is already at EOF.\n\nIf the argument is positive, and the underlying raw stream is\nnot interactive, multiple raw reads may be issued to satisfy\nthe byte count (unless EOF is reached first).  But for\ninteractive raw streams, at most one raw read will be issued,\nand a short result does not imply that EOF is imminent.\n\nA *note BlockingIOError: ed0. is raised if the underlying raw\nstream is in non blocking-mode, and has no data available at\nthe moment.\n\n-- Method: read1 (size=-1, /)\n\nRead and return up to 'size' bytes, with at most one call to\nthe underlying raw stream's *note read(): c7b. (or *note\nreadinto(): c7c.) method.  This can be useful if you are\nimplementing your own buffering on top of a *note\nBufferedIOBase: 460. object.\n\nIf 'size' is '-1' (the default), an arbitrary number of bytes\nare returned (more than zero unless EOF is reached).\n\n-- Method: readinto (b, /)\n\nRead bytes into a pre-allocated, writable *note bytes-like\nobject: b82. 'b' and return the number of bytes read.  For\nexample, 'b' might be a *note bytearray: 294.\n\nLike *note read(): 11a0, multiple reads may be issued to the\nunderlying raw stream, unless the latter is interactive.\n\nA *note BlockingIOError: ed0. is raised if the underlying raw\nstream is in non blocking-mode, and has no data available at\nthe moment.\n\n-- Method: readinto1 (b, /)\n\nRead bytes into a pre-allocated, writable *note bytes-like\nobject: b82. 'b', using at most one call to the underlying raw\nstream's *note read(): c7b. (or *note readinto(): c7c.)\nmethod.  Return the number of bytes read.\n\nA *note BlockingIOError: ed0. is raised if the underlying raw\nstream is in non blocking-mode, and has no data available at\nthe moment.\n\nNew in version 3.5.\n\n-- Method: write (b, /)\n\nWrite the given *note bytes-like object: b82, 'b', and return\nthe number of bytes written (always equal to the length of 'b'\nin bytes, since if the write fails an *note OSError: 613. will\nbe raised).  Depending on the actual implementation, these\nbytes may be readily written to the underlying stream, or held\nin a buffer for performance and latency reasons.\n\nWhen in non-blocking mode, a *note BlockingIOError: ed0. is\nraised if the data needed to be written to the raw stream but\nit couldn't accept all the data without blocking.\n\nThe caller may release or mutate 'b' after this method\nreturns, so the implementation should only access 'b' during\nthe method call.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Raw File I/O,  Next: Buffered Streams,  Prev: I/O Base Classes,  Up: Class hierarchy": {
            "content": "5.16.2.10 Raw File I/O\n......................\n\n-- Class: io.FileIO (name, mode='r', closefd=True, opener=None)\n\nA raw binary stream representing an OS-level file containing bytes\ndata.  It inherits from *note RawIOBase: f40.\n\nThe 'name' can be one of two things:\n\n* a character string or *note bytes: 295. object representing\nthe path to the file which will be opened.  In this case\nclosefd must be 'True' (the default) otherwise an error will\nbe raised.\n\n* an integer representing the number of an existing OS-level\nfile descriptor to which the resulting *note FileIO: 1186.\nobject will give access.  When the FileIO object is closed\nthis fd will be closed as well, unless 'closefd' is set to\n'False'.\n\nThe 'mode' can be ''r'', ''w'', ''x'' or ''a'' for reading\n(default), writing, exclusive creation or appending.  The file will\nbe created if it doesn't exist when opened for writing or\nappending; it will be truncated when opened for writing.  *note\nFileExistsError: e97. will be raised if it already exists when\nopened for creating.  Opening a file for creating implies writing,\nso this mode behaves in a similar way to ''w''.  Add a ''+'' to the\nmode to allow simultaneous reading and writing.\n\nThe *note read(): c7b. (when called with a positive argument),\n*note readinto(): c7c. and *note write(): 26e0. methods on this\nclass will only make one system call.\n\nA custom opener can be used by passing a callable as 'opener'.  The\nunderlying file descriptor for the file object is then obtained by\ncalling 'opener' with ('name', 'flags').  'opener' must return an\nopen file descriptor (passing *note os.open: bee. as 'opener'\nresults in functionality similar to passing 'None').\n\nThe newly created file is *note non-inheritable: d60.\n\nSee the *note open(): 26e. built-in function for examples on using\nthe 'opener' parameter.\n\nChanged in version 3.3: The 'opener' parameter was added.  The\n''x'' mode was added.\n\nChanged in version 3.4: The file is now non-inheritable.\n\n*note FileIO: 1186. provides these data attributes in addition to\nthose from *note RawIOBase: f40. and *note IOBase: 823.:\n\n-- Attribute: mode\n\nThe mode as given in the constructor.\n\n-- Attribute: name\n\nThe file name.  This is the file descriptor of the file when\nno name is given in the constructor.\n\nFile: python3.12.info,  Node: Buffered Streams,  Next: Text I/O<2>,  Prev: Raw File I/O,  Up: Class hierarchy\n\n5.16.2.11 Buffered Streams\n..........................\n",
            "subsections": []
        },
        "Buffered I/O streams provide a higher-level interface to an I/O device": {
            "content": "than raw I/O does.\n\n-- Class: io.BytesIO (initialbytes=b'')\n\nA binary stream using an in-memory bytes buffer.  It inherits from\n*note BufferedIOBase: 460.  The buffer is discarded when the *note\nclose(): 17a4. method is called.\n\nThe optional argument 'initialbytes' is a *note bytes-like object:\nb82. that contains initial data.\n\n*note BytesIO: d08. provides or overrides these methods in addition\nto those from *note BufferedIOBase: 460. and *note IOBase: 823.:\n\n-- Method: getbuffer ()\n\nReturn a readable and writable view over the contents of the\nbuffer without copying them.  Also, mutating the view will\ntransparently update the contents of the buffer:\n\n>>> b = io.BytesIO(b\"abcdef\")\n>>> view = b.getbuffer()\n>>> view[2:4] = b\"56\"\n>>> b.getvalue()\nb'ab56ef'\n\nNote: As long as the view exists, the *note BytesIO: d08.\nobject cannot be resized or closed.\n\nNew in version 3.2.\n\n-- Method: getvalue ()\n\nReturn *note bytes: 295. containing the entire contents of the\nbuffer.\n\n-- Method: read1 (size=-1, /)\n\nIn *note BytesIO: d08, this is the same as *note read(): 11a0.\n\nChanged in version 3.7: The 'size' argument is now optional.\n\n-- Method: readinto1 (b, /)\n\nIn *note BytesIO: d08, this is the same as *note readinto():\n2917.\n\nNew in version 3.5.\n\n-- Class: io.BufferedReader (raw, buffersize=DEFAULTBUFFERSIZE)\n\nA buffered binary stream providing higher-level access to a\nreadable, non seekable *note RawIOBase: f40. raw binary stream.  It\ninherits from *note BufferedIOBase: 460.\n\nWhen reading data from this object, a larger amount of data may be\nrequested from the underlying raw stream, and kept in an internal\nbuffer.  The buffered data can then be returned directly on\nsubsequent reads.\n\nThe constructor creates a *note BufferedReader: 1082. for the given\nreadable 'raw' stream and 'buffersize'.  If 'buffersize' is\nomitted, *note DEFAULTBUFFERSIZE: 13eb. is used.\n\n*note BufferedReader: 1082. provides or overrides these methods in\naddition to those from *note BufferedIOBase: 460. and *note IOBase:\n823.:\n\n-- Method: peek (size=0, /)\n\nReturn bytes from the stream without advancing the position.\nAt most one single read on the raw stream is done to satisfy\nthe call.  The number of bytes returned may be less or more\nthan requested.\n\n-- Method: read (size=-1, /)\n\nRead and return 'size' bytes, or if 'size' is not given or\nnegative, until EOF or if the read call would block in\nnon-blocking mode.\n\n-- Method: read1 (size=-1, /)\n\nRead and return up to 'size' bytes with only one call on the\nraw stream.  If at least one byte is buffered, only buffered\nbytes are returned.  Otherwise, one raw stream read call is\nmade.\n\nChanged in version 3.7: The 'size' argument is now optional.\n\n-- Class: io.BufferedWriter (raw, buffersize=DEFAULTBUFFERSIZE)\n\nA buffered binary stream providing higher-level access to a\nwriteable, non seekable *note RawIOBase: f40. raw binary stream.\nIt inherits from *note BufferedIOBase: 460.\n\nWhen writing to this object, data is normally placed into an\ninternal buffer.  The buffer will be written out to the underlying\n*note RawIOBase: f40. object under various conditions, including:\n\n* when the buffer gets too small for all pending data;\n\n* when *note flush(): 2921. is called;\n\n* when a *note seek(): 1105. is requested (for *note\nBufferedRandom: 1e86. objects);\n\n* when the *note BufferedWriter: 1e85. object is closed or\ndestroyed.\n\nThe constructor creates a *note BufferedWriter: 1e85. for the given\nwriteable 'raw' stream.  If the 'buffersize' is not given, it\ndefaults to *note DEFAULTBUFFERSIZE: 13eb.\n\n*note BufferedWriter: 1e85. provides or overrides these methods in\naddition to those from *note BufferedIOBase: 460. and *note IOBase:\n823.:\n\n-- Method: flush ()\n\nForce bytes held in the buffer into the raw stream.  A *note\nBlockingIOError: ed0. should be raised if the raw stream\nblocks.\n\n-- Method: write (b, /)\n\nWrite the *note bytes-like object: b82, 'b', and return the\nnumber of bytes written.  When in non-blocking mode, a *note\nBlockingIOError: ed0. is raised if the buffer needs to be\nwritten out but the raw stream blocks.\n\n-- Class: io.BufferedRandom (raw, buffersize=DEFAULTBUFFERSIZE)\n\nA buffered binary stream providing higher-level access to a\nseekable *note RawIOBase: f40. raw binary stream.  It inherits from\n*note BufferedReader: 1082. and *note BufferedWriter: 1e85.\n\nThe constructor creates a reader and writer for a seekable raw\nstream, given in the first argument.  If the 'buffersize' is\nomitted it defaults to *note DEFAULTBUFFERSIZE: 13eb.\n\n*note BufferedRandom: 1e86. is capable of anything *note\nBufferedReader: 1082. or *note BufferedWriter: 1e85. can do.  In\naddition, *note seek(): 1105. and *note tell(): 26a2. are\nguaranteed to be implemented.\n\n-- Class: io.BufferedRWPair (reader, writer,\nbuffersize=DEFAULTBUFFERSIZE, /)\n\nA buffered binary stream providing higher-level access to two non\nseekable *note RawIOBase: f40. raw binary streams--one readable, the\nother writeable.  It inherits from *note BufferedIOBase: 460.\n\n'reader' and 'writer' are *note RawIOBase: f40. objects that are\nreadable and writeable respectively.  If the 'buffersize' is\nomitted it defaults to *note DEFAULTBUFFERSIZE: 13eb.\n\n*note BufferedRWPair: 290f. implements all of *note BufferedIOBase:\n460.'s methods except for *note detach(): 266e, which raises *note\nUnsupportedOperation: 1704.\n\nWarning: *note BufferedRWPair: 290f. does not attempt to\nsynchronize accesses to its underlying raw streams.  You\nshould not pass it the same object as reader and writer; use\n*note BufferedRandom: 1e86. instead.\n\nFile: python3.12.info,  Node: Text I/O<2>,  Prev: Buffered Streams,  Up: Class hierarchy\n\n5.16.2.12 Text I/O\n..................\n\n-- Class: io.TextIOBase\n\nBase class for text streams.  This class provides a character and\nline based interface to stream I/O. It inherits from *note IOBase:\n823.\n\n*note TextIOBase: 461. provides or overrides these data attributes\nand methods in addition to those from *note IOBase: 823.:\n\n-- Attribute: encoding\n\nThe name of the encoding used to decode the stream's bytes\ninto strings, and to encode strings into bytes.\n\n-- Attribute: errors\n\nThe error setting of the decoder or encoder.\n\n-- Attribute: newlines\n\nA string, a tuple of strings, or 'None', indicating the\nnewlines translated so far.  Depending on the implementation\nand the initial constructor flags, this may not be available.\n\n-- Attribute: buffer\n\nThe underlying binary buffer (a *note BufferedIOBase: 460.\ninstance) that *note TextIOBase: 461. deals with.  This is not\npart of the *note TextIOBase: 461. API and may not exist in\nsome implementations.\n\n-- Method: detach ()\n\nSeparate the underlying binary buffer from the *note\nTextIOBase: 461. and return it.\n\nAfter the underlying buffer has been detached, the *note\nTextIOBase: 461. is in an unusable state.\n\nSome *note TextIOBase: 461. implementations, like *note\nStringIO: d94, may not have the concept of an underlying\nbuffer and calling this method will raise *note\nUnsupportedOperation: 1704.\n\nNew in version 3.1.\n\n-- Method: read (size=-1, /)\n\nRead and return at most 'size' characters from the stream as a\nsingle *note str: 157.  If 'size' is negative or 'None', reads\nuntil EOF.\n\n-- Method: readline (size=-1, /)\n\nRead until newline or EOF and return a single *note str: 157.\nIf the stream is already at EOF, an empty string is returned.\n\nIf 'size' is specified, at most 'size' characters will be\nread.\n\n-- Method: seek (offset, whence=SEEKSET, /)\n\nChange the stream position to the given 'offset'.  Behaviour\ndepends on the 'whence' parameter.  The default value for\n'whence' is 'SEEKSET'.\n\n* 'SEEKSET' or '0': seek from the start of the stream (the\ndefault); 'offset' must either be a number returned by\n*note TextIOBase.tell(): 2928, or zero.  Any other\n'offset' value produces undefined behaviour.\n\n* 'SEEKCUR' or '1': \"seek\" to the current position;\n'offset' must be zero, which is a no-operation (all other\nvalues are unsupported).\n\n* 'SEEKEND' or '2': seek to the end of the stream;\n'offset' must be zero (all other values are unsupported).\n\nReturn the new absolute position as an opaque number.\n\nNew in version 3.1: The 'SEEK*' constants.\n\n-- Method: tell ()\n\nReturn the current stream position as an opaque number.  The\nnumber does not usually represent a number of bytes in the\nunderlying binary storage.\n\n-- Method: write (s, /)\n\nWrite the string 's' to the stream and return the number of\ncharacters written.\n\n-- Class: io.TextIOWrapper (buffer, encoding=None, errors=None,\nnewline=None, linebuffering=False, writethrough=False)\n\nA buffered text stream providing higher-level access to a *note\nBufferedIOBase: 460. buffered binary stream.  It inherits from\n*note TextIOBase: 461.\n\n'encoding' gives the name of the encoding that the stream will be\ndecoded or encoded with.  It defaults to *note\nlocale.getencoding(): 41f.  'encoding=\"locale\"' can be used to\nspecify the current locale's encoding explicitly.  See *note Text\nEncoding: 5b0. for more information.\n\n'errors' is an optional string that specifies how encoding and\ndecoding errors are to be handled.  Pass ''strict'' to raise a\n*note ValueError: 183. exception if there is an encoding error (the\ndefault of 'None' has the same effect), or pass ''ignore'' to\nignore errors.  (Note that ignoring encoding errors can lead to\ndata loss.)  ''replace'' causes a replacement marker (such as\n''?'') to be inserted where there is malformed data.\n''backslashreplace'' causes malformed data to be replaced by a\nbackslashed escape sequence.  When writing, ''xmlcharrefreplace''\n(replace with the appropriate XML character reference) or\n''namereplace'' (replace with '\\N{...}' escape sequences) can be\nused.  Any other error handling name that has been registered with\n*note codecs.registererror(): 12f0. is also valid.\n\n'newline' controls how line endings are handled.  It can be 'None',\n'''', ''\\n'', ''\\r'', and ''\\r\\n''.  It works as follows:\n\n* When reading input from the stream, if 'newline' is 'None',\n*note universal newlines: b90. mode is enabled.  Lines in the\ninput can end in ''\\n'', ''\\r'', or ''\\r\\n'', and these are\ntranslated into ''\\n'' before being returned to the caller.\nIf 'newline' is '''', universal newlines mode is enabled, but\nline endings are returned to the caller untranslated.  If\n'newline' has any of the other legal values, input lines are\nonly terminated by the given string, and the line ending is\nreturned to the caller untranslated.\n\n* When writing output to the stream, if 'newline' is 'None', any\n''\\n'' characters written are translated to the system default\nline separator, *note os.linesep: 1e84.  If 'newline' is ''''\nor ''\\n'', no translation takes place.  If 'newline' is any of\nthe other legal values, any ''\\n'' characters written are\ntranslated to the given string.\n\nIf 'linebuffering' is 'True', *note flush(): 2911. is implied when\na call to write contains a newline character or a carriage return.\n\nIf 'writethrough' is 'True', calls to *note write(): b2a. are\nguaranteed not to be buffered: any data written on the *note\nTextIOWrapper: b8f. object is immediately handled to its underlying\nbinary 'buffer'.\n\nChanged in version 3.3: The 'writethrough' argument has been\nadded.\n\nChanged in version 3.3: The default 'encoding' is now\n'locale.getpreferredencoding(False)' instead of\n'locale.getpreferredencoding()'.  Don't change temporary the locale\nencoding using *note locale.setlocale(): 500, use the current\nlocale encoding instead of the user preferred encoding.\n\nChanged in version 3.10: The 'encoding' argument now supports the\n'\"locale\"' dummy encoding name.\n\n*note TextIOWrapper: b8f. provides these data attributes and\nmethods in addition to those from *note TextIOBase: 461. and *note\nIOBase: 823.:\n\n-- Attribute: linebuffering\n\nWhether line buffering is enabled.\n\n-- Attribute: writethrough\n\nWhether writes are passed immediately to the underlying binary\nbuffer.\n\nNew in version 3.7.\n\n-- Method: reconfigure (*, encoding=None, errors=None,\nnewline=None, linebuffering=None, writethrough=None)\n\nReconfigure this text stream using new settings for\n'encoding', 'errors', 'newline', 'linebuffering' and\n'writethrough'.\n\nParameters not specified keep current settings, except\n'errors='strict'' is used when 'encoding' is specified but\n'errors' is not specified.\n\nIt is not possible to change the encoding or newline if some\ndata has already been read from the stream.  On the other\nhand, changing encoding after write is possible.\n\nThis method does an implicit stream flush before setting the\nnew parameters.\n\nNew in version 3.7.\n\nChanged in version 3.11: The method supports\n'encoding=\"locale\"' option.\n\n-- Method: seek (cookie, whence=os.SEEKSET, /)\n\nSet the stream position.  Return the new stream position as an\n*note int: 17e.\n\nFour operations are supported, given by the following argument\ncombinations:\n\n* 'seek(0, SEEKSET)': Rewind to the start of the stream.\n\n* 'seek(cookie, SEEKSET)': Restore a previous position;\n'cookie' 'must be' a number returned by *note tell():\n292c.\n\n* 'seek(0, SEEKEND)': Fast-forward to the end of the\nstream.\n\n* 'seek(0, SEEKCUR)': Leave the current stream position\nunchanged.\n\nAny other argument combinations are invalid, and may raise\nexceptions.\n\nSee also\n........\n\n*note os.SEEKSET: 1106, *note os.SEEKCUR: 1107, and *note\nos.SEEKEND: 1108.\n\n-- Method: tell ()\n\nReturn the stream position as an opaque number.  The return\nvalue of 'tell()' can be given as input to *note seek(): 292b,\nto restore a previous stream position.\n\n-- Class: io.StringIO (initialvalue='', newline='\\n')\n\nA text stream using an in-memory text buffer.  It inherits from\n*note TextIOBase: 461.\n\nThe text buffer is discarded when the *note close(): 17a4. method\nis called.\n\nThe initial value of the buffer can be set by providing\n'initialvalue'.  If newline translation is enabled, newlines will\nbe encoded as if by *note write(): 19f9.  The stream is positioned\nat the start of the buffer which emulates opening an existing file\nin a 'w+' mode, making it ready for an immediate write from the\nbeginning or for a write that would overwrite the initial value.\nTo emulate opening a file in an 'a+' mode ready for appending, use\n'f.seek(0, io.SEEKEND)' to reposition the stream at the end of the\nbuffer.\n\nThe 'newline' argument works like that of *note TextIOWrapper: b8f,\nexcept that when writing output to the stream, if 'newline' is\n'None', newlines are written as '\\n' on all platforms.\n\n*note StringIO: d94. provides this method in addition to those from\n*note TextIOBase: 461. and *note IOBase: 823.:\n\n-- Method: getvalue ()\n\nReturn a *note str: 157. containing the entire contents of the\nbuffer.  Newlines are decoded as if by *note read(): 1a0a,\nalthough the stream position is not changed.\n\nExample usage:\n\nimport io\n\noutput = io.StringIO()\noutput.write('First line.\\n')\nprint('Second line.', file=output)\n\n# Retrieve file contents -- this will be\n# 'First line.\\nSecond line.\\n'\ncontents = output.getvalue()\n\n# Close object and discard memory buffer --\n# .getvalue() will now raise an exception.\noutput.close()\n\n-- Class: io.IncrementalNewlineDecoder\n\nA helper codec that decodes newlines for *note universal newlines:\nb90. mode.  It inherits from *note codecs.IncrementalDecoder: 20d8.\n\nFile: python3.12.info,  Node: Performance<3>,  Prev: Class hierarchy,  Up: io -- Core tools for working with streams\n\n5.16.2.13 Performance\n.....................\n",
            "subsections": []
        },
        "This section discusses the performance of the provided concrete I/O": {
            "content": "implementations.\n\n* Menu:\n\n* Binary I/O: Binary I/O<2>.\n* Text I/O: Text I/O<3>.\n* Multi-threading: Multi-threading<3>.\n* Reentrancy::\n\nFile: python3.12.info,  Node: Binary I/O<2>,  Next: Text I/O<3>,  Up: Performance<3>\n\n5.16.2.14 Binary I/O\n....................\n",
            "subsections": []
        },
        "By reading and writing only large chunks of data even when the user asks": {
            "content": "for a single byte, buffered I/O hides any inefficiency in calling and\nexecuting the operating system's unbuffered I/O routines.  The gain\ndepends on the OS and the kind of I/O which is performed.  For example,\non some modern OSes such as Linux, unbuffered disk I/O can be as fast as\nbuffered I/O. The bottom line, however, is that buffered I/O offers\npredictable performance regardless of the platform and the backing\ndevice.  Therefore, it is almost always preferable to use buffered I/O\nrather than unbuffered I/O for binary data.\n\nFile: python3.12.info,  Node: Text I/O<3>,  Next: Multi-threading<3>,  Prev: Binary I/O<2>,  Up: Performance<3>\n\n5.16.2.15 Text I/O\n..................\n",
            "subsections": []
        },
        "Text I/O over a binary storage (such as a file) is significantly slower": {
            "content": "than binary I/O over the same storage, because it requires conversions\nbetween unicode and binary data using a character codec.  This can\nbecome noticeable handling huge amounts of text data like large log\nfiles.  Also, *note tell(): 2928. and *note seek(): 2927. are both quite\nslow due to the reconstruction algorithm used.\n\n*note StringIO: d94, however, is a native in-memory unicode container\nand will exhibit similar speed to *note BytesIO: d08.\n\nFile: python3.12.info,  Node: Multi-threading<3>,  Next: Reentrancy,  Prev: Text I/O<3>,  Up: Performance<3>\n\n5.16.2.16 Multi-threading\n.........................\n\n*note FileIO: 1186. objects are thread-safe to the extent that the\noperating system calls (such as 'read(2)' under Unix) they wrap are\nthread-safe too.\n\nBinary buffered objects (instances of *note BufferedReader: 1082, *note\nBufferedWriter: 1e85, *note BufferedRandom: 1e86. and *note",
            "subsections": []
        },
        "BufferedRWPair: 290f.) protect their internal structures using a lock;": {
            "content": "it is therefore safe to call them from multiple threads at once.\n\n*note TextIOWrapper: b8f. objects are not thread-safe.\n\nFile: python3.12.info,  Node: Reentrancy,  Prev: Multi-threading<3>,  Up: Performance<3>\n\n5.16.2.17 Reentrancy\n....................\n\nBinary buffered objects (instances of *note BufferedReader: 1082, *note\nBufferedWriter: 1e85, *note BufferedRandom: 1e86. and *note",
            "subsections": []
        },
        "BufferedRWPair: 290f.) are not reentrant.  While reentrant calls will": {
            "content": "not happen in normal situations, they can arise from doing I/O in a\n*note signal: c1. handler.  If a thread tries to re-enter a buffered\nobject which it is already accessing, a *note RuntimeError: 17a. is\nraised.  Note this doesn't prohibit a different thread from entering the\nbuffered object.\n\nThe above implicitly extends to text files, since the *note open(): 26e.\nfunction will wrap a buffered object inside a *note TextIOWrapper: b8f.\nThis includes standard streams and therefore affects the built-in *note\nprint(): de5. function as well.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: time -- Time access and conversions,  Next: argparse -- Parser for command-line options arguments and sub-commands,  Prev: io -- Core tools for working with streams,  Up: Generic Operating System Services": {
            "content": "",
            "subsections": []
        },
        "This module provides various time-related functions.  For related": {
            "content": "functionality, see also the *note datetime: 2e. and *note calendar: 12.\nmodules.\n",
            "subsections": []
        },
        "Although this module is always available, not all functions are": {
            "content": "available on all platforms.  Most of the functions defined in this\nmodule call platform C library functions with the same name.  It may\nsometimes be helpful to consult the platform documentation, because the\nsemantics of these functions varies among platforms.\n\nAn explanation of some terminology and conventions is in order.\n\n* The 'epoch' is the point where the time starts, the return value of\n'time.gmtime(0)'.  It is January 1, 1970, 00:00:00 (UTC) on all\nplatforms.\n\n* The term 'seconds since the epoch' refers to the total number of\nelapsed seconds since the epoch, typically excluding leap\nseconds(1).  Leap seconds are excluded from this total on all\nPOSIX-compliant platforms.\n\n* The functions in this module may not handle dates and times before\nthe *note epoch: 2716. or far in the future.  The cut-off point in\nthe future is determined by the C library; for 32-bit systems, it\nis typically in 2038.\n\n* Function *note strptime(): 1283. can parse 2-digit years when given\n'%y' format code.  When 2-digit years are parsed, they are\nconverted according to the POSIX and ISO C standards: values 69-99\nare mapped to 1969-1999, and values 0-68 are mapped to 2000-2068.\n\n* UTC is Coordinated Universal Time (formerly known as Greenwich Mean\nTime, or GMT). The acronym UTC is not a mistake but a compromise\nbetween English and French.\n\n* DST is Daylight Saving Time, an adjustment of the timezone by\n(usually) one hour during part of the year.  DST rules are magic\n(determined by local law) and can change from year to year.  The C\nlibrary has a table containing the local rules (often it is read\nfrom a system file for flexibility) and is the only source of True\nWisdom in this respect.\n\n* The precision of the various real-time functions may be less than\nsuggested by the units in which their value or argument is\nexpressed.  E.g.  on most Unix systems, the clock \"ticks\" only 50\nor 100 times a second.\n\n* On the other hand, the precision of *note time(): 918. and *note\nsleep(): 469. is better than their Unix equivalents: times are\nexpressed as floating point numbers, *note time(): 918. returns the\nmost accurate time available (using Unix 'gettimeofday()' where\navailable), and *note sleep(): 469. will accept a time with a\nnonzero fraction (Unix 'select()' is used to implement this, where\navailable).\n\n* The time value as returned by *note gmtime(): 1034, *note\nlocaltime(): 1353, and *note strptime(): 1283, and accepted by\n*note asctime(): 105b, *note mktime(): 105c. and *note strftime():\n105d, is a sequence of 9 integers.  The return values of *note\ngmtime(): 1034, *note localtime(): 1353, and *note strptime():\n1283. also offer attribute names for individual fields.\n\nSee *note structtime: b3a. for a description of these objects.\n\nChanged in version 3.3: The *note structtime: b3a. type was\nextended to provide the *note tmgmtoff: 2935. and *note tmzone:\n2936. attributes when platform supports corresponding 'struct tm'\nmembers.\n\nChanged in version 3.6: The *note structtime: b3a. attributes\n*note tmgmtoff: 2935. and *note tmzone: 2936. are now available\non all platforms.\n\n* Use the following functions to convert between time\nrepresentations:\n\nFrom                          To                            Use\n\n------------------------------------------------------------------------------------------\n\nseconds since the epoch       *note structtime: b3a. in    *note gmtime(): 1034.\nUTC\n\n\nseconds since the epoch       *note structtime: b3a. in    *note localtime(): 1353.\nlocal time\n\n\n*note structtime: b3a. in    seconds since the epoch       *note calendar.timegm(): 21e0.\nUTC\n\n*note structtime: b3a. in    seconds since the epoch       *note mktime(): 105c.\nlocal time\n\n* Menu:\n\n* Functions: Functions<5>.\n* Clock ID Constants::\n* Timezone Constants::\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Leapsecond\n\nFile: python3.12.info,  Node: Functions<5>,  Next: Clock ID Constants,  Up: time -- Time access and conversions\n\n5.16.3.1 Functions\n..................\n\n-- Function: time.asctime ([t])\n\nConvert a tuple or *note structtime: b3a. representing a time as\nreturned by *note gmtime(): 1034. or *note localtime(): 1353. to a\nstring of the following form: ''Sun Jun 20 23:21:05 1993''.  The\nday field is two characters long and is space padded if the day is\na single digit, e.g.: ''Wed Jun 9 04:26:40 1993''.\n\nIf 't' is not provided, the current time as returned by *note\nlocaltime(): 1353. is used.  Locale information is not used by\n*note asctime(): 105b.\n\nNote: Unlike the C function of the same name, *note asctime():\n105b. does not add a trailing newline.\n\n-- Function: time.pthreadgetcpuclockid (threadid)\n\nReturn the 'clkid' of the thread-specific CPU-time clock for the\nspecified 'threadid'.\n\nUse *note threading.getident(): fcf. or the *note ident: 2939.\nattribute of *note threading.Thread: 76c. objects to get a suitable\nvalue for 'threadid'.\n\nWarning: Passing an invalid or expired 'threadid' may result\nin undefined behavior, such as segmentation fault.\n\n*note Availability: 1ad3.: Unix\n\nSee the man page for 'pthreadgetcpuclockid(3)' for further\ninformation.\n\nNew in version 3.7.\n\n-- Function: time.clockgetres (clkid)\n\nReturn the resolution (precision) of the specified clock 'clkid'.\nRefer to *note Clock ID Constants: 293a. for a list of accepted\nvalues for 'clkid'.\n\n*note Availability: 1ad3.: Unix.\n\nNew in version 3.3.\n\n-- Function: time.clockgettime (clkid) -> float\n\nReturn the time of the specified clock 'clkid'.  Refer to *note\nClock ID Constants: 293a. for a list of accepted values for\n'clkid'.\n\nUse *note clockgettimens(): 919. to avoid the precision loss\ncaused by the *note float: 4b7. type.\n\n*note Availability: 1ad3.: Unix.\n\nNew in version 3.3.\n\n-- Function: time.clockgettimens (clkid) -> int\n\nSimilar to *note clockgettime(): fd3. but return time as\nnanoseconds.\n\n*note Availability: 1ad3.: Unix.\n\nNew in version 3.7.\n\n-- Function: time.clocksettime (clkid, time: float)\n\nSet the time of the specified clock 'clkid'.  Currently, *note\nCLOCKREALTIME: 466. is the only accepted value for 'clkid'.\n\nUse *note clocksettimens(): 91a. to avoid the precision loss\ncaused by the *note float: 4b7. type.\n\n*note Availability: 1ad3.: Unix.\n\nNew in version 3.3.\n\n-- Function: time.clocksettimens (clkid, time: int)\n\nSimilar to *note clocksettime(): fd4. but set time with\nnanoseconds.\n\n*note Availability: 1ad3.: Unix.\n\nNew in version 3.7.\n\n-- Function: time.ctime ([secs])\n\nConvert a time expressed in seconds since the *note epoch: 2716. to\na string of a form: ''Sun Jun 20 23:21:05 1993'' representing local\ntime.  The day field is two characters long and is space padded if\nthe day is a single digit, e.g.: ''Wed Jun 9 04:26:40 1993''.\n\nIf 'secs' is not provided or *note None: 43f, the current time as\nreturned by *note time(): 918. is used.  'ctime(secs)' is\nequivalent to 'asctime(localtime(secs))'.  Locale information is\nnot used by *note ctime(): 2160.\n\n-- Function: time.getclockinfo (name)\n\nGet information on the specified clock as a namespace object.\nSupported clock names and the corresponding functions to read their\nvalue are:\n\n* ''monotonic'': *note time.monotonic(): ce1.\n\n* ''perfcounter'': *note time.perfcounter(): 8b6.\n\n* ''processtime'': *note time.processtime(): 8b7.\n\n* ''threadtime'': *note time.threadtime(): 754.\n\n* ''time'': *note time.time(): 918.\n\nThe result has the following attributes:\n\n- 'adjustable': 'True' if the clock can be changed automatically\n(e.g.  by a NTP daemon) or manually by the system\nadministrator, 'False' otherwise\n\n- 'implementation': The name of the underlying C function used\nto get the clock value.  Refer to *note Clock ID Constants:\n293a. for possible values.\n\n- 'monotonic': 'True' if the clock cannot go backward, 'False'\notherwise\n\n- 'resolution': The resolution of the clock in seconds (*note\nfloat: 4b7.)\n\nNew in version 3.3.\n\n-- Function: time.gmtime ([secs])\n\nConvert a time expressed in seconds since the *note epoch: 2716. to\na *note structtime: b3a. in UTC in which the dst flag is always\nzero.  If 'secs' is not provided or *note None: 43f, the current\ntime as returned by *note time(): 918. is used.  Fractions of a\nsecond are ignored.  See above for a description of the *note\nstructtime: b3a. object.  See *note calendar.timegm(): 21e0. for\nthe inverse of this function.\n\n-- Function: time.localtime ([secs])\n\nLike *note gmtime(): 1034. but converts to local time.  If 'secs'\nis not provided or *note None: 43f, the current time as returned by\n*note time(): 918. is used.  The dst flag is set to '1' when DST\napplies to the given time.\n\n*note localtime(): 1353. may raise *note OverflowError: 68d, if the\ntimestamp is outside the range of values supported by the platform\nC 'localtime()' or 'gmtime()' functions, and *note OSError: 613. on\n'localtime()' or 'gmtime()' failure.  It's common for this to be\nrestricted to years between 1970 and 2038.\n\n-- Function: time.mktime (t)\n\nThis is the inverse function of *note localtime(): 1353.  Its\nargument is the *note structtime: b3a. or full 9-tuple (since the\ndst flag is needed; use '-1' as the dst flag if it is unknown)\nwhich expresses the time in 'local' time, not UTC. It returns a\nfloating point number, for compatibility with *note time(): 918.\nIf the input value cannot be represented as a valid time, either\n*note OverflowError: 68d. or *note ValueError: 183. will be raised\n(which depends on whether the invalid value is caught by Python or\nthe underlying C libraries).  The earliest date for which it can\ngenerate a time is platform-dependent.\n\n-- Function: time.monotonic () -> float\n\nReturn the value (in fractional seconds) of a monotonic clock, i.e.\na clock that cannot go backwards.  The clock is not affected by\nsystem clock updates.  The reference point of the returned value is\nundefined, so that only the difference between the results of two\ncalls is valid.\n\nUse *note monotonicns(): 91b. to avoid the precision loss caused\nby the *note float: 4b7. type.\n\nNew in version 3.3.\n\nChanged in version 3.5: The function is now always available and\nalways system-wide.\n\nChanged in version 3.10: On macOS, the function is now system-wide.\n\n-- Function: time.monotonicns () -> int\n\nSimilar to *note monotonic(): ce1, but return time as nanoseconds.\n\nNew in version 3.7.\n\n-- Function: time.perfcounter () -> float\n\nReturn the value (in fractional seconds) of a performance counter,\ni.e.  a clock with the highest available resolution to measure a\nshort duration.  It does include time elapsed during sleep and is\nsystem-wide.  The reference point of the returned value is\nundefined, so that only the difference between the results of two\ncalls is valid.\n\nUse *note perfcounterns(): 91c. to avoid the precision loss\ncaused by the *note float: 4b7. type.\n\nNew in version 3.3.\n\nChanged in version 3.10: On Windows, the function is now\nsystem-wide.\n\n-- Function: time.perfcounterns () -> int\n\nSimilar to *note perfcounter(): 8b6, but return time as\nnanoseconds.\n\nNew in version 3.7.\n\n-- Function: time.processtime () -> float\n\nReturn the value (in fractional seconds) of the sum of the system\nand user CPU time of the current process.  It does not include time\nelapsed during sleep.  It is process-wide by definition.  The\nreference point of the returned value is undefined, so that only\nthe difference between the results of two calls is valid.\n\nUse *note processtimens(): 91d. to avoid the precision loss\ncaused by the *note float: 4b7. type.\n\nNew in version 3.3.\n\n-- Function: time.processtimens () -> int\n\nSimilar to *note processtime(): 8b7. but return time as\nnanoseconds.\n\nNew in version 3.7.\n\n-- Function: time.sleep (secs)\n\nSuspend execution of the calling thread for the given number of\nseconds.  The argument may be a floating point number to indicate a\nmore precise sleep time.\n\nIf the sleep is interrupted by a signal and no exception is raised\nby the signal handler, the sleep is restarted with a recomputed\ntimeout.\n\nThe suspension time may be longer than requested by an arbitrary\namount, because of the scheduling of other activity in the system.\n\nOn Windows, if 'secs' is zero, the thread relinquishes the\nremainder of its time slice to any other thread that is ready to\nrun.  If there are no other threads ready to run, the function\nreturns immediately, and the thread continues execution.  On\nWindows 8.1 and newer the implementation uses a high-resolution\ntimer(1) which provides resolution of 100 nanoseconds.  If 'secs'\nis zero, 'Sleep(0)' is used.\n\nUnix implementation:\n\n* Use 'clocknanosleep()' if available (resolution: 1\nnanosecond);\n\n* Or use 'nanosleep()' if available (resolution: 1 nanosecond);\n\n* Or use 'select()' (resolution: 1 microsecond).\n\nChanged in version 3.5: The function now sleeps at least 'secs'\neven if the sleep is interrupted by a signal, except if the signal\nhandler raises an exception (see PEP 475(2) for the rationale).\n\nChanged in version 3.11: On Unix, the 'clocknanosleep()' and\n'nanosleep()' functions are now used if available.  On Windows, a\nwaitable timer is now used.\n\n-- Function: time.strftime (format[, t])\n\nConvert a tuple or *note structtime: b3a. representing a time as\nreturned by *note gmtime(): 1034. or *note localtime(): 1353. to a\nstring as specified by the 'format' argument.  If 't' is not\nprovided, the current time as returned by *note localtime(): 1353.\nis used.  'format' must be a string.  *note ValueError: 183. is\nraised if any field in 't' is outside of the allowed range.\n\n0 is a legal argument for any position in the time tuple; if it is\nnormally illegal the value is forced to a correct one.\n\nThe following directives can be embedded in the 'format' string.\nThey are shown without the optional field width and precision\nspecification, and are replaced by the indicated characters in the\n*note strftime(): 105d. result:\n\nDirective       Meaning                                              Notes\n\n---------------------------------------------------------------------------------\n\n'%a'            Locale's abbreviated weekday name.\n\n\n'%A'            Locale's full weekday name.\n\n\n'%b'            Locale's abbreviated month name.\n\n\n'%B'            Locale's full month name.\n\n\n'%c'            Locale's appropriate date and time representation.\n\n\n'%d'            Day of the month as a decimal number [01,31].\n\n\n'%f'            Microseconds as a decimal number                     (1)\n\n[000000,999999].\n\n\n'%H'            Hour (24-hour clock) as a decimal number [00,23].\n\n\n'%I'            Hour (12-hour clock) as a decimal number [01,12].\n\n\n'%j'            Day of the year as a decimal number [001,366].\n\n\n'%m'            Month as a decimal number [01,12].\n\n\n'%M'            Minute as a decimal number [00,59].\n\n\n'%p'            Locale's equivalent of either AM or PM.              (2)\n\n\n'%S'            Second as a decimal number [00,61].                  (3)\n\n\n'%U'            Week number of the year (Sunday as the first day     (4)\nof the week) as a decimal number [00,53].  All\ndays in a new year preceding the first Sunday are\nconsidered to be in week 0.\n\n\n'%w'            Weekday as a decimal number [0(Sunday),6].\n\n\n'%W'            Week number of the year (Monday as the first day     (4)\nof the week) as a decimal number [00,53].  All\ndays in a new year preceding the first Monday are\nconsidered to be in week 0.\n\n\n'%x'            Locale's appropriate date representation.\n\n\n'%X'            Locale's appropriate time representation.\n\n\n'%y'            Year without century as a decimal number [00,99].\n\n\n'%Y'            Year with century as a decimal number.\n\n\n'%z'            Time zone offset indicating a positive or negative\ntime difference from UTC/GMT of the form +HHMM or\n-HHMM, where H represents decimal hour digits and\nM represents decimal minute digits [-23:59,\n+23:59].  (3)\n\n\n'%Z'            Time zone name (no characters if no time zone\nexists).  Deprecated.  (4)\n\n\n'%%'            A literal ''%'' character.\n\n\nNotes:\n\n1. The '%f' format directive only applies to *note strptime():\n1283, not to *note strftime(): 105d.  However, see also *note\ndatetime.datetime.strptime(): 146c. and *note\ndatetime.datetime.strftime(): add. where the '%f' format\ndirective *note applies to microseconds: 2131.\n\n2. When used with the *note strptime(): 1283. function, the '%p'\ndirective only affects the output hour field if the '%I'\ndirective is used to parse the hour.\n\n3. The range really is '0' to '61'; value '60' is valid in\ntimestamps representing leap seconds(5) and value '61' is\nsupported for historical reasons.\n\n4. When used with the *note strptime(): 1283. function, '%U' and\n'%W' are only used in calculations when the day of the week\nand the year are specified.\n\nHere is an example, a format for dates compatible with that\nspecified in the RFC 2822(6) Internet email standard.  (7)\n\n>>> from time import gmtime, strftime\n>>> strftime(\"%a, %d %b %Y %H:%M:%S +0000\", gmtime())\n'Thu, 28 Jun 2001 14:17:15 +0000'\n\nAdditional directives may be supported on certain platforms, but\nonly the ones listed here have a meaning standardized by ANSI C. To\nsee the full set of format codes supported on your platform,\nconsult the 'strftime(3)' documentation.\n\nOn some platforms, an optional field width and precision\nspecification can immediately follow the initial ''%'' of a\ndirective in the following order; this is also not portable.  The\nfield width is normally 2 except for '%j' where it is 3.\n\n-- Function: time.strptime (string[, format])\n\nParse a string representing a time according to a format.  The\nreturn value is a *note structtime: b3a. as returned by *note\ngmtime(): 1034. or *note localtime(): 1353.\n\nThe 'format' parameter uses the same directives as those used by\n*note strftime(): 105d.; it defaults to '\"%a %b %d %H:%M:%S %Y\"'\nwhich matches the formatting returned by *note ctime(): 2160.  If\n'string' cannot be parsed according to 'format', or if it has\nexcess data after parsing, *note ValueError: 183. is raised.  The\ndefault values used to fill in any missing data when more accurate\nvalues cannot be inferred are '(1900, 1, 1, 0, 0, 0, 0, 1, -1)'.\nBoth 'string' and 'format' must be strings.\n\nFor example:\n\n>>> import time\n>>> time.strptime(\"30 Nov 00\", \"%d %b %y\")\ntime.structtime(tmyear=2000, tmmon=11, tmmday=30, tmhour=0, tmmin=0,\ntmsec=0, tmwday=3, tmyday=335, tmisdst=-1)\n\nSupport for the '%Z' directive is based on the values contained in\n'tzname' and whether 'daylight' is true.  Because of this, it is\nplatform-specific except for recognizing UTC and GMT which are\nalways known (and are considered to be non-daylight savings\ntimezones).\n\nOnly the directives specified in the documentation are supported.\nBecause 'strftime()' is implemented per platform it can sometimes\noffer more directives than those listed.  But 'strptime()' is\nindependent of any platform and thus does not necessarily support\nall directives available that are not documented as supported.\n\n-- Class: time.structtime\n\nThe type of the time value sequence returned by *note gmtime():\n1034, *note localtime(): 1353, and *note strptime(): 1283.  It is\nan object with a *note named tuple: 417. interface: values can be\naccessed by index and by attribute name.  The following values are\npresent:\n\nIndex                                 Attribute                             Values\n\n\n0                                      -- Attribute: tmyear                (for example, 1993)\n\n\n1                                      -- Attribute: tmmon                 range [1, 12]\n\n\n2                                      -- Attribute: tmday                 range [1, 31]\n\n\n3                                      -- Attribute: tmhour                range [0, 23]\n\n\n4                                      -- Attribute: tmmin                 range [0, 59]\n\n\n5                                      -- Attribute: tmsec                 range [0, 61]; see\n*note Note (2): 293b. in\n*note strftime(): 105d.\n\n\n6                                      -- Attribute: tmwday                range [0, 6]; Monday is 0\n\n\n7                                      -- Attribute: tmyday                range [1, 366]\n\n\n8                                      -- Attribute: tmisdst               0, 1 or -1; see below\n\n\nN/A                                    -- Attribute: tmzone                abbreviation of timezone name\n\n\nN/A                                    -- Attribute: tmgmtoff              offset east of UTC in seconds\n\n\nNote that unlike the C structure, the month value is a range of [1,\n12], not [0, 11].\n\nIn calls to *note mktime(): 105c, *note tmisdst: 2171. may be set\nto 1 when daylight savings time is in effect, and 0 when it is not.\nA value of -1 indicates that this is not known, and will usually\nresult in the correct state being filled in.\n\nWhen a tuple with an incorrect length is passed to a function\nexpecting a *note structtime: b3a, or having elements of the wrong\ntype, a *note TypeError: 28e. is raised.\n\n-- Function: time.time () -> float\n\nReturn the time in seconds since the *note epoch: 2716. as a\nfloating point number.  The handling of leap seconds(8) is platform\ndependent.  On Windows and most Unix systems, the leap seconds are\nnot counted towards the time in seconds since the *note epoch:\n2716.  This is commonly referred to as Unix time(9).\n\nNote that even though the time is always returned as a floating\npoint number, not all systems provide time with a better precision\nthan 1 second.  While this function normally returns non-decreasing\nvalues, it can return a lower value than a previous call if the\nsystem clock has been set back between the two calls.\n\nThe number returned by *note time(): 918. may be converted into a\nmore common time format (i.e.  year, month, day, hour, etc...) in UTC\nby passing it to *note gmtime(): 1034. function or in local time by\npassing it to the *note localtime(): 1353. function.  In both cases\na *note structtime: b3a. object is returned, from which the\ncomponents of the calendar date may be accessed as attributes.\n\nUse *note timens(): 91e. to avoid the precision loss caused by the\n*note float: 4b7. type.\n\n-- Function: time.timens () -> int\n\nSimilar to *note time(): 918. but returns time as an integer number\nof nanoseconds since the *note epoch: 2716.\n\nNew in version 3.7.\n\n-- Function: time.threadtime () -> float\n\nReturn the value (in fractional seconds) of the sum of the system\nand user CPU time of the current thread.  It does not include time\nelapsed during sleep.  It is thread-specific by definition.  The\nreference point of the returned value is undefined, so that only\nthe difference between the results of two calls in the same thread\nis valid.\n\nUse *note threadtimens(): 9d4. to avoid the precision loss caused\nby the *note float: 4b7. type.\n\n*note Availability: 1ad3.: Linux, Unix, Windows.\n\nUnix systems supporting 'CLOCKTHREADCPUTIMEID'.\n\nNew in version 3.7.\n\n-- Function: time.threadtimens () -> int\n\nSimilar to *note threadtime(): 754. but return time as\nnanoseconds.\n\nNew in version 3.7.\n\n-- Function: time.tzset ()\n\nReset the time conversion rules used by the library routines.  The\nenvironment variable 'TZ' specifies how this is done.  It will also\nset the variables 'tzname' (from the 'TZ' environment variable),\n'timezone' (non-DST seconds West of UTC), 'altzone' (DST seconds\nwest of UTC) and 'daylight' (to 0 if this timezone does not have\nany daylight saving time rules, or to nonzero if there is a time,\npast, present or future when daylight saving time applies).\n\n*note Availability: 1ad3.: Unix.\n\nNote: Although in many cases, changing the 'TZ' environment\nvariable may affect the output of functions like *note\nlocaltime(): 1353. without calling *note tzset(): 2943, this\nbehavior should not be relied on.\n\nThe 'TZ' environment variable should contain no whitespace.\n\nThe standard format of the 'TZ' environment variable is (whitespace\nadded for clarity):\n\nstd offset [dst [offset [,start[/time], end[/time]]]]\n\nWhere the components are:\n\n'std' and 'dst'\n\nThree or more alphanumerics giving the timezone abbreviations.\nThese will be propagated into time.tzname\n\n'offset'\n\nThe offset has the form: '?? hh[:mm[:ss]]'.  This indicates the\nvalue added the local time to arrive at UTC. If preceded by a\n'-', the timezone is east of the Prime Meridian; otherwise, it\nis west.  If no offset follows dst, summer time is assumed to\nbe one hour ahead of standard time.\n\n'start[/time], end[/time]'\n\nIndicates when to change to and back from DST. The format of\nthe start and end dates are one of the following:\n\n'JN'\n\nThe Julian day 'n' (1 <= 'n' <= 365).  Leap days are not\ncounted, so in all years February 28 is day 59 and March\n1 is day 60.\n\n'N'\n\nThe zero-based Julian day (0 <= 'n' <= 365).  Leap days\nare counted, and it is possible to refer to February 29.\n\n'MM.N.D'\n\nThe 'd''th day (0 <= 'd' <= 6) of week 'n' of month 'm'\nof the year (1 <= 'n' <= 5, 1 <= 'm' <= 12, where week 5\nmeans \"the last 'd' day in month 'm'\" which may occur in\neither the fourth or the fifth week).  Week 1 is the\nfirst week in which the 'd''th day occurs.  Day zero is a\nSunday.\n\n'time' has the same format as 'offset' except that no leading\nsign ('-' or '+') is allowed.  The default, if time is not\ngiven, is 02:00:00.\n\n>>> os.environ['TZ'] = 'EST+05EDT,M4.1.0,M10.5.0'\n>>> time.tzset()\n>>> time.strftime('%X %x %Z')\n'02:07:36 05/08/03 EDT'\n>>> os.environ['TZ'] = 'AEST-10AEDT-11,M10.5.0,M3.5.0'\n>>> time.tzset()\n>>> time.strftime('%X %x %Z')\n'16:08:12 05/08/03 AEST'\n\nOn many Unix systems (including *BSD, Linux, Solaris, and Darwin),\nit is more convenient to use the system's zoneinfo ('tzfile(5)')\ndatabase to specify the timezone rules.  To do this, set the 'TZ'\nenvironment variable to the path of the required timezone datafile,\nrelative to the root of the systems 'zoneinfo' timezone database,\nusually located at '/usr/share/zoneinfo'.  For example,\n''US/Eastern'', ''Australia/Melbourne'', ''Egypt'' or\n''Europe/Amsterdam''.\n\n>>> os.environ['TZ'] = 'US/Eastern'\n>>> time.tzset()\n>>> time.tzname\n('EST', 'EDT')\n>>> os.environ['TZ'] = 'Egypt'\n>>> time.tzset()\n>>> time.tzname\n('EET', 'EEST')\n\n---------- Footnotes ----------\n\n(1)\nhttps://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/high-resolution-timers\n\n(2) https://peps.python.org/pep-0475/\n\n(3) The use of '%Z' is now deprecated, but the '%z' escape that\nexpands to the preferred hour/minute offset is not supported by all ANSI\nC libraries.  Also, a strict reading of the original 1982 RFC 822\n(https://datatracker.ietf.org/doc/html/rfc822.html) standard calls for a\ntwo-digit year ('%y' rather than '%Y'), but practice moved to 4-digit\nyears long before the year 2000.  After that, RFC 822\n(https://datatracker.ietf.org/doc/html/rfc822.html) became obsolete and\nthe 4-digit year has been first recommended by RFC 1123\n(https://datatracker.ietf.org/doc/html/rfc1123.html) and then mandated\nby RFC 2822 (https://datatracker.ietf.org/doc/html/rfc2822.html).\n\n(4) The use of '%Z' is now deprecated, but the '%z' escape that\nexpands to the preferred hour/minute offset is not supported by all ANSI\nC libraries.  Also, a strict reading of the original 1982 RFC 822\n(https://datatracker.ietf.org/doc/html/rfc822.html) standard calls for a\ntwo-digit year ('%y' rather than '%Y'), but practice moved to 4-digit\nyears long before the year 2000.  After that, RFC 822\n(https://datatracker.ietf.org/doc/html/rfc822.html) became obsolete and\nthe 4-digit year has been first recommended by RFC 1123\n(https://datatracker.ietf.org/doc/html/rfc1123.html) and then mandated\nby RFC 2822 (https://datatracker.ietf.org/doc/html/rfc2822.html).\n\n(5) https://en.wikipedia.org/wiki/Leapsecond\n\n(6) https://datatracker.ietf.org/doc/html/rfc2822.html\n\n(7) The use of '%Z' is now deprecated, but the '%z' escape that\nexpands to the preferred hour/minute offset is not supported by all ANSI\nC libraries.  Also, a strict reading of the original 1982 RFC 822\n(https://datatracker.ietf.org/doc/html/rfc822.html) standard calls for a\ntwo-digit year ('%y' rather than '%Y'), but practice moved to 4-digit\nyears long before the year 2000.  After that, RFC 822\n(https://datatracker.ietf.org/doc/html/rfc822.html) became obsolete and\nthe 4-digit year has been first recommended by RFC 1123\n(https://datatracker.ietf.org/doc/html/rfc1123.html) and then mandated\nby RFC 2822 (https://datatracker.ietf.org/doc/html/rfc2822.html).\n\n(8) https://en.wikipedia.org/wiki/Leapsecond\n\n(9) https://en.wikipedia.org/wiki/Unixtime\n\nFile: python3.12.info,  Node: Clock ID Constants,  Next: Timezone Constants,  Prev: Functions<5>,  Up: time -- Time access and conversions\n\n5.16.3.2 Clock ID Constants\n...........................\n\nThese constants are used as parameters for *note clockgetres(): fd2.\nand *note clockgettime(): fd3.\n\n-- Data: time.CLOCKBOOTTIME\n\nIdentical to *note CLOCKMONOTONIC: 465, except it also includes\nany time that the system is suspended.\n\nThis allows applications to get a suspend-aware monotonic clock\nwithout having to deal with the complications of *note\nCLOCKREALTIME: 466, which may have discontinuities if the time is\nchanged using 'settimeofday()' or similar.\n\n*note Availability: 1ad3.: Linux >= 2.6.39.\n\nNew in version 3.7.\n\n-- Data: time.CLOCKHIGHRES\n\nThe Solaris OS has a 'CLOCKHIGHRES' timer that attempts to use an\noptimal hardware source, and may give close to nanosecond\nresolution.  'CLOCKHIGHRES' is the nonadjustable, high-resolution\nclock.\n\n*note Availability: 1ad3.: Solaris.\n\nNew in version 3.3.\n\n-- Data: time.CLOCKMONOTONIC\n\nClock that cannot be set and represents monotonic time since some\nunspecified starting point.\n\n*note Availability: 1ad3.: Unix.\n\nNew in version 3.3.\n\n-- Data: time.CLOCKMONOTONICRAW\n\nSimilar to *note CLOCKMONOTONIC: 465, but provides access to a raw\nhardware-based time that is not subject to NTP adjustments.\n\n*note Availability: 1ad3.: Linux >= 2.6.28, macOS >= 10.12.\n\nNew in version 3.3.\n\n-- Data: time.CLOCKPROCESSCPUTIMEID\n\nHigh-resolution per-process timer from the CPU.\n\n*note Availability: 1ad3.: Unix.\n\nNew in version 3.3.\n\n-- Data: time.CLOCKPROF\n\nHigh-resolution per-process timer from the CPU.\n\n*note Availability: 1ad3.: FreeBSD, NetBSD >= 7, OpenBSD.\n\nNew in version 3.7.\n\n-- Data: time.CLOCKTAI\n\nInternational Atomic Time(1)\n\nThe system must have a current leap second table in order for this\nto give the correct answer.  PTP or NTP software can maintain a\nleap second table.\n\n*note Availability: 1ad3.: Linux.\n\nNew in version 3.9.\n\n-- Data: time.CLOCKTHREADCPUTIMEID\n\nThread-specific CPU-time clock.\n\n*note Availability: 1ad3.: Unix.\n\nNew in version 3.3.\n\n-- Data: time.CLOCKUPTIME\n\nTime whose absolute value is the time the system has been running\nand not suspended, providing accurate uptime measurement, both\nabsolute and interval.\n\n*note Availability: 1ad3.: FreeBSD, OpenBSD >= 5.5.\n\nNew in version 3.7.\n\n-- Data: time.CLOCKUPTIMERAW\n\nClock that increments monotonically, tracking the time since an\narbitrary point, unaffected by frequency or time adjustments and\nnot incremented while the system is asleep.\n\n*note Availability: 1ad3.: macOS >= 10.12.\n\nNew in version 3.8.\n\nThe following constant is the only parameter that can be sent to *note\nclocksettime(): fd4.\n\n-- Data: time.CLOCKREALTIME\n\nSystem-wide real-time clock.  Setting this clock requires\nappropriate privileges.\n\n*note Availability: 1ad3.: Unix.\n\nNew in version 3.3.\n\n---------- Footnotes ----------\n\n(1)\nhttps://www.nist.gov/pml/time-and-frequency-division/nist-time-frequently-asked-questions-faq#tai\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Timezone Constants,  Prev: Clock ID Constants,  Up: time -- Time access and conversions": {
            "content": "5.16.3.3 Timezone Constants\n...........................\n\n-- Data: time.altzone\n\nThe offset of the local DST timezone, in seconds west of UTC, if\none is defined.  This is negative if the local DST timezone is east\nof UTC (as in Western Europe, including the UK). Only use this if\n'daylight' is nonzero.  See note below.\n\n-- Data: time.daylight\n\nNonzero if a DST timezone is defined.  See note below.\n\n-- Data: time.timezone\n\nThe offset of the local (non-DST) timezone, in seconds west of UTC\n(negative in most of Western Europe, positive in the US, zero in\nthe UK). See note below.\n\n-- Data: time.tzname\n\nA tuple of two strings: the first is the name of the local non-DST\ntimezone, the second is the name of the local DST timezone.  If no\nDST timezone is defined, the second string should not be used.  See\nnote below.\n\nNote: For the above Timezone constants (*note altzone: 294b, *note\ndaylight: 294c, *note timezone: 294d, and *note tzname: 294e.), the\nvalue is determined by the timezone rules in effect at module load\ntime or the last time *note tzset(): 2943. is called and may be\nincorrect for times in the past.  It is recommended to use the\n*note tmgmtoff: 2935. and *note tmzone: 2936. results from *note\nlocaltime(): 1353. to obtain timezone information.\n\nSee also\n........\n\nModule *note datetime: 2e.\n\nMore object-oriented interface to dates and times.\n\nModule *note locale: 81.\n\nInternationalization services.  The locale setting affects the\ninterpretation of many format specifiers in *note strftime(): 105d.\nand *note strptime(): 1283.\n\nModule *note calendar: 12.\n\nGeneral calendar-related functions.  *note timegm(): 21e0. is the\ninverse of *note gmtime(): 1034. from this module.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: argparse -- Parser for command-line options arguments and sub-commands,  Next: getopt -- C-style parser for command line options,  Prev: time -- Time access and conversions,  Up: Generic Operating System Services": {
            "content": "New in version 3.2.\n\n'Source code:' Lib/argparse.py(1)\n\n\n",
            "subsections": []
        },
        "This page contains the API reference information.  For a more gentle": {
            "content": "introduction to Python command-line parsing, have a look at the *note\nargparse tutorial: 2951.\n\nThe *note argparse: 6. module makes it easy to write user-friendly\ncommand-line interfaces.  The program defines what arguments it\nrequires, and *note argparse: 6. will figure out how to parse those out\nof *note sys.argv: 10dd.  The *note argparse: 6. module also\nautomatically generates help and usage messages.  The module will also\nissue errors when users give the program invalid arguments.\n\n* Menu:\n\n* Core Functionality::\n* Quick Links for addargument(): Quick Links for addargument.\n* Example: Example<7>.\n* ArgumentParser objects::\n* The addargument() method: The addargument method.\n* The parseargs() method: The parseargs method.\n* Other utilities::\n* Upgrading optparse code::\n* Exceptions: Exceptions<8>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/argparse.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Core Functionality,  Next: Quick Links for addargument,  Up: argparse -- Parser for command-line options arguments and sub-commands": {
            "content": "5.16.4.1 Core Functionality\n...........................\n\nThe *note argparse: 6. module's support for command-line interfaces is\nbuilt around an instance of *note argparse.ArgumentParser: 28f.  It is a\ncontainer for argument specifications and has options that apply to the\nparser as whole:\n\nparser = argparse.ArgumentParser(\nprog='ProgramName',\ndescription='What the program does',\nepilog='Text at the bottom of help')\n\nThe *note ArgumentParser.addargument(): 14a2. method attaches\nindividual argument specifications to the parser.  It supports\npositional arguments, options that accept values, and on/off flags:\n\nparser.addargument('filename')           # positional argument\nparser.addargument('-c', '--count')      # option that takes a value\nparser.addargument('-v', '--verbose',\naction='storetrue')  # on/off flag\n\nThe *note ArgumentParser.parseargs(): 2953. method runs the parser and\nplaces the extracted data in a *note argparse.Namespace: 2954. object:\n\nargs = parser.parseargs()\nprint(args.filename, args.count, args.verbose)\n\nFile: python3.12.info,  Node: Quick Links for addargument,  Next: Example<7>,  Prev: Core Functionality,  Up: argparse -- Parser for command-line options arguments and sub-commands\n\n5.16.4.2 Quick Links for addargument()\n.......................................\n",
            "subsections": []
        },
        "Name                             Description                                                     Values": {
            "content": "--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\n*note action: 2956.              Specify how an argument should be handled                       ''store'', ''storeconst'', ''storetrue'', ''append'', ''appendconst'', ''count'', ''help'', ''version''\n\n\n*note choices: 2957.             Limit values to a specific set of choices                       '['foo', 'bar']', 'range(1, 10)', or *note Container: 1f5d. instance\n\n\n*note const: 2958.               Store a constant value\n\n\n*note default: 2959.             Default value used when an argument is not provided             Defaults to 'None'\n\n\n*note dest: 295a.                Specify the attribute name used in the result namespace\n\n\n*note help: 295b.                Help message for an argument\n\n\n*note metavar: 295c.             Alternate display name for the argument as shown in help\n\n\n*note nargs: 295d.               Number of times the argument can be used                        *note int: 17e, ''?'', ''*'', or ''+''\n\n\n*note required: 295e.            Indicate whether an argument is required or optional            'True' or 'False'\n\n\n*note type: 295f.                Automatically convert an argument to the given type             *note int: 17e, *note float: 4b7, 'argparse.FileType('w')', or callable function\n\n\nFile: python3.12.info,  Node: Example<7>,  Next: ArgumentParser objects,  Prev: Quick Links for addargument,  Up: argparse -- Parser for command-line options arguments and sub-commands\n\n5.16.4.3 Example\n................\n",
            "subsections": []
        },
        "The following code is a Python program that takes a list of integers and": {
            "content": "produces either the sum or the max:\n\nimport argparse\n\nparser = argparse.ArgumentParser(description='Process some integers.')\nparser.addargument('integers', metavar='N', type=int, nargs='+',\nhelp='an integer for the accumulator')\nparser.addargument('--sum', dest='accumulate', action='storeconst',\nconst=sum, default=max,\nhelp='sum the integers (default: find the max)')\n\nargs = parser.parseargs()\nprint(args.accumulate(args.integers))\n",
            "subsections": []
        },
        "Assuming the above Python code is saved into a file called 'prog.py', it": {
            "content": "can be run at the command line and it provides useful help messages:\n\n$ python prog.py -h\nusage: prog.py [-h] [--sum] N [N ...]\n\nProcess some integers.\n\npositional arguments:\nN           an integer for the accumulator\n\noptions:\n-h, --help  show this help message and exit\n--sum       sum the integers (default: find the max)\n",
            "subsections": []
        },
        "When run with the appropriate arguments, it prints either the sum or the": {
            "content": "max of the command-line integers:\n\n$ python prog.py 1 2 3 4\n4\n\n$ python prog.py 1 2 3 4 --sum\n10\n\nIf invalid arguments are passed in, an error will be displayed:\n\n$ python prog.py a b c\nusage: prog.py [-h] [--sum] N [N ...]\nprog.py: error: argument N: invalid int value: 'a'\n\nThe following sections walk you through this example.\n\n* Menu:\n\n* Creating a parser::\n* Adding arguments::\n* Parsing arguments::\n\nFile: python3.12.info,  Node: Creating a parser,  Next: Adding arguments,  Up: Example<7>\n\n5.16.4.4 Creating a parser\n..........................\n\nThe first step in using the *note argparse: 6. is creating an *note\nArgumentParser: 28f. object:\n\n>>> parser = argparse.ArgumentParser(description='Process some integers.')\n\nThe *note ArgumentParser: 28f. object will hold all the information\nnecessary to parse the command line into Python data types.\n\nFile: python3.12.info,  Node: Adding arguments,  Next: Parsing arguments,  Prev: Creating a parser,  Up: Example<7>\n\n5.16.4.5 Adding arguments\n.........................\n\nFilling an *note ArgumentParser: 28f. with information about program\narguments is done by making calls to the *note addargument(): 14a2.\nmethod.  Generally, these calls tell the *note ArgumentParser: 28f. how\nto take the strings on the command line and turn them into objects.\nThis information is stored and used when *note parseargs(): 2953. is\ncalled.  For example:\n\n>>> parser.addargument('integers', metavar='N', type=int, nargs='+',\n...                     help='an integer for the accumulator')\n>>> parser.addargument('--sum', dest='accumulate', action='storeconst',\n...                     const=sum, default=max,\n...                     help='sum the integers (default: find the max)')\n\nLater, calling *note parseargs(): 2953. will return an object with two\nattributes, 'integers' and 'accumulate'.  The 'integers' attribute will\nbe a list of one or more integers, and the 'accumulate' attribute will\nbe either the *note sum(): 181. function, if '--sum' was specified at\nthe command line, or the *note max(): d70. function if it was not.\n\nFile: python3.12.info,  Node: Parsing arguments,  Prev: Adding arguments,  Up: Example<7>\n\n5.16.4.6 Parsing arguments\n..........................\n\n*note ArgumentParser: 28f. parses arguments through the *note\nparseargs(): 2953. method.  This will inspect the command line, convert\neach argument to the appropriate type and then invoke the appropriate\naction.  In most cases, this means a simple *note Namespace: 2954.\nobject will be built up from attributes parsed out of the command line:\n\n>>> parser.parseargs(['--sum', '7', '-1', '42'])\nNamespace(accumulate=<built-in function sum>, integers=[7, -1, 42])\n\nIn a script, *note parseargs(): 2953. will typically be called with no\narguments, and the *note ArgumentParser: 28f. will automatically\ndetermine the command-line arguments from *note sys.argv: 10dd.\n\nFile: python3.12.info,  Node: ArgumentParser objects,  Next: The addargument method,  Prev: Example<7>,  Up: argparse -- Parser for command-line options arguments and sub-commands\n\n5.16.4.7 ArgumentParser objects\n...............................\n\n-- Class: argparse.ArgumentParser (prog=None, usage=None,\ndescription=None, epilog=None, parents=[],\nformatterclass=argparse.HelpFormatter, prefixchars='-',\nfromfileprefixchars=None, argumentdefault=None,\nconflicthandler='error', addhelp=True, allowabbrev=True,\nexitonerror=True)\n\nCreate a new *note ArgumentParser: 28f. object.  All parameters\nshould be passed as keyword arguments.  Each parameter has its own\nmore detailed description below, but in short they are:\n\n* *note prog: 2965. - The name of the program (default:\n'os.path.basename(sys.argv[0])')\n\n* *note usage: 2966. - The string describing the program usage\n(default: generated from arguments added to parser)\n\n* *note description: 2967. - Text to display before the argument\nhelp (by default, no text)\n\n* *note epilog: 2968. - Text to display after the argument help\n(by default, no text)\n\n* *note parents: 2969. - A list of *note ArgumentParser: 28f.\nobjects whose arguments should also be included\n\n* *note formatterclass: 296a. - A class for customizing the\nhelp output\n\n* *note prefixchars: 296b. - The set of characters that prefix\noptional arguments (default: '-')\n\n* *note fromfileprefixchars: 296c. - The set of characters\nthat prefix files from which additional arguments should be\nread (default: 'None')\n\n* *note argumentdefault: 296d. - The global default value for\narguments (default: 'None')\n\n* *note conflicthandler: 296e. - The strategy for resolving\nconflicting optionals (usually unnecessary)\n\n* *note addhelp: 296f. - Add a '-h/--help' option to the parser\n(default: 'True')\n\n* *note allowabbrev: c1c. - Allows long options to be\nabbreviated if the abbreviation is unambiguous.  (default:\n'True')\n\n* *note exitonerror: 2970. - Determines whether or not\nArgumentParser exits with error info when an error occurs.\n(default: 'True')\n\nChanged in version 3.5: 'allowabbrev' parameter was added.\n\nChanged in version 3.8: In previous versions, 'allowabbrev' also\ndisabled grouping of short flags such as '-vv' to mean '-v -v'.\n\nChanged in version 3.9: 'exitonerror' parameter was added.\n\nThe following sections describe how each of these are used.\n\n* Menu:\n\n* prog::\n* usage::\n* description::\n* epilog::\n* parents::\n* formatterclass::\n* prefixchars::\n* fromfileprefixchars::\n* argumentdefault::\n* allowabbrev::\n* conflicthandler::\n* addhelp::\n* exitonerror::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: prog,  Next: usage,  Up: ArgumentParser objects": {
            "content": "5.16.4.8 prog\n.............\n\nBy default, *note ArgumentParser: 28f. objects use 'sys.argv[0]' to\ndetermine how to display the name of the program in help messages.  This\ndefault is almost always desirable because it will make the help\nmessages match how the program was invoked on the command line.  For\nexample, consider a file named 'myprogram.py' with the following code:\n\nimport argparse\nparser = argparse.ArgumentParser()\nparser.addargument('--foo', help='foo help')\nargs = parser.parseargs()\n",
            "subsections": []
        },
        "The help for this program will display 'myprogram.py' as the program": {
            "content": "name (regardless of where the program was invoked from):\n\n$ python myprogram.py --help\nusage: myprogram.py [-h] [--foo FOO]\n\noptions:\n-h, --help  show this help message and exit\n--foo FOO   foo help\n$ cd ..\n$ python subdir/myprogram.py --help\nusage: myprogram.py [-h] [--foo FOO]\n\noptions:\n-h, --help  show this help message and exit\n--foo FOO   foo help\n",
            "subsections": []
        },
        "To change this default behavior, another value can be supplied using the": {
            "content": "'prog=' argument to *note ArgumentParser: 28f.:\n\n>>> parser = argparse.ArgumentParser(prog='myprogram')\n>>> parser.printhelp()\nusage: myprogram [-h]\n\noptions:\n-h, --help  show this help message and exit\n\nNote that the program name, whether determined from 'sys.argv[0]' or\nfrom the 'prog=' argument, is available to help messages using the\n'%(prog)s' format specifier.\n\n>>> parser = argparse.ArgumentParser(prog='myprogram')\n>>> parser.addargument('--foo', help='foo of the %(prog)s program')\n>>> parser.printhelp()\nusage: myprogram [-h] [--foo FOO]\n\noptions:\n-h, --help  show this help message and exit\n--foo FOO   foo of the myprogram program\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: usage,  Next: description,  Prev: prog,  Up: ArgumentParser objects": {
            "content": "5.16.4.9 usage\n..............\n\nBy default, *note ArgumentParser: 28f. calculates the usage message from\nthe arguments it contains:\n\n>>> parser = argparse.ArgumentParser(prog='PROG')\n>>> parser.addargument('--foo', nargs='?', help='foo help')\n>>> parser.addargument('bar', nargs='+', help='bar help')\n>>> parser.printhelp()\nusage: PROG [-h] [--foo [FOO]] bar [bar ...]\n\npositional arguments:\nbar          bar help\n\noptions:\n-h, --help   show this help message and exit\n--foo [FOO]  foo help\n\nThe default message can be overridden with the 'usage=' keyword\nargument:\n\n>>> parser = argparse.ArgumentParser(prog='PROG', usage='%(prog)s [options]')\n>>> parser.addargument('--foo', nargs='?', help='foo help')\n>>> parser.addargument('bar', nargs='+', help='bar help')\n>>> parser.printhelp()\nusage: PROG [options]\n\npositional arguments:\nbar          bar help\n\noptions:\n-h, --help   show this help message and exit\n--foo [FOO]  foo help\n\nThe '%(prog)s' format specifier is available to fill in the program name\nin your usage messages.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: description,  Next: epilog,  Prev: usage,  Up: ArgumentParser objects": {
            "content": "5.16.4.10 description\n.....................\n\nMost calls to the *note ArgumentParser: 28f. constructor will use the\n'description=' keyword argument.  This argument gives a brief\ndescription of what the program does and how it works.  In help\nmessages, the description is displayed between the command-line usage\nstring and the help messages for the various arguments:\n\n>>> parser = argparse.ArgumentParser(description='A foo that bars')\n>>> parser.printhelp()\nusage: argparse.py [-h]\n\nA foo that bars\n\noptions:\n-h, --help  show this help message and exit\n",
            "subsections": []
        },
        "By default, the description will be line-wrapped so that it fits within": {
            "content": "the given space.  To change this behavior, see the *note\nformatterclass: 296a. argument.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: epilog,  Next: parents,  Prev: description,  Up: ArgumentParser objects": {
            "content": "5.16.4.11 epilog\n................\n",
            "subsections": []
        },
        "Some programs like to display additional description of the program": {
            "content": "after the description of the arguments.  Such text can be specified\nusing the 'epilog=' argument to *note ArgumentParser: 28f.:\n\n>>> parser = argparse.ArgumentParser(\n...     description='A foo that bars',\n...     epilog=\"And that's how you'd foo a bar\")\n>>> parser.printhelp()\nusage: argparse.py [-h]\n\nA foo that bars\n\noptions:\n-h, --help  show this help message and exit\n\nAnd that's how you'd foo a bar\n\nAs with the *note description: 2967. argument, the 'epilog=' text is by\ndefault line-wrapped, but this behavior can be adjusted with the *note\nformatterclass: 296a. argument to *note ArgumentParser: 28f.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: parents,  Next: formatterclass,  Prev: epilog,  Up: ArgumentParser objects": {
            "content": "5.16.4.12 parents\n.................\n",
            "subsections": []
        },
        "Sometimes, several parsers share a common set of arguments.  Rather than": {
            "content": "repeating the definitions of these arguments, a single parser with all\nthe shared arguments and passed to 'parents=' argument to *note\nArgumentParser: 28f. can be used.  The 'parents=' argument takes a list\nof *note ArgumentParser: 28f. objects, collects all the positional and\noptional actions from them, and adds these actions to the *note\nArgumentParser: 28f. object being constructed:\n\n>>> parentparser = argparse.ArgumentParser(addhelp=False)\n>>> parentparser.addargument('--parent', type=int)\n\n>>> fooparser = argparse.ArgumentParser(parents=[parentparser])\n>>> fooparser.addargument('foo')\n>>> fooparser.parseargs(['--parent', '2', 'XXX'])\nNamespace(foo='XXX', parent=2)\n\n>>> barparser = argparse.ArgumentParser(parents=[parentparser])\n>>> barparser.addargument('--bar')\n>>> barparser.parseargs(['--bar', 'YYY'])\nNamespace(bar='YYY', parent=None)\n\nNote that most parent parsers will specify 'addhelp=False'.  Otherwise,\nthe *note ArgumentParser: 28f. will see two '-h/--help' options (one in\nthe parent and one in the child) and raise an error.\n\nNote: You must fully initialize the parsers before passing them via\n'parents='.  If you change the parent parsers after the child\nparser, those changes will not be reflected in the child.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: formatterclass,  Next: prefixchars,  Prev: parents,  Up: ArgumentParser objects": {
            "content": "5.16.4.13 formatterclass\n.........................\n\n*note ArgumentParser: 28f. objects allow the help formatting to be\ncustomized by specifying an alternate formatting class.  Currently,\nthere are four such classes:\n\n-- Class: argparse.RawDescriptionHelpFormatter\n-- Class: argparse.RawTextHelpFormatter\n-- Class: argparse.ArgumentDefaultsHelpFormatter\n-- Class: argparse.MetavarTypeHelpFormatter\n\n*note RawDescriptionHelpFormatter: 2974. and *note RawTextHelpFormatter:\n2975. give more control over how textual descriptions are displayed.  By\ndefault, *note ArgumentParser: 28f. objects line-wrap the *note\ndescription: 2967. and *note epilog: 2968. texts in command-line help\nmessages:\n\n>>> parser = argparse.ArgumentParser(\n...     prog='PROG',\n...     description='''this description\n...         was indented weird\n...             but that is okay''',\n...     epilog='''\n...             likewise for this epilog whose whitespace will\n...         be cleaned up and whose words will be wrapped\n...         across a couple lines''')\n>>> parser.printhelp()\nusage: PROG [-h]\n\nthis description was indented weird but that is okay\n\noptions:\n-h, --help  show this help message and exit\n\nlikewise for this epilog whose whitespace will be cleaned up and whose words\nwill be wrapped across a couple lines\n\nPassing *note RawDescriptionHelpFormatter: 2974. as 'formatterclass='\nindicates that *note description: 2967. and *note epilog: 2968. are\nalready correctly formatted and should not be line-wrapped:\n\n>>> parser = argparse.ArgumentParser(\n...     prog='PROG',\n...     formatterclass=argparse.RawDescriptionHelpFormatter,\n...     description=textwrap.dedent('''\\\n...         Please do not mess up this text!\n...         --------------------------------\n...             I have indented it\n...             exactly the way\n...             I want it\n...         '''))\n>>> parser.printhelp()\nusage: PROG [-h]\n\nI have indented it\nexactly the way\nI want it\n\noptions:\n-h, --help  show this help message and exit\n\n*note RawTextHelpFormatter: 2975. maintains whitespace for all sorts of\nhelp text, including argument descriptions.  However, multiple new lines\nare replaced with one.  If you wish to preserve multiple blank lines,\nadd spaces between the newlines.\n\n*note ArgumentDefaultsHelpFormatter: 15fd. automatically adds\ninformation about default values to each of the argument help messages:\n\n>>> parser = argparse.ArgumentParser(\n...     prog='PROG',\n...     formatterclass=argparse.ArgumentDefaultsHelpFormatter)\n>>> parser.addargument('--foo', type=int, default=42, help='FOO!')\n>>> parser.addargument('bar', nargs='*', default=[1, 2, 3], help='BAR!')\n>>> parser.printhelp()\nusage: PROG [-h] [--foo FOO] [bar ...]\n\npositional arguments:\nbar         BAR! (default: [1, 2, 3])\n\noptions:\n-h, --help  show this help message and exit\n--foo FOO   FOO! (default: 42)\n\n*note MetavarTypeHelpFormatter: 2976. uses the name of the *note type:\n2977. argument for each argument as the display name for its values\n(rather than using the *note dest: 295a. as the regular formatter does):\n\n>>> parser = argparse.ArgumentParser(\n...     prog='PROG',\n...     formatterclass=argparse.MetavarTypeHelpFormatter)\n>>> parser.addargument('--foo', type=int)\n>>> parser.addargument('bar', type=float)\n>>> parser.printhelp()\nusage: PROG [-h] [--foo int] float\n\npositional arguments:\nfloat\n\noptions:\n-h, --help  show this help message and exit\n--foo int\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: prefixchars,  Next: fromfileprefixchars,  Prev: formatterclass,  Up: ArgumentParser objects": {
            "content": "5.16.4.14 prefixchars\n......................\n\nMost command-line options will use '-' as the prefix, e.g.  '-f/--foo'.",
            "subsections": []
        },
        "Parsers that need to support different or additional prefix characters,": {
            "content": "e.g.  for options like '+f' or '/foo', may specify them using the\n'prefixchars=' argument to the ArgumentParser constructor:\n\n>>> parser = argparse.ArgumentParser(prog='PROG', prefixchars='-+')\n>>> parser.addargument('+f')\n>>> parser.addargument('++bar')\n>>> parser.parseargs('+f X ++bar Y'.split())\nNamespace(bar='Y', f='X')\n\nThe 'prefixchars=' argument defaults to ''-''.  Supplying a set of\ncharacters that does not include '-' will cause '-f/--foo' options to be\ndisallowed.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: fromfileprefixchars,  Next: argumentdefault,  Prev: prefixchars,  Up: ArgumentParser objects": {
            "content": "5.16.4.15 fromfileprefixchars\n...............................\n",
            "subsections": []
        },
        "Sometimes, when dealing with a particularly long argument list, it may": {
            "content": "make sense to keep the list of arguments in a file rather than typing it\nout at the command line.  If the 'fromfileprefixchars=' argument is\ngiven to the *note ArgumentParser: 28f. constructor, then arguments that\nstart with any of the specified characters will be treated as files, and\nwill be replaced by the arguments they contain.  For example:\n\n>>> with open('args.txt', 'w', encoding=sys.getfilesystemencoding()) as fp:\n...     fp.write('-f\\nbar')\n...\n>>> parser = argparse.ArgumentParser(fromfileprefixchars='@')\n>>> parser.addargument('-f')\n>>> parser.parseargs(['-f', 'foo', '@args.txt'])\nNamespace(f='bar')\n",
            "subsections": []
        },
        "Arguments read from a file must by default be one per line (but see also": {
            "content": "*note convertarglinetoargs(): 2978.) and are treated as if they were\nin the same place as the original file referencing argument on the\ncommand line.  So in the example above, the expression '['-f', 'foo',\n'@args.txt']' is considered equivalent to the expression '['-f', 'foo',\n'-f', 'bar']'.\n\n*note ArgumentParser: 28f. uses *note filesystem encoding and error\nhandler: 291. to read the file containing arguments.\n\nThe 'fromfileprefixchars=' argument defaults to 'None', meaning that\narguments will never be treated as file references.\n\nChanged in version 3.12: *note ArgumentParser: 28f. changed encoding and\nerrors to read arguments files from default (e.g.  *note\nlocale.getpreferredencoding(False): 290. and '\"strict\"') to *note\nfilesystem encoding and error handler: 291.  Arguments file should be\nencoded in UTF-8 instead of ANSI Codepage on Windows.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: argumentdefault,  Next: allowabbrev,  Prev: fromfileprefixchars,  Up: ArgumentParser objects": {
            "content": "5.16.4.16 argumentdefault\n..........................\n",
            "subsections": []
        },
        "Generally, argument defaults are specified either by passing a default": {
            "content": "to *note addargument(): 14a2. or by calling the *note setdefaults():\n2979. methods with a specific set of name-value pairs.  Sometimes\nhowever, it may be useful to specify a single parser-wide default for\narguments.  This can be accomplished by passing the 'argumentdefault='\nkeyword argument to *note ArgumentParser: 28f.  For example, to globally\nsuppress attribute creation on *note parseargs(): 2953. calls, we\nsupply 'argumentdefault=SUPPRESS':\n\n>>> parser = argparse.ArgumentParser(argumentdefault=argparse.SUPPRESS)\n>>> parser.addargument('--foo')\n>>> parser.addargument('bar', nargs='?')\n>>> parser.parseargs(['--foo', '1', 'BAR'])\nNamespace(bar='BAR', foo='1')\n>>> parser.parseargs([])\nNamespace()\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: allowabbrev,  Next: conflicthandler,  Prev: argumentdefault,  Up: ArgumentParser objects": {
            "content": "5.16.4.17 allowabbrev\n......................\n\nNormally, when you pass an argument list to the *note parseargs():\n2953. method of an *note ArgumentParser: 28f, it *note recognizes\nabbreviations: c1b. of long options.\n\nThis feature can be disabled by setting 'allowabbrev' to 'False':\n\n>>> parser = argparse.ArgumentParser(prog='PROG', allowabbrev=False)\n>>> parser.addargument('--foobar', action='storetrue')\n>>> parser.addargument('--foonley', action='storefalse')\n>>> parser.parseargs(['--foon'])\nusage: PROG [-h] [--foobar] [--foonley]\nPROG: error: unrecognized arguments: --foon\n\nNew in version 3.5.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: conflicthandler,  Next: addhelp,  Prev: allowabbrev,  Up: ArgumentParser objects": {
            "content": "5.16.4.18 conflicthandler\n..........................\n\n*note ArgumentParser: 28f. objects do not allow two actions with the\nsame option string.  By default, *note ArgumentParser: 28f. objects\nraise an exception if an attempt is made to create an argument with an\noption string that is already in use:\n\n>>> parser = argparse.ArgumentParser(prog='PROG')\n>>> parser.addargument('-f', '--foo', help='old foo help')\n>>> parser.addargument('--foo', help='new foo help')\nTraceback (most recent call last):\n..\nArgumentError: argument --foo: conflicting option string(s): --foo\n\nSometimes (e.g.  when using *note parents: 2969.) it may be useful to\nsimply override any older arguments with the same option string.  To get\nthis behavior, the value ''resolve'' can be supplied to the\n'conflicthandler=' argument of *note ArgumentParser: 28f.:\n\n>>> parser = argparse.ArgumentParser(prog='PROG', conflicthandler='resolve')\n>>> parser.addargument('-f', '--foo', help='old foo help')\n>>> parser.addargument('--foo', help='new foo help')\n>>> parser.printhelp()\nusage: PROG [-h] [-f FOO] [--foo FOO]\n\noptions:\n-h, --help  show this help message and exit\n-f FOO      old foo help\n--foo FOO   new foo help\n\nNote that *note ArgumentParser: 28f. objects only remove an action if\nall of its option strings are overridden.  So, in the example above, the\nold '-f/--foo' action is retained as the '-f' action, because only the\n'--foo' option string was overridden.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: addhelp,  Next: exitonerror,  Prev: conflicthandler,  Up: ArgumentParser objects": {
            "content": "5.16.4.19 addhelp\n..................\n",
            "subsections": []
        },
        "By default, ArgumentParser objects add an option which simply displays": {
            "content": "the parser's help message.  For example, consider a file named\n'myprogram.py' containing the following code:\n\nimport argparse\nparser = argparse.ArgumentParser()\nparser.addargument('--foo', help='foo help')\nargs = parser.parseargs()\n",
            "subsections": []
        },
        "If '-h' or '--help' is supplied at the command line, the ArgumentParser": {
            "content": "help will be printed:\n\n$ python myprogram.py --help\nusage: myprogram.py [-h] [--foo FOO]\n\noptions:\n-h, --help  show this help message and exit\n--foo FOO   foo help\n",
            "subsections": []
        },
        "Occasionally, it may be useful to disable the addition of this help": {
            "content": "option.  This can be achieved by passing 'False' as the 'addhelp='\nargument to *note ArgumentParser: 28f.:\n\n>>> parser = argparse.ArgumentParser(prog='PROG', addhelp=False)\n>>> parser.addargument('--foo', help='foo help')\n>>> parser.printhelp()\nusage: PROG [--foo FOO]\n\noptions:\n--foo FOO  foo help\n",
            "subsections": []
        },
        "The help option is typically '-h/--help'.  The exception to this is if": {
            "content": "the 'prefixchars=' is specified and does not include '-', in which case\n'-h' and '--help' are not valid options.  In this case, the first\ncharacter in 'prefixchars' is used to prefix the help options:\n\n>>> parser = argparse.ArgumentParser(prog='PROG', prefixchars='+/')\n>>> parser.printhelp()\nusage: PROG [+h]\n\noptions:\n+h, ++help  show this help message and exit\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: exitonerror,  Prev: addhelp,  Up: ArgumentParser objects": {
            "content": "5.16.4.20 exitonerror\n.......................\n\nNormally, when you pass an invalid argument list to the *note\nparseargs(): 2953. method of an *note ArgumentParser: 28f, it will exit\nwith error info.\n",
            "subsections": []
        },
        "If the user would like to catch errors manually, the feature can be": {
            "content": "enabled by setting 'exitonerror' to 'False':\n\n>>> parser = argparse.ArgumentParser(exitonerror=False)\n>>> parser.addargument('--integers', type=int)\nStoreAction(optionstrings=['--integers'], dest='integers', nargs=None, const=None, default=None, type=<class 'int'>, choices=None, help=None, metavar=None)\n>>> try:\n...     parser.parseargs('--integers a'.split())\n... except argparse.ArgumentError:\n...     print('Catching an argumentError')\n...\nCatching an argumentError\n\nNew in version 3.9.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The addargument method,  Next: The parseargs method,  Prev: ArgumentParser objects,  Up: argparse -- Parser for command-line options arguments and sub-commands": {
            "content": "5.16.4.21 The addargument() method\n...................................\n\n-- Method: ArgumentParser.addargument (name or flags...[, action][,\nnargs][, const][, default][, type][, choices][, required][,\nhelp][, metavar][, dest])\n\nDefine how a single command-line argument should be parsed.  Each\nparameter has its own more detailed description below, but in short\nthey are:\n\n* *note name or flags: 297c. - Either a name or a list of option\nstrings, e.g.  'foo' or '-f, --foo'.\n\n* *note action: 2956. - The basic type of action to be taken\nwhen this argument is encountered at the command line.\n\n* *note nargs: 295d. - The number of command-line arguments that\nshould be consumed.\n\n* *note const: 2958. - A constant value required by some *note\naction: 2956. and *note nargs: 295d. selections.\n\n* *note default: 2959. - The value produced if the argument is\nabsent from the command line and if it is absent from the\nnamespace object.\n\n* *note type: 2977. - The type to which the command-line\nargument should be converted.\n\n* *note choices: 2957. - A sequence of the allowable values for\nthe argument.\n\n* *note required: 295e. - Whether or not the command-line option\nmay be omitted (optionals only).\n\n* *note help: 295b. - A brief description of what the argument\ndoes.\n\n* *note metavar: 295c. - A name for the argument in usage\nmessages.\n\n* *note dest: 295a. - The name of the attribute to be added to\nthe object returned by *note parseargs(): 2953.\n\nThe following sections describe how each of these are used.\n\n* Menu:\n\n* name or flags::\n* action::\n* nargs::\n* const::\n* default::\n* type::\n* choices::\n* required::\n* help::\n* metavar::\n* dest::\n* Action classes::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: name or flags,  Next: action,  Up: The addargument method": {
            "content": "5.16.4.22 name or flags\n.......................\n\nThe *note addargument(): 14a2. method must know whether an optional\nargument, like '-f' or '--foo', or a positional argument, like a list of\nfilenames, is expected.  The first arguments passed to *note\naddargument(): 14a2. must therefore be either a series of flags, or a\nsimple argument name.\n\nFor example, an optional argument could be created like:\n\n>>> parser.addargument('-f', '--foo')\n\nwhile a positional argument could be created like:\n\n>>> parser.addargument('bar')\n\nWhen *note parseargs(): 2953. is called, optional arguments will be\nidentified by the '-' prefix, and the remaining arguments will be\nassumed to be positional:\n\n>>> parser = argparse.ArgumentParser(prog='PROG')\n>>> parser.addargument('-f', '--foo')\n>>> parser.addargument('bar')\n>>> parser.parseargs(['BAR'])\nNamespace(bar='BAR', foo=None)\n>>> parser.parseargs(['BAR', '--foo', 'FOO'])\nNamespace(bar='BAR', foo='FOO')\n>>> parser.parseargs(['--foo', 'FOO'])\nusage: PROG [-h] [-f FOO] bar\nPROG: error: the following arguments are required: bar\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: action,  Next: nargs,  Prev: name or flags,  Up: The addargument method": {
            "content": "5.16.4.23 action\n................\n\n*note ArgumentParser: 28f. objects associate command-line arguments with\nactions.  These actions can do just about anything with the command-line\narguments associated with them, though most actions simply add an\nattribute to the object returned by *note parseargs(): 2953.  The\n'action' keyword argument specifies how the command-line arguments\nshould be handled.  The supplied actions are:\n\n* ''store'' - This just stores the argument's value.  This is the\ndefault action.  For example:\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('--foo')\n>>> parser.parseargs('--foo 1'.split())\nNamespace(foo='1')\n\n* ''storeconst'' - This stores the value specified by the *note\nconst: 2958. keyword argument; note that the *note const: 2958.\nkeyword argument defaults to 'None'.  The ''storeconst'' action is\nmost commonly used with optional arguments that specify some sort\nof flag.  For example:\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('--foo', action='storeconst', const=42)\n>>> parser.parseargs(['--foo'])\nNamespace(foo=42)\n\n* ''storetrue'' and ''storefalse'' - These are special cases of\n''storeconst'' used for storing the values 'True' and 'False'\nrespectively.  In addition, they create default values of 'False'\nand 'True' respectively.  For example:\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('--foo', action='storetrue')\n>>> parser.addargument('--bar', action='storefalse')\n>>> parser.addargument('--baz', action='storefalse')\n>>> parser.parseargs('--foo --bar'.split())\nNamespace(foo=True, bar=False, baz=True)\n\n* ''append'' - This stores a list, and appends each argument value to\nthe list.  It is useful to allow an option to be specified multiple\ntimes.  If the default value is non-empty, the default elements\nwill be present in the parsed value for the option, with any values\nfrom the command line appended after those default values.  Example\nusage:\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('--foo', action='append')\n>>> parser.parseargs('--foo 1 --foo 2'.split())\nNamespace(foo=['1', '2'])\n\n* ''appendconst'' - This stores a list, and appends the value\nspecified by the *note const: 2958. keyword argument to the list;\nnote that the *note const: 2958. keyword argument defaults to\n'None'.  The ''appendconst'' action is typically useful when\nmultiple arguments need to store constants to the same list.  For\nexample:\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('--str', dest='types', action='appendconst', const=str)\n>>> parser.addargument('--int', dest='types', action='appendconst', const=int)\n>>> parser.parseargs('--str --int'.split())\nNamespace(types=[<class 'str'>, <class 'int'>])\n\n* ''count'' - This counts the number of times a keyword argument\noccurs.  For example, this is useful for increasing verbosity\nlevels:\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('--verbose', '-v', action='count', default=0)\n>>> parser.parseargs(['-vvv'])\nNamespace(verbose=3)\n\nNote, the 'default' will be 'None' unless explicitly set to '0'.\n\n* ''help'' - This prints a complete help message for all the options\nin the current parser and then exits.  By default a help action is\nautomatically added to the parser.  See *note ArgumentParser: 28f.\nfor details of how the output is created.\n\n* ''version'' - This expects a 'version=' keyword argument in the\n*note addargument(): 14a2. call, and prints version information\nand exits when invoked:\n\n>>> import argparse\n>>> parser = argparse.ArgumentParser(prog='PROG')\n>>> parser.addargument('--version', action='version', version='%(prog)s 2.0')\n>>> parser.parseargs(['--version'])\nPROG 2.0\n\n* ''extend'' - This stores a list, and extends each argument value to\nthe list.  Example usage:\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument(\"--foo\", action=\"extend\", nargs=\"+\", type=str)\n>>> parser.parseargs([\"--foo\", \"f1\", \"--foo\", \"f2\", \"f3\", \"f4\"])\nNamespace(foo=['f1', 'f2', 'f3', 'f4'])\n\nNew in version 3.8.\n",
            "subsections": []
        },
        "You may also specify an arbitrary action by passing an Action subclass": {
            "content": "or other object that implements the same interface.  The\n'BooleanOptionalAction' is available in 'argparse' and adds support for\nboolean actions such as '--foo' and '--no-foo':\n\n>>> import argparse\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('--foo', action=argparse.BooleanOptionalAction)\n>>> parser.parseargs(['--no-foo'])\nNamespace(foo=False)\n\nNew in version 3.9.\n\nThe recommended way to create a custom action is to extend *note Action:\n155d, overriding the 'call' method and optionally the 'init' and\n'formatusage' methods.\n\nAn example of a custom action:\n\n>>> class FooAction(argparse.Action):\n...     def init(self, optionstrings, dest, nargs=None, kwargs):\n...         if nargs is not None:\n...             raise ValueError(\"nargs not allowed\")\n...         super().init(optionstrings, dest, kwargs)\n...     def call(self, parser, namespace, values, optionstring=None):\n...         print('%r %r %r' % (namespace, values, optionstring))\n...         setattr(namespace, self.dest, values)\n...\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('--foo', action=FooAction)\n>>> parser.addargument('bar', action=FooAction)\n>>> args = parser.parseargs('1 --foo 2'.split())\nNamespace(bar=None, foo=None) '1' None\nNamespace(bar='1', foo=None) '2' '--foo'\n>>> args\nNamespace(bar='1', foo='2')\n\nFor more details, see *note Action: 155d.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: nargs,  Next: const,  Prev: action,  Up: The addargument method": {
            "content": "5.16.4.24 nargs\n...............\n",
            "subsections": []
        },
        "ArgumentParser objects usually associate a single command-line argument": {
            "content": "with a single action to be taken.  The 'nargs' keyword argument\nassociates a different number of command-line arguments with a single\naction.  See also *note Specifying ambiguous arguments: 2980.  The\nsupported values are:\n\n* 'N' (an integer).  'N' arguments from the command line will be\ngathered together into a list.  For example:\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('--foo', nargs=2)\n>>> parser.addargument('bar', nargs=1)\n>>> parser.parseargs('c --foo a b'.split())\nNamespace(bar=['c'], foo=['a', 'b'])\n\nNote that 'nargs=1' produces a list of one item.  This is different\nfrom the default, in which the item is produced by itself.\n\n* ''?''.  One argument will be consumed from the command line if\npossible, and produced as a single item.  If no command-line\nargument is present, the value from *note default: 2959. will be\nproduced.  Note that for optional arguments, there is an additional\ncase - the option string is present but not followed by a\ncommand-line argument.  In this case the value from *note const:\n2958. will be produced.  Some examples to illustrate this:\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('--foo', nargs='?', const='c', default='d')\n>>> parser.addargument('bar', nargs='?', default='d')\n>>> parser.parseargs(['XX', '--foo', 'YY'])\nNamespace(bar='XX', foo='YY')\n>>> parser.parseargs(['XX', '--foo'])\nNamespace(bar='XX', foo='c')\n>>> parser.parseargs([])\nNamespace(bar='d', foo='d')\n\nOne of the more common uses of 'nargs='?'' is to allow optional\ninput and output files:\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('infile', nargs='?', type=argparse.FileType('r'),\n...                     default=sys.stdin)\n>>> parser.addargument('outfile', nargs='?', type=argparse.FileType('w'),\n...                     default=sys.stdout)\n>>> parser.parseargs(['input.txt', 'output.txt'])\nNamespace(infile=<io.TextIOWrapper name='input.txt' encoding='UTF-8'>,\noutfile=<io.TextIOWrapper name='output.txt' encoding='UTF-8'>)\n>>> parser.parseargs([])\nNamespace(infile=<io.TextIOWrapper name='<stdin>' encoding='UTF-8'>,\noutfile=<io.TextIOWrapper name='<stdout>' encoding='UTF-8'>)\n\n* ''*''.  All command-line arguments present are gathered into a\nlist.  Note that it generally doesn't make much sense to have more\nthan one positional argument with 'nargs='*'', but multiple\noptional arguments with 'nargs='*'' is possible.  For example:\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('--foo', nargs='*')\n>>> parser.addargument('--bar', nargs='*')\n>>> parser.addargument('baz', nargs='*')\n>>> parser.parseargs('a b --foo x y --bar 1 2'.split())\nNamespace(bar=['1', '2'], baz=['a', 'b'], foo=['x', 'y'])\n\n* ''+''.  Just like ''*'', all command-line args present are gathered\ninto a list.  Additionally, an error message will be generated if\nthere wasn't at least one command-line argument present.  For\nexample:\n\n>>> parser = argparse.ArgumentParser(prog='PROG')\n>>> parser.addargument('foo', nargs='+')\n>>> parser.parseargs(['a', 'b'])\nNamespace(foo=['a', 'b'])\n>>> parser.parseargs([])\nusage: PROG [-h] foo [foo ...]\nPROG: error: the following arguments are required: foo\n",
            "subsections": []
        },
        "If the 'nargs' keyword argument is not provided, the number of arguments": {
            "content": "consumed is determined by the *note action: 2956.  Generally this means\na single command-line argument will be consumed and a single item (not a\nlist) will be produced.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: const,  Next: default,  Prev: nargs,  Up: The addargument method": {
            "content": "5.16.4.25 const\n...............\n\nThe 'const' argument of *note addargument(): 14a2. is used to hold\nconstant values that are not read from the command line but are required\nfor the various *note ArgumentParser: 28f. actions.  The two most common\nuses of it are:\n\n* When *note addargument(): 14a2. is called with\n'action='storeconst'' or 'action='appendconst''.  These actions\nadd the 'const' value to one of the attributes of the object\nreturned by *note parseargs(): 2953.  See the *note action: 2956.\ndescription for examples.  If 'const' is not provided to *note\naddargument(): 14a2, it will receive a default value of 'None'.\n\n* When *note addargument(): 14a2. is called with option strings\n(like '-f' or '--foo') and 'nargs='?''.  This creates an optional\nargument that can be followed by zero or one command-line\narguments.  When parsing the command line, if the option string is\nencountered with no command-line argument following it, the value\nof 'const' will be assumed to be 'None' instead.  See the *note\nnargs: 295d. description for examples.\n\nChanged in version 3.11: 'const=None' by default, including when\n'action='appendconst'' or 'action='storeconst''.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: default,  Next: type,  Prev: const,  Up: The addargument method": {
            "content": "5.16.4.26 default\n.................\n",
            "subsections": []
        },
        "All optional arguments and some positional arguments may be omitted at": {
            "content": "the command line.  The 'default' keyword argument of *note\naddargument(): 14a2, whose value defaults to 'None', specifies what\nvalue should be used if the command-line argument is not present.  For\noptional arguments, the 'default' value is used when the option string\nwas not present at the command line:\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('--foo', default=42)\n>>> parser.parseargs(['--foo', '2'])\nNamespace(foo='2')\n>>> parser.parseargs([])\nNamespace(foo=42)\n",
            "subsections": []
        },
        "If the target namespace already has an attribute set, the action": {
            "content": "'default' will not over write it:\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('--foo', default=42)\n>>> parser.parseargs([], namespace=argparse.Namespace(foo=101))\nNamespace(foo=101)\n",
            "subsections": []
        },
        "If the 'default' value is a string, the parser parses the value as if it": {
            "content": "were a command-line argument.  In particular, the parser applies any\n*note type: 2977. conversion argument, if provided, before setting the\nattribute on the *note Namespace: 2954. return value.  Otherwise, the\nparser uses the value as is:\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('--length', default='10', type=int)\n>>> parser.addargument('--width', default=10.5, type=int)\n>>> parser.parseargs()\nNamespace(length=10, width=10.5)\n\nFor positional arguments with *note nargs: 295d. equal to '?' or '*',\nthe 'default' value is used when no command-line argument was present:\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('foo', nargs='?', default=42)\n>>> parser.parseargs(['a'])\nNamespace(foo='a')\n>>> parser.parseargs([])\nNamespace(foo=42)\n\nProviding 'default=argparse.SUPPRESS' causes no attribute to be added if\nthe command-line argument was not present:\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('--foo', default=argparse.SUPPRESS)\n>>> parser.parseargs([])\nNamespace()\n>>> parser.parseargs(['--foo', '1'])\nNamespace(foo='1')\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: type,  Next: choices,  Prev: default,  Up: The addargument method": {
            "content": "5.16.4.27 type\n..............\n",
            "subsections": []
        },
        "By default, the parser reads command-line arguments in as simple": {
            "content": "strings.  However, quite often the command-line string should instead be\ninterpreted as another type, such as a *note float: 4b7. or *note int:\n17e.  The 'type' keyword for *note addargument(): 14a2. allows any\nnecessary type-checking and type conversions to be performed.\n\nIf the *note type: 2977. keyword is used with the *note default: 2959.\nkeyword, the type converter is only applied if the default is a string.\n\nThe argument to 'type' can be any callable that accepts a single string.\nIf the function raises *note ArgumentTypeError: 2983, *note TypeError:\n28e, or *note ValueError: 183, the exception is caught and a nicely\nformatted error message is displayed.  No other exception types are\nhandled.\n\nCommon built-in types and functions can be used as type converters:\n\nimport argparse\nimport pathlib\n\nparser = argparse.ArgumentParser()\nparser.addargument('count', type=int)\nparser.addargument('distance', type=float)\nparser.addargument('street', type=ascii)\nparser.addargument('codepoint', type=ord)\nparser.addargument('sourcefile', type=open)\nparser.addargument('destfile', type=argparse.FileType('w', encoding='latin-1'))\nparser.addargument('datapath', type=pathlib.Path)\n\nUser defined functions can be used as well:\n\n>>> def hyphenated(string):\n...     return '-'.join([word[:4] for word in string.casefold().split()])\n...\n>>> parser = argparse.ArgumentParser()\n>>>  = parser.addargument('shorttitle', type=hyphenated)\n>>> parser.parseargs(['\"The Tale of Two Cities\"'])\nNamespace(shorttitle='\"the-tale-of-two-citi')\n\nThe *note bool(): 17d. function is not recommended as a type converter.",
            "subsections": []
        },
        "All it does is convert empty strings to 'False' and non-empty strings to": {
            "content": "'True'.  This is usually not what is desired.\n",
            "subsections": []
        },
        "In general, the 'type' keyword is a convenience that should only be used": {
            "content": "for simple conversions that can only raise one of the three supported\nexceptions.  Anything with more interesting error-handling or resource\nmanagement should be done downstream after the arguments are parsed.\n",
            "subsections": []
        },
        "For example, JSON or YAML conversions have complex error cases that": {
            "content": "require better reporting than can be given by the 'type' keyword.  A\n*note JSONDecodeError: c7f. would not be well formatted and a *note\nFileNotFoundError: 353. exception would not be handled at all.\n\nEven *note FileType: d87. has its limitations for use with the 'type'\nkeyword.  If one argument uses 'FileType' and then a subsequent argument\nfails, an error is reported but the file is not automatically closed.",
            "subsections": []
        },
        "In this case, it would be better to wait until after the parser has run": {
            "content": "and then use the *note with: 396.-statement to manage the files.\n",
            "subsections": []
        },
        "For type checkers that simply check against a fixed set of values,": {
            "content": "consider using the *note choices: 2957. keyword instead.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: choices,  Next: required,  Prev: type,  Up: The addargument method": {
            "content": "5.16.4.28 choices\n.................\n",
            "subsections": []
        },
        "Some command-line arguments should be selected from a restricted set of": {
            "content": "values.  These can be handled by passing a sequence object as the\n'choices' keyword argument to *note addargument(): 14a2.  When the\ncommand line is parsed, argument values will be checked, and an error\nmessage will be displayed if the argument was not one of the acceptable\nvalues:\n\n>>> parser = argparse.ArgumentParser(prog='game.py')\n>>> parser.addargument('move', choices=['rock', 'paper', 'scissors'])\n>>> parser.parseargs(['rock'])\nNamespace(move='rock')\n>>> parser.parseargs(['fire'])\nusage: game.py [-h] {rock,paper,scissors}\ngame.py: error: argument move: invalid choice: 'fire' (choose from 'rock',\n'paper', 'scissors')\n\nNote that inclusion in the 'choices' sequence is checked after any *note\ntype: 2977. conversions have been performed, so the type of the objects\nin the 'choices' sequence should match the *note type: 2977. specified:\n\n>>> parser = argparse.ArgumentParser(prog='doors.py')\n>>> parser.addargument('door', type=int, choices=range(1, 4))\n>>> print(parser.parseargs(['3']))\nNamespace(door=3)\n>>> parser.parseargs(['4'])\nusage: doors.py [-h] {1,2,3}\ndoors.py: error: argument door: invalid choice: 4 (choose from 1, 2, 3)\n\nAny sequence can be passed as the 'choices' value, so *note list: 3dc.\nobjects, *note tuple: 4b8. objects, and custom sequences are all\nsupported.\n\nUse of *note enum.Enum: 3fd. is not recommended because it is difficult\nto control its appearance in usage, help, and error messages.\n",
            "subsections": []
        },
        "Formatted choices override the default 'metavar' which is normally": {
            "content": "derived from 'dest'.  This is usually what you want because the user\nnever sees the 'dest' parameter.  If this display isn't desirable\n(perhaps because there are many choices), just specify an explicit *note\nmetavar: 295c.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: required,  Next: help,  Prev: choices,  Up: The addargument method": {
            "content": "5.16.4.29 required\n..................\n\nIn general, the *note argparse: 6. module assumes that flags like '-f'\nand '--bar' indicate 'optional' arguments, which can always be omitted\nat the command line.  To make an option 'required', 'True' can be\nspecified for the 'required=' keyword argument to *note addargument():\n14a2.:\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('--foo', required=True)\n>>> parser.parseargs(['--foo', 'BAR'])\nNamespace(foo='BAR')\n>>> parser.parseargs([])\nusage: [-h] --foo FOO\n: error: the following arguments are required: --foo\n\nAs the example shows, if an option is marked as 'required', *note\nparseargs(): 2953. will report an error if that option is not present\nat the command line.\n\nNote: Required options are generally considered bad form because\nusers expect 'options' to be 'optional', and thus they should be\navoided when possible.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: help,  Next: metavar,  Prev: required,  Up: The addargument method": {
            "content": "5.16.4.30 help\n..............\n",
            "subsections": []
        },
        "The 'help' value is a string containing a brief description of the": {
            "content": "argument.  When a user requests help (usually by using '-h' or '--help'\nat the command line), these 'help' descriptions will be displayed with\neach argument:\n\n>>> parser = argparse.ArgumentParser(prog='frobble')\n>>> parser.addargument('--foo', action='storetrue',\n...                     help='foo the bars before frobbling')\n>>> parser.addargument('bar', nargs='+',\n...                     help='one of the bars to be frobbled')\n>>> parser.parseargs(['-h'])\nusage: frobble [-h] [--foo] bar [bar ...]\n\npositional arguments:\nbar     one of the bars to be frobbled\n\noptions:\n-h, --help  show this help message and exit\n--foo   foo the bars before frobbling\n",
            "subsections": []
        },
        "The 'help' strings can include various format specifiers to avoid": {
            "content": "repetition of things like the program name or the argument *note\ndefault: 2959.  The available specifiers include the program name,\n'%(prog)s' and most keyword arguments to *note addargument(): 14a2,\ne.g.  '%(default)s', '%(type)s', etc.:\n\n>>> parser = argparse.ArgumentParser(prog='frobble')\n>>> parser.addargument('bar', nargs='?', type=int, default=42,\n...                     help='the bar to %(prog)s (default: %(default)s)')\n>>> parser.printhelp()\nusage: frobble [-h] [bar]\n\npositional arguments:\nbar     the bar to frobble (default: 42)\n\noptions:\n-h, --help  show this help message and exit\n\nAs the help string supports %-formatting, if you want a literal '%' to\nappear in the help string, you must escape it as '%%'.\n\n*note argparse: 6. supports silencing the help entry for certain\noptions, by setting the 'help' value to 'argparse.SUPPRESS':\n\n>>> parser = argparse.ArgumentParser(prog='frobble')\n>>> parser.addargument('--foo', help=argparse.SUPPRESS)\n>>> parser.printhelp()\nusage: frobble [-h]\n\noptions:\n-h, --help  show this help message and exit\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: metavar,  Next: dest,  Prev: help,  Up: The addargument method": {
            "content": "5.16.4.31 metavar\n.................\n\nWhen *note ArgumentParser: 28f. generates help messages, it needs some\nway to refer to each expected argument.  By default, ArgumentParser\nobjects use the *note dest: 295a. value as the \"name\" of each object.\nBy default, for positional argument actions, the *note dest: 295a. value\nis used directly, and for optional argument actions, the *note dest:\n295a. value is uppercased.  So, a single positional argument with\n'dest='bar'' will be referred to as 'bar'.  A single optional argument\n'--foo' that should be followed by a single command-line argument will\nbe referred to as 'FOO'.  An example:\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('--foo')\n>>> parser.addargument('bar')\n>>> parser.parseargs('X --foo Y'.split())\nNamespace(bar='X', foo='Y')\n>>> parser.printhelp()\nusage:  [-h] [--foo FOO] bar\n\npositional arguments:\nbar\n\noptions:\n-h, --help  show this help message and exit\n--foo FOO\n\nAn alternative name can be specified with 'metavar':\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('--foo', metavar='YYY')\n>>> parser.addargument('bar', metavar='XXX')\n>>> parser.parseargs('X --foo Y'.split())\nNamespace(bar='X', foo='Y')\n>>> parser.printhelp()\nusage:  [-h] [--foo YYY] XXX\n\npositional arguments:\nXXX\n\noptions:\n-h, --help  show this help message and exit\n--foo YYY\n",
            "subsections": []
        },
        "Note that 'metavar' only changes the 'displayed' name - the name of the": {
            "content": "attribute on the *note parseargs(): 2953. object is still determined by\nthe *note dest: 295a. value.\n",
            "subsections": []
        },
        "Different values of 'nargs' may cause the metavar to be used multiple": {
            "content": "times.  Providing a tuple to 'metavar' specifies a different display for\neach of the arguments:\n\n>>> parser = argparse.ArgumentParser(prog='PROG')\n>>> parser.addargument('-x', nargs=2)\n>>> parser.addargument('--foo', nargs=2, metavar=('bar', 'baz'))\n>>> parser.printhelp()\nusage: PROG [-h] [-x X X] [--foo bar baz]\n\noptions:\n-h, --help     show this help message and exit\n-x X X\n--foo bar baz\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: dest,  Next: Action classes,  Prev: metavar,  Up: The addargument method": {
            "content": "5.16.4.32 dest\n..............\n\nMost *note ArgumentParser: 28f. actions add some value as an attribute\nof the object returned by *note parseargs(): 2953.  The name of this\nattribute is determined by the 'dest' keyword argument of *note\naddargument(): 14a2.  For positional argument actions, 'dest' is\nnormally supplied as the first argument to *note addargument(): 14a2.:\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('bar')\n>>> parser.parseargs(['XXX'])\nNamespace(bar='XXX')\n",
            "subsections": []
        },
        "For optional argument actions, the value of 'dest' is normally inferred": {
            "content": "from the option strings.  *note ArgumentParser: 28f. generates the value\nof 'dest' by taking the first long option string and stripping away the\ninitial '--' string.  If no long option strings were supplied, 'dest'\nwill be derived from the first short option string by stripping the\ninitial '-' character.  Any internal '-' characters will be converted to\n'' characters to make sure the string is a valid attribute name.  The\nexamples below illustrate this behavior:\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('-f', '--foo-bar', '--foo')\n>>> parser.addargument('-x', '-y')\n>>> parser.parseargs('-f 1 -x 2'.split())\nNamespace(foobar='1', x='2')\n>>> parser.parseargs('--foo 1 -y 2'.split())\nNamespace(foobar='1', x='2')\n\n'dest' allows a custom attribute name to be provided:\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('--foo', dest='bar')\n>>> parser.parseargs('--foo XXX'.split())\nNamespace(bar='XXX')\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Action classes,  Prev: dest,  Up: The addargument method": {
            "content": "5.16.4.33 Action classes\n........................\n",
            "subsections": []
        },
        "Action classes implement the Action API, a callable which returns a": {
            "content": "callable which processes arguments from the command-line.  Any object\nwhich follows this API may be passed as the 'action' parameter to *note\naddargument(): 14a2.\n\n-- Class: argparse.Action (optionstrings, dest, nargs=None,\nconst=None, default=None, type=None, choices=None,\nrequired=False, help=None, metavar=None)\n",
            "subsections": []
        },
        "Action objects are used by an ArgumentParser to represent the": {
            "content": "information needed to parse a single argument from one or more strings\nfrom the command line.  The Action class must accept the two positional\narguments plus any keyword arguments passed to *note\nArgumentParser.addargument(): 14a2. except for the 'action' itself.\n",
            "subsections": []
        },
        "Instances of Action (or return value of any callable to the 'action'": {
            "content": "parameter) should have attributes \"dest\", \"optionstrings\", \"default\",\n\"type\", \"required\", \"help\", etc.  defined.  The easiest way to ensure\nthese attributes are defined is to call 'Action.init'.\n",
            "subsections": []
        },
        "Action instances should be callable, so subclasses must override the": {
            "content": "'call' method, which should accept four parameters:\n\n* 'parser' - The ArgumentParser object which contains this action.\n\n* 'namespace' - The *note Namespace: 2954. object that will be\nreturned by *note parseargs(): 2953.  Most actions add an\nattribute to this object using *note setattr(): 1e63.\n\n* 'values' - The associated command-line arguments, with any type\nconversions applied.  Type conversions are specified with the *note\ntype: 2977. keyword argument to *note addargument(): 14a2.\n\n* 'optionstring' - The option string that was used to invoke this\naction.  The 'optionstring' argument is optional, and will be\nabsent if the action is associated with a positional argument.\n",
            "subsections": []
        },
        "The 'call' method may perform arbitrary actions, but will typically": {
            "content": "set attributes on the 'namespace' based on 'dest' and 'values'.\n",
            "subsections": []
        },
        "Action subclasses can define a 'formatusage' method that takes no": {
            "content": "argument and return a string which will be used when printing the usage\nof the program.  If such method is not provided, a sensible default will\nbe used.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The parseargs method,  Next: Other utilities,  Prev: The addargument method,  Up: argparse -- Parser for command-line options arguments and sub-commands": {
            "content": "5.16.4.34 The parseargs() method\n.................................\n\n-- Method: ArgumentParser.parseargs (args=None, namespace=None)\n\nConvert argument strings to objects and assign them as attributes\nof the namespace.  Return the populated namespace.\n\nPrevious calls to *note addargument(): 14a2. determine exactly\nwhat objects are created and how they are assigned.  See the\ndocumentation for *note addargument(): 14a2. for details.\n\n* *note args: 298b. - List of strings to parse.  The default is\ntaken from *note sys.argv: 10dd.\n\n* *note namespace: 298c. - An object to take the attributes.\nThe default is a new empty *note Namespace: 2954. object.\n\n* Menu:\n\n* Option value syntax::\n* Invalid arguments::\n* Arguments containing -::\n* Argument abbreviations (prefix matching): Argument abbreviations prefix matching.\n* Beyond sys.argv: Beyond sys argv.\n* The Namespace object::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Option value syntax,  Next: Invalid arguments,  Up: The parseargs method": {
            "content": "5.16.4.35 Option value syntax\n.............................\n\nThe *note parseargs(): 2953. method supports several ways of specifying\nthe value of an option (if it takes one).  In the simplest case, the\noption and its value are passed as two separate arguments:\n\n>>> parser = argparse.ArgumentParser(prog='PROG')\n>>> parser.addargument('-x')\n>>> parser.addargument('--foo')\n>>> parser.parseargs(['-x', 'X'])\nNamespace(foo=None, x='X')\n>>> parser.parseargs(['--foo', 'FOO'])\nNamespace(foo='FOO', x=None)\n",
            "subsections": []
        },
        "For long options (options with names longer than a single character),": {
            "content": "the option and value can also be passed as a single command-line\nargument, using '=' to separate them:\n\n>>> parser.parseargs(['--foo=FOO'])\nNamespace(foo='FOO', x=None)\n",
            "subsections": []
        },
        "For short options (options only one character long), the option and its": {
            "content": "value can be concatenated:\n\n>>> parser.parseargs(['-xX'])\nNamespace(foo=None, x='X')\n",
            "subsections": []
        },
        "Several short options can be joined together, using only a single '-'": {
            "content": "prefix, as long as only the last option (or none of them) requires a\nvalue:\n\n>>> parser = argparse.ArgumentParser(prog='PROG')\n>>> parser.addargument('-x', action='storetrue')\n>>> parser.addargument('-y', action='storetrue')\n>>> parser.addargument('-z')\n>>> parser.parseargs(['-xyzZ'])\nNamespace(x=True, y=True, z='Z')\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Invalid arguments,  Next: Arguments containing -,  Prev: Option value syntax,  Up: The parseargs method": {
            "content": "5.16.4.36 Invalid arguments\n...........................\n\nWhile parsing the command line, *note parseargs(): 2953. checks for a\nvariety of errors, including ambiguous options, invalid types, invalid\noptions, wrong number of positional arguments, etc.  When it encounters\nsuch an error, it exits and prints the error along with a usage message:\n\n>>> parser = argparse.ArgumentParser(prog='PROG')\n>>> parser.addargument('--foo', type=int)\n>>> parser.addargument('bar', nargs='?')\n\n>>> # invalid type\n>>> parser.parseargs(['--foo', 'spam'])\nusage: PROG [-h] [--foo FOO] [bar]\nPROG: error: argument --foo: invalid int value: 'spam'\n\n>>> # invalid option\n>>> parser.parseargs(['--bar'])\nusage: PROG [-h] [--foo FOO] [bar]\nPROG: error: no such option: --bar\n\n>>> # wrong number of arguments\n>>> parser.parseargs(['spam', 'badger'])\nusage: PROG [-h] [--foo FOO] [bar]\nPROG: error: extra arguments found: badger\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Arguments containing -,  Next: Argument abbreviations prefix matching,  Prev: Invalid arguments,  Up: The parseargs method": {
            "content": "5.16.4.37 Arguments containing '-'\n..................................\n\nThe *note parseargs(): 2953. method attempts to give errors whenever\nthe user has clearly made a mistake, but some situations are inherently\nambiguous.  For example, the command-line argument '-1' could either be\nan attempt to specify an option or an attempt to provide a positional\nargument.  The *note parseargs(): 2953. method is cautious here:\npositional arguments may only begin with '-' if they look like negative\nnumbers and there are no options in the parser that look like negative\nnumbers:\n\n>>> parser = argparse.ArgumentParser(prog='PROG')\n>>> parser.addargument('-x')\n>>> parser.addargument('foo', nargs='?')\n\n>>> # no negative number options, so -1 is a positional argument\n>>> parser.parseargs(['-x', '-1'])\nNamespace(foo=None, x='-1')\n\n>>> # no negative number options, so -1 and -5 are positional arguments\n>>> parser.parseargs(['-x', '-1', '-5'])\nNamespace(foo='-5', x='-1')\n\n>>> parser = argparse.ArgumentParser(prog='PROG')\n>>> parser.addargument('-1', dest='one')\n>>> parser.addargument('foo', nargs='?')\n\n>>> # negative number options present, so -1 is an option\n>>> parser.parseargs(['-1', 'X'])\nNamespace(foo=None, one='X')\n\n>>> # negative number options present, so -2 is an option\n>>> parser.parseargs(['-2'])\nusage: PROG [-h] [-1 ONE] [foo]\nPROG: error: no such option: -2\n\n>>> # negative number options present, so both -1s are options\n>>> parser.parseargs(['-1', '-1'])\nusage: PROG [-h] [-1 ONE] [foo]\nPROG: error: argument -1: expected one argument\n",
            "subsections": []
        },
        "If you have positional arguments that must begin with '-' and don't look": {
            "content": "like negative numbers, you can insert the pseudo-argument ''--'' which\ntells *note parseargs(): 2953. that everything after that is a\npositional argument:\n\n>>> parser.parseargs(['--', '-f'])\nNamespace(foo='-f', one=None)\n\nSee also *note the argparse howto on ambiguous arguments: 2980. for more\ndetails.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Argument abbreviations prefix matching,  Next: Beyond sys argv,  Prev: Arguments containing -,  Up: The parseargs method": {
            "content": "5.16.4.38 Argument abbreviations (prefix matching)\n..................................................\n\nThe *note parseargs(): 2953. method *note by default: c1c. allows long\noptions to be abbreviated to a prefix, if the abbreviation is\nunambiguous (the prefix matches a unique option):\n\n>>> parser = argparse.ArgumentParser(prog='PROG')\n>>> parser.addargument('-bacon')\n>>> parser.addargument('-badger')\n>>> parser.parseargs('-bac MMM'.split())\nNamespace(bacon='MMM', badger=None)\n>>> parser.parseargs('-bad WOOD'.split())\nNamespace(bacon=None, badger='WOOD')\n>>> parser.parseargs('-ba BA'.split())\nusage: PROG [-h] [-bacon BACON] [-badger BADGER]\nPROG: error: ambiguous option: -ba could match -badger, -bacon\n",
            "subsections": []
        },
        "An error is produced for arguments that could produce more than one": {
            "content": "options.  This feature can be disabled by setting *note allowabbrev:\nc1c. to 'False'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Beyond sys argv,  Next: The Namespace object,  Prev: Argument abbreviations prefix matching,  Up: The parseargs method": {
            "content": "5.16.4.39 Beyond 'sys.argv'\n...........................\n",
            "subsections": []
        },
        "Sometimes it may be useful to have an ArgumentParser parse arguments": {
            "content": "other than those of *note sys.argv: 10dd.  This can be accomplished by\npassing a list of strings to *note parseargs(): 2953.  This is useful\nfor testing at the interactive prompt:\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument(\n...     'integers', metavar='int', type=int, choices=range(10),\n...     nargs='+', help='an integer in the range 0..9')\n>>> parser.addargument(\n...     '--sum', dest='accumulate', action='storeconst', const=sum,\n...     default=max, help='sum the integers (default: find the max)')\n>>> parser.parseargs(['1', '2', '3', '4'])\nNamespace(accumulate=<built-in function max>, integers=[1, 2, 3, 4])\n>>> parser.parseargs(['1', '2', '3', '4', '--sum'])\nNamespace(accumulate=<built-in function sum>, integers=[1, 2, 3, 4])\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The Namespace object,  Prev: Beyond sys argv,  Up: The parseargs method": {
            "content": "5.16.4.40 The Namespace object\n..............................\n\n-- Class: argparse.Namespace\n\nSimple class used by default by *note parseargs(): 2953. to create\nan object holding attributes and return it.\n\nThis class is deliberately simple, just an *note object: 8bb. subclass\nwith a readable string representation.  If you prefer to have dict-like\nview of the attributes, you can use the standard Python idiom, *note\nvars(): 17c1.:\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('--foo')\n>>> args = parser.parseargs(['--foo', 'BAR'])\n>>> vars(args)\n{'foo': 'BAR'}\n\nIt may also be useful to have an *note ArgumentParser: 28f. assign\nattributes to an already existing object, rather than a new *note",
            "subsections": []
        },
        "Namespace: 2954. object.  This can be achieved by specifying the": {
            "content": "'namespace=' keyword argument:\n\n>>> class C:\n...     pass\n...\n>>> c = C()\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('--foo')\n>>> parser.parseargs(args=['--foo', 'BAR'], namespace=c)\n>>> c.foo\n'BAR'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Other utilities,  Next: Upgrading optparse code,  Prev: The parseargs method,  Up: argparse -- Parser for command-line options arguments and sub-commands": {
            "content": "5.16.4.41 Other utilities\n.........................\n\n* Menu:\n\n* Sub-commands::\n* FileType objects::\n* Argument groups::\n* Mutual exclusion::\n* Parser defaults::\n* Printing help::\n* Partial parsing::\n* Customizing file parsing::\n* Exiting methods::\n* Intermixed parsing::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Sub-commands,  Next: FileType objects,  Up: Other utilities": {
            "content": "5.16.4.42 Sub-commands\n......................\n\n-- Method: ArgumentParser.addsubparsers ([title][, description][,\nprog][, parserclass][, action][, optionstrings][, dest][,\nrequired][, help][, metavar])\n\nMany programs split up their functionality into a number of\nsub-commands, for example, the 'svn' program can invoke\nsub-commands like 'svn checkout', 'svn update', and 'svn commit'.\nSplitting up functionality this way can be a particularly good idea\nwhen a program performs several different functions which require\ndifferent kinds of command-line arguments.  *note ArgumentParser:\n28f. supports the creation of such sub-commands with the *note\naddsubparsers(): a5d. method.  The *note addsubparsers(): a5d.\nmethod is normally called with no arguments and returns a special\naction object.  This object has a single method, 'addparser()',\nwhich takes a command name and any *note ArgumentParser: 28f.\nconstructor arguments, and returns an *note ArgumentParser: 28f.\nobject that can be modified as usual.\n\nDescription of parameters:\n\n* title - title for the sub-parser group in help output; by\ndefault \"subcommands\" if description is provided, otherwise\nuses title for positional arguments\n\n* description - description for the sub-parser group in help\noutput, by default 'None'\n\n* prog - usage information that will be displayed with\nsub-command help, by default the name of the program and any\npositional arguments before the subparser argument\n\n* parserclass - class which will be used to create sub-parser\ninstances, by default the class of the current parser (e.g.\nArgumentParser)\n\n* *note action: 2956. - the basic type of action to be taken\nwhen this argument is encountered at the command line\n\n* *note dest: 295a. - name of the attribute under which\nsub-command name will be stored; by default 'None' and no\nvalue is stored\n\n* *note required: 295e. - Whether or not a subcommand must be\nprovided, by default 'False' (added in 3.7)\n\n* *note help: 295b. - help for sub-parser group in help output,\nby default 'None'\n\n* *note metavar: 295c. - string presenting available\nsub-commands in help; by default it is 'None' and presents\nsub-commands in form {cmd1, cmd2, ..}\n\nSome example usage:\n\n>>> # create the top-level parser\n>>> parser = argparse.ArgumentParser(prog='PROG')\n>>> parser.addargument('--foo', action='storetrue', help='foo help')\n>>> subparsers = parser.addsubparsers(help='sub-command help')\n>>>\n>>> # create the parser for the \"a\" command\n>>> parsera = subparsers.addparser('a', help='a help')\n>>> parsera.addargument('bar', type=int, help='bar help')\n>>>\n>>> # create the parser for the \"b\" command\n>>> parserb = subparsers.addparser('b', help='b help')\n>>> parserb.addargument('--baz', choices='XYZ', help='baz help')\n>>>\n>>> # parse some argument lists\n>>> parser.parseargs(['a', '12'])\nNamespace(bar=12, foo=False)\n>>> parser.parseargs(['--foo', 'b', '--baz', 'Z'])\nNamespace(baz='Z', foo=True)\n\nNote that the object returned by *note parseargs(): 2953. will\nonly contain attributes for the main parser and the subparser that\nwas selected by the command line (and not any other subparsers).\nSo in the example above, when the 'a' command is specified, only\nthe 'foo' and 'bar' attributes are present, and when the 'b'\ncommand is specified, only the 'foo' and 'baz' attributes are\npresent.\n\nSimilarly, when a help message is requested from a subparser, only\nthe help for that particular parser will be printed.  The help\nmessage will not include parent parser or sibling parser messages.\n(A help message for each subparser command, however, can be given\nby supplying the 'help=' argument to 'addparser()' as above.)\n\n>>> parser.parseargs(['--help'])\nusage: PROG [-h] [--foo] {a,b} ...\n\npositional arguments:\n{a,b}   sub-command help\na     a help\nb     b help\n\noptions:\n-h, --help  show this help message and exit\n--foo   foo help\n\n>>> parser.parseargs(['a', '--help'])\nusage: PROG a [-h] bar\n\npositional arguments:\nbar     bar help\n\noptions:\n-h, --help  show this help message and exit\n\n>>> parser.parseargs(['b', '--help'])\nusage: PROG b [-h] [--baz {X,Y,Z}]\n\noptions:\n-h, --help     show this help message and exit\n--baz {X,Y,Z}  baz help\n\nThe *note addsubparsers(): a5d. method also supports 'title' and\n'description' keyword arguments.  When either is present, the\nsubparser's commands will appear in their own group in the help\noutput.  For example:\n\n>>> parser = argparse.ArgumentParser()\n>>> subparsers = parser.addsubparsers(title='subcommands',\n...                                    description='valid subcommands',\n...                                    help='additional help')\n>>> subparsers.addparser('foo')\n>>> subparsers.addparser('bar')\n>>> parser.parseargs(['-h'])\nusage:  [-h] {foo,bar} ...\n\noptions:\n-h, --help  show this help message and exit\n\nsubcommands:\nvalid subcommands\n\n{foo,bar}   additional help\n\nFurthermore, 'addparser' supports an additional 'aliases'\nargument, which allows multiple strings to refer to the same\nsubparser.  This example, like 'svn', aliases 'co' as a shorthand\nfor 'checkout':\n\n>>> parser = argparse.ArgumentParser()\n>>> subparsers = parser.addsubparsers()\n>>> checkout = subparsers.addparser('checkout', aliases=['co'])\n>>> checkout.addargument('foo')\n>>> parser.parseargs(['co', 'bar'])\nNamespace(foo='bar')\n\nOne particularly effective way of handling sub-commands is to\ncombine the use of the *note addsubparsers(): a5d. method with\ncalls to *note setdefaults(): 2979. so that each subparser knows\nwhich Python function it should execute.  For example:\n\n>>> # sub-command functions\n>>> def foo(args):\n...     print(args.x * args.y)\n...\n>>> def bar(args):\n...     print('((%s))' % args.z)\n...\n>>> # create the top-level parser\n>>> parser = argparse.ArgumentParser()\n>>> subparsers = parser.addsubparsers(required=True)\n>>>\n>>> # create the parser for the \"foo\" command\n>>> parserfoo = subparsers.addparser('foo')\n>>> parserfoo.addargument('-x', type=int, default=1)\n>>> parserfoo.addargument('y', type=float)\n>>> parserfoo.setdefaults(func=foo)\n>>>\n>>> # create the parser for the \"bar\" command\n>>> parserbar = subparsers.addparser('bar')\n>>> parserbar.addargument('z')\n>>> parserbar.setdefaults(func=bar)\n>>>\n>>> # parse the args and call whatever function was selected\n>>> args = parser.parseargs('foo 1 -x 2'.split())\n>>> args.func(args)\n2.0\n>>>\n>>> # parse the args and call whatever function was selected\n>>> args = parser.parseargs('bar XYZYX'.split())\n>>> args.func(args)\n((XYZYX))\n\nThis way, you can let *note parseargs(): 2953. do the job of\ncalling the appropriate function after argument parsing is\ncomplete.  Associating functions with actions like this is\ntypically the easiest way to handle the different actions for each\nof your subparsers.  However, if it is necessary to check the name\nof the subparser that was invoked, the 'dest' keyword argument to\nthe *note addsubparsers(): a5d. call will work:\n\n>>> parser = argparse.ArgumentParser()\n>>> subparsers = parser.addsubparsers(dest='subparsername')\n>>> subparser1 = subparsers.addparser('1')\n>>> subparser1.addargument('-x')\n>>> subparser2 = subparsers.addparser('2')\n>>> subparser2.addargument('y')\n>>> parser.parseargs(['2', 'frobble'])\nNamespace(subparsername='2', y='frobble')\n\nChanged in version 3.7: New 'required' keyword argument.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: FileType objects,  Next: Argument groups,  Prev: Sub-commands,  Up: Other utilities": {
            "content": "5.16.4.43 FileType objects\n..........................\n\n-- Class: argparse.FileType (mode='r', bufsize=-1, encoding=None,\nerrors=None)\n\nThe *note FileType: d87. factory creates objects that can be passed\nto the type argument of *note ArgumentParser.addargument(): 14a2.\nArguments that have *note FileType: d87. objects as their type will\nopen command-line arguments as files with the requested modes,\nbuffer sizes, encodings and error handling (see the *note open():\n26e. function for more details):\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('--raw', type=argparse.FileType('wb', 0))\n>>> parser.addargument('out', type=argparse.FileType('w', encoding='UTF-8'))\n>>> parser.parseargs(['--raw', 'raw.dat', 'file.txt'])\nNamespace(out=<io.TextIOWrapper name='file.txt' mode='w' encoding='UTF-8'>, raw=<io.FileIO name='raw.dat' mode='wb'>)\n\nFileType objects understand the pseudo-argument ''-'' and\nautomatically convert this into *note sys.stdin: 293. for readable\n*note FileType: d87. objects and *note sys.stdout: 90c. for\nwritable *note FileType: d87. objects:\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('infile', type=argparse.FileType('r'))\n>>> parser.parseargs(['-'])\nNamespace(infile=<io.TextIOWrapper name='<stdin>' encoding='UTF-8'>)\n\nChanged in version 3.4: Added the 'encodings' and 'errors'\nparameters.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Argument groups,  Next: Mutual exclusion,  Prev: FileType objects,  Up: Other utilities": {
            "content": "5.16.4.44 Argument groups\n.........................\n\n-- Method: ArgumentParser.addargumentgroup (title=None,\ndescription=None)\n\nBy default, *note ArgumentParser: 28f. groups command-line\narguments into \"positional arguments\" and \"options\" when displaying\nhelp messages.  When there is a better conceptual grouping of\narguments than this default one, appropriate groups can be created\nusing the *note addargumentgroup(): 2997. method:\n\n>>> parser = argparse.ArgumentParser(prog='PROG', addhelp=False)\n>>> group = parser.addargumentgroup('group')\n>>> group.addargument('--foo', help='foo help')\n>>> group.addargument('bar', help='bar help')\n>>> parser.printhelp()\nusage: PROG [--foo FOO] bar\n\ngroup:\nbar    bar help\n--foo FOO  foo help\n\nThe *note addargumentgroup(): 2997. method returns an argument\ngroup object which has an *note addargument(): 14a2. method just\nlike a regular *note ArgumentParser: 28f.  When an argument is\nadded to the group, the parser treats it just like a normal\nargument, but displays the argument in a separate group for help\nmessages.  The *note addargumentgroup(): 2997. method accepts\n'title' and 'description' arguments which can be used to customize\nthis display:\n\n>>> parser = argparse.ArgumentParser(prog='PROG', addhelp=False)\n>>> group1 = parser.addargumentgroup('group1', 'group1 description')\n>>> group1.addargument('foo', help='foo help')\n>>> group2 = parser.addargumentgroup('group2', 'group2 description')\n>>> group2.addargument('--bar', help='bar help')\n>>> parser.printhelp()\nusage: PROG [--bar BAR] foo\n\ngroup1:\ngroup1 description\n\nfoo    foo help\n\ngroup2:\ngroup2 description\n\n--bar BAR  bar help\n\nNote that any arguments not in your user-defined groups will end up\nback in the usual \"positional arguments\" and \"optional arguments\"\nsections.\n\nChanged in version 3.11: Calling *note addargumentgroup(): 2997.\non an argument group is deprecated.  This feature was never\nsupported and does not always work correctly.  The function exists\non the API by accident through inheritance and will be removed in\nthe future.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Mutual exclusion,  Next: Parser defaults,  Prev: Argument groups,  Up: Other utilities": {
            "content": "5.16.4.45 Mutual exclusion\n..........................\n\n-- Method: ArgumentParser.addmutuallyexclusivegroup (required=False)\n\nCreate a mutually exclusive group.  *note argparse: 6. will make\nsure that only one of the arguments in the mutually exclusive group\nwas present on the command line:\n\n>>> parser = argparse.ArgumentParser(prog='PROG')\n>>> group = parser.addmutuallyexclusivegroup()\n>>> group.addargument('--foo', action='storetrue')\n>>> group.addargument('--bar', action='storefalse')\n>>> parser.parseargs(['--foo'])\nNamespace(bar=True, foo=True)\n>>> parser.parseargs(['--bar'])\nNamespace(bar=False, foo=False)\n>>> parser.parseargs(['--foo', '--bar'])\nusage: PROG [-h] [--foo | --bar]\nPROG: error: argument --bar: not allowed with argument --foo\n\nThe *note addmutuallyexclusivegroup(): 2999. method also accepts\na 'required' argument, to indicate that at least one of the\nmutually exclusive arguments is required:\n\n>>> parser = argparse.ArgumentParser(prog='PROG')\n>>> group = parser.addmutuallyexclusivegroup(required=True)\n>>> group.addargument('--foo', action='storetrue')\n>>> group.addargument('--bar', action='storefalse')\n>>> parser.parseargs([])\nusage: PROG [-h] (--foo | --bar)\nPROG: error: one of the arguments --foo --bar is required\n\nNote that currently mutually exclusive argument groups do not\nsupport the 'title' and 'description' arguments of *note\naddargumentgroup(): 2997.  However, a mutually exclusive group\ncan be added to an argument group that has a title and description.\nFor example:\n\n>>> parser = argparse.ArgumentParser(prog='PROG')\n>>> group = parser.addargumentgroup('Group title', 'Group description')\n>>> exclusivegroup = group.addmutuallyexclusivegroup(required=True)\n>>> exclusivegroup.addargument('--foo', help='foo help')\n>>> exclusivegroup.addargument('--bar', help='bar help')\n>>> parser.printhelp()\nusage: PROG [-h] (--foo FOO | --bar BAR)\n\noptions:\n-h, --help  show this help message and exit\n\nGroup title:\nGroup description\n\n--foo FOO   foo help\n--bar BAR   bar help\n\nChanged in version 3.11: Calling *note addargumentgroup(): 2997.\nor *note addmutuallyexclusivegroup(): 2999. on a mutually\nexclusive group is deprecated.  These features were never supported\nand do not always work correctly.  The functions exist on the API\nby accident through inheritance and will be removed in the future.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Parser defaults,  Next: Printing help,  Prev: Mutual exclusion,  Up: Other utilities": {
            "content": "5.16.4.46 Parser defaults\n.........................\n\n-- Method: ArgumentParser.setdefaults (kwargs)\n\nMost of the time, the attributes of the object returned by *note\nparseargs(): 2953. will be fully determined by inspecting the\ncommand-line arguments and the argument actions.  *note\nsetdefaults(): 2979. allows some additional attributes that are\ndetermined without any inspection of the command line to be added:\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('foo', type=int)\n>>> parser.setdefaults(bar=42, baz='badger')\n>>> parser.parseargs(['736'])\nNamespace(bar=42, baz='badger', foo=736)\n\nNote that parser-level defaults always override argument-level\ndefaults:\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('--foo', default='bar')\n>>> parser.setdefaults(foo='spam')\n>>> parser.parseargs([])\nNamespace(foo='spam')\n\nParser-level defaults can be particularly useful when working with\nmultiple parsers.  See the *note addsubparsers(): a5d. method for\nan example of this type.\n\n-- Method: ArgumentParser.getdefault (dest)\n\nGet the default value for a namespace attribute, as set by either\n*note addargument(): 14a2. or by *note setdefaults(): 2979.:\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('--foo', default='badger')\n>>> parser.getdefault('foo')\n'badger'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Printing help,  Next: Partial parsing,  Prev: Parser defaults,  Up: Other utilities": {
            "content": "5.16.4.47 Printing help\n.......................\n\nIn most typical applications, *note parseargs(): 2953. will take care\nof formatting and printing any usage or error messages.  However,\nseveral formatting methods are available:\n\n-- Method: ArgumentParser.printusage (file=None)\n\nPrint a brief description of how the *note ArgumentParser: 28f.\nshould be invoked on the command line.  If 'file' is 'None', *note\nsys.stdout: 90c. is assumed.\n\n-- Method: ArgumentParser.printhelp (file=None)\n\nPrint a help message, including the program usage and information\nabout the arguments registered with the *note ArgumentParser: 28f.\nIf 'file' is 'None', *note sys.stdout: 90c. is assumed.\n",
            "subsections": []
        },
        "There are also variants of these methods that simply return a string": {
            "content": "instead of printing it:\n\n-- Method: ArgumentParser.formatusage ()\n\nReturn a string containing a brief description of how the *note\nArgumentParser: 28f. should be invoked on the command line.\n\n-- Method: ArgumentParser.formathelp ()\n\nReturn a string containing a help message, including the program\nusage and information about the arguments registered with the *note\nArgumentParser: 28f.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Partial parsing,  Next: Customizing file parsing,  Prev: Printing help,  Up: Other utilities": {
            "content": "5.16.4.48 Partial parsing\n.........................\n\n-- Method: ArgumentParser.parseknownargs (args=None, namespace=None)\n",
            "subsections": []
        },
        "Sometimes a script may only parse a few of the command-line arguments,": {
            "content": "passing the remaining arguments on to another script or program.  In\nthese cases, the *note parseknownargs(): 29a1. method can be useful.\nIt works much like *note parseargs(): 2953. except that it does not\nproduce an error when extra arguments are present.  Instead, it returns\na two item tuple containing the populated namespace and the list of\nremaining argument strings.\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('--foo', action='storetrue')\n>>> parser.addargument('bar')\n>>> parser.parseknownargs(['--foo', '--badger', 'BAR', 'spam'])\n(Namespace(bar='BAR', foo=True), ['--badger', 'spam'])\n\nWarning: *note Prefix matching: c1b. rules apply to *note\nparseknownargs(): 29a1.  The parser may consume an option even if\nit's just a prefix of one of its known options, instead of leaving\nit in the remaining arguments list.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Customizing file parsing,  Next: Exiting methods,  Prev: Partial parsing,  Up: Other utilities": {
            "content": "5.16.4.49 Customizing file parsing\n..................................\n\n-- Method: ArgumentParser.convertarglinetoargs (argline)\n\nArguments that are read from a file (see the\n'fromfileprefixchars' keyword argument to the *note\nArgumentParser: 28f. constructor) are read one argument per line.\n*note convertarglinetoargs(): 2978. can be overridden for\nfancier reading.\n\nThis method takes a single argument 'argline' which is a string\nread from the argument file.  It returns a list of arguments parsed\nfrom this string.  The method is called once per line read from the\nargument file, in order.\n\nA useful override of this method is one that treats each\nspace-separated word as an argument.  The following example\ndemonstrates how to do this:\n\nclass MyArgumentParser(argparse.ArgumentParser):\ndef convertarglinetoargs(self, argline):\nreturn argline.split()\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Exiting methods,  Next: Intermixed parsing,  Prev: Customizing file parsing,  Up: Other utilities": {
            "content": "5.16.4.50 Exiting methods\n.........................\n\n-- Method: ArgumentParser.exit (status=0, message=None)\n\nThis method terminates the program, exiting with the specified\n'status' and, if given, it prints a 'message' before that.  The\nuser can override this method to handle these steps differently:\n\nclass ErrorCatchingArgumentParser(argparse.ArgumentParser):\ndef exit(self, status=0, message=None):\nif status:\nraise Exception(f'Exiting because of an error: {message}')\nexit(status)\n\n-- Method: ArgumentParser.error (message)\n\nThis method prints a usage message including the 'message' to the\nstandard error and terminates the program with a status code of 2.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Intermixed parsing,  Prev: Exiting methods,  Up: Other utilities": {
            "content": "5.16.4.51 Intermixed parsing\n............................\n\n-- Method: ArgumentParser.parseintermixedargs (args=None,\nnamespace=None)\n\n-- Method: ArgumentParser.parseknownintermixedargs (args=None,\nnamespace=None)\n\nA number of Unix commands allow the user to intermix optional arguments\nwith positional arguments.  The *note parseintermixedargs(): 937. and\n*note parseknownintermixedargs(): 29a7. methods support this parsing\nstyle.\n",
            "subsections": []
        },
        "These parsers do not support all the argparse features, and will raise": {
            "content": "exceptions if unsupported features are used.  In particular, subparsers,\nand mutually exclusive groups that include both optionals and\npositionals are not supported.\n\nThe following example shows the difference between *note\nparseknownargs(): 29a1. and *note parseintermixedargs(): 937.: the\nformer returns '['2', '3']' as unparsed arguments, while the latter\ncollects all the positionals into 'rest'.\n\n>>> parser = argparse.ArgumentParser()\n>>> parser.addargument('--foo')\n>>> parser.addargument('cmd')\n>>> parser.addargument('rest', nargs='*', type=int)\n>>> parser.parseknownargs('doit 1 --foo bar 2 3'.split())\n(Namespace(cmd='doit', foo='bar', rest=[1]), ['2', '3'])\n>>> parser.parseintermixedargs('doit 1 --foo bar 2 3'.split())\nNamespace(cmd='doit', foo='bar', rest=[1, 2, 3])\n\n*note parseknownintermixedargs(): 29a7. returns a two item tuple\ncontaining the populated namespace and the list of remaining argument\nstrings.  *note parseintermixedargs(): 937. raises an error if there\nare any remaining unparsed argument strings.\n\nNew in version 3.7.\n\nFile: python3.12.info,  Node: Upgrading optparse code,  Next: Exceptions<8>,  Prev: Other utilities,  Up: argparse -- Parser for command-line options arguments and sub-commands\n\n5.16.4.52 Upgrading optparse code\n.................................\n\nOriginally, the *note argparse: 6. module had attempted to maintain\ncompatibility with *note optparse: 9b.  However, *note optparse: 9b. was\ndifficult to extend transparently, particularly with the changes\nrequired to support the new 'nargs=' specifiers and better usage\nmessages.  When most everything in *note optparse: 9b. had either been\ncopy-pasted over or monkey-patched, it no longer seemed practical to try\nto maintain the backwards compatibility.\n\nThe *note argparse: 6. module improves on the standard library *note\noptparse: 9b. module in a number of ways including:\n\n* Handling positional arguments.\n\n* Supporting sub-commands.\n\n* Allowing alternative option prefixes like '+' and '/'.\n\n* Handling zero-or-more and one-or-more style arguments.\n\n* Producing more informative usage messages.\n\n* Providing a much simpler interface for custom 'type' and 'action'.\n\nA partial upgrade path from *note optparse: 9b. to *note argparse: 6.:\n\n* Replace all *note optparse.OptionParser.addoption(): 29a9. calls\nwith *note ArgumentParser.addargument(): 14a2. calls.\n\n* Replace '(options, args) = parser.parseargs()' with 'args =\nparser.parseargs()' and add additional *note\nArgumentParser.addargument(): 14a2. calls for the positional\narguments.  Keep in mind that what was previously called 'options',\nnow in the *note argparse: 6. context is called 'args'.\n\n* Replace *note optparse.OptionParser.disableinterspersedargs():\n29aa. by using *note parseintermixedargs(): 937. instead of *note\nparseargs(): 2953.\n\n* Replace callback actions and the 'callback*' keyword arguments\nwith 'type' or 'action' arguments.\n\n* Replace string names for 'type' keyword arguments with the\ncorresponding type objects (e.g.  int, float, complex, etc).\n\n* Replace *note optparse.Values: 29ab. with *note Namespace: 2954.\nand *note optparse.OptionError: 29ac. and *note\noptparse.OptionValueError: 29ad. with *note ArgumentError: 29ae.\n\n* Replace strings with implicit arguments such as '%default' or\n'%prog' with the standard Python syntax to use dictionaries to\nformat strings, that is, '%(default)s' and '%(prog)s'.\n\n* Replace the OptionParser constructor 'version' argument with a call\nto 'parser.addargument('--version', action='version',\nversion='<the version>')'.\n\nFile: python3.12.info,  Node: Exceptions<8>,  Prev: Upgrading optparse code,  Up: argparse -- Parser for command-line options arguments and sub-commands\n\n5.16.4.53 Exceptions\n....................\n\n-- Exception: argparse.ArgumentError\n\nAn error from creating or using an argument (optional or\npositional).\n\nThe string value of this exception is the message, augmented with\ninformation about the argument that caused it.\n\n-- Exception: argparse.ArgumentTypeError\n\nRaised when something goes wrong converting a command line string\nto a type.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: getopt -- C-style parser for command line options,  Next: logging -- Logging facility for Python,  Prev: argparse -- Parser for command-line options arguments and sub-commands,  Up: Generic Operating System Services": {
            "content": "'Source code:' Lib/getopt.py(1)\n\nNote: The *note getopt: 5c. module is a parser for command line\noptions whose API is designed to be familiar to users of the C\n'getopt()' function.  Users who are unfamiliar with the C\n'getopt()' function or who would like to write less code and get\nbetter help and error messages should consider using the *note\nargparse: 6. module instead.\n\n\n",
            "subsections": []
        },
        "This module helps scripts to parse the command line arguments in": {
            "content": "'sys.argv'.  It supports the same conventions as the Unix 'getopt()'\nfunction (including the special meanings of arguments of the form ''-''\nand ''--'').  Long options similar to those supported by GNU software\nmay be used as well via an optional third argument.\n\nThis module provides two functions and an exception:\n\n-- Function: getopt.getopt (args, shortopts, longopts=[])\n\nParses command line options and parameter list.  'args' is the\nargument list to be parsed, without the leading reference to the\nrunning program.  Typically, this means 'sys.argv[1:]'.\n'shortopts' is the string of option letters that the script wants\nto recognize, with options that require an argument followed by a\ncolon ('':''; i.e., the same format that Unix 'getopt()' uses).\n\nNote: Unlike GNU 'getopt()', after a non-option argument, all\nfurther arguments are considered also non-options.  This is\nsimilar to the way non-GNU Unix systems work.\n\n'longopts', if specified, must be a list of strings with the names\nof the long options which should be supported.  The leading ''--''\ncharacters should not be included in the option name.  Long options\nwhich require an argument should be followed by an equal sign\n(''='').  Optional arguments are not supported.  To accept only\nlong options, 'shortopts' should be an empty string.  Long options\non the command line can be recognized so long as they provide a\nprefix of the option name that matches exactly one of the accepted\noptions.  For example, if 'longopts' is '['foo', 'frob']', the\noption '--fo' will match as '--foo', but '--f' will not match\nuniquely, so *note GetoptError: 29b2. will be raised.\n\nThe return value consists of two elements: the first is a list of\n'(option, value)' pairs; the second is the list of program\narguments left after the option list was stripped (this is a\ntrailing slice of 'args').  Each option-and-value pair returned has\nthe option as its first element, prefixed with a hyphen for short\noptions (e.g., ''-x'') or two hyphens for long options (e.g.,\n''--long-option''), and the option argument as its second element,\nor an empty string if the option has no argument.  The options\noccur in the list in the same order in which they were found, thus\nallowing multiple occurrences.  Long and short options may be\nmixed.\n\n-- Function: getopt.gnugetopt (args, shortopts, longopts=[])\n\nThis function works like *note getopt(): 5c, except that GNU style\nscanning mode is used by default.  This means that option and\nnon-option arguments may be intermixed.  The *note getopt(): 5c.\nfunction stops processing options as soon as a non-option argument\nis encountered.\n\nIf the first character of the option string is ''+'', or if the\nenvironment variable 'POSIXLYCORRECT' is set, then option\nprocessing stops as soon as a non-option argument is encountered.\n\n-- Exception: getopt.GetoptError\n\nThis is raised when an unrecognized option is found in the argument\nlist or when an option requiring an argument is given none.  The\nargument to the exception is a string indicating the cause of the\nerror.  For long options, an argument given to an option which does\nnot require one will also cause this exception to be raised.  The\nattributes 'msg' and 'opt' give the error message and related\noption; if there is no specific option to which the exception\nrelates, 'opt' is an empty string.\n\n-- Exception: getopt.error\n\nAlias for *note GetoptError: 29b2.; for backward compatibility.\n\nAn example using only Unix style options:\n\n>>> import getopt\n>>> args = '-a -b -cfoo -d bar a1 a2'.split()\n>>> args\n['-a', '-b', '-cfoo', '-d', 'bar', 'a1', 'a2']\n>>> optlist, args = getopt.getopt(args, 'abc:d:')\n>>> optlist\n[('-a', ''), ('-b', ''), ('-c', 'foo'), ('-d', 'bar')]\n>>> args\n['a1', 'a2']\n\nUsing long option names is equally easy:\n\n>>> s = '--condition=foo --testing --output-file abc.def -x a1 a2'\n>>> args = s.split()\n>>> args\n['--condition=foo', '--testing', '--output-file', 'abc.def', '-x', 'a1', 'a2']\n>>> optlist, args = getopt.getopt(args, 'x', [\n...     'condition=', 'output-file=', 'testing'])\n>>> optlist\n[('--condition', 'foo'), ('--testing', ''), ('--output-file', 'abc.def'), ('-x', '')]\n>>> args\n['a1', 'a2']\n\nIn a script, typical usage is something like this:\n\nimport getopt, sys\n\ndef main():\ntry:\nopts, args = getopt.getopt(sys.argv[1:], \"ho:v\", [\"help\", \"output=\"])\nexcept getopt.GetoptError as err:\n# print help information and exit:\nprint(err)  # will print something like \"option -a not recognized\"\nusage()\nsys.exit(2)\noutput = None\nverbose = False\nfor o, a in opts:\nif o == \"-v\":\nverbose = True\nelif o in (\"-h\", \"--help\"):\nusage()\nsys.exit()\nelif o in (\"-o\", \"--output\"):\noutput = a\nelse:\nassert False, \"unhandled option\"\n# ...\n\nif name == \"main\":\nmain()\n",
            "subsections": []
        },
        "Note that an equivalent command line interface could be produced with": {
            "content": "less code and more informative help and error messages by using the\n*note argparse: 6. module:\n\nimport argparse\n\nif name == 'main':\nparser = argparse.ArgumentParser()\nparser.addargument('-o', '--output')\nparser.addargument('-v', dest='verbose', action='storetrue')\nargs = parser.parseargs()\n# ... do something with args.output ...\n# ... do something with args.verbose ..\n\nSee also\n........\n\nModule *note argparse: 6.\n\nAlternative command line option and argument parsing library.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/getopt.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: logging -- Logging facility for Python,  Next: logging config -- Logging configuration,  Prev: getopt -- C-style parser for command line options,  Up: Generic Operating System Services": {
            "content": "'Source code:' Lib/logging/init.py(1)\n",
            "subsections": []
        },
        "This module defines functions and classes which implement a flexible": {
            "content": "event logging system for applications and libraries.\n",
            "subsections": []
        },
        "The key benefit of having the logging API provided by a standard library": {
            "content": "module is that all Python modules can participate in logging, so your\napplication log can include your own messages integrated with messages\nfrom third-party modules.\n\nHere's a simple example of idiomatic usage:\n\n# myapp.py\nimport logging\nimport mylib\nlogger = logging.getLogger(name)\n\ndef main():\nlogging.basicConfig(filename='myapp.log', level=logging.INFO)\nlogger.info('Started')\nmylib.dosomething()\nlogger.info('Finished')\n\nif name == 'main':\nmain()\n\n# mylib.py\nimport logging\nlogger = logging.getLogger(name)\n\ndef dosomething():\nlogger.info('Doing something')\n\nIf you run 'myapp.py', you should see this in 'myapp.log':\n\nINFO:main:Started\nINFO:mylib:Doing something\nINFO:main:Finished\n",
            "subsections": []
        },
        "The key feature of this idiomatic usage is that the majority of code is": {
            "content": "simply creating a module level logger with 'getLogger(name)', and\nusing that logger to do any needed logging.  This is concise, while\nallowing downstream code fine-grained control if needed.  Logged\nmessages to the module-level logger get forwarded to handlers of loggers\nin higher-level modules, all the way up to the highest-level logger\nknown as the root logger; this approach is known as hierarchical\nlogging.\n",
            "subsections": []
        },
        "For logging to be useful, it needs to be configured: setting the levels": {
            "content": "and destinations for each logger, potentially changing how specific\nmodules log, often based on command-line arguments or application\nconfiguration.  In most cases, like the one above, only the root logger\nneeds to be so configured, since all the lower level loggers at module\nlevel eventually forward their messages to its handlers.  *note\nbasicConfig(): 828. provides a quick way to configure the root logger\nthat handles many use cases.\n",
            "subsections": []
        },
        "The module provides a lot of functionality and flexibility.  If you are": {
            "content": "unfamiliar with logging, the best way to get to grips with it is to view\nthe tutorials ('see the links above and on the right').\n",
            "subsections": []
        },
        "The basic classes defined by the module, together with their attributes": {
            "content": "and methods, are listed in the sections below.\n\n* Loggers expose the interface that application code directly uses.\n\n* Handlers send the log records (created by loggers) to the\nappropriate destination.\n\n* Filters provide a finer grained facility for determining which log\nrecords to output.\n\n* Formatters specify the layout of log records in the final output.\n\n* Menu:\n\n* Logger Objects::\n* Logging Levels::\n* Handler Objects::\n* Formatter Objects::\n* Filter Objects::\n* LogRecord Objects::\n* LogRecord attributes::\n* LoggerAdapter Objects::\n* Thread Safety::\n* Module-Level Functions::\n* Module-Level Attributes::\n* Integration with the warnings module::\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/logging/init.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Logger Objects,  Next: Logging Levels,  Up: logging -- Logging facility for Python": {
            "content": "5.16.6.1 Logger Objects\n.......................\n",
            "subsections": []
        },
        "Loggers have the following attributes and methods.  Note that Loggers": {
            "content": "should 'NEVER' be instantiated directly, but always through the\nmodule-level function 'logging.getLogger(name)'.  Multiple calls to\n*note getLogger(): 781. with the same name will always return a\nreference to the same Logger object.\n",
            "subsections": []
        },
        "The 'name' is potentially a period-separated hierarchical value, like": {
            "content": "'foo.bar.baz' (though it could also be just plain 'foo', for example).",
            "subsections": []
        },
        "Loggers that are further down in the hierarchical list are children of": {
            "content": "loggers higher up in the list.  For example, given a logger with a name\nof 'foo', loggers with names of 'foo.bar', 'foo.bar.baz', and 'foo.bam'\nare all descendants of 'foo'.  The logger name hierarchy is analogous to\nthe Python package hierarchy, and identical to it if you organise your\nloggers on a per-module basis using the recommended construction\n'logging.getLogger(name)'.  That's because in a module, 'name'\nis the module's name in the Python package namespace.\n\n-- Class: logging.Logger\n\n-- Attribute: name\n\nThis is the logger's name, and is the value that was passed to\n*note getLogger(): 781. to obtain the logger.\n\nNote: This attribute should be treated as read-only.\n\n-- Attribute: level\n\nThe threshold of this logger, as set by the *note setLevel():\n12e7. method.\n\nNote: Do not set this attribute directly - always use\n*note setLevel(): 12e7, which has checks for the level\npassed to it.\n\n-- Attribute: parent\n\nThe parent logger of this logger.  It may change based on\nlater instantiation of loggers which are higher up in the\nnamespace hierarchy.\n\nNote: This value should be treated as read-only.\n\n-- Attribute: propagate\n\nIf this attribute evaluates to true, events logged to this\nlogger will be passed to the handlers of higher level\n(ancestor) loggers, in addition to any handlers attached to\nthis logger.  Messages are passed directly to the ancestor\nloggers' handlers - neither the level nor filters of the\nancestor loggers in question are considered.\n\nIf this evaluates to false, logging messages are not passed to\nthe handlers of ancestor loggers.\n\nSpelling it out with an example: If the propagate attribute of\nthe logger named 'A.B.C' evaluates to true, any event logged\nto 'A.B.C' via a method call such as\n'logging.getLogger('A.B.C').error(...)' will [subject to\npassing that logger's level and filter settings] be passed in\nturn to any handlers attached to loggers named 'A.B', 'A' and\nthe root logger, after first being passed to any handlers\nattached to 'A.B.C'.  If any logger in the chain 'A.B.C',\n'A.B', 'A' has its 'propagate' attribute set to false, then\nthat is the last logger whose handlers are offered the event\nto handle, and propagation stops at that point.\n\nThe constructor sets this attribute to 'True'.\n\nNote: If you attach a handler to a logger 'and' one or\nmore of its ancestors, it may emit the same record\nmultiple times.  In general, you should not need to\nattach a handler to more than one logger - if you just\nattach it to the appropriate logger which is highest in\nthe logger hierarchy, then it will see all events logged\nby all descendant loggers, provided that their propagate\nsetting is left set to 'True'.  A common scenario is to\nattach handlers only to the root logger, and to let\npropagation take care of the rest.\n\n-- Attribute: handlers\n\nThe list of handlers directly attached to this logger\ninstance.\n\nNote: This attribute should be treated as read-only; it\nis normally changed via the *note addHandler(): 29bc. and\n*note removeHandler(): 29bd. methods, which use locks to\nensure thread-safe operation.\n\n-- Attribute: disabled\n\nThis attribute disables handling of any events.  It is set to\n'False' in the initializer, and only changed by logging\nconfiguration code.\n\nNote: This attribute should be treated as read-only.\n\n-- Method: setLevel (level)\n\nSets the threshold for this logger to 'level'.  Logging\nmessages which are less severe than 'level' will be ignored;\nlogging messages which have severity 'level' or higher will be\nemitted by whichever handler or handlers service this logger,\nunless a handler's level has been set to a higher severity\nlevel than 'level'.\n\nWhen a logger is created, the level is set to *note NOTSET:\n29bf. (which causes all messages to be processed when the\nlogger is the root logger, or delegation to the parent when\nthe logger is a non-root logger).  Note that the root logger\nis created with level *note WARNING: 1a78.\n\nThe term 'delegation to the parent' means that if a logger has\na level of NOTSET, its chain of ancestor loggers is traversed\nuntil either an ancestor with a level other than NOTSET is\nfound, or the root is reached.\n\nIf an ancestor is found with a level other than NOTSET, then\nthat ancestor's level is treated as the effective level of the\nlogger where the ancestor search began, and is used to\ndetermine how a logging event is handled.\n\nIf the root is reached, and it has a level of NOTSET, then all\nmessages will be processed.  Otherwise, the root's level will\nbe used as the effective level.\n\nSee *note Logging Levels: 424. for a list of levels.\n\nChanged in version 3.2: The 'level' parameter now accepts a\nstring representation of the level such as 'INFO' as an\nalternative to the integer constants such as *note INFO: 1a77.\nNote, however, that levels are internally stored as integers,\nand methods such as e.g.  *note getEffectiveLevel(): 29c0. and\n*note isEnabledFor(): 116b. will return/expect to be passed\nintegers.\n\n-- Method: isEnabledFor (level)\n\nIndicates if a message of severity 'level' would be processed\nby this logger.  This method checks first the module-level\nlevel set by 'logging.disable(level)' and then the logger's\neffective level as determined by *note getEffectiveLevel():\n29c0.\n\n-- Method: getEffectiveLevel ()\n\nIndicates the effective level for this logger.  If a value\nother than *note NOTSET: 29bf. has been set using *note\nsetLevel(): 12e7, it is returned.  Otherwise, the hierarchy is\ntraversed towards the root until a value other than *note\nNOTSET: 29bf. is found, and that value is returned.  The value\nreturned is an integer, typically one of *note logging.DEBUG:\n1a76, *note logging.INFO: 1a77. etc.\n\n-- Method: getChild (suffix)\n\nReturns a logger which is a descendant to this logger, as\ndetermined by the suffix.  Thus,\n'logging.getLogger('abc').getChild('def.ghi')' would return\nthe same logger as would be returned by\n'logging.getLogger('abc.def.ghi')'.  This is a convenience\nmethod, useful when the parent logger is named using e.g.\n'name' rather than a literal string.\n\nNew in version 3.2.\n\n-- Method: getChildren ()\n\nReturns a set of loggers which are immediate children of this\nlogger.  So for example 'logging.getLogger().getChildren()'\nmight return a set containing loggers named 'foo' and 'bar',\nbut a logger named 'foo.bar' wouldn't be included in the set.\nLikewise, 'logging.getLogger('foo').getChildren()' might\nreturn a set including a logger named 'foo.bar', but it\nwouldn't include one named 'foo.bar.baz'.\n\nNew in version 3.12.\n\n-- Method: debug (msg, *args, kwargs)\n\nLogs a message with level *note DEBUG: 1a76. on this logger.\nThe 'msg' is the message format string, and the 'args' are the\narguments which are merged into 'msg' using the string\nformatting operator.  (Note that this means that you can use\nkeywords in the format string, together with a single\ndictionary argument.)  No % formatting operation is performed\non 'msg' when no 'args' are supplied.\n\nThere are four keyword arguments in 'kwargs' which are\ninspected: 'excinfo', 'stackinfo', 'stacklevel' and 'extra'.\n\nIf 'excinfo' does not evaluate as false, it causes exception\ninformation to be added to the logging message.  If an\nexception tuple (in the format returned by *note\nsys.excinfo(): 456.) or an exception instance is provided, it\nis used; otherwise, *note sys.excinfo(): 456. is called to\nget the exception information.\n\nThe second optional keyword argument is 'stackinfo', which\ndefaults to 'False'.  If true, stack information is added to\nthe logging message, including the actual logging call.  Note\nthat this is not the same stack information as that displayed\nthrough specifying 'excinfo': The former is stack frames from\nthe bottom of the stack up to the logging call in the current\nthread, whereas the latter is information about stack frames\nwhich have been unwound, following an exception, while\nsearching for exception handlers.\n\nYou can specify 'stackinfo' independently of 'excinfo', e.g.\nto just show how you got to a certain point in your code, even\nwhen no exceptions were raised.  The stack frames are printed\nfollowing a header line which says:\n\nStack (most recent call last):\n\nThis mimics the 'Traceback (most recent call last):' which is\nused when displaying exception frames.\n\nThe third optional keyword argument is 'stacklevel', which\ndefaults to '1'.  If greater than 1, the corresponding number\nof stack frames are skipped when computing the line number and\nfunction name set in the *note LogRecord: e59. created for the\nlogging event.  This can be used in logging helpers so that\nthe function name, filename and line number recorded are not\nthe information for the helper function/method, but rather its\ncaller.  The name of this parameter mirrors the equivalent one\nin the *note warnings: 10d. module.\n\nThe fourth keyword argument is 'extra' which can be used to\npass a dictionary which is used to populate the dict of\nthe *note LogRecord: e59. created for the logging event with\nuser-defined attributes.  These custom attributes can then be\nused as you like.  For example, they could be incorporated\ninto logged messages.  For example:\n\nFORMAT = '%(asctime)s %(clientip)-15s %(user)-8s %(message)s'\nlogging.basicConfig(format=FORMAT)\nd = {'clientip': '192.168.0.1', 'user': 'fbloggs'}\nlogger = logging.getLogger('tcpserver')\nlogger.warning('Protocol problem: %s', 'connection reset', extra=d)\n\nwould print something like\n\n2006-02-08 22:20:02,165 192.168.0.1 fbloggs  Protocol problem: connection reset\n\nThe keys in the dictionary passed in 'extra' should not clash\nwith the keys used by the logging system.  (See the section on\n*note LogRecord attributes: 29c1. for more information on\nwhich keys are used by the logging system.)\n\nIf you choose to use these attributes in logged messages, you\nneed to exercise some care.  In the above example, for\ninstance, the *note Formatter: 12ec. has been set up with a\nformat string which expects 'clientip' and 'user' in the\nattribute dictionary of the *note LogRecord: e59.  If these\nare missing, the message will not be logged because a string\nformatting exception will occur.  So in this case, you always\nneed to pass the 'extra' dictionary with these keys.\n\nWhile this might be annoying, this feature is intended for use\nin specialized circumstances, such as multi-threaded servers\nwhere the same code executes in many contexts, and interesting\nconditions which arise are dependent on this context (such as\nremote client IP address and authenticated user name, in the\nabove example).  In such circumstances, it is likely that\nspecialized *note Formatter: 12ec.s would be used with\nparticular *note Handler: 12eb.s.\n\nIf no handler is attached to this logger (or any of its\nancestors, taking into account the relevant *note\nLogger.propagate: 12ea. attributes), the message will be sent\nto the handler set on *note lastResort: 106e.\n\nChanged in version 3.2: The 'stackinfo' parameter was added.\n\nChanged in version 3.5: The 'excinfo' parameter can now\naccept exception instances.\n\nChanged in version 3.8: The 'stacklevel' parameter was added.\n\n-- Method: info (msg, *args, kwargs)\n\nLogs a message with level *note INFO: 1a77. on this logger.\nThe arguments are interpreted as for *note debug(): 29c3.\n\n-- Method: warning (msg, *args, kwargs)\n\nLogs a message with level *note WARNING: 1a78. on this logger.\nThe arguments are interpreted as for *note debug(): 29c3.\n\nNote: There is an obsolete method 'warn' which is\nfunctionally identical to 'warning'.  As 'warn' is\ndeprecated, please do not use it - use 'warning' instead.\n\n-- Method: error (msg, *args, kwargs)\n\nLogs a message with level *note ERROR: 1a79. on this logger.\nThe arguments are interpreted as for *note debug(): 29c3.\n\n-- Method: critical (msg, *args, kwargs)\n\nLogs a message with level *note CRITICAL: 1a7a. on this\nlogger.  The arguments are interpreted as for *note debug():\n29c3.\n\n-- Method: log (level, msg, *args, kwargs)\n\nLogs a message with integer level 'level' on this logger.  The\nother arguments are interpreted as for *note debug(): 29c3.\n\n-- Method: exception (msg, *args, kwargs)\n\nLogs a message with level *note ERROR: 1a79. on this logger.\nThe arguments are interpreted as for *note debug(): 29c3.\nException info is added to the logging message.  This method\nshould only be called from an exception handler.\n\n-- Method: addFilter (filter)\n\nAdds the specified filter 'filter' to this logger.\n\n-- Method: removeFilter (filter)\n\nRemoves the specified filter 'filter' from this logger.\n\n-- Method: filter (record)\n\nApply this logger's filters to the record and return 'True' if\nthe record is to be processed.  The filters are consulted in\nturn, until one of them returns a false value.  If none of\nthem return a false value, the record will be processed\n(passed to handlers).  If one returns a false value, no\nfurther processing of the record occurs.\n\n-- Method: addHandler (hdlr)\n\nAdds the specified handler 'hdlr' to this logger.\n\n-- Method: removeHandler (hdlr)\n\nRemoves the specified handler 'hdlr' from this logger.\n\n-- Method: findCaller (stackinfo=False, stacklevel=1)\n\nFinds the caller's source filename and line number.  Returns\nthe filename, line number, function name and stack information\nas a 4-element tuple.  The stack information is returned as\n'None' unless 'stackinfo' is 'True'.\n\nThe 'stacklevel' parameter is passed from code calling the\n*note debug(): 29c3. and other APIs.  If greater than 1, the\nexcess is used to skip stack frames before determining the\nvalues to be returned.  This will generally be useful when\ncalling logging APIs from helper/wrapper code, so that the\ninformation in the event log refers not to the helper/wrapper\ncode, but to the code that calls it.\n\n-- Method: handle (record)\n\nHandles a record by passing it to all handlers associated with\nthis logger and its ancestors (until a false value of\n'propagate' is found).  This method is used for unpickled\nrecords received from a socket, as well as those created\nlocally.  Logger-level filtering is applied using *note\nfilter(): 29c8.\n\n-- Method: makeRecord (name, level, fn, lno, msg, args, excinfo,\nfunc=None, extra=None, sinfo=None)\n\nThis is a factory method which can be overridden in subclasses\nto create specialized *note LogRecord: e59. instances.\n\n-- Method: hasHandlers ()\n\nChecks to see if this logger has any handlers configured.\nThis is done by looking for handlers in this logger and its\nparents in the logger hierarchy.  Returns 'True' if a handler\nwas found, else 'False'.  The method stops searching up the\nhierarchy whenever a logger with the 'propagate' attribute set\nto false is found - that will be the last logger which is\nchecked for the existence of handlers.\n\nNew in version 3.2.\n\nChanged in version 3.7: Loggers can now be pickled and unpickled.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Logging Levels,  Next: Handler Objects,  Prev: Logger Objects,  Up: logging -- Logging facility for Python": {
            "content": "5.16.6.2 Logging Levels\n.......................\n\nThe numeric values of logging levels are given in the following table.",
            "subsections": []
        },
        "These are primarily of interest if you want to define your own levels,": {
            "content": "and need them to have specific values relative to the predefined levels.",
            "subsections": []
        },
        "If you define a level with the same numeric value, it overwrites the": {
            "content": "predefined value; the predefined name is lost.\n",
            "subsections": []
        },
        "Level                       Numeric value       What it means / When to use it": {
            "content": "------------------------------------------------------------------------------------------\n\n-- Data: logging.NOTSET    0                   When set on a logger, indicates that\nancestor loggers are to be consulted to\ndetermine the effective level.  If that\nstill resolves to 'NOTSET', then all\nevents are logged.  When set on a\nhandler, all events are handled.\n\n\n-- Data: logging.DEBUG     10                  Detailed information, typically only of\ninterest to a developer trying to\ndiagnose a problem.\n\n\n-- Data: logging.INFO      20                  Confirmation that things are working as\nexpected.\n\n\n-- Data: logging.WARNING   30                  An indication that something unexpected\nhappened, or that a problem might occur\nin the near future (e.g.  'disk space\nlow').  The software is still working\nas expected.\n\n\n-- Data: logging.ERROR     40                  Due to a more serious problem, the\nsoftware has not been able to perform\nsome function.\n\n\n-- Data:                   50                  A serious error, indicating that the\nlogging.CRITICAL                      program itself may be unable to\ncontinue running.\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Handler Objects,  Next: Formatter Objects,  Prev: Logging Levels,  Up: logging -- Logging facility for Python": {
            "content": "5.16.6.3 Handler Objects\n........................\n\nHandlers have the following attributes and methods.  Note that *note",
            "subsections": []
        },
        "Handler: 12eb. is never instantiated directly; this class acts as a base": {
            "content": "for more useful subclasses.  However, the 'init()' method in\nsubclasses needs to call *note Handler.init(): 29d0.\n\n-- Class: logging.Handler\n\n-- Method: init (level=NOTSET)\n\nInitializes the *note Handler: 12eb. instance by setting its\nlevel, setting the list of filters to the empty list and\ncreating a lock (using *note createLock(): 29d1.) for\nserializing access to an I/O mechanism.\n\n-- Method: createLock ()\n\nInitializes a thread lock which can be used to serialize\naccess to underlying I/O functionality which may not be\nthreadsafe.\n\n-- Method: acquire ()\n\nAcquires the thread lock created with *note createLock():\n29d1.\n\n-- Method: release ()\n\nReleases the thread lock acquired with *note acquire(): 29d2.\n\n-- Method: setLevel (level)\n\nSets the threshold for this handler to 'level'.  Logging\nmessages which are less severe than 'level' will be ignored.\nWhen a handler is created, the level is set to *note NOTSET:\n29bf. (which causes all messages to be processed).\n\nSee *note Logging Levels: 424. for a list of levels.\n\nChanged in version 3.2: The 'level' parameter now accepts a\nstring representation of the level such as 'INFO' as an\nalternative to the integer constants such as *note INFO: 1a77.\n\n-- Method: setFormatter (fmt)\n\nSets the *note Formatter: 12ec. for this handler to 'fmt'.\n\n-- Method: addFilter (filter)\n\nAdds the specified filter 'filter' to this handler.\n\n-- Method: removeFilter (filter)\n\nRemoves the specified filter 'filter' from this handler.\n\n-- Method: filter (record)\n\nApply this handler's filters to the record and return 'True'\nif the record is to be processed.  The filters are consulted\nin turn, until one of them returns a false value.  If none of\nthem return a false value, the record will be emitted.  If one\nreturns a false value, the handler will not emit the record.\n\n-- Method: flush ()\n\nEnsure all logging output has been flushed.  This version does\nnothing and is intended to be implemented by subclasses.\n\n-- Method: close ()\n\nTidy up any resources used by the handler.  This version does\nno output but removes the handler from an internal list of\nhandlers which is closed when *note shutdown(): 29db. is\ncalled.  Subclasses should ensure that this gets called from\noverridden *note close(): 29da. methods.\n\n-- Method: handle (record)\n\nConditionally emits the specified logging record, depending on\nfilters which may have been added to the handler.  Wraps the\nactual emission of the record with acquisition/release of the\nI/O thread lock.\n\n-- Method: handleError (record)\n\nThis method should be called from handlers when an exception\nis encountered during an *note emit(): 29de. call.  If the\nmodule-level attribute *note raiseExceptions: 106d. is\n'False', exceptions get silently ignored.  This is what is\nmostly wanted for a logging system - most users will not care\nabout errors in the logging system, they are more interested\nin application errors.  You could, however, replace this with\na custom handler if you wish.  The specified record is the one\nwhich was being processed when the exception occurred.  (The\ndefault value of *note raiseExceptions: 106d. is 'True', as\nthat is more useful during development).\n\n-- Method: format (record)\n\nDo formatting for a record - if a formatter is set, use it.\nOtherwise, use the default formatter for the module.\n\n-- Method: emit (record)\n\nDo whatever it takes to actually log the specified logging\nrecord.  This version is intended to be implemented by\nsubclasses and so raises a *note NotImplementedError: ba5.\n\nWarning: This method is called after a handler-level lock\nis acquired, which is released after this method returns.\nWhen you override this method, note that you should be\ncareful when calling anything that invokes other parts of\nthe logging API which might do locking, because that\nmight result in a deadlock.  Specifically:\n\n* Logging configuration APIs acquire the module-level\nlock, and then individual handler-level locks as\nthose handlers are configured.\n\n* Many logging APIs lock the module-level lock.  If\nsuch an API is called from this method, it could\ncause a deadlock if a configuration call is made on\nanother thread, because that thread will try to\nacquire the module-level lock 'before' the\nhandler-level lock, whereas this thread tries to\nacquire the module-level lock 'after' the\nhandler-level lock (because in this method, the\nhandler-level lock has already been acquired).\n\nFor a list of handlers included as standard, see *note logging.handlers:\n84.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Formatter Objects,  Next: Filter Objects,  Prev: Handler Objects,  Up: logging -- Logging facility for Python": {
            "content": "5.16.6.4 Formatter Objects\n..........................\n\n-- Class: logging.Formatter (fmt=None, datefmt=None, style='%',\nvalidate=True, *, defaults=None)\n\nResponsible for converting a *note LogRecord: e59. to an output\nstring to be interpreted by a human or external system.\n\n\nParameters:\n\n* 'fmt' (*note str: 157.) - A format string in the given 'style'\nfor the logged output as a whole.  The possible mapping keys\nare drawn from the *note LogRecord: e59. object's *note\nLogRecord attributes: 29c1.  If not specified, ''%(message)s''\nis used, which is just the logged message.\n\n* 'datefmt' (*note str: 157.) - A format string in the given\n'style' for the date/time portion of the logged output.  If\nnot specified, the default described in *note formatTime():\n29e2. is used.\n\n* 'style' (*note str: 157.) - Can be one of ''%'', ''{'' or\n''$'' and determines how the format string will be merged with\nits data: using one of *note printf-style String Formatting:\n49c. ('%'), *note str.format(): 3ed. ('{') or *note\nstring.Template: 453. ('$').  This only applies to 'fmt' and\n'datefmt' (e.g.  ''%(message)s'' versus ''{message}''), not to\nthe actual log messages passed to the logging methods.\nHowever, there are *note other ways: 29e3. to use '{'- and\n'$'-formatting for log messages.\n\n* 'validate' (*note bool: 17d.) - If 'True' (the default),\nincorrect or mismatched 'fmt' and 'style' will raise a *note\nValueError: 183.; for example, 'logging.Formatter('%(asctime)s\n- %(message)s', style='{')'.\n\n* 'defaults' (*note dict: 237.'['*note str: 157.', ''Any'']') -\nA dictionary with default values to use in custom fields.  For\nexample, 'logging.Formatter('%(ip)s %(message)s',\ndefaults={\"ip\": None})'\n\nChanged in version 3.2: Added the 'style' parameter.\n\nChanged in version 3.8: Added the 'validate' parameter.\n\nChanged in version 3.10: Added the 'defaults' parameter.\n\n-- Method: format (record)\n\nThe record's attribute dictionary is used as the operand to a\nstring formatting operation.  Returns the resulting string.\nBefore formatting the dictionary, a couple of preparatory\nsteps are carried out.  The 'message' attribute of the record\nis computed using 'msg' % 'args'.  If the formatting string\ncontains ''(asctime)'', *note formatTime(): 29e2. is called to\nformat the event time.  If there is exception information, it\nis formatted using *note formatException(): 29e5. and appended\nto the message.  Note that the formatted exception information\nis cached in attribute 'exctext'.  This is useful because the\nexception information can be pickled and sent across the wire,\nbut you should be careful if you have more than one *note\nFormatter: 12ec. subclass which customizes the formatting of\nexception information.  In this case, you will have to clear\nthe cached value (by setting the 'exctext' attribute to\n'None') after a formatter has done its formatting, so that the\nnext formatter to handle the event doesn't use the cached\nvalue, but recalculates it afresh.\n\nIf stack information is available, it's appended after the\nexception information, using *note formatStack(): 29e6. to\ntransform it if necessary.\n\n-- Method: formatTime (record, datefmt=None)\n\nThis method should be called from *note format(): 3eb. by a\nformatter which wants to make use of a formatted time.  This\nmethod can be overridden in formatters to provide for any\nspecific requirement, but the basic behavior is as follows: if\n'datefmt' (a string) is specified, it is used with *note\ntime.strftime(): 105d. to format the creation time of the\nrecord.  Otherwise, the format '%Y-%m-%d %H:%M:%S,uuu' is\nused, where the uuu part is a millisecond value and the other\nletters are as per the *note time.strftime(): 105d.\ndocumentation.  An example time in this format is '2003-01-23\n00:29:50,411'.  The resulting string is returned.\n\nThis function uses a user-configurable function to convert the\ncreation time to a tuple.  By default, *note time.localtime():\n1353. is used; to change this for a particular formatter\ninstance, set the 'converter' attribute to a function with the\nsame signature as *note time.localtime(): 1353. or *note\ntime.gmtime(): 1034.  To change it for all formatters, for\nexample if you want all logging times to be shown in GMT, set\nthe 'converter' attribute in the 'Formatter' class.\n\nChanged in version 3.3: Previously, the default format was\nhard-coded as in this example: '2010-09-06 22:38:15,292' where\nthe part before the comma is handled by a strptime format\nstring (''%Y-%m-%d %H:%M:%S''), and the part after the comma\nis a millisecond value.  Because strptime does not have a\nformat placeholder for milliseconds, the millisecond value is\nappended using another format string, ''%s,%03d'' -- and both\nof these format strings have been hardcoded into this method.\nWith the change, these strings are defined as class-level\nattributes which can be overridden at the instance level when\ndesired.  The names of the attributes are\n'defaulttimeformat' (for the strptime format string) and\n'defaultmsecformat' (for appending the millisecond value).\n\nChanged in version 3.9: The 'defaultmsecformat' can be\n'None'.\n\n-- Method: formatException (excinfo)\n\nFormats the specified exception information (a standard\nexception tuple as returned by *note sys.excinfo(): 456.) as\na string.  This default implementation just uses *note\ntraceback.printexception(): 645.  The resulting string is\nreturned.\n\n-- Method: formatStack (stackinfo)\n\nFormats the specified stack information (a string as returned\nby *note traceback.printstack(): ceb, but with the last\nnewline removed) as a string.  This default implementation\njust returns the input value.\n\n-- Class: logging.BufferingFormatter (linefmt=None)\n\nA base formatter class suitable for subclassing when you want to\nformat a number of records.  You can pass a *note Formatter: 12ec.\ninstance which you want to use to format each line (that\ncorresponds to a single record).  If not specified, the default\nformatter (which just outputs the event message) is used as the\nline formatter.\n\n-- Method: formatHeader (records)\n\nReturn a header for a list of 'records'.  The base\nimplementation just returns the empty string.  You will need\nto override this method if you want specific behaviour, e.g.\nto show the count of records, a title or a separator line.\n\n-- Method: formatFooter (records)\n\nReturn a footer for a list of 'records'.  The base\nimplementation just returns the empty string.  You will need\nto override this method if you want specific behaviour, e.g.\nto show the count of records or a separator line.\n\n-- Method: format (records)\n\nReturn formatted text for a list of 'records'.  The base\nimplementation just returns the empty string if there are no\nrecords; otherwise, it returns the concatenation of the\nheader, each record formatted with the line formatter, and the\nfooter.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Filter Objects,  Next: LogRecord Objects,  Prev: Formatter Objects,  Up: logging -- Logging facility for Python": {
            "content": "5.16.6.5 Filter Objects\n.......................\n\n'Filters' can be used by 'Handlers' and 'Loggers' for more sophisticated\nfiltering than is provided by levels.  The base filter class only allows\nevents which are below a certain point in the logger hierarchy.  For\nexample, a filter initialized with 'A.B' will allow events logged by\nloggers 'A.B', 'A.B.C', 'A.B.C.D', 'A.B.D' etc.  but not 'A.BB', 'B.A.B'\netc.  If initialized with the empty string, all events are passed.\n\n-- Class: logging.Filter (name='')\n\nReturns an instance of the *note Filter: 106f. class.  If 'name' is\nspecified, it names a logger which, together with its children,\nwill have its events allowed through the filter.  If 'name' is the\nempty string, allows every event.\n\n-- Method: filter (record)\n\nIs the specified record to be logged?  Returns false for no,\ntrue for yes.  Filters can either modify log records in-place\nor return a completely different record instance which will\nreplace the original log record in any future processing of\nthe event.\n",
            "subsections": []
        },
        "Note that filters attached to handlers are consulted before an event is": {
            "content": "emitted by the handler, whereas filters attached to loggers are\nconsulted whenever an event is logged (using *note debug(): 29c3, *note\ninfo(): 29ee, etc.), before sending an event to handlers.  This means\nthat events which have been generated by descendant loggers will not be\nfiltered by a logger's filter setting, unless the filter has also been\napplied to those descendant loggers.\n",
            "subsections": []
        },
        "You don't actually need to subclass 'Filter': you can pass any instance": {
            "content": "which has a 'filter' method with the same semantics.\n",
            "subsections": []
        },
        "Changed in version 3.2: You don't need to create specialized 'Filter'": {
            "content": "classes, or use other classes with a 'filter' method: you can use a\nfunction (or other callable) as a filter.  The filtering logic will\ncheck to see if the filter object has a 'filter' attribute: if it does,\nit's assumed to be a 'Filter' and its *note filter(): 29ed. method is\ncalled.  Otherwise, it's assumed to be a callable and called with the\nrecord as the single parameter.  The returned value should conform to\nthat returned by *note filter(): 29ed.\n\nChanged in version 3.12: You can now return a *note LogRecord: e59.\ninstance from filters to replace the log record rather than modifying it\nin place.  This allows filters attached to a *note Handler: 12eb. to\nmodify the log record before it is emitted, without having side effects\non other handlers.\n",
            "subsections": []
        },
        "Although filters are used primarily to filter records based on more": {
            "content": "sophisticated criteria than levels, they get to see every record which\nis processed by the handler or logger they're attached to: this can be\nuseful if you want to do things like counting how many records were\nprocessed by a particular logger or handler, or adding, changing or\nremoving attributes in the *note LogRecord: e59. being processed.",
            "subsections": []
        },
        "Obviously changing the LogRecord needs to be done with some care, but it": {
            "content": "does allow the injection of contextual information into logs (see *note\nUsing Filters to impart contextual information: 29ef.).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: LogRecord Objects,  Next: LogRecord attributes,  Prev: Filter Objects,  Up: logging -- Logging facility for Python": {
            "content": "5.16.6.6 LogRecord Objects\n..........................\n\n*note LogRecord: e59. instances are created automatically by the *note",
            "subsections": []
        },
        "Logger: 98b. every time something is logged, and can be created manually": {
            "content": "via *note makeLogRecord(): 29f2. (for example, from a pickled event\nreceived over the wire).\n\n-- Class: logging.LogRecord (name, level, pathname, lineno, msg, args,\nexcinfo, func=None, sinfo=None)\n\nContains all the information pertinent to the event being logged.\n\nThe primary information is passed in 'msg' and 'args', which are\ncombined using 'msg % args' to create the 'message' attribute of\nthe record.\n\n\nParameters:\n\n* 'name' (*note str: 157.) - The name of the logger used to log\nthe event represented by this 'LogRecord'.  Note that the\nlogger name in the 'LogRecord' will always have this value,\neven though it may be emitted by a handler attached to a\ndifferent (ancestor) logger.\n\n* 'level' (*note int: 17e.) - The *note numeric level: 424. of\nthe logging event (such as '10' for 'DEBUG', '20' for 'INFO',\netc).  Note that this is converted to 'two' attributes of the\nLogRecord: 'levelno' for the numeric value and 'levelname' for\nthe corresponding level name.\n\n* 'pathname' (*note str: 157.) - The full string path of the\nsource file where the logging call was made.\n\n* 'lineno' (*note int: 17e.) - The line number in the source\nfile where the logging call was made.\n\n* 'msg' (*note Any: 479.) - The event description message, which\ncan be a %-format string with placeholders for variable data,\nor an arbitrary object (see *note Using arbitrary objects as\nmessages: 29f3.).\n\n* 'args' (*note tuple: 4b8.' | '*note dict: 237.'['*note str:\n157.', '*note Any: 479.']') - Variable data to merge into the\n'msg' argument to obtain the event description.\n\n* 'excinfo' (*note tuple: 4b8.'['*note type: ba0.'['*note\nBaseException: 37c.']'', '*note BaseException: 37c.', '*note\ntypes.TracebackType: 929.'] ''| ''None') - An exception tuple\nwith the current exception information, as returned by *note\nsys.excinfo(): 456, or 'None' if no exception information is\navailable.\n\n* 'func' (*note str: 157.' | ''None') - The name of the function\nor method from which the logging call was invoked.\n\n* 'sinfo' (*note str: 157.' | ''None') - A text string\nrepresenting stack information from the base of the stack in\nthe current thread, up to the logging call.\n\n-- Method: getMessage ()\n\nReturns the message for this *note LogRecord: e59. instance\nafter merging any user-supplied arguments with the message.\nIf the user-supplied message argument to the logging call is\nnot a string, *note str(): 157. is called on it to convert it\nto a string.  This allows use of user-defined classes as\nmessages, whose 'str' method can return the actual format\nstring to be used.\n\nChanged in version 3.2: The creation of a *note LogRecord: e59. has\nbeen made more configurable by providing a factory which is used to\ncreate the record.  The factory can be set using *note\ngetLogRecordFactory(): 29f5. and *note setLogRecordFactory(): 29f6.\n(see this for the factory's signature).\n\nThis functionality can be used to inject your own values into a\n*note LogRecord: e59. at creation time.  You can use the following\npattern:\n\noldfactory = logging.getLogRecordFactory()\n\ndef recordfactory(*args, kwargs):\nrecord = oldfactory(*args, kwargs)\nrecord.customattribute = 0xdecafbad\nreturn record\n\nlogging.setLogRecordFactory(recordfactory)\n\nWith this pattern, multiple factories could be chained, and as long\nas they don't overwrite each other's attributes or unintentionally\noverwrite the standard attributes listed above, there should be no\nsurprises.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: LogRecord attributes,  Next: LoggerAdapter Objects,  Prev: LogRecord Objects,  Up: logging -- Logging facility for Python": {
            "content": "5.16.6.7 LogRecord attributes\n.............................\n",
            "subsections": []
        },
        "The LogRecord has a number of attributes, most of which are derived from": {
            "content": "the parameters to the constructor.  (Note that the names do not always\ncorrespond exactly between the LogRecord constructor parameters and the",
            "subsections": []
        },
        "LogRecord attributes.)  These attributes can be used to merge data from": {
            "content": "the record into the format string.  The following table lists (in\nalphabetical order) the attribute names, their meanings and the\ncorresponding placeholder in a %-style format string.\n\nIf you are using {}-formatting (*note str.format(): 3ed.), you can use\n'{attrname}' as the placeholder in the format string.  If you are using\n$-formatting (*note string.Template: 453.), use the form '${attrname}'.",
            "subsections": []
        },
        "In both cases, of course, replace 'attrname' with the actual attribute": {
            "content": "name you want to use.\n\nIn the case of {}-formatting, you can specify formatting flags by\nplacing them after the attribute name, separated from it with a colon.\nFor example: a placeholder of '{msecs:03.0f}' would format a millisecond\nvalue of '4' as '004'.  Refer to the *note str.format(): 3ed.\ndocumentation for full details on the options available to you.\n",
            "subsections": []
        },
        "Attribute name       Format                        Description": {
            "content": "-------------------------------------------------------------------------------------------------------\n\nargs                 You shouldn't need to         The tuple of arguments merged into 'msg' to\nformat this yourself.         produce 'message', or a dict whose values are\nused for the merge (when there is only one\nargument, and it is a dictionary).\n\n\nasctime              '%(asctime)s'                 Human-readable time when the\n*note LogRecord: e59. was created.  By default\nthis is of the form '2003-07-08 16:49:45,896'\n(the numbers after the comma are millisecond\nportion of the time).\n\n\ncreated              '%(created)f'                 Time when the *note LogRecord: e59. was created\n(as returned by *note time.time(): 918.).\n\n\nexcinfo             You shouldn't need to         Exception tuple (a` la 'sys.excinfo') or, if no\nformat this yourself.         exception has occurred, 'None'.\n\n\nfilename             '%(filename)s'                Filename portion of 'pathname'.\n\n\nfuncName             '%(funcName)s'                Name of function containing the logging call.\n\n\nlevelname            '%(levelname)s'               Text logging level for the message (''DEBUG'',\n''INFO'', ''WARNING'', ''ERROR'', ''CRITICAL'').\n\n\nlevelno              '%(levelno)s'                 Numeric logging level for the message\n(*note DEBUG: 1a76, *note INFO: 1a77,\n*note WARNING: 1a78, *note ERROR: 1a79,\n*note CRITICAL: 1a7a.).\n\n\nlineno               '%(lineno)d'                  Source line number where the logging call was\nissued (if available).\n\n\nmessage              '%(message)s'                 The logged message, computed as 'msg % args'.\nThis is set when *note Formatter.format(): 29e4.\nis invoked.\n\n\nmodule               '%(module)s'                  Module (name portion of 'filename').\n\n\nmsecs                '%(msecs)d'                   Millisecond portion of the time when the\n*note LogRecord: e59. was created.\n\n\nmsg                  You shouldn't need to         The format string passed in the original logging\nformat this yourself.         call.  Merged with 'args' to produce 'message',\nor an arbitrary object (see\n*note Using arbitrary objects as messages: 29f3.).\n\n\nname                 '%(name)s'                    Name of the logger used to log the call.\n\n\npathname             '%(pathname)s'                Full pathname of the source file where the\nlogging call was issued (if available).\n\n\nprocess              '%(process)d'                 Process ID (if available).\n\n\nprocessName          '%(processName)s'             Process name (if available).\n\n\nrelativeCreated      '%(relativeCreated)d'         Time in milliseconds when the LogRecord was\ncreated, relative to the time the logging module\nwas loaded.\n\n\nstackinfo           You shouldn't need to         Stack frame information (where available) from\nformat this yourself.         the bottom of the stack in the current thread, up\nto and including the stack frame of the logging\ncall which resulted in the creation of this\nrecord.\n\n\nthread               '%(thread)d'                  Thread ID (if available).\n\n\nthreadName           '%(threadName)s'              Thread name (if available).\n\n\ntaskName             '%(taskName)s'                *note asyncio.Task: 201. name (if available).\n\n\nChanged in version 3.1: 'processName' was added.\n\nChanged in version 3.12: 'taskName' was added.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: LoggerAdapter Objects,  Next: Thread Safety,  Prev: LogRecord attributes,  Up: logging -- Logging facility for Python": {
            "content": "5.16.6.8 LoggerAdapter Objects\n..............................\n\n*note LoggerAdapter: 116a. instances are used to conveniently pass\ncontextual information into logging calls.  For a usage example, see the\nsection on *note adding contextual information to your logging output:\n29fa.\n\n-- Class: logging.LoggerAdapter (logger, extra)\n\nReturns an instance of *note LoggerAdapter: 116a. initialized with\nan underlying *note Logger: 98b. instance and a dict-like object.\n\n-- Method: process (msg, kwargs)\n\nModifies the message and/or keyword arguments passed to a\nlogging call in order to insert contextual information.  This\nimplementation takes the object passed as 'extra' to the\nconstructor and adds it to 'kwargs' using key 'extra'.  The\nreturn value is a ('msg', 'kwargs') tuple which has the\n(possibly modified) versions of the arguments passed in.\n\n-- Attribute: manager\n\nDelegates to the underlying 'manager`' on 'logger'.\n\n-- Attribute: log\n\nDelegates to the underlying 'log`()' method on 'logger'.\n\nIn addition to the above, *note LoggerAdapter: 116a. supports the\nfollowing methods of *note Logger: 98b.: *note debug(): c89, *note\ninfo(): 29c2, *note warning(): 29c4, *note error(): 29c5, *note\nexception(): c87, *note critical(): c88, *note log(): c86, *note\nisEnabledFor(): 116b, *note getEffectiveLevel(): 29c0, *note\nsetLevel(): 12e7. and *note hasHandlers(): 29cc.  These methods\nhave the same signatures as their counterparts in *note Logger:\n98b, so you can use the two types of instances interchangeably.\n\nChanged in version 3.2: The *note isEnabledFor(): 116b, *note\ngetEffectiveLevel(): 29c0, *note setLevel(): 12e7. and *note\nhasHandlers(): 29cc. methods were added to *note LoggerAdapter:\n116a.  These methods delegate to the underlying logger.\n\nChanged in version 3.6: Attribute 'manager' and method 'log()'\nwere added, which delegate to the underlying logger and allow\nadapters to be nested.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Thread Safety,  Next: Module-Level Functions,  Prev: LoggerAdapter Objects,  Up: logging -- Logging facility for Python": {
            "content": "5.16.6.9 Thread Safety\n......................\n",
            "subsections": []
        },
        "The logging module is intended to be thread-safe without any special": {
            "content": "work needing to be done by its clients.  It achieves this though using\nthreading locks; there is one lock to serialize access to the module's\nshared data, and each handler also creates a lock to serialize access to\nits underlying I/O.\n\nIf you are implementing asynchronous signal handlers using the *note\nsignal: c1. module, you may not be able to use logging from within such\nhandlers.  This is because lock implementations in the *note threading:\ne7. module are not always re-entrant, and so cannot be invoked from such\nsignal handlers.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Module-Level Functions,  Next: Module-Level Attributes,  Prev: Thread Safety,  Up: logging -- Logging facility for Python": {
            "content": "5.16.6.10 Module-Level Functions\n................................\n",
            "subsections": []
        },
        "In addition to the classes described above, there are a number of": {
            "content": "module-level functions.\n\n-- Function: logging.getLogger (name=None)\n\nReturn a logger with the specified name or, if name is 'None',\nreturn a logger which is the root logger of the hierarchy.  If\nspecified, the name is typically a dot-separated hierarchical name\nlike ''a'', ''a.b'' or ''a.b.c.d''.  Choice of these names is\nentirely up to the developer who is using logging.\n\nAll calls to this function with a given name return the same logger\ninstance.  This means that logger instances never need to be passed\nbetween different parts of an application.\n\n-- Function: logging.getLoggerClass ()\n\nReturn either the standard *note Logger: 98b. class, or the last\nclass passed to *note setLoggerClass(): 2a01.  This function may be\ncalled from within a new class definition, to ensure that\ninstalling a customized *note Logger: 98b. class will not undo\ncustomizations already applied by other code.  For example:\n\nclass MyLogger(logging.getLoggerClass()):\n# ... override behaviour here\n\n-- Function: logging.getLogRecordFactory ()\n\nReturn a callable which is used to create a *note LogRecord: e59.\n\nNew in version 3.2: This function has been provided, along with\n*note setLogRecordFactory(): 29f6, to allow developers more control\nover how the *note LogRecord: e59. representing a logging event is\nconstructed.\n\nSee *note setLogRecordFactory(): 29f6. for more information about\nthe how the factory is called.\n\n-- Function: logging.debug (msg, *args, kwargs)\n\nThis is a convenience function that calls *note Logger.debug():\nc89, on the root logger.  The handling of the arguments is in every\nway identical to what is described in that method.\n\nThe only difference is that if the root logger has no handlers,\nthen *note basicConfig(): 828. is called, prior to calling 'debug'\non the root logger.\n\nFor very short scripts or quick demonstrations of 'logging'\nfacilities, 'debug' and the other module-level functions may be\nconvenient.  However, most programs will want to carefully and\nexplicitly control the logging configuration, and should therefore\nprefer creating a module-level logger and calling *note\nLogger.debug(): c89. (or other level-specific methods) on it, as\ndescribed at the beginnning of this documentation.\n\n-- Function: logging.info (msg, *args, kwargs)\n\nLogs a message with level *note INFO: 1a77. on the root logger.\nThe arguments and behavior are otherwise the same as for *note\ndebug(): 29c3.\n\n-- Function: logging.warning (msg, *args, kwargs)\n\nLogs a message with level *note WARNING: 1a78. on the root logger.\nThe arguments and behavior are otherwise the same as for *note\ndebug(): 29c3.\n\nNote: There is an obsolete function 'warn' which is\nfunctionally identical to 'warning'.  As 'warn' is deprecated,\nplease do not use it - use 'warning' instead.\n\n-- Function: logging.error (msg, *args, kwargs)\n\nLogs a message with level *note ERROR: 1a79. on the root logger.\nThe arguments and behavior are otherwise the same as for *note\ndebug(): 29c3.\n\n-- Function: logging.critical (msg, *args, kwargs)\n\nLogs a message with level *note CRITICAL: 1a7a. on the root logger.\nThe arguments and behavior are otherwise the same as for *note\ndebug(): 29c3.\n\n-- Function: logging.exception (msg, *args, kwargs)\n\nLogs a message with level *note ERROR: 1a79. on the root logger.\nThe arguments and behavior are otherwise the same as for *note\ndebug(): 29c3.  Exception info is added to the logging message.\nThis function should only be called from an exception handler.\n\n-- Function: logging.log (level, msg, *args, kwargs)\n\nLogs a message with level 'level' on the root logger.  The\narguments and behavior are otherwise the same as for *note debug():\n29c3.\n\n-- Function: logging.disable (level=CRITICAL)\n\nProvides an overriding level 'level' for all loggers which takes\nprecedence over the logger's own level.  When the need arises to\ntemporarily throttle logging output down across the whole\napplication, this function can be useful.  Its effect is to disable\nall logging calls of severity 'level' and below, so that if you\ncall it with a value of INFO, then all INFO and DEBUG events would\nbe discarded, whereas those of severity WARNING and above would be\nprocessed according to the logger's effective level.  If\n'logging.disable(logging.NOTSET)' is called, it effectively removes\nthis overriding level, so that logging output again depends on the\neffective levels of individual loggers.\n\nNote that if you have defined any custom logging level higher than\n'CRITICAL' (this is not recommended), you won't be able to rely on\nthe default value for the 'level' parameter, but will have to\nexplicitly supply a suitable value.\n\nChanged in version 3.7: The 'level' parameter was defaulted to\nlevel 'CRITICAL'.  See bpo-28524(1) for more information about this\nchange.\n\n-- Function: logging.addLevelName (level, levelName)\n\nAssociates level 'level' with text 'levelName' in an internal\ndictionary, which is used to map numeric levels to a textual\nrepresentation, for example when a *note Formatter: 12ec. formats a\nmessage.  This function can also be used to define your own levels.\nThe only constraints are that all levels used must be registered\nusing this function, levels should be positive integers and they\nshould increase in increasing order of severity.\n\nNote: If you are thinking of defining your own levels, please\nsee the section on *note Custom Levels: 2a07.\n\n-- Function: logging.getLevelNamesMapping ()\n\nReturns a mapping from level names to their corresponding logging\nlevels.  For example, the string \"CRITICAL\" maps to *note CRITICAL:\n1a7a.  The returned mapping is copied from an internal mapping on\neach call to this function.\n\nNew in version 3.11.\n\n-- Function: logging.getLevelName (level)\n\nReturns the textual or numeric representation of logging level\n'level'.\n\nIf 'level' is one of the predefined levels *note CRITICAL: 1a7a,\n*note ERROR: 1a79, *note WARNING: 1a78, *note INFO: 1a77. or *note\nDEBUG: 1a76. then you get the corresponding string.  If you have\nassociated levels with names using *note addLevelName(): 2a06. then\nthe name you have associated with 'level' is returned.  If a\nnumeric value corresponding to one of the defined levels is passed\nin, the corresponding string representation is returned.\n\nThe 'level' parameter also accepts a string representation of the\nlevel such as 'INFO'.  In such cases, this functions returns the\ncorresponding numeric value of the level.\n\nIf no matching numeric or string value is passed in, the string\n'Level %s' % level is returned.\n\nNote: Levels are internally integers (as they need to be\ncompared in the logging logic).  This function is used to\nconvert between an integer level and the level name displayed\nin the formatted log output by means of the '%(levelname)s'\nformat specifier (see *note LogRecord attributes: 29c1.), and\nvice versa.\n\nChanged in version 3.4: In Python versions earlier than 3.4, this\nfunction could also be passed a text level, and would return the\ncorresponding numeric value of the level.  This undocumented\nbehaviour was considered a mistake, and was removed in Python 3.4,\nbut reinstated in 3.4.2 due to retain backward compatibility.\n\n-- Function: logging.getHandlerByName (name)\n\nReturns a handler with the specified 'name', or 'None' if there is\nno handler with that name.\n\nNew in version 3.12.\n\n-- Function: logging.getHandlerNames ()\n\nReturns an immutable set of all known handler names.\n\nNew in version 3.12.\n\n-- Function: logging.makeLogRecord (attrdict)\n\nCreates and returns a new *note LogRecord: e59. instance whose\nattributes are defined by 'attrdict'.  This function is useful for\ntaking a pickled *note LogRecord: e59. attribute dictionary, sent\nover a socket, and reconstituting it as a *note LogRecord: e59.\ninstance at the receiving end.\n\n-- Function: logging.basicConfig (kwargs)\n\nDoes basic configuration for the logging system by creating a *note\nStreamHandler: 106c. with a default *note Formatter: 12ec. and\nadding it to the root logger.  The functions *note debug(): 29c3,\n*note info(): 29ee, *note warning(): 12e8, *note error(): 2a02. and\n*note critical(): 2a03. will call *note basicConfig(): 828.\nautomatically if no handlers are defined for the root logger.\n\nThis function does nothing if the root logger already has handlers\nconfigured, unless the keyword argument 'force' is set to 'True'.\n\nNote: This function should be called from the main thread\nbefore other threads are started.  In versions of Python prior\nto 2.7.1 and 3.2, if this function is called from multiple\nthreads, it is possible (in rare circumstances) that a handler\nwill be added to the root logger more than once, leading to\nunexpected results such as messages being duplicated in the\nlog.\n\nThe following keyword arguments are supported.\n\nFormat             Description\n\n---------------------------------------------------------------------\n\n'filename'         Specifies that a *note FileHandler: 1600. be\ncreated, using the specified filename, rather\nthan a *note StreamHandler: 106c.\n\n\n'filemode'         If 'filename' is specified, open the file in\nthis *note mode: 1e81.  Defaults to ''a''.\n\n\n'format'           Use the specified format string for the\nhandler.  Defaults to attributes 'levelname',\n'name' and 'message' separated by colons.\n\n\n'datefmt'          Use the specified date/time format, as accepted\nby *note time.strftime(): 105d.\n\n\n'style'            If 'format' is specified, use this style for\nthe format string.  One of ''%'', ''{'' or\n''$'' for *note printf-style: 49c,\n*note str.format(): 3ed. or\n*note string.Template: 453. respectively.\nDefaults to ''%''.\n\n\n'level'            Set the root logger level to the specified\n*note level: 424.\n\n\n'stream'           Use the specified stream to initialize the\n*note StreamHandler: 106c.  Note that this\nargument is incompatible with 'filename' - if\nboth are present, a 'ValueError' is raised.\n\n\n'handlers'         If specified, this should be an iterable of\nalready created handlers to add to the root\nlogger.  Any handlers which don't already have\na formatter set will be assigned the default\nformatter created in this function.  Note that\nthis argument is incompatible with 'filename'\nor 'stream' - if both are present, a\n'ValueError' is raised.\n\n\n'force'            If this keyword argument is specified as true,\nany existing handlers attached to the root\nlogger are removed and closed, before carrying\nout the configuration as specified by the other\narguments.\n\n\n'encoding'         If this keyword argument is specified along\nwith 'filename', its value is used when the\n*note FileHandler: 1600. is created, and thus\nused when opening the output file.\n\n\n'errors'           If this keyword argument is specified along\nwith 'filename', its value is used when the\n*note FileHandler: 1600. is created, and thus\nused when opening the output file.  If not\nspecified, the value 'backslashreplace' is\nused.  Note that if 'None' is specified, it\nwill be passed as such to *note open(): 26e,\nwhich means that it will be treated the same as\npassing 'errors'.\n\n\nChanged in version 3.2: The 'style' argument was added.\n\nChanged in version 3.3: The 'handlers' argument was added.\nAdditional checks were added to catch situations where incompatible\narguments are specified (e.g.  'handlers' together with 'stream' or\n'filename', or 'stream' together with 'filename').\n\nChanged in version 3.8: The 'force' argument was added.\n\nChanged in version 3.9: The 'encoding' and 'errors' arguments were\nadded.\n\n-- Function: logging.shutdown ()\n\nInforms the logging system to perform an orderly shutdown by\nflushing and closing all handlers.  This should be called at\napplication exit and no further use of the logging system should be\nmade after this call.\n\nWhen the logging module is imported, it registers this function as\nan exit handler (see *note atexit: a.), so normally there's no need\nto do that manually.\n\n-- Function: logging.setLoggerClass (klass)\n\nTells the logging system to use the class 'klass' when\ninstantiating a logger.  The class should define 'init()' such\nthat only a name argument is required, and the 'init()' should\ncall 'Logger.init()'.  This function is typically called before\nany loggers are instantiated by applications which need to use\ncustom logger behavior.  After this call, as at any other time, do\nnot instantiate loggers directly using the subclass: continue to\nuse the *note logging.getLogger(): 781. API to get your loggers.\n\n-- Function: logging.setLogRecordFactory (factory)\n\nSet a callable which is used to create a *note LogRecord: e59.\n\n\nParameters: 'factory' - The factory callable to be used to\ninstantiate a log record.\n\nNew in version 3.2: This function has been provided, along with\n*note getLogRecordFactory(): 29f5, to allow developers more control\nover how the *note LogRecord: e59. representing a logging event is\nconstructed.\n\nThe factory has the following signature:\n\n'factory(name, level, fn, lno, msg, args, excinfo, func=None,\nsinfo=None, kwargs)'\n\n\nname: The logger name.\n\n\nlevel: The logging level (numeric).\n\n\nfn: The full pathname of the file where the logging call was\nmade.\n\n\nlno: The line number in the file where the logging call was\nmade.\n\n\nmsg: The logging message.\n\n\nargs: The arguments for the logging message.\n\n\nexcinfo: An exception tuple, or 'None'.\n\n\nfunc: The name of the function or method which invoked the\nlogging call.\n\n\nsinfo: A stack traceback such as is provided by *note\ntraceback.printstack(): ceb, showing the call hierarchy.\n\n\nkwargs: Additional keyword arguments.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=28524\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Module-Level Attributes,  Next: Integration with the warnings module,  Prev: Module-Level Functions,  Up: logging -- Logging facility for Python": {
            "content": "5.16.6.11 Module-Level Attributes\n.................................\n\n-- Attribute: logging.lastResort\n\nA \"handler of last resort\" is available through this attribute.\nThis is a *note StreamHandler: 106c. writing to 'sys.stderr' with a\nlevel of 'WARNING', and is used to handle logging events in the\nabsence of any logging configuration.  The end result is to just\nprint the message to 'sys.stderr'.  This replaces the earlier error\nmessage saying that \"no handlers could be found for logger XYZ\".\nIf you need the earlier behaviour for some reason, 'lastResort' can\nbe set to 'None'.\n\nNew in version 3.2.\n\n-- Attribute: logging.raiseExceptions\n\nUsed to see if exceptions during handling should be propagated.\n\nDefault: 'True'.\n\nIf *note raiseExceptions: 106d. is 'False', exceptions get silently\nignored.  This is what is mostly wanted for a logging system - most\nusers will not care about errors in the logging system, they are\nmore interested in application errors.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Integration with the warnings module,  Prev: Module-Level Attributes,  Up: logging -- Logging facility for Python": {
            "content": "5.16.6.12 Integration with the warnings module\n..............................................\n\nThe *note captureWarnings(): 2a0b. function can be used to integrate\n*note logging: 82. with the *note warnings: 10d. module.\n\n-- Function: logging.captureWarnings (capture)\n\nThis function is used to turn the capture of warnings by logging on\nand off.\n\nIf 'capture' is 'True', warnings issued by the *note warnings: 10d.\nmodule will be redirected to the logging system.  Specifically, a\nwarning will be formatted using *note warnings.formatwarning():\n178d. and the resulting string logged to a logger named\n''py.warnings'' with a severity of *note WARNING: 1a78.\n\nIf 'capture' is 'False', the redirection of warnings to the logging\nsystem will stop, and warnings will be redirected to their original\ndestinations (i.e.  those in effect before 'captureWarnings(True)'\nwas called).\n\nSee also\n........\n\nModule *note logging.config: 83.\n\nConfiguration API for the logging module.\n\nModule *note logging.handlers: 84.\n\nUseful handlers included with the logging module.\n\nPEP 282(1) - A Logging System\n\nThe proposal which described this feature for inclusion in the\nPython standard library.\n",
            "subsections": []
        },
        "Original Python logging package(2)": {
            "content": "This is the original source for the *note logging: 82. package.\nThe version of the package available from this site is suitable for\nuse with Python 1.5.2, 2.1.x and 2.2.x, which do not include the\n*note logging: 82. package in the standard library.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0282/\n\n(2) https://old.red-dove.com/pythonlogging.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: logging config -- Logging configuration,  Next: logging handlers -- Logging handlers,  Prev: logging -- Logging facility for Python,  Up: Generic Operating System Services": {
            "content": "'Source code:' Lib/logging/config.py(1)\n",
            "subsections": []
        },
        "This page contains only reference information.  For tutorials, please": {
            "content": "see\n\n* *note Basic Tutorial: 1069.\n\n* *note Advanced Tutorial: 106a.\n\n* *note Logging Cookbook: 106b.\n\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Configuration functions,  Next: Security considerations,  Up: logging config -- Logging configuration": {
            "content": "5.16.7.1 Configuration functions\n................................\n",
            "subsections": []
        },
        "The following functions configure the logging module.  They are located": {
            "content": "in the *note logging.config: 83. module.  Their use is optional -- you\ncan configure the logging module using these functions or by making\ncalls to the main API (defined in *note logging: 82. itself) and\ndefining handlers which are declared either in *note logging: 82. or\n*note logging.handlers: 84.\n\n-- Function: logging.config.dictConfig (config)\n\nTakes the logging configuration from a dictionary.  The contents of\nthis dictionary are described in *note Configuration dictionary\nschema: 2a0f. below.\n\nIf an error is encountered during configuration, this function will\nraise a *note ValueError: 183, *note TypeError: 28e, *note\nAttributeError: 395. or *note ImportError: 145. with a suitably\ndescriptive message.  The following is a (possibly incomplete) list\nof conditions which will raise an error:\n\n* A 'level' which is not a string or which is a string not\ncorresponding to an actual logging level.\n\n* A 'propagate' value which is not a boolean.\n\n* An id which does not have a corresponding destination.\n\n* A non-existent handler id found during an incremental call.\n\n* An invalid logger name.\n\n* Inability to resolve to an internal or external object.\n\nParsing is performed by the 'DictConfigurator' class, whose\nconstructor is passed the dictionary used for configuration, and\nhas a 'configure()' method.  The *note logging.config: 83. module\nhas a callable attribute 'dictConfigClass' which is initially set\nto 'DictConfigurator'.  You can replace the value of\n'dictConfigClass' with a suitable implementation of your own.\n\n*note dictConfig(): 1023. calls 'dictConfigClass' passing the\nspecified dictionary, and then calls the 'configure()' method on\nthe returned object to put the configuration into effect:\n\ndef dictConfig(config):\ndictConfigClass(config).configure()\n\nFor example, a subclass of 'DictConfigurator' could call\n'DictConfigurator.init()' in its own 'init()', then set up\ncustom prefixes which would be usable in the subsequent\n'configure()' call.  'dictConfigClass' would be bound to this new\nsubclass, and then *note dictConfig(): 1023. could be called\nexactly as in the default, uncustomized state.\n\nNew in version 3.2.\n\n-- Function: logging.config.fileConfig (fname, defaults=None,\ndisableexistingloggers=True, encoding=None)\n\nReads the logging configuration from a *note configparser:\n20.-format file.  The format of the file should be as described in\n*note Configuration file format: 2a10.  This function can be called\nseveral times from an application, allowing an end user to select\nfrom various pre-canned configurations (if the developer provides a\nmechanism to present the choices and load the chosen\nconfiguration).\n\nIt will raise *note FileNotFoundError: 353. if the file doesn't\nexist and *note RuntimeError: 17a. if the file is invalid or empty.\n\n\nParameters:\n\n* 'fname' - A filename, or a file-like object, or an instance\nderived from *note RawConfigParser: dd4.  If a\n'RawConfigParser'-derived instance is passed, it is used as\nis.  Otherwise, a *note ConfigParser: 257. is instantiated,\nand the configuration read by it from the object passed in\n'fname'.  If that has a *note readline(): b5. method, it is\nassumed to be a file-like object and read using *note\nreadfile(): 258.; otherwise, it is assumed to be a filename\nand passed to *note read(): 12bd.\n\n* 'defaults' - Defaults to be passed to the 'ConfigParser' can\nbe specified in this argument.\n\n* 'disableexistingloggers' - If specified as 'False', loggers\nwhich exist when this call is made are left enabled.  The\ndefault is 'True' because this enables old behaviour in a\nbackward-compatible way.  This behaviour is to disable any\nexisting non-root loggers unless they or their ancestors are\nexplicitly named in the logging configuration.\n\n* 'encoding' - The encoding used to open file when 'fname' is\nfilename.\n\nChanged in version 3.4: An instance of a subclass of *note\nRawConfigParser: dd4. is now accepted as a value for 'fname'.  This\nfacilitates:\n\n* Use of a configuration file where logging configuration\nis just part of the overall application configuration.\n\n* Use of a configuration read from a file, and then\nmodified by the using application (e.g.  based on\ncommand-line parameters or other aspects of the runtime\nenvironment) before being passed to 'fileConfig'.\n\nChanged in version 3.10: Added the 'encoding' parameter.\n\nChanged in version 3.12: An exception will be thrown if the\nprovided file doesn't exist or is invalid or empty.\n\n-- Function: logging.config.listen (port=DEFAULTLOGGINGCONFIGPORT,\nverify=None)\n\nStarts up a socket server on the specified port, and listens for\nnew configurations.  If no port is specified, the module's default\n'DEFAULTLOGGINGCONFIGPORT' is used.  Logging configurations will\nbe sent as a file suitable for processing by *note dictConfig():\n1023. or *note fileConfig(): 98d.  Returns a *note Thread: 76c.\ninstance on which you can call *note start(): 2a11. to start the\nserver, and which you can *note join(): 1058. when appropriate.  To\nstop the server, call *note stopListening(): 2a12.\n\nThe 'verify' argument, if specified, should be a callable which\nshould verify whether bytes received across the socket are valid\nand should be processed.  This could be done by encrypting and/or\nsigning what is sent across the socket, such that the 'verify'\ncallable can perform signature verification and/or decryption.  The\n'verify' callable is called with a single argument - the bytes\nreceived across the socket - and should return the bytes to be\nprocessed, or 'None' to indicate that the bytes should be\ndiscarded.  The returned bytes could be the same as the passed in\nbytes (e.g.  when only verification is done), or they could be\ncompletely different (perhaps if decryption were performed).\n\nTo send a configuration to the socket, read in the configuration\nfile and send it to the socket as a sequence of bytes preceded by a\nfour-byte length string packed in binary using 'struct.pack('>L',\nn)'.\nNote: Because portions of the configuration are passed through\n*note eval(): 690, use of this function may open its users to\na security risk.  While the function only binds to a socket on\n'localhost', and so does not accept connections from remote\nmachines, there are scenarios where untrusted code could be\nrun under the account of the process which calls *note\nlisten(): dd5.  Specifically, if the process calling *note\nlisten(): dd5. runs on a multi-user machine where users cannot\ntrust each other, then a malicious user could arrange to run\nessentially arbitrary code in a victim user's process, simply\nby connecting to the victim's *note listen(): dd5. socket and\nsending a configuration which runs whatever code the attacker\nwants to have executed in the victim's process.  This is\nespecially easy to do if the default port is used, but not\nhard even if a different port is used.  To avoid the risk of\nthis happening, use the 'verify' argument to *note listen():\ndd5. to prevent unrecognised configurations from being\napplied.\n\nChanged in version 3.4: The 'verify' argument was added.\n\nNote: If you want to send configurations to the listener which\ndon't disable existing loggers, you will need to use a JSON\nformat for the configuration, which will use *note\ndictConfig(): 1023. for configuration.  This method allows you\nto specify 'disableexistingloggers' as 'False' in the\nconfiguration you send.\n\n-- Function: logging.config.stopListening ()\n\nStops the listening server which was created with a call to *note\nlisten(): dd5.  This is typically called before calling 'join()' on\nthe return value from *note listen(): dd5.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Security considerations,  Next: Configuration dictionary schema,  Prev: Configuration functions,  Up: logging config -- Logging configuration": {
            "content": "5.16.7.2 Security considerations\n................................\n",
            "subsections": []
        },
        "The logging configuration functionality tries to offer convenience, and": {
            "content": "in part this is done by offering the ability to convert text in\nconfiguration files into Python objects used in logging configuration -\nfor example, as described in *note User-defined objects: 2a15.  However,\nthese same mechanisms (importing callables from user-defined modules and\ncalling them with parameters from the configuration) could be used to\ninvoke any code you like, and for this reason you should treat\nconfiguration files from untrusted sources with 'extreme caution' and\nsatisfy yourself that nothing bad can happen if you load them, before\nactually loading them.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Configuration dictionary schema,  Next: Configuration file format,  Prev: Security considerations,  Up: logging config -- Logging configuration": {
            "content": "5.16.7.3 Configuration dictionary schema\n........................................\n",
            "subsections": []
        },
        "Describing a logging configuration requires listing the various objects": {
            "content": "to create and the connections between them; for example, you may create\na handler named 'console' and then say that the logger named 'startup'\nwill send its messages to the 'console' handler.  These objects aren't\nlimited to those provided by the *note logging: 82. module because you\nmight write your own formatter or handler class.  The parameters to\nthese classes may also need to include external objects such as\n'sys.stderr'.  The syntax for describing these objects and connections\nis defined in *note Object connections: 2a17. below.\n\n* Menu:\n\n* Dictionary Schema Details::\n* Incremental Configuration::\n* Object connections::\n* User-defined objects::\n* Handler configuration order::\n* Access to external objects::\n* Access to internal objects::\n* Import resolution and custom importers::\n* Configuring QueueHandler and QueueListener::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Dictionary Schema Details,  Next: Incremental Configuration,  Up: Configuration dictionary schema": {
            "content": "5.16.7.4 Dictionary Schema Details\n..................................\n\nThe dictionary passed to *note dictConfig(): 1023. must contain the\nfollowing keys:\n\n* 'version' - to be set to an integer value representing the schema\nversion.  The only valid value at present is 1, but having this key\nallows the schema to evolve while still preserving backwards\ncompatibility.\n",
            "subsections": []
        },
        "All other keys are optional, but if present they will be interpreted as": {
            "content": "described below.  In all cases below where a 'configuring dict' is\nmentioned, it will be checked for the special ''()'' key to see if a\ncustom instantiation is required.  If so, the mechanism described in\n*note User-defined objects: 2a15. below is used to create an instance;\notherwise, the context is used to determine what to instantiate.\n\n* 'formatters' - the corresponding value will be a dict in which each\nkey is a formatter id and each value is a dict describing how to\nconfigure the corresponding *note Formatter: 12ec. instance.\n\nThe configuring dict is searched for the following optional keys\nwhich correspond to the arguments passed to create a *note\nFormatter: 12ec. object:\n\n* 'format'\n\n* 'datefmt'\n\n* 'style'\n\n* 'validate' (since version >=3.8)\n\n* 'defaults' (since version >=3.12)\n\nAn optional 'class' key indicates the name of the formatter's class\n(as a dotted module and class name).  The instantiation arguments\nare as for *note Formatter: 12ec, thus this key is most useful for\ninstantiating a customised subclass of *note Formatter: 12ec.  For\nexample, the alternative class might present exception tracebacks\nin an expanded or condensed format.  If your formatter requires\ndifferent or extra configuration keys, you should use *note\nUser-defined objects: 2a15.\n\n* 'filters' - the corresponding value will be a dict in which each\nkey is a filter id and each value is a dict describing how to\nconfigure the corresponding Filter instance.\n\nThe configuring dict is searched for the key 'name' (defaulting to\nthe empty string) and this is used to construct a *note\nlogging.Filter: 106f. instance.\n\n* 'handlers' - the corresponding value will be a dict in which each\nkey is a handler id and each value is a dict describing how to\nconfigure the corresponding Handler instance.\n\nThe configuring dict is searched for the following keys:\n\n* 'class' (mandatory).  This is the fully qualified name of the\nhandler class.\n\n* 'level' (optional).  The level of the handler.\n\n* 'formatter' (optional).  The id of the formatter for this\nhandler.\n\n* 'filters' (optional).  A list of ids of the filters for this\nhandler.\n\nChanged in version 3.11: 'filters' can take filter instances\nin addition to ids.\n\nAll 'other' keys are passed through as keyword arguments to the\nhandler's constructor.  For example, given the snippet:\n\nhandlers:\nconsole:\nclass : logging.StreamHandler\nformatter: brief\nlevel   : INFO\nfilters: [allowfoo]\nstream  : ext://sys.stdout\nfile:\nclass : logging.handlers.RotatingFileHandler\nformatter: precise\nfilename: logconfig.log\nmaxBytes: 1024\nbackupCount: 3\n\nthe handler with id 'console' is instantiated as a *note\nlogging.StreamHandler: 106c, using 'sys.stdout' as the underlying\nstream.  The handler with id 'file' is instantiated as a *note\nlogging.handlers.RotatingFileHandler: 2a1a. with the keyword\narguments 'filename='logconfig.log', maxBytes=1024, backupCount=3'.\n\n* 'loggers' - the corresponding value will be a dict in which each\nkey is a logger name and each value is a dict describing how to\nconfigure the corresponding Logger instance.\n\nThe configuring dict is searched for the following keys:\n\n* 'level' (optional).  The level of the logger.\n\n* 'propagate' (optional).  The propagation setting of the\nlogger.\n\n* 'filters' (optional).  A list of ids of the filters for this\nlogger.\n\nChanged in version 3.11: 'filters' can take filter instances\nin addition to ids.\n\n* 'handlers' (optional).  A list of ids of the handlers for this\nlogger.\n\nThe specified loggers will be configured according to the level,\npropagation, filters and handlers specified.\n\n* 'root' - this will be the configuration for the root logger.\nProcessing of the configuration will be as for any logger, except\nthat the 'propagate' setting will not be applicable.\n\n* 'incremental' - whether the configuration is to be interpreted as\nincremental to the existing configuration.  This value defaults to\n'False', which means that the specified configuration replaces the\nexisting configuration with the same semantics as used by the\nexisting *note fileConfig(): 98d. API.\n\nIf the specified value is 'True', the configuration is processed as\ndescribed in the section on *note Incremental Configuration: 2a1b.\n\n* 'disableexistingloggers' - whether any existing non-root loggers\nare to be disabled.  This setting mirrors the parameter of the same\nname in *note fileConfig(): 98d.  If absent, this parameter\ndefaults to 'True'.  This value is ignored if 'incremental' is\n'True'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Incremental Configuration,  Next: Object connections,  Prev: Dictionary Schema Details,  Up: Configuration dictionary schema": {
            "content": "5.16.7.5 Incremental Configuration\n..................................\n",
            "subsections": []
        },
        "It is difficult to provide complete flexibility for incremental": {
            "content": "configuration.  For example, because objects such as filters and\nformatters are anonymous, once a configuration is set up, it is not\npossible to refer to such anonymous objects when augmenting a\nconfiguration.\n",
            "subsections": []
        },
        "Furthermore, there is not a compelling case for arbitrarily altering the": {
            "content": "object graph of loggers, handlers, filters, formatters at run-time, once\na configuration is set up; the verbosity of loggers and handlers can be\ncontrolled just by setting levels (and, in the case of loggers,\npropagation flags).  Changing the object graph arbitrarily in a safe way\nis problematic in a multi-threaded environment; while not impossible,\nthe benefits are not worth the complexity it adds to the implementation.\n",
            "subsections": []
        },
        "Thus, when the 'incremental' key of a configuration dict is present and": {
            "content": "is 'True', the system will completely ignore any 'formatters' and\n'filters' entries, and process only the 'level' settings in the\n'handlers' entries, and the 'level' and 'propagate' settings in the\n'loggers' and 'root' entries.\n",
            "subsections": []
        },
        "Using a value in the configuration dict lets configurations to be sent": {
            "content": "over the wire as pickled dicts to a socket listener.  Thus, the logging\nverbosity of a long-running application can be altered over time with no\nneed to stop and restart the application.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Object connections,  Next: User-defined objects,  Prev: Incremental Configuration,  Up: Configuration dictionary schema": {
            "content": "5.16.7.6 Object connections\n...........................\n",
            "subsections": []
        },
        "The schema describes a set of logging objects - loggers, handlers,": {
            "content": "formatters, filters - which are connected to each other in an object\ngraph.  Thus, the schema needs to represent connections between the\nobjects.  For example, say that, once configured, a particular logger\nhas attached to it a particular handler.  For the purposes of this\ndiscussion, we can say that the logger represents the source, and the\nhandler the destination, of a connection between the two.  Of course in\nthe configured objects this is represented by the logger holding a\nreference to the handler.  In the configuration dict, this is done by\ngiving each destination object an id which identifies it unambiguously,\nand then using the id in the source object's configuration to indicate\nthat a connection exists between the source and the destination object\nwith that id.\n\nSo, for example, consider the following YAML snippet:\n\nformatters:\nbrief:\n# configuration for formatter with id 'brief' goes here\nprecise:\n# configuration for formatter with id 'precise' goes here\nhandlers:\nh1: #This is an id\n# configuration of handler with id 'h1' goes here\nformatter: brief\nh2: #This is another id\n# configuration of handler with id 'h2' goes here\nformatter: precise\nloggers:\nfoo.bar.baz:\n# other configuration for logger 'foo.bar.baz'\nhandlers: [h1, h2]\n\n(Note: YAML used here because it's a little more readable than the\nequivalent Python source form for the dictionary.)\n",
            "subsections": []
        },
        "The ids for loggers are the logger names which would be used": {
            "content": "programmatically to obtain a reference to those loggers, e.g.\n'foo.bar.baz'.  The ids for Formatters and Filters can be any string\nvalue (such as 'brief', 'precise' above) and they are transient, in that\nthey are only meaningful for processing the configuration dictionary and\nused to determine connections between objects, and are not persisted\nanywhere when the configuration call is complete.\n",
            "subsections": []
        },
        "The above snippet indicates that logger named 'foo.bar.baz' should have": {
            "content": "two handlers attached to it, which are described by the handler ids 'h1'\nand 'h2'.  The formatter for 'h1' is that described by id 'brief', and\nthe formatter for 'h2' is that described by id 'precise'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: User-defined objects,  Next: Handler configuration order,  Prev: Object connections,  Up: Configuration dictionary schema": {
            "content": "5.16.7.7 User-defined objects\n.............................\n",
            "subsections": []
        },
        "The schema supports user-defined objects for handlers, filters and": {
            "content": "formatters.  (Loggers do not need to have different types for different\ninstances, so there is no support in this configuration schema for\nuser-defined logger classes.)\n",
            "subsections": []
        },
        "Objects to be configured are described by dictionaries which detail": {
            "content": "their configuration.  In some places, the logging system will be able to\ninfer from the context how an object is to be instantiated, but when a\nuser-defined object is to be instantiated, the system will not know how\nto do this.  In order to provide complete flexibility for user-defined\nobject instantiation, the user needs to provide a 'factory' - a callable\nwhich is called with a configuration dictionary and which returns the\ninstantiated object.  This is signalled by an absolute import path to\nthe factory being made available under the special key ''()''.  Here's a\nconcrete example:\n\nformatters:\nbrief:\nformat: '%(message)s'\ndefault:\nformat: '%(asctime)s %(levelname)-8s %(name)-15s %(message)s'\ndatefmt: '%Y-%m-%d %H:%M:%S'\ncustom:\n(): my.package.customFormatterFactory\nbar: baz\nspam: 99.9\nanswer: 42\n",
            "subsections": []
        },
        "The above YAML snippet defines three formatters.  The first, with id": {
            "content": "'brief', is a standard *note logging.Formatter: 12ec. instance with the\nspecified format string.  The second, with id 'default', has a longer\nformat and also defines the time format explicitly, and will result in a\n*note logging.Formatter: 12ec. initialized with those two format\nstrings.  Shown in Python source form, the 'brief' and 'default'\nformatters have configuration sub-dictionaries:\n\n{\n'format' : '%(message)s'\n}\n\nand:\n\n{\n'format' : '%(asctime)s %(levelname)-8s %(name)-15s %(message)s',\n'datefmt' : '%Y-%m-%d %H:%M:%S'\n}\n\nrespectively, and as these dictionaries do not contain the special key\n''()'', the instantiation is inferred from the context: as a result,\nstandard *note logging.Formatter: 12ec. instances are created.  The\nconfiguration sub-dictionary for the third formatter, with id 'custom',\nis:\n\n{\n'()' : 'my.package.customFormatterFactory',\n'bar' : 'baz',\n'spam' : 99.9,\n'answer' : 42\n}\n\nand this contains the special key ''()'', which means that user-defined\ninstantiation is wanted.  In this case, the specified factory callable\nwill be used.  If it is an actual callable it will be used directly -\notherwise, if you specify a string (as in the example) the actual\ncallable will be located using normal import mechanisms.  The callable\nwill be called with the 'remaining' items in the configuration\nsub-dictionary as keyword arguments.  In the above example, the\nformatter with id 'custom' will be assumed to be returned by the call:\n\nmy.package.customFormatterFactory(bar='baz', spam=99.9, answer=42)\n\nWarning: The values for keys such as 'bar', 'spam' and 'answer' in\nthe above example should not be configuration dictionaries or\nreferences such as 'cfg://foo' or 'ext://bar', because they will\nnot be processed by the configuration machinery, but passed to the\ncallable as-is.\n",
            "subsections": []
        },
        "The key ''()'' has been used as the special key because it is not a": {
            "content": "valid keyword parameter name, and so will not clash with the names of\nthe keyword arguments used in the call.  The ''()'' also serves as a\nmnemonic that the corresponding value is a callable.\n",
            "subsections": []
        },
        "Changed in version 3.11: The 'filters' member of 'handlers' and": {
            "content": "'loggers' can take filter instances in addition to ids.\n",
            "subsections": []
        },
        "You can also specify a special key ''.'' whose value is a dictionary is": {
            "content": "a mapping of attribute names to values.  If found, the specified\nattributes will be set on the user-defined object before it is returned.\nThus, with the following configuration:\n\n{\n'()' : 'my.package.customFormatterFactory',\n'bar' : 'baz',\n'spam' : 99.9,\n'answer' : 42,\n'.' {\n'foo': 'bar',\n'baz': 'bozz'\n}\n}\n\nthe returned formatter will have attribute 'foo' set to ''bar'' and\nattribute 'baz' set to ''bozz''.\n\nWarning: The values for attributes such as 'foo' and 'baz' in the\nabove example should not be configuration dictionaries or\nreferences such as 'cfg://foo' or 'ext://bar', because they will\nnot be processed by the configuration machinery, but set as\nattribute values as-is.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Handler configuration order,  Next: Access to external objects,  Prev: User-defined objects,  Up: Configuration dictionary schema": {
            "content": "5.16.7.8 Handler configuration order\n....................................\n",
            "subsections": []
        },
        "Handlers are configured in alphabetical order of their keys, and a": {
            "content": "configured handler replaces the configuration dictionary in (a working\ncopy of) the 'handlers' dictionary in the schema.  If you use a\nconstruct such as 'cfg://handlers.foo', then initially 'handlers['foo']'\npoints to the configuration dictionary for the handler named 'foo', and\nlater (once that handler has been configured) it points to the\nconfigured handler instance.  Thus, 'cfg://handlers.foo' could resolve\nto either a dictionary or a handler instance.  In general, it is wise to\nname handlers in a way such that dependent handlers are configured\nafter any handlers they depend on; that allows something like\n'cfg://handlers.foo' to be used in configuring a handler that depends on\nhandler 'foo'.  If that dependent handler were named 'bar', problems\nwould result, because the configuration of 'bar' would be attempted\nbefore that of 'foo', and 'foo' would not yet have been configured.",
            "subsections": []
        },
        "However, if the dependent handler were named 'foobar', it would be": {
            "content": "configured after 'foo', with the result that 'cfg://handlers.foo' would\nresolve to configured handler 'foo', and not its configuration\ndictionary.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Access to external objects,  Next: Access to internal objects,  Prev: Handler configuration order,  Up: Configuration dictionary schema": {
            "content": "5.16.7.9 Access to external objects\n...................................\n",
            "subsections": []
        },
        "There are times where a configuration needs to refer to objects external": {
            "content": "to the configuration, for example 'sys.stderr'.  If the configuration\ndict is constructed using Python code, this is straightforward, but a\nproblem arises when the configuration is provided via a text file (e.g.\nJSON, YAML). In a text file, there is no standard way to distinguish\n'sys.stderr' from the literal string ''sys.stderr''.  To facilitate this\ndistinction, the configuration system looks for certain special prefixes\nin string values and treat them specially.  For example, if the literal\nstring ''ext://sys.stderr'' is provided as a value in the configuration,\nthen the 'ext://' will be stripped off and the remainder of the value\nprocessed using normal import mechanisms.\n",
            "subsections": []
        },
        "The handling of such prefixes is done in a way analogous to protocol": {
            "content": "handling: there is a generic mechanism to look for prefixes which match\nthe regular expression '^(?P<prefix>[a-z]+)://(?P<suffix>.*)$' whereby,\nif the 'prefix' is recognised, the 'suffix' is processed in a\nprefix-dependent manner and the result of the processing replaces the\nstring value.  If the prefix is not recognised, then the string value\nwill be left as-is.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Access to internal objects,  Next: Import resolution and custom importers,  Prev: Access to external objects,  Up: Configuration dictionary schema": {
            "content": "5.16.7.10 Access to internal objects\n....................................\n",
            "subsections": []
        },
        "As well as external objects, there is sometimes also a need to refer to": {
            "content": "objects in the configuration.  This will be done implicitly by the\nconfiguration system for things that it knows about.  For example, the\nstring value ''DEBUG'' for a 'level' in a logger or handler will\nautomatically be converted to the value 'logging.DEBUG', and the\n'handlers', 'filters' and 'formatter' entries will take an object id and\nresolve to the appropriate destination object.\n",
            "subsections": []
        },
        "However, a more generic mechanism is needed for user-defined objects": {
            "content": "which are not known to the *note logging: 82. module.  For example,\nconsider *note logging.handlers.MemoryHandler: 2a25, which takes a\n'target' argument which is another handler to delegate to.  Since the\nsystem already knows about this class, then in the configuration, the\ngiven 'target' just needs to be the object id of the relevant target\nhandler, and the system will resolve to the handler from the id.  If,\nhowever, a user defines a 'my.package.MyHandler' which has an\n'alternate' handler, the configuration system would not know that the\n'alternate' referred to a handler.  To cater for this, a generic\nresolution system allows the user to specify:\n\nhandlers:\nfile:\n# configuration of file handler goes here\n\ncustom:\n(): my.package.MyHandler\nalternate: cfg://handlers.file\n",
            "subsections": []
        },
        "The literal string ''cfg://handlers.file'' will be resolved in an": {
            "content": "analogous way to strings with the 'ext://' prefix, but looking in the\nconfiguration itself rather than the import namespace.  The mechanism\nallows access by dot or by index, in a similar way to that provided by\n'str.format'.  Thus, given the following snippet:\n\nhandlers:\nemail:\nclass: logging.handlers.SMTPHandler\nmailhost: localhost\nfromaddr: myapp@domain.tld\ntoaddrs:\n- supportteam@domain.tld\n- devteam@domain.tld\nsubject: Houston, we have a problem.\n\nin the configuration, the string ''cfg://handlers'' would resolve to the\ndict with key 'handlers', the string ''cfg://handlers.email' would\nresolve to the dict with key 'email' in the 'handlers' dict, and so on.\nThe string ''cfg://handlers.email.toaddrs[1]' would resolve to\n''devteam@domain.tld'' and the string\n''cfg://handlers.email.toaddrs[0]'' would resolve to the value\n''supportteam@domain.tld''.  The 'subject' value could be accessed\nusing either ''cfg://handlers.email.subject'' or, equivalently,\n''cfg://handlers.email[subject]''.  The latter form only needs to be\nused if the key contains spaces or non-alphanumeric characters.  If an\nindex value consists only of decimal digits, access will be attempted\nusing the corresponding integer value, falling back to the string value\nif needed.\n",
            "subsections": []
        },
        "Given a string 'cfg://handlers.myhandler.mykey.123', this will resolve": {
            "content": "to 'configdict['handlers']['myhandler']['mykey']['123']'.  If the\nstring is specified as 'cfg://handlers.myhandler.mykey[123]', the system\nwill attempt to retrieve the value from\n'configdict['handlers']['myhandler']['mykey'][123]', and fall back to\n'configdict['handlers']['myhandler']['mykey']['123']' if that fails.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Import resolution and custom importers,  Next: Configuring QueueHandler and QueueListener,  Prev: Access to internal objects,  Up: Configuration dictionary schema": {
            "content": "5.16.7.11 Import resolution and custom importers\n................................................\n\nImport resolution, by default, uses the builtin *note import(): 6ed.\nfunction to do its importing.  You may want to replace this with your\nown importing mechanism: if so, you can replace the 'importer' attribute\nof the 'DictConfigurator' or its superclass, the 'BaseConfigurator'\nclass.  However, you need to be careful because of the way functions are\naccessed from classes via descriptors.  If you are using a Python\ncallable to do your imports, and you want to define it at class level\nrather than instance level, you need to wrap it with *note\nstaticmethod(): 5cc.  For example:\n\nfrom importlib import importmodule\nfrom logging.config import BaseConfigurator\n\nBaseConfigurator.importer = staticmethod(importmodule)\n\nYou don't need to wrap with *note staticmethod(): 5cc. if you're setting\nthe import callable on a configurator 'instance'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Configuring QueueHandler and QueueListener,  Prev: Import resolution and custom importers,  Up: Configuration dictionary schema": {
            "content": "5.16.7.12 Configuring QueueHandler and QueueListener\n....................................................\n\nIf you want to configure a *note QueueHandler: 1534, noting that this is\nnormally used in conjunction with a *note QueueListener: c8b, you can\nconfigure both together.  After the configuration, the 'QueueListener'\ninstance will be available as the *note listener: 2a2a. attribute of the\ncreated handler, and that in turn will be available to you using *note\ngetHandlerByName(): 1535. and passing the name you have used for the\n'QueueHandler' in your configuration.  The dictionary schema for\nconfiguring the pair is shown in the example YAML snippet below.\n\nhandlers:\nqhand:\nclass: logging.handlers.QueueHandler\nqueue: my.module.queuefactory\nlistener: my.package.CustomListener\nhandlers:\n- handname1\n- handname2\n...\n\nThe 'queue' and 'listener' keys are optional.\n",
            "subsections": []
        },
        "If the 'queue' key is present, the corresponding value can be one of the": {
            "content": "following:\n\n* An actual instance of *note queue.Queue: 1203. or a subclass\nthereof.  This is of course only possible if you are constructing\nor modifying the configuration dictionary in code.\n\n* A string that resolves to a callable which, when called with no\narguments, returns the *note queue.Queue: 1203. instance to use.\nThat callable could be a *note queue.Queue: 1203. subclass or a\nfunction which returns a suitable queue instance, such as\n'my.module.queuefactory()'.\n\n* A dict with a ''()'' key which is constructed in the usual way as\ndiscussed in *note User-defined objects: 2a15.  The result of this\nconstruction should be a *note queue.Queue: 1203. instance.\n\nIf the 'queue' key is absent, a standard unbounded *note queue.Queue:\n1203. instance is created and used.\n",
            "subsections": []
        },
        "If the 'listener' key is present, the corresponding value can be one of": {
            "content": "the following:\n\n* A subclass of *note logging.handlers.QueueListener: c8b.  This is\nof course only possible if you are constructing or modifying the\nconfiguration dictionary in code.\n\n* A string which resolves to a class which is a subclass of\n'QueueListener', such as ''my.package.CustomListener''.\n\n* A dict with a ''()'' key which is constructed in the usual way as\ndiscussed in *note User-defined objects: 2a15.  The result of this\nconstruction should be a callable with the same signature as the\n'QueueListener' initializer.\n\nIf the 'listener' key is absent, *note logging.handlers.QueueListener:\nc8b. is used.\n",
            "subsections": []
        },
        "The values under the 'handlers' key are the names of other handlers in": {
            "content": "the configuration (not shown in the above snippet) which will be passed\nto the queue listener.\n",
            "subsections": []
        },
        "Any custom queue handler and listener classes will need to be defined": {
            "content": "with the same initialization signatures as *note QueueHandler: 1534. and\n*note QueueListener: c8b.\n\nNew in version 3.12.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Configuration file format,  Prev: Configuration dictionary schema,  Up: logging config -- Logging configuration": {
            "content": "5.16.7.13 Configuration file format\n...................................\n\nThe configuration file format understood by *note fileConfig(): 98d. is\nbased on *note configparser: 20. functionality.  The file must contain\nsections called '[loggers]', '[handlers]' and '[formatters]' which\nidentify by name the entities of each type which are defined in the\nfile.  For each such entity, there is a separate section which\nidentifies how that entity is configured.  Thus, for a logger named\n'log01' in the '[loggers]' section, the relevant configuration details\nare held in a section '[loggerlog01]'.  Similarly, a handler called\n'hand01' in the '[handlers]' section will have its configuration held in\na section called '[handlerhand01]', while a formatter called 'form01'\nin the '[formatters]' section will have its configuration specified in a\nsection called '[formatterform01]'.  The root logger configuration must\nbe specified in a section called '[loggerroot]'.\n\nNote: The *note fileConfig(): 98d. API is older than the *note\ndictConfig(): 1023. API and does not provide functionality to cover\ncertain aspects of logging.  For example, you cannot configure\n*note Filter: 106f. objects, which provide for filtering of\nmessages beyond simple integer levels, using *note fileConfig():\n98d.  If you need to have instances of *note Filter: 106f. in your\nlogging configuration, you will need to use *note dictConfig():\n1023.  Note that future enhancements to configuration functionality\nwill be added to *note dictConfig(): 1023, so it's worth\nconsidering transitioning to this newer API when it's convenient to\ndo so.\n\nExamples of these sections in the file are given below.\n\n[loggers]\nkeys=root,log02,log03,log04,log05,log06,log07\n\n[handlers]\nkeys=hand01,hand02,hand03,hand04,hand05,hand06,hand07,hand08,hand09\n\n[formatters]\nkeys=form01,form02,form03,form04,form05,form06,form07,form08,form09\n",
            "subsections": []
        },
        "The root logger must specify a level and a list of handlers.  An example": {
            "content": "of a root logger section is given below.\n\n[loggerroot]\nlevel=NOTSET\nhandlers=hand01\n",
            "subsections": []
        },
        "The 'level' entry can be one of 'DEBUG, INFO, WARNING, ERROR, CRITICAL'": {
            "content": "or 'NOTSET'.  For the root logger only, 'NOTSET' means that all messages\nwill be logged.  Level values are *note evaluated: 1e70. in the context\nof the 'logging' package's namespace.\n",
            "subsections": []
        },
        "The 'handlers' entry is a comma-separated list of handler names, which": {
            "content": "must appear in the '[handlers]' section.  These names must appear in the\n'[handlers]' section and have corresponding sections in the\nconfiguration file.\n",
            "subsections": []
        },
        "For loggers other than the root logger, some additional information is": {
            "content": "required.  This is illustrated by the following example.\n\n[loggerparser]\nlevel=DEBUG\nhandlers=hand01\npropagate=1\nqualname=compiler.parser\n",
            "subsections": []
        },
        "The 'level' and 'handlers' entries are interpreted as for the root": {
            "content": "logger, except that if a non-root logger's level is specified as\n'NOTSET', the system consults loggers higher up the hierarchy to\ndetermine the effective level of the logger.  The 'propagate' entry is\nset to 1 to indicate that messages must propagate to handlers higher up\nthe logger hierarchy from this logger, or 0 to indicate that messages\nare 'not' propagated to handlers up the hierarchy.  The 'qualname' entry\nis the hierarchical channel name of the logger, that is to say the name\nused by the application to get the logger.\n",
            "subsections": []
        },
        "Sections which specify handler configuration are exemplified by the": {
            "content": "following.\n\n[handlerhand01]\nclass=StreamHandler\nlevel=NOTSET\nformatter=form01\nargs=(sys.stdout,)\n\nThe 'class' entry indicates the handler's class (as determined by *note\neval(): 690. in the 'logging' package's namespace).  The 'level' is\ninterpreted as for loggers, and 'NOTSET' is taken to mean 'log\neverything'.\n",
            "subsections": []
        },
        "The 'formatter' entry indicates the key name of the formatter for this": {
            "content": "handler.  If blank, a default formatter ('logging.defaultFormatter') is\nused.  If a name is specified, it must appear in the '[formatters]'\nsection and have a corresponding section in the configuration file.\n\nThe 'args' entry, when *note evaluated: 1e70. in the context of the\n'logging' package's namespace, is the list of arguments to the\nconstructor for the handler class.  Refer to the constructors for the\nrelevant handlers, or to the examples below, to see how typical entries\nare constructed.  If not provided, it defaults to '()'.\n\nThe optional 'kwargs' entry, when *note evaluated: 1e70. in the context\nof the 'logging' package's namespace, is the keyword argument dict to\nthe constructor for the handler class.  If not provided, it defaults to\n'{}'.\n\n[handlerhand02]\nclass=FileHandler\nlevel=DEBUG\nformatter=form02\nargs=('python.log', 'w')\n\n[handlerhand03]\nclass=handlers.SocketHandler\nlevel=INFO\nformatter=form03\nargs=('localhost', handlers.DEFAULTTCPLOGGINGPORT)\n\n[handlerhand04]\nclass=handlers.DatagramHandler\nlevel=WARN\nformatter=form04\nargs=('localhost', handlers.DEFAULTUDPLOGGINGPORT)\n\n[handlerhand05]\nclass=handlers.SysLogHandler\nlevel=ERROR\nformatter=form05\nargs=(('localhost', handlers.SYSLOGUDPPORT), handlers.SysLogHandler.LOGUSER)\n\n[handlerhand06]\nclass=handlers.NTEventLogHandler\nlevel=CRITICAL\nformatter=form06\nargs=('Python Application', '', 'Application')\n\n[handlerhand07]\nclass=handlers.SMTPHandler\nlevel=WARN\nformatter=form07\nargs=('localhost', 'from@abc', ['user1@abc', 'user2@xyz'], 'Logger Subject')\nkwargs={'timeout': 10.0}\n\n[handlerhand08]\nclass=handlers.MemoryHandler\nlevel=NOTSET\nformatter=form08\ntarget=\nargs=(10, ERROR)\n\n[handlerhand09]\nclass=handlers.HTTPHandler\nlevel=NOTSET\nformatter=form09\nargs=('localhost:9022', '/log', 'GET')\nkwargs={'secure': True}\n",
            "subsections": []
        },
        "Sections which specify formatter configuration are typified by the": {
            "content": "following.\n\n[formatterform01]\nformat=F1 %(asctime)s %(levelname)s %(message)s %(customfield)s\ndatefmt=\nstyle=%\nvalidate=True\ndefaults={'customfield': 'defaultvalue'}\nclass=logging.Formatter\n",
            "subsections": []
        },
        "The arguments for the formatter configuration are the same as the keys": {
            "content": "in the dictionary schema *note formatters section: 2a19.\n\nThe 'defaults' entry, when *note evaluated: 1e70. in the context of the\n'logging' package's namespace, is a dictionary of default values for\ncustom formatting fields.  If not provided, it defaults to 'None'.\n\nNote: Due to the use of *note eval(): 690. as described above,\nthere are potential security risks which result from using the\n*note listen(): dd5. to send and receive configurations via\nsockets.  The risks are limited to where multiple users with no\nmutual trust run code on the same machine; see the *note listen():\ndd5. documentation for more information.\n\nSee also\n........\n\nModule *note logging: 82.\n\nAPI reference for the logging module.\n\nModule *note logging.handlers: 84.\n\nUseful handlers included with the logging module.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: logging handlers -- Logging handlers,  Next: getpass -- Portable password input,  Prev: logging config -- Logging configuration,  Up: Generic Operating System Services": {
            "content": "'Source code:' Lib/logging/handlers.py(1)\n",
            "subsections": []
        },
        "The following useful handlers are provided in the package.  Note that": {
            "content": "three of the handlers (*note StreamHandler: 106c, *note FileHandler:\n1600. and *note NullHandler: 10fd.) are actually defined in the *note\nlogging: 82. module itself, but have been documented here along with the\nother handlers.\n\n* Menu:\n\n* StreamHandler::\n* FileHandler::\n* NullHandler::\n* WatchedFileHandler::\n* BaseRotatingHandler::\n* RotatingFileHandler::\n* TimedRotatingFileHandler::\n* SocketHandler::\n* DatagramHandler::\n* SysLogHandler::\n* NTEventLogHandler::\n* SMTPHandler::\n* MemoryHandler::\n* HTTPHandler::\n* QueueHandler::\n* QueueListener::\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/logging/handlers.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: StreamHandler,  Next: FileHandler,  Up: logging handlers -- Logging handlers": {
            "content": "5.16.8.1 StreamHandler\n......................\n\nThe *note StreamHandler: 106c. class, located in the core *note logging:\n82. package, sends logging output to streams such as 'sys.stdout',\n'sys.stderr' or any file-like object (or, more precisely, any object\nwhich supports 'write()' and 'flush()' methods).\n\n-- Class: logging.StreamHandler (stream=None)\n\nReturns a new instance of the *note StreamHandler: 106c. class.  If\n'stream' is specified, the instance will use it for logging output;\notherwise, 'sys.stderr' will be used.\n\n-- Method: emit (record)\n\nIf a formatter is specified, it is used to format the record.\nThe record is then written to the stream followed by *note\nterminator: 2a31.  If exception information is present, it is\nformatted using *note traceback.printexception(): 645. and\nappended to the stream.\n\n-- Method: flush ()\n\nFlushes the stream by calling its *note flush(): 2a32. method.\nNote that the 'close()' method is inherited from *note\nHandler: 12eb. and so does no output, so an explicit *note\nflush(): 2a32. call may be needed at times.\n\n-- Method: setStream (stream)\n\nSets the instance's stream to the specified value, if it is\ndifferent.  The old stream is flushed before the new stream is\nset.\n\n\nParameters: 'stream' - The stream that the handler should use.\n\n\nReturns: the old stream, if the stream was changed, or 'None'\nif it wasn't.\n\nNew in version 3.7.\n\n-- Attribute: terminator\n\nString used as the terminator when writing a formatted record\nto a stream.  Default value is ''\\n''.\n\nIf you don't want a newline termination, you can set the\nhandler instance's 'terminator' attribute to the empty string.\n\nIn earlier versions, the terminator was hardcoded as ''\\n''.\n\nNew in version 3.2.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: FileHandler,  Next: NullHandler,  Prev: StreamHandler,  Up: logging handlers -- Logging handlers": {
            "content": "5.16.8.2 FileHandler\n....................\n\nThe *note FileHandler: 1600. class, located in the core *note logging:\n82. package, sends logging output to a disk file.  It inherits the\noutput functionality from *note StreamHandler: 106c.\n\n-- Class: logging.FileHandler (filename, mode='a', encoding=None,\ndelay=False, errors=None)\n\nReturns a new instance of the *note FileHandler: 1600. class.  The\nspecified file is opened and used as the stream for logging.  If\n'mode' is not specified, ''a'' is used.  If 'encoding' is not\n'None', it is used to open the file with that encoding.  If 'delay'\nis true, then file opening is deferred until the first call to\n*note emit(): 2a35.  By default, the file grows indefinitely.  If\n'errors' is specified, it's used to determine how encoding errors\nare handled.\n\nChanged in version 3.6: As well as string values, *note Path: 149.\nobjects are also accepted for the 'filename' argument.\n\nChanged in version 3.9: The 'errors' parameter was added.\n\n-- Method: close ()\n\nCloses the file.\n\n-- Method: emit (record)\n\nOutputs the record to the file.\n\nNote that if the file was closed due to logging shutdown at\nexit and the file mode is 'w', the record will not be emitted\n(see bpo-42378(1)).\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=42378\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: NullHandler,  Next: WatchedFileHandler,  Prev: FileHandler,  Up: logging handlers -- Logging handlers": {
            "content": "5.16.8.3 NullHandler\n....................\n\nNew in version 3.1.\n\nThe *note NullHandler: 10fd. class, located in the core *note logging:\n82. package, does not do any formatting or output.  It is essentially a\n'no-op' handler for use by library developers.\n\n-- Class: logging.NullHandler\n\nReturns a new instance of the *note NullHandler: 10fd. class.\n\n-- Method: emit (record)\n\nThis method does nothing.\n\n-- Method: handle (record)\n\nThis method does nothing.\n\n-- Method: createLock ()\n\nThis method returns 'None' for the lock, since there is no\nunderlying I/O to which access needs to be serialized.\n\nSee *note Configuring Logging for a Library: 2a3c. for more information\non how to use *note NullHandler: 10fd.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: WatchedFileHandler,  Next: BaseRotatingHandler,  Prev: NullHandler,  Up: logging handlers -- Logging handlers": {
            "content": "5.16.8.4 WatchedFileHandler\n...........................\n\nThe *note WatchedFileHandler: 2a3f. class, located in the *note\nlogging.handlers: 84. module, is a 'FileHandler' which watches the file\nit is logging to.  If the file changes, it is closed and reopened using\nthe file name.\n\nA file change can happen because of usage of programs such as\n'newsyslog' and 'logrotate' which perform log file rotation.  This\nhandler, intended for use under Unix/Linux, watches the file to see if\nit has changed since the last emit.  (A file is deemed to have changed\nif its device or inode have changed.)  If the file has changed, the old\nfile stream is closed, and the file opened to get a new stream.\n",
            "subsections": []
        },
        "This handler is not appropriate for use under Windows, because under": {
            "content": "",
            "subsections": []
        },
        "Windows open log files cannot be moved or renamed - logging opens the": {
            "content": "files with exclusive locks - and so there is no need for such a handler.\nFurthermore, 'STINO' is not supported under Windows; *note stat(): 1bf.\nalways returns zero for this value.\n\n-- Class: logging.handlers.WatchedFileHandler (filename, mode='a',\nencoding=None, delay=False, errors=None)\n\nReturns a new instance of the *note WatchedFileHandler: 2a3f.\nclass.  The specified file is opened and used as the stream for\nlogging.  If 'mode' is not specified, ''a'' is used.  If 'encoding'\nis not 'None', it is used to open the file with that encoding.  If\n'delay' is true, then file opening is deferred until the first call\nto *note emit(): 2a40.  By default, the file grows indefinitely.\nIf 'errors' is provided, it determines how encoding errors are\nhandled.\n\nChanged in version 3.6: As well as string values, *note Path: 149.\nobjects are also accepted for the 'filename' argument.\n\nChanged in version 3.9: The 'errors' parameter was added.\n\n-- Method: reopenIfNeeded ()\n\nChecks to see if the file has changed.  If it has, the\nexisting stream is flushed and closed and the file opened\nagain, typically as a precursor to outputting the record to\nthe file.\n\nNew in version 3.6.\n\n-- Method: emit (record)\n\nOutputs the record to the file, but first calls *note\nreopenIfNeeded(): b05. to reopen the file if it has changed.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: BaseRotatingHandler,  Next: RotatingFileHandler,  Prev: WatchedFileHandler,  Up: logging handlers -- Logging handlers": {
            "content": "5.16.8.5 BaseRotatingHandler\n............................\n\nThe *note BaseRotatingHandler: 2a43. class, located in the *note\nlogging.handlers: 84. module, is the base class for the rotating file\nhandlers, *note RotatingFileHandler: 2a1a. and *note",
            "subsections": []
        },
        "TimedRotatingFileHandler: dd1.  You should not need to instantiate this": {
            "content": "class, but it has attributes and methods you may need to override.\n\n-- Class: logging.handlers.BaseRotatingHandler (filename, mode,\nencoding=None, delay=False, errors=None)\n\nThe parameters are as for 'FileHandler'.  The attributes are:\n\n-- Attribute: namer\n\nIf this attribute is set to a callable, the *note\nrotationfilename(): 2a45. method delegates to this callable.\nThe parameters passed to the callable are those passed to\n*note rotationfilename(): 2a45.\n\nNote: The namer function is called quite a few times\nduring rollover, so it should be as simple and as fast as\npossible.  It should also return the same output every\ntime for a given input, otherwise the rollover behaviour\nmay not work as expected.\n\nIt's also worth noting that care should be taken when\nusing a namer to preserve certain attributes in the\nfilename which are used during rotation.  For example,\n*note RotatingFileHandler: 2a1a. expects to have a set of\nlog files whose names contain successive integers, so\nthat rotation works as expected, and *note\nTimedRotatingFileHandler: dd1. deletes old log files\n(based on the 'backupCount' parameter passed to the\nhandler's initializer) by determining the oldest files to\ndelete.  For this to happen, the filenames should be\nsortable using the date/time portion of the filename, and\na namer needs to respect this.  (If a namer is wanted\nthat doesn't respect this scheme, it will need to be used\nin a subclass of *note TimedRotatingFileHandler: dd1.\nwhich overrides the *note getFilesToDelete(): 2a46.\nmethod to fit in with the custom naming scheme.)\n\nNew in version 3.3.\n\n-- Attribute: rotator\n\nIf this attribute is set to a callable, the *note rotate():\n2a48. method delegates to this callable.  The parameters\npassed to the callable are those passed to *note rotate():\n2a48.\n\nNew in version 3.3.\n\n-- Method: rotationfilename (defaultname)\n\nModify the filename of a log file when rotating.\n\nThis is provided so that a custom filename can be provided.\n\nThe default implementation calls the 'namer' attribute of the\nhandler, if it's callable, passing the default name to it.  If\nthe attribute isn't callable (the default is 'None'), the name\nis returned unchanged.\n\n\nParameters: 'defaultname' - The default name for the log\nfile.\n\nNew in version 3.3.\n\n-- Method: rotate (source, dest)\n\nWhen rotating, rotate the current log.\n\nThe default implementation calls the 'rotator' attribute of\nthe handler, if it's callable, passing the source and dest\narguments to it.  If the attribute isn't callable (the default\nis 'None'), the source is simply renamed to the destination.\n\n\nParameters:\n\n* 'source' - The source filename.  This is normally the\nbase filename, e.g.  'test.log'.\n\n* 'dest' - The destination filename.  This is normally what\nthe source is rotated to, e.g.  'test.log.1'.\n\nNew in version 3.3.\n",
            "subsections": []
        },
        "The reason the attributes exist is to save you having to subclass - you": {
            "content": "can use the same callables for instances of *note RotatingFileHandler:\n2a1a. and *note TimedRotatingFileHandler: dd1.  If either the namer or\nrotator callable raises an exception, this will be handled in the same\nway as any other exception during an 'emit()' call, i.e.  via the\n'handleError()' method of the handler.\n",
            "subsections": []
        },
        "If you need to make more significant changes to rotation processing, you": {
            "content": "can override the methods.\n\nFor an example, see *note Using a rotator and namer to customize log\nrotation processing: 2a49.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: RotatingFileHandler,  Next: TimedRotatingFileHandler,  Prev: BaseRotatingHandler,  Up: logging handlers -- Logging handlers": {
            "content": "5.16.8.6 RotatingFileHandler\n............................\n\nThe *note RotatingFileHandler: 2a1a. class, located in the *note\nlogging.handlers: 84. module, supports rotation of disk log files.\n\n-- Class: logging.handlers.RotatingFileHandler (filename, mode='a',\nmaxBytes=0, backupCount=0, encoding=None, delay=False,\nerrors=None)\n\nReturns a new instance of the *note RotatingFileHandler: 2a1a.\nclass.  The specified file is opened and used as the stream for\nlogging.  If 'mode' is not specified, ''a'' is used.  If 'encoding'\nis not 'None', it is used to open the file with that encoding.  If\n'delay' is true, then file opening is deferred until the first call\nto *note emit(): 2a4c.  By default, the file grows indefinitely.\nIf 'errors' is provided, it determines how encoding errors are\nhandled.\n\nYou can use the 'maxBytes' and 'backupCount' values to allow the\nfile to 'rollover' at a predetermined size.  When the size is about\nto be exceeded, the file is closed and a new file is silently\nopened for output.  Rollover occurs whenever the current log file\nis nearly 'maxBytes' in length; but if either of 'maxBytes' or\n'backupCount' is zero, rollover never occurs, so you generally want\nto set 'backupCount' to at least 1, and have a non-zero 'maxBytes'.\nWhen 'backupCount' is non-zero, the system will save old log files\nby appending the extensions '.1', '.2' etc., to the filename.  For\nexample, with a 'backupCount' of 5 and a base file name of\n'app.log', you would get 'app.log', 'app.log.1', 'app.log.2', up to\n'app.log.5'.  The file being written to is always 'app.log'.  When\nthis file is filled, it is closed and renamed to 'app.log.1', and\nif files 'app.log.1', 'app.log.2', etc.  exist, then they are\nrenamed to 'app.log.2', 'app.log.3' etc.  respectively.\n\nChanged in version 3.6: As well as string values, *note Path: 149.\nobjects are also accepted for the 'filename' argument.\n\nChanged in version 3.9: The 'errors' parameter was added.\n\n-- Method: doRollover ()\n\nDoes a rollover, as described above.\n\n-- Method: emit (record)\n\nOutputs the record to the file, catering for rollover as\ndescribed previously.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: TimedRotatingFileHandler,  Next: SocketHandler,  Prev: RotatingFileHandler,  Up: logging handlers -- Logging handlers": {
            "content": "5.16.8.7 TimedRotatingFileHandler\n.................................\n\nThe *note TimedRotatingFileHandler: dd1. class, located in the *note\nlogging.handlers: 84. module, supports rotation of disk log files at\ncertain timed intervals.\n\n-- Class: logging.handlers.TimedRotatingFileHandler (filename,\nwhen='h', interval=1, backupCount=0, encoding=None,\ndelay=False, utc=False, atTime=None, errors=None)\n\nReturns a new instance of the *note TimedRotatingFileHandler: dd1.\nclass.  The specified file is opened and used as the stream for\nlogging.  On rotating it also sets the filename suffix.  Rotating\nhappens based on the product of 'when' and 'interval'.\n\nYou can use the 'when' to specify the type of 'interval'.  The list\nof possible values is below.  Note that they are not case\nsensitive.\n\nValue                Type of interval                 If/how 'atTime' is used\n\n------------------------------------------------------------------------------------\n\n''S''                Seconds                          Ignored\n\n\n''M''                Minutes                          Ignored\n\n\n''H''                Hours                            Ignored\n\n\n''D''                Days                             Ignored\n\n\n''W0'-'W6''          Weekday (0=Monday)               Used to compute initial\nrollover time\n\n\n''midnight''         Roll over at midnight, if        Used to compute initial\n'atTime' not specified, else     rollover time\nat time 'atTime'\n\n\nWhen using weekday-based rotation, specify 'W0' for Monday, 'W1'\nfor Tuesday, and so on up to 'W6' for Sunday.  In this case, the\nvalue passed for 'interval' isn't used.\n\nThe system will save old log files by appending extensions to the\nfilename.  The extensions are date-and-time based, using the\nstrftime format '%Y-%m-%d%H-%M-%S' or a leading portion thereof,\ndepending on the rollover interval.\n\nWhen computing the next rollover time for the first time (when the\nhandler is created), the last modification time of an existing log\nfile, or else the current time, is used to compute when the next\nrotation will occur.\n\nIf the 'utc' argument is true, times in UTC will be used; otherwise\nlocal time is used.\n\nIf 'backupCount' is nonzero, at most 'backupCount' files will be\nkept, and if more would be created when rollover occurs, the oldest\none is deleted.  The deletion logic uses the interval to determine\nwhich files to delete, so changing the interval may leave old files\nlying around.\n\nIf 'delay' is true, then file opening is deferred until the first\ncall to *note emit(): 2a50.\n\nIf 'atTime' is not 'None', it must be a 'datetime.time' instance\nwhich specifies the time of day when rollover occurs, for the cases\nwhere rollover is set to happen \"at midnight\" or \"on a particular\nweekday\".  Note that in these cases, the 'atTime' value is\neffectively used to compute the 'initial' rollover, and subsequent\nrollovers would be calculated via the normal interval calculation.\n\nIf 'errors' is specified, it's used to determine how encoding\nerrors are handled.\n\nNote: Calculation of the initial rollover time is done when\nthe handler is initialised.  Calculation of subsequent\nrollover times is done only when rollover occurs, and rollover\noccurs only when emitting output.  If this is not kept in\nmind, it might lead to some confusion.  For example, if an\ninterval of \"every minute\" is set, that does not mean you will\nalways see log files with times (in the filename) separated by\na minute; if, during application execution, logging output is\ngenerated more frequently than once a minute, 'then' you can\nexpect to see log files with times separated by a minute.  If,\non the other hand, logging messages are only output once every\nfive minutes (say), then there will be gaps in the file times\ncorresponding to the minutes where no output (and hence no\nrollover) occurred.\n\nChanged in version 3.4: 'atTime' parameter was added.\n\nChanged in version 3.6: As well as string values, *note Path: 149.\nobjects are also accepted for the 'filename' argument.\n\nChanged in version 3.9: The 'errors' parameter was added.\n\n-- Method: doRollover ()\n\nDoes a rollover, as described above.\n\n-- Method: emit (record)\n\nOutputs the record to the file, catering for rollover as\ndescribed above.\n\n-- Method: getFilesToDelete ()\n\nReturns a list of filenames which should be deleted as part of\nrollover.  These are the absolute paths of the oldest backup\nlog files written by the handler.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: SocketHandler,  Next: DatagramHandler,  Prev: TimedRotatingFileHandler,  Up: logging handlers -- Logging handlers": {
            "content": "5.16.8.8 SocketHandler\n......................\n\nThe *note SocketHandler: dd2. class, located in the *note\nlogging.handlers: 84. module, sends logging output to a network socket.\nThe base class uses a TCP socket.\n\n-- Class: logging.handlers.SocketHandler (host, port)\n\nReturns a new instance of the *note SocketHandler: dd2. class\nintended to communicate with a remote machine whose address is\ngiven by 'host' and 'port'.\n\nChanged in version 3.4: If 'port' is specified as 'None', a Unix\ndomain socket is created using the value in 'host' - otherwise, a\nTCP socket is created.\n\n-- Method: close ()\n\nCloses the socket.\n\n-- Method: emit ()\n\nPickles the record's attribute dictionary and writes it to the\nsocket in binary format.  If there is an error with the\nsocket, silently drops the packet.  If the connection was\npreviously lost, re-establishes the connection.  To unpickle\nthe record at the receiving end into a *note LogRecord: e59,\nuse the *note makeLogRecord(): 29f2. function.\n\n-- Method: handleError ()\n\nHandles an error which has occurred during *note emit(): 2a55.\nThe most likely cause is a lost connection.  Closes the socket\nso that we can retry on the next event.\n\n-- Method: makeSocket ()\n\nThis is a factory method which allows subclasses to define the\nprecise type of socket they want.  The default implementation\ncreates a TCP socket (*note socket.SOCKSTREAM: 1168.).\n\n-- Method: makePickle (record)\n\nPickles the record's attribute dictionary in binary format\nwith a length prefix, and returns it ready for transmission\nacross the socket.  The details of this operation are\nequivalent to:\n\ndata = pickle.dumps(recordattrdict, 1)\ndatalen = struct.pack('>L', len(data))\nreturn datalen + data\n\nNote that pickles aren't completely secure.  If you are\nconcerned about security, you may want to override this method\nto implement a more secure mechanism.  For example, you can\nsign pickles using HMAC and then verify them on the receiving\nend, or alternatively you can disable unpickling of global\nobjects on the receiving end.\n\n-- Method: send (packet)\n\nSend a pickled byte-string 'packet' to the socket.  The format\nof the sent byte-string is as described in the documentation\nfor *note makePickle(): 2a58.\n\nThis function allows for partial sends, which can happen when\nthe network is busy.\n\n-- Method: createSocket ()\n\nTries to create a socket; on failure, uses an exponential\nback-off algorithm.  On initial failure, the handler will drop\nthe message it was trying to send.  When subsequent messages\nare handled by the same instance, it will not try connecting\nuntil some time has passed.  The default parameters are such\nthat the initial delay is one second, and if after that delay\nthe connection still can't be made, the handler will double\nthe delay each time up to a maximum of 30 seconds.\n\nThis behaviour is controlled by the following handler\nattributes:\n\n* 'retryStart' (initial delay, defaulting to 1.0 seconds).\n\n* 'retryFactor' (multiplier, defaulting to 2.0).\n\n* 'retryMax' (maximum delay, defaulting to 30.0 seconds).\n\nThis means that if the remote listener starts up 'after' the\nhandler has been used, you could lose messages (since the\nhandler won't even attempt a connection until the delay has\nelapsed, but just silently drop messages during the delay\nperiod).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: DatagramHandler,  Next: SysLogHandler,  Prev: SocketHandler,  Up: logging handlers -- Logging handlers": {
            "content": "5.16.8.9 DatagramHandler\n........................\n\nThe *note DatagramHandler: dd3. class, located in the *note\nlogging.handlers: 84. module, inherits from *note SocketHandler: dd2. to\nsupport sending logging messages over UDP sockets.\n\n-- Class: logging.handlers.DatagramHandler (host, port)\n\nReturns a new instance of the *note DatagramHandler: dd3. class\nintended to communicate with a remote machine whose address is\ngiven by 'host' and 'port'.\n\nNote: As UDP is not a streaming protocol, there is no\npersistent connection between an instance of this handler and\n'host'.  For this reason, when using a network socket, a DNS\nlookup might have to be made each time an event is logged,\nwhich can introduce some latency into the system.  If this\naffects you, you can do a lookup yourself and initialize this\nhandler using the looked-up IP address rather than the\nhostname.\n\nChanged in version 3.4: If 'port' is specified as 'None', a Unix\ndomain socket is created using the value in 'host' - otherwise, a\nUDP socket is created.\n\n-- Method: emit ()\n\nPickles the record's attribute dictionary and writes it to the\nsocket in binary format.  If there is an error with the\nsocket, silently drops the packet.  To unpickle the record at\nthe receiving end into a *note LogRecord: e59, use the *note\nmakeLogRecord(): 29f2. function.\n\n-- Method: makeSocket ()\n\nThe factory method of *note SocketHandler: dd2. is here\noverridden to create a UDP socket (*note socket.SOCKDGRAM:\n1167.).\n\n-- Method: send (s)\n\nSend a pickled byte-string to a socket.  The format of the\nsent byte-string is as described in the documentation for\n*note SocketHandler.makePickle(): 2a58.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: SysLogHandler,  Next: NTEventLogHandler,  Prev: DatagramHandler,  Up: logging handlers -- Logging handlers": {
            "content": "5.16.8.10 SysLogHandler\n.......................\n\nThe *note SysLogHandler: 426. class, located in the *note\nlogging.handlers: 84. module, supports sending logging messages to a\nremote or local Unix syslog.\n\n-- Class: logging.handlers.SysLogHandler (address=('localhost',\nSYSLOGUDPPORT), facility=LOGUSER,\nsocktype=socket.SOCKDGRAM)\n\nReturns a new instance of the *note SysLogHandler: 426. class\nintended to communicate with a remote Unix machine whose address is\ngiven by 'address' in the form of a '(host, port)' tuple.  If\n'address' is not specified, '('localhost', 514)' is used.  The\naddress is used to open a socket.  An alternative to providing a\n'(host, port)' tuple is providing an address as a string, for\nexample '/dev/log'.  In this case, a Unix domain socket is used to\nsend the message to the syslog.  If 'facility' is not specified,\n'LOGUSER' is used.  The type of socket opened depends on the\n'socktype' argument, which defaults to *note socket.SOCKDGRAM:\n1167. and thus opens a UDP socket.  To open a TCP socket (for use\nwith the newer syslog daemons such as rsyslog), specify a value of\n*note socket.SOCKSTREAM: 1168.\n\nNote that if your server is not listening on UDP port 514, *note\nSysLogHandler: 426. may appear not to work.  In that case, check\nwhat address you should be using for a domain socket - it's system\ndependent.  For example, on Linux it's usually '/dev/log' but on\nOS/X it's '/var/run/syslog'.  You'll need to check your platform\nand use the appropriate address (you may need to do this check at\nruntime if your application needs to run on several platforms).  On\nWindows, you pretty much have to use the UDP option.\n\nNote: On macOS 12.x (Monterey), Apple has changed the\nbehaviour of their syslog daemon - it no longer listens on a\ndomain socket.  Therefore, you cannot expect *note\nSysLogHandler: 426. to work on this system.\n\nSee gh-91070(1) for more information.\n\nChanged in version 3.2: 'socktype' was added.\n\n-- Method: close ()\n\nCloses the socket to the remote host.\n\n-- Method: createSocket ()\n\nTries to create a socket and, if it's not a datagram socket,\nconnect it to the other end.  This method is called during\nhandler initialization, but it's not regarded as an error if\nthe other end isn't listening at this point - the method will\nbe called again when emitting an event, if there is no socket\nat that point.\n\nNew in version 3.11.\n\n-- Method: emit (record)\n\nThe record is formatted, and then sent to the syslog server.\nIf exception information is present, it is 'not' sent to the\nserver.\n\nChanged in version 3.2.1: (See: bpo-12168(2).)  In earlier\nversions, the message sent to the syslog daemons was always\nterminated with a NUL byte, because early versions of these\ndaemons expected a NUL terminated message - even though it's\nnot in the relevant specification ( RFC 5424(3)).  More recent\nversions of these daemons don't expect the NUL byte but strip\nit off if it's there, and even more recent daemons (which\nadhere more closely to RFC 5424) pass the NUL byte on as part\nof the message.\n\nTo enable easier handling of syslog messages in the face of\nall these differing daemon behaviours, the appending of the\nNUL byte has been made configurable, through the use of a\nclass-level attribute, 'appendnul'.  This defaults to 'True'\n(preserving the existing behaviour) but can be set to 'False'\non a 'SysLogHandler' instance in order for that instance to\n'not' append the NUL terminator.\n\nChanged in version 3.3: (See: bpo-12419(4).)  In earlier\nversions, there was no facility for an \"ident\" or \"tag\" prefix\nto identify the source of the message.  This can now be\nspecified using a class-level attribute, defaulting to '\"\"' to\npreserve existing behaviour, but which can be overridden on a\n'SysLogHandler' instance in order for that instance to prepend\nthe ident to every message handled.  Note that the provided\nident must be text, not bytes, and is prepended to the message\nexactly as is.\n\n-- Method: encodePriority (facility, priority)\n\nEncodes the facility and priority into an integer.  You can\npass in strings or integers - if strings are passed, internal\nmapping dictionaries are used to convert them to integers.\n\nThe symbolic 'LOG' values are defined in *note SysLogHandler:\n426. and mirror the values defined in the 'sys/syslog.h'\nheader file.\n\n'Priorities'\n\nName (string)                  Symbolic value\n\n---------------------------------------------------\n\n'alert'                        LOGALERT\n\n\n'crit' or 'critical'           LOGCRIT\n\n\n'debug'                        LOGDEBUG\n\n\n'emerg' or 'panic'             LOGEMERG\n\n\n'err' or 'error'               LOGERR\n\n\n'info'                         LOGINFO\n\n\n'notice'                       LOGNOTICE\n\n\n'warn' or 'warning'            LOGWARNING\n\n\n'Facilities'\n\nName (string)       Symbolic value\n\n----------------------------------------\n\n'auth'              LOGAUTH\n\n\n'authpriv'          LOGAUTHPRIV\n\n\n'cron'              LOGCRON\n\n\n'daemon'            LOGDAEMON\n\n\n'ftp'               LOGFTP\n\n\n'kern'              LOGKERN\n\n\n'lpr'               LOGLPR\n\n\n'mail'              LOGMAIL\n\n\n'news'              LOGNEWS\n\n\n'syslog'            LOGSYSLOG\n\n\n'user'              LOGUSER\n\n\n'uucp'              LOGUUCP\n\n\n'local0'            LOGLOCAL0\n\n\n'local1'            LOGLOCAL1\n\n\n'local2'            LOGLOCAL2\n\n\n'local3'            LOGLOCAL3\n\n\n'local4'            LOGLOCAL4\n\n\n'local5'            LOGLOCAL5\n\n\n'local6'            LOGLOCAL6\n\n\n'local7'            LOGLOCAL7\n\n\n-- Method: mapPriority (levelname)\n\nMaps a logging level name to a syslog priority name.  You may\nneed to override this if you are using custom levels, or if\nthe default algorithm is not suitable for your needs.  The\ndefault algorithm maps 'DEBUG', 'INFO', 'WARNING', 'ERROR' and\n'CRITICAL' to the equivalent syslog names, and all other level\nnames to 'warning'.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/issues/91070\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=12168\n\n(3) https://datatracker.ietf.org/doc/html/rfc5424.html\n\n(4) https://bugs.python.org/issue?@action=redirect&bpo=12419\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: NTEventLogHandler,  Next: SMTPHandler,  Prev: SysLogHandler,  Up: logging handlers -- Logging handlers": {
            "content": "5.16.8.11 NTEventLogHandler\n...........................\n\nThe *note NTEventLogHandler: 2a67. class, located in the *note\nlogging.handlers: 84. module, supports sending logging messages to a\nlocal Windows NT, Windows 2000 or Windows XP event log.  Before you can\nuse it, you need Mark Hammond's Win32 extensions for Python installed.\n\n-- Class: logging.handlers.NTEventLogHandler (appname, dllname=None,\nlogtype='Application')\n\nReturns a new instance of the *note NTEventLogHandler: 2a67. class.\nThe 'appname' is used to define the application name as it appears\nin the event log.  An appropriate registry entry is created using\nthis name.  The 'dllname' should give the fully qualified pathname\nof a .dll or .exe which contains message definitions to hold in the\nlog (if not specified, ''win32service.pyd'' is used - this is\ninstalled with the Win32 extensions and contains some basic\nplaceholder message definitions.  Note that use of these\nplaceholders will make your event logs big, as the entire message\nsource is held in the log.  If you want slimmer logs, you have to\npass in the name of your own .dll or .exe which contains the\nmessage definitions you want to use in the event log).  The\n'logtype' is one of ''Application'', ''System'' or ''Security'',\nand defaults to ''Application''.\n\n-- Method: close ()\n\nAt this point, you can remove the application name from the\nregistry as a source of event log entries.  However, if you do\nthis, you will not be able to see the events as you intended\nin the Event Log Viewer - it needs to be able to access the\nregistry to get the .dll name.  The current version does not\ndo this.\n\n-- Method: emit (record)\n\nDetermines the message ID, event category and event type, and\nthen logs the message in the NT event log.\n\n-- Method: getEventCategory (record)\n\nReturns the event category for the record.  Override this if\nyou want to specify your own categories.  This version returns\n0.\n\n-- Method: getEventType (record)\n\nReturns the event type for the record.  Override this if you\nwant to specify your own types.  This version does a mapping\nusing the handler's typemap attribute, which is set up in\n'init()' to a dictionary which contains mappings for\n'DEBUG', 'INFO', 'WARNING', 'ERROR' and 'CRITICAL'.  If you\nare using your own levels, you will either need to override\nthis method or place a suitable dictionary in the handler's\n'typemap' attribute.\n\n-- Method: getMessageID (record)\n\nReturns the message ID for the record.  If you are using your\nown messages, you could do this by having the 'msg' passed to\nthe logger being an ID rather than a format string.  Then, in\nhere, you could use a dictionary lookup to get the message ID.\nThis version returns 1, which is the base message ID in\n'win32service.pyd'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: SMTPHandler,  Next: MemoryHandler,  Prev: NTEventLogHandler,  Up: logging handlers -- Logging handlers": {
            "content": "5.16.8.12 SMTPHandler\n.....................\n\nThe *note SMTPHandler: 2a6f. class, located in the *note\nlogging.handlers: 84. module, supports sending logging messages to an\nemail address via SMTP.\n\n-- Class: logging.handlers.SMTPHandler (mailhost, fromaddr, toaddrs,\nsubject, credentials=None, secure=None, timeout=1.0)\n\nReturns a new instance of the *note SMTPHandler: 2a6f. class.  The\ninstance is initialized with the from and to addresses and subject\nline of the email.  The 'toaddrs' should be a list of strings.  To\nspecify a non-standard SMTP port, use the (host, port) tuple format\nfor the 'mailhost' argument.  If you use a string, the standard\nSMTP port is used.  If your SMTP server requires authentication,\nyou can specify a (username, password) tuple for the 'credentials'\nargument.\n\nTo specify the use of a secure protocol (TLS), pass in a tuple to\nthe 'secure' argument.  This will only be used when authentication\ncredentials are supplied.  The tuple should be either an empty\ntuple, or a single-value tuple with the name of a keyfile, or a\n2-value tuple with the names of the keyfile and certificate file.\n(This tuple is passed to the *note smtplib.SMTP.starttls(): faa.\nmethod.)\n\nA timeout can be specified for communication with the SMTP server\nusing the 'timeout' argument.\n\nChanged in version 3.3: Added the 'timeout' parameter.\n\n-- Method: emit (record)\n\nFormats the record and sends it to the specified addressees.\n\n-- Method: getSubject (record)\n\nIf you want to specify a subject line which is\nrecord-dependent, override this method.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: MemoryHandler,  Next: HTTPHandler,  Prev: SMTPHandler,  Up: logging handlers -- Logging handlers": {
            "content": "5.16.8.13 MemoryHandler\n.......................\n\nThe *note MemoryHandler: 2a25. class, located in the *note\nlogging.handlers: 84. module, supports buffering of logging records in\nmemory, periodically flushing them to a 'target' handler.  Flushing\noccurs whenever the buffer is full, or when an event of a certain\nseverity or greater is seen.\n\n*note MemoryHandler: 2a25. is a subclass of the more general *note",
            "subsections": []
        },
        "BufferingHandler: 2a74, which is an abstract class.  This buffers": {
            "content": "logging records in memory.  Whenever each record is added to the buffer,\na check is made by calling 'shouldFlush()' to see if the buffer should\nbe flushed.  If it should, then 'flush()' is expected to do the\nflushing.\n\n-- Class: logging.handlers.BufferingHandler (capacity)\n\nInitializes the handler with a buffer of the specified capacity.\nHere, 'capacity' means the number of logging records buffered.\n\n-- Method: emit (record)\n\nAppend the record to the buffer.  If *note shouldFlush():\n2a76. returns true, call *note flush(): 2a77. to process the\nbuffer.\n\n-- Method: flush ()\n\nFor a *note BufferingHandler: 2a74. instance, flushing means\nthat it sets the buffer to an empty list.  This method can be\noverwritten to implement more useful flushing behavior.\n\n-- Method: shouldFlush (record)\n\nReturn 'True' if the buffer is up to capacity.  This method\ncan be overridden to implement custom flushing strategies.\n\n-- Class: logging.handlers.MemoryHandler (capacity, flushLevel=ERROR,\ntarget=None, flushOnClose=True)\n\nReturns a new instance of the *note MemoryHandler: 2a25. class.\nThe instance is initialized with a buffer size of 'capacity'\n(number of records buffered).  If 'flushLevel' is not specified,\n'ERROR' is used.  If no 'target' is specified, the target will need\nto be set using *note setTarget(): 2a78. before this handler does\nanything useful.  If 'flushOnClose' is specified as 'False', then\nthe buffer is 'not' flushed when the handler is closed.  If not\nspecified or specified as 'True', the previous behaviour of\nflushing the buffer will occur when the handler is closed.\n\nChanged in version 3.6: The 'flushOnClose' parameter was added.\n\n-- Method: close ()\n\nCalls *note flush(): 2a7a, sets the target to 'None' and\nclears the buffer.\n\n-- Method: flush ()\n\nFor a *note MemoryHandler: 2a25. instance, flushing means just\nsending the buffered records to the target, if there is one.\nThe buffer is also cleared when buffered records are sent to\nthe target.  Override if you want different behavior.\n\n-- Method: setTarget (target)\n\nSets the target handler for this handler.\n\n-- Method: shouldFlush (record)\n\nChecks for buffer full or a record at the 'flushLevel' or\nhigher.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: HTTPHandler,  Next: QueueHandler,  Prev: MemoryHandler,  Up: logging handlers -- Logging handlers": {
            "content": "5.16.8.14 HTTPHandler\n.....................\n\nThe *note HTTPHandler: c8a. class, located in the *note\nlogging.handlers: 84. module, supports sending logging messages to a web\nserver, using either 'GET' or 'POST' semantics.\n\n-- Class: logging.handlers.HTTPHandler (host, url, method='GET',\nsecure=False, credentials=None, context=None)\n\nReturns a new instance of the *note HTTPHandler: c8a. class.  The\n'host' can be of the form 'host:port', should you need to use a\nspecific port number.  If no 'method' is specified, 'GET' is used.\nIf 'secure' is true, a HTTPS connection will be used.  The\n'context' parameter may be set to a *note ssl.SSLContext: 278.\ninstance to configure the SSL settings used for the HTTPS\nconnection.  If 'credentials' is specified, it should be a 2-tuple\nconsisting of userid and password, which will be placed in a HTTP\n'Authorization' header using Basic authentication.  If you specify\ncredentials, you should also specify secure=True so that your\nuserid and password are not passed in cleartext across the wire.\n\nChanged in version 3.5: The 'context' parameter was added.\n\n-- Method: mapLogRecord (record)\n\nProvides a dictionary, based on 'record', which is to be\nURL-encoded and sent to the web server.  The default\nimplementation just returns 'record.dict'.  This method\ncan be overridden if e.g.  only a subset of *note LogRecord:\ne59. is to be sent to the web server, or if more specific\ncustomization of what's sent to the server is required.\n\n-- Method: emit (record)\n\nSends the record to the web server as a URL-encoded\ndictionary.  The *note mapLogRecord(): 2a7e. method is used to\nconvert the record to the dictionary to be sent.\n\nNote: Since preparing a record for sending it to a web server\nis not the same as a generic formatting operation, using *note\nsetFormatter(): 29d5. to specify a *note Formatter: 12ec. for\na *note HTTPHandler: c8a. has no effect.  Instead of calling\n*note format(): 29df, this handler calls *note mapLogRecord():\n2a7e. and then *note urllib.parse.urlencode(): cf8. to encode\nthe dictionary in a form suitable for sending to a web server.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: QueueHandler,  Next: QueueListener,  Prev: HTTPHandler,  Up: logging handlers -- Logging handlers": {
            "content": "5.16.8.15 QueueHandler\n......................\n\nNew in version 3.2.\n\nThe *note QueueHandler: 1534. class, located in the *note\nlogging.handlers: 84. module, supports sending logging messages to a\nqueue, such as those implemented in the *note queue: b1. or *note\nmultiprocessing: 8f. modules.\n\nAlong with the *note QueueListener: c8b. class, *note QueueHandler:\n1534. can be used to let handlers do their work on a separate thread\nfrom the one which does the logging.  This is important in web\napplications and also other service applications where threads servicing\nclients need to respond as quickly as possible, while any potentially\nslow operations (such as sending an email via *note SMTPHandler: 2a6f.)\nare done on a separate thread.\n\n-- Class: logging.handlers.QueueHandler (queue)\n\nReturns a new instance of the *note QueueHandler: 1534. class.  The\ninstance is initialized with the queue to send messages to.  The\n'queue' can be any queue-like object; it's used as-is by the *note\nenqueue(): 2a82. method, which needs to know how to send messages\nto it.  The queue is not 'required' to have the task tracking API,\nwhich means that you can use *note SimpleQueue: 9aa. instances for\n'queue'.\n\nNote: If you are using *note multiprocessing: 8f, you should\navoid using *note SimpleQueue: 9aa. and instead use *note\nmultiprocessing.Queue: 13cf.\n\n-- Method: emit (record)\n\nEnqueues the result of preparing the LogRecord.  Should an\nexception occur (e.g.  because a bounded queue has filled up),\nthe *note handleError(): 29dd. method is called to handle the\nerror.  This can result in the record silently being dropped\n(if *note logging.raiseExceptions: 106d. is 'False') or a\nmessage printed to 'sys.stderr' (if *note\nlogging.raiseExceptions: 106d. is 'True').\n\n-- Method: prepare (record)\n\nPrepares a record for queuing.  The object returned by this\nmethod is enqueued.\n\nThe base implementation formats the record to merge the\nmessage, arguments, exception and stack information, if\npresent.  It also removes unpickleable items from the record\nin-place.  Specifically, it overwrites the record's 'msg' and\n'message' attributes with the merged message (obtained by\ncalling the handler's *note format(): 3eb. method), and sets\nthe 'args', 'excinfo' and 'exctext' attributes to 'None'.\n\nYou might want to override this method if you want to convert\nthe record to a dict or JSON string, or send a modified copy\nof the record while leaving the original intact.\n\nNote: The base implementation formats the message with\narguments, sets the 'message' and 'msg' attributes to the\nformatted message and sets the 'args' and 'exctext'\nattributes to 'None' to allow pickling and to prevent\nfurther attempts at formatting.  This means that a\nhandler on the *note QueueListener: c8b. side won't have\nthe information to do custom formatting, e.g.  of\nexceptions.  You may wish to subclass 'QueueHandler' and\noverride this method to e.g.  avoid setting 'exctext' to\n'None'.  Note that the 'message' / 'msg' / 'args' changes\nare related to ensuring the record is pickleable, and you\nmight or might not be able to avoid doing that depending\non whether your 'args' are pickleable.  (Note that you\nmay have to consider not only your own code but also code\nin any libraries that you use.)\n\n-- Method: enqueue (record)\n\nEnqueues the record on the queue using 'putnowait()'; you may\nwant to override this if you want to use blocking behaviour,\nor a timeout, or a customized queue implementation.\n\n-- Attribute: listener\n\nWhen created via configuration using *note dictConfig(): 1023,\nthis attribute will contain a *note QueueListener: c8b.\ninstance for use with this handler.  Otherwise, it will be\n'None'.\n\nNew in version 3.12.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: QueueListener,  Prev: QueueHandler,  Up: logging handlers -- Logging handlers": {
            "content": "5.16.8.16 QueueListener\n.......................\n\nNew in version 3.2.\n\nThe *note QueueListener: c8b. class, located in the *note\nlogging.handlers: 84. module, supports receiving logging messages from a\nqueue, such as those implemented in the *note queue: b1. or *note\nmultiprocessing: 8f. modules.  The messages are received from a queue in\nan internal thread and passed, on the same thread, to one or more\nhandlers for processing.  While *note QueueListener: c8b. is not itself\na handler, it is documented here because it works hand-in-hand with\n*note QueueHandler: 1534.\n\nAlong with the *note QueueHandler: 1534. class, *note QueueListener:\nc8b. can be used to let handlers do their work on a separate thread from\nthe one which does the logging.  This is important in web applications\nand also other service applications where threads servicing clients need\nto respond as quickly as possible, while any potentially slow operations\n(such as sending an email via *note SMTPHandler: 2a6f.) are done on a\nseparate thread.\n\n-- Class: logging.handlers.QueueListener (queue, *handlers,\nrespecthandlerlevel=False)\n\nReturns a new instance of the *note QueueListener: c8b. class.  The\ninstance is initialized with the queue to send messages to and a\nlist of handlers which will handle entries placed on the queue.\nThe queue can be any queue-like object; it's passed as-is to the\n*note dequeue(): 2a87. method, which needs to know how to get\nmessages from it.  The queue is not 'required' to have the task\ntracking API (though it's used if available), which means that you\ncan use *note SimpleQueue: 9aa. instances for 'queue'.\n\nNote: If you are using *note multiprocessing: 8f, you should\navoid using *note SimpleQueue: 9aa. and instead use *note\nmultiprocessing.Queue: 13cf.\n\nIf 'respecthandlerlevel' is 'True', a handler's level is\nrespected (compared with the level for the message) when deciding\nwhether to pass messages to that handler; otherwise, the behaviour\nis as in previous Python versions - to always pass each message to\neach handler.\n\nChanged in version 3.5: The 'respecthandlerlevel' argument was\nadded.\n\n-- Method: dequeue (block)\n\nDequeues a record and return it, optionally blocking.\n\nThe base implementation uses 'get()'.  You may want to\noverride this method if you want to use timeouts or work with\ncustom queue implementations.\n\n-- Method: prepare (record)\n\nPrepare a record for handling.\n\nThis implementation just returns the passed-in record.  You\nmay want to override this method if you need to do any custom\nmarshalling or manipulation of the record before passing it to\nthe handlers.\n\n-- Method: handle (record)\n\nHandle a record.\n\nThis just loops through the handlers offering them the record\nto handle.  The actual object passed to the handlers is that\nwhich is returned from *note prepare(): 2a88.\n\n-- Method: start ()\n\nStarts the listener.\n\nThis starts up a background thread to monitor the queue for\nLogRecords to process.\n\n-- Method: stop ()\n\nStops the listener.\n\nThis asks the thread to terminate, and then waits for it to do\nso.  Note that if you don't call this before your application\nexits, there may be some records still left on the queue,\nwhich won't be processed.\n\n-- Method: enqueuesentinel ()\n\nWrites a sentinel to the queue to tell the listener to quit.\nThis implementation uses 'putnowait()'.  You may want to\noverride this method if you want to use timeouts or work with\ncustom queue implementations.\n\nNew in version 3.3.\n\nSee also\n........\n\nModule *note logging: 82.\n\nAPI reference for the logging module.\n\nModule *note logging.config: 83.\n\nConfiguration API for the logging module.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: getpass -- Portable password input,  Next: curses -- Terminal handling for character-cell displays,  Prev: logging handlers -- Logging handlers,  Up: Generic Operating System Services": {
            "content": "'Source code:' Lib/getpass.py(1)\n\n\n\n*note Availability: 1ad3.: not Emscripten, not WASI.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: curses -- Terminal handling for character-cell displays,  Next: curses textpad -- Text input widget for curses programs,  Prev: getpass -- Portable password input,  Up: Generic Operating System Services": {
            "content": "'Source code:' Lib/curses(1)\n\n\n\nThe *note curses: 29. module provides an interface to the curses\nlibrary, the de-facto standard for portable advanced terminal handling.\n",
            "subsections": []
        },
        "While curses is most widely used in the Unix environment, versions are": {
            "content": "available for Windows, DOS, and possibly other systems as well.  This\nextension module is designed to match the API of ncurses, an open-source\ncurses library hosted on Linux and the BSD variants of Unix.\n\nNote: Whenever the documentation mentions a 'character' it can be\nspecified as an integer, a one-character Unicode string or a\none-byte byte string.\n\nWhenever the documentation mentions a 'character string' it can be\nspecified as a Unicode string or a byte string.\n\nSee also\n........\n\nModule *note curses.ascii: 2a.\n\nUtilities for working with ASCII characters, regardless of your\nlocale settings.\n\nModule *note curses.panel: 2b.\n\nA panel stack extension that adds depth to curses windows.\n\nModule *note curses.textpad: 2c.\n\nEditable text widget for curses supporting 'Emacs'-like bindings.\n\n*note Curses Programming with Python: 2a93.\n\nTutorial material on using curses with Python, by Andrew Kuchling\nand Eric Raymond.\n\n* Menu:\n\n* Functions: Functions<6>.\n* Window Objects::\n* Constants: Constants<6>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/curses\n\nFile: python3.12.info,  Node: Functions<6>,  Next: Window Objects,  Up: curses -- Terminal handling for character-cell displays\n\n5.16.10.1 Functions\n...................\n\nThe module *note curses: 29. defines the following exception:\n\n-- Exception: curses.error\n\nException raised when a curses library function returns an error.\n\nNote: Whenever 'x' or 'y' arguments to a function or a method are\noptional, they default to the current cursor location.  Whenever\n'attr' is optional, it defaults to *note ANORMAL: 2a97.\n\nThe module *note curses: 29. defines the following functions:\n\n-- Function: curses.baudrate ()\n\nReturn the output speed of the terminal in bits per second.  On\nsoftware terminal emulators it will have a fixed high value.\nIncluded for historical reasons; in former times, it was used to\nwrite output loops for time delays and occasionally to change\ninterfaces depending on the line speed.\n\n-- Function: curses.beep ()\n\nEmit a short attention sound.\n\n-- Function: curses.canchangecolor ()\n\nReturn 'True' or 'False', depending on whether the programmer can\nchange the colors displayed by the terminal.\n\n-- Function: curses.cbreak ()\n\nEnter cbreak mode.  In cbreak mode (sometimes called \"rare\" mode)\nnormal tty line buffering is turned off and characters are\navailable to be read one by one.  However, unlike raw mode, special\ncharacters (interrupt, quit, suspend, and flow control) retain\ntheir effects on the tty driver and calling program.  Calling first\n*note raw(): 2a9c. then *note cbreak(): 2a9b. leaves the terminal\nin cbreak mode.\n\n-- Function: curses.colorcontent (colornumber)\n\nReturn the intensity of the red, green, and blue (RGB) components\nin the color 'colornumber', which must be between '0' and 'COLORS\n- 1'.  Return a 3-tuple, containing the R,G,B values for the given\ncolor, which will be between '0' (no component) and '1000' (maximum\namount of component).\n\n-- Function: curses.colorpair (pairnumber)\n\nReturn the attribute value for displaying text in the specified\ncolor pair.  Only the first 256 color pairs are supported.  This\nattribute value can be combined with *note ASTANDOUT: 2a9e, *note\nAREVERSE: 2a9f, and the other 'A*' attributes.  *note\npairnumber(): 2aa0. is the counterpart to this function.\n\n-- Function: curses.cursset (visibility)\n\nSet the cursor state.  'visibility' can be set to '0', '1', or '2',\nfor invisible, normal, or very visible.  If the terminal supports\nthe visibility requested, return the previous cursor state;\notherwise raise an exception.  On many terminals, the \"visible\"\nmode is an underline cursor and the \"very visible\" mode is a block\ncursor.\n\n-- Function: curses.defprogmode ()\n\nSave the current terminal mode as the \"program\" mode, the mode when\nthe running program is using curses.  (Its counterpart is the\n\"shell\" mode, for when the program is not in curses.)  Subsequent\ncalls to *note resetprogmode(): 2aa3. will restore this mode.\n\n-- Function: curses.defshellmode ()\n\nSave the current terminal mode as the \"shell\" mode, the mode when\nthe running program is not using curses.  (Its counterpart is the\n\"program\" mode, when the program is using curses capabilities.)\nSubsequent calls to *note resetshellmode(): 2aa5. will restore\nthis mode.\n\n-- Function: curses.delayoutput (ms)\n\nInsert an 'ms' millisecond pause in output.\n\n-- Function: curses.doupdate ()\n\nUpdate the physical screen.  The curses library keeps two data\nstructures, one representing the current physical screen contents\nand a virtual screen representing the desired next state.  The\n*note doupdate(): 2aa7. ground updates the physical screen to match\nthe virtual screen.\n\nThe virtual screen may be updated by a *note noutrefresh(): 2aa8.\ncall after write operations such as *note addstr(): 2aa9. have been\nperformed on a window.  The normal *note refresh(): 2aaa. call is\nsimply 'noutrefresh()' followed by 'doupdate()'; if you have to\nupdate multiple windows, you can speed performance and perhaps\nreduce screen flicker by issuing 'noutrefresh()' calls on all\nwindows, followed by a single 'doupdate()'.\n\n-- Function: curses.echo ()\n\nEnter echo mode.  In echo mode, each character input is echoed to\nthe screen as it is entered.\n\n-- Function: curses.endwin ()\n\nDe-initialize the library, and return terminal to normal status.\n\n-- Function: curses.erasechar ()\n\nReturn the user's current erase character as a one-byte bytes\nobject.  Under Unix operating systems this is a property of the\ncontrolling tty of the curses program, and is not set by the curses\nlibrary itself.\n\n-- Function: curses.filter ()\n\nThe *note filter(): 2aae. routine, if used, must be called before\n*note initscr(): 2aaf. is called.  The effect is that, during those\ncalls, 'LINES' is set to '1'; the capabilities 'clear', 'cup',\n'cud', 'cud1', 'cuu1', 'cuu', 'vpa' are disabled; and the 'home'\nstring is set to the value of 'cr'.  The effect is that the cursor\nis confined to the current line, and so are screen updates.  This\nmay be used for enabling character-at-a-time line editing without\ntouching the rest of the screen.\n\n-- Function: curses.flash ()\n\nFlash the screen.  That is, change it to reverse-video and then\nchange it back in a short interval.  Some people prefer such as\n'visible bell' to the audible attention signal produced by *note\nbeep(): 2a99.\n\n-- Function: curses.flushinp ()\n\nFlush all input buffers.  This throws away any typeahead that has\nbeen typed by the user and has not yet been processed by the\nprogram.\n\n-- Function: curses.getmouse ()\n\nAfter *note getch(): 2ab3. returns *note KEYMOUSE: 2ab4. to signal\na mouse event, this method should be called to retrieve the queued\nmouse event, represented as a 5-tuple '(id, x, y, z, bstate)'.\n'id' is an ID value used to distinguish multiple devices, and 'x',\n'y', 'z' are the event's coordinates.  ('z' is currently unused.)\n'bstate' is an integer value whose bits will be set to indicate the\ntype of event, and will be the bitwise OR of one or more of the\nfollowing constants, where 'n' is the button number from 1 to 5:\n*note BUTTONnPRESSED: 2ab5, *note BUTTONnRELEASED: 2ab6, *note\nBUTTONnCLICKED: 2ab7, *note BUTTONnDOUBLECLICKED: 2ab8, *note\nBUTTONnTRIPLECLICKED: 2ab9, *note BUTTONSHIFT: 2aba, *note\nBUTTONCTRL: 2abb, *note BUTTONALT: 2abc.\n\nChanged in version 3.10: The 'BUTTON5*' constants are now exposed\nif they are provided by the underlying curses library.\n\n-- Function: curses.getsyx ()\n\nReturn the current coordinates of the virtual screen cursor as a\ntuple '(y, x)'.  If *note leaveok: 2abe. is currently 'True', then\nreturn '(-1, -1)'.\n\n-- Function: curses.getwin (file)\n\nRead window related data stored in the file by an earlier *note\nwindow.putwin(): 2ac0. call.  The routine then creates and\ninitializes a new window using that data, returning the new window\nobject.\n\n-- Function: curses.hascolors ()\n\nReturn 'True' if the terminal can display colors; otherwise, return\n'False'.\n\n-- Function: curses.hasextendedcolorsupport ()\n\nReturn 'True' if the module supports extended colors; otherwise,\nreturn 'False'.  Extended color support allows more than 256 color\npairs for terminals that support more than 16 colors (e.g.\nxterm-256color).\n\nExtended color support requires ncurses version 6.1 or later.\n\nNew in version 3.10.\n\n-- Function: curses.hasic ()\n\nReturn 'True' if the terminal has insert- and delete-character\ncapabilities.  This function is included for historical reasons\nonly, as all modern software terminal emulators have such\ncapabilities.\n\n-- Function: curses.hasil ()\n\nReturn 'True' if the terminal has insert- and delete-line\ncapabilities, or can simulate them using scrolling regions.  This\nfunction is included for historical reasons only, as all modern\nsoftware terminal emulators have such capabilities.\n\n-- Function: curses.haskey (ch)\n\nTake a key value 'ch', and return 'True' if the current terminal\ntype recognizes a key with that value.\n\n-- Function: curses.halfdelay (tenths)\n\nUsed for half-delay mode, which is similar to cbreak mode in that\ncharacters typed by the user are immediately available to the\nprogram.  However, after blocking for 'tenths' tenths of seconds,\nraise an exception if nothing has been typed.  The value of\n'tenths' must be a number between '1' and '255'.  Use *note\nnocbreak(): 2ac6. to leave half-delay mode.\n\n-- Function: curses.initcolor (colornumber, r, g, b)\n\nChange the definition of a color, taking the number of the color to\nbe changed followed by three RGB values (for the amounts of red,\ngreen, and blue components).  The value of 'colornumber' must be\nbetween '0' and 'COLORS - 1'.  Each of 'r', 'g', 'b', must be a\nvalue between '0' and '1000'.  When *note initcolor(): 5e5. is\nused, all occurrences of that color on the screen immediately\nchange to the new definition.  This function is a no-op on most\nterminals; it is active only if *note canchangecolor(): 2a9a.\nreturns 'True'.\n\n-- Function: curses.initpair (pairnumber, fg, bg)\n\nChange the definition of a color-pair.  It takes three arguments:\nthe number of the color-pair to be changed, the foreground color\nnumber, and the background color number.  The value of\n'pairnumber' must be between '1' and 'COLORPAIRS - 1' (the '0'\ncolor pair is wired to white on black and cannot be changed).  The\nvalue of 'fg' and 'bg' arguments must be between '0' and 'COLORS -\n1', or, after calling *note usedefaultcolors(): 2ac7, '-1'.  If\nthe color-pair was previously initialized, the screen is refreshed\nand all occurrences of that color-pair are changed to the new\ndefinition.\n\n-- Function: curses.initscr ()\n\nInitialize the library.  Return a *note window: 2ac8. object which\nrepresents the whole screen.\n\nNote: If there is an error opening the terminal, the\nunderlying curses library may cause the interpreter to exit.\n\n-- Function: curses.istermresized (nlines, ncols)\n\nReturn 'True' if *note resizeterm(): 2aca. would modify the window\nstructure, 'False' otherwise.\n\n-- Function: curses.isendwin ()\n\nReturn 'True' if *note endwin(): 2aac. has been called (that is,\nthe curses library has been deinitialized).\n\n-- Function: curses.keyname (k)\n\nReturn the name of the key numbered 'k' as a bytes object.  The\nname of a key generating printable ASCII character is the key's\ncharacter.  The name of a control-key combination is a two-byte\nbytes object consisting of a caret ('b'^'') followed by the\ncorresponding printable ASCII character.  The name of an alt-key\ncombination (128-255) is a bytes object consisting of the prefix\n'b'M-'' followed by the name of the corresponding ASCII character.\n\n-- Function: curses.killchar ()\n\nReturn the user's current line kill character as a one-byte bytes\nobject.  Under Unix operating systems this is a property of the\ncontrolling tty of the curses program, and is not set by the curses\nlibrary itself.\n\n-- Function: curses.longname ()\n\nReturn a bytes object containing the terminfo long name field\ndescribing the current terminal.  The maximum length of a verbose\ndescription is 128 characters.  It is defined only after the call\nto *note initscr(): 2aaf.\n\n-- Function: curses.meta (flag)\n\nIf 'flag' is 'True', allow 8-bit characters to be input.  If 'flag'\nis 'False', allow only 7-bit chars.\n\n-- Function: curses.mouseinterval (interval)\n\nSet the maximum time in milliseconds that can elapse between press\nand release events in order for them to be recognized as a click,\nand return the previous interval value.  The default value is 200\nmilliseconds, or one fifth of a second.\n\n-- Function: curses.mousemask (mousemask)\n\nSet the mouse events to be reported, and return a tuple\n'(availmask, oldmask)'.  'availmask' indicates which of the\nspecified mouse events can be reported; on complete failure it\nreturns '0'.  'oldmask' is the previous value of the given window's\nmouse event mask.  If this function is never called, no mouse\nevents are ever reported.\n\n-- Function: curses.napms (ms)\n\nSleep for 'ms' milliseconds.\n\n-- Function: curses.newpad (nlines, ncols)\n\nCreate and return a pointer to a new pad data structure with the\ngiven number of lines and columns.  Return a pad as a window\nobject.\n\nA pad is like a window, except that it is not restricted by the\nscreen size, and is not necessarily associated with a particular\npart of the screen.  Pads can be used when a large window is\nneeded, and only a part of the window will be on the screen at one\ntime.  Automatic refreshes of pads (such as from scrolling or\nechoing of input) do not occur.  The *note refresh(): 2aaa. and\n*note noutrefresh(): 2aa8. methods of a pad require 6 arguments to\nspecify the part of the pad to be displayed and the location on the\nscreen to be used for the display.  The arguments are 'pminrow',\n'pmincol', 'sminrow', 'smincol', 'smaxrow', 'smaxcol'; the 'p'\narguments refer to the upper left corner of the pad region to be\ndisplayed and the 's' arguments define a clipping box on the screen\nwithin which the pad region is to be displayed.\n\n-- Function: curses.newwin (nlines, ncols)\n\n-- Function: curses.newwin (nlines, ncols, beginy, beginx)\n\nReturn a new *note window: 2ac8, whose left-upper corner is at\n'(beginy, beginx)', and whose height/width is 'nlines'/'ncols'.\n\nBy default, the window will extend from the specified position to\nthe lower right corner of the screen.\n\n-- Function: curses.nl ()\n\nEnter newline mode.  This mode translates the return key into\nnewline on input, and translates newline into return and line-feed\non output.  Newline mode is initially on.\n\n-- Function: curses.nocbreak ()\n\nLeave cbreak mode.  Return to normal \"cooked\" mode with line\nbuffering.\n\n-- Function: curses.noecho ()\n\nLeave echo mode.  Echoing of input characters is turned off.\n\n-- Function: curses.nonl ()\n\nLeave newline mode.  Disable translation of return into newline on\ninput, and disable low-level translation of newline into\nnewline/return on output (but this does not change the behavior of\n'addch('\\n')', which always does the equivalent of return and line\nfeed on the virtual screen).  With translation off, curses can\nsometimes speed up vertical motion a little; also, it will be able\nto detect the return key on input.\n\n-- Function: curses.noqiflush ()\n\nWhen the 'noqiflush()' routine is used, normal flush of input and\noutput queues associated with the 'INTR', 'QUIT' and 'SUSP'\ncharacters will not be done.  You may want to call 'noqiflush()' in\na signal handler if you want output to continue as though the\ninterrupt had not occurred, after the handler exits.\n\n-- Function: curses.noraw ()\n\nLeave raw mode.  Return to normal \"cooked\" mode with line\nbuffering.\n\n-- Function: curses.paircontent (pairnumber)\n\nReturn a tuple '(fg, bg)' containing the colors for the requested\ncolor pair.  The value of 'pairnumber' must be between '0' and\n'COLORPAIRS - 1'.\n\n-- Function: curses.pairnumber (attr)\n\nReturn the number of the color-pair set by the attribute value\n'attr'.  *note colorpair(): 2a9d. is the counterpart to this\nfunction.\n\n-- Function: curses.putp (str)\n\nEquivalent to 'tputs(str, 1, putchar)'; emit the value of a\nspecified terminfo capability for the current terminal.  Note that\nthe output of *note putp(): 2ada. always goes to standard output.\n\n-- Function: curses.qiflush ([flag])\n\nIf 'flag' is 'False', the effect is the same as calling *note\nnoqiflush(): 2ad8.  If 'flag' is 'True', or no argument is\nprovided, the queues will be flushed when these control characters\nare read.\n\n-- Function: curses.raw ()\n\nEnter raw mode.  In raw mode, normal line buffering and processing\nof interrupt, quit, suspend, and flow control keys are turned off;\ncharacters are presented to curses input functions one by one.\n\n-- Function: curses.resetprogmode ()\n\nRestore the terminal to \"program\" mode, as previously saved by\n*note defprogmode(): 2aa2.\n\n-- Function: curses.resetshellmode ()\n\nRestore the terminal to \"shell\" mode, as previously saved by *note\ndefshellmode(): 2aa4.\n\n-- Function: curses.resetty ()\n\nRestore the state of the terminal modes to what it was at the last\ncall to *note savetty(): 2add.\n\n-- Function: curses.resizeterm (nlines, ncols)\n\nBackend function used by *note resizeterm(): 2ade, performing most\nof the work; when resizing the windows, *note resizeterm(): 2aca.\nblank-fills the areas that are extended.  The calling application\nshould fill in these areas with appropriate data.  The\n'resizeterm()' function attempts to resize all windows.  However,\ndue to the calling convention of pads, it is not possible to resize\nthese without additional interaction with the application.\n\n-- Function: curses.resizeterm (nlines, ncols)\n\nResize the standard and current windows to the specified\ndimensions, and adjusts other bookkeeping data used by the curses\nlibrary that record the window dimensions (in particular the\nSIGWINCH handler).\n\n-- Function: curses.savetty ()\n\nSave the current state of the terminal modes in a buffer, usable by\n*note resetty(): 2adc.\n\n-- Function: curses.getescdelay ()\n\nRetrieves the value set by *note setescdelay(): 70a.\n\nNew in version 3.9.\n\n-- Function: curses.setescdelay (ms)\n\nSets the number of milliseconds to wait after reading an escape\ncharacter, to distinguish between an individual escape character\nentered on the keyboard from escape sequences sent by cursor and\nfunction keys.\n\nNew in version 3.9.\n\n-- Function: curses.gettabsize ()\n\nRetrieves the value set by *note settabsize(): 70c.\n\nNew in version 3.9.\n\n-- Function: curses.settabsize (size)\n\nSets the number of columns used by the curses library when\nconverting a tab character to spaces as it adds the tab to a\nwindow.\n\nNew in version 3.9.\n\n-- Function: curses.setsyx (y, x)\n\nSet the virtual screen cursor to 'y', 'x'.  If 'y' and 'x' are both\n'-1', then *note leaveok: 2abe. is set 'True'.\n\n-- Function: curses.setupterm (term=None, fd=-1)\n\nInitialize the terminal.  'term' is a string giving the terminal\nname, or 'None'; if omitted or 'None', the value of the 'TERM'\nenvironment variable will be used.  'fd' is the file descriptor to\nwhich any initialization sequences will be sent; if not supplied or\n'-1', the file descriptor for 'sys.stdout' will be used.\n\n-- Function: curses.startcolor ()\n\nMust be called if the programmer wants to use colors, and before\nany other color manipulation routine is called.  It is good\npractice to call this routine right after *note initscr(): 2aaf.\n\n*note startcolor(): 2ae1. initializes eight basic colors (black,\nred, green, yellow, blue, magenta, cyan, and white), and two global\nvariables in the *note curses: 29. module, *note COLORS: 2ae2. and\n*note COLORPAIRS: 2ae3, containing the maximum number of colors\nand color-pairs the terminal can support.  It also restores the\ncolors on the terminal to the values they had when the terminal was\njust turned on.\n\n-- Function: curses.termattrs ()\n\nReturn a logical OR of all video attributes supported by the\nterminal.  This information is useful when a curses program needs\ncomplete control over the appearance of the screen.\n\n-- Function: curses.termname ()\n\nReturn the value of the environment variable 'TERM', as a bytes\nobject, truncated to 14 characters.\n\n-- Function: curses.tigetflag (capname)\n\nReturn the value of the Boolean capability corresponding to the\nterminfo capability name 'capname' as an integer.  Return the value\n'-1' if 'capname' is not a Boolean capability, or '0' if it is\ncanceled or absent from the terminal description.\n\n-- Function: curses.tigetnum (capname)\n\nReturn the value of the numeric capability corresponding to the\nterminfo capability name 'capname' as an integer.  Return the value\n'-2' if 'capname' is not a numeric capability, or '-1' if it is\ncanceled or absent from the terminal description.\n\n-- Function: curses.tigetstr (capname)\n\nReturn the value of the string capability corresponding to the\nterminfo capability name 'capname' as a bytes object.  Return\n'None' if 'capname' is not a terminfo \"string capability\", or is\ncanceled or absent from the terminal description.\n\n-- Function: curses.tparm (str[, ...])\n\nInstantiate the bytes object 'str' with the supplied parameters,\nwhere 'str' should be a parameterized string obtained from the\nterminfo database.  E.g.  'tparm(tigetstr(\"cup\"), 5, 3)' could\nresult in 'b'\\033[6;4H'', the exact result depending on terminal\ntype.\n\n-- Function: curses.typeahead (fd)\n\nSpecify that the file descriptor 'fd' be used for typeahead\nchecking.  If 'fd' is '-1', then no typeahead checking is done.\n\nThe curses library does \"line-breakout optimization\" by looking for\ntypeahead periodically while updating the screen.  If input is\nfound, and it is coming from a tty, the current update is postponed\nuntil refresh or doupdate is called again, allowing faster response\nto commands typed in advance.  This function allows specifying a\ndifferent file descriptor for typeahead checking.\n\n-- Function: curses.unctrl (ch)\n\nReturn a bytes object which is a printable representation of the\ncharacter 'ch'.  Control characters are represented as a caret\nfollowed by the character, for example as 'b'^C''.  Printing\ncharacters are left as they are.\n\n-- Function: curses.ungetch (ch)\n\nPush 'ch' so the next *note getch(): 2ab3. will return it.\n\nNote: Only one 'ch' can be pushed before 'getch()' is called.\n\n-- Function: curses.updatelinescols ()\n\nUpdate the *note LINES: 142e. and *note COLS: 142f. module\nvariables.  Useful for detecting manual screen resize.\n\nNew in version 3.5.\n\n-- Function: curses.ungetwch (ch)\n\nPush 'ch' so the next *note getwch(): f0e. will return it.\n\nNote: Only one 'ch' can be pushed before 'getwch()' is\ncalled.\n\nNew in version 3.3.\n\n-- Function: curses.ungetmouse (id, x, y, z, bstate)\n\nPush a *note KEYMOUSE: 2ab4. event onto the input queue,\nassociating the given state data with it.\n\n-- Function: curses.useenv (flag)\n\nIf used, this function should be called before *note initscr():\n2aaf. or newterm are called.  When 'flag' is 'False', the values of\nlines and columns specified in the terminfo database will be used,\neven if environment variables 'LINES' and 'COLUMNS' (used by\ndefault) are set, or if curses is running in a window (in which\ncase default behavior would be to use the window size if 'LINES'\nand 'COLUMNS' are not set).\n\n-- Function: curses.usedefaultcolors ()\n\nAllow use of default values for colors on terminals supporting this\nfeature.  Use this to support transparency in your application.\nThe default color is assigned to the color number '-1'.  After\ncalling this function, 'initpair(x, curses.COLORRED, -1)'\ninitializes, for instance, color pair 'x' to a red foreground color\non the default background.\n\n-- Function: curses.wrapper (func, /, *args, kwargs)\n\nInitialize curses and call another callable object, 'func', which\nshould be the rest of your curses-using application.  If the\napplication raises an exception, this function will restore the\nterminal to a sane state before re-raising the exception and\ngenerating a traceback.  The callable object 'func' is then passed\nthe main window 'stdscr' as its first argument, followed by any\nother arguments passed to 'wrapper()'.  Before calling 'func',\n'wrapper()' turns on cbreak mode, turns off echo, enables the\nterminal keypad, and initializes colors if the terminal has color\nsupport.  On exit (whether normally or by exception) it restores\ncooked mode, turns on echo, and disables the terminal keypad.\n\nFile: python3.12.info,  Node: Window Objects,  Next: Constants<6>,  Prev: Functions<6>,  Up: curses -- Terminal handling for character-cell displays\n\n5.16.10.2 Window Objects\n........................\n\nWindow objects, as returned by *note initscr(): 2aaf. and *note\nnewwin(): 2ad4. above, have the following methods and attributes:\n\n-- Method: window.addch (ch[, attr])\n\n-- Method: window.addch (y, x, ch[, attr])\n\nPaint character 'ch' at '(y, x)' with attributes 'attr',\noverwriting any character previously painted at that location.  By\ndefault, the character position and attributes are the current\nsettings for the window object.\n\nNote: Writing outside the window, subwindow, or pad raises a\n*note curses.error: 2a96.  Attempting to write to the lower\nright corner of a window, subwindow, or pad will cause an\nexception to be raised after the character is printed.\n\n-- Method: window.addnstr (str, n[, attr])\n\n-- Method: window.addnstr (y, x, str, n[, attr])\n\nPaint at most 'n' characters of the character string 'str' at '(y,\nx)' with attributes 'attr', overwriting anything previously on the\ndisplay.\n\n-- Method: window.addstr (str[, attr])\n\n-- Method: window.addstr (y, x, str[, attr])\n\nPaint the character string 'str' at '(y, x)' with attributes\n'attr', overwriting anything previously on the display.\n\nNote:\n* Writing outside the window, subwindow, or pad raises\n*note curses.error: 2a96.  Attempting to write to the\nlower right corner of a window, subwindow, or pad will\ncause an exception to be raised after the string is\nprinted.\n\n* A bug in ncurses(1), the backend for this Python module,\ncan cause SegFaults when resizing windows.  This is fixed\nin ncurses-6.1-20190511.  If you are stuck with an\nearlier ncurses, you can avoid triggering this if you do\nnot call *note addstr(): 2aa9. with a 'str' that has\nembedded newlines.  Instead, call *note addstr(): 2aa9.\nseparately for each line.\n\n-- Method: window.attroff (attr)\n\nRemove attribute 'attr' from the \"background\" set applied to all\nwrites to the current window.\n\n-- Method: window.attron (attr)\n\nAdd attribute 'attr' from the \"background\" set applied to all\nwrites to the current window.\n\n-- Method: window.attrset (attr)\n\nSet the \"background\" set of attributes to 'attr'.  This set is\ninitially '0' (no attributes).\n\n-- Method: window.bkgd (ch[, attr])\n\nSet the background property of the window to the character 'ch',\nwith attributes 'attr'.  The change is then applied to every\ncharacter position in that window:\n\n* The attribute of every character in the window is changed to\nthe new background attribute.\n\n* Wherever the former background character appears, it is\nchanged to the new background character.\n\n-- Method: window.bkgdset (ch[, attr])\n\nSet the window's background.  A window's background consists of a\ncharacter and any combination of attributes.  The attribute part of\nthe background is combined (OR'ed) with all non-blank characters\nthat are written into the window.  Both the character and attribute\nparts of the background are combined with the blank characters.\nThe background becomes a property of the character and moves with\nthe character through any scrolling and insert/delete\nline/character operations.\n\n-- Method: window.border ([ls[, rs[, ts[, bs[, tl[, tr[, bl[,\nbr]]]]]]]])\n\nDraw a border around the edges of the window.  Each parameter\nspecifies the character to use for a specific part of the border;\nsee the table below for more details.\n\nNote: A '0' value for any parameter will cause the default\ncharacter to be used for that parameter.  Keyword parameters\ncan 'not' be used.  The defaults are listed in this table:\n\nParameter       Description               Default value\n\n----------------------------------------------------------------------\n\n'ls'            Left side                 *note ACSVLINE: 2af8.\n\n\n'rs'            Right side                *note ACSVLINE: 2af8.\n\n\n'ts'            Top                       *note ACSHLINE: 2af9.\n\n\n'bs'            Bottom                    *note ACSHLINE: 2af9.\n\n\n'tl'            Upper-left corner         *note ACSULCORNER: 2afa.\n\n\n'tr'            Upper-right corner        *note ACSURCORNER: 2afb.\n\n\n'bl'            Bottom-left corner        *note ACSLLCORNER: 2afc.\n\n\n'br'            Bottom-right corner       *note ACSLRCORNER: 2afd.\n\n\n-- Method: window.box ([vertch, horch])\n\nSimilar to *note border(): 2af7, but both 'ls' and 'rs' are\n'vertch' and both 'ts' and 'bs' are 'horch'.  The default corner\ncharacters are always used by this function.\n\n-- Method: window.chgat (attr)\n\n-- Method: window.chgat (num, attr)\n\n-- Method: window.chgat (y, x, attr)\n\n-- Method: window.chgat (y, x, num, attr)\n\nSet the attributes of 'num' characters at the current cursor\nposition, or at position '(y, x)' if supplied.  If 'num' is not\ngiven or is '-1', the attribute will be set on all the characters\nto the end of the line.  This function moves cursor to position\n'(y, x)' if supplied.  The changed line will be touched using the\n*note touchline(): 2b00. method so that the contents will be\nredisplayed by the next window refresh.\n\n-- Method: window.clear ()\n\nLike *note erase(): 2b02, but also cause the whole window to be\nrepainted upon next call to *note refresh(): 2aaa.\n\n-- Method: window.clearok (flag)\n\nIf 'flag' is 'True', the next call to *note refresh(): 2aaa. will\nclear the window completely.\n\n-- Method: window.clrtobot ()\n\nErase from cursor to the end of the window: all lines below the\ncursor are deleted, and then the equivalent of *note clrtoeol():\n2b05. is performed.\n\n-- Method: window.clrtoeol ()\n\nErase from cursor to the end of the line.\n\n-- Method: window.cursyncup ()\n\nUpdate the current cursor position of all the ancestors of the\nwindow to reflect the current cursor position of the window.\n\n-- Method: window.delch ([y, x])\n\nDelete any character at '(y, x)'.\n\n-- Method: window.deleteln ()\n\nDelete the line under the cursor.  All following lines are moved up\nby one line.\n\n-- Method: window.derwin (beginy, beginx)\n\n-- Method: window.derwin (nlines, ncols, beginy, beginx)\n\nAn abbreviation for \"derive window\", *note derwin(): 2b09. is the\nsame as calling *note subwin(): 2b0a, except that 'beginy' and\n'beginx' are relative to the origin of the window, rather than\nrelative to the entire screen.  Return a window object for the\nderived window.\n\n-- Method: window.echochar (ch[, attr])\n\nAdd character 'ch' with attribute 'attr', and immediately call\n*note refresh(): 2aaa. on the window.\n\n-- Method: window.enclose (y, x)\n\nTest whether the given pair of screen-relative character-cell\ncoordinates are enclosed by the given window, returning 'True' or\n'False'.  It is useful for determining what subset of the screen\nwindows enclose the location of a mouse event.\n\nChanged in version 3.10: Previously it returned '1' or '0' instead\nof 'True' or 'False'.\n\n-- Attribute: window.encoding\n\nEncoding used to encode method arguments (Unicode strings and\ncharacters).  The encoding attribute is inherited from the parent\nwindow when a subwindow is created, for example with *note\nwindow.subwin(): 2b0a.  By default, current locale encoding is used\n(see *note locale.getencoding(): 41f.).\n\nNew in version 3.3.\n\n-- Method: window.erase ()\n\nClear the window.\n\n-- Method: window.getbegyx ()\n\nReturn a tuple '(y, x)' of co-ordinates of upper-left corner.\n\n-- Method: window.getbkgd ()\n\nReturn the given window's current background character/attribute\npair.\n\n-- Method: window.getch ([y, x])\n\nGet a character.  Note that the integer returned does 'not' have to\nbe in ASCII range: function keys, keypad keys and so on are\nrepresented by numbers higher than 255.  In no-delay mode, return\n'-1' if there is no input, otherwise wait until a key is pressed.\n\n-- Method: window.getwch ([y, x])\n\nGet a wide character.  Return a character for most keys, or an\ninteger for function keys, keypad keys, and other special keys.  In\nno-delay mode, raise an exception if there is no input.\n\nNew in version 3.3.\n\n-- Method: window.getkey ([y, x])\n\nGet a character, returning a string instead of an integer, as *note\ngetch(): 2ab3. does.  Function keys, keypad keys and other special\nkeys return a multibyte string containing the key name.  In\nno-delay mode, raise an exception if there is no input.\n\n-- Method: window.getmaxyx ()\n\nReturn a tuple '(y, x)' of the height and width of the window.\n\n-- Method: window.getparyx ()\n\nReturn the beginning coordinates of this window relative to its\nparent window as a tuple '(y, x)'.  Return '(-1, -1)' if this\nwindow has no parent.\n\n-- Method: window.getstr ()\n\n-- Method: window.getstr (n)\n\n-- Method: window.getstr (y, x)\n\n-- Method: window.getstr (y, x, n)\n\nRead a bytes object from the user, with primitive line editing\ncapacity.\n\n-- Method: window.getyx ()\n\nReturn a tuple '(y, x)' of current cursor position relative to the\nwindow's upper-left corner.\n\n-- Method: window.hline (ch, n)\n\n-- Method: window.hline (y, x, ch, n)\n\nDisplay a horizontal line starting at '(y, x)' with length 'n'\nconsisting of the character 'ch'.\n\n-- Method: window.idcok (flag)\n\nIf 'flag' is 'False', curses no longer considers using the hardware\ninsert/delete character feature of the terminal; if 'flag' is\n'True', use of character insertion and deletion is enabled.  When\ncurses is first initialized, use of character insert/delete is\nenabled by default.\n\n-- Method: window.idlok (flag)\n\nIf 'flag' is 'True', *note curses: 29. will try and use hardware\nline editing facilities.  Otherwise, line insertion/deletion are\ndisabled.\n\n-- Method: window.immedok (flag)\n\nIf 'flag' is 'True', any change in the window image automatically\ncauses the window to be refreshed; you no longer have to call *note\nrefresh(): 2aaa. yourself.  However, it may degrade performance\nconsiderably, due to repeated calls to wrefresh.  This option is\ndisabled by default.\n\n-- Method: window.inch ([y, x])\n\nReturn the character at the given position in the window.  The\nbottom 8 bits are the character proper, and upper bits are the\nattributes.\n\n-- Method: window.insch (ch[, attr])\n\n-- Method: window.insch (y, x, ch[, attr])\n\nPaint character 'ch' at '(y, x)' with attributes 'attr', moving the\nline from position 'x' right by one character.\n\n-- Method: window.insdelln (nlines)\n\nInsert 'nlines' lines into the specified window above the current\nline.  The 'nlines' bottom lines are lost.  For negative 'nlines',\ndelete 'nlines' lines starting with the one under the cursor, and\nmove the remaining lines up.  The bottom 'nlines' lines are\ncleared.  The current cursor position remains the same.\n\n-- Method: window.insertln ()\n\nInsert a blank line under the cursor.  All following lines are\nmoved down by one line.\n\n-- Method: window.insnstr (str, n[, attr])\n\n-- Method: window.insnstr (y, x, str, n[, attr])\n\nInsert a character string (as many characters as will fit on the\nline) before the character under the cursor, up to 'n' characters.\nIf 'n' is zero or negative, the entire string is inserted.  All\ncharacters to the right of the cursor are shifted right, with the\nrightmost characters on the line being lost.  The cursor position\ndoes not change (after moving to 'y', 'x', if specified).\n\n-- Method: window.insstr (str[, attr])\n\n-- Method: window.insstr (y, x, str[, attr])\n\nInsert a character string (as many characters as will fit on the\nline) before the character under the cursor.  All characters to the\nright of the cursor are shifted right, with the rightmost\ncharacters on the line being lost.  The cursor position does not\nchange (after moving to 'y', 'x', if specified).\n\n-- Method: window.instr ([n])\n\n-- Method: window.instr (y, x[, n])\n\nReturn a bytes object of characters, extracted from the window\nstarting at the current cursor position, or at 'y', 'x' if\nspecified.  Attributes are stripped from the characters.  If 'n' is\nspecified, *note instr(): 2b1d. returns a string at most 'n'\ncharacters long (exclusive of the trailing NUL).\n\n-- Method: window.islinetouched (line)\n\nReturn 'True' if the specified line was modified since the last\ncall to *note refresh(): 2aaa.; otherwise return 'False'.  Raise a\n*note curses.error: 2a96. exception if 'line' is not valid for the\ngiven window.\n\n-- Method: window.iswintouched ()\n\nReturn 'True' if the specified window was modified since the last\ncall to *note refresh(): 2aaa.; otherwise return 'False'.\n\n-- Method: window.keypad (flag)\n\nIf 'flag' is 'True', escape sequences generated by some keys\n(keypad, function keys) will be interpreted by *note curses: 29.\nIf 'flag' is 'False', escape sequences will be left as is in the\ninput stream.\n\n-- Method: window.leaveok (flag)\n\nIf 'flag' is 'True', cursor is left where it is on update, instead\nof being at \"cursor position.\" This reduces cursor movement where\npossible.  If possible the cursor will be made invisible.\n\nIf 'flag' is 'False', cursor will always be at \"cursor position\"\nafter an update.\n\n-- Method: window.move (newy, newx)\n\nMove cursor to '(newy, newx)'.\n\n-- Method: window.mvderwin (y, x)\n\nMove the window inside its parent window.  The screen-relative\nparameters of the window are not changed.  This routine is used to\ndisplay different parts of the parent window at the same physical\nposition on the screen.\n\n-- Method: window.mvwin (newy, newx)\n\nMove the window so its upper-left corner is at '(newy, newx)'.\n\n-- Method: window.nodelay (flag)\n\nIf 'flag' is 'True', *note getch(): 2ab3. will be non-blocking.\n\n-- Method: window.notimeout (flag)\n\nIf 'flag' is 'True', escape sequences will not be timed out.\n\nIf 'flag' is 'False', after a few milliseconds, an escape sequence\nwill not be interpreted, and will be left in the input stream as\nis.\n\n-- Method: window.noutrefresh ()\n\nMark for refresh but wait.  This function updates the data\nstructure representing the desired state of the window, but does\nnot force an update of the physical screen.  To accomplish that,\ncall *note doupdate(): 2aa7.\n\n-- Method: window.overlay (destwin[, sminrow, smincol, dminrow,\ndmincol, dmaxrow, dmaxcol])\n\nOverlay the window on top of 'destwin'.  The windows need not be\nthe same size, only the overlapping region is copied.  This copy is\nnon-destructive, which means that the current background character\ndoes not overwrite the old contents of 'destwin'.\n\nTo get fine-grained control over the copied region, the second form\nof *note overlay(): 2b26. can be used.  'sminrow' and 'smincol' are\nthe upper-left coordinates of the source window, and the other\nvariables mark a rectangle in the destination window.\n\n-- Method: window.overwrite (destwin[, sminrow, smincol, dminrow,\ndmincol, dmaxrow, dmaxcol])\n\nOverwrite the window on top of 'destwin'.  The windows need not be\nthe same size, in which case only the overlapping region is copied.\nThis copy is destructive, which means that the current background\ncharacter overwrites the old contents of 'destwin'.\n\nTo get fine-grained control over the copied region, the second form\nof *note overwrite(): 2b27. can be used.  'sminrow' and 'smincol'\nare the upper-left coordinates of the source window, the other\nvariables mark a rectangle in the destination window.\n\n-- Method: window.putwin (file)\n\nWrite all data associated with the window into the provided file\nobject.  This information can be later retrieved using the *note\ngetwin(): 2abf. function.\n\n-- Method: window.redrawln (beg, num)\n\nIndicate that the 'num' screen lines, starting at line 'beg', are\ncorrupted and should be completely redrawn on the next *note\nrefresh(): 2aaa. call.\n\n-- Method: window.redrawwin ()\n\nTouch the entire window, causing it to be completely redrawn on the\nnext *note refresh(): 2aaa. call.\n\n-- Method: window.refresh ([pminrow, pmincol, sminrow, smincol,\nsmaxrow, smaxcol])\n\nUpdate the display immediately (sync actual screen with previous\ndrawing/deleting methods).\n\nThe 6 optional arguments can only be specified when the window is a\npad created with *note newpad(): 2ad3.  The additional parameters\nare needed to indicate what part of the pad and screen are\ninvolved.  'pminrow' and 'pmincol' specify the upper left-hand\ncorner of the rectangle to be displayed in the pad.  'sminrow',\n'smincol', 'smaxrow', and 'smaxcol' specify the edges of the\nrectangle to be displayed on the screen.  The lower right-hand\ncorner of the rectangle to be displayed in the pad is calculated\nfrom the screen coordinates, since the rectangles must be the same\nsize.  Both rectangles must be entirely contained within their\nrespective structures.  Negative values of 'pminrow', 'pmincol',\n'sminrow', or 'smincol' are treated as if they were zero.\n\n-- Method: window.resize (nlines, ncols)\n\nReallocate storage for a curses window to adjust its dimensions to\nthe specified values.  If either dimension is larger than the\ncurrent values, the window's data is filled with blanks that have\nthe current background rendition (as set by *note bkgdset(): 2af6.)\nmerged into them.\n\n-- Method: window.scroll ([lines=1])\n\nScroll the screen or scrolling region upward by 'lines' lines.\n\n-- Method: window.scrollok (flag)\n\nControl what happens when the cursor of a window is moved off the\nedge of the window or scrolling region, either as a result of a\nnewline action on the bottom line, or typing the last character of\nthe last line.  If 'flag' is 'False', the cursor is left on the\nbottom line.  If 'flag' is 'True', the window is scrolled up one\nline.  Note that in order to get the physical scrolling effect on\nthe terminal, it is also necessary to call *note idlok(): 2b15.\n\n-- Method: window.setscrreg (top, bottom)\n\nSet the scrolling region from line 'top' to line 'bottom'.  All\nscrolling actions will take place in this region.\n\n-- Method: window.standend ()\n\nTurn off the standout attribute.  On some terminals this has the\nside effect of turning off all attributes.\n\n-- Method: window.standout ()\n\nTurn on attribute 'ASTANDOUT'.\n\n-- Method: window.subpad (beginy, beginx)\n\n-- Method: window.subpad (nlines, ncols, beginy, beginx)\n\nReturn a sub-window, whose upper-left corner is at '(beginy,\nbeginx)', and whose width/height is 'ncols'/'nlines'.\n\n-- Method: window.subwin (beginy, beginx)\n\n-- Method: window.subwin (nlines, ncols, beginy, beginx)\n\nReturn a sub-window, whose upper-left corner is at '(beginy,\nbeginx)', and whose width/height is 'ncols'/'nlines'.\n\nBy default, the sub-window will extend from the specified position\nto the lower right corner of the window.\n\n-- Method: window.syncdown ()\n\nTouch each location in the window that has been touched in any of\nits ancestor windows.  This routine is called by *note refresh():\n2aaa, so it should almost never be necessary to call it manually.\n\n-- Method: window.syncok (flag)\n\nIf 'flag' is 'True', then *note syncup(): 2b33. is called\nautomatically whenever there is a change in the window.\n\n-- Method: window.syncup ()\n\nTouch all locations in ancestors of the window that have been\nchanged in the window.\n\n-- Method: window.timeout (delay)\n\nSet blocking or non-blocking read behavior for the window.  If\n'delay' is negative, blocking read is used (which will wait\nindefinitely for input).  If 'delay' is zero, then non-blocking\nread is used, and *note getch(): 2ab3. will return '-1' if no input\nis waiting.  If 'delay' is positive, then *note getch(): 2ab3. will\nblock for 'delay' milliseconds, and return '-1' if there is still\nno input at the end of that time.\n\n-- Method: window.touchline (start, count[, changed])\n\nPretend 'count' lines have been changed, starting with line\n'start'.  If 'changed' is supplied, it specifies whether the\naffected lines are marked as having been changed ('changed''=True')\nor unchanged ('changed''=False').\n\n-- Method: window.touchwin ()\n\nPretend the whole window has been changed, for purposes of drawing\noptimizations.\n\n-- Method: window.untouchwin ()\n\nMark all lines in the window as unchanged since the last call to\n*note refresh(): 2aaa.\n\n-- Method: window.vline (ch, n[, attr])\n\n-- Method: window.vline (y, x, ch, n[, attr])\n\nDisplay a vertical line starting at '(y, x)' with length 'n'\nconsisting of the character 'ch' with attributes 'attr'.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue35924\n\nFile: python3.12.info,  Node: Constants<6>,  Prev: Window Objects,  Up: curses -- Terminal handling for character-cell displays\n\n5.16.10.3 Constants\n...................\n\nThe *note curses: 29. module defines the following data members:\n\n-- Data: curses.ERR\n\nSome curses routines that return an integer, such as *note getch():\n2ab3, return *note ERR: 2b38. upon failure.\n\n-- Data: curses.OK\n\nSome curses routines that return an integer, such as *note napms():\n2ad2, return *note OK: 2b39. upon success.\n\n-- Data: curses.version\n\n-- Data: curses.version\n\nA bytes object representing the current version of the module.\n\n-- Data: curses.ncursesversion\n\nA named tuple containing the three components of the ncurses\nlibrary version: 'major', 'minor', and 'patch'.  All values are\nintegers.  The components can also be accessed by name, so\n'curses.ncursesversion[0]' is equivalent to\n'curses.ncursesversion.major' and so on.\n\nAvailability: if the ncurses library is used.\n\nNew in version 3.8.\n\n-- Data: curses.COLORS\n\nThe maximum number of colors the terminal can support.  It is\ndefined only after the call to *note startcolor(): 2ae1.\n\n-- Data: curses.COLORPAIRS\n\nThe maximum number of color pairs the terminal can support.  It is\ndefined only after the call to *note startcolor(): 2ae1.\n\n-- Data: curses.COLS\n\nThe width of the screen, i.e., the number of columns.  It is\ndefined only after the call to *note initscr(): 2aaf.  Updated by\n*note updatelinescols(): c49, *note resizeterm(): 2ade. and *note\nresizeterm(): 2aca.\n\n-- Data: curses.LINES\n\nThe height of the screen, i.e., the number of lines.  It is defined\nonly after the call to *note initscr(): 2aaf.  Updated by *note\nupdatelinescols(): c49, *note resizeterm(): 2ade. and *note\nresizeterm(): 2aca.\n",
            "subsections": []
        },
        "Some constants are available to specify character cell attributes.  The": {
            "content": "exact constants available are system dependent.\n",
            "subsections": []
        },
        "Attribute                    Meaning": {
            "content": "-----------------------------------------------------------------\n\n-- Data:                    Alternate character set mode\ncurses.AALTCHARSET\n\n-- Data: curses.ABLINK     Blink mode\n\n\n-- Data: curses.ABOLD      Bold mode\n\n\n-- Data: curses.ADIM       Dim mode\n\n\n-- Data: curses.AINVIS     Invisible or blank mode\n\n\n-- Data: curses.AITALIC    Italic mode\n\n\n-- Data: curses.ANORMAL    Normal attribute\n\n\n-- Data: curses.APROTECT   Protected mode\n\n\n-- Data: curses.AREVERSE   Reverse background and foreground\ncolors\n\n\n-- Data:                    Standout mode\ncurses.ASTANDOUT\n\n-- Data:                    Underline mode\ncurses.AUNDERLINE\n\n-- Data:                    Horizontal highlight\ncurses.AHORIZONTAL\n\n-- Data: curses.ALEFT      Left highlight\n\n\n-- Data: curses.ALOW       Low highlight\n\n\n-- Data: curses.ARIGHT     Right highlight\n\n\n-- Data: curses.ATOP       Top highlight\n\n\n-- Data:                    Vertical highlight\ncurses.AVERTICAL\n\nNew in version 3.7: 'AITALIC' was added.\n",
            "subsections": []
        },
        "Several constants are available to extract corresponding attributes": {
            "content": "returned by some methods.\n",
            "subsections": []
        },
        "Bit-mask                      Meaning": {
            "content": "------------------------------------------------------------------\n\n-- Data:                     Bit-mask to extract attributes\ncurses.AATTRIBUTES\n\n-- Data: curses.ACHARTEXT   Bit-mask to extract a character\n\n\n-- Data: curses.ACOLOR      Bit-mask to extract color-pair\nfield information\n\n",
            "subsections": []
        },
        "Keys are referred to by integer constants with names starting with": {
            "content": "'KEY'.  The exact keycaps available are system dependent.\n",
            "subsections": []
        },
        "Key constant                  Key": {
            "content": "-------------------------------------------------------------------------------\n\n-- Data: curses.KEYMIN      Minimum key value\n\n\n-- Data: curses.KEYBREAK    Break key (unreliable)\n\n\n-- Data: curses.KEYDOWN     Down-arrow\n\n\n-- Data: curses.KEYUP       Up-arrow\n\n\n-- Data: curses.KEYLEFT     Left-arrow\n\n\n-- Data: curses.KEYRIGHT    Right-arrow\n\n\n-- Data: curses.KEYHOME     Home key (upward+left arrow)\n\n\n-- Data:                     Backspace (unreliable)\ncurses.KEYBACKSPACE\n\n-- Data: curses.KEYF0       Function keys.  Up to 64 function keys are\nsupported.\n\n\n-- Data: curses.KEYFn       Value of function key 'n'\n\n\n-- Data: curses.KEYDL       Delete line\n\n\n-- Data: curses.KEYIL       Insert line\n\n\n-- Data: curses.KEYDC       Delete character\n\n\n-- Data: curses.KEYIC       Insert char or enter insert mode\n\n\n-- Data: curses.KEYEIC      Exit insert char mode\n\n\n-- Data: curses.KEYCLEAR    Clear screen\n\n\n-- Data: curses.KEYEOS      Clear to end of screen\n\n\n-- Data: curses.KEYEOL      Clear to end of line\n\n\n-- Data: curses.KEYSF       Scroll 1 line forward\n\n\n-- Data: curses.KEYSR       Scroll 1 line backward (reverse)\n\n\n-- Data: curses.KEYNPAGE    Next page\n\n\n-- Data: curses.KEYPPAGE    Previous page\n\n\n-- Data: curses.KEYSTAB     Set tab\n\n\n-- Data: curses.KEYCTAB     Clear tab\n\n\n-- Data: curses.KEYCATAB    Clear all tabs\n\n\n-- Data: curses.KEYENTER    Enter or send (unreliable)\n\n\n-- Data: curses.KEYSRESET   Soft (partial) reset (unreliable)\n\n\n-- Data: curses.KEYRESET    Reset or hard reset (unreliable)\n\n\n-- Data: curses.KEYPRINT    Print\n\n\n-- Data: curses.KEYLL       Home down or bottom (lower left)\n\n\n-- Data: curses.KEYA1       Upper left of keypad\n\n\n-- Data: curses.KEYA3       Upper right of keypad\n\n\n-- Data: curses.KEYB2       Center of keypad\n\n\n-- Data: curses.KEYC1       Lower left of keypad\n\n\n-- Data: curses.KEYC3       Lower right of keypad\n\n\n-- Data: curses.KEYBTAB     Back tab\n\n\n-- Data: curses.KEYBEG      Beg (beginning)\n\n\n-- Data: curses.KEYCANCEL   Cancel\n\n\n-- Data: curses.KEYCLOSE    Close\n\n\n-- Data:                     Cmd (command)\ncurses.KEYCOMMAND\n\n-- Data: curses.KEYCOPY     Copy\n\n\n-- Data: curses.KEYCREATE   Create\n\n\n-- Data: curses.KEYEND      End\n\n\n-- Data: curses.KEYEXIT     Exit\n\n\n-- Data: curses.KEYFIND     Find\n\n\n-- Data: curses.KEYHELP     Help\n\n\n-- Data: curses.KEYMARK     Mark\n\n\n-- Data:                     Message\ncurses.KEYMESSAGE\n\n-- Data: curses.KEYMOVE     Move\n\n\n-- Data: curses.KEYNEXT     Next\n\n\n-- Data: curses.KEYOPEN     Open\n\n\n-- Data:                     Options\ncurses.KEYOPTIONS\n\n-- Data:                     Prev (previous)\ncurses.KEYPREVIOUS\n\n-- Data: curses.KEYREDO     Redo\n\n\n-- Data:                     Ref (reference)\ncurses.KEYREFERENCE\n\n-- Data:                     Refresh\ncurses.KEYREFRESH\n\n-- Data:                     Replace\ncurses.KEYREPLACE\n\n-- Data:                     Restart\ncurses.KEYRESTART\n\n-- Data: curses.KEYRESUME   Resume\n\n\n-- Data: curses.KEYSAVE     Save\n\n\n-- Data: curses.KEYSBEG     Shifted Beg (beginning)\n\n\n-- Data:                     Shifted Cancel\ncurses.KEYSCANCEL\n\n-- Data:                     Shifted Command\ncurses.KEYSCOMMAND\n\n-- Data: curses.KEYSCOPY    Shifted Copy\n\n\n-- Data:                     Shifted Create\ncurses.KEYSCREATE\n\n-- Data: curses.KEYSDC      Shifted Delete char\n\n\n-- Data: curses.KEYSDL      Shifted Delete line\n\n\n-- Data: curses.KEYSELECT   Select\n\n\n-- Data: curses.KEYSEND     Shifted End\n\n\n-- Data: curses.KEYSEOL     Shifted Clear line\n\n\n-- Data: curses.KEYSEXIT    Shifted Exit\n\n\n-- Data: curses.KEYSFIND    Shifted Find\n\n\n-- Data: curses.KEYSHELP    Shifted Help\n\n\n-- Data: curses.KEYSHOME    Shifted Home\n\n\n-- Data: curses.KEYSIC      Shifted Input\n\n\n-- Data: curses.KEYSLEFT    Shifted Left arrow\n\n\n-- Data:                     Shifted Message\ncurses.KEYSMESSAGE\n\n-- Data: curses.KEYSMOVE    Shifted Move\n\n\n-- Data: curses.KEYSNEXT    Shifted Next\n\n\n-- Data:                     Shifted Options\ncurses.KEYSOPTIONS\n\n-- Data:                     Shifted Prev\ncurses.KEYSPREVIOUS\n\n-- Data: curses.KEYSPRINT   Shifted Print\n\n\n-- Data: curses.KEYSREDO    Shifted Redo\n\n\n-- Data:                     Shifted Replace\ncurses.KEYSREPLACE\n\n-- Data: curses.KEYSRIGHT   Shifted Right arrow\n\n\n-- Data: curses.KEYSRSUME   Shifted Resume\n\n\n-- Data: curses.KEYSSAVE    Shifted Save\n\n\n-- Data:                     Shifted Suspend\ncurses.KEYSSUSPEND\n\n-- Data: curses.KEYSUNDO    Shifted Undo\n\n\n-- Data:                     Suspend\ncurses.KEYSUSPEND\n\n-- Data: curses.KEYUNDO     Undo\n\n\n-- Data: curses.KEYMOUSE    Mouse event has occurred\n\n\n-- Data: curses.KEYRESIZE   Terminal resize event\n\n\n-- Data: curses.KEYMAX      Maximum key value\n\n",
            "subsections": []
        },
        "On VT100s and their software emulations, such as X terminal emulators,": {
            "content": "there are normally at least four function keys (*note KEYF1: 2b56,\n*note KEYF2: 2b56, *note KEYF3: 2b56, *note KEYF4: 2b56.) available,\nand the arrow keys mapped to *note KEYUP: 2b50, *note KEYDOWN: 2b4f,\n*note KEYLEFT: 2b51. and *note KEYRIGHT: 2b52. in the obvious way.  If\nyour machine has a PC keyboard, it is safe to expect arrow keys and\ntwelve function keys (older PC keyboards may have only ten function\nkeys); also, the following keypad mappings are standard:\n",
            "subsections": []
        },
        "Keycap                 Constant": {
            "content": "---------------------------------------\n\n'Insert'               KEYIC\n\n\n'Delete'               KEYDC\n\n\n'Home'                 KEYHOME\n\n\n'End'                  KEYEND\n\n\n'Page Up'              KEYPPAGE\n\n\n'Page Down'            KEYNPAGE\n\n\nThe following table lists characters from the alternate character set.",
            "subsections": []
        },
        "These are inherited from the VT100 terminal, and will generally be": {
            "content": "available on software emulations such as X terminals.  When there is no\ngraphic available, curses falls back on a crude printable ASCII\napproximation.\n\nNote: These are available only after *note initscr(): 2aaf. has\nbeen called.\n\nACS code                     Meaning\n\n----------------------------------------------------------------------------\n\n-- Data: curses.ACSBBSS    alternate name for upper right corner\n\n\n-- Data: curses.ACSBLOCK   solid square block\n\n\n-- Data: curses.ACSBOARD   board of squares\n\n\n-- Data: curses.ACSBSBS    alternate name for horizontal line\n\n\n-- Data: curses.ACSBSSB    alternate name for upper left corner\n\n\n-- Data: curses.ACSBSSS    alternate name for top tee\n\n\n-- Data: curses.ACSBTEE    bottom tee\n\n\n-- Data:                    bullet\ncurses.ACSBULLET\n\n-- Data:                    checker board (stipple)\ncurses.ACSCKBOARD\n\n-- Data:                    arrow pointing down\ncurses.ACSDARROW\n\n-- Data:                    degree symbol\ncurses.ACSDEGREE\n\n-- Data:                    diamond\ncurses.ACSDIAMOND\n\n-- Data:                    greater-than-or-equal-to\ncurses.ACSGEQUAL\n\n-- Data: curses.ACSHLINE   horizontal line\n\n\n-- Data:                    lantern symbol\ncurses.ACSLANTERN\n\n-- Data:                    left arrow\ncurses.ACSLARROW\n\n-- Data:                    less-than-or-equal-to\ncurses.ACSLEQUAL\n\n-- Data:                    lower left-hand corner\ncurses.ACSLLCORNER\n\n-- Data:                    lower right-hand corner\ncurses.ACSLRCORNER\n\n-- Data: curses.ACSLTEE    left tee\n\n\n-- Data:                    not-equal sign\ncurses.ACSNEQUAL\n\n-- Data: curses.ACSPI      letter pi\n\n\n-- Data:                    plus-or-minus sign\ncurses.ACSPLMINUS\n\n-- Data: curses.ACSPLUS    big plus sign\n\n\n-- Data:                    right arrow\ncurses.ACSRARROW\n\n-- Data: curses.ACSRTEE    right tee\n\n\n-- Data: curses.ACSS1      scan line 1\n\n\n-- Data: curses.ACSS3      scan line 3\n\n\n-- Data: curses.ACSS7      scan line 7\n\n\n-- Data: curses.ACSS9      scan line 9\n\n\n-- Data: curses.ACSSBBS    alternate name for lower right corner\n\n\n-- Data: curses.ACSSBSB    alternate name for vertical line\n\n\n-- Data: curses.ACSSBSS    alternate name for right tee\n\n\n-- Data: curses.ACSSSBB    alternate name for lower left corner\n\n\n-- Data: curses.ACSSSBS    alternate name for bottom tee\n\n\n-- Data: curses.ACSSSSB    alternate name for left tee\n\n\n-- Data: curses.ACSSSSS    alternate name for crossover or big plus\n\n\n-- Data:                    pound sterling\ncurses.ACSSTERLING\n\n-- Data: curses.ACSTTEE    top tee\n\n\n-- Data:                    up arrow\ncurses.ACSUARROW\n\n-- Data:                    upper left corner\ncurses.ACSULCORNER\n\n-- Data:                    upper right corner\ncurses.ACSURCORNER\n\n-- Data: curses.ACSVLINE   vertical line\n\n\nThe following table lists mouse button constants used by *note\ngetmouse(): 2ab2.:\n",
            "subsections": []
        },
        "Mouse button constant                  Meaning": {
            "content": "-----------------------------------------------------------------------------------------\n\n-- Data: curses.BUTTONnPRESSED       Mouse button 'n' pressed\n\n\n-- Data: curses.BUTTONnRELEASED      Mouse button 'n' released\n\n\n-- Data: curses.BUTTONnCLICKED       Mouse button 'n' clicked\n\n\n-- Data:                              Mouse button 'n' double clicked\ncurses.BUTTONnDOUBLECLICKED\n\n-- Data:                              Mouse button 'n' triple clicked\ncurses.BUTTONnTRIPLECLICKED\n\n-- Data: curses.BUTTONSHIFT          Shift was down during button state change\n\n\n-- Data: curses.BUTTONCTRL           Control was down during button state change\n\n\n-- Data: curses.BUTTONALT            Control was down during button state change\n\n\nChanged in version 3.10: The 'BUTTON5*' constants are now exposed if\nthey are provided by the underlying curses library.\n\nThe following table lists the predefined colors:\n",
            "subsections": []
        },
        "Constant                      Color": {
            "content": "---------------------------------------------------------------\n\n-- Data:                     Black\ncurses.COLORBLACK\n\n-- Data: curses.COLORBLUE   Blue\n\n\n-- Data: curses.COLORCYAN   Cyan (light greenish blue)\n\n\n-- Data:                     Green\ncurses.COLORGREEN\n\n-- Data:                     Magenta (purplish red)\ncurses.COLORMAGENTA\n\n-- Data: curses.COLORRED    Red\n\n\n-- Data:                     White\ncurses.COLORWHITE\n\n-- Data:                     Yellow\ncurses.COLORYELLOW\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: curses textpad -- Text input widget for curses programs,  Next: curses ascii -- Utilities for ASCII characters,  Prev: curses -- Terminal handling for character-cell displays,  Up: Generic Operating System Services": {
            "content": "The *note curses.textpad: 2c. module provides a *note Textbox: 2bd9.\nclass that handles elementary text editing in a curses window,\nsupporting a set of keybindings resembling those of Emacs (thus, also of\nNetscape Navigator, BBedit 6.x, FrameMaker, and many other programs).",
            "subsections": []
        },
        "The module also provides a rectangle-drawing function useful for framing": {
            "content": "text boxes or for other purposes.\n\nThe module *note curses.textpad: 2c. defines the following function:\n\n-- Function: curses.textpad.rectangle (win, uly, ulx, lry, lrx)\n\nDraw a rectangle.  The first argument must be a window object; the\nremaining arguments are coordinates relative to that window.  The\nsecond and third arguments are the y and x coordinates of the upper\nleft hand corner of the rectangle to be drawn; the fourth and fifth\narguments are the y and x coordinates of the lower right hand\ncorner.  The rectangle will be drawn using VT100/IBM PC forms\ncharacters on terminals that make this possible (including xterm\nand most other software terminal emulators).  Otherwise it will be\ndrawn with ASCII dashes, vertical bars, and plus signs.\n\n* Menu:\n\n* Textbox objects::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Textbox objects,  Up: curses textpad -- Text input widget for curses programs": {
            "content": "5.16.11.1 Textbox objects\n.........................\n\nYou can instantiate a *note Textbox: 2bd9. object as follows:\n\n-- Class: curses.textpad.Textbox (win)\n\nReturn a textbox widget object.  The 'win' argument should be a\ncurses *note window: 2ac8. object in which the textbox is to be\ncontained.  The edit cursor of the textbox is initially located at\nthe upper left hand corner of the containing window, with\ncoordinates '(0, 0)'.  The instance's *note stripspaces: 2bdd. flag\nis initially on.\n\n*note Textbox: 2bd9. objects have the following methods:\n\n-- Method: edit ([validator])\n\nThis is the entry point you will normally use.  It accepts\nediting keystrokes until one of the termination keystrokes is\nentered.  If 'validator' is supplied, it must be a function.\nIt will be called for each keystroke entered with the\nkeystroke as a parameter; command dispatch is done on the\nresult.  This method returns the window contents as a string;\nwhether blanks in the window are included is affected by the\n*note stripspaces: 2bdd. attribute.\n\n-- Method: docommand (ch)\n\nProcess a single command keystroke.  Here are the supported\nspecial keystrokes:\n\nKeystroke              Action\n\n-----------------------------------------------------------------------\n\n'Control-A'            Go to left edge of window.\n\n\n'Control-B'            Cursor left, wrapping to previous line if\nappropriate.\n\n\n'Control-D'            Delete character under cursor.\n\n\n'Control-E'            Go to right edge (stripspaces off) or end of\nline (stripspaces on).\n\n\n'Control-F'            Cursor right, wrapping to next line when\nappropriate.\n\n\n'Control-G'            Terminate, returning the window contents.\n\n\n'Control-H'            Delete character backward.\n\n\n'Control-J'            Terminate if the window is 1 line, otherwise\ninsert newline.\n\n\n'Control-K'            If line is blank, delete it, otherwise clear\nto end of line.\n\n\n'Control-L'            Refresh screen.\n\n\n'Control-N'            Cursor down; move down one line.\n\n\n'Control-O'            Insert a blank line at cursor location.\n\n\n'Control-P'            Cursor up; move up one line.\n\n\nMove operations do nothing if the cursor is at an edge where\nthe movement is not possible.  The following synonyms are\nsupported where possible:\n\nConstant                             Keystroke\n\n------------------------------------------------------------\n\n*note KEYLEFT: 2b51.                'Control-B'\n\n\n*note KEYRIGHT: 2b52.               'Control-F'\n\n\n*note KEYUP: 2b50.                  'Control-P'\n\n\n*note KEYDOWN: 2b4f.                'Control-N'\n\n\n*note KEYBACKSPACE: 2b54.           'Control-h'\n\n\nAll other keystrokes are treated as a command to insert the\ngiven character and move right (with line wrapping).\n\n-- Method: gather ()\n\nReturn the window contents as a string; whether blanks in the\nwindow are included is affected by the *note stripspaces:\n2bdd. member.\n\n-- Attribute: stripspaces\n\nThis attribute is a flag which controls the interpretation of\nblanks in the window.  When it is on, trailing blanks on each\nline are ignored; any cursor motion that would land the cursor\non a trailing blank goes to the end of that line instead, and\ntrailing blanks are stripped when the window contents are\ngathered.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: curses ascii -- Utilities for ASCII characters,  Next: curses panel -- A panel stack extension for curses,  Prev: curses textpad -- Text input widget for curses programs,  Up: Generic Operating System Services": {
            "content": "'Source code:' Lib/curses/ascii.py(1)\n\n\n\nThe *note curses.ascii: 2a. module supplies name constants for ASCII\ncharacters and functions to test membership in various ASCII character\nclasses.  The constants supplied are names for control characters as\nfollows:\n",
            "subsections": []
        },
        "Name                Meaning": {
            "content": "-----------------------------------------------------------------------\n\n-- Data:\ncurses.ascii.NUL\n\n-- Data:           Start of heading, console interrupt\ncurses.ascii.SOH\n\n-- Data:           Start of text\ncurses.ascii.STX\n\n-- Data:           End of text\ncurses.ascii.ETX\n\n-- Data:           End of transmission\ncurses.ascii.EOT\n\n-- Data:           Enquiry, goes with *note ACK: 2be9. flow control\ncurses.ascii.ENQ\n\n-- Data:           Acknowledgement\ncurses.ascii.ACK\n\n-- Data:           Bell\ncurses.ascii.BEL\n\n-- Data:           Backspace\ncurses.ascii.BS\n\n-- Data:           Tab\ncurses.ascii.TAB\n\n-- Data:           Alias for *note TAB: 2bec.: \"Horizontal tab\"\ncurses.ascii.HT\n\n-- Data:           Line feed\ncurses.ascii.LF\n\n-- Data:           Alias for *note LF: 2bee.: \"New line\"\ncurses.ascii.NL\n\n-- Data:           Vertical tab\ncurses.ascii.VT\n\n-- Data:           Form feed\ncurses.ascii.FF\n\n-- Data:           Carriage return\ncurses.ascii.CR\n\n-- Data:           Shift-out, begin alternate character set\ncurses.ascii.SO\n\n-- Data:           Shift-in, resume default character set\ncurses.ascii.SI\n\n-- Data:           Data-link escape\ncurses.ascii.DLE\n\n-- Data:           XON, for flow control\ncurses.ascii.DC1\n\n-- Data:           Device control 2, block-mode flow control\ncurses.ascii.DC2\n\n-- Data:           XOFF, for flow control\ncurses.ascii.DC3\n\n-- Data:           Device control 4\ncurses.ascii.DC4\n\n-- Data:           Negative acknowledgement\ncurses.ascii.NAK\n\n-- Data:           Synchronous idle\ncurses.ascii.SYN\n\n-- Data:           End transmission block\ncurses.ascii.ETB\n\n-- Data:           Cancel\ncurses.ascii.CAN\n\n-- Data:           End of medium\ncurses.ascii.EM\n\n-- Data:           Substitute\ncurses.ascii.SUB\n\n-- Data:           Escape\ncurses.ascii.ESC\n\n-- Data:           File separator\ncurses.ascii.FS\n\n-- Data:           Group separator\ncurses.ascii.GS\n\n-- Data:           Record separator, block-mode terminator\ncurses.ascii.RS\n\n-- Data:           Unit separator\ncurses.ascii.US\n\n-- Data:           Space\ncurses.ascii.SP\n\n-- Data:           Delete\ncurses.ascii.DEL\n",
            "subsections": []
        },
        "Note that many of these have little practical significance in modern": {
            "content": "usage.  The mnemonics derive from teleprinter conventions that predate\ndigital computers.\n",
            "subsections": []
        },
        "The module supplies the following functions, patterned on those in the": {
            "content": "standard C library:\n\n-- Function: curses.ascii.isalnum (c)\n\nChecks for an ASCII alphanumeric character; it is equivalent to\n'isalpha(c) or isdigit(c)'.\n\n-- Function: curses.ascii.isalpha (c)\n\nChecks for an ASCII alphabetic character; it is equivalent to\n'isupper(c) or islower(c)'.\n\n-- Function: curses.ascii.isascii (c)\n\nChecks for a character value that fits in the 7-bit ASCII set.\n\n-- Function: curses.ascii.isblank (c)\n\nChecks for an ASCII whitespace character; space or horizontal tab.\n\n-- Function: curses.ascii.iscntrl (c)\n\nChecks for an ASCII control character (in the range 0x00 to 0x1f or\n0x7f).\n\n-- Function: curses.ascii.isdigit (c)\n\nChecks for an ASCII decimal digit, ''0'' through ''9''.  This is\nequivalent to 'c in string.digits'.\n\n-- Function: curses.ascii.isgraph (c)\n\nChecks for ASCII any printable character except space.\n\n-- Function: curses.ascii.islower (c)\n\nChecks for an ASCII lower-case character.\n\n-- Function: curses.ascii.isprint (c)\n\nChecks for any ASCII printable character including space.\n\n-- Function: curses.ascii.ispunct (c)\n\nChecks for any printable ASCII character which is not a space or an\nalphanumeric character.\n\n-- Function: curses.ascii.isspace (c)\n\nChecks for ASCII white-space characters; space, line feed, carriage\nreturn, form feed, horizontal tab, vertical tab.\n\n-- Function: curses.ascii.isupper (c)\n\nChecks for an ASCII uppercase letter.\n\n-- Function: curses.ascii.isxdigit (c)\n\nChecks for an ASCII hexadecimal digit.  This is equivalent to 'c in\nstring.hexdigits'.\n\n-- Function: curses.ascii.isctrl (c)\n\nChecks for an ASCII control character (ordinal values 0 to 31).\n\n-- Function: curses.ascii.ismeta (c)\n\nChecks for a non-ASCII character (ordinal values 0x80 and above).\n",
            "subsections": []
        },
        "These functions accept either integers or single-character strings; when": {
            "content": "the argument is a string, it is first converted using the built-in\nfunction *note ord(): 1c10.\n",
            "subsections": []
        },
        "Note that all these functions check ordinal bit values derived from the": {
            "content": "character of the string you pass in; they do not actually know anything\nabout the host machine's character encoding.\n",
            "subsections": []
        },
        "The following two functions take either a single-character string or": {
            "content": "integer byte value; they return a value of the same type.\n\n-- Function: curses.ascii.ascii (c)\n\nReturn the ASCII value corresponding to the low 7 bits of 'c'.\n\n-- Function: curses.ascii.ctrl (c)\n\nReturn the control character corresponding to the given character\n(the character bit value is bitwise-anded with 0x1f).\n\n-- Function: curses.ascii.alt (c)\n\nReturn the 8-bit character corresponding to the given ASCII\ncharacter (the character bit value is bitwise-ored with 0x80).\n",
            "subsections": []
        },
        "The following function takes either a single-character string or integer": {
            "content": "value; it returns a string.\n\n-- Function: curses.ascii.unctrl (c)\n\nReturn a string representation of the ASCII character 'c'.  If 'c'\nis printable, this string is the character itself.  If the\ncharacter is a control character (0x00-0x1f) the string consists of\na caret (''^'') followed by the corresponding uppercase letter.  If\nthe character is an ASCII delete (0x7f) the string is ''^?''.  If\nthe character has its meta bit (0x80) set, the meta bit is\nstripped, the preceding rules applied, and ''!'' prepended to the\nresult.\n\n-- Data: curses.ascii.controlnames\n\nA 33-element string array that contains the ASCII mnemonics for the\nthirty-two ASCII control characters from 0 (NUL) to 0x1f (US), in\norder, plus the mnemonic 'SP' for the space character.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/curses/ascii.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: curses panel -- A panel stack extension for curses,  Next: platform -- Access to underlying platform's identifying data,  Prev: curses ascii -- Utilities for ASCII characters,  Up: Generic Operating System Services": {
            "content": "",
            "subsections": []
        },
        "Panels are windows with the added feature of depth, so they can be": {
            "content": "stacked on top of each other, and only the visible portions of each\nwindow will be displayed.  Panels can be added, moved up or down in the\nstack, and removed.\n\n* Menu:\n\n* Functions: Functions<7>.\n* Panel Objects::\n\nFile: python3.12.info,  Node: Functions<7>,  Next: Panel Objects,  Up: curses panel -- A panel stack extension for curses\n\n5.16.13.1 Functions\n...................\n\nThe module *note curses.panel: 2b. defines the following functions:\n\n-- Function: curses.panel.bottompanel ()\n\nReturns the bottom panel in the panel stack.\n\n-- Function: curses.panel.newpanel (win)\n\nReturns a panel object, associating it with the given window 'win'.\nBe aware that you need to keep the returned panel object referenced\nexplicitly.  If you don't, the panel object is garbage collected\nand removed from the panel stack.\n\n-- Function: curses.panel.toppanel ()\n\nReturns the top panel in the panel stack.\n\n-- Function: curses.panel.updatepanels ()\n\nUpdates the virtual screen after changes in the panel stack.  This\ndoes not call *note curses.doupdate(): 2aa7, so you'll have to do\nthis yourself.\n\nFile: python3.12.info,  Node: Panel Objects,  Prev: Functions<7>,  Up: curses panel -- A panel stack extension for curses\n\n5.16.13.2 Panel Objects\n.......................\n\nPanel objects, as returned by *note newpanel(): 2c20. above, are\nwindows with a stacking order.  There's always a window associated with\na panel which determines the content, while the panel methods are\nresponsible for the window's depth in the panel stack.\n\nPanel objects have the following methods:\n\n-- Method: Panel.above ()\n\nReturns the panel above the current panel.\n\n-- Method: Panel.below ()\n\nReturns the panel below the current panel.\n\n-- Method: Panel.bottom ()\n\nPush the panel to the bottom of the stack.\n\n-- Method: Panel.hidden ()\n\nReturns 'True' if the panel is hidden (not visible), 'False'\notherwise.\n\n-- Method: Panel.hide ()\n\nHide the panel.  This does not delete the object, it just makes the\nwindow on screen invisible.\n\n-- Method: Panel.move (y, x)\n\nMove the panel to the screen coordinates '(y, x)'.\n\n-- Method: Panel.replace (win)\n\nChange the window associated with the panel to the window 'win'.\n\n-- Method: Panel.setuserptr (obj)\n\nSet the panel's user pointer to 'obj'.  This is used to associate\nan arbitrary piece of data with the panel, and can be any Python\nobject.\n\n-- Method: Panel.show ()\n\nDisplay the panel (which might have been hidden).\n\n-- Method: Panel.top ()\n\nPush panel to the top of the stack.\n\n-- Method: Panel.userptr ()\n\nReturns the user pointer for the panel.  This might be any Python\nobject.\n\n-- Method: Panel.window ()\n\nReturns the window object associated with the panel.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: platform -- Access to underlying platform's identifying data,  Next: errno -- Standard errno system symbols,  Prev: curses panel -- A panel stack extension for curses,  Up: Generic Operating System Services": {
            "content": "'Source code:' Lib/platform.py(1)\n\n\n\nNote: Specific platforms listed alphabetically, with Linux included\nin the Unix section.\n\n* Menu:\n\n* Cross Platform::\n* Java Platform::\n* Windows Platform::\n* macOS Platform::\n* Unix Platforms::\n* Linux Platforms::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/platform.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Cross Platform,  Next: Java Platform,  Up: platform -- Access to underlying platform's identifying data": {
            "content": "5.16.14.1 Cross Platform\n........................\n\n-- Function: platform.architecture (executable=sys.executable, bits='',\nlinkage='')\n\nQueries the given executable (defaults to the Python interpreter\nbinary) for various architecture information.\n\nReturns a tuple '(bits, linkage)' which contain information about\nthe bit architecture and the linkage format used for the\nexecutable.  Both values are returned as strings.\n\nValues that cannot be determined are returned as given by the\nparameter presets.  If bits is given as '''', the 'sizeof(pointer)'\n(or 'sizeof(long)' on Python version < 1.5.2) is used as indicator\nfor the supported pointer size.\n\nThe function relies on the system's 'file' command to do the actual\nwork.  This is available on most if not all Unix platforms and some\nnon-Unix platforms and then only if the executable points to the\nPython interpreter.  Reasonable defaults are used when the above\nneeds are not met.\n\nNote: On macOS (and perhaps other platforms), executable files\nmay be universal files containing multiple architectures.\n\nTo get at the \"64-bitness\" of the current interpreter, it is\nmore reliable to query the *note sys.maxsize: 1039. attribute:\n\nis64bits = sys.maxsize > 232\n\n-- Function: platform.machine ()\n\nReturns the machine type, e.g.  ''AMD64''.  An empty string is\nreturned if the value cannot be determined.\n\n-- Function: platform.node ()\n\nReturns the computer's network name (may not be fully qualified!).\nAn empty string is returned if the value cannot be determined.\n\n-- Function: platform.platform (aliased=False, terse=False)\n\nReturns a single string identifying the underlying platform with as\nmuch useful information as possible.\n\nThe output is intended to be 'human readable' rather than machine\nparseable.  It may look different on different platforms and this\nis intended.\n\nIf 'aliased' is true, the function will use aliases for various\nplatforms that report system names which differ from their common\nnames, for example SunOS will be reported as Solaris.  The *note\nsystemalias(): 2c36. function is used to implement this.\n\nSetting 'terse' to true causes the function to return only the\nabsolute minimum information needed to identify the platform.\n\nChanged in version 3.8: On macOS, the function now uses *note\nmacver(): 17ae, if it returns a non-empty release string, to get\nthe macOS version rather than the darwin version.\n\n-- Function: platform.processor ()\n\nReturns the (real) processor name, e.g.  ''amdk6''.\n\nAn empty string is returned if the value cannot be determined.\nNote that many platforms do not provide this information or simply\nreturn the same value as for *note machine(): 2c34.  NetBSD does\nthis.\n\n-- Function: platform.pythonbuild ()\n\nReturns a tuple '(buildno, builddate)' stating the Python build\nnumber and date as strings.\n\n-- Function: platform.pythoncompiler ()\n\nReturns a string identifying the compiler used for compiling\nPython.\n\n-- Function: platform.pythonbranch ()\n\nReturns a string identifying the Python implementation SCM branch.\n\n-- Function: platform.pythonimplementation ()\n\nReturns a string identifying the Python implementation.  Possible\nreturn values are: 'CPython', 'IronPython', 'Jython', 'PyPy'.\n\n-- Function: platform.pythonrevision ()\n\nReturns a string identifying the Python implementation SCM\nrevision.\n\n-- Function: platform.pythonversion ()\n\nReturns the Python version as string ''major.minor.patchlevel''.\n\nNote that unlike the Python 'sys.version', the returned value will\nalways include the patchlevel (it defaults to 0).\n\n-- Function: platform.pythonversiontuple ()\n\nReturns the Python version as tuple '(major, minor, patchlevel)' of\nstrings.\n\nNote that unlike the Python 'sys.version', the returned value will\nalways include the patchlevel (it defaults to ''0'').\n\n-- Function: platform.release ()\n\nReturns the system's release, e.g.  ''2.2.0'' or ''NT''.  An empty\nstring is returned if the value cannot be determined.\n\n-- Function: platform.system ()\n\nReturns the system/OS name, such as ''Linux'', ''Darwin'',\n''Java'', ''Windows''.  An empty string is returned if the value\ncannot be determined.\n\n-- Function: platform.systemalias (system, release, version)\n\nReturns '(system, release, version)' aliased to common marketing\nnames used for some systems.  It also does some reordering of the\ninformation in some cases where it would otherwise cause confusion.\n\n-- Function: platform.version ()\n\nReturns the system's release version, e.g.  ''#3 on degas''.  An\nempty string is returned if the value cannot be determined.\n\n-- Function: platform.uname ()\n\nFairly portable uname interface.  Returns a *note namedtuple():\n711. containing six attributes: *note system: 2c40, *note node:\n2c35, *note release: 2c3f, *note version: 2c41, *note machine:\n2c34, and *note processor: 2c37.\n\n*note processor: 2c37. is resolved late, on demand.\n\nNote: the first two attribute names differ from the names presented\nby *note os.uname(): f86, where they are named 'sysname' and\n'nodename'.\n\nEntries which cannot be determined are set to ''''.\n\nChanged in version 3.3: Result changed from a tuple to a *note\nnamedtuple(): 711.\n\nChanged in version 3.9: *note processor: 2c37. is resolved late\ninstead of immediately.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Java Platform,  Next: Windows Platform,  Prev: Cross Platform,  Up: platform -- Access to underlying platform's identifying data": {
            "content": "5.16.14.2 Java Platform\n.......................\n\n-- Function: platform.javaver (release='', vendor='', vminfo=('', '',\n''), osinfo=('', '', ''))\n\nVersion interface for Jython.\n\nReturns a tuple '(release, vendor, vminfo, osinfo)' with 'vminfo'\nbeing a tuple '(vmname, vmrelease, vmvendor)' and 'osinfo' being\na tuple '(osname, osversion, osarch)'.  Values which cannot be\ndetermined are set to the defaults given as parameters (which all\ndefault to '''').\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Windows Platform,  Next: macOS Platform,  Prev: Java Platform,  Up: platform -- Access to underlying platform's identifying data": {
            "content": "5.16.14.3 Windows Platform\n..........................\n\n-- Function: platform.win32ver (release='', version='', csd='',\nptype='')\n\nGet additional version information from the Windows Registry and\nreturn a tuple '(release, version, csd, ptype)' referring to OS\nrelease, version number, CSD level (service pack) and OS type\n(multi/single processor).  Values which cannot be determined are\nset to the defaults given as parameters (which all default to an\nempty string).\n\nAs a hint: 'ptype' is ''Uniprocessor Free'' on single processor NT\nmachines and ''Multiprocessor Free'' on multi processor machines.\nThe ''Free'' refers to the OS version being free of debugging code.\nIt could also state ''Checked'' which means the OS version uses\ndebugging code, i.e.  code that checks arguments, ranges, etc.\n\n-- Function: platform.win32edition ()\n\nReturns a string representing the current Windows edition, or\n'None' if the value cannot be determined.  Possible values include\nbut are not limited to ''Enterprise'', ''IoTUAP'',\n''ServerStandard'', and ''nanoserver''.\n\nNew in version 3.8.\n\n-- Function: platform.win32isiot ()\n\nReturn 'True' if the Windows edition returned by *note\nwin32edition(): 2c45. is recognized as an IoT edition.\n\nNew in version 3.8.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: macOS Platform,  Next: Unix Platforms,  Prev: Windows Platform,  Up: platform -- Access to underlying platform's identifying data": {
            "content": "5.16.14.4 macOS Platform\n........................\n\n-- Function: platform.macver (release='', versioninfo=('', '', ''),\nmachine='')\n\nGet macOS version information and return it as tuple '(release,\nversioninfo, machine)' with 'versioninfo' being a tuple '(version,\ndevstage, nonreleaseversion)'.\n\nEntries which cannot be determined are set to ''''.  All tuple\nentries are strings.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Unix Platforms,  Next: Linux Platforms,  Prev: macOS Platform,  Up: platform -- Access to underlying platform's identifying data": {
            "content": "5.16.14.5 Unix Platforms\n........................\n\n-- Function: platform.libcver (executable=sys.executable, lib='',\nversion='', chunksize=16384)\n\nTries to determine the libc version against which the file\nexecutable (defaults to the Python interpreter) is linked.  Returns\na tuple of strings '(lib, version)' which default to the given\nparameters in case the lookup fails.\n\nNote that this function has intimate knowledge of how different\nlibc versions add symbols to the executable is probably only usable\nfor executables compiled using 'gcc'.\n\nThe file is read and scanned in chunks of 'chunksize' bytes.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Linux Platforms,  Prev: Unix Platforms,  Up: platform -- Access to underlying platform's identifying data": {
            "content": "5.16.14.6 Linux Platforms\n.........................\n\n-- Function: platform.freedesktoposrelease ()\n\nGet operating system identification from 'os-release' file and\nreturn it as a dict.  The 'os-release' file is a freedesktop.org\nstandard(1) and is available in most Linux distributions.  A\nnoticeable exception is Android and Android-based distributions.\n\nRaises *note OSError: 613. or subclass when neither\n'/etc/os-release' nor '/usr/lib/os-release' can be read.\n\nOn success, the function returns a dictionary where keys and values\nare strings.  Values have their special characters like '\"' and '$'\nunquoted.  The fields 'NAME', 'ID', and 'PRETTYNAME' are always\ndefined according to the standard.  All other fields are optional.\nVendors may include additional fields.\n\nNote that fields like 'NAME', 'VERSION', and 'VARIANT' are strings\nsuitable for presentation to users.  Programs should use fields\nlike 'ID', 'IDLIKE', 'VERSIONID', or 'VARIANTID' to identify\nLinux distributions.\n\nExample:\n\ndef getlikedistro():\ninfo = platform.freedesktoposrelease()\nids = [info[\"ID\"]]\nif \"IDLIKE\" in info:\n# ids are space separated and ordered by precedence\nids.extend(info[\"IDLIKE\"].split())\nreturn ids\n\nNew in version 3.10.\n\n---------- Footnotes ----------\n\n(1) https://www.freedesktop.org/software/systemd/man/os-release.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: errno -- Standard errno system symbols,  Next: ctypes -- A foreign function library for Python,  Prev: platform -- Access to underlying platform's identifying data,  Up: Generic Operating System Services": {
            "content": "",
            "subsections": []
        },
        "This module makes available standard 'errno' system symbols.  The value": {
            "content": "of each symbol is the corresponding integer value.  The names and\ndescriptions are borrowed from 'linux/include/errno.h', which should be\nall-inclusive.\n\n-- Data: errno.errorcode\n\nDictionary providing a mapping from the errno value to the string\nname in the underlying system.  For instance,\n'errno.errorcode[errno.EPERM]' maps to ''EPERM''.\n\nTo translate a numeric error code to an error message, use *note\nos.strerror(): 281d.\n",
            "subsections": []
        },
        "Of the following list, symbols that are not used on the current platform": {
            "content": "are not defined by the module.  The specific list of defined symbols is\navailable as 'errno.errorcode.keys()'.  Symbols available can include:\n\n-- Data: errno.EPERM\n\nOperation not permitted.  This error is mapped to the exception\n*note PermissionError: b9a.\n\n-- Data: errno.ENOENT\n\nNo such file or directory.  This error is mapped to the exception\n*note FileNotFoundError: 353.\n\n-- Data: errno.ESRCH\n\nNo such process.  This error is mapped to the exception *note\nProcessLookupError: ed4.\n\n-- Data: errno.EINTR\n\nInterrupted system call.  This error is mapped to the exception\n*note InterruptedError: be3.\n\n-- Data: errno.EIO\n\nI/O error\n\n-- Data: errno.ENXIO\n\nNo such device or address\n\n-- Data: errno.E2BIG\n\nArg list too long\n\n-- Data: errno.ENOEXEC\n\nExec format error\n\n-- Data: errno.EBADF\n\nBad file number\n\n-- Data: errno.ECHILD\n\nNo child processes.  This error is mapped to the exception *note\nChildProcessError: ed1.\n\n-- Data: errno.EAGAIN\n\nTry again.  This error is mapped to the exception *note\nBlockingIOError: ed0.\n\n-- Data: errno.ENOMEM\n\nOut of memory\n\n-- Data: errno.EACCES\n\nPermission denied.  This error is mapped to the exception *note\nPermissionError: b9a.\n\n-- Data: errno.EFAULT\n\nBad address\n\n-- Data: errno.ENOTBLK\n\nBlock device required\n\n-- Data: errno.EBUSY\n\nDevice or resource busy\n\n-- Data: errno.EEXIST\n\nFile exists.  This error is mapped to the exception *note\nFileExistsError: e97.\n\n-- Data: errno.EXDEV\n\nCross-device link\n\n-- Data: errno.ENODEV\n\nNo such device\n\n-- Data: errno.ENOTDIR\n\nNot a directory.  This error is mapped to the exception *note\nNotADirectoryError: ed3.\n\n-- Data: errno.EISDIR\n\nIs a directory.  This error is mapped to the exception *note\nIsADirectoryError: ed2.\n\n-- Data: errno.EINVAL\n\nInvalid argument\n\n-- Data: errno.ENFILE\n\nFile table overflow\n\n-- Data: errno.EMFILE\n\nToo many open files\n\n-- Data: errno.ENOTTY\n\nNot a typewriter\n\n-- Data: errno.ETXTBSY\n\nText file busy\n\n-- Data: errno.EFBIG\n\nFile too large\n\n-- Data: errno.ENOSPC\n\nNo space left on device\n\n-- Data: errno.ESPIPE\n\nIllegal seek\n\n-- Data: errno.EROFS\n\nRead-only file system\n\n-- Data: errno.EMLINK\n\nToo many links\n\n-- Data: errno.EPIPE\n\nBroken pipe.  This error is mapped to the exception *note\nBrokenPipeError: ed5.\n\n-- Data: errno.EDOM\n\nMath argument out of domain of func\n\n-- Data: errno.ERANGE\n\nMath result not representable\n\n-- Data: errno.EDEADLK\n\nResource deadlock would occur\n\n-- Data: errno.ENAMETOOLONG\n\nFile name too long\n\n-- Data: errno.ENOLCK\n\nNo record locks available\n\n-- Data: errno.ENOSYS\n\nFunction not implemented\n\n-- Data: errno.ENOTEMPTY\n\nDirectory not empty\n\n-- Data: errno.ELOOP\n\nToo many symbolic links encountered\n\n-- Data: errno.EWOULDBLOCK\n\nOperation would block.  This error is mapped to the exception *note\nBlockingIOError: ed0.\n\n-- Data: errno.ENOMSG\n\nNo message of desired type\n\n-- Data: errno.EIDRM\n\nIdentifier removed\n\n-- Data: errno.ECHRNG\n\nChannel number out of range\n\n-- Data: errno.EL2NSYNC\n\nLevel 2 not synchronized\n\n-- Data: errno.EL3HLT\n\nLevel 3 halted\n\n-- Data: errno.EL3RST\n\nLevel 3 reset\n\n-- Data: errno.ELNRNG\n\nLink number out of range\n\n-- Data: errno.EUNATCH\n\nProtocol driver not attached\n\n-- Data: errno.ENOCSI\n\nNo CSI structure available\n\n-- Data: errno.EL2HLT\n\nLevel 2 halted\n\n-- Data: errno.EBADE\n\nInvalid exchange\n\n-- Data: errno.EBADR\n\nInvalid request descriptor\n\n-- Data: errno.EXFULL\n\nExchange full\n\n-- Data: errno.ENOANO\n\nNo anode\n\n-- Data: errno.EBADRQC\n\nInvalid request code\n\n-- Data: errno.EBADSLT\n\nInvalid slot\n\n-- Data: errno.EDEADLOCK\n\nFile locking deadlock error\n\n-- Data: errno.EBFONT\n\nBad font file format\n\n-- Data: errno.ENOSTR\n\nDevice not a stream\n\n-- Data: errno.ENODATA\n\nNo data available\n\n-- Data: errno.ETIME\n\nTimer expired\n\n-- Data: errno.ENOSR\n\nOut of streams resources\n\n-- Data: errno.ENONET\n\nMachine is not on the network\n\n-- Data: errno.ENOPKG\n\nPackage not installed\n\n-- Data: errno.EREMOTE\n\nObject is remote\n\n-- Data: errno.ENOLINK\n\nLink has been severed\n\n-- Data: errno.EADV\n\nAdvertise error\n\n-- Data: errno.ESRMNT\n\nSrmount error\n\n-- Data: errno.ECOMM\n\nCommunication error on send\n\n-- Data: errno.EPROTO\n\nProtocol error\n\n-- Data: errno.EMULTIHOP\n\nMultihop attempted\n\n-- Data: errno.EDOTDOT\n\nRFS specific error\n\n-- Data: errno.EBADMSG\n\nNot a data message\n\n-- Data: errno.EOVERFLOW\n\nValue too large for defined data type\n\n-- Data: errno.ENOTUNIQ\n\nName not unique on network\n\n-- Data: errno.EBADFD\n\nFile descriptor in bad state\n\n-- Data: errno.EREMCHG\n\nRemote address changed\n\n-- Data: errno.ELIBACC\n\nCan not access a needed shared library\n\n-- Data: errno.ELIBBAD\n\nAccessing a corrupted shared library\n\n-- Data: errno.ELIBSCN\n\n.lib section in a.out corrupted\n\n-- Data: errno.ELIBMAX\n\nAttempting to link in too many shared libraries\n\n-- Data: errno.ELIBEXEC\n\nCannot exec a shared library directly\n\n-- Data: errno.EILSEQ\n\nIllegal byte sequence\n\n-- Data: errno.ERESTART\n\nInterrupted system call should be restarted\n\n-- Data: errno.ESTRPIPE\n\nStreams pipe error\n\n-- Data: errno.EUSERS\n\nToo many users\n\n-- Data: errno.ENOTSOCK\n\nSocket operation on non-socket\n\n-- Data: errno.EDESTADDRREQ\n\nDestination address required\n\n-- Data: errno.EMSGSIZE\n\nMessage too long\n\n-- Data: errno.EPROTOTYPE\n\nProtocol wrong type for socket\n\n-- Data: errno.ENOPROTOOPT\n\nProtocol not available\n\n-- Data: errno.EPROTONOSUPPORT\n\nProtocol not supported\n\n-- Data: errno.ESOCKTNOSUPPORT\n\nSocket type not supported\n\n-- Data: errno.EOPNOTSUPP\n\nOperation not supported on transport endpoint\n\n-- Data: errno.ENOTSUP\n\nOperation not supported\n\nNew in version 3.2.\n\n-- Data: errno.EPFNOSUPPORT\n\nProtocol family not supported\n\n-- Data: errno.EAFNOSUPPORT\n\nAddress family not supported by protocol\n\n-- Data: errno.EADDRINUSE\n\nAddress already in use\n\n-- Data: errno.EADDRNOTAVAIL\n\nCannot assign requested address\n\n-- Data: errno.ENETDOWN\n\nNetwork is down\n\n-- Data: errno.ENETUNREACH\n\nNetwork is unreachable\n\n-- Data: errno.ENETRESET\n\nNetwork dropped connection because of reset\n\n-- Data: errno.ECONNABORTED\n\nSoftware caused connection abort.  This error is mapped to the\nexception *note ConnectionAbortedError: ed6.\n\n-- Data: errno.ECONNRESET\n\nConnection reset by peer.  This error is mapped to the exception\n*note ConnectionResetError: ed8.\n\n-- Data: errno.ENOBUFS\n\nNo buffer space available\n\n-- Data: errno.EISCONN\n\nTransport endpoint is already connected\n\n-- Data: errno.ENOTCONN\n\nTransport endpoint is not connected\n\n-- Data: errno.ESHUTDOWN\n\nCannot send after transport endpoint shutdown.  This error is\nmapped to the exception *note BrokenPipeError: ed5.\n\n-- Data: errno.ETOOMANYREFS\n\nToo many references: cannot splice\n\n-- Data: errno.ETIMEDOUT\n\nConnection timed out.  This error is mapped to the exception *note\nTimeoutError: 62a.\n\n-- Data: errno.ECONNREFUSED\n\nConnection refused.  This error is mapped to the exception *note\nConnectionRefusedError: ed7.\n\n-- Data: errno.EHOSTDOWN\n\nHost is down\n\n-- Data: errno.EHOSTUNREACH\n\nNo route to host\n\n-- Data: errno.EALREADY\n\nOperation already in progress.  This error is mapped to the\nexception *note BlockingIOError: ed0.\n\n-- Data: errno.EINPROGRESS\n\nOperation now in progress.  This error is mapped to the exception\n*note BlockingIOError: ed0.\n\n-- Data: errno.ESTALE\n\nStale NFS file handle\n\n-- Data: errno.EUCLEAN\n\nStructure needs cleaning\n\n-- Data: errno.ENOTNAM\n\nNot a XENIX named type file\n\n-- Data: errno.ENAVAIL\n\nNo XENIX semaphores available\n\n-- Data: errno.EISNAM\n\nIs a named type file\n\n-- Data: errno.EREMOTEIO\n\nRemote I/O error\n\n-- Data: errno.EDQUOT\n\nQuota exceeded\n\n-- Data: errno.EQFULL\n\nInterface output queue is full\n\nNew in version 3.11.\n\n-- Data: errno.ENOTCAPABLE\n\nCapabilities insufficient.  This error is mapped to the exception\n*note PermissionError: b9a.\n\n*note Availability: 1ad3.: WASI, FreeBSD\n\nNew in version 3.11.1.\n\n-- Data: errno.ECANCELED\n\nOperation canceled\n\nNew in version 3.2.\n\n-- Data: errno.EOWNERDEAD\n\nOwner died\n\nNew in version 3.2.\n\n-- Data: errno.ENOTRECOVERABLE\n\nState not recoverable\n\nNew in version 3.2.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ctypes -- A foreign function library for Python,  Prev: errno -- Standard errno system symbols,  Up: Generic Operating System Services": {
            "content": "'Source code:' Lib/ctypes(1)\n\n\n\n*note ctypes: 28. is a foreign function library for Python.  It provides\nC compatible data types, and allows calling functions in DLLs or shared\nlibraries.  It can be used to wrap these libraries in pure Python.\n\n* Menu:\n\n* ctypes tutorial::\n* ctypes reference::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/ctypes\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ctypes tutorial,  Next: ctypes reference,  Up: ctypes -- A foreign function library for Python": {
            "content": "5.16.16.1 ctypes tutorial\n.........................\n\nNote: The code samples in this tutorial use *note doctest: 36. to make\nsure that they actually work.  Since some code samples behave\ndifferently under Linux, Windows, or macOS, they contain doctest\ndirectives in comments.\n\nNote: Some code samples reference the ctypes *note cint: 2cb7. type.\nOn platforms where 'sizeof(long) == sizeof(int)' it is an alias to *note\nclong: 2cb8.  So, you should not be confused if *note clong: 2cb8. is\nprinted if you would expect *note cint: 2cb7. -- they are actually the\nsame type.\n\n* Menu:\n\n* Loading dynamic link libraries::\n* Accessing functions from loaded dlls::\n* Calling functions::\n* Fundamental data types::\n* Calling functions, continued: Calling functions continued.\n* Calling variadic functions::\n* Calling functions with your own custom data types::\n* Specifying the required argument types (function prototypes): Specifying the required argument types function prototypes.\n* Return types::\n* Passing pointers (or; passing parameters by reference): Passing pointers or passing parameters by reference.\n* Structures and unions::\n* Structure/union alignment and byte order::\n* Bit fields in structures and unions::\n* Arrays::\n* Pointers::\n* Type conversions::\n* Incomplete Types::\n* Callback functions::\n* Accessing values exported from dlls::\n* Surprises::\n* Variable-sized data types::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Loading dynamic link libraries,  Next: Accessing functions from loaded dlls,  Up: ctypes tutorial": {
            "content": "5.16.16.2 Loading dynamic link libraries\n........................................\n\n*note ctypes: 28. exports the 'cdll', and on Windows 'windll' and\n'oledll' objects, for loading dynamic link libraries.\n\nYou load libraries by accessing them as attributes of these objects.\n'cdll' loads libraries which export functions using the standard 'cdecl'\ncalling convention, while 'windll' libraries call functions using the\n'stdcall' calling convention.  'oledll' also uses the 'stdcall' calling\nconvention, and assumes the functions return a Windows 'HRESULT' error\ncode.  The error code is used to automatically raise an *note OSError:\n613. exception when the function call fails.\n\nChanged in version 3.3: Windows errors used to raise *note WindowsError:\necd, which is now an alias of *note OSError: 613.\n",
            "subsections": []
        },
        "Here are some examples for Windows.  Note that 'msvcrt' is the MS": {
            "content": "standard C library containing most standard C functions, and uses the\ncdecl calling convention:\n\n>>> from ctypes import *\n>>> print(windll.kernel32)\n<WinDLL 'kernel32', handle ... at ...>\n>>> print(cdll.msvcrt)\n<CDLL 'msvcrt', handle ... at ...>\n>>> libc = cdll.msvcrt\n>>>\n\nWindows appends the usual '.dll' file suffix automatically.\n\nNote: Accessing the standard C library through 'cdll.msvcrt' will\nuse an outdated version of the library that may be incompatible\nwith the one being used by Python.  Where possible, use native\nPython functionality, or else import and use the 'msvcrt' module.\n",
            "subsections": []
        },
        "On Linux, it is required to specify the filename 'including' the": {
            "content": "extension to load a library, so attribute access can not be used to load\nlibraries.  Either the *note LoadLibrary(): 2cbb. method of the dll\nloaders should be used, or you should load the library by creating an\ninstance of CDLL by calling the constructor:\n\n>>> cdll.LoadLibrary(\"libc.so.6\")\n<CDLL 'libc.so.6', handle ... at ...>\n>>> libc = CDLL(\"libc.so.6\")\n>>> libc\n<CDLL 'libc.so.6', handle ... at ...>\n>>>\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Accessing functions from loaded dlls,  Next: Calling functions,  Prev: Loading dynamic link libraries,  Up: ctypes tutorial": {
            "content": "5.16.16.3 Accessing functions from loaded dlls\n..............................................\n\nFunctions are accessed as attributes of dll objects:\n\n>>> libc.printf\n<FuncPtr object at 0x...>\n>>> print(windll.kernel32.GetModuleHandleA)\n<FuncPtr object at 0x...>\n>>> print(windll.kernel32.MyOwnFunction)\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nFile \"ctypes.py\", line 239, in getattr\nfunc = StdcallFuncPtr(name, self)\nAttributeError: function 'MyOwnFunction' not found\n>>>\n",
            "subsections": []
        },
        "Note that win32 system dlls like 'kernel32' and 'user32' often export": {
            "content": "ANSI as well as UNICODE versions of a function.  The UNICODE version is\nexported with an 'W' appended to the name, while the ANSI version is\nexported with an 'A' appended to the name.  The win32 'GetModuleHandle'\nfunction, which returns a 'module handle' for a given module name, has\nthe following C prototype, and a macro is used to expose one of them as\n'GetModuleHandle' depending on whether UNICODE is defined or not:\n\n/* ANSI version */\nHMODULE GetModuleHandleA(LPCSTR lpModuleName);\n/* UNICODE version */\nHMODULE GetModuleHandleW(LPCWSTR lpModuleName);\n\n'windll' does not try to select one of them by magic, you must access\nthe version you need by specifying 'GetModuleHandleA' or\n'GetModuleHandleW' explicitly, and then call it with bytes or string\nobjects respectively.\n",
            "subsections": []
        },
        "Sometimes, dlls export functions with names which aren't valid Python": {
            "content": "identifiers, like '\"??2@YAPAXI@Z\"'.  In this case you have to use *note\ngetattr(): a15. to retrieve the function:\n\n>>> getattr(cdll.msvcrt, \"??2@YAPAXI@Z\")\n<FuncPtr object at 0x...>\n>>>\n\nOn Windows, some dlls export functions not by name but by ordinal.",
            "subsections": []
        },
        "These functions can be accessed by indexing the dll object with the": {
            "content": "ordinal number:\n\n>>> cdll.kernel32[1]\n<FuncPtr object at 0x...>\n>>> cdll.kernel32[0]\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nFile \"ctypes.py\", line 310, in getitem\nfunc = StdcallFuncPtr(name, self)\nAttributeError: function ordinal 0 not found\n>>>\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Calling functions,  Next: Fundamental data types,  Prev: Accessing functions from loaded dlls,  Up: ctypes tutorial": {
            "content": "5.16.16.4 Calling functions\n...........................\n",
            "subsections": []
        },
        "You can call these functions like any other Python callable.  This": {
            "content": "example uses the 'rand()' function, which takes no arguments and returns\na pseudo-random integer:\n\n>>> print(libc.rand())\n1804289383\n",
            "subsections": []
        },
        "On Windows, you can call the 'GetModuleHandleA()' function, which": {
            "content": "returns a win32 module handle (passing 'None' as single argument to call\nit with a 'NULL' pointer):\n\n>>> print(hex(windll.kernel32.GetModuleHandleA(None)))\n0x1d000000\n>>>\n\n*note ValueError: 183. is raised when you call an 'stdcall' function\nwith the 'cdecl' calling convention, or vice versa:\n\n>>> cdll.kernel32.GetModuleHandleA(None)\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nValueError: Procedure probably called with not enough arguments (4 bytes missing)\n>>>\n\n>>> windll.msvcrt.printf(b\"spam\")\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nValueError: Procedure probably called with too many arguments (4 bytes in excess)\n>>>\n",
            "subsections": []
        },
        "To find out the correct calling convention you have to look into the C": {
            "content": "header file or the documentation for the function you want to call.\n\nOn Windows, *note ctypes: 28. uses win32 structured exception handling\nto prevent crashes from general protection faults when functions are\ncalled with invalid argument values:\n\n>>> windll.kernel32.GetModuleHandleA(32)\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nOSError: exception: access violation reading 0x00000020\n>>>\n\nThere are, however, enough ways to crash Python with *note ctypes: 28,\nso you should be careful anyway.  The *note faulthandler: 53. module can\nbe helpful in debugging crashes (e.g.  from segmentation faults produced\nby erroneous C library calls).\n\n'None', integers, bytes objects and (unicode) strings are the only\nnative Python objects that can directly be used as parameters in these\nfunction calls.  'None' is passed as a C 'NULL' pointer, bytes objects\nand strings are passed as pointer to the memory block that contains\ntheir data (char* or wchart*).  Python integers are passed as the\nplatforms default C int type, their value is masked to fit into the C\ntype.\n",
            "subsections": []
        },
        "Before we move on calling functions with other parameter types, we have": {
            "content": "to learn more about *note ctypes: 28. data types.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Fundamental data types,  Next: Calling functions continued,  Prev: Calling functions,  Up: ctypes tutorial": {
            "content": "5.16.16.5 Fundamental data types\n................................\n\n*note ctypes: 28. defines a number of primitive C compatible data types:\n\nctypes type                C type                                         Python type\n\n-----------------------------------------------------------------------------------------------------------\n\n*note cbool: 2cc2.        Bool                                          bool (1)\n\n\n*note cchar: 2cc3.        char                                           1-character bytes object\n\n\n*note cwchar: 2cc4.       'wchart'                                      1-character string\n\n\n*note cbyte: 14c1.        char                                           int\n\n\n*note cubyte: 14c2.       unsigned char                                  int\n\n\n*note cshort: 2cc5.       short                                          int\n\n\n*note cushort: 2cc6.      unsigned short                                 int\n\n\n*note cint: 2cb7.         int                                            int\n\n\n*note cuint: 2cc7.        unsigned int                                   int\n\n\n*note clong: 2cb8.        long                                           int\n\n\n*note culong: 2cc8.       unsigned long                                  int\n\n\n*note clonglong: 2cc9.    int64 or long long                           int\n\n\n*note culonglong: 2cca.   unsigned int64 or unsigned long long         int\n\n\n*note csizet: 2ccb.      'sizet'                                       int\n\n\n*note cssizet: 10b2.     'ssizet' or *note Pyssizet: 88d.            int\n\n\n*note ctimet: 1537.      'timet'                                       int\n\n\n*note cfloat: 2ccc.       float                                          float\n\n\n*note cdouble: 165f.      double                                         float\n\n\n*note clongdouble: 1660.  long double                                    float\n\n\n*note ccharp: 2ccd.      char* (NUL terminated)                         bytes object or 'None'\n\n\n*note cwcharp: 162b.     wchart* (NUL terminated)                      string or 'None'\n\n\n*note cvoidp: 2cce.      void*                                          int or 'None'\n\n\n1. The constructor accepts any object with a truth value.\n",
            "subsections": []
        },
        "All these types can be created by calling them with an optional": {
            "content": "initializer of the correct type and value:\n\n>>> cint()\nclong(0)\n>>> cwcharp(\"Hello, World\")\ncwcharp(140018365411392)\n>>> cushort(-3)\ncushort(65533)\n>>>\n",
            "subsections": []
        },
        "Since these types are mutable, their value can also be changed": {
            "content": "afterwards:\n\n>>> i = cint(42)\n>>> print(i)\nclong(42)\n>>> print(i.value)\n42\n>>> i.value = -99\n>>> print(i.value)\n-99\n>>>\n\nAssigning a new value to instances of the pointer types *note ccharp:\n2ccd, *note cwcharp: 162b, and *note cvoidp: 2cce. changes the\n'memory location' they point to, 'not the contents' of the memory block\n(of course not, because Python bytes objects are immutable):\n\n>>> s = \"Hello, World\"\n>>> cs = cwcharp(s)\n>>> print(cs)\ncwcharp(139966785747344)\n>>> print(cs.value)\nHello World\n>>> cs.value = \"Hi, there\"\n>>> print(cs)              # the memory location has changed\ncwcharp(139966783348904)\n>>> print(cs.value)\nHi, there\n>>> print(s)                # first object is unchanged\nHello, World\n>>>\n",
            "subsections": []
        },
        "You should be careful, however, not to pass them to functions expecting": {
            "content": "pointers to mutable memory.  If you need mutable memory blocks, ctypes\nhas a *note createstringbuffer(): 2ccf. function which creates these\nin various ways.  The current memory block contents can be accessed (or\nchanged) with the 'raw' property; if you want to access it as NUL\nterminated string, use the 'value' property:\n\n>>> from ctypes import *\n>>> p = createstringbuffer(3)            # create a 3 byte buffer, initialized to NUL bytes\n>>> print(sizeof(p), repr(p.raw))\n3 b'\\x00\\x00\\x00'\n>>> p = createstringbuffer(b\"Hello\")     # create a buffer containing a NUL terminated string\n>>> print(sizeof(p), repr(p.raw))\n6 b'Hello\\x00'\n>>> print(repr(p.value))\nb'Hello'\n>>> p = createstringbuffer(b\"Hello\", 10) # create a 10 byte buffer\n>>> print(sizeof(p), repr(p.raw))\n10 b'Hello\\x00\\x00\\x00\\x00\\x00'\n>>> p.value = b\"Hi\"\n>>> print(sizeof(p), repr(p.raw))\n10 b'Hi\\x00lo\\x00\\x00\\x00\\x00\\x00'\n>>>\n\nThe *note createstringbuffer(): 2ccf. function replaces the old\n'cbuffer()' function (which is still available as an alias).  To create\na mutable memory block containing unicode characters of the C type\n'wchart', use the *note createunicodebuffer(): 1741. function.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Calling functions continued,  Next: Calling variadic functions,  Prev: Fundamental data types,  Up: ctypes tutorial": {
            "content": "5.16.16.6 Calling functions, continued\n......................................\n",
            "subsections": []
        },
        "Note that printf prints to the real standard output channel, 'not' to": {
            "content": "*note sys.stdout: 90c, so these examples will only work at the console\nprompt, not from within 'IDLE' or 'PythonWin':\n\n>>> printf = libc.printf\n>>> printf(b\"Hello, %s\\n\", b\"World!\")\nHello, World!\n14\n>>> printf(b\"Hello, %S\\n\", \"World!\")\nHello, World!\n14\n>>> printf(b\"%d bottles of beer\\n\", 42)\n42 bottles of beer\n19\n>>> printf(b\"%f bottles of beer\\n\", 42.5)\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nArgumentError: argument 2: TypeError: Don't know how to convert parameter 2\n>>>\n",
            "subsections": []
        },
        "As has been mentioned before, all Python types except integers, strings,": {
            "content": "and bytes objects have to be wrapped in their corresponding *note\nctypes: 28. type, so that they can be converted to the required C data\ntype:\n\n>>> printf(b\"An int %d, a double %f\\n\", 1234, cdouble(3.14))\nAn int 1234, a double 3.140000\n31\n>>>\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Calling variadic functions,  Next: Calling functions with your own custom data types,  Prev: Calling functions continued,  Up: ctypes tutorial": {
            "content": "5.16.16.7 Calling variadic functions\n....................................\n",
            "subsections": []
        },
        "On a lot of platforms calling variadic functions through ctypes is": {
            "content": "exactly the same as calling functions with a fixed number of parameters.",
            "subsections": []
        },
        "On some platforms, and in particular ARM64 for Apple Platforms, the": {
            "content": "calling convention for variadic functions is different than that for\nregular functions.\n\nOn those platforms it is required to specify the *note argtypes: 2cd4.\nattribute for the regular, non-variadic, function arguments:\n\nlibc.printf.argtypes = [ctypes.ccharp]\n",
            "subsections": []
        },
        "Because specifying the attribute does not inhibit portability it is": {
            "content": "advised to always specify *note argtypes: 2cd4. for all variadic\nfunctions.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Calling functions with your own custom data types,  Next: Specifying the required argument types function prototypes,  Prev: Calling variadic functions,  Up: ctypes tutorial": {
            "content": "5.16.16.8 Calling functions with your own custom data types\n...........................................................\n\nYou can also customize *note ctypes: 28. argument conversion to allow\ninstances of your own classes be used as function arguments.  *note\nctypes: 28. looks for an 'asparameter' attribute and uses this as the\nfunction argument.  The attribute must be an integer, string, bytes, a\n*note ctypes: 28. instance, or an object with an 'asparameter'\nattribute:\n\n>>> class Bottles:\n...     def init(self, number):\n...         self.asparameter = number\n...\n>>> bottles = Bottles(42)\n>>> printf(b\"%d bottles of beer\\n\", bottles)\n42 bottles of beer\n19\n>>>\n",
            "subsections": []
        },
        "If you don't want to store the instance's data in the 'asparameter'": {
            "content": "instance variable, you could define a *note property: 3f6. which makes\nthe attribute available on request.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Specifying the required argument types function prototypes,  Next: Return types,  Prev: Calling functions with your own custom data types,  Up: ctypes tutorial": {
            "content": "5.16.16.9 Specifying the required argument types (function prototypes)\n......................................................................\n",
            "subsections": []
        },
        "It is possible to specify the required argument types of functions": {
            "content": "exported from DLLs by setting the *note argtypes: 2cd4. attribute.\n\n*note argtypes: 2cd4. must be a sequence of C data types (the 'printf()'\nfunction is probably not a good example here, because it takes a\nvariable number and different types of parameters depending on the\nformat string, on the other hand this is quite handy to experiment with\nthis feature):\n\n>>> printf.argtypes = [ccharp, ccharp, cint, cdouble]\n>>> printf(b\"String '%s', Int %d, Double %f\\n\", b\"Hi\", 10, 2.2)\nString 'Hi', Int 10, Double 2.200000\n37\n>>>\n",
            "subsections": []
        },
        "Specifying a format protects against incompatible argument types (just": {
            "content": "as a prototype for a C function), and tries to convert the arguments to\nvalid types:\n\n>>> printf(b\"%d %d %d\", 1, 2, 3)\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nArgumentError: argument 2: TypeError: wrong type\n>>> printf(b\"%s %d %f\\n\", b\"X\", 2, 3)\nX 2 3.000000\n13\n>>>\n",
            "subsections": []
        },
        "If you have defined your own classes which you pass to function calls,": {
            "content": "you have to implement a *note fromparam(): 2cd9. class method for them\nto be able to use them in the *note argtypes: 2cd4. sequence.  The *note\nfromparam(): 2cd9. class method receives the Python object passed to\nthe function call, it should do a typecheck or whatever is needed to\nmake sure this object is acceptable, and then return the object itself,\nits 'asparameter' attribute, or whatever you want to pass as the C\nfunction argument in this case.  Again, the result should be an integer,\nstring, bytes, a *note ctypes: 28. instance, or an object with an\n'asparameter' attribute.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Return types,  Next: Passing pointers or passing parameters by reference,  Prev: Specifying the required argument types function prototypes,  Up: ctypes tutorial": {
            "content": "5.16.16.10 Return types\n.......................\n",
            "subsections": []
        },
        "By default functions are assumed to return the C int type.  Other return": {
            "content": "types can be specified by setting the *note restype: 2cdc. attribute of\nthe function object.\n\nThe C prototype of 'time()' is 'timet time(timet *)'.  Because\n'timet' might be of a different type than the default return type int,\nyou should specify the 'restype' attribute:\n\n>>> libc.time.restype = ctimet\n\nThe argument types can be specified using *note argtypes: 2cd4.:\n\n>>> libc.time.argtypes = (POINTER(ctimet),)\n",
            "subsections": []
        },
        "To call the function with a 'NULL' pointer as first argument, use": {
            "content": "'None':\n\n>>> print(libc.time(None))\n1150640792\n",
            "subsections": []
        },
        "Here is a more advanced example, it uses the 'strchr()' function, which": {
            "content": "expects a string pointer and a char, and returns a pointer to a string:\n\n>>> strchr = libc.strchr\n>>> strchr(b\"abcdef\", ord(\"d\"))\n8059983\n>>> strchr.restype = ccharp    # ccharp is a pointer to a string\n>>> strchr(b\"abcdef\", ord(\"d\"))\nb'def'\n>>> print(strchr(b\"abcdef\", ord(\"x\")))\nNone\n>>>\n\nIf you want to avoid the *note ord(\"x\"): 1c10. calls above, you can set\nthe *note argtypes: 2cd4. attribute, and the second argument will be\nconverted from a single character Python bytes object into a C char:\n\n>>> strchr.restype = ccharp\n>>> strchr.argtypes = [ccharp, cchar]\n>>> strchr(b\"abcdef\", b\"d\")\nb'def'\n>>> strchr(b\"abcdef\", b\"def\")\nTraceback (most recent call last):\nctypes.ArgumentError: argument 2: TypeError: one character bytes, bytearray or integer expected\n>>> print(strchr(b\"abcdef\", b\"x\"))\nNone\n>>> strchr(b\"abcdef\", b\"d\")\nb'def'\n>>>\n",
            "subsections": []
        },
        "You can also use a callable Python object (a function or a class for": {
            "content": "example) as the *note restype: 2cdc. attribute, if the foreign function\nreturns an integer.  The callable will be called with the 'integer' the\nC function returns, and the result of this call will be used as the\nresult of your function call.  This is useful to check for error return\nvalues and automatically raise an exception:\n\n>>> GetModuleHandle = windll.kernel32.GetModuleHandleA\n>>> def ValidHandle(value):\n...     if value == 0:\n...         raise WinError()\n...     return value\n...\n>>>\n>>> GetModuleHandle.restype = ValidHandle\n>>> GetModuleHandle(None)\n486539264\n>>> GetModuleHandle(\"something silly\")\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nFile \"<stdin>\", line 3, in ValidHandle\nOSError: [Errno 126] The specified module could not be found.\n>>>\n\n'WinError' is a function which will call Windows 'FormatMessage()' api\nto get the string representation of an error code, and 'returns' an\nexception.  'WinError' takes an optional error code parameter, if no one\nis used, it calls *note GetLastError(): 2cdd. to retrieve it.\n",
            "subsections": []
        },
        "Please note that a much more powerful error checking mechanism is": {
            "content": "available through the *note errcheck: 2cde. attribute; see the reference\nmanual for details.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Passing pointers or passing parameters by reference,  Next: Structures and unions,  Prev: Return types,  Up: ctypes tutorial": {
            "content": "5.16.16.11 Passing pointers (or: passing parameters by reference)\n.................................................................\n",
            "subsections": []
        },
        "Sometimes a C api function expects a 'pointer' to a data type as": {
            "content": "parameter, probably to write into the corresponding location, or if the\ndata is too large to be passed by value.  This is also known as 'passing\nparameters by reference'.\n\n*note ctypes: 28. exports the *note byref(): 2ce1. function which is\nused to pass parameters by reference.  The same effect can be achieved\nwith the *note pointer(): 2ce2. function, although *note pointer():\n2ce2. does a lot more work since it constructs a real pointer object, so\nit is faster to use *note byref(): 2ce1. if you don't need the pointer\nobject in Python itself:\n\n>>> i = cint()\n>>> f = cfloat()\n>>> s = createstringbuffer(b'\\000' * 32)\n>>> print(i.value, f.value, repr(s.value))\n0 0.0 b''\n>>> libc.sscanf(b\"1 3.14 Hello\", b\"%d %f %s\",\n...             byref(i), byref(f), s)\n3\n>>> print(i.value, f.value, repr(s.value))\n1 3.1400001049 b'Hello'\n>>>\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Structures and unions,  Next: Structure/union alignment and byte order,  Prev: Passing pointers or passing parameters by reference,  Up: ctypes tutorial": {
            "content": "5.16.16.12 Structures and unions\n................................\n\nStructures and unions must derive from the *note Structure: 13d3. and\n*note Union: 13d2. base classes which are defined in the *note ctypes:\n28. module.  Each subclass must define a *note fields: 2ce5.\nattribute.  'fields' must be a list of '2-tuples', containing a 'field\nname' and a 'field type'.\n\nThe field type must be a *note ctypes: 28. type like *note cint: 2cb7,\nor any other derived *note ctypes: 28. type: structure, union, array,\npointer.\n",
            "subsections": []
        },
        "Here is a simple example of a POINT structure, which contains two": {
            "content": "integers named 'x' and 'y', and also shows how to initialize a structure\nin the constructor:\n\n>>> from ctypes import *\n>>> class POINT(Structure):\n...     fields = [(\"x\", cint),\n...                 (\"y\", cint)]\n...\n>>> point = POINT(10, 20)\n>>> print(point.x, point.y)\n10 20\n>>> point = POINT(y=5)\n>>> print(point.x, point.y)\n0 5\n>>> POINT(1, 2, 3)\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nTypeError: too many initializers\n>>>\n",
            "subsections": []
        },
        "You can, however, build much more complicated structures.  A structure": {
            "content": "can itself contain other structures by using a structure as a field\ntype.\n",
            "subsections": []
        },
        "Here is a RECT structure which contains two POINTs named 'upperleft' and": {
            "content": "'lowerright':\n\n>>> class RECT(Structure):\n...     fields = [(\"upperleft\", POINT),\n...                 (\"lowerright\", POINT)]\n...\n>>> rc = RECT(point)\n>>> print(rc.upperleft.x, rc.upperleft.y)\n0 5\n>>> print(rc.lowerright.x, rc.lowerright.y)\n0 0\n>>>\n",
            "subsections": []
        },
        "Nested structures can also be initialized in the constructor in several": {
            "content": "ways:\n\n>>> r = RECT(POINT(1, 2), POINT(3, 4))\n>>> r = RECT((1, 2), (3, 4))\n\nField *note descriptor: 1c78.s can be retrieved from the 'class', they\nare useful for debugging because they can provide useful information:\n\n>>> print(POINT.x)\n<Field type=clong, ofs=0, size=4>\n>>> print(POINT.y)\n<Field type=clong, ofs=4, size=4>\n>>>\nWarning: *note ctypes: 28. does not support passing unions or\nstructures with bit-fields to functions by value.  While this may\nwork on 32-bit x86, it's not guaranteed by the library to work in\nthe general case.  Unions and structures with bit-fields should\nalways be passed to functions by pointer.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Structure/union alignment and byte order,  Next: Bit fields in structures and unions,  Prev: Structures and unions,  Up: ctypes tutorial": {
            "content": "5.16.16.13 Structure/union alignment and byte order\n...................................................\n",
            "subsections": []
        },
        "By default, Structure and Union fields are aligned in the same way the C": {
            "content": "compiler does it.  It is possible to override this behavior by\nspecifying a *note pack: 2ce8. class attribute in the subclass\ndefinition.  This must be set to a positive integer and specifies the\nmaximum alignment for the fields.  This is what '#pragma pack(n)' also\ndoes in MSVC.\n\n*note ctypes: 28. uses the native byte order for Structures and Unions.",
            "subsections": []
        },
        "To build structures with non-native byte order, you can use one of the": {
            "content": "*note BigEndianStructure: 2ce9, *note LittleEndianStructure: 2cea, *note\nBigEndianUnion: 1588, and *note LittleEndianUnion: 1589. base classes.\nThese classes cannot contain pointer fields.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Bit fields in structures and unions,  Next: Arrays,  Prev: Structure/union alignment and byte order,  Up: ctypes tutorial": {
            "content": "5.16.16.14 Bit fields in structures and unions\n..............................................\n\nIt is possible to create structures and unions containing bit fields.",
            "subsections": []
        },
        "Bit fields are only possible for integer fields, the bit width is": {
            "content": "specified as the third item in the *note fields: 2ce5. tuples:\n\n>>> class Int(Structure):\n...     fields = [(\"first16\", cint, 16),\n...                 (\"second16\", cint, 16)]\n...\n>>> print(Int.first16)\n<Field type=clong, ofs=0:0, bits=16>\n>>> print(Int.second16)\n<Field type=clong, ofs=0:16, bits=16>\n>>>\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Arrays,  Next: Pointers,  Prev: Bit fields in structures and unions,  Up: ctypes tutorial": {
            "content": "5.16.16.15 Arrays\n.................\n",
            "subsections": []
        },
        "Arrays are sequences, containing a fixed number of instances of the same": {
            "content": "type.\n",
            "subsections": []
        },
        "The recommended way to create array types is by multiplying a data type": {
            "content": "with a positive integer:\n\nTenPointsArrayType = POINT * 10\n",
            "subsections": []
        },
        "Here is an example of a somewhat artificial data type, a structure": {
            "content": "containing 4 POINTs among other stuff:\n\n>>> from ctypes import *\n>>> class POINT(Structure):\n...     fields = (\"x\", cint), (\"y\", cint)\n...\n>>> class MyStruct(Structure):\n...     fields = [(\"a\", cint),\n...                 (\"b\", cfloat),\n...                 (\"pointarray\", POINT * 4)]\n>>>\n>>> print(len(MyStruct().pointarray))\n4\n>>>\n\nInstances are created in the usual way, by calling the class:\n\narr = TenPointsArrayType()\nfor pt in arr:\nprint(pt.x, pt.y)\n",
            "subsections": []
        },
        "The above code print a series of '0 0' lines, because the array contents": {
            "content": "is initialized to zeros.\n\nInitializers of the correct type can also be specified:\n\n>>> from ctypes import *\n>>> TenIntegers = cint * 10\n>>> ii = TenIntegers(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)\n>>> print(ii)\n<clongArray10 object at 0x...>\n>>> for i in ii: print(i, end=\" \")\n...\n1 2 3 4 5 6 7 8 9 10\n>>>\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Pointers,  Next: Type conversions,  Prev: Arrays,  Up: ctypes tutorial": {
            "content": "5.16.16.16 Pointers\n...................\n\nPointer instances are created by calling the *note pointer(): 2ce2.\nfunction on a *note ctypes: 28. type:\n\n>>> from ctypes import *\n>>> i = cint(42)\n>>> pi = pointer(i)\n>>>\n\nPointer instances have a *note contents: 2cf1. attribute which returns\nthe object to which the pointer points, the 'i' object above:\n\n>>> pi.contents\nclong(42)\n>>>\n\nNote that *note ctypes: 28. does not have OOR (original object return),\nit constructs a new, equivalent object each time you retrieve an\nattribute:\n\n>>> pi.contents is i\nFalse\n>>> pi.contents is pi.contents\nFalse\n>>>\n\nAssigning another *note cint: 2cb7. instance to the pointer's contents\nattribute would cause the pointer to point to the memory location where\nthis is stored:\n\n>>> i = cint(99)\n>>> pi.contents = i\n>>> pi.contents\nclong(99)\n>>>\n\nPointer instances can also be indexed with integers:\n\n>>> pi[0]\n99\n>>>\n\nAssigning to an integer index changes the pointed to value:\n\n>>> print(i)\nclong(99)\n>>> pi[0] = 22\n>>> print(i)\nclong(22)\n>>>\n",
            "subsections": []
        },
        "It is also possible to use indexes different from 0, but you must know": {
            "content": "what you're doing, just as in C: You can access or change arbitrary\nmemory locations.  Generally you only use this feature if you receive a\npointer from a C function, and you 'know' that the pointer actually\npoints to an array instead of a single item.\n\nBehind the scenes, the *note pointer(): 2ce2. function does more than\nsimply create pointer instances, it has to create pointer 'types' first.\nThis is done with the *note POINTER(): 2cf2. function, which accepts any\n*note ctypes: 28. type, and returns a new type:\n\n>>> PI = POINTER(cint)\n>>> PI\n<class 'ctypes.LPclong'>\n>>> PI(42)\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nTypeError: expected clong instead of int\n>>> PI(cint(42))\n<ctypes.LPclong object at 0x...>\n>>>\n\nCalling the pointer type without an argument creates a 'NULL' pointer.\n'NULL' pointers have a 'False' boolean value:\n\n>>> nullptr = POINTER(cint)()\n>>> print(bool(nullptr))\nFalse\n>>>\n\n*note ctypes: 28. checks for 'NULL' when dereferencing pointers (but\ndereferencing invalid non-'NULL' pointers would crash Python):\n\n>>> nullptr[0]\nTraceback (most recent call last):\n....\nValueError: NULL pointer access\n>>>\n\n>>> nullptr[0] = 1234\nTraceback (most recent call last):\n....\nValueError: NULL pointer access\n>>>\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Type conversions,  Next: Incomplete Types,  Prev: Pointers,  Up: ctypes tutorial": {
            "content": "5.16.16.17 Type conversions\n...........................\n",
            "subsections": []
        },
        "Usually, ctypes does strict type checking.  This means, if you have": {
            "content": "'POINTER(cint)' in the *note argtypes: 2cd4. list of a function or as\nthe type of a member field in a structure definition, only instances of\nexactly the same type are accepted.  There are some exceptions to this\nrule, where ctypes accepts other objects.  For example, you can pass\ncompatible array instances instead of pointer types.  So, for\n'POINTER(cint)', ctypes accepts an array of cint:\n\n>>> class Bar(Structure):\n...     fields = [(\"count\", cint), (\"values\", POINTER(cint))]\n...\n>>> bar = Bar()\n>>> bar.values = (cint * 3)(1, 2, 3)\n>>> bar.count = 3\n>>> for i in range(bar.count):\n...     print(bar.values[i])\n...\n1\n2\n3\n>>>\n",
            "subsections": []
        },
        "In addition, if a function argument is explicitly declared to be a": {
            "content": "pointer type (such as 'POINTER(cint)') in *note argtypes: 2cd4, an\nobject of the pointed type ('cint' in this case) can be passed to the\nfunction.  ctypes will apply the required *note byref(): 2ce1.\nconversion in this case automatically.\n\nTo set a POINTER type field to 'NULL', you can assign 'None':\n\n>>> bar.values = None\n>>>\n",
            "subsections": []
        },
        "Sometimes you have instances of incompatible types.  In C, you can cast": {
            "content": "one type into another type.  *note ctypes: 28. provides a *note cast():\n2cf5. function which can be used in the same way.  The 'Bar' structure\ndefined above accepts 'POINTER(cint)' pointers or *note cint: 2cb7.\narrays for its 'values' field, but not instances of other types:\n\n>>> bar.values = (cbyte * 4)()\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nTypeError: incompatible types, cbyteArray4 instance instead of LPclong instance\n>>>\n\nFor these cases, the *note cast(): 2cf5. function is handy.\n\nThe *note cast(): 2cf5. function can be used to cast a ctypes instance\ninto a pointer to a different ctypes data type.  *note cast(): 2cf5.\ntakes two parameters, a ctypes object that is or can be converted to a\npointer of some kind, and a ctypes pointer type.  It returns an instance\nof the second argument, which references the same memory block as the\nfirst argument:\n\n>>> a = (cbyte * 4)()\n>>> cast(a, POINTER(cint))\n<ctypes.LPclong object at ...>\n>>>\n\nSo, *note cast(): 2cf5. can be used to assign to the 'values' field of\n'Bar' the structure:\n\n>>> bar = Bar()\n>>> bar.values = cast((cbyte * 4)(), POINTER(cint))\n>>> print(bar.values[0])\n0\n>>>\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Incomplete Types,  Next: Callback functions,  Prev: Type conversions,  Up: ctypes tutorial": {
            "content": "5.16.16.18 Incomplete Types\n...........................\n\n'Incomplete Types' are structures, unions or arrays whose members are\nnot yet specified.  In C, they are specified by forward declarations,\nwhich are defined later:\n\nstruct cell; /* forward declaration */\n\nstruct cell {\nchar *name;\nstruct cell *next;\n};\n",
            "subsections": []
        },
        "The straightforward translation into ctypes code would be this, but it": {
            "content": "does not work:\n\n>>> class cell(Structure):\n...     fields = [(\"name\", ccharp),\n...                 (\"next\", POINTER(cell))]\n...\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nFile \"<stdin>\", line 2, in cell\nNameError: name 'cell' is not defined\n>>>\n\nbecause the new 'class cell' is not available in the class statement\nitself.  In *note ctypes: 28, we can define the 'cell' class and set the\n*note fields: 2ce5. attribute later, after the class statement:\n\n>>> from ctypes import *\n>>> class cell(Structure):\n...     pass\n...\n>>> cell.fields = [(\"name\", ccharp),\n...                  (\"next\", POINTER(cell))]\n>>>\n",
            "subsections": []
        },
        "Let's try it.  We create two instances of 'cell', and let them point to": {
            "content": "each other, and finally follow the pointer chain a few times:\n\n>>> c1 = cell()\n>>> c1.name = b\"foo\"\n>>> c2 = cell()\n>>> c2.name = b\"bar\"\n>>> c1.next = pointer(c2)\n>>> c2.next = pointer(c1)\n>>> p = c1\n>>> for i in range(8):\n...     print(p.name, end=\" \")\n...     p = p.next[0]\n...\nfoo bar foo bar foo bar foo bar\n>>>\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Callback functions,  Next: Accessing values exported from dlls,  Prev: Incomplete Types,  Up: ctypes tutorial": {
            "content": "5.16.16.19 Callback functions\n.............................\n\n*note ctypes: 28. allows creating C callable function pointers from\nPython callables.  These are sometimes called 'callback functions'.\n",
            "subsections": []
        },
        "First, you must create a class for the callback function.  The class": {
            "content": "knows the calling convention, the return type, and the number and types\nof arguments this function will receive.\n\nThe *note CFUNCTYPE(): 2cfa. factory function creates types for callback\nfunctions using the 'cdecl' calling convention.  On Windows, the *note\nWINFUNCTYPE(): 2cfb. factory function creates types for callback\nfunctions using the 'stdcall' calling convention.\n",
            "subsections": []
        },
        "Both of these factory functions are called with the result type as first": {
            "content": "argument, and the callback functions expected argument types as the\nremaining arguments.\n\nI will present an example here which uses the standard C library's\n'qsort()' function, that is used to sort items with the help of a\ncallback function.  'qsort()' will be used to sort an array of integers:\n\n>>> IntArray5 = cint * 5\n>>> ia = IntArray5(5, 1, 7, 33, 99)\n>>> qsort = libc.qsort\n>>> qsort.restype = None\n>>>\n\n'qsort()' must be called with a pointer to the data to sort, the number\nof items in the data array, the size of one item, and a pointer to the\ncomparison function, the callback.  The callback will then be called\nwith two pointers to items, and it must return a negative integer if the\nfirst item is smaller than the second, a zero if they are equal, and a\npositive integer otherwise.\n",
            "subsections": []
        },
        "So our callback function receives pointers to integers, and must return": {
            "content": "an integer.  First we create the 'type' for the callback function:\n\n>>> CMPFUNC = CFUNCTYPE(cint, POINTER(cint), POINTER(cint))\n>>>\n",
            "subsections": []
        },
        "To get started, here is a simple callback that shows the values it gets": {
            "content": "passed:\n\n>>> def pycmpfunc(a, b):\n...     print(\"pycmpfunc\", a[0], b[0])\n...     return 0\n...\n>>> cmpfunc = CMPFUNC(pycmpfunc)\n>>>\n\nThe result:\n\n>>> qsort(ia, len(ia), sizeof(cint), cmpfunc)\npycmpfunc 5 1\npycmpfunc 33 99\npycmpfunc 7 33\npycmpfunc 5 7\npycmpfunc 1 7\n>>>\n\nNow we can actually compare the two items and return a useful result:\n\n>>> def pycmpfunc(a, b):\n...     print(\"pycmpfunc\", a[0], b[0])\n...     return a[0] - b[0]\n...\n>>>\n>>> qsort(ia, len(ia), sizeof(cint), CMPFUNC(pycmpfunc))\npycmpfunc 5 1\npycmpfunc 33 99\npycmpfunc 7 33\npycmpfunc 1 7\npycmpfunc 5 7\n>>>\n\nAs we can easily check, our array is sorted now:\n\n>>> for i in ia: print(i, end=\" \")\n...\n1 5 7 33 99\n>>>\n",
            "subsections": []
        },
        "The function factories can be used as decorator factories, so we may as": {
            "content": "well write:\n\n>>> @CFUNCTYPE(cint, POINTER(cint), POINTER(cint))\n... def pycmpfunc(a, b):\n...     print(\"pycmpfunc\", a[0], b[0])\n...     return a[0] - b[0]\n...\n>>> qsort(ia, len(ia), sizeof(cint), pycmpfunc)\npycmpfunc 5 1\npycmpfunc 33 99\npycmpfunc 7 33\npycmpfunc 1 7\npycmpfunc 5 7\n>>>\n\nNote: Make sure you keep references to *note CFUNCTYPE(): 2cfa.\nobjects as long as they are used from C code.  *note ctypes: 28.\ndoesn't, and if you don't, they may be garbage collected, crashing\nyour program when a callback is made.\n\nAlso, note that if the callback function is called in a thread\ncreated outside of Python's control (e.g.  by the foreign code that\ncalls the callback), ctypes creates a new dummy Python thread on\nevery invocation.  This behavior is correct for most purposes, but\nit means that values stored with *note threading.local: 14bb. will\n'not' survive across different callbacks, even when those calls are\nmade from the same C thread.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Accessing values exported from dlls,  Next: Surprises,  Prev: Callback functions,  Up: ctypes tutorial": {
            "content": "5.16.16.20 Accessing values exported from dlls\n..............................................\n",
            "subsections": []
        },
        "Some shared libraries not only export functions, they also export": {
            "content": "variables.  An example in the Python library itself is the *note",
            "subsections": []
        },
        "PyVersion: 53d, Python runtime version number encoded in a single": {
            "content": "constant integer.\n\n*note ctypes: 28. can access values like this with the *note indll():\n2cfe. class methods of the type.  'pythonapi' is a predefined symbol\ngiving access to the Python C api:\n\n>>> version = ctypes.cint.indll(ctypes.pythonapi, \"PyVersion\")\n>>> print(hex(version.value))\n0x30c00a0\n",
            "subsections": []
        },
        "An extended example which also demonstrates the use of pointers accesses": {
            "content": "the *note PyImportFrozenModules: 2cff. pointer exported by Python.\n\nQuoting the docs for that value:\n\nThis pointer is initialized to point to an array of *note frozen:\n560. records, terminated by one whose members are all 'NULL' or\nzero.  When a frozen module is imported, it is searched in this\ntable.  Third-party code could play tricks with this to provide a\ndynamically created collection of frozen modules.\n",
            "subsections": []
        },
        "So manipulating this pointer could even prove useful.  To restrict the": {
            "content": "example size, we show only how this table can be read with *note ctypes:\n28.:\n\n>>> from ctypes import *\n>>>\n>>> class structfrozen(Structure):\n...     fields = [(\"name\", ccharp),\n...                 (\"code\", POINTER(cubyte)),\n...                 (\"size\", cint),\n...                 (\"getcode\", POINTER(cubyte)),  # Function pointer\n...                ]\n...\n>>>\n\nWe have defined the *note frozen: 560. data type, so we can get the\npointer to the table:\n\n>>> FrozenTable = POINTER(structfrozen)\n>>> table = FrozenTable.indll(pythonapi, \"PyImportFrozenBootstrap\")\n>>>\n",
            "subsections": []
        },
        "Since 'table' is a 'pointer' to the array of 'structfrozen' records, we": {
            "content": "can iterate over it, but we just have to make sure that our loop\nterminates, because pointers have no size.  Sooner or later it would\nprobably crash with an access violation or whatever, so it's better to\nbreak out of the loop when we hit the 'NULL' entry:\n\n>>> for item in table:\n...     if item.name is None:\n...         break\n...     print(item.name.decode(\"ascii\"), item.size)\n...\nfrozenimportlib 31764\nfrozenimportlibexternal 41499\nzipimport 12345\n>>>\n",
            "subsections": []
        },
        "The fact that standard Python has a frozen module and a frozen package": {
            "content": "(indicated by the negative 'size' member) is not well known, it is only\nused for testing.  Try it out with 'import hello' for example.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Surprises,  Next: Variable-sized data types,  Prev: Accessing values exported from dlls,  Up: ctypes tutorial": {
            "content": "5.16.16.21 Surprises\n....................\n\nThere are some edges in *note ctypes: 28. where you might expect\nsomething other than what actually happens.\n\nConsider the following example:\n\n>>> from ctypes import *\n>>> class POINT(Structure):\n...     fields = (\"x\", cint), (\"y\", cint)\n...\n>>> class RECT(Structure):\n...     fields = (\"a\", POINT), (\"b\", POINT)\n...\n>>> p1 = POINT(1, 2)\n>>> p2 = POINT(3, 4)\n>>> rc = RECT(p1, p2)\n>>> print(rc.a.x, rc.a.y, rc.b.x, rc.b.y)\n1 2 3 4\n>>> # now swap the two points\n>>> rc.a, rc.b = rc.b, rc.a\n>>> print(rc.a.x, rc.a.y, rc.b.x, rc.b.y)\n3 4 3 4\n>>>\n",
            "subsections": []
        },
        "Hm.  We certainly expected the last statement to print '3 4 1 2'.  What": {
            "content": "happened?  Here are the steps of the 'rc.a, rc.b = rc.b, rc.a' line\nabove:\n\n>>> temp0, temp1 = rc.b, rc.a\n>>> rc.a = temp0\n>>> rc.b = temp1\n>>>\n",
            "subsections": []
        },
        "Note that 'temp0' and 'temp1' are objects still using the internal": {
            "content": "buffer of the 'rc' object above.  So executing 'rc.a = temp0' copies the\nbuffer contents of 'temp0' into 'rc' 's buffer.  This, in turn, changes\nthe contents of 'temp1'.  So, the last assignment 'rc.b = temp1',\ndoesn't have the expected effect.\n",
            "subsections": []
        },
        "Keep in mind that retrieving sub-objects from Structure, Unions, and": {
            "content": "",
            "subsections": []
        },
        "Arrays doesn't 'copy' the sub-object, instead it retrieves a wrapper": {
            "content": "object accessing the root-object's underlying buffer.\n",
            "subsections": []
        },
        "Another example that may behave differently from what one would expect": {
            "content": "is this:\n\n>>> s = ccharp()\n>>> s.value = b\"abc def ghi\"\n>>> s.value\nb'abc def ghi'\n>>> s.value is s.value\nFalse\n>>>\n\nNote: Objects instantiated from *note ccharp: 2ccd. can only have\ntheir value set to bytes or integers.\n\nWhy is it printing 'False'?  ctypes instances are objects containing a\nmemory block plus some *note descriptor: 1c78.s accessing the contents\nof the memory.  Storing a Python object in the memory block does not\nstore the object itself, instead the 'contents' of the object is stored.\nAccessing the contents again constructs a new Python object each time!\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Variable-sized data types,  Prev: Surprises,  Up: ctypes tutorial": {
            "content": "5.16.16.22 Variable-sized data types\n....................................\n\n*note ctypes: 28. provides some support for variable-sized arrays and\nstructures.\n\nThe *note resize(): 2d04. function can be used to resize the memory\nbuffer of an existing ctypes object.  The function takes the object as\nfirst argument, and the requested size in bytes as the second argument.",
            "subsections": []
        },
        "The memory block cannot be made smaller than the natural memory block": {
            "content": "specified by the objects type, a *note ValueError: 183. is raised if\nthis is tried:\n\n>>> shortarray = (cshort * 4)()\n>>> print(sizeof(shortarray))\n8\n>>> resize(shortarray, 4)\nTraceback (most recent call last):\n...\nValueError: minimum size is 8\n>>> resize(shortarray, 32)\n>>> sizeof(shortarray)\n32\n>>> sizeof(type(shortarray))\n8\n>>>\n",
            "subsections": []
        },
        "This is nice and fine, but how would one access the additional elements": {
            "content": "contained in this array?  Since the type still only knows about 4\nelements, we get errors accessing other elements:\n\n>>> shortarray[:]\n[0, 0, 0, 0]\n>>> shortarray[7]\nTraceback (most recent call last):\n...\nIndexError: invalid index\n>>>\n\nAnother way to use variable-sized data types with *note ctypes: 28. is\nto use the dynamic nature of Python, and (re-)define the data type after\nthe required size is already known, on a case by case basis.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ctypes reference,  Prev: ctypes tutorial,  Up: ctypes -- A foreign function library for Python": {
            "content": "5.16.16.23 ctypes reference\n...........................\n\n* Menu:\n\n* Finding shared libraries::\n* Loading shared libraries::\n* Foreign functions::\n* Function prototypes::\n* Utility functions::\n* Data types::\n* Fundamental data types: Fundamental data types<2>.\n* Structured data types::\n* Arrays and pointers::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Finding shared libraries,  Next: Loading shared libraries,  Up: ctypes reference": {
            "content": "5.16.16.24 Finding shared libraries\n...................................\n",
            "subsections": []
        },
        "When programming in a compiled language, shared libraries are accessed": {
            "content": "when compiling/linking a program, and when the program is run.\n\nThe purpose of the *note findlibrary(): ba2. function is to locate a\nlibrary in a way similar to what the compiler or runtime loader does (on\nplatforms with several versions of a shared library the most recent\nshould be loaded), while the ctypes library loaders act like when a\nprogram is run, and call the runtime loader directly.\n",
            "subsections": []
        },
        "The 'ctypes.util' module provides a function which can help to determine": {
            "content": "the library to load.\n\n-- Data: ctypes.util.findlibrary (name)\n\nTry to find a library and return a pathname.  'name' is the library\nname without any prefix like 'lib', suffix like '.so', '.dylib' or\nversion number (this is the form used for the posix linker option\n'-l').  If no library can be found, returns 'None'.\n\nThe exact functionality is system dependent.\n\nOn Linux, *note findlibrary(): ba2. tries to run external programs\n('/sbin/ldconfig', 'gcc', 'objdump' and 'ld') to find the library file.\nIt returns the filename of the library file.\n",
            "subsections": []
        },
        "Changed in version 3.6: On Linux, the value of the environment variable": {
            "content": "'LDLIBRARYPATH' is used when searching for libraries, if a library\ncannot be found by any other means.\n\nHere are some examples:\n\n>>> from ctypes.util import findlibrary\n>>> findlibrary(\"m\")\n'libm.so.6'\n>>> findlibrary(\"c\")\n'libc.so.6'\n>>> findlibrary(\"bz2\")\n'libbz2.so.1.0'\n>>>\n\nOn macOS, *note findlibrary(): ba2. tries several predefined naming\nschemes and paths to locate the library, and returns a full pathname if\nsuccessful:\n\n>>> from ctypes.util import findlibrary\n>>> findlibrary(\"c\")\n'/usr/lib/libc.dylib'\n>>> findlibrary(\"m\")\n'/usr/lib/libm.dylib'\n>>> findlibrary(\"bz2\")\n'/usr/lib/libbz2.dylib'\n>>> findlibrary(\"AGL\")\n'/System/Library/Frameworks/AGL.framework/AGL'\n>>>\n\nOn Windows, *note findlibrary(): ba2. searches along the system search\npath, and returns the full pathname, but since there is no predefined\nnaming scheme a call like 'findlibrary(\"c\")' will fail and return\n'None'.\n\nIf wrapping a shared library with *note ctypes: 28, it 'may' be better\nto determine the shared library name at development time, and hardcode\nthat into the wrapper module instead of using *note findlibrary(): ba2.\nto locate the library at runtime.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Loading shared libraries,  Next: Foreign functions,  Prev: Finding shared libraries,  Up: ctypes reference": {
            "content": "5.16.16.25 Loading shared libraries\n...................................\n\nThere are several ways to load shared libraries into the Python process.\nOne way is to instantiate one of the following classes:\n\n-- Class: ctypes.CDLL (name, mode=DEFAULTMODE, handle=None,\nuseerrno=False, uselasterror=False, winmode=None)\n\nInstances of this class represent loaded shared libraries.\nFunctions in these libraries use the standard C calling convention,\nand are assumed to return int.\n\nOn Windows creating a *note CDLL: 80f. instance may fail even if\nthe DLL name exists.  When a dependent DLL of the loaded DLL is not\nfound, a *note OSError: 613. error is raised with the message\n'\"[WinError 126] The specified module could not be found\".'  This\nerror message does not contain the name of the missing DLL because\nthe Windows API does not return this information making this error\nhard to diagnose.  To resolve this error and determine which DLL is\nnot found, you need to find the list of dependent DLLs and\ndetermine which one is not found using Windows debugging and\ntracing tools.\n\nChanged in version 3.12: The 'name' parameter can now be a *note\npath-like object: 957.\n\nSee also\n........\n\nMicrosoft DUMPBIN tool(1) - A tool to find DLL dependents.\n\n-- Class: ctypes.OleDLL (name, mode=DEFAULTMODE, handle=None,\nuseerrno=False, uselasterror=False, winmode=None)\n\nWindows only: Instances of this class represent loaded shared\nlibraries, functions in these libraries use the 'stdcall' calling\nconvention, and are assumed to return the windows specific *note\nHRESULT: 2d0b. code.  *note HRESULT: 2d0b. values contain\ninformation specifying whether the function call failed or\nsucceeded, together with additional error code.  If the return\nvalue signals a failure, an *note OSError: 613. is automatically\nraised.\n\nChanged in version 3.3: *note WindowsError: ecd. used to be raised,\nwhich is now an alias of *note OSError: 613.\n\nChanged in version 3.12: The 'name' parameter can now be a *note\npath-like object: 957.\n\n-- Class: ctypes.WinDLL (name, mode=DEFAULTMODE, handle=None,\nuseerrno=False, uselasterror=False, winmode=None)\n\nWindows only: Instances of this class represent loaded shared\nlibraries, functions in these libraries use the 'stdcall' calling\nconvention, and are assumed to return int by default.\n\nChanged in version 3.12: The 'name' parameter can now be a *note\npath-like object: 957.\n\nThe Python *note global interpreter lock: 141. is released before\ncalling any function exported by these libraries, and reacquired\nafterwards.\n\n-- Class: ctypes.PyDLL (name, mode=DEFAULTMODE, handle=None)\n\nInstances of this class behave like *note CDLL: 80f. instances,\nexcept that the Python GIL is 'not' released during the function\ncall, and after the function execution the Python error flag is\nchecked.  If the error flag is set, a Python exception is raised.\n\nThus, this is only useful to call Python C api functions directly.\n\nChanged in version 3.12: The 'name' parameter can now be a *note\npath-like object: 957.\n",
            "subsections": []
        },
        "All these classes can be instantiated by calling them with at least one": {
            "content": "argument, the pathname of the shared library.  If you have an existing\nhandle to an already loaded shared library, it can be passed as the\n'handle' named parameter, otherwise the underlying platforms 'dlopen()'\nor 'LoadLibrary()' function is used to load the library into the\nprocess, and to get a handle to it.\n\nThe 'mode' parameter can be used to specify how the library is loaded.",
            "subsections": []
        },
        "For details, consult the 'dlopen(3)' manpage.  On Windows, 'mode' is": {
            "content": "ignored.  On posix systems, RTLDNOW is always added, and is not\nconfigurable.\n",
            "subsections": []
        },
        "The 'useerrno' parameter, when set to true, enables a ctypes mechanism": {
            "content": "that allows accessing the system *note errno: 52. error number in a safe\nway.  *note ctypes: 28. maintains a thread-local copy of the systems\n*note errno: 52. variable; if you call foreign functions created with\n'useerrno=True' then the *note errno: 52. value before the function\ncall is swapped with the ctypes private copy, the same happens\nimmediately after the function call.\n\nThe function *note ctypes.geterrno(): 2d0c. returns the value of the\nctypes private copy, and the function *note ctypes.seterrno(): 2d0d.\nchanges the ctypes private copy to a new value and returns the former\nvalue.\n",
            "subsections": []
        },
        "The 'uselasterror' parameter, when set to true, enables the same": {
            "content": "mechanism for the Windows error code which is managed by the *note\nGetLastError(): 2cdd. and 'SetLastError()' Windows API functions; *note\nctypes.getlasterror(): 2d0e. and *note ctypes.setlasterror(): 2d0f.\nare used to request and change the ctypes private copy of the windows\nerror code.\n",
            "subsections": []
        },
        "The 'winmode' parameter is used on Windows to specify how the library is": {
            "content": "loaded (since 'mode' is ignored).  It takes any value that is valid for\nthe Win32 API 'LoadLibraryEx' flags parameter.  When omitted, the\ndefault is to use the flags that result in the most secure DLL load,\nwhich avoids issues such as DLL hijacking.  Passing the full path to the\nDLL is the safest way to ensure the correct library and dependencies are\nloaded.\n\nChanged in version 3.8: Added 'winmode' parameter.\n\n-- Data: ctypes.RTLDGLOBAL\n\nFlag to use as 'mode' parameter.  On platforms where this flag is\nnot available, it is defined as the integer zero.\n\n-- Data: ctypes.RTLDLOCAL\n\nFlag to use as 'mode' parameter.  On platforms where this is not\navailable, it is the same as 'RTLDGLOBAL'.\n\n-- Data: ctypes.DEFAULTMODE\n\nThe default mode which is used to load shared libraries.  On OSX\n10.3, this is 'RTLDGLOBAL', otherwise it is the same as\n'RTLDLOCAL'.\n",
            "subsections": []
        },
        "Instances of these classes have no public methods.  Functions exported": {
            "content": "by the shared library can be accessed as attributes or by index.  Please\nnote that accessing the function through an attribute caches the result\nand therefore accessing it repeatedly returns the same object each time.",
            "subsections": []
        },
        "On the other hand, accessing it through an index returns a new object": {
            "content": "each time:\n\n>>> from ctypes import CDLL\n>>> libc = CDLL(\"libc.so.6\")  # On Linux\n>>> libc.time == libc.time\nTrue\n>>> libc['time'] == libc['time']\nFalse\n",
            "subsections": []
        },
        "The following public attributes are available, their name starts with an": {
            "content": "underscore to not clash with exported function names:\n\n-- Attribute: PyDLL.handle\n\nThe system handle used to access the library.\n\n-- Attribute: PyDLL.name\n\nThe name of the library passed in the constructor.\n",
            "subsections": []
        },
        "Shared libraries can also be loaded by using one of the prefabricated": {
            "content": "objects, which are instances of the *note LibraryLoader: 2d12. class,\neither by calling the *note LoadLibrary(): 2cbb. method, or by\nretrieving the library as attribute of the loader instance.\n\n-- Class: ctypes.LibraryLoader (dlltype)\n\nClass which loads shared libraries.  'dlltype' should be one of the\n*note CDLL: 80f, *note PyDLL: 14c5, *note WinDLL: 14c4, or *note\nOleDLL: 14c3. types.\n\n'getattr()' has special behavior: It allows loading a shared\nlibrary by accessing it as attribute of a library loader instance.\nThe result is cached, so repeated attribute accesses return the\nsame library each time.\n\n-- Method: LoadLibrary (name)\n\nLoad a shared library into the process and return it.  This\nmethod always returns a new instance of the library.\n\nThese prefabricated library loaders are available:\n\n-- Data: ctypes.cdll\n\nCreates *note CDLL: 80f. instances.\n\n-- Data: ctypes.windll\n\nWindows only: Creates *note WinDLL: 14c4. instances.\n\n-- Data: ctypes.oledll\n\nWindows only: Creates *note OleDLL: 14c3. instances.\n\n-- Data: ctypes.pydll\n\nCreates *note PyDLL: 14c5. instances.\n",
            "subsections": []
        },
        "For accessing the C Python api directly, a ready-to-use Python shared": {
            "content": "library object is available:\n\n-- Data: ctypes.pythonapi\n\nAn instance of *note PyDLL: 14c5. that exposes Python C API\nfunctions as attributes.  Note that all these functions are assumed\nto return C int, which is of course not always the truth, so you\nhave to assign the correct 'restype' attribute to use these\nfunctions.\n\nLoading a library through any of these objects raises an *note auditing\nevent: 161d. 'ctypes.dlopen' with string argument 'name', the name used\nto load the library.\n",
            "subsections": []
        },
        "Accessing a function on a loaded library raises an auditing event": {
            "content": "'ctypes.dlsym' with arguments 'library' (the library object) and 'name'\n(the symbol's name as a string or integer).\n",
            "subsections": []
        },
        "In cases when only the library handle is available rather than the": {
            "content": "object, accessing a function raises an auditing event\n'ctypes.dlsym/handle' with arguments 'handle' (the raw library handle)\nand 'name'.\n\n---------- Footnotes ----------\n\n(1) https://docs.microsoft.com/cpp/build/reference/dependents\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Foreign functions,  Next: Function prototypes,  Prev: Loading shared libraries,  Up: ctypes reference": {
            "content": "5.16.16.26 Foreign functions\n............................\n",
            "subsections": []
        },
        "As explained in the previous section, foreign functions can be accessed": {
            "content": "as attributes of loaded shared libraries.  The function objects created\nin this way by default accept any number of arguments, accept any ctypes\ndata instances as arguments, and return the default result type\nspecified by the library loader.  They are instances of a private class:\n\n-- Class: ctypes.FuncPtr\n\nBase class for C callable foreign functions.\n\nInstances of foreign functions are also C compatible data types;\nthey represent C function pointers.\n\nThis behavior can be customized by assigning to special attributes\nof the foreign function object.\n\n-- Attribute: restype\n\nAssign a ctypes type to specify the result type of the foreign\nfunction.  Use 'None' for void, a function not returning\nanything.\n\nIt is possible to assign a callable Python object that is not\na ctypes type, in this case the function is assumed to return\na C int, and the callable will be called with this integer,\nallowing further processing or error checking.  Using this is\ndeprecated, for more flexible post processing or error\nchecking use a ctypes data type as 'restype' and assign a\ncallable to the *note errcheck: 2cde. attribute.\n\n-- Attribute: argtypes\n\nAssign a tuple of ctypes types to specify the argument types\nthat the function accepts.  Functions using the 'stdcall'\ncalling convention can only be called with the same number of\narguments as the length of this tuple; functions using the C\ncalling convention accept additional, unspecified arguments as\nwell.\n\nWhen a foreign function is called, each actual argument is\npassed to the *note fromparam(): 2cd9. class method of the\nitems in the *note argtypes: 2cd4. tuple, this method allows\nadapting the actual argument to an object that the foreign\nfunction accepts.  For example, a *note ccharp: 2ccd. item\nin the *note argtypes: 2cd4. tuple will convert a string\npassed as argument into a bytes object using ctypes conversion\nrules.\n\nNew: It is now possible to put items in argtypes which are not\nctypes types, but each item must have a *note fromparam():\n2cd9. method which returns a value usable as argument\n(integer, string, ctypes instance).  This allows defining\nadapters that can adapt custom objects as function parameters.\n\n-- Attribute: errcheck\n\nAssign a Python function or another callable to this\nattribute.  The callable will be called with three or more\narguments:\n\n-- Function: callable (result, func, arguments)\n\n'result' is what the foreign function returns, as\nspecified by the 'restype' attribute.\n\n'func' is the foreign function object itself, this allows\nreusing the same callable object to check or post process\nthe results of several functions.\n\n'arguments' is a tuple containing the parameters\noriginally passed to the function call, this allows\nspecializing the behavior on the arguments used.\n\nThe object that this function returns will be returned from\nthe foreign function call, but it can also check the result\nvalue and raise an exception if the foreign function call\nfailed.\n\n-- Exception: ctypes.ArgumentError\n\nThis exception is raised when a foreign function call cannot\nconvert one of the passed arguments.\n",
            "subsections": []
        },
        "On Windows, when a foreign function call raises a system exception (for": {
            "content": "example, due to an access violation), it will be captured and replaced\nwith a suitable Python exception.  Further, an auditing event\n'ctypes.setexception' with argument 'code' will be raised, allowing an\naudit hook to replace the exception with its own.\n",
            "subsections": []
        },
        "Some ways to invoke foreign function calls may raise an auditing event": {
            "content": "'ctypes.callfunction' with arguments 'function pointer' and\n'arguments'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Function prototypes,  Next: Utility functions,  Prev: Foreign functions,  Up: ctypes reference": {
            "content": "5.16.16.27 Function prototypes\n..............................\n",
            "subsections": []
        },
        "Foreign functions can also be created by instantiating function": {
            "content": "prototypes.  Function prototypes are similar to function prototypes in\nC; they describe a function (return type, argument types, calling\nconvention) without defining an implementation.  The factory functions\nmust be called with the desired result type and the argument types of\nthe function, and can be used as decorator factories, and as such, be\napplied to functions through the '@wrapper' syntax.  See *note Callback\nfunctions: 2cf9. for examples.\n\n-- Function: ctypes.CFUNCTYPE (restype, *argtypes, useerrno=False,\nuselasterror=False)\n\nThe returned function prototype creates functions that use the\nstandard C calling convention.  The function will release the GIL\nduring the call.  If 'useerrno' is set to true, the ctypes private\ncopy of the system *note errno: 52. variable is exchanged with the\nreal *note errno: 52. value before and after the call;\n'uselasterror' does the same for the Windows error code.\n\n-- Function: ctypes.WINFUNCTYPE (restype, *argtypes, useerrno=False,\nuselasterror=False)\n\nWindows only: The returned function prototype creates functions\nthat use the 'stdcall' calling convention.  The function will\nrelease the GIL during the call.  'useerrno' and 'uselasterror'\nhave the same meaning as above.\n\n-- Function: ctypes.PYFUNCTYPE (restype, *argtypes)\n\nThe returned function prototype creates functions that use the\nPython calling convention.  The function will 'not' release the GIL\nduring the call.\n",
            "subsections": []
        },
        "Function prototypes created by these factory functions can be": {
            "content": "instantiated in different ways, depending on the type and number of the\nparameters in the call:\n\n-- Function: prototype (address)\n\nReturns a foreign function at the specified address which must be\nan integer.\n\n-- Function: prototype (callable)\n\nCreate a C callable function (a callback function) from a Python\n'callable'.\n\n-- Function: prototype (funcspec[, paramflags])\n\nReturns a foreign function exported by a shared library.\n'funcspec' must be a 2-tuple '(nameorordinal, library)'.  The\nfirst item is the name of the exported function as string, or the\nordinal of the exported function as small integer.  The second item\nis the shared library instance.\n\n-- Function: prototype (vtblindex, name[, paramflags[, iid]])\n\nReturns a foreign function that will call a COM method.\n'vtblindex' is the index into the virtual function table, a small\nnon-negative integer.  'name' is name of the COM method.  'iid' is\nan optional pointer to the interface identifier which is used in\nextended error reporting.\n\nCOM methods use a special calling convention: They require a\npointer to the COM interface as first argument, in addition to\nthose parameters that are specified in the 'argtypes' tuple.\n",
            "subsections": []
        },
        "The optional 'paramflags' parameter creates foreign function wrappers": {
            "content": "with much more functionality than the features described above.\n\n'paramflags' must be a tuple of the same length as *note argtypes: 2cd4.\n",
            "subsections": []
        },
        "Each item in this tuple contains further information about a parameter,": {
            "content": "it must be a tuple containing one, two, or three items.\n",
            "subsections": []
        },
        "The first item is an integer containing a combination of direction flags": {
            "content": "for the parameter:\n\n1\n\nSpecifies an input parameter to the function.\n\n2\n\nOutput parameter.  The foreign function fills in a value.\n\n4\n\nInput parameter which defaults to the integer zero.\n",
            "subsections": []
        },
        "The optional second item is the parameter name as string.  If this is": {
            "content": "specified, the foreign function can be called with named parameters.\n\nThe optional third item is the default value for this parameter.\n",
            "subsections": []
        },
        "The following example demonstrates how to wrap the Windows 'MessageBoxW'": {
            "content": "function so that it supports default parameters and named arguments.\nThe C declaration from the windows header file is this:\n\nWINUSERAPI int WINAPI\nMessageBoxW(\nHWND hWnd,\nLPCWSTR lpText,\nLPCWSTR lpCaption,\nUINT uType);\n\nHere is the wrapping with *note ctypes: 28.:\n\n>>> from ctypes import cint, WINFUNCTYPE, windll\n>>> from ctypes.wintypes import HWND, LPCWSTR, UINT\n>>> prototype = WINFUNCTYPE(cint, HWND, LPCWSTR, LPCWSTR, UINT)\n>>> paramflags = (1, \"hwnd\", 0), (1, \"text\", \"Hi\"), (1, \"caption\", \"Hello from ctypes\"), (1, \"flags\", 0)\n>>> MessageBox = prototype((\"MessageBoxW\", windll.user32), paramflags)\n\nThe 'MessageBox' foreign function can now be called in these ways:\n\n>>> MessageBox()\n>>> MessageBox(text=\"Spam, spam, spam\")\n>>> MessageBox(flags=2, text=\"foo bar\")\n\nA second example demonstrates output parameters.  The win32\n'GetWindowRect' function retrieves the dimensions of a specified window\nby copying them into 'RECT' structure that the caller has to supply.\nHere is the C declaration:\n\nWINUSERAPI BOOL WINAPI\nGetWindowRect(\nHWND hWnd,\nLPRECT lpRect);\n\nHere is the wrapping with *note ctypes: 28.:\n\n>>> from ctypes import POINTER, WINFUNCTYPE, windll, WinError\n>>> from ctypes.wintypes import BOOL, HWND, RECT\n>>> prototype = WINFUNCTYPE(BOOL, HWND, POINTER(RECT))\n>>> paramflags = (1, \"hwnd\"), (2, \"lprect\")\n>>> GetWindowRect = prototype((\"GetWindowRect\", windll.user32), paramflags)\n>>>\n",
            "subsections": []
        },
        "Functions with output parameters will automatically return the output": {
            "content": "parameter value if there is a single one, or a tuple containing the\noutput parameter values when there are more than one, so the\nGetWindowRect function now returns a RECT instance, when called.\n\nOutput parameters can be combined with the *note errcheck: 2cde.\nprotocol to do further output processing and error checking.  The win32\n'GetWindowRect' api function returns a 'BOOL' to signal success or\nfailure, so this function could do the error checking, and raises an\nexception when the api call failed:\n\n>>> def errcheck(result, func, args):\n...     if not result:\n...         raise WinError()\n...     return args\n...\n>>> GetWindowRect.errcheck = errcheck\n>>>\n\nIf the *note errcheck: 2cde. function returns the argument tuple it\nreceives unchanged, *note ctypes: 28. continues the normal processing it\ndoes on the output parameters.  If you want to return a tuple of window\ncoordinates instead of a 'RECT' instance, you can retrieve the fields in\nthe function and return them instead, the normal processing will no\nlonger take place:\n\n>>> def errcheck(result, func, args):\n...     if not result:\n...         raise WinError()\n...     rc = args[1]\n...     return rc.left, rc.top, rc.bottom, rc.right\n...\n>>> GetWindowRect.errcheck = errcheck\n>>>\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Utility functions,  Next: Data types,  Prev: Function prototypes,  Up: ctypes reference": {
            "content": "5.16.16.28 Utility functions\n............................\n\n-- Function: ctypes.addressof (obj)\n\nReturns the address of the memory buffer as integer.  'obj' must be\nan instance of a ctypes type.\n\nRaises an *note auditing event: 161d. 'ctypes.addressof' with\nargument 'obj'.\n\n-- Function: ctypes.alignment (objortype)\n\nReturns the alignment requirements of a ctypes type.  'objortype'\nmust be a ctypes type or instance.\n\n-- Function: ctypes.byref (obj[, offset])\n\nReturns a light-weight pointer to 'obj', which must be an instance\nof a ctypes type.  'offset' defaults to zero, and must be an\ninteger that will be added to the internal pointer value.\n\n'byref(obj, offset)' corresponds to this C code:\n\n(((char *)&obj) + offset)\n\nThe returned object can only be used as a foreign function call\nparameter.  It behaves similar to 'pointer(obj)', but the\nconstruction is a lot faster.\n\n-- Function: ctypes.cast (obj, type)\n\nThis function is similar to the cast operator in C. It returns a\nnew instance of 'type' which points to the same memory block as\n'obj'.  'type' must be a pointer type, and 'obj' must be an object\nthat can be interpreted as a pointer.\n\n-- Function: ctypes.createstringbuffer (initorsize, size=None)\n\nThis function creates a mutable character buffer.  The returned\nobject is a ctypes array of *note cchar: 2cc3.\n\n'initorsize' must be an integer which specifies the size of the\narray, or a bytes object which will be used to initialize the array\nitems.\n\nIf a bytes object is specified as first argument, the buffer is\nmade one item larger than its length so that the last element in\nthe array is a NUL termination character.  An integer can be passed\nas second argument which allows specifying the size of the array if\nthe length of the bytes should not be used.\n\nRaises an *note auditing event: 161d. 'ctypes.createstringbuffer'\nwith arguments 'init', 'size'.\n\n-- Function: ctypes.createunicodebuffer (initorsize, size=None)\n\nThis function creates a mutable unicode character buffer.  The\nreturned object is a ctypes array of *note cwchar: 2cc4.\n\n'initorsize' must be an integer which specifies the size of the\narray, or a string which will be used to initialize the array\nitems.\n\nIf a string is specified as first argument, the buffer is made one\nitem larger than the length of the string so that the last element\nin the array is a NUL termination character.  An integer can be\npassed as second argument which allows specifying the size of the\narray if the length of the string should not be used.\n\nRaises an *note auditing event: 161d.\n'ctypes.createunicodebuffer' with arguments 'init', 'size'.\n\n-- Function: ctypes.DllCanUnloadNow ()\n\nWindows only: This function is a hook which allows implementing\nin-process COM servers with ctypes.  It is called from the\nDllCanUnloadNow function that the ctypes extension dll exports.\n\n-- Function: ctypes.DllGetClassObject ()\n\nWindows only: This function is a hook which allows implementing\nin-process COM servers with ctypes.  It is called from the\nDllGetClassObject function that the 'ctypes' extension dll\nexports.\n\n-- Function: ctypes.util.findlibrary (name)\n\nTry to find a library and return a pathname.  'name' is the library\nname without any prefix like 'lib', suffix like '.so', '.dylib' or\nversion number (this is the form used for the posix linker option\n'-l').  If no library can be found, returns 'None'.\n\nThe exact functionality is system dependent.\n\n-- Function: ctypes.util.findmsvcrt ()\n\nWindows only: return the filename of the VC runtime library used by\nPython, and by the extension modules.  If the name of the library\ncannot be determined, 'None' is returned.\n\nIf you need to free memory, for example, allocated by an extension\nmodule with a call to the 'free(void *)', it is important that you\nuse the function in the same library that allocated the memory.\n\n-- Function: ctypes.FormatError ([code])\n\nWindows only: Returns a textual description of the error code\n'code'.  If no error code is specified, the last error code is used\nby calling the Windows api function GetLastError.\n\n-- Function: ctypes.GetLastError ()\n\nWindows only: Returns the last error code set by Windows in the\ncalling thread.  This function calls the Windows 'GetLastError()'\nfunction directly, it does not return the ctypes-private copy of\nthe error code.\n\n-- Function: ctypes.geterrno ()\n\nReturns the current value of the ctypes-private copy of the system\n*note errno: 52. variable in the calling thread.\n\nRaises an *note auditing event: 161d. 'ctypes.geterrno' with no\narguments.\n\n-- Function: ctypes.getlasterror ()\n\nWindows only: returns the current value of the ctypes-private copy\nof the system 'LastError' variable in the calling thread.\n\nRaises an *note auditing event: 161d. 'ctypes.getlasterror' with\nno arguments.\n\n-- Function: ctypes.memmove (dst, src, count)\n\nSame as the standard C memmove library function: copies 'count'\nbytes from 'src' to 'dst'.  'dst' and 'src' must be integers or\nctypes instances that can be converted to pointers.\n\n-- Function: ctypes.memset (dst, c, count)\n\nSame as the standard C memset library function: fills the memory\nblock at address 'dst' with 'count' bytes of value 'c'.  'dst' must\nbe an integer specifying an address, or a ctypes instance.\n\n-- Function: ctypes.POINTER (type, /)\n\nCreate and return a new ctypes pointer type.  Pointer types are\ncached and reused internally, so calling this function repeatedly\nis cheap.  'type' must be a ctypes type.\n\n-- Function: ctypes.pointer (obj, /)\n\nCreate a new pointer instance, pointing to 'obj'.  The returned\nobject is of the type 'POINTER(type(obj))'.\n\nNote: If you just want to pass a pointer to an object to a foreign\nfunction call, you should use 'byref(obj)' which is much faster.\n\n-- Function: ctypes.resize (obj, size)\n\nThis function resizes the internal memory buffer of 'obj', which\nmust be an instance of a ctypes type.  It is not possible to make\nthe buffer smaller than the native size of the objects type, as\ngiven by 'sizeof(type(obj))', but it is possible to enlarge the\nbuffer.\n\n-- Function: ctypes.seterrno (value)\n\nSet the current value of the ctypes-private copy of the system\n*note errno: 52. variable in the calling thread to 'value' and\nreturn the previous value.\n\nRaises an *note auditing event: 161d. 'ctypes.seterrno' with\nargument 'errno'.\n\n-- Function: ctypes.setlasterror (value)\n\nWindows only: set the current value of the ctypes-private copy of\nthe system 'LastError' variable in the calling thread to 'value'\nand return the previous value.\n\nRaises an *note auditing event: 161d. 'ctypes.setlasterror' with\nargument 'error'.\n\n-- Function: ctypes.sizeof (objortype)\n\nReturns the size in bytes of a ctypes type or instance memory\nbuffer.  Does the same as the C 'sizeof' operator.\n\n-- Function: ctypes.stringat (address, size=-1)\n\nThis function returns the C string starting at memory address\n'address' as a bytes object.  If size is specified, it is used as\nsize, otherwise the string is assumed to be zero-terminated.\n\nRaises an *note auditing event: 161d. 'ctypes.stringat' with\narguments 'address', 'size'.\n\n-- Function: ctypes.WinError (code=None, descr=None)\n\nWindows only: this function is probably the worst-named thing in\nctypes.  It creates an instance of *note OSError: 613.  If 'code'\nis not specified, 'GetLastError' is called to determine the error\ncode.  If 'descr' is not specified, *note FormatError(): 2d21. is\ncalled to get a textual description of the error.\n\nChanged in version 3.3: An instance of *note WindowsError: ecd.\nused to be created, which is now an alias of *note OSError: 613.\n\n-- Function: ctypes.wstringat (address, size=-1)\n\nThis function returns the wide character string starting at memory\naddress 'address' as a string.  If 'size' is specified, it is used\nas the number of characters of the string, otherwise the string is\nassumed to be zero-terminated.\n\nRaises an *note auditing event: 161d. 'ctypes.wstringat' with\narguments 'address', 'size'.\n\nFile: python3.12.info,  Node: Data types,  Next: Fundamental data types<2>,  Prev: Utility functions,  Up: ctypes reference\n\n5.16.16.29 Data types\n.....................\n\n-- Class: ctypes.CData\n\nThis non-public class is the common base class of all ctypes data\ntypes.  Among other things, all ctypes type instances contain a\nmemory block that hold C compatible data; the address of the memory\nblock is returned by the *note addressof(): 2d1c. helper function.\nAnother instance variable is exposed as *note objects: 2d2b.; this\ncontains other Python objects that need to be kept alive in case\nthe memory block contains pointers.\n\nCommon methods of ctypes data types, these are all class methods\n(to be exact, they are methods of the *note metaclass: 1c8e.):\n\n-- Method: frombuffer (source[, offset])\n\nThis method returns a ctypes instance that shares the buffer\nof the 'source' object.  The 'source' object must support the\nwriteable buffer interface.  The optional 'offset' parameter\nspecifies an offset into the source buffer in bytes; the\ndefault is zero.  If the source buffer is not large enough a\n*note ValueError: 183. is raised.\n\nRaises an *note auditing event: 161d. 'ctypes.cdata/buffer'\nwith arguments 'pointer', 'size', 'offset'.\n\n-- Method: frombuffercopy (source[, offset])\n\nThis method creates a ctypes instance, copying the buffer from\nthe 'source' object buffer which must be readable.  The\noptional 'offset' parameter specifies an offset into the\nsource buffer in bytes; the default is zero.  If the source\nbuffer is not large enough a *note ValueError: 183. is raised.\n\nRaises an *note auditing event: 161d. 'ctypes.cdata/buffer'\nwith arguments 'pointer', 'size', 'offset'.\n\n-- Method: fromaddress (address)\n\nThis method returns a ctypes type instance using the memory\nspecified by 'address' which must be an integer.\n\nThis method, and others that indirectly call this method,\nraises an *note auditing event: 161d. 'ctypes.cdata' with\nargument 'address'.\n\n-- Method: fromparam (obj)\n\nThis method adapts 'obj' to a ctypes type.  It is called with\nthe actual object used in a foreign function call when the\ntype is present in the foreign function's *note argtypes:\n2cd4. tuple; it must return an object that can be used as a\nfunction call parameter.\n\nAll ctypes data types have a default implementation of this\nclassmethod that normally returns 'obj' if that is an instance\nof the type.  Some types accept other objects as well.\n\n-- Method: indll (library, name)\n\nThis method returns a ctypes type instance exported by a\nshared library.  'name' is the name of the symbol that exports\nthe data, 'library' is the loaded shared library.\n\nCommon instance variables of ctypes data types:\n\n-- Attribute: bbase\n\nSometimes ctypes data instances do not own the memory block\nthey contain, instead they share part of the memory block of a\nbase object.  The *note bbase: 2d2f. read-only member is\nthe root ctypes object that owns the memory block.\n\n-- Attribute: bneedsfree\n\nThis read-only variable is true when the ctypes data instance\nhas allocated the memory block itself, false otherwise.\n\n-- Attribute: objects\n\nThis member is either 'None' or a dictionary containing Python\nobjects that need to be kept alive so that the memory block\ncontents is kept valid.  This object is only exposed for\ndebugging; never modify the contents of this dictionary.\n\nFile: python3.12.info,  Node: Fundamental data types<2>,  Next: Structured data types,  Prev: Data types,  Up: ctypes reference\n\n5.16.16.30 Fundamental data types\n.................................\n\n-- Class: ctypes.SimpleCData\n\nThis non-public class is the base class of all fundamental ctypes\ndata types.  It is mentioned here because it contains the common\nattributes of the fundamental ctypes data types.  *note\nSimpleCData: 2d33. is a subclass of *note CData: 2d2a, so it\ninherits their methods and attributes.  ctypes data types that are\nnot and do not contain pointers can now be pickled.\n\nInstances have a single attribute:\n\n-- Attribute: value\n\nThis attribute contains the actual value of the instance.  For\ninteger and pointer types, it is an integer, for character\ntypes, it is a single character bytes object or string, for\ncharacter pointer types it is a Python bytes object or string.\n\nWhen the 'value' attribute is retrieved from a ctypes\ninstance, usually a new object is returned each time.  *note\nctypes: 28. does 'not' implement original object return,\nalways a new object is constructed.  The same is true for all\nother ctypes object instances.\n",
            "subsections": []
        },
        "Fundamental data types, when returned as foreign function call results,": {
            "content": "or, for example, by retrieving structure field members or array items,\nare transparently converted to native Python types.  In other words, if\na foreign function has a *note restype: 2cdc. of *note ccharp: 2ccd,\nyou will always receive a Python bytes object, 'not' a *note ccharp:\n2ccd. instance.\n\nSubclasses of fundamental data types do 'not' inherit this behavior.\nSo, if a foreign functions 'restype' is a subclass of *note cvoidp:\n2cce, you will receive an instance of this subclass from the function\ncall.  Of course, you can get the value of the pointer by accessing the\n'value' attribute.\n\nThese are the fundamental ctypes data types:\n\n-- Class: ctypes.cbyte\n\nRepresents the C signed char datatype, and interprets the value as\nsmall integer.  The constructor accepts an optional integer\ninitializer; no overflow checking is done.\n\n-- Class: ctypes.cchar\n\nRepresents the C char datatype, and interprets the value as a\nsingle character.  The constructor accepts an optional string\ninitializer, the length of the string must be exactly one\ncharacter.\n\n-- Class: ctypes.ccharp\n\nRepresents the C char* datatype when it points to a zero-terminated\nstring.  For a general character pointer that may also point to\nbinary data, 'POINTER(cchar)' must be used.  The constructor\naccepts an integer address, or a bytes object.\n\n-- Class: ctypes.cdouble\n\nRepresents the C double datatype.  The constructor accepts an\noptional float initializer.\n\n-- Class: ctypes.clongdouble\n\nRepresents the C long double datatype.  The constructor accepts an\noptional float initializer.  On platforms where 'sizeof(long\ndouble) == sizeof(double)' it is an alias to *note cdouble: 165f.\n\n-- Class: ctypes.cfloat\n\nRepresents the C float datatype.  The constructor accepts an\noptional float initializer.\n\n-- Class: ctypes.cint\n\nRepresents the C signed int datatype.  The constructor accepts an\noptional integer initializer; no overflow checking is done.  On\nplatforms where 'sizeof(int) == sizeof(long)' it is an alias to\n*note clong: 2cb8.\n\n-- Class: ctypes.cint8\n\nRepresents the C 8-bit signed int datatype.  Usually an alias for\n*note cbyte: 14c1.\n\n-- Class: ctypes.cint16\n\nRepresents the C 16-bit signed int datatype.  Usually an alias for\n*note cshort: 2cc5.\n\n-- Class: ctypes.cint32\n\nRepresents the C 32-bit signed int datatype.  Usually an alias for\n*note cint: 2cb7.\n\n-- Class: ctypes.cint64\n\nRepresents the C 64-bit signed int datatype.  Usually an alias for\n*note clonglong: 2cc9.\n\n-- Class: ctypes.clong\n\nRepresents the C signed long datatype.  The constructor accepts an\noptional integer initializer; no overflow checking is done.\n\n-- Class: ctypes.clonglong\n\nRepresents the C signed long long datatype.  The constructor\naccepts an optional integer initializer; no overflow checking is\ndone.\n\n-- Class: ctypes.cshort\n\nRepresents the C signed short datatype.  The constructor accepts an\noptional integer initializer; no overflow checking is done.\n\n-- Class: ctypes.csizet\n\nRepresents the C 'sizet' datatype.\n\n-- Class: ctypes.cssizet\n\nRepresents the C 'ssizet' datatype.\n\nNew in version 3.2.\n\n-- Class: ctypes.ctimet\n\nRepresents the C 'timet' datatype.\n\nNew in version 3.12.\n\n-- Class: ctypes.cubyte\n\nRepresents the C unsigned char datatype, it interprets the value as\nsmall integer.  The constructor accepts an optional integer\ninitializer; no overflow checking is done.\n\n-- Class: ctypes.cuint\n\nRepresents the C unsigned int datatype.  The constructor accepts an\noptional integer initializer; no overflow checking is done.  On\nplatforms where 'sizeof(int) == sizeof(long)' it is an alias for\n*note culong: 2cc8.\n\n-- Class: ctypes.cuint8\n\nRepresents the C 8-bit unsigned int datatype.  Usually an alias for\n*note cubyte: 14c2.\n\n-- Class: ctypes.cuint16\n\nRepresents the C 16-bit unsigned int datatype.  Usually an alias\nfor *note cushort: 2cc6.\n\n-- Class: ctypes.cuint32\n\nRepresents the C 32-bit unsigned int datatype.  Usually an alias\nfor *note cuint: 2cc7.\n\n-- Class: ctypes.cuint64\n\nRepresents the C 64-bit unsigned int datatype.  Usually an alias\nfor *note culonglong: 2cca.\n\n-- Class: ctypes.culong\n\nRepresents the C unsigned long datatype.  The constructor accepts\nan optional integer initializer; no overflow checking is done.\n\n-- Class: ctypes.culonglong\n\nRepresents the C unsigned long long datatype.  The constructor\naccepts an optional integer initializer; no overflow checking is\ndone.\n\n-- Class: ctypes.cushort\n\nRepresents the C unsigned short datatype.  The constructor accepts\nan optional integer initializer; no overflow checking is done.\n\n-- Class: ctypes.cvoidp\n\nRepresents the C void* type.  The value is represented as integer.\nThe constructor accepts an optional integer initializer.\n\n-- Class: ctypes.cwchar\n\nRepresents the C 'wchart' datatype, and interprets the value as a\nsingle character unicode string.  The constructor accepts an\noptional string initializer, the length of the string must be\nexactly one character.\n\n-- Class: ctypes.cwcharp\n\nRepresents the C wchart* datatype, which must be a pointer to a\nzero-terminated wide character string.  The constructor accepts an\ninteger address, or a string.\n\n-- Class: ctypes.cbool\n\nRepresent the C bool datatype (more accurately, Bool from C99).\nIts value can be 'True' or 'False', and the constructor accepts any\nobject that has a truth value.\n\n-- Class: ctypes.HRESULT\n\nWindows only: Represents a 'HRESULT' value, which contains success\nor error information for a function or method call.\n\n-- Class: ctypes.pyobject\n\nRepresents the C *note PyObject: 6b1.* datatype.  Calling this\nwithout an argument creates a 'NULL' *note PyObject: 6b1.* pointer.\n",
            "subsections": []
        },
        "The 'ctypes.wintypes' module provides quite some other Windows specific": {
            "content": "data types, for example 'HWND', 'WPARAM', or 'DWORD'.  Some useful\nstructures like 'MSG' or 'RECT' are also defined.\n\nFile: python3.12.info,  Node: Structured data types,  Next: Arrays and pointers,  Prev: Fundamental data types<2>,  Up: ctypes reference\n\n5.16.16.31 Structured data types\n................................\n\n-- Class: ctypes.Union (*args, kw)\n\nAbstract base class for unions in native byte order.\n\n-- Class: ctypes.BigEndianUnion (*args, kw)\n\nAbstract base class for unions in 'big endian' byte order.\n\nNew in version 3.11.\n\n-- Class: ctypes.LittleEndianUnion (*args, kw)\n\nAbstract base class for unions in 'little endian' byte order.\n\nNew in version 3.11.\n\n-- Class: ctypes.BigEndianStructure (*args, kw)\n\nAbstract base class for structures in 'big endian' byte order.\n\n-- Class: ctypes.LittleEndianStructure (*args, kw)\n\nAbstract base class for structures in 'little endian' byte order.\n",
            "subsections": []
        },
        "Structures and unions with non-native byte order cannot contain pointer": {
            "content": "type fields, or any other data types containing pointer type fields.\n\n-- Class: ctypes.Structure (*args, kw)\n\nAbstract base class for structures in 'native' byte order.\n\nConcrete structure and union types must be created by subclassing\none of these types, and at least define a *note fields: 2ce5.\nclass variable.  *note ctypes: 28. will create *note descriptor:\n1c78.s which allow reading and writing the fields by direct\nattribute accesses.  These are the\n\n-- Attribute: fields\n\nA sequence defining the structure fields.  The items must be\n2-tuples or 3-tuples.  The first item is the name of the\nfield, the second item specifies the type of the field; it can\nbe any ctypes data type.\n\nFor integer type fields like *note cint: 2cb7, a third\noptional item can be given.  It must be a small positive\ninteger defining the bit width of the field.\n\nField names must be unique within one structure or union.\nThis is not checked, only one field can be accessed when names\nare repeated.\n\nIt is possible to define the *note fields: 2ce5. class\nvariable 'after' the class statement that defines the\nStructure subclass, this allows creating data types that\ndirectly or indirectly reference themselves:\n\nclass List(Structure):\npass\nList.fields = [(\"pnext\", POINTER(List)),\n...\n]\n\nThe *note fields: 2ce5. class variable must, however, be\ndefined before the type is first used (an instance is created,\n*note sizeof(): 2d24. is called on it, and so on).  Later\nassignments to the *note fields: 2ce5. class variable will\nraise an AttributeError.\n\nIt is possible to define sub-subclasses of structure types,\nthey inherit the fields of the base class plus the *note\nfields: 2ce5. defined in the sub-subclass, if any.\n\n-- Attribute: pack\n\nAn optional small integer that allows overriding the alignment\nof structure fields in the instance.  *note pack: 2ce8. must\nalready be defined when *note fields: 2ce5. is assigned,\notherwise it will have no effect.  Setting this attribute to 0\nis the same as not setting it at all.\n\n-- Attribute: anonymous\n\nAn optional sequence that lists the names of unnamed\n(anonymous) fields.  *note anonymous: 2d3f. must be already\ndefined when *note fields: 2ce5. is assigned, otherwise it\nwill have no effect.\n\nThe fields listed in this variable must be structure or union\ntype fields.  *note ctypes: 28. will create descriptors in the\nstructure type that allows accessing the nested fields\ndirectly, without the need to create the structure or union\nfield.\n\nHere is an example type (Windows):\n\nclass U(Union):\nfields = [(\"lptdesc\", POINTER(TYPEDESC)),\n(\"lpadesc\", POINTER(ARRAYDESC)),\n(\"hreftype\", HREFTYPE)]\n\nclass TYPEDESC(Structure):\nanonymous = (\"u\",)\nfields = [(\"u\", U),\n(\"vt\", VARTYPE)]\n\nThe 'TYPEDESC' structure describes a COM data type, the 'vt'\nfield specifies which one of the union fields is valid.  Since\nthe 'u' field is defined as anonymous field, it is now\npossible to access the members directly off the TYPEDESC\ninstance.  'td.lptdesc' and 'td.u.lptdesc' are equivalent, but\nthe former is faster since it does not need to create a\ntemporary union instance:\n\ntd = TYPEDESC()\ntd.vt = VTPTR\ntd.lptdesc = POINTER(sometype)\ntd.u.lptdesc = POINTER(sometype)\n\nIt is possible to define sub-subclasses of structures, they inherit\nthe fields of the base class.  If the subclass definition has a\nseparate *note fields: 2ce5. variable, the fields specified in\nthis are appended to the fields of the base class.\n\nStructure and union constructors accept both positional and keyword\narguments.  Positional arguments are used to initialize member\nfields in the same order as they are appear in *note fields:\n2ce5.  Keyword arguments in the constructor are interpreted as\nattribute assignments, so they will initialize *note fields:\n2ce5. with the same name, or create new attributes for names not\npresent in *note fields: 2ce5.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Arrays and pointers,  Prev: Structured data types,  Up: ctypes reference": {
            "content": "5.16.16.32 Arrays and pointers\n..............................\n\n-- Class: ctypes.Array (*args)\n\nAbstract base class for arrays.\n\nThe recommended way to create concrete array types is by\nmultiplying any *note ctypes: 28. data type with a non-negative\ninteger.  Alternatively, you can subclass this type and define\n*note length: 2d42. and *note type: 2d43. class variables.\nArray elements can be read and written using standard subscript and\nslice accesses; for slice reads, the resulting object is 'not'\nitself an *note Array: 17a2.\n\n-- Attribute: length\n\nA positive integer specifying the number of elements in the\narray.  Out-of-range subscripts result in an *note IndexError:\n138f.  Will be returned by *note len(): 3fb.\n\n-- Attribute: type\n\nSpecifies the type of each element in the array.\n\nArray subclass constructors accept positional arguments, used to\ninitialize the elements in order.\n\n-- Class: ctypes.Pointer\n\nPrivate, abstract base class for pointers.\n\nConcrete pointer types are created by calling *note POINTER():\n2cf2. with the type that will be pointed to; this is done\nautomatically by *note pointer(): 2ce2.\n\nIf a pointer points to an array, its elements can be read and\nwritten using standard subscript and slice accesses.  Pointer\nobjects have no size, so *note len(): 3fb. will raise *note\nTypeError: 28e.  Negative subscripts will read from the memory\n'before' the pointer (as in C), and out-of-range subscripts will\nprobably crash with an access violation (if you're lucky).\n\n-- Attribute: type\n\nSpecifies the type pointed to.\n\n-- Attribute: contents\n\nReturns the object to which to pointer points.  Assigning to\nthis attribute changes the pointer to point to the assigned\nobject.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Concurrent Execution,  Next: Networking and Interprocess Communication,  Prev: Generic Operating System Services,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.17 Concurrent Execution",
                    "content": ""
                }
            ]
        },
        "The modules described in this chapter provide support for concurrent": {
            "content": "execution of code.  The appropriate choice of tool will depend on the\ntask to be executed (CPU bound vs IO bound) and preferred style of\ndevelopment (event driven cooperative multitasking vs preemptive\nmultitasking).  Here's an overview:\n\n* Menu:\n\n* threading -- Thread-based parallelism::\n* multiprocessing -- Process-based parallelism::\n* multiprocessing.sharedmemory -- Shared memory for direct access across processes: multiprocessing sharedmemory -- Shared memory for direct access across processes.\n* The concurrent package::\n* concurrent.futures -- Launching parallel tasks: concurrent futures -- Launching parallel tasks.\n* subprocess -- Subprocess management::\n* sched -- Event scheduler::\n* queue -- A synchronized queue class::\n* contextvars -- Context Variables::\n* thread -- Low-level threading API::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: threading -- Thread-based parallelism,  Next: multiprocessing -- Process-based parallelism,  Up: Concurrent Execution": {
            "content": "'Source code:' Lib/threading.py(1)\n\n\n",
            "subsections": []
        },
        "This module constructs higher-level threading interfaces on top of the": {
            "content": "lower level *note thread: 2. module.\n",
            "subsections": []
        },
        "Changed in version 3.7: This module used to be optional, it is now": {
            "content": "always available.\n\nThis module defines the following constants and functions:\n\n-- Exception: thread.error\n\nRaised on thread-specific errors.\n\nChanged in version 3.3: This is now a synonym of the built-in *note\nRuntimeError: 17a.\n\n-- Data: thread.LockType\n\nThis is the type of lock objects.\n\n-- Function: thread.startnewthread (function, args[, kwargs])\n\nStart a new thread and return its identifier.  The thread executes\nthe function 'function' with the argument list 'args' (which must\nbe a tuple).  The optional 'kwargs' argument specifies a dictionary\nof keyword arguments.\n\nWhen the function returns, the thread silently exits.\n\nWhen the function terminates with an unhandled exception, *note\nsys.unraisablehook(): 448. is called to handle the exception.  The\n'object' attribute of the hook argument is 'function'.  By default,\na stack trace is printed and then the thread exits (but other\nthreads continue to run).\n\nWhen the function raises a *note SystemExit: b97. exception, it is\nsilently ignored.\n\nRaises an *note auditing event: 161d. 'thread.startnewthread'\nwith arguments 'function', 'args', 'kwargs'.\n\nChanged in version 3.8: *note sys.unraisablehook(): 448. is now\nused to handle unhandled exceptions.\n\n-- Function: thread.interruptmain (signum=signal.SIGINT, /)\n\nSimulate the effect of a signal arriving in the main thread.  A\nthread can use this function to interrupt the main thread, though\nthere is no guarantee that the interruption will happen\nimmediately.\n\nIf given, 'signum' is the number of the signal to simulate.  If\n'signum' is not given, *note signal.SIGINT: 63a. is simulated.\n\nIf the given signal isn't handled by Python (it was set to *note\nsignal.SIGDFL: 1583. or *note signal.SIGIGN: 1582.), this\nfunction does nothing.\n\nChanged in version 3.10: The 'signum' argument is added to\ncustomize the signal number.\n\nNote: This does not emit the corresponding signal but\nschedules a call to the associated handler (if it exists).  If\nyou want to truly emit the signal, use *note\nsignal.raisesignal(): 1560.\n\n-- Function: thread.exit ()\n\nRaise the *note SystemExit: b97. exception.  When not caught, this\nwill cause the thread to exit silently.\n\n-- Function: thread.allocatelock ()\n\nReturn a new lock object.  Methods of locks are described below.\nThe lock is initially unlocked.\n\n-- Function: thread.getident ()\n\nReturn the 'thread identifier' of the current thread.  This is a\nnonzero integer.  Its value has no direct meaning; it is intended\nas a magic cookie to be used e.g.  to index a dictionary of\nthread-specific data.  Thread identifiers may be recycled when a\nthread exits and another thread is created.\n\n-- Function: thread.getnativeid ()\n\nReturn the native integral Thread ID of the current thread assigned\nby the kernel.  This is a non-negative integer.  Its value may be\nused to uniquely identify this particular thread system-wide (until\nthe thread terminates, after which the value may be recycled by the\nOS).\n\n*note Availability: 1ad3.: Windows, FreeBSD, Linux, macOS, OpenBSD,\nNetBSD, AIX, DragonFlyBSD.\n\nNew in version 3.8.\n\n-- Function: thread.stacksize ([size])\n\nReturn the thread stack size used when creating new threads.  The\noptional 'size' argument specifies the stack size to be used for\nsubsequently created threads, and must be 0 (use platform or\nconfigured default) or a positive integer value of at least 32,768\n(32 KiB). If 'size' is not specified, 0 is used.  If changing the\nthread stack size is unsupported, a *note RuntimeError: 17a. is\nraised.  If the specified stack size is invalid, a *note\nValueError: 183. is raised and the stack size is unmodified.  32\nKiB is currently the minimum supported stack size value to\nguarantee sufficient stack space for the interpreter itself.  Note\nthat some platforms may have particular restrictions on values for\nthe stack size, such as requiring a minimum stack size > 32 KiB or\nrequiring allocation in multiples of the system memory page size -\nplatform documentation should be referred to for more information\n(4 KiB pages are common; using multiples of 4096 for the stack size\nis the suggested approach in the absence of more specific\ninformation).\n\n*note Availability: 1ad3.: Windows, pthreads.\n\nUnix platforms with POSIX threads support.\n\n-- Data: thread.TIMEOUTMAX\n\nThe maximum value allowed for the 'timeout' parameter of *note\nLock.acquire: 464.  Specifying a timeout greater than this value\nwill raise an *note OverflowError: 68d.\n\nNew in version 3.2.\n\nLock objects have the following methods:\n\n-- Method: lock.acquire (blocking=True, timeout=-1)\n\nWithout any optional argument, this method acquires the lock\nunconditionally, if necessary waiting until it is released by\nanother thread (only one thread at a time can acquire a lock --\nthat's their reason for existence).\n\nIf the 'blocking' argument is present, the action depends on its\nvalue: if it is False, the lock is only acquired if it can be\nacquired immediately without waiting, while if it is True, the lock\nis acquired unconditionally as above.\n\nIf the floating-point 'timeout' argument is present and positive,\nit specifies the maximum wait time in seconds before returning.  A\nnegative 'timeout' argument specifies an unbounded wait.  You\ncannot specify a 'timeout' if 'blocking' is False.\n\nThe return value is 'True' if the lock is acquired successfully,\n'False' if not.\n\nChanged in version 3.2: The 'timeout' parameter is new.\n\nChanged in version 3.2: Lock acquires can now be interrupted by\nsignals on POSIX.\n\n-- Method: lock.release ()\n\nReleases the lock.  The lock must have been acquired earlier, but\nnot necessarily by the same thread.\n\n-- Method: lock.locked ()\n\nReturn the status of the lock: 'True' if it has been acquired by\nsome thread, 'False' if not.\n",
            "subsections": []
        },
        "Interpreter Lock: 141, only one thread can execute Python code at once": {
            "content": "(even though certain performance-oriented libraries might overcome this\nlimitation).  If you want your application to make better use of the\ncomputational resources of multi-core machines, you are advised to use\n*note multiprocessing: 8f. or *note\nconcurrent.futures.ProcessPoolExecutor: 707.  However, threading is\nstill an appropriate model if you want to run multiple I/O-bound tasks\nsimultaneously.\n\n*note Availability: 1ad3.: not Emscripten, not WASI.\n",
            "subsections": []
        },
        "This module defines a number of classes, which are detailed in the": {
            "content": "sections below.\n\nThe design of this module is loosely based on Java's threading model.",
            "subsections": []
        },
        "However, where Java makes locks and condition variables basic behavior": {
            "content": "of every object, they are separate objects in Python.  Python's *note",
            "subsections": []
        },
        "Thread: 76c. class supports a subset of the behavior of Java's Thread": {
            "content": "class; currently, there are no priorities, no thread groups, and threads\ncannot be destroyed, stopped, suspended, resumed, or interrupted.  The\nstatic methods of Java's Thread class, when implemented, are mapped to\nmodule-level functions.\n\nAll of the methods described below are executed atomically.\n\n* Menu:\n\n* Thread-Local Data::\n* Thread Objects::\n* Lock Objects::\n* RLock Objects::\n* Condition Objects::\n* Semaphore Objects::\n* Event Objects::\n* Timer Objects::\n* Barrier Objects::\n* Using locks, conditions, and semaphores in the with statement: Using locks conditions and semaphores in the with statement.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/threading.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Thread-Local Data,  Next: Thread Objects,  Up: threading -- Thread-based parallelism": {
            "content": "5.17.1.1 Thread-Local Data\n..........................\n",
            "subsections": []
        },
        "Thread-local data is data whose values are thread specific.  To manage": {
            "content": "thread-local data, just create an instance of *note local: 14bb. (or a\nsubclass) and store attributes on it:\n\nmydata = threading.local()\nmydata.x = 1\n\nThe instance's values will be different for separate threads.\n\n-- Class: threading.local\n\nA class that represents thread-local data.\n\nFor more details and extensive examples, see the documentation\nstring of the 'threadinglocal' module:\nLib/threadinglocal.py(1).\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/threadinglocal.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Thread Objects,  Next: Lock Objects,  Prev: Thread-Local Data,  Up: threading -- Thread-based parallelism": {
            "content": "5.17.1.2 Thread Objects\n.......................\n\nThe *note Thread: 76c. class represents an activity that is run in a\nseparate thread of control.  There are two ways to specify the activity:\nby passing a callable object to the constructor, or by overriding the\n*note run(): 868. method in a subclass.  No other methods (except for\nthe constructor) should be overridden in a subclass.  In other words,\n'only' override the 'init()' and *note run(): 868. methods of this\nclass.\n",
            "subsections": []
        },
        "Once a thread object is created, its activity must be started by calling": {
            "content": "the thread's *note start(): 2a11. method.  This invokes the *note run():\n868. method in a separate thread of control.\n\nOnce the thread's activity is started, the thread is considered 'alive'.\nIt stops being alive when its *note run(): 868. method terminates -\neither normally, or by raising an unhandled exception.  The *note\nisalive(): 76d. method tests whether the thread is alive.\n\nOther threads can call a thread's *note join(): 1058. method.  This\nblocks the calling thread until the thread whose *note join(): 1058.\nmethod is called is terminated.\n\nA thread has a name.  The name can be passed to the constructor, and\nread or changed through the *note name: 66f. attribute.\n\nIf the *note run(): 868. method raises an exception, *note\nthreading.excepthook(): 641. is called to handle it.  By default, *note\nthreading.excepthook(): 641. ignores silently *note SystemExit: b97.\n\nA thread can be flagged as a \"daemon thread\".  The significance of this\nflag is that the entire Python program exits when only daemon threads\nare left.  The initial value is inherited from the creating thread.  The\nflag can be set through the *note daemon: 670. property or the 'daemon'\nconstructor argument.\n\nNote: Daemon threads are abruptly stopped at shutdown.  Their\nresources (such as open files, database transactions, etc.)  may\nnot be released properly.  If you want your threads to stop\ngracefully, make them non-daemonic and use a suitable signalling\nmechanism such as an *note Event: fcd.\n\nThere is a \"main thread\" object; this corresponds to the initial thread\nof control in the Python program.  It is not a daemon thread.\n\nThere is the possibility that \"dummy thread objects\" are created.  These\nare thread objects corresponding to \"alien threads\", which are threads\nof control started outside the threading module, such as directly from C\ncode.  Dummy thread objects have limited functionality; they are always\nconsidered alive and daemonic, and cannot be *note joined: 2d50.  They\nare never deleted, since it is impossible to detect the termination of\nalien threads.\n\n-- Class: threading.Thread (group=None, target=None, name=None,\nargs=(), kwargs={}, *, daemon=None)\n\nThis constructor should always be called with keyword arguments.\nArguments are:\n\n'group' should be 'None'; reserved for future extension when a\n'ThreadGroup' class is implemented.\n\n'target' is the callable object to be invoked by the *note run():\n868. method.  Defaults to 'None', meaning nothing is called.\n\n'name' is the thread name.  By default, a unique name is\nconstructed of the form \"Thread-'N'\" where 'N' is a small decimal\nnumber, or \"Thread-'N' (target)\" where \"target\" is\n'target.name' if the 'target' argument is specified.\n\n'args' is a list or tuple of arguments for the target invocation.\nDefaults to '()'.\n\n'kwargs' is a dictionary of keyword arguments for the target\ninvocation.  Defaults to '{}'.\n\nIf not 'None', 'daemon' explicitly sets whether the thread is\ndaemonic.  If 'None' (the default), the daemonic property is\ninherited from the current thread.\n\nIf the subclass overrides the constructor, it must make sure to\ninvoke the base class constructor ('Thread.init()') before\ndoing anything else to the thread.\n\nChanged in version 3.3: Added the 'daemon' parameter.\n\nChanged in version 3.10: Use the 'target' name if 'name' argument\nis omitted.\n\n-- Method: start ()\n\nStart the thread's activity.\n\nIt must be called at most once per thread object.  It arranges\nfor the object's *note run(): 868. method to be invoked in a\nseparate thread of control.\n\nThis method will raise a *note RuntimeError: 17a. if called\nmore than once on the same thread object.\n\n-- Method: run ()\n\nMethod representing the thread's activity.\n\nYou may override this method in a subclass.  The standard\n*note run(): 868. method invokes the callable object passed to\nthe object's constructor as the 'target' argument, if any,\nwith positional and keyword arguments taken from the 'args'\nand 'kwargs' arguments, respectively.\n\nUsing list or tuple as the 'args' argument which passed to the\n*note Thread: 76c. could achieve the same effect.\n\nExample:\n\n>>> from threading import Thread\n>>> t = Thread(target=print, args=[1])\n>>> t.run()\n1\n>>> t = Thread(target=print, args=(1,))\n>>> t.run()\n1\n\n-- Method: join (timeout=None)\n\nWait until the thread terminates.  This blocks the calling\nthread until the thread whose *note join(): 1058. method is\ncalled terminates - either normally or through an unhandled\nexception - or until the optional timeout occurs.\n\nWhen the 'timeout' argument is present and not 'None', it\nshould be a floating point number specifying a timeout for the\noperation in seconds (or fractions thereof).  As *note join():\n1058. always returns 'None', you must call *note isalive():\n76d. after *note join(): 1058. to decide whether a timeout\nhappened - if the thread is still alive, the *note join():\n1058. call timed out.\n\nWhen the 'timeout' argument is not present or 'None', the\noperation will block until the thread terminates.\n\nA thread can be joined many times.\n\n*note join(): 1058. raises a *note RuntimeError: 17a. if an\nattempt is made to join the current thread as that would cause\na deadlock.  It is also an error to *note join(): 1058. a\nthread before it has been started and attempts to do so raise\nthe same exception.\n\n-- Attribute: name\n\nA string used for identification purposes only.  It has no\nsemantics.  Multiple threads may be given the same name.  The\ninitial name is set by the constructor.\n\n-- Method: getName ()\n-- Method: setName ()\n\nDeprecated getter/setter API for *note name: 66f.; use it\ndirectly as a property instead.\n\nDeprecated since version 3.10.\n\n-- Attribute: ident\n\nThe 'thread identifier' of this thread or 'None' if the thread\nhas not been started.  This is a nonzero integer.  See the\n*note getident(): fcf. function.  Thread identifiers may be\nrecycled when a thread exits and another thread is created.\nThe identifier is available even after the thread has exited.\n\n-- Attribute: nativeid\n\nThe Thread ID ('TID') of this thread, as assigned by the OS\n(kernel).  This is a non-negative integer, or 'None' if the\nthread has not been started.  See the *note getnativeid():\n869. function.  This value may be used to uniquely identify\nthis particular thread system-wide (until the thread\nterminates, after which the value may be recycled by the OS).\n\nNote: Similar to Process IDs, Thread IDs are only valid\n(guaranteed unique system-wide) from the time the thread\nis created until the thread has been terminated.\n\n*note Availability: 1ad3.: Windows, FreeBSD, Linux, macOS,\nOpenBSD, NetBSD, AIX, DragonFlyBSD.\n\nNew in version 3.8.\n\n-- Method: isalive ()\n\nReturn whether the thread is alive.\n\nThis method returns 'True' just before the *note run(): 868.\nmethod starts until just after the *note run(): 868. method\nterminates.  The module function *note enumerate(): 1607.\nreturns a list of all alive threads.\n\n-- Attribute: daemon\n\nA boolean value indicating whether this thread is a daemon\nthread ('True') or not ('False').  This must be set before\n*note start(): 2a11. is called, otherwise *note RuntimeError:\n17a. is raised.  Its initial value is inherited from the\ncreating thread; the main thread is not a daemon thread and\ntherefore all threads created in the main thread default to\n*note daemon: 670. = 'False'.\n\nThe entire Python program exits when no alive non-daemon\nthreads are left.\n\n-- Method: isDaemon ()\n-- Method: setDaemon ()\n\nDeprecated getter/setter API for *note daemon: 670.; use it\ndirectly as a property instead.\n\nDeprecated since version 3.10.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Lock Objects,  Next: RLock Objects,  Prev: Thread Objects,  Up: threading -- Thread-based parallelism": {
            "content": "5.17.1.3 Lock Objects\n.....................\n\nA primitive lock is a synchronization primitive that is not owned by a\nparticular thread when locked.  In Python, it is currently the lowest\nlevel synchronization primitive available, implemented directly by the\n*note thread: 2. extension module.\n\nA primitive lock is in one of two states, \"locked\" or \"unlocked\".  It is\ncreated in the unlocked state.  It has two basic methods, *note\nacquire(): 464. and *note release(): 1138.  When the state is unlocked,\n*note acquire(): 464. changes the state to locked and returns\nimmediately.  When the state is locked, *note acquire(): 464. blocks\nuntil a call to *note release(): 1138. in another thread changes it to\nunlocked, then the *note acquire(): 464. call resets it to locked and\nreturns.  The *note release(): 1138. method should only be called in the\nlocked state; it changes the state to unlocked and returns immediately.\nIf an attempt is made to release an unlocked lock, a *note RuntimeError:\n17a. will be raised.\n\nLocks also support the *note context management protocol: 2d57.\n\nWhen more than one thread is blocked in *note acquire(): 464. waiting\nfor the state to turn to unlocked, only one thread proceeds when a *note\nrelease(): 1138. call resets the state to unlocked; which one of the\nwaiting threads proceeds is not defined, and may vary across\nimplementations.\n\nAll methods are executed atomically.\n\n-- Class: threading.Lock\n\nThe class implementing primitive lock objects.  Once a thread has\nacquired a lock, subsequent attempts to acquire it block, until it\nis released; any thread may release it.\n\nNote that 'Lock' is actually a factory function which returns an\ninstance of the most efficient version of the concrete Lock class\nthat is supported by the platform.\n\n-- Method: acquire (blocking=True, timeout=-1)\n\nAcquire a lock, blocking or non-blocking.\n\nWhen invoked with the 'blocking' argument set to 'True' (the\ndefault), block until the lock is unlocked, then set it to\nlocked and return 'True'.\n\nWhen invoked with the 'blocking' argument set to 'False', do\nnot block.  If a call with 'blocking' set to 'True' would\nblock, return 'False' immediately; otherwise, set the lock to\nlocked and return 'True'.\n\nWhen invoked with the floating-point 'timeout' argument set to\na positive value, block for at most the number of seconds\nspecified by 'timeout' and as long as the lock cannot be\nacquired.  A 'timeout' argument of '-1' specifies an unbounded\nwait.  It is forbidden to specify a 'timeout' when 'blocking'\nis 'False'.\n\nThe return value is 'True' if the lock is acquired\nsuccessfully, 'False' if not (for example if the 'timeout'\nexpired).\n\nChanged in version 3.2: The 'timeout' parameter is new.\n\nChanged in version 3.2: Lock acquisition can now be\ninterrupted by signals on POSIX if the underlying threading\nimplementation supports it.\n\n-- Method: release ()\n\nRelease a lock.  This can be called from any thread, not only\nthe thread which has acquired the lock.\n\nWhen the lock is locked, reset it to unlocked, and return.  If\nany other threads are blocked waiting for the lock to become\nunlocked, allow exactly one of them to proceed.\n\nWhen invoked on an unlocked lock, a *note RuntimeError: 17a.\nis raised.\n\nThere is no return value.\n\n-- Method: locked ()\n\nReturn 'True' if the lock is acquired.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: RLock Objects,  Next: Condition Objects,  Prev: Lock Objects,  Up: threading -- Thread-based parallelism": {
            "content": "5.17.1.4 RLock Objects\n......................\n\nA reentrant lock is a synchronization primitive that may be acquired\nmultiple times by the same thread.  Internally, it uses the concepts of\n\"owning thread\" and \"recursion level\" in addition to the locked/unlocked\nstate used by primitive locks.  In the locked state, some thread owns\nthe lock; in the unlocked state, no thread owns it.\n\nTo lock the lock, a thread calls its *note acquire(): cdf. method; this\nreturns once the thread owns the lock.  To unlock the lock, a thread\ncalls its *note release(): 1138. method.  *note acquire(): 464./*note\nrelease(): 1138. call pairs may be nested; only the final *note\nrelease(): 1138. (the *note release(): 1138. of the outermost pair)\nresets the lock to unlocked and allows another thread blocked in *note\nacquire(): 464. to proceed.\n\nReentrant locks also support the *note context management protocol:\n2d57.\n\n-- Class: threading.RLock\n\nThis class implements reentrant lock objects.  A reentrant lock\nmust be released by the thread that acquired it.  Once a thread has\nacquired a reentrant lock, the same thread may acquire it again\nwithout blocking; the thread must release it once for each time it\nhas acquired it.\n\nNote that 'RLock' is actually a factory function which returns an\ninstance of the most efficient version of the concrete RLock class\nthat is supported by the platform.\n\n-- Method: acquire (blocking=True, timeout=-1)\n\nAcquire a lock, blocking or non-blocking.\n\nWhen invoked without arguments: if this thread already owns\nthe lock, increment the recursion level by one, and return\nimmediately.  Otherwise, if another thread owns the lock,\nblock until the lock is unlocked.  Once the lock is unlocked\n(not owned by any thread), then grab ownership, set the\nrecursion level to one, and return.  If more than one thread\nis blocked waiting until the lock is unlocked, only one at a\ntime will be able to grab ownership of the lock.  There is no\nreturn value in this case.\n\nWhen invoked with the 'blocking' argument set to 'True', do\nthe same thing as when called without arguments, and return\n'True'.\n\nWhen invoked with the 'blocking' argument set to 'False', do\nnot block.  If a call without an argument would block, return\n'False' immediately; otherwise, do the same thing as when\ncalled without arguments, and return 'True'.\n\nWhen invoked with the floating-point 'timeout' argument set to\na positive value, block for at most the number of seconds\nspecified by 'timeout' and as long as the lock cannot be\nacquired.  Return 'True' if the lock has been acquired,\n'False' if the timeout has elapsed.\n\nChanged in version 3.2: The 'timeout' parameter is new.\n\n-- Method: release ()\n\nRelease a lock, decrementing the recursion level.  If after\nthe decrement it is zero, reset the lock to unlocked (not\nowned by any thread), and if any other threads are blocked\nwaiting for the lock to become unlocked, allow exactly one of\nthem to proceed.  If after the decrement the recursion level\nis still nonzero, the lock remains locked and owned by the\ncalling thread.\n\nOnly call this method when the calling thread owns the lock.\nA *note RuntimeError: 17a. is raised if this method is called\nwhen the lock is unlocked.\n\nThere is no return value.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Condition Objects,  Next: Semaphore Objects,  Prev: RLock Objects,  Up: threading -- Thread-based parallelism": {
            "content": "5.17.1.5 Condition Objects\n..........................\n\nA condition variable is always associated with some kind of lock; this\ncan be passed in or one will be created by default.  Passing one in is\nuseful when several condition variables must share the same lock.  The\nlock is part of the condition object: you don't have to track it\nseparately.\n\nA condition variable obeys the *note context management protocol: 2d57.:\nusing the 'with' statement acquires the associated lock for the duration\nof the enclosed block.  The *note acquire(): 2d5f. and *note release():\n2d60. methods also call the corresponding methods of the associated\nlock.\n\nOther methods must be called with the associated lock held.  The *note\nwait(): 1614. method releases the lock, and then blocks until another\nthread awakens it by calling *note notify(): 153a. or *note\nnotifyall(): 66d.  Once awakened, *note wait(): 1614. re-acquires the\nlock and returns.  It is also possible to specify a timeout.\n\nThe *note notify(): 153a. method wakes up one of the threads waiting for\nthe condition variable, if any are waiting.  The *note notifyall():\n66d. method wakes up all threads waiting for the condition variable.\n\nNote: the *note notify(): 153a. and *note notifyall(): 66d. methods\ndon't release the lock; this means that the thread or threads awakened\nwill not return from their *note wait(): 1614. call immediately, but\nonly when the thread that called *note notify(): 153a. or *note\nnotifyall(): 66d. finally relinquishes ownership of the lock.\n",
            "subsections": []
        },
        "The typical programming style using condition variables uses the lock to": {
            "content": "synchronize access to some shared state; threads that are interested in\na particular change of state call *note wait(): 1614. repeatedly until\nthey see the desired state, while threads that modify the state call\n*note notify(): 153a. or *note notifyall(): 66d. when they change the\nstate in such a way that it could possibly be a desired state for one of\nthe waiters.  For example, the following code is a generic\nproducer-consumer situation with unlimited buffer capacity:\n\n# Consume one item\nwith cv:\nwhile not anitemisavailable():\ncv.wait()\ngetanavailableitem()\n\n# Produce one item\nwith cv:\nmakeanitemavailable()\ncv.notify()\n",
            "subsections": []
        },
        "The 'while' loop checking for the application's condition is necessary": {
            "content": "because *note wait(): 1614. can return after an arbitrary long time, and\nthe condition which prompted the *note notify(): 153a. call may no\nlonger hold true.  This is inherent to multi-threaded programming.  The\n*note waitfor(): 2d61. method can be used to automate the condition\nchecking, and eases the computation of timeouts:\n\n# Consume an item\nwith cv:\ncv.waitfor(anitemisavailable)\ngetanavailableitem()\n\nTo choose between *note notify(): 153a. and *note notifyall(): 66d,\nconsider whether one state change can be interesting for only one or\nseveral waiting threads.  E.g.  in a typical producer-consumer\nsituation, adding one item to the buffer only needs to wake up one\nconsumer thread.\n\n-- Class: threading.Condition (lock=None)\n\nThis class implements condition variable objects.  A condition\nvariable allows one or more threads to wait until they are notified\nby another thread.\n\nIf the 'lock' argument is given and not 'None', it must be a *note\nLock: 2d58. or *note RLock: 10cc. object, and it is used as the\nunderlying lock.  Otherwise, a new *note RLock: 10cc. object is\ncreated and used as the underlying lock.\n\nChanged in version 3.3: changed from a factory function to a class.\n\n-- Method: acquire (*args)\n\nAcquire the underlying lock.  This method calls the\ncorresponding method on the underlying lock; the return value\nis whatever that method returns.\n\n-- Method: release ()\n\nRelease the underlying lock.  This method calls the\ncorresponding method on the underlying lock; there is no\nreturn value.\n\n-- Method: wait (timeout=None)\n\nWait until notified or until a timeout occurs.  If the calling\nthread has not acquired the lock when this method is called, a\n*note RuntimeError: 17a. is raised.\n\nThis method releases the underlying lock, and then blocks\nuntil it is awakened by a *note notify(): 153a. or *note\nnotifyall(): 66d. call for the same condition variable in\nanother thread, or until the optional timeout occurs.  Once\nawakened or timed out, it re-acquires the lock and returns.\n\nWhen the 'timeout' argument is present and not 'None', it\nshould be a floating point number specifying a timeout for the\noperation in seconds (or fractions thereof).\n\nWhen the underlying lock is an *note RLock: 10cc, it is not\nreleased using its *note release(): 2d60. method, since this\nmay not actually unlock the lock when it was acquired multiple\ntimes recursively.  Instead, an internal interface of the\n*note RLock: 10cc. class is used, which really unlocks it even\nwhen it has been recursively acquired several times.  Another\ninternal interface is then used to restore the recursion level\nwhen the lock is reacquired.\n\nThe return value is 'True' unless a given 'timeout' expired,\nin which case it is 'False'.\n\nChanged in version 3.2: Previously, the method always returned\n'None'.\n\n-- Method: waitfor (predicate, timeout=None)\n\nWait until a condition evaluates to true.  'predicate' should\nbe a callable which result will be interpreted as a boolean\nvalue.  A 'timeout' may be provided giving the maximum time to\nwait.\n\nThis utility method may call *note wait(): 1614. repeatedly\nuntil the predicate is satisfied, or until a timeout occurs.\nThe return value is the last return value of the predicate and\nwill evaluate to 'False' if the method timed out.\n\nIgnoring the timeout feature, calling this method is roughly\nequivalent to writing:\n\nwhile not predicate():\ncv.wait()\n\nTherefore, the same rules apply as with *note wait(): 1614.:\nThe lock must be held when called and is re-acquired on\nreturn.  The predicate is evaluated with the lock held.\n\nNew in version 3.2.\n\n-- Method: notify (n=1)\n\nBy default, wake up one thread waiting on this condition, if\nany.  If the calling thread has not acquired the lock when\nthis method is called, a *note RuntimeError: 17a. is raised.\n\nThis method wakes up at most 'n' of the threads waiting for\nthe condition variable; it is a no-op if no threads are\nwaiting.\n\nThe current implementation wakes up exactly 'n' threads, if at\nleast 'n' threads are waiting.  However, it's not safe to rely\non this behavior.  A future, optimized implementation may\noccasionally wake up more than 'n' threads.\n\nNote: an awakened thread does not actually return from its\n*note wait(): 1614. call until it can reacquire the lock.\nSince *note notify(): 153a. does not release the lock, its\ncaller should.\n\n-- Method: notifyall ()\n\nWake up all threads waiting on this condition.  This method\nacts like *note notify(): 153a, but wakes up all waiting\nthreads instead of one.  If the calling thread has not\nacquired the lock when this method is called, a *note\nRuntimeError: 17a. is raised.\n\nThe method 'notifyAll' is a deprecated alias for this method.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Semaphore Objects,  Next: Event Objects,  Prev: Condition Objects,  Up: threading -- Thread-based parallelism": {
            "content": "5.17.1.6 Semaphore Objects\n..........................\n",
            "subsections": []
        },
        "This is one of the oldest synchronization primitives in the history of": {
            "content": "computer science, invented by the early Dutch computer scientist Edsger\nW. Dijkstra (he used the names 'P()' and 'V()' instead of *note\nacquire(): 10ca. and *note release(): 2d64.).\n\nA semaphore manages an internal counter which is decremented by each\n*note acquire(): 10ca. call and incremented by each *note release():\n2d64. call.  The counter can never go below zero; when *note acquire():\n10ca. finds that it is zero, it blocks, waiting until some other thread\ncalls *note release(): 2d64.\n\nSemaphores also support the *note context management protocol: 2d57.\n\n-- Class: threading.Semaphore (value=1)\n\nThis class implements semaphore objects.  A semaphore manages an\natomic counter representing the number of *note release(): 2d64.\ncalls minus the number of *note acquire(): 10ca. calls, plus an\ninitial value.  The *note acquire(): 10ca. method blocks if\nnecessary until it can return without making the counter negative.\nIf not given, 'value' defaults to 1.\n\nThe optional argument gives the initial 'value' for the internal\ncounter; it defaults to '1'.  If the 'value' given is less than 0,\n*note ValueError: 183. is raised.\n\nChanged in version 3.3: changed from a factory function to a class.\n\n-- Method: acquire (blocking=True, timeout=None)\n\nAcquire a semaphore.\n\nWhen invoked without arguments:\n\n* If the internal counter is larger than zero on entry,\ndecrement it by one and return 'True' immediately.\n\n* If the internal counter is zero on entry, block until\nawoken by a call to *note release(): 2d64.  Once awoken\n(and the counter is greater than 0), decrement the\ncounter by 1 and return 'True'.  Exactly one thread will\nbe awoken by each call to *note release(): 2d64.  The\norder in which threads are awoken should not be relied\non.\n\nWhen invoked with 'blocking' set to 'False', do not block.  If\na call without an argument would block, return 'False'\nimmediately; otherwise, do the same thing as when called\nwithout arguments, and return 'True'.\n\nWhen invoked with a 'timeout' other than 'None', it will block\nfor at most 'timeout' seconds.  If acquire does not complete\nsuccessfully in that interval, return 'False'.  Return 'True'\notherwise.\n\nChanged in version 3.2: The 'timeout' parameter is new.\n\n-- Method: release (n=1)\n\nRelease a semaphore, incrementing the internal counter by 'n'.\nWhen it was zero on entry and other threads are waiting for it\nto become larger than zero again, wake up 'n' of those\nthreads.\n\nChanged in version 3.9: Added the 'n' parameter to release\nmultiple waiting threads at once.\n\n-- Class: threading.BoundedSemaphore (value=1)\n\nClass implementing bounded semaphore objects.  A bounded semaphore\nchecks to make sure its current value doesn't exceed its initial\nvalue.  If it does, *note ValueError: 183. is raised.  In most\nsituations semaphores are used to guard resources with limited\ncapacity.  If the semaphore is released too many times it's a sign\nof a bug.  If not given, 'value' defaults to 1.\n\nChanged in version 3.3: changed from a factory function to a class.\n\n* Menu:\n\n* Semaphore Example::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Semaphore Example,  Up: Semaphore Objects": {
            "content": "5.17.1.7 'Semaphore' Example\n............................\n",
            "subsections": []
        },
        "Semaphores are often used to guard resources with limited capacity, for": {
            "content": "example, a database server.  In any situation where the size of the\nresource is fixed, you should use a bounded semaphore.  Before spawning\nany worker threads, your main thread would initialize the semaphore:\n\nmaxconnections = 5\n# ...\npoolsema = BoundedSemaphore(value=maxconnections)\n",
            "subsections": []
        },
        "Once spawned, worker threads call the semaphore's acquire and release": {
            "content": "methods when they need to connect to the server:\n\nwith poolsema:\nconn = connectdb()\ntry:\n# ... use connection ...\nfinally:\nconn.close()\n",
            "subsections": []
        },
        "The use of a bounded semaphore reduces the chance that a programming": {
            "content": "error which causes the semaphore to be released more than it's acquired\nwill go undetected.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Event Objects,  Next: Timer Objects,  Prev: Semaphore Objects,  Up: threading -- Thread-based parallelism": {
            "content": "5.17.1.8 Event Objects\n......................\n",
            "subsections": []
        },
        "This is one of the simplest mechanisms for communication between": {
            "content": "threads: one thread signals an event and other threads wait for it.\n",
            "subsections": []
        },
        "An event object manages an internal flag that can be set to true with": {
            "content": "the *note set(): 2d69. method and reset to false with the *note clear():\n2d6a. method.  The *note wait(): 119e. method blocks until the flag is\ntrue.\n\n-- Class: threading.Event\n\nClass implementing event objects.  An event manages a flag that can\nbe set to true with the *note set(): 2d69. method and reset to\nfalse with the *note clear(): 2d6a. method.  The *note wait():\n119e. method blocks until the flag is true.  The flag is initially\nfalse.\n\nChanged in version 3.3: changed from a factory function to a class.\n\n-- Method: isset ()\n\nReturn 'True' if and only if the internal flag is true.\n\nThe method 'isSet' is a deprecated alias for this method.\n\n-- Method: set ()\n\nSet the internal flag to true.  All threads waiting for it to\nbecome true are awakened.  Threads that call *note wait():\n119e. once the flag is true will not block at all.\n\n-- Method: clear ()\n\nReset the internal flag to false.  Subsequently, threads\ncalling *note wait(): 119e. will block until *note set():\n2d69. is called to set the internal flag to true again.\n\n-- Method: wait (timeout=None)\n\nBlock as long as the internal flag is false and the timeout,\nif given, has not expired.  The return value represents the\nreason that this blocking method returned; 'True' if returning\nbecause the internal flag is set to true, or 'False' if a\ntimeout is given and the the internal flag did not become true\nwithin the given wait time.\n\nWhen the timeout argument is present and not 'None', it should\nbe a floating point number specifying a timeout for the\noperation in seconds, or fractions thereof.\n\nChanged in version 3.1: Previously, the method always returned\n'None'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Timer Objects,  Next: Barrier Objects,  Prev: Event Objects,  Up: threading -- Thread-based parallelism": {
            "content": "5.17.1.9 Timer Objects\n......................\n",
            "subsections": []
        },
        "This class represents an action that should be run only after a certain": {
            "content": "amount of time has passed -- a timer.  *note Timer: fce. is a subclass of\n*note Thread: 76c. and as such also functions as an example of creating\ncustom threads.\n\nTimers are started, as with threads, by calling their *note Timer.start:\n2a11. method.  The timer can be stopped (before its action has begun) by\ncalling the *note cancel(): 2d6d. method.  The interval the timer will\nwait before executing its action may not be exactly the same as the\ninterval specified by the user.\n\nFor example:\n\ndef hello():\nprint(\"hello, world\")\n\nt = Timer(30.0, hello)\nt.start()  # after 30 seconds, \"hello, world\" will be printed\n\n-- Class: threading.Timer (interval, function, args=None, kwargs=None)\n\nCreate a timer that will run 'function' with arguments 'args' and\nkeyword arguments 'kwargs', after 'interval' seconds have passed.\nIf 'args' is 'None' (the default) then an empty list will be used.\nIf 'kwargs' is 'None' (the default) then an empty dict will be\nused.\n\nChanged in version 3.3: changed from a factory function to a class.\n\n-- Method: cancel ()\n\nStop the timer, and cancel the execution of the timer's\naction.  This will only work if the timer is still in its\nwaiting stage.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Barrier Objects,  Next: Using locks conditions and semaphores in the with statement,  Prev: Timer Objects,  Up: threading -- Thread-based parallelism": {
            "content": "5.17.1.10 Barrier Objects\n.........................\n\nNew in version 3.2.\n",
            "subsections": []
        },
        "This class provides a simple synchronization primitive for use by a": {
            "content": "fixed number of threads that need to wait for each other.  Each of the\nthreads tries to pass the barrier by calling the *note wait(): 2d6f.\nmethod and will block until all of the threads have made their *note\nwait(): 2d6f. calls.  At this point, the threads are released\nsimultaneously.\n",
            "subsections": []
        },
        "The barrier can be reused any number of times for the same number of": {
            "content": "threads.\n",
            "subsections": []
        },
        "As an example, here is a simple way to synchronize a client and server": {
            "content": "thread:\n\nb = Barrier(2, timeout=5)\n\ndef server():\nstartserver()\nb.wait()\nwhile True:\nconnection = acceptconnection()\nprocessserverconnection(connection)\n\ndef client():\nb.wait()\nwhile True:\nconnection = makeconnection()\nprocessclientconnection(connection)\n\n-- Class: threading.Barrier (parties, action=None, timeout=None)\n\nCreate a barrier object for 'parties' number of threads.  An\n'action', when provided, is a callable to be called by one of the\nthreads when they are released.  'timeout' is the default timeout\nvalue if none is specified for the *note wait(): 2d6f. method.\n\n-- Method: wait (timeout=None)\n\nPass the barrier.  When all the threads party to the barrier\nhave called this function, they are all released\nsimultaneously.  If a 'timeout' is provided, it is used in\npreference to any that was supplied to the class constructor.\n\nThe return value is an integer in the range 0 to 'parties' -\n1, different for each thread.  This can be used to select a\nthread to do some special housekeeping, e.g.:\n\ni = barrier.wait()\nif i == 0:\n# Only one thread needs to print this\nprint(\"passed the barrier\")\n\nIf an 'action' was provided to the constructor, one of the\nthreads will have called it prior to being released.  Should\nthis call raise an error, the barrier is put into the broken\nstate.\n\nIf the call times out, the barrier is put into the broken\nstate.\n\nThis method may raise a *note BrokenBarrierError: 1059.\nexception if the barrier is broken or reset while a thread is\nwaiting.\n\n-- Method: reset ()\n\nReturn the barrier to the default, empty state.  Any threads\nwaiting on it will receive the *note BrokenBarrierError: 1059.\nexception.\n\nNote that using this function may require some external\nsynchronization if there are other threads whose state is\nunknown.  If a barrier is broken it may be better to just\nleave it and create a new one.\n\n-- Method: abort ()\n\nPut the barrier into a broken state.  This causes any active\nor future calls to *note wait(): 2d6f. to fail with the *note\nBrokenBarrierError: 1059.  Use this for example if one of the\nthreads needs to abort, to avoid deadlocking the application.\n\nIt may be preferable to simply create the barrier with a\nsensible 'timeout' value to automatically guard against one of\nthe threads going awry.\n\n-- Attribute: parties\n\nThe number of threads required to pass the barrier.\n\n-- Attribute: nwaiting\n\nThe number of threads currently waiting in the barrier.\n\n-- Attribute: broken\n\nA boolean that is 'True' if the barrier is in the broken\nstate.\n\n-- Exception: threading.BrokenBarrierError\n\nThis exception, a subclass of *note RuntimeError: 17a, is raised\nwhen the *note Barrier: 1057. object is reset or broken.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using locks conditions and semaphores in the with statement,  Prev: Barrier Objects,  Up: threading -- Thread-based parallelism": {
            "content": "5.17.1.11 Using locks, conditions, and semaphores in the 'with' statement\n.........................................................................\n",
            "subsections": []
        },
        "All of the objects provided by this module that have 'acquire' and": {
            "content": "'release' methods can be used as context managers for a *note with: 396.\nstatement.  The 'acquire' method will be called when the block is\nentered, and 'release' will be called when the block is exited.  Hence,\nthe following snippet:\n\nwith somelock:\n# do something...\n\nis equivalent to:\n\nsomelock.acquire()\ntry:\n# do something...\nfinally:\nsomelock.release()\n\nCurrently, *note Lock: 2d58, *note RLock: 10cc, *note Condition: fca,\n*note Semaphore: fcb, and *note BoundedSemaphore: fcc. objects may be\nused as *note with: 396. statement context managers.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: multiprocessing -- Process-based parallelism,  Next: multiprocessing sharedmemory -- Shared memory for direct access across processes,  Prev: threading -- Thread-based parallelism,  Up: Concurrent Execution": {
            "content": "'Source code:' Lib/multiprocessing/(1)\n\n\n\n*note Availability: 1ad3.: not Emscripten, not WASI.\n",
            "subsections": []
        },
        "To show the individual process IDs involved, here is an expanded": {
            "content": "example:\n\nfrom multiprocessing import Process\nimport os\n\ndef info(title):\nprint(title)\nprint('module name:', name)\nprint('parent process:', os.getppid())\nprint('process id:', os.getpid())\n\ndef f(name):\ninfo('function f')\nprint('hello', name)\n\nif name == 'main':\ninfo('main line')\np = Process(target=f, args=('bob',))\np.start()\np.join()\n\nFor an explanation of why the 'if name == 'main'' part is\nnecessary, see *note Programming guidelines: 2d7b.\n\nFile: python3.12.info,  Node: Contexts and start methods,  Next: Exchanging objects between processes,  Prev: The Process class,  Up: Introduction<7>\n\n5.17.2.3 Contexts and start methods\n...................................\n\nDepending on the platform, *note multiprocessing: 8f. supports three\nways to start a process.  These 'start methods' are\n\n'spawn'\n\nThe parent process starts a fresh Python interpreter process.\nThe child process will only inherit those resources necessary\nto run the process object's *note run(): 2d7d. method.  In\nparticular, unnecessary file descriptors and handles from the\nparent process will not be inherited.  Starting a process\nusing this method is rather slow compared to using 'fork' or\n'forkserver'.\n\nAvailable on POSIX and Windows platforms.  The default on\nWindows and macOS.\n\n'fork'\n\nThe parent process uses *note os.fork(): 231. to fork the\nPython interpreter.  The child process, when it begins, is\neffectively identical to the parent process.  All resources of\nthe parent are inherited by the child process.  Note that\nsafely forking a multithreaded process is problematic.\n\nAvailable on POSIX systems.  Currently the default on POSIX\nexcept macOS.\n\nNote: The default start method will change away from\n'fork' in Python 3.14.  Code that requires 'fork' should\nexplicitly specify that via *note getcontext(): 22b. or\n*note setstartmethod(): 22c.\n\nChanged in version 3.12: If Python is able to detect that your\nprocess has multiple threads, the *note os.fork(): 231.\nfunction that this start method calls internally will raise a\n*note DeprecationWarning: 179.  Use a different start method.\nSee the *note os.fork(): 231. documentation for further\nexplanation.\n\n'forkserver'\n\nWhen the program starts and selects the 'forkserver' start\nmethod, a server process is spawned.  From then on, whenever a\nnew process is needed, the parent process connects to the\nserver and requests that it fork a new process.  The fork\nserver process is single threaded unless system libraries or\npreloaded imports spawn threads as a side-effect so it is\ngenerally safe for it to use *note os.fork(): 231.  No\nunnecessary resources are inherited.\n\nAvailable on POSIX platforms which support passing file\ndescriptors over Unix pipes such as Linux.\n",
            "subsections": []
        },
        "Changed in version 3.4: 'spawn' added on all POSIX platforms, and": {
            "content": "'forkserver' added for some POSIX platforms.  Child processes no longer\ninherit all of the parents inheritable handles on Windows.\n",
            "subsections": []
        },
        "Changed in version 3.8: On macOS, the 'spawn' start method is now the": {
            "content": "default.  The 'fork' start method should be considered unsafe as it can\nlead to crashes of the subprocess as macOS system libraries may start\nthreads.  See bpo-33725(1).\n",
            "subsections": []
        },
        "On POSIX using the 'spawn' or 'forkserver' start methods will also start": {
            "content": "a 'resource tracker' process which tracks the unlinked named system\nresources (such as named semaphores or *note SharedMemory: 13b4.\nobjects) created by processes of the program.  When all processes have\nexited the resource tracker unlinks any remaining tracked object.",
            "subsections": []
        },
        "Usually there should be none, but if a process was killed by a signal": {
            "content": "there may be some \"leaked\" resources.  (Neither leaked semaphores nor\nshared memory segments will be automatically unlinked until the next\nreboot.  This is problematic for both objects because the system allows\nonly a limited number of named semaphores, and shared memory segments\noccupy some space in the main memory.)\n\nTo select a start method you use the *note setstartmethod(): 22c. in\nthe 'if name == 'main'' clause of the main module.  For example:\n\nimport multiprocessing as mp\n\ndef foo(q):\nq.put('hello')\n\nif name == 'main':\nmp.setstartmethod('spawn')\nq = mp.Queue()\np = mp.Process(target=foo, args=(q,))\np.start()\nprint(q.get())\np.join()\n\n*note setstartmethod(): 22c. should not be used more than once in the\nprogram.\n\nAlternatively, you can use *note getcontext(): 22b. to obtain a context\nobject.  Context objects have the same API as the multiprocessing\nmodule, and allow one to use multiple start methods in the same program.\n\nimport multiprocessing as mp\n\ndef foo(q):\nq.put('hello')\n\nif name == 'main':\nctx = mp.getcontext('spawn')\nq = ctx.Queue()\np = ctx.Process(target=foo, args=(q,))\np.start()\nprint(q.get())\np.join()\n",
            "subsections": []
        },
        "Note that objects related to one context may not be compatible with": {
            "content": "processes for a different context.  In particular, locks created using\nthe 'fork' context cannot be passed to processes started using the\n'spawn' or 'forkserver' start methods.\n\nA library which wants to use a particular start method should probably\nuse *note getcontext(): 22b. to avoid interfering with the choice of\nthe library user.\n\nWarning: The ''spawn'' and ''forkserver'' start methods generally\ncannot be used with \"frozen\" executables (i.e., binaries produced\nby packages like 'PyInstaller' and 'cxFreeze') on POSIX systems.\nThe ''fork'' start method may work if code does not use threads.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33725\n\nFile: python3.12.info,  Node: Exchanging objects between processes,  Next: Synchronization between processes,  Prev: Contexts and start methods,  Up: Introduction<7>\n\n5.17.2.4 Exchanging objects between processes\n.............................................\n\n*note multiprocessing: 8f. supports two types of communication channel\nbetween processes:\n\n'Queues'\n\nThe *note Queue: 13cf. class is a near clone of *note queue.Queue:\n1203.  For example:\n\nfrom multiprocessing import Process, Queue\n\ndef f(q):\nq.put([42, None, 'hello'])\n\nif name == 'main':\nq = Queue()\np = Process(target=f, args=(q,))\np.start()\nprint(q.get())    # prints \"[42, None, 'hello']\"\np.join()\n\nQueues are thread and process safe.\n\n'Pipes'\n\nThe *note Pipe(): 2d7f. function returns a pair of connection\nobjects connected by a pipe which by default is duplex (two-way).\nFor example:\n\nfrom multiprocessing import Process, Pipe\n\ndef f(conn):\nconn.send([42, None, 'hello'])\nconn.close()\n\nif name == 'main':\nparentconn, childconn = Pipe()\np = Process(target=f, args=(childconn,))\np.start()\nprint(parentconn.recv())   # prints \"[42, None, 'hello']\"\np.join()\n\nThe two connection objects returned by *note Pipe(): 2d7f.\nrepresent the two ends of the pipe.  Each connection object has\n'send()' and 'recv()' methods (among others).  Note that data in a\npipe may become corrupted if two processes (or threads) try to read\nfrom or write to the 'same' end of the pipe at the same time.  Of\ncourse there is no risk of corruption from processes using\ndifferent ends of the pipe at the same time.\n\nFile: python3.12.info,  Node: Synchronization between processes,  Next: Sharing state between processes,  Prev: Exchanging objects between processes,  Up: Introduction<7>\n\n5.17.2.5 Synchronization between processes\n..........................................\n\n*note multiprocessing: 8f. contains equivalents of all the\nsynchronization primitives from *note threading: e7.  For instance one\ncan use a lock to ensure that only one process prints to standard output\nat a time:\n\nfrom multiprocessing import Process, Lock\n\ndef f(l, i):\nl.acquire()\ntry:\nprint('hello world', i)\nfinally:\nl.release()\n\nif name == 'main':\nlock = Lock()\n\nfor num in range(10):\nProcess(target=f, args=(lock, num)).start()\n",
            "subsections": []
        },
        "Without using the lock output from the different processes is liable to": {
            "content": "get all mixed up.\n\nFile: python3.12.info,  Node: Sharing state between processes,  Next: Using a pool of workers,  Prev: Synchronization between processes,  Up: Introduction<7>\n\n5.17.2.6 Sharing state between processes\n........................................\n",
            "subsections": []
        },
        "As mentioned above, when doing concurrent programming it is usually best": {
            "content": "to avoid using shared state as far as possible.  This is particularly\ntrue when using multiple processes.\n\nHowever, if you really do need to use some shared data then *note\nmultiprocessing: 8f. provides a couple of ways of doing so.\n\n'Shared memory'\n\nData can be stored in a shared memory map using *note Value: 2d82.\nor *note Array: 2d83.  For example, the following code\n\nfrom multiprocessing import Process, Value, Array\n\ndef f(n, a):\nn.value = 3.1415927\nfor i in range(len(a)):\na[i] = -a[i]\n\nif name == 'main':\nnum = Value('d', 0.0)\narr = Array('i', range(10))\n\np = Process(target=f, args=(num, arr))\np.start()\np.join()\n\nprint(num.value)\nprint(arr[:])\n\nwill print\n\n3.1415927\n[0, -1, -2, -3, -4, -5, -6, -7, -8, -9]\n\nThe ''d'' and ''i'' arguments used when creating 'num' and 'arr'\nare typecodes of the kind used by the *note array: 7. module: ''d''\nindicates a double precision float and ''i'' indicates a signed\ninteger.  These shared objects will be process and thread-safe.\n\nFor more flexibility in using shared memory one can use the *note\nmultiprocessing.sharedctypes: 95. module which supports the\ncreation of arbitrary ctypes objects allocated from shared memory.\n\n'Server process'\n\nA manager object returned by *note Manager(): b09. controls a\nserver process which holds Python objects and allows other\nprocesses to manipulate them using proxies.\n\nA manager returned by *note Manager(): b09. will support types\n*note list: 3dc, *note dict: 237, *note Namespace: 2d84, *note\nLock: 2d85, *note RLock: 2d86, *note Semaphore: 2d87, *note\nBoundedSemaphore: 2d88, *note Condition: 2d89, *note Event: 15c5,\n*note Barrier: 2d8a, *note Queue: 13cf, *note Value: 2d82. and\n*note Array: 2d83.  For example,\n\nfrom multiprocessing import Process, Manager\n\ndef f(d, l):\nd[1] = '1'\nd['2'] = 2\nd[0.25] = None\nl.reverse()\n\nif name == 'main':\nwith Manager() as manager:\nd = manager.dict()\nl = manager.list(range(10))\n\np = Process(target=f, args=(d, l))\np.start()\np.join()\n\nprint(d)\nprint(l)\n\nwill print\n\n{0.25: None, 1: '1', '2': 2}\n[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]\n\nServer process managers are more flexible than using shared memory\nobjects because they can be made to support arbitrary object types.\nAlso, a single manager can be shared by processes on different\ncomputers over a network.  They are, however, slower than using\nshared memory.\n\nFile: python3.12.info,  Node: Using a pool of workers,  Prev: Sharing state between processes,  Up: Introduction<7>\n\n5.17.2.7 Using a pool of workers\n................................\n\nThe *note Pool: ddb. class represents a pool of worker processes.  It\nhas methods which allows tasks to be offloaded to the worker processes\nin a few different ways.\n\nFor example:\n\nfrom multiprocessing import Pool, TimeoutError\nimport time\nimport os\n\ndef f(x):\nreturn x*x\n\nif name == 'main':\n# start 4 worker processes\nwith Pool(processes=4) as pool:\n\n# print \"[0, 1, 4,..., 81]\"\nprint(pool.map(f, range(10)))\n\n# print same numbers in arbitrary order\nfor i in pool.imapunordered(f, range(10)):\nprint(i)\n\n# evaluate \"f(20)\" asynchronously\nres = pool.applyasync(f, (20,))      # runs in *only* one process\nprint(res.get(timeout=1))             # prints \"400\"\n\n# evaluate \"os.getpid()\" asynchronously\nres = pool.applyasync(os.getpid, ()) # runs in *only* one process\nprint(res.get(timeout=1))             # prints the PID of that process\n\n# launching multiple evaluations asynchronously *may* use more processes\nmultipleresults = [pool.applyasync(os.getpid, ()) for i in range(4)]\nprint([res.get(timeout=1) for res in multipleresults])\n\n# make a single worker sleep for 10 seconds\nres = pool.applyasync(time.sleep, (10,))\ntry:\nprint(res.get(timeout=1))\nexcept TimeoutError:\nprint(\"We lacked patience and got a multiprocessing.TimeoutError\")\n\nprint(\"For the moment, the pool remains available for more work\")\n\n# exiting the 'with'-block has stopped the pool\nprint(\"Now the pool is closed and no longer available\")\n",
            "subsections": []
        },
        "Note that the methods of a pool should only ever be used by the process": {
            "content": "which created it.\n\nNote: Functionality within this package requires that the\n'main' module be importable by the children.  This is covered\nin *note Programming guidelines: 2d7b. however it is worth pointing\nout here.  This means that some examples, such as the *note\nmultiprocessing.pool.Pool: ddb. examples will not work in the\ninteractive interpreter.  For example:\n\n>>> from multiprocessing import Pool\n>>> p = Pool(5)\n>>> def f(x):\n...     return x*x\n...\n>>> with p:\n...     p.map(f, [1,2,3])\nProcess PoolWorker-1:\nProcess PoolWorker-2:\nProcess PoolWorker-3:\nTraceback (most recent call last):\nTraceback (most recent call last):\nTraceback (most recent call last):\nAttributeError: Can't get attribute 'f' on <module 'main' (<class 'frozenimportlib.BuiltinImporter'>)>\nAttributeError: Can't get attribute 'f' on <module 'main' (<class 'frozenimportlib.BuiltinImporter'>)>\nAttributeError: Can't get attribute 'f' on <module 'main' (<class 'frozenimportlib.BuiltinImporter'>)>\n\n(If you try this it will actually output three full tracebacks\ninterleaved in a semi-random fashion, and then you may have to stop\nthe parent process somehow.)\n\nFile: python3.12.info,  Node: Reference<2>,  Next: Programming guidelines,  Prev: Introduction<7>,  Up: multiprocessing -- Process-based parallelism\n\n5.17.2.8 Reference\n..................\n\nThe *note multiprocessing: 8f. package mostly replicates the API of the\n*note threading: e7. module.\n\n* Menu:\n\n* Process and exceptions::\n* Pipes and Queues::\n* Miscellaneous: Miscellaneous<3>.\n* Connection Objects::\n* Synchronization primitives::\n* Shared ctypes Objects::\n* Managers::\n* Proxy Objects::\n* Process Pools::\n* Listeners and Clients::\n* Authentication keys::\n* Logging: Logging<2>.\n* The multiprocessing.dummy module: The multiprocessing dummy module.\n\nFile: python3.12.info,  Node: Process and exceptions,  Next: Pipes and Queues,  Up: Reference<2>\n\n5.17.2.9 'Process' and exceptions\n.................................\n\n-- Class: multiprocessing.Process (group=None, target=None, name=None,\nargs=(), kwargs={}, *, daemon=None)\n\nProcess objects represent activity that is run in a separate\nprocess.  The *note Process: 996. class has equivalents of all the\nmethods of *note threading.Thread: 76c.\n\nThe constructor should always be called with keyword arguments.\n'group' should always be 'None'; it exists solely for compatibility\nwith *note threading.Thread: 76c.  'target' is the callable object\nto be invoked by the *note run(): 2d7d. method.  It defaults to\n'None', meaning nothing is called.  'name' is the process name (see\n*note name: 2d8e. for more details).  'args' is the argument tuple\nfor the target invocation.  'kwargs' is a dictionary of keyword\narguments for the target invocation.  If provided, the keyword-only\n'daemon' argument sets the process *note daemon: 2d8f. flag to\n'True' or 'False'.  If 'None' (the default), this flag will be\ninherited from the creating process.\n\nBy default, no arguments are passed to 'target'.  The 'args'\nargument, which defaults to '()', can be used to specify a list or\ntuple of the arguments to pass to 'target'.\n\nIf a subclass overrides the constructor, it must make sure it\ninvokes the base class constructor ('Process.init()') before\ndoing anything else to the process.\n\nChanged in version 3.3: Added the 'daemon' parameter.\n\n-- Method: run ()\n\nMethod representing the process's activity.\n\nYou may override this method in a subclass.  The standard\n*note run(): 2d7d. method invokes the callable object passed\nto the object's constructor as the target argument, if any,\nwith sequential and keyword arguments taken from the 'args'\nand 'kwargs' arguments, respectively.\n\nUsing a list or tuple as the 'args' argument passed to *note\nProcess: 996. achieves the same effect.\n\nExample:\n\n>>> from multiprocessing import Process\n>>> p = Process(target=print, args=[1])\n>>> p.run()\n1\n>>> p = Process(target=print, args=(1,))\n>>> p.run()\n1\n\n-- Method: start ()\n\nStart the process's activity.\n\nThis must be called at most once per process object.  It\narranges for the object's *note run(): 2d7d. method to be\ninvoked in a separate process.\n\n-- Method: join ([timeout])\n\nIf the optional argument 'timeout' is 'None' (the default),\nthe method blocks until the process whose *note join(): 2d90.\nmethod is called terminates.  If 'timeout' is a positive\nnumber, it blocks at most 'timeout' seconds.  Note that the\nmethod returns 'None' if its process terminates or if the\nmethod times out.  Check the process's *note exitcode: 2d91.\nto determine if it terminated.\n\nA process can be joined many times.\n\nA process cannot join itself because this would cause a\ndeadlock.  It is an error to attempt to join a process before\nit has been started.\n\n-- Attribute: name\n\nThe process's name.  The name is a string used for\nidentification purposes only.  It has no semantics.  Multiple\nprocesses may be given the same name.\n\nThe initial name is set by the constructor.  If no explicit\nname is provided to the constructor, a name of the form\n'Process-N[1]:N[2]:...:N[k]' is constructed, where each N[k] is\nthe N-th child of its parent.\n\n-- Method: isalive ()\n\nReturn whether the process is alive.\n\nRoughly, a process object is alive from the moment the *note\nstart(): 2d7a. method returns until the child process\nterminates.\n\n-- Attribute: daemon\n\nThe process's daemon flag, a Boolean value.  This must be set\nbefore *note start(): 2d7a. is called.\n\nThe initial value is inherited from the creating process.\n\nWhen a process exits, it attempts to terminate all of its\ndaemonic child processes.\n\nNote that a daemonic process is not allowed to create child\nprocesses.  Otherwise a daemonic process would leave its\nchildren orphaned if it gets terminated when its parent\nprocess exits.  Additionally, these are 'not' Unix daemons or\nservices, they are normal processes that will be terminated\n(and not joined) if non-daemonic processes have exited.\n\nIn addition to the *note threading.Thread: 76c. API, *note Process:\n996. objects also support the following attributes and methods:\n\n-- Attribute: pid\n\nReturn the process ID. Before the process is spawned, this\nwill be 'None'.\n\n-- Attribute: exitcode\n\nThe child's exit code.  This will be 'None' if the process has\nnot yet terminated.\n\nIf the child's *note run(): 2d7d. method returned normally,\nthe exit code will be 0.  If it terminated via *note\nsys.exit(): 11c2. with an integer argument 'N', the exit code\nwill be 'N'.\n\nIf the child terminated due to an exception not caught within\n*note run(): 2d7d, the exit code will be 1.  If it was\nterminated by signal 'N', the exit code will be the negative\nvalue '-N'.\n\n-- Attribute: authkey\n\nThe process's authentication key (a byte string).\n\nWhen *note multiprocessing: 8f. is initialized the main\nprocess is assigned a random string using *note os.urandom():\n276.\n\nWhen a *note Process: 996. object is created, it will inherit\nthe authentication key of its parent process, although this\nmay be changed by setting *note authkey: 2d94. to another byte\nstring.\n\nSee *note Authentication keys: 2d95.\n\n-- Attribute: sentinel\n\nA numeric handle of a system object which will become \"ready\"\nwhen the process ends.\n\nYou can use this value if you want to wait on several events\nat once using *note multiprocessing.connection.wait(): f4f.\nOtherwise calling *note join(): 2d90. is simpler.\n\nOn Windows, this is an OS handle usable with the\n'WaitForSingleObject' and 'WaitForMultipleObjects' family of\nAPI calls.  On POSIX, this is a file descriptor usable with\nprimitives from the *note select: bc. module.\n\nNew in version 3.3.\n\n-- Method: terminate ()\n\nTerminate the process.  On POSIX this is done using the *note\nSIGTERM: 1234. signal; on Windows 'TerminateProcess()' is\nused.  Note that exit handlers and finally clauses, etc., will\nnot be executed.\n\nNote that descendant processes of the process will 'not' be\nterminated - they will simply become orphaned.\n\nWarning: If this method is used when the associated\nprocess is using a pipe or queue then the pipe or queue\nis liable to become corrupted and may become unusable by\nother process.  Similarly, if the process has acquired a\nlock or semaphore etc.  then terminating it is liable to\ncause other processes to deadlock.\n\n-- Method: kill ()\n\nSame as *note terminate(): 2d96. but using the 'SIGKILL'\nsignal on POSIX.\n\nNew in version 3.7.\n\n-- Method: close ()\n\nClose the *note Process: 996. object, releasing all resources\nassociated with it.  *note ValueError: 183. is raised if the\nunderlying process is still running.  Once *note close(): 994.\nreturns successfully, most other methods and attributes of the\n*note Process: 996. object will raise *note ValueError: 183.\n\nNew in version 3.7.\n\nNote that the *note start(): 2d7a, *note join(): 2d90, *note\nisalive(): 2d92, *note terminate(): 2d96. and *note exitcode:\n2d91. methods should only be called by the process that created the\nprocess object.\n\nExample usage of some of the methods of *note Process: 996.:\n\n>>> import multiprocessing, time, signal\n>>> mpcontext = multiprocessing.getcontext('spawn')\n>>> p = mpcontext.Process(target=time.sleep, args=(1000,))\n>>> print(p, p.isalive())\n<...Process ... initial> False\n>>> p.start()\n>>> print(p, p.isalive())\n<...Process ... started> True\n>>> p.terminate()\n>>> time.sleep(0.1)\n>>> print(p, p.isalive())\n<...Process ... stopped exitcode=-SIGTERM> False\n>>> p.exitcode == -signal.SIGTERM\nTrue\n\n-- Exception: multiprocessing.ProcessError\n\nThe base class of all *note multiprocessing: 8f. exceptions.\n\n-- Exception: multiprocessing.BufferTooShort\n\nException raised by 'Connection.recvbytesinto()' when the\nsupplied buffer object is too small for the message read.\n\nIf 'e' is an instance of *note BufferTooShort: 2d98. then\n'e.args[0]' will give the message as a byte string.\n\n-- Exception: multiprocessing.AuthenticationError\n\nRaised when there is an authentication error.\n\n-- Exception: multiprocessing.TimeoutError\n\nRaised by methods with a timeout when the timeout expires.\n\nFile: python3.12.info,  Node: Pipes and Queues,  Next: Miscellaneous<3>,  Prev: Process and exceptions,  Up: Reference<2>\n\n5.17.2.10 Pipes and Queues\n..........................\n",
            "subsections": []
        },
        "When using multiple processes, one generally uses message passing for": {
            "content": "communication between processes and avoids having to use any\nsynchronization primitives like locks.\n\nFor passing messages one can use *note Pipe(): 2d7f. (for a connection\nbetween two processes) or a queue (which allows multiple producers and\nconsumers).\n\nThe *note Queue: 13cf, *note SimpleQueue: 730. and *note JoinableQueue:\n2d9c. types are multi-producer, multi-consumer FIFO queues modelled on\nthe *note queue.Queue: 1203. class in the standard library.  They differ\nin that *note Queue: 13cf. lacks the *note taskdone(): 2d9d. and *note\njoin(): 2d9e. methods introduced into Python 2.5's *note queue.Queue:\n1203. class.\n\nIf you use *note JoinableQueue: 2d9c. then you 'must' call *note",
            "subsections": []
        },
        "JoinableQueue.taskdone(): 2d9f. for each task removed from the queue or": {
            "content": "else the semaphore used to count the number of unfinished tasks may\neventually overflow, raising an exception.\n",
            "subsections": []
        },
        "Note that one can also create a shared queue by using a manager object -": {
            "content": "see *note Managers: 2da0.\n\nNote: *note multiprocessing: 8f. uses the usual *note queue.Empty:\n2da1. and *note queue.Full: 2da2. exceptions to signal a timeout.\nThey are not available in the *note multiprocessing: 8f. namespace\nso you need to import them from *note queue: b1.\n\nNote: When an object is put on a queue, the object is pickled and a\nbackground thread later flushes the pickled data to an underlying\npipe.  This has some consequences which are a little surprising,\nbut should not cause any practical difficulties - if they really\nbother you then you can instead use a queue created with a *note\nmanager: 2da0.\n\n1. After putting an object on an empty queue there may be an\ninfinitesimal delay before the queue's *note empty(): 2da3.\nmethod returns *note False: 971. and *note getnowait(): 2da4.\ncan return without raising *note queue.Empty: 2da1.\n\n2. If multiple processes are enqueuing objects, it is possible\nfor the objects to be received at the other end out-of-order.\nHowever, objects enqueued by the same process will always be\nin the expected order with respect to each other.\n\nWarning: If a process is killed using *note Process.terminate():\n2d96. or *note os.kill(): 11db. while it is trying to use a *note\nQueue: 13cf, then the data in the queue is likely to become\ncorrupted.  This may cause any other process to get an exception\nwhen it tries to use the queue later on.\n\nWarning: As mentioned above, if a child process has put items on a\nqueue (and it has not used *note JoinableQueue.canceljointhread:\n2da5.), then that process will not terminate until all buffered\nitems have been flushed to the pipe.\n\nThis means that if you try joining that process you may get a\ndeadlock unless you are sure that all items which have been put on\nthe queue have been consumed.  Similarly, if the child process is\nnon-daemonic then the parent process may hang on exit when it tries\nto join all its non-daemonic children.\n\nNote that a queue created using a manager does not have this issue.\nSee *note Programming guidelines: 2d7b.\n",
            "subsections": []
        },
        "For an example of the usage of queues for interprocess communication see": {
            "content": "*note Examples: 2da6.\n\n-- Function: multiprocessing.Pipe ([duplex])\n\nReturns a pair '(conn1, conn2)' of *note Connection: 13cb. objects\nrepresenting the ends of a pipe.\n\nIf 'duplex' is 'True' (the default) then the pipe is bidirectional.\nIf 'duplex' is 'False' then the pipe is unidirectional: 'conn1' can\nonly be used for receiving messages and 'conn2' can only be used\nfor sending messages.\n\n-- Class: multiprocessing.Queue ([maxsize])\n\nReturns a process shared queue implemented using a pipe and a few\nlocks/semaphores.  When a process first puts an item on the queue a\nfeeder thread is started which transfers objects from a buffer into\nthe pipe.\n\nThe usual *note queue.Empty: 2da1. and *note queue.Full: 2da2.\nexceptions from the standard library's *note queue: b1. module are\nraised to signal timeouts.\n\n*note Queue: 13cf. implements all the methods of *note queue.Queue:\n1203. except for *note taskdone(): 2d9d. and *note join(): 2d9e.\n\n-- Method: qsize ()\n\nReturn the approximate size of the queue.  Because of\nmultithreading/multiprocessing semantics, this number is not\nreliable.\n\nNote that this may raise *note NotImplementedError: ba5. on\nplatforms like macOS where 'semgetvalue()' is not\nimplemented.\n\n-- Method: empty ()\n\nReturn 'True' if the queue is empty, 'False' otherwise.\nBecause of multithreading/multiprocessing semantics, this is\nnot reliable.\n\n-- Method: full ()\n\nReturn 'True' if the queue is full, 'False' otherwise.\nBecause of multithreading/multiprocessing semantics, this is\nnot reliable.\n\n-- Method: put (obj[, block[, timeout]])\n\nPut obj into the queue.  If the optional argument 'block' is\n'True' (the default) and 'timeout' is 'None' (the default),\nblock if necessary until a free slot is available.  If\n'timeout' is a positive number, it blocks at most 'timeout'\nseconds and raises the *note queue.Full: 2da2. exception if no\nfree slot was available within that time.  Otherwise ('block'\nis 'False'), put an item on the queue if a free slot is\nimmediately available, else raise the *note queue.Full: 2da2.\nexception ('timeout' is ignored in that case).\n\nChanged in version 3.8: If the queue is closed, *note\nValueError: 183. is raised instead of *note AssertionError:\n476.\n\n-- Method: putnowait (obj)\n\nEquivalent to 'put(obj, False)'.\n\n-- Method: get ([block[, timeout]])\n\nRemove and return an item from the queue.  If optional args\n'block' is 'True' (the default) and 'timeout' is 'None' (the\ndefault), block if necessary until an item is available.  If\n'timeout' is a positive number, it blocks at most 'timeout'\nseconds and raises the *note queue.Empty: 2da1. exception if\nno item was available within that time.  Otherwise (block is\n'False'), return an item if one is immediately available, else\nraise the *note queue.Empty: 2da1. exception ('timeout' is\nignored in that case).\n\nChanged in version 3.8: If the queue is closed, *note\nValueError: 183. is raised instead of *note OSError: 613.\n\n-- Method: getnowait ()\n\nEquivalent to 'get(False)'.\n\n*note multiprocessing.Queue: 13cf. has a few additional methods not\nfound in *note queue.Queue: 1203.  These methods are usually\nunnecessary for most code:\n\n-- Method: close ()\n\nIndicate that no more data will be put on this queue by the\ncurrent process.  The background thread will quit once it has\nflushed all buffered data to the pipe.  This is called\nautomatically when the queue is garbage collected.\n\n-- Method: jointhread ()\n\nJoin the background thread.  This can only be used after *note\nclose(): 155b. has been called.  It blocks until the\nbackground thread exits, ensuring that all data in the buffer\nhas been flushed to the pipe.\n\nBy default if a process is not the creator of the queue then\non exit it will attempt to join the queue's background thread.\nThe process can call *note canceljointhread(): 2da5. to make\n*note jointhread(): 2daa. do nothing.\n\n-- Method: canceljointhread ()\n\nPrevent *note jointhread(): 2daa. from blocking.  In\nparticular, this prevents the background thread from being\njoined automatically when the process exits - see *note\njointhread(): 2daa.\n\nA better name for this method might be\n'allowexitwithoutflush()'.  It is likely to cause enqueued\ndata to be lost, and you almost certainly will not need to use\nit.  It is really only there if you need the current process\nto exit immediately without waiting to flush enqueued data to\nthe underlying pipe, and you don't care about lost data.\n\nNote: This class's functionality requires a functioning shared\nsemaphore implementation on the host operating system.\nWithout one, the functionality in this class will be disabled,\nand attempts to instantiate a *note Queue: 13cf. will result\nin an *note ImportError: 145.  See bpo-3770(1) for additional\ninformation.  The same holds true for any of the specialized\nqueue types listed below.\n\n-- Class: multiprocessing.SimpleQueue\n\nIt is a simplified *note Queue: 13cf. type, very close to a locked\n*note Pipe: 2d7f.\n\n-- Method: close ()\n\nClose the queue: release internal resources.\n\nA queue must not be used anymore after it is closed.  For\nexample, *note get(): 2dab, *note put(): 2dac. and *note\nempty(): 2dad. methods must no longer be called.\n\nNew in version 3.9.\n\n-- Method: empty ()\n\nReturn 'True' if the queue is empty, 'False' otherwise.\n\n-- Method: get ()\n\nRemove and return an item from the queue.\n\n-- Method: put (item)\n\nPut 'item' into the queue.\n\n-- Class: multiprocessing.JoinableQueue ([maxsize])\n\n*note JoinableQueue: 2d9c, a *note Queue: 13cf. subclass, is a\nqueue which additionally has *note taskdone(): 2d9f. and *note\njoin(): 2dae. methods.\n\n-- Method: taskdone ()\n\nIndicate that a formerly enqueued task is complete.  Used by\nqueue consumers.  For each *note get(): 17ba. used to fetch a\ntask, a subsequent call to *note taskdone(): 2d9f. tells the\nqueue that the processing on the task is complete.\n\nIf a *note join(): 2d9e. is currently blocking, it will resume\nwhen all items have been processed (meaning that a *note\ntaskdone(): 2d9f. call was received for every item that had\nbeen *note put(): 17b9. into the queue).\n\nRaises a *note ValueError: 183. if called more times than\nthere were items placed in the queue.\n\n-- Method: join ()\n\nBlock until all items in the queue have been gotten and\nprocessed.\n\nThe count of unfinished tasks goes up whenever an item is\nadded to the queue.  The count goes down whenever a consumer\ncalls *note taskdone(): 2d9f. to indicate that the item was\nretrieved and all work on it is complete.  When the count of\nunfinished tasks drops to zero, *note join(): 2d9e. unblocks.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=3770\n\nFile: python3.12.info,  Node: Miscellaneous<3>,  Next: Connection Objects,  Prev: Pipes and Queues,  Up: Reference<2>\n\n5.17.2.11 Miscellaneous\n.......................\n\n-- Function: multiprocessing.activechildren ()\n\nReturn list of all live children of the current process.\n\nCalling this has the side effect of \"joining\" any processes which\nhave already finished.\n\n-- Function: multiprocessing.cpucount ()\n\nReturn the number of CPUs in the system.\n\nThis number is not equivalent to the number of CPUs the current\nprocess can use.  The number of usable CPUs can be obtained with\n'len(os.schedgetaffinity(0))'\n\nWhen the number of CPUs cannot be determined a *note\nNotImplementedError: ba5. is raised.\n\nSee also\n........\n\n*note os.cpucount(): 60b.\n\n-- Function: multiprocessing.currentprocess ()\n\nReturn the *note Process: 996. object corresponding to the current\nprocess.\n\nAn analogue of *note threading.currentthread(): 66b.\n\n-- Function: multiprocessing.parentprocess ()\n\nReturn the *note Process: 996. object corresponding to the parent\nprocess of the *note currentprocess(): 2db1.  For the main\nprocess, 'parentprocess' will be 'None'.\n\nNew in version 3.8.\n\n-- Function: multiprocessing.freezesupport ()\n\nAdd support for when a program which uses *note multiprocessing:\n8f. has been frozen to produce a Windows executable.  (Has been\ntested with 'py2exe', 'PyInstaller' and 'cxFreeze'.)\n\nOne needs to call this function straight after the 'if name ==\n'main'' line of the main module.  For example:\n\nfrom multiprocessing import Process, freezesupport\n\ndef f():\nprint('hello world!')\n\nif name == 'main':\nfreezesupport()\nProcess(target=f).start()\n\nIf the 'freezesupport()' line is omitted then trying to run the\nfrozen executable will raise *note RuntimeError: 17a.\n\nCalling 'freezesupport()' has no effect when invoked on any\noperating system other than Windows.  In addition, if the module is\nbeing run normally by the Python interpreter on Windows (the\nprogram has not been frozen), then 'freezesupport()' has no\neffect.\n\n-- Function: multiprocessing.getallstartmethods ()\n\nReturns a list of the supported start methods, the first of which\nis the default.  The possible start methods are ''fork'', ''spawn''\nand ''forkserver''.  Not all platforms support all methods.  See\n*note Contexts and start methods: 22d.\n\nNew in version 3.4.\n\n-- Function: multiprocessing.getcontext (method=None)\n\nReturn a context object which has the same attributes as the *note\nmultiprocessing: 8f. module.\n\nIf 'method' is 'None' then the default context is returned.\nOtherwise 'method' should be ''fork'', ''spawn'', ''forkserver''.\n*note ValueError: 183. is raised if the specified start method is\nnot available.  See *note Contexts and start methods: 22d.\n\nNew in version 3.4.\n\n-- Function: multiprocessing.getstartmethod (allownone=False)\n\nReturn the name of start method used for starting processes.\n\nIf the start method has not been fixed and 'allownone' is false,\nthen the start method is fixed to the default and the name is\nreturned.  If the start method has not been fixed and 'allownone'\nis true then 'None' is returned.\n\nThe return value can be ''fork'', ''spawn'', ''forkserver'' or\n'None'.  See *note Contexts and start methods: 22d.\n\nNew in version 3.4.\n\nChanged in version 3.8: On macOS, the 'spawn' start method is now\nthe default.  The 'fork' start method should be considered unsafe\nas it can lead to crashes of the subprocess.  See bpo-33725(1).\n\n-- Function: multiprocessing.setexecutable (executable)\n\nSet the path of the Python interpreter to use when starting a child\nprocess.  (By default *note sys.executable: 330. is used).\nEmbedders will probably need to do some thing like\n\nsetexecutable(os.path.join(sys.execprefix, 'pythonw.exe'))\n\nbefore they can create child processes.\n\nChanged in version 3.4: Now supported on POSIX when the ''spawn''\nstart method is used.\n\nChanged in version 3.11: Accepts a *note path-like object: 957.\n\n-- Function: multiprocessing.setforkserverpreload (modulenames)\n\nSet a list of module names for the forkserver main process to\nattempt to import so that their already imported state is inherited\nby forked processes.  Any *note ImportError: 145. when doing so is\nsilently ignored.  This can be used as a performance enhancement to\navoid repeated work in every process.\n\nFor this to work, it must be called before the forkserver process\nhas been launched (before creating a 'Pool' or starting a *note\nProcess: 996.).\n\nOnly meaningful when using the ''forkserver'' start method.  See\n*note Contexts and start methods: 22d.\n\nNew in version 3.4.\n\n-- Function: multiprocessing.setstartmethod (method, force=False)\n\nSet the method which should be used to start child processes.  The\n'method' argument can be ''fork'', ''spawn'' or ''forkserver''.\nRaises *note RuntimeError: 17a. if the start method has already\nbeen set and 'force' is not 'True'.  If 'method' is 'None' and\n'force' is 'True' then the start method is set to 'None'.  If\n'method' is 'None' and 'force' is 'False' then the context is set\nto the default context.\n\nNote that this should be called at most once, and it should be\nprotected inside the 'if name == 'main'' clause of the main\nmodule.\n\nSee *note Contexts and start methods: 22d.\n\nNew in version 3.4.\n\nNote: *note multiprocessing: 8f. contains no analogues of *note\nthreading.activecount(): 66c, *note threading.enumerate(): 1607,\n*note threading.settrace(): 63e, *note threading.setprofile(): 63f,\n*note threading.Timer: fce, or *note threading.local: 14bb.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33725\n\nFile: python3.12.info,  Node: Connection Objects,  Next: Synchronization primitives,  Prev: Miscellaneous<3>,  Up: Reference<2>\n\n5.17.2.12 Connection Objects\n............................\n",
            "subsections": []
        },
        "Connection objects allow the sending and receiving of picklable objects": {
            "content": "or strings.  They can be thought of as message oriented connected\nsockets.\n\nConnection objects are usually created using *note Pipe: 2d7f. - see\nalso *note Listeners and Clients: 2db5.\n\n-- Class: multiprocessing.connection.Connection\n\n-- Method: send (obj)\n\nSend an object to the other end of the connection which should\nbe read using *note recv(): 2db7.\n\nThe object must be picklable.  Very large pickles\n(approximately 32 MiB+, though it depends on the OS) may raise\na *note ValueError: 183. exception.\n\n-- Method: recv ()\n\nReturn an object sent from the other end of the connection\nusing *note send(): 2db6.  Blocks until there is something to\nreceive.  Raises *note EOFError: 114e. if there is nothing\nleft to receive and the other end was closed.\n\n-- Method: fileno ()\n\nReturn the file descriptor or handle used by the connection.\n\n-- Method: close ()\n\nClose the connection.\n\nThis is called automatically when the connection is garbage\ncollected.\n\n-- Method: poll ([timeout])\n\nReturn whether there is any data available to be read.\n\nIf 'timeout' is not specified then it will return immediately.\nIf 'timeout' is a number then this specifies the maximum time\nin seconds to block.  If 'timeout' is 'None' then an infinite\ntimeout is used.\n\nNote that multiple connection objects may be polled at once by\nusing *note multiprocessing.connection.wait(): f4f.\n\n-- Method: sendbytes (buffer[, offset[, size]])\n\nSend byte data from a *note bytes-like object: b82. as a\ncomplete message.\n\nIf 'offset' is given then data is read from that position in\n'buffer'.  If 'size' is given then that many bytes will be\nread from buffer.  Very large buffers (approximately 32 MiB+,\nthough it depends on the OS) may raise a *note ValueError:\n183. exception\n\n-- Method: recvbytes ([maxlength])\n\nReturn a complete message of byte data sent from the other end\nof the connection as a string.  Blocks until there is\nsomething to receive.  Raises *note EOFError: 114e. if there\nis nothing left to receive and the other end has closed.\n\nIf 'maxlength' is specified and the message is longer than\n'maxlength' then *note OSError: 613. is raised and the\nconnection will no longer be readable.\n\nChanged in version 3.3: This function used to raise *note\nIOError: ecb, which is now an alias of *note OSError: 613.\n\n-- Method: recvbytesinto (buffer[, offset])\n\nRead into 'buffer' a complete message of byte data sent from\nthe other end of the connection and return the number of bytes\nin the message.  Blocks until there is something to receive.\nRaises *note EOFError: 114e. if there is nothing left to\nreceive and the other end was closed.\n\n'buffer' must be a writable *note bytes-like object: b82.  If\n'offset' is given then the message will be written into the\nbuffer from that position.  Offset must be a non-negative\ninteger less than the length of 'buffer' (in bytes).\n\nIf the buffer is too short then a 'BufferTooShort' exception\nis raised and the complete message is available as 'e.args[0]'\nwhere 'e' is the exception instance.\n\nChanged in version 3.3: Connection objects themselves can now be\ntransferred between processes using *note Connection.send(): 2db6.\nand *note Connection.recv(): 2db7.\n\nConnection objects also now support the context management protocol\n- see *note Context Manager Types: 1cc6.  *note enter(): 1f55.\nreturns the connection object, and *note exit(): 1f56. calls\n*note close(): 2db9.\n\nFor example:\n\n>>> from multiprocessing import Pipe\n>>> a, b = Pipe()\n>>> a.send([1, 'hello', None])\n>>> b.recv()\n[1, 'hello', None]\n>>> b.sendbytes(b'thank you')\n>>> a.recvbytes()\nb'thank you'\n>>> import array\n>>> arr1 = array.array('i', range(5))\n>>> arr2 = array.array('i', [0] * 10)\n>>> a.sendbytes(arr1)\n>>> count = b.recvbytesinto(arr2)\n>>> assert count == len(arr1) * arr1.itemsize\n>>> arr2\narray('i', [0, 1, 2, 3, 4, 0, 0, 0, 0, 0])\nWarning: The *note Connection.recv(): 2db7. method automatically\nunpickles the data it receives, which can be a security risk unless\nyou can trust the process which sent the message.\n\nTherefore, unless the connection object was produced using 'Pipe()'\nyou should only use the *note recv(): 2db7. and *note send(): 2db6.\nmethods after performing some sort of authentication.  See *note\nAuthentication keys: 2d95.\n\nWarning: If a process is killed while it is trying to read or write\nto a pipe then the data in the pipe is likely to become corrupted,\nbecause it may become impossible to be sure where the message\nboundaries lie.\n\nFile: python3.12.info,  Node: Synchronization primitives,  Next: Shared ctypes Objects,  Prev: Connection Objects,  Up: Reference<2>\n\n5.17.2.13 Synchronization primitives\n....................................\n",
            "subsections": []
        },
        "Generally synchronization primitives are not as necessary in a": {
            "content": "multiprocess program as they are in a multithreaded program.  See the\ndocumentation for *note threading: e7. module.\n",
            "subsections": []
        },
        "Note that one can also create synchronization primitives by using a": {
            "content": "manager object - see *note Managers: 2da0.\n\n-- Class: multiprocessing.Barrier (parties[, action[, timeout]])\n\nA barrier object: a clone of *note threading.Barrier: 1057.\n\nNew in version 3.3.\n\n-- Class: multiprocessing.BoundedSemaphore ([value])\n\nA bounded semaphore object: a close analog of *note\nthreading.BoundedSemaphore: fcc.\n\nA solitary difference from its close analog exists: its 'acquire'\nmethod's first argument is named 'block', as is consistent with\n*note Lock.acquire(): 2dc0.\n\nNote: On macOS, this is indistinguishable from *note\nSemaphore: 2d87. because 'semgetvalue()' is not implemented\non that platform.\n\n-- Class: multiprocessing.Condition ([lock])\n\nA condition variable: an alias for *note threading.Condition: fca.\n\nIf 'lock' is specified then it should be a *note Lock: 2d85. or\n*note RLock: 2d86. object from *note multiprocessing: 8f.\n\nChanged in version 3.3: The *note waitfor(): 2d61. method was\nadded.\n\n-- Class: multiprocessing.Event\n\nA clone of *note threading.Event: fcd.\n\n-- Class: multiprocessing.Lock\n\nA non-recursive lock object: a close analog of *note\nthreading.Lock: 2d58.  Once a process or thread has acquired a\nlock, subsequent attempts to acquire it from any process or thread\nwill block until it is released; any process or thread may release\nit.  The concepts and behaviors of *note threading.Lock: 2d58. as\nit applies to threads are replicated here in *note\nmultiprocessing.Lock: 2d85. as it applies to either processes or\nthreads, except as noted.\n\nNote that *note Lock: 2d85. is actually a factory function which\nreturns an instance of 'multiprocessing.synchronize.Lock'\ninitialized with a default context.\n\n*note Lock: 2d85. supports the *note context manager: 398. protocol\nand thus may be used in *note with: 396. statements.\n\n-- Method: acquire (block=True, timeout=None)\n\nAcquire a lock, blocking or non-blocking.\n\nWith the 'block' argument set to 'True' (the default), the\nmethod call will block until the lock is in an unlocked state,\nthen set it to locked and return 'True'.  Note that the name\nof this first argument differs from that in *note\nthreading.Lock.acquire(): 464.\n\nWith the 'block' argument set to 'False', the method call does\nnot block.  If the lock is currently in a locked state, return\n'False'; otherwise set the lock to a locked state and return\n'True'.\n\nWhen invoked with a positive, floating-point value for\n'timeout', block for at most the number of seconds specified\nby 'timeout' as long as the lock can not be acquired.\nInvocations with a negative value for 'timeout' are equivalent\nto a 'timeout' of zero.  Invocations with a 'timeout' value of\n'None' (the default) set the timeout period to infinite.  Note\nthat the treatment of negative or 'None' values for 'timeout'\ndiffers from the implemented behavior in *note\nthreading.Lock.acquire(): 464.  The 'timeout' argument has no\npractical implications if the 'block' argument is set to\n'False' and is thus ignored.  Returns 'True' if the lock has\nbeen acquired or 'False' if the timeout period has elapsed.\n\n-- Method: release ()\n\nRelease a lock.  This can be called from any process or\nthread, not only the process or thread which originally\nacquired the lock.\n\nBehavior is the same as in *note threading.Lock.release():\n1138. except that when invoked on an unlocked lock, a *note\nValueError: 183. is raised.\n\n-- Class: multiprocessing.RLock\n\nA recursive lock object: a close analog of *note threading.RLock:\n10cc.  A recursive lock must be released by the process or thread\nthat acquired it.  Once a process or thread has acquired a\nrecursive lock, the same process or thread may acquire it again\nwithout blocking; that process or thread must release it once for\neach time it has been acquired.\n\nNote that *note RLock: 2d86. is actually a factory function which\nreturns an instance of 'multiprocessing.synchronize.RLock'\ninitialized with a default context.\n\n*note RLock: 2d86. supports the *note context manager: 398.\nprotocol and thus may be used in *note with: 396. statements.\n\n-- Method: acquire (block=True, timeout=None)\n\nAcquire a lock, blocking or non-blocking.\n\nWhen invoked with the 'block' argument set to 'True', block\nuntil the lock is in an unlocked state (not owned by any\nprocess or thread) unless the lock is already owned by the\ncurrent process or thread.  The current process or thread then\ntakes ownership of the lock (if it does not already have\nownership) and the recursion level inside the lock increments\nby one, resulting in a return value of 'True'.  Note that\nthere are several differences in this first argument's\nbehavior compared to the implementation of *note\nthreading.RLock.acquire(): cdf, starting with the name of the\nargument itself.\n\nWhen invoked with the 'block' argument set to 'False', do not\nblock.  If the lock has already been acquired (and thus is\nowned) by another process or thread, the current process or\nthread does not take ownership and the recursion level within\nthe lock is not changed, resulting in a return value of\n'False'.  If the lock is in an unlocked state, the current\nprocess or thread takes ownership and the recursion level is\nincremented, resulting in a return value of 'True'.\n\nUse and behaviors of the 'timeout' argument are the same as in\n*note Lock.acquire(): 2dc0.  Note that some of these behaviors\nof 'timeout' differ from the implemented behaviors in *note\nthreading.RLock.acquire(): cdf.\n\n-- Method: release ()\n\nRelease a lock, decrementing the recursion level.  If after\nthe decrement the recursion level is zero, reset the lock to\nunlocked (not owned by any process or thread) and if any other\nprocesses or threads are blocked waiting for the lock to\nbecome unlocked, allow exactly one of them to proceed.  If\nafter the decrement the recursion level is still nonzero, the\nlock remains locked and owned by the calling process or\nthread.\n\nOnly call this method when the calling process or thread owns\nthe lock.  An *note AssertionError: 476. is raised if this\nmethod is called by a process or thread other than the owner\nor if the lock is in an unlocked (unowned) state.  Note that\nthe type of exception raised in this situation differs from\nthe implemented behavior in *note threading.RLock.release():\n2d5c.\n\n-- Class: multiprocessing.Semaphore ([value])\n\nA semaphore object: a close analog of *note threading.Semaphore:\nfcb.\n\nA solitary difference from its close analog exists: its 'acquire'\nmethod's first argument is named 'block', as is consistent with\n*note Lock.acquire(): 2dc0.\n\nNote: On macOS, 'semtimedwait' is unsupported, so calling\n'acquire()' with a timeout will emulate that function's behavior\nusing a sleeping loop.\n\nNote: If the SIGINT signal generated by 'Ctrl-C' arrives while the\nmain thread is blocked by a call to 'BoundedSemaphore.acquire()',\n*note Lock.acquire(): 2dc0, *note RLock.acquire(): 2dc2,\n'Semaphore.acquire()', 'Condition.acquire()' or 'Condition.wait()'\nthen the call will be immediately interrupted and *note\nKeyboardInterrupt: 7f5. will be raised.\n\nThis differs from the behaviour of *note threading: e7. where\nSIGINT will be ignored while the equivalent blocking calls are in\nprogress.\n\nNote: Some of this package's functionality requires a functioning\nshared semaphore implementation on the host operating system.\nWithout one, the 'multiprocessing.synchronize' module will be\ndisabled, and attempts to import it will result in an *note\nImportError: 145.  See bpo-3770(1) for additional information.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=3770\n\nFile: python3.12.info,  Node: Shared ctypes Objects,  Next: Managers,  Prev: Synchronization primitives,  Up: Reference<2>\n\n5.17.2.14 Shared 'ctypes' Objects\n.................................\n",
            "subsections": []
        },
        "It is possible to create shared objects using shared memory which can be": {
            "content": "inherited by child processes.\n\n-- Function: multiprocessing.Value (typecodeortype, *args, lock=True)\n\nReturn a *note ctypes: 28. object allocated from shared memory.  By\ndefault the return value is actually a synchronized wrapper for the\nobject.  The object itself can be accessed via the 'value'\nattribute of a *note Value: 2d82.\n\n'typecodeortype' determines the type of the returned object: it\nis either a ctypes type or a one character typecode of the kind\nused by the *note array: 7. module.  '*args' is passed on to the\nconstructor for the type.\n\nIf 'lock' is 'True' (the default) then a new recursive lock object\nis created to synchronize access to the value.  If 'lock' is a\n*note Lock: 2d85. or *note RLock: 2d86. object then that will be\nused to synchronize access to the value.  If 'lock' is 'False' then\naccess to the returned object will not be automatically protected\nby a lock, so it will not necessarily be \"process-safe\".\n\nOperations like '+=' which involve a read and write are not atomic.\nSo if, for instance, you want to atomically increment a shared\nvalue it is insufficient to just do\n\ncounter.value += 1\n\nAssuming the associated lock is recursive (which it is by default)\nyou can instead do\n\nwith counter.getlock():\ncounter.value += 1\n\nNote that 'lock' is a keyword-only argument.\n\n-- Function: multiprocessing.Array (typecodeortype,\nsizeorinitializer, *, lock=True)\n\nReturn a ctypes array allocated from shared memory.  By default the\nreturn value is actually a synchronized wrapper for the array.\n\n'typecodeortype' determines the type of the elements of the\nreturned array: it is either a ctypes type or a one character\ntypecode of the kind used by the *note array: 7. module.  If\n'sizeorinitializer' is an integer, then it determines the length\nof the array, and the array will be initially zeroed.  Otherwise,\n'sizeorinitializer' is a sequence which is used to initialize the\narray and whose length determines the length of the array.\n\nIf 'lock' is 'True' (the default) then a new lock object is created\nto synchronize access to the value.  If 'lock' is a *note Lock:\n2d85. or *note RLock: 2d86. object then that will be used to\nsynchronize access to the value.  If 'lock' is 'False' then access\nto the returned object will not be automatically protected by a\nlock, so it will not necessarily be \"process-safe\".\n\nNote that 'lock' is a keyword only argument.\n\nNote that an array of *note ctypes.cchar: 2cc3. has 'value' and\n'raw' attributes which allow one to use it to store and retrieve\nstrings.\n\n* Menu:\n\n* The multiprocessing.sharedctypes module: The multiprocessing sharedctypes module.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The multiprocessing sharedctypes module,  Up: Shared ctypes Objects": {
            "content": "5.17.2.15 The 'multiprocessing.sharedctypes' module\n...................................................\n\nThe *note multiprocessing.sharedctypes: 95. module provides functions\nfor allocating *note ctypes: 28. objects from shared memory which can be\ninherited by child processes.\n\nNote: Although it is possible to store a pointer in shared memory\nremember that this will refer to a location in the address space of\na specific process.  However, the pointer is quite likely to be\ninvalid in the context of a second process and trying to\ndereference the pointer from the second process may cause a crash.\n\n-- Function: multiprocessing.sharedctypes.RawArray (typecodeortype,\nsizeorinitializer)\n\nReturn a ctypes array allocated from shared memory.\n\n'typecodeortype' determines the type of the elements of the\nreturned array: it is either a ctypes type or a one character\ntypecode of the kind used by the *note array: 7. module.  If\n'sizeorinitializer' is an integer then it determines the length\nof the array, and the array will be initially zeroed.  Otherwise\n'sizeorinitializer' is a sequence which is used to initialize the\narray and whose length determines the length of the array.\n\nNote that setting and getting an element is potentially non-atomic\n- use *note Array(): 2dc7. instead to make sure that access is\nautomatically synchronized using a lock.\n\n-- Function: multiprocessing.sharedctypes.RawValue (typecodeortype,\n*args)\n\nReturn a ctypes object allocated from shared memory.\n\n'typecodeortype' determines the type of the returned object: it\nis either a ctypes type or a one character typecode of the kind\nused by the *note array: 7. module.  '*args' is passed on to the\nconstructor for the type.\n\nNote that setting and getting the value is potentially non-atomic -\nuse *note Value(): 2dc9. instead to make sure that access is\nautomatically synchronized using a lock.\n\nNote that an array of *note ctypes.cchar: 2cc3. has 'value' and\n'raw' attributes which allow one to use it to store and retrieve\nstrings - see documentation for *note ctypes: 28.\n\n-- Function: multiprocessing.sharedctypes.Array (typecodeortype,\nsizeorinitializer, *, lock=True)\n\nThe same as *note RawArray(): 2dc6. except that depending on the\nvalue of 'lock' a process-safe synchronization wrapper may be\nreturned instead of a raw ctypes array.\n\nIf 'lock' is 'True' (the default) then a new lock object is created\nto synchronize access to the value.  If 'lock' is a *note Lock:\n2d85. or *note RLock: 2d86. object then that will be used to\nsynchronize access to the value.  If 'lock' is 'False' then access\nto the returned object will not be automatically protected by a\nlock, so it will not necessarily be \"process-safe\".\n\nNote that 'lock' is a keyword-only argument.\n\n-- Function: multiprocessing.sharedctypes.Value (typecodeortype,\n*args, lock=True)\n\nThe same as *note RawValue(): 2dc8. except that depending on the\nvalue of 'lock' a process-safe synchronization wrapper may be\nreturned instead of a raw ctypes object.\n\nIf 'lock' is 'True' (the default) then a new lock object is created\nto synchronize access to the value.  If 'lock' is a *note Lock:\n2d85. or *note RLock: 2d86. object then that will be used to\nsynchronize access to the value.  If 'lock' is 'False' then access\nto the returned object will not be automatically protected by a\nlock, so it will not necessarily be \"process-safe\".\n\nNote that 'lock' is a keyword-only argument.\n\n-- Function: multiprocessing.sharedctypes.copy (obj)\n\nReturn a ctypes object allocated from shared memory which is a copy\nof the ctypes object 'obj'.\n\n-- Function: multiprocessing.sharedctypes.synchronized (obj[, lock])\n\nReturn a process-safe wrapper object for a ctypes object which uses\n'lock' to synchronize access.  If 'lock' is 'None' (the default)\nthen a *note multiprocessing.RLock: 2d86. object is created\nautomatically.\n\nA synchronized wrapper will have two methods in addition to those\nof the object it wraps: 'getobj()' returns the wrapped object and\n'getlock()' returns the lock object used for synchronization.\n\nNote that accessing the ctypes object through the wrapper can be a\nlot slower than accessing the raw ctypes object.\n\nChanged in version 3.5: Synchronized objects support the *note\ncontext manager: 398. protocol.\n",
            "subsections": []
        },
        "The table below compares the syntax for creating shared ctypes objects": {
            "content": "from shared memory with the normal ctypes syntax.  (In the table\n'MyStruct' is some subclass of *note ctypes.Structure: 13d3.)\n\nctypes                   sharedctypes using type        sharedctypes using typecode\n\n----------------------------------------------------------------------------------------\n\ncdouble(2.4)            RawValue(cdouble, 2.4)        RawValue('d', 2.4)\n\n",
            "subsections": []
        },
        "MyStruct(4, 6)           RawValue(MyStruct, 4, 6)": {
            "content": "(cshort * 7)()          RawArray(cshort, 7)           RawArray('h', 7)\n\n\n(cint * 3)(9, 2, 8)     RawArray(cint, (9, 2, 8))     RawArray('i', (9, 2, 8))\n\n",
            "subsections": []
        },
        "Below is an example where a number of ctypes objects are modified by a": {
            "content": "child process:\n\nfrom multiprocessing import Process, Lock\nfrom multiprocessing.sharedctypes import Value, Array\nfrom ctypes import Structure, cdouble\n\nclass Point(Structure):\nfields = [('x', cdouble), ('y', cdouble)]\n\ndef modify(n, x, s, A):\nn.value = 2\nx.value = 2\ns.value = s.value.upper()\nfor a in A:\na.x = 2\na.y = 2\n\nif name == 'main':\nlock = Lock()\n\nn = Value('i', 7)\nx = Value(cdouble, 1.0/3.0, lock=False)\ns = Array('c', b'hello world', lock=lock)\nA = Array(Point, [(1.875,-6.25), (-5.75,2.0), (2.375,9.5)], lock=lock)\n\np = Process(target=modify, args=(n, x, s, A))\np.start()\np.join()\n\nprint(n.value)\nprint(x.value)\nprint(s.value)\nprint([(a.x, a.y) for a in A])\n",
            "subsections": []
        },
        "The results printed are": {
            "content": "49\n0.1111111111111111\nHELLO WORLD\n[(3.515625, 39.0625), (33.0625, 4.0), (5.640625, 90.25)]\n\nFile: python3.12.info,  Node: Managers,  Next: Proxy Objects,  Prev: Shared ctypes Objects,  Up: Reference<2>\n\n5.17.2.16 Managers\n..................\n",
            "subsections": []
        },
        "Managers provide a way to create data which can be shared between": {
            "content": "different processes, including sharing over a network between processes\nrunning on different machines.  A manager object controls a server\nprocess which manages 'shared objects'.  Other processes can access the\nshared objects by using proxies.\n\n-- Function: multiprocessing.Manager ()\n\nReturns a started *note SyncManager: 2dcc. object which can be used\nfor sharing objects between processes.  The returned manager object\ncorresponds to a spawned child process and has methods which will\ncreate shared objects and return corresponding proxies.\n",
            "subsections": []
        },
        "Manager processes will be shutdown as soon as they are garbage collected": {
            "content": "or their parent process exits.  The manager classes are defined in the\n*note multiprocessing.managers: 92. module:\n\n-- Class: multiprocessing.managers.BaseManager (address=None,\nauthkey=None, serializer='pickle', ctx=None, *,\nshutdowntimeout=1.0)\n\nCreate a BaseManager object.\n\nOnce created one should call *note start(): 2dce. or\n'getserver().serveforever()' to ensure that the manager object\nrefers to a started manager process.\n\n'address' is the address on which the manager process listens for\nnew connections.  If 'address' is 'None' then an arbitrary one is\nchosen.\n\n'authkey' is the authentication key which will be used to check the\nvalidity of incoming connections to the server process.  If\n'authkey' is 'None' then 'currentprocess().authkey' is used.\nOtherwise 'authkey' is used and it must be a byte string.\n\n'serializer' must be ''pickle'' (use *note pickle: a1.\nserialization) or ''xmlrpclib'' (use *note xmlrpc.client: 128.\nserialization).\n\n'ctx' is a context object, or 'None' (use the current context).\nSee the 'getcontext()' function.\n\n'shutdowntimeout' is a timeout in seconds used to wait until the\nprocess used by the manager completes in the *note shutdown():\n2dcf. method.  If the shutdown times out, the process is\nterminated.  If terminating the process also times out, the process\nis killed.\n\nChanged in version 3.11: Added the 'shutdowntimeout' parameter.\n\n-- Method: start ([initializer[, initargs]])\n\nStart a subprocess to start the manager.  If 'initializer' is\nnot 'None' then the subprocess will call\n'initializer(*initargs)' when it starts.\n\n-- Method: getserver ()\n\nReturns a 'Server' object which represents the actual server\nunder the control of the Manager.  The 'Server' object\nsupports the 'serveforever()' method:\n\n>>> from multiprocessing.managers import BaseManager\n>>> manager = BaseManager(address=('', 50000), authkey=b'abc')\n>>> server = manager.getserver()\n>>> server.serveforever()\n\n'Server' additionally has an *note address: 2dd1. attribute.\n\n-- Method: connect ()\n\nConnect a local manager object to a remote manager process:\n\n>>> from multiprocessing.managers import BaseManager\n>>> m = BaseManager(address=('127.0.0.1', 50000), authkey=b'abc')\n>>> m.connect()\n\n-- Method: shutdown ()\n\nStop the process used by the manager.  This is only available\nif *note start(): 2dce. has been used to start the server\nprocess.\n\nThis can be called multiple times.\n\n-- Method: register (typeid[, callable[, proxytype[, exposed[,\nmethodtotypeid[, createmethod]]]]])\n\nA classmethod which can be used for registering a type or\ncallable with the manager class.\n\n'typeid' is a \"type identifier\" which is used to identify a\nparticular type of shared object.  This must be a string.\n\n'callable' is a callable used for creating objects for this\ntype identifier.  If a manager instance will be connected to\nthe server using the *note connect(): 2dd2. method, or if the\n'createmethod' argument is 'False' then this can be left as\n'None'.\n\n'proxytype' is a subclass of *note BaseProxy: 2dd4. which is\nused to create proxies for shared objects with this 'typeid'.\nIf 'None' then a proxy class is created automatically.\n\n'exposed' is used to specify a sequence of method names which\nproxies for this typeid should be allowed to access using\n*note BaseProxy.callmethod(): 2dd5.  (If 'exposed' is 'None'\nthen 'proxytype.exposed' is used instead if it exists.)  In\nthe case where no exposed list is specified, all \"public\nmethods\" of the shared object will be accessible.  (Here a\n\"public method\" means any attribute which has a *note\ncall(): 2b1. method and whose name does not begin with\n''''.)\n\n'methodtotypeid' is a mapping used to specify the return\ntype of those exposed methods which should return a proxy.  It\nmaps method names to typeid strings.  (If 'methodtotypeid'\nis 'None' then 'proxytype.methodtotypeid' is used instead\nif it exists.)  If a method's name is not a key of this\nmapping or if the mapping is 'None' then the object returned\nby the method will be copied by value.\n\n'createmethod' determines whether a method should be created\nwith name 'typeid' which can be used to tell the server\nprocess to create a new shared object and return a proxy for\nit.  By default it is 'True'.\n\n*note BaseManager: 2dcd. instances also have one read-only\nproperty:\n\n-- Attribute: address\n\nThe address used by the manager.\n\nChanged in version 3.3: Manager objects support the context\nmanagement protocol - see *note Context Manager Types: 1cc6.  *note\nenter(): 1f55. starts the server process (if it has not already\nstarted) and then returns the manager object.  *note exit():\n1f56. calls *note shutdown(): 2dcf.\n\nIn previous versions *note enter(): 1f55. did not start the\nmanager's server process if it was not already started.\n\n-- Class: multiprocessing.managers.SyncManager\n\nA subclass of *note BaseManager: 2dcd. which can be used for the\nsynchronization of processes.  Objects of this type are returned by\n*note multiprocessing.Manager(): b09.\n\nIts methods create and return *note Proxy Objects: b08. for a\nnumber of commonly used data types to be synchronized across\nprocesses.  This notably includes shared lists and dictionaries.\n\n-- Method: Barrier (parties[, action[, timeout]])\n\nCreate a shared *note threading.Barrier: 1057. object and\nreturn a proxy for it.\n\nNew in version 3.3.\n\n-- Method: BoundedSemaphore ([value])\n\nCreate a shared *note threading.BoundedSemaphore: fcc. object\nand return a proxy for it.\n\n-- Method: Condition ([lock])\n\nCreate a shared *note threading.Condition: fca. object and\nreturn a proxy for it.\n\nIf 'lock' is supplied then it should be a proxy for a *note\nthreading.Lock: 2d58. or *note threading.RLock: 10cc. object.\n\nChanged in version 3.3: The *note waitfor(): 2d61. method was\nadded.\n\n-- Method: Event ()\n\nCreate a shared *note threading.Event: fcd. object and return\na proxy for it.\n\n-- Method: Lock ()\n\nCreate a shared *note threading.Lock: 2d58. object and return\na proxy for it.\n\n-- Method: Namespace ()\n\nCreate a shared *note Namespace: 2d84. object and return a\nproxy for it.\n\n-- Method: Queue ([maxsize])\n\nCreate a shared *note queue.Queue: 1203. object and return a\nproxy for it.\n\n-- Method: RLock ()\n\nCreate a shared *note threading.RLock: 10cc. object and return\na proxy for it.\n\n-- Method: Semaphore ([value])\n\nCreate a shared *note threading.Semaphore: fcb. object and\nreturn a proxy for it.\n\n-- Method: Array (typecode, sequence)\n\nCreate an array and return a proxy for it.\n\n-- Method: Value (typecode, value)\n\nCreate an object with a writable 'value' attribute and return\na proxy for it.\n\n-- Method: dict ()\n\n-- Method: dict (mapping)\n\n-- Method: dict (sequence)\n\nCreate a shared *note dict: 237. object and return a proxy for\nit.\n\n-- Method: list ()\n\n-- Method: list (sequence)\n\nCreate a shared *note list: 3dc. object and return a proxy for\nit.\n\nChanged in version 3.6: Shared objects are capable of being nested.\nFor example, a shared container object such as a shared list can\ncontain other shared objects which will all be managed and\nsynchronized by the *note SyncManager: 2dcc.\n\n-- Class: multiprocessing.managers.Namespace\n\nA type that can register with *note SyncManager: 2dcc.\n\nA namespace object has no public methods, but does have writable\nattributes.  Its representation shows the values of its attributes.\n\nHowever, when using a proxy for a namespace object, an attribute\nbeginning with '''' will be an attribute of the proxy and not an\nattribute of the referent:\n\n>>> mpcontext = multiprocessing.getcontext('spawn')\n>>> manager = mpcontext.Manager()\n>>> Global = manager.Namespace()\n>>> Global.x = 10\n>>> Global.y = 'hello'\n>>> Global.z = 12.3    # this is an attribute of the proxy\n>>> print(Global)\nNamespace(x=10, y='hello')\n\n* Menu:\n\n* Customized managers::\n* Using a remote manager::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Customized managers,  Next: Using a remote manager,  Up: Managers": {
            "content": "5.17.2.17 Customized managers\n.............................\n\nTo create one's own manager, one creates a subclass of *note\nBaseManager: 2dcd. and uses the *note register(): 2dd3. classmethod to\nregister new types or callables with the manager class.  For example:\n\nfrom multiprocessing.managers import BaseManager\n\nclass MathsClass:\ndef add(self, x, y):\nreturn x + y\ndef mul(self, x, y):\nreturn x * y\n\nclass MyManager(BaseManager):\npass\n\nMyManager.register('Maths', MathsClass)\n\nif name == 'main':\nwith MyManager() as manager:\nmaths = manager.Maths()\nprint(maths.add(4, 3))         # prints 7\nprint(maths.mul(7, 8))         # prints 56\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using a remote manager,  Prev: Customized managers,  Up: Managers": {
            "content": "5.17.2.18 Using a remote manager\n................................\n",
            "subsections": []
        },
        "It is possible to run a manager server on one machine and have clients": {
            "content": "use it from other machines (assuming that the firewalls involved allow\nit).\n",
            "subsections": []
        },
        "Running the following commands creates a server for a single shared": {
            "content": "queue which remote clients can access:\n\n>>> from multiprocessing.managers import BaseManager\n>>> from queue import Queue\n>>> queue = Queue()\n>>> class QueueManager(BaseManager): pass\n>>> QueueManager.register('getqueue', callable=lambda:queue)\n>>> m = QueueManager(address=('', 50000), authkey=b'abracadabra')\n>>> s = m.getserver()\n>>> s.serveforever()\n\nOne client can access the server as follows:\n\n>>> from multiprocessing.managers import BaseManager\n>>> class QueueManager(BaseManager): pass\n>>> QueueManager.register('getqueue')\n>>> m = QueueManager(address=('foo.bar.org', 50000), authkey=b'abracadabra')\n>>> m.connect()\n>>> queue = m.getqueue()\n>>> queue.put('hello')\n\nAnother client can also use it:\n\n>>> from multiprocessing.managers import BaseManager\n>>> class QueueManager(BaseManager): pass\n>>> QueueManager.register('getqueue')\n>>> m = QueueManager(address=('foo.bar.org', 50000), authkey=b'abracadabra')\n>>> m.connect()\n>>> queue = m.getqueue()\n>>> queue.get()\n'hello'\n",
            "subsections": []
        },
        "Local processes can also access that queue, using the code from above on": {
            "content": "the client to access it remotely:\n\n>>> from multiprocessing import Process, Queue\n>>> from multiprocessing.managers import BaseManager\n>>> class Worker(Process):\n...     def init(self, q):\n...         self.q = q\n...         super().init()\n...     def run(self):\n...         self.q.put('local hello')\n...\n>>> queue = Queue()\n>>> w = Worker(queue)\n>>> w.start()\n>>> class QueueManager(BaseManager): pass\n...\n>>> QueueManager.register('getqueue', callable=lambda: queue)\n>>> m = QueueManager(address=('', 50000), authkey=b'abracadabra')\n>>> s = m.getserver()\n>>> s.serveforever()\n\nFile: python3.12.info,  Node: Proxy Objects,  Next: Process Pools,  Prev: Managers,  Up: Reference<2>\n\n5.17.2.19 Proxy Objects\n.......................\n\nA proxy is an object which 'refers' to a shared object which lives\n(presumably) in a different process.  The shared object is said to be\nthe 'referent' of the proxy.  Multiple proxy objects may have the same\nreferent.\n\nA proxy object has methods which invoke corresponding methods of its\nreferent (although not every method of the referent will necessarily be\navailable through the proxy).  In this way, a proxy can be used just\nlike its referent can:\n\n>>> mpcontext = multiprocessing.getcontext('spawn')\n>>> manager = mpcontext.Manager()\n>>> l = manager.list([i*i for i in range(10)])\n>>> print(l)\n[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]\n>>> print(repr(l))\n<ListProxy object, typeid 'list' at 0x...>\n>>> l[4]\n16\n>>> l[2:5]\n[4, 9, 16]\n\nNotice that applying *note str(): 157. to a proxy will return the\nrepresentation of the referent, whereas applying *note repr(): 5f0. will\nreturn the representation of the proxy.\n",
            "subsections": []
        },
        "An important feature of proxy objects is that they are picklable so they": {
            "content": "can be passed between processes.  As such, a referent can contain *note",
            "subsections": []
        },
        "Proxy Objects: b08.  This permits nesting of these managed lists, dicts,": {
            "content": "and other *note Proxy Objects: b08.:\n\n>>> a = manager.list()\n>>> b = manager.list()\n>>> a.append(b)         # referent of a now contains referent of b\n>>> print(a, b)\n[<ListProxy object, typeid 'list' at ...>] []\n>>> b.append('hello')\n>>> print(a[0], b)\n['hello'] ['hello']\n\nSimilarly, dict and list proxies may be nested inside one another:\n\n>>> louter = manager.list([ manager.dict() for i in range(2) ])\n>>> dfirstinner = louter[0]\n>>> dfirstinner['a'] = 1\n>>> dfirstinner['b'] = 2\n>>> louter[1]['c'] = 3\n>>> louter[1]['z'] = 26\n>>> print(louter[0])\n{'a': 1, 'b': 2}\n>>> print(louter[1])\n{'c': 3, 'z': 26}\n\nIf standard (non-proxy) *note list: 3dc. or *note dict: 237. objects are\ncontained in a referent, modifications to those mutable values will not\nbe propagated through the manager because the proxy has no way of\nknowing when the values contained within are modified.  However, storing\na value in a container proxy (which triggers a 'setitem' on the\nproxy object) does propagate through the manager and so to effectively\nmodify such an item, one could re-assign the modified value to the\ncontainer proxy:\n\n# create a list proxy and append a mutable object (a dictionary)\nlproxy = manager.list()\nlproxy.append({})\n# now mutate the dictionary\nd = lproxy[0]\nd['a'] = 1\nd['b'] = 2\n# at this point, the changes to d are not yet synced, but by\n# updating the dictionary, the proxy is notified of the change\nlproxy[0] = d\n\nThis approach is perhaps less convenient than employing nested *note",
            "subsections": []
        },
        "Proxy Objects: b08. for most use cases but also demonstrates a level of": {
            "content": "control over the synchronization.\n\nNote: The proxy types in *note multiprocessing: 8f. do nothing to\nsupport comparisons by value.  So, for instance, we have:\n\n>>> manager.list([1,2,3]) == [1,2,3]\nFalse\n\nOne should just use a copy of the referent instead when making\ncomparisons.\n\n-- Class: multiprocessing.managers.BaseProxy\n\nProxy objects are instances of subclasses of *note BaseProxy: 2dd4.\n\n-- Method: callmethod (methodname[, args[, kwds]])\n\nCall and return the result of a method of the proxy's\nreferent.\n\nIf 'proxy' is a proxy whose referent is 'obj' then the\nexpression\n\nproxy.callmethod(methodname, args, kwds)\n\nwill evaluate the expression\n\ngetattr(obj, methodname)(*args, kwds)\n\nin the manager's process.\n\nThe returned value will be a copy of the result of the call or\na proxy to a new shared object - see documentation for the\n'methodtotypeid' argument of *note BaseManager.register():\n2dd3.\n\nIf an exception is raised by the call, then is re-raised by\n*note callmethod(): 2dd5.  If some other exception is raised\nin the manager's process then this is converted into a\n'RemoteError' exception and is raised by *note callmethod():\n2dd5.\n\nNote in particular that an exception will be raised if\n'methodname' has not been 'exposed'.\n\nAn example of the usage of *note callmethod(): 2dd5.:\n\n>>> l = manager.list(range(10))\n>>> l.callmethod('len')\n10\n>>> l.callmethod('getitem', (slice(2, 7),)) # equivalent to l[2:7]\n[2, 3, 4, 5, 6]\n>>> l.callmethod('getitem', (20,))          # equivalent to l[20]\nTraceback (most recent call last):\n...\nIndexError: list index out of range\n\n-- Method: getvalue ()\n\nReturn a copy of the referent.\n\nIf the referent is unpicklable then this will raise an\nexception.\n\n-- Method: repr ()\n\nReturn a representation of the proxy object.\n\n-- Method: str ()\n\nReturn the representation of the referent.\n\n* Menu:\n\n* Cleanup::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Cleanup,  Up: Proxy Objects": {
            "content": "5.17.2.20 Cleanup\n.................\n\nA proxy object uses a weakref callback so that when it gets garbage\ncollected it deregisters itself from the manager which owns its\nreferent.\n\nA shared object gets deleted from the manager process when there are no\nlonger any proxies referring to it.\n\nFile: python3.12.info,  Node: Process Pools,  Next: Listeners and Clients,  Prev: Proxy Objects,  Up: Reference<2>\n\n5.17.2.21 Process Pools\n.......................\n",
            "subsections": []
        },
        "One can create a pool of processes which will carry out tasks submitted": {
            "content": "to it with the *note Pool: ddb. class.\n\n-- Class: multiprocessing.pool.Pool ([processes[, initializer[,\ninitargs[, maxtasksperchild[, context]]]]])\n\nA process pool object which controls a pool of worker processes to\nwhich jobs can be submitted.  It supports asynchronous results with\ntimeouts and callbacks and has a parallel map implementation.\n\n'processes' is the number of worker processes to use.  If\n'processes' is 'None' then the number returned by *note\nos.cpucount(): 60b. is used.\n\nIf 'initializer' is not 'None' then each worker process will call\n'initializer(*initargs)' when it starts.\n\n'maxtasksperchild' is the number of tasks a worker process can\ncomplete before it will exit and be replaced with a fresh worker\nprocess, to enable unused resources to be freed.  The default\n'maxtasksperchild' is 'None', which means worker processes will\nlive as long as the pool.\n\n'context' can be used to specify the context used for starting the\nworker processes.  Usually a pool is created using the function\n'multiprocessing.Pool()' or the *note Pool(): ddb. method of a\ncontext object.  In both cases 'context' is set appropriately.\n\nNote that the methods of the pool object should only be called by\nthe process which created the pool.\n\nWarning: *note multiprocessing.pool: 93. objects have internal\nresources that need to be properly managed (like any other\nresource) by using the pool as a context manager or by calling\n*note close(): 2deb. and *note terminate(): 2dec. manually.\nFailure to do this can lead to the process hanging on\nfinalization.\n\nNote that it is 'not correct' to rely on the garbage collector\nto destroy the pool as CPython does not assure that the\nfinalizer of the pool will be called (see *note\nobject.del(): 1c66. for more information).\n\nChanged in version 3.2: Added the 'maxtasksperchild' parameter.\n\nChanged in version 3.4: Added the 'context' parameter.\n\nNote: Worker processes within a *note Pool: ddb. typically\nlive for the complete duration of the Pool's work queue.  A\nfrequent pattern found in other systems (such as Apache,\nmodwsgi, etc) to free resources held by workers is to allow a\nworker within a pool to complete only a set amount of work\nbefore being exiting, being cleaned up and a new process\nspawned to replace the old one.  The 'maxtasksperchild'\nargument to the *note Pool: ddb. exposes this ability to the\nend user.\n\n-- Method: apply (func[, args[, kwds]])\n\nCall 'func' with arguments 'args' and keyword arguments\n'kwds'.  It blocks until the result is ready.  Given this\nblocks, *note applyasync(): 2dee. is better suited for\nperforming work in parallel.  Additionally, 'func' is only\nexecuted in one of the workers of the pool.\n\n-- Method: applyasync (func[, args[, kwds[, callback[,\nerrorcallback]]]])\n\nA variant of the *note apply(): 2ded. method which returns a\n*note AsyncResult: 2def. object.\n\nIf 'callback' is specified then it should be a callable which\naccepts a single argument.  When the result becomes ready\n'callback' is applied to it, that is unless the call failed,\nin which case the 'errorcallback' is applied instead.\n\nIf 'errorcallback' is specified then it should be a callable\nwhich accepts a single argument.  If the target function\nfails, then the 'errorcallback' is called with the exception\ninstance.\n\nCallbacks should complete immediately since otherwise the\nthread which handles the results will get blocked.\n\n-- Method: map (func, iterable[, chunksize])\n\nA parallel equivalent of the *note map(): 65f. built-in\nfunction (it supports only one 'iterable' argument though, for\nmultiple iterables see *note starmap(): f51.).  It blocks\nuntil the result is ready.\n\nThis method chops the iterable into a number of chunks which\nit submits to the process pool as separate tasks.  The\n(approximate) size of these chunks can be specified by setting\n'chunksize' to a positive integer.\n\nNote that it may cause high memory usage for very long\niterables.  Consider using *note imap(): 2df0. or *note\nimapunordered(): 2df1. with explicit 'chunksize' option for\nbetter efficiency.\n\n-- Method: mapasync (func, iterable[, chunksize[, callback[,\nerrorcallback]]])\n\nA variant of the *note map(): f54. method which returns a\n*note AsyncResult: 2def. object.\n\nIf 'callback' is specified then it should be a callable which\naccepts a single argument.  When the result becomes ready\n'callback' is applied to it, that is unless the call failed,\nin which case the 'errorcallback' is applied instead.\n\nIf 'errorcallback' is specified then it should be a callable\nwhich accepts a single argument.  If the target function\nfails, then the 'errorcallback' is called with the exception\ninstance.\n\nCallbacks should complete immediately since otherwise the\nthread which handles the results will get blocked.\n\n-- Method: imap (func, iterable[, chunksize])\n\nA lazier version of *note map(): f54.\n\nThe 'chunksize' argument is the same as the one used by the\n*note map(): f54. method.  For very long iterables using a\nlarge value for 'chunksize' can make the job complete 'much'\nfaster than using the default value of '1'.\n\nAlso if 'chunksize' is '1' then the 'next()' method of the\niterator returned by the *note imap(): 2df0. method has an\noptional 'timeout' parameter: 'next(timeout)' will raise *note\nmultiprocessing.TimeoutError: 2d9a. if the result cannot be\nreturned within 'timeout' seconds.\n\n-- Method: imapunordered (func, iterable[, chunksize])\n\nThe same as *note imap(): 2df0. except that the ordering of\nthe results from the returned iterator should be considered\narbitrary.  (Only when there is only one worker process is the\norder guaranteed to be \"correct\".)\n\n-- Method: starmap (func, iterable[, chunksize])\n\nLike *note map(): f54. except that the elements of the\n'iterable' are expected to be iterables that are unpacked as\narguments.\n\nHence an 'iterable' of '[(1,2), (3, 4)]' results in\n'[func(1,2), func(3,4)]'.\n\nNew in version 3.3.\n\n-- Method: starmapasync (func, iterable[, chunksize[, callback[,\nerrorcallback]]])\n\nA combination of *note starmap(): f51. and *note mapasync():\nf55. that iterates over 'iterable' of iterables and calls\n'func' with the iterables unpacked.  Returns a result object.\n\nNew in version 3.3.\n\n-- Method: close ()\n\nPrevents any more tasks from being submitted to the pool.\nOnce all the tasks have been completed the worker processes\nwill exit.\n\n-- Method: terminate ()\n\nStops the worker processes immediately without completing\noutstanding work.  When the pool object is garbage collected\n*note terminate(): 2dec. will be called immediately.\n\n-- Method: join ()\n\nWait for the worker processes to exit.  One must call *note\nclose(): 2deb. or *note terminate(): 2dec. before using *note\njoin(): 2df2.\n\nChanged in version 3.3: Pool objects now support the context\nmanagement protocol - see *note Context Manager Types: 1cc6.  *note\nenter(): 1f55. returns the pool object, and *note exit():\n1f56. calls *note terminate(): 2dec.\n\n-- Class: multiprocessing.pool.AsyncResult\n\nThe class of the result returned by *note Pool.applyasync(): 2dee.\nand *note Pool.mapasync(): f55.\n\n-- Method: get ([timeout])\n\nReturn the result when it arrives.  If 'timeout' is not 'None'\nand the result does not arrive within 'timeout' seconds then\n*note multiprocessing.TimeoutError: 2d9a. is raised.  If the\nremote call raised an exception then that exception will be\nreraised by *note get(): 2df3.\n\n-- Method: wait ([timeout])\n\nWait until the result is available or until 'timeout' seconds\npass.\n\n-- Method: ready ()\n\nReturn whether the call has completed.\n\n-- Method: successful ()\n\nReturn whether the call completed without raising an\nexception.  Will raise *note ValueError: 183. if the result is\nnot ready.\n\nChanged in version 3.7: If the result is not ready, *note\nValueError: 183. is raised instead of *note AssertionError:\n476.\n\nThe following example demonstrates the use of a pool:\n\nfrom multiprocessing import Pool\nimport time\n\ndef f(x):\nreturn x*x\n\nif name == 'main':\nwith Pool(processes=4) as pool:         # start 4 worker processes\nresult = pool.applyasync(f, (10,)) # evaluate \"f(10)\" asynchronously in a single process\nprint(result.get(timeout=1))        # prints \"100\" unless your computer is *very* slow\n\nprint(pool.map(f, range(10)))       # prints \"[0, 1, 4,..., 81]\"\n\nit = pool.imap(f, range(10))\nprint(next(it))                     # prints \"0\"\nprint(next(it))                     # prints \"1\"\nprint(it.next(timeout=1))           # prints \"4\" unless your computer is *very* slow\n\nresult = pool.applyasync(time.sleep, (10,))\nprint(result.get(timeout=1))        # raises multiprocessing.TimeoutError\n\nFile: python3.12.info,  Node: Listeners and Clients,  Next: Authentication keys,  Prev: Process Pools,  Up: Reference<2>\n\n5.17.2.22 Listeners and Clients\n...............................\n",
            "subsections": []
        },
        "Usually message passing between processes is done using queues or by": {
            "content": "using *note Connection: 13cb. objects returned by *note Pipe(): 2d7f.\n\nHowever, the *note multiprocessing.connection: 90. module allows some\nextra flexibility.  It basically gives a high level message oriented API\nfor dealing with sockets or Windows named pipes.  It also has support\nfor 'digest authentication' using the *note hmac: 65. module, and for\npolling multiple connections at the same time.\n\n-- Function: multiprocessing.connection.deliverchallenge (connection,\nauthkey)\n\nSend a randomly generated message to the other end of the\nconnection and wait for a reply.\n\nIf the reply matches the digest of the message using 'authkey' as\nthe key then a welcome message is sent to the other end of the\nconnection.  Otherwise *note AuthenticationError: 2d99. is raised.\n\n-- Function: multiprocessing.connection.answerchallenge (connection,\nauthkey)\n\nReceive a message, calculate the digest of the message using\n'authkey' as the key, and then send the digest back.\n\nIf a welcome message is not received, then *note\nAuthenticationError: 2d99. is raised.\n\n-- Function: multiprocessing.connection.Client (address[, family[,\nauthkey]])\n\nAttempt to set up a connection to the listener which is using\naddress 'address', returning a *note Connection: 13cb.\n\nThe type of the connection is determined by 'family' argument, but\nthis can generally be omitted since it can usually be inferred from\nthe format of 'address'.  (See *note Address Formats: 2dfb.)\n\nIf 'authkey' is given and not None, it should be a byte string and\nwill be used as the secret key for an HMAC-based authentication\nchallenge.  No authentication is done if 'authkey' is None.  *note\nAuthenticationError: 2d99. is raised if authentication fails.  See\n*note Authentication keys: 2d95.\n\n-- Class: multiprocessing.connection.Listener ([address[, family[,\nbacklog[, authkey]]]])\n\nA wrapper for a bound socket or Windows named pipe which is\n'listening' for connections.\n\n'address' is the address to be used by the bound socket or named\npipe of the listener object.\n\nNote: If an address of '0.0.0.0' is used, the address will not\nbe a connectable end point on Windows.  If you require a\nconnectable end-point, you should use '127.0.0.1'.\n\n'family' is the type of socket (or named pipe) to use.  This can be\none of the strings ''AFINET'' (for a TCP socket), ''AFUNIX'' (for\na Unix domain socket) or ''AFPIPE'' (for a Windows named pipe).\nOf these only the first is guaranteed to be available.  If 'family'\nis 'None' then the family is inferred from the format of 'address'.\nIf 'address' is also 'None' then a default is chosen.  This default\nis the family which is assumed to be the fastest available.  See\n*note Address Formats: 2dfb.  Note that if 'family' is ''AFUNIX''\nand address is 'None' then the socket will be created in a private\ntemporary directory created using *note tempfile.mkstemp(): 2540.\n\nIf the listener object uses a socket then 'backlog' (1 by default)\nis passed to the *note listen(): cc1. method of the socket once it\nhas been bound.\n\nIf 'authkey' is given and not None, it should be a byte string and\nwill be used as the secret key for an HMAC-based authentication\nchallenge.  No authentication is done if 'authkey' is None.  *note\nAuthenticationError: 2d99. is raised if authentication fails.  See\n*note Authentication keys: 2d95.\n\n-- Method: accept ()\n\nAccept a connection on the bound socket or named pipe of the\nlistener object and return a *note Connection: 13cb. object.\nIf authentication is attempted and fails, then *note\nAuthenticationError: 2d99. is raised.\n\n-- Method: close ()\n\nClose the bound socket or named pipe of the listener object.\nThis is called automatically when the listener is garbage\ncollected.  However it is advisable to call it explicitly.\n\nListener objects have the following read-only properties:\n\n-- Attribute: address\n\nThe address which is being used by the Listener object.\n\n-- Attribute: lastaccepted\n\nThe address from which the last accepted connection came.  If\nthis is unavailable then it is 'None'.\n\nChanged in version 3.3: Listener objects now support the context\nmanagement protocol - see *note Context Manager Types: 1cc6.  *note\nenter(): 1f55. returns the listener object, and *note\nexit(): 1f56. calls *note close(): 2dfc.\n\n-- Function: multiprocessing.connection.wait (objectlist,\ntimeout=None)\n\nWait till an object in 'objectlist' is ready.  Returns the list of\nthose objects in 'objectlist' which are ready.  If 'timeout' is a\nfloat then the call blocks for at most that many seconds.  If\n'timeout' is 'None' then it will block for an unlimited period.  A\nnegative timeout is equivalent to a zero timeout.\n\nFor both POSIX and Windows, an object can appear in 'objectlist'\nif it is\n\n* a readable *note Connection: 13cb. object;\n\n* a connected and readable *note socket.socket: bfd. object; or\n\n* the *note sentinel: f50. attribute of a *note Process: 996.\nobject.\n\nA connection or socket object is ready when there is data available\nto be read from it, or the other end has been closed.\n\n'POSIX': 'wait(objectlist, timeout)' almost equivalent\n'select.select(objectlist, [], [], timeout)'.  The difference is\nthat, if *note select.select(): bfc. is interrupted by a signal, it\ncan raise *note OSError: 613. with an error number of 'EINTR',\nwhereas *note wait(): f4f. will not.\n\n'Windows': An item in 'objectlist' must either be an integer\nhandle which is waitable (according to the definition used by the\ndocumentation of the Win32 function 'WaitForMultipleObjects()') or\nit can be an object with a *note fileno(): 2542. method which\nreturns a socket handle or pipe handle.  (Note that pipe handles\nand socket handles are 'not' waitable handles.)\n\nNew in version 3.3.\n\n'Examples'\n",
            "subsections": []
        },
        "The following server code creates a listener which uses ''secret": {
            "content": "password'' as an authentication key.  It then waits for a connection and\nsends some data to the client:\n\nfrom multiprocessing.connection import Listener\nfrom array import array\n\naddress = ('localhost', 6000)     # family is deduced to be 'AFINET'\n\nwith Listener(address, authkey=b'secret password') as listener:\nwith listener.accept() as conn:\nprint('connection accepted from', listener.lastaccepted)\n\nconn.send([2.25, None, 'junk', float])\n\nconn.sendbytes(b'hello')\n\nconn.sendbytes(array('i', [42, 1729]))\n",
            "subsections": []
        },
        "The following code connects to the server and receives some data from": {
            "content": "the server:\n\nfrom multiprocessing.connection import Client\nfrom array import array\n\naddress = ('localhost', 6000)\n\nwith Client(address, authkey=b'secret password') as conn:\nprint(conn.recv())                  # => [2.25, None, 'junk', float]\n\nprint(conn.recvbytes())            # => 'hello'\n\narr = array('i', [0, 0, 0, 0, 0])\nprint(conn.recvbytesinto(arr))    # => 8\nprint(arr)                          # => array('i', [42, 1729, 0, 0, 0])\n\nThe following code uses *note wait(): f4f. to wait for messages from\nmultiple processes at once:\n\nimport time, random\nfrom multiprocessing import Process, Pipe, currentprocess\nfrom multiprocessing.connection import wait\n\ndef foo(w):\nfor i in range(10):\nw.send((i, currentprocess().name))\nw.close()\n\nif name == 'main':\nreaders = []\n\nfor i in range(4):\nr, w = Pipe(duplex=False)\nreaders.append(r)\np = Process(target=foo, args=(w,))\np.start()\n# We close the writable end of the pipe now to be sure that\n# p is the only process which owns a handle for it.  This\n# ensures that when p closes its handle for the writable end,\n# wait() will promptly report the readable end as being ready.\nw.close()\n\nwhile readers:\nfor r in wait(readers):\ntry:\nmsg = r.recv()\nexcept EOFError:\nreaders.remove(r)\nelse:\nprint(msg)\n\n* Menu:\n\n* Address Formats::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Address Formats,  Up: Listeners and Clients": {
            "content": "5.17.2.23 Address Formats\n.........................\n\n* An ''AFINET'' address is a tuple of the form '(hostname, port)'\nwhere 'hostname' is a string and 'port' is an integer.\n\n* An ''AFUNIX'' address is a string representing a filename on the\nfilesystem.\n\n* An ''AFPIPE'' address is a string of the form\n'r'\\\\.\\pipe\\PIPENAME''.  To use *note Client(): 2dfa. to connect to\na named pipe on a remote computer called 'ServerName' one should\nuse an address of the form 'r'\\\\SERVERNAME\\pipe\\PIPENAME'' instead.\n",
            "subsections": []
        },
        "Note that any string beginning with two backslashes is assumed by": {
            "content": "default to be an ''AFPIPE'' address rather than an ''AFUNIX'' address.\n\nFile: python3.12.info,  Node: Authentication keys,  Next: Logging<2>,  Prev: Listeners and Clients,  Up: Reference<2>\n\n5.17.2.24 Authentication keys\n.............................\n\nWhen one uses *note Connection.recv: 2db7, the data received is\nautomatically unpickled.  Unfortunately unpickling data from an\nuntrusted source is a security risk.  Therefore *note Listener: 13ca.\nand *note Client(): 2dfa. use the *note hmac: 65. module to provide\ndigest authentication.\n",
            "subsections": []
        },
        "An authentication key is a byte string which can be thought of as a": {
            "content": "password: once a connection is established both ends will demand proof\nthat the other knows the authentication key.  (Demonstrating that both\nends are using the same key does 'not' involve sending the key over the\nconnection.)\n",
            "subsections": []
        },
        "If authentication is requested but no authentication key is specified": {
            "content": "then the return value of 'currentprocess().authkey' is used (see *note\nProcess: 996.).  This value will be automatically inherited by any *note",
            "subsections": []
        },
        "Process: 996. object that the current process creates.  This means that": {
            "content": "(by default) all processes of a multi-process program will share a\nsingle authentication key which can be used when setting up connections\nbetween themselves.\n\nSuitable authentication keys can also be generated by using *note\nos.urandom(): 276.\n\nFile: python3.12.info,  Node: Logging<2>,  Next: The multiprocessing dummy module,  Prev: Authentication keys,  Up: Reference<2>\n\n5.17.2.25 Logging\n.................\n\nSome support for logging is available.  Note, however, that the *note\nlogging: 82. package does not use process shared locks so it is possible\n(depending on the handler type) for messages from different processes to\nget mixed up.\n\n-- Function: multiprocessing.getlogger ()\n\nReturns the logger used by *note multiprocessing: 8f.  If\nnecessary, a new one will be created.\n\nWhen first created the logger has level *note logging.NOTSET: 29bf.\nand no default handler.  Messages sent to this logger will not by\ndefault propagate to the root logger.\n\nNote that on Windows child processes will only inherit the level of\nthe parent process's logger - any other customization of the logger\nwill not be inherited.\n\n-- Function: multiprocessing.logtostderr (level=None)\n\nThis function performs a call to *note getlogger(): 2e02. but in\naddition to returning the logger created by getlogger, it adds a\nhandler which sends output to *note sys.stderr: 757. using format\n''[%(levelname)s/%(processName)s] %(message)s''.  You can modify\n'levelname' of the logger by passing a 'level' argument.\n\nBelow is an example session with logging turned on:\n\n>>> import multiprocessing, logging\n>>> logger = multiprocessing.logtostderr()\n>>> logger.setLevel(logging.INFO)\n>>> logger.warning('doomed')\n[WARNING/MainProcess] doomed\n>>> m = multiprocessing.Manager()\n[INFO/SyncManager-...] child process calling self.run()\n[INFO/SyncManager-...] created temp directory /.../pymp-...\n[INFO/SyncManager-...] manager serving at '/.../listener-...'\n>>> del m\n[INFO/MainProcess] sending shutdown message to manager\n[INFO/SyncManager-...] manager exiting with exitcode 0\n\nFor a full table of logging levels, see the *note logging: 82. module.\n\nFile: python3.12.info,  Node: The multiprocessing dummy module,  Prev: Logging<2>,  Up: Reference<2>\n\n5.17.2.26 The 'multiprocessing.dummy' module\n............................................\n\n*note multiprocessing.dummy: 91. replicates the API of *note\nmultiprocessing: 8f. but is no more than a wrapper around the *note\nthreading: e7. module.\n\nIn particular, the 'Pool' function provided by *note\nmultiprocessing.dummy: 91. returns an instance of *note ThreadPool:\n1675, which is a subclass of *note Pool: ddb. that supports all the same\nmethod calls but uses a pool of worker threads rather than worker\nprocesses.\n\n-- Class: multiprocessing.pool.ThreadPool ([processes[, initializer[,\ninitargs]]])\n\nA thread pool object which controls a pool of worker threads to\nwhich jobs can be submitted.  *note ThreadPool: 1675. instances are\nfully interface compatible with *note Pool: ddb. instances, and\ntheir resources must also be properly managed, either by using the\npool as a context manager or by calling *note close(): 2deb. and\n*note terminate(): 2dec. manually.\n\n'processes' is the number of worker threads to use.  If 'processes'\nis 'None' then the number returned by *note os.cpucount(): 60b. is\nused.\n\nIf 'initializer' is not 'None' then each worker process will call\n'initializer(*initargs)' when it starts.\n\nUnlike *note Pool: ddb, 'maxtasksperchild' and 'context' cannot be\nprovided.\n\nNote: A *note ThreadPool: 1675. shares the same interface as\n*note Pool: ddb, which is designed around a pool of processes\nand predates the introduction of the *note concurrent.futures:\n1f. module.  As such, it inherits some operations that don't\nmake sense for a pool backed by threads, and it has its own\ntype for representing the status of asynchronous jobs, *note\nAsyncResult: 2def, that is not understood by any other\nlibraries.\n\nUsers should generally prefer to use *note\nconcurrent.futures.ThreadPoolExecutor: 529, which has a\nsimpler interface that was designed around threads from the\nstart, and which returns *note concurrent.futures.Future:\n1025. instances that are compatible with many other libraries,\nincluding *note asyncio: 9.\n\nFile: python3.12.info,  Node: Programming guidelines,  Next: Examples<13>,  Prev: Reference<2>,  Up: multiprocessing -- Process-based parallelism\n\n5.17.2.27 Programming guidelines\n................................\n",
            "subsections": []
        },
        "There are certain guidelines and idioms which should be adhered to when": {
            "content": "using *note multiprocessing: 8f.\n\n* Menu:\n\n* All start methods::\n* The spawn and forkserver start methods::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: All start methods,  Next: The spawn and forkserver start methods,  Up: Programming guidelines": {
            "content": "5.17.2.28 All start methods\n...........................\n\nThe following applies to all start methods.\n",
            "subsections": []
        },
        "Avoid shared state": {
            "content": "As far as possible one should try to avoid shifting large amounts\nof data between processes.\n\nIt is probably best to stick to using queues or pipes for\ncommunication between processes rather than using the lower level\nsynchronization primitives.\n",
            "subsections": []
        },
        "Picklability": {
            "content": "Ensure that the arguments to the methods of proxies are picklable.\n",
            "subsections": []
        },
        "Thread safety of proxies": {
            "content": "Do not use a proxy object from more than one thread unless you\nprotect it with a lock.\n\n(There is never a problem with different processes using the 'same'\nproxy.)\n",
            "subsections": []
        },
        "Joining zombie processes": {
            "content": "On POSIX when a process finishes but has not been joined it becomes\na zombie.  There should never be very many because each time a new\nprocess starts (or *note activechildren(): 2db0. is called) all\ncompleted processes which have not yet been joined will be joined.\nAlso calling a finished process's *note Process.isalive: 2d92.\nwill join the process.  Even so it is probably good practice to\nexplicitly join all the processes that you start.\n",
            "subsections": []
        },
        "Better to inherit than pickle/unpickle": {
            "content": "When using the 'spawn' or 'forkserver' start methods many types\nfrom *note multiprocessing: 8f. need to be picklable so that child\nprocesses can use them.  However, one should generally avoid\nsending shared objects to other processes using pipes or queues.\nInstead you should arrange the program so that a process which\nneeds access to a shared resource created elsewhere can inherit it\nfrom an ancestor process.\n",
            "subsections": []
        },
        "Avoid terminating processes": {
            "content": "Using the *note Process.terminate: 2d96. method to stop a process\nis liable to cause any shared resources (such as locks, semaphores,\npipes and queues) currently being used by the process to become\nbroken or unavailable to other processes.\n\nTherefore it is probably best to only consider using *note\nProcess.terminate: 2d96. on processes which never use any shared\nresources.\n",
            "subsections": []
        },
        "Joining processes that use queues": {
            "content": "Bear in mind that a process that has put items in a queue will wait\nbefore terminating until all the buffered items are fed by the\n\"feeder\" thread to the underlying pipe.  (The child process can\ncall the *note Queue.canceljointhread: 2da5. method of the queue\nto avoid this behaviour.)\n\nThis means that whenever you use a queue you need to make sure that\nall items which have been put on the queue will eventually be\nremoved before the process is joined.  Otherwise you cannot be sure\nthat processes which have put items on the queue will terminate.\nRemember also that non-daemonic processes will be joined\nautomatically.\n\nAn example which will deadlock is the following:\n\nfrom multiprocessing import Process, Queue\n\ndef f(q):\nq.put('X' * 1000000)\n\nif name == 'main':\nqueue = Queue()\np = Process(target=f, args=(queue,))\np.start()\np.join()                    # this deadlocks\nobj = queue.get()\n\nA fix here would be to swap the last two lines (or simply remove\nthe 'p.join()' line).\n",
            "subsections": []
        },
        "Explicitly pass resources to child processes": {
            "content": "On POSIX using the 'fork' start method, a child process can make\nuse of a shared resource created in a parent process using a global\nresource.  However, it is better to pass the object as an argument\nto the constructor for the child process.\n\nApart from making the code (potentially) compatible with Windows\nand the other start methods this also ensures that as long as the\nchild process is still alive the object will not be garbage\ncollected in the parent process.  This might be important if some\nresource is freed when the object is garbage collected in the\nparent process.\n\nSo for instance\n\nfrom multiprocessing import Process, Lock\n\ndef f():\n... do something using \"lock\" ...\n\nif name == 'main':\nlock = Lock()\nfor i in range(10):\nProcess(target=f).start()\n\nshould be rewritten as\n\nfrom multiprocessing import Process, Lock\n\ndef f(l):\n... do something using \"l\" ...\n\nif name == 'main':\nlock = Lock()\nfor i in range(10):\nProcess(target=f, args=(lock,)).start()\n\nBeware of replacing *note sys.stdin: 293. with a \"file like object\"\n\n*note multiprocessing: 8f. originally unconditionally called:\n\nos.close(sys.stdin.fileno())\n\nin the 'multiprocessing.Process.bootstrap()' method -- this\nresulted in issues with processes-in-processes.  This has been\nchanged to:\n\nsys.stdin.close()\nsys.stdin = open(os.open(os.devnull, os.ORDONLY), closefd=False)\n\nWhich solves the fundamental issue of processes colliding with each\nother resulting in a bad file descriptor error, but introduces a\npotential danger to applications which replace *note sys.stdin():\n293. with a \"file-like object\" with output buffering.  This danger\nis that if multiple processes call *note close(): 17a4. on this\nfile-like object, it could result in the same data being flushed to\nthe object multiple times, resulting in corruption.\n\nIf you write a file-like object and implement your own caching, you\ncan make it fork-safe by storing the pid whenever you append to the\ncache, and discarding the cache when the pid changes.  For example:\n\n@property\ndef cache(self):\npid = os.getpid()\nif pid != self.pid:\nself.pid = pid\nself.cache = []\nreturn self.cache\n\nFor more information, see bpo-5155(1), bpo-5313(2) and bpo-5331(3)\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=5155\n\n(2) https://bugs.python.org/issue?@action=redirect&bpo=5313\n\n(3) https://bugs.python.org/issue?@action=redirect&bpo=5331\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The spawn and forkserver start methods,  Prev: All start methods,  Up: Programming guidelines": {
            "content": "5.17.2.29 The 'spawn' and 'forkserver' start methods\n....................................................\n",
            "subsections": []
        },
        "There are a few extra restrictions which don't apply to the 'fork' start": {
            "content": "method.\n",
            "subsections": []
        },
        "More picklability": {
            "content": "Ensure that all arguments to 'Process.init()' are picklable.\nAlso, if you subclass *note Process: 996. then make sure that\ninstances will be picklable when the *note Process.start: 2d7a.\nmethod is called.\n",
            "subsections": []
        },
        "Global variables": {
            "content": "Bear in mind that if code run in a child process tries to access a\nglobal variable, then the value it sees (if any) may not be the\nsame as the value in the parent process at the time that *note\nProcess.start: 2d7a. was called.\n\nHowever, global variables which are just module level constants\ncause no problems.",
            "subsections": []
        },
        "Safe importing of main module": {
            "content": "Make sure that the main module can be safely imported by a new\nPython interpreter without causing unintended side effects (such as\nstarting a new process).\n\nFor example, using the 'spawn' or 'forkserver' start method running\nthe following module would fail with a *note RuntimeError: 17a.:\n\nfrom multiprocessing import Process\n\ndef foo():\nprint('hello')\n\np = Process(target=foo)\np.start()\n\nInstead one should protect the \"entry point\" of the program by\nusing 'if name == 'main':' as follows:\n\nfrom multiprocessing import Process, freezesupport, setstartmethod\n\ndef foo():\nprint('hello')\n\nif name == 'main':\nfreezesupport()\nsetstartmethod('spawn')\np = Process(target=foo)\np.start()\n\n(The 'freezesupport()' line can be omitted if the program will be\nrun normally instead of frozen.)\n\nThis allows the newly spawned Python interpreter to safely import\nthe module and then run the module's 'foo()' function.\n\nSimilar restrictions apply if a pool or manager is created in the\nmain module.\n\nFile: python3.12.info,  Node: Examples<13>,  Prev: Programming guidelines,  Up: multiprocessing -- Process-based parallelism\n\n5.17.2.30 Examples\n..................\n\nDemonstration of how to create and use customized managers and proxies:\n\nfrom multiprocessing import freezesupport\nfrom multiprocessing.managers import BaseManager, BaseProxy\nimport operator\n\n##\n\nclass Foo:\ndef f(self):\nprint('you called Foo.f()')\ndef g(self):\nprint('you called Foo.g()')\ndef h(self):\nprint('you called Foo.h()')\n\n# A simple generator function\ndef baz():\nfor i in range(10):\nyield i*i\n\n# Proxy type for generator objects\nclass GeneratorProxy(BaseProxy):\nexposed = ['next']\ndef iter(self):\nreturn self\ndef next(self):\nreturn self.callmethod('next')\n\n# Function to return the operator module\ndef getoperatormodule():\nreturn operator\n\n##\n\nclass MyManager(BaseManager):\npass\n\n# register the Foo class; make `f()` and `g()` accessible via proxy\nMyManager.register('Foo1', Foo)\n\n# register the Foo class; make `g()` and `h()` accessible via proxy\nMyManager.register('Foo2', Foo, exposed=('g', 'h'))\n\n# register the generator function baz; use `GeneratorProxy` to make proxies\nMyManager.register('baz', baz, proxytype=GeneratorProxy)\n\n# register getoperatormodule(); make public functions accessible via proxy\nMyManager.register('operator', getoperatormodule)\n\n##\n\ndef test():\nmanager = MyManager()\nmanager.start()\n\nprint('-' * 20)\n\nf1 = manager.Foo1()\nf1.f()\nf1.g()\nassert not hasattr(f1, 'h')\nassert sorted(f1.exposed) == sorted(['f', 'g'])\n\nprint('-' * 20)\n\nf2 = manager.Foo2()\nf2.g()\nf2.h()\nassert not hasattr(f2, 'f')\nassert sorted(f2.exposed) == sorted(['g', 'h'])\n\nprint('-' * 20)\n\nit = manager.baz()\nfor i in it:\nprint('<%d>' % i, end=' ')\nprint()\n\nprint('-' * 20)\n\nop = manager.operator()\nprint('op.add(23, 45) =', op.add(23, 45))\nprint('op.pow(2, 94) =', op.pow(2, 94))\nprint('op.exposed =', op.exposed)\n\n##\n\nif name == 'main':\nfreezesupport()\ntest()\n\nUsing *note Pool: ddb.:\n\nimport multiprocessing\nimport time\nimport random\nimport sys\n\n#\n# Functions used by test code\n#\n\ndef calculate(func, args):\nresult = func(*args)\nreturn '%s says that %s%s = %s' % (\nmultiprocessing.currentprocess().name,\nfunc.name, args, result\n)\n\ndef calculatestar(args):\nreturn calculate(*args)\n\ndef mul(a, b):\ntime.sleep(0.5 * random.random())\nreturn a * b\n\ndef plus(a, b):\ntime.sleep(0.5 * random.random())\nreturn a + b\n\ndef f(x):\nreturn 1.0 / (x - 5.0)\n\ndef pow3(x):\nreturn x  3\n\ndef noop(x):\npass\n\n#\n# Test code\n#\n\ndef test():\nPROCESSES = 4\nprint('Creating pool with %d processes\\n' % PROCESSES)\n\nwith multiprocessing.Pool(PROCESSES) as pool:\n#\n# Tests\n#\n\nTASKS = [(mul, (i, 7)) for i in range(10)] + \\\n[(plus, (i, 8)) for i in range(10)]\n\nresults = [pool.applyasync(calculate, t) for t in TASKS]\nimapit = pool.imap(calculatestar, TASKS)\nimapunorderedit = pool.imapunordered(calculatestar, TASKS)\n\nprint('Ordered results using pool.applyasync():')\nfor r in results:\nprint('\\t', r.get())\nprint()\n\nprint('Ordered results using pool.imap():')\nfor x in imapit:\nprint('\\t', x)\nprint()\n\nprint('Unordered results using pool.imapunordered():')\nfor x in imapunorderedit:\nprint('\\t', x)\nprint()\n\nprint('Ordered results using pool.map() --- will block till complete:')\nfor x in pool.map(calculatestar, TASKS):\nprint('\\t', x)\nprint()\n\n#\n# Test error handling\n#\n\nprint('Testing error handling:')\n\ntry:\nprint(pool.apply(f, (5,)))\nexcept ZeroDivisionError:\nprint('\\tGot ZeroDivisionError as expected from pool.apply()')\nelse:\nraise AssertionError('expected ZeroDivisionError')\n\ntry:\nprint(pool.map(f, list(range(10))))\nexcept ZeroDivisionError:\nprint('\\tGot ZeroDivisionError as expected from pool.map()')\nelse:\nraise AssertionError('expected ZeroDivisionError')\n\ntry:\nprint(list(pool.imap(f, list(range(10)))))\nexcept ZeroDivisionError:\nprint('\\tGot ZeroDivisionError as expected from list(pool.imap())')\nelse:\nraise AssertionError('expected ZeroDivisionError')\n\nit = pool.imap(f, list(range(10)))\nfor i in range(10):\ntry:\nx = next(it)\nexcept ZeroDivisionError:\nif i == 5:\npass\nexcept StopIteration:\nbreak\nelse:\nif i == 5:\nraise AssertionError('expected ZeroDivisionError')\n\nassert i == 9\nprint('\\tGot ZeroDivisionError as expected from IMapIterator.next()')\nprint()\n\n#\n# Testing timeouts\n#\n\nprint('Testing ApplyResult.get() with timeout:', end=' ')\nres = pool.applyasync(calculate, TASKS[0])\nwhile 1:\nsys.stdout.flush()\ntry:\nsys.stdout.write('\\n\\t%s' % res.get(0.02))\nbreak\nexcept multiprocessing.TimeoutError:\nsys.stdout.write('.')\nprint()\nprint()\n\nprint('Testing IMapIterator.next() with timeout:', end=' ')\nit = pool.imap(calculatestar, TASKS)\nwhile 1:\nsys.stdout.flush()\ntry:\nsys.stdout.write('\\n\\t%s' % it.next(0.02))\nexcept StopIteration:\nbreak\nexcept multiprocessing.TimeoutError:\nsys.stdout.write('.')\nprint()\nprint()\n\n\nif name == 'main':\nmultiprocessing.freezesupport()\ntest()\n",
            "subsections": []
        },
        "An example showing how to use queues to feed tasks to a collection of": {
            "content": "worker processes and collect the results:\n\nimport time\nimport random\n\nfrom multiprocessing import Process, Queue, currentprocess, freezesupport\n\n#\n# Function run by worker processes\n#\n\ndef worker(input, output):\nfor func, args in iter(input.get, 'STOP'):\nresult = calculate(func, args)\noutput.put(result)\n\n#\n# Function used to calculate result\n#\n\ndef calculate(func, args):\nresult = func(*args)\nreturn '%s says that %s%s = %s' % \\\n(currentprocess().name, func.name, args, result)\n\n#\n# Functions referenced by tasks\n#\n\ndef mul(a, b):\ntime.sleep(0.5*random.random())\nreturn a * b\n\ndef plus(a, b):\ntime.sleep(0.5*random.random())\nreturn a + b\n\n#\n#\n#\n\ndef test():\nNUMBEROFPROCESSES = 4\nTASKS1 = [(mul, (i, 7)) for i in range(20)]\nTASKS2 = [(plus, (i, 8)) for i in range(10)]\n\n# Create queues\ntaskqueue = Queue()\ndonequeue = Queue()\n\n# Submit tasks\nfor task in TASKS1:\ntaskqueue.put(task)\n\n# Start worker processes\nfor i in range(NUMBEROFPROCESSES):\nProcess(target=worker, args=(taskqueue, donequeue)).start()\n\n# Get and print results\nprint('Unordered results:')\nfor i in range(len(TASKS1)):\nprint('\\t', donequeue.get())\n\n# Add more tasks using `put()`\nfor task in TASKS2:\ntaskqueue.put(task)\n\n# Get and print some more results\nfor i in range(len(TASKS2)):\nprint('\\t', donequeue.get())\n\n# Tell child processes to stop\nfor i in range(NUMBEROFPROCESSES):\ntaskqueue.put('STOP')\n\n\nif name == 'main':\nfreezesupport()\ntest()\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: multiprocessing sharedmemory -- Shared memory for direct access across processes,  Next: The concurrent package,  Prev: multiprocessing -- Process-based parallelism,  Up: Concurrent Execution": {
            "content": "'Source code:' Lib/multiprocessing/sharedmemory.py(1)\n\nNew in version 3.8.\n\n\n\nThis module provides a class, *note SharedMemory: 13b4, for the\nallocation and management of shared memory to be accessed by one or more\nprocesses on a multicore or symmetric multiprocessor (SMP) machine.  To\nassist with the life-cycle management of shared memory especially across\ndistinct processes, a *note BaseManager: 2dcd. subclass, *note\nSharedMemoryManager: 2e0c, is also provided in the *note\nmultiprocessing.managers: 92. module.\n\nIn this module, shared memory refers to \"POSIX style\" shared memory\nblocks (though is not necessarily implemented explicitly as such) and\ndoes not refer to \"distributed shared memory\".  This style of shared\nmemory permits distinct processes to potentially read and write to a\ncommon (or shared) region of volatile memory.  Processes are\nconventionally limited to only have access to their own process memory\nspace but shared memory permits the sharing of data between processes,\navoiding the need to instead send messages between processes containing\nthat data.  Sharing data directly via memory can provide significant\nperformance benefits compared to sharing data via disk or socket or\nother communications requiring the serialization/deserialization and\ncopying of data.\n\n-- Class: multiprocessing.sharedmemory.SharedMemory (name=None,\ncreate=False, size=0)\n\nCreate an instance of the 'SharedMemory' class for either creating\na new shared memory block or attaching to an existing shared memory\nblock.  Each shared memory block is assigned a unique name.  In\nthis way, one process can create a shared memory block with a\nparticular name and a different process can attach to that same\nshared memory block using that same name.\n\nAs a resource for sharing data across processes, shared memory\nblocks may outlive the original process that created them.  When\none process no longer needs access to a shared memory block that\nmight still be needed by other processes, the *note close(): 2e0d.\nmethod should be called.  When a shared memory block is no longer\nneeded by any process, the *note unlink(): 2e0e. method should be\ncalled to ensure proper cleanup.\n\n\nParameters:\n\n* 'name' (*note str: 157.' | ''None') - The unique name for the\nrequested shared memory, specified as a string.  When creating\na new shared memory block, if 'None' (the default) is supplied\nfor the name, a novel name will be generated.\n\n* 'create' (*note bool: 17d.) - Control whether a new shared\nmemory block is created ('True') or an existing shared memory\nblock is attached ('False').\n\n* 'size' (*note int: 17e.) - The requested number of bytes when\ncreating a new shared memory block.  Because some platforms\nchoose to allocate chunks of memory based upon that platform's\nmemory page size, the exact size of the shared memory block\nmay be larger or equal to the size requested.  When attaching\nto an existing shared memory block, the 'size' parameter is\nignored.\n\n-- Method: close ()\n\nClose access to the shared memory from this instance.  In\norder to ensure proper cleanup of resources, all instances\nshould call *note close(): 2e0d. once the instance is no\nlonger needed.  Note that calling 'close()' does not cause the\nshared memory block itself to be destroyed.\n\n-- Method: unlink ()\n\nRequest that the underlying shared memory block be destroyed.\nIn order to ensure proper cleanup of resources, *note\nunlink(): 2e0e. should be called once (and only once) across\nall processes which have need for the shared memory block.\nAfter requesting its destruction, a shared memory block may or\nmay not be immediately destroyed and this behavior may differ\nacross platforms.  Attempts to access data inside the shared\nmemory block after 'unlink()' has been called may result in\nmemory access errors.  Note: the last process relinquishing\nits hold on a shared memory block may call 'unlink()' and\n*note close(): 2e0d. in either order.\n\n-- Attribute: buf\n\nA memoryview of contents of the shared memory block.\n\n-- Attribute: name\n\nRead-only access to the unique name of the shared memory\nblock.\n\n-- Attribute: size\n\nRead-only access to size in bytes of the shared memory block.\n\nThe following example demonstrates low-level use of *note SharedMemory:\n13b4. instances:\n\n>>> from multiprocessing import sharedmemory\n>>> shma = sharedmemory.SharedMemory(create=True, size=10)\n>>> type(shma.buf)\n<class 'memoryview'>\n>>> buffer = shma.buf\n>>> len(buffer)\n10\n>>> buffer[:4] = bytearray([22, 33, 44, 55])  # Modify multiple at once\n>>> buffer[4] = 100                           # Modify single byte at a time\n>>> # Attach to an existing shared memory block\n>>> shmb = sharedmemory.SharedMemory(shma.name)\n>>> import array\n>>> array.array('b', shmb.buf[:5])  # Copy the data into a new array.array\narray('b', [22, 33, 44, 55, 100])\n>>> shmb.buf[:5] = b'howdy'  # Modify via shmb using bytes\n>>> bytes(shma.buf[:5])      # Access via shma\nb'howdy'\n>>> shmb.close()   # Close each SharedMemory instance\n>>> shma.close()\n>>> shma.unlink()  # Call unlink only once to release the shared memory\n\nThe following example demonstrates a practical use of the *note",
            "subsections": []
        },
        "SharedMemory: 13b4. class with NumPy arrays(2), accessing the same": {
            "content": "'numpy.ndarray' from two distinct Python shells:\n\n>>> # In the first Python interactive shell\n>>> import numpy as np\n>>> a = np.array([1, 1, 2, 3, 5, 8])  # Start with an existing NumPy array\n>>> from multiprocessing import sharedmemory\n>>> shm = sharedmemory.SharedMemory(create=True, size=a.nbytes)\n>>> # Now create a NumPy array backed by shared memory\n>>> b = np.ndarray(a.shape, dtype=a.dtype, buffer=shm.buf)\n>>> b[:] = a[:]  # Copy the original data into shared memory\n>>> b\narray([1, 1, 2, 3, 5, 8])\n>>> type(b)\n<class 'numpy.ndarray'>\n>>> type(a)\n<class 'numpy.ndarray'>\n>>> shm.name  # We did not specify a name so one was chosen for us\n'psm2146746075'\n\n>>> # In either the same shell or a new Python shell on the same machine\n>>> import numpy as np\n>>> from multiprocessing import sharedmemory\n>>> # Attach to the existing shared memory block\n>>> existingshm = sharedmemory.SharedMemory(name='psm2146746075')\n>>> # Note that a.shape is (6,) and a.dtype is np.int64 in this example\n>>> c = np.ndarray((6,), dtype=np.int64, buffer=existingshm.buf)\n>>> c\narray([1, 1, 2, 3, 5, 8])\n>>> c[-1] = 888\n>>> c\narray([  1,   1,   2,   3,   5, 888])\n\n>>> # Back in the first Python interactive shell, b reflects this change\n>>> b\narray([  1,   1,   2,   3,   5, 888])\n\n>>> # Clean up from within the second Python shell\n>>> del c  # Unnecessary; merely emphasizing the array is no longer used\n>>> existingshm.close()\n\n>>> # Clean up from within the first Python shell\n>>> del b  # Unnecessary; merely emphasizing the array is no longer used\n>>> shm.close()\n>>> shm.unlink()  # Free and release the shared memory block at the very end\n\n-- Class: multiprocessing.managers.SharedMemoryManager ([address[,\nauthkey]])\n\nA subclass of *note multiprocessing.managers.BaseManager: 2dcd.\nwhich can be used for the management of shared memory blocks across\nprocesses.\n\nA call to *note start(): 2dce. on a 'SharedMemoryManager' instance\ncauses a new process to be started.  This new process's sole\npurpose is to manage the life cycle of all shared memory blocks\ncreated through it.  To trigger the release of all shared memory\nblocks managed by that process, call *note shutdown(): 2dcf. on the\ninstance.  This triggers a *note unlink(): 2e0e. call on all of the\n*note SharedMemory: 2e12. objects managed by that process and then\nstops the process itself.  By creating 'SharedMemory' instances\nthrough a 'SharedMemoryManager', we avoid the need to manually\ntrack and trigger the freeing of shared memory resources.\n\nThis class provides methods for creating and returning *note\nSharedMemory: 2e12. instances and for creating a list-like object\n(*note ShareableList: 2e13.) backed by shared memory.\n\nRefer to *note BaseManager: 2dcd. for a description of the\ninherited 'address' and 'authkey' optional input arguments and how\nthey may be used to connect to an existing 'SharedMemoryManager'\nservice from other processes.\n\n-- Method: SharedMemory (size)\n\nCreate and return a new *note SharedMemory: 2e12. object with\nthe specified 'size' in bytes.\n\n-- Method: ShareableList (sequence)\n\nCreate and return a new *note ShareableList: 2e13. object,\ninitialized by the values from the input 'sequence'.\n\nThe following example demonstrates the basic mechanisms of a *note\nSharedMemoryManager: 2e0c.:\n\n>>> from multiprocessing.managers import SharedMemoryManager\n>>> smm = SharedMemoryManager()\n>>> smm.start()  # Start the process that manages the shared memory blocks\n>>> sl = smm.ShareableList(range(4))\n>>> sl\nShareableList([0, 1, 2, 3], name='psm65727512')\n>>> rawshm = smm.SharedMemory(size=128)\n>>> anothersl = smm.ShareableList('alpha')\n>>> anothersl\nShareableList(['a', 'l', 'p', 'h', 'a'], name='psm657212221')\n>>> smm.shutdown()  # Calls unlink() on sl, rawshm, and anothersl\n",
            "subsections": []
        },
        "The following example depicts a potentially more convenient pattern for": {
            "content": "using *note SharedMemoryManager: 2e0c. objects via the *note with: 396.\nstatement to ensure that all shared memory blocks are released after\nthey are no longer needed:\n\n>>> with SharedMemoryManager() as smm:\n...     sl = smm.ShareableList(range(2000))\n...     # Divide the work among two processes, storing partial results in sl\n...     p1 = Process(target=dowork, args=(sl, 0, 1000))\n...     p2 = Process(target=dowork, args=(sl, 1000, 2000))\n...     p1.start()\n...     p2.start()  # A multiprocessing.Pool might be more efficient\n...     p1.join()\n...     p2.join()   # Wait for all work to complete in both processes\n...     totalresult = sum(sl)  # Consolidate the partial results now in sl\n\nWhen using a *note SharedMemoryManager: 2e0c. in a *note with: 396.\nstatement, the shared memory blocks created using that manager are all\nreleased when the 'with' statement's code block finishes execution.\n\n-- Class: multiprocessing.sharedmemory.ShareableList (sequence=None,\n*, name=None)\n\nProvide a mutable list-like object where all values stored within\nare stored in a shared memory block.  This constrains storable\nvalues to the following built-in data types:\n\n* *note int: 17e. (signed 64-bit)\n\n* *note float: 4b7.\n\n* *note bool: 17d.\n\n* *note str: 157. (less than 10M bytes each when encoded as\nUTF-8)\n\n* *note bytes: 295. (less than 10M bytes each)\n\n* 'None'\n\nIt also notably differs from the built-in *note list: 3dc. type in\nthat these lists can not change their overall length (i.e.  no\n'append()', 'insert()', etc.)  and do not support the dynamic\ncreation of new 'ShareableList' instances via slicing.\n\n'sequence' is used in populating a new 'ShareableList' full of\nvalues.  Set to 'None' to instead attach to an already existing\n'ShareableList' by its unique shared memory name.\n\n'name' is the unique name for the requested shared memory, as\ndescribed in the definition for *note SharedMemory: 13b4.  When\nattaching to an existing 'ShareableList', specify its shared memory\nblock's unique name while leaving 'sequence' set to 'None'.\n\nNote: A known issue exists for *note bytes: 295. and *note\nstr: 157. values.  If they end with '\\x00' nul bytes or\ncharacters, those may be 'silently stripped' when fetching\nthem by index from the 'ShareableList'.  This\n'.rstrip(b'\\x00')' behavior is considered a bug and may go\naway in the future.  See gh-106939(3).\n\nFor applications where rstripping of trailing nulls is a problem,\nwork around it by always unconditionally appending an extra non-0\nbyte to the end of such values when storing and unconditionally\nremoving it when fetching:\n\n>>> from multiprocessing import sharedmemory\n>>> nulbugdemo = sharedmemory.ShareableList(['?\\x00', b'\\x03\\x02\\x01\\x00\\x00\\x00'])\n>>> nulbugdemo[0]\n'?'\n>>> nulbugdemo[1]\nb'\\x03\\x02\\x01'\n>>> nulbugdemo.shm.unlink()\n>>> padded = sharedmemory.ShareableList(['?\\x00\\x07', b'\\x03\\x02\\x01\\x00\\x00\\x00\\x07'])\n>>> padded[0][:-1]\n'?\\x00'\n>>> padded[1][:-1]\nb'\\x03\\x02\\x01\\x00\\x00\\x00'\n>>> padded.shm.unlink()\n\n-- Method: count (value)\n\nReturn the number of occurrences of 'value'.\n\n-- Method: index (value)\n\nReturn first index position of 'value'.  Raise *note\nValueError: 183. if 'value' is not present.\n\n-- Attribute: format\n\nRead-only attribute containing the *note struct: cf. packing\nformat used by all currently stored values.\n\n-- Attribute: shm\n\nThe *note SharedMemory: 13b4. instance where the values are\nstored.\n\nThe following example demonstrates basic use of a *note ShareableList:\n16db. instance:\n\n>>> from multiprocessing import sharedmemory\n>>> a = sharedmemory.ShareableList(['howdy', b'HoWdY', -273.154, 100, None, True, 42])\n>>> [ type(entry) for entry in a ]\n[<class 'str'>, <class 'bytes'>, <class 'float'>, <class 'int'>, <class 'NoneType'>, <class 'bool'>, <class 'int'>]\n>>> a[2]\n-273.154\n>>> a[2] = -78.5\n>>> a[2]\n-78.5\n>>> a[2] = 'dry ice'  # Changing data types is supported as well\n>>> a[2]\n'dry ice'\n>>> a[2] = 'larger than previously allocated storage space'\nTraceback (most recent call last):\n...\nValueError: exceeds available storage for existing str\n>>> a[2]\n'dry ice'\n>>> len(a)\n7\n>>> a.index(42)\n6\n>>> a.count(b'howdy')\n0\n>>> a.count(b'HoWdY')\n1\n>>> a.shm.close()\n>>> a.shm.unlink()\n>>> del a  # Use of a ShareableList after call to unlink() is unsupported\n",
            "subsections": []
        },
        "The following example depicts how one, two, or many processes may access": {
            "content": "the same *note ShareableList: 16db. by supplying the name of the shared\nmemory block behind it:\n\n>>> b = sharedmemory.ShareableList(range(5))         # In a first process\n>>> c = sharedmemory.ShareableList(name=b.shm.name)  # In a second process\n>>> c\nShareableList([0, 1, 2, 3, 4], name='...')\n>>> c[-1] = -999\n>>> b[-1]\n-999\n>>> b.shm.close()\n>>> c.shm.close()\n>>> c.shm.unlink()\n\nThe following examples demonstrates that *note ShareableList: 16db. (and\nunderlying *note SharedMemory: 13b4.) objects can be pickled and\nunpickled if needed.  Note, that it will still be the same shared\nobject.  This happens, because the deserialized object has the same\nunique name and is just attached to an existing object with the same\nname (if the object is still alive):\n\n>>> import pickle\n>>> from multiprocessing import sharedmemory\n>>> sl = sharedmemory.ShareableList(range(10))\n>>> list(sl)\n[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n\n>>> deserializedsl = pickle.loads(pickle.dumps(sl))\n>>> list(deserializedsl)\n[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n\n>>> sl[0] = -1\n>>> deserializedsl[1] = -2\n>>> list(sl)\n[-1, -2, 2, 3, 4, 5, 6, 7, 8, 9]\n>>> list(deserializedsl)\n[-1, -2, 2, 3, 4, 5, 6, 7, 8, 9]\n\n>>> sl.shm.close()\n>>> sl.shm.unlink()\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/multiprocessing/sharedmemory.py\n\n(2) https://numpy.org/\n\n(3) https://github.com/python/cpython/issues/106939\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The concurrent package,  Next: concurrent futures -- Launching parallel tasks,  Prev: multiprocessing sharedmemory -- Shared memory for direct access across processes,  Up: Concurrent Execution": {
            "content": "Currently, there is only one module in this package:\n\n* *note concurrent.futures: 1f. - Launching parallel tasks\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: concurrent futures -- Launching parallel tasks,  Next: subprocess -- Subprocess management,  Prev: The concurrent package,  Up: Concurrent Execution": {
            "content": "New in version 3.2.\n\n'Source code:' Lib/concurrent/futures/thread.py(1) and",
            "subsections": []
        },
        "Lib/concurrent/futures/process.py(2)": {
            "content": "The *note concurrent.futures: 1f. module provides a high-level interface\nfor asynchronously executing callables.\n\nThe asynchronous execution can be performed with threads, using *note\nThreadPoolExecutor: 529, or separate processes, using *note",
            "subsections": []
        },
        "ProcessPoolExecutor: 707.  Both implement the same interface, which is": {
            "content": "defined by the abstract *note Executor: 2e1c. class.\n\n*note Availability: 1ad3.: not Emscripten, not WASI.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Executor Objects,  Next: ThreadPoolExecutor,  Up: concurrent futures -- Launching parallel tasks": {
            "content": "5.17.5.1 Executor Objects\n.........................\n\n-- Class: concurrent.futures.Executor\n\nAn abstract class that provides methods to execute calls\nasynchronously.  It should not be used directly, but through its\nconcrete subclasses.\n\n-- Method: submit (fn, /, *args, kwargs)\n\nSchedules the callable, 'fn', to be executed as 'fn(*args,\nkwargs)' and returns a *note Future: 1025. object\nrepresenting the execution of the callable.\n\nwith ThreadPoolExecutor(maxworkers=1) as executor:\nfuture = executor.submit(pow, 323, 1235)\nprint(future.result())\n\n-- Method: map (fn, *iterables, timeout=None, chunksize=1)\n\nSimilar to *note map(fn, *iterables): 65f. except:\n\n* the 'iterables' are collected immediately rather than\nlazily;\n\n* 'fn' is executed asynchronously and several calls to 'fn'\nmay be made concurrently.\n\nThe returned iterator raises a *note TimeoutError: 62a. if\n*note next(): 1141. is called and the result isn't\navailable after 'timeout' seconds from the original call to\n*note Executor.map(): c41.  'timeout' can be an int or a\nfloat.  If 'timeout' is not specified or 'None', there is no\nlimit to the wait time.\n\nIf a 'fn' call raises an exception, then that exception will\nbe raised when its value is retrieved from the iterator.\n\nWhen using *note ProcessPoolExecutor: 707, this method chops\n'iterables' into a number of chunks which it submits to the\npool as separate tasks.  The (approximate) size of these\nchunks can be specified by setting 'chunksize' to a positive\ninteger.  For very long iterables, using a large value for\n'chunksize' can significantly improve performance compared to\nthe default size of 1.  With *note ThreadPoolExecutor: 529,\n'chunksize' has no effect.\n\nChanged in version 3.5: Added the 'chunksize' argument.\n\n-- Method: shutdown (wait=True, *, cancelfutures=False)\n\nSignal the executor that it should free any resources that it\nis using when the currently pending futures are done\nexecuting.  Calls to *note Executor.submit(): 8b0. and *note\nExecutor.map(): c41. made after shutdown will raise *note\nRuntimeError: 17a.\n\nIf 'wait' is 'True' then this method will not return until all\nthe pending futures are done executing and the resources\nassociated with the executor have been freed.  If 'wait' is\n'False' then this method will return immediately and the\nresources associated with the executor will be freed when all\npending futures are done executing.  Regardless of the value\nof 'wait', the entire Python program will not exit until all\npending futures are done executing.\n\nIf 'cancelfutures' is 'True', this method will cancel all\npending futures that the executor has not started running.\nAny futures that are completed or running won't be cancelled,\nregardless of the value of 'cancelfutures'.\n\nIf both 'cancelfutures' and 'wait' are 'True', all futures\nthat the executor has started running will be completed prior\nto this method returning.  The remaining futures are\ncancelled.\n\nYou can avoid having to call this method explicitly if you use\nthe *note with: 396. statement, which will shutdown the *note\nExecutor: 2e1c. (waiting as if *note Executor.shutdown(): 706.\nwere called with 'wait' set to 'True'):\n\nimport shutil\nwith ThreadPoolExecutor(maxworkers=4) as e:\ne.submit(shutil.copy, 'src1.txt', 'dest1.txt')\ne.submit(shutil.copy, 'src2.txt', 'dest2.txt')\ne.submit(shutil.copy, 'src3.txt', 'dest3.txt')\ne.submit(shutil.copy, 'src4.txt', 'dest4.txt')\n\nChanged in version 3.9: Added 'cancelfutures'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ThreadPoolExecutor,  Next: ProcessPoolExecutor,  Prev: Executor Objects,  Up: concurrent futures -- Launching parallel tasks": {
            "content": "5.17.5.2 ThreadPoolExecutor\n...........................\n\n*note ThreadPoolExecutor: 529. is an *note Executor: 2e1c. subclass that\nuses a pool of threads to execute calls asynchronously.\n\nDeadlocks can occur when the callable associated with a *note Future:\n1025. waits on the results of another *note Future: 1025.  For example:\n\nimport time\ndef waitonb():\ntime.sleep(5)\nprint(b.result())  # b will never complete because it is waiting on a.\nreturn 5\n\ndef waitona():\ntime.sleep(5)\nprint(a.result())  # a will never complete because it is waiting on b.\nreturn 6\n\n\nexecutor = ThreadPoolExecutor(maxworkers=2)\na = executor.submit(waitonb)\nb = executor.submit(waitona)\n\nAnd:\n\ndef waitonfuture():\nf = executor.submit(pow, 5, 2)\n# This will never complete because there is only one worker thread and\n# it is executing this function.\nprint(f.result())\n\nexecutor = ThreadPoolExecutor(maxworkers=1)\nexecutor.submit(waitonfuture)\n\n-- Class: concurrent.futures.ThreadPoolExecutor (maxworkers=None,\nthreadnameprefix='', initializer=None, initargs=())\n\nAn *note Executor: 2e1c. subclass that uses a pool of at most\n'maxworkers' threads to execute calls asynchronously.\n\nAll threads enqueued to 'ThreadPoolExecutor' will be joined before\nthe interpreter can exit.  Note that the exit handler which does\nthis is executed 'before' any exit handlers added using 'atexit'.\nThis means exceptions in the main thread must be caught and handled\nin order to signal threads to exit gracefully.  For this reason, it\nis recommended that 'ThreadPoolExecutor' not be used for\nlong-running tasks.\n\n'initializer' is an optional callable that is called at the start\nof each worker thread; 'initargs' is a tuple of arguments passed to\nthe initializer.  Should 'initializer' raise an exception, all\ncurrently pending jobs will raise a *note BrokenThreadPool: 2e1f,\nas well as any attempt to submit more jobs to the pool.\n\nChanged in version 3.5: If 'maxworkers' is 'None' or not given, it\nwill default to the number of processors on the machine, multiplied\nby '5', assuming that *note ThreadPoolExecutor: 529. is often used\nto overlap I/O instead of CPU work and the number of workers should\nbe higher than the number of workers for *note ProcessPoolExecutor:\n707.\n\nChanged in version 3.6: Added the 'threadnameprefix' parameter to\nallow users to control the *note threading.Thread: 76c. names for\nworker threads created by the pool for easier debugging.\n\nChanged in version 3.7: Added the 'initializer' and 'initargs'\narguments.\n\nChanged in version 3.8: Default value of 'maxworkers' is changed\nto 'min(32, os.cpucount() + 4)'.  This default value preserves at\nleast 5 workers for I/O bound tasks.  It utilizes at most 32 CPU\ncores for CPU bound tasks which release the GIL. And it avoids\nusing very large resources implicitly on many-core machines.\n\nThreadPoolExecutor now reuses idle worker threads before starting\n'maxworkers' worker threads too.\n\n* Menu:\n\n* ThreadPoolExecutor Example::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ThreadPoolExecutor Example,  Up: ThreadPoolExecutor": {
            "content": "5.17.5.3 ThreadPoolExecutor Example\n...................................\n\nimport concurrent.futures\nimport urllib.request\n\nURLS = ['http://www.foxnews.com/',\n'http://www.cnn.com/',\n'http://europe.wsj.com/',\n'http://www.bbc.co.uk/',\n'http://nonexistant-subdomain.python.org/']\n\n# Retrieve a single page and report the URL and contents\ndef loadurl(url, timeout):\nwith urllib.request.urlopen(url, timeout=timeout) as conn:\nreturn conn.read()\n\n# We can use a with statement to ensure threads are cleaned up promptly\nwith concurrent.futures.ThreadPoolExecutor(maxworkers=5) as executor:\n# Start the load operations and mark each future with its URL\nfuturetourl = {executor.submit(loadurl, url, 60): url for url in URLS}\nfor future in concurrent.futures.ascompleted(futuretourl):\nurl = futuretourl[future]\ntry:\ndata = future.result()\nexcept Exception as exc:\nprint('%r generated an exception: %s' % (url, exc))\nelse:\nprint('%r page is %d bytes' % (url, len(data)))\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ProcessPoolExecutor,  Next: Future Objects,  Prev: ThreadPoolExecutor,  Up: concurrent futures -- Launching parallel tasks": {
            "content": "5.17.5.4 ProcessPoolExecutor\n............................\n\nThe *note ProcessPoolExecutor: 707. class is an *note Executor: 2e1c.\nsubclass that uses a pool of processes to execute calls asynchronously.\n*note ProcessPoolExecutor: 707. uses the *note multiprocessing: 8f.\nmodule, which allows it to side-step the *note Global Interpreter Lock:\n141. but also means that only picklable objects can be executed and\nreturned.\n",
            "subsections": []
        },
        "The 'main' module must be importable by worker subprocesses.  This": {
            "content": "means that *note ProcessPoolExecutor: 707. will not work in the\ninteractive interpreter.\n\nCalling *note Executor: 2e1c. or *note Future: 1025. methods from a\ncallable submitted to a *note ProcessPoolExecutor: 707. will result in\ndeadlock.\n\n-- Class: concurrent.futures.ProcessPoolExecutor (maxworkers=None,\nmpcontext=None, initializer=None, initargs=(),\nmaxtasksperchild=None)\n\nAn *note Executor: 2e1c. subclass that executes calls\nasynchronously using a pool of at most 'maxworkers' processes.  If\n'maxworkers' is 'None' or not given, it will default to the number\nof processors on the machine.  If 'maxworkers' is less than or\nequal to '0', then a *note ValueError: 183. will be raised.  On\nWindows, 'maxworkers' must be less than or equal to '61'.  If it\nis not then *note ValueError: 183. will be raised.  If\n'maxworkers' is 'None', then the default chosen will be at most\n'61', even if more processors are available.  'mpcontext' can be a\n*note multiprocessing: 8f. context or 'None'.  It will be used to\nlaunch the workers.  If 'mpcontext' is 'None' or not given, the\ndefault *note multiprocessing: 8f. context is used.  See *note\nContexts and start methods: 22d.\n\n'initializer' is an optional callable that is called at the start\nof each worker process; 'initargs' is a tuple of arguments passed\nto the initializer.  Should 'initializer' raise an exception, all\ncurrently pending jobs will raise a *note BrokenProcessPool: 2e22,\nas well as any attempt to submit more jobs to the pool.\n\n'maxtasksperchild' is an optional argument that specifies the\nmaximum number of tasks a single process can execute before it will\nexit and be replaced with a fresh worker process.  By default\n'maxtasksperchild' is 'None' which means worker processes will\nlive as long as the pool.  When a max is specified, the \"spawn\"\nmultiprocessing start method will be used by default in absence of\na 'mpcontext' parameter.  This feature is incompatible with the\n\"fork\" start method.\n\nChanged in version 3.3: When one of the worker processes terminates\nabruptly, a *note BrokenProcessPool: 2e22. error is now raised.\nPreviously, behaviour was undefined but operations on the executor\nor its futures would often freeze or deadlock.\n\nChanged in version 3.7: The 'mpcontext' argument was added to\nallow users to control the startmethod for worker processes\ncreated by the pool.\n\nAdded the 'initializer' and 'initargs' arguments.\n\nNote: The default *note multiprocessing: 8f. start method (see\n*note Contexts and start methods: 22d.) will change away from\n'fork' in Python 3.14.  Code that requires 'fork' be used for\ntheir *note ProcessPoolExecutor: 707. should explicitly\nspecify that by passing a\n'mpcontext=multiprocessing.getcontext(\"fork\")' parameter.\n\nChanged in version 3.11: The 'maxtasksperchild' argument was\nadded to allow users to control the lifetime of workers in the\npool.\n\nChanged in version 3.12: On POSIX systems, if your application has\nmultiple threads and the *note multiprocessing: 8f. context uses\nthe '\"fork\"' start method: The *note os.fork(): 231. function\ncalled internally to spawn workers may raise a *note\nDeprecationWarning: 179.  Pass a 'mpcontext' configured to use a\ndifferent start method.  See the *note os.fork(): 231.\ndocumentation for further explanation.\n\n* Menu:\n\n* ProcessPoolExecutor Example::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ProcessPoolExecutor Example,  Up: ProcessPoolExecutor": {
            "content": "5.17.5.5 ProcessPoolExecutor Example\n....................................\n\nimport concurrent.futures\nimport math\n\nPRIMES = [\n112272535095293,\n112582705942171,\n112272535095293,\n115280095190773,\n115797848077099,\n1099726899285419]\n\ndef isprime(n):\nif n < 2:\nreturn False\nif n == 2:\nreturn True\nif n % 2 == 0:\nreturn False\n\nsqrtn = int(math.floor(math.sqrt(n)))\nfor i in range(3, sqrtn + 1, 2):\nif n % i == 0:\nreturn False\nreturn True\n\ndef main():\nwith concurrent.futures.ProcessPoolExecutor() as executor:\nfor number, prime in zip(PRIMES, executor.map(isprime, PRIMES)):\nprint('%d is prime: %s' % (number, prime))\n\nif name == 'main':\nmain()\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Future Objects,  Next: Module Functions,  Prev: ProcessPoolExecutor,  Up: concurrent futures -- Launching parallel tasks": {
            "content": "5.17.5.6 Future Objects\n.......................\n\nThe *note Future: 1025. class encapsulates the asynchronous execution of\na callable.  *note Future: 1025. instances are created by *note\nExecutor.submit(): 8b0.\n\n-- Class: concurrent.futures.Future\n\nEncapsulates the asynchronous execution of a callable.  *note\nFuture: 1025. instances are created by *note Executor.submit():\n8b0. and should not be created directly except for testing.\n\n-- Method: cancel ()\n\nAttempt to cancel the call.  If the call is currently being\nexecuted or finished running and cannot be cancelled then the\nmethod will return 'False', otherwise the call will be\ncancelled and the method will return 'True'.\n\n-- Method: cancelled ()\n\nReturn 'True' if the call was successfully cancelled.\n\n-- Method: running ()\n\nReturn 'True' if the call is currently being executed and\ncannot be cancelled.\n\n-- Method: done ()\n\nReturn 'True' if the call was successfully cancelled or\nfinished running.\n\n-- Method: result (timeout=None)\n\nReturn the value returned by the call.  If the call hasn't yet\ncompleted then this method will wait up to 'timeout' seconds.\nIf the call hasn't completed in 'timeout' seconds, then a\n*note TimeoutError: 62a. will be raised.  'timeout' can be an\nint or float.  If 'timeout' is not specified or 'None', there\nis no limit to the wait time.\n\nIf the future is cancelled before completing then *note\nCancelledError: 800. will be raised.\n\nIf the call raised an exception, this method will raise the\nsame exception.\n\n-- Method: exception (timeout=None)\n\nReturn the exception raised by the call.  If the call hasn't\nyet completed then this method will wait up to 'timeout'\nseconds.  If the call hasn't completed in 'timeout' seconds,\nthen a *note TimeoutError: 62a. will be raised.  'timeout' can\nbe an int or float.  If 'timeout' is not specified or 'None',\nthere is no limit to the wait time.\n\nIf the future is cancelled before completing then *note\nCancelledError: 800. will be raised.\n\nIf the call completed without raising, 'None' is returned.\n\n-- Method: adddonecallback (fn)\n\nAttaches the callable 'fn' to the future.  'fn' will be\ncalled, with the future as its only argument, when the future\nis cancelled or finishes running.\n\nAdded callables are called in the order that they were added\nand are always called in a thread belonging to the process\nthat added them.  If the callable raises an *note Exception:\n7ff. subclass, it will be logged and ignored.  If the callable\nraises a *note BaseException: 37c. subclass, the behavior is\nundefined.\n\nIf the future has already completed or been cancelled, 'fn'\nwill be called immediately.\n\nThe following *note Future: 1025. methods are meant for use in unit\ntests and *note Executor: 2e1c. implementations.\n\n-- Method: setrunningornotifycancel ()\n\nThis method should only be called by *note Executor: 2e1c.\nimplementations before executing the work associated with the\n*note Future: 1025. and by unit tests.\n\nIf the method returns 'False' then the *note Future: 1025. was\ncancelled, i.e.  *note Future.cancel(): 2e25. was called and\nreturned 'True'.  Any threads waiting on the *note Future:\n1025. completing (i.e.  through *note ascompleted(): 2e2d. or\n*note wait(): 15c4.) will be woken up.\n\nIf the method returns 'True' then the *note Future: 1025. was\nnot cancelled and has been put in the running state, i.e.\ncalls to *note Future.running(): 2e27. will return 'True'.\n\nThis method can only be called once and cannot be called after\n*note Future.setresult(): 2e2e. or *note\nFuture.setexception(): 2e2f. have been called.\n\n-- Method: setresult (result)\n\nSets the result of the work associated with the *note Future:\n1025. to 'result'.\n\nThis method should only be used by *note Executor: 2e1c.\nimplementations and unit tests.\n\nChanged in version 3.8: This method raises *note\nconcurrent.futures.InvalidStateError: 2e30. if the *note\nFuture: 1025. is already done.\n\n-- Method: setexception (exception)\n\nSets the result of the work associated with the *note Future:\n1025. to the *note Exception: 7ff. 'exception'.\n\nThis method should only be used by *note Executor: 2e1c.\nimplementations and unit tests.\n\nChanged in version 3.8: This method raises *note\nconcurrent.futures.InvalidStateError: 2e30. if the *note\nFuture: 1025. is already done.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Module Functions,  Next: Exception classes,  Prev: Future Objects,  Up: concurrent futures -- Launching parallel tasks": {
            "content": "5.17.5.7 Module Functions\n.........................\n\n-- Function: concurrent.futures.wait (fs, timeout=None,\nreturnwhen=ALLCOMPLETED)\n\nWait for the *note Future: 1025. instances (possibly created by\ndifferent *note Executor: 2e1c. instances) given by 'fs' to\ncomplete.  Duplicate futures given to 'fs' are removed and will be\nreturned only once.  Returns a named 2-tuple of sets.  The first\nset, named 'done', contains the futures that completed (finished or\ncancelled futures) before the wait completed.  The second set,\nnamed 'notdone', contains the futures that did not complete\n(pending or running futures).\n\n'timeout' can be used to control the maximum number of seconds to\nwait before returning.  'timeout' can be an int or float.  If\n'timeout' is not specified or 'None', there is no limit to the wait\ntime.\n\n'returnwhen' indicates when this function should return.  It must\nbe one of the following constants:\n\nConstant                                               Description\n\n--------------------------------------------------------------------------------------------------------------\n\n-- Data: concurrent.futures.FIRSTCOMPLETED           The function will return when any future finishes or\nis cancelled.\n\n\n-- Data: concurrent.futures.FIRSTEXCEPTION           The function will return when any future finishes by\nraising an exception.  If no future raises an\nexception then it is equivalent to\n*note ALLCOMPLETED: 2e34.\n\n\n-- Data: concurrent.futures.ALLCOMPLETED             The function will return when all futures finish or\nare cancelled.\n\n\n-- Function: concurrent.futures.ascompleted (fs, timeout=None)\n\nReturns an iterator over the *note Future: 1025. instances\n(possibly created by different *note Executor: 2e1c. instances)\ngiven by 'fs' that yields futures as they complete (finished or\ncancelled futures).  Any futures given by 'fs' that are duplicated\nwill be returned once.  Any futures that completed before *note\nascompleted(): 2e2d. is called will be yielded first.  The\nreturned iterator raises a *note TimeoutError: 62a. if *note\nnext(): 1141. is called and the result isn't available after\n'timeout' seconds from the original call to *note ascompleted():\n2e2d.  'timeout' can be an int or float.  If 'timeout' is not\nspecified or 'None', there is no limit to the wait time.\n\nSee also\n........\n\nPEP 3148(1) - futures - execute computations asynchronously\n\nThe proposal which described this feature for inclusion in the\nPython standard library.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3148/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Exception classes,  Prev: Module Functions,  Up: concurrent futures -- Launching parallel tasks": {
            "content": "5.17.5.8 Exception classes\n..........................\n\n-- Exception: concurrent.futures.CancelledError\n\nRaised when a future is cancelled.\n\n-- Exception: concurrent.futures.TimeoutError\n\nA deprecated alias of *note TimeoutError: 62a, raised when a future\noperation exceeds the given timeout.\n\nChanged in version 3.11: This class was made an alias of *note\nTimeoutError: 62a.\n\n-- Exception: concurrent.futures.BrokenExecutor\n\nDerived from *note RuntimeError: 17a, this exception class is\nraised when an executor is broken for some reason, and cannot be\nused to submit or execute new tasks.\n\nNew in version 3.7.\n\n-- Exception: concurrent.futures.InvalidStateError\n\nRaised when an operation is performed on a future that is not\nallowed in the current state.\n\nNew in version 3.8.\n\n-- Exception: concurrent.futures.thread.BrokenThreadPool\n\nDerived from *note BrokenExecutor: 2e37, this exception class is\nraised when one of the workers of a *note ThreadPoolExecutor: 529.\nhas failed initializing.\n\nNew in version 3.7.\n\n-- Exception: concurrent.futures.process.BrokenProcessPool\n\nDerived from *note BrokenExecutor: 2e37. (formerly *note\nRuntimeError: 17a.), this exception class is raised when one of the\nworkers of a *note ProcessPoolExecutor: 707. has terminated in a\nnon-clean fashion (for example, if it was killed from the outside).\n\nNew in version 3.3.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: subprocess -- Subprocess management,  Next: sched -- Event scheduler,  Prev: concurrent futures -- Launching parallel tasks,  Up: Concurrent Execution": {
            "content": "'Source code:' Lib/subprocess.py(1)\n\n\n\nThe *note subprocess: d0. module allows you to spawn new processes,\nconnect to their input/output/error pipes, and obtain their return\ncodes.  This module intends to replace several older modules and\nfunctions:\n\nos.system\nos.spawn*\n\nInformation about how the *note subprocess: d0. module can be used to\nreplace these modules and functions can be found in the following\nsections.\n\nSee also\n........\n\nPEP 324(2) - PEP proposing the subprocess module\n\n*note Availability: 1ad3.: not Emscripten, not WASI.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using the subprocess Module,  Next: Security Considerations,  Up: subprocess -- Subprocess management": {
            "content": "5.17.6.1 Using the 'subprocess' Module\n......................................\n\nThe recommended approach to invoking subprocesses is to use the *note\nrun(): 9c9. function for all use cases it can handle.  For more advanced\nuse cases, the underlying *note Popen: 8c3. interface can be used\ndirectly.\n\n-- Function: subprocess.run (args, *, stdin=None, input=None,\nstdout=None, stderr=None, captureoutput=False, shell=False,\ncwd=None, timeout=None, check=False, encoding=None,\nerrors=None, text=None, env=None, universalnewlines=None,\notherpopenkwargs)\n\nRun the command described by 'args'.  Wait for command to complete,\nthen return a *note CompletedProcess: cd6. instance.\n\nThe arguments shown above are merely the most common ones,\ndescribed below in *note Frequently Used Arguments: 2e3b. (hence\nthe use of keyword-only notation in the abbreviated signature).\nThe full function signature is largely the same as that of the\n*note Popen: 8c3. constructor - most of the arguments to this\nfunction are passed through to that interface.  ('timeout',\n'input', 'check', and 'captureoutput' are not.)\n\nIf 'captureoutput' is true, stdout and stderr will be captured.\nWhen used, the internal *note Popen: 8c3. object is automatically\ncreated with 'stdout' and 'stdin' both set to *note PIPE: 9ca.  The\n'stdout' and 'stderr' arguments may not be supplied at the same\ntime as 'captureoutput'.  If you wish to capture and combine both\nstreams into one, set 'stdout' to *note PIPE: 9ca. and 'stderr' to\n*note STDOUT: 2e3c, instead of using 'captureoutput'.\n\nA 'timeout' may be specified in seconds, it is internally passed on\nto *note Popen.communicate(): 2e3d.  If the timeout expires, the\nchild process will be killed and waited for.  The *note\nTimeoutExpired: 2e3e. exception will be re-raised after the child\nprocess has terminated.  The initial process creation itself cannot\nbe interrupted on many platform APIs so you are not guaranteed to\nsee a timeout exception until at least after however long process\ncreation takes.\n\nThe 'input' argument is passed to *note Popen.communicate(): 2e3d.\nand thus to the subprocess's stdin.  If used it must be a byte\nsequence, or a string if 'encoding' or 'errors' is specified or\n'text' is true.  When used, the internal *note Popen: 8c3. object\nis automatically created with 'stdin' set to *note PIPE: 9ca, and\nthe 'stdin' argument may not be used as well.\n\nIf 'check' is true, and the process exits with a non-zero exit\ncode, a *note CalledProcessError: 119c. exception will be raised.\nAttributes of that exception hold the arguments, the exit code, and\nstdout and stderr if they were captured.\n\nIf 'encoding' or 'errors' are specified, or 'text' is true, file\nobjects for stdin, stdout and stderr are opened in text mode using\nthe specified 'encoding' and 'errors' or the *note\nio.TextIOWrapper: b8f. default.  The 'universalnewlines' argument\nis equivalent to 'text' and is provided for backwards\ncompatibility.  By default, file objects are opened in binary mode.\n\nIf 'env' is not 'None', it must be a mapping that defines the\nenvironment variables for the new process; these are used instead\nof the default behavior of inheriting the current process'\nenvironment.  It is passed directly to *note Popen: 8c3.  This\nmapping can be str to str on any platform or bytes to bytes on\nPOSIX platforms much like *note os.environ: 102e. or *note\nos.environb: 108b.\n\nExamples:\n\n>>> subprocess.run([\"ls\", \"-l\"])  # doesn't capture output\nCompletedProcess(args=['ls', '-l'], returncode=0)\n\n>>> subprocess.run(\"exit 1\", shell=True, check=True)\nTraceback (most recent call last):\n...\nsubprocess.CalledProcessError: Command 'exit 1' returned non-zero exit status 1\n\n>>> subprocess.run([\"ls\", \"-l\", \"/dev/null\"], captureoutput=True)\nCompletedProcess(args=['ls', '-l', '/dev/null'], returncode=0,\nstdout=b'crw-rw-rw- 1 root root 1, 3 Jan 23 16:23 /dev/null\\n', stderr=b'')\n\nNew in version 3.5.\n\nChanged in version 3.6: Added 'encoding' and 'errors' parameters\n\nChanged in version 3.7: Added the 'text' parameter, as a more\nunderstandable alias of 'universalnewlines'.  Added the\n'captureoutput' parameter.\n\nChanged in version 3.12: Changed Windows shell search order for\n'shell=True'.  The current directory and '%PATH%' are replaced with\n'%COMSPEC%' and '%SystemRoot%\\System32\\cmd.exe'.  As a result,\ndropping a malicious program named 'cmd.exe' into a current\ndirectory no longer works.\n\n-- Class: subprocess.CompletedProcess\n\nThe return value from *note run(): 9c9, representing a process that\nhas finished.\n\n-- Attribute: args\n\nThe arguments used to launch the process.  This may be a list\nor a string.\n\n-- Attribute: returncode\n\nExit status of the child process.  Typically, an exit status\nof 0 indicates that it ran successfully.\n\nA negative value '-N' indicates that the child was terminated\nby signal 'N' (POSIX only).\n\n-- Attribute: stdout\n\nCaptured stdout from the child process.  A bytes sequence, or\na string if *note run(): 9c9. was called with an encoding,\nerrors, or text=True.  'None' if stdout was not captured.\n\nIf you ran the process with 'stderr=subprocess.STDOUT', stdout\nand stderr will be combined in this attribute, and *note\nstderr: 2e42. will be 'None'.\n\n-- Attribute: stderr\n\nCaptured stderr from the child process.  A bytes sequence, or\na string if *note run(): 9c9. was called with an encoding,\nerrors, or text=True.  'None' if stderr was not captured.\n\n-- Method: checkreturncode ()\n\nIf *note returncode: 2e40. is non-zero, raise a *note\nCalledProcessError: 119c.\n\nNew in version 3.5.\n\n-- Data: subprocess.DEVNULL\n\nSpecial value that can be used as the 'stdin', 'stdout' or 'stderr'\nargument to *note Popen: 8c3. and indicates that the special file\n*note os.devnull: 17ad. will be used.\n\nNew in version 3.3.\n\n-- Data: subprocess.PIPE\n\nSpecial value that can be used as the 'stdin', 'stdout' or 'stderr'\nargument to *note Popen: 8c3. and indicates that a pipe to the\nstandard stream should be opened.  Most useful with *note\nPopen.communicate(): 2e3d.\n\n-- Data: subprocess.STDOUT\n\nSpecial value that can be used as the 'stderr' argument to *note\nPopen: 8c3. and indicates that standard error should go into the\nsame handle as standard output.\n\n-- Exception: subprocess.SubprocessError\n\nBase class for all other exceptions from this module.\n\nNew in version 3.3.\n\n-- Exception: subprocess.TimeoutExpired\n\nSubclass of *note SubprocessError: 2e44, raised when a timeout\nexpires while waiting for a child process.\n\n-- Attribute: cmd\n\nCommand that was used to spawn the child process.\n\n-- Attribute: timeout\n\nTimeout in seconds.\n\n-- Attribute: output\n\nOutput of the child process if it was captured by *note run():\n9c9. or *note checkoutput(): e31.  Otherwise, 'None'.  This\nis always *note bytes: 295. when any output was captured\nregardless of the 'text=True' setting.  It may remain 'None'\ninstead of 'b''' when no output was observed.\n\n-- Attribute: stdout\n\nAlias for output, for symmetry with *note stderr: 2e49.\n\n-- Attribute: stderr\n\nStderr output of the child process if it was captured by *note\nrun(): 9c9.  Otherwise, 'None'.  This is always *note bytes:\n295. when stderr output was captured regardless of the\n'text=True' setting.  It may remain 'None' instead of 'b'''\nwhen no stderr output was observed.\n\nNew in version 3.3.\n\nChanged in version 3.5: 'stdout' and 'stderr' attributes added\n\n-- Exception: subprocess.CalledProcessError\n\nSubclass of *note SubprocessError: 2e44, raised when a process run\nby *note checkcall(): 2e4a, *note checkoutput(): e31, or *note\nrun(): 9c9. (with 'check=True') returns a non-zero exit status.\n\n-- Attribute: returncode\n\nExit status of the child process.  If the process exited due\nto a signal, this will be the negative signal number.\n\n-- Attribute: cmd\n\nCommand that was used to spawn the child process.\n\n-- Attribute: output\n\nOutput of the child process if it was captured by *note run():\n9c9. or *note checkoutput(): e31.  Otherwise, 'None'.\n\n-- Attribute: stdout\n\nAlias for output, for symmetry with *note stderr: 2e4f.\n\n-- Attribute: stderr\n\nStderr output of the child process if it was captured by *note\nrun(): 9c9.  Otherwise, 'None'.\n\nChanged in version 3.5: 'stdout' and 'stderr' attributes added\n\n* Menu:\n\n* Frequently Used Arguments::\n* Popen Constructor::\n* Exceptions: Exceptions<9>.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Frequently Used Arguments,  Next: Popen Constructor,  Up: Using the subprocess Module": {
            "content": "5.17.6.2 Frequently Used Arguments\n..................................\n\nTo support a wide variety of use cases, the *note Popen: 8c3.\nconstructor (and the convenience functions) accept a large number of\noptional arguments.  For most typical use cases, many of these arguments\ncan be safely left at their default values.  The arguments that are most\ncommonly needed are:\n\n'args' is required for all calls and should be a string, or a\nsequence of program arguments.  Providing a sequence of arguments\nis generally preferred, as it allows the module to take care of any\nrequired escaping and quoting of arguments (e.g.  to permit spaces\nin file names).  If passing a single string, either 'shell' must be\n*note True: a53. (see below) or else the string must simply name\nthe program to be executed without specifying any arguments.\n\n'stdin', 'stdout' and 'stderr' specify the executed program's\nstandard input, standard output and standard error file handles,\nrespectively.  Valid values are 'None', *note PIPE: 9ca, *note\nDEVNULL: fc2, an existing file descriptor (a positive integer), and\nan existing *note file object: 1037. with a valid file descriptor.\nWith the default settings of 'None', no redirection will occur.\n*note PIPE: 9ca. indicates that a new pipe to the child should be\ncreated.  *note DEVNULL: fc2. indicates that the special file *note\nos.devnull: 17ad. will be used.  Additionally, 'stderr' can be\n*note STDOUT: 2e3c, which indicates that the stderr data from the\nchild process should be captured into the same file handle as for\n'stdout'.\n\nIf 'encoding' or 'errors' are specified, or 'text' (also known as\n'universalnewlines') is true, the file objects 'stdin', 'stdout'\nand 'stderr' will be opened in text mode using the 'encoding' and\n'errors' specified in the call or the defaults for *note\nio.TextIOWrapper: b8f.\n\nFor 'stdin', line ending characters ''\\n'' in the input will be\nconverted to the default line separator *note os.linesep: 1e84.\nFor 'stdout' and 'stderr', all line endings in the output will be\nconverted to ''\\n''.  For more information see the documentation of\nthe *note io.TextIOWrapper: b8f. class when the 'newline' argument\nto its constructor is 'None'.\n\nIf text mode is not used, 'stdin', 'stdout' and 'stderr' will be\nopened as binary streams.  No encoding or line ending conversion is\nperformed.\n\nChanged in version 3.6: Added the 'encoding' and 'errors'\nparameters.\n\nChanged in version 3.7: Added the 'text' parameter as an alias for\n'universalnewlines'.\n\nNote: The newlines attribute of the file objects *note\nPopen.stdin: 2e51, *note Popen.stdout: 2e52. and *note\nPopen.stderr: 2e53. are not updated by the *note\nPopen.communicate(): 2e3d. method.\n\nIf 'shell' is 'True', the specified command will be executed\nthrough the shell.  This can be useful if you are using Python\nprimarily for the enhanced control flow it offers over most system\nshells and still want convenient access to other shell features\nsuch as shell pipes, filename wildcards, environment variable\nexpansion, and expansion of '~' to a user's home directory.\nHowever, note that Python itself offers implementations of many\nshell-like features (in particular, *note glob: 5f, *note fnmatch:\n57, *note os.walk(): 1c8, *note os.path.expandvars(): 122e, *note\nos.path.expanduser(): 83d, and *note shutil: c0.).\n\nChanged in version 3.3: When 'universalnewlines' is 'True', the\nclass uses the encoding *note locale.getpreferredencoding(False):\n290. instead of 'locale.getpreferredencoding()'.  See the *note\nio.TextIOWrapper: b8f. class for more information on this change.\n\nNote: Read the *note Security Considerations: 2e54. section\nbefore using 'shell=True'.\n",
            "subsections": []
        },
        "These options, along with all of the other options, are described in": {
            "content": "more detail in the *note Popen: 8c3. constructor documentation.\n\nFile: python3.12.info,  Node: Popen Constructor,  Next: Exceptions<9>,  Prev: Frequently Used Arguments,  Up: Using the subprocess Module\n\n5.17.6.3 Popen Constructor\n..........................\n",
            "subsections": []
        },
        "The underlying process creation and management in this module is handled": {
            "content": "by the *note Popen: 8c3. class.  It offers a lot of flexibility so that\ndevelopers are able to handle the less common cases not covered by the\nconvenience functions.\n\n-- Class: subprocess.Popen (args, bufsize=-1, executable=None,\nstdin=None, stdout=None, stderr=None, preexecfn=None,\nclosefds=True, shell=False, cwd=None, env=None,\nuniversalnewlines=None, startupinfo=None, creationflags=0,\nrestoresignals=True, startnewsession=False, passfds=(), *,\ngroup=None, extragroups=None, user=None, umask=-1,\nencoding=None, errors=None, text=None, pipesize=-1,\nprocessgroup=None)\n\nExecute a child program in a new process.  On POSIX, the class uses\n*note os.execvpe(): 28b7.-like behavior to execute the child\nprogram.  On Windows, the class uses the Windows 'CreateProcess()'\nfunction.  The arguments to *note Popen: 8c3. are as follows.\n\n'args' should be a sequence of program arguments or else a single\nstring or *note path-like object: 957.  By default, the program to\nexecute is the first item in 'args' if 'args' is a sequence.  If\n'args' is a string, the interpretation is platform-dependent and\ndescribed below.  See the 'shell' and 'executable' arguments for\nadditional differences from the default behavior.  Unless otherwise\nstated, it is recommended to pass 'args' as a sequence.\n\nWarning: For maximum reliability, use a fully qualified path\nfor the executable.  To search for an unqualified name on\n'PATH', use *note shutil.which(): 1d6.  On all platforms,\npassing *note sys.executable: 330. is the recommended way to\nlaunch the current Python interpreter again, and use the '-m'\ncommand-line format to launch an installed module.\n\nResolving the path of 'executable' (or the first item of\n'args') is platform dependent.  For POSIX, see *note\nos.execvpe(): 28b7, and note that when resolving or searching\nfor the executable path, 'cwd' overrides the current working\ndirectory and 'env' can override the 'PATH' environment\nvariable.  For Windows, see the documentation of the\n'lpApplicationName' and 'lpCommandLine' parameters of WinAPI\n'CreateProcess', and note that when resolving or searching for\nthe executable path with 'shell=False', 'cwd' does not\noverride the current working directory and 'env' cannot\noverride the 'PATH' environment variable.  Using a full path\navoids all of these variations.\n\nAn example of passing some arguments to an external program as a\nsequence is:\n\nPopen([\"/usr/bin/git\", \"commit\", \"-m\", \"Fixes a bug.\"])\n\nOn POSIX, if 'args' is a string, the string is interpreted as the\nname or path of the program to execute.  However, this can only be\ndone if not passing arguments to the program.\n\nNote: It may not be obvious how to break a shell command into\na sequence of arguments, especially in complex cases.  *note\nshlex.split(): 292. can illustrate how to determine the\ncorrect tokenization for 'args':\n\n>>> import shlex, subprocess\n>>> commandline = input()\n/bin/vikings -input eggs.txt -output \"spam spam.txt\" -cmd \"echo '$MONEY'\"\n>>> args = shlex.split(commandline)\n>>> print(args)\n['/bin/vikings', '-input', 'eggs.txt', '-output', 'spam spam.txt', '-cmd', \"echo '$MONEY'\"]\n>>> p = subprocess.Popen(args) # Success!\n\nNote in particular that options (such as '-input') and\narguments (such as 'eggs.txt') that are separated by\nwhitespace in the shell go in separate list elements, while\narguments that need quoting or backslash escaping when used in\nthe shell (such as filenames containing spaces or the 'echo'\ncommand shown above) are single list elements.\n\nOn Windows, if 'args' is a sequence, it will be converted to a\nstring in a manner described in *note Converting an argument\nsequence to a string on Windows: 2e56.  This is because the\nunderlying 'CreateProcess()' operates on strings.\n\nChanged in version 3.6: 'args' parameter accepts a *note path-like\nobject: 957. if 'shell' is 'False' and a sequence containing\npath-like objects on POSIX.\n\nChanged in version 3.8: 'args' parameter accepts a *note path-like\nobject: 957. if 'shell' is 'False' and a sequence containing bytes\nand path-like objects on Windows.\n\nThe 'shell' argument (which defaults to 'False') specifies whether\nto use the shell as the program to execute.  If 'shell' is 'True',\nit is recommended to pass 'args' as a string rather than as a\nsequence.\n\nOn POSIX with 'shell=True', the shell defaults to '/bin/sh'.  If\n'args' is a string, the string specifies the command to execute\nthrough the shell.  This means that the string must be formatted\nexactly as it would be when typed at the shell prompt.  This\nincludes, for example, quoting or backslash escaping filenames with\nspaces in them.  If 'args' is a sequence, the first item specifies\nthe command string, and any additional items will be treated as\nadditional arguments to the shell itself.  That is to say, *note\nPopen: 8c3. does the equivalent of:\n\nPopen(['/bin/sh', '-c', args[0], args[1], ...])\n\nOn Windows with 'shell=True', the 'COMSPEC' environment variable\nspecifies the default shell.  The only time you need to specify\n'shell=True' on Windows is when the command you wish to execute is\nbuilt into the shell (e.g.  'dir' or 'copy').  You do not need\n'shell=True' to run a batch file or console-based executable.\n\nNote: Read the *note Security Considerations: 2e54. section\nbefore using 'shell=True'.\n\n'bufsize' will be supplied as the corresponding argument to the\n*note open(): 26e. function when creating the stdin/stdout/stderr\npipe file objects:\n\n- '0' means unbuffered (read and write are one system call and\ncan return short)\n\n- '1' means line buffered (only usable if 'text=True' or\n'universalnewlines=True')\n\n- any other positive value means use a buffer of approximately\nthat size\n\n- negative bufsize (the default) means the system default of\nio.DEFAULTBUFFERSIZE will be used.\n\nChanged in version 3.3.1: 'bufsize' now defaults to -1 to enable\nbuffering by default to match the behavior that most code expects.\nIn versions prior to Python 3.2.4 and 3.3.1 it incorrectly\ndefaulted to '0' which was unbuffered and allowed short reads.\nThis was unintentional and did not match the behavior of Python 2\nas most code expected.\n\nThe 'executable' argument specifies a replacement program to\nexecute.  It is very seldom needed.  When 'shell=False',\n'executable' replaces the program to execute specified by 'args'.\nHowever, the original 'args' is still passed to the program.  Most\nprograms treat the program specified by 'args' as the command name,\nwhich can then be different from the program actually executed.  On\nPOSIX, the 'args' name becomes the display name for the executable\nin utilities such as 'ps'.  If 'shell=True', on POSIX the\n'executable' argument specifies a replacement shell for the default\n'/bin/sh'.\n\nChanged in version 3.6: 'executable' parameter accepts a *note\npath-like object: 957. on POSIX.\n\nChanged in version 3.8: 'executable' parameter accepts a bytes and\n*note path-like object: 957. on Windows.\n\nChanged in version 3.12: Changed Windows shell search order for\n'shell=True'.  The current directory and '%PATH%' are replaced with\n'%COMSPEC%' and '%SystemRoot%\\System32\\cmd.exe'.  As a result,\ndropping a malicious program named 'cmd.exe' into a current\ndirectory no longer works.\n\n'stdin', 'stdout' and 'stderr' specify the executed program's\nstandard input, standard output and standard error file handles,\nrespectively.  Valid values are 'None', *note PIPE: 9ca, *note\nDEVNULL: fc2, an existing file descriptor (a positive integer), and\nan existing *note file object: 1037. with a valid file descriptor.\nWith the default settings of 'None', no redirection will occur.\n*note PIPE: 9ca. indicates that a new pipe to the child should be\ncreated.  *note DEVNULL: fc2. indicates that the special file *note\nos.devnull: 17ad. will be used.  Additionally, 'stderr' can be\n*note STDOUT: 2e3c, which indicates that the stderr data from the\napplications should be captured into the same file handle as for\n'stdout'.\n\nIf 'preexecfn' is set to a callable object, this object will be\ncalled in the child process just before the child is executed.\n(POSIX only)\n\nWarning: The 'preexecfn' parameter is NOT SAFE to use in the\npresence of threads in your application.  The child process\ncould deadlock before exec is called.\n\nNote: If you need to modify the environment for the child use\nthe 'env' parameter rather than doing it in a 'preexecfn'.\nThe 'startnewsession' and 'processgroup' parameters should\ntake the place of code using 'preexecfn' to call *note\nos.setsid(): 1748. or *note os.setpgid(): 2818. in the child.\n\nChanged in version 3.8: The 'preexecfn' parameter is no longer\nsupported in subinterpreters.  The use of the parameter in a\nsubinterpreter raises *note RuntimeError: 17a.  The new restriction\nmay affect applications that are deployed in modwsgi, uWSGI, and\nother embedded environments.\n\nIf 'closefds' is true, all file descriptors except '0', '1' and\n'2' will be closed before the child process is executed.  Otherwise\nwhen 'closefds' is false, file descriptors obey their inheritable\nflag as described in *note Inheritance of File Descriptors: d60.\n\nOn Windows, if 'closefds' is true then no handles will be\ninherited by the child process unless explicitly passed in the\n'handlelist' element of *note STARTUPINFO.lpAttributeList: a54, or\nby standard handle redirection.\n\nChanged in version 3.2: The default for 'closefds' was changed\nfrom *note False: 971. to what is described above.\n\nChanged in version 3.7: On Windows the default for 'closefds' was\nchanged from *note False: 971. to *note True: a53. when redirecting\nthe standard handles.  It's now possible to set 'closefds' to\n*note True: a53. when redirecting the standard handles.\n\n'passfds' is an optional sequence of file descriptors to keep open\nbetween the parent and child.  Providing any 'passfds' forces\n'closefds' to be *note True: a53.  (POSIX only)\n\nChanged in version 3.2: The 'passfds' parameter was added.\n\nIf 'cwd' is not 'None', the function changes the working directory\nto 'cwd' before executing the child.  'cwd' can be a string, bytes\nor *note path-like: 957. object.  On POSIX, the function looks for\n'executable' (or for the first item in 'args') relative to 'cwd' if\nthe executable path is a relative path.\n\nChanged in version 3.6: 'cwd' parameter accepts a *note path-like\nobject: 957. on POSIX.\n\nChanged in version 3.7: 'cwd' parameter accepts a *note path-like\nobject: 957. on Windows.\n\nChanged in version 3.8: 'cwd' parameter accepts a bytes object on\nWindows.\n\nIf 'restoresignals' is true (the default) all signals that Python\nhas set to SIGIGN are restored to SIGDFL in the child process\nbefore the exec.  Currently this includes the SIGPIPE, SIGXFZ and\nSIGXFSZ signals.  (POSIX only)\n\nChanged in version 3.2: 'restoresignals' was added.\n\nIf 'startnewsession' is true the 'setsid()' system call will be\nmade in the child process prior to the execution of the subprocess.\n\n*note Availability: 1ad3.: POSIX\n\nChanged in version 3.2: 'startnewsession' was added.\n\nIf 'processgroup' is a non-negative integer, the 'setpgid(0,\nvalue)' system call will be made in the child process prior to the\nexecution of the subprocess.\n\n*note Availability: 1ad3.: POSIX\n\nChanged in version 3.11: 'processgroup' was added.\n\nIf 'group' is not 'None', the setregid() system call will be made\nin the child process prior to the execution of the subprocess.  If\nthe provided value is a string, it will be looked up via *note\ngrp.getgrnam(): 2e57. and the value in 'grgid' will be used.  If\nthe value is an integer, it will be passed verbatim.  (POSIX only)\n\n*note Availability: 1ad3.: POSIX\n\nNew in version 3.9.\n\nIf 'extragroups' is not 'None', the setgroups() system call will\nbe made in the child process prior to the execution of the\nsubprocess.  Strings provided in 'extragroups' will be looked up\nvia *note grp.getgrnam(): 2e57. and the values in 'grgid' will be\nused.  Integer values will be passed verbatim.  (POSIX only)\n\n*note Availability: 1ad3.: POSIX\n\nNew in version 3.9.\n\nIf 'user' is not 'None', the setreuid() system call will be made in\nthe child process prior to the execution of the subprocess.  If the\nprovided value is a string, it will be looked up via *note\npwd.getpwnam(): 2e58. and the value in 'pwuid' will be used.  If\nthe value is an integer, it will be passed verbatim.  (POSIX only)\n\n*note Availability: 1ad3.: POSIX\n\nNew in version 3.9.\n\nIf 'umask' is not negative, the umask() system call will be made in\nthe child process prior to the execution of the subprocess.\n\n*note Availability: 1ad3.: POSIX\n\nNew in version 3.9.\n\nIf 'env' is not 'None', it must be a mapping that defines the\nenvironment variables for the new process; these are used instead\nof the default behavior of inheriting the current process'\nenvironment.  This mapping can be str to str on any platform or\nbytes to bytes on POSIX platforms much like *note os.environ: 102e.\nor *note os.environb: 108b.\n\nNote: If specified, 'env' must provide any variables required\nfor the program to execute.  On Windows, in order to run a\nside-by-side assembly(1) the specified 'env' 'must' include a\nvalid 'SystemRoot'.\n\nIf 'encoding' or 'errors' are specified, or 'text' is true, the\nfile objects 'stdin', 'stdout' and 'stderr' are opened in text mode\nwith the specified 'encoding' and 'errors', as described above in\n*note Frequently Used Arguments: 2e3b.  The 'universalnewlines'\nargument is equivalent to 'text' and is provided for backwards\ncompatibility.  By default, file objects are opened in binary mode.\n\nNew in version 3.6: 'encoding' and 'errors' were added.\n\nNew in version 3.7: 'text' was added as a more readable alias for\n'universalnewlines'.\n\nIf given, 'startupinfo' will be a *note STARTUPINFO: 2e59. object,\nwhich is passed to the underlying 'CreateProcess' function.\n\nIf given, 'creationflags', can be one or more of the following\nflags:\n\n* *note CREATENEWCONSOLE: 2e5a.\n\n* *note CREATENEWPROCESSGROUP: 2e5b.\n\n* *note ABOVENORMALPRIORITYCLASS: 2e5c.\n\n* *note BELOWNORMALPRIORITYCLASS: 2e5d.\n\n* *note HIGHPRIORITYCLASS: 2e5e.\n\n* *note IDLEPRIORITYCLASS: 2e5f.\n\n* *note NORMALPRIORITYCLASS: 2e60.\n\n* *note REALTIMEPRIORITYCLASS: 2e61.\n\n* *note CREATENOWINDOW: 2e62.\n\n* *note DETACHEDPROCESS: 2e63.\n\n* *note CREATEDEFAULTERRORMODE: 2e64.\n\n* *note CREATEBREAKAWAYFROMJOB: 2e65.\n\n'pipesize' can be used to change the size of the pipe when *note\nPIPE: 9ca. is used for 'stdin', 'stdout' or 'stderr'.  The size of\nthe pipe is only changed on platforms that support this (only Linux\nat this time of writing).  Other platforms will ignore this\nparameter.\n\nChanged in version 3.10: Added the 'pipesize' parameter.\n\nPopen objects are supported as context managers via the *note with:\n396. statement: on exit, standard file descriptors are closed, and\nthe process is waited for.\n\nwith Popen([\"ifconfig\"], stdout=PIPE) as proc:\nlog.write(proc.stdout.read())\n\nPopen and the other functions in this module that use it raise an\n*note auditing event: 161d. 'subprocess.Popen' with arguments\n'executable', 'args', 'cwd', and 'env'.  The value for 'args' may\nbe a single string or a list of strings, depending on platform.\n\nChanged in version 3.2: Added context manager support.\n\nChanged in version 3.6: Popen destructor now emits a *note\nResourceWarning: a86. warning if the child process is still\nrunning.\n\nChanged in version 3.8: Popen can use *note os.posixspawn(): 885.\nin some cases for better performance.  On Windows Subsystem for\nLinux and QEMU User Emulation, Popen constructor using *note\nos.posixspawn(): 885. no longer raise an exception on errors like\nmissing program, but the child process fails with a non-zero *note\nreturncode: 1716.\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Side-by-SideAssembly\n\nFile: python3.12.info,  Node: Exceptions<9>,  Prev: Popen Constructor,  Up: Using the subprocess Module\n\n5.17.6.4 Exceptions\n...................\n",
            "subsections": []
        },
        "Exceptions raised in the child process, before the new program has": {
            "content": "started to execute, will be re-raised in the parent.\n\nThe most common exception raised is *note OSError: 613.  This occurs,\nfor example, when trying to execute a non-existent file.  Applications\nshould prepare for *note OSError: 613. exceptions.  Note that, when\n'shell=True', *note OSError: 613. will be raised by the child only if\nthe selected shell itself was not found.  To determine if the shell\nfailed to find the requested application, it is necessary to check the\nreturn code or output from the subprocess.\n\nA *note ValueError: 183. will be raised if *note Popen: 8c3. is called\nwith invalid arguments.\n\n*note checkcall(): 2e4a. and *note checkoutput(): e31. will raise\n*note CalledProcessError: 119c. if the called process returns a non-zero\nreturn code.\n",
            "subsections": []
        },
        "All of the functions and methods that accept a 'timeout' parameter, such": {
            "content": "as *note run(): 9c9. and *note Popen.communicate(): 2e3d. will raise\n*note TimeoutExpired: 2e3e. if the timeout expires before the process\nexits.\n\nExceptions defined in this module all inherit from *note\nSubprocessError: 2e44.\n\nNew in version 3.3: The *note SubprocessError: 2e44. base class was\nadded.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Security Considerations,  Next: Popen Objects,  Prev: Using the subprocess Module,  Up: subprocess -- Subprocess management": {
            "content": "5.17.6.5 Security Considerations\n................................\n",
            "subsections": []
        },
        "Unlike some other popen functions, this implementation will never": {
            "content": "implicitly call a system shell.  This means that all characters,\nincluding shell metacharacters, can safely be passed to child processes.\nIf the shell is invoked explicitly, via 'shell=True', it is the\napplication's responsibility to ensure that all whitespace and\nmetacharacters are quoted appropriately to avoid shell injection(1)\nvulnerabilities.  On *note some platforms: 2e68, it is possible to use\n*note shlex.quote(): f9c. for this escaping.\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Shellinjection#Shellinjection\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Popen Objects,  Next: Windows Popen Helpers,  Prev: Security Considerations,  Up: subprocess -- Subprocess management": {
            "content": "5.17.6.6 Popen Objects\n......................\n\nInstances of the *note Popen: 8c3. class have the following methods:\n\n-- Method: Popen.poll ()\n\nCheck if child process has terminated.  Set and return *note\nreturncode: 1716. attribute.  Otherwise, returns 'None'.\n\n-- Method: Popen.wait (timeout=None)\n\nWait for child process to terminate.  Set and return *note\nreturncode: 1716. attribute.\n\nIf the process does not terminate after 'timeout' seconds, raise a\n*note TimeoutExpired: 2e3e. exception.  It is safe to catch this\nexception and retry the wait.\n\nNote: This will deadlock when using 'stdout=PIPE' or\n'stderr=PIPE' and the child process generates enough output to\na pipe such that it blocks waiting for the OS pipe buffer to\naccept more data.  Use *note Popen.communicate(): 2e3d. when\nusing pipes to avoid that.\n\nNote: When the 'timeout' parameter is not 'None', then (on\nPOSIX) the function is implemented using a busy loop\n(non-blocking call and short sleeps).  Use the *note asyncio:\n9. module for an asynchronous wait: see *note\nasyncio.createsubprocessexec: 8a5.\n\nChanged in version 3.3: 'timeout' was added.\n\n-- Method: Popen.communicate (input=None, timeout=None)\n\nInteract with process: Send data to stdin.  Read data from stdout\nand stderr, until end-of-file is reached.  Wait for process to\nterminate and set the *note returncode: 1716. attribute.  The\noptional 'input' argument should be data to be sent to the child\nprocess, or 'None', if no data should be sent to the child.  If\nstreams were opened in text mode, 'input' must be a string.\nOtherwise, it must be bytes.\n\n*note communicate(): 2e3d. returns a tuple '(stdoutdata,\nstderrdata)'.  The data will be strings if streams were opened in\ntext mode; otherwise, bytes.\n\nNote that if you want to send data to the process's stdin, you need\nto create the Popen object with 'stdin=PIPE'.  Similarly, to get\nanything other than 'None' in the result tuple, you need to give\n'stdout=PIPE' and/or 'stderr=PIPE' too.\n\nIf the process does not terminate after 'timeout' seconds, a *note\nTimeoutExpired: 2e3e. exception will be raised.  Catching this\nexception and retrying communication will not lose any output.\n\nThe child process is not killed if the timeout expires, so in order\nto cleanup properly a well-behaved application should kill the\nchild process and finish communication:\n\nproc = subprocess.Popen(...)\ntry:\nouts, errs = proc.communicate(timeout=15)\nexcept TimeoutExpired:\nproc.kill()\nouts, errs = proc.communicate()\n\nNote: The data read is buffered in memory, so do not use this\nmethod if the data size is large or unlimited.\n\nChanged in version 3.3: 'timeout' was added.\n\n-- Method: Popen.sendsignal (signal)\n\nSends the signal 'signal' to the child.\n\nDo nothing if the process completed.\n\nNote: On Windows, SIGTERM is an alias for *note terminate():\n1231.  CTRLCEVENT and CTRLBREAKEVENT can be sent to\nprocesses started with a 'creationflags' parameter which\nincludes 'CREATENEWPROCESSGROUP'.\n\n-- Method: Popen.terminate ()\n\nStop the child.  On POSIX OSs the method sends *note SIGTERM: 1234.\nto the child.  On Windows the Win32 API function\n'TerminateProcess()' is called to stop the child.\n\n-- Method: Popen.kill ()\n\nKills the child.  On POSIX OSs the function sends SIGKILL to the\nchild.  On Windows *note kill(): 1232. is an alias for *note\nterminate(): 1231.\n\nThe following attributes are also set by the class for you to access.\nReassigning them to new values is unsupported:\n\n-- Attribute: Popen.args\n\nThe 'args' argument as it was passed to *note Popen: 8c3. - a\nsequence of program arguments or else a single string.\n\nNew in version 3.3.\n\n-- Attribute: Popen.stdin\n\nIf the 'stdin' argument was *note PIPE: 9ca, this attribute is a\nwriteable stream object as returned by *note open(): 26e.  If the\n'encoding' or 'errors' arguments were specified or the 'text' or\n'universalnewlines' argument was 'True', the stream is a text\nstream, otherwise it is a byte stream.  If the 'stdin' argument was\nnot *note PIPE: 9ca, this attribute is 'None'.\n\n-- Attribute: Popen.stdout\n\nIf the 'stdout' argument was *note PIPE: 9ca, this attribute is a\nreadable stream object as returned by *note open(): 26e.  Reading\nfrom the stream provides output from the child process.  If the\n'encoding' or 'errors' arguments were specified or the 'text' or\n'universalnewlines' argument was 'True', the stream is a text\nstream, otherwise it is a byte stream.  If the 'stdout' argument\nwas not *note PIPE: 9ca, this attribute is 'None'.\n\n-- Attribute: Popen.stderr\n\nIf the 'stderr' argument was *note PIPE: 9ca, this attribute is a\nreadable stream object as returned by *note open(): 26e.  Reading\nfrom the stream provides error output from the child process.  If\nthe 'encoding' or 'errors' arguments were specified or the 'text'\nor 'universalnewlines' argument was 'True', the stream is a text\nstream, otherwise it is a byte stream.  If the 'stderr' argument\nwas not *note PIPE: 9ca, this attribute is 'None'.\n\nWarning: Use *note communicate(): 2e3d. rather than *note\n.stdin.write: 2e51, *note .stdout.read: 2e52. or *note\n.stderr.read: 2e53. to avoid deadlocks due to any of the other OS\npipe buffers filling up and blocking the child process.\n\n-- Attribute: Popen.pid\n\nThe process ID of the child process.\n\nNote that if you set the 'shell' argument to 'True', this is the\nprocess ID of the spawned shell.\n\n-- Attribute: Popen.returncode\n\nThe child return code.  Initially 'None', *note returncode: 1716.\nis set by a call to the *note poll(): 2e6a, *note wait(): b33, or\n*note communicate(): 2e3d. methods if they detect that the process\nhas terminated.\n\nA 'None' value indicates that the process hadn't yet terminated at\nthe time of the last method call.\n\nA negative value '-N' indicates that the child was terminated by\nsignal 'N' (POSIX only).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Windows Popen Helpers,  Next: Older high-level API,  Prev: Popen Objects,  Up: subprocess -- Subprocess management": {
            "content": "5.17.6.7 Windows Popen Helpers\n..............................\n\nThe *note STARTUPINFO: 2e59. class and following constants are only\navailable on Windows.\n\n-- Class: subprocess.STARTUPINFO (*, dwFlags=0, hStdInput=None,\nhStdOutput=None, hStdError=None, wShowWindow=0,\nlpAttributeList=None)\n\nPartial support of the Windows STARTUPINFO(1) structure is used for\n*note Popen: 8c3. creation.  The following attributes can be set by\npassing them as keyword-only arguments.\n\nChanged in version 3.7: Keyword-only argument support was added.\n\n-- Attribute: dwFlags\n\nA bit field that determines whether certain *note STARTUPINFO:\n2e59. attributes are used when the process creates a window.\n\nsi = subprocess.STARTUPINFO()\nsi.dwFlags = subprocess.STARTFUSESTDHANDLES | subprocess.STARTFUSESHOWWINDOW\n\n-- Attribute: hStdInput\n\nIf *note dwFlags: 2e6e. specifies *note STARTFUSESTDHANDLES:\n2e70, this attribute is the standard input handle for the\nprocess.  If *note STARTFUSESTDHANDLES: 2e70. is not\nspecified, the default for standard input is the keyboard\nbuffer.\n\n-- Attribute: hStdOutput\n\nIf *note dwFlags: 2e6e. specifies *note STARTFUSESTDHANDLES:\n2e70, this attribute is the standard output handle for the\nprocess.  Otherwise, this attribute is ignored and the default\nfor standard output is the console window's buffer.\n\n-- Attribute: hStdError\n\nIf *note dwFlags: 2e6e. specifies *note STARTFUSESTDHANDLES:\n2e70, this attribute is the standard error handle for the\nprocess.  Otherwise, this attribute is ignored and the default\nfor standard error is the console window's buffer.\n\n-- Attribute: wShowWindow\n\nIf *note dwFlags: 2e6e. specifies *note STARTFUSESHOWWINDOW:\n2e74, this attribute can be any of the values that can be\nspecified in the 'nCmdShow' parameter for the ShowWindow(2)\nfunction, except for 'SWSHOWDEFAULT'.  Otherwise, this\nattribute is ignored.\n\n*note SWHIDE: 2e75. is provided for this attribute.  It is\nused when *note Popen: 8c3. is called with 'shell=True'.\n\n-- Attribute: lpAttributeList\n\nA dictionary of additional attributes for process creation as\ngiven in 'STARTUPINFOEX', see UpdateProcThreadAttribute(3).\n\nSupported attributes:\n\n'handlelist'\n\nSequence of handles that will be inherited.  'closefds'\nmust be true if non-empty.\n\nThe handles must be temporarily made inheritable by *note\nos.sethandleinheritable(): d64. when passed to the\n*note Popen: 8c3. constructor, else *note OSError: 613.\nwill be raised with Windows error\n'ERRORINVALIDPARAMETER' (87).\n\nWarning: In a multithreaded process, use caution to\navoid leaking handles that are marked inheritable\nwhen combining this feature with concurrent calls to\nother process creation functions that inherit all\nhandles such as *note os.system(): 12b2.  This also\napplies to standard handle redirection, which\ntemporarily creates inheritable handles.\n\nNew in version 3.7.\n\n* Menu:\n\n* Windows Constants::\n\n---------- Footnotes ----------\n\n(1) https://msdn.microsoft.com/en-us/library/ms686331(v=vs.85).aspx\n\n(2) https://msdn.microsoft.com/en-us/library/ms633548(v=vs.85).aspx\n\n(3)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/ms686880(v=vs.85).aspx\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Windows Constants,  Up: Windows Popen Helpers": {
            "content": "5.17.6.8 Windows Constants\n..........................\n\nThe *note subprocess: d0. module exposes the following constants.\n\n-- Data: subprocess.STDINPUTHANDLE\n\nThe standard input device.  Initially, this is the console input\nbuffer, 'CONIN$'.\n\n-- Data: subprocess.STDOUTPUTHANDLE\n\nThe standard output device.  Initially, this is the active console\nscreen buffer, 'CONOUT$'.\n\n-- Data: subprocess.STDERRORHANDLE\n\nThe standard error device.  Initially, this is the active console\nscreen buffer, 'CONOUT$'.\n\n-- Data: subprocess.SWHIDE\n\nHides the window.  Another window will be activated.\n\n-- Data: subprocess.STARTFUSESTDHANDLES\n\nSpecifies that the *note STARTUPINFO.hStdInput: 2e6f, *note\nSTARTUPINFO.hStdOutput: 2e71, and *note STARTUPINFO.hStdError:\n2e72. attributes contain additional information.\n\n-- Data: subprocess.STARTFUSESHOWWINDOW\n\nSpecifies that the *note STARTUPINFO.wShowWindow: 2e73. attribute\ncontains additional information.\n\n-- Data: subprocess.CREATENEWCONSOLE\n\nThe new process has a new console, instead of inheriting its\nparent's console (the default).\n\n-- Data: subprocess.CREATENEWPROCESSGROUP\n\nA *note Popen: 8c3. 'creationflags' parameter to specify that a new\nprocess group will be created.  This flag is necessary for using\n*note os.kill(): 11db. on the subprocess.\n\nThis flag is ignored if *note CREATENEWCONSOLE: 2e5a. is\nspecified.\n\n-- Data: subprocess.ABOVENORMALPRIORITYCLASS\n\nA *note Popen: 8c3. 'creationflags' parameter to specify that a new\nprocess will have an above average priority.\n\nNew in version 3.7.\n\n-- Data: subprocess.BELOWNORMALPRIORITYCLASS\n\nA *note Popen: 8c3. 'creationflags' parameter to specify that a new\nprocess will have a below average priority.\n\nNew in version 3.7.\n\n-- Data: subprocess.HIGHPRIORITYCLASS\n\nA *note Popen: 8c3. 'creationflags' parameter to specify that a new\nprocess will have a high priority.\n\nNew in version 3.7.\n\n-- Data: subprocess.IDLEPRIORITYCLASS\n\nA *note Popen: 8c3. 'creationflags' parameter to specify that a new\nprocess will have an idle (lowest) priority.\n\nNew in version 3.7.\n\n-- Data: subprocess.NORMALPRIORITYCLASS\n\nA *note Popen: 8c3. 'creationflags' parameter to specify that a new\nprocess will have an normal priority.  (default)\n\nNew in version 3.7.\n\n-- Data: subprocess.REALTIMEPRIORITYCLASS\n\nA *note Popen: 8c3. 'creationflags' parameter to specify that a new\nprocess will have realtime priority.  You should almost never use\nREALTIMEPRIORITYCLASS, because this interrupts system threads\nthat manage mouse input, keyboard input, and background disk\nflushing.  This class can be appropriate for applications that\n\"talk\" directly to hardware or that perform brief tasks that should\nhave limited interruptions.\n\nNew in version 3.7.\n\n-- Data: subprocess.CREATENOWINDOW\n\nA *note Popen: 8c3. 'creationflags' parameter to specify that a new\nprocess will not create a window.\n\nNew in version 3.7.\n\n-- Data: subprocess.DETACHEDPROCESS\n\nA *note Popen: 8c3. 'creationflags' parameter to specify that a new\nprocess will not inherit its parent's console.  This value cannot\nbe used with CREATENEWCONSOLE.\n\nNew in version 3.7.\n\n-- Data: subprocess.CREATEDEFAULTERRORMODE\n\nA *note Popen: 8c3. 'creationflags' parameter to specify that a new\nprocess does not inherit the error mode of the calling process.\nInstead, the new process gets the default error mode.  This feature\nis particularly useful for multithreaded shell applications that\nrun with hard errors disabled.\n\nNew in version 3.7.\n\n-- Data: subprocess.CREATEBREAKAWAYFROMJOB\n\nA *note Popen: 8c3. 'creationflags' parameter to specify that a new\nprocess is not associated with the job.\n\nNew in version 3.7.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Older high-level API,  Next: Replacing Older Functions with the subprocess Module,  Prev: Windows Popen Helpers,  Up: subprocess -- Subprocess management": {
            "content": "5.17.6.9 Older high-level API\n.............................\n",
            "subsections": []
        },
        "Prior to Python 3.5, these three functions comprised the high level API": {
            "content": "to subprocess.  You can now use *note run(): 9c9. in many cases, but\nlots of existing code calls these functions.\n\n-- Function: subprocess.call (args, *, stdin=None, stdout=None,\nstderr=None, shell=False, cwd=None, timeout=None,\notherpopenkwargs)\n\nRun the command described by 'args'.  Wait for command to complete,\nthen return the *note returncode: 1716. attribute.\n\nCode needing to capture stdout or stderr should use *note run():\n9c9. instead:\n\nrun(...).returncode\n\nTo suppress stdout or stderr, supply a value of *note DEVNULL: fc2.\n\nThe arguments shown above are merely some common ones.  The full\nfunction signature is the same as that of the *note Popen: 8c3.\nconstructor - this function passes all supplied arguments other\nthan 'timeout' directly through to that interface.\n\nNote: Do not use 'stdout=PIPE' or 'stderr=PIPE' with this\nfunction.  The child process will block if it generates enough\noutput to a pipe to fill up the OS pipe buffer as the pipes\nare not being read from.\n\nChanged in version 3.3: 'timeout' was added.\n\nChanged in version 3.12: Changed Windows shell search order for\n'shell=True'.  The current directory and '%PATH%' are replaced with\n'%COMSPEC%' and '%SystemRoot%\\System32\\cmd.exe'.  As a result,\ndropping a malicious program named 'cmd.exe' into a current\ndirectory no longer works.\n\n-- Function: subprocess.checkcall (args, *, stdin=None, stdout=None,\nstderr=None, shell=False, cwd=None, timeout=None,\notherpopenkwargs)\n\nRun command with arguments.  Wait for command to complete.  If the\nreturn code was zero then return, otherwise raise *note\nCalledProcessError: 119c.  The *note CalledProcessError: 119c.\nobject will have the return code in the *note returncode: 2e4b.\nattribute.  If *note checkcall(): 2e4a. was unable to start the\nprocess it will propagate the exception that was raised.\n\nCode needing to capture stdout or stderr should use *note run():\n9c9. instead:\n\nrun(..., check=True)\n\nTo suppress stdout or stderr, supply a value of *note DEVNULL: fc2.\n\nThe arguments shown above are merely some common ones.  The full\nfunction signature is the same as that of the *note Popen: 8c3.\nconstructor - this function passes all supplied arguments other\nthan 'timeout' directly through to that interface.\n\nNote: Do not use 'stdout=PIPE' or 'stderr=PIPE' with this\nfunction.  The child process will block if it generates enough\noutput to a pipe to fill up the OS pipe buffer as the pipes\nare not being read from.\n\nChanged in version 3.3: 'timeout' was added.\n\nChanged in version 3.12: Changed Windows shell search order for\n'shell=True'.  The current directory and '%PATH%' are replaced with\n'%COMSPEC%' and '%SystemRoot%\\System32\\cmd.exe'.  As a result,\ndropping a malicious program named 'cmd.exe' into a current\ndirectory no longer works.\n\n-- Function: subprocess.checkoutput (args, *, stdin=None, stderr=None,\nshell=False, cwd=None, encoding=None, errors=None,\nuniversalnewlines=None, timeout=None, text=None,\notherpopenkwargs)\n\nRun command with arguments and return its output.\n\nIf the return code was non-zero it raises a *note\nCalledProcessError: 119c.  The *note CalledProcessError: 119c.\nobject will have the return code in the *note returncode: 2e4b.\nattribute and any output in the *note output: 2e4d. attribute.\n\nThis is equivalent to:\n\nrun(..., check=True, stdout=PIPE).stdout\n\nThe arguments shown above are merely some common ones.  The full\nfunction signature is largely the same as that of *note run(): 9c9.\n- most arguments are passed directly through to that interface.\nOne API deviation from *note run(): 9c9. behavior exists: passing\n'input=None' will behave the same as 'input=b''' (or 'input=''',\ndepending on other arguments) rather than using the parent's\nstandard input file handle.\n\nBy default, this function will return the data as encoded bytes.\nThe actual encoding of the output data may depend on the command\nbeing invoked, so the decoding to text will often need to be\nhandled at the application level.\n\nThis behaviour may be overridden by setting 'text', 'encoding',\n'errors', or 'universalnewlines' to 'True' as described in *note\nFrequently Used Arguments: 2e3b. and *note run(): 9c9.\n\nTo also capture standard error in the result, use\n'stderr=subprocess.STDOUT':\n\n>>> subprocess.checkoutput(\n...     \"ls nonexistentfile; exit 0\",\n...     stderr=subprocess.STDOUT,\n...     shell=True)\n'ls: nonexistentfile: No such file or directory\\n'\n\nNew in version 3.1.\n\nChanged in version 3.3: 'timeout' was added.\n\nChanged in version 3.4: Support for the 'input' keyword argument\nwas added.\n\nChanged in version 3.6: 'encoding' and 'errors' were added.  See\n*note run(): 9c9. for details.\n\nNew in version 3.7: 'text' was added as a more readable alias for\n'universalnewlines'.\n\nChanged in version 3.12: Changed Windows shell search order for\n'shell=True'.  The current directory and '%PATH%' are replaced with\n'%COMSPEC%' and '%SystemRoot%\\System32\\cmd.exe'.  As a result,\ndropping a malicious program named 'cmd.exe' into a current\ndirectory no longer works.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Replacing Older Functions with the subprocess Module,  Next: Legacy Shell Invocation Functions,  Prev: Older high-level API,  Up: subprocess -- Subprocess management": {
            "content": "5.17.6.10 Replacing Older Functions with the 'subprocess' Module\n................................................................\n\nIn this section, \"a becomes b\" means that b can be used as a replacement\nfor a.\n\nNote: All \"a\" functions in this section fail (more or less)\nsilently if the executed program cannot be found; the \"b\"\nreplacements raise *note OSError: 613. instead.\n\nIn addition, the replacements using *note checkoutput(): e31. will\nfail with a *note CalledProcessError: 119c. if the requested\noperation produces a non-zero return code.  The output is still\navailable as the *note output: 2e4d. attribute of the raised\nexception.\n",
            "subsections": []
        },
        "In the following examples, we assume that the relevant functions have": {
            "content": "already been imported from the *note subprocess: d0. module.\n\n* Menu:\n\n* Replacing /bin/sh shell command substitution::\n* Replacing shell pipeline::\n* Replacing os.system(): Replacing os system.\n* Replacing the os.spawn family: Replacing the os spawn family.\n* Replacing os.popen(), os.popen2(), os.popen3(): Replacing os popen os popen2 os popen3.\n* Replacing functions from the popen2 module::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Replacing /bin/sh shell command substitution,  Next: Replacing shell pipeline,  Up: Replacing Older Functions with the subprocess Module": {
            "content": "5.17.6.11 Replacing '/bin/sh' shell command substitution\n........................................................\n\noutput=$(mycmd myarg)\n\nbecomes:\n\noutput = checkoutput([\"mycmd\", \"myarg\"])\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Replacing shell pipeline,  Next: Replacing os system,  Prev: Replacing /bin/sh shell command substitution,  Up: Replacing Older Functions with the subprocess Module": {
            "content": "5.17.6.12 Replacing shell pipeline\n..................................\n\noutput=$(dmesg | grep hda)\n\nbecomes:\n\np1 = Popen([\"dmesg\"], stdout=PIPE)\np2 = Popen([\"grep\", \"hda\"], stdin=p1.stdout, stdout=PIPE)\np1.stdout.close()  # Allow p1 to receive a SIGPIPE if p2 exits.\noutput = p2.communicate()[0]\n",
            "subsections": []
        },
        "The 'p1.stdout.close()' call after starting the p2 is important in order": {
            "content": "for p1 to receive a SIGPIPE if p2 exits before p1.\n",
            "subsections": []
        },
        "Alternatively, for trusted input, the shell's own pipeline support may": {
            "content": "still be used directly:\n\noutput=$(dmesg | grep hda)\n\nbecomes:\n\noutput = checkoutput(\"dmesg | grep hda\", shell=True)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Replacing os system,  Next: Replacing the os spawn family,  Prev: Replacing shell pipeline,  Up: Replacing Older Functions with the subprocess Module": {
            "content": "5.17.6.13 Replacing 'os.system()'\n.................................\n\nsts = os.system(\"mycmd\" + \" myarg\")\n# becomes\nretcode = call(\"mycmd\" + \" myarg\", shell=True)\n\nNotes:\n\n* Calling the program through the shell is usually not required.\n\n* The *note call(): 9cb. return value is encoded differently to that\nof *note os.system(): 12b2.\n\n* The *note os.system(): 12b2. function ignores SIGINT and SIGQUIT\nsignals while the command is running, but the caller must do this\nseparately when using the *note subprocess: d0. module.\n\nA more realistic example would look like this:\n\ntry:\nretcode = call(\"mycmd\" + \" myarg\", shell=True)\nif retcode < 0:\nprint(\"Child was terminated by signal\", -retcode, file=sys.stderr)\nelse:\nprint(\"Child returned\", retcode, file=sys.stderr)\nexcept OSError as e:\nprint(\"Execution failed:\", e, file=sys.stderr)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Replacing the os spawn family,  Next: Replacing os popen os popen2 os popen3,  Prev: Replacing os system,  Up: Replacing Older Functions with the subprocess Module": {
            "content": "5.17.6.14 Replacing the 'os.spawn' family\n.........................................\n\nPNOWAIT example:\n\npid = os.spawnlp(os.PNOWAIT, \"/bin/mycmd\", \"mycmd\", \"myarg\")\n==>\npid = Popen([\"/bin/mycmd\", \"myarg\"]).pid\n\nPWAIT example:\n\nretcode = os.spawnlp(os.PWAIT, \"/bin/mycmd\", \"mycmd\", \"myarg\")\n==>\nretcode = call([\"/bin/mycmd\", \"myarg\"])\n\nVector example:\n\nos.spawnvp(os.PNOWAIT, path, args)\n==>\nPopen([path] + args[1:])\n\nEnvironment example:\n\nos.spawnlpe(os.PNOWAIT, \"/bin/mycmd\", \"mycmd\", \"myarg\", env)\n==>\nPopen([\"/bin/mycmd\", \"myarg\"], env={\"PATH\": \"/usr/bin\"})\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Replacing os popen os popen2 os popen3,  Next: Replacing functions from the popen2 module,  Prev: Replacing the os spawn family,  Up: Replacing Older Functions with the subprocess Module": {
            "content": "5.17.6.15 Replacing 'os.popen()', 'os.popen2()', 'os.popen3()'\n..............................................................\n\n(childstdin, childstdout) = os.popen2(cmd, mode, bufsize)\n==>\np = Popen(cmd, shell=True, bufsize=bufsize,\nstdin=PIPE, stdout=PIPE, closefds=True)\n(childstdin, childstdout) = (p.stdin, p.stdout)\n\n(childstdin,\nchildstdout,\nchildstderr) = os.popen3(cmd, mode, bufsize)\n==>\np = Popen(cmd, shell=True, bufsize=bufsize,\nstdin=PIPE, stdout=PIPE, stderr=PIPE, closefds=True)\n(childstdin,\nchildstdout,\nchildstderr) = (p.stdin, p.stdout, p.stderr)\n\n(childstdin, childstdoutandstderr) = os.popen4(cmd, mode, bufsize)\n==>\np = Popen(cmd, shell=True, bufsize=bufsize,\nstdin=PIPE, stdout=PIPE, stderr=STDOUT, closefds=True)\n(childstdin, childstdoutandstderr) = (p.stdin, p.stdout)\n\nReturn code handling translates as follows:\n\npipe = os.popen(cmd, 'w')\n...\nrc = pipe.close()\nif rc is not None and rc >> 8:\nprint(\"There were some errors\")\n==>\nprocess = Popen(cmd, stdin=PIPE)\n...\nprocess.stdin.close()\nif process.wait() != 0:\nprint(\"There were some errors\")\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Replacing functions from the popen2 module,  Prev: Replacing os popen os popen2 os popen3,  Up: Replacing Older Functions with the subprocess Module": {
            "content": "5.17.6.16 Replacing functions from the 'popen2' module\n......................................................\n\nNote: If the cmd argument to popen2 functions is a string, the\ncommand is executed through /bin/sh.  If it is a list, the command\nis directly executed.\n\n(childstdout, childstdin) = popen2.popen2(\"somestring\", bufsize, mode)\n==>\np = Popen(\"somestring\", shell=True, bufsize=bufsize,\nstdin=PIPE, stdout=PIPE, closefds=True)\n(childstdout, childstdin) = (p.stdout, p.stdin)\n\n(childstdout, childstdin) = popen2.popen2([\"mycmd\", \"myarg\"], bufsize, mode)\n==>\np = Popen([\"mycmd\", \"myarg\"], bufsize=bufsize,\nstdin=PIPE, stdout=PIPE, closefds=True)\n(childstdout, childstdin) = (p.stdout, p.stdin)\n\n'popen2.Popen3' and 'popen2.Popen4' basically work as *note\nsubprocess.Popen: 8c3, except that:\n\n* *note Popen: 8c3. raises an exception if the execution fails.\n\n* The 'capturestderr' argument is replaced with the 'stderr'\nargument.\n\n* 'stdin=PIPE' and 'stdout=PIPE' must be specified.\n\n* popen2 closes all file descriptors by default, but you have to\nspecify 'closefds=True' with *note Popen: 8c3. to guarantee this\nbehavior on all platforms or past Python versions.\n\nFile: python3.12.info,  Node: Legacy Shell Invocation Functions,  Next: Notes<2>,  Prev: Replacing Older Functions with the subprocess Module,  Up: subprocess -- Subprocess management\n\n5.17.6.17 Legacy Shell Invocation Functions\n...........................................\n",
            "subsections": []
        },
        "This module also provides the following legacy functions from the 2.x": {
            "content": "'commands' module.  These operations implicitly invoke the system shell\nand none of the guarantees described above regarding security and\nexception handling consistency are valid for these functions.\n\n-- Function: subprocess.getstatusoutput (cmd, *, encoding=None,\nerrors=None)\n\nReturn '(exitcode, output)' of executing 'cmd' in a shell.\n\nExecute the string 'cmd' in a shell with 'Popen.checkoutput()' and\nreturn a 2-tuple '(exitcode, output)'.  'encoding' and 'errors' are\nused to decode output; see the notes on *note Frequently Used\nArguments: 2e3b. for more details.\n\nA trailing newline is stripped from the output.  The exit code for\nthe command can be interpreted as the return code of subprocess.\nExample:\n\n>>> subprocess.getstatusoutput('ls /bin/ls')\n(0, '/bin/ls')\n>>> subprocess.getstatusoutput('cat /bin/junk')\n(1, 'cat: /bin/junk: No such file or directory')\n>>> subprocess.getstatusoutput('/bin/junk')\n(127, 'sh: /bin/junk: not found')\n>>> subprocess.getstatusoutput('/bin/kill $$')\n(-15, '')\n\n*note Availability: 1ad3.: Unix, Windows.\n\nChanged in version 3.3.4: Windows support was added.\n\nThe function now returns (exitcode, output) instead of (status,\noutput) as it did in Python 3.3.3 and earlier.  exitcode has the\nsame value as *note returncode: 1716.\n\nChanged in version 3.11: Added the 'encoding' and 'errors'\nparameters.\n\n-- Function: subprocess.getoutput (cmd, *, encoding=None, errors=None)\n\nReturn output (stdout and stderr) of executing 'cmd' in a shell.\n\nLike *note getstatusoutput(): e32, except the exit code is ignored\nand the return value is a string containing the command's output.\nExample:\n\n>>> subprocess.getoutput('ls /bin/ls')\n'/bin/ls'\n\n*note Availability: 1ad3.: Unix, Windows.\n\nChanged in version 3.3.4: Windows support added\n\nChanged in version 3.11: Added the 'encoding' and 'errors'\nparameters.\n\nFile: python3.12.info,  Node: Notes<2>,  Prev: Legacy Shell Invocation Functions,  Up: subprocess -- Subprocess management\n\n5.17.6.18 Notes\n...............\n\n* Menu:\n\n* Converting an argument sequence to a string on Windows::\n* Disabling use of vfork() or posixspawn(): Disabling use of vfork or posixspawn.\n\nFile: python3.12.info,  Node: Converting an argument sequence to a string on Windows,  Next: Disabling use of vfork or posixspawn,  Up: Notes<2>\n\n5.17.6.19 Converting an argument sequence to a string on Windows\n................................................................\n",
            "subsections": []
        },
        "On Windows, an 'args' sequence is converted to a string that can be": {
            "content": "parsed using the following rules (which correspond to the rules used by\nthe MS C runtime):\n\n1. Arguments are delimited by white space, which is either a space or\na tab.\n\n2. A string surrounded by double quotation marks is interpreted as a\nsingle argument, regardless of white space contained within.  A\nquoted string can be embedded in an argument.\n\n3. A double quotation mark preceded by a backslash is interpreted as a\nliteral double quotation mark.\n\n4. Backslashes are interpreted literally, unless they immediately\nprecede a double quotation mark.\n\n5. If backslashes immediately precede a double quotation mark, every\npair of backslashes is interpreted as a literal backslash.  If the\nnumber of backslashes is odd, the last backslash escapes the next\ndouble quotation mark as described in rule 3.\n\nSee also\n........\n\n*note shlex: bf.\n\nModule which provides function to parse and escape command lines.\n\nFile: python3.12.info,  Node: Disabling use of vfork or posixspawn,  Prev: Converting an argument sequence to a string on Windows,  Up: Notes<2>\n\n5.17.6.20 Disabling use of 'vfork()' or 'posixspawn()'\n.......................................................\n\nOn Linux, *note subprocess: d0. defaults to using the 'vfork()' system\ncall internally when it is safe to do so rather than 'fork()'.  This\ngreatly improves performance.\n",
            "subsections": []
        },
        "If you ever encounter a presumed highly unusual situation where you need": {
            "content": "to prevent 'vfork()' from being used by Python, you can set the\n'subprocess.USEVFORK' attribute to a false value.\n\nsubprocess.USEVFORK = False  # See CPython issue gh-NNNNNN.\n",
            "subsections": []
        },
        "Setting this has no impact on use of 'posixspawn()' which could use": {
            "content": "'vfork()' internally within its libc implementation.  There is a similar\n'subprocess.USEPOSIXSPAWN' attribute if you need to prevent use of\nthat.\n\nsubprocess.USEPOSIXSPAWN = False  # See CPython issue gh-NNNNNN.\n",
            "subsections": []
        },
        "It is safe to set these to false on any Python version.  They will have": {
            "content": "no effect on older versions when unsupported.  Do not assume the\nattributes are available to read.  Despite their names, a true value\ndoes not indicate that the corresponding function will be used, only\nthat it may be.\n",
            "subsections": []
        },
        "Please file issues any time you have to use these private knobs with a": {
            "content": "way to reproduce the issue you were seeing.  Link to that issue from a\ncomment in your code.\n",
            "subsections": []
        },
        "New in version 3.8: 'USEPOSIXSPAWN'": {
            "content": "",
            "subsections": []
        },
        "New in version 3.11: 'USEVFORK'": {
            "content": "",
            "subsections": []
        },
        "File: python3.12.info,  Node: sched -- Event scheduler,  Next: queue -- A synchronized queue class,  Prev: subprocess -- Subprocess management,  Up: Concurrent Execution": {
            "content": "'Source code:' Lib/sched.py(1)\n\n\n\nThe *note sched: ba. module defines a class which implements a general\npurpose event scheduler:\n\n-- Class: sched.scheduler (timefunc=time.monotonic,\ndelayfunc=time.sleep)\n\nThe *note scheduler: f97. class defines a generic interface to\nscheduling events.  It needs two functions to actually deal with\nthe \"outside world\" -- 'timefunc' should be callable without\narguments, and return a number (the \"time\", in any units\nwhatsoever).  The 'delayfunc' function should be callable with one\nargument, compatible with the output of 'timefunc', and should\ndelay that many time units.  'delayfunc' will also be called with\nthe argument '0' after each event is run to allow other threads an\nopportunity to run in multi-threaded applications.\n\nChanged in version 3.3: 'timefunc' and 'delayfunc' parameters are\noptional.\n\nChanged in version 3.3: *note scheduler: f97. class can be safely\nused in multi-threaded environments.\n\nExample:\n\n>>> import sched, time\n>>> s = sched.scheduler(time.time, time.sleep)\n>>> def printtime(a='default'):\n...     print(\"From printtime\", time.time(), a)\n...\n>>> def printsometimes():\n...     print(time.time())\n...     s.enter(10, 1, printtime)\n...     s.enter(5, 2, printtime, argument=('positional',))\n...     # despite having higher priority, 'keyword' runs after 'positional' as enter() is relative\n...     s.enter(5, 1, printtime, kwargs={'a': 'keyword'})\n...     s.enterabs(1650000000, 10, printtime, argument=(\"first enterabs\",))\n...     s.enterabs(1650000000, 5, printtime, argument=(\"second enterabs\",))\n...     s.run()\n...     print(time.time())\n...\n>>> printsometimes()\n1652342830.3640375\nFrom printtime 1652342830.3642538 second enterabs\nFrom printtime 1652342830.3643398 first enterabs\nFrom printtime 1652342835.3694863 positional\nFrom printtime 1652342835.3696074 keyword\nFrom printtime 1652342840.369612 default\n1652342840.3697174\n\n* Menu:\n\n* Scheduler Objects::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/sched.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Scheduler Objects,  Up: sched -- Event scheduler": {
            "content": "5.17.7.1 Scheduler Objects\n..........................\n\n*note scheduler: f97. instances have the following methods and\nattributes:\n\n-- Method: scheduler.enterabs (time, priority, action, argument=(),\nkwargs={})\n\nSchedule a new event.  The 'time' argument should be a numeric type\ncompatible with the return value of the 'timefunc' function passed\nto the constructor.  Events scheduled for the same 'time' will be\nexecuted in the order of their 'priority'.  A lower number\nrepresents a higher priority.\n\nExecuting the event means executing 'action(*argument, kwargs)'.\n'argument' is a sequence holding the positional arguments for\n'action'.  'kwargs' is a dictionary holding the keyword arguments\nfor 'action'.\n\nReturn value is an event which may be used for later cancellation\nof the event (see *note cancel(): 1695.).\n\nChanged in version 3.3: 'argument' parameter is optional.\n\nChanged in version 3.3: 'kwargs' parameter was added.\n\n-- Method: scheduler.enter (delay, priority, action, argument=(),\nkwargs={})\n\nSchedule an event for 'delay' more time units.  Other than the\nrelative time, the other arguments, the effect and the return value\nare the same as those for *note enterabs(): f99.\n\nChanged in version 3.3: 'argument' parameter is optional.\n\nChanged in version 3.3: 'kwargs' parameter was added.\n\n-- Method: scheduler.cancel (event)\n\nRemove the event from the queue.  If 'event' is not an event\ncurrently in the queue, this method will raise a *note ValueError:\n183.\n\n-- Method: scheduler.empty ()\n\nReturn 'True' if the event queue is empty.\n\n-- Method: scheduler.run (blocking=True)\n\nRun all scheduled events.  This method will wait (using the\n'delayfunc' function passed to the constructor) for the next event,\nthen execute it and so on until there are no more scheduled events.\n\nIf 'blocking' is false executes the scheduled events due to expire\nsoonest (if any) and then return the deadline of the next scheduled\ncall in the scheduler (if any).\n\nEither 'action' or 'delayfunc' can raise an exception.  In either\ncase, the scheduler will maintain a consistent state and propagate\nthe exception.  If an exception is raised by 'action', the event\nwill not be attempted in future calls to *note run(): f96.\n\nIf a sequence of events takes longer to run than the time available\nbefore the next event, the scheduler will simply fall behind.  No\nevents will be dropped; the calling code is responsible for\ncanceling events which are no longer pertinent.\n\nChanged in version 3.3: 'blocking' parameter was added.\n\n-- Attribute: scheduler.queue\n\nRead-only attribute returning a list of upcoming events in the\norder they will be run.  Each event is shown as a *note named\ntuple: 417. with the following fields: time, priority, action,\nargument, kwargs.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: queue -- A synchronized queue class,  Next: contextvars -- Context Variables,  Prev: sched -- Event scheduler,  Up: Concurrent Execution": {
            "content": "'Source code:' Lib/queue.py(1)\n\n\n\nThe *note queue: b1. module implements multi-producer, multi-consumer\nqueues.  It is especially useful in threaded programming when\ninformation must be exchanged safely between multiple threads.  The\n*note Queue: 1203. class in this module implements all the required\nlocking semantics.\n",
            "subsections": []
        },
        "The module implements three types of queue, which differ only in the": {
            "content": "order in which the entries are retrieved.  In a FIFO queue, the first\ntasks added are the first retrieved.  In a LIFO queue, the most recently\nadded entry is the first retrieved (operating like a stack).  With a\npriority queue, the entries are kept sorted (using the *note heapq: 64.\nmodule) and the lowest valued entry is retrieved first.\n",
            "subsections": []
        },
        "Internally, those three types of queues use locks to temporarily block": {
            "content": "competing threads; however, they are not designed to handle reentrancy\nwithin a thread.\n\nIn addition, the module implements a \"simple\" FIFO queue type, *note",
            "subsections": []
        },
        "SimpleQueue: 9aa, whose specific implementation provides additional": {
            "content": "guarantees in exchange for the smaller functionality.\n\nThe *note queue: b1. module defines the following classes and\nexceptions:\n\n-- Class: queue.Queue (maxsize=0)\n\nConstructor for a FIFO queue.  'maxsize' is an integer that sets\nthe upperbound limit on the number of items that can be placed in\nthe queue.  Insertion will block once this size has been reached,\nuntil queue items are consumed.  If 'maxsize' is less than or equal\nto zero, the queue size is infinite.\n\n-- Class: queue.LifoQueue (maxsize=0)\n\nConstructor for a LIFO queue.  'maxsize' is an integer that sets\nthe upperbound limit on the number of items that can be placed in\nthe queue.  Insertion will block once this size has been reached,\nuntil queue items are consumed.  If 'maxsize' is less than or equal\nto zero, the queue size is infinite.\n\n-- Class: queue.PriorityQueue (maxsize=0)\n\nConstructor for a priority queue.  'maxsize' is an integer that\nsets the upperbound limit on the number of items that can be placed\nin the queue.  Insertion will block once this size has been\nreached, until queue items are consumed.  If 'maxsize' is less than\nor equal to zero, the queue size is infinite.\n\nThe lowest valued entries are retrieved first (the lowest valued\nentry is the one that would be returned by 'min(entries)').  A\ntypical pattern for entries is a tuple in the form:\n'(prioritynumber, data)'.\n\nIf the 'data' elements are not comparable, the data can be wrapped\nin a class that ignores the data item and only compares the\npriority number:\n\nfrom dataclasses import dataclass, field\nfrom typing import Any\n\n@dataclass(order=True)\nclass PrioritizedItem:\npriority: int\nitem: Any=field(compare=False)\n\n-- Class: queue.SimpleQueue\n\nConstructor for an unbounded FIFO queue.  Simple queues lack\nadvanced functionality such as task tracking.\n\nNew in version 3.7.\n\n-- Exception: queue.Empty\n\nException raised when non-blocking *note get(): 2e91. (or *note\ngetnowait(): 2e92.) is called on a *note Queue: 1203. object which\nis empty.\n\n-- Exception: queue.Full\n\nException raised when non-blocking *note put(): 2e93. (or *note\nputnowait(): 2e94.) is called on a *note Queue: 1203. object which\nis full.\n\n* Menu:\n\n* Queue Objects::\n* SimpleQueue Objects::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/queue.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Queue Objects,  Next: SimpleQueue Objects,  Up: queue -- A synchronized queue class": {
            "content": "5.17.8.1 Queue Objects\n......................\n\nQueue objects (*note Queue: 1203, *note LifoQueue: 1f64, or *note\nPriorityQueue: 1f65.) provide the public methods described below.\n\n-- Method: Queue.qsize ()\n\nReturn the approximate size of the queue.  Note, qsize() > 0\ndoesn't guarantee that a subsequent get() will not block, nor will\nqsize() < maxsize guarantee that put() will not block.\n\n-- Method: Queue.empty ()\n\nReturn 'True' if the queue is empty, 'False' otherwise.  If empty()\nreturns 'True' it doesn't guarantee that a subsequent call to put()\nwill not block.  Similarly, if empty() returns 'False' it doesn't\nguarantee that a subsequent call to get() will not block.\n\n-- Method: Queue.full ()\n\nReturn 'True' if the queue is full, 'False' otherwise.  If full()\nreturns 'True' it doesn't guarantee that a subsequent call to get()\nwill not block.  Similarly, if full() returns 'False' it doesn't\nguarantee that a subsequent call to put() will not block.\n\n-- Method: Queue.put (item, block=True, timeout=None)\n\nPut 'item' into the queue.  If optional args 'block' is true and\n'timeout' is 'None' (the default), block if necessary until a free\nslot is available.  If 'timeout' is a positive number, it blocks at\nmost 'timeout' seconds and raises the *note Full: 2da2. exception\nif no free slot was available within that time.  Otherwise ('block'\nis false), put an item on the queue if a free slot is immediately\navailable, else raise the *note Full: 2da2. exception ('timeout' is\nignored in that case).\n\n-- Method: Queue.putnowait (item)\n\nEquivalent to 'put(item, block=False)'.\n\n-- Method: Queue.get (block=True, timeout=None)\n\nRemove and return an item from the queue.  If optional args 'block'\nis true and 'timeout' is 'None' (the default), block if necessary\nuntil an item is available.  If 'timeout' is a positive number, it\nblocks at most 'timeout' seconds and raises the *note Empty: 2da1.\nexception if no item was available within that time.  Otherwise\n('block' is false), return an item if one is immediately available,\nelse raise the *note Empty: 2da1. exception ('timeout' is ignored\nin that case).\n\nPrior to 3.0 on POSIX systems, and for all versions on Windows, if\n'block' is true and 'timeout' is 'None', this operation goes into\nan uninterruptible wait on an underlying lock.  This means that no\nexceptions can occur, and in particular a SIGINT will not trigger a\n*note KeyboardInterrupt: 7f5.\n\n-- Method: Queue.getnowait ()\n\nEquivalent to 'get(False)'.\n",
            "subsections": []
        },
        "Two methods are offered to support tracking whether enqueued tasks have": {
            "content": "been fully processed by daemon consumer threads.\n\n-- Method: Queue.taskdone ()\n\nIndicate that a formerly enqueued task is complete.  Used by queue\nconsumer threads.  For each *note get(): 2e91. used to fetch a\ntask, a subsequent call to *note taskdone(): 2d9d. tells the queue\nthat the processing on the task is complete.\n\nIf a *note join(): 2d9e. is currently blocking, it will resume when\nall items have been processed (meaning that a *note taskdone():\n2d9d. call was received for every item that had been *note put():\n2e93. into the queue).\n\nRaises a *note ValueError: 183. if called more times than there\nwere items placed in the queue.\n\n-- Method: Queue.join ()\n\nBlocks until all items in the queue have been gotten and processed.\n\nThe count of unfinished tasks goes up whenever an item is added to\nthe queue.  The count goes down whenever a consumer thread calls\n*note taskdone(): 2d9d. to indicate that the item was retrieved\nand all work on it is complete.  When the count of unfinished tasks\ndrops to zero, *note join(): 2d9e. unblocks.\n\nExample of how to wait for enqueued tasks to be completed:\n\nimport threading\nimport queue\n\nq = queue.Queue()\n\ndef worker():\nwhile True:\nitem = q.get()\nprint(f'Working on {item}')\nprint(f'Finished {item}')\nq.taskdone()\n\n# Turn-on the worker thread.\nthreading.Thread(target=worker, daemon=True).start()\n\n# Send thirty task requests to the worker.\nfor item in range(30):\nq.put(item)\n\n# Block until all tasks are done.\nq.join()\nprint('All work completed')\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: SimpleQueue Objects,  Prev: Queue Objects,  Up: queue -- A synchronized queue class": {
            "content": "5.17.8.2 SimpleQueue Objects\n............................\n\n*note SimpleQueue: 9aa. objects provide the public methods described\nbelow.\n\n-- Method: SimpleQueue.qsize ()\n\nReturn the approximate size of the queue.  Note, qsize() > 0\ndoesn't guarantee that a subsequent get() will not block.\n\n-- Method: SimpleQueue.empty ()\n\nReturn 'True' if the queue is empty, 'False' otherwise.  If empty()\nreturns 'False' it doesn't guarantee that a subsequent call to\nget() will not block.\n\n-- Method: SimpleQueue.put (item, block=True, timeout=None)\n\nPut 'item' into the queue.  The method never blocks and always\nsucceeds (except for potential low-level errors such as failure to\nallocate memory).  The optional args 'block' and 'timeout' are\nignored and only provided for compatibility with *note Queue.put():\n2e93.\n\n'CPython implementation detail:' This method has a C implementation\nwhich is reentrant.  That is, a 'put()' or 'get()' call can be\ninterrupted by another 'put()' call in the same thread without\ndeadlocking or corrupting internal state inside the queue.  This\nmakes it appropriate for use in destructors such as 'del'\nmethods or *note weakref: 10f. callbacks.\n\n-- Method: SimpleQueue.putnowait (item)\n\nEquivalent to 'put(item, block=False)', provided for compatibility\nwith *note Queue.putnowait(): 2e94.\n\n-- Method: SimpleQueue.get (block=True, timeout=None)\n\nRemove and return an item from the queue.  If optional args 'block'\nis true and 'timeout' is 'None' (the default), block if necessary\nuntil an item is available.  If 'timeout' is a positive number, it\nblocks at most 'timeout' seconds and raises the *note Empty: 2da1.\nexception if no item was available within that time.  Otherwise\n('block' is false), return an item if one is immediately available,\nelse raise the *note Empty: 2da1. exception ('timeout' is ignored\nin that case).\n\n-- Method: SimpleQueue.getnowait ()\n\nEquivalent to 'get(False)'.\n\nSee also\n........\n\nClass *note multiprocessing.Queue: 13cf.\n\nA queue class for use in a multi-processing (rather than\nmulti-threading) context.\n\n*note collections.deque: 3a0. is an alternative implementation of\nunbounded queues with fast atomic *note append(): 2214. and *note\npopleft(): 221a. operations that do not require locking and also support\nindexing.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: contextvars -- Context Variables,  Next: thread -- Low-level threading API,  Prev: queue -- A synchronized queue class,  Up: Concurrent Execution": {
            "content": "",
            "subsections": []
        },
        "This module provides APIs to manage, store, and access context-local": {
            "content": "state.  The *note ContextVar: 2ea3. class is used to declare and work\nwith 'Context Variables'.  The *note copycontext(): 2ea4. function and\nthe *note Context: 2ea5. class should be used to manage the current\ncontext in asynchronous frameworks.\n",
            "subsections": []
        },
        "Context managers that have state should use Context Variables instead of": {
            "content": "*note threading.local(): 14bb. to prevent their state from bleeding to\nother code unexpectedly, when used in concurrent code.\n\nSee also PEP 567(1) for additional details.\n\nNew in version 3.7.\n\n* Menu:\n\n* Context Variables::\n* Manual Context Management::\n* asyncio support::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0567/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Context Variables,  Next: Manual Context Management,  Up: contextvars -- Context Variables": {
            "content": "5.17.9.1 Context Variables\n..........................\n\n-- Class: contextvars.ContextVar (name[, *, default])\n\nThis class is used to declare a new Context Variable, e.g.:\n\nvar: ContextVar[int] = ContextVar('var', default=42)\n\nThe required 'name' parameter is used for introspection and debug\npurposes.\n\nThe optional keyword-only 'default' parameter is returned by *note\nContextVar.get(): 2ea7. when no value for the variable is found in\nthe current context.\n\n'Important:' Context Variables should be created at the top module\nlevel and never in closures.  *note Context: 2ea5. objects hold\nstrong references to context variables which prevents context\nvariables from being properly garbage collected.\n\n-- Attribute: name\n\nThe name of the variable.  This is a read-only property.\n\nNew in version 3.7.1.\n\n-- Method: get ([default])\n\nReturn a value for the context variable for the current\ncontext.\n\nIf there is no value for the variable in the current context,\nthe method will:\n\n* return the value of the 'default' argument of the method,\nif provided; or\n\n* return the default value for the context variable, if it\nwas created with one; or\n\n* raise a *note LookupError: 1ed9.\n\n-- Method: set (value)\n\nCall to set a new value for the context variable in the\ncurrent context.\n\nThe required 'value' argument is the new value for the context\nvariable.\n\nReturns a *note Token: 2eaa. object that can be used to\nrestore the variable to its previous value via the *note\nContextVar.reset(): 2eab. method.\n\n-- Method: reset (token)\n\nReset the context variable to the value it had before the\n*note ContextVar.set(): 2ea9. that created the 'token' was\nused.\n\nFor example:\n\nvar = ContextVar('var')\n\ntoken = var.set('new value')\n# code that uses 'var'; var.get() returns 'new value'.\nvar.reset(token)\n\n# After the reset call the var has no value again, so\n# var.get() would raise a LookupError.\n\n-- Class: contextvars.Token\n\n'Token' objects are returned by the *note ContextVar.set(): 2ea9.\nmethod.  They can be passed to the *note ContextVar.reset(): 2eab.\nmethod to revert the value of the variable to what it was before\nthe corresponding 'set'.\n\n-- Attribute: var\n\nA read-only property.  Points to the *note ContextVar: 2ea3.\nobject that created the token.\n\n-- Attribute: oldvalue\n\nA read-only property.  Set to the value the variable had\nbefore the *note ContextVar.set(): 2ea9. method call that\ncreated the token.  It points to *note Token.MISSING: 2eae. if\nthe variable was not set before the call.\n\n-- Attribute: MISSING\n\nA marker object used by *note Token.oldvalue: 2ead.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Manual Context Management,  Next: asyncio support,  Prev: Context Variables,  Up: contextvars -- Context Variables": {
            "content": "5.17.9.2 Manual Context Management\n..................................\n\n-- Function: contextvars.copycontext ()\n\nReturns a copy of the current *note Context: 2ea5. object.\n\nThe following snippet gets a copy of the current context and prints\nall variables and their values that are set in it:\n\nctx: Context = copycontext()\nprint(list(ctx.items()))\n\nThe function has an 'O'(1) complexity, i.e.  works equally fast for\ncontexts with a few context variables and for contexts that have a\nlot of them.\n\n-- Class: contextvars.Context\n\nA mapping of *note ContextVars: 2ea3. to their values.\n\n'Context()' creates an empty context with no values in it.  To get\na copy of the current context use the *note copycontext(): 2ea4.\nfunction.\n\nEvery thread will have a different top-level *note Context: 2ea5.\nobject.  This means that a *note ContextVar: 2ea3. object behaves\nin a similar fashion to *note threading.local(): 14bb. when values\nare assigned in different threads.\n\nContext implements the *note collections.abc.Mapping: 6e2.\ninterface.\n\n-- Method: run (callable, *args, kwargs)\n\nExecute 'callable(*args, kwargs)' code in the context object\nthe 'run' method is called on.  Return the result of the\nexecution or propagate an exception if one occurred.\n\nAny changes to any context variables that 'callable' makes\nwill be contained in the context object:\n\nvar = ContextVar('var')\nvar.set('spam')\n\ndef main():\n# 'var' was set to 'spam' before\n# calling 'copycontext()' and 'ctx.run(main)', so:\n# var.get() == ctx[var] == 'spam'\n\nvar.set('ham')\n\n# Now, after setting 'var' to 'ham':\n# var.get() == ctx[var] == 'ham'\n\nctx = copycontext()\n\n# Any changes that the 'main' function makes to 'var'\n# will be contained in 'ctx'.\nctx.run(main)\n\n# The 'main()' function was run in the 'ctx' context,\n# so changes to 'var' are contained in it:\n# ctx[var] == 'ham'\n\n# However, outside of 'ctx', 'var' is still set to 'spam':\n# var.get() == 'spam'\n\nThe method raises a *note RuntimeError: 17a. when called on\nthe same context object from more than one OS thread, or when\ncalled recursively.\n\n-- Method: copy ()\n\nReturn a shallow copy of the context object.\n\n-- Describe: var in context\n\nReturn 'True' if the 'context' has a value for 'var' set;\nreturn 'False' otherwise.\n\n-- Describe: context[var]\n\nReturn the value of the 'var' *note ContextVar: 2ea3.\nvariable.  If the variable is not set in the context object, a\n*note KeyError: 8cf. is raised.\n\n-- Method: get (var[, default])\n\nReturn the value for 'var' if 'var' has the value in the\ncontext object.  Return 'default' otherwise.  If 'default' is\nnot given, return 'None'.\n\n-- Describe: iter(context)\n\nReturn an iterator over the variables stored in the context\nobject.\n\n-- Describe: len(proxy)\n\nReturn the number of variables set in the context object.\n\n-- Method: keys ()\n\nReturn a list of all variables in the context object.\n\n-- Method: values ()\n\nReturn a list of all variables' values in the context object.\n\n-- Method: items ()\n\nReturn a list of 2-tuples containing all variables and their\nvalues in the context object.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: asyncio support,  Prev: Manual Context Management,  Up: contextvars -- Context Variables": {
            "content": "5.17.9.3 asyncio support\n........................\n\nContext variables are natively supported in *note asyncio: 9. and are\nready to be used without any extra configuration.  For example, here is\na simple echo server, that uses a context variable to make the address\nof a remote client available in the Task that handles that client:\n\nimport asyncio\nimport contextvars\n\nclientaddrvar = contextvars.ContextVar('clientaddr')\n\ndef rendergoodbye():\n# The address of the currently handled client can be accessed\n# without passing it explicitly to this function.\n\nclientaddr = clientaddrvar.get()\nreturn f'Good bye, client @ {clientaddr}\\n'.encode()\n\nasync def handlerequest(reader, writer):\naddr = writer.transport.getextrainfo('socket').getpeername()\nclientaddrvar.set(addr)\n\n# In any code that we call is now possible to get\n# client's address by calling 'clientaddrvar.get()'.\n\nwhile True:\nline = await reader.readline()\nprint(line)\nif not line.strip():\nbreak\nwriter.write(line)\n\nwriter.write(rendergoodbye())\nwriter.close()\n\nasync def main():\nsrv = await asyncio.startserver(\nhandlerequest, '127.0.0.1', 8081)\n\nasync with srv:\nawait srv.serveforever()\n\nasyncio.run(main())\n\n# To test it you can use telnet:\n#     telnet 127.0.0.1 8081\n\nThe following are support modules for some of the above services:\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: thread -- Low-level threading API,  Prev: contextvars -- Context Variables,  Up: Concurrent Execution": {
            "content": "",
            "subsections": []
        },
        "This module provides low-level primitives for working with multiple": {
            "content": "threads (also called 'light-weight processes' or 'tasks') -- multiple\nthreads of control sharing their global data space.  For\nsynchronization, simple locks (also called 'mutexes' or 'binary\nsemaphores') are provided.  The *note threading: e7. module provides an\neasier to use and higher-level threading API built on top of this\nmodule.\n",
            "subsections": []
        },
        "In addition to these methods, lock objects can also be used via the": {
            "content": "*note with: 396. statement, e.g.:\n\nimport thread\n\nalock = thread.allocatelock()\n\nwith alock:\nprint(\"alock is locked while this executes\")\n\n'Caveats:'\n\n* Threads interact strangely with interrupts: the *note\nKeyboardInterrupt: 7f5. exception will be received by an arbitrary\nthread.  (When the *note signal: c1. module is available,\ninterrupts always go to the main thread.)\n\n* Calling *note sys.exit(): 11c2. or raising the *note SystemExit:\nb97. exception is equivalent to calling *note thread.exit(): 2ebb.\n\n* It is not possible to interrupt the *note acquire(): 464. method on\na lock -- the *note KeyboardInterrupt: 7f5. exception will happen\nafter the lock has been acquired.\n\n* When the main thread exits, it is system defined whether the other\nthreads survive.  On most systems, they are killed without\nexecuting *note try: 4bc. ... *note finally: 7ee. clauses or\nexecuting object destructors.\n\n* When the main thread exits, it does not do any of its usual cleanup\n(except that *note try: 4bc. ... *note finally: 7ee. clauses are\nhonored), and the standard I/O files are not flushed.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Networking and Interprocess Communication,  Next: Internet Data Handling,  Prev: Concurrent Execution,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.18 Networking and Interprocess Communication",
                    "content": ""
                }
            ]
        },
        "The modules described in this chapter provide mechanisms for networking": {
            "content": "and inter-processes communication.\n",
            "subsections": []
        },
        "Some modules only work for two processes that are on the same machine,": {
            "content": "e.g.  *note signal: c1. and *note mmap: 8b.  Other modules support\nnetworking protocols that two or more processes can use to communicate\nacross machines.\n\nThe list of modules described in this chapter is:\n\n* Menu:\n\n* asyncio -- Asynchronous I/O::\n* socket -- Low-level networking interface::\n* ssl -- TLS/SSL wrapper for socket objects::\n* select -- Waiting for I/O completion::\n* selectors -- High-level I/O multiplexing::\n* signal -- Set handlers for asynchronous events::\n* mmap -- Memory-mapped file support::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: asyncio -- Asynchronous I/O,  Next: socket -- Low-level networking interface,  Up: Networking and Interprocess Communication": {
            "content": "Hello World!\n............\n\nimport asyncio\n\nasync def main():\nprint('Hello ...')\nawait asyncio.sleep(1)\nprint('... World!')\n\nasyncio.run(main())\n\nasyncio is a library to write 'concurrent' code using the 'async/await'\nsyntax.\n\nasyncio is used as a foundation for multiple Python asynchronous\nframeworks that provide high-performance network and web-servers,\ndatabase connection libraries, distributed task queues, etc.\n\nasyncio is often a perfect fit for IO-bound and high-level 'structured'\nnetwork code.\n\nasyncio provides a set of 'high-level' APIs to:\n\n* *note run Python coroutines: 2ec9. concurrently and have full\ncontrol over their execution;\n\n* perform *note network IO and IPC: 2eca.;\n\n* control *note subprocesses: 2ecb.;\n\n* distribute tasks via *note queues: 2ecc.;\n\n* *note synchronize: 2ecd. concurrent code;\n",
            "subsections": []
        },
        "Additionally, there are 'low-level' APIs for 'library and framework": {
            "content": "developers' to:\n\n* create and manage *note event loops: bd3, which provide\nasynchronous APIs for *note networking: 2ece, running *note\nsubprocesses: 2ecf, handling *note OS signals: 2ed0, etc;\n\n* implement efficient protocols using *note transports: 2ed1.;\n\n* *note bridge: 2ed2. callback-based libraries and code with\nasync/await syntax.\nYou can experiment with an 'asyncio' concurrent context in the REPL:\n\n$ python -m asyncio\nasyncio REPL ...\nUse \"await\" directly instead of \"asyncio.run()\".\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> import asyncio\n>>> await asyncio.sleep(10, result='hello')\n'hello'\n\n*note Availability: 1ad3.: not Emscripten, not WASI.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Runners,  Next: Coroutines and Tasks,  Up: asyncio -- Asynchronous I/O": {
            "content": "5.18.1.1 Runners\n................\n\n'Source code:' Lib/asyncio/runners.py(1)\n\nThis section outlines high-level asyncio primitives to run asyncio code.\n\nThey are built on top of an *note event loop: bd3. with the aim to\nsimplify async code usage for common wide-spread scenarios.\n\n* Menu:\n\n* Running an asyncio Program::\n* Runner context manager::\n* Handling Keyboard Interruption::\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/asyncio/runners.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Running an asyncio Program,  Next: Runner context manager,  Up: Runners": {
            "content": "5.18.1.2 Running an asyncio Program\n...................................\n\n-- Function: asyncio.run (coro, *, debug=None, loopfactory=None)\n\nExecute the *note coroutine: 1ae. 'coro' and return the result.\n\nThis function runs the passed coroutine, taking care of managing\nthe asyncio event loop, 'finalizing asynchronous generators', and\nclosing the executor.\n\nThis function cannot be called when another asyncio event loop is\nrunning in the same thread.\n\nIf 'debug' is 'True', the event loop will be run in debug mode.\n'False' disables debug mode explicitly.  'None' is used to respect\nthe global *note Debug Mode: 1acf. settings.\n\nIf 'loopfactory' is not 'None', it is used to create a new event\nloop; otherwise *note asyncio.neweventloop(): 2ed7. is used.  The\nloop is closed at the end.  This function should be used as a main\nentry point for asyncio programs, and should ideally only be called\nonce.  It is recommended to use 'loopfactory' to configure the\nevent loop instead of policies.\n\nThe executor is given a timeout duration of 5 minutes to shutdown.\nIf the executor hasn't finished within that duration, a warning is\nemitted and the executor is closed.\n\nExample:\n\nasync def main():\nawait asyncio.sleep(1)\nprint('hello')\n\nasyncio.run(main())\n\nNew in version 3.7.\n\nChanged in version 3.9: Updated to use *note\nloop.shutdowndefaultexecutor(): 700.\n\nChanged in version 3.10: 'debug' is 'None' by default to respect\nthe global debug mode settings.\n\nChanged in version 3.12: Added 'loopfactory' parameter.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Runner context manager,  Next: Handling Keyboard Interruption,  Prev: Running an asyncio Program,  Up: Runners": {
            "content": "5.18.1.3 Runner context manager\n...............................\n\n-- Class: asyncio.Runner (*, debug=None, loopfactory=None)\n\nA context manager that simplifies 'multiple' async function calls\nin the same context.\n\nSometimes several top-level async functions should be called in the\nsame *note event loop: bd3. and *note contextvars.Context: 2ea5.\n\nIf 'debug' is 'True', the event loop will be run in debug mode.\n'False' disables debug mode explicitly.  'None' is used to respect\nthe global *note Debug Mode: 1acf. settings.\n\n'loopfactory' could be used for overriding the loop creation.  It\nis the responsibility of the 'loopfactory' to set the created loop\nas the current one.  By default *note asyncio.neweventloop():\n2ed7. is used and set as current event loop with *note\nasyncio.seteventloop(): 1524. if 'loopfactory' is 'None'.\n\nBasically, *note asyncio.run(): 197. example can be rewritten with\nthe runner usage:\n\nasync def main():\nawait asyncio.sleep(1)\nprint('hello')\n\nwith asyncio.Runner() as runner:\nrunner.run(main())\n\nNew in version 3.11.\n\n-- Method: run (coro, *, context=None)\n\nRun a *note coroutine: 1ae. 'coro' in the embedded loop.\n\nReturn the coroutine's result or raise its exception.\n\nAn optional keyword-only 'context' argument allows specifying\na custom *note contextvars.Context: 2ea5. for the 'coro' to\nrun in.  The runner's default context is used if 'None'.\n\nThis function cannot be called when another asyncio event loop\nis running in the same thread.\n\n-- Method: close ()\n\nClose the runner.\n\nFinalize asynchronous generators, shutdown default executor,\nclose the event loop and release embedded *note\ncontextvars.Context: 2ea5.\n\n-- Method: getloop ()\n\nReturn the event loop associated with the runner instance.\n\nNote: *note Runner: 3c9. uses the lazy initialization\nstrategy, its constructor doesn't initialize underlying\nlow-level structures.\n\nEmbedded 'loop' and 'context' are created at the *note with:\n396. body entering or the first call of *note run(): 197. or\n*note getloop(): 2eda.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Handling Keyboard Interruption,  Prev: Runner context manager,  Up: Runners": {
            "content": "5.18.1.4 Handling Keyboard Interruption\n.......................................\n\nNew in version 3.11.\n\nWhen *note signal.SIGINT: 63a. is raised by 'Ctrl-C', *note",
            "subsections": []
        },
        "KeyboardInterrupt: 7f5. exception is raised in the main thread by": {
            "content": "default.  However this doesn't work with *note asyncio: 9. because it\ncan interrupt asyncio internals and can hang the program from exiting.\n\nTo mitigate this issue, *note asyncio: 9. handles *note signal.SIGINT:\n63a. as follows:\n\n1. *note asyncio.Runner.run(): 13ce. installs a custom *note\nsignal.SIGINT: 63a. handler before any user code is executed and\nremoves it when exiting from the function.\n\n2. The *note Runner: 3c9. creates the main task for the passed\ncoroutine for its execution.\n\n3. When *note signal.SIGINT: 63a. is raised by 'Ctrl-C', the custom\nsignal handler cancels the main task by calling *note\nasyncio.Task.cancel(): 157a. which raises *note\nasyncio.CancelledError: 7fe. inside the main task.  This causes the\nPython stack to unwind, 'try/except' and 'try/finally' blocks can\nbe used for resource cleanup.  After the main task is cancelled,\n*note asyncio.Runner.run(): 13ce. raises *note KeyboardInterrupt:\n7f5.\n\n4. A user could write a tight loop which cannot be interrupted by\n*note asyncio.Task.cancel(): 157a, in which case the second\nfollowing 'Ctrl-C' immediately raises the *note KeyboardInterrupt:\n7f5. without cancelling the main task.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Coroutines and Tasks,  Next: Streams,  Prev: Runners,  Up: asyncio -- Asynchronous I/O": {
            "content": "5.18.1.5 Coroutines and Tasks\n.............................\n",
            "subsections": []
        },
        "This section outlines high-level asyncio APIs to work with coroutines": {
            "content": "and Tasks.\n\n* Menu:\n\n* Coroutines: Coroutines<3>.\n* Awaitables::\n* Creating Tasks::\n* Task Cancellation::\n* Task Groups::\n* Sleeping::\n* Running Tasks Concurrently::\n* Eager Task Factory::\n* Shielding From Cancellation::\n* Timeouts::\n* Waiting Primitives::\n* Running in Threads::\n* Scheduling From Other Threads::\n* Introspection::\n* Task Object::\n\nFile: python3.12.info,  Node: Coroutines<3>,  Next: Awaitables,  Up: Coroutines and Tasks\n\n5.18.1.6 Coroutines\n...................\n\n'Source code:' Lib/asyncio/coroutines.py(1)\n\n\n\n*note Coroutines: 1ae. declared with the async/await syntax is the\npreferred way of writing asyncio applications.  For example, the\nfollowing snippet of code prints \"hello\", waits 1 second, and then\nprints \"world\":\n\n>>> import asyncio\n\n>>> async def main():\n...     print('hello')\n...     await asyncio.sleep(1)\n...     print('world')\n\n>>> asyncio.run(main())\nhello\nworld\n",
            "subsections": []
        },
        "Note that simply calling a coroutine will not schedule it to be": {
            "content": "executed:\n\n>>> main()\n<coroutine object main at 0x1053bb7c8>\n\nTo actually run a coroutine, asyncio provides the following mechanisms:\n\n* The *note asyncio.run(): 197. function to run the top-level entry\npoint \"main()\" function (see the above example.)\n\n* Awaiting on a coroutine.  The following snippet of code will print\n\"hello\" after waiting for 1 second, and then print \"world\" after\nwaiting for 'another' 2 seconds:\n\nimport asyncio\nimport time\n\nasync def sayafter(delay, what):\nawait asyncio.sleep(delay)\nprint(what)\n\nasync def main():\nprint(f\"started at {time.strftime('%X')}\")\n\nawait sayafter(1, 'hello')\nawait sayafter(2, 'world')\n\nprint(f\"finished at {time.strftime('%X')}\")\n\nasyncio.run(main())\n\nExpected output:\n\nstarted at 17:13:52\nhello\nworld\nfinished at 17:13:55\n\n* The *note asyncio.createtask(): 3c5. function to run coroutines\nconcurrently as asyncio *note Tasks: 201.\n\nLet's modify the above example and run two 'sayafter' coroutines\n'concurrently':\n\nasync def main():\ntask1 = asyncio.createtask(\nsayafter(1, 'hello'))\n\ntask2 = asyncio.createtask(\nsayafter(2, 'world'))\n\nprint(f\"started at {time.strftime('%X')}\")\n\n# Wait until both tasks are completed (should take\n# around 2 seconds.)\nawait task1\nawait task2\n\nprint(f\"finished at {time.strftime('%X')}\")\n\nNote that expected output now shows that the snippet runs 1 second\nfaster than before:\n\nstarted at 17:14:32\nhello\nworld\nfinished at 17:14:34\n\n* The *note asyncio.TaskGroup: 3c3. class provides a more modern\nalternative to *note createtask(): 3c5.  Using this API, the last\nexample becomes:\n\nasync def main():\nasync with asyncio.TaskGroup() as tg:\ntask1 = tg.createtask(\nsayafter(1, 'hello'))\n\ntask2 = tg.createtask(\nsayafter(2, 'world'))\n\nprint(f\"started at {time.strftime('%X')}\")\n\n# The await is implicit when the context manager exits.\n\nprint(f\"finished at {time.strftime('%X')}\")\n\nThe timing and output should be the same as for the previous\nversion.\n\nNew in version 3.11: *note asyncio.TaskGroup: 3c3.\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/asyncio/coroutines.py\n\nFile: python3.12.info,  Node: Awaitables,  Next: Creating Tasks,  Prev: Coroutines<3>,  Up: Coroutines and Tasks\n\n5.18.1.7 Awaitables\n...................\n",
            "subsections": []
        },
        "We say that an object is an 'awaitable' object if it can be used in an": {
            "content": "*note await: 516. expression.  Many asyncio APIs are designed to accept\nawaitables.\n",
            "subsections": []
        },
        "There are three main types of 'awaitable' objects: 'coroutines',": {
            "content": "'Tasks', and 'Futures'.\n",
            "subsections": []
        },
        "Python coroutines are 'awaitables' and therefore can be awaited from": {
            "content": "other coroutines:\n\nimport asyncio\n\nasync def nested():\nreturn 42\n\nasync def main():\n# Nothing happens if we just call \"nested()\".\n# A coroutine object is created but not awaited,\n# so it *won't run at all*.\nnested()\n\n# Let's do it differently now and await it:\nprint(await nested())  # will print \"42\".\n\nasyncio.run(main())\n\nImportant: In this documentation the term \"coroutine\" can be used\nfor two closely related concepts:\n\n* a 'coroutine function': an *note async def: 394. function;\n\n* a 'coroutine object': an object returned by calling a\n'coroutine function'.\n",
            "subsections": []
        },
        "Tasks": {
            "content": ".....\n\n'Tasks' are used to schedule coroutines 'concurrently'.\n\nWhen a coroutine is wrapped into a 'Task' with functions like *note\nasyncio.createtask(): 3c5. the coroutine is automatically scheduled to\nrun soon:\n\nimport asyncio\n\nasync def nested():\nreturn 42\n\nasync def main():\n# Schedule nested() to run soon concurrently\n# with \"main()\".\ntask = asyncio.createtask(nested())\n\n# \"task\" can now be used to cancel \"nested()\", or\n# can simply be awaited to wait until it is complete:\nawait task\n\nasyncio.run(main())\n",
            "subsections": []
        },
        "When a Future object is 'awaited' it means that the coroutine will wait": {
            "content": "until the Future is resolved in some other place.\n",
            "subsections": []
        },
        "Future objects in asyncio are needed to allow callback-based code to be": {
            "content": "used with async/await.\n",
            "subsections": []
        },
        "Normally 'there is no need' to create Future objects at the application": {
            "content": "level code.\n",
            "subsections": []
        },
        "Future objects, sometimes exposed by libraries and some asyncio APIs,": {
            "content": "can be awaited:\n\nasync def main():\nawait functionthatreturnsafutureobject()\n\n# this is also valid:\nawait asyncio.gather(\nfunctionthatreturnsafutureobject(),\nsomepythoncoroutine()\n)\n\nA good example of a low-level function that returns a Future object is\n*note loop.runinexecutor(): 702.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Creating Tasks,  Next: Task Cancellation,  Prev: Awaitables,  Up: Coroutines and Tasks": {
            "content": "5.18.1.8 Creating Tasks\n.......................\n\n'Source code:' Lib/asyncio/tasks.py(1)\n\n\n\n-- Function: asyncio.createtask (coro, *, name=None, context=None)\n\nWrap the 'coro' *note coroutine: 2ec9. into a *note Task: 201. and\nschedule its execution.  Return the Task object.\n\nIf 'name' is not 'None', it is set as the name of the task using\n*note Task.setname(): 803.\n\nAn optional keyword-only 'context' argument allows specifying a\ncustom *note contextvars.Context: 2ea5. for the 'coro' to run in.\nThe current context copy is created when no 'context' is provided.\n\nThe task is executed in the loop returned by *note\ngetrunningloop(): 942, *note RuntimeError: 17a. is raised if\nthere is no running loop in current thread.\n\nNote: *note asyncio.TaskGroup.createtask(): 2ee2. is a new\nalternative leveraging structural concurrency; it allows for\nwaiting for a group of related tasks with strong safety\nguarantees.\n\nImportant: Save a reference to the result of this function, to\navoid a task disappearing mid-execution.  The event loop only\nkeeps weak references to tasks.  A task that isn't referenced\nelsewhere may get garbage collected at any time, even before\nit's done.  For reliable \"fire-and-forget\" background tasks,\ngather them in a collection:\n\nbackgroundtasks = set()\n\nfor i in range(10):\ntask = asyncio.createtask(somecoro(param=i))\n\n# Add task to the set. This creates a strong reference.\nbackgroundtasks.add(task)\n\n# To prevent keeping references to finished tasks forever,\n# make each task remove its own reference from the set after\n# completion:\ntask.adddonecallback(backgroundtasks.discard)\n\nNew in version 3.7.\n\nChanged in version 3.8: Added the 'name' parameter.\n\nChanged in version 3.11: Added the 'context' parameter.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/asyncio/tasks.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Task Cancellation,  Next: Task Groups,  Prev: Creating Tasks,  Up: Coroutines and Tasks": {
            "content": "5.18.1.9 Task Cancellation\n..........................\n",
            "subsections": []
        },
        "Tasks can easily and safely be cancelled.  When a task is cancelled,": {
            "content": "*note asyncio.CancelledError: 7fe. will be raised in the task at the\nnext opportunity.\n",
            "subsections": []
        },
        "It is recommended that coroutines use 'try/finally' blocks to robustly": {
            "content": "perform clean-up logic.  In case *note asyncio.CancelledError: 7fe. is\nexplicitly caught, it should generally be propagated when clean-up is\ncomplete.  *note asyncio.CancelledError: 7fe. directly subclasses *note\nBaseException: 37c. so most code will not need to be aware of it.\n\nThe asyncio components that enable structured concurrency, like *note\nasyncio.TaskGroup: 3c3. and *note asyncio.timeout(): 3c7, are\nimplemented using cancellation internally and might misbehave if a\ncoroutine swallows *note asyncio.CancelledError: 7fe.  Similarly, user\ncode should not generally call *note uncancel: 3d4.  However, in cases\nwhen suppressing *note asyncio.CancelledError: 7fe. is truly desired, it\nis necessary to also call 'uncancel()' to completely remove the\ncancellation state.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Task Groups,  Next: Sleeping,  Prev: Task Cancellation,  Up: Coroutines and Tasks": {
            "content": "5.18.1.10 Task Groups\n.....................\n",
            "subsections": []
        },
        "Task groups combine a task creation API with a convenient and reliable": {
            "content": "way to wait for all tasks in the group to finish.\n\n-- Class: asyncio.TaskGroup\n\nAn *note asynchronous context manager: 3c4. holding a group of\ntasks.  Tasks can be added to the group using *note createtask():\n3c5.  All tasks are awaited when the context manager exits.\n\nNew in version 3.11.\n\n-- Method: createtask (coro, *, name=None, context=None)\n\nCreate a task in this task group.  The signature matches that\nof *note asyncio.createtask(): 3c5.\n\nExample:\n\nasync def main():\nasync with asyncio.TaskGroup() as tg:\ntask1 = tg.createtask(somecoro(...))\ntask2 = tg.createtask(anothercoro(...))\nprint(f\"Both tasks have completed now: {task1.result()}, {task2.result()}\")\n",
            "subsections": []
        },
        "The 'async with' statement will wait for all tasks in the group to": {
            "content": "finish.  While waiting, new tasks may still be added to the group (for\nexample, by passing 'tg' into one of the coroutines and calling\n'tg.createtask()' in that coroutine).  Once the last task has finished\nand the 'async with' block is exited, no new tasks may be added to the\ngroup.\n",
            "subsections": []
        },
        "The first time any of the tasks belonging to the group fails with an": {
            "content": "exception other than *note asyncio.CancelledError: 7fe, the remaining\ntasks in the group are cancelled.  No further tasks can then be added to\nthe group.  At this point, if the body of the 'async with' statement is\nstill active (i.e., *note aexit(): 1cd8. hasn't been called yet),\nthe task directly containing the 'async with' statement is also\ncancelled.  The resulting *note asyncio.CancelledError: 7fe. will\ninterrupt an 'await', but it will not bubble out of the containing\n'async with' statement.\n",
            "subsections": []
        },
        "Once all tasks have finished, if any tasks have failed with an exception": {
            "content": "other than *note asyncio.CancelledError: 7fe, those exceptions are\ncombined in an *note ExceptionGroup: 17b. or *note BaseExceptionGroup:\n377. (as appropriate; see their documentation) which is then raised.\n\nTwo base exceptions are treated specially: If any task fails with *note\nKeyboardInterrupt: 7f5. or *note SystemExit: b97, the task group still\ncancels the remaining tasks and waits for them, but then the initial\n*note KeyboardInterrupt: 7f5. or *note SystemExit: b97. is re-raised\ninstead of *note ExceptionGroup: 17b. or *note BaseExceptionGroup: 377.\n",
            "subsections": []
        },
        "If the body of the 'async with' statement exits with an exception (so": {
            "content": "*note aexit(): 1cd8. is called with an exception set), this is\ntreated the same as if one of the tasks failed: the remaining tasks are\ncancelled and then waited for, and non-cancellation exceptions are\ngrouped into an exception group and raised.  The exception passed into\n*note aexit(): 1cd8, unless it is *note asyncio.CancelledError: 7fe,\nis also included in the exception group.  The same special case is made\nfor *note KeyboardInterrupt: 7f5. and *note SystemExit: b97. as in the\nprevious paragraph.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Sleeping,  Next: Running Tasks Concurrently,  Prev: Task Groups,  Up: Coroutines and Tasks": {
            "content": "5.18.1.11 Sleeping\n..................\n\n-- Function: coroutine asyncio.sleep (delay, result=None)\n\nBlock for 'delay' seconds.\n\nIf 'result' is provided, it is returned to the caller when the\ncoroutine completes.\n\n'sleep()' always suspends the current task, allowing other tasks to\nrun.\n\nSetting the delay to 0 provides an optimized path to allow other\ntasks to run.  This can be used by long-running functions to avoid\nblocking the event loop for the full duration of the function call.\nExample of coroutine displaying the current date every second for 5\nseconds:\n\nimport asyncio\nimport datetime\n\nasync def displaydate():\nloop = asyncio.getrunningloop()\nendtime = loop.time() + 5.0\nwhile True:\nprint(datetime.datetime.now())\nif (loop.time() + 1.0) >= endtime:\nbreak\nawait asyncio.sleep(1)\n\nasyncio.run(displaydate())\n\nChanged in version 3.10: Removed the 'loop' parameter.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Running Tasks Concurrently,  Next: Eager Task Factory,  Prev: Sleeping,  Up: Coroutines and Tasks": {
            "content": "5.18.1.12 Running Tasks Concurrently\n....................................\n\n-- Function: awaitable asyncio.gather (*aws, returnexceptions=False)\n\nRun *note awaitable objects: 2edf. in the 'aws' sequence\n'concurrently'.\n\nIf any awaitable in 'aws' is a coroutine, it is automatically\nscheduled as a Task.\n\nIf all awaitables are completed successfully, the result is an\naggregate list of returned values.  The order of result values\ncorresponds to the order of awaitables in 'aws'.\n\nIf 'returnexceptions' is 'False' (default), the first raised\nexception is immediately propagated to the task that awaits on\n'gather()'.  Other awaitables in the 'aws' sequence 'won't be\ncancelled' and will continue to run.\n\nIf 'returnexceptions' is 'True', exceptions are treated the same\nas successful results, and aggregated in the result list.\n\nIf 'gather()' is 'cancelled', all submitted awaitables (that have\nnot completed yet) are also 'cancelled'.\n\nIf any Task or Future from the 'aws' sequence is 'cancelled', it is\ntreated as if it raised *note CancelledError: 7fe. - the 'gather()'\ncall is 'not' cancelled in this case.  This is to prevent the\ncancellation of one submitted Task/Future to cause other\nTasks/Futures to be cancelled.\n\nNote: A new alternative to create and run tasks concurrently\nand wait for their completion is *note asyncio.TaskGroup: 3c3.\n'TaskGroup' provides stronger safety guarantees than 'gather'\nfor scheduling a nesting of subtasks: if a task (or a subtask,\na task scheduled by a task) raises an exception, 'TaskGroup'\nwill, while 'gather' will not, cancel the remaining scheduled\ntasks).\nExample:\n\nimport asyncio\n\nasync def factorial(name, number):\nf = 1\nfor i in range(2, number + 1):\nprint(f\"Task {name}: Compute factorial({number}), currently i={i}...\")\nawait asyncio.sleep(1)\nf *= i\nprint(f\"Task {name}: factorial({number}) = {f}\")\nreturn f\n\nasync def main():\n# Schedule three calls *concurrently*:\nL = await asyncio.gather(\nfactorial(\"A\", 2),\nfactorial(\"B\", 3),\nfactorial(\"C\", 4),\n)\nprint(L)\n\nasyncio.run(main())\n\n# Expected output:\n#\n#     Task A: Compute factorial(2), currently i=2...\n#     Task B: Compute factorial(3), currently i=2...\n#     Task C: Compute factorial(4), currently i=2...\n#     Task A: factorial(2) = 2\n#     Task B: Compute factorial(3), currently i=3...\n#     Task C: Compute factorial(4), currently i=3...\n#     Task B: factorial(3) = 6\n#     Task C: Compute factorial(4), currently i=4...\n#     Task C: factorial(4) = 24\n#     [2, 6, 24]\n\nNote: If 'returnexceptions' is False, cancelling gather()\nafter it has been marked done won't cancel any submitted\nawaitables.  For instance, gather can be marked done after\npropagating an exception to the caller, therefore, calling\n'gather.cancel()' after catching an exception (raised by one\nof the awaitables) from gather won't cancel any other\nawaitables.\n\nChanged in version 3.7: If the 'gather' itself is cancelled, the\ncancellation is propagated regardless of 'returnexceptions'.\n\nChanged in version 3.10: Removed the 'loop' parameter.\n\nDeprecated since version 3.10: Deprecation warning is emitted if no\npositional arguments are provided or not all positional arguments\nare Future-like objects and there is no running event loop.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Eager Task Factory,  Next: Shielding From Cancellation,  Prev: Running Tasks Concurrently,  Up: Coroutines and Tasks": {
            "content": "5.18.1.13 Eager Task Factory\n............................\n\n-- Function: asyncio.eagertaskfactory (loop, coro, *, name=None,\ncontext=None)\n\nA task factory for eager task execution.\n\nWhen using this factory (via *note\nloop.settaskfactory(asyncio.eagertaskfactory): c22.),\ncoroutines begin execution synchronously during *note Task: 201.\nconstruction.  Tasks are only scheduled on the event loop if they\nblock.  This can be a performance improvement as the overhead of\nloop scheduling is avoided for coroutines that complete\nsynchronously.\n\nA common example where this is beneficial is coroutines which\nemploy caching or memoization to avoid actual I/O when possible.\n\nNote: Immediate execution of the coroutine is a semantic\nchange.  If the coroutine returns or raises, the task is never\nscheduled to the event loop.  If the coroutine execution\nblocks, the task is scheduled to the event loop.  This change\nmay introduce behavior changes to existing applications.  For\nexample, the application's task execution order is likely to\nchange.\n\nNew in version 3.12.\n\n-- Function: asyncio.createeagertaskfactory\n(customtaskconstructor)\n\nCreate an eager task factory, similar to *note\neagertaskfactory(): 192, using the provided\n'customtaskconstructor' when creating a new task instead of the\ndefault *note Task: 201.\n\n'customtaskconstructor' must be a 'callable' with the signature\nmatching the signature of *note Task.init: 201.  The callable\nmust return a *note asyncio.Task: 201.-compatible object.\n\nThis function returns a 'callable' intended to be used as a task\nfactory of an event loop via *note loop.settaskfactory(factory):\nc22.).\n\nNew in version 3.12.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Shielding From Cancellation,  Next: Timeouts,  Prev: Eager Task Factory,  Up: Coroutines and Tasks": {
            "content": "5.18.1.14 Shielding From Cancellation\n.....................................\n\n-- Function: awaitable asyncio.shield (aw)\n\nProtect an *note awaitable object: 2edf. from being *note\ncancelled: 157a.\n\nIf 'aw' is a coroutine it is automatically scheduled as a Task.\n\nThe statement:\n\ntask = asyncio.createtask(something())\nres = await shield(task)\n\nis equivalent to:\n\nres = await something()\n\n'except' that if the coroutine containing it is cancelled, the Task\nrunning in 'something()' is not cancelled.  From the point of view\nof 'something()', the cancellation did not happen.  Although its\ncaller is still cancelled, so the \"await\" expression still raises a\n*note CancelledError: 7fe.\n\nIf 'something()' is cancelled by other means (i.e.  from within\nitself) that would also cancel 'shield()'.\n\nIf it is desired to completely ignore cancellation (not\nrecommended) the 'shield()' function should be combined with a\ntry/except clause, as follows:\n\ntask = asyncio.createtask(something())\ntry:\nres = await shield(task)\nexcept CancelledError:\nres = None\n\nImportant: Save a reference to tasks passed to this function,\nto avoid a task disappearing mid-execution.  The event loop\nonly keeps weak references to tasks.  A task that isn't\nreferenced elsewhere may get garbage collected at any time,\neven before it's done.\n\nChanged in version 3.10: Removed the 'loop' parameter.\n\nDeprecated since version 3.10: Deprecation warning is emitted if\n'aw' is not Future-like object and there is no running event loop.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Timeouts,  Next: Waiting Primitives,  Prev: Shielding From Cancellation,  Up: Coroutines and Tasks": {
            "content": "5.18.1.15 Timeouts\n..................\n\n-- Function: asyncio.timeout (delay)\n\nReturn an *note asynchronous context manager: 3c4. that can be used\nto limit the amount of time spent waiting on something.\n\n'delay' can either be 'None', or a float/int number of seconds to\nwait.  If 'delay' is 'None', no time limit will be applied; this\ncan be useful if the delay is unknown when the context manager is\ncreated.\n\nIn either case, the context manager can be rescheduled after\ncreation using *note Timeout.reschedule(): 2eee.\n\nExample:\n\nasync def main():\nasync with asyncio.timeout(10):\nawait longrunningtask()\n\nIf 'longrunningtask' takes more than 10 seconds to complete, the\ncontext manager will cancel the current task and handle the\nresulting *note asyncio.CancelledError: 7fe. internally,\ntransforming it into a *note TimeoutError: 62a. which can be caught\nand handled.\n\nNote: The *note asyncio.timeout(): 3c7. context manager is\nwhat transforms the *note asyncio.CancelledError: 7fe. into a\n*note TimeoutError: 62a, which means the *note TimeoutError:\n62a. can only be caught 'outside' of the context manager.\n\nExample of catching *note TimeoutError: 62a.:\n\nasync def main():\ntry:\nasync with asyncio.timeout(10):\nawait longrunningtask()\nexcept TimeoutError:\nprint(\"The long operation timed out, but we've handled it.\")\n\nprint(\"This statement will run regardless.\")\n\nThe context manager produced by *note asyncio.timeout(): 3c7. can\nbe rescheduled to a different deadline and inspected.\n\n-- Class: asyncio.Timeout (when)\n\nAn *note asynchronous context manager: 3c4. for cancelling\noverdue coroutines.\n\n'when' should be an absolute time at which the context should\ntime out, as measured by the event loop's clock:\n\n- If 'when' is 'None', the timeout will never trigger.\n\n- If 'when < loop.time()', the timeout will trigger on the\nnext iteration of the event loop.\n\n-- Method: when () -> float | None\n\nReturn the current deadline, or 'None' if the\ncurrent deadline is not set.\n\n-- Method: reschedule (when: float | None)\n\nReschedule the timeout.\n\n-- Method: expired () -> bool\n\nReturn whether the context manager has exceeded its\ndeadline (expired).\n\nExample:\n\nasync def main():\ntry:\n# We do not know the timeout when starting, so we pass ``None``.\nasync with asyncio.timeout(None) as cm:\n# We know the timeout now, so we reschedule it.\nnewdeadline = getrunningloop().time() + 10\ncm.reschedule(newdeadline)\n\nawait longrunningtask()\nexcept TimeoutError:\npass\n\nif cm.expired():\nprint(\"Looks like we haven't finished on time.\")\n\nTimeout context managers can be safely nested.\n\nNew in version 3.11.\n\n-- Function: asyncio.timeoutat (when)\n\nSimilar to *note asyncio.timeout(): 3c7, except 'when' is the\nabsolute time to stop waiting, or 'None'.\n\nExample:\n\nasync def main():\nloop = getrunningloop()\ndeadline = loop.time() + 20\ntry:\nasync with asyncio.timeoutat(deadline):\nawait longrunningtask()\nexcept TimeoutError:\nprint(\"The long operation timed out, but we've handled it.\")\n\nprint(\"This statement will run regardless.\")\n\nNew in version 3.11.\n\n-- Function: coroutine asyncio.waitfor (aw, timeout)\n\nWait for the 'aw' *note awaitable: 2edf. to complete with a\ntimeout.\n\nIf 'aw' is a coroutine it is automatically scheduled as a Task.\n\n'timeout' can either be 'None' or a float or int number of seconds\nto wait for.  If 'timeout' is 'None', block until the future\ncompletes.\n\nIf a timeout occurs, it cancels the task and raises *note\nTimeoutError: 62a.\n\nTo avoid the task *note cancellation: 157a, wrap it in *note\nshield(): 89e.\n\nThe function will wait until the future is actually cancelled, so\nthe total wait time may exceed the 'timeout'.  If an exception\nhappens during cancellation, it is propagated.\n\nIf the wait is cancelled, the future 'aw' is also cancelled.\nExample:\n\nasync def eternity():\n# Sleep for one hour\nawait asyncio.sleep(3600)\nprint('yay!')\n\nasync def main():\n# Wait for at most 1 second\ntry:\nawait asyncio.waitfor(eternity(), timeout=1.0)\nexcept TimeoutError:\nprint('timeout!')\n\nasyncio.run(main())\n\n# Expected output:\n#\n#     timeout!\n\nChanged in version 3.7: When 'aw' is cancelled due to a timeout,\n'waitfor' waits for 'aw' to be cancelled.  Previously, it raised\n*note TimeoutError: 62a. immediately.\n\nChanged in version 3.10: Removed the 'loop' parameter.\n\nChanged in version 3.11: Raises *note TimeoutError: 62a. instead of\n*note asyncio.TimeoutError: 148d.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Waiting Primitives,  Next: Running in Threads,  Prev: Timeouts,  Up: Coroutines and Tasks": {
            "content": "5.18.1.16 Waiting Primitives\n............................\n\n-- Function: coroutine asyncio.wait (aws, *, timeout=None,\nreturnwhen=ALLCOMPLETED)\n\nRun *note Future: a11. and *note Task: 201. instances in the 'aws'\niterable concurrently and block until the condition specified by\n'returnwhen'.\n\nThe 'aws' iterable must not be empty.\n\nReturns two sets of Tasks/Futures: '(done, pending)'.\n\nUsage:\n\ndone, pending = await asyncio.wait(aws)\n\n'timeout' (a float or int), if specified, can be used to control\nthe maximum number of seconds to wait before returning.\n\nNote that this function does not raise *note TimeoutError: 62a.\nFutures or Tasks that aren't done when the timeout occurs are\nsimply returned in the second set.\n\n'returnwhen' indicates when this function should return.  It must\nbe one of the following constants:\n\nConstant                                               Description\n\n--------------------------------------------------------------------------------------------------------------\n\n-- Data: asyncio.FIRSTCOMPLETED                      The function will return when any future finishes or\nis cancelled.\n\n\n-- Data: asyncio.FIRSTEXCEPTION                      The function will return when any future finishes by\nraising an exception.  If no future raises an\nexception then it is equivalent to\n*note ALLCOMPLETED: 2ef5.\n\n\n-- Data: asyncio.ALLCOMPLETED                        The function will return when all futures finish or\nare cancelled.\n\n\nUnlike *note waitfor(): 3c8, 'wait()' does not cancel the futures\nwhen a timeout occurs.\n\nChanged in version 3.10: Removed the 'loop' parameter.\n\nChanged in version 3.11: Passing coroutine objects to 'wait()'\ndirectly is forbidden.\n\nChanged in version 3.12: Added support for generators yielding\ntasks.\n\n-- Function: asyncio.ascompleted (aws, *, timeout=None)\n\nRun *note awaitable objects: 2edf. in the 'aws' iterable\nconcurrently.  Return an iterator of coroutines.  Each coroutine\nreturned can be awaited to get the earliest next result from the\niterable of the remaining awaitables.\n\nRaises *note TimeoutError: 62a. if the timeout occurs before all\nFutures are done.\n\nExample:\n\nfor coro in ascompleted(aws):\nearliestresult = await coro\n# ...\n\nChanged in version 3.10: Removed the 'loop' parameter.\n\nDeprecated since version 3.10: Deprecation warning is emitted if\nnot all awaitable objects in the 'aws' iterable are Future-like\nobjects and there is no running event loop.\n\nChanged in version 3.12: Added support for generators yielding\ntasks.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Running in Threads,  Next: Scheduling From Other Threads,  Prev: Waiting Primitives,  Up: Coroutines and Tasks": {
            "content": "5.18.1.17 Running in Threads\n............................\n\n-- Function: coroutine asyncio.tothread (func, /, *args, kwargs)\n\nAsynchronously run function 'func' in a separate thread.\n\nAny *args and kwargs supplied for this function are directly\npassed to 'func'.  Also, the current *note contextvars.Context:\n2ea5. is propagated, allowing context variables from the event loop\nthread to be accessed in the separate thread.\n\nReturn a coroutine that can be awaited to get the eventual result\nof 'func'.\n\nThis coroutine function is primarily intended to be used for\nexecuting IO-bound functions/methods that would otherwise block the\nevent loop if they were run in the main thread.  For example:\n\ndef blockingio():\nprint(f\"start blockingio at {time.strftime('%X')}\")\n# Note that time.sleep() can be replaced with any blocking\n# IO-bound operation, such as file operations.\ntime.sleep(1)\nprint(f\"blockingio complete at {time.strftime('%X')}\")\n\nasync def main():\nprint(f\"started main at {time.strftime('%X')}\")\n\nawait asyncio.gather(\nasyncio.tothread(blockingio),\nasyncio.sleep(1))\n\nprint(f\"finished main at {time.strftime('%X')}\")\n\n\nasyncio.run(main())\n\n# Expected output:\n#\n# started main at 19:50:53\n# start blockingio at 19:50:53\n# blockingio complete at 19:50:54\n# finished main at 19:50:54\n\nDirectly calling 'blockingio()' in any coroutine would block the\nevent loop for its duration, resulting in an additional 1 second of\nrun time.  Instead, by using 'asyncio.tothread()', we can run it\nin a separate thread without blocking the event loop.\n\nNote: Due to the *note GIL: 6c0, 'asyncio.tothread()' can\ntypically only be used to make IO-bound functions\nnon-blocking.  However, for extension modules that release the\nGIL or alternative Python implementations that don't have one,\n'asyncio.tothread()' can also be used for CPU-bound\nfunctions.\n\nNew in version 3.9.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Scheduling From Other Threads,  Next: Introspection,  Prev: Running in Threads,  Up: Coroutines and Tasks": {
            "content": "5.18.1.18 Scheduling From Other Threads\n.......................................\n\n-- Function: asyncio.runcoroutinethreadsafe (coro, loop)\n\nSubmit a coroutine to the given event loop.  Thread-safe.\n\nReturn a *note concurrent.futures.Future: 1025. to wait for the\nresult from another OS thread.\n\nThis function is meant to be called from a different OS thread than\nthe one where the event loop is running.  Example:\n\n# Create a coroutine\ncoro = asyncio.sleep(1, result=3)\n\n# Submit the coroutine to a given loop\nfuture = asyncio.runcoroutinethreadsafe(coro, loop)\n\n# Wait for the result with an optional timeout argument\nassert future.result(timeout) == 3\n\nIf an exception is raised in the coroutine, the returned Future\nwill be notified.  It can also be used to cancel the task in the\nevent loop:\n\ntry:\nresult = future.result(timeout)\nexcept TimeoutError:\nprint('The coroutine took too long, cancelling the task...')\nfuture.cancel()\nexcept Exception as exc:\nprint(f'The coroutine raised an exception: {exc!r}')\nelse:\nprint(f'The coroutine returned: {result!r}')\n\nSee the *note concurrency and multithreading: 2ef8. section of the\ndocumentation.\n\nUnlike other asyncio functions this function requires the 'loop'\nargument to be passed explicitly.\n\nNew in version 3.5.1.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Introspection,  Next: Task Object,  Prev: Scheduling From Other Threads,  Up: Coroutines and Tasks": {
            "content": "5.18.1.19 Introspection\n.......................\n\n-- Function: asyncio.currenttask (loop=None)\n\nReturn the currently running *note Task: 201. instance, or 'None'\nif no task is running.\n\nIf 'loop' is 'None' *note getrunningloop(): 942. is used to get\nthe current loop.\n\nNew in version 3.7.\n\n-- Function: asyncio.alltasks (loop=None)\n\nReturn a set of not yet finished *note Task: 201. objects run by\nthe loop.\n\nIf 'loop' is 'None', *note getrunningloop(): 942. is used for\ngetting current loop.\n\nNew in version 3.7.\n\n-- Function: asyncio.iscoroutine (obj)\n\nReturn 'True' if 'obj' is a coroutine object.\n\nNew in version 3.4.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Task Object,  Prev: Introspection,  Up: Coroutines and Tasks": {
            "content": "5.18.1.20 Task Object\n.....................\n\n-- Class: asyncio.Task (coro, *, loop=None, name=None, context=None,\neagerstart=False)\n\nA *note Future-like: a11. object that runs a Python *note\ncoroutine: 2ec9.  Not thread-safe.\n\nTasks are used to run coroutines in event loops.  If a coroutine\nawaits on a Future, the Task suspends the execution of the\ncoroutine and waits for the completion of the Future.  When the\nFuture is 'done', the execution of the wrapped coroutine resumes.\n\nEvent loops use cooperative scheduling: an event loop runs one Task\nat a time.  While a Task awaits for the completion of a Future, the\nevent loop runs other Tasks, callbacks, or performs IO operations.\n\nUse the high-level *note asyncio.createtask(): 3c5. function to\ncreate Tasks, or the low-level *note loop.createtask(): 802. or\n*note ensurefuture(): ac1. functions.  Manual instantiation of\nTasks is discouraged.\n\nTo cancel a running Task use the *note cancel(): 157a. method.\nCalling it will cause the Task to throw a *note CancelledError:\n7fe. exception into the wrapped coroutine.  If a coroutine is\nawaiting on a Future object during cancellation, the Future object\nwill be cancelled.\n\n*note cancelled(): 2efb. can be used to check if the Task was\ncancelled.  The method returns 'True' if the wrapped coroutine did\nnot suppress the *note CancelledError: 7fe. exception and was\nactually cancelled.\n\n*note asyncio.Task: 201. inherits from *note Future: a11. all of\nits APIs except *note Future.setresult(): 2efc. and *note\nFuture.setexception(): 2efd.\n\nAn optional keyword-only 'context' argument allows specifying a\ncustom *note contextvars.Context: 2ea5. for the 'coro' to run in.\nIf no 'context' is provided, the Task copies the current context\nand later runs its coroutine in the copied context.\n\nAn optional keyword-only 'eagerstart' argument allows eagerly\nstarting the execution of the *note asyncio.Task: 201. at task\ncreation time.  If set to 'True' and the event loop is running, the\ntask will start executing the coroutine immediately, until the\nfirst time the coroutine blocks.  If the coroutine returns or\nraises without blocking, the task will be finished eagerly and will\nskip scheduling to the event loop.\n\nChanged in version 3.7: Added support for the *note contextvars:\n22. module.\n\nChanged in version 3.8: Added the 'name' parameter.\n\nDeprecated since version 3.10: Deprecation warning is emitted if\n'loop' is not specified and there is no running event loop.\n\nChanged in version 3.11: Added the 'context' parameter.\n\nChanged in version 3.12: Added the 'eagerstart' parameter.\n\n-- Method: done ()\n\nReturn 'True' if the Task is 'done'.\n\nA Task is 'done' when the wrapped coroutine either returned a\nvalue, raised an exception, or the Task was cancelled.\n\n-- Method: result ()\n\nReturn the result of the Task.\n\nIf the Task is 'done', the result of the wrapped coroutine is\nreturned (or if the coroutine raised an exception, that\nexception is re-raised.)\n\nIf the Task has been 'cancelled', this method raises a *note\nCancelledError: 7fe. exception.\n\nIf the Task's result isn't yet available, this method raises a\n*note InvalidStateError: 2f00. exception.\n\n-- Method: exception ()\n\nReturn the exception of the Task.\n\nIf the wrapped coroutine raised an exception that exception is\nreturned.  If the wrapped coroutine returned normally this\nmethod returns 'None'.\n\nIf the Task has been 'cancelled', this method raises a *note\nCancelledError: 7fe. exception.\n\nIf the Task isn't 'done' yet, this method raises an *note\nInvalidStateError: 2f00. exception.\n\n-- Method: adddonecallback (callback, *, context=None)\n\nAdd a callback to be run when the Task is 'done'.\n\nThis method should only be used in low-level callback-based\ncode.\n\nSee the documentation of *note Future.adddonecallback():\n93f. for more details.\n\n-- Method: removedonecallback (callback)\n\nRemove 'callback' from the callbacks list.\n\nThis method should only be used in low-level callback-based\ncode.\n\nSee the documentation of *note Future.removedonecallback():\n151c. for more details.\n\n-- Method: getstack (*, limit=None)\n\nReturn the list of stack frames for this Task.\n\nIf the wrapped coroutine is not done, this returns the stack\nwhere it is suspended.  If the coroutine has completed\nsuccessfully or was cancelled, this returns an empty list.  If\nthe coroutine was terminated by an exception, this returns the\nlist of traceback frames.\n\nThe frames are always ordered from oldest to newest.\n\nOnly one stack frame is returned for a suspended coroutine.\n\nThe optional 'limit' argument sets the maximum number of\nframes to return; by default all available frames are\nreturned.  The ordering of the returned list differs depending\non whether a stack or a traceback is returned: the newest\nframes of a stack are returned, but the oldest frames of a\ntraceback are returned.  (This matches the behavior of the\ntraceback module.)\n\n-- Method: printstack (*, limit=None, file=None)\n\nPrint the stack or traceback for this Task.\n\nThis produces output similar to that of the traceback module\nfor the frames retrieved by *note getstack(): 2f04.\n\nThe 'limit' argument is passed to *note getstack(): 2f04.\ndirectly.\n\nThe 'file' argument is an I/O stream to which the output is\nwritten; by default output is written to *note sys.stdout:\n90c.\n\n-- Method: getcoro ()\n\nReturn the coroutine object wrapped by the *note Task: 201.\n\nNote: This will return 'None' for Tasks which have\nalready completed eagerly.  See the *note Eager Task\nFactory: 2eea.\n\nNew in version 3.8.\n\nChanged in version 3.12: Newly added eager task execution\nmeans result may be 'None'.\n\n-- Method: getcontext ()\n\nReturn the *note contextvars.Context: 2ea5. object associated\nwith the task.\n\nNew in version 3.12.\n\n-- Method: getname ()\n\nReturn the name of the Task.\n\nIf no name has been explicitly assigned to the Task, the\ndefault asyncio Task implementation generates a default name\nduring instantiation.\n\nNew in version 3.8.\n\n-- Method: setname (value)\n\nSet the name of the Task.\n\nThe 'value' argument can be any object, which is then\nconverted to a string.\n\nIn the default Task implementation, the name will be visible\nin the *note repr(): 5f0. output of a task object.\n\nNew in version 3.8.\n\n-- Method: cancel (msg=None)\n\nRequest the Task to be cancelled.\n\nThis arranges for a *note CancelledError: 7fe. exception to be\nthrown into the wrapped coroutine on the next cycle of the\nevent loop.\n\nThe coroutine then has a chance to clean up or even deny the\nrequest by suppressing the exception with a *note try: 4bc. ...\n... 'except CancelledError' ... *note finally: 7ee. block.\nTherefore, unlike *note Future.cancel(): 1579, *note\nTask.cancel(): 157a. does not guarantee that the Task will be\ncancelled, although suppressing cancellation completely is not\ncommon and is actively discouraged.  Should the coroutine\nnevertheless decide to suppress the cancellation, it needs to\ncall *note Task.uncancel(): 3d4. in addition to catching the\nexception.\n\nChanged in version 3.9: Added the 'msg' parameter.\n\nChanged in version 3.11: The 'msg' parameter is propagated\nfrom cancelled task to its awaiter.\n\nThe following example illustrates how coroutines can intercept\nthe cancellation request:\n\nasync def cancelme():\nprint('cancelme(): before sleep')\n\ntry:\n# Wait for 1 hour\nawait asyncio.sleep(3600)\nexcept asyncio.CancelledError:\nprint('cancelme(): cancel sleep')\nraise\nfinally:\nprint('cancelme(): after sleep')\n\nasync def main():\n# Create a \"cancelme\" Task\ntask = asyncio.createtask(cancelme())\n\n# Wait for 1 second\nawait asyncio.sleep(1)\n\ntask.cancel()\ntry:\nawait task\nexcept asyncio.CancelledError:\nprint(\"main(): cancelme is cancelled now\")\n\nasyncio.run(main())\n\n# Expected output:\n#\n#     cancelme(): before sleep\n#     cancelme(): cancel sleep\n#     cancelme(): after sleep\n#     main(): cancelme is cancelled now\n\n-- Method: cancelled ()\n\nReturn 'True' if the Task is 'cancelled'.\n\nThe Task is 'cancelled' when the cancellation was requested\nwith *note cancel(): 157a. and the wrapped coroutine\npropagated the *note CancelledError: 7fe. exception thrown\ninto it.\n\n-- Method: uncancel ()\n\nDecrement the count of cancellation requests to this Task.\n\nReturns the remaining number of cancellation requests.\n\nNote that once execution of a cancelled task completed,\nfurther calls to *note uncancel(): 3d4. are ineffective.\n\nNew in version 3.11.\n\nThis method is used by asyncio's internals and isn't expected\nto be used by end-user code.  In particular, if a Task gets\nsuccessfully uncancelled, this allows for elements of\nstructured concurrency like *note Task Groups: 2ee5. and *note\nasyncio.timeout(): 3c7. to continue running, isolating\ncancellation to the respective structured block.  For example:\n\nasync def makerequestwithtimeout():\ntry:\nasync with asyncio.timeout(1):\n# Structured block affected by the timeout:\nawait makerequest()\nawait makeanotherrequest()\nexcept TimeoutError:\nlog(\"There was a timeout\")\n# Outer code not affected by the timeout:\nawait unrelatedcode()\n\nWhile the block with 'makerequest()' and\n'makeanotherrequest()' might get cancelled due to the\ntimeout, 'unrelatedcode()' should continue running even in\ncase of the timeout.  This is implemented with *note\nuncancel(): 3d4.  *note TaskGroup: 3c3. context managers use\n*note uncancel(): 3d4. in a similar fashion.\n\nIf end-user code is, for some reason, suppresing cancellation\nby catching *note CancelledError: 7fe, it needs to call this\nmethod to remove the cancellation state.\n\n-- Method: cancelling ()\n\nReturn the number of pending cancellation requests to this\nTask, i.e., the number of calls to *note cancel(): 157a. less\nthe number of *note uncancel(): 3d4. calls.\n\nNote that if this number is greater than zero but the Task is\nstill executing, *note cancelled(): 2efb. will still return\n'False'.  This is because this number can be lowered by\ncalling *note uncancel(): 3d4, which can lead to the task not\nbeing cancelled after all if the cancellation requests go down\nto zero.\n\nThis method is used by asyncio's internals and isn't expected\nto be used by end-user code.  See *note uncancel(): 3d4. for\nmore details.\n\nNew in version 3.11.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Streams,  Next: Synchronization Primitives,  Prev: Coroutines and Tasks,  Up: asyncio -- Asynchronous I/O": {
            "content": "5.18.1.21 Streams\n.................\n\n'Source code:' Lib/asyncio/streams.py(1)\n\n\n",
            "subsections": []
        },
        "Streams are high-level async/await-ready primitives to work with network": {
            "content": "connections.  Streams allow sending and receiving data without using\ncallbacks or low-level protocols and transports.  Here is an example of\na TCP echo client written using asyncio streams:\n\nimport asyncio\n\nasync def tcpechoclient(message):\nreader, writer = await asyncio.openconnection(\n'127.0.0.1', 8888)\n\nprint(f'Send: {message!r}')\nwriter.write(message.encode())\nawait writer.drain()\n\ndata = await reader.read(100)\nprint(f'Received: {data.decode()!r}')\n\nprint('Close the connection')\nwriter.close()\nawait writer.waitclosed()\n\nasyncio.run(tcpechoclient('Hello World!'))\n\nSee also the *note Examples: 2f0a. section below.\n",
            "subsections": []
        },
        "Stream Functions": {
            "content": "................\n",
            "subsections": []
        },
        "The following top-level asyncio functions can be used to create and work": {
            "content": "with streams:\n\n-- Function: coroutine asyncio.openconnection (host=None, port=None,\n*, limit=None, ssl=None, family=0, proto=0, flags=0,\nsock=None, localaddr=None, serverhostname=None,\nsslhandshaketimeout=None, sslshutdowntimeout=None,\nhappyeyeballsdelay=None, interleave=None)\n\nEstablish a network connection and return a pair of '(reader,\nwriter)' objects.\n\nThe returned 'reader' and 'writer' objects are instances of *note\nStreamReader: 1628. and *note StreamWriter: 1419. classes.\n\n'limit' determines the buffer size limit used by the returned *note\nStreamReader: 1628. instance.  By default the 'limit' is set to 64\nKiB.\n\nThe rest of the arguments are passed directly to *note\nloop.createconnection(): 3cc.\n\nNote: The 'sock' argument transfers ownership of the socket to\nthe *note StreamWriter: 1419. created.  To close the socket,\ncall its *note close(): 2f0b. method.\n\nChanged in version 3.7: Added the 'sslhandshaketimeout'\nparameter.\n\nChanged in version 3.8: Added the 'happyeyeballsdelay' and\n'interleave' parameters.\n\nChanged in version 3.10: Removed the 'loop' parameter.\n\nChanged in version 3.11: Added the 'sslshutdowntimeout'\nparameter.\n\n-- Function: coroutine asyncio.startserver (clientconnectedcb,\nhost=None, port=None, *, limit=None, family=socket.AFUNSPEC,\nflags=socket.AIPASSIVE, sock=None, backlog=100, ssl=None,\nreuseaddress=None, reuseport=None,\nsslhandshaketimeout=None, sslshutdowntimeout=None,\nstartserving=True)\n\nStart a socket server.\n\nThe 'clientconnectedcb' callback is called whenever a new client\nconnection is established.  It receives a '(reader, writer)' pair\nas two arguments, instances of the *note StreamReader: 1628. and\n*note StreamWriter: 1419. classes.\n\n'clientconnectedcb' can be a plain callable or a *note coroutine\nfunction: 2ec9.; if it is a coroutine function, it will be\nautomatically scheduled as a *note Task: 201.\n\n'limit' determines the buffer size limit used by the returned *note\nStreamReader: 1628. instance.  By default the 'limit' is set to 64\nKiB.\n\nThe rest of the arguments are passed directly to *note\nloop.createserver(): 94a.\n\nNote: The 'sock' argument transfers ownership of the socket to\nthe server created.  To close the socket, call the server's\n*note close(): 2f0c. method.\n\nChanged in version 3.7: Added the 'sslhandshaketimeout' and\n'startserving' parameters.\n\nChanged in version 3.10: Removed the 'loop' parameter.\n\nChanged in version 3.11: Added the 'sslshutdowntimeout'\nparameter.\n",
            "subsections": []
        },
        "Unix Sockets": {
            "content": "............\n\n-- Function: coroutine asyncio.openunixconnection (path=None, *,\nlimit=None, ssl=None, sock=None, serverhostname=None,\nsslhandshaketimeout=None, sslshutdowntimeout=None)\n\nEstablish a Unix socket connection and return a pair of\n'(reader, writer)'.\n\nSimilar to *note openconnection(): 950. but operates on Unix\nsockets.\n\nSee also the documentation of *note\nloop.createunixconnection(): 2f0e.\n\nNote: The 'sock' argument transfers ownership of the\nsocket to the *note StreamWriter: 1419. created.  To\nclose the socket, call its *note close(): 2f0b. method.\n\n*note Availability: 1ad3.: Unix.\n\nChanged in version 3.7: Added the 'sslhandshaketimeout'\nparameter.  The 'path' parameter can now be a *note path-like\nobject: 957.\n\nChanged in version 3.10: Removed the 'loop' parameter.\n\nChanged in version 3.11: Added the 'sslshutdowntimeout'\nparameter.\n\n-- Function: coroutine asyncio.startunixserver (clientconnectedcb,\npath=None, *, limit=None, sock=None, backlog=100, ssl=None,\nsslhandshaketimeout=None, sslshutdowntimeout=None,\nstartserving=True)\n\nStart a Unix socket server.\n\nSimilar to *note startserver(): 951. but works with Unix sockets.\n\nSee also the documentation of *note loop.createunixserver(): 94b.\n\nNote: The 'sock' argument transfers ownership of the socket to\nthe server created.  To close the socket, call the server's\n*note close(): 2f0c. method.\n\n*note Availability: 1ad3.: Unix.\n\nChanged in version 3.7: Added the 'sslhandshaketimeout' and\n'startserving' parameters.  The 'path' parameter can now be a\n*note path-like object: 957.\n\nChanged in version 3.10: Removed the 'loop' parameter.\n\nChanged in version 3.11: Added the 'sslshutdowntimeout'\nparameter.\n\n* Menu:\n\n* StreamReader::\n* StreamWriter::\n* Examples: Examples<14>.\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/asyncio/streams.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: StreamReader,  Next: StreamWriter,  Up: Streams": {
            "content": "5.18.1.22 StreamReader\n......................\n\n-- Class: asyncio.StreamReader\n\nRepresents a reader object that provides APIs to read data from the\nIO stream.  As an *note asynchronous iterable: bd2, the object\nsupports the *note async for: 8e0. statement.\n\nIt is not recommended to instantiate 'StreamReader' objects\ndirectly; use *note openconnection(): 950. and *note\nstartserver(): 951. instead.\n\n-- Method: feedeof ()\n\nAcknowledge the EOF.\n\n-- Method: coroutine read (n=-1)\n\nRead up to 'n' bytes from the stream.\n\nIf 'n' is not provided or set to '-1', read until EOF, then\nreturn all read *note bytes: 295.  If EOF was received and the\ninternal buffer is empty, return an empty 'bytes' object.\n\nIf 'n' is '0', return an empty 'bytes' object immediately.\n\nIf 'n' is positive, return at most 'n' available 'bytes' as\nsoon as at least 1 byte is available in the internal buffer.\nIf EOF is received before any byte is read, return an empty\n'bytes' object.\n\n-- Method: coroutine readline ()\n\nRead one line, where \"line\" is a sequence of bytes ending with\n'\\n'.\n\nIf EOF is received and '\\n' was not found, the method returns\npartially read data.\n\nIf EOF is received and the internal buffer is empty, return an\nempty 'bytes' object.\n\n-- Method: coroutine readexactly (n)\n\nRead exactly 'n' bytes.\n\nRaise an *note IncompleteReadError: 1684. if EOF is reached\nbefore 'n' can be read.  Use the *note\nIncompleteReadError.partial: 2f14. attribute to get the\npartially read data.\n\n-- Method: coroutine readuntil (separator=b'\\n')\n\nRead data from the stream until 'separator' is found.\n\nOn success, the data and separator will be removed from the\ninternal buffer (consumed).  Returned data will include the\nseparator at the end.\n\nIf the amount of data read exceeds the configured stream\nlimit, a *note LimitOverrunError: 2f15. exception is raised,\nand the data is left in the internal buffer and can be read\nagain.\n\nIf EOF is reached before the complete separator is found, an\n*note IncompleteReadError: 1684. exception is raised, and the\ninternal buffer is reset.  The *note\nIncompleteReadError.partial: 2f14. attribute may contain a\nportion of the separator.\n\nNew in version 3.5.2.\n\n-- Method: ateof ()\n\nReturn 'True' if the buffer is empty and *note feedeof():\n2f11. was called.\n\nFile: python3.12.info,  Node: StreamWriter,  Next: Examples<14>,  Prev: StreamReader,  Up: Streams\n\n5.18.1.23 StreamWriter\n......................\n\n-- Class: asyncio.StreamWriter\n\nRepresents a writer object that provides APIs to write data to the\nIO stream.\n\nIt is not recommended to instantiate 'StreamWriter' objects\ndirectly; use *note openconnection(): 950. and *note\nstartserver(): 951. instead.\n\n-- Method: write (data)\n\nThe method attempts to write the 'data' to the underlying\nsocket immediately.  If that fails, the data is queued in an\ninternal write buffer until it can be sent.\n\nThe method should be used along with the 'drain()' method:\n\nstream.write(data)\nawait stream.drain()\n\n-- Method: writelines (data)\n\nThe method writes a list (or any iterable) of bytes to the\nunderlying socket immediately.  If that fails, the data is\nqueued in an internal write buffer until it can be sent.\n\nThe method should be used along with the 'drain()' method:\n\nstream.writelines(lines)\nawait stream.drain()\n\n-- Method: close ()\n\nThe method closes the stream and the underlying socket.\n\nThe method should be used, though not mandatory, along with\nthe 'waitclosed()' method:\n\nstream.close()\nawait stream.waitclosed()\n\n-- Method: canwriteeof ()\n\nReturn 'True' if the underlying transport supports the *note\nwriteeof(): 2f1b. method, 'False' otherwise.\n\n-- Method: writeeof ()\n\nClose the write end of the stream after the buffered write\ndata is flushed.\n\n-- Attribute: transport\n\nReturn the underlying asyncio transport.\n\n-- Method: getextrainfo (name, default=None)\n\nAccess optional transport information; see *note\nBaseTransport.getextrainfo(): 8d0. for details.\n\n-- Method: coroutine drain ()\n\nWait until it is appropriate to resume writing to the stream.\nExample:\n\nwriter.write(data)\nawait writer.drain()\n\nThis is a flow control method that interacts with the\nunderlying IO write buffer.  When the size of the buffer\nreaches the high watermark, 'drain()' blocks until the size of\nthe buffer is drained down to the low watermark and writing\ncan be resumed.  When there is nothing to wait for, the *note\ndrain(): 1503. returns immediately.\n\n-- Method: coroutine starttls (sslcontext, *,\nserverhostname=None, sslhandshaketimeout=None,\nsslshutdowntimeout=None)\n\nUpgrade an existing stream-based connection to TLS.\n\nParameters:\n\n* 'sslcontext': a configured instance of *note SSLContext:\n278.\n\n* 'serverhostname': sets or overrides the host name that\nthe target server's certificate will be matched against.\n\n* 'sslhandshaketimeout' is the time in seconds to wait\nfor the TLS handshake to complete before aborting the\nconnection.  '60.0' seconds if 'None' (default).\n\n* 'sslshutdowntimeout' is the time in seconds to wait for\nthe SSL shutdown to complete before aborting the\nconnection.  '30.0' seconds if 'None' (default).\n\nNew in version 3.11.\n\nChanged in version 3.12: Added the 'sslshutdowntimeout'\nparameter.\n\n-- Method: isclosing ()\n\nReturn 'True' if the stream is closed or in the process of\nbeing closed.\n\nNew in version 3.7.\n\n-- Method: coroutine waitclosed ()\n\nWait until the stream is closed.\n\nShould be called after *note close(): 2f0b. to wait until the\nunderlying connection is closed, ensuring that all data has\nbeen flushed before e.g.  exiting the program.\n\nNew in version 3.7.\n\nFile: python3.12.info,  Node: Examples<14>,  Prev: StreamWriter,  Up: Streams\n\n5.18.1.24 Examples\n..................\n\n* Menu:\n\n* TCP echo client using streams::\n* TCP echo server using streams::\n* Get HTTP headers::\n* Register an open socket to wait for data using streams::\n\nFile: python3.12.info,  Node: TCP echo client using streams,  Next: TCP echo server using streams,  Up: Examples<14>\n\n5.18.1.25 TCP echo client using streams\n.......................................\n\nTCP echo client using the *note asyncio.openconnection(): 950.\nfunction:\n\nimport asyncio\n\nasync def tcpechoclient(message):\nreader, writer = await asyncio.openconnection(\n'127.0.0.1', 8888)\n\nprint(f'Send: {message!r}')\nwriter.write(message.encode())\nawait writer.drain()\n\ndata = await reader.read(100)\nprint(f'Received: {data.decode()!r}')\n\nprint('Close the connection')\nwriter.close()\nawait writer.waitclosed()\n\nasyncio.run(tcpechoclient('Hello World!'))\n\nSee also\n........\n\nThe *note TCP echo client protocol: 2f20. example uses the low-level\n*note loop.createconnection(): 3cc. method.\n\nFile: python3.12.info,  Node: TCP echo server using streams,  Next: Get HTTP headers,  Prev: TCP echo client using streams,  Up: Examples<14>\n\n5.18.1.26 TCP echo server using streams\n.......................................\n\nTCP echo server using the *note asyncio.startserver(): 951. function:\n\nimport asyncio\n\nasync def handleecho(reader, writer):\ndata = await reader.read(100)\nmessage = data.decode()\naddr = writer.getextrainfo('peername')\n\nprint(f\"Received {message!r} from {addr!r}\")\n\nprint(f\"Send: {message!r}\")\nwriter.write(data)\nawait writer.drain()\n\nprint(\"Close the connection\")\nwriter.close()\nawait writer.waitclosed()\n\nasync def main():\nserver = await asyncio.startserver(\nhandleecho, '127.0.0.1', 8888)\n\naddrs = ', '.join(str(sock.getsockname()) for sock in server.sockets)\nprint(f'Serving on {addrs}')\n\nasync with server:\nawait server.serveforever()\n\nasyncio.run(main())\n\nSee also\n........\n\nThe *note TCP echo server protocol: 2f23. example uses the *note\nloop.createserver(): 94a. method.\n\nFile: python3.12.info,  Node: Get HTTP headers,  Next: Register an open socket to wait for data using streams,  Prev: TCP echo server using streams,  Up: Examples<14>\n\n5.18.1.27 Get HTTP headers\n..........................\n",
            "subsections": []
        },
        "Simple example querying HTTP headers of the URL passed on the command": {
            "content": "line:\n\nimport asyncio\nimport urllib.parse\nimport sys\n\nasync def printhttpheaders(url):\nurl = urllib.parse.urlsplit(url)\nif url.scheme == 'https':\nreader, writer = await asyncio.openconnection(\nurl.hostname, 443, ssl=True)\nelse:\nreader, writer = await asyncio.openconnection(\nurl.hostname, 80)\n\nquery = (\nf\"HEAD {url.path or '/'} HTTP/1.0\\r\\n\"\nf\"Host: {url.hostname}\\r\\n\"\nf\"\\r\\n\"\n)\n\nwriter.write(query.encode('latin-1'))\nwhile True:\nline = await reader.readline()\nif not line:\nbreak\n\nline = line.decode('latin1').rstrip()\nif line:\nprint(f'HTTP header> {line}')\n\n# Ignore the body, close the socket\nwriter.close()\nawait writer.waitclosed()\n\nurl = sys.argv[1]\nasyncio.run(printhttpheaders(url))\n\nUsage:\n\npython example.py http://example.com/path/page.html\n\nor with HTTPS:\n\npython example.py https://example.com/path/page.html\n\nFile: python3.12.info,  Node: Register an open socket to wait for data using streams,  Prev: Get HTTP headers,  Up: Examples<14>\n\n5.18.1.28 Register an open socket to wait for data using streams\n................................................................\n\nCoroutine waiting until a socket receives data using the *note\nopenconnection(): 950. function:\n\nimport asyncio\nimport socket\n\nasync def waitfordata():\n# Get a reference to the current event loop because\n# we want to access low-level APIs.\nloop = asyncio.getrunningloop()\n\n# Create a pair of connected sockets.\nrsock, wsock = socket.socketpair()\n\n# Register the open socket to wait for data.\nreader, writer = await asyncio.openconnection(sock=rsock)\n\n# Simulate the reception of data from the network\nloop.callsoon(wsock.send, 'abc'.encode())\n\n# Wait for data\ndata = await reader.read(100)\n\n# Got data, we are done: close the socket\nprint(\"Received:\", data.decode())\nwriter.close()\nawait writer.waitclosed()\n\n# Close the second socket\nwsock.close()\n\nasyncio.run(waitfordata())\n\nSee also\n........\n\nThe *note register an open socket to wait for data using a protocol:\n2f27. example uses a low-level protocol and the *note\nloop.createconnection(): 3cc. method.\n\nThe *note watch a file descriptor for read events: 2f28. example uses\nthe low-level *note loop.addreader(): 2f29. method to watch a file\ndescriptor.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Synchronization Primitives,  Next: Subprocesses,  Prev: Streams,  Up: asyncio -- Asynchronous I/O": {
            "content": "5.18.1.29 Synchronization Primitives\n....................................\n\n'Source code:' Lib/asyncio/locks.py(1)\n\n\n\nasyncio synchronization primitives are designed to be similar to those\nof the *note threading: e7. module with two important caveats:\n\n* asyncio primitives are not thread-safe, therefore they should not\nbe used for OS thread synchronization (use *note threading: e7. for\nthat);\n\n* methods of these synchronization primitives do not accept the\n'timeout' argument; use the *note asyncio.waitfor(): 3c8. function\nto perform operations with timeouts.\n\nasyncio has the following basic synchronization primitives:\n\n* *note Lock: 89f.\n\n* *note Event: 8a0.\n\n* *note Condition: 8a1.\n\n* *note Semaphore: 8a2.\n\n* *note BoundedSemaphore: 8a3.\n\n* *note Barrier: 3ca.\n\n\n\n* Menu:\n\n* Lock::\n* Event::\n* Condition::\n* Semaphore::\n* BoundedSemaphore::\n* Barrier::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/asyncio/locks.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Lock,  Next: Event,  Up: Synchronization Primitives": {
            "content": "5.18.1.30 Lock\n..............\n\n-- Class: asyncio.Lock\n\nImplements a mutex lock for asyncio tasks.  Not thread-safe.\n\nAn asyncio lock can be used to guarantee exclusive access to a\nshared resource.\n\nThe preferred way to use a Lock is an *note async with: 399.\nstatement:\n\nlock = asyncio.Lock()\n\n# ... later\nasync with lock:\n# access shared state\n\nwhich is equivalent to:\n\nlock = asyncio.Lock()\n\n# ... later\nawait lock.acquire()\ntry:\n# access shared state\nfinally:\nlock.release()\n\nChanged in version 3.10: Removed the 'loop' parameter.\n\n-- Method: coroutine acquire ()\n\nAcquire the lock.\n\nThis method waits until the lock is 'unlocked', sets it to\n'locked' and returns 'True'.\n\nWhen more than one coroutine is blocked in *note acquire():\n2f2d. waiting for the lock to be unlocked, only one coroutine\neventually proceeds.\n\nAcquiring a lock is 'fair': the coroutine that proceeds will\nbe the first coroutine that started waiting on the lock.\n\n-- Method: release ()\n\nRelease the lock.\n\nWhen the lock is 'locked', reset it to 'unlocked' and return.\n\nIf the lock is 'unlocked', a *note RuntimeError: 17a. is\nraised.\n\n-- Method: locked ()\n\nReturn 'True' if the lock is 'locked'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Event,  Next: Condition,  Prev: Lock,  Up: Synchronization Primitives": {
            "content": "5.18.1.31 Event\n...............\n\n-- Class: asyncio.Event\n\nAn event object.  Not thread-safe.\n\nAn asyncio event can be used to notify multiple asyncio tasks that\nsome event has happened.\n\nAn Event object manages an internal flag that can be set to 'true'\nwith the *note set(): 2f31. method and reset to 'false' with the\n*note clear(): 2f32. method.  The *note wait(): 2f33. method blocks\nuntil the flag is set to 'true'.  The flag is set to 'false'\ninitially.\n\nChanged in version 3.10: Removed the 'loop' parameter.\n\nExample:\n\nasync def waiter(event):\nprint('waiting for it ...')\nawait event.wait()\nprint('... got it!')\n\nasync def main():\n# Create an Event object.\nevent = asyncio.Event()\n\n# Spawn a Task to wait until 'event' is set.\nwaitertask = asyncio.createtask(waiter(event))\n\n# Sleep for 1 second and set the event.\nawait asyncio.sleep(1)\nevent.set()\n\n# Wait until the waiter task is finished.\nawait waitertask\n\nasyncio.run(main())\n\n-- Method: coroutine wait ()\n\nWait until the event is set.\n\nIf the event is set, return 'True' immediately.  Otherwise\nblock until another task calls *note set(): 2f31.\n\n-- Method: set ()\n\nSet the event.\n\nAll tasks waiting for event to be set will be immediately\nawakened.\n\n-- Method: clear ()\n\nClear (unset) the event.\n\nTasks awaiting on *note wait(): 2f33. will now block until the\n*note set(): 2f31. method is called again.\n\n-- Method: isset ()\n\nReturn 'True' if the event is set.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Condition,  Next: Semaphore,  Prev: Event,  Up: Synchronization Primitives": {
            "content": "5.18.1.32 Condition\n...................\n\n-- Class: asyncio.Condition (lock=None)\n\nA Condition object.  Not thread-safe.\n\nAn asyncio condition primitive can be used by a task to wait for\nsome event to happen and then get exclusive access to a shared\nresource.\n\nIn essence, a Condition object combines the functionality of an\n*note Event: 8a0. and a *note Lock: 89f.  It is possible to have\nmultiple Condition objects share one Lock, which allows\ncoordinating exclusive access to a shared resource between\ndifferent tasks interested in particular states of that shared\nresource.\n\nThe optional 'lock' argument must be a *note Lock: 89f. object or\n'None'.  In the latter case a new Lock object is created\nautomatically.\n\nChanged in version 3.10: Removed the 'loop' parameter.\n\nThe preferred way to use a Condition is an *note async with: 399.\nstatement:\n\ncond = asyncio.Condition()\n\n# ... later\nasync with cond:\nawait cond.wait()\n\nwhich is equivalent to:\n\ncond = asyncio.Condition()\n\n# ... later\nawait cond.acquire()\ntry:\nawait cond.wait()\nfinally:\ncond.release()\n\n-- Method: coroutine acquire ()\n\nAcquire the underlying lock.\n\nThis method waits until the underlying lock is 'unlocked',\nsets it to 'locked' and returns 'True'.\n\n-- Method: notify (n=1)\n\nWake up at most 'n' tasks (1 by default) waiting on this\ncondition.  The method is no-op if no tasks are waiting.\n\nThe lock must be acquired before this method is called and\nreleased shortly after.  If called with an 'unlocked' lock a\n*note RuntimeError: 17a. error is raised.\n\n-- Method: locked ()\n\nReturn 'True' if the underlying lock is acquired.\n\n-- Method: notifyall ()\n\nWake up all tasks waiting on this condition.\n\nThis method acts like *note notify(): 2f38, but wakes up all\nwaiting tasks.\n\nThe lock must be acquired before this method is called and\nreleased shortly after.  If called with an 'unlocked' lock a\n*note RuntimeError: 17a. error is raised.\n\n-- Method: release ()\n\nRelease the underlying lock.\n\nWhen invoked on an unlocked lock, a *note RuntimeError: 17a.\nis raised.\n\n-- Method: coroutine wait ()\n\nWait until notified.\n\nIf the calling task has not acquired the lock when this method\nis called, a *note RuntimeError: 17a. is raised.\n\nThis method releases the underlying lock, and then blocks\nuntil it is awakened by a *note notify(): 2f38. or *note\nnotifyall(): 2f3a. call.  Once awakened, the Condition\nre-acquires its lock and this method returns 'True'.\n\n-- Method: coroutine waitfor (predicate)\n\nWait until a predicate becomes 'true'.\n\nThe predicate must be a callable which result will be\ninterpreted as a boolean value.  The final value is the return\nvalue.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Semaphore,  Next: BoundedSemaphore,  Prev: Condition,  Up: Synchronization Primitives": {
            "content": "5.18.1.33 Semaphore\n...................\n\n-- Class: asyncio.Semaphore (value=1)\n\nA Semaphore object.  Not thread-safe.\n\nA semaphore manages an internal counter which is decremented by\neach *note acquire(): 2f3f. call and incremented by each *note\nrelease(): 2f40. call.  The counter can never go below zero; when\n*note acquire(): 2f3f. finds that it is zero, it blocks, waiting\nuntil some task calls *note release(): 2f40.\n\nThe optional 'value' argument gives the initial value for the\ninternal counter ('1' by default).  If the given value is less than\n'0' a *note ValueError: 183. is raised.\n\nChanged in version 3.10: Removed the 'loop' parameter.\n\nThe preferred way to use a Semaphore is an *note async with: 399.\nstatement:\n\nsem = asyncio.Semaphore(10)\n\n# ... later\nasync with sem:\n# work with shared resource\n\nwhich is equivalent to:\n\nsem = asyncio.Semaphore(10)\n\n# ... later\nawait sem.acquire()\ntry:\n# work with shared resource\nfinally:\nsem.release()\n\n-- Method: coroutine acquire ()\n\nAcquire a semaphore.\n\nIf the internal counter is greater than zero, decrement it by\none and return 'True' immediately.  If it is zero, wait until\na *note release(): 2f40. is called and return 'True'.\n\n-- Method: locked ()\n\nReturns 'True' if semaphore can not be acquired immediately.\n\n-- Method: release ()\n\nRelease a semaphore, incrementing the internal counter by one.\nCan wake up a task waiting to acquire the semaphore.\n\nUnlike *note BoundedSemaphore: 8a3, *note Semaphore: 8a2.\nallows making more 'release()' calls than 'acquire()' calls.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: BoundedSemaphore,  Next: Barrier,  Prev: Semaphore,  Up: Synchronization Primitives": {
            "content": "5.18.1.34 BoundedSemaphore\n..........................\n\n-- Class: asyncio.BoundedSemaphore (value=1)\n\nA bounded semaphore object.  Not thread-safe.\n\nBounded Semaphore is a version of *note Semaphore: 8a2. that raises\na *note ValueError: 183. in *note release(): 2f40. if it increases\nthe internal counter above the initial 'value'.\n\nChanged in version 3.10: Removed the 'loop' parameter.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Barrier,  Prev: BoundedSemaphore,  Up: Synchronization Primitives": {
            "content": "5.18.1.35 Barrier\n.................\n\n-- Class: asyncio.Barrier (parties)\n\nA barrier object.  Not thread-safe.\n\nA barrier is a simple synchronization primitive that allows to\nblock until 'parties' number of tasks are waiting on it.  Tasks can\nwait on the *note wait(): 2f44. method and would be blocked until\nthe specified number of tasks end up waiting on *note wait(): 2f44.\nAt that point all of the waiting tasks would unblock\nsimultaneously.\n\n*note async with: 399. can be used as an alternative to awaiting on\n*note wait(): 2f44.\n\nThe barrier can be reused any number of times.  Example:\n\nasync def examplebarrier():\n# barrier with 3 parties\nb = asyncio.Barrier(3)\n\n# create 2 new waiting tasks\nasyncio.createtask(b.wait())\nasyncio.createtask(b.wait())\n\nawait asyncio.sleep(0)\nprint(b)\n\n# The third .wait() call passes the barrier\nawait b.wait()\nprint(b)\nprint(\"barrier passed\")\n\nawait asyncio.sleep(0)\nprint(b)\n\nasyncio.run(examplebarrier())\n\nResult of this example is:\n\n<asyncio.locks.Barrier object at 0x... [filling, waiters:2/3]>\n<asyncio.locks.Barrier object at 0x... [draining, waiters:0/3]>\nbarrier passed\n<asyncio.locks.Barrier object at 0x... [filling, waiters:0/3]>\n\nNew in version 3.11.\n\n-- Method: coroutine wait ()\n\nPass the barrier.  When all the tasks party to the barrier\nhave called this function, they are all unblocked\nsimultaneously.\n\nWhen a waiting or blocked task in the barrier is cancelled,\nthis task exits the barrier which stays in the same state.  If\nthe state of the barrier is \"filling\", the number of waiting\ntask decreases by 1.\n\nThe return value is an integer in the range of 0 to\n'parties-1', different for each task.  This can be used to\nselect a task to do some special housekeeping, e.g.:\n\n...\nasync with barrier as position:\nif position == 0:\n# Only one task prints this\nprint('End of *draining phase*')\n\nThis method may raise a *note BrokenBarrierError: 3cb.\nexception if the barrier is broken or reset while a task is\nwaiting.  It could raise a *note CancelledError: 7fe. if a\ntask is cancelled.\n\n-- Method: coroutine reset ()\n\nReturn the barrier to the default, empty state.  Any tasks\nwaiting on it will receive the *note BrokenBarrierError: 3cb.\nexception.\n\nIf a barrier is broken it may be better to just leave it and\ncreate a new one.\n\n-- Method: coroutine abort ()\n\nPut the barrier into a broken state.  This causes any active\nor future calls to *note wait(): 19a. to fail with the *note\nBrokenBarrierError: 3cb.  Use this for example if one of the\ntasks needs to abort, to avoid infinite waiting tasks.\n\n-- Attribute: parties\n\nThe number of tasks required to pass the barrier.\n\n-- Attribute: nwaiting\n\nThe number of tasks currently waiting in the barrier while\nfilling.\n\n-- Attribute: broken\n\nA boolean that is 'True' if the barrier is in the broken\nstate.\n\n-- Exception: asyncio.BrokenBarrierError\n\nThis exception, a subclass of *note RuntimeError: 17a, is raised\nwhen the *note Barrier: 3ca. object is reset or broken.\n\n\n",
            "subsections": []
        },
        "Changed in version 3.9: Acquiring a lock using 'await lock' or 'yield": {
            "content": "from lock' and/or *note with: 396. statement ('with await lock', 'with\n(yield from lock)') was removed.  Use 'async with lock' instead.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Subprocesses,  Next: Queues,  Prev: Synchronization Primitives,  Up: asyncio -- Asynchronous I/O": {
            "content": "5.18.1.36 Subprocesses\n......................\n\n'Source code:' Lib/asyncio/subprocess.py(1),",
            "subsections": []
        },
        "Lib/asyncio/basesubprocess.py(2)": {
            "content": "",
            "subsections": []
        },
        "This section describes high-level async/await asyncio APIs to create and": {
            "content": "manage subprocesses.  Here's an example of how asyncio can run a shell\ncommand and obtain its result:\n\nimport asyncio\n\nasync def run(cmd):\nproc = await asyncio.createsubprocessshell(\ncmd,\nstdout=asyncio.subprocess.PIPE,\nstderr=asyncio.subprocess.PIPE)\n\nstdout, stderr = await proc.communicate()\n\nprint(f'[{cmd!r} exited with {proc.returncode}]')\nif stdout:\nprint(f'[stdout]\\n{stdout.decode()}')\nif stderr:\nprint(f'[stderr]\\n{stderr.decode()}')\n\nasyncio.run(run('ls /zzz'))\n\nwill print:\n\n['ls /zzz' exited with 1]\n[stderr]\nls: /zzz: No such file or directory\n",
            "subsections": []
        },
        "Because all asyncio subprocess functions are asynchronous and asyncio": {
            "content": "provides many tools to work with such functions, it is easy to execute\nand monitor multiple subprocesses in parallel.  It is indeed trivial to\nmodify the above example to run several commands simultaneously:\n\nasync def main():\nawait asyncio.gather(\nrun('ls /zzz'),\nrun('sleep 1; echo \"hello\"'))\n\nasyncio.run(main())\n\nSee also the *note Examples: 2f4e. subsection.\n\n* Menu:\n\n* Creating Subprocesses::\n* Constants: Constants<7>.\n* Interacting with Subprocesses::\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/asyncio/subprocess.py\n\n(2)\nhttps://github.com/python/cpython/tree/3.12/Lib/asyncio/basesubprocess.py\n\nFile: python3.12.info,  Node: Creating Subprocesses,  Next: Constants<7>,  Up: Subprocesses\n\n5.18.1.37 Creating Subprocesses\n...............................\n\n-- Function: coroutine asyncio.createsubprocessexec (program, *args,\nstdin=None, stdout=None, stderr=None, limit=None, kwds)\n\nCreate a subprocess.\n\nThe 'limit' argument sets the buffer limit for *note StreamReader:\n1628. wrappers for 'Process.stdout' and 'Process.stderr' (if *note\nsubprocess.PIPE: 9ca. is passed to 'stdout' and 'stderr'\narguments).\n\nReturn a *note Process: 2f50. instance.\n\nSee the documentation of *note loop.subprocessexec(): 2f51. for\nother parameters.\n\nChanged in version 3.10: Removed the 'loop' parameter.\n\n-- Function: coroutine asyncio.createsubprocessshell (cmd,\nstdin=None, stdout=None, stderr=None, limit=None, kwds)\n\nRun the 'cmd' shell command.\n\nThe 'limit' argument sets the buffer limit for *note StreamReader:\n1628. wrappers for 'Process.stdout' and 'Process.stderr' (if *note\nsubprocess.PIPE: 9ca. is passed to 'stdout' and 'stderr'\narguments).\n\nReturn a *note Process: 2f50. instance.\n\nSee the documentation of *note loop.subprocessshell(): 2f52. for\nother parameters.\n\nImportant: It is the application's responsibility to ensure\nthat all whitespace and special characters are quoted\nappropriately to avoid shell injection(1) vulnerabilities.\nThe *note shlex.quote(): f9c. function can be used to properly\nescape whitespace and special shell characters in strings that\nare going to be used to construct shell commands.\n\nChanged in version 3.10: Removed the 'loop' parameter.\n\nNote: Subprocesses are available for Windows if a *note\nProactorEventLoop: 3d2. is used.  See *note Subprocess Support on\nWindows: 2f53. for details.\n\nSee also\n........\n\nasyncio also has the following 'low-level' APIs to work with\nsubprocesses: *note loop.subprocessexec(): 2f51, *note\nloop.subprocessshell(): 2f52, *note loop.connectreadpipe(): 2f54,\n*note loop.connectwritepipe(): 2f55, as well as the *note Subprocess\nTransports: 2f56. and *note Subprocess Protocols: 2f57.\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Shellinjection#Shellinjection\n\nFile: python3.12.info,  Node: Constants<7>,  Next: Interacting with Subprocesses,  Prev: Creating Subprocesses,  Up: Subprocesses\n\n5.18.1.38 Constants\n...................\n\n-- Data: asyncio.subprocess.PIPE\n\nCan be passed to the 'stdin', 'stdout' or 'stderr' parameters.\n\nIf 'PIPE' is passed to 'stdin' argument, the *note Process.stdin:\n2f5a. attribute will point to a 'StreamWriter' instance.\n\nIf 'PIPE' is passed to 'stdout' or 'stderr' arguments, the *note\nProcess.stdout: 2f5b. and *note Process.stderr: 2f5c. attributes\nwill point to 'StreamReader' instances.\n\n-- Data: asyncio.subprocess.STDOUT\n\nSpecial value that can be used as the 'stderr' argument and\nindicates that standard error should be redirected into standard\noutput.\n\n-- Data: asyncio.subprocess.DEVNULL\n\nSpecial value that can be used as the 'stdin', 'stdout' or 'stderr'\nargument to process creation functions.  It indicates that the\nspecial file *note os.devnull: 17ad. will be used for the\ncorresponding subprocess stream.\n\nFile: python3.12.info,  Node: Interacting with Subprocesses,  Prev: Constants<7>,  Up: Subprocesses\n\n5.18.1.39 Interacting with Subprocesses\n.......................................\n\nBoth *note createsubprocessexec(): 8a5. and *note\ncreatesubprocessshell(): 8a6. functions return instances of the\n'Process' class.  'Process' is a high-level wrapper that allows\ncommunicating with subprocesses and watching for their completion.\n\n-- Class: asyncio.subprocess.Process\n\nAn object that wraps OS processes created by the\n'createsubprocessexec()' and 'createsubprocessshell()'\nfunctions.\n\nThis class is designed to have a similar API to the *note\nsubprocess.Popen: 8c3. class, but there are some notable\ndifferences:\n\n* unlike Popen, Process instances do not have an equivalent to\nthe *note poll(): 2e6a. method;\n\n* the *note communicate(): 1476. and *note wait(): 2f60. methods\ndon't have a 'timeout' parameter: use the *note waitfor():\n3c8. function;\n\n* the *note Process.wait(): 2f60. method is asynchronous,\nwhereas *note subprocess.Popen.wait(): b33. method is\nimplemented as a blocking busy loop;\n\n* the 'universalnewlines' parameter is not supported.\n\nThis class is *note not thread safe: 2ef8.\n\nSee also the *note Subprocess and Threads: 2f61. section.\n\n-- Method: coroutine wait ()\n\nWait for the child process to terminate.\n\nSet and return the *note returncode: 2f62. attribute.\n\nNote: This method can deadlock when using 'stdout=PIPE'\nor 'stderr=PIPE' and the child process generates so much\noutput that it blocks waiting for the OS pipe buffer to\naccept more data.  Use the *note communicate(): 1476.\nmethod when using pipes to avoid this condition.\n\n-- Method: coroutine communicate (input=None)\n\nInteract with process:\n\n1. send data to 'stdin' (if 'input' is not 'None');\n\n2. closes 'stdin';\n\n3. read data from 'stdout' and 'stderr', until EOF is\nreached;\n\n4. wait for process to terminate.\n\nThe optional 'input' argument is the data (*note bytes: 295.\nobject) that will be sent to the child process.\n\nReturn a tuple '(stdoutdata, stderrdata)'.\n\nIf either *note BrokenPipeError: ed5. or *note\nConnectionResetError: ed8. exception is raised when writing\n'input' into 'stdin', the exception is ignored.  This\ncondition occurs when the process exits before all data are\nwritten into 'stdin'.\n\nIf it is desired to send data to the process' 'stdin', the\nprocess needs to be created with 'stdin=PIPE'.  Similarly, to\nget anything other than 'None' in the result tuple, the\nprocess has to be created with 'stdout=PIPE' and/or\n'stderr=PIPE' arguments.\n\nNote, that the data read is buffered in memory, so do not use\nthis method if the data size is large or unlimited.\n\nChanged in version 3.12: 'stdin' gets closed when 'input=None'\ntoo.\n\n-- Method: sendsignal (signal)\n\nSends the signal 'signal' to the child process.\n\nNote: On Windows, *note SIGTERM: 1234. is an alias for\n*note terminate(): 2f64.  'CTRLCEVENT' and\n'CTRLBREAKEVENT' can be sent to processes started with\na 'creationflags' parameter which includes\n'CREATENEWPROCESSGROUP'.\n\n-- Method: terminate ()\n\nStop the child process.\n\nOn POSIX systems this method sends *note SIGTERM: 1234. to the\nchild process.\n\nOn Windows the Win32 API function 'TerminateProcess()' is\ncalled to stop the child process.\n\n-- Method: kill ()\n\nKill the child process.\n\nOn POSIX systems this method sends 'SIGKILL' to the child\nprocess.\n\nOn Windows this method is an alias for *note terminate():\n2f64.\n\n-- Attribute: stdin\n\nStandard input stream ('StreamWriter') or 'None' if the\nprocess was created with 'stdin=None'.\n\n-- Attribute: stdout\n\nStandard output stream ('StreamReader') or 'None' if the\nprocess was created with 'stdout=None'.\n\n-- Attribute: stderr\n\nStandard error stream ('StreamReader') or 'None' if the\nprocess was created with 'stderr=None'.\n\nWarning: Use the *note communicate(): 1476. method rather than\n*note process.stdin.write(): 2f5a, *note await\nprocess.stdout.read(): 2f5b. or *note await\nprocess.stderr.read(): 2f5c.  This avoids deadlocks due to\nstreams pausing reading or writing and blocking the child\nprocess.\n\n-- Attribute: pid\n\nProcess identification number (PID).\n\nNote that for processes created by the\n'createsubprocessshell()' function, this attribute is the\nPID of the spawned shell.\n\n-- Attribute: returncode\n\nReturn code of the process when it exits.\n\nA 'None' value indicates that the process has not terminated\nyet.\n\nA negative value '-N' indicates that the child was terminated\nby signal 'N' (POSIX only).\n\n* Menu:\n\n* Subprocess and Threads::\n* Examples: Examples<15>.\n\nFile: python3.12.info,  Node: Subprocess and Threads,  Next: Examples<15>,  Up: Interacting with Subprocesses\n\n5.18.1.40 Subprocess and Threads\n................................\n",
            "subsections": []
        },
        "Standard asyncio event loop supports running subprocesses from different": {
            "content": "threads by default.\n\nOn Windows subprocesses are provided by *note ProactorEventLoop: 3d2.\nonly (default), *note SelectorEventLoop: 3d1. has no subprocess support.\n",
            "subsections": []
        },
        "On UNIX 'child watchers' are used for subprocess finish waiting, see": {
            "content": "*note Process Watchers: 2f68. for more info.\n\nChanged in version 3.8: UNIX switched to use *note ThreadedChildWatcher:\n196. for spawning subprocesses from different threads without any\nlimitation.\n\nSpawning a subprocess with 'inactive' current child watcher raises *note\nRuntimeError: 17a.\n",
            "subsections": []
        },
        "Note that alternative event loop implementations might have own": {
            "content": "limitations; please refer to their documentation.\n\nSee also\n........\n\nThe *note Concurrency and multithreading in asyncio: 2ef8. section.\n\nFile: python3.12.info,  Node: Examples<15>,  Prev: Subprocess and Threads,  Up: Interacting with Subprocesses\n\n5.18.1.41 Examples\n..................\n\nAn example using the *note Process: 2f50. class to control a subprocess\nand the *note StreamReader: 1628. class to read from its standard\noutput.  The subprocess is created by the *note\ncreatesubprocessexec(): 8a5. function:\n\nimport asyncio\nimport sys\n\nasync def getdate():\ncode = 'import datetime; print(datetime.datetime.now())'\n\n# Create the subprocess; redirect the standard output\n# into a pipe.\nproc = await asyncio.createsubprocessexec(\nsys.executable, '-c', code,\nstdout=asyncio.subprocess.PIPE)\n\n# Read one line of output.\ndata = await proc.stdout.readline()\nline = data.decode('ascii').rstrip()\n\n# Wait for the subprocess exit.\nawait proc.wait()\nreturn line\n\ndate = asyncio.run(getdate())\nprint(f\"Current date: {date}\")\n\nSee also the *note same example: 2f6a. written using low-level APIs.\n\nFile: python3.12.info,  Node: Queues,  Next: Exceptions<11>,  Prev: Subprocesses,  Up: asyncio -- Asynchronous I/O\n\n5.18.1.42 Queues\n................\n\n'Source code:' Lib/asyncio/queues.py(1)\n\n\n\nasyncio queues are designed to be similar to classes of the *note queue:\nb1. module.  Although asyncio queues are not thread-safe, they are\ndesigned to be used specifically in async/await code.\n",
            "subsections": []
        },
        "Note that methods of asyncio queues don't have a 'timeout' parameter;": {
            "content": "use *note asyncio.waitfor(): 3c8. function to do queue operations with\na timeout.\n\nSee also the *note Examples: 2f6d. section below.\n\n* Menu:\n\n* Queue::\n* Priority Queue::\n* LIFO Queue::\n* Exceptions: Exceptions<10>.\n* Examples: Examples<16>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/asyncio/queues.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Queue,  Next: Priority Queue,  Up: Queues": {
            "content": "5.18.1.43 Queue\n...............\n\n-- Class: asyncio.Queue (maxsize=0)\n\nA first in, first out (FIFO) queue.\n\nIf 'maxsize' is less than or equal to zero, the queue size is\ninfinite.  If it is an integer greater than '0', then 'await put()'\nblocks when the queue reaches 'maxsize' until an item is removed by\n*note get(): 2f6f.\n\nUnlike the standard library threading *note queue: b1, the size of\nthe queue is always known and can be returned by calling the *note\nqsize(): 2f70. method.\n\nChanged in version 3.10: Removed the 'loop' parameter.\n\nThis class is *note not thread safe: 2ef8.\n\n-- Attribute: maxsize\n\nNumber of items allowed in the queue.\n\n-- Method: empty ()\n\nReturn 'True' if the queue is empty, 'False' otherwise.\n\n-- Method: full ()\n\nReturn 'True' if there are *note maxsize: 2f71. items in the\nqueue.\n\nIf the queue was initialized with 'maxsize=0' (the default),\nthen *note full(): 2f73. never returns 'True'.\n\n-- Method: coroutine get ()\n\nRemove and return an item from the queue.  If queue is empty,\nwait until an item is available.\n\n-- Method: getnowait ()\n\nReturn an item if one is immediately available, else raise\n*note QueueEmpty: 2f75.\n\n-- Method: coroutine join ()\n\nBlock until all items in the queue have been received and\nprocessed.\n\nThe count of unfinished tasks goes up whenever an item is\nadded to the queue.  The count goes down whenever a consumer\ncoroutine calls *note taskdone(): c25. to indicate that the\nitem was retrieved and all work on it is complete.  When the\ncount of unfinished tasks drops to zero, *note join(): c24.\nunblocks.\n\n-- Method: coroutine put (item)\n\nPut an item into the queue.  If the queue is full, wait until\na free slot is available before adding the item.\n\n-- Method: putnowait (item)\n\nPut an item into the queue without blocking.\n\nIf no free slot is immediately available, raise *note\nQueueFull: 2f78.\n\n-- Method: qsize ()\n\nReturn the number of items in the queue.\n\n-- Method: taskdone ()\n\nIndicate that a formerly enqueued task is complete.\n\nUsed by queue consumers.  For each *note get(): 2f6f. used to\nfetch a task, a subsequent call to *note taskdone(): c25.\ntells the queue that the processing on the task is complete.\n\nIf a *note join(): c24. is currently blocking, it will resume\nwhen all items have been processed (meaning that a *note\ntaskdone(): c25. call was received for every item that had\nbeen *note put(): 2f76. into the queue).\n\nRaises *note ValueError: 183. if called more times than there\nwere items placed in the queue.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Priority Queue,  Next: LIFO Queue,  Prev: Queue,  Up: Queues": {
            "content": "5.18.1.44 Priority Queue\n........................\n\n-- Class: asyncio.PriorityQueue\n\nA variant of *note Queue: 8a4.; retrieves entries in priority order\n(lowest first).\n\nEntries are typically tuples of the form '(prioritynumber, data)'.\n\nFile: python3.12.info,  Node: LIFO Queue,  Next: Exceptions<10>,  Prev: Priority Queue,  Up: Queues\n\n5.18.1.45 LIFO Queue\n....................\n\n-- Class: asyncio.LifoQueue\n\nA variant of *note Queue: 8a4. that retrieves most recently added\nentries first (last in, first out).\n\nFile: python3.12.info,  Node: Exceptions<10>,  Next: Examples<16>,  Prev: LIFO Queue,  Up: Queues\n\n5.18.1.46 Exceptions\n....................\n\n-- Exception: asyncio.QueueEmpty\n\nThis exception is raised when the *note getnowait(): 2f74. method\nis called on an empty queue.\n\n-- Exception: asyncio.QueueFull\n\nException raised when the *note putnowait(): 2f77. method is\ncalled on a queue that has reached its 'maxsize'.\n\nFile: python3.12.info,  Node: Examples<16>,  Prev: Exceptions<10>,  Up: Queues\n\n5.18.1.47 Examples\n..................\n",
            "subsections": []
        },
        "Queues can be used to distribute workload between several concurrent": {
            "content": "tasks:\n\nimport asyncio\nimport random\nimport time\n\n\nasync def worker(name, queue):\nwhile True:\n# Get a \"work item\" out of the queue.\nsleepfor = await queue.get()\n\n# Sleep for the \"sleepfor\" seconds.\nawait asyncio.sleep(sleepfor)\n\n# Notify the queue that the \"work item\" has been processed.\nqueue.taskdone()\n\nprint(f'{name} has slept for {sleepfor:.2f} seconds')\n\n\nasync def main():\n# Create a queue that we will use to store our \"workload\".\nqueue = asyncio.Queue()\n\n# Generate random timings and put them into the queue.\ntotalsleeptime = 0\nfor  in range(20):\nsleepfor = random.uniform(0.05, 1.0)\ntotalsleeptime += sleepfor\nqueue.putnowait(sleepfor)\n\n# Create three worker tasks to process the queue concurrently.\ntasks = []\nfor i in range(3):\ntask = asyncio.createtask(worker(f'worker-{i}', queue))\ntasks.append(task)\n\n# Wait until the queue is fully processed.\nstartedat = time.monotonic()\nawait queue.join()\ntotalsleptfor = time.monotonic() - startedat\n\n# Cancel our worker tasks.\nfor task in tasks:\ntask.cancel()\n# Wait until all worker tasks are cancelled.\nawait asyncio.gather(*tasks, returnexceptions=True)\n\nprint('====')\nprint(f'3 workers slept in parallel for {totalsleptfor:.2f} seconds')\nprint(f'total expected sleep time: {totalsleeptime:.2f} seconds')\n\n\nasyncio.run(main())\n\nFile: python3.12.info,  Node: Exceptions<11>,  Next: Event Loop,  Prev: Queues,  Up: asyncio -- Asynchronous I/O\n\n5.18.1.48 Exceptions\n....................\n\n'Source code:' Lib/asyncio/exceptions.py(1)\n\n\n\n-- Exception: asyncio.TimeoutError\n\nA deprecated alias of *note TimeoutError: 62a, raised when the\noperation has exceeded the given deadline.\n\nChanged in version 3.11: This class was made an alias of *note\nTimeoutError: 62a.\n\n-- Exception: asyncio.CancelledError\n\nThe operation has been cancelled.\n\nThis exception can be caught to perform custom operations when\nasyncio Tasks are cancelled.  In almost all situations the\nexception must be re-raised.\n\nChanged in version 3.8: *note CancelledError: 7fe. is now a\nsubclass of *note BaseException: 37c. rather than *note Exception:\n7ff.\n\n-- Exception: asyncio.InvalidStateError\n\nInvalid internal state of *note Task: 201. or *note Future: a11.\n\nCan be raised in situations like setting a result value for a\n'Future' object that already has a result value set.\n\n-- Exception: asyncio.SendfileNotAvailableError\n\nThe \"sendfile\" syscall is not available for the given socket or\nfile type.\n\nA subclass of *note RuntimeError: 17a.\n\n-- Exception: asyncio.IncompleteReadError\n\nThe requested read operation did not complete fully.\n\nRaised by the *note asyncio stream APIs: 2eca.\n\nThis exception is a subclass of *note EOFError: 114e.\n\n-- Attribute: expected\n\nThe total number (*note int: 17e.) of expected bytes.\n\n-- Attribute: partial\n\nA string of *note bytes: 295. read before the end of stream\nwas reached.\n\n-- Exception: asyncio.LimitOverrunError\n\nReached the buffer size limit while looking for a separator.\n\nRaised by the *note asyncio stream APIs: 2eca.\n\n-- Attribute: consumed\n\nThe total number of to be consumed bytes.\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/asyncio/exceptions.py\n\nFile: python3.12.info,  Node: Event Loop,  Next: Futures,  Prev: Exceptions<11>,  Up: asyncio -- Asynchronous I/O\n\n5.18.1.49 Event Loop\n....................\n\n'Source code:' Lib/asyncio/events.py(1), Lib/asyncio/baseevents.py(2)\n\n\n",
            "subsections": []
        },
        "Preface": {
            "content": ".......\n",
            "subsections": []
        },
        "The event loop is the core of every asyncio application.  Event loops": {
            "content": "run asynchronous tasks and callbacks, perform network IO operations, and\nrun subprocesses.\n",
            "subsections": []
        },
        "Application developers should typically use the high-level asyncio": {
            "content": "functions, such as *note asyncio.run(): 197, and should rarely need to\nreference the loop object or call its methods.  This section is intended\nmostly for authors of lower-level code, libraries, and frameworks, who\nneed finer control over the event loop behavior.\n",
            "subsections": []
        },
        "Obtaining the Event Loop": {
            "content": "........................\n",
            "subsections": []
        },
        "The following low-level functions can be used to get, set, or create an": {
            "content": "event loop:\n\n-- Function: asyncio.getrunningloop ()\n\nReturn the running event loop in the current OS thread.\n\nRaise a *note RuntimeError: 17a. if there is no running event loop.\n\nThis function can only be called from a coroutine or a callback.\n\nNew in version 3.7.\n\n-- Function: asyncio.geteventloop ()\n\nGet the current event loop.\n\nWhen called from a coroutine or a callback (e.g.  scheduled with\ncallsoon or similar API), this function will always return the\nrunning event loop.\n\nIf there is no running event loop set, the function will return the\nresult of the 'geteventlooppolicy().geteventloop()' call.\n\nBecause this function has rather complex behavior (especially when\ncustom event loop policies are in use), using the *note\ngetrunningloop(): 942. function is preferred to *note\ngeteventloop(): 21e. in coroutines and callbacks.\n\nAs noted above, consider using the higher-level *note\nasyncio.run(): 197. function, instead of using these lower level\nfunctions to manually create and close an event loop.\n\nDeprecated since version 3.12: Deprecation warning is emitted if\nthere is no current event loop.  In some future Python release this\nwill become an error.\n\n-- Function: asyncio.seteventloop (loop)\n\nSet 'loop' as the current event loop for the current OS thread.\n\n-- Function: asyncio.neweventloop ()\n\nCreate and return a new event loop object.\n\nNote that the behaviour of *note geteventloop(): 21e, *note\nseteventloop(): 1524, and *note neweventloop(): 2ed7. functions can\nbe altered by *note setting a custom event loop policy: 2f87.\n",
            "subsections": []
        },
        "Contents": {
            "content": "........\n\nThis documentation page contains the following sections:\n\n* The *note Transports: 2fd4. section documents asyncio *note\nBaseTransport: 2fd6, *note ReadTransport: 2fae, *note\nWriteTransport: 2faf, *note Transport: 2fd7, *note\nDatagramTransport: 1501, and *note SubprocessTransport: 2fbc.\nclasses.\n\n* The *note Protocols: 2fd5. section documents asyncio *note\nBaseProtocol: 2fd8, *note Protocol: 2fd9, *note BufferedProtocol:\n8d1, *note DatagramProtocol: 49e, and *note SubprocessProtocol:\n2fbb. classes.\n\n* The *note Examples: 2fda. section showcases how to work with\ntransports, protocols, and low-level event loop APIs.\n\n* Menu:\n\n* Transports::\n* Protocols::\n* Examples: Examples<18>.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Event Loop Methods,  Next: Callback Handles,  Up: Event Loop": {
            "content": "5.18.1.50 Event Loop Methods\n............................\n\nEvent loops have 'low-level' APIs for the following:\n\n* Menu:\n\n* Running and stopping the loop::\n* Scheduling callbacks::\n* Scheduling delayed callbacks::\n* Creating Futures and Tasks::\n* Opening network connections::\n* Creating network servers::\n* Transferring files::\n* TLS Upgrade::\n* Watching file descriptors::\n* Working with socket objects directly::\n* DNS::\n* Working with pipes::\n* Unix signals::\n* Executing code in thread or process pools::\n* Error Handling API::\n* Enabling debug mode::\n* Running Subprocesses::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Running and stopping the loop,  Next: Scheduling callbacks,  Up: Event Loop Methods": {
            "content": "5.18.1.51 Running and stopping the loop\n.......................................\n\n-- Method: loop.rununtilcomplete (future)\n\nRun until the 'future' (an instance of *note Future: a11.) has\ncompleted.\n\nIf the argument is a *note coroutine object: 2ec9. it is implicitly\nscheduled to run as a *note asyncio.Task: 201.\n\nReturn the Future's result or raise its exception.\n\n-- Method: loop.runforever ()\n\nRun the event loop until *note stop(): ac9. is called.\n\nIf *note stop(): ac9. is called before *note runforever(): 2f8f.\nis called, the loop will poll the I/O selector once with a timeout\nof zero, run all callbacks scheduled in response to I/O events (and\nthose that were already scheduled), and then exit.\n\nIf *note stop(): ac9. is called while *note runforever(): 2f8f. is\nrunning, the loop will run the current batch of callbacks and then\nexit.  Note that new callbacks scheduled by callbacks will not run\nin this case; instead, they will run the next time *note\nrunforever(): 2f8f. or *note rununtilcomplete(): ac2. is called.\n\n-- Method: loop.stop ()\n\nStop the event loop.\n\n-- Method: loop.isrunning ()\n\nReturn 'True' if the event loop is currently running.\n\n-- Method: loop.isclosed ()\n\nReturn 'True' if the event loop was closed.\n\n-- Method: loop.close ()\n\nClose the event loop.\n\nThe loop must not be running when this function is called.  Any\npending callbacks will be discarded.\n\nThis method clears all queues and shuts down the executor, but does\nnot wait for the executor to finish.\n\nThis method is idempotent and irreversible.  No other methods\nshould be called after the event loop is closed.\n\n-- Method: coroutine loop.shutdownasyncgens ()\n\nSchedule all currently open *note asynchronous generator: 1d47.\nobjects to close with an *note aclose(): 6f1. call.  After calling\nthis method, the event loop will issue a warning if a new\nasynchronous generator is iterated.  This should be used to\nreliably finalize all scheduled asynchronous generators.\n\nNote that there is no need to call this function when *note\nasyncio.run(): 197. is used.\n\nExample:\n\ntry:\nloop.runforever()\nfinally:\nloop.rununtilcomplete(loop.shutdownasyncgens())\nloop.close()\n\nNew in version 3.6.\n\n-- Method: coroutine loop.shutdowndefaultexecutor (timeout=None)\n\nSchedule the closure of the default executor and wait for it to\njoin all of the threads in the *note ThreadPoolExecutor: 529.  Once\nthis method has been called, using the default executor with *note\nloop.runinexecutor(): 702. will raise a *note RuntimeError: 17a.\n\nThe 'timeout' parameter specifies the amount of time (in *note\nfloat: 4b7. seconds) the executor will be given to finish joining.\nWith the default, 'None', the executor is allowed an unlimited\namount of time.\n\nIf the 'timeout' is reached, a *note RuntimeWarning: 8c9. is\nemitted and the default executor is terminated without waiting for\nits threads to finish joining.\n\nNote: Do not call this method when using *note asyncio.run():\n197, as the latter handles default executor shutdown\nautomatically.\n\nNew in version 3.9.\n\nChanged in version 3.12: Added the 'timeout' parameter.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Scheduling callbacks,  Next: Scheduling delayed callbacks,  Prev: Running and stopping the loop,  Up: Event Loop Methods": {
            "content": "5.18.1.52 Scheduling callbacks\n..............................\n\n-- Method: loop.callsoon (callback, *args, context=None)\n\nSchedule the 'callback' *note callback: 2609. to be called with\n'args' arguments at the next iteration of the event loop.\n\nReturn an instance of *note asyncio.Handle: 1826, which can be used\nlater to cancel the callback.\n\nCallbacks are called in the order in which they are registered.\nEach callback will be called exactly once.\n\nThe optional keyword-only 'context' argument specifies a custom\n*note contextvars.Context: 2ea5. for the 'callback' to run in.\nCallbacks use the current context when no 'context' is provided.\n\nUnlike *note callsoonthreadsafe(): 93c, this method is not\nthread-safe.\n\n-- Method: loop.callsoonthreadsafe (callback, *args, context=None)\n\nA thread-safe variant of *note callsoon(): 93b.  When scheduling\ncallbacks from another thread, this function 'must' be used, since\n*note callsoon(): 93b. is not thread-safe.\n\nRaises *note RuntimeError: 17a. if called on a loop that's been\nclosed.  This can happen on a secondary thread when the main\napplication is shutting down.\n\nSee the *note concurrency and multithreading: 2ef8. section of the\ndocumentation.\n\nChanged in version 3.7: The 'context' keyword-only parameter was\nadded.  See PEP 567(1) for more details.\n\nNote: Most *note asyncio: 9. scheduling functions don't allow\npassing keyword arguments.  To do that, use *note\nfunctools.partial(): d31.:\n\n# will schedule \"print(\"Hello\", flush=True)\"\nloop.callsoon(\nfunctools.partial(print, \"Hello\", flush=True))\n\nUsing partial objects is usually more convenient than using\nlambdas, as asyncio can render partial objects better in debug and\nerror messages.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0567/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Scheduling delayed callbacks,  Next: Creating Futures and Tasks,  Prev: Scheduling callbacks,  Up: Event Loop Methods": {
            "content": "5.18.1.53 Scheduling delayed callbacks\n......................................\n",
            "subsections": []
        },
        "Event loop provides mechanisms to schedule callback functions to be": {
            "content": "called at some point in the future.  Event loop uses monotonic clocks to\ntrack time.\n\n-- Method: loop.calllater (delay, callback, *args, context=None)\n\nSchedule 'callback' to be called after the given 'delay' number of\nseconds (can be either an int or a float).\n\nAn instance of *note asyncio.TimerHandle: 14bd. is returned which\ncan be used to cancel the callback.\n\n'callback' will be called exactly once.  If two callbacks are\nscheduled for exactly the same time, the order in which they are\ncalled is undefined.\n\nThe optional positional 'args' will be passed to the callback when\nit is called.  If you want the callback to be called with keyword\narguments use *note functools.partial(): d31.\n\nAn optional keyword-only 'context' argument allows specifying a\ncustom *note contextvars.Context: 2ea5. for the 'callback' to run\nin.  The current context is used when no 'context' is provided.\n\nChanged in version 3.7: The 'context' keyword-only parameter was\nadded.  See PEP 567(1) for more details.\n\nChanged in version 3.8: In Python 3.7 and earlier with the default\nevent loop implementation, the 'delay' could not exceed one day.\nThis has been fixed in Python 3.8.\n\n-- Method: loop.callat (when, callback, *args, context=None)\n\nSchedule 'callback' to be called at the given absolute timestamp\n'when' (an int or a float), using the same time reference as *note\nloop.time(): 2f96.\n\nThis method's behavior is the same as *note calllater(): 93d.\n\nAn instance of *note asyncio.TimerHandle: 14bd. is returned which\ncan be used to cancel the callback.\n\nChanged in version 3.7: The 'context' keyword-only parameter was\nadded.  See PEP 567(2) for more details.\n\nChanged in version 3.8: In Python 3.7 and earlier with the default\nevent loop implementation, the difference between 'when' and the\ncurrent time could not exceed one day.  This has been fixed in\nPython 3.8.\n\n-- Method: loop.time ()\n\nReturn the current time, as a *note float: 4b7. value, according to\nthe event loop's internal monotonic clock.\n\nNote:\nChanged in version 3.8: In Python 3.7 and earlier timeouts\n(relative 'delay' or absolute 'when') should not exceed one day.\nThis has been fixed in Python 3.8.\n\nSee also\n........\n\nThe *note asyncio.sleep(): 89d. function.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0567/\n\n(2) https://peps.python.org/pep-0567/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Creating Futures and Tasks,  Next: Opening network connections,  Prev: Scheduling delayed callbacks,  Up: Event Loop Methods": {
            "content": "5.18.1.54 Creating Futures and Tasks\n....................................\n\n-- Method: loop.createfuture ()\n\nCreate an *note asyncio.Future: a11. object attached to the event\nloop.\n\nThis is the preferred way to create Futures in asyncio.  This lets\nthird-party event loops provide alternative implementations of the\nFuture object (with better performance or instrumentation).\n\nNew in version 3.5.2.\n\n-- Method: loop.createtask (coro, *, name=None, context=None)\n\nSchedule the execution of *note coroutine: 2ec9. 'coro'.  Return a\n*note Task: 201. object.\n\nThird-party event loops can use their own subclass of *note Task:\n201. for interoperability.  In this case, the result type is a\nsubclass of *note Task: 201.\n\nIf the 'name' argument is provided and not 'None', it is set as the\nname of the task using *note Task.setname(): 803.\n\nAn optional keyword-only 'context' argument allows specifying a\ncustom *note contextvars.Context: 2ea5. for the 'coro' to run in.\nThe current context copy is created when no 'context' is provided.\n\nChanged in version 3.8: Added the 'name' parameter.\n\nChanged in version 3.11: Added the 'context' parameter.\n\n-- Method: loop.settaskfactory (factory)\n\nSet a task factory that will be used by *note loop.createtask():\n802.\n\nIf 'factory' is 'None' the default task factory will be set.\nOtherwise, 'factory' must be a 'callable' with the signature\nmatching '(loop, coro, context=None)', where 'loop' is a reference\nto the active event loop, and 'coro' is a coroutine object.  The\ncallable must return a *note asyncio.Future: a11.-compatible\nobject.\n\n-- Method: loop.gettaskfactory ()\n\nReturn a task factory or 'None' if the default one is in use.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Opening network connections,  Next: Creating network servers,  Prev: Creating Futures and Tasks,  Up: Event Loop Methods": {
            "content": "5.18.1.55 Opening network connections\n.....................................\n\n-- Method: coroutine loop.createconnection (protocolfactory,\nhost=None, port=None, *, ssl=None, family=0, proto=0, flags=0,\nsock=None, localaddr=None, serverhostname=None,\nsslhandshaketimeout=None, sslshutdowntimeout=None,\nhappyeyeballsdelay=None, interleave=None, allerrors=False)\n\nOpen a streaming transport connection to a given address specified\nby 'host' and 'port'.\n\nThe socket family can be either *note AFINET: 157e. or *note\nAFINET6: 157f. depending on 'host' (or the 'family' argument, if\nprovided).\n\nThe socket type will be *note SOCKSTREAM: 1168.\n\n'protocolfactory' must be a callable returning an *note asyncio\nprotocol: 2f99. implementation.\n\nThis method will try to establish the connection in the background.\nWhen successful, it returns a '(transport, protocol)' pair.\n\nThe chronological synopsis of the underlying operation is as\nfollows:\n\n1. The connection is established and a *note transport: 2f9a. is\ncreated for it.\n\n2. 'protocolfactory' is called without arguments and is expected\nto return a *note protocol: 2f99. instance.\n\n3. The protocol instance is coupled with the transport by calling\nits *note connectionmade(): 2f9b. method.\n\n4. A '(transport, protocol)' tuple is returned on success.\n\nThe created transport is an implementation-dependent bidirectional\nstream.\n\nOther arguments:\n\n* 'ssl': if given and not false, a SSL/TLS transport is created\n(by default a plain TCP transport is created).  If 'ssl' is a\n*note ssl.SSLContext: 278. object, this context is used to\ncreate the transport; if 'ssl' is *note True: a53, a default\ncontext returned from *note ssl.createdefaultcontext(): e17.\nis used.\n\nSee also\n........\n\n*note SSL/TLS security considerations: 2f9c.\n\n* 'serverhostname' sets or overrides the hostname that the\ntarget server's certificate will be matched against.  Should\nonly be passed if 'ssl' is not 'None'.  By default the value\nof the 'host' argument is used.  If 'host' is empty, there is\nno default and you must pass a value for 'serverhostname'.\nIf 'serverhostname' is an empty string, hostname matching is\ndisabled (which is a serious security risk, allowing for\npotential man-in-the-middle attacks).\n\n* 'family', 'proto', 'flags' are the optional address family,\nprotocol and flags to be passed through to getaddrinfo() for\n'host' resolution.  If given, these should all be integers\nfrom the corresponding *note socket: c6. module constants.\n\n* 'happyeyeballsdelay', if given, enables Happy Eyeballs for\nthis connection.  It should be a floating-point number\nrepresenting the amount of time in seconds to wait for a\nconnection attempt to complete, before starting the next\nattempt in parallel.  This is the \"Connection Attempt Delay\"\nas defined in RFC 8305(1).  A sensible default value\nrecommended by the RFC is '0.25' (250 milliseconds).\n\n* 'interleave' controls address reordering when a host name\nresolves to multiple IP addresses.  If '0' or unspecified, no\nreordering is done, and addresses are tried in the order\nreturned by *note getaddrinfo(): a5a.  If a positive integer\nis specified, the addresses are interleaved by address family,\nand the given integer is interpreted as \"First Address Family\nCount\" as defined in RFC 8305(2).  The default is '0' if\n'happyeyeballsdelay' is not specified, and '1' if it is.\n\n* 'sock', if given, should be an existing, already connected\n*note socket.socket: bfd. object to be used by the transport.\nIf 'sock' is given, none of 'host', 'port', 'family', 'proto',\n'flags', 'happyeyeballsdelay', 'interleave' and 'localaddr'\nshould be specified.\n\nNote: The 'sock' argument transfers ownership of the\nsocket to the transport created.  To close the socket,\ncall the transport's *note close(): 2f9d. method.\n\n* 'localaddr', if given, is a '(localhost, localport)' tuple\nused to bind the socket locally.  The 'localhost' and\n'localport' are looked up using 'getaddrinfo()', similarly to\n'host' and 'port'.\n\n* 'sslhandshaketimeout' is (for a TLS connection) the time in\nseconds to wait for the TLS handshake to complete before\naborting the connection.  '60.0' seconds if 'None' (default).\n\n* 'sslshutdowntimeout' is the time in seconds to wait for the\nSSL shutdown to complete before aborting the connection.\n'30.0' seconds if 'None' (default).\n\n* 'allerrors' determines what exceptions are raised when a\nconnection cannot be created.  By default, only a single\n'Exception' is raised: the first exception if there is only\none or all errors have same message, or a single 'OSError'\nwith the error messages combined.  When 'allerrors' is\n'True', an 'ExceptionGroup' will be raised containing all\nexceptions (even if there is only one).\n\nChanged in version 3.5: Added support for SSL/TLS in *note\nProactorEventLoop: 3d2.\n\nChanged in version 3.6: The socket option *note socket.TCPNODELAY:\n2f9e. is set by default for all TCP connections.\n\nChanged in version 3.7: Added the 'sslhandshaketimeout'\nparameter.\n\nChanged in version 3.8: Added the 'happyeyeballsdelay' and\n'interleave' parameters.\n\nHappy Eyeballs Algorithm: Success with Dual-Stack Hosts.  When a\nserver's IPv4 path and protocol are working, but the server's IPv6\npath and protocol are not working, a dual-stack client application\nexperiences significant connection delay compared to an IPv4-only\nclient.  This is undesirable because it causes the dual-stack\nclient to have a worse user experience.  This document specifies\nrequirements for algorithms that reduce this user-visible delay and\nprovides an algorithm.\n\nFor more information:\n'https://datatracker.ietf.org/doc/html/rfc6555'\n\nChanged in version 3.11: Added the 'sslshutdowntimeout'\nparameter.\n\nChanged in version 3.12: 'allerrors' was added.\n\nSee also\n........\n\nThe *note openconnection(): 950. function is a high-level\nalternative API. It returns a pair of (*note StreamReader: 1628,\n*note StreamWriter: 1419.) that can be used directly in async/await\ncode.\n\n-- Method: coroutine loop.createdatagramendpoint (protocolfactory,\nlocaladdr=None, remoteaddr=None, *, family=0, proto=0,\nflags=0, reuseport=None, allowbroadcast=None, sock=None)\n\nCreate a datagram connection.\n\nThe socket family can be either *note AFINET: 157e, *note\nAFINET6: 157f, or *note AFUNIX: 1580, depending on 'host' (or the\n'family' argument, if provided).\n\nThe socket type will be *note SOCKDGRAM: 1167.\n\n'protocolfactory' must be a callable returning a *note protocol:\n2f99. implementation.\n\nA tuple of '(transport, protocol)' is returned on success.\n\nOther arguments:\n\n* 'localaddr', if given, is a '(localhost, localport)' tuple\nused to bind the socket locally.  The 'localhost' and\n'localport' are looked up using *note getaddrinfo(): a5a.\n\n* 'remoteaddr', if given, is a '(remotehost, remoteport)'\ntuple used to connect the socket to a remote address.  The\n'remotehost' and 'remoteport' are looked up using *note\ngetaddrinfo(): a5a.\n\n* 'family', 'proto', 'flags' are the optional address family,\nprotocol and flags to be passed through to *note\ngetaddrinfo(): a5a. for 'host' resolution.  If given, these\nshould all be integers from the corresponding *note socket:\nc6. module constants.\n\n* 'reuseport' tells the kernel to allow this endpoint to be\nbound to the same port as other existing endpoints are bound\nto, so long as they all set this flag when being created.\nThis option is not supported on Windows and some Unixes.  If\nthe *note socket.SOREUSEPORT: 2f9e. constant is not defined\nthen this capability is unsupported.\n\n* 'allowbroadcast' tells the kernel to allow this endpoint to\nsend messages to the broadcast address.\n\n* 'sock' can optionally be specified in order to use a\npreexisting, already connected, *note socket.socket: bfd.\nobject to be used by the transport.  If specified,\n'localaddr' and 'remoteaddr' should be omitted (must be\n*note None: 43f.).\n\nNote: The 'sock' argument transfers ownership of the\nsocket to the transport created.  To close the socket,\ncall the transport's *note close(): 2f9d. method.\n\nSee *note UDP echo client protocol: 2f9f. and *note UDP echo server\nprotocol: 2fa0. examples.\n\nChanged in version 3.4.4: The 'family', 'proto', 'flags',\n'reuseaddress', 'reuseport', 'allowbroadcast', and 'sock'\nparameters were added.\n\nChanged in version 3.8: Added support for Windows.\n\nChanged in version 3.8.1: The 'reuseaddress' parameter is no\nlonger supported, as using *note socket.SOREUSEADDR: 2f9e. poses a\nsignificant security concern for UDP. Explicitly passing\n'reuseaddress=True' will raise an exception.\n\nWhen multiple processes with differing UIDs assign sockets to an\nidentical UDP socket address with 'SOREUSEADDR', incoming packets\ncan become randomly distributed among the sockets.\n\nFor supported platforms, 'reuseport' can be used as a replacement\nfor similar functionality.  With 'reuseport', *note\nsocket.SOREUSEPORT: 2f9e. is used instead, which specifically\nprevents processes with differing UIDs from assigning sockets to\nthe same socket address.\n\nChanged in version 3.11: The 'reuseaddress' parameter, disabled\nsince Python 3.8.1, 3.7.6 and 3.6.10, has been entirely removed.\n\n-- Method: coroutine loop.createunixconnection (protocolfactory,\npath=None, *, ssl=None, sock=None, serverhostname=None,\nsslhandshaketimeout=None, sslshutdowntimeout=None)\n\nCreate a Unix connection.\n\nThe socket family will be *note AFUNIX: 1580.; socket type will be\n*note SOCKSTREAM: 1168.\n\nA tuple of '(transport, protocol)' is returned on success.\n\n'path' is the name of a Unix domain socket and is required, unless\na 'sock' parameter is specified.  Abstract Unix sockets, *note str:\n157, *note bytes: 295, and *note Path: 149. paths are supported.\n\nSee the documentation of the *note loop.createconnection(): 3cc.\nmethod for information about arguments to this method.\n\n*note Availability: 1ad3.: Unix.\n\nChanged in version 3.7: Added the 'sslhandshaketimeout'\nparameter.  The 'path' parameter can now be a *note path-like\nobject: 957.\n\nChanged in version 3.11: Added the 'sslshutdowntimeout'\nparameter.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc8305.html\n\n(2) https://datatracker.ietf.org/doc/html/rfc8305.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Creating network servers,  Next: Transferring files,  Prev: Opening network connections,  Up: Event Loop Methods": {
            "content": "5.18.1.56 Creating network servers\n..................................\n\n-- Method: coroutine loop.createserver (protocolfactory, host=None,\nport=None, *, family=socket.AFUNSPEC,\nflags=socket.AIPASSIVE, sock=None, backlog=100, ssl=None,\nreuseaddress=None, reuseport=None,\nsslhandshaketimeout=None, sslshutdowntimeout=None,\nstartserving=True)\n\nCreate a TCP server (socket type *note SOCKSTREAM: 1168.)\nlistening on 'port' of the 'host' address.\n\nReturns a *note Server: 949. object.\n\nArguments:\n\n* 'protocolfactory' must be a callable returning a *note\nprotocol: 2f99. implementation.\n\n* The 'host' parameter can be set to several types which\ndetermine where the server would be listening:\n\n- If 'host' is a string, the TCP server is bound to a\nsingle network interface specified by 'host'.\n\n- If 'host' is a sequence of strings, the TCP server is\nbound to all network interfaces specified by the\nsequence.\n\n- If 'host' is an empty string or 'None', all interfaces\nare assumed and a list of multiple sockets will be\nreturned (most likely one for IPv4 and another one for\nIPv6).\n\n* The 'port' parameter can be set to specify which port the\nserver should listen on.  If '0' or 'None' (the default), a\nrandom unused port will be selected (note that if 'host'\nresolves to multiple network interfaces, a different random\nport will be selected for each interface).\n\n* 'family' can be set to either *note socket.AFINET: 157e. or\n*note AFINET6: 157f. to force the socket to use IPv4 or IPv6.\nIf not set, the 'family' will be determined from host name\n(defaults to *note AFUNSPEC: 2fa2.).\n\n* 'flags' is a bitmask for *note getaddrinfo(): a5a.\n\n* 'sock' can optionally be specified in order to use a\npreexisting socket object.  If specified, 'host' and 'port'\nmust not be specified.\n\nNote: The 'sock' argument transfers ownership of the\nsocket to the server created.  To close the socket, call\nthe server's *note close(): 2f0c. method.\n\n* 'backlog' is the maximum number of queued connections passed\nto *note listen(): cc1. (defaults to 100).\n\n* 'ssl' can be set to an *note SSLContext: 278. instance to\nenable TLS over the accepted connections.\n\n* 'reuseaddress' tells the kernel to reuse a local socket in\n'TIMEWAIT' state, without waiting for its natural timeout to\nexpire.  If not specified will automatically be set to 'True'\non Unix.\n\n* 'reuseport' tells the kernel to allow this endpoint to be\nbound to the same port as other existing endpoints are bound\nto, so long as they all set this flag when being created.\nThis option is not supported on Windows.\n\n* 'sslhandshaketimeout' is (for a TLS server) the time in\nseconds to wait for the TLS handshake to complete before\naborting the connection.  '60.0' seconds if 'None' (default).\n\n* 'sslshutdowntimeout' is the time in seconds to wait for the\nSSL shutdown to complete before aborting the connection.\n'30.0' seconds if 'None' (default).\n\n* 'startserving' set to 'True' (the default) causes the created\nserver to start accepting connections immediately.  When set\nto 'False', the user should await on *note\nServer.startserving(): 94c. or *note Server.serveforever():\n94d. to make the server to start accepting connections.\n\nChanged in version 3.5: Added support for SSL/TLS in *note\nProactorEventLoop: 3d2.\n\nChanged in version 3.5.1: The 'host' parameter can be a sequence of\nstrings.\n\nChanged in version 3.6: Added 'sslhandshaketimeout' and\n'startserving' parameters.  The socket option *note\nsocket.TCPNODELAY: 2f9e. is set by default for all TCP\nconnections.\n\nChanged in version 3.11: Added the 'sslshutdowntimeout'\nparameter.\n\nSee also\n........\n\nThe *note startserver(): 951. function is a higher-level\nalternative API that returns a pair of *note StreamReader: 1628.\nand *note StreamWriter: 1419. that can be used in an async/await\ncode.\n\n-- Method: coroutine loop.createunixserver (protocolfactory,\npath=None, *, sock=None, backlog=100, ssl=None,\nsslhandshaketimeout=None, sslshutdowntimeout=None,\nstartserving=True)\n\nSimilar to *note loop.createserver(): 94a. but works with the\n*note AFUNIX: 1580. socket family.\n\n'path' is the name of a Unix domain socket, and is required, unless\na 'sock' argument is provided.  Abstract Unix sockets, *note str:\n157, *note bytes: 295, and *note Path: 149. paths are supported.\n\nSee the documentation of the *note loop.createserver(): 94a.\nmethod for information about arguments to this method.\n\n*note Availability: 1ad3.: Unix.\n\nChanged in version 3.7: Added the 'sslhandshaketimeout' and\n'startserving' parameters.  The 'path' parameter can now be a\n*note Path: 149. object.\n\nChanged in version 3.11: Added the 'sslshutdowntimeout'\nparameter.\n\n-- Method: coroutine loop.connectacceptedsocket (protocolfactory,\nsock, *, ssl=None, sslhandshaketimeout=None,\nsslshutdowntimeout=None)\n\nWrap an already accepted connection into a transport/protocol pair.\n\nThis method can be used by servers that accept connections outside\nof asyncio but that use asyncio to handle them.\n\nParameters:\n\n* 'protocolfactory' must be a callable returning a *note\nprotocol: 2f99. implementation.\n\n* 'sock' is a preexisting socket object returned from *note\nsocket.accept: bfe.\n\nNote: The 'sock' argument transfers ownership of the\nsocket to the transport created.  To close the socket,\ncall the transport's *note close(): 2f9d. method.\n\n* 'ssl' can be set to an *note SSLContext: 278. to enable SSL\nover the accepted connections.\n\n* 'sslhandshaketimeout' is (for an SSL connection) the time in\nseconds to wait for the SSL handshake to complete before\naborting the connection.  '60.0' seconds if 'None' (default).\n\n* 'sslshutdowntimeout' is the time in seconds to wait for the\nSSL shutdown to complete before aborting the connection.\n'30.0' seconds if 'None' (default).\n\nReturns a '(transport, protocol)' pair.\n\nNew in version 3.5.3.\n\nChanged in version 3.7: Added the 'sslhandshaketimeout'\nparameter.\n\nChanged in version 3.11: Added the 'sslshutdowntimeout'\nparameter.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Transferring files,  Next: TLS Upgrade,  Prev: Creating network servers,  Up: Event Loop Methods": {
            "content": "5.18.1.57 Transferring files\n............................\n\n-- Method: coroutine loop.sendfile (transport, file, offset=0,\ncount=None, *, fallback=True)\n\nSend a 'file' over a 'transport'.  Return the total number of bytes\nsent.\n\nThe method uses high-performance *note os.sendfile(): 946. if\navailable.\n\n'file' must be a regular file object opened in binary mode.\n\n'offset' tells from where to start reading the file.  If specified,\n'count' is the total number of bytes to transmit as opposed to\nsending the file until EOF is reached.  File position is always\nupdated, even when this method raises an error, and *note\nfile.tell(): 26a2. can be used to obtain the actual number of bytes\nsent.\n\n'fallback' set to 'True' makes asyncio to manually read and send\nthe file when the platform does not support the sendfile system\ncall (e.g.  Windows or SSL socket on Unix).\n\nRaise *note SendfileNotAvailableError: 2f82. if the system does not\nsupport the 'sendfile' syscall and 'fallback' is 'False'.\n\nNew in version 3.7.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: TLS Upgrade,  Next: Watching file descriptors,  Prev: Transferring files,  Up: Event Loop Methods": {
            "content": "5.18.1.58 TLS Upgrade\n.....................\n\n-- Method: coroutine loop.starttls (transport, protocol, sslcontext,\n*, serverside=False, serverhostname=None,\nsslhandshaketimeout=None, sslshutdowntimeout=None)\n\nUpgrade an existing transport-based connection to TLS.\n\nCreate a TLS coder/decoder instance and insert it between the\n'transport' and the 'protocol'.  The coder/decoder implements both\n'transport'-facing protocol and 'protocol'-facing transport.\n\nReturn the created two-interface instance.  After 'await', the\n'protocol' must stop using the original 'transport' and communicate\nwith the returned object only because the coder caches\n'protocol'-side data and sporadically exchanges extra TLS session\npackets with 'transport'.\n\nIn some situations (e.g.  when the passed transport is already\nclosing) this may return 'None'.\n\nParameters:\n\n* 'transport' and 'protocol' instances that methods like *note\ncreateserver(): 94a. and *note createconnection(): 3cc.\nreturn.\n\n* 'sslcontext': a configured instance of *note SSLContext: 278.\n\n* 'serverside' pass 'True' when a server-side connection is\nbeing upgraded (like the one created by *note createserver():\n94a.).\n\n* 'serverhostname': sets or overrides the host name that the\ntarget server's certificate will be matched against.\n\n* 'sslhandshaketimeout' is (for a TLS connection) the time in\nseconds to wait for the TLS handshake to complete before\naborting the connection.  '60.0' seconds if 'None' (default).\n\n* 'sslshutdowntimeout' is the time in seconds to wait for the\nSSL shutdown to complete before aborting the connection.\n'30.0' seconds if 'None' (default).\n\nNew in version 3.7.\n\nChanged in version 3.11: Added the 'sslshutdowntimeout'\nparameter.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Watching file descriptors,  Next: Working with socket objects directly,  Prev: TLS Upgrade,  Up: Event Loop Methods": {
            "content": "5.18.1.59 Watching file descriptors\n...................................\n\n-- Method: loop.addreader (fd, callback, *args)\n\nStart monitoring the 'fd' file descriptor for read availability and\ninvoke 'callback' with the specified arguments once 'fd' is\navailable for reading.\n\n-- Method: loop.removereader (fd)\n\nStop monitoring the 'fd' file descriptor for read availability.\nReturns 'True' if 'fd' was previously being monitored for reads.\n\n-- Method: loop.addwriter (fd, callback, *args)\n\nStart monitoring the 'fd' file descriptor for write availability\nand invoke 'callback' with the specified arguments once 'fd' is\navailable for writing.\n\nUse *note functools.partial(): d31. *note to pass keyword\narguments: 2f93. to 'callback'.\n\n-- Method: loop.removewriter (fd)\n\nStop monitoring the 'fd' file descriptor for write availability.\nReturns 'True' if 'fd' was previously being monitored for writes.\n\nSee also *note Platform Support: 2faa. section for some limitations of\nthese methods.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Working with socket objects directly,  Next: DNS,  Prev: Watching file descriptors,  Up: Event Loop Methods": {
            "content": "5.18.1.60 Working with socket objects directly\n..............................................\n",
            "subsections": []
        },
        "In general, protocol implementations that use transport-based APIs such": {
            "content": "as *note loop.createconnection(): 3cc. and *note loop.createserver():\n94a. are faster than implementations that work with sockets directly.",
            "subsections": []
        },
        "However, there are some use cases when performance is not critical, and": {
            "content": "working with *note socket: bfd. objects directly is more convenient.\n\n-- Method: coroutine loop.sockrecv (sock, nbytes)\n\nReceive up to 'nbytes' from 'sock'.  Asynchronous version of *note\nsocket.recv(): c00.\n\nReturn the received data as a bytes object.\n\n'sock' must be a non-blocking socket.\n\nChanged in version 3.7: Even though this method was always\ndocumented as a coroutine method, releases before Python 3.7\nreturned a *note Future: a11.  Since Python 3.7 this is an 'async\ndef' method.\n\n-- Method: coroutine loop.sockrecvinto (sock, buf)\n\nReceive data from 'sock' into the 'buf' buffer.  Modeled after the\nblocking *note socket.recvinto(): 1195. method.\n\nReturn the number of bytes written to the buffer.\n\n'sock' must be a non-blocking socket.\n\nNew in version 3.7.\n\n-- Method: coroutine loop.sockrecvfrom (sock, bufsize)\n\nReceive a datagram of up to 'bufsize' from 'sock'.  Asynchronous\nversion of *note socket.recvfrom(): c01.\n\nReturn a tuple of (received data, remote address).\n\n'sock' must be a non-blocking socket.\n\nNew in version 3.11.\n\n-- Method: coroutine loop.sockrecvfrominto (sock, buf, nbytes=0)\n\nReceive a datagram of up to 'nbytes' from 'sock' into 'buf'.\nAsynchronous version of *note socket.recvfrominto(): 1196.\n\nReturn a tuple of (number of bytes received, remote address).\n\n'sock' must be a non-blocking socket.\n\nNew in version 3.11.\n\n-- Method: coroutine loop.socksendall (sock, data)\n\nSend 'data' to the 'sock' socket.  Asynchronous version of *note\nsocket.sendall(): c04.\n\nThis method continues to send to the socket until either all data\nin 'data' has been sent or an error occurs.  'None' is returned on\nsuccess.  On error, an exception is raised.  Additionally, there is\nno way to determine how much data, if any, was successfully\nprocessed by the receiving end of the connection.\n\n'sock' must be a non-blocking socket.\n\nChanged in version 3.7: Even though the method was always\ndocumented as a coroutine method, before Python 3.7 it returned a\n*note Future: a11.  Since Python 3.7, this is an 'async def'\nmethod.\n\n-- Method: coroutine loop.socksendto (sock, data, address)\n\nSend a datagram from 'sock' to 'address'.  Asynchronous version of\n*note socket.sendto(): c05.\n\nReturn the number of bytes sent.\n\n'sock' must be a non-blocking socket.\n\nNew in version 3.11.\n\n-- Method: coroutine loop.sockconnect (sock, address)\n\nConnect 'sock' to a remote socket at 'address'.\n\nAsynchronous version of *note socket.connect(): bff.\n\n'sock' must be a non-blocking socket.\n\nChanged in version 3.5.2: 'address' no longer needs to be resolved.\n'sockconnect' will try to check if the 'address' is already\nresolved by calling *note socket.inetpton(): 783.  If not, *note\nloop.getaddrinfo(): a5a. will be used to resolve the 'address'.\n\nSee also\n........\n\n*note loop.createconnection(): 3cc. and *note\nasyncio.openconnection(): 950.\n\n-- Method: coroutine loop.sockaccept (sock)\n\nAccept a connection.  Modeled after the blocking *note\nsocket.accept(): bfe. method.\n\nThe socket must be bound to an address and listening for\nconnections.  The return value is a pair '(conn, address)' where\n'conn' is a 'new' socket object usable to send and receive data on\nthe connection, and 'address' is the address bound to the socket on\nthe other end of the connection.\n\n'sock' must be a non-blocking socket.\n\nChanged in version 3.7: Even though the method was always\ndocumented as a coroutine method, before Python 3.7 it returned a\n*note Future: a11.  Since Python 3.7, this is an 'async def'\nmethod.\n\nSee also\n........\n\n*note loop.createserver(): 94a. and *note startserver(): 951.\n\n-- Method: coroutine loop.socksendfile (sock, file, offset=0,\ncount=None, *, fallback=True)\n\nSend a file using high-performance *note os.sendfile: 946. if\npossible.  Return the total number of bytes sent.\n\nAsynchronous version of *note socket.sendfile(): cc0.\n\n'sock' must be a non-blocking *note socket.SOCKSTREAM: 1168. *note\nsocket: bfd.\n\n'file' must be a regular file object open in binary mode.\n\n'offset' tells from where to start reading the file.  If specified,\n'count' is the total number of bytes to transmit as opposed to\nsending the file until EOF is reached.  File position is always\nupdated, even when this method raises an error, and *note\nfile.tell(): 26a2. can be used to obtain the actual number of bytes\nsent.\n\n'fallback', when set to 'True', makes asyncio manually read and\nsend the file when the platform does not support the sendfile\nsyscall (e.g.  Windows or SSL socket on Unix).\n\nRaise *note SendfileNotAvailableError: 2f82. if the system does not\nsupport 'sendfile' syscall and 'fallback' is 'False'.\n\n'sock' must be a non-blocking socket.\n\nNew in version 3.7.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: DNS,  Next: Working with pipes,  Prev: Working with socket objects directly,  Up: Event Loop Methods": {
            "content": "5.18.1.61 DNS\n.............\n\n-- Method: coroutine loop.getaddrinfo (host, port, *, family=0, type=0,\nproto=0, flags=0)\n\nAsynchronous version of *note socket.getaddrinfo(): 149f.\n\n-- Method: coroutine loop.getnameinfo (sockaddr, flags=0)\n\nAsynchronous version of *note socket.getnameinfo(): 1466.\n",
            "subsections": []
        },
        "Changed in version 3.7: Both 'getaddrinfo' and 'getnameinfo' methods": {
            "content": "were always documented to return a coroutine, but prior to Python 3.7\nthey were, in fact, returning *note asyncio.Future: a11. objects.\nStarting with Python 3.7 both methods are coroutines.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Working with pipes,  Next: Unix signals,  Prev: DNS,  Up: Event Loop Methods": {
            "content": "5.18.1.62 Working with pipes\n............................\n\n-- Method: coroutine loop.connectreadpipe (protocolfactory, pipe)\n\nRegister the read end of 'pipe' in the event loop.\n\n'protocolfactory' must be a callable returning an *note asyncio\nprotocol: 2f99. implementation.\n\n'pipe' is a *note file-like object: 1037.\n\nReturn pair '(transport, protocol)', where 'transport' supports the\n*note ReadTransport: 2fae. interface and 'protocol' is an object\ninstantiated by the 'protocolfactory'.\n\nWith *note SelectorEventLoop: 3d1. event loop, the 'pipe' is set to\nnon-blocking mode.\n\n-- Method: coroutine loop.connectwritepipe (protocolfactory, pipe)\n\nRegister the write end of 'pipe' in the event loop.\n\n'protocolfactory' must be a callable returning an *note asyncio\nprotocol: 2f99. implementation.\n\n'pipe' is *note file-like object: 1037.\n\nReturn pair '(transport, protocol)', where 'transport' supports\n*note WriteTransport: 2faf. interface and 'protocol' is an object\ninstantiated by the 'protocolfactory'.\n\nWith *note SelectorEventLoop: 3d1. event loop, the 'pipe' is set to\nnon-blocking mode.\n\nNote: *note SelectorEventLoop: 3d1. does not support the above\nmethods on Windows.  Use *note ProactorEventLoop: 3d2. instead for\nWindows.\n\nSee also\n........\n\nThe *note loop.subprocessexec(): 2f51. and *note\nloop.subprocessshell(): 2f52. methods.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Unix signals,  Next: Executing code in thread or process pools,  Prev: Working with pipes,  Up: Event Loop Methods": {
            "content": "5.18.1.63 Unix signals\n......................\n\n-- Method: loop.addsignalhandler (signum, callback, *args)\n\nSet 'callback' as the handler for the 'signum' signal.\n\nThe callback will be invoked by 'loop', along with other queued\ncallbacks and runnable coroutines of that event loop.  Unlike\nsignal handlers registered using *note signal.signal(): fa6, a\ncallback registered with this function is allowed to interact with\nthe event loop.\n\nRaise *note ValueError: 183. if the signal number is invalid or\nuncatchable.  Raise *note RuntimeError: 17a. if there is a problem\nsetting up the handler.\n\nUse *note functools.partial(): d31. *note to pass keyword\narguments: 2f93. to 'callback'.\n\nLike *note signal.signal(): fa6, this function must be invoked in\nthe main thread.\n\n-- Method: loop.removesignalhandler (sig)\n\nRemove the handler for the 'sig' signal.\n\nReturn 'True' if the signal handler was removed, or 'False' if no\nhandler was set for the given signal.\n\n*note Availability: 1ad3.: Unix.\n\nSee also\n........\n\nThe *note signal: c1. module.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Executing code in thread or process pools,  Next: Error Handling API,  Prev: Unix signals,  Up: Event Loop Methods": {
            "content": "5.18.1.64 Executing code in thread or process pools\n...................................................\n\n-- Method: awaitable loop.runinexecutor (executor, func, *args)\n\nArrange for 'func' to be called in the specified executor.\n\nThe 'executor' argument should be an *note\nconcurrent.futures.Executor: 2e1c. instance.  The default executor\nis used if 'executor' is 'None'.\n\nExample:\n\nimport asyncio\nimport concurrent.futures\n\ndef blockingio():\n# File operations (such as logging) can block the\n# event loop: run them in a thread pool.\nwith open('/dev/urandom', 'rb') as f:\nreturn f.read(100)\n\ndef cpubound():\n# CPU-bound operations will block the event loop:\n# in general it is preferable to run them in a\n# process pool.\nreturn sum(i * i for i in range(10  7))\n\nasync def main():\nloop = asyncio.getrunningloop()\n\n## Options:\n\n# 1. Run in the default loop's executor:\nresult = await loop.runinexecutor(\nNone, blockingio)\nprint('default thread pool', result)\n\n# 2. Run in a custom thread pool:\nwith concurrent.futures.ThreadPoolExecutor() as pool:\nresult = await loop.runinexecutor(\npool, blockingio)\nprint('custom thread pool', result)\n\n# 3. Run in a custom process pool:\nwith concurrent.futures.ProcessPoolExecutor() as pool:\nresult = await loop.runinexecutor(\npool, cpubound)\nprint('custom process pool', result)\n\nif name == 'main':\nasyncio.run(main())\n\nNote that the entry point guard ('if name == 'main'') is\nrequired for option 3 due to the peculiarities of *note\nmultiprocessing: 8f, which is used by *note ProcessPoolExecutor:\n707.  See *note Safe importing of main module: 2e08.\n\nThis method returns a *note asyncio.Future: a11. object.\n\nUse *note functools.partial(): d31. *note to pass keyword\narguments: 2f93. to 'func'.\n\nChanged in version 3.5.3: *note loop.runinexecutor(): 702. no\nlonger configures the 'maxworkers' of the thread pool executor it\ncreates, instead leaving it up to the thread pool executor (*note\nThreadPoolExecutor: 529.) to set the default.\n\n-- Method: loop.setdefaultexecutor (executor)\n\nSet 'executor' as the default executor used by *note\nruninexecutor(): 702.  'executor' must be an instance of *note\nThreadPoolExecutor: 529.\n\nChanged in version 3.11: 'executor' must be an instance of *note\nThreadPoolExecutor: 529.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Error Handling API,  Next: Enabling debug mode,  Prev: Executing code in thread or process pools,  Up: Event Loop Methods": {
            "content": "5.18.1.65 Error Handling API\n............................\n\nAllows customizing how exceptions are handled in the event loop.\n\n-- Method: loop.setexceptionhandler (handler)\n\nSet 'handler' as the new event loop exception handler.\n\nIf 'handler' is 'None', the default exception handler will be set.\nOtherwise, 'handler' must be a callable with the signature matching\n'(loop, context)', where 'loop' is a reference to the active event\nloop, and 'context' is a 'dict' object containing the details of\nthe exception (see *note callexceptionhandler(): 2fb6.\ndocumentation for details about context).\n\nIf the handler is called on behalf of a *note Task: 201. or *note\nHandle: 1826, it is run in the *note contextvars.Context: 2ea5. of\nthat task or callback handle.\n\nChanged in version 3.12: The handler may be called in the *note\nContext: 2ea5. of the task or handle where the exception\noriginated.\n\n-- Method: loop.getexceptionhandler ()\n\nReturn the current exception handler, or 'None' if no custom\nexception handler was set.\n\nNew in version 3.5.2.\n\n-- Method: loop.defaultexceptionhandler (context)\n\nDefault exception handler.\n\nThis is called when an exception occurs and no exception handler is\nset.  This can be called by a custom exception handler that wants\nto defer to the default handler behavior.\n\n'context' parameter has the same meaning as in *note\ncallexceptionhandler(): 2fb6.\n\n-- Method: loop.callexceptionhandler (context)\n\nCall the current event loop exception handler.\n\n'context' is a 'dict' object containing the following keys (new\nkeys may be introduced in future Python versions):\n\n* 'message': Error message;\n\n* 'exception' (optional): Exception object;\n\n* 'future' (optional): *note asyncio.Future: a11. instance;\n\n* 'task' (optional): *note asyncio.Task: 201. instance;\n\n* 'handle' (optional): *note asyncio.Handle: 1826. instance;\n\n* 'protocol' (optional): *note Protocol: 2f99. instance;\n\n* 'transport' (optional): *note Transport: 2f9a. instance;\n\n* 'socket' (optional): *note socket.socket: bfd. instance;\n\n*\n'asyncgen' (optional): Asynchronous generator that caused\n\nthe exception.\n\nNote: This method should not be overloaded in subclassed event\nloops.  For custom exception handling, use the *note\nsetexceptionhandler(): 2fb5. method.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Enabling debug mode,  Next: Running Subprocesses,  Prev: Error Handling API,  Up: Event Loop Methods": {
            "content": "5.18.1.66 Enabling debug mode\n.............................\n\n-- Method: loop.getdebug ()\n\nGet the debug mode (*note bool: 17d.) of the event loop.\n\nThe default value is 'True' if the environment variable *note\nPYTHONASYNCIODEBUG: 1ace. is set to a non-empty string, 'False'\notherwise.\n\n-- Method: loop.setdebug (enabled: bool)\n\nSet the debug mode of the event loop.\n\nChanged in version 3.7: The new *note Python Development Mode: 6e3.\ncan now also be used to enable the debug mode.\n\n-- Attribute: loop.slowcallbackduration\n\nThis attribute can be used to set the minimum execution duration in\nseconds that is considered \"slow\".  When debug mode is enabled,\n\"slow\" callbacks are logged.\n\nDefault value is 100 milliseconds.\n\nSee also\n........\n\nThe *note debug mode of asyncio: 1acf.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Running Subprocesses,  Prev: Enabling debug mode,  Up: Event Loop Methods": {
            "content": "5.18.1.67 Running Subprocesses\n..............................\n",
            "subsections": []
        },
        "Methods described in this subsections are low-level.  In regular": {
            "content": "async/await code consider using the high-level *note\nasyncio.createsubprocessshell(): 8a6. and *note\nasyncio.createsubprocessexec(): 8a5. convenience functions instead.\n\nNote: On Windows, the default event loop *note ProactorEventLoop:\n3d2. supports subprocesses, whereas *note SelectorEventLoop: 3d1.\ndoes not.  See *note Subprocess Support on Windows: 2f53. for\ndetails.\n\n-- Method: coroutine loop.subprocessexec (protocolfactory, *args,\nstdin=subprocess.PIPE, stdout=subprocess.PIPE,\nstderr=subprocess.PIPE, kwargs)\n\nCreate a subprocess from one or more string arguments specified by\n'args'.\n\n'args' must be a list of strings represented by:\n\n* *note str: 157.;\n\n* or *note bytes: 295, encoded to the *note filesystem encoding:\n27f9.\n\nThe first string specifies the program executable, and the\nremaining strings specify the arguments.  Together, string\narguments form the 'argv' of the program.\n\nThis is similar to the standard library *note subprocess.Popen:\n8c3. class called with 'shell=False' and the list of strings passed\nas the first argument; however, where *note Popen: 8c3. takes a\nsingle argument which is list of strings, 'subprocessexec' takes\nmultiple string arguments.\n\nThe 'protocolfactory' must be a callable returning a subclass of\nthe *note asyncio.SubprocessProtocol: 2fbb. class.\n\nOther parameters:\n\n* 'stdin' can be any of these:\n\n* a file-like object\n\n* an existing file descriptor (a positive integer), for\nexample those created with *note os.pipe(): 1538.\n\n* the *note subprocess.PIPE: 9ca. constant (default) which\nwill create a new pipe and connect it,\n\n* the value 'None' which will make the subprocess inherit\nthe file descriptor from this process\n\n* the *note subprocess.DEVNULL: fc2. constant which\nindicates that the special *note os.devnull: 17ad. file\nwill be used\n\n* 'stdout' can be any of these:\n\n* a file-like object\n\n* the *note subprocess.PIPE: 9ca. constant (default) which\nwill create a new pipe and connect it,\n\n* the value 'None' which will make the subprocess inherit\nthe file descriptor from this process\n\n* the *note subprocess.DEVNULL: fc2. constant which\nindicates that the special *note os.devnull: 17ad. file\nwill be used\n\n* 'stderr' can be any of these:\n\n* a file-like object\n\n* the *note subprocess.PIPE: 9ca. constant (default) which\nwill create a new pipe and connect it,\n\n* the value 'None' which will make the subprocess inherit\nthe file descriptor from this process\n\n* the *note subprocess.DEVNULL: fc2. constant which\nindicates that the special *note os.devnull: 17ad. file\nwill be used\n\n* the *note subprocess.STDOUT: 2e3c. constant which will\nconnect the standard error stream to the process'\nstandard output stream\n\n* All other keyword arguments are passed to *note\nsubprocess.Popen: 8c3. without interpretation, except for\n'bufsize', 'universalnewlines', 'shell', 'text', 'encoding'\nand 'errors', which should not be specified at all.\n\nThe 'asyncio' subprocess API does not support decoding the\nstreams as text.  *note bytes.decode(): 6ef. can be used to\nconvert the bytes returned from the stream to text.\n\nIf a file-like object passed as 'stdin', 'stdout' or 'stderr'\nrepresents a pipe, then the other side of this pipe should be\nregistered with *note connectwritepipe(): 2f55. or *note\nconnectreadpipe(): 2f54. for use with the event loop.\n\nSee the constructor of the *note subprocess.Popen: 8c3. class for\ndocumentation on other arguments.\n\nReturns a pair of '(transport, protocol)', where 'transport'\nconforms to the *note asyncio.SubprocessTransport: 2fbc. base class\nand 'protocol' is an object instantiated by the 'protocolfactory'.\n\n-- Method: coroutine loop.subprocessshell (protocolfactory, cmd, *,\nstdin=subprocess.PIPE, stdout=subprocess.PIPE,\nstderr=subprocess.PIPE, kwargs)\n\nCreate a subprocess from 'cmd', which can be a *note str: 157. or a\n*note bytes: 295. string encoded to the *note filesystem encoding:\n27f9, using the platform's \"shell\" syntax.\n\nThis is similar to the standard library *note subprocess.Popen:\n8c3. class called with 'shell=True'.\n\nThe 'protocolfactory' must be a callable returning a subclass of\nthe *note SubprocessProtocol: 2fbb. class.\n\nSee *note subprocessexec(): 2f51. for more details about the\nremaining arguments.\n\nReturns a pair of '(transport, protocol)', where 'transport'\nconforms to the *note SubprocessTransport: 2fbc. base class and\n'protocol' is an object instantiated by the 'protocolfactory'.\n\nNote: It is the application's responsibility to ensure that all\nwhitespace and special characters are quoted appropriately to avoid\nshell injection(1) vulnerabilities.  The *note shlex.quote(): f9c.\nfunction can be used to properly escape whitespace and special\ncharacters in strings that are going to be used to construct shell\ncommands.\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Shellinjection#Shellinjection\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Callback Handles,  Next: Server Objects,  Prev: Event Loop Methods,  Up: Event Loop": {
            "content": "5.18.1.68 Callback Handles\n..........................\n\n-- Class: asyncio.Handle\n\nA callback wrapper object returned by *note loop.callsoon(): 93b,\n*note loop.callsoonthreadsafe(): 93c.\n\n-- Method: getcontext ()\n\nReturn the *note contextvars.Context: 2ea5. object associated\nwith the handle.\n\nNew in version 3.12.\n\n-- Method: cancel ()\n\nCancel the callback.  If the callback has already been\ncanceled or executed, this method has no effect.\n\n-- Method: cancelled ()\n\nReturn 'True' if the callback was cancelled.\n\nNew in version 3.7.\n\n-- Class: asyncio.TimerHandle\n\nA callback wrapper object returned by *note loop.calllater(): 93d,\nand *note loop.callat(): 93e.\n\nThis class is a subclass of *note Handle: 1826.\n\n-- Method: when ()\n\nReturn a scheduled callback time as *note float: 4b7. seconds.\n\nThe time is an absolute timestamp, using the same time\nreference as *note loop.time(): 2f96.\n\nNew in version 3.7.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Server Objects,  Next: Event Loop Implementations,  Prev: Callback Handles,  Up: Event Loop": {
            "content": "5.18.1.69 Server Objects\n........................\n\nServer objects are created by *note loop.createserver(): 94a, *note\nloop.createunixserver(): 94b, *note startserver(): 951, and *note\nstartunixserver(): 2f0f. functions.\n\nDo not instantiate the *note Server: 949. class directly.\n\n-- Class: asyncio.Server\n\n'Server' objects are asynchronous context managers.  When used in\nan 'async with' statement, it's guaranteed that the Server object\nis closed and not accepting new connections when the 'async with'\nstatement is completed:\n\nsrv = await loop.createserver(...)\n\nasync with srv:\n# some code\n\n# At this point, srv is closed and no longer accepts new connections.\n\nChanged in version 3.7: Server object is an asynchronous context\nmanager since Python 3.7.\n\nChanged in version 3.11: This class was exposed publicly as\n'asyncio.Server' in Python 3.9.11, 3.10.3 and 3.11.\n\n-- Method: close ()\n\nStop serving: close listening sockets and set the *note\nsockets: a5c. attribute to 'None'.\n\nThe sockets that represent existing incoming client\nconnections are left open.\n\nThe server is closed asynchronously; use the *note\nwaitclosed(): 13ee. coroutine to wait until the server is\nclosed (and no more connections are active).\n\n-- Method: getloop ()\n\nReturn the event loop associated with the server object.\n\nNew in version 3.7.\n\n-- Method: coroutine startserving ()\n\nStart accepting connections.\n\nThis method is idempotent, so it can be called when the server\nis already serving.\n\nThe 'startserving' keyword-only parameter to *note\nloop.createserver(): 94a. and *note asyncio.startserver():\n951. allows creating a Server object that is not accepting\nconnections initially.  In this case 'Server.startserving()',\nor *note Server.serveforever(): 94d. can be used to make the\nServer start accepting connections.\n\nNew in version 3.7.\n\n-- Method: coroutine serveforever ()\n\nStart accepting connections until the coroutine is cancelled.\nCancellation of 'serveforever' task causes the server to be\nclosed.\n\nThis method can be called if the server is already accepting\nconnections.  Only one 'serveforever' task can exist per one\n'Server' object.\n\nExample:\n\nasync def clientconnected(reader, writer):\n# Communicate with the client with\n# reader/writer streams.  For example:\nawait reader.readline()\n\nasync def main(host, port):\nsrv = await asyncio.startserver(\nclientconnected, host, port)\nawait srv.serveforever()\n\nasyncio.run(main('127.0.0.1', 0))\n\nNew in version 3.7.\n\n-- Method: isserving ()\n\nReturn 'True' if the server is accepting new connections.\n\nNew in version 3.7.\n\n-- Method: coroutine waitclosed ()\n\nWait until the *note close(): 2f0c. method completes and all\nactive connections have finished.\n\n-- Attribute: sockets\n\nList of socket-like objects, 'asyncio.trsock.TransportSocket',\nwhich the server is listening on.\n\nChanged in version 3.7: Prior to Python 3.7 'Server.sockets'\nused to return an internal list of server sockets directly.\nIn 3.7 a copy of that list is returned.\n\nFile: python3.12.info,  Node: Event Loop Implementations,  Next: Examples<17>,  Prev: Server Objects,  Up: Event Loop\n\n5.18.1.70 Event Loop Implementations\n....................................\n\nasyncio ships with two different event loop implementations: *note\nSelectorEventLoop: 3d1. and *note ProactorEventLoop: 3d2.\n\nBy default asyncio is configured to use *note SelectorEventLoop: 3d1. on\nUnix and *note ProactorEventLoop: 3d2. on Windows.\n\n-- Class: asyncio.SelectorEventLoop\n\nAn event loop based on the *note selectors: bd. module.\n\nUses the most efficient 'selector' available for the given\nplatform.  It is also possible to manually configure the exact\nselector implementation to be used:\n\nimport asyncio\nimport selectors\n\nclass MyPolicy(asyncio.DefaultEventLoopPolicy):\ndef neweventloop(self):\nselector = selectors.SelectSelector()\nreturn asyncio.SelectorEventLoop(selector)\n\nasyncio.seteventlooppolicy(MyPolicy())\n\n*note Availability: 1ad3.: Unix, Windows.\n\n-- Class: asyncio.ProactorEventLoop\n\nAn event loop for Windows that uses \"I/O Completion Ports\" (IOCP).\n\n*note Availability: 1ad3.: Windows.\n\nSee also\n........\n\nMSDN documentation on I/O Completion Ports(1).\n\n-- Class: asyncio.AbstractEventLoop\n\nAbstract base class for asyncio-compliant event loops.\n\nThe *note Event Loop Methods: 2f8d. section lists all methods that\nan alternative implementation of 'AbstractEventLoop' should have\ndefined.\n\n---------- Footnotes ----------\n\n(1)\nhttps://docs.microsoft.com/en-ca/windows/desktop/FileIO/i-o-completion-ports\n\nFile: python3.12.info,  Node: Examples<17>,  Prev: Event Loop Implementations,  Up: Event Loop\n\n5.18.1.71 Examples\n..................\n",
            "subsections": []
        },
        "Note that all examples in this section 'purposefully' show how to use": {
            "content": "the low-level event loop APIs, such as *note loop.runforever(): 2f8f.\nand *note loop.callsoon(): 93b.  Modern asyncio applications rarely\nneed to be written this way; consider using the high-level functions\nlike *note asyncio.run(): 197.\n\n* Menu:\n\n* Hello World with callsoon(): Hello World with callsoon.\n* Display the current date with calllater(): Display the current date with calllater.\n* Watch a file descriptor for read events::\n* Set signal handlers for SIGINT and SIGTERM::\n\nFile: python3.12.info,  Node: Hello World with callsoon,  Next: Display the current date with calllater,  Up: Examples<17>\n\n5.18.1.72 Hello World with callsoon()\n......................................\n\nAn example using the *note loop.callsoon(): 93b. method to schedule a\ncallback.  The callback displays '\"Hello World\"' and then stops the\nevent loop:\n\nimport asyncio\n\ndef helloworld(loop):\n\"\"\"A callback to print 'Hello World' and stop the event loop\"\"\"\nprint('Hello World')\nloop.stop()\n\nloop = asyncio.neweventloop()\n\n# Schedule a call to helloworld()\nloop.callsoon(helloworld, loop)\n\n# Blocking call interrupted by loop.stop()\ntry:\nloop.runforever()\nfinally:\nloop.close()\n\nSee also\n........\n\nA similar *note Hello World: 2ec9. example created with a coroutine and\nthe *note run(): 197. function.\n\nFile: python3.12.info,  Node: Display the current date with calllater,  Next: Watch a file descriptor for read events,  Prev: Hello World with callsoon,  Up: Examples<17>\n\n5.18.1.73 Display the current date with calllater()\n....................................................\n",
            "subsections": []
        },
        "An example of a callback displaying the current date every second.  The": {
            "content": "callback uses the *note loop.calllater(): 93d. method to reschedule\nitself after 5 seconds, and then stops the event loop:\n\nimport asyncio\nimport datetime\n\ndef displaydate(endtime, loop):\nprint(datetime.datetime.now())\nif (loop.time() + 1.0) < endtime:\nloop.calllater(1, displaydate, endtime, loop)\nelse:\nloop.stop()\n\nloop = asyncio.neweventloop()\n\n# Schedule the first call to displaydate()\nendtime = loop.time() + 5.0\nloop.callsoon(displaydate, endtime, loop)\n\n# Blocking call interrupted by loop.stop()\ntry:\nloop.runforever()\nfinally:\nloop.close()\n\nSee also\n........\n\nA similar *note current date: 2ee7. example created with a coroutine and\nthe *note run(): 197. function.\n\nFile: python3.12.info,  Node: Watch a file descriptor for read events,  Next: Set signal handlers for SIGINT and SIGTERM,  Prev: Display the current date with calllater,  Up: Examples<17>\n\n5.18.1.74 Watch a file descriptor for read events\n.................................................\n\nWait until a file descriptor received some data using the *note\nloop.addreader(): 2f29. method and then close the event loop:\n\nimport asyncio\nfrom socket import socketpair\n\n# Create a pair of connected file descriptors\nrsock, wsock = socketpair()\n\nloop = asyncio.neweventloop()\n\ndef reader():\ndata = rsock.recv(100)\nprint(\"Received:\", data.decode())\n\n# We are done: unregister the file descriptor\nloop.removereader(rsock)\n\n# Stop the event loop\nloop.stop()\n\n# Register the file descriptor for read event\nloop.addreader(rsock, reader)\n\n# Simulate the reception of data from the network\nloop.callsoon(wsock.send, 'abc'.encode())\n\ntry:\n# Run the event loop\nloop.runforever()\nfinally:\n# We are done. Close sockets and the event loop.\nrsock.close()\nwsock.close()\nloop.close()\n\nSee also\n........\n\n* A similar *note example: 2f27. using transports, protocols, and the\n*note loop.createconnection(): 3cc. method.\n\n* Another similar *note example: 2f25. using the high-level *note\nasyncio.openconnection(): 950. function and streams.\n\nFile: python3.12.info,  Node: Set signal handlers for SIGINT and SIGTERM,  Prev: Watch a file descriptor for read events,  Up: Examples<17>\n\n5.18.1.75 Set signal handlers for SIGINT and SIGTERM\n....................................................\n\n(This 'signals' example only works on Unix.)\n\nRegister handlers for signals *note SIGINT: 63a. and *note SIGTERM:\n1234. using the *note loop.addsignalhandler(): 2fb1. method:\n\nimport asyncio\nimport functools\nimport os\nimport signal\n\ndef askexit(signame, loop):\nprint(\"got signal %s: exit\" % signame)\nloop.stop()\n\nasync def main():\nloop = asyncio.getrunningloop()\n\nfor signame in {'SIGINT', 'SIGTERM'}:\nloop.addsignalhandler(\ngetattr(signal, signame),\nfunctools.partial(askexit, signame, loop))\n\nawait asyncio.sleep(3600)\n\nprint(\"Event loop running for 1 hour, press Ctrl+C to interrupt.\")\nprint(f\"pid {os.getpid()}: send SIGINT or SIGTERM to exit.\")\n\nasyncio.run(main())\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Futures,  Next: Transports and Protocols,  Prev: Event Loop,  Up: asyncio -- Asynchronous I/O": {
            "content": "5.18.1.76 Futures\n.................\n\n'Source code:' Lib/asyncio/futures.py(1), Lib/asyncio/basefutures.py(2)\n\n\n\n'Future' objects are used to bridge 'low-level callback-based code' with\nhigh-level async/await code.\n\n* Menu:\n\n* Future Functions::\n* Future Object::\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/asyncio/futures.py\n\n(2)\nhttps://github.com/python/cpython/tree/3.12/Lib/asyncio/basefutures.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Future Functions,  Next: Future Object,  Up: Futures": {
            "content": "5.18.1.77 Future Functions\n..........................\n\n-- Function: asyncio.isfuture (obj)\n\nReturn 'True' if 'obj' is either of:\n\n* an instance of *note asyncio.Future: a11,\n\n* an instance of *note asyncio.Task: 201,\n\n* a Future-like object with a 'asynciofutureblocking'\nattribute.\n\nNew in version 3.5.\n\n-- Function: asyncio.ensurefuture (obj, *, loop=None)\n\nReturn:\n\n* 'obj' argument as is, if 'obj' is a *note Future: a11, a *note\nTask: 201, or a Future-like object (*note isfuture(): 2fcb. is\nused for the test.)\n\n* a *note Task: 201. object wrapping 'obj', if 'obj' is a\ncoroutine (*note iscoroutine(): 199. is used for the test); in\nthis case the coroutine will be scheduled by\n'ensurefuture()'.\n\n* a *note Task: 201. object that would await on 'obj', if 'obj'\nis an awaitable (*note inspect.isawaitable(): c76. is used for\nthe test.)\n\nIf 'obj' is neither of the above a *note TypeError: 28e. is raised.\n\nImportant: See also the *note createtask(): 3c5. function\nwhich is the preferred way for creating new Tasks.\n\nSave a reference to the result of this function, to avoid a\ntask disappearing mid-execution.\n\nChanged in version 3.5.1: The function accepts any *note awaitable:\nac3. object.\n\nDeprecated since version 3.10: Deprecation warning is emitted if\n'obj' is not a Future-like object and 'loop' is not specified and\nthere is no running event loop.\n\n-- Function: asyncio.wrapfuture (future, *, loop=None)\n\nWrap a *note concurrent.futures.Future: 1025. object in a *note\nasyncio.Future: a11. object.\n\nDeprecated since version 3.10: Deprecation warning is emitted if\n'future' is not a Future-like object and 'loop' is not specified\nand there is no running event loop.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Future Object,  Prev: Future Functions,  Up: Futures": {
            "content": "5.18.1.78 Future Object\n.......................\n\n-- Class: asyncio.Future (*, loop=None)\n\nA Future represents an eventual result of an asynchronous\noperation.  Not thread-safe.\n\nFuture is an *note awaitable: ac3. object.  Coroutines can await on\nFuture objects until they either have a result or an exception set,\nor until they are cancelled.  A Future can be awaited multiple\ntimes and the result is same.\n\nTypically Futures are used to enable low-level callback-based code\n(e.g.  in protocols implemented using asyncio *note transports:\n2ed1.) to interoperate with high-level async/await code.\n\nThe rule of thumb is to never expose Future objects in user-facing\nAPIs, and the recommended way to create a Future object is to call\n*note loop.createfuture(): ac5.  This way alternative event loop\nimplementations can inject their own optimized implementations of a\nFuture object.\n\nChanged in version 3.7: Added support for the *note contextvars:\n22. module.\n\nDeprecated since version 3.10: Deprecation warning is emitted if\n'loop' is not specified and there is no running event loop.\n\n-- Method: result ()\n\nReturn the result of the Future.\n\nIf the Future is 'done' and has a result set by the *note\nsetresult(): 2efc. method, the result value is returned.\n\nIf the Future is 'done' and has an exception set by the *note\nsetexception(): 2efd. method, this method raises the\nexception.\n\nIf the Future has been 'cancelled', this method raises a *note\nCancelledError: 7fe. exception.\n\nIf the Future's result isn't yet available, this method raises\na *note InvalidStateError: 2f00. exception.\n\n-- Method: setresult (result)\n\nMark the Future as 'done' and set its result.\n\nRaises a *note InvalidStateError: 2f00. error if the Future is\nalready 'done'.\n\n-- Method: setexception (exception)\n\nMark the Future as 'done' and set an exception.\n\nRaises a *note InvalidStateError: 2f00. error if the Future is\nalready 'done'.\n\n-- Method: done ()\n\nReturn 'True' if the Future is 'done'.\n\nA Future is 'done' if it was 'cancelled' or if it has a result\nor an exception set with *note setresult(): 2efc. or *note\nsetexception(): 2efd. calls.\n\n-- Method: cancelled ()\n\nReturn 'True' if the Future was 'cancelled'.\n\nThe method is usually used to check if a Future is not\n'cancelled' before setting a result or an exception for it:\n\nif not fut.cancelled():\nfut.setresult(42)\n\n-- Method: adddonecallback (callback, *, context=None)\n\nAdd a callback to be run when the Future is 'done'.\n\nThe 'callback' is called with the Future object as its only\nargument.\n\nIf the Future is already 'done' when this method is called,\nthe callback is scheduled with *note loop.callsoon(): 93b.\n\nAn optional keyword-only 'context' argument allows specifying\na custom *note contextvars.Context: 2ea5. for the 'callback'\nto run in.  The current context is used when no 'context' is\nprovided.\n\n*note functools.partial(): d31. can be used to pass parameters\nto the callback, e.g.:\n\n# Call 'print(\"Future:\", fut)' when \"fut\" is done.\nfut.adddonecallback(\nfunctools.partial(print, \"Future:\"))\n\nChanged in version 3.7: The 'context' keyword-only parameter\nwas added.  See PEP 567(1) for more details.\n\n-- Method: removedonecallback (callback)\n\nRemove 'callback' from the callbacks list.\n\nReturns the number of callbacks removed, which is typically 1,\nunless a callback was added more than once.\n\n-- Method: cancel (msg=None)\n\nCancel the Future and schedule callbacks.\n\nIf the Future is already 'done' or 'cancelled', return\n'False'.  Otherwise, change the Future's state to 'cancelled',\nschedule the callbacks, and return 'True'.\n\nChanged in version 3.9: Added the 'msg' parameter.\n\n-- Method: exception ()\n\nReturn the exception that was set on this Future.\n\nThe exception (or 'None' if no exception was set) is returned\nonly if the Future is 'done'.\n\nIf the Future has been 'cancelled', this method raises a *note\nCancelledError: 7fe. exception.\n\nIf the Future isn't 'done' yet, this method raises an *note\nInvalidStateError: 2f00. exception.\n\n-- Method: getloop ()\n\nReturn the event loop the Future object is bound to.\n\nNew in version 3.7.\n",
            "subsections": []
        },
        "This example creates a Future object, creates and schedules an": {
            "content": "asynchronous Task to set result for the Future, and waits until the\nFuture has a result:\n\nasync def setafter(fut, delay, value):\n# Sleep for *delay* seconds.\nawait asyncio.sleep(delay)\n\n# Set *value* as a result of *fut* Future.\nfut.setresult(value)\n\nasync def main():\n# Get the current event loop.\nloop = asyncio.getrunningloop()\n\n# Create a new Future object.\nfut = loop.createfuture()\n\n# Run \"setafter()\" coroutine in a parallel Task.\n# We are using the low-level \"loop.createtask()\" API here because\n# we already have a reference to the event loop at hand.\n# Otherwise we could have just used \"asyncio.createtask()\".\nloop.createtask(\nsetafter(fut, 1, '... world'))\n\nprint('hello ...')\n\n# Wait until *fut* has a result (1 second) and print it.\nprint(await fut)\n\nasyncio.run(main())\n\nImportant: The Future object was designed to mimic *note\nconcurrent.futures.Future: 1025.  Key differences include:\n\n- unlike asyncio Futures, *note concurrent.futures.Future: 1025.\ninstances cannot be awaited.\n\n- *note asyncio.Future.result(): 2fcd. and *note\nasyncio.Future.exception(): 2fd0. do not accept the 'timeout'\nargument.\n\n- *note asyncio.Future.result(): 2fcd. and *note\nasyncio.Future.exception(): 2fd0. raise an *note\nInvalidStateError: 2f00. exception when the Future is not\n'done'.\n\n- Callbacks registered with *note\nasyncio.Future.adddonecallback(): 93f. are not called\nimmediately.  They are scheduled with *note loop.callsoon():\n93b. instead.\n\n- asyncio Future is not compatible with the *note\nconcurrent.futures.wait(): 15c4. and *note\nconcurrent.futures.ascompleted(): 2e2d. functions.\n\n- *note asyncio.Future.cancel(): 1579. accepts an optional 'msg'\nargument, but *note concurrent.futures.Future.cancel(): 2e25.\ndoes not.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0567/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Transports and Protocols,  Next: Policies,  Prev: Futures,  Up: asyncio -- Asynchronous I/O": {
            "content": "5.18.1.79 Transports and Protocols\n..................................\n",
            "subsections": []
        },
        "Transports and Protocols are used by the 'low-level' event loop APIs": {
            "content": "such as *note loop.createconnection(): 3cc.  They use callback-based\nprogramming style and enable high-performance implementations of network\nor IPC protocols (e.g.  HTTP).\n",
            "subsections": []
        },
        "Essentially, transports and protocols should only be used in libraries": {
            "content": "and frameworks and never in high-level asyncio applications.\n\nThis documentation page covers both *note Transports: 2fd4. and *note\nProtocols: 2fd5.\n",
            "subsections": []
        },
        "At the highest level, the transport is concerned with 'how' bytes are": {
            "content": "transmitted, while the protocol determines 'which' bytes to transmit\n(and to some extent when).\n\nA different way of saying the same thing: a transport is an abstraction\nfor a socket (or similar I/O endpoint) while a protocol is an\nabstraction for an application, from the transport's point of view.\n",
            "subsections": []
        },
        "Yet another view is the transport and protocol interfaces together": {
            "content": "define an abstract interface for using network I/O and interprocess I/O.\n",
            "subsections": []
        },
        "There is always a 1:1 relationship between transport and protocol": {
            "content": "objects: the protocol calls transport methods to send data, while the\ntransport calls protocol methods to pass it data that has been received.\n\nMost of connection oriented event loop methods (such as *note\nloop.createconnection(): 3cc.) usually accept a 'protocolfactory'\nargument used to create a 'Protocol' object for an accepted connection,\nrepresented by a 'Transport' object.  Such methods usually return a\ntuple of '(transport, protocol)'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Transports,  Next: Protocols,  Up: Transports and Protocols": {
            "content": "5.18.1.80 Transports\n....................\n\n'Source code:' Lib/asyncio/transports.py(1)\n\n\n\nTransports are classes provided by *note asyncio: 9. in order to\nabstract various kinds of communication channels.\n\nTransport objects are always instantiated by an *note asyncio event\nloop: bd3.\n\nasyncio implements transports for TCP, UDP, SSL, and subprocess pipes.\nThe methods available on a transport depend on the transport's kind.\n\nThe transport classes are *note not thread safe: 2ef8.\n\n* Menu:\n\n* Transports Hierarchy::\n* Base Transport::\n* Read-only Transports::\n* Write-only Transports::\n* Datagram Transports::\n* Subprocess Transports::\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/asyncio/transports.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Transports Hierarchy,  Next: Base Transport,  Up: Transports": {
            "content": "5.18.1.81 Transports Hierarchy\n..............................\n\n-- Class: asyncio.BaseTransport\n\nBase class for all transports.  Contains methods that all asyncio\ntransports share.\n\n-- Class: asyncio.WriteTransport (BaseTransport)\n\nA base transport for write-only connections.\n\nInstances of the 'WriteTransport' class are returned from the *note\nloop.connectwritepipe(): 2f55. event loop method and are also\nused by subprocess-related methods like *note\nloop.subprocessexec(): 2f51.\n\n-- Class: asyncio.ReadTransport (BaseTransport)\n\nA base transport for read-only connections.\n\nInstances of the 'ReadTransport' class are returned from the *note\nloop.connectreadpipe(): 2f54. event loop method and are also used\nby subprocess-related methods like *note loop.subprocessexec():\n2f51.\n\n-- Class: asyncio.Transport (WriteTransport, ReadTransport)\n\nInterface representing a bidirectional transport, such as a TCP\nconnection.\n\nThe user does not instantiate a transport directly; they call a\nutility function, passing it a protocol factory and other\ninformation necessary to create the transport and protocol.\n\nInstances of the 'Transport' class are returned from or used by\nevent loop methods like *note loop.createconnection(): 3cc, *note\nloop.createunixconnection(): 2f0e, *note loop.createserver():\n94a, *note loop.sendfile(): 2fa4, etc.\n\n-- Class: asyncio.DatagramTransport (BaseTransport)\n\nA transport for datagram (UDP) connections.\n\nInstances of the 'DatagramTransport' class are returned from the\n*note loop.createdatagramendpoint(): 517. event loop method.\n\n-- Class: asyncio.SubprocessTransport (BaseTransport)\n\nAn abstraction to represent a connection between a parent and its\nchild OS process.\n\nInstances of the 'SubprocessTransport' class are returned from\nevent loop methods *note loop.subprocessshell(): 2f52. and *note\nloop.subprocessexec(): 2f51.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Base Transport,  Next: Read-only Transports,  Prev: Transports Hierarchy,  Up: Transports": {
            "content": "5.18.1.82 Base Transport\n........................\n\n-- Method: BaseTransport.close ()\n\nClose the transport.\n\nIf the transport has a buffer for outgoing data, buffered data will\nbe flushed asynchronously.  No more data will be received.  After\nall buffered data is flushed, the protocol's *note\nprotocol.connectionlost(): 2fdd. method will be called with *note\nNone: 43f. as its argument.  The transport should not be used once\nit is closed.\n\n-- Method: BaseTransport.isclosing ()\n\nReturn 'True' if the transport is closing or is closed.\n\n-- Method: BaseTransport.getextrainfo (name, default=None)\n\nReturn information about the transport or underlying resources it\nuses.\n\n'name' is a string representing the piece of transport-specific\ninformation to get.\n\n'default' is the value to return if the information is not\navailable, or if the transport does not support querying it with\nthe given third-party event loop implementation or on the current\nplatform.\n\nFor example, the following code attempts to get the underlying\nsocket object of the transport:\n\nsock = transport.getextrainfo('socket')\nif sock is not None:\nprint(sock.getsockopt(...))\n\nCategories of information that can be queried on some transports:\n\n* socket:\n\n- ''peername'': the remote address to which the socket is\nconnected, result of *note socket.socket.getpeername():\n2fde. ('None' on error)\n\n- ''socket'': *note socket.socket: bfd. instance\n\n- ''sockname'': the socket's own address, result of *note\nsocket.socket.getsockname(): 2fdf.\n\n* SSL socket:\n\n- ''compression'': the compression algorithm being used as\na string, or 'None' if the connection isn't compressed;\nresult of *note ssl.SSLSocket.compression(): fb9.\n\n- ''cipher'': a three-value tuple containing the name of\nthe cipher being used, the version of the SSL protocol\nthat defines its use, and the number of secret bits being\nused; result of *note ssl.SSLSocket.cipher(): 2fe0.\n\n- ''peercert'': peer certificate; result of *note\nssl.SSLSocket.getpeercert(): e27.\n\n- ''sslcontext'': *note ssl.SSLContext: 278. instance\n\n- ''sslobject'': *note ssl.SSLObject: 9c2. or *note\nssl.SSLSocket: 703. instance\n\n* pipe:\n\n- ''pipe'': pipe object\n\n* subprocess:\n\n- ''subprocess'': *note subprocess.Popen: 8c3. instance\n\n-- Method: BaseTransport.setprotocol (protocol)\n\nSet a new protocol.\n\nSwitching protocol should only be done when both protocols are\ndocumented to support the switch.\n\n-- Method: BaseTransport.getprotocol ()\n\nReturn the current protocol.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Read-only Transports,  Next: Write-only Transports,  Prev: Base Transport,  Up: Transports": {
            "content": "5.18.1.83 Read-only Transports\n..............................\n\n-- Method: ReadTransport.isreading ()\n\nReturn 'True' if the transport is receiving new data.\n\nNew in version 3.7.\n\n-- Method: ReadTransport.pausereading ()\n\nPause the receiving end of the transport.  No data will be passed\nto the protocol's *note protocol.datareceived(): 14e1. method\nuntil *note resumereading(): 955. is called.\n\nChanged in version 3.7: The method is idempotent, i.e.  it can be\ncalled when the transport is already paused or closed.\n\n-- Method: ReadTransport.resumereading ()\n\nResume the receiving end.  The protocol's *note\nprotocol.datareceived(): 14e1. method will be called once again if\nsome data is available for reading.\n\nChanged in version 3.7: The method is idempotent, i.e.  it can be\ncalled when the transport is already reading.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Write-only Transports,  Next: Datagram Transports,  Prev: Read-only Transports,  Up: Transports": {
            "content": "5.18.1.84 Write-only Transports\n...............................\n\n-- Method: WriteTransport.abort ()\n\nClose the transport immediately, without waiting for pending\noperations to complete.  Buffered data will be lost.  No more data\nwill be received.  The protocol's *note protocol.connectionlost():\n2fdd. method will eventually be called with *note None: 43f. as its\nargument.\n\n-- Method: WriteTransport.canwriteeof ()\n\nReturn *note True: a53. if the transport supports *note\nwriteeof(): 2fe7, *note False: 971. if not.\n\n-- Method: WriteTransport.getwritebuffersize ()\n\nReturn the current size of the output buffer used by the transport.\n\n-- Method: WriteTransport.getwritebufferlimits ()\n\nGet the 'high' and 'low' watermarks for write flow control.  Return\na tuple '(low, high)' where 'low' and 'high' are positive number of\nbytes.\n\nUse *note setwritebufferlimits(): 2fe9. to set the limits.\n\nNew in version 3.4.2.\n\n-- Method: WriteTransport.setwritebufferlimits (high=None, low=None)\n\nSet the 'high' and 'low' watermarks for write flow control.\n\nThese two values (measured in number of bytes) control when the\nprotocol's *note protocol.pausewriting(): 2fea. and *note\nprotocol.resumewriting(): 2feb. methods are called.  If specified,\nthe low watermark must be less than or equal to the high watermark.\nNeither 'high' nor 'low' can be negative.\n\n*note pausewriting(): 2fea. is called when the buffer size becomes\ngreater than or equal to the 'high' value.  If writing has been\npaused, *note resumewriting(): 2feb. is called when the buffer\nsize becomes less than or equal to the 'low' value.\n\nThe defaults are implementation-specific.  If only the high\nwatermark is given, the low watermark defaults to an\nimplementation-specific value less than or equal to the high\nwatermark.  Setting 'high' to zero forces 'low' to zero as well,\nand causes *note pausewriting(): 2fea. to be called whenever the\nbuffer becomes non-empty.  Setting 'low' to zero causes *note\nresumewriting(): 2feb. to be called only once the buffer is empty.\nUse of zero for either limit is generally sub-optimal as it reduces\nopportunities for doing I/O and computation concurrently.\n\nUse *note getwritebufferlimits(): c21. to get the limits.\n\n-- Method: WriteTransport.write (data)\n\nWrite some 'data' bytes to the transport.\n\nThis method does not block; it buffers the data and arranges for it\nto be sent out asynchronously.\n\n-- Method: WriteTransport.writelines (listofdata)\n\nWrite a list (or any iterable) of data bytes to the transport.\nThis is functionally equivalent to calling *note write(): 2fec. on\neach element yielded by the iterable, but may be implemented more\nefficiently.\n\n-- Method: WriteTransport.writeeof ()\n\nClose the write end of the transport after flushing all buffered\ndata.  Data may still be received.\n\nThis method can raise *note NotImplementedError: ba5. if the\ntransport (e.g.  SSL) doesn't support half-closed connections.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Datagram Transports,  Next: Subprocess Transports,  Prev: Write-only Transports,  Up: Transports": {
            "content": "5.18.1.85 Datagram Transports\n.............................\n\n-- Method: DatagramTransport.sendto (data, addr=None)\n\nSend the 'data' bytes to the remote peer given by 'addr' (a\ntransport-dependent target address).  If 'addr' is *note None: 43f,\nthe data is sent to the target address given on transport creation.\n\nThis method does not block; it buffers the data and arranges for it\nto be sent out asynchronously.\n\n-- Method: DatagramTransport.abort ()\n\nClose the transport immediately, without waiting for pending\noperations to complete.  Buffered data will be lost.  No more data\nwill be received.  The protocol's *note protocol.connectionlost():\n2fdd. method will eventually be called with *note None: 43f. as its\nargument.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Subprocess Transports,  Prev: Datagram Transports,  Up: Transports": {
            "content": "5.18.1.86 Subprocess Transports\n...............................\n\n-- Method: SubprocessTransport.getpid ()\n\nReturn the subprocess process id as an integer.\n\n-- Method: SubprocessTransport.getpipetransport (fd)\n\nReturn the transport for the communication pipe corresponding to\nthe integer file descriptor 'fd':\n\n* '0': readable streaming transport of the standard input\n('stdin'), or *note None: 43f. if the subprocess was not\ncreated with 'stdin=PIPE'\n\n* '1': writable streaming transport of the standard output\n('stdout'), or *note None: 43f. if the subprocess was not\ncreated with 'stdout=PIPE'\n\n* '2': writable streaming transport of the standard error\n('stderr'), or *note None: 43f. if the subprocess was not\ncreated with 'stderr=PIPE'\n\n* other 'fd': *note None: 43f.\n\n-- Method: SubprocessTransport.getreturncode ()\n\nReturn the subprocess return code as an integer or *note None: 43f.\nif it hasn't returned, which is similar to the *note\nsubprocess.Popen.returncode: 1716. attribute.\n\n-- Method: SubprocessTransport.kill ()\n\nKill the subprocess.\n\nOn POSIX systems, the function sends SIGKILL to the subprocess.  On\nWindows, this method is an alias for *note terminate(): 2ff5.\n\nSee also *note subprocess.Popen.kill(): 1232.\n\n-- Method: SubprocessTransport.sendsignal (signal)\n\nSend the 'signal' number to the subprocess, as in *note\nsubprocess.Popen.sendsignal(): 1233.\n\n-- Method: SubprocessTransport.terminate ()\n\nStop the subprocess.\n\nOn POSIX systems, this method sends *note SIGTERM: 1234. to the\nsubprocess.  On Windows, the Windows API function\n'TerminateProcess()' is called to stop the subprocess.\n\nSee also *note subprocess.Popen.terminate(): 1231.\n\n-- Method: SubprocessTransport.close ()\n\nKill the subprocess by calling the *note kill(): 2ff4. method.\n\nIf the subprocess hasn't returned yet, and close transports of\n'stdin', 'stdout', and 'stderr' pipes.\n\nFile: python3.12.info,  Node: Protocols,  Next: Examples<18>,  Prev: Transports,  Up: Transports and Protocols\n\n5.18.1.87 Protocols\n...................\n\n'Source code:' Lib/asyncio/protocols.py(1)\n\n\n\nasyncio provides a set of abstract base classes that should be used to\nimplement network protocols.  Those classes are meant to be used\ntogether with *note transports: 2f9a.\n",
            "subsections": []
        },
        "Subclasses of abstract base protocol classes may implement some or all": {
            "content": "methods.  All these methods are callbacks: they are called by transports\non certain events, for example when some data is received.  A base\nprotocol method should be called by the corresponding transport.\n\n* Menu:\n\n* Base Protocols::\n* Base Protocol::\n* Streaming Protocols::\n* Buffered Streaming Protocols::\n* Datagram Protocols::\n* Subprocess Protocols::\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/asyncio/protocols.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Base Protocols,  Next: Base Protocol,  Up: Protocols": {
            "content": "5.18.1.88 Base Protocols\n........................\n\n-- Class: asyncio.BaseProtocol\n\nBase protocol with methods that all protocols share.\n\n-- Class: asyncio.Protocol (BaseProtocol)\n\nThe base class for implementing streaming protocols (TCP, Unix\nsockets, etc).\n\n-- Class: asyncio.BufferedProtocol (BaseProtocol)\n\nA base class for implementing streaming protocols with manual\ncontrol of the receive buffer.\n\n-- Class: asyncio.DatagramProtocol (BaseProtocol)\n\nThe base class for implementing datagram (UDP) protocols.\n\n-- Class: asyncio.SubprocessProtocol (BaseProtocol)\n\nThe base class for implementing protocols communicating with child\nprocesses (unidirectional pipes).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Base Protocol,  Next: Streaming Protocols,  Prev: Base Protocols,  Up: Protocols": {
            "content": "5.18.1.89 Base Protocol\n.......................\n\nAll asyncio protocols can implement Base Protocol callbacks.\n",
            "subsections": []
        },
        "Connection Callbacks": {
            "content": "....................\n",
            "subsections": []
        },
        "Connection callbacks are called on all protocols, exactly once per a": {
            "content": "successful connection.  All other protocol callbacks can only be called\nbetween those two methods.\n\n-- Method: BaseProtocol.connectionmade (transport)\n\nCalled when a connection is made.\n\nThe 'transport' argument is the transport representing the\nconnection.  The protocol is responsible for storing the reference\nto its transport.\n\n-- Method: BaseProtocol.connectionlost (exc)\n\nCalled when the connection is lost or closed.\n\nThe argument is either an exception object or *note None: 43f.  The\nlatter means a regular EOF is received, or the connection was\naborted or closed by this side of the connection.\n",
            "subsections": []
        },
        "Flow Control Callbacks": {
            "content": "......................\n",
            "subsections": []
        },
        "Flow control callbacks can be called by transports to pause or resume": {
            "content": "writing performed by the protocol.\n\nSee the documentation of the *note setwritebufferlimits(): 2fe9.\nmethod for more details.\n\n-- Method: BaseProtocol.pausewriting ()\n\nCalled when the transport's buffer goes over the high watermark.\n\n-- Method: BaseProtocol.resumewriting ()\n\nCalled when the transport's buffer drains below the low watermark.\n\nIf the buffer size equals the high watermark, *note pausewriting():\n2fea. is not called: the buffer size must go strictly over.\n\nConversely, *note resumewriting(): 2feb. is called when the buffer size\nis equal or lower than the low watermark.  These end conditions are\nimportant to ensure that things go as expected when either mark is zero.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Streaming Protocols,  Next: Buffered Streaming Protocols,  Prev: Base Protocol,  Up: Protocols": {
            "content": "5.18.1.90 Streaming Protocols\n.............................\n\nEvent methods, such as *note loop.createserver(): 94a, *note\nloop.createunixserver(): 94b, *note loop.createconnection(): 3cc,\n*note loop.createunixconnection(): 2f0e, *note\nloop.connectacceptedsocket(): 952, *note loop.connectreadpipe():\n2f54, and *note loop.connectwritepipe(): 2f55. accept factories that\nreturn streaming protocols.\n\n-- Method: Protocol.datareceived (data)\n\nCalled when some data is received.  'data' is a non-empty bytes\nobject containing the incoming data.\n\nWhether the data is buffered, chunked or reassembled depends on the\ntransport.  In general, you shouldn't rely on specific semantics\nand instead make your parsing generic and flexible.  However, data\nis always received in the correct order.\n\nThe method can be called an arbitrary number of times while a\nconnection is open.\n\nHowever, *note protocol.eofreceived(): 2ffb. is called at most\nonce.  Once 'eofreceived()' is called, 'datareceived()' is not\ncalled anymore.\n\n-- Method: Protocol.eofreceived ()\n\nCalled when the other end signals it won't send any more data (for\nexample by calling *note transport.writeeof(): 2fe7, if the other\nend also uses asyncio).\n\nThis method may return a false value (including 'None'), in which\ncase the transport will close itself.  Conversely, if this method\nreturns a true value, the protocol used determines whether to close\nthe transport.  Since the default implementation returns 'None', it\nimplicitly closes the connection.\n\nSome transports, including SSL, don't support half-closed\nconnections, in which case returning true from this method will\nresult in the connection being closed.\n\nState machine:\n\nstart -> connectionmade\n[-> datareceived]*\n[-> eofreceived]?\n-> connectionlost -> end\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Buffered Streaming Protocols,  Next: Datagram Protocols,  Prev: Streaming Protocols,  Up: Protocols": {
            "content": "5.18.1.91 Buffered Streaming Protocols\n......................................\n\nNew in version 3.7.\n",
            "subsections": []
        },
        "Buffered Protocols can be used with any event loop method that supports": {
            "content": "*note Streaming Protocols: 2ffa.\n\n'BufferedProtocol' implementations allow explicit manual allocation and\ncontrol of the receive buffer.  Event loops can then use the buffer\nprovided by the protocol to avoid unnecessary data copies.  This can\nresult in noticeable performance improvement for protocols that receive\nbig amounts of data.  Sophisticated protocol implementations can\nsignificantly reduce the number of buffer allocations.\n\nThe following callbacks are called on *note BufferedProtocol: 8d1.\ninstances:\n\n-- Method: BufferedProtocol.getbuffer (sizehint)\n\nCalled to allocate a new receive buffer.\n\n'sizehint' is the recommended minimum size for the returned buffer.\nIt is acceptable to return smaller or larger buffers than what\n'sizehint' suggests.  When set to -1, the buffer size can be\narbitrary.  It is an error to return a buffer with a zero size.\n\n'getbuffer()' must return an object implementing the *note buffer\nprotocol: 148.\n\n-- Method: BufferedProtocol.bufferupdated (nbytes)\n\nCalled when the buffer was updated with the received data.\n\n'nbytes' is the total number of bytes that were written to the\nbuffer.\n\n-- Method: BufferedProtocol.eofreceived ()\n\nSee the documentation of the *note protocol.eofreceived(): 2ffb.\nmethod.\n\n*note getbuffer(): 2ffd. can be called an arbitrary number of times\nduring a connection.  However, *note protocol.eofreceived(): 2ffb. is\ncalled at most once and, if called, *note getbuffer(): 2ffd. and *note\nbufferupdated(): 2ffe. won't be called after it.\n\nState machine:\n\nstart -> connectionmade\n[-> getbuffer\n[-> bufferupdated]?\n]*\n[-> eofreceived]?\n-> connectionlost -> end\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Datagram Protocols,  Next: Subprocess Protocols,  Prev: Buffered Streaming Protocols,  Up: Protocols": {
            "content": "5.18.1.92 Datagram Protocols\n............................\n",
            "subsections": []
        },
        "Datagram Protocol instances should be constructed by protocol factories": {
            "content": "passed to the *note loop.createdatagramendpoint(): 517. method.\n\n-- Method: DatagramProtocol.datagramreceived (data, addr)\n\nCalled when a datagram is received.  'data' is a bytes object\ncontaining the incoming data.  'addr' is the address of the peer\nsending the data; the exact format depends on the transport.\n\n-- Method: DatagramProtocol.errorreceived (exc)\n\nCalled when a previous send or receive operation raises an *note\nOSError: 613.  'exc' is the *note OSError: 613. instance.\n\nThis method is called in rare conditions, when the transport (e.g.\nUDP) detects that a datagram could not be delivered to its\nrecipient.  In many conditions though, undeliverable datagrams will\nbe silently dropped.\n\nNote: On BSD systems (macOS, FreeBSD, etc.)  flow control is not\nsupported for datagram protocols, because there is no reliable way\nto detect send failures caused by writing too many packets.\n\nThe socket always appears 'ready' and excess packets are dropped.\nAn *note OSError: 613. with 'errno' set to *note errno.ENOBUFS:\n1545. may or may not be raised; if it is raised, it will be\nreported to *note DatagramProtocol.errorreceived(): 3002. but\notherwise ignored.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Subprocess Protocols,  Prev: Datagram Protocols,  Up: Protocols": {
            "content": "5.18.1.93 Subprocess Protocols\n..............................\n",
            "subsections": []
        },
        "Subprocess Protocol instances should be constructed by protocol": {
            "content": "factories passed to the *note loop.subprocessexec(): 2f51. and *note\nloop.subprocessshell(): 2f52. methods.\n\n-- Method: SubprocessProtocol.pipedatareceived (fd, data)\n\nCalled when the child process writes data into its stdout or stderr\npipe.\n\n'fd' is the integer file descriptor of the pipe.\n\n'data' is a non-empty bytes object containing the received data.\n\n-- Method: SubprocessProtocol.pipeconnectionlost (fd, exc)\n\nCalled when one of the pipes communicating with the child process\nis closed.\n\n'fd' is the integer file descriptor that was closed.\n\n-- Method: SubprocessProtocol.processexited ()\n\nCalled when the child process has exited.\n\nIt can be called before *note pipedatareceived(): 151e. and *note\npipeconnectionlost(): 3004. methods.\n\nFile: python3.12.info,  Node: Examples<18>,  Prev: Protocols,  Up: Transports and Protocols\n\n5.18.1.94 Examples\n..................\n\n* Menu:\n\n* TCP Echo Server::\n* TCP Echo Client::\n* UDP Echo Server::\n* UDP Echo Client::\n* Connecting Existing Sockets::\n* loop.subprocessexec() and SubprocessProtocol: loop subprocessexec and SubprocessProtocol.\n\nFile: python3.12.info,  Node: TCP Echo Server,  Next: TCP Echo Client,  Up: Examples<18>\n\n5.18.1.95 TCP Echo Server\n.........................\n\nCreate a TCP echo server using the *note loop.createserver(): 94a.\nmethod, send back received data, and close the connection:\n\nimport asyncio\n\n\nclass EchoServerProtocol(asyncio.Protocol):\ndef connectionmade(self, transport):\npeername = transport.getextrainfo('peername')\nprint('Connection from {}'.format(peername))\nself.transport = transport\n\ndef datareceived(self, data):\nmessage = data.decode()\nprint('Data received: {!r}'.format(message))\n\nprint('Send: {!r}'.format(message))\nself.transport.write(data)\n\nprint('Close the client socket')\nself.transport.close()\n\n\nasync def main():\n# Get a reference to the event loop as we plan to use\n# low-level APIs.\nloop = asyncio.getrunningloop()\n\nserver = await loop.createserver(\nlambda: EchoServerProtocol(),\n'127.0.0.1', 8888)\n\nasync with server:\nawait server.serveforever()\n\n\nasyncio.run(main())\n\nSee also\n........\n\nThe *note TCP echo server using streams: 2f21. example uses the\nhigh-level *note asyncio.startserver(): 951. function.\n\nFile: python3.12.info,  Node: TCP Echo Client,  Next: UDP Echo Server,  Prev: TCP Echo Server,  Up: Examples<18>\n\n5.18.1.96 TCP Echo Client\n.........................\n\nA TCP echo client using the *note loop.createconnection(): 3cc. method,\nsends data, and waits until the connection is closed:\n\nimport asyncio\n\n\nclass EchoClientProtocol(asyncio.Protocol):\ndef init(self, message, onconlost):\nself.message = message\nself.onconlost = onconlost\n\ndef connectionmade(self, transport):\ntransport.write(self.message.encode())\nprint('Data sent: {!r}'.format(self.message))\n\ndef datareceived(self, data):\nprint('Data received: {!r}'.format(data.decode()))\n\ndef connectionlost(self, exc):\nprint('The server closed the connection')\nself.onconlost.setresult(True)\n\n\nasync def main():\n# Get a reference to the event loop as we plan to use\n# low-level APIs.\nloop = asyncio.getrunningloop()\n\nonconlost = loop.createfuture()\nmessage = 'Hello World!'\n\ntransport, protocol = await loop.createconnection(\nlambda: EchoClientProtocol(message, onconlost),\n'127.0.0.1', 8888)\n\n# Wait until the protocol signals that the connection\n# is lost and close the transport.\ntry:\nawait onconlost\nfinally:\ntransport.close()\n\n\nasyncio.run(main())\n\nSee also\n........\n\nThe *note TCP echo client using streams: 2f1e. example uses the\nhigh-level *note asyncio.openconnection(): 950. function.\n\nFile: python3.12.info,  Node: UDP Echo Server,  Next: UDP Echo Client,  Prev: TCP Echo Client,  Up: Examples<18>\n\n5.18.1.97 UDP Echo Server\n.........................\n\nA UDP echo server, using the *note loop.createdatagramendpoint(): 517.\nmethod, sends back received data:\n\nimport asyncio\n\n\nclass EchoServerProtocol:\ndef connectionmade(self, transport):\nself.transport = transport\n\ndef datagramreceived(self, data, addr):\nmessage = data.decode()\nprint('Received %r from %s' % (message, addr))\nprint('Send %r to %s' % (message, addr))\nself.transport.sendto(data, addr)\n\n\nasync def main():\nprint(\"Starting UDP server\")\n\n# Get a reference to the event loop as we plan to use\n# low-level APIs.\nloop = asyncio.getrunningloop()\n\n# One protocol instance will be created to serve all\n# client requests.\ntransport, protocol = await loop.createdatagramendpoint(\nlambda: EchoServerProtocol(),\nlocaladdr=('127.0.0.1', 9999))\n\ntry:\nawait asyncio.sleep(3600)  # Serve for 1 hour.\nfinally:\ntransport.close()\n\n\nasyncio.run(main())\n\nFile: python3.12.info,  Node: UDP Echo Client,  Next: Connecting Existing Sockets,  Prev: UDP Echo Server,  Up: Examples<18>\n\n5.18.1.98 UDP Echo Client\n.........................\n\nA UDP echo client, using the *note loop.createdatagramendpoint(): 517.\nmethod, sends data and closes the transport when it receives the answer:\n\nimport asyncio\n\n\nclass EchoClientProtocol:\ndef init(self, message, onconlost):\nself.message = message\nself.onconlost = onconlost\nself.transport = None\n\ndef connectionmade(self, transport):\nself.transport = transport\nprint('Send:', self.message)\nself.transport.sendto(self.message.encode())\n\ndef datagramreceived(self, data, addr):\nprint(\"Received:\", data.decode())\n\nprint(\"Close the socket\")\nself.transport.close()\n\ndef errorreceived(self, exc):\nprint('Error received:', exc)\n\ndef connectionlost(self, exc):\nprint(\"Connection closed\")\nself.onconlost.setresult(True)\n\n\nasync def main():\n# Get a reference to the event loop as we plan to use\n# low-level APIs.\nloop = asyncio.getrunningloop()\n\nonconlost = loop.createfuture()\nmessage = \"Hello World!\"\n\ntransport, protocol = await loop.createdatagramendpoint(\nlambda: EchoClientProtocol(message, onconlost),\nremoteaddr=('127.0.0.1', 9999))\n\ntry:\nawait onconlost\nfinally:\ntransport.close()\n\n\nasyncio.run(main())\n\nFile: python3.12.info,  Node: Connecting Existing Sockets,  Next: loop subprocessexec and SubprocessProtocol,  Prev: UDP Echo Client,  Up: Examples<18>\n\n5.18.1.99 Connecting Existing Sockets\n.....................................\n\nWait until a socket receives data using the *note\nloop.createconnection(): 3cc. method with a protocol:\n\nimport asyncio\nimport socket\n\n\nclass MyProtocol(asyncio.Protocol):\n\ndef init(self, onconlost):\nself.transport = None\nself.onconlost = onconlost\n\ndef connectionmade(self, transport):\nself.transport = transport\n\ndef datareceived(self, data):\nprint(\"Received:\", data.decode())\n\n# We are done: close the transport;\n# connectionlost() will be called automatically.\nself.transport.close()\n\ndef connectionlost(self, exc):\n# The socket has been closed\nself.onconlost.setresult(True)\n\n\nasync def main():\n# Get a reference to the event loop as we plan to use\n# low-level APIs.\nloop = asyncio.getrunningloop()\nonconlost = loop.createfuture()\n\n# Create a pair of connected sockets\nrsock, wsock = socket.socketpair()\n\n# Register the socket to wait for data.\ntransport, protocol = await loop.createconnection(\nlambda: MyProtocol(onconlost), sock=rsock)\n\n# Simulate the reception of data from the network.\nloop.callsoon(wsock.send, 'abc'.encode())\n\ntry:\nawait protocol.onconlost\nfinally:\ntransport.close()\nwsock.close()\n\nasyncio.run(main())\n\nSee also\n........\n\nThe *note watch a file descriptor for read events: 2f28. example uses\nthe low-level *note loop.addreader(): 2f29. method to register an FD.\n\nThe *note register an open socket to wait for data using streams: 2f25.\nexample uses high-level streams created by the *note openconnection():\n950. function in a coroutine.\n\nFile: python3.12.info,  Node: loop subprocessexec and SubprocessProtocol,  Prev: Connecting Existing Sockets,  Up: Examples<18>\n\n5.18.1.100 loop.subprocessexec() and SubprocessProtocol\n........................................................\n",
            "subsections": []
        },
        "An example of a subprocess protocol used to get the output of a": {
            "content": "subprocess and to wait for the subprocess exit.\n\nThe subprocess is created by the *note loop.subprocessexec(): 2f51.\nmethod:\n\nimport asyncio\nimport sys\n\nclass DateProtocol(asyncio.SubprocessProtocol):\ndef init(self, exitfuture):\nself.exitfuture = exitfuture\nself.output = bytearray()\nself.pipeclosed = False\nself.exited = False\n\ndef pipeconnectionlost(self, fd, exc):\nself.pipeclosed = True\nself.checkforexit()\n\ndef pipedatareceived(self, fd, data):\nself.output.extend(data)\n\ndef processexited(self):\nself.exited = True\n# processexited() method can be called before\n# pipeconnectionlost() method: wait until both methods are\n# called.\nself.checkforexit()\n\ndef checkforexit(self):\nif self.pipeclosed and self.exited:\nself.exitfuture.setresult(True)\n\nasync def getdate():\n# Get a reference to the event loop as we plan to use\n# low-level APIs.\nloop = asyncio.getrunningloop()\n\ncode = 'import datetime; print(datetime.datetime.now())'\nexitfuture = asyncio.Future(loop=loop)\n\n# Create the subprocess controlled by DateProtocol;\n# redirect the standard output into a pipe.\ntransport, protocol = await loop.subprocessexec(\nlambda: DateProtocol(exitfuture),\nsys.executable, '-c', code,\nstdin=None, stderr=None)\n\n# Wait for the subprocess exit using the processexited()\n# method of the protocol.\nawait exitfuture\n\n# Close the stdout pipe.\ntransport.close()\n\n# Read the output which was collected by the\n# pipedatareceived() method of the protocol.\ndata = bytes(protocol.output)\nreturn data.decode('ascii').rstrip()\n\ndate = asyncio.run(getdate())\nprint(f\"Current date: {date}\")\n\nSee also the *note same example: 2f69. written using high-level APIs.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Policies,  Next: Platform Support,  Prev: Transports and Protocols,  Up: asyncio -- Asynchronous I/O": {
            "content": "5.18.1.101 Policies\n...................\n",
            "subsections": []
        },
        "An event loop policy is a global object used to get and set the current": {
            "content": "*note event loop: bd3, as well as create new event loops.  The default\npolicy can be *note replaced: 300d. with *note built-in alternatives:\n300e. to use different event loop implementations, or substituted by a\n*note custom policy: 300f. that can override these behaviors.\n\nThe *note policy object: 3010. gets and sets a separate event loop per\n'context'.  This is per-thread by default, though custom policies could\ndefine 'context' differently.\n\nCustom event loop policies can control the behavior of *note\ngeteventloop(): 21e, *note seteventloop(): 1524, and *note\nneweventloop(): 2ed7.\n\nPolicy objects should implement the APIs defined in the *note\nAbstractEventLoopPolicy: 3011. abstract base class.\n\n* Menu:\n\n* Getting and Setting the Policy::\n* Policy Objects::\n* Process Watchers::\n* Custom Policies::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Getting and Setting the Policy,  Next: Policy Objects,  Up: Policies": {
            "content": "5.18.1.102 Getting and Setting the Policy\n.........................................\n",
            "subsections": []
        },
        "The following functions can be used to get and set the policy for the": {
            "content": "current process:\n\n-- Function: asyncio.geteventlooppolicy ()\n\nReturn the current process-wide policy.\n\n-- Function: asyncio.seteventlooppolicy (policy)\n\nSet the current process-wide policy to 'policy'.\n\nIf 'policy' is set to 'None', the default policy is restored.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Policy Objects,  Next: Process Watchers,  Prev: Getting and Setting the Policy,  Up: Policies": {
            "content": "5.18.1.103 Policy Objects\n.........................\n\nThe abstract event loop policy base class is defined as follows:\n\n-- Class: asyncio.AbstractEventLoopPolicy\n\nAn abstract base class for asyncio policies.\n\n-- Method: geteventloop ()\n\nGet the event loop for the current context.\n\nReturn an event loop object implementing the *note\nAbstractEventLoop: 780. interface.\n\nThis method should never return 'None'.\n\nChanged in version 3.6.\n\n-- Method: seteventloop (loop)\n\nSet the event loop for the current context to 'loop'.\n\n-- Method: neweventloop ()\n\nCreate and return a new event loop object.\n\nThis method should never return 'None'.\n\n-- Method: getchildwatcher ()\n\nGet a child process watcher object.\n\nReturn a watcher object implementing the *note\nAbstractChildWatcher: 218. interface.\n\nThis function is Unix specific.\n\nDeprecated since version 3.12.\n\n-- Method: setchildwatcher (watcher)\n\nSet the current child process watcher to 'watcher'.\n\nThis function is Unix specific.\n\nDeprecated since version 3.12.\n\nasyncio ships with the following built-in policies:\n\n-- Class: asyncio.DefaultEventLoopPolicy\n\nThe default asyncio policy.  Uses *note SelectorEventLoop: 3d1. on\nUnix and *note ProactorEventLoop: 3d2. on Windows.\n\nThere is no need to install the default policy manually.  asyncio\nis configured to use the default policy automatically.\n\nChanged in version 3.8: On Windows, *note ProactorEventLoop: 3d2.\nis now used by default.\n\nDeprecated since version 3.12: The *note geteventloop(): 21e.\nmethod of the default asyncio policy now emits a *note\nDeprecationWarning: 179. if there is no current event loop set and\nit decides to create one.  In some future Python release this will\nbecome an error.\n\n-- Class: asyncio.WindowsSelectorEventLoopPolicy\n\nAn alternative event loop policy that uses the *note\nSelectorEventLoop: 3d1. event loop implementation.\n\n*note Availability: 1ad3.: Windows.\n\n-- Class: asyncio.WindowsProactorEventLoopPolicy\n\nAn alternative event loop policy that uses the *note\nProactorEventLoop: 3d2. event loop implementation.\n\n*note Availability: 1ad3.: Windows.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Process Watchers,  Next: Custom Policies,  Prev: Policy Objects,  Up: Policies": {
            "content": "5.18.1.104 Process Watchers\n...........................\n\nA process watcher allows customization of how an event loop monitors\nchild processes on Unix.  Specifically, the event loop needs to know\nwhen a child process has exited.\n\nIn asyncio, child processes are created with *note\ncreatesubprocessexec(): 8a5. and *note loop.subprocessexec(): 2f51.\nfunctions.\n\nasyncio defines the *note AbstractChildWatcher: 218. abstract base\nclass, which child watchers should implement, and has four different\nimplementations: *note ThreadedChildWatcher: 196. (configured to be used\nby default), *note MultiLoopChildWatcher: 216, *note SafeChildWatcher:\n219, and *note FastChildWatcher: 217.\n\nSee also the *note Subprocess and Threads: 2f61. section.\n",
            "subsections": []
        },
        "The following two functions can be used to customize the child process": {
            "content": "watcher implementation used by the asyncio event loop:\n\n-- Function: asyncio.getchildwatcher ()\n\nReturn the current child watcher for the current policy.\n\nDeprecated since version 3.12.\n\n-- Function: asyncio.setchildwatcher (watcher)\n\nSet the current child watcher to 'watcher' for the current policy.\n'watcher' must implement methods defined in the *note\nAbstractChildWatcher: 218. base class.\n\nDeprecated since version 3.12.\n\nNote: Third-party event loops implementations might not support\ncustom child watchers.  For such event loops, using *note\nsetchildwatcher(): 21a. might be prohibited or have no effect.\n\n-- Class: asyncio.AbstractChildWatcher\n\n-- Method: addchildhandler (pid, callback, *args)\n\nRegister a new child handler.\n\nArrange for 'callback(pid, returncode, *args)' to be called\nwhen a process with PID equal to 'pid' terminates.  Specifying\nanother callback for the same process replaces the previous\nhandler.\n\nThe 'callback' callable must be thread-safe.\n\n-- Method: removechildhandler (pid)\n\nRemoves the handler for process with PID equal to 'pid'.\n\nThe function returns 'True' if the handler was successfully\nremoved, 'False' if there was nothing to remove.\n\n-- Method: attachloop (loop)\n\nAttach the watcher to an event loop.\n\nIf the watcher was previously attached to an event loop, then\nit is first detached before attaching to the new loop.\n\nNote: loop may be 'None'.\n\n-- Method: isactive ()\n\nReturn 'True' if the watcher is ready to use.\n\nSpawning a subprocess with 'inactive' current child watcher\nraises *note RuntimeError: 17a.\n\nNew in version 3.8.\n\n-- Method: close ()\n\nClose the watcher.\n\nThis method has to be called to ensure that underlying\nresources are cleaned-up.\n\nDeprecated since version 3.12.\n\n-- Class: asyncio.ThreadedChildWatcher\n\nThis implementation starts a new waiting thread for every\nsubprocess spawn.\n\nIt works reliably even when the asyncio event loop is run in a\nnon-main OS thread.\n\nThere is no noticeable overhead when handling a big number of\nchildren ('O'(1) each time a child terminates), but starting a\nthread per process requires extra memory.\n\nThis watcher is used by default.\n\nNew in version 3.8.\n\n-- Class: asyncio.MultiLoopChildWatcher\n\nThis implementation registers a 'SIGCHLD' signal handler on\ninstantiation.  That can break third-party code that installs a\ncustom handler for 'SIGCHLD' signal.\n\nThe watcher avoids disrupting other code spawning processes by\npolling every process explicitly on a 'SIGCHLD' signal.\n\nThere is no limitation for running subprocesses from different\nthreads once the watcher is installed.\n\nThe solution is safe but it has a significant overhead when\nhandling a big number of processes ('O'('n') each time a 'SIGCHLD'\nis received).\n\nNew in version 3.8.\n\nDeprecated since version 3.12.\n\n-- Class: asyncio.SafeChildWatcher\n\nThis implementation uses active event loop from the main thread to\nhandle 'SIGCHLD' signal.  If the main thread has no running event\nloop another thread cannot spawn a subprocess (*note RuntimeError:\n17a. is raised).\n\nThe watcher avoids disrupting other code spawning processes by\npolling every process explicitly on a 'SIGCHLD' signal.\n\nThis solution is as safe as *note MultiLoopChildWatcher: 216. and\nhas the same 'O'('n') complexity but requires a running event loop\nin the main thread to work.\n\nDeprecated since version 3.12.\n\n-- Class: asyncio.FastChildWatcher\n\nThis implementation reaps every terminated processes by calling\n'os.waitpid(-1)' directly, possibly breaking other code spawning\nprocesses and waiting for their termination.\n\nThere is no noticeable overhead when handling a big number of\nchildren ('O'(1) each time a child terminates).\n\nThis solution requires a running event loop in the main thread to\nwork, as *note SafeChildWatcher: 219.\n\nDeprecated since version 3.12.\n\n-- Class: asyncio.PidfdChildWatcher\n\nThis implementation polls process file descriptors (pidfds) to\nawait child process termination.  In some respects, *note\nPidfdChildWatcher: 194. is a \"Goldilocks\" child watcher\nimplementation.  It doesn't require signals or threads, doesn't\ninterfere with any processes launched outside the event loop, and\nscales linearly with the number of subprocesses launched by the\nevent loop.  The main disadvantage is that pidfds are specific to\nLinux, and only work on recent (5.3+) kernels.\n\nNew in version 3.9.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Custom Policies,  Prev: Process Watchers,  Up: Policies": {
            "content": "5.18.1.105 Custom Policies\n..........................\n",
            "subsections": []
        },
        "To implement a new event loop policy, it is recommended to subclass": {
            "content": "*note DefaultEventLoopPolicy: 3019. and override the methods for which\ncustom behavior is wanted, e.g.:\n\nclass MyEventLoopPolicy(asyncio.DefaultEventLoopPolicy):\n\ndef geteventloop(self):\n\"\"\"Get the event loop.\n\nThis may be None or an instance of EventLoop.\n\"\"\"\nloop = super().geteventloop()\n# Do something with loop ...\nreturn loop\n\nasyncio.seteventlooppolicy(MyEventLoopPolicy())\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Platform Support,  Next: Extending,  Prev: Policies,  Up: asyncio -- Asynchronous I/O": {
            "content": "5.18.1.106 Platform Support\n...........................\n\nThe *note asyncio: 9. module is designed to be portable, but some\nplatforms have subtle differences and limitations due to the platforms'\nunderlying architecture and capabilities.\n\n* Menu:\n\n* All Platforms::\n* Windows: Windows<71>.\n* macOS: macOS<44>.\n\nFile: python3.12.info,  Node: All Platforms,  Next: Windows<71>,  Up: Platform Support\n\n5.18.1.107 All Platforms\n........................\n\n* *note loop.addreader(): 2f29. and *note loop.addwriter(): 2fa8.\ncannot be used to monitor file I/O.\n\nFile: python3.12.info,  Node: Windows<71>,  Next: macOS<44>,  Prev: All Platforms,  Up: Platform Support\n\n5.18.1.108 Windows\n..................\n\n'Source code:' Lib/asyncio/proactorevents.py(1),",
            "subsections": []
        },
        "Lib/asyncio/windowsevents.py(2), Lib/asyncio/windowsutils.py(3)": {
            "content": "Changed in version 3.8: On Windows, *note ProactorEventLoop: 3d2. is now\nthe default event loop.\n\nAll event loops on Windows do not support the following methods:\n\n* *note loop.createunixconnection(): 2f0e. and *note\nloop.createunixserver(): 94b. are not supported.  The *note\nsocket.AFUNIX: 1580. socket family is specific to Unix.\n\n* *note loop.addsignalhandler(): 2fb1. and *note\nloop.removesignalhandler(): 2fb2. are not supported.\n\n*note SelectorEventLoop: 3d1. has the following limitations:\n\n* *note SelectSelector: 3026. is used to wait on socket events: it\nsupports sockets and is limited to 512 sockets.\n\n* *note loop.addreader(): 2f29. and *note loop.addwriter(): 2fa8.\nonly accept socket handles (e.g.  pipe file descriptors are not\nsupported).\n\n* Pipes are not supported, so the *note loop.connectreadpipe():\n2f54. and *note loop.connectwritepipe(): 2f55. methods are not\nimplemented.\n\n* *note Subprocesses: 2ecb. are not supported, i.e.  *note\nloop.subprocessexec(): 2f51. and *note loop.subprocessshell():\n2f52. methods are not implemented.\n\n*note ProactorEventLoop: 3d2. has the following limitations:\n\n* The *note loop.addreader(): 2f29. and *note loop.addwriter():\n2fa8. methods are not supported.\n",
            "subsections": []
        },
        "The resolution of the monotonic clock on Windows is usually around 15.6": {
            "content": "milliseconds.  The best resolution is 0.5 milliseconds.  The resolution\ndepends on the hardware (availability of HPET(4)) and on the Windows\nconfiguration.\n\n* Menu:\n\n* Subprocess Support on Windows::\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/asyncio/proactorevents.py\n\n(2)\nhttps://github.com/python/cpython/tree/3.12/Lib/asyncio/windowsevents.py\n\n(3)\nhttps://github.com/python/cpython/tree/3.12/Lib/asyncio/windowsutils.py\n\n(4) https://en.wikipedia.org/wiki/HighPrecisionEventTimer\n\nFile: python3.12.info,  Node: Subprocess Support on Windows,  Up: Windows<71>\n\n5.18.1.109 Subprocess Support on Windows\n........................................\n\nOn Windows, the default event loop *note ProactorEventLoop: 3d2.\nsupports subprocesses, whereas *note SelectorEventLoop: 3d1. does not.\n\nThe *note policy.setchildwatcher(): 21c. function is also not\nsupported, as *note ProactorEventLoop: 3d2. has a different mechanism to\nwatch child processes.\n\nFile: python3.12.info,  Node: macOS<44>,  Prev: Windows<71>,  Up: Platform Support\n\n5.18.1.110 macOS\n................\n\nModern macOS versions are fully supported.\n\nmacOS <= 10.8\n.............\n\nOn macOS 10.6, 10.7 and 10.8, the default event loop uses *note\nselectors.KqueueSelector: 3029, which does not support character devices\non these versions.  The *note SelectorEventLoop: 3d1. can be manually\nconfigured to use *note SelectSelector: 3026. or *note PollSelector:\na1a. to support character devices on these older versions of macOS.\nExample:\n\nimport asyncio\nimport selectors\n\nselector = selectors.SelectSelector()\nloop = asyncio.SelectorEventLoop(selector)\nasyncio.seteventloop(loop)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Extending,  Next: High-level API Index,  Prev: Platform Support,  Up: asyncio -- Asynchronous I/O": {
            "content": "5.18.1.111 Extending\n....................\n\nThe main direction for *note asyncio: 9. extending is writing custom\n'event loop' classes.  Asyncio has helpers that could be used to\nsimplify this task.\n\nNote: Third-parties should reuse existing asyncio code with\ncaution, a new Python version is free to break backward\ncompatibility in 'internal' part of API.\n\n* Menu:\n\n* Writing a Custom Event Loop::\n* Future and Task private constructors::\n* Task lifetime support::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Writing a Custom Event Loop,  Next: Future and Task private constructors,  Up: Extending": {
            "content": "5.18.1.112 Writing a Custom Event Loop\n......................................\n\n*note asyncio.AbstractEventLoop: 780. declares very many methods.\nImplementing all them from scratch is a tedious job.\n\nA loop can get many common methods implementation for free by inheriting\nfrom 'asyncio.BaseEventLoop'.\n",
            "subsections": []
        },
        "In turn, the successor should implement a bunch of 'private' methods": {
            "content": "declared but not implemented in 'asyncio.BaseEventLoop'.\n",
            "subsections": []
        },
        "For example, 'loop.createconnection()' checks arguments, resolves DNS": {
            "content": "addresses, and calls 'loop.makesockettransport()' that should be\nimplemented by inherited class.  The 'makesockettransport()' method\nis not documented and is considered as an 'internal' API.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Future and Task private constructors,  Next: Task lifetime support,  Prev: Writing a Custom Event Loop,  Up: Extending": {
            "content": "5.18.1.113 Future and Task private constructors\n...............................................\n\n*note asyncio.Future: a11. and *note asyncio.Task: 201. should be never\ncreated directly, please use corresponding *note loop.createfuture():\nac5. and *note loop.createtask(): 802, or *note asyncio.createtask():\n3c5. factories instead.\n",
            "subsections": []
        },
        "However, third-party 'event loops' may 'reuse' built-in future and task": {
            "content": "implementations for the sake of getting a complex and highly optimized\ncode for free.\n\nFor this purpose the following, 'private' constructors are listed:\n\n-- Method: Future.init (*, loop=None)\n\nCreate a built-in future instance.\n\n'loop' is an optional event loop instance.\n\n-- Method: Task.init (coro, *, loop=None, name=None, context=None)\n\nCreate a built-in task instance.\n\n'loop' is an optional event loop instance.  The rest of arguments\nare described in *note loop.createtask(): 802. description.\n\nChanged in version 3.11: 'context' argument is added.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Task lifetime support,  Prev: Future and Task private constructors,  Up: Extending": {
            "content": "5.18.1.114 Task lifetime support\n................................\n\nA third party task implementation should call the following functions to\nkeep a task visible by *note asyncio.alltasks(): 777. and *note\nasyncio.currenttask(): 198.:\n\n-- Function: asyncio.registertask (task)\n\nRegister a new 'task' as managed by 'asyncio'.\n\nCall the function from a task constructor.\n\n-- Function: asyncio.unregistertask (task)\n\nUnregister a 'task' from 'asyncio' internal structures.\n\nThe function should be called when a task is about to finish.\n\n-- Function: asyncio.entertask (loop, task)\n\nSwitch the current task to the 'task' argument.\n\nCall the function just before executing a portion of embedded\n'coroutine' (*note coroutine.send(): 1cd2. or *note\ncoroutine.throw(): 240.).\n\n-- Function: asyncio.leavetask (loop, task)\n\nSwitch the current task back from 'task' to 'None'.\n\nCall the function just after *note coroutine.send(): 1cd2. or *note\ncoroutine.throw(): 240. execution.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: High-level API Index,  Next: Low-level API Index,  Prev: Extending,  Up: asyncio -- Asynchronous I/O": {
            "content": "5.18.1.115 High-level API Index\n...............................\n\nThis page lists all high-level async/await enabled asyncio APIs.\n\n* Menu:\n\n* Tasks::\n* Queues: Queues<2>.\n* Subprocesses: Subprocesses<2>.\n* Streams: Streams<2>.\n* Synchronization::\n* Exceptions: Exceptions<12>.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Low-level API Index,  Next: Developing with asyncio,  Prev: High-level API Index,  Up: asyncio -- Asynchronous I/O": {
            "content": "5.18.1.122 Low-level API Index\n..............................\n\nThis page lists all low-level asyncio APIs.\n\n* Menu:\n\n* Obtaining the Event Loop::\n* Event Loop Methods: Event Loop Methods<2>.\n* Transports: Transports<2>.\n* Protocols: Protocols<2>.\n* Event Loop Policies::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Developing with asyncio,  Prev: Low-level API Index,  Up: asyncio -- Asynchronous I/O": {
            "content": "5.18.1.128 Developing with asyncio\n..................................\n\nAsynchronous programming is different from classic \"sequential\"\nprogramming.\n",
            "subsections": []
        },
        "This page lists common mistakes and traps and explains how to avoid": {
            "content": "them.\n\n* Menu:\n\n* Debug Mode::\n* Concurrency and Multithreading::\n* Running Blocking Code::\n* Logging: Logging<3>.\n* Detect never-awaited coroutines::\n* Detect never-retrieved exceptions::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Debug Mode,  Next: Concurrency and Multithreading,  Up: Developing with asyncio": {
            "content": "5.18.1.129 Debug Mode\n.....................\n",
            "subsections": []
        },
        "By default asyncio runs in production mode.  In order to ease the": {
            "content": "development asyncio has a 'debug mode'.\n\nThere are several ways to enable asyncio debug mode:\n\n* Setting the *note PYTHONASYNCIODEBUG: 1ace. environment variable to\n'1'.\n\n* Using the *note Python Development Mode: 6e3.\n\n* Passing 'debug=True' to *note asyncio.run(): 197.\n\n* Calling *note loop.setdebug(): c1e.\n\nIn addition to enabling the debug mode, consider also:\n\n* setting the log level of the *note asyncio logger: 3047. to *note\nlogging.DEBUG: 1a76, for example the following snippet of code can\nbe run at startup of the application:\n\nlogging.basicConfig(level=logging.DEBUG)\n\n* configuring the *note warnings: 10d. module to display *note\nResourceWarning: a86. warnings.  One way of doing that is by using\nthe *note -W: 6df. 'default' command line option.\n\nWhen the debug mode is enabled:\n\n* asyncio checks for *note coroutines that were not awaited: 3048.\nand logs them; this mitigates the \"forgotten await\" pitfall.\n\n* Many non-threadsafe asyncio APIs (such as *note loop.callsoon():\n93b. and *note loop.callat(): 93e. methods) raise an exception if\nthey are called from a wrong thread.\n\n* The execution time of the I/O selector is logged if it takes too\nlong to perform an I/O operation.\n\n* Callbacks taking longer than 100 milliseconds are logged.  The\n*note loop.slowcallbackduration: 2fb9. attribute can be used to\nset the minimum execution duration in seconds that is considered\n\"slow\".\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Concurrency and Multithreading,  Next: Running Blocking Code,  Prev: Debug Mode,  Up: Developing with asyncio": {
            "content": "5.18.1.130 Concurrency and Multithreading\n.........................................\n",
            "subsections": []
        },
        "An event loop runs in a thread (typically the main thread) and executes": {
            "content": "all callbacks and Tasks in its thread.  While a Task is running in the\nevent loop, no other Tasks can run in the same thread.  When a Task\nexecutes an 'await' expression, the running Task gets suspended, and the\nevent loop executes the next Task.\n\nTo schedule a *note callback: 2609. from another OS thread, the *note\nloop.callsoonthreadsafe(): 93c. method should be used.  Example:\n\nloop.callsoonthreadsafe(callback, *args)\n",
            "subsections": []
        },
        "Almost all asyncio objects are not thread safe, which is typically not a": {
            "content": "problem unless there is code that works with them from outside of a Task\nor a callback.  If there's a need for such code to call a low-level\nasyncio API, the *note loop.callsoonthreadsafe(): 93c. method should\nbe used, e.g.:\n\nloop.callsoonthreadsafe(fut.cancel)\n\nTo schedule a coroutine object from a different OS thread, the *note\nruncoroutinethreadsafe(): 68e. function should be used.  It returns a\n*note concurrent.futures.Future: 1025. to access the result:\n\nasync def corofunc():\nreturn await asyncio.sleep(1, 42)\n\n# Later in another OS thread:\n\nfuture = asyncio.runcoroutinethreadsafe(corofunc(), loop)\n# Wait for the result:\nresult = future.result()\n\nTo handle signals the event loop must be run in the main thread.\n\nThe *note loop.runinexecutor(): 702. method can be used with a *note\nconcurrent.futures.ThreadPoolExecutor: 529. to execute blocking code in\na different OS thread without blocking the OS thread that the event loop\nruns in.\n",
            "subsections": []
        },
        "There is currently no way to schedule coroutines or callbacks directly": {
            "content": "from a different process (such as one started with *note\nmultiprocessing: 8f.).  The *note Event Loop Methods: 2f8d. section\nlists APIs that can read from pipes and watch file descriptors without\nblocking the event loop.  In addition, asyncio's *note Subprocess: 2ecb.\nAPIs provide a way to start a process and communicate with it from the\nevent loop.  Lastly, the aforementioned *note loop.runinexecutor():\n702. method can also be used with a *note\nconcurrent.futures.ProcessPoolExecutor: 707. to execute code in a\ndifferent process.\n\nFile: python3.12.info,  Node: Running Blocking Code,  Next: Logging<3>,  Prev: Concurrency and Multithreading,  Up: Developing with asyncio\n\n5.18.1.131 Running Blocking Code\n................................\n",
            "subsections": []
        },
        "Blocking (CPU-bound) code should not be called directly.  For example,": {
            "content": "if a function performs a CPU-intensive calculation for 1 second, all\nconcurrent asyncio Tasks and IO operations would be delayed by 1 second.\n",
            "subsections": []
        },
        "An executor can be used to run a task in a different thread or even in a": {
            "content": "different process to avoid blocking the OS thread with the event loop.\nSee the *note loop.runinexecutor(): 702. method for more details.\n\nFile: python3.12.info,  Node: Logging<3>,  Next: Detect never-awaited coroutines,  Prev: Running Blocking Code,  Up: Developing with asyncio\n\n5.18.1.132 Logging\n..................\n\nasyncio uses the *note logging: 82. module and all logging is performed\nvia the '\"asyncio\"' logger.\n\nThe default log level is *note logging.INFO: 1a77, which can be easily\nadjusted:\n\nlogging.getLogger(\"asyncio\").setLevel(logging.WARNING)\n",
            "subsections": []
        },
        "Network logging can block the event loop.  It is recommended to use a": {
            "content": "separate thread for handling logs or use non-blocking IO. For example,\nsee *note Dealing with handlers that block: 304d.\n\nFile: python3.12.info,  Node: Detect never-awaited coroutines,  Next: Detect never-retrieved exceptions,  Prev: Logging<3>,  Up: Developing with asyncio\n\n5.18.1.133 Detect never-awaited coroutines\n..........................................\n",
            "subsections": []
        },
        "When a coroutine function is called, but not awaited (e.g.  'coro()'": {
            "content": "instead of 'await coro()') or the coroutine is not scheduled with *note\nasyncio.createtask(): 3c5, asyncio will emit a *note RuntimeWarning:\n8c9.:\n\nimport asyncio\n\nasync def test():\nprint(\"never scheduled\")\n\nasync def main():\ntest()\n\nasyncio.run(main())\n\nOutput:\n\ntest.py:7: RuntimeWarning: coroutine 'test' was never awaited\ntest()\n\nOutput in debug mode:\n\ntest.py:7: RuntimeWarning: coroutine 'test' was never awaited\nCoroutine created at (most recent call last)\nFile \"../t.py\", line 9, in <module>\nasyncio.run(main(), debug=True)\n\n< .. >\n\nFile \"../t.py\", line 7, in main\ntest()\ntest()\n\nThe usual fix is to either await the coroutine or call the *note\nasyncio.createtask(): 3c5. function:\n\nasync def main():\nawait test()\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Detect never-retrieved exceptions,  Prev: Detect never-awaited coroutines,  Up: Developing with asyncio": {
            "content": "5.18.1.134 Detect never-retrieved exceptions\n............................................\n\nIf a *note Future.setexception(): 2efd. is called but the Future object\nis never awaited on, the exception would never be propagated to the user\ncode.  In this case, asyncio would emit a log message when the Future\nobject is garbage collected.\n\nExample of an unhandled exception:\n\nimport asyncio\n\nasync def bug():\nraise Exception(\"not consumed\")\n\nasync def main():\nasyncio.createtask(bug())\n\nasyncio.run(main())\n\nOutput:\n\nTask exception was never retrieved\nfuture: <Task finished coro=<bug() done, defined at test.py:3>\nexception=Exception('not consumed')>\n\nTraceback (most recent call last):\nFile \"test.py\", line 4, in bug\nraise Exception(\"not consumed\")\nException: not consumed\n\n*note Enable the debug mode: 1acf. to get the traceback where the task\nwas created:\n\nasyncio.run(main(), debug=True)\n\nOutput in debug mode:\n\nTask exception was never retrieved\nfuture: <Task finished coro=<bug() done, defined at test.py:3>\nexception=Exception('not consumed') created at asyncio/tasks.py:321>\n\nsourcetraceback: Object created at (most recent call last):\nFile \"../t.py\", line 9, in <module>\nasyncio.run(main(), debug=True)\n\n< .. >\n\nTraceback (most recent call last):\nFile \"../t.py\", line 4, in bug\nraise Exception(\"not consumed\")\nException: not consumed\n\nNote: The source code for asyncio can be found in Lib/asyncio/(1).\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/asyncio/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: socket -- Low-level networking interface,  Next: ssl -- TLS/SSL wrapper for socket objects,  Prev: asyncio -- Asynchronous I/O,  Up: Networking and Interprocess Communication": {
            "content": "'Source code:' Lib/socket.py(1)\n\n\n",
            "subsections": []
        },
        "This module provides access to the BSD 'socket' interface.  It is": {
            "content": "available on all modern Unix systems, Windows, MacOS, and probably\nadditional platforms.\n\nNote: Some behavior may be platform dependent, since calls are made\nto the operating system socket APIs.\n\n*note Availability: 1ad3.: not Emscripten, not WASI.\n",
            "subsections": []
        },
        "The Python interface is a straightforward transliteration of the Unix": {
            "content": "system call and library interface for sockets to Python's\nobject-oriented style: the *note socket(): bfd. function returns a\n'socket object' whose methods implement the various socket system calls.",
            "subsections": []
        },
        "Parameter types are somewhat higher-level than in the C interface: as": {
            "content": "with 'read()' and 'write()' operations on Python files, buffer\nallocation on receive operations is automatic, and buffer length is\nimplicit on send operations.\n\nSee also\n........\n\nModule *note socketserver: c7.\n\nClasses that simplify writing network servers.\n\nModule *note ssl: ca.\n\nA TLS/SSL wrapper for socket objects.\n\n* Menu:\n\n* Socket families::\n* Module contents::\n* Socket Objects::\n* Notes on socket timeouts::\n* Example: Example<8>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/socket.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Socket families,  Next: Module contents,  Up: socket -- Low-level networking interface": {
            "content": "5.18.2.1 Socket families\n........................\n",
            "subsections": []
        },
        "Depending on the system and the build options, various socket families": {
            "content": "are supported by this module.\n",
            "subsections": []
        },
        "The address format required by a particular socket object is": {
            "content": "automatically selected based on the address family specified when the\nsocket object was created.  Socket addresses are represented as follows:\n\n- The address of an *note AFUNIX: 1580. socket bound to a file\nsystem node is represented as a string, using the file system\nencoding and the ''surrogateescape'' error handler (see PEP\n383(1)).  An address in Linux's abstract namespace is returned as a\n*note bytes-like object: b82. with an initial null byte; note that\nsockets in this namespace can communicate with normal file system\nsockets, so programs intended to run on Linux may need to deal with\nboth types of address.  A string or bytes-like object can be used\nfor either type of address when passing it as an argument.\n\nChanged in version 3.3: Previously, *note AFUNIX: 1580. socket\npaths were assumed to use UTF-8 encoding.\n\nChanged in version 3.5: Writable *note bytes-like object: b82. is\nnow accepted.\n\n- A pair '(host, port)' is used for the *note AFINET: 157e. address\nfamily, where 'host' is a string representing either a hostname in\ninternet domain notation like ''daring.cwi.nl'' or an IPv4 address\nlike ''100.50.200.5'', and 'port' is an integer.\n\n- For IPv4 addresses, two special forms are accepted instead of\na host address: '''' represents 'INADDRANY', which is used to\nbind to all interfaces, and the string ''<broadcast>''\nrepresents 'INADDRBROADCAST'.  This behavior is not\ncompatible with IPv6, therefore, you may want to avoid these\nif you intend to support IPv6 with your Python programs.\n\n- For *note AFINET6: 157f. address family, a four-tuple '(host,\nport, flowinfo, scopeid)' is used, where 'flowinfo' and 'scopeid'\nrepresent the 'sin6flowinfo' and 'sin6scopeid' members in\n'struct sockaddrin6' in C. For *note socket: c6. module methods,\n'flowinfo' and 'scopeid' can be omitted just for backward\ncompatibility.  Note, however, omission of 'scopeid' can cause\nproblems in manipulating scoped IPv6 addresses.\n\nChanged in version 3.7: For multicast addresses (with 'scopeid'\nmeaningful) 'address' may not contain '%scopeid' (or 'zone id')\npart.  This information is superfluous and may be safely omitted\n(recommended).\n\n- 'AFNETLINK' sockets are represented as pairs '(pid, groups)'.\n\n- Linux-only support for TIPC is available using the 'AFTIPC'\naddress family.  TIPC is an open, non-IP based networked protocol\ndesigned for use in clustered computer environments.  Addresses are\nrepresented by a tuple, and the fields depend on the address type.\nThe general tuple form is '(addrtype, v1, v2, v3 [, scope])',\nwhere:\n\n- 'addrtype' is one of 'TIPCADDRNAMESEQ', 'TIPCADDRNAME',\nor 'TIPCADDRID'.\n\n- 'scope' is one of 'TIPCZONESCOPE', 'TIPCCLUSTERSCOPE', and\n'TIPCNODESCOPE'.\n\n- If 'addrtype' is 'TIPCADDRNAME', then 'v1' is the server\ntype, 'v2' is the port identifier, and 'v3' should be 0.\n\nIf 'addrtype' is 'TIPCADDRNAMESEQ', then 'v1' is the server\ntype, 'v2' is the lower port number, and 'v3' is the upper\nport number.\n\nIf 'addrtype' is 'TIPCADDRID', then 'v1' is the node, 'v2'\nis the reference, and 'v3' should be set to 0.\n\n- A tuple '(interface, )' is used for the *note AFCAN: 3054. address\nfamily, where 'interface' is a string representing a network\ninterface name like ''can0''.  The network interface name '''' can\nbe used to receive packets from all network interfaces of this\nfamily.\n\n- *note CANISOTP: 3055. protocol require a tuple '(interface,\nrxaddr, txaddr)' where both additional parameters are\nunsigned long integer that represent a CAN identifier\n(standard or extended).\n\n- *note CANJ1939: 750. protocol require a tuple '(interface,\nname, pgn, addr)' where additional parameters are 64-bit\nunsigned integer representing the ECU name, a 32-bit unsigned\ninteger representing the Parameter Group Number (PGN), and an\n8-bit integer representing the address.\n\n- A string or a tuple '(id, unit)' is used for the 'SYSPROTOCONTROL'\nprotocol of the 'PFSYSTEM' family.  The string is the name of a\nkernel control using a dynamically assigned ID. The tuple can be\nused if ID and unit number of the kernel control are known or if a\nregistered ID is used.\n\nNew in version 3.3.\n\n- 'AFBLUETOOTH' supports the following protocols and address\nformats:\n\n- 'BTPROTOL2CAP' accepts '(bdaddr, psm)' where 'bdaddr' is the\nBluetooth address as a string and 'psm' is an integer.\n\n- 'BTPROTORFCOMM' accepts '(bdaddr, channel)' where 'bdaddr' is\nthe Bluetooth address as a string and 'channel' is an integer.\n\n- 'BTPROTOHCI' accepts '(deviceid,)' where 'deviceid' is\neither an integer or a string with the Bluetooth address of\nthe interface.  (This depends on your OS; NetBSD and\nDragonFlyBSD expect a Bluetooth address while everything else\nexpects an integer.)\n\nChanged in version 3.2: NetBSD and DragonFlyBSD support added.\n\n- 'BTPROTOSCO' accepts 'bdaddr' where 'bdaddr' is a *note\nbytes: 295. object containing the Bluetooth address in a\nstring format.  (ex.  'b'12:23:34:45:56:67'') This protocol is\nnot supported under FreeBSD.\n\n- *note AFALG: b26. is a Linux-only socket based interface to Kernel\ncryptography.  An algorithm socket is configured with a tuple of\ntwo to four elements '(type, name [, feat [, mask]])', where:\n\n- 'type' is the algorithm type as string, e.g.  'aead', 'hash',\n'skcipher' or 'rng'.\n\n- 'name' is the algorithm name and operation mode as string,\ne.g.  'sha256', 'hmac(sha256)', 'cbc(aes)' or\n'drbgnoprctraes256'.\n\n- 'feat' and 'mask' are unsigned 32bit integers.\n\n*note Availability: 1ad3.: Linux >= 2.6.38.\n\nSome algorithm types require more recent Kernels.\n\nNew in version 3.6.\n\n- *note AFVSOCK: 9b6. allows communication between virtual machines\nand their hosts.  The sockets are represented as a '(CID, port)'\ntuple where the context ID or CID and port are integers.\n\n*note Availability: 1ad3.: Linux >= 3.9\n\nSee 'vsock(7)'\n\nNew in version 3.7.\n\n- *note AFPACKET: 3056. is a low-level interface directly to network\ndevices.  The addresses are represented by the tuple '(ifname,\nproto[, pkttype[, hatype[, addr]]])' where:\n\n- 'ifname' - String specifying the device name.\n\n- 'proto' - The Ethernet protocol number.  May be *note\nETHPALL: 14fd. to capture all protocols, one of the *note\nETHERTYPE* constants: 14fe. or any other Ethernet protocol\nnumber.\n\n- 'pkttype' - Optional integer specifying the packet type:\n\n- 'PACKETHOST' (the default) - Packet addressed to the\nlocal host.\n\n- 'PACKETBROADCAST' - Physical-layer broadcast packet.\n\n- 'PACKETMULTICAST' - Packet sent to a physical-layer\nmulticast address.\n\n- 'PACKETOTHERHOST' - Packet to some other host that has\nbeen caught by a device driver in promiscuous mode.\n\n- 'PACKETOUTGOING' - Packet originating from the local\nhost that is looped back to a packet socket.\n\n- 'hatype' - Optional integer specifying the ARP hardware\naddress type.\n\n- 'addr' - Optional bytes-like object specifying the hardware\nphysical address, whose interpretation depends on the device.\n\n*note Availability: 1ad3.: Linux >= 2.2.\n\n- *note AFQIPCRTR: 3057. is a Linux-only socket based interface for\ncommunicating with services running on co-processors in Qualcomm\nplatforms.  The address family is represented as a '(node, port)'\ntuple where the 'node' and 'port' are non-negative integers.\n\n*note Availability: 1ad3.: Linux >= 4.7.\n\nNew in version 3.8.\n\n- 'IPPROTOUDPLITE' is a variant of UDP which allows you to specify\nwhat portion of a packet is covered with the checksum.  It adds two\nsocket options that you can change.\n'self.setsockopt(IPPROTOUDPLITE, UDPLITESENDCSCOV, length)' will\nchange what portion of outgoing packets are covered by the checksum\nand 'self.setsockopt(IPPROTOUDPLITE, UDPLITERECVCSCOV, length)'\nwill filter out packets which cover too little of their data.  In\nboth cases 'length' should be in 'range(8, 216, 8)'.\n\nSuch a socket should be constructed with 'socket(AFINET,\nSOCKDGRAM, IPPROTOUDPLITE)' for IPv4 or 'socket(AFINET6,\nSOCKDGRAM, IPPROTOUDPLITE)' for IPv6.\n\n*note Availability: 1ad3.: Linux >= 2.6.20, FreeBSD >= 10.1\n\nNew in version 3.9.\n\n- *note AFHYPERV: 3058. is a Windows-only socket based interface for\ncommunicating with Hyper-V hosts and guests.  The address family is\nrepresented as a '(vmid, serviceid)' tuple where the 'vmid' and\n'serviceid' are UUID strings.\n\nThe 'vmid' is the virtual machine identifier or a set of known\nVMID values if the target is not a specific virtual machine.  Known\nVMID constants defined on 'socket' are:\n\n- 'HVGUIDZERO'\n\n- 'HVGUIDBROADCAST'\n\n- 'HVGUIDWILDCARD' - Used to bind on itself and accept\nconnections from all partitions.\n\n- 'HVGUIDCHILDREN' - Used to bind on itself and accept\nconnection from child partitions.\n\n- 'HVGUIDLOOPBACK' - Used as a target to itself.\n\n- 'HVGUIDPARENT' - When used as a bind accepts connection from\nthe parent partition.  When used as an address target it will\nconnect to the parent partition.\n\nThe 'serviceid' is the service identifier of the registered\nservice.\n\nNew in version 3.12.\n",
            "subsections": []
        },
        "If you use a hostname in the 'host' portion of IPv4/v6 socket address,": {
            "content": "the program may show a nondeterministic behavior, as Python uses the\nfirst address returned from the DNS resolution.  The socket address will\nbe resolved differently into an actual IPv4/v6 address, depending on the\nresults from DNS resolution and/or the host configuration.  For\ndeterministic behavior use a numeric address in 'host' portion.\n",
            "subsections": []
        },
        "All errors raise exceptions.  The normal exceptions for invalid argument": {
            "content": "types and out-of-memory conditions can be raised.  Errors related to\nsocket or address semantics raise *note OSError: 613. or one of its\nsubclasses.\n\nNon-blocking mode is supported through *note setblocking(): 2836.  A\ngeneralization of this based on timeouts is supported through *note\nsettimeout(): 3059.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0383/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Module contents,  Next: Socket Objects,  Prev: Socket families,  Up: socket -- Low-level networking interface": {
            "content": "5.18.2.2 Module contents\n........................\n\nThe module *note socket: c6. exports the following elements.\n\n* Menu:\n\n* Exceptions: Exceptions<13>.\n* Constants: Constants<8>.\n* Functions: Functions<8>.\n\nFile: python3.12.info,  Node: Exceptions<13>,  Next: Constants<8>,  Up: Module contents\n\n5.18.2.3 Exceptions\n...................\n\n-- Exception: socket.error\n\nA deprecated alias of *note OSError: 613.\n\nChanged in version 3.3: Following PEP 3151(1), this class was made\nan alias of *note OSError: 613.\n\n-- Exception: socket.herror\n\nA subclass of *note OSError: 613, this exception is raised for\naddress-related errors, i.e.  for functions that use 'herrno' in\nthe POSIX C API, including *note gethostbynameex(): 1632. and\n*note gethostbyaddr(): 1631.  The accompanying value is a pair\n'(herrno, string)' representing an error returned by a library\ncall.  'herrno' is a numeric value, while 'string' represents the\ndescription of 'herrno', as returned by the 'hstrerror()' C\nfunction.\n\nChanged in version 3.3: This class was made a subclass of *note\nOSError: 613.\n\n-- Exception: socket.gaierror\n\nA subclass of *note OSError: 613, this exception is raised for\naddress-related errors by *note getaddrinfo(): 149f. and *note\ngetnameinfo(): 1466.  The accompanying value is a pair '(error,\nstring)' representing an error returned by a library call.\n'string' represents the description of 'error', as returned by the\n'gaistrerror()' C function.  The numeric 'error' value will match\none of the 'EAI*' constants defined in this module.\n\nChanged in version 3.3: This class was made a subclass of *note\nOSError: 613.\n\n-- Exception: socket.timeout\n\nA deprecated alias of *note TimeoutError: 62a.\n\nA subclass of *note OSError: 613, this exception is raised when a\ntimeout occurs on a socket which has had timeouts enabled via a\nprior call to *note settimeout(): 3059. (or implicitly through\n*note setdefaulttimeout(): 305d.).  The accompanying value is a\nstring whose value is currently always \"timed out\".\n\nChanged in version 3.3: This class was made a subclass of *note\nOSError: 613.\n\nChanged in version 3.10: This class was made an alias of *note\nTimeoutError: 62a.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3151/\n\nFile: python3.12.info,  Node: Constants<8>,  Next: Functions<8>,  Prev: Exceptions<13>,  Up: Module contents\n\n5.18.2.4 Constants\n..................\n\nThe AF* and SOCK* constants are now 'AddressFamily' and\n'SocketKind' *note IntEnum: b2e. collections.\n\nNew in version 3.4.\n\n-- Data: socket.AFUNIX\n-- Data: socket.AFINET\n-- Data: socket.AFINET6\n\nThese constants represent the address (and protocol) families, used\nfor the first argument to *note socket(): bfd.  If the *note\nAFUNIX: 1580. constant is not defined then this protocol is\nunsupported.  More constants may be available depending on the\nsystem.\n\n-- Data: socket.AFUNSPEC\n\n*note AFUNSPEC: 2fa2. means that *note getaddrinfo(): 149f. should\nreturn socket addresses for any address family (either IPv4, IPv6,\nor any other) that can be used.\n\n-- Data: socket.SOCKSTREAM\n-- Data: socket.SOCKDGRAM\n-- Data: socket.SOCKRAW\n-- Data: socket.SOCKRDM\n-- Data: socket.SOCKSEQPACKET\n\nThese constants represent the socket types, used for the second\nargument to *note socket(): bfd.  More constants may be available\ndepending on the system.  (Only *note SOCKSTREAM: 1168. and *note\nSOCKDGRAM: 1167. appear to be generally useful.)\n\n-- Data: socket.SOCKCLOEXEC\n-- Data: socket.SOCKNONBLOCK\n\nThese two constants, if defined, can be combined with the socket\ntypes and allow you to set some flags atomically (thus avoiding\npossible race conditions and the need for separate calls).\n\nSee also\n........\n\nSecure File Descriptor Handling(1) for a more thorough explanation.\n\n*note Availability: 1ad3.: Linux >= 2.6.27.\n\nNew in version 3.2.\n\n-- Data: SO*\n-- Data: socket.SOMAXCONN\n\n-- Data: MSG*\n\n-- Data: SOL*\n\n-- Data: SCM*\n\n-- Data: IPPROTO*\n\n-- Data: IPPORT*\n\n-- Data: INADDR*\n\n-- Data: IP*\n\n-- Data: IPV6*\n\n-- Data: EAI*\n\n-- Data: AI*\n\n-- Data: NI*\n\n-- Data: TCP*\n\nMany constants of these forms, documented in the Unix documentation\non sockets and/or the IP protocol, are also defined in the socket\nmodule.  They are generally used in arguments to the *note\nsetsockopt(): b25. and *note getsockopt(): b24. methods of socket\nobjects.  In most cases, only those symbols that are defined in the\nUnix header files are defined; for a few symbols, default values\nare provided.\n\nChanged in version 3.6: 'SODOMAIN', 'SOPROTOCOL', 'SOPEERSEC',\n'SOPASSSEC', 'TCPUSERTIMEOUT', 'TCPCONGESTION' were added.\n\nChanged in version 3.6.5: On Windows, 'TCPFASTOPEN', 'TCPKEEPCNT'\nappear if run-time Windows supports.\n\nChanged in version 3.7: 'TCPNOTSENTLOWAT' was added.\n\nOn Windows, 'TCPKEEPIDLE', 'TCPKEEPINTVL' appear if run-time\nWindows supports.\n\nChanged in version 3.10: 'IPRECVTOS' was added.  Added\n'TCPKEEPALIVE'.  On MacOS this constant can be used in the same\nway that 'TCPKEEPIDLE' is used on Linux.\n\nChanged in version 3.11: Added 'TCPCONNECTIONINFO'.  On MacOS\nthis constant can be used in the same way that 'TCPINFO' is used\non Linux and BSD.\n\nChanged in version 3.12: Added 'SORTABLE' and 'SOUSERCOOKIE'.\nOn OpenBSD and FreeBSD respectively those constants can be used in\nthe same way that 'SOMARK' is used on Linux.  Also added missing\nTCP socket options from Linux: 'TCPMD5SIG',\n'TCPTHINLINEARTIMEOUTS', 'TCPTHINDUPACK', 'TCPREPAIR',\n'TCPREPAIRQUEUE', 'TCPQUEUESEQ', 'TCPREPAIROPTIONS',\n'TCPTIMESTAMP', 'TCPCCINFO', 'TCPSAVESYN', 'TCPSAVEDSYN',\n'TCPREPAIRWINDOW', 'TCPFASTOPENCONNECT', 'TCPULP',\n'TCPMD5SIGEXT', 'TCPFASTOPENKEY', 'TCPFASTOPENNOCOOKIE',\n'TCPZEROCOPYRECEIVE', 'TCPINQ', 'TCPTXDELAY'.  Added\n'IPPKTINFO', 'IPUNBLOCKSOURCE', 'IPBLOCKSOURCE',\n'IPADDSOURCEMEMBERSHIP', 'IPDROPSOURCEMEMBERSHIP'.\n\n-- Data: socket.AFCAN\n-- Data: socket.PFCAN\n\n-- Data: SOLCAN*\n\n-- Data: CAN*\n\nMany constants of these forms, documented in the Linux\ndocumentation, are also defined in the socket module.\n\n*note Availability: 1ad3.: Linux >= 2.6.25, NetBSD >= 8.\n\nNew in version 3.3.\n\nChanged in version 3.11: NetBSD support was added.\n\n-- Data: socket.CANBCM\n\n-- Data: CANBCM*\n\nCANBCM, in the CAN protocol family, is the broadcast manager (BCM)\nprotocol.  Broadcast manager constants, documented in the Linux\ndocumentation, are also defined in the socket module.\n\n*note Availability: 1ad3.: Linux >= 2.6.25.\n\nNote: The 'CANBCMCANFDFRAME' flag is only available on\nLinux >= 4.8.\n\nNew in version 3.4.\n\n-- Data: socket.CANRAWFDFRAMES\n\nEnables CAN FD support in a CANRAW socket.  This is disabled by\ndefault.  This allows your application to send both CAN and CAN FD\nframes; however, you must accept both CAN and CAN FD frames when\nreading from the socket.\n\nThis constant is documented in the Linux documentation.\n\n*note Availability: 1ad3.: Linux >= 3.6.\n\nNew in version 3.5.\n\n-- Data: socket.CANRAWJOINFILTERS\n\nJoins the applied CAN filters such that only CAN frames that match\nall given CAN filters are passed to user space.\n\nThis constant is documented in the Linux documentation.\n\n*note Availability: 1ad3.: Linux >= 4.1.\n\nNew in version 3.9.\n\n-- Data: socket.CANISOTP\n\nCANISOTP, in the CAN protocol family, is the ISO-TP (ISO 15765-2)\nprotocol.  ISO-TP constants, documented in the Linux documentation.\n\n*note Availability: 1ad3.: Linux >= 2.6.25.\n\nNew in version 3.7.\n\n-- Data: socket.CANJ1939\n\nCANJ1939, in the CAN protocol family, is the SAE J1939 protocol.\nJ1939 constants, documented in the Linux documentation.\n\n*note Availability: 1ad3.: Linux >= 5.4.\n\nNew in version 3.9.\n\n-- Data: socket.AFDIVERT\n-- Data: socket.PFDIVERT\n\nThese two constants, documented in the FreeBSD divert(4) manual\npage, are also defined in the socket module.\n\n*note Availability: 1ad3.: FreeBSD >= 14.0.\n\nNew in version 3.12.\n\n-- Data: socket.AFPACKET\n-- Data: socket.PFPACKET\n\n-- Data: PACKET*\n\nMany constants of these forms, documented in the Linux\ndocumentation, are also defined in the socket module.\n\n*note Availability: 1ad3.: Linux >= 2.2.\n\n-- Data: socket.ETHPALL\n\n'ETHPALL' can be used in the *note socket: bfd. constructor as\n'proto' for the *note AFPACKET: 3056. family in order to capture\nevery packet, regardless of protocol.\n\nFor more information, see the 'packet(7)' manpage.\n\n*note Availability: 1ad3.: Linux.\n\nNew in version 3.12.\n\n-- Data: socket.AFRDS\n-- Data: socket.PFRDS\n-- Data: socket.SOLRDS\n\n-- Data: RDS*\n\nMany constants of these forms, documented in the Linux\ndocumentation, are also defined in the socket module.\n\n*note Availability: 1ad3.: Linux >= 2.6.30.\n\nNew in version 3.3.\n\n-- Data: socket.SIORCVALL\n-- Data: socket.SIOKEEPALIVEVALS\n-- Data: socket.SIOLOOPBACKFASTPATH\n\n-- Data: RCVALL*\n\nConstants for Windows' WSAIoctl().  The constants are used as\narguments to the *note ioctl(): b22. method of socket objects.\n\nChanged in version 3.6: 'SIOLOOPBACKFASTPATH' was added.\n\n-- Data: TIPC*\n\nTIPC related constants, matching the ones exported by the C socket\nAPI. See the TIPC documentation for more information.\n\n-- Data: socket.AFALG\n-- Data: socket.SOLALG\n\n-- Data: ALG*\n\nConstants for Linux Kernel cryptography.\n\n*note Availability: 1ad3.: Linux >= 2.6.38.\n\nNew in version 3.6.\n\n-- Data: socket.AFVSOCK\n-- Data: socket.IOCTLVMSOCKETSGETLOCALCID\n\n-- Data: VMADDR*\n\n-- Data: SOVM*\n\nConstants for Linux host/guest communication.\n\n*note Availability: 1ad3.: Linux >= 4.8.\n\nNew in version 3.7.\n\n-- Data: socket.AFLINK\n\n*note Availability: 1ad3.: BSD, macOS.\n\nNew in version 3.4.\n\n-- Data: socket.hasipv6\n\nThis constant contains a boolean value which indicates if IPv6 is\nsupported on this platform.\n\n-- Data: socket.BDADDRANY\n-- Data: socket.BDADDRLOCAL\n\nThese are string constants containing Bluetooth addresses with\nspecial meanings.  For example, *note BDADDRANY: 306e. can be used\nto indicate any address when specifying the binding socket with\n'BTPROTORFCOMM'.\n\n-- Data: socket.HCIFILTER\n-- Data: socket.HCITIMESTAMP\n-- Data: socket.HCIDATADIR\n\nFor use with 'BTPROTOHCI'.  *note HCIFILTER: 3070. is not\navailable for NetBSD or DragonFlyBSD. *note HCITIMESTAMP: 3071.\nand *note HCIDATADIR: 3072. are not available for FreeBSD,\nNetBSD, or DragonFlyBSD.\n\n-- Data: socket.AFQIPCRTR\n\nConstant for Qualcomm's IPC router protocol, used to communicate\nwith service providing remote processors.\n\n*note Availability: 1ad3.: Linux >= 4.7.\n\n-- Data: socket.SCMCREDS2\n-- Data: socket.LOCALCREDS\n-- Data: socket.LOCALCREDSPERSISTENT\n\nLOCALCREDS and LOCALCREDSPERSISTENT can be used with SOCKDGRAM,\nSOCKSTREAM sockets, equivalent to Linux/DragonFlyBSD SOPASSCRED,\nwhile LOCALCREDS sends the credentials at first read,\nLOCALCREDSPERSISTENT sends for each read, SCMCREDS2 must be then\nused for the latter for the message type.\n\nNew in version 3.11.\n\n*note Availability: 1ad3.: FreeBSD.\n\n-- Data: socket.SOINCOMINGCPU\n\nConstant to optimize CPU locality, to be used in conjunction\nwith 'SOREUSEPORT'.\n\nNew in version 3.11.\n\n*note Availability: 1ad3.: Linux >= 3.9\n\n-- Data: socket.AFHYPERV\n-- Data: socket.HVPROTOCOLRAW\n-- Data: socket.HVSOCKETCONNECTTIMEOUT\n-- Data: socket.HVSOCKETCONNECTTIMEOUTMAX\n-- Data: socket.HVSOCKETCONNECTEDSUSPEND\n-- Data: socket.HVSOCKETADDRESSFLAGPASSTHRU\n-- Data: socket.HVGUIDZERO\n-- Data: socket.HVGUIDWILDCARD\n-- Data: socket.HVGUIDBROADCAST\n-- Data: socket.HVGUIDCHILDREN\n-- Data: socket.HVGUIDLOOPBACK\n-- Data: socket.HVGUIDPARENT\n\nConstants for Windows Hyper-V sockets for host/guest\ncommunications.\n\n*note Availability: 1ad3.: Windows.\n\nNew in version 3.12.\n\n-- Data: socket.ETHERTYPEARP\n-- Data: socket.ETHERTYPEIP\n-- Data: socket.ETHERTYPEIPV6\n-- Data: socket.ETHERTYPEVLAN\n\nIEEE 802.3 protocol number(2).  constants.\n\n*note Availability: 1ad3.: Linux, FreeBSD, macOS.\n\nNew in version 3.12.\n\n---------- Footnotes ----------\n\n(1) https://udrepper.livejournal.com/20407.html\n\n(2)\nhttps://www.iana.org/assignments/ieee-802-numbers/ieee-802-numbers.txt\n\nFile: python3.12.info,  Node: Functions<8>,  Prev: Constants<8>,  Up: Module contents\n\n5.18.2.5 Functions\n..................\n\n* Menu:\n\n* Creating sockets::\n* Other functions: Other functions<2>.\n\nFile: python3.12.info,  Node: Creating sockets,  Next: Other functions<2>,  Up: Functions<8>\n\n5.18.2.6 Creating sockets\n.........................\n\nThe following functions all create *note socket objects: 3088.\n\n-- Class: socket.socket (family=AFINET, type=SOCKSTREAM, proto=0,\nfileno=None)\n\nCreate a new socket using the given address family, socket type and\nprotocol number.  The address family should be *note AFINET: 157e.\n(the default), *note AFINET6: 157f, *note AFUNIX: 1580, *note\nAFCAN: 3054, *note AFPACKET: 3056, or *note AFRDS: 3066.  The\nsocket type should be *note SOCKSTREAM: 1168. (the default), *note\nSOCKDGRAM: 1167, *note SOCKRAW: 305f. or perhaps one of the other\n'SOCK' constants.  The protocol number is usually zero and may be\nomitted or in the case where the address family is *note AFCAN:\n3054. the protocol should be one of 'CANRAW', *note CANBCM: e12,\n*note CANISOTP: 3055. or *note CANJ1939: 750.\n\nIf 'fileno' is specified, the values for 'family', 'type', and\n'proto' are auto-detected from the specified file descriptor.\nAuto-detection can be overruled by calling the function with\nexplicit 'family', 'type', or 'proto' arguments.  This only affects\nhow Python represents e.g.  the return value of *note\nsocket.getpeername(): 2fde. but not the actual OS resource.  Unlike\n*note socket.fromfd(): 3089, 'fileno' will return the same socket\nand not a duplicate.  This may help close a detached socket using\n*note socket.close(): 9b4.\n\nThe newly created socket is *note non-inheritable: d60.\n\nRaises an *note auditing event: 161d. 'socket.new' with\narguments 'self', 'family', 'type', 'protocol'.\n\nChanged in version 3.3: The AFCAN family was added.  The AFRDS\nfamily was added.\n\nChanged in version 3.4: The CANBCM protocol was added.\n\nChanged in version 3.4: The returned socket is now non-inheritable.\n\nChanged in version 3.7: The CANISOTP protocol was added.\n\nChanged in version 3.7: When *note SOCKNONBLOCK: a50. or *note\nSOCKCLOEXEC: a51. bit flags are applied to 'type' they are\ncleared, and *note socket.type: a52. will not reflect them.  They\nare still passed to the underlying system 'socket()' call.\nTherefore,\n\nsock = socket.socket(\nsocket.AFINET,\nsocket.SOCKSTREAM | socket.SOCKNONBLOCK)\n\nwill still create a non-blocking socket on OSes that support\n'SOCKNONBLOCK', but 'sock.type' will be set to\n'socket.SOCKSTREAM'.\n\nChanged in version 3.9: The CANJ1939 protocol was added.\n\nChanged in version 3.10: The IPPROTOMPTCP protocol was added.\n\n-- Function: socket.socketpair ([family[, type[, proto]]])\n\nBuild a pair of connected socket objects using the given address\nfamily, socket type, and protocol number.  Address family, socket\ntype, and protocol number are as for the *note socket(): bfd.\nfunction above.  The default family is *note AFUNIX: 1580. if\ndefined on the platform; otherwise, the default is *note AFINET:\n157e.\n\nThe newly created sockets are *note non-inheritable: d60.\n\nChanged in version 3.2: The returned socket objects now support the\nwhole socket API, rather than a subset.\n\nChanged in version 3.4: The returned sockets are now\nnon-inheritable.\n\nChanged in version 3.5: Windows support added.\n\n-- Function: socket.createconnection (address, timeout=GLOBALDEFAULT,\nsourceaddress=None, *, allerrors=False)\n\nConnect to a TCP service listening on the internet 'address' (a\n2-tuple '(host, port)'), and return the socket object.  This is a\nhigher-level function than *note socket.connect(): bff.: if 'host'\nis a non-numeric hostname, it will try to resolve it for both *note\nAFINET: 157e. and *note AFINET6: 157f, and then try to connect to\nall possible addresses in turn until a connection succeeds.  This\nmakes it easy to write clients that are compatible to both IPv4 and\nIPv6.\n\nPassing the optional 'timeout' parameter will set the timeout on\nthe socket instance before attempting to connect.  If no 'timeout'\nis supplied, the global default timeout setting returned by *note\ngetdefaulttimeout(): 308a. is used.\n\nIf supplied, 'sourceaddress' must be a 2-tuple '(host, port)' for\nthe socket to bind to as its source address before connecting.  If\nhost or port are '' or 0 respectively the OS default behavior will\nbe used.\n\nWhen a connection cannot be created, an exception is raised.  By\ndefault, it is the exception from the last address in the list.  If\n'allerrors' is 'True', it is an *note ExceptionGroup: 17b.\ncontaining the errors of all attempts.\n\nChanged in version 3.2: 'sourceaddress' was added.\n\nChanged in version 3.11: 'allerrors' was added.\n\n-- Function: socket.createserver (address, *, family=AFINET,\nbacklog=None, reuseport=False, dualstackipv6=False)\n\nConvenience function which creates a TCP socket bound to 'address'\n(a 2-tuple '(host, port)') and returns the socket object.\n\n'family' should be either *note AFINET: 157e. or *note AFINET6:\n157f.  'backlog' is the queue size passed to *note socket.listen():\ncc1.; if not specified , a default reasonable value is chosen.\n'reuseport' dictates whether to set the 'SOREUSEPORT' socket\noption.\n\nIf 'dualstackipv6' is true and the platform supports it the socket\nwill be able to accept both IPv4 and IPv6 connections, else it will\nraise *note ValueError: 183.  Most POSIX platforms and Windows are\nsupposed to support this functionality.  When this functionality is\nenabled the address returned by *note socket.getpeername(): 2fde.\nwhen an IPv4 connection occurs will be an IPv6 address represented\nas an IPv4-mapped IPv6 address.  If 'dualstackipv6' is false it\nwill explicitly disable this functionality on platforms that enable\nit by default (e.g.  Linux).  This parameter can be used in\nconjunction with *note hasdualstackipv6(): 857.:\n\nimport socket\n\naddr = (\"\", 8080)  # all interfaces, port 8080\nif socket.hasdualstackipv6():\ns = socket.createserver(addr, family=socket.AFINET6, dualstackipv6=True)\nelse:\ns = socket.createserver(addr)\n\nNote: On POSIX platforms the 'SOREUSEADDR' socket option is\nset in order to immediately reuse previous sockets which were\nbound on the same 'address' and remained in TIMEWAIT state.\n\nNew in version 3.8.\n\n-- Function: socket.hasdualstackipv6 ()\n\nReturn 'True' if the platform supports creating a TCP socket which\ncan handle both IPv4 and IPv6 connections.\n\nNew in version 3.8.\n\n-- Function: socket.fromfd (fd, family, type, proto=0)\n\nDuplicate the file descriptor 'fd' (an integer as returned by a\nfile object's *note fileno(): 2542. method) and build a socket\nobject from the result.  Address family, socket type and protocol\nnumber are as for the *note socket(): bfd. function above.  The\nfile descriptor should refer to a socket, but this is not checked --\nsubsequent operations on the object may fail if the file descriptor\nis invalid.  This function is rarely needed, but can be used to get\nor set socket options on a socket passed to a program as standard\ninput or output (such as a server started by the Unix inet daemon).\nThe socket is assumed to be in blocking mode.\n\nThe newly created socket is *note non-inheritable: d60.\n\nChanged in version 3.4: The returned socket is now non-inheritable.\n\n-- Function: socket.fromshare (data)\n\nInstantiate a socket from data obtained from the *note\nsocket.share(): a4e. method.  The socket is assumed to be in\nblocking mode.\n\n*note Availability: 1ad3.: Windows.\n\nNew in version 3.3.\n\n-- Data: socket.SocketType\n\nThis is a Python type object that represents the socket object\ntype.  It is the same as 'type(socket(...))'.\n\nFile: python3.12.info,  Node: Other functions<2>,  Prev: Creating sockets,  Up: Functions<8>\n\n5.18.2.7 Other functions\n........................\n\nThe *note socket: c6. module also offers various network-related\nservices:\n\n-- Function: socket.close (fd)\n\nClose a socket file descriptor.  This is like *note os.close():\n9b5, but for sockets.  On some platforms (most noticeable Windows)\n*note os.close(): 9b5. does not work for socket file descriptors.\n\nNew in version 3.7.\n\n-- Function: socket.getaddrinfo (host, port, family=0, type=0, proto=0,\nflags=0)\n\nTranslate the 'host'/'port' argument into a sequence of 5-tuples\nthat contain all the necessary arguments for creating a socket\nconnected to that service.  'host' is a domain name, a string\nrepresentation of an IPv4/v6 address or 'None'.  'port' is a string\nservice name such as ''http'', a numeric port number or 'None'.  By\npassing 'None' as the value of 'host' and 'port', you can pass\n'NULL' to the underlying C API.\n\nThe 'family', 'type' and 'proto' arguments can be optionally\nspecified in order to narrow the list of addresses returned.\nPassing zero as a value for each of these arguments selects the\nfull range of results.  The 'flags' argument can be one or several\nof the 'AI*' constants, and will influence how results are\ncomputed and returned.  For example, 'AINUMERICHOST' will disable\ndomain name resolution and will raise an error if 'host' is a\ndomain name.\n\nThe function returns a list of 5-tuples with the following\nstructure:\n\n'(family, type, proto, canonname, sockaddr)'\n\nIn these tuples, 'family', 'type', 'proto' are all integers and are\nmeant to be passed to the *note socket(): bfd. function.\n'canonname' will be a string representing the canonical name of the\n'host' if 'AICANONNAME' is part of the 'flags' argument; else\n'canonname' will be empty.  'sockaddr' is a tuple describing a\nsocket address, whose format depends on the returned 'family' (a\n'(address, port)' 2-tuple for *note AFINET: 157e, a '(address,\nport, flowinfo, scopeid)' 4-tuple for *note AFINET6: 157f.), and\nis meant to be passed to the *note socket.connect(): bff. method.\n\nRaises an *note auditing event: 161d. 'socket.getaddrinfo' with\narguments 'host', 'port', 'family', 'type', 'protocol'.\n\nThe following example fetches address information for a\nhypothetical TCP connection to 'example.org' on port 80 (results\nmay differ on your system if IPv6 isn't enabled):\n\n>>> socket.getaddrinfo(\"example.org\", 80, proto=socket.IPPROTOTCP)\n[(socket.AFINET6, socket.SOCKSTREAM,\n6, '', ('2606:2800:220:1:248:1893:25c8:1946', 80, 0, 0)),\n(socket.AFINET, socket.SOCKSTREAM,\n6, '', ('93.184.216.34', 80))]\n\nChanged in version 3.2: parameters can now be passed using keyword\narguments.\n\nChanged in version 3.7: for IPv6 multicast addresses, string\nrepresenting an address will not contain '%scopeid' part.\n\n-- Function: socket.getfqdn ([name])\n\nReturn a fully qualified domain name for 'name'.  If 'name' is\nomitted or empty, it is interpreted as the local host.  To find the\nfully qualified name, the hostname returned by *note\ngethostbyaddr(): 1631. is checked, followed by aliases for the\nhost, if available.  The first name which includes a period is\nselected.  In case no fully qualified domain name is available and\n'name' was provided, it is returned unchanged.  If 'name' was empty\nor equal to ''0.0.0.0'', the hostname from *note gethostname():\n281f. is returned.\n\n-- Function: socket.gethostbyname (hostname)\n\nTranslate a host name to IPv4 address format.  The IPv4 address is\nreturned as a string, such as ''100.50.200.5''.  If the host name\nis an IPv4 address itself it is returned unchanged.  See *note\ngethostbynameex(): 1632. for a more complete interface.  *note\ngethostbyname(): 308d. does not support IPv6 name resolution, and\n*note getaddrinfo(): 149f. should be used instead for IPv4/v6 dual\nstack support.\n\nRaises an *note auditing event: 161d. 'socket.gethostbyname' with\nargument 'hostname'.\n\n*note Availability: 1ad3.: not WASI.\n\n-- Function: socket.gethostbynameex (hostname)\n\nTranslate a host name to IPv4 address format, extended interface.\nReturn a 3-tuple '(hostname, aliaslist, ipaddrlist)' where\n'hostname' is the host's primary host name, 'aliaslist' is a\n(possibly empty) list of alternative host names for the same\naddress, and 'ipaddrlist' is a list of IPv4 addresses for the same\ninterface on the same host (often but not always a single address).\n*note gethostbynameex(): 1632. does not support IPv6 name\nresolution, and *note getaddrinfo(): 149f. should be used instead\nfor IPv4/v6 dual stack support.\n\nRaises an *note auditing event: 161d. 'socket.gethostbyname' with\nargument 'hostname'.\n\n*note Availability: 1ad3.: not WASI.\n\n-- Function: socket.gethostname ()\n\nReturn a string containing the hostname of the machine where the\nPython interpreter is currently executing.\n\nRaises an *note auditing event: 161d. 'socket.gethostname' with no\narguments.\n\nNote: *note gethostname(): 281f. doesn't always return the fully\nqualified domain name; use *note getfqdn(): 14cd. for that.\n\n*note Availability: 1ad3.: not WASI.\n\n-- Function: socket.gethostbyaddr (ipaddress)\n\nReturn a 3-tuple '(hostname, aliaslist, ipaddrlist)' where\n'hostname' is the primary host name responding to the given\n'ipaddress', 'aliaslist' is a (possibly empty) list of alternative\nhost names for the same address, and 'ipaddrlist' is a list of\nIPv4/v6 addresses for the same interface on the same host (most\nlikely containing only a single address).  To find the fully\nqualified domain name, use the function *note getfqdn(): 14cd.\n*note gethostbyaddr(): 1631. supports both IPv4 and IPv6.\n\nRaises an *note auditing event: 161d. 'socket.gethostbyaddr' with\nargument 'ipaddress'.\n\n*note Availability: 1ad3.: not WASI.\n\n-- Function: socket.getnameinfo (sockaddr, flags)\n\nTranslate a socket address 'sockaddr' into a 2-tuple '(host,\nport)'.  Depending on the settings of 'flags', the result can\ncontain a fully qualified domain name or numeric address\nrepresentation in 'host'.  Similarly, 'port' can contain a string\nport name or a numeric port number.\n\nFor IPv6 addresses, '%scopeid' is appended to the host part if\n'sockaddr' contains meaningful 'scopeid'.  Usually this happens\nfor multicast addresses.\n\nFor more information about 'flags' you can consult\n'getnameinfo(3)'.\n\nRaises an *note auditing event: 161d. 'socket.getnameinfo' with\nargument 'sockaddr'.\n\n*note Availability: 1ad3.: not WASI.\n\n-- Function: socket.getprotobyname (protocolname)\n\nTranslate an internet protocol name (for example, ''icmp'') to a\nconstant suitable for passing as the (optional) third argument to\nthe *note socket(): bfd. function.  This is usually only needed for\nsockets opened in \"raw\" mode (*note SOCKRAW: 305f.); for the\nnormal socket modes, the correct protocol is chosen automatically\nif the protocol is omitted or zero.\n\n*note Availability: 1ad3.: not WASI.\n\n-- Function: socket.getservbyname (servicename[, protocolname])\n\nTranslate an internet service name and protocol name to a port\nnumber for that service.  The optional protocol name, if given,\nshould be ''tcp'' or ''udp'', otherwise any protocol will match.\n\nRaises an *note auditing event: 161d. 'socket.getservbyname' with\narguments 'servicename', 'protocolname'.\n\n*note Availability: 1ad3.: not WASI.\n\n-- Function: socket.getservbyport (port[, protocolname])\n\nTranslate an internet port number and protocol name to a service\nname for that service.  The optional protocol name, if given,\nshould be ''tcp'' or ''udp'', otherwise any protocol will match.\n\nRaises an *note auditing event: 161d. 'socket.getservbyport' with\narguments 'port', 'protocolname'.\n\n*note Availability: 1ad3.: not WASI.\n\n-- Function: socket.ntohl (x)\n\nConvert 32-bit positive integers from network to host byte order.\nOn machines where the host byte order is the same as network byte\norder, this is a no-op; otherwise, it performs a 4-byte swap\noperation.\n\n-- Function: socket.ntohs (x)\n\nConvert 16-bit positive integers from network to host byte order.\nOn machines where the host byte order is the same as network byte\norder, this is a no-op; otherwise, it performs a 2-byte swap\noperation.\n\nChanged in version 3.10: Raises *note OverflowError: 68d. if 'x'\ndoes not fit in a 16-bit unsigned integer.\n\n-- Function: socket.htonl (x)\n\nConvert 32-bit positive integers from host to network byte order.\nOn machines where the host byte order is the same as network byte\norder, this is a no-op; otherwise, it performs a 4-byte swap\noperation.\n\n-- Function: socket.htons (x)\n\nConvert 16-bit positive integers from host to network byte order.\nOn machines where the host byte order is the same as network byte\norder, this is a no-op; otherwise, it performs a 2-byte swap\noperation.\n\nChanged in version 3.10: Raises *note OverflowError: 68d. if 'x'\ndoes not fit in a 16-bit unsigned integer.\n\n-- Function: socket.inetaton (ipstring)\n\nConvert an IPv4 address from dotted-quad string format (for\nexample, '123.45.67.89') to 32-bit packed binary format, as a bytes\nobject four characters in length.  This is useful when conversing\nwith a program that uses the standard C library and needs objects\nof type 'inaddr', which is the C type for the 32-bit packed binary\nthis function returns.\n\n*note inetaton(): 782. also accepts strings with less than three\ndots; see the Unix manual page 'inet(3)' for details.\n\nIf the IPv4 address string passed to this function is invalid,\n*note OSError: 613. will be raised.  Note that exactly what is\nvalid depends on the underlying C implementation of 'inetaton()'.\n\n*note inetaton(): 782. does not support IPv6, and *note\ninetpton(): 783. should be used instead for IPv4/v6 dual stack\nsupport.\n\n-- Function: socket.inetntoa (packedip)\n\nConvert a 32-bit packed IPv4 address (a *note bytes-like object:\nb82. four bytes in length) to its standard dotted-quad string\nrepresentation (for example, '123.45.67.89').  This is useful when\nconversing with a program that uses the standard C library and\nneeds objects of type 'inaddr', which is the C type for the 32-bit\npacked binary data this function takes as an argument.\n\nIf the byte sequence passed to this function is not exactly 4 bytes\nin length, *note OSError: 613. will be raised.  *note inetntoa():\n3093. does not support IPv6, and *note inetntop(): e14. should be\nused instead for IPv4/v6 dual stack support.\n\nChanged in version 3.5: Writable *note bytes-like object: b82. is\nnow accepted.\n\n-- Function: socket.inetpton (addressfamily, ipstring)\n\nConvert an IP address from its family-specific string format to a\npacked, binary format.  *note inetpton(): 783. is useful when a\nlibrary or network protocol calls for an object of type 'inaddr'\n(similar to *note inetaton(): 782.) or 'in6addr'.\n\nSupported values for 'addressfamily' are currently *note AFINET:\n157e. and *note AFINET6: 157f.  If the IP address string\n'ipstring' is invalid, *note OSError: 613. will be raised.  Note\nthat exactly what is valid depends on both the value of\n'addressfamily' and the underlying implementation of\n'inetpton()'.\n\n*note Availability: 1ad3.: Unix, Windows.\n\nChanged in version 3.4: Windows support added\n\n-- Function: socket.inetntop (addressfamily, packedip)\n\nConvert a packed IP address (a *note bytes-like object: b82. of\nsome number of bytes) to its standard, family-specific string\nrepresentation (for example, ''7.10.0.5'' or ''5aef:2b::8'').\n*note inetntop(): e14. is useful when a library or network\nprotocol returns an object of type 'inaddr' (similar to *note\ninetntoa(): 3093.) or 'in6addr'.\n\nSupported values for 'addressfamily' are currently *note AFINET:\n157e. and *note AFINET6: 157f.  If the bytes object 'packedip' is\nnot the correct length for the specified address family, *note\nValueError: 183. will be raised.  *note OSError: 613. is raised for\nerrors from the call to *note inetntop(): e14.\n\n*note Availability: 1ad3.: Unix, Windows.\n\nChanged in version 3.4: Windows support added\n\nChanged in version 3.5: Writable *note bytes-like object: b82. is\nnow accepted.\n\n-- Function: socket.CMSGLEN (length)\n\nReturn the total length, without trailing padding, of an ancillary\ndata item with associated data of the given 'length'.  This value\ncan often be used as the buffer size for *note recvmsg(): c02. to\nreceive a single item of ancillary data, but RFC 3542(1) requires\nportable applications to use *note CMSGSPACE(): 17b0. and thus\ninclude space for padding, even when the item will be the last in\nthe buffer.  Raises *note OverflowError: 68d. if 'length' is\noutside the permissible range of values.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nMost Unix platforms.\n\nNew in version 3.3.\n\n-- Function: socket.CMSGSPACE (length)\n\nReturn the buffer size needed for *note recvmsg(): c02. to receive\nan ancillary data item with associated data of the given 'length',\nalong with any trailing padding.  The buffer space needed to\nreceive multiple items is the sum of the *note CMSGSPACE(): 17b0.\nvalues for their associated data lengths.  Raises *note\nOverflowError: 68d. if 'length' is outside the permissible range of\nvalues.\n\nNote that some systems might support ancillary data without\nproviding this function.  Also note that setting the buffer size\nusing the results of this function may not precisely limit the\namount of ancillary data that can be received, since additional\ndata may be able to fit into the padding area.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n\nmost Unix platforms.\n\nNew in version 3.3.\n\n-- Function: socket.getdefaulttimeout ()\n\nReturn the default timeout in seconds (float) for new socket\nobjects.  A value of 'None' indicates that new socket objects have\nno timeout.  When the socket module is first imported, the default\nis 'None'.\n\n-- Function: socket.setdefaulttimeout (timeout)\n\nSet the default timeout in seconds (float) for new socket objects.\nWhen the socket module is first imported, the default is 'None'.\nSee *note settimeout(): 3059. for possible values and their\nrespective meanings.\n\n-- Function: socket.sethostname (name)\n\nSet the machine's hostname to 'name'.  This will raise an *note\nOSError: 613. if you don't have enough rights.\n\nRaises an *note auditing event: 161d. 'socket.sethostname' with\nargument 'name'.\n\n*note Availability: 1ad3.: Unix.\n\nNew in version 3.3.\n\n-- Function: socket.ifnameindex ()\n\nReturn a list of network interface information (index int, name\nstring) tuples.  *note OSError: 613. if the system call fails.\n\n*note Availability: 1ad3.: Unix, Windows, not Emscripten, not WASI.\n\nNew in version 3.3.\n\nChanged in version 3.8: Windows support was added.\n\nNote: On Windows network interfaces have different names in\ndifferent contexts (all names are examples):\n\n* UUID: '{FB605B73-AAC2-49A6-9A2F-25416AEA0573}'\n\n* name: 'ethernet32770'\n\n* friendly name: 'vEthernet (nat)'\n\n* description: 'Hyper-V Virtual Ethernet Adapter'\n\nThis function returns names of the second form from the list,\n'ethernet32770' in this example case.\n\n-- Function: socket.ifnametoindex (ifname)\n\nReturn a network interface index number corresponding to an\ninterface name.  *note OSError: 613. if no interface with the given\nname exists.\n\n*note Availability: 1ad3.: Unix, Windows, not Emscripten, not WASI.\n\nNew in version 3.3.\n\nChanged in version 3.8: Windows support was added.\n\nSee also\n........\n\n\"Interface name\" is a name as documented in *note ifnameindex():\n858.\n\n-- Function: socket.ifindextoname (ifindex)\n\nReturn a network interface name corresponding to an interface index\nnumber.  *note OSError: 613. if no interface with the given index\nexists.\n\n*note Availability: 1ad3.: Unix, Windows, not Emscripten, not WASI.\n\nNew in version 3.3.\n\nChanged in version 3.8: Windows support was added.\n\nSee also\n........\n\n\"Interface name\" is a name as documented in *note ifnameindex():\n858.\n\n-- Function: socket.sendfds (sock, buffers, fds[, flags[, address]])\n\nSend the list of file descriptors 'fds' over an *note AFUNIX:\n1580. socket 'sock'.  The 'fds' parameter is a sequence of file\ndescriptors.  Consult *note sendmsg(): 191. for the documentation\nof these parameters.\n\n*note Availability: 1ad3.: Unix, Windows, not Emscripten, not WASI.\n\nUnix platforms supporting *note sendmsg(): 191. and 'SCMRIGHTS'\nmechanism.\n\nNew in version 3.9.\n\n-- Function: socket.recvfds (sock, bufsize, maxfds[, flags])\n\nReceive up to 'maxfds' file descriptors from an *note AFUNIX:\n1580. socket 'sock'.  Return '(msg, list(fds), flags, addr)'.\nConsult *note recvmsg(): c02. for the documentation of these\nparameters.\n\n*note Availability: 1ad3.: Unix, Windows, not Emscripten, not WASI.\n\nUnix platforms supporting *note sendmsg(): 191. and 'SCMRIGHTS'\nmechanism.\n\nNew in version 3.9.\n\nNote: Any truncated integers at the end of the list of file\ndescriptors.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc3542.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Socket Objects,  Next: Notes on socket timeouts,  Prev: Module contents,  Up: socket -- Low-level networking interface": {
            "content": "5.18.2.8 Socket Objects\n.......................\n\nSocket objects have the following methods.  Except for *note makefile():\n1013, these correspond to Unix system calls applicable to sockets.\n\nChanged in version 3.2: Support for the *note context manager: 398.\nprotocol was added.  Exiting the context manager is equivalent to\ncalling *note close(): 9b4.\n\n-- Method: socket.accept ()\n\nAccept a connection.  The socket must be bound to an address and\nlistening for connections.  The return value is a pair '(conn,\naddress)' where 'conn' is a 'new' socket object usable to send and\nreceive data on the connection, and 'address' is the address bound\nto the socket on the other end of the connection.\n\nThe newly created socket is *note non-inheritable: d60.\n\nChanged in version 3.4: The socket is now non-inheritable.\n\nChanged in version 3.5: If the system call is interrupted and the\nsignal handler does not raise an exception, the method now retries\nthe system call instead of raising an *note InterruptedError: be3.\nexception (see PEP 475(1) for the rationale).\n\n-- Method: socket.bind (address)\n\nBind the socket to 'address'.  The socket must not already be\nbound.  (The format of 'address' depends on the address family --\nsee above.)\n\nRaises an *note auditing event: 161d. 'socket.bind' with arguments\n'self', 'address'.\n\n*note Availability: 1ad3.: not WASI.\n\n-- Method: socket.close ()\n\nMark the socket closed.  The underlying system resource (e.g.  a\nfile descriptor) is also closed when all file objects from *note\nmakefile(): 1013. are closed.  Once that happens, all future\noperations on the socket object will fail.  The remote end will\nreceive no more data (after queued data is flushed).\n\nSockets are automatically closed when they are garbage-collected,\nbut it is recommended to *note close(): 9b4. them explicitly, or to\nuse a *note with: 396. statement around them.\n\nChanged in version 3.6: *note OSError: 613. is now raised if an\nerror occurs when the underlying 'close()' call is made.\n\nNote: *note close(): 9b4. releases the resource associated\nwith a connection but does not necessarily close the\nconnection immediately.  If you want to close the connection\nin a timely fashion, call *note shutdown(): 3095. before *note\nclose(): 9b4.\n\n-- Method: socket.connect (address)\n\nConnect to a remote socket at 'address'.  (The format of 'address'\ndepends on the address family -- see above.)\n\nIf the connection is interrupted by a signal, the method waits\nuntil the connection completes, or raise a *note TimeoutError: 62a.\non timeout, if the signal handler doesn't raise an exception and\nthe socket is blocking or has a timeout.  For non-blocking sockets,\nthe method raises an *note InterruptedError: be3. exception if the\nconnection is interrupted by a signal (or the exception raised by\nthe signal handler).\n\nRaises an *note auditing event: 161d. 'socket.connect' with\narguments 'self', 'address'.\n\nChanged in version 3.5: The method now waits until the connection\ncompletes instead of raising an *note InterruptedError: be3.\nexception if the connection is interrupted by a signal, the signal\nhandler doesn't raise an exception and the socket is blocking or\nhas a timeout (see the PEP 475(2) for the rationale).\n\n*note Availability: 1ad3.: not WASI.\n\n-- Method: socket.connectex (address)\n\nLike 'connect(address)', but return an error indicator instead of\nraising an exception for errors returned by the C-level 'connect()'\ncall (other problems, such as \"host not found,\" can still raise\nexceptions).  The error indicator is '0' if the operation\nsucceeded, otherwise the value of the 'errno' variable.  This is\nuseful to support, for example, asynchronous connects.\n\nRaises an *note auditing event: 161d. 'socket.connect' with\narguments 'self', 'address'.\n\n*note Availability: 1ad3.: not WASI.\n\n-- Method: socket.detach ()\n\nPut the socket object into closed state without actually closing\nthe underlying file descriptor.  The file descriptor is returned,\nand can be reused for other purposes.\n\nNew in version 3.2.\n\n-- Method: socket.dup ()\n\nDuplicate the socket.\n\nThe newly created socket is *note non-inheritable: d60.\n\nChanged in version 3.4: The socket is now non-inheritable.\n\n*note Availability: 1ad3.: not WASI.\n\n-- Method: socket.fileno ()\n\nReturn the socket's file descriptor (a small integer), or -1 on\nfailure.  This is useful with *note select.select(): bfc.\n\nUnder Windows the small integer returned by this method cannot be\nused where a file descriptor can be used (such as *note\nos.fdopen(): 1c38.).  Unix does not have this limitation.\n\n-- Method: socket.getinheritable ()\n\nGet the *note inheritable flag: d60. of the socket's file\ndescriptor or socket's handle: 'True' if the socket can be\ninherited in child processes, 'False' if it cannot.\n\nNew in version 3.4.\n\n-- Method: socket.getpeername ()\n\nReturn the remote address to which the socket is connected.  This\nis useful to find out the port number of a remote IPv4/v6 socket,\nfor instance.  (The format of the address returned depends on the\naddress family -- see above.)  On some systems this function is not\nsupported.\n\n-- Method: socket.getsockname ()\n\nReturn the socket's own address.  This is useful to find out the\nport number of an IPv4/v6 socket, for instance.  (The format of the\naddress returned depends on the address family -- see above.)\n\n-- Method: socket.getsockopt (level, optname[, buflen])\n\nReturn the value of the given socket option (see the Unix man page\n'getsockopt(2)').  The needed symbolic constants (*note SO* etc.:\n2f9e.) are defined in this module.  If 'buflen' is absent, an\ninteger option is assumed and its integer value is returned by the\nfunction.  If 'buflen' is present, it specifies the maximum length\nof the buffer used to receive the option in, and this buffer is\nreturned as a bytes object.  It is up to the caller to decode the\ncontents of the buffer (see the optional built-in module *note\nstruct: cf. for a way to decode C structures encoded as byte\nstrings).\n\n*note Availability: 1ad3.: not WASI.\n\n-- Method: socket.getblocking ()\n\nReturn 'True' if socket is in blocking mode, 'False' if in\nnon-blocking.\n\nThis is equivalent to checking 'socket.gettimeout() != 0'.\n\nNew in version 3.7.\n\n-- Method: socket.gettimeout ()\n\nReturn the timeout in seconds (float) associated with socket\noperations, or 'None' if no timeout is set.  This reflects the last\ncall to *note setblocking(): 2836. or *note settimeout(): 3059.\n\n-- Method: socket.ioctl (control, option)\n\n\nPlatform: Windows\n\nThe *note ioctl(): b22. method is a limited interface to the\nWSAIoctl system interface.  Please refer to the Win32\ndocumentation(3) for more information.\n\nOn other platforms, the generic *note fcntl.fcntl(): 3099. and\n*note fcntl.ioctl(): 12d0. functions may be used; they accept a\nsocket object as their first argument.\n\nCurrently only the following control codes are supported:\n'SIORCVALL', 'SIOKEEPALIVEVALS', and 'SIOLOOPBACKFASTPATH'.\n\nChanged in version 3.6: 'SIOLOOPBACKFASTPATH' was added.\n\n-- Method: socket.listen ([backlog])\n\nEnable a server to accept connections.  If 'backlog' is specified,\nit must be at least 0 (if it is lower, it is set to 0); it\nspecifies the number of unaccepted connections that the system will\nallow before refusing new connections.  If not specified, a default\nreasonable value is chosen.\n\n*note Availability: 1ad3.: not WASI.\n\nChanged in version 3.5: The 'backlog' parameter is now optional.\n\n-- Method: socket.makefile (mode='r', buffering=None, *, encoding=None,\nerrors=None, newline=None)\n\nReturn a *note file object: 1037. associated with the socket.  The\nexact returned type depends on the arguments given to *note\nmakefile(): 1013.  These arguments are interpreted the same way as\nby the built-in *note open(): 26e. function, except the only\nsupported 'mode' values are ''r'' (default), ''w'' and ''b''.\n\nThe socket must be in blocking mode; it can have a timeout, but the\nfile object's internal buffer may end up in an inconsistent state\nif a timeout occurs.\n\nClosing the file object returned by *note makefile(): 1013. won't\nclose the original socket unless all other file objects have been\nclosed and *note socket.close(): 9b4. has been called on the socket\nobject.\n\nNote: On Windows, the file-like object created by *note\nmakefile(): 1013. cannot be used where a file object with a\nfile descriptor is expected, such as the stream arguments of\n*note subprocess.Popen(): 8c3.\n\n-- Method: socket.recv (bufsize[, flags])\n\nReceive data from the socket.  The return value is a bytes object\nrepresenting the data received.  The maximum amount of data to be\nreceived at once is specified by 'bufsize'.  A returned empty bytes\nobject indicates that the client has disconnected.  See the Unix\nmanual page 'recv(2)' for the meaning of the optional argument\n'flags'; it defaults to zero.\n\nNote: For best match with hardware and network realities, the\nvalue of 'bufsize' should be a relatively small power of 2,\nfor example, 4096.\n\nChanged in version 3.5: If the system call is interrupted and the\nsignal handler does not raise an exception, the method now retries\nthe system call instead of raising an *note InterruptedError: be3.\nexception (see PEP 475(4) for the rationale).\n\n-- Method: socket.recvfrom (bufsize[, flags])\n\nReceive data from the socket.  The return value is a pair '(bytes,\naddress)' where 'bytes' is a bytes object representing the data\nreceived and 'address' is the address of the socket sending the\ndata.  See the Unix manual page 'recv(2)' for the meaning of the\noptional argument 'flags'; it defaults to zero.  (The format of\n'address' depends on the address family -- see above.)\n\nChanged in version 3.5: If the system call is interrupted and the\nsignal handler does not raise an exception, the method now retries\nthe system call instead of raising an *note InterruptedError: be3.\nexception (see PEP 475(5) for the rationale).\n\nChanged in version 3.7: For multicast IPv6 address, first item of\n'address' does not contain '%scopeid' part anymore.  In order to\nget full IPv6 address use *note getnameinfo(): 1466.\n\n-- Method: socket.recvmsg (bufsize[, ancbufsize[, flags]])\n\nReceive normal data (up to 'bufsize' bytes) and ancillary data from\nthe socket.  The 'ancbufsize' argument sets the size in bytes of\nthe internal buffer used to receive the ancillary data; it defaults\nto 0, meaning that no ancillary data will be received.  Appropriate\nbuffer sizes for ancillary data can be calculated using *note\nCMSGSPACE(): 17b0. or *note CMSGLEN(): 17b1, and items which do\nnot fit into the buffer might be truncated or discarded.  The\n'flags' argument defaults to 0 and has the same meaning as for\n*note recv(): c00.\n\nThe return value is a 4-tuple: '(data, ancdata, msgflags,\naddress)'.  The 'data' item is a *note bytes: 295. object holding\nthe non-ancillary data received.  The 'ancdata' item is a list of\nzero or more tuples '(cmsglevel, cmsgtype, cmsgdata)'\nrepresenting the ancillary data (control messages) received:\n'cmsglevel' and 'cmsgtype' are integers specifying the protocol\nlevel and protocol-specific type respectively, and 'cmsgdata' is a\n*note bytes: 295. object holding the associated data.  The\n'msgflags' item is the bitwise OR of various flags indicating\nconditions on the received message; see your system documentation\nfor details.  If the receiving socket is unconnected, 'address' is\nthe address of the sending socket, if available; otherwise, its\nvalue is unspecified.\n\nOn some systems, *note sendmsg(): 191. and *note recvmsg(): c02.\ncan be used to pass file descriptors between processes over an\n*note AFUNIX: 1580. socket.  When this facility is used (it is\noften restricted to *note SOCKSTREAM: 1168. sockets), *note\nrecvmsg(): c02. will return, in its ancillary data, items of the\nform '(socket.SOLSOCKET, socket.SCMRIGHTS, fds)', where 'fds' is\na *note bytes: 295. object representing the new file descriptors as\na binary array of the native C int type.  If *note recvmsg(): c02.\nraises an exception after the system call returns, it will first\nattempt to close any file descriptors received via this mechanism.\n\nSome systems do not indicate the truncated length of ancillary data\nitems which have been only partially received.  If an item appears\nto extend beyond the end of the buffer, *note recvmsg(): c02. will\nissue a *note RuntimeWarning: 8c9, and will return the part of it\nwhich is inside the buffer provided it has not been truncated\nbefore the start of its associated data.\n\nOn systems which support the 'SCMRIGHTS' mechanism, the following\nfunction will receive up to 'maxfds' file descriptors, returning\nthe message data and a list containing the descriptors (while\nignoring unexpected conditions such as unrelated control messages\nbeing received).  See also *note sendmsg(): 191.\n\nimport socket, array\n\ndef recvfds(sock, msglen, maxfds):\nfds = array.array(\"i\")   # Array of ints\nmsg, ancdata, flags, addr = sock.recvmsg(msglen, socket.CMSGLEN(maxfds * fds.itemsize))\nfor cmsglevel, cmsgtype, cmsgdata in ancdata:\nif cmsglevel == socket.SOLSOCKET and cmsgtype == socket.SCMRIGHTS:\n# Append data, ignoring any truncated integers at the end.\nfds.frombytes(cmsgdata[:len(cmsgdata) - (len(cmsgdata) % fds.itemsize)])\nreturn msg, list(fds)\n\n*note Availability: 1ad3.: Unix.\n\nMost Unix platforms.\n\nNew in version 3.3.\n\nChanged in version 3.5: If the system call is interrupted and the\nsignal handler does not raise an exception, the method now retries\nthe system call instead of raising an *note InterruptedError: be3.\nexception (see PEP 475(6) for the rationale).\n\n-- Method: socket.recvmsginto (buffers[, ancbufsize[, flags]])\n\nReceive normal data and ancillary data from the socket, behaving as\n*note recvmsg(): c02. would, but scatter the non-ancillary data\ninto a series of buffers instead of returning a new bytes object.\nThe 'buffers' argument must be an iterable of objects that export\nwritable buffers (e.g.  *note bytearray: 294. objects); these will\nbe filled with successive chunks of the non-ancillary data until it\nhas all been written or there are no more buffers.  The operating\nsystem may set a limit (*note sysconf(): 285d. value 'SCIOVMAX')\non the number of buffers that can be used.  The 'ancbufsize' and\n'flags' arguments have the same meaning as for *note recvmsg():\nc02.\n\nThe return value is a 4-tuple: '(nbytes, ancdata, msgflags,\naddress)', where 'nbytes' is the total number of bytes of\nnon-ancillary data written into the buffers, and 'ancdata',\n'msgflags' and 'address' are the same as for *note recvmsg(): c02.\n\nExample:\n\n>>> import socket\n>>> s1, s2 = socket.socketpair()\n>>> b1 = bytearray(b'----')\n>>> b2 = bytearray(b'0123456789')\n>>> b3 = bytearray(b'--------------')\n>>> s1.send(b'Mary had a little lamb')\n22\n>>> s2.recvmsginto([b1, memoryview(b2)[2:9], b3])\n(22, [], 0, None)\n>>> [b1, b2, b3]\n[bytearray(b'Mary'), bytearray(b'01 had a 9'), bytearray(b'little lamb---')]\n\n*note Availability: 1ad3.: Unix.\n\nMost Unix platforms.\n\nNew in version 3.3.\n\n-- Method: socket.recvfrominto (buffer[, nbytes[, flags]])\n\nReceive data from the socket, writing it into 'buffer' instead of\ncreating a new bytestring.  The return value is a pair '(nbytes,\naddress)' where 'nbytes' is the number of bytes received and\n'address' is the address of the socket sending the data.  See the\nUnix manual page 'recv(2)' for the meaning of the optional argument\n'flags'; it defaults to zero.  (The format of 'address' depends on\nthe address family -- see above.)\n\n-- Method: socket.recvinto (buffer[, nbytes[, flags]])\n\nReceive up to 'nbytes' bytes from the socket, storing the data into\na buffer rather than creating a new bytestring.  If 'nbytes' is not\nspecified (or 0), receive up to the size available in the given\nbuffer.  Returns the number of bytes received.  See the Unix manual\npage 'recv(2)' for the meaning of the optional argument 'flags'; it\ndefaults to zero.\n\n-- Method: socket.send (bytes[, flags])\n\nSend data to the socket.  The socket must be connected to a remote\nsocket.  The optional 'flags' argument has the same meaning as for\n*note recv(): c00. above.  Returns the number of bytes sent.\nApplications are responsible for checking that all data has been\nsent; if only some of the data was transmitted, the application\nneeds to attempt delivery of the remaining data.  For further\ninformation on this topic, consult the *note Socket Programming\nHOWTO: 309a.\n\nChanged in version 3.5: If the system call is interrupted and the\nsignal handler does not raise an exception, the method now retries\nthe system call instead of raising an *note InterruptedError: be3.\nexception (see PEP 475(7) for the rationale).\n\n-- Method: socket.sendall (bytes[, flags])\n\nSend data to the socket.  The socket must be connected to a remote\nsocket.  The optional 'flags' argument has the same meaning as for\n*note recv(): c00. above.  Unlike *note send(): c03, this method\ncontinues to send data from 'bytes' until either all data has been\nsent or an error occurs.  'None' is returned on success.  On error,\nan exception is raised, and there is no way to determine how much\ndata, if any, was successfully sent.\n\nChanged in version 3.5: The socket timeout is no longer reset each\ntime data is sent successfully.  The socket timeout is now the\nmaximum total duration to send all data.\n\nChanged in version 3.5: If the system call is interrupted and the\nsignal handler does not raise an exception, the method now retries\nthe system call instead of raising an *note InterruptedError: be3.\nexception (see PEP 475(8) for the rationale).\n\n-- Method: socket.sendto (bytes, address)\n\n-- Method: socket.sendto (bytes, flags, address)\n\nSend data to the socket.  The socket should not be connected to a\nremote socket, since the destination socket is specified by\n'address'.  The optional 'flags' argument has the same meaning as\nfor *note recv(): c00. above.  Return the number of bytes sent.\n(The format of 'address' depends on the address family -- see\nabove.)\n\nRaises an *note auditing event: 161d. 'socket.sendto' with\narguments 'self', 'address'.\n\nChanged in version 3.5: If the system call is interrupted and the\nsignal handler does not raise an exception, the method now retries\nthe system call instead of raising an *note InterruptedError: be3.\nexception (see PEP 475(9) for the rationale).\n\n-- Method: socket.sendmsg (buffers[, ancdata[, flags[, address]]])\n\nSend normal and ancillary data to the socket, gathering the\nnon-ancillary data from a series of buffers and concatenating it\ninto a single message.  The 'buffers' argument specifies the\nnon-ancillary data as an iterable of *note bytes-like objects: b82.\n(e.g.  *note bytes: 295. objects); the operating system may set a\nlimit (*note sysconf(): 285d. value 'SCIOVMAX') on the number of\nbuffers that can be used.  The 'ancdata' argument specifies the\nancillary data (control messages) as an iterable of zero or more\ntuples '(cmsglevel, cmsgtype, cmsgdata)', where 'cmsglevel' and\n'cmsgtype' are integers specifying the protocol level and\nprotocol-specific type respectively, and 'cmsgdata' is a\nbytes-like object holding the associated data.  Note that some\nsystems (in particular, systems without *note CMSGSPACE(): 17b0.)\nmight support sending only one control message per call.  The\n'flags' argument defaults to 0 and has the same meaning as for\n*note send(): c03.  If 'address' is supplied and not 'None', it\nsets a destination address for the message.  The return value is\nthe number of bytes of non-ancillary data sent.\n\nThe following function sends the list of file descriptors 'fds'\nover an *note AFUNIX: 1580. socket, on systems which support the\n'SCMRIGHTS' mechanism.  See also *note recvmsg(): c02.\n\nimport socket, array\n\ndef sendfds(sock, msg, fds):\nreturn sock.sendmsg([msg], [(socket.SOLSOCKET, socket.SCMRIGHTS, array.array(\"i\", fds))])\n\n*note Availability: 1ad3.: Unix, not WASI.\n\nMost Unix platforms.\n\nRaises an *note auditing event: 161d. 'socket.sendmsg' with\narguments 'self', 'address'.\n\nNew in version 3.3.\n\nChanged in version 3.5: If the system call is interrupted and the\nsignal handler does not raise an exception, the method now retries\nthe system call instead of raising an *note InterruptedError: be3.\nexception (see PEP 475(10) for the rationale).\n\n-- Method: socket.sendmsgafalg ([msg], *, op[, iv[, assoclen[,\nflags]]])\n\nSpecialized version of *note sendmsg(): 191. for *note AFALG: b26.\nsocket.  Set mode, IV, AEAD associated data length and flags for\n*note AFALG: b26. socket.\n\n*note Availability: 1ad3.: Linux >= 2.6.38.\n\nNew in version 3.6.\n\n-- Method: socket.sendfile (file, offset=0, count=None)\n\nSend a file until EOF is reached by using high-performance *note\nos.sendfile: 946. and return the total number of bytes which were\nsent.  'file' must be a regular file object opened in binary mode.\nIf *note os.sendfile: 946. is not available (e.g.  Windows) or\n'file' is not a regular file *note send(): c03. will be used\ninstead.  'offset' tells from where to start reading the file.  If\nspecified, 'count' is the total number of bytes to transmit as\nopposed to sending the file until EOF is reached.  File position is\nupdated on return or also in case of error in which case *note\nfile.tell(): 26a2. can be used to figure out the number of bytes\nwhich were sent.  The socket must be of *note SOCKSTREAM: 1168.\ntype.  Non-blocking sockets are not supported.\n\nNew in version 3.5.\n\n-- Method: socket.setinheritable (inheritable)\n\nSet the *note inheritable flag: d60. of the socket's file\ndescriptor or socket's handle.\n\nNew in version 3.4.\n\n-- Method: socket.setblocking (flag)\n\nSet blocking or non-blocking mode of the socket: if 'flag' is\nfalse, the socket is set to non-blocking, else to blocking mode.\n\nThis method is a shorthand for certain *note settimeout(): 3059.\ncalls:\n\n* 'sock.setblocking(True)' is equivalent to\n'sock.settimeout(None)'\n\n* 'sock.setblocking(False)' is equivalent to\n'sock.settimeout(0.0)'\n\nChanged in version 3.7: The method no longer applies *note\nSOCKNONBLOCK: a50. flag on *note socket.type: a52.\n\n-- Method: socket.settimeout (value)\n\nSet a timeout on blocking socket operations.  The 'value' argument\ncan be a nonnegative floating point number expressing seconds, or\n'None'.  If a non-zero value is given, subsequent socket operations\nwill raise a *note timeout: 629. exception if the timeout period\n'value' has elapsed before the operation has completed.  If zero is\ngiven, the socket is put in non-blocking mode.  If 'None' is given,\nthe socket is put in blocking mode.\n\nFor further information, please consult the *note notes on socket\ntimeouts: 309b.\n\nChanged in version 3.7: The method no longer toggles *note\nSOCKNONBLOCK: a50. flag on *note socket.type: a52.\n\n-- Method: socket.setsockopt (level, optname, value: int)\n\n-- Method: socket.setsockopt (level, optname, value: buffer)\n\n-- Method: socket.setsockopt (level, optname, None, optlen: int)\n\nSet the value of the given socket option (see the Unix manual page\n'setsockopt(2)').  The needed symbolic constants are defined in\nthis module (SO* etc.  <socket-unix-constants>).  The value can be\nan integer, 'None' or a *note bytes-like object: b82. representing\na buffer.  In the later case it is up to the caller to ensure that\nthe bytestring contains the proper bits (see the optional built-in\nmodule *note struct: cf. for a way to encode C structures as\nbytestrings).  When 'value' is set to 'None', 'optlen' argument is\nrequired.  It's equivalent to call 'setsockopt()' C function with\n'optval=NULL' and 'optlen=optlen'.\n\nChanged in version 3.5: Writable *note bytes-like object: b82. is\nnow accepted.\n\nChanged in version 3.6: setsockopt(level, optname, None, optlen:\nint) form added.\n\n*note Availability: 1ad3.: not WASI.\n\n-- Method: socket.shutdown (how)\n\nShut down one or both halves of the connection.  If 'how' is\n'SHUTRD', further receives are disallowed.  If 'how' is 'SHUTWR',\nfurther sends are disallowed.  If 'how' is 'SHUTRDWR', further\nsends and receives are disallowed.\n\n*note Availability: 1ad3.: not WASI.\n\n-- Method: socket.share (processid)\n\nDuplicate a socket and prepare it for sharing with a target\nprocess.  The target process must be provided with 'processid'.\nThe resulting bytes object can then be passed to the target process\nusing some form of interprocess communication and the socket can be\nrecreated there using *note fromshare(): a4d.  Once this method has\nbeen called, it is safe to close the socket since the operating\nsystem has already duplicated it for the target process.\n\n*note Availability: 1ad3.: Windows.\n\nNew in version 3.3.\n\nNote that there are no methods 'read()' or 'write()'; use *note recv():\nc00. and *note send(): c03. without 'flags' argument instead.\n",
            "subsections": []
        },
        "Socket objects also have these (read-only) attributes that correspond to": {
            "content": "the values given to the *note socket: bfd. constructor.\n\n-- Attribute: socket.family\n\nThe socket family.\n\n-- Attribute: socket.type\n\nThe socket type.\n\n-- Attribute: socket.proto\n\nThe socket protocol.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0475/\n\n(2) https://peps.python.org/pep-0475/\n\n(3) https://msdn.microsoft.com/en-us/library/ms741621%28VS.85%29.aspx\n\n(4) https://peps.python.org/pep-0475/\n\n(5) https://peps.python.org/pep-0475/\n\n(6) https://peps.python.org/pep-0475/\n\n(7) https://peps.python.org/pep-0475/\n\n(8) https://peps.python.org/pep-0475/\n\n(9) https://peps.python.org/pep-0475/\n\n(10) https://peps.python.org/pep-0475/\n\nFile: python3.12.info,  Node: Notes on socket timeouts,  Next: Example<8>,  Prev: Socket Objects,  Up: socket -- Low-level networking interface\n\n5.18.2.9 Notes on socket timeouts\n.................................\n\nA socket object can be in one of three modes: blocking, non-blocking, or\ntimeout.  Sockets are by default always created in blocking mode, but\nthis can be changed by calling *note setdefaulttimeout(): 305d.\n\n* In 'blocking mode', operations block until complete or the system\nreturns an error (such as connection timed out).\n\n* In 'non-blocking mode', operations fail (with an error that is\nunfortunately system-dependent) if they cannot be completed\nimmediately: functions from the *note select: bc. module can be\nused to know when and whether a socket is available for reading or\nwriting.\n\n* In 'timeout mode', operations fail if they cannot be completed\nwithin the timeout specified for the socket (they raise a *note\ntimeout: 629. exception) or if the system returns an error.\n\nNote: At the operating system level, sockets in 'timeout mode' are\ninternally set in non-blocking mode.  Also, the blocking and\ntimeout modes are shared between file descriptors and socket\nobjects that refer to the same network endpoint.  This\nimplementation detail can have visible consequences if e.g.  you\ndecide to use the *note fileno(): 3097. of a socket.\n\n* Menu:\n\n* Timeouts and the connect method::\n* Timeouts and the accept method::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Timeouts and the connect method,  Next: Timeouts and the accept method,  Up: Notes on socket timeouts": {
            "content": "5.18.2.10 Timeouts and the 'connect' method\n...........................................\n\nThe *note connect(): bff. operation is also subject to the timeout\nsetting, and in general it is recommended to call *note settimeout():\n3059. before calling *note connect(): bff. or pass a timeout parameter\nto *note createconnection(): 43c.  However, the system network stack\nmay also return a connection timeout error of its own regardless of any\nPython socket timeout setting.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Timeouts and the accept method,  Prev: Timeouts and the connect method,  Up: Notes on socket timeouts": {
            "content": "5.18.2.11 Timeouts and the 'accept' method\n..........................................\n\nIf *note getdefaulttimeout(): 308a. is not *note None: 43f, sockets\nreturned by the *note accept(): bfe. method inherit that timeout.\nOtherwise, the behaviour depends on settings of the listening socket:\n\n* if the listening socket is in 'blocking mode' or in 'timeout mode',\nthe socket returned by *note accept(): bfe. is in 'blocking mode';\n\n* if the listening socket is in 'non-blocking mode', whether the\nsocket returned by *note accept(): bfe. is in blocking or\nnon-blocking mode is operating system-dependent.  If you want to\nensure cross-platform behaviour, it is recommended you manually\noverride this setting.\n\nFile: python3.12.info,  Node: Example<8>,  Prev: Notes on socket timeouts,  Up: socket -- Low-level networking interface\n\n5.18.2.12 Example\n.................\n",
            "subsections": []
        },
        "Here are four minimal example programs using the TCP/IP protocol: a": {
            "content": "server that echoes all data that it receives back (servicing only one\nclient), and a client using it.  Note that a server must perform the\nsequence *note socket(): bfd, *note bind(): 1394, *note listen(): cc1,\n*note accept(): bfe. (possibly repeating the *note accept(): bfe. to\nservice more than one client), while a client only needs the sequence\n*note socket(): bfd, *note connect(): bff.  Also note that the server\ndoes not *note sendall(): c04./*note recv(): c00. on the socket it is\nlistening on but on the new socket returned by *note accept(): bfe.\n\nThe first two examples support IPv4 only.\n\n# Echo server program\nimport socket\n\nHOST = ''                 # Symbolic name meaning all available interfaces\nPORT = 50007              # Arbitrary non-privileged port\nwith socket.socket(socket.AFINET, socket.SOCKSTREAM) as s:\ns.bind((HOST, PORT))\ns.listen(1)\nconn, addr = s.accept()\nwith conn:\nprint('Connected by', addr)\nwhile True:\ndata = conn.recv(1024)\nif not data: break\nconn.sendall(data)\n\n# Echo client program\nimport socket\n\nHOST = 'daring.cwi.nl'    # The remote host\nPORT = 50007              # The same port as used by the server\nwith socket.socket(socket.AFINET, socket.SOCKSTREAM) as s:\ns.connect((HOST, PORT))\ns.sendall(b'Hello, world')\ndata = s.recv(1024)\nprint('Received', repr(data))\n",
            "subsections": []
        },
        "The next two examples are identical to the above two, but support both": {
            "content": "IPv4 and IPv6.  The server side will listen to the first address family\navailable (it should listen to both instead).  On most of IPv6-ready\nsystems, IPv6 will take precedence and the server may not accept IPv4\ntraffic.  The client side will try to connect to all the addresses\nreturned as a result of the name resolution, and sends traffic to the\nfirst one connected successfully.\n\n# Echo server program\nimport socket\nimport sys\n\nHOST = None               # Symbolic name meaning all available interfaces\nPORT = 50007              # Arbitrary non-privileged port\ns = None\nfor res in socket.getaddrinfo(HOST, PORT, socket.AFUNSPEC,\nsocket.SOCKSTREAM, 0, socket.AIPASSIVE):\naf, socktype, proto, canonname, sa = res\ntry:\ns = socket.socket(af, socktype, proto)\nexcept OSError as msg:\ns = None\ncontinue\ntry:\ns.bind(sa)\ns.listen(1)\nexcept OSError as msg:\ns.close()\ns = None\ncontinue\nbreak\nif s is None:\nprint('could not open socket')\nsys.exit(1)\nconn, addr = s.accept()\nwith conn:\nprint('Connected by', addr)\nwhile True:\ndata = conn.recv(1024)\nif not data: break\nconn.send(data)\n\n# Echo client program\nimport socket\nimport sys\n\nHOST = 'daring.cwi.nl'    # The remote host\nPORT = 50007              # The same port as used by the server\ns = None\nfor res in socket.getaddrinfo(HOST, PORT, socket.AFUNSPEC, socket.SOCKSTREAM):\naf, socktype, proto, canonname, sa = res\ntry:\ns = socket.socket(af, socktype, proto)\nexcept OSError as msg:\ns = None\ncontinue\ntry:\ns.connect(sa)\nexcept OSError as msg:\ns.close()\ns = None\ncontinue\nbreak\nif s is None:\nprint('could not open socket')\nsys.exit(1)\nwith s:\ns.sendall(b'Hello, world')\ndata = s.recv(1024)\nprint('Received', repr(data))\n",
            "subsections": []
        },
        "The next example shows how to write a very simple network sniffer with": {
            "content": "raw sockets on Windows.  The example requires administrator privileges\nto modify the interface:\n\nimport socket\n\n# the public network interface\nHOST = socket.gethostbyname(socket.gethostname())\n\n# create a raw socket and bind it to the public interface\ns = socket.socket(socket.AFINET, socket.SOCKRAW, socket.IPPROTOIP)\ns.bind((HOST, 0))\n\n# Include IP headers\ns.setsockopt(socket.IPPROTOIP, socket.IPHDRINCL, 1)\n\n# receive all packets\ns.ioctl(socket.SIORCVALL, socket.RCVALLON)\n\n# receive a packet\nprint(s.recvfrom(65565))\n\n# disabled promiscuous mode\ns.ioctl(socket.SIORCVALL, socket.RCVALLOFF)\n",
            "subsections": []
        },
        "The next example shows how to use the socket interface to communicate to": {
            "content": "a CAN network using the raw socket protocol.  To use CAN with the\nbroadcast manager protocol instead, open a socket with:\n\nsocket.socket(socket.AFCAN, socket.SOCKDGRAM, socket.CANBCM)\n\nAfter binding ('CANRAW') or connecting (*note CANBCM: e12.) the\nsocket, you can use the *note socket.send(): c03. and *note\nsocket.recv(): c00. operations (and their counterparts) on the socket\nobject as usual.\n\nThis last example might require special privileges:\n\nimport socket\nimport struct\n\n\n# CAN frame packing/unpacking (see 'struct canframe' in <linux/can.h>)\n\ncanframefmt = \"=IB3x8s\"\ncanframesize = struct.calcsize(canframefmt)\n\ndef buildcanframe(canid, data):\ncandlc = len(data)\ndata = data.ljust(8, b'\\x00')\nreturn struct.pack(canframefmt, canid, candlc, data)\n\ndef dissectcanframe(frame):\ncanid, candlc, data = struct.unpack(canframefmt, frame)\nreturn (canid, candlc, data[:candlc])\n\n\n# create a raw socket and bind it to the 'vcan0' interface\ns = socket.socket(socket.AFCAN, socket.SOCKRAW, socket.CANRAW)\ns.bind(('vcan0',))\n\nwhile True:\ncf, addr = s.recvfrom(canframesize)\n\nprint('Received: canid=%x, candlc=%x, data=%s' % dissectcanframe(cf))\n\ntry:\ns.send(cf)\nexcept OSError:\nprint('Error sending CAN frame')\n\ntry:\ns.send(buildcanframe(0x01, b'\\x01\\x02\\x03'))\nexcept OSError:\nprint('Error sending CAN frame')\n",
            "subsections": []
        },
        "Running an example several times with too small delay between": {
            "content": "executions, could lead to this error:\n\nOSError: [Errno 98] Address already in use\n",
            "subsections": []
        },
        "This is because the previous execution has left the socket in a": {
            "content": "'TIMEWAIT' state, and can't be immediately reused.\n\nThere is a *note socket: c6. flag to set, in order to prevent this,\n'socket.SOREUSEADDR':\n\ns = socket.socket(socket.AFINET, socket.SOCKSTREAM)\ns.setsockopt(socket.SOLSOCKET, socket.SOREUSEADDR, 1)\ns.bind((HOST, PORT))\n\nthe 'SOREUSEADDR' flag tells the kernel to reuse a local socket in\n'TIMEWAIT' state, without waiting for its natural timeout to expire.\n\nSee also\n........\n",
            "subsections": []
        },
        "For an introduction to socket programming (in C), see the following": {
            "content": "papers:\n\n- 'An Introductory 4.3BSD Interprocess Communication Tutorial', by\nStuart Sechrest\n\n- 'An Advanced 4.3BSD Interprocess Communication Tutorial', by Samuel\nJ. Leffler et al,\n\nboth in the UNIX Programmer's Manual, Supplementary Documents 1\n(sections PS1:7 and PS1:8).  The platform-specific reference material\nfor the various socket-related system calls are also a valuable source\nof information on the details of socket semantics.  For Unix, refer to\nthe manual pages; for Windows, see the WinSock (or Winsock 2)\nspecification.  For IPv6-ready APIs, readers may want to refer to RFC\n3493(1) titled Basic Socket Interface Extensions for IPv6.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc3493.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ssl -- TLS/SSL wrapper for socket objects,  Next: select -- Waiting for I/O completion,  Prev: socket -- Low-level networking interface,  Up: Networking and Interprocess Communication": {
            "content": "'Source code:' Lib/ssl.py(1)\n\n\n",
            "subsections": []
        },
        "This module provides access to Transport Layer Security (often known as": {
            "content": "\"Secure Sockets Layer\") encryption and peer authentication facilities\nfor network sockets, both client-side and server-side.  This module uses\nthe OpenSSL library.  It is available on all modern Unix systems,",
            "subsections": []
        },
        "Windows, macOS, and probably additional platforms, as long as OpenSSL is": {
            "content": "installed on that platform.\n\nNote: Some behavior may be platform dependent, since calls are made\nto the operating system socket APIs.  The installed version of\nOpenSSL may also cause variations in behavior.  For example,\nTLSv1.3 comes with OpenSSL version 1.1.1.\n\nWarning: Don't use this module without reading the *note Security\nconsiderations: 2f9c.  Doing so may lead to a false sense of\nsecurity, as the default settings of the ssl module are not\nnecessarily appropriate for your application.\n\n*note Availability: 1ad3.: not Emscripten, not WASI.\n",
            "subsections": []
        },
        "This section documents the objects and functions in the 'ssl' module;": {
            "content": "for more general information about TLS, SSL, and certificates, the\nreader is referred to the documents in the \"See Also\" section at the\nbottom.\n\nThis module provides a class, *note ssl.SSLSocket: 703, which is derived\nfrom the *note socket.socket: bfd. type, and provides a socket-like\nwrapper that also encrypts and decrypts the data going over the socket\nwith SSL. It supports additional methods such as 'getpeercert()', which\nretrieves the certificate of the other side of the connection, and\n'cipher()', which retrieves the cipher being used for the secure\nconnection.\n\nFor more sophisticated applications, the *note ssl.SSLContext: 278.\nclass helps manage settings and certificates, which can then be\ninherited by SSL sockets created through the *note\nSSLContext.wrapsocket(): 279. method.\n",
            "subsections": []
        },
        "Changed in version 3.5.3: Updated to support linking with OpenSSL 1.1.0": {
            "content": "",
            "subsections": []
        },
        "Changed in version 3.6: OpenSSL 0.9.8, 1.0.0 and 1.0.1 are deprecated": {
            "content": "and no longer supported.  In the future the ssl module will require at\nleast OpenSSL 1.0.2 or 1.1.0.\n",
            "subsections": []
        },
        "Changed in version 3.10: PEP 644(2) has been implemented.  The ssl": {
            "content": "module requires OpenSSL 1.1.1 or newer.\n",
            "subsections": []
        },
        "Use of deprecated constants and functions result in deprecation": {
            "content": "warnings.\n\n* Menu:\n\n* Functions, Constants, and Exceptions: Functions Constants and Exceptions.\n* SSL Sockets::\n* SSL Contexts::\n* Certificates::\n* Examples: Examples<19>.\n* Notes on non-blocking sockets::\n* Memory BIO Support: Memory BIO Support<2>.\n* SSL session::\n* Security considerations: Security considerations<2>.\n* TLS 1.3: TLS 1 3.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/ssl.py\n\n(2) https://peps.python.org/pep-0644/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Functions Constants and Exceptions,  Next: SSL Sockets,  Up: ssl -- TLS/SSL wrapper for socket objects": {
            "content": "5.18.3.1 Functions, Constants, and Exceptions\n.............................................\n\n* Menu:\n\n* Socket creation::\n* Context creation::\n* Exceptions: Exceptions<14>.\n* Random generation::\n* Certificate handling::\n* Constants: Constants<9>.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Socket creation,  Next: Context creation,  Up: Functions Constants and Exceptions": {
            "content": "5.18.3.2 Socket creation\n........................\n\nInstances of *note SSLSocket: 703. must be created using the *note\nSSLContext.wrapsocket(): 279. method.  The helper function *note\ncreatedefaultcontext(): e17. returns a new context with secure default\nsettings.\n\nClient socket example with default context and IPv4/IPv6 dual stack:\n\nimport socket\nimport ssl\n\nhostname = 'www.python.org'\ncontext = ssl.createdefaultcontext()\n\nwith socket.createconnection((hostname, 443)) as sock:\nwith context.wrapsocket(sock, serverhostname=hostname) as ssock:\nprint(ssock.version())\n\nClient socket example with custom context and IPv4:\n\nhostname = 'www.python.org'\n# PROTOCOLTLSCLIENT requires valid cert chain and hostname\ncontext = ssl.SSLContext(ssl.PROTOCOLTLSCLIENT)\ncontext.loadverifylocations('path/to/cabundle.pem')\n\nwith socket.socket(socket.AFINET, socket.SOCKSTREAM, 0) as sock:\nwith context.wrapsocket(sock, serverhostname=hostname) as ssock:\nprint(ssock.version())\n\nServer socket example listening on localhost IPv4:\n\ncontext = ssl.SSLContext(ssl.PROTOCOLTLSSERVER)\ncontext.loadcertchain('/path/to/certchain.pem', '/path/to/private.key')\n\nwith socket.socket(socket.AFINET, socket.SOCKSTREAM, 0) as sock:\nsock.bind(('127.0.0.1', 8443))\nsock.listen(5)\nwith context.wrapsocket(sock, serverside=True) as ssock:\nconn, addr = ssock.accept()\n...\n\nFile: python3.12.info,  Node: Context creation,  Next: Exceptions<14>,  Prev: Socket creation,  Up: Functions Constants and Exceptions\n\n5.18.3.3 Context creation\n.........................\n\nA convenience function helps create *note SSLContext: 278. objects for\ncommon purposes.\n\n-- Function: ssl.createdefaultcontext (purpose=Purpose.SERVERAUTH,\ncafile=None, capath=None, cadata=None)\n\nReturn a new *note SSLContext: 278. object with default settings\nfor the given 'purpose'.  The settings are chosen by the *note ssl:\nca. module, and usually represent a higher security level than when\ncalling the *note SSLContext: 278. constructor directly.\n\n'cafile', 'capath', 'cadata' represent optional CA certificates to\ntrust for certificate verification, as in *note\nSSLContext.loadverifylocations(): d52.  If all three are *note\nNone: 43f, this function can choose to trust the system's default\nCA certificates instead.\n\nThe settings are: *note PROTOCOLTLSCLIENT: 67b. or *note\nPROTOCOLTLSSERVER: 67c, *note OPNOSSLv2: 62e, and *note\nOPNOSSLv3: 62f. with high encryption cipher suites without RC4\nand without unauthenticated cipher suites.  Passing *note\nSERVERAUTH: e22. as 'purpose' sets *note verifymode: 30a8. to\n*note CERTREQUIRED: 30a9. and either loads CA certificates (when\nat least one of 'cafile', 'capath' or 'cadata' is given) or uses\n*note SSLContext.loaddefaultcerts(): e21. to load default CA\ncertificates.\n\nWhen *note keylogfilename: 30aa. is supported and the environment\nvariable 'SSLKEYLOGFILE' is set, *note createdefaultcontext():\ne17. enables key logging.\n\nNote: The protocol, options, cipher and other settings may\nchange to more restrictive values anytime without prior\ndeprecation.  The values represent a fair balance between\ncompatibility and security.\n\nIf your application needs specific settings, you should create\na *note SSLContext: 278. and apply the settings yourself.\n\nNote: If you find that when certain older clients or servers\nattempt to connect with a *note SSLContext: 278. created by\nthis function that they get an error stating \"Protocol or\ncipher suite mismatch\", it may be that they only support\nSSL3.0 which this function excludes using the *note\nOPNOSSLv3: 62f.  SSL3.0 is widely considered to be\ncompletely broken(1).  If you still wish to continue to use\nthis function but still allow SSL 3.0 connections you can\nre-enable them using:\n\nctx = ssl.createdefaultcontext(Purpose.CLIENTAUTH)\nctx.options &= ~ssl.OPNOSSLv3\n\nNew in version 3.4.\n\nChanged in version 3.4.4: RC4 was dropped from the default cipher\nstring.\n\nChanged in version 3.6: ChaCha20/Poly1305 was added to the default\ncipher string.\n\n3DES was dropped from the default cipher string.\n\nChanged in version 3.8: Support for key logging to 'SSLKEYLOGFILE'\nwas added.\n\nChanged in version 3.10: The context now uses *note\nPROTOCOLTLSCLIENT: 67b. or *note PROTOCOLTLSSERVER: 67c.\nprotocol instead of generic *note PROTOCOLTLS: 67a.\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/POODLE\n\nFile: python3.12.info,  Node: Exceptions<14>,  Next: Random generation,  Prev: Context creation,  Up: Functions Constants and Exceptions\n\n5.18.3.4 Exceptions\n...................\n\n-- Exception: ssl.SSLError\n\nRaised to signal an error from the underlying SSL implementation\n(currently provided by the OpenSSL library).  This signifies some\nproblem in the higher-level encryption and authentication layer\nthat's superimposed on the underlying network connection.  This\nerror is a subtype of *note OSError: 613.  The error code and\nmessage of *note SSLError: 10f2. instances are provided by the\nOpenSSL library.\n\nChanged in version 3.3: *note SSLError: 10f2. used to be a subtype\nof *note socket.error: ece.\n\n-- Attribute: library\n\nA string mnemonic designating the OpenSSL submodule in which\nthe error occurred, such as 'SSL', 'PEM' or 'X509'.  The range\nof possible values depends on the OpenSSL version.\n\nNew in version 3.3.\n\n-- Attribute: reason\n\nA string mnemonic designating the reason this error occurred,\nfor example 'CERTIFICATEVERIFYFAILED'.  The range of\npossible values depends on the OpenSSL version.\n\nNew in version 3.3.\n\n-- Exception: ssl.SSLZeroReturnError\n\nA subclass of *note SSLError: 10f2. raised when trying to read or\nwrite and the SSL connection has been closed cleanly.  Note that\nthis doesn't mean that the underlying transport (read TCP) has been\nclosed.\n\nNew in version 3.3.\n\n-- Exception: ssl.SSLWantReadError\n\nA subclass of *note SSLError: 10f2. raised by a *note non-blocking\nSSL socket: 30ad. when trying to read or write data, but more data\nneeds to be received on the underlying TCP transport before the\nrequest can be fulfilled.\n\nNew in version 3.3.\n\n-- Exception: ssl.SSLWantWriteError\n\nA subclass of *note SSLError: 10f2. raised by a *note non-blocking\nSSL socket: 30ad. when trying to read or write data, but more data\nneeds to be sent on the underlying TCP transport before the request\ncan be fulfilled.\n\nNew in version 3.3.\n\n-- Exception: ssl.SSLSyscallError\n\nA subclass of *note SSLError: 10f2. raised when a system error was\nencountered while trying to fulfill an operation on a SSL socket.\nUnfortunately, there is no easy way to inspect the original errno\nnumber.\n\nNew in version 3.3.\n\n-- Exception: ssl.SSLEOFError\n\nA subclass of *note SSLError: 10f2. raised when the SSL connection\nhas been terminated abruptly.  Generally, you shouldn't try to\nreuse the underlying transport when this error is encountered.\n\nNew in version 3.3.\n\n-- Exception: ssl.SSLCertVerificationError\n\nA subclass of *note SSLError: 10f2. raised when certificate\nvalidation has failed.\n\nNew in version 3.7.\n\n-- Attribute: verifycode\n\nA numeric error number that denotes the verification error.\n\n-- Attribute: verifymessage\n\nA human readable string of the verification error.\n\n-- Exception: ssl.CertificateError\n\nAn alias for *note SSLCertVerificationError: 9bd.\n\nChanged in version 3.7: The exception is now an alias for *note\nSSLCertVerificationError: 9bd.\n\nFile: python3.12.info,  Node: Random generation,  Next: Certificate handling,  Prev: Exceptions<14>,  Up: Functions Constants and Exceptions\n\n5.18.3.5 Random generation\n..........................\n\n-- Function: ssl.RANDbytes (num)\n\nReturn 'num' cryptographically strong pseudo-random bytes.  Raises\nan *note SSLError: 10f2. if the PRNG has not been seeded with\nenough data or if the operation is not supported by the current\nRAND method.  *note RANDstatus(): 162a. can be used to check the\nstatus of the PRNG and *note RANDadd(): 30b3. can be used to seed\nthe PRNG.\n\nFor almost all applications *note os.urandom(): 276. is preferable.\n\nRead the Wikipedia article, Cryptographically secure pseudorandom\nnumber generator (CSPRNG)(1), to get the requirements of a\ncryptographically strong generator.\n\nNew in version 3.3.\n\n-- Function: ssl.RANDstatus ()\n\nReturn 'True' if the SSL pseudo-random number generator has been\nseeded with 'enough' randomness, and 'False' otherwise.  You can\nuse 'ssl.RANDegd()' and *note ssl.RANDadd(): 30b3. to increase\nthe randomness of the pseudo-random number generator.\n\n-- Function: ssl.RANDadd (bytes, entropy)\n\nMix the given 'bytes' into the SSL pseudo-random number generator.\nThe parameter 'entropy' (a float) is a lower bound on the entropy\ncontained in string (so you can always use '0.0').  See RFC 1750(2)\nfor more information on sources of entropy.\n\nChanged in version 3.5: Writable *note bytes-like object: b82. is\nnow accepted.\n\n---------- Footnotes ----------\n\n(1)\nhttps://en.wikipedia.org/wiki/Cryptographicallysecurepseudorandomnumbergenerator\n\n(2) https://datatracker.ietf.org/doc/html/rfc1750.html\n\nFile: python3.12.info,  Node: Certificate handling,  Next: Constants<9>,  Prev: Random generation,  Up: Functions Constants and Exceptions\n\n5.18.3.6 Certificate handling\n.............................\n\n-- Function: ssl.certtimetoseconds (certtime)\n\nReturn the time in seconds since the Epoch, given the 'certtime'\nstring representing the \"notBefore\" or \"notAfter\" date from a\ncertificate in '\"%b %d %H:%M:%S %Y %Z\"' strptime format (C locale).\n\nHere's an example:\n\n>>> import ssl\n>>> timestamp = ssl.certtimetoseconds(\"Jan  5 09:34:43 2018 GMT\")\n>>> timestamp\n1515144883\n>>> from datetime import datetime\n>>> print(datetime.utcfromtimestamp(timestamp))\n2018-01-05 09:34:43\n\n\"notBefore\" or \"notAfter\" dates must use GMT ( RFC 5280(1)).\n\nChanged in version 3.5: Interpret the input time as a time in UTC\nas specified by 'GMT' timezone in the input string.  Local timezone\nwas used previously.  Return an integer (no fractions of a second\nin the input format)\n\n-- Function: ssl.getservercertificate (addr,\nsslversion=PROTOCOLTLSCLIENT, cacerts=None[, timeout])\n\nGiven the address 'addr' of an SSL-protected server, as a\n('hostname', 'port-number') pair, fetches the server's certificate,\nand returns it as a PEM-encoded string.  If 'sslversion' is\nspecified, uses that version of the SSL protocol to attempt to\nconnect to the server.  If 'cacerts' is specified, it should be a\nfile containing a list of root certificates, the same format as\nused for the 'cafile' parameter in *note\nSSLContext.loadverifylocations(): d52.  The call will attempt to\nvalidate the server certificate against that set of root\ncertificates, and will fail if the validation attempt fails.  A\ntimeout can be specified with the 'timeout' parameter.\n\nChanged in version 3.3: This function is now IPv6-compatible.\n\nChanged in version 3.5: The default 'sslversion' is changed from\n*note PROTOCOLSSLv3: 675. to *note PROTOCOLTLS: 67a. for maximum\ncompatibility with modern servers.\n\nChanged in version 3.10: The 'timeout' parameter was added.\n\n-- Function: ssl.DERcerttoPEMcert (DERcertbytes)\n\nGiven a certificate as a DER-encoded blob of bytes, returns a\nPEM-encoded string version of the same certificate.\n\n-- Function: ssl.PEMcerttoDERcert (PEMcertstring)\n\nGiven a certificate as an ASCII PEM string, returns a DER-encoded\nsequence of bytes for that same certificate.\n\n-- Function: ssl.getdefaultverifypaths ()\n\nReturns a named tuple with paths to OpenSSL's default cafile and\ncapath.  The paths are the same as used by *note\nSSLContext.setdefaultverifypaths(): e19.  The return value is a\n*note named tuple: 417. 'DefaultVerifyPaths':\n\n* 'cafile' - resolved path to cafile or 'None' if the file\ndoesn't exist,\n\n* 'capath' - resolved path to capath or 'None' if the directory\ndoesn't exist,\n\n* 'opensslcafileenv' - OpenSSL's environment key that points\nto a cafile,\n\n* 'opensslcafile' - hard coded path to a cafile,\n\n* 'opensslcapathenv' - OpenSSL's environment key that points\nto a capath,\n\n* 'opensslcapath' - hard coded path to a capath directory\n\nNew in version 3.4.\n\n-- Function: ssl.enumcertificates (storename)\n\nRetrieve certificates from Windows' system cert store.\n'storename' may be one of 'CA', 'ROOT' or 'MY'.  Windows may\nprovide additional cert stores, too.\n\nThe function returns a list of (certbytes, encodingtype, trust)\ntuples.  The encodingtype specifies the encoding of certbytes.\nIt is either 'x509asn' for X.509 ASN.1 data or 'pkcs7asn' for\nPKCS#7 ASN.1 data.  Trust specifies the purpose of the certificate\nas a set of OIDS or exactly 'True' if the certificate is\ntrustworthy for all purposes.\n\nExample:\n\n>>> ssl.enumcertificates(\"CA\")\n[(b'data...', 'x509asn', {'1.3.6.1.5.5.7.3.1', '1.3.6.1.5.5.7.3.2'}),\n(b'data...', 'x509asn', True)]\n\n*note Availability: 1ad3.: Windows.\n\nNew in version 3.4.\n\n-- Function: ssl.enumcrls (storename)\n\nRetrieve CRLs from Windows' system cert store.  'storename' may be\none of 'CA', 'ROOT' or 'MY'.  Windows may provide additional cert\nstores, too.\n\nThe function returns a list of (certbytes, encodingtype, trust)\ntuples.  The encodingtype specifies the encoding of certbytes.\nIt is either 'x509asn' for X.509 ASN.1 data or 'pkcs7asn' for\nPKCS#7 ASN.1 data.\n\n*note Availability: 1ad3.: Windows.\n\nNew in version 3.4.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc5280.html\n\nFile: python3.12.info,  Node: Constants<9>,  Prev: Certificate handling,  Up: Functions Constants and Exceptions\n\n5.18.3.7 Constants\n..................\n\nAll constants are now *note enum.IntEnum: b2e. or *note\nenum.IntFlag: 200b. collections.\n\nNew in version 3.6.\n\n-- Data: ssl.CERTNONE\n\nPossible value for *note SSLContext.verifymode: 30a8.  Except for\n*note PROTOCOLTLSCLIENT: 67b, it is the default mode.  With\nclient-side sockets, just about any cert is accepted.  Validation\nerrors, such as untrusted or expired cert, are ignored and do not\nabort the TLS/SSL handshake.\n\nIn server mode, no certificate is requested from the client, so the\nclient does not send any for client cert authentication.\n\nSee the discussion of *note Security considerations: 2f9c. below.\n\n-- Data: ssl.CERTOPTIONAL\n\nPossible value for *note SSLContext.verifymode: 30a8.  In client\nmode, *note CERTOPTIONAL: 30b9. has the same meaning as *note\nCERTREQUIRED: 30a9.  It is recommended to use *note CERTREQUIRED:\n30a9. for client-side sockets instead.\n\nIn server mode, a client certificate request is sent to the client.\nThe client may either ignore the request or send a certificate in\norder perform TLS client cert authentication.  If the client\nchooses to send a certificate, it is verified.  Any verification\nerror immediately aborts the TLS handshake.\n\nUse of this setting requires a valid set of CA certificates to be\npassed to *note SSLContext.loadverifylocations(): d52.\n\n-- Data: ssl.CERTREQUIRED\n\nPossible value for *note SSLContext.verifymode: 30a8.  In this\nmode, certificates are required from the other side of the socket\nconnection; an *note SSLError: 10f2. will be raised if no\ncertificate is provided, or if its validation fails.  This mode is\n'not' sufficient to verify a certificate in client mode as it does\nnot match hostnames.  *note checkhostname: 30ba. must be enabled\nas well to verify the authenticity of a cert.  *note\nPROTOCOLTLSCLIENT: 67b. uses *note CERTREQUIRED: 30a9. and\nenables *note checkhostname: 30ba. by default.\n\nWith server socket, this mode provides mandatory TLS client cert\nauthentication.  A client certificate request is sent to the client\nand the client must provide a valid and trusted certificate.\n\nUse of this setting requires a valid set of CA certificates to be\npassed to *note SSLContext.loadverifylocations(): d52.\n\n-- Class: ssl.VerifyMode\n\n*note enum.IntEnum: b2e. collection of CERT* constants.\n\nNew in version 3.6.\n\n-- Data: ssl.VERIFYDEFAULT\n\nPossible value for *note SSLContext.verifyflags: e1c.  In this\nmode, certificate revocation lists (CRLs) are not checked.  By\ndefault OpenSSL does neither require nor verify CRLs.\n\nNew in version 3.4.\n\n-- Data: ssl.VERIFYCRLCHECKLEAF\n\nPossible value for *note SSLContext.verifyflags: e1c.  In this\nmode, only the peer cert is checked but none of the intermediate CA\ncertificates.  The mode requires a valid CRL that is signed by the\npeer cert's issuer (its direct ancestor CA). If no proper CRL has\nbeen loaded with *note SSLContext.loadverifylocations: d52,\nvalidation will fail.\n\nNew in version 3.4.\n\n-- Data: ssl.VERIFYCRLCHECKCHAIN\n\nPossible value for *note SSLContext.verifyflags: e1c.  In this\nmode, CRLs of all certificates in the peer cert chain are checked.\n\nNew in version 3.4.\n\n-- Data: ssl.VERIFYX509STRICT\n\nPossible value for *note SSLContext.verifyflags: e1c. to disable\nworkarounds for broken X.509 certificates.\n\nNew in version 3.4.\n\n-- Data: ssl.VERIFYALLOWPROXYCERTS\n\nPossible value for *note SSLContext.verifyflags: e1c. to enables\nproxy certificate verification.\n\nNew in version 3.10.\n\n-- Data: ssl.VERIFYX509TRUSTEDFIRST\n\nPossible value for *note SSLContext.verifyflags: e1c.  It\ninstructs OpenSSL to prefer trusted certificates when building the\ntrust chain to validate a certificate.  This flag is enabled by\ndefault.\n\nNew in version 3.4.4.\n\n-- Data: ssl.VERIFYX509PARTIALCHAIN\n\nPossible value for *note SSLContext.verifyflags: e1c.  It\ninstructs OpenSSL to accept intermediate CAs in the trust store to\nbe treated as trust-anchors, in the same way as the self-signed\nroot CA certificates.  This makes it possible to trust certificates\nissued by an intermediate CA without having to trust its ancestor\nroot CA.\n\nNew in version 3.10.\n\n-- Class: ssl.VerifyFlags\n\n*note enum.IntFlag: 200b. collection of VERIFY* constants.\n\nNew in version 3.6.\n\n-- Data: ssl.PROTOCOLTLS\n\nSelects the highest protocol version that both the client and\nserver support.  Despite the name, this option can select both\n\"SSL\" and \"TLS\" protocols.\n\nNew in version 3.6.\n\nDeprecated since version 3.10: TLS clients and servers require\ndifferent default settings for secure communication.  The generic\nTLS protocol constant is deprecated in favor of *note\nPROTOCOLTLSCLIENT: 67b. and *note PROTOCOLTLSSERVER: 67c.\n\n-- Data: ssl.PROTOCOLTLSCLIENT\n\nAuto-negotiate the highest protocol version that both the client\nand server support, and configure the context client-side\nconnections.  The protocol enables *note CERTREQUIRED: 30a9. and\n*note checkhostname: 30ba. by default.\n\nNew in version 3.6.\n\n-- Data: ssl.PROTOCOLTLSSERVER\n\nAuto-negotiate the highest protocol version that both the client\nand server support, and configure the context server-side\nconnections.\n\nNew in version 3.6.\n\n-- Data: ssl.PROTOCOLSSLv23\n\nAlias for *note PROTOCOLTLS: 67a.\n\nDeprecated since version 3.6: Use *note PROTOCOLTLS: 67a. instead.\n\n-- Data: ssl.PROTOCOLSSLv3\n\nSelects SSL version 3 as the channel encryption protocol.\n\nThis protocol is not available if OpenSSL is compiled with the\n'no-ssl3' option.\n\nWarning: SSL version 3 is insecure.  Its use is highly\ndiscouraged.\n\nDeprecated since version 3.6: OpenSSL has deprecated all version\nspecific protocols.  Use the default protocol *note\nPROTOCOLTLSSERVER: 67c. or *note PROTOCOLTLSCLIENT: 67b. with\n*note SSLContext.minimumversion: 9c4. and *note\nSSLContext.maximumversion: 9c5. instead.\n\n-- Data: ssl.PROTOCOLTLSv1\n\nSelects TLS version 1.0 as the channel encryption protocol.\n\nDeprecated since version 3.6: OpenSSL has deprecated all version\nspecific protocols.\n\n-- Data: ssl.PROTOCOLTLSv11\n\nSelects TLS version 1.1 as the channel encryption protocol.\nAvailable only with openssl version 1.0.1+.\n\nNew in version 3.4.\n\nDeprecated since version 3.6: OpenSSL has deprecated all version\nspecific protocols.\n\n-- Data: ssl.PROTOCOLTLSv12\n\nSelects TLS version 1.2 as the channel encryption protocol.\nAvailable only with openssl version 1.0.1+.\n\nNew in version 3.4.\n\nDeprecated since version 3.6: OpenSSL has deprecated all version\nspecific protocols.\n\n-- Data: ssl.OPALL\n\nEnables workarounds for various bugs present in other SSL\nimplementations.  This option is set by default.  It does not\nnecessarily set the same flags as OpenSSL's 'SSLOPALL' constant.\n\nNew in version 3.2.\n\n-- Data: ssl.OPNOSSLv2\n\nPrevents an SSLv2 connection.  This option is only applicable in\nconjunction with *note PROTOCOLTLS: 67a.  It prevents the peers\nfrom choosing SSLv2 as the protocol version.\n\nNew in version 3.2.\n\nDeprecated since version 3.6: SSLv2 is deprecated\n\n-- Data: ssl.OPNOSSLv3\n\nPrevents an SSLv3 connection.  This option is only applicable in\nconjunction with *note PROTOCOLTLS: 67a.  It prevents the peers\nfrom choosing SSLv3 as the protocol version.\n\nNew in version 3.2.\n\nDeprecated since version 3.6: SSLv3 is deprecated\n\n-- Data: ssl.OPNOTLSv1\n\nPrevents a TLSv1 connection.  This option is only applicable in\nconjunction with *note PROTOCOLTLS: 67a.  It prevents the peers\nfrom choosing TLSv1 as the protocol version.\n\nNew in version 3.2.\n\nDeprecated since version 3.7: The option is deprecated since\nOpenSSL 1.1.0, use the new *note SSLContext.minimumversion: 9c4.\nand *note SSLContext.maximumversion: 9c5. instead.\n\n-- Data: ssl.OPNOTLSv11\n\nPrevents a TLSv1.1 connection.  This option is only applicable in\nconjunction with *note PROTOCOLTLS: 67a.  It prevents the peers\nfrom choosing TLSv1.1 as the protocol version.  Available only with\nopenssl version 1.0.1+.\n\nNew in version 3.4.\n\nDeprecated since version 3.7: The option is deprecated since\nOpenSSL 1.1.0.\n\n-- Data: ssl.OPNOTLSv12\n\nPrevents a TLSv1.2 connection.  This option is only applicable in\nconjunction with *note PROTOCOLTLS: 67a.  It prevents the peers\nfrom choosing TLSv1.2 as the protocol version.  Available only with\nopenssl version 1.0.1+.\n\nNew in version 3.4.\n\nDeprecated since version 3.7: The option is deprecated since\nOpenSSL 1.1.0.\n\n-- Data: ssl.OPNOTLSv13\n\nPrevents a TLSv1.3 connection.  This option is only applicable in\nconjunction with *note PROTOCOLTLS: 67a.  It prevents the peers\nfrom choosing TLSv1.3 as the protocol version.  TLS 1.3 is\navailable with OpenSSL 1.1.1 or later.  When Python has been\ncompiled against an older version of OpenSSL, the flag defaults to\n'0'.\n\nNew in version 3.6.3.\n\nDeprecated since version 3.7: The option is deprecated since\nOpenSSL 1.1.0.  It was added to 2.7.15 and 3.6.3 for backwards\ncompatibility with OpenSSL 1.0.2.\n\n-- Data: ssl.OPNORENEGOTIATION\n\nDisable all renegotiation in TLSv1.2 and earlier.  Do not send\nHelloRequest messages, and ignore renegotiation requests via\nClientHello.\n\nThis option is only available with OpenSSL 1.1.0h and later.\n\nNew in version 3.7.\n\n-- Data: ssl.OPCIPHERSERVERPREFERENCE\n\nUse the server's cipher ordering preference, rather than the\nclient's.  This option has no effect on client sockets and SSLv2\nserver sockets.\n\nNew in version 3.3.\n\n-- Data: ssl.OPSINGLEDHUSE\n\nPrevents re-use of the same DH key for distinct SSL sessions.  This\nimproves forward secrecy but requires more computational resources.\nThis option only applies to server sockets.\n\nNew in version 3.3.\n\n-- Data: ssl.OPSINGLEECDHUSE\n\nPrevents re-use of the same ECDH key for distinct SSL sessions.\nThis improves forward secrecy but requires more computational\nresources.  This option only applies to server sockets.\n\nNew in version 3.3.\n\n-- Data: ssl.OPENABLEMIDDLEBOXCOMPAT\n\nSend dummy Change Cipher Spec (CCS) messages in TLS 1.3 handshake\nto make a TLS 1.3 connection look more like a TLS 1.2 connection.\n\nThis option is only available with OpenSSL 1.1.1 and later.\n\nNew in version 3.8.\n\n-- Data: ssl.OPNOCOMPRESSION\n\nDisable compression on the SSL channel.  This is useful if the\napplication protocol supports its own compression scheme.\n\nNew in version 3.3.\n\n-- Class: ssl.Options\n\n*note enum.IntFlag: 200b. collection of OP* constants.\n\n-- Data: ssl.OPNOTICKET\n\nPrevent client side from requesting a session ticket.\n\nNew in version 3.6.\n\n-- Data: ssl.OPIGNOREUNEXPECTEDEOF\n\nIgnore unexpected shutdown of TLS connections.\n\nThis option is only available with OpenSSL 3.0.0 and later.\n\nNew in version 3.10.\n\n-- Data: ssl.OPENABLEKTLS\n\nEnable the use of the kernel TLS. To benefit from the feature,\nOpenSSL must have been compiled with support for it, and the\nnegotiated cipher suites and extensions must be supported by it (a\nlist of supported ones may vary by platform and kernel version).\n\nNote that with enabled kernel TLS some cryptographic operations are\nperformed by the kernel directly and not via any available OpenSSL\nProviders.  This might be undesirable if, for example, the\napplication requires all cryptographic operations to be performed\nby the FIPS provider.\n\nThis option is only available with OpenSSL 3.0.0 and later.\n\nNew in version 3.12.\n\n-- Data: ssl.OPLEGACYSERVERCONNECT\n\nAllow legacy insecure renegotiation between OpenSSL and unpatched\nservers only.\n\nNew in version 3.12.\n\n-- Data: ssl.HASALPN\n\nWhether the OpenSSL library has built-in support for the\n'Application-Layer Protocol Negotiation' TLS extension as described\nin RFC 7301(1).\n\nNew in version 3.5.\n\n-- Data: ssl.HASNEVERCHECKCOMMONNAME\n\nWhether the OpenSSL library has built-in support not checking\nsubject common name and *note\nSSLContext.hostnamecheckscommonname: 9be. is writeable.\n\nNew in version 3.7.\n\n-- Data: ssl.HASECDH\n\nWhether the OpenSSL library has built-in support for the Elliptic\nCurve-based Diffie-Hellman key exchange.  This should be true\nunless the feature was explicitly disabled by the distributor.\n\nNew in version 3.3.\n\n-- Data: ssl.HASSNI\n\nWhether the OpenSSL library has built-in support for the 'Server\nName Indication' extension (as defined in RFC 6066(2)).\n\nNew in version 3.2.\n\n-- Data: ssl.HASNPN\n\nWhether the OpenSSL library has built-in support for the 'Next\nProtocol Negotiation' as described in the Application Layer\nProtocol Negotiation(3).  When true, you can use the *note\nSSLContext.setnpnprotocols(): 67e. method to advertise which\nprotocols you want to support.\n\nNew in version 3.3.\n\n-- Data: ssl.HASSSLv2\n\nWhether the OpenSSL library has built-in support for the SSL 2.0\nprotocol.\n\nNew in version 3.7.\n\n-- Data: ssl.HASSSLv3\n\nWhether the OpenSSL library has built-in support for the SSL 3.0\nprotocol.\n\nNew in version 3.7.\n\n-- Data: ssl.HASTLSv1\n\nWhether the OpenSSL library has built-in support for the TLS 1.0\nprotocol.\n\nNew in version 3.7.\n\n-- Data: ssl.HASTLSv11\n\nWhether the OpenSSL library has built-in support for the TLS 1.1\nprotocol.\n\nNew in version 3.7.\n\n-- Data: ssl.HASTLSv12\n\nWhether the OpenSSL library has built-in support for the TLS 1.2\nprotocol.\n\nNew in version 3.7.\n\n-- Data: ssl.HASTLSv13\n\nWhether the OpenSSL library has built-in support for the TLS 1.3\nprotocol.\n\nNew in version 3.7.\n\n-- Data: ssl.CHANNELBINDINGTYPES\n\nList of supported TLS channel binding types.  Strings in this list\ncan be used as arguments to *note SSLSocket.getchannelbinding():\nfb8.\n\nNew in version 3.3.\n\n-- Data: ssl.OPENSSLVERSION\n\nThe version string of the OpenSSL library loaded by the\ninterpreter:\n\n>>> ssl.OPENSSLVERSION\n'OpenSSL 1.0.2k  26 Jan 2017'\n\nNew in version 3.2.\n\n-- Data: ssl.OPENSSLVERSIONINFO\n\nA tuple of five integers representing version information about the\nOpenSSL library:\n\n>>> ssl.OPENSSLVERSIONINFO\n(1, 0, 2, 11, 15)\n\nNew in version 3.2.\n\n-- Data: ssl.OPENSSLVERSIONNUMBER\n\nThe raw version number of the OpenSSL library, as a single integer:\n\n>>> ssl.OPENSSLVERSIONNUMBER\n268443839\n>>> hex(ssl.OPENSSLVERSIONNUMBER)\n'0x100020bf'\n\nNew in version 3.2.\n\n-- Data: ssl.ALERTDESCRIPTIONHANDSHAKEFAILURE\n-- Data: ssl.ALERTDESCRIPTIONINTERNALERROR\n\n-- Data: ALERTDESCRIPTION*\n\nAlert Descriptions from RFC 5246(4) and others.  The IANA TLS Alert\nRegistry(5) contains this list and references to the RFCs where\ntheir meaning is defined.\n\nUsed as the return value of the callback function in *note\nSSLContext.setservernamecallback(): e26.\n\nNew in version 3.4.\n\n-- Class: ssl.AlertDescription\n\n*note enum.IntEnum: b2e. collection of ALERTDESCRIPTION*\nconstants.\n\nNew in version 3.6.\n\n-- Data: Purpose.SERVERAUTH\n\nOption for *note createdefaultcontext(): e17. and *note\nSSLContext.loaddefaultcerts(): e21.  This value indicates that\nthe context may be used to authenticate web servers (therefore, it\nwill be used to create client-side sockets).\n\nNew in version 3.4.\n\n-- Data: Purpose.CLIENTAUTH\n\nOption for *note createdefaultcontext(): e17. and *note\nSSLContext.loaddefaultcerts(): e21.  This value indicates that\nthe context may be used to authenticate web clients (therefore, it\nwill be used to create server-side sockets).\n\nNew in version 3.4.\n\n-- Class: ssl.SSLErrorNumber\n\n*note enum.IntEnum: b2e. collection of SSLERROR* constants.\n\nNew in version 3.6.\n\n-- Class: ssl.TLSVersion\n\n*note enum.IntEnum: b2e. collection of SSL and TLS versions for\n*note SSLContext.maximumversion: 9c5. and *note\nSSLContext.minimumversion: 9c4.\n\nNew in version 3.7.\n\n-- Attribute: TLSVersion.MINIMUMSUPPORTED\n\n-- Attribute: TLSVersion.MAXIMUMSUPPORTED\n\nThe minimum or maximum supported SSL or TLS version.  These are\nmagic constants.  Their values don't reflect the lowest and highest\navailable TLS/SSL versions.\n\n-- Attribute: TLSVersion.SSLv3\n\n-- Attribute: TLSVersion.TLSv1\n\n-- Attribute: TLSVersion.TLSv11\n\n-- Attribute: TLSVersion.TLSv12\n\n-- Attribute: TLSVersion.TLSv13\n\nSSL 3.0 to TLS 1.3.\n\nDeprecated since version 3.10: All *note TLSVersion: 30d3. members\nexcept *note TLSVersion.TLSv12: 30d9. and *note\nTLSVersion.TLSv13: 30da. are deprecated.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc7301.html\n\n(2) https://datatracker.ietf.org/doc/html/rfc6066.html\n\n(3)\nhttps://en.wikipedia.org/wiki/Application-LayerProtocolNegotiation\n\n(4) https://datatracker.ietf.org/doc/html/rfc5246.html\n\n(5)\nhttps://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-6\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: SSL Sockets,  Next: SSL Contexts,  Prev: Functions Constants and Exceptions,  Up: ssl -- TLS/SSL wrapper for socket objects": {
            "content": "5.18.3.8 SSL Sockets\n....................\n\n-- Class: ssl.SSLSocket (socket.socket)\n\nSSL sockets provide the following methods of *note Socket Objects:\n3088.:\n\n- *note accept(): bfe.\n\n- *note bind(): 1394.\n\n- *note close(): b9b.\n\n- *note connect(): bff.\n\n- *note detach(): 1091.\n\n- *note fileno(): 3097.\n\n- *note getpeername(): 2fde, *note getsockname(): 2fdf.\n\n- *note getsockopt(): b24, *note setsockopt(): b25.\n\n- *note gettimeout(): 3098, *note settimeout(): 3059, *note\nsetblocking(): 2836.\n\n- *note listen(): cc1.\n\n- *note makefile(): 1013.\n\n- *note recv(): c00, *note recvinto(): 1195. (but passing a\nnon-zero 'flags' argument is not allowed)\n\n- *note send(): c03, *note sendall(): c04. (with the same\nlimitation)\n\n- *note sendfile(): cc0. (but *note os.sendfile: 946. will be\nused for plain-text sockets only, else *note send(): c03. will\nbe used)\n\n- *note shutdown(): 3095.\n\nHowever, since the SSL (and TLS) protocol has its own framing atop\nof TCP, the SSL sockets abstraction can, in certain respects,\ndiverge from the specification of normal, OS-level sockets.  See\nespecially the *note notes on non-blocking sockets: 30ad.\n\nInstances of *note SSLSocket: 703. must be created using the *note\nSSLContext.wrapsocket(): 279. method.\n\nChanged in version 3.5: The 'sendfile()' method was added.\n\nChanged in version 3.5: The 'shutdown()' does not reset the socket\ntimeout each time bytes are received or sent.  The socket timeout\nis now the maximum total duration of the shutdown.\n\nDeprecated since version 3.6: It is deprecated to create a *note\nSSLSocket: 703. instance directly, use *note\nSSLContext.wrapsocket(): 279. to wrap a socket.\n\nChanged in version 3.7: *note SSLSocket: 703. instances must to\ncreated with *note wrapsocket(): 279.  In earlier versions, it was\npossible to create instances directly.  This was never documented\nor officially supported.\n\nChanged in version 3.10: Python now uses 'SSLreadex' and\n'SSLwriteex' internally.  The functions support reading and\nwriting of data larger than 2 GB. Writing zero-length data no\nlonger fails with a protocol violation error.\n\nSSL sockets also have the following additional methods and attributes:\n\n-- Method: SSLSocket.read (len=1024, buffer=None)\n\nRead up to 'len' bytes of data from the SSL socket and return the\nresult as a 'bytes' instance.  If 'buffer' is specified, then read\ninto the buffer instead, and return the number of bytes read.\n\nRaise *note SSLWantReadError: ccc. or *note SSLWantWriteError: ccd.\nif the socket is *note non-blocking: 30ad. and the read would\nblock.\n\nAs at any time a re-negotiation is possible, a call to *note\nread(): cd1. can also cause write operations.\n\nChanged in version 3.5: The socket timeout is no longer reset each\ntime bytes are received or sent.  The socket timeout is now the\nmaximum total duration to read up to 'len' bytes.\n\nDeprecated since version 3.6: Use 'recv()' instead of *note read():\ncd1.\n\n-- Method: SSLSocket.write (buf)\n\nWrite 'buf' to the SSL socket and return the number of bytes\nwritten.  The 'buf' argument must be an object supporting the\nbuffer interface.\n\nRaise *note SSLWantReadError: ccc. or *note SSLWantWriteError: ccd.\nif the socket is *note non-blocking: 30ad. and the write would\nblock.\n\nAs at any time a re-negotiation is possible, a call to *note\nwrite(): cd2. can also cause read operations.\n\nChanged in version 3.5: The socket timeout is no longer reset each\ntime bytes are received or sent.  The socket timeout is now the\nmaximum total duration to write 'buf'.\n\nDeprecated since version 3.6: Use 'send()' instead of *note\nwrite(): cd2.\n\nNote: The *note read(): cd1. and *note write(): cd2. methods are\nthe low-level methods that read and write unencrypted,\napplication-level data and decrypt/encrypt it to encrypted,\nwire-level data.  These methods require an active SSL connection,\ni.e.  the handshake was completed and *note SSLSocket.unwrap():\n30dc. was not called.\n\nNormally you should use the socket API methods like *note recv():\nc00. and *note send(): c03. instead of these methods.\n\n-- Method: SSLSocket.dohandshake ()\n\nPerform the SSL setup handshake.\n\nChanged in version 3.4: The handshake method also performs\n'matchhostname()' when the *note checkhostname: 30ba. attribute\nof the socket's *note context: 30dd. is true.\n\nChanged in version 3.5: The socket timeout is no longer reset each\ntime bytes are received or sent.  The socket timeout is now the\nmaximum total duration of the handshake.\n\nChanged in version 3.7: Hostname or IP address is matched by\nOpenSSL during handshake.  The function 'matchhostname()' is no\nlonger used.  In case OpenSSL refuses a hostname or IP address, the\nhandshake is aborted early and a TLS alert message is sent to the\npeer.\n\n-- Method: SSLSocket.getpeercert (binaryform=False)\n\nIf there is no certificate for the peer on the other end of the\nconnection, return 'None'.  If the SSL handshake hasn't been done\nyet, raise *note ValueError: 183.\n\nIf the 'binaryform' parameter is *note False: 971, and a\ncertificate was received from the peer, this method returns a *note\ndict: 237. instance.  If the certificate was not validated, the\ndict is empty.  If the certificate was validated, it returns a dict\nwith several keys, amongst them 'subject' (the principal for which\nthe certificate was issued) and 'issuer' (the principal issuing the\ncertificate).  If a certificate contains an instance of the\n'Subject Alternative Name' extension (see RFC 3280(1)), there will\nalso be a 'subjectAltName' key in the dictionary.\n\nThe 'subject' and 'issuer' fields are tuples containing the\nsequence of relative distinguished names (RDNs) given in the\ncertificate's data structure for the respective fields, and each\nRDN is a sequence of name-value pairs.  Here is a real-world\nexample:\n\n{'issuer': ((('countryName', 'IL'),),\n(('organizationName', 'StartCom Ltd.'),),\n(('organizationalUnitName',\n'Secure Digital Certificate Signing'),),\n(('commonName',\n'StartCom Class 2 Primary Intermediate Server CA'),)),\n'notAfter': 'Nov 22 08:15:19 2013 GMT',\n'notBefore': 'Nov 21 03:09:52 2011 GMT',\n'serialNumber': '95F0',\n'subject': ((('description', '571208-SLe257oHY9fVQ07Z'),),\n(('countryName', 'US'),),\n(('stateOrProvinceName', 'California'),),\n(('localityName', 'San Francisco'),),\n(('organizationName', 'Electronic Frontier Foundation, Inc.'),),\n(('commonName', '*.eff.org'),),\n(('emailAddress', 'hostmaster@eff.org'),)),\n'subjectAltName': (('DNS', '*.eff.org'), ('DNS', 'eff.org')),\n'version': 3}\n\nIf the 'binaryform' parameter is *note True: a53, and a\ncertificate was provided, this method returns the DER-encoded form\nof the entire certificate as a sequence of bytes, or *note None:\n43f. if the peer did not provide a certificate.  Whether the peer\nprovides a certificate depends on the SSL socket's role:\n\n* for a client SSL socket, the server will always provide a\ncertificate, regardless of whether validation was required;\n\n* for a server SSL socket, the client will only provide a\ncertificate when requested by the server; therefore *note\ngetpeercert(): e27. will return *note None: 43f. if you used\n*note CERTNONE: 30b8. (rather than *note CERTOPTIONAL: 30b9.\nor *note CERTREQUIRED: 30a9.).\n\nSee also *note SSLContext.checkhostname: 30ba.\n\nChanged in version 3.2: The returned dictionary includes additional\nitems such as 'issuer' and 'notBefore'.\n\nChanged in version 3.4: *note ValueError: 183. is raised when the\nhandshake isn't done.  The returned dictionary includes additional\nX509v3 extension items such as 'crlDistributionPoints', 'caIssuers'\nand 'OCSP' URIs.\n\nChanged in version 3.9: IPv6 address strings no longer have a\ntrailing new line.\n\n-- Method: SSLSocket.cipher ()\n\nReturns a three-value tuple containing the name of the cipher being\nused, the version of the SSL protocol that defines its use, and the\nnumber of secret bits being used.  If no connection has been\nestablished, returns 'None'.\n\n-- Method: SSLSocket.sharedciphers ()\n\nReturn the list of ciphers available in both the client and server.\nEach entry of the returned list is a three-value tuple containing\nthe name of the cipher, the version of the SSL protocol that\ndefines its use, and the number of secret bits the cipher uses.\n*note sharedciphers(): ccf. returns 'None' if no connection has\nbeen established or the socket is a client socket.\n\nNew in version 3.5.\n\n-- Method: SSLSocket.compression ()\n\nReturn the compression algorithm being used as a string, or 'None'\nif the connection isn't compressed.\n\nIf the higher-level protocol supports its own compression\nmechanism, you can use *note OPNOCOMPRESSION: fba. to disable\nSSL-level compression.\n\nNew in version 3.3.\n\n-- Method: SSLSocket.getchannelbinding (cbtype='tls-unique')\n\nGet channel binding data for current connection, as a bytes object.\nReturns 'None' if not connected or the handshake has not been\ncompleted.\n\nThe 'cbtype' parameter allow selection of the desired channel\nbinding type.  Valid channel binding types are listed in the *note\nCHANNELBINDINGTYPES: 30ce. list.  Currently only the 'tls-unique'\nchannel binding, defined by RFC 5929(2), is supported.  *note\nValueError: 183. will be raised if an unsupported channel binding\ntype is requested.\n\nNew in version 3.3.\n\n-- Method: SSLSocket.selectedalpnprotocol ()\n\nReturn the protocol that was selected during the TLS handshake.  If\n*note SSLContext.setalpnprotocols(): cc7. was not called, if the\nother party does not support ALPN, if this socket does not support\nany of the client's proposed protocols, or if the handshake has not\nhappened yet, 'None' is returned.\n\nNew in version 3.5.\n\n-- Method: SSLSocket.selectednpnprotocol ()\n\nReturn the higher-level protocol that was selected during the\nTLS/SSL handshake.  If *note SSLContext.setnpnprotocols(): 67e.\nwas not called, or if the other party does not support NPN, or if\nthe handshake has not yet happened, this will return 'None'.\n\nNew in version 3.3.\n\nDeprecated since version 3.10: NPN has been superseded by ALPN\n\n-- Method: SSLSocket.unwrap ()\n\nPerforms the SSL shutdown handshake, which removes the TLS layer\nfrom the underlying socket, and returns the underlying socket\nobject.  This can be used to go from encrypted operation over a\nconnection to unencrypted.  The returned socket should always be\nused for further communication with the other side of the\nconnection, rather than the original socket.\n\n-- Method: SSLSocket.verifyclientposthandshake ()\n\nRequests post-handshake authentication (PHA) from a TLS 1.3 client.\nPHA can only be initiated for a TLS 1.3 connection from a\nserver-side socket, after the initial TLS handshake and with PHA\nenabled on both sides, see *note SSLContext.posthandshakeauth:\n85c.\n\nThe method does not perform a cert exchange immediately.  The\nserver-side sends a CertificateRequest during the next write event\nand expects the client to respond with a certificate on the next\nread event.\n\nIf any precondition isn't met (e.g.  not TLS 1.3, PHA not enabled),\nan *note SSLError: 10f2. is raised.\n\nNote: Only available with OpenSSL 1.1.1 and TLS 1.3 enabled.\nWithout TLS 1.3 support, the method raises *note\nNotImplementedError: ba5.\n\nNew in version 3.8.\n\n-- Method: SSLSocket.version ()\n\nReturn the actual SSL protocol version negotiated by the connection\nas a string, or 'None' if no secure connection is established.  As\nof this writing, possible return values include '\"SSLv2\"',\n'\"SSLv3\"', '\"TLSv1\"', '\"TLSv1.1\"' and '\"TLSv1.2\"'.  Recent OpenSSL\nversions may define more return values.\n\nNew in version 3.5.\n\n-- Method: SSLSocket.pending ()\n\nReturns the number of already decrypted bytes available for read,\npending on the connection.\n\n-- Attribute: SSLSocket.context\n\nThe *note SSLContext: 278. object this SSL socket is tied to.\n\nNew in version 3.2.\n\n-- Attribute: SSLSocket.serverside\n\nA boolean which is 'True' for server-side sockets and 'False' for\nclient-side sockets.\n\nNew in version 3.2.\n\n-- Attribute: SSLSocket.serverhostname\n\nHostname of the server: *note str: 157. type, or 'None' for\nserver-side socket or if the hostname was not specified in the\nconstructor.\n\nNew in version 3.2.\n\nChanged in version 3.7: The attribute is now always ASCII text.\nWhen 'serverhostname' is an internationalized domain name (IDN),\nthis attribute now stores the A-label form ('\"xn--pythn-mua.org\"'),\nrather than the U-label form ('\"pytho\"n.org\"').\n\n-- Attribute: SSLSocket.session\n\nThe *note SSLSession: b2c. for this SSL connection.  The session is\navailable for client and server side sockets after the TLS\nhandshake has been performed.  For client sockets the session can\nbe set before *note dohandshake(): cd0. has been called to reuse a\nsession.\n\nNew in version 3.6.\n\n-- Attribute: SSLSocket.sessionreused\n\nNew in version 3.6.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc3280.html\n\n(2) https://datatracker.ietf.org/doc/html/rfc5929.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: SSL Contexts,  Next: Certificates,  Prev: SSL Sockets,  Up: ssl -- TLS/SSL wrapper for socket objects": {
            "content": "5.18.3.9 SSL Contexts\n.....................\n\nNew in version 3.2.\n",
            "subsections": []
        },
        "An SSL context holds various data longer-lived than single SSL": {
            "content": "connections, such as SSL configuration options, certificate(s) and\nprivate key(s).  It also manages a cache of SSL sessions for server-side\nsockets, in order to speed up repeated connections from the same\nclients.\n\n-- Class: ssl.SSLContext (protocol=None)\n\nCreate a new SSL context.  You may pass 'protocol' which must be\none of the 'PROTOCOL*' constants defined in this module.  The\nparameter specifies which version of the SSL protocol to use.\nTypically, the server chooses a particular protocol version, and\nthe client must adapt to the server's choice.  Most of the versions\nare not interoperable with the other versions.  If not specified,\nthe default is *note PROTOCOLTLS: 67a.; it provides the most\ncompatibility with other versions.\n\nHere's a table showing which versions in a client (down the side)\ncan connect to which versions in a server (along the top):\n\n'client' / 'server'          'SSLv2'          'SSLv3'          'TLS' (1)         'TLSv1'       'TLSv1.1'       'TLSv1.2'\n\n\n'SSLv2'                      yes              no               no (2)            no            no              no\n\n\n'SSLv3'                      no               yes              no (3)            no            no              no\n\n\n'TLS' ('SSLv23') (4)         no (5)           no (6)           yes               yes           yes             yes\n\n\n'TLSv1'                      no               no               yes               yes           no              no\n\n\n'TLSv1.1'                    no               no               yes               no            yes             no\n\n\n'TLSv1.2'                    no               no               yes               no            no              yes\n\n\nSee also\n........\n\n*note createdefaultcontext(): e17. lets the *note ssl: ca. module\nchoose security settings for a given purpose.\n\nChanged in version 3.6: The context is created with secure default\nvalues.  The options *note OPNOCOMPRESSION: fba, *note\nOPCIPHERSERVERPREFERENCE: fbd, *note OPSINGLEDHUSE: 30c0,\n*note OPSINGLEECDHUSE: 30c1, *note OPNOSSLv2: 62e, and *note\nOPNOSSLv3: 62f. (except for *note PROTOCOLSSLv3: 675.) are set\nby default.  The initial cipher suite list contains only 'HIGH'\nciphers, no 'NULL' ciphers and no 'MD5' ciphers.\n\nDeprecated since version 3.10: *note SSLContext: 278. without\nprotocol argument is deprecated.  The context class will either\nrequire *note PROTOCOLTLSCLIENT: 67b. or *note\nPROTOCOLTLSSERVER: 67c. protocol in the future.\n\nChanged in version 3.10: The default cipher suites now include only\nsecure AES and ChaCha20 ciphers with forward secrecy and security\nlevel 2.  RSA and DH keys with less than 2048 bits and ECC keys\nwith less than 224 bits are prohibited.  *note PROTOCOLTLS: 67a,\n*note PROTOCOLTLSCLIENT: 67b, and *note PROTOCOLTLSSERVER: 67c.\nuse TLS 1.2 as minimum TLS version.\n\n*note SSLContext: 278. objects have the following methods and\nattributes:\n\n-- Method: SSLContext.certstorestats ()\n\nGet statistics about quantities of loaded X.509 certificates, count\nof X.509 certificates flagged as CA certificates and certificate\nrevocation lists as dictionary.\n\nExample for a context with one CA cert and one other cert:\n\n>>> context.certstorestats()\n{'crl': 0, 'x509ca': 1, 'x509': 2}\n\nNew in version 3.4.\n\n-- Method: SSLContext.loadcertchain (certfile, keyfile=None,\npassword=None)\n\nLoad a private key and the corresponding certificate.  The\n'certfile' string must be the path to a single file in PEM format\ncontaining the certificate as well as any number of CA certificates\nneeded to establish the certificate's authenticity.  The 'keyfile'\nstring, if present, must point to a file containing the private\nkey.  Otherwise the private key will be taken from 'certfile' as\nwell.  See the discussion of *note Certificates: 30e3. for more\ninformation on how the certificate is stored in the 'certfile'.\n\nThe 'password' argument may be a function to call to get the\npassword for decrypting the private key.  It will only be called if\nthe private key is encrypted and a password is necessary.  It will\nbe called with no arguments, and it should return a string, bytes,\nor bytearray.  If the return value is a string it will be encoded\nas UTF-8 before using it to decrypt the key.  Alternatively a\nstring, bytes, or bytearray value may be supplied directly as the\n'password' argument.  It will be ignored if the private key is not\nencrypted and no password is needed.\n\nIf the 'password' argument is not specified and a password is\nrequired, OpenSSL's built-in password prompting mechanism will be\nused to interactively prompt the user for a password.\n\nAn *note SSLError: 10f2. is raised if the private key doesn't match\nwith the certificate.\n\nChanged in version 3.3: New optional argument 'password'.\n\n-- Method: SSLContext.loaddefaultcerts (purpose=Purpose.SERVERAUTH)\n\nLoad a set of default \"certification authority\" (CA) certificates\nfrom default locations.  On Windows it loads CA certs from the 'CA'\nand 'ROOT' system stores.  On all systems it calls *note\nSSLContext.setdefaultverifypaths(): e19.  In the future the\nmethod may load CA certificates from other locations, too.\n\nThe 'purpose' flag specifies what kind of CA certificates are\nloaded.  The default settings *note Purpose.SERVERAUTH: e22. loads\ncertificates, that are flagged and trusted for TLS web server\nauthentication (client side sockets).  *note Purpose.CLIENTAUTH:\ne23. loads CA certificates for client certificate verification on\nthe server side.\n\nNew in version 3.4.\n\n-- Method: SSLContext.loadverifylocations (cafile=None, capath=None,\ncadata=None)\n\nLoad a set of \"certification authority\" (CA) certificates used to\nvalidate other peers' certificates when *note verifymode: 30a8. is\nother than *note CERTNONE: 30b8.  At least one of 'cafile' or\n'capath' must be specified.\n\nThis method can also load certification revocation lists (CRLs) in\nPEM or DER format.  In order to make use of CRLs, *note\nSSLContext.verifyflags: e1c. must be configured properly.\n\nThe 'cafile' string, if present, is the path to a file of\nconcatenated CA certificates in PEM format.  See the discussion of\n*note Certificates: 30e3. for more information about how to arrange\nthe certificates in this file.\n\nThe 'capath' string, if present, is the path to a directory\ncontaining several CA certificates in PEM format, following an\nOpenSSL specific layout(7).\n\nThe 'cadata' object, if present, is either an ASCII string of one\nor more PEM-encoded certificates or a *note bytes-like object: b82.\nof DER-encoded certificates.  Like with 'capath' extra lines around\nPEM-encoded certificates are ignored but at least one certificate\nmust be present.\n\nChanged in version 3.4: New optional argument 'cadata'\n\n-- Method: SSLContext.getcacerts (binaryform=False)\n\nGet a list of loaded \"certification authority\" (CA) certificates.\nIf the 'binaryform' parameter is *note False: 971. each list entry\nis a dict like the output of *note SSLSocket.getpeercert(): e27.\nOtherwise the method returns a list of DER-encoded certificates.\nThe returned list does not contain certificates from 'capath'\nunless a certificate was requested and loaded by a SSL connection.\n\nNote: Certificates in a capath directory aren't loaded unless\nthey have been used at least once.\n\nNew in version 3.4.\n\n-- Method: SSLContext.getciphers ()\n\nGet a list of enabled ciphers.  The list is in order of cipher\npriority.  See *note SSLContext.setciphers(): 30e4.\n\nExample:\n\n>>> ctx = ssl.SSLContext(ssl.PROTOCOLSSLv23)\n>>> ctx.setciphers('ECDHE+AESGCM:!ECDSA')\n>>> ctx.getciphers()\n[{'aead': True,\n'algbits': 256,\n'auth': 'auth-rsa',\n'description': 'ECDHE-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH     Au=RSA  '\n'Enc=AESGCM(256) Mac=AEAD',\n'digest': None,\n'id': 50380848,\n'kea': 'kx-ecdhe',\n'name': 'ECDHE-RSA-AES256-GCM-SHA384',\n'protocol': 'TLSv1.2',\n'strengthbits': 256,\n'symmetric': 'aes-256-gcm'},\n{'aead': True,\n'algbits': 128,\n'auth': 'auth-rsa',\n'description': 'ECDHE-RSA-AES128-GCM-SHA256 TLSv1.2 Kx=ECDH     Au=RSA  '\n'Enc=AESGCM(128) Mac=AEAD',\n'digest': None,\n'id': 50380847,\n'kea': 'kx-ecdhe',\n'name': 'ECDHE-RSA-AES128-GCM-SHA256',\n'protocol': 'TLSv1.2',\n'strengthbits': 128,\n'symmetric': 'aes-128-gcm'}]\n\nNew in version 3.6.\n\n-- Method: SSLContext.setdefaultverifypaths ()\n\nLoad a set of default \"certification authority\" (CA) certificates\nfrom a filesystem path defined when building the OpenSSL library.\nUnfortunately, there's no easy way to know whether this method\nsucceeds: no error is returned if no certificates are to be found.\nWhen the OpenSSL library is provided as part of the operating\nsystem, though, it is likely to be configured properly.\n\n-- Method: SSLContext.setciphers (ciphers)\n\nSet the available ciphers for sockets created with this context.\nIt should be a string in the OpenSSL cipher list format(8).  If no\ncipher can be selected (because compile-time options or other\nconfiguration forbids use of all the specified ciphers), an *note\nSSLError: 10f2. will be raised.\n\nNote: when connected, the *note SSLSocket.cipher(): 2fe0.\nmethod of SSL sockets will give the currently selected cipher.\n\nTLS 1.3 cipher suites cannot be disabled with *note\nsetciphers(): 30e4.\n\n-- Method: SSLContext.setalpnprotocols (protocols)\n\nSpecify which protocols the socket should advertise during the\nSSL/TLS handshake.  It should be a list of ASCII strings, like\n'['http/1.1', 'spdy/2']', ordered by preference.  The selection of\na protocol will happen during the handshake, and will play out\naccording to RFC 7301(9).  After a successful handshake, the *note\nSSLSocket.selectedalpnprotocol(): cc8. method will return the\nagreed-upon protocol.\n\nThis method will raise *note NotImplementedError: ba5. if *note\nHASALPN: cc9. is 'False'.\n\nNew in version 3.5.\n\n-- Method: SSLContext.setnpnprotocols (protocols)\n\nSpecify which protocols the socket should advertise during the\nSSL/TLS handshake.  It should be a list of strings, like\n'['http/1.1', 'spdy/2']', ordered by preference.  The selection of\na protocol will happen during the handshake, and will play out\naccording to the Application Layer Protocol Negotiation(10).  After\na successful handshake, the *note\nSSLSocket.selectednpnprotocol(): 67d. method will return the\nagreed-upon protocol.\n\nThis method will raise *note NotImplementedError: ba5. if *note\nHASNPN: 30c8. is 'False'.\n\nNew in version 3.3.\n\nDeprecated since version 3.10: NPN has been superseded by ALPN\n\n-- Attribute: SSLContext.snicallback\n\nRegister a callback function that will be called after the TLS\nClient Hello handshake message has been received by the SSL/TLS\nserver when the TLS client specifies a server name indication.  The\nserver name indication mechanism is specified in RFC 6066(11)\nsection 3 - Server Name Indication.\n\nOnly one callback can be set per 'SSLContext'.  If 'snicallback'\nis set to 'None' then the callback is disabled.  Calling this\nfunction a subsequent time will disable the previously registered\ncallback.\n\nThe callback function will be called with three arguments; the\nfirst being the *note ssl.SSLSocket: 703, the second is a string\nthat represents the server name that the client is intending to\ncommunicate (or *note None: 43f. if the TLS Client Hello does not\ncontain a server name) and the third argument is the original *note\nSSLContext: 278.  The server name argument is text.  For\ninternationalized domain name, the server name is an IDN A-label\n('\"xn--pythn-mua.org\"').\n\nA typical use of this callback is to change the *note\nssl.SSLSocket: 703.'s *note SSLSocket.context: 30dd. attribute to a\nnew object of type *note SSLContext: 278. representing a\ncertificate chain that matches the server name.\n\nDue to the early negotiation phase of the TLS connection, only\nlimited methods and attributes are usable like *note\nSSLSocket.selectedalpnprotocol(): cc8. and *note\nSSLSocket.context: 30dd.  The *note SSLSocket.getpeercert(): e27,\n*note SSLSocket.cipher(): 2fe0. and *note SSLSocket.compression():\nfb9. methods require that the TLS connection has progressed beyond\nthe TLS Client Hello and therefore will not return meaningful\nvalues nor can they be called safely.\n\nThe 'snicallback' function must return 'None' to allow the TLS\nnegotiation to continue.  If a TLS failure is required, a constant\n*note ALERTDESCRIPTION*: 30d0. can be returned.  Other return\nvalues will result in a TLS fatal error with *note\nALERTDESCRIPTIONINTERNALERROR: 30d0.\n\nIf an exception is raised from the 'snicallback' function the TLS\nconnection will terminate with a fatal TLS alert message *note\nALERTDESCRIPTIONHANDSHAKEFAILURE: 30cf.\n\nThis method will raise *note NotImplementedError: ba5. if the\nOpenSSL library had OPENSSLNOTLSEXT defined when it was built.\n\nNew in version 3.7.\n\n-- Attribute: SSLContext.setservernamecallback (servernamecallback)\n\nThis is a legacy API retained for backwards compatibility.  When\npossible, you should use *note snicallback: 163a. instead.  The\ngiven 'servernamecallback' is similar to 'snicallback', except\nthat when the server hostname is an IDN-encoded internationalized\ndomain name, the 'servernamecallback' receives a decoded U-label\n('\"pytho\"n.org\"').\n\nIf there is an decoding error on the server name, the TLS\nconnection will terminate with an *note\nALERTDESCRIPTIONINTERNALERROR: 30d0. fatal TLS alert message to\nthe client.\n\nNew in version 3.4.\n\n-- Method: SSLContext.loaddhparams (dhfile)\n\nLoad the key generation parameters for Diffie-Hellman (DH) key\nexchange.  Using DH key exchange improves forward secrecy at the\nexpense of computational resources (both on the server and on the\nclient).  The 'dhfile' parameter should be the path to a file\ncontaining DH parameters in PEM format.\n\nThis setting doesn't apply to client sockets.  You can also use the\n*note OPSINGLEDHUSE: 30c0. option to further improve security.\n\nNew in version 3.3.\n\n-- Method: SSLContext.setecdhcurve (curvename)\n\nSet the curve name for Elliptic Curve-based Diffie-Hellman (ECDH)\nkey exchange.  ECDH is significantly faster than regular DH while\narguably as secure.  The 'curvename' parameter should be a string\ndescribing a well-known elliptic curve, for example 'prime256v1'\nfor a widely supported curve.\n\nThis setting doesn't apply to client sockets.  You can also use the\n*note OPSINGLEECDHUSE: 30c1. option to further improve security.\n\nThis method is not available if *note HASECDH: 30c6. is 'False'.\n\nNew in version 3.3.\n\nSee also\n........\n\nSSL/TLS & Perfect Forward Secrecy(12)\n\nVincent Bernat.\n\n-- Method: SSLContext.wrapsocket (sock, serverside=False,\ndohandshakeonconnect=True, suppressraggedeofs=True,\nserverhostname=None, session=None)\n\nWrap an existing Python socket 'sock' and return an instance of\n*note SSLContext.sslsocketclass: 30e5. (default *note SSLSocket:\n703.).  The returned SSL socket is tied to the context, its\nsettings and certificates.  'sock' must be a *note SOCKSTREAM:\n1168. socket; other socket types are unsupported.\n\nThe parameter 'serverside' is a boolean which identifies whether\nserver-side or client-side behavior is desired from this socket.\n\nFor client-side sockets, the context construction is lazy; if the\nunderlying socket isn't connected yet, the context construction\nwill be performed after 'connect()' is called on the socket.  For\nserver-side sockets, if the socket has no remote peer, it is\nassumed to be a listening socket, and the server-side SSL wrapping\nis automatically performed on client connections accepted via the\n'accept()' method.  The method may raise *note SSLError: 10f2.\n\nOn client connections, the optional parameter 'serverhostname'\nspecifies the hostname of the service which we are connecting to.\nThis allows a single server to host multiple SSL-based services\nwith distinct certificates, quite similarly to HTTP virtual hosts.\nSpecifying 'serverhostname' will raise a *note ValueError: 183. if\n'serverside' is true.\n\nThe parameter 'dohandshakeonconnect' specifies whether to do the\nSSL handshake automatically after doing a 'socket.connect()', or\nwhether the application program will call it explicitly, by\ninvoking the *note SSLSocket.dohandshake(): cd0. method.  Calling\n*note SSLSocket.dohandshake(): cd0. explicitly gives the program\ncontrol over the blocking behavior of the socket I/O involved in\nthe handshake.\n\nThe parameter 'suppressraggedeofs' specifies how the\n'SSLSocket.recv()' method should signal unexpected EOF from the\nother end of the connection.  If specified as *note True: a53. (the\ndefault), it returns a normal EOF (an empty bytes object) in\nresponse to unexpected EOF errors raised from the underlying\nsocket; if *note False: 971, it will raise the exceptions back to\nthe caller.\n\n'session', see *note session: 30e0.\n\nTo wrap an *note SSLSocket: 703. in another *note SSLSocket: 703,\nuse *note SSLContext.wrapbio(): 9c3.\n\nChanged in version 3.5: Always allow a serverhostname to be\npassed, even if OpenSSL does not have SNI.\n\nChanged in version 3.6: 'session' argument was added.\n\nChanged in version 3.7: The method returns an instance of *note\nSSLContext.sslsocketclass: 30e5. instead of hard-coded *note\nSSLSocket: 703.\n\n-- Attribute: SSLContext.sslsocketclass\n\nThe return type of *note SSLContext.wrapsocket(): 279, defaults to\n*note SSLSocket: 703.  The attribute can be overridden on instance\nof class in order to return a custom subclass of *note SSLSocket:\n703.\n\nNew in version 3.7.\n\n-- Method: SSLContext.wrapbio (incoming, outgoing, serverside=False,\nserverhostname=None, session=None)\n\nWrap the BIO objects 'incoming' and 'outgoing' and return an\ninstance of *note SSLContext.sslobjectclass: 30e6. (default *note\nSSLObject: 9c2.).  The SSL routines will read input data from the\nincoming BIO and write data to the outgoing BIO.\n\nThe 'serverside', 'serverhostname' and 'session' parameters have\nthe same meaning as in *note SSLContext.wrapsocket(): 279.\n\nChanged in version 3.6: 'session' argument was added.\n\nChanged in version 3.7: The method returns an instance of *note\nSSLContext.sslobjectclass: 30e6. instead of hard-coded *note\nSSLObject: 9c2.\n\n-- Attribute: SSLContext.sslobjectclass\n\nThe return type of *note SSLContext.wrapbio(): 9c3, defaults to\n*note SSLObject: 9c2.  The attribute can be overridden on instance\nof class in order to return a custom subclass of *note SSLObject:\n9c2.\n\nNew in version 3.7.\n\n-- Method: SSLContext.sessionstats ()\n\nGet statistics about the SSL sessions created or managed by this\ncontext.  A dictionary is returned which maps the names of each\npiece of information(13) to their numeric values.  For example,\nhere is the total number of hits and misses in the session cache\nsince the context was created:\n\n>>> stats = context.sessionstats()\n>>> stats['hits'], stats['misses']\n(0, 0)\n\n-- Attribute: SSLContext.checkhostname\n\nWhether to match the peer cert's hostname in *note\nSSLSocket.dohandshake(): cd0.  The context's *note verifymode:\n30a8. must be set to *note CERTOPTIONAL: 30b9. or *note\nCERTREQUIRED: 30a9, and you must pass 'serverhostname' to *note\nwrapsocket(): 279. in order to match the hostname.  Enabling\nhostname checking automatically sets *note verifymode: 30a8. from\n*note CERTNONE: 30b8. to *note CERTREQUIRED: 30a9.  It cannot be\nset back to *note CERTNONE: 30b8. as long as hostname checking is\nenabled.  The *note PROTOCOLTLSCLIENT: 67b. protocol enables\nhostname checking by default.  With other protocols, hostname\nchecking must be enabled explicitly.\n\nExample:\n\nimport socket, ssl\n\ncontext = ssl.SSLContext(ssl.PROTOCOLTLSv12)\ncontext.verifymode = ssl.CERTREQUIRED\ncontext.checkhostname = True\ncontext.loaddefaultcerts()\n\ns = socket.socket(socket.AFINET, socket.SOCKSTREAM)\nsslsock = context.wrapsocket(s, serverhostname='www.verisign.com')\nsslsock.connect(('www.verisign.com', 443))\n\nNew in version 3.4.\n\nChanged in version 3.7: *note verifymode: 30a8. is now\nautomatically changed to *note CERTREQUIRED: 30a9. when hostname\nchecking is enabled and *note verifymode: 30a8. is *note\nCERTNONE: 30b8.  Previously the same operation would have failed\nwith a *note ValueError: 183.\n\n-- Attribute: SSLContext.keylogfilename\n\nWrite TLS keys to a keylog file, whenever key material is generated\nor received.  The keylog file is designed for debugging purposes\nonly.  The file format is specified by NSS and used by many traffic\nanalyzers such as Wireshark.  The log file is opened in append-only\nmode.  Writes are synchronized between threads, but not between\nprocesses.\n\nNew in version 3.8.\n\n-- Attribute: SSLContext.maximumversion\n\nA *note TLSVersion: 30d3. enum member representing the highest\nsupported TLS version.  The value defaults to *note\nTLSVersion.MAXIMUMSUPPORTED: 30d5.  The attribute is read-only for\nprotocols other than *note PROTOCOLTLS: 67a, *note\nPROTOCOLTLSCLIENT: 67b, and *note PROTOCOLTLSSERVER: 67c.\n\nThe attributes *note maximumversion: 9c5, *note minimumversion:\n9c4. and *note SSLContext.options: 62d. all affect the supported\nSSL and TLS versions of the context.  The implementation does not\nprevent invalid combination.  For example a context with *note\nOPNOTLSv12: 673. in *note options: 62d. and *note\nmaximumversion: 9c5. set to *note TLSVersion.TLSv12: 30d9. will\nnot be able to establish a TLS 1.2 connection.\n\nNew in version 3.7.\n\n-- Attribute: SSLContext.minimumversion\n\nLike *note SSLContext.maximumversion: 9c5. except it is the lowest\nsupported version or *note TLSVersion.MINIMUMSUPPORTED: 30d4.\n\nNew in version 3.7.\n\n-- Attribute: SSLContext.numtickets\n\nControl the number of TLS 1.3 session tickets of a *note\nPROTOCOLTLSSERVER: 67c. context.  The setting has no impact on\nTLS 1.0 to 1.2 connections.\n\nNew in version 3.8.\n\n-- Attribute: SSLContext.options\n\nAn integer representing the set of SSL options enabled on this\ncontext.  The default value is *note OPALL: 30be, but you can\nspecify other options such as *note OPNOSSLv2: 62e. by ORing them\ntogether.\n\nChanged in version 3.6: *note SSLContext.options: 62d. returns\n*note Options: 30c3. flags:\n\n>>> ssl.createdefaultcontext().options\n<Options.OPALL|OPNOSSLv3|OPNOSSLv2|OPNOCOMPRESSION: 2197947391>\n\nDeprecated since version 3.7: All 'OPNOSSL*' and 'OPNOTLS*'\noptions have been deprecated since Python 3.7.  Use *note\nSSLContext.minimumversion: 9c4. and *note\nSSLContext.maximumversion: 9c5. instead.\n\n-- Attribute: SSLContext.posthandshakeauth\n\nEnable TLS 1.3 post-handshake client authentication.\nPost-handshake auth is disabled by default and a server can only\nrequest a TLS client certificate during the initial handshake.\nWhen enabled, a server may request a TLS client certificate at any\ntime after the handshake.\n\nWhen enabled on client-side sockets, the client signals the server\nthat it supports post-handshake authentication.\n\nWhen enabled on server-side sockets, *note SSLContext.verifymode:\n30a8. must be set to *note CERTOPTIONAL: 30b9. or *note\nCERTREQUIRED: 30a9, too.  The actual client cert exchange is\ndelayed until *note SSLSocket.verifyclientposthandshake(): 85d.\nis called and some I/O is performed.\n\nNew in version 3.8.\n\n-- Attribute: SSLContext.protocol\n\nThe protocol version chosen when constructing the context.  This\nattribute is read-only.\n\n-- Attribute: SSLContext.hostnamecheckscommonname\n\nWhether *note checkhostname: 30ba. falls back to verify the cert's\nsubject common name in the absence of a subject alternative name\nextension (default: true).\n\nNew in version 3.7.\n\nChanged in version 3.10: The flag had no effect with OpenSSL before\nversion 1.1.1l.  Python 3.8.9, 3.9.3, and 3.10 include workarounds\nfor previous versions.\n\n-- Attribute: SSLContext.securitylevel\n\nAn integer representing the security level(14) for the context.\nThis attribute is read-only.\n\nNew in version 3.10.\n\n-- Attribute: SSLContext.verifyflags\n\nThe flags for certificate verification operations.  You can set\nflags like *note VERIFYCRLCHECKLEAF: e1e. by ORing them\ntogether.  By default OpenSSL does neither require nor verify\ncertificate revocation lists (CRLs).\n\nNew in version 3.4.\n\nChanged in version 3.6: *note SSLContext.verifyflags: e1c. returns\n*note VerifyFlags: 30bd. flags:\n\n>>> ssl.createdefaultcontext().verifyflags\n<VerifyFlags.VERIFYX509TRUSTEDFIRST: 32768>\n\n-- Attribute: SSLContext.verifymode\n\nWhether to try to verify other peers' certificates and how to\nbehave if verification fails.  This attribute must be one of *note\nCERTNONE: 30b8, *note CERTOPTIONAL: 30b9. or *note CERTREQUIRED:\n30a9.\n\nChanged in version 3.6: *note SSLContext.verifymode: 30a8. returns\n*note VerifyMode: 30bb. enum:\n\n>>> ssl.createdefaultcontext().verifymode\n<VerifyMode.CERTREQUIRED: 2>\n\n---------- Footnotes ----------\n\n(1) TLS 1.3 protocol will be available with *note PROTOCOLTLS: 67a.\nin OpenSSL >= 1.1.1.  There is no dedicated PROTOCOL constant for just\nTLS 1.3.\n\n(2) *note SSLContext: 278. disables SSLv2 with *note OPNOSSLv2:\n62e. by default.\n\n(3) *note SSLContext: 278. disables SSLv3 with *note OPNOSSLv3:\n62f. by default.\n\n(4) TLS 1.3 protocol will be available with *note PROTOCOLTLS: 67a.\nin OpenSSL >= 1.1.1.  There is no dedicated PROTOCOL constant for just\nTLS 1.3.\n\n(5) *note SSLContext: 278. disables SSLv2 with *note OPNOSSLv2:\n62e. by default.\n\n(6) *note SSLContext: 278. disables SSLv3 with *note OPNOSSLv3:\n62f. by default.\n\n(7)\nhttps://www.openssl.org/docs/manmaster/man3/SSLCTXloadverifylocations.html\n\n(8) https://www.openssl.org/docs/manmaster/man1/ciphers.html\n\n(9) https://datatracker.ietf.org/doc/html/rfc7301.html\n\n(10)\nhttps://en.wikipedia.org/wiki/Application-LayerProtocolNegotiation\n\n(11) https://datatracker.ietf.org/doc/html/rfc6066.html\n\n(12)\nhttps://vincent.bernat.ch/en/blog/2011-ssl-perfect-forward-secrecy\n\n(13)\nhttps://www.openssl.org/docs/man1.1.1/man3/SSLCTXsessnumber.html\n\n(14)\nhttps://www.openssl.org/docs/manmaster/man3/SSLCTXgetsecuritylevel.html\n\nFile: python3.12.info,  Node: Certificates,  Next: Examples<19>,  Prev: SSL Contexts,  Up: ssl -- TLS/SSL wrapper for socket objects\n\n5.18.3.10 Certificates\n......................\n\nCertificates in general are part of a public-key / private-key system.",
            "subsections": []
        },
        "In this system, each 'principal', (which may be a machine, or a person,": {
            "content": "or an organization) is assigned a unique two-part encryption key.  One\npart of the key is public, and is called the 'public key'; the other\npart is kept secret, and is called the 'private key'.  The two parts are\nrelated, in that if you encrypt a message with one of the parts, you can\ndecrypt it with the other part, and 'only' with the other part.\n\nA certificate contains information about two principals.  It contains\nthe name of a 'subject', and the subject's public key.  It also contains\na statement by a second principal, the 'issuer', that the subject is who\nthey claim to be, and that this is indeed the subject's public key.  The\nissuer's statement is signed with the issuer's private key, which only\nthe issuer knows.  However, anyone can verify the issuer's statement by\nfinding the issuer's public key, decrypting the statement with it, and\ncomparing it to the other information in the certificate.  The\ncertificate also contains information about the time period over which\nit is valid.  This is expressed as two fields, called \"notBefore\" and\n\"notAfter\".\n",
            "subsections": []
        },
        "In the Python use of certificates, a client or server can use a": {
            "content": "certificate to prove who they are.  The other side of a network\nconnection can also be required to produce a certificate, and that\ncertificate can be validated to the satisfaction of the client or server\nthat requires such validation.  The connection attempt can be set to\nraise an exception if the validation fails.  Validation is done\nautomatically, by the underlying OpenSSL framework; the application need\nnot concern itself with its mechanics.  But the application does usually\nneed to provide sets of certificates to allow this process to take\nplace.\n",
            "subsections": []
        },
        "Python uses files to contain certificates.  They should be formatted as": {
            "content": "\"PEM\" (see RFC 1422(1)), which is a base-64 encoded form wrapped with a\nheader line and a footer line:\n\n-----BEGIN CERTIFICATE-----\n... (certificate in base64 PEM encoding) ...\n-----END CERTIFICATE-----\n\n* Menu:\n\n* Certificate chains::\n* CA certificates::\n* Combined key and certificate::\n* Self-signed certificates::\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc1422.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Certificate chains,  Next: CA certificates,  Up: Certificates": {
            "content": "5.18.3.11 Certificate chains\n............................\n",
            "subsections": []
        },
        "The Python files which contain certificates can contain a sequence of": {
            "content": "certificates, sometimes called a 'certificate chain'.  This chain should\nstart with the specific certificate for the principal who \"is\" the\nclient or server, and then the certificate for the issuer of that\ncertificate, and then the certificate for the issuer of 'that'\ncertificate, and so on up the chain till you get to a certificate which\nis 'self-signed', that is, a certificate which has the same subject and\nissuer, sometimes called a 'root certificate'.  The certificates should\njust be concatenated together in the certificate file.  For example,\nsuppose we had a three certificate chain, from our server certificate to\nthe certificate of the certification authority that signed our server\ncertificate, to the root certificate of the agency which issued the\ncertification authority's certificate:\n\n-----BEGIN CERTIFICATE-----\n... (certificate for your server)...\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\n... (the certificate for the CA)...\n-----END CERTIFICATE-----\n-----BEGIN CERTIFICATE-----\n... (the root certificate for the CA's issuer)...\n-----END CERTIFICATE-----\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: CA certificates,  Next: Combined key and certificate,  Prev: Certificate chains,  Up: Certificates": {
            "content": "5.18.3.12 CA certificates\n.........................\n",
            "subsections": []
        },
        "If you are going to require validation of the other side of the": {
            "content": "connection's certificate, you need to provide a \"CA certs\" file, filled\nwith the certificate chains for each issuer you are willing to trust.",
            "subsections": []
        },
        "Again, this file just contains these chains concatenated together.  For": {
            "content": "validation, Python will use the first chain it finds in the file which\nmatches.  The platform's certificates file can be used by calling *note\nSSLContext.loaddefaultcerts(): e21, this is done automatically with\n*note createdefaultcontext(): e17.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Combined key and certificate,  Next: Self-signed certificates,  Prev: CA certificates,  Up: Certificates": {
            "content": "5.18.3.13 Combined key and certificate\n......................................\n",
            "subsections": []
        },
        "Often the private key is stored in the same file as the certificate; in": {
            "content": "this case, only the 'certfile' parameter to *note\nSSLContext.loadcertchain(): fb5. needs to be passed.  If the private\nkey is stored with the certificate, it should come before the first\ncertificate in the certificate chain:\n\n-----BEGIN RSA PRIVATE KEY-----\n... (private key in base64 encoding) ...\n-----END RSA PRIVATE KEY-----\n-----BEGIN CERTIFICATE-----\n... (certificate in base64 PEM encoding) ...\n-----END CERTIFICATE-----\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Self-signed certificates,  Prev: Combined key and certificate,  Up: Certificates": {
            "content": "5.18.3.14 Self-signed certificates\n..................................\n",
            "subsections": []
        },
        "If you are going to create a server that provides SSL-encrypted": {
            "content": "connection services, you will need to acquire a certificate for that\nservice.  There are many ways of acquiring appropriate certificates,\nsuch as buying one from a certification authority.  Another common\npractice is to generate a self-signed certificate.  The simplest way to\ndo this is with the OpenSSL package, using something like the following:\n\n% openssl req -new -x509 -days 365 -nodes -out cert.pem -keyout cert.pem\nGenerating a 1024 bit RSA private key\n.......++++++\n.............................++++++\nYou are about to be asked to enter information that will be incorporated\ninto your certificate request.\nWhat you are about to enter is what is called a Distinguished Name or a DN.\nThere are quite a few fields but you can leave some blank\nFor some fields there will be a default value,\nCountry Name (2 letter code) [AU]:US\nState or Province Name (full name) [Some-State]:MyState\nLocality Name (eg, city) []:Some City\nOrganization Name (eg, company) [Internet Widgits Pty Ltd]:My Organization, Inc.\nOrganizational Unit Name (eg, section) []:My Group\nCommon Name (eg, YOUR name) []:myserver.mygroup.myorganization.com\nEmail Address []:ops@myserver.mygroup.myorganization.com\n%\n",
            "subsections": []
        },
        "The disadvantage of a self-signed certificate is that it is its own root": {
            "content": "certificate, and no one else will have it in their cache of known (and\ntrusted) root certificates.\n\nFile: python3.12.info,  Node: Examples<19>,  Next: Notes on non-blocking sockets,  Prev: Certificates,  Up: ssl -- TLS/SSL wrapper for socket objects\n\n5.18.3.15 Examples\n..................\n\n* Menu:\n\n* Testing for SSL support::\n* Client-side operation::\n* Server-side operation::\n\nFile: python3.12.info,  Node: Testing for SSL support,  Next: Client-side operation,  Up: Examples<19>\n\n5.18.3.16 Testing for SSL support\n.................................\n",
            "subsections": []
        },
        "To test for the presence of SSL support in a Python installation, user": {
            "content": "code should use the following idiom:\n\ntry:\nimport ssl\nexcept ImportError:\npass\nelse:\n...  # do something that requires SSL support\n\nFile: python3.12.info,  Node: Client-side operation,  Next: Server-side operation,  Prev: Testing for SSL support,  Up: Examples<19>\n\n5.18.3.17 Client-side operation\n...............................\n",
            "subsections": []
        },
        "This example creates a SSL context with the recommended security": {
            "content": "settings for client sockets, including automatic certificate\nverification:\n\n>>> context = ssl.createdefaultcontext()\n",
            "subsections": []
        },
        "If you prefer to tune security settings yourself, you might create a": {
            "content": "context from scratch (but beware that you might not get the settings\nright):\n\n>>> context = ssl.SSLContext(ssl.PROTOCOLTLSCLIENT)\n>>> context.loadverifylocations(\"/etc/ssl/certs/ca-bundle.crt\")\n\n(this snippet assumes your operating system places a bundle of all CA\ncertificates in '/etc/ssl/certs/ca-bundle.crt'; if not, you'll get an\nerror and have to adjust the location)\n\nThe *note PROTOCOLTLSCLIENT: 67b. protocol configures the context for\ncert validation and hostname verification.  *note verifymode: 30a8. is\nset to *note CERTREQUIRED: 30a9. and *note checkhostname: 30ba. is set\nto 'True'.  All other protocols create SSL contexts with insecure\ndefaults.\n\nWhen you use the context to connect to a server, *note CERTREQUIRED:\n30a9. and *note checkhostname: 30ba. validate the server certificate:\nit ensures that the server certificate was signed with one of the CA\ncertificates, checks the signature for correctness, and verifies other\nproperties like validity and identity of the hostname:\n\n>>> conn = context.wrapsocket(socket.socket(socket.AFINET),\n...                            serverhostname=\"www.python.org\")\n>>> conn.connect((\"www.python.org\", 443))\n\nYou may then fetch the certificate:\n\n>>> cert = conn.getpeercert()\n",
            "subsections": []
        },
        "Visual inspection shows that the certificate does identify the desired": {
            "content": "service (that is, the HTTPS host 'www.python.org'):\n\n>>> pprint.pprint(cert)\n{'OCSP': ('http://ocsp.digicert.com',),\n'caIssuers': ('http://cacerts.digicert.com/DigiCertSHA2ExtendedValidationServerCA.crt',),\n'crlDistributionPoints': ('http://crl3.digicert.com/sha2-ev-server-g1.crl',\n'http://crl4.digicert.com/sha2-ev-server-g1.crl'),\n'issuer': ((('countryName', 'US'),),\n(('organizationName', 'DigiCert Inc'),),\n(('organizationalUnitName', 'www.digicert.com'),),\n(('commonName', 'DigiCert SHA2 Extended Validation Server CA'),)),\n'notAfter': 'Sep  9 12:00:00 2016 GMT',\n'notBefore': 'Sep  5 00:00:00 2014 GMT',\n'serialNumber': '01BB6F00122B177F36CAB49CEA8B6B26',\n'subject': ((('businessCategory', 'Private Organization'),),\n(('1.3.6.1.4.1.311.60.2.1.3', 'US'),),\n(('1.3.6.1.4.1.311.60.2.1.2', 'Delaware'),),\n(('serialNumber', '3359300'),),\n(('streetAddress', '16 Allen Rd'),),\n(('postalCode', '03894-4801'),),\n(('countryName', 'US'),),\n(('stateOrProvinceName', 'NH'),),\n(('localityName', 'Wolfeboro'),),\n(('organizationName', 'Python Software Foundation'),),\n(('commonName', 'www.python.org'),)),\n'subjectAltName': (('DNS', 'www.python.org'),\n('DNS', 'python.org'),\n('DNS', 'pypi.org'),\n('DNS', 'docs.python.org'),\n('DNS', 'testpypi.org'),\n('DNS', 'bugs.python.org'),\n('DNS', 'wiki.python.org'),\n('DNS', 'hg.python.org'),\n('DNS', 'mail.python.org'),\n('DNS', 'packaging.python.org'),\n('DNS', 'pythonhosted.org'),\n('DNS', 'www.pythonhosted.org'),\n('DNS', 'test.pythonhosted.org'),\n('DNS', 'us.pycon.org'),\n('DNS', 'id.python.org')),\n'version': 3}\n",
            "subsections": []
        },
        "Now the SSL channel is established and the certificate verified, you can": {
            "content": "proceed to talk with the server:\n\n>>> conn.sendall(b\"HEAD / HTTP/1.0\\r\\nHost: linuxfr.org\\r\\n\\r\\n\")\n>>> pprint.pprint(conn.recv(1024).split(b\"\\r\\n\"))\n[b'HTTP/1.1 200 OK',\nb'Date: Sat, 18 Oct 2014 18:27:20 GMT',\nb'Server: nginx',\nb'Content-Type: text/html; charset=utf-8',\nb'X-Frame-Options: SAMEORIGIN',\nb'Content-Length: 45679',\nb'Accept-Ranges: bytes',\nb'Via: 1.1 varnish',\nb'Age: 2188',\nb'X-Served-By: cache-lcy1134-LCY',\nb'X-Cache: HIT',\nb'X-Cache-Hits: 11',\nb'Vary: Cookie',\nb'Strict-Transport-Security: max-age=63072000; includeSubDomains',\nb'Connection: close',\nb'',\nb'']\n\nSee the discussion of *note Security considerations: 2f9c. below.\n\nFile: python3.12.info,  Node: Server-side operation,  Prev: Client-side operation,  Up: Examples<19>\n\n5.18.3.18 Server-side operation\n...............................\n",
            "subsections": []
        },
        "For server operation, typically you'll need to have a server": {
            "content": "certificate, and private key, each in a file.  You'll first create a\ncontext holding the key and the certificate, so that clients can check\nyour authenticity.  Then you'll open a socket, bind it to a port, call\n'listen()' on it, and start waiting for clients to connect:\n\nimport socket, ssl\n\ncontext = ssl.createdefaultcontext(ssl.Purpose.CLIENTAUTH)\ncontext.loadcertchain(certfile=\"mycertfile\", keyfile=\"mykeyfile\")\n\nbindsocket = socket.socket()\nbindsocket.bind(('myaddr.example.com', 10023))\nbindsocket.listen(5)\n",
            "subsections": []
        },
        "When a client connects, you'll call 'accept()' on the socket to get the": {
            "content": "new socket from the other end, and use the context's *note\nSSLContext.wrapsocket(): 279. method to create a server-side SSL socket\nfor the connection:\n\nwhile True:\nnewsocket, fromaddr = bindsocket.accept()\nconnstream = context.wrapsocket(newsocket, serverside=True)\ntry:\ndealwithclient(connstream)\nfinally:\nconnstream.shutdown(socket.SHUTRDWR)\nconnstream.close()\n",
            "subsections": []
        },
        "Then you'll read data from the 'connstream' and do something with it": {
            "content": "till you are finished with the client (or the client is finished with\nyou):\n\ndef dealwithclient(connstream):\ndata = connstream.recv(1024)\n# empty data means the client is finished with us\nwhile data:\nif not dosomething(connstream, data):\n# we'll assume dosomething returns False\n# when we're finished with client\nbreak\ndata = connstream.recv(1024)\n# finished with client\n",
            "subsections": []
        },
        "And go back to listening for new client connections (of course, a real": {
            "content": "server would probably handle each client connection in a separate\nthread, or put the sockets in *note non-blocking mode: 30ad. and use an\nevent loop).\n\nFile: python3.12.info,  Node: Notes on non-blocking sockets,  Next: Memory BIO Support<2>,  Prev: Examples<19>,  Up: ssl -- TLS/SSL wrapper for socket objects\n\n5.18.3.19 Notes on non-blocking sockets\n.......................................\n\nSSL sockets behave slightly different than regular sockets in\nnon-blocking mode.  When working with non-blocking sockets, there are\nthus several things you need to be aware of:\n\n- Most *note SSLSocket: 703. methods will raise either *note\nSSLWantWriteError: ccd. or *note SSLWantReadError: ccc. instead of\n*note BlockingIOError: ed0. if an I/O operation would block.  *note\nSSLWantReadError: ccc. will be raised if a read operation on the\nunderlying socket is necessary, and *note SSLWantWriteError: ccd.\nfor a write operation on the underlying socket.  Note that attempts\nto 'write' to an SSL socket may require 'reading' from the\nunderlying socket first, and attempts to 'read' from the SSL socket\nmay require a prior 'write' to the underlying socket.\n\nChanged in version 3.5: In earlier Python versions, the\n'SSLSocket.send()' method returned zero instead of raising *note\nSSLWantWriteError: ccd. or *note SSLWantReadError: ccc.\n\n- Calling *note select(): bfc. tells you that the OS-level socket can\nbe read from (or written to), but it does not imply that there is\nsufficient data at the upper SSL layer.  For example, only part of\nan SSL frame might have arrived.  Therefore, you must be ready to\nhandle 'SSLSocket.recv()' and 'SSLSocket.send()' failures, and\nretry after another call to *note select(): bfc.\n\n- Conversely, since the SSL layer has its own framing, a SSL socket\nmay still have data available for reading without *note select():\nbfc. being aware of it.  Therefore, you should first call\n'SSLSocket.recv()' to drain any potentially available data, and\nthen only block on a *note select(): bfc. call if still necessary.\n\n(of course, similar provisions apply when using other primitives\nsuch as *note poll(): 28a8, or those in the *note selectors: bd.\nmodule)\n\n- The SSL handshake itself will be non-blocking: the *note\nSSLSocket.dohandshake(): cd0. method has to be retried until it\nreturns successfully.  Here is a synopsis using *note select():\nbfc. to wait for the socket's readiness:\n\nwhile True:\ntry:\nsock.dohandshake()\nbreak\nexcept ssl.SSLWantReadError:\nselect.select([sock], [], [])\nexcept ssl.SSLWantWriteError:\nselect.select([], [sock], [])\n\nSee also\n........\n\nThe *note asyncio: 9. module supports *note non-blocking SSL sockets:\n30ad. and provides a higher level API. It polls for events using the\n*note selectors: bd. module and handles *note SSLWantWriteError: ccd,\n*note SSLWantReadError: ccc. and *note BlockingIOError: ed0. exceptions.\nIt runs the SSL handshake asynchronously as well.\n\nFile: python3.12.info,  Node: Memory BIO Support<2>,  Next: SSL session,  Prev: Notes on non-blocking sockets,  Up: ssl -- TLS/SSL wrapper for socket objects\n\n5.18.3.20 Memory BIO Support\n............................\n\nNew in version 3.5.\n\nEver since the SSL module was introduced in Python 2.6, the *note\nSSLSocket: 703. class has provided two related but distinct areas of\nfunctionality:\n\n- SSL protocol handling\n\n- Network IO\n\nThe network IO API is identical to that provided by *note socket.socket:\nbfd, from which *note SSLSocket: 703. also inherits.  This allows an SSL\nsocket to be used as a drop-in replacement for a regular socket, making\nit very easy to add SSL support to an existing application.\n",
            "subsections": []
        },
        "Combining SSL protocol handling and network IO usually works well, but": {
            "content": "there are some cases where it doesn't.  An example is async IO\nframeworks that want to use a different IO multiplexing model than the\n\"select/poll on a file descriptor\" (readiness based) model that is\nassumed by *note socket.socket: bfd. and by the internal OpenSSL socket\nIO routines.  This is mostly relevant for platforms like Windows where\nthis model is not efficient.  For this purpose, a reduced scope variant\nof *note SSLSocket: 703. called *note SSLObject: 9c2. is provided.\n\n-- Class: ssl.SSLObject\n\nA reduced-scope variant of *note SSLSocket: 703. representing an\nSSL protocol instance that does not contain any network IO methods.\nThis class is typically used by framework authors that want to\nimplement asynchronous IO for SSL through memory buffers.\n\nThis class implements an interface on top of a low-level SSL object\nas implemented by OpenSSL. This object captures the state of an SSL\nconnection but does not provide any network IO itself.  IO needs to\nbe performed through separate \"BIO\" objects which are OpenSSL's IO\nabstraction layer.\n\nThis class has no public constructor.  An *note SSLObject: 9c2.\ninstance must be created using the *note wrapbio(): 9c3. method.\nThis method will create the *note SSLObject: 9c2. instance and bind\nit to a pair of BIOs.  The 'incoming' BIO is used to pass data from\nPython to the SSL protocol instance, while the 'outgoing' BIO is\nused to pass data the other way around.\n\nThe following methods are available:\n\n- *note context: 30dd.\n\n- *note serverside: 30df.\n\n- *note serverhostname: 9c0.\n\n- *note session: 30e0.\n\n- *note sessionreused: 30e1.\n\n- *note read(): cd1.\n\n- *note write(): cd2.\n\n- *note getpeercert(): e27.\n\n- *note selectedalpnprotocol(): cc8.\n\n- *note selectednpnprotocol(): 67d.\n\n- *note cipher(): 2fe0.\n\n- *note sharedciphers(): ccf.\n\n- *note compression(): fb9.\n\n- *note pending(): 30de.\n\n- *note dohandshake(): cd0.\n\n- *note verifyclientposthandshake(): 85d.\n\n- *note unwrap(): 30dc.\n\n- *note getchannelbinding(): fb8.\n\n- *note version(): ccb.\n\nWhen compared to *note SSLSocket: 703, this object lacks the\nfollowing features:\n\n- Any form of network IO; 'recv()' and 'send()' read and write\nonly to the underlying *note MemoryBIO: cc5. buffers.\n\n- There is no 'dohandshakeonconnect' machinery.  You must\nalways manually call *note dohandshake(): cd0. to start the\nhandshake.\n\n- There is no handling of 'suppressraggedeofs'.  All\nend-of-file conditions that are in violation of the protocol\nare reported via the *note SSLEOFError: 1491. exception.\n\n- The method *note unwrap(): 30dc. call does not return\nanything, unlike for an SSL socket where it returns the\nunderlying socket.\n\n- The 'servernamecallback' callback passed to *note\nSSLContext.setservernamecallback(): e26. will get an *note\nSSLObject: 9c2. instance instead of a *note SSLSocket: 703.\ninstance as its first parameter.\n\nSome notes related to the use of *note SSLObject: 9c2.:\n\n- All IO on an *note SSLObject: 9c2. is *note non-blocking:\n30ad.  This means that for example *note read(): cd1. will\nraise an *note SSLWantReadError: ccc. if it needs more data\nthan the incoming BIO has available.\n\nChanged in version 3.7: *note SSLObject: 9c2. instances must be\ncreated with *note wrapbio(): 9c3.  In earlier versions, it was\npossible to create instances directly.  This was never documented\nor officially supported.\n\nAn SSLObject communicates with the outside world using memory buffers.\nThe class *note MemoryBIO: cc5. provides a memory buffer that can be\nused for this purpose.  It wraps an OpenSSL memory BIO (Basic IO)\nobject:\n\n-- Class: ssl.MemoryBIO\n\nA memory buffer that can be used to pass data between Python and an\nSSL protocol instance.\n\n-- Attribute: pending\n\nReturn the number of bytes currently in the memory buffer.\n\n-- Attribute: eof\n\nA boolean indicating whether the memory BIO is current at the\nend-of-file position.\n\n-- Method: read (n=-1)\n\nRead up to 'n' bytes from the memory buffer.  If 'n' is not\nspecified or negative, all bytes are returned.\n\n-- Method: write (buf)\n\nWrite the bytes from 'buf' to the memory BIO. The 'buf'\nargument must be an object supporting the buffer protocol.\n\nThe return value is the number of bytes written, which is\nalways equal to the length of 'buf'.\n\n-- Method: writeeof ()\n\nWrite an EOF marker to the memory BIO. After this method has\nbeen called, it is illegal to call *note write(): 30f9.  The\nattribute *note eof: 30f7. will become true after all data\ncurrently in the buffer has been read.\n\nFile: python3.12.info,  Node: SSL session,  Next: Security considerations<2>,  Prev: Memory BIO Support<2>,  Up: ssl -- TLS/SSL wrapper for socket objects\n\n5.18.3.21 SSL session\n.....................\n\nNew in version 3.6.\n\n-- Class: ssl.SSLSession\n\nSession object used by *note session: 30e0.\n\n-- Attribute: id\n\n-- Attribute: time\n\n-- Attribute: timeout\n\n-- Attribute: ticketlifetimehint\n\n-- Attribute: hasticket\n\nFile: python3.12.info,  Node: Security considerations<2>,  Next: TLS 1 3,  Prev: SSL session,  Up: ssl -- TLS/SSL wrapper for socket objects\n\n5.18.3.22 Security considerations\n.................................\n\n* Menu:\n\n* Best defaults::\n* Manual settings::\n* Multi-processing::\n\nFile: python3.12.info,  Node: Best defaults,  Next: Manual settings,  Up: Security considerations<2>\n\n5.18.3.23 Best defaults\n.......................\n",
            "subsections": []
        },
        "For 'client use', if you don't have any special requirements for your": {
            "content": "security policy, it is highly recommended that you use the *note\ncreatedefaultcontext(): e17. function to create your SSL context.  It\nwill load the system's trusted CA certificates, enable certificate\nvalidation and hostname checking, and try to choose reasonably secure\nprotocol and cipher settings.\n\nFor example, here is how you would use the *note smtplib.SMTP: 74b.\nclass to create a trusted, secure connection to a SMTP server:\n\n>>> import ssl, smtplib\n>>> smtp = smtplib.SMTP(\"mail.python.org\", port=587)\n>>> context = ssl.createdefaultcontext()\n>>> smtp.starttls(context=context)\n(220, b'2.0.0 Ready to start TLS')\n",
            "subsections": []
        },
        "If a client certificate is needed for the connection, it can be added": {
            "content": "with *note SSLContext.loadcertchain(): fb5.\n\nBy contrast, if you create the SSL context by calling the *note\nSSLContext: 278. constructor yourself, it will not have certificate\nvalidation nor hostname checking enabled by default.  If you do so,\nplease read the paragraphs below to achieve a good security level.\n\nFile: python3.12.info,  Node: Manual settings,  Next: Multi-processing,  Prev: Best defaults,  Up: Security considerations<2>\n\n5.18.3.24 Manual settings\n.........................\n\n* Menu:\n\n* Verifying certificates::\n* Protocol versions::\n* Cipher selection::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Verifying certificates,  Next: Protocol versions,  Up: Manual settings": {
            "content": "5.18.3.25 Verifying certificates\n................................\n\nWhen calling the *note SSLContext: 278. constructor directly, *note\nCERTNONE: 30b8. is the default.  Since it does not authenticate the\nother peer, it can be insecure, especially in client mode where most of\ntime you would like to ensure the authenticity of the server you're\ntalking to.  Therefore, when in client mode, it is highly recommended to\nuse *note CERTREQUIRED: 30a9.  However, it is in itself not sufficient;\nyou also have to check that the server certificate, which can be\nobtained by calling *note SSLSocket.getpeercert(): e27, matches the\ndesired service.  For many protocols and applications, the service can\nbe identified by the hostname.  This common check is automatically\nperformed when *note SSLContext.checkhostname: 30ba. is enabled.\n\nChanged in version 3.7: Hostname matchings is now performed by OpenSSL.\nPython no longer uses 'matchhostname()'.\n",
            "subsections": []
        },
        "In server mode, if you want to authenticate your clients using the SSL": {
            "content": "layer (rather than using a higher-level authentication mechanism),\nyou'll also have to specify *note CERTREQUIRED: 30a9. and similarly\ncheck the client certificate.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Protocol versions,  Next: Cipher selection,  Prev: Verifying certificates,  Up: Manual settings": {
            "content": "5.18.3.26 Protocol versions\n...........................\n\nSSL versions 2 and 3 are considered insecure and are therefore dangerous\nto use.  If you want maximum compatibility between clients and servers,\nit is recommended to use *note PROTOCOLTLSCLIENT: 67b. or *note\nPROTOCOLTLSSERVER: 67c. as the protocol version.  SSLv2 and SSLv3 are\ndisabled by default.\n\n>>> clientcontext = ssl.SSLContext(ssl.PROTOCOLTLSCLIENT)\n>>> clientcontext.minimumversion = ssl.TLSVersion.TLSv13\n>>> clientcontext.maximumversion = ssl.TLSVersion.TLSv13\n",
            "subsections": []
        },
        "The SSL context created above will only allow TLSv1.3 and later (if": {
            "content": "supported by your system) connections to a server.  *note\nPROTOCOLTLSCLIENT: 67b. implies certificate validation and hostname\nchecks by default.  You have to load certificates into the context.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Cipher selection,  Prev: Protocol versions,  Up: Manual settings": {
            "content": "5.18.3.27 Cipher selection\n..........................\n",
            "subsections": []
        },
        "If you have advanced security requirements, fine-tuning of the ciphers": {
            "content": "enabled when negotiating a SSL session is possible through the *note\nSSLContext.setciphers(): 30e4. method.  Starting from Python 3.2.3, the\nssl module disables certain weak ciphers by default, but you may want to\nfurther restrict the cipher choice.  Be sure to read OpenSSL's\ndocumentation about the cipher list format(1).  If you want to check\nwhich ciphers are enabled by a given cipher list, use *note\nSSLContext.getciphers(): b2d. or the 'openssl ciphers' command on your\nsystem.\n\n---------- Footnotes ----------\n\n(1)\nhttps://www.openssl.org/docs/man1.1.1/man1/ciphers.html#CIPHER-LIST-FORMAT\n\nFile: python3.12.info,  Node: Multi-processing,  Prev: Manual settings,  Up: Security considerations<2>\n\n5.18.3.28 Multi-processing\n..........................\n",
            "subsections": []
        },
        "If using this module as part of a multi-processed application (using,": {
            "content": "for example the *note multiprocessing: 8f. or *note concurrent.futures:\n1f. modules), be aware that OpenSSL's internal random number generator\ndoes not properly handle forked processes.  Applications must change the\nPRNG state of the parent process if they use any SSL feature with *note\nos.fork(): 231.  Any successful call of *note RANDadd(): 30b3. or *note\nRANDbytes(): 277. is sufficient.\n\nFile: python3.12.info,  Node: TLS 1 3,  Prev: Security considerations<2>,  Up: ssl -- TLS/SSL wrapper for socket objects\n\n5.18.3.29 TLS 1.3\n.................\n\nNew in version 3.7.\n",
            "subsections": []
        },
        "The TLS 1.3 protocol behaves slightly differently than previous version": {
            "content": "of TLS/SSL. Some new TLS 1.3 features are not yet available.\n\n- TLS 1.3 uses a disjunct set of cipher suites.  All AES-GCM and\nChaCha20 cipher suites are enabled by default.  The method *note\nSSLContext.setciphers(): 30e4. cannot enable or disable any TLS\n1.3 ciphers yet, but *note SSLContext.getciphers(): b2d. returns\nthem.\n\n- Session tickets are no longer sent as part of the initial handshake\nand are handled differently.  *note SSLSocket.session: 30e0. and\n*note SSLSession: b2c. are not compatible with TLS 1.3.\n\n- Client-side certificates are also no longer verified during the\ninitial handshake.  A server can request a certificate at any time.\nClients process certificate requests while they send or receive\napplication data from the server.\n\n- TLS 1.3 features like early data, deferred TLS client cert request,\nsignature algorithm configuration, and rekeying are not supported\nyet.\n\nSee also\n........\n\nClass *note socket.socket: bfd.\n\nDocumentation of underlying *note socket: c6. class\n\nSSL/TLS Strong Encryption: An Introduction(1)\n\nIntro from the Apache HTTP Server documentation\n\nRFC 1422: Privacy Enhancement for Internet Electronic Mail: Part II: Certificate-Based Key Management(2)\n\nSteve Kent\n\nRFC 4086: Randomness Requirements for Security(3)\n\nDonald E., Jeffrey I. Schiller\n\nRFC 5280: Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile(4)\n\nD. Cooper\n\nRFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2(5)\n\nT. Dierks et.  al.\n\nRFC 6066: Transport Layer Security (TLS) Extensions(6)\n\nD. Eastlake\n\nIANA TLS: Transport Layer Security (TLS) Parameters(7)\n\nIANA\n\nRFC 7525: Recommendations for Secure Use of Transport Layer Security (TLS) and Datagram Transport Layer Security (DTLS)(8)\n\nIETF\n",
            "subsections": []
        },
        "Mozilla's Server Side TLS recommendations(9)": {
            "content": "Mozilla\n\n---------- Footnotes ----------\n\n(1) https://httpd.apache.org/docs/trunk/en/ssl/sslintro.html\n\n(2) https://datatracker.ietf.org/doc/html/rfc1422.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc4086.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc5280.html\n\n(5) https://datatracker.ietf.org/doc/html/rfc5246.html\n\n(6) https://datatracker.ietf.org/doc/html/rfc6066.html\n\n(7)\nhttps://www.iana.org/assignments/tls-parameters/tls-parameters.xml\n\n(8) https://datatracker.ietf.org/doc/html/rfc7525.html\n\n(9) https://wiki.mozilla.org/Security/ServerSideTLS\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: select -- Waiting for I/O completion,  Next: selectors -- High-level I/O multiplexing,  Prev: ssl -- TLS/SSL wrapper for socket objects,  Up: Networking and Interprocess Communication": {
            "content": "",
            "subsections": []
        },
        "This module provides access to the 'select()' and 'poll()' functions": {
            "content": "available in most operating systems, 'devpoll()' available on Solaris\nand derivatives, 'epoll()' available on Linux 2.5+ and 'kqueue()'\navailable on most BSD. Note that on Windows, it only works for sockets;\non other operating systems, it also works for other file types (in\nparticular, on Unix, it works on pipes).  It cannot be used on regular\nfiles to determine whether a file has grown since it was last read.\n\nNote: The *note selectors: bd. module allows high-level and\nefficient I/O multiplexing, built upon the *note select: bc. module\nprimitives.  Users are encouraged to use the *note selectors: bd.\nmodule instead, unless they want precise control over the OS-level\nprimitives used.\n\n*note Availability: 1ad3.: not Emscripten, not WASI.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: /dev/poll Polling Objects,  Next: Edge and Level Trigger Polling epoll Objects,  Up: select -- Waiting for I/O completion": {
            "content": "5.18.4.1 '/dev/poll' Polling Objects\n....................................\n",
            "subsections": []
        },
        "Solaris and derivatives have '/dev/poll'.  While 'select()' is": {
            "content": "'O'('highest file descriptor') and 'poll()' is 'O'('number of file\ndescriptors'), '/dev/poll' is 'O'('active file descriptors').\n\n'/dev/poll' behaviour is very close to the standard 'poll()' object.\n\n-- Method: devpoll.close ()\n\nClose the file descriptor of the polling object.\n\nNew in version 3.4.\n\n-- Attribute: devpoll.closed\n\n'True' if the polling object is closed.\n\nNew in version 3.4.\n\n-- Method: devpoll.fileno ()\n\nReturn the file descriptor number of the polling object.\n\nNew in version 3.4.\n\n-- Method: devpoll.register (fd[, eventmask])\n\nRegister a file descriptor with the polling object.  Future calls\nto the *note poll(): 28a8. method will then check whether the file\ndescriptor has any pending I/O events.  'fd' can be either an\ninteger, or an object with a *note fileno(): 2542. method that\nreturns an integer.  File objects implement 'fileno()', so they can\nalso be used as the argument.\n\n'eventmask' is an optional bitmask describing the type of events\nyou want to check for.  The constants are the same that with\n'poll()' object.  The default value is a combination of the\nconstants 'POLLIN', 'POLLPRI', and 'POLLOUT'.\n\nWarning: Registering a file descriptor that's already\nregistered is not an error, but the result is undefined.  The\nappropriate action is to unregister or modify it first.  This\nis an important difference compared with 'poll()'.\n\n-- Method: devpoll.modify (fd[, eventmask])\n\nThis method does an *note unregister(): 3114. followed by a *note\nregister(): 3112.  It is (a bit) more efficient that doing the same\nexplicitly.\n\n-- Method: devpoll.unregister (fd)\n\nRemove a file descriptor being tracked by a polling object.  Just\nlike the *note register(): 3112. method, 'fd' can be an integer or\nan object with a *note fileno(): 2542. method that returns an\ninteger.\n\nAttempting to remove a file descriptor that was never registered is\nsafely ignored.\n\n-- Method: devpoll.poll ([timeout])\n\nPolls the set of registered file descriptors, and returns a\npossibly empty list containing '(fd, event)' 2-tuples for the\ndescriptors that have events or errors to report.  'fd' is the file\ndescriptor, and 'event' is a bitmask with bits set for the reported\nevents for that descriptor -- 'POLLIN' for waiting input, 'POLLOUT'\nto indicate that the descriptor can be written to, and so forth.\nAn empty list indicates that the call timed out and no file\ndescriptors had any events to report.  If 'timeout' is given, it\nspecifies the length of time in milliseconds which the system will\nwait for events before returning.  If 'timeout' is omitted, -1, or\n*note None: 43f, the call will block until there is an event for\nthis poll object.\n\nChanged in version 3.5: The function is now retried with a\nrecomputed timeout when interrupted by a signal, except if the\nsignal handler raises an exception (see PEP 475(1) for the\nrationale), instead of raising *note InterruptedError: be3.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0475/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Edge and Level Trigger Polling epoll Objects,  Next: Polling Objects,  Prev: /dev/poll Polling Objects,  Up: select -- Waiting for I/O completion": {
            "content": "5.18.4.2 Edge and Level Trigger Polling (epoll) Objects\n.......................................................\n\n'https://linux.die.net/man/4/epoll'\n\n'eventmask'\n\nConstant                      Meaning\n\n----------------------------------------------------------------------------------\n\n'EPOLLIN'                     Available for read\n\n\n'EPOLLOUT'                    Available for write\n\n\n'EPOLLPRI'                    Urgent data for read\n\n\n'EPOLLERR'                    Error condition happened on the assoc.  fd\n\n\n'EPOLLHUP'                    Hang up happened on the assoc.  fd\n\n\n'EPOLLET'                     Set Edge Trigger behavior, the default is Level\nTrigger behavior\n\n\n'EPOLLONESHOT'                Set one-shot behavior.  After one event is pulled\nout, the fd is internally disabled\n\n\n'EPOLLEXCLUSIVE'              Wake only one epoll object when the associated fd\nhas an event.  The default (if this flag is not\nset) is to wake all epoll objects polling on a\nfd.\n\n\n'EPOLLRDHUP'                  Stream socket peer closed connection or shut down\nwriting half of connection.\n\n\n'EPOLLRDNORM'                 Equivalent to 'EPOLLIN'\n\n\n'EPOLLRDBAND'                 Priority data band can be read.\n\n\n'EPOLLWRNORM'                 Equivalent to 'EPOLLOUT'\n\n\n'EPOLLWRBAND'                 Priority data may be written.\n\n\n'EPOLLMSG'                    Ignored.\n\n\nNew in version 3.6: 'EPOLLEXCLUSIVE' was added.  It's only\nsupported by Linux Kernel 4.5 or later.\n\n-- Method: epoll.close ()\n\nClose the control file descriptor of the epoll object.\n\n-- Attribute: epoll.closed\n\n'True' if the epoll object is closed.\n\n-- Method: epoll.fileno ()\n\nReturn the file descriptor number of the control fd.\n\n-- Method: epoll.fromfd (fd)\n\nCreate an epoll object from a given file descriptor.\n\n-- Method: epoll.register (fd[, eventmask])\n\nRegister a fd descriptor with the epoll object.\n\n-- Method: epoll.modify (fd, eventmask)\n\nModify a registered file descriptor.\n\n-- Method: epoll.unregister (fd)\n\nRemove a registered file descriptor from the epoll object.\n\nChanged in version 3.9: The method no longer ignores the *note\nEBADF: 77c. error.\n\n-- Method: epoll.poll (timeout=None, maxevents=-1)\n\nWait for events.  timeout in seconds (float)\n\nChanged in version 3.5: The function is now retried with a\nrecomputed timeout when interrupted by a signal, except if the\nsignal handler raises an exception (see PEP 475(1) for the\nrationale), instead of raising *note InterruptedError: be3.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0475/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Polling Objects,  Next: Kqueue Objects,  Prev: Edge and Level Trigger Polling epoll Objects,  Up: select -- Waiting for I/O completion": {
            "content": "5.18.4.3 Polling Objects\n........................\n",
            "subsections": []
        },
        "The 'poll()' system call, supported on most Unix systems, provides": {
            "content": "better scalability for network servers that service many, many clients\nat the same time.  'poll()' scales better because the system call only\nrequires listing the file descriptors of interest, while 'select()'\nbuilds a bitmap, turns on bits for the fds of interest, and then\nafterward the whole bitmap has to be linearly scanned again.  'select()'\nis 'O'('highest file descriptor'), while 'poll()' is 'O'('number of file\ndescriptors').\n\n-- Method: poll.register (fd[, eventmask])\n\nRegister a file descriptor with the polling object.  Future calls\nto the *note poll(): 28a8. method will then check whether the file\ndescriptor has any pending I/O events.  'fd' can be either an\ninteger, or an object with a *note fileno(): 2542. method that\nreturns an integer.  File objects implement 'fileno()', so they can\nalso be used as the argument.\n\n'eventmask' is an optional bitmask describing the type of events\nyou want to check for, and can be a combination of the constants\n'POLLIN', 'POLLPRI', and 'POLLOUT', described in the table below.\nIf not specified, the default value used will check for all 3 types\nof events.\n\nConstant                Meaning\n\n-----------------------------------------------------------------------\n\n'POLLIN'                There is data to read\n\n\n'POLLPRI'               There is urgent data to read\n\n\n'POLLOUT'               Ready for output: writing will not block\n\n\n'POLLERR'               Error condition of some sort\n\n\n'POLLHUP'               Hung up\n\n\n'POLLRDHUP'             Stream socket peer closed connection, or\nshut down writing half of connection\n\n\n'POLLNVAL'              Invalid request: descriptor not open\n\n\nRegistering a file descriptor that's already registered is not an\nerror, and has the same effect as registering the descriptor\nexactly once.\n\n-- Method: poll.modify (fd, eventmask)\n\nModifies an already registered fd.  This has the same effect as\n'register(fd, eventmask)'.  Attempting to modify a file descriptor\nthat was never registered causes an *note OSError: 613. exception\nwith errno 'ENOENT' to be raised.\n\n-- Method: poll.unregister (fd)\n\nRemove a file descriptor being tracked by a polling object.  Just\nlike the *note register(): 311c. method, 'fd' can be an integer or\nan object with a *note fileno(): 2542. method that returns an\ninteger.\n\nAttempting to remove a file descriptor that was never registered\ncauses a *note KeyError: 8cf. exception to be raised.\n\n-- Method: poll.poll ([timeout])\n\nPolls the set of registered file descriptors, and returns a\npossibly empty list containing '(fd, event)' 2-tuples for the\ndescriptors that have events or errors to report.  'fd' is the file\ndescriptor, and 'event' is a bitmask with bits set for the reported\nevents for that descriptor -- 'POLLIN' for waiting input, 'POLLOUT'\nto indicate that the descriptor can be written to, and so forth.\nAn empty list indicates that the call timed out and no file\ndescriptors had any events to report.  If 'timeout' is given, it\nspecifies the length of time in milliseconds which the system will\nwait for events before returning.  If 'timeout' is omitted,\nnegative, or *note None: 43f, the call will block until there is an\nevent for this poll object.\n\nChanged in version 3.5: The function is now retried with a\nrecomputed timeout when interrupted by a signal, except if the\nsignal handler raises an exception (see PEP 475(1) for the\nrationale), instead of raising *note InterruptedError: be3.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0475/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Kqueue Objects,  Next: Kevent Objects,  Prev: Polling Objects,  Up: select -- Waiting for I/O completion": {
            "content": "5.18.4.4 Kqueue Objects\n.......................\n\n-- Method: kqueue.close ()\n\nClose the control file descriptor of the kqueue object.\n\n-- Attribute: kqueue.closed\n\n'True' if the kqueue object is closed.\n\n-- Method: kqueue.fileno ()\n\nReturn the file descriptor number of the control fd.\n\n-- Method: kqueue.fromfd (fd)\n\nCreate a kqueue object from a given file descriptor.\n\n-- Method: kqueue.control (changelist, maxevents[, timeout]) ->\neventlist\n\nLow level interface to kevent\n\n- changelist must be an iterable of kevent objects or 'None'\n\n- maxevents must be 0 or a positive integer\n\n- timeout in seconds (floats possible); the default is 'None',\nto wait forever\n\nChanged in version 3.5: The function is now retried with a\nrecomputed timeout when interrupted by a signal, except if the\nsignal handler raises an exception (see PEP 475(1) for the\nrationale), instead of raising *note InterruptedError: be3.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0475/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Kevent Objects,  Prev: Kqueue Objects,  Up: select -- Waiting for I/O completion": {
            "content": "5.18.4.5 Kevent Objects\n.......................\n\n'https://man.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2'\n\n-- Attribute: kevent.ident\n\nValue used to identify the event.  The interpretation depends on\nthe filter but it's usually the file descriptor.  In the\nconstructor ident can either be an int or an object with a *note\nfileno(): 2542. method.  kevent stores the integer internally.\n\n-- Attribute: kevent.filter\n\nName of the kernel filter.\n\nConstant                        Meaning\n\n----------------------------------------------------------------------------------\n\n'KQFILTERREAD'                Takes a descriptor and returns whenever there\nis data available to read\n\n\n'KQFILTERWRITE'               Takes a descriptor and returns whenever there\nis data available to write\n\n\n'KQFILTERAIO'                 AIO requests\n\n\n'KQFILTERVNODE'               Returns when one or more of the requested\nevents watched in 'fflag' occurs\n\n\n'KQFILTERPROC'                Watch for events on a process id\n\n\n'KQFILTERNETDEV'              Watch for events on a network device [not\navailable on macOS]\n\n\n'KQFILTERSIGNAL'              Returns whenever the watched signal is\ndelivered to the process\n\n\n'KQFILTERTIMER'               Establishes an arbitrary timer\n\n\n-- Attribute: kevent.flags\n\nFilter action.\n\nConstant                        Meaning\n\n----------------------------------------------------------------------------------\n\n'KQEVADD'                     Adds or modifies an event\n\n\n'KQEVDELETE'                  Removes an event from the queue\n\n\n'KQEVENABLE'                  Permitscontrol() to returns the event\n\n\n'KQEVDISABLE'                 Disablesevent\n\n\n'KQEVONESHOT'                 Removes event after first occurrence\n\n\n'KQEVCLEAR'                   Reset the state after an event is retrieved\n\n\n'KQEVSYSFLAGS'                internal event\n\n\n'KQEVFLAG1'                   internal event\n\n\n'KQEVEOF'                     Filter specific EOF condition\n\n\n'KQEVERROR'                   See return values\n\n\n-- Attribute: kevent.fflags\n\nFilter specific flags.\n\n'KQFILTERREAD' and 'KQFILTERWRITE' filter flags:\n\nConstant                         Meaning\n\n----------------------------------------------------------------------------------\n\n'KQNOTELOWAT'                  low water mark of a socket buffer\n\n\n'KQFILTERVNODE' filter flags:\n\nConstant                         Meaning\n\n----------------------------------------------------------------------------------\n\n'KQNOTEDELETE'                 'unlink()' was called\n\n\n'KQNOTEWRITE'                  a write occurred\n\n\n'KQNOTEEXTEND'                 the file was extended\n\n\n'KQNOTEATTRIB'                 an attribute was changed\n\n\n'KQNOTELINK'                   the link count has changed\n\n\n'KQNOTERENAME'                 the file was renamed\n\n\n'KQNOTEREVOKE'                 access to the file was revoked\n\n\n'KQFILTERPROC' filter flags:\n\nConstant                         Meaning\n\n----------------------------------------------------------------------------------\n\n'KQNOTEEXIT'                   the process has exited\n\n\n'KQNOTEFORK'                   the process has called 'fork()'\n\n\n'KQNOTEEXEC'                   the process has executed a new process\n\n\n'KQNOTEPCTRLMASK'              internal filter flag\n\n\n'KQNOTEPDATAMASK'              internal filter flag\n\n\n'KQNOTETRACK'                  follow a process across 'fork()'\n\n\n'KQNOTECHILD'                  returned on the child process for 'NOTETRACK'\n\n\n'KQNOTETRACKERR'               unable to attach to a child\n\n\n'KQFILTERNETDEV' filter flags (not available on macOS):\n\nConstant                         Meaning\n\n----------------------------------------------------------------------------------\n\n'KQNOTELINKUP'                 link is up\n\n\n'KQNOTELINKDOWN'               link is down\n\n\n'KQNOTELINKINV'                link state is invalid\n\n\n-- Attribute: kevent.data\n\nFilter specific data.\n\n-- Attribute: kevent.udata\n\nUser defined value.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: selectors -- High-level I/O multiplexing,  Next: signal -- Set handlers for asynchronous events,  Prev: select -- Waiting for I/O completion,  Up: Networking and Interprocess Communication": {
            "content": "New in version 3.4.\n\n'Source code:' Lib/selectors.py(1)\n\n\n\n* Menu:\n\n* Introduction: Introduction<8>.\n* Classes: Classes<4>.\n* Examples: Examples<20>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/selectors.py\n\nFile: python3.12.info,  Node: Introduction<8>,  Next: Classes<4>,  Up: selectors -- High-level I/O multiplexing\n\n5.18.5.1 Introduction\n.....................\n",
            "subsections": []
        },
        "This module allows high-level and efficient I/O multiplexing, built upon": {
            "content": "the *note select: bc. module primitives.  Users are encouraged to use\nthis module instead, unless they want precise control over the OS-level\nprimitives used.\n\nIt defines a *note BaseSelector: 312e. abstract base class, along with\nseveral concrete implementations (*note KqueueSelector: 3029, *note",
            "subsections": []
        },
        "EpollSelector: a19....), that can be used to wait for I/O readiness": {
            "content": "notification on multiple file objects.  In the following, \"file object\"\nrefers to any object with a *note fileno(): 2542. method, or a raw file\ndescriptor.  See *note file object: 1037.\n\n*note DefaultSelector: 312f. is an alias to the most efficient\nimplementation available on the current platform: this should be the\ndefault choice for most users.\n\nNote: The type of file objects supported depends on the platform:\non Windows, sockets are supported, but not pipes, whereas on Unix,\nboth are supported (some other types may be supported as well, such\nas fifos or special file devices).\n\nSee also\n........\n\n*note select: bc.\n\nLow-level I/O multiplexing module.\n\n*note Availability: 1ad3.: not Emscripten, not WASI.\n",
            "subsections": []
        },
        "In the following, 'events' is a bitwise mask indicating which I/O events": {
            "content": "should be waited for on a given file object.  It can be a combination of\nthe modules constants below:\n\nConstant                    Meaning\n\n--------------------------------------------------------------------------------\n\n-- Data:                   Available for read\nselectors.EVENTREAD\n\n-- Data:                   Available for write\nselectors.EVENTWRITE\n\n-- Class: selectors.SelectorKey\n\nA *note SelectorKey: 3133. is a *note namedtuple: 711. used to\nassociate a file object to its underlying file descriptor, selected\nevent mask and attached data.  It is returned by several *note\nBaseSelector: 312e. methods.\n\n-- Attribute: fileobj\n\nFile object registered.\n\n-- Attribute: fd\n\nUnderlying file descriptor.\n\n-- Attribute: events\n\nEvents that must be waited for on this file object.\n\n-- Attribute: data\n\nOptional opaque data associated to this file object: for\nexample, this could be used to store a per-client session ID.\n\n-- Class: selectors.BaseSelector\n\nA *note BaseSelector: 312e. is used to wait for I/O event readiness\non multiple file objects.  It supports file stream registration,\nunregistration, and a method to wait for I/O events on those\nstreams, with an optional timeout.  It's an abstract base class, so\ncannot be instantiated.  Use *note DefaultSelector: 312f. instead,\nor one of *note SelectSelector: 3026, *note KqueueSelector: 3029.\netc.  if you want to specifically use an implementation, and your\nplatform supports it.  *note BaseSelector: 312e. and its concrete\nimplementations support the *note context manager: 398. protocol.\n\n-- Method: abstractmethod register (fileobj, events, data=None)\n\nRegister a file object for selection, monitoring it for I/O\nevents.\n\n'fileobj' is the file object to monitor.  It may either be an\ninteger file descriptor or an object with a 'fileno()' method.\n'events' is a bitwise mask of events to monitor.  'data' is an\nopaque object.\n\nThis returns a new *note SelectorKey: 3133. instance, or\nraises a *note ValueError: 183. in case of invalid event mask\nor file descriptor, or *note KeyError: 8cf. if the file object\nis already registered.\n\n-- Method: abstractmethod unregister (fileobj)\n\nUnregister a file object from selection, removing it from\nmonitoring.  A file object shall be unregistered prior to\nbeing closed.\n\n'fileobj' must be a file object previously registered.\n\nThis returns the associated *note SelectorKey: 3133. instance,\nor raises a *note KeyError: 8cf. if 'fileobj' is not\nregistered.  It will raise *note ValueError: 183. if 'fileobj'\nis invalid (e.g.  it has no 'fileno()' method or its\n'fileno()' method has an invalid return value).\n\n-- Method: modify (fileobj, events, data=None)\n\nChange a registered file object's monitored events or attached\ndata.\n\nThis is equivalent to 'BaseSelector.unregister(fileobj)'\nfollowed by 'BaseSelector.register(fileobj, events, data)',\nexcept that it can be implemented more efficiently.\n\nThis returns a new *note SelectorKey: 3133. instance, or\nraises a *note ValueError: 183. in case of invalid event mask\nor file descriptor, or *note KeyError: 8cf. if the file object\nis not registered.\n\n-- Method: abstractmethod select (timeout=None)\n\nWait until some registered file objects become ready, or the\ntimeout expires.\n\nIf 'timeout > 0', this specifies the maximum wait time, in\nseconds.  If 'timeout <= 0', the call won't block, and will\nreport the currently ready file objects.  If 'timeout' is\n'None', the call will block until a monitored file object\nbecomes ready.\n\nThis returns a list of '(key, events)' tuples, one for each\nready file object.\n\n'key' is the *note SelectorKey: 3133. instance corresponding\nto a ready file object.  'events' is a bitmask of events ready\non this file object.\n\nNote: This method can return before any file object\nbecomes ready or the timeout has elapsed if the current\nprocess receives a signal: in this case, an empty list\nwill be returned.\n\nChanged in version 3.5: The selector is now retried with a\nrecomputed timeout when interrupted by a signal if the signal\nhandler did not raise an exception (see PEP 475(1) for the\nrationale), instead of returning an empty list of events\nbefore the timeout.\n\n-- Method: close ()\n\nClose the selector.\n\nThis must be called to make sure that any underlying resource\nis freed.  The selector shall not be used once it has been\nclosed.\n\n-- Method: getkey (fileobj)\n\nReturn the key associated with a registered file object.\n\nThis returns the *note SelectorKey: 3133. instance associated\nto this file object, or raises *note KeyError: 8cf. if the\nfile object is not registered.\n\n-- Method: abstractmethod getmap ()\n\nReturn a mapping of file objects to selector keys.\n\nThis returns a *note Mapping: 6e2. instance mapping registered\nfile objects to their associated *note SelectorKey: 3133.\ninstance.\n\n-- Class: selectors.DefaultSelector\n\nThe default selector class, using the most efficient implementation\navailable on the current platform.  This should be the default\nchoice for most users.\n\n-- Class: selectors.SelectSelector\n\n*note select.select(): bfc.-based selector.\n\n-- Class: selectors.PollSelector\n\n*note select.poll(): 28a8.-based selector.\n\n-- Class: selectors.EpollSelector\n\n*note select.epoll(): e03.-based selector.\n\n-- Method: fileno ()\n\nThis returns the file descriptor used by the underlying *note\nselect.epoll(): e03. object.\n\n-- Class: selectors.DevpollSelector\n\n*note select.devpoll(): e05.-based selector.\n\n-- Method: fileno ()\n\nThis returns the file descriptor used by the underlying *note\nselect.devpoll(): e05. object.\n\nNew in version 3.5.\n\n-- Class: selectors.KqueueSelector\n\n*note select.kqueue(): 13f3.-based selector.\n\n-- Method: fileno ()\n\nThis returns the file descriptor used by the underlying *note\nselect.kqueue(): 13f3. object.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0475/\n\nFile: python3.12.info,  Node: Examples<20>,  Prev: Classes<4>,  Up: selectors -- High-level I/O multiplexing\n\n5.18.5.3 Examples\n.................\n\nHere is a simple echo server implementation:\n\nimport selectors\nimport socket\n\nsel = selectors.DefaultSelector()\n\ndef accept(sock, mask):\nconn, addr = sock.accept()  # Should be ready\nprint('accepted', conn, 'from', addr)\nconn.setblocking(False)\nsel.register(conn, selectors.EVENTREAD, read)\n\ndef read(conn, mask):\ndata = conn.recv(1000)  # Should be ready\nif data:\nprint('echoing', repr(data), 'to', conn)\nconn.send(data)  # Hope it won't block\nelse:\nprint('closing', conn)\nsel.unregister(conn)\nconn.close()\n\nsock = socket.socket()\nsock.bind(('localhost', 1234))\nsock.listen(100)\nsock.setblocking(False)\nsel.register(sock, selectors.EVENTREAD, accept)\n\nwhile True:\nevents = sel.select()\nfor key, mask in events:\ncallback = key.data\ncallback(key.fileobj, mask)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: signal -- Set handlers for asynchronous events,  Next: mmap -- Memory-mapped file support,  Prev: selectors -- High-level I/O multiplexing,  Up: Networking and Interprocess Communication": {
            "content": "'Source code:' Lib/signal.py(1)\n\n\n\nThis module provides mechanisms to use signal handlers in Python.\n\n* Menu:\n\n* General rules::\n* Module contents: Module contents<2>.\n* Examples: Examples<21>.\n* Note on SIGPIPE::\n* Note on Signal Handlers and Exceptions::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/signal.py\n\nFile: python3.12.info,  Node: General rules,  Next: Module contents<2>,  Up: signal -- Set handlers for asynchronous events\n\n5.18.6.1 General rules\n......................\n\nThe *note signal.signal(): fa6. function allows defining custom handlers\nto be executed when a signal is received.  A small number of default\nhandlers are installed: *note SIGPIPE: 3145. is ignored (so write errors\non pipes and sockets can be reported as ordinary Python exceptions) and\n*note SIGINT: 63a. is translated into a *note KeyboardInterrupt: 7f5.\nexception if the parent process has not changed it.\n\nA handler for a particular signal, once set, remains installed until it\nis explicitly reset (Python emulates the BSD style interface regardless\nof the underlying implementation), with the exception of the handler for\n*note SIGCHLD: 28e2, which follows the underlying implementation.\n",
            "subsections": []
        },
        "On WebAssembly platforms 'wasm32-emscripten' and 'wasm32-wasi', signals": {
            "content": "are emulated and therefore behave differently.  Several functions and\nsignals are not available on these platforms.\n\n* Menu:\n\n* Execution of Python signal handlers::\n* Signals and threads::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Execution of Python signal handlers,  Next: Signals and threads,  Up: General rules": {
            "content": "5.18.6.2 Execution of Python signal handlers\n............................................\n\nA Python signal handler does not get executed inside the low-level (C)\nsignal handler.  Instead, the low-level signal handler sets a flag which\ntells the *note virtual machine: 3147. to execute the corresponding\nPython signal handler at a later point(for example at the next *note\nbytecode: 370. instruction).  This has consequences:\n\n* It makes little sense to catch synchronous errors like *note\nSIGFPE: 1aca. or *note SIGSEGV: 1ac9. that are caused by an invalid\noperation in C code.  Python will return from the signal handler to\nthe C code, which is likely to raise the same signal again, causing\nPython to apparently hang.  From Python 3.3 onwards, you can use\nthe *note faulthandler: 53. module to report on synchronous errors.\n\n* A long-running calculation implemented purely in C (such as regular\nexpression matching on a large body of text) may run uninterrupted\nfor an arbitrary amount of time, regardless of any signals\nreceived.  The Python signal handlers will be called when the\ncalculation finishes.\n\n* If the handler raises an exception, it will be raised \"out of thin\nair\" in the main thread.  See the *note note below: 1f98. for a\ndiscussion.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Signals and threads,  Prev: Execution of Python signal handlers,  Up: General rules": {
            "content": "5.18.6.3 Signals and threads\n............................\n",
            "subsections": []
        },
        "Python signal handlers are always executed in the main Python thread of": {
            "content": "the main interpreter, even if the signal was received in another thread.",
            "subsections": []
        },
        "This means that signals can't be used as a means of inter-thread": {
            "content": "communication.  You can use the synchronization primitives from the\n*note threading: e7. module instead.\n",
            "subsections": []
        },
        "Besides, only the main thread of the main interpreter is allowed to set": {
            "content": "a new signal handler.\n\nFile: python3.12.info,  Node: Module contents<2>,  Next: Examples<21>,  Prev: General rules,  Up: signal -- Set handlers for asynchronous events\n\n5.18.6.4 Module contents\n........................\n\nChanged in version 3.5: signal (SIG*), handler (*note SIGDFL: 1583,\n*note SIGIGN: 1582.) and sigmask (*note SIGBLOCK: 314b, *note\nSIGUNBLOCK: 314c, *note SIGSETMASK: 314d.) related constants listed\nbelow were turned into *note enums: b2e. (*note Signals: 314e, *note\nHandlers: 314f. and *note Sigmasks: 3150. respectively).  *note\ngetsignal(): 13cd, *note pthreadsigmask(): fa2, *note sigpending():\nfa4. and *note sigwait(): fa5. functions return human-readable *note\nenums: b2e. as *note Signals: 314e. objects.\n\nThe signal module defines three enums:\n\n-- Class: signal.Signals\n\n*note enum.IntEnum: b2e. collection of SIG* constants and the\nCTRL* constants.\n\nNew in version 3.5.\n\n-- Class: signal.Handlers\n\n*note enum.IntEnum: b2e. collection the constants *note SIGDFL:\n1583. and *note SIGIGN: 1582.\n\nNew in version 3.5.\n\n-- Class: signal.Sigmasks\n\n*note enum.IntEnum: b2e. collection the constants *note SIGBLOCK:\n314b, *note SIGUNBLOCK: 314c. and *note SIGSETMASK: 314d.\n\n*note Availability: 1ad3.: Unix.\n\nSee the man page 'sigprocmask(2)' and 'pthreadsigmask(3)' for\nfurther information.\n\nNew in version 3.5.\n\nThe variables defined in the *note signal: c1. module are:\n\n-- Data: signal.SIGDFL\n\nThis is one of two standard signal handling options; it will simply\nperform the default function for the signal.  For example, on most\nsystems the default action for 'SIGQUIT' is to dump core and exit,\nwhile the default action for *note SIGCHLD: 28e2. is to simply\nignore it.\n\n-- Data: signal.SIGIGN\n\nThis is another standard signal handler, which will simply ignore\nthe given signal.\n\n-- Data: signal.SIGABRT\n\nAbort signal from 'abort(3)'.\n\n-- Data: signal.SIGALRM\n\nTimer signal from 'alarm(2)'.\n\n*note Availability: 1ad3.: Unix.\n\n-- Data: signal.SIGBREAK\n\nInterrupt from keyboard (CTRL + BREAK).\n\n*note Availability: 1ad3.: Windows.\n\n-- Data: signal.SIGBUS\n\nBus error (bad memory access).\n\n*note Availability: 1ad3.: Unix.\n\n-- Data: signal.SIGCHLD\n\nChild process stopped or terminated.\n\n*note Availability: 1ad3.: Unix.\n\n-- Data: signal.SIGCLD\n\nAlias to *note SIGCHLD: 28e2.\n\n*note Availability: 1ad3.: not macOS.\n\n-- Data: signal.SIGCONT\n\nContinue the process if it is currently stopped\n\n*note Availability: 1ad3.: Unix.\n\n-- Data: signal.SIGFPE\n\nFloating-point exception.  For example, division by zero.\n\nSee also\n........\n\n*note ZeroDivisionError: 763. is raised when the second argument of\na division or modulo operation is zero.\n\n-- Data: signal.SIGHUP\n\nHangup detected on controlling terminal or death of controlling\nprocess.\n\n*note Availability: 1ad3.: Unix.\n\n-- Data: signal.SIGILL\n\nIllegal instruction.\n\n-- Data: signal.SIGINT\n\nInterrupt from keyboard (CTRL + C).\n\nDefault action is to raise *note KeyboardInterrupt: 7f5.\n\n-- Data: signal.SIGKILL\n\nKill signal.\n\nIt cannot be caught, blocked, or ignored.\n\n*note Availability: 1ad3.: Unix.\n\n-- Data: signal.SIGPIPE\n\nBroken pipe: write to pipe with no readers.\n\nDefault action is to ignore the signal.\n\n*note Availability: 1ad3.: Unix.\n\n-- Data: signal.SIGSEGV\n\nSegmentation fault: invalid memory reference.\n\n-- Data: signal.SIGSTKFLT\n\nStack fault on coprocessor.  The Linux kernel does not raise\nthis signal: it can only be raised in user space.\n\n*note Availability: 1ad3.: Linux.\n\nOn architectures where the signal is available.  See the man page\n'signal(7)' for further information.\n\nNew in version 3.11.\n\n-- Data: signal.SIGTERM\n\nTermination signal.\n\n-- Data: signal.SIGUSR1\n\nUser-defined signal 1.\n\n*note Availability: 1ad3.: Unix.\n\n-- Data: signal.SIGUSR2\n\nUser-defined signal 2.\n\n*note Availability: 1ad3.: Unix.\n\n-- Data: signal.SIGWINCH\n\nWindow resize signal.\n\n*note Availability: 1ad3.: Unix.\n\n-- Data: SIG*\n\nAll the signal numbers are defined symbolically.  For example, the\nhangup signal is defined as *note signal.SIGHUP: 3154.; the\nvariable names are identical to the names used in C programs, as\nfound in '<signal.h>'.  The Unix man page for ''signal()'' lists\nthe existing signals (on some systems this is 'signal(2)', on\nothers the list is in 'signal(7)').  Note that not all systems\ndefine the same set of signal names; only those names defined by\nthe system are defined by this module.\n\n-- Data: signal.CTRLCEVENT\n\nThe signal corresponding to the 'Ctrl+C' keystroke event.  This\nsignal can only be used with *note os.kill(): 11db.\n\n*note Availability: 1ad3.: Windows.\n\nNew in version 3.2.\n\n-- Data: signal.CTRLBREAKEVENT\n\nThe signal corresponding to the 'Ctrl+Break' keystroke event.  This\nsignal can only be used with *note os.kill(): 11db.\n\n*note Availability: 1ad3.: Windows.\n\nNew in version 3.2.\n\n-- Data: signal.NSIG\n\nOne more than the number of the highest signal number.  Use *note\nvalidsignals(): 3159. to get valid signal numbers.\n\n-- Data: signal.ITIMERREAL\n\nDecrements interval timer in real time, and delivers *note SIGALRM:\n3151. upon expiration.\n\n-- Data: signal.ITIMERVIRTUAL\n\nDecrements interval timer only when the process is executing, and\ndelivers SIGVTALRM upon expiration.\n\n-- Data: signal.ITIMERPROF\n\nDecrements interval timer both when the process executes and when\nthe system is executing on behalf of the process.  Coupled with\nITIMERVIRTUAL, this timer is usually used to profile the time\nspent by the application in user and kernel space.  SIGPROF is\ndelivered upon expiration.\n\n-- Data: signal.SIGBLOCK\n\nA possible value for the 'how' parameter to *note\npthreadsigmask(): fa2. indicating that signals are to be blocked.\n\nNew in version 3.3.\n\n-- Data: signal.SIGUNBLOCK\n\nA possible value for the 'how' parameter to *note\npthreadsigmask(): fa2. indicating that signals are to be\nunblocked.\n\nNew in version 3.3.\n\n-- Data: signal.SIGSETMASK\n\nA possible value for the 'how' parameter to *note\npthreadsigmask(): fa2. indicating that the signal mask is to be\nreplaced.\n\nNew in version 3.3.\n\nThe *note signal: c1. module defines one exception:\n\n-- Exception: signal.ItimerError\n\nRaised to signal an error from the underlying *note setitimer():\n315e. or *note getitimer(): 315f. implementation.  Expect this\nerror if an invalid interval timer or a negative time is passed to\n*note setitimer(): 315e.  This error is a subtype of *note OSError:\n613.\n\nNew in version 3.3: This error used to be a subtype of *note\nIOError: ecb, which is now an alias of *note OSError: 613.\n\nThe *note signal: c1. module defines the following functions:\n\n-- Function: signal.alarm (time)\n\nIf 'time' is non-zero, this function requests that a *note SIGALRM:\n3151. signal be sent to the process in 'time' seconds.  Any\npreviously scheduled alarm is canceled (only one alarm can be\nscheduled at any time).  The returned value is then the number of\nseconds before any previously set alarm was to have been delivered.\nIf 'time' is zero, no alarm is scheduled, and any scheduled alarm\nis canceled.  If the return value is zero, no alarm is currently\nscheduled.\n\n*note Availability: 1ad3.: Unix.\n\nSee the man page 'alarm(2)' for further information.\n\n-- Function: signal.getsignal (signalnum)\n\nReturn the current signal handler for the signal 'signalnum'.  The\nreturned value may be a callable Python object, or one of the\nspecial values *note signal.SIGIGN: 1582, *note signal.SIGDFL:\n1583. or *note None: 43f.  Here, *note signal.SIGIGN: 1582. means\nthat the signal was previously ignored, *note signal.SIGDFL: 1583.\nmeans that the default way of handling the signal was previously in\nuse, and 'None' means that the previous signal handler was not\ninstalled from Python.\n\n-- Function: signal.strsignal (signalnum)\n\nReturns the description of signal 'signalnum', such as \"Interrupt\"\nfor *note SIGINT: 63a.  Returns *note None: 43f. if 'signalnum' has\nno description.  Raises *note ValueError: 183. if 'signalnum' is\ninvalid.\n\nNew in version 3.8.\n\n-- Function: signal.validsignals ()\n\nReturn the set of valid signal numbers on this platform.  This can\nbe less than 'range(1, NSIG)' if some signals are reserved by the\nsystem for internal use.\n\nNew in version 3.8.\n\n-- Function: signal.pause ()\n\nCause the process to sleep until a signal is received; the\nappropriate handler will then be called.  Returns nothing.\n\n*note Availability: 1ad3.: Unix.\n\nSee the man page 'signal(2)' for further information.\n\nSee also *note sigwait(): fa5, *note sigwaitinfo(): c07, *note\nsigtimedwait(): c06. and *note sigpending(): fa4.\n\n-- Function: signal.raisesignal (signum)\n\nSends a signal to the calling process.  Returns nothing.\n\nNew in version 3.8.\n\n-- Function: signal.pidfdsendsignal (pidfd, sig, siginfo=None,\nflags=0)\n\nSend signal 'sig' to the process referred to by file descriptor\n'pidfd'.  Python does not currently support the 'siginfo'\nparameter; it must be 'None'.  The 'flags' argument is provided for\nfuture extensions; no flag values are currently defined.\n\nSee the 'pidfdsendsignal(2)' man page for more information.\n\n*note Availability: 1ad3.: Linux >= 5.1\n\nNew in version 3.9.\n\n-- Function: signal.pthreadkill (threadid, signalnum)\n\nSend the signal 'signalnum' to the thread 'threadid', another\nthread in the same process as the caller.  The target thread can be\nexecuting any code (Python or not).  However, if the target thread\nis executing the Python interpreter, the Python signal handlers\nwill be *note executed by the main thread of the main interpreter:\n3149.  Therefore, the only point of sending a signal to a\nparticular Python thread would be to force a running system call to\nfail with *note InterruptedError: be3.\n\nUse *note threading.getident(): fcf. or the *note ident: 2939.\nattribute of *note threading.Thread: 76c. objects to get a suitable\nvalue for 'threadid'.\n\nIf 'signalnum' is 0, then no signal is sent, but error checking is\nstill performed; this can be used to check if the target thread is\nstill running.\n\nRaises an *note auditing event: 161d. 'signal.pthreadkill' with\narguments 'threadid', 'signalnum'.\n\n*note Availability: 1ad3.: Unix.\n\nSee the man page 'pthreadkill(3)' for further information.\n\nSee also *note os.kill(): 11db.\n\nNew in version 3.3.\n\n-- Function: signal.pthreadsigmask (how, mask)\n\nFetch and/or change the signal mask of the calling thread.  The\nsignal mask is the set of signals whose delivery is currently\nblocked for the caller.  Return the old signal mask as a set of\nsignals.\n\nThe behavior of the call is dependent on the value of 'how', as\nfollows.\n\n* *note SIGBLOCK: 314b.: The set of blocked signals is the\nunion of the current set and the 'mask' argument.\n\n* *note SIGUNBLOCK: 314c.: The signals in 'mask' are removed\nfrom the current set of blocked signals.  It is permissible to\nattempt to unblock a signal which is not blocked.\n\n* *note SIGSETMASK: 314d.: The set of blocked signals is set to\nthe 'mask' argument.\n\n'mask' is a set of signal numbers (e.g.  {*note signal.SIGINT: 63a,\n*note signal.SIGTERM: 1234.}).  Use *note validsignals(): 3159.\nfor a full mask including all signals.\n\nFor example, 'signal.pthreadsigmask(signal.SIGBLOCK, [])' reads\nthe signal mask of the calling thread.\n\n*note SIGKILL: 3155. and 'SIGSTOP' cannot be blocked.\n\n*note Availability: 1ad3.: Unix.\n\nSee the man page 'sigprocmask(2)' and 'pthreadsigmask(3)' for\nfurther information.\n\nSee also *note pause(): 3161, *note sigpending(): fa4. and *note\nsigwait(): fa5.\n\nNew in version 3.3.\n\n-- Function: signal.setitimer (which, seconds, interval=0.0)\n\nSets given interval timer (one of *note signal.ITIMERREAL: 315a,\n*note signal.ITIMERVIRTUAL: 315b. or *note signal.ITIMERPROF:\n315c.) specified by 'which' to fire after 'seconds' (float is\naccepted, different from *note alarm(): 3160.) and after that every\n'interval' seconds (if 'interval' is non-zero).  The interval timer\nspecified by 'which' can be cleared by setting 'seconds' to zero.\n\nWhen an interval timer fires, a signal is sent to the process.  The\nsignal sent is dependent on the timer being used; *note\nsignal.ITIMERREAL: 315a. will deliver *note SIGALRM: 3151, *note\nsignal.ITIMERVIRTUAL: 315b. sends 'SIGVTALRM', and *note\nsignal.ITIMERPROF: 315c. will deliver 'SIGPROF'.\n\nThe old values are returned as a tuple: (delay, interval).\n\nAttempting to pass an invalid interval timer will cause an *note\nItimerError: 315d.\n\n*note Availability: 1ad3.: Unix.\n\n-- Function: signal.getitimer (which)\n\nReturns current value of a given interval timer specified by\n'which'.\n\n*note Availability: 1ad3.: Unix.\n\n-- Function: signal.setwakeupfd (fd, *, warnonfullbuffer=True)\n\nSet the wakeup file descriptor to 'fd'.  When a signal is received,\nthe signal number is written as a single byte into the fd.  This\ncan be used by a library to wakeup a poll or select call, allowing\nthe signal to be fully processed.\n\nThe old wakeup fd is returned (or -1 if file descriptor wakeup was\nnot enabled).  If 'fd' is -1, file descriptor wakeup is disabled.\nIf not -1, 'fd' must be non-blocking.  It is up to the library to\nremove any bytes from 'fd' before calling poll or select again.\n\nWhen threads are enabled, this function can only be called from\n*note the main thread of the main interpreter: 3149.; attempting to\ncall it from other threads will cause a *note ValueError: 183.\nexception to be raised.\n\nThere are two common ways to use this function.  In both\napproaches, you use the fd to wake up when a signal arrives, but\nthen they differ in how they determine 'which' signal or signals\nhave arrived.\n\nIn the first approach, we read the data out of the fd's buffer, and\nthe byte values give you the signal numbers.  This is simple, but\nin rare cases it can run into a problem: generally the fd will have\na limited amount of buffer space, and if too many signals arrive\ntoo quickly, then the buffer may become full, and some signals may\nbe lost.  If you use this approach, then you should set\n'warnonfullbuffer=True', which will at least cause a warning to\nbe printed to stderr when signals are lost.\n\nIn the second approach, we use the wakeup fd 'only' for wakeups,\nand ignore the actual byte values.  In this case, all we care about\nis whether the fd's buffer is empty or non-empty; a full buffer\ndoesn't indicate a problem at all.  If you use this approach, then\nyou should set 'warnonfullbuffer=False', so that your users are\nnot confused by spurious warning messages.\n\nChanged in version 3.5: On Windows, the function now also supports\nsocket handles.\n\nChanged in version 3.7: Added 'warnonfullbuffer' parameter.\n\n-- Function: signal.siginterrupt (signalnum, flag)\n\nChange system call restart behaviour: if 'flag' is *note False:\n971, system calls will be restarted when interrupted by signal\n'signalnum', otherwise system calls will be interrupted.  Returns\nnothing.\n\n*note Availability: 1ad3.: Unix.\n\nSee the man page 'siginterrupt(3)' for further information.\n\nNote that installing a signal handler with *note signal(): c1. will\nreset the restart behaviour to interruptible by implicitly calling\n'siginterrupt()' with a true 'flag' value for the given signal.\n\n-- Function: signal.signal (signalnum, handler)\n\nSet the handler for signal 'signalnum' to the function 'handler'.\n'handler' can be a callable Python object taking two arguments (see\nbelow), or one of the special values *note signal.SIGIGN: 1582. or\n*note signal.SIGDFL: 1583.  The previous signal handler will be\nreturned (see the description of *note getsignal(): 13cd. above).\n(See the Unix man page 'signal(2)' for further information.)\n\nWhen threads are enabled, this function can only be called from\n*note the main thread of the main interpreter: 3149.; attempting to\ncall it from other threads will cause a *note ValueError: 183.\nexception to be raised.\n\nThe 'handler' is called with two arguments: the signal number and\nthe current stack frame ('None' or a frame object; for a\ndescription of frame objects, see the *note description in the type\nhierarchy: 4af. or see the attribute descriptions in the *note\ninspect: 78. module).\n\nOn Windows, *note signal(): c1. can only be called with *note\nSIGABRT: 1acb, *note SIGFPE: 1aca, *note SIGILL: 1acd, *note\nSIGINT: 63a, *note SIGSEGV: 1ac9, *note SIGTERM: 1234, or *note\nSIGBREAK: 3152.  A *note ValueError: 183. will be raised in any\nother case.  Note that not all systems define the same set of\nsignal names; an *note AttributeError: 395. will be raised if a\nsignal name is not defined as 'SIG*' module level constant.\n\n-- Function: signal.sigpending ()\n\nExamine the set of signals that are pending for delivery to the\ncalling thread (i.e., the signals which have been raised while\nblocked).  Return the set of the pending signals.\n\n*note Availability: 1ad3.: Unix.\n\nSee the man page 'sigpending(2)' for further information.\n\nSee also *note pause(): 3161, *note pthreadsigmask(): fa2. and\n*note sigwait(): fa5.\n\nNew in version 3.3.\n\n-- Function: signal.sigwait (sigset)\n\nSuspend execution of the calling thread until the delivery of one\nof the signals specified in the signal set 'sigset'.  The function\naccepts the signal (removes it from the pending list of signals),\nand returns the signal number.\n\n*note Availability: 1ad3.: Unix.\n\nSee the man page 'sigwait(3)' for further information.\n\nSee also *note pause(): 3161, *note pthreadsigmask(): fa2, *note\nsigpending(): fa4, *note sigwaitinfo(): c07. and *note\nsigtimedwait(): c06.\n\nNew in version 3.3.\n\n-- Function: signal.sigwaitinfo (sigset)\n\nSuspend execution of the calling thread until the delivery of one\nof the signals specified in the signal set 'sigset'.  The function\naccepts the signal and removes it from the pending list of signals.\nIf one of the signals in 'sigset' is already pending for the\ncalling thread, the function will return immediately with\ninformation about that signal.  The signal handler is not called\nfor the delivered signal.  The function raises an *note\nInterruptedError: be3. if it is interrupted by a signal that is not\nin 'sigset'.\n\nThe return value is an object representing the data contained in\nthe 'siginfot' structure, namely: 'sisigno', 'sicode',\n'sierrno', 'sipid', 'siuid', 'sistatus', 'siband'.\n\n*note Availability: 1ad3.: Unix.\n\nSee the man page 'sigwaitinfo(2)' for further information.\n\nSee also *note pause(): 3161, *note sigwait(): fa5. and *note\nsigtimedwait(): c06.\n\nNew in version 3.3.\n\nChanged in version 3.5: The function is now retried if interrupted\nby a signal not in 'sigset' and the signal handler does not raise\nan exception (see PEP 475(1) for the rationale).\n\n-- Function: signal.sigtimedwait (sigset, timeout)\n\nLike *note sigwaitinfo(): c07, but takes an additional 'timeout'\nargument specifying a timeout.  If 'timeout' is specified as '0', a\npoll is performed.  Returns *note None: 43f. if a timeout occurs.\n\n*note Availability: 1ad3.: Unix.\n\nSee the man page 'sigtimedwait(2)' for further information.\n\nSee also *note pause(): 3161, *note sigwait(): fa5. and *note\nsigwaitinfo(): c07.\n\nNew in version 3.3.\n\nChanged in version 3.5: The function is now retried with the\nrecomputed 'timeout' if interrupted by a signal not in 'sigset' and\nthe signal handler does not raise an exception (see PEP 475(2) for\nthe rationale).\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0475/\n\n(2) https://peps.python.org/pep-0475/\n\nFile: python3.12.info,  Node: Examples<21>,  Next: Note on SIGPIPE,  Prev: Module contents<2>,  Up: signal -- Set handlers for asynchronous events\n\n5.18.6.5 Examples\n.................\n\nHere is a minimal example program.  It uses the *note alarm(): 3160.\nfunction to limit the time spent waiting to open a file; this is useful\nif the file is for a serial device that may not be turned on, which\nwould normally cause the *note os.open(): bee. to hang indefinitely.",
            "subsections": []
        },
        "The solution is to set a 5-second alarm before opening the file; if the": {
            "content": "operation takes too long, the alarm signal will be sent, and the handler\nraises an exception.\n\nimport signal, os\n\ndef handler(signum, frame):\nsigname = signal.Signals(signum).name\nprint(f'Signal handler called with signal {signame} ({signum})')\nraise OSError(\"Couldn't open device!\")\n\n# Set the signal handler and a 5-second alarm\nsignal.signal(signal.SIGALRM, handler)\nsignal.alarm(5)\n\n# This open() may hang indefinitely\nfd = os.open('/dev/ttyS0', os.ORDWR)\n\nsignal.alarm(0)          # Disable the alarm\n\nFile: python3.12.info,  Node: Note on SIGPIPE,  Next: Note on Signal Handlers and Exceptions,  Prev: Examples<21>,  Up: signal -- Set handlers for asynchronous events\n\n5.18.6.6 Note on SIGPIPE\n........................\n\nPiping output of your program to tools like 'head(1)' will cause a *note\nSIGPIPE: 3145. signal to be sent to your process when the receiver of\nits standard output closes early.  This results in an exception like\n'BrokenPipeError: [Errno 32] Broken pipe'.  To handle this case, wrap\nyour entry point to catch this exception as follows:\n\nimport os\nimport sys\n\ndef main():\ntry:\n# simulate large output (your code replaces this loop)\nfor x in range(10000):\nprint(\"y\")\n# flush output here to force SIGPIPE to be triggered\n# while inside this try block.\nsys.stdout.flush()\nexcept BrokenPipeError:\n# Python flushes standard streams on exit; redirect remaining output\n# to devnull to avoid another BrokenPipeError at shutdown\ndevnull = os.open(os.devnull, os.OWRONLY)\nos.dup2(devnull, sys.stdout.fileno())\nsys.exit(1)  # Python exits with error code 1 on EPIPE\n\nif name == 'main':\nmain()\n\nDo not set *note SIGPIPE: 3145.'s disposition to *note SIGDFL: 1583. in\norder to avoid *note BrokenPipeError: ed5.  Doing that would cause your\nprogram to exit unexpectedly whenever any socket connection is\ninterrupted while your program is still writing to it.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Note on Signal Handlers and Exceptions,  Prev: Note on SIGPIPE,  Up: signal -- Set handlers for asynchronous events": {
            "content": "5.18.6.7 Note on Signal Handlers and Exceptions\n...............................................\n",
            "subsections": []
        },
        "If a signal handler raises an exception, the exception will be": {
            "content": "propagated to the main thread and may be raised after any *note\nbytecode: 370. instruction.  Most notably, a *note KeyboardInterrupt:\n7f5. may appear at any point during execution.  Most Python code,\nincluding the standard library, cannot be made robust against this, and\nso a *note KeyboardInterrupt: 7f5. (or any other exception resulting\nfrom a signal handler) may on rare occasions put the program in an\nunexpected state.\n\nTo illustrate this issue, consider the following code:\n\nclass SpamContext:\ndef init(self):\nself.lock = threading.Lock()\n\ndef enter(self):\n# If KeyboardInterrupt occurs here, everything is fine\nself.lock.acquire()\n# If KeyboardInterrupt occurs here, exit will not be called\n...\n# KeyboardInterrupt could occur just before the function returns\n\ndef exit(self, exctype, excval, exctb):\n...\nself.lock.release()\n\nFor many programs, especially those that merely want to exit on *note",
            "subsections": []
        },
        "KeyboardInterrupt: 7f5, this is not a problem, but applications that are": {
            "content": "complex or require high reliability should avoid raising exceptions from\nsignal handlers.  They should also avoid catching *note\nKeyboardInterrupt: 7f5. as a means of gracefully shutting down.\nInstead, they should install their own *note SIGINT: 63a. handler.\nBelow is an example of an HTTP server that avoids *note\nKeyboardInterrupt: 7f5.:\n\nimport signal\nimport socket\nfrom selectors import DefaultSelector, EVENTREAD\nfrom http.server import HTTPServer, SimpleHTTPRequestHandler\n\ninterruptread, interruptwrite = socket.socketpair()\n\ndef handler(signum, frame):\nprint('Signal handler called with signal', signum)\ninterruptwrite.send(b'\\0')\nsignal.signal(signal.SIGINT, handler)\n\ndef serveforever(httpd):\nsel = DefaultSelector()\nsel.register(interruptread, EVENTREAD)\nsel.register(httpd, EVENTREAD)\n\nwhile True:\nfor key,  in sel.select():\nif key.fileobj == interruptread:\ninterruptread.recv(1)\nreturn\nif key.fileobj == httpd:\nhttpd.handlerequest()\n\nprint(\"Serving on port 8000\")\nhttpd = HTTPServer(('', 8000), SimpleHTTPRequestHandler)\nserveforever(httpd)\nprint(\"Shutdown...\")\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: mmap -- Memory-mapped file support,  Prev: signal -- Set handlers for asynchronous events,  Up: Networking and Interprocess Communication": {
            "content": "*note Availability: 1ad3.: not Emscripten, not WASI.\n",
            "subsections": []
        },
        "For both the Unix and Windows versions of the constructor, 'access' may": {
            "content": "be specified as an optional keyword parameter.  'access' accepts one of\nfour values: 'ACCESSREAD', 'ACCESSWRITE', or 'ACCESSCOPY' to specify\nread-only, write-through or copy-on-write memory respectively, or\n'ACCESSDEFAULT' to defer to 'prot'.  'access' can be used on both Unix\nand Windows.  If 'access' is not specified, Windows mmap returns a\nwrite-through mapping.  The initial memory values for all three access\ntypes are taken from the specified file.  Assignment to an 'ACCESSREAD'\nmemory map raises a *note TypeError: 28e. exception.  Assignment to an\n'ACCESSWRITE' memory map affects both memory and the underlying file.",
            "subsections": []
        },
        "Assignment to an 'ACCESSCOPY' memory map affects memory but does not": {
            "content": "update the underlying file.\n\nChanged in version 3.7: Added 'ACCESSDEFAULT' constant.\n",
            "subsections": []
        },
        "To map anonymous memory, -1 should be passed as the fileno along with": {
            "content": "the length.\n\n-- Class: mmap.mmap (fileno, length, tagname=None,\naccess=ACCESSDEFAULT[, offset])\n\n'(Windows version)' Maps 'length' bytes from the file specified by\nthe file handle 'fileno', and creates a mmap object.  If 'length'\nis larger than the current size of the file, the file is extended\nto contain 'length' bytes.  If 'length' is '0', the maximum length\nof the map is the current size of the file, except that if the file\nis empty Windows raises an exception (you cannot create an empty\nmapping on Windows).\n\n'tagname', if specified and not 'None', is a string giving a tag\nname for the mapping.  Windows allows you to have many different\nmappings against the same file.  If you specify the name of an\nexisting tag, that tag is opened, otherwise a new tag of this name\nis created.  If this parameter is omitted or 'None', the mapping is\ncreated without a name.  Avoiding the use of the 'tagname'\nparameter will assist in keeping your code portable between Unix\nand Windows.\n\n'offset' may be specified as a non-negative integer offset.  mmap\nreferences will be relative to the offset from the beginning of the\nfile.  'offset' defaults to 0.  'offset' must be a multiple of the\n'ALLOCATIONGRANULARITY'.\n\nRaises an *note auditing event: 161d. 'mmap.new' with arguments\n'fileno', 'length', 'access', 'offset'.\n\n-- Class: mmap.mmap (fileno, length, flags=MAPSHARED,\nprot=PROTWRITE|PROTREAD, access=ACCESSDEFAULT[, offset])\n\n'(Unix version)' Maps 'length' bytes from the file specified by the\nfile descriptor 'fileno', and returns a mmap object.  If 'length'\nis '0', the maximum length of the map will be the current size of\nthe file when *note mmap: 830. is called.\n\n'flags' specifies the nature of the mapping.  *note MAPPRIVATE:\n3168. creates a private copy-on-write mapping, so changes to the\ncontents of the mmap object will be private to this process, and\n*note MAPSHARED: 3169. creates a mapping that's shared with all\nother processes mapping the same areas of the file.  The default\nvalue is *note MAPSHARED: 3169.  Some systems have additional\npossible flags with the full list specified in *note MAP*\nconstants: 316a.\n\n'prot', if specified, gives the desired memory protection; the two\nmost useful values are 'PROTREAD' and 'PROTWRITE', to specify\nthat the pages may be read or written.  'prot' defaults to\n'PROTREAD | PROTWRITE'.\n\n'access' may be specified in lieu of 'flags' and 'prot' as an\noptional keyword parameter.  It is an error to specify both\n'flags', 'prot' and 'access'.  See the description of 'access'\nabove for information on how to use this parameter.\n\n'offset' may be specified as a non-negative integer offset.  mmap\nreferences will be relative to the offset from the beginning of the\nfile.  'offset' defaults to 0.  'offset' must be a multiple of\n'ALLOCATIONGRANULARITY' which is equal to 'PAGESIZE' on Unix\nsystems.\n\nTo ensure validity of the created memory mapping the file specified\nby the descriptor 'fileno' is internally automatically synchronized\nwith the physical backing store on macOS.\n\nThis example shows a simple way of using *note mmap: 830.:\n\nimport mmap\n\n# write a simple example file\nwith open(\"hello.txt\", \"wb\") as f:\nf.write(b\"Hello Python!\\n\")\n\nwith open(\"hello.txt\", \"r+b\") as f:\n# memory-map the file, size 0 means whole file\nmm = mmap.mmap(f.fileno(), 0)\n# read content via standard file methods\nprint(mm.readline())  # prints b\"Hello Python!\\n\"\n# read content via slice notation\nprint(mm[:5])  # prints b\"Hello\"\n# update content using slice notation;\n# note that new content must have same size\nmm[6:] = b\" world!\\n\"\n# ... and read again using standard file methods\nmm.seek(0)\nprint(mm.readline())  # prints b\"Hello  world!\\n\"\n# close the map\nmm.close()\n\n*note mmap: 830. can also be used as a context manager in a *note\nwith: 396. statement:\n\nimport mmap\n\nwith mmap.mmap(-1, 13) as mm:\nmm.write(b\"Hello world!\")\n\nNew in version 3.2: Context manager support.\n\nThe next example demonstrates how to create an anonymous map and\nexchange data between the parent and child processes:\n\nimport mmap\nimport os\n\nmm = mmap.mmap(-1, 13)\nmm.write(b\"Hello world!\")\n\npid = os.fork()\n\nif pid == 0:  # In a child process\nmm.seek(0)\nprint(mm.readline())\n\nmm.close()\n\nRaises an *note auditing event: 161d. 'mmap.new' with arguments\n'fileno', 'length', 'access', 'offset'.\n\nMemory-mapped file objects support the following methods:\n\n-- Method: close ()\n\nCloses the mmap.  Subsequent calls to other methods of the\nobject will result in a ValueError exception being raised.\nThis will not close the open file.\n\n-- Attribute: closed\n\n'True' if the file is closed.\n\nNew in version 3.2.\n\n-- Method: find (sub[, start[, end]])\n\nReturns the lowest index in the object where the subsequence\n'sub' is found, such that 'sub' is contained in the range\n['start', 'end'].  Optional arguments 'start' and 'end' are\ninterpreted as in slice notation.  Returns '-1' on failure.\n\nChanged in version 3.5: Writable *note bytes-like object: b82.\nis now accepted.\n\n-- Method: flush ([offset[, size]])\n\nFlushes changes made to the in-memory copy of a file back to\ndisk.  Without use of this call there is no guarantee that\nchanges are written back before the object is destroyed.  If\n'offset' and 'size' are specified, only changes to the given\nrange of bytes will be flushed to disk; otherwise, the whole\nextent of the mapping is flushed.  'offset' must be a multiple\nof the 'PAGESIZE' or 'ALLOCATIONGRANULARITY'.\n\n'None' is returned to indicate success.  An exception is\nraised when the call failed.\n\nChanged in version 3.8: Previously, a nonzero value was\nreturned on success; zero was returned on error under Windows.\nA zero value was returned on success; an exception was raised\non error under Unix.\n\n-- Method: madvise (option[, start[, length]])\n\nSend advice 'option' to the kernel about the memory region\nbeginning at 'start' and extending 'length' bytes.  'option'\nmust be one of the *note MADV* constants: 316e. available on\nthe system.  If 'start' and 'length' are omitted, the entire\nmapping is spanned.  On some systems (including Linux),\n'start' must be a multiple of the 'PAGESIZE'.\n\nAvailability: Systems with the 'madvise()' system call.\n\nNew in version 3.8.\n\n-- Method: move (dest, src, count)\n\nCopy the 'count' bytes starting at offset 'src' to the\ndestination index 'dest'.  If the mmap was created with\n'ACCESSREAD', then calls to move will raise a *note\nTypeError: 28e. exception.\n\n-- Method: read ([n])\n\nReturn a *note bytes: 295. containing up to 'n' bytes starting\nfrom the current file position.  If the argument is omitted,\n'None' or negative, return all bytes from the current file\nposition to the end of the mapping.  The file position is\nupdated to point after the bytes that were returned.\n\nChanged in version 3.3: Argument can be omitted or 'None'.\n\n-- Method: readbyte ()\n\nReturns a byte at the current file position as an integer, and\nadvances the file position by 1.\n\n-- Method: readline ()\n\nReturns a single line, starting at the current file position\nand up to the next newline.  The file position is updated to\npoint after the bytes that were returned.\n\n-- Method: resize (newsize)\n\nResizes the map and the underlying file, if any.  If the mmap\nwas created with 'ACCESSREAD' or 'ACCESSCOPY', resizing the\nmap will raise a *note TypeError: 28e. exception.\n\n'On Windows': Resizing the map will raise an *note OSError:\n613. if there are other maps against the same named file.\nResizing an anonymous map (ie against the pagefile) will\nsilently create a new map with the original data copied over\nup to the length of the new size.\n\nChanged in version 3.11: Correctly fails if attempting to\nresize when another map is held Allows resize against an\nanonymous map on Windows\n\n-- Method: rfind (sub[, start[, end]])\n\nReturns the highest index in the object where the subsequence\n'sub' is found, such that 'sub' is contained in the range\n['start', 'end'].  Optional arguments 'start' and 'end' are\ninterpreted as in slice notation.  Returns '-1' on failure.\n\nChanged in version 3.5: Writable *note bytes-like object: b82.\nis now accepted.\n\n-- Method: seek (pos[, whence])\n\nSet the file's current position.  'whence' argument is\noptional and defaults to 'os.SEEKSET' or '0' (absolute file\npositioning); other values are 'os.SEEKCUR' or '1' (seek\nrelative to the current position) and 'os.SEEKEND' or '2'\n(seek relative to the file's end).\n\n-- Method: size ()\n\nReturn the length of the file, which can be larger than the\nsize of the memory-mapped area.\n\n-- Method: tell ()\n\nReturns the current position of the file pointer.\n\n-- Method: write (bytes)\n\nWrite the bytes in 'bytes' into memory at the current position\nof the file pointer and return the number of bytes written\n(never less than 'len(bytes)', since if the write fails, a\n*note ValueError: 183. will be raised).  The file position is\nupdated to point after the bytes that were written.  If the\nmmap was created with 'ACCESSREAD', then writing to it will\nraise a *note TypeError: 28e. exception.\n\nChanged in version 3.5: Writable *note bytes-like object: b82.\nis now accepted.\n\nChanged in version 3.6: The number of bytes written is now\nreturned.\n\n-- Method: writebyte (byte)\n\nWrite the integer 'byte' into memory at the current position\nof the file pointer; the file position is advanced by '1'.  If\nthe mmap was created with 'ACCESSREAD', then writing to it\nwill raise a *note TypeError: 28e. exception.\n\n* Menu:\n\n* MADV* Constants::\n* MAP* Constants::\n\nFile: python3.12.info,  Node: MADV* Constants,  Next: MAP* Constants,  Up: mmap -- Memory-mapped file support\n\n5.18.7.1 MADV* Constants\n.........................\n\n-- Data: mmap.MADVNORMAL\n-- Data: mmap.MADVRANDOM\n-- Data: mmap.MADVSEQUENTIAL\n-- Data: mmap.MADVWILLNEED\n-- Data: mmap.MADVDONTNEED\n-- Data: mmap.MADVREMOVE\n-- Data: mmap.MADVDONTFORK\n-- Data: mmap.MADVDOFORK\n-- Data: mmap.MADVHWPOISON\n-- Data: mmap.MADVMERGEABLE\n-- Data: mmap.MADVUNMERGEABLE\n-- Data: mmap.MADVSOFTOFFLINE\n-- Data: mmap.MADVHUGEPAGE\n-- Data: mmap.MADVNOHUGEPAGE\n-- Data: mmap.MADVDONTDUMP\n-- Data: mmap.MADVDODUMP\n-- Data: mmap.MADVFREE\n-- Data: mmap.MADVNOSYNC\n-- Data: mmap.MADVAUTOSYNC\n-- Data: mmap.MADVNOCORE\n-- Data: mmap.MADVCORE\n-- Data: mmap.MADVPROTECT\n-- Data: mmap.MADVFREEREUSABLE\n-- Data: mmap.MADVFREEREUSE\n\nThese options can be passed to *note mmap.madvise(): 831.  Not\nevery option will be present on every system.\n\nAvailability: Systems with the madvise() system call.\n\nNew in version 3.8.\n\nFile: python3.12.info,  Node: MAP* Constants,  Prev: MADV* Constants,  Up: mmap -- Memory-mapped file support\n\n5.18.7.2 MAP* Constants\n........................\n\n-- Data: mmap.MAPSHARED\n-- Data: mmap.MAPPRIVATE\n-- Data: mmap.MAPDENYWRITE\n-- Data: mmap.MAPEXECUTABLE\n-- Data: mmap.MAPANON\n-- Data: mmap.MAPANONYMOUS\n-- Data: mmap.MAPPOPULATE\n-- Data: mmap.MAPSTACK\n-- Data: mmap.MAPALIGNEDSUPER\n-- Data: mmap.MAPCONCEAL\n\nThese are the various flags that can be passed to *note\nmmap.mmap(): 830.  *note MAPALIGNEDSUPER: 14a4. is only available\nat FreeBSD and *note MAPCONCEAL: 14a5. is only available at\nOpenBSD. Note that some options might not be present on some\nsystems.\n\nChanged in version 3.10: Added *note MAPPOPULATE: 16af. constant.\n\nNew in version 3.11: Added *note MAPSTACK: 3197. constant.\n\nNew in version 3.12: Added *note MAPALIGNEDSUPER: 14a4. constant.\nAdded *note MAPCONCEAL: 14a5. constant.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Internet Data Handling,  Next: Structured Markup Processing Tools,  Prev: Networking and Interprocess Communication,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.19 Internet Data Handling",
                    "content": ""
                }
            ]
        },
        "This chapter describes modules which support handling data formats": {
            "content": "commonly used on the internet.\n\n* Menu:\n\n* email -- An email and MIME handling package::\n* json -- JSON encoder and decoder::\n* mailbox -- Manipulate mailboxes in various formats::\n* mimetypes -- Map filenames to MIME types::\n* base64 -- Base16, Base32, Base64, Base85 Data Encodings: base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n* binascii -- Convert between binary and ASCII::\n* quopri -- Encode and decode MIME quoted-printable data::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: email -- An email and MIME handling package,  Next: json -- JSON encoder and decoder,  Up: Internet Data Handling": {
            "content": "'Source code:' Lib/email/init.py(1)\n\n\n\nThe *note email: 37. package is a library for managing email messages.",
            "subsections": []
        },
        "It is specifically 'not' designed to do any sending of email messages to": {
            "content": "SMTP ( RFC 2821(2)), NNTP, or other servers; those are functions of\nmodules such as *note smtplib: c4. and *note nntplib: 98.  The *note\nemail: 37. package attempts to be as RFC-compliant as possible,\nsupporting RFC 5322(3) and RFC 6532(4), as well as such MIME-related\nRFCs as RFC 2045(5), RFC 2046(6), RFC 2047(7), RFC 2183(8), and RFC\n2231(9).\n",
            "subsections": []
        },
        "The overall structure of the email package can be divided into three": {
            "content": "major components, plus a fourth component that controls the behavior of\nthe other components.\n\nThe central component of the package is an \"object model\" that\nrepresents email messages.  An application interacts with the package\nprimarily through the object model interface defined in the *note\nmessage: 40. sub-module.  The application can use this API to ask\nquestions about an existing email, to construct a new email, or to add\nor remove email subcomponents that themselves use the same object model\ninterface.  That is, following the nature of email messages and their\nMIME subcomponents, the email object model is a tree structure of\nobjects that all provide the *note EmailMessage: ae8. API.\n\nThe other two major components of the package are the *note parser: 4a.\nand the *note generator: 3c.  The parser takes the serialized version of\nan email message (a stream of bytes) and converts it into a tree of\n*note EmailMessage: ae8. objects.  The generator takes an *note\nEmailMessage: ae8. and turns it back into a serialized byte stream.\n(The parser and generator also handle streams of text characters, but\nthis usage is discouraged as it is too easy to end up with messages that\nare not valid in one way or another.)\n\nThe control component is the *note policy: 4b. module.  Every *note\nEmailMessage: ae8, every *note generator: 3c, and every *note parser:\n4a. has an associated *note policy: 4b. object that controls its\nbehavior.  Usually an application only needs to specify the policy when\nan *note EmailMessage: ae8. is created, either by directly instantiating\nan *note EmailMessage: ae8. to create a new email, or by parsing an\ninput stream using a *note parser: 4a.  But the policy can be changed\nwhen the message is serialized using a *note generator: 3c.  This\nallows, for example, a generic email message to be parsed from disk, but\nto serialize it using standard SMTP settings when sending it to an email\nserver.\n",
            "subsections": []
        },
        "The email package does its best to hide the details of the various": {
            "content": "governing RFCs from the application.  Conceptually the application\nshould be able to treat the email message as a structured tree of\nunicode text and binary attachments, without having to worry about how\nthese are represented when serialized.  In practice, however, it is\noften necessary to be aware of at least some of the rules governing MIME\nmessages and their structure, specifically the names and nature of the\nMIME \"content types\" and how they identify multipart documents.  For the\nmost part this knowledge should only be required for more complex\napplications, and even then it should only be the high level structure\nin question, and not the details of how those structures are\nrepresented.  Since MIME content types are used widely in modern\ninternet software (not just email), this will be a familiar concept to\nmany programmers.\n\nThe following sections describe the functionality of the *note email:\n37. package.  We start with the *note message: 40. object model, which\nis the primary interface an application will use, and follow that with\nthe *note parser: 4a. and *note generator: 3c. components.  Then we\ncover the *note policy: 4b. controls, which completes the treatment of\nthe main components of the library.\n",
            "subsections": []
        },
        "The next three sections cover the exceptions the package may raise and": {
            "content": "the defects (non-compliance with the RFCs) that the *note parser: 4a.\nmay detect.  Then we cover the *note headerregistry: 3e. and the *note\ncontentmanager: 39. sub-components, which provide tools for doing more\ndetailed manipulation of headers and payloads, respectively.  Both of\nthese components contain features relevant to consuming and producing\nnon-trivial messages, but also document their extensibility APIs, which\nwill be of interest to advanced applications.\n",
            "subsections": []
        },
        "Following those is a set of examples of using the fundamental parts of": {
            "content": "the APIs covered in the preceding sections.\n",
            "subsections": []
        },
        "The foregoing represent the modern (unicode friendly) API of the email": {
            "content": "package.  The remaining sections, starting with the *note Message: ae7.\nclass, cover the legacy *note compat32: ae6. API that deals much more\ndirectly with the details of how email messages are represented.  The\n*note compat32: ae6. API does 'not' hide the details of the RFCs from\nthe application, but for applications that need to operate at that\nlevel, they can be useful tools.  This documentation is also relevant\nfor applications that are still using the *note compat32: ae6. API for\nbackward compatibility reasons.\n",
            "subsections": []
        },
        "Changed in version 3.6: Docs reorganized and rewritten to promote the": {
            "content": "new *note EmailMessage: ae8./*note EmailPolicy: f27. API.\n\nContents of the *note email: 37. package documentation:\n\n* Menu:\n\n* email.message; Representing an email message: email message Representing an email message.\n* email.parser; Parsing email messages: email parser Parsing email messages.\n* email.generator; Generating MIME documents: email generator Generating MIME documents.\n* email.policy; Policy Objects: email policy Policy Objects.\n* email.errors; Exception and Defect classes: email errors Exception and Defect classes.\n* email.headerregistry; Custom Header Objects: email headerregistry Custom Header Objects.\n* email.contentmanager; Managing MIME Content: email contentmanager Managing MIME Content.\n* email; Examples: email Examples.\n* email.message.Message; Representing an email message using the compat32 API: email message Message Representing an email message using the compat32 API.\n* email.mime; Creating email and MIME objects from scratch: email mime Creating email and MIME objects from scratch.\n* email.header; Internationalized headers: email header Internationalized headers.\n* email.charset; Representing character sets: email charset Representing character sets.\n* email.encoders; Encoders: email encoders Encoders.\n* email.utils; Miscellaneous utilities: email utils Miscellaneous utilities.\n* email.iterators; Iterators: email iterators Iterators.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/email/init.py\n\n(2) https://datatracker.ietf.org/doc/html/rfc2821.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc5322.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc6532.html\n\n(5) https://datatracker.ietf.org/doc/html/rfc2045.html\n\n(6) https://datatracker.ietf.org/doc/html/rfc2046.html\n\n(7) https://datatracker.ietf.org/doc/html/rfc2047.html\n\n(8) https://datatracker.ietf.org/doc/html/rfc2183.html\n\n(9) https://datatracker.ietf.org/doc/html/rfc2231.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: email message Representing an email message,  Next: email parser Parsing email messages,  Up: email -- An email and MIME handling package": {
            "content": "5.19.1.1 'email.message': Representing an email message\n.......................................................\n\n'Source code:' Lib/email/message.py(1)\n\n\n",
            "subsections": []
        },
        "New in version 3.6: (2)": {
            "content": "-- Class: email.contentmanager.ContentManager\n\nBase class for content managers.  Provides the standard registry\nmechanisms to register converters between MIME content and other\nrepresentations, as well as the 'getcontent' and 'setcontent'\ndispatch methods.\n\n-- Method: getcontent (msg, *args, kw)\n\nLook up a handler function based on the 'mimetype' of 'msg'\n(see next paragraph), call it, passing through all arguments,\nand return the result of the call.  The expectation is that\nthe handler will extract the payload from 'msg' and return an\nobject that encodes information about the extracted data.\n\nTo find the handler, look for the following keys in the\nregistry, stopping with the first one found:\n\n* the string representing the full MIME type\n('maintype/subtype')\n\n* the string representing the 'maintype'\n\n* the empty string\n\nIf none of these keys produce a handler, raise a *note\nKeyError: 8cf. for the full MIME type.\n\n-- Method: setcontent (msg, obj, *args, kw)\n\nIf the 'maintype' is 'multipart', raise a *note TypeError:\n28e.; otherwise look up a handler function based on the type\nof 'obj' (see next paragraph), call *note clearcontent():\n31d8. on the 'msg', and call the handler function, passing\nthrough all arguments.  The expectation is that the handler\nwill transform and store 'obj' into 'msg', possibly making\nother changes to 'msg' as well, such as adding various MIME\nheaders to encode information needed to interpret the stored\ndata.\n\nTo find the handler, obtain the type of 'obj' ('typ =\ntype(obj)'), and look for the following keys in the registry,\nstopping with the first one found:\n\n* the type itself ('typ')\n\n* the type's fully qualified name ('typ.module + '.' +\ntyp.qualname').\n\n* the type's qualname ('typ.qualname')\n\n* the type's name ('typ.name').\n\nIf none of the above match, repeat all of the checks above for\neach of the types in the *note MRO: 3249. ('typ.mro').\nFinally, if no other key yields a handler, check for a handler\nfor the key 'None'.  If there is no handler for 'None', raise\na *note KeyError: 8cf. for the fully qualified name of the\ntype.\n\nAlso add a 'MIME-Version' header if one is not present (see\nalso *note MIMEPart: daa.).\n\n-- Method: addgethandler (key, handler)\n\nRecord the function 'handler' as the handler for 'key'.  For\nthe possible values of 'key', see *note getcontent(): 324b.\n\n-- Method: addsethandler (typekey, handler)\n\nRecord 'handler' as the function to call when an object of a\ntype matching 'typekey' is passed to *note setcontent():\n324d.  For the possible values of 'typekey', see *note\nsetcontent(): 324d.\n\n* Menu:\n\n* Content Manager Instances::\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/email/contentmanager.py\n\n(2) Originally added in 3.4 as a *note provisional module: eba.\n",
            "subsections": []
        },
        "An email message consists of 'headers' and a 'payload' (which is also": {
            "content": "referred to as the 'content').  Headers are RFC 5322(3) or RFC 6532(4)\nstyle field names and values, where the field name and value are\nseparated by a colon.  The colon is not part of either the field name or\nthe field value.  The payload may be a simple text message, or a binary\nobject, or a structured sequence of sub-messages each with their own set\nof headers and their own payload.  The latter type of payload is\nindicated by the message having a MIME type such as 'multipart/*' or\n'message/rfc822'.\n\nThe conceptual model provided by an *note EmailMessage: ae8. object is\nthat of an ordered dictionary of headers coupled with a 'payload' that\nrepresents the RFC 5322(5) body of the message, which might be a list of\nsub-'EmailMessage' objects.  In addition to the normal dictionary\nmethods for accessing the header names and values, there are methods for\naccessing specialized information from the headers (for example the MIME\ncontent type), for operating on the payload, for generating a serialized\nversion of the message, and for recursively walking over the object\ntree.\n\nThe *note EmailMessage: ae8. dictionary-like interface is indexed by the\nheader names, which must be ASCII values.  The values of the dictionary\nare strings with some extra methods.  Headers are stored and returned in\ncase-preserving form, but field names are matched case-insensitively.\nThe keys are ordered, but unlike a real dict, there can be duplicates.",
            "subsections": []
        },
        "Addtional methods are provided for working with headers that have": {
            "content": "duplicate keys.\n",
            "subsections": []
        },
        "The 'payload' is either a string or bytes object, in the case of simple": {
            "content": "message objects, or a list of *note EmailMessage: ae8. objects, for MIME\ncontainer documents such as 'multipart/*' and 'message/rfc822' message\nobjects.\n\n-- Class: email.message.EmailMessage (policy=default)\n\nIf 'policy' is specified use the rules it specifies to update and\nserialize the representation of the message.  If 'policy' is not\nset, use the *note default: 31a0. policy, which follows the rules\nof the email RFCs except for line endings (instead of the RFC\nmandated '\\r\\n', it uses the Python standard '\\n' line endings).\nFor more information see the *note policy: 4b. documentation.\n\n-- Method: asstring (unixfrom=False, maxheaderlen=None,\npolicy=None)\n\nReturn the entire message flattened as a string.  When\noptional 'unixfrom' is true, the envelope header is included\nin the returned string.  'unixfrom' defaults to 'False'.  For\nbackward compatibility with the base *note Message: ae7. class\n'maxheaderlen' is accepted, but defaults to 'None', which\nmeans that by default the line length is controlled by the\n*note maxlinelength: 31a2. of the policy.  The 'policy'\nargument may be used to override the default policy obtained\nfrom the message instance.  This can be used to control some\nof the formatting produced by the method, since the specified\n'policy' will be passed to the *note Generator: 1042.\n\nFlattening the message may trigger changes to the *note\nEmailMessage: ae8. if defaults need to be filled in to\ncomplete the transformation to a string (for example, MIME\nboundaries may be generated or modified).\n\nNote that this method is provided as a convenience and may not\nbe the most useful way to serialize messages in your\napplication, especially if you are dealing with multiple\nmessages.  See *note email.generator.Generator: 1042. for a\nmore flexible API for serializing messages.  Note also that\nthis method is restricted to producing messages serialized as\n\"7 bit clean\" when *note utf8: c55. is 'False', which is the\ndefault.\n\nChanged in version 3.6: the default behavior when\n'maxheaderlen' is not specified was changed from defaulting to\n0 to defaulting to the value of 'maxlinelength' from the\npolicy.\n\n-- Method: str ()\n\nEquivalent to\n'asstring(policy=self.policy.clone(utf8=True))'.  Allows\n'str(msg)' to produce a string containing the serialized\nmessage in a readable format.\n\nChanged in version 3.4: the method was changed to use\n'utf8=True', thus producing an RFC 6531(6)-like message\nrepresentation, instead of being a direct alias for *note\nasstring(): 31a1.\n\n-- Method: asbytes (unixfrom=False, policy=None)\n\nReturn the entire message flattened as a bytes object.  When\noptional 'unixfrom' is true, the envelope header is included\nin the returned string.  'unixfrom' defaults to 'False'.  The\n'policy' argument may be used to override the default policy\nobtained from the message instance.  This can be used to\ncontrol some of the formatting produced by the method, since\nthe specified 'policy' will be passed to the *note\nBytesGenerator: 1043.\n\nFlattening the message may trigger changes to the *note\nEmailMessage: ae8. if defaults need to be filled in to\ncomplete the transformation to a string (for example, MIME\nboundaries may be generated or modified).\n\nNote that this method is provided as a convenience and may not\nbe the most useful way to serialize messages in your\napplication, especially if you are dealing with multiple\nmessages.  See *note email.generator.BytesGenerator: 1043. for\na more flexible API for serializing messages.\n\n-- Method: bytes ()\n\nEquivalent to *note asbytes(): 31a4.  Allows 'bytes(msg)' to\nproduce a bytes object containing the serialized message.\n\n-- Method: ismultipart ()\n\nReturn 'True' if the message's payload is a list of sub-*note\nEmailMessage: ae8. objects, otherwise return 'False'.  When\n*note ismultipart(): 31a6. returns 'False', the payload\nshould be a string object (which might be a CTE encoded binary\npayload).  Note that *note ismultipart(): 31a6. returning\n'True' does not necessarily mean that\n\"msg.getcontentmaintype() == 'multipart'\" will return the\n'True'.  For example, 'ismultipart' will return 'True' when\nthe *note EmailMessage: ae8. is of type 'message/rfc822'.\n\n-- Method: setunixfrom (unixfrom)\n\nSet the message's envelope header to 'unixfrom', which should\nbe a string.  (See *note mboxMessage: 31a8. for a brief\ndescription of this header.)\n\n-- Method: getunixfrom ()\n\nReturn the message's envelope header.  Defaults to 'None' if\nthe envelope header was never set.\n\nThe following methods implement the mapping-like interface for\naccessing the message's headers.  Note that there are some semantic\ndifferences between these methods and a normal mapping (i.e.\ndictionary) interface.  For example, in a dictionary there are no\nduplicate keys, but here there may be duplicate message headers.\nAlso, in dictionaries there is no guaranteed order to the keys\nreturned by *note keys(): 31aa, but in an *note EmailMessage: ae8.\nobject, headers are always returned in the order they appeared in\nthe original message, or in which they were added to the message\nlater.  Any header deleted and then re-added is always appended to\nthe end of the header list.\n\nThese semantic differences are intentional and are biased toward\nconvenience in the most common use cases.\n\nNote that in all cases, any envelope header present in the message\nis not included in the mapping interface.\n\n-- Method: len ()\n\nReturn the total number of headers, including duplicates.\n\n-- Method: contains (name)\n\nReturn 'True' if the message object has a field named 'name'.\nMatching is done without regard to case and 'name' does not\ninclude the trailing colon.  Used for the 'in' operator.  For\nexample:\n\nif 'message-id' in myMessage:\nprint('Message-ID:', myMessage['message-id'])\n\n-- Method: getitem (name)\n\nReturn the value of the named header field.  'name' does not\ninclude the colon field separator.  If the header is missing,\n'None' is returned; a *note KeyError: 8cf. is never raised.\n\nNote that if the named field appears more than once in the\nmessage's headers, exactly which of those field values will be\nreturned is undefined.  Use the *note getall(): 31ae. method\nto get the values of all the extant headers named 'name'.\n\nUsing the standard (non-'compat32') policies, the returned\nvalue is an instance of a subclass of *note\nemail.headerregistry.BaseHeader: 31af.\n\n-- Method: setitem (name, val)\n\nAdd a header to the message with field name 'name' and value\n'val'.  The field is appended to the end of the message's\nexisting headers.\n\nNote that this does 'not' overwrite or delete any existing\nheader with the same name.  If you want to ensure that the new\nheader is the only one present in the message with field name\n'name', delete the field first, e.g.:\n\ndel msg['subject']\nmsg['subject'] = 'Python roolz!'\n\nIf the *note policy: 4b. defines certain headers to be unique\n(as the standard policies do), this method may raise a *note\nValueError: 183. when an attempt is made to assign a value to\nsuch a header when one already exists.  This behavior is\nintentional for consistency's sake, but do not depend on it as\nwe may choose to make such assignments do an automatic\ndeletion of the existing header in the future.\n\n-- Method: delitem (name)\n\nDelete all occurrences of the field with name 'name' from the\nmessage's headers.  No exception is raised if the named field\nisn't present in the headers.\n\n-- Method: keys ()\n\nReturn a list of all the message's header field names.\n\n-- Method: values ()\n\nReturn a list of all the message's field values.\n\n-- Method: items ()\n\nReturn a list of 2-tuples containing all the message's field\nheaders and values.\n\n-- Method: get (name, failobj=None)\n\nReturn the value of the named header field.  This is identical\nto *note getitem(): 4b9. except that optional 'failobj' is\nreturned if the named header is missing ('failobj' defaults to\n'None').\n\nHere are some additional useful header related methods:\n\n-- Method: getall (name, failobj=None)\n\nReturn a list of all the values for the field named 'name'.\nIf there are no such named headers in the message, 'failobj'\nis returned (defaults to 'None').\n\n-- Method: addheader (name, value, params)\n\nExtended header setting.  This method is similar to *note\nsetitem(): 31b0. except that additional header parameters\ncan be provided as keyword arguments.  'name' is the header\nfield to add and 'value' is the 'primary' value for the\nheader.\n\nFor each item in the keyword argument dictionary 'params',\nthe key is taken as the parameter name, with underscores\nconverted to dashes (since dashes are illegal in Python\nidentifiers).  Normally, the parameter will be added as\n'key=\"value\"' unless the value is 'None', in which case only\nthe key will be added.\n\nIf the value contains non-ASCII characters, the charset and\nlanguage may be explicitly controlled by specifying the value\nas a three tuple in the format '(CHARSET, LANGUAGE, VALUE)',\nwhere 'CHARSET' is a string naming the charset to be used to\nencode the value, 'LANGUAGE' can usually be set to 'None' or\nthe empty string (see RFC 2231(7) for other possibilities),\nand 'VALUE' is the string value containing non-ASCII code\npoints.  If a three tuple is not passed and the value contains\nnon-ASCII characters, it is automatically encoded in RFC\n2231(8) format using a 'CHARSET' of 'utf-8' and a 'LANGUAGE'\nof 'None'.\n\nHere is an example:\n\nmsg.addheader('Content-Disposition', 'attachment', filename='bud.gif')\n\nThis will add a header that looks like\n\nContent-Disposition: attachment; filename=\"bud.gif\"\n\nAn example of the extended interface with non-ASCII\ncharacters:\n\nmsg.addheader('Content-Disposition', 'attachment',\nfilename=('iso-8859-1', '', 'Fussballer.ppt'))\n\n-- Method: replaceheader (name, value)\n\nReplace a header.  Replace the first header found in the\nmessage that matches 'name', retaining header order and field\nname case of the original header.  If no matching header is\nfound, raise a *note KeyError: 8cf.\n\n-- Method: getcontenttype ()\n\nReturn the message's content type, coerced to lower case of\nthe form 'maintype/subtype'.  If there is no 'Content-Type'\nheader in the message return the value returned by *note\ngetdefaulttype(): 31b8.  If the 'Content-Type' header is\ninvalid, return 'text/plain'.\n\n(According to RFC 2045(9), messages always have a default\ntype, *note getcontenttype(): 31b7. will always return a\nvalue.  RFC 2045(10) defines a message's default type to be\n'text/plain' unless it appears inside a 'multipart/digest'\ncontainer, in which case it would be 'message/rfc822'.  If the\n'Content-Type' header has an invalid type specification, RFC\n2045(11) mandates that the default type be 'text/plain'.)\n\n-- Method: getcontentmaintype ()\n\nReturn the message's main content type.  This is the\n'maintype' part of the string returned by *note\ngetcontenttype(): 31b7.\n\n-- Method: getcontentsubtype ()\n\nReturn the message's sub-content type.  This is the 'subtype'\npart of the string returned by *note getcontenttype(): 31b7.\n\n-- Method: getdefaulttype ()\n\nReturn the default content type.  Most messages have a default\ncontent type of 'text/plain', except for messages that are\nsubparts of 'multipart/digest' containers.  Such subparts have\na default content type of 'message/rfc822'.\n\n-- Method: setdefaulttype (ctype)\n\nSet the default content type.  'ctype' should either be\n'text/plain' or 'message/rfc822', although this is not\nenforced.  The default content type is not stored in the\n'Content-Type' header, so it only affects the return value of\nthe 'getcontenttype' methods when no 'Content-Type' header\nis present in the message.\n\n-- Method: setparam (param, value, header='Content-Type',\nrequote=True, charset=None, language='', replace=False)\n\nSet a parameter in the 'Content-Type' header.  If the\nparameter already exists in the header, replace its value with\n'value'.  When 'header' is 'Content-Type' (the default) and\nthe header does not yet exist in the message, add it, set its\nvalue to 'text/plain', and append the new parameter value.\nOptional 'header' specifies an alternative header to\n'Content-Type'.\n\nIf the value contains non-ASCII characters, the charset and\nlanguage may be explicitly specified using the optional\n'charset' and 'language' parameters.  Optional 'language'\nspecifies the RFC 2231(12) language, defaulting to the empty\nstring.  Both 'charset' and 'language' should be strings.  The\ndefault is to use the 'utf8' 'charset' and 'None' for the\n'language'.\n\nIf 'replace' is 'False' (the default) the header is moved to\nthe end of the list of headers.  If 'replace' is 'True', the\nheader will be updated in place.\n\nUse of the 'requote' parameter with *note EmailMessage: ae8.\nobjects is deprecated.\n\nNote that existing parameter values of headers may be accessed\nthrough the *note params: 31bd. attribute of the header value\n(for example, 'msg['Content-Type'].params['charset']').\n\nChanged in version 3.4: 'replace' keyword was added.\n\n-- Method: delparam (param, header='content-type', requote=True)\n\nRemove the given parameter completely from the 'Content-Type'\nheader.  The header will be re-written in place without the\nparameter or its value.  Optional 'header' specifies an\nalternative to 'Content-Type'.\n\nUse of the 'requote' parameter with *note EmailMessage: ae8.\nobjects is deprecated.\n\n-- Method: getfilename (failobj=None)\n\nReturn the value of the 'filename' parameter of the\n'Content-Disposition' header of the message.  If the header\ndoes not have a 'filename' parameter, this method falls back\nto looking for the 'name' parameter on the 'Content-Type'\nheader.  If neither is found, or the header is missing, then\n'failobj' is returned.  The returned string will always be\nunquoted as per *note email.utils.unquote(): 31c0.\n\n-- Method: getboundary (failobj=None)\n\nReturn the value of the 'boundary' parameter of the\n'Content-Type' header of the message, or 'failobj' if either\nthe header is missing, or has no 'boundary' parameter.  The\nreturned string will always be unquoted as per *note\nemail.utils.unquote(): 31c0.\n\n-- Method: setboundary (boundary)\n\nSet the 'boundary' parameter of the 'Content-Type' header to\n'boundary'.  *note setboundary(): 31c2. will always quote\n'boundary' if necessary.  A *note HeaderParseError: 31c3. is\nraised if the message object has no 'Content-Type' header.\n\nNote that using this method is subtly different from deleting\nthe old 'Content-Type' header and adding a new one with the\nnew boundary via *note addheader(): 31b5, because *note\nsetboundary(): 31c2. preserves the order of the\n'Content-Type' header in the list of headers.\n\n-- Method: getcontentcharset (failobj=None)\n\nReturn the 'charset' parameter of the 'Content-Type' header,\ncoerced to lower case.  If there is no 'Content-Type' header,\nor if that header has no 'charset' parameter, 'failobj' is\nreturned.\n\n-- Method: getcharsets (failobj=None)\n\nReturn a list containing the character set names in the\nmessage.  If the message is a 'multipart', then the list will\ncontain one element for each subpart in the payload,\notherwise, it will be a list of length 1.\n\nEach item in the list will be a string which is the value of\nthe 'charset' parameter in the 'Content-Type' header for the\nrepresented subpart.  If the subpart has no 'Content-Type'\nheader, no 'charset' parameter, or is not of the 'text' main\nMIME type, then that item in the returned list will be\n'failobj'.\n\n-- Method: isattachment ()\n\nReturn 'True' if there is a 'Content-Disposition' header and\nits (case insensitive) value is 'attachment', 'False'\notherwise.\n\nChanged in version 3.4.2: isattachment is now a method\ninstead of a property, for consistency with *note\nismultipart(): 31c7.\n\n-- Method: getcontentdisposition ()\n\nReturn the lowercased value (without parameters) of the\nmessage's 'Content-Disposition' header if it has one, or\n'None'.  The possible values for this method are 'inline',\n'attachment' or 'None' if the message follows RFC 2183(13).\n\nNew in version 3.5.\n\nThe following methods relate to interrogating and manipulating the\ncontent (payload) of the message.\n\n-- Method: walk ()\n\nThe *note walk(): 31c9. method is an all-purpose generator\nwhich can be used to iterate over all the parts and subparts\nof a message object tree, in depth-first traversal order.  You\nwill typically use *note walk(): 31c9. as the iterator in a\n'for' loop; each iteration returns the next subpart.\n\nHere's an example that prints the MIME type of every part of a\nmultipart message structure:\n\n>>> for part in msg.walk():\n...     print(part.getcontenttype())\nmultipart/report\ntext/plain\nmessage/delivery-status\ntext/plain\ntext/plain\nmessage/rfc822\ntext/plain\n\n'walk' iterates over the subparts of any part where *note\nismultipart(): 31a6. returns 'True', even though\n'msg.getcontentmaintype() == 'multipart'' may return\n'False'.  We can see this in our example by making use of the\n'structure' debug helper function:\n\n>>> from email.iterators import structure\n>>> for part in msg.walk():\n...     print(part.getcontentmaintype() == 'multipart',\n...           part.ismultipart())\nTrue True\nFalse False\nFalse True\nFalse False\nFalse False\nFalse True\nFalse False\n>>> structure(msg)\nmultipart/report\ntext/plain\nmessage/delivery-status\ntext/plain\ntext/plain\nmessage/rfc822\ntext/plain\n\nHere the 'message' parts are not 'multiparts', but they do\ncontain subparts.  'ismultipart()' returns 'True' and 'walk'\ndescends into the subparts.\n\n-- Method: getbody (preferencelist=('related', 'html', 'plain'))\n\nReturn the MIME part that is the best candidate to be the\n\"body\" of the message.\n\n'preferencelist' must be a sequence of strings from the set\n'related', 'html', and 'plain', and indicates the order of\npreference for the content type of the part returned.\n\nStart looking for candidate matches with the object on which\nthe 'getbody' method is called.\n\nIf 'related' is not included in 'preferencelist', consider the\nroot part (or subpart of the root part) of any related\nencountered as a candidate if the (sub-)part matches a\npreference.\n\nWhen encountering a 'multipart/related', check the 'start'\nparameter and if a part with a matching 'Content-ID' is found,\nconsider only it when looking for candidate matches.\nOtherwise consider only the first (default root) part of the\n'multipart/related'.\n\nIf a part has a 'Content-Disposition' header, only consider\nthe part a candidate match if the value of the header is\n'inline'.\n\nIf none of the candidates matches any of the preferences in\n'preferencelist', return 'None'.\n\nNotes: (1) For most applications the only 'preferencelist'\ncombinations that really make sense are '('plain',)',\n'('html', 'plain')', and the default '('related', 'html',\n'plain')'.  (2) Because matching starts with the object on\nwhich 'getbody' is called, calling 'getbody' on a\n'multipart/related' will return the object itself unless\n'preferencelist' has a non-default value.  (3) Messages (or\nmessage parts) that do not specify a 'Content-Type' or whose\n'Content-Type' header is invalid will be treated as if they\nare of type 'text/plain', which may occasionally cause\n'getbody' to return unexpected results.\n\n-- Method: iterattachments ()\n\nReturn an iterator over all of the immediate sub-parts of the\nmessage that are not candidate \"body\" parts.  That is, skip\nthe first occurrence of each of 'text/plain', 'text/html',\n'multipart/related', or 'multipart/alternative' (unless they\nare explicitly marked as attachments via 'Content-Disposition:\nattachment'), and return all remaining parts.  When applied\ndirectly to a 'multipart/related', return an iterator over the\nall the related parts except the root part (ie: the part\npointed to by the 'start' parameter, or the first part if\nthere is no 'start' parameter or the 'start' parameter doesn't\nmatch the 'Content-ID' of any of the parts).  When applied\ndirectly to a 'multipart/alternative' or a non-'multipart',\nreturn an empty iterator.\n\n-- Method: iterparts ()\n\nReturn an iterator over all of the immediate sub-parts of the\nmessage, which will be empty for a non-'multipart'.  (See also\n*note walk(): 31c9.)\n\n-- Method: getcontent (*args, contentmanager=None, kw)\n\nCall the *note getcontent(): 31ce. method of the\n'contentmanager', passing self as the message object, and\npassing along any other arguments or keywords as additional\narguments.  If 'contentmanager' is not specified, use the\n'contentmanager' specified by the current *note policy: 4b.\n\n-- Method: setcontent (*args, contentmanager=None, kw)\n\nCall the *note setcontent(): 31cf. method of the\n'contentmanager', passing self as the message object, and\npassing along any other arguments or keywords as additional\narguments.  If 'contentmanager' is not specified, use the\n'contentmanager' specified by the current *note policy: 4b.\n\n-- Method: makerelated (boundary=None)\n\nConvert a non-'multipart' message into a 'multipart/related'\nmessage, moving any existing 'Content-' headers and payload\ninto a (new) first part of the 'multipart'.  If 'boundary' is\nspecified, use it as the boundary string in the multipart,\notherwise leave the boundary to be automatically created when\nit is needed (for example, when the message is serialized).\n\n-- Method: makealternative (boundary=None)\n\nConvert a non-'multipart' or a 'multipart/related' into a\n'multipart/alternative', moving any existing 'Content-'\nheaders and payload into a (new) first part of the\n'multipart'.  If 'boundary' is specified, use it as the\nboundary string in the multipart, otherwise leave the boundary\nto be automatically created when it is needed (for example,\nwhen the message is serialized).\n\n-- Method: makemixed (boundary=None)\n\nConvert a non-'multipart', a 'multipart/related', or a\n'multipart-alternative' into a 'multipart/mixed', moving any\nexisting 'Content-' headers and payload into a (new) first\npart of the 'multipart'.  If 'boundary' is specified, use it\nas the boundary string in the multipart, otherwise leave the\nboundary to be automatically created when it is needed (for\nexample, when the message is serialized).\n\n-- Method: addrelated (*args, contentmanager=None, kw)\n\nIf the message is a 'multipart/related', create a new message\nobject, pass all of the arguments to its *note setcontent():\n160a. method, and *note attach(): 31d4. it to the 'multipart'.\nIf the message is a non-'multipart', call *note\nmakerelated(): 31d0. and then proceed as above.  If the\nmessage is any other type of 'multipart', raise a *note\nTypeError: 28e.  If 'contentmanager' is not specified, use\nthe 'contentmanager' specified by the current *note policy:\n4b.  If the added part has no 'Content-Disposition' header,\nadd one with the value 'inline'.\n\n-- Method: addalternative (*args, contentmanager=None, kw)\n\nIf the message is a 'multipart/alternative', create a new\nmessage object, pass all of the arguments to its *note\nsetcontent(): 160a. method, and *note attach(): 31d4. it to\nthe 'multipart'.  If the message is a non-'multipart' or\n'multipart/related', call *note makealternative(): 31d1. and\nthen proceed as above.  If the message is any other type of\n'multipart', raise a *note TypeError: 28e.  If\n'contentmanager' is not specified, use the 'contentmanager'\nspecified by the current *note policy: 4b.\n\n-- Method: addattachment (*args, contentmanager=None, kw)\n\nIf the message is a 'multipart/mixed', create a new message\nobject, pass all of the arguments to its *note setcontent():\n160a. method, and *note attach(): 31d4. it to the 'multipart'.\nIf the message is a non-'multipart', 'multipart/related', or\n'multipart/alternative', call *note makemixed(): 31d2. and\nthen proceed as above.  If 'contentmanager' is not specified,\nuse the 'contentmanager' specified by the current *note\npolicy: 4b.  If the added part has no 'Content-Disposition'\nheader, add one with the value 'attachment'.  This method can\nbe used both for explicit attachments ('Content-Disposition:\nattachment') and 'inline' attachments ('Content-Disposition:\ninline'), by passing appropriate options to the\n'contentmanager'.\n\n-- Method: clear ()\n\nRemove the payload and all of the headers.\n\n-- Method: clearcontent ()\n\nRemove the payload and all of the '!Content-' headers, leaving\nall other headers intact and in their original order.\n\n*note EmailMessage: ae8. objects have the following instance\nattributes:\n\n-- Attribute: preamble\n\nThe format of a MIME document allows for some text between the\nblank line following the headers, and the first multipart\nboundary string.  Normally, this text is never visible in a\nMIME-aware mail reader because it falls outside the standard\nMIME armor.  However, when viewing the raw text of the\nmessage, or when viewing the message in a non-MIME aware\nreader, this text can become visible.\n\nThe 'preamble' attribute contains this leading extra-armor\ntext for MIME documents.  When the *note Parser: 1012.\ndiscovers some text after the headers but before the first\nboundary string, it assigns this text to the message's\n'preamble' attribute.  When the *note Generator: 1042. is\nwriting out the plain text representation of a MIME message,\nand it finds the message has a 'preamble' attribute, it will\nwrite this text in the area between the headers and the first\nboundary.  See *note email.parser: 4a. and *note\nemail.generator: 3c. for details.\n\nNote that if the message object has no preamble, the\n'preamble' attribute will be 'None'.\n\n-- Attribute: epilogue\n\nThe 'epilogue' attribute acts the same way as the 'preamble'\nattribute, except that it contains text that appears between\nthe last boundary and the end of the message.  As with the\n*note preamble: 31d9, if there is no epilog text this\nattribute will be 'None'.\n\n-- Attribute: defects\n\nThe 'defects' attribute contains a list of all the problems\nfound when parsing this message.  See *note email.errors: 3b.\nfor a detailed description of the possible parsing defects.\n\n-- Class: email.message.MIMEPart (policy=default)\n\nThis class represents a subpart of a MIME message.  It is identical\nto *note EmailMessage: ae8, except that no 'MIME-Version' headers\nare added when *note setcontent(): 160a. is called, since\nsub-parts do not need their own 'MIME-Version' headers.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/email/message.py\n\n(2) Originally added in 3.4 as a *note provisional module: eba.  Docs\nfor legacy message class moved to *note email.message.Message;\nRepresenting an email message using the compat32 API: 319f.\n\n(3) https://datatracker.ietf.org/doc/html/rfc5322.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc6532.html\n\n(5) https://datatracker.ietf.org/doc/html/rfc5322.html\n\n(6) https://datatracker.ietf.org/doc/html/rfc6531.html\n\n(7) https://datatracker.ietf.org/doc/html/rfc2231.html\n\n(8) https://datatracker.ietf.org/doc/html/rfc2231.html\n\n(9) https://datatracker.ietf.org/doc/html/rfc2045.html\n\n(10) https://datatracker.ietf.org/doc/html/rfc2045.html\n\n(11) https://datatracker.ietf.org/doc/html/rfc2045.html\n\n(12) https://datatracker.ietf.org/doc/html/rfc2231.html\n\n(13) https://datatracker.ietf.org/doc/html/rfc2183.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: email parser Parsing email messages,  Next: email generator Generating MIME documents,  Prev: email message Representing an email message,  Up: email -- An email and MIME handling package": {
            "content": "5.19.1.2 'email.parser': Parsing email messages\n...............................................\n\n'Source code:' Lib/email/parser.py(1)\n\n\n",
            "subsections": []
        },
        "Message object structures can be created in one of two ways: they can be": {
            "content": "created from whole cloth by creating an *note EmailMessage: ae8. object,\nadding headers using the dictionary interface, and adding payload(s)\nusing *note setcontent(): 160a. and related methods, or they can be\ncreated by parsing a serialized representation of the email message.\n\nThe *note email: 37. package provides a standard parser that understands\nmost email document structures, including MIME documents.  You can pass\nthe parser a bytes, string or file object, and the parser will return to\nyou the root *note EmailMessage: ae8. instance of the object structure.",
            "subsections": []
        },
        "For simple, non-MIME messages the payload of this root object will": {
            "content": "likely be a string containing the text of the message.  For MIME\nmessages, the root object will return 'True' from its *note\nismultipart(): 31a6. method, and the subparts can be accessed via the\npayload manipulation methods, such as *note getbody(): 31ca, *note\niterparts(): 31cc, and *note walk(): 31c9.\n\nThere are actually two parser interfaces available for use, the *note\nParser: 1012. API and the incremental *note FeedParser: 31de. API. The\n*note Parser: 1012. API is most useful if you have the entire text of\nthe message in memory, or if the entire message lives in a file on the\nfile system.  *note FeedParser: 31de. is more appropriate when you are\nreading the message from a stream which might block waiting for more\ninput (such as reading an email message from a socket).  The *note",
            "subsections": []
        },
        "FeedParser: 31de. can consume and parse the message incrementally, and": {
            "content": "only returns the root object when you close the parser.\n",
            "subsections": []
        },
        "Note that the parser can be extended in limited ways, and of course you": {
            "content": "can implement your own parser completely from scratch.  All of the logic\nthat connects the *note email: 37. package's bundled parser and the\n*note EmailMessage: ae8. class is embodied in the *note Policy: f23.\nclass, so a custom parser can create message object trees any way it\nfinds necessary by implementing custom versions of the appropriate\n'Policy' methods.\n\n* Menu:\n\n* FeedParser API::\n* Parser API::\n* Additional notes::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/email/parser.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: FeedParser API,  Next: Parser API,  Up: email parser Parsing email messages": {
            "content": "5.19.1.3 FeedParser API\n.......................\n\nThe *note BytesFeedParser: 103f, imported from the 'email.feedparser'\nmodule, provides an API that is conducive to incremental parsing of\nemail messages, such as would be necessary when reading the text of an\nemail message from a source that can block (such as a socket).  The\n*note BytesFeedParser: 103f. can of course be used to parse an email\nmessage fully contained in a *note bytes-like object: b82, string, or\nfile, but the *note BytesParser: 1040. API may be more convenient for\nsuch use cases.  The semantics and results of the two parser APIs are\nidentical.\n\nThe *note BytesFeedParser: 103f.'s API is simple; you create an\ninstance, feed it a bunch of bytes until there's no more to feed it,\nthen close the parser to retrieve the root message object.  The *note",
            "subsections": []
        },
        "BytesFeedParser: 103f. is extremely accurate when parsing": {
            "content": "standards-compliant messages, and it does a very good job of parsing\nnon-compliant messages, providing information about how a message was\ndeemed broken.  It will populate a message object's *note defects: 31db.\nattribute with a list of any problems it found in a message.  See the\n*note email.errors: 3b. module for the list of defects that it can find.\n\nHere is the API for the *note BytesFeedParser: 103f.:\n\n-- Class: email.parser.BytesFeedParser (factory=None, *,\npolicy=policy.compat32)\n\nCreate a *note BytesFeedParser: 103f. instance.  Optional\n'factory' is a no-argument callable; if not specified use the\n*note messagefactory: ae5. from the 'policy'.  Call 'factory'\nwhenever a new message object is needed.\n\nIf 'policy' is specified use the rules it specifies to update the\nrepresentation of the message.  If 'policy' is not set, use the\n*note compat32: f24. policy, which maintains backward compatibility\nwith the Python 3.2 version of the email package and provides *note\nMessage: ae7. as the default factory.  All other policies provide\n*note EmailMessage: ae8. as the default 'factory'.  For more\ninformation on what else 'policy' controls, see the *note policy:\n4b. documentation.\n\nNote: 'The policy keyword should always be specified'; The default\nwill change to *note email.policy.default: 31a0. in a future\nversion of Python.\n\nNew in version 3.2.\n\nChanged in version 3.3: Added the 'policy' keyword.\n\nChanged in version 3.6: 'factory' defaults to the policy\n'messagefactory'.\n\n-- Method: feed (data)\n\nFeed the parser some more data.  'data' should be a *note\nbytes-like object: b82. containing one or more lines.  The\nlines can be partial and the parser will stitch such partial\nlines together properly.  The lines can have any of the three\ncommon line endings: carriage return, newline, or carriage\nreturn and newline (they can even be mixed).\n\n-- Method: close ()\n\nComplete the parsing of all previously fed data and return the\nroot message object.  It is undefined what happens if *note\nfeed(): 31e0. is called after this method has been called.\n\n-- Class: email.parser.FeedParser (factory=None, *,\npolicy=policy.compat32)\n\nWorks like *note BytesFeedParser: 103f. except that the input to\nthe *note feed(): 31e0. method must be a string.  This is of\nlimited utility, since the only way for such a message to be valid\nis for it to contain only ASCII text or, if 'utf8' is 'True', no\nbinary attachments.\n\nChanged in version 3.3: Added the 'policy' keyword.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Parser API,  Next: Additional notes,  Prev: FeedParser API,  Up: email parser Parsing email messages": {
            "content": "5.19.1.4 Parser API\n...................\n\nThe *note BytesParser: 1040. class, imported from the *note\nemail.parser: 4a. module, provides an API that can be used to parse a\nmessage when the complete contents of the message are available in a\n*note bytes-like object: b82. or file.  The *note email.parser: 4a.\nmodule also provides *note Parser: 1012. for parsing strings, and\nheader-only parsers, *note BytesHeaderParser: f2b. and *note",
            "subsections": []
        },
        "HeaderParser: f2c, which can be used if you're only interested in the": {
            "content": "headers of the message.  *note BytesHeaderParser: f2b. and *note",
            "subsections": []
        },
        "HeaderParser: f2c. can be much faster in these situations, since they do": {
            "content": "not attempt to parse the message body, instead setting the payload to\nthe raw body.\n\n-- Class: email.parser.BytesParser (class=None, *,\npolicy=policy.compat32)\n\nCreate a *note BytesParser: 1040. instance.  The 'class' and\n'policy' arguments have the same meaning and semantics as the\n'factory' and 'policy' arguments of *note BytesFeedParser: 103f.\n\nNote: 'The policy keyword should always be specified'; The default\nwill change to *note email.policy.default: 31a0. in a future\nversion of Python.\n\nChanged in version 3.3: Removed the 'strict' argument that was\ndeprecated in 2.4.  Added the 'policy' keyword.\n\nChanged in version 3.6: 'class' defaults to the policy\n'messagefactory'.\n\n-- Method: parse (fp, headersonly=False)\n\nRead all the data from the binary file-like object 'fp', parse\nthe resulting bytes, and return the message object.  'fp' must\nsupport both the *note readline(): 11a1. and the 'read()'\nmethods.\n\nThe bytes contained in 'fp' must be formatted as a block of\nRFC 5322(1) (or, if 'utf8' is 'True', RFC 6532(2)) style\nheaders and header continuation lines, optionally preceded by\nan envelope header.  The header block is terminated either by\nthe end of the data or by a blank line.  Following the header\nblock is the body of the message (which may contain\nMIME-encoded subparts, including subparts with a\n'Content-Transfer-Encoding' of '8bit').\n\nOptional 'headersonly' is a flag specifying whether to stop\nparsing after reading the headers or not.  The default is\n'False', meaning it parses the entire contents of the file.\n\n-- Method: parsebytes (bytes, headersonly=False)\n\nSimilar to the *note parse(): 31e3. method, except it takes a\n*note bytes-like object: b82. instead of a file-like object.\nCalling this method on a *note bytes-like object: b82. is\nequivalent to wrapping 'bytes' in a *note BytesIO: d08.\ninstance first and calling *note parse(): 31e3.\n\nOptional 'headersonly' is as with the *note parse(): 31e3.\nmethod.\n\nNew in version 3.2.\n\n-- Class: email.parser.BytesHeaderParser (class=None, *,\npolicy=policy.compat32)\n\nExactly like *note BytesParser: 1040, except that 'headersonly'\ndefaults to 'True'.\n\nNew in version 3.3.\n\n-- Class: email.parser.Parser (class=None, *, policy=policy.compat32)\n\nThis class is parallel to *note BytesParser: 1040, but handles\nstring input.\n\nChanged in version 3.3: Removed the 'strict' argument.  Added the\n'policy' keyword.\n\nChanged in version 3.6: 'class' defaults to the policy\n'messagefactory'.\n\n-- Method: parse (fp, headersonly=False)\n\nRead all the data from the text-mode file-like object 'fp',\nparse the resulting text, and return the root message object.\n'fp' must support both the *note readline(): 1a40. and the\n*note read(): 1a0a. methods on file-like objects.\n\nOther than the text mode requirement, this method operates\nlike *note BytesParser.parse(): 31e3.\n\n-- Method: parsestr (text, headersonly=False)\n\nSimilar to the *note parse(): 31e5. method, except it takes a\nstring object instead of a file-like object.  Calling this\nmethod on a string is equivalent to wrapping 'text' in a *note\nStringIO: d94. instance first and calling *note parse(): 31e5.\n\nOptional 'headersonly' is as with the *note parse(): 31e5.\nmethod.\n\n-- Class: email.parser.HeaderParser (class=None, *,\npolicy=policy.compat32)\n\nExactly like *note Parser: 1012, except that 'headersonly' defaults\nto 'True'.\n",
            "subsections": []
        },
        "Since creating a message object structure from a string or a file object": {
            "content": "is such a common task, four functions are provided as a convenience.\nThey are available in the top-level *note email: 37. package namespace.\n\n-- Function: email.messagefrombytes (s, class=None, *,\npolicy=policy.compat32)\n\nReturn a message object structure from a *note bytes-like object:\nb82.  This is equivalent to 'BytesParser().parsebytes(s)'.\nOptional 'class' and 'policy' are interpreted as with the *note\nBytesParser: 1040. class constructor.\n\nNew in version 3.2.\n\nChanged in version 3.3: Removed the 'strict' argument.  Added the\n'policy' keyword.\n\n-- Function: email.messagefrombinaryfile (fp, class=None, *,\npolicy=policy.compat32)\n\nReturn a message object structure tree from an open binary *note\nfile object: 1037.  This is equivalent to\n'BytesParser().parse(fp)'.  'class' and 'policy' are interpreted\nas with the *note BytesParser: 1040. class constructor.\n\nNew in version 3.2.\n\nChanged in version 3.3: Removed the 'strict' argument.  Added the\n'policy' keyword.\n\n-- Function: email.messagefromstring (s, class=None, *,\npolicy=policy.compat32)\n\nReturn a message object structure from a string.  This is\nequivalent to 'Parser().parsestr(s)'.  'class' and 'policy' are\ninterpreted as with the *note Parser: 1012. class constructor.\n\nChanged in version 3.3: Removed the 'strict' argument.  Added the\n'policy' keyword.\n\n-- Function: email.messagefromfile (fp, class=None, *,\npolicy=policy.compat32)\n\nReturn a message object structure tree from an open *note file\nobject: 1037.  This is equivalent to 'Parser().parse(fp)'.\n'class' and 'policy' are interpreted as with the *note Parser:\n1012. class constructor.\n\nChanged in version 3.3: Removed the 'strict' argument.  Added the\n'policy' keyword.\n\nChanged in version 3.6: 'class' defaults to the policy\n'messagefactory'.\n\nHere's an example of how you might use *note messagefrombytes(): 103d.\nat an interactive Python prompt:\n\n>>> import email\n>>> msg = email.messagefrombytes(myBytes)\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc5322.html\n\n(2) https://datatracker.ietf.org/doc/html/rfc6532.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Additional notes,  Prev: Parser API,  Up: email parser Parsing email messages": {
            "content": "5.19.1.5 Additional notes\n.........................\n\nHere are some notes on the parsing semantics:\n\n* Most non-'multipart' type messages are parsed as a single message\nobject with a string payload.  These objects will return 'False'\nfor *note ismultipart(): 31a6, and *note iterparts(): 31cc. will\nyield an empty list.\n\n* All 'multipart' type messages will be parsed as a container message\nobject with a list of sub-message objects for their payload.  The\nouter container message will return 'True' for *note\nismultipart(): 31a6, and *note iterparts(): 31cc. will yield a\nlist of subparts.\n\n* Most messages with a content type of 'message/*' (such as\n'message/delivery-status' and 'message/rfc822') will also be parsed\nas container object containing a list payload of length 1.  Their\n*note ismultipart(): 31a6. method will return 'True'.  The single\nelement yielded by *note iterparts(): 31cc. will be a sub-message\nobject.\n\n* Some non-standards-compliant messages may not be internally\nconsistent about their 'multipart'-edness.  Such messages may have\na 'Content-Type' header of type 'multipart', but their *note\nismultipart(): 31a6. method may return 'False'.  If such messages\nwere parsed with the *note FeedParser: 31de, they will have an\ninstance of the 'MultipartInvariantViolationDefect' class in their\n'defects' attribute list.  See *note email.errors: 3b. for details.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: email generator Generating MIME documents,  Next: email policy Policy Objects,  Prev: email parser Parsing email messages,  Up: email -- An email and MIME handling package": {
            "content": "5.19.1.6 'email.generator': Generating MIME documents\n.....................................................\n\n'Source code:' Lib/email/generator.py(1)\n\n\n",
            "subsections": []
        },
        "One of the most common tasks is to generate the flat (serialized)": {
            "content": "version of the email message represented by a message object structure.\nYou will need to do this if you want to send your message via *note\nsmtplib.SMTP.sendmail(): cba. or the *note nntplib: 98. module, or print\nthe message on the console.  Taking a message object structure and\nproducing a serialized representation is the job of the generator\nclasses.\n\nAs with the *note email.parser: 4a. module, you aren't limited to the\nfunctionality of the bundled generator; you could write one from scratch\nyourself.  However the bundled generator knows how to generate most\nemail in a standards-compliant way, should handle MIME and non-MIME\nemail messages just fine, and is designed so that the bytes-oriented\nparsing and generation operations are inverses, assuming the same\nnon-transforming *note policy: 4b. is used for both.  That is, parsing\nthe serialized byte stream via the *note BytesParser: 1040. class and\nthen regenerating the serialized byte stream using *note BytesGenerator:\n1043. should produce output identical to the input (2).  (On the other\nhand, using the generator on an *note EmailMessage: ae8. constructed by\nprogram may result in changes to the *note EmailMessage: ae8. object as\ndefaults are filled in.)\n\nThe *note Generator: 1042. class can be used to flatten a message into a\ntext (as opposed to binary) serialized representation, but since Unicode\ncannot represent binary data directly, the message is of necessity\ntransformed into something that contains only ASCII characters, using\nthe standard email RFC Content Transfer Encoding techniques for encoding\nemail messages for transport over channels that are not \"8 bit clean\".\n\nTo accommodate reproducible processing of SMIME-signed messages *note",
            "subsections": []
        },
        "Generator: 1042. disables header folding for message parts of type": {
            "content": "'multipart/signed' and all subparts.\n\n-- Class: email.generator.BytesGenerator (outfp, manglefrom=None,\nmaxheaderlen=None, *, policy=None)\n\nReturn a *note BytesGenerator: 1043. object that will write any\nmessage provided to the *note flatten(): 31ed. method, or any\nsurrogateescape encoded text provided to the *note write(): 31ee.\nmethod, to the *note file-like object: 229a. 'outfp'.  'outfp' must\nsupport a 'write' method that accepts binary data.\n\nIf optional 'manglefrom' is 'True', put a '>' character in front\nof any line in the body that starts with the exact string '\"From\n\"', that is 'From' followed by a space at the beginning of a line.\n'manglefrom' defaults to the value of the *note manglefrom:\nc53. setting of the 'policy' (which is 'True' for the *note\ncompat32: ae6. policy and 'False' for all others).  'manglefrom'\nis intended for use when messages are stored in Unix mbox format\n(see *note mailbox: 86. and WHY THE CONTENT-LENGTH FORMAT IS\nBAD(3)).\n\nIf 'maxheaderlen' is not 'None', refold any header lines that are\nlonger than 'maxheaderlen', or if '0', do not rewrap any headers.\nIf 'manheaderlen' is 'None' (the default), wrap headers and other\nmessage lines according to the 'policy' settings.\n\nIf 'policy' is specified, use that policy to control message\ngeneration.  If 'policy' is 'None' (the default), use the policy\nassociated with the *note Message: ae7. or *note EmailMessage: ae8.\nobject passed to 'flatten' to control the message generation.  See\n*note email.policy: 4b. for details on what 'policy' controls.\n\nNew in version 3.2.\n\nChanged in version 3.3: Added the 'policy' keyword.\n\nChanged in version 3.6: The default behavior of the 'manglefrom'\nand 'maxheaderlen' parameters is to follow the policy.\n\n-- Method: flatten (msg, unixfrom=False, linesep=None)\n\nPrint the textual representation of the message object\nstructure rooted at 'msg' to the output file specified when\nthe *note BytesGenerator: 1043. instance was created.\n\nIf the *note policy: 4b. option *note ctetype: 31ef. is\n'8bit' (the default), copy any headers in the original parsed\nmessage that have not been modified to the output with any\nbytes with the high bit set reproduced as in the original, and\npreserve the non-ASCII 'Content-Transfer-Encoding' of any body\nparts that have them.  If 'ctetype' is '7bit', convert the\nbytes with the high bit set as needed using an\nASCII-compatible 'Content-Transfer-Encoding'.  That is,\ntransform parts with non-ASCII 'Content-Transfer-Encoding'\n('Content-Transfer-Encoding: 8bit') to an ASCII compatible\n'Content-Transfer-Encoding', and encode RFC-invalid non-ASCII\nbytes in headers using the MIME 'unknown-8bit' character set,\nthus rendering them RFC-compliant.\n\nIf 'unixfrom' is 'True', print the envelope header delimiter\nused by the Unix mailbox format (see *note mailbox: 86.)\nbefore the first of the RFC 5322(4) headers of the root\nmessage object.  If the root object has no envelope header,\ncraft a standard one.  The default is 'False'.  Note that for\nsubparts, no envelope header is ever printed.\n\nIf 'linesep' is not 'None', use it as the separator character\nbetween all the lines of the flattened message.  If 'linesep'\nis 'None' (the default), use the value specified in the\n'policy'.\n\n-- Method: clone (fp)\n\nReturn an independent clone of this *note BytesGenerator:\n1043. instance with the exact same option settings, and 'fp'\nas the new 'outfp'.\n\n-- Method: write (s)\n\nEncode 's' using the 'ASCII' codec and the 'surrogateescape'\nerror handler, and pass it to the 'write' method of the\n'outfp' passed to the *note BytesGenerator: 1043.'s\nconstructor.\n\nAs a convenience, *note EmailMessage: ae8. provides the methods *note\nasbytes(): 31a4. and 'bytes(aMessage)' (a.k.a.  *note bytes():\n31a5.), which simplify the generation of a serialized binary\nrepresentation of a message object.  For more detail, see *note\nemail.message: 40.\n\nBecause strings cannot represent binary data, the *note Generator: 1042.\nclass must convert any binary data in any message it flattens to an\nASCII compatible format, by converting them to an ASCII compatible\n'Content-TransferEncoding'.  Using the terminology of the email RFCs,\nyou can think of this as *note Generator: 1042. serializing to an I/O\nstream that is not \"8 bit clean\".  In other words, most applications\nwill want to be using *note BytesGenerator: 1043, and not *note\nGenerator: 1042.\n\n-- Class: email.generator.Generator (outfp, manglefrom=None,\nmaxheaderlen=None, *, policy=None)\n\nReturn a *note Generator: 1042. object that will write any message\nprovided to the *note flatten(): 31f1. method, or any text provided\nto the *note write(): 31f2. method, to the *note file-like object:\n229a. 'outfp'.  'outfp' must support a 'write' method that accepts\nstring data.\n\nIf optional 'manglefrom' is 'True', put a '>' character in front\nof any line in the body that starts with the exact string '\"From\n\"', that is 'From' followed by a space at the beginning of a line.\n'manglefrom' defaults to the value of the *note manglefrom:\nc53. setting of the 'policy' (which is 'True' for the *note\ncompat32: ae6. policy and 'False' for all others).  'manglefrom'\nis intended for use when messages are stored in Unix mbox format\n(see *note mailbox: 86. and WHY THE CONTENT-LENGTH FORMAT IS\nBAD(5)).\n\nIf 'maxheaderlen' is not 'None', refold any header lines that are\nlonger than 'maxheaderlen', or if '0', do not rewrap any headers.\nIf 'manheaderlen' is 'None' (the default), wrap headers and other\nmessage lines according to the 'policy' settings.\n\nIf 'policy' is specified, use that policy to control message\ngeneration.  If 'policy' is 'None' (the default), use the policy\nassociated with the *note Message: ae7. or *note EmailMessage: ae8.\nobject passed to 'flatten' to control the message generation.  See\n*note email.policy: 4b. for details on what 'policy' controls.\n\nChanged in version 3.3: Added the 'policy' keyword.\n\nChanged in version 3.6: The default behavior of the 'manglefrom'\nand 'maxheaderlen' parameters is to follow the policy.\n\n-- Method: flatten (msg, unixfrom=False, linesep=None)\n\nPrint the textual representation of the message object\nstructure rooted at 'msg' to the output file specified when\nthe *note Generator: 1042. instance was created.\n\nIf the *note policy: 4b. option *note ctetype: 31ef. is\n'8bit', generate the message as if the option were set to\n'7bit'.  (This is required because strings cannot represent\nnon-ASCII bytes.)  Convert any bytes with the high bit set as\nneeded using an ASCII-compatible 'Content-Transfer-Encoding'.\nThat is, transform parts with non-ASCII\n'Content-Transfer-Encoding' ('Content-Transfer-Encoding:\n8bit') to an ASCII compatible 'Content-Transfer-Encoding', and\nencode RFC-invalid non-ASCII bytes in headers using the MIME\n'unknown-8bit' character set, thus rendering them\nRFC-compliant.\n\nIf 'unixfrom' is 'True', print the envelope header delimiter\nused by the Unix mailbox format (see *note mailbox: 86.)\nbefore the first of the RFC 5322(6) headers of the root\nmessage object.  If the root object has no envelope header,\ncraft a standard one.  The default is 'False'.  Note that for\nsubparts, no envelope header is ever printed.\n\nIf 'linesep' is not 'None', use it as the separator character\nbetween all the lines of the flattened message.  If 'linesep'\nis 'None' (the default), use the value specified in the\n'policy'.\n\nChanged in version 3.2: Added support for re-encoding '8bit'\nmessage bodies, and the 'linesep' argument.\n\n-- Method: clone (fp)\n\nReturn an independent clone of this *note Generator: 1042.\ninstance with the exact same options, and 'fp' as the new\n'outfp'.\n\n-- Method: write (s)\n\nWrite 's' to the 'write' method of the 'outfp' passed to the\n*note Generator: 1042.'s constructor.  This provides just\nenough file-like API for *note Generator: 1042. instances to\nbe used in the *note print(): de5. function.\n\nAs a convenience, *note EmailMessage: ae8. provides the methods *note\nasstring(): 31a1. and 'str(aMessage)' (a.k.a.  *note str(): 31a3.),\nwhich simplify the generation of a formatted string representation of a\nmessage object.  For more detail, see *note email.message: 40.\n\nThe *note email.generator: 3c. module also provides a derived class,\n*note DecodedGenerator: ae4, which is like the *note Generator: 1042.\nbase class, except that non-'text' parts are not serialized, but are\ninstead represented in the output stream by a string derived from a\ntemplate filled in with information about the part.\n\n-- Class: email.generator.DecodedGenerator (outfp, manglefrom=None,\nmaxheaderlen=None, fmt=None, *, policy=None)\n\nAct like *note Generator: 1042, except that for any subpart of the\nmessage passed to *note Generator.flatten(): 31f1, if the subpart\nis of main type 'text', print the decoded payload of the subpart,\nand if the main type is not 'text', instead of printing it fill in\nthe string 'fmt' using information from the part and print the\nresulting filled-in string.\n\nTo fill in 'fmt', execute 'fmt % partinfo', where 'partinfo' is a\ndictionary composed of the following keys and values:\n\n* 'type' - Full MIME type of the non-'text' part\n\n* 'maintype' - Main MIME type of the non-'text' part\n\n* 'subtype' - Sub-MIME type of the non-'text' part\n\n* 'filename' - Filename of the non-'text' part\n\n* 'description' - Description associated with the non-'text'\npart\n\n* 'encoding' - Content transfer encoding of the non-'text' part\n\nIf 'fmt' is 'None', use the following default 'fmt':\n\n\"[Non-text (%(type)s) part of message omitted, filename\n%(filename)s]\"\n\nOptional 'manglefrom' and 'maxheaderlen' are as with the *note\nGenerator: 1042. base class.\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/email/generator.py\n\n(2) This statement assumes that you use the appropriate setting for\n'unixfrom', and that there are no *note email.policy: 4b. settings\ncalling for automatic adjustments (for example, *note refoldsource:\n31ec. must be 'none', which is 'not' the default).  It is also not 100%\ntrue, since if the message does not conform to the RFC standards\noccasionally information about the exact original text is lost during\nparsing error recovery.  It is a goal to fix these latter edge cases\nwhen possible.\n\n(3) https://www.jwz.org/doc/content-length.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc5322.html\n\n(5) https://www.jwz.org/doc/content-length.html\n\n(6) https://datatracker.ietf.org/doc/html/rfc5322.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: email policy Policy Objects,  Next: email errors Exception and Defect classes,  Prev: email generator Generating MIME documents,  Up: email -- An email and MIME handling package": {
            "content": "5.19.1.7 'email.policy': Policy Objects\n.......................................\n\nNew in version 3.3.\n\n'Source code:' Lib/email/policy.py(1)\n\n\n\nThe *note email: 37. package's prime focus is the handling of email\nmessages as described by the various email and MIME RFCs.  However, the\ngeneral format of email messages (a block of header fields each\nconsisting of a name followed by a colon followed by a value, the whole\nblock followed by a blank line and an arbitrary 'body'), is a format\nthat has found utility outside of the realm of email.  Some of these\nuses conform fairly closely to the main email RFCs, some do not.  Even\nwhen working with email, there are times when it is desirable to break\nstrict compliance with the RFCs, such as generating emails that\ninteroperate with email servers that do not themselves follow the\nstandards, or that implement extensions you want to use in ways that\nviolate the standards.\n",
            "subsections": []
        },
        "Policy objects give the email package the flexibility to handle all": {
            "content": "these disparate use cases.\n\nA *note Policy: f23. object encapsulates a set of attributes and methods\nthat control the behavior of various components of the email package\nduring use.  *note Policy: f23. instances can be passed to various\nclasses and methods in the email package to alter the default behavior.\nThe settable values and their defaults are described below.\n",
            "subsections": []
        },
        "There is a default policy used by all classes in the email package.  For": {
            "content": "all of the *note parser: 4a. classes and the related convenience\nfunctions, and for the *note Message: ae7. class, this is the *note\nCompat32: f24. policy, via its corresponding pre-defined instance *note\ncompat32: ae6.  This policy provides for complete backward compatibility\n(in some cases, including bug compatibility) with the pre-Python3.3\nversion of the email package.\n\nThis default value for the 'policy' keyword to *note EmailMessage: ae8.\nis the *note EmailPolicy: f27. policy, via its pre-defined instance\n*note default: 31a0.\n\nWhen a *note Message: ae7. or *note EmailMessage: ae8. object is\ncreated, it acquires a policy.  If the message is created by a *note\nparser: 4a, a policy passed to the parser will be the policy used by the\nmessage it creates.  If the message is created by the program, then the\npolicy can be specified when it is created.  When a message is passed to\na *note generator: 3c, the generator uses the policy from the message by\ndefault, but you can also pass a specific policy to the generator that\nwill override the one stored on the message object.\n\nThe default value for the 'policy' keyword for the *note email.parser:\n4a. classes and the parser convenience functions 'will be changing' in a\nfuture version of Python.  Therefore you should 'always specify\nexplicitly which policy you want to use' when calling any of the classes\nand functions described in the *note parser: 4a. module.\n\nThe first part of this documentation covers the features of *note\nPolicy: f23, an *note abstract base class: 102a. that defines the\nfeatures that are common to all policy objects, including *note\ncompat32: ae6.  This includes certain hook methods that are called\ninternally by the email package, which a custom policy could override to\nobtain different behavior.  The second part describes the concrete\nclasses *note EmailPolicy: f27. and *note Compat32: f24, which implement\nthe hooks that provide the standard behavior and the backward compatible\nbehavior and features, respectively.\n\n*note Policy: f23. instances are immutable, but they can be cloned,\naccepting the same keyword arguments as the class constructor and\nreturning a new *note Policy: f23. instance that is a copy of the\noriginal but with the specified attributes values changed.\n",
            "subsections": []
        },
        "As an example, the following code could be used to read an email message": {
            "content": "from a file on disk and pass it to the system 'sendmail' program on a\nUnix system:\n\n>>> from email import messagefrombinaryfile\n>>> from email.generator import BytesGenerator\n>>> from email import policy\n>>> from subprocess import Popen, PIPE\n>>> with open('mymsg.txt', 'rb') as f:\n...     msg = messagefrombinaryfile(f, policy=policy.default)\n...\n>>> p = Popen(['sendmail', msg['To'].addresses[0]], stdin=PIPE)\n>>> g = BytesGenerator(p.stdin, policy=msg.policy.clone(linesep='\\r\\n'))\n>>> g.flatten(msg)\n>>> p.stdin.close()\n>>> rc = p.wait()\n\nHere we are telling *note BytesGenerator: 1043. to use the RFC correct\nline separator characters when creating the binary string to feed into\n'sendmail's' 'stdin', where the default policy would use '\\n' line\nseparators.\n",
            "subsections": []
        },
        "Some email package methods accept a 'policy' keyword argument, allowing": {
            "content": "the policy to be overridden for that method.  For example, the following\ncode uses the *note asbytes(): da7. method of the 'msg' object from the\nprevious example and writes the message to a file using the native line\nseparators for the platform on which it is running:\n\n>>> import os\n>>> with open('converted.txt', 'wb') as f:\n...     f.write(msg.asbytes(policy=msg.policy.clone(linesep=os.linesep)))\n17\n",
            "subsections": []
        },
        "Policy objects can also be combined using the addition operator,": {
            "content": "producing a policy object whose settings are a combination of the\nnon-default values of the summed objects:\n\n>>> compatSMTP = policy.compat32.clone(linesep='\\r\\n')\n>>> compatstrict = policy.compat32.clone(raiseondefect=True)\n>>> compatstrictSMTP = compatSMTP + compatstrict\n",
            "subsections": []
        },
        "This operation is not commutative; that is, the order in which the": {
            "content": "objects are added matters.  To illustrate:\n\n>>> policy100 = policy.compat32.clone(maxlinelength=100)\n>>> policy80 = policy.compat32.clone(maxlinelength=80)\n>>> apolicy = policy100 + policy80\n>>> apolicy.maxlinelength\n80\n>>> apolicy = policy80 + policy100\n>>> apolicy.maxlinelength\n100\n\n-- Class: email.policy.Policy (kw)\n\nThis is the *note abstract base class: 102a. for all policy\nclasses.  It provides default implementations for a couple of\ntrivial methods, as well as the implementation of the immutability\nproperty, the *note clone(): f25. method, and the constructor\nsemantics.\n\nThe constructor of a policy class can be passed various keyword\narguments.  The arguments that may be specified are any non-method\nproperties on this class, plus any additional non-method properties\non the concrete class.  A value specified in the constructor will\noverride the default value for the corresponding attribute.\n\nThis class defines the following properties, and thus values for\nthe following may be passed in the constructor of any policy class:\n\n-- Attribute: maxlinelength\n\nThe maximum length of any line in the serialized output, not\ncounting the end of line character(s).  Default is 78, per RFC\n5322(2).  A value of '0' or *note None: 43f. indicates that no\nline wrapping should be done at all.\n\n-- Attribute: linesep\n\nThe string to be used to terminate lines in serialized output.\nThe default is '\\n' because that's the internal end-of-line\ndiscipline used by Python, though '\\r\\n' is required by the\nRFCs.\n\n-- Attribute: ctetype\n\nControls the type of Content Transfer Encodings that may be or\nare required to be used.  The possible values are:\n\n'7bit'       all data must be \"7 bit clean\" (ASCII-only).  This means that\nwhere necessary data will be encoded using either\nquoted-printable or base64 encoding.\n\n\n'8bit'       data is not constrained to be 7 bit clean.  Data in headers is\nstill required to be ASCII-only and so will be encoded (see\n*note foldbinary(): 31f7. and *note utf8: c55. below for\nexceptions), but body parts may use the '8bit' CTE.\n\n\nA 'ctetype' value of '8bit' only works with 'BytesGenerator',\nnot 'Generator', because strings cannot contain binary data.\nIf a 'Generator' is operating under a policy that specifies\n'ctetype=8bit', it will act as if 'ctetype' is '7bit'.\n\n-- Attribute: raiseondefect\n\nIf *note True: a53, any defects encountered will be raised as\nerrors.  If *note False: 971. (the default), defects will be\npassed to the *note registerdefect(): 31f9. method.\n\n-- Attribute: manglefrom\n\nIf *note True: a53, lines starting with '\"From \"' in the body\nare escaped by putting a '>' in front of them.  This parameter\nis used when the message is being serialized by a generator.\nDefault: *note False: 971.\n\nNew in version 3.5.\n\n-- Attribute: messagefactory\n\nA factory function for constructing a new empty message\nobject.  Used by the parser when building messages.  Defaults\nto 'None', in which case *note Message: ae7. is used.\n\nNew in version 3.6.\n\n-- Attribute: verifygeneratedheaders\n\nIf 'True' (the default), the generator will raise *note\nHeaderWriteError: 31fb. instead of writing a header that is\nimproperly folded or delimited, such that it would be parsed\nas multiple headers or joined with adjacent data.  Such\nheaders can be generated by custom header classes or bugs in\nthe 'email' module.\n\nAs it's a security feature, this defaults to 'True' even in\nthe *note Compat32: f24. policy.  For backwards compatible,\nbut unsafe, behavior, it must be set to 'False' explicitly.\n\nNew in version 3.12.5.\n\nThe following *note Policy: f23. method is intended to be called by\ncode using the email library to create policy instances with custom\nsettings:\n\n-- Method: clone (kw)\n\nReturn a new *note Policy: f23. instance whose attributes have\nthe same values as the current instance, except where those\nattributes are given new values by the keyword arguments.\n\nThe remaining *note Policy: f23. methods are called by the email\npackage code, and are not intended to be called by an application\nusing the email package.  A custom policy must implement all of\nthese methods.\n\n-- Method: handledefect (obj, defect)\n\nHandle a 'defect' found on 'obj'.  When the email package\ncalls this method, 'defect' will always be a subclass of\n'Defect'.\n\nThe default implementation checks the *note raiseondefect:\n31f8. flag.  If it is 'True', 'defect' is raised as an\nexception.  If it is 'False' (the default), 'obj' and 'defect'\nare passed to *note registerdefect(): 31f9.\n\n-- Method: registerdefect (obj, defect)\n\nRegister a 'defect' on 'obj'.  In the email package, 'defect'\nwill always be a subclass of 'Defect'.\n\nThe default implementation calls the 'append' method of the\n'defects' attribute of 'obj'.  When the email package calls\n*note handledefect: 31fc, 'obj' will normally have a\n'defects' attribute that has an 'append' method.  Custom\nobject types used with the email package (for example, custom\n'Message' objects) should also provide such an attribute,\notherwise defects in parsed messages will raise unexpected\nerrors.\n\n-- Method: headermaxcount (name)\n\nReturn the maximum allowed number of headers named 'name'.\n\nCalled when a header is added to an *note EmailMessage: ae8.\nor *note Message: ae7. object.  If the returned value is not\n'0' or 'None', and there are already a number of headers with\nthe name 'name' greater than or equal to the value returned, a\n*note ValueError: 183. is raised.\n\nBecause the default behavior of 'Message.setitem' is to\nappend the value to the list of headers, it is easy to create\nduplicate headers without realizing it.  This method allows\ncertain headers to be limited in the number of instances of\nthat header that may be added to a 'Message' programmatically.\n(The limit is not observed by the parser, which will\nfaithfully produce as many headers as exist in the message\nbeing parsed.)\n\nThe default implementation returns 'None' for all header\nnames.\n\n-- Method: headersourceparse (sourcelines)\n\nThe email package calls this method with a list of strings,\neach string ending with the line separation characters found\nin the source being parsed.  The first line includes the field\nheader name and separator.  All whitespace in the source is\npreserved.  The method should return the '(name, value)' tuple\nthat is to be stored in the 'Message' to represent the parsed\nheader.\n\nIf an implementation wishes to retain compatibility with the\nexisting email package policies, 'name' should be the case\npreserved name (all characters up to the '':'' separator),\nwhile 'value' should be the unfolded value (all line separator\ncharacters removed, but whitespace kept intact), stripped of\nleading whitespace.\n\n'sourcelines' may contain surrogateescaped binary data.\n\nThere is no default implementation\n\n-- Method: headerstoreparse (name, value)\n\nThe email package calls this method with the name and value\nprovided by the application program when the application\nprogram is modifying a 'Message' programmatically (as opposed\nto a 'Message' created by a parser).  The method should return\nthe '(name, value)' tuple that is to be stored in the\n'Message' to represent the header.\n\nIf an implementation wishes to retain compatibility with the\nexisting email package policies, the 'name' and 'value' should\nbe strings or string subclasses that do not change the content\nof the passed in arguments.\n\nThere is no default implementation\n\n-- Method: headerfetchparse (name, value)\n\nThe email package calls this method with the 'name' and\n'value' currently stored in the 'Message' when that header is\nrequested by the application program, and whatever the method\nreturns is what is passed back to the application as the value\nof the header being retrieved.  Note that there may be more\nthan one header with the same name stored in the 'Message';\nthe method is passed the specific name and value of the header\ndestined to be returned to the application.\n\n'value' may contain surrogateescaped binary data.  There\nshould be no surrogateescaped binary data in the value\nreturned by the method.\n\nThere is no default implementation\n\n-- Method: fold (name, value)\n\nThe email package calls this method with the 'name' and\n'value' currently stored in the 'Message' for a given header.\nThe method should return a string that represents that header\n\"folded\" correctly (according to the policy settings) by\ncomposing the 'name' with the 'value' and inserting *note\nlinesep: 31f6. characters at the appropriate places.  See RFC\n5322(3) for a discussion of the rules for folding email\nheaders.\n\n'value' may contain surrogateescaped binary data.  There\nshould be no surrogateescaped binary data in the string\nreturned by the method.\n\n-- Method: foldbinary (name, value)\n\nThe same as *note fold(): 3201, except that the returned value\nshould be a bytes object rather than a string.\n\n'value' may contain surrogateescaped binary data.  These could\nbe converted back into binary data in the returned bytes\nobject.\n\n-- Class: email.policy.EmailPolicy (kw)\n\nThis concrete *note Policy: f23. provides behavior that is intended\nto be fully compliant with the current email RFCs.  These include\n(but are not limited to) RFC 5322(4), RFC 2047(5), and the current\nMIME RFCs.\n\nThis policy adds new header parsing and folding algorithms.\nInstead of simple strings, headers are 'str' subclasses with\nattributes that depend on the type of the field.  The parsing and\nfolding algorithm fully implement RFC 2047(6) and RFC 5322(7).\n\nThe default value for the *note messagefactory: ae5. attribute is\n*note EmailMessage: ae8.\n\nIn addition to the settable attributes listed above that apply to\nall policies, this policy adds the following additional attributes:\n\nNew in version 3.6: (8)\n\n-- Attribute: utf8\n\nIf 'False', follow RFC 5322(9), supporting non-ASCII\ncharacters in headers by encoding them as \"encoded words\".  If\n'True', follow RFC 6532(10) and use 'utf-8' encoding for\nheaders.  Messages formatted in this way may be passed to SMTP\nservers that support the 'SMTPUTF8' extension ( RFC 6531(11)).\n\n-- Attribute: refoldsource\n\nIf the value for a header in the 'Message' object originated\nfrom a *note parser: 4a. (as opposed to being set by a\nprogram), this attribute indicates whether or not a generator\nshould refold that value when transforming the message back\ninto serialized form.  The possible values are:\n\n'none'       all source values use original folding\n\n\n'long'       source values that have any line that is longer than\n'maxlinelength' will be refolded\n\n\n'all'        all values are refolded.\n\n\nThe default is 'long'.\n\n-- Attribute: headerfactory\n\nA callable that takes two arguments, 'name' and 'value', where\n'name' is a header field name and 'value' is an unfolded\nheader field value, and returns a string subclass that\nrepresents that header.  A default 'headerfactory' (see *note\nheaderregistry: 3e.) is provided that supports custom parsing\nfor the various address and date RFC 5322(12) header field\ntypes, and the major MIME header field stypes.  Support for\nadditional custom parsing will be added in the future.\n\n-- Attribute: contentmanager\n\nAn object with at least two methods: getcontent and\nsetcontent.  When the *note getcontent(): 31cd. or *note\nsetcontent(): 160a. method of an *note EmailMessage: ae8.\nobject is called, it calls the corresponding method of this\nobject, passing it the message object as its first argument,\nand any arguments or keywords that were passed to it as\nadditional arguments.  By default 'contentmanager' is set to\n*note rawdatamanager: 3203.\n\nNew in version 3.4.\n\nThe class provides the following concrete implementations of the\nabstract methods of *note Policy: f23.:\n\n-- Method: headermaxcount (name)\n\nReturns the value of the *note maxcount: 3205. attribute of\nthe specialized class used to represent the header with the\ngiven name.\n\n-- Method: headersourceparse (sourcelines)\n\nThe name is parsed as everything up to the '':'' and returned\nunmodified.  The value is determined by stripping leading\nwhitespace off the remainder of the first line, joining all\nsubsequent lines together, and stripping any trailing carriage\nreturn or linefeed characters.\n\n-- Method: headerstoreparse (name, value)\n\nThe name is returned unchanged.  If the input value has a\n'name' attribute and it matches 'name' ignoring case, the\nvalue is returned unchanged.  Otherwise the 'name' and 'value'\nare passed to 'headerfactory', and the resulting header\nobject is returned as the value.  In this case a 'ValueError'\nis raised if the input value contains CR or LF characters.\n\n-- Method: headerfetchparse (name, value)\n\nIf the value has a 'name' attribute, it is returned to\nunmodified.  Otherwise the 'name', and the 'value' with any CR\nor LF characters removed, are passed to the 'headerfactory',\nand the resulting header object is returned.  Any\nsurrogateescaped bytes get turned into the unicode\nunknown-character glyph.\n\n-- Method: fold (name, value)\n\nHeader folding is controlled by the *note refoldsource: 31ec.\npolicy setting.  A value is considered to be a 'source value'\nif and only if it does not have a 'name' attribute (having a\n'name' attribute means it is a header object of some sort).\nIf a source value needs to be refolded according to the\npolicy, it is converted into a header object by passing the\n'name' and the 'value' with any CR and LF characters removed\nto the 'headerfactory'.  Folding of a header object is done\nby calling its 'fold' method with the current policy.\n\nSource values are split into lines using *note splitlines():\n10ce.  If the value is not to be refolded, the lines are\nrejoined using the 'linesep' from the policy and returned.\nThe exception is lines containing non-ascii binary data.  In\nthat case the value is refolded regardless of the\n'refoldsource' setting, which causes the binary data to be\nCTE encoded using the 'unknown-8bit' charset.\n\n-- Method: foldbinary (name, value)\n\nThe same as *note fold(): 13c6. if *note ctetype: 31ef. is\n'7bit', except that the returned value is bytes.\n\nIf *note ctetype: 31ef. is '8bit', non-ASCII binary data is\nconverted back into bytes.  Headers with binary data are not\nrefolded, regardless of the 'refoldheader' setting, since\nthere is no way to know whether the binary data consists of\nsingle byte characters or multibyte characters.\n\nThe following instances of *note EmailPolicy: f27. provide defaults\nsuitable for specific application domains.  Note that in the future the\nbehavior of these instances (in particular the 'HTTP' instance) may be\nadjusted to conform even more closely to the RFCs relevant to their\ndomains.\n\n-- Data: email.policy.default\n\nAn instance of 'EmailPolicy' with all defaults unchanged.  This\npolicy uses the standard Python '\\n' line endings rather than the\nRFC-correct '\\r\\n'.\n\n-- Data: email.policy.SMTP\n\nSuitable for serializing messages in conformance with the email\nRFCs.  Like 'default', but with 'linesep' set to '\\r\\n', which is\nRFC compliant.\n\n-- Data: email.policy.SMTPUTF8\n\nThe same as 'SMTP' except that *note utf8: c55. is 'True'.  Useful\nfor serializing messages to a message store without using encoded\nwords in the headers.  Should only be used for SMTP transmission if\nthe sender or recipient addresses have non-ASCII characters (the\n*note smtplib.SMTP.sendmessage(): cbb. method handles this\nautomatically).\n\n-- Data: email.policy.HTTP\n\nSuitable for serializing headers with for use in HTTP traffic.\nLike 'SMTP' except that 'maxlinelength' is set to 'None'\n(unlimited).\n\n-- Data: email.policy.strict\n\nConvenience instance.  The same as 'default' except that\n'raiseondefect' is set to 'True'.  This allows any policy to be\nmade strict by writing:\n\nsomepolicy + policy.strict\n\nWith all of these *note EmailPolicies: f27, the effective API of the\nemail package is changed from the Python 3.2 API in the following ways:\n\n* Setting a header on a *note Message: ae7. results in that header\nbeing parsed and a header object created.\n\n* Fetching a header value from a *note Message: ae7. results in that\nheader being parsed and a header object created and returned.\n\n* Any header object, or any header that is refolded due to the policy\nsettings, is folded using an algorithm that fully implements the\nRFC folding algorithms, including knowing where encoded words are\nrequired and allowed.\n",
            "subsections": []
        },
        "From the application view, this means that any header obtained through": {
            "content": "the *note EmailMessage: ae8. is a header object with extra attributes,\nwhose string value is the fully decoded unicode value of the header.",
            "subsections": []
        },
        "Likewise, a header may be assigned a new value, or a new header created,": {
            "content": "using a unicode string, and the policy will take care of converting the\nunicode string into the correct RFC encoded form.\n\nThe header objects and their attributes are described in *note\nheaderregistry: 3e.\n\n-- Class: email.policy.Compat32 (kw)\n\nThis concrete *note Policy: f23. is the backward compatibility\npolicy.  It replicates the behavior of the email package in Python\n3.2.  The *note policy: 4b. module also defines an instance of this\nclass, *note compat32: ae6, that is used as the default policy.\nThus the default behavior of the email package is to maintain\ncompatibility with Python 3.2.\n\nThe following attributes have values that are different from the\n*note Policy: f23. default:\n\n-- Attribute: manglefrom\n\nThe default is 'True'.\n\nThe class provides the following concrete implementations of the\nabstract methods of *note Policy: f23.:\n\n-- Method: headersourceparse (sourcelines)\n\nThe name is parsed as everything up to the '':'' and returned\nunmodified.  The value is determined by stripping leading\nwhitespace off the remainder of the first line, joining all\nsubsequent lines together, and stripping any trailing carriage\nreturn or linefeed characters.\n\n-- Method: headerstoreparse (name, value)\n\nThe name and value are returned unmodified.\n\n-- Method: headerfetchparse (name, value)\n\nIf the value contains binary data, it is converted into a\n*note Header: 160b. object using the 'unknown-8bit' charset.\nOtherwise it is returned unmodified.\n\n-- Method: fold (name, value)\n\nHeaders are folded using the *note Header: 160b. folding\nalgorithm, which preserves existing line breaks in the value,\nand wraps each resulting line to the 'maxlinelength'.\nNon-ASCII binary data are CTE encoded using the 'unknown-8bit'\ncharset.\n\n-- Method: foldbinary (name, value)\n\nHeaders are folded using the *note Header: 160b. folding\nalgorithm, which preserves existing line breaks in the value,\nand wraps each resulting line to the 'maxlinelength'.  If\n'ctetype' is '7bit', non-ascii binary data is CTE encoded\nusing the 'unknown-8bit' charset.  Otherwise the original\nsource header is used, with its existing line breaks and any\n(RFC invalid) binary data it may contain.\n\n-- Data: email.policy.compat32\n\nAn instance of *note Compat32: f24, providing backward\ncompatibility with the behavior of the email package in Python 3.2.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/email/policy.py\n\n(2) https://datatracker.ietf.org/doc/html/rfc5322.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc5322.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc5322.html\n\n(5) https://datatracker.ietf.org/doc/html/rfc2047.html\n\n(6) https://datatracker.ietf.org/doc/html/rfc2047.html\n\n(7) https://datatracker.ietf.org/doc/html/rfc5322.html\n\n(8) Originally added in 3.3 as a *note provisional feature: eba.\n\n(9) https://datatracker.ietf.org/doc/html/rfc5322.html\n\n(10) https://datatracker.ietf.org/doc/html/rfc6532.html\n\n(11) https://datatracker.ietf.org/doc/html/rfc6531.html\n\n(12) https://datatracker.ietf.org/doc/html/rfc5322.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: email errors Exception and Defect classes,  Next: email headerregistry Custom Header Objects,  Prev: email policy Policy Objects,  Up: email -- An email and MIME handling package": {
            "content": "5.19.1.8 'email.errors': Exception and Defect classes\n.....................................................\n\n'Source code:' Lib/email/errors.py(1)\n\n\n\nThe following exception classes are defined in the *note email.errors:\n3b. module:\n\n-- Exception: email.errors.MessageError\n\nThis is the base class for all exceptions that the *note email: 37.\npackage can raise.  It is derived from the standard *note\nException: 7ff. class and defines no additional methods.\n\n-- Exception: email.errors.MessageParseError\n\nThis is the base class for exceptions raised by the *note Parser:\n1012. class.  It is derived from *note MessageError: 3216.  This\nclass is also used internally by the parser used by *note\nheaderregistry: 3e.\n\n-- Exception: email.errors.HeaderParseError\n\nRaised under some error conditions when parsing the RFC 5322(2)\nheaders of a message, this class is derived from *note\nMessageParseError: 3217.  The *note setboundary(): 31c2. method\nwill raise this error if the content type is unknown when the\nmethod is called.  *note Header: 160b. may raise this error for\ncertain base64 decoding errors, and when an attempt is made to\ncreate a header that appears to contain an embedded header (that\nis, there is what is supposed to be a continuation line that has no\nleading whitespace and looks like a header).\n\n-- Exception: email.errors.BoundaryError\n\nDeprecated and no longer used.\n\n-- Exception: email.errors.MultipartConversionError\n\nRaised when a payload is added to a *note Message: ae7. object\nusing 'addpayload()', but the payload is already a scalar and the\nmessage's 'Content-Type' main type is not either 'multipart' or\nmissing.  *note MultipartConversionError: 3219. multiply inherits\nfrom *note MessageError: 3216. and the built-in *note TypeError:\n28e.\n\nSince 'Message.addpayload()' is deprecated, this exception is\nrarely raised in practice.  However the exception may also be\nraised if the *note attach(): 31d4. method is called on an instance\nof a class derived from *note MIMENonMultipart: 321a. (e.g.  *note\nMIMEImage: 321b.).\n\n-- Exception: email.errors.HeaderWriteError\n\nRaised when an error occurs when the *note generator: 3c. outputs\nheaders.\n\n-- Exception: email.errors.MessageDefect\n\nThis is the base class for all defects found when parsing email\nmessages.  It is derived from *note ValueError: 183.\n\n-- Exception: email.errors.HeaderDefect\n\nThis is the base class for all defects found when parsing email\nheaders.  It is derived from *note MessageDefect: 321c.\n\nHere is the list of the defects that the *note FeedParser: 31de. can\nfind while parsing messages.  Note that the defects are added to the\nmessage where the problem was found, so for example, if a message nested\ninside a 'multipart/alternative' had a malformed header, that nested\nmessage object would have a defect, but the containing messages would\nnot.\n\nAll defect classes are subclassed from *note email.errors.MessageDefect:\n321c.\n\n* 'NoBoundaryInMultipartDefect' - A message claimed to be a\nmultipart, but had no 'boundary' parameter.\n\n* 'StartBoundaryNotFoundDefect' - The start boundary claimed in the\n'Content-Type' header was never found.\n\n* 'CloseBoundaryNotFoundDefect' - A start boundary was found, but no\ncorresponding close boundary was ever found.\n\nNew in version 3.3.\n\n* 'FirstHeaderLineIsContinuationDefect' - The message had a\ncontinuation line as its first header line.\n\n* 'MisplacedEnvelopeHeaderDefect' - A \"Unix From\" header was found in\nthe middle of a header block.\n\n* 'MissingHeaderBodySeparatorDefect' - A line was found while parsing\nheaders that had no leading white space but contained no ':'.\nParsing continues assuming that the line represents the first line\nof the body.\n\nNew in version 3.3.\n\n* 'MalformedHeaderDefect' - A header was found that was missing a\ncolon, or was otherwise malformed.\n\nDeprecated since version 3.3: This defect has not been used for\nseveral Python versions.\n\n* 'MultipartInvariantViolationDefect' - A message claimed to be a\n'multipart', but no subparts were found.  Note that when a message\nhas this defect, its *note ismultipart(): 31c7. method may return\n'False' even though its content type claims to be 'multipart'.\n\n* 'InvalidBase64PaddingDefect' - When decoding a block of base64\nencoded bytes, the padding was not correct.  Enough padding is\nadded to perform the decode, but the resulting decoded bytes may be\ninvalid.\n\n* 'InvalidBase64CharactersDefect' - When decoding a block of base64\nencoded bytes, characters outside the base64 alphabet were\nencountered.  The characters are ignored, but the resulting decoded\nbytes may be invalid.\n\n* 'InvalidBase64LengthDefect' - When decoding a block of base64\nencoded bytes, the number of non-padding base64 characters was\ninvalid (1 more than a multiple of 4).  The encoded block was kept\nas-is.\n\n* 'InvalidDateDefect' - When decoding an invalid or unparsable date\nfield.  The original value is kept as-is.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/email/errors.py\n\n(2) https://datatracker.ietf.org/doc/html/rfc5322.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: email headerregistry Custom Header Objects,  Next: email contentmanager Managing MIME Content,  Prev: email errors Exception and Defect classes,  Up: email -- An email and MIME handling package": {
            "content": "5.19.1.9 'email.headerregistry': Custom Header Objects\n......................................................\n\n'Source code:' Lib/email/headerregistry.py(1)\n\n\n",
            "subsections": []
        },
        "The sections below first document the header base classes and their": {
            "content": "attributes, followed by the API for modifying the behavior of *note",
            "subsections": []
        },
        "HeaderRegistry: 3220, and finally the support classes used to represent": {
            "content": "the data parsed from structured headers.\n\n-- Class: email.headerregistry.BaseHeader (name, value)\n\n'name' and 'value' are passed to 'BaseHeader' from the *note\nheaderfactory: 3202. call.  The string value of any header object\nis the 'value' fully decoded to unicode.\n\nThis base class defines the following read-only properties:\n\n-- Attribute: name\n\nThe name of the header (the portion of the field before the\n':').  This is exactly the value passed in the *note\nheaderfactory: 3202. call for 'name'; that is, case is\npreserved.\n\n-- Attribute: defects\n\nA tuple of *note HeaderDefect: 321d. instances reporting any\nRFC compliance problems found during parsing.  The email\npackage tries to be complete about detecting compliance\nissues.  See the *note errors: 3b. module for a discussion of\nthe types of defects that may be reported.\n\n-- Attribute: maxcount\n\nThe maximum number of headers of this type that can have the\nsame 'name'.  A value of 'None' means unlimited.  The\n'BaseHeader' value for this attribute is 'None'; it is\nexpected that specialized header classes will override this\nvalue as needed.\n\n'BaseHeader' also provides the following method, which is called by\nthe email library code and should not in general be called by\napplication programs:\n\n-- Method: fold (*, policy)\n\nReturn a string containing *note linesep: 31f6. characters as\nrequired to correctly fold the header according to 'policy'.\nA *note ctetype: 31ef. of '8bit' will be treated as if it\nwere '7bit', since headers may not contain arbitrary binary\ndata.  If *note utf8: c55. is 'False', non-ASCII data will be\nRFC 2047(4) encoded.\n\n'BaseHeader' by itself cannot be used to create a header object.\nIt defines a protocol that each specialized header cooperates with\nin order to produce the header object.  Specifically, 'BaseHeader'\nrequires that the specialized class provide a *note classmethod():\n246. named 'parse'.  This method is called as follows:\n\nparse(string, kwds)\n\n'kwds' is a dictionary containing one pre-initialized key,\n'defects'.  'defects' is an empty list.  The parse method should\nappend any detected defects to this list.  On return, the 'kwds'\ndictionary 'must' contain values for at least the keys 'decoded'\nand 'defects'.  'decoded' should be the string value for the header\n(that is, the header value fully decoded to unicode).  The parse\nmethod should assume that 'string' may contain\ncontent-transfer-encoded parts, but should correctly handle all\nvalid unicode characters as well so that it can parse un-encoded\nheader values.\n\n'BaseHeader''s 'new' then creates the header instance, and\ncalls its 'init' method.  The specialized class only needs to\nprovide an 'init' method if it wishes to set additional attributes\nbeyond those provided by 'BaseHeader' itself.  Such an 'init'\nmethod should look like this:\n\ndef init(self, /, *args, kw):\nself.myattr = kw.pop('myattr')\nsuper().init(*args, kw)\n\nThat is, anything extra that the specialized class puts in to the\n'kwds' dictionary should be removed and handled, and the remaining\ncontents of 'kw' (and 'args') passed to the 'BaseHeader' 'init'\nmethod.\n\n-- Class: email.headerregistry.UnstructuredHeader\n\nAn \"unstructured\" header is the default type of header in RFC\n5322(5).  Any header that does not have a specified syntax is\ntreated as unstructured.  The classic example of an unstructured\nheader is the 'Subject' header.\n\nIn RFC 5322(6), an unstructured header is a run of arbitrary text\nin the ASCII character set.  RFC 2047(7), however, has an RFC\n5322(8) compatible mechanism for encoding non-ASCII text as ASCII\ncharacters within a header value.  When a 'value' containing\nencoded words is passed to the constructor, the\n'UnstructuredHeader' parser converts such encoded words into\nunicode, following the RFC 2047(9) rules for unstructured text.\nThe parser uses heuristics to attempt to decode certain\nnon-compliant encoded words.  Defects are registered in such cases,\nas well as defects for issues such as invalid characters within the\nencoded words or the non-encoded text.\n\nThis header type provides no additional attributes.\n\n-- Class: email.headerregistry.DateHeader\n\nRFC 5322(10) specifies a very specific format for dates within\nemail headers.  The 'DateHeader' parser recognizes that date\nformat, as well as recognizing a number of variant forms that are\nsometimes found \"in the wild\".\n\nThis header type provides the following additional attributes:\n\n-- Attribute: datetime\n\nIf the header value can be recognized as a valid date of one\nform or another, this attribute will contain a *note datetime:\n222. instance representing that date.  If the timezone of the\ninput date is specified as '-0000' (indicating it is in UTC\nbut contains no information about the source timezone), then\n*note datetime: 3226. will be a naive *note datetime: 222.  If\na specific timezone offset is found (including '+0000'), then\n*note datetime: 3226. will contain an aware 'datetime' that\nuses *note datetime.timezone: f2f. to record the timezone\noffset.\n\nThe 'decoded' value of the header is determined by formatting the\n'datetime' according to the RFC 5322(11) rules; that is, it is set\nto:\n\nemail.utils.formatdatetime(self.datetime)\n\nWhen creating a 'DateHeader', 'value' may be *note datetime: 222.\ninstance.  This means, for example, that the following code is\nvalid and does what one would expect:\n\nmsg['Date'] = datetime(2011, 7, 15, 21)\n\nBecause this is a naive 'datetime' it will be interpreted as a UTC\ntimestamp, and the resulting value will have a timezone of '-0000'.\nMuch more useful is to use the *note localtime(): 228. function\nfrom the *note utils: 4c. module:\n\nmsg['Date'] = utils.localtime()\n\nThis example sets the date header to the current time and date\nusing the current timezone offset.\n\n-- Class: email.headerregistry.AddressHeader\n\nAddress headers are one of the most complex structured header\ntypes.  The 'AddressHeader' class provides a generic interface to\nany address header.\n\nThis header type provides the following additional attributes:\n\n-- Attribute: groups\n\nA tuple of *note Group: 3229. objects encoding the addresses\nand groups found in the header value.  Addresses that are not\npart of a group are represented in this list as single-address\n'Groups' whose *note displayname: 322a. is 'None'.\n\n-- Attribute: addresses\n\nA tuple of *note Address: 322c. objects encoding all of the\nindividual addresses from the header value.  If the header\nvalue contains any groups, the individual addresses from the\ngroup are included in the list at the point where the group\noccurs in the value (that is, the list of addresses is\n\"flattened\" into a one dimensional list).\n\nThe 'decoded' value of the header will have all encoded words\ndecoded to unicode.  *note idna: 4d. encoded domain names are also\ndecoded to unicode.  The 'decoded' value is set by *note joining:\n1ed4. the *note str: 157. value of the elements of the 'groups'\nattribute with '', ''.\n\nA list of *note Address: 322c. and *note Group: 3229. objects in\nany combination may be used to set the value of an address header.\n'Group' objects whose 'displayname' is 'None' will be interpreted\nas single addresses, which allows an address list to be copied with\ngroups intact by using the list obtained from the 'groups'\nattribute of the source header.\n\n-- Class: email.headerregistry.SingleAddressHeader\n\nA subclass of *note AddressHeader: 3227. that adds one additional\nattribute:\n\n-- Attribute: address\n\nThe single address encoded by the header value.  If the header\nvalue actually contains more than one address (which would be\na violation of the RFC under the default *note policy: 4b.),\naccessing this attribute will result in a *note ValueError:\n183.\n",
            "subsections": []
        },
        "Many of the above classes also have a 'Unique' variant (for example,": {
            "content": "'UniqueUnstructuredHeader').  The only difference is that in the\n'Unique' variant, *note maxcount: 3205. is set to 1.\n\n-- Class: email.headerregistry.MIMEVersionHeader\n\nThere is really only one valid value for the 'MIME-Version' header,\nand that is '1.0'.  For future proofing, this header class supports\nother valid version numbers.  If a version number has a valid value\nper RFC 2045(12), then the header object will have non-'None'\nvalues for the following attributes:\n\n-- Attribute: version\n\nThe version number as a string, with any whitespace and/or\ncomments removed.\n\n-- Attribute: major\n\nThe major version number as an integer\n\n-- Attribute: minor\n\nThe minor version number as an integer\n\n-- Class: email.headerregistry.ParameterizedMIMEHeader\n\nMIME headers all start with the prefix 'Content-'.  Each specific\nheader has a certain value, described under the class for that\nheader.  Some can also take a list of supplemental parameters,\nwhich have a common format.  This class serves as a base for all\nthe MIME headers that take parameters.\n\n-- Attribute: params\n\nA dictionary mapping parameter names to parameter values.\n\n-- Class: email.headerregistry.ContentTypeHeader\n\nA *note ParameterizedMIMEHeader: 3233. class that handles the\n'Content-Type' header.\n\n-- Attribute: contenttype\n\nThe content type string, in the form 'maintype/subtype'.\n\n-- Attribute: maintype\n\n-- Attribute: subtype\n\n-- Class: email.headerregistry.ContentDispositionHeader\n\nA *note ParameterizedMIMEHeader: 3233. class that handles the\n'Content-Disposition' header.\n\n-- Attribute: contentdisposition\n\n'inline' and 'attachment' are the only valid values in common\nuse.\n\n-- Class: email.headerregistry.ContentTransferEncoding\n\nHandles the 'Content-Transfer-Encoding' header.\n\n-- Attribute: cte\n\nValid values are '7bit', '8bit', 'base64', and\n'quoted-printable'.  See RFC 2045(13) for more information.\n\n-- Class: email.headerregistry.HeaderRegistry (baseclass=BaseHeader,\ndefaultclass=UnstructuredHeader, usedefaultmap=True)\n\nThis is the factory used by *note EmailPolicy: f27. by default.\n'HeaderRegistry' builds the class used to create a header instance\ndynamically, using 'baseclass' and a specialized class retrieved\nfrom a registry that it holds.  When a given header name does not\nappear in the registry, the class specified by 'defaultclass' is\nused as the specialized class.  When 'usedefaultmap' is 'True'\n(the default), the standard mapping of header names to classes is\ncopied in to the registry during initialization.  'baseclass' is\nalways the last class in the generated class's 'bases' list.\n\nThe default mappings are:\n\n\nsubject: UniqueUnstructuredHeader\n\n\ndate: UniqueDateHeader\n\n\nresent-date: DateHeader\n\n\norig-date: UniqueDateHeader\n\n\nsender: UniqueSingleAddressHeader\n\n\nresent-sender: SingleAddressHeader\n\n\nto: UniqueAddressHeader\n\n\nresent-to: AddressHeader\n\n\ncc: UniqueAddressHeader\n\n\nresent-cc: AddressHeader\n\n\nbcc: UniqueAddressHeader\n\n\nresent-bcc: AddressHeader\n\n\nfrom: UniqueAddressHeader\n\n\nresent-from: AddressHeader\n\n\nreply-to: UniqueAddressHeader\n\n\nmime-version: MIMEVersionHeader\n\n\ncontent-type: ContentTypeHeader\n\n\ncontent-disposition: ContentDispositionHeader\n\n\ncontent-transfer-encoding: ContentTransferEncodingHeader\n\n\nmessage-id: MessageIDHeader\n\n'HeaderRegistry' has the following methods:\n\n-- Method: maptotype (self, name, cls)\n\n'name' is the name of the header to be mapped.  It will be\nconverted to lower case in the registry.  'cls' is the\nspecialized class to be used, along with 'baseclass', to\ncreate the class used to instantiate headers that match\n'name'.\n\n-- Method: getitem (name)\n\nConstruct and return a class to handle creating a 'name'\nheader.\n\n-- Method: call (name, value)\n\nRetrieves the specialized header associated with 'name' from\nthe registry (using 'defaultclass' if 'name' does not appear\nin the registry) and composes it with 'baseclass' to produce\na class, calls the constructed class's constructor, passing it\nthe same argument list, and finally returns the class instance\ncreated thereby.\n",
            "subsections": []
        },
        "The following classes are the classes used to represent data parsed from": {
            "content": "structured headers and can, in general, be used by an application\nprogram to construct structured values to assign to specific headers.\n\n-- Class: email.headerregistry.Address (displayname='', username='',\ndomain='', addrspec=None)\n\nThe class used to represent an email address.  The general form of\nan address is:\n\n[displayname] <username@domain>\n\nor:\n\nusername@domain\n\nwhere each part must conform to specific syntax rules spelled out\nin RFC 5322(14).\n\nAs a convenience 'addrspec' can be specified instead of 'username'\nand 'domain', in which case 'username' and 'domain' will be parsed\nfrom the 'addrspec'.  An 'addrspec' must be a properly RFC quoted\nstring; if it is not 'Address' will raise an error.  Unicode\ncharacters are allowed and will be property encoded when\nserialized.  However, per the RFCs, unicode is 'not' allowed in the\nusername portion of the address.\n\n-- Attribute: displayname\n\nThe display name portion of the address, if any, with all\nquoting removed.  If the address does not have a display name,\nthis attribute will be an empty string.\n\n-- Attribute: username\n\nThe 'username' portion of the address, with all quoting\nremoved.\n\n-- Attribute: domain\n\nThe 'domain' portion of the address.\n\n-- Attribute: addrspec\n\nThe 'username@domain' portion of the address, correctly quoted\nfor use as a bare address (the second form shown above).  This\nattribute is not mutable.\n\n-- Method: str ()\n\nThe 'str' value of the object is the address quoted according\nto RFC 5322(15) rules, but with no Content Transfer Encoding\nof any non-ASCII characters.\n\nTo support SMTP ( RFC 5321(16)), 'Address' handles one special\ncase: if 'username' and 'domain' are both the empty string (or\n'None'), then the string value of the 'Address' is '<>'.\n\n-- Class: email.headerregistry.Group (displayname=None,\naddresses=None)\n\nThe class used to represent an address group.  The general form of\nan address group is:\n\ndisplayname: [address-list];\n\nAs a convenience for processing lists of addresses that consist of\na mixture of groups and single addresses, a 'Group' may also be\nused to represent single addresses that are not part of a group by\nsetting 'displayname' to 'None' and providing a list of the single\naddress as 'addresses'.\n\n-- Attribute: displayname\n\nThe 'displayname' of the group.  If it is 'None' and there is\nexactly one 'Address' in 'addresses', then the 'Group'\nrepresents a single address that is not in a group.\n\n-- Attribute: addresses\n\nA possibly empty tuple of *note Address: 322c. objects\nrepresenting the addresses in the group.\n\n-- Method: str ()\n\nThe 'str' value of a 'Group' is formatted according to RFC\n5322(17), but with no Content Transfer Encoding of any\nnon-ASCII characters.  If 'displayname' is none and there is\na single 'Address' in the 'addresses' list, the 'str' value\nwill be the same as the 'str' of that single 'Address'.\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/email/headerregistry.py\n\n(2) Originally added in 3.3 as a *note provisional module: eba.\n\n(3) https://datatracker.ietf.org/doc/html/rfc5322.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc2047.html\n\n(5) https://datatracker.ietf.org/doc/html/rfc5322.html\n\n(6) https://datatracker.ietf.org/doc/html/rfc5322.html\n\n(7) https://datatracker.ietf.org/doc/html/rfc2047.html\n\n(8) https://datatracker.ietf.org/doc/html/rfc5322.html\n\n(9) https://datatracker.ietf.org/doc/html/rfc2047.html\n\n(10) https://datatracker.ietf.org/doc/html/rfc5322.html\n\n(11) https://datatracker.ietf.org/doc/html/rfc5322.html\n\n(12) https://datatracker.ietf.org/doc/html/rfc2045.html\n\n(13) https://datatracker.ietf.org/doc/html/rfc2045.html\n\n(14) https://datatracker.ietf.org/doc/html/rfc5322.html\n\n(15) https://datatracker.ietf.org/doc/html/rfc5322.html\n\n(16) https://datatracker.ietf.org/doc/html/rfc5321.html\n\n(17) https://datatracker.ietf.org/doc/html/rfc5322.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: email contentmanager Managing MIME Content,  Next: email Examples,  Prev: email headerregistry Custom Header Objects,  Up: email -- An email and MIME handling package": {
            "content": "5.19.1.10 'email.contentmanager': Managing MIME Content\n.......................................................\n\n'Source code:' Lib/email/contentmanager.py(1)\n\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Content Manager Instances,  Up: email contentmanager Managing MIME Content": {
            "content": "5.19.1.11 Content Manager Instances\n...................................\n",
            "subsections": []
        },
        "Currently the email package provides only one concrete content manager,": {
            "content": "*note rawdatamanager: 3203, although more may be added in the future.\n*note rawdatamanager: 3203. is the *note contentmanager: dab.\nprovided by *note EmailPolicy: f27. and its derivatives.\n\n-- Data: email.contentmanager.rawdatamanager\n\nThis content manager provides only a minimum interface beyond that\nprovided by *note Message: ae7. itself: it deals only with text,\nraw byte strings, and *note Message: ae7. objects.  Nevertheless,\nit provides significant advantages compared to the base API:\n'getcontent' on a text part will return a unicode string without\nthe application needing to manually decode it, 'setcontent'\nprovides a rich set of options for controlling the headers added to\na part and controlling the content transfer encoding, and it\nenables the use of the various 'add' methods, thereby simplifying\nthe creation of multipart messages.\n\n-- Method: email.contentmanager.getcontent (msg,\nerrors='replace')\n\nReturn the payload of the part as either a string (for 'text'\nparts), an *note EmailMessage: ae8. object (for\n'message/rfc822' parts), or a 'bytes' object (for all other\nnon-multipart types).  Raise a *note KeyError: 8cf. if called\non a 'multipart'.  If the part is a 'text' part and 'errors'\nis specified, use it as the error handler when decoding the\npayload to unicode.  The default error handler is 'replace'.\n\n-- Method: email.contentmanager.setcontent (msg, <'str'>,\nsubtype=\"plain\", charset='utf-8', cte=None,\ndisposition=None, filename=None, cid=None, params=None,\nheaders=None)\n\n-- Method: email.contentmanager.setcontent (msg, <'bytes'>,\nmaintype, subtype, cte=\"base64\", disposition=None,\nfilename=None, cid=None, params=None, headers=None)\n\n-- Method: email.contentmanager.setcontent (msg,\n<'EmailMessage'>, cte=None, disposition=None,\nfilename=None, cid=None, params=None, headers=None)\n\nAdd headers and payload to 'msg':\n\nAdd a 'Content-Type' header with a 'maintype/subtype' value.\n\n* For 'str', set the MIME 'maintype' to 'text', and set the\nsubtype to 'subtype' if it is specified, or 'plain' if it\nis not.\n\n* For 'bytes', use the specified 'maintype' and 'subtype',\nor raise a *note TypeError: 28e. if they are not\nspecified.\n\n* For *note EmailMessage: ae8. objects, set the maintype to\n'message', and set the subtype to 'subtype' if it is\nspecified or 'rfc822' if it is not.  If 'subtype' is\n'partial', raise an error ('bytes' objects must be used\nto construct 'message/partial' parts).\n\nIf 'charset' is provided (which is valid only for 'str'),\nencode the string to bytes using the specified character set.\nThe default is 'utf-8'.  If the specified 'charset' is a known\nalias for a standard MIME charset name, use the standard\ncharset instead.\n\nIf 'cte' is set, encode the payload using the specified\ncontent transfer encoding, and set the\n'Content-Transfer-Encoding' header to that value.  Possible\nvalues for 'cte' are 'quoted-printable', 'base64', '7bit',\n'8bit', and 'binary'.  If the input cannot be encoded in the\nspecified encoding (for example, specifying a 'cte' of '7bit'\nfor an input that contains non-ASCII values), raise a *note\nValueError: 183.\n\n* For 'str' objects, if 'cte' is not set use heuristics to\ndetermine the most compact encoding.\n\n* For *note EmailMessage: ae8, per RFC 2046(1), raise an\nerror if a 'cte' of 'quoted-printable' or 'base64' is\nrequested for 'subtype' 'rfc822', and for any 'cte' other\nthan '7bit' for 'subtype' 'external-body'.  For\n'message/rfc822', use '8bit' if 'cte' is not specified.\nFor all other values of 'subtype', use '7bit'.\n\nNote: A 'cte' of 'binary' does not actually work\ncorrectly yet.  The 'EmailMessage' object as modified by\n'setcontent' is correct, but *note BytesGenerator: 1043.\ndoes not serialize it correctly.\n\nIf 'disposition' is set, use it as the value of the\n'Content-Disposition' header.  If not specified, and\n'filename' is specified, add the header with the value\n'attachment'.  If 'disposition' is not specified and\n'filename' is also not specified, do not add the header.  The\nonly valid values for 'disposition' are 'attachment' and\n'inline'.\n\nIf 'filename' is specified, use it as the value of the\n'filename' parameter of the 'Content-Disposition' header.\n\nIf 'cid' is specified, add a 'Content-ID' header with 'cid' as\nits value.\n\nIf 'params' is specified, iterate its 'items' method and use\nthe resulting '(key, value)' pairs to set additional\nparameters on the 'Content-Type' header.\n\nIf 'headers' is specified and is a list of strings of the form\n'headername: headervalue' or a list of 'header' objects\n(distinguished from strings by having a 'name' attribute), add\nthe headers to 'msg'.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc2046.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: email Examples,  Next: email message Message Representing an email message using the compat32 API,  Prev: email contentmanager Managing MIME Content,  Up: email -- An email and MIME handling package": {
            "content": "5.19.1.12 'email': Examples\n...........................\n\nHere are a few examples of how to use the *note email: 37. package to\nread, write, and send simple email messages, as well as more complex\nMIME messages.\n",
            "subsections": []
        },
        "First, let's see how to create and send a simple text message (both the": {
            "content": "text content and the addresses may contain unicode characters):\n\n# Import smtplib for the actual sending function\nimport smtplib\n\n# Import the email modules we'll need\nfrom email.message import EmailMessage\n\n# Open the plain text file whose name is in textfile for reading.\nwith open(textfile) as fp:\n# Create a text/plain message\nmsg = EmailMessage()\nmsg.setcontent(fp.read())\n\n# me == the sender's email address\n# you == the recipient's email address\nmsg['Subject'] = f'The contents of {textfile}'\nmsg['From'] = me\nmsg['To'] = you\n\n# Send the message via our own SMTP server.\ns = smtplib.SMTP('localhost')\ns.sendmessage(msg)\ns.quit()\n",
            "subsections": []
        },
        "Parsing RFC 822(1) headers can easily be done by the using the classes": {
            "content": "from the *note parser: 4a. module:\n\n# Import the email modules we'll need\n#from email.parser import BytesParser\nfrom email.parser import Parser\nfrom email.policy import default\n\n# If the e-mail headers are in a file, uncomment these two lines:\n# with open(messagefile, 'rb') as fp:\n#     headers = BytesParser(policy=default).parse(fp)\n\n#  Or for parsing headers in a string (this is an uncommon operation), use:\nheaders = Parser(policy=default).parsestr(\n'From: Foo Bar <user@example.com>\\n'\n'To: <someoneelse@example.com>\\n'\n'Subject: Test message\\n'\n'\\n'\n'Body would go here\\n')\n\n#  Now the header items can be accessed as a dictionary:\nprint('To: {}'.format(headers['to']))\nprint('From: {}'.format(headers['from']))\nprint('Subject: {}'.format(headers['subject']))\n\n# You can also access the parts of the addresses:\nprint('Recipient username: {}'.format(headers['to'].addresses[0].username))\nprint('Sender name: {}'.format(headers['from'].addresses[0].displayname))\n",
            "subsections": []
        },
        "Here's an example of how to send a MIME message containing a bunch of": {
            "content": "family pictures that may be residing in a directory:\n\n# Import smtplib for the actual sending function.\nimport smtplib\n\n# Here are the email package modules we'll need.\nfrom email.message import EmailMessage\n\n# Create the container email message.\nmsg = EmailMessage()\nmsg['Subject'] = 'Our family reunion'\n# me == the sender's email address\n# family = the list of all recipients' email addresses\nmsg['From'] = me\nmsg['To'] = ', '.join(family)\nmsg.preamble = 'You will not see this in a MIME-aware mail reader.\\n'\n\n# Open the files in binary mode.  You can also omit the subtype\n# if you want MIMEImage to guess it.\nfor file in pngfiles:\nwith open(file, 'rb') as fp:\nimgdata = fp.read()\nmsg.addattachment(imgdata, maintype='image',\nsubtype='png')\n\n# Send the email via our own SMTP server.\nwith smtplib.SMTP('localhost') as s:\ns.sendmessage(msg)\n",
            "subsections": []
        },
        "Here's an example of how to send the entire contents of a directory as": {
            "content": "an email message: (2)\n\n#!/usr/bin/env python3\n\n\"\"\"Send the contents of a directory as a MIME message.\"\"\"\n\nimport os\nimport smtplib\n# For guessing MIME type based on file name extension\nimport mimetypes\n\nfrom argparse import ArgumentParser\n\nfrom email.message import EmailMessage\nfrom email.policy import SMTP\n\n\ndef main():\nparser = ArgumentParser(description=\"\"\"\\\nSend the contents of a directory as a MIME message.\nUnless the -o option is given, the email is sent by forwarding to your local\nSMTP server, which then does the normal delivery process.  Your local machine\nmust be running an SMTP server.\n\"\"\")\nparser.addargument('-d', '--directory',\nhelp=\"\"\"Mail the contents of the specified directory,\notherwise use the current directory.  Only the regular\nfiles in the directory are sent, and we don't recurse to\nsubdirectories.\"\"\")\nparser.addargument('-o', '--output',\nmetavar='FILE',\nhelp=\"\"\"Print the composed message to FILE instead of\nsending the message to the SMTP server.\"\"\")\nparser.addargument('-s', '--sender', required=True,\nhelp='The value of the From: header (required)')\nparser.addargument('-r', '--recipient', required=True,\naction='append', metavar='RECIPIENT',\ndefault=[], dest='recipients',\nhelp='A To: header value (at least one required)')\nargs = parser.parseargs()\ndirectory = args.directory\nif not directory:\ndirectory = '.'\n# Create the message\nmsg = EmailMessage()\nmsg['Subject'] = f'Contents of directory {os.path.abspath(directory)}'\nmsg['To'] = ', '.join(args.recipients)\nmsg['From'] = args.sender\nmsg.preamble = 'You will not see this in a MIME-aware mail reader.\\n'\n\nfor filename in os.listdir(directory):\npath = os.path.join(directory, filename)\nif not os.path.isfile(path):\ncontinue\n# Guess the content type based on the file's extension.  Encoding\n# will be ignored, although we should check for simple things like\n# gzip'd or compressed files.\nctype, encoding = mimetypes.guesstype(path)\nif ctype is None or encoding is not None:\n# No guess could be made, or the file is encoded (compressed), so\n# use a generic bag-of-bits type.\nctype = 'application/octet-stream'\nmaintype, subtype = ctype.split('/', 1)\nwith open(path, 'rb') as fp:\nmsg.addattachment(fp.read(),\nmaintype=maintype,\nsubtype=subtype,\nfilename=filename)\n# Now send or store the message\nif args.output:\nwith open(args.output, 'wb') as fp:\nfp.write(msg.asbytes(policy=SMTP))\nelse:\nwith smtplib.SMTP('localhost') as s:\ns.sendmessage(msg)\n\n\nif name == 'main':\nmain()\n",
            "subsections": []
        },
        "Here's an example of how to unpack a MIME message like the one above,": {
            "content": "into a directory of files:\n\n#!/usr/bin/env python3\n\n\"\"\"Unpack a MIME message into a directory of files.\"\"\"\n\nimport os\nimport email\nimport mimetypes\n\nfrom email.policy import default\n\nfrom argparse import ArgumentParser\n\n\ndef main():\nparser = ArgumentParser(description=\"\"\"\\\nUnpack a MIME message into a directory of files.\n\"\"\")\nparser.addargument('-d', '--directory', required=True,\nhelp=\"\"\"Unpack the MIME message into the named\ndirectory, which will be created if it doesn't already\nexist.\"\"\")\nparser.addargument('msgfile')\nargs = parser.parseargs()\n\nwith open(args.msgfile, 'rb') as fp:\nmsg = email.messagefrombinaryfile(fp, policy=default)\n\ntry:\nos.mkdir(args.directory)\nexcept FileExistsError:\npass\n\ncounter = 1\nfor part in msg.walk():\n# multipart/* are just containers\nif part.getcontentmaintype() == 'multipart':\ncontinue\n# Applications should really sanitize the given filename so that an\n# email message can't be used to overwrite important files\nfilename = part.getfilename()\nif not filename:\next = mimetypes.guessextension(part.getcontenttype())\nif not ext:\n# Use a generic bag-of-bits extension\next = '.bin'\nfilename = f'part-{counter:03d}{ext}'\ncounter += 1\nwith open(os.path.join(args.directory, filename), 'wb') as fp:\nfp.write(part.getpayload(decode=True))\n\n\nif name == 'main':\nmain()\n",
            "subsections": []
        },
        "Here's an example of how to create an HTML message with an alternative": {
            "content": "plain text version.  To make things a bit more interesting, we include a\nrelated image in the html part, and we save a copy of what we are going\nto send to disk, as well as sending it.\n\n#!/usr/bin/env python3\n\nimport smtplib\n\nfrom email.message import EmailMessage\nfrom email.headerregistry import Address\nfrom email.utils import makemsgid\n\n# Create the base text message.\nmsg = EmailMessage()\nmsg['Subject'] = \"Ayons asperges pour le de'jeuner\"\nmsg['From'] = Address(\"Pepe' Le Pew\", \"pepe\", \"example.com\")\nmsg['To'] = (Address(\"Penelope Pussycat\", \"penelope\", \"example.com\"),\nAddress(\"Fabrette Pussycat\", \"fabrette\", \"example.com\"))\nmsg.setcontent(\"\"\"\\\nSalut!\n\nCela ressemble a` un excellent recipie[1] de'jeuner.\n\n[1] http://www.yummly.com/recipe/Roasted-Asparagus-Epicurious-203718\n\n--Pepe'\n\"\"\")\n\n# Add the html version.  This converts the message into a multipart/alternative\n# container, with the original text message as the first part and the new html\n# message as the second part.\nasparaguscid = makemsgid()\nmsg.addalternative(\"\"\"\\\n<html>\n<head></head>\n<body>\n<p>Salut!</p>\n<p>Cela ressemble a` un excellent\n<a href=\"http://www.yummly.com/recipe/Roasted-Asparagus-Epicurious-203718\">\nrecipie\n</a> de'jeuner.\n</p>\n<img src=\"cid:{asparaguscid}\" />\n</body>\n</html>\n\"\"\".format(asparaguscid=asparaguscid[1:-1]), subtype='html')\n# note that we needed to peel the <> off the msgid for use in the html.\n\n# Now add the related image to the html part.\nwith open(\"roasted-asparagus.jpg\", 'rb') as img:\nmsg.getpayload()[1].addrelated(img.read(), 'image', 'jpeg',\ncid=asparaguscid)\n\n# Make a local copy of what we are going to send.\nwith open('outgoing.msg', 'wb') as f:\nf.write(bytes(msg))\n\n# Send the message via local SMTP server.\nwith smtplib.SMTP('localhost') as s:\ns.sendmessage(msg)\n",
            "subsections": []
        },
        "If we were sent the message from the last example, here is one way we": {
            "content": "could process it:\n\nimport os\nimport sys\nimport tempfile\nimport mimetypes\nimport webbrowser\n\n# Import the email modules we'll need\nfrom email import policy\nfrom email.parser import BytesParser\n\n\ndef magichtmlparser(htmltext, partfiles):\n\"\"\"Return safety-sanitized html linked to partfiles.\n\nRewrite the href=\"cid:....\" attributes to point to the filenames in partfiles.\nThough not trivial, this should be possible using html.parser.\n\"\"\"\nraise NotImplementedError(\"Add the magic needed\")\n\n\n# In a real program you'd get the filename from the arguments.\nwith open('outgoing.msg', 'rb') as fp:\nmsg = BytesParser(policy=policy.default).parse(fp)\n\n# Now the header items can be accessed as a dictionary, and any non-ASCII will\n# be converted to unicode:\nprint('To:', msg['to'])\nprint('From:', msg['from'])\nprint('Subject:', msg['subject'])\n\n# If we want to print a preview of the message content, we can extract whatever\n# the least formatted payload is and print the first three lines.  Of course,\n# if the message has no plain text part printing the first three lines of html\n# is probably useless, but this is just a conceptual example.\nsimplest = msg.getbody(preferencelist=('plain', 'html'))\nprint()\nprint(''.join(simplest.getcontent().splitlines(keepends=True)[:3]))\n\nans = input(\"View full message?\")\nif ans.lower()[0] == 'n':\nsys.exit()\n\n# We can extract the richest alternative in order to display it:\nrichest = msg.getbody()\npartfiles = {}\nif richest['content-type'].maintype == 'text':\nif richest['content-type'].subtype == 'plain':\nfor line in richest.getcontent().splitlines():\nprint(line)\nsys.exit()\nelif richest['content-type'].subtype == 'html':\nbody = richest\nelse:\nprint(\"Don't know how to display {}\".format(richest.getcontenttype()))\nsys.exit()\nelif richest['content-type'].contenttype == 'multipart/related':\nbody = richest.getbody(preferencelist=('html'))\nfor part in richest.iterattachments():\nfn = part.getfilename()\nif fn:\nextension = os.path.splitext(part.getfilename())[1]\nelse:\nextension = mimetypes.guessextension(part.getcontenttype())\nwith tempfile.NamedTemporaryFile(suffix=extension, delete=False) as f:\nf.write(part.getcontent())\n# again strip the <> to go from email form of cid to html form.\npartfiles[part['content-id'][1:-1]] = f.name\nelse:\nprint(\"Don't know how to display {}\".format(richest.getcontenttype()))\nsys.exit()\nwith tempfile.NamedTemporaryFile(mode='w', delete=False) as f:\nf.write(magichtmlparser(body.getcontent(), partfiles))\nwebbrowser.open(f.name)\nos.remove(f.name)\nfor fn in partfiles.values():\nos.remove(fn)\n\n# Of course, there are lots of email messages that could break this simple\n# minded program, but it will handle the most common ones.\n\nUp to the prompt, the output from the above is:\n\nTo: Penelope Pussycat <penelope@example.com>, Fabrette Pussycat <fabrette@example.com>\nFrom: Pepe' Le Pew <pepe@example.com>\nSubject: Ayons asperges pour le de'jeuner\n\nSalut!\n\nCela ressemble a` un excellent recipie[1] de'jeuner.\n\nLegacy API:\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc822.html\n\n(2) Thanks to Matthew Dixon Cowles for the original inspiration and\nexamples.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: email message Message Representing an email message using the compat32 API,  Next: email mime Creating email and MIME objects from scratch,  Prev: email Examples,  Up: email -- An email and MIME handling package": {
            "content": "5.19.1.13 'email.message.Message': Representing an email message using the 'compat32' API\n.........................................................................................\n\nThe *note Message: ae7. class is very similar to the *note EmailMessage:\nae8. class, without the methods added by that class, and with the\ndefault behavior of certain other methods being slightly different.  We\nalso document here some methods that, while supported by the *note",
            "subsections": []
        },
        "EmailMessage: ae8. class, are not recommended unless you are dealing": {
            "content": "with legacy code.\n\nThe philosophy and structure of the two classes is otherwise the same.\n\nThis document describes the behavior under the default (for *note\nMessage: ae7.) policy *note Compat32: f24.  If you are going to use\nanother policy, you should be using the *note EmailMessage: ae8. class\ninstead.\n",
            "subsections": []
        },
        "An email message consists of 'headers' and a 'payload'.  Headers must be": {
            "content": "RFC 5322(1) style names and values, where the field name and value are\nseparated by a colon.  The colon is not part of either the field name or\nthe field value.  The payload may be a simple text message, or a binary\nobject, or a structured sequence of sub-messages each with their own set\nof headers and their own payload.  The latter type of payload is\nindicated by the message having a MIME type such as 'multipart/*' or\n'message/rfc822'.\n\nThe conceptual model provided by a *note Message: ae7. object is that of\nan ordered dictionary of headers with additional methods for accessing\nboth specialized information from the headers, for accessing the\npayload, for generating a serialized version of the message, and for\nrecursively walking over the object tree.  Note that duplicate headers\nare supported but special methods must be used to access them.\n\nThe *note Message: ae7. pseudo-dictionary is indexed by the header\nnames, which must be ASCII values.  The values of the dictionary are\nstrings that are supposed to contain only ASCII characters; there is\nsome special handling for non-ASCII input, but it doesn't always produce\nthe correct results.  Headers are stored and returned in case-preserving\nform, but field names are matched case-insensitively.  There may also be\na single envelope header, also known as the 'Unix-From' header or the\n'From' header.  The 'payload' is either a string or bytes, in the case\nof simple message objects, or a list of *note Message: ae7. objects, for\nMIME container documents (e.g.  'multipart/*' and 'message/rfc822').\n\nHere are the methods of the *note Message: ae7. class:\n\n-- Class: email.message.Message (policy=compat32)\n\nIf 'policy' is specified (it must be an instance of a *note policy:\n4b. class) use the rules it specifies to update and serialize the\nrepresentation of the message.  If 'policy' is not set, use the\n*note compat32: f24. policy, which maintains backward compatibility\nwith the Python 3.2 version of the email package.  For more\ninformation see the *note policy: 4b. documentation.\n\nChanged in version 3.3: The 'policy' keyword argument was added.\n\n-- Method: asstring (unixfrom=False, maxheaderlen=0, policy=None)\n\nReturn the entire message flattened as a string.  When\noptional 'unixfrom' is true, the envelope header is included\nin the returned string.  'unixfrom' defaults to 'False'.  For\nbackward compatibility reasons, 'maxheaderlen' defaults to\n'0', so if you want a different value you must override it\nexplicitly (the value specified for 'maxlinelength' in the\npolicy will be ignored by this method).  The 'policy' argument\nmay be used to override the default policy obtained from the\nmessage instance.  This can be used to control some of the\nformatting produced by the method, since the specified\n'policy' will be passed to the 'Generator'.\n\nFlattening the message may trigger changes to the *note\nMessage: ae7. if defaults need to be filled in to complete the\ntransformation to a string (for example, MIME boundaries may\nbe generated or modified).\n\nNote that this method is provided as a convenience and may not\nalways format the message the way you want.  For example, by\ndefault it does not do the mangling of lines that begin with\n'From' that is required by the Unix mbox format.  For more\nflexibility, instantiate a *note Generator: 1042. instance and\nuse its *note flatten(): 31f1. method directly.  For example:\n\nfrom io import StringIO\nfrom email.generator import Generator\nfp = StringIO()\ng = Generator(fp, manglefrom=True, maxheaderlen=60)\ng.flatten(msg)\ntext = fp.getvalue()\n\nIf the message object contains binary data that is not encoded\naccording to RFC standards, the non-compliant data will be\nreplaced by unicode \"unknown character\" code points.  (See\nalso *note asbytes(): da7. and *note BytesGenerator: 1043.)\n\nChanged in version 3.4: the 'policy' keyword argument was\nadded.\n\n-- Method: str ()\n\nEquivalent to *note asstring(): da6.  Allows 'str(msg)' to\nproduce a string containing the formatted message.\n\n-- Method: asbytes (unixfrom=False, policy=None)\n\nReturn the entire message flattened as a bytes object.  When\noptional 'unixfrom' is true, the envelope header is included\nin the returned string.  'unixfrom' defaults to 'False'.  The\n'policy' argument may be used to override the default policy\nobtained from the message instance.  This can be used to\ncontrol some of the formatting produced by the method, since\nthe specified 'policy' will be passed to the 'BytesGenerator'.\n\nFlattening the message may trigger changes to the *note\nMessage: ae7. if defaults need to be filled in to complete the\ntransformation to a string (for example, MIME boundaries may\nbe generated or modified).\n\nNote that this method is provided as a convenience and may not\nalways format the message the way you want.  For example, by\ndefault it does not do the mangling of lines that begin with\n'From' that is required by the Unix mbox format.  For more\nflexibility, instantiate a *note BytesGenerator: 1043.\ninstance and use its *note flatten(): 31ed. method directly.\nFor example:\n\nfrom io import BytesIO\nfrom email.generator import BytesGenerator\nfp = BytesIO()\ng = BytesGenerator(fp, manglefrom=True, maxheaderlen=60)\ng.flatten(msg)\ntext = fp.getvalue()\n\nNew in version 3.4.\n\n-- Method: bytes ()\n\nEquivalent to *note asbytes(): da7.  Allows 'bytes(msg)' to\nproduce a bytes object containing the formatted message.\n\nNew in version 3.4.\n\n-- Method: ismultipart ()\n\nReturn 'True' if the message's payload is a list of sub-*note\nMessage: ae7. objects, otherwise return 'False'.  When *note\nismultipart(): 31c7. returns 'False', the payload should be a\nstring object (which might be a CTE encoded binary payload).\n(Note that *note ismultipart(): 31c7. returning 'True' does\nnot necessarily mean that \"msg.getcontentmaintype() ==\n'multipart'\" will return the 'True'.  For example,\n'ismultipart' will return 'True' when the *note Message: ae7.\nis of type 'message/rfc822'.)\n\n-- Method: setunixfrom (unixfrom)\n\nSet the message's envelope header to 'unixfrom', which should\nbe a string.\n\n-- Method: getunixfrom ()\n\nReturn the message's envelope header.  Defaults to 'None' if\nthe envelope header was never set.\n\n-- Method: attach (payload)\n\nAdd the given 'payload' to the current payload, which must be\n'None' or a list of *note Message: ae7. objects before the\ncall.  After the call, the payload will always be a list of\n*note Message: ae7. objects.  If you want to set the payload\nto a scalar object (e.g.  a string), use *note setpayload():\n3256. instead.\n\nThis is a legacy method.  On the 'EmailMessage' class its\nfunctionality is replaced by *note setcontent(): 160a. and\nthe related 'make' and 'add' methods.\n\n-- Method: getpayload (i=None, decode=False)\n\nReturn the current payload, which will be a list of *note\nMessage: ae7. objects when *note ismultipart(): 31c7. is\n'True', or a string when *note ismultipart(): 31c7. is\n'False'.  If the payload is a list and you mutate the list\nobject, you modify the message's payload in place.\n\nWith optional argument 'i', *note getpayload(): 1041. will\nreturn the 'i'-th element of the payload, counting from zero,\nif *note ismultipart(): 31c7. is 'True'.  An *note\nIndexError: 138f. will be raised if 'i' is less than 0 or\ngreater than or equal to the number of items in the payload.\nIf the payload is a string (i.e.  *note ismultipart(): 31c7.\nis 'False') and 'i' is given, a *note TypeError: 28e. is\nraised.\n\nOptional 'decode' is a flag indicating whether the payload\nshould be decoded or not, according to the\n'Content-Transfer-Encoding' header.  When 'True' and the\nmessage is not a multipart, the payload will be decoded if\nthis header's value is 'quoted-printable' or 'base64'.  If\nsome other encoding is used, or 'Content-Transfer-Encoding'\nheader is missing, the payload is returned as-is (undecoded).\nIn all cases the returned value is binary data.  If the\nmessage is a multipart and the 'decode' flag is 'True', then\n'None' is returned.  If the payload is base64 and it was not\nperfectly formed (missing padding, characters outside the\nbase64 alphabet), then an appropriate defect will be added to\nthe message's defect property ('InvalidBase64PaddingDefect' or\n'InvalidBase64CharactersDefect', respectively).\n\nWhen 'decode' is 'False' (the default) the body is returned as\na string without decoding the 'Content-Transfer-Encoding'.\nHowever, for a 'Content-Transfer-Encoding' of 8bit, an attempt\nis made to decode the original bytes using the 'charset'\nspecified by the 'Content-Type' header, using the 'replace'\nerror handler.  If no 'charset' is specified, or if the\n'charset' given is not recognized by the email package, the\nbody is decoded using the default ASCII charset.\n\nThis is a legacy method.  On the 'EmailMessage' class its\nfunctionality is replaced by *note getcontent(): 31cd. and\n*note iterparts(): 31cc.\n\n-- Method: setpayload (payload, charset=None)\n\nSet the entire message object's payload to 'payload'.  It is\nthe client's responsibility to ensure the payload invariants.\nOptional 'charset' sets the message's default character set;\nsee *note setcharset(): 3257. for details.\n\nThis is a legacy method.  On the 'EmailMessage' class its\nfunctionality is replaced by *note setcontent(): 160a.\n\n-- Method: setcharset (charset)\n\nSet the character set of the payload to 'charset', which can\neither be a *note Charset: c57. instance (see *note\nemail.charset: 38.), a string naming a character set, or\n'None'.  If it is a string, it will be converted to a *note\nCharset: c57. instance.  If 'charset' is 'None', the 'charset'\nparameter will be removed from the 'Content-Type' header (the\nmessage will not be otherwise modified).  Anything else will\ngenerate a *note TypeError: 28e.\n\nIf there is no existing 'MIME-Version' header one will be\nadded.  If there is no existing 'Content-Type' header, one\nwill be added with a value of 'text/plain'.  Whether the\n'Content-Type' header already exists or not, its 'charset'\nparameter will be set to 'charset.outputcharset'.  If\n'charset.inputcharset' and 'charset.outputcharset' differ,\nthe payload will be re-encoded to the 'outputcharset'.  If\nthere is no existing 'Content-Transfer-Encoding' header, then\nthe payload will be transfer-encoded, if needed, using the\nspecified *note Charset: c57, and a header with the\nappropriate value will be added.  If a\n'Content-Transfer-Encoding' header already exists, the payload\nis assumed to already be correctly encoded using that\n'Content-Transfer-Encoding' and is not modified.\n\nThis is a legacy method.  On the 'EmailMessage' class its\nfunctionality is replaced by the 'charset' parameter of the\n'email.emailmessage.EmailMessage.setcontent()' method.\n\n-- Method: getcharset ()\n\nReturn the *note Charset: c57. instance associated with the\nmessage's payload.\n\nThis is a legacy method.  On the 'EmailMessage' class it\nalways returns 'None'.\n\nThe following methods implement a mapping-like interface for\naccessing the message's RFC 2822(2) headers.  Note that there are\nsome semantic differences between these methods and a normal\nmapping (i.e.  dictionary) interface.  For example, in a dictionary\nthere are no duplicate keys, but here there may be duplicate\nmessage headers.  Also, in dictionaries there is no guaranteed\norder to the keys returned by *note keys(): 3259, but in a *note\nMessage: ae7. object, headers are always returned in the order they\nappeared in the original message, or were added to the message\nlater.  Any header deleted and then re-added are always appended to\nthe end of the header list.\n\nThese semantic differences are intentional and are biased toward\nmaximal convenience.\n\nNote that in all cases, any envelope header present in the message\nis not included in the mapping interface.\n\nIn a model generated from bytes, any header values that (in\ncontravention of the RFCs) contain non-ASCII bytes will, when\nretrieved through this interface, be represented as *note Header:\n160b. objects with a charset of 'unknown-8bit'.\n\n-- Method: len ()\n\nReturn the total number of headers, including duplicates.\n\n-- Method: contains (name)\n\nReturn 'True' if the message object has a field named 'name'.\nMatching is done case-insensitively and 'name' should not\ninclude the trailing colon.  Used for the 'in' operator, e.g.:\n\nif 'message-id' in myMessage:\nprint('Message-ID:', myMessage['message-id'])\n\n-- Method: getitem (name)\n\nReturn the value of the named header field.  'name' should not\ninclude the colon field separator.  If the header is missing,\n'None' is returned; a *note KeyError: 8cf. is never raised.\n\nNote that if the named field appears more than once in the\nmessage's headers, exactly which of those field values will be\nreturned is undefined.  Use the *note getall(): 325c. method\nto get the values of all the extant named headers.\n\n-- Method: setitem (name, val)\n\nAdd a header to the message with field name 'name' and value\n'val'.  The field is appended to the end of the message's\nexisting fields.\n\nNote that this does 'not' overwrite or delete any existing\nheader with the same name.  If you want to ensure that the new\nheader is the only one present in the message with field name\n'name', delete the field first, e.g.:\n\ndel msg['subject']\nmsg['subject'] = 'Python roolz!'\n\n-- Method: delitem (name)\n\nDelete all occurrences of the field with name 'name' from the\nmessage's headers.  No exception is raised if the named field\nisn't present in the headers.\n\n-- Method: keys ()\n\nReturn a list of all the message's header field names.\n\n-- Method: values ()\n\nReturn a list of all the message's field values.\n\n-- Method: items ()\n\nReturn a list of 2-tuples containing all the message's field\nheaders and values.\n\n-- Method: get (name, failobj=None)\n\nReturn the value of the named header field.  This is identical\nto *note getitem(): 4b9. except that optional 'failobj' is\nreturned if the named header is missing (defaults to 'None').\n\nHere are some additional useful methods:\n\n-- Method: getall (name, failobj=None)\n\nReturn a list of all the values for the field named 'name'.\nIf there are no such named headers in the message, 'failobj'\nis returned (defaults to 'None').\n\n-- Method: addheader (name, value, params)\n\nExtended header setting.  This method is similar to *note\nsetitem(): 325d. except that additional header parameters\ncan be provided as keyword arguments.  'name' is the header\nfield to add and 'value' is the 'primary' value for the\nheader.\n\nFor each item in the keyword argument dictionary 'params',\nthe key is taken as the parameter name, with underscores\nconverted to dashes (since dashes are illegal in Python\nidentifiers).  Normally, the parameter will be added as\n'key=\"value\"' unless the value is 'None', in which case only\nthe key will be added.  If the value contains non-ASCII\ncharacters, it can be specified as a three tuple in the format\n'(CHARSET, LANGUAGE, VALUE)', where 'CHARSET' is a string\nnaming the charset to be used to encode the value, 'LANGUAGE'\ncan usually be set to 'None' or the empty string (see RFC\n2231(3) for other possibilities), and 'VALUE' is the string\nvalue containing non-ASCII code points.  If a three tuple is\nnot passed and the value contains non-ASCII characters, it is\nautomatically encoded in RFC 2231(4) format using a 'CHARSET'\nof 'utf-8' and a 'LANGUAGE' of 'None'.\n\nHere's an example:\n\nmsg.addheader('Content-Disposition', 'attachment', filename='bud.gif')\n\nThis will add a header that looks like\n\nContent-Disposition: attachment; filename=\"bud.gif\"\n\nAn example with non-ASCII characters:\n\nmsg.addheader('Content-Disposition', 'attachment',\nfilename=('iso-8859-1', '', 'Fussballer.ppt'))\n\nWhich produces\n\nContent-Disposition: attachment; filename*=\"iso-8859-1''Fu%DFballer.ppt\"\n\n-- Method: replaceheader (name, value)\n\nReplace a header.  Replace the first header found in the\nmessage that matches 'name', retaining header order and field\nname case.  If no matching header was found, a *note KeyError:\n8cf. is raised.\n\n-- Method: getcontenttype ()\n\nReturn the message's content type.  The returned string is\ncoerced to lower case of the form 'maintype/subtype'.  If\nthere was no 'Content-Type' header in the message the default\ntype as given by *note getdefaulttype(): 3265. will be\nreturned.  Since according to RFC 2045(5), messages always\nhave a default type, *note getcontenttype(): 3264. will\nalways return a value.\n\nRFC 2045(6) defines a message's default type to be\n'text/plain' unless it appears inside a 'multipart/digest'\ncontainer, in which case it would be 'message/rfc822'.  If the\n'Content-Type' header has an invalid type specification, RFC\n2045(7) mandates that the default type be 'text/plain'.\n\n-- Method: getcontentmaintype ()\n\nReturn the message's main content type.  This is the\n'maintype' part of the string returned by *note\ngetcontenttype(): 3264.\n\n-- Method: getcontentsubtype ()\n\nReturn the message's sub-content type.  This is the 'subtype'\npart of the string returned by *note getcontenttype(): 3264.\n\n-- Method: getdefaulttype ()\n\nReturn the default content type.  Most messages have a default\ncontent type of 'text/plain', except for messages that are\nsubparts of 'multipart/digest' containers.  Such subparts have\na default content type of 'message/rfc822'.\n\n-- Method: setdefaulttype (ctype)\n\nSet the default content type.  'ctype' should either be\n'text/plain' or 'message/rfc822', although this is not\nenforced.  The default content type is not stored in the\n'Content-Type' header.\n\n-- Method: getparams (failobj=None, header='content-type',\nunquote=True)\n\nReturn the message's 'Content-Type' parameters, as a list.\nThe elements of the returned list are 2-tuples of key/value\npairs, as split on the ''='' sign.  The left hand side of the\n''='' is the key, while the right hand side is the value.  If\nthere is no ''='' sign in the parameter the value is the empty\nstring, otherwise the value is as described in *note\ngetparam(): 326a. and is unquoted if optional 'unquote' is\n'True' (the default).\n\nOptional 'failobj' is the object to return if there is no\n'Content-Type' header.  Optional 'header' is the header to\nsearch instead of 'Content-Type'.\n\nThis is a legacy method.  On the 'EmailMessage' class its\nfunctionality is replaced by the 'params' property of the\nindividual header objects returned by the header access\nmethods.\n\n-- Method: getparam (param, failobj=None, header='content-type',\nunquote=True)\n\nReturn the value of the 'Content-Type' header's parameter\n'param' as a string.  If the message has no 'Content-Type'\nheader or if there is no such parameter, then 'failobj' is\nreturned (defaults to 'None').\n\nOptional 'header' if given, specifies the message header to\nuse instead of 'Content-Type'.\n\nParameter keys are always compared case insensitively.  The\nreturn value can either be a string, or a 3-tuple if the\nparameter was RFC 2231(8) encoded.  When it's a 3-tuple, the\nelements of the value are of the form '(CHARSET, LANGUAGE,\nVALUE)'.  Note that both 'CHARSET' and 'LANGUAGE' can be\n'None', in which case you should consider 'VALUE' to be\nencoded in the 'us-ascii' charset.  You can usually ignore\n'LANGUAGE'.\n\nIf your application doesn't care whether the parameter was\nencoded as in RFC 2231(9), you can collapse the parameter\nvalue by calling *note email.utils.collapserfc2231value():\n326b, passing in the return value from *note getparam():\n326a.  This will return a suitably decoded Unicode string when\nthe value is a tuple, or the original string unquoted if it\nisn't.  For example:\n\nrawparam = msg.getparam('foo')\nparam = email.utils.collapserfc2231value(rawparam)\n\nIn any case, the parameter value (either the returned string,\nor the 'VALUE' item in the 3-tuple) is always unquoted, unless\n'unquote' is set to 'False'.\n\nThis is a legacy method.  On the 'EmailMessage' class its\nfunctionality is replaced by the 'params' property of the\nindividual header objects returned by the header access\nmethods.\n\n-- Method: setparam (param, value, header='Content-Type',\nrequote=True, charset=None, language='', replace=False)\n\nSet a parameter in the 'Content-Type' header.  If the\nparameter already exists in the header, its value will be\nreplaced with 'value'.  If the 'Content-Type' header as not\nyet been defined for this message, it will be set to\n'text/plain' and the new parameter value will be appended as\nper RFC 2045(10).\n\nOptional 'header' specifies an alternative header to\n'Content-Type', and all parameters will be quoted as necessary\nunless optional 'requote' is 'False' (the default is 'True').\n\nIf optional 'charset' is specified, the parameter will be\nencoded according to RFC 2231(11).  Optional 'language'\nspecifies the RFC 2231 language, defaulting to the empty\nstring.  Both 'charset' and 'language' should be strings.\n\nIf 'replace' is 'False' (the default) the header is moved to\nthe end of the list of headers.  If 'replace' is 'True', the\nheader will be updated in place.\n\nChanged in version 3.4: 'replace' keyword was added.\n\n-- Method: delparam (param, header='content-type', requote=True)\n\nRemove the given parameter completely from the 'Content-Type'\nheader.  The header will be re-written in place without the\nparameter or its value.  All values will be quoted as\nnecessary unless 'requote' is 'False' (the default is 'True').\nOptional 'header' specifies an alternative to 'Content-Type'.\n\n-- Method: settype (type, header='Content-Type', requote=True)\n\nSet the main type and subtype for the 'Content-Type' header.\n'type' must be a string in the form 'maintype/subtype',\notherwise a *note ValueError: 183. is raised.\n\nThis method replaces the 'Content-Type' header, keeping all\nthe parameters in place.  If 'requote' is 'False', this leaves\nthe existing header's quoting as is, otherwise the parameters\nwill be quoted (the default).\n\nAn alternative header can be specified in the 'header'\nargument.  When the 'Content-Type' header is set a\n'MIME-Version' header is also added.\n\nThis is a legacy method.  On the 'EmailMessage' class its\nfunctionality is replaced by the 'make' and 'add' methods.\n\n-- Method: getfilename (failobj=None)\n\nReturn the value of the 'filename' parameter of the\n'Content-Disposition' header of the message.  If the header\ndoes not have a 'filename' parameter, this method falls back\nto looking for the 'name' parameter on the 'Content-Type'\nheader.  If neither is found, or the header is missing, then\n'failobj' is returned.  The returned string will always be\nunquoted as per *note email.utils.unquote(): 31c0.\n\n-- Method: getboundary (failobj=None)\n\nReturn the value of the 'boundary' parameter of the\n'Content-Type' header of the message, or 'failobj' if either\nthe header is missing, or has no 'boundary' parameter.  The\nreturned string will always be unquoted as per *note\nemail.utils.unquote(): 31c0.\n\n-- Method: setboundary (boundary)\n\nSet the 'boundary' parameter of the 'Content-Type' header to\n'boundary'.  *note setboundary(): 3270. will always quote\n'boundary' if necessary.  A *note HeaderParseError: 31c3. is\nraised if the message object has no 'Content-Type' header.\n\nNote that using this method is subtly different than deleting\nthe old 'Content-Type' header and adding a new one with the\nnew boundary via *note addheader(): 3262, because *note\nsetboundary(): 3270. preserves the order of the\n'Content-Type' header in the list of headers.  However, it\ndoes 'not' preserve any continuation lines which may have been\npresent in the original 'Content-Type' header.\n\n-- Method: getcontentcharset (failobj=None)\n\nReturn the 'charset' parameter of the 'Content-Type' header,\ncoerced to lower case.  If there is no 'Content-Type' header,\nor if that header has no 'charset' parameter, 'failobj' is\nreturned.\n\nNote that this method differs from *note getcharset(): 3258.\nwhich returns the *note Charset: c57. instance for the default\nencoding of the message body.\n\n-- Method: getcharsets (failobj=None)\n\nReturn a list containing the character set names in the\nmessage.  If the message is a 'multipart', then the list will\ncontain one element for each subpart in the payload,\notherwise, it will be a list of length 1.\n\nEach item in the list will be a string which is the value of\nthe 'charset' parameter in the 'Content-Type' header for the\nrepresented subpart.  However, if the subpart has no\n'Content-Type' header, no 'charset' parameter, or is not of\nthe 'text' main MIME type, then that item in the returned list\nwill be 'failobj'.\n\n-- Method: getcontentdisposition ()\n\nReturn the lowercased value (without parameters) of the\nmessage's 'Content-Disposition' header if it has one, or\n'None'.  The possible values for this method are 'inline',\n'attachment' or 'None' if the message follows RFC 2183(12).\n\nNew in version 3.5.\n\n-- Method: walk ()\n\nThe *note walk(): 3273. method is an all-purpose generator\nwhich can be used to iterate over all the parts and subparts\nof a message object tree, in depth-first traversal order.  You\nwill typically use *note walk(): 3273. as the iterator in a\n'for' loop; each iteration returns the next subpart.\n\nHere's an example that prints the MIME type of every part of a\nmultipart message structure:\n\n>>> for part in msg.walk():\n...     print(part.getcontenttype())\nmultipart/report\ntext/plain\nmessage/delivery-status\ntext/plain\ntext/plain\nmessage/rfc822\ntext/plain\n\n'walk' iterates over the subparts of any part where *note\nismultipart(): 31c7. returns 'True', even though\n'msg.getcontentmaintype() == 'multipart'' may return\n'False'.  We can see this in our example by making use of the\n'structure' debug helper function:\n\n>>> for part in msg.walk():\n...     print(part.getcontentmaintype() == 'multipart',\n...           part.ismultipart())\nTrue True\nFalse False\nFalse True\nFalse False\nFalse False\nFalse True\nFalse False\n>>> structure(msg)\nmultipart/report\ntext/plain\nmessage/delivery-status\ntext/plain\ntext/plain\nmessage/rfc822\ntext/plain\n\nHere the 'message' parts are not 'multiparts', but they do\ncontain subparts.  'ismultipart()' returns 'True' and 'walk'\ndescends into the subparts.\n\n*note Message: ae7. objects can also optionally contain two\ninstance attributes, which can be used when generating the plain\ntext of a MIME message.\n\n-- Attribute: preamble\n\nThe format of a MIME document allows for some text between the\nblank line following the headers, and the first multipart\nboundary string.  Normally, this text is never visible in a\nMIME-aware mail reader because it falls outside the standard\nMIME armor.  However, when viewing the raw text of the\nmessage, or when viewing the message in a non-MIME aware\nreader, this text can become visible.\n\nThe 'preamble' attribute contains this leading extra-armor\ntext for MIME documents.  When the *note Parser: 1012.\ndiscovers some text after the headers but before the first\nboundary string, it assigns this text to the message's\n'preamble' attribute.  When the *note Generator: 1042. is\nwriting out the plain text representation of a MIME message,\nand it finds the message has a 'preamble' attribute, it will\nwrite this text in the area between the headers and the first\nboundary.  See *note email.parser: 4a. and *note\nemail.generator: 3c. for details.\n\nNote that if the message object has no preamble, the\n'preamble' attribute will be 'None'.\n\n-- Attribute: epilogue\n\nThe 'epilogue' attribute acts the same way as the 'preamble'\nattribute, except that it contains text that appears between\nthe last boundary and the end of the message.\n\nYou do not need to set the epilogue to the empty string in\norder for the *note Generator: 1042. to print a newline at the\nend of the file.\n\n-- Attribute: defects\n\nThe 'defects' attribute contains a list of all the problems\nfound when parsing this message.  See *note email.errors: 3b.\nfor a detailed description of the possible parsing defects.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc5322.html\n\n(2) https://datatracker.ietf.org/doc/html/rfc2822.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc2231.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc2231.html\n\n(5) https://datatracker.ietf.org/doc/html/rfc2045.html\n\n(6) https://datatracker.ietf.org/doc/html/rfc2045.html\n\n(7) https://datatracker.ietf.org/doc/html/rfc2045.html\n\n(8) https://datatracker.ietf.org/doc/html/rfc2231.html\n\n(9) https://datatracker.ietf.org/doc/html/rfc2231.html\n\n(10) https://datatracker.ietf.org/doc/html/rfc2045.html\n\n(11) https://datatracker.ietf.org/doc/html/rfc2231.html\n\n(12) https://datatracker.ietf.org/doc/html/rfc2183.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: email mime Creating email and MIME objects from scratch,  Next: email header Internationalized headers,  Prev: email message Message Representing an email message using the compat32 API,  Up: email -- An email and MIME handling package": {
            "content": "5.19.1.14 'email.mime': Creating email and MIME objects from scratch\n....................................................................\n\n'Source code:' Lib/email/mime/(1)\n\n\n",
            "subsections": []
        },
        "This module is part of the legacy ('Compat32') email API. Its": {
            "content": "functionality is partially replaced by the *note contentmanager: 39. in\nthe new API, but in certain applications these classes may still be\nuseful, even in non-legacy code.\n",
            "subsections": []
        },
        "Ordinarily, you get a message object structure by passing a file or some": {
            "content": "text to a parser, which parses the text and returns the root message\nobject.  However you can also build a complete message structure from\nscratch, or even individual *note Message: ae7. objects by hand.  In\nfact, you can also take an existing structure and add new *note Message:\nae7. objects, move them around, etc.  This makes a very convenient\ninterface for slicing-and-dicing MIME messages.\n\nYou can create a new object structure by creating *note Message: ae7.\ninstances, adding attachments and all the appropriate headers manually.\nFor MIME messages though, the *note email: 37. package provides some\nconvenient subclasses to make things easier.\n\nHere are the classes:\n\n-- Class: email.mime.base.MIMEBase (maintype, subtype, *,\npolicy=compat32, params)\n\nModule: *note email.mime.base: 44.\n\nThis is the base class for all the MIME-specific subclasses of\n*note Message: ae7.  Ordinarily you won't create instances\nspecifically of *note MIMEBase: 3279, although you could.  *note\nMIMEBase: 3279. is provided primarily as a convenient base class\nfor more specific MIME-aware subclasses.\n\n'maintype' is the 'Content-Type' major type (e.g.  'text' or\n'image'), and 'subtype' is the 'Content-Type' minor type (e.g.\n'plain' or 'gif').  'params' is a parameter key/value dictionary\nand is passed directly to *note Message.addheader: 3262.\n\nIf 'policy' is specified, (defaults to the *note compat32: f24.\npolicy) it will be passed to *note Message: ae7.\n\nThe *note MIMEBase: 3279. class always adds a 'Content-Type' header\n(based on 'maintype', 'subtype', and 'params'), and a\n'MIME-Version' header (always set to '1.0').\n\nChanged in version 3.6: Added 'policy' keyword-only parameter.\n\n-- Class: email.mime.nonmultipart.MIMENonMultipart\n\nModule: *note email.mime.nonmultipart: 48.\n\nA subclass of *note MIMEBase: 3279, this is an intermediate base\nclass for MIME messages that are not 'multipart'.  The primary\npurpose of this class is to prevent the use of the *note attach():\n31d4. method, which only makes sense for 'multipart' messages.  If\n*note attach(): 31d4. is called, a *note MultipartConversionError:\n3219. exception is raised.\n\n-- Class: email.mime.multipart.MIMEMultipart (subtype='mixed',\nboundary=None, subparts=None, *, policy=compat32, params)\n\nModule: *note email.mime.multipart: 47.\n\nA subclass of *note MIMEBase: 3279, this is an intermediate base\nclass for MIME messages that are 'multipart'.  Optional 'subtype'\ndefaults to 'mixed', but can be used to specify the subtype of the\nmessage.  A 'Content-Type' header of 'multipart/subtype' will be\nadded to the message object.  A 'MIME-Version' header will also be\nadded.\n\nOptional 'boundary' is the multipart boundary string.  When 'None'\n(the default), the boundary is calculated when needed (for example,\nwhen the message is serialized).\n\n'subparts' is a sequence of initial subparts for the payload.  It\nmust be possible to convert this sequence to a list.  You can\nalways attach new subparts to the message by using the *note\nMessage.attach: 31d4. method.\n\nOptional 'policy' argument defaults to *note compat32: f24.\n\nAdditional parameters for the 'Content-Type' header are taken from\nthe keyword arguments, or passed into the 'params' argument, which\nis a keyword dictionary.\n\nChanged in version 3.6: Added 'policy' keyword-only parameter.\n\n-- Class: email.mime.application.MIMEApplication (data,\nsubtype='octet-stream',\nencoder=email.encoders.encodebase64, *, policy=compat32,\nparams)\n\nModule: *note email.mime.application: 42.\n\nA subclass of *note MIMENonMultipart: 321a, the *note\nMIMEApplication: 327b. class is used to represent MIME message\nobjects of major type 'application'.  'data' contains the bytes\nfor the raw application data.  Optional 'subtype' specifies the\nMIME subtype and defaults to 'octet-stream'.\n\nOptional 'encoder' is a callable (i.e.  function) which will\nperform the actual encoding of the data for transport.  This\ncallable takes one argument, which is the *note MIMEApplication:\n327b. instance.  It should use *note getpayload(): 1041. and *note\nsetpayload(): 3256. to change the payload to encoded form.  It\nshould also add any 'Content-Transfer-Encoding' or other headers to\nthe message object as necessary.  The default encoding is base64.\nSee the *note email.encoders: 3a. module for a list of the built-in\nencoders.\n\nOptional 'policy' argument defaults to *note compat32: f24.\n\n'params' are passed straight through to the base class\nconstructor.\n\nChanged in version 3.6: Added 'policy' keyword-only parameter.\n\n-- Class: email.mime.audio.MIMEAudio (audiodata, subtype=None,\nencoder=email.encoders.encodebase64, *, policy=compat32,\nparams)\n\nModule: *note email.mime.audio: 43.\n\nA subclass of *note MIMENonMultipart: 321a, the *note MIMEAudio:\n327c. class is used to create MIME message objects of major type\n'audio'.  'audiodata' contains the bytes for the raw audio data.\nIf this data can be decoded as au, wav, aiff, or aifc, then the\nsubtype will be automatically included in the 'Content-Type'\nheader.  Otherwise you can explicitly specify the audio subtype via\nthe 'subtype' argument.  If the minor type could not be guessed\nand 'subtype' was not given, then *note TypeError: 28e. is raised.\n\nOptional 'encoder' is a callable (i.e.  function) which will\nperform the actual encoding of the audio data for transport.  This\ncallable takes one argument, which is the *note MIMEAudio: 327c.\ninstance.  It should use *note getpayload(): 1041. and *note\nsetpayload(): 3256. to change the payload to encoded form.  It\nshould also add any 'Content-Transfer-Encoding' or other headers to\nthe message object as necessary.  The default encoding is base64.\nSee the *note email.encoders: 3a. module for a list of the built-in\nencoders.\n\nOptional 'policy' argument defaults to *note compat32: f24.\n\n'params' are passed straight through to the base class\nconstructor.\n\nChanged in version 3.6: Added 'policy' keyword-only parameter.\n\n-- Class: email.mime.image.MIMEImage (imagedata, subtype=None,\nencoder=email.encoders.encodebase64, *, policy=compat32,\nparams)\n\nModule: *note email.mime.image: 45.\n\nA subclass of *note MIMENonMultipart: 321a, the *note MIMEImage:\n321b. class is used to create MIME message objects of major type\n'image'.  'imagedata' contains the bytes for the raw image data.\nIf this data type can be detected (jpeg, png, gif, tiff, rgb, pbm,\npgm, ppm, rast, xbm, bmp, webp, and exr attempted), then the\nsubtype will be automatically included in the 'Content-Type'\nheader.  Otherwise you can explicitly specify the image subtype via\nthe 'subtype' argument.  If the minor type could not be guessed\nand 'subtype' was not given, then *note TypeError: 28e. is raised.\n\nOptional 'encoder' is a callable (i.e.  function) which will\nperform the actual encoding of the image data for transport.  This\ncallable takes one argument, which is the *note MIMEImage: 321b.\ninstance.  It should use *note getpayload(): 1041. and *note\nsetpayload(): 3256. to change the payload to encoded form.  It\nshould also add any 'Content-Transfer-Encoding' or other headers to\nthe message object as necessary.  The default encoding is base64.\nSee the *note email.encoders: 3a. module for a list of the built-in\nencoders.\n\nOptional 'policy' argument defaults to *note compat32: f24.\n\n'params' are passed straight through to the *note MIMEBase: 3279.\nconstructor.\n\nChanged in version 3.6: Added 'policy' keyword-only parameter.\n\n-- Class: email.mime.message.MIMEMessage (msg, subtype='rfc822', *,\npolicy=compat32)\n\nModule: *note email.mime.message: 46.\n\nA subclass of *note MIMENonMultipart: 321a, the *note MIMEMessage:\n327d. class is used to create MIME objects of main type 'message'.\n'msg' is used as the payload, and must be an instance of class\n*note Message: ae7. (or a subclass thereof), otherwise a *note\nTypeError: 28e. is raised.\n\nOptional 'subtype' sets the subtype of the message; it defaults to\n'rfc822'.\n\nOptional 'policy' argument defaults to *note compat32: f24.\n\nChanged in version 3.6: Added 'policy' keyword-only parameter.\n\n-- Class: email.mime.text.MIMEText (text, subtype='plain',\ncharset=None, *, policy=compat32)\n\nModule: *note email.mime.text: 49.\n\nA subclass of *note MIMENonMultipart: 321a, the *note MIMEText:\nc56. class is used to create MIME objects of major type 'text'.\n'text' is the string for the payload.  'subtype' is the minor\ntype and defaults to 'plain'.  'charset' is the character set of\nthe text and is passed as an argument to the *note\nMIMENonMultipart: 321a. constructor; it defaults to 'us-ascii' if\nthe string contains only 'ascii' code points, and 'utf-8'\notherwise.  The 'charset' parameter accepts either a string or a\n*note Charset: c57. instance.\n\nUnless the 'charset' argument is explicitly set to 'None', the\nMIMEText object created will have both a 'Content-Type' header with\na 'charset' parameter, and a 'Content-Transfer-Encoding' header.\nThis means that a subsequent 'setpayload' call will not result in\nan encoded payload, even if a charset is passed in the\n'setpayload' command.  You can \"reset\" this behavior by deleting\nthe 'Content-Transfer-Encoding' header, after which a 'setpayload'\ncall will automatically encode the new payload (and add a new\n'Content-Transfer-Encoding' header).\n\nOptional 'policy' argument defaults to *note compat32: f24.\n\nChanged in version 3.5: 'charset' also accepts *note Charset: c57.\ninstances.\n\nChanged in version 3.6: Added 'policy' keyword-only parameter.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/email/mime/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: email header Internationalized headers,  Next: email charset Representing character sets,  Prev: email mime Creating email and MIME objects from scratch,  Up: email -- An email and MIME handling package": {
            "content": "5.19.1.15 'email.header': Internationalized headers\n...................................................\n\n'Source code:' Lib/email/header.py(1)\n\n\n",
            "subsections": []
        },
        "This module is part of the legacy ('Compat32') email API. In the current": {
            "content": "API encoding and decoding of headers is handled transparently by the\ndictionary-like API of the *note EmailMessage: ae8. class.  In addition\nto uses in legacy code, this module can be useful in applications that\nneed to completely control the character sets used when encoding\nheaders.\n",
            "subsections": []
        },
        "The remaining text in this section is the original documentation of the": {
            "content": "module.\n\nWhen creating *note Message: ae7. objects from scratch, you often need\nto encode the payloads for transport through compliant mail servers.\nThis is especially true for 'image/*' and 'text/*' type messages\ncontaining binary data.\n\nThe *note email: 37. package provides some convenient encoders in its\n*note encoders: 3a. module.  These encoders are actually used by the\n*note MIMEAudio: 327c. and *note MIMEImage: 321b. class constructors to\nprovide default encodings.  All encoder functions take exactly one\nargument, the message object to encode.  They usually extract the\npayload, encode it, and reset the payload to this newly encoded value.",
            "subsections": []
        },
        "Of course, as email has been deployed worldwide, it has become": {
            "content": "internationalized, such that language specific character sets can now be\nused in email messages.  The base standard still requires email messages\nto be transferred using only 7-bit ASCII characters, so a slew of RFCs\nhave been written describing how to encode email containing non-ASCII\ncharacters into RFC 2822(5)-compliant format.  These RFCs include RFC\n2045(6), RFC 2046(7), RFC 2047(8), and RFC 2231(9).  The *note email:\n37. package supports these standards in its *note email.header: 3d. and\n*note email.charset: 38. modules.\n",
            "subsections": []
        },
        "If you want to include non-ASCII characters in your email headers, say": {
            "content": "in the 'Subject' or 'To' fields, you should use the *note Header: 160b.\nclass and assign the field in the *note Message: ae7. object to an\ninstance of *note Header: 160b. instead of using a string for the header\nvalue.  Import the *note Header: 160b. class from the *note\nemail.header: 3d. module.  For example:\n\n>>> from email.message import Message\n>>> from email.header import Header\n>>> msg = Message()\n>>> h = Header('p\\xf6stal', 'iso-8859-1')\n>>> msg['Subject'] = h\n>>> msg.asstring()\n'Subject: =?iso-8859-1?q?p=F6stal?=\\n\\n'\n",
            "subsections": []
        },
        "Notice here how we wanted the 'Subject' field to contain a non-ASCII": {
            "content": "character?  We did this by creating a *note Header: 160b. instance and\npassing in the character set that the byte string was encoded in.  When\nthe subsequent *note Message: ae7. instance was flattened, the 'Subject'\nfield was properly RFC 2047(10) encoded.  MIME-aware mail readers would\nshow this header using the embedded ISO-8859-1 character.\n\nHere is the *note Header: 160b. class description:\n\n-- Class: email.header.Header (s=None, charset=None, maxlinelen=None,\nheadername=None, continuationws=' ', errors='strict')\n\nCreate a MIME-compliant header that can contain strings in\ndifferent character sets.\n\nOptional 's' is the initial header value.  If 'None' (the default),\nthe initial header value is not set.  You can later append to the\nheader with *note append(): 3280. method calls.  's' may be an\ninstance of *note bytes: 295. or *note str: 157, but see the *note\nappend(): 3280. documentation for semantics.\n\nOptional 'charset' serves two purposes: it has the same meaning as\nthe 'charset' argument to the *note append(): 3280. method.  It\nalso sets the default character set for all subsequent *note\nappend(): 3280. calls that omit the 'charset' argument.  If\n'charset' is not provided in the constructor (the default), the\n'us-ascii' character set is used both as 's''s initial charset and\nas the default for subsequent *note append(): 3280. calls.\n\nThe maximum line length can be specified explicitly via\n'maxlinelen'.  For splitting the first line to a shorter value (to\naccount for the field header which isn't included in 's', e.g.\n'Subject') pass in the name of the field in 'headername'.  The\ndefault 'maxlinelen' is 76, and the default value for 'headername'\nis 'None', meaning it is not taken into account for the first line\nof a long, split header.\n\nOptional 'continuationws' must be RFC 2822(11)-compliant folding\nwhitespace, and is usually either a space or a hard tab character.\nThis character will be prepended to continuation lines.\n'continuationws' defaults to a single space character.\n\nOptional 'errors' is passed straight through to the *note append():\n3280. method.\n\n-- Method: append (s, charset=None, errors='strict')\n\nAppend the string 's' to the MIME header.\n\nOptional 'charset', if given, should be a *note Charset: c57.\ninstance (see *note email.charset: 38.) or the name of a\ncharacter set, which will be converted to a *note Charset:\nc57. instance.  A value of 'None' (the default) means that the\n'charset' given in the constructor is used.\n\n's' may be an instance of *note bytes: 295. or *note str: 157.\nIf it is an instance of *note bytes: 295, then 'charset' is\nthe encoding of that byte string, and a *note UnicodeError:\n111b. will be raised if the string cannot be decoded with that\ncharacter set.\n\nIf 's' is an instance of *note str: 157, then 'charset' is a\nhint specifying the character set of the characters in the\nstring.\n\nIn either case, when producing an RFC 2822(12)-compliant\nheader using RFC 2047(13) rules, the string will be encoded\nusing the output codec of the charset.  If the string cannot\nbe encoded using the output codec, a UnicodeError will be\nraised.\n\nOptional 'errors' is passed as the errors argument to the\ndecode call if 's' is a byte string.\n\n-- Method: encode (splitchars=';, \\t', maxlinelen=None,\nlinesep='\\n')\n\nEncode a message header into an RFC-compliant format, possibly\nwrapping long lines and encapsulating non-ASCII parts in\nbase64 or quoted-printable encodings.\n\nOptional 'splitchars' is a string containing characters which\nshould be given extra weight by the splitting algorithm during\nnormal header wrapping.  This is in very rough support of RFC\n2822(14)'s 'higher level syntactic breaks': split points\npreceded by a splitchar are preferred during line splitting,\nwith the characters preferred in the order in which they\nappear in the string.  Space and tab may be included in the\nstring to indicate whether preference should be given to one\nover the other as a split point when other split chars do not\nappear in the line being split.  Splitchars does not affect\nRFC 2047(15) encoded lines.\n\n'maxlinelen', if given, overrides the instance's value for the\nmaximum line length.\n\n'linesep' specifies the characters used to separate the lines\nof the folded header.  It defaults to the most useful value\nfor Python application code ('\\n'), but '\\r\\n' can be\nspecified in order to produce headers with RFC-compliant line\nseparators.\n\nChanged in version 3.2: Added the 'linesep' argument.\n\nThe *note Header: 160b. class also provides a number of methods to\nsupport standard operators and built-in functions.\n\n-- Method: str ()\n\nReturns an approximation of the *note Header: 160b. as a\nstring, using an unlimited line length.  All pieces are\nconverted to unicode using the specified encoding and joined\ntogether appropriately.  Any pieces with a charset of\n''unknown-8bit'' are decoded as ASCII using the ''replace''\nerror handler.\n\nChanged in version 3.2: Added handling for the\n''unknown-8bit'' charset.\n\n-- Method: eq (other)\n\nThis method allows you to compare two *note Header: 160b.\ninstances for equality.\n\n-- Method: ne (other)\n\nThis method allows you to compare two *note Header: 160b.\ninstances for inequality.\n\nThe *note email.header: 3d. module also provides the following\nconvenient functions.\n\n-- Function: email.header.decodeheader (header)\n\nDecode a message header value without converting the character set.\nThe header value is in 'header'.\n\nThis function returns a list of '(decodedstring, charset)' pairs\ncontaining each of the decoded parts of the header.  'charset' is\n'None' for non-encoded parts of the header, otherwise a lower case\nstring containing the name of the character set specified in the\nencoded string.\n\nHere's an example:\n\n>>> from email.header import decodeheader\n>>> decodeheader('=?iso-8859-1?q?p=F6stal?=')\n[(b'p\\xf6stal', 'iso-8859-1')]\n\n-- Function: email.header.makeheader (decodedseq, maxlinelen=None,\nheadername=None, continuationws=' ')\n\nCreate a *note Header: 160b. instance from a sequence of pairs as\nreturned by *note decodeheader(): f28.\n\n*note decodeheader(): f28. takes a header value string and returns\na sequence of pairs of the format '(decodedstring, charset)' where\n'charset' is the name of the character set.\n\nThis function takes one of those sequence of pairs and returns a\n*note Header: 160b. instance.  Optional 'maxlinelen',\n'headername', and 'continuationws' are as in the *note Header:\n160b. constructor.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/email/header.py\n\n(2) https://datatracker.ietf.org/doc/html/rfc2822.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc822.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc2822.html\n\n(5) https://datatracker.ietf.org/doc/html/rfc2822.html\n\n(6) https://datatracker.ietf.org/doc/html/rfc2045.html\n\n(7) https://datatracker.ietf.org/doc/html/rfc2046.html\n\n(8) https://datatracker.ietf.org/doc/html/rfc2047.html\n\n(9) https://datatracker.ietf.org/doc/html/rfc2231.html\n\n(10) https://datatracker.ietf.org/doc/html/rfc2047.html\n\n(11) https://datatracker.ietf.org/doc/html/rfc2822.html\n\n(12) https://datatracker.ietf.org/doc/html/rfc2822.html\n\n(13) https://datatracker.ietf.org/doc/html/rfc2047.html\n\n(14) https://datatracker.ietf.org/doc/html/rfc2822.html\n\n(15) https://datatracker.ietf.org/doc/html/rfc2047.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: email charset Representing character sets,  Next: email encoders Encoders,  Prev: email header Internationalized headers,  Up: email -- An email and MIME handling package": {
            "content": "5.19.1.16 'email.charset': Representing character sets\n......................................................\n\n'Source code:' Lib/email/charset.py(1)\n\n\n",
            "subsections": []
        },
        "This module is part of the legacy ('Compat32') email API. In the new API": {
            "content": "the functionality is provided by the 'cte' parameter of the *note\nsetcontent(): 160a. method.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: email encoders Encoders,  Next: email utils Miscellaneous utilities,  Prev: email charset Representing character sets,  Up: email -- An email and MIME handling package": {
            "content": "5.19.1.17 'email.encoders': Encoders\n....................................\n\n'Source code:' Lib/email/encoders.py(1)\n\n\n",
            "subsections": []
        },
        "This module is deprecated in Python 3.  The functions provided here": {
            "content": "should not be called explicitly since the *note MIMEText: c56. class\nsets the content type and CTE header using the 'subtype' and 'charset'\nvalues passed during the instantiation of that class.\n",
            "subsections": []
        },
        "They should also set the 'Content-Transfer-Encoding' header as": {
            "content": "appropriate.\n\nNote that these functions are not meaningful for a multipart message.",
            "subsections": []
        },
        "They must be applied to individual subparts instead, and will raise a": {
            "content": "*note TypeError: 28e. if passed a message whose type is multipart.\n\nHere are the encoding functions provided:\n\n-- Function: email.encoders.encodequopri (msg)\n\nEncodes the payload into quoted-printable form and sets the\n'Content-Transfer-Encoding' header to 'quoted-printable' (2).  This\nis a good encoding to use when most of your payload is normal\nprintable data, but contains a few unprintable characters.\n\n-- Function: email.encoders.encodebase64 (msg)\n\nEncodes the payload into base64 form and sets the\n'Content-Transfer-Encoding' header to 'base64'.  This is a good\nencoding to use when most of your payload is unprintable data since\nit is a more compact form than quoted-printable.  The drawback of\nbase64 encoding is that it renders the text non-human readable.\n\n-- Function: email.encoders.encode7or8bit (msg)\n\nThis doesn't actually modify the message's payload, but it does set\nthe 'Content-Transfer-Encoding' header to either '7bit' or '8bit'\nas appropriate, based on the payload data.\n\n-- Function: email.encoders.encodenoop (msg)\n\nThis does nothing; it doesn't even set the\n'Content-Transfer-Encoding' header.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/email/encoders.py\n\n(2) Note that encoding with *note encodequopri(): 329a. also encodes\nall tabs and space characters in the data.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: email utils Miscellaneous utilities,  Next: email iterators Iterators,  Prev: email encoders Encoders,  Up: email -- An email and MIME handling package": {
            "content": "5.19.1.18 'email.utils': Miscellaneous utilities\n................................................\n\n'Source code:' Lib/email/utils.py(1)\n\n\n\nThere are a couple of useful utilities provided in the *note\nemail.utils: 4c. module:\n\n-- Function: email.utils.localtime (dt=None)\n\nReturn local time as an aware datetime object.  If called without\narguments, return current time.  Otherwise 'dt' argument should be\na *note datetime: 222. instance, and it is converted to the local\ntime zone according to the system time zone database.  If 'dt' is\nnaive (that is, 'dt.tzinfo' is 'None'), it is assumed to be in\nlocal time.  The 'isdst' parameter is ignored.\n\nNew in version 3.3.\n\nDeprecated since version 3.12, will be removed in version 3.14: The\n'isdst' parameter.\n\n-- Function: email.utils.makemsgid (idstring=None, domain=None)\n\nReturns a string suitable for an RFC 2822(2)-compliant 'Message-ID'\nheader.  Optional 'idstring' if given, is a string used to\nstrengthen the uniqueness of the message id.  Optional 'domain' if\ngiven provides the portion of the msgid after the '@'.  The default\nis the local hostname.  It is not normally necessary to override\nthis default, but may be useful certain cases, such as a\nconstructing distributed system that uses a consistent domain name\nacross multiple hosts.\n\nChanged in version 3.2: Added the 'domain' keyword.\n\nThe remaining functions are part of the legacy ('Compat32') email API.",
            "subsections": []
        },
        "There is no need to directly use these with the new API, since the": {
            "content": "parsing and formatting they provide is done automatically by the header\nparsing machinery of the new API.\n\n-- Function: email.utils.quote (str)\n\nReturn a new string with backslashes in 'str' replaced by two\nbackslashes, and double quotes replaced by backslash-double quote.\n\n-- Function: email.utils.unquote (str)\n\nReturn a new string which is an 'unquoted' version of 'str'.  If\n'str' ends and begins with double quotes, they are stripped off.\nLikewise if 'str' ends and begins with angle brackets, they are\nstripped off.\n\n-- Function: email.utils.parseaddr (address, *, strict=True)\n\nParse address - which should be the value of some\naddress-containing field such as 'To' or 'Cc' - into its\nconstituent 'realname' and 'email address' parts.  Returns a tuple\nof that information, unless the parse fails, in which case a\n2-tuple of '('', '')' is returned.\n\nIf 'strict' is true, use a strict parser which rejects malformed\ninputs.\n\nChanged in version 3.13: Add 'strict' optional parameter and reject\nmalformed inputs by default.\n\n-- Function: email.utils.formataddr (pair, charset='utf-8')\n\nThe inverse of *note parseaddr(): 1439, this takes a 2-tuple of the\nform '(realname, emailaddress)' and returns the string value\nsuitable for a 'To' or 'Cc' header.  If the first element of 'pair'\nis false, then the second element is returned unmodified.\n\nOptional 'charset' is the character set that will be used in the\nRFC 2047(3) encoding of the 'realname' if the 'realname' contains\nnon-ASCII characters.  Can be an instance of *note str: 157. or a\n*note Charset: c57.  Defaults to 'utf-8'.\n\nChanged in version 3.3: Added the 'charset' option.\n\n-- Function: email.utils.getaddresses (fieldvalues, *, strict=True)\n\nThis method returns a list of 2-tuples of the form returned by\n'parseaddr()'.  'fieldvalues' is a sequence of header field values\nas might be returned by *note Message.getall: 325c.\n\nIf 'strict' is true, use a strict parser which rejects malformed\ninputs.\n\nHere's a simple example that gets all the recipients of a message:\n\nfrom email.utils import getaddresses\n\ntos = msg.getall('to', [])\nccs = msg.getall('cc', [])\nresenttos = msg.getall('resent-to', [])\nresentccs = msg.getall('resent-cc', [])\nallrecipients = getaddresses(tos + ccs + resenttos + resentccs)\n\nChanged in version 3.13: Add 'strict' optional parameter and reject\nmalformed inputs by default.\n\n-- Function: email.utils.parsedate (date)\n\nAttempts to parse a date according to the rules in RFC 2822(4).\nhowever, some mailers don't follow that format as specified, so\n*note parsedate(): 32a2. tries to guess correctly in such cases.\n'date' is a string containing an RFC 2822(5) date, such as '\"Mon,\n20 Nov 1995 19:12:08 -0500\"'.  If it succeeds in parsing the date,\n*note parsedate(): 32a2. returns a 9-tuple that can be passed\ndirectly to *note time.mktime(): 105c.; otherwise 'None' will be\nreturned.  Note that indexes 6, 7, and 8 of the result tuple are\nnot usable.\n\n-- Function: email.utils.parsedatetz (date)\n\nPerforms the same function as *note parsedate(): 32a2, but returns\neither 'None' or a 10-tuple; the first 9 elements make up a tuple\nthat can be passed directly to *note time.mktime(): 105c, and the\ntenth is the offset of the date's timezone from UTC (which is the\nofficial term for Greenwich Mean Time) (6).  If the input string\nhas no timezone, the last element of the tuple returned is '0',\nwhich represents UTC. Note that indexes 6, 7, and 8 of the result\ntuple are not usable.\n\n-- Function: email.utils.parsedatetodatetime (date)\n\nThe inverse of *note formatdatetime(): f2d.  Performs the same\nfunction as *note parsedate(): 32a2, but on success returns a *note\ndatetime: 222.; otherwise 'ValueError' is raised if 'date' contains\nan invalid value such as an hour greater than 23 or a timezone\noffset not between -24 and 24 hours.  If the input date has a\ntimezone of '-0000', the 'datetime' will be a naive 'datetime', and\nif the date is conforming to the RFCs it will represent a time in\nUTC but with no indication of the actual source timezone of the\nmessage the date comes from.  If the input date has any other valid\ntimezone offset, the 'datetime' will be an aware 'datetime' with\nthe corresponding a *note timezone: f2f. *note tzinfo: 3a2.\n\nNew in version 3.3.\n\n-- Function: email.utils.mktimetz (tuple)\n\nTurn a 10-tuple as returned by *note parsedatetz(): 15e0. into a\nUTC timestamp (seconds since the Epoch).  If the timezone item in\nthe tuple is 'None', assume local time.\n\n-- Function: email.utils.formatdate (timeval=None, localtime=False,\nusegmt=False)\n\nReturns a date string as per RFC 2822(7), e.g.:\n\nFri, 09 Nov 2001 01:08:47 -0000\n\nOptional 'timeval' if given is a floating point time value as\naccepted by *note time.gmtime(): 1034. and *note time.localtime():\n1353, otherwise the current time is used.\n\nOptional 'localtime' is a flag that when 'True', interprets\n'timeval', and returns a date relative to the local timezone\ninstead of UTC, properly taking daylight savings time into account.\nThe default is 'False' meaning UTC is used.\n\nOptional 'usegmt' is a flag that when 'True', outputs a date string\nwith the timezone as an ascii string 'GMT', rather than a numeric\n'-0000'.  This is needed for some protocols (such as HTTP). This\nonly applies when 'localtime' is 'False'.  The default is 'False'.\n\n-- Function: email.utils.formatdatetime (dt, usegmt=False)\n\nLike 'formatdate', but the input is a *note datetime: 2e. instance.\nIf it is a naive datetime, it is assumed to be \"UTC with no\ninformation about the source timezone\", and the conventional\n'-0000' is used for the timezone.  If it is an aware 'datetime',\nthen the numeric timezone offset is used.  If it is an aware\ntimezone with offset zero, then 'usegmt' may be set to 'True', in\nwhich case the string 'GMT' is used instead of the numeric timezone\noffset.  This provides a way to generate standards conformant HTTP\ndate headers.\n\nNew in version 3.3.\n\n-- Function: email.utils.decoderfc2231 (s)\n\nDecode the string 's' according to RFC 2231(8).\n\n-- Function: email.utils.encoderfc2231 (s, charset=None,\nlanguage=None)\n\nEncode the string 's' according to RFC 2231(9).  Optional 'charset'\nand 'language', if given is the character set name and language\nname to use.  If neither is given, 's' is returned as-is.  If\n'charset' is given but 'language' is not, the string is encoded\nusing the empty string for 'language'.\n\n-- Function: email.utils.collapserfc2231value (value,\nerrors='replace', fallbackcharset='us-ascii')\n\nWhen a header parameter is encoded in RFC 2231(10) format, *note\nMessage.getparam: 326a. may return a 3-tuple containing the\ncharacter set, language, and value.  *note\ncollapserfc2231value(): 326b. turns this into a unicode string.\nOptional 'errors' is passed to the 'errors' argument of *note str:\n157.'s *note encode(): 6ee. method; it defaults to ''replace''.\nOptional 'fallbackcharset' specifies the character set to use if\nthe one in the RFC 2231(11) header is not known by Python; it\ndefaults to ''us-ascii''.\n\nFor convenience, if the 'value' passed to *note\ncollapserfc2231value(): 326b. is not a tuple, it should be a\nstring and it is returned unquoted.\n\n-- Function: email.utils.decodeparams (params)\n\nDecode parameters list according to RFC 2231(12).  'params' is a\nsequence of 2-tuples containing elements of the form\n'(content-type, string-value)'.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/email/utils.py\n\n(2) https://datatracker.ietf.org/doc/html/rfc2822.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc2047.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc2822.html\n\n(5) https://datatracker.ietf.org/doc/html/rfc2822.html\n\n(6) Note that the sign of the timezone offset is the opposite of the\nsign of the 'time.timezone' variable for the same timezone; the latter\nvariable follows the POSIX standard while this module follows RFC 2822\n(https://datatracker.ietf.org/doc/html/rfc2822.html).\n\n(7) https://datatracker.ietf.org/doc/html/rfc2822.html\n\n(8) https://datatracker.ietf.org/doc/html/rfc2231.html\n\n(9) https://datatracker.ietf.org/doc/html/rfc2231.html\n\n(10) https://datatracker.ietf.org/doc/html/rfc2231.html\n\n(11) https://datatracker.ietf.org/doc/html/rfc2231.html\n\n(12) https://datatracker.ietf.org/doc/html/rfc2231.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: email iterators Iterators,  Prev: email utils Miscellaneous utilities,  Up: email -- An email and MIME handling package": {
            "content": "5.19.1.19 'email.iterators': Iterators\n......................................\n\n'Source code:' Lib/email/iterators.py(1)\n\n\n\nIterating over a message object tree is fairly easy with the *note\nMessage.walk: 3273. method.  The *note email.iterators: 3f. module\nprovides some useful higher level iterations over message object trees.\n\n-- Function: email.iterators.bodylineiterator (msg, decode=False)\n\nThis iterates over all the payloads in all the subparts of 'msg',\nreturning the string payloads line-by-line.  It skips over all the\nsubpart headers, and it skips over any subpart with a payload that\nisn't a Python string.  This is somewhat equivalent to reading the\nflat text representation of the message from a file using *note\nreadline(): 1a40, skipping over all the intervening headers.\n\nOptional 'decode' is passed through to *note Message.getpayload:\n1041.\n\n-- Function: email.iterators.typedsubpartiterator (msg,\nmaintype='text', subtype=None)\n\nThis iterates over all the subparts of 'msg', returning only those\nsubparts that match the MIME type specified by 'maintype' and\n'subtype'.\n\nNote that 'subtype' is optional; if omitted, then subpart MIME type\nmatching is done only with the main type.  'maintype' is optional\ntoo; it defaults to 'text'.\n\nThus, by default *note typedsubpartiterator(): 32aa. returns each\nsubpart that has a MIME type of 'text/*'.\n",
            "subsections": []
        },
        "The following function has been added as a useful debugging tool.  It": {
            "content": "should 'not' be considered part of the supported public interface for\nthe package.\n\n-- Function: email.iterators.structure (msg, fp=None, level=0,\nincludedefault=False)\n\nPrints an indented representation of the content types of the\nmessage object structure.  For example:\n\n>>> msg = email.messagefromfile(somefile)\n>>> structure(msg)\nmultipart/mixed\ntext/plain\ntext/plain\nmultipart/digest\nmessage/rfc822\ntext/plain\nmessage/rfc822\ntext/plain\nmessage/rfc822\ntext/plain\nmessage/rfc822\ntext/plain\nmessage/rfc822\ntext/plain\ntext/plain\n\nOptional 'fp' is a file-like object to print the output to.  It\nmust be suitable for Python's *note print(): de5. function.\n'level' is used internally.  'includedefault', if true, prints the\ndefault type as well.\n\nSee also\n........\n\nModule *note smtplib: c4.\n\nSMTP (Simple Mail Transport Protocol) client\n\nModule *note poplib: a7.\n\nPOP (Post Office Protocol) client\n\nModule *note imaplib: 6f.\n\nIMAP (Internet Message Access Protocol) client\n\nModule *note nntplib: 98.\n\nNNTP (Net News Transport Protocol) client\n\nModule *note mailbox: 86.\n\nTools for creating, reading, and managing collections of messages\non disk using a variety standard formats.\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/email/iterators.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: json -- JSON encoder and decoder,  Next: mailbox -- Manipulate mailboxes in various formats,  Prev: email -- An email and MIME handling package,  Up: Internet Data Handling": {
            "content": "'Source code:' Lib/json/init.py(1)\n\n\n\nJSON (JavaScript Object Notation)(2), specified by RFC 7159(3) (which\nobsoletes RFC 4627(4)) and by ECMA-404(5), is a lightweight data\ninterchange format inspired by JavaScript(6) object literal syntax\n(although it is not a strict subset of JavaScript (7) ).\n\nWarning: Be cautious when parsing JSON data from untrusted sources.\nA malicious JSON string may cause the decoder to consume\nconsiderable CPU and memory resources.  Limiting the size of data\nto be parsed is recommended.\n\n*note json: 7c. exposes an API familiar to users of the standard library\n*note marshal: 88. and *note pickle: a1. modules.\n\nEncoding basic Python object hierarchies:\n\n>>> import json\n>>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}])\n'[\"foo\", {\"bar\": [\"baz\", null, 1.0, 2]}]'\n>>> print(json.dumps(\"\\\"foo\\bar\"))\n\"\\\"foo\\bar\"\n>>> print(json.dumps('\\u1234'))\n\"\\u1234\"\n>>> print(json.dumps('\\\\'))\n\"\\\\\"\n>>> print(json.dumps({\"c\": 0, \"b\": 0, \"a\": 0}, sortkeys=True))\n{\"a\": 0, \"b\": 0, \"c\": 0}\n>>> from io import StringIO\n>>> io = StringIO()\n>>> json.dump(['streaming API'], io)\n>>> io.getvalue()\n'[\"streaming API\"]'\n\nCompact encoding:\n\n>>> import json\n>>> json.dumps([1, 2, 3, {'4': 5, '6': 7}], separators=(',', ':'))\n'[1,2,3,{\"4\":5,\"6\":7}]'\n\nPretty printing:\n\n>>> import json\n>>> print(json.dumps({'4': 5, '6': 7}, sortkeys=True, indent=4))\n{\n\"4\": 5,\n\"6\": 7\n}\n\nDecoding JSON:\n\n>>> import json\n>>> json.loads('[\"foo\", {\"bar\":[\"baz\", null, 1.0, 2]}]')\n['foo', {'bar': ['baz', None, 1.0, 2]}]\n>>> json.loads('\"\\\\\"foo\\\\bar\"')\n'\"foo\\x08ar'\n>>> from io import StringIO\n>>> io = StringIO('[\"streaming API\"]')\n>>> json.load(io)\n['streaming API']\n\nSpecializing JSON object decoding:\n\n>>> import json\n>>> def ascomplex(dct):\n...     if 'complex' in dct:\n...         return complex(dct['real'], dct['imag'])\n...     return dct\n...\n>>> json.loads('{\"complex\": true, \"real\": 1, \"imag\": 2}',\n...     objecthook=ascomplex)\n(1+2j)\n>>> import decimal\n>>> json.loads('1.1', parsefloat=decimal.Decimal)\nDecimal('1.1')\n\nExtending *note JSONEncoder: b9e.:\n\n>>> import json\n>>> class ComplexEncoder(json.JSONEncoder):\n...     def default(self, obj):\n...         if isinstance(obj, complex):\n...             return [obj.real, obj.imag]\n...         # Let the base class default method raise the TypeError\n...         return super().default(obj)\n...\n>>> json.dumps(2 + 1j, cls=ComplexEncoder)\n'[2.0, 1.0]'\n>>> ComplexEncoder().encode(2 + 1j)\n'[2.0, 1.0]'\n>>> list(ComplexEncoder().iterencode(2 + 1j))\n['[2.0', ', 1.0', ']']\n\nUsing *note json.tool: 7d. from the shell to validate and pretty-print:\n\n$ echo '{\"json\":\"obj\"}' | python -m json.tool\n{\n\"json\": \"obj\"\n}\n$ echo '{1.2:3.4}' | python -m json.tool\nExpecting property name enclosed in double quotes: line 1 column 2 (char 1)\n\nSee *note Command Line Interface: 32ae. for detailed documentation.\n\nNote: JSON is a subset of YAML(8) 1.2.  The JSON produced by this\nmodule's default settings (in particular, the default 'separators'\nvalue) is also a subset of YAML 1.0 and 1.1.  This module can thus\nalso be used as a YAML serializer.\n\nNote: This module's encoders and decoders preserve input and output\norder by default.  Order is only lost if the underlying containers\nare unordered.\n\n* Menu:\n\n* Basic Usage::\n* Encoders and Decoders::\n* Exceptions: Exceptions<15>.\n* Standard Compliance and Interoperability::\n* Command Line Interface: Command Line Interface<2>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/json/init.py\n\n(2) https://json.org\n\n(3) https://datatracker.ietf.org/doc/html/rfc7159.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc4627.html\n\n(5)\nhttps://www.ecma-international.org/publications-and-standards/standards/ecma-404/\n\n(6) https://en.wikipedia.org/wiki/JavaScript\n\n(7) As noted in the errata for RFC 7159\n(https://www.rfc-editor.org/erratasearch.php?rfc=7159), JSON permits\nliteral U+2028 (LINE SEPARATOR) and U+2029 (PARAGRAPH SEPARATOR)\ncharacters in strings, whereas JavaScript (as of ECMAScript Edition 5.1)\ndoes not.\n\n(8) https://yaml.org/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Basic Usage,  Next: Encoders and Decoders,  Up: json -- JSON encoder and decoder": {
            "content": "5.19.2.1 Basic Usage\n....................\n\n-- Function: json.dump (obj, fp, *, skipkeys=False, ensureascii=True,\ncheckcircular=True, allownan=True, cls=None, indent=None,\nseparators=None, default=None, sortkeys=False, kw)\n\nSerialize 'obj' as a JSON formatted stream to 'fp' (a\n'.write()'-supporting *note file-like object: 229a.) using this\n*note conversion table: 32b0.\n\nIf 'skipkeys' is true (default: 'False'), then dict keys that are\nnot of a basic type (*note str: 157, *note int: 17e, *note float:\n4b7, *note bool: 17d, 'None') will be skipped instead of raising a\n*note TypeError: 28e.\n\nThe *note json: 7c. module always produces *note str: 157. objects,\nnot *note bytes: 295. objects.  Therefore, 'fp.write()' must\nsupport *note str: 157. input.\n\nIf 'ensureascii' is true (the default), the output is guaranteed\nto have all incoming non-ASCII characters escaped.  If\n'ensureascii' is false, these characters will be output as-is.\n\nIf 'checkcircular' is false (default: 'True'), then the circular\nreference check for container types will be skipped and a circular\nreference will result in a *note RecursionError: bc6. (or worse).\n\nIf 'allownan' is false (default: 'True'), then it will be a *note\nValueError: 183. to serialize out of range *note float: 4b7. values\n('nan', 'inf', '-inf') in strict compliance of the JSON\nspecification.  If 'allownan' is true, their JavaScript\nequivalents ('NaN', 'Infinity', '-Infinity') will be used.\n\nIf 'indent' is a non-negative integer or string, then JSON array\nelements and object members will be pretty-printed with that indent\nlevel.  An indent level of 0, negative, or '\"\"' will only insert\nnewlines.  'None' (the default) selects the most compact\nrepresentation.  Using a positive integer indent indents that many\nspaces per level.  If 'indent' is a string (such as '\"\\t\"'), that\nstring is used to indent each level.\n\nChanged in version 3.2: Allow strings for 'indent' in addition to\nintegers.\n\nIf specified, 'separators' should be an '(itemseparator,\nkeyseparator)' tuple.  The default is '(', ', ': ')' if 'indent'\nis 'None' and '(',', ': ')' otherwise.  To get the most compact\nJSON representation, you should specify '(',', ':')' to eliminate\nwhitespace.\n\nChanged in version 3.4: Use '(',', ': ')' as default if 'indent' is\nnot 'None'.\n\nIf specified, 'default' should be a function that gets called for\nobjects that can't otherwise be serialized.  It should return a\nJSON encodable version of the object or raise a *note TypeError:\n28e.  If not specified, *note TypeError: 28e. is raised.\n\nIf 'sortkeys' is true (default: 'False'), then the output of\ndictionaries will be sorted by key.\n\nTo use a custom *note JSONEncoder: b9e. subclass (e.g.  one that\noverrides the *note default(): 32b1. method to serialize additional\ntypes), specify it with the 'cls' kwarg; otherwise *note\nJSONEncoder: b9e. is used.\n\nChanged in version 3.6: All optional parameters are now *note\nkeyword-only: 8b8.\n\nNote: Unlike *note pickle: a1. and *note marshal: 88, JSON is\nnot a framed protocol, so trying to serialize multiple objects\nwith repeated calls to *note dump(): b9c. using the same 'fp'\nwill result in an invalid JSON file.\n\n-- Function: json.dumps (obj, *, skipkeys=False, ensureascii=True,\ncheckcircular=True, allownan=True, cls=None, indent=None,\nseparators=None, default=None, sortkeys=False, kw)\n\nSerialize 'obj' to a JSON formatted *note str: 157. using this\n*note conversion table: 32b0.  The arguments have the same meaning\nas in *note dump(): b9c.\n\nNote: Keys in key/value pairs of JSON are always of the type\n*note str: 157.  When a dictionary is converted into JSON, all\nthe keys of the dictionary are coerced to strings.  As a\nresult of this, if a dictionary is converted into JSON and\nthen back into a dictionary, the dictionary may not equal the\noriginal one.  That is, 'loads(dumps(x)) != x' if x has\nnon-string keys.\n\n-- Function: json.load (fp, *, cls=None, objecthook=None,\nparsefloat=None, parseint=None, parseconstant=None,\nobjectpairshook=None, kw)\n\nDeserialize 'fp' (a '.read()'-supporting *note text file: 1a0b. or\n*note binary file: 1a0c. containing a JSON document) to a Python\nobject using this *note conversion table: 32b2.\n\n'objecthook' is an optional function that will be called with the\nresult of any object literal decoded (a *note dict: 237.).  The\nreturn value of 'objecthook' will be used instead of the *note\ndict: 237.  This feature can be used to implement custom decoders\n(e.g.  JSON-RPC(1) class hinting).\n\n'objectpairshook' is an optional function that will be called\nwith the result of any object literal decoded with an ordered list\nof pairs.  The return value of 'objectpairshook' will be used\ninstead of the *note dict: 237.  This feature can be used to\nimplement custom decoders.  If 'objecthook' is also defined, the\n'objectpairshook' takes priority.\n\nChanged in version 3.1: Added support for 'objectpairshook'.\n\n'parsefloat', if specified, will be called with the string of\nevery JSON float to be decoded.  By default, this is equivalent to\n'float(numstr)'.  This can be used to use another datatype or\nparser for JSON floats (e.g.  *note decimal.Decimal: 5c3.).\n\n'parseint', if specified, will be called with the string of every\nJSON int to be decoded.  By default, this is equivalent to\n'int(numstr)'.  This can be used to use another datatype or parser\nfor JSON integers (e.g.  *note float: 4b7.).\n\nChanged in version 3.11: The default 'parseint' of *note int():\n17e. now limits the maximum length of the integer string via the\ninterpreter's *note integer string conversion length limitation:\n3bc. to help avoid denial of service attacks.\n\n'parseconstant', if specified, will be called with one of the\nfollowing strings: ''-Infinity'', ''Infinity'', ''NaN''.  This can\nbe used to raise an exception if invalid JSON numbers are\nencountered.\n\nChanged in version 3.1: 'parseconstant' doesn't get called on\n'null', 'true', 'false' anymore.\n\nTo use a custom *note JSONDecoder: b9f. subclass, specify it with\nthe 'cls' kwarg; otherwise *note JSONDecoder: b9f. is used.\nAdditional keyword arguments will be passed to the constructor of\nthe class.\n\nIf the data being deserialized is not a valid JSON document, a\n*note JSONDecodeError: c7f. will be raised.\n\nChanged in version 3.6: All optional parameters are now *note\nkeyword-only: 8b8.\n\nChanged in version 3.6: 'fp' can now be a *note binary file: 1a0c.\nThe input encoding should be UTF-8, UTF-16 or UTF-32.\n\n-- Function: json.loads (s, *, cls=None, objecthook=None,\nparsefloat=None, parseint=None, parseconstant=None,\nobjectpairshook=None, kw)\n\nDeserialize 's' (a *note str: 157, *note bytes: 295. or *note\nbytearray: 294. instance containing a JSON document) to a Python\nobject using this *note conversion table: 32b2.\n\nThe other arguments have the same meaning as in *note load(): b03.\n\nIf the data being deserialized is not a valid JSON document, a\n*note JSONDecodeError: c7f. will be raised.\n\nChanged in version 3.6: 's' can now be of type *note bytes: 295. or\n*note bytearray: 294.  The input encoding should be UTF-8, UTF-16\nor UTF-32.\n\nChanged in version 3.9: The keyword argument 'encoding' has been\nremoved.\n\n---------- Footnotes ----------\n\n(1) https://www.jsonrpc.org\n\nFile: python3.12.info,  Node: Encoders and Decoders,  Next: Exceptions<15>,  Prev: Basic Usage,  Up: json -- JSON encoder and decoder\n\n5.19.2.2 Encoders and Decoders\n..............................\n\n-- Class: json.JSONDecoder (*, objecthook=None, parsefloat=None,\nparseint=None, parseconstant=None, strict=True,\nobjectpairshook=None)\n\nSimple JSON decoder.\n\nPerforms the following translations in decoding by default:\n\nJSON                Python\n\n--------------------------------------------\n\nobject              dict\n\n\narray               list\n\n\nstring              str\n\n\nnumber (int)        int\n\n\nnumber (real)       float\n\n\ntrue                True\n\n\nfalse               False\n\n\nnull                None\n\n\nIt also understands 'NaN', 'Infinity', and '-Infinity' as their\ncorresponding 'float' values, which is outside the JSON spec.\n\n'objecthook', if specified, will be called with the result of\nevery JSON object decoded and its return value will be used in\nplace of the given *note dict: 237.  This can be used to provide\ncustom deserializations (e.g.  to support JSON-RPC(1) class\nhinting).\n\n'objectpairshook', if specified will be called with the result of\nevery JSON object decoded with an ordered list of pairs.  The\nreturn value of 'objectpairshook' will be used instead of the\n*note dict: 237.  This feature can be used to implement custom\ndecoders.  If 'objecthook' is also defined, the\n'objectpairshook' takes priority.\n\nChanged in version 3.1: Added support for 'objectpairshook'.\n\n'parsefloat', if specified, will be called with the string of\nevery JSON float to be decoded.  By default, this is equivalent to\n'float(numstr)'.  This can be used to use another datatype or\nparser for JSON floats (e.g.  *note decimal.Decimal: 5c3.).\n\n'parseint', if specified, will be called with the string of every\nJSON int to be decoded.  By default, this is equivalent to\n'int(numstr)'.  This can be used to use another datatype or parser\nfor JSON integers (e.g.  *note float: 4b7.).\n\n'parseconstant', if specified, will be called with one of the\nfollowing strings: ''-Infinity'', ''Infinity'', ''NaN''.  This can\nbe used to raise an exception if invalid JSON numbers are\nencountered.\n\nIf 'strict' is false ('True' is the default), then control\ncharacters will be allowed inside strings.  Control characters in\nthis context are those with character codes in the 0-31 range,\nincluding ''\\t'' (tab), ''\\n'', ''\\r'' and ''\\0''.\n\nIf the data being deserialized is not a valid JSON document, a\n*note JSONDecodeError: c7f. will be raised.\n\nChanged in version 3.6: All parameters are now *note keyword-only:\n8b8.\n\n-- Method: decode (s)\n\nReturn the Python representation of 's' (a *note str: 157.\ninstance containing a JSON document).\n\n*note JSONDecodeError: c7f. will be raised if the given JSON\ndocument is not valid.\n\n-- Method: rawdecode (s)\n\nDecode a JSON document from 's' (a *note str: 157. beginning\nwith a JSON document) and return a 2-tuple of the Python\nrepresentation and the index in 's' where the document ended.\n\nThis can be used to decode a JSON document from a string that\nmay have extraneous data at the end.\n\n-- Class: json.JSONEncoder (*, skipkeys=False, ensureascii=True,\ncheckcircular=True, allownan=True, sortkeys=False,\nindent=None, separators=None, default=None)\n\nExtensible JSON encoder for Python data structures.\n\nSupports the following objects and types by default:\n\nPython                                       JSON\n\n-----------------------------------------------------------------\n\ndict                                         object\n\n\nlist, tuple                                  array\n\n\nstr                                          string\n\n\nint, float, int- & float-derived Enums       number\n\n\nTrue                                         true\n\n\nFalse                                        false\n\n\nNone                                         null\n\n\nChanged in version 3.4: Added support for int- and float-derived\nEnum classes.\n\nTo extend this to recognize other objects, subclass and implement a\n*note default(): 32b1. method with another method that returns a\nserializable object for 'o' if possible, otherwise it should call\nthe superclass implementation (to raise *note TypeError: 28e.).\n\nIf 'skipkeys' is false (the default), a *note TypeError: 28e. will\nbe raised when trying to encode keys that are not *note str: 157,\n*note int: 17e, *note float: 4b7. or 'None'.  If 'skipkeys' is\ntrue, such items are simply skipped.\n\nIf 'ensureascii' is true (the default), the output is guaranteed\nto have all incoming non-ASCII characters escaped.  If\n'ensureascii' is false, these characters will be output as-is.\n\nIf 'checkcircular' is true (the default), then lists, dicts, and\ncustom encoded objects will be checked for circular references\nduring encoding to prevent an infinite recursion (which would cause\na *note RecursionError: bc6.).  Otherwise, no such check takes\nplace.\n\nIf 'allownan' is true (the default), then 'NaN', 'Infinity', and\n'-Infinity' will be encoded as such.  This behavior is not JSON\nspecification compliant, but is consistent with most JavaScript\nbased encoders and decoders.  Otherwise, it will be a *note\nValueError: 183. to encode such floats.\n\nIf 'sortkeys' is true (default: 'False'), then the output of\ndictionaries will be sorted by key; this is useful for regression\ntests to ensure that JSON serializations can be compared on a\nday-to-day basis.\n\nIf 'indent' is a non-negative integer or string, then JSON array\nelements and object members will be pretty-printed with that indent\nlevel.  An indent level of 0, negative, or '\"\"' will only insert\nnewlines.  'None' (the default) selects the most compact\nrepresentation.  Using a positive integer indent indents that many\nspaces per level.  If 'indent' is a string (such as '\"\\t\"'), that\nstring is used to indent each level.\n\nChanged in version 3.2: Allow strings for 'indent' in addition to\nintegers.\n\nIf specified, 'separators' should be an '(itemseparator,\nkeyseparator)' tuple.  The default is '(', ', ': ')' if 'indent'\nis 'None' and '(',', ': ')' otherwise.  To get the most compact\nJSON representation, you should specify '(',', ':')' to eliminate\nwhitespace.\n\nChanged in version 3.4: Use '(',', ': ')' as default if 'indent' is\nnot 'None'.\n\nIf specified, 'default' should be a function that gets called for\nobjects that can't otherwise be serialized.  It should return a\nJSON encodable version of the object or raise a *note TypeError:\n28e.  If not specified, *note TypeError: 28e. is raised.\n\nChanged in version 3.6: All parameters are now *note keyword-only:\n8b8.\n\n-- Method: default (o)\n\nImplement this method in a subclass such that it returns a\nserializable object for 'o', or calls the base implementation\n(to raise a *note TypeError: 28e.).\n\nFor example, to support arbitrary iterators, you could\nimplement *note default(): 32b1. like this:\n\ndef default(self, o):\ntry:\niterable = iter(o)\nexcept TypeError:\npass\nelse:\nreturn list(iterable)\n# Let the base class default method raise the TypeError\nreturn super().default(o)\n\n-- Method: encode (o)\n\nReturn a JSON string representation of a Python data\nstructure, 'o'.  For example:\n\n>>> json.JSONEncoder().encode({\"foo\": [\"bar\", \"baz\"]})\n'{\"foo\": [\"bar\", \"baz\"]}'\n\n-- Method: iterencode (o)\n\nEncode the given object, 'o', and yield each string\nrepresentation as available.  For example:\n\nfor chunk in json.JSONEncoder().iterencode(bigobject):\nmysocket.write(chunk)\n\n---------- Footnotes ----------\n\n(1) https://www.jsonrpc.org\n\nFile: python3.12.info,  Node: Exceptions<15>,  Next: Standard Compliance and Interoperability,  Prev: Encoders and Decoders,  Up: json -- JSON encoder and decoder\n\n5.19.2.3 Exceptions\n...................\n\n-- Exception: json.JSONDecodeError (msg, doc, pos)\n\nSubclass of *note ValueError: 183. with the following additional\nattributes:\n\n-- Attribute: msg\n\nThe unformatted error message.\n\n-- Attribute: doc\n\nThe JSON document being parsed.\n\n-- Attribute: pos\n\nThe start index of 'doc' where parsing failed.\n\n-- Attribute: lineno\n\nThe line corresponding to 'pos'.\n\n-- Attribute: colno\n\nThe column corresponding to 'pos'.\n\nNew in version 3.5.\n\nFile: python3.12.info,  Node: Standard Compliance and Interoperability,  Next: Command Line Interface<2>,  Prev: Exceptions<15>,  Up: json -- JSON encoder and decoder\n\n5.19.2.4 Standard Compliance and Interoperability\n.................................................\n",
            "subsections": []
        },
        "The JSON format is specified by RFC 7159(1) and by ECMA-404(2).  This": {
            "content": "section details this module's level of compliance with the RFC. For\nsimplicity, *note JSONEncoder: b9e. and *note JSONDecoder: b9f.\nsubclasses, and parameters other than those explicitly mentioned, are\nnot considered.\n",
            "subsections": []
        },
        "This module does not comply with the RFC in a strict fashion,": {
            "content": "implementing some extensions that are valid JavaScript but not valid\nJSON. In particular:\n\n- Infinite and NaN number values are accepted and output;\n\n- Repeated names within an object are accepted, and only the value of\nthe last name-value pair is used.\n",
            "subsections": []
        },
        "Since the RFC permits RFC-compliant parsers to accept input texts that": {
            "content": "are not RFC-compliant, this module's deserializer is technically\nRFC-compliant under default settings.\n\n* Menu:\n\n* Character Encodings::\n* Infinite and NaN Number Values::\n* Repeated Names Within an Object::\n* Top-level Non-Object, Non-Array Values: Top-level Non-Object Non-Array Values.\n* Implementation Limitations::\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc7159.html\n\n(2)\nhttps://www.ecma-international.org/publications-and-standards/standards/ecma-404/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Character Encodings,  Next: Infinite and NaN Number Values,  Up: Standard Compliance and Interoperability": {
            "content": "5.19.2.5 Character Encodings\n............................\n",
            "subsections": []
        },
        "The RFC requires that JSON be represented using either UTF-8, UTF-16, or": {
            "content": "UTF-32, with UTF-8 being the recommended default for maximum\ninteroperability.\n",
            "subsections": []
        },
        "As permitted, though not required, by the RFC, this module's serializer": {
            "content": "sets 'ensureascii=True' by default, thus escaping the output so that\nthe resulting strings only contain ASCII characters.\n",
            "subsections": []
        },
        "Other than the 'ensureascii' parameter, this module is defined strictly": {
            "content": "in terms of conversion between Python objects and *note Unicode strings:\n157, and thus does not otherwise directly address the issue of character\nencodings.\n",
            "subsections": []
        },
        "The RFC prohibits adding a byte order mark (BOM) to the start of a JSON": {
            "content": "text, and this module's serializer does not add a BOM to its output.",
            "subsections": []
        },
        "The RFC permits, but does not require, JSON deserializers to ignore an": {
            "content": "initial BOM in their input.  This module's deserializer raises a *note\nValueError: 183. when an initial BOM is present.\n",
            "subsections": []
        },
        "The RFC does not explicitly forbid JSON strings which contain byte": {
            "content": "sequences that don't correspond to valid Unicode characters (e.g.\nunpaired UTF-16 surrogates), but it does note that they may cause\ninteroperability problems.  By default, this module accepts and outputs\n(when present in the original *note str: 157.) code points for such\nsequences.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Infinite and NaN Number Values,  Next: Repeated Names Within an Object,  Prev: Character Encodings,  Up: Standard Compliance and Interoperability": {
            "content": "5.19.2.6 Infinite and NaN Number Values\n.......................................\n",
            "subsections": []
        },
        "The RFC does not permit the representation of infinite or NaN number": {
            "content": "values.  Despite that, by default, this module accepts and outputs\n'Infinity', '-Infinity', and 'NaN' as if they were valid JSON number\nliteral values:\n\n>>> # Neither of these calls raises an exception, but the results are not valid JSON\n>>> json.dumps(float('-inf'))\n'-Infinity'\n>>> json.dumps(float('nan'))\n'NaN'\n>>> # Same when deserializing\n>>> json.loads('-Infinity')",
            "subsections": [
                {
                    "name": "-inf",
                    "content": ">>> json.loads('NaN')\nnan\n"
                }
            ]
        },
        "In the serializer, the 'allownan' parameter can be used to alter this": {
            "content": "behavior.  In the deserializer, the 'parseconstant' parameter can be\nused to alter this behavior.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Repeated Names Within an Object,  Next: Top-level Non-Object Non-Array Values,  Prev: Infinite and NaN Number Values,  Up: Standard Compliance and Interoperability": {
            "content": "5.19.2.7 Repeated Names Within an Object\n........................................\n",
            "subsections": []
        },
        "The RFC specifies that the names within a JSON object should be unique,": {
            "content": "but does not mandate how repeated names in JSON objects should be\nhandled.  By default, this module does not raise an exception; instead,\nit ignores all but the last name-value pair for a given name:\n\n>>> weirdjson = '{\"x\": 1, \"x\": 2, \"x\": 3}'\n>>> json.loads(weirdjson)\n{'x': 3}\n\nThe 'objectpairshook' parameter can be used to alter this behavior.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Top-level Non-Object Non-Array Values,  Next: Implementation Limitations,  Prev: Repeated Names Within an Object,  Up: Standard Compliance and Interoperability": {
            "content": "5.19.2.8 Top-level Non-Object, Non-Array Values\n...............................................\n",
            "subsections": []
        },
        "The old version of JSON specified by the obsolete RFC 4627(1) required": {
            "content": "that the top-level value of a JSON text must be either a JSON object or\narray (Python *note dict: 237. or *note list: 3dc.), and could not be a\nJSON null, boolean, number, or string value.  RFC 7159(2) removed that\nrestriction, and this module does not and has never implemented that\nrestriction in either its serializer or its deserializer.\n",
            "subsections": []
        },
        "Regardless, for maximum interoperability, you may wish to voluntarily": {
            "content": "adhere to the restriction yourself.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc4627.html\n\n(2) https://datatracker.ietf.org/doc/html/rfc7159.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Implementation Limitations,  Prev: Top-level Non-Object Non-Array Values,  Up: Standard Compliance and Interoperability": {
            "content": "5.19.2.9 Implementation Limitations\n...................................\n\nSome JSON deserializer implementations may set limits on:\n\n* the size of accepted JSON texts\n\n* the maximum level of nesting of JSON objects and arrays\n\n* the range and precision of JSON numbers\n\n* the content and maximum length of JSON strings\n",
            "subsections": []
        },
        "This module does not impose any such limits beyond those of the relevant": {
            "content": "Python datatypes themselves or the Python interpreter itself.\n",
            "subsections": []
        },
        "When serializing to JSON, beware any such limitations in applications": {
            "content": "that may consume your JSON. In particular, it is common for JSON numbers\nto be deserialized into IEEE 754 double precision numbers and thus\nsubject to that representation's range and precision limitations.  This\nis especially relevant when serializing Python *note int: 17e. values of\nextremely large magnitude, or when serializing instances of \"exotic\"\nnumerical types such as *note decimal.Decimal: 5c3.\n\nFile: python3.12.info,  Node: Command Line Interface<2>,  Prev: Standard Compliance and Interoperability,  Up: json -- JSON encoder and decoder\n\n5.19.2.10 Command Line Interface\n................................\n\n'Source code:' Lib/json/tool.py(1)\n\n\n\nThe *note json.tool: 7d. module provides a simple command line interface\nto validate and pretty-print JSON objects.\n",
            "subsections": []
        },
        "If the optional 'infile' and 'outfile' arguments are not specified,": {
            "content": "*note sys.stdin: 293. and *note sys.stdout: 90c. will be used\nrespectively:\n\n$ echo '{\"json\": \"obj\"}' | python -m json.tool\n{\n\"json\": \"obj\"\n}\n$ echo '{1.2:3.4}' | python -m json.tool\nExpecting property name enclosed in double quotes: line 1 column 2 (char 1)\n",
            "subsections": []
        },
        "Changed in version 3.5: The output is now in the same order as the": {
            "content": "input.  Use the *note -sort-keys: 32c5. option to sort the output of\ndictionaries alphabetically by key.\n\n* Menu:\n\n* Command line options: Command line options<2>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/json/tool.py\n\nFile: python3.12.info,  Node: Command line options<2>,  Up: Command Line Interface<2>\n\n5.19.2.11 Command line options\n..............................\n\n-- Option: infile\n\nThe JSON file to be validated or pretty-printed:\n\n$ python -m json.tool mpfilms.json\n[\n{\n\"title\": \"And Now for Something Completely Different\",\n\"year\": 1971\n},\n{\n\"title\": \"Monty Python and the Holy Grail\",\n\"year\": 1975\n}\n]\n\nIf 'infile' is not specified, read from *note sys.stdin: 293.\n\n-- Option: outfile\n\nWrite the output of the 'infile' to the given 'outfile'.\nOtherwise, write it to *note sys.stdout: 90c.\n\n-- Option: --sort-keys\n\nSort the output of dictionaries alphabetically by key.\n\nNew in version 3.5.\n\n-- Option: --no-ensure-ascii\n\nDisable escaping of non-ascii characters, see *note json.dumps():\nb9d. for more information.\n\nNew in version 3.9.\n\n-- Option: --json-lines\n\nParse every input line as separate JSON object.\n\nNew in version 3.8.\n\n-- Option: --indent, --tab, --no-indent, --compact\n\nMutually exclusive options for whitespace control.\n\nNew in version 3.9.\n\n-- Option: -h, --help\n\nShow the help message.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: mailbox -- Manipulate mailboxes in various formats,  Next: mimetypes -- Map filenames to MIME types,  Prev: json -- JSON encoder and decoder,  Up: Internet Data Handling": {
            "content": "'Source code:' Lib/mailbox.py(1)\n\n\n\nThis module defines two classes, *note Mailbox: 10c3. and *note Message:\n10c7, for accessing and manipulating on-disk mailboxes and the messages\nthey contain.  'Mailbox' offers a dictionary-like mapping from keys to\nmessages.  'Message' extends the *note email.message: 40. module's *note",
            "subsections": []
        },
        "Message: ae7. class with format-specific state and behavior.  Supported": {
            "content": "mailbox formats are Maildir, mbox, MH, Babyl, and MMDF.\n\nSee also\n........\n\nModule *note email: 37.\n\nRepresent and manipulate messages.\n\n* Menu:\n\n* Mailbox objects::\n* Message objects::\n* Exceptions: Exceptions<16>.\n* Examples: Examples<22>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/mailbox.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Mailbox objects,  Next: Message objects,  Up: mailbox -- Manipulate mailboxes in various formats": {
            "content": "5.19.3.1 'Mailbox' objects\n..........................\n\n-- Class: mailbox.Mailbox\n\nA mailbox, which may be inspected and modified.\n\nThe 'Mailbox' class defines an interface and is not intended to be\ninstantiated.  Instead, format-specific subclasses should inherit\nfrom 'Mailbox' and your code should instantiate a particular\nsubclass.\n\nThe 'Mailbox' interface is dictionary-like, with small keys\ncorresponding to messages.  Keys are issued by the 'Mailbox'\ninstance with which they will be used and are only meaningful to\nthat 'Mailbox' instance.  A key continues to identify a message\neven if the corresponding message is modified, such as by replacing\nit with another message.\n\nMessages may be added to a 'Mailbox' instance using the set-like\nmethod *note add(): 10c2. and removed using a 'del' statement or\nthe set-like methods *note remove(): 32d5. and *note discard():\n32d6.\n\n'Mailbox' interface semantics differ from dictionary semantics in\nsome noteworthy ways.  Each time a message is requested, a new\nrepresentation (typically a *note Message: 10c7. instance) is\ngenerated based upon the current state of the mailbox.  Similarly,\nwhen a message is added to a 'Mailbox' instance, the provided\nmessage representation's contents are copied.  In neither case is a\nreference to the message representation kept by the 'Mailbox'\ninstance.\n\nThe default 'Mailbox' *note iterator: 16a9. iterates over message\nrepresentations, not keys as the default *note dictionary: 237.\niterator does.  Moreover, modification of a mailbox during\niteration is safe and well-defined.  Messages added to the mailbox\nafter an iterator is created will not be seen by the iterator.\nMessages removed from the mailbox before the iterator yields them\nwill be silently skipped, though using a key from an iterator may\nresult in a *note KeyError: 8cf. exception if the corresponding\nmessage is subsequently removed.\n\nWarning: Be very cautious when modifying mailboxes that might\nbe simultaneously changed by some other process.  The safest\nmailbox format to use for such tasks is *note Maildir: 118a.;\ntry to avoid using single-file formats such as *note mbox:\n13d0. for concurrent writing.  If you're modifying a mailbox,\nyou 'must' lock it by calling the *note lock(): 32d7. and\n*note unlock(): 32d8. methods 'before' reading any messages in\nthe file or making any changes by adding or deleting a\nmessage.  Failing to lock the mailbox runs the risk of losing\nmessages or corrupting the entire mailbox.\n\n'Mailbox' instances have the following methods:\n\n-- Method: add (message)\n\nAdd 'message' to the mailbox and return the key that has been\nassigned to it.\n\nParameter 'message' may be a *note Message: 10c7. instance, an\n*note email.message.Message: ae7. instance, a string, a byte\nstring, or a file-like object (which should be open in binary\nmode).  If 'message' is an instance of the appropriate\nformat-specific *note Message: 10c7. subclass (e.g., if it's\nan *note mboxMessage: 31a8. instance and this is an *note\nmbox: 13d0. instance), its format-specific information is\nused.  Otherwise, reasonable defaults for format-specific\ninformation are used.\n\nChanged in version 3.2: Support for binary input was added.\n\n-- Method: remove (key)\n-- Method: delitem (key)\n-- Method: discard (key)\n\nDelete the message corresponding to 'key' from the mailbox.\n\nIf no such message exists, a *note KeyError: 8cf. exception is\nraised if the method was called as *note remove(): 32d5. or\n*note delitem(): 32d9. but no exception is raised if the\nmethod was called as *note discard(): 32d6.  The behavior of\n*note discard(): 32d6. may be preferred if the underlying\nmailbox format supports concurrent modification by other\nprocesses.\n\n-- Method: setitem (key, message)\n\nReplace the message corresponding to 'key' with 'message'.\nRaise a *note KeyError: 8cf. exception if no message already\ncorresponds to 'key'.\n\nAs with *note add(): 10c2, parameter 'message' may be a *note\nMessage: 10c7. instance, an *note email.message.Message: ae7.\ninstance, a string, a byte string, or a file-like object\n(which should be open in binary mode).  If 'message' is an\ninstance of the appropriate format-specific *note Message:\n10c7. subclass (e.g., if it's an *note mboxMessage: 31a8.\ninstance and this is an *note mbox: 13d0. instance), its\nformat-specific information is used.  Otherwise, the\nformat-specific information of the message that currently\ncorresponds to 'key' is left unchanged.\n\n-- Method: iterkeys ()\n\nReturn an *note iterator: 16a9. over all keys\n\n-- Method: keys ()\n\nThe same as *note iterkeys(): 32db, except that a *note list:\n3dc. is returned rather than an *note iterator: 16a9.\n\n-- Method: itervalues ()\n-- Method: iter ()\n\nReturn an *note iterator: 16a9. over representations of all\nmessages.  The messages are represented as instances of the\nappropriate format-specific *note Message: 10c7. subclass\nunless a custom message factory was specified when the\n'Mailbox' instance was initialized.\n\nNote: The behavior of *note iter(): 32de. is unlike\nthat of dictionaries, which iterate over keys.\n\n-- Method: values ()\n\nThe same as *note itervalues(): 32dd, except that a *note\nlist: 3dc. is returned rather than an *note iterator: 16a9.\n\n-- Method: iteritems ()\n\nReturn an *note iterator: 16a9. over ('key', 'message') pairs,\nwhere 'key' is a key and 'message' is a message\nrepresentation.  The messages are represented as instances of\nthe appropriate format-specific *note Message: 10c7. subclass\nunless a custom message factory was specified when the\n'Mailbox' instance was initialized.\n\n-- Method: items ()\n\nThe same as *note iteritems(): 32e0, except that a *note list:\n3dc. of pairs is returned rather than an *note iterator: 16a9.\nof pairs.\n\n-- Method: get (key, default=None)\n-- Method: getitem (key)\n\nReturn a representation of the message corresponding to 'key'.\nIf no such message exists, 'default' is returned if the method\nwas called as *note get(): 32e2. and a *note KeyError: 8cf.\nexception is raised if the method was called as\n'getitem()'.  The message is represented as an instance of\nthe appropriate format-specific *note Message: 10c7. subclass\nunless a custom message factory was specified when the\n'Mailbox' instance was initialized.\n\n-- Method: getmessage (key)\n\nReturn a representation of the message corresponding to 'key'\nas an instance of the appropriate format-specific *note\nMessage: 10c7. subclass, or raise a *note KeyError: 8cf.\nexception if no such message exists.\n\n-- Method: getbytes (key)\n\nReturn a byte representation of the message corresponding to\n'key', or raise a *note KeyError: 8cf. exception if no such\nmessage exists.\n\nNew in version 3.2.\n\n-- Method: getstring (key)\n\nReturn a string representation of the message corresponding to\n'key', or raise a *note KeyError: 8cf. exception if no such\nmessage exists.  The message is processed through *note\nemail.message.Message: ae7. to convert it to a 7bit clean\nrepresentation.\n\n-- Method: getfile (key)\n\nReturn a *note file-like: 229a. representation of the message\ncorresponding to 'key', or raise a *note KeyError: 8cf.\nexception if no such message exists.  The file-like object\nbehaves as if open in binary mode.  This file should be closed\nonce it is no longer needed.\n\nChanged in version 3.2: The file object really is a *note\nbinary file: 1a0c.; previously it was incorrectly returned in\ntext mode.  Also, the *note file-like object: 229a. now\nsupports the *note context manager: 398. protocol: you can use\na *note with: 396. statement to automatically close it.\n\nNote: Unlike other representations of messages, *note\nfile-like: 229a. representations are not necessarily\nindependent of the 'Mailbox' instance that created them\nor of the underlying mailbox.  More specific\ndocumentation is provided by each subclass.\n\n-- Method: contains (key)\n\nReturn 'True' if 'key' corresponds to a message, 'False'\notherwise.\n\n-- Method: len ()\n\nReturn a count of messages in the mailbox.\n\n-- Method: clear ()\n\nDelete all messages from the mailbox.\n\n-- Method: pop (key, default=None)\n\nReturn a representation of the message corresponding to 'key'\nand delete the message.  If no such message exists, return\n'default'.  The message is represented as an instance of the\nappropriate format-specific *note Message: 10c7. subclass\nunless a custom message factory was specified when the\n'Mailbox' instance was initialized.\n\n-- Method: popitem ()\n\nReturn an arbitrary ('key', 'message') pair, where 'key' is a\nkey and 'message' is a message representation, and delete the\ncorresponding message.  If the mailbox is empty, raise a *note\nKeyError: 8cf. exception.  The message is represented as an\ninstance of the appropriate format-specific *note Message:\n10c7. subclass unless a custom message factory was specified\nwhen the 'Mailbox' instance was initialized.\n\n-- Method: update (arg)\n\nParameter 'arg' should be a 'key'-to-'message' mapping or an\niterable of ('key', 'message') pairs.  Updates the mailbox so\nthat, for each given 'key' and 'message', the message\ncorresponding to 'key' is set to 'message' as if by using\n*note setitem(): 32da.  As with *note setitem(): 32da,\neach 'key' must already correspond to a message in the mailbox\nor else a *note KeyError: 8cf. exception will be raised, so in\ngeneral it is incorrect for 'arg' to be a 'Mailbox' instance.\n\nNote: Unlike with dictionaries, keyword arguments are not\nsupported.\n\n-- Method: flush ()\n\nWrite any pending changes to the filesystem.  For some *note\nMailbox: 10c3. subclasses, changes are always written\nimmediately and 'flush()' does nothing, but you should still\nmake a habit of calling this method.\n\n-- Method: lock ()\n\nAcquire an exclusive advisory lock on the mailbox so that\nother processes know not to modify it.  An *note\nExternalClashError: 32ec. is raised if the lock is not\navailable.  The particular locking mechanisms used depend upon\nthe mailbox format.  You should 'always' lock the mailbox\nbefore making any modifications to its contents.\n\n-- Method: unlock ()\n\nRelease the lock on the mailbox, if any.\n\n-- Method: close ()\n\nFlush the mailbox, unlock it if necessary, and close any open\nfiles.  For some 'Mailbox' subclasses, this method does\nnothing.\n\n* Menu:\n\n* Maildir objects::\n* mbox objects::\n* MH objects::\n* Babyl objects::\n* MMDF objects::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Maildir objects,  Next: mbox objects,  Up: Mailbox objects": {
            "content": "5.19.3.2 'Maildir' objects\n..........................\n\n-- Class: mailbox.Maildir (dirname, factory=None, create=True)\n\nA subclass of *note Mailbox: 10c3. for mailboxes in Maildir format.\nParameter 'factory' is a callable object that accepts a file-like\nmessage representation (which behaves as if opened in binary mode)\nand returns a custom representation.  If 'factory' is 'None', *note\nMaildirMessage: 32f0. is used as the default message\nrepresentation.  If 'create' is 'True', the mailbox is created if\nit does not exist.\n\nIf 'create' is 'True' and the 'dirname' path exists, it will be\ntreated as an existing maildir without attempting to verify its\ndirectory layout.\n\nIt is for historical reasons that 'dirname' is named as such rather\nthan 'path'.\n\nMaildir is a directory-based mailbox format invented for the qmail\nmail transfer agent and now widely supported by other programs.\nMessages in a Maildir mailbox are stored in separate files within a\ncommon directory structure.  This design allows Maildir mailboxes\nto be accessed and modified by multiple unrelated programs without\ndata corruption, so file locking is unnecessary.\n\nMaildir mailboxes contain three subdirectories, namely: 'tmp',\n'new', and 'cur'.  Messages are created momentarily in the 'tmp'\nsubdirectory and then moved to the 'new' subdirectory to finalize\ndelivery.  A mail user agent may subsequently move the message to\nthe 'cur' subdirectory and store information about the state of the\nmessage in a special \"info\" section appended to its file name.\n\nFolders of the style introduced by the Courier mail transfer agent\nare also supported.  Any subdirectory of the main mailbox is\nconsidered a folder if ''.'' is the first character in its name.\nFolder names are represented by 'Maildir' without the leading\n''.''.  Each folder is itself a Maildir mailbox but should not\ncontain other folders.  Instead, a logical nesting is indicated\nusing ''.'' to delimit levels, e.g., \"Archived.2005.07\".\n\n-- Attribute: colon\n\nThe Maildir specification requires the use of a colon ('':'')\nin certain message file names.  However, some operating\nsystems do not permit this character in file names, If you\nwish to use a Maildir-like format on such an operating system,\nyou should specify another character to use instead.  The\nexclamation point (''!'') is a popular choice.  For example:\n\nimport mailbox\nmailbox.Maildir.colon = '!'\n\nThe 'colon' attribute may also be set on a per-instance basis.\n\n'Maildir' instances have all of the methods of *note Mailbox: 10c3.\nin addition to the following:\n\n-- Method: listfolders ()\n\nReturn a list of the names of all folders.\n\n-- Method: getfolder (folder)\n\nReturn a 'Maildir' instance representing the folder whose name\nis 'folder'.  A *note NoSuchMailboxError: 32f4. exception is\nraised if the folder does not exist.\n\n-- Method: addfolder (folder)\n\nCreate a folder whose name is 'folder' and return a 'Maildir'\ninstance representing it.\n\n-- Method: removefolder (folder)\n\nDelete the folder whose name is 'folder'.  If the folder\ncontains any messages, a *note NotEmptyError: 32f7. exception\nwill be raised and the folder will not be deleted.\n\n-- Method: clean ()\n\nDelete temporary files from the mailbox that have not been\naccessed in the last 36 hours.  The Maildir specification says\nthat mail-reading programs should do this occasionally.\n\nSome *note Mailbox: 10c3. methods implemented by 'Maildir' deserve\nspecial remarks:\n\n-- Method: add (message)\n-- Method: setitem (key, message)\n-- Method: update (arg)\n\nWarning: These methods generate unique file names based\nupon the current process ID. When using multiple threads,\nundetected name clashes may occur and cause corruption of\nthe mailbox unless threads are coordinated to avoid using\nthese methods to manipulate the same mailbox\nsimultaneously.\n\n-- Method: flush ()\n\nAll changes to Maildir mailboxes are immediately applied, so\nthis method does nothing.\n\n-- Method: lock ()\n-- Method: unlock ()\n\nMaildir mailboxes do not support (or require) locking, so\nthese methods do nothing.\n\n-- Method: close ()\n\n'Maildir' instances do not keep any open files and the\nunderlying mailboxes do not support locking, so this method\ndoes nothing.\n\n-- Method: getfile (key)\n\nDepending upon the host platform, it may not be possible to\nmodify or remove the underlying message while the returned\nfile remains open.\n\nSee also\n........\n\nmaildir man page from Courier(1)\n\nA specification of the format.  Describes a common extension for\nsupporting folders.\n",
            "subsections": []
        },
        "Using maildir format(2)": {
            "content": "Notes on Maildir by its inventor.  Includes an updated\nname-creation scheme and details on \"info\" semantics.\n\n---------- Footnotes ----------\n\n(1) https://www.courier-mta.org/maildir.html\n\n(2) https://cr.yp.to/proto/maildir.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: mbox objects,  Next: MH objects,  Prev: Maildir objects,  Up: Mailbox objects": {
            "content": "5.19.3.3 'mbox' objects\n.......................\n\n-- Class: mailbox.mbox (path, factory=None, create=True)\n\nA subclass of *note Mailbox: 10c3. for mailboxes in mbox format.\nParameter 'factory' is a callable object that accepts a file-like\nmessage representation (which behaves as if opened in binary mode)\nand returns a custom representation.  If 'factory' is 'None', *note\nmboxMessage: 31a8. is used as the default message representation.\nIf 'create' is 'True', the mailbox is created if it does not exist.\n\nThe mbox format is the classic format for storing mail on Unix\nsystems.  All messages in an mbox mailbox are stored in a single\nfile with the beginning of each message indicated by a line whose\nfirst five characters are \"From \".\n\nSeveral variations of the mbox format exist to address perceived\nshortcomings in the original.  In the interest of compatibility,\n'mbox' implements the original format, which is sometimes referred\nto as 'mboxo'.  This means that the 'Content-Length' header, if\npresent, is ignored and that any occurrences of \"From \" at the\nbeginning of a line in a message body are transformed to \">From \"\nwhen storing the message, although occurrences of \">From \" are not\ntransformed to \"From \" when reading the message.\n\nSome *note Mailbox: 10c3. methods implemented by 'mbox' deserve\nspecial remarks:\n\n-- Method: getfile (key)\n\nUsing the file after calling *note flush(): 32eb. or *note\nclose(): 32ed. on the 'mbox' instance may yield unpredictable\nresults or raise an exception.\n\n-- Method: lock ()\n-- Method: unlock ()\n\nThree locking mechanisms are used--dot locking and, if\navailable, the 'flock()' and 'lockf()' system calls.\n\nSee also\n........\n\nmbox man page from tin(1)\n\nA specification of the format, with details on locking.\n",
            "subsections": []
        },
        "Configuring Netscape Mail on Unix: Why The Content-Length Format is Bad(2)": {
            "content": "An argument for using the original mbox format rather than a\nvariation.\n\n\"mbox\" is a family of several mutually incompatible mailbox formats(3)\n\nA history of mbox variations.\n\n---------- Footnotes ----------\n\n(1) http://www.tin.org/bin/man.cgi?section=5&topic=mbox\n\n(2) https://www.jwz.org/doc/content-length.html\n\n(3)\nhttps://www.loc.gov/preservation/digital/formats/fdd/fdd000383.shtml\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: MH objects,  Next: Babyl objects,  Prev: mbox objects,  Up: Mailbox objects": {
            "content": "5.19.3.4 'MH' objects\n.....................\n\n-- Class: mailbox.MH (path, factory=None, create=True)\n\nA subclass of *note Mailbox: 10c3. for mailboxes in MH format.\nParameter 'factory' is a callable object that accepts a file-like\nmessage representation (which behaves as if opened in binary mode)\nand returns a custom representation.  If 'factory' is 'None', *note\nMHMessage: 3309. is used as the default message representation.  If\n'create' is 'True', the mailbox is created if it does not exist.\n\nMH is a directory-based mailbox format invented for the MH Message\nHandling System, a mail user agent.  Each message in an MH mailbox\nresides in its own file.  An MH mailbox may contain other MH\nmailboxes (called 'folders') in addition to messages.  Folders may\nbe nested indefinitely.  MH mailboxes also support 'sequences',\nwhich are named lists used to logically group messages without\nmoving them to sub-folders.  Sequences are defined in a file called\n'.mhsequences' in each folder.\n\nThe 'MH' class manipulates MH mailboxes, but it does not attempt to\nemulate all of 'mh''s behaviors.  In particular, it does not modify\nand is not affected by the 'context' or '.mhprofile' files that\nare used by 'mh' to store its state and configuration.\n\n'MH' instances have all of the methods of *note Mailbox: 10c3. in\naddition to the following:\n\n-- Method: listfolders ()\n\nReturn a list of the names of all folders.\n\n-- Method: getfolder (folder)\n\nReturn an 'MH' instance representing the folder whose name is\n'folder'.  A *note NoSuchMailboxError: 32f4. exception is\nraised if the folder does not exist.\n\n-- Method: addfolder (folder)\n\nCreate a folder whose name is 'folder' and return an 'MH'\ninstance representing it.\n\n-- Method: removefolder (folder)\n\nDelete the folder whose name is 'folder'.  If the folder\ncontains any messages, a *note NotEmptyError: 32f7. exception\nwill be raised and the folder will not be deleted.\n\n-- Method: getsequences ()\n\nReturn a dictionary of sequence names mapped to key lists.  If\nthere are no sequences, the empty dictionary is returned.\n\n-- Method: setsequences (sequences)\n\nRe-define the sequences that exist in the mailbox based upon\n'sequences', a dictionary of names mapped to key lists, like\nreturned by *note getsequences(): 330e.\n\n-- Method: pack ()\n\nRename messages in the mailbox as necessary to eliminate gaps\nin numbering.  Entries in the sequences list are updated\ncorrespondingly.\n\nNote: Already-issued keys are invalidated by this\noperation and should not be subsequently used.\n\nSome *note Mailbox: 10c3. methods implemented by 'MH' deserve\nspecial remarks:\n\n-- Method: remove (key)\n-- Method: delitem (key)\n-- Method: discard (key)\n\nThese methods immediately delete the message.  The MH\nconvention of marking a message for deletion by prepending a\ncomma to its name is not used.\n\n-- Method: lock ()\n-- Method: unlock ()\n\nThree locking mechanisms are used--dot locking and, if\navailable, the 'flock()' and 'lockf()' system calls.  For MH\nmailboxes, locking the mailbox means locking the\n'.mhsequences' file and, only for the duration of any\noperations that affect them, locking individual message files.\n\n-- Method: getfile (key)\n\nDepending upon the host platform, it may not be possible to\nremove the underlying message while the returned file remains\nopen.\n\n-- Method: flush ()\n\nAll changes to MH mailboxes are immediately applied, so this\nmethod does nothing.\n\n-- Method: close ()\n\n'MH' instances do not keep any open files, so this method is\nequivalent to *note unlock(): 3315.\n\nSee also\n........\n\nnmh - Message Handling System(1)\n\nHome page of 'nmh', an updated version of the original 'mh'.\n\nMH & nmh: Email for Users & Programmers(2)\n\nA GPL-licensed book on 'mh' and 'nmh', with some information on the\nmailbox format.\n\n---------- Footnotes ----------\n\n(1) https://www.nongnu.org/nmh/\n\n(2) https://rand-mh.sourceforge.io/book/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Babyl objects,  Next: MMDF objects,  Prev: MH objects,  Up: Mailbox objects": {
            "content": "5.19.3.5 'Babyl' objects\n........................\n\n-- Class: mailbox.Babyl (path, factory=None, create=True)\n\nA subclass of *note Mailbox: 10c3. for mailboxes in Babyl format.\nParameter 'factory' is a callable object that accepts a file-like\nmessage representation (which behaves as if opened in binary mode)\nand returns a custom representation.  If 'factory' is 'None', *note\nBabylMessage: 331c. is used as the default message representation.\nIf 'create' is 'True', the mailbox is created if it does not exist.\n\nBabyl is a single-file mailbox format used by the Rmail mail user\nagent included with Emacs.  The beginning of a message is indicated\nby a line containing the two characters Control-Underscore\n(''\\037'') and Control-L (''\\014'').  The end of a message is\nindicated by the start of the next message or, in the case of the\nlast message, a line containing a Control-Underscore (''\\037'')\ncharacter.\n\nMessages in a Babyl mailbox have two sets of headers, original\nheaders and so-called visible headers.  Visible headers are\ntypically a subset of the original headers that have been\nreformatted or abridged to be more attractive.  Each message in a\nBabyl mailbox also has an accompanying list of 'labels', or short\nstrings that record extra information about the message, and a list\nof all user-defined labels found in the mailbox is kept in the\nBabyl options section.\n\n'Babyl' instances have all of the methods of *note Mailbox: 10c3.\nin addition to the following:\n\n-- Method: getlabels ()\n\nReturn a list of the names of all user-defined labels used in\nthe mailbox.\n\nNote: The actual messages are inspected to determine\nwhich labels exist in the mailbox rather than consulting\nthe list of labels in the Babyl options section, but the\nBabyl section is updated whenever the mailbox is\nmodified.\n\nSome *note Mailbox: 10c3. methods implemented by 'Babyl' deserve\nspecial remarks:\n\n-- Method: getfile (key)\n\nIn Babyl mailboxes, the headers of a message are not stored\ncontiguously with the body of the message.  To generate a\nfile-like representation, the headers and body are copied\ntogether into an *note io.BytesIO: d08. instance, which has an\nAPI identical to that of a file.  As a result, the file-like\nobject is truly independent of the underlying mailbox but does\nnot save memory compared to a string representation.\n\n-- Method: lock ()\n-- Method: unlock ()\n\nThree locking mechanisms are used--dot locking and, if\navailable, the 'flock()' and 'lockf()' system calls.\n\nSee also\n........\n",
            "subsections": []
        },
        "Format of Version 5 Babyl Files(1)": {
            "content": "A specification of the Babyl format.\n",
            "subsections": []
        },
        "Reading Mail with Rmail(2)": {
            "content": "The Rmail manual, with some information on Babyl semantics.\n\n---------- Footnotes ----------\n\n(1) https://quimby.gnus.org/notes/BABYL\n\n(2)\nhttps://www.gnu.org/software/emacs/manual/htmlnode/emacs/Rmail.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: MMDF objects,  Prev: Babyl objects,  Up: Mailbox objects": {
            "content": "5.19.3.6 'MMDF' objects\n.......................\n\n-- Class: mailbox.MMDF (path, factory=None, create=True)\n\nA subclass of *note Mailbox: 10c3. for mailboxes in MMDF format.\nParameter 'factory' is a callable object that accepts a file-like\nmessage representation (which behaves as if opened in binary mode)\nand returns a custom representation.  If 'factory' is 'None', *note\nMMDFMessage: 3323. is used as the default message representation.\nIf 'create' is 'True', the mailbox is created if it does not exist.\n\nMMDF is a single-file mailbox format invented for the Multichannel\nMemorandum Distribution Facility, a mail transfer agent.  Each\nmessage is in the same form as an mbox message but is bracketed\nbefore and after by lines containing four Control-A (''\\001'')\ncharacters.  As with the mbox format, the beginning of each message\nis indicated by a line whose first five characters are \"From \", but\nadditional occurrences of \"From \" are not transformed to \">From \"\nwhen storing messages because the extra message separator lines\nprevent mistaking such occurrences for the starts of subsequent\nmessages.\n\nSome *note Mailbox: 10c3. methods implemented by 'MMDF' deserve\nspecial remarks:\n\n-- Method: getfile (key)\n\nUsing the file after calling *note flush(): 32eb. or *note\nclose(): 32ed. on the 'MMDF' instance may yield unpredictable\nresults or raise an exception.\n\n-- Method: lock ()\n-- Method: unlock ()\n\nThree locking mechanisms are used--dot locking and, if\navailable, the 'flock()' and 'lockf()' system calls.\n\nSee also\n........\n\nmmdf man page from tin(1)\n\nA specification of MMDF format from the documentation of tin, a\nnewsreader.\n\nMMDF(2)\n\nA Wikipedia article describing the Multichannel Memorandum\nDistribution Facility.\n\n---------- Footnotes ----------\n\n(1) http://www.tin.org/bin/man.cgi?section=5&topic=mmdf\n\n(2) https://en.wikipedia.org/wiki/MMDF\n\nFile: python3.12.info,  Node: Message objects,  Next: Exceptions<16>,  Prev: Mailbox objects,  Up: mailbox -- Manipulate mailboxes in various formats\n\n5.19.3.7 'Message' objects\n..........................\n\n-- Class: mailbox.Message (message=None)\n\nA subclass of the *note email.message: 40. module's *note Message:\nae7.  Subclasses of 'mailbox.Message' add mailbox-format-specific\nstate and behavior.\n\nIf 'message' is omitted, the new instance is created in a default,\nempty state.  If 'message' is an *note email.message.Message: ae7.\ninstance, its contents are copied; furthermore, any format-specific\ninformation is converted insofar as possible if 'message' is a\n'Message' instance.  If 'message' is a string, a byte string, or a\nfile, it should contain an RFC 2822(1)-compliant message, which is\nread and parsed.  Files should be open in binary mode, but text\nmode files are accepted for backward compatibility.\n\nThe format-specific state and behaviors offered by subclasses vary,\nbut in general it is only the properties that are not specific to a\nparticular mailbox that are supported (although presumably the\nproperties are specific to a particular mailbox format).  For\nexample, file offsets for single-file mailbox formats and file\nnames for directory-based mailbox formats are not retained, because\nthey are only applicable to the original mailbox.  But state such\nas whether a message has been read by the user or marked as\nimportant is retained, because it applies to the message itself.\n\nThere is no requirement that 'Message' instances be used to\nrepresent messages retrieved using *note Mailbox: 10c3. instances.\nIn some situations, the time and memory required to generate\n'Message' representations might not be acceptable.  For such\nsituations, 'Mailbox' instances also offer string and file-like\nrepresentations, and a custom message factory may be specified when\na 'Mailbox' instance is initialized.\n\n* Menu:\n\n* MaildirMessage objects::\n* mboxMessage objects::\n* MHMessage objects::\n* BabylMessage objects::\n* MMDFMessage objects::\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc2822.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: MaildirMessage objects,  Next: mboxMessage objects,  Up: Message objects": {
            "content": "5.19.3.8 'MaildirMessage' objects\n.................................\n\n-- Class: mailbox.MaildirMessage (message=None)\n\nA message with Maildir-specific behaviors.  Parameter 'message' has\nthe same meaning as with the *note Message: 10c7. constructor.\n\nTypically, a mail user agent application moves all of the messages\nin the 'new' subdirectory to the 'cur' subdirectory after the first\ntime the user opens and closes the mailbox, recording that the\nmessages are old whether or not they've actually been read.  Each\nmessage in 'cur' has an \"info\" section added to its file name to\nstore information about its state.  (Some mail readers may also add\nan \"info\" section to messages in 'new'.)  The \"info\" section may\ntake one of two forms: it may contain \"2,\" followed by a list of\nstandardized flags (e.g., \"2,FR\") or it may contain \"1,\" followed\nby so-called experimental information.  Standard flags for Maildir\nmessages are as follows:\n\nFlag       Meaning       Explanation\n\n--------------------------------------------------------------\n\nD          Draft         Under composition\n\n\nF          Flagged       Marked as important\n\n\nP          Passed        Forwarded, resent, or bounced\n\n\nR          Replied       Replied to\n\n\nS          Seen          Read\n\n\nT          Trashed       Marked for subsequent deletion\n\n\n'MaildirMessage' instances offer the following methods:\n\n-- Method: getsubdir ()\n\nReturn either \"new\" (if the message should be stored in the\n'new' subdirectory) or \"cur\" (if the message should be stored\nin the 'cur' subdirectory).\n\nNote: A message is typically moved from 'new' to 'cur'\nafter its mailbox has been accessed, whether or not the\nmessage is has been read.  A message 'msg' has been read\nif '\"S\" in msg.getflags()' is 'True'.\n\n-- Method: setsubdir (subdir)\n\nSet the subdirectory the message should be stored in.\nParameter 'subdir' must be either \"new\" or \"cur\".\n\n-- Method: getflags ()\n\nReturn a string specifying the flags that are currently set.\nIf the message complies with the standard Maildir format, the\nresult is the concatenation in alphabetical order of zero or\none occurrence of each of ''D'', ''F'', ''P'', ''R'', ''S'',\nand ''T''.  The empty string is returned if no flags are set\nor if \"info\" contains experimental semantics.\n\n-- Method: setflags (flags)\n\nSet the flags specified by 'flags' and unset all others.\n\n-- Method: addflag (flag)\n\nSet the flag(s) specified by 'flag' without changing other\nflags.  To add more than one flag at a time, 'flag' may be a\nstring of more than one character.  The current \"info\" is\noverwritten whether or not it contains experimental\ninformation rather than flags.\n\n-- Method: removeflag (flag)\n\nUnset the flag(s) specified by 'flag' without changing other\nflags.  To remove more than one flag at a time, 'flag' maybe a\nstring of more than one character.  If \"info\" contains\nexperimental information rather than flags, the current \"info\"\nis not modified.\n\n-- Method: getdate ()\n\nReturn the delivery date of the message as a floating-point\nnumber representing seconds since the epoch.\n\n-- Method: setdate (date)\n\nSet the delivery date of the message to 'date', a\nfloating-point number representing seconds since the epoch.\n\n-- Method: getinfo ()\n\nReturn a string containing the \"info\" for a message.  This is\nuseful for accessing and modifying \"info\" that is experimental\n(i.e., not a list of flags).\n\n-- Method: setinfo (info)\n\nSet \"info\" to 'info', which should be a string.\n\nWhen a 'MaildirMessage' instance is created based upon an *note\nmboxMessage: 31a8. or *note MMDFMessage: 3323. instance, the 'Status'\nand 'X-Status' headers are omitted and the following conversions take\nplace:\n\nResulting state          *note mboxMessage: 31a8. or\n*note MMDFMessage: 3323. state\n\n----------------------------------------------------------------------------\n\n\"cur\" subdirectory       O flag\n\n\nF flag                   F flag\n\n\nR flag                   A flag\n\n\nS flag                   R flag\n\n\nT flag                   D flag\n\n\nWhen a 'MaildirMessage' instance is created based upon an *note\nMHMessage: 3309. instance, the following conversions take place:\n\nResulting state                     *note MHMessage: 3309. state\n\n-------------------------------------------------------------------\n\n\"cur\" subdirectory                  \"unseen\" sequence\n\n\n\"cur\" subdirectory and S flag       no \"unseen\" sequence\n\n\nF flag                              \"flagged\" sequence\n\n\nR flag                              \"replied\" sequence\n\n\nWhen a 'MaildirMessage' instance is created based upon a *note\nBabylMessage: 331c. instance, the following conversions take place:\n\nResulting state                     *note BabylMessage: 331c. state\n\n------------------------------------------------------------------------\n\n\"cur\" subdirectory                  \"unseen\" label\n\n\n\"cur\" subdirectory and S flag       no \"unseen\" label\n\n\nP flag                              \"forwarded\" or \"resent\" label\n\n\nR flag                              \"answered\" label\n\n\nT flag                              \"deleted\" label\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: mboxMessage objects,  Next: MHMessage objects,  Prev: MaildirMessage objects,  Up: Message objects": {
            "content": "5.19.3.9 'mboxMessage' objects\n..............................\n\n-- Class: mailbox.mboxMessage (message=None)\n\nA message with mbox-specific behaviors.  Parameter 'message' has\nthe same meaning as with the *note Message: 10c7. constructor.\n\nMessages in an mbox mailbox are stored together in a single file.\nThe sender's envelope address and the time of delivery are\ntypically stored in a line beginning with \"From \" that is used to\nindicate the start of a message, though there is considerable\nvariation in the exact format of this data among mbox\nimplementations.  Flags that indicate the state of the message,\nsuch as whether it has been read or marked as important, are\ntypically stored in 'Status' and 'X-Status' headers.\n\nConventional flags for mbox messages are as follows:\n\nFlag       Meaning        Explanation\n\n---------------------------------------------------------------\n\nR          Read           Read\n\n\nO          Old            Previously detected by MUA\n\n\nD          Deleted        Marked for subsequent deletion\n\n\nF          Flagged        Marked as important\n\n\nA          Answered       Replied to\n\n\nThe \"R\" and \"O\" flags are stored in the 'Status' header, and the\n\"D\", \"F\", and \"A\" flags are stored in the 'X-Status' header.  The\nflags and headers typically appear in the order mentioned.\n\n'mboxMessage' instances offer the following methods:\n\n-- Method: getfrom ()\n\nReturn a string representing the \"From \" line that marks the\nstart of the message in an mbox mailbox.  The leading \"From \"\nand the trailing newline are excluded.\n\n-- Method: setfrom (from, time=None)\n\nSet the \"From \" line to 'from', which should be specified\nwithout a leading \"From \" or trailing newline.  For\nconvenience, 'time' may be specified and will be formatted\nappropriately and appended to 'from'.  If 'time' is\nspecified, it should be a *note time.structtime: b3a.\ninstance, a tuple suitable for passing to *note\ntime.strftime(): 105d, or 'True' (to use *note time.gmtime():\n1034.).\n\n-- Method: getflags ()\n\nReturn a string specifying the flags that are currently set.\nIf the message complies with the conventional format, the\nresult is the concatenation in the following order of zero or\none occurrence of each of ''R'', ''O'', ''D'', ''F'', and\n''A''.\n\n-- Method: setflags (flags)\n\nSet the flags specified by 'flags' and unset all others.\nParameter 'flags' should be the concatenation in any order of\nzero or more occurrences of each of ''R'', ''O'', ''D'',\n''F'', and ''A''.\n\n-- Method: addflag (flag)\n\nSet the flag(s) specified by 'flag' without changing other\nflags.  To add more than one flag at a time, 'flag' may be a\nstring of more than one character.\n\n-- Method: removeflag (flag)\n\nUnset the flag(s) specified by 'flag' without changing other\nflags.  To remove more than one flag at a time, 'flag' maybe a\nstring of more than one character.\n\nWhen an 'mboxMessage' instance is created based upon a *note\nMaildirMessage: 32f0. instance, a \"From \" line is generated based upon\nthe *note MaildirMessage: 32f0. instance's delivery date, and the\nfollowing conversions take place:\n\nResulting state       *note MaildirMessage: 32f0. state\n\n----------------------------------------------------------\n\nR flag                S flag\n\n\nO flag                \"cur\" subdirectory\n\n\nD flag                T flag\n\n\nF flag                F flag\n\n\nA flag                R flag\n\n\nWhen an 'mboxMessage' instance is created based upon an *note MHMessage:\n3309. instance, the following conversions take place:\n\nResulting state         *note MHMessage: 3309. state\n\n-------------------------------------------------------\n\nR flag and O flag       no \"unseen\" sequence\n\n\nO flag                  \"unseen\" sequence\n\n\nF flag                  \"flagged\" sequence\n\n\nA flag                  \"replied\" sequence\n\n\nWhen an 'mboxMessage' instance is created based upon a *note\nBabylMessage: 331c. instance, the following conversions take place:\n\nResulting state         *note BabylMessage: 331c. state\n\n----------------------------------------------------------\n\nR flag and O flag       no \"unseen\" label\n\n\nO flag                  \"unseen\" label\n\n\nD flag                  \"deleted\" label\n\n\nA flag                  \"answered\" label\n\n\nWhen a 'mboxMessage' instance is created based upon an *note\nMMDFMessage: 3323. instance, the \"From \" line is copied and all flags\ndirectly correspond:\n\nResulting state       *note MMDFMessage: 3323. state\n\n-------------------------------------------------------\n\nR flag                R flag\n\n\nO flag                O flag\n\n\nD flag                D flag\n\n\nF flag                F flag\n\n\nA flag                A flag\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: MHMessage objects,  Next: BabylMessage objects,  Prev: mboxMessage objects,  Up: Message objects": {
            "content": "5.19.3.10 'MHMessage' objects\n.............................\n\n-- Class: mailbox.MHMessage (message=None)\n\nA message with MH-specific behaviors.  Parameter 'message' has the\nsame meaning as with the *note Message: 10c7. constructor.\n\nMH messages do not support marks or flags in the traditional sense,\nbut they do support sequences, which are logical groupings of\narbitrary messages.  Some mail reading programs (although not the\nstandard 'mh' and 'nmh') use sequences in much the same way flags\nare used with other formats, as follows:\n\nSequence       Explanation\n\n--------------------------------------------------------------\n\nunseen         Not read, but previously detected by MUA\n\n\nreplied        Replied to\n\n\nflagged        Marked as important\n\n\n'MHMessage' instances offer the following methods:\n\n-- Method: getsequences ()\n\nReturn a list of the names of sequences that include this\nmessage.\n\n-- Method: setsequences (sequences)\n\nSet the list of sequences that include this message.\n\n-- Method: addsequence (sequence)\n\nAdd 'sequence' to the list of sequences that include this\nmessage.\n\n-- Method: removesequence (sequence)\n\nRemove 'sequence' from the list of sequences that include this\nmessage.\n\nWhen an 'MHMessage' instance is created based upon a *note\nMaildirMessage: 32f0. instance, the following conversions take place:\n\nResulting state          *note MaildirMessage: 32f0. state\n\n-------------------------------------------------------------\n\n\"unseen\" sequence        no S flag\n\n\n\"replied\" sequence       R flag\n\n\n\"flagged\" sequence       F flag\n\n\nWhen an 'MHMessage' instance is created based upon an *note mboxMessage:\n31a8. or *note MMDFMessage: 3323. instance, the 'Status' and 'X-Status'\nheaders are omitted and the following conversions take place:\n\nResulting state          *note mboxMessage: 31a8. or\n*note MMDFMessage: 3323. state\n\n----------------------------------------------------------------------------\n\n\"unseen\" sequence        no R flag\n\n\n\"replied\" sequence       A flag\n\n\n\"flagged\" sequence       F flag\n\n\nWhen an 'MHMessage' instance is created based upon a *note BabylMessage:\n331c. instance, the following conversions take place:\n\nResulting state          *note BabylMessage: 331c. state\n\n-----------------------------------------------------------\n\n\"unseen\" sequence        \"unseen\" label\n\n\n\"replied\" sequence       \"answered\" label\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: BabylMessage objects,  Next: MMDFMessage objects,  Prev: MHMessage objects,  Up: Message objects": {
            "content": "5.19.3.11 'BabylMessage' objects\n................................\n\n-- Class: mailbox.BabylMessage (message=None)\n\nA message with Babyl-specific behaviors.  Parameter 'message' has\nthe same meaning as with the *note Message: 10c7. constructor.\n\nCertain message labels, called 'attributes', are defined by\nconvention to have special meanings.  The attributes are as\nfollows:\n\nLabel           Explanation\n\n---------------------------------------------------------------\n\nunseen          Not read, but previously detected by MUA\n\n\ndeleted         Marked for subsequent deletion\n\n\nfiled           Copied to another file or mailbox\n\n\nanswered        Replied to\n\n\nforwarded       Forwarded\n\n\nedited          Modified by the user\n\n\nresent          Resent\n\n\nBy default, Rmail displays only visible headers.  The\n'BabylMessage' class, though, uses the original headers because\nthey are more complete.  Visible headers may be accessed explicitly\nif desired.\n\n'BabylMessage' instances offer the following methods:\n\n-- Method: getlabels ()\n\nReturn a list of labels on the message.\n\n-- Method: setlabels (labels)\n\nSet the list of labels on the message to 'labels'.\n\n-- Method: addlabel (label)\n\nAdd 'label' to the list of labels on the message.\n\n-- Method: removelabel (label)\n\nRemove 'label' from the list of labels on the message.\n\n-- Method: getvisible ()\n\nReturn an *note Message: 10c7. instance whose headers are the\nmessage's visible headers and whose body is empty.\n\n-- Method: setvisible (visible)\n\nSet the message's visible headers to be the same as the\nheaders in 'message'.  Parameter 'visible' should be a *note\nMessage: 10c7. instance, an *note email.message.Message: ae7.\ninstance, a string, or a file-like object (which should be\nopen in text mode).\n\n-- Method: updatevisible ()\n\nWhen a 'BabylMessage' instance's original headers are\nmodified, the visible headers are not automatically modified\nto correspond.  This method updates the visible headers as\nfollows: each visible header with a corresponding original\nheader is set to the value of the original header, each\nvisible header without a corresponding original header is\nremoved, and any of 'Date', 'From', 'Reply-To', 'To', 'CC',\nand 'Subject' that are present in the original headers but not\nthe visible headers are added to the visible headers.\n\nWhen a 'BabylMessage' instance is created based upon a *note\nMaildirMessage: 32f0. instance, the following conversions take place:\n\nResulting state         *note MaildirMessage: 32f0. state\n\n------------------------------------------------------------\n\n\"unseen\" label          no S flag\n\n\n\"deleted\" label         T flag\n\n\n\"answered\" label        R flag\n\n\n\"forwarded\" label       P flag\n\n\nWhen a 'BabylMessage' instance is created based upon an *note\nmboxMessage: 31a8. or *note MMDFMessage: 3323. instance, the 'Status'\nand 'X-Status' headers are omitted and the following conversions take\nplace:\n\nResulting state        *note mboxMessage: 31a8. or\n*note MMDFMessage: 3323. state\n\n--------------------------------------------------------------------------\n\n\"unseen\" label         no R flag\n\n\n\"deleted\" label        D flag\n\n\n\"answered\" label       A flag\n\n\nWhen a 'BabylMessage' instance is created based upon an *note MHMessage:\n3309. instance, the following conversions take place:\n\nResulting state        *note MHMessage: 3309. state\n\n------------------------------------------------------\n\n\"unseen\" label         \"unseen\" sequence\n\n\n\"answered\" label       \"replied\" sequence\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: MMDFMessage objects,  Prev: BabylMessage objects,  Up: Message objects": {
            "content": "5.19.3.12 'MMDFMessage' objects\n...............................\n\n-- Class: mailbox.MMDFMessage (message=None)\n\nA message with MMDF-specific behaviors.  Parameter 'message' has\nthe same meaning as with the *note Message: 10c7. constructor.\n\nAs with message in an mbox mailbox, MMDF messages are stored with\nthe sender's address and the delivery date in an initial line\nbeginning with \"From \".  Likewise, flags that indicate the state of\nthe message are typically stored in 'Status' and 'X-Status'\nheaders.\n\nConventional flags for MMDF messages are identical to those of mbox\nmessage and are as follows:\n\nFlag       Meaning        Explanation\n\n---------------------------------------------------------------\n\nR          Read           Read\n\n\nO          Old            Previously detected by MUA\n\n\nD          Deleted        Marked for subsequent deletion\n\n\nF          Flagged        Marked as important\n\n\nA          Answered       Replied to\n\n\nThe \"R\" and \"O\" flags are stored in the 'Status' header, and the\n\"D\", \"F\", and \"A\" flags are stored in the 'X-Status' header.  The\nflags and headers typically appear in the order mentioned.\n\n'MMDFMessage' instances offer the following methods, which are\nidentical to those offered by *note mboxMessage: 31a8.:\n\n-- Method: getfrom ()\n\nReturn a string representing the \"From \" line that marks the\nstart of the message in an mbox mailbox.  The leading \"From \"\nand the trailing newline are excluded.\n\n-- Method: setfrom (from, time=None)\n\nSet the \"From \" line to 'from', which should be specified\nwithout a leading \"From \" or trailing newline.  For\nconvenience, 'time' may be specified and will be formatted\nappropriately and appended to 'from'.  If 'time' is\nspecified, it should be a *note time.structtime: b3a.\ninstance, a tuple suitable for passing to *note\ntime.strftime(): 105d, or 'True' (to use *note time.gmtime():\n1034.).\n\n-- Method: getflags ()\n\nReturn a string specifying the flags that are currently set.\nIf the message complies with the conventional format, the\nresult is the concatenation in the following order of zero or\none occurrence of each of ''R'', ''O'', ''D'', ''F'', and\n''A''.\n\n-- Method: setflags (flags)\n\nSet the flags specified by 'flags' and unset all others.\nParameter 'flags' should be the concatenation in any order of\nzero or more occurrences of each of ''R'', ''O'', ''D'',\n''F'', and ''A''.\n\n-- Method: addflag (flag)\n\nSet the flag(s) specified by 'flag' without changing other\nflags.  To add more than one flag at a time, 'flag' may be a\nstring of more than one character.\n\n-- Method: removeflag (flag)\n\nUnset the flag(s) specified by 'flag' without changing other\nflags.  To remove more than one flag at a time, 'flag' maybe a\nstring of more than one character.\n\nWhen an 'MMDFMessage' instance is created based upon a *note\nMaildirMessage: 32f0. instance, a \"From \" line is generated based upon\nthe *note MaildirMessage: 32f0. instance's delivery date, and the\nfollowing conversions take place:\n\nResulting state       *note MaildirMessage: 32f0. state\n\n----------------------------------------------------------\n\nR flag                S flag\n\n\nO flag                \"cur\" subdirectory\n\n\nD flag                T flag\n\n\nF flag                F flag\n\n\nA flag                R flag\n\n\nWhen an 'MMDFMessage' instance is created based upon an *note MHMessage:\n3309. instance, the following conversions take place:\n\nResulting state         *note MHMessage: 3309. state\n\n-------------------------------------------------------\n\nR flag and O flag       no \"unseen\" sequence\n\n\nO flag                  \"unseen\" sequence\n\n\nF flag                  \"flagged\" sequence\n\n\nA flag                  \"replied\" sequence\n\n\nWhen an 'MMDFMessage' instance is created based upon a *note\nBabylMessage: 331c. instance, the following conversions take place:\n\nResulting state         *note BabylMessage: 331c. state\n\n----------------------------------------------------------\n\nR flag and O flag       no \"unseen\" label\n\n\nO flag                  \"unseen\" label\n\n\nD flag                  \"deleted\" label\n\n\nA flag                  \"answered\" label\n\n\nWhen an 'MMDFMessage' instance is created based upon an *note\nmboxMessage: 31a8. instance, the \"From \" line is copied and all flags\ndirectly correspond:\n\nResulting state       *note mboxMessage: 31a8. state\n\n-------------------------------------------------------\n\nR flag                R flag\n\n\nO flag                O flag\n\n\nD flag                D flag\n\n\nF flag                F flag\n\n\nA flag                A flag\n\n\nFile: python3.12.info,  Node: Exceptions<16>,  Next: Examples<22>,  Prev: Message objects,  Up: mailbox -- Manipulate mailboxes in various formats\n\n5.19.3.13 Exceptions\n....................\n\nThe following exception classes are defined in the 'mailbox' module:\n\n-- Exception: mailbox.Error\n\nThe based class for all other module-specific exceptions.\n\n-- Exception: mailbox.NoSuchMailboxError\n\nRaised when a mailbox is expected but is not found, such as when\ninstantiating a *note Mailbox: 10c3. subclass with a path that does\nnot exist (and with the 'create' parameter set to 'False'), or when\nopening a folder that does not exist.\n\n-- Exception: mailbox.NotEmptyError\n\nRaised when a mailbox is not empty but is expected to be, such as\nwhen deleting a folder that contains messages.\n\n-- Exception: mailbox.ExternalClashError\n\nRaised when some mailbox-related condition beyond the control of\nthe program causes it to be unable to proceed, such as when failing\nto acquire a lock that another program already holds a lock, or\nwhen a uniquely generated file name already exists.\n\n-- Exception: mailbox.FormatError\n\nRaised when the data in a file cannot be parsed, such as when an\n*note MH: 3308. instance attempts to read a corrupted\n'.mhsequences' file.\n\nFile: python3.12.info,  Node: Examples<22>,  Prev: Exceptions<16>,  Up: mailbox -- Manipulate mailboxes in various formats\n\n5.19.3.14 Examples\n..................\n\nA simple example of printing the subjects of all messages in a mailbox\nthat seem interesting:\n\nimport mailbox\nfor message in mailbox.mbox('~/mbox'):\nsubject = message['subject']       # Could possibly be None.\nif subject and 'python' in subject.lower():\nprint(subject)\n",
            "subsections": []
        },
        "To copy all mail from a Babyl mailbox to an MH mailbox, converting all": {
            "content": "of the format-specific information that can be converted:\n\nimport mailbox\ndestination = mailbox.MH('~/Mail')\ndestination.lock()\nfor message in mailbox.Babyl('~/RMAIL'):\ndestination.add(mailbox.MHMessage(message))\ndestination.flush()\ndestination.unlock()\n",
            "subsections": []
        },
        "This example sorts mail from several mailing lists into different": {
            "content": "mailboxes, being careful to avoid mail corruption due to concurrent\nmodification by other programs, mail loss due to interruption of the\nprogram, or premature termination due to malformed messages in the\nmailbox:\n\nimport mailbox\nimport email.errors\n\nlistnames = ('python-list', 'python-dev', 'python-bugs')\n\nboxes = {name: mailbox.mbox('~/email/%s' % name) for name in listnames}\ninbox = mailbox.Maildir('~/Maildir', factory=None)\n\nfor key in inbox.iterkeys():\ntry:\nmessage = inbox[key]\nexcept email.errors.MessageParseError:\ncontinue                # The message is malformed. Just leave it.\n\nfor name in listnames:\nlistid = message['list-id']\nif listid and name in listid:\n# Get mailbox to use\nbox = boxes[name]\n\n# Write copy to disk before removing original.\n# If there's a crash, you might duplicate a message, but\n# that's better than losing a message completely.\nbox.lock()\nbox.add(message)\nbox.flush()\nbox.unlock()\n\n# Remove original message\ninbox.lock()\ninbox.discard(key)\ninbox.flush()\ninbox.unlock()\nbreak               # Found destination, so stop looking.\n\nfor box in boxes.itervalues():\nbox.close()\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: mimetypes -- Map filenames to MIME types,  Next: base64 -- Base16 Base32 Base64 Base85 Data Encodings,  Prev: mailbox -- Manipulate mailboxes in various formats,  Up: Internet Data Handling": {
            "content": "'Source code:' Lib/mimetypes.py(1)\n\n\n\nThe *note mimetypes: 8a. module converts between a filename or URL and\nthe MIME type associated with the filename extension.  Conversions are\nprovided from filename to MIME type and from MIME type to filename\nextension; encodings are not supported for the latter conversion.\n\nThe module provides one class and a number of convenience functions.",
            "subsections": []
        },
        "The functions are the normal interface to this module, but some": {
            "content": "applications may be interested in the class as well.\n",
            "subsections": []
        },
        "The functions described below provide the primary interface for this": {
            "content": "module.  If the module has not been initialized, they will call *note\ninit(): 335b. if they rely on the information *note init(): 335b. sets\nup.\n\n-- Function: mimetypes.guesstype (url, strict=True)\n\nGuess the type of a file based on its filename, path or URL, given\nby 'url'.  URL can be a string or a *note path-like object: 957.\n\nThe return value is a tuple '(type, encoding)' where 'type' is\n'None' if the type can't be guessed (missing or unknown suffix) or\na string of the form ''type/subtype'', usable for a MIME\n'content-type' header.\n\n'encoding' is 'None' for no encoding or the name of the program\nused to encode (e.g.  'compress' or 'gzip').  The encoding is\nsuitable for use as a 'Content-Encoding' header, 'not' as a\n'Content-Transfer-Encoding' header.  The mappings are table driven.\nEncoding suffixes are case sensitive; type suffixes are first tried\ncase sensitively, then case insensitively.\n\nThe optional 'strict' argument is a flag specifying whether the\nlist of known MIME types is limited to only the official types\nregistered with IANA(2). When 'strict' is 'True' (the default),\nonly the IANA types are supported; when 'strict' is 'False', some\nadditional non-standard but commonly used MIME types are also\nrecognized.\n\nChanged in version 3.8: Added support for url being a *note\npath-like object: 957.\n\n-- Function: mimetypes.guessallextensions (type, strict=True)\n\nGuess the extensions for a file based on its MIME type, given by\n'type'.  The return value is a list of strings giving all possible\nfilename extensions, including the leading dot (''.'').  The\nextensions are not guaranteed to have been associated with any\nparticular data stream, but would be mapped to the MIME type 'type'\nby *note guesstype(): 13b9.\n\nThe optional 'strict' argument has the same meaning as with the\n*note guesstype(): 13b9. function.\n\n-- Function: mimetypes.guessextension (type, strict=True)\n\nGuess the extension for a file based on its MIME type, given by\n'type'.  The return value is a string giving a filename extension,\nincluding the leading dot (''.'').  The extension is not guaranteed\nto have been associated with any particular data stream, but would\nbe mapped to the MIME type 'type' by *note guesstype(): 13b9.  If\nno extension can be guessed for 'type', 'None' is returned.\n\nThe optional 'strict' argument has the same meaning as with the\n*note guesstype(): 13b9. function.\n",
            "subsections": []
        },
        "Some additional functions and data items are available for controlling": {
            "content": "the behavior of the module.\n\n-- Function: mimetypes.init (files=None)\n\nInitialize the internal data structures.  If given, 'files' must be\na sequence of file names which should be used to augment the\ndefault type map.  If omitted, the file names to use are taken from\n*note knownfiles: 335d.; on Windows, the current registry settings\nare loaded.  Each file named in 'files' or *note knownfiles: 335d.\ntakes precedence over those named before it.  Calling *note init():\n335b. repeatedly is allowed.\n\nSpecifying an empty list for 'files' will prevent the system\ndefaults from being applied: only the well-known values will be\npresent from a built-in list.\n\nIf 'files' is 'None' the internal data structure is completely\nrebuilt to its initial default value.  This is a stable operation\nand will produce the same results when called multiple times.\n\nChanged in version 3.2: Previously, Windows registry settings were\nignored.\n\n-- Function: mimetypes.readmimetypes (filename)\n\nLoad the type map given in the file 'filename', if it exists.  The\ntype map is returned as a dictionary mapping filename extensions,\nincluding the leading dot (''.''), to strings of the form\n''type/subtype''.  If the file 'filename' does not exist or cannot\nbe read, 'None' is returned.\n\n-- Function: mimetypes.addtype (type, ext, strict=True)\n\nAdd a mapping from the MIME type 'type' to the extension 'ext'.\nWhen the extension is already known, the new type will replace the\nold one.  When the type is already known the extension will be\nadded to the list of known extensions.\n\nWhen 'strict' is 'True' (the default), the mapping will be added to\nthe official MIME types, otherwise to the non-standard ones.\n\n-- Data: mimetypes.inited\n\nFlag indicating whether or not the global data structures have been\ninitialized.  This is set to 'True' by *note init(): 335b.\n\n-- Data: mimetypes.knownfiles\n\nList of type map file names commonly installed.  These files are\ntypically named 'mime.types' and are installed in different\nlocations by different packages.\n\n-- Data: mimetypes.suffixmap\n\nDictionary mapping suffixes to suffixes.  This is used to allow\nrecognition of encoded files for which the encoding and the type\nare indicated by the same extension.  For example, the '.tgz'\nextension is mapped to '.tar.gz' to allow the encoding and type to\nbe recognized separately.\n\n-- Data: mimetypes.encodingsmap\n\nDictionary mapping filename extensions to encoding types.\n\n-- Data: mimetypes.typesmap\n\nDictionary mapping filename extensions to MIME types.\n\n-- Data: mimetypes.commontypes\n\nDictionary mapping filename extensions to non-standard, but\ncommonly found MIME types.\n\nAn example usage of the module:\n\n>>> import mimetypes\n>>> mimetypes.init()\n>>> mimetypes.knownfiles\n['/etc/mime.types', '/etc/httpd/mime.types', ... ]\n>>> mimetypes.suffixmap['.tgz']\n'.tar.gz'\n>>> mimetypes.encodingsmap['.gz']\n'gzip'\n>>> mimetypes.typesmap['.tgz']\n'application/x-tar-gz'\n\n* Menu:\n\n* MimeTypes Objects::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/mimetypes.py\n\n(2) https://www.iana.org/assignments/media-types/media-types.xhtml\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: MimeTypes Objects,  Up: mimetypes -- Map filenames to MIME types": {
            "content": "5.19.4.1 MimeTypes Objects\n..........................\n\nThe *note MimeTypes: 1355. class may be useful for applications which\nmay want more than one MIME-type database; it provides an interface\nsimilar to the one of the *note mimetypes: 8a. module.\n\n-- Class: mimetypes.MimeTypes (filenames=(), strict=True)\n\nThis class represents a MIME-types database.  By default, it\nprovides access to the same database as the rest of this module.\nThe initial database is a copy of that provided by the module, and\nmay be extended by loading additional 'mime.types'-style files into\nthe database using the *note read(): 3366. or *note readfp(): 3367.\nmethods.  The mapping dictionaries may also be cleared before\nloading additional data if the default data is not desired.\n\nThe optional 'filenames' parameter can be used to cause additional\nfiles to be loaded \"on top\" of the default database.\n\n-- Attribute: suffixmap\n\nDictionary mapping suffixes to suffixes.  This is used to\nallow recognition of encoded files for which the encoding and\nthe type are indicated by the same extension.  For example,\nthe '.tgz' extension is mapped to '.tar.gz' to allow the\nencoding and type to be recognized separately.  This is\ninitially a copy of the global *note suffixmap: 3360. defined\nin the module.\n\n-- Attribute: encodingsmap\n\nDictionary mapping filename extensions to encoding types.\nThis is initially a copy of the global *note encodingsmap:\n3361. defined in the module.\n\n-- Attribute: typesmap\n\nTuple containing two dictionaries, mapping filename extensions\nto MIME types: the first dictionary is for the non-standards\ntypes and the second one is for the standard types.  They are\ninitialized by *note commontypes: 3363. and *note typesmap:\n3362.\n\n-- Attribute: typesmapinv\n\nTuple containing two dictionaries, mapping MIME types to a\nlist of filename extensions: the first dictionary is for the\nnon-standards types and the second one is for the standard\ntypes.  They are initialized by *note commontypes: 3363. and\n*note typesmap: 3362.\n\n-- Method: guessextension (type, strict=True)\n\nSimilar to the *note guessextension(): 335c. function, using\nthe tables stored as part of the object.\n\n-- Method: guesstype (url, strict=True)\n\nSimilar to the *note guesstype(): 13b9. function, using the\ntables stored as part of the object.\n\n-- Method: guessallextensions (type, strict=True)\n\nSimilar to the *note guessallextensions(): 15f7. function,\nusing the tables stored as part of the object.\n\n-- Method: read (filename, strict=True)\n\nLoad MIME information from a file named 'filename'.  This uses\n*note readfp(): 3367. to parse the file.\n\nIf 'strict' is 'True', information will be added to list of\nstandard types, else to the list of non-standard types.\n\n-- Method: readfp (fp, strict=True)\n\nLoad MIME type information from an open file 'fp'.  The file\nmust have the format of the standard 'mime.types' files.\n\nIf 'strict' is 'True', information will be added to the list\nof standard types, else to the list of non-standard types.\n\n-- Method: readwindowsregistry (strict=True)\n\nLoad MIME type information from the Windows registry.\n\n*note Availability: 1ad3.: Windows.\n\nIf 'strict' is 'True', information will be added to the list\nof standard types, else to the list of non-standard types.\n\nNew in version 3.2.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: base64 -- Base16 Base32 Base64 Base85 Data Encodings,  Next: binascii -- Convert between binary and ASCII,  Prev: mimetypes -- Map filenames to MIME types,  Up: Internet Data Handling": {
            "content": "'Source code:' Lib/base64.py(1)\n\n\n",
            "subsections": []
        },
        "This module provides functions for encoding binary data to printable": {
            "content": "ASCII characters and decoding such encodings back to binary data.  It\nprovides encoding and decoding functions for the encodings specified in\nRFC 4648(2), which defines the Base16, Base32, and Base64 algorithms,\nand for the de-facto standard Ascii85 and Base85 encodings.\n",
            "subsections": []
        },
        "The RFC 4648(3) encodings are suitable for encoding binary data so that": {
            "content": "it can be safely sent by email, used as parts of URLs, or included as\npart of an HTTP POST request.  The encoding algorithm is not the same as\nthe 'uuencode' program.\n",
            "subsections": []
        },
        "There are two interfaces provided by this module.  The modern interface": {
            "content": "supports encoding *note bytes-like objects: b82. to ASCII *note bytes:\n295, and decoding *note bytes-like objects: b82. or strings containing\nASCII to *note bytes: 295.  Both base-64 alphabets defined in RFC\n4648(4) (normal, and URL- and filesystem-safe) are supported.\n",
            "subsections": []
        },
        "The legacy interface does not support decoding from strings, but it does": {
            "content": "provide functions for encoding and decoding to and from *note file\nobjects: 1037.  It only supports the Base64 standard alphabet, and it\nadds newlines every 76 characters as per RFC 2045(5).  Note that if you\nare looking for RFC 2045(6) support you probably want to be looking at\nthe *note email: 37. package instead.\n",
            "subsections": []
        },
        "Changed in version 3.3: ASCII-only Unicode strings are now accepted by": {
            "content": "the decoding functions of the modern interface.\n\nChanged in version 3.4: Any *note bytes-like objects: b82. are now\naccepted by all encoding and decoding functions in this module.\nAscii85/Base85 support added.\n\nThe modern interface provides:\n\n-- Function: base64.b64encode (s, altchars=None)\n\nEncode the *note bytes-like object: b82. 's' using Base64 and\nreturn the encoded *note bytes: 295.\n\nOptional 'altchars' must be a *note bytes-like object: b82. of\nlength 2 which specifies an alternative alphabet for the '+' and\n'/' characters.  This allows an application to e.g.  generate URL\nor filesystem safe Base64 strings.  The default is 'None', for\nwhich the standard Base64 alphabet is used.\n\nMay assert or raise a *note ValueError: 183. if the length of\n'altchars' is not 2.  Raises a *note TypeError: 28e. if 'altchars'\nis not a *note bytes-like object: b82.\n\n-- Function: base64.b64decode (s, altchars=None, validate=False)\n\nDecode the Base64 encoded *note bytes-like object: b82. or ASCII\nstring 's' and return the decoded *note bytes: 295.\n\nOptional 'altchars' must be a *note bytes-like object: b82. or\nASCII string of length 2 which specifies the alternative alphabet\nused instead of the '+' and '/' characters.\n\nA *note binascii.Error: e9d. exception is raised if 's' is\nincorrectly padded.\n\nIf 'validate' is 'False' (the default), characters that are neither\nin the normal base-64 alphabet nor the alternative alphabet are\ndiscarded prior to the padding check.  If 'validate' is 'True',\nthese non-alphabet characters in the input result in a *note\nbinascii.Error: e9d.\n\nFor more information about the strict base64 check, see *note\nbinascii.a2bbase64(): 1744.\n\nMay assert or raise a *note ValueError: 183. if the length of\n'altchars' is not 2.\n\n-- Function: base64.standardb64encode (s)\n\nEncode *note bytes-like object: b82. 's' using the standard Base64\nalphabet and return the encoded *note bytes: 295.\n\n-- Function: base64.standardb64decode (s)\n\nDecode *note bytes-like object: b82. or ASCII string 's' using the\nstandard Base64 alphabet and return the decoded *note bytes: 295.\n\n-- Function: base64.urlsafeb64encode (s)\n\nEncode *note bytes-like object: b82. 's' using the URL- and\nfilesystem-safe alphabet, which substitutes '-' instead of '+' and\n'' instead of '/' in the standard Base64 alphabet, and return the\nencoded *note bytes: 295.  The result can still contain '='.\n\n-- Function: base64.urlsafeb64decode (s)\n\nDecode *note bytes-like object: b82. or ASCII string 's' using the\nURL- and filesystem-safe alphabet, which substitutes '-' instead of\n'+' and '' instead of '/' in the standard Base64 alphabet, and\nreturn the decoded *note bytes: 295.\n\n-- Function: base64.b32encode (s)\n\nEncode the *note bytes-like object: b82. 's' using Base32 and\nreturn the encoded *note bytes: 295.\n\n-- Function: base64.b32decode (s, casefold=False, map01=None)\n\nDecode the Base32 encoded *note bytes-like object: b82. or ASCII\nstring 's' and return the decoded *note bytes: 295.\n\nOptional 'casefold' is a flag specifying whether a lowercase\nalphabet is acceptable as input.  For security purposes, the\ndefault is 'False'.\n\nRFC 4648(7) allows for optional mapping of the digit 0 (zero) to\nthe letter O (oh), and for optional mapping of the digit 1 (one) to\neither the letter I (eye) or letter L (el).  The optional argument\n'map01' when not 'None', specifies which letter the digit 1 should\nbe mapped to (when 'map01' is not 'None', the digit 0 is always\nmapped to the letter O). For security purposes the default is\n'None', so that 0 and 1 are not allowed in the input.\n\nA *note binascii.Error: e9d. is raised if 's' is incorrectly padded\nor if there are non-alphabet characters present in the input.\n\n-- Function: base64.b32hexencode (s)\n\nSimilar to *note b32encode(): 3376. but uses the Extended Hex\nAlphabet, as defined in RFC 4648(8).\n\nNew in version 3.10.\n\n-- Function: base64.b32hexdecode (s, casefold=False)\n\nSimilar to *note b32decode(): e9c. but uses the Extended Hex\nAlphabet, as defined in RFC 4648(9).\n\nThis version does not allow the digit 0 (zero) to the letter O (oh)\nand digit 1 (one) to either the letter I (eye) or letter L (el)\nmappings, all these characters are included in the Extended Hex\nAlphabet and are not interchangeable.\n\nNew in version 3.10.\n\n-- Function: base64.b16encode (s)\n\nEncode the *note bytes-like object: b82. 's' using Base16 and\nreturn the encoded *note bytes: 295.\n\n-- Function: base64.b16decode (s, casefold=False)\n\nDecode the Base16 encoded *note bytes-like object: b82. or ASCII\nstring 's' and return the decoded *note bytes: 295.\n\nOptional 'casefold' is a flag specifying whether a lowercase\nalphabet is acceptable as input.  For security purposes, the\ndefault is 'False'.\n\nA *note binascii.Error: e9d. is raised if 's' is incorrectly padded\nor if there are non-alphabet characters present in the input.\n\n-- Function: base64.a85encode (b, *, foldspaces=False, wrapcol=0,\npad=False, adobe=False)\n\nEncode the *note bytes-like object: b82. 'b' using Ascii85 and\nreturn the encoded *note bytes: 295.\n\n'foldspaces' is an optional flag that uses the special short\nsequence 'y' instead of 4 consecutive spaces (ASCII 0x20) as\nsupported by 'btoa'.  This feature is not supported by the\n\"standard\" Ascii85 encoding.\n\n'wrapcol' controls whether the output should have newline ('b'\\n'')\ncharacters added to it.  If this is non-zero, each output line will\nbe at most this many characters long.\n\n'pad' controls whether the input is padded to a multiple of 4\nbefore encoding.  Note that the 'btoa' implementation always pads.\n\n'adobe' controls whether the encoded byte sequence is framed with\n'<~' and '~>', which is used by the Adobe implementation.\n\nNew in version 3.4.\n\n-- Function: base64.a85decode (b, *, foldspaces=False, adobe=False,\nignorechars=b' \\t\\n\\r\\x0b')\n\nDecode the Ascii85 encoded *note bytes-like object: b82. or ASCII\nstring 'b' and return the decoded *note bytes: 295.\n\n'foldspaces' is a flag that specifies whether the 'y' short\nsequence should be accepted as shorthand for 4 consecutive spaces\n(ASCII 0x20).  This feature is not supported by the \"standard\"\nAscii85 encoding.\n\n'adobe' controls whether the input sequence is in Adobe Ascii85\nformat (i.e.  is framed with <~ and ~>).\n\n'ignorechars' should be a *note bytes-like object: b82. or ASCII\nstring containing characters to ignore from the input.  This should\nonly contain whitespace characters, and by default contains all\nwhitespace characters in ASCII.\n\nNew in version 3.4.\n\n-- Function: base64.b85encode (b, pad=False)\n\nEncode the *note bytes-like object: b82. 'b' using base85 (as used\nin e.g.  git-style binary diffs) and return the encoded *note\nbytes: 295.\n\nIf 'pad' is true, the input is padded with 'b'\\0'' so its length is\na multiple of 4 bytes before encoding.\n\nNew in version 3.4.\n\n-- Function: base64.b85decode (b)\n\nDecode the base85-encoded *note bytes-like object: b82. or ASCII\nstring 'b' and return the decoded *note bytes: 295.  Padding is\nimplicitly removed, if necessary.\n\nNew in version 3.4.\n\nThe legacy interface:\n\n-- Function: base64.decode (input, output)\n\nDecode the contents of the binary 'input' file and write the\nresulting binary data to the 'output' file.  'input' and 'output'\nmust be *note file objects: 1037.  'input' will be read until\n'input.readline()' returns an empty bytes object.\n\n-- Function: base64.decodebytes (s)\n\nDecode the *note bytes-like object: b82. 's', which must contain\none or more lines of base64 encoded data, and return the decoded\n*note bytes: 295.\n\nNew in version 3.1.\n\n-- Function: base64.encode (input, output)\n\nEncode the contents of the binary 'input' file and write the\nresulting base64 encoded data to the 'output' file.  'input' and\n'output' must be *note file objects: 1037.  'input' will be read\nuntil 'input.read()' returns an empty bytes object.  *note\nencode(): 337a. inserts a newline character ('b'\\n'') after every\n76 bytes of the output, as well as ensuring that the output always\nends with a newline, as per RFC 2045(10) (MIME).\n\n-- Function: base64.encodebytes (s)\n\nEncode the *note bytes-like object: b82. 's', which can contain\narbitrary binary data, and return *note bytes: 295. containing the\nbase64-encoded data, with newlines ('b'\\n'') inserted after every\n76 bytes of output, and ensuring that there is a trailing newline,\nas per RFC 2045(11) (MIME).\n\nNew in version 3.1.\n\nAn example usage of the module:\n\n>>> import base64\n>>> encoded = base64.b64encode(b'data to be encoded')\n>>> encoded\nb'ZGF0YSB0byBiZSBlbmNvZGVk'\n>>> data = base64.b64decode(encoded)\n>>> data\nb'data to be encoded'\n\n* Menu:\n\n* Security Considerations: Security Considerations<2>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/base64.py\n\n(2) https://datatracker.ietf.org/doc/html/rfc4648.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc4648.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc4648.html\n\n(5) https://datatracker.ietf.org/doc/html/rfc2045.html\n\n(6) https://datatracker.ietf.org/doc/html/rfc2045.html\n\n(7) https://datatracker.ietf.org/doc/html/rfc4648.html\n\n(8) https://datatracker.ietf.org/doc/html/rfc4648.html\n\n(9) https://datatracker.ietf.org/doc/html/rfc4648.html\n\n(10) https://datatracker.ietf.org/doc/html/rfc2045.html\n\n(11) https://datatracker.ietf.org/doc/html/rfc2045.html\n\nFile: python3.12.info,  Node: Security Considerations<2>,  Up: base64 -- Base16 Base32 Base64 Base85 Data Encodings\n\n5.19.5.1 Security Considerations\n................................\n\nA new security considerations section was added to RFC 4648(1) (section\n12); it's recommended to review the security section for any code\ndeployed to production.\n\nSee also\n........\n\nModule *note binascii: e.\n\nSupport module containing ASCII-to-binary and binary-to-ASCII\nconversions.\n\nRFC 1521(2) - MIME (Multipurpose Internet Mail Extensions) Part One: Mechanisms for Specifying and Describing the Format of Internet Message Bodies\n\nSection 5.2, \"Base64 Content-Transfer-Encoding,\" provides the\ndefinition of the base64 encoding.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc4648.html\n\n(2) https://datatracker.ietf.org/doc/html/rfc1521.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: binascii -- Convert between binary and ASCII,  Next: quopri -- Encode and decode MIME quoted-printable data,  Prev: base64 -- Base16 Base32 Base64 Base85 Data Encodings,  Up: Internet Data Handling": {
            "content": "The *note binascii: e. module contains a number of methods to convert\nbetween binary and various ASCII-encoded binary representations.",
            "subsections": []
        },
        "Normally, you will not use these functions directly but use wrapper": {
            "content": "modules like *note uu: 10a. or *note base64: c. instead.  The *note\nbinascii: e. module contains low-level functions written in C for\ngreater speed that are used by the higher-level modules.\n\nNote: 'a2b*' functions accept Unicode strings containing only\nASCII characters.  Other functions only accept *note bytes-like\nobjects: b82. (such as *note bytes: 295, *note bytearray: 294. and\nother objects that support the buffer protocol).\n\nChanged in version 3.3: ASCII-only unicode strings are now accepted\nby the 'a2b*' functions.\n\nThe *note binascii: e. module defines the following functions:\n\n-- Function: binascii.a2buu (string)\n\nConvert a single line of uuencoded data back to binary and return\nthe binary data.  Lines normally contain 45 (binary) bytes, except\nfor the last line.  Line data may be followed by whitespace.\n\n-- Function: binascii.b2auu (data, *, backtick=False)\n\nConvert binary data to a line of ASCII characters, the return value\nis the converted line, including a newline char.  The length of\n'data' should be at most 45.  If 'backtick' is true, zeros are\nrepresented by ''`'' instead of spaces.\n\nChanged in version 3.7: Added the 'backtick' parameter.\n\n-- Function: binascii.a2bbase64 (string, /, *, strictmode=False)\n\nConvert a block of base64 data back to binary and return the binary\ndata.  More than one line may be passed at a time.\n\nIf 'strictmode' is true, only valid base64 data will be converted.\nInvalid base64 data will raise *note binascii.Error: e9d.\n\nValid base64:\n\n* Conforms to RFC 3548(1).\n\n* Contains only characters from the base64 alphabet.\n\n* Contains no excess data after padding (including excess\npadding, newlines, etc.).\n\n* Does not start with a padding.\n\nChanged in version 3.11: Added the 'strictmode' parameter.\n\n-- Function: binascii.b2abase64 (data, *, newline=True)\n\nConvert binary data to a line of ASCII characters in base64 coding.\nThe return value is the converted line, including a newline char if\n'newline' is true.  The output of this function conforms to RFC\n3548(2).\n\nChanged in version 3.6: Added the 'newline' parameter.\n\n-- Function: binascii.a2bqp (data, header=False)\n\nConvert a block of quoted-printable data back to binary and return\nthe binary data.  More than one line may be passed at a time.  If\nthe optional argument 'header' is present and true, underscores\nwill be decoded as spaces.\n\n-- Function: binascii.b2aqp (data, quotetabs=False, istext=True,\nheader=False)\n\nConvert binary data to a line(s) of ASCII characters in\nquoted-printable encoding.  The return value is the converted\nline(s).  If the optional argument 'quotetabs' is present and true,\nall tabs and spaces will be encoded.  If the optional argument\n'istext' is present and true, newlines are not encoded but trailing\nwhitespace will be encoded.  If the optional argument 'header' is\npresent and true, spaces will be encoded as underscores per RFC\n1522(3).  If the optional argument 'header' is present and false,\nnewline characters will be encoded as well; otherwise linefeed\nconversion might corrupt the binary data stream.\n\n-- Function: binascii.crchqx (data, value)\n\nCompute a 16-bit CRC value of 'data', starting with 'value' as the\ninitial CRC, and return the result.  This uses the CRC-CCITT\npolynomial 'x'^16 + 'x'^12 + 'x'^5 + 1, often represented as\n0x1021.  This CRC is used in the binhex4 format.\n\n-- Function: binascii.crc32 (data[, value])\n\nCompute CRC-32, the unsigned 32-bit checksum of 'data', starting\nwith an initial CRC of 'value'.  The default initial CRC is zero.\nThe algorithm is consistent with the ZIP file checksum.  Since the\nalgorithm is designed for use as a checksum algorithm, it is not\nsuitable for use as a general hash algorithm.  Use as follows:\n\nprint(binascii.crc32(b\"hello world\"))\n# Or, in two pieces:\ncrc = binascii.crc32(b\"hello\")\ncrc = binascii.crc32(b\" world\", crc)\nprint('crc32 = {:#010x}'.format(crc))\n\nChanged in version 3.0: The result is always unsigned.\n\n-- Function: binascii.b2ahex (data[, sep[, bytespersep=1]])\n-- Function: binascii.hexlify (data[, sep[, bytespersep=1]])\n\nReturn the hexadecimal representation of the binary 'data'.  Every\nbyte of 'data' is converted into the corresponding 2-digit hex\nrepresentation.  The returned bytes object is therefore twice as\nlong as the length of 'data'.\n\nSimilar functionality (but returning a text string) is also\nconveniently accessible using the *note bytes.hex(): bc3. method.\n\nIf 'sep' is specified, it must be a single character str or bytes\nobject.  It will be inserted in the output after every\n'bytespersep' input bytes.  Separator placement is counted from\nthe right end of the output by default, if you wish to count from\nthe left, supply a negative 'bytespersep' value.\n\n>>> import binascii\n>>> binascii.b2ahex(b'\\xb9\\x01\\xef')\nb'b901ef'\n>>> binascii.hexlify(b'\\xb9\\x01\\xef', '-')\nb'b9-01-ef'\n>>> binascii.b2ahex(b'\\xb9\\x01\\xef', b'', 2)\nb'b901ef'\n>>> binascii.b2ahex(b'\\xb9\\x01\\xef', b' ', -2)\nb'b901 ef'\n\nChanged in version 3.8: The 'sep' and 'bytespersep' parameters\nwere added.\n\n-- Function: binascii.a2bhex (hexstr)\n-- Function: binascii.unhexlify (hexstr)\n\nReturn the binary data represented by the hexadecimal string\n'hexstr'.  This function is the inverse of *note b2ahex(): 2121.\n'hexstr' must contain an even number of hexadecimal digits (which\ncan be upper or lower case), otherwise an *note Error: e9d.\nexception is raised.\n\nSimilar functionality (accepting only text string arguments, but\nmore liberal towards whitespace) is also accessible using the *note\nbytes.fromhex(): 926. class method.\n\n-- Exception: binascii.Error\n\nException raised on errors.  These are usually programming errors.\n\n-- Exception: binascii.Incomplete\n\nException raised on incomplete data.  These are usually not\nprogramming errors, but may be handled by reading a little more\ndata and trying again.\n\nSee also\n........\n\nModule *note base64: c.\n\nSupport for RFC compliant base64-style encoding in base 16, 32, 64,\nand 85.\n\nModule *note uu: 10a.\n\nSupport for UU encoding used on Unix.\n\nModule *note quopri: b2.\n\nSupport for quoted-printable encoding used in MIME email messages.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc3548.html\n\n(2) https://datatracker.ietf.org/doc/html/rfc3548.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc1522.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: quopri -- Encode and decode MIME quoted-printable data,  Prev: binascii -- Convert between binary and ASCII,  Up: Internet Data Handling": {
            "content": "'Source code:' Lib/quopri.py(1)\n\n\n",
            "subsections": []
        },
        "This module performs quoted-printable transport encoding and decoding,": {
            "content": "as defined in RFC 1521(2): \"MIME (Multipurpose Internet Mail Extensions)",
            "subsections": []
        },
        "Part One: Mechanisms for Specifying and Describing the Format of": {
            "content": "Internet Message Bodies\".  The quoted-printable encoding is designed for\ndata where there are relatively few nonprintable characters; the base64\nencoding scheme available via the *note base64: c. module is more\ncompact if there are many such characters, as when sending a graphics\nfile.\n\n-- Function: quopri.decode (input, output, header=False)\n\nDecode the contents of the 'input' file and write the resulting\ndecoded binary data to the 'output' file.  'input' and 'output'\nmust be *note binary file objects: 1037.  If the optional argument\n'header' is present and true, underscore will be decoded as space.\nThis is used to decode \"Q\"-encoded headers as described in RFC\n1522(3): \"MIME (Multipurpose Internet Mail Extensions) Part Two:\nMessage Header Extensions for Non-ASCII Text\".\n\n-- Function: quopri.encode (input, output, quotetabs, header=False)\n\nEncode the contents of the 'input' file and write the resulting\nquoted-printable data to the 'output' file.  'input' and 'output'\nmust be *note binary file objects: 1037.  'quotetabs', a\nnon-optional flag which controls whether to encode embedded spaces\nand tabs; when true it encodes such embedded whitespace, and when\nfalse it leaves them unencoded.  Note that spaces and tabs\nappearing at the end of lines are always encoded, as per RFC\n1521(4).  'header' is a flag which controls if spaces are encoded\nas underscores as per RFC 1522(5).\n\n-- Function: quopri.decodestring (s, header=False)\n\nLike *note decode(): 2124, except that it accepts a source *note\nbytes: 295. and returns the corresponding decoded *note bytes: 295.\n\n-- Function: quopri.encodestring (s, quotetabs=False, header=False)\n\nLike *note encode(): 2123, except that it accepts a source *note\nbytes: 295. and returns the corresponding encoded *note bytes: 295.\nBy default, it sends a 'False' value to 'quotetabs' parameter of\nthe *note encode(): 2123. function.\n\nSee also\n........\n\nModule *note base64: c.\n\nEncode and decode MIME base64 data\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/quopri.py\n\n(2) https://datatracker.ietf.org/doc/html/rfc1521.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc1522.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc1521.html\n\n(5) https://datatracker.ietf.org/doc/html/rfc1522.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Structured Markup Processing Tools,  Next: Internet Protocols and Support,  Prev: Internet Data Handling,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.20 Structured Markup Processing Tools",
                    "content": ""
                }
            ]
        },
        "Python supports a variety of modules to work with various forms of": {
            "content": "structured data markup.  This includes modules to work with the Standard",
            "subsections": []
        },
        "Generalized Markup Language (SGML) and the Hypertext Markup Language": {
            "content": "(HTML), and several interfaces for working with the Extensible Markup\nLanguage (XML).\n\n* Menu:\n\n* html -- HyperText Markup Language support::\n* html.parser -- Simple HTML and XHTML parser: html parser -- Simple HTML and XHTML parser.\n* html.entities -- Definitions of HTML general entities: html entities -- Definitions of HTML general entities.\n* XML Processing Modules::\n* xml.etree.ElementTree -- The ElementTree XML API: xml etree ElementTree -- The ElementTree XML API.\n* xml.dom -- The Document Object Model API: xml dom -- The Document Object Model API.\n* xml.dom.minidom -- Minimal DOM implementation: xml dom minidom -- Minimal DOM implementation.\n* xml.dom.pulldom -- Support for building partial DOM trees: xml dom pulldom -- Support for building partial DOM trees.\n* xml.sax -- Support for SAX2 parsers: xml sax -- Support for SAX2 parsers.\n* xml.sax.handler -- Base classes for SAX handlers: xml sax handler -- Base classes for SAX handlers.\n* xml.sax.saxutils -- SAX Utilities: xml sax saxutils -- SAX Utilities.\n* xml.sax.xmlreader -- Interface for XML parsers: xml sax xmlreader -- Interface for XML parsers.\n* xml.parsers.expat -- Fast XML parsing using Expat: xml parsers expat -- Fast XML parsing using Expat.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: html -- HyperText Markup Language support,  Next: html parser -- Simple HTML and XHTML parser,  Up: Structured Markup Processing Tools": {
            "content": "'Source code:' Lib/html/init.py(1)\n\n\n\nThis module defines utilities to manipulate HTML.\n\n-- Function: html.escape (s, quote=True)\n\nConvert the characters '&', '<' and '>' in string 's' to HTML-safe\nsequences.  Use this if you need to display text that might contain\nsuch characters in HTML. If the optional flag 'quote' is true, the\ncharacters ('\"') and (''') are also translated; this helps for\ninclusion in an HTML attribute value delimited by quotes, as in '<a\nhref=\"...\">'.\n\nNew in version 3.2.\n\n-- Function: html.unescape (s)\n\nConvert all named and numeric character references (e.g.  '&gt;',\n'&#62;', '&#x3e;') in the string 's' to the corresponding Unicode\ncharacters.  This function uses the rules defined by the HTML 5\nstandard for both valid and invalid character references, and the\n*note list of HTML 5 named character references: f42.\n\nNew in version 3.4.\n\n\n\nSubmodules in the 'html' package are:\n\n* *note html.parser: 68. - HTML/XHTML parser with lenient parsing\nmode\n\n* *note html.entities: 67. - HTML entity definitions\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/html/init.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: html parser -- Simple HTML and XHTML parser,  Next: html entities -- Definitions of HTML general entities,  Prev: html -- HyperText Markup Language support,  Up: Structured Markup Processing Tools": {
            "content": "'Source code:' Lib/html/parser.py(1)\n\n\n\nThis module defines a class *note HTMLParser: 682. which serves as the\nbasis for parsing text files formatted in HTML (HyperText Mark-up\nLanguage) and XHTML.\n\n-- Class: html.parser.HTMLParser (*, convertcharrefs=True,\nscripting=False)\n\nCreate a parser instance able to parse invalid markup.\n\nIf 'convertcharrefs' is true (the default), all character\nreferences (except the ones in elements like 'script' and 'style')\nare automatically converted to the corresponding Unicode\ncharacters.\n\nIf 'scripting' is false (the default), the content of the\n'noscript' element is parsed normally; if it's true, it's returned\nas is without being parsed.\n\nAn *note HTMLParser: 682. instance is fed HTML data and calls\nhandler methods when start tags, end tags, text, comments, and\nother markup elements are encountered.  The user should subclass\n*note HTMLParser: 682. and override its methods to implement the\ndesired behavior.\n\nThis parser does not check that end tags match start tags or call\nthe end-tag handler for elements which are closed implicitly by\nclosing an outer element.\n\nChanged in version 3.4: 'convertcharrefs' keyword argument added.\n\nChanged in version 3.5: The default value for argument\n'convertcharrefs' is now 'True'.\n\nChanged in version 3.12.13: Added the 'scripting' parameter.\n\n* Menu:\n\n* Example HTML Parser Application::\n* HTMLParser Methods::\n* Examples: Examples<23>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/html/parser.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Example HTML Parser Application,  Next: HTMLParser Methods,  Up: html parser -- Simple HTML and XHTML parser": {
            "content": "5.20.2.1 Example HTML Parser Application\n........................................\n\nAs a basic example, below is a simple HTML parser that uses the *note\nHTMLParser: 682. class to print out start tags, end tags, and data as\nthey are encountered:\n\nfrom html.parser import HTMLParser\n\nclass MyHTMLParser(HTMLParser):\ndef handlestarttag(self, tag, attrs):\nprint(\"Encountered a start tag:\", tag)\n\ndef handleendtag(self, tag):\nprint(\"Encountered an end tag :\", tag)\n\ndef handledata(self, data):\nprint(\"Encountered some data  :\", data)\n\nparser = MyHTMLParser()\nparser.feed('<html><head><title>Test</title></head>'\n'<body><h1>Parse me!</h1></body></html>')\n\nThe output will then be:\n\nEncountered a start tag: html\nEncountered a start tag: head\nEncountered a start tag: title\nEncountered some data  : Test\nEncountered an end tag : title\nEncountered an end tag : head\nEncountered a start tag: body\nEncountered a start tag: h1\nEncountered some data  : Parse me!\nEncountered an end tag : h1\nEncountered an end tag : body\nEncountered an end tag : html\n\nFile: python3.12.info,  Node: HTMLParser Methods,  Next: Examples<23>,  Prev: Example HTML Parser Application,  Up: html parser -- Simple HTML and XHTML parser\n\n5.20.2.2 'HTMLParser' Methods\n.............................\n\n*note HTMLParser: 682. instances have the following methods:\n\n-- Method: HTMLParser.feed (data)\n\nFeed some text to the parser.  It is processed insofar as it\nconsists of complete elements; incomplete data is buffered until\nmore data is fed or *note close(): 3392. is called.  'data' must be\n*note str: 157.\n\n-- Method: HTMLParser.close ()\n\nForce processing of all buffered data as if it were followed by an\nend-of-file mark.  This method may be redefined by a derived class\nto define additional processing at the end of the input, but the\nredefined version should always call the *note HTMLParser: 682.\nbase class method *note close(): 3392.\n\n-- Method: HTMLParser.reset ()\n\nReset the instance.  Loses all unprocessed data.  This is called\nimplicitly at instantiation time.\n\n-- Method: HTMLParser.getpos ()\n\nReturn current line number and offset.\n\n-- Method: HTMLParser.getstarttagtext ()\n\nReturn the text of the most recently opened start tag.  This should\nnot normally be needed for structured processing, but may be useful\nin dealing with HTML \"as deployed\" or for re-generating input with\nminimal changes (whitespace between attributes can be preserved,\netc.).\n",
            "subsections": []
        },
        "The following methods are called when data or markup elements are": {
            "content": "encountered and they are meant to be overridden in a subclass.  The base\nclass implementations do nothing (except for *note handlestartendtag():\n3396.):\n\n-- Method: HTMLParser.handlestarttag (tag, attrs)\n\nThis method is called to handle the start tag of an element (e.g.\n'<div id=\"main\">').\n\nThe 'tag' argument is the name of the tag converted to lower case.\nThe 'attrs' argument is a list of '(name, value)' pairs containing\nthe attributes found inside the tag's '<>' brackets.  The 'name'\nwill be translated to lower case, and quotes in the 'value' have\nbeen removed, and character and entity references have been\nreplaced.\n\nFor instance, for the tag '<A HREF=\"https://www.cwi.nl/\">', this\nmethod would be called as 'handlestarttag('a', [('href',\n'https://www.cwi.nl/')])'.\n\nAll entity references from *note html.entities: 67. are replaced in\nthe attribute values.\n\n-- Method: HTMLParser.handleendtag (tag)\n\nThis method is called to handle the end tag of an element (e.g.\n'</div>').\n\nThe 'tag' argument is the name of the tag converted to lower case.\n\n-- Method: HTMLParser.handlestartendtag (tag, attrs)\n\nSimilar to *note handlestarttag(): 3397, but called when the\nparser encounters an XHTML-style empty tag ('<img ... />').  This\nmethod may be overridden by subclasses which require this\nparticular lexical information; the default implementation simply\ncalls *note handlestarttag(): 3397. and *note handleendtag():\n3398.\n\n-- Method: HTMLParser.handledata (data)\n\nThis method is called to process arbitrary data (e.g.  text nodes\nand the content of elements like 'script' and 'style').\n\n-- Method: HTMLParser.handleentityref (name)\n\nThis method is called to process a named character reference of the\nform '&name;' (e.g.  '&gt;'), where 'name' is a general entity\nreference (e.g.  ''gt'').  This method is only called if\n'convertcharrefs' is false.\n\n-- Method: HTMLParser.handlecharref (name)\n\nThis method is called to process decimal and hexadecimal numeric\ncharacter references of the form '&#NNN;' and '&#xNNN;'.  For\nexample, the decimal equivalent for '&gt;' is '&#62;', whereas the\nhexadecimal is '&#x3E;'; in this case the method will receive\n''62'' or ''x3E''.  This method is only called if\n'convertcharrefs' is false.\n\n-- Method: HTMLParser.handlecomment (data)\n\nThis method is called when a comment is encountered (e.g.\n'<!--comment-->').\n\nFor example, the comment '<!-- comment -->' will cause this method\nto be called with the argument '' comment ''.\n\nThe content of Internet Explorer conditional comments (condcoms)\nwill also be sent to this method, so, for '<!--[if IE\n9]>IE9-specific content<![endif]-->', this method will receive\n''[if IE 9]>IE9-specific content<![endif]''.\n\n-- Method: HTMLParser.handledecl (decl)\n\nThis method is called to handle an HTML doctype declaration (e.g.\n'<!DOCTYPE html>').\n\nThe 'decl' parameter will be the entire contents of the declaration\ninside the '<!...>' markup (e.g.  ''DOCTYPE html'').\n\n-- Method: HTMLParser.handlepi (data)\n\nMethod called when a processing instruction is encountered.  The\n'data' parameter will contain the entire processing instruction.\nFor example, for the processing instruction '<?proc color='red'>',\nthis method would be called as 'handlepi(\"proc color='red'\")'.  It\nis intended to be overridden by a derived class; the base class\nimplementation does nothing.\n\nNote: The *note HTMLParser: 682. class uses the SGML syntactic\nrules for processing instructions.  An XHTML processing\ninstruction using the trailing ''?'' will cause the ''?'' to\nbe included in 'data'.\n\n-- Method: HTMLParser.unknowndecl (data)\n\nThis method is called when an unrecognized declaration is read by\nthe parser.\n\nThe 'data' parameter will be the entire contents of the declaration\ninside the '<![...]>' markup.  It is sometimes useful to be\noverridden by a derived class.  The base class implementation does\nnothing.\n\nFile: python3.12.info,  Node: Examples<23>,  Prev: HTMLParser Methods,  Up: html parser -- Simple HTML and XHTML parser\n\n5.20.2.3 Examples\n.................\n",
            "subsections": []
        },
        "The following class implements a parser that will be used to illustrate": {
            "content": "more examples:\n\nfrom html.parser import HTMLParser\nfrom html.entities import name2codepoint\n\nclass MyHTMLParser(HTMLParser):\ndef handlestarttag(self, tag, attrs):\nprint(\"Start tag:\", tag)\nfor attr in attrs:\nprint(\"     attr:\", attr)\n\ndef handleendtag(self, tag):\nprint(\"End tag  :\", tag)\n\ndef handledata(self, data):\nprint(\"Data     :\", data)\n\ndef handlecomment(self, data):\nprint(\"Comment  :\", data)\n\ndef handleentityref(self, name):\nc = chr(name2codepoint[name])\nprint(\"Named ent:\", c)\n\ndef handlecharref(self, name):\nif name.startswith('x'):\nc = chr(int(name[1:], 16))\nelse:\nc = chr(int(name))\nprint(\"Num ent  :\", c)\n\ndef handledecl(self, data):\nprint(\"Decl     :\", data)\n\nparser = MyHTMLParser()\n\nParsing a doctype:\n\n>>> parser.feed('<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" '\n...             '\"http://www.w3.org/TR/html4/strict.dtd\">')\nDecl     : DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\"\n\nParsing an element with a few attributes and a title:\n\n>>> parser.feed('<img src=\"python-logo.png\" alt=\"The Python logo\">')\nStart tag: img\nattr: ('src', 'python-logo.png')\nattr: ('alt', 'The Python logo')\n>>>\n>>> parser.feed('<h1>Python</h1>')\nStart tag: h1\nData     : Python\nEnd tag  : h1\n",
            "subsections": []
        },
        "The content of elements like 'script' and 'style' is returned as is,": {
            "content": "without further parsing:\n\n>>> parser.feed('<style type=\"text/css\">#python { color: green }</style>')\nStart tag: style\nattr: ('type', 'text/css')\nData     : #python { color: green }\nEnd tag  : style\n\n>>> parser.feed('<script type=\"text/javascript\">'\n...             'alert(\"<strong>hello! &#9786;</strong>\");</script>')\nStart tag: script\nattr: ('type', 'text/javascript')\nData     : alert(\"<strong>hello! &#9786;</strong>\");\nEnd tag  : script\n\nParsing comments:\n\n>>> parser.feed('<!-- a comment -->'\n...             '<!--[if IE 9]>IE-specific content<![endif]-->')\nComment  :  a comment\nComment  : [if IE 9]>IE-specific content<![endif]\n",
            "subsections": []
        },
        "Parsing named and numeric character references and converting them to": {
            "content": "the correct char (note: these 3 references are all equivalent to ''>''):\n\n>>> parser.feed('&gt;&#62;&#x3E;')\nNamed ent: >\nNum ent  : >\nNum ent  : >\n\nFeeding incomplete chunks to *note feed(): 3391. works, but *note\nhandledata(): 3399. might be called more than once if\n'convertcharrefs' is false:\n\n>>> for chunk in ['<sp', 'an>buff', 'ered ', 'text</s', 'pan>']:\n...     parser.feed(chunk)\n...\nStart tag: span\nData     : buff\nData     : ered\nData     : text\nEnd tag  : span\n\nParsing invalid HTML (e.g.  unquoted attributes) also works:\n\n>>> parser.feed('<p><a class=link href=#main>tag soup</p ></a>')\nStart tag: p\nStart tag: a\nattr: ('class', 'link')\nattr: ('href', '#main')\nData     : tag soup\nEnd tag  : p\nEnd tag  : a\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "'Source code:' Lib/html/entities.py(1)\n\n\n\nThis module defines four dictionaries, *note html5: f42, *note\nname2codepoint: 33a4, *note codepoint2name: 33a5, and *note entitydefs:\n33a6.\n\n-- Data: html.entities.html5\n\nA dictionary that maps HTML5 named character references (2) to the\nequivalent Unicode character(s), e.g.  'html5['gt;'] == '>''.  Note\nthat the trailing semicolon is included in the name (e.g.\n''gt;''), however some of the names are accepted by the standard\neven without the semicolon: in this case the name is present with\nand without the '';''.  See also *note html.unescape(): 778.\n\nNew in version 3.3.\n\n-- Data: html.entities.entitydefs\n\nA dictionary mapping XHTML 1.0 entity definitions to their\nreplacement text in ISO Latin-1.\n\n-- Data: html.entities.name2codepoint\n\nA dictionary that maps HTML4 entity names to the Unicode code\npoints.\n\n-- Data: html.entities.codepoint2name\n\nA dictionary that maps Unicode code points to HTML4 entity names.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/html/entities.py\n\n(2) See\n'https://html.spec.whatwg.org/multipage/named-characters.html#named-character-references'\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "'Source code:' Lib/xml/(1)\n\n\n\nPython's interfaces for processing XML are grouped in the 'xml' package.\n\nWarning: The XML modules are not secure against erroneous or\nmaliciously constructed data.  If you need to parse untrusted or\nunauthenticated data see the *note XML vulnerabilities: 33aa. and\n*note The defusedxml Package: 33ab. sections.\n\nIt is important to note that modules in the *note xml: 11b. package\nrequire that there be at least one SAX-compliant XML parser available.\nThe Expat parser is included with Python, so the *note\nxml.parsers.expat: 121. module will always be available.\n\nThe documentation for the *note xml.dom: 11c. and *note xml.sax: 124.\npackages are the definition of the Python bindings for the DOM and SAX\ninterfaces.\n\nThe XML handling submodules are:\n\n* *note xml.etree.ElementTree: 120.: the ElementTree API, a simple\nand lightweight XML processor\n\n* *note xml.dom: 11c.: the DOM API definition\n\n* *note xml.dom.minidom: 11d.: a minimal DOM implementation\n\n* *note xml.dom.pulldom: 11e.: support for building partial DOM trees\n\n* *note xml.sax: 124.: SAX2 base classes and convenience functions\n\n* *note xml.parsers.expat: 121.: the Expat parser binding\n\n* Menu:\n\n* XML vulnerabilities::\n* The defusedxml Package::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/xml/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: XML vulnerabilities,  Next: The defusedxml Package,  Up: XML Processing Modules": {
            "content": "5.20.4.1 XML vulnerabilities\n............................\n",
            "subsections": []
        },
        "The XML processing modules are not secure against maliciously": {
            "content": "constructed data.  An attacker can abuse XML features to carry out\ndenial of service attacks, access local files, generate network\nconnections to other machines, or circumvent firewalls.\n",
            "subsections": []
        },
        "The following table gives an overview of the known attacks and whether": {
            "content": "the various modules are vulnerable to them.\n\nkind                          sax                    etree                  minidom                pulldom                xmlrpc\n\n-------------------------------------------------------------------------------------------------------------------------------------------------\n\nbillion laughs                'Vulnerable' (1)       'Vulnerable' (1)       'Vulnerable' (1)       'Vulnerable' (1)       'Vulnerable' (1)\n\n\nquadratic blowup              'Vulnerable' (1)       'Vulnerable' (1)       'Vulnerable' (1)       'Vulnerable' (1)       'Vulnerable' (1)\n\n\nexternal entity expansion     Safe (5)               Safe (2)               Safe (3)               Safe (5)               Safe (4)\n\n\nDTD(1) retrieval              Safe (5)               Safe                   Safe                   Safe (5)               Safe\n\n\ndecompression bomb            Safe                   Safe                   Safe                   Safe                   'Vulnerable'\n\n\nlarge tokens                  'Vulnerable' (6)       'Vulnerable' (6)       'Vulnerable' (6)       'Vulnerable' (6)       'Vulnerable' (6)\n\n\n1. Expat 2.4.1 and newer is not vulnerable to the \"billion laughs\" and\n\"quadratic blowup\" vulnerabilities.  Items still listed as\nvulnerable due to potential reliance on system-provided libraries.\nCheck 'pyexpat.EXPATVERSION'.\n\n2. *note xml.etree.ElementTree: 120. doesn't expand external entities\nand raises a *note ParseError: 10f0. when an entity occurs.\n\n3. *note xml.dom.minidom: 11d. doesn't expand external entities and\nsimply returns the unexpanded entity verbatim.\n\n4. *note xmlrpc.client: 128. doesn't expand external entities and\nomits them.\n\n5. Since Python 3.7.1, external general entities are no longer\nprocessed by default.\n\n6. Expat 2.6.0 and newer is not vulnerable to denial of service\nthrough quadratic runtime caused by parsing large tokens.  Items\nstill listed as vulnerable due to potential reliance on\nsystem-provided libraries.  Check 'pyexpat.EXPATVERSION'.\n\nbillion laughs / exponential entity expansion\n\nThe Billion Laughs(2) attack - also known as exponential entity\nexpansion - uses multiple levels of nested entities.  Each entity\nrefers to another entity several times, and the final entity\ndefinition contains a small string.  The exponential expansion\nresults in several gigabytes of text and consumes lots of memory\nand CPU time.\n\nquadratic blowup entity expansion\n\nA quadratic blowup attack is similar to a Billion Laughs(3) attack;\nit abuses entity expansion, too.  Instead of nested entities it\nrepeats one large entity with a couple of thousand chars over and\nover again.  The attack isn't as efficient as the exponential case\nbut it avoids triggering parser countermeasures that forbid deeply\nnested entities.\n\nexternal entity expansion\n\nEntity declarations can contain more than just text for\nreplacement.  They can also point to external resources or local\nfiles.  The XML parser accesses the resource and embeds the content\ninto the XML document.\n\nDTD(4) retrieval\n\nSome XML libraries like Python's *note xml.dom.pulldom: 11e.\nretrieve document type definitions from remote or local locations.\nThe feature has similar implications as the external entity\nexpansion issue.\n\ndecompression bomb\n\nDecompression bombs (aka ZIP bomb(5)) apply to all XML libraries\nthat can parse compressed XML streams such as gzipped HTTP streams\nor LZMA-compressed files.  For an attacker it can reduce the amount\nof transmitted data by three magnitudes or more.\n\nlarge tokens\n\nExpat needs to re-parse unfinished tokens; without the protection\nintroduced in Expat 2.6.0, this can lead to quadratic runtime that\ncan be used to cause denial of service in the application parsing\nXML. The issue is known as CVE-2023-52425(6).\n",
            "subsections": []
        },
        "The documentation for defusedxml(7) on PyPI has further information": {
            "content": "about all known attack vectors with examples and references.\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Documenttypedefinition\n\n(2) https://en.wikipedia.org/wiki/Billionlaughs\n\n(3) https://en.wikipedia.org/wiki/Billionlaughs\n\n(4) https://en.wikipedia.org/wiki/Documenttypedefinition\n\n(5) https://en.wikipedia.org/wiki/Zipbomb\n\n(6) https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-52425\n\n(7) https://pypi.org/project/defusedxml/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The defusedxml Package,  Prev: XML vulnerabilities,  Up: XML Processing Modules": {
            "content": "5.20.4.2 The 'defusedxml' Package\n.................................\n\ndefusedxml(1) is a pure Python package with modified subclasses of all\nstdlib XML parsers that prevent any potentially malicious operation.",
            "subsections": []
        },
        "Use of this package is recommended for any server code that parses": {
            "content": "untrusted XML data.  The package also ships with example exploits and\nextended documentation on more XML exploits such as XPath injection.\n\n---------- Footnotes ----------\n\n(1) https://pypi.org/project/defusedxml/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "'Source code:' Lib/xml/etree/ElementTree.py(1)\n\n\n\nThe *note xml.etree.ElementTree: 120. module implements a simple and\nefficient API for parsing and creating XML data.\n",
            "subsections": []
        },
        "Changed in version 3.3: This module will use a fast implementation": {
            "content": "whenever available.\n",
            "subsections": []
        },
        "Deprecated since version 3.3: The 'xml.etree.cElementTree' module is": {
            "content": "deprecated.\n\nWarning: The *note xml.etree.ElementTree: 120. module is not secure\nagainst maliciously constructed data.  If you need to parse\nuntrusted or unauthenticated data see *note XML vulnerabilities:\n33aa.\n\n* Menu:\n\n* Tutorial: Tutorial<2>.\n* XPath support::\n* Reference: Reference<3>.\n* XInclude support::\n* Reference: Reference<4>.\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/xml/etree/ElementTree.py\n\nFile: python3.12.info,  Node: Tutorial<2>,  Next: XPath support,  Up: xml etree ElementTree -- The ElementTree XML API\n\n5.20.5.1 Tutorial\n.................\n\nThis is a short tutorial for using *note xml.etree.ElementTree: 120.\n('ET' in short).  The goal is to demonstrate some of the building blocks\nand basic concepts of the module.\n\n* Menu:\n\n* XML tree and elements::\n* Parsing XML::\n* Pull API for non-blocking parsing::\n* Finding interesting elements::\n* Modifying an XML File::\n* Building XML documents::\n* Parsing XML with Namespaces::\n\nFile: python3.12.info,  Node: XML tree and elements,  Next: Parsing XML,  Up: Tutorial<2>\n\n5.20.5.2 XML tree and elements\n..............................\n\nXML is an inherently hierarchical data format, and the most natural way\nto represent it is with a tree.  'ET' has two classes for this purpose -\n*note ElementTree: 76e. represents the whole XML document as a tree, and\n*note Element: 23e. represents a single node in this tree.  Interactions\nwith the whole document (reading and writing to/from files) are usually\ndone on the *note ElementTree: 76e. level.  Interactions with a single\nXML element and its sub-elements are done on the *note Element: 23e.\nlevel.\n\nFile: python3.12.info,  Node: Parsing XML,  Next: Pull API for non-blocking parsing,  Prev: XML tree and elements,  Up: Tutorial<2>\n\n5.20.5.3 Parsing XML\n....................\n",
            "subsections": []
        },
        "We'll be using the fictive 'countrydata.xml' XML document as the sample": {
            "content": "data for this section:\n\n<?xml version=\"1.0\"?>\n<data>\n<country name=\"Liechtenstein\">\n<rank>1</rank>\n<year>2008</year>\n<gdppc>141100</gdppc>\n<neighbor name=\"Austria\" direction=\"E\"/>\n<neighbor name=\"Switzerland\" direction=\"W\"/>\n</country>\n<country name=\"Singapore\">\n<rank>4</rank>\n<year>2011</year>\n<gdppc>59900</gdppc>\n<neighbor name=\"Malaysia\" direction=\"N\"/>\n</country>\n<country name=\"Panama\">\n<rank>68</rank>\n<year>2011</year>\n<gdppc>13600</gdppc>\n<neighbor name=\"Costa Rica\" direction=\"W\"/>\n<neighbor name=\"Colombia\" direction=\"E\"/>\n</country>\n</data>\n\nWe can import this data by reading from a file:\n\nimport xml.etree.ElementTree as ET\ntree = ET.parse('countrydata.xml')\nroot = tree.getroot()\n\nOr directly from a string:\n\nroot = ET.fromstring(countrydataasstring)\n\n*note fromstring(): 33b4. parses XML from a string directly into an\n*note Element: 23e, which is the root element of the parsed tree.  Other\nparsing functions may create an *note ElementTree: 76e.  Check the\ndocumentation to be sure.\n\nAs an *note Element: 23e, 'root' has a tag and a dictionary of\nattributes:\n\n>>> root.tag\n'data'\n>>> root.attrib\n{}\n\nIt also has children nodes over which we can iterate:\n\n>>> for child in root:\n...     print(child.tag, child.attrib)\n...\ncountry {'name': 'Liechtenstein'}\ncountry {'name': 'Singapore'}\ncountry {'name': 'Panama'}\n\nChildren are nested, and we can access specific child nodes by index:\n\n>>> root[0][1].text\n'2008'\n\nNote: Not all elements of the XML input will end up as elements of\nthe parsed tree.  Currently, this module skips over any XML\ncomments, processing instructions, and document type declarations\nin the input.  Nevertheless, trees built using this module's API\nrather than parsing from XML text can have comments and processing\ninstructions in them; they will be included when generating XML\noutput.  A document type declaration may be accessed by passing a\ncustom *note TreeBuilder: 881. instance to the *note XMLParser:\n880. constructor.\n\nFile: python3.12.info,  Node: Pull API for non-blocking parsing,  Next: Finding interesting elements,  Prev: Parsing XML,  Up: Tutorial<2>\n\n5.20.5.4 Pull API for non-blocking parsing\n..........................................\n",
            "subsections": []
        },
        "Most parsing functions provided by this module require the whole": {
            "content": "document to be read at once before returning any result.  It is possible\nto use an *note XMLParser: 880. and feed data into it incrementally, but\nit is a push API that calls methods on a callback target, which is too\nlow-level and inconvenient for most needs.  Sometimes what the user\nreally wants is to be able to parse XML incrementally, without blocking\noperations, while enjoying the convenience of fully constructed *note\nElement: 23e. objects.\n\nThe most powerful tool for doing this is *note XMLPullParser: e66.  It\ndoes not require a blocking read to obtain the XML data, and is instead\nfed with data incrementally with *note XMLPullParser.feed(): 33b6.\ncalls.  To get the parsed XML elements, call *note\nXMLPullParser.readevents(): 33b7.  Here is an example:\n\n>>> parser = ET.XMLPullParser(['start', 'end'])\n>>> parser.feed('<mytag>sometext')\n>>> list(parser.readevents())\n[('start', <Element 'mytag' at 0x7fa66db2be58>)]\n>>> parser.feed(' more text</mytag>')\n>>> for event, elem in parser.readevents():\n...     print(event)\n...     print(elem.tag, 'text=', elem.text)\n...\nend\nmytag text= sometext more text\n",
            "subsections": []
        },
        "The obvious use case is applications that operate in a non-blocking": {
            "content": "fashion where the XML data is being received from a socket or read\nincrementally from some storage device.  In such cases, blocking reads\nare unacceptable.\n\nBecause it's so flexible, *note XMLPullParser: e66. can be inconvenient\nto use for simpler use-cases.  If you don't mind your application\nblocking on reading XML data but would still like to have incremental\nparsing capabilities, take a look at *note iterparse(): e88.  It can be\nuseful when you're reading a large XML document and don't want to hold\nit wholly in memory.\n",
            "subsections": []
        },
        "Where 'immediate' feedback through events is wanted, calling method": {
            "content": "*note XMLPullParser.flush(): 13ac. can help reduce delay; please make\nsure to study the related security notes.\n\nFile: python3.12.info,  Node: Finding interesting elements,  Next: Modifying an XML File,  Prev: Pull API for non-blocking parsing,  Up: Tutorial<2>\n\n5.20.5.5 Finding interesting elements\n.....................................\n\n*note Element: 23e. has some useful methods that help iterate\nrecursively over all the sub-tree below it (its children, their\nchildren, and so on).  For example, *note Element.iter(): 11c8.:\n\n>>> for neighbor in root.iter('neighbor'):\n...     print(neighbor.attrib)\n...\n{'name': 'Austria', 'direction': 'E'}\n{'name': 'Switzerland', 'direction': 'W'}\n{'name': 'Malaysia', 'direction': 'N'}\n{'name': 'Costa Rica', 'direction': 'W'}\n{'name': 'Colombia', 'direction': 'E'}\n\n*note Element.findall(): 33b9. finds only elements with a tag which are\ndirect children of the current element.  *note Element.find(): 33ba.\nfinds the 'first' child with a particular tag, and *note Element.text:\n33bb. accesses the element's text content.  *note Element.get(): 33bc.\naccesses the element's attributes:\n\n>>> for country in root.findall('country'):\n...     rank = country.find('rank').text\n...     name = country.get('name')\n...     print(name, rank)\n...\nLiechtenstein 1\nSingapore 4\nPanama 68\n",
            "subsections": []
        },
        "More sophisticated specification of which elements to look for is": {
            "content": "possible by using *note XPath: 9f1.\n\nFile: python3.12.info,  Node: Modifying an XML File,  Next: Building XML documents,  Prev: Finding interesting elements,  Up: Tutorial<2>\n\n5.20.5.6 Modifying an XML File\n..............................\n\n*note ElementTree: 76e. provides a simple way to build XML documents and\nwrite them to files.  The *note ElementTree.write(): e6a. method serves\nthis purpose.\n\nOnce created, an *note Element: 23e. object may be manipulated by\ndirectly changing its fields (such as *note Element.text: 33bb.), adding\nand modifying attributes (*note Element.set(): 33be. method), as well as\nadding new children (for example with *note Element.append(): 33bf.).\n",
            "subsections": []
        },
        "Let's say we want to add one to each country's rank, and add an": {
            "content": "'updated' attribute to the rank element:\n\n>>> for rank in root.iter('rank'):\n...     newrank = int(rank.text) + 1\n...     rank.text = str(newrank)\n...     rank.set('updated', 'yes')\n...\n>>> tree.write('output.xml')\n\nOur XML now looks like this:\n\n<?xml version=\"1.0\"?>\n<data>\n<country name=\"Liechtenstein\">\n<rank updated=\"yes\">2</rank>\n<year>2008</year>\n<gdppc>141100</gdppc>\n<neighbor name=\"Austria\" direction=\"E\"/>\n<neighbor name=\"Switzerland\" direction=\"W\"/>\n</country>\n<country name=\"Singapore\">\n<rank updated=\"yes\">5</rank>\n<year>2011</year>\n<gdppc>59900</gdppc>\n<neighbor name=\"Malaysia\" direction=\"N\"/>\n</country>\n<country name=\"Panama\">\n<rank updated=\"yes\">69</rank>\n<year>2011</year>\n<gdppc>13600</gdppc>\n<neighbor name=\"Costa Rica\" direction=\"W\"/>\n<neighbor name=\"Colombia\" direction=\"E\"/>\n</country>\n</data>\n\nWe can remove elements using *note Element.remove(): 33c0.  Let's say we\nwant to remove all countries with a rank higher than 50:\n\n>>> for country in root.findall('country'):\n...     # using root.findall() to avoid removal during traversal\n...     rank = int(country.find('rank').text)\n...     if rank > 50:\n...         root.remove(country)\n...\n>>> tree.write('output.xml')\n",
            "subsections": []
        },
        "Note that concurrent modification while iterating can lead to problems,": {
            "content": "just like when iterating and modifying Python lists or dicts.",
            "subsections": []
        },
        "Therefore, the example first collects all matching elements with": {
            "content": "'root.findall()', and only then iterates over the list of matches.\n\nOur XML now looks like this:\n\n<?xml version=\"1.0\"?>\n<data>\n<country name=\"Liechtenstein\">\n<rank updated=\"yes\">2</rank>\n<year>2008</year>\n<gdppc>141100</gdppc>\n<neighbor name=\"Austria\" direction=\"E\"/>\n<neighbor name=\"Switzerland\" direction=\"W\"/>\n</country>\n<country name=\"Singapore\">\n<rank updated=\"yes\">5</rank>\n<year>2011</year>\n<gdppc>59900</gdppc>\n<neighbor name=\"Malaysia\" direction=\"N\"/>\n</country>\n</data>\n\nFile: python3.12.info,  Node: Building XML documents,  Next: Parsing XML with Namespaces,  Prev: Modifying an XML File,  Up: Tutorial<2>\n\n5.20.5.7 Building XML documents\n...............................\n\nThe *note SubElement(): 33c2. function also provides a convenient way to\ncreate new sub-elements for a given element:\n\n>>> a = ET.Element('a')\n>>> b = ET.SubElement(a, 'b')\n>>> c = ET.SubElement(a, 'c')\n>>> d = ET.SubElement(c, 'd')\n>>> ET.dump(a)\n<a><b /><c><d /></c></a>\n\nFile: python3.12.info,  Node: Parsing XML with Namespaces,  Prev: Building XML documents,  Up: Tutorial<2>\n\n5.20.5.8 Parsing XML with Namespaces\n....................................\n",
            "subsections": []
        },
        "If the XML input has namespaces(1), tags and attributes with prefixes in": {
            "content": "the form 'prefix:sometag' get expanded to '{uri}sometag' where the\n'prefix' is replaced by the full 'URI'. Also, if there is a default\nnamespace(2), that full URI gets prepended to all of the non-prefixed\ntags.\n",
            "subsections": []
        },
        "Here is an XML example that incorporates two namespaces, one with the": {
            "content": "prefix \"fictional\" and the other serving as the default namespace:\n\n<?xml version=\"1.0\"?>\n<actors xmlns:fictional=\"http://characters.example.com\"\nxmlns=\"http://people.example.com\">\n<actor>\n<name>John Cleese</name>\n<fictional:character>Lancelot</fictional:character>\n<fictional:character>Archie Leach</fictional:character>\n</actor>\n<actor>\n<name>Eric Idle</name>\n<fictional:character>Sir Robin</fictional:character>\n<fictional:character>Gunther</fictional:character>\n<fictional:character>Commander Clement</fictional:character>\n</actor>\n</actors>\n",
            "subsections": []
        },
        "One way to search and explore this XML example is to manually add the": {
            "content": "URI to every tag or attribute in the xpath of a *note find(): 33ba. or\n*note findall(): 33b9.:\n\nroot = fromstring(xmltext)\nfor actor in root.findall('{http://people.example.com}actor'):\nname = actor.find('{http://people.example.com}name')\nprint(name.text)\nfor char in actor.findall('{http://characters.example.com}character'):\nprint(' |-->', char.text)\n\nA better way to search the namespaced XML example is to create a\ndictionary with your own prefixes and use those in the search functions:\n\nns = {'realperson': 'http://people.example.com',\n'role': 'http://characters.example.com'}\n\nfor actor in root.findall('realperson:actor', ns):\nname = actor.find('realperson:name', ns)\nprint(name.text)\nfor char in actor.findall('role:character', ns):\nprint(' |-->', char.text)\n\nThese two approaches both output:\n\nJohn Cleese\n|--> Lancelot\n|--> Archie Leach\nEric Idle\n|--> Sir Robin\n|--> Gunther\n|--> Commander Clement\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/XMLnamespace\n\n(2) https://www.w3.org/TR/xml-names/#defaulting\n\nFile: python3.12.info,  Node: XPath support,  Next: Reference<3>,  Prev: Tutorial<2>,  Up: xml etree ElementTree -- The ElementTree XML API\n\n5.20.5.9 XPath support\n......................\n",
            "subsections": []
        },
        "This module provides limited support for XPath expressions(1) for": {
            "content": "locating elements in a tree.  The goal is to support a small subset of\nthe abbreviated syntax; a full XPath engine is outside the scope of the\nmodule.\n\n* Menu:\n\n* Example: Example<9>.\n* Supported XPath syntax::\n\n---------- Footnotes ----------\n\n(1) https://www.w3.org/TR/xpath\n\nFile: python3.12.info,  Node: Example<9>,  Next: Supported XPath syntax,  Up: XPath support\n\n5.20.5.10 Example\n.................\n",
            "subsections": []
        },
        "Here's an example that demonstrates some of the XPath capabilities of": {
            "content": "the module.  We'll be using the 'countrydata' XML document from the\n*note Parsing XML: 33b2. section:\n\nimport xml.etree.ElementTree as ET\n\nroot = ET.fromstring(countrydata)\n\n# Top-level elements\nroot.findall(\".\")\n\n# All 'neighbor' grand-children of 'country' children of the top-level\n# elements\nroot.findall(\"./country/neighbor\")\n\n# Nodes with name='Singapore' that have a 'year' child\nroot.findall(\".//year/..[@name='Singapore']\")\n\n# 'year' nodes that are children of nodes with name='Singapore'\nroot.findall(\".//*[@name='Singapore']/year\")\n\n# All 'neighbor' nodes that are the second child of their parent\nroot.findall(\".//neighbor[2]\")\n\nFor XML with namespaces, use the usual qualified '{namespace}tag'\nnotation:\n\n# All dublin-core \"title\" tags in the document\nroot.findall(\".//{http://purl.org/dc/elements/1.1/}title\")\n\nFile: python3.12.info,  Node: Supported XPath syntax,  Prev: Example<9>,  Up: XPath support\n\n5.20.5.11 Supported XPath syntax\n................................\n",
            "subsections": []
        },
        "Syntax                      Meaning": {
            "content": "---------------------------------------------------------------------------------------\n\n'tag'                       Selects all child elements with the given tag.  For\nexample, 'spam' selects all child elements named 'spam',\nand 'spam/egg' selects all grandchildren named 'egg' in\nall children named 'spam'.  '{namespace}*' selects all\ntags in the given namespace, '{*}spam' selects tags\nnamed 'spam' in any (or no) namespace, and '{}*' only\nselects tags that are not in a namespace.\n\nChanged in version 3.8: Support for star-wildcards was\nadded.\n\n\n'*'                         Selects all child elements, including comments and\nprocessing instructions.  For example, '*/egg' selects\nall grandchildren named 'egg'.\n\n\n'.'                         Selects the current node.  This is mostly useful at the\nbeginning of the path, to indicate that it's a relative\npath.\n\n\n'//'                        Selects all subelements, on all levels beneath the\ncurrent element.  For example, './/egg' selects all\n'egg' elements in the entire tree.\n\n\n'..'                        Selects the parent element.  Returns 'None' if the path\nattempts to reach the ancestors of the start element\n(the element 'find' was called on).\n\n\n'[@attrib]'                 Selects all elements that have the given attribute.\n\n\n'[@attrib='value']'         Selects all elements for which the given attribute has\nthe given value.  The value cannot contain quotes.\n\n\n'[@attrib!='value']'        Selects all elements for which the given attribute does\nnot have the given value.  The value cannot contain\nquotes.\n\nNew in version 3.10.\n\n\n'[tag]'                     Selects all elements that have a child named 'tag'.\nOnly immediate children are supported.\n\n\n'[.='text']'                Selects all elements whose complete text content,\nincluding descendants, equals the given 'text'.\n\nNew in version 3.7.\n\n\n'[.!='text']'               Selects all elements whose complete text content,\nincluding descendants, does not equal the given 'text'.\n\nNew in version 3.10.\n\n\n'[tag='text']'              Selects all elements that have a child named 'tag' whose\ncomplete text content, including descendants, equals the\ngiven 'text'.\n\n\n'[tag!='text']'             Selects all elements that have a child named 'tag' whose\ncomplete text content, including descendants, does not\nequal the given 'text'.\n\nNew in version 3.10.\n\n\n'[position]'                Selects all elements that are located at the given\nposition.  The position can be either an integer (1 is\nthe first position), the expression 'last()' (for the\nlast position), or a position relative to the last\nposition (e.g.  'last()-1').\n\n",
            "subsections": []
        },
        "Predicates (expressions within square brackets) must be preceded by a": {
            "content": "tag name, an asterisk, or another predicate.  'position' predicates must\nbe preceded by a tag name.\n\nFile: python3.12.info,  Node: Reference<3>,  Next: XInclude support,  Prev: XPath support,  Up: xml etree ElementTree -- The ElementTree XML API\n\n5.20.5.12 Reference\n...................\n\n* Menu:\n\n* Functions: Functions<9>.\n\nFile: python3.12.info,  Node: Functions<9>,  Up: Reference<3>\n\n5.20.5.13 Functions\n...................\n\n-- Function: xml.etree.ElementTree.canonicalize (xmldata=None, *,\nout=None, fromfile=None, options)\n\nC14N 2.0(1) transformation function.\n\nCanonicalization is a way to normalise XML output in a way that\nallows byte-by-byte comparisons and digital signatures.  It reduced\nthe freedom that XML serializers have and instead generates a more\nconstrained XML representation.  The main restrictions regard the\nplacement of namespace declarations, the ordering of attributes,\nand ignorable whitespace.\n\nThis function takes an XML data string ('xmldata') or a file path\nor file-like object ('fromfile') as input, converts it to the\ncanonical form, and writes it out using the 'out' file(-like)\nobject, if provided, or returns it as a text string if not.  The\noutput file receives text, not bytes.  It should therefore be\nopened in text mode with 'utf-8' encoding.\n\nTypical uses:\n\nxmldata = \"<root>...</root>\"\nprint(canonicalize(xmldata))\n\nwith open(\"c14noutput.xml\", mode='w', encoding='utf-8') as outfile:\ncanonicalize(xmldata, out=outfile)\n\nwith open(\"c14noutput.xml\", mode='w', encoding='utf-8') as outfile:\ncanonicalize(fromfile=\"inputfile.xml\", out=outfile)\n\nThe configuration 'options' are as follows:\n\n- 'withcomments': set to true to include comments (default:\nfalse)\n\n-\n'striptext': set to true to strip whitespace before and after text content\n\n(default: false)\n\n-\n'rewriteprefixes': set to true to replace namespace prefixes by \"n{number}\"\n\n(default: false)\n\n-\n'qnameawaretags': a set of qname aware tag names in which prefixes\n\nshould be replaced in text content (default: empty)\n\n-\n'qnameawareattrs': a set of qname aware attribute names in which prefixes\n\nshould be replaced in text content (default: empty)\n\n- 'excludeattrs': a set of attribute names that should not be\nserialised\n\n- 'excludetags': a set of tag names that should not be\nserialised\n\nIn the option list above, \"a set\" refers to any collection or\niterable of strings, no ordering is expected.\n\nNew in version 3.8.\n\n-- Function: xml.etree.ElementTree.Comment (text=None)\n\nComment element factory.  This factory function creates a special\nelement that will be serialized as an XML comment by the standard\nserializer.  The comment string can be either a bytestring or a\nUnicode string.  'text' is a string containing the comment string.\nReturns an element instance representing a comment.\n\nNote that *note XMLParser: 880. skips over comments in the input\ninstead of creating comment objects for them.  An *note\nElementTree: 76e. will only contain comment nodes if they have been\ninserted into to the tree using one of the *note Element: 23e.\nmethods.\n\n-- Function: xml.etree.ElementTree.dump (elem)\n\nWrites an element tree or element structure to sys.stdout.  This\nfunction should be used for debugging only.\n\nThe exact output format is implementation dependent.  In this\nversion, it's written as an ordinary XML file.\n\n'elem' is an element tree or an individual element.\n\nChanged in version 3.8: The *note dump(): 33cc. function now\npreserves the attribute order specified by the user.\n\n-- Function: xml.etree.ElementTree.fromstring (text, parser=None)\n\nParses an XML section from a string constant.  Same as *note XML():\n33cd.  'text' is a string containing XML data.  'parser' is an\noptional parser instance.  If not given, the standard *note\nXMLParser: 880. parser is used.  Returns an *note Element: 23e.\ninstance.\n\n-- Function: xml.etree.ElementTree.fromstringlist (sequence,\nparser=None)\n\nParses an XML document from a sequence of string fragments.\n'sequence' is a list or other sequence containing XML data\nfragments.  'parser' is an optional parser instance.  If not given,\nthe standard *note XMLParser: 880. parser is used.  Returns an\n*note Element: 23e. instance.\n\nNew in version 3.2.\n\n-- Function: xml.etree.ElementTree.indent (tree, space=' ', level=0)\n\nAppends whitespace to the subtree to indent the tree visually.\nThis can be used to generate pretty-printed XML output.  'tree' can\nbe an Element or ElementTree.  'space' is the whitespace string\nthat will be inserted for each indentation level, two space\ncharacters by default.  For indenting partial subtrees inside of an\nalready indented tree, pass the initial indentation level as\n'level'.\n\nNew in version 3.9.\n\n-- Function: xml.etree.ElementTree.iselement (element)\n\nCheck if an object appears to be a valid element object.  'element'\nis an element instance.  Return 'True' if this is an element\nobject.\n\n-- Function: xml.etree.ElementTree.iterparse (source, events=None,\nparser=None)\n\nParses an XML section into an element tree incrementally, and\nreports what's going on to the user.  'source' is a filename or\n*note file object: 1037. containing XML data.  'events' is a\nsequence of events to report back.  The supported events are the\nstrings '\"start\"', '\"end\"', '\"comment\"', '\"pi\"', '\"start-ns\"' and\n'\"end-ns\"' (the \"ns\" events are used to get detailed namespace\ninformation).  If 'events' is omitted, only '\"end\"' events are\nreported.  'parser' is an optional parser instance.  If not given,\nthe standard *note XMLParser: 880. parser is used.  'parser' must\nbe a subclass of *note XMLParser: 880. and can only use the default\n*note TreeBuilder: 881. as a target.  Returns an *note iterator:\n16a9. providing '(event, elem)' pairs; it has a 'root' attribute\nthat references the root element of the resulting XML tree once\n'source' is fully read.\n\nNote that while *note iterparse(): e88. builds the tree\nincrementally, it issues blocking reads on 'source' (or the file it\nnames).  As such, it's unsuitable for applications where blocking\nreads can't be made.  For fully non-blocking parsing, see *note\nXMLPullParser: e66.\n\nNote: *note iterparse(): e88. only guarantees that it has seen\nthe \">\" character of a starting tag when it emits a \"start\"\nevent, so the attributes are defined, but the contents of the\ntext and tail attributes are undefined at that point.  The\nsame applies to the element children; they may or may not be\npresent.\n\nIf you need a fully populated element, look for \"end\" events\ninstead.\n\nDeprecated since version 3.4: The 'parser' argument.\n\nChanged in version 3.8: The 'comment' and 'pi' events were added.\n\n-- Function: xml.etree.ElementTree.parse (source, parser=None)\n\nParses an XML section into an element tree.  'source' is a filename\nor file object containing XML data.  'parser' is an optional parser\ninstance.  If not given, the standard *note XMLParser: 880. parser\nis used.  Returns an *note ElementTree: 76e. instance.\n\n-- Function: xml.etree.ElementTree.ProcessingInstruction (target,\ntext=None)\n\nPI element factory.  This factory function creates a special\nelement that will be serialized as an XML processing instruction.\n'target' is a string containing the PI target.  'text' is a string\ncontaining the PI contents, if given.  Returns an element instance,\nrepresenting a processing instruction.\n\nNote that *note XMLParser: 880. skips over processing instructions\nin the input instead of creating PI objects for them.  An *note\nElementTree: 76e. will only contain processing instruction nodes if\nthey have been inserted into to the tree using one of the *note\nElement: 23e. methods.\n\n-- Function: xml.etree.ElementTree.registernamespace (prefix, uri)\n\nRegisters a namespace prefix.  The registry is global, and any\nexisting mapping for either the given prefix or the namespace URI\nwill be removed.  'prefix' is a namespace prefix.  'uri' is a\nnamespace uri.  Tags and attributes in this namespace will be\nserialized with the given prefix, if at all possible.\n\nNew in version 3.2.\n\n-- Function: xml.etree.ElementTree.SubElement (parent, tag, attrib={},\nextra)\n\nSubelement factory.  This function creates an element instance, and\nappends it to an existing element.\n\nThe element name, attribute names, and attribute values can be\neither bytestrings or Unicode strings.  'parent' is the parent\nelement.  'tag' is the subelement name.  'attrib' is an optional\ndictionary, containing element attributes.  'extra' contains\nadditional attributes, given as keyword arguments.  Returns an\nelement instance.\n\n-- Function: xml.etree.ElementTree.tostring (element,\nencoding='us-ascii', method='xml', *, xmldeclaration=None,\ndefaultnamespace=None, shortemptyelements=True)\n\nGenerates a string representation of an XML element, including all\nsubelements.  'element' is an *note Element: 23e. instance.\n'encoding' (2) is the output encoding (default is US-ASCII). Use\n'encoding=\"unicode\"' to generate a Unicode string (otherwise, a\nbytestring is generated).  'method' is either '\"xml\"', '\"html\"' or\n'\"text\"' (default is '\"xml\"').  'xmldeclaration',\n'defaultnamespace' and 'shortemptyelements' has the same meaning\nas in *note ElementTree.write(): e6a.  Returns an (optionally)\nencoded string containing the XML data.\n\nChanged in version 3.4: Added the 'shortemptyelements' parameter.\n\nChanged in version 3.8: Added the 'xmldeclaration' and\n'defaultnamespace' parameters.\n\nChanged in version 3.8: The *note tostring(): e68. function now\npreserves the attribute order specified by the user.\n\n-- Function: xml.etree.ElementTree.tostringlist (element,\nencoding='us-ascii', method='xml', *, xmldeclaration=None,\ndefaultnamespace=None, shortemptyelements=True)\n\nGenerates a string representation of an XML element, including all\nsubelements.  'element' is an *note Element: 23e. instance.\n'encoding' (3) is the output encoding (default is US-ASCII). Use\n'encoding=\"unicode\"' to generate a Unicode string (otherwise, a\nbytestring is generated).  'method' is either '\"xml\"', '\"html\"' or\n'\"text\"' (default is '\"xml\"').  'xmldeclaration',\n'defaultnamespace' and 'shortemptyelements' has the same meaning\nas in *note ElementTree.write(): e6a.  Returns a list of\n(optionally) encoded strings containing the XML data.  It does not\nguarantee any specific sequence, except that\n'b\"\".join(tostringlist(element)) == tostring(element)'.\n\nNew in version 3.2.\n\nChanged in version 3.4: Added the 'shortemptyelements' parameter.\n\nChanged in version 3.8: Added the 'xmldeclaration' and\n'defaultnamespace' parameters.\n\nChanged in version 3.8: The *note tostringlist(): e69. function now\npreserves the attribute order specified by the user.\n\n-- Function: xml.etree.ElementTree.XML (text, parser=None)\n\nParses an XML section from a string constant.  This function can be\nused to embed \"XML literals\" in Python code.  'text' is a string\ncontaining XML data.  'parser' is an optional parser instance.  If\nnot given, the standard *note XMLParser: 880. parser is used.\nReturns an *note Element: 23e. instance.\n\n-- Function: xml.etree.ElementTree.XMLID (text, parser=None)\n\nParses an XML section from a string constant, and also returns a\ndictionary which maps from element id:s to elements.  'text' is a\nstring containing XML data.  'parser' is an optional parser\ninstance.  If not given, the standard *note XMLParser: 880. parser\nis used.  Returns a tuple containing an *note Element: 23e.\ninstance and a dictionary.\n\n---------- Footnotes ----------\n\n(1) https://www.w3.org/TR/xml-c14n2/\n\n(2) The encoding string included in XML output should conform to the\nappropriate standards.  For example, \"UTF-8\" is valid, but \"UTF8\" is\nnot.  See\n'https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl' and\n'https://www.iana.org/assignments/character-sets/character-sets.xhtml'.\n\n(3) The encoding string included in XML output should conform to the\nappropriate standards.  For example, \"UTF-8\" is valid, but \"UTF8\" is\nnot.  See\n'https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl' and\n'https://www.iana.org/assignments/character-sets/character-sets.xhtml'.\n\nFile: python3.12.info,  Node: XInclude support,  Next: Reference<4>,  Prev: Reference<3>,  Up: xml etree ElementTree -- The ElementTree XML API\n\n5.20.5.14 XInclude support\n..........................\n",
            "subsections": []
        },
        "This module provides limited support for XInclude directives(1), via the": {
            "content": "*note xml.etree.ElementInclude: 11f. helper module.  This module can be\nused to insert subtrees and text strings into element trees, based on\ninformation in the tree.\n\n* Menu:\n\n* Example: Example<10>.\n\n---------- Footnotes ----------\n\n(1) https://www.w3.org/TR/xinclude/\n\nFile: python3.12.info,  Node: Example<10>,  Up: XInclude support\n\n5.20.5.15 Example\n.................\n",
            "subsections": []
        },
        "Here's an example that demonstrates use of the XInclude module.  To": {
            "content": "include an XML document in the current document, use the\n'{http://www.w3.org/2001/XInclude}include' element and set the 'parse'\nattribute to '\"xml\"', and use the 'href' attribute to specify the\ndocument to include.\n\n<?xml version=\"1.0\"?>\n<document xmlns:xi=\"http://www.w3.org/2001/XInclude\">\n<xi:include href=\"source.xml\" parse=\"xml\" />\n</document>\n",
            "subsections": []
        },
        "By default, the 'href' attribute is treated as a file name.  You can use": {
            "content": "custom loaders to override this behaviour.  Also note that the standard\nhelper does not support XPointer syntax.\n",
            "subsections": []
        },
        "To process this file, load it as usual, and pass the root element to the": {
            "content": "*note xml.etree.ElementTree: 120. module:\n\nfrom xml.etree import ElementTree, ElementInclude\n\ntree = ElementTree.parse(\"document.xml\")\nroot = tree.getroot()\n\nElementInclude.include(root)\n",
            "subsections": []
        },
        "The ElementInclude module replaces the": {
            "content": "'{http://www.w3.org/2001/XInclude}include' element with the root element\nfrom the 'source.xml' document.  The result might look something like\nthis:\n\n<document xmlns:xi=\"http://www.w3.org/2001/XInclude\">\n<para>This is a paragraph.</para>\n</document>\n\nIf the 'parse' attribute is omitted, it defaults to \"xml\".  The href\nattribute is required.\n",
            "subsections": []
        },
        "To include a text document, use the": {
            "content": "'{http://www.w3.org/2001/XInclude}include' element, and set the 'parse'\nattribute to \"text\":\n\n<?xml version=\"1.0\"?>\n<document xmlns:xi=\"http://www.w3.org/2001/XInclude\">\nCopyright (c) <xi:include href=\"year.txt\" parse=\"text\" />.\n</document>\n\nThe result might look something like:\n\n<document xmlns:xi=\"http://www.w3.org/2001/XInclude\">\nCopyright (c) 2003.\n</document>\n\nFile: python3.12.info,  Node: Reference<4>,  Prev: XInclude support,  Up: xml etree ElementTree -- The ElementTree XML API\n\n5.20.5.16 Reference\n...................\n\n* Menu:\n\n* Functions: Functions<10>.\n* Element Objects::\n* ElementTree Objects::\n* QName Objects::\n* TreeBuilder Objects::\n* XMLParser Objects::\n* XMLPullParser Objects::\n* Exceptions: Exceptions<17>.\n\nFile: python3.12.info,  Node: Functions<10>,  Next: Element Objects,  Up: Reference<4>\n\n5.20.5.17 Functions\n...................\n\n-- Function: xml.etree.ElementInclude.defaultloader (href, parse,\nencoding=None)\n\nDefault loader.  This default loader reads an included resource\nfrom disk.  'href' is a URL. 'parse' is for parse mode either \"xml\"\nor \"text\".  'encoding' is an optional text encoding.  If not given,\nencoding is 'utf-8'.  Returns the expanded resource.  If the parse\nmode is '\"xml\"', this is an ElementTree instance.  If the parse\nmode is \"text\", this is a Unicode string.  If the loader fails, it\ncan return None or raise an exception.\n\n-- Function: xml.etree.ElementInclude.include (elem, loader=None,\nbaseurl=None, maxdepth=6)\n\nThis function expands XInclude directives.  'elem' is the root\nelement.  'loader' is an optional resource loader.  If omitted, it\ndefaults to *note defaultloader(): 33d9.  If given, it should be a\ncallable that implements the same interface as *note\ndefaultloader(): 33d9.  'baseurl' is base URL of the original\nfile, to resolve relative include file references.  'maxdepth' is\nthe maximum number of recursive inclusions.  Limited to reduce the\nrisk of malicious content explosion.  Pass a negative value to\ndisable the limitation.\n\nReturns the expanded resource.  If the parse mode is '\"xml\"', this\nis an ElementTree instance.  If the parse mode is \"text\", this is a\nUnicode string.  If the loader fails, it can return None or raise\nan exception.\n\nChanged in version 3.9: Added the 'baseurl' and 'maxdepth'\nparameters.\n\nFile: python3.12.info,  Node: Element Objects,  Next: ElementTree Objects,  Prev: Functions<10>,  Up: Reference<4>\n\n5.20.5.18 Element Objects\n.........................\n\n-- Class: xml.etree.ElementTree.Element (tag, attrib={}, extra)\n\nElement class.  This class defines the Element interface, and\nprovides a reference implementation of this interface.\n\nThe element name, attribute names, and attribute values can be\neither bytestrings or Unicode strings.  'tag' is the element name.\n'attrib' is an optional dictionary, containing element attributes.\n'extra' contains additional attributes, given as keyword arguments.\n\n-- Attribute: tag\n\nA string identifying what kind of data this element represents\n(the element type, in other words).\n\n-- Attribute: text\n-- Attribute: tail\n\nThese attributes can be used to hold additional data\nassociated with the element.  Their values are usually strings\nbut may be any application-specific object.  If the element is\ncreated from an XML file, the 'text' attribute holds either\nthe text between the element's start tag and its first child\nor end tag, or 'None', and the 'tail' attribute holds either\nthe text between the element's end tag and the next tag, or\n'None'.  For the XML data\n\n<a><b>1<c>2<d/>3</c></b>4</a>\n\nthe 'a' element has 'None' for both 'text' and 'tail'\nattributes, the 'b' element has 'text' '\"1\"' and 'tail' '\"4\"',\nthe 'c' element has 'text' '\"2\"' and 'tail' 'None', and the\n'd' element has 'text' 'None' and 'tail' '\"3\"'.\n\nTo collect the inner text of an element, see *note itertext():\n1049, for example '\"\".join(element.itertext())'.\n\nApplications may store arbitrary objects in these attributes.\n\n-- Attribute: attrib\n\nA dictionary containing the element's attributes.  Note that\nwhile the 'attrib' value is always a real mutable Python\ndictionary, an ElementTree implementation may choose to use\nanother internal representation, and create the dictionary\nonly if someone asks for it.  To take advantage of such\nimplementations, use the dictionary methods below whenever\npossible.\n\nThe following dictionary-like methods work on the element\nattributes.\n\n-- Method: clear ()\n\nResets an element.  This function removes all subelements,\nclears all attributes, and sets the text and tail attributes\nto 'None'.\n\n-- Method: get (key, default=None)\n\nGets the element attribute named 'key'.\n\nReturns the attribute value, or 'default' if the attribute was\nnot found.\n\n-- Method: items ()\n\nReturns the element attributes as a sequence of (name, value)\npairs.  The attributes are returned in an arbitrary order.\n\n-- Method: keys ()\n\nReturns the elements attribute names as a list.  The names are\nreturned in an arbitrary order.\n\n-- Method: set (key, value)\n\nSet the attribute 'key' on the element to 'value'.\n\nThe following methods work on the element's children (subelements).\n\n-- Method: append (subelement)\n\nAdds the element 'subelement' to the end of this element's\ninternal list of subelements.  Raises *note TypeError: 28e. if\n'subelement' is not an *note Element: 23e.\n\n-- Method: extend (subelements)\n\nAppends 'subelements' from a sequence object with zero or more\nelements.  Raises *note TypeError: 28e. if a subelement is not\nan *note Element: 23e.\n\nNew in version 3.2.\n\n-- Method: find (match, namespaces=None)\n\nFinds the first subelement matching 'match'.  'match' may be a\ntag name or a *note path: 9f1.  Returns an element instance or\n'None'.  'namespaces' is an optional mapping from namespace\nprefix to full name.  Pass '''' as prefix to move all\nunprefixed tag names in the expression into the given\nnamespace.\n\n-- Method: findall (match, namespaces=None)\n\nFinds all matching subelements, by tag name or *note path:\n9f1.  Returns a list containing all matching elements in\ndocument order.  'namespaces' is an optional mapping from\nnamespace prefix to full name.  Pass '''' as prefix to move\nall unprefixed tag names in the expression into the given\nnamespace.\n\n-- Method: findtext (match, default=None, namespaces=None)\n\nFinds text for the first subelement matching 'match'.  'match'\nmay be a tag name or a *note path: 9f1.  Returns the text\ncontent of the first matching element, or 'default' if no\nelement was found.  Note that if the matching element has no\ntext content an empty string is returned.  'namespaces' is an\noptional mapping from namespace prefix to full name.  Pass\n'''' as prefix to move all unprefixed tag names in the\nexpression into the given namespace.\n\n-- Method: insert (index, subelement)\n\nInserts 'subelement' at the given position in this element.\nRaises *note TypeError: 28e. if 'subelement' is not an *note\nElement: 23e.\n\n-- Method: iter (tag=None)\n\nCreates a tree *note iterator: 16a9. with the current element\nas the root.  The iterator iterates over this element and all\nelements below it, in document (depth first) order.  If 'tag'\nis not 'None' or ''*'', only elements whose tag equals 'tag'\nare returned from the iterator.  If the tree structure is\nmodified during iteration, the result is undefined.\n\nNew in version 3.2.\n\n-- Method: iterfind (match, namespaces=None)\n\nFinds all matching subelements, by tag name or *note path:\n9f1.  Returns an iterable yielding all matching elements in\ndocument order.  'namespaces' is an optional mapping from\nnamespace prefix to full name.\n\nNew in version 3.2.\n\n-- Method: itertext ()\n\nCreates a text iterator.  The iterator loops over this element\nand all subelements, in document order, and returns all inner\ntext.\n\nNew in version 3.2.\n\n-- Method: makeelement (tag, attrib)\n\nCreates a new element object of the same type as this element.\nDo not call this method, use the *note SubElement(): 33c2.\nfactory function instead.\n\n-- Method: remove (subelement)\n\nRemoves 'subelement' from the element.  Unlike the find*\nmethods this method compares elements based on the instance\nidentity, not on tag value or contents.\n\n*note Element: 23e. objects also support the following sequence\ntype methods for working with subelements: *note delitem():\n1321, *note getitem(): 4b9, *note setitem(): 1320, *note\nlen(): 1c68.\n\nCaution: Elements with no subelements will test as 'False'.\nTesting the truth value of an Element is deprecated and will raise\nan exception in Python 3.14.  Use specific 'len(elem)' or 'elem is\nNone' test instead.:\n\nelement = root.find('foo')\n\nif not element:  # careful!\nprint(\"element not found, or element has no subelements\")\n\nif element is None:\nprint(\"element not found\")\n\nChanged in version 3.12: Testing the truth value of an Element\nemits *note DeprecationWarning: 179.\n\nPrior to Python 3.8, the serialisation order of the XML attributes\nof elements was artificially made predictable by sorting the\nattributes by their name.  Based on the now guaranteed ordering of\ndicts, this arbitrary reordering was removed in Python 3.8 to\npreserve the order in which attributes were originally parsed or\ncreated by user code.\n\nIn general, user code should try not to depend on a specific\nordering of attributes, given that the XML Information Set(1)\nexplicitly excludes the attribute order from conveying information.\nCode should be prepared to deal with any ordering on input.  In\ncases where deterministic XML output is required, e.g.  for\ncryptographic signing or test data sets, canonical serialisation is\navailable with the *note canonicalize(): 33ca. function.\n\nIn cases where canonical output is not applicable but a specific\nattribute order is still desirable on output, code should aim for\ncreating the attributes directly in the desired order, to avoid\nperceptual mismatches for readers of the code.  In cases where this\nis difficult to achieve, a recipe like the following can be applied\nprior to serialisation to enforce an order independently from the\nElement creation:\n\ndef reorderattributes(root):\nfor el in root.iter():\nattrib = el.attrib\nif len(attrib) > 1:\n# adjust attribute order, e.g. by sorting\nattribs = sorted(attrib.items())\nattrib.clear()\nattrib.update(attribs)\n\n---------- Footnotes ----------\n\n(1) https://www.w3.org/TR/xml-infoset/\n\nFile: python3.12.info,  Node: ElementTree Objects,  Next: QName Objects,  Prev: Element Objects,  Up: Reference<4>\n\n5.20.5.19 ElementTree Objects\n.............................\n\n-- Class: xml.etree.ElementTree.ElementTree (element=None, file=None)\n\nElementTree wrapper class.  This class represents an entire element\nhierarchy, and adds some extra support for serialization to and\nfrom standard XML.\n\n'element' is the root element.  The tree is initialized with the\ncontents of the XML 'file' if given.\n\n-- Method: setroot (element)\n\nReplaces the root element for this tree.  This discards the\ncurrent contents of the tree, and replaces it with the given\nelement.  Use with care.  'element' is an element instance.\n\n-- Method: find (match, namespaces=None)\n\nSame as *note Element.find(): 33ba, starting at the root of\nthe tree.\n\n-- Method: findall (match, namespaces=None)\n\nSame as *note Element.findall(): 33b9, starting at the root of\nthe tree.\n\n-- Method: findtext (match, default=None, namespaces=None)\n\nSame as *note Element.findtext(): 33e2, starting at the root\nof the tree.\n\n-- Method: getroot ()\n\nReturns the root element for this tree.\n\n-- Method: iter (tag=None)\n\nCreates and returns a tree iterator for the root element.  The\niterator loops over all elements in this tree, in section\norder.  'tag' is the tag to look for (default is to return all\nelements).\n\n-- Method: iterfind (match, namespaces=None)\n\nSame as *note Element.iterfind(): 1048, starting at the root\nof the tree.\n\nNew in version 3.2.\n\n-- Method: parse (source, parser=None)\n\nLoads an external XML section into this element tree.\n'source' is a file name or *note file object: 1037.  'parser'\nis an optional parser instance.  If not given, the standard\n*note XMLParser: 880. parser is used.  Returns the section\nroot element.\n\n-- Method: write (file, encoding='us-ascii', xmldeclaration=None,\ndefaultnamespace=None, method='xml', *,\nshortemptyelements=True)\n\nWrites the element tree to a file, as XML. 'file' is a file\nname, or a *note file object: 1037. opened for writing.\n'encoding' (1) is the output encoding (default is US-ASCII).\n'xmldeclaration' controls if an XML declaration should be\nadded to the file.  Use 'False' for never, 'True' for always,\n'None' for only if not US-ASCII or UTF-8 or Unicode (default\nis 'None').  'defaultnamespace' sets the default XML\nnamespace (for \"xmlns\").  'method' is either '\"xml\"', '\"html\"'\nor '\"text\"' (default is '\"xml\"').  The keyword-only\n'shortemptyelements' parameter controls the formatting of\nelements that contain no content.  If 'True' (the default),\nthey are emitted as a single self-closed tag, otherwise they\nare emitted as a pair of start/end tags.\n\nThe output is either a string (*note str: 157.) or binary\n(*note bytes: 295.).  This is controlled by the 'encoding'\nargument.  If 'encoding' is '\"unicode\"', the output is a\nstring; otherwise, it's binary.  Note that this may conflict\nwith the type of 'file' if it's an open *note file object:\n1037.; make sure you do not try to write a string to a binary\nstream and vice versa.\n\nChanged in version 3.4: Added the 'shortemptyelements'\nparameter.\n\nChanged in version 3.8: The *note write(): e6a. method now\npreserves the attribute order specified by the user.\n\nThis is the XML file that is going to be manipulated:\n\n<html>\n<head>\n<title>Example page</title>\n</head>\n<body>\n<p>Moved to <a href=\"http://example.org/\">example.org</a>\nor <a href=\"http://example.com/\">example.com</a>.</p>\n</body>\n</html>\n\nExample of changing the attribute \"target\" of every link in first\nparagraph:\n\n>>> from xml.etree.ElementTree import ElementTree\n>>> tree = ElementTree()\n>>> tree.parse(\"index.xhtml\")\n<Element 'html' at 0xb77e6fac>\n>>> p = tree.find(\"body/p\")     # Finds first occurrence of tag p in body\n>>> p\n<Element 'p' at 0xb77ec26c>\n>>> links = list(p.iter(\"a\"))   # Returns list of all links\n>>> links\n[<Element 'a' at 0xb77ec2ac>, <Element 'a' at 0xb77ec1cc>]\n>>> for i in links:             # Iterates through all found links\n...     i.attrib[\"target\"] = \"blank\"\n...\n>>> tree.write(\"output.xhtml\")\n\n---------- Footnotes ----------\n\n(1) The encoding string included in XML output should conform to the\nappropriate standards.  For example, \"UTF-8\" is valid, but \"UTF8\" is\nnot.  See\n'https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl' and\n'https://www.iana.org/assignments/character-sets/character-sets.xhtml'.\n\nFile: python3.12.info,  Node: QName Objects,  Next: TreeBuilder Objects,  Prev: ElementTree Objects,  Up: Reference<4>\n\n5.20.5.20 QName Objects\n.......................\n\n-- Class: xml.etree.ElementTree.QName (textoruri, tag=None)\n\nQName wrapper.  This can be used to wrap a QName attribute value,\nin order to get proper namespace handling on output.  'textoruri'\nis a string containing the QName value, in the form {uri}local, or,\nif the tag argument is given, the URI part of a QName.  If 'tag' is\ngiven, the first argument is interpreted as a URI, and this\nargument is interpreted as a local name.  *note QName: 33f1.\ninstances are opaque.\n\nFile: python3.12.info,  Node: TreeBuilder Objects,  Next: XMLParser Objects,  Prev: QName Objects,  Up: Reference<4>\n\n5.20.5.21 TreeBuilder Objects\n.............................\n\n-- Class: xml.etree.ElementTree.TreeBuilder (elementfactory=None, *,\ncommentfactory=None, pifactory=None, insertcomments=False,\ninsertpis=False)\n\nGeneric element structure builder.  This builder converts a\nsequence of start, data, end, comment and pi method calls to a\nwell-formed element structure.  You can use this class to build an\nelement structure using a custom XML parser, or a parser for some\nother XML-like format.\n\n'elementfactory', when given, must be a callable accepting two\npositional arguments: a tag and a dict of attributes.  It is\nexpected to return a new element instance.\n\nThe 'commentfactory' and 'pifactory' functions, when given,\nshould behave like the *note Comment(): 33cb. and *note\nProcessingInstruction(): 33d1. functions to create comments and\nprocessing instructions.  When not given, the default factories\nwill be used.  When 'insertcomments' and/or 'insertpis' is true,\ncomments/pis will be inserted into the tree if they appear within\nthe root element (but not outside of it).\n\n-- Method: close ()\n\nFlushes the builder buffers, and returns the toplevel document\nelement.  Returns an *note Element: 23e. instance.\n\n-- Method: data (data)\n\nAdds text to the current element.  'data' is a string.  This\nshould be either a bytestring, or a Unicode string.\n\n-- Method: end (tag)\n\nCloses the current element.  'tag' is the element name.\nReturns the closed element.\n\n-- Method: start (tag, attrs)\n\nOpens a new element.  'tag' is the element name.  'attrs' is a\ndictionary containing element attributes.  Returns the opened\nelement.\n\n-- Method: comment (text)\n\nCreates a comment with the given 'text'.  If 'insertcomments'\nis true, this will also add it to the tree.\n\nNew in version 3.8.\n\n-- Method: pi (target, text)\n\nCreates a process instruction with the given 'target' name and\n'text'.  If 'insertpis' is true, this will also add it to the\ntree.\n\nNew in version 3.8.\n\nIn addition, a custom *note TreeBuilder: 881. object can provide\nthe following methods:\n\n-- Method: doctype (name, pubid, system)\n\nHandles a doctype declaration.  'name' is the doctype name.\n'pubid' is the public identifier.  'system' is the system\nidentifier.  This method does not exist on the default *note\nTreeBuilder: 881. class.\n\nNew in version 3.2.\n\n-- Method: startns (prefix, uri)\n\nIs called whenever the parser encounters a new namespace\ndeclaration, before the 'start()' callback for the opening\nelement that defines it.  'prefix' is '''' for the default\nnamespace and the declared namespace prefix name otherwise.\n'uri' is the namespace URI.\n\nNew in version 3.8.\n\n-- Method: endns (prefix)\n\nIs called after the 'end()' callback of an element that\ndeclared a namespace prefix mapping, with the name of the\n'prefix' that went out of scope.\n\nNew in version 3.8.\n\n-- Class: xml.etree.ElementTree.C14NWriterTarget (write, *,\nwithcomments=False, striptext=False, rewriteprefixes=False,\nqnameawaretags=None, qnameawareattrs=None,\nexcludeattrs=None, excludetags=None)\n\nA C14N 2.0(1) writer.  Arguments are the same as for the *note\ncanonicalize(): 33ca. function.  This class does not build a tree\nbut translates the callback events directly into a serialised form\nusing the 'write' function.\n\nNew in version 3.8.\n\n---------- Footnotes ----------\n\n(1) https://www.w3.org/TR/xml-c14n2/\n\nFile: python3.12.info,  Node: XMLParser Objects,  Next: XMLPullParser Objects,  Prev: TreeBuilder Objects,  Up: Reference<4>\n\n5.20.5.22 XMLParser Objects\n...........................\n\n-- Class: xml.etree.ElementTree.XMLParser (*, target=None,\nencoding=None)\n\nThis class is the low-level building block of the module.  It uses\n*note xml.parsers.expat: 121. for efficient, event-based parsing of\nXML. It can be fed XML data incrementally with the *note feed():\n33fd. method, and parsing events are translated to a push API - by\ninvoking callbacks on the 'target' object.  If 'target' is omitted,\nthe standard *note TreeBuilder: 881. is used.  If 'encoding' (1) is\ngiven, the value overrides the encoding specified in the XML file.\n\nChanged in version 3.8: Parameters are now *note keyword-only: 8b8.\nThe 'html' argument no longer supported.\n\n-- Method: close ()\n\nFinishes feeding data to the parser.  Returns the result of\ncalling the 'close()' method of the 'target' passed during\nconstruction; by default, this is the toplevel document\nelement.\n\n-- Method: feed (data)\n\nFeeds data to the parser.  'data' is encoded data.\n\n-- Method: flush ()\n\nTriggers parsing of any previously fed unparsed data, which\ncan be used to ensure more immediate feedback, in particular\nwith Expat >=2.6.0.  The implementation of *note flush():\n13ab. temporarily disables reparse deferral with Expat (if\ncurrently enabled) and triggers a reparse.  Disabling reparse\ndeferral has security consequences; please see *note\nxml.parsers.expat.xmlparser.SetReparseDeferralEnabled(): 13ae.\nfor details.\n\nNote that *note flush(): 13ab. has been backported to some\nprior releases of CPython as a security fix.  Check for\navailability of *note flush(): 13ab. using *note hasattr():\n1f7. if used in code running across a variety of Python\nversions.\n\nNew in version 3.12.3.\n\n*note XMLParser.feed(): 33fd. calls 'target\"s 'start(tag,\nattrsdict)' method for each opening tag, its 'end(tag)' method for\neach closing tag, and data is processed by method 'data(data)'.\nFor further supported callback methods, see the *note TreeBuilder:\n881. class.  *note XMLParser.close(): 33fe. calls 'target\"s method\n'close()'.  *note XMLParser: 880. can be used not only for building\na tree structure.  This is an example of counting the maximum depth\nof an XML file:\n\n>>> from xml.etree.ElementTree import XMLParser\n>>> class MaxDepth:                     # The target object of the parser\n...     maxDepth = 0\n...     depth = 0\n...     def start(self, tag, attrib):   # Called for each opening tag.\n...         self.depth += 1\n...         if self.depth > self.maxDepth:\n...             self.maxDepth = self.depth\n...     def end(self, tag):             # Called for each closing tag.\n...         self.depth -= 1\n...     def data(self, data):\n...         pass            # We do not need to do anything with data.\n...     def close(self):    # Called when all data has been parsed.\n...         return self.maxDepth\n...\n>>> target = MaxDepth()\n>>> parser = XMLParser(target=target)\n>>> exampleXml = \"\"\"\n... <a>\n...   <b>\n...   </b>\n...   <b>\n...     <c>\n...       <d>\n...       </d>\n...     </c>\n...   </b>\n... </a>\"\"\"\n>>> parser.feed(exampleXml)\n>>> parser.close()\n4\n\n---------- Footnotes ----------\n\n(1) The encoding string included in XML output should conform to the\nappropriate standards.  For example, \"UTF-8\" is valid, but \"UTF8\" is\nnot.  See\n'https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl' and\n'https://www.iana.org/assignments/character-sets/character-sets.xhtml'.\n\nFile: python3.12.info,  Node: XMLPullParser Objects,  Next: Exceptions<17>,  Prev: XMLParser Objects,  Up: Reference<4>\n\n5.20.5.23 XMLPullParser Objects\n...............................\n\n-- Class: xml.etree.ElementTree.XMLPullParser (events=None)\n\nA pull parser suitable for non-blocking applications.  Its\ninput-side API is similar to that of *note XMLParser: 880, but\ninstead of pushing calls to a callback target, *note XMLPullParser:\ne66. collects an internal list of parsing events and lets the user\nread from it.  'events' is a sequence of events to report back.\nThe supported events are the strings '\"start\"', '\"end\"',\n'\"comment\"', '\"pi\"', '\"start-ns\"' and '\"end-ns\"' (the \"ns\" events\nare used to get detailed namespace information).  If 'events' is\nomitted, only '\"end\"' events are reported.\n\n-- Method: feed (data)\n\nFeed the given bytes data to the parser.\n\n-- Method: flush ()\n\nTriggers parsing of any previously fed unparsed data, which\ncan be used to ensure more immediate feedback, in particular\nwith Expat >=2.6.0.  The implementation of *note flush():\n13ac. temporarily disables reparse deferral with Expat (if\ncurrently enabled) and triggers a reparse.  Disabling reparse\ndeferral has security consequences; please see *note\nxml.parsers.expat.xmlparser.SetReparseDeferralEnabled(): 13ae.\nfor details.\n\nNote that *note flush(): 13ac. has been backported to some\nprior releases of CPython as a security fix.  Check for\navailability of *note flush(): 13ac. using *note hasattr():\n1f7. if used in code running across a variety of Python\nversions.\n\nNew in version 3.12.3.\n\n-- Method: close ()\n\nSignal the parser that the data stream is terminated.  Unlike\n*note XMLParser.close(): 33fe, this method always returns\n*note None: 43f.  Any events not yet retrieved when the parser\nis closed can still be read with *note readevents(): 33b7.\n\n-- Method: readevents ()\n\nReturn an iterator over the events which have been encountered\nin the data fed to the parser.  The iterator yields '(event,\nelem)' pairs, where 'event' is a string representing the type\nof event (e.g.  '\"end\"') and 'elem' is the encountered *note\nElement: 23e. object, or other context value as follows.\n\n* 'start', 'end': the current Element.\n\n* 'comment', 'pi': the current comment / processing\ninstruction\n\n* 'start-ns': a tuple '(prefix, uri)' naming the declared\nnamespace mapping.\n\n* 'end-ns': *note None: 43f. (this may change in a future\nversion)\n\nEvents provided in a previous call to *note readevents():\n33b7. will not be yielded again.  Events are consumed from the\ninternal queue only when they are retrieved from the iterator,\nso multiple readers iterating in parallel over iterators\nobtained from *note readevents(): 33b7. will have\nunpredictable results.\n\nNote: *note XMLPullParser: e66. only guarantees that it has\nseen the \">\" character of a starting tag when it emits a\n\"start\" event, so the attributes are defined, but the contents\nof the text and tail attributes are undefined at that point.\nThe same applies to the element children; they may or may not\nbe present.\n\nIf you need a fully populated element, look for \"end\" events\ninstead.\n\nNew in version 3.4.\n\nChanged in version 3.8: The 'comment' and 'pi' events were added.\n\nFile: python3.12.info,  Node: Exceptions<17>,  Prev: XMLPullParser Objects,  Up: Reference<4>\n\n5.20.5.24 Exceptions\n....................\n\n-- Class: xml.etree.ElementTree.ParseError\n\nXML parse error, raised by the various parsing methods in this\nmodule when parsing fails.  The string representation of an\ninstance of this exception will contain a user-friendly error\nmessage.  In addition, it will have the following attributes\navailable:\n\n-- Attribute: code\n\nA numeric error code from the expat parser.  See the\ndocumentation of *note xml.parsers.expat: 121. for the list of\nerror codes and their meanings.\n\n-- Attribute: position\n\nA tuple of 'line', 'column' numbers, specifying where the\nerror occurred.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "'Source code:' Lib/xml/dom/init.py(1)\n\n\n\nThe Document Object Model, or \"DOM,\" is a cross-language API from the",
            "subsections": []
        },
        "World Wide Web Consortium (W3C) for accessing and modifying XML": {
            "content": "documents.  A DOM implementation presents an XML document as a tree\nstructure, or allows client code to build such a structure from scratch.",
            "subsections": []
        },
        "It then gives access to the structure through a set of objects which": {
            "content": "provided well-known interfaces.\n",
            "subsections": []
        },
        "The DOM is extremely useful for random-access applications.  SAX only": {
            "content": "allows you a view of one bit of the document at a time.  If you are\nlooking at one SAX element, you have no access to another.  If you are\nlooking at a text node, you have no access to a containing element.",
            "subsections": []
        },
        "When you write a SAX application, you need to keep track of your": {
            "content": "program's position in the document somewhere in your own code.  SAX does\nnot do it for you.  Also, if you need to look ahead in the XML document,\nyou are just out of luck.\n",
            "subsections": []
        },
        "Some applications are simply impossible in an event driven model with no": {
            "content": "access to a tree.  Of course you could build some sort of tree yourself\nin SAX events, but the DOM allows you to avoid writing that code.  The\nDOM is a standard tree representation for XML data.\n",
            "subsections": []
        },
        "The Document Object Model is being defined by the W3C in stages, or": {
            "content": "\"levels\" in their terminology.  The Python mapping of the API is\nsubstantially based on the DOM Level 2 recommendation.\n\nDOM applications typically start by parsing some XML into a DOM. How\nthis is accomplished is not covered at all by DOM Level 1, and Level 2\nprovides only limited improvements: There is a 'DOMImplementation'\nobject class which provides access to 'Document' creation methods, but\nno way to access an XML reader/parser/Document builder in an\nimplementation-independent way.  There is also no well-defined way to\naccess these methods without an existing 'Document' object.  In Python,\neach DOM implementation will provide a function *note\ngetDOMImplementation(): 3407.  DOM Level 3 adds a Load/Store\nspecification, which defines an interface to the reader, but this is not\nyet available in the Python standard library.\n",
            "subsections": []
        },
        "Once you have a DOM document object, you can access the parts of your": {
            "content": "XML document through its properties and methods.  These properties are\ndefined in the DOM specification.  The main property of the document\nobject is the 'documentElement' property.  It gives you the main element\nin the XML document: the one that holds all others.  Here is an example\nprogram:\n\ndom3 = parseString(\"<myxml>Some data</myxml>\")\nassert dom3.documentElement.tagName == \"myxml\"\n",
            "subsections": []
        },
        "The specification provided by the W3C defines the DOM API for Java,": {
            "content": "ECMAScript, and OMG IDL. The Python mapping defined here is based in\nlarge part on the IDL version of the specification, but strict\ncompliance is not required (though implementations are free to support\nthe strict mapping from IDL). See section *note Conformance: 3408. for a\ndetailed discussion of mapping requirements.\n\nSee also\n........\n",
            "subsections": []
        },
        "Document Object Model (DOM) Level 2 Specification(2)": {
            "content": "The W3C recommendation upon which the Python DOM API is based.\n",
            "subsections": []
        },
        "Document Object Model (DOM) Level 1 Specification(3)": {
            "content": "The W3C recommendation for the DOM supported by *note\nxml.dom.minidom: 11d.\n",
            "subsections": []
        },
        "Python Language Mapping Specification(4)": {
            "content": "This specifies the mapping from OMG IDL to Python.\n\n* Menu:\n\n* Module Contents: Module Contents<4>.\n* Objects in the DOM::\n* Conformance::\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/xml/dom/init.py\n\n(2) https://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/\n\n(3) https://www.w3.org/TR/REC-DOM-Level-1/\n\n(4) https://www.omg.org/spec/PYTH/1.2/PDF\n\nFile: python3.12.info,  Node: Module Contents<4>,  Next: Objects in the DOM,  Up: xml dom -- The Document Object Model API\n\n5.20.6.1 Module Contents\n........................\n\nThe *note xml.dom: 11c. contains the following functions:\n\n-- Function: xml.dom.registerDOMImplementation (name, factory)\n\nRegister the 'factory' function with the name 'name'.  The factory\nfunction should return an object which implements the\n'DOMImplementation' interface.  The factory function can return the\nsame object every time, or a new one for each call, as appropriate\nfor the specific implementation (e.g.  if that implementation\nsupports some customization).\n\n-- Function: xml.dom.getDOMImplementation (name=None, features=())\n\nReturn a suitable DOM implementation.  The 'name' is either\nwell-known, the module name of a DOM implementation, or 'None'.  If\nit is not 'None', imports the corresponding module and returns a\n'DOMImplementation' object if the import succeeds.  If no name is\ngiven, and if the environment variable 'PYTHONDOM' is set, this\nvariable is used to find the implementation.\n\nIf name is not given, this examines the available implementations\nto find one with the required feature set.  If no implementation\ncan be found, raise an *note ImportError: 145.  The features list\nmust be a sequence of '(feature, version)' pairs which are passed\nto the 'hasFeature()' method on available 'DOMImplementation'\nobjects.\n\nSome convenience constants are also provided:\n\n-- Data: xml.dom.EMPTYNAMESPACE\n\nThe value used to indicate that no namespace is associated with a\nnode in the DOM. This is typically found as the 'namespaceURI' of a\nnode, or used as the 'namespaceURI' parameter to a\nnamespaces-specific method.\n\n-- Data: xml.dom.XMLNAMESPACE\n\nThe namespace URI associated with the reserved prefix 'xml', as\ndefined by Namespaces in XML(1) (section 4).\n\n-- Data: xml.dom.XMLNSNAMESPACE\n\nThe namespace URI for namespace declarations, as defined by\nDocument Object Model (DOM) Level 2 Core Specification(2) (section\n1.1.8).\n\n-- Data: xml.dom.XHTMLNAMESPACE\n\nThe URI of the XHTML namespace as defined by XHTML 1.0: The\nExtensible HyperText Markup Language(3) (section 3.1.1).\n\nIn addition, *note xml.dom: 11c. contains a base 'Node' class and the\nDOM exception classes.  The 'Node' class provided by this module does\nnot implement any of the methods or attributes defined by the DOM\nspecification; concrete DOM implementations must provide those.  The\n'Node' class provided as part of this module does provide the constants\nused for the 'nodeType' attribute on concrete 'Node' objects; they are\nlocated within the class rather than at the module level to conform with\nthe DOM specifications.\n\n---------- Footnotes ----------\n\n(1) https://www.w3.org/TR/REC-xml-names/\n\n(2) https://www.w3.org/TR/DOM-Level-2-Core/core.html\n\n(3) https://www.w3.org/TR/xhtml1/\n\nFile: python3.12.info,  Node: Objects in the DOM,  Next: Conformance,  Prev: Module Contents<4>,  Up: xml dom -- The Document Object Model API\n\n5.20.6.2 Objects in the DOM\n...........................\n",
            "subsections": []
        },
        "The definitive documentation for the DOM is the DOM specification from": {
            "content": "the W3C.\n",
            "subsections": []
        },
        "Note that DOM attributes may also be manipulated as nodes instead of as": {
            "content": "simple strings.  It is fairly rare that you must do this, however, so\nthis usage is not yet documented.\n",
            "subsections": []
        },
        "Interface                            Section                                 Purpose": {
            "content": "-------------------------------------------------------------------------------------------------------------------\n\n'DOMImplementation'                  *note DOMImplementation Objects: 3411.  Interface to the underlying\nimplementation.\n\n\n'Node'                               *note Node Objects: 3412.               Base interface for most objects in\na document.\n\n\n'NodeList'                           *note NodeList Objects: 3413.           Interface for a sequence of nodes.\n\n\n'DocumentType'                       *note DocumentType Objects: 3414.       Information about the declarations\nneeded to process a document.\n\n\n'Document'                           *note Document Objects: 3415.           Object which represents an entire\ndocument.\n\n\n'Element'                            *note Element Objects: 3416.            Element nodes in the document\nhierarchy.\n\n\n'Attr'                               *note Attr Objects: 3417.               Attribute value nodes on element\nnodes.\n\n\n'Comment'                            *note Comment Objects: 3418.            Representation of comments in the\nsource document.\n\n\n'Text'                               *note Text and CDATASection Objects: 3419.Nodes containing textual content\nfrom the document.\n\n\n'ProcessingInstruction'              *note ProcessingInstruction Objects: 341a.Processing instruction\nrepresentation.\n\n",
            "subsections": []
        },
        "An additional section describes the exceptions defined for working with": {
            "content": "the DOM in Python.\n\n* Menu:\n\n* DOMImplementation Objects::\n* Node Objects::\n* NodeList Objects::\n* DocumentType Objects::\n* Document Objects::\n* Element Objects: Element Objects<2>.\n* Attr Objects::\n* NamedNodeMap Objects::\n* Comment Objects::\n* Text and CDATASection Objects::\n* ProcessingInstruction Objects::\n* Exceptions: Exceptions<18>.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: DOMImplementation Objects,  Next: Node Objects,  Up: Objects in the DOM": {
            "content": "5.20.6.3 DOMImplementation Objects\n..................................\n",
            "subsections": []
        },
        "The 'DOMImplementation' interface provides a way for applications to": {
            "content": "determine the availability of particular features in the DOM they are\nusing.  DOM Level 2 added the ability to create new 'Document' and\n'DocumentType' objects using the 'DOMImplementation' as well.\n\n-- Method: DOMImplementation.hasFeature (feature, version)\n\nReturn 'True' if the feature identified by the pair of strings\n'feature' and 'version' is implemented.\n\n-- Method: DOMImplementation.createDocument (namespaceUri,\nqualifiedName, doctype)\n\nReturn a new 'Document' object (the root of the DOM), with a child\n'Element' object having the given 'namespaceUri' and\n'qualifiedName'.  The 'doctype' must be a 'DocumentType' object\ncreated by *note createDocumentType(): 341e, or 'None'.  In the\nPython DOM API, the first two arguments can also be 'None' in order\nto indicate that no 'Element' child is to be created.\n\n-- Method: DOMImplementation.createDocumentType (qualifiedName,\npublicId, systemId)\n\nReturn a new 'DocumentType' object that encapsulates the given\n'qualifiedName', 'publicId', and 'systemId' strings, representing\nthe information contained in an XML document type declaration.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Node Objects,  Next: NodeList Objects,  Prev: DOMImplementation Objects,  Up: Objects in the DOM": {
            "content": "5.20.6.4 Node Objects\n.....................\n\nAll of the components of an XML document are subclasses of 'Node'.\n\n-- Attribute: Node.nodeType\n\nAn integer representing the node type.  Symbolic constants for the\ntypes are on the 'Node' object: 'ELEMENTNODE', 'ATTRIBUTENODE',\n'TEXTNODE', 'CDATASECTIONNODE', 'ENTITYNODE',\n'PROCESSINGINSTRUCTIONNODE', 'COMMENTNODE', 'DOCUMENTNODE',\n'DOCUMENTTYPENODE', 'NOTATIONNODE'.  This is a read-only\nattribute.\n\n-- Attribute: Node.parentNode\n\nThe parent of the current node, or 'None' for the document node.\nThe value is always a 'Node' object or 'None'.  For 'Element'\nnodes, this will be the parent element, except for the root\nelement, in which case it will be the 'Document' object.  For\n'Attr' nodes, this is always 'None'.  This is a read-only\nattribute.\n\n-- Attribute: Node.attributes\n\nA 'NamedNodeMap' of attribute objects.  Only elements have actual\nvalues for this; others provide 'None' for this attribute.  This is\na read-only attribute.\n\n-- Attribute: Node.previousSibling\n\nThe node that immediately precedes this one with the same parent.\nFor instance the element with an end-tag that comes just before the\n'self' element's start-tag.  Of course, XML documents are made up\nof more than just elements so the previous sibling could be text, a\ncomment, or something else.  If this node is the first child of the\nparent, this attribute will be 'None'.  This is a read-only\nattribute.\n\n-- Attribute: Node.nextSibling\n\nThe node that immediately follows this one with the same parent.\nSee also *note previousSibling: 3423.  If this is the last child of\nthe parent, this attribute will be 'None'.  This is a read-only\nattribute.\n\n-- Attribute: Node.childNodes\n\nA list of nodes contained within this node.  This is a read-only\nattribute.\n\n-- Attribute: Node.firstChild\n\nThe first child of the node, if there are any, or 'None'.  This is\na read-only attribute.\n\n-- Attribute: Node.lastChild\n\nThe last child of the node, if there are any, or 'None'.  This is a\nread-only attribute.\n\n-- Attribute: Node.localName\n\nThe part of the 'tagName' following the colon if there is one, else\nthe entire 'tagName'.  The value is a string.\n\n-- Attribute: Node.prefix\n\nThe part of the 'tagName' preceding the colon if there is one, else\nthe empty string.  The value is a string, or 'None'.\n\n-- Attribute: Node.namespaceURI\n\nThe namespace associated with the element name.  This will be a\nstring or 'None'.  This is a read-only attribute.\n\n-- Attribute: Node.nodeName\n\nThis has a different meaning for each node type; see the DOM\nspecification for details.  You can always get the information you\nwould get here from another property such as the 'tagName' property\nfor elements or the 'name' property for attributes.  For all node\ntypes, the value of this attribute will be either a string or\n'None'.  This is a read-only attribute.\n\n-- Attribute: Node.nodeValue\n\nThis has a different meaning for each node type; see the DOM\nspecification for details.  The situation is similar to that with\n*note nodeName: 342b.  The value is a string or 'None'.\n\n-- Method: Node.hasAttributes ()\n\nReturn 'True' if the node has any attributes.\n\n-- Method: Node.hasChildNodes ()\n\nReturn 'True' if the node has any child nodes.\n\n-- Method: Node.isSameNode (other)\n\nReturn 'True' if 'other' refers to the same node as this node.\nThis is especially useful for DOM implementations which use any\nsort of proxy architecture (because more than one object can refer\nto the same node).\n\nNote: This is based on a proposed DOM Level 3 API which is\nstill in the \"working draft\" stage, but this particular\ninterface appears uncontroversial.  Changes from the W3C will\nnot necessarily affect this method in the Python DOM interface\n(though any new W3C API for this would also be supported).\n\n-- Method: Node.appendChild (newChild)\n\nAdd a new child node to this node at the end of the list of\nchildren, returning 'newChild'.  If the node was already in the\ntree, it is removed first.\n\n-- Method: Node.insertBefore (newChild, refChild)\n\nInsert a new child node before an existing child.  It must be the\ncase that 'refChild' is a child of this node; if not, *note\nValueError: 183. is raised.  'newChild' is returned.  If 'refChild'\nis 'None', it inserts 'newChild' at the end of the children's list.\n\n-- Method: Node.removeChild (oldChild)\n\nRemove a child node.  'oldChild' must be a child of this node; if\nnot, *note ValueError: 183. is raised.  'oldChild' is returned on\nsuccess.  If 'oldChild' will not be used further, its 'unlink()'\nmethod should be called.\n\n-- Method: Node.replaceChild (newChild, oldChild)\n\nReplace an existing node with a new node.  It must be the case that\n'oldChild' is a child of this node; if not, *note ValueError: 183.\nis raised.\n\n-- Method: Node.normalize ()\n\nJoin adjacent text nodes so that all stretches of text are stored\nas single 'Text' instances.  This simplifies processing text from a\nDOM tree for many applications.\n\n-- Method: Node.cloneNode (deep)\n\nClone this node.  Setting 'deep' means to clone all child nodes as\nwell.  This returns the clone.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: NodeList Objects,  Next: DocumentType Objects,  Prev: Node Objects,  Up: Objects in the DOM": {
            "content": "5.20.6.5 NodeList Objects\n.........................\n\nA 'NodeList' represents a sequence of nodes.  These objects are used in\ntwo ways in the DOM Core recommendation: an 'Element' object provides\none as its list of child nodes, and the 'getElementsByTagName()' and\n'getElementsByTagNameNS()' methods of 'Node' return objects with this\ninterface to represent query results.\n",
            "subsections": []
        },
        "The DOM Level 2 recommendation defines one method and one attribute for": {
            "content": "these objects:\n\n-- Method: NodeList.item (i)\n\nReturn the 'i''th item from the sequence, if there is one, or\n'None'.  The index 'i' is not allowed to be less than zero or\ngreater than or equal to the length of the sequence.\n\n-- Attribute: NodeList.length\n\nThe number of nodes in the sequence.\n",
            "subsections": []
        },
        "In addition, the Python DOM interface requires that some additional": {
            "content": "support is provided to allow 'NodeList' objects to be used as Python\nsequences.  All 'NodeList' implementations must include support for\n*note len(): 1c68. and *note getitem(): 4b9.; this allows\niteration over the 'NodeList' in *note for: 24e. statements and proper\nsupport for the *note len(): 3fb. built-in function.\n",
            "subsections": []
        },
        "If a DOM implementation supports modification of the document, the": {
            "content": "'NodeList' implementation must also support the *note setitem():\n1320. and *note delitem(): 1321. methods.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: DocumentType Objects,  Next: Document Objects,  Prev: NodeList Objects,  Up: Objects in the DOM": {
            "content": "5.20.6.6 DocumentType Objects\n.............................\n",
            "subsections": []
        },
        "Information about the notations and entities declared by a document": {
            "content": "(including the external subset if the parser uses it and can provide the\ninformation) is available from a 'DocumentType' object.  The\n'DocumentType' for a document is available from the 'Document' object's\n'doctype' attribute; if there is no 'DOCTYPE' declaration for the\ndocument, the document's 'doctype' attribute will be set to 'None'\ninstead of an instance of this interface.\n\n'DocumentType' is a specialization of 'Node', and adds the following\nattributes:\n\n-- Attribute: DocumentType.publicId\n\nThe public identifier for the external subset of the document type\ndefinition.  This will be a string or 'None'.\n\n-- Attribute: DocumentType.systemId\n\nThe system identifier for the external subset of the document type\ndefinition.  This will be a URI as a string, or 'None'.\n\n-- Attribute: DocumentType.internalSubset\n\nA string giving the complete internal subset from the document.\nThis does not include the brackets which enclose the subset.  If\nthe document has no internal subset, this should be 'None'.\n\n-- Attribute: DocumentType.name\n\nThe name of the root element as given in the 'DOCTYPE' declaration,\nif present.\n\n-- Attribute: DocumentType.entities\n\nThis is a 'NamedNodeMap' giving the definitions of external\nentities.  For entity names defined more than once, only the first\ndefinition is provided (others are ignored as required by the XML\nrecommendation).  This may be 'None' if the information is not\nprovided by the parser, or if no entities are defined.\n\n-- Attribute: DocumentType.notations\n\nThis is a 'NamedNodeMap' giving the definitions of notations.  For\nnotation names defined more than once, only the first definition is\nprovided (others are ignored as required by the XML\nrecommendation).  This may be 'None' if the information is not\nprovided by the parser, or if no notations are defined.\n\nFile: python3.12.info,  Node: Document Objects,  Next: Element Objects<2>,  Prev: DocumentType Objects,  Up: Objects in the DOM\n\n5.20.6.7 Document Objects\n.........................\n\nA 'Document' represents an entire XML document, including its\nconstituent elements, attributes, processing instructions, comments etc.\nRemember that it inherits properties from 'Node'.\n\n-- Attribute: Document.documentElement\n\nThe one and only root element of the document.\n\n-- Method: Document.createElement (tagName)\n\nCreate and return a new element node.  The element is not inserted\ninto the document when it is created.  You need to explicitly\ninsert it with one of the other methods such as 'insertBefore()' or\n'appendChild()'.\n\n-- Method: Document.createElementNS (namespaceURI, tagName)\n\nCreate and return a new element with a namespace.  The 'tagName'\nmay have a prefix.  The element is not inserted into the document\nwhen it is created.  You need to explicitly insert it with one of\nthe other methods such as 'insertBefore()' or 'appendChild()'.\n\n-- Method: Document.createTextNode (data)\n\nCreate and return a text node containing the data passed as a\nparameter.  As with the other creation methods, this one does not\ninsert the node into the tree.\n\n-- Method: Document.createComment (data)\n\nCreate and return a comment node containing the data passed as a\nparameter.  As with the other creation methods, this one does not\ninsert the node into the tree.\n\n-- Method: Document.createProcessingInstruction (target, data)\n\nCreate and return a processing instruction node containing the\n'target' and 'data' passed as parameters.  As with the other\ncreation methods, this one does not insert the node into the tree.\n\n-- Method: Document.createAttribute (name)\n\nCreate and return an attribute node.  This method does not\nassociate the attribute node with any particular element.  You must\nuse 'setAttributeNode()' on the appropriate 'Element' object to use\nthe newly created attribute instance.\n\n-- Method: Document.createAttributeNS (namespaceURI, qualifiedName)\n\nCreate and return an attribute node with a namespace.  The\n'tagName' may have a prefix.  This method does not associate the\nattribute node with any particular element.  You must use\n'setAttributeNode()' on the appropriate 'Element' object to use the\nnewly created attribute instance.\n\n-- Method: Document.getElementsByTagName (tagName)\n\nSearch for all descendants (direct children, children's children,\netc.)  with a particular element type name.\n\n-- Method: Document.getElementsByTagNameNS (namespaceURI, localName)\n\nSearch for all descendants (direct children, children's children,\netc.)  with a particular namespace URI and localname.  The\nlocalname is the part of the namespace after the prefix.\n\nFile: python3.12.info,  Node: Element Objects<2>,  Next: Attr Objects,  Prev: Document Objects,  Up: Objects in the DOM\n\n5.20.6.8 Element Objects\n........................\n\n'Element' is a subclass of 'Node', so inherits all the attributes of\nthat class.\n\n-- Attribute: Element.tagName\n\nThe element type name.  In a namespace-using document it may have\ncolons in it.  The value is a string.\n\n-- Method: Element.getElementsByTagName (tagName)\n\nSame as equivalent method in the 'Document' class.\n\n-- Method: Element.getElementsByTagNameNS (namespaceURI, localName)\n\nSame as equivalent method in the 'Document' class.\n\n-- Method: Element.hasAttribute (name)\n\nReturn 'True' if the element has an attribute named by 'name'.\n\n-- Method: Element.hasAttributeNS (namespaceURI, localName)\n\nReturn 'True' if the element has an attribute named by\n'namespaceURI' and 'localName'.\n\n-- Method: Element.getAttribute (name)\n\nReturn the value of the attribute named by 'name' as a string.  If\nno such attribute exists, an empty string is returned, as if the\nattribute had no value.\n\n-- Method: Element.getAttributeNode (attrname)\n\nReturn the 'Attr' node for the attribute named by 'attrname'.\n\n-- Method: Element.getAttributeNS (namespaceURI, localName)\n\nReturn the value of the attribute named by 'namespaceURI' and\n'localName' as a string.  If no such attribute exists, an empty\nstring is returned, as if the attribute had no value.\n\n-- Method: Element.getAttributeNodeNS (namespaceURI, localName)\n\nReturn an attribute value as a node, given a 'namespaceURI' and\n'localName'.\n\n-- Method: Element.removeAttribute (name)\n\nRemove an attribute by name.  If there is no matching attribute, a\n*note NotFoundErr: 3456. is raised.\n\n-- Method: Element.removeAttributeNode (oldAttr)\n\nRemove and return 'oldAttr' from the attribute list, if present.\nIf 'oldAttr' is not present, *note NotFoundErr: 3456. is raised.\n\n-- Method: Element.removeAttributeNS (namespaceURI, localName)\n\nRemove an attribute by name.  Note that it uses a localName, not a\nqname.  No exception is raised if there is no matching attribute.\n\n-- Method: Element.setAttribute (name, value)\n\nSet an attribute value from a string.\n\n-- Method: Element.setAttributeNode (newAttr)\n\nAdd a new attribute node to the element, replacing an existing\nattribute if necessary if the 'name' attribute matches.  If a\nreplacement occurs, the old attribute node will be returned.  If\n'newAttr' is already in use, *note InuseAttributeErr: 345b. will be\nraised.\n\n-- Method: Element.setAttributeNodeNS (newAttr)\n\nAdd a new attribute node to the element, replacing an existing\nattribute if necessary if the 'namespaceURI' and 'localName'\nattributes match.  If a replacement occurs, the old attribute node\nwill be returned.  If 'newAttr' is already in use, *note\nInuseAttributeErr: 345b. will be raised.\n\n-- Method: Element.setAttributeNS (namespaceURI, qname, value)\n\nSet an attribute value from a string, given a 'namespaceURI' and a\n'qname'.  Note that a qname is the whole attribute name.  This is\ndifferent than above.\n\nFile: python3.12.info,  Node: Attr Objects,  Next: NamedNodeMap Objects,  Prev: Element Objects<2>,  Up: Objects in the DOM\n\n5.20.6.9 Attr Objects\n.....................\n\n'Attr' inherits from 'Node', so inherits all its attributes.\n\n-- Attribute: Attr.name\n\nThe attribute name.  In a namespace-using document it may include a\ncolon.\n\n-- Attribute: Attr.localName\n\nThe part of the name following the colon if there is one, else the\nentire name.  This is a read-only attribute.\n\n-- Attribute: Attr.prefix\n\nThe part of the name preceding the colon if there is one, else the\nempty string.\n\n-- Attribute: Attr.value\n\nThe text value of the attribute.  This is a synonym for the\n'nodeValue' attribute.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: NamedNodeMap Objects,  Next: Comment Objects,  Prev: Attr Objects,  Up: Objects in the DOM": {
            "content": "5.20.6.10 NamedNodeMap Objects\n..............................\n\n'NamedNodeMap' does 'not' inherit from 'Node'.\n\n-- Attribute: NamedNodeMap.length\n\nThe length of the attribute list.\n\n-- Method: NamedNodeMap.item (index)\n\nReturn an attribute with a particular index.  The order you get the\nattributes in is arbitrary but will be consistent for the life of a\nDOM. Each item is an attribute node.  Get its value with the\n'value' attribute.\n",
            "subsections": []
        },
        "There are also experimental methods that give this class more mapping": {
            "content": "behavior.  You can use them or you can use the standardized\n'getAttribute*()' family of methods on the 'Element' objects.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Comment Objects,  Next: Text and CDATASection Objects,  Prev: NamedNodeMap Objects,  Up: Objects in the DOM": {
            "content": "5.20.6.11 Comment Objects\n.........................\n\n'Comment' represents a comment in the XML document.  It is a subclass of\n'Node', but cannot have child nodes.\n\n-- Attribute: Comment.data\n\nThe content of the comment as a string.  The attribute contains all\ncharacters between the leading '<!-''-' and trailing '-''->', but\ndoes not include them.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Text and CDATASection Objects,  Next: ProcessingInstruction Objects,  Prev: Comment Objects,  Up: Objects in the DOM": {
            "content": "5.20.6.12 Text and CDATASection Objects\n.......................................\n",
            "subsections": []
        },
        "The 'Text' interface represents text in the XML document.  If the parser": {
            "content": "and DOM implementation support the DOM's XML extension, portions of the\ntext enclosed in CDATA marked sections are stored in 'CDATASection'\nobjects.  These two interfaces are identical, but provide different\nvalues for the 'nodeType' attribute.\n",
            "subsections": []
        },
        "These interfaces extend the 'Node' interface.  They cannot have child": {
            "content": "nodes.\n\n-- Attribute: Text.data\n\nThe content of the text node as a string.\n\nNote: The use of a 'CDATASection' node does not indicate that the\nnode represents a complete CDATA marked section, only that the\ncontent of the node was part of a CDATA section.  A single CDATA\nsection may be represented by more than one node in the document\ntree.  There is no way to determine whether two adjacent\n'CDATASection' nodes represent different CDATA marked sections.\n\nFile: python3.12.info,  Node: ProcessingInstruction Objects,  Next: Exceptions<18>,  Prev: Text and CDATASection Objects,  Up: Objects in the DOM\n\n5.20.6.13 ProcessingInstruction Objects\n.......................................\n",
            "subsections": []
        },
        "Represents a processing instruction in the XML document; this inherits": {
            "content": "from the 'Node' interface and cannot have child nodes.\n\n-- Attribute: ProcessingInstruction.target\n\nThe content of the processing instruction up to the first\nwhitespace character.  This is a read-only attribute.\n\n-- Attribute: ProcessingInstruction.data\n\nThe content of the processing instruction following the first\nwhitespace character.\n\nFile: python3.12.info,  Node: Exceptions<18>,  Prev: ProcessingInstruction Objects,  Up: Objects in the DOM\n\n5.20.6.14 Exceptions\n....................\n\nThe DOM Level 2 recommendation defines a single exception, *note\nDOMException: 3470, and a number of constants that allow applications to\ndetermine what sort of error occurred.  *note DOMException: 3470.\ninstances carry a *note code: 18. attribute that provides the\nappropriate value for the specific exception.\n",
            "subsections": []
        },
        "The Python DOM interface provides the constants, but also expands the": {
            "content": "set of exceptions so that a specific exception exists for each of the\nexception codes defined by the DOM. The implementations must raise the\nappropriate specific exception, each of which carries the appropriate\nvalue for the *note code: 18. attribute.\n\n-- Exception: xml.dom.DOMException\n\nBase exception class used for all specific DOM exceptions.  This\nexception class cannot be directly instantiated.\n\n-- Exception: xml.dom.DomstringSizeErr\n\nRaised when a specified range of text does not fit into a string.\nThis is not known to be used in the Python DOM implementations, but\nmay be received from DOM implementations not written in Python.\n\n-- Exception: xml.dom.HierarchyRequestErr\n\nRaised when an attempt is made to insert a node where the node type\nis not allowed.\n\n-- Exception: xml.dom.IndexSizeErr\n\nRaised when an index or size parameter to a method is negative or\nexceeds the allowed values.\n\n-- Exception: xml.dom.InuseAttributeErr\n\nRaised when an attempt is made to insert an 'Attr' node that is\nalready present elsewhere in the document.\n\n-- Exception: xml.dom.InvalidAccessErr\n\nRaised if a parameter or an operation is not supported on the\nunderlying object.\n\n-- Exception: xml.dom.InvalidCharacterErr\n\nThis exception is raised when a string parameter contains a\ncharacter that is not permitted in the context it's being used in\nby the XML 1.0 recommendation.  For example, attempting to create\nan 'Element' node with a space in the element type name will cause\nthis error to be raised.\n\n-- Exception: xml.dom.InvalidModificationErr\n\nRaised when an attempt is made to modify the type of a node.\n\n-- Exception: xml.dom.InvalidStateErr\n\nRaised when an attempt is made to use an object that is not defined\nor is no longer usable.\n\n-- Exception: xml.dom.NamespaceErr\n\nIf an attempt is made to change any object in a way that is not\npermitted with regard to the Namespaces in XML(1) recommendation,\nthis exception is raised.\n\n-- Exception: xml.dom.NotFoundErr\n\nException when a node does not exist in the referenced context.\nFor example, 'NamedNodeMap.removeNamedItem()' will raise this if\nthe node passed in does not exist in the map.\n\n-- Exception: xml.dom.NotSupportedErr\n\nRaised when the implementation does not support the requested type\nof object or operation.\n\n-- Exception: xml.dom.NoDataAllowedErr\n\nThis is raised if data is specified for a node which does not\nsupport data.\n\n-- Exception: xml.dom.NoModificationAllowedErr\n\nRaised on attempts to modify an object where modifications are not\nallowed (such as for read-only nodes).\n\n-- Exception: xml.dom.SyntaxErr\n\nRaised when an invalid or illegal string is specified.\n\n-- Exception: xml.dom.WrongDocumentErr\n\nRaised when a node is inserted in a different document than it\ncurrently belongs to, and the implementation does not support\nmigrating the node from one document to the other.\n",
            "subsections": []
        },
        "The exception codes defined in the DOM recommendation map to the": {
            "content": "exceptions described above according to this table:\n",
            "subsections": []
        },
        "Constant                                   Exception": {
            "content": "---------------------------------------------------------------------------------\n\n'DOMSTRINGSIZEERR'                       *note DomstringSizeErr: 3471.\n\n\n'HIERARCHYREQUESTERR'                    *note HierarchyRequestErr: 3472.\n\n\n'INDEXSIZEERR'                           *note IndexSizeErr: 3473.\n\n\n'INUSEATTRIBUTEERR'                      *note InuseAttributeErr: 345b.\n\n\n'INVALIDACCESSERR'                       *note InvalidAccessErr: 3474.\n\n\n'INVALIDCHARACTERERR'                    *note InvalidCharacterErr: 3475.\n\n\n'INVALIDMODIFICATIONERR'                 *note InvalidModificationErr: 3476.\n\n\n'INVALIDSTATEERR'                        *note InvalidStateErr: 3477.\n\n\n'NAMESPACEERR'                            *note NamespaceErr: 3478.\n\n\n'NOTFOUNDERR'                            *note NotFoundErr: 3456.\n\n\n'NOTSUPPORTEDERR'                        *note NotSupportedErr: 3479.\n\n\n'NODATAALLOWEDERR'                      *note NoDataAllowedErr: 347a.\n\n\n'NOMODIFICATIONALLOWEDERR'              *note NoModificationAllowedErr: 347b.\n\n\n'SYNTAXERR'                               *note SyntaxErr: 347c.\n\n\n'WRONGDOCUMENTERR'                       *note WrongDocumentErr: 347d.\n\n\n---------- Footnotes ----------\n\n(1) https://www.w3.org/TR/REC-xml-names/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Conformance,  Prev: Objects in the DOM,  Up: xml dom -- The Document Object Model API": {
            "content": "5.20.6.15 Conformance\n.....................\n",
            "subsections": []
        },
        "This section describes the conformance requirements and relationships": {
            "content": "between the Python DOM API, the W3C DOM recommendations, and the OMG IDL\nmapping for Python.\n\n* Menu:\n\n* Type Mapping::\n* Accessor Methods::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Type Mapping,  Next: Accessor Methods,  Up: Conformance": {
            "content": "5.20.6.16 Type Mapping\n......................\n",
            "subsections": []
        },
        "The IDL types used in the DOM specification are mapped to Python types": {
            "content": "according to the following table.\n\nIDL Type               Python Type\n\n-----------------------------------------------------------------------\n\n'boolean'              'bool' or 'int'\n\n\n'int'                  'int'\n\n\n'long int'             'int'\n\n\n'unsigned int'         'int'\n\n\n'DOMString'            'str' or 'bytes'\n\n\n'null'                 'None'\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Accessor Methods,  Prev: Type Mapping,  Up: Conformance": {
            "content": "5.20.6.17 Accessor Methods\n..........................\n",
            "subsections": []
        },
        "The mapping from OMG IDL to Python defines accessor functions for IDL": {
            "content": "'attribute' declarations in much the way the Java mapping does.  Mapping\nthe IDL declarations\n\nreadonly attribute string someValue;\nattribute string anotherValue;\n\nyields three accessor functions: a \"get\" method for 'someValue'\n('getsomeValue()'), and \"get\" and \"set\" methods for 'anotherValue'\n('getanotherValue()' and 'setanotherValue()').  The mapping, in\nparticular, does not require that the IDL attributes are accessible as\nnormal Python attributes: 'object.someValue' is 'not' required to work,\nand may raise an *note AttributeError: 395.\n",
            "subsections": []
        },
        "The Python DOM API, however, 'does' require that normal attribute access": {
            "content": "work.  This means that the typical surrogates generated by Python IDL\ncompilers are not likely to work, and wrapper objects may be needed on\nthe client if the DOM objects are accessed via CORBA. While this does\nrequire some additional consideration for CORBA DOM clients, the\nimplementers with experience using DOM over CORBA from Python do not\nconsider this a problem.  Attributes that are declared 'readonly' may\nnot restrict write access in all DOM implementations.\n",
            "subsections": []
        },
        "In the Python DOM API, accessor functions are not required.  If": {
            "content": "provided, they should take the form defined by the Python IDL mapping,\nbut these methods are considered unnecessary since the attributes are\naccessible directly from Python.  \"Set\" accessors should never be\nprovided for 'readonly' attributes.\n",
            "subsections": []
        },
        "The IDL definitions do not fully embody the requirements of the W3C DOM": {
            "content": "API, such as the notion of certain objects, such as the return value of\n'getElementsByTagName()', being \"live\".  The Python DOM API does not\nrequire implementations to enforce such requirements.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "'Source code:' Lib/xml/dom/minidom.py(1)\n\n\n\n*note xml.dom.minidom: 11d. is a minimal implementation of the Document\nObject Model interface, with an API similar to that in other languages.",
            "subsections": []
        },
        "It is intended to be simpler than the full DOM and also significantly": {
            "content": "smaller.  Users who are not already proficient with the DOM should\nconsider using the *note xml.etree.ElementTree: 120. module for their\nXML processing instead.\n\nWarning: The *note xml.dom.minidom: 11d. module is not secure\nagainst maliciously constructed data.  If you need to parse\nuntrusted or unauthenticated data see *note XML vulnerabilities:\n33aa.\n\nDOM applications typically start by parsing some XML into a DOM. With\n*note xml.dom.minidom: 11d, this is done through the parse functions:\n\nfrom xml.dom.minidom import parse, parseString\n\ndom1 = parse('c:\\\\temp\\\\mydata.xml')  # parse an XML file by name\n\ndatasource = open('c:\\\\temp\\\\mydata.xml')\ndom2 = parse(datasource)  # parse an open file\n\ndom3 = parseString('<myxml>Some data<empty/> some more data</myxml>')\n\nThe *note parse(): 3485. function can take either a filename or an open\nfile object.\n\n-- Function: xml.dom.minidom.parse (filenameorfile, parser=None,\nbufsize=None)\n\nReturn a 'Document' from the given input.  'filenameorfile' may\nbe either a file name, or a file-like object.  'parser', if given,\nmust be a SAX2 parser object.  This function will change the\ndocument handler of the parser and activate namespace support;\nother parser configuration (like setting an entity resolver) must\nhave been done in advance.\n\nIf you have XML in a string, you can use the *note parseString(): 3486.\nfunction instead:\n\n-- Function: xml.dom.minidom.parseString (string, parser=None)\n\nReturn a 'Document' that represents the 'string'.  This method\ncreates an *note io.StringIO: d94. object for the string and passes\nthat on to *note parse(): 3485.\n",
            "subsections": []
        },
        "Both functions return a 'Document' object representing the content of": {
            "content": "the document.\n\nWhat the *note parse(): 3485. and *note parseString(): 3486. functions\ndo is connect an XML parser with a \"DOM builder\" that can accept parse\nevents from any SAX parser and convert them into a DOM tree.  The name\nof the functions are perhaps misleading, but are easy to grasp when\nlearning the interfaces.  The parsing of the document will be completed\nbefore these functions return; it's simply that these functions do not\nprovide a parser implementation themselves.\n\nYou can also create a 'Document' by calling a method on a \"DOM\nImplementation\" object.  You can get this object either by calling the\n'getDOMImplementation()' function in the *note xml.dom: 11c. package or\nthe *note xml.dom.minidom: 11d. module.  Once you have a 'Document', you\ncan add child nodes to it to populate the DOM:\n\nfrom xml.dom.minidom import getDOMImplementation\n\nimpl = getDOMImplementation()\n\nnewdoc = impl.createDocument(None, \"sometag\", None)\ntopelement = newdoc.documentElement\ntext = newdoc.createTextNode('Some textual content.')\ntopelement.appendChild(text)\n",
            "subsections": []
        },
        "When you are finished with a DOM tree, you may optionally call the": {
            "content": "'unlink()' method to encourage early cleanup of the now-unneeded\nobjects.  'unlink()' is an *note xml.dom.minidom: 11d.-specific\nextension to the DOM API that renders the node and its descendants\nessentially useless.  Otherwise, Python's garbage collector will\neventually take care of the objects in the tree.\n\nSee also\n........\n",
            "subsections": []
        },
        "Document Object Model (DOM) Level 1 Specification(2)": {
            "content": "The W3C recommendation for the DOM supported by *note\nxml.dom.minidom: 11d.\n\n* Menu:\n\n* DOM Objects::\n* DOM Example::\n* minidom and the DOM standard::\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/xml/dom/minidom.py\n\n(2) https://www.w3.org/TR/REC-DOM-Level-1/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: DOM Objects,  Next: DOM Example,  Up: xml dom minidom -- Minimal DOM implementation": {
            "content": "5.20.7.1 DOM Objects\n....................\n\nThe definition of the DOM API for Python is given as part of the *note\nxml.dom: 11c. module documentation.  This section lists the differences\nbetween the API and *note xml.dom.minidom: 11d.\n\n-- Method: Node.unlink ()\n\nBreak internal references within the DOM so that it will be garbage\ncollected on versions of Python without cyclic GC. Even when cyclic\nGC is available, using this can make large amounts of memory\navailable sooner, so calling this on DOM objects as soon as they\nare no longer needed is good practice.  This only needs to be\ncalled on the 'Document' object, but may be called on child nodes\nto discard children of that node.\n\nYou can avoid calling this method explicitly by using the *note\nwith: 396. statement.  The following code will automatically unlink\n'dom' when the 'with' block is exited:\n\nwith xml.dom.minidom.parse(datasource) as dom:\n... # Work with dom.\n\n-- Method: Node.writexml (writer, indent='', addindent='', newl='',\nencoding=None, standalone=None)\n\nWrite XML to the writer object.  The writer receives texts but not\nbytes as input, it should have a 'write()' method which matches\nthat of the file object interface.  The 'indent' parameter is the\nindentation of the current node.  The 'addindent' parameter is the\nincremental indentation to use for subnodes of the current one.\nThe 'newl' parameter specifies the string to use to terminate\nnewlines.\n\nFor the 'Document' node, an additional keyword argument 'encoding'\ncan be used to specify the encoding field of the XML header.\n\nSimilarly, explicitly stating the 'standalone' argument causes the\nstandalone document declarations to be added to the prologue of the\nXML document.  If the value is set to 'True', 'standalone=\"yes\"' is\nadded, otherwise it is set to '\"no\"'.  Not stating the argument\nwill omit the declaration from the document.\n\nChanged in version 3.8: The *note writexml(): 348a. method now\npreserves the attribute order specified by the user.\n\nChanged in version 3.9: The 'standalone' parameter was added.\n\n-- Method: Node.toxml (encoding=None, standalone=None)\n\nReturn a string or byte string containing the XML represented by\nthe DOM node.\n\nWith an explicit 'encoding' (1) argument, the result is a byte\nstring in the specified encoding.  With no 'encoding' argument, the\nresult is a Unicode string, and the XML declaration in the\nresulting string does not specify an encoding.  Encoding this\nstring in an encoding other than UTF-8 is likely incorrect, since\nUTF-8 is the default encoding of XML.\n\nThe 'standalone' argument behaves exactly as in *note writexml():\n348a.\n\nChanged in version 3.8: The *note toxml(): 1322. method now\npreserves the attribute order specified by the user.\n\nChanged in version 3.9: The 'standalone' parameter was added.\n\n-- Method: Node.toprettyxml (indent='\\t', newl='\\n', encoding=None,\nstandalone=None)\n\nReturn a pretty-printed version of the document.  'indent'\nspecifies the indentation string and defaults to a tabulator;\n'newl' specifies the string emitted at the end of each line and\ndefaults to '\\n'.\n\nThe 'encoding' argument behaves like the corresponding argument of\n*note toxml(): 1322.\n\nThe 'standalone' argument behaves exactly as in *note writexml():\n348a.\n\nChanged in version 3.8: The *note toprettyxml(): 1323. method now\npreserves the attribute order specified by the user.\n\nChanged in version 3.9: The 'standalone' parameter was added.\n\n---------- Footnotes ----------\n\n(1) The encoding name included in the XML output should conform to\nthe appropriate standards.  For example, \"UTF-8\" is valid, but \"UTF8\" is\nnot valid in an XML document's declaration, even though Python accepts\nit as an encoding name.  See\n'https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl' and\n'https://www.iana.org/assignments/character-sets/character-sets.xhtml'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: DOM Example,  Next: minidom and the DOM standard,  Prev: DOM Objects,  Up: xml dom minidom -- Minimal DOM implementation": {
            "content": "5.20.7.2 DOM Example\n....................\n\nThis example program is a fairly realistic example of a simple program.",
            "subsections": []
        },
        "In this particular case, we do not take much advantage of the": {
            "content": "flexibility of the DOM.\n\nimport xml.dom.minidom\n\ndocument = \"\"\"\\\n<slideshow>\n<title>Demo slideshow</title>\n<slide><title>Slide title</title>\n<point>This is a demo</point>\n<point>Of a program for processing slides</point>\n</slide>\n\n<slide><title>Another demo slide</title>\n<point>It is important</point>\n<point>To have more than</point>\n<point>one slide</point>\n</slide>\n</slideshow>\n\"\"\"\n\ndom = xml.dom.minidom.parseString(document)\n\ndef getText(nodelist):\nrc = []\nfor node in nodelist:\nif node.nodeType == node.TEXTNODE:\nrc.append(node.data)\nreturn ''.join(rc)\n\ndef handleSlideshow(slideshow):\nprint(\"<html>\")\nhandleSlideshowTitle(slideshow.getElementsByTagName(\"title\")[0])\nslides = slideshow.getElementsByTagName(\"slide\")\nhandleToc(slides)\nhandleSlides(slides)\nprint(\"</html>\")\n\ndef handleSlides(slides):\nfor slide in slides:\nhandleSlide(slide)\n\ndef handleSlide(slide):\nhandleSlideTitle(slide.getElementsByTagName(\"title\")[0])\nhandlePoints(slide.getElementsByTagName(\"point\"))\n\ndef handleSlideshowTitle(title):\nprint(f\"<title>{getText(title.childNodes)}</title>\")\n\ndef handleSlideTitle(title):\nprint(f\"<h2>{getText(title.childNodes)}</h2>\")\n\ndef handlePoints(points):\nprint(\"<ul>\")\nfor point in points:\nhandlePoint(point)\nprint(\"</ul>\")\n\ndef handlePoint(point):\nprint(f\"<li>{getText(point.childNodes)}</li>\")\n\ndef handleToc(slides):\nfor slide in slides:\ntitle = slide.getElementsByTagName(\"title\")[0]\nprint(f\"<p>{getText(title.childNodes)}</p>\")\n\nhandleSlideshow(dom)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: minidom and the DOM standard,  Prev: DOM Example,  Up: xml dom minidom -- Minimal DOM implementation": {
            "content": "5.20.7.3 minidom and the DOM standard\n.....................................\n\nThe *note xml.dom.minidom: 11d. module is essentially a DOM\n1.0-compatible DOM with some DOM 2 features (primarily namespace\nfeatures).\n",
            "subsections": []
        },
        "Usage of the DOM interface in Python is straight-forward.  The following": {
            "content": "mapping rules apply:\n\n* Interfaces are accessed through instance objects.  Applications\nshould not instantiate the classes themselves; they should use the\ncreator functions available on the 'Document' object.  Derived\ninterfaces support all operations (and attributes) from the base\ninterfaces, plus any new operations.\n\n* Operations are used as methods.  Since the DOM uses only *note in:\n250. parameters, the arguments are passed in normal order (from\nleft to right).  There are no optional arguments.  'void'\noperations return 'None'.\n\n* IDL attributes map to instance attributes.  For compatibility with\nthe OMG IDL language mapping for Python, an attribute 'foo' can\nalso be accessed through accessor methods 'getfoo()' and\n'setfoo()'.  'readonly' attributes must not be changed; this is\nnot enforced at runtime.\n\n* The types 'short int', 'unsigned int', 'unsigned long long', and\n'boolean' all map to Python integer objects.\n\n* The type 'DOMString' maps to Python strings.  *note\nxml.dom.minidom: 11d. supports either bytes or strings, but will\nnormally produce strings.  Values of type 'DOMString' may also be\n'None' where allowed to have the IDL 'null' value by the DOM\nspecification from the W3C.\n\n* 'const' declarations map to variables in their respective scope\n(e.g.  'xml.dom.minidom.Node.PROCESSINGINSTRUCTIONNODE'); they\nmust not be changed.\n\n* 'DOMException' is currently not supported in *note xml.dom.minidom:\n11d.  Instead, *note xml.dom.minidom: 11d. uses standard Python\nexceptions such as *note TypeError: 28e. and *note AttributeError:\n395.\n\n* 'NodeList' objects are implemented using Python's built-in list\ntype.  These objects provide the interface defined in the DOM\nspecification, but with earlier versions of Python they do not\nsupport the official API. They are, however, much more \"Pythonic\"\nthan the interface defined in the W3C recommendations.\n\nThe following interfaces have no implementation in *note\nxml.dom.minidom: 11d.:\n\n* 'DOMTimeStamp'\n\n* 'EntityReference'\n",
            "subsections": []
        },
        "Most of these reflect information in the XML document that is not of": {
            "content": "general utility to most DOM users.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "'Source code:' Lib/xml/dom/pulldom.py(1)\n\n\n\nThe *note xml.dom.pulldom: 11e. module provides a \"pull parser\" which\ncan also be asked to produce DOM-accessible fragments of the document\nwhere necessary.  The basic concept involves pulling \"events\" from a\nstream of incoming XML and processing them.  In contrast to SAX which\nalso employs an event-driven processing model together with callbacks,\nthe user of a pull parser is responsible for explicitly pulling events\nfrom the stream, looping over those events until either processing is\nfinished or an error condition occurs.\n\nWarning: The *note xml.dom.pulldom: 11e. module is not secure\nagainst maliciously constructed data.  If you need to parse\nuntrusted or unauthenticated data see *note XML vulnerabilities:\n33aa.\n",
            "subsections": []
        },
        "Changed in version 3.7.1: The SAX parser no longer processes general": {
            "content": "external entities by default to increase security.  Before, the parser\ncreated network connections to fetch remote files or loaded local files\nfrom the file system for DTD and entities.  The feature can be enabled\nagain with method *note setFeature(): 349f. on the parser object and\nargument *note featureexternalges: 34a0.\n\nThe convenience functions are:\n\n-- Function: xml.sax.makeparser (parserlist=[])\n\nCreate and return a SAX *note XMLReader: 3496. object.  The first\nparser found will be used.  If 'parserlist' is provided, it must\nbe an iterable of strings which name modules that have a function\nnamed 'createparser()'.  Modules listed in 'parserlist' will be\nused before modules in the default list of parsers.\n\nChanged in version 3.8: The 'parserlist' argument can be any\niterable, not just a list.\n\n-- Function: xml.sax.parse (filenameorstream, handler,\nerrorhandler=handler.ErrorHandler())\n\nCreate a SAX parser and use it to parse a document.  The document,\npassed in as 'filenameorstream', can be a filename or a file\nobject.  The 'handler' parameter needs to be a SAX *note\nContentHandler: 3493. instance.  If 'errorhandler' is given, it\nmust be a SAX *note ErrorHandler: 34a1. instance; if omitted, *note\nSAXParseException: 34a2. will be raised on all errors.  There is no\nreturn value; all work must be done by the 'handler' passed in.\n\n-- Function: xml.sax.parseString (string, handler,\nerrorhandler=handler.ErrorHandler())\n\nSimilar to *note parse(): 177c, but parses from a buffer 'string'\nreceived as a parameter.  'string' must be a *note str: 157.\ninstance or a *note bytes-like object: b82.\n\nChanged in version 3.5: Added support of *note str: 157. instances.\n\nA typical SAX application uses three kinds of objects: readers, handlers\nand input sources.  \"Reader\" in this context is another term for parser,\ni.e.  some piece of code that reads the bytes or characters from the\ninput source, and produces a sequence of events.  The events then get\ndistributed to the handler objects, i.e.  the reader invokes a method on\nthe handler.  A SAX application must therefore obtain a reader object,\ncreate or open the input sources, create the handlers, and connect these\nobjects all together.  As the final step of preparation, the reader is\ncalled to parse the input.  During parsing, methods on the handler\nobjects are called based on structural and syntactic events from the\ninput data.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: DOMEventStream Objects,  Up: xml dom pulldom -- Support for building partial DOM trees": {
            "content": "5.20.8.1 DOMEventStream Objects\n...............................\n\n-- Class: xml.dom.pulldom.DOMEventStream (stream, parser, bufsize)\n\nChanged in version 3.11: Support for *note getitem(): 4b9.\nmethod has been removed.\n\n-- Method: getEvent ()\n\nReturn a tuple containing 'event' and the current 'node' as\n'xml.dom.minidom.Document' if event equals 'STARTDOCUMENT',\n'xml.dom.minidom.Element' if event equals 'STARTELEMENT' or\n'ENDELEMENT' or 'xml.dom.minidom.Text' if event equals\n'CHARACTERS'.  The current node does not contain information\nabout its children, unless *note expandNode(): 3491. is\ncalled.\n\n-- Method: expandNode (node)\n\nExpands all children of 'node' into 'node'.  Example:\n\nfrom xml.dom import pulldom\n\nxml = '<html><title>Foo</title> <p>Some text <div>and more</div></p> </html>'\ndoc = pulldom.parseString(xml)\nfor event, node in doc:\nif event == pulldom.STARTELEMENT and node.tagName == 'p':\n# Following statement only prints '<p/>'\nprint(node.toxml())\ndoc.expandNode(node)\n# Following statement prints node with all its children '<p>Some text <div>and more</div></p>'\nprint(node.toxml())\n\n-- Method: reset ()\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "'Source code:' Lib/xml/sax/init.py(1)\n\n\n\nThe *note xml.sax: 124. package provides a number of modules which\nimplement the Simple API for XML (SAX) interface for Python.  The\npackage itself provides the SAX exceptions and the convenience functions\nwhich will be most used by users of the SAX API.\n\nWarning: The *note xml.sax: 124. module is not secure against\nmaliciously constructed data.  If you need to parse untrusted or\nunauthenticated data see *note XML vulnerabilities: 33aa.\n",
            "subsections": []
        },
        "For these objects, only the interfaces are relevant; they are normally": {
            "content": "not instantiated by the application itself.  Since Python does not have\nan explicit notion of interface, they are formally introduced as\nclasses, but applications may use implementations which do not inherit\nfrom the provided classes.  The *note InputSource: cff, *note Locator:\n34a3, 'Attributes', 'AttributesNS', and *note XMLReader: 3496.\ninterfaces are defined in the module *note xml.sax.xmlreader: 127.  The\nhandler interfaces are defined in *note xml.sax.handler: 125.  For\nconvenience, *note InputSource: cff. (which is often instantiated\ndirectly) and the handler classes are also available from *note xml.sax:\n124.  These interfaces are described below.\n\nIn addition to these classes, *note xml.sax: 124. provides the following\nexception classes.\n\n-- Exception: xml.sax.SAXException (msg, exception=None)\n\nEncapsulate an XML error or warning.  This class can contain basic\nerror or warning information from either the XML parser or the\napplication: it can be subclassed to provide additional\nfunctionality or to add localization.  Note that although the\nhandlers defined in the *note ErrorHandler: 34a1. interface receive\ninstances of this exception, it is not required to actually raise\nthe exception -- it is also useful as a container for information.\n\nWhen instantiated, 'msg' should be a human-readable description of\nthe error.  The optional 'exception' parameter, if given, should be\n'None' or an exception that was caught by the parsing code and is\nbeing passed along as information.\n\nThis is the base class for the other SAX exception classes.\n\n-- Exception: xml.sax.SAXParseException (msg, exception, locator)\n\nSubclass of *note SAXException: 34a4. raised on parse errors.\nInstances of this class are passed to the methods of the SAX *note\nErrorHandler: 34a1. interface to provide information about the\nparse error.  This class supports the SAX *note Locator: 34a3.\ninterface as well as the *note SAXException: 34a4. interface.\n\n-- Exception: xml.sax.SAXNotRecognizedException (msg, exception=None)\n\nSubclass of *note SAXException: 34a4. raised when a SAX *note\nXMLReader: 3496. is confronted with an unrecognized feature or\nproperty.  SAX applications and extensions may use this class for\nsimilar purposes.\n\n-- Exception: xml.sax.SAXNotSupportedException (msg, exception=None)\n\nSubclass of *note SAXException: 34a4. raised when a SAX *note\nXMLReader: 3496. is asked to enable a feature that is not\nsupported, or to set a property to a value that the implementation\ndoes not support.  SAX applications and extensions may use this\nclass for similar purposes.\n\nSee also\n........\n\nSAX: The Simple API for XML(2)\n\nThis site is the focal point for the definition of the SAX API. It\nprovides a Java implementation and online documentation.  Links to\nimplementations and historical information are also available.\n\nModule *note xml.sax.handler: 125.\n\nDefinitions of the interfaces for application-provided objects.\n\nModule *note xml.sax.saxutils: 126.\n\nConvenience functions for use in SAX applications.\n\nModule *note xml.sax.xmlreader: 127.\n\nDefinitions of the interfaces for parser-provided objects.\n\n* Menu:\n\n* SAXException Objects::\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/xml/sax/init.py\n\n(2) http://www.saxproject.org/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: SAXException Objects,  Up: xml sax -- Support for SAX2 parsers": {
            "content": "5.20.9.1 SAXException Objects\n.............................\n\nThe *note SAXException: 34a4. exception class supports the following\nmethods:\n\n-- Method: SAXException.getMessage ()\n\nReturn a human-readable message describing the error condition.\n\n-- Method: SAXException.getException ()\n\nReturn an encapsulated exception object, or 'None'.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "'Source code:' Lib/xml/sax/handler.py(1)\n\n\n",
            "subsections": []
        },
        "The SAX API defines five kinds of handlers: content handlers, DTD": {
            "content": "handlers, error handlers, entity resolvers and lexical handlers.",
            "subsections": []
        },
        "Applications normally only need to implement those interfaces whose": {
            "content": "events they are interested in; they can implement the interfaces in a\nsingle object or in multiple objects.  Handler implementations should\ninherit from the base classes provided in the module *note\nxml.sax.handler: 125, so that all methods get default implementations.\n\n-- Class: xml.sax.handler.ContentHandler\n\nThis is the main callback interface in SAX, and the one most\nimportant to applications.  The order of events in this interface\nmirrors the order of the information in the document.\n\n-- Class: xml.sax.handler.DTDHandler\n\nHandle DTD events.\n\nThis interface specifies only those DTD events required for basic\nparsing (unparsed entities and attributes).\n\n-- Class: xml.sax.handler.EntityResolver\n\nBasic interface for resolving entities.  If you create an object\nimplementing this interface, then register the object with your\nParser, the parser will call the method in your object to resolve\nall external entities.\n\n-- Class: xml.sax.handler.ErrorHandler\n\nInterface used by the parser to present error and warning messages\nto the application.  The methods of this object control whether\nerrors are immediately converted to exceptions or are handled in\nsome other way.\n\n-- Class: xml.sax.handler.LexicalHandler\n\nInterface used by the parser to represent low frequency events\nwhich may not be of interest to many applications.\n\nIn addition to these classes, *note xml.sax.handler: 125. provides\nsymbolic constants for the feature and property names.\n\n-- Data: xml.sax.handler.featurenamespaces\n\nvalue: '\"http://xml.org/sax/features/namespaces\"'\ntrue: Perform Namespace processing.\nfalse: Optionally do not perform Namespace processing (implies namespace-prefixes; default).\naccess: (parsing) read-only; (not parsing) read/write\n\n-- Data: xml.sax.handler.featurenamespaceprefixes\n\nvalue: '\"http://xml.org/sax/features/namespace-prefixes\"'\ntrue: Report the original prefixed names and attributes used for Namespace declarations.\nfalse: Do not report attributes used for Namespace declarations, and optionally do not report original prefixed names (default).\naccess: (parsing) read-only; (not parsing) read/write\n\n-- Data: xml.sax.handler.featurestringinterning\n\nvalue: '\"http://xml.org/sax/features/string-interning\"'\ntrue: All element names, prefixes, attribute names, Namespace URIs, and local names are interned using the built-in intern function.\nfalse: Names are not necessarily interned, although they may be (default).\naccess: (parsing) read-only; (not parsing) read/write\n\n-- Data: xml.sax.handler.featurevalidation\n\nvalue: '\"http://xml.org/sax/features/validation\"'\ntrue: Report all validation errors (implies external-general-entities and external-parameter-entities).\nfalse: Do not report validation errors.\naccess: (parsing) read-only; (not parsing) read/write\n\n-- Data: xml.sax.handler.featureexternalges\n\nvalue: '\"http://xml.org/sax/features/external-general-entities\"'\ntrue: Include all external general (text) entities.\nfalse: Do not include external general entities.\naccess: (parsing) read-only; (not parsing) read/write\n\n-- Data: xml.sax.handler.featureexternalpes\n\nvalue: '\"http://xml.org/sax/features/external-parameter-entities\"'\ntrue: Include all external parameter entities, including the external DTD subset.\nfalse: Do not include any external parameter entities, even the external DTD subset.\naccess: (parsing) read-only; (not parsing) read/write\n\n-- Data: xml.sax.handler.allfeatures\n\nList of all features.\n\n-- Data: xml.sax.handler.propertylexicalhandler\n\nvalue: '\"http://xml.org/sax/properties/lexical-handler\"'\ndata type: xml.sax.handler.LexicalHandler (not supported in Python 2)\ndescription: An optional extension handler for lexical events like comments.\naccess: read/write\n\n-- Data: xml.sax.handler.propertydeclarationhandler\n\nvalue: '\"http://xml.org/sax/properties/declaration-handler\"'\ndata type: xml.sax.sax2lib.DeclHandler (not supported in Python 2)\ndescription: An optional extension handler for DTD-related events other than notations and unparsed entities.\naccess: read/write\n\n-- Data: xml.sax.handler.propertydomnode\n\nvalue: '\"http://xml.org/sax/properties/dom-node\"'\ndata type: org.w3c.dom.Node (not supported in Python 2)\ndescription: When parsing, the current DOM node being visited if this is a DOM iterator; when not parsing, the root DOM node for iteration.\naccess: (parsing) read-only; (not parsing) read/write\n\n-- Data: xml.sax.handler.propertyxmlstring\n\nvalue: '\"http://xml.org/sax/properties/xml-string\"'\ndata type: Bytes\ndescription: The literal string of characters that was the source for the current event.\naccess: read-only\n\n-- Data: xml.sax.handler.allproperties\n\nList of all known property names.\n\n* Menu:\n\n* ContentHandler Objects::\n* DTDHandler Objects::\n* EntityResolver Objects::\n* ErrorHandler Objects::\n* LexicalHandler Objects::\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/xml/sax/handler.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ContentHandler Objects,  Next: DTDHandler Objects,  Up: xml sax handler -- Base classes for SAX handlers": {
            "content": "5.20.10.1 ContentHandler Objects\n................................\n\nUsers are expected to subclass *note ContentHandler: 3493. to support\ntheir application.  The following methods are called by the parser on\nthe appropriate events in the input document:\n\n-- Method: ContentHandler.setDocumentLocator (locator)\n\nCalled by the parser to give the application a locator for locating\nthe origin of document events.\n\nSAX parsers are strongly encouraged (though not absolutely\nrequired) to supply a locator: if it does so, it must supply the\nlocator to the application by invoking this method before invoking\nany of the other methods in the DocumentHandler interface.\n\nThe locator allows the application to determine the end position of\nany document-related event, even if the parser is not reporting an\nerror.  Typically, the application will use this information for\nreporting its own errors (such as character content that does not\nmatch an application's business rules).  The information returned\nby the locator is probably not sufficient for use with a search\nengine.\n\nNote that the locator will return correct information only during\nthe invocation of the events in this interface.  The application\nshould not attempt to use it at any other time.\n\n-- Method: ContentHandler.startDocument ()\n\nReceive notification of the beginning of a document.\n\nThe SAX parser will invoke this method only once, before any other\nmethods in this interface or in DTDHandler (except for *note\nsetDocumentLocator(): 34bc.).\n\n-- Method: ContentHandler.endDocument ()\n\nReceive notification of the end of a document.\n\nThe SAX parser will invoke this method only once, and it will be\nthe last method invoked during the parse.  The parser shall not\ninvoke this method until it has either abandoned parsing (because\nof an unrecoverable error) or reached the end of input.\n\n-- Method: ContentHandler.startPrefixMapping (prefix, uri)\n\nBegin the scope of a prefix-URI Namespace mapping.\n\nThe information from this event is not necessary for normal\nNamespace processing: the SAX XML reader will automatically replace\nprefixes for element and attribute names when the\n'featurenamespaces' feature is enabled (the default).\n\nThere are cases, however, when applications need to use prefixes in\ncharacter data or in attribute values, where they cannot safely be\nexpanded automatically; the *note startPrefixMapping(): 34bf. and\n*note endPrefixMapping(): 34c0. events supply the information to\nthe application to expand prefixes in those contexts itself, if\nnecessary.\n\nNote that *note startPrefixMapping(): 34bf. and *note\nendPrefixMapping(): 34c0. events are not guaranteed to be properly\nnested relative to each-other: all *note startPrefixMapping():\n34bf. events will occur before the corresponding *note\nstartElement(): 139d. event, and all *note endPrefixMapping():\n34c0. events will occur after the corresponding *note endElement():\n139e. event, but their order is not guaranteed.\n\n-- Method: ContentHandler.endPrefixMapping (prefix)\n\nEnd the scope of a prefix-URI mapping.\n\nSee *note startPrefixMapping(): 34bf. for details.  This event will\nalways occur after the corresponding *note endElement(): 139e.\nevent, but the order of *note endPrefixMapping(): 34c0. events is\nnot otherwise guaranteed.\n\n-- Method: ContentHandler.startElement (name, attrs)\n\nSignals the start of an element in non-namespace mode.\n\nThe 'name' parameter contains the raw XML 1.0 name of the element\ntype as a string and the 'attrs' parameter holds an object of the\n'Attributes' interface (see *note The Attributes Interface: 34c1.)\ncontaining the attributes of the element.  The object passed as\n'attrs' may be re-used by the parser; holding on to a reference to\nit is not a reliable way to keep a copy of the attributes.  To keep\na copy of the attributes, use the *note copy(): 23. method of the\n'attrs' object.\n\n-- Method: ContentHandler.endElement (name)\n\nSignals the end of an element in non-namespace mode.\n\nThe 'name' parameter contains the name of the element type, just as\nwith the *note startElement(): 139d. event.\n\n-- Method: ContentHandler.startElementNS (name, qname, attrs)\n\nSignals the start of an element in namespace mode.\n\nThe 'name' parameter contains the name of the element type as a\n'(uri, localname)' tuple, the 'qname' parameter contains the raw\nXML 1.0 name used in the source document, and the 'attrs' parameter\nholds an instance of the 'AttributesNS' interface (see *note The\nAttributesNS Interface: 34c3.) containing the attributes of the\nelement.  If no namespace is associated with the element, the 'uri'\ncomponent of 'name' will be 'None'.  The object passed as 'attrs'\nmay be re-used by the parser; holding on to a reference to it is\nnot a reliable way to keep a copy of the attributes.  To keep a\ncopy of the attributes, use the *note copy(): 23. method of the\n'attrs' object.\n\nParsers may set the 'qname' parameter to 'None', unless the\n'featurenamespaceprefixes' feature is activated.\n\n-- Method: ContentHandler.endElementNS (name, qname)\n\nSignals the end of an element in namespace mode.\n\nThe 'name' parameter contains the name of the element type, just as\nwith the *note startElementNS(): 34c2. method, likewise the 'qname'\nparameter.\n\n-- Method: ContentHandler.characters (content)\n\nReceive notification of character data.\n\nThe Parser will call this method to report each chunk of character\ndata.  SAX parsers may return all contiguous character data in a\nsingle chunk, or they may split it into several chunks; however,\nall of the characters in any single event must come from the same\nexternal entity so that the Locator provides useful information.\n\n'content' may be a string or bytes instance; the 'expat' reader\nmodule always produces strings.\n\nNote: The earlier SAX 1 interface provided by the Python XML\nSpecial Interest Group used a more Java-like interface for\nthis method.  Since most parsers used from Python did not take\nadvantage of the older interface, the simpler signature was\nchosen to replace it.  To convert old code to the new\ninterface, use 'content' instead of slicing content with the\nold 'offset' and 'length' parameters.\n\n-- Method: ContentHandler.ignorableWhitespace (whitespace)\n\nReceive notification of ignorable whitespace in element content.\n\nValidating Parsers must use this method to report each chunk of\nignorable whitespace (see the W3C XML 1.0 recommendation, section\n2.10): non-validating parsers may also use this method if they are\ncapable of parsing and using content models.\n\nSAX parsers may return all contiguous whitespace in a single chunk,\nor they may split it into several chunks; however, all of the\ncharacters in any single event must come from the same external\nentity, so that the Locator provides useful information.\n\n-- Method: ContentHandler.processingInstruction (target, data)\n\nReceive notification of a processing instruction.\n\nThe Parser will invoke this method once for each processing\ninstruction found: note that processing instructions may occur\nbefore or after the main document element.\n\nA SAX parser should never report an XML declaration (XML 1.0,\nsection 2.8) or a text declaration (XML 1.0, section 4.3.1) using\nthis method.\n\n-- Method: ContentHandler.skippedEntity (name)\n\nReceive notification of a skipped entity.\n\nThe Parser will invoke this method once for each entity skipped.\nNon-validating processors may skip entities if they have not seen\nthe declarations (because, for example, the entity was declared in\nan external DTD subset).  All processors may skip external\nentities, depending on the values of the 'featureexternalges' and\nthe 'featureexternalpes' properties.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: DTDHandler Objects,  Next: EntityResolver Objects,  Prev: ContentHandler Objects,  Up: xml sax handler -- Base classes for SAX handlers": {
            "content": "5.20.10.2 DTDHandler Objects\n............................\n\n*note DTDHandler: 34ad. instances provide the following methods:\n\n-- Method: DTDHandler.notationDecl (name, publicId, systemId)\n\nHandle a notation declaration event.\n\n-- Method: DTDHandler.unparsedEntityDecl (name, publicId, systemId,\nndata)\n\nHandle an unparsed entity declaration event.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: EntityResolver Objects,  Next: ErrorHandler Objects,  Prev: DTDHandler Objects,  Up: xml sax handler -- Base classes for SAX handlers": {
            "content": "5.20.10.3 EntityResolver Objects\n................................\n\n-- Method: EntityResolver.resolveEntity (publicId, systemId)\n\nResolve the system identifier of an entity and return either the\nsystem identifier to read from as a string, or an InputSource to\nread from.  The default implementation returns 'systemId'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ErrorHandler Objects,  Next: LexicalHandler Objects,  Prev: EntityResolver Objects,  Up: xml sax handler -- Base classes for SAX handlers": {
            "content": "5.20.10.4 ErrorHandler Objects\n..............................\n",
            "subsections": []
        },
        "Objects with this interface are used to receive error and warning": {
            "content": "information from the *note XMLReader: 3496.  If you create an object\nthat implements this interface, then register the object with your *note\nXMLReader: 3496, the parser will call the methods in your object to\nreport all warnings and errors.  There are three levels of errors\navailable: warnings, (possibly) recoverable errors, and unrecoverable\nerrors.  All methods take a *note SAXParseException: 34a2. as the only\nparameter.  Errors and warnings may be converted to an exception by\nraising the passed-in exception object.\n\n-- Method: ErrorHandler.error (exception)\n\nCalled when the parser encounters a recoverable error.  If this\nmethod does not raise an exception, parsing may continue, but\nfurther document information should not be expected by the\napplication.  Allowing the parser to continue may allow additional\nerrors to be discovered in the input document.\n\n-- Method: ErrorHandler.fatalError (exception)\n\nCalled when the parser encounters an error it cannot recover from;\nparsing is expected to terminate when this method returns.\n\n-- Method: ErrorHandler.warning (exception)\n\nCalled when the parser presents minor warning information to the\napplication.  Parsing is expected to continue when this method\nreturns, and document information will continue to be passed to the\napplication.  Raising an exception in this method will cause\nparsing to end.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: LexicalHandler Objects,  Prev: ErrorHandler Objects,  Up: xml sax handler -- Base classes for SAX handlers": {
            "content": "5.20.10.5 LexicalHandler Objects\n................................\n\nOptional SAX2 handler for lexical events.\n",
            "subsections": []
        },
        "This handler is used to obtain lexical information about an XML": {
            "content": "document.  Lexical information includes information describing the\ndocument encoding used and XML comments embedded in the document, as\nwell as section boundaries for the DTD and for any CDATA sections.  The\nlexical handlers are used in the same manner as content handlers.\n",
            "subsections": []
        },
        "Set the LexicalHandler of an XMLReader by using the setProperty method": {
            "content": "with the property identifier\n''http://xml.org/sax/properties/lexical-handler''.\n\n-- Method: LexicalHandler.comment (content)\n\nReports a comment anywhere in the document (including the DTD and\noutside the document element).\n\n-- Method: LexicalHandler.startDTD (name, publicid, systemid)\n\nReports the start of the DTD declarations if the document has an\nassociated DTD.\n\n-- Method: LexicalHandler.endDTD ()\n\nReports the end of DTD declaration.\n\n-- Method: LexicalHandler.startCDATA ()\n\nReports the start of a CDATA marked section.\n\nThe contents of the CDATA marked section will be reported through\nthe characters handler.\n\n-- Method: LexicalHandler.endCDATA ()\n\nReports the end of a CDATA marked section.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "'Source code:' Lib/xml/sax/saxutils.py(1)\n\n\n\nThe module *note xml.sax.saxutils: 126. contains a number of classes and\nfunctions that are commonly useful when creating SAX applications,\neither in direct use, or as base classes.\n\n-- Function: xml.sax.saxutils.escape (data, entities={})\n\nEscape ''&'', ''<'', and ''>'' in a string of data.\n\nYou can escape other strings of data by passing a dictionary as the\noptional 'entities' parameter.  The keys and values must all be\nstrings; each key will be replaced with its corresponding value.\nThe characters ''&'', ''<'' and ''>'' are always escaped, even if\n'entities' is provided.\n\nNote: This function should only be used to escape characters\nthat can't be used directly in XML. Do not use this function\nas a general string translation function.\n\n-- Function: xml.sax.saxutils.unescape (data, entities={})\n\nUnescape ''&amp;'', ''&lt;'', and ''&gt;'' in a string of data.\n\nYou can unescape other strings of data by passing a dictionary as\nthe optional 'entities' parameter.  The keys and values must all be\nstrings; each key will be replaced with its corresponding value.\n''&amp'', ''&lt;'', and ''&gt;'' are always unescaped, even if\n'entities' is provided.\n\n-- Function: xml.sax.saxutils.quoteattr (data, entities={})\n\nSimilar to *note escape(): 34dd, but also prepares 'data' to be\nused as an attribute value.  The return value is a quoted version\nof 'data' with any additional required replacements.  *note\nquoteattr(): 34df. will select a quote character based on the\ncontent of 'data', attempting to avoid encoding any quote\ncharacters in the string.  If both single- and double-quote\ncharacters are already in 'data', the double-quote characters will\nbe encoded and 'data' will be wrapped in double-quotes.  The\nresulting string can be used directly as an attribute value:\n\n>>> print(\"<element attr=%s>\" % quoteattr(\"ab ' cd \\\" ef\"))\n<element attr=\"ab ' cd &quot; ef\">\n\nThis function is useful when generating attribute values for HTML\nor any SGML using the reference concrete syntax.\n\n-- Class: xml.sax.saxutils.XMLGenerator (out=None,\nencoding='iso-8859-1', shortemptyelements=False)\n\nThis class implements the *note ContentHandler: 3493. interface by\nwriting SAX events back into an XML document.  In other words,\nusing an *note XMLGenerator: 34e0. as the content handler will\nreproduce the original document being parsed.  'out' should be a\nfile-like object which will default to 'sys.stdout'.  'encoding' is\nthe encoding of the output stream which defaults to ''iso-8859-1''.\n'shortemptyelements' controls the formatting of elements that\ncontain no content: if 'False' (the default) they are emitted as a\npair of start/end tags, if set to 'True' they are emitted as a\nsingle self-closed tag.\n\nChanged in version 3.2: Added the 'shortemptyelements' parameter.\n\n-- Class: xml.sax.saxutils.XMLFilterBase (base)\n\nThis class is designed to sit between an *note XMLReader: 3496. and\nthe client application's event handlers.  By default, it does\nnothing but pass requests up to the reader and events on to the\nhandlers unmodified, but subclasses can override specific methods\nto modify the event stream or the configuration requests as they\npass through.\n\n-- Function: xml.sax.saxutils.prepareinputsource (source, base='')\n\nThis function takes an input source and an optional base URL and\nreturns a fully resolved *note InputSource: cff. object ready for\nreading.  The input source can be given as a string, a file-like\nobject, or an *note InputSource: cff. object; parsers will use this\nfunction to implement the polymorphic 'source' argument to their\n*note parse(): 34e3. method.\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/xml/sax/saxutils.py\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "'Source code:' Lib/xml/sax/xmlreader.py(1)\n\n\n\nSAX parsers implement the *note XMLReader: 3496. interface.  They are\nimplemented in a Python module, which must provide a function\n'createparser()'.  This function is invoked by *note\nxml.sax.makeparser(): 17b7. with no arguments to create a new parser\nobject.\n\n-- Class: xml.sax.xmlreader.XMLReader\n\nBase class which can be inherited by SAX parsers.\n\n-- Class: xml.sax.xmlreader.IncrementalParser\n\nIn some cases, it is desirable not to parse an input source at\nonce, but to feed chunks of the document as they get available.\nNote that the reader will normally not read the entire file, but\nread it in chunks as well; still 'parse()' won't return until the\nentire document is processed.  So these interfaces should be used\nif the blocking behaviour of 'parse()' is not desirable.\n\nWhen the parser is instantiated it is ready to begin accepting data\nfrom the feed method immediately.  After parsing has been finished\nwith a call to close the reset method must be called to make the\nparser ready to accept new data, either from feed or using the\nparse method.\n\nNote that these methods must 'not' be called during parsing, that\nis, after parse has been called and before it returns.\n\nBy default, the class also implements the parse method of the\nXMLReader interface using the feed, close and reset methods of the\nIncrementalParser interface as a convenience to SAX 2.0 driver\nwriters.\n\n-- Class: xml.sax.xmlreader.Locator\n\nInterface for associating a SAX event with a document location.  A\nlocator object will return valid results only during calls to\nDocumentHandler methods; at any other time, the results are\nunpredictable.  If information is not available, methods may return\n'None'.\n\n-- Class: xml.sax.xmlreader.InputSource (systemid=None)\n\nEncapsulation of the information needed by the *note XMLReader:\n3496. to read entities.\n\nThis class may include information about the public identifier,\nsystem identifier, byte stream (possibly with character encoding\ninformation) and/or the character stream of an entity.\n\nApplications will create objects of this class for use in the *note\nXMLReader.parse(): 34e3. method and for returning from\nEntityResolver.resolveEntity.\n\nAn *note InputSource: cff. belongs to the application, the *note\nXMLReader: 3496. is not allowed to modify *note InputSource: cff.\nobjects passed to it from the application, although it may make\ncopies and modify those.\n\n-- Class: xml.sax.xmlreader.AttributesImpl (attrs)\n\nThis is an implementation of the 'Attributes' interface (see\nsection *note The Attributes Interface: 34c1.).  This is a\ndictionary-like object which represents the element attributes in a\n'startElement()' call.  In addition to the most useful dictionary\noperations, it supports a number of other methods as described by\nthe interface.  Objects of this class should be instantiated by\nreaders; 'attrs' must be a dictionary-like object containing a\nmapping from attribute names to attribute values.\n\n-- Class: xml.sax.xmlreader.AttributesNSImpl (attrs, qnames)\n\nNamespace-aware variant of *note AttributesImpl: 34e7, which will\nbe passed to 'startElementNS()'.  It is derived from *note\nAttributesImpl: 34e7, but understands attribute names as two-tuples\nof 'namespaceURI' and 'localname'.  In addition, it provides a\nnumber of methods expecting qualified names as they appear in the\noriginal document.  This class implements the 'AttributesNS'\ninterface (see section *note The AttributesNS Interface: 34c3.).\n\n* Menu:\n\n* XMLReader Objects::\n* IncrementalParser Objects::\n* Locator Objects::\n* InputSource Objects::\n* The Attributes Interface::\n* The AttributesNS Interface::\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/xml/sax/xmlreader.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: XMLReader Objects,  Next: IncrementalParser Objects,  Up: xml sax xmlreader -- Interface for XML parsers": {
            "content": "5.20.12.1 XMLReader Objects\n...........................\n\nThe *note XMLReader: 3496. interface supports the following methods:\n\n-- Method: XMLReader.parse (source)\n\nProcess an input source, producing SAX events.  The 'source' object\ncan be a system identifier (a string identifying the input source -\ntypically a file name or a URL), a *note pathlib.Path: 149. or\n*note path-like: 957. object, or an *note InputSource: cff. object.\nWhen *note parse(): 34e3. returns, the input is completely\nprocessed, and the parser object can be discarded or reset.\n\nChanged in version 3.5: Added support of character streams.\n\nChanged in version 3.8: Added support of path-like objects.\n\n-- Method: XMLReader.getContentHandler ()\n\nReturn the current *note ContentHandler: 3493.\n\n-- Method: XMLReader.setContentHandler (handler)\n\nSet the current *note ContentHandler: 3493.  If no *note\nContentHandler: 3493. is set, content events will be discarded.\n\n-- Method: XMLReader.getDTDHandler ()\n\nReturn the current *note DTDHandler: 34ad.\n\n-- Method: XMLReader.setDTDHandler (handler)\n\nSet the current *note DTDHandler: 34ad.  If no *note DTDHandler:\n34ad. is set, DTD events will be discarded.\n\n-- Method: XMLReader.getEntityResolver ()\n\nReturn the current *note EntityResolver: 34ae.\n\n-- Method: XMLReader.setEntityResolver (handler)\n\nSet the current *note EntityResolver: 34ae.  If no *note\nEntityResolver: 34ae. is set, attempts to resolve an external\nentity will result in opening the system identifier for the entity,\nand fail if it is not available.\n\n-- Method: XMLReader.getErrorHandler ()\n\nReturn the current *note ErrorHandler: 34a1.\n\n-- Method: XMLReader.setErrorHandler (handler)\n\nSet the current error handler.  If no *note ErrorHandler: 34a1. is\nset, errors will be raised as exceptions, and warnings will be\nprinted.\n\n-- Method: XMLReader.setLocale (locale)\n\nAllow an application to set the locale for errors and warnings.\n\nSAX parsers are not required to provide localization for errors and\nwarnings; if they cannot support the requested locale, however,\nthey must raise a SAX exception.  Applications may request a locale\nchange in the middle of a parse.\n\n-- Method: XMLReader.getFeature (featurename)\n\nReturn the current setting for feature 'featurename'.  If the\nfeature is not recognized, 'SAXNotRecognizedException' is raised.\nThe well-known featurenames are listed in the module *note\nxml.sax.handler: 125.\n\n-- Method: XMLReader.setFeature (featurename, value)\n\nSet the 'featurename' to 'value'.  If the feature is not\nrecognized, 'SAXNotRecognizedException' is raised.  If the feature\nor its setting is not supported by the parser,\n'SAXNotSupportedException' is raised.\n\n-- Method: XMLReader.getProperty (propertyname)\n\nReturn the current setting for property 'propertyname'.  If the\nproperty is not recognized, a 'SAXNotRecognizedException' is\nraised.  The well-known propertynames are listed in the module\n*note xml.sax.handler: 125.\n\n-- Method: XMLReader.setProperty (propertyname, value)\n\nSet the 'propertyname' to 'value'.  If the property is not\nrecognized, 'SAXNotRecognizedException' is raised.  If the property\nor its setting is not supported by the parser,\n'SAXNotSupportedException' is raised.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: IncrementalParser Objects,  Next: Locator Objects,  Prev: XMLReader Objects,  Up: xml sax xmlreader -- Interface for XML parsers": {
            "content": "5.20.12.2 IncrementalParser Objects\n...................................\n\nInstances of *note IncrementalParser: 34e6. offer the following\nadditional methods:\n\n-- Method: IncrementalParser.feed (data)\n\nProcess a chunk of 'data'.\n\n-- Method: IncrementalParser.close ()\n\nAssume the end of the document.  That will check well-formedness\nconditions that can be checked only at the end, invoke handlers,\nand may clean up resources allocated during parsing.\n\n-- Method: IncrementalParser.reset ()\n\nThis method is called after close has been called to reset the\nparser so that it is ready to parse new documents.  The results of\ncalling parse or feed after close without calling reset are\nundefined.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Locator Objects,  Next: InputSource Objects,  Prev: IncrementalParser Objects,  Up: xml sax xmlreader -- Interface for XML parsers": {
            "content": "5.20.12.3 Locator Objects\n.........................\n\nInstances of *note Locator: 34a3. provide these methods:\n\n-- Method: Locator.getColumnNumber ()\n\nReturn the column number where the current event begins.\n\n-- Method: Locator.getLineNumber ()\n\nReturn the line number where the current event begins.\n\n-- Method: Locator.getPublicId ()\n\nReturn the public identifier for the current event.\n\n-- Method: Locator.getSystemId ()\n\nReturn the system identifier for the current event.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: InputSource Objects,  Next: The Attributes Interface,  Prev: Locator Objects,  Up: xml sax xmlreader -- Interface for XML parsers": {
            "content": "5.20.12.4 InputSource Objects\n.............................\n\n-- Method: InputSource.setPublicId (id)\n\nSets the public identifier of this *note InputSource: cff.\n\n-- Method: InputSource.getPublicId ()\n\nReturns the public identifier of this *note InputSource: cff.\n\n-- Method: InputSource.setSystemId (id)\n\nSets the system identifier of this *note InputSource: cff.\n\n-- Method: InputSource.getSystemId ()\n\nReturns the system identifier of this *note InputSource: cff.\n\n-- Method: InputSource.setEncoding (encoding)\n\nSets the character encoding of this *note InputSource: cff.\n\nThe encoding must be a string acceptable for an XML encoding\ndeclaration (see section 4.3.3 of the XML recommendation).\n\nThe encoding attribute of the *note InputSource: cff. is ignored if\nthe *note InputSource: cff. also contains a character stream.\n\n-- Method: InputSource.getEncoding ()\n\nGet the character encoding of this InputSource.\n\n-- Method: InputSource.setByteStream (bytefile)\n\nSet the byte stream (a *note binary file: 1a0c.) for this input\nsource.\n\nThe SAX parser will ignore this if there is also a character stream\nspecified, but it will use a byte stream in preference to opening a\nURI connection itself.\n\nIf the application knows the character encoding of the byte stream,\nit should set it with the setEncoding method.\n\n-- Method: InputSource.getByteStream ()\n\nGet the byte stream for this input source.\n\nThe getEncoding method will return the character encoding for this\nbyte stream, or 'None' if unknown.\n\n-- Method: InputSource.setCharacterStream (charfile)\n\nSet the character stream (a *note text file: 1a0b.) for this input\nsource.\n\nIf there is a character stream specified, the SAX parser will\nignore any byte stream and will not attempt to open a URI\nconnection to the system identifier.\n\n-- Method: InputSource.getCharacterStream ()\n\nGet the character stream for this input source.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The Attributes Interface,  Next: The AttributesNS Interface,  Prev: InputSource Objects,  Up: xml sax xmlreader -- Interface for XML parsers": {
            "content": "5.20.12.5 The 'Attributes' Interface\n....................................\n\n'Attributes' objects implement a portion of the *note mapping protocol:\n1030, including the methods 'copy()', 'get()', *note contains():\n1c63, 'items()', 'keys()', and 'values()'.  The following methods are\nalso provided:\n\n-- Method: Attributes.getLength ()\n\nReturn the number of attributes.\n\n-- Method: Attributes.getNames ()\n\nReturn the names of the attributes.\n\n-- Method: Attributes.getType (name)\n\nReturns the type of the attribute 'name', which is normally\n''CDATA''.\n\n-- Method: Attributes.getValue (name)\n\nReturn the value of attribute 'name'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The AttributesNS Interface,  Prev: The Attributes Interface,  Up: xml sax xmlreader -- Interface for XML parsers": {
            "content": "5.20.12.6 The 'AttributesNS' Interface\n......................................\n",
            "subsections": []
        },
        "This interface is a subtype of the 'Attributes' interface (see section": {
            "content": "*note The Attributes Interface: 34c1.).  All methods supported by that\ninterface are also available on 'AttributesNS' objects.\n\nThe following methods are also available:\n\n-- Method: AttributesNS.getValueByQName (name)\n\nReturn the value for a qualified name.\n\n-- Method: AttributesNS.getNameByQName (name)\n\nReturn the '(namespace, localname)' pair for a qualified 'name'.\n\n-- Method: AttributesNS.getQNameByName (name)\n\nReturn the qualified name for a '(namespace, localname)' pair.\n\n-- Method: AttributesNS.getQNames ()\n\nReturn the qualified names of all attributes.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: xml parsers expat -- Fast XML parsing using Expat,  Prev: xml sax xmlreader -- Interface for XML parsers,  Up: Structured Markup Processing Tools": {
            "content": "Warning: The 'pyexpat' module is not secure against maliciously\nconstructed data.  If you need to parse untrusted or\nunauthenticated data see *note XML vulnerabilities: 33aa.\n\nThe *note xml.parsers.expat: 121. module is a Python interface to the",
            "subsections": []
        },
        "Expat non-validating XML parser.  The module provides a single extension": {
            "content": "type, 'xmlparser', that represents the current state of an XML parser.",
            "subsections": []
        },
        "After an 'xmlparser' object has been created, various attributes of the": {
            "content": "object can be set to handler functions.  When an XML document is then\nfed to the parser, the handler functions are called for the character\ndata and markup in the XML document.\n",
            "subsections": []
        },
        "This module uses the 'pyexpat' module to provide access to the Expat": {
            "content": "parser.  Direct use of the 'pyexpat' module is deprecated.\n\nThis module provides one exception and one type object:\n\n-- Exception: xml.parsers.expat.ExpatError\n\nThe exception raised when Expat reports an error.  See section\n*note ExpatError Exceptions: 351a. for more information on\ninterpreting Expat errors.\n\n-- Exception: xml.parsers.expat.error\n\nAlias for *note ExpatError: 10f1.\n\n-- Data: xml.parsers.expat.XMLParserType\n\nThe type of the return values from the *note ParserCreate(): 351d.\nfunction.\n\nThe *note xml.parsers.expat: 121. module contains two functions:\n\n-- Function: xml.parsers.expat.ErrorString (errno)\n\nReturns an explanatory string for a given error number 'errno'.\n\n-- Function: xml.parsers.expat.ParserCreate (encoding=None,\nnamespaceseparator=None)\n\nCreates and returns a new 'xmlparser' object.  'encoding', if\nspecified, must be a string naming the encoding used by the XML\ndata.  Expat doesn't support as many encodings as Python does, and\nits repertoire of encodings can't be extended; it supports UTF-8,\nUTF-16, ISO-8859-1 (Latin1), and ASCII. If 'encoding' (1) is given\nit will override the implicit or explicit encoding of the document.\n\nExpat can optionally do XML namespace processing for you, enabled\nby providing a value for 'namespaceseparator'.  The value must be\na one-character string; a *note ValueError: 183. will be raised if\nthe string has an illegal length ('None' is considered the same as\nomission).  When namespace processing is enabled, element type\nnames and attribute names that belong to a namespace will be\nexpanded.  The element name passed to the element handlers\n'StartElementHandler' and 'EndElementHandler' will be the\nconcatenation of the namespace URI, the namespace separator\ncharacter, and the local part of the name.  If the namespace\nseparator is a zero byte ('chr(0)') then the namespace URI and the\nlocal part will be concatenated without any separator.\n\nFor example, if 'namespaceseparator' is set to a space character\n('' '') and the following document is parsed:\n\n<?xml version=\"1.0\"?>\n<root xmlns    = \"http://default-namespace.org/\"\nxmlns:py = \"http://www.python.org/ns/\">\n<py:elem1 />\n<elem2 xmlns=\"\" />\n</root>\n\n'StartElementHandler' will receive the following strings for each\nelement:\n\nhttp://default-namespace.org/ root\nhttp://www.python.org/ns/ elem1\nelem2\n\nDue to limitations in the 'Expat' library used by 'pyexpat', the\n'xmlparser' instance returned can only be used to parse a single\nXML document.  Call 'ParserCreate' for each document to provide\nunique parser instances.\n\nSee also\n........\n",
            "subsections": []
        },
        "The Expat XML Parser(2)": {
            "content": "Home page of the Expat project.\n\n* Menu:\n\n* XMLParser Objects: XMLParser Objects<2>.\n* ExpatError Exceptions::\n* Example: Example<11>.\n* Content Model Descriptions::\n* Expat error constants::\n\n---------- Footnotes ----------\n\n(1) The encoding string included in XML output should conform to the\nappropriate standards.  For example, \"UTF-8\" is valid, but \"UTF8\" is\nnot.  See\n'https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl' and\n'https://www.iana.org/assignments/character-sets/character-sets.xhtml'.\n\n(2) http://www.libexpat.org/\n\nFile: python3.12.info,  Node: XMLParser Objects<2>,  Next: ExpatError Exceptions,  Up: xml parsers expat -- Fast XML parsing using Expat\n\n5.20.13.1 XMLParser Objects\n...........................\n\n'xmlparser' objects have the following methods:\n\n-- Method: xmlparser.Parse (data[, isfinal])\n\nParses the contents of the string 'data', calling the appropriate\nhandler functions to process the parsed data.  'isfinal' must be\ntrue on the final call to this method; it allows the parsing of a\nsingle file in fragments, not the submission of multiple files.\n'data' can be the empty string at any time.\n\n-- Method: xmlparser.ParseFile (file)\n\nParse XML data reading from the object 'file'.  'file' only needs\nto provide the 'read(nbytes)' method, returning the empty string\nwhen there's no more data.\n\n-- Method: xmlparser.SetBase (base)\n\nSets the base to be used for resolving relative URIs in system\nidentifiers in declarations.  Resolving relative identifiers is\nleft to the application: this value will be passed through as the\n'base' argument to the *note ExternalEntityRefHandler(): 3524,\n*note NotationDeclHandler(): 3525, and *note\nUnparsedEntityDeclHandler(): 3526. functions.\n\n-- Method: xmlparser.GetBase ()\n\nReturns a string containing the base set by a previous call to\n*note SetBase(): 3523, or 'None' if *note SetBase(): 3523. hasn't\nbeen called.\n\n-- Method: xmlparser.GetInputContext ()\n\nReturns the input data that generated the current event as a\nstring.  The data is in the encoding of the entity which contains\nthe text.  When called while an event handler is not active, the\nreturn value is 'None'.\n\n-- Method: xmlparser.ExternalEntityParserCreate (context[, encoding])\n\nCreate a \"child\" parser which can be used to parse an external\nparsed entity referred to by content parsed by the parent parser.\nThe 'context' parameter should be the string passed to the *note\nExternalEntityRefHandler(): 3524. handler function, described\nbelow.  The child parser is created with the *note\norderedattributes: 352a. and *note specifiedattributes: 352b. set\nto the values of this parser.\n\n-- Method: xmlparser.SetParamEntityParsing (flag)\n\nControl parsing of parameter entities (including the external DTD\nsubset).  Possible 'flag' values are\n'XMLPARAMENTITYPARSINGNEVER',\n'XMLPARAMENTITYPARSINGUNLESSSTANDALONE' and\n'XMLPARAMENTITYPARSINGALWAYS'.  Return true if setting the flag\nwas successful.\n\n-- Method: xmlparser.UseForeignDTD ([flag])\n\nCalling this with a true value for 'flag' (the default) will cause\nExpat to call the *note ExternalEntityRefHandler: 3524. with *note\nNone: 43f. for all arguments to allow an alternate DTD to be\nloaded.  If the document does not contain a document type\ndeclaration, the *note ExternalEntityRefHandler: 3524. will still\nbe called, but the *note StartDoctypeDeclHandler: 352e. and *note\nEndDoctypeDeclHandler: 352f. will not be called.\n\nPassing a false value for 'flag' will cancel a previous call that\npassed a true value, but otherwise has no effect.\n\nThis method can only be called before the *note Parse(): 3521. or\n*note ParseFile(): 3522. methods are called; calling it after\neither of those have been called causes *note ExpatError: 10f1. to\nbe raised with the *note code: 18. attribute set to\n'errors.codes[errors.XMLERRORCANTCHANGEFEATUREONCEPARSING]'.\n\n-- Method: xmlparser.SetReparseDeferralEnabled (enabled)\n\nWarning: Calling 'SetReparseDeferralEnabled(False)' has\nsecurity implications, as detailed below; please make sure to\nunderstand these consequences prior to using the\n'SetReparseDeferralEnabled' method.\n\nExpat 2.6.0 introduced a security mechanism called \"reparse\ndeferral\" where instead of causing denial of service through\nquadratic runtime from reparsing large tokens, reparsing of\nunfinished tokens is now delayed by default until a sufficient\namount of input is reached.  Due to this delay, registered handlers\nmay -- depending of the sizing of input chunks pushed to Expat -- no\nlonger be called right after pushing new input to the parser.\nWhere immediate feedback and taking over responsiblity of\nprotecting against denial of service from large tokens are both\nwanted, calling 'SetReparseDeferralEnabled(False)' disables reparse\ndeferral for the current Expat parser instance, temporarily or\naltogether.  Calling 'SetReparseDeferralEnabled(True)' allows\nre-enabling reparse deferral.\n\nNote that *note SetReparseDeferralEnabled(): 13ae. has been\nbackported to some prior releases of CPython as a security fix.\nCheck for availability of *note SetReparseDeferralEnabled(): 13ae.\nusing *note hasattr(): 1f7. if used in code running across a\nvariety of Python versions.\n\nNew in version 3.12.3.\n\n-- Method: xmlparser.GetReparseDeferralEnabled ()\n\nReturns whether reparse deferral is currently enabled for the given\nExpat parser instance.\n\nNew in version 3.12.3.\n\n'xmlparser' objects have the following attributes:\n\n-- Attribute: xmlparser.buffersize\n\nThe size of the buffer used when *note buffertext: 1319. is true.\nA new buffer size can be set by assigning a new integer value to\nthis attribute.  When the size is changed, the buffer will be\nflushed.\n\n-- Attribute: xmlparser.buffertext\n\nSetting this to true causes the 'xmlparser' object to buffer\ntextual content returned by Expat to avoid multiple calls to the\n*note CharacterDataHandler(): 3531. callback whenever possible.\nThis can improve performance substantially since Expat normally\nbreaks character data into chunks at every line ending.  This\nattribute is false by default, and may be changed at any time.\nNote that when it is false, data that does not contain newlines may\nbe chunked too.\n\n-- Attribute: xmlparser.bufferused\n\nIf *note buffertext: 1319. is enabled, the number of bytes stored\nin the buffer.  These bytes represent UTF-8 encoded text.  This\nattribute has no meaningful interpretation when *note buffertext:\n1319. is false.\n\n-- Attribute: xmlparser.orderedattributes\n\nSetting this attribute to a non-zero integer causes the attributes\nto be reported as a list rather than a dictionary.  The attributes\nare presented in the order found in the document text.  For each\nattribute, two list entries are presented: the attribute name and\nthe attribute value.  (Older versions of this module also used this\nformat.)  By default, this attribute is false; it may be changed at\nany time.\n\n-- Attribute: xmlparser.specifiedattributes\n\nIf set to a non-zero integer, the parser will report only those\nattributes which were specified in the document instance and not\nthose which were derived from attribute declarations.  Applications\nwhich set this need to be especially careful to use what additional\ninformation is available from the declarations as needed to comply\nwith the standards for the behavior of XML processors.  By default,\nthis attribute is false; it may be changed at any time.\n",
            "subsections": []
        },
        "The following attributes contain values relating to the most recent": {
            "content": "error encountered by an 'xmlparser' object, and will only have correct\nvalues once a call to 'Parse()' or 'ParseFile()' has raised an *note\nxml.parsers.expat.ExpatError: 10f1. exception.\n\n-- Attribute: xmlparser.ErrorByteIndex\n\nByte index at which an error occurred.\n\n-- Attribute: xmlparser.ErrorCode\n\nNumeric code specifying the problem.  This value can be passed to\nthe *note ErrorString(): 351e. function, or compared to one of the\nconstants defined in the 'errors' object.\n\n-- Attribute: xmlparser.ErrorColumnNumber\n\nColumn number at which an error occurred.\n\n-- Attribute: xmlparser.ErrorLineNumber\n\nLine number at which an error occurred.\n",
            "subsections": []
        },
        "The following attributes contain values relating to the current parse": {
            "content": "location in an 'xmlparser' object.  During a callback reporting a parse\nevent they indicate the location of the first of the sequence of\ncharacters that generated the event.  When called outside of a callback,\nthe position indicated will be just past the last parse event\n(regardless of whether there was an associated callback).\n\n-- Attribute: xmlparser.CurrentByteIndex\n\nCurrent byte index in the parser input.\n\n-- Attribute: xmlparser.CurrentColumnNumber\n\nCurrent column number in the parser input.\n\n-- Attribute: xmlparser.CurrentLineNumber\n\nCurrent line number in the parser input.\n",
            "subsections": []
        },
        "Here is the list of handlers that can be set.  To set a handler on an": {
            "content": "'xmlparser' object 'o', use 'o.handlername = func'.  'handlername' must\nbe taken from the following list, and 'func' must be a callable object\naccepting the correct number of arguments.  The arguments are all\nstrings, unless otherwise stated.\n\n-- Method: xmlparser.XmlDeclHandler (version, encoding, standalone)\n\nCalled when the XML declaration is parsed.  The XML declaration is\nthe (optional) declaration of the applicable version of the XML\nrecommendation, the encoding of the document text, and an optional\n\"standalone\" declaration.  'version' and 'encoding' will be\nstrings, and 'standalone' will be '1' if the document is declared\nstandalone, '0' if it is declared not to be standalone, or '-1' if\nthe standalone clause was omitted.  This is only available with\nExpat version 1.95.0 or newer.\n\n-- Method: xmlparser.StartDoctypeDeclHandler (doctypeName, systemId,\npublicId, hasinternalsubset)\n\nCalled when Expat begins parsing the document type declaration\n('<!DOCTYPE ...').  The 'doctypeName' is provided exactly as\npresented.  The 'systemId' and 'publicId' parameters give the\nsystem and public identifiers if specified, or 'None' if omitted.\n'hasinternalsubset' will be true if the document contains and\ninternal document declaration subset.  This requires Expat version\n1.2 or newer.\n\n-- Method: xmlparser.EndDoctypeDeclHandler ()\n\nCalled when Expat is done parsing the document type declaration.\nThis requires Expat version 1.2 or newer.\n\n-- Method: xmlparser.ElementDeclHandler (name, model)\n\nCalled once for each element type declaration.  'name' is the name\nof the element type, and 'model' is a representation of the content\nmodel.\n\n-- Method: xmlparser.AttlistDeclHandler (elname, attname, type,\ndefault, required)\n\nCalled for each declared attribute for an element type.  If an\nattribute list declaration declares three attributes, this handler\nis called three times, once for each attribute.  'elname' is the\nname of the element to which the declaration applies and 'attname'\nis the name of the attribute declared.  The attribute type is a\nstring passed as 'type'; the possible values are ''CDATA'', ''ID'',\n''IDREF'', ... 'default' gives the default value for the attribute\nused when the attribute is not specified by the document instance,\nor 'None' if there is no default value ('#IMPLIED' values).  If the\nattribute is required to be given in the document instance,\n'required' will be true.  This requires Expat version 1.95.0 or\nnewer.\n\n-- Method: xmlparser.StartElementHandler (name, attributes)\n\nCalled for the start of every element.  'name' is a string\ncontaining the element name, and 'attributes' is the element\nattributes.  If *note orderedattributes: 352a. is true, this is a\nlist (see *note orderedattributes: 352a. for a full description).\nOtherwise it's a dictionary mapping names to values.\n\n-- Method: xmlparser.EndElementHandler (name)\n\nCalled for the end of every element.\n\n-- Method: xmlparser.ProcessingInstructionHandler (target, data)\n\nCalled for every processing instruction.\n\n-- Method: xmlparser.CharacterDataHandler (data)\n\nCalled for character data.  This will be called for normal\ncharacter data, CDATA marked content, and ignorable whitespace.\nApplications which must distinguish these cases can use the *note\nStartCdataSectionHandler: 3540, *note EndCdataSectionHandler: 3541,\nand *note ElementDeclHandler: 353b. callbacks to collect the\nrequired information.  Note that the character data may be chunked\neven if it is short and so you may receive more than one call to\n*note CharacterDataHandler(): 3531.  Set the *note buffertext:\n1319. instance attribute to 'True' to avoid that.\n\n-- Method: xmlparser.UnparsedEntityDeclHandler (entityName, base,\nsystemId, publicId, notationName)\n\nCalled for unparsed (NDATA) entity declarations.  This is only\npresent for version 1.2 of the Expat library; for more recent\nversions, use *note EntityDeclHandler: 3542. instead.  (The\nunderlying function in the Expat library has been declared\nobsolete.)\n\n-- Method: xmlparser.EntityDeclHandler (entityName,\nisparameterentity, value, base, systemId, publicId,\nnotationName)\n\nCalled for all entity declarations.  For parameter and internal\nentities, 'value' will be a string giving the declared contents of\nthe entity; this will be 'None' for external entities.  The\n'notationName' parameter will be 'None' for parsed entities, and\nthe name of the notation for unparsed entities.\n'isparameterentity' will be true if the entity is a parameter\nentity or false for general entities (most applications only need\nto be concerned with general entities).  This is only available\nstarting with version 1.95.0 of the Expat library.\n\n-- Method: xmlparser.NotationDeclHandler (notationName, base, systemId,\npublicId)\n\nCalled for notation declarations.  'notationName', 'base', and\n'systemId', and 'publicId' are strings if given.  If the public\nidentifier is omitted, 'publicId' will be 'None'.\n\n-- Method: xmlparser.StartNamespaceDeclHandler (prefix, uri)\n\nCalled when an element contains a namespace declaration.  Namespace\ndeclarations are processed before the *note StartElementHandler:\n353d. is called for the element on which declarations are placed.\n\n-- Method: xmlparser.EndNamespaceDeclHandler (prefix)\n\nCalled when the closing tag is reached for an element that\ncontained a namespace declaration.  This is called once for each\nnamespace declaration on the element in the reverse of the order\nfor which the *note StartNamespaceDeclHandler: 3543. was called to\nindicate the start of each namespace declaration's scope.  Calls to\nthis handler are made after the corresponding *note\nEndElementHandler: 353e. for the end of the element.\n\n-- Method: xmlparser.CommentHandler (data)\n\nCalled for comments.  'data' is the text of the comment, excluding\nthe leading ''<!-''-'' and trailing ''-''->''.\n\n-- Method: xmlparser.StartCdataSectionHandler ()\n\nCalled at the start of a CDATA section.  This and *note\nEndCdataSectionHandler: 3541. are needed to be able to identify the\nsyntactical start and end for CDATA sections.\n\n-- Method: xmlparser.EndCdataSectionHandler ()\n\nCalled at the end of a CDATA section.\n\n-- Method: xmlparser.DefaultHandler (data)\n\nCalled for any characters in the XML document for which no\napplicable handler has been specified.  This means characters that\nare part of a construct which could be reported, but for which no\nhandler has been supplied.\n\n-- Method: xmlparser.DefaultHandlerExpand (data)\n\nThis is the same as the *note DefaultHandler(): 3546, but doesn't\ninhibit expansion of internal entities.  The entity reference will\nnot be passed to the default handler.\n\n-- Method: xmlparser.NotStandaloneHandler ()\n\nCalled if the XML document hasn't been declared as being a\nstandalone document.  This happens when there is an external subset\nor a reference to a parameter entity, but the XML declaration does\nnot set standalone to 'yes' in an XML declaration.  If this handler\nreturns '0', then the parser will raise an\n'XMLERRORNOTSTANDALONE' error.  If this handler is not set, no\nexception is raised by the parser for this condition.\n\n-- Method: xmlparser.ExternalEntityRefHandler (context, base, systemId,\npublicId)\n\nCalled for references to external entities.  'base' is the current\nbase, as set by a previous call to *note SetBase(): 3523.  The\npublic and system identifiers, 'systemId' and 'publicId', are\nstrings if given; if the public identifier is not given, 'publicId'\nwill be 'None'.  The 'context' value is opaque and should only be\nused as described below.\n\nFor external entities to be parsed, this handler must be\nimplemented.  It is responsible for creating the sub-parser using\n'ExternalEntityParserCreate(context)', initializing it with the\nappropriate callbacks, and parsing the entity.  This handler should\nreturn an integer; if it returns '0', the parser will raise an\n'XMLERROREXTERNALENTITYHANDLING' error, otherwise parsing will\ncontinue.\n\nIf this handler is not provided, external entities are reported by\nthe *note DefaultHandler: 3546. callback, if provided.\n\nFile: python3.12.info,  Node: ExpatError Exceptions,  Next: Example<11>,  Prev: XMLParser Objects<2>,  Up: xml parsers expat -- Fast XML parsing using Expat\n\n5.20.13.2 ExpatError Exceptions\n...............................\n\n*note ExpatError: 10f1. exceptions have a number of interesting\nattributes:\n\n-- Attribute: ExpatError.code\n\nExpat's internal error number for the specific error.  The *note\nerrors.messages: 354b. dictionary maps these error numbers to\nExpat's error messages.  For example:\n\nfrom xml.parsers.expat import ParserCreate, ExpatError, errors\n\np = ParserCreate()\ntry:\np.Parse(somexmldocument)\nexcept ExpatError as err:\nprint(\"Error:\", errors.messages[err.code])\n\nThe *note errors: 122. module also provides error message constants\nand a dictionary *note codes: 354c. mapping these messages back to\nthe error codes, see below.\n\n-- Attribute: ExpatError.lineno\n\nLine number on which the error was detected.  The first line is\nnumbered '1'.\n\n-- Attribute: ExpatError.offset\n\nCharacter offset into the line where the error occurred.  The first\ncolumn is numbered '0'.\n\nFile: python3.12.info,  Node: Example<11>,  Next: Content Model Descriptions,  Prev: ExpatError Exceptions,  Up: xml parsers expat -- Fast XML parsing using Expat\n\n5.20.13.3 Example\n.................\n",
            "subsections": []
        },
        "The following program defines three handlers that just print out their": {
            "content": "arguments.\n\nimport xml.parsers.expat\n\n# 3 handler functions\ndef startelement(name, attrs):\nprint('Start element:', name, attrs)\ndef endelement(name):\nprint('End element:', name)\ndef chardata(data):\nprint('Character data:', repr(data))\n\np = xml.parsers.expat.ParserCreate()\n\np.StartElementHandler = startelement\np.EndElementHandler = endelement\np.CharacterDataHandler = chardata\n\np.Parse(\"\"\"<?xml version=\"1.0\"?>\n<parent id=\"top\"><child1 name=\"paul\">Text goes here</child1>\n<child2 name=\"fred\">More text</child2>\n</parent>\"\"\", 1)\n\nThe output from this program is:\n\nStart element: parent {'id': 'top'}\nStart element: child1 {'name': 'paul'}\nCharacter data: 'Text goes here'\nEnd element: child1\nCharacter data: '\\n'\nStart element: child2 {'name': 'fred'}\nCharacter data: 'More text'\nEnd element: child2\nCharacter data: '\\n'\nEnd element: parent\n\nFile: python3.12.info,  Node: Content Model Descriptions,  Next: Expat error constants,  Prev: Example<11>,  Up: xml parsers expat -- Fast XML parsing using Expat\n\n5.20.13.4 Content Model Descriptions\n....................................\n",
            "subsections": []
        },
        "Content models are described using nested tuples.  Each tuple contains": {
            "content": "four values: the type, the quantifier, the name, and a tuple of\nchildren.  Children are simply additional content model descriptions.\n\nThe values of the first two fields are constants defined in the *note\nxml.parsers.expat.model: 123. module.  These constants can be collected\nin two groups: the model type group and the quantifier group.\n\nThe constants in the model type group are:\n\n-- Data: xml.parsers.expat.model.XMLCTYPEANY\n\nThe element named by the model name was declared to have a content\nmodel of 'ANY'.\n\n-- Data: xml.parsers.expat.model.XMLCTYPECHOICE\n\nThe named element allows a choice from a number of options; this is\nused for content models such as '(A | B | C)'.\n\n-- Data: xml.parsers.expat.model.XMLCTYPEEMPTY\n\nElements which are declared to be 'EMPTY' have this model type.\n\n-- Data: xml.parsers.expat.model.XMLCTYPEMIXED\n\n-- Data: xml.parsers.expat.model.XMLCTYPENAME\n\n-- Data: xml.parsers.expat.model.XMLCTYPESEQ\n\nModels which represent a series of models which follow one after\nthe other are indicated with this model type.  This is used for\nmodels such as '(A, B, C)'.\n\nThe constants in the quantifier group are:\n\n-- Data: xml.parsers.expat.model.XMLCQUANTNONE\n\nNo modifier is given, so it can appear exactly once, as for 'A'.\n\n-- Data: xml.parsers.expat.model.XMLCQUANTOPT\n\nThe model is optional: it can appear once or not at all, as for\n'A?'.\n\n-- Data: xml.parsers.expat.model.XMLCQUANTPLUS\n\nThe model must occur one or more times (like 'A+').\n\n-- Data: xml.parsers.expat.model.XMLCQUANTREP\n\nThe model must occur zero or more times, as for 'A*'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Expat error constants,  Prev: Content Model Descriptions,  Up: xml parsers expat -- Fast XML parsing using Expat": {
            "content": "5.20.13.5 Expat error constants\n...............................\n\nThe following constants are provided in the *note\nxml.parsers.expat.errors: 122. module.  These constants are useful in\ninterpreting some of the attributes of the 'ExpatError' exception\nobjects raised when an error has occurred.  Since for backwards\ncompatibility reasons, the constants' value is the error 'message' and\nnot the numeric error 'code', you do this by comparing its *note code:\n18. attribute with 'errors.codes[errors.XMLERRORCONSTANTNAME]'.\n\nThe 'errors' module has the following attributes:\n\n-- Data: xml.parsers.expat.errors.codes\n\nA dictionary mapping string descriptions to their error codes.\n\nNew in version 3.2.\n\n-- Data: xml.parsers.expat.errors.messages\n\nA dictionary mapping numeric error codes to their string\ndescriptions.\n\nNew in version 3.2.\n\n-- Data: xml.parsers.expat.errors.XMLERRORASYNCENTITY\n\n-- Data:\nxml.parsers.expat.errors.XMLERRORATTRIBUTEEXTERNALENTITYREF\n\nAn entity reference in an attribute value referred to an external\nentity instead of an internal entity.\n\n-- Data: xml.parsers.expat.errors.XMLERRORBADCHARREF\n\nA character reference referred to a character which is illegal in\nXML (for example, character '0', or ''&#0;'').\n\n-- Data: xml.parsers.expat.errors.XMLERRORBINARYENTITYREF\n\nAn entity reference referred to an entity which was declared with a\nnotation, so cannot be parsed.\n\n-- Data: xml.parsers.expat.errors.XMLERRORDUPLICATEATTRIBUTE\n\nAn attribute was used more than once in a start tag.\n\n-- Data: xml.parsers.expat.errors.XMLERRORINCORRECTENCODING\n\n-- Data: xml.parsers.expat.errors.XMLERRORINVALIDTOKEN\n\nRaised when an input byte could not properly be assigned to a\ncharacter; for example, a NUL byte (value '0') in a UTF-8 input\nstream.\n\n-- Data: xml.parsers.expat.errors.XMLERRORJUNKAFTERDOCELEMENT\n\nSomething other than whitespace occurred after the document\nelement.\n\n-- Data: xml.parsers.expat.errors.XMLERRORMISPLACEDXMLPI\n\nAn XML declaration was found somewhere other than the start of the\ninput data.\n\n-- Data: xml.parsers.expat.errors.XMLERRORNOELEMENTS\n\nThe document contains no elements (XML requires all documents to\ncontain exactly one top-level element)..\n\n-- Data: xml.parsers.expat.errors.XMLERRORNOMEMORY\n\nExpat was not able to allocate memory internally.\n\n-- Data: xml.parsers.expat.errors.XMLERRORPARAMENTITYREF\n\nA parameter entity reference was found where it was not allowed.\n\n-- Data: xml.parsers.expat.errors.XMLERRORPARTIALCHAR\n\nAn incomplete character was found in the input.\n\n-- Data: xml.parsers.expat.errors.XMLERRORRECURSIVEENTITYREF\n\nAn entity reference contained another reference to the same entity;\npossibly via a different name, and possibly indirectly.\n\n-- Data: xml.parsers.expat.errors.XMLERRORSYNTAX\n\nSome unspecified syntax error was encountered.\n\n-- Data: xml.parsers.expat.errors.XMLERRORTAGMISMATCH\n\nAn end tag did not match the innermost open start tag.\n\n-- Data: xml.parsers.expat.errors.XMLERRORUNCLOSEDTOKEN\n\nSome token (such as a start tag) was not closed before the end of\nthe stream or the next token was encountered.\n\n-- Data: xml.parsers.expat.errors.XMLERRORUNDEFINEDENTITY\n\nA reference was made to an entity which was not defined.\n\n-- Data: xml.parsers.expat.errors.XMLERRORUNKNOWNENCODING\n\nThe document encoding is not supported by Expat.\n\n-- Data: xml.parsers.expat.errors.XMLERRORUNCLOSEDCDATASECTION\n\nA CDATA marked section was not closed.\n\n-- Data: xml.parsers.expat.errors.XMLERROREXTERNALENTITYHANDLING\n\n-- Data: xml.parsers.expat.errors.XMLERRORNOTSTANDALONE\n\nThe parser determined that the document was not \"standalone\" though\nit declared itself to be in the XML declaration, and the\n'NotStandaloneHandler' was set and returned '0'.\n\n-- Data: xml.parsers.expat.errors.XMLERRORUNEXPECTEDSTATE\n\n-- Data: xml.parsers.expat.errors.XMLERRORENTITYDECLAREDINPE\n\n-- Data: xml.parsers.expat.errors.XMLERRORFEATUREREQUIRESXMLDTD\n\nAn operation was requested that requires DTD support to be compiled\nin, but Expat was configured without DTD support.  This should\nnever be reported by a standard build of the *note\nxml.parsers.expat: 121. module.\n\n-- Data:\nxml.parsers.expat.errors.XMLERRORCANTCHANGEFEATUREONCEPARSING\n\nA behavioral change was requested after parsing started that can\nonly be changed before parsing has started.  This is (currently)\nonly raised by 'UseForeignDTD()'.\n\n-- Data: xml.parsers.expat.errors.XMLERRORUNBOUNDPREFIX\n\nAn undeclared prefix was found when namespace processing was\nenabled.\n\n-- Data: xml.parsers.expat.errors.XMLERRORUNDECLARINGPREFIX\n\nThe document attempted to remove the namespace declaration\nassociated with a prefix.\n\n-- Data: xml.parsers.expat.errors.XMLERRORINCOMPLETEPE\n\nA parameter entity contained incomplete markup.\n\n-- Data: xml.parsers.expat.errors.XMLERRORXMLDECL\n\nThe document contained no document element at all.\n\n-- Data: xml.parsers.expat.errors.XMLERRORTEXTDECL\n\nThere was an error parsing a text declaration in an external\nentity.\n\n-- Data: xml.parsers.expat.errors.XMLERRORPUBLICID\n\nCharacters were found in the public id that are not allowed.\n\n-- Data: xml.parsers.expat.errors.XMLERRORSUSPENDED\n\nThe requested operation was made on a suspended parser, but isn't\nallowed.  This includes attempts to provide additional input or to\nstop the parser.\n\n-- Data: xml.parsers.expat.errors.XMLERRORNOTSUSPENDED\n\nAn attempt to resume the parser was made when the parser had not\nbeen suspended.\n\n-- Data: xml.parsers.expat.errors.XMLERRORABORTED\n\nThis should not be reported to Python applications.\n\n-- Data: xml.parsers.expat.errors.XMLERRORFINISHED\n\nThe requested operation was made on a parser which was finished\nparsing input, but isn't allowed.  This includes attempts to\nprovide additional input or to stop the parser.\n\n-- Data: xml.parsers.expat.errors.XMLERRORSUSPENDPE\n\n-- Data: xml.parsers.expat.errors.XMLERRORRESERVEDPREFIXXML\n\nAn attempt was made to undeclare reserved namespace prefix 'xml' or\nto bind it to another namespace URI.\n\n-- Data: xml.parsers.expat.errors.XMLERRORRESERVEDPREFIXXMLNS\n\nAn attempt was made to declare or undeclare reserved namespace\nprefix 'xmlns'.\n\n-- Data: xml.parsers.expat.errors.XMLERRORRESERVEDNAMESPACEURI\n\nAn attempt was made to bind the URI of one the reserved namespace\nprefixes 'xml' and 'xmlns' to another namespace prefix.\n\n-- Data: xml.parsers.expat.errors.XMLERRORINVALIDARGUMENT\n\nThis should not be reported to Python applications.\n\n-- Data: xml.parsers.expat.errors.XMLERRORNOBUFFER\n\nThis should not be reported to Python applications.\n\n-- Data: xml.parsers.expat.errors.XMLERRORAMPLIFICATIONLIMITBREACH\n\nThe limit on input amplification factor (from DTD and entities) has\nbeen breached.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Internet Protocols and Support,  Next: Multimedia Services,  Prev: Structured Markup Processing Tools,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.21 Internet Protocols and Support",
                    "content": ""
                }
            ]
        },
        "The modules described in this chapter implement internet protocols and": {
            "content": "support for related technology.  They are all implemented in Python.",
            "subsections": []
        },
        "Most of these modules require the presence of the system-dependent": {
            "content": "module *note socket: c6, which is currently supported on most popular\nplatforms.  Here is an overview:\n\n* Menu:\n\n* webbrowser -- Convenient web-browser controller::\n* wsgiref -- WSGI Utilities and Reference Implementation::\n* urllib -- URL handling modules::\n* urllib.request -- Extensible library for opening URLs: urllib request -- Extensible library for opening URLs.\n* urllib.response -- Response classes used by urllib: urllib response -- Response classes used by urllib.\n* urllib.parse -- Parse URLs into components: urllib parse -- Parse URLs into components.\n* urllib.error -- Exception classes raised by urllib.request: urllib error -- Exception classes raised by urllib request.\n* urllib.robotparser -- Parser for robots.txt: urllib robotparser -- Parser for robots txt.\n* http -- HTTP modules::\n* http.client -- HTTP protocol client: http client -- HTTP protocol client.\n* ftplib -- FTP protocol client::\n* poplib -- POP3 protocol client::\n* imaplib -- IMAP4 protocol client::\n* smtplib -- SMTP protocol client::\n* uuid -- UUID objects according to RFC 4122::\n* socketserver -- A framework for network servers::\n* http.server -- HTTP servers: http server -- HTTP servers.\n* http.cookies -- HTTP state management: http cookies -- HTTP state management.\n* http.cookiejar -- Cookie handling for HTTP clients: http cookiejar -- Cookie handling for HTTP clients.\n* xmlrpc -- XMLRPC server and client modules::\n* xmlrpc.client -- XML-RPC client access: xmlrpc client -- XML-RPC client access.\n* xmlrpc.server -- Basic XML-RPC servers: xmlrpc server -- Basic XML-RPC servers.\n* ipaddress -- IPv4/IPv6 manipulation library::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: webbrowser -- Convenient web-browser controller,  Next: wsgiref -- WSGI Utilities and Reference Implementation,  Up: Internet Protocols and Support": {
            "content": "'Source code:' Lib/webbrowser.py(1)\n\n\n\nThe *note webbrowser: 110. module provides a high-level interface to\nallow displaying web-based documents to users.  Under most\ncircumstances, simply calling the *note open(): 3585. function from this\nmodule will do the right thing.\n",
            "subsections": []
        },
        "Under Unix, graphical browsers are preferred under X11, but text-mode": {
            "content": "browsers will be used if graphical browsers are not available or an X11\ndisplay isn't available.  If text-mode browsers are used, the calling\nprocess will block until the user exits the browser.\n",
            "subsections": []
        },
        "If the environment variable 'BROWSER' exists, it is interpreted as the": {
            "content": "*note os.pathsep: 1ac4.-separated list of browsers to try ahead of the\nplatform defaults.  When the value of a list part contains the string\n'%s', then it is interpreted as a literal browser command line to be\nused with the argument URL substituted for '%s'; if the part does not\ncontain '%s', it is simply interpreted as the name of the browser to\nlaunch.  (2)\n",
            "subsections": []
        },
        "For non-Unix platforms, or when a remote browser is available on Unix,": {
            "content": "the controlling process will not wait for the user to finish with the\nbrowser, but allow the remote browser to maintain its own windows on the\ndisplay.  If remote browsers are not available on Unix, the controlling\nprocess will launch a new browser and wait.\n",
            "subsections": []
        },
        "The script 'webbrowser' can be used as a command-line interface for the": {
            "content": "module.  It accepts a URL as the argument.  It accepts the following\noptional parameters: '-n' opens the URL in a new browser window, if\npossible; '-t' opens the URL in a new browser page (\"tab\").  The options\nare, naturally, mutually exclusive.  Usage example:\n\npython -m webbrowser -t \"https://www.python.org\"\n\n*note Availability: 1ad3.: not Emscripten, not WASI.\n",
            "subsections": []
        },
        "Type Name                    Class Name                                    Notes": {
            "content": "---------------------------------------------------------------------------------------\n\n''mozilla''                  'Mozilla('mozilla')'\n\n\n''firefox''                  'Mozilla('mozilla')'\n\n\n''epiphany''                 'Epiphany('epiphany')'\n\n\n''kfmclient''                'Konqueror()'                                 (1)\n\n\n''konqueror''                'Konqueror()'                                 (1)\n\n\n''kfm''                      'Konqueror()'                                 (1)\n\n\n''opera''                    'Opera()'\n\n\n''links''                    'GenericBrowser('links')'\n\n\n''elinks''                   'Elinks('elinks')'\n\n\n''lynx''                     'GenericBrowser('lynx')'\n\n\n''w3m''                      'GenericBrowser('w3m')'\n\n\n''windows-default''          'WindowsDefault'                              (2)\n\n\n''macosx''                   'MacOSXOSAScript('default')'                  (3)\n\n\n''safari''                   'MacOSXOSAScript('safari')'                   (3)\n\n\n''google-chrome''            'Chrome('google-chrome')'\n\n\n''chrome''                   'Chrome('chrome')'\n\n\n''chromium''                 'Chromium('chromium')'\n\n\n''chromium-browser''         'Chromium('chromium-browser')'\n\n\nNotes:\n\n1. \"Konqueror\" is the file manager for the KDE desktop environment for\nUnix, and only makes sense to use if KDE is running.  Some way of\nreliably detecting KDE would be nice; the 'KDEDIR' variable is not\nsufficient.  Note also that the name \"kfm\" is used even when using\nthe 'konqueror' command with KDE 2 -- the implementation selects the\nbest strategy for running Konqueror.\n\n2. Only on Windows platforms.\n\n3. Only on macOS platform.\n\nNew in version 3.3: Support for Chrome/Chromium has been added.\n",
            "subsections": []
        },
        "Changed in version 3.12: Support for several obsolete browsers has been": {
            "content": "removed.  Removed browsers include Grail, Mosaic, Netscape, Galeon,\nSkipstone, Iceape, and Firefox versions 35 and below.\n",
            "subsections": []
        },
        "Deprecated since version 3.11, will be removed in version 3.13: 'MacOSX'": {
            "content": "is deprecated, use 'MacOSXOSAScript' instead.\n\nHere are some simple examples:\n\nurl = 'https://docs.python.org/'\n\n# Open URL in a new tab, if a browser window is already open.\nwebbrowser.opennewtab(url)\n\n# Open URL in new window, raising the window if possible.\nwebbrowser.opennew(url)\n\n* Menu:\n\n* Browser Controller Objects::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/webbrowser.py\n\n(2) Executables named here without a full path will be searched in\nthe directories given in the 'PATH' environment variable.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Browser Controller Objects,  Up: webbrowser -- Convenient web-browser controller": {
            "content": "5.21.1.1 Browser Controller Objects\n...................................\n",
            "subsections": []
        },
        "Browser controllers provide these methods which parallel three of the": {
            "content": "module-level convenience functions:\n\n-- Attribute: webbrowser.name\n\nSystem-dependent name for the browser.\n\n-- Method: controller.open (url, new=0, autoraise=True)\n\nDisplay 'url' using the browser handled by this controller.  If\n'new' is 1, a new browser window is opened if possible.  If 'new'\nis 2, a new browser page (\"tab\") is opened if possible.\n\n-- Method: controller.opennew (url)\n\nOpen 'url' in a new window of the browser handled by this\ncontroller, if possible, otherwise, open 'url' in the only browser\nwindow.  Alias *note opennew(): 3587.\n\n-- Method: controller.opennewtab (url)\n\nOpen 'url' in a new page (\"tab\") of the browser handled by this\ncontroller, if possible, otherwise equivalent to *note opennew():\n3587.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: wsgiref -- WSGI Utilities and Reference Implementation,  Next: urllib -- URL handling modules,  Prev: webbrowser -- Convenient web-browser controller,  Up: Internet Protocols and Support": {
            "content": "'Source code:' Lib/wsgiref(1)\n\n\n",
            "subsections": []
        },
        "The Web Server Gateway Interface (WSGI) is a standard interface between": {
            "content": "web server software and web applications written in Python.  Having a\nstandard interface makes it easy to use an application that supports\nWSGI with a number of different web servers.\n",
            "subsections": []
        },
        "Only authors of web servers and programming frameworks need to know": {
            "content": "every detail and corner case of the WSGI design.  You don't need to\nunderstand every detail of WSGI just to install a WSGI application or to\nwrite a web application using an existing framework.\n\n*note wsgiref: 113. is a reference implementation of the WSGI\nspecification that can be used to add WSGI support to a web server or\nframework.  It provides utilities for manipulating WSGI environment\nvariables and response headers, base classes for implementing WSGI\nservers, a demo HTTP server that serves WSGI applications, types for\nstatic type checking, and a validation tool that checks WSGI servers and\napplications for conformance to the WSGI specification ( PEP 3333(2)).\n",
            "subsections": []
        },
        "See wsgi.readthedocs.io(3) for more information about WSGI, and links to": {
            "content": "tutorials and other resources.\n\n* Menu:\n\n* wsgiref.util - WSGI environment utilities: wsgiref util - WSGI environment utilities.\n* wsgiref.headers - WSGI response header tools: wsgiref headers - WSGI response header tools.\n* wsgiref.simpleserver - a simple WSGI HTTP server: wsgiref simpleserver - a simple WSGI HTTP server.\n* wsgiref.validate -- WSGI conformance checker: wsgiref validate -- WSGI conformance checker.\n* wsgiref.handlers - server/gateway base classes: wsgiref handlers - server/gateway base classes.\n* wsgiref.types - WSGI types for static type checking: wsgiref types - WSGI types for static type checking.\n* Examples: Examples<24>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/wsgiref\n\n(2) https://peps.python.org/pep-3333/\n\n(3) https://wsgi.readthedocs.io/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: wsgiref util - WSGI environment utilities,  Next: wsgiref headers - WSGI response header tools,  Up: wsgiref -- WSGI Utilities and Reference Implementation": {
            "content": "5.21.2.1 'wsgiref.util' - WSGI environment utilities\n....................................................\n",
            "subsections": []
        },
        "This module provides a variety of utility functions for working with": {
            "content": "WSGI environments.  A WSGI environment is a dictionary containing HTTP\nrequest variables as described in PEP 3333(1).  All of the functions\ntaking an 'environ' parameter expect a WSGI-compliant dictionary to be\nsupplied; please see PEP 3333(2) for a detailed specification and *note\nWSGIEnvironment: 3594. for a type alias that can be used in type\nannotations.\n\n-- Function: wsgiref.util.guessscheme (environ)\n\nReturn a guess for whether 'wsgi.urlscheme' should be \"http\" or\n\"https\", by checking for a 'HTTPS' environment variable in the\n'environ' dictionary.  The return value is a string.\n\nThis function is useful when creating a gateway that wraps CGI or a\nCGI-like protocol such as FastCGI. Typically, servers providing\nsuch protocols will include a 'HTTPS' variable with a value of \"1\",\n\"yes\", or \"on\" when a request is received via SSL. So, this\nfunction returns \"https\" if such a value is found, and \"http\"\notherwise.\n\n-- Function: wsgiref.util.requesturi (environ, includequery=True)\n\nReturn the full request URI, optionally including the query string,\nusing the algorithm found in the \"URL Reconstruction\" section of\nPEP 3333(3).  If 'includequery' is false, the query string is not\nincluded in the resulting URI.\n\n-- Function: wsgiref.util.applicationuri (environ)\n\nSimilar to *note requesturi(): 3596, except that the 'PATHINFO'\nand 'QUERYSTRING' variables are ignored.  The result is the base\nURI of the application object addressed by the request.\n\n-- Function: wsgiref.util.shiftpathinfo (environ)\n\nShift a single name from 'PATHINFO' to 'SCRIPTNAME' and return\nthe name.  The 'environ' dictionary is 'modified' in-place; use a\ncopy if you need to keep the original 'PATHINFO' or 'SCRIPTNAME'\nintact.\n\nIf there are no remaining path segments in 'PATHINFO', 'None' is\nreturned.\n\nTypically, this routine is used to process each portion of a\nrequest URI path, for example to treat the path as a series of\ndictionary keys.  This routine modifies the passed-in environment\nto make it suitable for invoking another WSGI application that is\nlocated at the target URI. For example, if there is a WSGI\napplication at '/foo', and the request URI path is '/foo/bar/baz',\nand the WSGI application at '/foo' calls *note shiftpathinfo():\n3598, it will receive the string \"bar\", and the environment will be\nupdated to be suitable for passing to a WSGI application at\n'/foo/bar'.  That is, 'SCRIPTNAME' will change from '/foo' to\n'/foo/bar', and 'PATHINFO' will change from '/bar/baz' to '/baz'.\n\nWhen 'PATHINFO' is just a \"/\", this routine returns an empty\nstring and appends a trailing slash to 'SCRIPTNAME', even though\nempty path segments are normally ignored, and 'SCRIPTNAME' doesn't\nnormally end in a slash.  This is intentional behavior, to ensure\nthat an application can tell the difference between URIs ending in\n'/x' from ones ending in '/x/' when using this routine to do object\ntraversal.\n\n-- Function: wsgiref.util.setuptestingdefaults (environ)\n\nUpdate 'environ' with trivial defaults for testing purposes.\n\nThis routine adds various parameters required for WSGI, including\n'HTTPHOST', 'SERVERNAME', 'SERVERPORT', 'REQUESTMETHOD',\n'SCRIPTNAME', 'PATHINFO', and all of the PEP 3333(4)-defined\n'wsgi.*' variables.  It only supplies default values, and does not\nreplace any existing settings for these variables.\n\nThis routine is intended to make it easier for unit tests of WSGI\nservers and applications to set up dummy environments.  It should\nNOT be used by actual WSGI servers or applications, since the data\nis fake!\n\nExample usage:\n\nfrom wsgiref.util import setuptestingdefaults\nfrom wsgiref.simpleserver import makeserver\n\n# A relatively simple WSGI application. It's going to print out the\n# environment dictionary after being updated by setuptestingdefaults\ndef simpleapp(environ, startresponse):\nsetuptestingdefaults(environ)\n\nstatus = '200 OK'\nheaders = [('Content-type', 'text/plain; charset=utf-8')]\n\nstartresponse(status, headers)\n\nret = [(\"%s: %s\\n\" % (key, value)).encode(\"utf-8\")\nfor key, value in environ.items()]\nreturn ret\n\nwith makeserver('', 8000, simpleapp) as httpd:\nprint(\"Serving on port 8000...\")\nhttpd.serveforever()\n\nIn addition to the environment functions above, the *note wsgiref.util:\n118. module also provides these miscellaneous utilities:\n\n-- Function: wsgiref.util.ishopbyhop (headername)\n\nReturn 'True' if 'headername' is an HTTP/1.1 \"Hop-by-Hop\" header,\nas defined by RFC 2616(5).\n\n-- Class: wsgiref.util.FileWrapper (filelike, blksize=8192)\n\nA concrete implementation of the *note wsgiref.types.FileWrapper:\n359b. protocol used to convert a file-like object to an *note\niterator: 16a9.  The resulting objects are *note iterable: 109d.s.\nAs the object is iterated over, the optional 'blksize' parameter\nwill be repeatedly passed to the 'filelike' object's 'read()'\nmethod to obtain bytestrings to yield.  When 'read()' returns an\nempty bytestring, iteration is ended and is not resumable.\n\nIf 'filelike' has a 'close()' method, the returned object will also\nhave a 'close()' method, and it will invoke the 'filelike' object's\n'close()' method when called.\n\nExample usage:\n\nfrom io import StringIO\nfrom wsgiref.util import FileWrapper\n\n# We're using a StringIO-buffer for as the file-like object\nfilelike = StringIO(\"This is an example file-like object\"*10)\nwrapper = FileWrapper(filelike, blksize=5)\n\nfor chunk in wrapper:\nprint(chunk)\n\nChanged in version 3.11: Support for *note getitem(): 4b9.\nmethod has been removed.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3333/\n\n(2) https://peps.python.org/pep-3333/\n\n(3) https://peps.python.org/pep-3333/\n\n(4) https://peps.python.org/pep-3333/\n\n(5) https://datatracker.ietf.org/doc/html/rfc2616.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: wsgiref headers - WSGI response header tools,  Next: wsgiref simpleserver - a simple WSGI HTTP server,  Prev: wsgiref util - WSGI environment utilities,  Up: wsgiref -- WSGI Utilities and Reference Implementation": {
            "content": "5.21.2.2 'wsgiref.headers' - WSGI response header tools\n.......................................................\n\nThis module provides a single class, *note Headers: cfc, for convenient\nmanipulation of WSGI response headers using a mapping-like interface.\n\n-- Class: wsgiref.headers.Headers ([headers])\n\nCreate a mapping-like object wrapping 'headers', which must be a\nlist of header name/value tuples as described in PEP 3333(1).  The\ndefault value of 'headers' is an empty list.\n\n*note Headers: cfc. objects support typical mapping operations\nincluding *note getitem(): 4b9, *note get(): 1f4f, *note\nsetitem(): 1320, *note setdefault(): ef0, *note delitem():\n1321. and *note contains(): 1c63.  For each of these methods,\nthe key is the header name (treated case-insensitively), and the\nvalue is the first value associated with that header name.  Setting\na header deletes any existing values for that header, then adds a\nnew value at the end of the wrapped header list.  Headers' existing\norder is generally maintained, with new headers added to the end of\nthe wrapped list.\n\nUnlike a dictionary, *note Headers: cfc. objects do not raise an\nerror when you try to get or delete a key that isn't in the wrapped\nheader list.  Getting a nonexistent header just returns 'None', and\ndeleting a nonexistent header does nothing.\n\n*note Headers: cfc. objects also support 'keys()', 'values()', and\n'items()' methods.  The lists returned by 'keys()' and 'items()'\ncan include the same key more than once if there is a multi-valued\nheader.  The 'len()' of a *note Headers: cfc. object is the same as\nthe length of its 'items()', which is the same as the length of the\nwrapped header list.  In fact, the 'items()' method just returns a\ncopy of the wrapped header list.\n\nCalling 'bytes()' on a *note Headers: cfc. object returns a\nformatted bytestring suitable for transmission as HTTP response\nheaders.  Each header is placed on a line with its value, separated\nby a colon and a space.  Each line is terminated by a carriage\nreturn and line feed, and the bytestring is terminated with a blank\nline.\n\nIn addition to their mapping interface and formatting features,\n*note Headers: cfc. objects also have the following methods for\nquerying and adding multi-valued headers, and for adding headers\nwith MIME parameters:\n\n-- Method: getall (name)\n\nReturn a list of all the values for the named header.\n\nThe returned list will be sorted in the order they appeared in\nthe original header list or were added to this instance, and\nmay contain duplicates.  Any fields deleted and re-inserted\nare always appended to the header list.  If no fields exist\nwith the given name, returns an empty list.\n\n-- Method: addheader (name, value, params)\n\nAdd a (possibly multi-valued) header, with optional MIME\nparameters specified via keyword arguments.\n\n'name' is the header field to add.  Keyword arguments can be\nused to set MIME parameters for the header field.  Each\nparameter must be a string or 'None'.  Underscores in\nparameter names are converted to dashes, since dashes are\nillegal in Python identifiers, but many MIME parameter names\ninclude dashes.  If the parameter value is a string, it is\nadded to the header value parameters in the form\n'name=\"value\"'.  If it is 'None', only the parameter name is\nadded.  (This is used for MIME parameters without a value.)\nExample usage:\n\nh.addheader('content-disposition', 'attachment', filename='bud.gif')\n\nThe above will add a header that looks like this:\n\nContent-Disposition: attachment; filename=\"bud.gif\"\n\nChanged in version 3.5: 'headers' parameter is optional.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3333/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: wsgiref simpleserver - 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": {
            "content": "5.21.2.3 'wsgiref.simpleserver' - a simple WSGI HTTP server\n............................................................\n\nThis module implements a simple HTTP server (based on *note http.server:\n6d.) that serves WSGI applications.  Each server instance serves a\nsingle WSGI application on a given host and port.  If you want to serve\nmultiple applications on a single host and port, you should create a\nWSGI application that parses 'PATHINFO' to select which application to\ninvoke for each request.  (E.g., using the 'shiftpathinfo()' function\nfrom *note wsgiref.util: 118.)\n\n-- Function: wsgiref.simpleserver.makeserver (host, port, app,\nserverclass=WSGIServer, handlerclass=WSGIRequestHandler)\n\nCreate a new WSGI server listening on 'host' and 'port', accepting\nconnections for 'app'.  The return value is an instance of the\nsupplied 'serverclass', and will process requests using the\nspecified 'handlerclass'.  'app' must be a WSGI application\nobject, as defined by PEP 3333(1).\n\nExample usage:\n\nfrom wsgiref.simpleserver import makeserver, demoapp\n\nwith makeserver('', 8000, demoapp) as httpd:\nprint(\"Serving HTTP on port 8000...\")\n\n# Respond to requests until process is killed\nhttpd.serveforever()\n\n# Alternative: serve one request, then exit\nhttpd.handlerequest()\n\n-- Function: wsgiref.simpleserver.demoapp (environ, startresponse)\n\nThis function is a small but complete WSGI application that returns\na text page containing the message \"Hello world!\" and a list of the\nkey/value pairs provided in the 'environ' parameter.  It's useful\nfor verifying that a WSGI server (such as *note\nwsgiref.simpleserver: 116.) is able to run a simple WSGI\napplication correctly.\n\n-- Class: wsgiref.simpleserver.WSGIServer (serveraddress,\nRequestHandlerClass)\n\nCreate a *note WSGIServer: 35a2. instance.  'serveraddress' should\nbe a '(host,port)' tuple, and 'RequestHandlerClass' should be the\nsubclass of *note http.server.BaseHTTPRequestHandler: f3b. that\nwill be used to process requests.\n\nYou do not normally need to call this constructor, as the *note\nmakeserver(): 35a0. function can handle all the details for you.\n\n*note WSGIServer: 35a2. is a subclass of *note\nhttp.server.HTTPServer: 35a3, so all of its methods (such as\n'serveforever()' and 'handlerequest()') are available.  *note\nWSGIServer: 35a2. also provides these WSGI-specific methods:\n\n-- Method: setapp (application)\n\nSets the callable 'application' as the WSGI application that\nwill receive requests.\n\n-- Method: getapp ()\n\nReturns the currently set application callable.\n\nNormally, however, you do not need to use these additional methods,\nas *note setapp(): 35a4. is normally called by *note\nmakeserver(): 35a0, and the *note getapp(): 35a5. exists mainly\nfor the benefit of request handler instances.\n\n-- Class: wsgiref.simpleserver.WSGIRequestHandler (request,\nclientaddress, server)\n\nCreate an HTTP handler for the given 'request' (i.e.  a socket),\n'clientaddress' (a '(host,port)' tuple), and 'server' (*note\nWSGIServer: 35a2. instance).\n\nYou do not need to create instances of this class directly; they\nare automatically created as needed by *note WSGIServer: 35a2.\nobjects.  You can, however, subclass this class and supply it as a\n'handlerclass' to the *note makeserver(): 35a0. function.  Some\npossibly relevant methods for overriding in subclasses:\n\n-- Method: getenviron ()\n\nReturn a *note WSGIEnvironment: 3594. dictionary for a\nrequest.  The default implementation copies the contents of\nthe *note WSGIServer: 35a2. object's 'baseenviron' dictionary\nattribute and then adds various headers derived from the HTTP\nrequest.  Each call to this method should return a new\ndictionary containing all of the relevant CGI environment\nvariables as specified in PEP 3333(2).\n\n-- Method: getstderr ()\n\nReturn the object that should be used as the 'wsgi.errors'\nstream.  The default implementation just returns 'sys.stderr'.\n\n-- Method: handle ()\n\nProcess the HTTP request.  The default implementation creates\na handler instance using a *note wsgiref.handlers: 114. class\nto implement the actual WSGI application interface.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3333/\n\n(2) https://peps.python.org/pep-3333/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: wsgiref validate -- WSGI conformance checker,  Next: wsgiref handlers - server/gateway base classes,  Prev: wsgiref simpleserver - a simple WSGI HTTP server,  Up: wsgiref -- WSGI Utilities and Reference Implementation": {
            "content": "5.21.2.4 'wsgiref.validate' -- WSGI conformance checker\n......................................................\n",
            "subsections": []
        },
        "When creating new WSGI application objects, frameworks, servers, or": {
            "content": "middleware, it can be useful to validate the new code's conformance\nusing *note wsgiref.validate: 119.  This module provides a function that\ncreates WSGI application objects that validate communications between a\nWSGI server or gateway and a WSGI application object, to check both\nsides for protocol conformance.\n",
            "subsections": []
        },
        "Note that this utility does not guarantee complete PEP 3333(1)": {
            "content": "compliance; an absence of errors from this module does not necessarily\nmean that errors do not exist.  However, if this module does produce an\nerror, then it is virtually certain that either the server or\napplication is not 100% compliant.\n",
            "subsections": []
        },
        "This module is based on the 'paste.lint' module from Ian Bicking's": {
            "content": "\"Python Paste\" library.\n\n-- Function: wsgiref.validate.validator (application)\n\nWrap 'application' and return a new WSGI application object.  The\nreturned application will forward all requests to the original\n'application', and will check that both the 'application' and the\nserver invoking it are conforming to the WSGI specification and to\nRFC 2616(2).\n\nAny detected nonconformance results in an *note AssertionError:\n476. being raised; note, however, that how these errors are handled\nis server-dependent.  For example, *note wsgiref.simpleserver:\n116. and other servers based on *note wsgiref.handlers: 114. (that\ndon't override the error handling methods to do something else)\nwill simply output a message that an error has occurred, and dump\nthe traceback to 'sys.stderr' or some other error stream.\n\nThis wrapper may also generate output using the *note warnings:\n10d. module to indicate behaviors that are questionable but which\nmay not actually be prohibited by PEP 3333(3).  Unless they are\nsuppressed using Python command-line options or the *note warnings:\n10d. API, any such warnings will be written to 'sys.stderr' ('not'\n'wsgi.errors', unless they happen to be the same object).\n\nExample usage:\n\nfrom wsgiref.validate import validator\nfrom wsgiref.simpleserver import makeserver\n\n# Our callable object which is intentionally not compliant to the\n# standard, so the validator is going to break\ndef simpleapp(environ, startresponse):\nstatus = '200 OK'  # HTTP Status\nheaders = [('Content-type', 'text/plain')]  # HTTP Headers\nstartresponse(status, headers)\n\n# This is going to break because we need to return a list, and\n# the validator is going to inform us\nreturn b\"Hello World\"\n\n# This is the application wrapped in a validator\nvalidatorapp = validator(simpleapp)\n\nwith makeserver('', 8000, validatorapp) as httpd:\nprint(\"Listening on port 8000....\")\nhttpd.serveforever()\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3333/\n\n(2) https://datatracker.ietf.org/doc/html/rfc2616.html\n\n(3) https://peps.python.org/pep-3333/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "5.21.2.5 'wsgiref.handlers' - server/gateway base classes\n.........................................................\n",
            "subsections": []
        },
        "This module provides base handler classes for implementing WSGI servers": {
            "content": "and gateways.  These base classes handle most of the work of\ncommunicating with a WSGI application, as long as they are given a\nCGI-like environment, along with input, output, and error streams.\n\n-- Class: wsgiref.handlers.CGIHandler\n\nCGI-based invocation via 'sys.stdin', 'sys.stdout', 'sys.stderr'\nand 'os.environ'.  This is useful when you have a WSGI application\nand want to run it as a CGI script.  Simply invoke\n'CGIHandler().run(app)', where 'app' is the WSGI application object\nyou wish to invoke.\n\nThis class is a subclass of *note BaseCGIHandler: 35ae. that sets\n'wsgi.runonce' to true, 'wsgi.multithread' to false, and\n'wsgi.multiprocess' to true, and always uses *note sys: d3. and\n*note os: 9c. to obtain the necessary CGI streams and environment.\n\n-- Class: wsgiref.handlers.IISCGIHandler\n\nA specialized alternative to *note CGIHandler: 35ad, for use when\ndeploying on Microsoft's IIS web server, without having set the\nconfig allowPathInfo option (IIS>=7) or metabase\nallowPathInfoForScriptMappings (IIS<7).\n\nBy default, IIS gives a 'PATHINFO' that duplicates the\n'SCRIPTNAME' at the front, causing problems for WSGI applications\nthat wish to implement routing.  This handler strips any such\nduplicated path.\n\nIIS can be configured to pass the correct 'PATHINFO', but this\ncauses another bug where 'PATHTRANSLATED' is wrong.  Luckily this\nvariable is rarely used and is not guaranteed by WSGI. On IIS<7,\nthough, the setting can only be made on a vhost level, affecting\nall other script mappings, many of which break when exposed to the\n'PATHTRANSLATED' bug.  For this reason IIS<7 is almost never\ndeployed with the fix (Even IIS7 rarely uses it because there is\nstill no UI for it.).\n\nThere is no way for CGI code to tell whether the option was set, so\na separate handler class is provided.  It is used in the same way\nas *note CGIHandler: 35ad, i.e., by calling\n'IISCGIHandler().run(app)', where 'app' is the WSGI application\nobject you wish to invoke.\n\nNew in version 3.2.\n\n-- Class: wsgiref.handlers.BaseCGIHandler (stdin, stdout, stderr,\nenviron, multithread=True, multiprocess=False)\n\nSimilar to *note CGIHandler: 35ad, but instead of using the *note\nsys: d3. and *note os: 9c. modules, the CGI environment and I/O\nstreams are specified explicitly.  The 'multithread' and\n'multiprocess' values are used to set the 'wsgi.multithread' and\n'wsgi.multiprocess' flags for any applications run by the handler\ninstance.\n\nThis class is a subclass of *note SimpleHandler: 35b0. intended for\nuse with software other than HTTP \"origin servers\".  If you are\nwriting a gateway protocol implementation (such as CGI, FastCGI,\nSCGI, etc.)  that uses a 'Status:' header to send an HTTP status,\nyou probably want to subclass this instead of *note SimpleHandler:\n35b0.\n\n-- Class: wsgiref.handlers.SimpleHandler (stdin, stdout, stderr,\nenviron, multithread=True, multiprocess=False)\n\nSimilar to *note BaseCGIHandler: 35ae, but designed for use with\nHTTP origin servers.  If you are writing an HTTP server\nimplementation, you will probably want to subclass this instead of\n*note BaseCGIHandler: 35ae.\n\nThis class is a subclass of *note BaseHandler: 1767.  It overrides\nthe 'init()', *note getstdin(): 35b1, *note getstderr():\n35b2, *note addcgivars(): 35b3, *note write(): 35b4, and *note\nflush(): 35b5. methods to support explicitly setting the\nenvironment and streams via the constructor.  The supplied\nenvironment and streams are stored in the 'stdin', 'stdout',\n'stderr', and 'environ' attributes.\n\nThe *note write(): b2a. method of 'stdout' should write each chunk\nin full, like *note io.BufferedIOBase: 460.\n\n-- Class: wsgiref.handlers.BaseHandler\n\nThis is an abstract base class for running WSGI applications.  Each\ninstance will handle a single HTTP request, although in principle\nyou could create a subclass that was reusable for multiple\nrequests.\n\n*note BaseHandler: 1767. instances have only one method intended\nfor external use:\n\n-- Method: run (app)\n\nRun the specified WSGI application, 'app'.\n\nAll of the other *note BaseHandler: 1767. methods are invoked by\nthis method in the process of running the application, and thus\nexist primarily to allow customizing the process.\n\nThe following methods MUST be overridden in a subclass:\n\n-- Method: write (data)\n\nBuffer the bytes 'data' for transmission to the client.  It's\nokay if this method actually transmits the data; *note\nBaseHandler: 1767. just separates write and flush operations\nfor greater efficiency when the underlying system actually has\nsuch a distinction.\n\n-- Method: flush ()\n\nForce buffered data to be transmitted to the client.  It's\nokay if this method is a no-op (i.e., if *note write(): 35b4.\nactually sends the data).\n\n-- Method: getstdin ()\n\nReturn an object compatible with *note InputStream: 35b7.\nsuitable for use as the 'wsgi.input' of the request currently\nbeing processed.\n\n-- Method: getstderr ()\n\nReturn an object compatible with *note ErrorStream: 35b8.\nsuitable for use as the 'wsgi.errors' of the request currently\nbeing processed.\n\n-- Method: addcgivars ()\n\nInsert CGI variables for the current request into the\n'environ' attribute.\n\nHere are some other methods and attributes you may wish to\noverride.  This list is only a summary, however, and does not\ninclude every method that can be overridden.  You should consult\nthe docstrings and source code for additional information before\nattempting to create a customized *note BaseHandler: 1767.\nsubclass.\n\nAttributes and methods for customizing the WSGI environment:\n\n-- Attribute: wsgimultithread\n\nThe value to be used for the 'wsgi.multithread' environment\nvariable.  It defaults to true in *note BaseHandler: 1767, but\nmay have a different default (or be set by the constructor) in\nthe other subclasses.\n\n-- Attribute: wsgimultiprocess\n\nThe value to be used for the 'wsgi.multiprocess' environment\nvariable.  It defaults to true in *note BaseHandler: 1767, but\nmay have a different default (or be set by the constructor) in\nthe other subclasses.\n\n-- Attribute: wsgirunonce\n\nThe value to be used for the 'wsgi.runonce' environment\nvariable.  It defaults to false in *note BaseHandler: 1767,\nbut *note CGIHandler: 35ad. sets it to true by default.\n\n-- Attribute: osenviron\n\nThe default environment variables to be included in every\nrequest's WSGI environment.  By default, this is a copy of\n'os.environ' at the time that *note wsgiref.handlers: 114. was\nimported, but subclasses can either create their own at the\nclass or instance level.  Note that the dictionary should be\nconsidered read-only, since the default value is shared\nbetween multiple classes and instances.\n\n-- Attribute: serversoftware\n\nIf the *note originserver: 35be. attribute is set, this\nattribute's value is used to set the default 'SERVERSOFTWARE'\nWSGI environment variable, and also to set a default 'Server:'\nheader in HTTP responses.  It is ignored for handlers (such as\n*note BaseCGIHandler: 35ae. and *note CGIHandler: 35ad.) that\nare not HTTP origin servers.\n\nChanged in version 3.3: The term \"Python\" is replaced with\nimplementation specific term like \"CPython\", \"Jython\" etc.\n\n-- Method: getscheme ()\n\nReturn the URL scheme being used for the current request.  The\ndefault implementation uses the 'guessscheme()' function from\n*note wsgiref.util: 118. to guess whether the scheme should be\n\"http\" or \"https\", based on the current request's 'environ'\nvariables.\n\n-- Method: setupenviron ()\n\nSet the 'environ' attribute to a fully populated WSGI\nenvironment.  The default implementation uses all of the above\nmethods and attributes, plus the *note getstdin(): 35b1,\n*note getstderr(): 35b2, and *note addcgivars(): 35b3.\nmethods and the *note wsgifilewrapper: 35c1. attribute.  It\nalso inserts a 'SERVERSOFTWARE' key if not present, as long\nas the *note originserver: 35be. attribute is a true value\nand the *note serversoftware: 35bd. attribute is set.\n\nMethods and attributes for customizing exception handling:\n\n-- Method: logexception (excinfo)\n\nLog the 'excinfo' tuple in the server log.  'excinfo' is a\n'(type, value, traceback)' tuple.  The default implementation\nsimply writes the traceback to the request's 'wsgi.errors'\nstream and flushes it.  Subclasses can override this method to\nchange the format or retarget the output, mail the traceback\nto an administrator, or whatever other action may be deemed\nsuitable.\n\n-- Attribute: tracebacklimit\n\nThe maximum number of frames to include in tracebacks output\nby the default *note logexception(): 35c2. method.  If\n'None', all frames are included.\n\n-- Method: erroroutput (environ, startresponse)\n\nThis method is a WSGI application to generate an error page\nfor the user.  It is only invoked if an error occurs before\nheaders are sent to the client.\n\nThis method can access the current error using\n'sys.exception()', and should pass that information to\n'startresponse' when calling it (as described in the \"Error\nHandling\" section of PEP 3333(1)).\n\nThe default implementation just uses the *note errorstatus:\n35c5, *note errorheaders: 35c6, and *note errorbody: 35c7.\nattributes to generate an output page.  Subclasses can\noverride this to produce more dynamic error output.\n\nNote, however, that it's not recommended from a security\nperspective to spit out diagnostics to any old user; ideally,\nyou should have to do something special to enable diagnostic\noutput, which is why the default implementation doesn't\ninclude any.\n\n-- Attribute: errorstatus\n\nThe HTTP status used for error responses.  This should be a\nstatus string as defined in PEP 3333(2); it defaults to a 500\ncode and message.\n\n-- Attribute: errorheaders\n\nThe HTTP headers used for error responses.  This should be a\nlist of WSGI response headers ('(name, value)' tuples), as\ndescribed in PEP 3333(3).  The default list just sets the\ncontent type to 'text/plain'.\n\n-- Attribute: errorbody\n\nThe error response body.  This should be an HTTP response body\nbytestring.  It defaults to the plain text, \"A server error\noccurred.  Please contact the administrator.\"\n\nMethods and attributes for PEP 3333(4)'s \"Optional\nPlatform-Specific File Handling\" feature:\n\n-- Attribute: wsgifilewrapper\n\nA 'wsgi.filewrapper' factory, compatible with *note\nwsgiref.types.FileWrapper: 359b, or 'None'.  The default value\nof this attribute is the *note wsgiref.util.FileWrapper: 51a.\nclass.\n\n-- Method: sendfile ()\n\nOverride to implement platform-specific file transmission.\nThis method is called only if the application's return value\nis an instance of the class specified by the *note\nwsgifilewrapper: 35c1. attribute.  It should return a true\nvalue if it was able to successfully transmit the file, so\nthat the default transmission code will not be executed.  The\ndefault implementation of this method just returns a false\nvalue.\n\nMiscellaneous methods and attributes:\n\n-- Attribute: originserver\n\nThis attribute should be set to a true value if the handler's\n*note write(): 35b4. and *note flush(): 35b5. are being used\nto communicate directly to the client, rather than via a\nCGI-like gateway protocol that wants the HTTP status in a\nspecial 'Status:' header.\n\nThis attribute's default value is true in *note BaseHandler:\n1767, but false in *note BaseCGIHandler: 35ae. and *note\nCGIHandler: 35ad.\n\n-- Attribute: httpversion\n\nIf *note originserver: 35be. is true, this string attribute\nis used to set the HTTP version of the response set to the\nclient.  It defaults to '\"1.0\"'.\n\n-- Function: wsgiref.handlers.readenviron ()\n\nTranscode CGI variables from 'os.environ' to PEP 3333(5) \"bytes in\nunicode\" strings, returning a new dictionary.  This function is\nused by *note CGIHandler: 35ad. and *note IISCGIHandler: 35af. in\nplace of directly using 'os.environ', which is not necessarily\nWSGI-compliant on all platforms and web servers using Python 3 -\nspecifically, ones where the OS's actual environment is Unicode\n(i.e.  Windows), or ones where the environment is bytes, but the\nsystem encoding used by Python to decode it is anything other than\nISO-8859-1 (e.g.  Unix systems using UTF-8).\n\nIf you are implementing a CGI-based handler of your own, you\nprobably want to use this routine instead of just copying values\nout of 'os.environ' directly.\n\nNew in version 3.2.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3333/\n\n(2) https://peps.python.org/pep-3333/\n\n(3) https://peps.python.org/pep-3333/\n\n(4) https://peps.python.org/pep-3333/\n\n(5) https://peps.python.org/pep-3333/\n\nFile: python3.12.info,  Node: wsgiref types - WSGI types for static type checking,  Next: Examples<24>,  Prev: wsgiref handlers - server/gateway base classes,  Up: wsgiref -- WSGI Utilities and Reference Implementation\n\n5.21.2.6 'wsgiref.types' - WSGI types for static type checking\n..............................................................\n",
            "subsections": []
        },
        "This module provides various types for static type checking as described": {
            "content": "in PEP 3333(1).\n\nNew in version 3.11.\n\n-- Class: wsgiref.types.StartResponse\n\nA *note typing.Protocol: 47e. describing startresponse()(2)\ncallables ( PEP 3333(3)).\n\n-- Data: wsgiref.types.WSGIEnvironment\n\nA type alias describing a WSGI environment dictionary.\n\n-- Data: wsgiref.types.WSGIApplication\n\nA type alias describing a WSGI application callable.\n\n-- Class: wsgiref.types.InputStream\n\nA *note typing.Protocol: 47e. describing a WSGI Input Stream(4).\n\n-- Class: wsgiref.types.ErrorStream\n\nA *note typing.Protocol: 47e. describing a WSGI Error Stream(5).\n\n-- Class: wsgiref.types.FileWrapper\n\nA *note typing.Protocol: 47e. describing a file wrapper(6).  See\n*note wsgiref.util.FileWrapper: 51a. for a concrete implementation\nof this protocol.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3333/\n\n(2) https://peps.python.org/pep-3333/#the-start-response-callable\n\n(3) https://peps.python.org/pep-3333/\n\n(4) https://peps.python.org/pep-3333/#input-and-error-streams\n\n(5) https://peps.python.org/pep-3333/#input-and-error-streams\n\n(6)\nhttps://peps.python.org/pep-3333/#optional-platform-specific-file-handling\n\nFile: python3.12.info,  Node: Examples<24>,  Prev: wsgiref types - WSGI types for static type checking,  Up: wsgiref -- WSGI Utilities and Reference Implementation\n\n5.21.2.7 Examples\n.................\n\nThis is a working \"Hello World\" WSGI application:\n\n\"\"\"\nEvery WSGI application must have an application object - a callable\nobject that accepts two arguments. For that purpose, we're going to\nuse a function (note that you're not limited to a function, you can\nuse a class for example). The first argument passed to the function\nis a dictionary containing CGI-style environment variables and the\nsecond variable is the callable object.\n\"\"\"\nfrom wsgiref.simpleserver import makeserver\n\n\ndef helloworldapp(environ, startresponse):\nstatus = \"200 OK\"  # HTTP Status\nheaders = [(\"Content-type\", \"text/plain; charset=utf-8\")]  # HTTP Headers\nstartresponse(status, headers)\n\n# The returned object is going to be printed\nreturn [b\"Hello World\"]\n\nwith makeserver(\"\", 8000, helloworldapp) as httpd:\nprint(\"Serving on port 8000...\")\n\n# Serve until process is killed\nhttpd.serveforever()\n",
            "subsections": []
        },
        "Example of a WSGI application serving the current directory, accept": {
            "content": "optional directory and port number (default: 8000) on the command line:\n\n\"\"\"\nSmall wsgiref based web server. Takes a path to serve from and an\noptional port number (defaults to 8000), then tries to serve files.\nMIME types are guessed from the file names, 404 errors are raised\nif the file is not found.\n\"\"\"\nimport mimetypes\nimport os\nimport sys\nfrom wsgiref import simpleserver, util\n\n\ndef app(environ, respond):\n# Get the file name and MIME type\nfn = os.path.join(path, environ[\"PATHINFO\"][1:])\nif \".\" not in fn.split(os.path.sep)[-1]:\nfn = os.path.join(fn, \"index.html\")\nmimetype = mimetypes.guesstype(fn)[0]\n\n# Return 200 OK if file exists, otherwise 404 Not Found\nif os.path.exists(fn):\nrespond(\"200 OK\", [(\"Content-Type\", mimetype)])\nreturn util.FileWrapper(open(fn, \"rb\"))\nelse:\nrespond(\"404 Not Found\", [(\"Content-Type\", \"text/plain\")])\nreturn [b\"not found\"]\n\n\nif name == \"main\":\n# Get the path and port from command-line arguments\npath = sys.argv[1] if len(sys.argv) > 1 else os.getcwd()\nport = int(sys.argv[2]) if len(sys.argv) > 2 else 8000\n\n# Make and start the server until control-c\nhttpd = simpleserver.makeserver(\"\", port, app)\nprint(f\"Serving {path} on port {port}, control-C to stop\")\ntry:\nhttpd.serveforever()\nexcept KeyboardInterrupt:\nprint(\"Shutting down.\")\nhttpd.serverclose()\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "'Source code:' Lib/urllib/(1)\n\n\n\n'urllib' is a package that collects several modules for working with\nURLs:\n\n* *note urllib.request: 106. for opening and reading URLs\n\n* *note urllib.error: 104. containing the exceptions raised by *note\nurllib.request: 106.\n\n* *note urllib.parse: 105. for parsing URLs\n\n* *note urllib.robotparser: 108. for parsing 'robots.txt' files\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/urllib/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "'Source code:' Lib/urllib/request.py(1)\n\n\n\nThe *note urllib.request: 106. module defines functions and classes\nwhich help in opening URLs (mostly HTTP) in a complex world -- basic and\ndigest authentication, redirections, cookies and more.\n\nSee also\n........\n",
            "subsections": []
        },
        "The Requests package(2) is recommended for a higher-level HTTP client": {
            "content": "interface.\n\nNote: HTTPS support is only available if Python was compiled with\nSSL support (through the *note ssl: ca. module).\n\n*note Availability: 1ad3.: not Emscripten, not WASI.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Request Objects,  Next: OpenerDirector Objects,  Up: urllib request -- Extensible library for opening URLs": {
            "content": "5.21.4.1 Request Objects\n........................\n\nThe following methods describe *note Request: e4b.'s public interface,\nand so all may be overridden in subclasses.  It also defines several\npublic attributes that can be used by clients to inspect the parsed\nrequest.\n\n-- Attribute: Request.fullurl\n\nThe original URL passed to the constructor.\n\nChanged in version 3.4.\n\nRequest.fullurl is a property with setter, getter and a deleter.\nGetting *note fullurl: e4d. returns the original request URL with\nthe fragment, if it was present.\n\n-- Attribute: Request.type\n\nThe URI scheme.\n\n-- Attribute: Request.host\n\nThe URI authority, typically a host, but may also contain a port\nseparated by a colon.\n\n-- Attribute: Request.originreqhost\n\nThe original host for the request, without port.\n\n-- Attribute: Request.selector\n\nThe URI path.  If the *note Request: e4b. uses a proxy, then\nselector will be the full URL that is passed to the proxy.\n\n-- Attribute: Request.data\n\nThe entity body for the request, or 'None' if not specified.\n\nChanged in version 3.4: Changing value of *note Request.data: e4e.\nnow deletes \"Content-Length\" header if it was previously set or\ncalculated.\n\n-- Attribute: Request.unverifiable\n\nboolean, indicates whether the request is unverifiable as defined\nby RFC 2965(1).\n\n-- Attribute: Request.method\n\nThe HTTP request method to use.  By default its value is *note\nNone: 43f, which means that *note getmethod(): fde. will do its\nnormal computation of the method to be used.  Its value can be set\n(thus overriding the default computation in *note getmethod():\nfde.) either by providing a default value by setting it at the\nclass level in a *note Request: e4b. subclass, or by passing a\nvalue in to the *note Request: e4b. constructor via the 'method'\nargument.\n\nNew in version 3.3.\n\nChanged in version 3.4: A default value can now be set in\nsubclasses; previously it could only be set via the constructor\nargument.\n\n-- Method: Request.getmethod ()\n\nReturn a string indicating the HTTP request method.  If *note\nRequest.method: e4c. is not 'None', return its value, otherwise\nreturn ''GET'' if *note Request.data: e4e. is 'None', or ''POST''\nif it's not.  This is only meaningful for HTTP requests.\n\nChanged in version 3.3: getmethod now looks at the value of *note\nRequest.method: e4c.\n\n-- Method: Request.addheader (key, val)\n\nAdd another header to the request.  Headers are currently ignored\nby all handlers except HTTP handlers, where they are added to the\nlist of headers sent to the server.  Note that there cannot be more\nthan one header with the same name, and later calls will overwrite\nprevious calls in case the 'key' collides.  Currently, this is no\nloss of HTTP functionality, since all headers which have meaning\nwhen used more than once have a (header-specific) way of gaining\nthe same functionality using only one header.  Note that headers\nadded using this method are also added to redirected requests.\n\n-- Method: Request.addunredirectedheader (key, header)\n\nAdd a header that will not be added to a redirected request.\n\n-- Method: Request.hasheader (header)\n\nReturn whether the instance has the named header (checks both\nregular and unredirected).\n\n-- Method: Request.removeheader (header)\n\nRemove named header from the request instance (both from regular\nand unredirected headers).\n\nNew in version 3.4.\n\n-- Method: Request.getfullurl ()\n\nReturn the URL given in the constructor.\n\nChanged in version 3.4.\n\nReturns *note Request.fullurl: e4d.\n\n-- Method: Request.setproxy (host, type)\n\nPrepare the request by connecting to a proxy server.  The 'host'\nand 'type' will replace those of the instance, and the instance's\nselector will be the original URL given in the constructor.\n\n-- Method: Request.getheader (headername, default=None)\n\nReturn the value of the given header.  If the header is not\npresent, return the default value.\n\n-- Method: Request.headeritems ()\n\nReturn a list of tuples (headername, headervalue) of the Request\nheaders.\n",
            "subsections": []
        },
        "Changed in version 3.4: The request methods adddata, hasdata,": {
            "content": "getdata, gettype, gethost, getselector, getoriginreqhost and\nisunverifiable that were deprecated since 3.3 have been removed.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc2965.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: OpenerDirector Objects,  Next: BaseHandler Objects,  Prev: Request Objects,  Up: urllib request -- Extensible library for opening URLs": {
            "content": "5.21.4.2 OpenerDirector Objects\n...............................\n\n*note OpenerDirector: 35d7. instances have the following methods:\n\n-- Method: OpenerDirector.addhandler (handler)\n\n'handler' should be an instance of *note BaseHandler: 35db.  The\nfollowing methods are searched, and added to the possible chains\n(note that HTTP errors are a special case).  Note that, in the\nfollowing, 'protocol' should be replaced with the actual protocol\nto handle, for example 'httpresponse()' would be the HTTP protocol\nresponse handler.  Also 'type' should be replaced with the actual\nHTTP code, for example 'httperror404()' would handle HTTP 404\nerrors.\n\n* '<protocol>open()' -- signal that the handler knows how to\nopen 'protocol' URLs.\n\nSee *note BaseHandler.<protocol>open(): 35fe. for more\ninformation.\n\n* 'httperror<type>()' -- signal that the handler knows how to\nhandle HTTP errors with HTTP error code 'type'.\n\nSee *note BaseHandler.httperror<nnn>(): 35ff. for more\ninformation.\n\n* '<protocol>error()' -- signal that the handler knows how to\nhandle errors from (non-'http') 'protocol'.\n\n* '<protocol>request()' -- signal that the handler knows how to\npre-process 'protocol' requests.\n\nSee *note BaseHandler.<protocol>request(): 3600. for more\ninformation.\n\n* '<protocol>response()' -- signal that the handler knows how to\npost-process 'protocol' responses.\n\nSee *note BaseHandler.<protocol>response(): 3601. for more\ninformation.\n\n-- Method: OpenerDirector.open (url, data=None[, timeout])\n\nOpen the given 'url' (which can be a request object or a string),\noptionally passing the given 'data'.  Arguments, return values and\nexceptions raised are the same as those of *note urlopen(): cf9.\n(which simply calls the *note open(): 26e. method on the currently\ninstalled global *note OpenerDirector: 35d7.).  The optional\n'timeout' parameter specifies a timeout in seconds for blocking\noperations like the connection attempt (if not specified, the\nglobal default timeout setting will be used).  The timeout feature\nactually works only for HTTP, HTTPS and FTP connections.\n\n-- Method: OpenerDirector.error (proto, *args)\n\nHandle an error of the given protocol.  This will call the\nregistered error handlers for the given protocol with the given\narguments (which are protocol specific).  The HTTP protocol is a\nspecial case which uses the HTTP response code to determine the\nspecific error handler; refer to the 'httperror<type>()' methods\nof the handler classes.\n\nReturn values and exceptions raised are the same as those of *note\nurlopen(): cf9.\n\nOpenerDirector objects open URLs in three stages:\n",
            "subsections": []
        },
        "The order in which these methods are called within each stage is": {
            "content": "determined by sorting the handler instances.\n\n1. Every handler with a method named like '<protocol>request()' has\nthat method called to pre-process the request.\n\n2. Handlers with a method named like '<protocol>open()' are called to\nhandle the request.  This stage ends when a handler either returns\na non-*note None: 43f. value (ie.  a response), or raises an\nexception (usually *note URLError: 35d6.).  Exceptions are allowed\nto propagate.\n\nIn fact, the above algorithm is first tried for methods named *note\ndefaultopen(): 3603.  If all such methods return *note None: 43f,\nthe algorithm is repeated for methods named like\n'<protocol>open()'.  If all such methods return *note None: 43f,\nthe algorithm is repeated for methods named *note unknownopen():\n3604.\n\nNote that the implementation of these methods may involve calls of\nthe parent *note OpenerDirector: 35d7. instance's *note open():\ne4f. and *note error(): 3602. methods.\n\n3. Every handler with a method named like '<protocol>response()' has\nthat method called to post-process the response.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: BaseHandler Objects,  Next: HTTPRedirectHandler Objects,  Prev: OpenerDirector Objects,  Up: urllib request -- Extensible library for opening URLs": {
            "content": "5.21.4.3 BaseHandler Objects\n............................\n\n*note BaseHandler: 35db. objects provide a couple of methods that are\ndirectly useful, and others that are meant to be used by derived\nclasses.  These are intended for direct use:\n\n-- Method: BaseHandler.addparent (director)\n\nAdd a director as parent.\n\n-- Method: BaseHandler.close ()\n\nRemove any parents.\n",
            "subsections": []
        },
        "The following attribute and methods should only be used by classes": {
            "content": "derived from *note BaseHandler: 35db.\n\nNote: The convention has been adopted that subclasses defining\n'<protocol>request()' or '<protocol>response()' methods are named\n'*Processor'; all others are named '*Handler'.\n\n-- Attribute: BaseHandler.parent\n\nA valid *note OpenerDirector: 35d7, which can be used to open using\na different protocol, or handle errors.\n\n-- Method: BaseHandler.defaultopen (req)\n\nThis method is 'not' defined in *note BaseHandler: 35db, but\nsubclasses should define it if they want to catch all URLs.\n\nThis method, if implemented, will be called by the parent *note\nOpenerDirector: 35d7.  It should return a file-like object as\ndescribed in the return value of the *note open(): e4f. method of\n*note OpenerDirector: 35d7, or 'None'.  It should raise *note\nURLError: 35d6, unless a truly exceptional thing happens (for\nexample, *note MemoryError: 13e3. should not be mapped to *note\nURLError: 35d6.).\n\nThis method will be called before any protocol-specific open\nmethod.\n\n-- Method: BaseHandler.<protocol>open(req)\n\nThis method is 'not' defined in *note BaseHandler: 35db, but\nsubclasses should define it if they want to handle URLs with the\ngiven protocol.\n\nThis method, if defined, will be called by the parent *note\nOpenerDirector: 35d7.  Return values should be the same as for\n*note defaultopen(): 3603.\n\n-- Method: BaseHandler.unknownopen (req)\n\nThis method is 'not' defined in *note BaseHandler: 35db, but\nsubclasses should define it if they want to catch all URLs with no\nspecific registered handler to open it.\n\nThis method, if implemented, will be called by the *note parent:\n3609. *note OpenerDirector: 35d7.  Return values should be the same\nas for *note defaultopen(): 3603.\n\n-- Method: BaseHandler.httperrordefault (req, fp, code, msg, hdrs)\n\nThis method is 'not' defined in *note BaseHandler: 35db, but\nsubclasses should override it if they intend to provide a catch-all\nfor otherwise unhandled HTTP errors.  It will be called\nautomatically by the *note OpenerDirector: 35d7. getting the error,\nand should not normally be called in other circumstances.\n\n'req' will be a *note Request: e4b. object, 'fp' will be a\nfile-like object with the HTTP error body, 'code' will be the\nthree-digit code of the error, 'msg' will be the user-visible\nexplanation of the code and 'hdrs' will be a mapping object with\nthe headers of the error.\n\nReturn values and exceptions raised should be the same as those of\n*note urlopen(): cf9.\n\n-- Method: BaseHandler.httperror<nnn>(req, fp, code, msg, hdrs)\n\n'nnn' should be a three-digit HTTP error code.  This method is also\nnot defined in *note BaseHandler: 35db, but will be called, if it\nexists, on an instance of a subclass, when an HTTP error with code\n'nnn' occurs.\n\nSubclasses should override this method to handle specific HTTP\nerrors.\n\nArguments, return values and exceptions raised should be the same\nas for *note httperrordefault(): 360a.\n\n-- Method: BaseHandler.<protocol>request(req)\n\nThis method is 'not' defined in *note BaseHandler: 35db, but\nsubclasses should define it if they want to pre-process requests of\nthe given protocol.\n\nThis method, if defined, will be called by the parent *note\nOpenerDirector: 35d7.  'req' will be a *note Request: e4b. object.\nThe return value should be a *note Request: e4b. object.\n\n-- Method: BaseHandler.<protocol>response(req, response)\n\nThis method is 'not' defined in *note BaseHandler: 35db, but\nsubclasses should define it if they want to post-process responses\nof the given protocol.\n\nThis method, if defined, will be called by the parent *note\nOpenerDirector: 35d7.  'req' will be a *note Request: e4b. object.\n'response' will be an object implementing the same interface as the\nreturn value of *note urlopen(): cf9.  The return value should\nimplement the same interface as the return value of *note\nurlopen(): cf9.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: HTTPRedirectHandler Objects,  Next: HTTPCookieProcessor Objects,  Prev: BaseHandler Objects,  Up: urllib request -- Extensible library for opening URLs": {
            "content": "5.21.4.4 HTTPRedirectHandler Objects\n....................................\n\nNote: Some HTTP redirections require action from this module's\nclient code.  If this is the case, *note HTTPError: e51. is raised.\nSee RFC 2616(1) for details of the precise meanings of the various\nredirection codes.\n\nAn *note HTTPError: e51. exception raised as a security\nconsideration if the HTTPRedirectHandler is presented with a\nredirected URL which is not an HTTP, HTTPS or FTP URL.\n\n-- Method: HTTPRedirectHandler.redirectrequest (req, fp, code, msg,\nhdrs, newurl)\n\nReturn a *note Request: e4b. or 'None' in response to a redirect.\nThis is called by the default implementations of the\n'httperror30*()' methods when a redirection is received from the\nserver.  If a redirection should take place, return a new *note\nRequest: e4b. to allow 'httperror30*()' to perform the redirect\nto 'newurl'.  Otherwise, raise *note HTTPError: e51. if no other\nhandler should try to handle this URL, or return 'None' if you\ncan't but another handler might.\n\nNote: The default implementation of this method does not\nstrictly follow RFC 2616(2), which says that 301 and 302\nresponses to 'POST' requests must not be automatically\nredirected without confirmation by the user.  In reality,\nbrowsers do allow automatic redirection of these responses,\nchanging the POST to a 'GET', and the default implementation\nreproduces this behavior.\n\n-- Method: HTTPRedirectHandler.httperror301 (req, fp, code, msg,\nhdrs)\n\nRedirect to the 'Location:' or 'URI:' URL. This method is called by\nthe parent *note OpenerDirector: 35d7. when getting an HTTP 'moved\npermanently' response.\n\n-- Method: HTTPRedirectHandler.httperror302 (req, fp, code, msg,\nhdrs)\n\nThe same as *note httperror301(): 360e, but called for the\n'found' response.\n\n-- Method: HTTPRedirectHandler.httperror303 (req, fp, code, msg,\nhdrs)\n\nThe same as *note httperror301(): 360e, but called for the 'see\nother' response.\n\n-- Method: HTTPRedirectHandler.httperror307 (req, fp, code, msg,\nhdrs)\n\nThe same as *note httperror301(): 360e, but called for the\n'temporary redirect' response.  It does not allow changing the\nrequest method from 'POST' to 'GET'.\n\n-- Method: HTTPRedirectHandler.httperror308 (req, fp, code, msg,\nhdrs)\n\nThe same as *note httperror301(): 360e, but called for the\n'permanent redirect' response.  It does not allow changing the\nrequest method from 'POST' to 'GET'.\n\nNew in version 3.11.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc2616.html\n\n(2) https://datatracker.ietf.org/doc/html/rfc2616.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: HTTPCookieProcessor Objects,  Next: ProxyHandler Objects,  Prev: HTTPRedirectHandler Objects,  Up: urllib request -- Extensible library for opening URLs": {
            "content": "5.21.4.5 HTTPCookieProcessor Objects\n....................................\n\n*note HTTPCookieProcessor: 35e5. instances have one attribute:\n\n-- Attribute: HTTPCookieProcessor.cookiejar\n\nThe *note http.cookiejar.CookieJar: 3616. in which cookies are\nstored.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ProxyHandler Objects,  Next: HTTPPasswordMgr Objects,  Prev: HTTPCookieProcessor Objects,  Up: urllib request -- Extensible library for opening URLs": {
            "content": "5.21.4.6 ProxyHandler Objects\n.............................\n\n-- Method: ProxyHandler.<protocol>open(request)\n\nThe *note ProxyHandler: 1742. will have a method\n'<protocol>open()' for every 'protocol' which has a proxy in the\n'proxies' dictionary given in the constructor.  The method will\nmodify requests to go through the proxy, by calling\n'request.setproxy()', and call the next handler in the chain to\nactually execute the protocol.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: HTTPPasswordMgr Objects,  Next: HTTPPasswordMgrWithPriorAuth Objects,  Prev: ProxyHandler Objects,  Up: urllib request -- Extensible library for opening URLs": {
            "content": "5.21.4.7 HTTPPasswordMgr Objects\n................................\n\nThese methods are available on *note HTTPPasswordMgr: 35e6. and *note\nHTTPPasswordMgrWithDefaultRealm: 35e7. objects.\n\n-- Method: HTTPPasswordMgr.addpassword (realm, uri, user, passwd)\n\n'uri' can be either a single URI, or a sequence of URIs.  'realm',\n'user' and 'passwd' must be strings.  This causes '(user, passwd)'\nto be used as authentication tokens when authentication for 'realm'\nand a super-URI of any of the given URIs is given.\n\n-- Method: HTTPPasswordMgr.finduserpassword (realm, authuri)\n\nGet user/password for given realm and URI, if any.  This method\nwill return '(None, None)' if there is no matching user/password.\n\nFor *note HTTPPasswordMgrWithDefaultRealm: 35e7. objects, the realm\n'None' will be searched if the given 'realm' has no matching\nuser/password.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: HTTPPasswordMgrWithPriorAuth Objects,  Next: AbstractBasicAuthHandler Objects,  Prev: HTTPPasswordMgr Objects,  Up: urllib request -- Extensible library for opening URLs": {
            "content": "5.21.4.8 HTTPPasswordMgrWithPriorAuth Objects\n.............................................\n\nThis password manager extends *note HTTPPasswordMgrWithDefaultRealm:\n35e7. to support tracking URIs for which authentication credentials\nshould always be sent.\n\n-- Method: HTTPPasswordMgrWithPriorAuth.addpassword (realm, uri, user,\npasswd, isauthenticated=False)\n\n'realm', 'uri', 'user', 'passwd' are as for *note\nHTTPPasswordMgr.addpassword(): 361a.  'isauthenticated' sets the\ninitial value of the 'isauthenticated' flag for the given URI or\nlist of URIs.  If 'isauthenticated' is specified as 'True',\n'realm' is ignored.\n\n-- Method: HTTPPasswordMgrWithPriorAuth.finduserpassword (realm,\nauthuri)\n\nSame as for *note HTTPPasswordMgrWithDefaultRealm: 35e7. objects\n\n-- Method: HTTPPasswordMgrWithPriorAuth.updateauthenticated (self,\nuri, isauthenticated=False)\n\nUpdate the 'isauthenticated' flag for the given 'uri' or list of\nURIs.\n\n-- Method: HTTPPasswordMgrWithPriorAuth.isauthenticated (self,\nauthuri)\n\nReturns the current state of the 'isauthenticated' flag for the\ngiven URI.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: AbstractBasicAuthHandler Objects,  Next: HTTPBasicAuthHandler Objects,  Prev: HTTPPasswordMgrWithPriorAuth Objects,  Up: urllib request -- Extensible library for opening URLs": {
            "content": "5.21.4.9 AbstractBasicAuthHandler Objects\n.........................................\n\n-- Method: AbstractBasicAuthHandler.httperrorauthreqed (authreq,\nhost, req, headers)\n\nHandle an authentication request by getting a user/password pair,\nand re-trying the request.  'authreq' should be the name of the\nheader where the information about the realm is included in the\nrequest, 'host' specifies the URL and path to authenticate for,\n'req' should be the (failed) *note Request: e4b. object, and\n'headers' should be the error headers.\n\n'host' is either an authority (e.g.  '\"python.org\"') or a URL\ncontaining an authority component (e.g.  '\"http://python.org/\"').\nIn either case, the authority must not contain a userinfo component\n(so, '\"python.org\"' and '\"python.org:80\"' are fine,\n'\"joe:password@python.org\"' is not).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: HTTPBasicAuthHandler Objects,  Next: ProxyBasicAuthHandler Objects,  Prev: AbstractBasicAuthHandler Objects,  Up: urllib request -- Extensible library for opening URLs": {
            "content": "5.21.4.10 HTTPBasicAuthHandler Objects\n......................................\n\n-- Method: HTTPBasicAuthHandler.httperror401 (req, fp, code, msg,\nhdrs)\n\nRetry the request with authentication information, if available.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ProxyBasicAuthHandler Objects,  Next: AbstractDigestAuthHandler Objects,  Prev: HTTPBasicAuthHandler Objects,  Up: urllib request -- Extensible library for opening URLs": {
            "content": "5.21.4.11 ProxyBasicAuthHandler Objects\n.......................................\n\n-- Method: ProxyBasicAuthHandler.httperror407 (req, fp, code, msg,\nhdrs)\n\nRetry the request with authentication information, if available.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: AbstractDigestAuthHandler Objects,  Next: HTTPDigestAuthHandler Objects,  Prev: ProxyBasicAuthHandler Objects,  Up: urllib request -- Extensible library for opening URLs": {
            "content": "5.21.4.12 AbstractDigestAuthHandler Objects\n...........................................\n\n-- Method: AbstractDigestAuthHandler.httperrorauthreqed (authreq,\nhost, req, headers)\n\n'authreq' should be the name of the header where the information\nabout the realm is included in the request, 'host' should be the\nhost to authenticate to, 'req' should be the (failed) *note\nRequest: e4b. object, and 'headers' should be the error headers.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: HTTPDigestAuthHandler Objects,  Next: ProxyDigestAuthHandler Objects,  Prev: AbstractDigestAuthHandler Objects,  Up: urllib request -- Extensible library for opening URLs": {
            "content": "5.21.4.13 HTTPDigestAuthHandler Objects\n.......................................\n\n-- Method: HTTPDigestAuthHandler.httperror401 (req, fp, code, msg,\nhdrs)\n\nRetry the request with authentication information, if available.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ProxyDigestAuthHandler Objects,  Next: HTTPHandler Objects,  Prev: HTTPDigestAuthHandler Objects,  Up: urllib request -- Extensible library for opening URLs": {
            "content": "5.21.4.14 ProxyDigestAuthHandler Objects\n........................................\n\n-- Method: ProxyDigestAuthHandler.httperror407 (req, fp, code, msg,\nhdrs)\n\nRetry the request with authentication information, if available.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: HTTPHandler Objects,  Next: HTTPSHandler Objects,  Prev: ProxyDigestAuthHandler Objects,  Up: urllib request -- Extensible library for opening URLs": {
            "content": "5.21.4.15 HTTPHandler Objects\n.............................\n\n-- Method: HTTPHandler.httpopen (req)\n\nSend an HTTP request, which can be either GET or POST, depending on\n'req.hasdata()'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: HTTPSHandler Objects,  Next: FileHandler Objects,  Prev: HTTPHandler Objects,  Up: urllib request -- Extensible library for opening URLs": {
            "content": "5.21.4.16 HTTPSHandler Objects\n..............................\n\n-- Method: HTTPSHandler.httpsopen (req)\n\nSend an HTTPS request, which can be either GET or POST, depending\non 'req.hasdata()'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: FileHandler Objects,  Next: DataHandler Objects,  Prev: HTTPSHandler Objects,  Up: urllib request -- Extensible library for opening URLs": {
            "content": "5.21.4.17 FileHandler Objects\n.............................\n\n-- Method: FileHandler.fileopen (req)\n\nOpen the file locally, if there is no host name, or the host name\nis ''localhost''.\n\nChanged in version 3.2: This method is applicable only for local\nhostnames.  When a remote hostname is given, an *note URLError:\n35d6. is raised.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: DataHandler Objects,  Next: FTPHandler Objects,  Prev: FileHandler Objects,  Up: urllib request -- Extensible library for opening URLs": {
            "content": "5.21.4.18 DataHandler Objects\n.............................\n\n-- Method: DataHandler.dataopen (req)\n\nRead a data URL. This kind of URL contains the content encoded in\nthe URL itself.  The data URL syntax is specified in RFC 2397(1).\nThis implementation ignores white spaces in base64 encoded data\nURLs so the URL may be wrapped in whatever source file it comes\nfrom.  But even though some browsers don't mind about a missing\npadding at the end of a base64 encoded data URL, this\nimplementation will raise an *note ValueError: 183. in that case.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc2397.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: FTPHandler Objects,  Next: CacheFTPHandler Objects,  Prev: DataHandler Objects,  Up: urllib request -- Extensible library for opening URLs": {
            "content": "5.21.4.19 FTPHandler Objects\n............................\n\n-- Method: FTPHandler.ftpopen (req)\n\nOpen the FTP file indicated by 'req'.  The login is always done\nwith empty username and password.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: CacheFTPHandler Objects,  Next: UnknownHandler Objects,  Prev: FTPHandler Objects,  Up: urllib request -- Extensible library for opening URLs": {
            "content": "5.21.4.20 CacheFTPHandler Objects\n.................................\n\n*note CacheFTPHandler: 146d. objects are *note FTPHandler: 35df. objects\nwith the following additional methods:\n\n-- Method: CacheFTPHandler.setTimeout (t)\n\nSet timeout of connections to 't' seconds.\n\n-- Method: CacheFTPHandler.setMaxConns (m)\n\nSet maximum number of cached connections to 'm'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: UnknownHandler Objects,  Next: HTTPErrorProcessor Objects,  Prev: CacheFTPHandler Objects,  Up: urllib request -- Extensible library for opening URLs": {
            "content": "5.21.4.21 UnknownHandler Objects\n................................\n\n-- Method: UnknownHandler.unknownopen ()\n\nRaise a *note URLError: 35d6. exception.\n\nFile: python3.12.info,  Node: HTTPErrorProcessor Objects,  Next: Examples<25>,  Prev: UnknownHandler Objects,  Up: urllib request -- Extensible library for opening URLs\n\n5.21.4.22 HTTPErrorProcessor Objects\n....................................\n\n-- Method: HTTPErrorProcessor.httpresponse (request, response)\n\nProcess HTTP error responses.\n\nFor 200 error codes, the response object is returned immediately.\n\nFor non-200 error codes, this simply passes the job on to the\n'httperror<type>()' handler methods, via *note\nOpenerDirector.error(): 3602.  Eventually, *note\nHTTPDefaultErrorHandler: 35dd. will raise an *note HTTPError: e51.\nif no other handler handles the error.\n\n-- Method: HTTPErrorProcessor.httpsresponse (request, response)\n\nProcess HTTPS error responses.\n\nThe behavior is same as *note httpresponse(): 3649.\n\nFile: python3.12.info,  Node: Examples<25>,  Next: Legacy interface,  Prev: HTTPErrorProcessor Objects,  Up: urllib request -- Extensible library for opening URLs\n\n5.21.4.23 Examples\n..................\n\nIn addition to the examples below, more examples are given in *note\nHOWTO Fetch Internet Resources Using The urllib Package: 364d.\n",
            "subsections": []
        },
        "This example gets the python.org main page and displays the first 300": {
            "content": "bytes of it.\n\n>>> import urllib.request\n>>> with urllib.request.urlopen('http://www.python.org/') as f:\n...     print(f.read(300))\n...\nb'<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\\n\\n\\n<html\nxmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\\n\\n<head>\\n\n<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />\\n\n<title>Python Programming '\n",
            "subsections": []
        },
        "Note that urlopen returns a bytes object.  This is because there is no": {
            "content": "way for urlopen to automatically determine the encoding of the byte\nstream it receives from the HTTP server.  In general, a program will\ndecode the returned bytes object to string once it determines or guesses\nthe appropriate encoding.\n",
            "subsections": []
        },
        "The following W3C document,": {
            "content": "'https://www.w3.org/International/O-charset', lists the various ways in\nwhich an (X)HTML or an XML document could have specified its encoding\ninformation.\n",
            "subsections": []
        },
        "As the python.org website uses 'utf-8' encoding as specified in its meta": {
            "content": "tag, we will use the same for decoding the bytes object.\n\n>>> with urllib.request.urlopen('http://www.python.org/') as f:\n...     print(f.read(100).decode('utf-8'))\n...\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n\"http://www.w3.org/TR/xhtml1/DTD/xhtm\n\nIt is also possible to achieve the same result without using the *note\ncontext manager: 398. approach.\n\n>>> import urllib.request\n>>> f = urllib.request.urlopen('http://www.python.org/')\n>>> print(f.read(100).decode('utf-8'))\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n\"http://www.w3.org/TR/xhtml1/DTD/xhtm\n",
            "subsections": []
        },
        "In the following example, we are sending a data-stream to the stdin of a": {
            "content": "CGI and reading the data it returns to us.  Note that this example will\nonly work when the Python installation supports SSL.\n\n>>> import urllib.request\n>>> req = urllib.request.Request(url='https://localhost/cgi-bin/test.cgi',\n...                       data=b'This data is passed to stdin of the CGI')\n>>> with urllib.request.urlopen(req) as f:\n...     print(f.read().decode('utf-8'))\n...\nGot Data: \"This data is passed to stdin of the CGI\"\n\nThe code for the sample CGI used in the above example is:\n\n#!/usr/bin/env python\nimport sys\ndata = sys.stdin.read()\nprint('Content-type: text/plain\\n\\nGot Data: \"%s\"' % data)\n\nHere is an example of doing a 'PUT' request using *note Request: e4b.:\n\nimport urllib.request\nDATA = b'some data'\nreq = urllib.request.Request(url='http://localhost:8080', data=DATA, method='PUT')\nwith urllib.request.urlopen(req) as f:\npass\nprint(f.status)\nprint(f.reason)\n\nUse of Basic HTTP Authentication:\n\nimport urllib.request\n# Create an OpenerDirector with support for Basic HTTP Authentication...\nauthhandler = urllib.request.HTTPBasicAuthHandler()\nauthhandler.addpassword(realm='PDQ Application',\nuri='https://mahler:8092/site-updates.py',\nuser='klem',\npasswd='kadidd!ehopper')\nopener = urllib.request.buildopener(authhandler)\n# ...and install it globally so it can be used with urlopen.\nurllib.request.installopener(opener)\nurllib.request.urlopen('http://www.example.com/login.html')\n\n*note buildopener(): 35da. provides many handlers by default, including\na *note ProxyHandler: 1742.  By default, *note ProxyHandler: 1742. uses\nthe environment variables named '<scheme>proxy', where '<scheme>' is\nthe URL scheme involved.  For example, the 'httpproxy' environment\nvariable is read to obtain the HTTP proxy's URL.\n\nThis example replaces the default *note ProxyHandler: 1742. with one\nthat uses programmatically supplied proxy URLs, and adds proxy\nauthorization support with *note ProxyBasicAuthHandler: 35eb.\n\nproxyhandler = urllib.request.ProxyHandler({'http': 'http://www.example.com:3128/'})\nproxyauthhandler = urllib.request.ProxyBasicAuthHandler()\nproxyauthhandler.addpassword('realm', 'host', 'username', 'password')\n\nopener = urllib.request.buildopener(proxyhandler, proxyauthhandler)\n# This time, rather than install the OpenerDirector, we use it directly:\nopener.open('http://www.example.com/login.html')\n\nAdding HTTP headers:\n\nUse the 'headers' argument to the *note Request: e4b. constructor, or:\n\nimport urllib.request\nreq = urllib.request.Request('http://www.example.com/')\nreq.addheader('Referer', 'http://www.python.org/')\n# Customize the default User-Agent header value:\nreq.addheader('User-Agent', 'urllib-example/0.1 (Contact: . . .)')\nr = urllib.request.urlopen(req)\n\n*note OpenerDirector: 35d7. automatically adds a 'User-Agent' header to\nevery *note Request: e4b.  To change this:\n\nimport urllib.request\nopener = urllib.request.buildopener()\nopener.addheaders = [('User-agent', 'Mozilla/5.0')]\nopener.open('http://www.example.com/')\n",
            "subsections": []
        },
        "Also, remember that a few standard headers ('Content-Length',": {
            "content": "'Content-Type' and 'Host') are added when the *note Request: e4b. is\npassed to *note urlopen(): cf9. (or *note OpenerDirector.open(): e4f.).",
            "subsections": []
        },
        "Here is an example session that uses the 'GET' method to retrieve a URL": {
            "content": "containing parameters:\n\n>>> import urllib.request\n>>> import urllib.parse\n>>> params = urllib.parse.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})\n>>> url = \"http://www.musi-cal.com/cgi-bin/query?%s\" % params\n>>> with urllib.request.urlopen(url) as f:\n...     print(f.read().decode('utf-8'))\n...\n",
            "subsections": []
        },
        "The following example uses the 'POST' method instead.  Note that params": {
            "content": "output from urlencode is encoded to bytes before it is sent to urlopen\nas data:\n\n>>> import urllib.request\n>>> import urllib.parse\n>>> data = urllib.parse.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})\n>>> data = data.encode('ascii')\n>>> with urllib.request.urlopen(\"http://requestb.in/xrbl82xr\", data) as f:\n...     print(f.read().decode('utf-8'))\n...\n",
            "subsections": []
        },
        "The following example uses an explicitly specified HTTP proxy,": {
            "content": "overriding environment settings:\n\n>>> import urllib.request\n>>> proxies = {'http': 'http://proxy.example.com:8080/'}\n>>> opener = urllib.request.FancyURLopener(proxies)\n>>> with opener.open(\"http://www.python.org\") as f:\n...     f.read().decode('utf-8')\n...\n",
            "subsections": []
        },
        "The following example uses no proxies at all, overriding environment": {
            "content": "settings:\n\n>>> import urllib.request\n>>> opener = urllib.request.FancyURLopener({})\n>>> with opener.open(\"http://www.python.org/\") as f:\n...     f.read().decode('utf-8')\n...\n\nFile: python3.12.info,  Node: Legacy interface,  Next: urllib request Restrictions,  Prev: Examples<25>,  Up: urllib request -- Extensible library for opening URLs\n\n5.21.4.24 Legacy interface\n..........................\n",
            "subsections": []
        },
        "The following functions and classes are ported from the Python 2 module": {
            "content": "'urllib' (as opposed to 'urllib2').  They might become deprecated at\nsome point in the future.\n\n-- Function: urllib.request.urlretrieve (url, filename=None,\nreporthook=None, data=None)\n\nCopy a network object denoted by a URL to a local file.  If the URL\npoints to a local file, the object will not be copied unless\nfilename is supplied.  Return a tuple '(filename, headers)' where\n'filename' is the local file name under which the object can be\nfound, and 'headers' is whatever the 'info()' method of the object\nreturned by *note urlopen(): cf9. returned (for a remote object).\nExceptions are the same as for *note urlopen(): cf9.\n\nThe second argument, if present, specifies the file location to\ncopy to (if absent, the location will be a tempfile with a\ngenerated name).  The third argument, if present, is a callable\nthat will be called once on establishment of the network connection\nand once after each block read thereafter.  The callable will be\npassed three arguments; a count of blocks transferred so far, a\nblock size in bytes, and the total size of the file.  The third\nargument may be '-1' on older FTP servers which do not return a\nfile size in response to a retrieval request.\n\nThe following example illustrates the most common usage scenario:\n\n>>> import urllib.request\n>>> localfilename, headers = urllib.request.urlretrieve('http://python.org/')\n>>> html = open(localfilename)\n>>> html.close()\n\nIf the 'url' uses the 'http:' scheme identifier, the optional\n'data' argument may be given to specify a 'POST' request (normally\nthe request type is 'GET').  The 'data' argument must be a bytes\nobject in standard 'application/x-www-form-urlencoded' format; see\nthe *note urllib.parse.urlencode(): cf8. function.\n\n*note urlretrieve(): 3650. will raise *note ContentTooShortError:\n3651. when it detects that the amount of data available was less\nthan the expected amount (which is the size reported by a\n'Content-Length' header).  This can occur, for example, when the\ndownload is interrupted.\n\nThe 'Content-Length' is treated as a lower bound: if there's more\ndata to read, urlretrieve reads more data, but if less data is\navailable, it raises the exception.\n\nYou can still retrieve the downloaded data in this case, it is\nstored in the 'content' attribute of the exception instance.\n\nIf no 'Content-Length' header was supplied, urlretrieve can not\ncheck the size of the data it has downloaded, and just returns it.\nIn this case you just have to assume that the download was\nsuccessful.\n\n-- Function: urllib.request.urlcleanup ()\n\nCleans up temporary files that may have been left behind by\nprevious calls to *note urlretrieve(): 3650.\n\n-- Class: urllib.request.URLopener (proxies=None, x509)\n\nDeprecated since version 3.3.\n\nBase class for opening and reading URLs.  Unless you need to\nsupport opening objects using schemes other than 'http:', 'ftp:',\nor 'file:', you probably want to use *note FancyURLopener: 35d5.\n\nBy default, the *note URLopener: 1581. class sends a 'User-Agent'\nheader of 'urllib/VVV', where 'VVV' is the *note urllib: 103.\nversion number.  Applications can define their own 'User-Agent'\nheader by subclassing *note URLopener: 1581. or *note\nFancyURLopener: 35d5. and setting the class attribute *note\nversion: 3652. to an appropriate string value in the subclass\ndefinition.\n\nThe optional 'proxies' parameter should be a dictionary mapping\nscheme names to proxy URLs, where an empty dictionary turns proxies\noff completely.  Its default value is 'None', in which case\nenvironmental proxy settings will be used if present, as discussed\nin the definition of *note urlopen(): cf9, above.\n\nAdditional keyword parameters, collected in 'x509', may be used for\nauthentication of the client when using the 'https:' scheme.  The\nkeywords 'keyfile' and 'certfile' are supported to provide an SSL\nkey and certificate; both are needed to support client\nauthentication.\n\n*note URLopener: 1581. objects will raise an *note OSError: 613.\nexception if the server returns an error code.\n\n-- Method: open (fullurl, data=None)\n\nOpen 'fullurl' using the appropriate protocol.  This method\nsets up cache and proxy information, then calls the\nappropriate open method with its input arguments.  If the\nscheme is not recognized, *note openunknown(): 3654. is\ncalled.  The 'data' argument has the same meaning as the\n'data' argument of *note urlopen(): cf9.\n\nThis method always quotes 'fullurl' using *note quote(): 9e6.\n\n-- Method: openunknown (fullurl, data=None)\n\nOverridable interface to open unknown URL types.\n\n-- Method: retrieve (url, filename=None, reporthook=None,\ndata=None)\n\nRetrieves the contents of 'url' and places it in 'filename'.\nThe return value is a tuple consisting of a local filename and\neither an *note email.message.Message: ae7. object containing\nthe response headers (for remote URLs) or 'None' (for local\nURLs).  The caller must then open and read the contents of\n'filename'.  If 'filename' is not given and the URL refers to\na local file, the input filename is returned.  If the URL is\nnon-local and 'filename' is not given, the filename is the\noutput of *note tempfile.mktemp(): 15f0. with a suffix that\nmatches the suffix of the last path component of the input\nURL.  If 'reporthook' is given, it must be a function\naccepting three numeric parameters: A chunk number, the\nmaximum size chunks are read in and the total size of the\ndownload (-1 if unknown).  It will be called once at the start\nand after each chunk of data is read from the network.\n'reporthook' is ignored for local URLs.\n\nIf the 'url' uses the 'http:' scheme identifier, the optional\n'data' argument may be given to specify a 'POST' request\n(normally the request type is 'GET').  The 'data' argument\nmust in standard 'application/x-www-form-urlencoded' format;\nsee the *note urllib.parse.urlencode(): cf8. function.\n\n-- Attribute: version\n\nVariable that specifies the user agent of the opener object.\nTo get *note urllib: 103. to tell servers that it is a\nparticular user agent, set this in a subclass as a class\nvariable or in the constructor before calling the base\nconstructor.\n\n-- Class: urllib.request.FancyURLopener (...)\n\nDeprecated since version 3.3.\n\n*note FancyURLopener: 35d5. subclasses *note URLopener: 1581.\nproviding default handling for the following HTTP response codes:\n301, 302, 303, 307 and 401.  For the 30x response codes listed\nabove, the 'Location' header is used to fetch the actual URL. For\n401 response codes (authentication required), basic HTTP\nauthentication is performed.  For the 30x response codes, recursion\nis bounded by the value of the 'maxtries' attribute, which defaults\nto 10.\n\nFor all other response codes, the method *note\nhttperrordefault(): 360a. is called which you can override in\nsubclasses to handle the error appropriately.\n\nNote: According to the letter of RFC 2616(1), 301 and 302\nresponses to POST requests must not be automatically\nredirected without confirmation by the user.  In reality,\nbrowsers do allow automatic redirection of these responses,\nchanging the POST to a GET, and *note urllib: 103. reproduces\nthis behaviour.\n\nThe parameters to the constructor are the same as those for *note\nURLopener: 1581.\n\nNote: When performing basic authentication, a *note\nFancyURLopener: 35d5. instance calls its *note\npromptuserpasswd(): 3655. method.  The default\nimplementation asks the users for the required information on\nthe controlling terminal.  A subclass may override this method\nto support more appropriate behavior if needed.\n\nThe *note FancyURLopener: 35d5. class offers one additional method\nthat should be overloaded to provide the appropriate behavior:\n\n-- Method: promptuserpasswd (host, realm)\n\nReturn information needed to authenticate the user at the\ngiven host in the specified security realm.  The return value\nshould be a tuple, '(user, password)', which can be used for\nbasic authentication.\n\nThe implementation prompts for this information on the\nterminal; an application should override this method to use an\nappropriate interaction model in the local environment.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc2616.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: urllib request Restrictions,  Prev: Legacy interface,  Up: urllib request -- Extensible library for opening URLs": {
            "content": "5.21.4.25 'urllib.request' Restrictions\n.......................................\n\n* Currently, only the following protocols are supported: HTTP\n(versions 0.9 and 1.0), FTP, local files, and data URLs.\n\nChanged in version 3.4: Added support for data URLs.\n\n* The caching feature of *note urlretrieve(): 3650. has been disabled\nuntil someone finds the time to hack proper processing of\nExpiration time headers.\n\n* There should be a function to query whether a particular URL is in\nthe cache.\n\n* For backward compatibility, if a URL appears to point to a local\nfile but the file can't be opened, the URL is re-interpreted using\nthe FTP protocol.  This can sometimes cause confusing error\nmessages.\n\n* The *note urlopen(): cf9. and *note urlretrieve(): 3650. functions\ncan cause arbitrarily long delays while waiting for a network\nconnection to be set up.  This means that it is difficult to build\nan interactive web client using these functions without using\nthreads.\n\n* The data returned by *note urlopen(): cf9. or *note urlretrieve():\n3650. is the raw data returned by the server.  This may be binary\ndata (such as an image), plain text or (for example) HTML. The HTTP\nprotocol provides type information in the reply header, which can\nbe inspected by looking at the 'Content-Type' header.  If the\nreturned data is HTML, you can use the module *note html.parser:\n68. to parse it.\n\n* The code handling the FTP protocol cannot differentiate between a\nfile and a directory.  This can lead to unexpected behavior when\nattempting to read a URL that points to a file that is not\naccessible.  If the URL ends in a '/', it is assumed to refer to a\ndirectory and will be handled accordingly.  But if an attempt to\nread a file leads to a 550 error (meaning the URL cannot be found\nor is not accessible, often for permission reasons), then the path\nis treated as a directory in order to handle the case when a\ndirectory is specified by a URL but the trailing '/' has been left\noff.  This can cause misleading results when you try to fetch a\nfile whose read permissions make it inaccessible; the FTP code will\ntry to read it, fail with a 550 error, and then perform a directory\nlisting for the unreadable file.  If fine-grained control is\nneeded, consider using the *note ftplib: 59. module, subclassing\n*note FancyURLopener: 35d5, or changing 'urlopener' to meet your\nneeds.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: urllib response -- Response classes used by urllib,  Next: urllib parse -- Parse URLs into components,  Prev: urllib request -- Extensible library for opening URLs,  Up: Internet Protocols and Support": {
            "content": "The *note urllib.response: 107. module defines functions and classes\nwhich define a minimal file-like interface, including 'read()' and\n'readline()'.  Functions defined by this module are used internally by\nthe *note urllib.request: 106. module.  The typical response object is a\n*note urllib.response.addinfourl: 35d3. instance:\n\n-- Class: urllib.response.addinfourl\n\n-- Attribute: url\n\nURL of the resource retrieved, commonly used to determine if a\nredirect was followed.\n\n-- Attribute: headers\n\nReturns the headers of the response in the form of an *note\nEmailMessage: ae8. instance.\n\n-- Attribute: status\n\nNew in version 3.9.\n\nStatus code returned by server.\n\n-- Method: geturl ()\n\nDeprecated since version 3.9: Deprecated in favor of *note\nurl: 3658.\n\n-- Method: info ()\n\nDeprecated since version 3.9: Deprecated in favor of *note\nheaders: 3659.\n\n-- Attribute: code\n\nDeprecated since version 3.9: Deprecated in favor of *note\nstatus: 365a.\n\n-- Method: getcode ()\n\nDeprecated since version 3.9: Deprecated in favor of *note\nstatus: 365a.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: urllib parse -- Parse URLs into components,  Next: urllib error -- Exception classes raised by urllib request,  Prev: urllib response -- Response classes used by urllib,  Up: Internet Protocols and Support": {
            "content": "'Source code:' Lib/urllib/parse.py(1)\n\n\n",
            "subsections": []
        },
        "This module defines a standard interface to break Uniform Resource": {
            "content": "",
            "subsections": []
        },
        "Locator (URL) strings up in components (addressing scheme, network": {
            "content": "location, path etc.), to combine the components back into a URL string,\nand to convert a \"relative URL\" to an absolute URL given a \"base URL.\"\n",
            "subsections": []
        },
        "The module has been designed to match the internet RFC on Relative": {
            "content": "Uniform Resource Locators.  It supports the following URL schemes:\n'file', 'ftp', 'gopher', 'hdl', 'http', 'https', 'imap', 'mailto',\n'mms', 'news', 'nntp', 'prospero', 'rsync', 'rtsp', 'rtsps', 'rtspu',\n'sftp', 'shttp', 'sip', 'sips', 'snews', 'svn', 'svn+ssh', 'telnet',\n'wais', 'ws', 'wss'.\n\nThe *note urllib.parse: 105. module defines functions that fall into two\nbroad categories: URL parsing and URL quoting.  These are covered in\ndetail in the following sections.\n\n* Menu:\n\n* URL Parsing::\n* URL parsing security::\n* Parsing ASCII Encoded Bytes::\n* Structured Parse Results::\n* URL Quoting::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/urllib/parse.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: URL Parsing,  Next: URL parsing security,  Up: urllib parse -- Parse URLs into components": {
            "content": "5.21.6.1 URL Parsing\n....................\n",
            "subsections": []
        },
        "The URL parsing functions focus on splitting a URL string into its": {
            "content": "components, or on combining URL components into a URL string.\n\n-- Function: urllib.parse.urlparse (urlstring, scheme='',\nallowfragments=True)\n\nParse a URL into six components, returning a 6-item *note named\ntuple: 417.  This corresponds to the general structure of a URL:\n'scheme://netloc/path;parameters?query#fragment'.  Each tuple item\nis a string, possibly empty.  The components are not broken up into\nsmaller parts (for example, the network location is a single\nstring), and % escapes are not expanded.  The delimiters as shown\nabove are not part of the result, except for a leading slash in the\n'path' component, which is retained if present.  For example:\n\n>>> from urllib.parse import urlparse\n>>> urlparse(\"scheme://netloc/path;parameters?query#fragment\")\nParseResult(scheme='scheme', netloc='netloc', path='/path;parameters', params='',\nquery='query', fragment='fragment')\n>>> o = urlparse(\"http://docs.python.org:80/3/library/urllib.parse.html?\"\n...              \"highlight=params#url-parsing\")\n>>> o\nParseResult(scheme='http', netloc='docs.python.org:80',\npath='/3/library/urllib.parse.html', params='',\nquery='highlight=params', fragment='url-parsing')\n>>> o.scheme\n'http'\n>>> o.netloc\n'docs.python.org:80'\n>>> o.hostname\n'docs.python.org'\n>>> o.port\n80\n>>> o.replace(fragment=\"\").geturl()\n'http://docs.python.org:80/3/library/urllib.parse.html?highlight=params'\n\nFollowing the syntax specifications in RFC 1808(1), urlparse\nrecognizes a netloc only if it is properly introduced by '//'.\nOtherwise the input is presumed to be a relative URL and thus to\nstart with a path component.\n\n>>> from urllib.parse import urlparse\n>>> urlparse('//www.cwi.nl:80/%7Eguido/Python.html')\nParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/Python.html',\nparams='', query='', fragment='')\n>>> urlparse('www.cwi.nl/%7Eguido/Python.html')\nParseResult(scheme='', netloc='', path='www.cwi.nl/%7Eguido/Python.html',\nparams='', query='', fragment='')\n>>> urlparse('help/Python.html')\nParseResult(scheme='', netloc='', path='help/Python.html', params='',\nquery='', fragment='')\n\nThe 'scheme' argument gives the default addressing scheme, to be\nused only if the URL does not specify one.  It should be the same\ntype (text or bytes) as 'urlstring', except that the default value\n'''' is always allowed, and is automatically converted to 'b''' if\nappropriate.\n\nIf the 'allowfragments' argument is false, fragment identifiers\nare not recognized.  Instead, they are parsed as part of the path,\nparameters or query component, and 'fragment' is set to the empty\nstring in the return value.\n\nThe return value is a *note named tuple: 417, which means that its\nitems can be accessed by index or as named attributes, which are:\n\nAttribute              Index       Value                         Value if not present\n\n----------------------------------------------------------------------------------------------\n\n'scheme'               0           URL scheme specifier          'scheme' parameter\n\n\n'netloc'               1           Network location part         empty string\n\n\n'path'                 2           Hierarchical path             empty string\n\n\n'params'               3           Parameters for last path      empty string\nelement\n\n\n'query'                4           Query component               empty string\n\n\n'fragment'             5           Fragment identifier           empty string\n\n\n'username'                         User name                     *note None: 43f.\n\n\n'password'                         Password                      *note None: 43f.\n\n\n'hostname'                         Host name (lower case)        *note None: 43f.\n\n\n'port'                             Port number as integer, if    *note None: 43f.\npresent\n\n\nReading the 'port' attribute will raise a *note ValueError: 183. if\nan invalid port is specified in the URL. See section *note\nStructured Parse Results: 3662. for more information on the result\nobject.\n\nUnmatched square brackets in the 'netloc' attribute will raise a\n*note ValueError: 183.\n\nCharacters in the 'netloc' attribute that decompose under NFKC\nnormalization (as used by the IDNA encoding) into any of '/', '?',\n'#', '@', or ':' will raise a *note ValueError: 183.  If the URL is\ndecomposed before parsing, no error will be raised.\n\nAs is the case with all named tuples, the subclass has a few\nadditional methods and attributes that are particularly useful.\nOne such method is 'replace()'.  The 'replace()' method will\nreturn a new ParseResult object replacing specified fields with new\nvalues.\n\n>>> from urllib.parse import urlparse\n>>> u = urlparse('//www.cwi.nl:80/%7Eguido/Python.html')\n>>> u\nParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/Python.html',\nparams='', query='', fragment='')\n>>> u.replace(scheme='http')\nParseResult(scheme='http', netloc='www.cwi.nl:80', path='/%7Eguido/Python.html',\nparams='', query='', fragment='')\n\nWarning: *note urlparse(): b96. does not perform validation.\nSee *note URL parsing security: 3663. for details.\n\nChanged in version 3.2: Added IPv6 URL parsing capabilities.\n\nChanged in version 3.3: The fragment is now parsed for all URL\nschemes (unless 'allowfragment' is false), in accordance with RFC\n3986(2).  Previously, an allowlist of schemes that support\nfragments existed.\n\nChanged in version 3.6: Out-of-range port numbers now raise *note\nValueError: 183, instead of returning *note None: 43f.\n\nChanged in version 3.8: Characters that affect netloc parsing under\nNFKC normalization will now raise *note ValueError: 183.\n\n-- Function: urllib.parse.parseqs (qs, keepblankvalues=False,\nstrictparsing=False, encoding='utf-8', errors='replace',\nmaxnumfields=None, separator='&')\n\nParse a query string given as a string argument (data of type\n'application/x-www-form-urlencoded').  Data are returned as a\ndictionary.  The dictionary keys are the unique query variable\nnames and the values are lists of values for each name.\n\nThe optional argument 'keepblankvalues' is a flag indicating\nwhether blank values in percent-encoded queries should be treated\nas blank strings.  A true value indicates that blanks should be\nretained as blank strings.  The default false value indicates that\nblank values are to be ignored and treated as if they were not\nincluded.\n\nThe optional argument 'strictparsing' is a flag indicating what to\ndo with parsing errors.  If false (the default), errors are\nsilently ignored.  If true, errors raise a *note ValueError: 183.\nexception.\n\nThe optional 'encoding' and 'errors' parameters specify how to\ndecode percent-encoded sequences into Unicode characters, as\naccepted by the *note bytes.decode(): 6ef. method.\n\nThe optional argument 'maxnumfields' is the maximum number of\nfields to read.  If set, then throws a *note ValueError: 183. if\nthere are more than 'maxnumfields' fields read.\n\nThe optional argument 'separator' is the symbol to use for\nseparating the query arguments.  It defaults to '&'.\n\nUse the *note urllib.parse.urlencode(): cf8. function (with the\n'doseq' parameter set to 'True') to convert such dictionaries into\nquery strings.\n\nChanged in version 3.2: Add 'encoding' and 'errors' parameters.\n\nChanged in version 3.8: Added 'maxnumfields' parameter.\n\nChanged in version 3.10: Added 'separator' parameter with the\ndefault value of '&'.  Python versions earlier than Python 3.10\nallowed using both ';' and '&' as query parameter separator.  This\nhas been changed to allow only a single separator key, with '&' as\nthe default separator.\n\n-- Function: urllib.parse.parseqsl (qs, keepblankvalues=False,\nstrictparsing=False, encoding='utf-8', errors='replace',\nmaxnumfields=None, separator='&')\n\nParse a query string given as a string argument (data of type\n'application/x-www-form-urlencoded').  Data are returned as a list\nof name, value pairs.\n\nThe optional argument 'keepblankvalues' is a flag indicating\nwhether blank values in percent-encoded queries should be treated\nas blank strings.  A true value indicates that blanks should be\nretained as blank strings.  The default false value indicates that\nblank values are to be ignored and treated as if they were not\nincluded.\n\nThe optional argument 'strictparsing' is a flag indicating what to\ndo with parsing errors.  If false (the default), errors are\nsilently ignored.  If true, errors raise a *note ValueError: 183.\nexception.\n\nThe optional 'encoding' and 'errors' parameters specify how to\ndecode percent-encoded sequences into Unicode characters, as\naccepted by the *note bytes.decode(): 6ef. method.\n\nThe optional argument 'maxnumfields' is the maximum number of\nfields to read.  If set, then throws a *note ValueError: 183. if\nthere are more than 'maxnumfields' fields read.\n\nThe optional argument 'separator' is the symbol to use for\nseparating the query arguments.  It defaults to '&'.\n\nUse the *note urllib.parse.urlencode(): cf8. function to convert\nsuch lists of pairs into query strings.\n\nChanged in version 3.2: Add 'encoding' and 'errors' parameters.\n\nChanged in version 3.8: Added 'maxnumfields' parameter.\n\nChanged in version 3.10: Added 'separator' parameter with the\ndefault value of '&'.  Python versions earlier than Python 3.10\nallowed using both ';' and '&' as query parameter separator.  This\nhas been changed to allow only a single separator key, with '&' as\nthe default separator.\n\n-- Function: urllib.parse.urlunparse (parts)\n\nConstruct a URL from a tuple as returned by 'urlparse()'.  The\n'parts' argument can be any six-item iterable.  This may result in\na slightly different, but equivalent URL, if the URL that was\nparsed originally had unnecessary delimiters (for example, a '?'\nwith an empty query; the RFC states that these are equivalent).\n\n-- Function: urllib.parse.urlsplit (urlstring, scheme='',\nallowfragments=True)\n\nThis is similar to *note urlparse(): b96, but does not split the\nparams from the URL. This should generally be used instead of *note\nurlparse(): b96. if the more recent URL syntax allowing parameters\nto be applied to each segment of the 'path' portion of the URL (see\nRFC 2396(3)) is wanted.  A separate function is needed to separate\nthe path segments and parameters.  This function returns a 5-item\n*note named tuple: 417.:\n\n(addressing scheme, network location, path, query, fragment identifier).\n\nThe return value is a *note named tuple: 417, its items can be\naccessed by index or as named attributes:\n\nAttribute              Index       Value                         Value if not present\n\n--------------------------------------------------------------------------------------------\n\n'scheme'               0           URL scheme specifier          'scheme' parameter\n\n\n'netloc'               1           Network location part         empty string\n\n\n'path'                 2           Hierarchical path             empty string\n\n\n'query'                3           Query component               empty string\n\n\n'fragment'             4           Fragment identifier           empty string\n\n\n'username'                         User name                     *note None: 43f.\n\n\n'password'                         Password                      *note None: 43f.\n\n\n'hostname'                         Host name (lower case)        *note None: 43f.\n\n\n'port'                             Port number as integer, if    *note None: 43f.\npresent\n\n\nReading the 'port' attribute will raise a *note ValueError: 183. if\nan invalid port is specified in the URL. See section *note\nStructured Parse Results: 3662. for more information on the result\nobject.\n\nUnmatched square brackets in the 'netloc' attribute will raise a\n*note ValueError: 183.\n\nCharacters in the 'netloc' attribute that decompose under NFKC\nnormalization (as used by the IDNA encoding) into any of '/', '?',\n'#', '@', or ':' will raise a *note ValueError: 183.  If the URL is\ndecomposed before parsing, no error will be raised.\n\nFollowing some of the WHATWG spec(4) that updates RFC 3986, leading\nC0 control and space characters are stripped from the URL. '\\n',\n'\\r' and tab '\\t' characters are removed from the URL at any\nposition.\n\nWarning: *note urlsplit(): b95. does not perform validation.\nSee *note URL parsing security: 3663. for details.\n\nChanged in version 3.6: Out-of-range port numbers now raise *note\nValueError: 183, instead of returning *note None: 43f.\n\nChanged in version 3.8: Characters that affect netloc parsing under\nNFKC normalization will now raise *note ValueError: 183.\n\nChanged in version 3.10: ASCII newline and tab characters are\nstripped from the URL.\n\nChanged in version 3.12: Leading WHATWG C0 control and space\ncharacters are stripped from the URL.\n\n-- Function: urllib.parse.urlunsplit (parts)\n\nCombine the elements of a tuple as returned by *note urlsplit():\nb95. into a complete URL as a string.  The 'parts' argument can be\nany five-item iterable.  This may result in a slightly different,\nbut equivalent URL, if the URL that was parsed originally had\nunnecessary delimiters (for example, a ?  with an empty query; the\nRFC states that these are equivalent).\n\n-- Function: urllib.parse.urljoin (base, url, allowfragments=True)\n\nConstruct a full (\"absolute\") URL by combining a \"base URL\"\n('base') with another URL ('url').  Informally, this uses\ncomponents of the base URL, in particular the addressing scheme,\nthe network location and (part of) the path, to provide missing\ncomponents in the relative URL. For example:\n\n>>> from urllib.parse import urljoin\n>>> urljoin('http://www.cwi.nl/%7Eguido/Python.html', 'FAQ.html')\n'http://www.cwi.nl/%7Eguido/FAQ.html'\n\nThe 'allowfragments' argument has the same meaning and default as\nfor *note urlparse(): b96.\n\nNote: If 'url' is an absolute URL (that is, it starts with\n'//' or 'scheme://'), the 'url''s hostname and/or scheme will\nbe present in the result.  For example:\n\n>>> urljoin('http://www.cwi.nl/%7Eguido/Python.html',\n...         '//www.python.org/%7Eguido')\n'http://www.python.org/%7Eguido'\n\nIf you do not want that behavior, preprocess the 'url' with\n*note urlsplit(): b95. and *note urlunsplit(): 3665, removing\npossible 'scheme' and 'netloc' parts.\n\nChanged in version 3.5: Behavior updated to match the semantics\ndefined in RFC 3986(5).\n\n-- Function: urllib.parse.urldefrag (url)\n\nIf 'url' contains a fragment identifier, return a modified version\nof 'url' with no fragment identifier, and the fragment identifier\nas a separate string.  If there is no fragment identifier in 'url',\nreturn 'url' unmodified and an empty string.\n\nThe return value is a *note named tuple: 417, its items can be\naccessed by index or as named attributes:\n\nAttribute              Index       Value                         Value if not present\n\n--------------------------------------------------------------------------------------------\n\n'url'                  0           URL with no fragment          empty string\n\n\n'fragment'             1           Fragment identifier           empty string\n\n\nSee section *note Structured Parse Results: 3662. for more\ninformation on the result object.\n\nChanged in version 3.2: Result is a structured object rather than a\nsimple 2-tuple.\n\n-- Function: urllib.parse.unwrap (url)\n\nExtract the url from a wrapped URL (that is, a string formatted as\n'<URL:scheme://host/path>', '<scheme://host/path>',\n'URL:scheme://host/path' or 'scheme://host/path').  If 'url' is not\na wrapped URL, it is returned without changes.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc1808.html\n\n(2) https://datatracker.ietf.org/doc/html/rfc3986.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc2396.html\n\n(4) https://url.spec.whatwg.org/#concept-basic-url-parser\n\n(5) https://datatracker.ietf.org/doc/html/rfc3986.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: URL parsing security,  Next: Parsing ASCII Encoded Bytes,  Prev: URL Parsing,  Up: urllib parse -- Parse URLs into components": {
            "content": "5.21.6.2 URL parsing security\n.............................\n\nThe *note urlsplit(): b95. and *note urlparse(): b96. APIs do not\nperform 'validation' of inputs.  They may not raise errors on inputs\nthat other applications consider invalid.  They may also succeed on some\ninputs that might not be considered URLs elsewhere.  Their purpose is\nfor practical functionality rather than purity.\n",
            "subsections": []
        },
        "Instead of raising an exception on unusual input, they may instead": {
            "content": "return some component parts as empty strings.  Or components may contain\nmore than perhaps they should.\n",
            "subsections": []
        },
        "We recommend that users of these APIs where the values may be used": {
            "content": "anywhere with security implications code defensively.  Do some\nverification within your code before trusting a returned component part.\nDoes that 'scheme' make sense?  Is that a sensible 'path'?  Is there\nanything strange about that 'hostname'?  etc.\n",
            "subsections": []
        },
        "What constitutes a URL is not universally well defined.  Different": {
            "content": "applications have different needs and desired constraints.  For instance\nthe living WHATWG spec(1) describes what user facing web clients such as\na web browser require.  While RFC 3986(2) is more general.  These\nfunctions incorporate some aspects of both, but cannot be claimed\ncompliant with either.  The APIs and existing user code with\nexpectations on specific behaviors predate both standards leading us to\nbe very cautious about making API behavior changes.\n\n---------- Footnotes ----------\n\n(1) https://url.spec.whatwg.org/#concept-basic-url-parser\n\n(2) https://datatracker.ietf.org/doc/html/rfc3986.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Parsing ASCII Encoded Bytes,  Next: Structured Parse Results,  Prev: URL parsing security,  Up: urllib parse -- Parse URLs into components": {
            "content": "5.21.6.3 Parsing ASCII Encoded Bytes\n....................................\n",
            "subsections": []
        },
        "The URL parsing functions were originally designed to operate on": {
            "content": "character strings only.  In practice, it is useful to be able to\nmanipulate properly quoted and encoded URLs as sequences of ASCII bytes.",
            "subsections": []
        },
        "Accordingly, the URL parsing functions in this module all operate on": {
            "content": "*note bytes: 295. and *note bytearray: 294. objects in addition to *note\nstr: 157. objects.\n\nIf *note str: 157. data is passed in, the result will also contain only\n*note str: 157. data.  If *note bytes: 295. or *note bytearray: 294.\ndata is passed in, the result will contain only *note bytes: 295. data.\n\nAttempting to mix *note str: 157. data with *note bytes: 295. or *note\nbytearray: 294. in a single function call will result in a *note",
            "subsections": []
        },
        "TypeError: 28e. being raised, while attempting to pass in non-ASCII byte": {
            "content": "values will trigger *note UnicodeDecodeError: 83c.\n\nTo support easier conversion of result objects between *note str: 157.\nand *note bytes: 295, all return values from URL parsing functions\nprovide either an 'encode()' method (when the result contains *note str:\n157. data) or a 'decode()' method (when the result contains *note bytes:\n295. data).  The signatures of these methods match those of the\ncorresponding *note str: 157. and *note bytes: 295. methods (except that\nthe default encoding is ''ascii'' rather than ''utf-8'').  Each produces\na value of a corresponding type that contains either *note bytes: 295.\ndata (for 'encode()' methods) or *note str: 157. data (for 'decode()'\nmethods).\n",
            "subsections": []
        },
        "Applications that need to operate on potentially improperly quoted URLs": {
            "content": "that may contain non-ASCII data will need to do their own decoding from\nbytes to characters before invoking the URL parsing methods.\n",
            "subsections": []
        },
        "The behaviour described in this section applies only to the URL parsing": {
            "content": "functions.  The URL quoting functions use their own rules when producing\nor consuming byte sequences as detailed in the documentation of the\nindividual URL quoting functions.\n",
            "subsections": []
        },
        "Changed in version 3.2: URL parsing functions now accept ASCII encoded": {
            "content": "byte sequences\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Structured Parse Results,  Next: URL Quoting,  Prev: Parsing ASCII Encoded Bytes,  Up: urllib parse -- Parse URLs into components": {
            "content": "5.21.6.4 Structured Parse Results\n.................................\n\nThe result objects from the *note urlparse(): b96, *note urlsplit():\nb95. and *note urldefrag(): 10be. functions are subclasses of the *note\ntuple: 4b8. type.  These subclasses add the attributes listed in the\ndocumentation for those functions, the encoding and decoding support\ndescribed in the previous section, as well as an additional method:\n\n-- Method: urllib.parse.SplitResult.geturl ()\n\nReturn the re-combined version of the original URL as a string.\nThis may differ from the original URL in that the scheme may be\nnormalized to lower case and empty components may be dropped.\nSpecifically, empty parameters, queries, and fragment identifiers\nwill be removed.\n\nFor *note urldefrag(): 10be. results, only empty fragment\nidentifiers will be removed.  For *note urlsplit(): b95. and *note\nurlparse(): b96. results, all noted changes will be made to the URL\nreturned by this method.\n\nThe result of this method remains unchanged if passed back through\nthe original parsing function:\n\n>>> from urllib.parse import urlsplit\n>>> url = 'HTTP://www.Python.org/doc/#'\n>>> r1 = urlsplit(url)\n>>> r1.geturl()\n'http://www.Python.org/doc/'\n>>> r2 = urlsplit(r1.geturl())\n>>> r2.geturl()\n'http://www.Python.org/doc/'\n",
            "subsections": []
        },
        "The following classes provide the implementations of the structured": {
            "content": "parse results when operating on *note str: 157. objects:\n\n-- Class: urllib.parse.DefragResult (url, fragment)\n\nConcrete class for *note urldefrag(): 10be. results containing\n*note str: 157. data.  The 'encode()' method returns a *note\nDefragResultBytes: 366c. instance.\n\nNew in version 3.2.\n\n-- Class: urllib.parse.ParseResult (scheme, netloc, path, params,\nquery, fragment)\n\nConcrete class for *note urlparse(): b96. results containing *note\nstr: 157. data.  The 'encode()' method returns a *note\nParseResultBytes: 366e. instance.\n\n-- Class: urllib.parse.SplitResult (scheme, netloc, path, query,\nfragment)\n\nConcrete class for *note urlsplit(): b95. results containing *note\nstr: 157. data.  The 'encode()' method returns a *note\nSplitResultBytes: 3670. instance.\n",
            "subsections": []
        },
        "The following classes provide the implementations of the parse results": {
            "content": "when operating on *note bytes: 295. or *note bytearray: 294. objects:\n\n-- Class: urllib.parse.DefragResultBytes (url, fragment)\n\nConcrete class for *note urldefrag(): 10be. results containing\n*note bytes: 295. data.  The 'decode()' method returns a *note\nDefragResult: 366b. instance.\n\nNew in version 3.2.\n\n-- Class: urllib.parse.ParseResultBytes (scheme, netloc, path, params,\nquery, fragment)\n\nConcrete class for *note urlparse(): b96. results containing *note\nbytes: 295. data.  The 'decode()' method returns a *note\nParseResult: 366d. instance.\n\nNew in version 3.2.\n\n-- Class: urllib.parse.SplitResultBytes (scheme, netloc, path, query,\nfragment)\n\nConcrete class for *note urlsplit(): b95. results containing *note\nbytes: 295. data.  The 'decode()' method returns a *note\nSplitResult: 366f. instance.\n\nNew in version 3.2.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: URL Quoting,  Prev: Structured Parse Results,  Up: urllib parse -- Parse URLs into components": {
            "content": "5.21.6.5 URL Quoting\n....................\n",
            "subsections": []
        },
        "The URL quoting functions focus on taking program data and making it": {
            "content": "safe for use as URL components by quoting special characters and\nappropriately encoding non-ASCII text.  They also support reversing\nthese operations to recreate the original data from the contents of a\nURL component if that task isn't already covered by the URL parsing\nfunctions above.\n\n-- Function: urllib.parse.quote (string, safe='/', encoding=None,\nerrors=None)\n\nReplace special characters in 'string' using the '%XX' escape.\nLetters, digits, and the characters ''.-~'' are never quoted.  By\ndefault, this function is intended for quoting the path section of\na URL. The optional 'safe' parameter specifies additional ASCII\ncharacters that should not be quoted -- its default value is ''/''.\n\n'string' may be either a *note str: 157. or a *note bytes: 295.\nobject.\n\nChanged in version 3.7: Moved from RFC 2396(1) to RFC 3986(2) for\nquoting URL strings.  \"~\" is now included in the set of unreserved\ncharacters.\n\nThe optional 'encoding' and 'errors' parameters specify how to deal\nwith non-ASCII characters, as accepted by the *note str.encode():\n6ee. method.  'encoding' defaults to ''utf-8''.  'errors' defaults\nto ''strict'', meaning unsupported characters raise a *note\nUnicodeEncodeError: 442.  'encoding' and 'errors' must not be\nsupplied if 'string' is a *note bytes: 295, or a *note TypeError:\n28e. is raised.\n\nNote that 'quote(string, safe, encoding, errors)' is equivalent to\n'quotefrombytes(string.encode(encoding, errors), safe)'.\n\nExample: 'quote('/El Nin~o/')' yields ''/El%20Ni%C3%B1o/''.\n\n-- Function: urllib.parse.quoteplus (string, safe='', encoding=None,\nerrors=None)\n\nLike *note quote(): 9e6, but also replace spaces with plus signs,\nas required for quoting HTML form values when building up a query\nstring to go into a URL. Plus signs in the original string are\nescaped unless they are included in 'safe'.  It also does not have\n'safe' default to ''/''.\n\nExample: 'quoteplus('/El Nin~o/')' yields ''%2FEl+Ni%C3%B1o%2F''.\n\n-- Function: urllib.parse.quotefrombytes (bytes, safe='/')\n\nLike *note quote(): 9e6, but accepts a *note bytes: 295. object\nrather than a *note str: 157, and does not perform string-to-bytes\nencoding.\n\nExample: 'quotefrombytes(b'a&\\xef')' yields ''a%26%EF''.\n\n-- Function: urllib.parse.unquote (string, encoding='utf-8',\nerrors='replace')\n\nReplace '%XX' escapes with their single-character equivalent.  The\noptional 'encoding' and 'errors' parameters specify how to decode\npercent-encoded sequences into Unicode characters, as accepted by\nthe *note bytes.decode(): 6ef. method.\n\n'string' may be either a *note str: 157. or a *note bytes: 295.\nobject.\n\n'encoding' defaults to ''utf-8''.  'errors' defaults to\n''replace'', meaning invalid sequences are replaced by a\nplaceholder character.\n\nExample: 'unquote('/El%20Ni%C3%B1o/')' yields ''/El Nin~o/''.\n\nChanged in version 3.9: 'string' parameter supports bytes and str\nobjects (previously only str).\n\n-- Function: urllib.parse.unquoteplus (string, encoding='utf-8',\nerrors='replace')\n\nLike *note unquote(): 14d8, but also replace plus signs with\nspaces, as required for unquoting HTML form values.\n\n'string' must be a *note str: 157.\n\nExample: 'unquoteplus('/El+Ni%C3%B1o/')' yields ''/El Nin~o/''.\n\n-- Function: urllib.parse.unquotetobytes (string)\n\nReplace '%XX' escapes with their single-octet equivalent, and\nreturn a *note bytes: 295. object.\n\n'string' may be either a *note str: 157. or a *note bytes: 295.\nobject.\n\nIf it is a *note str: 157, unescaped non-ASCII characters in\n'string' are encoded into UTF-8 bytes.\n\nExample: 'unquotetobytes('a%26%EF')' yields 'b'a&\\xef''.\n\n-- Function: urllib.parse.urlencode (query, doseq=False, safe='',\nencoding=None, errors=None, quotevia=quoteplus)\n\nConvert a mapping object or a sequence of two-element tuples, which\nmay contain *note str: 157. or *note bytes: 295. objects, to a\npercent-encoded ASCII text string.  If the resultant string is to\nbe used as a 'data' for POST operation with the *note urlopen():\ncf9. function, then it should be encoded to bytes, otherwise it\nwould result in a *note TypeError: 28e.\n\nThe resulting string is a series of 'key=value' pairs separated by\n''&'' characters, where both 'key' and 'value' are quoted using the\n'quotevia' function.  By default, *note quoteplus(): 10bf. is\nused to quote the values, which means spaces are quoted as a ''+''\ncharacter and '/' characters are encoded as '%2F', which follows\nthe standard for GET requests\n('application/x-www-form-urlencoded').  An alternate function that\ncan be passed as 'quotevia' is *note quote(): 9e6, which will\nencode spaces as '%20' and not encode '/' characters.  For maximum\ncontrol of what is quoted, use 'quote' and specify a value for\n'safe'.\n\nWhen a sequence of two-element tuples is used as the 'query'\nargument, the first element of each tuple is a key and the second\nis a value.  The value element in itself can be a sequence and in\nthat case, if the optional parameter 'doseq' evaluates to 'True',\nindividual 'key=value' pairs separated by ''&'' are generated for\neach element of the value sequence for the key.  The order of\nparameters in the encoded string will match the order of parameter\ntuples in the sequence.\n\nThe 'safe', 'encoding', and 'errors' parameters are passed down to\n'quotevia' (the 'encoding' and 'errors' parameters are only passed\nwhen a query element is a *note str: 157.).\n\nTo reverse this encoding process, *note parseqs(): 651. and *note\nparseqsl(): 652. are provided in this module to parse query\nstrings into Python data structures.\n\nRefer to *note urllib examples: 364e. to find out how the *note\nurllib.parse.urlencode(): cf8. method can be used for generating\nthe query string of a URL or data for a POST request.\n\nChanged in version 3.2: 'query' supports bytes and string objects.\n\nChanged in version 3.5: Added the 'quotevia' parameter.\n\nSee also\n........\n\nWHATWG(3) - URL Living standard\n\nWorking Group for the URL Standard that defines URLs, domains, IP\naddresses, the application/x-www-form-urlencoded format, and their\nAPI.\n\nRFC 3986(4) - Uniform Resource Identifiers\n\nThis is the current standard (STD66).  Any changes to urllib.parse\nmodule should conform to this.  Certain deviations could be\nobserved, which are mostly for backward compatibility purposes and\nfor certain de-facto parsing requirements as commonly observed in\nmajor browsers.\n\nRFC 2732(5) - Format for Literal IPv6 Addresses in URL's.\n\nThis specifies the parsing requirements of IPv6 URLs.\n\nRFC 2396(6) - Uniform Resource Identifiers (URI): Generic Syntax\n\nDocument describing the generic syntactic requirements for both\nUniform Resource Names (URNs) and Uniform Resource Locators (URLs).\n\nRFC 2368(7) - The mailto URL scheme.\n\nParsing requirements for mailto URL schemes.\n\nRFC 1808(8) - Relative Uniform Resource Locators\n\nThis Request For Comments includes the rules for joining an\nabsolute and a relative URL, including a fair number of \"Abnormal\nExamples\" which govern the treatment of border cases.\n\nRFC 1738(9) - Uniform Resource Locators (URL)\n\nThis specifies the formal syntax and semantics of absolute URLs.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc2396.html\n\n(2) https://datatracker.ietf.org/doc/html/rfc3986.html\n\n(3) https://url.spec.whatwg.org/\n\n(4) https://datatracker.ietf.org/doc/html/rfc3986.html\n\n(5) https://datatracker.ietf.org/doc/html/rfc2732.html\n\n(6) https://datatracker.ietf.org/doc/html/rfc2396.html\n\n(7) https://datatracker.ietf.org/doc/html/rfc2368.html\n\n(8) https://datatracker.ietf.org/doc/html/rfc1808.html\n\n(9) https://datatracker.ietf.org/doc/html/rfc1738.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: urllib error -- Exception classes raised by urllib request,  Next: urllib robotparser -- Parser for robots txt,  Prev: urllib parse -- Parse URLs into components,  Up: Internet Protocols and Support": {
            "content": "'Source code:' Lib/urllib/error.py(1)\n\n\n\nThe *note urllib.error: 104. module defines the exception classes for\nexceptions raised by *note urllib.request: 106.  The base exception\nclass is *note URLError: 35d6.\n\nThe following exceptions are raised by *note urllib.error: 104. as\nappropriate:\n\n-- Exception: urllib.error.URLError\n\nThe handlers raise this exception (or derived exceptions) when they\nrun into a problem.  It is a subclass of *note OSError: 613.\n\n-- Attribute: reason\n\nThe reason for this error.  It can be a message string or\nanother exception instance.\n\nChanged in version 3.3: *note URLError: 35d6. used to be a subtype\nof *note IOError: ecb, which is now an alias of *note OSError: 613.\n\n-- Exception: urllib.error.HTTPError (url, code, msg, hdrs, fp)\n\nThough being an exception (a subclass of *note URLError: 35d6.), an\n*note HTTPError: e51. can also function as a non-exceptional\nfile-like return value (the same thing that *note urlopen(): cf9.\nreturns).  This is useful when handling exotic HTTP errors, such as\nrequests for authentication.\n\n-- Attribute: url\n\nContains the request URL. An alias for 'filename' attribute.\n\n-- Attribute: code\n\nAn HTTP status code as defined in RFC 2616(2).  This numeric\nvalue corresponds to a value found in the dictionary of codes\nas found in *note\nhttp.server.BaseHTTPRequestHandler.responses: 3678.\n\n-- Attribute: reason\n\nThis is usually a string explaining the reason for this error.\nAn alias for 'msg' attribute.\n\n-- Attribute: headers\n\nThe HTTP response headers for the HTTP request that caused the\n*note HTTPError: e51.  An alias for 'hdrs' attribute.\n\nNew in version 3.4.\n\n-- Attribute: fp\n\nA file-like object where the HTTP error body can be read from.\n\n-- Exception: urllib.error.ContentTooShortError (msg, content)\n\nThis exception is raised when the *note urlretrieve(): 3650.\nfunction detects that the amount of the downloaded data is less\nthan the expected amount (given by the 'Content-Length' header).\n\n-- Attribute: content\n\nThe downloaded (and supposedly truncated) data.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/urllib/error.py\n\n(2) https://datatracker.ietf.org/doc/html/rfc2616.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: urllib robotparser -- Parser for robots txt,  Next: http -- HTTP modules,  Prev: urllib error -- Exception classes raised by urllib request,  Up: Internet Protocols and Support": {
            "content": "'Source code:' Lib/urllib/robotparser.py(1)\n\n\n\nThis module provides a single class, *note RobotFileParser: b4d, which\nanswers questions about whether or not a particular user agent can fetch\na URL on the web site that published the 'robots.txt' file.  For more\ndetails on the structure of 'robots.txt' files, see\n'http://www.robotstxt.org/orig.html'.\n\n-- Class: urllib.robotparser.RobotFileParser (url='')\n\nThis class provides methods to read, parse and answer questions\nabout the 'robots.txt' file at 'url'.\n\n-- Method: seturl (url)\n\nSets the URL referring to a 'robots.txt' file.\n\n-- Method: read ()\n\nReads the 'robots.txt' URL and feeds it to the parser.\n\n-- Method: parse (lines)\n\nParses the lines argument.\n\n-- Method: canfetch (useragent, url)\n\nReturns 'True' if the 'useragent' is allowed to fetch the\n'url' according to the rules contained in the parsed\n'robots.txt' file.\n\n-- Method: mtime ()\n\nReturns the time the 'robots.txt' file was last fetched.  This\nis useful for long-running web spiders that need to check for\nnew 'robots.txt' files periodically.\n\n-- Method: modified ()\n\nSets the time the 'robots.txt' file was last fetched to the\ncurrent time.\n\n-- Method: crawldelay (useragent)\n\nReturns the value of the 'Crawl-delay' parameter from\n'robots.txt' for the 'useragent' in question.  If there is no\nsuch parameter or it doesn't apply to the 'useragent'\nspecified or the 'robots.txt' entry for this parameter has\ninvalid syntax, return 'None'.\n\nNew in version 3.6.\n\n-- Method: requestrate (useragent)\n\nReturns the contents of the 'Request-rate' parameter from\n'robots.txt' as a *note named tuple: 417.\n'RequestRate(requests, seconds)'.  If there is no such\nparameter or it doesn't apply to the 'useragent' specified or\nthe 'robots.txt' entry for this parameter has invalid syntax,\nreturn 'None'.\n\nNew in version 3.6.\n\n-- Method: sitemaps ()\n\nReturns the contents of the 'Sitemap' parameter from\n'robots.txt' in the form of a *note list(): 3dc.  If there is\nno such parameter or the 'robots.txt' entry for this parameter\nhas invalid syntax, return 'None'.\n\nNew in version 3.8.\n\nThe following example demonstrates basic use of the *note\nRobotFileParser: b4d. class:\n\n>>> import urllib.robotparser\n>>> rp = urllib.robotparser.RobotFileParser()\n>>> rp.seturl(\"http://www.musi-cal.com/robots.txt\")\n>>> rp.read()\n>>> rrate = rp.requestrate(\"*\")\n>>> rrate.requests\n3\n>>> rrate.seconds\n20\n>>> rp.crawldelay(\"*\")\n6\n>>> rp.canfetch(\"*\", \"http://www.musi-cal.com/cgi-bin/search?city=San+Francisco\")\nFalse\n>>> rp.canfetch(\"*\", \"http://www.musi-cal.com/\")\nTrue\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/urllib/robotparser.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: http -- HTTP modules,  Next: http client -- HTTP protocol client,  Prev: urllib robotparser -- Parser for robots txt,  Up: Internet Protocols and Support": {
            "content": "'Source code:' Lib/http/init.py(1)\n\n\n\n*note http: 69. is a package that collects several modules for working\nwith the HyperText Transfer Protocol:\n\n* *note http.client: 6a. is a low-level HTTP protocol client; for\nhigh-level URL opening use *note urllib.request: 106.\n\n* *note http.server: 6d. contains basic HTTP server classes based on\n*note socketserver: c7.\n\n* *note http.cookies: 6c. has utilities for implementing state\nmanagement with cookies\n\n* *note http.cookiejar: 6b. provides persistence of cookies\n\nThe *note http: 69. module also defines the following enums that help\nyou work with http related code:\n\n-- Class: http.HTTPStatus\n\nNew in version 3.5.\n\nA subclass of *note enum.IntEnum: b2e. that defines a set of HTTP\nstatus codes, reason phrases and long descriptions written in\nEnglish.\n\nUsage:\n\n>>> from http import HTTPStatus\n>>> HTTPStatus.OK\nHTTPStatus.OK\n>>> HTTPStatus.OK == 200\nTrue\n>>> HTTPStatus.OK.value\n200\n>>> HTTPStatus.OK.phrase\n'OK'\n>>> HTTPStatus.OK.description\n'Request fulfilled, document follows'\n>>> list(HTTPStatus)\n[HTTPStatus.CONTINUE, HTTPStatus.SWITCHINGPROTOCOLS, ...]\n\n* Menu:\n\n* HTTP status codes::\n* HTTP status category::\n* HTTP methods::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/http/init.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: HTTP status codes,  Next: HTTP status category,  Up: http -- HTTP modules": {
            "content": "5.21.9.1 HTTP status codes\n..........................\n\nSupported, IANA-registered status codes(1) available in *note\nhttp.HTTPStatus: 71b. are:\n",
            "subsections": []
        },
        "Code        Enum Name                               Details": {
            "content": "----------------------------------------------------------------------------------------------------------------------------------------\n\n'100'       'CONTINUE'                              HTTP/1.1 RFC 7231(2), Section 6.2.1\n\n\n'101'       'SWITCHINGPROTOCOLS'                   HTTP/1.1 RFC 7231(3), Section 6.2.2\n\n\n'102'       'PROCESSING'                            WebDAV RFC 2518(4), Section 10.1\n\n\n'103'       'EARLYHINTS'                           An HTTP Status Code for Indicating Hints RFC 8297(5)\n\n\n'200'       'OK'                                    HTTP/1.1 RFC 7231(6), Section 6.3.1\n\n\n'201'       'CREATED'                               HTTP/1.1 RFC 7231(7), Section 6.3.2\n\n\n'202'       'ACCEPTED'                              HTTP/1.1 RFC 7231(8), Section 6.3.3\n\n\n'203'       'NONAUTHORITATIVEINFORMATION'         HTTP/1.1 RFC 7231(9), Section 6.3.4\n\n\n'204'       'NOCONTENT'                            HTTP/1.1 RFC 7231(10), Section 6.3.5\n\n\n'205'       'RESETCONTENT'                         HTTP/1.1 RFC 7231(11), Section 6.3.6\n\n\n'206'       'PARTIALCONTENT'                       HTTP/1.1 RFC 7233(12), Section 4.1\n\n\n'207'       'MULTISTATUS'                          WebDAV RFC 4918(13), Section 11.1\n\n\n'208'       'ALREADYREPORTED'                      WebDAV Binding Extensions RFC 5842(14), Section 7.1 (Experimental)\n\n\n'226'       'IMUSED'                               Delta Encoding in HTTP RFC 3229(15), Section 10.4.1\n\n\n'300'       'MULTIPLECHOICES'                      HTTP/1.1 RFC 7231(16), Section 6.4.1\n\n\n'301'       'MOVEDPERMANENTLY'                     HTTP/1.1 RFC 7231(17), Section 6.4.2\n\n\n'302'       'FOUND'                                 HTTP/1.1 RFC 7231(18), Section 6.4.3\n\n\n'303'       'SEEOTHER'                             HTTP/1.1 RFC 7231(19), Section 6.4.4\n\n\n'304'       'NOTMODIFIED'                          HTTP/1.1 RFC 7232(20), Section 4.1\n\n\n'305'       'USEPROXY'                             HTTP/1.1 RFC 7231(21), Section 6.4.5\n\n\n'307'       'TEMPORARYREDIRECT'                    HTTP/1.1 RFC 7231(22), Section 6.4.7\n\n\n'308'       'PERMANENTREDIRECT'                    Permanent Redirect RFC 7238(23), Section 3 (Experimental)\n\n\n'400'       'BADREQUEST'                           HTTP/1.1 RFC 7231(24), Section 6.5.1\n\n\n'401'       'UNAUTHORIZED'                          HTTP/1.1 Authentication RFC 7235(25), Section 3.1\n\n\n'402'       'PAYMENTREQUIRED'                      HTTP/1.1 RFC 7231(26), Section 6.5.2\n\n\n'403'       'FORBIDDEN'                             HTTP/1.1 RFC 7231(27), Section 6.5.3\n\n\n'404'       'NOTFOUND'                             HTTP/1.1 RFC 7231(28), Section 6.5.4\n\n\n'405'       'METHODNOTALLOWED'                    HTTP/1.1 RFC 7231(29), Section 6.5.5\n\n\n'406'       'NOTACCEPTABLE'                        HTTP/1.1 RFC 7231(30), Section 6.5.6\n\n\n'407'       'PROXYAUTHENTICATIONREQUIRED'         HTTP/1.1 Authentication RFC 7235(31), Section 3.2\n\n\n'408'       'REQUESTTIMEOUT'                       HTTP/1.1 RFC 7231(32), Section 6.5.7\n\n\n'409'       'CONFLICT'                              HTTP/1.1 RFC 7231(33), Section 6.5.8\n\n\n'410'       'GONE'                                  HTTP/1.1 RFC 7231(34), Section 6.5.9\n\n\n'411'       'LENGTHREQUIRED'                       HTTP/1.1 RFC 7231(35), Section 6.5.10\n\n\n'412'       'PRECONDITIONFAILED'                   HTTP/1.1 RFC 7232(36), Section 4.2\n\n\n'413'       'REQUESTENTITYTOOLARGE'              HTTP/1.1 RFC 7231(37), Section 6.5.11\n\n\n'414'       'REQUESTURITOOLONG'                  HTTP/1.1 RFC 7231(38), Section 6.5.12\n\n\n'415'       'UNSUPPORTEDMEDIATYPE'                HTTP/1.1 RFC 7231(39), Section 6.5.13\n\n\n'416'       'REQUESTEDRANGENOTSATISFIABLE'       HTTP/1.1 Range Requests RFC 7233(40), Section 4.4\n\n\n'417'       'EXPECTATIONFAILED'                    HTTP/1.1 RFC 7231(41), Section 6.5.14\n\n\n'418'       'IMATEAPOT'                           HTCPCP/1.0 RFC 2324(42), Section 2.3.2\n\n\n'421'       'MISDIRECTEDREQUEST'                   HTTP/2 RFC 7540(43), Section 9.1.2\n\n\n'422'       'UNPROCESSABLEENTITY'                  WebDAV RFC 4918(44), Section 11.2\n\n\n'423'       'LOCKED'                                WebDAV RFC 4918(45), Section 11.3\n\n\n'424'       'FAILEDDEPENDENCY'                     WebDAV RFC 4918(46), Section 11.4\n\n\n'425'       'TOOEARLY'                             Using Early Data in HTTP RFC 8470(47)\n\n\n'426'       'UPGRADEREQUIRED'                      HTTP/1.1 RFC 7231(48), Section 6.5.15\n\n\n'428'       'PRECONDITIONREQUIRED'                 Additional HTTP Status Codes RFC 6585(49)\n\n\n'429'       'TOOMANYREQUESTS'                     Additional HTTP Status Codes RFC 6585(50)\n\n\n'431'       'REQUESTHEADERFIELDSTOOLARGE'       Additional HTTP Status Codes RFC 6585(51)\n\n\n'451'       'UNAVAILABLEFORLEGALREASONS'         An HTTP Status Code to Report Legal Obstacles RFC 7725(52)\n\n\n'500'       'INTERNALSERVERERROR'                 HTTP/1.1 RFC 7231(53), Section 6.6.1\n\n\n'501'       'NOTIMPLEMENTED'                       HTTP/1.1 RFC 7231(54), Section 6.6.2\n\n\n'502'       'BADGATEWAY'                           HTTP/1.1 RFC 7231(55), Section 6.6.3\n\n\n'503'       'SERVICEUNAVAILABLE'                   HTTP/1.1 RFC 7231(56), Section 6.6.4\n\n\n'504'       'GATEWAYTIMEOUT'                       HTTP/1.1 RFC 7231(57), Section 6.6.5\n\n\n'505'       'HTTPVERSIONNOTSUPPORTED'            HTTP/1.1 RFC 7231(58), Section 6.6.6\n\n\n'506'       'VARIANTALSONEGOTIATES'               Transparent Content Negotiation in HTTP RFC 2295(59), Section 8.1 (Experimental)\n\n\n'507'       'INSUFFICIENTSTORAGE'                  WebDAV RFC 4918(60), Section 11.5\n\n\n'508'       'LOOPDETECTED'                         WebDAV Binding Extensions RFC 5842(61), Section 7.2 (Experimental)\n\n\n'510'       'NOTEXTENDED'                          An HTTP Extension Framework RFC 2774(62), Section 7 (Experimental)\n\n\n'511'       'NETWORKAUTHENTICATIONREQUIRED'       Additional HTTP Status Codes RFC 6585(63), Section 6\n\n",
            "subsections": []
        },
        "In order to preserve backwards compatibility, enum values are also": {
            "content": "present in the *note http.client: 6a. module in the form of constants.",
            "subsections": []
        },
        "The enum name is equal to the constant name (i.e.  'http.HTTPStatus.OK'": {
            "content": "is also available as 'http.client.OK').\n\nChanged in version 3.7: Added '421 MISDIRECTEDREQUEST' status code.\n",
            "subsections": []
        },
        "New in version 3.8: Added '451 UNAVAILABLEFORLEGALREASONS' status": {
            "content": "code.\n",
            "subsections": []
        },
        "New in version 3.9: Added '103 EARLYHINTS', '418 IMATEAPOT' and '425": {
            "content": "TOOEARLY' status codes.\n\n---------- Footnotes ----------\n\n(1)\nhttps://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml\n\n(2) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc2518.html\n\n(5) https://datatracker.ietf.org/doc/html/rfc8297.html\n\n(6) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(7) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(8) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(9) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(10) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(11) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(12) https://datatracker.ietf.org/doc/html/rfc7233.html\n\n(13) https://datatracker.ietf.org/doc/html/rfc4918.html\n\n(14) https://datatracker.ietf.org/doc/html/rfc5842.html\n\n(15) https://datatracker.ietf.org/doc/html/rfc3229.html\n\n(16) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(17) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(18) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(19) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(20) https://datatracker.ietf.org/doc/html/rfc7232.html\n\n(21) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(22) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(23) https://datatracker.ietf.org/doc/html/rfc7238.html\n\n(24) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(25) https://datatracker.ietf.org/doc/html/rfc7235.html\n\n(26) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(27) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(28) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(29) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(30) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(31) https://datatracker.ietf.org/doc/html/rfc7235.html\n\n(32) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(33) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(34) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(35) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(36) https://datatracker.ietf.org/doc/html/rfc7232.html\n\n(37) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(38) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(39) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(40) https://datatracker.ietf.org/doc/html/rfc7233.html\n\n(41) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(42) https://datatracker.ietf.org/doc/html/rfc2324.html\n\n(43) https://datatracker.ietf.org/doc/html/rfc7540.html\n\n(44) https://datatracker.ietf.org/doc/html/rfc4918.html\n\n(45) https://datatracker.ietf.org/doc/html/rfc4918.html\n\n(46) https://datatracker.ietf.org/doc/html/rfc4918.html\n\n(47) https://datatracker.ietf.org/doc/html/rfc8470.html\n\n(48) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(49) https://datatracker.ietf.org/doc/html/rfc6585.html\n\n(50) https://datatracker.ietf.org/doc/html/rfc6585.html\n\n(51) https://datatracker.ietf.org/doc/html/rfc6585.html\n\n(52) https://datatracker.ietf.org/doc/html/rfc7725.html\n\n(53) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(54) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(55) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(56) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(57) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(58) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(59) https://datatracker.ietf.org/doc/html/rfc2295.html\n\n(60) https://datatracker.ietf.org/doc/html/rfc4918.html\n\n(61) https://datatracker.ietf.org/doc/html/rfc5842.html\n\n(62) https://datatracker.ietf.org/doc/html/rfc2774.html\n\n(63) https://datatracker.ietf.org/doc/html/rfc6585.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: HTTP status category,  Next: HTTP methods,  Prev: HTTP status codes,  Up: http -- HTTP modules": {
            "content": "5.21.9.2 HTTP status category\n.............................\n\nNew in version 3.12.\n",
            "subsections": []
        },
        "The enum values have several properties to indicate the HTTP status": {
            "content": "category:\n",
            "subsections": []
        },
        "Property                 Indicates that               Details": {
            "content": "------------------------------------------------------------------------------------------\n\n'isinformational'       '100 <= status <= 199'       HTTP/1.1 RFC 7231(1), Section 6\n\n\n'issuccess'             '200 <= status <= 299'       HTTP/1.1 RFC 7231(2), Section 6\n\n\n'isredirection'         '300 <= status <= 399'       HTTP/1.1 RFC 7231(3), Section 6\n\n\n'isclienterror'        '400 <= status <= 499'       HTTP/1.1 RFC 7231(4), Section 6\n\n\n'isservererror'        '500 <= status <= 599'       HTTP/1.1 RFC 7231(5), Section 6\n\n\nUsage:\n\n>>> from http import HTTPStatus\n>>> HTTPStatus.OK.issuccess\nTrue\n>>> HTTPStatus.OK.isclienterror\nFalse\n\n-- Class: http.HTTPMethod\n\nNew in version 3.11.\n\nA subclass of *note enum.StrEnum: 3e6. that defines a set of HTTP\nmethods and descriptions written in English.\n\nUsage:\n\n>>> from http import HTTPMethod\n>>>\n>>> HTTPMethod.GET\n<HTTPMethod.GET>\n>>> HTTPMethod.GET == 'GET'\nTrue\n>>> HTTPMethod.GET.value\n'GET'\n>>> HTTPMethod.GET.description\n'Retrieve the target.'\n>>> list(HTTPMethod)\n[<HTTPMethod.CONNECT>,\n<HTTPMethod.DELETE>,\n<HTTPMethod.GET>,\n<HTTPMethod.HEAD>,\n<HTTPMethod.OPTIONS>,\n<HTTPMethod.PATCH>,\n<HTTPMethod.POST>,\n<HTTPMethod.PUT>,\n<HTTPMethod.TRACE>]\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(2) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(5) https://datatracker.ietf.org/doc/html/rfc7231.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: HTTP methods,  Prev: HTTP status category,  Up: http -- HTTP modules": {
            "content": "5.21.9.3 HTTP methods\n.....................\n\nSupported, IANA-registered methods(1) available in *note\nhttp.HTTPMethod: 368a. are:\n",
            "subsections": []
        },
        "Method          Enum Name                               Details": {
            "content": "-------------------------------------------------------------------------------------------------------------------------------\n\n'GET'           'GET'                                   HTTP/1.1 RFC 7231(2), Section 4.3.1\n\n\n'HEAD'          'HEAD'                                  HTTP/1.1 RFC 7231(3), Section 4.3.2\n\n\n'POST'          'POST'                                  HTTP/1.1 RFC 7231(4), Section 4.3.3\n\n\n'PUT'           'PUT'                                   HTTP/1.1 RFC 7231(5), Section 4.3.4\n\n\n'DELETE'        'DELETE'                                HTTP/1.1 RFC 7231(6), Section 4.3.5\n\n\n'CONNECT'       'CONNECT'                               HTTP/1.1 RFC 7231(7), Section 4.3.6\n\n\n'OPTIONS'       'OPTIONS'                               HTTP/1.1 RFC 7231(8), Section 4.3.7\n\n\n'TRACE'         'TRACE'                                 HTTP/1.1 RFC 7231(9), Section 4.3.8\n\n\n'PATCH'         'PATCH'                                 HTTP/1.1 RFC 5789(10)\n\n\n---------- Footnotes ----------\n\n(1) https://www.iana.org/assignments/http-methods/http-methods.xhtml\n\n(2) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(5) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(6) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(7) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(8) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(9) https://datatracker.ietf.org/doc/html/rfc7231.html\n\n(10) https://datatracker.ietf.org/doc/html/rfc5789.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: http client -- HTTP protocol client,  Next: ftplib -- FTP protocol client,  Prev: http -- HTTP modules,  Up: Internet Protocols and Support": {
            "content": "'Source code:' Lib/http/client.py(1)\n\n\n",
            "subsections": []
        },
        "This module defines classes that implement the client side of the HTTP": {
            "content": "and HTTPS protocols.  It is normally not used directly -- the module\n*note urllib.request: 106. uses it to handle URLs that use HTTP and\nHTTPS.\n\nSee also\n........\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: HTTPConnection Objects,  Next: HTTPResponse Objects,  Up: http client -- HTTP protocol client": {
            "content": "5.21.10.1 HTTPConnection Objects\n................................\n\n*note HTTPConnection: 97a. instances have the following methods:\n\n-- Method: HTTPConnection.request (method, url, body=None, headers={},\n*, encodechunked=False)\n\nThis will send a request to the server using the HTTP request\nmethod 'method' and the request URI 'url'.  The provided 'url' must\nbe an absolute path to conform with RFC 2616 ??5.1.2(1) (unless\nconnecting to an HTTP proxy server or using the 'OPTIONS' or\n'CONNECT' methods).\n\nIf 'body' is specified, the specified data is sent after the\nheaders are finished.  It may be a *note str: 157, a *note\nbytes-like object: b82, an open *note file object: 1037, or an\niterable of *note bytes: 295.  If 'body' is a string, it is encoded\nas ISO-8859-1, the default for HTTP. If it is a bytes-like object,\nthe bytes are sent as is.  If it is a *note file object: 1037, the\ncontents of the file is sent; this file object should support at\nleast the 'read()' method.  If the file object is an instance of\n*note io.TextIOBase: 461, the data returned by the 'read()' method\nwill be encoded as ISO-8859-1, otherwise the data returned by\n'read()' is sent as is.  If 'body' is an iterable, the elements of\nthe iterable are sent as is until the iterable is exhausted.\n\nThe 'headers' argument should be a mapping of extra HTTP headers to\nsend with the request.  A Host header(2) must be provided to\nconform with RFC 2616 ??5.1.2(3) (unless connecting to an HTTP proxy\nserver or using the 'OPTIONS' or 'CONNECT' methods).\n\nIf 'headers' contains neither Content-Length nor Transfer-Encoding,\nbut there is a request body, one of those header fields will be\nadded automatically.  If 'body' is 'None', the Content-Length\nheader is set to '0' for methods that expect a body ('PUT', 'POST',\nand 'PATCH').  If 'body' is a string or a bytes-like object that is\nnot also a *note file: 1037, the Content-Length header is set to\nits length.  Any other type of 'body' (files and iterables in\ngeneral) will be chunk-encoded, and the Transfer-Encoding header\nwill automatically be set instead of Content-Length.\n\nThe 'encodechunked' argument is only relevant if Transfer-Encoding\nis specified in 'headers'.  If 'encodechunked' is 'False', the\nHTTPConnection object assumes that all encoding is handled by the\ncalling code.  If it is 'True', the body will be chunk-encoded.\n\nFor example, to perform a 'GET' request to\n'https://docs.python.org/3/':\n\n>>> import http.client\n>>> host = \"docs.python.org\"\n>>> conn = http.client.HTTPSConnection(host)\n>>> conn.request(\"GET\", \"/3/\", headers={\"Host\": host})\n>>> response = conn.getresponse()\n>>> print(response.status, response.reason)\n200 OK\n\nNote: Chunked transfer encoding has been added to the HTTP\nprotocol version 1.1.  Unless the HTTP server is known to\nhandle HTTP 1.1, the caller must either specify the\nContent-Length, or must pass a *note str: 157. or bytes-like\nobject that is not also a file as the body representation.\n\nChanged in version 3.2: 'body' can now be an iterable.\n\nChanged in version 3.6: If neither Content-Length nor\nTransfer-Encoding are set in 'headers', file and iterable 'body'\nobjects are now chunk-encoded.  The 'encodechunked' argument was\nadded.  No attempt is made to determine the Content-Length for file\nobjects.\n\n-- Method: HTTPConnection.getresponse ()\n\nShould be called after a request is sent to get the response from\nthe server.  Returns an *note HTTPResponse: f3e. instance.\n\nNote: Note that you must have read the whole response before\nyou can send a new request to the server.\n\nChanged in version 3.5: If a *note ConnectionError: c67. or\nsubclass is raised, the *note HTTPConnection: 97a. object will be\nready to reconnect when a new request is sent.\n\n-- Method: HTTPConnection.setdebuglevel (level)\n\nSet the debugging level.  The default debug level is '0', meaning\nno debugging output is printed.  Any value greater than '0' will\ncause all currently defined debug output to be printed to stdout.\nThe 'debuglevel' is passed to any new *note HTTPResponse: f3e.\nobjects that are created.\n\nNew in version 3.1.\n\n-- Method: HTTPConnection.settunnel (host, port=None, headers=None)\n\nSet the host and the port for HTTP Connect Tunnelling.  This allows\nrunning the connection through a proxy server.\n\nThe 'host' and 'port' arguments specify the endpoint of the\ntunneled connection (i.e.  the address included in the CONNECT\nrequest, 'not' the address of the proxy server).\n\nThe 'headers' argument should be a mapping of extra HTTP headers to\nsend with the CONNECT request.\n\nAs HTTP/1.1 is used for HTTP CONNECT tunnelling request, as per the\nRFC(4), a HTTP 'Host:' header must be provided, matching the\nauthority-form of the request target provided as the destination\nfor the CONNECT request.  If a HTTP 'Host:' header is not provided\nvia the headers argument, one is generated and transmitted\nautomatically.\n\nFor example, to tunnel through a HTTPS proxy server running locally\non port 8080, we would pass the address of the proxy to the *note\nHTTPSConnection: 97b. constructor, and the address of the host that\nwe eventually want to reach to the *note settunnel(): 109e.\nmethod:\n\n>>> import http.client\n>>> conn = http.client.HTTPSConnection(\"localhost\", 8080)\n>>> conn.settunnel(\"www.python.org\")\n>>> conn.request(\"HEAD\",\"/index.html\")\n\nNew in version 3.2.\n\nChanged in version 3.12: HTTP CONNECT tunnelling requests use\nprotocol HTTP/1.1, upgraded from protocol HTTP/1.0.  'Host:' HTTP\nheaders are mandatory for HTTP/1.1, so one will be automatically\ngenerated and transmitted if not provided in the headers argument.\n\n-- Method: HTTPConnection.getproxyresponseheaders ()\n\nReturns a dictionary with the headers of the response received from\nthe proxy server to the CONNECT request.\n\nIf the CONNECT request was not sent, the method returns 'None'.\n\nNew in version 3.12.\n\n-- Method: HTTPConnection.connect ()\n\nConnect to the server specified when the object was created.  By\ndefault, this is called automatically when making a request if the\nclient does not already have a connection.\n\nRaises an *note auditing event: 161d. 'http.client.connect' with\narguments 'self', 'host', 'port'.\n\n-- Method: HTTPConnection.close ()\n\nClose the connection to the server.\n\n-- Attribute: HTTPConnection.blocksize\n\nBuffer size in bytes for sending a file-like message body.\n\nNew in version 3.7.\n\nAs an alternative to using the *note request(): af8. method described\nabove, you can also send your request step by step, by using the four\nfunctions below.\n\n-- Method: HTTPConnection.putrequest (method, url, skiphost=False,\nskipacceptencoding=False)\n\nThis should be the first call after the connection to the server\nhas been made.  It sends a line to the server consisting of the\n'method' string, the 'url' string, and the HTTP version\n('HTTP/1.1').  To disable automatic sending of 'Host:' or\n'Accept-Encoding:' headers (for example to accept additional\ncontent encodings), specify 'skiphost' or 'skipacceptencoding'\nwith non-False values.\n\n-- Method: HTTPConnection.putheader (header, argument[, ...])\n\nSend an RFC 822(5)-style header to the server.  It sends a line to\nthe server consisting of the header, a colon and a space, and the\nfirst argument.  If more arguments are given, continuation lines\nare sent, each consisting of a tab and an argument.\n\n-- Method: HTTPConnection.endheaders (messagebody=None, *,\nencodechunked=False)\n\nSend a blank line to the server, signalling the end of the headers.\nThe optional 'messagebody' argument can be used to pass a message\nbody associated with the request.\n\nIf 'encodechunked' is 'True', the result of each iteration of\n'messagebody' will be chunk-encoded as specified in RFC 7230(6),\nSection 3.3.1.  How the data is encoded is dependent on the type of\n'messagebody'.  If 'messagebody' implements the *note buffer\ninterface: 148. the encoding will result in a single chunk.  If\n'messagebody' is a *note collections.abc.Iterable: 1f5b, each\niteration of 'messagebody' will result in a chunk.  If\n'messagebody' is a *note file object: 1037, each call to '.read()'\nwill result in a chunk.  The method automatically signals the end\nof the chunk-encoded data immediately after 'messagebody'.\n\nNote: Due to the chunked encoding specification, empty chunks\nyielded by an iterator body will be ignored by the\nchunk-encoder.  This is to avoid premature termination of the\nread of the request by the target server due to malformed\nencoding.\n\nChanged in version 3.6: Added chunked encoding support and the\n'encodechunked' parameter.\n\n-- Method: HTTPConnection.send (data)\n\nSend data to the server.  This should be used directly only after\nthe *note endheaders(): af9. method has been called and before\n*note getresponse(): c65. is called.\n\nRaises an *note auditing event: 161d. 'http.client.send' with\narguments 'self', 'data'.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc2616.html#section-5.1.2\n\n(2) https://datatracker.ietf.org/doc/html/rfc2616.html#section-14.23\n\n(3) https://datatracker.ietf.org/doc/html/rfc2616.html#section-5.1.2\n\n(4) https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.6\n\n(5) https://datatracker.ietf.org/doc/html/rfc822.html\n\n(6) https://datatracker.ietf.org/doc/html/rfc7230.html\n\nFile: python3.12.info,  Node: HTTPResponse Objects,  Next: Examples<26>,  Prev: HTTPConnection Objects,  Up: http client -- HTTP protocol client\n\n5.21.10.2 HTTPResponse Objects\n..............................\n\nAn *note HTTPResponse: f3e. instance wraps the HTTP response from the\nserver.  It provides access to the request headers and the entity body.\nThe response is an iterable object and can be used in a with statement.\n\nChanged in version 3.5: The *note io.BufferedIOBase: 460. interface is\nnow implemented and all of its reader operations are supported.\n\n-- Method: HTTPResponse.read ([amt])\n\nReads and returns the response body, or up to the next 'amt' bytes.\n\n-- Method: HTTPResponse.readinto (b)\n\nReads up to the next len(b) bytes of the response body into the\nbuffer 'b'.  Returns the number of bytes read.\n\nNew in version 3.3.\n\n-- Method: HTTPResponse.getheader (name, default=None)\n\nReturn the value of the header 'name', or 'default' if there is no\nheader matching 'name'.  If there is more than one header with the\nname 'name', return all of the values joined by ', '.  If 'default'\nis any iterable other than a single string, its elements are\nsimilarly returned joined by commas.\n\n-- Method: HTTPResponse.getheaders ()\n\nReturn a list of (header, value) tuples.\n\n-- Method: HTTPResponse.fileno ()\n\nReturn the 'fileno' of the underlying socket.\n\n-- Attribute: HTTPResponse.msg\n\nA *note http.client.HTTPMessage: 368f. instance containing the\nresponse headers.  *note http.client.HTTPMessage: 368f. is a\nsubclass of *note email.message.Message: ae7.\n\n-- Attribute: HTTPResponse.version\n\nHTTP protocol version used by server.  10 for HTTP/1.0, 11 for\nHTTP/1.1.\n\n-- Attribute: HTTPResponse.url\n\nURL of the resource retrieved, commonly used to determine if a\nredirect was followed.\n\n-- Attribute: HTTPResponse.headers\n\nHeaders of the response in the form of an *note\nemail.message.EmailMessage: ae8. instance.\n\n-- Attribute: HTTPResponse.status\n\nStatus code returned by server.\n\n-- Attribute: HTTPResponse.reason\n\nReason phrase returned by server.\n\n-- Attribute: HTTPResponse.debuglevel\n\nA debugging hook.  If *note debuglevel: 36b4. is greater than zero,\nmessages will be printed to stdout as the response is read and\nparsed.\n\n-- Attribute: HTTPResponse.closed\n\nIs 'True' if the stream is closed.\n\n-- Method: HTTPResponse.geturl ()\n\nDeprecated since version 3.9: Deprecated in favor of *note url:\n36b1.\n\n-- Method: HTTPResponse.info ()\n\nDeprecated since version 3.9: Deprecated in favor of *note headers:\n36b2.\n\n-- Method: HTTPResponse.getcode ()\n\nDeprecated since version 3.9: Deprecated in favor of *note status:\n36b3.\n\nFile: python3.12.info,  Node: Examples<26>,  Next: HTTPMessage Objects,  Prev: HTTPResponse Objects,  Up: http client -- HTTP protocol client\n\n5.21.10.3 Examples\n..................\n\nHere is an example session that uses the 'GET' method:\n\n>>> import http.client\n>>> conn = http.client.HTTPSConnection(\"www.python.org\")\n>>> conn.request(\"GET\", \"/\")\n>>> r1 = conn.getresponse()\n>>> print(r1.status, r1.reason)\n200 OK\n>>> data1 = r1.read()  # This will return entire content.\n>>> # The following example demonstrates reading data in chunks.\n>>> conn.request(\"GET\", \"/\")\n>>> r1 = conn.getresponse()\n>>> while chunk := r1.read(200):\n...     print(repr(chunk))\nb'<!doctype html>\\n<!--[if\"...\n...\n>>> # Example of an invalid request\n>>> conn = http.client.HTTPSConnection(\"docs.python.org\")\n>>> conn.request(\"GET\", \"/parrot.spam\")\n>>> r2 = conn.getresponse()\n>>> print(r2.status, r2.reason)\n404 Not Found\n>>> data2 = r2.read()\n>>> conn.close()\n",
            "subsections": []
        },
        "Here is an example session that uses the 'HEAD' method.  Note that the": {
            "content": "'HEAD' method never returns any data.\n\n>>> import http.client\n>>> conn = http.client.HTTPSConnection(\"www.python.org\")\n>>> conn.request(\"HEAD\", \"/\")\n>>> res = conn.getresponse()\n>>> print(res.status, res.reason)\n200 OK\n>>> data = res.read()\n>>> print(len(data))\n0\n>>> data == b''\nTrue\n\nHere is an example session that uses the 'POST' method:\n\n>>> import http.client, urllib.parse\n>>> params = urllib.parse.urlencode({'@number': 12524, '@type': 'issue', '@action': 'show'})\n>>> headers = {\"Content-type\": \"application/x-www-form-urlencoded\",\n...            \"Accept\": \"text/plain\"}\n>>> conn = http.client.HTTPConnection(\"bugs.python.org\")\n>>> conn.request(\"POST\", \"\", params, headers)\n>>> response = conn.getresponse()\n>>> print(response.status, response.reason)\n302 Found\n>>> data = response.read()\n>>> data\nb'Redirecting to <a href=\"https://bugs.python.org/issue12524\">https://bugs.python.org/issue12524</a>'\n>>> conn.close()\n\nClient side HTTP 'PUT' requests are very similar to 'POST' requests.",
            "subsections": []
        },
        "The difference lies only on the server side where HTTP servers will": {
            "content": "allow resources to be created via 'PUT' requests.  It should be noted\nthat custom HTTP methods are also handled in *note\nurllib.request.Request: e4b. by setting the appropriate method\nattribute.  Here is an example session that uses the 'PUT' method:\n\n>>> # This creates an HTTP request\n>>> # with the content of BODY as the enclosed representation\n>>> # for the resource http://localhost:8080/file\n...\n>>> import http.client\n>>> BODY = \"*filecontents*\"\n>>> conn = http.client.HTTPConnection(\"localhost\", 8080)\n>>> conn.request(\"PUT\", \"/file\", BODY)\n>>> response = conn.getresponse()\n>>> print(response.status, response.reason)\n200, OK\n\nFile: python3.12.info,  Node: HTTPMessage Objects,  Prev: Examples<26>,  Up: http client -- HTTP protocol client\n\n5.21.10.4 HTTPMessage Objects\n.............................\n\n-- Class: http.client.HTTPMessage (email.message.Message)\n\nAn *note http.client.HTTPMessage: 368f. instance holds the headers from\nan HTTP response.  It is implemented using the *note\nemail.message.Message: ae7. class.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ftplib -- FTP protocol client,  Next: poplib -- POP3 protocol client,  Prev: http client -- HTTP protocol client,  Up: Internet Protocols and Support": {
            "content": "'Source code:' Lib/ftplib.py(1)\n\n\n\nThis module defines the class *note FTP: 715. and a few related items.\nThe *note FTP: 715. class implements the client side of the FTP\nprotocol.  You can use this to write Python programs that perform a\nvariety of automated FTP jobs, such as mirroring other FTP servers.  It\nis also used by the module *note urllib.request: 106. to handle URLs\nthat use FTP. For more information on FTP (File Transfer Protocol), see\ninternet RFC 959(2).\n\nThe default encoding is UTF-8, following RFC 2640(3).\n\n*note Availability: 1ad3.: not Emscripten, not WASI.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: poplib -- POP3 protocol client,  Next: imaplib -- IMAP4 protocol client,  Prev: ftplib -- FTP protocol client,  Up: Internet Protocols and Support": {
            "content": "'Source code:' Lib/poplib.py(1)\n\n\n\nThis module defines a class, *note POP3: 742, which encapsulates a\nconnection to a POP3 server and implements the protocol as defined in\nRFC 1939(2).  The *note POP3: 742. class supports both the minimal and\noptional command sets from RFC 1939(3).  The *note POP3: 742. class also\nsupports the 'STLS' command introduced in RFC 2595(4) to enable\nencrypted communication on an already established connection.\n\nAdditionally, this module provides a class *note POP3SSL: 743, which\nprovides support for connecting to POP3 servers that use SSL as an\nunderlying protocol layer.\n",
            "subsections": []
        },
        "Note that POP3, though widely supported, is obsolescent.  The": {
            "content": "implementation quality of POP3 servers varies widely, and too many are\nquite poor.  If your mailserver supports IMAP, you would be better off\nusing the *note imaplib.IMAP4: 71e. class, as IMAP servers tend to be\nbetter implemented.\n\n*note Availability: 1ad3.: not Emscripten, not WASI.\n",
            "subsections": []
        },
        "Frequently Asked Questions About Fetchmail(5)": {
            "content": "The FAQ for the 'fetchmail' POP/IMAP client collects information on\nPOP3 server variations and RFC noncompliance that may be useful if\nyou need to write an application based on the POP protocol.\n\n* Menu:\n\n* POP3 Objects::\n* POP3 Example::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/poplib.py\n\n(2) https://datatracker.ietf.org/doc/html/rfc1939.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc1939.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc2595.html\n\n(5) http://www.catb.org/~esr/fetchmail/fetchmail-FAQ.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: POP3 Objects,  Next: POP3 Example,  Up: poplib -- POP3 protocol client": {
            "content": "5.21.12.1 POP3 Objects\n......................\n",
            "subsections": []
        },
        "All POP3 commands are represented by methods of the same name, in": {
            "content": "lowercase; most return the response text sent by the server.\n\nA *note POP3: 742. instance has the following methods:\n\n-- Method: POP3.setdebuglevel (level)\n\nSet the instance's debugging level.  This controls the amount of\ndebugging output printed.  The default, '0', produces no debugging\noutput.  A value of '1' produces a moderate amount of debugging\noutput, generally a single line per request.  A value of '2' or\nhigher produces the maximum amount of debugging output, logging\neach line sent and received on the control connection.\n\n-- Method: POP3.getwelcome ()\n\nReturns the greeting string sent by the POP3 server.\n\n-- Method: POP3.capa ()\n\nQuery the server's capabilities as specified in RFC 2449(1).\nReturns a dictionary in the form '{'name': ['param'...]}'.\n\nNew in version 3.4.\n\n-- Method: POP3.user (username)\n\nSend user command, response should indicate that a password is\nrequired.\n\n-- Method: POP3.pass (password)\n\nSend password, response includes message count and mailbox size.\nNote: the mailbox on the server is locked until *note quit(): 1010.\nis called.\n\n-- Method: POP3.apop (user, secret)\n\nUse the more secure APOP authentication to log into the POP3\nserver.\n\n-- Method: POP3.rpop (user)\n\nUse RPOP authentication (similar to UNIX r-commands) to log into\nPOP3 server.\n\n-- Method: POP3.stat ()\n\nGet mailbox status.  The result is a tuple of 2 integers: '(message\ncount, mailbox size)'.\n\n-- Method: POP3.list ([which])\n\nRequest message list, result is in the form '(response, ['mesgnum\noctets', ...], octets)'.  If 'which' is set, it is the message to\nlist.\n\n-- Method: POP3.retr (which)\n\nRetrieve whole message number 'which', and set its seen flag.\nResult is in form '(response, ['line', ...], octets)'.\n\n-- Method: POP3.dele (which)\n\nFlag message number 'which' for deletion.  On most servers\ndeletions are not actually performed until QUIT (the major\nexception is Eudora QPOP, which deliberately violates the RFCs by\ndoing pending deletes on any disconnect).\n\n-- Method: POP3.rset ()\n\nRemove any deletion marks for the mailbox.\n\n-- Method: POP3.noop ()\n\nDo nothing.  Might be used as a keep-alive.\n\n-- Method: POP3.quit ()\n\nSignoff: commit changes, unlock mailbox, drop connection.\n\n-- Method: POP3.top (which, howmuch)\n\nRetrieves the message header plus 'howmuch' lines of the message\nafter the header of message number 'which'.  Result is in form\n'(response, ['line', ...], octets)'.\n\nThe POP3 TOP command this method uses, unlike the RETR command,\ndoesn't set the message's seen flag; unfortunately, TOP is poorly\nspecified in the RFCs and is frequently broken in off-brand\nservers.  Test this method by hand against the POP3 servers you\nwill use before trusting it.\n\n-- Method: POP3.uidl (which=None)\n\nReturn message digest (unique id) list.  If 'which' is specified,\nresult contains the unique id for that message in the form\n''response mesgnum uid', otherwise result is list '(response,\n['mesgnum uid', ...], octets)'.\n\n-- Method: POP3.utf8 ()\n\nTry to switch to UTF-8 mode.  Returns the server response if\nsuccessful, raises *note errorproto: 1011. if not.  Specified in\nRFC 6856(2).\n\nNew in version 3.5.\n\n-- Method: POP3.stls (context=None)\n\nStart a TLS session on the active connection as specified in RFC\n2595(3).  This is only allowed before user authentication\n\n'context' parameter is a *note ssl.SSLContext: 278. object which\nallows bundling SSL configuration options, certificates and private\nkeys into a single (potentially long-lived) structure.  Please read\n*note Security considerations: 2f9c. for best practices.\n\nThis method supports hostname checking via *note\nssl.SSLContext.checkhostname: 30ba. and 'Server Name Indication'\n(see *note ssl.HASSNI: 30c7.).\n\nNew in version 3.4.\n\nInstances of *note POP3SSL: 743. have no additional methods.  The\ninterface of this subclass is identical to its parent.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc2449.html\n\n(2) https://datatracker.ietf.org/doc/html/rfc6856.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc2595.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: POP3 Example,  Prev: POP3 Objects,  Up: poplib -- POP3 protocol client": {
            "content": "5.21.12.2 POP3 Example\n......................\n",
            "subsections": []
        },
        "Here is a minimal example (without error checking) that opens a mailbox": {
            "content": "and retrieves and prints all messages:\n\nimport getpass, imaplib\n\nM = imaplib.IMAP4(host='example.org')\nM.login(getpass.getuser(), getpass.getpass())\nM.select()\ntyp, data = M.search(None, 'ALL')\nfor num in data[0].split():\ntyp, data = M.fetch(num, '(RFC822)')\nprint('Message %s\\n%s\\n' % (num, data[0][1]))\nM.close()\nM.logout()\n",
            "subsections": []
        },
        "At the end of the module, there is a test section that contains a more": {
            "content": "extensive example of usage.\n\nSee also\n........\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: imaplib -- IMAP4 protocol client,  Next: smtplib -- SMTP protocol client,  Prev: poplib -- POP3 protocol client,  Up: Internet Protocols and Support": {
            "content": "'Source code:' Lib/imaplib.py(1)\n\n\n\nThis module defines three classes, *note IMAP4: 71e, *note IMAP4SSL:\n71f. and *note IMAP4stream: 721, which encapsulate a connection to an\nIMAP4 server and implement a large subset of the IMAP4rev1 client\nprotocol as defined in RFC 2060(2).  It is backward compatible with\nIMAP4 ( RFC 1730(3)) servers, but note that the 'STATUS' command is not\nsupported in IMAP4.\n\n*note Availability: 1ad3.: not Emscripten, not WASI.\n",
            "subsections": []
        },
        "Note that IMAP4 message numbers change as the mailbox changes; in": {
            "content": "particular, after an 'EXPUNGE' command performs deletions the remaining\nmessages are renumbered.  So it is highly advisable to use UIDs instead,\nwith the UID command.\n",
            "subsections": []
        },
        "Documents describing the protocol, sources for servers implementing it,": {
            "content": "by the University of Washington's IMAP Information Center can all be\nfound at ('Source Code') 'https://github.com/uw-imap/imap' ('Not\nMaintained').\n\n* Menu:\n\n* IMAP4 Objects::\n* IMAP4 Example::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/imaplib.py\n\n(2) https://datatracker.ietf.org/doc/html/rfc2060.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc1730.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: IMAP4 Objects,  Next: IMAP4 Example,  Up: imaplib -- IMAP4 protocol client": {
            "content": "5.21.13.1 IMAP4 Objects\n.......................\n",
            "subsections": []
        },
        "All IMAP4rev1 commands are represented by methods of the same name,": {
            "content": "either uppercase or lowercase.\n",
            "subsections": []
        },
        "All arguments to commands are converted to strings, except for": {
            "content": "'AUTHENTICATE', and the last argument to 'APPEND' which is passed as an\nIMAP4 literal.  If necessary (the string contains IMAP4\nprotocol-sensitive characters and isn't enclosed with either parentheses\nor double quotes) each string is quoted.  However, the 'password'\nargument to the 'LOGIN' command is always quoted.  If you want to avoid\nhaving an argument string quoted (eg: the 'flags' argument to 'STORE')\nthen enclose the string in parentheses (eg: 'r'(\\Deleted)'').\n\nEach command returns a tuple: '(type, [data, ...])' where 'type' is\nusually ''OK'' or ''NO'', and 'data' is either the text from the command\nresponse, or mandated results from the command.  Each 'data' is either a\n'bytes', or a tuple.  If a tuple, then the first part is the header of\nthe response, and the second part contains the data (ie: 'literal'\nvalue).\n",
            "subsections": []
        },
        "The 'messageset' options to commands below is a string specifying one": {
            "content": "or more messages to be acted upon.  It may be a simple message number\n(''1''), a range of message numbers (''2:4''), or a group of\nnon-contiguous ranges separated by commas (''1:3,6:9'').  A range can\ncontain an asterisk to indicate an infinite upper bound (''3:*'').\n\nAn *note IMAP4: 71e. instance has the following methods:\n\n-- Method: IMAP4.append (mailbox, flags, datetime, message)\n\nAppend 'message' to named mailbox.\n\n-- Method: IMAP4.authenticate (mechanism, authobject)\n\nAuthenticate command -- requires response processing.\n\n'mechanism' specifies which authentication mechanism is to be used\n- it should appear in the instance variable 'capabilities' in the\nform 'AUTH=mechanism'.\n\n'authobject' must be a callable object:\n\ndata = authobject(response)\n\nIt will be called to process server continuation responses; the\n'response' argument it is passed will be 'bytes'.  It should return\n'bytes' 'data' that will be base64 encoded and sent to the server.\nIt should return 'None' if the client abort response '*' should be\nsent instead.\n\nChanged in version 3.5: string usernames and passwords are now\nencoded to 'utf-8' instead of being limited to ASCII.\n\n-- Method: IMAP4.check ()\n\nCheckpoint mailbox on server.\n\n-- Method: IMAP4.close ()\n\nClose currently selected mailbox.  Deleted messages are removed\nfrom writable mailbox.  This is the recommended command before\n'LOGOUT'.\n\n-- Method: IMAP4.copy (messageset, newmailbox)\n\nCopy 'messageset' messages onto end of 'newmailbox'.\n\n-- Method: IMAP4.create (mailbox)\n\nCreate new mailbox named 'mailbox'.\n\n-- Method: IMAP4.delete (mailbox)\n\nDelete old mailbox named 'mailbox'.\n\n-- Method: IMAP4.deleteacl (mailbox, who)\n\nDelete the ACLs (remove any rights) set for who on mailbox.\n\n-- Method: IMAP4.enable (capability)\n\nEnable 'capability' (see RFC 5161(1)).  Most capabilities do not\nneed to be enabled.  Currently only the 'UTF8=ACCEPT' capability is\nsupported (see RFC 6855(2)).\n\nNew in version 3.5: The *note enable(): c6a. method itself, and RFC\n6855(3) support.\n\n-- Method: IMAP4.expunge ()\n\nPermanently remove deleted items from selected mailbox.  Generates\nan 'EXPUNGE' response for each deleted message.  Returned data\ncontains a list of 'EXPUNGE' message numbers in order received.\n\n-- Method: IMAP4.fetch (messageset, messageparts)\n\nFetch (parts of) messages.  'messageparts' should be a string of\nmessage part names enclosed within parentheses, eg: '\"(UID\nBODY[TEXT])\"'.  Returned data are tuples of message part envelope\nand data.\n\n-- Method: IMAP4.getacl (mailbox)\n\nGet the 'ACL's for 'mailbox'.  The method is non-standard, but is\nsupported by the 'Cyrus' server.\n\n-- Method: IMAP4.getannotation (mailbox, entry, attribute)\n\nRetrieve the specified 'ANNOTATION's for 'mailbox'.  The method is\nnon-standard, but is supported by the 'Cyrus' server.\n\n-- Method: IMAP4.getquota (root)\n\nGet the 'quota' 'root''s resource usage and limits.  This method is\npart of the IMAP4 QUOTA extension defined in rfc2087.\n\n-- Method: IMAP4.getquotaroot (mailbox)\n\nGet the list of 'quota' 'roots' for the named 'mailbox'.  This\nmethod is part of the IMAP4 QUOTA extension defined in rfc2087.\n\n-- Method: IMAP4.list ([directory[, pattern]])\n\nList mailbox names in 'directory' matching 'pattern'.  'directory'\ndefaults to the top-level mail folder, and 'pattern' defaults to\nmatch anything.  Returned data contains a list of 'LIST' responses.\n\n-- Method: IMAP4.login (user, password)\n\nIdentify the client using a plaintext password.  The 'password'\nwill be quoted.\n\n-- Method: IMAP4.logincrammd5 (user, password)\n\nForce use of 'CRAM-MD5' authentication when identifying the client\nto protect the password.  Will only work if the server 'CAPABILITY'\nresponse includes the phrase 'AUTH=CRAM-MD5'.\n\n-- Method: IMAP4.logout ()\n\nShutdown connection to server.  Returns server 'BYE' response.\n\nChanged in version 3.8: The method no longer ignores silently\narbitrary exceptions.\n\n-- Method: IMAP4.lsub (directory='\"\"', pattern='*')\n\nList subscribed mailbox names in directory matching pattern.\n'directory' defaults to the top level directory and 'pattern'\ndefaults to match any mailbox.  Returned data are tuples of message\npart envelope and data.\n\n-- Method: IMAP4.myrights (mailbox)\n\nShow my ACLs for a mailbox (i.e.  the rights that I have on\nmailbox).\n\n-- Method: IMAP4.namespace ()\n\nReturns IMAP namespaces as defined in RFC 2342(4).\n\n-- Method: IMAP4.noop ()\n\nSend 'NOOP' to server.\n\n-- Method: IMAP4.open (host, port, timeout=None)\n\nOpens socket to 'port' at 'host'.  The optional 'timeout' parameter\nspecifies a timeout in seconds for the connection attempt.  If\ntimeout is not given or is None, the global default socket timeout\nis used.  Also note that if the 'timeout' parameter is set to be\nzero, it will raise a *note ValueError: 183. to reject creating a\nnon-blocking socket.  This method is implicitly called by the *note\nIMAP4: 71e. constructor.  The connection objects established by\nthis method will be used in the *note IMAP4.read(): 3717, *note\nIMAP4.readline(): 3718, *note IMAP4.send(): 3719, and *note\nIMAP4.shutdown(): 371a. methods.  You may override this method.\n\nRaises an *note auditing event: 161d. 'imaplib.open' with arguments\n'self', 'host', 'port'.\n\nChanged in version 3.9: The 'timeout' parameter was added.\n\n-- Method: IMAP4.partial (messagenum, messagepart, start, length)\n\nFetch truncated part of a message.  Returned data is a tuple of\nmessage part envelope and data.\n\n-- Method: IMAP4.proxyauth (user)\n\nAssume authentication as 'user'.  Allows an authorised\nadministrator to proxy into any user's mailbox.\n\n-- Method: IMAP4.read (size)\n\nReads 'size' bytes from the remote server.  You may override this\nmethod.\n\n-- Method: IMAP4.readline ()\n\nReads one line from the remote server.  You may override this\nmethod.\n\n-- Method: IMAP4.recent ()\n\nPrompt server for an update.  Returned data is 'None' if no new\nmessages, else value of 'RECENT' response.\n\n-- Method: IMAP4.rename (oldmailbox, newmailbox)\n\nRename mailbox named 'oldmailbox' to 'newmailbox'.\n\n-- Method: IMAP4.response (code)\n\nReturn data for response 'code' if received, or 'None'.  Returns\nthe given code, instead of the usual type.\n\n-- Method: IMAP4.search (charset, criterion[, ...])\n\nSearch mailbox for matching messages.  'charset' may be 'None', in\nwhich case no 'CHARSET' will be specified in the request to the\nserver.  The IMAP protocol requires that at least one criterion be\nspecified; an exception will be raised when the server returns an\nerror.  'charset' must be 'None' if the 'UTF8=ACCEPT' capability\nwas enabled using the *note enable(): c6a. command.\n\nExample:\n\n# M is a connected IMAP4 instance...\ntyp, msgnums = M.search(None, 'FROM', '\"LDJ\"')\n\n# or:\ntyp, msgnums = M.search(None, '(FROM \"LDJ\")')\n\n-- Method: IMAP4.select (mailbox='INBOX', readonly=False)\n\nSelect a mailbox.  Returned data is the count of messages in\n'mailbox' ('EXISTS' response).  The default 'mailbox' is ''INBOX''.\nIf the 'readonly' flag is set, modifications to the mailbox are not\nallowed.\n\n-- Method: IMAP4.send (data)\n\nSends 'data' to the remote server.  You may override this method.\n\nRaises an *note auditing event: 161d. 'imaplib.send' with arguments\n'self', 'data'.\n\n-- Method: IMAP4.setacl (mailbox, who, what)\n\nSet an 'ACL' for 'mailbox'.  The method is non-standard, but is\nsupported by the 'Cyrus' server.\n\n-- Method: IMAP4.setannotation (mailbox, entry, attribute[, ...])\n\nSet 'ANNOTATION's for 'mailbox'.  The method is non-standard, but\nis supported by the 'Cyrus' server.\n\n-- Method: IMAP4.setquota (root, limits)\n\nSet the 'quota' 'root''s resource 'limits'.  This method is part of\nthe IMAP4 QUOTA extension defined in rfc2087.\n\n-- Method: IMAP4.shutdown ()\n\nClose connection established in 'open'.  This method is implicitly\ncalled by *note IMAP4.logout(): 3712.  You may override this\nmethod.\n\n-- Method: IMAP4.socket ()\n\nReturns socket instance used to connect to server.\n\n-- Method: IMAP4.sort (sortcriteria, charset, searchcriterion[, ...])\n\nThe 'sort' command is a variant of 'search' with sorting semantics\nfor the results.  Returned data contains a space separated list of\nmatching message numbers.\n\nSort has two arguments before the 'searchcriterion' argument(s); a\nparenthesized list of 'sortcriteria', and the searching 'charset'.\nNote that unlike 'search', the searching 'charset' argument is\nmandatory.  There is also a 'uid sort' command which corresponds to\n'sort' the way that 'uid search' corresponds to 'search'.  The\n'sort' command first searches the mailbox for messages that match\nthe given searching criteria using the charset argument for the\ninterpretation of strings in the searching criteria.  It then\nreturns the numbers of matching messages.\n\nThis is an 'IMAP4rev1' extension command.\n\n-- Method: IMAP4.starttls (sslcontext=None)\n\nSend a 'STARTTLS' command.  The 'sslcontext' argument is optional\nand should be a *note ssl.SSLContext: 278. object.  This will\nenable encryption on the IMAP connection.  Please read *note\nSecurity considerations: 2f9c. for best practices.\n\nNew in version 3.2.\n\nChanged in version 3.4: The method now supports hostname check with\n*note ssl.SSLContext.checkhostname: 30ba. and 'Server Name\nIndication' (see *note ssl.HASSNI: 30c7.).\n\n-- Method: IMAP4.status (mailbox, names)\n\nRequest named status conditions for 'mailbox'.\n\n-- Method: IMAP4.store (messageset, command, flaglist)\n\nAlters flag dispositions for messages in mailbox.  'command' is\nspecified by section 6.4.6 of RFC 2060(5) as being one of \"FLAGS\",\n\"+FLAGS\", or \"-FLAGS\", optionally with a suffix of \".SILENT\".\n\nFor example, to set the delete flag on all messages:\n\ntyp, data = M.search(None, 'ALL')\nfor num in data[0].split():\nM.store(num, '+FLAGS', '\\\\Deleted')\nM.expunge()\n\nNote: Creating flags containing ']' (for example: \"[test]\")\nviolates RFC 3501(6) (the IMAP protocol).  However, imaplib\nhas historically allowed creation of such tags, and popular\nIMAP servers, such as Gmail, accept and produce such flags.\nThere are non-Python programs which also create such tags.\nAlthough it is an RFC violation and IMAP clients and servers\nare supposed to be strict, imaplib nonetheless continues to\nallow such tags to be created for backward compatibility\nreasons, and as of Python 3.6, handles them if they are sent\nfrom the server, since this improves real-world compatibility.\n\n-- Method: IMAP4.subscribe (mailbox)\n\nSubscribe to new mailbox.\n\n-- Method: IMAP4.thread (threadingalgorithm, charset,\nsearchcriterion[, ...])\n\nThe 'thread' command is a variant of 'search' with threading\nsemantics for the results.  Returned data contains a space\nseparated list of thread members.\n\nThread members consist of zero or more messages numbers, delimited\nby spaces, indicating successive parent and child.\n\nThread has two arguments before the 'searchcriterion' argument(s);\na 'threadingalgorithm', and the searching 'charset'.  Note that\nunlike 'search', the searching 'charset' argument is mandatory.\nThere is also a 'uid thread' command which corresponds to 'thread'\nthe way that 'uid search' corresponds to 'search'.  The 'thread'\ncommand first searches the mailbox for messages that match the\ngiven searching criteria using the 'charset' argument for the\ninterpretation of strings in the searching criteria.  It then\nreturns the matching messages threaded according to the specified\nthreading algorithm.\n\nThis is an 'IMAP4rev1' extension command.\n\n-- Method: IMAP4.uid (command, arg[, ...])\n\nExecute command args with messages identified by UID, rather than\nmessage number.  Returns response appropriate to command.  At least\none argument must be supplied; if none are provided, the server\nwill return an error and an exception will be raised.\n\n-- Method: IMAP4.unsubscribe (mailbox)\n\nUnsubscribe from old mailbox.\n\n-- Method: IMAP4.unselect ()\n\n*note imaplib.IMAP4.unselect(): 722. frees server's resources\nassociated with the selected mailbox and returns the server to the\nauthenticated state.  This command performs the same actions as\n*note imaplib.IMAP4.close(): 723, except that no messages are\npermanently removed from the currently selected mailbox.\n\nNew in version 3.9.\n\n-- Method: IMAP4.xatom (name[, ...])\n\nAllow simple extension commands notified by server in 'CAPABILITY'\nresponse.\n\nThe following attributes are defined on instances of *note IMAP4: 71e.:\n\n-- Attribute: IMAP4.PROTOCOLVERSION\n\nThe most recent supported protocol in the 'CAPABILITY' response\nfrom the server.\n\n-- Attribute: IMAP4.debug\n\nInteger value to control debugging output.  The initialize value is\ntaken from the module variable 'Debug'.  Values greater than three\ntrace each command.\n\n-- Attribute: IMAP4.utf8enabled\n\nBoolean value that is normally 'False', but is set to 'True' if an\n*note enable(): c6a. command is successfully issued for the\n'UTF8=ACCEPT' capability.\n\nNew in version 3.5.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc5161.html\n\n(2) https://datatracker.ietf.org/doc/html/rfc6855.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc6855.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc2342.html\n\n(5) https://datatracker.ietf.org/doc/html/rfc2060.html\n\n(6) https://datatracker.ietf.org/doc/html/rfc3501.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: IMAP4 Example,  Prev: IMAP4 Objects,  Up: imaplib -- IMAP4 protocol client": {
            "content": "5.21.13.2 IMAP4 Example\n.......................\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: smtplib -- SMTP protocol client,  Next: uuid -- UUID objects according to RFC 4122,  Prev: imaplib -- IMAP4 protocol client,  Up: Internet Protocols and Support": {
            "content": "'Source code:' Lib/smtplib.py(1)\n\n\n\nThe *note smtplib: c4. module defines an SMTP client session object that\ncan be used to send mail to any internet machine with an SMTP or ESMTP\nlistener daemon.  For details of SMTP and ESMTP operation, consult RFC\n821(2) (Simple Mail Transfer Protocol) and RFC 1869(3) (SMTP Service\nExtensions).\n\n*note Availability: 1ad3.: not Emscripten, not WASI.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: SMTP Objects,  Next: SMTP Example,  Up: smtplib -- SMTP protocol client": {
            "content": "5.21.14.1 SMTP Objects\n......................\n\nAn *note SMTP: 74b. instance has the following methods:\n\n-- Method: SMTP.setdebuglevel (level)\n\nSet the debug output level.  A value of 1 or 'True' for 'level'\nresults in debug messages for connection and for all messages sent\nto and received from the server.  A value of 2 for 'level' results\nin these messages being timestamped.\n\nChanged in version 3.5: Added debuglevel 2.\n\n-- Method: SMTP.docmd (cmd, args='')\n\nSend a command 'cmd' to the server.  The optional argument 'args'\nis simply concatenated to the command, separated by a space.\n\nThis returns a 2-tuple composed of a numeric response code and the\nactual response line (multiline responses are joined into one long\nline.)\n\nIn normal operation it should not be necessary to call this method\nexplicitly.  It is used to implement other methods and may be\nuseful for testing private extensions.\n\nIf the connection to the server is lost while waiting for the\nreply, *note SMTPServerDisconnected: 3736. will be raised.\n\n-- Method: SMTP.connect (host='localhost', port=0)\n\nConnect to a host on a given port.  The defaults are to connect to\nthe local host at the standard SMTP port (25).  If the hostname\nends with a colon ('':'') followed by a number, that suffix will be\nstripped off and the number interpreted as the port number to use.\nThis method is automatically invoked by the constructor if a host\nis specified during instantiation.  Returns a 2-tuple of the\nresponse code and message sent by the server in its connection\nresponse.\n\nRaises an *note auditing event: 161d. 'smtplib.connect' with\narguments 'self', 'host', 'port'.\n\n-- Method: SMTP.helo (name='')\n\nIdentify yourself to the SMTP server using 'HELO'.  The hostname\nargument defaults to the fully qualified domain name of the local\nhost.  The message returned by the server is stored as the\n'heloresp' attribute of the object.\n\nIn normal operation it should not be necessary to call this method\nexplicitly.  It will be implicitly called by the *note sendmail():\ncba. when necessary.\n\n-- Method: SMTP.ehlo (name='')\n\nIdentify yourself to an ESMTP server using 'EHLO'.  The hostname\nargument defaults to the fully qualified domain name of the local\nhost.  Examine the response for ESMTP option and store them for use\nby *note hasextn(): 3742.  Also sets several informational\nattributes: the message returned by the server is stored as the\n'ehloresp' attribute, 'doesesmtp' is set to 'True' or 'False'\ndepending on whether the server supports ESMTP, and\n'esmtpfeatures' will be a dictionary containing the names of the\nSMTP service extensions this server supports, and their parameters\n(if any).\n\nUnless you wish to use *note hasextn(): 3742. before sending mail,\nit should not be necessary to call this method explicitly.  It will\nbe implicitly called by *note sendmail(): cba. when necessary.\n\n-- Method: SMTP.ehloorheloifneeded ()\n\nThis method calls *note ehlo(): 3741. and/or *note helo(): 3740. if\nthere has been no previous 'EHLO' or 'HELO' command this session.\nIt tries ESMTP 'EHLO' first.\n\n*note SMTPHeloError: 373b.\n\nThe server didn't reply properly to the 'HELO' greeting.\n\n-- Method: SMTP.hasextn (name)\n\nReturn *note True: a53. if 'name' is in the set of SMTP service\nextensions returned by the server, *note False: 971. otherwise.\nCase is ignored.\n\n-- Method: SMTP.verify (address)\n\nCheck the validity of an address on this server using SMTP 'VRFY'.\nReturns a tuple consisting of code 250 and a full RFC 822(1)\naddress (including human name) if the user address is valid.\nOtherwise returns an SMTP error code of 400 or greater and an error\nstring.\n\nNote: Many sites disable SMTP 'VRFY' in order to foil\nspammers.\n\n-- Method: SMTP.login (user, password, *, initialresponseok=True)\n\nLog in on an SMTP server that requires authentication.  The\narguments are the username and the password to authenticate with.\nIf there has been no previous 'EHLO' or 'HELO' command this\nsession, this method tries ESMTP 'EHLO' first.  This method will\nreturn normally if the authentication was successful, or may raise\nthe following exceptions:\n\n*note SMTPHeloError: 373b.\n\nThe server didn't reply properly to the 'HELO' greeting.\n\n*note SMTPAuthenticationError: 373c.\n\nThe server didn't accept the username/password combination.\n\n*note SMTPNotSupportedError: 1738.\n\nThe 'AUTH' command is not supported by the server.\n\n*note SMTPException: e10.\n\nNo suitable authentication method was found.\n\nEach of the authentication methods supported by *note smtplib: c4.\nare tried in turn if they are advertised as supported by the\nserver.  See *note auth(): cb8. for a list of supported\nauthentication methods.  'initialresponseok' is passed through to\n*note auth(): cb8.\n\nOptional keyword argument 'initialresponseok' specifies whether,\nfor authentication methods that support it, an \"initial response\"\nas specified in RFC 4954(2) can be sent along with the 'AUTH'\ncommand, rather than requiring a challenge/response.\n\nChanged in version 3.5: *note SMTPNotSupportedError: 1738. may be\nraised, and the 'initialresponseok' parameter was added.\n\n-- Method: SMTP.auth (mechanism, authobject, *,\ninitialresponseok=True)\n\nIssue an 'SMTP' 'AUTH' command for the specified authentication\n'mechanism', and handle the challenge response via 'authobject'.\n\n'mechanism' specifies which authentication mechanism is to be used\nas argument to the 'AUTH' command; the valid values are those\nlisted in the 'auth' element of 'esmtpfeatures'.\n\n'authobject' must be a callable object taking an optional single\nargument:\n\ndata = authobject(challenge=None)\n\nIf optional keyword argument 'initialresponseok' is true,\n'authobject()' will be called first with no argument.  It can\nreturn the RFC 4954(3) \"initial response\" ASCII 'str' which will be\nencoded and sent with the 'AUTH' command as below.  If the\n'authobject()' does not support an initial response (e.g.  because\nit requires a challenge), it should return 'None' when called with\n'challenge=None'.  If 'initialresponseok' is false, then\n'authobject()' will not be called first with 'None'.\n\nIf the initial response check returns 'None', or if\n'initialresponseok' is false, 'authobject()' will be called to\nprocess the server's challenge response; the 'challenge' argument\nit is passed will be a 'bytes'.  It should return ASCII 'str'\n'data' that will be base64 encoded and sent to the server.\n\nThe 'SMTP' class provides 'authobjects' for the 'CRAM-MD5',\n'PLAIN', and 'LOGIN' mechanisms; they are named\n'SMTP.authcrammd5', 'SMTP.authplain', and 'SMTP.authlogin'\nrespectively.  They all require that the 'user' and 'password'\nproperties of the 'SMTP' instance are set to appropriate values.\n\nUser code does not normally need to call 'auth' directly, but can\ninstead call the *note login(): 3745. method, which will try each\nof the above mechanisms in turn, in the order listed.  'auth' is\nexposed to facilitate the implementation of authentication methods\nnot (or not yet) supported directly by *note smtplib: c4.\n\nNew in version 3.5.\n\n-- Method: SMTP.starttls (*, context=None)\n\nPut the SMTP connection in TLS (Transport Layer Security) mode.\nAll SMTP commands that follow will be encrypted.  You should then\ncall *note ehlo(): 3741. again.\n\nIf 'keyfile' and 'certfile' are provided, they are used to create\nan *note ssl.SSLContext: 278.\n\nOptional 'context' parameter is an *note ssl.SSLContext: 278.\nobject; This is an alternative to using a keyfile and a certfile\nand if specified both 'keyfile' and 'certfile' should be 'None'.\n\nIf there has been no previous 'EHLO' or 'HELO' command this\nsession, this method tries ESMTP 'EHLO' first.\n\nChanged in version 3.12: The deprecated 'keyfile' and 'certfile'\nparameters have been removed.\n\n*note SMTPHeloError: 373b.\n\nThe server didn't reply properly to the 'HELO' greeting.\n\n*note SMTPNotSupportedError: 1738.\n\nThe server does not support the STARTTLS extension.\n\n*note RuntimeError: 17a.\n\nSSL/TLS support is not available to your Python interpreter.\n\nChanged in version 3.3: 'context' was added.\n\nChanged in version 3.4: The method now supports hostname check with\n'SSLContext.checkhostname' and 'Server Name Indicator' (see *note\nHASSNI: 30c7.).\n\nChanged in version 3.5: The error raised for lack of STARTTLS\nsupport is now the *note SMTPNotSupportedError: 1738. subclass\ninstead of the base *note SMTPException: e10.\n\n-- Method: SMTP.sendmail (fromaddr, toaddrs, msg, mailoptions=(),\nrcptoptions=())\n\nSend mail.  The required arguments are an RFC 822(4) from-address\nstring, a list of RFC 822(5) to-address strings (a bare string will\nbe treated as a list with 1 address), and a message string.  The\ncaller may pass a list of ESMTP options (such as '8bitmime') to be\nused in 'MAIL FROM' commands as 'mailoptions'.  ESMTP options\n(such as 'DSN' commands) that should be used with all 'RCPT'\ncommands can be passed as 'rcptoptions'.  (If you need to use\ndifferent ESMTP options to different recipients you have to use the\nlow-level methods such as 'mail()', 'rcpt()' and 'data()' to send\nthe message.)\n\nNote: The 'fromaddr' and 'toaddrs' parameters are used to\nconstruct the message envelope used by the transport agents.\n'sendmail' does not modify the message headers in any way.\n\n'msg' may be a string containing characters in the ASCII range, or\na byte string.  A string is encoded to bytes using the ascii codec,\nand lone '\\r' and '\\n' characters are converted to '\\r\\n'\ncharacters.  A byte string is not modified.\n\nIf there has been no previous 'EHLO' or 'HELO' command this\nsession, this method tries ESMTP 'EHLO' first.  If the server does\nESMTP, message size and each of the specified options will be\npassed to it (if the option is in the feature set the server\nadvertises).  If 'EHLO' fails, 'HELO' will be tried and ESMTP\noptions suppressed.\n\nThis method will return normally if the mail is accepted for at\nleast one recipient.  Otherwise it will raise an exception.  That\nis, if this method does not raise an exception, then someone should\nget your mail.  If this method does not raise an exception, it\nreturns a dictionary, with one entry for each recipient that was\nrefused.  Each entry contains a tuple of the SMTP error code and\nthe accompanying error message sent by the server.\n\nIf 'SMTPUTF8' is included in 'mailoptions', and the server\nsupports it, 'fromaddr' and 'toaddrs' may contain non-ASCII\ncharacters.\n\nThis method may raise the following exceptions:\n\n*note SMTPRecipientsRefused: 3739.\n\nAll recipients were refused.  Nobody got the mail.  The\n'recipients' attribute of the exception object is a dictionary\nwith information about the refused recipients (like the one\nreturned when at least one recipient was accepted).\n\n*note SMTPHeloError: 373b.\n\nThe server didn't reply properly to the 'HELO' greeting.\n\n*note SMTPSenderRefused: 3738.\n\nThe server didn't accept the 'fromaddr'.\n\n*note SMTPDataError: 373a.\n\nThe server replied with an unexpected error code (other than a\nrefusal of a recipient).\n\n*note SMTPNotSupportedError: 1738.\n\n'SMTPUTF8' was given in the 'mailoptions' but is not\nsupported by the server.\n\nUnless otherwise noted, the connection will be open even after an\nexception is raised.\n\nChanged in version 3.2: 'msg' may be a byte string.\n\nChanged in version 3.5: 'SMTPUTF8' support added, and *note\nSMTPNotSupportedError: 1738. may be raised if 'SMTPUTF8' is\nspecified but the server does not support it.\n\n-- Method: SMTP.sendmessage (msg, fromaddr=None, toaddrs=None,\nmailoptions=(), rcptoptions=())\n\nThis is a convenience method for calling *note sendmail(): cba.\nwith the message represented by an *note email.message.Message:\nae7. object.  The arguments have the same meaning as for *note\nsendmail(): cba, except that 'msg' is a 'Message' object.\n\nIf 'fromaddr' is 'None' or 'toaddrs' is 'None', 'sendmessage'\nfills those arguments with addresses extracted from the headers of\n'msg' as specified in RFC 5322(6): 'fromaddr' is set to the\n'Sender' field if it is present, and otherwise to the 'From' field.\n'toaddrs' combines the values (if any) of the 'To', 'Cc', and\n'Bcc' fields from 'msg'.  If exactly one set of 'Resent-*' headers\nappear in the message, the regular headers are ignored and the\n'Resent-*' headers are used instead.  If the message contains more\nthan one set of 'Resent-*' headers, a *note ValueError: 183. is\nraised, since there is no way to unambiguously detect the most\nrecent set of 'Resent-' headers.\n\n'sendmessage' serializes 'msg' using *note BytesGenerator: 1043.\nwith '\\r\\n' as the 'linesep', and calls *note sendmail(): cba. to\ntransmit the resulting message.  Regardless of the values of\n'fromaddr' and 'toaddrs', 'sendmessage' does not transmit any\n'Bcc' or 'Resent-Bcc' headers that may appear in 'msg'.  If any of\nthe addresses in 'fromaddr' and 'toaddrs' contain non-ASCII\ncharacters and the server does not advertise 'SMTPUTF8' support, an\n'SMTPNotSupported' error is raised.  Otherwise the 'Message' is\nserialized with a clone of its *note policy: 4b. with the *note\nutf8: c55. attribute set to 'True', and 'SMTPUTF8' and\n'BODY=8BITMIME' are added to 'mailoptions'.\n\nNew in version 3.2.\n\nNew in version 3.5: Support for internationalized addresses\n('SMTPUTF8').\n\n-- Method: SMTP.quit ()\n\nTerminate the SMTP session and close the connection.  Return the\nresult of the SMTP 'QUIT' command.\n",
            "subsections": []
        },
        "Low-level methods corresponding to the standard SMTP/ESMTP commands": {
            "content": "'HELP', 'RSET', 'NOOP', 'MAIL', 'RCPT', and 'DATA' are also supported.",
            "subsections": []
        },
        "Normally these do not need to be called directly, so they are not": {
            "content": "documented here.  For details, consult the module code.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc822.html\n\n(2) https://datatracker.ietf.org/doc/html/rfc4954.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc4954.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc822.html\n\n(5) https://datatracker.ietf.org/doc/html/rfc822.html\n\n(6) https://datatracker.ietf.org/doc/html/rfc5322.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: SMTP Example,  Prev: SMTP Objects,  Up: smtplib -- SMTP protocol client": {
            "content": "5.21.14.2 SMTP Example\n......................\n",
            "subsections": []
        },
        "This example prompts the user for addresses needed in the message": {
            "content": "envelope ('To' and 'From' addresses), and the message to be delivered.",
            "subsections": []
        },
        "Note that the headers to be included with the message must be included": {
            "content": "in the message as entered; this example doesn't do any processing of the\nRFC 822(1) headers.  In particular, the 'To' and 'From' addresses must\nbe included in the message headers explicitly.\n\nimport smtplib\n\ndef prompt(prompt):\nreturn input(prompt).strip()\n\nfromaddr = prompt(\"From: \")\ntoaddrs  = prompt(\"To: \").split()\nprint(\"Enter message, end with ^D (Unix) or ^Z (Windows):\")\n\n# Add the From: and To: headers at the start!\nmsg = (\"From: %s\\r\\nTo: %s\\r\\n\\r\\n\"\n% (fromaddr, \", \".join(toaddrs)))\nwhile True:\ntry:\nline = input()\nexcept EOFError:\nbreak\nif not line:\nbreak\nmsg = msg + line\n\nprint(\"Message length is\", len(msg))\n\nserver = smtplib.SMTP('localhost')\nserver.setdebuglevel(1)\nserver.sendmail(fromaddr, toaddrs, msg)\nserver.quit()\n\nNote: In general, you will want to use the *note email: 37.\npackage's features to construct an email message, which you can\nthen send via *note sendmessage(): cbb.; see *note email;\nExamples: dac.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc822.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: uuid -- UUID objects according to RFC 4122,  Next: socketserver -- A framework for network servers,  Prev: smtplib -- SMTP protocol client,  Up: Internet Protocols and Support": {
            "content": "'RFC 4122'\n\n'Source code:' Lib/uuid.py(1)\n\n\n\nThis module provides immutable *note UUID: 88e. objects (the *note UUID:\n88e. class) and the functions *note uuid1(): 9ec, *note uuid3(): 1492,\n*note uuid4(): 374a, *note uuid5(): 1493. for generating version 1, 3,\n4, and 5 UUIDs as specified in RFC 4122(2).\n\nIf all you want is a unique ID, you should probably call *note uuid1():\n9ec. or *note uuid4(): 374a.  Note that *note uuid1(): 9ec. may\ncompromise privacy since it creates a UUID containing the computer's\nnetwork address.  *note uuid4(): 374a. creates a random UUID.\n\nDepending on support from the underlying platform, *note uuid1(): 9ec.\nmay or may not return a \"safe\" UUID. A safe UUID is one which is\ngenerated using synchronization methods that ensure no two processes can\nobtain the same UUID. All instances of *note UUID: 88e. have an *note\nissafe: 9ea. attribute which relays any information about the UUID's\nsafety, using this enumeration:\n\n-- Class: uuid.SafeUUID\n\nNew in version 3.7.\n\n-- Attribute: safe\n\nThe UUID was generated by the platform in a\nmultiprocessing-safe way.\n\n-- Attribute: unsafe\n\nThe UUID was not generated in a multiprocessing-safe way.\n\n-- Attribute: unknown\n\nThe platform does not provide information on whether the UUID\nwas generated safely or not.\n\n-- Class: uuid.UUID (hex=None, bytes=None, bytesle=None, fields=None,\nint=None, version=None, *, issafe=SafeUUID.unknown)\n\nCreate a UUID from either a string of 32 hexadecimal digits, a\nstring of 16 bytes in big-endian order as the 'bytes' argument, a\nstring of 16 bytes in little-endian order as the 'bytesle'\nargument, a tuple of six integers (32-bit 'timelow', 16-bit\n'timemid', 16-bit 'timehiversion', 8-bit 'clockseqhivariant',\n8-bit 'clockseqlow', 48-bit 'node') as the 'fields' argument, or\na single 128-bit integer as the 'int' argument.  When a string of\nhex digits is given, curly braces, hyphens, and a URN prefix are\nall optional.  For example, these expressions all yield the same\nUUID:\n\nUUID('{12345678-1234-5678-1234-567812345678}')\nUUID('12345678123456781234567812345678')\nUUID('urn:uuid:12345678-1234-5678-1234-567812345678')\nUUID(bytes=b'\\x12\\x34\\x56\\x78'*4)\nUUID(bytesle=b'\\x78\\x56\\x34\\x12\\x34\\x12\\x78\\x56' +\nb'\\x12\\x34\\x56\\x78\\x12\\x34\\x56\\x78')\nUUID(fields=(0x12345678, 0x1234, 0x5678, 0x12, 0x34, 0x567812345678))\nUUID(int=0x12345678123456781234567812345678)\n\nExactly one of 'hex', 'bytes', 'bytesle', 'fields', or 'int' must\nbe given.  The 'version' argument is optional; if given, the\nresulting UUID will have its variant and version number set\naccording to RFC 4122(3), overriding bits in the given 'hex',\n'bytes', 'bytesle', 'fields', or 'int'.\n\nComparison of UUID objects are made by way of comparing their *note\nUUID.int: 374f. attributes.  Comparison with a non-UUID object\nraises a *note TypeError: 28e.\n\n'str(uuid)' returns a string in the form\n'12345678-1234-5678-1234-567812345678' where the 32 hexadecimal\ndigits represent the UUID.\n\n*note UUID: 88e. instances have these read-only attributes:\n\n-- Attribute: UUID.bytes\n\nThe UUID as a 16-byte string (containing the six integer fields in\nbig-endian byte order).\n\n-- Attribute: UUID.bytesle\n\nThe UUID as a 16-byte string (with 'timelow', 'timemid', and\n'timehiversion' in little-endian byte order).\n\n-- Attribute: UUID.fields\n\nA tuple of the six integer fields of the UUID, which are also\navailable as six individual attributes and two derived attributes:\n",
            "subsections": []
        },
        "Field                                                  Meaning": {
            "content": "-- Attribute: UUID.timelow                           The first 32 bits of the UUID.\n\n\n-- Attribute: UUID.timemid                           The next 16 bits of the UUID.\n\n\n-- Attribute: UUID.timehiversion                    The next 16 bits of the UUID.\n\n\n-- Attribute: UUID.clockseqhivariant               The next 8 bits of the UUID.\n\n\n-- Attribute: UUID.clockseqlow                      The next 8 bits of the UUID.\n\n\n-- Attribute: UUID.node                               The last 48 bits of the UUID.\n\n\n-- Attribute: UUID.time                               The 60-bit timestamp.\n\n\n-- Attribute: UUID.clockseq                          The 14-bit sequence number.\n\n\n-- Attribute: UUID.hex\n\nThe UUID as a 32-character lowercase hexadecimal string.\n\n-- Attribute: UUID.int\n\nThe UUID as a 128-bit integer.\n\n-- Attribute: UUID.urn\n\nThe UUID as a URN as specified in RFC 4122(4).\n\n-- Attribute: UUID.variant\n\nThe UUID variant, which determines the internal layout of the UUID.\nThis will be one of the constants *note RESERVEDNCS: 375e, *note\nRFC4122: 375f, *note RESERVEDMICROSOFT: 3760, or *note\nRESERVEDFUTURE: 3761.\n\n-- Attribute: UUID.version\n\nThe UUID version number (1 through 5, meaningful only when the\nvariant is *note RFC4122: 375f.).\n\n-- Attribute: UUID.issafe\n\nAn enumeration of *note SafeUUID: 374b. which indicates whether the\nplatform generated the UUID in a multiprocessing-safe way.\n\nNew in version 3.7.\n\nThe *note uuid: 10b. module defines the following functions:\n\n-- Function: uuid.getnode ()\n\nGet the hardware address as a 48-bit positive integer.  The first\ntime this runs, it may launch a separate program, which could be\nquite slow.  If all attempts to obtain the hardware address fail,\nwe choose a random 48-bit number with the multicast bit (least\nsignificant bit of the first octet) set to 1 as recommended in RFC\n4122(5).  \"Hardware address\" means the MAC address of a network\ninterface.  On a machine with multiple network interfaces,\nuniversally administered MAC addresses (i.e.  where the second\nleast significant bit of the first octet is 'unset') will be\npreferred over locally administered MAC addresses, but with no\nother ordering guarantees.\n\nChanged in version 3.7: Universally administered MAC addresses are\npreferred over locally administered MAC addresses, since the former\nare guaranteed to be globally unique, while the latter are not.\n\n-- Function: uuid.uuid1 (node=None, clockseq=None)\n\nGenerate a UUID from a host ID, sequence number, and the current\ntime.  If 'node' is not given, *note getnode(): 9eb. is used to\nobtain the hardware address.  If 'clockseq' is given, it is used\nas the sequence number; otherwise a random 14-bit sequence number\nis chosen.\n\n-- Function: uuid.uuid3 (namespace, name)\n\nGenerate a UUID based on the MD5 hash of a namespace identifier\n(which is a UUID) and a name (which is a *note bytes: 295. object\nor a string that will be encoded using UTF-8).\n\n-- Function: uuid.uuid4 ()\n\nGenerate a random UUID.\n\n-- Function: uuid.uuid5 (namespace, name)\n\nGenerate a UUID based on the SHA-1 hash of a namespace identifier\n(which is a UUID) and a name (which is a *note bytes: 295. object\nor a string that will be encoded using UTF-8).\n\nThe *note uuid: 10b. module defines the following namespace identifiers\nfor use with *note uuid3(): 1492. or *note uuid5(): 1493.\n\n-- Data: uuid.NAMESPACEDNS\n\nWhen this namespace is specified, the 'name' string is a fully\nqualified domain name.\n\n-- Data: uuid.NAMESPACEURL\n\nWhen this namespace is specified, the 'name' string is a URL.\n\n-- Data: uuid.NAMESPACEOID\n\nWhen this namespace is specified, the 'name' string is an ISO OID.\n\n-- Data: uuid.NAMESPACEX500\n\nWhen this namespace is specified, the 'name' string is an X.500 DN\nin DER or a text output format.\n\nThe *note uuid: 10b. module defines the following constants for the\npossible values of the *note variant: 375d. attribute:\n\n-- Data: uuid.RESERVEDNCS\n\nReserved for NCS compatibility.\n\n-- Data: uuid.RFC4122\n\nSpecifies the UUID layout given in RFC 4122(6).\n\n-- Data: uuid.RESERVEDMICROSOFT\n\nReserved for Microsoft compatibility.\n\n-- Data: uuid.RESERVEDFUTURE\n\nReserved for future definition.\n\nSee also\n........\n\nRFC 4122(7) - A Universally Unique IDentifier (UUID) URN Namespace\n\nThis specification defines a Uniform Resource Name namespace for\nUUIDs, the internal format of UUIDs, and methods of generating\nUUIDs.\n\n* Menu:\n\n* Command-Line Usage: Command-Line Usage<2>.\n* Example: Example<12>.\n* Command-Line Example::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/uuid.py\n\n(2) https://datatracker.ietf.org/doc/html/rfc4122.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc4122.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc4122.html\n\n(5) https://datatracker.ietf.org/doc/html/rfc4122.html\n\n(6) https://datatracker.ietf.org/doc/html/rfc4122.html\n\n(7) https://datatracker.ietf.org/doc/html/rfc4122.html\n\nFile: python3.12.info,  Node: Command-Line Usage<2>,  Next: Example<12>,  Up: uuid -- UUID objects according to RFC 4122\n\n5.21.15.1 Command-Line Usage\n............................\n\nNew in version 3.12.\n\nThe *note uuid: 10b. module can be executed as a script from the command\nline.\n\npython -m uuid [-h] [-u {uuid1,uuid3,uuid4,uuid5}] [-n NAMESPACE] [-N NAME]\n\nThe following options are accepted:\n\n-- Option: -h, --help\n\nShow the help message and exit.\n\n-- Option: -u <uuid>\n-- Option: --uuid <uuid>\n\nSpecify the function name to use to generate the uuid.  By default\n*note uuid4(): 374a. is used.\n\n-- Option: -n <namespace>\n-- Option: --namespace <namespace>\n\nThe namespace is a 'UUID', or '@ns' where 'ns' is a well-known\npredefined UUID addressed by namespace name.  Such as '@dns',\n'@url', '@oid', and '@x500'.  Only required for *note uuid3():\n1492. / *note uuid5(): 1493. functions.\n\n-- Option: -N <name>\n-- Option: --name <name>\n\nThe name used as part of generating the uuid.  Only required for\n*note uuid3(): 1492. / *note uuid5(): 1493. functions.\n\nFile: python3.12.info,  Node: Example<12>,  Next: Command-Line Example,  Prev: Command-Line Usage<2>,  Up: uuid -- UUID objects according to RFC 4122\n\n5.21.15.2 Example\n.................\n\nHere are some examples of typical usage of the *note uuid: 10b. module:\n\n>>> import uuid\n\n>>> # make a UUID based on the host ID and current time\n>>> uuid.uuid1()\nUUID('a8098c1a-f86e-11da-bd1a-00112444be1e')\n\n>>> # make a UUID using an MD5 hash of a namespace UUID and a name\n>>> uuid.uuid3(uuid.NAMESPACEDNS, 'python.org')\nUUID('6fa459ea-ee8a-3ca4-894e-db77e160355e')\n\n>>> # make a random UUID\n>>> uuid.uuid4()\nUUID('16fd2706-8baf-433b-82eb-8c7fada847da')\n\n>>> # make a UUID using a SHA-1 hash of a namespace UUID and a name\n>>> uuid.uuid5(uuid.NAMESPACEDNS, 'python.org')\nUUID('886313e1-3b8a-5372-9b90-0c9aee199e5d')\n\n>>> # make a UUID from a string of hex digits (braces and hyphens ignored)\n>>> x = uuid.UUID('{00010203-0405-0607-0809-0a0b0c0d0e0f}')\n\n>>> # convert a UUID to a string of hex digits in standard form\n>>> str(x)\n'00010203-0405-0607-0809-0a0b0c0d0e0f'\n\n>>> # get the raw 16 bytes of the UUID\n>>> x.bytes\nb'\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\t\\n\\x0b\\x0c\\r\\x0e\\x0f'\n\n>>> # make a UUID from a 16-byte string\n>>> uuid.UUID(bytes=x.bytes)\nUUID('00010203-0405-0607-0809-0a0b0c0d0e0f')\n\nFile: python3.12.info,  Node: Command-Line Example,  Prev: Example<12>,  Up: uuid -- UUID objects according to RFC 4122\n\n5.21.15.3 Command-Line Example\n..............................\n\nHere are some examples of typical usage of the *note uuid: 10b. command\nline interface:\n\n# generate a random uuid - by default uuid4() is used\n$ python -m uuid\n\n# generate a uuid using uuid1()\n$ python -m uuid -u uuid1\n\n# generate a uuid using uuid5\n$ python -m uuid -u uuid5 -n @url -N example.com\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: socketserver -- A framework for network servers,  Next: http server -- HTTP servers,  Prev: uuid -- UUID objects according to RFC 4122,  Up: Internet Protocols and Support": {
            "content": "'Source code:' Lib/socketserver.py(1)\n\n\n\nThe *note socketserver: c7. module simplifies the task of writing\nnetwork servers.\n\n*note Availability: 1ad3.: not Emscripten, not WASI.\n",
            "subsections": []
        },
        "These four classes process requests 'synchronously'; each request must": {
            "content": "be completed before the next request can be started.  This isn't\nsuitable if each request takes a long time to complete, because it\nrequires a lot of computation, or because it returns a lot of data which\nthe client is slow to process.  The solution is to create a separate\nprocess or thread to handle each request; the *note ForkingMixIn: 9b8.\nand *note ThreadingMixIn: 9b9. mix-in classes can be used to support\nasynchronous behaviour.\n",
            "subsections": []
        },
        "Creating a server requires several steps.  First, you must create a": {
            "content": "request handler class by subclassing the *note BaseRequestHandler: 377b.\nclass and overriding its *note handle(): 377c. method; this method will\nprocess incoming requests.  Second, you must instantiate one of the\nserver classes, passing it the server's address and the request handler\nclass.  It is recommended to use the server in a *note with: 396.\nstatement.  Then call the *note handlerequest(): 119a. or *note\nserveforever(): fb1. method of the server object to process one or many\nrequests.  Finally, call *note serverclose(): 377d. to close the socket\n(unless you used a 'with' statement).\n\nWhen inheriting from *note ThreadingMixIn: 9b9. for threaded connection\nbehavior, you should explicitly declare how you want your threads to\nbehave on an abrupt shutdown.  The *note ThreadingMixIn: 9b9. class\ndefines an attribute 'daemonthreads', which indicates whether or not\nthe server should wait for thread termination.  You should set the flag\nexplicitly if you would like threads to behave autonomously; the default\nis *note False: 971, meaning that Python will not exit until all threads\ncreated by *note ThreadingMixIn: 9b9. have exited.\n",
            "subsections": []
        },
        "Server classes have the same external methods and attributes, no matter": {
            "content": "what network protocol they use.\n\n* Menu:\n\n* Server Creation Notes::\n* Server Objects: Server Objects<2>.\n* Request Handler Objects::\n* Examples: Examples<27>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/socketserver.py\n\nFile: python3.12.info,  Node: Server Creation Notes,  Next: Server Objects<2>,  Up: socketserver -- A framework for network servers\n\n5.21.16.1 Server Creation Notes\n...............................\n",
            "subsections": []
        },
        "There are five classes in an inheritance diagram, four of which": {
            "content": "represent synchronous servers of four types:\n\n+------------+\n| BaseServer |\n+------------+\n|\nv\n+-----------+        +------------------+\n| TCPServer |------->| UnixStreamServer |\n+-----------+        +------------------+\n|\nv\n+-----------+        +--------------------+\n| UDPServer |------->| UnixDatagramServer |\n+-----------+        +--------------------+\n\nNote that *note UnixDatagramServer: 377a. derives from *note UDPServer:\n3778, not from *note UnixStreamServer: 3779. -- the only difference\nbetween an IP and a Unix server is the address family.\n\n-- Class: socketserver.ForkingMixIn\n-- Class: socketserver.ThreadingMixIn\n\nForking and threading versions of each type of server can be\ncreated using these mix-in classes.  For instance, *note\nThreadingUDPServer: 377f. is created as follows:\n\nclass ThreadingUDPServer(ThreadingMixIn, UDPServer):\npass\n\nThe mix-in class comes first, since it overrides a method defined\nin *note UDPServer: 3778.  Setting the various attributes also\nchanges the behavior of the underlying server mechanism.\n\n*note ForkingMixIn: 9b8. and the Forking classes mentioned below\nare only available on POSIX platforms that support *note fork():\n231.\n\n-- Attribute: blockonclose\n\n*note ForkingMixIn.serverclose: 377d. waits until all child\nprocesses complete, except if *note blockonclose: a43.\nattribute is 'False'.\n\n*note ThreadingMixIn.serverclose: 377d. waits until all\nnon-daemon threads complete, except if *note blockonclose:\na43. attribute is 'False'.\n\n-- Attribute: daemonthreads\n\nFor *note ThreadingMixIn: 9b9. use daemonic threads by setting\n*note ThreadingMixIn.daemonthreads: 3780. to 'True' to not\nwait until threads complete.\n\nChanged in version 3.7: *note ForkingMixIn.serverclose: 377d. and\n*note ThreadingMixIn.serverclose: 377d. now waits until all child\nprocesses and non-daemonic threads complete.  Add a new *note\nForkingMixIn.blockonclose: a43. class attribute to opt-in for the\npre-3.7 behaviour.\n\n-- Class: socketserver.ForkingTCPServer\n-- Class: socketserver.ForkingUDPServer\n-- Class: socketserver.ThreadingTCPServer\n-- Class: socketserver.ThreadingUDPServer\n-- Class: socketserver.ForkingUnixStreamServer\n-- Class: socketserver.ForkingUnixDatagramServer\n-- Class: socketserver.ThreadingUnixStreamServer\n-- Class: socketserver.ThreadingUnixDatagramServer\n\nThese classes are pre-defined using the mix-in classes.\n",
            "subsections": []
        },
        "New in version 3.12: The 'ForkingUnixStreamServer' and": {
            "content": "'ForkingUnixDatagramServer' classes were added.\n\nTo implement a service, you must derive a class from *note\nBaseRequestHandler: 377b. and redefine its *note handle(): 377c. method.",
            "subsections": []
        },
        "You can then run various versions of the service by combining one of the": {
            "content": "server classes with your request handler class.  The request handler\nclass must be different for datagram or stream services.  This can be\nhidden by using the handler subclasses *note StreamRequestHandler: b29.\nor *note DatagramRequestHandler: 3788.\n\nOf course, you still have to use your head!  For instance, it makes no\nsense to use a forking server if the service contains state in memory\nthat can be modified by different requests, since the modifications in\nthe child process would never reach the initial state kept in the parent\nprocess and passed to each child.  In this case, you can use a threading\nserver, but you will probably have to use locks to protect the integrity\nof the shared data.\n",
            "subsections": []
        },
        "On the other hand, if you are building an HTTP server where all data is": {
            "content": "stored externally (for instance, in the file system), a synchronous\nclass will essentially render the service \"deaf\" while one request is\nbeing handled - which may be for a very long time if a client is slow to\nreceive all the data it has requested.  Here a threading or forking\nserver is appropriate.\n",
            "subsections": []
        },
        "In some cases, it may be appropriate to process part of a request": {
            "content": "synchronously, but to finish processing in a forked child depending on\nthe request data.  This can be implemented by using a synchronous server\nand doing an explicit fork in the request handler class *note handle():\n377c. method.\n",
            "subsections": []
        },
        "Another approach to handling multiple simultaneous requests in an": {
            "content": "environment that supports neither threads nor *note fork(): 231. (or\nwhere these are too expensive or inappropriate for the service) is to\nmaintain an explicit table of partially finished requests and to use\n*note selectors: bd. to decide which request to work on next (or whether\nto handle a new incoming request).  This is particularly important for\nstream services where each client can potentially be connected for a\nlong time (if threads or subprocesses cannot be used).\n\nFile: python3.12.info,  Node: Server Objects<2>,  Next: Request Handler Objects,  Prev: Server Creation Notes,  Up: socketserver -- A framework for network servers\n\n5.21.16.2 Server Objects\n........................\n\n-- Class: socketserver.BaseServer (serveraddress, RequestHandlerClass)\n\nThis is the superclass of all Server objects in the module.  It\ndefines the interface, given below, but does not implement most of\nthe methods, which is done in subclasses.  The two parameters are\nstored in the respective *note serveraddress: 378a. and *note\nRequestHandlerClass: 378b. attributes.\n\n-- Method: fileno ()\n\nReturn an integer file descriptor for the socket on which the\nserver is listening.  This function is most commonly passed to\n*note selectors: bd, to allow monitoring multiple servers in\nthe same process.\n\n-- Method: handlerequest ()\n\nProcess a single request.  This function calls the following\nmethods in order: *note getrequest(): 378d, *note\nverifyrequest(): 378e, and *note processrequest(): 378f.  If\nthe user-provided *note handle(): 377c. method of the handler\nclass raises an exception, the server's *note handleerror():\nb98. method will be called.  If no request is received within\n*note timeout: 1198. seconds, *note handletimeout(): 1199.\nwill be called and *note handlerequest(): 119a. will return.\n\n-- Method: serveforever (pollinterval=0.5)\n\nHandle requests until an explicit *note shutdown(): 17af.\nrequest.  Poll for shutdown every 'pollinterval' seconds.\nIgnores the *note timeout: 1198. attribute.  It also calls\n*note serviceactions(): fb0, which may be used by a subclass\nor mixin to provide actions specific to a given service.  For\nexample, the *note ForkingMixIn: 9b8. class uses *note\nserviceactions(): fb0. to clean up zombie child processes.\n\nChanged in version 3.3: Added 'serviceactions' call to the\n'serveforever' method.\n\n-- Method: serviceactions ()\n\nThis is called in the *note serveforever(): fb1. loop.  This\nmethod can be overridden by subclasses or mixin classes to\nperform actions specific to a given service, such as cleanup\nactions.\n\nNew in version 3.3.\n\n-- Method: shutdown ()\n\nTell the *note serveforever(): fb1. loop to stop and wait\nuntil it does.  *note shutdown(): 17af. must be called while\n*note serveforever(): fb1. is running in a different thread\notherwise it will deadlock.\n\n-- Method: serverclose ()\n\nClean up the server.  May be overridden.\n\n-- Attribute: addressfamily\n\nThe family of protocols to which the server's socket belongs.\nCommon examples are *note socket.AFINET: 157e. and *note\nsocket.AFUNIX: 1580.\n\n-- Attribute: RequestHandlerClass\n\nThe user-provided request handler class; an instance of this\nclass is created for each request.\n\n-- Attribute: serveraddress\n\nThe address on which the server is listening.  The format of\naddresses varies depending on the protocol family; see the\ndocumentation for the *note socket: c6. module for details.\nFor internet protocols, this is a tuple containing a string\ngiving the address, and an integer port number: '('127.0.0.1',\n80)', for example.\n\n-- Attribute: socket\n\nThe socket object on which the server will listen for incoming\nrequests.\n\nThe server classes support the following class variables:\n\n-- Attribute: allowreuseaddress\n\nWhether the server will allow the reuse of an address.  This\ndefaults to *note False: 971, and can be set in subclasses to\nchange the policy.\n\n-- Attribute: requestqueuesize\n\nThe size of the request queue.  If it takes a long time to\nprocess a single request, any requests that arrive while the\nserver is busy are placed into a queue, up to *note\nrequestqueuesize: 3793. requests.  Once the queue is full,\nfurther requests from clients will get a \"Connection denied\"\nerror.  The default value is usually 5, but this can be\noverridden by subclasses.\n\n-- Attribute: sockettype\n\nThe type of socket used by the server; *note\nsocket.SOCKSTREAM: 1168. and *note socket.SOCKDGRAM: 1167.\nare two common values.\n\n-- Attribute: timeout\n\nTimeout duration, measured in seconds, or *note None: 43f. if\nno timeout is desired.  If *note handlerequest(): 119a.\nreceives no incoming requests within the timeout period, the\n*note handletimeout(): 1199. method is called.\n\nThere are various server methods that can be overridden by\nsubclasses of base server classes like *note TCPServer: 1197.;\nthese methods aren't useful to external users of the server object.\n\n-- Method: finishrequest (request, clientaddress)\n\nActually processes the request by instantiating *note\nRequestHandlerClass: 378b. and calling its *note handle():\n377c. method.\n\n-- Method: getrequest ()\n\nMust accept a request from the socket, and return a 2-tuple\ncontaining the 'new' socket object to be used to communicate\nwith the client, and the client's address.\n\n-- Method: handleerror (request, clientaddress)\n\nThis function is called if the *note handle(): 377c. method of\na *note RequestHandlerClass: 378b. instance raises an\nexception.  The default action is to print the traceback to\nstandard error and continue handling further requests.\n\nChanged in version 3.6: Now only called for exceptions derived\nfrom the *note Exception: 7ff. class.\n\n-- Method: handletimeout ()\n\nThis function is called when the *note timeout: 1198.\nattribute has been set to a value other than *note None: 43f.\nand the timeout period has passed with no requests being\nreceived.  The default action for forking servers is to\ncollect the status of any child processes that have exited,\nwhile in threading servers this method does nothing.\n\n-- Method: processrequest (request, clientaddress)\n\nCalls *note finishrequest(): 3795. to create an instance of\nthe *note RequestHandlerClass: 378b.  If desired, this\nfunction can create a new process or thread to handle the\nrequest; the *note ForkingMixIn: 9b8. and *note\nThreadingMixIn: 9b9. classes do this.\n\n-- Method: serveractivate ()\n\nCalled by the server's constructor to activate the server.\nThe default behavior for a TCP server just invokes *note\nlisten(): cc1. on the server's socket.  May be overridden.\n\n-- Method: serverbind ()\n\nCalled by the server's constructor to bind the socket to the\ndesired address.  May be overridden.\n\n-- Method: verifyrequest (request, clientaddress)\n\nMust return a Boolean value; if the value is *note True: a53,\nthe request will be processed, and if it's *note False: 971,\nthe request will be denied.  This function can be overridden\nto implement access controls for a server.  The default\nimplementation always returns *note True: a53.\n\nChanged in version 3.6: Support for the *note context manager: 398.\nprotocol was added.  Exiting the context manager is equivalent to\ncalling *note serverclose(): 377d.\n\nFile: python3.12.info,  Node: Request Handler Objects,  Next: Examples<27>,  Prev: Server Objects<2>,  Up: socketserver -- A framework for network servers\n\n5.21.16.3 Request Handler Objects\n.................................\n\n-- Class: socketserver.BaseRequestHandler\n\nThis is the superclass of all request handler objects.  It defines\nthe interface, given below.  A concrete request handler subclass\nmust define a new *note handle(): 377c. method, and can override\nany of the other methods.  A new instance of the subclass is\ncreated for each request.\n\n-- Method: setup ()\n\nCalled before the *note handle(): 377c. method to perform any\ninitialization actions required.  The default implementation\ndoes nothing.\n\n-- Method: handle ()\n\nThis function must do all the work required to service a\nrequest.  The default implementation does nothing.  Several\ninstance attributes are available to it; the request is\navailable as *note request: 3798.; the client address as *note\nclientaddress: 3799.; and the server instance as *note\nserver: 379a, in case it needs access to per-server\ninformation.\n\nThe type of *note request: 3798. is different for datagram or\nstream services.  For stream services, *note request: 3798. is\na socket object; for datagram services, *note request: 3798.\nis a pair of string and socket.\n\n-- Method: finish ()\n\nCalled after the *note handle(): 377c. method to perform any\nclean-up actions required.  The default implementation does\nnothing.  If *note setup(): 3797. raises an exception, this\nfunction will not be called.\n\n-- Attribute: request\n\nThe 'new' *note socket.socket: bfd. object to be used to\ncommunicate with the client.\n\n-- Attribute: clientaddress\n\nClient address returned by *note BaseServer.getrequest():\n378d.\n\n-- Attribute: server\n\n*note BaseServer: faf. object used for handling the request.\n\n-- Class: socketserver.StreamRequestHandler\n-- Class: socketserver.DatagramRequestHandler\n\nThese *note BaseRequestHandler: 377b. subclasses override the *note\nsetup(): 3797. and *note finish(): 379b. methods, and provide *note\nrfile: 379c. and *note wfile: 379d. attributes.\n\n-- Attribute: rfile\n\nA file object from which receives the request is read.\nSupport the *note io.BufferedIOBase: 460. readable interface.\n\n-- Attribute: wfile\n\nA file object to which the reply is written.  Support the\n*note io.BufferedIOBase: 460. writable interface\n\nChanged in version 3.6: *note wfile: 379d. also supports the *note\nio.BufferedIOBase: 460. writable interface.\n\nFile: python3.12.info,  Node: Examples<27>,  Prev: Request Handler Objects,  Up: socketserver -- A framework for network servers\n\n5.21.16.4 Examples\n..................\n\n* Menu:\n\n* socketserver.TCPServer Example: socketserver TCPServer Example.\n* socketserver.UDPServer Example: socketserver UDPServer Example.\n* Asynchronous Mixins::\n\nFile: python3.12.info,  Node: socketserver TCPServer Example,  Next: socketserver UDPServer Example,  Up: Examples<27>\n\n5.21.16.5 'socketserver.TCPServer' Example\n..........................................\n\nThis is the server side:\n\nimport socketserver\n\nclass MyTCPHandler(socketserver.BaseRequestHandler):\n\"\"\"\nThe request handler class for our server.\n\nIt is instantiated once per connection to the server, and must\noverride the handle() method to implement communication to the\nclient.\n\"\"\"\n\ndef handle(self):\n# self.request is the TCP socket connected to the client\nself.data = self.request.recv(1024).strip()\nprint(\"Received from {}:\".format(self.clientaddress[0]))\nprint(self.data)\n# just send back the same data, but upper-cased\nself.request.sendall(self.data.upper())\n\nif name == \"main\":\nHOST, PORT = \"localhost\", 9999\n\n# Create the server, binding to localhost on port 9999\nwith socketserver.TCPServer((HOST, PORT), MyTCPHandler) as server:\n# Activate the server; this will keep running until you\n# interrupt the program with Ctrl-C\nserver.serveforever()\n",
            "subsections": []
        },
        "An alternative request handler class that makes use of streams": {
            "content": "(file-like objects that simplify communication by providing the standard\nfile interface):\n\nclass MyTCPHandler(socketserver.StreamRequestHandler):\n\ndef handle(self):\n# self.rfile is a file-like object created by the handler;\n# we can now use e.g. readline() instead of raw recv() calls\nself.data = self.rfile.readline().strip()\nprint(\"{} wrote:\".format(self.clientaddress[0]))\nprint(self.data)\n# Likewise, self.wfile is a file-like object used to write back\n# to the client\nself.wfile.write(self.data.upper())\n",
            "subsections": []
        },
        "The difference is that the 'readline()' call in the second handler will": {
            "content": "call 'recv()' multiple times until it encounters a newline character,\nwhile the single 'recv()' call in the first handler will just return\nwhat has been received so far from the client's 'sendall()' call\n(typically all of it, but this is not guaranteed by the TCP protocol).\n\nThis is the client side:\n\nimport socket\nimport sys\n\nHOST, PORT = \"localhost\", 9999\ndata = \" \".join(sys.argv[1:])\n\n# Create a socket (SOCKSTREAM means a TCP socket)\nwith socket.socket(socket.AFINET, socket.SOCKSTREAM) as sock:\n# Connect to server and send data\nsock.connect((HOST, PORT))\nsock.sendall(bytes(data + \"\\n\", \"utf-8\"))\n\n# Receive data from the server and shut down\nreceived = str(sock.recv(1024), \"utf-8\")\n\nprint(\"Sent:     {}\".format(data))\nprint(\"Received: {}\".format(received))\n\nThe output of the example should look something like this:\n\nServer:\n\n$ python TCPServer.py\n127.0.0.1 wrote:\nb'hello world with TCP'\n127.0.0.1 wrote:\nb'python is nice'\n\nClient:\n\n$ python TCPClient.py hello world with TCP\nSent:     hello world with TCP\nReceived: HELLO WORLD WITH TCP\n$ python TCPClient.py python is nice\nSent:     python is nice\nReceived: PYTHON IS NICE\n\nFile: python3.12.info,  Node: socketserver UDPServer Example,  Next: Asynchronous Mixins,  Prev: socketserver TCPServer Example,  Up: Examples<27>\n\n5.21.16.6 'socketserver.UDPServer' Example\n..........................................\n\nThis is the server side:\n\nimport socketserver\n\nclass MyUDPHandler(socketserver.BaseRequestHandler):\n\"\"\"\nThis class works similar to the TCP handler class, except that\nself.request consists of a pair of data and client socket, and since\nthere is no connection the client address must be given explicitly\nwhen sending data back via sendto().\n\"\"\"\n\ndef handle(self):\ndata = self.request[0].strip()\nsocket = self.request[1]\nprint(\"{} wrote:\".format(self.clientaddress[0]))\nprint(data)\nsocket.sendto(data.upper(), self.clientaddress)\n\nif name == \"main\":\nHOST, PORT = \"localhost\", 9999\nwith socketserver.UDPServer((HOST, PORT), MyUDPHandler) as server:\nserver.serveforever()\n\nThis is the client side:\n\nimport socket\nimport sys\n\nHOST, PORT = \"localhost\", 9999\ndata = \" \".join(sys.argv[1:])\n\n# SOCKDGRAM is the socket type to use for UDP sockets\nsock = socket.socket(socket.AFINET, socket.SOCKDGRAM)\n\n# As you can see, there is no connect() call; UDP has no connections.\n# Instead, data is directly sent to the recipient via sendto().\nsock.sendto(bytes(data + \"\\n\", \"utf-8\"), (HOST, PORT))\nreceived = str(sock.recv(1024), \"utf-8\")\n\nprint(\"Sent:     {}\".format(data))\nprint(\"Received: {}\".format(received))\n",
            "subsections": []
        },
        "The output of the example should look exactly like for the TCP server": {
            "content": "example.\n\nFile: python3.12.info,  Node: Asynchronous Mixins,  Prev: socketserver UDPServer Example,  Up: Examples<27>\n\n5.21.16.7 Asynchronous Mixins\n.............................\n\nTo build asynchronous handlers, use the *note ThreadingMixIn: 9b9. and\n*note ForkingMixIn: 9b8. classes.\n\nAn example for the *note ThreadingMixIn: 9b9. class:\n\nimport socket\nimport threading\nimport socketserver\n\nclass ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):\n\ndef handle(self):\ndata = str(self.request.recv(1024), 'ascii')\ncurthread = threading.currentthread()\nresponse = bytes(\"{}: {}\".format(curthread.name, data), 'ascii')\nself.request.sendall(response)\n\nclass ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer):\npass\n\ndef client(ip, port, message):\nwith socket.socket(socket.AFINET, socket.SOCKSTREAM) as sock:\nsock.connect((ip, port))\nsock.sendall(bytes(message, 'ascii'))\nresponse = str(sock.recv(1024), 'ascii')\nprint(\"Received: {}\".format(response))\n\nif name == \"main\":\n# Port 0 means to select an arbitrary unused port\nHOST, PORT = \"localhost\", 0\n\nserver = ThreadedTCPServer((HOST, PORT), ThreadedTCPRequestHandler)\nwith server:\nip, port = server.serveraddress\n\n# Start a thread with the server -- that thread will then start one\n# more thread for each request\nserverthread = threading.Thread(target=server.serveforever)\n# Exit the server thread when the main thread terminates\nserverthread.daemon = True\nserverthread.start()\nprint(\"Server loop running in thread:\", serverthread.name)\n\nclient(ip, port, \"Hello World 1\")\nclient(ip, port, \"Hello World 2\")\nclient(ip, port, \"Hello World 3\")\n\nserver.shutdown()\n\nThe output of the example should look something like this:\n\n$ python ThreadedTCPServer.py\nServer loop running in thread: Thread-1\nReceived: Thread-2: Hello World 1\nReceived: Thread-3: Hello World 2\nReceived: Thread-4: Hello World 3\n\nThe *note ForkingMixIn: 9b8. class is used in the same way, except that\nthe server will spawn a new process for each request.  Available only on\nPOSIX platforms that support *note fork(): 231.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: http server -- HTTP servers,  Next: http cookies -- HTTP state management,  Prev: socketserver -- A framework for network servers,  Up: Internet Protocols and Support": {
            "content": "'Source code:' Lib/http/server.py(1)\n\n\n\nThis module defines classes for implementing HTTP servers.\n\nWarning: *note http.server: 6d. is not recommended for production.\nIt only implements *note basic security checks: 37a4.\n\n*note Availability: 1ad3.: not Emscripten, not WASI.\n",
            "subsections": []
        },
        "Similar to the previous example, this serves files relative to the": {
            "content": "current directory:\n\npython -m http.server\n",
            "subsections": []
        },
        "The server listens to port 8000 by default.  The default can be": {
            "content": "overridden by passing the desired port number as an argument:\n\npython -m http.server 9000\n",
            "subsections": []
        },
        "By default, the server binds itself to all interfaces.  The option": {
            "content": "'-b/--bind' specifies a specific address to which it should bind.  Both\nIPv4 and IPv6 addresses are supported.  For example, the following\ncommand causes the server to bind to localhost only:\n\npython -m http.server --bind 127.0.0.1\n\nChanged in version 3.4: Added the '--bind' option.\n\nChanged in version 3.8: Support IPv6 in the '--bind' option.\n",
            "subsections": []
        },
        "By default, the server uses the current directory.  The option": {
            "content": "'-d/--directory' specifies a directory to which it should serve the\nfiles.  For example, the following command uses a specific directory:\n\npython -m http.server --directory /tmp/\n\nChanged in version 3.7: Added the '--directory' option.\n",
            "subsections": []
        },
        "By default, the server is conformant to HTTP/1.0.  The option": {
            "content": "'-p/--protocol' specifies the HTTP version to which the server is\nconformant.  For example, the following command runs an HTTP/1.1\nconformant server:\n\npython -m http.server --protocol HTTP/1.1\n\nChanged in version 3.11: Added the '--protocol' option.\n\n-- Class: http.server.CGIHTTPRequestHandler (request, clientaddress,\nserver)\n\nThis class is used to serve either files or output of CGI scripts\nfrom the current directory and below.  Note that mapping HTTP\nhierarchic structure to local directory structure is exactly as in\n*note SimpleHTTPRequestHandler: 97d.\n\nNote: CGI scripts run by the *note CGIHTTPRequestHandler:\n37c5. class cannot execute redirects (HTTP code 302), because\ncode 200 (script output follows) is sent prior to execution of\nthe CGI script.  This pre-empts the status code.\n\nThe class will however, run the CGI script, instead of serving it\nas a file, if it guesses it to be a CGI script.  Only\ndirectory-based CGI are used -- the other common server\nconfiguration is to treat special extensions as denoting CGI\nscripts.\n\nThe 'doGET()' and 'doHEAD()' functions are modified to run CGI\nscripts and serve the output, instead of serving files, if the\nrequest leads to somewhere below the 'cgidirectories' path.\n\nThe *note CGIHTTPRequestHandler: 37c5. defines the following data\nmember:\n\n-- Attribute: cgidirectories\n\nThis defaults to '['/cgi-bin', '/htbin']' and describes\ndirectories to treat as containing CGI scripts.\n\nThe *note CGIHTTPRequestHandler: 37c5. defines the following\nmethod:\n\n-- Method: doPOST ()\n\nThis method serves the ''POST'' request type, only allowed for\nCGI scripts.  Error 501, \"Can only POST to CGI scripts\", is\noutput when trying to POST to a non-CGI url.\n\nNote that CGI scripts will be run with UID of user nobody, for\nsecurity reasons.  Problems with the CGI script will be translated\nto error 403.\n\n*note CGIHTTPRequestHandler: 37c5. can be enabled in the command line by\npassing the '--cgi' option:\n\npython -m http.server --cgi\n\nWarning: *note CGIHTTPRequestHandler: 37c5. and the '--cgi' command\nline option are not intended for use by untrusted clients and may\nbe vulnerable to exploitation.  Always use within a secure\nenvironment.\n\n* Menu:\n\n* Security Considerations: Security Considerations<3>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/http/server.py\n\n(2) https://datatracker.ietf.org/doc/html/rfc3986.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc2822.html\n\n(4) https://github.com/python/cpython/tree/3.12/Lib/http/server.py\n\nFile: python3.12.info,  Node: Security Considerations<3>,  Up: http server -- HTTP servers\n\n5.21.17.1 Security Considerations\n.................................\n\n*note SimpleHTTPRequestHandler: 97d. will follow symbolic links when\nhandling requests, this makes it possible for files outside of the\nspecified directory to be served.\n",
            "subsections": []
        },
        "Earlier versions of Python did not scrub control characters from the log": {
            "content": "messages emitted to stderr from 'python -m http.server' or the default\n*note BaseHTTPRequestHandler: f3b. '.logmessage' implementation.  This\ncould allow remote clients connecting to your server to send nefarious\ncontrol codes to your terminal.\n\nChanged in version 3.12: Control characters are scrubbed in stderr logs.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "'Source code:' Lib/http/cookies.py(1)\n\n\n\nThe *note http.cookies: 6c. module defines classes for abstracting the\nconcept of cookies, an HTTP state management mechanism.  It supports\nboth simple string-only cookies, and provides an abstraction for having\nany serializable data-type as cookie value.\n",
            "subsections": []
        },
        "The module formerly strictly applied the parsing rules described in the": {
            "content": "RFC 2109(2) and RFC 2068(3) specifications.  It has since been\ndiscovered that MSIE 3.0x didn't follow the character rules outlined in\nthose specs; many current-day browsers and servers have also relaxed\nparsing rules when it comes to cookie handling.  As a result, this\nmodule now uses parsing rules that are a bit less strict than they once\nwere.\n\nThe character set, *note string.asciiletters: 1139, *note\nstring.digits: 1fd4. and '!#$%&'*+-.^`|~:' denote the set of valid\ncharacters allowed by this module in a cookie name (as *note key: a47.).\n\nChanged in version 3.3: Allowed ':' as a valid cookie name character.\n\nNote: On encountering an invalid cookie, *note CookieError: 37cb.\nis raised, so if your cookie data comes from a browser you should\nalways prepare for invalid data and catch *note CookieError: 37cb.\non parsing.\n\n-- Exception: http.cookies.CookieError\n\nException failing because of RFC 2109(4) invalidity: incorrect\nattributes, incorrect 'Set-Cookie' header, etc.\n\n-- Class: http.cookies.BaseCookie ([input])\n\nThis class is a dictionary-like object whose keys are strings and\nwhose values are *note Morsel: a4a. instances.  Note that upon\nsetting a key to a value, the value is first converted to a *note\nMorsel: a4a. containing the key and the value.\n\nIf 'input' is given, it is passed to the *note load(): 37cd.\nmethod.\n\n-- Class: http.cookies.SimpleCookie ([input])\n\nThis class derives from *note BaseCookie: 37cc. and overrides *note\nvaluedecode(): 37ce. and *note valueencode(): 37cf.\n'SimpleCookie' supports strings as cookie values.  When setting the\nvalue, 'SimpleCookie' calls the builtin *note str(): 157. to\nconvert the value to a string.  Values received from HTTP are kept\nas strings.\n\nSee also\n........\n\nModule *note http.cookiejar: 6b.\n\nHTTP cookie handling for web 'clients'.  The *note http.cookiejar:\n6b. and *note http.cookies: 6c. modules do not depend on each\nother.\n\nRFC 2109(5) - HTTP State Management Mechanism\n\nThis is the state management specification implemented by this\nmodule.\n\n* Menu:\n\n* Cookie Objects::\n* Morsel Objects::\n* Example: Example<13>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/http/cookies.py\n\n(2) https://datatracker.ietf.org/doc/html/rfc2109.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc2068.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc2109.html\n\n(5) https://datatracker.ietf.org/doc/html/rfc2109.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Cookie Objects,  Next: Morsel Objects,  Up: http cookies -- HTTP state management": {
            "content": "5.21.18.1 Cookie Objects\n........................\n\n-- Method: BaseCookie.valuedecode (val)\n\nReturn a tuple '(realvalue, codedvalue)' from a string\nrepresentation.  'realvalue' can be any type.  This method does no\ndecoding in *note BaseCookie: 37cc. -- it exists so it can be\noverridden.\n\n-- Method: BaseCookie.valueencode (val)\n\nReturn a tuple '(realvalue, codedvalue)'.  'val' can be any type,\nbut 'codedvalue' will always be converted to a string.  This\nmethod does no encoding in *note BaseCookie: 37cc. -- it exists so\nit can be overridden.\n\nIn general, it should be the case that *note valueencode(): 37cf.\nand *note valuedecode(): 37ce. are inverses on the range of\n'valuedecode'.\n\n-- Method: BaseCookie.output (attrs=None, header='Set-Cookie:',\nsep='\\r\\n')\n\nReturn a string representation suitable to be sent as HTTP headers.\n'attrs' and 'header' are sent to each *note Morsel: a4a.'s *note\noutput(): 37d2. method.  'sep' is used to join the headers\ntogether, and is by default the combination ''\\r\\n'' (CRLF).\n\n-- Method: BaseCookie.jsoutput (attrs=None)\n\nReturn an embeddable JavaScript snippet, which, if run on a browser\nwhich supports JavaScript, will act the same as if the HTTP headers\nwas sent.\n\nThe meaning for 'attrs' is the same as in *note output(): 37d2.\n\n-- Method: BaseCookie.load (rawdata)\n\nIf 'rawdata' is a string, parse it as an 'HTTPCOOKIE' and add the\nvalues found there as *note Morsel: a4a.s.  If it is a dictionary,\nit is equivalent to:\n\nfor k, v in rawdata.items():\ncookie[k] = v\n\nFile: python3.12.info,  Node: Morsel Objects,  Next: Example<13>,  Prev: Cookie Objects,  Up: http cookies -- HTTP state management\n\n5.21.18.2 Morsel Objects\n........................\n\n-- Class: http.cookies.Morsel\n\nAbstract a key/value pair, which has some RFC 2109(1) attributes.\n\nMorsels are dictionary-like objects, whose set of keys is constant\n-- the valid RFC 2109(2) attributes, which are:\n\n-- Attribute: expires\n-- Attribute: path\n-- Attribute: comment\n-- Attribute: domain\n\n-- Attribute: max-age\n-- Attribute: secure\n-- Attribute: version\n-- Attribute: httponly\n-- Attribute: samesite\n\nThe attribute *note httponly: 1225. specifies that the cookie is\nonly transferred in HTTP requests, and is not accessible through\nJavaScript.  This is intended to mitigate some forms of cross-site\nscripting.\n\nThe attribute *note samesite: 37dc. specifies that the browser is\nnot allowed to send the cookie along with cross-site requests.\nThis helps to mitigate CSRF attacks.  Valid values for this\nattribute are \"Strict\" and \"Lax\".\n\nThe keys are case-insensitive and their default value is ''''.\n\nChanged in version 3.5: 'eq()' now takes *note key: a47. and\n*note value: a48. into account.\n\nChanged in version 3.7: Attributes *note key: a47, *note value:\na48. and *note codedvalue: a49. are read-only.  Use *note set():\na4b. for setting them.\n\nChanged in version 3.8: Added support for the *note samesite: 37dc.\nattribute.\n\n-- Attribute: Morsel.value\n\nThe value of the cookie.\n\n-- Attribute: Morsel.codedvalue\n\nThe encoded value of the cookie -- this is what should be sent.\n\n-- Attribute: Morsel.key\n\nThe name of the cookie.\n\n-- Method: Morsel.set (key, value, codedvalue)\n\nSet the 'key', 'value' and 'codedvalue' attributes.\n\n-- Method: Morsel.isReservedKey (K)\n\nWhether 'K' is a member of the set of keys of a *note Morsel: a4a.\n\n-- Method: Morsel.output (attrs=None, header='Set-Cookie:')\n\nReturn a string representation of the Morsel, suitable to be sent\nas an HTTP header.  By default, all the attributes are included,\nunless 'attrs' is given, in which case it should be a list of\nattributes to use.  'header' is by default '\"Set-Cookie:\"'.\n\n-- Method: Morsel.jsoutput (attrs=None)\n\nReturn an embeddable JavaScript snippet, which, if run on a browser\nwhich supports JavaScript, will act the same as if the HTTP header\nwas sent.\n\nThe meaning for 'attrs' is the same as in *note output(): 37de.\n\n-- Method: Morsel.OutputString (attrs=None)\n\nReturn a string representing the Morsel, without any surrounding\nHTTP or JavaScript.\n\nThe meaning for 'attrs' is the same as in *note output(): 37de.\n\n-- Method: Morsel.update (values)\n\nUpdate the values in the Morsel dictionary with the values in the\ndictionary 'values'.  Raise an error if any of the keys in the\n'values' dict is not a valid RFC 2109(3) attribute.\n\nChanged in version 3.5: an error is raised for invalid keys.\n\n-- Method: Morsel.copy (value)\n\nReturn a shallow copy of the Morsel object.\n\nChanged in version 3.5: return a Morsel object instead of a dict.\n\n-- Method: Morsel.setdefault (key, value=None)\n\nRaise an error if key is not a valid RFC 2109(4) attribute,\notherwise behave the same as *note dict.setdefault(): ef0.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc2109.html\n\n(2) https://datatracker.ietf.org/doc/html/rfc2109.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc2109.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc2109.html\n\nFile: python3.12.info,  Node: Example<13>,  Prev: Morsel Objects,  Up: http cookies -- HTTP state management\n\n5.21.18.3 Example\n.................\n\nThe following example demonstrates how to use the *note http.cookies:\n6c. module.\n\n>>> from http import cookies\n>>> C = cookies.SimpleCookie()\n>>> C[\"fig\"] = \"newton\"\n>>> C[\"sugar\"] = \"wafer\"\n>>> print(C) # generate HTTP headers\nSet-Cookie: fig=newton\nSet-Cookie: sugar=wafer\n>>> print(C.output()) # same thing\nSet-Cookie: fig=newton\nSet-Cookie: sugar=wafer\n>>> C = cookies.SimpleCookie()\n>>> C[\"rocky\"] = \"road\"\n>>> C[\"rocky\"][\"path\"] = \"/cookie\"\n>>> print(C.output(header=\"Cookie:\"))\nCookie: rocky=road; Path=/cookie\n>>> print(C.output(attrs=[], header=\"Cookie:\"))\nCookie: rocky=road\n>>> C = cookies.SimpleCookie()\n>>> C.load(\"chips=ahoy; vienna=finger\") # load from a string (HTTP header)\n>>> print(C)\nSet-Cookie: chips=ahoy\nSet-Cookie: vienna=finger\n>>> C = cookies.SimpleCookie()\n>>> C.load('keebler=\"E=everybody; L=\\\\\"Loves\\\\\"; fudge=;\";')\n>>> print(C)\nSet-Cookie: keebler=\"E=everybody; L=\\\"Loves\\\"; fudge=;\"\n>>> C = cookies.SimpleCookie()\n>>> C[\"oreo\"] = \"doublestuff\"\n>>> C[\"oreo\"][\"path\"] = \"/\"\n>>> print(C)\nSet-Cookie: oreo=doublestuff; Path=/\n>>> C = cookies.SimpleCookie()\n>>> C[\"twix\"] = \"none for you\"\n>>> C[\"twix\"].value\n'none for you'\n>>> C = cookies.SimpleCookie()\n>>> C[\"number\"] = 7 # equivalent to C[\"number\"] = str(7)\n>>> C[\"string\"] = \"seven\"\n>>> C[\"number\"].value\n'7'\n>>> C[\"string\"].value\n'seven'\n>>> print(C)\nSet-Cookie: number=7\nSet-Cookie: string=seven\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "'Source code:' Lib/http/cookiejar.py(1)\n\n\n\nThe *note http.cookiejar: 6b. module defines classes for automatic\nhandling of HTTP cookies.  It is useful for accessing web sites that\nrequire small pieces of data - 'cookies' - to be set on the client\nmachine by an HTTP response from a web server, and then returned to the\nserver in later HTTP requests.\n",
            "subsections": []
        },
        "Both the regular Netscape cookie protocol and the protocol defined by": {
            "content": "RFC 2965(2) are handled.  RFC 2965 handling is switched off by default.\nRFC 2109(3) cookies are parsed as Netscape cookies and subsequently\ntreated either as Netscape or RFC 2965 cookies according to the 'policy'\nin effect.  Note that the great majority of cookies on the internet are\nNetscape cookies.  *note http.cookiejar: 6b. attempts to follow the\nde-facto Netscape cookie protocol (which differs substantially from that\nset out in the original Netscape specification), including taking note\nof the 'max-age' and 'port' cookie-attributes introduced with RFC 2965.\n\nNote: The various named parameters found in 'Set-Cookie' and\n'Set-Cookie2' headers (eg.  'domain' and 'expires') are\nconventionally referred to as 'attributes'.  To distinguish them\nfrom Python attributes, the documentation for this module uses the\nterm 'cookie-attribute' instead.\n\nThe module defines the following exception:\n\n-- Exception: http.cookiejar.LoadError\n\nInstances of *note FileCookieJar: 37e7. raise this exception on\nfailure to load cookies from a file.  *note LoadError: 37e6. is a\nsubclass of *note OSError: 613.\n\nChanged in version 3.3: *note LoadError: 37e6. used to be a subtype\nof *note IOError: ecb, which is now an alias of *note OSError: 613.\n\nThe following classes are provided:\n\n-- Class: http.cookiejar.CookieJar (policy=None)\n\n'policy' is an object implementing the *note CookiePolicy: 37e8.\ninterface.\n\nThe *note CookieJar: 3616. class stores HTTP cookies.  It extracts\ncookies from HTTP requests, and returns them in HTTP responses.\n*note CookieJar: 3616. instances automatically expire contained\ncookies when necessary.  Subclasses are also responsible for\nstoring and retrieving cookies from a file or database.\n\n-- Class: http.cookiejar.FileCookieJar (filename=None, delayload=None,\npolicy=None)\n\n'policy' is an object implementing the *note CookiePolicy: 37e8.\ninterface.  For the other arguments, see the documentation for the\ncorresponding attributes.\n\nA *note CookieJar: 3616. which can load cookies from, and perhaps\nsave cookies to, a file on disk.  Cookies are 'NOT' loaded from the\nnamed file until either the *note load(): 37e9. or *note revert():\n37ea. method is called.  Subclasses of this class are documented in\nsection *note FileCookieJar subclasses and co-operation with web\nbrowsers: 37eb.\n\nThis should not be initialized directly - use its subclasses below\ninstead.\n\nChanged in version 3.8: The filename parameter supports a *note\npath-like object: 957.\n\n-- Class: http.cookiejar.CookiePolicy\n\nThis class is responsible for deciding whether each cookie should\nbe accepted from / returned to the server.\n\n-- Class: http.cookiejar.DefaultCookiePolicy (blockeddomains=None,\nalloweddomains=None, netscape=True, rfc2965=False,\nrfc2109asnetscape=None, hidecookie2=False,\nstrictdomain=False, strictrfc2965unverifiable=True,\nstrictnsunverifiable=False,\nstrictnsdomain=DefaultCookiePolicy.DomainLiberal,\nstrictnssetinitialdollar=False, strictnssetpath=False,\nsecureprotocols=('https', 'wss'))\n\nConstructor arguments should be passed as keyword arguments only.\n'blockeddomains' is a sequence of domain names that we never\naccept cookies from, nor return cookies to.  'alloweddomains' if\nnot *note None: 43f, this is a sequence of the only domains for\nwhich we accept and return cookies.  'secureprotocols' is a\nsequence of protocols for which secure cookies can be added to.  By\ndefault 'https' and 'wss' (secure websocket) are considered secure\nprotocols.  For all other arguments, see the documentation for\n*note CookiePolicy: 37e8. and *note DefaultCookiePolicy: 1789.\nobjects.\n\n*note DefaultCookiePolicy: 1789. implements the standard accept /\nreject rules for Netscape and RFC 2965(4) cookies.  By default, RFC\n2109(5) cookies (ie.  cookies received in a 'Set-Cookie' header\nwith a version cookie-attribute of 1) are treated according to the\nRFC 2965 rules.  However, if RFC 2965 handling is turned off or\n*note rfc2109asnetscape: 37ec. is 'True', RFC 2109 cookies are\n'downgraded' by the *note CookieJar: 3616. instance to Netscape\ncookies, by setting the 'version' attribute of the *note Cookie:\n37ed. instance to 0.  *note DefaultCookiePolicy: 1789. also\nprovides some parameters to allow some fine-tuning of policy.\n\n-- Class: http.cookiejar.Cookie\n\nThis class represents Netscape, RFC 2109(6) and RFC 2965(7)\ncookies.  It is not expected that users of *note http.cookiejar:\n6b. construct their own *note Cookie: 37ed. instances.  Instead, if\nnecessary, call 'makecookies()' on a *note CookieJar: 3616.\ninstance.\n\nSee also\n........\n\nModule *note urllib.request: 106.\n\nURL opening with automatic cookie handling.\n\nModule *note http.cookies: 6c.\n\nHTTP cookie classes, principally useful for server-side code.  The\n*note http.cookiejar: 6b. and *note http.cookies: 6c. modules do\nnot depend on each other.\n\n'https://curl.se/rfc/cookiespec.html'\n\nThe specification of the original Netscape cookie protocol.  Though\nthis is still the dominant protocol, the 'Netscape cookie protocol'\nimplemented by all the major browsers (and *note http.cookiejar:\n6b.) only bears a passing resemblance to the one sketched out in\n'cookiespec.html'.\n\nRFC 2109(8) - HTTP State Management Mechanism\n\nObsoleted by RFC 2965(9).  Uses 'Set-Cookie' with version=1.\n\nRFC 2965(10) - HTTP State Management Mechanism\n\nThe Netscape protocol with the bugs fixed.  Uses 'Set-Cookie2' in\nplace of 'Set-Cookie'.  Not widely used.\n\n'http://kristol.org/cookie/errata.html'\n\nUnfinished errata to RFC 2965(11).\n\nRFC 2964(12) - Use of HTTP State Management\n\n* Menu:\n\n* CookieJar and FileCookieJar Objects::\n* FileCookieJar subclasses and co-operation with web browsers::\n* CookiePolicy Objects::\n* DefaultCookiePolicy Objects::\n* Cookie Objects: Cookie Objects<2>.\n* Examples: Examples<28>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/http/cookiejar.py\n\n(2) https://datatracker.ietf.org/doc/html/rfc2965.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc2109.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc2965.html\n\n(5) https://datatracker.ietf.org/doc/html/rfc2109.html\n\n(6) https://datatracker.ietf.org/doc/html/rfc2109.html\n\n(7) https://datatracker.ietf.org/doc/html/rfc2965.html\n\n(8) https://datatracker.ietf.org/doc/html/rfc2109.html\n\n(9) https://datatracker.ietf.org/doc/html/rfc2965.html\n\n(10) https://datatracker.ietf.org/doc/html/rfc2965.html\n\n(11) https://datatracker.ietf.org/doc/html/rfc2965.html\n\n(12) https://datatracker.ietf.org/doc/html/rfc2964.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: CookieJar and FileCookieJar Objects,  Next: FileCookieJar subclasses and co-operation with web browsers,  Up: http cookiejar -- Cookie handling for HTTP clients": {
            "content": "5.21.19.1 CookieJar and FileCookieJar Objects\n.............................................\n\n*note CookieJar: 3616. objects support the *note iterator: 16a9.\nprotocol for iterating over contained *note Cookie: 37ed. objects.\n\n*note CookieJar: 3616. has the following methods:\n\n-- Method: CookieJar.addcookieheader (request)\n\nAdd correct 'Cookie' header to 'request'.\n\nIf policy allows (ie.  the 'rfc2965' and 'hidecookie2' attributes\nof the *note CookieJar: 3616.'s *note CookiePolicy: 37e8. instance\nare true and false respectively), the 'Cookie2' header is also\nadded when appropriate.\n\nThe 'request' object (usually a *note urllib.request.Request: e4b.\ninstance) must support the methods 'getfullurl()',\n'hasheader()', 'getheader()', 'headeritems()',\n'addunredirectedheader()' and the attributes 'host', 'type',\n'unverifiable' and 'originreqhost' as documented by *note\nurllib.request: 106.\n\nChanged in version 3.3: 'request' object needs 'originreqhost'\nattribute.  Dependency on a deprecated method\n'getoriginreqhost()' has been removed.\n\n-- Method: CookieJar.extractcookies (response, request)\n\nExtract cookies from HTTP 'response' and store them in the *note\nCookieJar: 3616, where allowed by policy.\n\nThe *note CookieJar: 3616. will look for allowable 'Set-Cookie' and\n'Set-Cookie2' headers in the 'response' argument, and store cookies\nas appropriate (subject to the *note CookiePolicy.setok(): 37f2.\nmethod's approval).\n\nThe 'response' object (usually the result of a call to *note\nurllib.request.urlopen(): cf9, or similar) should support an\n'info()' method, which returns an *note email.message.Message: ae7.\ninstance.\n\nThe 'request' object (usually a *note urllib.request.Request: e4b.\ninstance) must support the method 'getfullurl()' and the\nattributes 'host', 'unverifiable' and 'originreqhost', as\ndocumented by *note urllib.request: 106.  The request is used to\nset default values for cookie-attributes as well as for checking\nthat the cookie is allowed to be set.\n\nChanged in version 3.3: 'request' object needs 'originreqhost'\nattribute.  Dependency on a deprecated method\n'getoriginreqhost()' has been removed.\n\n-- Method: CookieJar.setpolicy (policy)\n\nSet the *note CookiePolicy: 37e8. instance to be used.\n\n-- Method: CookieJar.makecookies (response, request)\n\nReturn sequence of *note Cookie: 37ed. objects extracted from\n'response' object.\n\nSee the documentation for *note extractcookies(): 37f1. for the\ninterfaces required of the 'response' and 'request' arguments.\n\n-- Method: CookieJar.setcookieifok (cookie, request)\n\nSet a *note Cookie: 37ed. if policy says it's OK to do so.\n\n-- Method: CookieJar.setcookie (cookie)\n\nSet a *note Cookie: 37ed, without checking with policy to see\nwhether or not it should be set.\n\n-- Method: CookieJar.clear ([domain[, path[, name]]])\n\nClear some cookies.\n\nIf invoked without arguments, clear all cookies.  If given a single\nargument, only cookies belonging to that 'domain' will be removed.\nIf given two arguments, cookies belonging to the specified 'domain'\nand URL 'path' are removed.  If given three arguments, then the\ncookie with the specified 'domain', 'path' and 'name' is removed.\n\nRaises *note KeyError: 8cf. if no matching cookie exists.\n\n-- Method: CookieJar.clearsessioncookies ()\n\nDiscard all session cookies.\n\nDiscards all contained cookies that have a true 'discard' attribute\n(usually because they had either no 'max-age' or 'expires'\ncookie-attribute, or an explicit 'discard' cookie-attribute).  For\ninteractive browsers, the end of a session usually corresponds to\nclosing the browser window.\n\nNote that the 'save()' method won't save session cookies anyway,\nunless you ask otherwise by passing a true 'ignorediscard'\nargument.\n\n*note FileCookieJar: 37e7. implements the following additional methods:\n\n-- Method: FileCookieJar.save (filename=None, ignorediscard=False,\nignoreexpires=False)\n\nSave cookies to a file.\n\nThis base class raises *note NotImplementedError: ba5.  Subclasses\nmay leave this method unimplemented.\n\n'filename' is the name of file in which to save cookies.  If\n'filename' is not specified, 'self.filename' is used (whose default\nis the value passed to the constructor, if any); if 'self.filename'\nis *note None: 43f, *note ValueError: 183. is raised.\n\n'ignorediscard': save even cookies set to be discarded.\n'ignoreexpires': save even cookies that have expired\n\nThe file is overwritten if it already exists, thus wiping all the\ncookies it contains.  Saved cookies can be restored later using the\n*note load(): 37e9. or *note revert(): 37ea. methods.\n\n-- Method: FileCookieJar.load (filename=None, ignorediscard=False,\nignoreexpires=False)\n\nLoad cookies from a file.\n\nOld cookies are kept unless overwritten by newly loaded ones.\n\nArguments are as for *note save(): 37f9.\n\nThe named file must be in the format understood by the class, or\n*note LoadError: 37e6. will be raised.  Also, *note OSError: 613.\nmay be raised, for example if the file does not exist.\n\nChanged in version 3.3: *note IOError: ecb. used to be raised, it\nis now an alias of *note OSError: 613.\n\n-- Method: FileCookieJar.revert (filename=None, ignorediscard=False,\nignoreexpires=False)\n\nClear all cookies and reload cookies from a saved file.\n\n*note revert(): 37ea. can raise the same exceptions as *note\nload(): 37e9.  If there is a failure, the object's state will not\nbe altered.\n\n*note FileCookieJar: 37e7. instances have the following public\nattributes:\n\n-- Attribute: FileCookieJar.filename\n\nFilename of default file in which to keep cookies.  This attribute\nmay be assigned to.\n\n-- Attribute: FileCookieJar.delayload\n\nIf true, load cookies lazily from disk.  This attribute should not\nbe assigned to.  This is only a hint, since this only affects\nperformance, not behaviour (unless the cookies on disk are\nchanging).  A *note CookieJar: 3616. object may ignore it.  None of\nthe *note FileCookieJar: 37e7. classes included in the standard\nlibrary lazily loads cookies.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "5.21.19.2 FileCookieJar subclasses and co-operation with web browsers\n.....................................................................\n\nThe following *note CookieJar: 3616. subclasses are provided for reading\nand writing.\n\n-- Class: http.cookiejar.MozillaCookieJar (filename=None,\ndelayload=None, policy=None)\n\nA *note FileCookieJar: 37e7. that can load from and save cookies to\ndisk in the Mozilla 'cookies.txt' file format (which is also used\nby curl and the Lynx and Netscape browsers).\n\nNote: This loses information about RFC 2965(1) cookies, and\nalso about newer or non-standard cookie-attributes such as\n'port'.\n\nWarning: Back up your cookies before saving if you have\ncookies whose loss / corruption would be inconvenient (there\nare some subtleties which may lead to slight changes in the\nfile over a load / save round-trip).\n\nAlso note that cookies saved while Mozilla is running will get\nclobbered by Mozilla.\n\n-- Class: http.cookiejar.LWPCookieJar (filename=None, delayload=None,\npolicy=None)\n\nA *note FileCookieJar: 37e7. that can load from and save cookies to\ndisk in format compatible with the libwww-perl library's\n'Set-Cookie3' file format.  This is convenient if you want to store\ncookies in a human-readable file.\n\nChanged in version 3.8: The filename parameter supports a *note\npath-like object: 957.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc2965.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: CookiePolicy Objects,  Next: DefaultCookiePolicy Objects,  Prev: FileCookieJar subclasses and co-operation with web browsers,  Up: http cookiejar -- Cookie handling for HTTP clients": {
            "content": "5.21.19.3 CookiePolicy Objects\n..............................\n\nObjects implementing the *note CookiePolicy: 37e8. interface have the\nfollowing methods:\n\n-- Method: CookiePolicy.setok (cookie, request)\n\nReturn boolean value indicating whether cookie should be accepted\nfrom server.\n\n'cookie' is a *note Cookie: 37ed. instance.  'request' is an object\nimplementing the interface defined by the documentation for *note\nCookieJar.extractcookies(): 37f1.\n\n-- Method: CookiePolicy.returnok (cookie, request)\n\nReturn boolean value indicating whether cookie should be returned\nto server.\n\n'cookie' is a *note Cookie: 37ed. instance.  'request' is an object\nimplementing the interface defined by the documentation for *note\nCookieJar.addcookieheader(): 37f0.\n\n-- Method: CookiePolicy.domainreturnok (domain, request)\n\nReturn 'False' if cookies should not be returned, given cookie\ndomain.\n\nThis method is an optimization.  It removes the need for checking\nevery cookie with a particular domain (which might involve reading\nmany files).  Returning true from *note domainreturnok(): 3802.\nand *note pathreturnok(): 3803. leaves all the work to *note\nreturnok(): 3801.\n\nIf *note domainreturnok(): 3802. returns true for the cookie\ndomain, *note pathreturnok(): 3803. is called for the cookie\npath.  Otherwise, *note pathreturnok(): 3803. and *note\nreturnok(): 3801. are never called for that cookie domain.  If\n*note pathreturnok(): 3803. returns true, *note returnok():\n3801. is called with the *note Cookie: 37ed. object itself for a\nfull check.  Otherwise, *note returnok(): 3801. is never called\nfor that cookie path.\n\nNote that *note domainreturnok(): 3802. is called for every\n'cookie' domain, not just for the 'request' domain.  For example,\nthe function might be called with both '\".example.com\"' and\n'\"www.example.com\"' if the request domain is '\"www.example.com\"'.\nThe same goes for *note pathreturnok(): 3803.\n\nThe 'request' argument is as documented for *note returnok():\n3801.\n\n-- Method: CookiePolicy.pathreturnok (path, request)\n\nReturn 'False' if cookies should not be returned, given cookie\npath.\n\nSee the documentation for *note domainreturnok(): 3802.\n",
            "subsections": []
        },
        "In addition to implementing the methods above, implementations of the": {
            "content": "*note CookiePolicy: 37e8. interface must also supply the following\nattributes, indicating which protocols should be used, and how.  All of\nthese attributes may be assigned to.\n\n-- Attribute: CookiePolicy.netscape\n\nImplement Netscape protocol.\n\n-- Attribute: CookiePolicy.rfc2965\n\nImplement RFC 2965(1) protocol.\n\n-- Attribute: CookiePolicy.hidecookie2\n\nDon't add 'Cookie2' header to requests (the presence of this header\nindicates to the server that we understand RFC 2965(2) cookies).\n\nThe most useful way to define a *note CookiePolicy: 37e8. class is by\nsubclassing from *note DefaultCookiePolicy: 1789. and overriding some or\nall of the methods above.  *note CookiePolicy: 37e8. itself may be used\nas a 'null policy' to allow setting and receiving any and all cookies\n(this is unlikely to be useful).\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc2965.html\n\n(2) https://datatracker.ietf.org/doc/html/rfc2965.html\n\nFile: python3.12.info,  Node: DefaultCookiePolicy Objects,  Next: Cookie Objects<2>,  Prev: CookiePolicy Objects,  Up: http cookiejar -- Cookie handling for HTTP clients\n\n5.21.19.4 DefaultCookiePolicy Objects\n.....................................\n\nImplements the standard rules for accepting and returning cookies.\n",
            "subsections": []
        },
        "Both RFC 2965(1) and Netscape cookies are covered.  RFC 2965 handling is": {
            "content": "switched off by default.\n",
            "subsections": []
        },
        "The easiest way to provide your own policy is to override this class and": {
            "content": "call its methods in your overridden implementations before adding your\nown additional checks:\n\nimport http.cookiejar\nclass MyCookiePolicy(http.cookiejar.DefaultCookiePolicy):\ndef setok(self, cookie, request):\nif not http.cookiejar.DefaultCookiePolicy.setok(self, cookie, request):\nreturn False\nif idontwanttostorethiscookie(cookie):\nreturn False\nreturn True\n\nIn addition to the features required to implement the *note",
            "subsections": []
        },
        "CookiePolicy: 37e8. interface, this class allows you to block and allow": {
            "content": "domains from setting and receiving cookies.  There are also some\nstrictness switches that allow you to tighten up the rather loose",
            "subsections": []
        },
        "Netscape protocol rules a little bit (at the cost of blocking some": {
            "content": "benign cookies).\n\nA domain blocklist and allowlist is provided (both off by default).",
            "subsections": []
        },
        "Only domains not in the blocklist and present in the allowlist (if the": {
            "content": "allowlist is active) participate in cookie setting and returning.  Use\nthe 'blockeddomains' constructor argument, and 'blockeddomains()' and\n'setblockeddomains()' methods (and the corresponding argument and\nmethods for 'alloweddomains').  If you set an allowlist, you can turn\nit off again by setting it to *note None: 43f.\n",
            "subsections": []
        },
        "Domains in block or allow lists that do not start with a dot must equal": {
            "content": "the cookie domain to be matched.  For example, '\"example.com\"' matches a\nblocklist entry of '\"example.com\"', but '\"www.example.com\"' does not.",
            "subsections": []
        },
        "Domains that do start with a dot are matched by more specific domains": {
            "content": "too.  For example, both '\"www.example.com\"' and\n'\"www.coyote.example.com\"' match '\".example.com\"' (but '\"example.com\"'\nitself does not).  IP addresses are an exception, and must match\nexactly.  For example, if blockeddomains contains '\"192.168.1.2\"' and\n'\".168.1.2\"', 192.168.1.2 is blocked, but 193.168.1.2 is not.\n\n*note DefaultCookiePolicy: 1789. implements the following additional\nmethods:\n\n-- Method: DefaultCookiePolicy.blockeddomains ()\n\nReturn the sequence of blocked domains (as a tuple).\n\n-- Method: DefaultCookiePolicy.setblockeddomains (blockeddomains)\n\nSet the sequence of blocked domains.\n\n-- Method: DefaultCookiePolicy.isblocked (domain)\n\nReturn 'True' if 'domain' is on the blocklist for setting or\nreceiving cookies.\n\n-- Method: DefaultCookiePolicy.alloweddomains ()\n\nReturn *note None: 43f, or the sequence of allowed domains (as a\ntuple).\n\n-- Method: DefaultCookiePolicy.setalloweddomains (alloweddomains)\n\nSet the sequence of allowed domains, or *note None: 43f.\n\n-- Method: DefaultCookiePolicy.isnotallowed (domain)\n\nReturn 'True' if 'domain' is not on the allowlist for setting or\nreceiving cookies.\n\n*note DefaultCookiePolicy: 1789. instances have the following\nattributes, which are all initialised from the constructor arguments of\nthe same name, and which may all be assigned to.\n\n-- Attribute: DefaultCookiePolicy.rfc2109asnetscape\n\nIf true, request that the *note CookieJar: 3616. instance downgrade\nRFC 2109(2) cookies (ie.  cookies received in a 'Set-Cookie' header\nwith a version cookie-attribute of 1) to Netscape cookies by\nsetting the version attribute of the *note Cookie: 37ed. instance\nto 0.  The default value is *note None: 43f, in which case RFC 2109\ncookies are downgraded if and only if RFC 2965(3) handling is\nturned off.  Therefore, RFC 2109 cookies are downgraded by default.\n\nGeneral strictness switches:\n\n-- Attribute: DefaultCookiePolicy.strictdomain\n\nDon't allow sites to set two-component domains with country-code\ntop-level domains like '.co.uk', '.gov.uk', '.co.nz'.etc.  This is\nfar from perfect and isn't guaranteed to work!\n\nRFC 2965(4) protocol strictness switches:\n\n-- Attribute: DefaultCookiePolicy.strictrfc2965unverifiable\n\nFollow RFC 2965(5) rules on unverifiable transactions (usually, an\nunverifiable transaction is one resulting from a redirect or a\nrequest for an image hosted on another site).  If this is false,\ncookies are 'never' blocked on the basis of verifiability\n\nNetscape protocol strictness switches:\n\n-- Attribute: DefaultCookiePolicy.strictnsunverifiable\n\nApply RFC 2965(6) rules on unverifiable transactions even to\nNetscape cookies.\n\n-- Attribute: DefaultCookiePolicy.strictnsdomain\n\nFlags indicating how strict to be with domain-matching rules for\nNetscape cookies.  See below for acceptable values.\n\n-- Attribute: DefaultCookiePolicy.strictnssetinitialdollar\n\nIgnore cookies in Set-Cookie: headers that have names starting with\n''$''.\n\n-- Attribute: DefaultCookiePolicy.strictnssetpath\n\nDon't allow setting cookies whose path doesn't path-match request\nURI.\n\n'strictnsdomain' is a collection of flags.  Its value is constructed\nby or-ing together (for example,\n'DomainStrictNoDots|DomainStrictNonDomain' means both flags are set).\n\n-- Attribute: DefaultCookiePolicy.DomainStrictNoDots\n\nWhen setting cookies, the 'host prefix' must not contain a dot (eg.\n'www.foo.bar.com' can't set a cookie for '.bar.com', because\n'www.foo' contains a dot).\n\n-- Attribute: DefaultCookiePolicy.DomainStrictNonDomain\n\nCookies that did not explicitly specify a 'domain' cookie-attribute\ncan only be returned to a domain equal to the domain that set the\ncookie (eg.  'spam.example.com' won't be returned cookies from\n'example.com' that had no 'domain' cookie-attribute).\n\n-- Attribute: DefaultCookiePolicy.DomainRFC2965Match\n\nWhen setting cookies, require a full RFC 2965(7) domain-match.\n",
            "subsections": []
        },
        "The following attributes are provided for convenience, and are the most": {
            "content": "useful combinations of the above flags:\n\n-- Attribute: DefaultCookiePolicy.DomainLiberal\n\nEquivalent to 0 (ie.  all of the above Netscape domain strictness\nflags switched off).\n\n-- Attribute: DefaultCookiePolicy.DomainStrict\n\nEquivalent to 'DomainStrictNoDots|DomainStrictNonDomain'.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc2965.html\n\n(2) https://datatracker.ietf.org/doc/html/rfc2109.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc2965.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc2965.html\n\n(5) https://datatracker.ietf.org/doc/html/rfc2965.html\n\n(6) https://datatracker.ietf.org/doc/html/rfc2965.html\n\n(7) https://datatracker.ietf.org/doc/html/rfc2965.html\n\nFile: python3.12.info,  Node: Cookie Objects<2>,  Next: Examples<28>,  Prev: DefaultCookiePolicy Objects,  Up: http cookiejar -- Cookie handling for HTTP clients\n\n5.21.19.5 Cookie Objects\n........................\n\n*note Cookie: 37ed. instances have Python attributes roughly\ncorresponding to the standard cookie-attributes specified in the various\ncookie standards.  The correspondence is not one-to-one, because there\nare complicated rules for assigning default values, because the\n'max-age' and 'expires' cookie-attributes contain equivalent\ninformation, and because RFC 2109(1) cookies may be 'downgraded' by\n*note http.cookiejar: 6b. from version 1 to version 0 (Netscape)\ncookies.\n",
            "subsections": []
        },
        "Assignment to these attributes should not be necessary other than in": {
            "content": "rare circumstances in a *note CookiePolicy: 37e8. method.  The class\ndoes not enforce internal consistency, so you should know what you're\ndoing if you do that.\n\n-- Attribute: Cookie.version\n\nInteger or *note None: 43f.  Netscape cookies have *note version:\n381b. 0.  RFC 2965(2) and RFC 2109(3) cookies have a 'version'\ncookie-attribute of 1.  However, note that *note http.cookiejar:\n6b. may 'downgrade' RFC 2109 cookies to Netscape cookies, in which\ncase *note version: 381b. is 0.\n\n-- Attribute: Cookie.name\n\nCookie name (a string).\n\n-- Attribute: Cookie.value\n\nCookie value (a string), or *note None: 43f.\n\n-- Attribute: Cookie.port\n\nString representing a port or a set of ports (eg.  '80', or\n'80,8080'), or *note None: 43f.\n\n-- Attribute: Cookie.domain\n\nCookie domain (a string).\n\n-- Attribute: Cookie.path\n\nCookie path (a string, eg.  ''/acme/rocketlaunchers'').\n\n-- Attribute: Cookie.secure\n\n'True' if cookie should only be returned over a secure connection.\n\n-- Attribute: Cookie.expires\n\nInteger expiry date in seconds since epoch, or *note None: 43f.\nSee also the *note isexpired(): 3823. method.\n\n-- Attribute: Cookie.discard\n\n'True' if this is a session cookie.\n\n-- Attribute: Cookie.comment\n\nString comment from the server explaining the function of this\ncookie, or *note None: 43f.\n\n-- Attribute: Cookie.commenturl\n\nURL linking to a comment from the server explaining the function of\nthis cookie, or *note None: 43f.\n\n-- Attribute: Cookie.rfc2109\n\n'True' if this cookie was received as an RFC 2109(4) cookie (ie.\nthe cookie arrived in a 'Set-Cookie' header, and the value of the\nVersion cookie-attribute in that header was 1).  This attribute is\nprovided because *note http.cookiejar: 6b. may 'downgrade' RFC 2109\ncookies to Netscape cookies, in which case *note version: 381b. is\n0.\n\n-- Attribute: Cookie.portspecified\n\n'True' if a port or set of ports was explicitly specified by the\nserver (in the 'Set-Cookie' / 'Set-Cookie2' header).\n\n-- Attribute: Cookie.domainspecified\n\n'True' if a domain was explicitly specified by the server.\n\n-- Attribute: Cookie.domaininitialdot\n\n'True' if the domain explicitly specified by the server began with\na dot (''.'').\n",
            "subsections": []
        },
        "Cookies may have additional non-standard cookie-attributes.  These may": {
            "content": "be accessed using the following methods:\n\n-- Method: Cookie.hasnonstandardattr (name)\n\nReturn 'True' if cookie has the named cookie-attribute.\n\n-- Method: Cookie.getnonstandardattr (name, default=None)\n\nIf cookie has the named cookie-attribute, return its value.\nOtherwise, return 'default'.\n\n-- Method: Cookie.setnonstandardattr (name, value)\n\nSet the value of the named cookie-attribute.\n\nThe *note Cookie: 37ed. class also defines the following method:\n\n-- Method: Cookie.isexpired (now=None)\n\n'True' if cookie has passed the time at which the server requested\nit should expire.  If 'now' is given (in seconds since the epoch),\nreturn whether the cookie has expired at the specified time.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc2109.html\n\n(2) https://datatracker.ietf.org/doc/html/rfc2965.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc2109.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc2109.html\n\nFile: python3.12.info,  Node: Examples<28>,  Prev: Cookie Objects<2>,  Up: http cookiejar -- Cookie handling for HTTP clients\n\n5.21.19.6 Examples\n..................\n\nThe first example shows the most common usage of *note http.cookiejar:\n6b.:\n\nimport http.cookiejar, urllib.request\ncj = http.cookiejar.CookieJar()\nopener = urllib.request.buildopener(urllib.request.HTTPCookieProcessor(cj))\nr = opener.open(\"http://example.com/\")\n",
            "subsections": []
        },
        "This example illustrates how to open a URL using your Netscape, Mozilla,": {
            "content": "or Lynx cookies (assumes Unix/Netscape convention for location of the\ncookies file):\n\nimport os, http.cookiejar, urllib.request\ncj = http.cookiejar.MozillaCookieJar()\ncj.load(os.path.join(os.path.expanduser(\"~\"), \".netscape\", \"cookies.txt\"))\nopener = urllib.request.buildopener(urllib.request.HTTPCookieProcessor(cj))\nr = opener.open(\"http://example.com/\")\n\nThe next example illustrates the use of *note DefaultCookiePolicy: 1789.",
            "subsections": []
        },
        "Turn on RFC 2965(1) cookies, be more strict about domains when setting": {
            "content": "and returning Netscape cookies, and block some domains from setting\ncookies or having them returned:\n\nimport urllib.request\nfrom http.cookiejar import CookieJar, DefaultCookiePolicy\npolicy = DefaultCookiePolicy(\nrfc2965=True, strictnsdomain=Policy.DomainStrict,\nblockeddomains=[\"ads.net\", \".ads.net\"])\ncj = CookieJar(policy)\nopener = urllib.request.buildopener(urllib.request.HTTPCookieProcessor(cj))\nr = opener.open(\"http://example.com/\")\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc2965.html\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "XML-RPC is a Remote Procedure Call method that uses XML passed via HTTP\nas a transport.  With it, a client can call methods with parameters on a\nremote server (the server is named by a URI) and get back structured\ndata.\n\n'xmlrpc' is a package that collects server and client modules\nimplementing XML-RPC. The modules are:\n\n* *note xmlrpc.client: 128.\n\n* *note xmlrpc.server: 129.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "'Source code:' Lib/xmlrpc/client.py(1)\n\n\n\nXML-RPC is a Remote Procedure Call method that uses XML passed via\nHTTP(S) as a transport.  With it, a client can call methods with\nparameters on a remote server (the server is named by a URI) and get\nback structured data.  This module supports writing XML-RPC client code;\nit handles all the details of translating between conformable Python\nobjects and XML on the wire.\n\nWarning: The *note xmlrpc.client: 128. module is not secure against\nmaliciously constructed data.  If you need to parse untrusted or\nunauthenticated data see *note XML vulnerabilities: 33aa.\n\nChanged in version 3.5: For HTTPS URIs, *note xmlrpc.client: 128. now\nperforms all the necessary certificate and hostname checks by default.\n\n*note Availability: 1ad3.: not Emscripten, not WASI.\n",
            "subsections": []
        },
        "Both the HTTP and HTTPS transports support the URL syntax extension for": {
            "content": "HTTP Basic Authentication: 'http://user:pass@host:port/path'.  The\n'user:pass' portion will be base64-encoded as an HTTP 'Authorization'\nheader, and sent to the remote server as part of the connection process\nwhen invoking an XML-RPC method.  You only need to use this if the\nremote server requires a Basic Authentication user and password.  If an\nHTTPS URL is provided, 'context' may be *note ssl.SSLContext: 278. and\nconfigures the SSL settings of the underlying HTTPS connection.\n",
            "subsections": []
        },
        "The returned instance is a proxy object with methods that can be used to": {
            "content": "invoke corresponding RPC calls on the remote server.  If the remote\nserver supports the introspection API, the proxy can also be used to\nquery the remote server for the methods it supports (service discovery)\nand fetch other server-associated metadata.\n",
            "subsections": []
        },
        "Types that are conformable (e.g.  that can be marshalled through XML),": {
            "content": "include the following (and except where noted, they are unmarshalled as\nthe same Python type):\n\nXML-RPC type               Python type\n\n---------------------------------------------------------------------------------------\n\n'boolean'                  *note bool: 17d.\n\n\n'int', 'i1', 'i2', 'i4',   *note int: 17e. in range from -2147483648 to 2147483647.\n'i8' or 'biginteger'       Values get the '<int>' tag.\n\n\n'double' or 'float'        *note float: 4b7.  Values get the '<double>' tag.\n\n\n'string'                   *note str: 157.\n\n\n'array'                    *note list: 3dc. or *note tuple: 4b8. containing\nconformable elements.  Arrays are returned as\n*note lists: 3dc.\n\n\n'struct'                   *note dict: 237.  Keys must be strings, values may be any\nconformable type.  Objects of user-defined classes can be\npassed in; only their *note dict: aa8. attribute is\ntransmitted.\n\n\n'dateTime.iso8601'         *note DateTime: 1238. or *note datetime.datetime: 222.\nReturned type depends on values of 'usebuiltintypes'\nand 'usedatetime' flags.\n\n\n'base64'                   *note Binary: 3833, *note bytes: 295. or\n*note bytearray: 294.  Returned type depends on the value\nof the 'usebuiltintypes' flag.\n\n\n'nil'                      The 'None' constant.  Passing is allowed only if\n'allownone' is true.\n\n\n'bigdecimal'               *note decimal.Decimal: 5c3.  Returned type only.\n\n",
            "subsections": []
        },
        "This is the full set of data types supported by XML-RPC. Method calls": {
            "content": "may also raise a special *note Fault: 3834. instance, used to signal\nXML-RPC server errors, or *note ProtocolError: 3835. used to signal an\nerror in the HTTP/HTTPS transport layer.  Both *note Fault: 3834. and\n*note ProtocolError: 3835. derive from a base class called 'Error'.",
            "subsections": []
        },
        "Note that the xmlrpc client module currently does not marshal instances": {
            "content": "of subclasses of built-in types.\n\nWhen passing strings, characters special to XML such as '<', '>', and\n'&' will be automatically escaped.  However, it's the caller's\nresponsibility to ensure that the string is free of characters that\naren't allowed in XML, such as the control characters with ASCII values\nbetween 0 and 31 (except, of course, tab, newline and carriage return);\nfailing to do this will result in an XML-RPC request that isn't\nwell-formed XML. If you have to pass arbitrary bytes via XML-RPC, use\n*note bytes: 295. or *note bytearray: 294. classes or the *note Binary:\n3833. wrapper class described below.\n\n'Server' is retained as an alias for *note ServerProxy: 883. for\nbackwards compatibility.  New code should use *note ServerProxy: 883.\n\nChanged in version 3.5: Added the 'context' argument.\n\nChanged in version 3.6: Added support of type tags with prefixes (e.g.\n'ex:nil').  Added support of unmarshalling additional types used by",
            "subsections": []
        },
        "Apache XML-RPC implementation for numerics: 'i1', 'i2', 'i8',": {
            "content": "'biginteger', 'float' and 'bigdecimal'.  See\n'https://ws.apache.org/xmlrpc/types.html' for a description.\n\nSee also\n........\n\nXML-RPC HOWTO(3)\n\nA good description of XML-RPC operation and client software in\nseveral languages.  Contains pretty much everything an XML-RPC\nclient developer needs to know.\n\nXML-RPC Introspection(4)\n\nDescribes the XML-RPC protocol extension for introspection.\n\nXML-RPC Specification(5)\n\nThe official specification.\n\n* Menu:\n\n* ServerProxy Objects::\n* DateTime Objects::\n* Binary Objects::\n* Fault Objects::\n* ProtocolError Objects::\n* MultiCall Objects::\n* Convenience Functions::\n* Example of Client Usage::\n* Example of Client and Server Usage::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/xmlrpc/client.py\n\n(2)\nhttps://web.archive.org/web/20130120074804/http://ontosys.com/xml-rpc/extensions.php\n\n(3) https://tldp.org/HOWTO/XML-RPC-HOWTO/index.html\n\n(4) https://xmlrpc-c.sourceforge.net/introspection.html\n\n(5) http://xmlrpc.scripting.com/spec.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ServerProxy Objects,  Next: DateTime Objects,  Up: xmlrpc client -- XML-RPC client access": {
            "content": "5.21.21.1 ServerProxy Objects\n.............................\n\nA *note ServerProxy: 883. instance has a method corresponding to each\nremote procedure call accepted by the XML-RPC server.  Calling the\nmethod performs an RPC, dispatched by both name and argument signature\n(e.g.  the same method name can be overloaded with multiple argument\nsignatures).  The RPC finishes by returning a value, which may be either\nreturned data in a conformant type or a *note Fault: 3834. or *note\nProtocolError: 3835. object indicating an error.\n",
            "subsections": []
        },
        "Servers that support the XML introspection API support some common": {
            "content": "methods grouped under the reserved 'system' attribute:\n\n-- Method: ServerProxy.system.listMethods ()\n\nThis method returns a list of strings, one for each (non-system)\nmethod supported by the XML-RPC server.\n\n-- Method: ServerProxy.system.methodSignature (name)\n\nThis method takes one parameter, the name of a method implemented\nby the XML-RPC server.  It returns an array of possible signatures\nfor this method.  A signature is an array of types.  The first of\nthese types is the return type of the method, the rest are\nparameters.\n\nBecause multiple signatures (ie.  overloading) is permitted, this\nmethod returns a list of signatures rather than a singleton.\n\nSignatures themselves are restricted to the top level parameters\nexpected by a method.  For instance if a method expects one array\nof structs as a parameter, and it returns a string, its signature\nis simply \"string, array\".  If it expects three integers and\nreturns a string, its signature is \"string, int, int, int\".\n\nIf no signature is defined for the method, a non-array value is\nreturned.  In Python this means that the type of the returned value\nwill be something other than list.\n\n-- Method: ServerProxy.system.methodHelp (name)\n\nThis method takes one parameter, the name of a method implemented\nby the XML-RPC server.  It returns a documentation string\ndescribing the use of that method.  If no such string is available,\nan empty string is returned.  The documentation string may contain\nHTML markup.\n\nChanged in version 3.5: Instances of *note ServerProxy: 883. support the\n*note context manager: 398. protocol for closing the underlying\ntransport.\n\nA working example follows.  The server code:\n\nfrom xmlrpc.server import SimpleXMLRPCServer\n\ndef iseven(n):\nreturn n % 2 == 0\n\nserver = SimpleXMLRPCServer((\"localhost\", 8000))\nprint(\"Listening on port 8000...\")\nserver.registerfunction(iseven, \"iseven\")\nserver.serveforever()\n\nThe client code for the preceding server:\n\nimport xmlrpc.client\n\nwith xmlrpc.client.ServerProxy(\"http://localhost:8000/\") as proxy:\nprint(\"3 is even: %s\" % str(proxy.iseven(3)))\nprint(\"100 is even: %s\" % str(proxy.iseven(100)))\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: DateTime Objects,  Next: Binary Objects,  Prev: ServerProxy Objects,  Up: xmlrpc client -- XML-RPC client access": {
            "content": "5.21.21.2 DateTime Objects\n..........................\n\n-- Class: xmlrpc.client.DateTime\n\nThis class may be initialized with seconds since the epoch, a time\ntuple, an ISO 8601 time/date string, or a *note datetime.datetime:\n222. instance.  It has the following methods, supported mainly for\ninternal use by the marshalling/unmarshalling code:\n\n-- Method: decode (string)\n\nAccept a string as the instance's new time value.\n\n-- Method: encode (out)\n\nWrite the XML-RPC encoding of this *note DateTime: 1238. item\nto the 'out' stream object.\n\nIt also supports certain of Python's built-in operators through\n*note rich comparison: 1180. and *note repr(): 3e8. methods.\n\nA working example follows.  The server code:\n\nimport datetime\nfrom xmlrpc.server import SimpleXMLRPCServer\nimport xmlrpc.client\n\ndef today():\ntoday = datetime.datetime.today()\nreturn xmlrpc.client.DateTime(today)\n\nserver = SimpleXMLRPCServer((\"localhost\", 8000))\nprint(\"Listening on port 8000...\")\nserver.registerfunction(today, \"today\")\nserver.serveforever()\n\nThe client code for the preceding server:\n\nimport xmlrpc.client\nimport datetime\n\nproxy = xmlrpc.client.ServerProxy(\"http://localhost:8000/\")\n\ntoday = proxy.today()\n# convert the ISO8601 string to a datetime object\nconverted = datetime.datetime.strptime(today.value, \"%Y%m%dT%H:%M:%S\")\nprint(\"Today: %s\" % converted.strftime(\"%d.%m.%Y, %H:%M\"))\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Binary Objects,  Next: Fault Objects,  Prev: DateTime Objects,  Up: xmlrpc client -- XML-RPC client access": {
            "content": "5.21.21.3 Binary Objects\n........................\n\n-- Class: xmlrpc.client.Binary\n\nThis class may be initialized from bytes data (which may include\nNULs).  The primary access to the content of a *note Binary: 3833.\nobject is provided by an attribute:\n\n-- Attribute: data\n\nThe binary data encapsulated by the *note Binary: 3833.\ninstance.  The data is provided as a *note bytes: 295. object.\n\n*note Binary: 3833. objects have the following methods, supported\nmainly for internal use by the marshalling/unmarshalling code:\n\n-- Method: decode (bytes)\n\nAccept a base64 *note bytes: 295. object and decode it as the\ninstance's new data.\n\n-- Method: encode (out)\n\nWrite the XML-RPC base 64 encoding of this binary item to the\n'out' stream object.\n\nThe encoded data will have newlines every 76 characters as per\nRFC 2045 section 6.8(1), which was the de facto standard\nbase64 specification when the XML-RPC spec was written.\n\nIt also supports certain of Python's built-in operators through\n*note eq(): 931. and *note ne(): 1372. methods.\n",
            "subsections": []
        },
        "Example usage of the binary objects.  We're going to transfer an image": {
            "content": "over XMLRPC:\n\nfrom xmlrpc.server import SimpleXMLRPCServer\nimport xmlrpc.client\n\ndef pythonlogo():\nwith open(\"pythonlogo.jpg\", \"rb\") as handle:\nreturn xmlrpc.client.Binary(handle.read())\n\nserver = SimpleXMLRPCServer((\"localhost\", 8000))\nprint(\"Listening on port 8000...\")\nserver.registerfunction(pythonlogo, 'pythonlogo')\n\nserver.serveforever()\n\nThe client gets the image and saves it to a file:\n\nimport xmlrpc.client\n\nproxy = xmlrpc.client.ServerProxy(\"http://localhost:8000/\")\nwith open(\"fetchedpythonlogo.jpg\", \"wb\") as handle:\nhandle.write(proxy.pythonlogo().data)\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc2045.html#section-6.8\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Fault Objects,  Next: ProtocolError Objects,  Prev: Binary Objects,  Up: xmlrpc client -- XML-RPC client access": {
            "content": "5.21.21.4 Fault Objects\n.......................\n\n-- Class: xmlrpc.client.Fault\n\nA *note Fault: 3834. object encapsulates the content of an XML-RPC\nfault tag.  Fault objects have the following attributes:\n\n-- Attribute: faultCode\n\nAn int indicating the fault type.\n\n-- Attribute: faultString\n\nA string containing a diagnostic message associated with the\nfault.\n\nIn the following example we're going to intentionally cause a *note\nFault: 3834. by returning a complex type object.  The server code:\n\nfrom xmlrpc.server import SimpleXMLRPCServer\n\n# A marshalling error is going to occur because we're returning a\n# complex number\ndef add(x, y):\nreturn x+y+0j\n\nserver = SimpleXMLRPCServer((\"localhost\", 8000))\nprint(\"Listening on port 8000...\")\nserver.registerfunction(add, 'add')\n\nserver.serveforever()\n\nThe client code for the preceding server:\n\nimport xmlrpc.client\n\nproxy = xmlrpc.client.ServerProxy(\"http://localhost:8000/\")\ntry:\nproxy.add(2, 5)\nexcept xmlrpc.client.Fault as err:\nprint(\"A fault occurred\")\nprint(\"Fault code: %d\" % err.faultCode)\nprint(\"Fault string: %s\" % err.faultString)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ProtocolError Objects,  Next: MultiCall Objects,  Prev: Fault Objects,  Up: xmlrpc client -- XML-RPC client access": {
            "content": "5.21.21.5 ProtocolError Objects\n...............................\n\n-- Class: xmlrpc.client.ProtocolError\n\nA *note ProtocolError: 3835. object describes a protocol error in\nthe underlying transport layer (such as a 404 'not found' error if\nthe server named by the URI does not exist).  It has the following\nattributes:\n\n-- Attribute: url\n\nThe URI or URL that triggered the error.\n\n-- Attribute: errcode\n\nThe error code.\n\n-- Attribute: errmsg\n\nThe error message or diagnostic string.\n\n-- Attribute: headers\n\nA dict containing the headers of the HTTP/HTTPS request that\ntriggered the error.\n\nIn the following example we're going to intentionally cause a *note\nProtocolError: 3835. by providing an invalid URI:\n\nimport xmlrpc.client\n\n# create a ServerProxy with a URI that doesn't respond to XMLRPC requests\nproxy = xmlrpc.client.ServerProxy(\"http://google.com/\")\n\ntry:\nproxy.somemethod()\nexcept xmlrpc.client.ProtocolError as err:\nprint(\"A protocol error occurred\")\nprint(\"URL: %s\" % err.url)\nprint(\"HTTP/HTTPS headers: %s\" % err.headers)\nprint(\"Error code: %d\" % err.errcode)\nprint(\"Error message: %s\" % err.errmsg)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: MultiCall Objects,  Next: Convenience Functions,  Prev: ProtocolError Objects,  Up: xmlrpc client -- XML-RPC client access": {
            "content": "5.21.21.6 MultiCall Objects\n...........................\n\nThe *note MultiCall: 384f. object provides a way to encapsulate multiple\ncalls to a remote server into a single request (1).\n\n-- Class: xmlrpc.client.MultiCall (server)\n\nCreate an object used to boxcar method calls.  'server' is the\neventual target of the call.  Calls can be made to the result\nobject, but they will immediately return 'None', and only store the\ncall name and parameters in the *note MultiCall: 384f. object.\nCalling the object itself causes all stored calls to be transmitted\nas a single 'system.multicall' request.  The result of this call is\na *note generator: eda.; iterating over this generator yields the\nindividual results.\n\nA usage example of this class follows.  The server code:\n\nfrom xmlrpc.server import SimpleXMLRPCServer\n\ndef add(x, y):\nreturn x + y\n\ndef subtract(x, y):\nreturn x - y\n\ndef multiply(x, y):\nreturn x * y\n\ndef divide(x, y):\nreturn x // y\n\n# A simple server with simple arithmetic functions\nserver = SimpleXMLRPCServer((\"localhost\", 8000))\nprint(\"Listening on port 8000...\")\nserver.registermulticallfunctions()\nserver.registerfunction(add, 'add')\nserver.registerfunction(subtract, 'subtract')\nserver.registerfunction(multiply, 'multiply')\nserver.registerfunction(divide, 'divide')\nserver.serveforever()\n\nThe client code for the preceding server:\n\nimport xmlrpc.client\n\nproxy = xmlrpc.client.ServerProxy(\"http://localhost:8000/\")\nmulticall = xmlrpc.client.MultiCall(proxy)\nmulticall.add(7, 3)\nmulticall.subtract(7, 3)\nmulticall.multiply(7, 3)\nmulticall.divide(7, 3)\nresult = multicall()\n\nprint(\"7+3=%d, 7-3=%d, 7*3=%d, 7//3=%d\" % tuple(result))\n\n---------- Footnotes ----------\n\n(1) This approach has been first presented in a discussion on\nxmlrpc.com\n(https://web.archive.org/web/20060624230303/http://www.xmlrpc.com/discuss/msgReader$1208?mode=topic).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Convenience Functions,  Next: Example of Client Usage,  Prev: MultiCall Objects,  Up: xmlrpc client -- XML-RPC client access": {
            "content": "5.21.21.7 Convenience Functions\n...............................\n\n-- Function: xmlrpc.client.dumps (params, methodname=None,\nmethodresponse=None, encoding=None, allownone=False)\n\nConvert 'params' into an XML-RPC request.  or into a response if\n'methodresponse' is true.  'params' can be either a tuple of\narguments or an instance of the *note Fault: 3834. exception class.\nIf 'methodresponse' is true, only a single value can be returned,\nmeaning that 'params' must be of length 1.  'encoding', if\nsupplied, is the encoding to use in the generated XML; the default\nis UTF-8.  Python's *note None: 43f. value cannot be used in\nstandard XML-RPC; to allow using it via an extension, provide a\ntrue value for 'allownone'.\n\n-- Function: xmlrpc.client.loads (data, usedatetime=False,\nusebuiltintypes=False)\n\nConvert an XML-RPC request or response into Python objects, a\n'(params, methodname)'.  'params' is a tuple of argument;\n'methodname' is a string, or 'None' if no method name is present in\nthe packet.  If the XML-RPC packet represents a fault condition,\nthis function will raise a *note Fault: 3834. exception.  The\n'usebuiltintypes' flag can be used to cause date/time values to\nbe presented as *note datetime.datetime: 222. objects and binary\ndata to be presented as *note bytes: 295. objects; this flag is\nfalse by default.\n\nThe obsolete 'usedatetime' flag is similar to 'usebuiltintypes'\nbut it applies only to date/time values.\n\nChanged in version 3.3: The 'usebuiltintypes' flag was added.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Example of Client Usage,  Next: Example of Client and Server Usage,  Prev: Convenience Functions,  Up: xmlrpc client -- XML-RPC client access": {
            "content": "5.21.21.8 Example of Client Usage\n.................................\n\n# simple test program (from the XML-RPC specification)\nfrom xmlrpc.client import ServerProxy, Error\n\n# server = ServerProxy(\"http://localhost:8000\") # local server\nwith ServerProxy(\"http://betty.userland.com\") as proxy:\n\nprint(proxy)\n\ntry:\nprint(proxy.examples.getStateName(41))\nexcept Error as v:\nprint(\"ERROR\", v)\n",
            "subsections": []
        },
        "To access an XML-RPC server through a HTTP proxy, you need to define a": {
            "content": "custom transport.  The following example shows how:\n\nimport http.client\nimport xmlrpc.client\n\nclass ProxiedTransport(xmlrpc.client.Transport):\n\ndef setproxy(self, host, port=None, headers=None):\nself.proxy = host, port\nself.proxyheaders = headers\n\ndef makeconnection(self, host):\nconnection = http.client.HTTPConnection(*self.proxy)\nconnection.settunnel(host, headers=self.proxyheaders)\nself.connection = host, connection\nreturn connection\n\ntransport = ProxiedTransport()\ntransport.setproxy('proxy-server', 8080)\nserver = xmlrpc.client.ServerProxy('http://betty.userland.com', transport=transport)\nprint(server.examples.getStateName(41))\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Example of Client and Server Usage,  Prev: Example of Client Usage,  Up: xmlrpc client -- XML-RPC client access": {
            "content": "5.21.21.9 Example of Client and Server Usage\n............................................\n\nSee *note SimpleXMLRPCServer Example: 3855.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "'Source code:' Lib/xmlrpc/server.py(1)\n\n\n\nThe *note xmlrpc.server: 129. module provides a basic server framework\nfor XML-RPC servers written in Python.  Servers can either be free\nstanding, using *note SimpleXMLRPCServer: 3858, or embedded in a CGI\nenvironment, using *note CGIXMLRPCRequestHandler: 3859.\n\nWarning: The *note xmlrpc.server: 129. module is not secure against\nmaliciously constructed data.  If you need to parse untrusted or\nunauthenticated data see *note XML vulnerabilities: 33aa.\n\n*note Availability: 1ad3.: not Emscripten, not WASI.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: SimpleXMLRPCServer Objects,  Next: CGIXMLRPCRequestHandler,  Up: xmlrpc server -- Basic XML-RPC servers": {
            "content": "5.21.22.1 SimpleXMLRPCServer Objects\n....................................\n\nThe *note SimpleXMLRPCServer: 3858. class is based on *note\nsocketserver.TCPServer: 1197. and provides a means of creating simple,\nstand alone XML-RPC servers.\n\n-- Method: SimpleXMLRPCServer.registerfunction (function=None,\nname=None)\n\nRegister a function that can respond to XML-RPC requests.  If\n'name' is given, it will be the method name associated with\n'function', otherwise *note function.name: 1149. will be used.\n'name' is a string, and may contain characters not legal in Python\nidentifiers, including the period character.\n\nThis method can also be used as a decorator.  When used as a\ndecorator, 'name' can only be given as a keyword argument to\nregister 'function' under 'name'.  If no 'name' is given, *note\nfunction.name: 1149. will be used.\n\nChanged in version 3.7: *note registerfunction(): 385c. can be\nused as a decorator.\n\n-- Method: SimpleXMLRPCServer.registerinstance (instance,\nallowdottednames=False)\n\nRegister an object which is used to expose method names which have\nnot been registered using *note registerfunction(): 385c.  If\n'instance' contains a 'dispatch()' method, it is called with the\nrequested method name and the parameters from the request.  Its API\nis 'def dispatch(self, method, params)' (note that 'params' does\nnot represent a variable argument list).  If it calls an underlying\nfunction to perform its task, that function is called as\n'func(*params)', expanding the parameter list.  The return value\nfrom 'dispatch()' is returned to the client as the result.  If\n'instance' does not have a 'dispatch()' method, it is searched for\nan attribute matching the name of the requested method.\n\nIf the optional 'allowdottednames' argument is true and the\ninstance does not have a 'dispatch()' method, then if the\nrequested method name contains periods, each component of the\nmethod name is searched for individually, with the effect that a\nsimple hierarchical search is performed.  The value found from this\nsearch is then called with the parameters from the request, and the\nreturn value is passed back to the client.\n\nWarning: Enabling the 'allowdottednames' option allows\nintruders to access your module's global variables and may\nallow intruders to execute arbitrary code on your machine.\nOnly use this option on a secure, closed network.\n\n-- Method: SimpleXMLRPCServer.registerintrospectionfunctions ()\n\nRegisters the XML-RPC introspection functions 'system.listMethods',\n'system.methodHelp' and 'system.methodSignature'.\n\n-- Method: SimpleXMLRPCServer.registermulticallfunctions ()\n\nRegisters the XML-RPC multicall function system.multicall.\n\n-- Attribute: SimpleXMLRPCRequestHandler.rpcpaths\n\nAn attribute value that must be a tuple listing valid path portions\nof the URL for receiving XML-RPC requests.  Requests posted to\nother paths will result in a 404 \"no such page\" HTTP error.  If\nthis tuple is empty, all paths will be considered valid.  The\ndefault value is '('/', '/RPC2')'.\n\n* Menu:\n\n* SimpleXMLRPCServer Example::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: SimpleXMLRPCServer Example,  Up: SimpleXMLRPCServer Objects": {
            "content": "5.21.22.2 SimpleXMLRPCServer Example\n....................................\n\nServer code:\n\nfrom xmlrpc.server import SimpleXMLRPCServer\nfrom xmlrpc.server import SimpleXMLRPCRequestHandler\n\n# Restrict to a particular path.\nclass RequestHandler(SimpleXMLRPCRequestHandler):\nrpcpaths = ('/RPC2',)\n\n# Create server\nwith SimpleXMLRPCServer(('localhost', 8000),\nrequestHandler=RequestHandler) as server:\nserver.registerintrospectionfunctions()\n\n# Register pow() function; this will use the value of\n# pow.name as the name, which is just 'pow'.\nserver.registerfunction(pow)\n\n# Register a function under a different name\ndef adderfunction(x, y):\nreturn x + y\nserver.registerfunction(adderfunction, 'add')\n\n# Register an instance; all the methods of the instance are\n# published as XML-RPC methods (in this case, just 'mul').\nclass MyFuncs:\ndef mul(self, x, y):\nreturn x * y\n\nserver.registerinstance(MyFuncs())\n\n# Run the server's main loop\nserver.serveforever()\n",
            "subsections": []
        },
        "The following client code will call the methods made available by the": {
            "content": "preceding server:\n\nimport xmlrpc.client\n\ns = xmlrpc.client.ServerProxy('http://localhost:8000')\nprint(s.pow(2,3))  # Returns 23 = 8\nprint(s.add(2,3))  # Returns 5\nprint(s.mul(5,2))  # Returns 5*2 = 10\n\n# Print list of available methods\nprint(s.system.listMethods())\n\n'registerfunction()' can also be used as a decorator.  The previous\nserver example can register functions in a decorator way:\n\nfrom xmlrpc.server import SimpleXMLRPCServer\nfrom xmlrpc.server import SimpleXMLRPCRequestHandler\n\nclass RequestHandler(SimpleXMLRPCRequestHandler):\nrpcpaths = ('/RPC2',)\n\nwith SimpleXMLRPCServer(('localhost', 8000),\nrequestHandler=RequestHandler) as server:\nserver.registerintrospectionfunctions()\n\n# Register pow() function; this will use the value of\n# pow.name as the name, which is just 'pow'.\nserver.registerfunction(pow)\n\n# Register a function under a different name, using\n# registerfunction as a decorator. *name* can only be given\n# as a keyword argument.\n@server.registerfunction(name='add')\ndef adderfunction(x, y):\nreturn x + y\n\n# Register a function under function.name.\n@server.registerfunction\ndef mul(x, y):\nreturn x * y\n\nserver.serveforever()\n",
            "subsections": []
        },
        "The following example included in the 'Lib/xmlrpc/server.py' module": {
            "content": "shows a server allowing dotted names and registering a multicall\nfunction.\n\nWarning: Enabling the 'allowdottednames' option allows intruders\nto access your module's global variables and may allow intruders to\nexecute arbitrary code on your machine.  Only use this example only\nwithin a secure, closed network.\n\nimport datetime\n\nclass ExampleService:\ndef getData(self):\nreturn '42'\n\nclass currentTime:\n@staticmethod\ndef getCurrentTime():\nreturn datetime.datetime.now()\n\nwith SimpleXMLRPCServer((\"localhost\", 8000)) as server:\nserver.registerfunction(pow)\nserver.registerfunction(lambda x,y: x+y, 'add')\nserver.registerinstance(ExampleService(), allowdottednames=True)\nserver.registermulticallfunctions()\nprint('Serving XML-RPC on localhost port 8000')\ntry:\nserver.serveforever()\nexcept KeyboardInterrupt:\nprint(\"\\nKeyboard interrupt received, exiting.\")\nsys.exit(0)\n\nThis ExampleService demo can be invoked from the command line:\n\npython -m xmlrpc.server\n",
            "subsections": []
        },
        "The client that interacts with the above server is included in": {
            "content": "'Lib/xmlrpc/client.py':\n\nserver = ServerProxy(\"http://localhost:8000\")\n\ntry:\nprint(server.currentTime.getCurrentTime())\nexcept Error as v:\nprint(\"ERROR\", v)\n\nmulti = MultiCall(server)\nmulti.getData()\nmulti.pow(2,9)\nmulti.add(1,2)\ntry:\nfor response in multi():\nprint(response)\nexcept Error as v:\nprint(\"ERROR\", v)\n",
            "subsections": []
        },
        "This client which interacts with the demo XMLRPC server can be invoked": {
            "content": "as:\n\npython -m xmlrpc.client\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: CGIXMLRPCRequestHandler,  Next: Documenting XMLRPC server,  Prev: SimpleXMLRPCServer Objects,  Up: xmlrpc server -- Basic XML-RPC servers": {
            "content": "5.21.22.3 CGIXMLRPCRequestHandler\n.................................\n\nThe *note CGIXMLRPCRequestHandler: 3859. class can be used to handle\nXML-RPC requests sent to Python CGI scripts.\n\n-- Method: CGIXMLRPCRequestHandler.registerfunction (function=None,\nname=None)\n\nRegister a function that can respond to XML-RPC requests.  If\n'name' is given, it will be the method name associated with\n'function', otherwise *note function.name: 1149. will be used.\n'name' is a string, and may contain characters not legal in Python\nidentifiers, including the period character.\n\nThis method can also be used as a decorator.  When used as a\ndecorator, 'name' can only be given as a keyword argument to\nregister 'function' under 'name'.  If no 'name' is given, *note\nfunction.name: 1149. will be used.\n\nChanged in version 3.7: *note registerfunction(): 3863. can be\nused as a decorator.\n\n-- Method: CGIXMLRPCRequestHandler.registerinstance (instance)\n\nRegister an object which is used to expose method names which have\nnot been registered using *note registerfunction(): 3863.  If\ninstance contains a 'dispatch()' method, it is called with the\nrequested method name and the parameters from the request; the\nreturn value is returned to the client as the result.  If instance\ndoes not have a 'dispatch()' method, it is searched for an\nattribute matching the name of the requested method; if the\nrequested method name contains periods, each component of the\nmethod name is searched for individually, with the effect that a\nsimple hierarchical search is performed.  The value found from this\nsearch is then called with the parameters from the request, and the\nreturn value is passed back to the client.\n\n-- Method: CGIXMLRPCRequestHandler.registerintrospectionfunctions ()\n\nRegister the XML-RPC introspection functions 'system.listMethods',\n'system.methodHelp' and 'system.methodSignature'.\n\n-- Method: CGIXMLRPCRequestHandler.registermulticallfunctions ()\n\nRegister the XML-RPC multicall function 'system.multicall'.\n\n-- Method: CGIXMLRPCRequestHandler.handlerequest (requesttext=None)\n\nHandle an XML-RPC request.  If 'requesttext' is given, it should\nbe the POST data provided by the HTTP server, otherwise the\ncontents of stdin will be used.\n\nExample:\n\nclass MyFuncs:\ndef mul(self, x, y):\nreturn x * y\n\n\nhandler = CGIXMLRPCRequestHandler()\nhandler.registerfunction(pow)\nhandler.registerfunction(lambda x,y: x+y, 'add')\nhandler.registerintrospectionfunctions()\nhandler.registerinstance(MyFuncs())\nhandler.handlerequest()\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Documenting XMLRPC server,  Next: DocXMLRPCServer Objects,  Prev: CGIXMLRPCRequestHandler,  Up: xmlrpc server -- Basic XML-RPC servers": {
            "content": "5.21.22.4 Documenting XMLRPC server\n...................................\n",
            "subsections": []
        },
        "These classes extend the above classes to serve HTML documentation in": {
            "content": "response to HTTP GET requests.  Servers can either be free standing,\nusing *note DocXMLRPCServer: 172d, or embedded in a CGI environment,\nusing *note DocCGIXMLRPCRequestHandler: 3869.\n\n-- Class: xmlrpc.server.DocXMLRPCServer (addr,\nrequestHandler=DocXMLRPCRequestHandler, logRequests=True,\nallownone=False, encoding=None, bindandactivate=True,\nusebuiltintypes=True)\n\nCreate a new server instance.  All parameters have the same meaning\nas for *note SimpleXMLRPCServer: 3858.; 'requestHandler' defaults\nto *note DocXMLRPCRequestHandler: 386a.\n\nChanged in version 3.3: The 'usebuiltintypes' flag was added.\n\n-- Class: xmlrpc.server.DocCGIXMLRPCRequestHandler\n\nCreate a new instance to handle XML-RPC requests in a CGI\nenvironment.\n\n-- Class: xmlrpc.server.DocXMLRPCRequestHandler\n\nCreate a new request handler instance.  This request handler\nsupports XML-RPC POST requests, documentation GET requests, and\nmodifies logging so that the 'logRequests' parameter to the *note\nDocXMLRPCServer: 172d. constructor parameter is honored.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: DocXMLRPCServer Objects,  Next: DocCGIXMLRPCRequestHandler,  Prev: Documenting XMLRPC server,  Up: xmlrpc server -- Basic XML-RPC servers": {
            "content": "5.21.22.5 DocXMLRPCServer Objects\n.................................\n\nThe *note DocXMLRPCServer: 172d. class is derived from *note",
            "subsections": []
        },
        "SimpleXMLRPCServer: 3858. and provides a means of creating": {
            "content": "self-documenting, stand alone XML-RPC servers.  HTTP POST requests are\nhandled as XML-RPC method calls.  HTTP GET requests are handled by\ngenerating pydoc-style HTML documentation.  This allows a server to\nprovide its own web-based documentation.\n\n-- Method: DocXMLRPCServer.setservertitle (servertitle)\n\nSet the title used in the generated HTML documentation.  This title\nwill be used inside the HTML \"title\" element.\n\n-- Method: DocXMLRPCServer.setservername (servername)\n\nSet the name used in the generated HTML documentation.  This name\nwill appear at the top of the generated documentation inside a \"h1\"\nelement.\n\n-- Method: DocXMLRPCServer.setserverdocumentation\n(serverdocumentation)\n\nSet the description used in the generated HTML documentation.  This\ndescription will appear as a paragraph, below the server name, in\nthe documentation.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: DocCGIXMLRPCRequestHandler,  Prev: DocXMLRPCServer Objects,  Up: xmlrpc server -- Basic XML-RPC servers": {
            "content": "5.21.22.6 DocCGIXMLRPCRequestHandler\n....................................\n\nThe *note DocCGIXMLRPCRequestHandler: 3869. class is derived from *note\nCGIXMLRPCRequestHandler: 3859. and provides a means of creating\nself-documenting, XML-RPC CGI scripts.  HTTP POST requests are handled\nas XML-RPC method calls.  HTTP GET requests are handled by generating\npydoc-style HTML documentation.  This allows a server to provide its own\nweb-based documentation.\n\n-- Method: DocCGIXMLRPCRequestHandler.setservertitle (servertitle)\n\nSet the title used in the generated HTML documentation.  This title\nwill be used inside the HTML \"title\" element.\n\n-- Method: DocCGIXMLRPCRequestHandler.setservername (servername)\n\nSet the name used in the generated HTML documentation.  This name\nwill appear at the top of the generated documentation inside a \"h1\"\nelement.\n\n-- Method: DocCGIXMLRPCRequestHandler.setserverdocumentation\n(serverdocumentation)\n\nSet the description used in the generated HTML documentation.  This\ndescription will appear as a paragraph, below the server name, in\nthe documentation.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ipaddress -- IPv4/IPv6 manipulation library,  Prev: xmlrpc server -- Basic XML-RPC servers,  Up: Internet Protocols and Support": {
            "content": "'Source code:' Lib/ipaddress.py(1)\n\n\n\n*note ipaddress: 7a. provides the capabilities to create, manipulate and\noperate on IPv4 and IPv6 addresses and networks.\n",
            "subsections": []
        },
        "The functions and classes in this module make it straightforward to": {
            "content": "handle various tasks related to IP addresses, including checking whether\nor not two hosts are on the same subnet, iterating over all hosts in a\nparticular subnet, checking whether or not a string represents a valid\nIP address or network definition, and so on.\n",
            "subsections": []
        },
        "This is the full module API reference--for an overview and introduction,": {
            "content": "see *note An introduction to the ipaddress module: 3876.\n\nNew in version 3.3.\n\n* Menu:\n\n* Convenience factory functions::\n* IP Addresses::\n* IP Network definitions::\n* Interface objects::\n* Other Module Level Functions::\n* Custom Exceptions::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/ipaddress.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Convenience factory functions,  Next: IP Addresses,  Up: ipaddress -- IPv4/IPv6 manipulation library": {
            "content": "5.21.23.1 Convenience factory functions\n.......................................\n\nThe *note ipaddress: 7a. module provides factory functions to\nconveniently create IP addresses, networks and interfaces:\n\n-- Function: ipaddress.ipaddress (address)\n\nReturn an *note IPv4Address: 3879. or *note IPv6Address: 729.\nobject depending on the IP address passed as argument.  Either IPv4\nor IPv6 addresses may be supplied; integers less than '232' will\nbe considered to be IPv4 by default.  A *note ValueError: 183. is\nraised if 'address' does not represent a valid IPv4 or IPv6\naddress.\n\n>>> ipaddress.ipaddress('192.168.0.1')\nIPv4Address('192.168.0.1')\n>>> ipaddress.ipaddress('2001:db8::')\nIPv6Address('2001:db8::')\n\n-- Function: ipaddress.ipnetwork (address, strict=True)\n\nReturn an *note IPv4Network: 986. or *note IPv6Network: 985. object\ndepending on the IP address passed as argument.  'address' is a\nstring or integer representing the IP network.  Either IPv4 or IPv6\nnetworks may be supplied; integers less than '232' will be\nconsidered to be IPv4 by default.  'strict' is passed to *note\nIPv4Network: 986. or *note IPv6Network: 985. constructor.  A *note\nValueError: 183. is raised if 'address' does not represent a valid\nIPv4 or IPv6 address, or if the network has host bits set.\n\n>>> ipaddress.ipnetwork('192.168.0.0/28')\nIPv4Network('192.168.0.0/28')\n\n-- Function: ipaddress.ipinterface (address)\n\nReturn an *note IPv4Interface: 156c. or *note IPv6Interface: 156d.\nobject depending on the IP address passed as argument.  'address'\nis a string or integer representing the IP address.  Either IPv4 or\nIPv6 addresses may be supplied; integers less than '232' will be\nconsidered to be IPv4 by default.  A *note ValueError: 183. is\nraised if 'address' does not represent a valid IPv4 or IPv6\naddress.\n",
            "subsections": []
        },
        "One downside of these convenience functions is that the need to handle": {
            "content": "both IPv4 and IPv6 formats means that error messages provide minimal\ninformation on the precise error, as the functions don't know whether\nthe IPv4 or IPv6 format was intended.  More detailed error reporting can\nbe obtained by calling the appropriate version specific class\nconstructors directly.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: IP Addresses,  Next: IP Network definitions,  Prev: Convenience factory functions,  Up: ipaddress -- IPv4/IPv6 manipulation library": {
            "content": "5.21.23.2 IP Addresses\n......................\n\n* Menu:\n\n* Address objects::\n* Conversion to Strings and Integers::\n* Operators: Operators<3>.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Address objects,  Next: Conversion to Strings and Integers,  Up: IP Addresses": {
            "content": "5.21.23.3 Address objects\n.........................\n\nThe *note IPv4Address: 3879. and *note IPv6Address: 729. objects share a\nlot of common attributes.  Some attributes that are only meaningful for\nIPv6 addresses are also implemented by *note IPv4Address: 3879. objects,\nin order to make it easier to write code that handles both IP versions\ncorrectly.  Address objects are *note hashable: 3db, so they can be used\nas keys in dictionaries.\n\n-- Class: ipaddress.IPv4Address (address)\n\nConstruct an IPv4 address.  An *note AddressValueError: 387e. is\nraised if 'address' is not a valid IPv4 address.\n\nThe following constitutes a valid IPv4 address:\n\n1. A string in decimal-dot notation, consisting of four decimal\nintegers in the inclusive range 0-255, separated by dots (e.g.\n'192.168.0.1').  Each integer represents an octet (byte) in\nthe address.  Leading zeroes are not tolerated to prevent\nconfusion with octal notation.\n\n2. An integer that fits into 32 bits.\n\n3. An integer packed into a *note bytes: 295. object of length 4\n(most significant octet first).\n\n>>> ipaddress.IPv4Address('192.168.0.1')\nIPv4Address('192.168.0.1')\n>>> ipaddress.IPv4Address(3232235521)\nIPv4Address('192.168.0.1')\n>>> ipaddress.IPv4Address(b'\\xC0\\xA8\\x00\\x01')\nIPv4Address('192.168.0.1')\n\nChanged in version 3.8: Leading zeros are tolerated, even in\nambiguous cases that look like octal notation.\n\nChanged in version 3.9.5: Leading zeros are no longer tolerated and\nare treated as an error.  IPv4 address strings are now parsed as\nstrict as glibc *note inetpton(): 783.\n\n-- Attribute: version\n\nThe appropriate version number: '4' for IPv4, '6' for IPv6.\n\n-- Attribute: maxprefixlen\n\nThe total number of bits in the address representation for\nthis version: '32' for IPv4, '128' for IPv6.\n\nThe prefix defines the number of leading bits in an address\nthat are compared to determine whether or not an address is\npart of a network.\n\n-- Attribute: compressed\n\n-- Attribute: exploded\n\nThe string representation in dotted decimal notation.  Leading\nzeroes are never included in the representation.\n\nAs IPv4 does not define a shorthand notation for addresses\nwith octets set to zero, these two attributes are always the\nsame as 'str(addr)' for IPv4 addresses.  Exposing these\nattributes makes it easier to write display code that can\nhandle both IPv4 and IPv6 addresses.\n\n-- Attribute: packed\n\nThe binary representation of this address - a *note bytes:\n295. object of the appropriate length (most significant octet\nfirst).  This is 4 bytes for IPv4 and 16 bytes for IPv6.\n\n-- Attribute: reversepointer\n\nThe name of the reverse DNS PTR record for the IP address,\ne.g.:\n\n>>> ipaddress.ipaddress(\"127.0.0.1\").reversepointer\n'1.0.0.127.in-addr.arpa'\n>>> ipaddress.ipaddress(\"2001:db8::1\").reversepointer\n'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'\n\nThis is the name that could be used for performing a PTR\nlookup, not the resolved hostname itself.\n\nNew in version 3.5.\n\n-- Attribute: ismulticast\n\n'True' if the address is reserved for multicast use.  See RFC\n3171(1) (for IPv4) or RFC 2373(2) (for IPv6).\n\n-- Attribute: isprivate\n\n'True' if the address is defined as not globally reachable by\niana-ipv4-special-registry(3) (for IPv4) or\niana-ipv6-special-registry(4) (for IPv6) with the following\nexceptions:\n\n* 'isprivate' is 'False' for the shared address space\n('100.64.0.0/10')\n\n* For IPv4-mapped IPv6-addresses the 'isprivate' value is\ndetermined by the semantics of the underlying IPv4\naddresses and the following condition holds (see *note\nIPv6Address.ipv4mapped: 3886.):\n\naddress.isprivate == address.ipv4mapped.isprivate\n\n'isprivate' has value opposite to *note isglobal: dcf,\nexcept for the shared address space ('100.64.0.0/10' range)\nwhere they are both 'False'.\n\nChanged in version 3.12.4: Fixed some false positives and\nfalse negatives.\n\n* '192.0.0.0/24' is considered private with the exception\nof '192.0.0.9/32' and '192.0.0.10/32' (previously: only\nthe '192.0.0.0/29' sub-range was considered private).\n\n* '64:ff9b:1::/48' is considered private.\n\n* '2002::/16' is considered private.\n\n* There are exceptions within '2001::/23' (otherwise\nconsidered private): '2001:1::1/128', '2001:1::2/128',\n'2001:3::/32', '2001:4:112::/48', '2001:20::/28',\n'2001:30::/28'.  The exceptions are not considered\nprivate.\n\n-- Attribute: isglobal\n\n'True' if the address is defined as globally reachable by\niana-ipv4-special-registry(5) (for IPv4) or\niana-ipv6-special-registry(6) (for IPv6) with the following\nexception:\n\nFor IPv4-mapped IPv6-addresses the 'isprivate' value is\ndetermined by the semantics of the underlying IPv4 addresses\nand the following condition holds (see *note\nIPv6Address.ipv4mapped: 3886.):\n\naddress.isglobal == address.ipv4mapped.isglobal\n\n'isglobal' has value opposite to *note isprivate: 14eb,\nexcept for the shared address space ('100.64.0.0/10' range)\nwhere they are both 'False'.\n\nNew in version 3.4.\n\nChanged in version 3.12.4: Fixed some false positives and\nfalse negatives, see *note isprivate: 14eb. for details.\n\n-- Attribute: isunspecified\n\n'True' if the address is unspecified.  See RFC 5735(7) (for\nIPv4) or RFC 2373(8) (for IPv6).\n\n-- Attribute: isreserved\n\n'True' if the address is otherwise IETF reserved.\n\n-- Attribute: isloopback\n\n'True' if this is a loopback address.  See RFC 3330(9) (for\nIPv4) or RFC 2373(10) (for IPv6).\n\n-- Attribute: islinklocal\n\n'True' if the address is reserved for link-local usage.  See\nRFC 3927(11).\n\n-- Method: IPv4Address.format (fmt)\n\nReturns a string representation of the IP address, controlled by an\nexplicit format string.  'fmt' can be one of the following: ''s'',\nthe default option, equivalent to *note str(): 157, ''b'' for a\nzero-padded binary string, ''X'' or ''x'' for an uppercase or\nlowercase hexadecimal representation, or ''n'', which is equivalent\nto ''b'' for IPv4 addresses and ''x'' for IPv6.  For binary and\nhexadecimal representations, the form specifier ''#'' and the\ngrouping option '''' are available.  'format' is used by\n'format', 'str.format' and f-strings.\n\n>>> format(ipaddress.IPv4Address('192.168.0.1'))\n'192.168.0.1'\n>>> '{:#b}'.format(ipaddress.IPv4Address('192.168.0.1'))\n'0b11000000101010000000000000000001'\n>>> f'{ipaddress.IPv6Address(\"2001:db8::1000\"):s}'\n'2001:db8::1000'\n>>> format(ipaddress.IPv6Address('2001:db8::1000'), 'X')\n'20010DB8000000000000000000001000'\n>>> '{:#n}'.format(ipaddress.IPv6Address('2001:db8::1000'))\n'0x20010db8000000000000000000001000'\n\nNew in version 3.9.\n\n-- Class: ipaddress.IPv6Address (address)\n\nConstruct an IPv6 address.  An *note AddressValueError: 387e. is\nraised if 'address' is not a valid IPv6 address.\n\nThe following constitutes a valid IPv6 address:\n\n1. A string consisting of eight groups of four hexadecimal\ndigits, each group representing 16 bits.  The groups are\nseparated by colons.  This describes an 'exploded' (longhand)\nnotation.  The string can also be 'compressed' (shorthand\nnotation) by various means.  See RFC 4291(12) for details.\nFor example, '\"0000:0000:0000:0000:0000:0abc:0007:0def\"' can\nbe compressed to '\"::abc:7:def\"'.\n\nOptionally, the string may also have a scope zone ID,\nexpressed with a suffix '%scopeid'.  If present, the scope ID\nmust be non-empty, and may not contain '%'.  See RFC 4007(13)\nfor details.  For example, 'fe80::1234%1' might identify\naddress 'fe80::1234' on the first link of the node.\n\n2. An integer that fits into 128 bits.\n\n3. An integer packed into a *note bytes: 295. object of length\n16, big-endian.\n\n>>> ipaddress.IPv6Address('2001:db8::1000')\nIPv6Address('2001:db8::1000')\n>>> ipaddress.IPv6Address('ff02::5678%1')\nIPv6Address('ff02::5678%1')\n\n-- Attribute: compressed\n\nThe short form of the address representation, with leading zeroes\nin groups omitted and the longest sequence of groups consisting\nentirely of zeroes collapsed to a single empty group.\n\nThis is also the value returned by 'str(addr)' for IPv6 addresses.\n\n-- Attribute: exploded\n\nThe long form of the address representation, with all leading\nzeroes and groups consisting entirely of zeroes included.\n\nFor the following attributes and methods, see the corresponding\ndocumentation of the *note IPv4Address: 3879. class:\n\n-- Attribute: packed\n\n-- Attribute: reversepointer\n\n-- Attribute: version\n\n-- Attribute: maxprefixlen\n\n-- Attribute: ismulticast\n\n-- Attribute: isprivate\n\n-- Attribute: isglobal\n\n-- Attribute: isunspecified\n\n-- Attribute: isreserved\n\n-- Attribute: isloopback\n\n-- Attribute: islinklocal\n\nNew in version 3.4: isglobal\n\n-- Attribute: issitelocal\n\n'True' if the address is reserved for site-local usage.  Note\nthat the site-local address space has been deprecated by RFC\n3879(14).  Use *note isprivate: 14eb. to test if this address\nis in the space of unique local addresses as defined by RFC\n4193(15).\n\n-- Attribute: ipv4mapped\n\nFor addresses that appear to be IPv4 mapped addresses\n(starting with '::FFFF/96'), this property will report the\nembedded IPv4 address.  For any other address, this property\nwill be 'None'.\n\n-- Attribute: scopeid\n\nFor scoped addresses as defined by RFC 4007(16), this property\nidentifies the particular zone of the address's scope that the\naddress belongs to, as a string.  When no scope zone is\nspecified, this property will be 'None'.\n\n-- Attribute: sixtofour\n\nFor addresses that appear to be 6to4 addresses (starting with\n'2002::/16') as defined by RFC 3056(17), this property will\nreport the embedded IPv4 address.  For any other address, this\nproperty will be 'None'.\n\n-- Attribute: teredo\n\nFor addresses that appear to be Teredo addresses (starting\nwith '2001::/32') as defined by RFC 4380(18), this property\nwill report the embedded '(server, client)' IP address pair.\nFor any other address, this property will be 'None'.\n\n-- Method: IPv6Address.format (fmt)\n\nRefer to the corresponding method documentation in *note\nIPv4Address: 3879.\n\nNew in version 3.9.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc3171.html\n\n(2) https://datatracker.ietf.org/doc/html/rfc2373.html\n\n(3)\nhttps://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml\n\n(4)\nhttps://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml\n\n(5)\nhttps://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml\n\n(6)\nhttps://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml\n\n(7) https://datatracker.ietf.org/doc/html/rfc5735.html\n\n(8) https://datatracker.ietf.org/doc/html/rfc2373.html\n\n(9) https://datatracker.ietf.org/doc/html/rfc3330.html\n\n(10) https://datatracker.ietf.org/doc/html/rfc2373.html\n\n(11) https://datatracker.ietf.org/doc/html/rfc3927.html\n\n(12) https://datatracker.ietf.org/doc/html/rfc4291.html\n\n(13) https://datatracker.ietf.org/doc/html/rfc4007.html\n\n(14) https://datatracker.ietf.org/doc/html/rfc3879.html\n\n(15) https://datatracker.ietf.org/doc/html/rfc4193.html\n\n(16) https://datatracker.ietf.org/doc/html/rfc4007.html\n\n(17) https://datatracker.ietf.org/doc/html/rfc3056.html\n\n(18) https://datatracker.ietf.org/doc/html/rfc4380.html\n\nFile: python3.12.info,  Node: Conversion to Strings and Integers,  Next: Operators<3>,  Prev: Address objects,  Up: IP Addresses\n\n5.21.23.4 Conversion to Strings and Integers\n............................................\n",
            "subsections": []
        },
        "To interoperate with networking interfaces such as the socket module,": {
            "content": "addresses must be converted to strings or integers.  This is handled\nusing the *note str(): 157. and *note int(): 17e. builtin functions:\n\n>>> str(ipaddress.IPv4Address('192.168.0.1'))\n'192.168.0.1'\n>>> int(ipaddress.IPv4Address('192.168.0.1'))\n3232235521\n>>> str(ipaddress.IPv6Address('::1'))\n'::1'\n>>> int(ipaddress.IPv6Address('::1'))\n1\n",
            "subsections": []
        },
        "Note that IPv6 scoped addresses are converted to integers without scope": {
            "content": "zone ID.\n\nFile: python3.12.info,  Node: Operators<3>,  Prev: Conversion to Strings and Integers,  Up: IP Addresses\n\n5.21.23.5 Operators\n...................\n",
            "subsections": []
        },
        "Address objects support some operators.  Unless stated otherwise,": {
            "content": "operators can only be applied between compatible objects (i.e.  IPv4\nwith IPv4, IPv6 with IPv6).\n\n* Menu:\n\n* Comparison operators::\n* Arithmetic operators::\n\nFile: python3.12.info,  Node: Comparison operators,  Next: Arithmetic operators,  Up: Operators<3>\n\n5.21.23.6 Comparison operators\n..............................\n",
            "subsections": []
        },
        "Address objects can be compared with the usual set of comparison": {
            "content": "operators.  Same IPv6 addresses with different scope zone IDs are not\nequal.  Some examples:\n\n>>> IPv4Address('127.0.0.2') > IPv4Address('127.0.0.1')\nTrue\n>>> IPv4Address('127.0.0.2') == IPv4Address('127.0.0.1')\nFalse\n>>> IPv4Address('127.0.0.2') != IPv4Address('127.0.0.1')\nTrue\n>>> IPv6Address('fe80::1234') == IPv6Address('fe80::1234%1')\nFalse\n>>> IPv6Address('fe80::1234%1') != IPv6Address('fe80::1234%2')\nTrue\n\nFile: python3.12.info,  Node: Arithmetic operators,  Prev: Comparison operators,  Up: Operators<3>\n\n5.21.23.7 Arithmetic operators\n..............................\n",
            "subsections": []
        },
        "Integers can be added to or subtracted from address objects.  Some": {
            "content": "examples:\n\n>>> IPv4Address('127.0.0.2') + 3\nIPv4Address('127.0.0.5')\n>>> IPv4Address('127.0.0.2') - 3\nIPv4Address('126.255.255.255')\n>>> IPv4Address('255.255.255.255') + 1\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nipaddress.AddressValueError: 4294967296 (>= 232) is not permitted as an IPv4 address\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: IP Network definitions,  Next: Interface objects,  Prev: IP Addresses,  Up: ipaddress -- IPv4/IPv6 manipulation library": {
            "content": "5.21.23.8 IP Network definitions\n................................\n\nThe *note IPv4Network: 986. and *note IPv6Network: 985. objects provide\na mechanism for defining and inspecting IP network definitions.  A\nnetwork definition consists of a 'mask' and a 'network address', and as\nsuch defines a range of IP addresses that equal the network address when\nmasked (binary AND) with the mask.  For example, a network definition\nwith the mask '255.255.255.0' and the network address '192.168.1.0'\nconsists of IP addresses in the inclusive range '192.168.1.0' to\n'192.168.1.255'.\n\n* Menu:\n\n* Prefix, net mask and host mask: Prefix net mask and host mask.\n* Network objects::\n* Operators: Operators<4>.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Prefix net mask and host mask,  Next: Network objects,  Up: IP Network definitions": {
            "content": "5.21.23.9 Prefix, net mask and host mask\n........................................\n",
            "subsections": []
        },
        "There are several equivalent ways to specify IP network masks.  A": {
            "content": "'prefix' '/<nbits>' is a notation that denotes how many high-order bits\nare set in the network mask.  A 'net mask' is an IP address with some\nnumber of high-order bits set.  Thus the prefix '/24' is equivalent to\nthe net mask '255.255.255.0' in IPv4, or 'ffff:ff00::' in IPv6.  In\naddition, a 'host mask' is the logical inverse of a 'net mask', and is\nsometimes used (for example in Cisco access control lists) to denote a\nnetwork mask.  The host mask equivalent to '/24' in IPv4 is '0.0.0.255'.\n\nFile: python3.12.info,  Node: Network objects,  Next: Operators<4>,  Prev: Prefix net mask and host mask,  Up: IP Network definitions\n\n5.21.23.10 Network objects\n..........................\n",
            "subsections": []
        },
        "All attributes implemented by address objects are implemented by network": {
            "content": "objects as well.  In addition, network objects implement additional\nattributes.  All of these are common between *note IPv4Network: 986. and\n*note IPv6Network: 985, so to avoid duplication they are only documented\nfor *note IPv4Network: 986.  Network objects are *note hashable: 3db, so\nthey can be used as keys in dictionaries.\n\n-- Class: ipaddress.IPv4Network (address, strict=True)\n\nConstruct an IPv4 network definition.  'address' can be one of the\nfollowing:\n\n1. A string consisting of an IP address and an optional mask,\nseparated by a slash ('/').  The IP address is the network\naddress, and the mask can be either a single number, which\nmeans it's a 'prefix', or a string representation of an IPv4\naddress.  If it's the latter, the mask is interpreted as a\n'net mask' if it starts with a non-zero field, or as a 'host\nmask' if it starts with a zero field, with the single\nexception of an all-zero mask which is treated as a 'net\nmask'.  If no mask is provided, it's considered to be '/32'.\n\nFor example, the following 'address' specifications are\nequivalent: '192.168.1.0/24', '192.168.1.0/255.255.255.0' and\n'192.168.1.0/0.0.0.255'.\n\n2. An integer that fits into 32 bits.  This is equivalent to a\nsingle-address network, with the network address being\n'address' and the mask being '/32'.\n\n3. An integer packed into a *note bytes: 295. object of length 4,\nbig-endian.  The interpretation is similar to an integer\n'address'.\n\n4. A two-tuple of an address description and a netmask, where the\naddress description is either a string, a 32-bits integer, a\n4-bytes packed integer, or an existing IPv4Address object; and\nthe netmask is either an integer representing the prefix\nlength (e.g.  '24') or a string representing the prefix mask\n(e.g.  '255.255.255.0').\n\nAn *note AddressValueError: 387e. is raised if 'address' is not a\nvalid IPv4 address.  A *note NetmaskValueError: 38a3. is raised if\nthe mask is not valid for an IPv4 address.\n\nIf 'strict' is 'True' and host bits are set in the supplied\naddress, then *note ValueError: 183. is raised.  Otherwise, the\nhost bits are masked out to determine the appropriate network\naddress.\n\nUnless stated otherwise, all network methods accepting other\nnetwork/address objects will raise *note TypeError: 28e. if the\nargument's IP version is incompatible to 'self'.\n\nChanged in version 3.5: Added the two-tuple form for the 'address'\nconstructor parameter.\n\n-- Attribute: version\n\n-- Attribute: maxprefixlen\n\nRefer to the corresponding attribute documentation in *note\nIPv4Address: 3879.\n\n-- Attribute: ismulticast\n\n-- Attribute: isprivate\n\n-- Attribute: isunspecified\n\n-- Attribute: isreserved\n\n-- Attribute: isloopback\n\n-- Attribute: islinklocal\n\nThese attributes are true for the network as a whole if they\nare true for both the network address and the broadcast\naddress.\n\n-- Attribute: networkaddress\n\nThe network address for the network.  The network address and\nthe prefix length together uniquely define a network.\n\n-- Attribute: broadcastaddress\n\nThe broadcast address for the network.  Packets sent to the\nbroadcast address should be received by every host on the\nnetwork.\n\n-- Attribute: hostmask\n\nThe host mask, as an *note IPv4Address: 3879. object.\n\n-- Attribute: netmask\n\nThe net mask, as an *note IPv4Address: 3879. object.\n\n-- Attribute: withprefixlen\n\n-- Attribute: compressed\n\n-- Attribute: exploded\n\nA string representation of the network, with the mask in\nprefix notation.\n\n'withprefixlen' and 'compressed' are always the same as\n'str(network)'.  'exploded' uses the exploded form the network\naddress.\n\n-- Attribute: withnetmask\n\nA string representation of the network, with the mask in net\nmask notation.\n\n-- Attribute: withhostmask\n\nA string representation of the network, with the mask in host\nmask notation.\n\n-- Attribute: numaddresses\n\nThe total number of addresses in the network.\n\n-- Attribute: prefixlen\n\nLength of the network prefix, in bits.\n\n-- Method: hosts ()\n\nReturns an iterator over the usable hosts in the network.  The\nusable hosts are all the IP addresses that belong to the\nnetwork, except the network address itself and the network\nbroadcast address.  For networks with a mask length of 31, the\nnetwork address and network broadcast address are also\nincluded in the result.  Networks with a mask of 32 will\nreturn a list containing the single host address.\n\n>>> list(ipnetwork('192.0.2.0/29').hosts())\n[IPv4Address('192.0.2.1'), IPv4Address('192.0.2.2'),\nIPv4Address('192.0.2.3'), IPv4Address('192.0.2.4'),\nIPv4Address('192.0.2.5'), IPv4Address('192.0.2.6')]\n>>> list(ipnetwork('192.0.2.0/31').hosts())\n[IPv4Address('192.0.2.0'), IPv4Address('192.0.2.1')]\n>>> list(ipnetwork('192.0.2.1/32').hosts())\n[IPv4Address('192.0.2.1')]\n\n-- Method: overlaps (other)\n\n'True' if this network is partly or wholly contained in\n'other' or 'other' is wholly contained in this network.\n\n-- Method: addressexclude (network)\n\nComputes the network definitions resulting from removing the\ngiven 'network' from this one.  Returns an iterator of network\nobjects.  Raises *note ValueError: 183. if 'network' is not\ncompletely contained in this network.\n\n>>> n1 = ipnetwork('192.0.2.0/28')\n>>> n2 = ipnetwork('192.0.2.1/32')\n>>> list(n1.addressexclude(n2))\n[IPv4Network('192.0.2.8/29'), IPv4Network('192.0.2.4/30'),\nIPv4Network('192.0.2.2/31'), IPv4Network('192.0.2.0/32')]\n\n-- Method: subnets (prefixlendiff=1, newprefix=None)\n\nThe subnets that join to make the current network definition,\ndepending on the argument values.  'prefixlendiff' is the\namount our prefix length should be increased by.  'newprefix'\nis the desired new prefix of the subnets; it must be larger\nthan our prefix.  One and only one of 'prefixlendiff' and\n'newprefix' must be set.  Returns an iterator of network\nobjects.\n\n>>> list(ipnetwork('192.0.2.0/24').subnets())\n[IPv4Network('192.0.2.0/25'), IPv4Network('192.0.2.128/25')]\n>>> list(ipnetwork('192.0.2.0/24').subnets(prefixlendiff=2))\n[IPv4Network('192.0.2.0/26'), IPv4Network('192.0.2.64/26'),\nIPv4Network('192.0.2.128/26'), IPv4Network('192.0.2.192/26')]\n>>> list(ipnetwork('192.0.2.0/24').subnets(newprefix=26))\n[IPv4Network('192.0.2.0/26'), IPv4Network('192.0.2.64/26'),\nIPv4Network('192.0.2.128/26'), IPv4Network('192.0.2.192/26')]\n>>> list(ipnetwork('192.0.2.0/24').subnets(newprefix=23))\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nraise ValueError('new prefix must be longer')\nValueError: new prefix must be longer\n>>> list(ipnetwork('192.0.2.0/24').subnets(newprefix=25))\n[IPv4Network('192.0.2.0/25'), IPv4Network('192.0.2.128/25')]\n\n-- Method: supernet (prefixlendiff=1, newprefix=None)\n\nThe supernet containing this network definition, depending on\nthe argument values.  'prefixlendiff' is the amount our\nprefix length should be decreased by.  'newprefix' is the\ndesired new prefix of the supernet; it must be smaller than\nour prefix.  One and only one of 'prefixlendiff' and\n'newprefix' must be set.  Returns a single network object.\n\n>>> ipnetwork('192.0.2.0/24').supernet()\nIPv4Network('192.0.2.0/23')\n>>> ipnetwork('192.0.2.0/24').supernet(prefixlendiff=2)\nIPv4Network('192.0.0.0/22')\n>>> ipnetwork('192.0.2.0/24').supernet(newprefix=20)\nIPv4Network('192.0.0.0/20')\n\n-- Method: subnetof (other)\n\nReturn 'True' if this network is a subnet of 'other'.\n\n>>> a = ipnetwork('192.168.1.0/24')\n>>> b = ipnetwork('192.168.1.128/30')\n>>> b.subnetof(a)\nTrue\n\nNew in version 3.7.\n\n-- Method: supernetof (other)\n\nReturn 'True' if this network is a supernet of 'other'.\n\n>>> a = ipnetwork('192.168.1.0/24')\n>>> b = ipnetwork('192.168.1.128/30')\n>>> a.supernetof(b)\nTrue\n\nNew in version 3.7.\n\n-- Method: comparenetworks (other)\n\nCompare this network to 'other'.  In this comparison only the\nnetwork addresses are considered; host bits aren't.  Returns\neither '-1', '0' or '1'.\n\n>>> ipnetwork('192.0.2.1/32').comparenetworks(ipnetwork('192.0.2.2/32'))\n-1\n>>> ipnetwork('192.0.2.1/32').comparenetworks(ipnetwork('192.0.2.0/32'))\n1\n>>> ipnetwork('192.0.2.1/32').comparenetworks(ipnetwork('192.0.2.1/32'))\n0\n\nDeprecated since version 3.7: It uses the same ordering and\ncomparison algorithm as \"<\", \"==\", and \">\"\n\n-- Class: ipaddress.IPv6Network (address, strict=True)\n\nConstruct an IPv6 network definition.  'address' can be one of the\nfollowing:\n\n1. A string consisting of an IP address and an optional prefix\nlength, separated by a slash ('/').  The IP address is the\nnetwork address, and the prefix length must be a single\nnumber, the 'prefix'.  If no prefix length is provided, it's\nconsidered to be '/128'.\n\nNote that currently expanded netmasks are not supported.  That\nmeans '2001:db00::0/24' is a valid argument while\n'2001:db00::0/ffff:ff00::' is not.\n\n2. An integer that fits into 128 bits.  This is equivalent to a\nsingle-address network, with the network address being\n'address' and the mask being '/128'.\n\n3. An integer packed into a *note bytes: 295. object of length\n16, big-endian.  The interpretation is similar to an integer\n'address'.\n\n4. A two-tuple of an address description and a netmask, where the\naddress description is either a string, a 128-bits integer, a\n16-bytes packed integer, or an existing IPv6Address object;\nand the netmask is an integer representing the prefix length.\n\nAn *note AddressValueError: 387e. is raised if 'address' is not a\nvalid IPv6 address.  A *note NetmaskValueError: 38a3. is raised if\nthe mask is not valid for an IPv6 address.\n\nIf 'strict' is 'True' and host bits are set in the supplied\naddress, then *note ValueError: 183. is raised.  Otherwise, the\nhost bits are masked out to determine the appropriate network\naddress.\n\nChanged in version 3.5: Added the two-tuple form for the 'address'\nconstructor parameter.\n\n-- Attribute: version\n\n-- Attribute: maxprefixlen\n\n-- Attribute: ismulticast\n\n-- Attribute: isprivate\n\n-- Attribute: isunspecified\n\n-- Attribute: isreserved\n\n-- Attribute: isloopback\n\n-- Attribute: islinklocal\n\n-- Attribute: networkaddress\n\n-- Attribute: broadcastaddress\n\n-- Attribute: hostmask\n\n-- Attribute: netmask\n\n-- Attribute: withprefixlen\n\n-- Attribute: compressed\n\n-- Attribute: exploded\n\n-- Attribute: withnetmask\n\n-- Attribute: withhostmask\n\n-- Attribute: numaddresses\n\n-- Attribute: prefixlen\n\n-- Method: hosts ()\n\nReturns an iterator over the usable hosts in the network.  The\nusable hosts are all the IP addresses that belong to the\nnetwork, except the Subnet-Router anycast address.  For\nnetworks with a mask length of 127, the Subnet-Router anycast\naddress is also included in the result.  Networks with a mask\nof 128 will return a list containing the single host address.\n\n-- Method: overlaps (other)\n\n-- Method: addressexclude (network)\n\n-- Method: subnets (prefixlendiff=1, newprefix=None)\n\n-- Method: supernet (prefixlendiff=1, newprefix=None)\n\n-- Method: subnetof (other)\n\n-- Method: supernetof (other)\n\n-- Method: comparenetworks (other)\n\nRefer to the corresponding attribute documentation in *note\nIPv4Network: 986.\n\n-- Attribute: issitelocal\n\nThese attribute is true for the network as a whole if it is\ntrue for both the network address and the broadcast address.\n\nFile: python3.12.info,  Node: Operators<4>,  Prev: Network objects,  Up: IP Network definitions\n\n5.21.23.11 Operators\n....................\n",
            "subsections": []
        },
        "Network objects support some operators.  Unless stated otherwise,": {
            "content": "operators can only be applied between compatible objects (i.e.  IPv4\nwith IPv4, IPv6 with IPv6).\n\n* Menu:\n\n* Logical operators::\n* Iteration::\n* Networks as containers of addresses::\n\nFile: python3.12.info,  Node: Logical operators,  Next: Iteration,  Up: Operators<4>\n\n5.21.23.12 Logical operators\n............................\n\nNetwork objects can be compared with the usual set of logical operators.\nNetwork objects are ordered first by network address, then by net mask.\n\nFile: python3.12.info,  Node: Iteration,  Next: Networks as containers of addresses,  Prev: Logical operators,  Up: Operators<4>\n\n5.21.23.13 Iteration\n....................\n",
            "subsections": []
        },
        "Network objects can be iterated to list all the addresses belonging to": {
            "content": "the network.  For iteration, 'all' hosts are returned, including\nunusable hosts (for usable hosts, use the *note hosts(): 38b7. method).\nAn example:\n\n>>> for addr in IPv4Network('192.0.2.0/28'):\n...     addr\n...\nIPv4Address('192.0.2.0')\nIPv4Address('192.0.2.1')\nIPv4Address('192.0.2.2')\nIPv4Address('192.0.2.3')\nIPv4Address('192.0.2.4')\nIPv4Address('192.0.2.5')\nIPv4Address('192.0.2.6')\nIPv4Address('192.0.2.7')\nIPv4Address('192.0.2.8')\nIPv4Address('192.0.2.9')\nIPv4Address('192.0.2.10')\nIPv4Address('192.0.2.11')\nIPv4Address('192.0.2.12')\nIPv4Address('192.0.2.13')\nIPv4Address('192.0.2.14')\nIPv4Address('192.0.2.15')\n\nFile: python3.12.info,  Node: Networks as containers of addresses,  Prev: Iteration,  Up: Operators<4>\n\n5.21.23.14 Networks as containers of addresses\n..............................................\n\nNetwork objects can act as containers of addresses.  Some examples:\n\n>>> IPv4Network('192.0.2.0/28')[0]\nIPv4Address('192.0.2.0')\n>>> IPv4Network('192.0.2.0/28')[15]\nIPv4Address('192.0.2.15')\n>>> IPv4Address('192.0.2.6') in IPv4Network('192.0.2.0/28')\nTrue\n>>> IPv4Address('192.0.3.6') in IPv4Network('192.0.2.0/28')\nFalse\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Interface objects,  Next: Other Module Level Functions,  Prev: IP Network definitions,  Up: ipaddress -- IPv4/IPv6 manipulation library": {
            "content": "5.21.23.15 Interface objects\n............................\n\nInterface objects are *note hashable: 3db, so they can be used as keys\nin dictionaries.\n\n-- Class: ipaddress.IPv4Interface (address)\n\nConstruct an IPv4 interface.  The meaning of 'address' is as in the\nconstructor of *note IPv4Network: 986, except that arbitrary host\naddresses are always accepted.\n\n*note IPv4Interface: 156c. is a subclass of *note IPv4Address:\n3879, so it inherits all the attributes from that class.  In\naddition, the following attributes are available:\n\n-- Attribute: ip\n\nThe address (*note IPv4Address: 3879.) without network\ninformation.\n\n>>> interface = IPv4Interface('192.0.2.5/24')\n>>> interface.ip\nIPv4Address('192.0.2.5')\n\n-- Attribute: network\n\nThe network (*note IPv4Network: 986.) this interface belongs\nto.\n\n>>> interface = IPv4Interface('192.0.2.5/24')\n>>> interface.network\nIPv4Network('192.0.2.0/24')\n\n-- Attribute: withprefixlen\n\nA string representation of the interface with the mask in\nprefix notation.\n\n>>> interface = IPv4Interface('192.0.2.5/24')\n>>> interface.withprefixlen\n'192.0.2.5/24'\n\n-- Attribute: withnetmask\n\nA string representation of the interface with the network as a\nnet mask.\n\n>>> interface = IPv4Interface('192.0.2.5/24')\n>>> interface.withnetmask\n'192.0.2.5/255.255.255.0'\n\n-- Attribute: withhostmask\n\nA string representation of the interface with the network as a\nhost mask.\n\n>>> interface = IPv4Interface('192.0.2.5/24')\n>>> interface.withhostmask\n'192.0.2.5/0.0.0.255'\n\n-- Class: ipaddress.IPv6Interface (address)\n\nConstruct an IPv6 interface.  The meaning of 'address' is as in the\nconstructor of *note IPv6Network: 985, except that arbitrary host\naddresses are always accepted.\n\n*note IPv6Interface: 156d. is a subclass of *note IPv6Address: 729,\nso it inherits all the attributes from that class.  In addition,\nthe following attributes are available:\n\n-- Attribute: ip\n\n-- Attribute: network\n\n-- Attribute: withprefixlen\n\n-- Attribute: withnetmask\n\n-- Attribute: withhostmask\n\nRefer to the corresponding attribute documentation in *note\nIPv4Interface: 156c.\n\n* Menu:\n\n* Operators: Operators<5>.\n\nFile: python3.12.info,  Node: Operators<5>,  Up: Interface objects\n\n5.21.23.16 Operators\n....................\n",
            "subsections": []
        },
        "Interface objects support some operators.  Unless stated otherwise,": {
            "content": "operators can only be applied between compatible objects (i.e.  IPv4\nwith IPv4, IPv6 with IPv6).\n\n* Menu:\n\n* Logical operators: Logical operators<2>.\n\nFile: python3.12.info,  Node: Logical operators<2>,  Up: Operators<5>\n\n5.21.23.17 Logical operators\n............................\n",
            "subsections": []
        },
        "Interface objects can be compared with the usual set of logical": {
            "content": "operators.\n\nFor equality comparison ('==' and '!='), both the IP address and network\nmust be the same for the objects to be equal.  An interface will not\ncompare equal to any address or network object.\n\nFor ordering ('<', '>', etc) the rules are different.  Interface and\naddress objects with the same IP version can be compared, and the\naddress objects will always sort before the interface objects.  Two\ninterface objects are first compared by their networks and, if those are\nthe same, then by their IP addresses.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Other Module Level Functions,  Next: Custom Exceptions,  Prev: Interface objects,  Up: ipaddress -- IPv4/IPv6 manipulation library": {
            "content": "5.21.23.18 Other Module Level Functions\n.......................................\n\nThe module also provides the following module level functions:\n\n-- Function: ipaddress.v4inttopacked (address)\n\nRepresent an address as 4 packed bytes in network (big-endian)\norder.  'address' is an integer representation of an IPv4 IP\naddress.  A *note ValueError: 183. is raised if the integer is\nnegative or too large to be an IPv4 IP address.\n\n>>> ipaddress.ipaddress(3221225985)\nIPv4Address('192.0.2.1')\n>>> ipaddress.v4inttopacked(3221225985)\nb'\\xc0\\x00\\x02\\x01'\n\n-- Function: ipaddress.v6inttopacked (address)\n\nRepresent an address as 16 packed bytes in network (big-endian)\norder.  'address' is an integer representation of an IPv6 IP\naddress.  A *note ValueError: 183. is raised if the integer is\nnegative or too large to be an IPv6 IP address.\n\n-- Function: ipaddress.summarizeaddressrange (first, last)\n\nReturn an iterator of the summarized network range given the first\nand last IP addresses.  'first' is the first *note IPv4Address:\n3879. or *note IPv6Address: 729. in the range and 'last' is the\nlast *note IPv4Address: 3879. or *note IPv6Address: 729. in the\nrange.  A *note TypeError: 28e. is raised if 'first' or 'last' are\nnot IP addresses or are not of the same version.  A *note\nValueError: 183. is raised if 'last' is not greater than 'first' or\nif 'first' address version is not 4 or 6.\n\n>>> [ipaddr for ipaddr in ipaddress.summarizeaddressrange(\n...    ipaddress.IPv4Address('192.0.2.0'),\n...    ipaddress.IPv4Address('192.0.2.130'))]\n[IPv4Network('192.0.2.0/25'), IPv4Network('192.0.2.128/31'), IPv4Network('192.0.2.130/32')]\n\n-- Function: ipaddress.collapseaddresses (addresses)\n\nReturn an iterator of the collapsed *note IPv4Network: 986. or\n*note IPv6Network: 985. objects.  'addresses' is an iterator of\n*note IPv4Network: 986. or *note IPv6Network: 985. objects.  A\n*note TypeError: 28e. is raised if 'addresses' contains mixed\nversion objects.\n\n>>> [ipaddr for ipaddr in\n... ipaddress.collapseaddresses([ipaddress.IPv4Network('192.0.2.0/25'),\n... ipaddress.IPv4Network('192.0.2.128/25')])]\n[IPv4Network('192.0.2.0/24')]\n\n-- Function: ipaddress.getmixedtypekey (obj)\n\nReturn a key suitable for sorting between networks and addresses.\nAddress and Network objects are not sortable by default; they're\nfundamentally different, so the expression:\n\nIPv4Address('192.0.2.0') <= IPv4Network('192.0.2.0/24')\n\ndoesn't make sense.  There are some times however, where you may\nwish to have *note ipaddress: 7a. sort these anyway.  If you need\nto do this, you can use this function as the 'key' argument to\n*note sorted(): a12.\n\n'obj' is either a network or address object.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Custom Exceptions,  Prev: Other Module Level Functions,  Up: ipaddress -- IPv4/IPv6 manipulation library": {
            "content": "5.21.23.19 Custom Exceptions\n............................\n",
            "subsections": []
        },
        "To support more specific error reporting from class constructors, the": {
            "content": "module defines the following exceptions:\n\n-- Exception: ipaddress.AddressValueError (ValueError)\n\nAny value error related to the address.\n\n-- Exception: ipaddress.NetmaskValueError (ValueError)\n\nAny value error related to the net mask.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Multimedia Services,  Next: Internationalization,  Prev: Internet Protocols and Support,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.22 Multimedia Services",
                    "content": ""
                }
            ]
        },
        "The modules described in this chapter implement various algorithms or": {
            "content": "interfaces that are mainly useful for multimedia applications.  They are\navailable at the discretion of the installation.  Here's an overview:\n\n* Menu:\n\n* wave -- Read and write WAV files::\n* colorsys -- Conversions between color systems::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: wave -- Read and write WAV files,  Next: colorsys -- Conversions between color systems,  Up: Multimedia Services": {
            "content": "'Source code:' Lib/wave.py(1)\n\n\n\nThe *note wave: 10e. module provides a convenient interface to the\nWaveform Audio \"WAVE\" (or \"WAV\") file format.  Only uncompressed PCM\nencoded wave files are supported.\n",
            "subsections": []
        },
        "Changed in version 3.12: Support for 'WAVEFORMATEXTENSIBLE' headers": {
            "content": "was added, provided that the extended format is\n'KSDATAFORMATSUBTYPEPCM'.\n\nThe *note wave: 10e. module defines the following function and\nexception:\n\n-- Function: wave.open (file, mode=None)\n\nIf 'file' is a string, open the file by that name, otherwise treat\nit as a file-like object.  'mode' can be:\n\n''rb''\n\nRead only mode.\n\n''wb''\n\nWrite only mode.\n\nNote that it does not allow read/write WAV files.\n\nA 'mode' of ''rb'' returns a *note Waveread: 38f4. object, while a\n'mode' of ''wb'' returns a *note Wavewrite: 38f5. object.  If\n'mode' is omitted and a file-like object is passed as 'file',\n'file.mode' is used as the default value for 'mode'.\n\nIf you pass in a file-like object, the wave object will not close\nit when its 'close()' method is called; it is the caller's\nresponsibility to close the file object.\n\nThe *note open(): 76b. function may be used in a *note with: 396.\nstatement.  When the 'with' block completes, the *note\nWaveread.close(): 38f6. or *note Wavewrite.close(): 38f7. method\nis called.\n\nChanged in version 3.4: Added support for unseekable files.\n\n-- Exception: wave.Error\n\nAn error raised when something is impossible because it violates\nthe WAV specification or hits an implementation deficiency.\n\n* Menu:\n\n* Waveread Objects::\n* Wavewrite Objects::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/wave.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Waveread Objects,  Next: Wavewrite Objects,  Up: wave -- Read and write WAV files": {
            "content": "5.22.1.1 Waveread Objects\n..........................\n\n-- Class: wave.Waveread\n\nRead a WAV file.\n\nWaveread objects, as returned by *note open(): 76b, have the\nfollowing methods:\n\n-- Method: close ()\n\nClose the stream if it was opened by *note wave: 10e, and make\nthe instance unusable.  This is called automatically on object\ncollection.\n\n-- Method: getnchannels ()\n\nReturns number of audio channels ('1' for mono, '2' for\nstereo).\n\n-- Method: getsampwidth ()\n\nReturns sample width in bytes.\n\n-- Method: getframerate ()\n\nReturns sampling frequency.\n\n-- Method: getnframes ()\n\nReturns number of audio frames.\n\n-- Method: getcomptype ()\n\nReturns compression type (''NONE'' is the only supported\ntype).\n\n-- Method: getcompname ()\n\nHuman-readable version of *note getcomptype(): 38ff.  Usually\n''not compressed'' parallels ''NONE''.\n\n-- Method: getparams ()\n\nReturns a *note namedtuple(): 711. '(nchannels, sampwidth,\nframerate, nframes, comptype, compname)', equivalent to output\nof the 'get*()' methods.\n\n-- Method: readframes (n)\n\nReads and returns at most 'n' frames of audio, as a *note\nbytes: 295. object.\n\n-- Method: rewind ()\n\nRewind the file pointer to the beginning of the audio stream.\n\nThe following two methods are defined for compatibility with the\n*note aifc: 5. module, and don't do anything interesting.\n\n-- Method: getmarkers ()\n\nReturns 'None'.\n\n-- Method: getmark (id)\n\nRaise an error.\n\nThe following two methods define a term \"position\" which is\ncompatible between them, and is otherwise implementation dependent.\n\n-- Method: setpos (pos)\n\nSet the file pointer to the specified position.\n\n-- Method: tell ()\n\nReturn current file pointer position.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Wavewrite Objects,  Prev: Waveread Objects,  Up: wave -- Read and write WAV files": {
            "content": "5.22.1.2 Wavewrite Objects\n...........................\n\n-- Class: wave.Wavewrite\n\nWrite a WAV file.\n\nWavewrite objects, as returned by *note open(): 76b.\n\nFor seekable output streams, the 'wave' header will automatically\nbe updated to reflect the number of frames actually written.  For\nunseekable streams, the 'nframes' value must be accurate when the\nfirst frame data is written.  An accurate 'nframes' value can be\nachieved either by calling *note setnframes(): 3909. or *note\nsetparams(): 390a. with the number of frames that will be written\nbefore *note close(): 38f7. is called and then using *note\nwriteframesraw(): e5f. to write the frame data, or by calling *note\nwriteframes(): e60. with all of the frame data to be written.  In\nthe latter case *note writeframes(): e60. will calculate the number\nof frames in the data and set 'nframes' accordingly before writing\nthe frame data.\n\nChanged in version 3.4: Added support for unseekable files.\n\nWavewrite objects have the following methods:\n\n-- Method: close ()\n\nMake sure 'nframes' is correct, and close the file if it was\nopened by *note wave: 10e.  This method is called upon object\ncollection.  It will raise an exception if the output stream\nis not seekable and 'nframes' does not match the number of\nframes actually written.\n\n-- Method: setnchannels (n)\n\nSet the number of channels.\n\n-- Method: setsampwidth (n)\n\nSet the sample width to 'n' bytes.\n\n-- Method: setframerate (n)\n\nSet the frame rate to 'n'.\n\nChanged in version 3.2: A non-integral input to this method is\nrounded to the nearest integer.\n\n-- Method: setnframes (n)\n\nSet the number of frames to 'n'.  This will be changed later\nif the number of frames actually written is different (this\nupdate attempt will raise an error if the output stream is not\nseekable).\n\n-- Method: setcomptype (type, name)\n\nSet the compression type and description.  At the moment, only\ncompression type 'NONE' is supported, meaning no compression.\n\n-- Method: setparams (tuple)\n\nThe 'tuple' should be '(nchannels, sampwidth, framerate,\nnframes, comptype, compname)', with values valid for the\n'set*()' methods.  Sets all parameters.\n\n-- Method: tell ()\n\nReturn current position in the file, with the same disclaimer\nfor the *note Waveread.tell(): 3907. and *note\nWaveread.setpos(): 3906. methods.\n\n-- Method: writeframesraw (data)\n\nWrite audio frames, without correcting 'nframes'.\n\nChanged in version 3.4: Any *note bytes-like object: b82. is\nnow accepted.\n\n-- Method: writeframes (data)\n\nWrite audio frames and make sure 'nframes' is correct.  It\nwill raise an error if the output stream is not seekable and\nthe total number of frames that have been written after 'data'\nhas been written does not match the previously set value for\n'nframes'.\n\nChanged in version 3.4: Any *note bytes-like object: b82. is\nnow accepted.\n\nNote that it is invalid to set any parameters after calling\n*note writeframes(): e60. or *note writeframesraw(): e5f, and\nany attempt to do so will raise *note wave.Error: 38f8.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: colorsys -- Conversions between color systems,  Prev: wave -- Read and write WAV files,  Up: Multimedia Services": {
            "content": "'Source code:' Lib/colorsys.py(1)\n\n\n\nThe *note colorsys: 1d. module defines bidirectional conversions of\ncolor values between colors expressed in the RGB (Red Green Blue) color\nspace used in computer monitors and three other coordinate systems: YIQ,\nHLS (Hue Lightness Saturation) and HSV (Hue Saturation Value).",
            "subsections": []
        },
        "Coordinates in all of these color spaces are floating point values.  In": {
            "content": "the YIQ space, the Y coordinate is between 0 and 1, but the I and Q\ncoordinates can be positive or negative.  In all other spaces, the\ncoordinates are all between 0 and 1.\n\nSee also\n........\n",
            "subsections": []
        },
        "More information about color spaces can be found at": {
            "content": "'https://poynton.ca/ColorFAQ.html' and\n'https://www.cambridgeincolour.com/tutorials/color-spaces.htm'.\n\nThe *note colorsys: 1d. module defines the following functions:\n\n-- Function: colorsys.rgbtoyiq (r, g, b)\n\nConvert the color from RGB coordinates to YIQ coordinates.\n\n-- Function: colorsys.yiqtorgb (y, i, q)\n\nConvert the color from YIQ coordinates to RGB coordinates.\n\n-- Function: colorsys.rgbtohls (r, g, b)\n\nConvert the color from RGB coordinates to HLS coordinates.\n\n-- Function: colorsys.hlstorgb (h, l, s)\n\nConvert the color from HLS coordinates to RGB coordinates.\n\n-- Function: colorsys.rgbtohsv (r, g, b)\n\nConvert the color from RGB coordinates to HSV coordinates.\n\n-- Function: colorsys.hsvtorgb (h, s, v)\n\nConvert the color from HSV coordinates to RGB coordinates.\n\nExample:\n\n>>> import colorsys\n>>> colorsys.rgbtohsv(0.2, 0.4, 0.4)\n(0.5, 0.5, 0.4)\n>>> colorsys.hsvtorgb(0.5, 0.5, 0.4)\n(0.2, 0.4, 0.4)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/colorsys.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Internationalization,  Next: Program Frameworks,  Prev: Multimedia Services,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.23 Internationalization",
                    "content": ""
                }
            ]
        },
        "The modules described in this chapter help you write software that is": {
            "content": "independent of language and locale by providing mechanisms for selecting\na language to be used in program messages or by tailoring output to\nmatch local conventions.\n\nThe list of modules described in this chapter is:\n\n* Menu:\n\n* gettext -- Multilingual internationalization services::\n* locale -- Internationalization services::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: gettext -- Multilingual internationalization services,  Next: locale -- Internationalization services,  Up: Internationalization": {
            "content": "'Source code:' Lib/gettext.py(1)\n\n\n\nThe *note gettext: 5e. module provides internationalization (I18N) and\nlocalization (L10N) services for your Python modules and applications.",
            "subsections": []
        },
        "It supports both the GNU 'gettext' message catalog API and a higher": {
            "content": "level, class-based API that may be more appropriate for Python files.",
            "subsections": []
        },
        "The interface described below allows you to write your module and": {
            "content": "application messages in one natural language, and provide a catalog of\ntranslated messages for running under different natural languages.\n",
            "subsections": []
        },
        "Some hints on localizing your Python modules and applications are also": {
            "content": "given.\n\n* Menu:\n\n* GNU gettext API::\n* Class-based API::\n* Internationalizing your programs and modules::\n* Acknowledgements: Acknowledgements<9>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/gettext.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: GNU gettext API,  Next: Class-based API,  Up: gettext -- Multilingual internationalization services": {
            "content": "5.23.1.1 GNU 'gettext' API\n..........................\n\nThe *note gettext: 5e. module defines the following API, which is very\nsimilar to the GNU 'gettext' API. If you use this API you will affect\nthe translation of your entire application globally.  Often this is what\nyou want if your application is monolingual, with the choice of language\ndependent on the locale of your user.  If you are localizing a Python\nmodule, or if your application needs to switch languages on the fly, you\nprobably want to use the class-based API instead.\n\n-- Function: gettext.bindtextdomain (domain, localedir=None)\n\nBind the 'domain' to the locale directory 'localedir'.  More\nconcretely, *note gettext: 5e. will look for binary '.mo' files for\nthe given domain using the path (on Unix):\n'`localedir'/`language'/LCMESSAGES/`domain'.mo', where 'language'\nis searched for in the environment variables 'LANGUAGE', 'LCALL',\n'LCMESSAGES', and 'LANG' respectively.\n\nIf 'localedir' is omitted or 'None', then the current binding for\n'domain' is returned.  (1)\n\n-- Function: gettext.textdomain (domain=None)\n\nChange or query the current global domain.  If 'domain' is 'None',\nthen the current global domain is returned, otherwise the global\ndomain is set to 'domain', which is returned.\n\n-- Function: gettext.gettext (message)\n\nReturn the localized translation of 'message', based on the current\nglobal domain, language, and locale directory.  This function is\nusually aliased as '()' in the local namespace (see examples\nbelow).\n\n-- Function: gettext.dgettext (domain, message)\n\nLike *note gettext(): 12be, but look the message up in the\nspecified 'domain'.\n\n-- Function: gettext.ngettext (singular, plural, n)\n\nLike *note gettext(): 12be, but consider plural forms.  If a\ntranslation is found, apply the plural formula to 'n', and return\nthe resulting message (some languages have more than two plural\nforms).  If no translation is found, return 'singular' if 'n' is 1;\nreturn 'plural' otherwise.\n\nThe Plural formula is taken from the catalog header.  It is a C or\nPython expression that has a free variable 'n'; the expression\nevaluates to the index of the plural in the catalog.  See the GNU\ngettext documentation(2) for the precise syntax to be used in '.po'\nfiles and the formulas for a variety of languages.\n\n-- Function: gettext.dngettext (domain, singular, plural, n)\n\nLike *note ngettext(): 3921, but look the message up in the\nspecified 'domain'.\n\n-- Function: gettext.pgettext (context, message)\n\n-- Function: gettext.dpgettext (domain, context, message)\n\n-- Function: gettext.npgettext (context, singular, plural, n)\n\n-- Function: gettext.dnpgettext (domain, context, singular, plural, n)\n\nSimilar to the corresponding functions without the 'p' in the\nprefix (that is, *note gettext(): 5e, *note dgettext(): 3920, *note\nngettext(): 3921, *note dngettext(): 3922.), but the translation is\nrestricted to the given message 'context'.\n\nNew in version 3.8.\n",
            "subsections": []
        },
        "Note that GNU 'gettext' also defines a 'dcgettext()' method, but this": {
            "content": "was deemed not useful and so it is currently unimplemented.\n\nHere's an example of typical usage for this API:\n\nimport gettext\ngettext.bindtextdomain('myapplication', '/path/to/my/language/directory')\ngettext.textdomain('myapplication')\n= gettext.gettext\n# ...\nprint(('This is a translatable string.'))\n\n---------- Footnotes ----------\n\n(1) The default locale directory is system dependent; for example, on",
            "subsections": []
        },
        "Red Hat Linux it is '/usr/share/locale', but on Solaris it is": {
            "content": "'/usr/lib/locale'.  The 'gettext' module does not try to support these\nsystem dependent defaults; instead its default is\n'`sys.baseprefix'/share/locale' (see *note sys.baseprefix: 391e.).\nFor this reason, it is always best to call *note bindtextdomain(): 391d.\nwith an explicit absolute path at the start of your application.\n\n(2) https://www.gnu.org/software/gettext/manual/gettext.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Class-based API,  Next: Internationalizing your programs and modules,  Prev: GNU gettext API,  Up: gettext -- Multilingual internationalization services": {
            "content": "5.23.1.2 Class-based API\n........................\n\nThe class-based API of the *note gettext: 5e. module gives you more\nflexibility and greater convenience than the GNU 'gettext' API. It is\nthe recommended way of localizing your Python applications and modules.\n'gettext' defines a *note GNUTranslations: 3927. class which implements\nthe parsing of GNU '.mo' format files, and has methods for returning\nstrings.  Instances of this class can also install themselves in the\nbuilt-in namespace as the function '()'.\n\n-- Function: gettext.find (domain, localedir=None, languages=None,\nall=False)\n\nThis function implements the standard '.mo' file search algorithm.\nIt takes a 'domain', identical to what *note textdomain(): 391f.\ntakes.  Optional 'localedir' is as in *note bindtextdomain(): 391d.\nOptional 'languages' is a list of strings, where each string is a\nlanguage code.\n\nIf 'localedir' is not given, then the default system locale\ndirectory is used.  (1)  If 'languages' is not given, then the\nfollowing environment variables are searched: 'LANGUAGE', 'LCALL',\n'LCMESSAGES', and 'LANG'.  The first one returning a non-empty\nvalue is used for the 'languages' variable.  The environment\nvariables should contain a colon separated list of languages, which\nwill be split on the colon to produce the expected list of language\ncode strings.\n\n*note find(): 3928. then expands and normalizes the languages, and\nthen iterates through them, searching for an existing file built of\nthese components:\n\n'`localedir'/`language'/LCMESSAGES/`domain'.mo'\n\nThe first such file name that exists is returned by *note find():\n3928.  If no such file is found, then 'None' is returned.  If 'all'\nis given, it returns a list of all file names, in the order in\nwhich they appear in the languages list or the environment\nvariables.\n\n-- Function: gettext.translation (domain, localedir=None,\nlanguages=None, class=None, fallback=False)\n\nReturn a '*Translations' instance based on the 'domain',\n'localedir', and 'languages', which are first passed to *note\nfind(): 3928. to get a list of the associated '.mo' file paths.\nInstances with identical '.mo' file names are cached.  The actual\nclass instantiated is 'class' if provided, otherwise *note\nGNUTranslations: 3927.  The class's constructor must take a single\n*note file object: 1037. argument.\n\nIf multiple files are found, later files are used as fallbacks for\nearlier ones.  To allow setting the fallback, *note copy.copy():\n289. is used to clone each translation object from the cache; the\nactual instance data is still shared with the cache.\n\nIf no '.mo' file is found, this function raises *note OSError: 613.\nif 'fallback' is false (which is the default), and returns a *note\nNullTranslations: 3929. instance if 'fallback' is true.\n\nChanged in version 3.3: *note IOError: ecb. used to be raised, it\nis now an alias of *note OSError: 613.\n\nChanged in version 3.11: 'codeset' parameter is removed.\n\n-- Function: gettext.install (domain, localedir=None, *, names=None)\n\nThis installs the function '()' in Python's builtins namespace,\nbased on 'domain' and 'localedir' which are passed to the function\n*note translation(): 8a7.\n\nFor the 'names' parameter, please see the description of the\ntranslation object's *note install(): 392a. method.\n\nAs seen below, you usually mark the strings in your application\nthat are candidates for translation, by wrapping them in a call to\nthe '()' function, like this:\n\nprint(('This string will be translated.'))\n\nFor convenience, you want the '()' function to be installed in\nPython's builtins namespace, so it is easily accessible in all\nmodules of your application.\n\nChanged in version 3.11: 'names' is now a keyword-only parameter.\n\n* Menu:\n\n* The NullTranslations class::\n* The GNUTranslations class::\n* Solaris message catalog support::\n* The Catalog constructor::\n\n---------- Footnotes ----------\n\n(1) See the footnote for *note bindtextdomain(): 391d. above.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The NullTranslations class,  Next: The GNUTranslations class,  Up: Class-based API": {
            "content": "5.23.1.3 The 'NullTranslations' class\n.....................................\n",
            "subsections": []
        },
        "Translation classes are what actually implement the translation of": {
            "content": "original source file message strings to translated message strings.  The\nbase class used by all translation classes is *note NullTranslations:\n3929.; this provides the basic interface you can use to write your own\nspecialized translation classes.  Here are the methods of\n'NullTranslations':\n\n-- Class: gettext.NullTranslations (fp=None)\n\nTakes an optional *note file object: 1037. 'fp', which is ignored\nby the base class.  Initializes \"protected\" instance variables\n'info' and 'charset' which are set by derived classes, as well as\n'fallback', which is set through *note addfallback(): 392c.  It\nthen calls 'self.parse(fp)' if 'fp' is not 'None'.\n\n-- Method: parse (fp)\n\nNo-op in the base class, this method takes file object 'fp',\nand reads the data from the file, initializing its message\ncatalog.  If you have an unsupported message catalog file\nformat, you should override this method to parse your format.\n\n-- Method: addfallback (fallback)\n\nAdd 'fallback' as the fallback object for the current\ntranslation object.  A translation object should consult the\nfallback if it cannot provide a translation for a given\nmessage.\n\n-- Method: gettext (message)\n\nIf a fallback has been set, forward 'gettext()' to the\nfallback.  Otherwise, return 'message'.  Overridden in derived\nclasses.\n\n-- Method: ngettext (singular, plural, n)\n\nIf a fallback has been set, forward 'ngettext()' to the\nfallback.  Otherwise, return 'singular' if 'n' is 1; return\n'plural' otherwise.  Overridden in derived classes.\n\n-- Method: pgettext (context, message)\n\nIf a fallback has been set, forward *note pgettext(): 81b. to\nthe fallback.  Otherwise, return the translated message.\nOverridden in derived classes.\n\nNew in version 3.8.\n\n-- Method: npgettext (context, singular, plural, n)\n\nIf a fallback has been set, forward *note npgettext(): 3924.\nto the fallback.  Otherwise, return the translated message.\nOverridden in derived classes.\n\nNew in version 3.8.\n\n-- Method: info ()\n\nReturn a dictionary containing the metadata found in the\nmessage catalog file.\n\n-- Method: charset ()\n\nReturn the encoding of the message catalog file.\n\n-- Method: install (names=None)\n\nThis method installs *note gettext(): 392e. into the built-in\nnamespace, binding it to ''.\n\nIf the 'names' parameter is given, it must be a sequence\ncontaining the names of functions you want to install in the\nbuiltins namespace in addition to '()'.  Supported names are\n''gettext'', ''ngettext'', ''pgettext'', and ''npgettext''.\n\nNote that this is only one way, albeit the most convenient\nway, to make the '()' function available to your application.\nBecause it affects the entire application globally, and\nspecifically the built-in namespace, localized modules should\nnever install '()'.  Instead, they should use this code to\nmake '()' available to their module:\n\nimport gettext\nt = gettext.translation('mymodule', ...)\n= t.gettext\n\nThis puts '()' only in the module's global namespace and so\nonly affects calls within this module.\n\nChanged in version 3.8: Added ''pgettext'' and ''npgettext''.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The GNUTranslations class,  Next: Solaris message catalog support,  Prev: The NullTranslations class,  Up: Class-based API": {
            "content": "5.23.1.4 The 'GNUTranslations' class\n....................................\n\nThe 'gettext' module provides one additional class derived from *note\nNullTranslations: 3929.: *note GNUTranslations: 3927.  This class\noverrides 'parse()' to enable reading GNU 'gettext' format '.mo' files\nin both big-endian and little-endian format.\n\n*note GNUTranslations: 3927. parses optional metadata out of the\ntranslation catalog.  It is convention with GNU 'gettext' to include\nmetadata as the translation for the empty string.  This metadata is in\nRFC 822(1)-style 'key: value' pairs, and should contain the\n'Project-Id-Version' key.  If the key 'Content-Type' is found, then the\n'charset' property is used to initialize the \"protected\" 'charset'\ninstance variable, defaulting to 'None' if not found.  If the charset\nencoding is specified, then all message ids and message strings read\nfrom the catalog are converted to Unicode using this encoding, else\nASCII is assumed.\n\nSince message ids are read as Unicode strings too, all '*gettext()'\nmethods will assume message ids as Unicode strings, not byte strings.\n",
            "subsections": []
        },
        "The entire set of key/value pairs are placed into a dictionary and set": {
            "content": "as the \"protected\" 'info' instance variable.\n",
            "subsections": []
        },
        "If the '.mo' file's magic number is invalid, the major version number is": {
            "content": "unexpected, or if other problems occur while reading the file,\ninstantiating a *note GNUTranslations: 3927. class can raise *note\nOSError: 613.\n\n-- Class: gettext.GNUTranslations\n\nThe following methods are overridden from the base class\nimplementation:\n\n-- Method: gettext (message)\n\nLook up the 'message' id in the catalog and return the\ncorresponding message string, as a Unicode string.  If there\nis no entry in the catalog for the 'message' id, and a\nfallback has been set, the look up is forwarded to the\nfallback's *note gettext(): 392e. method.  Otherwise, the\n'message' id is returned.\n\n-- Method: ngettext (singular, plural, n)\n\nDo a plural-forms lookup of a message id.  'singular' is used\nas the message id for purposes of lookup in the catalog, while\n'n' is used to determine which plural form to use.  The\nreturned message string is a Unicode string.\n\nIf the message id is not found in the catalog, and a fallback\nis specified, the request is forwarded to the fallback's *note\nngettext(): 392f. method.  Otherwise, when 'n' is 1 'singular'\nis returned, and 'plural' is returned in all other cases.\n\nHere is an example:\n\nn = len(os.listdir('.'))\ncat = GNUTranslations(somefile)\nmessage = cat.ngettext(\n'There is %(num)d file in this directory',\n'There are %(num)d files in this directory',\nn) % {'num': n}\n\n-- Method: pgettext (context, message)\n\nLook up the 'context' and 'message' id in the catalog and\nreturn the corresponding message string, as a Unicode string.\nIf there is no entry in the catalog for the 'message' id and\n'context', and a fallback has been set, the look up is\nforwarded to the fallback's *note pgettext(): 81b. method.\nOtherwise, the 'message' id is returned.\n\nNew in version 3.8.\n\n-- Method: npgettext (context, singular, plural, n)\n\nDo a plural-forms lookup of a message id.  'singular' is used\nas the message id for purposes of lookup in the catalog, while\n'n' is used to determine which plural form to use.\n\nIf the message id for 'context' is not found in the catalog,\nand a fallback is specified, the request is forwarded to the\nfallback's *note npgettext(): 3924. method.  Otherwise, when\n'n' is 1 'singular' is returned, and 'plural' is returned in\nall other cases.\n\nNew in version 3.8.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc822.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Solaris message catalog support,  Next: The Catalog constructor,  Prev: The GNUTranslations class,  Up: Class-based API": {
            "content": "5.23.1.5 Solaris message catalog support\n........................................\n",
            "subsections": []
        },
        "The Solaris operating system defines its own binary '.mo' file format,": {
            "content": "but since no documentation can be found on this format, it is not\nsupported at this time.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The Catalog constructor,  Prev: Solaris message catalog support,  Up: Class-based API": {
            "content": "5.23.1.6 The Catalog constructor\n................................\n\nGNOME uses a version of the *note gettext: 5e. module by James",
            "subsections": []
        },
        "Henstridge, but this version has a slightly different API. Its": {
            "content": "documented usage was:\n\nimport gettext\ncat = gettext.Catalog(domain, localedir)\n= cat.gettext\nprint(('hello world'))\n",
            "subsections": []
        },
        "For compatibility with this older module, the function 'Catalog()' is an": {
            "content": "alias for the *note translation(): 8a7. function described above.\n",
            "subsections": []
        },
        "One difference between this module and Henstridge's: his catalog objects": {
            "content": "supported access through a mapping API, but this appears to be unused\nand so is not currently supported.\n\nFile: python3.12.info,  Node: Internationalizing your programs and modules,  Next: Acknowledgements<9>,  Prev: Class-based API,  Up: gettext -- Multilingual internationalization services\n\n5.23.1.7 Internationalizing your programs and modules\n.....................................................\n",
            "subsections": []
        },
        "Internationalization (I18N) refers to the operation by which a program": {
            "content": "is made aware of multiple languages.  Localization (L10N) refers to the\nadaptation of your program, once internationalized, to the local\nlanguage and cultural habits.  In order to provide multilingual messages\nfor your Python programs, you need to take the following steps:\n\n1. prepare your program or module by specially marking translatable\nstrings\n\n2. run a suite of tools over your marked files to generate raw\nmessages catalogs\n\n3. create language-specific translations of the message catalogs\n\n4. use the *note gettext: 5e. module so that message strings are\nproperly translated\n",
            "subsections": []
        },
        "In order to prepare your code for I18N, you need to look at all the": {
            "content": "strings in your files.  Any string that needs to be translated should be\nmarked by wrapping it in '('...')' -- that is, a call to the function\n*note : 5e.  For example:\n\nfilename = 'mylog.txt'\nmessage = ('writing a log message')\nwith open(filename, 'w') as fp:\nfp.write(message)\n",
            "subsections": []
        },
        "In this example, the string ''writing a log message'' is marked as a": {
            "content": "candidate for translation, while the strings ''mylog.txt'' and ''w'' are\nnot.\n",
            "subsections": []
        },
        "There are a few tools to extract the strings meant for translation.  The": {
            "content": "original GNU 'gettext' only supported C or C++ source code but its\nextended version 'xgettext' scans code written in a number of languages,\nincluding Python, to find strings marked as translatable.  Babel(1) is a",
            "subsections": []
        },
        "Python internationalization library that includes a 'pybabel' script to": {
            "content": "extract and compile message catalogs.  Franc,ois Pinard's program called\n'xpot' does a similar job and is available as part of his po-utils\npackage(2).\n\n(Python also includes pure-Python versions of these programs, called\n'pygettext.py' and 'msgfmt.py'; some Python distributions will install\nthem for you.  'pygettext.py' is similar to 'xgettext', but only\nunderstands Python source code and cannot handle other programming\nlanguages such as C or C++.  'pygettext.py' supports a command-line\ninterface similar to 'xgettext'; for details on its use, run\n'pygettext.py --help'.  'msgfmt.py' is binary compatible with GNU\n'msgfmt'.  With these two programs, you may not need the GNU 'gettext'\npackage to internationalize your Python applications.)\n\n'xgettext', 'pygettext', and similar tools generate '.po' files that are\nmessage catalogs.  They are structured human-readable files that contain\nevery marked string in the source code, along with a placeholder for the\ntranslated versions of these strings.\n",
            "subsections": []
        },
        "Copies of these '.po' files are then handed over to the individual human": {
            "content": "translators who write translations for every supported natural language.",
            "subsections": []
        },
        "They send back the completed language-specific versions as a": {
            "content": "'<language-name>.po' file that's compiled into a machine-readable '.mo'\nbinary catalog file using the 'msgfmt' program.  The '.mo' files are\nused by the *note gettext: 5e. module for the actual translation\nprocessing at run-time.\n\nHow you use the *note gettext: 5e. module in your code depends on\nwhether you are internationalizing a single module or your entire\napplication.  The next two sections will discuss each case.\n\n* Menu:\n\n* Localizing your module::\n* Localizing your application::\n* Changing languages on the fly::\n* Deferred translations::\n\n---------- Footnotes ----------\n\n(1) https://babel.pocoo.org/\n\n(2) https://github.com/pinard/po-utils\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Localizing your module,  Next: Localizing your application,  Up: Internationalizing your programs and modules": {
            "content": "5.23.1.8 Localizing your module\n...............................\n",
            "subsections": []
        },
        "If you are localizing your module, you must take care not to make global": {
            "content": "changes, e.g.  to the built-in namespace.  You should not use the GNU\n'gettext' API but instead the class-based API.\n\nLet's say your module is called \"spam\" and the module's various natural\nlanguage translation '.mo' files reside in '/usr/share/locale' in GNU\n'gettext' format.  Here's what you would put at the top of your module:\n\nimport gettext\nt = gettext.translation('spam', '/usr/share/locale')\n= t.gettext\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Localizing your application,  Next: Changing languages on the fly,  Prev: Localizing your module,  Up: Internationalizing your programs and modules": {
            "content": "5.23.1.9 Localizing your application\n....................................\n",
            "subsections": []
        },
        "If you are localizing your application, you can install the '()'": {
            "content": "function globally into the built-in namespace, usually in the main\ndriver file of your application.  This will let all your\napplication-specific files just use '('...')' without having to\nexplicitly install it in each file.\n",
            "subsections": []
        },
        "In the simple case then, you need only add the following bit of code to": {
            "content": "the main driver file of your application:\n\nimport gettext\ngettext.install('myapplication')\n\nIf you need to set the locale directory, you can pass it into the *note\ninstall(): 8a8. function:\n\nimport gettext\ngettext.install('myapplication', '/usr/share/locale')\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Changing languages on the fly,  Next: Deferred translations,  Prev: Localizing your application,  Up: Internationalizing your programs and modules": {
            "content": "5.23.1.10 Changing languages on the fly\n.......................................\n",
            "subsections": []
        },
        "If your program needs to support many languages at the same time, you": {
            "content": "may want to create multiple translation instances and then switch\nbetween them explicitly, like so:\n\nimport gettext\n\nlang1 = gettext.translation('myapplication', languages=['en'])\nlang2 = gettext.translation('myapplication', languages=['fr'])\nlang3 = gettext.translation('myapplication', languages=['de'])\n\n# start by using language1\nlang1.install()\n\n# ... time goes by, user selects language 2\nlang2.install()\n\n# ... more time goes by, user selects language 3\nlang3.install()\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Deferred translations,  Prev: Changing languages on the fly,  Up: Internationalizing your programs and modules": {
            "content": "5.23.1.11 Deferred translations\n...............................\n\nIn most coding situations, strings are translated where they are coded.",
            "subsections": []
        },
        "Occasionally however, you need to mark strings for translation, but": {
            "content": "defer actual translation until later.  A classic example is:\n\nanimals = ['mollusk',\n'albatross',\n'rat',\n'penguin',\n'python', ]\n# ...\nfor a in animals:\nprint(a)\n",
            "subsections": []
        },
        "Here, you want to mark the strings in the 'animals' list as being": {
            "content": "translatable, but you don't actually want to translate them until they\nare printed.\n\nHere is one way you can handle this situation:\n\ndef (message): return message\n\nanimals = [('mollusk'),\n('albatross'),\n('rat'),\n('penguin'),\n('python'), ]\n\ndel\n\n# ...\nfor a in animals:\nprint((a))\n",
            "subsections": []
        },
        "This works because the dummy definition of '()' simply returns the": {
            "content": "string unchanged.  And this dummy definition will temporarily override\nany definition of '()' in the built-in namespace (until the *note del:\n14fb. command).  Take care, though if you have a previous definition of\n'()' in the local namespace.\n\nNote that the second use of '()' will not identify \"a\" as being\ntranslatable to the 'gettext' program, because the parameter is not a\nstring literal.\n\nAnother way to handle this is with the following example:\n\ndef N(message): return message\n\nanimals = [N('mollusk'),\nN('albatross'),\nN('rat'),\nN('penguin'),\nN('python'), ]\n\n# ...\nfor a in animals:\nprint((a))\n",
            "subsections": []
        },
        "In this case, you are marking translatable strings with the function": {
            "content": "'N()', which won't conflict with any definition of '()'.  However, you\nwill need to teach your message extraction program to look for\ntranslatable strings marked with 'N()'.  'xgettext', 'pygettext',\n'pybabel extract', and 'xpot' all support this through the use of the\n'-k' command-line switch.  The choice of 'N()' here is totally\narbitrary; it could have just as easily been\n'MarkThisStringForTranslation()'.\n\nFile: python3.12.info,  Node: Acknowledgements<9>,  Prev: Internationalizing your programs and modules,  Up: gettext -- Multilingual internationalization services\n\n5.23.1.12 Acknowledgements\n..........................\n",
            "subsections": []
        },
        "The following people contributed code, feedback, design suggestions,": {
            "content": "previous implementations, and valuable experience to the creation of\nthis module:\n\n* Peter Funk\n\n* James Henstridge\n\n* Juan David Ib??n~ez Palomar\n\n* Marc-Andre' Lemburg\n\n* Martin von Lo\"wis\n\n* Franc,ois Pinard\n\n* Barry Warsaw\n\n* Gustavo Niemeyer\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: locale -- Internationalization services,  Prev: gettext -- Multilingual internationalization services,  Up: Internationalization": {
            "content": "'Source code:' Lib/locale.py(1)\n\n\n\nThe *note locale: 81. module opens access to the POSIX locale database\nand functionality.  The POSIX locale mechanism allows programmers to\ndeal with certain cultural issues in an application, without requiring\nthe programmer to know all the specifics of each country where the\nsoftware is executed.\n\nThe *note locale: 81. module is implemented on top of the 'locale'\nmodule, which in turn uses an ANSI C locale implementation if available.\n\nThe *note locale: 81. module defines the following exception and\nfunctions:\n\n-- Exception: locale.Error\n\nException raised when the locale passed to *note setlocale(): 500.\nis not recognized.\n\n-- Function: locale.setlocale (category, locale=None)\n\nIf 'locale' is given and not 'None', *note setlocale(): 500.\nmodifies the locale setting for the 'category'.  The available\ncategories are listed in the data description below.  'locale' may\nbe a string, or an iterable of two strings (language code and\nencoding).  If it's an iterable, it's converted to a locale name\nusing the locale aliasing engine.  An empty string specifies the\nuser's default settings.  If the modification of the locale fails,\nthe exception *note Error: 3944. is raised.  If successful, the new\nlocale setting is returned.\n\nIf 'locale' is omitted or 'None', the current setting for\n'category' is returned.\n\n*note setlocale(): 500. is not thread-safe on most systems.\nApplications typically start with a call of\n\nimport locale\nlocale.setlocale(locale.LCALL, '')\n\nThis sets the locale for all categories to the user's default\nsetting (typically specified in the 'LANG' environment variable).\nIf the locale is not changed thereafter, using multithreading\nshould not cause problems.\n\n-- Function: locale.localeconv ()\n\nReturns the database of the local conventions as a dictionary.\nThis dictionary has the following strings as keys:\n\nCategory                   Key                                       Meaning\n\n----------------------------------------------------------------------------------------------------------\n\n*note LCNUMERIC: 3945.    ''decimalpoint''                         Decimal point character.\n\n\n''grouping''                              Sequence of numbers specifying\nwhich relative positions the\n''thousandssep'' is expected.  If\nthe sequence is terminated with\n*note CHARMAX: 3946, no further\ngrouping is performed.  If the\nsequence terminates with a '0',\nthe last group size is repeatedly\nused.\n\n\n''thousandssep''                         Character used between groups.\n\n\n*note LCMONETARY: 3947.   ''intcurrsymbol''                       International currency symbol.\n\n\n''currencysymbol''                       Local currency symbol.\n\n\n''pcsprecedes/ncsprecedes''           Whether the currency symbol\nprecedes the value (for positive\nresp.  negative values).\n\n\n''psepbyspace/nsepbyspace''         Whether the currency symbol is\nseparated from the value by a\nspace (for positive resp.\nnegative values).\n\n\n''mondecimalpoint''                     Decimal point used for monetary\nvalues.\n\n\n''fracdigits''                           Number of fractional digits used\nin local formatting of monetary\nvalues.\n\n\n''intfracdigits''                       Number of fractional digits used\nin international formatting of\nmonetary values.\n\n\n''monthousandssep''                     Group separator used for monetary\nvalues.\n\n\n''mongrouping''                          Equivalent to ''grouping'', used\nfor monetary values.\n\n\n''positivesign''                         Symbol used to annotate a positive\nmonetary value.\n\n\n''negativesign''                         Symbol used to annotate a negative\nmonetary value.\n\n\n''psignposn/nsignposn''               The position of the sign (for\npositive resp.  negative values),\nsee below.\n\n\nAll numeric values can be set to *note CHARMAX: 3946. to indicate\nthat there is no value specified in this locale.\n\nThe possible values for ''psignposn'' and ''nsignposn'' are\ngiven below.\n\nValue              Explanation\n\n-----------------------------------------------------------------\n\n'0'                Currency and value are surrounded by\nparentheses.\n\n\n'1'                The sign should precede the value and\ncurrency symbol.\n\n\n'2'                The sign should follow the value and\ncurrency symbol.\n\n\n'3'                The sign should immediately precede the\nvalue.\n\n\n'4'                The sign should immediately follow the\nvalue.\n\n\n'CHARMAX'         Nothing is specified in this locale.\n\n\nThe function temporarily sets the 'LCCTYPE' locale to the\n'LCNUMERIC' locale or the 'LCMONETARY' locale if locales are\ndifferent and numeric or monetary strings are non-ASCII. This\ntemporary change affects other threads.\n\nChanged in version 3.7: The function now temporarily sets the\n'LCCTYPE' locale to the 'LCNUMERIC' locale in some cases.\n\n-- Function: locale.nllanginfo (option)\n\nReturn some locale-specific information as a string.  This function\nis not available on all systems, and the set of possible options\nmight also vary across platforms.  The possible argument values are\nnumbers, for which symbolic constants are available in the locale\nmodule.\n\nThe *note nllanginfo(): 3948. function accepts one of the\nfollowing keys.  Most descriptions are taken from the corresponding\ndescription in the GNU C library.\n\n-- Data: locale.CODESET\n\nGet a string with the name of the character encoding used in\nthe selected locale.\n\n-- Data: locale.DTFMT\n\nGet a string that can be used as a format string for *note\ntime.strftime(): 105d. to represent date and time in a\nlocale-specific way.\n\n-- Data: locale.DFMT\n\nGet a string that can be used as a format string for *note\ntime.strftime(): 105d. to represent a date in a\nlocale-specific way.\n\n-- Data: locale.TFMT\n\nGet a string that can be used as a format string for *note\ntime.strftime(): 105d. to represent a time in a\nlocale-specific way.\n\n-- Data: locale.TFMTAMPM\n\nGet a format string for *note time.strftime(): 105d. to\nrepresent time in the am/pm format.\n\n-- Data: locale.DAY1\n-- Data: locale.DAY2\n-- Data: locale.DAY3\n-- Data: locale.DAY4\n-- Data: locale.DAY5\n-- Data: locale.DAY6\n-- Data: locale.DAY7\n\nGet the name of the n-th day of the week.\n\nNote: This follows the US convention of *note DAY1:\n394e. being Sunday, not the international convention (ISO\n8601) that Monday is the first day of the week.\n\n-- Data: locale.ABDAY1\n-- Data: locale.ABDAY2\n-- Data: locale.ABDAY3\n-- Data: locale.ABDAY4\n-- Data: locale.ABDAY5\n-- Data: locale.ABDAY6\n-- Data: locale.ABDAY7\n\nGet the abbreviated name of the n-th day of the week.\n\n-- Data: locale.MON1\n-- Data: locale.MON2\n-- Data: locale.MON3\n-- Data: locale.MON4\n-- Data: locale.MON5\n-- Data: locale.MON6\n-- Data: locale.MON7\n-- Data: locale.MON8\n-- Data: locale.MON9\n-- Data: locale.MON10\n-- Data: locale.MON11\n-- Data: locale.MON12\n\nGet the name of the n-th month.\n\n-- Data: locale.ABMON1\n-- Data: locale.ABMON2\n-- Data: locale.ABMON3\n-- Data: locale.ABMON4\n-- Data: locale.ABMON5\n-- Data: locale.ABMON6\n-- Data: locale.ABMON7\n-- Data: locale.ABMON8\n-- Data: locale.ABMON9\n-- Data: locale.ABMON10\n-- Data: locale.ABMON11\n-- Data: locale.ABMON12\n\nGet the abbreviated name of the n-th month.\n\n-- Data: locale.RADIXCHAR\n\nGet the radix character (decimal dot, decimal comma, etc.).\n\n-- Data: locale.THOUSEP\n\nGet the separator character for thousands (groups of three\ndigits).\n\n-- Data: locale.YESEXPR\n\nGet a regular expression that can be used with the regex\nfunction to recognize a positive response to a yes/no\nquestion.\n\n-- Data: locale.NOEXPR\n\nGet a regular expression that can be used with the 'regex(3)'\nfunction to recognize a negative response to a yes/no\nquestion.\n\nNote: The regular expressions for *note YESEXPR: 3976.\nand *note NOEXPR: 3977. use syntax suitable for the\n'regex' function from the C library, which might differ\nfrom the syntax used in *note re: b4.\n\n-- Data: locale.CRNCYSTR\n\nGet the currency symbol, preceded by \"-\" if the symbol should\nappear before the value, \"+\" if the symbol should appear after\nthe value, or \".\" if the symbol should replace the radix\ncharacter.\n\n-- Data: locale.ERA\n\nGet a string that represents the era used in the current\nlocale.\n\nMost locales do not define this value.  An example of a locale\nwhich does define this value is the Japanese one.  In Japan,\nthe traditional representation of dates includes the name of\nthe era corresponding to the then-emperor's reign.\n\nNormally it should not be necessary to use this value\ndirectly.  Specifying the 'E' modifier in their format strings\ncauses the *note time.strftime(): 105d. function to use this\ninformation.  The format of the returned string is not\nspecified, and therefore you should not assume knowledge of it\non different systems.\n\n-- Data: locale.ERADTFMT\n\nGet a format string for *note time.strftime(): 105d. to\nrepresent date and time in a locale-specific era-based way.\n\n-- Data: locale.ERADFMT\n\nGet a format string for *note time.strftime(): 105d. to\nrepresent a date in a locale-specific era-based way.\n\n-- Data: locale.ERATFMT\n\nGet a format string for *note time.strftime(): 105d. to\nrepresent a time in a locale-specific era-based way.\n\n-- Data: locale.ALTDIGITS\n\nGet a representation of up to 100 values used to represent the\nvalues 0 to 99.\n\n-- Function: locale.getdefaultlocale ([envvars])\n\nTries to determine the default locale settings and returns them as\na tuple of the form '(language code, encoding)'.\n\nAccording to POSIX, a program which has not called\n'setlocale(LCALL, '')' runs using the portable ''C'' locale.\nCalling 'setlocale(LCALL, '')' lets it use the default locale as\ndefined by the 'LANG' variable.  Since we do not want to interfere\nwith the current locale setting we thus emulate the behavior in the\nway described above.\n\nTo maintain compatibility with other platforms, not only the 'LANG'\nvariable is tested, but a list of variables given as envvars\nparameter.  The first found to be defined will be used.  'envvars'\ndefaults to the search path used in GNU gettext; it must always\ncontain the variable name ''LANG''.  The GNU gettext search path\ncontains ''LCALL'', ''LCCTYPE'', ''LANG'' and ''LANGUAGE'', in\nthat order.\n\nExcept for the code ''C'', the language code corresponds to RFC\n1766(2).  'language code' and 'encoding' may be 'None' if their\nvalues cannot be determined.\n\nDeprecated since version 3.11, will be removed in version 3.15.\n\n-- Function: locale.getlocale (category=LCCTYPE)\n\nReturns the current setting for the given locale category as\nsequence containing 'language code', 'encoding'.  'category' may be\none of the 'LC*' values except *note LCALL: 397e.  It defaults to\n*note LCCTYPE: 397f.\n\nExcept for the code ''C'', the language code corresponds to RFC\n1766(3).  'language code' and 'encoding' may be 'None' if their\nvalues cannot be determined.\n\n-- Function: locale.getpreferredencoding (dosetlocale=True)\n\nReturn the *note locale encoding: 27fa. used for text data,\naccording to user preferences.  User preferences are expressed\ndifferently on different systems, and might not be available\nprogrammatically on some systems, so this function only returns a\nguess.\n\nOn some systems, it is necessary to invoke *note setlocale(): 500.\nto obtain the user preferences, so this function is not\nthread-safe.  If invoking setlocale is not necessary or desired,\n'dosetlocale' should be set to 'False'.\n\nOn Android or if the *note Python UTF-8 Mode: 420. is enabled,\nalways return ''utf-8'', the *note locale encoding: 27fa. and the\n'dosetlocale' argument are ignored.\n\nThe *note Python preinitialization: 3980. configures the LCCTYPE\nlocale.  See also the *note filesystem encoding and error handler:\n291.\n\nChanged in version 3.7: The function now always returns '\"utf-8\"'\non Android or if the *note Python UTF-8 Mode: 420. is enabled.\n\n-- Function: locale.getencoding ()\n\nGet the current *note locale encoding: 27fa.:\n\n* On Android and VxWorks, return '\"utf-8\"'.\n\n* On Unix, return the encoding of the current *note LCCTYPE:\n397f. locale.  Return '\"utf-8\"' if 'nllanginfo(CODESET)'\nreturns an empty string: for example, if the current LCCTYPE\nlocale is not supported.\n\n* On Windows, return the ANSI code page.\n\nThe *note Python preinitialization: 3980. configures the LCCTYPE\nlocale.  See also the *note filesystem encoding and error handler:\n291.\n\nThis function is similar to *note getpreferredencoding(False): 290.\nexcept this function ignores the *note Python UTF-8 Mode: 420.\n\nNew in version 3.11.\n\n-- Function: locale.normalize (localename)\n\nReturns a normalized locale code for the given locale name.  The\nreturned locale code is formatted for use with *note setlocale():\n500.  If normalization fails, the original name is returned\nunchanged.\n\nIf the given encoding is not known, the function defaults to the\ndefault encoding for the locale code just like *note setlocale():\n500.\n\n-- Function: locale.resetlocale (category=LCALL)\n\nSets the locale for 'category' to the default setting.\n\nThe default setting is determined by calling *note\ngetdefaultlocale(): 249.  'category' defaults to *note LCALL:\n397e.\n\nDeprecated since version 3.11, will be removed in version 3.13.\n\n-- Function: locale.strcoll (string1, string2)\n\nCompares two strings according to the current *note LCCOLLATE:\n3983. setting.  As any other compare function, returns a negative,\nor a positive value, or '0', depending on whether 'string1'\ncollates before or after 'string2' or is equal to it.\n\n-- Function: locale.strxfrm (string)\n\nTransforms a string to one that can be used in locale-aware\ncomparisons.  For example, 'strxfrm(s1) < strxfrm(s2)' is\nequivalent to 'strcoll(s1, s2) < 0'.  This function can be used\nwhen the same string is compared repeatedly, e.g.  when collating a\nsequence of strings.\n\n-- Function: locale.formatstring (format, val, grouping=False,\nmonetary=False)\n\nFormats a number 'val' according to the current *note LCNUMERIC:\n3945. setting.  The format follows the conventions of the '%'\noperator.  For floating point values, the decimal point is modified\nif appropriate.  If 'grouping' is 'True', also takes the grouping\ninto account.\n\nIf 'monetary' is true, the conversion uses monetary thousands\nseparator and grouping strings.\n\nProcesses formatting specifiers as in 'format % val', but takes the\ncurrent locale settings into account.\n\nChanged in version 3.7: The 'monetary' keyword parameter was added.\n\n-- Function: locale.currency (val, symbol=True, grouping=False,\ninternational=False)\n\nFormats a number 'val' according to the current *note LCMONETARY:\n3947. settings.\n\nThe returned string includes the currency symbol if 'symbol' is\ntrue, which is the default.  If 'grouping' is 'True' (which is not\nthe default), grouping is done with the value.  If 'international'\nis 'True' (which is not the default), the international currency\nsymbol is used.\n\nNote: This function will not work with the 'C' locale, so you\nhave to set a locale via *note setlocale(): 500. first.\n\n-- Function: locale.str (float)\n\nFormats a floating point number using the same format as the\nbuilt-in function 'str(float)', but takes the decimal point into\naccount.\n\n-- Function: locale.delocalize (string)\n\nConverts a string into a normalized number string, following the\n*note LCNUMERIC: 3945. settings.\n\nNew in version 3.5.\n\n-- Function: locale.localize (string, grouping=False, monetary=False)\n\nConverts a normalized number string into a formatted string\nfollowing the *note LCNUMERIC: 3945. settings.\n\nNew in version 3.10.\n\n-- Function: locale.atof (string, func=float)\n\nConverts a string to a number, following the *note LCNUMERIC:\n3945. settings, by calling 'func' on the result of calling *note\ndelocalize(): c84. on 'string'.\n\n-- Function: locale.atoi (string)\n\nConverts a string to an integer, following the *note LCNUMERIC:\n3945. conventions.\n\n-- Data: locale.LCCTYPE\n\nLocale category for the character type functions.  Most\nimportantly, this category defines the text encoding, i.e.  how\nbytes are interpreted as Unicode codepoints.  See PEP 538(4) and\nPEP 540(5) for how this variable might be automatically coerced to\n'C.UTF-8' to avoid issues created by invalid settings in containers\nor incompatible settings passed over remote SSH connections.\n\nPython doesn't internally use locale-dependent character\ntransformation functions from 'ctype.h'.  Instead, an internal\n'pyctype.h' provides locale-independent equivalents like\n'PyTOLOWER'.\n\n-- Data: locale.LCCOLLATE\n\nLocale category for sorting strings.  The functions *note\nstrcoll(): 3982. and *note strxfrm(): 3984. of the *note locale:\n81. module are affected.\n\n-- Data: locale.LCTIME\n\nLocale category for the formatting of time.  The function *note\ntime.strftime(): 105d. follows these conventions.\n\n-- Data: locale.LCMONETARY\n\nLocale category for formatting of monetary values.  The available\noptions are available from the *note localeconv(): a44. function.\n\n-- Data: locale.LCMESSAGES\n\nLocale category for message display.  Python currently does not\nsupport application specific locale-aware messages.  Messages\ndisplayed by the operating system, like those returned by *note\nos.strerror(): 281d. might be affected by this category.\n\nThis value may not be available on operating systems not conforming\nto the POSIX standard, most notably Windows.\n\n-- Data: locale.LCNUMERIC\n\nLocale category for formatting numbers.  The functions *note\nformatstring(): 271, *note atoi(): 3989, *note atof(): 3988. and\n*note str(): 3986. of the *note locale: 81. module are affected by\nthat category.  All other numeric formatting operations are not\naffected.\n\n-- Data: locale.LCALL\n\nCombination of all locale settings.  If this flag is used when the\nlocale is changed, setting the locale for all categories is\nattempted.  If that fails for any category, no category is changed\nat all.  When the locale is retrieved using this flag, a string\nindicating the setting for all categories is returned.  This string\ncan be later used to restore the settings.\n\n-- Data: locale.CHARMAX\n\nThis is a symbolic constant used for different values returned by\n*note localeconv(): a44.\n\nExample:\n\n>>> import locale\n>>> loc = locale.getlocale()  # get current locale\n# use German locale; name might vary with platform\n>>> locale.setlocale(locale.LCALL, 'deDE')\n>>> locale.strcoll('f\\xe4n', 'foo')  # compare a string containing an umlaut\n>>> locale.setlocale(locale.LCALL, '')   # use user's preferred locale\n>>> locale.setlocale(locale.LCALL, 'C')  # use default (C) locale\n>>> locale.setlocale(locale.LCALL, loc)  # restore saved locale\n\n* Menu:\n\n* Background, details, hints, tips and caveats: Background details hints tips and caveats.\n* For extension writers and programs that embed Python::\n* Access to message catalogs::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/locale.py\n\n(2) https://datatracker.ietf.org/doc/html/rfc1766.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc1766.html\n\n(4) https://peps.python.org/pep-0538/\n\n(5) https://peps.python.org/pep-0540/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Background details hints tips and caveats,  Next: For extension writers and programs that embed Python,  Up: locale -- Internationalization services": {
            "content": "5.23.2.1 Background, details, hints, tips and caveats\n.....................................................\n",
            "subsections": []
        },
        "The C standard defines the locale as a program-wide property that may be": {
            "content": "relatively expensive to change.  On top of that, some implementations\nare broken in such a way that frequent locale changes may cause core\ndumps.  This makes the locale somewhat painful to use correctly.\n",
            "subsections": []
        },
        "Initially, when a program is started, the locale is the 'C' locale, no": {
            "content": "matter what the user's preferred locale is.  There is one exception: the\n*note LCCTYPE: 397f. category is changed at startup to set the current\nlocale encoding to the user's preferred locale encoding.  The program\nmust explicitly say that it wants the user's preferred locale settings\nfor other categories by calling 'setlocale(LCALL, '')'.\n\nIt is generally a bad idea to call *note setlocale(): 500. in some\nlibrary routine, since as a side effect it affects the entire program.",
            "subsections": []
        },
        "Saving and restoring it is almost as bad: it is expensive and affects": {
            "content": "other threads that happen to run before the settings have been restored.\n",
            "subsections": []
        },
        "If, when coding a module for general use, you need a locale independent": {
            "content": "version of an operation that is affected by the locale (such as certain\nformats used with *note time.strftime(): 105d.), you will have to find a\nway to do it without using the standard library routine.  Even better is\nconvincing yourself that using locale settings is okay.  Only as a last\nresort should you document that your module is not compatible with\nnon-'C' locale settings.\n",
            "subsections": []
        },
        "The only way to perform numeric operations according to the locale is to": {
            "content": "use the special functions defined by this module: *note atof(): 3988,\n*note atoi(): 3989, *note formatstring(): 271, *note str(): 3986.\n",
            "subsections": []
        },
        "There is no way to perform case conversions and character": {
            "content": "classifications according to the locale.  For (Unicode) text strings\nthese are done according to the character value only, while for byte\nstrings, the conversions and classifications are done according to the\nASCII value of the byte, and bytes whose high bit is set (i.e.,\nnon-ASCII bytes) are never converted or considered part of a character\nclass such as letter or whitespace.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: For extension writers and programs that embed Python,  Next: Access to message catalogs,  Prev: Background details hints tips and caveats,  Up: locale -- Internationalization services": {
            "content": "5.23.2.2 For extension writers and programs that embed Python\n.............................................................\n\nExtension modules should never call *note setlocale(): 500, except to\nfind out what the current locale is.  But since the return value can\nonly be used portably to restore it, that is not very useful (except\nperhaps to find out whether or not the locale is 'C').\n\nWhen Python code uses the *note locale: 81. module to change the locale,\nthis also affects the embedding application.  If the embedding\napplication doesn't want this to happen, it should remove the 'locale'\nextension module (which does all the work) from the table of built-in\nmodules in the 'config.c' file, and make sure that the 'locale' module\nis not accessible as a shared library.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Access to message catalogs,  Prev: For extension writers and programs that embed Python,  Up: locale -- Internationalization services": {
            "content": "5.23.2.3 Access to message catalogs\n...................................\n\n-- Function: locale.gettext (msg)\n\n-- Function: locale.dgettext (domain, msg)\n\n-- Function: locale.dcgettext (domain, msg, category)\n\n-- Function: locale.textdomain (domain)\n\n-- Function: locale.bindtextdomain (domain, dir)\n\n-- Function: locale.bindtextdomaincodeset (domain, codeset)\n",
            "subsections": []
        },
        "The locale module exposes the C library's gettext interface on systems": {
            "content": "that provide this interface.  It consists of the functions *note\ngettext(): 5e, *note dgettext(): 3992, *note dcgettext(): 3993, *note\ntextdomain(): 3994, *note bindtextdomain(): 3995, and *note\nbindtextdomaincodeset(): 3996.  These are similar to the same\nfunctions in the *note gettext: 5e. module, but use the C library's\nbinary format for message catalogs, and the C library's search\nalgorithms for locating message catalogs.\n",
            "subsections": []
        },
        "Python applications should normally find no need to invoke these": {
            "content": "functions, and should use *note gettext: 5e. instead.  A known exception\nto this rule are applications that link with additional C libraries\nwhich internally invoke C functions 'gettext' or 'dcgettext'.  For these\napplications, it may be necessary to bind the text domain, so that the\nlibraries can properly locate their message catalogs.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Program Frameworks,  Next: Graphical User Interfaces with Tk,  Prev: Internationalization,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.24 Program Frameworks",
                    "content": ""
                }
            ]
        },
        "The modules described in this chapter are frameworks that will largely": {
            "content": "dictate the structure of your program.  Currently the modules described\nhere are all oriented toward writing command-line interfaces.\n\nThe full list of modules described in this chapter is:\n\n* Menu:\n\n* turtle -- Turtle graphics::\n* cmd -- Support for line-oriented command interpreters::\n* shlex -- Simple lexical analysis::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: turtle -- Turtle graphics,  Next: cmd -- Support for line-oriented command interpreters,  Up: Program Frameworks": {
            "content": "'Source code:' Lib/turtle.py(1)\n\n\n\n* Menu:\n\n* Introduction: Introduction<9>.\n* Tutorial: Tutorial<3>.\n* How to...::\n* Turtle graphics reference::\n* Methods of RawTurtle/Turtle and corresponding functions::\n* Methods of TurtleScreen/Screen and corresponding functions::\n* Public classes::\n* Explanation: Explanation<2>.\n* Help and configuration::\n* turtledemo -- Demo scripts::\n* Changes since Python 2.6: Changes since Python 2 6.\n* Changes since Python 3.0: Changes since Python 3 0.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/turtle.py\n\nFile: python3.12.info,  Node: Introduction<9>,  Next: Tutorial<3>,  Up: turtle -- Turtle graphics\n\n5.24.1.1 Introduction\n.....................\n",
            "subsections": []
        },
        "Turtle graphics is an implementation of the popular geometric drawing": {
            "content": "tools introduced in Logo(1), developed by Wally Feurzeig, Seymour Papert\nand Cynthia Solomon in 1967.\n",
            "subsections": []
        },
        "Turtle star": {
            "content": "...........\n",
            "subsections": []
        },
        "Turtle can draw intricate shapes using programs that repeat simple": {
            "content": "moves.\n\n\n\n",
            "subsections": []
        },
        "In Python, turtle graphics provides a representation of a physical": {
            "content": "\"turtle\" (a little robot with a pen) that draws on a sheet of paper on\nthe floor.\n",
            "subsections": []
        },
        "It's an effective and well-proven way for learners to encounter": {
            "content": "programming concepts and interaction with software, as it provides\ninstant, visible feedback.  It also provides convenient access to\ngraphical output in general.\n",
            "subsections": []
        },
        "Turtle drawing was originally created as an educational tool, to be used": {
            "content": "by teachers in the classroom.  For the programmer who needs to produce\nsome graphical output it can be a way to do that without the overhead of\nintroducing more complex or external libraries into their work.\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Turtle(robot)\n\nFile: python3.12.info,  Node: Tutorial<3>,  Next: How to...,  Prev: Introduction<9>,  Up: turtle -- Turtle graphics\n\n5.24.1.2 Tutorial\n.................\n",
            "subsections": []
        },
        "New users should start here.  In this tutorial we'll explore some of the": {
            "content": "basics of turtle drawing.\n\n* Menu:\n\n* Starting a turtle environment::\n* Basic drawing::\n* Making algorithmic patterns::\n\nFile: python3.12.info,  Node: Starting a turtle environment,  Next: Basic drawing,  Up: Tutorial<3>\n\n5.24.1.3 Starting a turtle environment\n......................................\n\nIn a Python shell, import all the objects of the 'turtle' module:\n\nfrom turtle import *\n",
            "subsections": []
        },
        "If you run into a 'No module named 'tkinter'' error, you'll have to": {
            "content": "install the *note Tk interface package: ea. on your system.\n\nFile: python3.12.info,  Node: Basic drawing,  Next: Making algorithmic patterns,  Prev: Starting a turtle environment,  Up: Tutorial<3>\n\n5.24.1.4 Basic drawing\n......................\n\nSend the turtle forward 100 steps:\n\nforward(100)\n",
            "subsections": []
        },
        "You should see (most likely, in a new window on your display) a line": {
            "content": "drawn by the turtle, heading East.  Change the direction of the turtle,\nso that it turns 120 degrees left (anti-clockwise):\n\nleft(120)\n\nLet's continue by drawing a triangle:\n\nforward(100)\nleft(120)\nforward(100)\n",
            "subsections": []
        },
        "Notice how the turtle, represented by an arrow, points in different": {
            "content": "directions as you steer it.\n",
            "subsections": []
        },
        "Experiment with those commands, and also with 'backward()' and": {
            "content": "'right()'.\n\n* Menu:\n\n* Pen control::\n* The turtle's position::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Pen control,  Next: The turtle's position,  Up: Basic drawing": {
            "content": "5.24.1.5 Pen control\n....................\n",
            "subsections": []
        },
        "Try changing the color - for example, 'color('blue')' - and width of the": {
            "content": "line - for example, 'width(3)' - and then drawing again.\n",
            "subsections": []
        },
        "You can also move the turtle around without drawing, by lifting up the": {
            "content": "pen: 'up()' before moving.  To start drawing again, use 'down()'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The turtle's position,  Prev: Pen control,  Up: Basic drawing": {
            "content": "5.24.1.6 The turtle's position\n..............................\n",
            "subsections": []
        },
        "Send your turtle back to its starting-point (useful if it has": {
            "content": "disappeared off-screen):\n\nhome()\n",
            "subsections": []
        },
        "The home position is at the center of the turtle's screen.  If you ever": {
            "content": "need to know them, get the turtle's x-y co-ordinates with:\n\npos()\n\nHome is at '(0, 0)'.\n",
            "subsections": []
        },
        "And after a while, it will probably help to clear the window so we can": {
            "content": "start anew:\n\nclearscreen()\n\nFile: python3.12.info,  Node: Making algorithmic patterns,  Prev: Basic drawing,  Up: Tutorial<3>\n\n5.24.1.7 Making algorithmic patterns\n....................................\n\nUsing loops, it's possible to build up geometric patterns:\n\nfor steps in range(100):\nfor c in ('blue', 'red', 'green'):\ncolor(c)\nforward(steps)\nright(30)\n\n- which of course, are limited only by the imagination!\n",
            "subsections": []
        },
        "Let's draw the star shape at the top of this page.  We want red lines,": {
            "content": "filled in with yellow:\n\ncolor('red')\nfillcolor('yellow')\n",
            "subsections": []
        },
        "Just as 'up()' and 'down()' determine whether lines will be drawn,": {
            "content": "filling can be turned on and off:\n\nbeginfill()\n\nNext we'll create a loop:\n\nwhile True:\nforward(200)\nleft(170)\nif abs(pos()) < 1:\nbreak\n\n'abs(pos()) < 1' is a good way to know when the turtle is back at its\nhome position.\n\nFinally, complete the filling:\n\nendfill()\n\n(Note that filling only actually takes place when you give the\n'endfill()' command.)\n\nFile: python3.12.info,  Node: How to...,  Next: Turtle graphics reference,  Prev: Tutorial<3>,  Up: turtle -- Turtle graphics\n\n5.24.1.8 How to...\n................\n\nThis section covers some typical turtle use-cases and approaches.\n\n* Menu:\n\n* Get started as quickly as possible::\n* Use the turtle module namespace::\n* Use turtle graphics in a script::\n* Use object-oriented turtle graphics::\n\nFile: python3.12.info,  Node: Get started as quickly as possible,  Next: Use the turtle module namespace,  Up: How to...\n\n5.24.1.9 Get started as quickly as possible\n...........................................\n",
            "subsections": []
        },
        "One of the joys of turtle graphics is the immediate, visual feedback": {
            "content": "that's available from simple commands - it's an excellent way to\nintroduce children to programming ideas, with a minimum of overhead (not\njust children, of course).\n",
            "subsections": []
        },
        "The turtle module makes this possible by exposing all its basic": {
            "content": "functionality as functions, available with 'from turtle import *'.  The\n*note turtle graphics tutorial: 399d. covers this approach.\n",
            "subsections": []
        },
        "It's worth noting that many of the turtle commands also have even more": {
            "content": "terse equivalents, such as 'fd()' for *note forward(): 39a7.  These are\nespecially useful when working with learners for whom typing is not a\nskill.\n\nYou'll need to have the *note Tk interface package: ea. installed\non your system for turtle graphics to work.  Be warned that this is\nnot always straightforward, so check this in advance if you're\nplanning to use turtle graphics with a learner.\n\nFile: python3.12.info,  Node: Use the turtle module namespace,  Next: Use turtle graphics in a script,  Prev: Get started as quickly as possible,  Up: How to...\n\n5.24.1.10 Use the 'turtle' module namespace\n...........................................\n\nUsing 'from turtle import *' is convenient - but be warned that it\nimports a rather large collection of objects, and if you're doing\nanything but turtle graphics you run the risk of a name conflict (this\nbecomes even more an issue if you're using turtle graphics in a script\nwhere other modules might be imported).\n",
            "subsections": []
        },
        "The solution is to use 'import turtle' - 'fd()' becomes 'turtle.fd()',": {
            "content": "'width()' becomes 'turtle.width()' and so on.  (If typing \"turtle\" over\nand over again becomes tedious, use for example 'import turtle as t'\ninstead.)\n\nFile: python3.12.info,  Node: Use turtle graphics in a script,  Next: Use object-oriented turtle graphics,  Prev: Use the turtle module namespace,  Up: How to...\n\n5.24.1.11 Use turtle graphics in a script\n.........................................\n",
            "subsections": []
        },
        "It's recommended to use the 'turtle' module namespace as described": {
            "content": "immediately above, for example:\n\nimport turtle as t\nfrom random import random\n\nfor i in range(100):\nsteps = int(random() * 100)\nangle = int(random() * 360)\nt.right(angle)\nt.fd(steps)\n",
            "subsections": []
        },
        "Another step is also required though - as soon as the script ends,": {
            "content": "Python will also close the turtle's window.  Add:\n\nt.mainloop()\n\nto the end of the script.  The script will now wait to be dismissed and\nwill not exit until it is terminated, for example by closing the turtle\ngraphics window.\n\nFile: python3.12.info,  Node: Use object-oriented turtle graphics,  Prev: Use turtle graphics in a script,  Up: How to...\n\n5.24.1.12 Use object-oriented turtle graphics\n.............................................\n\nSee also\n........\n\n*note Explanation of the object-oriented interface: 39ac.\n",
            "subsections": []
        },
        "Other than for very basic introductory purposes, or for trying things": {
            "content": "out as quickly as possible, it's more usual and much more powerful to\nuse the object-oriented approach to turtle graphics.  For example, this\nallows multiple turtles on screen at once.\n",
            "subsections": []
        },
        "In this approach, the various turtle commands are methods of objects": {
            "content": "(mostly of 'Turtle' objects).  You 'can' use the object-oriented\napproach in the shell, but it would be more typical in a Python script.\n\nThe example above then becomes:\n\nfrom turtle import Turtle\nfrom random import random\n\nt = Turtle()\nfor i in range(100):\nsteps = int(random() * 100)\nangle = int(random() * 360)\nt.right(angle)\nt.fd(steps)\n\nt.screen.mainloop()\n\nNote the last line.  't.screen' is an instance of the *note Screen:\n39ad. that a Turtle instance exists on; it's created automatically along\nwith the turtle.\n\nThe turtle's screen can be customised, for example:\n\nt.screen.title('Object-oriented turtle demo')\nt.screen.bgcolor(\"orange\")\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Turtle graphics reference,  Next: Methods of RawTurtle/Turtle and corresponding functions,  Prev: How to...,  Up: turtle -- Turtle graphics": {
            "content": "5.24.1.13 Turtle graphics reference\n...................................\n\nNote: In the following documentation the argument list for\nfunctions is given.  Methods, of course, have the additional first\nargument 'self' which is omitted here.\n\n* Menu:\n\n* Turtle methods::\n* Methods of TurtleScreen/Screen::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Turtle methods,  Next: Methods of TurtleScreen/Screen,  Up: Turtle graphics reference": {
            "content": "5.24.1.14 Turtle methods\n........................\n",
            "subsections": []
        },
        "Turtle motion": {
            "content": "Move and draw\n\n*note forward(): 39a7. | *note fd(): 39b0.\n*note backward(): 39b1. | *note bk(): 39b2. | *note back(): 39b3.\n*note right(): 39b4. | *note rt(): 39b5.\n*note left(): 39b6. | *note lt(): 39b7.\n*note goto(): 39b8. | *note setpos(): 39b9. | *note setposition(): 39ba.\n*note teleport(): 1469.\n*note setx(): 39bb.\n*note sety(): 39bc.\n*note setheading(): 39bd. | *note seth(): 39be.\n*note home(): 39bf.\n*note circle(): 39c0.\n*note dot(): 39c1.\n*note stamp(): 39c2.\n*note clearstamp(): 39c3.\n*note clearstamps(): 39c4.\n*note undo(): 39c5.\n*note speed(): 39c6.\n\nTell Turtle's state\n\n*note position(): 39c7. | *note pos(): 39c8.\n*note towards(): 39c9.\n*note xcor(): 39ca.\n*note ycor(): 39cb.\n*note heading(): 39cc.\n*note distance(): 39cd.\n\nSetting and measurement\n\n*note degrees(): 39ce.\n*note radians(): 39cf.\n",
            "subsections": []
        },
        "Using events": {
            "content": "*note onclick(): 39f0.\n*note onrelease(): 39f1.\n*note ondrag(): 39f2.\n",
            "subsections": []
        },
        "Special Turtle methods": {
            "content": "*note beginpoly(): 39f3.\n*note endpoly(): 39f4.\n*note getpoly(): 39f5.\n*note clone(): 39f6.\n*note getturtle(): 39f7. | *note getpen(): 39f8.\n*note getscreen(): 39f9.\n*note setundobuffer(): 39fa.\n*note undobufferentries(): 39fb.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Methods of TurtleScreen/Screen,  Prev: Turtle methods,  Up: Turtle graphics reference": {
            "content": "5.24.1.15 Methods of TurtleScreen/Screen\n........................................\n",
            "subsections": []
        },
        "Window control": {
            "content": "*note bgcolor(): 39fd.\n*note bgpic(): 39fe.\n*note clearscreen(): 39ff.\n*note resetscreen(): 3a00.\n*note screensize(): 3a01.\n*note setworldcoordinates(): 3a02.\n",
            "subsections": []
        },
        "Animation control": {
            "content": "*note delay(): 3a03.\n*note tracer(): 3a04.\n*note update(): 3a05.\n",
            "subsections": []
        },
        "Using screen events": {
            "content": "*note listen(): 3a06.\n*note onkey(): 3a07. | *note onkeyrelease(): 3a08.\n*note onkeypress(): 3a09.\n*note onclick(): 39f0. | *note onscreenclick(): 3a0a.\n*note ontimer(): 3a0b.\n*note mainloop(): 3a0c. | *note done(): 3a0d.\n",
            "subsections": []
        },
        "Settings and special methods": {
            "content": "*note mode(): 3a0e.\n*note colormode(): 3a0f.\n*note getcanvas(): 3a10.\n*note getshapes(): 3a11.\n*note registershape(): 3a12. | *note addshape(): 3a13.\n*note turtles(): 3a14.\n*note windowheight(): 3a15.\n*note windowwidth(): 3a16.\n",
            "subsections": []
        },
        "Input methods": {
            "content": "*note textinput(): 1625.\n*note numinput(): 1626.\n",
            "subsections": []
        },
        "Methods specific to Screen": {
            "content": "*note bye(): 3a17.\n*note exitonclick(): 3a18.\n*note setup(): 3a19.\n*note title(): 3a1a.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "5.24.1.16 Methods of RawTurtle/Turtle and corresponding functions\n.................................................................\n",
            "subsections": []
        },
        "Most of the examples in this section refer to a Turtle instance called": {
            "content": "'turtle'.\n\n* Menu:\n\n* Turtle motion::\n* Tell Turtle's state::\n* Settings for measurement::\n* Pen control: Pen control<2>.\n* Turtle state::\n* Using events::\n* Special Turtle methods::\n* Compound shapes::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Turtle motion,  Next: Tell Turtle's state,  Up: Methods of RawTurtle/Turtle and corresponding functions": {
            "content": "5.24.1.17 Turtle motion\n.......................\n\n-- Function: turtle.forward (distance)\n-- Function: turtle.fd (distance)\n\n\nParameters: 'distance' - a number (integer or float)\n\nMove the turtle forward by the specified 'distance', in the\ndirection the turtle is headed.\n\n>>> turtle.position()\n(0.00,0.00)\n>>> turtle.forward(25)\n>>> turtle.position()\n(25.00,0.00)\n>>> turtle.forward(-75)\n>>> turtle.position()\n(-50.00,0.00)\n\n-- Function: turtle.back (distance)\n-- Function: turtle.bk (distance)\n-- Function: turtle.backward (distance)\n\n\nParameters: 'distance' - a number\n\nMove the turtle backward by 'distance', opposite to the direction\nthe turtle is headed.  Do not change the turtle's heading.\n\n>>> turtle.position()\n(0.00,0.00)\n>>> turtle.backward(30)\n>>> turtle.position()\n(-30.00,0.00)\n\n-- Function: turtle.right (angle)\n-- Function: turtle.rt (angle)\n\n\nParameters: 'angle' - a number (integer or float)\n\nTurn turtle right by 'angle' units.  (Units are by default degrees,\nbut can be set via the *note degrees(): 39ce. and *note radians():\n39cf. functions.)  Angle orientation depends on the turtle mode,\nsee *note mode(): 3a0e.\n\n>>> turtle.heading()\n22.0\n>>> turtle.right(45)\n>>> turtle.heading()\n337.0\n\n-- Function: turtle.left (angle)\n-- Function: turtle.lt (angle)\n\n\nParameters: 'angle' - a number (integer or float)\n\nTurn turtle left by 'angle' units.  (Units are by default degrees,\nbut can be set via the *note degrees(): 39ce. and *note radians():\n39cf. functions.)  Angle orientation depends on the turtle mode,\nsee *note mode(): 3a0e.\n\n>>> turtle.heading()\n22.0\n>>> turtle.left(45)\n>>> turtle.heading()\n67.0\n\n-- Function: turtle.goto (x, y=None)\n-- Function: turtle.setpos (x, y=None)\n-- Function: turtle.setposition (x, y=None)\n\n\nParameters:\n\n* 'x' - a number or a pair/vector of numbers\n\n* 'y' - a number or 'None'\n\nIf 'y' is 'None', 'x' must be a pair of coordinates or a *note\nVec2D: 3a1d. (e.g.  as returned by *note pos(): 39c8.).\n\nMove turtle to an absolute position.  If the pen is down, draw\nline.  Do not change the turtle's orientation.\n\n>>> tp = turtle.pos()\n>>> tp\n(0.00,0.00)\n>>> turtle.setpos(60,30)\n>>> turtle.pos()\n(60.00,30.00)\n>>> turtle.setpos((20,80))\n>>> turtle.pos()\n(20.00,80.00)\n>>> turtle.setpos(tp)\n>>> turtle.pos()\n(0.00,0.00)\n\n-- Function: turtle.teleport (x, y=None, *, fillgap=False)\n\n\nParameters:\n\n* 'x' - a number or 'None'\n\n* 'y' - a number or 'None'\n\n* 'fillgap' - a boolean\n\nMove turtle to an absolute position.  Unlike goto(x, y), a line\nwill not be drawn.  The turtle's orientation does not change.  If\ncurrently filling, the polygon(s) teleported from will be filled\nafter leaving, and filling will begin again after teleporting.\nThis can be disabled with fillgap=True, which makes the imaginary\nline traveled during teleporting act as a fill barrier like in\ngoto(x, y).\n\n>>> tp = turtle.pos()\n>>> tp\n(0.00,0.00)\n>>> turtle.teleport(60)\n>>> turtle.pos()\n(60.00,0.00)\n>>> turtle.teleport(y=10)\n>>> turtle.pos()\n(60.00,10.00)\n>>> turtle.teleport(20, 30)\n>>> turtle.pos()\n(20.00,30.00)\n\nNew in version 3.12.\n\n-- Function: turtle.setx (x)\n\n\nParameters: 'x' - a number (integer or float)\n\nSet the turtle's first coordinate to 'x', leave second coordinate\nunchanged.\n\n>>> turtle.position()\n(0.00,240.00)\n>>> turtle.setx(10)\n>>> turtle.position()\n(10.00,240.00)\n\n-- Function: turtle.sety (y)\n\n\nParameters: 'y' - a number (integer or float)\n\nSet the turtle's second coordinate to 'y', leave first coordinate\nunchanged.\n\n>>> turtle.position()\n(0.00,40.00)\n>>> turtle.sety(-10)\n>>> turtle.position()\n(0.00,-10.00)\n\n-- Function: turtle.setheading (toangle)\n-- Function: turtle.seth (toangle)\n\n\nParameters: 'toangle' - a number (integer or float)\n\nSet the orientation of the turtle to 'toangle'.  Here are some\ncommon directions in degrees:\n\nstandard mode           logo mode\n\n-------------------------------------------------\n\n0 - east                0 - north\n\n\n90 - north              90 - east\n\n\n180 - west              180 - south\n\n\n270 - south             270 - west\n\n\n>>> turtle.setheading(90)\n>>> turtle.heading()\n90.0\n\n-- Function: turtle.home ()\n\nMove turtle to the origin - coordinates (0,0) - and set its heading\nto its start-orientation (which depends on the mode, see *note\nmode(): 3a0e.).\n\n>>> turtle.heading()\n90.0\n>>> turtle.position()\n(0.00,-10.00)\n>>> turtle.home()\n>>> turtle.position()\n(0.00,0.00)\n>>> turtle.heading()\n0.0\n\n-- Function: turtle.circle (radius, extent=None, steps=None)\n\n\nParameters:\n\n* 'radius' - a number\n\n* 'extent' - a number (or 'None')\n\n* 'steps' - an integer (or 'None')\n\nDraw a circle with given 'radius'.  The center is 'radius' units\nleft of the turtle; 'extent' - an angle - determines which part of\nthe circle is drawn.  If 'extent' is not given, draw the entire\ncircle.  If 'extent' is not a full circle, one endpoint of the arc\nis the current pen position.  Draw the arc in counterclockwise\ndirection if 'radius' is positive, otherwise in clockwise\ndirection.  Finally the direction of the turtle is changed by the\namount of 'extent'.\n\nAs the circle is approximated by an inscribed regular polygon,\n'steps' determines the number of steps to use.  If not given, it\nwill be calculated automatically.  May be used to draw regular\npolygons.\n\n>>> turtle.home()\n>>> turtle.position()\n(0.00,0.00)\n>>> turtle.heading()\n0.0\n>>> turtle.circle(50)\n>>> turtle.position()\n(-0.00,0.00)\n>>> turtle.heading()\n0.0\n>>> turtle.circle(120, 180)  # draw a semicircle\n>>> turtle.position()\n(0.00,240.00)\n>>> turtle.heading()\n180.0\n\n-- Function: turtle.dot (size=None, *color)\n\n\nParameters:\n\n* 'size' - an integer >= 1 (if given)\n\n* 'color' - a colorstring or a numeric color tuple\n\nDraw a circular dot with diameter 'size', using 'color'.  If 'size'\nis not given, the maximum of pensize+4 and 2*pensize is used.\n\n>>> turtle.home()\n>>> turtle.dot()\n>>> turtle.fd(50); turtle.dot(20, \"blue\"); turtle.fd(50)\n>>> turtle.position()\n(100.00,-0.00)\n>>> turtle.heading()\n0.0\n\n-- Function: turtle.stamp ()\n\nStamp a copy of the turtle shape onto the canvas at the current\nturtle position.  Return a stampid for that stamp, which can be\nused to delete it by calling 'clearstamp(stampid)'.\n\n>>> turtle.color(\"blue\")\n>>> stampid = turtle.stamp()\n>>> turtle.fd(50)\n\n-- Function: turtle.clearstamp (stampid)\n\n\nParameters: 'stampid' - an integer, must be return value of\nprevious *note stamp(): 39c2. call\n\nDelete stamp with given 'stampid'.\n\n>>> turtle.position()\n(150.00,-0.00)\n>>> turtle.color(\"blue\")\n>>> astamp = turtle.stamp()\n>>> turtle.fd(50)\n>>> turtle.position()\n(200.00,-0.00)\n>>> turtle.clearstamp(astamp)\n>>> turtle.position()\n(200.00,-0.00)\n\n-- Function: turtle.clearstamps (n=None)\n\n\nParameters: 'n' - an integer (or 'None')\n\nDelete all or first/last 'n' of turtle's stamps.  If 'n' is 'None',\ndelete all stamps, if 'n' > 0 delete first 'n' stamps, else if 'n'\n< 0 delete last 'n' stamps.\n\n>>> for i in range(8):\n...     unusedstampid = turtle.stamp()\n...     turtle.fd(30)\n>>> turtle.clearstamps(2)\n>>> turtle.clearstamps(-2)\n>>> turtle.clearstamps()\n\n-- Function: turtle.undo ()\n\nUndo (repeatedly) the last turtle action(s).  Number of available\nundo actions is determined by the size of the undobuffer.\n\n>>> for i in range(4):\n...     turtle.fd(50); turtle.lt(80)\n...\n>>> for i in range(8):\n...     turtle.undo()\n\n-- Function: turtle.speed (speed=None)\n\n\nParameters: 'speed' - an integer in the range 0..10 or a\nspeedstring (see below)\n\nSet the turtle's speed to an integer value in the range 0..10.  If\nno argument is given, return current speed.\n\nIf input is a number greater than 10 or smaller than 0.5, speed is\nset to 0.  Speedstrings are mapped to speedvalues as follows:\n\n* \"fastest\": 0\n\n* \"fast\": 10\n\n* \"normal\": 6\n\n* \"slow\": 3\n\n* \"slowest\": 1\n\nSpeeds from 1 to 10 enforce increasingly faster animation of line\ndrawing and turtle turning.\n\nAttention: 'speed' = 0 means that 'no' animation takes place.\nforward/back makes turtle jump and likewise left/right make the\nturtle turn instantly.\n\n>>> turtle.speed()\n3\n>>> turtle.speed('normal')\n>>> turtle.speed()\n6\n>>> turtle.speed(9)\n>>> turtle.speed()\n9\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Tell Turtle's state,  Next: Settings for measurement,  Prev: Turtle motion,  Up: Methods of RawTurtle/Turtle and corresponding functions": {
            "content": "5.24.1.18 Tell Turtle's state\n.............................\n\n-- Function: turtle.position ()\n-- Function: turtle.pos ()\n\nReturn the turtle's current location (x,y) (as a *note Vec2D: 3a1d.\nvector).\n\n>>> turtle.pos()\n(440.00,-0.00)\n\n-- Function: turtle.towards (x, y=None)\n\n\nParameters:\n\n* 'x' - a number or a pair/vector of numbers or a turtle\ninstance\n\n* 'y' - a number if 'x' is a number, else 'None'\n\nReturn the angle between the line from turtle position to position\nspecified by (x,y), the vector or the other turtle.  This depends\non the turtle's start orientation which depends on the mode -\n\"standard\"/\"world\" or \"logo\".\n\n>>> turtle.goto(10, 10)\n>>> turtle.towards(0,0)\n225.0\n\n-- Function: turtle.xcor ()\n\nReturn the turtle's x coordinate.\n\n>>> turtle.home()\n>>> turtle.left(50)\n>>> turtle.forward(100)\n>>> turtle.pos()\n(64.28,76.60)\n>>> print(round(turtle.xcor(), 5))\n64.27876\n\n-- Function: turtle.ycor ()\n\nReturn the turtle's y coordinate.\n\n>>> turtle.home()\n>>> turtle.left(60)\n>>> turtle.forward(100)\n>>> print(turtle.pos())\n(50.00,86.60)\n>>> print(round(turtle.ycor(), 5))\n86.60254\n\n-- Function: turtle.heading ()\n\nReturn the turtle's current heading (value depends on the turtle\nmode, see *note mode(): 3a0e.).\n\n>>> turtle.home()\n>>> turtle.left(67)\n>>> turtle.heading()\n67.0\n\n-- Function: turtle.distance (x, y=None)\n\n\nParameters:\n\n* 'x' - a number or a pair/vector of numbers or a turtle\ninstance\n\n* 'y' - a number if 'x' is a number, else 'None'\n\nReturn the distance from the turtle to (x,y), the given vector, or\nthe given other turtle, in turtle step units.\n\n>>> turtle.home()\n>>> turtle.distance(30,40)\n50.0\n>>> turtle.distance((30,40))\n50.0\n>>> joe = Turtle()\n>>> joe.forward(77)\n>>> turtle.distance(joe)\n77.0\n\nFile: python3.12.info,  Node: Settings for measurement,  Next: Pen control<2>,  Prev: Tell Turtle's state,  Up: Methods of RawTurtle/Turtle and corresponding functions\n\n5.24.1.19 Settings for measurement\n..................................\n\n-- Function: turtle.degrees (fullcircle=360.0)\n\n\nParameters: 'fullcircle' - a number\n\nSet angle measurement units, i.e.  set number of \"degrees\" for a\nfull circle.  Default value is 360 degrees.\n\n>>> turtle.home()\n>>> turtle.left(90)\n>>> turtle.heading()\n90.0\n\nChange angle measurement unit to grad (also known as gon,\ngrade, or gradian and equals 1/100-th of the right angle.)\n>>> turtle.degrees(400.0)\n>>> turtle.heading()\n100.0\n>>> turtle.degrees(360)\n>>> turtle.heading()\n90.0\n\n-- Function: turtle.radians ()\n\nSet the angle measurement units to radians.  Equivalent to\n'degrees(2*math.pi)'.\n\n>>> turtle.home()\n>>> turtle.left(90)\n>>> turtle.heading()\n90.0\n>>> turtle.radians()\n>>> turtle.heading()\n1.5707963267948966\n\nFile: python3.12.info,  Node: Pen control<2>,  Next: Turtle state,  Prev: Settings for measurement,  Up: Methods of RawTurtle/Turtle and corresponding functions\n\n5.24.1.20 Pen control\n.....................\n\n* Menu:\n\n* Drawing state::\n* Color control::\n* Filling::\n* More drawing control::\n\nFile: python3.12.info,  Node: Drawing state,  Next: Color control,  Up: Pen control<2>\n\n5.24.1.21 Drawing state\n.......................\n\n-- Function: turtle.pendown ()\n-- Function: turtle.pd ()\n-- Function: turtle.down ()\n\nPull the pen down - drawing when moving.\n\n-- Function: turtle.penup ()\n-- Function: turtle.pu ()\n-- Function: turtle.up ()\n\nPull the pen up - no drawing when moving.\n\n-- Function: turtle.pensize (width=None)\n-- Function: turtle.width (width=None)\n\n\nParameters: 'width' - a positive number\n\nSet the line thickness to 'width' or return it.  If resizemode is\nset to \"auto\" and turtleshape is a polygon, that polygon is drawn\nwith the same line thickness.  If no argument is given, the current\npensize is returned.\n\n>>> turtle.pensize()\n1\n>>> turtle.pensize(10)   # from here on lines of width 10 are drawn\n\n-- Function: turtle.pen (pen=None, pendict)\n\n\nParameters:\n\n* 'pen' - a dictionary with some or all of the below listed keys\n\n* 'pendict' - one or more keyword-arguments with the below\nlisted keys as keywords\n\nReturn or set the pen's attributes in a \"pen-dictionary\" with the\nfollowing key/value pairs:\n\n* \"shown\": True/False\n\n* \"pendown\": True/False\n\n* \"pencolor\": color-string or color-tuple\n\n* \"fillcolor\": color-string or color-tuple\n\n* \"pensize\": positive number\n\n* \"speed\": number in range 0..10\n\n* \"resizemode\": \"auto\" or \"user\" or \"noresize\"\n\n* \"stretchfactor\": (positive number, positive number)\n\n* \"outline\": positive number\n\n* \"tilt\": number\n\nThis dictionary can be used as argument for a subsequent call to\n*note pen(): 39d8. to restore the former pen-state.  Moreover one\nor more of these attributes can be provided as keyword-arguments.\nThis can be used to set several pen attributes in one statement.\n\n>>> turtle.pen(fillcolor=\"black\", pencolor=\"red\", pensize=10)\n>>> sorted(turtle.pen().items())\n[('fillcolor', 'black'), ('outline', 1), ('pencolor', 'red'),\n('pendown', True), ('pensize', 10), ('resizemode', 'noresize'),\n('shearfactor', 0.0), ('shown', True), ('speed', 9),\n('stretchfactor', (1.0, 1.0)), ('tilt', 0.0)]\n>>> penstate=turtle.pen()\n>>> turtle.color(\"yellow\", \"\")\n>>> turtle.penup()\n>>> sorted(turtle.pen().items())[:3]\n[('fillcolor', ''), ('outline', 1), ('pencolor', 'yellow')]\n>>> turtle.pen(penstate, fillcolor=\"green\")\n>>> sorted(turtle.pen().items())[:3]\n[('fillcolor', 'green'), ('outline', 1), ('pencolor', 'red')]\n\n-- Function: turtle.isdown ()\n\nReturn 'True' if pen is down, 'False' if it's up.\n\n>>> turtle.penup()\n>>> turtle.isdown()\nFalse\n>>> turtle.pendown()\n>>> turtle.isdown()\nTrue\n\nFile: python3.12.info,  Node: Color control,  Next: Filling,  Prev: Drawing state,  Up: Pen control<2>\n\n5.24.1.22 Color control\n.......................\n\n-- Function: turtle.pencolor (*args)\n\nReturn or set the pencolor.\n\nFour input formats are allowed:\n\n'pencolor()'\n\nReturn the current pencolor as color specification string or\nas a tuple (see example).  May be used as input to another\ncolor/pencolor/fillcolor call.\n\n'pencolor(colorstring)'\n\nSet pencolor to 'colorstring', which is a Tk color\nspecification string, such as '\"red\"', '\"yellow\"', or\n'\"#33cc8c\"'.\n\n'pencolor((r, g, b))'\n\nSet pencolor to the RGB color represented by the tuple of 'r',\n'g', and 'b'.  Each of 'r', 'g', and 'b' must be in the range\n0..colormode, where colormode is either 1.0 or 255 (see *note\ncolormode(): 3a0f.).\n\n'pencolor(r, g, b)'\n\nSet pencolor to the RGB color represented by 'r', 'g', and\n'b'.  Each of 'r', 'g', and 'b' must be in the range\n0..colormode.\n\nIf turtleshape is a polygon, the outline of that polygon is drawn\nwith the newly set pencolor.\n\n>>> colormode()\n1.0\n>>> turtle.pencolor()\n'red'\n>>> turtle.pencolor(\"brown\")\n>>> turtle.pencolor()\n'brown'\n>>> tup = (0.2, 0.8, 0.55)\n>>> turtle.pencolor(tup)\n>>> turtle.pencolor()\n(0.2, 0.8, 0.5490196078431373)\n>>> colormode(255)\n>>> turtle.pencolor()\n(51.0, 204.0, 140.0)\n>>> turtle.pencolor('#32c18f')\n>>> turtle.pencolor()\n(50.0, 193.0, 143.0)\n\n-- Function: turtle.fillcolor (*args)\n\nReturn or set the fillcolor.\n\nFour input formats are allowed:\n\n'fillcolor()'\n\nReturn the current fillcolor as color specification string,\npossibly in tuple format (see example).  May be used as input\nto another color/pencolor/fillcolor call.\n\n'fillcolor(colorstring)'\n\nSet fillcolor to 'colorstring', which is a Tk color\nspecification string, such as '\"red\"', '\"yellow\"', or\n'\"#33cc8c\"'.\n\n'fillcolor((r, g, b))'\n\nSet fillcolor to the RGB color represented by the tuple of\n'r', 'g', and 'b'.  Each of 'r', 'g', and 'b' must be in the\nrange 0..colormode, where colormode is either 1.0 or 255 (see\n*note colormode(): 3a0f.).\n\n'fillcolor(r, g, b)'\n\nSet fillcolor to the RGB color represented by 'r', 'g', and\n'b'.  Each of 'r', 'g', and 'b' must be in the range\n0..colormode.\n\nIf turtleshape is a polygon, the interior of that polygon is drawn\nwith the newly set fillcolor.\n\n>>> turtle.fillcolor(\"violet\")\n>>> turtle.fillcolor()\n'violet'\n>>> turtle.pencolor()\n(50.0, 193.0, 143.0)\n>>> turtle.fillcolor((50, 193, 143))  # Integers, not floats\n>>> turtle.fillcolor()\n(50.0, 193.0, 143.0)\n>>> turtle.fillcolor('#ffffff')\n>>> turtle.fillcolor()\n(255.0, 255.0, 255.0)\n\n-- Function: turtle.color (*args)\n\nReturn or set pencolor and fillcolor.\n\nSeveral input formats are allowed.  They use 0 to 3 arguments as\nfollows:\n\n'color()'\n\nReturn the current pencolor and the current fillcolor as a\npair of color specification strings or tuples as returned by\n*note pencolor(): 39db. and *note fillcolor(): 39dc.\n\n'color(colorstring)', 'color((r,g,b))', 'color(r,g,b)'\n\nInputs as in *note pencolor(): 39db, set both, fillcolor and\npencolor, to the given value.\n\n'color(colorstring1, colorstring2)', 'color((r1,g1,b1), (r2,g2,b2))'\n\nEquivalent to 'pencolor(colorstring1)' and\n'fillcolor(colorstring2)' and analogously if the other input\nformat is used.\n\nIf turtleshape is a polygon, outline and interior of that polygon\nis drawn with the newly set colors.\n\n>>> turtle.color(\"red\", \"green\")\n>>> turtle.color()\n('red', 'green')\n>>> color(\"#285078\", \"#a0c8f0\")\n>>> color()\n((40.0, 80.0, 120.0), (160.0, 200.0, 240.0))\n\nSee also: Screen method *note colormode(): 3a0f.\n\nFile: python3.12.info,  Node: Filling,  Next: More drawing control,  Prev: Color control,  Up: Pen control<2>\n\n5.24.1.23 Filling\n.................\n\n-- Function: turtle.filling ()\n\nReturn fillstate ('True' if filling, 'False' else).\n\n>>> turtle.beginfill()\n>>> if turtle.filling():\n...    turtle.pensize(5)\n... else:\n...    turtle.pensize(3)\n\n-- Function: turtle.beginfill ()\n\nTo be called just before drawing a shape to be filled.\n\n-- Function: turtle.endfill ()\n\nFill the shape drawn after the last call to *note beginfill():\n39de.\n\nWhether or not overlap regions for self-intersecting polygons or\nmultiple shapes are filled depends on the operating system\ngraphics, type of overlap, and number of overlaps.  For example,\nthe Turtle star above may be either all yellow or have some white\nregions.\n\n>>> turtle.color(\"black\", \"red\")\n>>> turtle.beginfill()\n>>> turtle.circle(80)\n>>> turtle.endfill()\n\nFile: python3.12.info,  Node: More drawing control,  Prev: Filling,  Up: Pen control<2>\n\n5.24.1.24 More drawing control\n..............................\n\n-- Function: turtle.reset ()\n\nDelete the turtle's drawings from the screen, re-center the turtle\nand set variables to the default values.\n\n>>> turtle.goto(0,-22)\n>>> turtle.left(100)\n>>> turtle.position()\n(0.00,-22.00)\n>>> turtle.heading()\n100.0\n>>> turtle.reset()\n>>> turtle.position()\n(0.00,0.00)\n>>> turtle.heading()\n0.0\n\n-- Function: turtle.clear ()\n\nDelete the turtle's drawings from the screen.  Do not move turtle.\nState and position of the turtle as well as drawings of other\nturtles are not affected.\n\n-- Function: turtle.write (arg, move=False, align='left',\nfont=('Arial', 8, 'normal'))\n\n\nParameters:\n\n* 'arg' - object to be written to the TurtleScreen\n\n* 'move' - True/False\n\n* 'align' - one of the strings \"left\", \"center\" or right\"\n\n* 'font' - a triple (fontname, fontsize, fonttype)\n\nWrite text - the string representation of 'arg' - at the current\nturtle position according to 'align' (\"left\", \"center\" or \"right\")\nand with the given font.  If 'move' is true, the pen is moved to\nthe bottom-right corner of the text.  By default, 'move' is\n'False'.\n\n>>> turtle.write(\"Home = \", True, align=\"center\")\n>>> turtle.write((0,0), True)\n\nFile: python3.12.info,  Node: Turtle state,  Next: Using events,  Prev: Pen control<2>,  Up: Methods of RawTurtle/Turtle and corresponding functions\n\n5.24.1.25 Turtle state\n......................\n\n* Menu:\n\n* Visibility::\n* Appearance::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Visibility,  Next: Appearance,  Up: Turtle state": {
            "content": "5.24.1.26 Visibility\n....................\n\n-- Function: turtle.hideturtle ()\n-- Function: turtle.ht ()\n\nMake the turtle invisible.  It's a good idea to do this while\nyou're in the middle of doing some complex drawing, because hiding\nthe turtle speeds up the drawing observably.\n\n>>> turtle.hideturtle()\n\n-- Function: turtle.showturtle ()\n-- Function: turtle.st ()\n\nMake the turtle visible.\n\n>>> turtle.showturtle()\n\n-- Function: turtle.isvisible ()\n\nReturn 'True' if the Turtle is shown, 'False' if it's hidden.\n\n>>> turtle.hideturtle()\n>>> turtle.isvisible()\nFalse\n>>> turtle.showturtle()\n>>> turtle.isvisible()\nTrue\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Appearance,  Prev: Visibility,  Up: Turtle state": {
            "content": "5.24.1.27 Appearance\n....................\n\n-- Function: turtle.shape (name=None)\n\n\nParameters: 'name' - a string which is a valid shapename\n\nSet turtle shape to shape with given 'name' or, if name is not\ngiven, return name of current shape.  Shape with 'name' must exist\nin the TurtleScreen's shape dictionary.  Initially there are the\nfollowing polygon shapes: \"arrow\", \"turtle\", \"circle\", \"square\",\n\"triangle\", \"classic\".  To learn about how to deal with shapes see\nScreen method *note registershape(): 3a12.\n\n>>> turtle.shape()\n'classic'\n>>> turtle.shape(\"turtle\")\n>>> turtle.shape()\n'turtle'\n\n-- Function: turtle.resizemode (rmode=None)\n\n\nParameters: 'rmode' - one of the strings \"auto\", \"user\", \"noresize\"\n\nSet resizemode to one of the values: \"auto\", \"user\", \"noresize\".\nIf 'rmode' is not given, return current resizemode.  Different\nresizemodes have the following effects:\n\n- \"auto\": adapts the appearance of the turtle corresponding to\nthe value of pensize.\n\n- \"user\": adapts the appearance of the turtle according to the\nvalues of stretchfactor and outlinewidth (outline), which are\nset by *note shapesize(): 39ea.\n\n- \"noresize\": no adaption of the turtle's appearance takes\nplace.\n\n'resizemode(\"user\")' is called by *note shapesize(): 39ea. when\nused with arguments.\n\n>>> turtle.resizemode()\n'noresize'\n>>> turtle.resizemode(\"auto\")\n>>> turtle.resizemode()\n'auto'\n\n-- Function: turtle.shapesize (stretchwid=None, stretchlen=None,\noutline=None)\n-- Function: turtle.turtlesize (stretchwid=None, stretchlen=None,\noutline=None)\n\n\nParameters:\n\n* 'stretchwid' - positive number\n\n* 'stretchlen' - positive number\n\n* 'outline' - positive number\n\nReturn or set the pen's attributes x/y-stretchfactors and/or\noutline.  Set resizemode to \"user\".  If and only if resizemode is\nset to \"user\", the turtle will be displayed stretched according to\nits stretchfactors: 'stretchwid' is stretchfactor perpendicular to\nits orientation, 'stretchlen' is stretchfactor in direction of its\norientation, 'outline' determines the width of the shape's outline.\n\n>>> turtle.shapesize()\n(1.0, 1.0, 1)\n>>> turtle.resizemode(\"user\")\n>>> turtle.shapesize(5, 5, 12)\n>>> turtle.shapesize()\n(5, 5, 12)\n>>> turtle.shapesize(outline=8)\n>>> turtle.shapesize()\n(5, 5, 8)\n\n-- Function: turtle.shearfactor (shear=None)\n\n\nParameters: 'shear' - number (optional)\n\nSet or return the current shearfactor.  Shear the turtleshape\naccording to the given shearfactor shear, which is the tangent of\nthe shear angle.  Do 'not' change the turtle's heading (direction\nof movement).  If shear is not given: return the current\nshearfactor, i.  e.  the tangent of the shear angle, by which lines\nparallel to the heading of the turtle are sheared.\n\n>>> turtle.shape(\"circle\")\n>>> turtle.shapesize(5,2)\n>>> turtle.shearfactor(0.5)\n>>> turtle.shearfactor()\n0.5\n\n-- Function: turtle.tilt (angle)\n\n\nParameters: 'angle' - a number\n\nRotate the turtleshape by 'angle' from its current tilt-angle, but\ndo 'not' change the turtle's heading (direction of movement).\n\n>>> turtle.reset()\n>>> turtle.shape(\"circle\")\n>>> turtle.shapesize(5,2)\n>>> turtle.tilt(30)\n>>> turtle.fd(50)\n>>> turtle.tilt(30)\n>>> turtle.fd(50)\n\n-- Function: turtle.settiltangle (angle)\n\n\nParameters: 'angle' - a number\n\nRotate the turtleshape to point in the direction specified by\n'angle', regardless of its current tilt-angle.  'Do not' change the\nturtle's heading (direction of movement).\n\n>>> turtle.reset()\n>>> turtle.shape(\"circle\")\n>>> turtle.shapesize(5,2)\n>>> turtle.settiltangle(45)\n>>> turtle.fd(50)\n>>> turtle.settiltangle(-45)\n>>> turtle.fd(50)\n\nDeprecated since version 3.1.\n\n-- Function: turtle.tiltangle (angle=None)\n\n\nParameters: 'angle' - a number (optional)\n\nSet or return the current tilt-angle.  If angle is given, rotate\nthe turtleshape to point in the direction specified by angle,\nregardless of its current tilt-angle.  Do 'not' change the turtle's\nheading (direction of movement).  If angle is not given: return the\ncurrent tilt-angle, i.  e.  the angle between the orientation of\nthe turtleshape and the heading of the turtle (its direction of\nmovement).\n\n>>> turtle.reset()\n>>> turtle.shape(\"circle\")\n>>> turtle.shapesize(5,2)\n>>> turtle.tilt(45)\n>>> turtle.tiltangle()\n45.0\n\n-- Function: turtle.shapetransform (t11=None, t12=None, t21=None,\nt22=None)\n\n\nParameters:\n\n* 't11' - a number (optional)\n\n* 't12' - a number (optional)\n\n* 't21' - a number (optional)\n\n* 't12' - a number (optional)\n\nSet or return the current transformation matrix of the turtle\nshape.\n\nIf none of the matrix elements are given, return the transformation\nmatrix as a tuple of 4 elements.  Otherwise set the given elements\nand transform the turtleshape according to the matrix consisting of\nfirst row t11, t12 and second row t21, t22.  The determinant t11 *\nt22 - t12 * t21 must not be zero, otherwise an error is raised.\nModify stretchfactor, shearfactor and tiltangle according to the\ngiven matrix.\n\n>>> turtle = Turtle()\n>>> turtle.shape(\"square\")\n>>> turtle.shapesize(4,2)\n>>> turtle.shearfactor(-0.5)\n>>> turtle.shapetransform()\n(4.0, -1.0, -0.0, 2.0)\n\n-- Function: turtle.getshapepoly ()\n\nReturn the current shape polygon as tuple of coordinate pairs.\nThis can be used to define a new shape or components of a compound\nshape.\n\n>>> turtle.shape(\"square\")\n>>> turtle.shapetransform(4, -1, 0, 2)\n>>> turtle.getshapepoly()\n((50, -20), (30, 20), (-50, 20), (-30, -20))\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using events,  Next: Special Turtle methods,  Prev: Turtle state,  Up: Methods of RawTurtle/Turtle and corresponding functions": {
            "content": "5.24.1.28 Using events\n......................\n\n-- Function: turtle.onclick (fun, btn=1, add=None)\n\n\nParameters:\n\n* 'fun' - a function with two arguments which will be called\nwith the coordinates of the clicked point on the canvas\n\n* 'btn' - number of the mouse-button, defaults to 1 (left mouse\nbutton)\n\n* 'add' - 'True' or 'False' - if 'True', a new binding will be\nadded, otherwise it will replace a former binding\n\nBind 'fun' to mouse-click events on this turtle.  If 'fun' is\n'None', existing bindings are removed.  Example for the anonymous\nturtle, i.e.  the procedural way:\n\n>>> def turn(x, y):\n...     left(180)\n...\n>>> onclick(turn)  # Now clicking into the turtle will turn it.\n>>> onclick(None)  # event-binding will be removed\n\n-- Function: turtle.onrelease (fun, btn=1, add=None)\n\n\nParameters:\n\n* 'fun' - a function with two arguments which will be called\nwith the coordinates of the clicked point on the canvas\n\n* 'btn' - number of the mouse-button, defaults to 1 (left mouse\nbutton)\n\n* 'add' - 'True' or 'False' - if 'True', a new binding will be\nadded, otherwise it will replace a former binding\n\nBind 'fun' to mouse-button-release events on this turtle.  If 'fun'\nis 'None', existing bindings are removed.\n\n>>> class MyTurtle(Turtle):\n...     def glow(self,x,y):\n...         self.fillcolor(\"red\")\n...     def unglow(self,x,y):\n...         self.fillcolor(\"\")\n...\n>>> turtle = MyTurtle()\n>>> turtle.onclick(turtle.glow)     # clicking on turtle turns fillcolor red,\n>>> turtle.onrelease(turtle.unglow) # releasing turns it to transparent.\n\n-- Function: turtle.ondrag (fun, btn=1, add=None)\n\n\nParameters:\n\n* 'fun' - a function with two arguments which will be called\nwith the coordinates of the clicked point on the canvas\n\n* 'btn' - number of the mouse-button, defaults to 1 (left mouse\nbutton)\n\n* 'add' - 'True' or 'False' - if 'True', a new binding will be\nadded, otherwise it will replace a former binding\n\nBind 'fun' to mouse-move events on this turtle.  If 'fun' is\n'None', existing bindings are removed.\n\nRemark: Every sequence of mouse-move-events on a turtle is preceded\nby a mouse-click event on that turtle.\n\n>>> turtle.ondrag(turtle.goto)\n\nSubsequently, clicking and dragging the Turtle will move it across\nthe screen thereby producing handdrawings (if pen is down).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Special Turtle methods,  Next: Compound shapes,  Prev: Using events,  Up: Methods of RawTurtle/Turtle and corresponding functions": {
            "content": "5.24.1.29 Special Turtle methods\n................................\n\n-- Function: turtle.beginpoly ()\n\nStart recording the vertices of a polygon.  Current turtle position\nis first vertex of polygon.\n\n-- Function: turtle.endpoly ()\n\nStop recording the vertices of a polygon.  Current turtle position\nis last vertex of polygon.  This will be connected with the first\nvertex.\n\n-- Function: turtle.getpoly ()\n\nReturn the last recorded polygon.\n\n>>> turtle.home()\n>>> turtle.beginpoly()\n>>> turtle.fd(100)\n>>> turtle.left(20)\n>>> turtle.fd(30)\n>>> turtle.left(60)\n>>> turtle.fd(50)\n>>> turtle.endpoly()\n>>> p = turtle.getpoly()\n>>> registershape(\"myFavouriteShape\", p)\n\n-- Function: turtle.clone ()\n\nCreate and return a clone of the turtle with same position, heading\nand turtle properties.\n\n>>> mick = Turtle()\n>>> joe = mick.clone()\n\n-- Function: turtle.getturtle ()\n-- Function: turtle.getpen ()\n\nReturn the Turtle object itself.  Only reasonable use: as a\nfunction to return the \"anonymous turtle\":\n\n>>> pet = getturtle()\n>>> pet.fd(50)\n>>> pet\n<turtle.Turtle object at 0x...>\n\n-- Function: turtle.getscreen ()\n\nReturn the *note TurtleScreen: 3a2a. object the turtle is drawing\non.  TurtleScreen methods can then be called for that object.\n\n>>> ts = turtle.getscreen()\n>>> ts\n<turtle.Screen object at 0x...>\n>>> ts.bgcolor(\"pink\")\n\n-- Function: turtle.setundobuffer (size)\n\n\nParameters: 'size' - an integer or 'None'\n\nSet or disable undobuffer.  If 'size' is an integer, an empty\nundobuffer of given size is installed.  'size' gives the maximum\nnumber of turtle actions that can be undone by the *note undo():\n39c5. method/function.  If 'size' is 'None', the undobuffer is\ndisabled.\n\n>>> turtle.setundobuffer(42)\n\n-- Function: turtle.undobufferentries ()\n\nReturn number of entries in the undobuffer.\n\n>>> while undobufferentries():\n...     undo()\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Compound shapes,  Prev: Special Turtle methods,  Up: Methods of RawTurtle/Turtle and corresponding functions": {
            "content": "5.24.1.30 Compound shapes\n.........................\n",
            "subsections": []
        },
        "To use compound turtle shapes, which consist of several polygons of": {
            "content": "different color, you must use the helper class *note Shape: 3a2d.\nexplicitly as described below:\n\n1. Create an empty Shape object of type \"compound\".\n\n2. Add as many components to this object as desired, using the *note\naddcomponent(): 3a2e. method.\n\nFor example:\n\n>>> s = Shape(\"compound\")\n>>> poly1 = ((0,0),(10,-5),(0,10),(-10,-5))\n>>> s.addcomponent(poly1, \"red\", \"blue\")\n>>> poly2 = ((0,0),(10,-5),(-10,-5))\n>>> s.addcomponent(poly2, \"blue\", \"red\")\n\n3. Now add the Shape to the Screen's shapelist and use it:\n\n>>> registershape(\"myshape\", s)\n>>> shape(\"myshape\")\n\nNote: The *note Shape: 3a2d. class is used internally by the *note\nregistershape(): 3a12. method in different ways.  The application\nprogrammer has to deal with the Shape class 'only' when using\ncompound shapes like shown above!\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Methods of TurtleScreen/Screen and corresponding functions,  Next: Public classes,  Prev: Methods of RawTurtle/Turtle and corresponding functions,  Up: turtle -- Turtle graphics": {
            "content": "5.24.1.31 Methods of TurtleScreen/Screen and corresponding functions\n....................................................................\n",
            "subsections": []
        },
        "Most of the examples in this section refer to a TurtleScreen instance": {
            "content": "called 'screen'.\n\n* Menu:\n\n* Window control::\n* Animation control::\n* Using screen events::\n* Input methods::\n* Settings and special methods::\n* Methods specific to Screen, not inherited from TurtleScreen: Methods specific to Screen not inherited from TurtleScreen.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Window control,  Next: Animation control,  Up: Methods of TurtleScreen/Screen and corresponding functions": {
            "content": "5.24.1.32 Window control\n........................\n\n-- Function: turtle.bgcolor (*args)\n\n\nParameters: 'args' - a color string or three numbers in the range\n0..colormode or a 3-tuple of such numbers\n\nSet or return background color of the TurtleScreen.\n\n>>> screen.bgcolor(\"orange\")\n>>> screen.bgcolor()\n'orange'\n>>> screen.bgcolor(\"#800080\")\n>>> screen.bgcolor()\n(128.0, 0.0, 128.0)\n\n-- Function: turtle.bgpic (picname=None)\n\n\nParameters: 'picname' - a string, name of a gif-file or '\"nopic\"',\nor 'None'\n\nSet background image or return name of current backgroundimage.  If\n'picname' is a filename, set the corresponding image as background.\nIf 'picname' is '\"nopic\"', delete background image, if present.  If\n'picname' is 'None', return the filename of the current\nbackgroundimage.\n\n>>> screen.bgpic()\n'nopic'\n>>> screen.bgpic(\"landscape.gif\")\n>>> screen.bgpic()\n\"landscape.gif\"\n\n-- Function: turtle.clear ()\n\nNote: This TurtleScreen method is available as a global\nfunction only under the name 'clearscreen'.  The global\nfunction 'clear' is a different one derived from the Turtle\nmethod 'clear'.\n\n-- Function: turtle.clearscreen ()\n\nDelete all drawings and all turtles from the TurtleScreen.  Reset\nthe now empty TurtleScreen to its initial state: white background,\nno background image, no event bindings and tracing on.\n\n-- Function: turtle.reset ()\n\nNote: This TurtleScreen method is available as a global\nfunction only under the name 'resetscreen'.  The global\nfunction 'reset' is another one derived from the Turtle method\n'reset'.\n\n-- Function: turtle.resetscreen ()\n\nReset all Turtles on the Screen to their initial state.\n\n-- Function: turtle.screensize (canvwidth=None, canvheight=None,\nbg=None)\n\n\nParameters:\n\n* 'canvwidth' - positive integer, new width of canvas in pixels\n\n* 'canvheight' - positive integer, new height of canvas in\npixels\n\n* 'bg' - colorstring or color-tuple, new background color\n\nIf no arguments are given, return current (canvaswidth,\ncanvasheight).  Else resize the canvas the turtles are drawing on.\nDo not alter the drawing window.  To observe hidden parts of the\ncanvas, use the scrollbars.  With this method, one can make visible\nthose parts of a drawing which were outside the canvas before.\n\n>>> screen.screensize()\n(400, 300)\n>>> screen.screensize(2000,1500)\n>>> screen.screensize()\n(2000, 1500)\n\ne.g.  to search for an erroneously escaped turtle ;-)\n\n-- Function: turtle.setworldcoordinates (llx, lly, urx, ury)\n\n\nParameters:\n\n* 'llx' - a number, x-coordinate of lower left corner of canvas\n\n* 'lly' - a number, y-coordinate of lower left corner of canvas\n\n* 'urx' - a number, x-coordinate of upper right corner of canvas\n\n* 'ury' - a number, y-coordinate of upper right corner of canvas\n\nSet up user-defined coordinate system and switch to mode \"world\" if\nnecessary.  This performs a 'screen.reset()'.  If mode \"world\" is\nalready active, all drawings are redrawn according to the new\ncoordinates.\n\n'ATTENTION': in user-defined coordinate systems angles may appear\ndistorted.\n\n>>> screen.reset()\n>>> screen.setworldcoordinates(-50,-7.5,50,7.5)\n>>> for  in range(72):\n...     left(10)\n...\n>>> for  in range(8):\n...     left(45); fd(2)   # a regular octagon\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Animation control,  Next: Using screen events,  Prev: Window control,  Up: Methods of TurtleScreen/Screen and corresponding functions": {
            "content": "5.24.1.33 Animation control\n...........................\n\n-- Function: turtle.delay (delay=None)\n\n\nParameters: 'delay' - positive integer\n\nSet or return the drawing 'delay' in milliseconds.  (This is\napproximately the time interval between two consecutive canvas\nupdates.)  The longer the drawing delay, the slower the animation.\n\nOptional argument:\n\n>>> screen.delay()\n10\n>>> screen.delay(5)\n>>> screen.delay()\n5\n\n-- Function: turtle.tracer (n=None, delay=None)\n\n\nParameters:\n\n* 'n' - nonnegative integer\n\n* 'delay' - nonnegative integer\n\nTurn turtle animation on/off and set delay for update drawings.  If\n'n' is given, only each n-th regular screen update is really\nperformed.  (Can be used to accelerate the drawing of complex\ngraphics.)  When called without arguments, returns the currently\nstored value of n.  Second argument sets delay value (see *note\ndelay(): 3a03.).\n\n>>> screen.tracer(8, 25)\n>>> dist = 2\n>>> for i in range(200):\n...     fd(dist)\n...     rt(90)\n...     dist += 2\n\n-- Function: turtle.update ()\n\nPerform a TurtleScreen update.  To be used when tracer is turned\noff.\n\nSee also the RawTurtle/Turtle method *note speed(): 39c6.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using screen events,  Next: Input methods,  Prev: Animation control,  Up: Methods of TurtleScreen/Screen and corresponding functions": {
            "content": "5.24.1.34 Using screen events\n.............................\n\n-- Function: turtle.listen (xdummy=None, ydummy=None)\n\nSet focus on TurtleScreen (in order to collect key-events).  Dummy\narguments are provided in order to be able to pass *note listen():\n3a06. to the onclick method.\n\n-- Function: turtle.onkey (fun, key)\n-- Function: turtle.onkeyrelease (fun, key)\n\n\nParameters:\n\n* 'fun' - a function with no arguments or 'None'\n\n* 'key' - a string: key (e.g.  \"a\") or key-symbol (e.g.\n\"space\")\n\nBind 'fun' to key-release event of key.  If 'fun' is 'None', event\nbindings are removed.  Remark: in order to be able to register\nkey-events, TurtleScreen must have the focus.  (See method *note\nlisten(): 3a06.)\n\n>>> def f():\n...     fd(50)\n...     lt(60)\n...\n>>> screen.onkey(f, \"Up\")\n>>> screen.listen()\n\n-- Function: turtle.onkeypress (fun, key=None)\n\n\nParameters:\n\n* 'fun' - a function with no arguments or 'None'\n\n* 'key' - a string: key (e.g.  \"a\") or key-symbol (e.g.\n\"space\")\n\nBind 'fun' to key-press event of key if key is given, or to any\nkey-press-event if no key is given.  Remark: in order to be able to\nregister key-events, TurtleScreen must have focus.  (See method\n*note listen(): 3a06.)\n\n>>> def f():\n...     fd(50)\n...\n>>> screen.onkey(f, \"Up\")\n>>> screen.listen()\n\n-- Function: turtle.onclick (fun, btn=1, add=None)\n-- Function: turtle.onscreenclick (fun, btn=1, add=None)\n\n\nParameters:\n\n* 'fun' - a function with two arguments which will be called\nwith the coordinates of the clicked point on the canvas\n\n* 'btn' - number of the mouse-button, defaults to 1 (left mouse\nbutton)\n\n* 'add' - 'True' or 'False' - if 'True', a new binding will be\nadded, otherwise it will replace a former binding\n\nBind 'fun' to mouse-click events on this screen.  If 'fun' is\n'None', existing bindings are removed.\n\nExample for a TurtleScreen instance named 'screen' and a Turtle\ninstance named 'turtle':\n\n>>> screen.onclick(turtle.goto) # Subsequently clicking into the TurtleScreen will\n>>>                             # make the turtle move to the clicked point.\n>>> screen.onclick(None)        # remove event binding again\n\nNote: This TurtleScreen method is available as a global\nfunction only under the name 'onscreenclick'.  The global\nfunction 'onclick' is another one derived from the Turtle\nmethod 'onclick'.\n\n-- Function: turtle.ontimer (fun, t=0)\n\n\nParameters:\n\n* 'fun' - a function with no arguments\n\n* 't' - a number >= 0\n\nInstall a timer that calls 'fun' after 't' milliseconds.\n\n>>> running = True\n>>> def f():\n...     if running:\n...         fd(50)\n...         lt(60)\n...         screen.ontimer(f, 250)\n>>> f()   ### makes the turtle march around\n>>> running = False\n\n-- Function: turtle.mainloop ()\n-- Function: turtle.done ()\n\nStarts event loop - calling Tkinter's mainloop function.  Must be\nthe last statement in a turtle graphics program.  Must 'not' be\nused if a script is run from within IDLE in -n mode (No subprocess)\n- for interactive use of turtle graphics.\n\n>>> screen.mainloop()\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Input methods,  Next: Settings and special methods,  Prev: Using screen events,  Up: Methods of TurtleScreen/Screen and corresponding functions": {
            "content": "5.24.1.35 Input methods\n.......................\n\n-- Function: turtle.textinput (title, prompt)\n\n\nParameters:\n\n* 'title' - string\n\n* 'prompt' - string\n\nPop up a dialog window for input of a string.  Parameter title is\nthe title of the dialog window, prompt is a text mostly describing\nwhat information to input.  Return the string input.  If the dialog\nis canceled, return 'None'.\n\n>>> screen.textinput(\"NIM\", \"Name of first player:\")\n\n-- Function: turtle.numinput (title, prompt, default=None, minval=None,\nmaxval=None)\n\n\nParameters:\n\n* 'title' - string\n\n* 'prompt' - string\n\n* 'default' - number (optional)\n\n* 'minval' - number (optional)\n\n* 'maxval' - number (optional)\n\nPop up a dialog window for input of a number.  title is the title\nof the dialog window, prompt is a text mostly describing what\nnumerical information to input.  default: default value, minval:\nminimum value for input, maxval: maximum value for input.  The\nnumber input must be in the range minval ..  maxval if these are\ngiven.  If not, a hint is issued and the dialog remains open for\ncorrection.  Return the number input.  If the dialog is canceled,\nreturn 'None'.\n\n>>> screen.numinput(\"Poker\", \"Your stakes:\", 1000, minval=10, maxval=10000)\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "5.24.1.36 Settings and special methods\n......................................\n\n-- Function: turtle.mode (mode=None)\n\n\nParameters: 'mode' - one of the strings \"standard\", \"logo\" or\n\"world\"\n\nSet turtle mode (\"standard\", \"logo\" or \"world\") and perform reset.\nIf mode is not given, current mode is returned.\n\nMode \"standard\" is compatible with old *note turtle: fc.  Mode\n\"logo\" is compatible with most Logo turtle graphics.  Mode \"world\"\nuses user-defined \"world coordinates\".  'Attention': in this mode\nangles appear distorted if 'x/y' unit-ratio doesn't equal 1.\n\nMode             Initial turtle heading        positive angles\n\n-----------------------------------------------------------------------\n\n\"standard\"       to the right (east)           counterclockwise\n\n\n\"logo\"           upward (north)                clockwise\n\n\n>>> mode(\"logo\")   # resets turtle heading to north\n>>> mode()\n'logo'\n\n-- Function: turtle.colormode (cmode=None)\n\n\nParameters: 'cmode' - one of the values 1.0 or 255\n\nReturn the colormode or set it to 1.0 or 255.  Subsequently 'r',\n'g', 'b' values of color triples have to be in the range\n0..*cmode*.\n\n>>> screen.colormode(1)\n>>> turtle.pencolor(240, 160, 80)\nTraceback (most recent call last):\n...\nTurtleGraphicsError: bad color sequence: (240, 160, 80)\n>>> screen.colormode()\n1.0\n>>> screen.colormode(255)\n>>> screen.colormode()\n255\n>>> turtle.pencolor(240,160,80)\n\n-- Function: turtle.getcanvas ()\n\nReturn the Canvas of this TurtleScreen.  Useful for insiders who\nknow what to do with a Tkinter Canvas.\n\n>>> cv = screen.getcanvas()\n>>> cv\n<turtle.ScrolledCanvas object ...>\n\n-- Function: turtle.getshapes ()\n\nReturn a list of names of all currently available turtle shapes.\n\n>>> screen.getshapes()\n['arrow', 'blank', 'circle', ..., 'turtle']\n\n-- Function: turtle.registershape (name, shape=None)\n-- Function: turtle.addshape (name, shape=None)\n\nThere are three different ways to call this function:\n\n1. 'name' is the name of a gif-file and 'shape' is 'None':\nInstall the corresponding image shape.\n\n>>> screen.registershape(\"turtle.gif\")\n\nNote: Image shapes 'do not' rotate when turning the\nturtle, so they do not display the heading of the turtle!\n\n2. 'name' is an arbitrary string and 'shape' is a tuple of pairs\nof coordinates: Install the corresponding polygon shape.\n\n>>> screen.registershape(\"triangle\", ((5,-3), (0,5), (-5,-3)))\n\n3. 'name' is an arbitrary string and 'shape' is a (compound)\n*note Shape: 3a2d. object: Install the corresponding compound\nshape.\n\nAdd a turtle shape to TurtleScreen's shapelist.  Only thusly\nregistered shapes can be used by issuing the command\n'shape(shapename)'.\n\n-- Function: turtle.turtles ()\n\nReturn the list of turtles on the screen.\n\n>>> for turtle in screen.turtles():\n...     turtle.color(\"red\")\n\n-- Function: turtle.windowheight ()\n\nReturn the height of the turtle window.\n\n>>> screen.windowheight()\n480\n\n-- Function: turtle.windowwidth ()\n\nReturn the width of the turtle window.\n\n>>> screen.windowwidth()\n640\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Methods specific to Screen not inherited from TurtleScreen,  Prev: Settings and special methods,  Up: Methods of TurtleScreen/Screen and corresponding functions": {
            "content": "5.24.1.37 Methods specific to Screen, not inherited from TurtleScreen\n.....................................................................\n\n-- Function: turtle.bye ()\n\nShut the turtlegraphics window.\n\n-- Function: turtle.exitonclick ()\n\nBind 'bye()' method to mouse clicks on the Screen.\n\nIf the value \"usingIDLE\" in the configuration dictionary is\n'False' (default value), also enter mainloop.  Remark: If IDLE with\nthe '-n' switch (no subprocess) is used, this value should be set\nto 'True' in 'turtle.cfg'.  In this case IDLE's own mainloop is\nactive also for the client script.\n\n-- Function: turtle.setup (width=CFG['width'], height=CFG['height'],\nstartx=CFG['leftright'], starty=CFG['topbottom'])\n\nSet the size and position of the main window.  Default values of\narguments are stored in the configuration dictionary and can be\nchanged via a 'turtle.cfg' file.\n\n\nParameters:\n\n* 'width' - if an integer, a size in pixels, if a float, a\nfraction of the screen; default is 50% of screen\n\n* 'height' - if an integer, the height in pixels, if a float, a\nfraction of the screen; default is 75% of screen\n\n* 'startx' - if positive, starting position in pixels from the\nleft edge of the screen, if negative from the right edge, if\n'None', center window horizontally\n\n* 'starty' - if positive, starting position in pixels from the\ntop edge of the screen, if negative from the bottom edge, if\n'None', center window vertically\n\n>>> screen.setup (width=200, height=200, startx=0, starty=0)\n>>>              # sets window to 200x200 pixels, in upper left of screen\n>>> screen.setup(width=.75, height=0.5, startx=None, starty=None)\n>>>              # sets window to 75% of screen by 50% of screen and centers\n\n-- Function: turtle.title (titlestring)\n\n\nParameters: 'titlestring' - a string that is shown in the titlebar\nof the turtle graphics window\n\nSet title of turtle window to 'titlestring'.\n\n>>> screen.title(\"Welcome to the turtle zoo!\")\n\nFile: python3.12.info,  Node: Public classes,  Next: Explanation<2>,  Prev: Methods of TurtleScreen/Screen and corresponding functions,  Up: turtle -- Turtle graphics\n\n5.24.1.38 Public classes\n........................\n\n-- Class: turtle.RawTurtle (canvas)\n-- Class: turtle.RawPen (canvas)\n\n\nParameters: 'canvas' - a 'tkinter.Canvas', a *note ScrolledCanvas:\n3a3a. or a *note TurtleScreen: 3a2a.\n\nCreate a turtle.  The turtle has all methods described above as\n\"methods of Turtle/RawTurtle\".\n\n-- Class: turtle.Turtle\n\nSubclass of RawTurtle, has the same interface but draws on a\ndefault *note Screen: 39ad. object created automatically when\nneeded for the first time.\n\n-- Class: turtle.TurtleScreen (cv)\n\n\nParameters: 'cv' - a 'tkinter.Canvas'\n\nProvides screen oriented methods like *note bgcolor(): 39fd. etc.\nthat are described above.\n\n-- Class: turtle.Screen\n\nSubclass of TurtleScreen, with *note four methods added: 3a36.\n\n-- Class: turtle.ScrolledCanvas (master)\n\n\nParameters: 'master' - some Tkinter widget to contain the\nScrolledCanvas, i.e.  a Tkinter-canvas with scrollbars added\n\nUsed by class Screen, which thus automatically provides a\nScrolledCanvas as playground for the turtles.\n\n-- Class: turtle.Shape (type, data)\n\n\nParameters: 'type' - one of the strings \"polygon\", \"image\",\n\"compound\"\n\nData structure modeling shapes.  The pair '(type, data)' must\nfollow this specification:\n\n'type'         'data'\n\n-------------------------------------------------------------------------------\n\n\"polygon\"       a polygon-tuple, i.e.  a tuple of pairs of coordinates\n\n\n\"image\"         an image (in this form only used internally!)\n\n\n\"compound\"      'None' (a compound shape has to be constructed using the\n*note addcomponent(): 3a2e. method)\n\n\n-- Method: addcomponent (poly, fill, outline=None)\n\n\nParameters:\n\n* 'poly' - a polygon, i.e.  a tuple of pairs of numbers\n\n* 'fill' - a color the 'poly' will be filled with\n\n* 'outline' - a color for the poly's outline (if given)\n\nExample:\n\n>>> poly = ((0,0),(10,-5),(0,10),(-10,-5))\n>>> s = Shape(\"compound\")\n>>> s.addcomponent(poly, \"red\", \"blue\")\n>>> # ... add more components and then use registershape()\n\nSee *note Compound shapes: 3a2c.\n\n-- Class: turtle.Vec2D (x, y)\n\nA two-dimensional vector class, used as a helper class for\nimplementing turtle graphics.  May be useful for turtle graphics\nprograms too.  Derived from tuple, so a vector is a tuple!\n\nProvides (for 'a', 'b' vectors, 'k' number):\n\n* 'a + b' vector addition\n\n* 'a - b' vector subtraction\n\n* 'a * b' inner product\n\n* 'k * a' and 'a * k' multiplication with scalar\n\n* 'abs(a)' absolute value of a\n\n* 'a.rotate(angle)' rotation\n\nFile: python3.12.info,  Node: Explanation<2>,  Next: Help and configuration,  Prev: Public classes,  Up: turtle -- Turtle graphics\n\n5.24.1.39 Explanation\n.....................\n\nA turtle object draws on a screen object, and there a number of key\nclasses in the turtle object-oriented interface that can be used to\ncreate them and relate them to each other.\n\nA *note Turtle: 3a3b. instance will automatically create a *note Screen:\n39ad. instance if one is not already present.\n\n'Turtle' is a subclass of *note RawTurtle: 3a38, which 'doesn't'\nautomatically create a drawing surface - a 'canvas' will need to be\nprovided or created for it.  The 'canvas' can be a 'tkinter.Canvas',\n*note ScrolledCanvas: 3a3a. or *note TurtleScreen: 3a2a.\n\n*note TurtleScreen: 3a2a. is the basic drawing surface for a turtle.\n*note Screen: 39ad. is a subclass of 'TurtleScreen', and includes *note\nsome additional methods: 3a36. for managing its appearance (including\nsize and title) and behaviour.  'TurtleScreen''s constructor needs a\n'tkinter.Canvas' or a *note ScrolledCanvas: 3a3a. as an argument.\n",
            "subsections": []
        },
        "The functional interface for turtle graphics uses the various methods of": {
            "content": "'Turtle' and 'TurtleScreen'/'Screen'.  Behind the scenes, a screen\nobject is automatically created whenever a function derived from a\n'Screen' method is called.  Similarly, a turtle object is automatically\ncreated whenever any of the functions derived from a Turtle method is\ncalled.\n",
            "subsections": []
        },
        "To use multiple turtles on a screen, the object-oriented interface must": {
            "content": "be used.\n\nFile: python3.12.info,  Node: Help and configuration,  Next: turtledemo -- Demo scripts,  Prev: Explanation<2>,  Up: turtle -- Turtle graphics\n\n5.24.1.40 Help and configuration\n................................\n\n* Menu:\n\n* How to use help::\n* Translation of docstrings into different languages::\n* How to configure Screen and Turtles::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: How to use help,  Next: Translation of docstrings into different languages,  Up: Help and configuration": {
            "content": "5.24.1.41 How to use help\n.........................\n",
            "subsections": []
        },
        "The public methods of the Screen and Turtle classes are documented": {
            "content": "extensively via docstrings.  So these can be used as online-help via the\nPython help facilities:\n\n- When using IDLE, tooltips show the signatures and first lines of\nthe docstrings of typed in function-/method calls.\n\n- Calling *note help(): 6f0. on methods or functions displays the\ndocstrings:\n\n>>> help(Screen.bgcolor)\nHelp on method bgcolor in module turtle:\n\nbgcolor(self, *args) unbound turtle.Screen method\nSet or return backgroundcolor of the TurtleScreen.\n\nArguments (if given): a color string or three numbers\nin the range 0..colormode or a 3-tuple of such numbers.\n\n\n>>> screen.bgcolor(\"orange\")\n>>> screen.bgcolor()\n\"orange\"\n>>> screen.bgcolor(0.5,0,0.5)\n>>> screen.bgcolor()\n\"#800080\"\n\n>>> help(Turtle.penup)\nHelp on method penup in module turtle:\n\npenup(self) unbound turtle.Turtle method\nPull the pen up -- no drawing when moving.\n\nAliases: penup | pu | up\n\nNo argument\n\n>>> turtle.penup()\n\n- The docstrings of the functions which are derived from methods have\na modified form:\n\n>>> help(bgcolor)\nHelp on function bgcolor in module turtle:\n\nbgcolor(*args)\nSet or return backgroundcolor of the TurtleScreen.\n\nArguments (if given): a color string or three numbers\nin the range 0..colormode or a 3-tuple of such numbers.\n\nExample::\n\n>>> bgcolor(\"orange\")\n>>> bgcolor()\n\"orange\"\n>>> bgcolor(0.5,0,0.5)\n>>> bgcolor()\n\"#800080\"\n\n>>> help(penup)\nHelp on function penup in module turtle:\n\npenup()\nPull the pen up -- no drawing when moving.\n\nAliases: penup | pu | up\n\nNo argument\n\nExample:\n>>> penup()\n",
            "subsections": []
        },
        "These modified docstrings are created automatically together with the": {
            "content": "function definitions that are derived from the methods at import time.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Translation of docstrings into different languages,  Next: How to configure Screen and Turtles,  Prev: How to use help,  Up: Help and configuration": {
            "content": "5.24.1.42 Translation of docstrings into different languages\n............................................................\n",
            "subsections": []
        },
        "There is a utility to create a dictionary the keys of which are the": {
            "content": "method names and the values of which are the docstrings of the public\nmethods of the classes Screen and Turtle.\n\n-- Function: turtle.writedocstringdict\n(filename='turtledocstringdict')\n\n\nParameters: 'filename' - a string, used as filename\n\nCreate and write docstring-dictionary to a Python script with the\ngiven filename.  This function has to be called explicitly (it is\nnot used by the turtle graphics classes).  The docstring dictionary\nwill be written to the Python script '`filename'.py'.  It is\nintended to serve as a template for translation of the docstrings\ninto different languages.\n\nIf you (or your students) want to use *note turtle: fc. with online help\nin your native language, you have to translate the docstrings and save\nthe resulting file as e.g.  'turtledocstringdictgerman.py'.\n",
            "subsections": []
        },
        "If you have an appropriate entry in your 'turtle.cfg' file this": {
            "content": "dictionary will be read in at import time and will replace the original\nEnglish docstrings.\n",
            "subsections": []
        },
        "At the time of this writing there are docstring dictionaries in German": {
            "content": "and in Italian.  (Requests please to <glingl@aon.at>.)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: How to configure Screen and Turtles,  Prev: Translation of docstrings into different languages,  Up: Help and configuration": {
            "content": "5.24.1.43 How to configure Screen and Turtles\n.............................................\n",
            "subsections": []
        },
        "The built-in default configuration mimics the appearance and behaviour": {
            "content": "of the old turtle module in order to retain best possible compatibility\nwith it.\n",
            "subsections": []
        },
        "If you want to use a different configuration which better reflects the": {
            "content": "features of this module or which better fits to your needs, e.g.  for\nuse in a classroom, you can prepare a configuration file 'turtle.cfg'\nwhich will be read at import time and modify the configuration according\nto its settings.\n",
            "subsections": []
        },
        "The built in configuration would correspond to the following": {
            "content": "'turtle.cfg':\n\nwidth = 0.5\nheight = 0.75\nleftright = None\ntopbottom = None\ncanvwidth = 400\ncanvheight = 300\nmode = standard\ncolormode = 1.0\ndelay = 10\nundobuffersize = 1000\nshape = classic\npencolor = black\nfillcolor = black\nresizemode = noresize\nvisible = True\nlanguage = english\nexampleturtle = turtle\nexamplescreen = screen\ntitle = Python Turtle Graphics\nusingIDLE = False\n\nShort explanation of selected entries:\n\n- The first four lines correspond to the arguments of the *note\nScreen.setup: 3a19. method.\n\n- Line 5 and 6 correspond to the arguments of the method *note\nScreen.screensize: 3a01.\n\n- 'shape' can be any of the built-in shapes, e.g: arrow, turtle, etc.\nFor more info try 'help(shape)'.\n\n- If you want to use no fill color (i.e.  make the turtle\ntransparent), you have to write 'fillcolor = \"\"' (but all nonempty\nstrings must not have quotes in the cfg file).\n\n- If you want to reflect the turtle its state, you have to use\n'resizemode = auto'.\n\n- If you set e.g.  'language = italian' the docstringdict\n'turtledocstringdictitalian.py' will be loaded at import time (if\npresent on the import path, e.g.  in the same directory as *note\nturtle: fc.).\n\n- The entries 'exampleturtle' and 'examplescreen' define the names of\nthese objects as they occur in the docstrings.  The transformation\nof method-docstrings to function-docstrings will delete these names\nfrom the docstrings.\n\n- 'usingIDLE': Set this to 'True' if you regularly work with IDLE\nand its '-n' switch (\"no subprocess\").  This will prevent *note\nexitonclick(): 3a18. to enter the mainloop.\n\nThere can be a 'turtle.cfg' file in the directory where *note turtle:\nfc. is stored and an additional one in the current working directory.\nThe latter will override the settings of the first one.\n",
            "subsections": []
        },
        "The 'Lib/turtledemo' directory contains a 'turtle.cfg' file.  You can": {
            "content": "study it as an example and see its effects when running the demos\n(preferably not from within the demo-viewer).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: turtledemo -- Demo scripts,  Next: Changes since Python 2 6,  Prev: Help and configuration,  Up: turtle -- Turtle graphics": {
            "content": "5.24.1.44 'turtledemo' -- Demo scripts\n.....................................\n\nThe *note turtledemo: fd. package includes a set of demo scripts.  These\nscripts can be run and viewed using the supplied demo viewer as follows:\n\npython -m turtledemo\n",
            "subsections": []
        },
        "Alternatively, you can run the demo scripts individually.  For example,": {
            "content": "python -m turtledemo.bytedesign\n\nThe *note turtledemo: fd. package directory contains:\n\n- A demo viewer 'main.py' which can be used to view the\nsourcecode of the scripts and run them at the same time.\n\n- Multiple scripts demonstrating different features of the *note\nturtle: fc. module.  Examples can be accessed via the Examples\nmenu.  They can also be run standalone.\n\n- A 'turtle.cfg' file which serves as an example of how to write and\nuse such files.\n\nThe demo scripts are:\n",
            "subsections": []
        },
        "Name                 Description                        Features": {
            "content": "------------------------------------------------------------------------------------\n\nbytedesign           complex classical turtle           *note tracer(): 3a04,\ngraphics pattern                   delay,\n*note update(): 3a05.\n\n\nchaos                graphs Verhulst dynamics, shows    world coordinates\nthat computer's computations can\ngenerate results sometimes\nagainst the common sense\nexpectations\n\n\nclock                analog clock showing time of       turtles as clock's hands,\nyour computer                      ontimer\n\n\ncolormixer           experiment with r, g, b            *note ondrag(): 39f2.\n\n\nforest               3 breadth-first trees              randomization\n\n\nfractalcurves        Hilbert & Koch curves              recursion\n\n\nlindenmayer          ethnomathematics (indian kolams)   L-System\n\n\nminimalhanoi        Towers of Hanoi                    Rectangular Turtles as\nHanoi discs (shape,\nshapesize)\n\n\nnim                  play the classical nim game with   turtles as nimsticks,\nthree heaps of sticks against      event driven (mouse,\nthe computer.                      keyboard)\n\n\npaint                super minimalistic drawing         *note onclick(): 39f0.\nprogram\n\n\npeace                elementary                         turtle: appearance and\nanimation\n\n\npenrose              aperiodic tiling with kites and    *note stamp(): 39c2.\ndarts\n\n\nplanetandmoon      simulation of gravitational        compound shapes,\nsystem                             *note Vec2D: 3a1d.\n\n\nrosette              a pattern from the wikipedia       *note clone(): 39f6,\narticle on turtle graphics         *note undo(): 39c5.\n\n\nrounddance          dancing turtles rotating           compound shapes, clone\npairwise in opposite direction     shapesize, tilt,\ngetshapepoly, update\n\n\nsortinganimate      visual demonstration of            simple alignment,\ndifferent sorting methods          randomization\n\n\ntree                 a (graphical) breadth first tree   *note clone(): 39f6.\n(using generators)\n\n\ntwocanvases         simple design                      turtles on two canvases\n\n\nyinyang              another elementary example         *note circle(): 39c0.\n\n\nHave fun!\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Changes since Python 2 6,  Next: Changes since Python 3 0,  Prev: turtledemo -- Demo scripts,  Up: turtle -- Turtle graphics": {
            "content": "5.24.1.45 Changes since Python 2.6\n..................................\n\n- The methods *note Turtle.tracer: 3a04, *note Turtle.windowwidth:\n3a16. and *note Turtle.windowheight: 3a15. have been eliminated.\nMethods with these names and functionality are now available only\nas methods of *note Screen: 39ad.  The functions derived from these\nremain available.  (In fact already in Python 2.6 these methods\nwere merely duplications of the corresponding *note TurtleScreen:\n3a2a./*note Screen: 39ad. methods.)\n\n- The method 'Turtle.fill()' has been eliminated.  The behaviour of\n*note beginfill(): 39de. and *note endfill(): 39df. have changed\nslightly: now every filling process must be completed with an\n'endfill()' call.\n\n- A method *note Turtle.filling: 39dd. has been added.  It returns a\nboolean value: 'True' if a filling process is under way, 'False'\notherwise.  This behaviour corresponds to a 'fill()' call without\narguments in Python 2.6.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Changes since Python 3 0,  Prev: Changes since Python 2 6,  Up: turtle -- Turtle graphics": {
            "content": "5.24.1.46 Changes since Python 3.0\n..................................\n\n- The *note Turtle: 3a3b. methods *note shearfactor(): 39ec, *note\nshapetransform(): 39ee. and *note getshapepoly(): 39ef. have been\nadded.  Thus the full range of regular linear transforms is now\navailable for transforming turtle shapes.  *note tiltangle(): 505.\nhas been enhanced in functionality: it now can be used to get or\nset the tilt angle.  *note settiltangle(): 504. has been\ndeprecated.\n\n- The *note Screen: 39ad. method *note onkeypress(): 3a09. has been\nadded as a complement to *note onkey(): 3a07.  As the latter binds\nactions to the key release event, an alias: *note onkeyrelease():\n3a08. was also added for it.\n\n- The method *note Screen.mainloop: 3a0c. has been added, so there is\nno longer a need to use the standalone *note mainloop(): 3a0c.\nfunction when working with *note Screen: 39ad. and *note Turtle:\n3a3b. objects.\n\n- Two input methods have been added: *note Screen.textinput: 1625.\nand *note Screen.numinput: 1626.  These pop up input dialogs and\nreturn strings and numbers respectively.\n\n- Two example scripts 'tdemonim.py' and 'tdemorounddance.py' have\nbeen added to the 'Lib/turtledemo' directory.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: cmd -- Support for line-oriented command interpreters,  Next: shlex -- Simple lexical analysis,  Prev: turtle -- Turtle graphics,  Up: Program Frameworks": {
            "content": "'Source code:' Lib/cmd.py(1)\n\n\n\nThe *note Cmd: 3a47. class provides a simple framework for writing\nline-oriented command interpreters.  These are often useful for test\nharnesses, administrative tools, and prototypes that will later be\nwrapped in a more sophisticated interface.\n\n-- Class: cmd.Cmd (completekey='tab', stdin=None, stdout=None)\n\nA *note Cmd: 3a47. instance or subclass instance is a line-oriented\ninterpreter framework.  There is no good reason to instantiate\n*note Cmd: 3a47. itself; rather, it's useful as a superclass of an\ninterpreter class you define yourself in order to inherit *note\nCmd: 3a47.'s methods and encapsulate action methods.\n\nThe optional argument 'completekey' is the *note readline: b5. name\nof a completion key; it defaults to 'Tab'.  If 'completekey' is not\n*note None: 43f. and *note readline: b5. is available, command\ncompletion is done automatically.\n\nThe optional arguments 'stdin' and 'stdout' specify the input and\noutput file objects that the Cmd instance or subclass instance will\nuse for input and output.  If not specified, they will default to\n*note sys.stdin: 293. and *note sys.stdout: 90c.\n\nIf you want a given 'stdin' to be used, make sure to set the\ninstance's *note userawinput: 3a48. attribute to 'False',\notherwise 'stdin' will be ignored.\n\n* Menu:\n\n* Cmd Objects::\n* Cmd Example::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/cmd.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Cmd Objects,  Next: Cmd Example,  Up: cmd -- Support for line-oriented command interpreters": {
            "content": "5.24.2.1 Cmd Objects\n....................\n\nA *note Cmd: 3a47. instance has the following methods:\n\n-- Method: Cmd.cmdloop (intro=None)\n\nRepeatedly issue a prompt, accept input, parse an initial prefix\noff the received input, and dispatch to action methods, passing\nthem the remainder of the line as argument.\n\nThe optional argument is a banner or intro string to be issued\nbefore the first prompt (this overrides the *note intro: 3a4c.\nclass attribute).\n\nIf the *note readline: b5. module is loaded, input will\nautomatically inherit 'bash'-like history-list editing (e.g.\n'Control-P' scrolls back to the last command, 'Control-N' forward\nto the next one, 'Control-F' moves the cursor to the right\nnon-destructively, 'Control-B' moves the cursor to the left\nnon-destructively, etc.).\n\nAn end-of-file on input is passed back as the string ''EOF''.\n\nAn interpreter instance will recognize a command name 'foo' if and\nonly if it has a method 'dofoo()'.  As a special case, a line\nbeginning with the character ''?'' is dispatched to the method\n*note dohelp(): 3a4d.  As another special case, a line beginning\nwith the character ''!'' is dispatched to the method 'doshell()'\n(if such a method is defined).\n\nThis method will return when the *note postcmd(): 3a4e. method\nreturns a true value.  The 'stop' argument to *note postcmd():\n3a4e. is the return value from the command's corresponding 'do*()'\nmethod.\n\nIf completion is enabled, completing commands will be done\nautomatically, and completing of commands args is done by calling\n'completefoo()' with arguments 'text', 'line', 'begidx', and\n'endidx'.  'text' is the string prefix we are attempting to match:\nall returned matches must begin with it.  'line' is the current\ninput line with leading whitespace removed, 'begidx' and 'endidx'\nare the beginning and ending indexes of the prefix text, which\ncould be used to provide different completion depending upon which\nposition the argument is in.\n\n-- Method: Cmd.dohelp (arg)\n\nAll subclasses of *note Cmd: 3a47. inherit a predefined\n'dohelp()'.  This method, called with an argument ''bar'', invokes\nthe corresponding method 'helpbar()', and if that is not present,\nprints the docstring of 'dobar()', if available.  With no\nargument, 'dohelp()' lists all available help topics (that is, all\ncommands with corresponding 'help*()' methods or commands that\nhave docstrings), and also lists any undocumented commands.\n\n-- Method: Cmd.onecmd (str)\n\nInterpret the argument as though it had been typed in response to\nthe prompt.  This may be overridden, but should not normally need\nto be; see the *note precmd(): 3a50. and *note postcmd(): 3a4e.\nmethods for useful execution hooks.  The return value is a flag\nindicating whether interpretation of commands by the interpreter\nshould stop.  If there is a 'do*()' method for the command 'str',\nthe return value of that method is returned, otherwise the return\nvalue from the *note default(): 3a51. method is returned.\n\n-- Method: Cmd.emptyline ()\n\nMethod called when an empty line is entered in response to the\nprompt.  If this method is not overridden, it repeats the last\nnonempty command entered.\n\n-- Method: Cmd.default (line)\n\nMethod called on an input line when the command prefix is not\nrecognized.  If this method is not overridden, it prints an error\nmessage and returns.\n\n-- Method: Cmd.completedefault (text, line, begidx, endidx)\n\nMethod called to complete an input line when no command-specific\n'complete*()' method is available.  By default, it returns an\nempty list.\n\n-- Method: Cmd.columnize (list, displaywidth=80)\n\nMethod called to display a list of strings as a compact set of\ncolumns.  Each column is only as wide as necessary.  Columns are\nseparated by two spaces for readability.\n\n-- Method: Cmd.precmd (line)\n\nHook method executed just before the command line 'line' is\ninterpreted, but after the input prompt is generated and issued.\nThis method is a stub in *note Cmd: 3a47.; it exists to be\noverridden by subclasses.  The return value is used as the command\nwhich will be executed by the *note onecmd(): 3a4f. method; the\n*note precmd(): 3a50. implementation may re-write the command or\nsimply return 'line' unchanged.\n\n-- Method: Cmd.postcmd (stop, line)\n\nHook method executed just after a command dispatch is finished.\nThis method is a stub in *note Cmd: 3a47.; it exists to be\noverridden by subclasses.  'line' is the command line which was\nexecuted, and 'stop' is a flag which indicates whether execution\nwill be terminated after the call to *note postcmd(): 3a4e.; this\nwill be the return value of the *note onecmd(): 3a4f. method.  The\nreturn value of this method will be used as the new value for the\ninternal flag which corresponds to 'stop'; returning false will\ncause interpretation to continue.\n\n-- Method: Cmd.preloop ()\n\nHook method executed once when *note cmdloop(): 3a4b. is called.\nThis method is a stub in *note Cmd: 3a47.; it exists to be\noverridden by subclasses.\n\n-- Method: Cmd.postloop ()\n\nHook method executed once when *note cmdloop(): 3a4b. is about to\nreturn.  This method is a stub in *note Cmd: 3a47.; it exists to be\noverridden by subclasses.\n\nInstances of *note Cmd: 3a47. subclasses have some public instance\nvariables:\n\n-- Attribute: Cmd.prompt\n\nThe prompt issued to solicit input.\n\n-- Attribute: Cmd.identchars\n\nThe string of characters accepted for the command prefix.\n\n-- Attribute: Cmd.lastcmd\n\nThe last nonempty command prefix seen.\n\n-- Attribute: Cmd.cmdqueue\n\nA list of queued input lines.  The cmdqueue list is checked in\n*note cmdloop(): 3a4b. when new input is needed; if it is nonempty,\nits elements will be processed in order, as if entered at the\nprompt.\n\n-- Attribute: Cmd.intro\n\nA string to issue as an intro or banner.  May be overridden by\ngiving the *note cmdloop(): 3a4b. method an argument.\n\n-- Attribute: Cmd.docheader\n\nThe header to issue if the help output has a section for documented\ncommands.\n\n-- Attribute: Cmd.mischeader\n\nThe header to issue if the help output has a section for\nmiscellaneous help topics (that is, there are 'help*()' methods\nwithout corresponding 'do*()' methods).\n\n-- Attribute: Cmd.undocheader\n\nThe header to issue if the help output has a section for\nundocumented commands (that is, there are 'do*()' methods without\ncorresponding 'help*()' methods).\n\n-- Attribute: Cmd.ruler\n\nThe character used to draw separator lines under the help-message\nheaders.  If empty, no ruler line is drawn.  It defaults to ''=''.\n\n-- Attribute: Cmd.userawinput\n\nA flag, defaulting to true.  If true, *note cmdloop(): 3a4b. uses\n*note input(): 114d. to display a prompt and read the next command;\nif false, *note sys.stdout.write(): 90c. and *note\nsys.stdin.readline(): 293. are used.  (This means that by importing\n*note readline: b5, on systems that support it, the interpreter\nwill automatically support 'Emacs'-like line editing and\ncommand-history keystrokes.)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Cmd Example,  Prev: Cmd Objects,  Up: cmd -- Support for line-oriented command interpreters": {
            "content": "5.24.2.2 Cmd Example\n....................\n\nThe *note cmd: 17. module is mainly useful for building custom shells\nthat let a user work with a program interactively.\n",
            "subsections": []
        },
        "This section presents a simple example of how to build a shell around a": {
            "content": "few of the commands in the *note turtle: fc. module.\n\nBasic turtle commands such as *note forward(): 39a7. are added to a\n*note Cmd: 3a47. subclass with method named 'doforward()'.  The\nargument is converted to a number and dispatched to the turtle module.\nThe docstring is used in the help utility provided by the shell.\n",
            "subsections": []
        },
        "The example also includes a basic record and playback facility": {
            "content": "implemented with the *note precmd(): 3a50. method which is responsible\nfor converting the input to lowercase and writing the commands to a\nfile.  The 'doplayback()' method reads the file and adds the recorded\ncommands to the *note cmdqueue: 3a59. for immediate playback:\n\nimport cmd, sys\nfrom turtle import *\n\nclass TurtleShell(cmd.Cmd):\nintro = 'Welcome to the turtle shell.   Type help or ? to list commands.\\n'\nprompt = '(turtle) '\nfile = None\n\n# ----- basic turtle commands -----\ndef doforward(self, arg):\n'Move the turtle forward by the specified distance:  FORWARD 10'\nforward(*parse(arg))\ndef doright(self, arg):\n'Turn turtle right by given number of degrees:  RIGHT 20'\nright(*parse(arg))\ndef doleft(self, arg):\n'Turn turtle left by given number of degrees:  LEFT 90'\nleft(*parse(arg))\ndef dogoto(self, arg):\n'Move turtle to an absolute position with changing orientation.  GOTO 100 200'\ngoto(*parse(arg))\ndef dohome(self, arg):\n'Return turtle to the home position:  HOME'\nhome()\ndef docircle(self, arg):\n'Draw circle with given radius an options extent and steps:  CIRCLE 50'\ncircle(*parse(arg))\ndef doposition(self, arg):\n'Print the current turtle position:  POSITION'\nprint('Current position is %d %d\\n' % position())\ndef doheading(self, arg):\n'Print the current turtle heading in degrees:  HEADING'\nprint('Current heading is %d\\n' % (heading(),))\ndef docolor(self, arg):\n'Set the color:  COLOR BLUE'\ncolor(arg.lower())\ndef doundo(self, arg):\n'Undo (repeatedly) the last turtle action(s):  UNDO'\ndef doreset(self, arg):\n'Clear the screen and return turtle to center:  RESET'\nreset()\ndef dobye(self, arg):\n'Stop recording, close the turtle window, and exit:  BYE'\nprint('Thank you for using Turtle')\nself.close()\nbye()\nreturn True\n\n# ----- record and playback -----\ndef dorecord(self, arg):\n'Save future commands to filename:  RECORD rose.cmd'\nself.file = open(arg, 'w')\ndef doplayback(self, arg):\n'Playback commands from a file:  PLAYBACK rose.cmd'\nself.close()\nwith open(arg) as f:\nself.cmdqueue.extend(f.read().splitlines())\ndef precmd(self, line):\nline = line.lower()\nif self.file and 'playback' not in line:\nprint(line, file=self.file)\nreturn line\ndef close(self):\nif self.file:\nself.file.close()\nself.file = None\n\ndef parse(arg):\n'Convert a series of zero or more numbers to an argument tuple'\nreturn tuple(map(int, arg.split()))\n\nif name == 'main':\nTurtleShell().cmdloop()\n",
            "subsections": []
        },
        "Here is a sample session with the turtle shell showing the help": {
            "content": "functions, using blank lines to repeat commands, and the simple record\nand playback facility:\n\nWelcome to the turtle shell.   Type help or ? to list commands.\n\n(turtle) ?\n",
            "subsections": [
                {
                    "name": "Documented commands (type help ):",
                    "content": "bye     color    goto     home  playback  record  right\ncircle  forward  heading  left  position  reset   undo\n\n(turtle) help forward\nMove the turtle forward by the specified distance:  FORWARD 10\n(turtle) record spiral.cmd\n(turtle) position\nCurrent position is 0 0\n\n(turtle) heading\nCurrent heading is 0\n\n(turtle) reset\n(turtle) circle 20\n(turtle) right 30\n(turtle) circle 40\n(turtle) right 30\n(turtle) circle 60\n(turtle) right 30\n(turtle) circle 80\n(turtle) right 30\n(turtle) circle 100\n(turtle) right 30\n(turtle) circle 120\n(turtle) right 30\n(turtle) circle 120\n(turtle) heading\nCurrent heading is 180\n\n(turtle) forward 100\n(turtle)\n(turtle) right 90\n(turtle) forward 100\n(turtle)\n(turtle) right 90\n(turtle) forward 400\n(turtle) right 90\n(turtle) forward 500\n(turtle) right 90\n(turtle) forward 400\n(turtle) right 90\n(turtle) forward 300\n(turtle) playback spiral.cmd\nCurrent position is 0 0\n\nCurrent heading is 0\n\nCurrent heading is 180\n\n(turtle) bye\nThank you for using Turtle\n"
                }
            ]
        },
        "File: python3.12.info,  Node: shlex -- Simple lexical analysis,  Prev: cmd -- Support for line-oriented command interpreters,  Up: Program Frameworks": {
            "content": "'Source code:' Lib/shlex.py(1)\n\n\n\nThe *note shlex: b1c. class makes it easy to write lexical analyzers for\nsimple syntaxes resembling that of the Unix shell.  This will often be\nuseful for writing minilanguages, (for example, in run control files for\nPython applications) or for parsing quoted strings.\n\nThe *note shlex: bf. module defines the following functions:\n\n-- Function: shlex.split (s, comments=False, posix=True)\n\nSplit the string 's' using shell-like syntax.  If 'comments' is\n*note False: 971. (the default), the parsing of comments in the\ngiven string will be disabled (setting the *note commenters: 3a62.\nattribute of the *note shlex: b1c. instance to the empty string).\nThis function operates in POSIX mode by default, but uses non-POSIX\nmode if the 'posix' argument is false.\n\nChanged in version 3.12: Passing 'None' for 's' argument now raises\nan exception, rather than reading *note sys.stdin: 293.\n\n-- Function: shlex.join (splitcommand)\n\nConcatenate the tokens of the list 'splitcommand' and return a\nstring.  This function is the inverse of *note split(): 292.\n\n>>> from shlex import join\n>>> print(join(['echo', '-n', 'Multiple words']))\necho -n 'Multiple words'\n\nThe returned value is shell-escaped to protect against injection\nvulnerabilities (see *note quote(): f9c.).\n\nNew in version 3.8.\n\n-- Function: shlex.quote (s)\n\nReturn a shell-escaped version of the string 's'.  The returned\nvalue is a string that can safely be used as one token in a shell\ncommand line, for cases where you cannot use a list.\nWarning: The 'shlex' module is 'only designed for Unix\nshells'.\n\nThe *note quote(): f9c. function is not guaranteed to be\ncorrect on non-POSIX compliant shells or shells from other\noperating systems such as Windows.  Executing commands quoted\nby this module on such shells can open up the possibility of a\ncommand injection vulnerability.\n\nConsider using functions that pass command arguments with\nlists such as *note subprocess.run(): 9c9. with 'shell=False'.\n\nThis idiom would be unsafe:\n\n>>> filename = 'somefile; rm -rf ~'\n>>> command = 'ls -l {}'.format(filename)\n>>> print(command)  # executed by a shell: boom!\nls -l somefile; rm -rf ~\n\n*note quote(): f9c. lets you plug the security hole:\n\n>>> from shlex import quote\n>>> command = 'ls -l {}'.format(quote(filename))\n>>> print(command)\nls -l 'somefile; rm -rf ~'\n>>> remotecommand = 'ssh home {}'.format(quote(command))\n>>> print(remotecommand)\nssh home 'ls -l '\"'\"'somefile; rm -rf ~'\"'\"''\n\nThe quoting is compatible with UNIX shells and with *note split():\n292.:\n\n>>> from shlex import split\n>>> remotecommand = split(remotecommand)\n>>> remotecommand\n['ssh', 'home', \"ls -l 'somefile; rm -rf ~'\"]\n>>> command = split(remotecommand[-1])\n>>> command\n['ls', '-l', 'somefile; rm -rf ~']\n\nNew in version 3.3.\n\nThe *note shlex: bf. module defines the following class:\n\n-- Class: shlex.shlex (instream=None, infile=None, posix=False,\npunctuationchars=False)\n\nA *note shlex: b1c. instance or subclass instance is a lexical\nanalyzer object.  The initialization argument, if present,\nspecifies where to read characters from.  It must be a\nfile-/stream-like object with *note read(): 1a0a. and *note\nreadline(): 1a40. methods, or a string.  If no argument is given,\ninput will be taken from 'sys.stdin'.  The second optional argument\nis a filename string, which sets the initial value of the *note\ninfile: 3a63. attribute.  If the 'instream' argument is omitted or\nequal to 'sys.stdin', this second argument defaults to \"stdin\".\nThe 'posix' argument defines the operational mode: when 'posix' is\nnot true (default), the *note shlex: b1c. instance will operate in\ncompatibility mode.  When operating in POSIX mode, *note shlex:\nb1c. will try to be as close as possible to the POSIX shell parsing\nrules.  The 'punctuationchars' argument provides a way to make the\nbehaviour even closer to how real shells parse.  This can take a\nnumber of values: the default value, 'False', preserves the\nbehaviour seen under Python 3.5 and earlier.  If set to 'True',\nthen parsing of the characters '();<>|&' is changed: any run of\nthese characters (considered punctuation characters) is returned as\na single token.  If set to a non-empty string of characters, those\ncharacters will be used as the punctuation characters.  Any\ncharacters in the *note wordchars: 3a64. attribute that appear in\n'punctuationchars' will be removed from *note wordchars: 3a64.\nSee *note Improved Compatibility with Shells: b1d. for more\ninformation.  'punctuationchars' can be set only upon *note shlex:\nb1c. instance creation and can't be modified later.\n\nChanged in version 3.6: The 'punctuationchars' parameter was\nadded.\n\nSee also\n........\n\nModule *note configparser: 20.\n\nParser for configuration files similar to the Windows '.ini' files.\n\n* Menu:\n\n* shlex Objects::\n* Parsing Rules::\n* Improved Compatibility with Shells::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/shlex.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: shlex Objects,  Next: Parsing Rules,  Up: shlex -- Simple lexical analysis": {
            "content": "5.24.3.1 shlex Objects\n......................\n\nA *note shlex: b1c. instance has the following methods:\n\n-- Method: shlex.gettoken ()\n\nReturn a token.  If tokens have been stacked using *note\npushtoken(): 3a68, pop a token off the stack.  Otherwise, read one\nfrom the input stream.  If reading encounters an immediate\nend-of-file, *note eof: 3a69. is returned (the empty string ('''')\nin non-POSIX mode, and 'None' in POSIX mode).\n\n-- Method: shlex.pushtoken (str)\n\nPush the argument onto the token stack.\n\n-- Method: shlex.readtoken ()\n\nRead a raw token.  Ignore the pushback stack, and do not interpret\nsource requests.  (This is not ordinarily a useful entry point, and\nis documented here only for the sake of completeness.)\n\n-- Method: shlex.sourcehook (filename)\n\nWhen *note shlex: b1c. detects a source request (see *note source:\n3a6c. below) this method is given the following token as argument,\nand expected to return a tuple consisting of a filename and an open\nfile-like object.\n\nNormally, this method first strips any quotes off the argument.  If\nthe result is an absolute pathname, or there was no previous source\nrequest in effect, or the previous source was a stream (such as\n'sys.stdin'), the result is left alone.  Otherwise, if the result\nis a relative pathname, the directory part of the name of the file\nimmediately before it on the source inclusion stack is prepended\n(this behavior is like the way the C preprocessor handles '#include\n\"file.h\"').\n\nThe result of the manipulations is treated as a filename, and\nreturned as the first component of the tuple, with *note open():\n26e. called on it to yield the second component.  (Note: this is\nthe reverse of the order of arguments in instance initialization!)\n\nThis hook is exposed so that you can use it to implement directory\nsearch paths, addition of file extensions, and other namespace\nhacks.  There is no corresponding 'close' hook, but a shlex\ninstance will call the *note close(): 17a4. method of the sourced\ninput stream when it returns EOF.\n\nFor more explicit control of source stacking, use the *note\npushsource(): 3a6d. and *note popsource(): 3a6e. methods.\n\n-- Method: shlex.pushsource (newstream, newfile=None)\n\nPush an input source stream onto the input stack.  If the filename\nargument is specified it will later be available for use in error\nmessages.  This is the same method used internally by the *note\nsourcehook(): 3a6b. method.\n\n-- Method: shlex.popsource ()\n\nPop the last-pushed input source from the input stack.  This is the\nsame method used internally when the lexer reaches EOF on a stacked\ninput stream.\n\n-- Method: shlex.errorleader (infile=None, lineno=None)\n\nThis method generates an error message leader in the format of a\nUnix C compiler error label; the format is ''\"%s\", line %d: '',\nwhere the '%s' is replaced with the name of the current source file\nand the '%d' with the current input line number (the optional\narguments can be used to override these).\n\nThis convenience is provided to encourage *note shlex: bf. users to\ngenerate error messages in the standard, parseable format\nunderstood by Emacs and other Unix tools.\n\nInstances of *note shlex: b1c. subclasses have some public instance\nvariables which either control lexical analysis or can be used for\ndebugging:\n\n-- Attribute: shlex.commenters\n\nThe string of characters that are recognized as comment beginners.\nAll characters from the comment beginner to end of line are\nignored.  Includes just ''#'' by default.\n\n-- Attribute: shlex.wordchars\n\nThe string of characters that will accumulate into multi-character\ntokens.  By default, includes all ASCII alphanumerics and\nunderscore.  In POSIX mode, the accented characters in the Latin-1\nset are also included.  If *note punctuationchars: 1743. is not\nempty, the characters '~-./*?=', which can appear in filename\nspecifications and command line parameters, will also be included\nin this attribute, and any characters which appear in\n'punctuationchars' will be removed from 'wordchars' if they are\npresent there.  If *note whitespacesplit: 3a70. is set to 'True',\nthis will have no effect.\n\n-- Attribute: shlex.whitespace\n\nCharacters that will be considered whitespace and skipped.\nWhitespace bounds tokens.  By default, includes space, tab,\nlinefeed and carriage-return.\n\n-- Attribute: shlex.escape\n\nCharacters that will be considered as escape.  This will be only\nused in POSIX mode, and includes just ''\\'' by default.\n\n-- Attribute: shlex.quotes\n\nCharacters that will be considered string quotes.  The token\naccumulates until the same quote is encountered again (thus,\ndifferent quote types protect each other as in the shell.)  By\ndefault, includes ASCII single and double quotes.\n\n-- Attribute: shlex.escapedquotes\n\nCharacters in *note quotes: 3a73. that will interpret escape\ncharacters defined in *note escape: 3a72.  This is only used in\nPOSIX mode, and includes just ''\"'' by default.\n\n-- Attribute: shlex.whitespacesplit\n\nIf 'True', tokens will only be split in whitespaces.  This is\nuseful, for example, for parsing command lines with *note shlex:\nb1c, getting tokens in a similar way to shell arguments.  When used\nin combination with *note punctuationchars: 1743, tokens will be\nsplit on whitespace in addition to those characters.\n\nChanged in version 3.8: The *note punctuationchars: 1743.\nattribute was made compatible with the *note whitespacesplit:\n3a70. attribute.\n\n-- Attribute: shlex.infile\n\nThe name of the current input file, as initially set at class\ninstantiation time or stacked by later source requests.  It may be\nuseful to examine this when constructing error messages.\n\n-- Attribute: shlex.instream\n\nThe input stream from which this *note shlex: b1c. instance is\nreading characters.\n\n-- Attribute: shlex.source\n\nThis attribute is 'None' by default.  If you assign a string to it,\nthat string will be recognized as a lexical-level inclusion request\nsimilar to the 'source' keyword in various shells.  That is, the\nimmediately following token will be opened as a filename and input\nwill be taken from that stream until EOF, at which point the *note\nclose(): 17a4. method of that stream will be called and the input\nsource will again become the original input stream.  Source\nrequests may be stacked any number of levels deep.\n\n-- Attribute: shlex.debug\n\nIf this attribute is numeric and '1' or more, a *note shlex: b1c.\ninstance will print verbose progress output on its behavior.  If\nyou need to use this, you can read the module source code to learn\nthe details.\n\n-- Attribute: shlex.lineno\n\nSource line number (count of newlines seen so far plus one).\n\n-- Attribute: shlex.token\n\nThe token buffer.  It may be useful to examine this when catching\nexceptions.\n\n-- Attribute: shlex.eof\n\nToken used to determine end of file.  This will be set to the empty\nstring (''''), in non-POSIX mode, and to 'None' in POSIX mode.\n\n-- Attribute: shlex.punctuationchars\n\nA read-only property.  Characters that will be considered\npunctuation.  Runs of punctuation characters will be returned as a\nsingle token.  However, note that no semantic validity checking\nwill be performed: for example, '>>>' could be returned as a token,\neven though it may not be recognised as such by shells.\n\nNew in version 3.6.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Parsing Rules,  Next: Improved Compatibility with Shells,  Prev: shlex Objects,  Up: shlex -- Simple lexical analysis": {
            "content": "5.24.3.2 Parsing Rules\n......................\n\nWhen operating in non-POSIX mode, *note shlex: b1c. will try to obey to\nthe following rules.\n\n* Quote characters are not recognized within words ('Do\"Not\"Separate'\nis parsed as the single word 'Do\"Not\"Separate');\n\n* Escape characters are not recognized;\n\n* Enclosing characters in quotes preserve the literal value of all\ncharacters within the quotes;\n\n* Closing quotes separate words ('\"Do\"Separate' is parsed as '\"Do\"'\nand 'Separate');\n\n* If *note whitespacesplit: 3a70. is 'False', any character not\ndeclared to be a word character, whitespace, or a quote will be\nreturned as a single-character token.  If it is 'True', *note\nshlex: b1c. will only split words in whitespaces;\n\n* EOF is signaled with an empty string ('''');\n\n* It's not possible to parse empty strings, even if quoted.\n\nWhen operating in POSIX mode, *note shlex: b1c. will try to obey to the\nfollowing parsing rules.\n\n* Quotes are stripped out, and do not separate words\n('\"Do\"Not\"Separate\"' is parsed as the single word 'DoNotSeparate');\n\n* Non-quoted escape characters (e.g.  ''\\'') preserve the literal\nvalue of the next character that follows;\n\n* Enclosing characters in quotes which are not part of *note\nescapedquotes: 3a74. (e.g.  '\"'\"')  preserve the literal value of\nall characters within the quotes;\n\n* Enclosing characters in quotes which are part of *note\nescapedquotes: 3a74. (e.g.  ''\"'')  preserves the literal value of\nall characters within the quotes, with the exception of the\ncharacters mentioned in *note escape: 3a72.  The escape characters\nretain its special meaning only when followed by the quote in use,\nor the escape character itself.  Otherwise the escape character\nwill be considered a normal character.\n\n* EOF is signaled with a *note None: 43f. value;\n\n* Quoted empty strings ('''') are allowed.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Improved Compatibility with Shells,  Prev: Parsing Rules,  Up: shlex -- Simple lexical analysis": {
            "content": "5.24.3.3 Improved Compatibility with Shells\n...........................................\n\nNew in version 3.6.\n\nThe *note shlex: bf. class provides compatibility with the parsing\nperformed by common Unix shells like 'bash', 'dash', and 'sh'.  To take\nadvantage of this compatibility, specify the 'punctuationchars'\nargument in the constructor.  This defaults to 'False', which preserves\npre-3.6 behaviour.  However, if it is set to 'True', then parsing of the\ncharacters '();<>|&' is changed: any run of these characters is returned\nas a single token.  While this is short of a full parser for shells\n(which would be out of scope for the standard library, given the\nmultiplicity of shells out there), it does allow you to perform\nprocessing of command lines more easily than you could otherwise.  To\nillustrate, you can see the difference in the following snippet:\n\n>>> import shlex\n>>> text = \"a && b; c && d || e; f >'abc'; (def \\\"ghi\\\")\"\n>>> s = shlex.shlex(text, posix=True)\n>>> s.whitespacesplit = True\n>>> list(s)\n['a', '&&', 'b;', 'c', '&&', 'd', '||', 'e;', 'f', '>abc;', '(def', 'ghi)']\n>>> s = shlex.shlex(text, posix=True, punctuationchars=True)\n>>> s.whitespacesplit = True\n>>> list(s)\n['a', '&&', 'b', ';', 'c', '&&', 'd', '||', 'e', ';', 'f', '>', 'abc', ';',\n'(', 'def', 'ghi', ')']\n",
            "subsections": []
        },
        "Of course, tokens will be returned which are not valid for shells, and": {
            "content": "you'll need to implement your own error checks on the returned tokens.\n",
            "subsections": []
        },
        "Instead of passing 'True' as the value for the punctuationchars": {
            "content": "parameter, you can pass a string with specific characters, which will be\nused to determine which characters constitute punctuation.  For example:\n\n>>> import shlex\n>>> s = shlex.shlex(\"a && b || c\", punctuationchars=\"|\")\n>>> list(s)\n['a', '&', '&', 'b', '||', 'c']\n\nNote: When 'punctuationchars' is specified, the *note wordchars:\n3a64. attribute is augmented with the characters '~-./*?='.  That\nis because these characters can appear in file names (including\nwildcards) and command-line arguments (e.g.  '--color=auto').\nHence:\n\n>>> import shlex\n>>> s = shlex.shlex('~/a && b-c --color=auto || d *.py?',\n...                 punctuationchars=True)\n>>> list(s)\n['~/a', '&&', 'b-c', '--color=auto', '||', 'd', '*.py?']\n\nHowever, to match the shell as closely as possible, it is\nrecommended to always use 'posix' and *note whitespacesplit: 3a70.\nwhen using *note punctuationchars: 1743, which will negate *note\nwordchars: 3a64. entirely.\n",
            "subsections": []
        },
        "For best effect, 'punctuationchars' should be set in conjunction with": {
            "content": "'posix=True'.  (Note that 'posix=False' is the default for *note shlex:\nb1c.)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Graphical User Interfaces with Tk,  Next: Development Tools,  Prev: Program Frameworks,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.25 Graphical User Interfaces with Tk",
                    "content": ""
                }
            ]
        },
        "Tk/Tcl has long been an integral part of Python.  It provides a robust": {
            "content": "and platform independent windowing toolkit, that is available to Python\nprogrammers using the *note tkinter: ea. package, and its extension, the\n*note tkinter.tix: f3. and the *note tkinter.ttk: f4. modules.\n\nThe *note tkinter: ea. package is a thin object-oriented layer on top of\nTcl/Tk.  To use *note tkinter: ea, you don't need to write Tcl code, but\nyou will need to consult the Tk documentation, and occasionally the Tcl\ndocumentation.  *note tkinter: ea. is a set of wrappers that implement\nthe Tk widgets as Python classes.\n\n*note tkinter: ea.'s chief virtues are that it is fast, and that it\nusually comes bundled with Python.  Although its standard documentation\nis weak, good material is available, which includes: references,\ntutorials, a book and others.  *note tkinter: ea. is also famous for\nhaving an outdated look and feel, which has been vastly improved in Tk\n8.5.  Nevertheless, there are many other GUI libraries that you could be\ninterested in.  The Python wiki lists several alternative GUI frameworks\nand tools(1).\n\n* Menu:\n\n* tkinter -- Python interface to Tcl/Tk::\n* tkinter.colorchooser -- Color choosing dialog: tkinter colorchooser -- Color choosing dialog.\n* tkinter.font -- Tkinter font wrapper: tkinter font -- Tkinter font wrapper.\n* Tkinter Dialogs::\n* tkinter.messagebox -- Tkinter message prompts: tkinter messagebox -- Tkinter message prompts.\n* tkinter.scrolledtext -- Scrolled Text Widget: tkinter scrolledtext -- Scrolled Text Widget.\n* tkinter.dnd -- Drag and drop support: tkinter dnd -- Drag and drop support.\n* tkinter.ttk -- Tk themed widgets: tkinter ttk -- Tk themed widgets.\n* tkinter.tix -- Extension widgets for Tk: tkinter tix -- Extension widgets for Tk.\n* IDLE: IDLE<57>.\n\n---------- Footnotes ----------\n\n(1) https://wiki.python.org/moin/GuiProgramming\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: tkinter -- Python interface to Tcl/Tk,  Next: tkinter colorchooser -- Color choosing dialog,  Up: Graphical User Interfaces with Tk": {
            "content": "'Source code:' Lib/tkinter/init.py(1)\n\n\n\nThe *note tkinter: ea. package (\"Tk interface\") is the standard Python\ninterface to the Tcl/Tk GUI toolkit.  Both Tk and *note tkinter: ea. are\navailable on most Unix platforms, including macOS, as well as on Windows\nsystems.\n",
            "subsections": []
        },
        "Running 'python -m tkinter' from the command line should open a window": {
            "content": "demonstrating a simple Tk interface, letting you know that *note\ntkinter: ea. is properly installed on your system, and also showing what\nversion of Tcl/Tk is installed, so you can read the Tcl/Tk documentation\nspecific to that version.\n",
            "subsections": []
        },
        "Tkinter supports a range of Tcl/Tk versions, built either with or": {
            "content": "without thread support.  The official Python binary release bundles\nTcl/Tk 8.6 threaded.  See the source code for the *note tkinter: 3.\nmodule for more information about supported versions.\n",
            "subsections": []
        },
        "Tkinter is not a thin wrapper, but adds a fair amount of its own logic": {
            "content": "to make the experience more pythonic.  This documentation will\nconcentrate on these additions and changes, and refer to the official\nTcl/Tk documentation for details that are unchanged.\n\nNote: Tcl/Tk 8.5 (2007) introduced a modern set of themed user\ninterface components along with a new API to use them.  Both old\nand new APIs are still available.  Most documentation you will find\nonline still uses the old API and can be woefully outdated.\n\nSee also\n........\n\n*\nTkDocs(2)\n\nExtensive tutorial on creating user interfaces with Tkinter.\nExplains key concepts, and illustrates recommended approaches\nusing the modern API.\n\n*\nTkinter 8.5 reference: a GUI for Python(3)\n\nReference documentation for Tkinter 8.5 detailing available\nclasses, methods, and options.\n\nTcl/Tk Resources:\n\n*\nTk commands(4)\n\nComprehensive reference to each of the underlying Tcl/Tk\ncommands used by Tkinter.\n\n*\nTcl/Tk Home Page(5)\n\nAdditional documentation, and links to Tcl/Tk core\ndevelopment.\n\nBooks:\n\n*\nModern Tkinter for Busy Python Developers(6)\n\nBy Mark Roseman.  (ISBN 978-1999149567)\n\n*\nPython GUI programming with Tkinter(7)\n\nBy Alan D. Moore.  (ISBN 978-1788835886)\n\n*\nProgramming Python(8)\n\nBy Mark Lutz; has excellent coverage of Tkinter.  (ISBN\n978-0596158101)\n\n*\nTcl and the Tk Toolkit (2nd edition)(9)\n\nBy John Ousterhout, inventor of Tcl/Tk, and Ken Jones; does\nnot cover Tkinter.  (ISBN 978-0321336330)\n\n* Menu:\n\n* Architecture::\n* Tkinter Modules::\n* Tkinter Life Preserver::\n* Threading model::\n* Handy Reference::\n* File Handlers::\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/tkinter/init.py\n\n(2) https://tkdocs.com/\n\n(3) https://www.tkdocs.com/shipman/\n\n(4) https://www.tcl.tk/man/tcl8.6/TkCmd/contents.htm\n\n(5) https://www.tcl.tk\n\n(6) https://tkdocs.com/book.html\n\n(7)\nhttps://www.packtpub.com/product/python-gui-programming-with-tkinter/9781788835886\n\n(8) https://learning-python.com/about-pp4e.html\n\n(9) https://www.amazon.com/exec/obidos/ASIN/032133633X\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Architecture,  Next: Tkinter Modules,  Up: tkinter -- Python interface to Tcl/Tk": {
            "content": "5.25.1.1 Architecture\n.....................\n",
            "subsections": []
        },
        "Tcl/Tk is not a single library but rather consists of a few distinct": {
            "content": "modules, each with separate functionality and its own official\ndocumentation.  Python's binary releases also ship an add-on module\ntogether with it.\n",
            "subsections": []
        },
        "Tcl": {
            "content": "Tcl is a dynamic interpreted programming language, just like\nPython.  Though it can be used on its own as a general-purpose\nprogramming language, it is most commonly embedded into C\napplications as a scripting engine or an interface to the Tk\ntoolkit.  The Tcl library has a C interface to create and manage\none or more instances of a Tcl interpreter, run Tcl commands and\nscripts in those instances, and add custom commands implemented in\neither Tcl or C. Each interpreter has an event queue, and there are\nfacilities to send events to it and process them.  Unlike Python,\nTcl's execution model is designed around cooperative multitasking,\nand Tkinter bridges this difference (see *note Threading model:\n3a82. for details).\n\nTk\n\nTk is a Tcl package(1) implemented in C that adds custom commands\nto create and manipulate GUI widgets.  Each *note Tk: 13ff. object\nembeds its own Tcl interpreter instance with Tk loaded into it.\nTk's widgets are very customizable, though at the cost of a dated\nappearance.  Tk uses Tcl's event queue to generate and process GUI\nevents.\n",
            "subsections": []
        },
        "Ttk": {
            "content": "Themed Tk (Ttk) is a newer family of Tk widgets that provide a much\nbetter appearance on different platforms than many of the classic\nTk widgets.  Ttk is distributed as part of Tk, starting with Tk\nversion 8.5.  Python bindings are provided in a separate module,\n*note tkinter.ttk: f4.\n",
            "subsections": []
        },
        "Internally, Tk and Ttk use facilities of the underlying operating": {
            "content": "system, i.e., Xlib on Unix/X11, Cocoa on macOS, GDI on Windows.\n",
            "subsections": []
        },
        "When your Python application uses a class in Tkinter, e.g., to create a": {
            "content": "widget, the *note tkinter: ea. module first assembles a Tcl/Tk command\nstring.  It passes that Tcl command string to an internal *note\ntkinter: 3. binary module, which then calls the Tcl interpreter to\nevaluate it.  The Tcl interpreter will then call into the Tk and/or Ttk\npackages, which will in turn make calls to Xlib, Cocoa, or GDI.\n\n---------- Footnotes ----------\n\n(1) https://wiki.tcl-lang.org/37432\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Tkinter Modules,  Next: Tkinter Life Preserver,  Prev: Architecture,  Up: tkinter -- Python interface to Tcl/Tk": {
            "content": "5.25.1.2 Tkinter Modules\n........................\n",
            "subsections": []
        },
        "Support for Tkinter is spread across several modules.  Most applications": {
            "content": "will need the main *note tkinter: ea. module, as well as the *note\ntkinter.ttk: f4. module, which provides the modern themed widget set and\nAPI:\n\nfrom tkinter import *\nfrom tkinter import ttk\n\n-- Class: tkinter.Tk (screenName=None, baseName=None, className='Tk',\nuseTk=True, sync=False, use=None)\n\nConstruct a toplevel Tk widget, which is usually the main window of\nan application, and initialize a Tcl interpreter for this widget.\nEach instance has its own associated Tcl interpreter.\n\nThe *note Tk: 13ff. class is typically instantiated using all\ndefault values.  However, the following keyword arguments are\ncurrently recognized:\n\n'screenName'\n\nWhen given (as a string), sets the 'DISPLAY' environment\nvariable.  (X11 only)\n\n'baseName'\n\nName of the profile file.  By default, 'baseName' is derived\nfrom the program name ('sys.argv[0]').\n\n'className'\n\nName of the widget class.  Used as a profile file and also as\nthe name with which Tcl is invoked ('argv0' in 'interp').\n\n'useTk'\n\nIf 'True', initialize the Tk subsystem.  The *note\ntkinter.Tcl(): 3a84. function sets this to 'False'.\n\n'sync'\n\nIf 'True', execute all X server commands synchronously, so\nthat errors are reported immediately.  Can be used for\ndebugging.  (X11 only)\n\n'use'\n\nSpecifies the 'id' of the window in which to embed the\napplication, instead of it being created as an independent\ntoplevel window.  'id' must be specified in the same way as\nthe value for the -use option for toplevel widgets (that is,\nit has a form like that returned by 'winfoid()').\n\nNote that on some platforms this will only work correctly if\n'id' refers to a Tk frame or toplevel that has its -container\noption enabled.\n\n*note Tk: 13ff. reads and interprets profile files, named\n'.`className'.tcl' and '.`baseName'.tcl', into the Tcl interpreter\nand calls *note exec(): 691. on the contents of '.`className'.py'\nand '.`baseName'.py'.  The path for the profile files is the 'HOME'\nenvironment variable or, if that isn't defined, then *note\nos.curdir: 24cf.\n\n-- Attribute: tk\n\nThe Tk application object created by instantiating *note Tk:\n13ff.  This provides access to the Tcl interpreter.  Each\nwidget that is attached the same instance of *note Tk: 13ff.\nhas the same value for its *note tk: 3a85. attribute.\n\n-- Attribute: master\n\nThe widget object that contains this widget.  For *note Tk:\n13ff, the 'master' is *note None: 43f. because it is the main\nwindow.  The terms 'master' and 'parent' are similar and\nsometimes used interchangeably as argument names; however,\ncalling 'winfoparent()' returns a string of the widget name\nwhereas *note master: 3a86. returns the object.\n'parent'/'child' reflects the tree-like relationship while\n'master'/'slave' reflects the container structure.\n\n-- Attribute: children\n\nThe immediate descendants of this widget as a *note dict: 237.\nwith the child widget names as the keys and the child instance\nobjects as the values.\n\n-- Function: tkinter.Tcl (screenName=None, baseName=None,\nclassName='Tk', useTk=False)\n\nThe *note Tcl(): 3a84. function is a factory function which creates\nan object much like that created by the *note Tk: 13ff. class,\nexcept that it does not initialize the Tk subsystem.  This is most\noften useful when driving the Tcl interpreter in an environment\nwhere one doesn't want to create extraneous toplevel windows, or\nwhere one cannot (such as Unix/Linux systems without an X server).\nAn object created by the *note Tcl(): 3a84. object can have a\nToplevel window created (and the Tk subsystem initialized) by\ncalling its 'loadtk()' method.\n\nThe modules that provide Tk support include:\n\n*note tkinter: ea.\n\nMain Tkinter module.\n\n*note tkinter.colorchooser: eb.\n\nDialog to let the user choose a color.\n\n*note tkinter.commondialog: ec.\n\nBase class for the dialogs defined in the other modules listed\nhere.\n\n*note tkinter.filedialog: ee.\n\nCommon dialogs to allow the user to specify a file to open or save.\n\n*note tkinter.font: ef.\n\nUtilities to help work with fonts.\n\n*note tkinter.messagebox: f0.\n\nAccess to standard Tk dialog boxes.\n\n*note tkinter.scrolledtext: f1.\n\nText widget with a vertical scroll bar built in.\n\n*note tkinter.simpledialog: f2.\n\nBasic dialogs and convenience functions.\n\n*note tkinter.ttk: f4.\n\nThemed widget set introduced in Tk 8.5, providing modern\nalternatives for many of the classic widgets in the main *note\ntkinter: ea. module.\n\nAdditional modules:\n\n*note tkinter: 3.\n\nA binary module that contains the low-level interface to Tcl/Tk.\nIt is automatically imported by the main *note tkinter: ea. module,\nand should never be used directly by application programmers.  It\nis usually a shared library (or DLL), but might in some cases be\nstatically linked with the Python interpreter.\n\n*note idlelib: 6e.\n\nPython's Integrated Development and Learning Environment (IDLE).\nBased on *note tkinter: ea.\n\n'tkinter.constants'\n\nSymbolic constants that can be used in place of strings when\npassing various parameters to Tkinter calls.  Automatically\nimported by the main *note tkinter: ea. module.\n\n*note tkinter.dnd: ed.\n\n(experimental) Drag-and-drop support for *note tkinter: ea.  This\nwill become deprecated when it is replaced with the Tk DND.\n\n*note tkinter.tix: f3.\n\n(deprecated) An older third-party Tcl/Tk package that adds several\nnew widgets.  Better alternatives for most can be found in *note\ntkinter.ttk: f4.\n\n*note turtle: fc.\n\nTurtle graphics in a Tk window.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Tkinter Life Preserver,  Next: Threading model,  Prev: Tkinter Modules,  Up: tkinter -- Python interface to Tcl/Tk": {
            "content": "5.25.1.3 Tkinter Life Preserver\n...............................\n",
            "subsections": []
        },
        "This section is not designed to be an exhaustive tutorial on either Tk": {
            "content": "or Tkinter.  For that, refer to one of the external resources noted\nearlier.  Instead, this section provides a very quick orientation to\nwhat a Tkinter application looks like, identifies foundational Tk\nconcepts, and explains how the Tkinter wrapper is structured.\n",
            "subsections": []
        },
        "The remainder of this section will help you to identify the classes,": {
            "content": "methods, and options you'll need in your Tkinter application, and where\nto find more detailed documentation on them, including in the official\nTcl/Tk reference manual.\n\n* Menu:\n\n* A Hello World Program::\n* Important Tk Concepts::\n* Understanding How Tkinter Wraps Tcl/Tk::\n* How do I...? What option does...?::\n* Navigating the Tcl/Tk Reference Manual::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: A Hello World Program,  Next: Important Tk Concepts,  Up: Tkinter Life Preserver": {
            "content": "5.25.1.4 A Hello World Program\n..............................\n\nWe'll start by walking through a \"Hello World\" application in Tkinter.",
            "subsections": []
        },
        "This isn't the smallest one we could write, but has enough to illustrate": {
            "content": "some key concepts you'll need to know.\n\nfrom tkinter import *\nfrom tkinter import ttk\nroot = Tk()\nfrm = ttk.Frame(root, padding=10)\nfrm.grid()\nttk.Label(frm, text=\"Hello World!\").grid(column=0, row=0)\nttk.Button(frm, text=\"Quit\", command=root.destroy).grid(column=1, row=0)\nroot.mainloop()\n",
            "subsections": []
        },
        "After the imports, the next line creates an instance of the 'Tk' class,": {
            "content": "which initializes Tk and creates its associated Tcl interpreter.  It\nalso creates a toplevel window, known as the root window, which serves\nas the main window of the application.\n",
            "subsections": []
        },
        "The following line creates a frame widget, which in this case will": {
            "content": "contain a label and a button we'll create next.  The frame is fit inside\nthe root window.\n",
            "subsections": []
        },
        "The next line creates a label widget holding a static text string.  The": {
            "content": "'grid()' method is used to specify the relative layout (position) of the\nlabel within its containing frame widget, similar to how tables in HTML\nwork.\n\nA button widget is then created, and placed to the right of the label.\nWhen pressed, it will call the 'destroy()' method of the root window.\n",
            "subsections": []
        },
        "Finally, the 'mainloop()' method puts everything on the display, and": {
            "content": "responds to user input until the program terminates.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Important Tk Concepts,  Next: Understanding How Tkinter Wraps Tcl/Tk,  Prev: A Hello World Program,  Up: Tkinter Life Preserver": {
            "content": "5.25.1.5 Important Tk Concepts\n..............................\n\nEven this simple program illustrates the following key Tk concepts:\n\nwidgets\n\nA Tkinter user interface is made up of individual 'widgets'.  Each\nwidget is represented as a Python object, instantiated from classes\nlike 'ttk.Frame', 'ttk.Label', and 'ttk.Button'.\n\nwidget hierarchy\n\nWidgets are arranged in a 'hierarchy'.  The label and button were\ncontained within a frame, which in turn was contained within the\nroot window.  When creating each 'child' widget, its 'parent'\nwidget is passed as the first argument to the widget constructor.\n\nconfiguration options\n\nWidgets have 'configuration options', which modify their appearance\nand behavior, such as the text to display in a label or button.\nDifferent classes of widgets will have different sets of options.\n\ngeometry management\n\nWidgets aren't automatically added to the user interface when they\nare created.  A 'geometry manager' like 'grid' controls where in\nthe user interface they are placed.\n\nevent loop\n\nTkinter reacts to user input, changes from your program, and even\nrefreshes the display only when actively running an 'event loop'.\nIf your program isn't running the event loop, your user interface\nwon't update.\n\nFile: python3.12.info,  Node: Understanding How Tkinter Wraps Tcl/Tk,  Next: How do I...? What option does...?,  Prev: Important Tk Concepts,  Up: Tkinter Life Preserver\n\n5.25.1.6 Understanding How Tkinter Wraps Tcl/Tk\n...............................................\n",
            "subsections": []
        },
        "When your application uses Tkinter's classes and methods, internally": {
            "content": "",
            "subsections": []
        },
        "Tkinter is assembling strings representing Tcl/Tk commands, and": {
            "content": "executing those commands in the Tcl interpreter attached to your\napplication's 'Tk' instance.\n",
            "subsections": []
        },
        "Whether it's trying to navigate reference documentation, trying to find": {
            "content": "the right method or option, adapting some existing code, or debugging\nyour Tkinter application, there are times that it will be useful to\nunderstand what those underlying Tcl/Tk commands look like.\n",
            "subsections": []
        },
        "To illustrate, here is the Tcl/Tk equivalent of the main part of the": {
            "content": "Tkinter script above.\n\nttk::frame .frm -padding 10\ngrid .frm\ngrid [ttk::label .frm.lbl -text \"Hello World!\"] -column 0 -row 0\ngrid [ttk::button .frm.btn -text \"Quit\" -command \"destroy .\"] -column 1 -row 0\n",
            "subsections": []
        },
        "Tcl's syntax is similar to many shell languages, where the first word is": {
            "content": "the command to be executed, with arguments to that command following it,\nseparated by spaces.  Without getting into too many details, notice the\nfollowing:\n\n* The commands used to create widgets (like 'ttk::frame') correspond\nto widget classes in Tkinter.\n\n* Tcl widget options (like '-text') correspond to keyword arguments\nin Tkinter.\n\n* Widgets are referred to by a 'pathname' in Tcl (like '.frm.btn'),\nwhereas Tkinter doesn't use names but object references.\n\n* A widget's place in the widget hierarchy is encoded in its\n(hierarchical) pathname, which uses a '.' (dot) as a path\nseparator.  The pathname for the root window is just '.' (dot).  In\nTkinter, the hierarchy is defined not by pathname but by specifying\nthe parent widget when creating each child widget.\n\n* Operations which are implemented as separate 'commands' in Tcl\n(like 'grid' or 'destroy') are represented as 'methods' on Tkinter\nwidget objects.  As you'll see shortly, at other times Tcl uses\nwhat appear to be method calls on widget objects, which more\nclosely mirror what would is used in Tkinter.\n\nFile: python3.12.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\n\n5.25.1.7 How do I...? What option does...?\n......................................\n",
            "subsections": []
        },
        "If you're not sure how to do something in Tkinter, and you can't": {
            "content": "immediately find it in the tutorial or reference documentation you're\nusing, there are a few strategies that can be helpful.\n",
            "subsections": []
        },
        "First, remember that the details of how individual widgets work may vary": {
            "content": "across different versions of both Tkinter and Tcl/Tk.  If you're\nsearching documentation, make sure it corresponds to the Python and\nTcl/Tk versions installed on your system.\n",
            "subsections": []
        },
        "When searching for how to use an API, it helps to know the exact name of": {
            "content": "the class, option, or method that you're using.  Introspection, either\nin an interactive Python shell or with *note print(): de5, can help you\nidentify what you need.\n",
            "subsections": []
        },
        "To find out what configuration options are available on any widget, call": {
            "content": "its 'configure()' method, which returns a dictionary containing a\nvariety of information about each object, including its default and\ncurrent values.  Use 'keys()' to get just the names of each option.\n\nbtn = ttk.Button(frm, ...)\nprint(btn.configure().keys())\n",
            "subsections": []
        },
        "As most widgets have many configuration options in common, it can be": {
            "content": "useful to find out which are specific to a particular widget class.",
            "subsections": []
        },
        "Comparing the list of options to that of a simpler widget, like a frame,": {
            "content": "is one way to do that.\n\nprint(set(btn.configure().keys()) - set(frm.configure().keys()))\n",
            "subsections": []
        },
        "Similarly, you can find the available methods for a widget object using": {
            "content": "the standard *note dir(): 3ff. function.  If you try it, you'll see\nthere are over 200 common widget methods, so again identifying those\nspecific to a widget class is helpful.\n\nprint(dir(btn))\nprint(set(dir(btn)) - set(dir(frm)))\n\nFile: python3.12.info,  Node: Navigating the Tcl/Tk Reference Manual,  Prev: How do I...? What option does...?,  Up: Tkinter Life Preserver\n\n5.25.1.8 Navigating the Tcl/Tk Reference Manual\n...............................................\n",
            "subsections": []
        },
        "As noted, the official Tk commands(1) reference manual (man pages) is": {
            "content": "often the most accurate description of what specific operations on\nwidgets do.  Even when you know the name of the option or method that\nyou need, you may still have a few places to look.\n",
            "subsections": []
        },
        "While all operations in Tkinter are implemented as method calls on": {
            "content": "widget objects, you've seen that many Tcl/Tk operations appear as\ncommands that take a widget pathname as its first parameter, followed by\noptional parameters, e.g.\n\ndestroy .\ngrid .frm.btn -column 0 -row 0\n",
            "subsections": []
        },
        "Others, however, look more like methods called on a widget object (in": {
            "content": "fact, when you create a widget in Tcl/Tk, it creates a Tcl command with\nthe name of the widget pathname, with the first parameter to that\ncommand being the name of a method to call).\n\n.frm.btn invoke\n.frm.lbl configure -text \"Goodbye\"\n",
            "subsections": []
        },
        "In the official Tcl/Tk reference documentation, you'll find most": {
            "content": "operations that look like method calls on the man page for a specific\nwidget (e.g., you'll find the 'invoke()' method on the ttk::button(2)\nman page), while functions that take a widget as a parameter often have\ntheir own man page (e.g., grid(3)).\n",
            "subsections": []
        },
        "You'll find many common options and methods in the options(4) or": {
            "content": "ttk::widget(5) man pages, while others are found in the man page for a\nspecific widget class.\n",
            "subsections": []
        },
        "You'll also find that many Tkinter methods have compound names, e.g.,": {
            "content": "'winfox()', 'winfoheight()', 'winfoviewable()'.  You'd find\ndocumentation for all of these in the winfo(6) man page.\n\nNote: Somewhat confusingly, there are also methods on all Tkinter\nwidgets that don't actually operate on the widget, but operate at a\nglobal scope, independent of any widget.  Examples are methods for\naccessing the clipboard or the system bell.  (They happen to be\nimplemented as methods in the base 'Widget' class that all Tkinter\nwidgets inherit from).\n\n---------- Footnotes ----------\n\n(1) https://www.tcl.tk/man/tcl8.6/TkCmd/contents.htm\n\n(2) https://www.tcl.tk/man/tcl8.6/TkCmd/ttkbutton.htm\n\n(3) https://www.tcl.tk/man/tcl8.6/TkCmd/grid.htm\n\n(4) https://www.tcl.tk/man/tcl8.6/TkCmd/options.htm\n\n(5) https://www.tcl.tk/man/tcl8.6/TkCmd/ttkwidget.htm\n\n(6) https://www.tcl.tk/man/tcl8.6/TkCmd/winfo.htm\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Threading model,  Next: Handy Reference,  Prev: Tkinter Life Preserver,  Up: tkinter -- Python interface to Tcl/Tk": {
            "content": "5.25.1.9 Threading model\n........................\n\nPython and Tcl/Tk have very different threading models, which *note\ntkinter: ea. tries to bridge.  If you use threads, you may need to be\naware of this.\n\nA Python interpreter may have many threads associated with it.  In Tcl,\nmultiple threads can be created, but each thread has a separate Tcl\ninterpreter instance associated with it.  Threads can also create more\nthan one interpreter instance, though each interpreter instance can be\nused only by the one thread that created it.\n\nEach 'Tk' object created by *note tkinter: ea. contains a Tcl\ninterpreter.  It also keeps track of which thread created that\ninterpreter.  Calls to *note tkinter: ea. can be made from any Python\nthread.  Internally, if a call comes from a thread other than the one\nthat created the 'Tk' object, an event is posted to the interpreter's\nevent queue, and when executed, the result is returned to the calling\nPython thread.\n",
            "subsections": []
        },
        "Tcl/Tk applications are normally event-driven, meaning that after": {
            "content": "initialization, the interpreter runs an event loop (i.e.\n'Tk.mainloop()') and responds to events.  Because it is single-threaded,\nevent handlers must respond quickly, otherwise they will block other\nevents from being processed.  To avoid this, any long-running\ncomputations should not run in an event handler, but are either broken\ninto smaller pieces using timers, or run in another thread.  This is\ndifferent from many GUI toolkits where the GUI runs in a completely\nseparate thread from all application code including event handlers.\n",
            "subsections": []
        },
        "If the Tcl interpreter is not running the event loop and processing": {
            "content": "events, any *note tkinter: ea. calls made from threads other than the\none running the Tcl interpreter will fail.\n\nA number of special cases exist:\n\n* Tcl/Tk libraries can be built so they are not thread-aware.  In\nthis case, *note tkinter: ea. calls the library from the\noriginating Python thread, even if this is different than the\nthread that created the Tcl interpreter.  A global lock ensures\nonly one call occurs at a time.\n\n* While *note tkinter: ea. allows you to create more than one\ninstance of a 'Tk' object (with its own interpreter), all\ninterpreters that are part of the same thread share a common event\nqueue, which gets ugly fast.  In practice, don't create more than\none instance of 'Tk' at a time.  Otherwise, it's best to create\nthem in separate threads and ensure you're running a thread-aware\nTcl/Tk build.\n\n* Blocking event handlers are not the only way to prevent the Tcl\ninterpreter from reentering the event loop.  It is even possible to\nrun multiple nested event loops or abandon the event loop entirely.\nIf you're doing anything tricky when it comes to events or threads,\nbe aware of these possibilities.\n\n* There are a few select *note tkinter: ea. functions that presently\nwork only when called from the thread that created the Tcl\ninterpreter.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Handy Reference,  Next: File Handlers,  Prev: Threading model,  Up: tkinter -- Python interface to Tcl/Tk": {
            "content": "5.25.1.10 Handy Reference\n.........................\n\n* Menu:\n\n* Setting Options::\n* The Packer::\n* Packer Options::\n* Coupling Widget Variables::\n* The Window Manager::\n* Tk Option Data Types::\n* Bindings and Events::\n* The index Parameter::\n* Images::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Setting Options,  Next: The Packer,  Up: Handy Reference": {
            "content": "5.25.1.11 Setting Options\n.........................\n\nOptions control things like the color and border width of a widget.\nOptions can be set in three ways:\n",
            "subsections": []
        },
        "At object creation time, using keyword arguments": {
            "content": "fred = Button(self, fg=\"red\", bg=\"blue\")\n",
            "subsections": []
        },
        "After object creation, treating the option name like a dictionary index": {
            "content": "fred[\"fg\"] = \"red\"\nfred[\"bg\"] = \"blue\"\n",
            "subsections": []
        },
        "Use the config() method to update multiple attrs subsequent to object creation": {
            "content": "fred.config(fg=\"red\", bg=\"blue\")\n",
            "subsections": []
        },
        "For a complete explanation of a given option and its behavior, see the": {
            "content": "Tk man pages for the widget in question.\n\nNote that the man pages list \"STANDARD OPTIONS\" and \"WIDGET SPECIFIC\nOPTIONS\" for each widget.  The former is a list of options that are\ncommon to many widgets, the latter are the options that are\nidiosyncratic to that particular widget.  The Standard Options are\ndocumented on the 'options(3)' man page.\n",
            "subsections": []
        },
        "No distinction between standard and widget-specific options is made in": {
            "content": "this document.  Some options don't apply to some kinds of widgets.",
            "subsections": []
        },
        "Whether a given widget responds to a particular option depends on the": {
            "content": "class of the widget; buttons have a 'command' option, labels do not.\n",
            "subsections": []
        },
        "The options supported by a given widget are listed in that widget's man": {
            "content": "page, or can be queried at runtime by calling the 'config()' method\nwithout arguments, or by calling the 'keys()' method on that widget.",
            "subsections": []
        },
        "The return value of these calls is a dictionary whose key is the name of": {
            "content": "the option as a string (for example, ''relief'') and whose values are\n5-tuples.\n",
            "subsections": []
        },
        "Some options, like 'bg' are synonyms for common options with long names": {
            "content": "('bg' is shorthand for \"background\").  Passing the 'config()' method the\nname of a shorthand option will return a 2-tuple, not 5-tuple.  The\n2-tuple passed back will contain the name of the synonym and the \"real\"\noption (such as '('bg', 'background')').\n",
            "subsections": []
        },
        "Index       Meaning                               Example": {
            "content": "---------------------------------------------------------------------\n\n0           option name                           ''relief''\n\n\n1           option name for database lookup       ''relief''\n\n\n2           option class for database lookup      ''Relief''\n\n\n3           default value                         ''raised''\n\n\n4           current value                         ''groove''\n\n\nExample:\n\n>>> print(fred.config())\n{'relief': ('relief', 'relief', 'Relief', 'raised', 'groove')}\n",
            "subsections": []
        },
        "Of course, the dictionary printed will include all the options available": {
            "content": "and their values.  This is meant only as an example.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The Packer,  Next: Packer Options,  Prev: Setting Options,  Up: Handy Reference": {
            "content": "5.25.1.12 The Packer\n....................\n",
            "subsections": []
        },
        "The packer is one of Tk's geometry-management mechanisms.  Geometry": {
            "content": "managers are used to specify the relative positioning of widgets within\ntheir container - their mutual 'master'.  In contrast to the more\ncumbersome 'placer' (which is used less commonly, and we do not cover\nhere), the packer takes qualitative relationship specification -\n'above', 'to the left of', 'filling', etc - and works everything out to\ndetermine the exact placement coordinates for you.\n\nThe size of any 'master' widget is determined by the size of the \"slave\nwidgets\" inside.  The packer is used to control where slave widgets\nappear inside the master into which they are packed.  You can pack\nwidgets into frames, and frames into other frames, in order to achieve\nthe kind of layout you desire.  Additionally, the arrangement is\ndynamically adjusted to accommodate incremental changes to the\nconfiguration, once it is packed.\n",
            "subsections": []
        },
        "Note that widgets do not appear until they have had their geometry": {
            "content": "specified with a geometry manager.  It's a common early mistake to leave\nout the geometry specification, and then be surprised when the widget is\ncreated but nothing appears.  A widget will appear only after it has\nhad, for example, the packer's 'pack()' method applied to it.\n",
            "subsections": []
        },
        "The pack() method can be called with keyword-option/value pairs that": {
            "content": "control where the widget is to appear within its container, and how it\nis to behave when the main application window is resized.  Here are some\nexamples:\n\nfred.pack()                     # defaults to side = \"top\"\nfred.pack(side=\"left\")\nfred.pack(expand=1)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Packer Options,  Next: Coupling Widget Variables,  Prev: The Packer,  Up: Handy Reference": {
            "content": "5.25.1.13 Packer Options\n........................\n",
            "subsections": []
        },
        "For more extensive information on the packer and the options that it can": {
            "content": "take, see the man pages and page 183 of John Ousterhout's book.\n\nanchor\n\nAnchor type.  Denotes where the packer is to place each slave in\nits parcel.\n\nexpand\n\nBoolean, '0' or '1'.\n\nfill\n\nLegal values: ''x'', ''y'', ''both'', ''none''.\n\nipadx and ipady\n\nA distance - designating internal padding on each side of the slave\nwidget.\n\npadx and pady\n\nA distance - designating external padding on each side of the slave\nwidget.\n\nside\n\nLegal values are: ''left'', ''right'', ''top'', ''bottom''.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Coupling Widget Variables,  Next: The Window Manager,  Prev: Packer Options,  Up: Handy Reference": {
            "content": "5.25.1.14 Coupling Widget Variables\n...................................\n",
            "subsections": []
        },
        "The current-value setting of some widgets (like text entry widgets) can": {
            "content": "be connected directly to application variables by using special options.",
            "subsections": []
        },
        "These options are 'variable', 'textvariable', 'onvalue', 'offvalue', and": {
            "content": "'value'.  This connection works both ways: if the variable changes for\nany reason, the widget it's connected to will be updated to reflect the\nnew value.\n\nUnfortunately, in the current implementation of *note tkinter: ea. it is\nnot possible to hand over an arbitrary Python variable to a widget\nthrough a 'variable' or 'textvariable' option.  The only kinds of\nvariables for which this works are variables that are subclassed from a\nclass called Variable, defined in *note tkinter: ea.\n\nThere are many useful subclasses of Variable already defined:\n'StringVar', 'IntVar', 'DoubleVar', and 'BooleanVar'.  To read the\ncurrent value of such a variable, call the 'get()' method on it, and to\nchange its value you call the 'set()' method.  If you follow this\nprotocol, the widget will always track the value of the variable, with\nno further intervention on your part.\n\nFor example:\n\nimport tkinter as tk\n\nclass App(tk.Frame):\ndef init(self, master):\nsuper().init(master)\nself.pack()\n\nself.entrythingy = tk.Entry()\nself.entrythingy.pack()\n\n# Create the application variable.\nself.contents = tk.StringVar()\n# Set it to some value.\nself.contents.set(\"this is a variable\")\n# Tell the entry widget to watch this variable.\nself.entrythingy[\"textvariable\"] = self.contents\n\n# Define a callback for when the user hits return.\n# It prints the current value of the variable.\nself.entrythingy.bind('<Key-Return>',\nself.printcontents)\n\ndef printcontents(self, event):\nprint(\"Hi. The current entry content is:\",\nself.contents.get())\n\nroot = tk.Tk()\nmyapp = App(root)\nmyapp.mainloop()\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The Window Manager,  Next: Tk Option Data Types,  Prev: Coupling Widget Variables,  Up: Handy Reference": {
            "content": "5.25.1.15 The Window Manager\n............................\n",
            "subsections": []
        },
        "In Tk, there is a utility command, 'wm', for interacting with the window": {
            "content": "manager.  Options to the 'wm' command allow you to control things like\ntitles, placement, icon bitmaps, and the like.  In *note tkinter: ea,\nthese commands have been implemented as methods on the 'Wm' class.",
            "subsections": []
        },
        "Toplevel widgets are subclassed from the 'Wm' class, and so can call the": {
            "content": "'Wm' methods directly.\n",
            "subsections": []
        },
        "To get at the toplevel window that contains a given widget, you can": {
            "content": "often just refer to the widget's master.  Of course if the widget has\nbeen packed inside of a frame, the master won't represent a toplevel\nwindow.  To get at the toplevel window that contains an arbitrary\nwidget, you can call the 'root()' method.  This method begins with an\nunderscore to denote the fact that this function is part of the\nimplementation, and not an interface to Tk functionality.\n\nHere are some examples of typical usage:\n\nimport tkinter as tk\n\nclass App(tk.Frame):\ndef init(self, master=None):\nsuper().init(master)\nself.pack()\n\n# create the application\nmyapp = App()\n\n#\n# here are method calls to the window manager class\n#\nmyapp.master.title(\"My Do-Nothing Application\")\nmyapp.master.maxsize(1000, 400)\n\n# start the program\nmyapp.mainloop()\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Tk Option Data Types,  Next: Bindings and Events,  Prev: The Window Manager,  Up: Handy Reference": {
            "content": "5.25.1.16 Tk Option Data Types\n..............................\n\nanchor\n\nLegal values are points of the compass: '\"n\"', '\"ne\"', '\"e\"',\n'\"se\"', '\"s\"', '\"sw\"', '\"w\"', '\"nw\"', and also '\"center\"'.\n\nbitmap\n\nThere are eight built-in, named bitmaps: ''error'', ''gray25'',\n''gray50'', ''hourglass'', ''info'', ''questhead'', ''question'',\n''warning''.  To specify an X bitmap filename, give the full path\nto the file, preceded with an '@', as in\n'\"@/usr/contrib/bitmap/gumby.bit\"'.\n\nboolean\n\nYou can pass integers 0 or 1 or the strings '\"yes\"' or '\"no\"'.\n\ncallback\n\nThis is any Python function that takes no arguments.  For example:\n\ndef printit():\nprint(\"hi there\")\nfred[\"command\"] = printit\n\ncolor\n\nColors can be given as the names of X colors in the rgb.txt file,\nor as strings representing RGB values in 4 bit: '\"#RGB\"', 8 bit:\n'\"#RRGGBB\"', 12 bit: '\"#RRRGGGBBB\"', or 16 bit: '\"#RRRRGGGGBBBB\"'\nranges, where R,G,B here represent any legal hex digit.  See page\n160 of Ousterhout's book for details.\n\ncursor\n\nThe standard X cursor names from 'cursorfont.h' can be used,\nwithout the 'XC' prefix.  For example to get a hand cursor\n('XChand2'), use the string '\"hand2\"'.  You can also specify a\nbitmap and mask file of your own.  See page 179 of Ousterhout's\nbook.\n\ndistance\n\nScreen distances can be specified in either pixels or absolute\ndistances.  Pixels are given as numbers and absolute distances as\nstrings, with the trailing character denoting units: 'c' for\ncentimetres, 'i' for inches, 'm' for millimetres, 'p' for printer's\npoints.  For example, 3.5 inches is expressed as '\"3.5i\"'.\n\nfont\n\nTk uses a list font name format, such as '{courier 10 bold}'.  Font\nsizes with positive numbers are measured in points; sizes with\nnegative numbers are measured in pixels.\n\ngeometry\n\nThis is a string of the form 'widthxheight', where width and height\nare measured in pixels for most widgets (in characters for widgets\ndisplaying text).  For example: 'fred[\"geometry\"] = \"200x100\"'.\n\njustify\n\nLegal values are the strings: '\"left\"', '\"center\"', '\"right\"', and\n'\"fill\"'.\n\nregion\n\nThis is a string with four space-delimited elements, each of which\nis a legal distance (see above).  For example: '\"2 3 4 5\"' and '\"3i\n2i 4.5i 2i\"' and '\"3c 2c 4c 10.43c\"' are all legal regions.\n\nrelief\n\nDetermines what the border style of a widget will be.  Legal values\nare: '\"raised\"', '\"sunken\"', '\"flat\"', '\"groove\"', and '\"ridge\"'.\n\nscrollcommand\n\nThis is almost always the 'set()' method of some scrollbar widget,\nbut can be any widget method that takes a single argument.\n\nwrap\n\nMust be one of: '\"none\"', '\"char\"', or '\"word\"'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Bindings and Events,  Next: The index Parameter,  Prev: Tk Option Data Types,  Up: Handy Reference": {
            "content": "5.25.1.17 Bindings and Events\n.............................\n",
            "subsections": []
        },
        "The bind method from the widget command allows you to watch for certain": {
            "content": "events and to have a callback function trigger when that event type\noccurs.  The form of the bind method is:\n\ndef bind(self, sequence, func, add=''):\n\nwhere:\n\nsequence\n\nis a string that denotes the target kind of event.  (See the\n'bind(3tk)' man page, and page 201 of John Ousterhout's book, 'Tcl\nand the Tk Toolkit (2nd edition)', for details).\n\nfunc\n\nis a Python function, taking one argument, to be invoked when the\nevent occurs.  An Event instance will be passed as the argument.\n(Functions deployed this way are commonly known as 'callbacks'.)\n\nadd\n\nis optional, either '''' or ''+''.  Passing an empty string denotes\nthat this binding is to replace any other bindings that this event\nis associated with.  Passing a ''+'' means that this function is to\nbe added to the list of functions bound to this event type.\n\nFor example:\n\ndef turnred(self, event):\nevent.widget[\"activeforeground\"] = \"red\"\n\nself.button.bind(\"<Enter>\", self.turnred)\n",
            "subsections": []
        },
        "Notice how the widget field of the event is being accessed in the": {
            "content": "'turnred()' callback.  This field contains the widget that caught the X\nevent.  The following table lists the other event fields you can access,\nand how they are denoted in Tk, which can be useful when referring to\nthe Tk man pages.\n",
            "subsections": []
        },
        "Tk       Tkinter Event Field       Tk       Tkinter Event Field": {
            "content": "----------------------------------------------------------------------\n\n%f       focus                     %A       char\n\n\n%h       height                    %E       sendevent\n\n\n%k       keycode                   %K       keysym\n\n\n%s       state                     %N       keysymnum\n\n\n%t       time                      %T       type\n\n\n%w       width                     %W       widget\n\n\n%x       x                         %X       xroot\n\n\n%y       y                         %Y       yroot\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The index Parameter,  Next: Images,  Prev: Bindings and Events,  Up: Handy Reference": {
            "content": "5.25.1.18 The index Parameter\n.............................\n\nA number of widgets require \"index\" parameters to be passed.  These are\nused to point at a specific place in a Text widget, or to particular\ncharacters in an Entry widget, or to particular menu items in a Menu\nwidget.\n",
            "subsections": []
        },
        "Entry widget indexes (index, view index, etc.)": {
            "content": "Entry widgets have options that refer to character positions in the\ntext being displayed.  You can use these *note tkinter: ea.\nfunctions to access these special points in text widgets:\n",
            "subsections": []
        },
        "Text widget indexes": {
            "content": "The index notation for Text widgets is very rich and is best\ndescribed in the Tk man pages.\n",
            "subsections": []
        },
        "Menu indexes (menu.invoke(), menu.entryconfig(), etc.)": {
            "content": "Some options and methods for menus manipulate specific menu\nentries.  Anytime a menu index is needed for an option or a\nparameter, you may pass in:\n\n* an integer which refers to the numeric position of the entry\nin the widget, counted from the top, starting with 0;\n\n* the string '\"active\"', which refers to the menu position that\nis currently under the cursor;\n\n* the string '\"last\"' which refers to the last menu item;\n\n* An integer preceded by '@', as in '@6', where the integer is\ninterpreted as a y pixel coordinate in the menu's coordinate\nsystem;\n\n* the string '\"none\"', which indicates no menu entry at all,\nmost often used with menu.activate() to deactivate all\nentries, and finally,\n\n* a text string that is pattern matched against the label of the\nmenu entry, as scanned from the top of the menu to the bottom.\nNote that this index type is considered after all the others,\nwhich means that matches for menu items labelled 'last',\n'active', or 'none' may be interpreted as the above literals,\ninstead.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Images,  Prev: The index Parameter,  Up: Handy Reference": {
            "content": "5.25.1.19 Images\n................\n",
            "subsections": []
        },
        "Images of different formats can be created through the corresponding": {
            "content": "subclass of 'tkinter.Image':\n\n* 'BitmapImage' for images in XBM format.\n\n* 'PhotoImage' for images in PGM, PPM, GIF and PNG formats.  The\nlatter is supported starting with Tk 8.6.\n",
            "subsections": []
        },
        "Either type of image is created through either the 'file' or the 'data'": {
            "content": "option (other options are available as well).\n",
            "subsections": []
        },
        "The image object can then be used wherever an 'image' option is": {
            "content": "supported by some widget (e.g.  labels, buttons, menus).  In these\ncases, Tk will not keep a reference to the image.  When the last Python\nreference to the image object is deleted, the image data is deleted as\nwell, and Tk will display an empty box wherever the image was used.\n\nSee also\n........\n",
            "subsections": []
        },
        "The Pillow(1) package adds support for formats such as BMP, JPEG, TIFF,": {
            "content": "and WebP, among others.\n\n---------- Footnotes ----------\n\n(1) https://python-pillow.org/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: File Handlers,  Prev: Handy Reference,  Up: tkinter -- Python interface to Tcl/Tk": {
            "content": "5.25.1.20 File Handlers\n.......................\n",
            "subsections": []
        },
        "Tk allows you to register and unregister a callback function which will": {
            "content": "be called from the Tk mainloop when I/O is possible on a file\ndescriptor.  Only one handler may be registered per file descriptor.\nExample code:\n\nimport tkinter\nwidget = tkinter.Tk()\nmask = tkinter.READABLE | tkinter.WRITABLE\nwidget.tk.createfilehandler(file, mask, callback)\n...\nwidget.tk.deletefilehandler(file)\n\nThis feature is not available on Windows.\n",
            "subsections": []
        },
        "Since you don't know how many bytes are available for reading, you may": {
            "content": "not want to use the *note BufferedIOBase: 460. or *note TextIOBase: 461.\n*note read(): 11a0. or *note readline(): 11a1. methods, since these will\ninsist on reading a predefined number of bytes.  For sockets, the *note\nrecv(): c00. or *note recvfrom(): c01. methods will work fine; for other\nfiles, use raw reads or 'os.read(file.fileno(), maxbytecount)'.\n\n-- Method: Widget.tk.createfilehandler (file, mask, func)\n\nRegisters the file handler callback function 'func'.  The 'file'\nargument may either be an object with a *note fileno(): 2542.\nmethod (such as a file or socket object), or an integer file\ndescriptor.  The 'mask' argument is an ORed combination of any of\nthe three constants below.  The callback is called as follows:\n\ncallback(file, mask)\n\n-- Method: Widget.tk.deletefilehandler (file)\n\nUnregisters a file handler.\n\n-- Data: tkinter.READABLE\n-- Data: tkinter.WRITABLE\n-- Data: tkinter.EXCEPTION\n\nConstants used in the 'mask' arguments.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "'Source code:' Lib/tkinter/colorchooser.py(1)\n\n\n\nThe *note tkinter.colorchooser: eb. module provides the *note Chooser:\n3aa3. class as an interface to the native color picker dialog.\n'Chooser' implements a modal color choosing dialog window.  The\n'Chooser' class inherits from the *note Dialog: 3aa4. class.\n\n-- Class: tkinter.colorchooser.Chooser (master=None, options)\n\n-- Function: tkinter.colorchooser.askcolor (color=None, options)\n\nCreate a color choosing dialog.  A call to this method will show\nthe window, wait for the user to make a selection, and return the\nselected color (or 'None') to the caller.\n\nSee also\n........\n\nModule *note tkinter.commondialog: ec.\n\nTkinter standard dialog module\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/tkinter/colorchooser.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: tkinter font -- Tkinter font wrapper,  Next: Tkinter Dialogs,  Prev: tkinter colorchooser -- Color choosing dialog,  Up: Graphical User Interfaces with Tk": {
            "content": "'Source code:' Lib/tkinter/font.py(1)\n\n\n\nThe *note tkinter.font: ef. module provides the *note Font: 166f. class\nfor creating and using named fonts.\n\nThe different font weights and slants are:\n\n-- Data: tkinter.font.NORMAL\n-- Data: tkinter.font.BOLD\n-- Data: tkinter.font.ITALIC\n-- Data: tkinter.font.ROMAN\n\n-- Class: tkinter.font.Font (root=None, font=None, name=None,\nexists=False, options)\n\nThe *note Font: 166f. class represents a named font.  'Font'\ninstances are given unique names and can be specified by their\nfamily, size, and style configuration.  Named fonts are Tk's method\nof creating and identifying fonts as a single object, rather than\nspecifying a font by its attributes with each occurrence.\n\narguments:\n\n'font' - font specifier tuple (family, size, options)\n'name' - unique font name\n'exists' - self points to existing named font if true\n\nadditional keyword options (ignored if 'font' is specified):\n\n'family' - font family i.e. Courier, Times\n'size' - font size\nIf 'size' is positive it is interpreted as size in points.\nIf 'size' is a negative number its absolute value is treated\nas size in pixels.\n'weight' - font emphasis (NORMAL, BOLD)\n'slant' - ROMAN, ITALIC\n'underline' - font underlining (0 - none, 1 - underline)\n'overstrike' - font strikeout (0 - none, 1 - strikeout)\n\n-- Method: actual (option=None, displayof=None)\n\nReturn the attributes of the font.\n\n-- Method: cget (option)\n\nRetrieve an attribute of the font.\n\n-- Method: config (options)\n\nModify attributes of the font.\n\n-- Method: copy ()\n\nReturn new instance of the current font.\n\n-- Method: measure (text, displayof=None)\n\nReturn amount of space the text would occupy on the specified\ndisplay when formatted in the current font.  If no display is\nspecified then the main application window is assumed.\n\n-- Method: metrics (*options, kw)\n\nReturn font-specific data.  Options include:\n\n'ascent' - distance between baseline and highest point that a\n\ncharacter of the font can occupy\n\n'descent' - distance between baseline and lowest point that a\n\ncharacter of the font can occupy\n\n'linespace' - minimum vertical separation necessary between any two\n\ncharacters of the font that ensures no vertical overlap\nbetween lines.\n\n'fixed' - 1 if font is fixed-width else 0\n\n-- Function: tkinter.font.families (root=None, displayof=None)\n\nReturn the different font families.\n\n-- Function: tkinter.font.names (root=None)\n\nReturn the names of defined fonts.\n\n-- Function: tkinter.font.nametofont (name, root=None)\n\nReturn a *note Font: 166f. representation of a tk named font.\n\nChanged in version 3.10: The 'root' parameter was added.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/tkinter/font.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Tkinter Dialogs,  Next: tkinter messagebox -- Tkinter message prompts,  Prev: tkinter font -- Tkinter font wrapper,  Up: Graphical User Interfaces with Tk": {
            "content": "* Menu:\n\n* tkinter.simpledialog -- Standard Tkinter input dialogs: tkinter simpledialog -- Standard Tkinter input dialogs.\n* tkinter.filedialog -- File selection dialogs: tkinter filedialog -- File selection dialogs.\n* tkinter.commondialog -- Dialog window templates: tkinter commondialog -- Dialog window templates.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: tkinter simpledialog -- Standard Tkinter input dialogs,  Next: tkinter filedialog -- File selection dialogs,  Up: Tkinter Dialogs": {
            "content": "5.25.4.1 'tkinter.simpledialog' -- Standard Tkinter input dialogs\n................................................................\n\n'Source code:' Lib/tkinter/simpledialog.py(1)\n\n\n\nThe *note tkinter.simpledialog: f2. module contains convenience classes\nand functions for creating simple modal dialogs to get a value from the\nuser.\n\n-- Function: tkinter.simpledialog.askfloat (title, prompt, kw)\n-- Function: tkinter.simpledialog.askinteger (title, prompt, kw)\n-- Function: tkinter.simpledialog.askstring (title, prompt, kw)\n\nThe above three functions provide dialogs that prompt the user to\nenter a value of the desired type.\n\n-- Class: tkinter.simpledialog.Dialog (parent, title=None)\n\nThe base class for custom dialogs.\n\n-- Method: body (master)\n\nOverride to construct the dialog's interface and return the\nwidget that should have initial focus.\n\n-- Method: buttonbox ()\n\nDefault behaviour adds OK and Cancel buttons.  Override for\ncustom button layouts.\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/tkinter/simpledialog.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: tkinter filedialog -- File selection dialogs,  Next: tkinter commondialog -- Dialog window templates,  Prev: tkinter simpledialog -- Standard Tkinter input dialogs,  Up: Tkinter Dialogs": {
            "content": "5.25.4.2 'tkinter.filedialog' -- File selection dialogs\n......................................................\n\n'Source code:' Lib/tkinter/filedialog.py(1)\n\n\n\nThe *note tkinter.filedialog: ee. module provides classes and factory\nfunctions for creating file/directory selection windows.\n\n* Menu:\n\n* Native Load/Save Dialogs::\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/tkinter/filedialog.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Native Load/Save Dialogs,  Up: tkinter filedialog -- File selection dialogs": {
            "content": "5.25.4.3 Native Load/Save Dialogs\n.................................\n",
            "subsections": []
        },
        "The following classes and functions provide file dialog windows that": {
            "content": "combine a native look-and-feel with configuration options to customize\nbehaviour.  The following keyword arguments are applicable to the\nclasses and functions listed below:\n\n'parent' - the window to place the dialog on top of\n\n'title' - the title of the window\n\n'initialdir' - the directory that the dialog starts in\n\n'initialfile' - the file selected upon opening of the dialog\n\n'filetypes' - a sequence of (label, pattern) tuples, '*' wildcard is allowed\n\n'defaultextension' - default extension to append to file (save dialogs)\n\n'multiple' - when true, selection of multiple items is allowed\n\n'Static factory functions'\n",
            "subsections": []
        },
        "The below functions when called create a modal, native look-and-feel": {
            "content": "dialog, wait for the user's selection, then return the selected value(s)\nor 'None' to the caller.\n\n-- Function: tkinter.filedialog.askopenfile (mode='r', options)\n-- Function: tkinter.filedialog.askopenfiles (mode='r', options)\n\nThe above two functions create an *note Open: 3ac0. dialog and\nreturn the opened file object(s) in read-only mode.\n\n-- Function: tkinter.filedialog.asksaveasfile (mode='w', options)\n\nCreate a *note SaveAs: 3ac2. dialog and return a file object opened\nin write-only mode.\n\n-- Function: tkinter.filedialog.askopenfilename (options)\n-- Function: tkinter.filedialog.askopenfilenames (options)\n\nThe above two functions create an *note Open: 3ac0. dialog and\nreturn the selected filename(s) that correspond to existing\nfile(s).\n\n-- Function: tkinter.filedialog.asksaveasfilename (options)\n\nCreate a *note SaveAs: 3ac2. dialog and return the selected\nfilename.\n\n-- Function: tkinter.filedialog.askdirectory (options)\n\nPrompt user to select a directory.\nAdditional keyword option:\n'mustexist' - determines if selection must be an existing directory.\n\n-- Class: tkinter.filedialog.Open (master=None, options)\n-- Class: tkinter.filedialog.SaveAs (master=None, options)\n\nThe above two classes provide native dialog windows for saving and\nloading files.\n\n'Convenience classes'\n",
            "subsections": []
        },
        "The below classes are used for creating file/directory windows from": {
            "content": "scratch.  These do not emulate the native look-and-feel of the platform.\n\n-- Class: tkinter.filedialog.Directory (master=None, options)\n\nCreate a dialog prompting the user to select a directory.\n\nNote: The 'FileDialog' class should be subclassed for custom event\nhandling and behaviour.\n\n-- Class: tkinter.filedialog.FileDialog (master, title=None)\n\nCreate a basic file selection dialog.\n\n-- Method: cancelcommand (event=None)\n\nTrigger the termination of the dialog window.\n\n-- Method: dirsdoubleevent (event)\n\nEvent handler for double-click event on directory.\n\n-- Method: dirsselectevent (event)\n\nEvent handler for click event on directory.\n\n-- Method: filesdoubleevent (event)\n\nEvent handler for double-click event on file.\n\n-- Method: filesselectevent (event)\n\nEvent handler for single-click event on file.\n\n-- Method: filtercommand (event=None)\n\nFilter the files by directory.\n\n-- Method: getfilter ()\n\nRetrieve the file filter currently in use.\n\n-- Method: getselection ()\n\nRetrieve the currently selected item.\n\n-- Method: go (dirorfile=os.curdir, pattern='*', default='',\nkey=None)\n\nRender dialog and start event loop.\n\n-- Method: okevent (event)\n\nExit dialog returning current selection.\n\n-- Method: quit (how=None)\n\nExit dialog returning filename, if any.\n\n-- Method: setfilter (dir, pat)\n\nSet the file filter.\n\n-- Method: setselection (file)\n\nUpdate the current file selection to 'file'.\n\n-- Class: tkinter.filedialog.LoadFileDialog (master, title=None)\n\nA subclass of FileDialog that creates a dialog window for selecting\nan existing file.\n\n-- Method: okcommand ()\n\nTest that a file is provided and that the selection indicates\nan already existing file.\n\n-- Class: tkinter.filedialog.SaveFileDialog (master, title=None)\n\nA subclass of FileDialog that creates a dialog window for selecting\na destination file.\n\n-- Method: okcommand ()\n\nTest whether or not the selection points to a valid file that\nis not a directory.  Confirmation is required if an already\nexisting file is selected.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: tkinter commondialog -- Dialog window templates,  Prev: tkinter filedialog -- File selection dialogs,  Up: Tkinter Dialogs": {
            "content": "5.25.4.4 'tkinter.commondialog' -- Dialog window templates\n.........................................................\n\n'Source code:' Lib/tkinter/commondialog.py(1)\n\n\n\nThe *note tkinter.commondialog: ec. module provides the *note Dialog:\n3aa4. class that is the base class for dialogs defined in other\nsupporting modules.\n\n-- Class: tkinter.commondialog.Dialog (master=None, options)\n\n-- Method: show (color=None, options)\n\nRender the Dialog window.\n\nSee also\n........\n\nModules *note tkinter.messagebox: f0, *note Reading and Writing Files:\n1a04.\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/tkinter/commondialog.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: tkinter messagebox -- Tkinter message prompts,  Next: tkinter scrolledtext -- Scrolled Text Widget,  Prev: Tkinter Dialogs,  Up: Graphical User Interfaces with Tk": {
            "content": "'Source code:' Lib/tkinter/messagebox.py(1)\n\n\n\nThe *note tkinter.messagebox: f0. module provides a template base class\nas well as a variety of convenience methods for commonly used\nconfigurations.  The message boxes are modal and will return a subset of\n('True', 'False', 'None', *note OK: 3ade, *note CANCEL: 3adf, *note YES:\n3ae0, *note NO: 3ae1.) based on the user's selection.  Common message\nbox styles and layouts include but are not limited to:\n\n\n\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "'Source code:' Lib/tkinter/scrolledtext.py(1)\n\n\n\nThe *note tkinter.scrolledtext: f1. module provides a class of the same\nname which implements a basic text widget which has a vertical scroll\nbar configured to do the \"right thing.\" Using the *note ScrolledText:\n3afd. class is a lot easier than setting up a text widget and scroll bar\ndirectly.\n",
            "subsections": []
        },
        "The text widget and scrollbar are packed together in a 'Frame', and the": {
            "content": "methods of the 'Grid' and 'Pack' geometry managers are acquired from the\n'Frame' object.  This allows the *note ScrolledText: 3afd. widget to be\nused directly to achieve most normal geometry management behavior.\n",
            "subsections": []
        },
        "Should more specific control be necessary, the following attributes are": {
            "content": "available:\n\n-- Class: tkinter.scrolledtext.ScrolledText (master=None, kw)\n\n-- Attribute: frame\n\nThe frame which surrounds the text and scroll bar widgets.\n\n-- Attribute: vbar\n\nThe scroll bar widget.\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/tkinter/scrolledtext.py\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "'Source code:' Lib/tkinter/dnd.py(1)\n\n\n\nNote: This is experimental and due to be deprecated when it is\nreplaced with the Tk DND.\n\nThe *note tkinter.dnd: ed. module provides drag-and-drop support for\nobjects within a single application, within the same window or between\nwindows.  To enable an object to be dragged, you must create an event\nbinding for it that starts the drag-and-drop process.  Typically, you\nbind a ButtonPress event to a callback function that you write (see\n*note Bindings and Events: 3a96.).  The function should call *note\ndndstart(): 3b02, where 'source' is the object to be dragged, and\n'event' is the event that invoked the call (the argument to your\ncallback function).\n\nSelection of a target object occurs as follows:\n\n1. Top-down search of area under mouse for target widget\n\n* Target widget should have a callable 'dndaccept' attribute\n\n* If 'dndaccept' is not present or returns None, search moves\nto parent widget\n\n* If no target widget is found, then the target object is None\n\n2. Call to '<oldtarget>.dndleave(source, event)'\n\n3. Call to '<newtarget>.dndenter(source, event)'\n\n4. Call to '<target>.dndcommit(source, event)' to notify of drop\n\n5. Call to '<source>.dndend(target, event)' to signal end of\ndrag-and-drop\n\n-- Class: tkinter.dnd.DndHandler (source, event)\n\nThe 'DndHandler' class handles drag-and-drop events tracking Motion\nand ButtonRelease events on the root of the event widget.\n\n-- Method: cancel (event=None)\n\nCancel the drag-and-drop process.\n\n-- Method: finish (event, commit=0)\n\nExecute end of drag-and-drop functions.\n\n-- Method: onmotion (event)\n\nInspect area below mouse for target objects while drag is\nperformed.\n\n-- Method: onrelease (event)\n\nSignal end of drag when the release pattern is triggered.\n\n-- Function: tkinter.dnd.dndstart (source, event)\n\nFactory function for drag-and-drop process.\n\nSee also\n........\n\n*note Bindings and Events: 3a96.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/tkinter/dnd.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: tkinter ttk -- Tk themed widgets,  Next: tkinter tix -- Extension widgets for Tk,  Prev: tkinter dnd -- Drag and drop support,  Up: Graphical User Interfaces with Tk": {
            "content": "'Source code:' Lib/tkinter/ttk.py(1)\n\n\n\nThe *note tkinter.ttk: f4. module provides access to the Tk themed\nwidget set, introduced in Tk 8.5.  It provides additional benefits\nincluding anti-aliased font rendering under X11 and window transparency\n(requiring a composition window manager on X11).\n\nThe basic idea for *note tkinter.ttk: f4. is to separate, to the extent\npossible, the code implementing a widget's behavior from the code\nimplementing its appearance.\n\nSee also\n........\n",
            "subsections": []
        },
        "Tk Widget Styling Support(2)": {
            "content": "A document introducing theming support for Tk\n\n* Menu:\n\n* Using Ttk::\n* Ttk Widgets::\n* Widget::\n* Combobox::\n* Spinbox::\n* Notebook::\n* Progressbar::\n* Separator::\n* Sizegrip::\n* Treeview::\n* Ttk Styling::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/tkinter/ttk.py\n\n(2) https://core.tcl.tk/tips/doc/trunk/tip/48.md\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using Ttk,  Next: Ttk Widgets,  Up: tkinter ttk -- Tk themed widgets": {
            "content": "5.25.8.1 Using Ttk\n..................\n\nTo start using Ttk, import its module:\n\nfrom tkinter import ttk\n",
            "subsections": []
        },
        "To override the basic Tk widgets, the import should follow the Tk": {
            "content": "import:\n\nfrom tkinter import *\nfrom tkinter.ttk import *\n\nThat code causes several *note tkinter.ttk: f4. widgets ('Button',\n'Checkbutton', 'Entry', 'Frame', 'Label', 'LabelFrame', 'Menubutton',\n'PanedWindow', 'Radiobutton', 'Scale' and 'Scrollbar') to automatically\nreplace the Tk widgets.\n",
            "subsections": []
        },
        "This has the direct benefit of using the new widgets which gives a": {
            "content": "better look and feel across platforms; however, the replacement widgets\nare not completely compatible.  The main difference is that widget\noptions such as \"fg\", \"bg\" and others related to widget styling are no\nlonger present in Ttk widgets.  Instead, use the 'ttk.Style' class for\nimproved styling effects.\n\nSee also\n........\n",
            "subsections": []
        },
        "Converting existing applications to use Tile widgets(1)": {
            "content": "A monograph (using Tcl terminology) about differences typically\nencountered when moving applications to use the new widgets.\n\n---------- Footnotes ----------\n\n(1) https://tktable.sourceforge.net/tile/doc/converting.txt\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Ttk Widgets,  Next: Widget,  Prev: Using Ttk,  Up: tkinter ttk -- Tk themed widgets": {
            "content": "5.25.8.2 Ttk Widgets\n....................\n\nTtk comes with 18 widgets, twelve of which already existed in tkinter:\n'Button', 'Checkbutton', 'Entry', 'Frame', 'Label', 'LabelFrame',\n'Menubutton', 'PanedWindow', 'Radiobutton', 'Scale', 'Scrollbar', and\n*note Spinbox: 9d7.  The other six are new: *note Combobox: 3b0c, *note\nNotebook: 3b0d, *note Progressbar: 3b0e, 'Separator', 'Sizegrip' and\n*note Treeview: 8c6.  And all them are subclasses of *note Widget: 3b0f.\n\nUsing the Ttk widgets gives the application an improved look and feel.\nAs discussed above, there are differences in how the styling is coded.\n\nTk code:\n\nl1 = tkinter.Label(text=\"Test\", fg=\"black\", bg=\"white\")\nl2 = tkinter.Label(text=\"Test\", fg=\"black\", bg=\"white\")\n\nTtk code:\n\nstyle = ttk.Style()\nstyle.configure(\"BW.TLabel\", foreground=\"black\", background=\"white\")\n\nl1 = ttk.Label(text=\"Test\", style=\"BW.TLabel\")\nl2 = ttk.Label(text=\"Test\", style=\"BW.TLabel\")\n\nFor more information about *note TtkStyling: 3b10, see the *note Style:\n3b11. class documentation.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Widget,  Next: Combobox,  Prev: Ttk Widgets,  Up: tkinter ttk -- Tk themed widgets": {
            "content": "5.25.8.3 Widget\n...............\n\n'ttk.Widget' defines standard options and methods supported by Tk themed\nwidgets and is not supposed to be directly instantiated.\n\n* Menu:\n\n* Standard Options::\n* Scrollable Widget Options::\n* Label Options::\n* Compatibility Options::\n* Widget States::\n* ttk.Widget: ttk Widget.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Standard Options,  Next: Scrollable Widget Options,  Up: Widget": {
            "content": "5.25.8.4 Standard Options\n.........................\n\nAll the 'ttk' Widgets accept the following options:\n",
            "subsections": []
        },
        "Option          Description": {
            "content": "-----------------------------------------------------------------------------------\n\nstate           Either \"normal\", \"disabled\" or \"hidden\".  If \"disabled\", then\nthe tab is not selectable.  If \"hidden\", then the tab is not\nshown.\n\n\nsticky          Specifies how the child window is positioned within the pane\narea.  Value is a string containing zero or more of the\ncharacters \"n\", \"s\", \"e\" or \"w\".  Each letter refers to a side\n(north, south, east or west) that the child window will stick\nto, as per the 'grid()' geometry manager.\n\n\npadding         Specifies the amount of extra space to add between the notebook\nand this pane.  Syntax is the same as for the option padding\nused by this widget.\n\n\ntext            Specifies a text to be displayed in the tab.\n\n\nimage           Specifies an image to display in the tab.  See the option image\ndescribed in *note Widget: 3b0f.\n\n\ncompound        Specifies how to display the image relative to the text, in the\ncase both options text and image are present.  See\n*note Label Options: 3b15. for legal values.\n\n\nunderline       Specifies the index (0-based) of a character to underline in the\ntext string.  The underlined character is used for mnemonic\nactivation if *note Notebook.enabletraversal(): 3b2c. is\ncalled.\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Scrollable Widget Options,  Next: Label Options,  Prev: Standard Options,  Up: Widget": {
            "content": "5.25.8.5 Scrollable Widget Options\n..................................\n",
            "subsections": []
        },
        "The following options are supported by widgets that are controlled by a": {
            "content": "scrollbar.\n",
            "subsections": []
        },
        "Option               Description": {
            "content": "----------------------------------------------------------------------------------\n\ncolumns              A list of column identifiers, specifying the number of\ncolumns and their names.\n\n\ndisplaycolumns       A list of column identifiers (either symbolic or integer\nindices) specifying which data columns are displayed and\nthe order in which they appear, or the string \"#all\".\n\n\nheight               Specifies the number of rows which should be visible.\nNote: the requested width is determined from the sum of\nthe column widths.\n\n\npadding              Specifies the internal padding for the widget.  The\npadding is a list of up to four length specifications.\n\n\nselectmode           Controls how the built-in class bindings manage the\nselection.  One of \"extended\", \"browse\" or \"none\".  If set\nto \"extended\" (the default), multiple items may be\nselected.  If \"browse\", only a single item will be\nselected at a time.  If \"none\", the selection will not be\nchanged.\n\nNote that the application code and tag bindings can set\nthe selection however they wish, regardless of the value\nof this option.\n\n\nshow                 A list containing zero or more of the following values,\nspecifying which elements of the tree to display.\n\n* tree: display tree labels in column #0.\n\n* headings: display the heading row.\n\nThe default is \"tree headings\", i.e., show all elements.\n\n'Note': Column #0 always refers to the tree column, even\nif show=\"tree\" is not specified.\n\n\nFile: python3.12.info,  Node: Item Options,  Next: Tag Options,  Prev: Options<6>,  Up: Treeview\n\n5.25.8.34 Item Options\n......................\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Label Options,  Next: Compatibility Options,  Prev: Scrollable Widget Options,  Up: Widget": {
            "content": "5.25.8.6 Label Options\n......................\n",
            "subsections": []
        },
        "The following options are supported by labels, buttons and other": {
            "content": "button-like widgets.\n",
            "subsections": []
        },
        "Option             Description": {
            "content": "-----------------------------------------------------------------------------------\n\ntext               Specifies a text string to be displayed inside the widget.\n\n\ntextvariable       Specifies a name whose value will be used in place of the\ntext option resource.\n\n\nunderline          If set, specifies the index (0-based) of a character to\nunderline in the text string.  The underline character is\nused for mnemonic activation.\n\n\nimage              Specifies an image to display.  This is a list of 1 or more\nelements.  The first element is the default image name.  The\nrest of the list if a sequence of statespec/value pairs as\ndefined by *note Style.map(): 1682, specifying different\nimages to use when the widget is in a particular state or a\ncombination of states.  All images in the list should have\nthe same size.\n\n\ncompound           Specifies how to display the image relative to the text, in\nthe case both text and images options are present.  Valid\nvalues are:\n\n* text: display text only\n\n* image: display image only\n\n* top, bottom, left, right: display image above, below,\nleft of, or right of the text, respectively.\n\n* none: the default.  display the image if present,\notherwise the text.\n\n\nwidth              If greater than zero, specifies how much space, in character\nwidths, to allocate for the text label, if less than zero,\nspecifies a minimum width.  If zero or unspecified, the\nnatural width of the text label is used.\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Compatibility Options,  Next: Widget States,  Prev: Label Options,  Up: Widget": {
            "content": "5.25.8.7 Compatibility Options\n..............................\n",
            "subsections": []
        },
        "Option       Description": {
            "content": "---------------------------------------------------------------------------------\n\ntext         The textual label to display for the item.\n\n\nimage        A Tk Image, displayed to the left of the label.\n\n\nvalues       The list of values associated with the item.\n\nEach item should have the same number of values as the widget\noption columns.  If there are fewer values than columns, the\nremaining values are assumed empty.  If there are more values\nthan columns, the extra values are ignored.\n\n\nopen         'True'/'False' value indicating whether the item's children\nshould be displayed or hidden.\n\n\ntags         A list of tags associated with this item.\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Widget States,  Next: ttk Widget,  Prev: Compatibility Options,  Up: Widget": {
            "content": "5.25.8.8 Widget States\n......................\n\nThe widget state is a bitmap of independent state flags.\n",
            "subsections": []
        },
        "Flag             Description": {
            "content": "-----------------------------------------------------------------------------------\n\nactive           The mouse cursor is over the widget and pressing a mouse button\nwill cause some action to occur\n\n\ndisabled         Widget is disabled under program control\n\n\nfocus            Widget has keyboard focus\n\n\npressed          Widget is being pressed\n\n\nselected         \"On\", \"true\", or \"current\" for things like Checkbuttons and\nradiobuttons\n\n\nbackground       Windows and Mac have a notion of an \"active\" or foreground\nwindow.  The 'background' state is set for widgets in a\nbackground window, and cleared for those in the foreground\nwindow\n\n\nreadonly         Widget should not allow user modification\n\n\nalternate        A widget-specific alternate display format\n\n\ninvalid          The widget's value is invalid\n\n\nA state specification is a sequence of state names, optionally prefixed\nwith an exclamation point indicating that the bit is off.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ttk Widget,  Prev: Widget States,  Up: Widget": {
            "content": "5.25.8.9 ttk.Widget\n...................\n",
            "subsections": []
        },
        "Besides the methods described below, the 'ttk.Widget' supports the": {
            "content": "methods 'tkinter.Widget.cget()' and 'tkinter.Widget.configure()'.\n\n-- Class: tkinter.ttk.Widget\n\n-- Method: identify (x, y)\n\nReturns the name of the element at position 'x' 'y', or the\nempty string if the point does not lie within any element.\n\n'x' and 'y' are pixel coordinates relative to the widget.\n\n-- Method: instate (statespec, callback=None, *args, kw)\n\nTest the widget's state.  If a callback is not specified,\nreturns 'True' if the widget state matches 'statespec' and\n'False' otherwise.  If callback is specified then it is called\nwith args if widget state matches 'statespec'.\n\n-- Method: state (statespec=None)\n\nModify or inquire widget state.  If 'statespec' is specified,\nsets the widget state according to it and return a new\n'statespec' indicating which flags were changed.  If\n'statespec' is not specified, returns the currently enabled\nstate flags.\n\n'statespec' will usually be a list or a tuple.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Combobox,  Next: Spinbox,  Prev: Widget,  Up: tkinter ttk -- Tk themed widgets": {
            "content": "5.25.8.10 Combobox\n..................\n",
            "subsections": []
        },
        "The 'ttk.Combobox' widget combines a text field with a pop-down list of": {
            "content": "values.  This widget is a subclass of 'Entry'.\n\nBesides the methods inherited from *note Widget: 3b0f.: 'Widget.cget()',\n'Widget.configure()', *note Widget.identify(): 3b1a, *note\nWidget.instate(): 3b1b. and *note Widget.state(): 3b17, and the\nfollowing inherited from 'Entry': 'Entry.bbox()', 'Entry.delete()',\n'Entry.icursor()', 'Entry.index()', 'Entry.insert()',\n'Entry.selection()', 'Entry.xview()', it has some other methods,\ndescribed at 'ttk.Combobox'.\n\n* Menu:\n\n* Options::\n* Virtual events::\n* ttk.Combobox: ttk Combobox.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Options,  Next: Virtual events,  Up: Combobox": {
            "content": "5.25.8.11 Options\n.................\n\nThis widget accepts the following specific options:\n",
            "subsections": []
        },
        "Option                Description": {
            "content": "-----------------------------------------------------------------------------------\n\nexportselection       Boolean value.  If set, the widget selection is linked to\nthe Window Manager selection (which can be returned by\ninvoking Misc.selectionget, for example).\n\n\njustify               Specifies how the text is aligned within the widget.  One\nof \"left\", \"center\", or \"right\".\n\n\nheight                Specifies the height of the pop-down listbox, in rows.\n\n\npostcommand           A script (possibly registered with Misc.register) that is\ncalled immediately before displaying the values.  It may\nspecify which values to display.\n\n\nstate                 One of \"normal\", \"readonly\", or \"disabled\".  In the\n\"readonly\" state, the value may not be edited directly,\nand the user can only selection of the values from the\ndropdown list.  In the \"normal\" state, the text field is\ndirectly editable.  In the \"disabled\" state, no\ninteraction is possible.\n\n\ntextvariable          Specifies a name whose value is linked to the widget\nvalue.  Whenever the value associated with that name\nchanges, the widget value is updated, and vice versa.  See\n'tkinter.StringVar'.\n\n\nvalues                Specifies the list of values to display in the drop-down\nlistbox.\n\n\nwidth                 Specifies an integer value indicating the desired width of\nthe entry window, in average-size characters of the\nwidget's font.\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Virtual events,  Next: ttk Combobox,  Prev: Options,  Up: Combobox": {
            "content": "5.25.8.12 Virtual events\n........................\n\nThe combobox widgets generates a '<<ComboboxSelected>>' virtual event\nwhen the user selects an element from the list of values.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ttk Combobox,  Prev: Virtual events,  Up: Combobox": {
            "content": "5.25.8.13 ttk.Combobox\n......................\n\n-- Class: tkinter.ttk.Combobox\n\n-- Method: current (newindex=None)\n\nIf 'newindex' is specified, sets the combobox value to the\nelement position 'newindex'.  Otherwise, returns the index of\nthe current value or -1 if the current value is not in the\nvalues list.\n\n-- Method: get ()\n\nReturns the current value of the combobox.\n\n-- Method: set (value)\n\nSets the value of the combobox to 'value'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Spinbox,  Next: Notebook,  Prev: Combobox,  Up: tkinter ttk -- Tk themed widgets": {
            "content": "5.25.8.14 Spinbox\n.................\n",
            "subsections": []
        },
        "The 'ttk.Spinbox' widget is a 'ttk.Entry' enhanced with increment and": {
            "content": "decrement arrows.  It can be used for numbers or lists of string values.\nThis widget is a subclass of 'Entry'.\n\nBesides the methods inherited from *note Widget: 3b0f.: 'Widget.cget()',\n'Widget.configure()', *note Widget.identify(): 3b1a, *note\nWidget.instate(): 3b1b. and *note Widget.state(): 3b17, and the\nfollowing inherited from 'Entry': 'Entry.bbox()', 'Entry.delete()',\n'Entry.icursor()', 'Entry.index()', 'Entry.insert()', 'Entry.xview()',\nit has some other methods, described at 'ttk.Spinbox'.\n\n* Menu:\n\n* Options: Options<2>.\n* Virtual events: Virtual events<2>.\n* ttk.Spinbox: ttk Spinbox.\n\nFile: python3.12.info,  Node: Options<2>,  Next: Virtual events<2>,  Up: Spinbox\n\n5.25.8.15 Options\n.................\n\nThis widget accepts the following specific options:\n",
            "subsections": []
        },
        "Option                     Description": {
            "content": "--------------------------------------------------------------------------------------\n\nfrom                       Float value.  If set, this is the minimum value to which\nthe decrement button will decrement.  Must be spelled as\n'from' when used as an argument, since 'from' is a\nPython keyword.\n\n\nto                         Float value.  If set, this is the maximum value to which\nthe increment button will increment.\n\n\nincrement                  Float value.  Specifies the amount which the\nincrement/decrement buttons change the value.  Defaults\nto 1.0.\n\n\nvalues                     Sequence of string or float values.  If specified, the\nincrement/decrement buttons will cycle through the items\nin this sequence rather than incrementing or\ndecrementing numbers.\n\n\nwrap                       Boolean value.  If 'True', increment and decrement\nbuttons will cycle from the 'to' value to the 'from'\nvalue or the 'from' value to the 'to' value,\nrespectively.\n\n\nformat                     String value.  This specifies the format of numbers set\nby the increment/decrement buttons.  It must be in the\nform \"%W.Pf\", where W is the padded width of the value,\nP is the precision, and '%' and 'f' are literal.\n\n\ncommand                    Python callable.  Will be called with no arguments\nwhenever either of the increment or decrement buttons\nare pressed.\n\n\nFile: python3.12.info,  Node: Virtual events<2>,  Next: ttk Spinbox,  Prev: Options<2>,  Up: Spinbox\n\n5.25.8.16 Virtual events\n........................\n\nThe spinbox widget generates an '<<Increment>>' virtual event when the\nuser presses <Up>, and a '<<Decrement>>' virtual event when the user\npresses <Down>.\n\nFile: python3.12.info,  Node: ttk Spinbox,  Prev: Virtual events<2>,  Up: Spinbox\n\n5.25.8.17 ttk.Spinbox\n.....................\n\n-- Class: tkinter.ttk.Spinbox\n\n-- Method: get ()\n\nReturns the current value of the spinbox.\n\n-- Method: set (value)\n\nSets the value of the spinbox to 'value'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Notebook,  Next: Progressbar,  Prev: Spinbox,  Up: tkinter ttk -- Tk themed widgets": {
            "content": "5.25.8.18 Notebook\n..................\n",
            "subsections": []
        },
        "Ttk Notebook widget manages a collection of windows and displays a": {
            "content": "single one at a time.  Each child window is associated with a tab, which\nthe user may select to change the currently displayed window.\n\n* Menu:\n\n* Options: Options<3>.\n* Tab Options::\n* Tab Identifiers::\n* Virtual Events::\n* ttk.Notebook: ttk Notebook.\n\nFile: python3.12.info,  Node: Options<3>,  Next: Tab Options,  Up: Notebook\n\n5.25.8.19 Options\n.................\n\nThis widget accepts the following specific options:\n",
            "subsections": []
        },
        "Option        Description": {
            "content": "-----------------------------------------------------------------------------------\n\nheight        If present and greater than zero, specifies the desired height of\nthe pane area (not including internal padding or tabs).\nOtherwise, the maximum height of all panes is used.\n\n\npadding       Specifies the amount of extra space to add around the outside of\nthe notebook.  The padding is a list up to four length\nspecifications left top right bottom.  If fewer than four elements\nare specified, bottom defaults to top, right defaults to left, and\ntop defaults to left.\n\n\nwidth         If present and greater than zero, specified the desired width of\nthe pane area (not including internal padding).  Otherwise, the\nmaximum width of all panes is used.\n\n\nFile: python3.12.info,  Node: Tab Options,  Next: Tab Identifiers,  Prev: Options<3>,  Up: Notebook\n\n5.25.8.20 Tab Options\n.....................\n\nThere are also specific options for tabs:\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Tab Identifiers,  Next: Virtual Events,  Prev: Tab Options,  Up: Notebook": {
            "content": "5.25.8.21 Tab Identifiers\n.........................\n",
            "subsections": []
        },
        "The tabid present in several methods of 'ttk.Notebook' may take any of": {
            "content": "the following forms:\n\n* An integer between zero and the number of tabs\n\n* The name of a child window\n\n* A positional specification of the form \"@x,y\", which identifies the\ntab\n\n* The literal string \"current\", which identifies the currently\nselected tab\n\n* The literal string \"end\", which returns the number of tabs (only\nvalid for *note Notebook.index(): 3b2e.)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Virtual Events,  Next: ttk Notebook,  Prev: Tab Identifiers,  Up: Notebook": {
            "content": "5.25.8.22 Virtual Events\n........................\n\nThis widget generates a '<<NotebookTabChanged>>' virtual event after a\nnew tab is selected.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ttk Notebook,  Prev: Virtual Events,  Up: Notebook": {
            "content": "5.25.8.23 ttk.Notebook\n......................\n\n-- Class: tkinter.ttk.Notebook\n\n-- Method: add (child, kw)\n\nAdds a new tab to the notebook.\n\nIf window is currently managed by the notebook but hidden, it\nis restored to its previous position.\n\nSee *note Tab Options: 3b2b. for the list of available\noptions.\n\n-- Method: forget (tabid)\n\nRemoves the tab specified by 'tabid', unmaps and unmanages\nthe associated window.\n\n-- Method: hide (tabid)\n\nHides the tab specified by 'tabid'.\n\nThe tab will not be displayed, but the associated window\nremains managed by the notebook and its configuration\nremembered.  Hidden tabs may be restored with the *note add():\n3b31. command.\n\n-- Method: identify (x, y)\n\nReturns the name of the tab element at position 'x', 'y', or\nthe empty string if none.\n\n-- Method: index (tabid)\n\nReturns the numeric index of the tab specified by 'tabid', or\nthe total number of tabs if 'tabid' is the string \"end\".\n\n-- Method: insert (pos, child, kw)\n\nInserts a pane at the specified position.\n\n'pos' is either the string \"end\", an integer index, or the\nname of a managed child.  If 'child' is already managed by the\nnotebook, moves it to the specified position.\n\nSee *note Tab Options: 3b2b. for the list of available\noptions.\n\n-- Method: select (tabid=None)\n\nSelects the specified 'tabid'.\n\nThe associated child window will be displayed, and the\npreviously selected window (if different) is unmapped.  If\n'tabid' is omitted, returns the widget name of the currently\nselected pane.\n\n-- Method: tab (tabid, option=None, kw)\n\nQuery or modify the options of the specific 'tabid'.\n\nIf 'kw' is not given, returns a dictionary of the tab option\nvalues.  If 'option' is specified, returns the value of that\n'option'.  Otherwise, sets the options to the corresponding\nvalues.\n\n-- Method: tabs ()\n\nReturns a list of windows managed by the notebook.\n\n-- Method: enabletraversal ()\n\nEnable keyboard traversal for a toplevel window containing\nthis notebook.\n\nThis will extend the bindings for the toplevel window\ncontaining the notebook as follows:\n\n* 'Control-Tab': selects the tab following the currently\nselected one.\n\n* 'Shift-Control-Tab': selects the tab preceding the\ncurrently selected one.\n\n* 'Alt-K': where 'K' is the mnemonic (underlined) character\nof any tab, will select that tab.\n\nMultiple notebooks in a single toplevel may be enabled for\ntraversal, including nested notebooks.  However, notebook\ntraversal only works properly if all panes have the notebook\nthey are in as master.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Progressbar,  Next: Separator,  Prev: Notebook,  Up: tkinter ttk -- Tk themed widgets": {
            "content": "5.25.8.24 Progressbar\n.....................\n",
            "subsections": []
        },
        "The 'ttk.Progressbar' widget shows the status of a long-running": {
            "content": "operation.  It can operate in two modes: 1) the determinate mode which\nshows the amount completed relative to the total amount of work to be\ndone and 2) the indeterminate mode which provides an animated display to\nlet the user know that work is progressing.\n\n* Menu:\n\n* Options: Options<4>.\n* ttk.Progressbar: ttk Progressbar.\n\nFile: python3.12.info,  Node: Options<4>,  Next: ttk Progressbar,  Up: Progressbar\n\n5.25.8.25 Options\n.................\n\nThis widget accepts the following specific options:\n",
            "subsections": []
        },
        "Option         Description": {
            "content": "-----------------------------------------------------------------------------------\n\norient         One of \"horizontal\" or \"vertical\".  Specifies the orientation of\nthe progress bar.\n\n\nlength         Specifies the length of the long axis of the progress bar (width\nif horizontal, height if vertical).\n\n\nmode           One of \"determinate\" or \"indeterminate\".\n\n\nmaximum        A number specifying the maximum value.  Defaults to 100.\n\n\nvalue          The current value of the progress bar.  In \"determinate\" mode,\nthis represents the amount of work completed.  In \"indeterminate\"\nmode, it is interpreted as modulo 'maximum'; that is, the\nprogress bar completes one \"cycle\" when its value increases by\n'maximum'.\n\n\nvariable       A name which is linked to the option value.  If specified, the\nvalue of the progress bar is automatically set to the value of\nthis name whenever the latter is modified.\n\n\nphase          Read-only option.  The widget periodically increments the value\nof this option whenever its value is greater than 0 and, in\ndeterminate mode, less than maximum.  This option may be used by\nthe current theme to provide additional animation effects.\n\n\nFile: python3.12.info,  Node: ttk Progressbar,  Prev: Options<4>,  Up: Progressbar\n\n5.25.8.26 ttk.Progressbar\n.........................\n\n-- Class: tkinter.ttk.Progressbar\n\n-- Method: start (interval=None)\n\nBegin autoincrement mode: schedules a recurring timer event\nthat calls *note Progressbar.step(): 3b3d. every 'interval'\nmilliseconds.  If omitted, 'interval' defaults to 50\nmilliseconds.\n\n-- Method: step (amount=None)\n\nIncrements the progress bar's value by 'amount'.\n\n'amount' defaults to 1.0 if omitted.\n\n-- Method: stop ()\n\nStop autoincrement mode: cancels any recurring timer event\ninitiated by *note Progressbar.start(): 3b3c. for this\nprogress bar.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Separator,  Next: Sizegrip,  Prev: Progressbar,  Up: tkinter ttk -- Tk themed widgets": {
            "content": "5.25.8.27 Separator\n...................\n",
            "subsections": []
        },
        "The 'ttk.Separator' widget displays a horizontal or vertical separator": {
            "content": "bar.\n\nIt has no other methods besides the ones inherited from 'ttk.Widget'.\n\n* Menu:\n\n* Options: Options<5>.\n\nFile: python3.12.info,  Node: Options<5>,  Up: Separator\n\n5.25.8.28 Options\n.................\n\nThis widget accepts the following specific option:\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Sizegrip,  Next: Treeview,  Prev: Separator,  Up: tkinter ttk -- Tk themed widgets": {
            "content": "5.25.8.29 Sizegrip\n..................\n",
            "subsections": []
        },
        "The 'ttk.Sizegrip' widget (also known as a grow box) allows the user to": {
            "content": "resize the containing toplevel window by pressing and dragging the grip.\n",
            "subsections": []
        },
        "This widget has neither specific options nor specific methods, besides": {
            "content": "the ones inherited from 'ttk.Widget'.\n\n* Menu:\n\n* Platform-specific notes::\n* Bugs::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Platform-specific notes,  Next: Bugs,  Up: Sizegrip": {
            "content": "5.25.8.30 Platform-specific notes\n.................................\n\n* On macOS, toplevel windows automatically include a built-in size\ngrip by default.  Adding a 'Sizegrip' is harmless, since the\nbuilt-in grip will just mask the widget.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Bugs,  Prev: Platform-specific notes,  Up: Sizegrip": {
            "content": "5.25.8.31 Bugs\n..............\n\n* If the containing toplevel's position was specified relative to the\nright or bottom of the screen (e.g.  ....), the 'Sizegrip' widget\nwill not resize the window.\n\n* This widget supports only \"southeast\" resizing.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Treeview,  Next: Ttk Styling,  Prev: Sizegrip,  Up: tkinter ttk -- Tk themed widgets": {
            "content": "5.25.8.32 Treeview\n..................\n\nThe 'ttk.Treeview' widget displays a hierarchical collection of items.",
            "subsections": []
        },
        "Each item has a textual label, an optional image, and an optional list": {
            "content": "of data values.  The data values are displayed in successive columns\nafter the tree label.\n",
            "subsections": []
        },
        "The order in which data values are displayed may be controlled by": {
            "content": "setting the widget option 'displaycolumns'.  The tree widget can also\ndisplay column headings.  Columns may be accessed by number or symbolic\nnames listed in the widget option columns.  See *note Column\nIdentifiers: 3b45.\n",
            "subsections": []
        },
        "Each item is identified by a unique name.  The widget will generate item": {
            "content": "IDs if they are not supplied by the caller.  There is a distinguished\nroot item, named '{}'.  The root item itself is not displayed; its\nchildren appear at the top level of the hierarchy.\n",
            "subsections": []
        },
        "Each item also has a list of tags, which can be used to associate event": {
            "content": "bindings with individual items and control the appearance of the item.\n",
            "subsections": []
        },
        "The Treeview widget supports horizontal and vertical scrolling,": {
            "content": "according to the options described in *note Scrollable Widget Options:\n3b14. and the methods *note Treeview.xview(): 3b46. and *note\nTreeview.yview(): 3b47.\n\n* Menu:\n\n* Options: Options<6>.\n* Item Options::\n* Tag Options::\n* Column Identifiers::\n* Virtual Events: Virtual Events<2>.\n* ttk.Treeview: ttk Treeview.\n\nFile: python3.12.info,  Node: Options<6>,  Next: Item Options,  Up: Treeview\n\n5.25.8.33 Options\n.................\n\nThis widget accepts the following specific options:\n",
            "subsections": []
        },
        "The following item options may be specified for items in the insert and": {
            "content": "item widget commands.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Tag Options,  Next: Column Identifiers,  Prev: Item Options,  Up: Treeview": {
            "content": "5.25.8.35 Tag Options\n.....................\n\nThe following options may be specified on tags:\n",
            "subsections": []
        },
        "Option           Description": {
            "content": "---------------------------------------------------------------------------------\n\nforeground       Specifies the text foreground color.\n\n\nbackground       Specifies the cell or item background color.\n\n\nfont             Specifies the font to use when drawing text.\n\n\nimage            Specifies the item image, in case the item's image option is\nempty.\n\n\nFile: python3.12.info,  Node: Column Identifiers,  Next: Virtual Events<2>,  Prev: Tag Options,  Up: Treeview\n\n5.25.8.36 Column Identifiers\n............................\n\nColumn identifiers take any of the following forms:\n\n* A symbolic name from the list of columns option.\n\n* An integer n, specifying the nth data column.\n\n* A string of the form #n, where n is an integer, specifying the nth\ndisplay column.\n\nNotes:\n\n* Item's option values may be displayed in a different order than the\norder in which they are stored.\n\n* Column #0 always refers to the tree column, even if show=\"tree\" is\nnot specified.\n\nA data column number is an index into an item's option values list; a\ndisplay column number is the column number in the tree where the values\nare displayed.  Tree labels are displayed in column #0.  If option\ndisplaycolumns is not set, then data column n is displayed in column\n#n+1.  Again, 'column #0 always refers to the tree column'.\n\nFile: python3.12.info,  Node: Virtual Events<2>,  Next: ttk Treeview,  Prev: Column Identifiers,  Up: Treeview\n\n5.25.8.37 Virtual Events\n........................\n\nThe Treeview widget generates the following virtual events.\n",
            "subsections": []
        },
        "Event                    Description": {
            "content": "--------------------------------------------------------------------------------\n\n<<TreeviewSelect>>       Generated whenever the selection changes.\n\n\n<<TreeviewOpen>>         Generated just before settings the focus item to\nopen=True.\n\n\n<<TreeviewClose>>        Generated just after setting the focus item to\nopen=False.\n\n\nThe *note Treeview.focus(): 3b4c. and *note Treeview.selection(): 8c5.\nmethods can be used to determine the affected item or items.\n\nFile: python3.12.info,  Node: ttk Treeview,  Prev: Virtual Events<2>,  Up: Treeview\n\n5.25.8.38 ttk.Treeview\n......................\n\n-- Class: tkinter.ttk.Treeview\n\n-- Method: bbox (item, column=None)\n\nReturns the bounding box (relative to the treeview widget's\nwindow) of the specified 'item' in the form (x, y, width,\nheight).\n\nIf 'column' is specified, returns the bounding box of that\ncell.  If the 'item' is not visible (i.e., if it is a\ndescendant of a closed item or is scrolled offscreen), returns\nan empty string.\n\n-- Method: getchildren (item=None)\n\nReturns the list of children belonging to 'item'.\n\nIf 'item' is not specified, returns root children.\n\n-- Method: setchildren (item, *newchildren)\n\nReplaces 'item''s child with 'newchildren'.\n\nChildren present in 'item' that are not present in\n'newchildren' are detached from the tree.  No items in\n'newchildren' may be an ancestor of 'item'.  Note that not\nspecifying 'newchildren' results in detaching 'item''s\nchildren.\n\n-- Method: column (column, option=None, kw)\n\nQuery or modify the options for the specified 'column'.\n\nIf 'kw' is not given, returns a dict of the column option\nvalues.  If 'option' is specified then the value for that\n'option' is returned.  Otherwise, sets the options to the\ncorresponding values.\n\nThe valid options/values are:\n\n'id'\n\nReturns the column name.  This is a read-only option.\n\n'anchor': One of the standard Tk anchor values.\n\nSpecifies how the text in this column should be aligned\nwith respect to the cell.\n\n'minwidth': width\n\nThe minimum width of the column in pixels.  The treeview\nwidget will not make the column any smaller than\nspecified by this option when the widget is resized or\nthe user drags a column.\n\n'stretch': 'True'/'False'\n\nSpecifies whether the column's width should be adjusted\nwhen the widget is resized.\n\n'width': width\n\nThe width of the column in pixels.\n\nTo configure the tree column, call this with column = \"#0\"\n\n-- Method: delete (*items)\n\nDelete all specified 'items' and all their descendants.\n\nThe root item may not be deleted.\n\n-- Method: detach (*items)\n\nUnlinks all of the specified 'items' from the tree.\n\nThe items and all of their descendants are still present, and\nmay be reinserted at another point in the tree, but will not\nbe displayed.\n\nThe root item may not be detached.\n\n-- Method: exists (item)\n\nReturns 'True' if the specified 'item' is present in the tree.\n\n-- Method: focus (item=None)\n\nIf 'item' is specified, sets the focus item to 'item'.\nOtherwise, returns the current focus item, or '' if there is\nnone.\n\n-- Method: heading (column, option=None, kw)\n\nQuery or modify the heading options for the specified\n'column'.\n\nIf 'kw' is not given, returns a dict of the heading option\nvalues.  If 'option' is specified then the value for that\n'option' is returned.  Otherwise, sets the options to the\ncorresponding values.\n\nThe valid options/values are:\n\n'text': text\n\nThe text to display in the column heading.\n\n'image': imageName\n\nSpecifies an image to display to the right of the column\nheading.\n\n'anchor': anchor\n\nSpecifies how the heading text should be aligned.  One of\nthe standard Tk anchor values.\n\n'command': callback\n\nA callback to be invoked when the heading label is\npressed.\n\nTo configure the tree column heading, call this with column =\n\"#0\".\n\n-- Method: identify (component, x, y)\n\nReturns a description of the specified 'component' under the\npoint given by 'x' and 'y', or the empty string if no such\n'component' is present at that position.\n\n-- Method: identifyrow (y)\n\nReturns the item ID of the item at position 'y'.\n\n-- Method: identifycolumn (x)\n\nReturns the data column identifier of the cell at position\n'x'.\n\nThe tree column has ID #0.\n\n-- Method: identifyregion (x, y)\n\nReturns one of:\n\nregion          meaning\n\n-----------------------------------------------------------\n\nheading         Tree heading area.\n\n\nseparator       Space between two columns headings.\n\n\ntree            The tree area.\n\n\ncell            A data cell.\n\n\nAvailability: Tk 8.6.\n\n-- Method: identifyelement (x, y)\n\nReturns the element at position 'x', 'y'.\n\nAvailability: Tk 8.6.\n\n-- Method: index (item)\n\nReturns the integer index of 'item' within its parent's list\nof children.\n\n-- Method: insert (parent, index, iid=None, kw)\n\nCreates a new item and returns the item identifier of the\nnewly created item.\n\n'parent' is the item ID of the parent item, or the empty\nstring to create a new top-level item.  'index' is an integer,\nor the value \"end\", specifying where in the list of parent's\nchildren to insert the new item.  If 'index' is less than or\nequal to zero, the new node is inserted at the beginning; if\n'index' is greater than or equal to the current number of\nchildren, it is inserted at the end.  If 'iid' is specified,\nit is used as the item identifier; 'iid' must not already\nexist in the tree.  Otherwise, a new unique identifier is\ngenerated.\n\nSee *note Item Options: 3b49. for the list of available\noptions.\n\n-- Method: item (item, option=None, kw)\n\nQuery or modify the options for the specified 'item'.\n\nIf no options are given, a dict with options/values for the\nitem is returned.  If 'option' is specified then the value for\nthat option is returned.  Otherwise, sets the options to the\ncorresponding values as given by 'kw'.\n\n-- Method: move (item, parent, index)\n\nMoves 'item' to position 'index' in 'parent''s list of\nchildren.\n\nIt is illegal to move an item under one of its descendants.\nIf 'index' is less than or equal to zero, 'item' is moved to\nthe beginning; if greater than or equal to the number of\nchildren, it is moved to the end.  If 'item' was detached it\nis reattached.\n\n-- Method: next (item)\n\nReturns the identifier of 'item''s next sibling, or '' if\n'item' is the last child of its parent.\n\n-- Method: parent (item)\n\nReturns the ID of the parent of 'item', or '' if 'item' is at\nthe top level of the hierarchy.\n\n-- Method: prev (item)\n\nReturns the identifier of 'item''s previous sibling, or '' if\n'item' is the first child of its parent.\n\n-- Method: reattach (item, parent, index)\n\nAn alias for *note Treeview.move(): 3b5e.\n\n-- Method: see (item)\n\nEnsure that 'item' is visible.\n\nSets all of 'item''s ancestors open option to 'True', and\nscrolls the widget if necessary so that 'item' is within the\nvisible portion of the tree.\n\n-- Method: selection ()\n\nReturns a tuple of selected items.\n\nChanged in version 3.8: 'selection()' no longer takes\narguments.  For changing the selection state use the following\nselection methods.\n\n-- Method: selectionset (*items)\n\n'items' becomes the new selection.\n\nChanged in version 3.6: 'items' can be passed as separate\narguments, not just as a single tuple.\n\n-- Method: selectionadd (*items)\n\nAdd 'items' to the selection.\n\nChanged in version 3.6: 'items' can be passed as separate\narguments, not just as a single tuple.\n\n-- Method: selectionremove (*items)\n\nRemove 'items' from the selection.\n\nChanged in version 3.6: 'items' can be passed as separate\narguments, not just as a single tuple.\n\n-- Method: selectiontoggle (*items)\n\nToggle the selection state of each item in 'items'.\n\nChanged in version 3.6: 'items' can be passed as separate\narguments, not just as a single tuple.\n\n-- Method: set (item, column=None, value=None)\n\nWith one argument, returns a dictionary of column/value pairs\nfor the specified 'item'.  With two arguments, returns the\ncurrent value of the specified 'column'.  With three\narguments, sets the value of given 'column' in given 'item' to\nthe specified 'value'.\n\n-- Method: tagbind (tagname, sequence=None, callback=None)\n\nBind a callback for the given event 'sequence' to the tag\n'tagname'.  When an event is delivered to an item, the\ncallbacks for each of the item's tags option are called.\n\n-- Method: tagconfigure (tagname, option=None, kw)\n\nQuery or modify the options for the specified 'tagname'.\n\nIf 'kw' is not given, returns a dict of the option settings\nfor 'tagname'.  If 'option' is specified, returns the value\nfor that 'option' for the specified 'tagname'.  Otherwise,\nsets the options to the corresponding values for the given\n'tagname'.\n\n-- Method: taghas (tagname, item=None)\n\nIf 'item' is specified, returns 1 or 0 depending on whether\nthe specified 'item' has the given 'tagname'.  Otherwise,\nreturns a list of all items that have the specified tag.\n\nAvailability: Tk 8.6\n\n-- Method: xview (*args)\n\nQuery or modify horizontal position of the treeview.\n\n-- Method: yview (*args)\n\nQuery or modify vertical position of the treeview.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Ttk Styling,  Prev: Treeview,  Up: tkinter ttk -- Tk themed widgets": {
            "content": "5.25.8.39 Ttk Styling\n.....................\n",
            "subsections": []
        },
        "Each widget in 'ttk' is assigned a style, which specifies the set of": {
            "content": "elements making up the widget and how they are arranged, along with\ndynamic and default settings for element options.  By default the style\nname is the same as the widget's class name, but it may be overridden by\nthe widget's style option.  If you don't know the class name of a\nwidget, use the method 'Misc.winfoclass()' (somewidget.winfoclass()).\n\nSee also\n........\n",
            "subsections": []
        },
        "Tcl'2004 conference presentation(1)": {
            "content": "This document explains how the theme engine works\n\n-- Class: tkinter.ttk.Style\n\nThis class is used to manipulate the style database.\n\n-- Method: configure (style, queryopt=None, kw)\n\nQuery or set the default value of the specified option(s) in\n'style'.\n\nEach key in 'kw' is an option and each value is a string\nidentifying the value for that option.\n\nFor example, to change every default button to be a flat\nbutton with some padding and a different background color:\n\nfrom tkinter import ttk\nimport tkinter\n\nroot = tkinter.Tk()\n\nttk.Style().configure(\"TButton\", padding=6, relief=\"flat\",\nbackground=\"#ccc\")\n\nbtn = ttk.Button(text=\"Sample\")\nbtn.pack()\n\nroot.mainloop()\n\n-- Method: map (style, queryopt=None, kw)\n\nQuery or sets dynamic values of the specified option(s) in\n'style'.\n\nEach key in 'kw' is an option and each value should be a list\nor a tuple (usually) containing statespecs grouped in tuples,\nlists, or some other preference.  A statespec is a compound of\none or more states and then a value.\n\nAn example may make it more understandable:\n\nimport tkinter\nfrom tkinter import ttk\n\nroot = tkinter.Tk()\n\nstyle = ttk.Style()\nstyle.map(\"C.TButton\",\nforeground=[('pressed', 'red'), ('active', 'blue')],\nbackground=[('pressed', '!disabled', 'black'), ('active', 'white')]\n)\n\ncoloredbtn = ttk.Button(text=\"Test\", style=\"C.TButton\").pack()\n\nroot.mainloop()\n\nNote that the order of the (states, value) sequences for an\noption does matter, if the order is changed to '[('active',\n'blue'), ('pressed', 'red')]' in the foreground option, for\nexample, the result would be a blue foreground when the widget\nwere in active or pressed states.\n\n-- Method: lookup (style, option, state=None, default=None)\n\nReturns the value specified for 'option' in 'style'.\n\nIf 'state' is specified, it is expected to be a sequence of\none or more states.  If the 'default' argument is set, it is\nused as a fallback value in case no specification for option\nis found.\n\nTo check what font a Button uses by default:\n\nfrom tkinter import ttk\n\nprint(ttk.Style().lookup(\"TButton\", \"font\"))\n\n-- Method: layout (style, layoutspec=None)\n\nDefine the widget layout for given 'style'.  If 'layoutspec'\nis omitted, return the layout specification for given style.\n\n'layoutspec', if specified, is expected to be a list or some\nother sequence type (excluding strings), where each item\nshould be a tuple and the first item is the layout name and\nthe second item should have the format described in *note\nLayouts: 3b6f.\n\nTo understand the format, see the following example (it is not\nintended to do anything useful):\n\nfrom tkinter import ttk\nimport tkinter\n\nroot = tkinter.Tk()\n\nstyle = ttk.Style()\nstyle.layout(\"TMenubutton\", [\n(\"Menubutton.background\", None),\n(\"Menubutton.button\", {\"children\":\n[(\"Menubutton.focus\", {\"children\":\n[(\"Menubutton.padding\", {\"children\":\n[(\"Menubutton.label\", {\"side\": \"left\", \"expand\": 1})]\n})]\n})]\n}),\n])\n\nmbtn = ttk.Menubutton(text='Text')\nmbtn.pack()\nroot.mainloop()\n\n-- Method: elementcreate (elementname, etype, *args, kw)\n\nCreate a new element in the current theme, of the given\n'etype' which is expected to be either \"image\" or \"from\".\n\nIf \"image\" is used, 'args' should contain the default image\nname followed by statespec/value pairs (this is the\nimagespec), and 'kw' may have the following options:\n\nborder=padding\n\npadding is a list of up to four integers, specifying the\nleft, top, right, and bottom borders, respectively.\n\nheight=height\n\nSpecifies a minimum height for the element.  If less than\nzero, the base image's height is used as a default.\n\npadding=padding\n\nSpecifies the element's interior padding.  Defaults to\nborder's value if not specified.\n\nsticky=spec\n\nSpecifies how the image is placed within the final\nparcel.  spec contains zero or more characters \"n\", \"s\",\n\"w\", or \"e\".\n\nwidth=width\n\nSpecifies a minimum width for the element.  If less than\nzero, the base image's width is used as a default.\n\nExample:\n\nimg1 = tkinter.PhotoImage(master=root, file='button.png')\nimg1 = tkinter.PhotoImage(master=root, file='button-pressed.png')\nimg1 = tkinter.PhotoImage(master=root, file='button-active.png')\nstyle = ttk.Style(root)\nstyle.elementcreate('Button.button', 'image',\nimg1, ('pressed', img2), ('active', img3),\nborder=(2, 4), sticky='we')\n\nIf \"from\" is used as the value of 'etype', *note\nelementcreate(): 13ed. will clone an existing element.\n'args' is expected to contain a themename, from which the\nelement will be cloned, and optionally an element to clone\nfrom.  If this element to clone from is not specified, an\nempty element will be used.  'kw' is discarded.\n\nExample:\n\nstyle = ttk.Style(root)\nstyle.elementcreate('plain.background', 'from', 'default')\n\n-- Method: elementnames ()\n\nReturns the list of elements defined in the current theme.\n\n-- Method: elementoptions (elementname)\n\nReturns the list of 'elementname''s options.\n\n-- Method: themecreate (themename, parent=None, settings=None)\n\nCreate a new theme.\n\nIt is an error if 'themename' already exists.  If 'parent' is\nspecified, the new theme will inherit styles, elements and\nlayouts from the parent theme.  If 'settings' are present they\nare expected to have the same syntax used for *note\nthemesettings(): 3b73.\n\n-- Method: themesettings (themename, settings)\n\nTemporarily sets the current theme to 'themename', apply\nspecified 'settings' and then restore the previous theme.\n\nEach key in 'settings' is a style and each value may contain\nthe keys 'configure', 'map', 'layout' and 'element create' and\nthey are expected to have the same format as specified by the\nmethods *note Style.configure(): 3b6c, *note Style.map():\n1682, *note Style.layout(): 3b6e. and *note\nStyle.elementcreate(): 13ed. respectively.\n\nAs an example, let's change the Combobox for the default theme\na bit:\n\nfrom tkinter import ttk\nimport tkinter\n\nroot = tkinter.Tk()\n\nstyle = ttk.Style()\nstyle.themesettings(\"default\", {\n\"TCombobox\": {\n\"configure\": {\"padding\": 5},\n\"map\": {\n\"background\": [(\"active\", \"green2\"),\n(\"!disabled\", \"green4\")],\n\"fieldbackground\": [(\"!disabled\", \"green3\")],\n\"foreground\": [(\"focus\", \"OliveDrab1\"),\n(\"!disabled\", \"OliveDrab2\")]\n}\n}\n})\n\ncombo = ttk.Combobox().pack()\n\nroot.mainloop()\n\n-- Method: themenames ()\n\nReturns a list of all known themes.\n\n-- Method: themeuse (themename=None)\n\nIf 'themename' is not given, returns the theme in use.\nOtherwise, sets the current theme to 'themename', refreshes\nall widgets and emits a <<ThemeChanged>> event.\n\n* Menu:\n\n* Layouts::\n\n---------- Footnotes ----------\n\n(1) https://tktable.sourceforge.net/tile/tile-tcl2004.pdf\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Layouts,  Up: Ttk Styling": {
            "content": "5.25.8.40 Layouts\n.................\n\nA layout can be just 'None', if it takes no options, or a dict of\noptions specifying how to arrange the element.  The layout mechanism\nuses a simplified version of the pack geometry manager: given an initial\ncavity, each element is allocated a parcel.\n\nThe valid options/values are:\n\n'side': whichside\n\nSpecifies which side of the cavity to place the element; one of\ntop, right, bottom or left.  If omitted, the element occupies the\nentire cavity.\n\n'sticky': nswe\n\nSpecifies where the element is placed inside its allocated parcel.\n\n'unit': 0 or 1\n\nIf set to 1, causes the element and all of its descendants to be\ntreated as a single element for the purposes of *note\nWidget.identify(): 3b1a. et al.  It's used for things like\nscrollbar thumbs with grips.\n\n'children': [sublayout... ]\n\nSpecifies a list of elements to place inside the element.  Each\nelement is a tuple (or other sequence type) where the first item is\nthe layout name, and the other is a *note Layout: 3b6f.\n\nFile: python3.12.info,  Node: tkinter tix -- Extension widgets for Tk,  Next: IDLE<57>,  Prev: tkinter ttk -- Tk themed widgets,  Up: Graphical User Interfaces with Tk\n\n\n'Source code:' Lib/tkinter/tix.py(1)\n",
            "subsections": []
        },
        "Deprecated since version 3.6: This Tk extension is unmaintained and": {
            "content": "should not be used in new code.  Use *note tkinter.ttk: f4. instead.\n\n\n\nThe *note tkinter.tix: f3. (Tk Interface Extension) module provides an\nadditional rich set of widgets.  Although the standard Tk library has\nmany useful widgets, they are far from complete.  The *note tkinter.tix:\nf3. library provides most of the commonly needed widgets that are\nmissing from standard Tk: *note HList: 3b79, *note ComboBox: 3b7a, *note",
            "subsections": []
        },
        "Control: 3b7b. (a.k.a.  SpinBox) and an assortment of scrollable": {
            "content": "widgets.  *note tkinter.tix: f3. also includes many more widgets that\nare generally useful in a wide range of applications: *note NoteBook:\n3b7c, *note FileEntry: 3b7d, *note PanedWindow: 3b7e, etc; there are\nmore than 40 of them.\n",
            "subsections": []
        },
        "With all these new widgets, you can introduce new interaction techniques": {
            "content": "into applications, creating more useful and more intuitive user\ninterfaces.  You can design your application by choosing the most\nappropriate widgets to match the special needs of your application and\nusers.\n\nSee also\n........\n",
            "subsections": []
        },
        "Tix Homepage(2)": {
            "content": "The home page for 'Tix'.  This includes links to additional\ndocumentation and downloads.\n",
            "subsections": []
        },
        "Tix Man Pages(3)": {
            "content": "On-line version of the man pages and reference material.\n",
            "subsections": []
        },
        "Tix Programming Guide(4)": {
            "content": "On-line version of the programmer's reference material.\n",
            "subsections": []
        },
        "Tix Development Applications(5)": {
            "content": "Tix applications for development of Tix and Tkinter programs.  Tide\napplications work under Tk or Tkinter, and include 'TixInspect', an\ninspector to remotely modify and debug Tix/Tk/Tkinter applications.\n\n* Menu:\n\n* Using Tix::\n* Tix Widgets::\n* Tix Commands::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/tkinter/tix.py\n\n(2) https://tix.sourceforge.net/\n\n(3) https://tix.sourceforge.net/dist/current/man/\n\n(4)\nhttps://tix.sourceforge.net/dist/current/docs/tix-book/tix.book.html\n\n(5) https://tix.sourceforge.net/Tixapps/src/Tide.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using Tix,  Next: Tix Widgets,  Up: tkinter tix -- Extension widgets for Tk": {
            "content": "5.25.9.1 Using Tix\n..................\n\n-- Class: tkinter.tix.Tk (screenName=None, baseName=None,\nclassName='Tix')\n\nToplevel widget of Tix which represents mostly the main window of\nan application.  It has an associated Tcl interpreter.\n\nClasses in the *note tkinter.tix: f3. module subclasses the classes\nin the *note tkinter: ea.  The former imports the latter, so to use\n*note tkinter.tix: f3. with Tkinter, all you need to do is to\nimport one module.  In general, you can just import *note\ntkinter.tix: f3, and replace the toplevel call to *note tkinter.Tk:\n13ff. with 'tix.Tk':\n\nfrom tkinter import tix\nfrom tkinter.constants import *\nroot = tix.Tk()\n\nTo use *note tkinter.tix: f3, you must have the Tix widgets installed,\nusually alongside your installation of the Tk widgets.  To test your\ninstallation, try the following:\n\nfrom tkinter import tix\nroot = tix.Tk()\nroot.tk.eval('package require Tix')\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Tix Widgets,  Next: Tix Commands,  Prev: Using Tix,  Up: tkinter tix -- Extension widgets for Tk": {
            "content": "5.25.9.2 Tix Widgets\n....................\n\nTix(1) introduces over 40 widget classes to the *note tkinter: ea.\nrepertoire.\n\n* Menu:\n\n* Basic Widgets::\n* File Selectors::\n* Hierarchical ListBox::\n* Tabular ListBox::\n* Manager Widgets::\n* Image Types::\n* Miscellaneous Widgets::\n* Form Geometry Manager::\n\n---------- Footnotes ----------\n\n(1)\nhttps://tix.sourceforge.net/dist/current/man/html/TixCmd/TixIntro.htm\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Basic Widgets,  Next: File Selectors,  Up: Tix Widgets": {
            "content": "5.25.9.3 Basic Widgets\n......................\n\n-- Class: tkinter.tix.Balloon\n\nA Balloon(1) that pops up over a widget to provide help.  When the\nuser moves the cursor inside a widget to which a Balloon widget has\nbeen bound, a small pop-up window with a descriptive message will\nbe shown on the screen.\n\n-- Class: tkinter.tix.ButtonBox\n\nThe ButtonBox(2) widget creates a box of buttons, such as is\ncommonly used for 'Ok Cancel'.\n\n-- Class: tkinter.tix.ComboBox\n\nThe ComboBox(3) widget is similar to the combo box control in MS\nWindows.  The user can select a choice by either typing in the\nentry subwidget or selecting from the listbox subwidget.\n\n-- Class: tkinter.tix.Control\n\nThe Control(4) widget is also known as the 'SpinBox' widget.  The\nuser can adjust the value by pressing the two arrow buttons or by\nentering the value directly into the entry.  The new value will be\nchecked against the user-defined upper and lower limits.\n\n-- Class: tkinter.tix.LabelEntry\n\nThe LabelEntry(5) widget packages an entry widget and a label into\none mega widget.  It can be used to simplify the creation of\n\"entry-form\" type of interface.\n\n-- Class: tkinter.tix.LabelFrame\n\nThe LabelFrame(6) widget packages a frame widget and a label into\none mega widget.  To create widgets inside a LabelFrame widget, one\ncreates the new widgets relative to the 'frame' subwidget and\nmanage them inside the 'frame' subwidget.\n\n-- Class: tkinter.tix.Meter\n\nThe Meter(7) widget can be used to show the progress of a\nbackground job which may take a long time to execute.\n\n-- Class: tkinter.tix.OptionMenu\n\nThe OptionMenu(8) creates a menu button of options.\n\n-- Class: tkinter.tix.PopupMenu\n\nThe PopupMenu(9) widget can be used as a replacement of the\n'tkpopup' command.  The advantage of the 'Tix' *note PopupMenu:\n3b89. widget is it requires less application code to manipulate.\n\n-- Class: tkinter.tix.Select\n\nThe Select(10) widget is a container of button subwidgets.  It can\nbe used to provide radio-box or check-box style of selection\noptions for the user.\n\n-- Class: tkinter.tix.StdButtonBox\n\nThe StdButtonBox(11) widget is a group of standard buttons for\nMotif-like dialog boxes.\n\n---------- Footnotes ----------\n\n(1)\nhttps://tix.sourceforge.net/dist/current/man/html/TixCmd/tixBalloon.htm\n\n(2)\nhttps://tix.sourceforge.net/dist/current/man/html/TixCmd/tixButtonBox.htm\n\n(3)\nhttps://tix.sourceforge.net/dist/current/man/html/TixCmd/tixComboBox.htm\n\n(4)\nhttps://tix.sourceforge.net/dist/current/man/html/TixCmd/tixControl.htm\n\n(5)\nhttps://tix.sourceforge.net/dist/current/man/html/TixCmd/tixLabelEntry.htm\n\n(6)\nhttps://tix.sourceforge.net/dist/current/man/html/TixCmd/tixLabelFrame.htm\n\n(7)\nhttps://tix.sourceforge.net/dist/current/man/html/TixCmd/tixMeter.htm\n\n(8)\nhttps://tix.sourceforge.net/dist/current/man/html/TixCmd/tixOptionMenu.htm\n\n(9)\nhttps://tix.sourceforge.net/dist/current/man/html/TixCmd/tixPopupMenu.htm\n\n(10)\nhttps://tix.sourceforge.net/dist/current/man/html/TixCmd/tixSelect.htm\n\n(11)\nhttps://tix.sourceforge.net/dist/current/man/html/TixCmd/tixStdButtonBox.htm\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: File Selectors,  Next: Hierarchical ListBox,  Prev: Basic Widgets,  Up: Tix Widgets": {
            "content": "5.25.9.4 File Selectors\n.......................\n\n-- Class: tkinter.tix.DirList\n\nThe DirList(1) widget displays a list view of a directory, its\nprevious directories and its sub-directories.  The user can choose\none of the directories displayed in the list or change to another\ndirectory.\n\n-- Class: tkinter.tix.DirTree\n\nThe DirTree(2) widget displays a tree view of a directory, its\nprevious directories and its sub-directories.  The user can choose\none of the directories displayed in the list or change to another\ndirectory.\n\n-- Class: tkinter.tix.DirSelectDialog\n\nThe DirSelectDialog(3) widget presents the directories in the file\nsystem in a dialog window.  The user can use this dialog window to\nnavigate through the file system to select the desired directory.\n\n-- Class: tkinter.tix.DirSelectBox\n\nThe *note DirSelectBox: 3b90. is similar to the standard Motif(TM)\ndirectory-selection box.  It is generally used for the user to\nchoose a directory.  DirSelectBox stores the directories mostly\nrecently selected into a ComboBox widget so that they can be\nquickly selected again.\n\n-- Class: tkinter.tix.ExFileSelectBox\n\nThe ExFileSelectBox(4) widget is usually embedded in a\ntixExFileSelectDialog widget.  It provides a convenient method for\nthe user to select files.  The style of the *note ExFileSelectBox:\n3b91. widget is very similar to the standard file dialog on MS\nWindows 3.1.\n\n-- Class: tkinter.tix.FileSelectBox\n\nThe FileSelectBox(5) is similar to the standard Motif(TM)\nfile-selection box.  It is generally used for the user to choose a\nfile.  FileSelectBox stores the files mostly recently selected into\na *note ComboBox: 3b7a. widget so that they can be quickly selected\nagain.\n\n-- Class: tkinter.tix.FileEntry\n\nThe FileEntry(6) widget can be used to input a filename.  The user\ncan type in the filename manually.  Alternatively, the user can\npress the button widget that sits next to the entry, which will\nbring up a file selection dialog.\n\n---------- Footnotes ----------\n\n(1)\nhttps://tix.sourceforge.net/dist/current/man/html/TixCmd/tixDirList.htm\n\n(2)\nhttps://tix.sourceforge.net/dist/current/man/html/TixCmd/tixDirTree.htm\n\n(3)\nhttps://tix.sourceforge.net/dist/current/man/html/TixCmd/tixDirSelectDialog.htm\n\n(4)\nhttps://tix.sourceforge.net/dist/current/man/html/TixCmd/tixExFileSelectBox.htm\n\n(5)\nhttps://tix.sourceforge.net/dist/current/man/html/TixCmd/tixFileSelectBox.htm\n\n(6)\nhttps://tix.sourceforge.net/dist/current/man/html/TixCmd/tixFileEntry.htm\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Hierarchical ListBox,  Next: Tabular ListBox,  Prev: File Selectors,  Up: Tix Widgets": {
            "content": "5.25.9.5 Hierarchical ListBox\n.............................\n\n-- Class: tkinter.tix.HList\n\nThe HList(1) widget can be used to display any data that have a\nhierarchical structure, for example, file system directory trees.\nThe list entries are indented and connected by branch lines\naccording to their places in the hierarchy.\n\n-- Class: tkinter.tix.CheckList\n\nThe CheckList(2) widget displays a list of items to be selected by\nthe user.  CheckList acts similarly to the Tk checkbutton or\nradiobutton widgets, except it is capable of handling many more\nitems than checkbuttons or radiobuttons.\n\n-- Class: tkinter.tix.Tree\n\nThe Tree(3) widget can be used to display hierarchical data in a\ntree form.  The user can adjust the view of the tree by opening or\nclosing parts of the tree.\n\n---------- Footnotes ----------\n\n(1)\nhttps://tix.sourceforge.net/dist/current/man/html/TixCmd/tixHList.htm\n\n(2)\nhttps://tix.sourceforge.net/dist/current/man/html/TixCmd/tixCheckList.htm\n\n(3)\nhttps://tix.sourceforge.net/dist/current/man/html/TixCmd/tixTree.htm\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Tabular ListBox,  Next: Manager Widgets,  Prev: Hierarchical ListBox,  Up: Tix Widgets": {
            "content": "5.25.9.6 Tabular ListBox\n........................\n\n-- Class: tkinter.tix.TList\n\nThe TList(1) widget can be used to display data in a tabular\nformat.  The list entries of a *note TList: 3b97. widget are\nsimilar to the entries in the Tk listbox widget.  The main\ndifferences are (1) the *note TList: 3b97. widget can display the\nlist entries in a two dimensional format and (2) you can use\ngraphical images as well as multiple colors and fonts for the list\nentries.\n\n---------- Footnotes ----------\n\n(1)\nhttps://tix.sourceforge.net/dist/current/man/html/TixCmd/tixTList.htm\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Manager Widgets,  Next: Image Types,  Prev: Tabular ListBox,  Up: Tix Widgets": {
            "content": "5.25.9.7 Manager Widgets\n........................\n\n-- Class: tkinter.tix.PanedWindow\n\nThe PanedWindow(1) widget allows the user to interactively\nmanipulate the sizes of several panes.  The panes can be arranged\neither vertically or horizontally.  The user changes the sizes of\nthe panes by dragging the resize handle between two panes.\n\n-- Class: tkinter.tix.ListNoteBook\n\nThe ListNoteBook(2) widget is very similar to the 'TixNoteBook'\nwidget: it can be used to display many windows in a limited space\nusing a notebook metaphor.  The notebook is divided into a stack of\npages (windows).  At one time only one of these pages can be shown.\nThe user can navigate through these pages by choosing the name of\nthe desired page in the 'hlist' subwidget.\n\n-- Class: tkinter.tix.NoteBook\n\nThe NoteBook(3) widget can be used to display many windows in a\nlimited space using a notebook metaphor.  The notebook is divided\ninto a stack of pages.  At one time only one of these pages can be\nshown.  The user can navigate through these pages by choosing the\nvisual \"tabs\" at the top of the NoteBook widget.\n\n---------- Footnotes ----------\n\n(1)\nhttps://tix.sourceforge.net/dist/current/man/html/TixCmd/tixPanedWindow.htm\n\n(2)\nhttps://tix.sourceforge.net/dist/current/man/html/TixCmd/tixListNoteBook.htm\n\n(3)\nhttps://tix.sourceforge.net/dist/current/man/html/TixCmd/tixNoteBook.htm\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Image Types,  Next: Miscellaneous Widgets,  Prev: Manager Widgets,  Up: Tix Widgets": {
            "content": "5.25.9.8 Image Types\n....................\n\nThe *note tkinter.tix: f3. module adds:\n\n* pixmap(1) capabilities to all *note tkinter.tix: f3. and *note\ntkinter: ea. widgets to create color images from XPM files.\n\n* Compound(2) image types can be used to create images that consists\nof multiple horizontal lines; each line is composed of a series of\nitems (texts, bitmaps, images or spaces) arranged from left to\nright.  For example, a compound image can be used to display a\nbitmap and a text string simultaneously in a Tk 'Button' widget.\n\n---------- Footnotes ----------\n\n(1)\nhttps://tix.sourceforge.net/dist/current/man/html/TixCmd/pixmap.htm\n\n(2)\nhttps://tix.sourceforge.net/dist/current/man/html/TixCmd/compound.htm\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Miscellaneous Widgets,  Next: Form Geometry Manager,  Prev: Image Types,  Up: Tix Widgets": {
            "content": "5.25.9.9 Miscellaneous Widgets\n..............................\n\n-- Class: tkinter.tix.InputOnly\n\nThe InputOnly(1) widgets are to accept inputs from the user, which\ncan be done with the 'bind' command (Unix only).\n\n---------- Footnotes ----------\n\n(1)\nhttps://tix.sourceforge.net/dist/current/man/html/TixCmd/tixInputOnly.htm\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Form Geometry Manager,  Prev: Miscellaneous Widgets,  Up: Tix Widgets": {
            "content": "5.25.9.10 Form Geometry Manager\n...............................\n\nIn addition, *note tkinter.tix: f3. augments *note tkinter: ea. by\nproviding:\n\n-- Class: tkinter.tix.Form\n\nThe Form(1) geometry manager based on attachment rules for all Tk\nwidgets.\n\n---------- Footnotes ----------\n\n(1)\nhttps://tix.sourceforge.net/dist/current/man/html/TixCmd/tixForm.htm\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Tix Commands,  Prev: Tix Widgets,  Up: tkinter tix -- Extension widgets for Tk": {
            "content": "5.25.9.11 Tix Commands\n......................\n\n-- Class: tkinter.tix.tixCommand\n\nThe tix commands(1) provide access to miscellaneous elements of\n'Tix''s internal state and the 'Tix' application context.  Most of\nthe information manipulated by these methods pertains to the\napplication as a whole, or to a screen or display, rather than to a\nparticular window.\n\nTo view the current settings, the common usage is:\n\nfrom tkinter import tix\nroot = tix.Tk()\nprint(root.tixconfigure())\n\n-- Method: tixCommand.tixconfigure (cnf=None, kw)\n\nQuery or modify the configuration options of the Tix application\ncontext.  If no option is specified, returns a dictionary all of\nthe available options.  If option is specified with no value, then\nthe method returns a list describing the one named option (this\nlist will be identical to the corresponding sublist of the value\nreturned if no option is specified).  If one or more option-value\npairs are specified, then the method modifies the given option(s)\nto have the given value(s); in this case the method returns an\nempty string.  Option may be any of the configuration options.\n\n-- Method: tixCommand.tixcget (option)\n\nReturns the current value of the configuration option given by\n'option'.  Option may be any of the configuration options.\n\n-- Method: tixCommand.tixgetbitmap (name)\n\nLocates a bitmap file of the name 'name.xpm' or 'name' in one of\nthe bitmap directories (see the *note tixaddbitmapdir(): 3ba4.\nmethod).  By using *note tixgetbitmap(): 3ba3, you can avoid hard\ncoding the pathnames of the bitmap files in your application.  When\nsuccessful, it returns the complete pathname of the bitmap file,\nprefixed with the character '@'.  The returned value can be used to\nconfigure the 'bitmap' option of the Tk and Tix widgets.\n\n-- Method: tixCommand.tixaddbitmapdir (directory)\n\nTix maintains a list of directories under which the *note\ntixgetimage(): 3ba5. and *note tixgetbitmap(): 3ba3. methods will\nsearch for image files.  The standard bitmap directory is\n'$TIXLIBRARY/bitmaps'.  The *note tixaddbitmapdir(): 3ba4. method\nadds 'directory' into this list.  By using this method, the image\nfiles of an applications can also be located using the *note\ntixgetimage(): 3ba5. or *note tixgetbitmap(): 3ba3. method.\n\n-- Method: tixCommand.tixfiledialog ([dlgclass])\n\nReturns the file selection dialog that may be shared among\ndifferent calls from this application.  This method will create a\nfile selection dialog widget when it is called the first time.\nThis dialog will be returned by all subsequent calls to *note\ntixfiledialog(): 3ba6.  An optional dlgclass parameter can be\npassed as a string to specified what type of file selection dialog\nwidget is desired.  Possible options are 'tix', 'FileSelectDialog'\nor 'tixExFileSelectDialog'.\n\n-- Method: tixCommand.tixgetimage (self, name)\n\nLocates an image file of the name 'name.xpm', 'name.xbm' or\n'name.ppm' in one of the bitmap directories (see the *note\ntixaddbitmapdir(): 3ba4. method above).  If more than one file\nwith the same name (but different extensions) exist, then the image\ntype is chosen according to the depth of the X display: xbm images\nare chosen on monochrome displays and color images are chosen on\ncolor displays.  By using *note tixgetimage(): 3ba5, you can avoid\nhard coding the pathnames of the image files in your application.\nWhen successful, this method returns the name of the newly created\nimage, which can be used to configure the 'image' option of the Tk\nand Tix widgets.\n\n-- Method: tixCommand.tixoptionget (name)\n\nGets the options maintained by the Tix scheme mechanism.\n\n-- Method: tixCommand.tixresetoptions (newScheme, newFontSet[,\nnewScmPrio])\n\nResets the scheme and fontset of the Tix application to 'newScheme'\nand 'newFontSet', respectively.  This affects only those widgets\ncreated after this call.  Therefore, it is best to call the\nresetoptions method before the creation of any widgets in a Tix\napplication.\n\nThe optional parameter 'newScmPrio' can be given to reset the\npriority level of the Tk options set by the Tix schemes.\n\nBecause of the way Tk handles the X option database, after Tix has\nbeen has imported and inited, it is not possible to reset the color\nschemes and font sets using the 'tixconfig()' method.  Instead,\nthe *note tixresetoptions(): 3ba8. method must be used.\n\n---------- Footnotes ----------\n\n(1) https://tix.sourceforge.net/dist/current/man/html/TixCmd/tix.htm\n\nFile: python3.12.info,  Node: IDLE<57>,  Prev: tkinter tix -- Extension widgets for Tk,  Up: Graphical User Interfaces with Tk\n\n\n'Source code:' Lib/idlelib/(1)\n\n\n\nIDLE is Python's Integrated Development and Learning Environment.\n\nIDLE has the following features:\n\n* cross-platform: works mostly the same on Windows, Unix, and macOS\n\n* Python shell window (interactive interpreter) with colorizing of\ncode input, output, and error messages\n\n* multi-window text editor with multiple undo, Python colorizing,\nsmart indent, call tips, auto completion, and other features\n\n* search within any window, replace within editor windows, and search\nthrough multiple files (grep)\n\n* debugger with persistent breakpoints, stepping, and viewing of\nglobal and local namespaces\n\n* configuration, browsers, and other dialogs\n\n* Menu:\n\n* Menus::\n* Editing and Navigation::\n* Startup and Code Execution::\n* Help and Preferences::\n* idlelib::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/idlelib/\n\nFile: python3.12.info,  Node: Menus,  Next: Editing and Navigation,  Up: IDLE<57>\n\n5.25.10.1 Menus\n...............\n\nIDLE has two main window types, the Shell window and the Editor window.",
            "subsections": []
        },
        "It is possible to have multiple editor windows simultaneously.  On": {
            "content": "",
            "subsections": []
        },
        "Windows and Linux, each has its own top menu.  Each menu documented": {
            "content": "below indicates which window type it is associated with.\n\nOutput windows, such as used for Edit => Find in Files, are a subtype of\neditor window.  They currently have the same top menu but a different\ndefault title and context menu.\n",
            "subsections": []
        },
        "On macOS, there is one application menu.  It dynamically changes": {
            "content": "according to the window currently selected.  It has an IDLE menu, and\nsome entries described below are moved around to conform to Apple\nguidelines.\n\n* Menu:\n\n* File menu (Shell and Editor): File menu Shell and Editor.\n* Edit menu (Shell and Editor): Edit menu Shell and Editor.\n* Format menu (Editor window only): Format menu Editor window only.\n* Run menu (Editor window only): Run menu Editor window only.\n* Shell menu (Shell window only): Shell menu Shell window only.\n* Debug menu (Shell window only): Debug menu Shell window only.\n* Options menu (Shell and Editor): Options menu Shell and Editor.\n* Window menu (Shell and Editor): Window menu Shell and Editor.\n* Help menu (Shell and Editor): Help menu Shell and Editor.\n* Context menus::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: File menu Shell and Editor,  Next: Edit menu Shell and Editor,  Up: Menus": {
            "content": "5.25.10.2 File menu (Shell and Editor)\n......................................\n\nNew File\n\nCreate a new file editing window.\n\nOpen...\n\nOpen an existing file with an Open dialog.\n\nOpen Module...\n\nOpen an existing module (searches sys.path).\n",
            "subsections": []
        },
        "Recent Files": {
            "content": "Open a list of recent files.  Click one to open it.\n",
            "subsections": []
        },
        "Module Browser": {
            "content": "Show functions, classes, and methods in the current Editor file in\na tree structure.  In the shell, open a module first.\n",
            "subsections": []
        },
        "Path Browser": {
            "content": "Show sys.path directories, modules, functions, classes and methods\nin a tree structure.\n",
            "subsections": []
        },
        "Save": {
            "content": "Save the current window to the associated file, if there is one.\nWindows that have been changed since being opened or last saved\nhave a * before and after the window title.  If there is no\nassociated file, do Save As instead.\n\nSave As...\n\nSave the current window with a Save As dialog.  The file saved\nbecomes the new associated file for the window.  (If your file\nnamager is set to hide extensions, the current extension will be\nomitted in the file name box.  If the new filename has no '.',\n'.py' and '.txt' will be added for Python and text files, except\nthat on macOS Aqua,'.py' is added for all files.)\n\nSave Copy As...\n\nSave the current window to different file without changing the\nassociated file.  (See Save As note above about filename\nextensions.)\n",
            "subsections": []
        },
        "Print Window": {
            "content": "Print the current window to the default printer.\n",
            "subsections": []
        },
        "Close Window": {
            "content": "Close the current window (if an unsaved editor, ask to save; if an\nunsaved Shell, ask to quit execution).  Calling 'exit()' or\n'close()' in the Shell window also closes Shell.  If this is the\nonly window, also exit IDLE.\n\nExit IDLE\n\nClose all windows and quit IDLE (ask to save unsaved edit windows).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Edit menu Shell and Editor,  Next: Format menu Editor window only,  Prev: File menu Shell and Editor,  Up: Menus": {
            "content": "5.25.10.3 Edit menu (Shell and Editor)\n......................................\n",
            "subsections": []
        },
        "Undo": {
            "content": "Undo the last change to the current window.  A maximum of 1000\nchanges may be undone.\n",
            "subsections": []
        },
        "Redo": {
            "content": "Redo the last undone change to the current window.\n",
            "subsections": []
        },
        "Select All": {
            "content": "Select the entire contents of the current window.\n",
            "subsections": []
        },
        "Cut": {
            "content": "Copy selection into the system-wide clipboard; then delete the\nselection.\n",
            "subsections": []
        },
        "Copy": {
            "content": "Copy selection into the system-wide clipboard.\n",
            "subsections": []
        },
        "Paste": {
            "content": "Insert contents of the system-wide clipboard into the current\nwindow.\n",
            "subsections": []
        },
        "Find Again": {
            "content": "Repeat the last search, if there is one.\n",
            "subsections": []
        },
        "Find Selection": {
            "content": "Search for the currently selected string, if there is one.\n\nFind in Files...\n\nOpen a file search dialog.  Put results in a new output window.\n\nReplace...\n\nOpen a search-and-replace dialog.\n\nGo to Line\n\nMove the cursor to the beginning of the line requested and make\nthat line visible.  A request past the end of the file goes to the\nend.  Clear any selection and update the line and column status.\n",
            "subsections": []
        },
        "Show Completions": {
            "content": "Open a scrollable list allowing selection of existing names.  See\n*note Completions: 3bae. in the Editing and navigation section\nbelow.\n",
            "subsections": []
        },
        "Expand Word": {
            "content": "Expand a prefix you have typed to match a full word in the same\nwindow; repeat to get a different expansion.\n\nShow Call Tip\n\nAfter an unclosed parenthesis for a function, open a small window\nwith function parameter hints.  See *note Calltips: 3baf. in the\nEditing and navigation section below.\n",
            "subsections": []
        },
        "Show Surrounding Parens": {
            "content": "Highlight the surrounding parenthesis.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Format menu Editor window only,  Next: Run menu Editor window only,  Prev: Edit menu Shell and Editor,  Up: Menus": {
            "content": "5.25.10.4 Format menu (Editor window only)\n..........................................\n",
            "subsections": []
        },
        "Format Paragraph": {
            "content": "Reformat the current blank-line-delimited paragraph in comment\nblock or multiline string or selected line in a string.  All lines\nin the paragraph will be formatted to less than N columns, where N\ndefaults to 72.\n",
            "subsections": []
        },
        "Indent Region": {
            "content": "Shift selected lines right by the indent width (default 4 spaces).\n",
            "subsections": []
        },
        "Dedent Region": {
            "content": "Shift selected lines left by the indent width (default 4 spaces).\n",
            "subsections": []
        },
        "Comment Out Region": {
            "content": "Insert ## in front of selected lines.\n",
            "subsections": []
        },
        "Uncomment Region": {
            "content": "Remove leading # or ## from selected lines.\n",
            "subsections": []
        },
        "Tabify Region": {
            "content": "Turn 'leading' stretches of spaces into tabs.  (Note: We recommend\nusing 4 space blocks to indent Python code.)\n",
            "subsections": []
        },
        "Untabify Region": {
            "content": "Turn 'all' tabs into the correct number of spaces.\n",
            "subsections": []
        },
        "Toggle Tabs": {
            "content": "Open a dialog to switch between indenting with spaces and tabs.\n",
            "subsections": []
        },
        "New Indent Width": {
            "content": "Open a dialog to change indent width.  The accepted default by the\nPython community is 4 spaces.\n",
            "subsections": []
        },
        "Strip Trailing Chitespace": {
            "content": "Remove trailing space and other whitespace characters after the\nlast non-whitespace character of a line by applying str.rstrip to\neach line, including lines within multiline strings.  Except for\nShell windows, remove extra newlines at the end of the file.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Run menu Editor window only,  Next: Shell menu Shell window only,  Prev: Format menu Editor window only,  Up: Menus": {
            "content": "5.25.10.5 Run menu (Editor window only)\n.......................................\n",
            "subsections": []
        },
        "Run Module": {
            "content": "Do *note Check Module: 3bb4.  If no error, restart the shell to\nclean the environment, then execute the module.  Output is\ndisplayed in the Shell window.  Note that output requires use of\n'print' or 'write'.  When execution is complete, the Shell retains\nfocus and displays a prompt.  At this point, one may interactively\nexplore the result of execution.  This is similar to executing a\nfile with 'python -i file' at a command line.\n",
            "subsections": []
        },
        "Run... Customized": {
            "content": "Same as *note Run Module: 3bb3, but run the module with customized\nsettings.  'Command Line Arguments' extend *note sys.argv: 10dd. as\nif passed on a command line.  The module can be run in the Shell\nwithout restarting.\n",
            "subsections": []
        },
        "Check Module": {
            "content": "Check the syntax of the module currently open in the Editor window.\nIf the module has not been saved IDLE will either prompt the user\nto save or autosave, as selected in the General tab of the Idle\nSettings dialog.  If there is a syntax error, the approximate\nlocation is indicated in the Editor window.\n",
            "subsections": []
        },
        "Python Shell": {
            "content": "Open or wake up the Python Shell window.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Shell menu Shell window only,  Next: Debug menu Shell window only,  Prev: Run menu Editor window only,  Up: Menus": {
            "content": "5.25.10.6 Shell menu (Shell window only)\n........................................\n",
            "subsections": []
        },
        "View Last Restart": {
            "content": "Scroll the shell window to the last Shell restart.\n",
            "subsections": []
        },
        "Restart Shell": {
            "content": "Restart the shell to clean the environment and reset display and\nexception handling.\n",
            "subsections": []
        },
        "Previous History": {
            "content": "Cycle through earlier commands in history which match the current\nentry.\n",
            "subsections": []
        },
        "Next History": {
            "content": "Cycle through later commands in history which match the current\nentry.\n",
            "subsections": []
        },
        "Interrupt Execution": {
            "content": "Stop a running program.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Debug menu Shell window only,  Next: Options menu Shell and Editor,  Prev: Shell menu Shell window only,  Up: Menus": {
            "content": "5.25.10.7 Debug menu (Shell window only)\n........................................\n\nGo to File/Line\n\nLook on the current line.  with the cursor, and the line above for\na filename and line number.  If found, open the file if not already\nopen, and show the line.  Use this to view source lines referenced\nin an exception traceback and lines found by Find in Files.  Also\navailable in the context menu of the Shell window and Output\nwindows.\n",
            "subsections": []
        },
        "Debugger (toggle)": {
            "content": "When activated, code entered in the Shell or run from an Editor\nwill run under the debugger.  In the Editor, breakpoints can be set\nwith the context menu.  This feature is still incomplete and\nsomewhat experimental.\n",
            "subsections": []
        },
        "Stack Viewer": {
            "content": "Show the stack traceback of the last exception in a tree widget,\nwith access to locals and globals.\n",
            "subsections": []
        },
        "Auto-open Stack Viewer": {
            "content": "Toggle automatically opening the stack viewer on an unhandled\nexception.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Options menu Shell and Editor,  Next: Window menu Shell and Editor,  Prev: Debug menu Shell window only,  Up: Menus": {
            "content": "5.25.10.8 Options menu (Shell and Editor)\n.........................................\n",
            "subsections": []
        },
        "Configure IDLE": {
            "content": "Open a configuration dialog and change preferences for the\nfollowing: fonts, indentation, keybindings, text color themes,\nstartup windows and size, additional help sources, and extensions.\nOn macOS, open the configuration dialog by selecting Preferences in\nthe application menu.  For more details, see *note Setting\npreferences: 3bba. under Help and preferences.\n\nMost configuration options apply to all windows or all future windows.\nThe option items below only apply to the active window.\n",
            "subsections": []
        },
        "Show/Hide Code Context (Editor Window only)": {
            "content": "Open a pane at the top of the edit window which shows the block\ncontext of the code which has scrolled above the top of the window.\nSee *note Code Context: 3bbb. in the Editing and Navigation section\nbelow.\n",
            "subsections": []
        },
        "Show/Hide Line Numbers (Editor Window only)": {
            "content": "Open a column to the left of the edit window which shows the number\nof each line of text.  The default is off, which may be changed in\nthe preferences (see *note Setting preferences: 3bba.).\n",
            "subsections": []
        },
        "Zoom/Restore Height": {
            "content": "Toggles the window between normal size and maximum height.  The\ninitial size defaults to 40 lines by 80 chars unless changed on the\nGeneral tab of the Configure IDLE dialog.  The maximum height for a\nscreen is determined by momentarily maximizing a window the first\ntime one is zoomed on the screen.  Changing screen settings may\ninvalidate the saved height.  This toggle has no effect when a\nwindow is maximized.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Window menu Shell and Editor,  Next: Help menu Shell and Editor,  Prev: Options menu Shell and Editor,  Up: Menus": {
            "content": "5.25.10.9 Window menu (Shell and Editor)\n........................................\n",
            "subsections": []
        },
        "Lists the names of all open windows; select one to bring it to the": {
            "content": "foreground (deiconifying it if necessary).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Help menu Shell and Editor,  Next: Context menus,  Prev: Window menu Shell and Editor,  Up: Menus": {
            "content": "5.25.10.10 Help menu (Shell and Editor)\n.......................................\n",
            "subsections": []
        },
        "About IDLE": {
            "content": "Display version, copyright, license, credits, and more.\n\nIDLE Help\n\nDisplay this IDLE document, detailing the menu options, basic\nediting and navigation, and other tips.\n",
            "subsections": []
        },
        "Python Docs": {
            "content": "Access local Python documentation, if installed, or start a web\nbrowser and open docs.python.org showing the latest Python\ndocumentation.\n",
            "subsections": []
        },
        "Turtle Demo": {
            "content": "Run the turtledemo module with example Python code and turtle\ndrawings.\n",
            "subsections": []
        },
        "Additional help sources may be added here with the Configure IDLE dialog": {
            "content": "under the General tab.  See the *note Help sources: 3bbe. subsection\nbelow for more on Help menu choices.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Context menus,  Prev: Help menu Shell and Editor,  Up: Menus": {
            "content": "5.25.10.11 Context menus\n........................\n",
            "subsections": []
        },
        "Open a context menu by right-clicking in a window (Control-click on": {
            "content": "macOS). Context menus have the standard clipboard functions also on the\nEdit menu.\n",
            "subsections": []
        },
        "Editor windows also have breakpoint functions.  Lines with a breakpoint": {
            "content": "set are specially marked.  Breakpoints only have an effect when running\nunder the debugger.  Breakpoints for a file are saved in the user's\n'.idlerc' directory.\n",
            "subsections": []
        },
        "Set Breakpoint": {
            "content": "Set a breakpoint on the current line.\n",
            "subsections": []
        },
        "Clear Breakpoint": {
            "content": "Clear the breakpoint on that line.\n\nShell and Output windows also have the following.\n\nGo to file/line\n\nSame as in Debug menu.\n",
            "subsections": []
        },
        "The Shell window also has an output squeezing facility explained in the": {
            "content": "'Python Shell window' subsection below.\n",
            "subsections": []
        },
        "Squeeze": {
            "content": "If the cursor is over an output line, squeeze all the output\nbetween the code above and the prompt below down to a 'Squeezed\ntext' label.\n\nFile: python3.12.info,  Node: Editing and Navigation,  Next: Startup and Code Execution,  Prev: Menus,  Up: IDLE<57>\n\n5.25.10.12 Editing and Navigation\n.................................\n\n* Menu:\n\n* Editor windows::\n* Key bindings::\n* Automatic indentation::\n* Search and Replace::\n* Completions::\n* Calltips::\n* Code Context::\n* Shell window::\n* Text colors::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Editor windows,  Next: Key bindings,  Up: Editing and Navigation": {
            "content": "5.25.10.13 Editor windows\n.........................\n\nIDLE may open editor windows when it starts, depending on settings and\nhow you start IDLE. Thereafter, use the File menu.  There can be only\none open editor window for a given file.\n",
            "subsections": []
        },
        "The title bar contains the name of the file, the full path, and the": {
            "content": "version of Python and IDLE running the window.  The status bar contains\nthe line number ('Ln') and column number ('Col').  Line numbers start\nwith 1; column numbers with 0.\n\nIDLE assumes that files with a known .py* extension contain Python code\nand that other files do not.  Run Python code with the Run menu.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Key bindings,  Next: Automatic indentation,  Prev: Editor windows,  Up: Editing and Navigation": {
            "content": "5.25.10.14 Key bindings\n.......................\n",
            "subsections": []
        },
        "The IDLE insertion cursor is a thin vertical bar between character": {
            "content": "positions.  When characters are entered, the insertion cursor and\neverything to its right moves right one character and the new character\nis entered in the new space.\n",
            "subsections": []
        },
        "Several non-character keys move the cursor and possibly delete": {
            "content": "characters.  Deletion does not puts text on the clipboard, but IDLE has\nan undo list.  Wherever this doc discusses keys, 'C' refers to the\n'Control' key on Windows and Unix and the 'Command' key on macOS. (And\nall such dicussions assume that the keys have not been re-bound to\nsomething else.)\n\n* Arrow keys move the cursor one character or line.\n\n* 'C-LeftArrow' and 'C-RightArrow' moves left or right one word.\n\n* 'Home' and 'End' go to the beginning or end of the line.\n\n* 'Page Up' and 'Page Down' go up or down one screen.\n\n* 'C-Home' and 'C-End' go to beginning or end of the file.\n\n* 'Backspace' and 'Del' (or 'C-d') delete the previous or next\ncharacter.\n\n* 'C-Backspace' and 'C-Del' delete one word left or right.\n\n* 'C-k' deletes ('kills') everything to the right.\n\nStandard keybindings (like 'C-c' to copy and 'C-v' to paste) may work.\nKeybindings are selected in the Configure IDLE dialog.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Automatic indentation,  Next: Search and Replace,  Prev: Key bindings,  Up: Editing and Navigation": {
            "content": "5.25.10.15 Automatic indentation\n................................\n",
            "subsections": []
        },
        "After a block-opening statement, the next line is indented by 4 spaces": {
            "content": "(in the Python Shell window by one tab).  After certain keywords (break,\nreturn etc.)  the next line is dedented.  In leading indentation,\n'Backspace' deletes up to 4 spaces if they are there.  'Tab' inserts\nspaces (in the Python Shell window one tab), number depends on Indent\nwidth.  Currently, tabs are restricted to four spaces due to Tcl/Tk\nlimitations.\n\nSee also the indent/dedent region commands on the *note Format menu:\n3bb0.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Search and Replace,  Next: Completions,  Prev: Automatic indentation,  Up: Editing and Navigation": {
            "content": "5.25.10.16 Search and Replace\n.............................\n",
            "subsections": []
        },
        "Any selection becomes a search target.  However, only selections within": {
            "content": "a line work because searches are only performed within lines with the\nterminal newline removed.  If '[x] Regular expression' is checked, the\ntarget is interpreted according to the Python re module.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Completions,  Next: Calltips,  Prev: Search and Replace,  Up: Editing and Navigation": {
            "content": "5.25.10.17 Completions\n......................\n",
            "subsections": []
        },
        "Completions are supplied, when requested and available, for module": {
            "content": "names, attributes of classes or functions, or filenames.  Each request\nmethod displays a completion box with existing names.  (See tab\ncompletions below for an exception.)  For any box, change the name being\ncompleted and the item highlighted in the box by typing and deleting\ncharacters; by hitting 'Up', 'Down', 'PageUp', 'PageDown', 'Home', and\n'End' keys; and by a single click within the box.  Close the box with\n'Escape', 'Enter', and double 'Tab' keys or clicks outside the box.  A\ndouble click within the box selects and closes.\n",
            "subsections": []
        },
        "One way to open a box is to type a key character and wait for a": {
            "content": "predefined interval.  This defaults to 2 seconds; customize it in the\nsettings dialog.  (To prevent auto popups, set the delay to a large\nnumber of milliseconds, such as 100000000.)  For imported module names\nor class or function attributes, type '.'.  For filenames in the root\ndirectory, type *note os.sep: 434. or *note os.altsep: 435. immediately\nafter an opening quote.  (On Windows, one can specify a drive first.)\nMove into subdirectories by typing a directory name and a separator.\n",
            "subsections": []
        },
        "Instead of waiting, or after a box is closed, open a completion box": {
            "content": "immediately with Show Completions on the Edit menu.  The default hot key\nis 'C-space'.  If one types a prefix for the desired name before opening\nthe box, the first match or near miss is made visible.  The result is\nthe same as if one enters a prefix after the box is displayed.  Show",
            "subsections": []
        },
        "Completions after a quote completes filenames in the current directory": {
            "content": "instead of a root directory.\n",
            "subsections": []
        },
        "Hitting 'Tab' after a prefix usually has the same effect as Show": {
            "content": "",
            "subsections": []
        },
        "Completions.  (With no prefix, it indents.)  However, if there is only": {
            "content": "one match to the prefix, that match is immediately added to the editor\ntext without opening a box.\n",
            "subsections": []
        },
        "Invoking 'Show Completions', or hitting 'Tab' after a prefix, outside of": {
            "content": "a string and without a preceding '.' opens a box with keywords, builtin\nnames, and available module-level names.\n",
            "subsections": []
        },
        "When editing code in an editor (as oppose to Shell), increase the": {
            "content": "available module-level names by running your code and not restarting the",
            "subsections": []
        },
        "Shell thereafter.  This is especially useful after adding imports at the": {
            "content": "top of a file.  This also increases possible attribute completions.\n",
            "subsections": []
        },
        "Completion boxes initially exclude names beginning with '' or, for": {
            "content": "modules, not included in 'all'.  The hidden names can be accessed by\ntyping '' after '.', either before or after the box is opened.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Calltips,  Next: Code Context,  Prev: Completions,  Up: Editing and Navigation": {
            "content": "5.25.10.18 Calltips\n...................\n\nA calltip is shown automatically when one types '(' after the name of an\n'accessible' function.  A function name expression may include dots and\nsubscripts.  A calltip remains until it is clicked, the cursor is moved\nout of the argument area, or ')' is typed.  Whenever the cursor is in\nthe argument part of a definition, select Edit and \"Show Call Tip\" on\nthe menu or enter its shortcut to display a calltip.\n",
            "subsections": []
        },
        "The calltip consists of the function's signature and docstring up to the": {
            "content": "latter's first blank line or the fifth non-blank line.  (Some builtin\nfunctions lack an accessible signature.)  A '/' or '*' in the signature\nindicates that the preceding or following arguments are passed by\nposition or name (keyword) only.  Details are subject to change.\n",
            "subsections": []
        },
        "In Shell, the accessible functions depends on what modules have been": {
            "content": "imported into the user process, including those imported by Idle itself,\nand which definitions have been run, all since the last restart.\n",
            "subsections": []
        },
        "For example, restart the Shell and enter 'itertools.count('.  A calltip": {
            "content": "appears because Idle imports itertools into the user process for its own\nuse.  (This could change.)  Enter 'turtle.write(' and nothing appears.",
            "subsections": []
        },
        "Idle does not itself import turtle.  The menu entry and shortcut also do": {
            "content": "nothing.  Enter 'import turtle'.  Thereafter, 'turtle.write(' will\ndisplay a calltip.\n\nIn an editor, import statements have no effect until one runs the file.",
            "subsections": []
        },
        "One might want to run a file after writing import statements, after": {
            "content": "adding function definitions, or after opening an existing file.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Code Context,  Next: Shell window,  Prev: Calltips,  Up: Editing and Navigation": {
            "content": "5.25.10.19 Code Context\n.......................\n",
            "subsections": []
        },
        "Within an editor window containing Python code, code context can be": {
            "content": "toggled in order to show or hide a pane at the top of the window.  When\nshown, this pane freezes the opening lines for block code, such as those\nbeginning with 'class', 'def', or 'if' keywords, that would have\notherwise scrolled out of view.  The size of the pane will be expanded\nand contracted as needed to show the all current levels of context, up\nto the maximum number of lines defined in the Configure IDLE dialog\n(which defaults to 15).  If there are no current context lines and the\nfeature is toggled on, a single blank line will display.  Clicking on a\nline in the context pane will move that line to the top of the editor.\n",
            "subsections": []
        },
        "The text and background colors for the context pane can be configured": {
            "content": "under the Highlights tab in the Configure IDLE dialog.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Shell window,  Next: Text colors,  Prev: Code Context,  Up: Editing and Navigation": {
            "content": "5.25.10.20 Shell window\n.......................\n",
            "subsections": []
        },
        "In IDLE's Shell, enter, edit, and recall complete statements.  (Most": {
            "content": "consoles and terminals only work with a single physical line at a time).\n",
            "subsections": []
        },
        "Submit a single-line statement for execution by hitting 'Return' with": {
            "content": "the cursor anywhere on the line.  If a line is extended with Backslash\n('\\'), the cursor must be on the last physical line.  Submit a\nmulti-line compound statement by entering a blank line after the\nstatement.\n",
            "subsections": []
        },
        "When one pastes code into Shell, it is not compiled and possibly": {
            "content": "executed until one hits 'Return', as specified above.  One may edit\npasted code first.  If one pastes more than one statement into Shell,\nthe result will be a *note SyntaxError: 146. when multiple statements\nare compiled as if they were one.\n",
            "subsections": []
        },
        "Lines containing 'RESTART' mean that the user execution process has been": {
            "content": "re-started.  This occurs when the user execution process has crashed,\nwhen one requests a restart on the Shell menu, or when one runs code in\nan editor window.\n",
            "subsections": []
        },
        "The editing features described in previous subsections work when": {
            "content": "entering code interactively.  IDLE's Shell window also responds to the\nfollowing:\n\n* 'C-c' attempts to interrupt statement execution (but may fail).\n\n* 'C-d' closes Shell if typed at a '>>>' prompt.\n\n* 'Alt-p' and 'Alt-n' ('C-p' and 'C-n' on macOS) retrieve to the\ncurrent prompt the previous or next previously entered statement\nthat matches anything already typed.\n\n* 'Return' while the cursor is on any previous statement appends the\nlatter to anything already typed at the prompt.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Text colors,  Prev: Shell window,  Up: Editing and Navigation": {
            "content": "5.25.10.21 Text colors\n......................\n",
            "subsections": []
        },
        "Idle defaults to black on white text, but colors text with special": {
            "content": "meanings.  For the shell, these are shell output, shell error, user\noutput, and user error.  For Python code, at the shell prompt or in an\neditor, these are keywords, builtin class and function names, names\nfollowing 'class' and 'def', strings, and comments.  For any text\nwindow, these are the cursor (when present), found text (when possible),\nand selected text.\n\nIDLE also highlights the *note soft keywords: 600. *note match: 601,\n*note case: 601, and *note : 602. in pattern-matching statements.",
            "subsections": []
        },
        "However, this highlighting is not perfect and will be incorrect in some": {
            "content": "rare cases, including some ''-s in 'case' patterns.\n",
            "subsections": []
        },
        "Text coloring is done in the background, so uncolorized text is": {
            "content": "occasionally visible.  To change the color scheme, use the Configure\nIDLE dialog Highlighting tab.  The marking of debugger breakpoint lines\nin the editor and text in popups and dialogs is not user-configurable.\n\nFile: python3.12.info,  Node: Startup and Code Execution,  Next: Help and Preferences,  Prev: Editing and Navigation,  Up: IDLE<57>\n\n5.25.10.22 Startup and Code Execution\n.....................................\n",
            "subsections": []
        },
        "Upon startup with the '-s' option, IDLE will execute the file referenced": {
            "content": "by the environment variables 'IDLESTARTUP' or *note PYTHONSTARTUP: e3b.\nIDLE first checks for 'IDLESTARTUP'; if 'IDLESTARTUP' is present the\nfile referenced is run.  If 'IDLESTARTUP' is not present, IDLE checks\nfor 'PYTHONSTARTUP'.  Files referenced by these environment variables\nare convenient places to store functions that are used frequently from\nthe IDLE shell, or for executing import statements to import common\nmodules.\n",
            "subsections": []
        },
        "In addition, 'Tk' also loads a startup file if it is present.  Note that": {
            "content": "the Tk file is loaded unconditionally.  This additional file is\n'.Idle.py' and is looked for in the user's home directory.  Statements\nin this file will be executed in the Tk namespace, so this file is not\nuseful for importing functions to be used from IDLE's Python shell.\n\n* Menu:\n\n* Command line usage::\n* Startup failure::\n* Running user code::\n* User output in Shell::\n* Developing tkinter applications::\n* Running without a subprocess::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Command line usage,  Next: Startup failure,  Up: Startup and Code Execution": {
            "content": "5.25.10.23 Command line usage\n.............................\n\nidle.py [-c command] [-d] [-e] [-h] [-i] [-r file] [-s] [-t title] [-] [arg] ...\n\n-c command  run command in the shell window\n-d          enable debugger and open shell window\n-e          open editor window\n-h          print help message with legal combinations and exit\n-i          open shell window\n-r file     run file in shell window\n-s          run $IDLESTARTUP or $PYTHONSTARTUP first, in shell window\n-t title    set title of shell window\n-           run stdin in shell (- must be last option before args)\n\nIf there are arguments:\n\n* If '-', '-c', or 'r' is used, all arguments are placed in\n'sys.argv[1:...]' and 'sys.argv[0]' is set to '''', ''-c'', or\n''-r''.  No editor window is opened, even if that is the default\nset in the Options dialog.\n\n* Otherwise, arguments are files opened for editing and 'sys.argv'\nreflects the arguments passed to IDLE itself.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Startup failure,  Next: Running user code,  Prev: Command line usage,  Up: Startup and Code Execution": {
            "content": "5.25.10.24 Startup failure\n..........................\n\nIDLE uses a socket to communicate between the IDLE GUI process and the\nuser code execution process.  A connection must be established whenever\nthe Shell starts or restarts.  (The latter is indicated by a divider\nline that says 'RESTART').  If the user process fails to connect to the\nGUI process, it usually displays a 'Tk' error box with a 'cannot\nconnect' message that directs the user here.  It then exits.\n",
            "subsections": []
        },
        "One specific connection failure on Unix systems results from": {
            "content": "misconfigured masquerading rules somewhere in a system's network setup.",
            "subsections": []
        },
        "When IDLE is started from a terminal, one will see a message starting": {
            "content": "with ' Invalid host:'.  The valid value is '127.0.0.1\n(idlelib.rpc.LOCALHOST)'.  One can diagnose with 'tcpconnect -irv\n127.0.0.1 6543' in one terminal window and 'tcplisten <same args>' in\nanother.\n\nA common cause of failure is a user-written file with the same name as a\nstandard library module, such as 'random.py' and 'tkinter.py'.  When\nsuch a file is located in the same directory as a file that is about to\nbe run, IDLE cannot import the stdlib file.  The current fix is to\nrename the user file.\n",
            "subsections": []
        },
        "Though less common than in the past, an antivirus or firewall program": {
            "content": "may stop the connection.  If the program cannot be taught to allow the\nconnection, then it must be turned off for IDLE to work.  It is safe to\nallow this internal connection because no data is visible on external\nports.  A similar problem is a network mis-configuration that blocks\nconnections.\n",
            "subsections": []
        },
        "Python installation issues occasionally stop IDLE: multiple versions can": {
            "content": "clash, or a single installation might need admin access.  If one undo\nthe clash, or cannot or does not want to run as admin, it might be\neasiest to completely remove Python and start over.\n\nA zombie pythonw.exe process could be a problem.  On Windows, use Task",
            "subsections": []
        },
        "Manager to check for one and stop it if there is.  Sometimes a restart": {
            "content": "initiated by a program crash or Keyboard Interrupt (control-C) may fail\nto connect.  Dismissing the error box or using Restart Shell on the\nShell menu may fix a temporary problem.\n",
            "subsections": []
        },
        "When IDLE first starts, it attempts to read user configuration files in": {
            "content": "'~/.idlerc/' (~ is one's home directory).  If there is a problem, an\nerror message should be displayed.  Leaving aside random disk glitches,\nthis can be prevented by never editing the files by hand.  Instead, use\nthe configuration dialog, under Options.  Once there is an error in a\nuser configuration file, the best solution may be to delete it and start\nover with the settings dialog.\n",
            "subsections": []
        },
        "If IDLE quits with no message, and it was not started from a console,": {
            "content": "try starting it from a console or terminal ('python -m idlelib') and see\nif this results in an error message.\n",
            "subsections": []
        },
        "On Unix-based systems with tcl/tk older than '8.6.11' (see 'About IDLE')": {
            "content": "certain characters of certain fonts can cause a tk failure with a\nmessage to the terminal.  This can happen either if one starts IDLE to\nedit a file with such a character or later when entering such a\ncharacter.  If one cannot upgrade tcl/tk, then re-configure IDLE to use\na font that works better.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Running user code,  Next: User output in Shell,  Prev: Startup failure,  Up: Startup and Code Execution": {
            "content": "5.25.10.25 Running user code\n............................\n",
            "subsections": []
        },
        "With rare exceptions, the result of executing Python code with IDLE is": {
            "content": "intended to be the same as executing the same code by the default\nmethod, directly with Python in a text-mode system console or terminal\nwindow.  However, the different interface and operation occasionally\naffect visible results.  For instance, 'sys.modules' starts with more\nentries, and 'threading.activecount()' returns 2 instead of 1.\n",
            "subsections": []
        },
        "By default, IDLE runs user code in a separate OS process rather than in": {
            "content": "the user interface process that runs the shell and editor.  In the\nexecution process, it replaces 'sys.stdin', 'sys.stdout', and\n'sys.stderr' with objects that get input from and send output to the",
            "subsections": []
        },
        "Shell window.  The original values stored in 'sys.stdin',": {
            "content": "'sys.stdout', and 'sys.stderr' are not touched, but may be\n'None'.\n",
            "subsections": []
        },
        "Sending print output from one process to a text widget in another is": {
            "content": "slower than printing to a system terminal in the same process.  This has\nthe most effect when printing multiple arguments, as the string for each\nargument, each separator, the newline are sent separately.  For\ndevelopment, this is usually not a problem, but if one wants to print\nfaster in IDLE, format and join together everything one wants displayed\ntogether and then print a single string.  Both format strings and *note\nstr.join(): 1eb6. can help combine fields and lines.\n\nIDLE's standard stream replacements are not inherited by subprocesses\ncreated in the execution process, whether directly by user code or by\nmodules such as multiprocessing.  If such subprocess use 'input' from\nsys.stdin or 'print' or 'write' to sys.stdout or sys.stderr, IDLE should\nbe started in a command line window.  (On Windows, use 'python' or 'py'\nrather than 'pythonw' or 'pyw'.)  The secondary subprocess will then be\nattached to that window for input and output.\n",
            "subsections": []
        },
        "If 'sys' is reset by user code, such as with 'importlib.reload(sys)',": {
            "content": "IDLE's changes are lost and input from the keyboard and output to the\nscreen will not work correctly.\n",
            "subsections": []
        },
        "When Shell has the focus, it controls the keyboard and screen.  This is": {
            "content": "normally transparent, but functions that directly access the keyboard\nand screen will not work.  These include system-specific functions that\ndetermine whether a key has been pressed and if so, which.\n",
            "subsections": []
        },
        "The IDLE code running in the execution process adds frames to the call": {
            "content": "stack that would not be there otherwise.  IDLE wraps\n'sys.getrecursionlimit' and 'sys.setrecursionlimit' to reduce the effect\nof the additional stack frames.\n",
            "subsections": []
        },
        "When user code raises SystemExit either directly or by calling sys.exit,": {
            "content": "IDLE returns to a Shell prompt instead of exiting.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: User output in Shell,  Next: Developing tkinter applications,  Prev: Running user code,  Up: Startup and Code Execution": {
            "content": "5.25.10.26 User output in Shell\n...............................\n",
            "subsections": []
        },
        "When a program outputs text, the result is determined by the": {
            "content": "corresponding output device.  When IDLE executes user code, 'sys.stdout'\nand 'sys.stderr' are connected to the display area of IDLE's Shell.\nSome of its features are inherited from the underlying Tk Text widget.",
            "subsections": []
        },
        "Others are programmed additions.  Where it matters, Shell is designed": {
            "content": "for development rather than production runs.\n",
            "subsections": []
        },
        "For instance, Shell never throws away output.  A program that sends": {
            "content": "unlimited output to Shell will eventually fill memory, resulting in a\nmemory error.  In contrast, some system text windows only keep the last\nn lines of output.  A Windows console, for instance, keeps a\nuser-settable 1 to 9999 lines, with 300 the default.\n\nA Tk Text widget, and hence IDLE's Shell, displays characters\n(codepoints) in the BMP (Basic Multilingual Plane) subset of Unicode.",
            "subsections": []
        },
        "Which characters are displayed with a proper glyph and which with a": {
            "content": "replacement box depends on the operating system and installed fonts.",
            "subsections": []
        },
        "Tab characters cause the following text to begin after the next tab": {
            "content": "stop.  (They occur every 8 'characters').  Newline characters cause\nfollowing text to appear on a new line.  Other control characters are\nignored or displayed as a space, box, or something else, depending on\nthe operating system and font.  (Moving the text cursor through such\noutput with arrow keys may exhibit some surprising spacing behavior.)\n\n>>> s = 'a\\tb\\a<\\x02><\\r>\\bc\\nd'  # Enter 22 chars.\n>>> len(s)\n14\n>>> s  # Display repr(s)\n'a\\tb\\x07<\\x02><\\r>\\x08c\\nd'\n>>> print(s, end='')  # Display s as is.\n# Result varies by OS and font.  Try it.\n\nThe 'repr' function is used for interactive echo of expression values.",
            "subsections": []
        },
        "It returns an altered version of the input string in which control": {
            "content": "codes, some BMP codepoints, and all non-BMP codepoints are replaced with\nescape codes.  As demonstrated above, it allows one to identify the\ncharacters in a string, regardless of how they are displayed.\n",
            "subsections": []
        },
        "Normal and error output are generally kept separate (on separate lines)": {
            "content": "from code input and each other.  They each get different highlight\ncolors.\n\nFor SyntaxError tracebacks, the normal '^' marking where the error was\ndetected is replaced by coloring the text with an error highlight.  When\ncode run from a file causes other exceptions, one may right click on a\ntraceback line to jump to the corresponding line in an IDLE editor.  The\nfile will be opened if necessary.\n",
            "subsections": []
        },
        "Shell has a special facility for squeezing output lines down to a": {
            "content": "'Squeezed text' label.  This is done automatically for output over N\nlines (N = 50 by default).  N can be changed in the PyShell section of\nthe General page of the Settings dialog.  Output with fewer lines can be\nsqueezed by right clicking on the output.  This can be useful lines long\nenough to slow down scrolling.\n",
            "subsections": []
        },
        "Squeezed output is expanded in place by double-clicking the label.  It": {
            "content": "can also be sent to the clipboard or a separate view window by\nright-clicking the label.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Developing tkinter applications,  Next: Running without a subprocess,  Prev: User output in Shell,  Up: Startup and Code Execution": {
            "content": "5.25.10.27 Developing tkinter applications\n..........................................\n\nIDLE is intentionally different from standard Python in order to\nfacilitate development of tkinter programs.  Enter 'import tkinter as\ntk; root = tk.Tk()' in standard Python and nothing appears.  Enter the\nsame in IDLE and a tk window appears.  In standard Python, one must also\nenter 'root.update()' to see the window.  IDLE does the equivalent in\nthe background, about 20 times a second, which is about every 50\nmilliseconds.  Next enter 'b = tk.Button(root, text='button');\nb.pack()'.  Again, nothing visibly changes in standard Python until one\nenters 'root.update()'.\n",
            "subsections": []
        },
        "Most tkinter programs run 'root.mainloop()', which usually does not": {
            "content": "return until the tk app is destroyed.  If the program is run with\n'python -i' or from an IDLE editor, a '>>>' shell prompt does not appear\nuntil 'mainloop()' returns, at which time there is nothing left to\ninteract with.\n",
            "subsections": []
        },
        "When running a tkinter program from an IDLE editor, one can comment out": {
            "content": "the mainloop call.  One then gets a shell prompt immediately and can\ninteract with the live application.  One just has to remember to\nre-enable the mainloop call when running in standard Python.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Running without a subprocess,  Prev: Developing tkinter applications,  Up: Startup and Code Execution": {
            "content": "5.25.10.28 Running without a subprocess\n.......................................\n",
            "subsections": []
        },
        "By default, IDLE executes user code in a separate subprocess via a": {
            "content": "socket, which uses the internal loopback interface.  This connection is\nnot externally visible and no data is sent to or received from the\ninternet.  If firewall software complains anyway, you can ignore it.\n",
            "subsections": []
        },
        "If the attempt to make the socket connection fails, Idle will notify": {
            "content": "you.  Such failures are sometimes transient, but if persistent, the\nproblem may be either a firewall blocking the connection or\nmisconfiguration of a particular system.  Until the problem is fixed,\none can run Idle with the -n command line switch.\n",
            "subsections": []
        },
        "If IDLE is started with the -n command line switch it will run in a": {
            "content": "single process and will not create the subprocess which runs the RPC",
            "subsections": []
        },
        "Python execution server.  This can be useful if Python cannot create the": {
            "content": "subprocess or the RPC socket interface on your platform.  However, in\nthis mode user code is not isolated from IDLE itself.  Also, the\nenvironment is not restarted when Run/Run Module (F5) is selected.  If\nyour code has been modified, you must reload() the affected modules and\nre-import any specific items (e.g.  from foo import baz) if the changes\nare to take effect.  For these reasons, it is preferable to run IDLE\nwith the default subprocess if at all possible.\n\nDeprecated since version 3.4.\n\nFile: python3.12.info,  Node: Help and Preferences,  Next: idlelib,  Prev: Startup and Code Execution,  Up: IDLE<57>\n\n5.25.10.29 Help and Preferences\n...............................\n\n* Menu:\n\n* Help sources::\n* Setting preferences::\n* IDLE on macOS::\n* Extensions::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Help sources,  Next: Setting preferences,  Up: Help and Preferences": {
            "content": "5.25.10.30 Help sources\n.......................\n\nHelp menu entry \"IDLE Help\" displays a formatted html version of the\nIDLE chapter of the Library Reference.  The result, in a read-only\ntkinter text window, is close to what one sees in a web browser.",
            "subsections": []
        },
        "Navigate through the text with a mousewheel, the scrollbar, or up and": {
            "content": "down arrow keys held down.  Or click the TOC (Table of Contents) button\nand select a section header in the opened box.\n\nHelp menu entry \"Python Docs\" opens the extensive sources of help,\nincluding tutorials, available at 'docs.python.org/x.y', where 'x.y' is\nthe currently running Python version.  If your system has an off-line\ncopy of the docs (this may be an installation option), that will be\nopened instead.\n",
            "subsections": []
        },
        "Selected URLs can be added or removed from the help menu at any time": {
            "content": "using the General tab of the Configure IDLE dialog.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Setting preferences,  Next: IDLE on macOS,  Prev: Help sources,  Up: Help and Preferences": {
            "content": "5.25.10.31 Setting preferences\n..............................\n",
            "subsections": []
        },
        "The font preferences, highlighting, keys, and general preferences can be": {
            "content": "changed via Configure IDLE on the Option menu.  Non-default user\nsettings are saved in a '.idlerc' directory in the user's home\ndirectory.  Problems caused by bad user configuration files are solved\nby editing or deleting one or more of the files in '.idlerc'.\n",
            "subsections": []
        },
        "On the Font tab, see the text sample for the effect of font face and": {
            "content": "size on multiple characters in multiple languages.  Edit the sample to\nadd other characters of personal interest.  Use the sample to select\nmonospaced fonts.  If particular characters have problems in Shell or an\neditor, add them to the top of the sample and try changing first size\nand then font.\n",
            "subsections": []
        },
        "On the Highlights and Keys tab, select a built-in or custom color theme": {
            "content": "and key set.  To use a newer built-in color theme or key set with older\nIDLEs, save it as a new custom theme or key set and it well be\naccessible to older IDLEs.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: IDLE on macOS,  Next: Extensions,  Prev: Setting preferences,  Up: Help and Preferences": {
            "content": "5.25.10.32 IDLE on macOS\n........................\n\nUnder System Preferences: Dock, one can set \"Prefer tabs when opening\ndocuments\" to \"Always\".  This setting is not compatible with the\ntk/tkinter GUI framework used by IDLE, and it breaks a few IDLE\nfeatures.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Extensions,  Prev: IDLE on macOS,  Up: Help and Preferences": {
            "content": "5.25.10.33 Extensions\n.....................\n\nIDLE contains an extension facility.  Preferences for extensions can be\nchanged with the Extensions tab of the preferences dialog.  See the\nbeginning of config-extensions.def in the idlelib directory for further\ninformation.  The only current default extension is zzdummy, an example\nalso used for testing.\n\nFile: python3.12.info,  Node: idlelib,  Prev: Help and Preferences,  Up: IDLE<57>\n\n5.25.10.34 idlelib\n..................\n\n'Source code:' Lib/idlelib(1)\n\n\n",
            "subsections": []
        },
        "The Lib/idlelib package implements the IDLE application.  See the rest": {
            "content": "of this page for how to use IDLE.\n",
            "subsections": []
        },
        "The files in idlelib are described in idlelib/README.txt.  Access it": {
            "content": "either in idlelib or click Help => About IDLE on the IDLE menu.  This\nfile also maps IDLE menu items to the code that implements the item.",
            "subsections": []
        },
        "Except for files listed under 'Startup', the idlelib code is 'private'": {
            "content": "in sense that feature changes can be backported (see PEP 434(2)).\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/idlelib\n\n(2) https://peps.python.org/pep-0434/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Development Tools,  Next: Debugging and Profiling,  Prev: Graphical User Interfaces with Tk,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.26 Development Tools",
                    "content": ""
                }
            ]
        },
        "The modules described in this chapter help you write software.  For": {
            "content": "example, the *note pydoc: b0. module takes a module and generates\ndocumentation based on the module's contents.  The *note doctest: 36.\nand *note unittest: 101. modules contains frameworks for writing unit\ntests that automatically exercise code and verify that the expected\noutput is produced.  '2to3' can translate Python 2.x source code into\nvalid Python 3.x code.\n\nThe list of modules described in this chapter is:\n\n* Menu:\n\n* typing -- Support for type hints::\n* pydoc -- Documentation generator and online help system::\n* Python Development Mode::\n* doctest -- Test interactive Python examples::\n* unittest -- Unit testing framework::\n* unittest.mock -- mock object library: unittest mock -- mock object library.\n* unittest.mock -- getting started: unittest mock -- getting started.\n* 2to3 -- Automated Python 2 to 3 code translation::\n* test -- Regression tests package for Python::\n* test.support -- Utilities for the Python test suite: test support -- Utilities for the Python test suite.\n* test.support.sockethelper -- Utilities for socket tests: test support sockethelper -- Utilities for socket tests.\n* test.support.scripthelper -- Utilities for the Python execution tests: test support scripthelper -- Utilities for the Python execution tests.\n* test.support.bytecodehelper -- Support tools for testing correct bytecode generation: test support bytecodehelper -- Support tools for testing correct bytecode generation.\n* test.support.threadinghelper -- Utilities for threading tests: test support threadinghelper -- Utilities for threading tests.\n* test.support.oshelper -- Utilities for os tests: test support oshelper -- Utilities for os tests.\n* test.support.importhelper -- Utilities for import tests: test support importhelper -- Utilities for import tests.\n* test.support.warningshelper -- Utilities for warnings tests: test support warningshelper -- Utilities for warnings tests.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: typing -- Support for type hints,  Next: pydoc -- Documentation generator and online help system,  Up: Development Tools": {
            "content": "New in version 3.5.\n\n'Source code:' Lib/typing.py(1)\n\nNote: The Python runtime does not enforce function and variable\ntype annotations.  They can be used by third party tools such as\n*note type checkers: 2132, IDEs, linters, etc.\n\n\n\nThis module provides runtime support for type hints.\n\nConsider the function below:\n\ndef moonweight(earthweight: float) -> str:\nreturn f'On the moon, you would weigh {earthweight * 0.166} kilograms.'\n",
            "subsections": []
        },
        "The function 'moonweight' takes an argument expected to be an instance": {
            "content": "of *note float: 4b7, as indicated by the 'type hint' 'earthweight:\nfloat'.  The function is expected to return an instance of *note str:\n157, as indicated by the '-> str' hint.\n\nWhile type hints can be simple classes like *note float: 4b7. or *note\nstr: 157, they can also be more complex.  The *note typing: ff. module\nprovides a vocabulary of more advanced type hints.\n",
            "subsections": []
        },
        "New features are frequently added to the 'typing' module.  The": {
            "content": "typingextensions(2) package provides backports of these new features to\nolder versions of Python.\n\nSee also\n........\n\n\"Typing cheat sheet\"(3)\n\nA quick overview of type hints (hosted at the mypy docs)\n\n\"Type System Reference\" section of the mypy docs(4)\n\nThe Python typing system is standardised via PEPs, so this\nreference should broadly apply to most Python type checkers.  (Some\nparts may still be specific to mypy.)\n\n\"Static Typing with Python\"(5)\n\nType-checker-agnostic documentation written by the community\ndetailing type system features, useful typing related tools and\ntyping best practices.\n\n* Menu:\n\n* Specification for the Python Type System::\n* Type aliases::\n* NewType::\n* Annotating callable objects::\n* Generics::\n* Annotating tuples::\n* The type of class objects::\n* User-defined generic types::\n* The Any type::\n* Nominal vs structural subtyping::\n* Module contents: Module contents<3>.\n* Deprecation Timeline of Major Features::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/typing.py\n\n(2) https://pypi.org/project/typing-extensions/\n\n(3) https://mypy.readthedocs.io/en/stable/cheatsheetpy3.html\n\n(4) https://mypy.readthedocs.io/en/stable/index.html\n\n(5) https://typing.readthedocs.io/en/latest/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Specification for the Python Type System,  Next: Type aliases,  Up: typing -- Support for type hints": {
            "content": "5.26.1.1 Specification for the Python Type System\n.................................................\n",
            "subsections": []
        },
        "The canonical, up-to-date specification of the Python type system can be": {
            "content": "found at \"Specification for the Python type system\"(1).\n\n---------- Footnotes ----------\n\n(1) https://typing.readthedocs.io/en/latest/spec/index.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Type aliases,  Next: NewType,  Prev: Specification for the Python Type System,  Up: typing -- Support for type hints": {
            "content": "5.26.1.2 Type aliases\n.....................\n\nA type alias is defined using the *note type: 13a. statement, which\ncreates an instance of *note TypeAliasType: 160.  In this example,\n'Vector' and 'list[float]' will be treated equivalently by static type\ncheckers:\n\ntype Vector = list[float]\n\ndef scale(scalar: float, vector: Vector) -> Vector:\nreturn [scalar * num for num in vector]\n\n# passes type checking; a list of floats qualifies as a Vector.\nnewvector = scale(2.0, [1.0, -4.2, 5.4])\n",
            "subsections": []
        },
        "Type aliases are useful for simplifying complex type signatures.  For": {
            "content": "example:\n\nfrom collections.abc import Sequence\n\ntype ConnectionOptions = dict[str, str]\ntype Address = tuple[str, int]\ntype Server = tuple[Address, ConnectionOptions]\n\ndef broadcastmessage(message: str, servers: Sequence[Server]) -> None:\n...\n\n# The static type checker will treat the previous type signature as\n# being exactly equivalent to this one.\ndef broadcastmessage(\nmessage: str,\nservers: Sequence[tuple[tuple[str, int], dict[str, str]]]) -> None:\n...\n\nThe *note type: 13a. statement is new in Python 3.12.  For backwards\ncompatibility, type aliases can also be created through simple\nassignment:\n\nVector = list[float]\n\nOr marked with *note TypeAlias: 1696. to make it explicit that this is a\ntype alias, not a normal variable assignment:\n\nfrom typing import TypeAlias\n\nVector: TypeAlias = list[float]\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: NewType,  Next: Annotating callable objects,  Prev: Type aliases,  Up: typing -- Support for type hints": {
            "content": "5.26.1.3 NewType\n................\n\nUse the *note NewType: b45. helper to create distinct types:\n\nfrom typing import NewType\n\nUserId = NewType('UserId', int)\nsomeid = UserId(524313)\n",
            "subsections": []
        },
        "You may still perform all 'int' operations on a variable of type": {
            "content": "'UserId', but the result will always be of type 'int'.  This lets you\npass in a 'UserId' wherever an 'int' might be expected, but will prevent\nyou from accidentally creating a 'UserId' in an invalid way:\n\n# 'output' is of type 'int', not 'UserId'\noutput = UserId(23413) + UserId(54341)\n",
            "subsections": []
        },
        "Note that these checks are enforced only by the static type checker.  At": {
            "content": "runtime, the statement 'Derived = NewType('Derived', Base)' will make\n'Derived' a callable that immediately returns whatever parameter you\npass it.  That means the expression 'Derived(somevalue)' does not\ncreate a new class or introduce much overhead beyond that of a regular\nfunction call.\n",
            "subsections": []
        },
        "More precisely, the expression 'somevalue is Derived(somevalue)' is": {
            "content": "always true at runtime.\n\nIt is invalid to create a subtype of 'Derived':\n\nfrom typing import NewType\n\nUserId = NewType('UserId', int)\n\n# Fails at runtime and does not pass type checking\nclass AdminUserId(UserId): pass\n\nHowever, it is possible to create a *note NewType: b45. based on a\n'derived' 'NewType':\n\nfrom typing import NewType\n\nUserId = NewType('UserId', int)\n\nProUserId = NewType('ProUserId', UserId)\n\nand typechecking for 'ProUserId' will work as expected.\n\nSee PEP 484(1) for more details.\n\nNote: Recall that the use of a type alias declares two types to be\n'equivalent' to one another.  Doing 'type Alias = Original' will\nmake the static type checker treat 'Alias' as being 'exactly\nequivalent' to 'Original' in all cases.  This is useful when you\nwant to simplify complex type signatures.\n\nIn contrast, 'NewType' declares one type to be a 'subtype' of\nanother.  Doing 'Derived = NewType('Derived', Original)' will make\nthe static type checker treat 'Derived' as a 'subclass' of\n'Original', which means a value of type 'Original' cannot be used\nin places where a value of type 'Derived' is expected.  This is\nuseful when you want to prevent logic errors with minimal runtime\ncost.\n\nNew in version 3.5.2.\n",
            "subsections": []
        },
        "Changed in version 3.10: 'NewType' is now a class rather than a": {
            "content": "function.  As a result, there is some additional runtime cost when\ncalling 'NewType' over a regular function.\n",
            "subsections": []
        },
        "Changed in version 3.11: The performance of calling 'NewType' has been": {
            "content": "restored to its level in Python 3.9.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0484/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Annotating callable objects,  Next: Generics,  Prev: NewType,  Up: typing -- Support for type hints": {
            "content": "5.26.1.4 Annotating callable objects\n....................................\n\nFunctions - or other *note callable: 25e6. objects - can be annotated\nusing *note collections.abc.Callable: 5de. or *note typing.Callable:\n5b8.  'Callable[[int], str]' signifies a function that takes a single\nparameter of type *note int: 17e. and returns a *note str: 157.\n\nFor example:\n\nfrom collections.abc import Callable, Awaitable\n\ndef feeder(getnextitem: Callable[[], str]) -> None:\n...  # Body\n\ndef asyncquery(onsuccess: Callable[[int], None],\nonerror: Callable[[int, Exception], None]) -> None:\n...  # Body\n\nasync def onupdate(value: str) -> None:\n...  # Body\n\ncallback: Callable[[str], Awaitable[None]] = onupdate\n",
            "subsections": []
        },
        "The subscription syntax must always be used with exactly two values: the": {
            "content": "argument list and the return type.  The argument list must be a list of\ntypes, a *note ParamSpec: 163, *note Concatenate: 5b7, or an ellipsis.\nThe return type must be a single type.\n",
            "subsections": []
        },
        "If a literal ellipsis '...' is given as the argument list, it indicates": {
            "content": "that a callable with any arbitrary parameter list would be acceptable:\n\ndef concat(x: str, y: str) -> str:\nreturn x + y\n\nx: Callable[..., str]\nx = str     # OK\nx = concat  # Also OK\n\n'Callable' cannot express complex signatures such as functions that take\na variadic number of arguments, *note overloaded functions: 3be4, or\nfunctions that have keyword-only parameters.  However, these signatures\ncan be expressed by defining a *note Protocol: 47e. class with a *note\ncall(): 2b1. method:\n\nfrom collections.abc import Iterable\nfrom typing import Protocol\n\nclass Combiner(Protocol):\ndef call(self, *vals: bytes, maxlen: int | None = None) -> list[bytes]: ...\n\ndef batchproc(data: Iterable[bytes], cbresults: Combiner) -> bytes:\nfor item in data:\n...\n\ndef goodcb(*vals: bytes, maxlen: int | None = None) -> list[bytes]:\n...\ndef badcb(*vals: bytes, maxitems: int | None) -> list[bytes]:\n...\n\nbatchproc([], goodcb)  # OK\nbatchproc([], badcb)   # Error! Argument 2 has incompatible type because of\n# different name and kind in the callback\n",
            "subsections": []
        },
        "Callables which take other callables as arguments may indicate that": {
            "content": "their parameter types are dependent on each other using *note ParamSpec:\n163.  Additionally, if that callable adds or removes arguments from\nother callables, the *note Concatenate: 5b7. operator may be used.  They\ntake the form 'Callable[ParamSpecVariable, ReturnType]' and\n'Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable],\nReturnType]' respectively.\n\nChanged in version 3.10: 'Callable' now supports *note ParamSpec: 163.\nand *note Concatenate: 5b7.  See PEP 612(1) for more details.\n\nSee also\n........\n\nThe documentation for *note ParamSpec: 163. and *note Concatenate: 5b7.\nprovides examples of usage in 'Callable'.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0612/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Generics,  Next: Annotating tuples,  Prev: Annotating callable objects,  Up: typing -- Support for type hints": {
            "content": "5.26.1.5 Generics\n.................\n",
            "subsections": []
        },
        "Since type information about objects kept in containers cannot be": {
            "content": "statically inferred in a generic way, many container classes in the\nstandard library support subscription to denote the expected types of\ncontainer elements.\n\nfrom collections.abc import Mapping, Sequence\n\nclass Employee: ...\n\n# Sequence[Employee] indicates that all elements in the sequence\n# must be instances of \"Employee\".\n# Mapping[str, str] indicates that all keys and all values in the mapping\n# must be strings.\ndef notifybyemail(employees: Sequence[Employee],\noverrides: Mapping[str, str]) -> None: ...\n\nGeneric functions and classes can be parameterized by using *note type\nparameter syntax: 166.:\n\nfrom collections.abc import Sequence\n\ndef first[T](l: Sequence[T]) -> T:  # Function is generic over the TypeVar \"T\"\nreturn l[0]\n\nOr by using the *note TypeVar: 164. factory directly:\n\nfrom collections.abc import Sequence\nfrom typing import TypeVar\n\nU = TypeVar('U')                  # Declare type variable \"U\"\n\ndef second(l: Sequence[U]) -> U:  # Function is generic over the TypeVar \"U\"\nreturn l[1]\n",
            "subsections": []
        },
        "Changed in version 3.12: Syntactic support for generics is new in Python": {
            "content": "3.12.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Annotating tuples,  Next: The type of class objects,  Prev: Generics,  Up: typing -- Support for type hints": {
            "content": "5.26.1.6 Annotating tuples\n..........................\n",
            "subsections": []
        },
        "For most containers in Python, the typing system assumes that all": {
            "content": "elements in the container will be of the same type.  For example:\n\nfrom collections.abc import Mapping\n\n# Type checker will infer that all elements in ``x`` are meant to be ints\nx: list[int] = []\n\n# Type checker error: ``list`` only accepts a single type argument:\ny: list[int, str] = [1, 'foo']\n\n# Type checker will infer that all keys in ``z`` are meant to be strings,\n# and that all values in ``z`` are meant to be either strings or ints\nz: Mapping[str, str | int] = {}\n\n*note list: 3dc. only accepts one type argument, so a type checker would\nemit an error on the 'y' assignment above.  Similarly, *note Mapping:\n6e2. only accepts two type arguments: the first indicates the type of\nthe keys, and the second indicates the type of the values.\n",
            "subsections": []
        },
        "Unlike most other Python containers, however, it is common in idiomatic": {
            "content": "",
            "subsections": []
        },
        "Python code for tuples to have elements which are not all of the same": {
            "content": "type.  For this reason, tuples are special-cased in Python's typing\nsystem.  *note tuple: 4b8. accepts 'any number' of type arguments:\n\n# OK: ``x`` is assigned to a tuple of length 1 where the sole element is an int\nx: tuple[int] = (5,)\n\n# OK: ``y`` is assigned to a tuple of length 2;\n# element 1 is an int, element 2 is a str\ny: tuple[int, str] = (5, \"foo\")\n\n# Error: the type annotation indicates a tuple of length 1,\n# but ``z`` has been assigned to a tuple of length 3\nz: tuple[int] = (1, 2, 3)\n",
            "subsections": []
        },
        "To denote a tuple which could be of 'any' length, and in which all": {
            "content": "elements are of the same type 'T', use 'tuple[T, ...]'.  To denote an\nempty tuple, use 'tuple[()]'.  Using plain 'tuple' as an annotation is\nequivalent to using 'tuple[Any, ...]':\n\nx: tuple[int, ...] = (1, 2)\n# These reassignments are OK: ``tuple[int, ...]`` indicates x can be of any length\nx = (1, 2, 3)\nx = ()\n# This reassignment is an error: all elements in ``x`` must be ints\nx = (\"foo\", \"bar\")\n\n# ``y`` can only ever be assigned to an empty tuple\ny: tuple[()] = ()\n\nz: tuple = (\"foo\", \"bar\")\n# These reassignments are OK: plain ``tuple`` is equivalent to ``tuple[Any, ...]``\nz = (1, 2, 3)\nz = ()\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The type of class objects,  Next: User-defined generic types,  Prev: Annotating tuples,  Up: typing -- Support for type hints": {
            "content": "5.26.1.7 The type of class objects\n..................................\n\nA variable annotated with 'C' may accept a value of type 'C'.  In\ncontrast, a variable annotated with 'type[C]' (or *note typing.Type[C]:\n3bea.) may accept values that are classes themselves - specifically, it\nwill accept the 'class object' of 'C'.  For example:\n\na = 3         # Has type ``int``\nb = int       # Has type ``type[int]``\nc = type(a)   # Also has type ``type[int]``\n\nNote that 'type[C]' is covariant:\n\nclass User: ...\nclass ProUser(User): ...\nclass TeamUser(User): ...\n\ndef makenewuser(userclass: type[User]) -> User:\n# ...\nreturn userclass()\n\nmakenewuser(User)      # OK\nmakenewuser(ProUser)   # Also OK: ``type[ProUser]`` is a subtype of ``type[User]``\nmakenewuser(TeamUser)  # Still fine\nmakenewuser(User())    # Error: expected ``type[User]`` but got ``User``\nmakenewuser(int)       # Error: ``type[int]`` is not a subtype of ``type[User]``\n\nThe only legal parameters for *note type: ba0. are classes, *note Any:\n479, *note type variables: 1c87, and unions of any of these types.  For\nexample:\n\ndef newnonteamuser(userclass: type[BasicUser | ProUser]): ...\n\nnewnonteamuser(BasicUser)  # OK\nnewnonteamuser(ProUser)    # OK\nnewnonteamuser(TeamUser)   # Error: ``type[TeamUser]`` is not a subtype\n# of ``type[BasicUser | ProUser]``\nnewnonteamuser(User)       # Also an error\n\n'type[Any]' is equivalent to *note type: ba0, which is the root of\nPython's *note metaclass hierarchy: 1c7b.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: User-defined generic types,  Next: The Any type,  Prev: The type of class objects,  Up: typing -- Support for type hints": {
            "content": "5.26.1.8 User-defined generic types\n...................................\n\nA user-defined class can be defined as a generic class.\n\nfrom logging import Logger\n\nclass LoggedVar[T]:\ndef init(self, value: T, name: str, logger: Logger) -> None:\nself.name = name\nself.logger = logger\nself.value = value\n\ndef set(self, new: T) -> None:\nself.log('Set ' + repr(self.value))\nself.value = new\n\ndef get(self) -> T:\nself.log('Get ' + repr(self.value))\nreturn self.value\n\ndef log(self, message: str) -> None:\nself.logger.info('%s: %s', self.name, message)\n",
            "subsections": []
        },
        "This syntax indicates that the class 'LoggedVar' is parameterised around": {
            "content": "a single *note type variable: 3bec. 'T' .  This also makes 'T' valid as\na type within the class body.\n\nGeneric classes implicitly inherit from *note Generic: 1453.  For\ncompatibility with Python 3.11 and lower, it is also possible to inherit\nexplicitly from *note Generic: 1453. to indicate a generic class:\n\nfrom typing import TypeVar, Generic\n\nT = TypeVar('T')\n\nclass LoggedVar(Generic[T]):\n...\n\nGeneric classes have *note classgetitem(): 520. methods, meaning\nthey can be parameterised at runtime (e.g.  'LoggedVar[int]' below):\n\nfrom collections.abc import Iterable\n\ndef zeroallvars(vars: Iterable[LoggedVar[int]]) -> None:\nfor var in vars:\nvar.set(0)\n\nA generic type can have any number of type variables.  All varieties of\n*note TypeVar: 164. are permissible as parameters for a generic type:\n\nfrom typing import TypeVar, Generic, Sequence\n\nclass WeirdTrio[T, B: Sequence[bytes], S: (int, str)]:\n...\n\nOldT = TypeVar('OldT', contravariant=True)\nOldB = TypeVar('OldB', bound=Sequence[bytes], covariant=True)\nOldS = TypeVar('OldS', int, str)\n\nclass OldWeirdTrio(Generic[OldT, OldB, OldS]):\n...\n\nEach type variable argument to *note Generic: 1453. must be distinct.\nThis is thus invalid:\n\nfrom typing import TypeVar, Generic\n...\n\nclass Pair[M, M]:  # SyntaxError\n...\n\nT = TypeVar('T')\n\nclass Pair(Generic[T, T]):   # INVALID\n...\n\nGeneric classes can also inherit from other classes:\n\nfrom collections.abc import Sized\n\nclass LinkedList[T](Sized):\n...\n",
            "subsections": []
        },
        "When inheriting from generic classes, some type parameters could be": {
            "content": "fixed:\n\nfrom collections.abc import Mapping\n\nclass MyDict[T](Mapping[str, T]):\n...\n\nIn this case 'MyDict' has a single parameter, 'T'.\n\nUsing a generic class without specifying type parameters assumes *note",
            "subsections": []
        },
        "Any: 479. for each position.  In the following example, 'MyIterable' is": {
            "content": "not generic but implicitly inherits from 'Iterable[Any]':\n\nfrom collections.abc import Iterable\n\nclass MyIterable(Iterable): # Same as Iterable[Any]\n...\n\nUser-defined generic type aliases are also supported.  Examples:\n\nfrom collections.abc import Iterable\n\ntype Response[S] = Iterable[S] | int\n\n# Return type here is same as Iterable[str] | int\ndef response(query: str) -> Response[str]:\n...\n\ntype Vec[T] = Iterable[tuple[T, T]]\n\ndef inproduct[T: (int, float, complex)](v: Vec[T]) -> T: # Same as Iterable[tuple[T, T]]\nreturn sum(x*y for x, y in v)\n",
            "subsections": []
        },
        "For backward compatibility, generic type aliases can also be created": {
            "content": "through a simple assignment:\n\nfrom collections.abc import Iterable\nfrom typing import TypeVar\n\nS = TypeVar(\"S\")\nResponse = Iterable[S] | int\n\nChanged in version 3.7: *note Generic: 1453. no longer has a custom\nmetaclass.\n",
            "subsections": []
        },
        "Changed in version 3.12: Syntactic support for generics and type aliases": {
            "content": "is new in version 3.12.  Previously, generic classes had to explicitly\ninherit from *note Generic: 1453. or contain a type variable in one of\ntheir bases.\n",
            "subsections": []
        },
        "User-defined generics for parameter expressions are also supported via": {
            "content": "parameter specification variables in the form '[P]'.  The behavior is\nconsistent with type variables' described above as parameter\nspecification variables are treated by the typing module as a\nspecialized type variable.  The one exception to this is that a list of\ntypes can be used to substitute a *note ParamSpec: 163.:\n\n>>> class Z[T, P]: ...  # T is a TypeVar; P is a ParamSpec\n...\n>>> Z[int, [dict, float]]\nmain.Z[int, [dict, float]]\n\nClasses generic over a *note ParamSpec: 163. can also be created using\nexplicit inheritance from *note Generic: 1453.  In this case, '' is\nnot used:\n\nfrom typing import ParamSpec, Generic\n\nP = ParamSpec('P')\n\nclass Z(Generic[P]):\n...\n\nAnother difference between *note TypeVar: 164. and *note ParamSpec: 163.\nis that a generic with only one parameter specification variable will\naccept parameter lists in the forms 'X[[Type1, Type2, ...]]' and also\n'X[Type1, Type2, ...]' for aesthetic reasons.  Internally, the latter is\nconverted to the former, so the following are equivalent:\n\n>>> class X[P]: ...\n...\n>>> X[int, str]\nmain.X[[int, str]]\n>>> X[[int, str]]\nmain.X[[int, str]]\n\nNote that generics with *note ParamSpec: 163. may not have correct\n'parameters' after substitution in some cases because they are\nintended primarily for static type checking.\n\nChanged in version 3.10: *note Generic: 1453. can now be parameterized\nover parameter expressions.  See *note ParamSpec: 163. and PEP 612(1)\nfor more details.\n\nA user-defined generic class can have ABCs as base classes without a\nmetaclass conflict.  Generic metaclasses are not supported.  The outcome\nof parameterizing generics is cached, and most types in the typing\nmodule are *note hashable: 3db. and comparable for equality.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0612/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The Any type,  Next: Nominal vs structural subtyping,  Prev: User-defined generic types,  Up: typing -- Support for type hints": {
            "content": "5.26.1.9 The 'Any' type\n.......................\n\nA special kind of type is *note Any: 479.  A static type checker will\ntreat every type as being compatible with *note Any: 479. and *note Any:\n479. as being compatible with every type.\n",
            "subsections": []
        },
        "This means that it is possible to perform any operation or method call": {
            "content": "on a value of type *note Any: 479. and assign it to any variable:\n\nfrom typing import Any\n\na: Any = None\na = []          # OK\na = 2           # OK\n\ns: str = ''\ns = a           # OK\n\ndef foo(item: Any) -> int:\n# Passes type checking; 'item' could be any type,\n# and that type might have a 'bar' method\nitem.bar()\n...\n",
            "subsections": []
        },
        "Notice that no type checking is performed when assigning a value of type": {
            "content": "*note Any: 479. to a more precise type.  For example, the static type\nchecker did not report an error when assigning 'a' to 's' even though\n's' was declared to be of type *note str: 157. and receives an *note\nint: 17e. value at runtime!\n",
            "subsections": []
        },
        "Furthermore, all functions without a return type or parameter types will": {
            "content": "implicitly default to using *note Any: 479.:\n\ndef legacyparser(text):\n...\nreturn data\n\n# A static type checker will treat the above\n# as having the same signature as:\ndef legacyparser(text: Any) -> Any:\n...\nreturn data\n\nThis behavior allows *note Any: 479. to be used as an 'escape hatch'\nwhen you need to mix dynamically and statically typed code.\n\nContrast the behavior of *note Any: 479. with the behavior of *note\nobject: 8bb.  Similar to *note Any: 479, every type is a subtype of\n*note object: 8bb.  However, unlike *note Any: 479, the reverse is not\ntrue: *note object: 8bb. is 'not' a subtype of every other type.\n\nThat means when the type of a value is *note object: 8bb, a type checker\nwill reject almost all operations on it, and assigning it to a variable\n(or using it as a return value) of a more specialized type is a type\nerror.  For example:\n\ndef hasha(item: object) -> int:\n# Fails type checking; an object does not have a 'magic' method.\nitem.magic()\n...\n\ndef hashb(item: Any) -> int:\n# Passes type checking\nitem.magic()\n...\n\n# Passes type checking, since ints and strs are subclasses of object\nhasha(42)\nhasha(\"foo\")\n\n# Passes type checking, since Any is compatible with all types\nhashb(42)\nhashb(\"foo\")\n\nUse *note object: 8bb. to indicate that a value could be any type in a\ntypesafe manner.  Use *note Any: 479. to indicate that a value is\ndynamically typed.\n\nFile: python3.12.info,  Node: Nominal vs structural subtyping,  Next: Module contents<3>,  Prev: The Any type,  Up: typing -- Support for type hints\n\n5.26.1.10 Nominal vs structural subtyping\n.........................................\n",
            "subsections": []
        },
        "Initially PEP 484(1) defined the Python static type system as using": {
            "content": "'nominal subtyping'.  This means that a class 'A' is allowed where a\nclass 'B' is expected if and only if 'A' is a subclass of 'B'.\n",
            "subsections": []
        },
        "This requirement previously also applied to abstract base classes, such": {
            "content": "as *note Iterable: 1f5b.  The problem with this approach is that a class\nhad to be explicitly marked to support them, which is unpythonic and\nunlike what one would normally do in idiomatic dynamically typed Python\ncode.  For example, this conforms to PEP 484(2):\n\nfrom collections.abc import Sized, Iterable, Iterator\n\nclass Bucket(Sized, Iterable[int]):\n...\ndef len(self) -> int: ...\ndef iter(self) -> Iterator[int]: ...\n\nPEP 544(3) allows to solve this problem by allowing users to write the\nabove code without explicit base classes in the class definition,\nallowing 'Bucket' to be implicitly considered a subtype of both 'Sized'\nand 'Iterable[int]' by static type checkers.  This is known as\n'structural subtyping' (or static duck-typing):\n\nfrom collections.abc import Iterator, Iterable\n\nclass Bucket:  # Note: no base classes\n...\ndef len(self) -> int: ...\ndef iter(self) -> Iterator[int]: ...\n\ndef collect(items: Iterable[int]) -> int: ...\nresult = collect(Bucket())  # Passes type check\n\nMoreover, by subclassing a special class *note Protocol: 47e, a user can\ndefine new custom protocols to fully enjoy structural subtyping (see\nexamples below).\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0484/\n\n(2) https://peps.python.org/pep-0484/\n\n(3) https://peps.python.org/pep-0544/\n\nFile: python3.12.info,  Node: Module contents<3>,  Next: Deprecation Timeline of Major Features,  Prev: Nominal vs structural subtyping,  Up: typing -- Support for type hints\n\n5.26.1.11 Module contents\n.........................\n",
            "subsections": []
        },
        "The 'typing' module defines the following classes, functions and": {
            "content": "decorators.\n\n* Menu:\n\n* Special typing primitives::\n* Protocols: Protocols<3>.\n* ABCs for working with IO::\n* Functions and decorators::\n* Introspection helpers::\n* Constant::\n* Deprecated aliases::\n\nFile: python3.12.info,  Node: Special typing primitives,  Next: Protocols<3>,  Up: Module contents<3>\n\n5.26.1.12 Special typing primitives\n...................................\n\n* Menu:\n\n* Special types::\n* Special forms::\n* Building generic types and type aliases::\n* Other special directives::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Special types,  Next: Special forms,  Up: Special typing primitives": {
            "content": "5.26.1.13 Special types\n.......................\n",
            "subsections": []
        },
        "These can be used as types in annotations.  They do not support": {
            "content": "subscription using '[]'.\n\n-- Data: typing.Any\n\nSpecial type indicating an unconstrained type.\n\n* Every type is compatible with *note Any: 479.\n\n* *note Any: 479. is compatible with every type.\n\nChanged in version 3.11: *note Any: 479. can now be used as a base\nclass.  This can be useful for avoiding type checker errors with\nclasses that can duck type anywhere or are highly dynamic.\n\n-- Data: typing.AnyStr\n\nA *note constrained type variable: 3bf3.\n\nDefinition:\n\nAnyStr = TypeVar('AnyStr', str, bytes)\n\n'AnyStr' is meant to be used for functions that may accept *note\nstr: 157. or *note bytes: 295. arguments but cannot allow the two\nto mix.\n\nFor example:\n\ndef concat(a: AnyStr, b: AnyStr) -> AnyStr:\nreturn a + b\n\nconcat(\"foo\", \"bar\")    # OK, output has type 'str'\nconcat(b\"foo\", b\"bar\")  # OK, output has type 'bytes'\nconcat(\"foo\", b\"bar\")   # Error, cannot mix str and bytes\n\nNote that, despite its name, 'AnyStr' has nothing to do with the\n*note Any: 479. type, nor does it mean \"any string\".  In\nparticular, 'AnyStr' and 'str | bytes' are different from each\nother and have different use cases:\n\n# Invalid use of AnyStr:\n# The type variable is used only once in the function signature,\n# so cannot be \"solved\" by the type checker\ndef greetbad(cond: bool) -> AnyStr:\nreturn \"hi there!\" if cond else b\"greetings!\"\n\n# The better way of annotating this function:\ndef greetproper(cond: bool) -> str | bytes:\nreturn \"hi there!\" if cond else b\"greetings!\"\n\n-- Data: typing.LiteralString\n\nSpecial type that includes only literal strings.\n\nAny string literal is compatible with 'LiteralString', as is\nanother 'LiteralString'.  However, an object typed as just 'str' is\nnot.  A string created by composing 'LiteralString'-typed objects\nis also acceptable as a 'LiteralString'.\n\nExample:\n\ndef runquery(sql: LiteralString) -> None:\n...\n\ndef caller(arbitrarystring: str, literalstring: LiteralString) -> None:\nrunquery(\"SELECT * FROM students\")  # OK\nrunquery(literalstring)  # OK\nrunquery(\"SELECT * FROM \" + literalstring)  # OK\nrunquery(arbitrarystring)  # type checker error\nrunquery(  # type checker error\nf\"SELECT * FROM students WHERE name = {arbitrarystring}\"\n)\n\n'LiteralString' is useful for sensitive APIs where arbitrary\nuser-generated strings could generate problems.  For example, the\ntwo cases above that generate type checker errors could be\nvulnerable to an SQL injection attack.\n\nSee PEP 675(1) for more details.\n\nNew in version 3.11.\n\n-- Data: typing.Never\n\nThe bottom type(2), a type that has no members.\n\nThis can be used to define a function that should never be called,\nor a function that never returns:\n\nfrom typing import Never\n\ndef nevercallme(arg: Never) -> None:\npass\n\ndef intorstr(arg: int | str) -> None:\nnevercallme(arg)  # type checker error\nmatch arg:\ncase int():\nprint(\"It's an int\")\ncase str():\nprint(\"It's a str\")\ncase :\nnevercallme(arg)  # OK, arg is of type Never\n\nNew in version 3.11: On older Python versions, *note NoReturn:\n3bf4. may be used to express the same concept.  'Never' was added\nto make the intended meaning more explicit.\n\n-- Data: typing.NoReturn\n\nSpecial type indicating that a function never returns.\n\nFor example:\n\nfrom typing import NoReturn\n\ndef stop() -> NoReturn:\nraise RuntimeError('no way')\n\n'NoReturn' can also be used as a bottom type(3), a type that has no\nvalues.  Starting in Python 3.11, the *note Never: 475. type should\nbe used for this concept instead.  Type checkers should treat the\ntwo equivalently.\n\nNew in version 3.6.2.\n\n-- Data: typing.Self\n\nSpecial type to represent the current enclosed class.\n\nFor example:\n\nfrom typing import Self, revealtype\n\nclass Foo:\ndef returnself(self) -> Self:\n...\nreturn self\n\nclass SubclassOfFoo(Foo): pass\n\nrevealtype(Foo().returnself())  # Revealed type is \"Foo\"\nrevealtype(SubclassOfFoo().returnself())  # Revealed type is \"SubclassOfFoo\"\n\nThis annotation is semantically equivalent to the following, albeit\nin a more succinct fashion:\n\nfrom typing import TypeVar\n\nSelf = TypeVar(\"Self\", bound=\"Foo\")\n\nclass Foo:\ndef returnself(self: Self) -> Self:\n...\nreturn self\n\nIn general, if something returns 'self', as in the above examples,\nyou should use 'Self' as the return annotation.  If\n'Foo.returnself' was annotated as returning '\"Foo\"', then the type\nchecker would infer the object returned from\n'SubclassOfFoo.returnself' as being of type 'Foo' rather than\n'SubclassOfFoo'.\n\nOther common use cases include:\n\n- *note classmethod: 246.s that are used as alternative\nconstructors and return instances of the 'cls' parameter.\n\n- Annotating an *note enter(): 389. method which returns\nself.\n\nYou should not use 'Self' as the return annotation if the method is\nnot guaranteed to return an instance of a subclass when the class\nis subclassed:\n\nclass Eggs:\n# Self would be an incorrect return annotation here,\n# as the object returned is always an instance of Eggs,\n# even in subclasses\ndef returnseggs(self) -> \"Eggs\":\nreturn Eggs()\n\nSee PEP 673(4) for more details.\n\nNew in version 3.11.\n\n-- Data: typing.TypeAlias\n\nSpecial annotation for explicitly declaring a *note type alias:\n15f.\n\nFor example:\n\nfrom typing import TypeAlias\n\nFactors: TypeAlias = list[int]\n\n'TypeAlias' is particularly useful on older Python versions for\nannotating aliases that make use of forward references, as it can\nbe hard for type checkers to distinguish these from normal variable\nassignments:\n\nfrom typing import Generic, TypeAlias, TypeVar\n\nT = TypeVar(\"T\")\n\n# \"Box\" does not exist yet,\n# so we have to use quotes for the forward reference on Python <3.12.\n# Using ``TypeAlias`` tells the type checker that this is a type alias declaration,\n# not a variable assignment to a string.\nBoxOfStrings: TypeAlias = \"Box[str]\"\n\nclass Box(Generic[T]):\n@classmethod\ndef makeboxofstrings(cls) -> BoxOfStrings: ...\n\nSee PEP 613(5) for more details.\n\nNew in version 3.10.\n\nDeprecated since version 3.12: *note TypeAlias: 1696. is deprecated\nin favor of the *note type: 13a. statement, which creates instances\nof *note TypeAliasType: 160. and which natively supports forward\nreferences.  Note that while *note TypeAlias: 1696. and *note\nTypeAliasType: 160. serve similar purposes and have similar names,\nthey are distinct and the latter is not the type of the former.\nRemoval of *note TypeAlias: 1696. is not currently planned, but\nusers are encouraged to migrate to *note type: 13a. statements.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0675/\n\n(2) https://en.wikipedia.org/wiki/Bottomtype\n\n(3) https://en.wikipedia.org/wiki/Bottomtype\n\n(4) https://peps.python.org/pep-0673/\n\n(5) https://peps.python.org/pep-0613/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Special forms,  Next: Building generic types and type aliases,  Prev: Special types,  Up: Special typing primitives": {
            "content": "5.26.1.14 Special forms\n.......................\n",
            "subsections": []
        },
        "These can be used as types in annotations.  They all support": {
            "content": "subscription using '[]', but each has a unique syntax.\n\n-- Data: typing.Union\n\nUnion type; 'Union[X, Y]' is equivalent to 'X | Y' and means either\nX or Y.\n\nTo define a union, use e.g.  'Union[int, str]' or the shorthand\n'int | str'.  Using that shorthand is recommended.  Details:\n\n* The arguments must be types and there must be at least one.\n\n* Unions of unions are flattened, e.g.:\n\nUnion[Union[int, str], float] == Union[int, str, float]\n\n* Unions of a single argument vanish, e.g.:\n\nUnion[int] == int  # The constructor actually returns int\n\n* Redundant arguments are skipped, e.g.:\n\nUnion[int, str, int] == Union[int, str] == int | str\n\n* When comparing unions, the argument order is ignored, e.g.:\n\nUnion[int, str] == Union[str, int]\n\n* You cannot subclass or instantiate a 'Union'.\n\n* You cannot write 'Union[X][Y]'.\n\nChanged in version 3.7: Don't remove explicit subclasses from\nunions at runtime.\n\nChanged in version 3.10: Unions can now be written as 'X | Y'.  See\n*note union type expressions: 5b5.\n\n-- Data: typing.Optional\n\n'Optional[X]' is equivalent to 'X | None' (or 'Union[X, None]').\n\nNote that this is not the same concept as an optional argument,\nwhich is one that has a default.  An optional argument with a\ndefault does not require the 'Optional' qualifier on its type\nannotation just because it is optional.  For example:\n\ndef foo(arg: int = 0) -> None:\n...\n\nOn the other hand, if an explicit value of 'None' is allowed, the\nuse of 'Optional' is appropriate, whether the argument is optional\nor not.  For example:\n\ndef foo(arg: Optional[int] = None) -> None:\n...\n\nChanged in version 3.10: Optional can now be written as 'X | None'.\nSee *note union type expressions: 5b5.\n\n-- Data: typing.Concatenate\n\nSpecial form for annotating higher-order functions.\n\n'Concatenate' can be used in conjunction with *note Callable: 3be3.\nand *note ParamSpec: 163. to annotate a higher-order callable which\nadds, removes, or transforms parameters of another callable.  Usage\nis in the form 'Concatenate[Arg1Type, Arg2Type, ...,\nParamSpecVariable]'.  'Concatenate' is currently only valid when\nused as the first argument to a *note Callable: 3be3.  The last\nparameter to 'Concatenate' must be a *note ParamSpec: 163. or\nellipsis ('...').\n\nFor example, to annotate a decorator 'withlock' which provides a\n*note threading.Lock: 2d58. to the decorated function,\n'Concatenate' can be used to indicate that 'withlock' expects a\ncallable which takes in a 'Lock' as the first argument, and returns\na callable with a different type signature.  In this case, the\n*note ParamSpec: 163. indicates that the returned callable's\nparameter types are dependent on the parameter types of the\ncallable being passed in:\n\nfrom collections.abc import Callable\nfrom threading import Lock\nfrom typing import Concatenate\n\n# Use this lock to ensure that only one thread is executing a function\n# at any time.\nmylock = Lock()\n\ndef withlock[P, R](f: Callable[Concatenate[Lock, P], R]) -> Callable[P, R]:\n'''A type-safe decorator which provides a lock.'''\ndef inner(*args: P.args, kwargs: P.kwargs) -> R:\n# Provide the lock as the first argument.\nreturn f(mylock, *args, kwargs)\nreturn inner\n\n@withlock\ndef sumthreadsafe(lock: Lock, numbers: list[float]) -> float:\n'''Add a list of numbers together in a thread-safe manner.'''\nwith lock:\nreturn sum(numbers)\n\n# We don't need to pass in the lock ourselves thanks to the decorator.\nsumthreadsafe([1.1, 2.2, 3.3])\n\nNew in version 3.10.\n\nSee also\n........\n\n* PEP 612(1) - Parameter Specification Variables (the PEP which\nintroduced 'ParamSpec' and 'Concatenate')\n\n* *note ParamSpec: 163.\n\n* *note Annotating callable objects: 3be3.\n\n-- Data: typing.Literal\n\nSpecial typing form to define \"literal types\".\n\n'Literal' can be used to indicate to type checkers that the\nannotated object has a value equivalent to one of the provided\nliterals.\n\nFor example:\n\ndef validatesimple(data: Any) -> Literal[True]:  # always returns True\n...\n\ntype Mode = Literal['r', 'rb', 'w', 'wb']\ndef openhelper(file: str, mode: Mode) -> str:\n...\n\nopenhelper('/some/path', 'r')      # Passes type check\nopenhelper('/other/path', 'typo')  # Error in type checker\n\n'Literal[...]' cannot be subclassed.  At runtime, an arbitrary\nvalue is allowed as type argument to 'Literal[...]', but type\ncheckers may impose restrictions.  See PEP 586(2) for more details\nabout literal types.\n\nNew in version 3.8.\n\nChanged in version 3.9.1: 'Literal' now de-duplicates parameters.\nEquality comparisons of 'Literal' objects are no longer order\ndependent.  'Literal' objects will now raise a *note TypeError:\n28e. exception during equality comparisons if one of their\nparameters are not *note hashable: 3db.\n\n-- Data: typing.ClassVar\n\nSpecial type construct to mark class variables.\n\nAs introduced in PEP 526(3), a variable annotation wrapped in\nClassVar indicates that a given attribute is intended to be used as\na class variable and should not be set on instances of that class.\nUsage:\n\nclass Starship:\nstats: ClassVar[dict[str, int]] = {} # class variable\ndamage: int = 10                     # instance variable\n\n*note ClassVar: 482. accepts only types and cannot be further\nsubscribed.\n\n*note ClassVar: 482. is not a class itself, and should not be used\nwith *note isinstance(): 14b. or *note issubclass(): 5b4.  *note\nClassVar: 482. does not change Python runtime behavior, but it can\nbe used by third-party type checkers.  For example, a type checker\nmight flag the following code as an error:\n\nenterprised = Starship(3000)\nenterprised.stats = {} # Error, setting class variable on instance\nStarship.stats = {}     # This is OK\n\nNew in version 3.5.3.\n\n-- Data: typing.Final\n\nSpecial typing construct to indicate final names to type checkers.\n\nFinal names cannot be reassigned in any scope.  Final names\ndeclared in class scopes cannot be overridden in subclasses.\n\nFor example:\n\nMAXSIZE: Final = 9000\nMAXSIZE += 1  # Error reported by type checker\n\nclass Connection:\nTIMEOUT: Final[int] = 10\n\nclass FastConnector(Connection):\nTIMEOUT = 1  # Error reported by type checker\n\nThere is no runtime checking of these properties.  See PEP 591(4)\nfor more details.\n\nNew in version 3.8.\n\n-- Data: typing.Required\n\nSpecial typing construct to mark a *note TypedDict: 153. key as\nrequired.\n\nThis is mainly useful for 'total=False' TypedDicts.  See *note\nTypedDict: 153. and PEP 655(5) for more details.\n\nNew in version 3.11.\n\n-- Data: typing.NotRequired\n\nSpecial typing construct to mark a *note TypedDict: 153. key as\npotentially missing.\n\nSee *note TypedDict: 153. and PEP 655(6) for more details.\n\nNew in version 3.11.\n\n-- Data: typing.Annotated\n\nSpecial typing form to add context-specific metadata to an\nannotation.\n\nAdd metadata 'x' to a given type 'T' by using the annotation\n'Annotated[T, x]'.  Metadata added using 'Annotated' can be used by\nstatic analysis tools or at runtime.  At runtime, the metadata is\nstored in a 'metadata' attribute.\n\nIf a library or tool encounters an annotation 'Annotated[T, x]' and\nhas no special logic for the metadata, it should ignore the\nmetadata and simply treat the annotation as 'T'.  As such,\n'Annotated' can be useful for code that wants to use annotations\nfor purposes outside Python's static typing system.\n\nUsing 'Annotated[T, x]' as an annotation still allows for static\ntypechecking of 'T', as type checkers will simply ignore the\nmetadata 'x'.  In this way, 'Annotated' differs from the *note\n@notypecheck: 483. decorator, which can also be used for adding\nannotations outside the scope of the typing system, but completely\ndisables typechecking for a function or class.\n\nThe responsibility of how to interpret the metadata lies with the\ntool or library encountering an 'Annotated' annotation.  A tool or\nlibrary encountering an 'Annotated' type can scan through the\nmetadata elements to determine if they are of interest (e.g., using\n*note isinstance(): 14b.).\n\n-- Describe: Annotated[<type>, <metadata>]\n\nHere is an example of how you might use 'Annotated' to add metadata\nto type annotations if you were doing range analysis:\n\n@dataclass\nclass ValueRange:\nlo: int\nhi: int\n\nT1 = Annotated[int, ValueRange(-10, 5)]\nT2 = Annotated[T1, ValueRange(-20, 3)]\n\nDetails of the syntax:\n\n* The first argument to 'Annotated' must be a valid type\n\n* Multiple metadata elements can be supplied ('Annotated'\nsupports variadic arguments):\n\n@dataclass\nclass ctype:\nkind: str\n\nAnnotated[int, ValueRange(3, 10), ctype(\"char\")]\n\nIt is up to the tool consuming the annotations to decide\nwhether the client is allowed to add multiple metadata\nelements to one annotation and how to merge those annotations.\n\n* 'Annotated' must be subscripted with at least two arguments (\n'Annotated[int]' is not valid)\n\n* The order of the metadata elements is preserved and matters\nfor equality checks:\n\nassert Annotated[int, ValueRange(3, 10), ctype(\"char\")] != Annotated[\nint, ctype(\"char\"), ValueRange(3, 10)\n]\n\n* Nested 'Annotated' types are flattened.  The order of the\nmetadata elements starts with the innermost annotation:\n\nassert Annotated[Annotated[int, ValueRange(3, 10)], ctype(\"char\")] == Annotated[\nint, ValueRange(3, 10), ctype(\"char\")\n]\n\n* Duplicated metadata elements are not removed:\n\nassert Annotated[int, ValueRange(3, 10)] != Annotated[\nint, ValueRange(3, 10), ValueRange(3, 10)\n]\n\n* 'Annotated' can be used with nested and generic aliases:\n\n@dataclass\nclass MaxLen:\nvalue: int\n\ntype Vec[T] = Annotated[list[tuple[T, T]], MaxLen(10)]\n\n# When used in a type annotation, a type checker will treat \"V\" the same as\n# ``Annotated[list[tuple[int, int]], MaxLen(10)]``:\ntype V = Vec[int]\n\n* 'Annotated' cannot be used with an unpacked *note\nTypeVarTuple: 162.:\n\ntype Variadic[*Ts] = Annotated[*Ts, Ann1]  # NOT valid\n\nThis would be equivalent to:\n\nAnnotated[T1, T2, T3, ..., Ann1]\n\nwhere 'T1', 'T2', etc.  are *note TypeVars: 164.  This would\nbe invalid: only one type should be passed to Annotated.\n\n* By default, *note gettypehints(): 47f. strips the metadata\nfrom annotations.  Pass 'includeextras=True' to have the\nmetadata preserved:\n\n>>> from typing import Annotated, gettypehints\n>>> def func(x: Annotated[int, \"metadata\"]) -> None: pass\n...\n>>> gettypehints(func)\n{'x': <class 'int'>, 'return': <class 'NoneType'>}\n>>> gettypehints(func, includeextras=True)\n{'x': typing.Annotated[int, 'metadata'], 'return': <class 'NoneType'>}\n\n* At runtime, the metadata associated with an 'Annotated' type\ncan be retrieved via the 'metadata' attribute:\n\n>>> from typing import Annotated\n>>> X = Annotated[int, \"very\", \"important\", \"metadata\"]\n>>> X\ntyping.Annotated[int, 'very', 'important', 'metadata']\n>>> X.metadata\n('very', 'important', 'metadata')\n\nSee also\n........\n\nPEP 593(7) - Flexible function and variable annotations\n\nThe PEP introducing 'Annotated' to the standard library.\n\nNew in version 3.9.\n\n-- Data: typing.TypeGuard\n\nSpecial typing construct for marking user-defined type guard\nfunctions.\n\n'TypeGuard' can be used to annotate the return type of a\nuser-defined type guard function.  'TypeGuard' only accepts a\nsingle type argument.  At runtime, functions marked this way should\nreturn a boolean.\n\n'TypeGuard' aims to benefit 'type narrowing' - a technique used by\nstatic type checkers to determine a more precise type of an\nexpression within a program's code flow.  Usually type narrowing is\ndone by analyzing conditional code flow and applying the narrowing\nto a block of code.  The conditional expression here is sometimes\nreferred to as a \"type guard\":\n\ndef isstr(val: str | float):\n# \"isinstance\" type guard\nif isinstance(val, str):\n# Type of ``val`` is narrowed to ``str``\n...\nelse:\n# Else, type of ``val`` is narrowed to ``float``.\n...\n\nSometimes it would be convenient to use a user-defined boolean\nfunction as a type guard.  Such a function should use\n'TypeGuard[...]' as its return type to alert static type checkers\nto this intention.\n\nUsing '-> TypeGuard' tells the static type checker that for a given\nfunction:\n\n1. The return value is a boolean.\n\n2. If the return value is 'True', the type of its argument is the\ntype inside 'TypeGuard'.\n\nFor example:\n\ndef isstrlist(val: list[object]) -> TypeGuard[list[str]]:\n'''Determines whether all objects in the list are strings'''\nreturn all(isinstance(x, str) for x in val)\n\ndef func1(val: list[object]):\nif isstrlist(val):\n# Type of ``val`` is narrowed to ``list[str]``.\nprint(\" \".join(val))\nelse:\n# Type of ``val`` remains as ``list[object]``.\nprint(\"Not a list of strings!\")\n\nIf 'isstrlist' is a class or instance method, then the type in\n'TypeGuard' maps to the type of the second parameter after 'cls' or\n'self'.\n\nIn short, the form 'def foo(arg: TypeA) -> TypeGuard[TypeB]: ...',\nmeans that if 'foo(arg)' returns 'True', then 'arg' narrows from\n'TypeA' to 'TypeB'.\n\nNote: 'TypeB' need not be a narrower form of 'TypeA' - it can\neven be a wider form.  The main reason is to allow for things\nlike narrowing 'list[object]' to 'list[str]' even though the\nlatter is not a subtype of the former, since 'list' is\ninvariant.  The responsibility of writing type-safe type\nguards is left to the user.\n\n'TypeGuard' also works with type variables.  See PEP 647(8) for\nmore details.\n\nNew in version 3.10.\n\n-- Data: typing.Unpack\n\nTyping operator to conceptually mark an object as having been\nunpacked.\n\nFor example, using the unpack operator '*' on a *note type variable\ntuple: 3bf7. is equivalent to using 'Unpack' to mark the type\nvariable tuple as having been unpacked:\n\nTs = TypeVarTuple('Ts')\ntup: tuple[*Ts]\n# Effectively does:\ntup: tuple[Unpack[Ts]]\n\nIn fact, 'Unpack' can be used interchangeably with '*' in the\ncontext of *note typing.TypeVarTuple: 162. and *note\nbuiltins.tuple: 4b8. types.  You might see 'Unpack' being used\nexplicitly in older versions of Python, where '*' couldn't be used\nin certain places:\n\n# In older versions of Python, TypeVarTuple and Unpack\n# are located in the `typingextensions` backports package.\nfrom typingextensions import TypeVarTuple, Unpack\n\nTs = TypeVarTuple('Ts')\ntup: tuple[*Ts]         # Syntax error on Python <= 3.10!\ntup: tuple[Unpack[Ts]]  # Semantically equivalent, and backwards-compatible\n\n'Unpack' can also be used along with *note typing.TypedDict: 153.\nfor typing 'kwargs' in a function signature:\n\nfrom typing import TypedDict, Unpack\n\nclass Movie(TypedDict):\nname: str\nyear: int\n\n# This function expects two keyword arguments - `name` of type `str`\n# and `year` of type `int`.\ndef foo(kwargs: Unpack[Movie]): ...\n\nSee PEP 692(9) for more details on using 'Unpack' for 'kwargs'\ntyping.\n\nNew in version 3.11.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0612/\n\n(2) https://peps.python.org/pep-0586/\n\n(3) https://peps.python.org/pep-0526/\n\n(4) https://peps.python.org/pep-0591/\n\n(5) https://peps.python.org/pep-0655/\n\n(6) https://peps.python.org/pep-0655/\n\n(7) https://peps.python.org/pep-0593/\n\n(8) https://peps.python.org/pep-0647/\n\n(9) https://peps.python.org/pep-0692/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Building generic types and type aliases,  Next: Other special directives,  Prev: Special forms,  Up: Special typing primitives": {
            "content": "5.26.1.15 Building generic types and type aliases\n.................................................\n",
            "subsections": []
        },
        "The following classes should not be used directly as annotations.  Their": {
            "content": "intended purpose is to be building blocks for creating generic types and\ntype aliases.\n\nThese objects can be created through special syntax (*note type\nparameter lists: 166. and the *note type: 13a. statement).  For\ncompatibility with Python 3.11 and earlier, they can also be created\nwithout the dedicated syntax, as documented below.\n\n-- Class: typing.Generic\n\nAbstract base class for generic types.\n\nA generic type is typically declared by adding a list of type\nparameters after the class name:\n\nclass Mapping[KT, VT]:\ndef getitem(self, key: KT) -> VT:\n...\n# Etc.\n\nSuch a class implicitly inherits from 'Generic'.  The runtime\nsemantics of this syntax are discussed in the *note Language\nReference: 15d.\n\nThis class can then be used as follows:\n\ndef lookupname[X, Y](mapping: Mapping[X, Y], key: X, default: Y) -> Y:\ntry:\nreturn mapping[key]\nexcept KeyError:\nreturn default\n\nHere the brackets after the function name indicate a *note generic\nfunction: 15e.\n\nFor backwards compatibility, generic classes can also be declared\nby explicitly inheriting from 'Generic'.  In this case, the type\nparameters must be declared separately:\n\nKT = TypeVar('KT')\nVT = TypeVar('VT')\n\nclass Mapping(Generic[KT, VT]):\ndef getitem(self, key: KT) -> VT:\n...\n# Etc.\n\n-- Class: typing.TypeVar (name, *constraints, bound=None,\ncovariant=False, contravariant=False, infervariance=False)\n\nType variable.\n\nThe preferred way to construct a type variable is via the dedicated\nsyntax for *note generic functions: 15e, *note generic classes:\n15d, and *note generic type aliases: 161.:\n\nclass Sequence[T]:  # T is a TypeVar\n...\n\nThis syntax can also be used to create bound and constrained type\nvariables:\n\nclass StrSequence[S: str]:  # S is a TypeVar bound to str\n...\n\n\nclass StrOrBytesSequence[A: (str, bytes)]:  # A is a TypeVar constrained to str or bytes\n...\n\nHowever, if desired, reusable type variables can also be\nconstructed manually, like so:\n\nT = TypeVar('T')  # Can be anything\nS = TypeVar('S', bound=str)  # Can be any subtype of str\nA = TypeVar('A', str, bytes)  # Must be exactly str or bytes\n\nType variables exist primarily for the benefit of static type\ncheckers.  They serve as the parameters for generic types as well\nas for generic function and type alias definitions.  See *note\nGeneric: 1453. for more information on generic types.  Generic\nfunctions work as follows:\n\ndef repeat[T](x: T, n: int) -> Sequence[T]:\n\"\"\"Return a list containing n references to x.\"\"\"\nreturn [x]*n\n\n\ndef printcapitalized[S: str](x: S) -> S:\n\"\"\"Print x capitalized, and return x.\"\"\"\nprint(x.capitalize())\nreturn x\n\n\ndef concatenate[A: (str, bytes)](x: A, y: A) -> A:\n\"\"\"Add two strings or bytes objects together.\"\"\"\nreturn x + y\n\nNote that type variables can be 'bound', 'constrained', or neither,\nbut cannot be both bound 'and' constrained.\n\nThe variance of type variables is inferred by type checkers when\nthey are created through the *note type parameter syntax: 166. or\nwhen 'infervariance=True' is passed.  Manually created type\nvariables may be explicitly marked covariant or contravariant by\npassing 'covariant=True' or 'contravariant=True'.  By default,\nmanually created type variables are invariant.  See PEP 484(1) and\nPEP 695(2) for more details.\n\nBound type variables and constrained type variables have different\nsemantics in several important ways.  Using a 'bound' type variable\nmeans that the 'TypeVar' will be solved using the most specific\ntype possible:\n\nx = printcapitalized('a string')\nrevealtype(x)  # revealed type is str\n\nclass StringSubclass(str):\npass\n\ny = printcapitalized(StringSubclass('another string'))\nrevealtype(y)  # revealed type is StringSubclass\n\nz = printcapitalized(45)  # error: int is not a subtype of str\n\nType variables can be bound to concrete types, abstract types (ABCs\nor protocols), and even unions of types:\n\n# Can be anything with an abs method\ndef printabs[T: SupportsAbs](arg: T) -> None:\nprint(\"Absolute value:\", abs(arg))\n\nU = TypeVar('U', bound=str|bytes)  # Can be any subtype of the union str|bytes\nV = TypeVar('V', bound=SupportsAbs)  # Can be anything with an abs method\nUsing a 'constrained' type variable, however, means that the\n'TypeVar' can only ever be solved as being exactly one of the\nconstraints given:\n\na = concatenate('one', 'two')\nrevealtype(a)  # revealed type is str\n\nb = concatenate(StringSubclass('one'), StringSubclass('two'))\nrevealtype(b)  # revealed type is str, despite StringSubclass being passed in\n\nc = concatenate('one', b'two')  # error: type variable 'A' can be either str or bytes in a function call, but not both\n\nAt runtime, 'isinstance(x, T)' will raise *note TypeError: 28e.\n\n-- Attribute: name\n\nThe name of the type variable.\n\n-- Attribute: covariant\n\nWhether the type var has been explicitly marked as covariant.\n\n-- Attribute: contravariant\n\nWhether the type var has been explicitly marked as\ncontravariant.\n\n-- Attribute: infervariance\n\nWhether the type variable's variance should be inferred by\ntype checkers.\n\nNew in version 3.12.\n\n-- Attribute: bound\n\nThe bound of the type variable, if any.\n\nChanged in version 3.12: For type variables created through\n*note type parameter syntax: 166, the bound is evaluated only\nwhen the attribute is accessed, not when the type variable is\ncreated (see *note Lazy evaluation: 165.).\n\n-- Attribute: constraints\n\nA tuple containing the constraints of the type variable, if\nany.\n\nChanged in version 3.12: For type variables created through\n*note type parameter syntax: 166, the constraints are\nevaluated only when the attribute is accessed, not when the\ntype variable is created (see *note Lazy evaluation: 165.).\n\nChanged in version 3.12: Type variables can now be declared using\nthe *note type parameter: 166. syntax introduced by PEP 695(3).\nThe 'infervariance' parameter was added.\n\n-- Class: typing.TypeVarTuple (name)\n\nType variable tuple.  A specialized form of *note type variable:\n3bec. that enables 'variadic' generics.\n\nType variable tuples can be declared in *note type parameter lists:\n166. using a single asterisk ('*') before the name:\n\ndef movefirstelementtolast[T, *Ts](tup: tuple[T, *Ts]) -> tuple[*Ts, T]:\nreturn (*tup[1:], tup[0])\n\nOr by explicitly invoking the 'TypeVarTuple' constructor:\n\nT = TypeVar(\"T\")\nTs = TypeVarTuple(\"Ts\")\n\ndef movefirstelementtolast(tup: tuple[T, *Ts]) -> tuple[*Ts, T]:\nreturn (*tup[1:], tup[0])\n\nA normal type variable enables parameterization with a single type.\nA type variable tuple, in contrast, allows parameterization with an\n'arbitrary' number of types by acting like an 'arbitrary' number of\ntype variables wrapped in a tuple.  For example:\n\n# T is bound to int, Ts is bound to ()\n# Return value is (1,), which has type tuple[int]\nmovefirstelementtolast(tup=(1,))\n\n# T is bound to int, Ts is bound to (str,)\n# Return value is ('spam', 1), which has type tuple[str, int]\nmovefirstelementtolast(tup=(1, 'spam'))\n\n# T is bound to int, Ts is bound to (str, float)\n# Return value is ('spam', 3.0, 1), which has type tuple[str, float, int]\nmovefirstelementtolast(tup=(1, 'spam', 3.0))\n\n# This fails to type check (and fails at runtime)\n# because tuple[()] is not compatible with tuple[T, *Ts]\n# (at least one element is required)\nmovefirstelementtolast(tup=())\n\nNote the use of the unpacking operator '*' in 'tuple[T, *Ts]'.\nConceptually, you can think of 'Ts' as a tuple of type variables\n'(T1, T2, ...)'.  'tuple[T, *Ts]' would then become 'tuple[T, *(T1,\nT2, ...)]', which is equivalent to 'tuple[T, T1, T2, ...]'.  (Note\nthat in older versions of Python, you might see this written using\n*note Unpack: 1468. instead, as 'Unpack[Ts]'.)\n\nType variable tuples must 'always' be unpacked.  This helps\ndistinguish type variable tuples from normal type variables:\n\nx: Ts          # Not valid\nx: tuple[Ts]   # Not valid\nx: tuple[*Ts]  # The correct way to do it\n\nType variable tuples can be used in the same contexts as normal\ntype variables.  For example, in class definitions, arguments, and\nreturn types:\n\nclass Array[*Shape]:\ndef getitem(self, key: tuple[*Shape]) -> float: ...\ndef abs(self) -> \"Array[*Shape]\": ...\ndef getshape(self) -> tuple[*Shape]: ...\n\nType variable tuples can be happily combined with normal type\nvariables:\n\nclass Array[DType, *Shape]:  # This is fine\npass\n\nclass Array2[*Shape, DType]:  # This would also be fine\npass\n\nclass Height: ...\nclass Width: ...\n\nfloatarray1d: Array[float, Height] = Array()     # Totally fine\nintarray2d: Array[int, Height, Width] = Array()  # Yup, fine too\n\nHowever, note that at most one type variable tuple may appear in a\nsingle list of type arguments or type parameters:\n\nx: tuple[*Ts, *Ts]            # Not valid\nclass Array[*Shape, *Shape]:  # Not valid\npass\n\nFinally, an unpacked type variable tuple can be used as the type\nannotation of '*args':\n\ndef callsoon[*Ts](\ncallback: Callable[[*Ts], None],\n*args: *Ts\n) -> None:\n...\ncallback(*args)\n\nIn contrast to non-unpacked annotations of '*args' - e.g.  '*args:\nint', which would specify that 'all' arguments are 'int' - '*args:\n*Ts' enables reference to the types of the 'individual' arguments\nin '*args'.  Here, this allows us to ensure the types of the\n'*args' passed to 'callsoon' match the types of the (positional)\narguments of 'callback'.\n\nSee PEP 646(4) for more details on type variable tuples.\n\n-- Attribute: name\n\nThe name of the type variable tuple.\n\nNew in version 3.11.\n\nChanged in version 3.12: Type variable tuples can now be declared\nusing the *note type parameter: 166. syntax introduced by PEP\n695(5).\n\n-- Class: typing.ParamSpec (name, *, bound=None, covariant=False,\ncontravariant=False)\n\nParameter specification variable.  A specialized version of *note\ntype variables: 3bec.\n\nIn *note type parameter lists: 166, parameter specifications can be\ndeclared with two asterisks (''):\n\ntype IntFunc[P] = Callable[P, int]\n\nFor compatibility with Python 3.11 and earlier, 'ParamSpec' objects\ncan also be created as follows:\n\nP = ParamSpec('P')\n\nParameter specification variables exist primarily for the benefit\nof static type checkers.  They are used to forward the parameter\ntypes of one callable to another callable - a pattern commonly\nfound in higher order functions and decorators.  They are only\nvalid when used in 'Concatenate', or as the first argument to\n'Callable', or as parameters for user-defined Generics.  See *note\nGeneric: 1453. for more information on generic types.\n\nFor example, to add basic logging to a function, one can create a\ndecorator 'addlogging' to log function calls.  The parameter\nspecification variable tells the type checker that the callable\npassed into the decorator and the new callable returned by it have\ninter-dependent type parameters:\n\nfrom collections.abc import Callable\nimport logging\n\ndef addlogging[T, P](f: Callable[P, T]) -> Callable[P, T]:\n'''A type-safe decorator to add logging to a function.'''\ndef inner(*args: P.args, kwargs: P.kwargs) -> T:\nlogging.info(f'{f.name} was called')\nreturn f(*args, kwargs)\nreturn inner\n\n@addlogging\ndef addtwo(x: float, y: float) -> float:\n'''Add two numbers together.'''\nreturn x + y\n\nWithout 'ParamSpec', the simplest way to annotate this previously\nwas to use a *note TypeVar: 164. with bound 'Callable[..., Any]'.\nHowever this causes two problems:\n\n1. The type checker can't type check the 'inner' function because\n'*args' and 'kwargs' have to be typed *note Any: 479.\n\n2. *note cast(): 3c00. may be required in the body of the\n'addlogging' decorator when returning the 'inner' function,\nor the static type checker must be told to ignore the 'return\ninner'.\n\n-- Attribute: args\n\n-- Attribute: kwargs\n\nSince 'ParamSpec' captures both positional and keyword\nparameters, 'P.args' and 'P.kwargs' can be used to split a\n'ParamSpec' into its components.  'P.args' represents the\ntuple of positional parameters in a given call and should only\nbe used to annotate '*args'.  'P.kwargs' represents the\nmapping of keyword parameters to their values in a given call,\nand should be only be used to annotate 'kwargs'.  Both\nattributes require the annotated parameter to be in scope.  At\nruntime, 'P.args' and 'P.kwargs' are instances respectively of\n*note ParamSpecArgs: 5b9. and *note ParamSpecKwargs: 5ba.\n\n-- Attribute: name\n\nThe name of the parameter specification.\n\nParameter specification variables created with 'covariant=True' or\n'contravariant=True' can be used to declare covariant or\ncontravariant generic types.  The 'bound' argument is also\naccepted, similar to *note TypeVar: 164.  However the actual\nsemantics of these keywords are yet to be decided.\n\nNew in version 3.10.\n\nChanged in version 3.12: Parameter specifications can now be\ndeclared using the *note type parameter: 166. syntax introduced by\nPEP 695(6).\n\nNote: Only parameter specification variables defined in global\nscope can be pickled.\n\nSee also\n........\n\n* PEP 612(7) - Parameter Specification Variables (the PEP which\nintroduced 'ParamSpec' and 'Concatenate')\n\n* *note Concatenate: 5b7.\n\n* *note Annotating callable objects: 3be3.\n\n-- Data: typing.ParamSpecArgs\n\n-- Data: typing.ParamSpecKwargs\n\nArguments and keyword arguments attributes of a *note ParamSpec:\n163.  The 'P.args' attribute of a 'ParamSpec' is an instance of\n'ParamSpecArgs', and 'P.kwargs' is an instance of\n'ParamSpecKwargs'.  They are intended for runtime introspection and\nhave no special meaning to static type checkers.\n\nCalling *note getorigin(): 873. on either of these objects will\nreturn the original 'ParamSpec':\n\n>>> from typing import ParamSpec, getorigin\n>>> P = ParamSpec(\"P\")\n>>> getorigin(P.args) is P\nTrue\n>>> getorigin(P.kwargs) is P\nTrue\n\nNew in version 3.10.\n\n-- Class: typing.TypeAliasType (name, value, *, typeparams=())\n\nThe type of type aliases created through the *note type: 13a.\nstatement.\n\nExample:\n\n>>> type Alias = int\n>>> type(Alias)\n<class 'typing.TypeAliasType'>\n\nNew in version 3.12.\n\n-- Attribute: name\n\nThe name of the type alias:\n\n>>> type Alias = int\n>>> Alias.name\n'Alias'\n\n-- Attribute: module\n\nThe module in which the type alias was defined:\n\n>>> type Alias = int\n>>> Alias.module\n'main'\n\n-- Attribute: typeparams\n\nThe type parameters of the type alias, or an empty tuple if\nthe alias is not generic:\n\n>>> type ListOrSet[T] = list[T] | set[T]\n>>> ListOrSet.typeparams\n(T,)\n>>> type NotGeneric = int\n>>> NotGeneric.typeparams\n()\n\n-- Attribute: value\n\nThe type alias's value.  This is *note lazily evaluated: 165,\nso names used in the definition of the alias are not resolved\nuntil the 'value' attribute is accessed:\n\n>>> type Mutually = Recursive\n>>> type Recursive = Mutually\n>>> Mutually\nMutually\n>>> Recursive\nRecursive\n>>> Mutually.value\nRecursive\n>>> Recursive.value\nMutually\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0484/\n\n(2) https://peps.python.org/pep-0695/\n\n(3) https://peps.python.org/pep-0695/\n\n(4) https://peps.python.org/pep-0646/\n\n(5) https://peps.python.org/pep-0695/\n\n(6) https://peps.python.org/pep-0695/\n\n(7) https://peps.python.org/pep-0612/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Other special directives,  Prev: Building generic types and type aliases,  Up: Special typing primitives": {
            "content": "5.26.1.16 Other special directives\n..................................\n\nThese functions and classes should not be used directly as annotations.",
            "subsections": []
        },
        "Their intended purpose is to be building blocks for creating and": {
            "content": "declaring types.\n\n-- Class: typing.NamedTuple\n\nTyped version of *note collections.namedtuple(): 711.\n\nUsage:\n\nclass Employee(NamedTuple):\nname: str\nid: int\n\nThis is equivalent to:\n\nEmployee = collections.namedtuple('Employee', ['name', 'id'])\n\nTo give a field a default value, you can assign to it in the class\nbody:\n\nclass Employee(NamedTuple):\nname: str\nid: int = 3\n\nemployee = Employee('Guido')\nassert employee.id == 3\n\nFields with a default value must come after any fields without a\ndefault.\n\nThe resulting class has an extra attribute 'annotations' giving\na dict that maps the field names to the field types.  (The field\nnames are in the 'fields' attribute and the default values are in\nthe 'fielddefaults' attribute, both of which are part of the\n*note namedtuple(): 711. API.)\n\n'NamedTuple' subclasses can also have docstrings and methods:\n\nclass Employee(NamedTuple):\n\"\"\"Represents an employee.\"\"\"\nname: str\nid: int = 3\n\ndef repr(self) -> str:\nreturn f'<Employee {self.name}, id={self.id}>'\n\n'NamedTuple' subclasses can be generic:\n\nclass Group[T](NamedTuple):\nkey: T\ngroup: list[T]\n\nBackward-compatible usage:\n\n# For creating a generic NamedTuple on Python 3.11 or lower\nclass Group(NamedTuple, Generic[T]):\nkey: T\ngroup: list[T]\n\n# A functional syntax is also supported\nEmployee = NamedTuple('Employee', [('name', str), ('id', int)])\n\nChanged in version 3.6: Added support for PEP 526(1) variable\nannotation syntax.\n\nChanged in version 3.6.1: Added support for default values,\nmethods, and docstrings.\n\nChanged in version 3.8: The 'fieldtypes' and 'annotations'\nattributes are now regular dictionaries instead of instances of\n'OrderedDict'.\n\nChanged in version 3.9: Removed the 'fieldtypes' attribute in\nfavor of the more standard 'annotations' attribute which has\nthe same information.\n\nChanged in version 3.11: Added support for generic namedtuples.\n\n-- Class: typing.NewType (name, tp)\n\nHelper class to create low-overhead *note distinct types: 3be0.\n\nA 'NewType' is considered a distinct type by a typechecker.  At\nruntime, however, calling a 'NewType' returns its argument\nunchanged.\n\nUsage:\n\nUserId = NewType('UserId', int)  # Declare the NewType \"UserId\"\nfirstuser = UserId(1)  # \"UserId\" returns the argument unchanged at runtime\n\n-- Attribute: module\n\nThe module in which the new type is defined.\n\n-- Attribute: name\n\nThe name of the new type.\n\n-- Attribute: supertype\n\nThe type that the new type is based on.\n\nNew in version 3.5.2.\n\nChanged in version 3.10: 'NewType' is now a class rather than a\nfunction.\n\n-- Class: typing.Protocol (Generic)\n\nBase class for protocol classes.\n\nProtocol classes are defined like this:\n\nclass Proto(Protocol):\ndef meth(self) -> int:\n...\n\nSuch classes are primarily used with static type checkers that\nrecognize structural subtyping (static duck-typing), for example:\n\nclass C:\ndef meth(self) -> int:\nreturn 0\n\ndef func(x: Proto) -> int:\nreturn x.meth()\n\nfunc(C())  # Passes static type check\n\nSee PEP 544(2) for more details.  Protocol classes decorated with\n*note runtimecheckable(): 14c. (described later) act as\nsimple-minded runtime protocols that check only the presence of\ngiven attributes, ignoring their type signatures.\n\nProtocol classes can be generic, for example:\n\nclass GenProto[T](Protocol):\ndef meth(self) -> T:\n...\n\nIn code that needs to be compatible with Python 3.11 or older,\ngeneric Protocols can be written as follows:\n\nT = TypeVar(\"T\")\n\nclass GenProto(Protocol[T]):\ndef meth(self) -> T:\n...\n\nNew in version 3.8.\n\n-- Function: @typing.runtimecheckable\n\nMark a protocol class as a runtime protocol.\n\nSuch a protocol can be used with *note isinstance(): 14b. and *note\nissubclass(): 5b4.  This raises *note TypeError: 28e. when applied\nto a non-protocol class.  This allows a simple-minded structural\ncheck, very similar to \"one trick ponies\" in *note collections.abc:\n1c. such as *note Iterable: 1f5b.  For example:\n\n@runtimecheckable\nclass Closable(Protocol):\ndef close(self): ...\n\nassert isinstance(open('/some/file'), Closable)\n\n@runtimecheckable\nclass Named(Protocol):\nname: str\n\nimport threading\nassert isinstance(threading.Thread(name='Bob'), Named)\n\nNote: 'runtimecheckable()' will check only the presence of\nthe required methods or attributes, not their type signatures\nor types.  For example, *note ssl.SSLObject: 9c2. is a class,\ntherefore it passes an *note issubclass(): 5b4. check against\n*note Callable: 3be3.  However, the 'ssl.SSLObject.init'\nmethod exists only to raise a *note TypeError: 28e. with a\nmore informative message, therefore making it impossible to\ncall (instantiate) *note ssl.SSLObject: 9c2.\n\nNote: An *note isinstance(): 14b. check against a\nruntime-checkable protocol can be surprisingly slow compared\nto an 'isinstance()' check against a non-protocol class.\nConsider using alternative idioms such as *note hasattr():\n1f7. calls for structural checks in performance-sensitive\ncode.\n\nNew in version 3.8.\n\nChanged in version 3.12: The internal implementation of *note\nisinstance(): 14b. checks against runtime-checkable protocols now\nuses *note inspect.getattrstatic(): 1b2. to look up attributes\n(previously, *note hasattr(): 1f7. was used).  As a result, some\nobjects which used to be considered instances of a\nruntime-checkable protocol may no longer be considered instances of\nthat protocol on Python 3.12+, and vice versa.  Most users are\nunlikely to be affected by this change.\n\nChanged in version 3.12: The members of a runtime-checkable\nprotocol are now considered \"frozen\" at runtime as soon as the\nclass has been created.  Monkey-patching attributes onto a\nruntime-checkable protocol will still work, but will have no impact\non *note isinstance(): 14b. checks comparing objects to the\nprotocol.  See *note \"What's new in Python 3.12\": 1ed. for more\ndetails.\n\n-- Class: typing.TypedDict (dict)\n\nSpecial construct to add type hints to a dictionary.  At runtime it\nis a plain *note dict: 237.\n\n'TypedDict' declares a dictionary type that expects all of its\ninstances to have a certain set of keys, where each key is\nassociated with a value of a consistent type.  This expectation is\nnot checked at runtime but is only enforced by type checkers.\nUsage:\n\nclass Point2D(TypedDict):\nx: int\ny: int\nlabel: str\n\na: Point2D = {'x': 1, 'y': 2, 'label': 'good'}  # OK\nb: Point2D = {'z': 3, 'label': 'bad'}           # Fails type check\n\nassert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')\n\nTo allow using this feature with older versions of Python that do\nnot support PEP 526(3), 'TypedDict' supports two additional\nequivalent syntactic forms:\n\n* Using a literal *note dict: 237. as the second argument:\n\nPoint2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})\n\n* Using keyword arguments:\n\nPoint2D = TypedDict('Point2D', x=int, y=int, label=str)\n\nDeprecated since version 3.11, will be removed in version 3.13: The\nkeyword-argument syntax is deprecated in 3.11 and will be removed\nin 3.13.  It may also be unsupported by static type checkers.\n\nThe functional syntax should also be used when any of the keys are\nnot valid *note identifiers: 1bb5, for example because they are\nkeywords or contain hyphens.  Example:\n\n# raises SyntaxError\nclass Point2D(TypedDict):\nin: int  # 'in' is a keyword\nx-y: int  # name with hyphens\n\n# OK, functional syntax\nPoint2D = TypedDict('Point2D', {'in': int, 'x-y': int})\n\nBy default, all keys must be present in a 'TypedDict'.  It is\npossible to mark individual keys as non-required using *note\nNotRequired: 386.:\n\nclass Point2D(TypedDict):\nx: int\ny: int\nlabel: NotRequired[str]\n\n# Alternative syntax\nPoint2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': NotRequired[str]})\n\nThis means that a 'Point2D' 'TypedDict' can have the 'label' key\nomitted.\n\nIt is also possible to mark all keys as non-required by default by\nspecifying a totality of 'False':\n\nclass Point2D(TypedDict, total=False):\nx: int\ny: int\n\n# Alternative syntax\nPoint2D = TypedDict('Point2D', {'x': int, 'y': int}, total=False)\n\nThis means that a 'Point2D' 'TypedDict' can have any of the keys\nomitted.  A type checker is only expected to support a literal\n'False' or 'True' as the value of the 'total' argument.  'True' is\nthe default, and makes all items defined in the class body\nrequired.\n\nIndividual keys of a 'total=False' 'TypedDict' can be marked as\nrequired using *note Required: 385.:\n\nclass Point2D(TypedDict, total=False):\nx: Required[int]\ny: Required[int]\nlabel: str\n\n# Alternative syntax\nPoint2D = TypedDict('Point2D', {\n'x': Required[int],\n'y': Required[int],\n'label': str\n}, total=False)\n\nIt is possible for a 'TypedDict' type to inherit from one or more\nother 'TypedDict' types using the class-based syntax.  Usage:\n\nclass Point3D(Point2D):\nz: int\n\n'Point3D' has three items: 'x', 'y' and 'z'.  It is equivalent to\nthis definition:\n\nclass Point3D(TypedDict):\nx: int\ny: int\nz: int\n\nA 'TypedDict' cannot inherit from a non-'TypedDict' class, except\nfor *note Generic: 1453.  For example:\n\nclass X(TypedDict):\nx: int\n\nclass Y(TypedDict):\ny: int\n\nclass Z(object): pass  # A non-TypedDict class\n\nclass XY(X, Y): pass  # OK\n\nclass XZ(X, Z): pass  # raises TypeError\n\nA 'TypedDict' can be generic:\n\nclass Group[T](TypedDict):\nkey: T\ngroup: list[T]\n\nTo create a generic 'TypedDict' that is compatible with Python 3.11\nor lower, inherit from *note Generic: 1453. explicitly:\n\nT = TypeVar(\"T\")\n\nclass Group(TypedDict, Generic[T]):\nkey: T\ngroup: list[T]\n\nA 'TypedDict' can be introspected via annotations dicts (see *note\nAnnotations Best Practices: 5cd. for more information on\nannotations best practices), *note total: 3c0c, *note\nrequiredkeys: 3c0d, and *note optionalkeys: 3c0e.\n\n-- Attribute: total\n\n'Point2D.total' gives the value of the 'total' argument.\nExample:\n\n>>> from typing import TypedDict\n>>> class Point2D(TypedDict): pass\n>>> Point2D.total\nTrue\n>>> class Point2D(TypedDict, total=False): pass\n>>> Point2D.total\nFalse\n>>> class Point3D(Point2D): pass\n>>> Point3D.total\nTrue\n\nThis attribute reflects 'only' the value of the 'total'\nargument to the current 'TypedDict' class, not whether the\nclass is semantically total.  For example, a 'TypedDict' with\n'total' set to True may have keys marked with *note\nNotRequired: 386, or it may inherit from another 'TypedDict'\nwith 'total=False'.  Therefore, it is generally better to use\n*note requiredkeys: 3c0d. and *note optionalkeys:\n3c0e. for introspection.\n\n-- Attribute: requiredkeys\n\nNew in version 3.9.\n\n-- Attribute: optionalkeys\n\n'Point2D.requiredkeys' and 'Point2D.optionalkeys'\nreturn *note frozenset: 39e. objects containing required and\nnon-required keys, respectively.\n\nKeys marked with *note Required: 385. will always appear in\n'requiredkeys' and keys marked with *note NotRequired:\n386. will always appear in 'optionalkeys'.\n\nFor backwards compatibility with Python 3.10 and below, it is\nalso possible to use inheritance to declare both required and\nnon-required keys in the same 'TypedDict' .  This is done by\ndeclaring a 'TypedDict' with one value for the 'total'\nargument and then inheriting from it in another 'TypedDict'\nwith a different value for 'total':\n\n>>> class Point2D(TypedDict, total=False):\n...     x: int\n...     y: int\n...\n>>> class Point3D(Point2D):\n...     z: int\n...\n>>> Point3D.requiredkeys == frozenset({'z'})\nTrue\n>>> Point3D.optionalkeys == frozenset({'x', 'y'})\nTrue\n\nNew in version 3.9.\n\nNote: If 'from future import annotations' is used or\nif annotations are given as strings, annotations are not\nevaluated when the 'TypedDict' is defined.  Therefore,\nthe runtime introspection that 'requiredkeys' and\n'optionalkeys' rely on may not work properly, and\nthe values of the attributes may be incorrect.\n\nSee PEP 589(4) for more examples and detailed rules of using\n'TypedDict'.\n\nNew in version 3.8.\n\nChanged in version 3.11: Added support for marking individual keys\nas *note Required: 385. or *note NotRequired: 386.  See PEP 655(5).\n\nChanged in version 3.11: Added support for generic 'TypedDict's.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0526/\n\n(2) https://peps.python.org/pep-0544/\n\n(3) https://peps.python.org/pep-0526/\n\n(4) https://peps.python.org/pep-0589/\n\n(5) https://peps.python.org/pep-0655/\n\nFile: python3.12.info,  Node: Protocols<3>,  Next: ABCs for working with IO,  Prev: Special typing primitives,  Up: Module contents<3>\n\n5.26.1.17 Protocols\n...................\n",
            "subsections": []
        },
        "The following protocols are provided by the typing module.  All are": {
            "content": "decorated with *note @runtimecheckable: 14c.\n\n-- Class: typing.SupportsAbs\n\nAn ABC with one abstract method 'abs' that is covariant in its\nreturn type.\n\n-- Class: typing.SupportsBytes\n\nAn ABC with one abstract method 'bytes'.\n\n-- Class: typing.SupportsComplex\n\nAn ABC with one abstract method 'complex'.\n\n-- Class: typing.SupportsFloat\n\nAn ABC with one abstract method 'float'.\n\n-- Class: typing.SupportsIndex\n\nAn ABC with one abstract method 'index'.\n\nNew in version 3.8.\n\n-- Class: typing.SupportsInt\n\nAn ABC with one abstract method 'int'.\n\n-- Class: typing.SupportsRound\n\nAn ABC with one abstract method 'round' that is covariant in\nits return type.\n\nFile: python3.12.info,  Node: ABCs for working with IO,  Next: Functions and decorators,  Prev: Protocols<3>,  Up: Module contents<3>\n\n5.26.1.18 ABCs for working with IO\n..................................\n\n-- Class: typing.IO\n-- Class: typing.TextIO\n-- Class: typing.BinaryIO\n\nGeneric type 'IO[AnyStr]' and its subclasses 'TextIO(IO[str])' and\n'BinaryIO(IO[bytes])' represent the types of I/O streams such as\nreturned by *note open(): 26e.\n\nFile: python3.12.info,  Node: Functions and decorators,  Next: Introspection helpers,  Prev: ABCs for working with IO,  Up: Module contents<3>\n\n5.26.1.19 Functions and decorators\n..................................\n\n-- Function: typing.cast (typ, val)\n\nCast a value to a type.\n\nThis returns the value unchanged.  To the type checker this signals\nthat the return value has the designated type, but at runtime we\nintentionally don't check anything (we want this to be as fast as\npossible).\n\n-- Function: typing.asserttype (val, typ, /)\n\nAsk a static type checker to confirm that 'val' has an inferred\ntype of 'typ'.\n\nAt runtime this does nothing: it returns the first argument\nunchanged with no checks or side effects, no matter the actual type\nof the argument.\n\nWhen a static type checker encounters a call to 'asserttype()', it\nemits an error if the value is not of the specified type:\n\ndef greet(name: str) -> None:\nasserttype(name, str)  # OK, inferred type of `name` is `str`\nasserttype(name, int)  # type checker error\n\nThis function is useful for ensuring the type checker's\nunderstanding of a script is in line with the developer's\nintentions:\n\ndef complexfunction(arg: object):\n# Do some complex type-narrowing logic,\n# after which we hope the inferred type will be `int`\n...\n# Test whether the type checker correctly understands our function\nasserttype(arg, int)\n\nNew in version 3.11.\n\n-- Function: typing.assertnever (arg, /)\n\nAsk a static type checker to confirm that a line of code is\nunreachable.\n\nExample:\n\ndef intorstr(arg: int | str) -> None:\nmatch arg:\ncase int():\nprint(\"It's an int\")\ncase str():\nprint(\"It's a str\")\ncase  as unreachable:\nassertnever(unreachable)\n\nHere, the annotations allow the type checker to infer that the last\ncase can never execute, because 'arg' is either an *note int: 17e.\nor a *note str: 157, and both options are covered by earlier cases.\n\nIf a type checker finds that a call to 'assertnever()' is\nreachable, it will emit an error.  For example, if the type\nannotation for 'arg' was instead 'int | str | float', the type\nchecker would emit an error pointing out that 'unreachable' is of\ntype *note float: 4b7.  For a call to 'assertnever' to pass type\nchecking, the inferred type of the argument passed in must be the\nbottom type, *note Never: 475, and nothing else.\n\nAt runtime, this throws an exception when called.\n\nSee also\n........\n\nUnreachable Code and Exhaustiveness Checking(1) has more\ninformation about exhaustiveness checking with static typing.\n\nNew in version 3.11.\n\n-- Function: typing.revealtype (obj, /)\n\nAsk a static type checker to reveal the inferred type of an\nexpression.\n\nWhen a static type checker encounters a call to this function, it\nemits a diagnostic with the inferred type of the argument.  For\nexample:\n\nx: int = 1\nrevealtype(x)  # Revealed type is \"builtins.int\"\n\nThis can be useful when you want to debug how your type checker\nhandles a particular piece of code.\n\nAt runtime, this function prints the runtime type of its argument\nto *note sys.stderr: 757. and returns the argument unchanged\n(allowing the call to be used within an expression):\n\nx = revealtype(1)  # prints \"Runtime type is int\"\nprint(x)  # prints \"1\"\n\nNote that the runtime type may be different from (more or less\nspecific than) the type statically inferred by a type checker.\n\nMost type checkers support 'revealtype()' anywhere, even if the\nname is not imported from 'typing'.  Importing the name from\n'typing', however, allows your code to run without runtime errors\nand communicates intent more clearly.\n\nNew in version 3.11.\n\n-- Function: @typing.dataclasstransform (*, eqdefault=True,\norderdefault=False, kwonlydefault=False,\nfrozendefault=False, fieldspecifiers=(), kwargs)\n\nDecorator to mark an object as providing *note dataclass: 38d.-like\nbehavior.\n\n'dataclasstransform' may be used to decorate a class, metaclass,\nor a function that is itself a decorator.  The presence of\n'@dataclasstransform()' tells a static type checker that the\ndecorated object performs runtime \"magic\" that transforms a class\nin a similar way to *note @dataclasses.dataclass: 38d.\n\nExample usage with a decorator function:\n\n@dataclasstransform()\ndef createmodel[T](cls: type[T]) -> type[T]:\n...\nreturn cls\n\n@createmodel\nclass CustomerModel:\nid: int\nname: str\n\nOn a base class:\n\n@dataclasstransform()\nclass ModelBase: ...\n\nclass CustomerModel(ModelBase):\nid: int\nname: str\n\nOn a metaclass:\n\n@dataclasstransform()\nclass ModelMeta(type): ...\n\nclass ModelBase(metaclass=ModelMeta): ...\n\nclass CustomerModel(ModelBase):\nid: int\nname: str\n\nThe 'CustomerModel' classes defined above will be treated by type\ncheckers similarly to classes created with *note\n@dataclasses.dataclass: 38d.  For example, type checkers will\nassume these classes have 'init' methods that accept 'id' and\n'name'.\n\nThe decorated class, metaclass, or function may accept the\nfollowing bool arguments which type checkers will assume have the\nsame effect as they would have on the *note @dataclasses.dataclass:\n38d. decorator: 'init', 'eq', 'order', 'unsafehash', 'frozen',\n'matchargs', 'kwonly', and 'slots'.  It must be possible for the\nvalue of these arguments ('True' or 'False') to be statically\nevaluated.\n\nThe arguments to the 'dataclasstransform' decorator can be used to\ncustomize the default behaviors of the decorated class, metaclass,\nor function:\n\n\nParameters:\n\n* 'eqdefault' (*note bool: 17d.) - Indicates whether the 'eq'\nparameter is assumed to be 'True' or 'False' if it is omitted\nby the caller.  Defaults to 'True'.\n\n* 'orderdefault' (*note bool: 17d.) - Indicates whether the\n'order' parameter is assumed to be 'True' or 'False' if it is\nomitted by the caller.  Defaults to 'False'.\n\n* 'kwonlydefault' (*note bool: 17d.) - Indicates whether the\n'kwonly' parameter is assumed to be 'True' or 'False' if it\nis omitted by the caller.  Defaults to 'False'.\n\n* 'frozendefault' (*note bool: 17d.) - Indicates whether the\n'frozen' parameter is assumed to be 'True' or 'False' if it is\nomitted by the caller.  Defaults to 'False'.\n\nNew in version 3.12.\n\n* 'fieldspecifiers' (*note tuple: 4b8.'['*note Callable:\n5de.'[''...'', ''Any'']'', ''...'']') - Specifies a static\nlist of supported classes or functions that describe fields,\nsimilar to *note dataclasses.field(): 1798.  Defaults to '()'.\n\n* 'kwargs' ('Any') - Arbitrary other keyword arguments are\naccepted in order to allow for possible future extensions.\n\nType checkers recognize the following optional parameters on field\nspecifiers: 'Recognised parameters for field specifiers'\n\nParameter name           Description\n\n--------------------------------------------------------------------------------------------------------------\n\n'init'                   Indicates whether the field should be included in the synthesized 'init'\nmethod.  If unspecified, 'init' defaults to 'True'.\n\n\n'default'                Provides the default value for the field.\n\n\n'defaultfactory'        Provides a runtime callback that returns the default value for the field.  If\nneither 'default' nor 'defaultfactory' are specified, the field is assumed to\nhave no default value and must be provided a value when the class is instantiated.\n\n\n'factory'                An alias for the 'defaultfactory' parameter on field specifiers.\n\n\n'kwonly'                Indicates whether the field should be marked as keyword-only.  If 'True', the\nfield will be keyword-only.  If 'False', it will not be keyword-only.  If\nunspecified, the value of the 'kwonly' parameter on the object decorated with\n'dataclasstransform' will be used, or if that is unspecified, the value of\n'kwonlydefault' on 'dataclasstransform' will be used.\n\n\n'alias'                  Provides an alternative name for the field.  This alternative name is used in the\nsynthesized 'init' method.\n\n\nAt runtime, this decorator records its arguments in the\n'dataclasstransform' attribute on the decorated object.  It\nhas no other runtime effect.\n\nSee PEP 681(2) for more details.\n\nNew in version 3.11.\n\n-- Function: @typing.overload\n\nDecorator for creating overloaded functions and methods.\n\nThe '@overload' decorator allows describing functions and methods\nthat support multiple different combinations of argument types.  A\nseries of '@overload'-decorated definitions must be followed by\nexactly one non-'@overload'-decorated definition (for the same\nfunction/method).\n\n'@overload'-decorated definitions are for the benefit of the type\nchecker only, since they will be overwritten by the\nnon-'@overload'-decorated definition.  The\nnon-'@overload'-decorated definition, meanwhile, will be used at\nruntime but should be ignored by a type checker.  At runtime,\ncalling an '@overload'-decorated function directly will raise *note\nNotImplementedError: ba5.\n\nAn example of overload that gives a more precise type than can be\nexpressed using a union or a type variable:\n\n@overload\ndef process(response: None) -> None:\n...\n@overload\ndef process(response: int) -> tuple[int, str]:\n...\n@overload\ndef process(response: bytes) -> str:\n...\ndef process(response):\n...  # actual implementation goes here\n\nSee PEP 484(3) for more details and comparison with other typing\nsemantics.\n\nChanged in version 3.11: Overloaded functions can now be\nintrospected at runtime using *note getoverloads(): 47b.\n\n-- Function: typing.getoverloads (func)\n\nReturn a sequence of *note @overload: 3c17.-decorated definitions\nfor 'func'.\n\n'func' is the function object for the implementation of the\noverloaded function.  For example, given the definition of\n'process' in the documentation for *note @overload: 3c17,\n'getoverloads(process)' will return a sequence of three function\nobjects for the three defined overloads.  If called on a function\nwith no overloads, 'getoverloads()' returns an empty sequence.\n\n'getoverloads()' can be used for introspecting an overloaded\nfunction at runtime.\n\nNew in version 3.11.\n\n-- Function: typing.clearoverloads ()\n\nClear all registered overloads in the internal registry.\n\nThis can be used to reclaim the memory used by the registry.\n\nNew in version 3.11.\n\n-- Function: @typing.final\n\nDecorator to indicate final methods and final classes.\n\nDecorating a method with '@final' indicates to a type checker that\nthe method cannot be overridden in a subclass.  Decorating a class\nwith '@final' indicates that it cannot be subclassed.\n\nFor example:\n\nclass Base:\n@final\ndef done(self) -> None:\n...\nclass Sub(Base):\ndef done(self) -> None:  # Error reported by type checker\n...\n\n@final\nclass Leaf:\n...\nclass Other(Leaf):  # Error reported by type checker\n...\n\nThere is no runtime checking of these properties.  See PEP 591(4)\nfor more details.\n\nNew in version 3.8.\n\nChanged in version 3.11: The decorator will now attempt to set a\n'final' attribute to 'True' on the decorated object.  Thus, a\ncheck like 'if getattr(obj, \"final\", False)' can be used at\nruntime to determine whether an object 'obj' has been marked as\nfinal.  If the decorated object does not support setting\nattributes, the decorator returns the object unchanged without\nraising an exception.\n\n-- Function: @typing.notypecheck\n\nDecorator to indicate that annotations are not type hints.\n\nThis works as a class or function *note decorator: 514.  With a\nclass, it applies recursively to all methods and classes defined in\nthat class (but not to methods defined in its superclasses or\nsubclasses).  Type checkers will ignore all annotations in a\nfunction or class with this decorator.\n\n'@notypecheck' mutates the decorated object in place.\n\n-- Function: @typing.notypecheckdecorator\n\nDecorator to give another decorator the *note notypecheck(): 483.\neffect.\n\nThis wraps the decorator with something that wraps the decorated\nfunction in *note notypecheck(): 483.\n\n-- Function: @typing.override\n\nDecorator to indicate that a method in a subclass is intended to\noverride a method or attribute in a superclass.\n\nType checkers should emit an error if a method decorated with\n'@override' does not, in fact, override anything.  This helps\nprevent bugs that may occur when a base class is changed without an\nequivalent change to a child class.\n\nFor example:\n\nclass Base:\ndef logstatus(self) -> None:\n...\n\nclass Sub(Base):\n@override\ndef logstatus(self) -> None:  # Okay: overrides Base.logstatus\n...\n\n@override\ndef done(self) -> None:  # Error reported by type checker\n...\n\nThere is no runtime checking of this property.\n\nThe decorator will attempt to set an 'override' attribute to\n'True' on the decorated object.  Thus, a check like 'if\ngetattr(obj, \"override\", False)' can be used at runtime to\ndetermine whether an object 'obj' has been marked as an override.\nIf the decorated object does not support setting attributes, the\ndecorator returns the object unchanged without raising an\nexception.\n\nSee PEP 698(5) for more details.\n\nNew in version 3.12.\n\n-- Function: @typing.typecheckonly\n\nDecorator to mark a class or function as unavailable at runtime.\n\nThis decorator is itself not available at runtime.  It is mainly\nintended to mark classes that are defined in type stub files if an\nimplementation returns an instance of a private class:\n\n@typecheckonly\nclass Response:  # private or not available at runtime\ncode: int\ndef getheader(self, name: str) -> str: ...\n\ndef fetchresponse() -> Response: ...\n\nNote that returning instances of private classes is not\nrecommended.  It is usually preferable to make such classes public.\n\n---------- Footnotes ----------\n\n(1) https://typing.readthedocs.io/en/latest/source/unreachable.html\n\n(2) https://peps.python.org/pep-0681/\n\n(3) https://peps.python.org/pep-0484/\n\n(4) https://peps.python.org/pep-0591/\n\n(5) https://peps.python.org/pep-0698/\n\nFile: python3.12.info,  Node: Introspection helpers,  Next: Constant,  Prev: Functions and decorators,  Up: Module contents<3>\n\n5.26.1.20 Introspection helpers\n...............................\n\n-- Function: typing.gettypehints (obj, globalns=None, localns=None,\nincludeextras=False)\n\nReturn a dictionary containing type hints for a function, method,\nmodule or class object.\n\nThis is often the same as 'obj.annotations'.  In addition,\nforward references encoded as string literals are handled by\nevaluating them in 'globals' and 'locals' namespaces.  For a class\n'C', return a dictionary constructed by merging all the\n'annotations' along 'C.mro' in reverse order.\n\nThe function recursively replaces all 'Annotated[T, ...]' with 'T',\nunless 'includeextras' is set to 'True' (see *note Annotated: 75b.\nfor more information).  For example:\n\nclass Student(NamedTuple):\nname: Annotated[str, 'some marker']\n\nassert gettypehints(Student) == {'name': str}\nassert gettypehints(Student, includeextras=False) == {'name': str}\nassert gettypehints(Student, includeextras=True) == {\n'name': Annotated[str, 'some marker']\n}\n\nNote: *note gettypehints(): 47f. does not work with imported\n*note type aliases: 15f. that include forward references.\nEnabling postponed evaluation of annotations ( PEP 563(1)) may\nremove the need for most forward references.\n\nChanged in version 3.9: Added 'includeextras' parameter as part of\nPEP 593(2).  See the documentation on *note Annotated: 75b. for\nmore information.\n\nChanged in version 3.11: Previously, 'Optional[t]' was added for\nfunction and method annotations if a default value equal to 'None'\nwas set.  Now the annotation is returned unchanged.\n\n-- Function: typing.getorigin (tp)\n\nGet the unsubscripted version of a type: for a typing object of the\nform 'X[Y, Z, ...]' return 'X'.\n\nIf 'X' is a typing-module alias for a builtin or *note collections:\n1b. class, it will be normalized to the original class.  If 'X' is\nan instance of *note ParamSpecArgs: 5b9. or *note ParamSpecKwargs:\n5ba, return the underlying *note ParamSpec: 163.  Return 'None' for\nunsupported objects.\n\nExamples:\n\nassert getorigin(str) is None\nassert getorigin(Dict[str, int]) is dict\nassert getorigin(Union[int, str]) is Union\nP = ParamSpec('P')\nassert getorigin(P.args) is P\nassert getorigin(P.kwargs) is P\n\nNew in version 3.8.\n\n-- Function: typing.getargs (tp)\n\nGet type arguments with all substitutions performed: for a typing\nobject of the form 'X[Y, Z, ...]' return '(Y, Z, ...)'.\n\nIf 'X' is a union or *note Literal: 64b. contained in another\ngeneric type, the order of '(Y, Z, ...)' may be different from the\norder of the original arguments '[Y, Z, ...]' due to type caching.\nReturn '()' for unsupported objects.\n\nExamples:\n\nassert getargs(int) == ()\nassert getargs(Dict[int, str]) == (int, str)\nassert getargs(Union[int, str]) == (int, str)\n\nNew in version 3.8.\n\n-- Function: typing.istypeddict (tp)\n\nCheck if a type is a *note TypedDict: 153.\n\nFor example:\n\nclass Film(TypedDict):\ntitle: str\nyear: int\n\nassert istypeddict(Film)\nassert not istypeddict(list | str)\n\n# TypedDict is a factory for creating typed dicts,\n# not a typed dict itself\nassert not istypeddict(TypedDict)\n\nNew in version 3.10.\n\n-- Class: typing.ForwardRef\n\nClass used for internal typing representation of string forward\nreferences.\n\nFor example, 'List[\"SomeClass\"]' is implicitly transformed into\n'List[ForwardRef(\"SomeClass\")]'.  'ForwardRef' should not be\ninstantiated by a user, but may be used by introspection tools.\n\nNote: PEP 585(3) generic types such as 'list[\"SomeClass\"]'\nwill not be implicitly transformed into\n'list[ForwardRef(\"SomeClass\")]' and thus will not\nautomatically resolve to 'list[SomeClass]'.\n\nNew in version 3.7.4.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0563/\n\n(2) https://peps.python.org/pep-0593/\n\n(3) https://peps.python.org/pep-0585/\n\nFile: python3.12.info,  Node: Constant,  Next: Deprecated aliases,  Prev: Introspection helpers,  Up: Module contents<3>\n\n5.26.1.21 Constant\n..................\n\n-- Data: typing.TYPECHECKING\n\nA special constant that is assumed to be 'True' by 3rd party static\ntype checkers.  It is 'False' at runtime.\n\nUsage:\n\nif TYPECHECKING:\nimport expensivemod\n\ndef fun(arg: 'expensivemod.SomeType') -> None:\nlocalvar: expensivemod.AnotherType = otherfun()\n\nThe first type annotation must be enclosed in quotes, making it a\n\"forward reference\", to hide the 'expensivemod' reference from the\ninterpreter runtime.  Type annotations for local variables are not\nevaluated, so the second annotation does not need to be enclosed in\nquotes.\n\nNote: If 'from future import annotations' is used,\nannotations are not evaluated at function definition time.\nInstead, they are stored as strings in 'annotations'.\nThis makes it unnecessary to use quotes around the annotation\n(see PEP 563(1)).\n\nNew in version 3.5.2.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0563/\n\nFile: python3.12.info,  Node: Deprecated aliases,  Prev: Constant,  Up: Module contents<3>\n\n5.26.1.22 Deprecated aliases\n............................\n",
            "subsections": []
        },
        "This module defines several deprecated aliases to pre-existing standard": {
            "content": "library classes.  These were originally included in the typing module in\norder to support parameterizing these generic classes using '[]'.",
            "subsections": []
        },
        "However, the aliases became redundant in Python 3.9 when the": {
            "content": "corresponding pre-existing classes were enhanced to support '[]' (see\nPEP 585(1)).\n",
            "subsections": []
        },
        "The redundant types are deprecated as of Python 3.9.  However, while the": {
            "content": "aliases may be removed at some point, removal of these aliases is not\ncurrently planned.  As such, no deprecation warnings are currently\nissued by the interpreter for these aliases.\n",
            "subsections": []
        },
        "If at some point it is decided to remove these deprecated aliases, a": {
            "content": "deprecation warning will be issued by the interpreter for at least two\nreleases prior to removal.  The aliases are guaranteed to remain in the\ntyping module without deprecation warnings until at least Python 3.14.\n",
            "subsections": []
        },
        "Type checkers are encouraged to flag uses of the deprecated types if the": {
            "content": "program they are checking targets a minimum Python version of 3.9 or\nnewer.\n\n* Menu:\n\n* Aliases to built-in types::\n* Aliases to types in collections::\n* Aliases to other concrete types::\n* Aliases to container ABCs in collections.abc: Aliases to container ABCs in collections abc.\n* Aliases to asynchronous ABCs in collections.abc: Aliases to asynchronous ABCs in collections abc.\n* Aliases to other ABCs in collections.abc: Aliases to other ABCs in collections abc.\n* Aliases to contextlib ABCs::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0585/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Aliases to built-in types,  Next: Aliases to types in collections,  Up: Deprecated aliases": {
            "content": "5.26.1.23 Aliases to built-in types\n...................................\n\n-- Class: typing.Dict (dict, MutableMapping[KT, VT])\n\nDeprecated alias to *note dict: 237.\n\nNote that to annotate arguments, it is preferred to use an abstract\ncollection type such as *note Mapping: 3c22. rather than to use\n*note dict: 237. or 'typing.Dict'.\n\nThis type can be used as follows:\n\ndef countwords(text: str) -> Dict[str, int]:\n...\n\nDeprecated since version 3.9: *note builtins.dict: 237. now\nsupports subscripting ('[]').  See PEP 585(1) and *note Generic\nAlias Type: 480.\n\n-- Class: typing.List (list, MutableSequence[T])\n\nDeprecated alias to *note list: 3dc.\n\nNote that to annotate arguments, it is preferred to use an abstract\ncollection type such as *note Sequence: 3c24. or *note Iterable:\n3c25. rather than to use *note list: 3dc. or 'typing.List'.\n\nThis type may be used as follows:\n\ndef vec2[T: (int, float)](x: T, y: T) -> List[T]:\nreturn [x, y]\n\ndef keeppositives[T: (int, float)](vector: Sequence[T]) -> List[T]:\nreturn [item for item in vector if item > 0]\n\nDeprecated since version 3.9: *note builtins.list: 3dc. now\nsupports subscripting ('[]').  See PEP 585(2) and *note Generic\nAlias Type: 480.\n\n-- Class: typing.Set (set, MutableSet[T])\n\nDeprecated alias to *note builtins.set: 39d.\n\nNote that to annotate arguments, it is preferred to use an abstract\ncollection type such as *note AbstractSet: 3c27. rather than to use\n*note set: 39d. or 'typing.Set'.\n\nDeprecated since version 3.9: *note builtins.set: 39d. now supports\nsubscripting ('[]').  See PEP 585(3) and *note Generic Alias Type:\n480.\n\n-- Class: typing.FrozenSet (frozenset, AbstractSet[Tco])\n\nDeprecated alias to *note builtins.frozenset: 39e.\n\nDeprecated since version 3.9: *note builtins.frozenset: 39e. now\nsupports subscripting ('[]').  See PEP 585(4) and *note Generic\nAlias Type: 480.\n\n-- Data: typing.Tuple\n\nDeprecated alias for *note tuple: 4b8.\n\n*note tuple: 4b8. and 'Tuple' are special-cased in the type system;\nsee *note Annotating tuples: 3be6. for more details.\n\nDeprecated since version 3.9: *note builtins.tuple: 4b8. now\nsupports subscripting ('[]').  See PEP 585(5) and *note Generic\nAlias Type: 480.\n\n-- Class: typing.Type (Generic[CTco])\n\nDeprecated alias to *note type: ba0.\n\nSee *note The type of class objects: 3be9. for details on using\n*note type: ba0. or 'typing.Type' in type annotations.\n\nNew in version 3.5.2.\n\nDeprecated since version 3.9: *note builtins.type: ba0. now\nsupports subscripting ('[]').  See PEP 585(6) and *note Generic\nAlias Type: 480.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0585/\n\n(2) https://peps.python.org/pep-0585/\n\n(3) https://peps.python.org/pep-0585/\n\n(4) https://peps.python.org/pep-0585/\n\n(5) https://peps.python.org/pep-0585/\n\n(6) https://peps.python.org/pep-0585/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Aliases to types in collections,  Next: Aliases to other concrete types,  Prev: Aliases to built-in types,  Up: Deprecated aliases": {
            "content": "5.26.1.24 Aliases to types in 'collections'\n...........................................\n\n-- Class: typing.DefaultDict (collections.defaultdict,\nMutableMapping[KT, VT])\n\nDeprecated alias to *note collections.defaultdict: 1031.\n\nNew in version 3.5.2.\n\nDeprecated since version 3.9: *note collections.defaultdict: 1031.\nnow supports subscripting ('[]').  See PEP 585(1) and *note Generic\nAlias Type: 480.\n\n-- Class: typing.OrderedDict (collections.OrderedDict,\nMutableMapping[KT, VT])\n\nDeprecated alias to *note collections.OrderedDict: 39f.\n\nNew in version 3.7.2.\n\nDeprecated since version 3.9: *note collections.OrderedDict: 39f.\nnow supports subscripting ('[]').  See PEP 585(2) and *note Generic\nAlias Type: 480.\n\n-- Class: typing.ChainMap (collections.ChainMap, MutableMapping[KT,\nVT])\n\nDeprecated alias to *note collections.ChainMap: a62.\n\nNew in version 3.6.1.\n\nDeprecated since version 3.9: *note collections.ChainMap: a62. now\nsupports subscripting ('[]').  See PEP 585(3) and *note Generic\nAlias Type: 480.\n\n-- Class: typing.Counter (collections.Counter, Dict[T, int])\n\nDeprecated alias to *note collections.Counter: f09.\n\nNew in version 3.6.1.\n\nDeprecated since version 3.9: *note collections.Counter: f09. now\nsupports subscripting ('[]').  See PEP 585(4) and *note Generic\nAlias Type: 480.\n\n-- Class: typing.Deque (deque, MutableSequence[T])\n\nDeprecated alias to *note collections.deque: 3a0.\n\nNew in version 3.6.1.\n\nDeprecated since version 3.9: *note collections.deque: 3a0. now\nsupports subscripting ('[]').  See PEP 585(5) and *note Generic\nAlias Type: 480.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0585/\n\n(2) https://peps.python.org/pep-0585/\n\n(3) https://peps.python.org/pep-0585/\n\n(4) https://peps.python.org/pep-0585/\n\n(5) https://peps.python.org/pep-0585/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Aliases to other concrete types,  Next: Aliases to container ABCs in collections abc,  Prev: Aliases to types in collections,  Up: Deprecated aliases": {
            "content": "5.26.1.25 Aliases to other concrete types\n.........................................\n\nDeprecated since version 3.8, will be removed in version 3.13: The\n'typing.io' namespace is deprecated and will be removed.  These\ntypes should be directly imported from 'typing' instead.\n\n-- Class: typing.Pattern\n-- Class: typing.Match\n\nDeprecated aliases corresponding to the return types from *note\nre.compile(): a17. and *note re.match(): 10a3.\n\nThese types (and the corresponding functions) are generic over\n*note AnyStr: 3bf2.  'Pattern' can be specialised as 'Pattern[str]'\nor 'Pattern[bytes]'; 'Match' can be specialised as 'Match[str]' or\n'Match[bytes]'.\n\nDeprecated since version 3.8, will be removed in version 3.13: The\n'typing.re' namespace is deprecated and will be removed.  These\ntypes should be directly imported from 'typing' instead.\n\nDeprecated since version 3.9: Classes 'Pattern' and 'Match' from\n*note re: b4. now support '[]'.  See PEP 585(1) and *note Generic\nAlias Type: 480.\n\n-- Class: typing.Text\n\nDeprecated alias for *note str: 157.\n\n'Text' is provided to supply a forward compatible path for Python 2\ncode: in Python 2, 'Text' is an alias for 'unicode'.\n\nUse 'Text' to indicate that a value must contain a unicode string\nin a manner that is compatible with both Python 2 and Python 3:\n\ndef addunicodecheckmark(text: Text) -> Text:\nreturn text + u' \\u2713'\n\nNew in version 3.5.2.\n\nDeprecated since version 3.11: Python 2 is no longer supported, and\nmost type checkers also no longer support type checking Python 2\ncode.  Removal of the alias is not currently planned, but users are\nencouraged to use *note str: 157. instead of 'Text'.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0585/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "5.26.1.26 Aliases to container ABCs in 'collections.abc'\n........................................................\n\n-- Class: typing.AbstractSet (Collection[Tco])\n\nDeprecated alias to *note collections.abc.Set: 1f53.\n\nDeprecated since version 3.9: *note collections.abc.Set: 1f53. now\nsupports subscripting ('[]').  See PEP 585(1) and *note Generic\nAlias Type: 480.\n\n-- Class: typing.ByteString (Sequence[int])\n\nThis type represents the types *note bytes: 295, *note bytearray:\n294, and *note memoryview: 17f. of byte sequences.\n\nDeprecated since version 3.9, will be removed in version 3.14:\nPrefer *note collections.abc.Buffer: 170, or a union like 'bytes |\nbytearray | memoryview'.\n\n-- Class: typing.Collection (Sized, Iterable[Tco], Container[Tco])\n\nDeprecated alias to *note collections.abc.Collection: ad5.\n\nNew in version 3.6.\n\nDeprecated since version 3.9: *note collections.abc.Collection:\nad5. now supports subscripting ('[]').  See PEP 585(2) and *note\nGeneric Alias Type: 480.\n\n-- Class: typing.Container (Generic[Tco])\n\nDeprecated alias to *note collections.abc.Container: 1f5d.\n\nDeprecated since version 3.9: *note collections.abc.Container:\n1f5d. now supports subscripting ('[]').  See PEP 585(3) and *note\nGeneric Alias Type: 480.\n\n-- Class: typing.ItemsView (MappingView, AbstractSet[tuple[KTco,\nVTco]])\n\nDeprecated alias to *note collections.abc.ItemsView: 1f61.\n\nDeprecated since version 3.9: *note collections.abc.ItemsView:\n1f61. now supports subscripting ('[]').  See PEP 585(4) and *note\nGeneric Alias Type: 480.\n\n-- Class: typing.KeysView (MappingView, AbstractSet[KTco])\n\nDeprecated alias to *note collections.abc.KeysView: 1f60.\n\nDeprecated since version 3.9: *note collections.abc.KeysView: 1f60.\nnow supports subscripting ('[]').  See PEP 585(5) and *note Generic\nAlias Type: 480.\n\n-- Class: typing.Mapping (Collection[KT], Generic[KT, VTco])\n\nDeprecated alias to *note collections.abc.Mapping: 6e2.\n\nThis type can be used as follows:\n\ndef getpositioninindex(wordlist: Mapping[str, int], word: str) -> int:\nreturn wordlist[word]\n\nDeprecated since version 3.9: *note collections.abc.Mapping: 6e2.\nnow supports subscripting ('[]').  See PEP 585(6) and *note Generic\nAlias Type: 480.\n\n-- Class: typing.MappingView (Sized)\n\nDeprecated alias to *note collections.abc.MappingView: 1f5f.\n\nDeprecated since version 3.9: *note collections.abc.MappingView:\n1f5f. now supports subscripting ('[]').  See PEP 585(7) and *note\nGeneric Alias Type: 480.\n\n-- Class: typing.MutableMapping (Mapping[KT, VT])\n\nDeprecated alias to *note collections.abc.MutableMapping: f1e.\n\nDeprecated since version 3.9: *note collections.abc.MutableMapping:\nf1e. now supports subscripting ('[]').  See PEP 585(8) and *note\nGeneric Alias Type: 480.\n\n-- Class: typing.MutableSequence (Sequence[T])\n\nDeprecated alias to *note collections.abc.MutableSequence: c31.\n\nDeprecated since version 3.9: *note\ncollections.abc.MutableSequence: c31. now supports subscripting\n('[]').  See PEP 585(9) and *note Generic Alias Type: 480.\n\n-- Class: typing.MutableSet (AbstractSet[T])\n\nDeprecated alias to *note collections.abc.MutableSet: 1f5e.\n\nDeprecated since version 3.9: *note collections.abc.MutableSet:\n1f5e. now supports subscripting ('[]').  See PEP 585(10) and *note\nGeneric Alias Type: 480.\n\n-- Class: typing.Sequence (Reversible[Tco], Collection[Tco])\n\nDeprecated alias to *note collections.abc.Sequence: 1038.\n\nDeprecated since version 3.9: *note collections.abc.Sequence: 1038.\nnow supports subscripting ('[]').  See PEP 585(11) and *note\nGeneric Alias Type: 480.\n\n-- Class: typing.ValuesView (MappingView, Collection[VTco])\n\nDeprecated alias to *note collections.abc.ValuesView: 1f62.\n\nDeprecated since version 3.9: *note collections.abc.ValuesView:\n1f62. now supports subscripting ('[]').  See PEP 585(12) and *note\nGeneric Alias Type: 480.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0585/\n\n(2) https://peps.python.org/pep-0585/\n\n(3) https://peps.python.org/pep-0585/\n\n(4) https://peps.python.org/pep-0585/\n\n(5) https://peps.python.org/pep-0585/\n\n(6) https://peps.python.org/pep-0585/\n\n(7) https://peps.python.org/pep-0585/\n\n(8) https://peps.python.org/pep-0585/\n\n(9) https://peps.python.org/pep-0585/\n\n(10) https://peps.python.org/pep-0585/\n\n(11) https://peps.python.org/pep-0585/\n\n(12) https://peps.python.org/pep-0585/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "5.26.1.27 Aliases to asynchronous ABCs in 'collections.abc'\n...........................................................\n\n-- Class: typing.Coroutine (Awaitable[ReturnType], Generic[YieldType,\nSendType, ReturnType])\n\nDeprecated alias to *note collections.abc.Coroutine: c3a.\n\nThe variance and order of type variables correspond to those of\n*note Generator: 3c41, for example:\n\nfrom collections.abc import Coroutine\nc: Coroutine[list[str], str, int]  # Some coroutine defined elsewhere\nx = c.send('hi')                   # Inferred type of 'x' is list[str]\nasync def bar() -> None:\ny = await c                    # Inferred type of 'y' is int\n\nNew in version 3.5.3.\n\nDeprecated since version 3.9: *note collections.abc.Coroutine: c3a.\nnow supports subscripting ('[]').  See PEP 585(1) and *note Generic\nAlias Type: 480.\n\n-- Class: typing.AsyncGenerator (AsyncIterator[YieldType],\nGeneric[YieldType, SendType])\n\nDeprecated alias to *note collections.abc.AsyncGenerator: ad7.\n\nAn async generator can be annotated by the generic type\n'AsyncGenerator[YieldType, SendType]'.  For example:\n\nasync def echoround() -> AsyncGenerator[int, float]:\nsent = yield 0\nwhile sent >= 0.0:\nrounded = await round(sent)\nsent = yield rounded\n\nUnlike normal generators, async generators cannot return a value,\nso there is no 'ReturnType' type parameter.  As with *note\nGenerator: 3c41, the 'SendType' behaves contravariantly.\n\nIf your generator will only yield values, set the 'SendType' to\n'None':\n\nasync def infinitestream(start: int) -> AsyncGenerator[int, None]:\nwhile True:\nyield start\nstart = await increment(start)\n\nAlternatively, annotate your generator as having a return type of\neither 'AsyncIterable[YieldType]' or 'AsyncIterator[YieldType]':\n\nasync def infinitestream(start: int) -> AsyncIterator[int]:\nwhile True:\nyield start\nstart = await increment(start)\n\nNew in version 3.6.1.\n\nDeprecated since version 3.9: *note collections.abc.AsyncGenerator:\nad7. now supports subscripting ('[]').  See PEP 585(2) and *note\nGeneric Alias Type: 480.\n\n-- Class: typing.AsyncIterable (Generic[Tco])\n\nDeprecated alias to *note collections.abc.AsyncIterable: c3c.\n\nNew in version 3.5.2.\n\nDeprecated since version 3.9: *note collections.abc.AsyncIterable:\nc3c. now supports subscripting ('[]').  See PEP 585(3) and *note\nGeneric Alias Type: 480.\n\n-- Class: typing.AsyncIterator (AsyncIterable[Tco])\n\nDeprecated alias to *note collections.abc.AsyncIterator: c3b.\n\nNew in version 3.5.2.\n\nDeprecated since version 3.9: *note collections.abc.AsyncIterator:\nc3b. now supports subscripting ('[]').  See PEP 585(4) and *note\nGeneric Alias Type: 480.\n\n-- Class: typing.Awaitable (Generic[Tco])\n\nDeprecated alias to *note collections.abc.Awaitable: c39.\n\nNew in version 3.5.2.\n\nDeprecated since version 3.9: *note collections.abc.Awaitable: c39.\nnow supports subscripting ('[]').  See PEP 585(5) and *note Generic\nAlias Type: 480.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0585/\n\n(2) https://peps.python.org/pep-0585/\n\n(3) https://peps.python.org/pep-0585/\n\n(4) https://peps.python.org/pep-0585/\n\n(5) https://peps.python.org/pep-0585/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "5.26.1.28 Aliases to other ABCs in 'collections.abc'\n....................................................\n\n-- Class: typing.Iterable (Generic[Tco])\n\nDeprecated alias to *note collections.abc.Iterable: 1f5b.\n\nDeprecated since version 3.9: *note collections.abc.Iterable: 1f5b.\nnow supports subscripting ('[]').  See PEP 585(1) and *note Generic\nAlias Type: 480.\n\n-- Class: typing.Iterator (Iterable[Tco])\n\nDeprecated alias to *note collections.abc.Iterator: 1f5c.\n\nDeprecated since version 3.9: *note collections.abc.Iterator: 1f5c.\nnow supports subscripting ('[]').  See PEP 585(2) and *note Generic\nAlias Type: 480.\n\n-- Data: typing.Callable\n\nDeprecated alias to *note collections.abc.Callable: 5de.\n\nSee *note Annotating callable objects: 3be3. for details on how to\nuse *note collections.abc.Callable: 5de. and 'typing.Callable' in\ntype annotations.\n\nDeprecated since version 3.9: *note collections.abc.Callable: 5de.\nnow supports subscripting ('[]').  See PEP 585(3) and *note Generic\nAlias Type: 480.\n\nChanged in version 3.10: 'Callable' now supports *note ParamSpec:\n163. and *note Concatenate: 5b7.  See PEP 612(4) for more details.\n\n-- Class: typing.Generator (Iterator[YieldType], Generic[YieldType,\nSendType, ReturnType])\n\nDeprecated alias to *note collections.abc.Generator: c38.\n\nA generator can be annotated by the generic type\n'Generator[YieldType, SendType, ReturnType]'.  For example:\n\ndef echoround() -> Generator[int, float, str]:\nsent = yield 0\nwhile sent >= 0:\nsent = yield round(sent)\nreturn 'Done'\n\nNote that unlike many other generics in the typing module, the\n'SendType' of *note Generator: 3c41. behaves contravariantly, not\ncovariantly or invariantly.\n\nIf your generator will only yield values, set the 'SendType' and\n'ReturnType' to 'None':\n\ndef infinitestream(start: int) -> Generator[int, None, None]:\nwhile True:\nyield start\nstart += 1\n\nAlternatively, annotate your generator as having a return type of\neither 'Iterable[YieldType]' or 'Iterator[YieldType]':\n\ndef infinitestream(start: int) -> Iterator[int]:\nwhile True:\nyield start\nstart += 1\n\nDeprecated since version 3.9: *note collections.abc.Generator: c38.\nnow supports subscripting ('[]').  See PEP 585(5) and *note Generic\nAlias Type: 480.\n\n-- Class: typing.Hashable\n\nDeprecated alias to *note collections.abc.Hashable: 23b.\n\nDeprecated since version 3.12: Use *note collections.abc.Hashable:\n23b. directly instead.\n\n-- Class: typing.Reversible (Iterable[Tco])\n\nDeprecated alias to *note collections.abc.Reversible: ad6.\n\nDeprecated since version 3.9: *note collections.abc.Reversible:\nad6. now supports subscripting ('[]').  See PEP 585(6) and *note\nGeneric Alias Type: 480.\n\n-- Class: typing.Sized\n\nDeprecated alias to *note collections.abc.Sized: 23c.\n\nDeprecated since version 3.12: Use *note collections.abc.Sized:\n23c. directly instead.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0585/\n\n(2) https://peps.python.org/pep-0585/\n\n(3) https://peps.python.org/pep-0585/\n\n(4) https://peps.python.org/pep-0612/\n\n(5) https://peps.python.org/pep-0585/\n\n(6) https://peps.python.org/pep-0585/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Aliases to contextlib ABCs,  Prev: Aliases to other ABCs in collections abc,  Up: Deprecated aliases": {
            "content": "5.26.1.29 Aliases to 'contextlib' ABCs\n......................................\n\n-- Class: typing.ContextManager (Generic[Tco])\n\nDeprecated alias to *note contextlib.AbstractContextManager: ada.\n\nNew in version 3.5.4.\n\nDeprecated since version 3.9: *note\ncontextlib.AbstractContextManager: ada. now supports subscripting\n('[]').  See PEP 585(1) and *note Generic Alias Type: 480.\n\n-- Class: typing.AsyncContextManager (Generic[Tco])\n\nDeprecated alias to *note contextlib.AbstractAsyncContextManager:\n964.\n\nNew in version 3.6.2.\n\nDeprecated since version 3.9: *note\ncontextlib.AbstractAsyncContextManager: 964. now supports\nsubscripting ('[]').  See PEP 585(2) and *note Generic Alias Type:\n480.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0585/\n\n(2) https://peps.python.org/pep-0585/\n\nFile: python3.12.info,  Node: Deprecation Timeline of Major Features,  Prev: Module contents<3>,  Up: typing -- Support for type hints\n\n5.26.1.30 Deprecation Timeline of Major Features\n................................................\n",
            "subsections": []
        },
        "Certain features in 'typing' are deprecated and may be removed in a": {
            "content": "future version of Python.  The following table summarizes major\ndeprecations for your convenience.  This is subject to change, and not\nall deprecations are listed.\n",
            "subsections": []
        },
        "Feature                       Deprecated in                 Projected removal             PEP/issue": {
            "content": "------------------------------------------------------------------------------------------------------------------------\n\n'typing.io' and 'typing.re'   3.8                           3.13                          bpo-38291(1)\nsubmodules\n\n'typing' versions of          3.9                           Undecided (see                PEP 585(2)\nstandard collections                                        *note Deprecated aliases: 3c1d.\nfor more information)\n\n\n*note typing.ByteString: 23d. 3.9                           3.14                          gh-91896(3)\n\n\n*note typing.Text: 24b.       3.11                          Undecided                     gh-92332(4)\n\n\n*note typing.Hashable: 239.   3.12                          Undecided                     gh-94309(5)\nand\n*note typing.Sized: 23a.\n\n*note typing.TypeAlias: 1696. 3.12                          Undecided                     PEP 695(6)\n\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=38291\n\n(2) https://peps.python.org/pep-0585/\n\n(3) https://github.com/python/cpython/issues/91896\n\n(4) https://github.com/python/cpython/issues/92332\n\n(5) https://github.com/python/cpython/issues/94309\n\n(6) https://peps.python.org/pep-0695/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: pydoc -- Documentation generator and online help system,  Next: Python Development Mode,  Prev: typing -- Support for type hints,  Up: Development Tools": {
            "content": "'Source code:' Lib/pydoc.py(1)\n\n\n",
            "subsections": []
        },
        "The 'pydoc' module automatically generates documentation from Python": {
            "content": "modules.  The documentation can be presented as pages of text on the\nconsole, served to a web browser, or saved to HTML files.\n",
            "subsections": []
        },
        "For modules, classes, functions and methods, the displayed documentation": {
            "content": "is derived from the docstring (i.e.  the 'doc' attribute) of the\nobject, and recursively of its documentable members.  If there is no\ndocstring, 'pydoc' tries to obtain a description from the block of\ncomment lines just above the definition of the class, function or method\nin the source file, or at the top of the module (see *note\ninspect.getcomments(): 3c50.).\n\nThe built-in function *note help(): 6f0. invokes the online help system\nin the interactive interpreter, which uses 'pydoc' to generate its\ndocumentation as text on the console.  The same text documentation can\nalso be viewed from outside the Python interpreter by running 'pydoc' as\na script at the operating system's command prompt.  For example, running\n\npython -m pydoc sys\n\nat a shell prompt will display documentation on the *note sys: d3.\nmodule, in a style similar to the manual pages shown by the Unix 'man'\ncommand.  The argument to 'pydoc' can be the name of a function, module,\nor package, or a dotted reference to a class, method, or function within\na module or module in a package.  If the argument to 'pydoc' looks like\na path (that is, it contains the path separator for your operating\nsystem, such as a slash in Unix), and refers to an existing Python\nsource file, then documentation is produced for that file.\n\nNote: In order to find objects and their documentation, 'pydoc'\nimports the module(s) to be documented.  Therefore, any code on\nmodule level will be executed on that occasion.  Use an 'if\nname == 'main':' guard to only execute code when a file is\ninvoked as a script and not just imported.\n",
            "subsections": []
        },
        "When printing output to the console, 'pydoc' attempts to paginate the": {
            "content": "output for easier reading.  If the 'PAGER' environment variable is set,\n'pydoc' will use its value as a pagination program.\n",
            "subsections": []
        },
        "Specifying a '-w' flag before the argument will cause HTML documentation": {
            "content": "to be written out to a file in the current directory, instead of\ndisplaying text on the console.\n",
            "subsections": []
        },
        "Specifying a '-k' flag before the argument will search the synopsis": {
            "content": "lines of all available modules for the keyword given as the argument,\nagain in a manner similar to the Unix 'man' command.  The synopsis line\nof a module is the first line of its documentation string.\n",
            "subsections": []
        },
        "You can also use 'pydoc' to start an HTTP server on the local machine": {
            "content": "that will serve documentation to visiting web browsers.  'python -m\npydoc -p 1234' will start a HTTP server on port 1234, allowing you to\nbrowse the documentation at 'http://localhost:1234/' in your preferred\nweb browser.  Specifying '0' as the port number will select an arbitrary\nunused port.\n\n'python -m pydoc -n <hostname>' will start the server listening at the\ngiven hostname.  By default the hostname is 'localhost' but if you want\nthe server to be reached from other machines, you may want to change the\nhost name that the server responds to.  During development this is\nespecially useful if you want to run pydoc from within a container.\n\n'python -m pydoc -b' will start the server and additionally open a web\nbrowser to a module index page.  Each served page has a navigation bar\nat the top where you can 'Get' help on an individual item, 'Search' all\nmodules with a keyword in their synopsis line, and go to the 'Module\nindex', 'Topics' and 'Keywords' pages.\n",
            "subsections": []
        },
        "When 'pydoc' generates documentation, it uses the current environment": {
            "content": "and path to locate modules.  Thus, invoking 'pydoc spam' documents\nprecisely the version of the module you would get if you started the\nPython interpreter and typed 'import spam'.\n",
            "subsections": []
        },
        "Module docs for core modules are assumed to reside in": {
            "content": "'https://docs.python.org/X.Y/library/' where 'X' and 'Y' are the major\nand minor version numbers of the Python interpreter.  This can be\noverridden by setting the 'PYTHONDOCS' environment variable to a\ndifferent URL or to a local directory containing the Library Reference\nManual pages.\n\nChanged in version 3.2: Added the '-b' option.\n\nChanged in version 3.3: The '-g' command line option was removed.\n\nChanged in version 3.4: 'pydoc' now uses *note inspect.signature(): 51c.\nrather than *note inspect.getfullargspec(): 51d. to extract signature\ninformation from callables.\n\nChanged in version 3.7: Added the '-n' option.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/pydoc.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python Development Mode,  Next: doctest -- Test interactive Python examples,  Prev: pydoc -- Documentation generator and online help system,  Up: Development Tools": {
            "content": "New in version 3.7.\n",
            "subsections": []
        },
        "The Python Development Mode introduces additional runtime checks that": {
            "content": "are too expensive to be enabled by default.  It should not be more\nverbose than the default if the code is correct; new warnings are only\nemitted when an issue is detected.\n\nIt can be enabled using the *note -X dev: 188. command line option or by\nsetting the *note PYTHONDEVMODE: 924. environment variable to '1'.\n\nSee also *note Python debug build: 67f.\n\n* Menu:\n\n* Effects of the Python Development Mode::\n* ResourceWarning Example::\n* Bad file descriptor error example::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Effects of the Python Development Mode,  Next: ResourceWarning Example,  Up: Python Development Mode": {
            "content": "5.26.3.1 Effects of the Python Development Mode\n...............................................\n",
            "subsections": []
        },
        "Enabling the Python Development Mode is similar to the following": {
            "content": "command, but with additional effects described below:\n\nPYTHONMALLOC=debug PYTHONASYNCIODEBUG=1 python -W default -X faulthandler\n\nEffects of the Python Development Mode:\n\n* Add 'default' *note warning filter: 1abc.  The following warnings\nare shown:\n\n* *note DeprecationWarning: 179.\n\n* *note ImportWarning: 243.\n\n* *note PendingDeprecationWarning: 6e0.\n\n* *note ResourceWarning: a86.\n\nNormally, the above warnings are filtered by the default *note\nwarning filters: 1abc.\n\nIt behaves as if the *note -W default: 6df. command line option is\nused.\n\nUse the *note -W error: 6df. command line option or set the *note\nPYTHONWARNINGS: 9ee. environment variable to 'error' to treat\nwarnings as errors.\n\n* Install debug hooks on memory allocators to check for:\n\n* Buffer underflow\n\n* Buffer overflow\n\n* Memory allocator API violation\n\n* Unsafe usage of the GIL\n\nSee the *note PyMemSetupDebugHooks(): ab5. C function.\n\nIt behaves as if the *note PYTHONMALLOC: aaf. environment variable\nis set to 'debug'.\n\nTo enable the Python Development Mode without installing debug\nhooks on memory allocators, set the *note PYTHONMALLOC: aaf.\nenvironment variable to 'default'.\n\n* Call *note faulthandler.enable(): aed. at Python startup to install\nhandlers for the *note SIGSEGV: 1ac9, *note SIGFPE: 1aca, *note\nSIGABRT: 1acb, *note SIGBUS: 1acc. and *note SIGILL: 1acd. signals\nto dump the Python traceback on a crash.\n\nIt behaves as if the *note -X faulthandler: 188. command line\noption is used or if the *note PYTHONFAULTHANDLER: ef7. environment\nvariable is set to '1'.\n\n* Enable *note asyncio debug mode: 1acf.  For example, *note asyncio:\n9. checks for coroutines that were not awaited and logs them.\n\nIt behaves as if the *note PYTHONASYNCIODEBUG: 1ace. environment\nvariable is set to '1'.\n\n* Check the 'encoding' and 'errors' arguments for string encoding and\ndecoding operations.  Examples: *note open(): 26e, *note\nstr.encode(): 6ee. and *note bytes.decode(): 6ef.\n\nBy default, for best performance, the 'errors' argument is only\nchecked at the first encoding/decoding error and the 'encoding'\nargument is sometimes ignored for empty strings.\n\n* The *note io.IOBase: 823. destructor logs 'close()' exceptions.\n\n* Set the *note devmode: 1824. attribute of *note sys.flags: 458. to\n'True'.\n\nThe Python Development Mode does not enable the *note tracemalloc: fa.\nmodule by default, because the overhead cost (to performance and memory)\nwould be too large.  Enabling the *note tracemalloc: fa. module provides\nadditional information on the origin of some errors.  For example, *note",
            "subsections": []
        },
        "ResourceWarning: a86. logs the traceback where the resource was": {
            "content": "allocated, and a buffer overflow error logs the traceback where the\nmemory block was allocated.\n\nThe Python Development Mode does not prevent the *note -O: c11. command\nline option from removing *note assert: 78a. statements nor from setting\n*note debug: 5ce. to 'False'.\n\nThe Python Development Mode can only be enabled at the Python startup.\nIts value can be read from *note sys.flags.devmode: 458.\n\nChanged in version 3.8: The *note io.IOBase: 823. destructor now logs\n'close()' exceptions.\n",
            "subsections": []
        },
        "Changed in version 3.9: The 'encoding' and 'errors' arguments are now": {
            "content": "checked for string encoding and decoding operations.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ResourceWarning Example,  Next: Bad file descriptor error example,  Prev: Effects of the Python Development Mode,  Up: Python Development Mode": {
            "content": "5.26.3.2 ResourceWarning Example\n................................\n",
            "subsections": []
        },
        "Example of a script counting the number of lines of the text file": {
            "content": "specified in the command line:\n\nimport sys\n\ndef main():\nfp = open(sys.argv[1])\nnlines = len(fp.readlines())\nprint(nlines)\n# The file is closed implicitly\n\nif name == \"main\":\nmain()\n",
            "subsections": []
        },
        "The script does not close the file explicitly.  By default, Python does": {
            "content": "not emit any warning.  Example using README.txt, which has 269 lines:\n\n$ python script.py README.txt\n269\n\nEnabling the Python Development Mode displays a *note ResourceWarning:\na86. warning:\n\n$ python -X dev script.py README.txt\n269\nscript.py:10: ResourceWarning: unclosed file <io.TextIOWrapper name='README.rst' mode='r' encoding='UTF-8'>\nmain()\nResourceWarning: Enable tracemalloc to get the object allocation traceback\n\nIn addition, enabling *note tracemalloc: fa. shows the line where the\nfile was opened:\n\n$ python -X dev -X tracemalloc=5 script.py README.rst\n269\nscript.py:10: ResourceWarning: unclosed file <io.TextIOWrapper name='README.rst' mode='r' encoding='UTF-8'>\nmain()\nObject allocated at (most recent call last):\nFile \"script.py\", lineno 10\nmain()\nFile \"script.py\", lineno 4\nfp = open(sys.argv[1])\n",
            "subsections": []
        },
        "The fix is to close explicitly the file.  Example using a context": {
            "content": "manager:\n\ndef main():\n# Close the file explicitly when exiting the with block\nwith open(sys.argv[1]) as fp:\nnlines = len(fp.readlines())\nprint(nlines)\n",
            "subsections": []
        },
        "Not closing a resource explicitly can leave a resource open for way": {
            "content": "longer than expected; it can cause severe issues upon exiting Python.",
            "subsections": []
        },
        "It is bad in CPython, but it is even worse in PyPy.  Closing resources": {
            "content": "explicitly makes an application more deterministic and more reliable.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Bad file descriptor error example,  Prev: ResourceWarning Example,  Up: Python Development Mode": {
            "content": "5.26.3.3 Bad file descriptor error example\n..........................................\n\nScript displaying the first line of itself:\n\nimport os\n\ndef main():\nfp = open(file)\nfirstline = fp.readline()\nprint(firstline.rstrip())\nos.close(fp.fileno())\n# The file is closed implicitly\n\nmain()\n\nBy default, Python does not emit any warning:\n\n$ python script.py\nimport os\n\nThe Python Development Mode shows a *note ResourceWarning: a86. and logs\na \"Bad file descriptor\" error when finalizing the file object:\n\n$ python -X dev script.py\nimport os\nscript.py:10: ResourceWarning: unclosed file <io.TextIOWrapper name='script.py' mode='r' encoding='UTF-8'>\nmain()\nResourceWarning: Enable tracemalloc to get the object allocation traceback\nException ignored in: <io.TextIOWrapper name='script.py' mode='r' encoding='UTF-8'>\nTraceback (most recent call last):\nFile \"script.py\", line 10, in <module>\nmain()\nOSError: [Errno 9] Bad file descriptor\n\n'os.close(fp.fileno())' closes the file descriptor.  When the file\nobject finalizer tries to close the file descriptor again, it fails with\nthe 'Bad file descriptor' error.  A file descriptor must be closed only\nonce.  In the worst case scenario, closing it twice can lead to a crash\n(see bpo-18748(1) for an example).\n",
            "subsections": []
        },
        "The fix is to remove the 'os.close(fp.fileno())' line, or open the file": {
            "content": "with 'closefd=False'.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=18748\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: doctest -- Test interactive Python examples,  Next: unittest -- Unit testing framework,  Prev: Python Development Mode,  Up: Development Tools": {
            "content": "'Source code:' Lib/doctest.py(1)\n\n\n\nThe *note doctest: 36. module searches for pieces of text that look like\ninteractive Python sessions, and then executes those sessions to verify\nthat they work exactly as shown.  There are several common ways to use\ndoctest:\n\n* To check that a module's docstrings are up-to-date by verifying\nthat all interactive examples still work as documented.\n\n* To perform regression testing by verifying that interactive\nexamples from a test file or a test object work as expected.\n\n* To write tutorial documentation for a package, liberally\nillustrated with input-output examples.  Depending on whether the\nexamples or the expository text are emphasized, this has the flavor\nof \"literate testing\" or \"executable documentation\".\n\nHere's a complete but small example module:\n\n\"\"\"\nThis is the \"example\" module.\n\nThe example module supplies one function, factorial().  For example,\n\n>>> factorial(5)\n120\n\"\"\"\n\ndef factorial(n):\n\"\"\"Return the factorial of n, an exact integer >= 0.\n\n>>> [factorial(n) for n in range(6)]\n[1, 1, 2, 6, 24, 120]\n>>> factorial(30)\n265252859812191058636308480000000\n>>> factorial(-1)\nTraceback (most recent call last):\n...\nValueError: n must be >= 0\n\nFactorials of floats are OK, but the float must be an exact integer:\n>>> factorial(30.1)\nTraceback (most recent call last):\n...\nValueError: n must be exact integer\n>>> factorial(30.0)\n265252859812191058636308480000000\n\nIt must also not be ridiculously large:\n>>> factorial(1e100)\nTraceback (most recent call last):\n...\nOverflowError: n too large\n\"\"\"\n\nimport math\nif not n >= 0:\nraise ValueError(\"n must be >= 0\")\nif math.floor(n) != n:\nraise ValueError(\"n must be exact integer\")\nif n+1 == n:  # catch a value like 1e300\nraise OverflowError(\"n too large\")\nresult = 1\nfactor = 2\nwhile factor <= n:\nresult *= factor\nfactor += 1\nreturn result\n\n\nif name == \"main\":\nimport doctest\ndoctest.testmod()\n\nIf you run 'example.py' directly from the command line, *note doctest:\n36. works its magic:\n\n$ python example.py\n$\n\nThere's no output!  That's normal, and it means all the examples worked.\nPass '-v' to the script, and *note doctest: 36. prints a detailed log of\nwhat it's trying, and prints a summary at the end:\n\n$ python example.py -v\nTrying:\nfactorial(5)\nExpecting:\n120\nok\nTrying:\n[factorial(n) for n in range(6)]\nExpecting:\n[1, 1, 2, 6, 24, 120]\nok\n\nAnd so on, eventually ending with:\n\nTrying:\nfactorial(1e100)\nExpecting:\nTraceback (most recent call last):\n...\nOverflowError: n too large\nok\n2 items passed all tests:\n1 tests in main\n8 tests in main.factorial\n9 tests in 2 items.\n9 passed and 0 failed.\nTest passed.\n$\n\nThat's all you need to know to start making productive use of *note\ndoctest: 36.!  Jump in.  The following sections provide full details.",
            "subsections": []
        },
        "Note that there are many examples of doctests in the standard Python": {
            "content": "test suite and libraries.  Especially useful examples can be found in\nthe standard test file 'Lib/test/testdoctest/testdoctest.py'.\n\n* Menu:\n\n* Simple Usage; Checking Examples in Docstrings: Simple Usage Checking Examples in Docstrings.\n* Simple Usage; Checking Examples in a Text File: Simple Usage Checking Examples in a Text File.\n* How It Works::\n* Basic API::\n* Unittest API::\n* Advanced API::\n* Debugging::\n* Soapbox::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/doctest.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Simple Usage Checking Examples in Docstrings,  Next: Simple Usage Checking Examples in a Text File,  Up: doctest -- Test interactive Python examples": {
            "content": "5.26.4.1 Simple Usage: Checking Examples in Docstrings\n......................................................\n",
            "subsections": []
        },
        "The simplest way to start using doctest (but not necessarily the way": {
            "content": "you'll continue to do it) is to end each module 'M' with:\n\nif name == \"main\":\nimport doctest\ndoctest.testmod()\n\n'doctest' then examines docstrings in module 'M'.\n",
            "subsections": []
        },
        "Running the module as a script causes the examples in the docstrings to": {
            "content": "get executed and verified:\n\npython M.py\n",
            "subsections": []
        },
        "This won't display anything unless an example fails, in which case the": {
            "content": "failing example(s) and the cause(s) of the failure(s) are printed to\nstdout, and the final line of output is '*Test Failed* N failures.',\nwhere 'N' is the number of examples that failed.\n\nRun it with the '-v' switch instead:\n\npython M.py -v\n\nand a detailed report of all examples tried is printed to standard\noutput, along with assorted summaries at the end.\n\nYou can force verbose mode by passing 'verbose=True' to *note testmod():\n12c2, or prohibit it by passing 'verbose=False'.  In either of those\ncases, 'sys.argv' is not examined by *note testmod(): 12c2. (so passing\n'-v' or not has no effect).\n\nThere is also a command line shortcut for running *note testmod(): 12c2.",
            "subsections": []
        },
        "You can instruct the Python interpreter to run the doctest module": {
            "content": "directly from the standard library and pass the module name(s) on the\ncommand line:\n\npython -m doctest -v example.py\n\nThis will import 'example.py' as a standalone module and run *note\ntestmod(): 12c2. on it.  Note that this may not work correctly if the\nfile is part of a package and imports other submodules from that\npackage.\n\nFor more information on *note testmod(): 12c2, see section *note Basic\nAPI: 3c5a.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Simple Usage Checking Examples in a Text File,  Next: How It Works,  Prev: Simple Usage Checking Examples in Docstrings,  Up: doctest -- Test interactive Python examples": {
            "content": "5.26.4.2 Simple Usage: Checking Examples in a Text File\n.......................................................\n",
            "subsections": []
        },
        "Another simple application of doctest is testing interactive examples in": {
            "content": "a text file.  This can be done with the *note testfile(): 3c5d.\nfunction:\n\nimport doctest\ndoctest.testfile(\"example.txt\")\n",
            "subsections": []
        },
        "That short script executes and verifies any interactive Python examples": {
            "content": "contained in the file 'example.txt'.  The file content is treated as if\nit were a single giant docstring; the file doesn't need to contain a\nPython program!  For example, perhaps 'example.txt' contains this:\n",
            "subsections": [
                {
                    "name": "The ``example`` module",
                    "content": "This is an example text file in reStructuredText format.  First import\n``factorial`` from the ``example`` module:\n\n>>> from example import factorial\n\nNow use it:\n\n>>> factorial(6)\n120\n\nRunning 'doctest.testfile(\"example.txt\")' then finds the error in this\ndocumentation:\n\nFile \"./example.txt\", line 14, in example.txt\nFailed example:\nfactorial(6)\nExpected:\n120\nGot:\n720\n\nAs with *note testmod(): 12c2, *note testfile(): 3c5d. won't display\nanything unless an example fails.  If an example does fail, then the\nfailing example(s) and the cause(s) of the failure(s) are printed to\nstdout, using the same format as *note testmod(): 12c2.\n\nBy default, *note testfile(): 3c5d. looks for files in the calling\nmodule's directory.  See section *note Basic API: 3c5a. for a\ndescription of the optional arguments that can be used to tell it to\nlook for files in other locations.\n\nLike *note testmod(): 12c2, *note testfile(): 3c5d.'s verbosity can be\nset with the '-v' command-line switch or with the optional keyword\nargument 'verbose'.\n\nThere is also a command line shortcut for running *note testfile():\n3c5d.  You can instruct the Python interpreter to run the doctest module\ndirectly from the standard library and pass the file name(s) on the\ncommand line:\n\npython -m doctest -v example.txt\n\nBecause the file name does not end with '.py', *note doctest: 36. infers\nthat it must be run with *note testfile(): 3c5d, not *note testmod():\n12c2.\n\nFor more information on *note testfile(): 3c5d, see section *note Basic\nAPI: 3c5a.\n"
                }
            ]
        },
        "File: python3.12.info,  Node: How It Works,  Next: Basic API,  Prev: Simple Usage Checking Examples in a Text File,  Up: doctest -- Test interactive Python examples": {
            "content": "5.26.4.3 How It Works\n.....................\n",
            "subsections": []
        },
        "This section examines in detail how doctest works: which docstrings it": {
            "content": "looks at, how it finds interactive examples, what execution context it\nuses, how it handles exceptions, and how option flags can be used to\ncontrol its behavior.  This is the information that you need to know to\nwrite doctest examples; for information about actually running doctest\non these examples, see the following sections.\n\n* Menu:\n\n* Which Docstrings Are Examined?::\n* How are Docstring Examples Recognized?::\n* What's the Execution Context?::\n* What About Exceptions?::\n* Option Flags::\n* Directives::\n* Warnings: Warnings<2>.\n\nFile: python3.12.info,  Node: Which Docstrings Are Examined?,  Next: How are Docstring Examples Recognized?,  Up: How It Works\n\n5.26.4.4 Which Docstrings Are Examined?\n.......................................\n",
            "subsections": []
        },
        "The module docstring, and all function, class and method docstrings are": {
            "content": "searched.  Objects imported into the module are not searched.\n",
            "subsections": []
        },
        "In addition, there are cases when you want tests to be part of a module": {
            "content": "but not part of the help text, which requires that the tests not be\nincluded in the docstring.  Doctest looks for a module-level variable\ncalled 'test' and uses it to locate other tests.  If 'M.test'\nexists, it must be a dict, and each entry maps a (string) name to a\nfunction object, class object, or string.  Function and class object\ndocstrings found from 'M.test' are searched, and strings are treated\nas if they were docstrings.  In output, a key 'K' in 'M.test'\nappears with name 'M.test.K'.\n\nFor example, place this block of code at the top of 'example.py':\n\ntest = {\n'numbers': \"\"\"\n>>> factorial(6)\n720\n\n>>> [factorial(n) for n in range(6)]\n[1, 1, 2, 6, 24, 120]\n\"\"\"\n}\n\nThe value of 'example.test[\"numbers\"]' will be treated as a\ndocstring and all the tests inside it will be run.  It is important to\nnote that the value can be mapped to a function, class object, or\nmodule; if so, 'doctest' searches them recursively for docstrings, which\nare then scanned for tests.\n",
            "subsections": []
        },
        "Any classes found are recursively searched similarly, to test docstrings": {
            "content": "in their contained methods and nested classes.\n\nFile: python3.12.info,  Node: How are Docstring Examples Recognized?,  Next: What's the Execution Context?,  Prev: Which Docstrings Are Examined?,  Up: How It Works\n\n5.26.4.5 How are Docstring Examples Recognized?\n...............................................\n",
            "subsections": []
        },
        "In most cases a copy-and-paste of an interactive console session works": {
            "content": "fine, but doctest isn't trying to do an exact emulation of any specific\nPython shell.\n\n>>> # comments are ignored\n>>> x = 12\n>>> x\n12\n>>> if x == 13:\n...     print(\"yes\")\n... else:\n...     print(\"no\")\n...     print(\"NO\")\n...     print(\"NO!!!\")\n...\nno\nNO\nNO!!!\n>>>\n\nAny expected output must immediately follow the final ''>>> '' or ''...\n'' line containing the code, and the expected output (if any) extends to\nthe next ''>>> '' or all-whitespace line.\n\nThe fine print:\n\n* Expected output cannot contain an all-whitespace line, since such a\nline is taken to signal the end of expected output.  If expected\noutput does contain a blank line, put '<BLANKLINE>' in your doctest\nexample each place a blank line is expected.\n\n* All hard tab characters are expanded to spaces, using 8-column tab\nstops.  Tabs in output generated by the tested code are not\nmodified.  Because any hard tabs in the sample output 'are'\nexpanded, this means that if the code output includes hard tabs,\nthe only way the doctest can pass is if the *note\nNORMALIZEWHITESPACE: 3c64. option or *note directive: 3c65. is in\neffect.  Alternatively, the test can be rewritten to capture the\noutput and compare it to an expected value as part of the test.\nThis handling of tabs in the source was arrived at through trial\nand error, and has proven to be the least error prone way of\nhandling them.  It is possible to use a different algorithm for\nhandling tabs by writing a custom *note DocTestParser: 3c66. class.\n\n* Output to stdout is captured, but not output to stderr (exception\ntracebacks are captured via a different means).\n\n* If you continue a line via backslashing in an interactive session,\nor for any other reason use a backslash, you should use a raw\ndocstring, which will preserve your backslashes exactly as you type\nthem:\n\n>>> def f(x):\n...     r'''Backslashes in a raw docstring: m\\n'''\n...\n>>> print(f.doc)\nBackslashes in a raw docstring: m\\n\n\nOtherwise, the backslash will be interpreted as part of the string.\nFor example, the '\\n' above would be interpreted as a newline\ncharacter.  Alternatively, you can double each backslash in the\ndoctest version (and not use a raw string):\n\n>>> def f(x):\n...     '''Backslashes in a raw docstring: m\\\\n'''\n...\n>>> print(f.doc)\nBackslashes in a raw docstring: m\\n\n\n* The starting column doesn't matter:\n\n>>> assert \"Easy!\"\n>>> import math\n>>> math.floor(1.9)\n1\n\nand as many leading whitespace characters are stripped from the\nexpected output as appeared in the initial ''>>> '' line that\nstarted the example.\n\nFile: python3.12.info,  Node: What's the Execution Context?,  Next: What About Exceptions?,  Prev: How are Docstring Examples Recognized?,  Up: How It Works\n\n5.26.4.6 What's the Execution Context?\n......................................\n\nBy default, each time *note doctest: 36. finds a docstring to test, it\nuses a 'shallow copy' of 'M''s globals, so that running tests doesn't\nchange the module's real globals, and so that one test in 'M' can't\nleave behind crumbs that accidentally allow another test to work.  This\nmeans examples can freely use any names defined at top-level in 'M', and\nnames defined earlier in the docstring being run.  Examples cannot see\nnames defined in other docstrings.\n",
            "subsections": []
        },
        "You can force use of your own dict as the execution context by passing": {
            "content": "'globs=yourdict' to *note testmod(): 12c2. or *note testfile(): 3c5d.\ninstead.\n\nFile: python3.12.info,  Node: What About Exceptions?,  Next: Option Flags,  Prev: What's the Execution Context?,  Up: How It Works\n\n5.26.4.7 What About Exceptions?\n...............................\n",
            "subsections": []
        },
        "No problem, provided that the traceback is the only output produced by": {
            "content": "the example: just paste in the traceback.  (1)  Since tracebacks contain\ndetails that are likely to change rapidly (for example, exact file paths\nand line numbers), this is one case where doctest works hard to be\nflexible in what it accepts.\n\nSimple example:\n\n>>> [1, 2, 3].remove(42)\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nValueError: list.remove(x): x not in list\n\nThat doctest succeeds if *note ValueError: 183. is raised, with the\n'list.remove(x): x not in list' detail as shown.\n",
            "subsections": []
        },
        "The expected output for an exception must start with a traceback header,": {
            "content": "which may be either of the following two lines, indented the same as the\nfirst line of the example:\n\nTraceback (most recent call last):\nTraceback (innermost last):\n",
            "subsections": []
        },
        "The traceback header is followed by an optional traceback stack, whose": {
            "content": "contents are ignored by doctest.  The traceback stack is typically\nomitted, or copied verbatim from an interactive session.\n",
            "subsections": []
        },
        "The traceback stack is followed by the most interesting part: the": {
            "content": "line(s) containing the exception type and detail.  This is usually the\nlast line of a traceback, but can extend across multiple lines if the\nexception has a multi-line detail:\n\n>>> raise ValueError('multi\\n    line\\ndetail')\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nValueError: multi\nline\ndetail\n\nThe last three lines (starting with *note ValueError: 183.) are compared\nagainst the exception's type and detail, and the rest are ignored.\n",
            "subsections": []
        },
        "Best practice is to omit the traceback stack, unless it adds significant": {
            "content": "documentation value to the example.  So the last example is probably\nbetter as:\n\n>>> raise ValueError('multi\\n    line\\ndetail')\nTraceback (most recent call last):\n...\nValueError: multi\nline\ndetail\n",
            "subsections": []
        },
        "Note that tracebacks are treated very specially.  In particular, in the": {
            "content": "rewritten example, the use of '...' is independent of doctest's *note\nELLIPSIS: 12c3. option.  The ellipsis in that example could be left out,\nor could just as well be three (or three hundred) commas or digits, or\nan indented transcript of a Monty Python skit.\n\nSome details you should read once, but won't need to remember:\n\n* Doctest can't guess whether your expected output came from an\nexception traceback or from ordinary printing.  So, e.g., an\nexample that expects 'ValueError: 42 is prime' will pass whether\n*note ValueError: 183. is actually raised or if the example merely\nprints that traceback text.  In practice, ordinary output rarely\nbegins with a traceback header line, so this doesn't create real\nproblems.\n\n* Each line of the traceback stack (if present) must be indented\nfurther than the first line of the example, 'or' start with a\nnon-alphanumeric character.  The first line following the traceback\nheader indented the same and starting with an alphanumeric is taken\nto be the start of the exception detail.  Of course this does the\nright thing for genuine tracebacks.\n\n* When the *note IGNOREEXCEPTIONDETAIL: 117e. doctest option is\nspecified, everything following the leftmost colon and any module\ninformation in the exception name is ignored.\n\n* The interactive shell omits the traceback header line for some\n*note SyntaxError: 146.s.  But doctest uses the traceback header\nline to distinguish exceptions from non-exceptions.  So in the rare\ncase where you need to test a *note SyntaxError: 146. that omits\nthe traceback header, you will need to manually add the traceback\nheader line to your test example.\n\n* For some exceptions, Python displays the position of the error\nusing '^' markers and tildes:\n\n>>> 1 + None\nFile \"<stdin>\", line 1\n1 + None\n~~^~~~~~\nTypeError: unsupported operand type(s) for +: 'int' and 'NoneType'\n\nSince the lines showing the position of the error come before the\nexception type and detail, they are not checked by doctest.  For\nexample, the following test would pass, even though it puts the '^'\nmarker in the wrong location:\n\n>>> 1 + None\nFile \"<stdin>\", line 1\n1 + None\n^~~~~~~~\nTypeError: unsupported operand type(s) for +: 'int' and 'NoneType'\n\n---------- Footnotes ----------\n\n(1) Examples containing both expected output and an exception are not\nsupported.  Trying to guess where one ends and the other begins is too\nerror-prone, and that also makes for a confusing test.\n\nFile: python3.12.info,  Node: Option Flags,  Next: Directives,  Prev: What About Exceptions?,  Up: How It Works\n\n5.26.4.8 Option Flags\n.....................\n\nA number of option flags control various aspects of doctest's behavior.",
            "subsections": []
        },
        "Symbolic names for the flags are supplied as module constants, which can": {
            "content": "be *note bitwise ORed: 1d7b. together and passed to various functions.\nThe names can also be used in *note doctest directives: 3c65, and may be\npassed to the doctest command line interface via the '-o' option.\n\nNew in version 3.4: The '-o' command line option.\n",
            "subsections": []
        },
        "The first group of options define test semantics, controlling aspects of": {
            "content": "how doctest decides whether actual output matches an example's expected\noutput:\n\n-- Data: doctest.DONTACCEPTTRUEFOR1\n\nBy default, if an expected output block contains just '1', an\nactual output block containing just '1' or just 'True' is\nconsidered to be a match, and similarly for '0' versus 'False'.\nWhen *note DONTACCEPTTRUEFOR1: 3c6d. is specified, neither\nsubstitution is allowed.  The default behavior caters to that\nPython changed the return type of many functions from integer to\nboolean; doctests expecting \"little integer\" output still work in\nthese cases.  This option will probably go away, but not for\nseveral years.\n\n-- Data: doctest.DONTACCEPTBLANKLINE\n\nBy default, if an expected output block contains a line containing\nonly the string '<BLANKLINE>', then that line will match a blank\nline in the actual output.  Because a genuinely blank line delimits\nthe expected output, this is the only way to communicate that a\nblank line is expected.  When *note DONTACCEPTBLANKLINE: 3c6e. is\nspecified, this substitution is not allowed.\n\n-- Data: doctest.NORMALIZEWHITESPACE\n\nWhen specified, all sequences of whitespace (blanks and newlines)\nare treated as equal.  Any sequence of whitespace within the\nexpected output will match any sequence of whitespace within the\nactual output.  By default, whitespace must match exactly.  *note\nNORMALIZEWHITESPACE: 3c64. is especially useful when a line of\nexpected output is very long, and you want to wrap it across\nmultiple lines in your source.\n\n-- Data: doctest.ELLIPSIS\n\nWhen specified, an ellipsis marker ('...') in the expected output\ncan match any substring in the actual output.  This includes\nsubstrings that span line boundaries, and empty substrings, so it's\nbest to keep usage of this simple.  Complicated uses can lead to\nthe same kinds of \"oops, it matched too much!\" surprises that '.*'\nis prone to in regular expressions.\n\n-- Data: doctest.IGNOREEXCEPTIONDETAIL\n\nWhen specified, doctests expecting exceptions pass so long as an\nexception of the expected type is raised, even if the details\n(message and fully qualified exception name) don't match.\n\nFor example, an example expecting 'ValueError: 42' will pass if the\nactual exception raised is 'ValueError: 3*14', but will fail if,\nsay, a *note TypeError: 28e. is raised instead.  It will also\nignore any fully qualified name included before the exception\nclass, which can vary between implementations and versions of\nPython and the code/libraries in use.  Hence, all three of these\nvariations will work with the flag specified:\n\n>>> raise Exception('message')\nTraceback (most recent call last):\nException: message\n\n>>> raise Exception('message')\nTraceback (most recent call last):\nbuiltins.Exception: message\n\n>>> raise Exception('message')\nTraceback (most recent call last):\nmain.Exception: message\n\nNote that *note ELLIPSIS: 12c3. can also be used to ignore the\ndetails of the exception message, but such a test may still fail\nbased on whether the module name is present or matches exactly.\n\nChanged in version 3.2: *note IGNOREEXCEPTIONDETAIL: 117e. now\nalso ignores any information relating to the module containing the\nexception under test.\n\n-- Data: doctest.SKIP\n\nWhen specified, do not run the example at all.  This can be useful\nin contexts where doctest examples serve as both documentation and\ntest cases, and an example should be included for documentation\npurposes, but should not be checked.  E.g., the example's output\nmight be random; or the example might depend on resources which\nwould be unavailable to the test driver.\n\nThe SKIP flag can also be used for temporarily \"commenting out\"\nexamples.\n\n-- Data: doctest.COMPARISONFLAGS\n\nA bitmask or'ing together all the comparison flags above.\n\nThe second group of options controls how test failures are reported:\n\n-- Data: doctest.REPORTUDIFF\n\nWhen specified, failures that involve multi-line expected and\nactual outputs are displayed using a unified diff.\n\n-- Data: doctest.REPORTCDIFF\n\nWhen specified, failures that involve multi-line expected and\nactual outputs will be displayed using a context diff.\n\n-- Data: doctest.REPORTNDIFF\n\nWhen specified, differences are computed by 'difflib.Differ', using\nthe same algorithm as the popular 'ndiff.py' utility.  This is the\nonly method that marks differences within lines as well as across\nlines.  For example, if a line of expected output contains digit\n'1' where actual output contains letter 'l', a line is inserted\nwith a caret marking the mismatching column positions.\n\n-- Data: doctest.REPORTONLYFIRSTFAILURE\n\nWhen specified, display the first failing example in each doctest,\nbut suppress output for all remaining examples.  This will prevent\ndoctest from reporting correct examples that break because of\nearlier failures; but it might also hide incorrect examples that\nfail independently of the first failure.  When *note\nREPORTONLYFIRSTFAILURE: 3c71. is specified, the remaining\nexamples are still run, and still count towards the total number of\nfailures reported; only the output is suppressed.\n\n-- Data: doctest.FAILFAST\n\nWhen specified, exit after the first failing example and don't\nattempt to run the remaining examples.  Thus, the number of\nfailures reported will be at most 1.  This flag may be useful\nduring debugging, since examples after the first failure won't even\nproduce debugging output.\n\nThe doctest command line accepts the option '-f' as a shorthand for\n'-o FAILFAST'.\n\nNew in version 3.4.\n\n-- Data: doctest.REPORTINGFLAGS\n\nA bitmask or'ing together all the reporting flags above.\n",
            "subsections": []
        },
        "There is also a way to register new option flag names, though this isn't": {
            "content": "useful unless you intend to extend *note doctest: 36. internals via\nsubclassing:\n\n-- Function: doctest.registeroptionflag (name)\n\nCreate a new option flag with a given name, and return the new\nflag's integer value.  *note registeroptionflag(): 3c73. can be\nused when subclassing *note OutputChecker: 3c74. or *note\nDocTestRunner: 3c75. to create new options that are supported by\nyour subclasses.  *note registeroptionflag(): 3c73. should always\nbe called using the following idiom:\n\nMYFLAG = registeroptionflag('MYFLAG')\n\nFile: python3.12.info,  Node: Directives,  Next: Warnings<2>,  Prev: Option Flags,  Up: How It Works\n\n5.26.4.9 Directives\n...................\n\nDoctest directives may be used to modify the *note option flags: da3.\nfor an individual example.  Doctest directives are special Python\ncomments following an example's source code:\n\ndirective             ::= \"#\" \"doctest:\" directiveoptions\ndirectiveoptions     ::= directiveoption (\",\" directiveoption)*\ndirectiveoption      ::= onoroff directiveoptionname\nonoroff             ::= \"+\" | \"-\"\ndirectiveoptionname ::= \"DONTACCEPTBLANKLINE\" | \"NORMALIZEWHITESPACE\" | ...\n\nWhitespace is not allowed between the '+' or '-' and the directive\noption name.  The directive option name can be any of the option flag\nnames explained above.\n",
            "subsections": []
        },
        "An example's doctest directives modify doctest's behavior for that": {
            "content": "single example.  Use '+' to enable the named behavior, or '-' to disable\nit.\n\nFor example, this test passes:\n\n>>> print(list(range(20)))  # doctest: +NORMALIZEWHITESPACE\n[0,   1,  2,  3,  4,  5,  6,  7,  8,  9,\n10,  11, 12, 13, 14, 15, 16, 17, 18, 19]\n",
            "subsections": []
        },
        "Without the directive it would fail, both because the actual output": {
            "content": "doesn't have two blanks before the single-digit list elements, and\nbecause the actual output is on a single line.  This test also passes,\nand also requires a directive to do so:\n\n>>> print(list(range(20)))  # doctest: +ELLIPSIS\n[0, 1, ..., 18, 19]\n",
            "subsections": []
        },
        "Multiple directives can be used on a single physical line, separated by": {
            "content": "commas:\n\n>>> print(list(range(20)))  # doctest: +ELLIPSIS, +NORMALIZEWHITESPACE\n[0,    1, ...,   18,    19]\n",
            "subsections": []
        },
        "If multiple directive comments are used for a single example, then they": {
            "content": "are combined:\n\n>>> print(list(range(20)))  # doctest: +ELLIPSIS\n...                         # doctest: +NORMALIZEWHITESPACE\n[0,    1, ...,   18,    19]\n",
            "subsections": []
        },
        "As the previous example shows, you can add '...' lines to your example": {
            "content": "containing only directives.  This can be useful when an example is too\nlong for a directive to comfortably fit on the same line:\n\n>>> print(list(range(5)) + list(range(10, 20)) + list(range(30, 40)))\n... # doctest: +ELLIPSIS\n[0, ..., 4, 10, ..., 19, 30, ..., 39]\n",
            "subsections": []
        },
        "Note that since all options are disabled by default, and directives": {
            "content": "apply only to the example they appear in, enabling options (via '+' in a\ndirective) is usually the only meaningful choice.  However, option flags\ncan also be passed to functions that run doctests, establishing\ndifferent defaults.  In such cases, disabling an option via '-' in a\ndirective can be useful.\n\nFile: python3.12.info,  Node: Warnings<2>,  Prev: Directives,  Up: How It Works\n\n5.26.4.10 Warnings\n..................\n\n*note doctest: 36. is serious about requiring exact matches in expected\noutput.  If even a single character doesn't match, the test fails.  This\nwill probably surprise you a few times, as you learn exactly what Python\ndoes and doesn't guarantee about output.  For example, when printing a\nset, Python doesn't guarantee that the element is printed in any\nparticular order, so a test like\n\n>>> foo()\n{\"Hermione\", \"Harry\"}\n\nis vulnerable!  One workaround is to do\n\n>>> foo() == {\"Hermione\", \"Harry\"}\nTrue\n\ninstead.  Another is to do\n\n>>> d = sorted(foo())\n>>> d\n['Harry', 'Hermione']\n\nThere are others, but you get the idea.\n",
            "subsections": []
        },
        "Another bad idea is to print things that embed an object address, like": {
            "content": ">>> id(1.0)  # certain to fail some of the time\n7948648\n>>> class C: pass\n>>> C()  # the default repr() for instances embeds an address\n<C object at 0x00AC18F0>\n\nThe *note ELLIPSIS: 12c3. directive gives a nice approach for the last\nexample:\n\n>>> C()  # doctest: +ELLIPSIS\n<C object at 0x...>\n",
            "subsections": []
        },
        "Floating-point numbers are also subject to small output variations": {
            "content": "across platforms, because Python defers to the platform C library for\nfloat formatting, and C libraries vary widely in quality here.\n\n>>> 1./7  # risky\n0.14285714285714285\n>>> print(1./7) # safer\n0.142857142857\n>>> print(round(1./7, 6)) # much safer\n0.142857\n",
            "subsections": []
        },
        "Numbers of the form 'I/2.J' are safe across all platforms, and I often": {
            "content": "contrive doctest examples to produce numbers of that form:\n\n>>> 3./4  # utterly safe\n0.75\n",
            "subsections": []
        },
        "Simple fractions are also easier for people to understand, and that": {
            "content": "makes for better documentation.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Basic API,  Next: Unittest API,  Prev: How It Works,  Up: doctest -- Test interactive Python examples": {
            "content": "5.26.4.11 Basic API\n...................\n\nThe functions *note testmod(): 12c2. and *note testfile(): 3c5d. provide\na simple interface to doctest that should be sufficient for most basic\nuses.  For a less formal introduction to these two functions, see\nsections *note Simple Usage; Checking Examples in Docstrings: 3c58. and\n*note Simple Usage; Checking Examples in a Text File: 3c5b.\n\n-- Function: doctest.testfile (filename, modulerelative=True,\nname=None, package=None, globs=None, verbose=None,\nreport=True, optionflags=0, extraglobs=None,\nraiseonerror=False, parser=DocTestParser(), encoding=None)\n\nAll arguments except 'filename' are optional, and should be\nspecified in keyword form.\n\nTest examples in the file named 'filename'.  Return\n'(failurecount, testcount)'.\n\nOptional argument 'modulerelative' specifies how the filename\nshould be interpreted:\n\n* If 'modulerelative' is 'True' (the default), then 'filename'\nspecifies an OS-independent module-relative path.  By default,\nthis path is relative to the calling module's directory; but\nif the 'package' argument is specified, then it is relative to\nthat package.  To ensure OS-independence, 'filename' should\nuse '/' characters to separate path segments, and may not be\nan absolute path (i.e., it may not begin with '/').\n\n* If 'modulerelative' is 'False', then 'filename' specifies an\nOS-specific path.  The path may be absolute or relative;\nrelative paths are resolved with respect to the current\nworking directory.\n\nOptional argument 'name' gives the name of the test; by default, or\nif 'None', 'os.path.basename(filename)' is used.\n\nOptional argument 'package' is a Python package or the name of a\nPython package whose directory should be used as the base directory\nfor a module-relative filename.  If no package is specified, then\nthe calling module's directory is used as the base directory for\nmodule-relative filenames.  It is an error to specify 'package' if\n'modulerelative' is 'False'.\n\nOptional argument 'globs' gives a dict to be used as the globals\nwhen executing examples.  A new shallow copy of this dict is\ncreated for the doctest, so its examples start with a clean slate.\nBy default, or if 'None', a new empty dict is used.\n\nOptional argument 'extraglobs' gives a dict merged into the globals\nused to execute examples.  This works like *note dict.update():\n12ba.: if 'globs' and 'extraglobs' have a common key, the\nassociated value in 'extraglobs' appears in the combined dict.  By\ndefault, or if 'None', no extra globals are used.  This is an\nadvanced feature that allows parameterization of doctests.  For\nexample, a doctest can be written for a base class, using a generic\nname for the class, then reused to test any number of subclasses by\npassing an 'extraglobs' dict mapping the generic name to the\nsubclass to be tested.\n\nOptional argument 'verbose' prints lots of stuff if true, and\nprints only failures if false; by default, or if 'None', it's true\nif and only if ''-v'' is in 'sys.argv'.\n\nOptional argument 'report' prints a summary at the end when true,\nelse prints nothing at the end.  In verbose mode, the summary is\ndetailed, else the summary is very brief (in fact, empty if all\ntests passed).\n\nOptional argument 'optionflags' (default value 0) takes the *note\nbitwise OR: 1d7b. of option flags.  See section *note Option Flags:\nda3.\n\nOptional argument 'raiseonerror' defaults to false.  If true, an\nexception is raised upon the first failure or unexpected exception\nin an example.  This allows failures to be post-mortem debugged.\nDefault behavior is to continue running examples.\n\nOptional argument 'parser' specifies a *note DocTestParser: 3c66.\n(or subclass) that should be used to extract tests from the files.\nIt defaults to a normal parser (i.e., 'DocTestParser()').\n\nOptional argument 'encoding' specifies an encoding that should be\nused to convert the file to unicode.\n\n-- Function: doctest.testmod (m=None, name=None, globs=None,\nverbose=None, report=True, optionflags=0, extraglobs=None,\nraiseonerror=False, excludeempty=False)\n\nAll arguments are optional, and all except for 'm' should be\nspecified in keyword form.\n\nTest examples in docstrings in functions and classes reachable from\nmodule 'm' (or module *note main: 1. if 'm' is not supplied or\nis 'None'), starting with 'm.doc'.\n\nAlso test examples reachable from dict 'm.test', if it exists.\n'm.test' maps names (strings) to functions, classes and\nstrings; function and class docstrings are searched for examples;\nstrings are searched directly, as if they were docstrings.\n\nOnly docstrings attached to objects belonging to module 'm' are\nsearched.\n\nReturn '(failurecount, testcount)'.\n\nOptional argument 'name' gives the name of the module; by default,\nor if 'None', 'm.name' is used.\n\nOptional argument 'excludeempty' defaults to false.  If true,\nobjects for which no doctests are found are excluded from\nconsideration.  The default is a backward compatibility hack, so\nthat code still using *note doctest.master.summarize: 3c7f. in\nconjunction with *note testmod(): 12c2. continues to get output for\nobjects with no tests.  The 'excludeempty' argument to the newer\n*note DocTestFinder: 3c80. constructor defaults to true.\n\nOptional arguments 'extraglobs', 'verbose', 'report',\n'optionflags', 'raiseonerror', and 'globs' are the same as for\nfunction *note testfile(): 3c5d. above, except that 'globs'\ndefaults to 'm.dict'.\n\n-- Function: doctest.rundocstringexamples (f, globs, verbose=False,\nname='NoName', compileflags=None, optionflags=0)\n\nTest examples associated with object 'f'; for example, 'f' may be a\nstring, a module, a function, or a class object.\n\nA shallow copy of dictionary argument 'globs' is used for the\nexecution context.\n\nOptional argument 'name' is used in failure messages, and defaults\nto '\"NoName\"'.\n\nIf optional argument 'verbose' is true, output is generated even if\nthere are no failures.  By default, output is generated only in\ncase of an example failure.\n\nOptional argument 'compileflags' gives the set of flags that should\nbe used by the Python compiler when running the examples.  By\ndefault, or if 'None', flags are deduced corresponding to the set\nof future features found in 'globs'.\n\nOptional argument 'optionflags' works as for function *note\ntestfile(): 3c5d. above.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Unittest API,  Next: Advanced API,  Prev: Basic API,  Up: doctest -- Test interactive Python examples": {
            "content": "5.26.4.12 Unittest API\n......................\n",
            "subsections": []
        },
        "As your collection of doctest'ed modules grows, you'll want a way to run": {
            "content": "all their doctests systematically.  *note doctest: 36. provides two\nfunctions that can be used to create *note unittest: 101. test suites\nfrom modules and text files containing doctests.  To integrate with\n*note unittest: 101. test discovery, include a *note loadtests: 3c84.\nfunction in your test module:\n\nimport unittest\nimport doctest\nimport mymodulewithdoctests\n\ndef loadtests(loader, tests, ignore):\ntests.addTests(doctest.DocTestSuite(mymodulewithdoctests))\nreturn tests\n\nThere are two main functions for creating *note unittest.TestSuite: c51.\ninstances from text files and modules with doctests:\n\n-- Function: doctest.DocFileSuite (*paths, modulerelative=True,\npackage=None, setUp=None, tearDown=None, globs=None,\noptionflags=0, parser=DocTestParser(), encoding=None)\n\nConvert doctest tests from one or more text files to a *note\nunittest.TestSuite: c51.\n\nThe returned *note unittest.TestSuite: c51. is to be run by the\nunittest framework and runs the interactive examples in each file.\nIf an example in any file fails, then the synthesized unit test\nfails, and a *note failureException: 3c86. exception is raised\nshowing the name of the file containing the test and a (sometimes\napproximate) line number.\n\nPass one or more paths (as strings) to text files to be examined.\n\nOptions may be provided as keyword arguments:\n\nOptional argument 'modulerelative' specifies how the filenames in\n'paths' should be interpreted:\n\n* If 'modulerelative' is 'True' (the default), then each\nfilename in 'paths' specifies an OS-independent\nmodule-relative path.  By default, this path is relative to\nthe calling module's directory; but if the 'package' argument\nis specified, then it is relative to that package.  To ensure\nOS-independence, each filename should use '/' characters to\nseparate path segments, and may not be an absolute path (i.e.,\nit may not begin with '/').\n\n* If 'modulerelative' is 'False', then each filename in 'paths'\nspecifies an OS-specific path.  The path may be absolute or\nrelative; relative paths are resolved with respect to the\ncurrent working directory.\n\nOptional argument 'package' is a Python package or the name of a\nPython package whose directory should be used as the base directory\nfor module-relative filenames in 'paths'.  If no package is\nspecified, then the calling module's directory is used as the base\ndirectory for module-relative filenames.  It is an error to specify\n'package' if 'modulerelative' is 'False'.\n\nOptional argument 'setUp' specifies a set-up function for the test\nsuite.  This is called before running the tests in each file.  The\n'setUp' function will be passed a *note DocTest: 13e8. object.  The\nsetUp function can access the test globals as the 'globs' attribute\nof the test passed.\n\nOptional argument 'tearDown' specifies a tear-down function for the\ntest suite.  This is called after running the tests in each file.\nThe 'tearDown' function will be passed a *note DocTest: 13e8.\nobject.  The setUp function can access the test globals as the\n'globs' attribute of the test passed.\n\nOptional argument 'globs' is a dictionary containing the initial\nglobal variables for the tests.  A new copy of this dictionary is\ncreated for each test.  By default, 'globs' is a new empty\ndictionary.\n\nOptional argument 'optionflags' specifies the default doctest\noptions for the tests, created by or-ing together individual option\nflags.  See section *note Option Flags: da3.  See function *note\nsetunittestreportflags(): 3c87. below for a better way to set\nreporting options.\n\nOptional argument 'parser' specifies a *note DocTestParser: 3c66.\n(or subclass) that should be used to extract tests from the files.\nIt defaults to a normal parser (i.e., 'DocTestParser()').\n\nOptional argument 'encoding' specifies an encoding that should be\nused to convert the file to unicode.\n\nThe global 'file' is added to the globals provided to doctests\nloaded from a text file using *note DocFileSuite(): 3c85.\n\n-- Function: doctest.DocTestSuite (module=None, globs=None,\nextraglobs=None, testfinder=None, setUp=None, tearDown=None,\noptionflags=0, checker=None)\n\nConvert doctest tests for a module to a *note unittest.TestSuite:\nc51.\n\nThe returned *note unittest.TestSuite: c51. is to be run by the\nunittest framework and runs each doctest in the module.  If any of\nthe doctests fail, then the synthesized unit test fails, and a\n*note failureException: 3c86. exception is raised showing the name\nof the file containing the test and a (sometimes approximate) line\nnumber.\n\nOptional argument 'module' provides the module to be tested.  It\ncan be a module object or a (possibly dotted) module name.  If not\nspecified, the module calling this function is used.\n\nOptional argument 'globs' is a dictionary containing the initial\nglobal variables for the tests.  A new copy of this dictionary is\ncreated for each test.  By default, 'globs' is a new empty\ndictionary.\n\nOptional argument 'extraglobs' specifies an extra set of global\nvariables, which is merged into 'globs'.  By default, no extra\nglobals are used.\n\nOptional argument 'testfinder' is the *note DocTestFinder: 3c80.\nobject (or a drop-in replacement) that is used to extract doctests\nfrom the module.\n\nOptional arguments 'setUp', 'tearDown', and 'optionflags' are the\nsame as for function *note DocFileSuite(): 3c85. above.\n\nThis function uses the same search technique as *note testmod():\n12c2.\n\nChanged in version 3.5: *note DocTestSuite(): c50. returns an empty\n*note unittest.TestSuite: c51. if 'module' contains no docstrings\ninstead of raising *note ValueError: 183.\n\n-- Exception: doctest.failureException\n\nWhen doctests which have been converted to unit tests by *note\nDocFileSuite(): 3c85. or *note DocTestSuite(): c50. fail, this\nexception is raised showing the name of the file containing the\ntest and a (sometimes approximate) line number.\n\nUnder the covers, *note DocTestSuite(): c50. creates a *note\nunittest.TestSuite: c51. out of 'doctest.DocTestCase' instances, and\n'DocTestCase' is a subclass of *note unittest.TestCase: 159.\n'DocTestCase' isn't documented here (it's an internal detail), but\nstudying its code can answer questions about the exact details of *note\nunittest: 101. integration.\n\nSimilarly, *note DocFileSuite(): 3c85. creates a *note\nunittest.TestSuite: c51. out of 'doctest.DocFileCase' instances, and\n'DocFileCase' is a subclass of 'DocTestCase'.\n\nSo both ways of creating a *note unittest.TestSuite: c51. run instances\nof 'DocTestCase'.  This is important for a subtle reason: when you run\n*note doctest: 36. functions yourself, you can control the *note\ndoctest: 36. options in use directly, by passing option flags to *note\ndoctest: 36. functions.  However, if you're writing a *note unittest:\n101. framework, *note unittest: 101. ultimately controls when and how\ntests get run.  The framework author typically wants to control *note\ndoctest: 36. reporting options (perhaps, e.g., specified by command line\noptions), but there's no way to pass options through *note unittest:\n101. to *note doctest: 36. test runners.\n\nFor this reason, *note doctest: 36. also supports a notion of *note\ndoctest: 36. reporting flags specific to *note unittest: 101. support,\nvia this function:\n\n-- Function: doctest.setunittestreportflags (flags)\n\nSet the *note doctest: 36. reporting flags to use.\n\nArgument 'flags' takes the *note bitwise OR: 1d7b. of option flags.\nSee section *note Option Flags: da3.  Only \"reporting flags\" can be\nused.\n\nThis is a module-global setting, and affects all future doctests\nrun by module *note unittest: 101.: the 'runTest()' method of\n'DocTestCase' looks at the option flags specified for the test case\nwhen the 'DocTestCase' instance was constructed.  If no reporting\nflags were specified (which is the typical and expected case),\n'doctest''s *note unittest: 101. reporting flags are *note bitwise\nORed: 1d7b. into the option flags, and the option flags so\naugmented are passed to the *note DocTestRunner: 3c75. instance\ncreated to run the doctest.  If any reporting flags were specified\nwhen the 'DocTestCase' instance was constructed, 'doctest''s *note\nunittest: 101. reporting flags are ignored.\n\nThe value of the *note unittest: 101. reporting flags in effect\nbefore the function was called is returned by the function.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Advanced API,  Next: Debugging,  Prev: Unittest API,  Up: doctest -- Test interactive Python examples": {
            "content": "5.26.4.13 Advanced API\n......................\n",
            "subsections": []
        },
        "The basic API is a simple wrapper that's intended to make doctest easy": {
            "content": "to use.  It is fairly flexible, and should meet most users' needs;\nhowever, if you require more fine-grained control over testing, or wish\nto extend doctest's capabilities, then you should use the advanced API.\n",
            "subsections": []
        },
        "The advanced API revolves around two container classes, which are used": {
            "content": "to store the interactive examples extracted from doctest cases:\n\n* *note Example: 3c8a.: A single Python *note statement: 247d, paired\nwith its expected output.\n\n* *note DocTest: 13e8.: A collection of *note Example: 3c8a.s,\ntypically extracted from a single docstring or text file.\n",
            "subsections": []
        },
        "Additional processing classes are defined to find, parse, and run, and": {
            "content": "check doctest examples:\n\n* *note DocTestFinder: 3c80.: Finds all docstrings in a given module,\nand uses a *note DocTestParser: 3c66. to create a *note DocTest:\n13e8. from every docstring that contains interactive examples.\n\n* *note DocTestParser: 3c66.: Creates a *note DocTest: 13e8. object\nfrom a string (such as an object's docstring).\n\n* *note DocTestRunner: 3c75.: Executes the examples in a *note\nDocTest: 13e8, and uses an *note OutputChecker: 3c74. to verify\ntheir output.\n\n* *note OutputChecker: 3c74.: Compares the actual output from a\ndoctest example with the expected output, and decides whether they\nmatch.\n",
            "subsections": []
        },
        "The relationships among these processing classes are summarized in the": {
            "content": "following diagram:\n\nlist of:\n+------+                   +---------+\n|module| --DocTestFinder-> | DocTest | --DocTestRunner-> results\n+------+    |        ^     +---------+     |       ^    (printed)\n|        |     | Example |     |       |\nv        |     |   ...   |     v       |\nDocTestParser   | Example |   OutputChecker\n+---------+\n\n* Menu:\n\n* DocTest Objects::\n* Example Objects::\n* DocTestFinder objects::\n* DocTestParser objects::\n* DocTestRunner objects::\n* OutputChecker objects::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: DocTest Objects,  Next: Example Objects,  Up: Advanced API": {
            "content": "5.26.4.14 DocTest Objects\n.........................\n\n-- Class: doctest.DocTest (examples, globs, name, filename, lineno,\ndocstring)\n\nA collection of doctest examples that should be run in a single\nnamespace.  The constructor arguments are used to initialize the\nattributes of the same names.\n\n*note DocTest: 13e8. defines the following attributes.  They are\ninitialized by the constructor, and should not be modified\ndirectly.\n\n-- Attribute: examples\n\nA list of *note Example: 3c8a. objects encoding the individual\ninteractive Python examples that should be run by this test.\n\n-- Attribute: globs\n\nThe namespace (aka globals) that the examples should be run\nin.  This is a dictionary mapping names to values.  Any\nchanges to the namespace made by the examples (such as binding\nnew variables) will be reflected in *note globs: 3c8e. after\nthe test is run.\n\n-- Attribute: name\n\nA string name identifying the *note DocTest: 13e8.  Typically,\nthis is the name of the object or file that the test was\nextracted from.\n\n-- Attribute: filename\n\nThe name of the file that this *note DocTest: 13e8. was\nextracted from; or 'None' if the filename is unknown, or if\nthe *note DocTest: 13e8. was not extracted from a file.\n\n-- Attribute: lineno\n\nThe line number within *note filename: 3c90. where this *note\nDocTest: 13e8. begins, or 'None' if the line number is\nunavailable.  This line number is zero-based with respect to\nthe beginning of the file.\n\n-- Attribute: docstring\n\nThe string that the test was extracted from, or 'None' if the\nstring is unavailable, or if the test was not extracted from a\nstring.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Example Objects,  Next: DocTestFinder objects,  Prev: DocTest Objects,  Up: Advanced API": {
            "content": "5.26.4.15 Example Objects\n.........................\n\n-- Class: doctest.Example (source, want, excmsg=None, lineno=0,\nindent=0, options=None)\n\nA single interactive example, consisting of a Python statement and\nits expected output.  The constructor arguments are used to\ninitialize the attributes of the same names.\n\n*note Example: 3c8a. defines the following attributes.  They are\ninitialized by the constructor, and should not be modified\ndirectly.\n\n-- Attribute: source\n\nA string containing the example's source code.  This source\ncode consists of a single Python statement, and always ends\nwith a newline; the constructor adds a newline when necessary.\n\n-- Attribute: want\n\nThe expected output from running the example's source code\n(either from stdout, or a traceback in case of exception).\n*note want: 3c95. ends with a newline unless no output is\nexpected, in which case it's an empty string.  The constructor\nadds a newline when necessary.\n\n-- Attribute: excmsg\n\nThe exception message generated by the example, if the example\nis expected to generate an exception; or 'None' if it is not\nexpected to generate an exception.  This exception message is\ncompared against the return value of *note\ntraceback.formatexceptiononly(): 644.  *note excmsg: 3c96.\nends with a newline unless it's 'None'.  The constructor adds\na newline if needed.\n\n-- Attribute: lineno\n\nThe line number within the string containing this example\nwhere the example begins.  This line number is zero-based with\nrespect to the beginning of the containing string.\n\n-- Attribute: indent\n\nThe example's indentation in the containing string, i.e., the\nnumber of space characters that precede the example's first\nprompt.\n\n-- Attribute: options\n\nA dictionary mapping from option flags to 'True' or 'False',\nwhich is used to override default options for this example.\nAny option flags not contained in this dictionary are left at\ntheir default value (as specified by the *note DocTestRunner:\n3c75.'s *note optionflags: da3.).  By default, no options are\nset.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: DocTestFinder objects,  Next: DocTestParser objects,  Prev: Example Objects,  Up: Advanced API": {
            "content": "5.26.4.16 DocTestFinder objects\n...............................\n\n-- Class: doctest.DocTestFinder (verbose=False, parser=DocTestParser(),\nrecurse=True, excludeempty=True)\n\nA processing class used to extract the *note DocTest: 13e8.s that\nare relevant to a given object, from its docstring and the\ndocstrings of its contained objects.  *note DocTest: 13e8.s can be\nextracted from modules, classes, functions, methods, staticmethods,\nclassmethods, and properties.\n\nThe optional argument 'verbose' can be used to display the objects\nsearched by the finder.  It defaults to 'False' (no output).\n\nThe optional argument 'parser' specifies the *note DocTestParser:\n3c66. object (or a drop-in replacement) that is used to extract\ndoctests from docstrings.\n\nIf the optional argument 'recurse' is false, then *note\nDocTestFinder.find(): 1418. will only examine the given object, and\nnot any contained objects.\n\nIf the optional argument 'excludeempty' is false, then *note\nDocTestFinder.find(): 1418. will include tests for objects with\nempty docstrings.\n\n*note DocTestFinder: 3c80. defines the following method:\n\n-- Method: find (obj[, name][, module][, globs][, extraglobs])\n\nReturn a list of the *note DocTest: 13e8.s that are defined by\n'obj''s docstring, or by any of its contained objects'\ndocstrings.\n\nThe optional argument 'name' specifies the object's name; this\nname will be used to construct names for the returned *note\nDocTest: 13e8.s.  If 'name' is not specified, then\n'obj.name' is used.\n\nThe optional parameter 'module' is the module that contains\nthe given object.  If the module is not specified or is\n'None', then the test finder will attempt to automatically\ndetermine the correct module.  The object's module is used:\n\n* As a default namespace, if 'globs' is not specified.\n\n* To prevent the DocTestFinder from extracting DocTests\nfrom objects that are imported from other modules.\n(Contained objects with modules other than 'module' are\nignored.)\n\n* To find the name of the file containing the object.\n\n* To help find the line number of the object within its\nfile.\n\nIf 'module' is 'False', no attempt to find the module will be\nmade.  This is obscure, of use mostly in testing doctest\nitself: if 'module' is 'False', or is 'None' but cannot be\nfound automatically, then all objects are considered to belong\nto the (non-existent) module, so all contained objects will\n(recursively) be searched for doctests.\n\nThe globals for each *note DocTest: 13e8. is formed by\ncombining 'globs' and 'extraglobs' (bindings in 'extraglobs'\noverride bindings in 'globs').  A new shallow copy of the\nglobals dictionary is created for each *note DocTest: 13e8.\nIf 'globs' is not specified, then it defaults to the module's\n'dict', if specified, or '{}' otherwise.  If 'extraglobs'\nis not specified, then it defaults to '{}'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: DocTestParser objects,  Next: DocTestRunner objects,  Prev: DocTestFinder objects,  Up: Advanced API": {
            "content": "5.26.4.17 DocTestParser objects\n...............................\n\n-- Class: doctest.DocTestParser\n\nA processing class used to extract interactive examples from a\nstring, and use them to create a *note DocTest: 13e8. object.\n\n*note DocTestParser: 3c66. defines the following methods:\n\n-- Method: getdoctest (string, globs, name, filename, lineno)\n\nExtract all doctest examples from the given string, and\ncollect them into a *note DocTest: 13e8. object.\n\n'globs', 'name', 'filename', and 'lineno' are attributes for\nthe new *note DocTest: 13e8. object.  See the documentation\nfor *note DocTest: 13e8. for more information.\n\n-- Method: getexamples (string, name='<string>')\n\nExtract all doctest examples from the given string, and return\nthem as a list of *note Example: 3c8a. objects.  Line numbers\nare 0-based.  The optional argument 'name' is a name\nidentifying this string, and is only used for error messages.\n\n-- Method: parse (string, name='<string>')\n\nDivide the given string into examples and intervening text,\nand return them as a list of alternating *note Example: 3c8a.s\nand strings.  Line numbers for the *note Example: 3c8a.s are\n0-based.  The optional argument 'name' is a name identifying\nthis string, and is only used for error messages.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: DocTestRunner objects,  Next: OutputChecker objects,  Prev: DocTestParser objects,  Up: Advanced API": {
            "content": "5.26.4.18 DocTestRunner objects\n...............................\n\n-- Class: doctest.DocTestRunner (checker=None, verbose=None,\noptionflags=0)\n\nA processing class used to execute and verify the interactive\nexamples in a *note DocTest: 13e8.\n\nThe comparison between expected outputs and actual outputs is done\nby an *note OutputChecker: 3c74.  This comparison may be customized\nwith a number of option flags; see section *note Option Flags: da3.\nfor more information.  If the option flags are insufficient, then\nthe comparison may also be customized by passing a subclass of\n*note OutputChecker: 3c74. to the constructor.\n\nThe test runner's display output can be controlled in two ways.\nFirst, an output function can be passed to *note run(): 3ca3.; this\nfunction will be called with strings that should be displayed.  It\ndefaults to 'sys.stdout.write'.  If capturing the output is not\nsufficient, then the display output can be also customized by\nsubclassing DocTestRunner, and overriding the methods *note\nreportstart(): 3ca4, *note reportsuccess(): 3ca5, *note\nreportunexpectedexception(): 3ca6, and *note reportfailure():\n3ca7.\n\nThe optional keyword argument 'checker' specifies the *note\nOutputChecker: 3c74. object (or drop-in replacement) that should be\nused to compare the expected outputs to the actual outputs of\ndoctest examples.\n\nThe optional keyword argument 'verbose' controls the *note\nDocTestRunner: 3c75.'s verbosity.  If 'verbose' is 'True', then\ninformation is printed about each example, as it is run.  If\n'verbose' is 'False', then only failures are printed.  If 'verbose'\nis unspecified, or 'None', then verbose output is used iff the\ncommand-line switch '-v' is used.\n\nThe optional keyword argument 'optionflags' can be used to control\nhow the test runner compares expected output to actual output, and\nhow it displays failures.  For more information, see section *note\nOption Flags: da3.\n\n*note DocTestRunner: 3c75. defines the following methods:\n\n-- Method: reportstart (out, test, example)\n\nReport that the test runner is about to process the given\nexample.  This method is provided to allow subclasses of *note\nDocTestRunner: 3c75. to customize their output; it should not\nbe called directly.\n\n'example' is the example about to be processed.  'test' is the\ntest 'containing example'.  'out' is the output function that\nwas passed to *note DocTestRunner.run(): 3ca3.\n\n-- Method: reportsuccess (out, test, example, got)\n\nReport that the given example ran successfully.  This method\nis provided to allow subclasses of *note DocTestRunner: 3c75.\nto customize their output; it should not be called directly.\n\n'example' is the example about to be processed.  'got' is the\nactual output from the example.  'test' is the test containing\n'example'.  'out' is the output function that was passed to\n*note DocTestRunner.run(): 3ca3.\n\n-- Method: reportfailure (out, test, example, got)\n\nReport that the given example failed.  This method is provided\nto allow subclasses of *note DocTestRunner: 3c75. to customize\ntheir output; it should not be called directly.\n\n'example' is the example about to be processed.  'got' is the\nactual output from the example.  'test' is the test containing\n'example'.  'out' is the output function that was passed to\n*note DocTestRunner.run(): 3ca3.\n\n-- Method: reportunexpectedexception (out, test, example,\nexcinfo)\n\nReport that the given example raised an unexpected exception.\nThis method is provided to allow subclasses of *note\nDocTestRunner: 3c75. to customize their output; it should not\nbe called directly.\n\n'example' is the example about to be processed.  'excinfo' is\na tuple containing information about the unexpected exception\n(as returned by *note sys.excinfo(): 456.).  'test' is the\ntest containing 'example'.  'out' is the output function that\nwas passed to *note DocTestRunner.run(): 3ca3.\n\n-- Method: run (test, compileflags=None, out=None,\nclearglobs=True)\n\nRun the examples in 'test' (a *note DocTest: 13e8. object),\nand display the results using the writer function 'out'.\n\nThe examples are run in the namespace 'test.globs'.  If\n'clearglobs' is true (the default), then this namespace will\nbe cleared after the test runs, to help with garbage\ncollection.  If you would like to examine the namespace after\nthe test completes, then use 'clearglobs=False'.\n\n'compileflags' gives the set of flags that should be used by\nthe Python compiler when running the examples.  If not\nspecified, then it will default to the set of future-import\nflags that apply to 'globs'.\n\nThe output of each example is checked using the *note\nDocTestRunner: 3c75.'s output checker, and the results are\nformatted by the 'DocTestRunner.report*()' methods.\n\n-- Method: summarize (verbose=None)\n\nPrint a summary of all the test cases that have been run by\nthis DocTestRunner, and return a *note named tuple: 417.\n'TestResults(failed, attempted)'.\n\nThe optional 'verbose' argument controls how detailed the\nsummary is.  If the verbosity is not specified, then the *note\nDocTestRunner: 3c75.'s verbosity is used.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: OutputChecker objects,  Prev: DocTestRunner objects,  Up: Advanced API": {
            "content": "5.26.4.19 OutputChecker objects\n...............................\n\n-- Class: doctest.OutputChecker\n\nA class used to check the whether the actual output from a doctest\nexample matches the expected output.  *note OutputChecker: 3c74.\ndefines two methods: *note checkoutput(): 3caa, which compares a\ngiven pair of outputs, and returns 'True' if they match; and *note\noutputdifference(): 3cab, which returns a string describing the\ndifferences between two outputs.\n\n*note OutputChecker: 3c74. defines the following methods:\n\n-- Method: checkoutput (want, got, optionflags)\n\nReturn 'True' iff the actual output from an example ('got')\nmatches the expected output ('want').  These strings are\nalways considered to match if they are identical; but\ndepending on what option flags the test runner is using,\nseveral non-exact match types are also possible.  See section\n*note Option Flags: da3. for more information about option\nflags.\n\n-- Method: outputdifference (example, got, optionflags)\n\nReturn a string describing the differences between the\nexpected output for a given example ('example') and the actual\noutput ('got').  'optionflags' is the set of option flags used\nto compare 'want' and 'got'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Debugging,  Next: Soapbox,  Prev: Advanced API,  Up: doctest -- Test interactive Python examples": {
            "content": "5.26.4.20 Debugging\n...................\n\nDoctest provides several mechanisms for debugging doctest examples:\n\n* Several functions convert doctests to executable Python programs,\nwhich can be run under the Python debugger, *note pdb: a0.\n\n* The *note DebugRunner: 3cae. class is a subclass of *note\nDocTestRunner: 3c75. that raises an exception for the first failing\nexample, containing information about that example.  This\ninformation can be used to perform post-mortem debugging on the\nexample.\n\n* The *note unittest: 101. cases generated by *note DocTestSuite():\nc50. support the *note debug(): 3caf. method defined by *note\nunittest.TestCase: 159.\n\n* You can add a call to *note pdb.settrace(): 9a6. in a doctest\nexample, and you'll drop into the Python debugger when that line is\nexecuted.  Then you can inspect current values of variables, and so\non.  For example, suppose 'a.py' contains just this module\ndocstring:\n\n\"\"\"\n>>> def f(x):\n...     g(x*2)\n>>> def g(x):\n...     print(x+3)\n...     import pdb; pdb.settrace()\n>>> f(3)\n9\n\"\"\"\n\nThen an interactive Python session may look like this:\n\n>>> import a, doctest\n>>> doctest.testmod(a)\n--Return--\n> <doctest a[1]>(3)g()->None\n-> import pdb; pdb.settrace()\n(Pdb) list\n1     def g(x):\n2         print(x+3)\n3  ->     import pdb; pdb.settrace()\n[EOF]\n(Pdb) p x\n6\n(Pdb) step\n--Return--\n> <doctest a[0]>(2)f()->None\n-> g(x*2)\n(Pdb) list\n1     def f(x):\n2  ->     g(x*2)\n[EOF]\n(Pdb) p x\n3\n(Pdb) step\n--Return--\n> <doctest a[2]>(1)?()->None\n-> f(3)\n(Pdb) cont\n(0, 3)\n>>>\n",
            "subsections": []
        },
        "Functions that convert doctests to Python code, and possibly run the": {
            "content": "synthesized code under the debugger:\n\n-- Function: doctest.scriptfromexamples (s)\n\nConvert text with examples to a script.\n\nArgument 's' is a string containing doctest examples.  The string\nis converted to a Python script, where doctest examples in 's' are\nconverted to regular code, and everything else is converted to\nPython comments.  The generated script is returned as a string.\nFor example,\n\nimport doctest\nprint(doctest.scriptfromexamples(r\"\"\"\nSet x and y to 1 and 2.\n>>> x, y = 1, 2\n\nPrint their sum:\n>>> print(x+y)\n3\n\"\"\"))\n\ndisplays:\n\n# Set x and y to 1 and 2.\nx, y = 1, 2\n#\n# Print their sum:\nprint(x+y)\n# Expected:\n## 3\n\nThis function is used internally by other functions (see below),\nbut can also be useful when you want to transform an interactive\nPython session into a Python script.\n\n-- Function: doctest.testsource (module, name)\n\nConvert the doctest for an object to a script.\n\nArgument 'module' is a module object, or dotted name of a module,\ncontaining the object whose doctests are of interest.  Argument\n'name' is the name (within the module) of the object with the\ndoctests of interest.  The result is a string, containing the\nobject's docstring converted to a Python script, as described for\n*note scriptfromexamples(): 3cb0. above.  For example, if module\n'a.py' contains a top-level function 'f()', then\n\nimport a, doctest\nprint(doctest.testsource(a, \"a.f\"))\n\nprints a script version of function 'f()''s docstring, with\ndoctests converted to code, and the rest placed in comments.\n\n-- Function: doctest.debug (module, name, pm=False)\n\nDebug the doctests for an object.\n\nThe 'module' and 'name' arguments are the same as for function\n*note testsource(): 3cb1. above.  The synthesized Python script for\nthe named object's docstring is written to a temporary file, and\nthen that file is run under the control of the Python debugger,\n*note pdb: a0.\n\nA shallow copy of 'module.dict' is used for both local and\nglobal execution context.\n\nOptional argument 'pm' controls whether post-mortem debugging is\nused.  If 'pm' has a true value, the script file is run directly,\nand the debugger gets involved only if the script terminates via\nraising an unhandled exception.  If it does, then post-mortem\ndebugging is invoked, via *note pdb.postmortem(): 122f, passing\nthe traceback object from the unhandled exception.  If 'pm' is not\nspecified, or is false, the script is run under the debugger from\nthe start, via passing an appropriate *note exec(): 691. call to\n*note pdb.run(): 3cb2.\n\n-- Function: doctest.debugsrc (src, pm=False, globs=None)\n\nDebug the doctests in a string.\n\nThis is like function *note debug(): 3caf. above, except that a\nstring containing doctest examples is specified directly, via the\n'src' argument.\n\nOptional argument 'pm' has the same meaning as in function *note\ndebug(): 3caf. above.\n\nOptional argument 'globs' gives a dictionary to use as both local\nand global execution context.  If not specified, or 'None', an\nempty dictionary is used.  If specified, a shallow copy of the\ndictionary is used.\n\nThe *note DebugRunner: 3cae. class, and the special exceptions it may\nraise, are of most interest to testing framework authors, and will only\nbe sketched here.  See the source code, and especially *note\nDebugRunner: 3cae.'s docstring (which is a doctest!)  for more details:\n\n-- Class: doctest.DebugRunner (checker=None, verbose=None,\noptionflags=0)\n\nA subclass of *note DocTestRunner: 3c75. that raises an exception\nas soon as a failure is encountered.  If an unexpected exception\noccurs, an *note UnexpectedException: 3cb4. exception is raised,\ncontaining the test, the example, and the original exception.  If\nthe output doesn't match, then a *note DocTestFailure: 3cb5.\nexception is raised, containing the test, the example, and the\nactual output.\n\nFor information about the constructor parameters and methods, see\nthe documentation for *note DocTestRunner: 3c75. in section *note\nAdvanced API: 3c89.\n\nThere are two exceptions that may be raised by *note DebugRunner: 3cae.\ninstances:\n\n-- Exception: doctest.DocTestFailure (test, example, got)\n\nAn exception raised by *note DocTestRunner: 3c75. to signal that a\ndoctest example's actual output did not match its expected output.\nThe constructor arguments are used to initialize the attributes of\nthe same names.\n\n*note DocTestFailure: 3cb5. defines the following attributes:\n\n-- Attribute: DocTestFailure.test\n\nThe *note DocTest: 13e8. object that was being run when the example\nfailed.\n\n-- Attribute: DocTestFailure.example\n\nThe *note Example: 3c8a. that failed.\n\n-- Attribute: DocTestFailure.got\n\nThe example's actual output.\n\n-- Exception: doctest.UnexpectedException (test, example, excinfo)\n\nAn exception raised by *note DocTestRunner: 3c75. to signal that a\ndoctest example raised an unexpected exception.  The constructor\narguments are used to initialize the attributes of the same names.\n\n*note UnexpectedException: 3cb4. defines the following attributes:\n\n-- Attribute: UnexpectedException.test\n\nThe *note DocTest: 13e8. object that was being run when the example\nfailed.\n\n-- Attribute: UnexpectedException.example\n\nThe *note Example: 3c8a. that failed.\n\n-- Attribute: UnexpectedException.excinfo\n\nA tuple containing information about the unexpected exception, as\nreturned by *note sys.excinfo(): 456.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Soapbox,  Prev: Debugging,  Up: doctest -- Test interactive Python examples": {
            "content": "5.26.4.21 Soapbox\n.................\n\nAs mentioned in the introduction, *note doctest: 36. has grown to have\nthree primary uses:\n\n1. Checking examples in docstrings.\n\n2. Regression testing.\n\n3. Executable documentation / literate testing.\n",
            "subsections": []
        },
        "These uses have different requirements, and it is important to": {
            "content": "distinguish them.  In particular, filling your docstrings with obscure\ntest cases makes for bad documentation.\n",
            "subsections": []
        },
        "When writing a docstring, choose docstring examples with care.  There's": {
            "content": "an art to this that needs to be learned--it may not be natural at first.",
            "subsections": []
        },
        "Examples should add genuine value to the documentation.  A good example": {
            "content": "can often be worth many words.  If done with care, the examples will be\ninvaluable for your users, and will pay back the time it takes to\ncollect them many times over as the years go by and things change.  I'm\nstill amazed at how often one of my *note doctest: 36. examples stops\nworking after a \"harmless\" change.\n",
            "subsections": []
        },
        "Doctest also makes an excellent tool for regression testing, especially": {
            "content": "if you don't skimp on explanatory text.  By interleaving prose and\nexamples, it becomes much easier to keep track of what's actually being\ntested, and why.  When a test fails, good prose can make it much easier\nto figure out what the problem is, and how it should be fixed.  It's\ntrue that you could write extensive comments in code-based testing, but\nfew programmers do.  Many have found that using doctest approaches\ninstead leads to much clearer tests.  Perhaps this is simply because\ndoctest makes writing prose a little easier than writing code, while\nwriting comments in code is a little harder.  I think it goes deeper\nthan just that: the natural attitude when writing a doctest-based test\nis that you want to explain the fine points of your software, and\nillustrate them with examples.  This in turn naturally leads to test\nfiles that start with the simplest features, and logically progress to\ncomplications and edge cases.  A coherent narrative is the result,\ninstead of a collection of isolated functions that test isolated bits of\nfunctionality seemingly at random.  It's a different attitude, and\nproduces different results, blurring the distinction between testing and\nexplaining.\n\nRegression testing is best confined to dedicated objects or files.\nThere are several options for organizing tests:\n\n* Write text files containing test cases as interactive examples, and\ntest the files using *note testfile(): 3c5d. or *note\nDocFileSuite(): 3c85.  This is recommended, although is easiest to\ndo for new projects, designed from the start to use doctest.\n\n* Define functions named 'regrtesttopic' that consist of single\ndocstrings, containing test cases for the named topics.  These\nfunctions can be included in the same file as the module, or\nseparated out into a separate test file.\n\n* Define a 'test' dictionary mapping from regression test topics\nto docstrings containing test cases.\n",
            "subsections": []
        },
        "When you have placed your tests in a module, the module can itself be": {
            "content": "the test runner.  When a test fails, you can arrange for your test\nrunner to re-run only the failing doctest while you debug the problem.\nHere is a minimal example of such a test runner:\n\nif name == 'main':\nimport doctest\nflags = doctest.REPORTNDIFF|doctest.FAILFAST\nif len(sys.argv) > 1:\nname = sys.argv[1]\nif name in globals():\nobj = globals()[name]\nelse:\nobj = test[name]\ndoctest.rundocstringexamples(obj, globals(), name=name,\noptionflags=flags)\nelse:\nfail, total = doctest.testmod(optionflags=flags)\nprint(\"{} failures out of {} tests\".format(fail, total))\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: unittest -- Unit testing framework,  Next: unittest mock -- mock object library,  Prev: doctest -- Test interactive Python examples,  Up: Development Tools": {
            "content": "'Source code:' Lib/unittest/init.py(1)\n\n\n\n(If you are already familiar with the basic concepts of testing, you\nmight want to skip to *note the list of assert methods: 3cc0.)\n\nThe *note unittest: 101. unit testing framework was originally inspired\nby JUnit and has a similar flavor as major unit testing frameworks in\nother languages.  It supports test automation, sharing of setup and\nshutdown code for tests, aggregation of tests into collections, and\nindependence of the tests from the reporting framework.\n\nTo achieve this, *note unittest: 101. supports some important concepts\nin an object-oriented way:\n\ntest fixture\n\nA 'test fixture' represents the preparation needed to perform one\nor more tests, and any associated cleanup actions.  This may\ninvolve, for example, creating temporary or proxy databases,\ndirectories, or starting a server process.\n\ntest case\n\nA 'test case' is the individual unit of testing.  It checks for a\nspecific response to a particular set of inputs.  *note unittest:\n101. provides a base class, *note TestCase: 159, which may be used\nto create new test cases.\n\ntest suite\n\nA 'test suite' is a collection of test cases, test suites, or both.\nIt is used to aggregate tests that should be executed together.\n\ntest runner\n\nA 'test runner' is a component which orchestrates the execution of\ntests and provides the outcome to the user.  The runner may use a\ngraphical interface, a textual interface, or return a special value\nto indicate the results of executing the tests.\n\nSee also\n........\n\nModule *note doctest: 36.\n\nAnother test-support module with a very different flavor.\n",
            "subsections": []
        },
        "Simple Smalltalk Testing: With Patterns(2)": {
            "content": "Kent Beck's original paper on testing frameworks using the pattern\nshared by *note unittest: 101.\n\npytest(3)\n\nThird-party unittest framework with a lighter-weight syntax for\nwriting tests.  For example, 'assert func(10) == 42'.\n",
            "subsections": []
        },
        "The Python Testing Tools Taxonomy(4)": {
            "content": "An extensive list of Python testing tools including functional\ntesting frameworks and mock object libraries.\n",
            "subsections": []
        },
        "Testing in Python Mailing List(5)": {
            "content": "A special-interest-group for discussion of testing, and testing\ntools, in Python.\n",
            "subsections": []
        },
        "The script 'Tools/unittestgui/unittestgui.py' in the Python source": {
            "content": "distribution is a GUI tool for test discovery and execution.  This is\nintended largely for ease of use for those new to unit testing.  For\nproduction environments it is recommended that tests be driven by a\ncontinuous integration system such as Buildbot(6), Jenkins(7), GitHub\nActions(8), or AppVeyor(9).\n\n* Menu:\n\n* Basic example::\n* Command-Line Interface: Command-Line Interface<3>.\n* Test Discovery::\n* Organizing test code::\n* Re-using old test code::\n* Skipping tests and expected failures::\n* Distinguishing test iterations using subtests::\n* Classes and functions::\n* Class and Module Fixtures::\n* Signal Handling::\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/unittest/init.py\n\n(2)\nhttps://web.archive.org/web/20150315073817/http://www.xprogramming.com/testfram.htm\n\n(3) https://docs.pytest.org/\n\n(4) https://wiki.python.org/moin/PythonTestingToolsTaxonomy\n\n(5) http://lists.idyll.org/listinfo/testing-in-python\n\n(6) https://buildbot.net/\n\n(7) https://www.jenkins.io/\n\n(8) https://github.com/features/actions\n\n(9) https://www.appveyor.com/\n\nFile: python3.12.info,  Node: Basic example,  Next: Command-Line Interface<3>,  Up: unittest -- Unit testing framework\n\n5.26.5.1 Basic example\n......................\n\nThe *note unittest: 101. module provides a rich set of tools for\nconstructing and running tests.  This section demonstrates that a small\nsubset of the tools suffice to meet the needs of most users.\n\nHere is a short script to test three string methods:\n\nimport unittest\n\nclass TestStringMethods(unittest.TestCase):\n\ndef testupper(self):\nself.assertEqual('foo'.upper(), 'FOO')\n\ndef testisupper(self):\nself.assertTrue('FOO'.isupper())\nself.assertFalse('Foo'.isupper())\n\ndef testsplit(self):\ns = 'hello world'\nself.assertEqual(s.split(), ['hello', 'world'])\n# check that s.split fails when the separator is not a string\nwith self.assertRaises(TypeError):\ns.split(2)\n\nif name == 'main':\nunittest.main()\n\nA testcase is created by subclassing *note unittest.TestCase: 159.  The\nthree individual tests are defined with methods whose names start with\nthe letters 'test'.  This naming convention informs the test runner\nabout which methods represent tests.\n\nThe crux of each test is a call to *note assertEqual(): 27d. to check\nfor an expected result; *note assertTrue(): 27b. or *note assertFalse():\n27c. to verify a condition; or *note assertRaises(): 281. to verify that\na specific exception gets raised.  These methods are used instead of the\n*note assert: 78a. statement so the test runner can accumulate all test\nresults and produce a report.\n\nThe *note setUp(): 11b2. and *note tearDown(): 11b3. methods allow you\nto define instructions that will be executed before and after each test\nmethod.  They are covered in more detail in the section *note Organizing\ntest code: 3cc3.\n\nThe final block shows a simple way to run the tests.  *note\nunittest.main(): e56. provides a command-line interface to the test\nscript.  When run from the command line, the above script produces an\noutput that looks like this:\n\nRan 3 tests in 0.000s\n\nOK\n\nPassing the '-v' option to your test script will instruct *note\nunittest.main(): e56. to enable a higher level of verbosity, and produce\nthe following output:\n\ntestisupper (main.TestStringMethods.testisupper) ... ok\ntestsplit (main.TestStringMethods.testsplit) ... ok\ntestupper (main.TestStringMethods.testupper) ... ok\n\n----------------------------------------------------------------------\nRan 3 tests in 0.001s\n\nOK\n\nThe above examples show the most commonly used *note unittest: 101.\nfeatures which are sufficient to meet many everyday testing needs.  The\nremainder of the documentation explores the full feature set from first\nprinciples.\n",
            "subsections": []
        },
        "Changed in version 3.11: The behavior of returning a value from a test": {
            "content": "method (other than the default 'None' value), is now deprecated.\n\nFile: python3.12.info,  Node: Command-Line Interface<3>,  Next: Test Discovery,  Prev: Basic example,  Up: unittest -- Unit testing framework\n\n5.26.5.2 Command-Line Interface\n...............................\n",
            "subsections": []
        },
        "The unittest module can be used from the command line to run tests from": {
            "content": "modules, classes or even individual test methods:\n\npython -m unittest testmodule1 testmodule2\npython -m unittest testmodule.TestClass\npython -m unittest testmodule.TestClass.testmethod\n",
            "subsections": []
        },
        "You can pass in a list with any combination of module names, and fully": {
            "content": "qualified class or method names.\n\nTest modules can be specified by file path as well:\n\npython -m unittest tests/testsomething.py\n",
            "subsections": []
        },
        "This allows you to use the shell filename completion to specify the test": {
            "content": "module.  The file specified must still be importable as a module.  The\npath is converted to a module name by removing the '.py' and converting\npath separators into '.'.  If you want to execute a test file that isn't\nimportable as a module you should execute the file directly instead.\n",
            "subsections": []
        },
        "You can run tests with more detail (higher verbosity) by passing in the": {
            "content": "-v flag:\n\npython -m unittest -v testmodule\n\nWhen executed without arguments *note Test Discovery: 3cc6. is started:\n\npython -m unittest\n\nFor a list of all the command-line options:\n\npython -m unittest -h\n",
            "subsections": []
        },
        "Changed in version 3.2: In earlier versions it was only possible to run": {
            "content": "individual test methods and not modules or classes.\n\n* Menu:\n\n* Command-line options: Command-line options<3>.\n\nFile: python3.12.info,  Node: Command-line options<3>,  Up: Command-Line Interface<3>\n\n5.26.5.3 Command-line options\n.............................\n\n'unittest' supports these command-line options:\n\n-- Option: -b, --buffer\n\nThe standard output and standard error streams are buffered during\nthe test run.  Output during a passing test is discarded.  Output\nis echoed normally on test fail or error and is added to the\nfailure messages.\n\n-- Option: -c, --catch\n\n'Control-C' during the test run waits for the current test to end\nand then reports all the results so far.  A second 'Control-C'\nraises the normal *note KeyboardInterrupt: 7f5. exception.\n\nSee *note Signal Handling: 3cca. for the functions that provide\nthis functionality.\n\n-- Option: -f, --failfast\n\nStop the test run on the first error or failure.\n\n-- Option: -k\n\nOnly run test methods and classes that match the pattern or\nsubstring.  This option may be used multiple times, in which case\nall test cases that match any of the given patterns are included.\n\nPatterns that contain a wildcard character ('*') are matched\nagainst the test name using *note fnmatch.fnmatchcase(): 1602.;\notherwise simple case-sensitive substring matching is used.\n\nPatterns are matched against the fully qualified test method name\nas imported by the test loader.\n\nFor example, '-k foo' matches 'footests.SomeTest.testsomething',\n'bartests.SomeTest.testfoo', but not\n'bartests.FooTest.testsomething'.\n\n-- Option: --locals\n\nShow local variables in tracebacks.\n\n-- Option: --durations N\n\nShow the N slowest test cases (N=0 for all).\n",
            "subsections": []
        },
        "New in version 3.2: The command-line options '-b', '-c' and '-f' were": {
            "content": "added.\n\nNew in version 3.5: The command-line option '--locals'.\n\nNew in version 3.7: The command-line option '-k'.\n\nNew in version 3.12: The command-line option '--durations'.\n",
            "subsections": []
        },
        "The command line can also be used for test discovery, for running all of": {
            "content": "the tests in a project or just a subset.\n\nFile: python3.12.info,  Node: Test Discovery,  Next: Organizing test code,  Prev: Command-Line Interface<3>,  Up: unittest -- Unit testing framework\n\n5.26.5.4 Test Discovery\n.......................\n\nNew in version 3.2.\n",
            "subsections": []
        },
        "Unittest supports simple test discovery.  In order to be compatible with": {
            "content": "test discovery, all of the test files must be *note modules: 19db. or\n*note packages: 19ec. importable from the top-level directory of the\nproject (this means that their filenames must be valid *note\nidentifiers: 1bb5.).\n\nTest discovery is implemented in *note TestLoader.discover(): e58, but\ncan also be used from the command line.  The basic command-line usage\nis:\n\ncd projectdirectory\npython -m unittest discover\n\nNote: As a shortcut, 'python -m unittest' is the equivalent of\n'python -m unittest discover'.  If you want to pass arguments to\ntest discovery the 'discover' sub-command must be used explicitly.\n\nThe 'discover' sub-command has the following options:\n\n-- Option: -v, --verbose\n\nVerbose output\n\n-- Option: -s, --start-directory directory\n\nDirectory to start discovery ('.' default)\n\n-- Option: -p, --pattern pattern\n\nPattern to match test files ('test*.py' default)\n\n-- Option: -t, --top-level-directory directory\n\nTop level directory of project (defaults to start directory)\n\nThe *note -s: 3cd2, *note -p: 3cd4, and *note -t: 3cd6. options can be\npassed in as positional arguments in that order.  The following two\ncommand lines are equivalent:\n\npython -m unittest discover -s projectdirectory -p \"*test.py\"\npython -m unittest discover projectdirectory \"*test.py\"\n",
            "subsections": []
        },
        "As well as being a path it is possible to pass a package name, for": {
            "content": "example 'myproject.subpackage.test', as the start directory.  The\npackage name you supply will then be imported and its location on the\nfilesystem will be used as the start directory.\n\nCaution: Test discovery loads tests by importing them.  Once test\ndiscovery has found all the test files from the start directory you\nspecify it turns the paths into package names to import.  For\nexample 'foo/bar/baz.py' will be imported as 'foo.bar.baz'.\n\nIf you have a package installed globally and attempt test discovery\non a different copy of the package then the import 'could' happen\nfrom the wrong place.  If this happens test discovery will warn you\nand exit.\n\nIf you supply the start directory as a package name rather than a\npath to a directory then discover assumes that whichever location\nit imports from is the location you intended, so you will not get\nthe warning.\n",
            "subsections": []
        },
        "Test modules and packages can customize test loading and discovery by": {
            "content": "through the *note loadtests protocol: 3cd8.\n\nChanged in version 3.4: Test discovery supports *note namespace\npackages: 19ed. for the start directory.  Note that you need to specify\nthe top level directory too (e.g.  'python -m unittest discover -s\nroot/namespace -t root').\n\nChanged in version 3.11: *note unittest: 101. dropped the *note\nnamespace packages: 19ed. support in Python 3.11.  It has been broken\nsince Python 3.7.  Start directory and subdirectories containing tests\nmust be regular package that have 'init.py' file.\n\nDirectories containing start directory still can be a namespace package.",
            "subsections": []
        },
        "In this case, you need to specify start directory as dotted package": {
            "content": "name, and target directory explicitly.  For example:\n\n# proj/  <-- current directory\n#   namespace/\n#     mypkg/\n#       init.py\n#       testmypkg.py\n\npython -m unittest discover -s namespace.mypkg -t .\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Organizing test code,  Next: Re-using old test code,  Prev: Test Discovery,  Up: unittest -- Unit testing framework": {
            "content": "5.26.5.5 Organizing test code\n.............................\n",
            "subsections": []
        },
        "The basic building blocks of unit testing are 'test cases' -- single": {
            "content": "scenarios that must be set up and checked for correctness.  In *note\nunittest: 101, test cases are represented by *note unittest.TestCase:\n159. instances.  To make your own test cases you must write subclasses\nof *note TestCase: 159. or use *note FunctionTestCase: 13f7.\n\nThe testing code of a *note TestCase: 159. instance should be entirely\nself contained, such that it can be run either in isolation or in\narbitrary combination with any number of other test cases.\n\nThe simplest *note TestCase: 159. subclass will simply implement a test\nmethod (i.e.  a method whose name starts with 'test') in order to\nperform specific testing code:\n\nimport unittest\n\nclass DefaultWidgetSizeTestCase(unittest.TestCase):\ndef testdefaultwidgetsize(self):\nwidget = Widget('The widget')\nself.assertEqual(widget.size(), (50, 50))\n\nNote that in order to test something, we use one of the *note assert*\nmethods: 3cc0. provided by the *note TestCase: 159. base class.  If the\ntest fails, an exception will be raised with an explanatory message, and\n*note unittest: 101. will identify the test case as a 'failure'.  Any\nother exceptions will be treated as 'errors'.\n",
            "subsections": []
        },
        "Tests can be numerous, and their set-up can be repetitive.  Luckily, we": {
            "content": "can factor out set-up code by implementing a method called *note\nsetUp(): 11b2, which the testing framework will automatically call for\nevery single test we run:\n\nimport unittest\n\nclass WidgetTestCase(unittest.TestCase):\ndef setUp(self):\nself.widget = Widget('The widget')\n\ndef testdefaultwidgetsize(self):\nself.assertEqual(self.widget.size(), (50,50),\n'incorrect default size')\n\ndef testwidgetresize(self):\nself.widget.resize(100,150)\nself.assertEqual(self.widget.size(), (100,150),\n'wrong size after resize')\n\nNote: The order in which the various tests will be run is\ndetermined by sorting the test method names with respect to the\nbuilt-in ordering for strings.\n\nIf the *note setUp(): 11b2. method raises an exception while the test is\nrunning, the framework will consider the test to have suffered an error,\nand the test method will not be executed.\n\nSimilarly, we can provide a *note tearDown(): 11b3. method that tidies\nup after the test method has been run:\n\nimport unittest\n\nclass WidgetTestCase(unittest.TestCase):\ndef setUp(self):\nself.widget = Widget('The widget')\n\ndef tearDown(self):\nself.widget.dispose()\n\nIf *note setUp(): 11b2. succeeded, *note tearDown(): 11b3. will be run\nwhether the test method succeeded or not.\n",
            "subsections": []
        },
        "Such a working environment for the testing code is called a 'test": {
            "content": "fixture'.  A new TestCase instance is created as a unique test fixture\nused to execute each individual test method.  Thus *note setUp(): 11b2,\n*note tearDown(): 11b3, and 'init()' will be called once per test.\n",
            "subsections": []
        },
        "It is recommended that you use TestCase implementations to group tests": {
            "content": "together according to the features they test.  *note unittest: 101.\nprovides a mechanism for this: the 'test suite', represented by *note\nunittest: 101.'s *note TestSuite: c51. class.  In most cases, calling\n*note unittest.main(): e56. will do the right thing and collect all the\nmodule's test cases for you and execute them.\n",
            "subsections": []
        },
        "However, should you want to customize the building of your test suite,": {
            "content": "you can do it yourself:\n\ndef suite():\nsuite = unittest.TestSuite()\nsuite.addTest(WidgetTestCase('testdefaultwidgetsize'))\nsuite.addTest(WidgetTestCase('testwidgetresize'))\nreturn suite\n\nif name == 'main':\nrunner = unittest.TextTestRunner()\nrunner.run(suite())\n",
            "subsections": []
        },
        "You can place the definitions of test cases and test suites in the same": {
            "content": "modules as the code they are to test (such as 'widget.py'), but there\nare several advantages to placing the test code in a separate module,\nsuch as 'testwidget.py':\n\n* The test module can be run standalone from the command line.\n\n* The test code can more easily be separated from shipped code.\n\n* There is less temptation to change test code to fit the code it\ntests without a good reason.\n\n* Test code should be modified much less frequently than the code it\ntests.\n\n* Tested code can be refactored more easily.\n\n* Tests for modules written in C must be in separate modules anyway,\nso why not be consistent?\n\n* If the testing strategy changes, there is no need to change the\nsource code.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Re-using old test code,  Next: Skipping tests and expected failures,  Prev: Organizing test code,  Up: unittest -- Unit testing framework": {
            "content": "5.26.5.6 Re-using old test code\n...............................\n",
            "subsections": []
        },
        "Some users will find that they have existing test code that they would": {
            "content": "like to run from *note unittest: 101, without converting every old test\nfunction to a *note TestCase: 159. subclass.\n\nFor this reason, *note unittest: 101. provides a *note FunctionTestCase:\n13f7. class.  This subclass of *note TestCase: 159. can be used to wrap\nan existing test function.  Set-up and tear-down functions can also be\nprovided.\n\nGiven the following test function:\n\ndef testSomething():\nsomething = makeSomething()\nassert something.name is not None\n# ...\n\none can create an equivalent test case instance as follows, with\noptional set-up and tear-down methods:\n\ntestcase = unittest.FunctionTestCase(testSomething,\nsetUp=makeSomethingDB,\ntearDown=deleteSomethingDB)\n\nNote: Even though *note FunctionTestCase: 13f7. can be used to\nquickly convert an existing test base over to a *note unittest:\n101.-based system, this approach is not recommended.  Taking the\ntime to set up proper *note TestCase: 159. subclasses will make\nfuture test refactorings infinitely easier.\n\nIn some cases, the existing tests may have been written using the *note\ndoctest: 36. module.  If so, *note doctest: 36. provides a\n'DocTestSuite' class that can automatically build *note\nunittest.TestSuite: c51. instances from the existing *note doctest:\n36.-based tests.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Skipping tests and expected failures,  Next: Distinguishing test iterations using subtests,  Prev: Re-using old test code,  Up: unittest -- Unit testing framework": {
            "content": "5.26.5.7 Skipping tests and expected failures\n.............................................\n\nNew in version 3.1.\n",
            "subsections": []
        },
        "Unittest supports skipping individual test methods and even whole": {
            "content": "classes of tests.  In addition, it supports marking a test as an\n\"expected failure,\" a test that is broken and will fail, but shouldn't\nbe counted as a failure on a *note TestResult: fdc.\n\nSkipping a test is simply a matter of using the *note skip(): 174c.\n*note decorator: 514. or one of its conditional variants, calling *note\nTestCase.skipTest(): 3cde. within a *note setUp(): 11b2. or test method,\nor raising *note SkipTest: e57. directly.\n\nBasic skipping looks like this:\n\nclass MyTestCase(unittest.TestCase):\n\n@unittest.skip(\"demonstrating skipping\")\ndef testnothing(self):\nself.fail(\"shouldn't happen\")\n\n@unittest.skipIf(mylib.version < (1, 3),\n\"not supported in this library version\")\ndef testformat(self):\n# Tests that work for only a certain version of the library.\npass\n\n@unittest.skipUnless(sys.platform.startswith(\"win\"), \"requires Windows\")\ndef testwindowssupport(self):\n# windows specific testing code\npass\n\ndef testmaybeskipped(self):\nif not externalresourceavailable():\nself.skipTest(\"external resource not available\")\n# test code that depends on the external resource\npass\n\nThis is the output of running the example above in verbose mode:\n\ntestformat (main.MyTestCase.testformat) ... skipped 'not supported in this library version'\ntestnothing (main.MyTestCase.testnothing) ... skipped 'demonstrating skipping'\ntestmaybeskipped (main.MyTestCase.testmaybeskipped) ... skipped 'external resource not available'\ntestwindowssupport (main.MyTestCase.testwindowssupport) ... skipped 'requires Windows'\n\n----------------------------------------------------------------------\nRan 4 tests in 0.005s\n\nOK (skipped=4)\n\nClasses can be skipped just like methods:\n\n@unittest.skip(\"showing class skipping\")\nclass MySkippedTestCase(unittest.TestCase):\ndef testnotrun(self):\npass\n\n*note TestCase.setUp(): 11b2. can also skip the test.  This is useful\nwhen a resource that needs to be set up is not available.\n\nExpected failures use the *note expectedFailure(): 3cdf. decorator.\n\nclass ExpectedFailureTestCase(unittest.TestCase):\n@unittest.expectedFailure\ndef testfail(self):\nself.assertEqual(1, 0, \"broken\")\n",
            "subsections": []
        },
        "It's easy to roll your own skipping decorators by making a decorator": {
            "content": "that calls *note skip(): 174c. on the test when it wants it to be\nskipped.  This decorator skips the test unless the passed object has a\ncertain attribute:\n\ndef skipUnlessHasattr(obj, attr):\nif hasattr(obj, attr):\nreturn lambda func: func\nreturn unittest.skip(\"{!r} doesn't have {!r}\".format(obj, attr))\n",
            "subsections": []
        },
        "The following decorators and exception implement test skipping and": {
            "content": "expected failures:\n\n-- Function: @unittest.skip (reason)\n\nUnconditionally skip the decorated test.  'reason' should describe\nwhy the test is being skipped.\n\n-- Function: @unittest.skipIf (condition, reason)\n\nSkip the decorated test if 'condition' is true.\n\n-- Function: @unittest.skipUnless (condition, reason)\n\nSkip the decorated test unless 'condition' is true.\n\n-- Function: @unittest.expectedFailure\n\nMark the test as an expected failure or error.  If the test fails\nor errors in the test function itself (rather than in one of the\n'test fixture' methods) then it will be considered a success.  If\nthe test passes, it will be considered a failure.\n\n-- Exception: unittest.SkipTest (reason)\n\nThis exception is raised to skip a test.\n\nUsually you can use *note TestCase.skipTest(): 3cde. or one of the\nskipping decorators instead of raising this directly.\n\nSkipped tests will not have *note setUp(): 11b2. or *note tearDown():\n11b3. run around them.  Skipped classes will not have *note\nsetUpClass(): 87b. or *note tearDownClass(): 11b0. run.  Skipped modules\nwill not have 'setUpModule()' or 'tearDownModule()' run.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Distinguishing test iterations using subtests,  Next: Classes and functions,  Prev: Skipping tests and expected failures,  Up: unittest -- Unit testing framework": {
            "content": "5.26.5.8 Distinguishing test iterations using subtests\n......................................................\n\nNew in version 3.4.\n",
            "subsections": []
        },
        "When there are very small differences among your tests, for instance": {
            "content": "some parameters, unittest allows you to distinguish them inside the body\nof a test method using the *note subTest(): e54. context manager.\n\nFor example, the following test:\n\nclass NumbersTest(unittest.TestCase):\n\ndef testeven(self):\n\"\"\"\nTest that numbers between 0 and 5 are all even.\n\"\"\"\nfor i in range(0, 6):\nwith self.subTest(i=i):\nself.assertEqual(i % 2, 0)\n\nwill produce the following output:\n\n======================================================================\nFAIL: testeven (main.NumbersTest.testeven) (i=1)\nTraceback (most recent call last):\nFile \"subtests.py\", line 11, in testeven\nself.assertEqual(i % 2, 0)\n^^^^^^^^^^^^^^^^^^^^^^^^^^\nAssertionError: 1 != 0\n\n======================================================================\nFAIL: testeven (main.NumbersTest.testeven) (i=3)\nTraceback (most recent call last):\nFile \"subtests.py\", line 11, in testeven\nself.assertEqual(i % 2, 0)\n^^^^^^^^^^^^^^^^^^^^^^^^^^\nAssertionError: 1 != 0\n\n======================================================================\nFAIL: testeven (main.NumbersTest.testeven) (i=5)\nTraceback (most recent call last):\nFile \"subtests.py\", line 11, in testeven\nself.assertEqual(i % 2, 0)\n^^^^^^^^^^^^^^^^^^^^^^^^^^\nAssertionError: 1 != 0\n",
            "subsections": []
        },
        "Without using a subtest, execution would stop after the first failure,": {
            "content": "and the error would be less easy to diagnose because the value of 'i'\nwouldn't be displayed:\n\n======================================================================\nTraceback (most recent call last):\nFile \"subtests.py\", line 32, in testeven\nself.assertEqual(i % 2, 0)\nAssertionError: 1 != 0\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Classes and functions,  Next: Class and Module Fixtures,  Prev: Distinguishing test iterations using subtests,  Up: unittest -- Unit testing framework": {
            "content": "5.26.5.9 Classes and functions\n..............................\n\nThis section describes in depth the API of *note unittest: 101.\n\n* Menu:\n\n* Test cases::\n* Grouping tests::\n* Loading and running tests::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Test cases,  Next: Grouping tests,  Up: Classes and functions": {
            "content": "5.26.5.10 Test cases\n....................\n\n-- Class: unittest.TestCase (methodName='runTest')\n\nInstances of the *note TestCase: 159. class represent the logical\ntest units in the *note unittest: 101. universe.  This class is\nintended to be used as a base class, with specific tests being\nimplemented by concrete subclasses.  This class implements the\ninterface needed by the test runner to allow it to drive the tests,\nand methods that the test code can use to check for and report\nvarious kinds of failure.\n\nEach instance of *note TestCase: 159. will run a single base\nmethod: the method named 'methodName'.  In most uses of *note\nTestCase: 159, you will neither change the 'methodName' nor\nreimplement the default 'runTest()' method.\n\nChanged in version 3.2: *note TestCase: 159. can be instantiated\nsuccessfully without providing a 'methodName'.  This makes it\neasier to experiment with *note TestCase: 159. from the interactive\ninterpreter.\n\n*note TestCase: 159. instances provide three groups of methods: one\ngroup used to run the test, another used by the test implementation\nto check conditions and report failures, and some inquiry methods\nallowing information about the test itself to be gathered.\n\nMethods in the first group (running the test) are:\n\n-- Method: setUp ()\n\nMethod called to prepare the test fixture.  This is called\nimmediately before calling the test method; other than *note\nAssertionError: 476. or *note SkipTest: e57, any exception\nraised by this method will be considered an error rather than\na test failure.  The default implementation does nothing.\n\n-- Method: tearDown ()\n\nMethod called immediately after the test method has been\ncalled and the result recorded.  This is called even if the\ntest method raised an exception, so the implementation in\nsubclasses may need to be particularly careful about checking\ninternal state.  Any exception, other than *note\nAssertionError: 476. or *note SkipTest: e57, raised by this\nmethod will be considered an additional error rather than a\ntest failure (thus increasing the total number of reported\nerrors).  This method will only be called if the *note\nsetUp(): 11b2. succeeds, regardless of the outcome of the test\nmethod.  The default implementation does nothing.\n\n-- Method: setUpClass ()\n\nA class method called before tests in an individual class are\nrun.  'setUpClass' is called with the class as the only\nargument and must be decorated as a *note classmethod(): 246.:\n\n@classmethod\ndef setUpClass(cls):\n...\n\nSee *note Class and Module Fixtures: 3ce7. for more details.\n\nNew in version 3.2.\n\n-- Method: tearDownClass ()\n\nA class method called after tests in an individual class have\nrun.  'tearDownClass' is called with the class as the only\nargument and must be decorated as a *note classmethod(): 246.:\n\n@classmethod\ndef tearDownClass(cls):\n...\n\nSee *note Class and Module Fixtures: 3ce7. for more details.\n\nNew in version 3.2.\n\n-- Method: run (result=None)\n\nRun the test, collecting the result into the *note TestResult:\nfdc. object passed as 'result'.  If 'result' is omitted or\n'None', a temporary result object is created (by calling the\n*note defaultTestResult(): 3ce8. method) and used.  The result\nobject is returned to *note run(): fdb.'s caller.\n\nThe same effect may be had by simply calling the *note\nTestCase: 159. instance.\n\nChanged in version 3.3: Previous versions of 'run' did not\nreturn the result.  Neither did calling an instance.\n\n-- Method: skipTest (reason)\n\nCalling this during a test method or *note setUp(): 11b2.\nskips the current test.  See *note Skipping tests and expected\nfailures: 3cdd. for more information.\n\nNew in version 3.1.\n\n-- Method: subTest (msg=None, params)\n\nReturn a context manager which executes the enclosed code\nblock as a subtest.  'msg' and 'params' are optional,\narbitrary values which are displayed whenever a subtest fails,\nallowing you to identify them clearly.\n\nA test case can contain any number of subtest declarations,\nand they can be arbitrarily nested.\n\nSee *note Distinguishing test iterations using subtests: e55.\nfor more information.\n\nNew in version 3.4.\n\n-- Method: debug ()\n\nRun the test without collecting the result.  This allows\nexceptions raised by the test to be propagated to the caller,\nand can be used to support running tests under a debugger.\nThe *note TestCase: 159. class provides several assert methods to\ncheck for and report failures.  The following table lists the most\ncommonly used methods (see the tables below for more assert\nmethods):\n\nMethod                                        Checks that                       New in\n\n----------------------------------------------------------------------------------------------------\n\n*note assertEqual(a, b): 27d.                 'a == b'\n\n\n*note assertNotEqual(a, b): 27e.              'a != b'\n\n\n*note assertTrue(x): 27b.                     'bool(x) is True'\n\n\n*note assertFalse(x): 27c.                    'bool(x) is False'\n\n\n*note assertIs(a, b): 11b4.                   'a is b'                          3.1\n\n\n*note assertIsNot(a, b): 11b5.                'a is not b'                      3.1\n\n\n*note assertIsNone(x): 1103.                  'x is None'                       3.1\n\n\n*note assertIsNotNone(x): 1104.               'x is not None'                   3.1\n\n\n*note assertIn(a, b): 11bd.                   'a in b'                          3.1\n\n\n*note assertNotIn(a, b): 11be.                'a not in b'                      3.1\n\n\n*note assertIsInstance(a, b): 11b6.           'isinstance(a, b)'                3.2\n\n\n*note assertNotIsInstance(a, b): 11b7.        'not isinstance(a, b)'            3.2\n\n\nAll the assert methods accept a 'msg' argument that, if specified,\nis used as the error message on failure (see also *note\nlongMessage: 11af.).  Note that the 'msg' keyword argument can be\npassed to *note assertRaises(): 281, *note assertRaisesRegex():\n283, *note assertWarns(): fd9, *note assertWarnsRegex(): fda. only\nwhen they are used as a context manager.\n\n-- Method: assertEqual (first, second, msg=None)\n\nTest that 'first' and 'second' are equal.  If the values do\nnot compare equal, the test will fail.\n\nIn addition, if 'first' and 'second' are the exact same type\nand one of list, tuple, dict, set, frozenset or str or any\ntype that a subclass registers with *note\naddTypeEqualityFunc(): 11c1. the type-specific equality\nfunction will be called in order to generate a more useful\ndefault error message (see also the *note list of\ntype-specific methods: 3ce9.).\n\nChanged in version 3.1: Added the automatic calling of\ntype-specific equality function.\n\nChanged in version 3.2: *note assertMultiLineEqual(): 11bc.\nadded as the default type equality function for comparing\nstrings.\n\n-- Method: assertNotEqual (first, second, msg=None)\n\nTest that 'first' and 'second' are not equal.  If the values\ndo compare equal, the test will fail.\n\n-- Method: assertTrue (expr, msg=None)\n-- Method: assertFalse (expr, msg=None)\n\nTest that 'expr' is true (or false).\n\nNote that this is equivalent to 'bool(expr) is True' and not\nto 'expr is True' (use 'assertIs(expr, True)' for the latter).\nThis method should also be avoided when more specific methods\nare available (e.g.  'assertEqual(a, b)' instead of\n'assertTrue(a == b)'), because they provide a better error\nmessage in case of failure.\n\n-- Method: assertIs (first, second, msg=None)\n-- Method: assertIsNot (first, second, msg=None)\n\nTest that 'first' and 'second' are (or are not) the same\nobject.\n\nNew in version 3.1.\n\n-- Method: assertIsNone (expr, msg=None)\n-- Method: assertIsNotNone (expr, msg=None)\n\nTest that 'expr' is (or is not) 'None'.\n\nNew in version 3.1.\n\n-- Method: assertIn (member, container, msg=None)\n-- Method: assertNotIn (member, container, msg=None)\n\nTest that 'member' is (or is not) in 'container'.\n\nNew in version 3.1.\n\n-- Method: assertIsInstance (obj, cls, msg=None)\n-- Method: assertNotIsInstance (obj, cls, msg=None)\n\nTest that 'obj' is (or is not) an instance of 'cls' (which can\nbe a class or a tuple of classes, as supported by *note\nisinstance(): 14b.).  To check for the exact type, use *note\nassertIs(type(obj), cls): 11b4.\n\nNew in version 3.2.\n\nIt is also possible to check the production of exceptions,\nwarnings, and log messages using the following methods:\n\nMethod                                                        Checks that                                New in\n\n--------------------------------------------------------------------------------------------------------------------------\n\n*note assertRaises(exc, fun, *args, kwds): 281.             'fun(*args, kwds)' raises 'exc'\n\n\n*note assertRaisesRegex(exc, r, fun, *args, kwds): 283.     'fun(*args, kwds)' raises 'exc' and      3.1\nthe message matches regex 'r'\n\n\n*note assertWarns(warn, fun, *args, kwds): fd9.             'fun(*args, kwds)' raises 'warn'         3.2\n\n\n*note assertWarnsRegex(warn, r, fun, *args, kwds): fda.     'fun(*args, kwds)' raises 'warn' and     3.2\nthe message matches regex 'r'\n\n\n*note assertLogs(logger, level): 64f.                         The 'with' block logs on 'logger' with     3.4\nminimum 'level'\n\n\n*note assertNoLogs(logger, level): 64e.                       The 'with' block does not log on           3.10\n\n'logger' with minimum 'level'\n\n\n-- Method: assertRaises (exception, callable, *args, kwds)\n\n-- Method: assertRaises (exception, *, msg=None)\n\nTest that an exception is raised when 'callable' is called\nwith any positional or keyword arguments that are also passed\nto *note assertRaises(): 281.  The test passes if 'exception'\nis raised, is an error if another exception is raised, or\nfails if no exception is raised.  To catch any of a group of\nexceptions, a tuple containing the exception classes may be\npassed as 'exception'.\n\nIf only the 'exception' and possibly the 'msg' arguments are\ngiven, return a context manager so that the code under test\ncan be written inline rather than as a function:\n\nwith self.assertRaises(SomeException):\ndosomething()\n\nWhen used as a context manager, *note assertRaises(): 281.\naccepts the additional keyword argument 'msg'.\n\nThe context manager will store the caught exception object in\nits 'exception' attribute.  This can be useful if the\nintention is to perform additional checks on the exception\nraised:\n\nwith self.assertRaises(SomeException) as cm:\ndosomething()\n\ntheexception = cm.exception\nself.assertEqual(theexception.errorcode, 3)\n\nChanged in version 3.1: Added the ability to use *note\nassertRaises(): 281. as a context manager.\n\nChanged in version 3.2: Added the 'exception' attribute.\n\nChanged in version 3.3: Added the 'msg' keyword argument when\nused as a context manager.\n\n-- Method: assertRaisesRegex (exception, regex, callable, *args,\nkwds)\n\n-- Method: assertRaisesRegex (exception, regex, *, msg=None)\n\nLike *note assertRaises(): 281. but also tests that 'regex'\nmatches on the string representation of the raised exception.\n'regex' may be a regular expression object or a string\ncontaining a regular expression suitable for use by *note\nre.search(): 10a2.  Examples:\n\nself.assertRaisesRegex(ValueError, \"invalid literal for.*XYZ'$\",\nint, 'XYZ')\n\nor:\n\nwith self.assertRaisesRegex(ValueError, 'literal'):\nint('XYZ')\n\nNew in version 3.1: Added under the name 'assertRaisesRegexp'.\n\nChanged in version 3.2: Renamed to *note assertRaisesRegex():\n283.\n\nChanged in version 3.3: Added the 'msg' keyword argument when\nused as a context manager.\n\n-- Method: assertWarns (warning, callable, *args, kwds)\n\n-- Method: assertWarns (warning, *, msg=None)\n\nTest that a warning is triggered when 'callable' is called\nwith any positional or keyword arguments that are also passed\nto *note assertWarns(): fd9.  The test passes if 'warning' is\ntriggered and fails if it isn't.  Any exception is an error.\nTo catch any of a group of warnings, a tuple containing the\nwarning classes may be passed as 'warnings'.\n\nIf only the 'warning' and possibly the 'msg' arguments are\ngiven, return a context manager so that the code under test\ncan be written inline rather than as a function:\n\nwith self.assertWarns(SomeWarning):\ndosomething()\n\nWhen used as a context manager, *note assertWarns(): fd9.\naccepts the additional keyword argument 'msg'.\n\nThe context manager will store the caught warning object in\nits 'warning' attribute, and the source line which triggered\nthe warnings in the 'filename' and 'lineno' attributes.  This\ncan be useful if the intention is to perform additional checks\non the warning caught:\n\nwith self.assertWarns(SomeWarning) as cm:\ndosomething()\n\nself.assertIn('myfile.py', cm.filename)\nself.assertEqual(320, cm.lineno)\n\nThis method works regardless of the warning filters in place\nwhen it is called.\n\nNew in version 3.2.\n\nChanged in version 3.3: Added the 'msg' keyword argument when\nused as a context manager.\n\n-- Method: assertWarnsRegex (warning, regex, callable, *args,\nkwds)\n\n-- Method: assertWarnsRegex (warning, regex, *, msg=None)\n\nLike *note assertWarns(): fd9. but also tests that 'regex'\nmatches on the message of the triggered warning.  'regex' may\nbe a regular expression object or a string containing a\nregular expression suitable for use by *note re.search():\n10a2.  Example:\n\nself.assertWarnsRegex(DeprecationWarning,\nr'legacyfunction\\(\\) is deprecated',\nlegacyfunction, 'XYZ')\n\nor:\n\nwith self.assertWarnsRegex(RuntimeWarning, 'unsafe frobnicating'):\nfrobnicate('/etc/passwd')\n\nNew in version 3.2.\n\nChanged in version 3.3: Added the 'msg' keyword argument when\nused as a context manager.\n\n-- Method: assertLogs (logger=None, level=None)\n\nA context manager to test that at least one message is logged\non the 'logger' or one of its children, with at least the\ngiven 'level'.\n\nIf given, 'logger' should be a *note logging.Logger: 98b.\nobject or a *note str: 157. giving the name of a logger.  The\ndefault is the root logger, which will catch all messages that\nwere not blocked by a non-propagating descendent logger.\n\nIf given, 'level' should be either a numeric logging level or\nits string equivalent (for example either '\"ERROR\"' or *note\nlogging.ERROR: 1a79.).  The default is *note logging.INFO:\n1a77.\n\nThe test passes if at least one message emitted inside the\n'with' block matches the 'logger' and 'level' conditions,\notherwise it fails.\n\nThe object returned by the context manager is a recording\nhelper which keeps tracks of the matching log messages.  It\nhas two attributes:\n\n-- Attribute: records\n\nA list of *note logging.LogRecord: e59. objects of the\nmatching log messages.\n\n-- Attribute: output\n\nA list of *note str: 157. objects with the formatted\noutput of matching messages.\n\nExample:\n\nwith self.assertLogs('foo', level='INFO') as cm:\nlogging.getLogger('foo').info('first message')\nlogging.getLogger('foo.bar').error('second message')\nself.assertEqual(cm.output, ['INFO:foo:first message',\n'ERROR:foo.bar:second message'])\n\nNew in version 3.4.\n\n-- Method: assertNoLogs (logger=None, level=None)\n\nA context manager to test that no messages are logged on the\n'logger' or one of its children, with at least the given\n'level'.\n\nIf given, 'logger' should be a *note logging.Logger: 98b.\nobject or a *note str: 157. giving the name of a logger.  The\ndefault is the root logger, which will catch all messages.\n\nIf given, 'level' should be either a numeric logging level or\nits string equivalent (for example either '\"ERROR\"' or *note\nlogging.ERROR: 1a79.).  The default is *note logging.INFO:\n1a77.\n\nUnlike *note assertLogs(): 64f, nothing will be returned by\nthe context manager.\n\nNew in version 3.10.\n\nThere are also other methods used to perform more specific checks,\nsuch as:\n\nMethod                                      Checks that                          New in\n\n----------------------------------------------------------------------------------------------------\n\n*note assertAlmostEqual(a, b): 27f.         'round(a-b, 7) == 0'\n\n\n*note assertNotAlmostEqual(a, b): 280.      'round(a-b, 7) != 0'\n\n\n*note assertGreater(a, b): 11b8.            'a > b'                              3.1\n\n\n*note assertGreaterEqual(a, b): 11b9.       'a >= b'                             3.1\n\n\n*note assertLess(a, b): 11ba.               'a < b'                              3.1\n\n\n*note assertLessEqual(a, b): 11bb.          'a <= b'                             3.1\n\n\n*note assertRegex(s, r): 282.               'r.search(s)'                        3.1\n\n\n*note assertNotRegex(s, r): 284.            'not r.search(s)'                    3.2\n\n\n*note assertCountEqual(a, b): 10a0.         'a' and 'b' have the same elements   3.2\nin the same number, regardless of\ntheir order.\n\n\n-- Method: assertAlmostEqual (first, second, places=7, msg=None,\ndelta=None)\n-- Method: assertNotAlmostEqual (first, second, places=7,\nmsg=None, delta=None)\n\nTest that 'first' and 'second' are approximately (or not\napproximately) equal by computing the difference, rounding to\nthe given number of decimal 'places' (default 7), and\ncomparing to zero.  Note that these methods round the values\nto the given number of 'decimal places' (i.e.  like the *note\nround(): 114f. function) and not 'significant digits'.\n\nIf 'delta' is supplied instead of 'places' then the difference\nbetween 'first' and 'second' must be less or equal to (or\ngreater than) 'delta'.\n\nSupplying both 'delta' and 'places' raises a *note TypeError:\n28e.\n\nChanged in version 3.2: *note assertAlmostEqual(): 27f.\nautomatically considers almost equal objects that compare\nequal.  *note assertNotAlmostEqual(): 280. automatically fails\nif the objects compare equal.  Added the 'delta' keyword\nargument.\n\n-- Method: assertGreater (first, second, msg=None)\n-- Method: assertGreaterEqual (first, second, msg=None)\n-- Method: assertLess (first, second, msg=None)\n-- Method: assertLessEqual (first, second, msg=None)\n\nTest that 'first' is respectively >, >=, < or <= than 'second'\ndepending on the method name.  If not, the test will fail:\n\n>>> self.assertGreaterEqual(3, 4)\nAssertionError: \"3\" unexpectedly not greater than or equal to \"4\"\n\nNew in version 3.1.\n\n-- Method: assertRegex (text, regex, msg=None)\n-- Method: assertNotRegex (text, regex, msg=None)\n\nTest that a 'regex' search matches (or does not match) 'text'.\nIn case of failure, the error message will include the pattern\nand the 'text' (or the pattern and the part of 'text' that\nunexpectedly matched).  'regex' may be a regular expression\nobject or a string containing a regular expression suitable\nfor use by *note re.search(): 10a2.\n\nNew in version 3.1: Added under the name\n'assertRegexpMatches'.\n\nChanged in version 3.2: The method 'assertRegexpMatches()' has\nbeen renamed to *note assertRegex(): 282.\n\nNew in version 3.2: *note assertNotRegex(): 284.\n\n-- Method: assertCountEqual (first, second, msg=None)\n\nTest that sequence 'first' contains the same elements as\n'second', regardless of their order.  When they don't, an\nerror message listing the differences between the sequences\nwill be generated.\n\nDuplicate elements are 'not' ignored when comparing 'first'\nand 'second'.  It verifies whether each element has the same\ncount in both sequences.  Equivalent to:\n'assertEqual(Counter(list(first)), Counter(list(second)))' but\nworks with sequences of unhashable objects as well.\n\nNew in version 3.2.\n\nThe *note assertEqual(): 27d. method dispatches the equality check\nfor objects of the same type to different type-specific methods.\nThese methods are already implemented for most of the built-in\ntypes, but it's also possible to register new methods using *note\naddTypeEqualityFunc(): 11c1.:\n\n-- Method: addTypeEqualityFunc (typeobj, function)\n\nRegisters a type-specific method called by *note\nassertEqual(): 27d. to check if two objects of exactly the\nsame 'typeobj' (not subclasses) compare equal.  'function'\nmust take two positional arguments and a third msg=None\nkeyword argument just as *note assertEqual(): 27d. does.  It\nmust raise *note self.failureException(msg): 3cec. when\ninequality between the first two parameters is detected -\npossibly providing useful information and explaining the\ninequalities in details in the error message.\n\nNew in version 3.1.\n\nThe list of type-specific methods automatically used by *note\nassertEqual(): 27d. are summarized in the following table.  Note\nthat it's usually not necessary to invoke these methods directly.\n\nMethod                                        Used to compare                   New in\n\n---------------------------------------------------------------------------------------------------\n\n*note assertMultiLineEqual(a, b): 11bc.       strings                           3.1\n\n\n*note assertSequenceEqual(a, b): 1102.        sequences                         3.1\n\n\n*note assertListEqual(a, b): 1100.            lists                             3.1\n\n\n*note assertTupleEqual(a, b): 1101.           tuples                            3.1\n\n\n*note assertSetEqual(a, b): 10fe.             sets or frozensets                3.1\n\n\n*note assertDictEqual(a, b): 10ff.            dicts                             3.1\n\n\n-- Method: assertMultiLineEqual (first, second, msg=None)\n\nTest that the multiline string 'first' is equal to the string\n'second'.  When not equal a diff of the two strings\nhighlighting the differences will be included in the error\nmessage.  This method is used by default when comparing\nstrings with *note assertEqual(): 27d.\n\nNew in version 3.1.\n\n-- Method: assertSequenceEqual (first, second, msg=None,\nseqtype=None)\n\nTests that two sequences are equal.  If a 'seqtype' is\nsupplied, both 'first' and 'second' must be instances of\n'seqtype' or a failure will be raised.  If the sequences are\ndifferent an error message is constructed that shows the\ndifference between the two.\n\nThis method is not called directly by *note assertEqual():\n27d, but it's used to implement *note assertListEqual(): 1100.\nand *note assertTupleEqual(): 1101.\n\nNew in version 3.1.\n\n-- Method: assertListEqual (first, second, msg=None)\n-- Method: assertTupleEqual (first, second, msg=None)\n\nTests that two lists or tuples are equal.  If not, an error\nmessage is constructed that shows only the differences between\nthe two.  An error is also raised if either of the parameters\nare of the wrong type.  These methods are used by default when\ncomparing lists or tuples with *note assertEqual(): 27d.\n\nNew in version 3.1.\n\n-- Method: assertSetEqual (first, second, msg=None)\n\nTests that two sets are equal.  If not, an error message is\nconstructed that lists the differences between the sets.  This\nmethod is used by default when comparing sets or frozensets\nwith *note assertEqual(): 27d.\n\nFails if either of 'first' or 'second' does not have a\n'set.difference()' method.\n\nNew in version 3.1.\n\n-- Method: assertDictEqual (first, second, msg=None)\n\nTest that two dictionaries are equal.  If not, an error\nmessage is constructed that shows the differences in the\ndictionaries.  This method will be used by default to compare\ndictionaries in calls to *note assertEqual(): 27d.\n\nNew in version 3.1.\n\nFinally the *note TestCase: 159. provides the following methods and\nattributes:\n\n-- Method: fail (msg=None)\n\nSignals a test failure unconditionally, with 'msg' or 'None'\nfor the error message.\n\n-- Attribute: failureException\n\nThis class attribute gives the exception raised by the test\nmethod.  If a test framework needs to use a specialized\nexception, possibly to carry additional information, it must\nsubclass this exception in order to \"play fair\" with the\nframework.  The initial value of this attribute is *note\nAssertionError: 476.\n\n-- Attribute: longMessage\n\nThis class attribute determines what happens when a custom\nfailure message is passed as the msg argument to an assertXYY\ncall that fails.  'True' is the default value.  In this case,\nthe custom message is appended to the end of the standard\nfailure message.  When set to 'False', the custom message\nreplaces the standard message.\n\nThe class setting can be overridden in individual test methods\nby assigning an instance attribute, self.longMessage, to\n'True' or 'False' before calling the assert methods.\n\nThe class setting gets reset before each test call.\n\nNew in version 3.1.\n\n-- Attribute: maxDiff\n\nThis attribute controls the maximum length of diffs output by\nassert methods that report diffs on failure.  It defaults to\n80*8 characters.  Assert methods affected by this attribute\nare *note assertSequenceEqual(): 1102. (including all the\nsequence comparison methods that delegate to it), *note\nassertDictEqual(): 10ff. and *note assertMultiLineEqual():\n11bc.\n\nSetting 'maxDiff' to 'None' means that there is no maximum\nlength of diffs.\n\nNew in version 3.2.\n\nTesting frameworks can use the following methods to collect\ninformation on the test:\n\n-- Method: countTestCases ()\n\nReturn the number of tests represented by this test object.\nFor *note TestCase: 159. instances, this will always be '1'.\n\n-- Method: defaultTestResult ()\n\nReturn an instance of the test result class that should be\nused for this test case class (if no other result instance is\nprovided to the *note run(): fdb. method).\n\nFor *note TestCase: 159. instances, this will always be an\ninstance of *note TestResult: fdc.; subclasses of *note\nTestCase: 159. should override this as necessary.\n\n-- Method: id ()\n\nReturn a string identifying the specific test case.  This is\nusually the full name of the test method, including the module\nand class name.\n\n-- Method: shortDescription ()\n\nReturns a description of the test, or 'None' if no description\nhas been provided.  The default implementation of this method\nreturns the first line of the test method's docstring, if\navailable, or 'None'.\n\nChanged in version 3.1: In 3.1 this was changed to add the\ntest name to the short description even in the presence of a\ndocstring.  This caused compatibility issues with unittest\nextensions and adding the test name was moved to the *note\nTextTestResult: 286. in Python 3.2.\n\n-- Method: addCleanup (function, /, *args, kwargs)\n\nAdd a function to be called after *note tearDown(): 11b3. to\ncleanup resources used during the test.  Functions will be\ncalled in reverse order to the order they are added (LIFO).\nThey are called with any arguments and keyword arguments\npassed into *note addCleanup(): 8af. when they are added.\n\nIf *note setUp(): 11b2. fails, meaning that *note tearDown():\n11b3. is not called, then any cleanup functions added will\nstill be called.\n\nNew in version 3.1.\n\n-- Method: enterContext (cm)\n\nEnter the supplied *note context manager: 398.  If successful,\nalso add its *note exit(): 1175. method as a cleanup\nfunction by *note addCleanup(): 8af. and return the result of\nthe *note enter(): 389. method.\n\nNew in version 3.11.\n\n-- Method: doCleanups ()\n\nThis method is called unconditionally after *note tearDown():\n11b3, or after *note setUp(): 11b2. if *note setUp(): 11b2.\nraises an exception.\n\nIt is responsible for calling all the cleanup functions added\nby *note addCleanup(): 8af.  If you need cleanup functions to\nbe called 'prior' to *note tearDown(): 11b3. then you can call\n*note doCleanups(): 11b1. yourself.\n\n*note doCleanups(): 11b1. pops methods off the stack of\ncleanup functions one at a time, so it can be called at any\ntime.\n\nNew in version 3.1.\n\n-- Method: classmethod addClassCleanup (function, /, *args,\nkwargs)\n\nAdd a function to be called after *note tearDownClass(): 11b0.\nto cleanup resources used during the test class.  Functions\nwill be called in reverse order to the order they are added\n(LIFO).  They are called with any arguments and keyword\narguments passed into *note addClassCleanup(): 87a. when they\nare added.\n\nIf *note setUpClass(): 87b. fails, meaning that *note\ntearDownClass(): 11b0. is not called, then any cleanup\nfunctions added will still be called.\n\nNew in version 3.8.\n\n-- Method: classmethod enterClassContext (cm)\n\nEnter the supplied *note context manager: 398.  If successful,\nalso add its *note exit(): 1175. method as a cleanup\nfunction by *note addClassCleanup(): 87a. and return the\nresult of the *note enter(): 389. method.\n\nNew in version 3.11.\n\n-- Method: classmethod doClassCleanups ()\n\nThis method is called unconditionally after *note\ntearDownClass(): 11b0, or after *note setUpClass(): 87b. if\n*note setUpClass(): 87b. raises an exception.\n\nIt is responsible for calling all the cleanup functions added\nby *note addClassCleanup(): 87a.  If you need cleanup\nfunctions to be called 'prior' to *note tearDownClass(): 11b0.\nthen you can call *note doClassCleanups(): 3cf2. yourself.\n\n*note doClassCleanups(): 3cf2. pops methods off the stack of\ncleanup functions one at a time, so it can be called at any\ntime.\n\nNew in version 3.8.\n\n-- Class: unittest.IsolatedAsyncioTestCase (methodName='runTest')\n\nThis class provides an API similar to *note TestCase: 159. and also\naccepts coroutines as test functions.\n\nNew in version 3.8.\n\n-- Method: coroutine asyncSetUp ()\n\nMethod called to prepare the test fixture.  This is called\nafter 'setUp()'.  This is called immediately before calling\nthe test method; other than *note AssertionError: 476. or\n*note SkipTest: e57, any exception raised by this method will\nbe considered an error rather than a test failure.  The\ndefault implementation does nothing.\n\n-- Method: coroutine asyncTearDown ()\n\nMethod called immediately after the test method has been\ncalled and the result recorded.  This is called before\n'tearDown()'.  This is called even if the test method raised\nan exception, so the implementation in subclasses may need to\nbe particularly careful about checking internal state.  Any\nexception, other than *note AssertionError: 476. or *note\nSkipTest: e57, raised by this method will be considered an\nadditional error rather than a test failure (thus increasing\nthe total number of reported errors).  This method will only\nbe called if the *note asyncSetUp(): 3cf3. succeeds,\nregardless of the outcome of the test method.  The default\nimplementation does nothing.\n\n-- Method: addAsyncCleanup (function, /, *args, kwargs)\n\nThis method accepts a coroutine that can be used as a cleanup\nfunction.\n\n-- Method: coroutine enterAsyncContext (cm)\n\nEnter the supplied *note asynchronous context manager: 39b.\nIf successful, also add its *note aexit(): 1cd8. method as\na cleanup function by *note addAsyncCleanup(): 3cf5. and\nreturn the result of the *note aenter(): 1cd7. method.\n\nNew in version 3.11.\n\n-- Method: run (result=None)\n\nSets up a new event loop to run the test, collecting the\nresult into the *note TestResult: fdc. object passed as\n'result'.  If 'result' is omitted or 'None', a temporary\nresult object is created (by calling the 'defaultTestResult()'\nmethod) and used.  The result object is returned to *note\nrun(): 3cf6.'s caller.  At the end of the test all the tasks\nin the event loop are cancelled.\n\nAn example illustrating the order:\n\nfrom unittest import IsolatedAsyncioTestCase\n\nevents = []\n\n\nclass Test(IsolatedAsyncioTestCase):\n\n\ndef setUp(self):\nevents.append(\"setUp\")\n\nasync def asyncSetUp(self):\nself.asyncconnection = await AsyncConnection()\nevents.append(\"asyncSetUp\")\n\nasync def testresponse(self):\nevents.append(\"testresponse\")\nresponse = await self.asyncconnection.get(\"https://example.com\")\nself.assertEqual(response.statuscode, 200)\nself.addAsyncCleanup(self.oncleanup)\n\ndef tearDown(self):\nevents.append(\"tearDown\")\n\nasync def asyncTearDown(self):\nawait self.asyncconnection.close()\nevents.append(\"asyncTearDown\")\n\nasync def oncleanup(self):\nevents.append(\"cleanup\")\n\nif name == \"main\":\nunittest.main()\n\nAfter running the test, 'events' would contain '[\"setUp\",\n\"asyncSetUp\", \"testresponse\", \"asyncTearDown\", \"tearDown\",\n\"cleanup\"]'.\n\n-- Class: unittest.FunctionTestCase (testFunc, setUp=None,\ntearDown=None, description=None)\n\nThis class implements the portion of the *note TestCase: 159.\ninterface which allows the test runner to drive the test, but does\nnot provide the methods which test code can use to check and report\nerrors.  This is used to create test cases using legacy test code,\nallowing it to be integrated into a *note unittest: 101.-based test\nframework.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Grouping tests,  Next: Loading and running tests,  Prev: Test cases,  Up: Classes and functions": {
            "content": "5.26.5.11 Grouping tests\n........................\n\n-- Class: unittest.TestSuite (tests=())\n\nThis class represents an aggregation of individual test cases and\ntest suites.  The class presents the interface needed by the test\nrunner to allow it to be run as any other test case.  Running a\n*note TestSuite: c51. instance is the same as iterating over the\nsuite, running each test individually.\n\nIf 'tests' is given, it must be an iterable of individual test\ncases or other test suites that will be used to build the suite\ninitially.  Additional methods are provided to add test cases and\nsuites to the collection later on.\n\n*note TestSuite: c51. objects behave much like *note TestCase: 159.\nobjects, except they do not actually implement a test.  Instead,\nthey are used to aggregate tests into groups of tests that should\nbe run together.  Some additional methods are available to add\ntests to *note TestSuite: c51. instances:\n\n-- Method: addTest (test)\n\nAdd a *note TestCase: 159. or *note TestSuite: c51. to the\nsuite.\n\n-- Method: addTests (tests)\n\nAdd all the tests from an iterable of *note TestCase: 159. and\n*note TestSuite: c51. instances to this test suite.\n\nThis is equivalent to iterating over 'tests', calling *note\naddTest(): 3cf9. for each element.\n\n*note TestSuite: c51. shares the following methods with *note\nTestCase: 159.:\n\n-- Method: run (result)\n\nRun the tests associated with this suite, collecting the\nresult into the test result object passed as 'result'.  Note\nthat unlike *note TestCase.run(): fdb, *note TestSuite.run():\n3cfb. requires the result object to be passed in.\n\n-- Method: debug ()\n\nRun the tests associated with this suite without collecting\nthe result.  This allows exceptions raised by the test to be\npropagated to the caller and can be used to support running\ntests under a debugger.\n\n-- Method: countTestCases ()\n\nReturn the number of tests represented by this test object,\nincluding all individual tests and sub-suites.\n\n-- Method: iter ()\n\nTests grouped by a *note TestSuite: c51. are always accessed\nby iteration.  Subclasses can lazily provide tests by\noverriding 'iter()'.  Note that this method may be called\nseveral times on a single suite (for example when counting\ntests or comparing for equality) so the tests returned by\nrepeated iterations before *note TestSuite.run(): 3cfb. must\nbe the same for each call iteration.  After *note\nTestSuite.run(): 3cfb, callers should not rely on the tests\nreturned by this method unless the caller uses a subclass that\noverrides 'TestSuite.removeTestAtIndex()' to preserve test\nreferences.\n\nChanged in version 3.2: In earlier versions the *note\nTestSuite: c51. accessed tests directly rather than through\niteration, so overriding 'iter()' wasn't sufficient for\nproviding tests.\n\nChanged in version 3.4: In earlier versions the *note\nTestSuite: c51. held references to each *note TestCase: 159.\nafter *note TestSuite.run(): 3cfb.  Subclasses can restore\nthat behavior by overriding 'TestSuite.removeTestAtIndex()'.\n\nIn the typical usage of a *note TestSuite: c51. object, the *note\nrun(): 3cfb. method is invoked by a 'TestRunner' rather than by the\nend-user test harness.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Loading and running tests,  Prev: Grouping tests,  Up: Classes and functions": {
            "content": "5.26.5.12 Loading and running tests\n...................................\n\n-- Class: unittest.TestLoader\n\nThe *note TestLoader: 506. class is used to create test suites from\nclasses and modules.  Normally, there is no need to create an\ninstance of this class; the *note unittest: 101. module provides an\ninstance that can be shared as *note unittest.defaultTestLoader:\n3cff.  Using a subclass or instance, however, allows customization\nof some configurable properties.\n\n*note TestLoader: 506. objects have the following attributes:\n\n-- Attribute: errors\n\nA list of the non-fatal errors encountered while loading\ntests.  Not reset by the loader at any point.  Fatal errors\nare signalled by the relevant method raising an exception to\nthe caller.  Non-fatal errors are also indicated by a\nsynthetic test that will raise the original error when run.\n\nNew in version 3.5.\n\n*note TestLoader: 506. objects have the following methods:\n\n-- Method: loadTestsFromTestCase (testCaseClass)\n\nReturn a suite of all test cases contained in the *note\nTestCase: 159.-derived 'testCaseClass'.\n\nA test case instance is created for each method named by *note\ngetTestCaseNames(): 508.  By default these are the method\nnames beginning with 'test'.  If *note getTestCaseNames():\n508. returns no methods, but the 'runTest()' method is\nimplemented, a single test case is created for that method\ninstead.\n\n-- Method: loadTestsFromModule (module, *, pattern=None)\n\nReturn a suite of all test cases contained in the given\nmodule.  This method searches 'module' for classes derived\nfrom *note TestCase: 159. and creates an instance of the class\nfor each test method defined for the class.\n\nNote: While using a hierarchy of *note TestCase:\n159.-derived classes can be convenient in sharing\nfixtures and helper functions, defining test methods on\nbase classes that are not intended to be instantiated\ndirectly does not play well with this method.  Doing so,\nhowever, can be useful when the fixtures are different\nand defined in subclasses.\n\nIf a module provides a 'loadtests' function it will be called\nto load the tests.  This allows modules to customize test\nloading.  This is the *note loadtests protocol: 3cd8.  The\n'pattern' argument is passed as the third argument to\n'loadtests'.\n\nChanged in version 3.2: Support for 'loadtests' added.\n\nChanged in version 3.5: Support for a keyword-only argument\n'pattern' has been added.\n\nChanged in version 3.12: The undocumented and unofficial\n'useloadtests' parameter has been removed.\n\n-- Method: loadTestsFromName (name, module=None)\n\nReturn a suite of all test cases given a string specifier.\n\nThe specifier 'name' is a \"dotted name\" that may resolve\neither to a module, a test case class, a test method within a\ntest case class, a *note TestSuite: c51. instance, or a\ncallable object which returns a *note TestCase: 159. or *note\nTestSuite: c51. instance.  These checks are applied in the\norder listed here; that is, a method on a possible test case\nclass will be picked up as \"a test method within a test case\nclass\", rather than \"a callable object\".\n\nFor example, if you have a module 'SampleTests' containing a\n*note TestCase: 159.-derived class 'SampleTestCase' with three\ntest methods ('testone()', 'testtwo()', and 'testthree()'),\nthe specifier ''SampleTests.SampleTestCase'' would cause this\nmethod to return a suite which will run all three test\nmethods.  Using the specifier\n''SampleTests.SampleTestCase.testtwo'' would cause it to\nreturn a test suite which will run only the 'testtwo()' test\nmethod.  The specifier can refer to modules and packages which\nhave not been imported; they will be imported as a\nside-effect.\n\nThe method optionally resolves 'name' relative to the given\n'module'.\n\nChanged in version 3.5: If an *note ImportError: 145. or *note\nAttributeError: 395. occurs while traversing 'name' then a\nsynthetic test that raises that error when run will be\nreturned.  These errors are included in the errors accumulated\nby self.errors.\n\n-- Method: loadTestsFromNames (names, module=None)\n\nSimilar to *note loadTestsFromName(): 11bf, but takes a\nsequence of names rather than a single name.  The return value\nis a test suite which supports all the tests defined for each\nname.\n\n-- Method: getTestCaseNames (testCaseClass)\n\nReturn a sorted sequence of method names found within\n'testCaseClass'; this should be a subclass of *note TestCase:\n159.\n\n-- Method: discover (startdir, pattern='test*.py',\ntopleveldir=None)\n\nFind all the test modules by recursing into subdirectories\nfrom the specified start directory, and return a TestSuite\nobject containing them.  Only test files that match 'pattern'\nwill be loaded.  (Using shell style pattern matching.)  Only\nmodule names that are importable (i.e.  are valid Python\nidentifiers) will be loaded.\n\nAll test modules must be importable from the top level of the\nproject.  If the start directory is not the top level\ndirectory then the top level directory must be specified\nseparately.\n\nIf importing a module fails, for example due to a syntax\nerror, then this will be recorded as a single error and\ndiscovery will continue.  If the import failure is due to\n*note SkipTest: e57. being raised, it will be recorded as a\nskip instead of an error.\n\nIf a package (a directory containing a file named\n'init.py') is found, the package will be checked for a\n'loadtests' function.  If this exists then it will be called\n'package.loadtests(loader, tests, pattern)'.  Test discovery\ntakes care to ensure that a package is only checked for tests\nonce during an invocation, even if the loadtests function\nitself calls 'loader.discover'.\n\nIf 'loadtests' exists then discovery does 'not' recurse into\nthe package, 'loadtests' is responsible for loading all tests\nin the package.\n\nThe pattern is deliberately not stored as a loader attribute\nso that packages can continue discovery themselves.\n'topleveldir' is stored so 'loadtests' does not need to\npass this argument in to 'loader.discover()'.\n\n'startdir' can be a dotted module name as well as a\ndirectory.\n\nNew in version 3.2.\n\nChanged in version 3.4: Modules that raise *note SkipTest:\ne57. on import are recorded as skips, not errors.\n\nChanged in version 3.4: 'startdir' can be a *note namespace\npackages: 19ed.\n\nChanged in version 3.4: Paths are sorted before being imported\nso that execution order is the same even if the underlying\nfile system's ordering is not dependent on file name.\n\nChanged in version 3.5: Found packages are now checked for\n'loadtests' regardless of whether their path matches\n'pattern', because it is impossible for a package name to\nmatch the default pattern.\n\nChanged in version 3.11: 'startdir' can not be a *note\nnamespace packages: 19ed.  It has been broken since Python 3.7\nand Python 3.11 officially remove it.\n\nThe following attributes of a *note TestLoader: 506. can be\nconfigured either by subclassing or assignment on an instance:\n\n-- Attribute: testMethodPrefix\n\nString giving the prefix of method names which will be\ninterpreted as test methods.  The default value is ''test''.\n\nThis affects *note getTestCaseNames(): 508. and all the\n'loadTestsFrom*' methods.\n\n-- Attribute: sortTestMethodsUsing\n\nFunction to be used to compare method names when sorting them\nin *note getTestCaseNames(): 508. and all the 'loadTestsFrom*'\nmethods.\n\n-- Attribute: suiteClass\n\nCallable object that constructs a test suite from a list of\ntests.  No methods on the resulting object are needed.  The\ndefault value is the *note TestSuite: c51. class.\n\nThis affects all the 'loadTestsFrom*' methods.\n\n-- Attribute: testNamePatterns\n\nList of Unix shell-style wildcard test name patterns that test\nmethods have to match to be included in test suites (see '-k'\noption).\n\nIf this attribute is not 'None' (the default), all test\nmethods to be included in test suites must match one of the\npatterns in this list.  Note that matches are always performed\nusing *note fnmatch.fnmatchcase(): 1602, so unlike patterns\npassed to the '-k' option, simple substring patterns will have\nto be converted using '*' wildcards.\n\nThis affects all the 'loadTestsFrom*' methods.\n\nNew in version 3.7.\n\n-- Class: unittest.TestResult\n\nThis class is used to compile information about which tests have\nsucceeded and which have failed.\n\nA *note TestResult: fdc. object stores the results of a set of\ntests.  The *note TestCase: 159. and *note TestSuite: c51. classes\nensure that results are properly recorded; test authors do not need\nto worry about recording the outcome of tests.\n\nTesting frameworks built on top of *note unittest: 101. may want\naccess to the *note TestResult: fdc. object generated by running a\nset of tests for reporting purposes; a *note TestResult: fdc.\ninstance is returned by the 'TestRunner.run()' method for this\npurpose.\n\n*note TestResult: fdc. instances have the following attributes that\nwill be of interest when inspecting the results of running a set of\ntests:\n\n-- Attribute: errors\n\nA list containing 2-tuples of *note TestCase: 159. instances\nand strings holding formatted tracebacks.  Each tuple\nrepresents a test which raised an unexpected exception.\n\n-- Attribute: failures\n\nA list containing 2-tuples of *note TestCase: 159. instances\nand strings holding formatted tracebacks.  Each tuple\nrepresents a test where a failure was explicitly signalled\nusing the *note assert* methods: 3cc0.\n\n-- Attribute: skipped\n\nA list containing 2-tuples of *note TestCase: 159. instances\nand strings holding the reason for skipping the test.\n\nNew in version 3.1.\n\n-- Attribute: expectedFailures\n\nA list containing 2-tuples of *note TestCase: 159. instances\nand strings holding formatted tracebacks.  Each tuple\nrepresents an expected failure or error of the test case.\n\n-- Attribute: unexpectedSuccesses\n\nA list containing *note TestCase: 159. instances that were\nmarked as expected failures, but succeeded.\n\n-- Attribute: collectedDurations\n\nA list containing 2-tuples of test case names and floats\nrepresenting the elapsed time of each test which was run.\n\nNew in version 3.12.\n\n-- Attribute: shouldStop\n\nSet to 'True' when the execution of tests should stop by *note\nstop(): 3d0a.\n\n-- Attribute: testsRun\n\nThe total number of tests run so far.\n\n-- Attribute: buffer\n\nIf set to true, 'sys.stdout' and 'sys.stderr' will be buffered\nin between *note startTest(): 3d0d. and *note stopTest():\n3d0e. being called.  Collected output will only be echoed onto\nthe real 'sys.stdout' and 'sys.stderr' if the test fails or\nerrors.  Any output is also attached to the failure / error\nmessage.\n\nNew in version 3.2.\n\n-- Attribute: failfast\n\nIf set to true *note stop(): 3d0a. will be called on the first\nfailure or error, halting the test run.\n\nNew in version 3.2.\n\n-- Attribute: tblocals\n\nIf set to true then local variables will be shown in\ntracebacks.\n\nNew in version 3.5.\n\n-- Method: wasSuccessful ()\n\nReturn 'True' if all tests run so far have passed, otherwise\nreturns 'False'.\n\nChanged in version 3.4: Returns 'False' if there were any\n*note unexpectedSuccesses: 3d08. from tests marked with the\n*note expectedFailure(): 3cdf. decorator.\n\n-- Method: stop ()\n\nThis method can be called to signal that the set of tests\nbeing run should be aborted by setting the *note shouldStop:\n3d09. attribute to 'True'.  'TestRunner' objects should\nrespect this flag and return without running any additional\ntests.\n\nFor example, this feature is used by the *note TextTestRunner:\n148f. class to stop the test framework when the user signals\nan interrupt from the keyboard.  Interactive tools which\nprovide 'TestRunner' implementations can use this in a similar\nmanner.\n\nThe following methods of the *note TestResult: fdc. class are used\nto maintain the internal data structures, and may be extended in\nsubclasses to support additional reporting requirements.  This is\nparticularly useful in building tools which support interactive\nreporting while tests are being run.\n\n-- Method: startTest (test)\n\nCalled when the test case 'test' is about to be run.\n\n-- Method: stopTest (test)\n\nCalled after the test case 'test' has been executed,\nregardless of the outcome.\n\n-- Method: startTestRun ()\n\nCalled once before any tests are executed.\n\nNew in version 3.1.\n\n-- Method: stopTestRun ()\n\nCalled once after all tests are executed.\n\nNew in version 3.1.\n\n-- Method: addError (test, err)\n\nCalled when the test case 'test' raises an unexpected\nexception.  'err' is a tuple of the form returned by *note\nsys.excinfo(): 456.: '(type, value, traceback)'.\n\nThe default implementation appends a tuple '(test,\nformattederr)' to the instance's *note errors: 3d04.\nattribute, where 'formattederr' is a formatted traceback\nderived from 'err'.\n\n-- Method: addFailure (test, err)\n\nCalled when the test case 'test' signals a failure.  'err' is\na tuple of the form returned by *note sys.excinfo(): 456.:\n'(type, value, traceback)'.\n\nThe default implementation appends a tuple '(test,\nformattederr)' to the instance's *note failures: 3d05.\nattribute, where 'formattederr' is a formatted traceback\nderived from 'err'.\n\n-- Method: addSuccess (test)\n\nCalled when the test case 'test' succeeds.\n\nThe default implementation does nothing.\n\n-- Method: addSkip (test, reason)\n\nCalled when the test case 'test' is skipped.  'reason' is the\nreason the test gave for skipping.\n\nThe default implementation appends a tuple '(test, reason)' to\nthe instance's *note skipped: 3d06. attribute.\n\n-- Method: addExpectedFailure (test, err)\n\nCalled when the test case 'test' fails or errors, but was\nmarked with the *note expectedFailure(): 3cdf. decorator.\n\nThe default implementation appends a tuple '(test,\nformattederr)' to the instance's *note expectedFailures:\n3d07. attribute, where 'formattederr' is a formatted\ntraceback derived from 'err'.\n\n-- Method: addUnexpectedSuccess (test)\n\nCalled when the test case 'test' was marked with the *note\nexpectedFailure(): 3cdf. decorator, but succeeded.\n\nThe default implementation appends the test to the instance's\n*note unexpectedSuccesses: 3d08. attribute.\n\n-- Method: addSubTest (test, subtest, outcome)\n\nCalled when a subtest finishes.  'test' is the test case\ncorresponding to the test method.  'subtest' is a custom *note\nTestCase: 159. instance describing the subtest.\n\nIf 'outcome' is *note None: 43f, the subtest succeeded.\nOtherwise, it failed with an exception where 'outcome' is a\ntuple of the form returned by *note sys.excinfo(): 456.:\n'(type, value, traceback)'.\n\nThe default implementation does nothing when the outcome is a\nsuccess, and records subtest failures as normal failures.\n\nNew in version 3.4.\n\n-- Method: addDuration (test, elapsed)\n\nCalled when the test case finishes.  'elapsed' is the time\nrepresented in seconds, and it includes the execution of\ncleanup functions.\n\nNew in version 3.12.\n\n-- Class: unittest.TextTestResult (stream, descriptions, verbosity, *,\ndurations=None)\n\nA concrete implementation of *note TestResult: fdc. used by the\n*note TextTestRunner: 148f.  Subclasses should accept 'kwargs' to\nensure compatibility as the interface changes.\n\nNew in version 3.2.\n\nChanged in version 3.12: Added the 'durations' keyword parameter.\n\n-- Data: unittest.defaultTestLoader\n\nInstance of the *note TestLoader: 506. class intended to be shared.\nIf no customization of the *note TestLoader: 506. is needed, this\ninstance can be used instead of repeatedly creating new instances.\n\n-- Class: unittest.TextTestRunner (stream=None, descriptions=True,\nverbosity=1, failfast=False, buffer=False, resultclass=None,\nwarnings=None, *, tblocals=False, durations=None)\n\nA basic test runner implementation that outputs results to a\nstream.  If 'stream' is 'None', the default, *note sys.stderr: 757.\nis used as the output stream.  This class has a few configurable\nparameters, but is essentially very simple.  Graphical applications\nwhich run test suites should provide alternate implementations.\nSuch implementations should accept 'kwargs' as the interface to\nconstruct runners changes when features are added to unittest.\n\nBy default this runner shows *note DeprecationWarning: 179, *note\nPendingDeprecationWarning: 6e0, *note ResourceWarning: a86. and\n*note ImportWarning: 243. even if they are *note ignored by\ndefault: 3d15.  This behavior can be overridden using Python's\n'-Wd' or '-Wa' options (see *note Warning control: 1abb.) and\nleaving 'warnings' to 'None'.\n\nChanged in version 3.2: Added the 'warnings' parameter.\n\nChanged in version 3.2: The default stream is set to *note\nsys.stderr: 757. at instantiation time rather than import time.\n\nChanged in version 3.5: Added the 'tblocals' parameter.\n\nChanged in version 3.12: Added the 'durations' parameter.\n\n-- Method: makeResult ()\n\nThis method returns the instance of 'TestResult' used by *note\nrun(): 3d17.  It is not intended to be called directly, but\ncan be overridden in subclasses to provide a custom\n'TestResult'.\n\n'makeResult()' instantiates the class or callable passed in\nthe 'TextTestRunner' constructor as the 'resultclass'\nargument.  It defaults to *note TextTestResult: 286. if no\n'resultclass' is provided.  The result class is instantiated\nwith the following arguments:\n\nstream, descriptions, verbosity\n\n-- Method: run (test)\n\nThis method is the main public interface to the\n'TextTestRunner'.  This method takes a *note TestSuite: c51.\nor *note TestCase: 159. instance.  A *note TestResult: fdc. is\ncreated by calling *note makeResult(): 3d16. and the test(s)\nare run and the results printed to stdout.\n\n-- Function: unittest.main (module='main', defaultTest=None,\nargv=None, testRunner=None,\ntestLoader=unittest.defaultTestLoader, exit=True, verbosity=1,\nfailfast=None, catchbreak=None, buffer=None, warnings=None)\n\nA command-line program that loads a set of tests from 'module' and\nruns them; this is primarily for making test modules conveniently\nexecutable.  The simplest use for this function is to include the\nfollowing line at the end of a test script:\n\nif name == 'main':\nunittest.main()\n\nYou can run tests with more detailed information by passing in the\nverbosity argument:\n\nif name == 'main':\nunittest.main(verbosity=2)\n\nThe 'defaultTest' argument is either the name of a single test or\nan iterable of test names to run if no test names are specified via\n'argv'.  If not specified or 'None' and no test names are provided\nvia 'argv', all tests found in 'module' are run.\n\nThe 'argv' argument can be a list of options passed to the program,\nwith the first element being the program name.  If not specified or\n'None', the values of *note sys.argv: 10dd. are used.\n\nThe 'testRunner' argument can either be a test runner class or an\nalready created instance of it.  By default 'main' calls *note\nsys.exit(): 11c2. with an exit code indicating success (0) or\nfailure (1) of the tests run.  An exit code of 5 indicates that no\ntests were run or skipped.\n\nThe 'testLoader' argument has to be a *note TestLoader: 506.\ninstance, and defaults to *note defaultTestLoader: 3cff.\n\n'main' supports being used from the interactive interpreter by\npassing in the argument 'exit=False'.  This displays the result on\nstandard output without calling *note sys.exit(): 11c2.:\n\n>>> from unittest import main\n>>> main(module='testmodule', exit=False)\n\nThe 'failfast', 'catchbreak' and 'buffer' parameters have the same\neffect as the same-name *note command-line options: 3cc7.\n\nThe 'warnings' argument specifies the *note warning filter: 6e1.\nthat should be used while running the tests.  If it's not\nspecified, it will remain 'None' if a '-W' option is passed to\n'python' (see *note Warning control: 1abb.), otherwise it will be\nset to ''default''.\n\nCalling 'main' actually returns an instance of the 'TestProgram'\nclass.  This stores the result of the tests run as the 'result'\nattribute.\n\nChanged in version 3.1: The 'exit' parameter was added.\n\nChanged in version 3.2: The 'verbosity', 'failfast', 'catchbreak',\n'buffer' and 'warnings' parameters were added.\n\nChanged in version 3.4: The 'defaultTest' parameter was changed to\nalso accept an iterable of test names.\n\n* Menu:\n\n* loadtests Protocol::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: loadtests Protocol,  Up: Loading and running tests": {
            "content": "5.26.5.13 loadtests Protocol\n.............................\n\nNew in version 3.2.\n",
            "subsections": []
        },
        "Modules or packages can customize how tests are loaded from them during": {
            "content": "normal test runs or test discovery by implementing a function called\n'loadtests'.\n\nIf a test module defines 'loadtests' it will be called by *note\nTestLoader.loadTestsFromModule(): 285. with the following arguments:\n\nloadtests(loader, standardtests, pattern)\n\nwhere 'pattern' is passed straight through from 'loadTestsFromModule'.\nIt defaults to 'None'.\n\nIt should return a *note TestSuite: c51.\n\n'loader' is the instance of *note TestLoader: 506. doing the loading.\n'standardtests' are the tests that would be loaded by default from the\nmodule.  It is common for test modules to only want to add or remove\ntests from the standard set of tests.  The third argument is used when\nloading packages as part of test discovery.\n\nA typical 'loadtests' function that loads tests from a specific set of\n*note TestCase: 159. classes may look like:\n\ntestcases = (TestCase1, TestCase2, TestCase3)\n\ndef loadtests(loader, tests, pattern):\nsuite = TestSuite()\nfor testclass in testcases:\ntests = loader.loadTestsFromTestCase(testclass)\nsuite.addTests(tests)\nreturn suite\n",
            "subsections": []
        },
        "If discovery is started in a directory containing a package, either from": {
            "content": "the command line or by calling *note TestLoader.discover(): e58, then\nthe package 'init.py' will be checked for 'loadtests'.  If that\nfunction does not exist, discovery will recurse into the package as\nthough it were just another directory.  Otherwise, discovery of the\npackage's tests will be left up to 'loadtests' which is called with the\nfollowing arguments:\n\nloadtests(loader, standardtests, pattern)\n\nThis should return a *note TestSuite: c51. representing all the tests\nfrom the package.  ('standardtests' will only contain tests collected\nfrom 'init.py'.)\n",
            "subsections": []
        },
        "Because the pattern is passed into 'loadtests' the package is free to": {
            "content": "continue (and potentially modify) test discovery.  A 'do nothing'\n'loadtests' function for a test package would look like:\n\ndef loadtests(loader, standardtests, pattern):\n# top level directory cached on loader instance\nthisdir = os.path.dirname(file)\npackagetests = loader.discover(startdir=thisdir, pattern=pattern)\nstandardtests.addTests(packagetests)\nreturn standardtests\n",
            "subsections": []
        },
        "Changed in version 3.5: Discovery no longer checks package names for": {
            "content": "matching 'pattern' due to the impossibility of package names matching\nthe default pattern.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Class and Module Fixtures,  Next: Signal Handling,  Prev: Classes and functions,  Up: unittest -- Unit testing framework": {
            "content": "5.26.5.14 Class and Module Fixtures\n...................................\n\nClass and module level fixtures are implemented in *note TestSuite: c51.",
            "subsections": []
        },
        "When the test suite encounters a test from a new class then": {
            "content": "'tearDownClass()' from the previous class (if there is one) is called,\nfollowed by 'setUpClass()' from the new class.\n",
            "subsections": []
        },
        "Similarly if a test is from a different module from the previous test": {
            "content": "then 'tearDownModule' from the previous module is run, followed by\n'setUpModule' from the new module.\n",
            "subsections": []
        },
        "After all the tests have run the final 'tearDownClass' and": {
            "content": "'tearDownModule' are run.\n\nNote that shared fixtures do not play well with [potential] features\nlike test parallelization and they break test isolation.  They should be\nused with care.\n",
            "subsections": []
        },
        "The default ordering of tests created by the unittest test loaders is to": {
            "content": "group all tests from the same modules and classes together.  This will\nlead to 'setUpClass' / 'setUpModule' (etc) being called exactly once per\nclass and module.  If you randomize the order, so that tests from\ndifferent modules and classes are adjacent to each other, then these\nshared fixture functions may be called multiple times in a single test\nrun.\n",
            "subsections": []
        },
        "Shared fixtures are not intended to work with suites with non-standard": {
            "content": "ordering.  A 'BaseTestSuite' still exists for frameworks that don't want\nto support shared fixtures.\n",
            "subsections": []
        },
        "If there are any exceptions raised during one of the shared fixture": {
            "content": "functions the test is reported as an error.  Because there is no\ncorresponding test instance an 'ErrorHolder' object (that has the same\ninterface as a *note TestCase: 159.) is created to represent the error.",
            "subsections": []
        },
        "If you are just using the standard unittest test runner then this detail": {
            "content": "doesn't matter, but if you are a framework author it may be relevant.\n\n* Menu:\n\n* setUpClass and tearDownClass::\n* setUpModule and tearDownModule::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: setUpClass and tearDownClass,  Next: setUpModule and tearDownModule,  Up: Class and Module Fixtures": {
            "content": "5.26.5.15 setUpClass and tearDownClass\n......................................\n\nThese must be implemented as class methods:\n\nimport unittest\n\nclass Test(unittest.TestCase):\n@classmethod\ndef setUpClass(cls):\ncls.connection = createExpensiveConnectionObject()\n\n@classmethod\ndef tearDownClass(cls):\ncls.connection.destroy()\n",
            "subsections": []
        },
        "If you want the 'setUpClass' and 'tearDownClass' on base classes called": {
            "content": "then you must call up to them yourself.  The implementations in *note\nTestCase: 159. are empty.\n",
            "subsections": []
        },
        "If an exception is raised during a 'setUpClass' then the tests in the": {
            "content": "class are not run and the 'tearDownClass' is not run.  Skipped classes\nwill not have 'setUpClass' or 'tearDownClass' run.  If the exception is\na *note SkipTest: e57. exception then the class will be reported as\nhaving been skipped instead of as an error.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: setUpModule and tearDownModule,  Prev: setUpClass and tearDownClass,  Up: Class and Module Fixtures": {
            "content": "5.26.5.16 setUpModule and tearDownModule\n........................................\n\nThese should be implemented as functions:\n\ndef setUpModule():\ncreateConnection()\n\ndef tearDownModule():\ncloseConnection()\n",
            "subsections": []
        },
        "If an exception is raised in a 'setUpModule' then none of the tests in": {
            "content": "the module will be run and the 'tearDownModule' will not be run.  If the\nexception is a *note SkipTest: e57. exception then the module will be\nreported as having been skipped instead of as an error.\n",
            "subsections": []
        },
        "To add cleanup code that must be run even in the case of an exception,": {
            "content": "use 'addModuleCleanup':\n\n-- Function: unittest.addModuleCleanup (function, /, *args, kwargs)\n\nAdd a function to be called after 'tearDownModule()' to cleanup\nresources used during the test class.  Functions will be called in\nreverse order to the order they are added (LIFO).  They are called\nwith any arguments and keyword arguments passed into *note\naddModuleCleanup(): 879. when they are added.\n\nIf 'setUpModule()' fails, meaning that 'tearDownModule()' is not\ncalled, then any cleanup functions added will still be called.\n\nNew in version 3.8.\n\n-- Method: classmethod unittest.enterModuleContext (cm)\n\nEnter the supplied *note context manager: 398.  If successful, also\nadd its *note exit(): 1175. method as a cleanup function by\n*note addModuleCleanup(): 879. and return the result of the *note\nenter(): 389. method.\n\nNew in version 3.11.\n\n-- Function: unittest.doModuleCleanups ()\n\nThis function is called unconditionally after 'tearDownModule()',\nor after 'setUpModule()' if 'setUpModule()' raises an exception.\n\nIt is responsible for calling all the cleanup functions added by\n*note addModuleCleanup(): 879.  If you need cleanup functions to be\ncalled 'prior' to 'tearDownModule()' then you can call *note\ndoModuleCleanups(): 159f. yourself.\n\n*note doModuleCleanups(): 159f. pops methods off the stack of\ncleanup functions one at a time, so it can be called at any time.\n\nNew in version 3.8.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Signal Handling,  Prev: Class and Module Fixtures,  Up: unittest -- Unit testing framework": {
            "content": "5.26.5.17 Signal Handling\n.........................\n\nNew in version 3.2.\n\nThe *note -c/-catch: 11ac. command-line option to unittest, along with\nthe 'catchbreak' parameter to *note unittest.main(): e56, provide more\nfriendly handling of control-C during a test run.  With catch break\nbehavior enabled control-C will allow the currently running test to\ncomplete, and the test run will then end and report all the results so\nfar.  A second control-c will raise a *note KeyboardInterrupt: 7f5. in\nthe usual way.\n",
            "subsections": []
        },
        "The control-c handling signal handler attempts to remain compatible with": {
            "content": "code or tests that install their own *note signal.SIGINT: 63a. handler.\nIf the 'unittest' handler is called but 'isn't' the installed *note\nsignal.SIGINT: 63a. handler, i.e.  it has been replaced by the system\nunder test and delegated to, then it calls the default handler.  This\nwill normally be the expected behavior by code that replaces an\ninstalled handler and delegates to it.  For individual tests that need\n'unittest' control-c handling disabled the *note removeHandler(): 11ad.\ndecorator can be used.\n",
            "subsections": []
        },
        "There are a few utility functions for framework authors to enable": {
            "content": "control-c handling functionality within test frameworks.\n\n-- Function: unittest.installHandler ()\n\nInstall the control-c handler.  When a *note signal.SIGINT: 63a. is\nreceived (usually in response to the user pressing control-c) all\nregistered results have *note stop(): 3d0a. called.\n\n-- Function: unittest.registerResult (result)\n\nRegister a *note TestResult: fdc. object for control-c handling.\nRegistering a result stores a weak reference to it, so it doesn't\nprevent the result from being garbage collected.\n\nRegistering a *note TestResult: fdc. object has no side-effects if\ncontrol-c handling is not enabled, so test frameworks can\nunconditionally register all results they create independently of\nwhether or not handling is enabled.\n\n-- Function: unittest.removeResult (result)\n\nRemove a registered result.  Once a result has been removed then\n*note stop(): 3d0a. will no longer be called on that result object\nin response to a control-c.\n\n-- Function: unittest.removeHandler (function=None)\n\nWhen called without arguments this function removes the control-c\nhandler if it has been installed.  This function can also be used\nas a test decorator to temporarily remove the handler while the\ntest is being executed:\n\n@unittest.removeHandler\ndef testsignalhandling(self):\n...\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: unittest mock -- mock object library,  Next: unittest mock -- getting started,  Prev: unittest -- Unit testing framework,  Up: Development Tools": {
            "content": "New in version 3.3.\n\n'Source code:' Lib/unittest/mock.py(1)\n\n\n\n*note unittest.mock: 102. is a library for testing in Python.  It allows\nyou to replace parts of your system under test with mock objects and\nmake assertions about how they have been used.\n\n*note unittest.mock: 102. provides a core *note Mock: 878. class\nremoving the need to create a host of stubs throughout your test suite.",
            "subsections": []
        },
        "After performing an action, you can make assertions about which methods": {
            "content": "/ attributes were used and arguments they were called with.  You can\nalso specify return values and set needed attributes in the normal way.\n\nAdditionally, mock provides a *note patch(): cf5. decorator that handles\npatching module and class level attributes within the scope of a test,\nalong with *note sentinel: 9e3. for creating unique objects.  See the\n*note quick guide: 3d1f. for some examples of how to use *note Mock:\n878, *note MagicMock: cf4. and *note patch(): cf5.\n\nMock is designed for use with *note unittest: 101. and is based on the\n'action -> assertion' pattern instead of 'record -> replay' used by many\nmocking frameworks.\n\nThere is a backport of *note unittest.mock: 102. for earlier versions of\nPython, available as mock on PyPI(2).\n\n* Menu:\n\n* Quick Guide::\n* The Mock Class::\n* The patchers::\n* MagicMock and magic method support::\n* Helpers::\n* Order of precedence of sideeffect, returnvalue and wraps: Order of precedence of sideeffect returnvalue and wraps.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/unittest/mock.py\n\n(2) https://pypi.org/project/mock\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Quick Guide,  Next: The Mock Class,  Up: unittest mock -- mock object library": {
            "content": "5.26.6.1 Quick Guide\n....................\n\n*note Mock: 878. and *note MagicMock: cf4. objects create all attributes\nand methods as you access them and store details of how they have been\nused.  You can configure them, to specify return values or limit what\nattributes are available, and then make assertions about how they have\nbeen used:\n\n>>> from unittest.mock import MagicMock\n>>> thing = ProductionClass()\n>>> thing.method = MagicMock(returnvalue=3)\n>>> thing.method(3, 4, 5, key='value')\n3\n>>> thing.method.assertcalledwith(3, 4, 5, key='value')\n\n'sideeffect' allows you to perform side effects, including raising an\nexception when a mock is called:\n\n>>> from unittest.mock import Mock\n>>> mock = Mock(sideeffect=KeyError('foo'))\n>>> mock()\nTraceback (most recent call last):\n...\nKeyError: 'foo'\n\n>>> values = {'a': 1, 'b': 2, 'c': 3}\n>>> def sideeffect(arg):\n...     return values[arg]\n...\n>>> mock.sideeffect = sideeffect\n>>> mock('a'), mock('b'), mock('c')\n(1, 2, 3)\n>>> mock.sideeffect = [5, 4, 3, 2, 1]\n>>> mock(), mock(), mock()\n(5, 4, 3)\n\nMock has many other ways you can configure it and control its behaviour.",
            "subsections": []
        },
        "For example the 'spec' argument configures the mock to take its": {
            "content": "specification from another object.  Attempting to access attributes or\nmethods on the mock that don't exist on the spec will fail with an *note\nAttributeError: 395.\n\nThe *note patch(): cf5. decorator / context manager makes it easy to\nmock classes or objects in a module under test.  The object you specify\nwill be replaced with a mock (or other object) during the test and\nrestored when the test ends:\n\n>>> from unittest.mock import patch\n>>> @patch('module.ClassName2')\n... @patch('module.ClassName1')\n... def test(MockClass1, MockClass2):\n...     module.ClassName1()\n...     module.ClassName2()\n...     assert MockClass1 is module.ClassName1\n...     assert MockClass2 is module.ClassName2\n...     assert MockClass1.called\n...     assert MockClass2.called\n...\n>>> test()\n\nNote: When you nest patch decorators the mocks are passed in to the\ndecorated function in the same order they applied (the normal\n'Python' order that decorators are applied).  This means from the\nbottom up, so in the example above the mock for 'module.ClassName1'\nis passed in first.\n\nWith *note patch(): cf5. it matters that you patch objects in the\nnamespace where they are looked up.  This is normally\nstraightforward, but for a quick guide read *note where to patch:\n3d20.\n\nAs well as a decorator *note patch(): cf5. can be used as a context\nmanager in a with statement:\n\n>>> with patch.object(ProductionClass, 'method', returnvalue=None) as mockmethod:\n...     thing = ProductionClass()\n...     thing.method(1, 2, 3)\n...\n>>> mockmethod.assertcalledoncewith(1, 2, 3)\n\nThere is also *note patch.dict(): 176a. for setting values in a\ndictionary just during a scope and restoring the dictionary to its\noriginal state when the test ends:\n\n>>> foo = {'key': 'value'}\n>>> original = foo.copy()\n>>> with patch.dict(foo, {'newkey': 'newvalue'}, clear=True):\n...     assert foo == {'newkey': 'newvalue'}\n...\n>>> assert foo == original\n\nMock supports the mocking of Python *note magic methods: 3d21.  The\neasiest way of using magic methods is with the *note MagicMock: cf4.\nclass.  It allows you to do things like:\n\n>>> mock = MagicMock()\n>>> mock.str.returnvalue = 'foobarbaz'\n>>> str(mock)\n'foobarbaz'\n>>> mock.str.assertcalledwith()\n",
            "subsections": []
        },
        "Mock allows you to assign functions (or other Mock instances) to magic": {
            "content": "methods and they will be called appropriately.  The *note MagicMock:\ncf4. class is just a Mock variant that has all of the magic methods\npre-created for you (well, all the useful ones anyway).\n",
            "subsections": []
        },
        "The following is an example of using magic methods with the ordinary": {
            "content": "Mock class:\n\n>>> mock = Mock()\n>>> mock.str = Mock(returnvalue='wheeeeee')\n>>> str(mock)\n'wheeeeee'\n",
            "subsections": []
        },
        "For ensuring that the mock objects in your tests have the same api as": {
            "content": "the objects they are replacing, you can use *note auto-speccing: 3d22.",
            "subsections": []
        },
        "Auto-speccing can be done through the 'autospec' argument to patch, or": {
            "content": "the *note createautospec(): 13b3. function.  Auto-speccing creates mock\nobjects that have the same attributes and methods as the objects they\nare replacing, and any functions and methods (including constructors)\nhave the same call signature as the real object.\n",
            "subsections": []
        },
        "This ensures that your mocks will fail in the same way as your": {
            "content": "production code if they are used incorrectly:\n\n>>> from unittest.mock import createautospec\n>>> def function(a, b, c):\n...     pass\n...\n>>> mockfunction = createautospec(function, returnvalue='fishy')\n>>> mockfunction(1, 2, 3)\n'fishy'\n>>> mockfunction.assertcalledoncewith(1, 2, 3)\n>>> mockfunction('wrong arguments')\nTraceback (most recent call last):\n...\nTypeError: <lambda>() takes exactly 3 arguments (1 given)\n\n*note createautospec(): 13b3. can also be used on classes, where it\ncopies the signature of the 'init' method, and on callable objects\nwhere it copies the signature of the 'call' method.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The Mock Class,  Next: The patchers,  Prev: Quick Guide,  Up: unittest mock -- mock object library": {
            "content": "5.26.6.2 The Mock Class\n.......................\n\n*note Mock: 878. is a flexible mock object intended to replace the use\nof stubs and test doubles throughout your code.  Mocks are callable and\ncreate attributes as new mocks when you access them (1).  Accessing the\nsame attribute will always return the same mock.  Mocks record how you\nuse them, allowing you to make assertions about what your code has done\nto them.\n\n*note MagicMock: cf4. is a subclass of *note Mock: 878. with all the\nmagic methods pre-created and ready to use.  There are also non-callable\nvariants, useful when you are mocking out objects that aren't callable:\n*note NonCallableMock: 3d24. and *note NonCallableMagicMock: 3d25.\n\nThe *note patch(): cf5. decorators makes it easy to temporarily replace\nclasses in a particular module with a *note Mock: 878. object.  By\ndefault *note patch(): cf5. will create a *note MagicMock: cf4. for you.\nYou can specify an alternative class of *note Mock: 878. using the\n'newcallable' argument to *note patch(): cf5.\n\n-- Class: unittest.mock.Mock (spec=None, sideeffect=None,\nreturnvalue=DEFAULT, wraps=None, name=None, specset=None,\nunsafe=False, kwargs)\n\nCreate a new *note Mock: 878. object.  *note Mock: 878. takes\nseveral optional arguments that specify the behaviour of the Mock\nobject:\n\n* 'spec': This can be either a list of strings or an existing\nobject (a class or instance) that acts as the specification\nfor the mock object.  If you pass in an object then a list of\nstrings is formed by calling dir on the object (excluding\nunsupported magic attributes and methods).  Accessing any\nattribute not in this list will raise an *note AttributeError:\n395.\n\nIf 'spec' is an object (rather than a list of strings) then\n*note class: 1304. returns the class of the spec object.\nThis allows mocks to pass *note isinstance(): 14b. tests.\n\n* 'specset': A stricter variant of 'spec'.  If used, attempting\nto 'set' or get an attribute on the mock that isn't on the\nobject passed as 'specset' will raise an *note\nAttributeError: 395.\n\n* 'sideeffect': A function to be called whenever the Mock is\ncalled.  See the *note sideeffect: 3d26. attribute.  Useful\nfor raising exceptions or dynamically changing return values.\nThe function is called with the same arguments as the mock,\nand unless it returns *note DEFAULT: 3d27, the return value of\nthis function is used as the return value.\n\nAlternatively 'sideeffect' can be an exception class or\ninstance.  In this case the exception will be raised when the\nmock is called.\n\nIf 'sideeffect' is an iterable then each call to the mock\nwill return the next value from the iterable.\n\nA 'sideeffect' can be cleared by setting it to 'None'.\n\n* 'returnvalue': The value returned when the mock is called.\nBy default this is a new Mock (created on first access).  See\nthe *note returnvalue: 3d28. attribute.\n\n* 'unsafe': By default, accessing any attribute whose name\nstarts with 'assert', 'assret', 'asert', 'aseert' or 'assrt'\nwill raise an *note AttributeError: 395.  Passing\n'unsafe=True' will allow access to these attributes.\n\nNew in version 3.5.\n\n* 'wraps': Item for the mock object to wrap.  If 'wraps' is not\n'None' then calling the Mock will pass the call through to the\nwrapped object (returning the real result).  Attribute access\non the mock will return a Mock object that wraps the\ncorresponding attribute of the wrapped object (so attempting\nto access an attribute that doesn't exist will raise an *note\nAttributeError: 395.).\n\nIf the mock has an explicit 'returnvalue' set then calls are\nnot passed to the wrapped object and the 'returnvalue' is\nreturned instead.\n\n* 'name': If the mock has a name then it will be used in the\nrepr of the mock.  This can be useful for debugging.  The name\nis propagated to child mocks.\n\nMocks can also be called with arbitrary keyword arguments.  These\nwill be used to set attributes on the mock after it is created.\nSee the *note configuremock(): 3d29. method for details.\n\n-- Method: assertcalled ()\n\nAssert that the mock was called at least once.\n\n>>> mock = Mock()\n>>> mock.method()\n<Mock name='mock.method()' id='...'>\n>>> mock.method.assertcalled()\n\nNew in version 3.6.\n\n-- Method: assertcalledonce ()\n\nAssert that the mock was called exactly once.\n\n>>> mock = Mock()\n>>> mock.method()\n<Mock name='mock.method()' id='...'>\n>>> mock.method.assertcalledonce()\n>>> mock.method()\n<Mock name='mock.method()' id='...'>\n>>> mock.method.assertcalledonce()\nTraceback (most recent call last):\n...\nAssertionError: Expected 'method' to have been called once. Called 2 times.\n\nNew in version 3.6.\n\n-- Method: assertcalledwith (*args, kwargs)\n\nThis method is a convenient way of asserting that the last\ncall has been made in a particular way:\n\n>>> mock = Mock()\n>>> mock.method(1, 2, 3, test='wow')\n<Mock name='mock.method()' id='...'>\n>>> mock.method.assertcalledwith(1, 2, 3, test='wow')\n\n-- Method: assertcalledoncewith (*args, kwargs)\n\nAssert that the mock was called exactly once and that call was\nwith the specified arguments.\n\n>>> mock = Mock(returnvalue=None)\n>>> mock('foo', bar='baz')\n>>> mock.assertcalledoncewith('foo', bar='baz')\n>>> mock('other', bar='values')\n>>> mock.assertcalledoncewith('other', bar='values')\nTraceback (most recent call last):\n...\nAssertionError: Expected 'mock' to be called once. Called 2 times.\n\n-- Method: assertanycall (*args, kwargs)\n\nassert the mock has been called with the specified arguments.\n\nThe assert passes if the mock has 'ever' been called, unlike\n*note assertcalledwith(): 1799. and *note\nassertcalledoncewith(): 3d2a. that only pass if the call is\nthe most recent one, and in the case of *note\nassertcalledoncewith(): 3d2a. it must also be the only\ncall.\n\n>>> mock = Mock(returnvalue=None)\n>>> mock(1, 2, arg='thing')\n>>> mock('some', 'thing', 'else')\n>>> mock.assertanycall(1, 2, arg='thing')\n\n-- Method: asserthascalls (calls, anyorder=False)\n\nassert the mock has been called with the specified calls.  The\n*note mockcalls: 3d2d. list is checked for the calls.\n\nIf 'anyorder' is false then the calls must be sequential.\nThere can be extra calls before or after the specified calls.\n\nIf 'anyorder' is true then the calls can be in any order, but\nthey must all appear in *note mockcalls: 3d2d.\n\n>>> mock = Mock(returnvalue=None)\n>>> mock(1)\n>>> mock(2)\n>>> mock(3)\n>>> mock(4)\n>>> calls = [call(2), call(3)]\n>>> mock.asserthascalls(calls)\n>>> calls = [call(4), call(2), call(3)]\n>>> mock.asserthascalls(calls, anyorder=True)\n\n-- Method: assertnotcalled ()\n\nAssert the mock was never called.\n\n>>> m = Mock()\n>>> m.hello.assertnotcalled()\n>>> obj = m.hello()\n>>> m.hello.assertnotcalled()\nTraceback (most recent call last):\n...\nAssertionError: Expected 'hello' to not have been called. Called 1 times.\n\nNew in version 3.5.\n\n-- Method: resetmock (*, returnvalue=False, sideeffect=False)\n\nThe resetmock method resets all the call attributes on a mock\nobject:\n\n>>> mock = Mock(returnvalue=None)\n>>> mock('hello')\n>>> mock.called\nTrue\n>>> mock.resetmock()\n>>> mock.called\nFalse\n\nChanged in version 3.6: Added two keyword-only arguments to\nthe resetmock function.\n\nThis can be useful where you want to make a series of\nassertions that reuse the same object.  Note that *note\nresetmock(): b4a. 'doesn't' clear the return value, *note\nsideeffect: 3d26. or any child attributes you have set using\nnormal assignment by default.  In case you want to reset\n'returnvalue' or *note sideeffect: 3d26, then pass the\ncorresponding parameter as 'True'.  Child mocks and the return\nvalue mock (if any) are reset as well.\n\nNote: 'returnvalue', and *note sideeffect: 3d26. are\nkeyword-only arguments.\n\n-- Method: mockaddspec (spec, specset=False)\n\nAdd a spec to a mock.  'spec' can either be an object or a\nlist of strings.  Only attributes on the 'spec' can be fetched\nas attributes from the mock.\n\nIf 'specset' is true then only attributes on the spec can be\nset.\n\n-- Method: attachmock (mock, attribute)\n\nAttach a mock as an attribute of this one, replacing its name\nand parent.  Calls to the attached mock will be recorded in\nthe *note methodcalls: 3d30. and *note mockcalls: 3d2d.\nattributes of this one.\n\n-- Method: configuremock (kwargs)\n\nSet attributes on the mock through keyword arguments.\n\nAttributes plus return values and side effects can be set on\nchild mocks using standard dot notation and unpacking a\ndictionary in the method call:\n\n>>> mock = Mock()\n>>> attrs = {'method.returnvalue': 3, 'other.sideeffect': KeyError}\n>>> mock.configuremock(attrs)\n>>> mock.method()\n3\n>>> mock.other()\nTraceback (most recent call last):\n...\nKeyError\n\nThe same thing can be achieved in the constructor call to\nmocks:\n\n>>> attrs = {'method.returnvalue': 3, 'other.sideeffect': KeyError}\n>>> mock = Mock(someattribute='eggs', attrs)\n>>> mock.someattribute\n'eggs'\n>>> mock.method()\n3\n>>> mock.other()\nTraceback (most recent call last):\n...\nKeyError\n\n*note configuremock(): 3d29. exists to make it easier to do\nconfiguration after the mock has been created.\n\n-- Method: dir ()\n\n*note Mock: 878. objects limit the results of 'dir(somemock)'\nto useful results.  For mocks with a 'spec' this includes all\nthe permitted attributes for the mock.\n\nSee *note FILTERDIR: 3d32. for what this filtering does, and\nhow to switch it off.\n\n-- Method: getchildmock (kw)\n\nCreate the child mocks for attributes and return value.  By\ndefault child mocks will be the same type as the parent.\nSubclasses of Mock may want to override this to customize the\nway child mocks are made.\n\nFor non-callable mocks the callable variant will be used\n(rather than any custom subclass).\n\n-- Attribute: called\n\nA boolean representing whether or not the mock object has been\ncalled:\n\n>>> mock = Mock(returnvalue=None)\n>>> mock.called\nFalse\n>>> mock()\n>>> mock.called\nTrue\n\n-- Attribute: callcount\n\nAn integer telling you how many times the mock object has been\ncalled:\n\n>>> mock = Mock(returnvalue=None)\n>>> mock.callcount\n0\n>>> mock()\n>>> mock()\n>>> mock.callcount\n2\n\n-- Attribute: returnvalue\n\nSet this to configure the value returned by calling the mock:\n\n>>> mock = Mock()\n>>> mock.returnvalue = 'fish'\n>>> mock()\n'fish'\n\nThe default return value is a mock object and you can\nconfigure it in the normal way:\n\n>>> mock = Mock()\n>>> mock.returnvalue.attribute = sentinel.Attribute\n>>> mock.returnvalue()\n<Mock name='mock()()' id='...'>\n>>> mock.returnvalue.assertcalledwith()\n\n*note returnvalue: 3d28. can also be set in the constructor:\n\n>>> mock = Mock(returnvalue=3)\n>>> mock.returnvalue\n3\n>>> mock()\n3\n\n-- Attribute: sideeffect\n\nThis can either be a function to be called when the mock is\ncalled, an iterable or an exception (class or instance) to be\nraised.\n\nIf you pass in a function it will be called with same\narguments as the mock and unless the function returns the\n*note DEFAULT: 3d27. singleton the call to the mock will then\nreturn whatever the function returns.  If the function returns\n*note DEFAULT: 3d27. then the mock will return its normal\nvalue (from the *note returnvalue: 3d28.).\n\nIf you pass in an iterable, it is used to retrieve an iterator\nwhich must yield a value on every call.  This value can either\nbe an exception instance to be raised, or a value to be\nreturned from the call to the mock (*note DEFAULT: 3d27.\nhandling is identical to the function case).\n\nAn example of a mock that raises an exception (to test\nexception handling of an API):\n\n>>> mock = Mock()\n>>> mock.sideeffect = Exception('Boom!')\n>>> mock()\nTraceback (most recent call last):\n...\nException: Boom!\n\nUsing *note sideeffect: 3d26. to return a sequence of values:\n\n>>> mock = Mock()\n>>> mock.sideeffect = [3, 2, 1]\n>>> mock(), mock(), mock()\n(3, 2, 1)\n\nUsing a callable:\n\n>>> mock = Mock(returnvalue=3)\n>>> def sideeffect(*args, kwargs):\n...     return DEFAULT\n...\n>>> mock.sideeffect = sideeffect\n>>> mock()\n3\n\n*note sideeffect: 3d26. can be set in the constructor.\nHere's an example that adds one to the value the mock is\ncalled with and returns it:\n\n>>> sideeffect = lambda value: value + 1\n>>> mock = Mock(sideeffect=sideeffect)\n>>> mock(3)\n4\n>>> mock(-8)\n-7\n\nSetting *note sideeffect: 3d26. to 'None' clears it:\n\n>>> m = Mock(sideeffect=KeyError, returnvalue=3)\n>>> m()\nTraceback (most recent call last):\n...\nKeyError\n>>> m.sideeffect = None\n>>> m()\n3\n\n-- Attribute: callargs\n\nThis is either 'None' (if the mock hasn't been called), or the\narguments that the mock was last called with.  This will be in\nthe form of a tuple: the first member, which can also be\naccessed through the 'args' property, is any ordered arguments\nthe mock was called with (or an empty tuple) and the second\nmember, which can also be accessed through the 'kwargs'\nproperty, is any keyword arguments (or an empty dictionary).\n\n>>> mock = Mock(returnvalue=None)\n>>> print(mock.callargs)\nNone\n>>> mock()\n>>> mock.callargs\ncall()\n>>> mock.callargs == ()\nTrue\n>>> mock(3, 4)\n>>> mock.callargs\ncall(3, 4)\n>>> mock.callargs == ((3, 4),)\nTrue\n>>> mock.callargs.args\n(3, 4)\n>>> mock.callargs.kwargs\n{}\n>>> mock(3, 4, 5, key='fish', next='w00t!')\n>>> mock.callargs\ncall(3, 4, 5, key='fish', next='w00t!')\n>>> mock.callargs.args\n(3, 4, 5)\n>>> mock.callargs.kwargs\n{'key': 'fish', 'next': 'w00t!'}\n\n*note callargs: 16ee, along with members of the lists *note\ncallargslist: 3d36, *note methodcalls: 3d30. and *note\nmockcalls: 3d2d. are *note call: 173d. objects.  These are\ntuples, so they can be unpacked to get at the individual\narguments and make more complex assertions.  See *note calls\nas tuples: 3d37.\n\nChanged in version 3.8: Added 'args' and 'kwargs' properties.\n\n-- Attribute: callargslist\n\nThis is a list of all the calls made to the mock object in\nsequence (so the length of the list is the number of times it\nhas been called).  Before any calls have been made it is an\nempty list.  The *note call: 173d. object can be used for\nconveniently constructing lists of calls to compare with *note\ncallargslist: 3d36.\n\n>>> mock = Mock(returnvalue=None)\n>>> mock()\n>>> mock(3, 4)\n>>> mock(key='fish', next='w00t!')\n>>> mock.callargslist\n[call(), call(3, 4), call(key='fish', next='w00t!')]\n>>> expected = [(), ((3, 4),), ({'key': 'fish', 'next': 'w00t!'},)]\n>>> mock.callargslist == expected\nTrue\n\nMembers of *note callargslist: 3d36. are *note call: 173d.\nobjects.  These can be unpacked as tuples to get at the\nindividual arguments.  See *note calls as tuples: 3d37.\n\n-- Attribute: methodcalls\n\nAs well as tracking calls to themselves, mocks also track\ncalls to methods and attributes, and 'their' methods and\nattributes:\n\n>>> mock = Mock()\n>>> mock.method()\n<Mock name='mock.method()' id='...'>\n>>> mock.property.method.attribute()\n<Mock name='mock.property.method.attribute()' id='...'>\n>>> mock.methodcalls\n[call.method(), call.property.method.attribute()]\n\nMembers of *note methodcalls: 3d30. are *note call: 173d.\nobjects.  These can be unpacked as tuples to get at the\nindividual arguments.  See *note calls as tuples: 3d37.\n\n-- Attribute: mockcalls\n\n*note mockcalls: 3d2d. records 'all' calls to the mock\nobject, its methods, magic methods 'and' return value mocks.\n\n>>> mock = MagicMock()\n>>> result = mock(1, 2, 3)\n>>> mock.first(a=3)\n<MagicMock name='mock.first()' id='...'>\n>>> mock.second()\n<MagicMock name='mock.second()' id='...'>\n>>> int(mock)\n1\n>>> result(1)\n<MagicMock name='mock()()' id='...'>\n>>> expected = [call(1, 2, 3), call.first(a=3), call.second(),\n... call.int(), call()(1)]\n>>> mock.mockcalls == expected\nTrue\n\nMembers of *note mockcalls: 3d2d. are *note call: 173d.\nobjects.  These can be unpacked as tuples to get at the\nindividual arguments.  See *note calls as tuples: 3d37.\n\nNote: The way *note mockcalls: 3d2d. are recorded means\nthat where nested calls are made, the parameters of\nancestor calls are not recorded and so will always\ncompare equal:\n\n>>> mock = MagicMock()\n>>> mock.top(a=3).bottom()\n<MagicMock name='mock.top().bottom()' id='...'>\n>>> mock.mockcalls\n[call.top(a=3), call.top().bottom()]\n>>> mock.mockcalls[-1] == call.top(a=-1).bottom()\nTrue\n\n-- Attribute: class\n\nNormally the *note class: 3d38. attribute of an object\nwill return its type.  For a mock object with a 'spec',\n'class' returns the spec class instead.  This allows mock\nobjects to pass *note isinstance(): 14b. tests for the object\nthey are replacing / masquerading as:\n\n>>> mock = Mock(spec=3)\n>>> isinstance(mock, int)\nTrue\n\n*note class: 3d38. is assignable to, this allows a mock to\npass an *note isinstance(): 14b. check without forcing you to\nuse a spec:\n\n>>> mock = Mock()\n>>> mock.class = dict\n>>> isinstance(mock, dict)\nTrue\n\n-- Class: unittest.mock.NonCallableMock (spec=None, wraps=None,\nname=None, specset=None, kwargs)\n\nA non-callable version of *note Mock: 878.  The constructor\nparameters have the same meaning of *note Mock: 878, with the\nexception of 'returnvalue' and 'sideeffect' which have no meaning\non a non-callable mock.\n",
            "subsections": []
        },
        "Mock objects that use a class or an instance as a 'spec' or 'specset'": {
            "content": "are able to pass *note isinstance(): 14b. tests:\n\n>>> mock = Mock(spec=SomeClass)\n>>> isinstance(mock, SomeClass)\nTrue\n>>> mock = Mock(specset=SomeClass())\n>>> isinstance(mock, SomeClass)\nTrue\n\nThe *note Mock: 878. classes have support for mocking magic methods.\nSee *note magic methods: 3d21. for the full details.\n\nThe mock classes and the *note patch(): cf5. decorators all take\narbitrary keyword arguments for configuration.  For the *note patch():\ncf5. decorators the keywords are passed to the constructor of the mock\nbeing created.  The keyword arguments are for configuring attributes of\nthe mock:\n\n>>> m = MagicMock(attribute=3, other='fish')\n>>> m.attribute\n3\n>>> m.other\n'fish'\n",
            "subsections": []
        },
        "The return value and side effect of child mocks can be set in the same": {
            "content": "way, using dotted notation.  As you can't use dotted names directly in a\ncall you have to create a dictionary and unpack it using '':\n\n>>> attrs = {'method.returnvalue': 3, 'other.sideeffect': KeyError}\n>>> mock = Mock(someattribute='eggs', attrs)\n>>> mock.someattribute\n'eggs'\n>>> mock.method()\n3\n>>> mock.other()\nTraceback (most recent call last):\n...\nKeyError\n\nA callable mock which was created with a 'spec' (or a 'specset') will\nintrospect the specification object's signature when matching calls to\nthe mock.  Therefore, it can match the actual call's arguments\nregardless of whether they were passed positionally or by name:\n\n>>> def f(a, b, c): pass\n...\n>>> mock = Mock(spec=f)\n>>> mock(1, 2, c=3)\n<Mock name='mock()' id='140161580456576'>\n>>> mock.assertcalledwith(1, 2, 3)\n>>> mock.assertcalledwith(a=1, b=2, c=3)\n\nThis applies to *note assertcalledwith(): 1799, *note\nassertcalledoncewith(): 3d2a, *note asserthascalls(): 3d2c. and\n*note assertanycall(): 3d2b.  When *note Autospeccing: 3d22, it will\nalso apply to method calls on the mock object.\n",
            "subsections": []
        },
        "Changed in version 3.4: Added signature introspection on specced and": {
            "content": "autospecced mock objects.\n\n-- Class: unittest.mock.PropertyMock (*args, kwargs)\n\nA mock intended to be used as a *note property: 3f6, or other *note\ndescriptor: 1c78, on a class.  *note PropertyMock: 3d39. provides\n*note get(): 1518. and *note set(): 1c6f. methods so you\ncan specify a return value when it is fetched.\n\nFetching a *note PropertyMock: 3d39. instance from an object calls\nthe mock, with no args.  Setting it calls the mock with the value\nbeing set.\n\n>>> class Foo:\n...     @property\n...     def foo(self):\n...         return 'something'\n...     @foo.setter\n...     def foo(self, value):\n...         pass\n...\n>>> with patch('main.Foo.foo', newcallable=PropertyMock) as mockfoo:\n...     mockfoo.returnvalue = 'mockity-mock'\n...     thisfoo = Foo()\n...     print(thisfoo.foo)\n...     thisfoo.foo = 6\n...\nmockity-mock\n>>> mockfoo.mockcalls\n[call(), call(6)]\n",
            "subsections": []
        },
        "Because of the way mock attributes are stored you can't directly attach": {
            "content": "a *note PropertyMock: 3d39. to a mock object.  Instead you can attach it\nto the mock type object:\n\n>>> m = MagicMock()\n>>> p = PropertyMock(returnvalue=3)\n>>> type(m).foo = p\n>>> m.foo\n3\n>>> p.assertcalledoncewith()\n\n-- Class: unittest.mock.AsyncMock (spec=None, sideeffect=None,\nreturnvalue=DEFAULT, wraps=None, name=None, specset=None,\nunsafe=False, kwargs)\n\nAn asynchronous version of *note MagicMock: cf4.  The *note\nAsyncMock: 877. object will behave so the object is recognized as\nan async function, and the result of a call is an awaitable.\n\n>>> mock = AsyncMock()\n>>> asyncio.iscoroutinefunction(mock)\nTrue\n>>> inspect.isawaitable(mock())\nTrue\n\nThe result of 'mock()' is an async function which will have the\noutcome of 'sideeffect' or 'returnvalue' after it has been\nawaited:\n\n- if 'sideeffect' is a function, the async function will return\nthe result of that function,\n\n- if 'sideeffect' is an exception, the async function will\nraise the exception,\n\n- if 'sideeffect' is an iterable, the async function will\nreturn the next value of the iterable, however, if the\nsequence of result is exhausted, 'StopAsyncIteration' is\nraised immediately,\n\n- if 'sideeffect' is not defined, the async function will\nreturn the value defined by 'returnvalue', hence, by default,\nthe async function returns a new *note AsyncMock: 877. object.\n\nSetting the 'spec' of a *note Mock: 878. or *note MagicMock: cf4.\nto an async function will result in a coroutine object being\nreturned after calling.\n\n>>> async def asyncfunc(): pass\n...\n>>> mock = MagicMock(asyncfunc)\n>>> mock\n<MagicMock spec='function' id='...'>\n>>> mock()\n<coroutine object AsyncMockMixin.mockcall at ...>\n\nSetting the 'spec' of a *note Mock: 878, *note MagicMock: cf4, or\n*note AsyncMock: 877. to a class with asynchronous and synchronous\nfunctions will automatically detect the synchronous functions and\nset them as *note MagicMock: cf4. (if the parent mock is *note\nAsyncMock: 877. or *note MagicMock: cf4.) or *note Mock: 878. (if\nthe parent mock is *note Mock: 878.).  All asynchronous functions\nwill be *note AsyncMock: 877.\n\n>>> class ExampleClass:\n...     def syncfoo():\n...         pass\n...     async def asyncfoo():\n...         pass\n...\n>>> amock = AsyncMock(ExampleClass)\n>>> amock.syncfoo\n<MagicMock name='mock.syncfoo' id='...'>\n>>> amock.asyncfoo\n<AsyncMock name='mock.asyncfoo' id='...'>\n>>> mock = Mock(ExampleClass)\n>>> mock.syncfoo\n<Mock name='mock.syncfoo' id='...'>\n>>> mock.asyncfoo\n<AsyncMock name='mock.asyncfoo' id='...'>\n\nNew in version 3.8.\n\n-- Method: assertawaited ()\n\nAssert that the mock was awaited at least once.  Note that\nthis is separate from the object having been called, the\n'await' keyword must be used:\n\n>>> mock = AsyncMock()\n>>> async def main(coroutinemock):\n...     await coroutinemock\n...\n>>> coroutinemock = mock()\n>>> mock.called\nTrue\n>>> mock.assertawaited()\nTraceback (most recent call last):\n...\nAssertionError: Expected mock to have been awaited.\n>>> asyncio.run(main(coroutinemock))\n>>> mock.assertawaited()\n\n-- Method: assertawaitedonce ()\n\nAssert that the mock was awaited exactly once.\n\n>>> mock = AsyncMock()\n>>> async def main():\n...     await mock()\n...\n>>> asyncio.run(main())\n>>> mock.assertawaitedonce()\n>>> asyncio.run(main())\n>>> mock.method.assertawaitedonce()\nTraceback (most recent call last):\n...\nAssertionError: Expected mock to have been awaited once. Awaited 2 times.\n\n-- Method: assertawaitedwith (*args, kwargs)\n\nAssert that the last await was with the specified arguments.\n\n>>> mock = AsyncMock()\n>>> async def main(*args, kwargs):\n...     await mock(*args, kwargs)\n...\n>>> asyncio.run(main('foo', bar='bar'))\n>>> mock.assertawaitedwith('foo', bar='bar')\n>>> mock.assertawaitedwith('other')\nTraceback (most recent call last):\n...\nAssertionError: expected call not found.\nExpected: mock('other')\nActual: mock('foo', bar='bar')\n\n-- Method: assertawaitedoncewith (*args, kwargs)\n\nAssert that the mock was awaited exactly once and with the\nspecified arguments.\n\n>>> mock = AsyncMock()\n>>> async def main(*args, kwargs):\n...     await mock(*args, kwargs)\n...\n>>> asyncio.run(main('foo', bar='bar'))\n>>> mock.assertawaitedoncewith('foo', bar='bar')\n>>> asyncio.run(main('foo', bar='bar'))\n>>> mock.assertawaitedoncewith('foo', bar='bar')\nTraceback (most recent call last):\n...\nAssertionError: Expected mock to have been awaited once. Awaited 2 times.\n\n-- Method: assertanyawait (*args, kwargs)\n\nAssert the mock has ever been awaited with the specified\narguments.\n\n>>> mock = AsyncMock()\n>>> async def main(*args, kwargs):\n...     await mock(*args, kwargs)\n...\n>>> asyncio.run(main('foo', bar='bar'))\n>>> asyncio.run(main('hello'))\n>>> mock.assertanyawait('foo', bar='bar')\n>>> mock.assertanyawait('other')\nTraceback (most recent call last):\n...\nAssertionError: mock('other') await not found\n\n-- Method: asserthasawaits (calls, anyorder=False)\n\nAssert the mock has been awaited with the specified calls.\nThe *note awaitargslist: 16ed. list is checked for the\nawaits.\n\nIf 'anyorder' is false then the awaits must be sequential.\nThere can be extra calls before or after the specified awaits.\n\nIf 'anyorder' is true then the awaits can be in any order,\nbut they must all appear in *note awaitargslist: 16ed.\n\n>>> mock = AsyncMock()\n>>> async def main(*args, kwargs):\n...     await mock(*args, kwargs)\n...\n>>> calls = [call(\"foo\"), call(\"bar\")]\n>>> mock.asserthasawaits(calls)\nTraceback (most recent call last):\n...\nAssertionError: Awaits not found.\nExpected: [call('foo'), call('bar')]\nActual: []\n>>> asyncio.run(main('foo'))\n>>> asyncio.run(main('bar'))\n>>> mock.asserthasawaits(calls)\n\n-- Method: assertnotawaited ()\n\nAssert that the mock was never awaited.\n\n>>> mock = AsyncMock()\n>>> mock.assertnotawaited()\n\n-- Method: resetmock (*args, kwargs)\n\nSee *note Mock.resetmock(): b4a.  Also sets *note\nawaitcount: 3d42. to 0, *note awaitargs: 3d43. to None, and\nclears the *note awaitargslist: 16ed.\n\n-- Attribute: awaitcount\n\nAn integer keeping track of how many times the mock object has\nbeen awaited.\n\n>>> mock = AsyncMock()\n>>> async def main():\n...     await mock()\n...\n>>> asyncio.run(main())\n>>> mock.awaitcount\n1\n>>> asyncio.run(main())\n>>> mock.awaitcount\n2\n\n-- Attribute: awaitargs\n\nThis is either 'None' (if the mock hasn't been awaited), or\nthe arguments that the mock was last awaited with.  Functions\nthe same as *note Mock.callargs: 16ee.\n\n>>> mock = AsyncMock()\n>>> async def main(*args):\n...     await mock(*args)\n...\n>>> mock.awaitargs\n>>> asyncio.run(main('foo'))\n>>> mock.awaitargs\ncall('foo')\n>>> asyncio.run(main('bar'))\n>>> mock.awaitargs\ncall('bar')\n\n-- Attribute: awaitargslist\n\nThis is a list of all the awaits made to the mock object in\nsequence (so the length of the list is the number of times it\nhas been awaited).  Before any awaits have been made it is an\nempty list.\n\n>>> mock = AsyncMock()\n>>> async def main(*args):\n...     await mock(*args)\n...\n>>> mock.awaitargslist\n[]\n>>> asyncio.run(main('foo'))\n>>> mock.awaitargslist\n[call('foo')]\n>>> asyncio.run(main('bar'))\n>>> mock.awaitargslist\n[call('foo'), call('bar')]\n\n* Menu:\n\n* Calling::\n* Deleting Attributes::\n* Mock names and the name attribute::\n* Attaching Mocks as Attributes::\n\n---------- Footnotes ----------\n\n(1) The only exceptions are magic methods and attributes (those that\nhave leading and trailing double underscores).  Mock doesn't create\nthese but instead raises an *note AttributeError: 395.  This is because\nthe interpreter will often implicitly request these methods, and gets\n'very' confused to get a new Mock object when it expects a magic method.\nIf you need magic method support see *note magic methods: 3d21.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Calling,  Next: Deleting Attributes,  Up: The Mock Class": {
            "content": "5.26.6.3 Calling\n................\n",
            "subsections": []
        },
        "Mock objects are callable.  The call will return the value set as the": {
            "content": "*note returnvalue: 3d28. attribute.  The default return value is a new",
            "subsections": []
        },
        "Mock object; it is created the first time the return value is accessed": {
            "content": "(either explicitly or by calling the Mock) - but it is stored and the\nsame one returned each time.\n\nCalls made to the object will be recorded in the attributes like *note\ncallargs: 16ee. and *note callargslist: 3d36.\n\nIf *note sideeffect: 3d26. is set then it will be called after the call\nhas been recorded, so if 'sideeffect' raises an exception the call is\nstill recorded.\n",
            "subsections": []
        },
        "The simplest way to make a mock raise an exception when called is to": {
            "content": "make *note sideeffect: 3d26. an exception class or instance:\n\n>>> m = MagicMock(sideeffect=IndexError)\n>>> m(1, 2, 3)\nTraceback (most recent call last):\n...\nIndexError\n>>> m.mockcalls\n[call(1, 2, 3)]\n>>> m.sideeffect = KeyError('Bang!')\n>>> m('two', 'three', 'four')\nTraceback (most recent call last):\n...\nKeyError: 'Bang!'\n>>> m.mockcalls\n[call(1, 2, 3), call('two', 'three', 'four')]\n",
            "subsections": []
        },
        "If 'sideeffect' is a function then whatever that function returns is": {
            "content": "what calls to the mock return.  The 'sideeffect' function is called\nwith the same arguments as the mock.  This allows you to vary the return\nvalue of the call dynamically, based on the input:\n\n>>> def sideeffect(value):\n...     return value + 1\n...\n>>> m = MagicMock(sideeffect=sideeffect)\n>>> m(1)\n2\n>>> m(2)\n3\n>>> m.mockcalls\n[call(1), call(2)]\n",
            "subsections": []
        },
        "If you want the mock to still return the default return value (a new": {
            "content": "mock), or any set return value, then there are two ways of doing this.",
            "subsections": []
        },
        "Either return 'mock.returnvalue' from inside 'sideeffect', or return": {
            "content": "*note DEFAULT: 3d27.:\n\n>>> m = MagicMock()\n>>> def sideeffect(*args, kwargs):\n...     return m.returnvalue\n...\n>>> m.sideeffect = sideeffect\n>>> m.returnvalue = 3\n>>> m()\n3\n>>> def sideeffect(*args, kwargs):\n...     return DEFAULT\n...\n>>> m.sideeffect = sideeffect\n>>> m()\n3\n",
            "subsections": []
        },
        "To remove a 'sideeffect', and return to the default behaviour, set the": {
            "content": "'sideeffect' to 'None':\n\n>>> m = MagicMock(returnvalue=6)\n>>> def sideeffect(*args, kwargs):\n...     return 3\n...\n>>> m.sideeffect = sideeffect\n>>> m()\n3\n>>> m.sideeffect = None\n>>> m()\n6\n",
            "subsections": []
        },
        "The 'sideeffect' can also be any iterable object.  Repeated calls to": {
            "content": "the mock will return values from the iterable (until the iterable is\nexhausted and a *note StopIteration: a40. is raised):\n\n>>> m = MagicMock(sideeffect=[1, 2, 3])\n>>> m()\n1\n>>> m()\n2\n>>> m()\n3\n>>> m()\nTraceback (most recent call last):\n...\nStopIteration\n",
            "subsections": []
        },
        "If any members of the iterable are exceptions they will be raised": {
            "content": "instead of returned:\n\n>>> iterable = (33, ValueError, 66)\n>>> m = MagicMock(sideeffect=iterable)\n>>> m()\n33\n>>> m()\nTraceback (most recent call last):\n...\nValueError\n>>> m()\n66\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Deleting Attributes,  Next: Mock names and the name attribute,  Prev: Calling,  Up: The Mock Class": {
            "content": "5.26.6.4 Deleting Attributes\n............................\n",
            "subsections": []
        },
        "Mock objects create attributes on demand.  This allows them to pretend": {
            "content": "to be objects of any type.\n\nYou may want a mock object to return 'False' to a *note hasattr(): 1f7.\ncall, or raise an *note AttributeError: 395. when an attribute is\nfetched.  You can do this by providing an object as a 'spec' for a mock,\nbut that isn't always convenient.\n\nYou \"block\" attributes by deleting them.  Once deleted, accessing an\nattribute will raise an *note AttributeError: 395.\n\n>>> mock = MagicMock()\n>>> hasattr(mock, 'm')\nTrue\n>>> del mock.m\n>>> hasattr(mock, 'm')\nFalse\n>>> del mock.f\n>>> mock.f\nTraceback (most recent call last):\n...\nAttributeError: f\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Mock names and the name attribute,  Next: Attaching Mocks as Attributes,  Prev: Deleting Attributes,  Up: The Mock Class": {
            "content": "5.26.6.5 Mock names and the name attribute\n..........................................\n\nSince \"name\" is an argument to the *note Mock: 878. constructor, if you\nwant your mock object to have a \"name\" attribute you can't just pass it\nin at creation time.  There are two alternatives.  One option is to use\n*note configuremock(): 3d29.:\n\n>>> mock = MagicMock()\n>>> mock.configuremock(name='myname')\n>>> mock.name\n'myname'\n\nA simpler option is to simply set the \"name\" attribute after mock\ncreation:\n\n>>> mock = MagicMock()\n>>> mock.name = \"foo\"\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Attaching Mocks as Attributes,  Prev: Mock names and the name attribute,  Up: The Mock Class": {
            "content": "5.26.6.6 Attaching Mocks as Attributes\n......................................\n",
            "subsections": []
        },
        "When you attach a mock as an attribute of another mock (or as the return": {
            "content": "value) it becomes a \"child\" of that mock.  Calls to the child are\nrecorded in the *note methodcalls: 3d30. and *note mockcalls: 3d2d.\nattributes of the parent.  This is useful for configuring child mocks\nand then attaching them to the parent, or for attaching mocks to a\nparent that records all calls to the children and allows you to make\nassertions about the order of calls between mocks:\n\n>>> parent = MagicMock()\n>>> child1 = MagicMock(returnvalue=None)\n>>> child2 = MagicMock(returnvalue=None)\n>>> parent.child1 = child1\n>>> parent.child2 = child2\n>>> child1(1)\n>>> child2(2)\n>>> parent.mockcalls\n[call.child1(1), call.child2(2)]\n",
            "subsections": []
        },
        "The exception to this is if the mock has a name.  This allows you to": {
            "content": "prevent the \"parenting\" if for some reason you don't want it to happen.\n\n>>> mock = MagicMock()\n>>> notachild = MagicMock(name='not-a-child')\n>>> mock.attribute = notachild\n>>> mock.attribute()\n<MagicMock name='not-a-child()' id='...'>\n>>> mock.mockcalls\n[]\n\nMocks created for you by *note patch(): cf5. are automatically given\nnames.  To attach mocks that have names to a parent you use the *note\nattachmock(): 3d2f. method:\n\n>>> thing1 = object()\n>>> thing2 = object()\n>>> parent = MagicMock()\n>>> with patch('main.thing1', returnvalue=None) as child1:\n...     with patch('main.thing2', returnvalue=None) as child2:\n...         parent.attachmock(child1, 'child1')\n...         parent.attachmock(child2, 'child2')\n...         child1('one')\n...         child2('two')\n...\n>>> parent.mockcalls\n[call.child1('one'), call.child2('two')]\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The patchers,  Next: MagicMock and magic method support,  Prev: The Mock Class,  Up: unittest mock -- mock object library": {
            "content": "5.26.6.7 The patchers\n.....................\n",
            "subsections": []
        },
        "The patch decorators are used for patching objects only within the scope": {
            "content": "of the function they decorate.  They automatically handle the unpatching\nfor you, even if exceptions are raised.  All of these functions can also\nbe used in with statements or as class decorators.\n\n* Menu:\n\n* patch::\n* patch.object: patch object.\n* patch.dict: patch dict.\n* patch.multiple: patch multiple.\n* patch methods; start and stop: patch methods start and stop.\n* patch builtins::\n* TESTPREFIX::\n* Nesting Patch Decorators::\n* Where to patch::\n* Patching Descriptors and Proxy Objects::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: patch,  Next: patch object,  Up: The patchers": {
            "content": "5.26.6.8 patch\n..............\n\nNote: The key is to do the patching in the right namespace.  See\nthe section *note where to patch: 3d4b.\n\n-- Function: unittest.mock.patch (target, new=DEFAULT, spec=None,\ncreate=False, specset=None, autospec=None, newcallable=None,\nkwargs)\n\n*note patch(): cf5. acts as a function decorator, class decorator\nor a context manager.  Inside the body of the function or with\nstatement, the 'target' is patched with a 'new' object.  When the\nfunction/with statement exits the patch is undone.\n\nIf 'new' is omitted, then the target is replaced with an *note\nAsyncMock: 877. if the patched object is an async function or a\n*note MagicMock: cf4. otherwise.  If *note patch(): cf5. is used as\na decorator and 'new' is omitted, the created mock is passed in as\nan extra argument to the decorated function.  If *note patch():\ncf5. is used as a context manager the created mock is returned by\nthe context manager.\n\n'target' should be a string in the form\n''package.module.ClassName''.  The 'target' is imported and the\nspecified object replaced with the 'new' object, so the 'target'\nmust be importable from the environment you are calling *note\npatch(): cf5. from.  The target is imported when the decorated\nfunction is executed, not at decoration time.\n\nThe 'spec' and 'specset' keyword arguments are passed to the *note\nMagicMock: cf4. if patch is creating one for you.\n\nIn addition you can pass 'spec=True' or 'specset=True', which\ncauses patch to pass in the object being mocked as the\nspec/specset object.\n\n'newcallable' allows you to specify a different class, or callable\nobject, that will be called to create the 'new' object.  By default\n*note AsyncMock: 877. is used for async functions and *note\nMagicMock: cf4. for the rest.\n\nA more powerful form of 'spec' is 'autospec'.  If you set\n'autospec=True' then the mock will be created with a spec from the\nobject being replaced.  All attributes of the mock will also have\nthe spec of the corresponding attribute of the object being\nreplaced.  Methods and functions being mocked will have their\narguments checked and will raise a *note TypeError: 28e. if they\nare called with the wrong signature.  For mocks replacing a class,\ntheir return value (the 'instance') will have the same spec as the\nclass.  See the *note createautospec(): 13b3. function and *note\nAutospeccing: 3d22.\n\nInstead of 'autospec=True' you can pass 'autospec=someobject' to\nuse an arbitrary object as the spec instead of the one being\nreplaced.\n\nBy default *note patch(): cf5. will fail to replace attributes that\ndon't exist.  If you pass in 'create=True', and the attribute\ndoesn't exist, patch will create the attribute for you when the\npatched function is called, and delete it again after the patched\nfunction has exited.  This is useful for writing tests against\nattributes that your production code creates at runtime.  It is off\nby default because it can be dangerous.  With it switched on you\ncan write passing tests against APIs that don't actually exist!\n\nNote:\nChanged in version 3.5: If you are patching builtins in a\nmodule then you don't need to pass 'create=True', it will be\nadded by default.\n\nPatch can be used as a 'TestCase' class decorator.  It works by\ndecorating each test method in the class.  This reduces the\nboilerplate code when your test methods share a common patchings\nset.  *note patch(): cf5. finds tests by looking for method names\nthat start with 'patch.TESTPREFIX'.  By default this is ''test'',\nwhich matches the way *note unittest: 101. finds tests.  You can\nspecify an alternative prefix by setting 'patch.TESTPREFIX'.\n\nPatch can be used as a context manager, with the with statement.\nHere the patching applies to the indented block after the with\nstatement.  If you use \"as\" then the patched object will be bound\nto the name after the \"as\"; very useful if *note patch(): cf5. is\ncreating a mock object for you.\n\n*note patch(): cf5. takes arbitrary keyword arguments.  These will\nbe passed to *note AsyncMock: 877. if the patched object is\nasynchronous, to *note MagicMock: cf4. otherwise or to\n'newcallable' if specified.\n\n'patch.dict(...)', 'patch.multiple(...)' and 'patch.object(...)'\nare available for alternate use-cases.\n\n*note patch(): cf5. as function decorator, creating the mock for you and\npassing it into the decorated function:\n\n>>> @patch('main.SomeClass')\n... def function(normalargument, mockclass):\n...     print(mockclass is SomeClass)\n...\n>>> function(None)\nTrue\n\nPatching a class replaces the class with a *note MagicMock: cf4.\n'instance'.  If the class is instantiated in the code under test then it\nwill be the *note returnvalue: 3d28. of the mock that will be used.\n\nIf the class is instantiated multiple times you could use *note\nsideeffect: 3d26. to return a new mock each time.  Alternatively you\ncan set the 'returnvalue' to be anything you want.\n",
            "subsections": []
        },
        "To configure return values on methods of 'instances' on the patched": {
            "content": "class you must do this on the 'returnvalue'.  For example:\n\n>>> class Class:\n...     def method(self):\n...         pass\n...\n>>> with patch('main.Class') as MockClass:\n...     instance = MockClass.returnvalue\n...     instance.method.returnvalue = 'foo'\n...     assert Class() is instance\n...     assert Class().method() == 'foo'\n...\n\nIf you use 'spec' or 'specset' and *note patch(): cf5. is replacing a\n'class', then the return value of the created mock will have the same\nspec.\n\n>>> Original = Class\n>>> patcher = patch('main.Class', spec=True)\n>>> MockClass = patcher.start()\n>>> instance = MockClass()\n>>> assert isinstance(instance, Original)\n>>> patcher.stop()\n",
            "subsections": []
        },
        "The 'newcallable' argument is useful where you want to use an": {
            "content": "alternative class to the default *note MagicMock: cf4. for the created\nmock.  For example, if you wanted a *note NonCallableMock: 3d24. to be\nused:\n\n>>> thing = object()\n>>> with patch('main.thing', newcallable=NonCallableMock) as mockthing:\n...     assert thing is mockthing\n...     thing()\n...\nTraceback (most recent call last):\n...\nTypeError: 'NonCallableMock' object is not callable\n\nAnother use case might be to replace an object with an *note\nio.StringIO: d94. instance:\n\n>>> from io import StringIO\n>>> def foo():\n...     print('Something')\n...\n>>> @patch('sys.stdout', newcallable=StringIO)\n... def test(mockstdout):\n...     foo()\n...     assert mockstdout.getvalue() == 'Something\\n'\n...\n>>> test()\n\nWhen *note patch(): cf5. is creating a mock for you, it is common that\nthe first thing you need to do is to configure the mock.  Some of that\nconfiguration can be done in the call to patch.  Any arbitrary keywords\nyou pass into the call will be used to set attributes on the created\nmock:\n\n>>> patcher = patch('main.thing', first='one', second='two')\n>>> mockthing = patcher.start()\n>>> mockthing.first\n'one'\n>>> mockthing.second\n'two'\n\nAs well as attributes on the created mock attributes, like the *note\nreturnvalue: 3d28. and *note sideeffect: 3d26, of child mocks can also\nbe configured.  These aren't syntactically valid to pass in directly as\nkeyword arguments, but a dictionary with these as keys can still be\nexpanded into a *note patch(): cf5. call using '':\n\n>>> config = {'method.returnvalue': 3, 'other.sideeffect': KeyError}\n>>> patcher = patch('main.thing', config)\n>>> mockthing = patcher.start()\n>>> mockthing.method()\n3\n>>> mockthing.other()\nTraceback (most recent call last):\n...\nKeyError\n",
            "subsections": []
        },
        "By default, attempting to patch a function in a module (or a method or": {
            "content": "an attribute in a class) that does not exist will fail with *note\nAttributeError: 395.:\n\n>>> @patch('sys.nonexistingattribute', 42)\n... def test():\n...     assert sys.nonexistingattribute == 42\n...\n>>> test()\nTraceback (most recent call last):\n...\nAttributeError: <module 'sys' (built-in)> does not have the attribute 'nonexistingattribute'\n\nbut adding 'create=True' in the call to *note patch(): cf5. will make\nthe previous example work as expected:\n\n>>> @patch('sys.nonexistingattribute', 42, create=True)\n... def test(mockstdout):\n...     assert sys.nonexistingattribute == 42\n...\n>>> test()\n\nChanged in version 3.8: *note patch(): cf5. now returns an *note\nAsyncMock: 877. if the target is an async function.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: patch object,  Next: patch dict,  Prev: patch,  Up: The patchers": {
            "content": "5.26.6.9 patch.object\n.....................\n\n-- Function: patch.object (target, attribute, new=DEFAULT, spec=None,\ncreate=False, specset=None, autospec=None, newcallable=None,\nkwargs)\n\npatch the named member ('attribute') on an object ('target') with a\nmock object.\n\n*note patch.object(): 1725. can be used as a decorator, class\ndecorator or a context manager.  Arguments 'new', 'spec', 'create',\n'specset', 'autospec' and 'newcallable' have the same meaning as\nfor *note patch(): cf5.  Like *note patch(): cf5, *note\npatch.object(): 1725. takes arbitrary keyword arguments for\nconfiguring the mock object it creates.\n\nWhen used as a class decorator *note patch.object(): 1725. honours\n'patch.TESTPREFIX' for choosing which methods to wrap.\n\nYou can either call *note patch.object(): 1725. with three arguments or\ntwo arguments.  The three argument form takes the object to be patched,\nthe attribute name and the object to replace the attribute with.\n",
            "subsections": []
        },
        "When calling with the two argument form you omit the replacement object,": {
            "content": "and a mock is created for you and passed in as an extra argument to the\ndecorated function:\n\n>>> @patch.object(SomeClass, 'classmethod')\n... def test(mockmethod):\n...     SomeClass.classmethod(3)\n...     mockmethod.assertcalledwith(3)\n...\n>>> test()\n\n'spec', 'create' and the other arguments to *note patch.object(): 1725.\nhave the same meaning as they do for *note patch(): cf5.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: patch dict,  Next: patch multiple,  Prev: patch object,  Up: The patchers": {
            "content": "5.26.6.10 patch.dict\n....................\n\n-- Function: patch.dict (indict, values=(), clear=False, kwargs)\n\nPatch a dictionary, or dictionary like object, and restore the\ndictionary to its original state after the test.\n\n'indict' can be a dictionary or a mapping like container.  If it\nis a mapping then it must at least support getting, setting and\ndeleting items plus iterating over keys.\n\n'indict' can also be a string specifying the name of the\ndictionary, which will then be fetched by importing it.\n\n'values' can be a dictionary of values to set in the dictionary.\n'values' can also be an iterable of '(key, value)' pairs.\n\nIf 'clear' is true then the dictionary will be cleared before the\nnew values are set.\n\n*note patch.dict(): 176a. can also be called with arbitrary keyword\narguments to set values in the dictionary.\n\nChanged in version 3.8: *note patch.dict(): 176a. now returns the\npatched dictionary when used as a context manager.\n\n*note patch.dict(): 176a. can be used as a context manager, decorator or\nclass decorator:\n\n>>> foo = {}\n>>> @patch.dict(foo, {'newkey': 'newvalue'})\n... def test():\n...     assert foo == {'newkey': 'newvalue'}\n...\n>>> test()\n>>> assert foo == {}\n\nWhen used as a class decorator *note patch.dict(): 176a. honours\n'patch.TESTPREFIX' (default to ''test'') for choosing which methods to\nwrap:\n\n>>> import os\n>>> import unittest\n>>> from unittest.mock import patch\n>>> @patch.dict('os.environ', {'newkey': 'newvalue'})\n... class TestSample(unittest.TestCase):\n...     def testsample(self):\n...         self.assertEqual(os.environ['newkey'], 'newvalue')\n",
            "subsections": []
        },
        "If you want to use a different prefix for your test, you can inform the": {
            "content": "patchers of the different prefix by setting 'patch.TESTPREFIX'.  For\nmore details about how to change the value of see *note TESTPREFIX:\n3d4e.\n\n*note patch.dict(): 176a. can be used to add members to a dictionary, or\nsimply let a test change a dictionary, and ensure the dictionary is\nrestored when the test ends.\n\n>>> foo = {}\n>>> with patch.dict(foo, {'newkey': 'newvalue'}) as patchedfoo:\n...     assert foo == {'newkey': 'newvalue'}\n...     assert patchedfoo == {'newkey': 'newvalue'}\n...     # You can add, update or delete keys of foo (or patchedfoo, it's the same dict)\n...     patchedfoo['spam'] = 'eggs'\n...\n>>> assert foo == {}\n>>> assert patchedfoo == {}\n\n>>> import os\n>>> with patch.dict('os.environ', {'newkey': 'newvalue'}):\n...     print(os.environ['newkey'])\n...\nnewvalue\n>>> assert 'newkey' not in os.environ\n\nKeywords can be used in the *note patch.dict(): 176a. call to set values\nin the dictionary:\n\n>>> mymodule = MagicMock()\n>>> mymodule.function.returnvalue = 'fish'\n>>> with patch.dict('sys.modules', mymodule=mymodule):\n...     import mymodule\n...     mymodule.function('some', 'args')\n...\n'fish'\n\n*note patch.dict(): 176a. can be used with dictionary like objects that\naren't actually dictionaries.  At the very minimum they must support\nitem getting, setting, deleting and either iteration or membership test.\nThis corresponds to the magic methods *note getitem(): 4b9, *note\nsetitem(): 1320, *note delitem(): 1321. and either *note\niter(): 1a45. or *note contains(): 1c63.\n\n>>> class Container:\n...     def init(self):\n...         self.values = {}\n...     def getitem(self, name):\n...         return self.values[name]\n...     def setitem(self, name, value):\n...         self.values[name] = value\n...     def delitem(self, name):\n...         del self.values[name]\n...     def iter(self):\n...         return iter(self.values)\n...\n>>> thing = Container()\n>>> thing['one'] = 1\n>>> with patch.dict(thing, one=2, two=3):\n...     assert thing['one'] == 2\n...     assert thing['two'] == 3\n...\n>>> assert thing['one'] == 1\n>>> assert list(thing) == ['one']\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: patch multiple,  Next: patch methods start and stop,  Prev: patch dict,  Up: The patchers": {
            "content": "5.26.6.11 patch.multiple\n........................\n\n-- Function: patch.multiple (target, spec=None, create=False,\nspecset=None, autospec=None, newcallable=None, kwargs)\n\nPerform multiple patches in a single call.  It takes the object to\nbe patched (either as an object or a string to fetch the object by\nimporting) and keyword arguments for the patches:\n\nwith patch.multiple(settings, FIRSTPATCH='one', SECONDPATCH='two'):\n...\n\nUse *note DEFAULT: 3d27. as the value if you want *note\npatch.multiple(): 3d50. to create mocks for you.  In this case the\ncreated mocks are passed into a decorated function by keyword, and\na dictionary is returned when *note patch.multiple(): 3d50. is used\nas a context manager.\n\n*note patch.multiple(): 3d50. can be used as a decorator, class\ndecorator or a context manager.  The arguments 'spec', 'specset',\n'create', 'autospec' and 'newcallable' have the same meaning as\nfor *note patch(): cf5.  These arguments will be applied to 'all'\npatches done by *note patch.multiple(): 3d50.\n\nWhen used as a class decorator *note patch.multiple(): 3d50.\nhonours 'patch.TESTPREFIX' for choosing which methods to wrap.\n\nIf you want *note patch.multiple(): 3d50. to create mocks for you, then\nyou can use *note DEFAULT: 3d27. as the value.  If you use *note\npatch.multiple(): 3d50. as a decorator then the created mocks are passed\ninto the decorated function by keyword.\n\n>>> thing = object()\n>>> other = object()\n\n>>> @patch.multiple('main', thing=DEFAULT, other=DEFAULT)\n... def testfunction(thing, other):\n...     assert isinstance(thing, MagicMock)\n...     assert isinstance(other, MagicMock)\n...\n>>> testfunction()\n\n*note patch.multiple(): 3d50. can be nested with other 'patch'\ndecorators, but put arguments passed by keyword 'after' any of the\nstandard arguments created by *note patch(): cf5.:\n\n>>> @patch('sys.exit')\n... @patch.multiple('main', thing=DEFAULT, other=DEFAULT)\n... def testfunction(mockexit, other, thing):\n...     assert 'other' in repr(other)\n...     assert 'thing' in repr(thing)\n...     assert 'exit' in repr(mockexit)\n...\n>>> testfunction()\n\nIf *note patch.multiple(): 3d50. is used as a context manager, the value\nreturned by the context manager is a dictionary where created mocks are\nkeyed by name:\n\n>>> with patch.multiple('main', thing=DEFAULT, other=DEFAULT) as values:\n...     assert 'other' in repr(values['other'])\n...     assert 'thing' in repr(values['thing'])\n...     assert values['thing'] is thing\n...     assert values['other'] is other\n...\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: patch methods start and stop,  Next: patch builtins,  Prev: patch multiple,  Up: The patchers": {
            "content": "5.26.6.12 patch methods: start and stop\n.......................................\n",
            "subsections": []
        },
        "All the patchers have 'start()' and 'stop()' methods.  These make it": {
            "content": "simpler to do patching in 'setUp' methods or where you want to do\nmultiple patches without nesting decorators or with statements.\n\nTo use them call *note patch(): cf5, *note patch.object(): 1725. or\n*note patch.dict(): 176a. as normal and keep a reference to the returned\n'patcher' object.  You can then call 'start()' to put the patch in place\nand 'stop()' to undo it.\n\nIf you are using *note patch(): cf5. to create a mock for you then it\nwill be returned by the call to 'patcher.start'.\n\n>>> patcher = patch('package.module.ClassName')\n>>> from package import module\n>>> original = module.ClassName\n>>> newmock = patcher.start()\n>>> assert module.ClassName is not original\n>>> assert module.ClassName is newmock\n>>> patcher.stop()\n>>> assert module.ClassName is original\n>>> assert module.ClassName is not newmock\n\nA typical use case for this might be for doing multiple patches in the\n'setUp' method of a 'TestCase':\n\n>>> class MyTest(unittest.TestCase):\n...     def setUp(self):\n...         self.patcher1 = patch('package.module.Class1')\n...         self.patcher2 = patch('package.module.Class2')\n...         self.MockClass1 = self.patcher1.start()\n...         self.MockClass2 = self.patcher2.start()\n...\n...     def tearDown(self):\n...         self.patcher1.stop()\n...         self.patcher2.stop()\n...\n...     def testsomething(self):\n...         assert package.module.Class1 is self.MockClass1\n...         assert package.module.Class2 is self.MockClass2\n...\n>>> MyTest('testsomething').run()\n\nCaution: If you use this technique you must ensure that the\npatching is \"undone\" by calling 'stop'.  This can be fiddlier than\nyou might think, because if an exception is raised in the 'setUp'\nthen 'tearDown' is not called.  *note\nunittest.TestCase.addCleanup(): 8af. makes this easier:\n\n>>> class MyTest(unittest.TestCase):\n...     def setUp(self):\n...         patcher = patch('package.module.Class')\n...         self.MockClass = patcher.start()\n...         self.addCleanup(patcher.stop)\n...\n...     def testsomething(self):\n...         assert package.module.Class is self.MockClass\n...\n\nAs an added bonus you no longer need to keep a reference to the\n'patcher' object.\n",
            "subsections": []
        },
        "It is also possible to stop all patches which have been started by using": {
            "content": "*note patch.stopall(): 3d53.\n\n-- Function: patch.stopall ()\n\nStop all active patches.  Only stops patches started with 'start'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: patch builtins,  Next: TESTPREFIX,  Prev: patch methods start and stop,  Up: The patchers": {
            "content": "5.26.6.13 patch builtins\n........................\n",
            "subsections": []
        },
        "You can patch any builtins within a module.  The following example": {
            "content": "patches builtin *note ord(): 1c10.:\n\n>>> @patch('main.ord')\n... def test(mockord):\n...     mockord.returnvalue = 101\n...     print(ord('c'))\n...\n>>> test()\n101\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: TESTPREFIX,  Next: Nesting Patch Decorators,  Prev: patch builtins,  Up: The patchers": {
            "content": "5.26.6.14 TESTPREFIX\n.....................\n",
            "subsections": []
        },
        "All of the patchers can be used as class decorators.  When used in this": {
            "content": "way they wrap every test method on the class.  The patchers recognise\nmethods that start with ''test'' as being test methods.  This is the\nsame way that the *note unittest.TestLoader: 506. finds test methods by\ndefault.\n\nIt is possible that you want to use a different prefix for your tests.",
            "subsections": []
        },
        "You can inform the patchers of the different prefix by setting": {
            "content": "'patch.TESTPREFIX':\n\n>>> patch.TESTPREFIX = 'foo'\n>>> value = 3\n>>>\n>>> @patch('main.value', 'not three')\n... class Thing:\n...     def fooone(self):\n...         print(value)\n...     def footwo(self):\n...         print(value)\n...\n>>>\n>>> Thing().fooone()\nnot three\n>>> Thing().footwo()\nnot three\n>>> value\n3\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Nesting Patch Decorators,  Next: Where to patch,  Prev: TESTPREFIX,  Up: The patchers": {
            "content": "5.26.6.15 Nesting Patch Decorators\n..................................\n",
            "subsections": []
        },
        "If you want to perform multiple patches then you can simply stack up the": {
            "content": "decorators.\n\nYou can stack up multiple patch decorators using this pattern:\n\n>>> @patch.object(SomeClass, 'classmethod')\n... @patch.object(SomeClass, 'staticmethod')\n... def test(mock1, mock2):\n...     assert SomeClass.staticmethod is mock1\n...     assert SomeClass.classmethod is mock2\n...     SomeClass.staticmethod('foo')\n...     SomeClass.classmethod('bar')\n...     return mock1, mock2\n...\n>>> mock1, mock2 = test()\n>>> mock1.assertcalledoncewith('foo')\n>>> mock2.assertcalledoncewith('bar')\n",
            "subsections": []
        },
        "Note that the decorators are applied from the bottom upwards.  This is": {
            "content": "the standard way that Python applies decorators.  The order of the\ncreated mocks passed into your test function matches this order.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Where to patch,  Next: Patching Descriptors and Proxy Objects,  Prev: Nesting Patch Decorators,  Up: The patchers": {
            "content": "5.26.6.16 Where to patch\n........................\n\n*note patch(): cf5. works by (temporarily) changing the object that a\n'name' points to with another one.  There can be many names pointing to\nany individual object, so for patching to work you must ensure that you\npatch the name used by the system under test.\n",
            "subsections": []
        },
        "The basic principle is that you patch where an object is 'looked up',": {
            "content": "which is not necessarily the same place as where it is defined.  A\ncouple of examples will help to clarify this.\n",
            "subsections": []
        },
        "Imagine we have a project that we want to test with the following": {
            "content": "structure:\n\na.py\n-> Defines SomeClass\n\nb.py\n-> from a import SomeClass\n-> somefunction instantiates SomeClass\n",
            "subsections": []
        },
        "Now we want to test 'somefunction' but we want to mock out 'SomeClass'": {
            "content": "using *note patch(): cf5.  The problem is that when we import module b,\nwhich we will have to do then it imports 'SomeClass' from module a.  If\nwe use *note patch(): cf5. to mock out 'a.SomeClass' then it will have\nno effect on our test; module b already has a reference to the 'real'\n'SomeClass' and it looks like our patching had no effect.\n",
            "subsections": []
        },
        "The key is to patch out 'SomeClass' where it is used (or where it is": {
            "content": "looked up).  In this case 'somefunction' will actually look up\n'SomeClass' in module b, where we have imported it.  The patching should\nlook like:\n\n@patch('b.SomeClass')\n",
            "subsections": []
        },
        "However, consider the alternative scenario where instead of 'from a": {
            "content": "import SomeClass' module b does 'import a' and 'somefunction' uses\n'a.SomeClass'.  Both of these import forms are common.  In this case the\nclass we want to patch is being looked up in the module and so we have\nto patch 'a.SomeClass' instead:\n\n@patch('a.SomeClass')\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Patching Descriptors and Proxy Objects,  Prev: Where to patch,  Up: The patchers": {
            "content": "5.26.6.17 Patching Descriptors and Proxy Objects\n................................................\n\nBoth *note patch: 3d4a. and *note patch.object: 3d4c. correctly patch\nand restore descriptors: class methods, static methods and properties.",
            "subsections": []
        },
        "You should patch these on the 'class' rather than an instance.  They": {
            "content": "also work with 'some' objects that proxy attribute access, like the\ndjango settings object(1).\n\n---------- Footnotes ----------\n\n(1)\nhttps://web.archive.org/web/20200603181648/http://www.voidspace.org.uk/python/weblog/archd720101204.shtml#e1198\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: MagicMock and magic method support,  Next: Helpers,  Prev: The patchers,  Up: unittest mock -- mock object library": {
            "content": "5.26.6.18 MagicMock and magic method support\n............................................\n\n* Menu:\n\n* Mocking Magic Methods::\n* Magic Mock::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Mocking Magic Methods,  Next: Magic Mock,  Up: MagicMock and magic method support": {
            "content": "5.26.6.19 Mocking Magic Methods\n...............................\n\n*note Mock: 878. supports mocking the Python protocol methods, also\nknown as *note \"magic methods\": 3d5b.  This allows mock objects to\nreplace containers or other objects that implement Python protocols.\n",
            "subsections": []
        },
        "Because magic methods are looked up differently from normal methods (1),": {
            "content": "this support has been specially implemented.  This means that only\nspecific magic methods are supported.  The supported list includes\n'almost' all of them.  If there are any missing that you need please let\nus know.\n",
            "subsections": []
        },
        "You mock magic methods by setting the method you are interested in to a": {
            "content": "function or a mock instance.  If you are using a function then it 'must'\ntake 'self' as the first argument (2).\n\n>>> def str(self):\n...     return 'fooble'\n...\n>>> mock = Mock()\n>>> mock.str = str\n>>> str(mock)\n'fooble'\n\n>>> mock = Mock()\n>>> mock.str = Mock()\n>>> mock.str.returnvalue = 'fooble'\n>>> str(mock)\n'fooble'\n\n>>> mock = Mock()\n>>> mock.iter = Mock(returnvalue=iter([]))\n>>> list(mock)\n[]\n",
            "subsections": []
        },
        "One use case for this is for mocking objects used as context managers in": {
            "content": "a *note with: 396. statement:\n\n>>> mock = Mock()\n>>> mock.enter = Mock(returnvalue='foo')\n>>> mock.exit = Mock(returnvalue=False)\n>>> with mock as m:\n...     assert m == 'foo'\n...\n>>> mock.enter.assertcalledwith()\n>>> mock.exit.assertcalledwith(None, None, None)\n\nCalls to magic methods do not appear in *note methodcalls: 3d30, but\nthey are recorded in *note mockcalls: 3d2d.\n\nNote: If you use the 'spec' keyword argument to create a mock then\nattempting to set a magic method that isn't in the spec will raise\nan *note AttributeError: 395.\n\nThe full list of supported magic methods is:\n\n* 'hash', 'sizeof', 'repr' and 'str'\n\n* 'dir', 'format' and 'subclasses'\n\n* 'round', 'floor', 'trunc' and 'ceil'\n\n* Comparisons: 'lt', 'gt', 'le', 'ge', 'eq' and\n'ne'\n\n* Container methods: 'getitem', 'setitem', 'delitem',\n'contains', 'len', 'iter', 'reversed' and\n'missing'\n\n* Context manager: 'enter', 'exit', 'aenter' and\n'aexit'\n\n* Unary numeric methods: 'neg', 'pos' and 'invert'\n\n* The numeric methods (including right hand and in-place variants):\n'add', 'sub', 'mul', 'matmul', 'truediv',\n'floordiv', 'mod', 'divmod', 'lshift',\n'rshift', 'and', 'xor', 'or', and 'pow'\n\n* Numeric conversion methods: 'complex', 'int', 'float'\nand 'index'\n\n* Descriptor methods: 'get', 'set' and 'delete'\n\n* Pickling: 'reduce', 'reduceex', 'getinitargs',\n'getnewargs', 'getstate' and 'setstate'\n\n* File system path representation: 'fspath'\n\n* Asynchronous iteration methods: 'aiter' and 'anext'\n\nChanged in version 3.8: Added support for *note\nos.PathLike.fspath(): a9b.\n",
            "subsections": []
        },
        "Changed in version 3.8: Added support for 'aenter', 'aexit',": {
            "content": "'aiter' and 'anext'.\n",
            "subsections": []
        },
        "The following methods exist but are 'not' supported as they are either": {
            "content": "in use by mock, can't be set dynamically, or can cause problems:\n\n* 'getattr', 'setattr', 'init' and 'new'\n\n* 'prepare', 'instancecheck', 'subclasscheck', 'del'\n\n---------- Footnotes ----------\n\n(1) Magic methods 'should' be looked up on the class rather than the\ninstance.  Different versions of Python are inconsistent about applying\nthis rule.  The supported protocol methods should work with all\nsupported versions of Python.\n\n(2) The function is basically hooked up to the class, but each 'Mock'\ninstance is kept isolated from the others.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Magic Mock,  Prev: Mocking Magic Methods,  Up: MagicMock and magic method support": {
            "content": "5.26.6.20 Magic Mock\n....................\n\nThere are two 'MagicMock' variants: *note MagicMock: cf4. and *note\nNonCallableMagicMock: 3d25.\n\n-- Class: unittest.mock.MagicMock (*args, kw)\n\n'MagicMock' is a subclass of *note Mock: 878. with default\nimplementations of most of the *note magic methods: 3d5b.  You can\nuse 'MagicMock' without having to configure the magic methods\nyourself.\n\nThe constructor parameters have the same meaning as for *note Mock:\n878.\n\nIf you use the 'spec' or 'specset' arguments then 'only' magic\nmethods that exist in the spec will be created.\n\n-- Class: unittest.mock.NonCallableMagicMock (*args, kw)\n\nA non-callable version of *note MagicMock: cf4.\n\nThe constructor parameters have the same meaning as for *note\nMagicMock: cf4, with the exception of 'returnvalue' and\n'sideeffect' which have no meaning on a non-callable mock.\n\nThe magic methods are setup with *note MagicMock: cf4. objects, so you\ncan configure them and use them in the usual way:\n\n>>> mock = MagicMock()\n>>> mock[3] = 'fish'\n>>> mock.setitem.assertcalledwith(3, 'fish')\n>>> mock.getitem.returnvalue = 'result'\n>>> mock[2]\n'result'\n",
            "subsections": []
        },
        "By default many of the protocol methods are required to return objects": {
            "content": "of a specific type.  These methods are preconfigured with a default\nreturn value, so that they can be used without you having to do anything\nif you aren't interested in the return value.  You can still 'set' the\nreturn value manually if you want to change the default.\n\nMethods and their defaults:\n\n* 'lt': *note NotImplemented: 5c5.\n\n* 'gt': 'NotImplemented'\n\n* 'le': 'NotImplemented'\n\n* 'ge': 'NotImplemented'\n\n* 'int': '1'\n\n* 'contains': 'False'\n\n* 'len': '0'\n\n* 'iter': 'iter([])'\n\n* 'exit': 'False'\n\n* 'aexit': 'False'\n\n* 'complex': '1j'\n\n* 'float': '1.0'\n\n* 'bool': 'True'\n\n* 'index': '1'\n\n* 'hash': default hash for the mock\n\n* 'str': default str for the mock\n\n* 'sizeof': default sizeof for the mock\n\nFor example:\n\n>>> mock = MagicMock()\n>>> int(mock)\n1\n>>> len(mock)\n0\n>>> list(mock)\n[]\n>>> object() in mock\nFalse\n",
            "subsections": []
        },
        "The two equality methods, 'eq()' and 'ne()', are special.  They": {
            "content": "do the default equality comparison on identity, using the *note\nsideeffect: 3d26. attribute, unless you change their return value to\nreturn something else:\n\n>>> MagicMock() == 3\nFalse\n>>> MagicMock() != 3\nTrue\n>>> mock = MagicMock()\n>>> mock.eq.returnvalue = True\n>>> mock == 3\nTrue\n",
            "subsections": []
        },
        "The return value of 'MagicMock.iter()' can be any iterable object": {
            "content": "and isn't required to be an iterator:\n\n>>> mock = MagicMock()\n>>> mock.iter.returnvalue = ['a', 'b', 'c']\n>>> list(mock)\n['a', 'b', 'c']\n>>> list(mock)\n['a', 'b', 'c']\n",
            "subsections": []
        },
        "If the return value 'is' an iterator, then iterating over it once will": {
            "content": "consume it and subsequent iterations will result in an empty list:\n\n>>> mock.iter.returnvalue = iter(['a', 'b', 'c'])\n>>> list(mock)\n['a', 'b', 'c']\n>>> list(mock)\n[]\n\n'MagicMock' has all of the supported magic methods configured except for\nsome of the obscure and obsolete ones.  You can still set these up if\nyou want.\n",
            "subsections": []
        },
        "Magic methods that are supported but not setup by default in 'MagicMock'": {
            "content": "are:\n\n* 'subclasses'\n\n* 'dir'\n\n* 'format'\n\n* 'get', 'set' and 'delete'\n\n* 'reversed' and 'missing'\n\n* 'reduce', 'reduceex', 'getinitargs', 'getnewargs',\n'getstate' and 'setstate'\n\n* 'getformat'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Helpers,  Next: Order of precedence of sideeffect returnvalue and wraps,  Prev: MagicMock and magic method support,  Up: unittest mock -- mock object library": {
            "content": "5.26.6.21 Helpers\n.................\n\n* Menu:\n\n* sentinel::\n* DEFAULT::\n* call::\n* createautospec::\n* ANY::\n* FILTERDIR::\n* mockopen::\n* Autospeccing::\n* Sealing mocks::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: sentinel,  Next: DEFAULT,  Up: Helpers": {
            "content": "5.26.6.22 sentinel\n..................\n\n-- Data: unittest.mock.sentinel\n\nThe 'sentinel' object provides a convenient way of providing unique\nobjects for your tests.\n\nAttributes are created on demand when you access them by name.\nAccessing the same attribute will always return the same object.\nThe objects returned have a sensible repr so that test failure\nmessages are readable.\n\nChanged in version 3.7: The 'sentinel' attributes now preserve\ntheir identity when they are *note copied: 23. or *note pickled:\na1.\n",
            "subsections": []
        },
        "Sometimes when testing you need to test that a specific object is passed": {
            "content": "as an argument to another method, or returned.  It can be common to\ncreate named sentinel objects to test this.  *note sentinel: 9e3.\nprovides a convenient way of creating and testing the identity of\nobjects like this.\n",
            "subsections": []
        },
        "In this example we monkey patch 'method' to return": {
            "content": "'sentinel.someobject':\n\n>>> real = ProductionClass()\n>>> real.method = Mock(name=\"method\")\n>>> real.method.returnvalue = sentinel.someobject\n>>> result = real.method()\n>>> assert result is sentinel.someobject\n>>> result\nsentinel.someobject\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: DEFAULT,  Next: call,  Prev: sentinel,  Up: Helpers": {
            "content": "5.26.6.23 DEFAULT\n.................\n\n-- Data: unittest.mock.DEFAULT\n\nThe *note DEFAULT: 3d27. object is a pre-created sentinel (actually\n'sentinel.DEFAULT').  It can be used by *note sideeffect: 3d26.\nfunctions to indicate that the normal return value should be used.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: call,  Next: createautospec,  Prev: DEFAULT,  Up: Helpers": {
            "content": "5.26.6.24 call\n..............\n\n-- Function: unittest.mock.call (*args, kwargs)\n\n*note call(): 173d. is a helper object for making simpler\nassertions, for comparing with *note callargs: 16ee, *note\ncallargslist: 3d36, *note mockcalls: 3d2d. and *note\nmethodcalls: 3d30.  *note call(): 173d. can also be used with\n*note asserthascalls(): 3d2c.\n\n>>> m = MagicMock(returnvalue=None)\n>>> m(1, 2, a='foo', b='bar')\n>>> m()\n>>> m.callargslist == [call(1, 2, a='foo', b='bar'), call()]\nTrue\n\n-- Method: call.calllist ()\n\nFor a call object that represents multiple calls, *note\ncalllist(): 3d61. returns a list of all the intermediate calls as\nwell as the final call.\n\n'calllist' is particularly useful for making assertions on \"chained\ncalls\".  A chained call is multiple calls on a single line of code.\nThis results in multiple entries in *note mockcalls: 3d2d. on a mock.\nManually constructing the sequence of calls can be tedious.\n\n*note calllist(): 3d61. can construct the sequence of calls from the\nsame chained call:\n\n>>> m = MagicMock()\n>>> m(1).method(arg='foo').other('bar')(2.0)\n<MagicMock name='mock().method().other()()' id='...'>\n>>> kall = call(1).method(arg='foo').other('bar')(2.0)\n>>> kall.calllist()\n[call(1),\ncall().method(arg='foo'),\ncall().method().other('bar'),\ncall().method().other()(2.0)]\n>>> m.mockcalls == kall.calllist()\nTrue\nA 'call' object is either a tuple of (positional args, keyword args) or\n(name, positional args, keyword args) depending on how it was\nconstructed.  When you construct them yourself this isn't particularly\ninteresting, but the 'call' objects that are in the *note\nMock.callargs: 16ee, *note Mock.callargslist: 3d36. and *note",
            "subsections": []
        },
        "Mock.mockcalls: 3d2d. attributes can be introspected to get at the": {
            "content": "individual arguments they contain.\n\nThe 'call' objects in *note Mock.callargs: 16ee. and *note",
            "subsections": []
        },
        "Mock.callargslist: 3d36. are two-tuples of (positional args, keyword": {
            "content": "args) whereas the 'call' objects in *note Mock.mockcalls: 3d2d, along\nwith ones you construct yourself, are three-tuples of (name, positional\nargs, keyword args).\n\nYou can use their \"tupleness\" to pull out the individual arguments for\nmore complex introspection and assertions.  The positional arguments are\na tuple (an empty tuple if there are no positional arguments) and the\nkeyword arguments are a dictionary:\n\n>>> m = MagicMock(returnvalue=None)\n>>> m(1, 2, 3, arg='one', arg2='two')\n>>> kall = m.callargs\n>>> kall.args\n(1, 2, 3)\n>>> kall.kwargs\n{'arg': 'one', 'arg2': 'two'}\n>>> kall.args is kall[0]\nTrue\n>>> kall.kwargs is kall[1]\nTrue\n\n>>> m = MagicMock()\n>>> m.foo(4, 5, 6, arg='two', arg2='three')\n<MagicMock name='mock.foo()' id='...'>\n>>> kall = m.mockcalls[0]\n>>> name, args, kwargs = kall\n>>> name\n'foo'\n>>> args\n(4, 5, 6)\n>>> kwargs\n{'arg': 'two', 'arg2': 'three'}\n>>> name is m.mockcalls[0][0]\nTrue\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: createautospec,  Next: ANY,  Prev: call,  Up: Helpers": {
            "content": "5.26.6.25 createautospec\n.........................\n\n-- Function: unittest.mock.createautospec (spec, specset=False,\ninstance=False, kwargs)\n\nCreate a mock object using another object as a spec.  Attributes on\nthe mock will use the corresponding attribute on the 'spec' object\nas their spec.\n\nFunctions or methods being mocked will have their arguments checked\nto ensure that they are called with the correct signature.\n\nIf 'specset' is 'True' then attempting to set attributes that\ndon't exist on the spec object will raise an *note AttributeError:\n395.\n\nIf a class is used as a spec then the return value of the mock (the\ninstance of the class) will have the same spec.  You can use a\nclass as the spec for an instance object by passing\n'instance=True'.  The returned mock will only be callable if\ninstances of the mock are callable.\n\n*note createautospec(): 13b3. also takes arbitrary keyword\narguments that are passed to the constructor of the created mock.\n\nSee *note Autospeccing: 3d22. for examples of how to use auto-speccing\nwith *note createautospec(): 13b3. and the 'autospec' argument to *note\npatch(): cf5.\n\nChanged in version 3.8: *note createautospec(): 13b3. now returns an\n*note AsyncMock: 877. if the target is an async function.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ANY,  Next: FILTERDIR,  Prev: createautospec,  Up: Helpers": {
            "content": "5.26.6.26 ANY\n.............\n\n-- Data: unittest.mock.ANY\n",
            "subsections": []
        },
        "Sometimes you may need to make assertions about 'some' of the arguments": {
            "content": "in a call to mock, but either not care about some of the arguments or\nwant to pull them individually out of *note callargs: 16ee. and make\nmore complex assertions on them.\n",
            "subsections": []
        },
        "To ignore certain arguments you can pass in objects that compare equal": {
            "content": "to 'everything'.  Calls to *note assertcalledwith(): 1799. and *note\nassertcalledoncewith(): 3d2a. will then succeed no matter what was\npassed in.\n\n>>> mock = Mock(returnvalue=None)\n>>> mock('foo', bar=object())\n>>> mock.assertcalledoncewith('foo', bar=ANY)\n\n*note ANY: 173b. can also be used in comparisons with call lists like\n*note mockcalls: 3d2d.:\n\n>>> m = MagicMock(returnvalue=None)\n>>> m(1)\n>>> m(1, 2)\n>>> m(object())\n>>> m.mockcalls == [call(1), call(1, 2), ANY]\nTrue\n\n*note ANY: 173b. is not limited to comparisons with call objects and so\ncan also be used in test assertions:\n\nclass TestStringMethods(unittest.TestCase):\n\ndef testsplit(self):\ns = 'hello world'\nself.assertEqual(s.split(), ['hello', ANY])\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: FILTERDIR,  Next: mockopen,  Prev: ANY,  Up: Helpers": {
            "content": "5.26.6.27 FILTERDIR\n....................\n\n-- Data: unittest.mock.FILTERDIR\n\n*note FILTERDIR: 3d32. is a module level variable that controls the way\nmock objects respond to *note dir(): 3ff.  The default is 'True', which\nuses the filtering described below, to only show useful members.  If you\ndislike this filtering, or need to switch it off for diagnostic\npurposes, then set 'mock.FILTERDIR = False'.\n",
            "subsections": []
        },
        "With filtering on, 'dir(somemock)' shows only useful attributes and": {
            "content": "will include any dynamically created attributes that wouldn't normally\nbe shown.  If the mock was created with a 'spec' (or 'autospec' of\ncourse) then all the attributes from the original are shown, even if\nthey haven't been accessed yet:\n\n>>> dir(Mock())\n['assertanycall',\n'assertcalled',\n'assertcalledonce',\n'assertcalledoncewith',\n'assertcalledwith',\n'asserthascalls',\n'assertnotcalled',\n'attachmock',\n...\n>>> from urllib import request\n>>> dir(Mock(spec=request))\n['AbstractBasicAuthHandler',\n'AbstractDigestAuthHandler',\n'AbstractHTTPHandler',\n'BaseHandler',\n...\n\nMany of the not-very-useful (private to *note Mock: 878. rather than the\nthing being mocked) underscore and double underscore prefixed attributes\nhave been filtered from the result of calling *note dir(): 3ff. on a\n*note Mock: 878.  If you dislike this behaviour you can switch it off by\nsetting the module level switch *note FILTERDIR: 3d32.:\n\n>>> from unittest import mock\n>>> mock.FILTERDIR = False\n>>> dir(mock.Mock())\n['NonCallableMockgetreturnvalue',\n'NonCallableMockgetsideeffect',\n'NonCallableMockreturnvaluedoc',\n'NonCallableMocksetreturnvalue',\n'NonCallableMocksetsideeffect',\n'call',\n'class',\n...\n",
            "subsections": []
        },
        "Alternatively you can just use 'vars(mymock)' (instance members) and": {
            "content": "'dir(type(mymock))' (type members) to bypass the filtering irrespective\nof 'mock.FILTERDIR'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: mockopen,  Next: Autospeccing,  Prev: FILTERDIR,  Up: Helpers": {
            "content": "5.26.6.28 mockopen\n...................\n\n-- Function: unittest.mock.mockopen (mock=None, readdata=None)\n\nA helper function to create a mock to replace the use of *note\nopen(): 26e.  It works for *note open(): 26e. called directly or\nused as a context manager.\n\nThe 'mock' argument is the mock object to configure.  If 'None'\n(the default) then a *note MagicMock: cf4. will be created for you,\nwith the API limited to methods or attributes available on standard\nfile handles.\n\n'readdata' is a string for the 'read()', *note readline(): 11a1,\nand *note readlines(): 2040. methods of the file handle to return.\nCalls to those methods will take data from 'readdata' until it is\ndepleted.  The mock of these methods is pretty simplistic: every\ntime the 'mock' is called, the 'readdata' is rewound to the start.\nIf you need more control over the data that you are feeding to the\ntested code you will need to customize this mock for yourself.\nWhen that is insufficient, one of the in-memory filesystem packages\non PyPI(1) can offer a realistic filesystem for testing.\n\nChanged in version 3.4: Added *note readline(): 11a1. and *note\nreadlines(): 2040. support.  The mock of 'read()' changed to\nconsume 'readdata' rather than returning it on each call.\n\nChanged in version 3.5: 'readdata' is now reset on each call to\nthe 'mock'.\n\nChanged in version 3.8: Added *note iter(): 1a45. to\nimplementation so that iteration (such as in for loops) correctly\nconsumes 'readdata'.\n\nUsing *note open(): 26e. as a context manager is a great way to ensure\nyour file handles are closed properly and is becoming common:\n\nwith open('/some/path', 'w') as f:\nf.write('something')\n\nThe issue is that even if you mock out the call to *note open(): 26e. it\nis the 'returned object' that is used as a context manager (and has\n*note enter(): 389. and *note exit(): 1175. called).\n\nMocking context managers with a *note MagicMock: cf4. is common enough\nand fiddly enough that a helper function is useful.\n\n>>> m = mockopen()\n>>> with patch('main.open', m):\n...     with open('foo', 'w') as h:\n...         h.write('some stuff')\n...\n>>> m.mockcalls\n[call('foo', 'w'),\ncall().enter(),\ncall().write('some stuff'),\ncall().exit(None, None, None)]\n>>> m.assertcalledoncewith('foo', 'w')\n>>> handle = m()\n>>> handle.write.assertcalledoncewith('some stuff')\n\nAnd for reading files:\n\n>>> with patch('main.open', mockopen(readdata='bibble')) as m:\n...     with open('foo') as h:\n...         result = h.read()\n...\n>>> m.assertcalledoncewith('foo')\n>>> assert result == 'bibble'\n\n---------- Footnotes ----------\n\n(1) https://pypi.org\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Autospeccing,  Next: Sealing mocks,  Prev: mockopen,  Up: Helpers": {
            "content": "5.26.6.29 Autospeccing\n......................\n",
            "subsections": []
        },
        "Autospeccing is based on the existing 'spec' feature of mock.  It limits": {
            "content": "the api of mocks to the api of an original object (the spec), but it is\nrecursive (implemented lazily) so that attributes of mocks only have the\nsame api as the attributes of the spec.  In addition mocked functions /\nmethods have the same call signature as the original so they raise a\n*note TypeError: 28e. if they are called incorrectly.\n\nBefore I explain how auto-speccing works, here's why it is needed.\n\n*note Mock: 878. is a very powerful and flexible object, but it suffers\nfrom two flaws when used to mock out objects from a system under test.\nOne of these flaws is specific to the *note Mock: 878. api and the other\nis a more general problem with using mock objects.\n\nFirst the problem specific to *note Mock: 878.  *note Mock: 878. has two\nassert methods that are extremely handy: *note assertcalledwith():\n1799. and *note assertcalledoncewith(): 3d2a.\n\n>>> mock = Mock(name='Thing', returnvalue=None)\n>>> mock(1, 2, 3)\n>>> mock.assertcalledoncewith(1, 2, 3)\n>>> mock(1, 2, 3)\n>>> mock.assertcalledoncewith(1, 2, 3)\nTraceback (most recent call last):\n...\nAssertionError: Expected 'mock' to be called once. Called 2 times.\n",
            "subsections": []
        },
        "Because mocks auto-create attributes on demand, and allow you to call": {
            "content": "them with arbitrary arguments, if you misspell one of these assert\nmethods then your assertion is gone:\n\n>>> mock = Mock(name='Thing', returnvalue=None)\n>>> mock(1, 2, 3)\n>>> mock.assretcalledoncewith(4, 5, 6)  # Intentional typo!\n\nYour tests can pass silently and incorrectly because of the typo.\n",
            "subsections": []
        },
        "The second issue is more general to mocking.  If you refactor some of": {
            "content": "your code, rename members and so on, any tests for code that is still\nusing the 'old api' but uses mocks instead of the real objects will\nstill pass.  This means your tests can all pass even though your code is\nbroken.\n",
            "subsections": []
        },
        "Note that this is another reason why you need integration tests as well": {
            "content": "as unit tests.  Testing everything in isolation is all fine and dandy,\nbut if you don't test how your units are \"wired together\" there is still\nlots of room for bugs that tests might have caught.\n\n'mock' already provides a feature to help with this, called speccing.",
            "subsections": []
        },
        "If you use a class or instance as the 'spec' for a mock then you can": {
            "content": "only access attributes on the mock that exist on the real class:\n\n>>> from urllib import request\n>>> mock = Mock(spec=request.Request)\n>>> mock.assretcalledwith  # Intentional typo!\nTraceback (most recent call last):\n...\nAttributeError: Mock object has no attribute 'assretcalledwith'\n",
            "subsections": []
        },
        "The spec only applies to the mock itself, so we still have the same": {
            "content": "issue with any methods on the mock:\n\n>>> mock.hasdata()\n<mock.Mock object at 0x...>\n>>> mock.hasdata.assretcalledwith()  # Intentional typo!\n\nAuto-speccing solves this problem.  You can either pass 'autospec=True'\nto *note patch(): cf5. / *note patch.object(): 1725. or use the *note\ncreateautospec(): 13b3. function to create a mock with a spec.  If you\nuse the 'autospec=True' argument to *note patch(): cf5. then the object\nthat is being replaced will be used as the spec object.  Because the\nspeccing is done \"lazily\" (the spec is created as attributes on the mock\nare accessed) you can use it with very complex or deeply nested objects\n(like modules that import modules that import modules) without a big\nperformance hit.\n\nHere's an example of it in use:\n\n>>> from urllib import request\n>>> patcher = patch('main.request', autospec=True)\n>>> mockrequest = patcher.start()\n>>> request is mockrequest\nTrue\n>>> mockrequest.Request\n<MagicMock name='request.Request' spec='Request' id='...'>\n",
            "subsections": []
        },
        "You can see that 'request.Request' has a spec.  'request.Request' takes": {
            "content": "two arguments in the constructor (one of which is 'self').  Here's what\nhappens if we try to call it incorrectly:\n\n>>> req = request.Request()\nTraceback (most recent call last):\n...\nTypeError: <lambda>() takes at least 2 arguments (1 given)\n",
            "subsections": []
        },
        "The spec also applies to instantiated classes (i.e.  the return value of": {
            "content": "specced mocks):\n\n>>> req = request.Request('foo')\n>>> req\n<NonCallableMagicMock name='request.Request()' spec='Request' id='...'>\n\n'Request' objects are not callable, so the return value of instantiating\nour mocked out 'request.Request' is a non-callable mock.  With the spec\nin place any typos in our asserts will raise the correct error:\n\n>>> req.addheader('spam', 'eggs')\n<MagicMock name='request.Request().addheader()' id='...'>\n>>> req.addheader.assretcalledwith  # Intentional typo!\nTraceback (most recent call last):\n...\nAttributeError: Mock object has no attribute 'assretcalledwith'\n>>> req.addheader.assertcalledwith('spam', 'eggs')\n\nIn many cases you will just be able to add 'autospec=True' to your\nexisting *note patch(): cf5. calls and then be protected against bugs\ndue to typos and api changes.\n\nAs well as using 'autospec' through *note patch(): cf5. there is a *note\ncreateautospec(): 13b3. for creating autospecced mocks directly:\n\n>>> from urllib import request\n>>> mockrequest = createautospec(request)\n>>> mockrequest.Request('foo', 'bar')\n<NonCallableMagicMock name='mock.Request()' spec='Request' id='...'>\n",
            "subsections": []
        },
        "This isn't without caveats and limitations however, which is why it is": {
            "content": "not the default behaviour.  In order to know what attributes are\navailable on the spec object, autospec has to introspect (access\nattributes) the spec.  As you traverse attributes on the mock a\ncorresponding traversal of the original object is happening under the\nhood.  If any of your specced objects have properties or descriptors\nthat can trigger code execution then you may not be able to use\nautospec.  On the other hand it is much better to design your objects so\nthat introspection is safe (1).\n\nA more serious problem is that it is common for instance attributes to\nbe created in the *note init(): 47d. method and not to exist on the\nclass at all.  'autospec' can't know about any dynamically created\nattributes and restricts the api to visible attributes.\n\n>>> class Something:\n...   def init(self):\n...     self.a = 33\n...\n>>> with patch('main.Something', autospec=True):\n...   thing = Something()\n...   thing.a\n...\nTraceback (most recent call last):\n...\nAttributeError: Mock object has no attribute 'a'\n",
            "subsections": []
        },
        "There are a few different ways of resolving this problem.  The easiest,": {
            "content": "but not necessarily the least annoying, way is to simply set the\nrequired attributes on the mock after creation.  Just because 'autospec'\ndoesn't allow you to fetch attributes that don't exist on the spec it\ndoesn't prevent you setting them:\n\n>>> with patch('main.Something', autospec=True):\n...   thing = Something()\n...   thing.a = 33\n...\n",
            "subsections": []
        },
        "There is a more aggressive version of both 'spec' and 'autospec' that": {
            "content": "'does' prevent you setting non-existent attributes.  This is useful if\nyou want to ensure your code only 'sets' valid attributes too, but\nobviously it prevents this particular scenario:\n\n>>> with patch('main.Something', autospec=True, specset=True):\n...   thing = Something()\n...   thing.a = 33\n...\nTraceback (most recent call last):\n...\nAttributeError: Mock object has no attribute 'a'\n",
            "subsections": []
        },
        "Probably the best way of solving the problem is to add class attributes": {
            "content": "as default values for instance members initialised in *note init():\n47d.  Note that if you are only setting default attributes in\n'init()' then providing them via class attributes (shared between\ninstances of course) is faster too.  e.g.\n\nclass Something:\na = 33\n",
            "subsections": []
        },
        "This brings up another issue.  It is relatively common to provide a": {
            "content": "default value of 'None' for members that will later be an object of a\ndifferent type.  'None' would be useless as a spec because it wouldn't\nlet you access 'any' attributes or methods on it.  As 'None' is 'never'\ngoing to be useful as a spec, and probably indicates a member that will\nnormally of some other type, autospec doesn't use a spec for members\nthat are set to 'None'.  These will just be ordinary mocks (well -\nMagicMocks):\n\n>>> class Something:\n...     member = None\n...\n>>> mock = createautospec(Something)\n>>> mock.member.foo.bar.baz()\n<MagicMock name='mock.member.foo.bar.baz()' id='...'>\n",
            "subsections": []
        },
        "If modifying your production classes to add defaults isn't to your": {
            "content": "liking then there are more options.  One of these is simply to use an\ninstance as the spec rather than the class.  The other is to create a\nsubclass of the production class and add the defaults to the subclass\nwithout affecting the production class.  Both of these require you to\nuse an alternative object as the spec.  Thankfully *note patch(): cf5.\nsupports this - you can simply pass the alternative object as the\n'autospec' argument:\n\n>>> class Something:\n...   def init(self):\n...     self.a = 33\n...\n>>> class SomethingForTest(Something):\n...   a = 33\n...\n>>> p = patch('main.Something', autospec=SomethingForTest)\n>>> mock = p.start()\n>>> mock.a\n<NonCallableMagicMock name='Something.a' spec='int' id='...'>\n\n---------- Footnotes ----------\n\n(1) This only applies to classes or already instantiated objects.",
            "subsections": []
        },
        "Calling a mocked class to create a mock instance 'does not' create a": {
            "content": "real instance.  It is only attribute lookups - along with calls to *note\ndir(): 3ff. - that are done.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Sealing mocks,  Prev: Autospeccing,  Up: Helpers": {
            "content": "5.26.6.30 Sealing mocks\n.......................\n\n-- Function: unittest.mock.seal (mock)\n\nSeal will disable the automatic creation of mocks when accessing an\nattribute of the mock being sealed or any of its attributes that\nare already mocks recursively.\n\nIf a mock instance with a name or a spec is assigned to an\nattribute it won't be considered in the sealing chain.  This allows\none to prevent seal from fixing part of the mock object.\n\n>>> mock = Mock()\n>>> mock.submock.attribute1 = 2\n>>> mock.notsubmock = mock.Mock(name=\"samplename\")\n>>> seal(mock)\n>>> mock.newattribute  # This will raise AttributeError.\n>>> mock.submock.attribute2  # This will raise AttributeError.\n>>> mock.notsubmock.attribute2  # This won't raise.\n\nNew in version 3.7.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Order of precedence of sideeffect returnvalue and wraps,  Prev: Helpers,  Up: unittest mock -- mock object library": {
            "content": "5.26.6.31 Order of precedence of 'sideeffect', 'returnvalue' and 'wraps'\n..........................................................................\n\nThe order of their precedence is:\n\n1. *note sideeffect: 3d26.\n\n2. *note returnvalue: 3d28.\n\n3. 'wraps'\n\nIf all three are set, mock will return the value from *note sideeffect:\n3d26, ignoring *note returnvalue: 3d28. and the wrapped object\naltogether.  If any two are set, the one with the higher precedence will\nreturn the value.  Regardless of the order of which was set first, the\norder of precedence remains unchanged.\n\n>>> from unittest.mock import Mock\n>>> class Order:\n...     @staticmethod\n...     def getvalue():\n...         return \"third\"\n...\n>>> ordermock = Mock(spec=Order, wraps=Order)\n>>> ordermock.getvalue.sideeffect = [\"first\"]\n>>> ordermock.getvalue.returnvalue = \"second\"\n>>> ordermock.getvalue()\n'first'\n\nAs 'None' is the default value of *note sideeffect: 3d26, if you\nreassign its value back to 'None', the order of precedence will be\nchecked between *note returnvalue: 3d28. and the wrapped object,\nignoring *note sideeffect: 3d26.\n\n>>> ordermock.getvalue.sideeffect = None\n>>> ordermock.getvalue()\n'second'\n\nIf the value being returned by *note sideeffect: 3d26. is *note\nDEFAULT: 3d27, it is ignored and the order of precedence moves to the\nsuccessor to obtain the value to return.\n\n>>> from unittest.mock import DEFAULT\n>>> ordermock.getvalue.sideeffect = [DEFAULT]\n>>> ordermock.getvalue()\n'second'\n\nWhen *note Mock: 878. wraps an object, the default value of *note\nreturnvalue: 3d28. will be *note DEFAULT: 3d27.\n\n>>> ordermock = Mock(spec=Order, wraps=Order)\n>>> ordermock.returnvalue\nsentinel.DEFAULT\n>>> ordermock.getvalue.returnvalue\nsentinel.DEFAULT\n",
            "subsections": []
        },
        "The order of precedence will ignore this value and it will move to the": {
            "content": "last successor which is the wrapped object.\n",
            "subsections": []
        },
        "As the real call is being made to the wrapped object, creating an": {
            "content": "instance of this mock will return the real instance of the class.  The\npositional arguments, if any, required by the wrapped object must be\npassed.\n\n>>> ordermockinstance = ordermock()\n>>> isinstance(ordermockinstance, Order)\nTrue\n>>> ordermockinstance.getvalue()\n'third'\n\n>>> ordermock.getvalue.returnvalue = DEFAULT\n>>> ordermock.getvalue()\n'third'\n\n>>> ordermock.getvalue.returnvalue = \"second\"\n>>> ordermock.getvalue()\n'second'\n",
            "subsections": []
        },
        "But if you assign 'None' to it, this will not be ignored as it is an": {
            "content": "explicit assignment.  So, the order of precedence will not move to the\nwrapped object.\n\n>>> ordermock.getvalue.returnvalue = None\n>>> ordermock.getvalue() is None\nTrue\n",
            "subsections": []
        },
        "Even if you set all three at once when initializing the mock, the order": {
            "content": "of precedence remains the same:\n\n>>> ordermock = Mock(spec=Order, wraps=Order,\n...                   {\"getvalue.sideeffect\": [\"first\"],\n...                      \"getvalue.returnvalue\": \"second\"}\n...                   )\n...\n>>> ordermock.getvalue()\n'first'\n>>> ordermock.getvalue.sideeffect = None\n>>> ordermock.getvalue()\n'second'\n>>> ordermock.getvalue.returnvalue = DEFAULT\n>>> ordermock.getvalue()\n'third'\n\nIf *note sideeffect: 3d26. is exhausted, the order of precedence will\nnot cause a value to be obtained from the successors.  Instead,\n'StopIteration' exception is raised.\n\n>>> ordermock = Mock(spec=Order, wraps=Order)\n>>> ordermock.getvalue.sideeffect = [\"first side effect value\",\n...                                     \"another side effect value\"]\n>>> ordermock.getvalue.returnvalue = \"second\"\n\n>>> ordermock.getvalue()\n'first side effect value'\n>>> ordermock.getvalue()\n'another side effect value'\n\n>>> ordermock.getvalue()\nTraceback (most recent call last):\n...\nStopIteration\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: unittest mock -- getting started,  Next: 2to3 -- Automated Python 2 to 3 code translation,  Prev: unittest mock -- mock object library,  Up: Development Tools": {
            "content": "New in version 3.3.\n\n* Menu:\n\n* Using Mock::\n* Patch Decorators::\n* Further Examples::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using Mock,  Next: Patch Decorators,  Up: unittest mock -- getting started": {
            "content": "5.26.7.1 Using Mock\n...................\n\n* Menu:\n\n* Mock Patching Methods::\n* Mock for Method Calls on an Object::\n* Mocking Classes::\n* Naming your mocks::\n* Tracking all Calls::\n* Setting Return Values and Attributes::\n* Raising exceptions with mocks::\n* Side effect functions and iterables::\n* Mocking asynchronous iterators::\n* Mocking asynchronous context manager::\n* Creating a Mock from an Existing Object::\n* Using sideeffect to return per file content::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Mock Patching Methods,  Next: Mock for Method Calls on an Object,  Up: Using Mock": {
            "content": "5.26.7.2 Mock Patching Methods\n..............................\n\nCommon uses for *note Mock: 878. objects include:\n\n* Patching methods\n\n* Recording method calls on objects\n",
            "subsections": []
        },
        "You might want to replace a method on an object to check that it is": {
            "content": "called with the correct arguments by another part of the system:\n\n>>> real = SomeClass()\n>>> real.method = MagicMock(name='method')\n>>> real.method(3, 4, 5, key='value')\n<MagicMock name='method()' id='...'>\n",
            "subsections": []
        },
        "Once our mock has been used ('real.method' in this example) it has": {
            "content": "methods and attributes that allow you to make assertions about how it\nhas been used.\n\nNote: In most of these examples the *note Mock: 878. and *note\nMagicMock: cf4. classes are interchangeable.  As the 'MagicMock' is\nthe more capable class it makes a sensible one to use by default.\n\nOnce the mock has been called its *note called: 3d34. attribute is set\nto 'True'.  More importantly we can use the *note assertcalledwith():\n1799. or *note assertcalledoncewith(): 3d2a. method to check that it\nwas called with the correct arguments.\n",
            "subsections": []
        },
        "This example tests that calling 'ProductionClass().method' results in a": {
            "content": "call to the 'something' method:\n\n>>> class ProductionClass:\n...     def method(self):\n...         self.something(1, 2, 3)\n...     def something(self, a, b, c):\n...         pass\n...\n>>> real = ProductionClass()\n>>> real.something = MagicMock()\n>>> real.method()\n>>> real.something.assertcalledoncewith(1, 2, 3)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Mock for Method Calls on an Object,  Next: Mocking Classes,  Prev: Mock Patching Methods,  Up: Using Mock": {
            "content": "5.26.7.3 Mock for Method Calls on an Object\n...........................................\n",
            "subsections": []
        },
        "In the last example we patched a method directly on an object to check": {
            "content": "that it was called correctly.  Another common use case is to pass an\nobject into a method (or some part of the system under test) and then\ncheck that it is used in the correct way.\n",
            "subsections": []
        },
        "The simple 'ProductionClass' below has a 'closer' method.  If it is": {
            "content": "called with an object then it calls 'close' on it.\n\n>>> class ProductionClass:\n...     def closer(self, something):\n...         something.close()\n...\n",
            "subsections": []
        },
        "So to test it we need to pass in an object with a 'close' method and": {
            "content": "check that it was called correctly.\n\n>>> real = ProductionClass()\n>>> mock = Mock()\n>>> real.closer(mock)\n>>> mock.close.assertcalledwith()\n\nWe don't have to do any work to provide the 'close' method on our mock.",
            "subsections": []
        },
        "Accessing close creates it.  So, if 'close' hasn't already been called": {
            "content": "then accessing it in the test will create it, but *note\nassertcalledwith(): 1799. will raise a failure exception.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Mocking Classes,  Next: Naming your mocks,  Prev: Mock for Method Calls on an Object,  Up: Using Mock": {
            "content": "5.26.7.4 Mocking Classes\n........................\n\nA common use case is to mock out classes instantiated by your code under\ntest.  When you patch a class, then that class is replaced with a mock.",
            "subsections": []
        },
        "Instances are created by 'calling the class'.  This means you access the": {
            "content": "\"mock instance\" by looking at the return value of the mocked class.\n",
            "subsections": []
        },
        "In the example below we have a function 'somefunction' that": {
            "content": "instantiates 'Foo' and calls a method on it.  The call to *note patch():\ncf5. replaces the class 'Foo' with a mock.  The 'Foo' instance is the\nresult of calling the mock, so it is configured by modifying the mock\n*note returnvalue: 3d28.\n\n>>> def somefunction():\n...     instance = module.Foo()\n...     return instance.method()\n...\n>>> with patch('module.Foo') as mock:\n...     instance = mock.returnvalue\n...     instance.method.returnvalue = 'the result'\n...     result = somefunction()\n...     assert result == 'the result'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Naming your mocks,  Next: Tracking all Calls,  Prev: Mocking Classes,  Up: Using Mock": {
            "content": "5.26.7.5 Naming your mocks\n..........................\n",
            "subsections": []
        },
        "It can be useful to give your mocks a name.  The name is shown in the": {
            "content": "repr of the mock and can be helpful when the mock appears in test\nfailure messages.  The name is also propagated to attributes or methods\nof the mock:\n\n>>> mock = MagicMock(name='foo')\n>>> mock\n<MagicMock name='foo' id='...'>\n>>> mock.method\n<MagicMock name='foo.method' id='...'>\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Tracking all Calls,  Next: Setting Return Values and Attributes,  Prev: Naming your mocks,  Up: Using Mock": {
            "content": "5.26.7.6 Tracking all Calls\n...........................\n\nOften you want to track more than a single call to a method.  The *note\nmockcalls: 3d2d. attribute records all calls to child attributes of the\nmock - and also to their children.\n\n>>> mock = MagicMock()\n>>> mock.method()\n<MagicMock name='mock.method()' id='...'>\n>>> mock.attribute.method(10, x=53)\n<MagicMock name='mock.attribute.method()' id='...'>\n>>> mock.mockcalls\n[call.method(), call.attribute.method(10, x=53)]\n",
            "subsections": []
        },
        "If you make an assertion about 'mockcalls' and any unexpected methods": {
            "content": "have been called, then the assertion will fail.  This is useful because\nas well as asserting that the calls you expected have been made, you are\nalso checking that they were made in the right order and with no\nadditional calls:\n\nYou use the *note call: 173d. object to construct lists for comparing\nwith 'mockcalls':\n\n>>> expected = [call.method(), call.attribute.method(10, x=53)]\n>>> mock.mockcalls == expected\nTrue\n",
            "subsections": []
        },
        "However, parameters to calls that return mocks are not recorded, which": {
            "content": "means it is not possible to track nested calls where the parameters used\nto create ancestors are important:\n\n>>> m = Mock()\n>>> m.factory(important=True).deliver()\n<Mock name='mock.factory().deliver()' id='...'>\n>>> m.mockcalls[-1] == call.factory(important=False).deliver()\nTrue\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Setting Return Values and Attributes,  Next: Raising exceptions with mocks,  Prev: Tracking all Calls,  Up: Using Mock": {
            "content": "5.26.7.7 Setting Return Values and Attributes\n.............................................\n\nSetting the return values on a mock object is trivially easy:\n\n>>> mock = Mock()\n>>> mock.returnvalue = 3\n>>> mock()\n3\n\nOf course you can do the same for methods on the mock:\n\n>>> mock = Mock()\n>>> mock.method.returnvalue = 3\n>>> mock.method()\n3\n\nThe return value can also be set in the constructor:\n\n>>> mock = Mock(returnvalue=3)\n>>> mock()\n3\n\nIf you need an attribute setting on your mock, just do it:\n\n>>> mock = Mock()\n>>> mock.x = 3\n>>> mock.x\n3\n",
            "subsections": []
        },
        "Sometimes you want to mock up a more complex situation, like for example": {
            "content": "'mock.connection.cursor().execute(\"SELECT 1\")'.  If we wanted this call\nto return a list, then we have to configure the result of the nested\ncall.\n\nWe can use *note call: 173d. to construct the set of calls in a \"chained\ncall\" like this for easy assertion afterwards:\n\n>>> mock = Mock()\n>>> cursor = mock.connection.cursor.returnvalue\n>>> cursor.execute.returnvalue = ['foo']\n>>> mock.connection.cursor().execute(\"SELECT 1\")\n['foo']\n>>> expected = call.connection.cursor().execute(\"SELECT 1\").calllist()\n>>> mock.mockcalls\n[call.connection.cursor(), call.connection.cursor().execute('SELECT 1')]\n>>> mock.mockcalls == expected\nTrue\n",
            "subsections": []
        },
        "It is the call to '.calllist()' that turns our call object into a list": {
            "content": "of calls representing the chained calls.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Raising exceptions with mocks,  Next: Side effect functions and iterables,  Prev: Setting Return Values and Attributes,  Up: Using Mock": {
            "content": "5.26.7.8 Raising exceptions with mocks\n......................................\n\nA useful attribute is *note sideeffect: 3d26.  If you set this to an\nexception class or instance then the exception will be raised when the\nmock is called.\n\n>>> mock = Mock(sideeffect=Exception('Boom!'))\n>>> mock()\nTraceback (most recent call last):\n...\nException: Boom!\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Side effect functions and iterables,  Next: Mocking asynchronous iterators,  Prev: Raising exceptions with mocks,  Up: Using Mock": {
            "content": "5.26.7.9 Side effect functions and iterables\n............................................\n\n'sideeffect' can also be set to a function or an iterable.  The use\ncase for 'sideeffect' as an iterable is where your mock is going to be\ncalled several times, and you want each call to return a different\nvalue.  When you set 'sideeffect' to an iterable every call to the mock\nreturns the next value from the iterable:\n\n>>> mock = MagicMock(sideeffect=[4, 5, 6])\n>>> mock()\n4\n>>> mock()\n5\n>>> mock()\n6\n",
            "subsections": []
        },
        "For more advanced use cases, like dynamically varying the return values": {
            "content": "depending on what the mock is called with, 'sideeffect' can be a\nfunction.  The function will be called with the same arguments as the\nmock.  Whatever the function returns is what the call returns:\n\n>>> vals = {(1, 2): 1, (2, 3): 2}\n>>> def sideeffect(*args):\n...     return vals[args]\n...\n>>> mock = MagicMock(sideeffect=sideeffect)\n>>> mock(1, 2)\n1\n>>> mock(2, 3)\n2\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Mocking asynchronous iterators,  Next: Mocking asynchronous context manager,  Prev: Side effect functions and iterables,  Up: Using Mock": {
            "content": "5.26.7.10 Mocking asynchronous iterators\n........................................\n\nSince Python 3.8, 'AsyncMock' and 'MagicMock' have support to mock *note\nAsynchronous Iterators: bd5. through 'aiter'.  The *note\nreturnvalue: 3d28. attribute of 'aiter' can be used to set the\nreturn values to be used for iteration.\n\n>>> mock = MagicMock()  # AsyncMock also works here\n>>> mock.aiter.returnvalue = [1, 2, 3]\n>>> async def main():\n...     return [i async for i in mock]\n...\n>>> asyncio.run(main())\n[1, 2, 3]\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Mocking asynchronous context manager,  Next: Creating a Mock from an Existing Object,  Prev: Mocking asynchronous iterators,  Up: Using Mock": {
            "content": "5.26.7.11 Mocking asynchronous context manager\n..............................................\n\nSince Python 3.8, 'AsyncMock' and 'MagicMock' have support to mock *note",
            "subsections": []
        },
        "Asynchronous Context Managers: 3c4. through 'aenter' and": {
            "content": "'aexit'.  By default, 'aenter' and 'aexit' are 'AsyncMock'\ninstances that return an async function.\n\n>>> class AsyncContextManager:\n...     async def aenter(self):\n...         return self\n...     async def aexit(self, exctype, exc, tb):\n...         pass\n...\n>>> mockinstance = MagicMock(AsyncContextManager())  # AsyncMock also works here\n>>> async def main():\n...     async with mockinstance as result:\n...         pass\n...\n>>> asyncio.run(main())\n>>> mockinstance.aenter.assertawaitedonce()\n>>> mockinstance.aexit.assertawaitedonce()\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Creating a Mock from an Existing Object,  Next: Using sideeffect to return per file content,  Prev: Mocking asynchronous context manager,  Up: Using Mock": {
            "content": "5.26.7.12 Creating a Mock from an Existing Object\n.................................................\n",
            "subsections": []
        },
        "One problem with over use of mocking is that it couples your tests to": {
            "content": "the implementation of your mocks rather than your real code.  Suppose\nyou have a class that implements 'somemethod'.  In a test for another\nclass, you provide a mock of this object that 'also' provides\n'somemethod'.  If later you refactor the first class, so that it no\nlonger has 'somemethod' - then your tests will continue to pass even\nthough your code is now broken!\n\n*note Mock: 878. allows you to provide an object as a specification for\nthe mock, using the 'spec' keyword argument.  Accessing methods /\nattributes on the mock that don't exist on your specification object\nwill immediately raise an attribute error.  If you change the\nimplementation of your specification, then tests that use that class\nwill start failing immediately without you having to instantiate the\nclass in those tests.\n\n>>> mock = Mock(spec=SomeClass)\n>>> mock.oldmethod()\nTraceback (most recent call last):\n...\nAttributeError: object has no attribute 'oldmethod'\n",
            "subsections": []
        },
        "Using a specification also enables a smarter matching of calls made to": {
            "content": "the mock, regardless of whether some parameters were passed as\npositional or named arguments:\n\n>>> def f(a, b, c): pass\n...\n>>> mock = Mock(spec=f)\n>>> mock(1, 2, 3)\n<Mock name='mock()' id='140161580456576'>\n>>> mock.assertcalledwith(a=1, b=2, c=3)\n",
            "subsections": []
        },
        "If you want this smarter matching to also work with method calls on the": {
            "content": "mock, you can use *note auto-speccing: 3d22.\n",
            "subsections": []
        },
        "If you want a stronger form of specification that prevents the setting": {
            "content": "of arbitrary attributes as well as the getting of them then you can use\n'specset' instead of 'spec'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using sideeffect to return per file content,  Prev: Creating a Mock from an Existing Object,  Up: Using Mock": {
            "content": "5.26.7.13 Using sideeffect to return per file content\n......................................................\n\n*note mockopen(): 1764. is used to patch *note open(): 26e. method.\n*note sideeffect: 3d26. can be used to return a new Mock object per\ncall.  This can be used to return different contents per file stored in\na dictionary:\n\nDEFAULT = \"default\"\ndatadict = {\"file1\": \"data1\",\n\"file2\": \"data2\"}\n\ndef opensideeffect(name):\nreturn mockopen(readdata=datadict.get(name, DEFAULT))()\n\nwith patch(\"builtins.open\", sideeffect=opensideeffect):\nwith open(\"file1\") as file1:\nassert file1.read() == \"data1\"\n\nwith open(\"file2\") as file2:\nassert file2.read() == \"data2\"\n\nwith open(\"file3\") as file2:\nassert file2.read() == \"default\"\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Patch Decorators,  Next: Further Examples,  Prev: Using Mock,  Up: unittest mock -- getting started": {
            "content": "5.26.7.14 Patch Decorators\n..........................\n\nNote: With *note patch(): cf5. it matters that you patch objects in\nthe namespace where they are looked up.  This is normally\nstraightforward, but for a quick guide read *note where to patch:\n3d20.\n\nA common need in tests is to patch a class attribute or a module\nattribute, for example patching a builtin or patching a class in a\nmodule to test that it is instantiated.  Modules and classes are\neffectively global, so patching on them has to be undone after the test\nor the patch will persist into other tests and cause hard to diagnose\nproblems.\n\nmock provides three convenient decorators for this: *note patch(): cf5,\n*note patch.object(): 1725. and *note patch.dict(): 176a.  'patch' takes\na single string, of the form 'package.module.Class.attribute' to specify\nthe attribute you are patching.  It also optionally takes a value that\nyou want the attribute (or class or whatever) to be replaced with.\n'patch.object' takes an object and the name of the attribute you would\nlike patched, plus optionally the value to patch it with.\n\n'patch.object':\n\n>>> original = SomeClass.attribute\n>>> @patch.object(SomeClass, 'attribute', sentinel.attribute)\n... def test():\n...     assert SomeClass.attribute == sentinel.attribute\n...\n>>> test()\n>>> assert SomeClass.attribute == original\n\n>>> @patch('package.module.attribute', sentinel.attribute)\n... def test():\n...     from package.module import attribute\n...     assert attribute is sentinel.attribute\n...\n>>> test()\n\nIf you are patching a module (including *note builtins: 10.) then use\n*note patch(): cf5. instead of *note patch.object(): 1725.:\n\n>>> mock = MagicMock(returnvalue=sentinel.filehandle)\n>>> with patch('builtins.open', mock):\n...     handle = open('filename', 'r')\n...\n>>> mock.assertcalledwith('filename', 'r')\n>>> assert handle == sentinel.filehandle, \"incorrect file handle returned\"\n\nThe module name can be 'dotted', in the form 'package.module' if needed:\n\n>>> @patch('package.module.ClassName.attribute', sentinel.attribute)\n... def test():\n...     from package.module import ClassName\n...     assert ClassName.attribute == sentinel.attribute\n...\n>>> test()\n\nA nice pattern is to actually decorate test methods themselves:\n\n>>> class MyTest(unittest.TestCase):\n...     @patch.object(SomeClass, 'attribute', sentinel.attribute)\n...     def testsomething(self):\n...         self.assertEqual(SomeClass.attribute, sentinel.attribute)\n...\n>>> original = SomeClass.attribute\n>>> MyTest('testsomething').testsomething()\n>>> assert SomeClass.attribute == original\n\nIf you want to patch with a Mock, you can use *note patch(): cf5. with\nonly one argument (or *note patch.object(): 1725. with two arguments).",
            "subsections": []
        },
        "The mock will be created for you and passed into the test function /": {
            "content": "method:\n\n>>> class MyTest(unittest.TestCase):\n...     @patch.object(SomeClass, 'staticmethod')\n...     def testsomething(self, mockmethod):\n...         SomeClass.staticmethod()\n...         mockmethod.assertcalledwith()\n...\n>>> MyTest('testsomething').testsomething()\n\nYou can stack up multiple patch decorators using this pattern:\n\n>>> class MyTest(unittest.TestCase):\n...     @patch('package.module.ClassName1')\n...     @patch('package.module.ClassName2')\n...     def testsomething(self, MockClass2, MockClass1):\n...         self.assertIs(package.module.ClassName1, MockClass1)\n...         self.assertIs(package.module.ClassName2, MockClass2)\n...\n>>> MyTest('testsomething').testsomething()\n",
            "subsections": []
        },
        "When you nest patch decorators the mocks are passed in to the decorated": {
            "content": "function in the same order they applied (the normal 'Python' order that\ndecorators are applied).  This means from the bottom up, so in the\nexample above the mock for 'testmodule.ClassName2' is passed in first.\n\nThere is also *note patch.dict(): 176a. for setting values in a\ndictionary just during a scope and restoring the dictionary to its\noriginal state when the test ends:\n\n>>> foo = {'key': 'value'}\n>>> original = foo.copy()\n>>> with patch.dict(foo, {'newkey': 'newvalue'}, clear=True):\n...     assert foo == {'newkey': 'newvalue'}\n...\n>>> assert foo == original\n\n'patch', 'patch.object' and 'patch.dict' can all be used as context\nmanagers.\n\nWhere you use *note patch(): cf5. to create a mock for you, you can get\na reference to the mock using the \"as\" form of the with statement:\n\n>>> class ProductionClass:\n...     def method(self):\n...         pass\n...\n>>> with patch.object(ProductionClass, 'method') as mockmethod:\n...     mockmethod.returnvalue = None\n...     real = ProductionClass()\n...     real.method(1, 2, 3)\n...\n>>> mockmethod.assertcalledwith(1, 2, 3)\n",
            "subsections": []
        },
        "As an alternative 'patch', 'patch.object' and 'patch.dict' can be used": {
            "content": "as class decorators.  When used in this way it is the same as applying\nthe decorator individually to every method whose name starts with\n\"test\".\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Further Examples,  Prev: Patch Decorators,  Up: unittest mock -- getting started": {
            "content": "5.26.7.15 Further Examples\n..........................\n\nHere are some more examples for some slightly more advanced scenarios.\n\n* Menu:\n\n* Mocking chained calls::\n* Partial mocking::\n* Mocking a Generator Method::\n* Applying the same patch to every test method::\n* Mocking Unbound Methods::\n* Checking multiple calls with mock::\n* Coping with mutable arguments::\n* Nesting Patches::\n* Mocking a dictionary with MagicMock::\n* Mock subclasses and their attributes::\n* Mocking imports with patch.dict: Mocking imports with patch dict.\n* Tracking order of calls and less verbose call assertions::\n* More complex argument matching::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Mocking chained calls,  Next: Partial mocking,  Up: Further Examples": {
            "content": "5.26.7.16 Mocking chained calls\n...............................\n",
            "subsections": []
        },
        "Mocking chained calls is actually straightforward with mock once you": {
            "content": "understand the *note returnvalue: 3d28. attribute.  When a mock is\ncalled for the first time, or you fetch its 'returnvalue' before it has\nbeen called, a new *note Mock: 878. is created.\n",
            "subsections": []
        },
        "This means that you can see how the object returned from a call to a": {
            "content": "mocked object has been used by interrogating the 'returnvalue' mock:\n\n>>> mock = Mock()\n>>> mock().foo(a=2, b=3)\n<Mock name='mock().foo()' id='...'>\n>>> mock.returnvalue.foo.assertcalledwith(a=2, b=3)\n",
            "subsections": []
        },
        "From here it is a simple step to configure and then make assertions": {
            "content": "about chained calls.  Of course another alternative is writing your code\nin a more testable way in the first place...\n\nSo, suppose we have some code that looks a little bit like this:\n\n>>> class Something:\n...     def init(self):\n...         self.backend = BackendProvider()\n...     def method(self):\n...         response = self.backend.getendpoint('foobar').createcall('spam', 'eggs').startcall()\n...         # more code\n",
            "subsections": []
        },
        "Assuming that 'BackendProvider' is already well tested, how do we test": {
            "content": "'method()'?  Specifically, we want to test that the code section '# more\ncode' uses the response object in the correct way.\n",
            "subsections": []
        },
        "As this chain of calls is made from an instance attribute we can monkey": {
            "content": "patch the 'backend' attribute on a 'Something' instance.  In this\nparticular case we are only interested in the return value from the\nfinal call to 'startcall' so we don't have much configuration to do.",
            "subsections": []
        },
        "Let's assume the object it returns is 'file-like', so we'll ensure that": {
            "content": "our response object uses the builtin *note open(): 26e. as its 'spec'.\n",
            "subsections": []
        },
        "To do this we create a mock instance as our mock backend and create a": {
            "content": "mock response object for it.  To set the response as the return value\nfor that final 'startcall' we could do this:\n\nmockbackend.getendpoint.returnvalue.createcall.returnvalue.startcall.returnvalue = mockresponse\n\nWe can do that in a slightly nicer way using the *note configuremock():\n3d29. method to directly set the return value for us:\n\n>>> something = Something()\n>>> mockresponse = Mock(spec=open)\n>>> mockbackend = Mock()\n>>> config = {'getendpoint.returnvalue.createcall.returnvalue.startcall.returnvalue': mockresponse}\n>>> mockbackend.configuremock(config)\n\nWith these we monkey patch the \"mock backend\" in place and can make the\nreal call:\n\n>>> something.backend = mockbackend\n>>> something.method()\n\nUsing *note mockcalls: 3d2d. we can check the chained call with a\nsingle assert.  A chained call is several calls in one line of code, so\nthere will be several entries in 'mockcalls'.  We can use *note\ncall.calllist(): 3d61. to create this list of calls for us:\n\n>>> chained = call.getendpoint('foobar').createcall('spam', 'eggs').startcall()\n>>> calllist = chained.calllist()\n>>> assert mockbackend.mockcalls == calllist\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Partial mocking,  Next: Mocking a Generator Method,  Prev: Mocking chained calls,  Up: Further Examples": {
            "content": "5.26.7.17 Partial mocking\n.........................\n\nIn some tests I wanted to mock out a call to *note\ndatetime.date.today(): 1325. to return a known date, but I didn't want\nto prevent the code under test from creating new date objects.\nUnfortunately *note datetime.date: 70f. is written in C, and so I\ncouldn't just monkey-patch out the static *note datetime.date.today():\n1325. method.\n\nI found a simple way of doing this that involved effectively wrapping\nthe date class with a mock, but passing through calls to the constructor\nto the real class (and returning real instances).\n\nThe *note patch decorator: cf5. is used here to mock out the 'date'\nclass in the module under test.  The *note sideeffect: 3d26. attribute\non the mock date class is then set to a lambda function that returns a\nreal date.  When the mock date class is called a real date will be\nconstructed and returned by 'sideeffect'.\n\n>>> from datetime import date\n>>> with patch('mymodule.date') as mockdate:\n...     mockdate.today.returnvalue = date(2010, 10, 8)\n...     mockdate.sideeffect = lambda *args, kw: date(*args, kw)\n...\n...     assert mymodule.date.today() == date(2010, 10, 8)\n...     assert mymodule.date(2009, 6, 8) == date(2009, 6, 8)\n\nNote that we don't patch *note datetime.date: 70f. globally, we patch\n'date' in the module that 'uses' it.  See *note where to patch: 3d20.\n",
            "subsections": []
        },
        "When 'date.today()' is called a known date is returned, but calls to the": {
            "content": "'date(...)' constructor still return normal dates.  Without this you can\nfind yourself having to calculate an expected result using exactly the\nsame algorithm as the code under test, which is a classic testing\nanti-pattern.\n",
            "subsections": []
        },
        "Calls to the date constructor are recorded in the 'mockdate' attributes": {
            "content": "('callcount' and friends) which may also be useful for your tests.\n",
            "subsections": []
        },
        "An alternative way of dealing with mocking dates, or other builtin": {
            "content": "classes, is discussed in this blog entry(1).\n\n---------- Footnotes ----------\n\n(1)\nhttps://williambert.online/2011/07/how-to-unit-testing-in-django-with-mocking-and-patching/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Mocking a Generator Method,  Next: Applying the same patch to every test method,  Prev: Partial mocking,  Up: Further Examples": {
            "content": "5.26.7.18 Mocking a Generator Method\n....................................\n\nA Python generator is a function or method that uses the *note yield:\n7f1. statement to return a series of values when iterated over (1).\n\nA generator method / function is called to return the generator object.",
            "subsections": []
        },
        "It is the generator object that is then iterated over.  The protocol": {
            "content": "method for iteration is *note iter(): 1a45, so we can mock this\nusing a *note MagicMock: cf4.\n\nHere's an example class with an \"iter\" method implemented as a\ngenerator:\n\n>>> class Foo:\n...     def iter(self):\n...         for i in [1, 2, 3]:\n...             yield i\n...\n>>> foo = Foo()\n>>> list(foo.iter())\n[1, 2, 3]\n\nHow would we mock this class, and in particular its \"iter\" method?\n",
            "subsections": []
        },
        "To configure the values returned from the iteration (implicit in the": {
            "content": "call to *note list: 3dc.), we need to configure the object returned by\nthe call to 'foo.iter()'.\n\n>>> mockfoo = MagicMock()\n>>> mockfoo.iter.returnvalue = iter([1, 2, 3])\n>>> list(mockfoo.iter())\n[1, 2, 3]\n\n---------- Footnotes ----------\n\n(1) There are also generator expressions and more advanced uses\n(http://www.dabeaz.com/coroutines/index.html) of generators, but we\naren't concerned about them here.  A very good introduction to\ngenerators and how powerful they are is: Generator Tricks for Systems\nProgrammers (http://www.dabeaz.com/generators/).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Applying the same patch to every test method,  Next: Mocking Unbound Methods,  Prev: Mocking a Generator Method,  Up: Further Examples": {
            "content": "5.26.7.19 Applying the same patch to every test method\n......................................................\n",
            "subsections": []
        },
        "If you want several patches in place for multiple test methods the": {
            "content": "obvious way is to apply the patch decorators to every method.  This can\nfeel like unnecessary repetition.  Instead, you can use *note patch():\ncf5. (in all its various forms) as a class decorator.  This applies the\npatches to all test methods on the class.  A test method is identified\nby methods whose names start with 'test':\n\n>>> @patch('mymodule.SomeClass')\n... class MyTest(unittest.TestCase):\n...\n...     def testone(self, MockSomeClass):\n...         self.assertIs(mymodule.SomeClass, MockSomeClass)\n...\n...     def testtwo(self, MockSomeClass):\n...         self.assertIs(mymodule.SomeClass, MockSomeClass)\n...\n...     def notatest(self):\n...         return 'something'\n...\n>>> MyTest('testone').testone()\n>>> MyTest('testtwo').testtwo()\n>>> MyTest('testtwo').notatest()\n'something'\n\nAn alternative way of managing patches is to use the *note patch\nmethods; start and stop: 3d52.  These allow you to move the patching\ninto your 'setUp' and 'tearDown' methods.\n\n>>> class MyTest(unittest.TestCase):\n...     def setUp(self):\n...         self.patcher = patch('mymodule.foo')\n...         self.mockfoo = self.patcher.start()\n...\n...     def testfoo(self):\n...         self.assertIs(mymodule.foo, self.mockfoo)\n...\n...     def tearDown(self):\n...         self.patcher.stop()\n...\n>>> MyTest('testfoo').run()\n\nIf you use this technique you must ensure that the patching is \"undone\"\nby calling 'stop'.  This can be fiddlier than you might think, because\nif an exception is raised in the setUp then tearDown is not called.\n*note unittest.TestCase.addCleanup(): 8af. makes this easier:\n\n>>> class MyTest(unittest.TestCase):\n...     def setUp(self):\n...         patcher = patch('mymodule.foo')\n...         self.addCleanup(patcher.stop)\n...         self.mockfoo = patcher.start()\n...\n...     def testfoo(self):\n...         self.assertIs(mymodule.foo, self.mockfoo)\n...\n>>> MyTest('testfoo').run()\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Mocking Unbound Methods,  Next: Checking multiple calls with mock,  Prev: Applying the same patch to every test method,  Up: Further Examples": {
            "content": "5.26.7.20 Mocking Unbound Methods\n.................................\n",
            "subsections": []
        },
        "Whilst writing tests today I needed to patch an 'unbound method'": {
            "content": "(patching the method on the class rather than on the instance).  I\nneeded self to be passed in as the first argument because I want to make\nasserts about which objects were calling this particular method.  The\nissue is that you can't patch with a mock for this, because if you\nreplace an unbound method with a mock it doesn't become a bound method\nwhen fetched from the instance, and so it doesn't get self passed in.",
            "subsections": []
        },
        "The workaround is to patch the unbound method with a real function": {
            "content": "instead.  The *note patch(): cf5. decorator makes it so simple to patch\nout methods with a mock that having to create a real function becomes a\nnuisance.\n\nIf you pass 'autospec=True' to patch then it does the patching with a\n'real' function object.  This function object has the same signature as\nthe one it is replacing, but delegates to a mock under the hood.  You\nstill get your mock auto-created in exactly the same way as before.",
            "subsections": []
        },
        "What it means though, is that if you use it to patch out an unbound": {
            "content": "method on a class the mocked function will be turned into a bound method\nif it is fetched from an instance.  It will have 'self' passed in as the\nfirst argument, which is exactly what I wanted:\n\n>>> class Foo:\n...   def foo(self):\n...     pass\n...\n>>> with patch.object(Foo, 'foo', autospec=True) as mockfoo:\n...   mockfoo.returnvalue = 'foo'\n...   foo = Foo()\n...   foo.foo()\n...\n'foo'\n>>> mockfoo.assertcalledoncewith(foo)\n\nIf we don't use 'autospec=True' then the unbound method is patched out\nwith a Mock instance instead, and isn't called with 'self'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Checking multiple calls with mock,  Next: Coping with mutable arguments,  Prev: Mocking Unbound Methods,  Up: Further Examples": {
            "content": "5.26.7.21 Checking multiple calls with mock\n...........................................\n\nmock has a nice API for making assertions about how your mock objects\nare used.\n\n>>> mock = Mock()\n>>> mock.foobar.returnvalue = None\n>>> mock.foobar('baz', spam='eggs')\n>>> mock.foobar.assertcalledwith('baz', spam='eggs')\n\nIf your mock is only being called once you can use the *note\nassertcalledoncewith(): 3d2a. method that also asserts that the *note\ncallcount: 3d35. is one.\n\n>>> mock.foobar.assertcalledoncewith('baz', spam='eggs')\n>>> mock.foobar()\n>>> mock.foobar.assertcalledoncewith('baz', spam='eggs')\nTraceback (most recent call last):\n...\nAssertionError: Expected to be called once. Called 2 times.\n",
            "subsections": []
        },
        "Both 'assertcalledwith' and 'assertcalledoncewith' make assertions": {
            "content": "about the 'most recent' call.  If your mock is going to be called\nseveral times, and you want to make assertions about 'all' those calls\nyou can use *note callargslist: 3d36.:\n\n>>> mock = Mock(returnvalue=None)\n>>> mock(1, 2, 3)\n>>> mock(4, 5, 6)\n>>> mock()\n>>> mock.callargslist\n[call(1, 2, 3), call(4, 5, 6), call()]\n\nThe *note call: 173d. helper makes it easy to make assertions about\nthese calls.  You can build up a list of expected calls and compare it\nto 'callargslist'.  This looks remarkably similar to the repr of the\n'callargslist':\n\n>>> expected = [call(1, 2, 3), call(4, 5, 6), call()]\n>>> mock.callargslist == expected\nTrue\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Coping with mutable arguments,  Next: Nesting Patches,  Prev: Checking multiple calls with mock,  Up: Further Examples": {
            "content": "5.26.7.22 Coping with mutable arguments\n.......................................\n",
            "subsections": []
        },
        "Another situation is rare, but can bite you, is when your mock is called": {
            "content": "with mutable arguments.  'callargs' and 'callargslist' store\n'references' to the arguments.  If the arguments are mutated by the code\nunder test then you can no longer make assertions about what the values\nwere when the mock was called.\n",
            "subsections": []
        },
        "Here's some example code that shows the problem.  Imagine the following": {
            "content": "functions defined in 'mymodule':\n\ndef frob(val):\npass\n\ndef grob(val):\n\"First frob and then clear val\"\nfrob(val)\nval.clear()\n",
            "subsections": []
        },
        "When we try to test that 'grob' calls 'frob' with the correct argument": {
            "content": "look what happens:\n\n>>> with patch('mymodule.frob') as mockfrob:\n...     val = {6}\n...     mymodule.grob(val)\n...\n>>> val\nset()\n>>> mockfrob.assertcalledwith({6})\nTraceback (most recent call last):\n...\nAssertionError: Expected: (({6},), {})\nCalled with: ((set(),), {})\n\nOne possibility would be for mock to copy the arguments you pass in.",
            "subsections": []
        },
        "This could then cause problems if you do assertions that rely on object": {
            "content": "identity for equality.\n\nHere's one solution that uses the *note sideeffect: 3d26.\nfunctionality.  If you provide a 'sideeffect' function for a mock then\n'sideeffect' will be called with the same args as the mock.  This gives\nus an opportunity to copy the arguments and store them for later\nassertions.  In this example I'm using 'another' mock to store the\narguments so that I can use the mock methods for doing the assertion.\nAgain a helper function sets this up for me.\n\n>>> from copy import deepcopy\n>>> from unittest.mock import Mock, patch, DEFAULT\n>>> def copycallargs(mock):\n...     newmock = Mock()\n...     def sideeffect(*args, kwargs):\n...         args = deepcopy(args)\n...         kwargs = deepcopy(kwargs)\n...         newmock(*args, kwargs)\n...         return DEFAULT\n...     mock.sideeffect = sideeffect\n...     return newmock\n...\n>>> with patch('mymodule.frob') as mockfrob:\n...     newmock = copycallargs(mockfrob)\n...     val = {6}\n...     mymodule.grob(val)\n...\n>>> newmock.assertcalledwith({6})\n>>> newmock.callargs\ncall({6})\n\n'copycallargs' is called with the mock that will be called.  It\nreturns a new mock that we do the assertion on.  The 'sideeffect'\nfunction makes a copy of the args and calls our 'newmock' with the\ncopy.\n\nNote: If your mock is only going to be used once there is an easier\nway of checking arguments at the point they are called.  You can\nsimply do the checking inside a 'sideeffect' function.\n\n>>> def sideeffect(arg):\n...     assert arg == {6}\n...\n>>> mock = Mock(sideeffect=sideeffect)\n>>> mock({6})\n>>> mock(set())\nTraceback (most recent call last):\n...\nAssertionError\n\nAn alternative approach is to create a subclass of *note Mock: 878. or\n*note MagicMock: cf4. that copies (using *note copy.deepcopy(): 9af.)\nthe arguments.  Here's an example implementation:\n\n>>> from copy import deepcopy\n>>> class CopyingMock(MagicMock):\n...     def call(self, /, *args, kwargs):\n...         args = deepcopy(args)\n...         kwargs = deepcopy(kwargs)\n...         return super().call(*args, kwargs)\n...\n>>> c = CopyingMock(returnvalue=None)\n>>> arg = set()\n>>> c(arg)\n>>> arg.add(1)\n>>> c.assertcalledwith(set())\n>>> c.assertcalledwith(arg)\nTraceback (most recent call last):\n...\nAssertionError: Expected call: mock({1})\nActual call: mock(set())\n>>> c.foo\n<CopyingMock name='mock.foo' id='...'>\n",
            "subsections": []
        },
        "When you subclass 'Mock' or 'MagicMock' all dynamically created": {
            "content": "attributes, and the 'returnvalue' will use your subclass automatically.",
            "subsections": []
        },
        "That means all children of a 'CopyingMock' will also have the type": {
            "content": "'CopyingMock'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Nesting Patches,  Next: Mocking a dictionary with MagicMock,  Prev: Coping with mutable arguments,  Up: Further Examples": {
            "content": "5.26.7.23 Nesting Patches\n.........................\n",
            "subsections": []
        },
        "Using patch as a context manager is nice, but if you do multiple patches": {
            "content": "you can end up with nested with statements indenting further and further\nto the right:\n\n>>> class MyTest(unittest.TestCase):\n...\n...     def testfoo(self):\n...         with patch('mymodule.Foo') as mockfoo:\n...             with patch('mymodule.Bar') as mockbar:\n...                 with patch('mymodule.Spam') as mockspam:\n...                     assert mymodule.Foo is mockfoo\n...                     assert mymodule.Bar is mockbar\n...                     assert mymodule.Spam is mockspam\n...\n>>> original = mymodule.Foo\n>>> MyTest('testfoo').testfoo()\n>>> assert mymodule.Foo is original\n\nWith unittest 'cleanup' functions and the *note patch methods; start and\nstop: 3d52. we can achieve the same effect without the nested\nindentation.  A simple helper method, 'createpatch', puts the patch in\nplace and returns the created mock for us:\n\n>>> class MyTest(unittest.TestCase):\n...\n...     def createpatch(self, name):\n...         patcher = patch(name)\n...         thing = patcher.start()\n...         self.addCleanup(patcher.stop)\n...         return thing\n...\n...     def testfoo(self):\n...         mockfoo = self.createpatch('mymodule.Foo')\n...         mockbar = self.createpatch('mymodule.Bar')\n...         mockspam = self.createpatch('mymodule.Spam')\n...\n...         assert mymodule.Foo is mockfoo\n...         assert mymodule.Bar is mockbar\n...         assert mymodule.Spam is mockspam\n...\n>>> original = mymodule.Foo\n>>> MyTest('testfoo').run()\n>>> assert mymodule.Foo is original\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Mocking a dictionary with MagicMock,  Next: Mock subclasses and their attributes,  Prev: Nesting Patches,  Up: Further Examples": {
            "content": "5.26.7.24 Mocking a dictionary with MagicMock\n.............................................\n",
            "subsections": []
        },
        "You may want to mock a dictionary, or other container object, recording": {
            "content": "all access to it whilst having it still behave like a dictionary.\n\nWe can do this with *note MagicMock: cf4, which will behave like a\ndictionary, and using *note sideeffect: 3d26. to delegate dictionary\naccess to a real underlying dictionary that is under our control.\n\nWhen the *note getitem(): 4b9. and *note setitem(): 1320.\nmethods of our 'MagicMock' are called (normal dictionary access) then\n'sideeffect' is called with the key (and in the case of 'setitem'\nthe value too).  We can also control what is returned.\n\nAfter the 'MagicMock' has been used we can use attributes like *note\ncallargslist: 3d36. to assert about how the dictionary was used:\n\n>>> mydict = {'a': 1, 'b': 2, 'c': 3}\n>>> def getitem(name):\n...      return mydict[name]\n...\n>>> def setitem(name, val):\n...     mydict[name] = val\n...\n>>> mock = MagicMock()\n>>> mock.getitem.sideeffect = getitem\n>>> mock.setitem.sideeffect = setitem\n\nNote: An alternative to using 'MagicMock' is to use 'Mock' and\n'only' provide the magic methods you specifically want:\n\n>>> mock = Mock()\n>>> mock.getitem = Mock(sideeffect=getitem)\n>>> mock.setitem = Mock(sideeffect=setitem)\n\nA 'third' option is to use 'MagicMock' but passing in 'dict' as the\n'spec' (or 'specset') argument so that the 'MagicMock' created\nonly has dictionary magic methods available:\n\n>>> mock = MagicMock(specset=dict)\n>>> mock.getitem.sideeffect = getitem\n>>> mock.setitem.sideeffect = setitem\n",
            "subsections": []
        },
        "With these side effect functions in place, the 'mock' will behave like a": {
            "content": "normal dictionary but recording the access.  It even raises a *note\nKeyError: 8cf. if you try to access a key that doesn't exist.\n\n>>> mock['a']\n1\n>>> mock['c']\n3\n>>> mock['d']\nTraceback (most recent call last):\n...\nKeyError: 'd'\n>>> mock['b'] = 'fish'\n>>> mock['d'] = 'eggs'\n>>> mock['b']\n'fish'\n>>> mock['d']\n'eggs'\n",
            "subsections": []
        },
        "After it has been used you can make assertions about the access using": {
            "content": "the normal mock methods and attributes:\n\n>>> mock.getitem.callargslist\n[call('a'), call('c'), call('d'), call('b'), call('d')]\n>>> mock.setitem.callargslist\n[call('b', 'fish'), call('d', 'eggs')]\n>>> mydict\n{'a': 1, 'b': 'fish', 'c': 3, 'd': 'eggs'}\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Mock subclasses and their attributes,  Next: Mocking imports with patch dict,  Prev: Mocking a dictionary with MagicMock,  Up: Further Examples": {
            "content": "5.26.7.25 Mock subclasses and their attributes\n..............................................\n\nThere are various reasons why you might want to subclass *note Mock:\n878.  One reason might be to add helper methods.  Here's a silly\nexample:\n\n>>> class MyMock(MagicMock):\n...     def hasbeencalled(self):\n...         return self.called\n...\n>>> mymock = MyMock(returnvalue=None)\n>>> mymock\n<MyMock id='...'>\n>>> mymock.hasbeencalled()\nFalse\n>>> mymock()\n>>> mymock.hasbeencalled()\nTrue\n",
            "subsections": []
        },
        "The standard behaviour for 'Mock' instances is that attributes and the": {
            "content": "return value mocks are of the same type as the mock they are accessed\non.  This ensures that 'Mock' attributes are 'Mocks' and 'MagicMock'\nattributes are 'MagicMocks' (1).  So if you're subclassing to add helper\nmethods then they'll also be available on the attributes and return\nvalue mock of instances of your subclass.\n\n>>> mymock.foo\n<MyMock name='mock.foo' id='...'>\n>>> mymock.foo.hasbeencalled()\nFalse\n>>> mymock.foo()\n<MyMock name='mock.foo()' id='...'>\n>>> mymock.foo.hasbeencalled()\nTrue\n",
            "subsections": []
        },
        "Sometimes this is inconvenient.  For example, one user(2) is subclassing": {
            "content": "mock to created a Twisted adaptor(3).  Having this applied to attributes\ntoo actually causes errors.\n\n'Mock' (in all its flavours) uses a method called 'getchildmock' to\ncreate these \"sub-mocks\" for attributes and return values.  You can\nprevent your subclass being used for attributes by overriding this\nmethod.  The signature is that it takes arbitrary keyword arguments\n('kwargs') which are then passed onto the mock constructor:\n\n>>> class Subclass(MagicMock):\n...     def getchildmock(self, /, kwargs):\n...         return MagicMock(kwargs)\n...\n>>> mymock = Subclass()\n>>> mymock.foo\n<MagicMock name='mock.foo' id='...'>\n>>> assert isinstance(mymock, Subclass)\n>>> assert not isinstance(mymock.foo, Subclass)\n>>> assert not isinstance(mymock(), Subclass)\n\n---------- Footnotes ----------\n\n(1) An exception to this rule are the non-callable mocks.  Attributes\nuse the callable variant because otherwise non-callable mocks couldn't\nhave callable methods.\n\n(2) https://code.google.com/archive/p/mock/issues/105\n\n(3)\nhttps://twisted.org/documents/11.0.0/api/twisted.python.components.html\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "5.26.7.26 Mocking imports with patch.dict\n.........................................\n",
            "subsections": []
        },
        "One situation where mocking can be hard is where you have a local import": {
            "content": "inside a function.  These are harder to mock because they aren't using\nan object from the module namespace that we can patch out.\n",
            "subsections": []
        },
        "Generally local imports are to be avoided.  They are sometimes done to": {
            "content": "prevent circular dependencies, for which there is 'usually' a much\nbetter way to solve the problem (refactor the code) or to prevent \"up\nfront costs\" by delaying the import.  This can also be solved in better\nways than an unconditional local import (store the module as a class or\nmodule attribute and only do the import on first use).\n",
            "subsections": []
        },
        "That aside there is a way to use 'mock' to affect the results of an": {
            "content": "import.  Importing fetches an 'object' from the *note sys.modules: 16d7.\ndictionary.  Note that it fetches an 'object', which need not be a\nmodule.  Importing a module for the first time results in a module\nobject being put in 'sys.modules', so usually when you import something\nyou get a module back.  This need not be the case however.\n\nThis means you can use *note patch.dict(): 176a. to 'temporarily' put a\nmock in place in *note sys.modules: 16d7.  Any imports whilst this patch\nis active will fetch the mock.  When the patch is complete (the\ndecorated function exits, the with statement body is complete or\n'patcher.stop()' is called) then whatever was there previously will be\nrestored safely.\n\nHere's an example that mocks out the 'fooble' module.\n\n>>> import sys\n>>> mock = Mock()\n>>> with patch.dict('sys.modules', {'fooble': mock}):\n...    import fooble\n...    fooble.blob()\n...\n<Mock name='mock.blob()' id='...'>\n>>> assert 'fooble' not in sys.modules\n>>> mock.blob.assertcalledoncewith()\n",
            "subsections": []
        },
        "As you can see the 'import fooble' succeeds, but on exit there is no": {
            "content": "'fooble' left in *note sys.modules: 16d7.\n\nThis also works for the 'from module import name' form:\n\n>>> mock = Mock()\n>>> with patch.dict('sys.modules', {'fooble': mock}):\n...    from fooble import blob\n...    blob.blip()\n...\n<Mock name='mock.blob.blip()' id='...'>\n>>> mock.blob.blip.assertcalledoncewith()\n\nWith slightly more work you can also mock package imports:\n\n>>> mock = Mock()\n>>> modules = {'package': mock, 'package.module': mock.module}\n>>> with patch.dict('sys.modules', modules):\n...    from package.module import fooble\n...    fooble()\n...\n<Mock name='mock.module.fooble()' id='...'>\n>>> mock.module.fooble.assertcalledoncewith()\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "5.26.7.27 Tracking order of calls and less verbose call assertions\n..................................................................\n\nThe *note Mock: 878. class allows you to track the 'order' of method\ncalls on your mock objects through the *note methodcalls: 3d30.\nattribute.  This doesn't allow you to track the order of calls between\nseparate mock objects, however we can use *note mockcalls: 3d2d. to\nachieve the same effect.\n",
            "subsections": []
        },
        "Because mocks track calls to child mocks in 'mockcalls', and accessing": {
            "content": "an arbitrary attribute of a mock creates a child mock, we can create our\nseparate mocks from a parent one.  Calls to those child mock will then\nall be recorded, in order, in the 'mockcalls' of the parent:\n\n>>> manager = Mock()\n>>> mockfoo = manager.foo\n>>> mockbar = manager.bar\n\n>>> mockfoo.something()\n<Mock name='mock.foo.something()' id='...'>\n>>> mockbar.other.thing()\n<Mock name='mock.bar.other.thing()' id='...'>\n\n>>> manager.mockcalls\n[call.foo.something(), call.bar.other.thing()]\n",
            "subsections": []
        },
        "We can then assert about the calls, including the order, by comparing": {
            "content": "with the 'mockcalls' attribute on the manager mock:\n\n>>> expectedcalls = [call.foo.something(), call.bar.other.thing()]\n>>> manager.mockcalls == expectedcalls\nTrue\n",
            "subsections": []
        },
        "If 'patch' is creating, and putting in place, your mocks then you can": {
            "content": "attach them to a manager mock using the *note attachmock(): 3d2f.\nmethod.  After attaching calls will be recorded in 'mockcalls' of the\nmanager.\n\n>>> manager = MagicMock()\n>>> with patch('mymodule.Class1') as MockClass1:\n...     with patch('mymodule.Class2') as MockClass2:\n...         manager.attachmock(MockClass1, 'MockClass1')\n...         manager.attachmock(MockClass2, 'MockClass2')\n...         MockClass1().foo()\n...         MockClass2().bar()\n<MagicMock name='mock.MockClass1().foo()' id='...'>\n<MagicMock name='mock.MockClass2().bar()' id='...'>\n>>> manager.mockcalls\n[call.MockClass1(),\ncall.MockClass1().foo(),\ncall.MockClass2(),\ncall.MockClass2().bar()]\n",
            "subsections": []
        },
        "If many calls have been made, but you're only interested in a particular": {
            "content": "sequence of them then an alternative is to use the *note\nasserthascalls(): 3d2c. method.  This takes a list of calls\n(constructed with the *note call: 173d. object).  If that sequence of\ncalls are in *note mockcalls: 3d2d. then the assert succeeds.\n\n>>> m = MagicMock()\n>>> m().foo().bar().baz()\n<MagicMock name='mock().foo().bar().baz()' id='...'>\n>>> m.one().two().three()\n<MagicMock name='mock.one().two().three()' id='...'>\n>>> calls = call.one().two().three().calllist()\n>>> m.asserthascalls(calls)\n",
            "subsections": []
        },
        "Even though the chained call 'm.one().two().three()' aren't the only": {
            "content": "calls that have been made to the mock, the assert still succeeds.\n",
            "subsections": []
        },
        "Sometimes a mock may have several calls made to it, and you are only": {
            "content": "interested in asserting about 'some' of those calls.  You may not even\ncare about the order.  In this case you can pass 'anyorder=True' to\n'asserthascalls':\n\n>>> m = MagicMock()\n>>> m(1), m.two(2, 3), m.seven(7), m.fifty('50')\n(...)\n>>> calls = [call.fifty('50'), call(1), call.seven(7)]\n>>> m.asserthascalls(calls, anyorder=True)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: More complex argument matching,  Prev: Tracking order of calls and less verbose call assertions,  Up: Further Examples": {
            "content": "5.26.7.28 More complex argument matching\n........................................\n\nUsing the same basic concept as *note ANY: 173b. we can implement\nmatchers to do more complex assertions on objects used as arguments to\nmocks.\n",
            "subsections": []
        },
        "Suppose we expect some object to be passed to a mock that by default": {
            "content": "compares equal based on object identity (which is the Python default for\nuser defined classes).  To use *note assertcalledwith(): 1799. we\nwould need to pass in the exact same object.  If we are only interested\nin some of the attributes of this object then we can create a matcher\nthat will check these attributes for us.\n",
            "subsections": []
        },
        "You can see in this example how a 'standard' call to": {
            "content": "'assertcalledwith' isn't sufficient:\n\n>>> class Foo:\n...     def init(self, a, b):\n...         self.a, self.b = a, b\n...\n>>> mock = Mock(returnvalue=None)\n>>> mock(Foo(1, 2))\n>>> mock.assertcalledwith(Foo(1, 2))\nTraceback (most recent call last):\n...\nAssertionError: Expected: call(<main.Foo object at 0x...>)\nActual call: call(<main.Foo object at 0x...>)\n\nA comparison function for our 'Foo' class might look something like\nthis:\n\n>>> def compare(self, other):\n...     if not type(self) == type(other):\n...         return False\n...     if self.a != other.a:\n...         return False\n...     if self.b != other.b:\n...         return False\n...     return True\n...\n",
            "subsections": []
        },
        "And a matcher object that can use comparison functions like this for its": {
            "content": "equality operation would look something like this:\n\n>>> class Matcher:\n...     def init(self, compare, someobj):\n...         self.compare = compare\n...         self.someobj = someobj\n...     def eq(self, other):\n...         return self.compare(self.someobj, other)\n...\n\nPutting all this together:\n\n>>> matchfoo = Matcher(compare, Foo(1, 2))\n>>> mock.assertcalledwith(matchfoo)\n",
            "subsections": []
        },
        "The 'Matcher' is instantiated with our compare function and the 'Foo'": {
            "content": "object we want to compare against.  In 'assertcalledwith' the\n'Matcher' equality method will be called, which compares the object the\nmock was called with against the one we created our matcher with.  If\nthey match then 'assertcalledwith' passes, and if they don't an *note\nAssertionError: 476. is raised:\n\n>>> matchwrong = Matcher(compare, Foo(3, 4))\n>>> mock.assertcalledwith(matchwrong)\nTraceback (most recent call last):\n...\nAssertionError: Expected: ((<Matcher object at 0x...>,), {})\nCalled with: ((<Foo object at 0x...>,), {})\n",
            "subsections": []
        },
        "With a bit of tweaking you could have the comparison function raise the": {
            "content": "*note AssertionError: 476. directly and provide a more useful failure\nmessage.\n",
            "subsections": []
        },
        "As of version 1.5, the Python testing library PyHamcrest(1) provides": {
            "content": "similar functionality, that may be useful here, in the form of its\nequality matcher (hamcrest.library.integration.matchequality(2)).\n\n---------- Footnotes ----------\n\n(1) https://pyhamcrest.readthedocs.io/\n\n(2)\nhttps://pyhamcrest.readthedocs.io/en/release-1.8/integration/#module-hamcrest.library.integration.matchequality\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: 2to3 -- Automated Python 2 to 3 code translation,  Next: test -- Regression tests package for Python,  Prev: unittest mock -- getting started,  Up: Development Tools": {
            "content": "2to3 is a Python program that reads Python 2.x source code and applies a\nseries of 'fixers' to transform it into valid Python 3.x code.  The\nstandard library contains a rich set of fixers that will handle almost\nall code.  2to3 supporting library *note lib2to3: 7f. is, however, a\nflexible and generic library, so it is possible to write your own fixers\nfor 2to3.\n",
            "subsections": []
        },
        "Deprecated since version 3.11, will be removed in version 3.13: The": {
            "content": "*note xdrlib: 11a. module is deprecated (see PEP 594(2) for details).\n\n\n\nThe *note xdrlib: 11a. module supports the External Data Representation\nStandard as described in RFC 1014(3), written by Sun Microsystems, Inc.\nJune 1987.  It supports most of the data types described in the RFC.\n\nThe *note xdrlib: 11a. module defines two classes, one for packing\nvariables into XDR representation, and another for unpacking from XDR\nrepresentation.  There are also two exception classes.\n\n-- Class: xdrlib.Packer\n\n*note Packer: 4666. is the class for packing data into XDR\nrepresentation.  The *note Packer: 4666. class is instantiated with\nno arguments.\n\n-- Class: xdrlib.Unpacker (data)\n\n'Unpacker' is the complementary class which unpacks XDR data values\nfrom a string buffer.  The input buffer is given as 'data'.\n\nSee also\n........\n\nRFC 1014(4) - XDR: External Data Representation Standard\n\nThis RFC defined the encoding of data which was XDR at the time\nthis module was originally written.  It has apparently been\nobsoleted by RFC 1832(5).\n\nRFC 1832(6) - XDR: External Data Representation Standard\n\nNewer RFC that provides a revised definition of XDR.\n\n* Menu:\n\n* Packer Objects::\n* Unpacker Objects::\n* Exceptions: Exceptions<20>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/xdrlib.py\n\n(2) https://peps.python.org/pep-0594/#xdrlib\n\n(3) https://datatracker.ietf.org/doc/html/rfc1014.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc1014.html\n\n(5) https://datatracker.ietf.org/doc/html/rfc1832.html\n\n(6) https://datatracker.ietf.org/doc/html/rfc1832.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using 2to3,  Next: Fixers,  Up: 2to3 -- Automated Python 2 to 3 code translation": {
            "content": "5.26.8.1 Using 2to3\n...................\n\n2to3 will usually be installed with the Python interpreter as a script.\nIt is also located in the 'Tools/scripts' directory of the Python root.\n\n2to3's basic arguments are a list of files or directories to transform.\nThe directories are recursively traversed for Python sources.\n\nHere is a sample Python 2.x source file, 'example.py':\n\ndef greet(name):\nprint \"Hello, {0}!\".format(name)\nprint \"What's your name?\"\nname = rawinput()\ngreet(name)\n\nIt can be converted to Python 3.x code via 2to3 on the command line:\n\n$ 2to3 example.py\n\nA diff against the original source file is printed.  2to3 can also write\nthe needed modifications right back to the source file.  (A backup of\nthe original file is made unless '-n' is also given.)  Writing the\nchanges back is enabled with the '-w' flag:\n\n$ 2to3 -w example.py\n\nAfter transformation, 'example.py' looks like this:\n\ndef greet(name):\nprint(\"Hello, {0}!\".format(name))\nprint(\"What's your name?\")\nname = input()\ngreet(name)\n",
            "subsections": []
        },
        "Comments and exact indentation are preserved throughout the translation": {
            "content": "process.\n\nBy default, 2to3 runs a set of *note predefined fixers: 3d8d.  The '-l'\nflag lists all available fixers.  An explicit set of fixers to run can\nbe given with '-f'.  Likewise the '-x' explicitly disables a fixer.  The\nfollowing example runs only the 'imports' and 'haskey' fixers:\n\n$ 2to3 -f imports -f haskey example.py\n\nThis command runs every fixer except the 'apply' fixer:\n\n$ 2to3 -x apply example.py\n",
            "subsections": []
        },
        "Some fixers are 'explicit', meaning they aren't run by default and must": {
            "content": "be listed on the command line to be run.  Here, in addition to the\ndefault fixers, the 'idioms' fixer is run:\n\n$ 2to3 -f all -f idioms example.py\n\nNotice how passing 'all' enables all default fixers.\n",
            "subsections": []
        },
        "Sometimes 2to3 will find a place in your source code that needs to be": {
            "content": "changed, but 2to3 cannot fix automatically.  In this case, 2to3 will\nprint a warning beneath the diff for a file.  You should address the\nwarning in order to have compliant 3.x code.\n\n2to3 can also refactor doctests.  To enable this mode, use the '-d'\nflag.  Note that 'only' doctests will be refactored.  This also doesn't\nrequire the module to be valid Python.  For example, doctest like\nexamples in a reST document could also be refactored with this option.\n",
            "subsections": []
        },
        "The '-v' option enables output of more information on the translation": {
            "content": "process.\n",
            "subsections": []
        },
        "Since some print statements can be parsed as function calls or": {
            "content": "statements, 2to3 cannot always read files containing the print function.",
            "subsections": []
        },
        "When 2to3 detects the presence of the 'from future import": {
            "content": "printfunction' compiler directive, it modifies its internal grammar to\ninterpret *note print(): de5. as a function.  This change can also be\nenabled manually with the '-p' flag.  Use '-p' to run fixers on code\nthat already has had its print statements converted.  Also '-e' can be\nused to make *note exec(): 691. a function.\n",
            "subsections": []
        },
        "The '-o' or '--output-dir' option allows specification of an alternate": {
            "content": "directory for processed output files to be written to.  The '-n' flag is\nrequired when using this as backup files do not make sense when not\noverwriting the input files.\n\nNew in version 3.2.3: The '-o' option was added.\n",
            "subsections": []
        },
        "The '-W' or '--write-unchanged-files' flag tells 2to3 to always write": {
            "content": "output files even if no changes were required to the file.  This is most\nuseful with '-o' so that an entire Python source tree is copied with\ntranslation from one directory to another.  This option implies the '-w'\nflag as it would not make sense otherwise.\n\nNew in version 3.2.3: The '-W' flag was added.\n",
            "subsections": []
        },
        "The '--add-suffix' option specifies a string to append to all output": {
            "content": "filenames.  The '-n' flag is required when specifying this as backups\nare not necessary when writing to different filenames.  Example:\n\n$ 2to3 -n -W --add-suffix=3 example.py\n\nWill cause a converted file named 'example.py3' to be written.\n\nNew in version 3.2.3: The '--add-suffix' option was added.\n\nTo translate an entire project from one directory tree to another use:\n\n$ 2to3 --output-dir=python3-version/mycode -W -n python2-version/mycode\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Fixers,  Next: lib2to3 -- 2to3's library,  Prev: Using 2to3,  Up: 2to3 -- Automated Python 2 to 3 code translation": {
            "content": "5.26.8.2 Fixers\n...............\n",
            "subsections": []
        },
        "Each step of transforming code is encapsulated in a fixer.  The command": {
            "content": "'2to3 -l' lists them.  As *note documented above: 3d8b, each can be\nturned on and off individually.  They are described here in more detail.\n\n-- 2to3fixer: apply\n\nRemoves usage of 'apply()'.  For example 'apply(function, *args,\nkwargs)' is converted to 'function(*args, kwargs)'.\n\n-- 2to3fixer: asserts\n\nReplaces deprecated *note unittest: 101. method names with the\ncorrect ones.\n\nFrom                                 To\n\n------------------------------------------------------------------------------------\n\n'failUnlessEqual(a, b)'              *note assertEqual(a, b): 27d.\n\n\n'assertEquals(a, b)'                 *note assertEqual(a, b): 27d.\n\n\n'failIfEqual(a, b)'                  *note assertNotEqual(a, b): 27e.\n\n\n'assertNotEquals(a, b)'              *note assertNotEqual(a, b): 27e.\n\n\n'failUnless(a)'                      *note assertTrue(a): 27b.\n\n\n'assert(a)'                         *note assertTrue(a): 27b.\n\n\n'failIf(a)'                          *note assertFalse(a): 27c.\n\n\n'failUnlessRaises(exc, cal)'         *note assertRaises(exc, cal): 281.\n\n\n'failUnlessAlmostEqual(a, b)'        *note assertAlmostEqual(a, b): 27f.\n\n\n'assertAlmostEquals(a, b)'           *note assertAlmostEqual(a, b): 27f.\n\n\n'failIfAlmostEqual(a, b)'            *note assertNotAlmostEqual(a, b): 280.\n\n\n'assertNotAlmostEquals(a, b)'        *note assertNotAlmostEqual(a, b): 280.\n\n\n-- 2to3fixer: basestring\n\nConverts 'basestring' to *note str: 157.\n\n-- 2to3fixer: buffer\n\nConverts 'buffer' to *note memoryview: 17f.  This fixer is optional\nbecause the *note memoryview: 17f. API is similar but not exactly\nthe same as that of 'buffer'.\n\n-- 2to3fixer: dict\n\nFixes dictionary iteration methods.  'dict.iteritems()' is\nconverted to *note dict.items(): 5c1, 'dict.iterkeys()' to *note\ndict.keys(): 5bf, and 'dict.itervalues()' to *note dict.values():\n5c0.  Similarly, 'dict.viewitems()', 'dict.viewkeys()' and\n'dict.viewvalues()' are converted respectively to *note\ndict.items(): 5c1, *note dict.keys(): 5bf. and *note dict.values():\n5c0.  It also wraps existing usages of *note dict.items(): 5c1,\n*note dict.keys(): 5bf, and *note dict.values(): 5c0. in a call to\n*note list: 3dc.\n\n-- 2to3fixer: except\n\nConverts 'except X, T' to 'except X as T'.\n\n-- 2to3fixer: exec\n\nConverts the 'exec' statement to the *note exec(): 691. function.\n\n-- 2to3fixer: execfile\n\nRemoves usage of 'execfile()'.  The argument to 'execfile()' is\nwrapped in calls to *note open(): 26e, *note compile(): 528, and\n*note exec(): 691.\n\n-- 2to3fixer: exitfunc\n\nChanges assignment of 'sys.exitfunc' to use of the *note atexit: a.\nmodule.\n\n-- 2to3fixer: filter\n\nWraps *note filter(): 660. usage in a *note list: 3dc. call.\n\n-- 2to3fixer: funcattrs\n\nFixes function attributes that have been renamed.  For example,\n'myfunction.funcclosure' is converted to\n'myfunction.closure'.\n\n-- 2to3fixer: future\n\nRemoves 'from future import newfeature' statements.\n\n-- 2to3fixer: getcwdu\n\nRenames 'os.getcwdu()' to *note os.getcwd(): 1779.\n\n-- 2to3fixer: haskey\n\nChanges 'dict.haskey(key)' to 'key in dict'.\n\n-- 2to3fixer: idioms\n\nThis optional fixer performs several transformations that make\nPython code more idiomatic.  Type comparisons like 'type(x) is\nSomeClass' and 'type(x) == SomeClass' are converted to\n'isinstance(x, SomeClass)'.  'while 1' becomes 'while True'.  This\nfixer also tries to make use of *note sorted(): a12. in appropriate\nplaces.  For example, this block\n\nL = list(someiterable)\nL.sort()\n\nis changed to\n\nL = sorted(someiterable)\n\n-- 2to3fixer: import\n\nDetects sibling imports and converts them to relative imports.\n\n-- 2to3fixer: imports\n\nHandles module renames in the standard library.\n\n-- 2to3fixer: imports2\n\nHandles other modules renames in the standard library.  It is\nseparate from the *note imports: 3d9e. fixer only because of\ntechnical limitations.\n\n-- 2to3fixer: input\n\nConverts 'input(prompt)' to 'eval(input(prompt))'.\n\n-- 2to3fixer: intern\n\nConverts 'intern()' to *note sys.intern(): 1150.\n\n-- 2to3fixer: isinstance\n\nFixes duplicate types in the second argument of *note isinstance():\n14b.  For example, 'isinstance(x, (int, int))' is converted to\n'isinstance(x, int)' and 'isinstance(x, (int, float, int))' is\nconverted to 'isinstance(x, (int, float))'.\n\n-- 2to3fixer: itertoolsimports\n\nRemoves imports of 'itertools.ifilter()', 'itertools.izip()', and\n'itertools.imap()'.  Imports of 'itertools.ifilterfalse()' are also\nchanged to *note itertools.filterfalse(): 1e72.\n\n-- 2to3fixer: itertools\n\nChanges usage of 'itertools.ifilter()', 'itertools.izip()', and\n'itertools.imap()' to their built-in equivalents.\n'itertools.ifilterfalse()' is changed to *note\nitertools.filterfalse(): 1e72.\n\n-- 2to3fixer: long\n\nRenames 'long' to *note int: 17e.\n\n-- 2to3fixer: map\n\nWraps *note map(): 65f. in a *note list: 3dc. call.  It also\nchanges 'map(None, x)' to 'list(x)'.  Using 'from futurebuiltins\nimport map' disables this fixer.\n\n-- 2to3fixer: metaclass\n\nConverts the old metaclass syntax ('metaclass = Meta' in the\nclass body) to the new ('class X(metaclass=Meta)').\n\n-- 2to3fixer: methodattrs\n\nFixes old method attribute names.  For example, 'meth.imfunc' is\nconverted to 'meth.func'.\n\n-- 2to3fixer: ne\n\nConverts the old not-equal syntax, '<>', to '!='.\n\n-- 2to3fixer: next\n\nConverts the use of iterator's 'next()' methods to the *note\nnext(): 5cb. function.  It also renames *note next(): 5cb. methods\nto *note next(): 1141.\n\n-- 2to3fixer: nonzero\n\nRenames definitions of methods called 'nonzero()' to *note\nbool(): 114a.\n\n-- 2to3fixer: numliterals\n\nConverts octal literals into the new syntax.\n\n-- 2to3fixer: operator\n\nConverts calls to various functions in the *note operator: 9a.\nmodule to other, but equivalent, function calls.  When needed, the\nappropriate 'import' statements are added, e.g.  'import\ncollections.abc'.  The following mapping are made:\n\nFrom                                   To\n\n-----------------------------------------------------------------------------------------\n\n'operator.isCallable(obj)'             'callable(obj)'\n\n\n'operator.sequenceIncludes(obj)'       'operator.contains(obj)'\n\n\n'operator.isSequenceType(obj)'         'isinstance(obj, collections.abc.Sequence)'\n\n\n'operator.isMappingType(obj)'          'isinstance(obj, collections.abc.Mapping)'\n\n\n'operator.isNumberType(obj)'           'isinstance(obj, numbers.Number)'\n\n\n'operator.repeat(obj, n)'              'operator.mul(obj, n)'\n\n\n'operator.irepeat(obj, n)'             'operator.imul(obj, n)'\n\n\n-- 2to3fixer: paren\n\nAdd extra parenthesis where they are required in list\ncomprehensions.  For example, '[x for x in 1, 2]' becomes '[x for x\nin (1, 2)]'.\n\n-- 2to3fixer: print\n\nConverts the 'print' statement to the *note print(): de5. function.\n\n-- 2to3fixer: raise\n\nConverts 'raise E, V' to 'raise E(V)', and 'raise E, V, T' to\n'raise E(V).withtraceback(T)'.  If 'E' is a tuple, the translation\nwill be incorrect because substituting tuples for exceptions has\nbeen removed in 3.0.\n\n-- 2to3fixer: rawinput\n\nConverts 'rawinput()' to *note input(): 114d.\n\n-- 2to3fixer: reduce\n\nHandles the move of 'reduce()' to *note functools.reduce(): 1151.\n\n-- 2to3fixer: reload\n\nConverts 'reload()' to *note importlib.reload(): 26b.\n\n-- 2to3fixer: renames\n\nChanges 'sys.maxint' to *note sys.maxsize: 1039.\n\n-- 2to3fixer: repr\n\nReplaces backtick repr with the *note repr(): 5f0. function.\n\n-- 2to3fixer: setliteral\n\nReplaces use of the *note set: 39d. constructor with set literals.\nThis fixer is optional.\n\n-- 2to3fixer: standarderror\n\nRenames 'StandardError' to *note Exception: 7ff.\n\n-- 2to3fixer: sysexc\n\nChanges the deprecated 'sys.excvalue', 'sys.exctype',\n'sys.exctraceback' to use *note sys.excinfo(): 456.\n\n-- 2to3fixer: throw\n\nFixes the API change in generator's 'throw()' method.\n\n-- 2to3fixer: tupleparams\n\nRemoves implicit tuple parameter unpacking.  This fixer inserts\ntemporary variables.\n\n-- 2to3fixer: types\n\nFixes code broken from the removal of some members in the *note\ntypes: fe. module.\n\n-- 2to3fixer: unicode\n\nRenames 'unicode' to *note str: 157.\n\n-- 2to3fixer: urllib\n\nHandles the rename of *note urllib: 103. and 'urllib2' to the *note\nurllib: 103. package.\n\n-- 2to3fixer: wscomma\n\nRemoves excess whitespace from comma separated items.  This fixer\nis optional.\n\n-- 2to3fixer: xrange\n\nRenames 'xrange()' to *note range(): 761. and wraps existing *note\nrange(): 761. calls with *note list: 3dc.\n\n-- 2to3fixer: xreadlines\n\nChanges 'for x in file.xreadlines()' to 'for x in file'.\n\n-- 2to3fixer: zip\n\nWraps *note zip(): 5c2. usage in a *note list: 3dc. call.  This is\ndisabled when 'from futurebuiltins import zip' appears.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: lib2to3 -- 2to3's library,  Prev: Fixers,  Up: 2to3 -- Automated Python 2 to 3 code translation": {
            "content": "5.26.8.3 'lib2to3' -- 2to3's library\n...................................\n\n'Source code:' Lib/lib2to3/(1)\n\n\n",
            "subsections": []
        },
        "Deprecated since version 3.11, will be removed in version 3.13: Python": {
            "content": "3.9 switched to a PEG parser (see PEP 617(2)) while lib2to3 is using a\nless flexible LL(1) parser.  Python 3.10 includes new language syntax\nthat is not parsable by lib2to3's LL(1) parser (see PEP 634(3)).  The\n'lib2to3' module was marked pending for deprecation in Python 3.9\n(raising *note PendingDeprecationWarning: 6e0. on import) and fully\ndeprecated in Python 3.11 (raising *note DeprecationWarning: 179.).  It\nwill be removed from the standard library in Python 3.13.  Consider\nthird-party alternatives such as LibCST(4) or parso(5).\n\nNote: The *note lib2to3: 7f. API should be considered unstable and\nmay change drastically in the future.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/lib2to3/\n\n(2) https://peps.python.org/pep-0617/\n\n(3) https://peps.python.org/pep-0634/\n\n(4) https://libcst.readthedocs.io/\n\n(5) https://parso.readthedocs.io/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: test -- Regression tests package for Python,  Next: test support -- Utilities for the Python test suite,  Prev: 2to3 -- Automated Python 2 to 3 code translation,  Up: Development Tools": {
            "content": "Note: The *note test: dc. package is meant for internal use by\nPython only.  It is documented for the benefit of the core\ndevelopers of Python.  Any use of this package outside of Python's\nstandard library is discouraged as code mentioned here can change\nor be removed without notice between releases of Python.\n\n\n\nThe *note test: dc. package contains all regression tests for Python as\nwell as the modules *note test.support: de. and *note test.regrtest: dd.\n*note test.support: de. is used to enhance your tests while *note\ntest.regrtest: dd. drives the testing suite.\n\nEach module in the *note test: dc. package whose name starts with\n'test' is a testing suite for a specific module or feature.  All new\ntests should be written using the *note unittest: 101. or *note doctest:\n36. module.  Some older tests are written using a \"traditional\" testing\nstyle that compares output printed to 'sys.stdout'; this style of test\nis considered deprecated.\n\nSee also\n........\n\nModule *note unittest: 101.\n\nWriting PyUnit regression tests.\n\nModule *note doctest: 36.\n\nTests embedded in documentation strings.\n\n* Menu:\n\n* Writing Unit Tests for the test package::\n* Running tests using the command-line interface::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Writing Unit Tests for the test package,  Next: Running tests using the command-line interface,  Up: test -- Regression tests package for Python": {
            "content": "5.26.9.1 Writing Unit Tests for the 'test' package\n..................................................\n\nIt is preferred that tests that use the *note unittest: 101. module\nfollow a few guidelines.  One is to name the test module by starting it\nwith 'test' and end it with the name of the module being tested.  The\ntest methods in the test module should start with 'test' and end with a\ndescription of what the method is testing.  This is needed so that the\nmethods are recognized by the test driver as test methods.  Also, no\ndocumentation string for the method should be included.  A comment (such\nas '# Tests function returns only True or False') should be used to\nprovide documentation for test methods.  This is done because\ndocumentation strings get printed out if they exist and thus what test\nis being run is not stated.\n\nA basic boilerplate is often used:\n\nimport unittest\nfrom test import support\n\nclass MyTestCase1(unittest.TestCase):\n\n# Only use setUp() and tearDown() if necessary\n\ndef setUp(self):\n... code to execute in preparation for tests ...\n\ndef tearDown(self):\n... code to execute to clean up after tests ...\n\ndef testfeatureone(self):\n# Test feature one.\n... testing code ...\n\ndef testfeaturetwo(self):\n# Test feature two.\n... testing code ...\n\n... more test methods ...\n\nclass MyTestCase2(unittest.TestCase):\n... same structure as MyTestCase1 ...\n\n... more test classes ...\n\nif name == 'main':\nunittest.main()\n\nThis code pattern allows the testing suite to be run by *note\ntest.regrtest: dd, on its own as a script that supports the *note\nunittest: 101. CLI, or via the 'python -m unittest' CLI.\n",
            "subsections": []
        },
        "The goal for regression testing is to try to break code.  This leads to": {
            "content": "a few guidelines to be followed:\n\n* The testing suite should exercise all classes, functions, and\nconstants.  This includes not just the external API that is to be\npresented to the outside world but also \"private\" code.\n\n* Whitebox testing (examining the code being tested when the tests\nare being written) is preferred.  Blackbox testing (testing only\nthe published user interface) is not complete enough to make sure\nall boundary and edge cases are tested.\n\n* Make sure all possible values are tested including invalid ones.\nThis makes sure that not only all valid values are acceptable but\nalso that improper values are handled correctly.\n\n* Exhaust as many code paths as possible.  Test where branching\noccurs and thus tailor input to make sure as many different paths\nthrough the code are taken.\n\n* Add an explicit test for any bugs discovered for the tested code.\nThis will make sure that the error does not crop up again if the\ncode is changed in the future.\n\n* Make sure to clean up after your tests (such as close and remove\nall temporary files).\n\n* If a test is dependent on a specific condition of the operating\nsystem then verify the condition already exists before attempting\nthe test.\n\n* Import as few modules as possible and do it as soon as possible.\nThis minimizes external dependencies of tests and also minimizes\npossible anomalous behavior from side-effects of importing a\nmodule.\n\n* Try to maximize code reuse.  On occasion, tests will vary by\nsomething as small as what type of input is used.  Minimize code\nduplication by subclassing a basic test class with a class that\nspecifies the input:\n\nclass TestFuncAcceptsSequencesMixin:\n\nfunc = mySuperWhammyFunction\n\ndef testfunc(self):\nself.func(self.arg)\n\nclass AcceptLists(TestFuncAcceptsSequencesMixin, unittest.TestCase):\narg = [1, 2, 3]\n\nclass AcceptStrings(TestFuncAcceptsSequencesMixin, unittest.TestCase):\narg = 'abc'\n\nclass AcceptTuples(TestFuncAcceptsSequencesMixin, unittest.TestCase):\narg = (1, 2, 3)\n\nWhen using this pattern, remember that all classes that inherit\nfrom *note unittest.TestCase: 159. are run as tests.  The\n'TestFuncAcceptsSequencesMixin' class in the example above does not\nhave any data and so can't be run by itself, thus it does not\ninherit from *note unittest.TestCase: 159.\n\nSee also\n........\n",
            "subsections": []
        },
        "Test Driven Development": {
            "content": "A book by Kent Beck on writing tests before code.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Running tests using the command-line interface,  Prev: Writing Unit Tests for the test package,  Up: test -- Regression tests package for Python": {
            "content": "5.26.9.2 Running tests using the command-line interface\n.......................................................\n\nThe *note test: dc. package can be run as a script to drive Python's\nregression test suite, thanks to the *note -m: 3a5. option: 'python -m\ntest'.  Under the hood, it uses *note test.regrtest: dd.; the call\n'python -m test.regrtest' used in previous Python versions still works.",
            "subsections": []
        },
        "Running the script by itself automatically starts running all regression": {
            "content": "tests in the *note test: dc. package.  It does this by finding all\nmodules in the package whose name starts with 'test', importing them,\nand executing the function 'testmain()' if present or loading the tests\nvia unittest.TestLoader.loadTestsFromModule if 'testmain' does not\nexist.  The names of tests to execute may also be passed to the script.",
            "subsections": []
        },
        "Specifying a single regression test ('python -m test testspam') will": {
            "content": "minimize output and only print whether the test passed or failed.\n\nRunning *note test: dc. directly allows what resources are available for\ntests to use to be set.  You do this by using the '-u' command-line\noption.  Specifying 'all' as the value for the '-u' option enables all\npossible resources: 'python -m test -uall'.  If all but one resource is\ndesired (a more common case), a comma-separated list of resources that\nare not desired may be listed after 'all'.  The command 'python -m test\n-uall,-audio,-largefile' will run *note test: dc. with all resources\nexcept the 'audio' and 'largefile' resources.  For a list of all\nresources and more command-line options, run 'python -m test -h'.\n",
            "subsections": []
        },
        "Some other ways to execute the regression tests depend on what platform": {
            "content": "the tests are being executed on.  On Unix, you can run 'make test' at\nthe top-level directory where Python was built.  On Windows, executing\n'rt.bat' from your 'PCbuild' directory will run all regression tests.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: test support -- Utilities for the Python test suite,  Next: test support sockethelper -- Utilities for socket tests,  Prev: test -- Regression tests package for Python,  Up: Development Tools": {
            "content": "The *note test.support: de. module provides support for Python's\nregression test suite.\n\nNote: *note test.support: de. is not a public module.  It is\ndocumented here to help Python developers write tests.  The API of\nthis module is subject to change without backwards compatibility\nconcerns between releases.\n\nThis module defines the following exceptions:\n\n-- Exception: test.support.TestFailed\n\nException to be raised when a test fails.  This is deprecated in\nfavor of *note unittest: 101.-based tests and *note\nunittest.TestCase: 159.'s assertion methods.\n\n-- Exception: test.support.ResourceDenied\n\nSubclass of *note unittest.SkipTest: e57.  Raised when a resource\n(such as a network connection) is not available.  Raised by the\n*note requires(): 3dca. function.\n\nThe *note test.support: de. module defines the following constants:\n\n-- Data: test.support.verbose\n\n'True' when verbose output is enabled.  Should be checked when more\ndetailed information is desired about a running test.  'verbose' is\nset by *note test.regrtest: dd.\n\n-- Data: test.support.isjython\n\n'True' if the running interpreter is Jython.\n\n-- Data: test.support.isandroid\n\n'True' if the system is Android.\n\n-- Data: test.support.unixshell\n\nPath for shell if not on Windows; otherwise 'None'.\n\n-- Data: test.support.LOOPBACKTIMEOUT\n\nTimeout in seconds for tests using a network server listening on\nthe network local loopback interface like '127.0.0.1'.\n\nThe timeout is long enough to prevent test failure: it takes into\naccount that the client and the server can run in different threads\nor even different processes.\n\nThe timeout should be long enough for *note connect(): bff, *note\nrecv(): c00. and *note send(): c03. methods of *note socket.socket:\nbfd.\n\nIts default value is 5 seconds.\n\nSee also *note INTERNETTIMEOUT: 1723.\n\n-- Data: test.support.INTERNETTIMEOUT\n\nTimeout in seconds for network requests going to the internet.\n\nThe timeout is short enough to prevent a test to wait for too long\nif the internet request is blocked for whatever reason.\n\nUsually, a timeout using *note INTERNETTIMEOUT: 1723. should not\nmark a test as failed, but skip the test instead: see *note\ntransientinternet(): 3dcf.\n\nIts default value is 1 minute.\n\nSee also *note LOOPBACKTIMEOUT: 1722.\n\n-- Data: test.support.SHORTTIMEOUT\n\nTimeout in seconds to mark a test as failed if the test takes \"too\nlong\".\n\nThe timeout value depends on the regrtest '--timeout' command line\noption.\n\nIf a test using *note SHORTTIMEOUT: 1611. starts to fail randomly\non slow buildbots, use *note LONGTIMEOUT: 1724. instead.\n\nIts default value is 30 seconds.\n\n-- Data: test.support.LONGTIMEOUT\n\nTimeout in seconds to detect when a test hangs.\n\nIt is long enough to reduce the risk of test failure on the slowest\nPython buildbots.  It should not be used to mark a test as failed\nif the test takes \"too long\".  The timeout value depends on the\nregrtest '--timeout' command line option.\n\nIts default value is 5 minutes.\n\nSee also *note LOOPBACKTIMEOUT: 1722, *note INTERNETTIMEOUT:\n1723. and *note SHORTTIMEOUT: 1611.\n\n-- Data: test.support.PGO\n\nSet when tests can be skipped when they are not useful for PGO.\n\n-- Data: test.support.PIPEMAXSIZE\n\nA constant that is likely larger than the underlying OS pipe buffer\nsize, to make writes blocking.\n\n-- Data: test.support.PyDEBUG\n\nTrue if Python was built with the *note PyDEBUG: 3dd3. macro\ndefined, that is, if Python was *note built in debug mode: 67f.\n\nNew in version 3.12.\n\n-- Data: test.support.SOCKMAXSIZE\n\nA constant that is likely larger than the underlying OS socket\nbuffer size, to make writes blocking.\n\n-- Data: test.support.TESTSUPPORTDIR\n\nSet to the top level directory that contains *note test.support:\nde.\n\n-- Data: test.support.TESTHOMEDIR\n\nSet to the top level directory for the test package.\n\n-- Data: test.support.TESTDATADIR\n\nSet to the 'data' directory within the test package.\n\n-- Data: test.support.MAXPyssizet\n\nSet to *note sys.maxsize: 1039. for big memory tests.\n\n-- Data: test.support.maxmemuse\n\nSet by *note setmemlimit(): 3dda. as the memory limit for big\nmemory tests.  Limited by *note MAXPyssizet: 3dd8.\n\n-- Data: test.support.realmaxmemuse\n\nSet by *note setmemlimit(): 3dda. as the memory limit for big\nmemory tests.  Not limited by *note MAXPyssizet: 3dd8.\n\n-- Data: test.support.MISSINGCDOCSTRINGS\n\nSet to 'True' if Python is built without docstrings (the\n'WITHDOCSTRINGS' macro is not defined).  See the *note configure\n-without-doc-strings: 1b01. option.\n\nSee also the *note HAVEDOCSTRINGS: 3ddd. variable.\n\n-- Data: test.support.HAVEDOCSTRINGS\n\nSet to 'True' if function docstrings are available.  See the *note\npython -OO: c11. option, which strips docstrings of functions\nimplemented in Python.\n\nSee also the *note MISSINGCDOCSTRINGS: 3ddc. variable.\n\n-- Data: test.support.TESTHTTPURL\n\nDefine the URL of a dedicated HTTP server for the network tests.\n\n-- Data: test.support.ALWAYSEQ\n\nObject that is equal to anything.  Used to test mixed type\ncomparison.\n\n-- Data: test.support.NEVEREQ\n\nObject that is not equal to anything (even to *note ALWAYSEQ:\n3ddf.).  Used to test mixed type comparison.\n\n-- Data: test.support.LARGEST\n\nObject that is greater than anything (except itself).  Used to test\nmixed type comparison.\n\n-- Data: test.support.SMALLEST\n\nObject that is less than anything (except itself).  Used to test\nmixed type comparison.\n\nThe *note test.support: de. module defines the following functions:\n\n-- Function: test.support.busyretry (timeout, errmsg=None, /, *,\nerror=True)\n\nRun the loop body until 'break' stops the loop.\n\nAfter 'timeout' seconds, raise an *note AssertionError: 476. if\n'error' is true, or just stop the loop if 'error' is false.\n\nExample:\n\nfor  in support.busyretry(support.SHORTTIMEOUT):\nif check():\nbreak\n\nExample of error=False usage:\n\nfor  in support.busyretry(support.SHORTTIMEOUT, error=False):\nif check():\nbreak\nelse:\nraise RuntimeError('my custom error')\n\n-- Function: test.support.sleepingretry (timeout, errmsg=None, /, *,\ninitdelay=0.010, maxdelay=1.0, error=True)\n\nWait strategy that applies exponential backoff.\n\nRun the loop body until 'break' stops the loop.  Sleep at each loop\niteration, but not at the first iteration.  The sleep delay is\ndoubled at each iteration (up to 'maxdelay' seconds).\n\nSee *note busyretry(): 3de3. documentation for the parameters\nusage.\n\nExample raising an exception after SHORTTIMEOUT seconds:\n\nfor  in support.sleepingretry(support.SHORTTIMEOUT):\nif check():\nbreak\n\nExample of error=False usage:\n\nfor  in support.sleepingretry(support.SHORTTIMEOUT, error=False):\nif check():\nbreak\nelse:\nraise RuntimeError('my custom error')\n\n-- Function: test.support.isresourceenabled (resource)\n\nReturn 'True' if 'resource' is enabled and available.  The list of\navailable resources is only set when *note test.regrtest: dd. is\nexecuting the tests.\n\n-- Function: test.support.pythonisoptimized ()\n\nReturn 'True' if Python was not built with '-O0' or '-Og'.\n\n-- Function: test.support.withpymalloc ()\n\nReturn 'testcapi.WITHPYMALLOC'.\n\n-- Function: test.support.requires (resource, msg=None)\n\nRaise *note ResourceDenied: 3dc9. if 'resource' is not available.\n'msg' is the argument to *note ResourceDenied: 3dc9. if it is\nraised.  Always returns 'True' if called by a function whose\n'name' is ''main''.  Used when tests are executed by *note\ntest.regrtest: dd.\n\n-- Function: test.support.sortdict (dict)\n\nReturn a repr of 'dict' with keys sorted.\n\n-- Function: test.support.findfile (filename, subdir=None)\n\nReturn the path to the file named 'filename'.  If no match is found\n'filename' is returned.  This does not equal a failure since it\ncould be the path to the file.\n\nSetting 'subdir' indicates a relative path to use to find the file\nrather than looking directly in the path directories.\n\n-- Function: test.support.getpagesize ()\n\nGet size of a page in bytes.\n\nNew in version 3.12.\n\n-- Function: test.support.setswitchinterval (interval)\n\nSet the *note sys.setswitchinterval(): 76a. to the given\n'interval'.  Defines a minimum interval for Android systems to\nprevent the system from hanging.\n\n-- Function: test.support.checkimpldetail (guards)\n\nUse this check to guard CPython's implementation-specific tests or\nto run them only on the implementations guarded by the arguments.\nThis function returns 'True' or 'False' depending on the host\nplatform.  Example usage:\n\ncheckimpldetail()               # Only on CPython (default).\ncheckimpldetail(jython=True)    # Only on Jython.\ncheckimpldetail(cpython=False)  # Everywhere except CPython.\n\n-- Function: test.support.setmemlimit (limit)\n\nSet the values for *note maxmemuse: 3dd9. and *note\nrealmaxmemuse: 3ddb. for big memory tests.\n\n-- Function: test.support.recordoriginalstdout (stdout)\n\nStore the value from 'stdout'.  It is meant to hold the stdout at\nthe time the regrtest began.\n\n-- Function: test.support.getoriginalstdout ()\n\nReturn the original stdout set by *note recordoriginalstdout():\n3ded. or 'sys.stdout' if it's not set.\n\n-- Function: test.support.argsfrominterpreterflags ()\n\nReturn a list of command line arguments reproducing the current\nsettings in 'sys.flags' and 'sys.warnoptions'.\n\n-- Function: test.support.optimargsfrominterpreterflags ()\n\nReturn a list of command line arguments reproducing the current\noptimization settings in 'sys.flags'.\n\n-- Function: test.support.capturedstdin ()\n-- Function: test.support.capturedstdout ()\n-- Function: test.support.capturedstderr ()\n\nA context managers that temporarily replaces the named stream with\n*note io.StringIO: d94. object.\n\nExample use with output streams:\n\nwith capturedstdout() as stdout, capturedstderr() as stderr:\nprint(\"hello\")\nprint(\"error\", file=sys.stderr)\nassert stdout.getvalue() == \"hello\\n\"\nassert stderr.getvalue() == \"error\\n\"\n\nExample use with input stream:\n\nwith capturedstdin() as stdin:\nstdin.write('hello\\n')\nstdin.seek(0)\n# call test code that consumes from sys.stdin\ncaptured = input()\nself.assertEqual(captured, \"hello\")\n\n-- Function: test.support.disablefaulthandler ()\n\nA context manager that temporary disables *note faulthandler: 53.\n\n-- Function: test.support.gccollect ()\n\nForce as many objects as possible to be collected.  This is needed\nbecause timely deallocation is not guaranteed by the garbage\ncollector.  This means that 'del' methods may be called later\nthan expected and weakrefs may remain alive for longer than\nexpected.\n\n-- Function: test.support.disablegc ()\n\nA context manager that disables the garbage collector on entry.  On\nexit, the garbage collector is restored to its prior state.\n\n-- Function: test.support.swapattr (obj, attr, newval)\n\nContext manager to swap out an attribute with a new object.\n\nUsage:\n\nwith swapattr(obj, \"attr\", 5):\n...\n\nThis will set 'obj.attr' to 5 for the duration of the 'with' block,\nrestoring the old value at the end of the block.  If 'attr' doesn't\nexist on 'obj', it will be created and then deleted at the end of\nthe block.\n\nThe old value (or 'None' if it doesn't exist) will be assigned to\nthe target of the \"as\" clause, if there is one.\n\n-- Function: test.support.swapitem (obj, attr, newval)\n\nContext manager to swap out an item with a new object.\n\nUsage:\n\nwith swapitem(obj, \"item\", 5):\n...\n\nThis will set 'obj[\"item\"]' to 5 for the duration of the 'with'\nblock, restoring the old value at the end of the block.  If 'item'\ndoesn't exist on 'obj', it will be created and then deleted at the\nend of the block.\n\nThe old value (or 'None' if it doesn't exist) will be assigned to\nthe target of the \"as\" clause, if there is one.\n\n-- Function: test.support.flushstdstreams ()\n\nCall the 'flush()' method on *note sys.stdout: 90c. and then on\n*note sys.stderr: 757.  It can be used to make sure that the logs\norder is consistent before writing into stderr.\n\nNew in version 3.11.\n\n-- Function: test.support.printwarning (msg)\n\nPrint a warning into *note sys.stderr: 3dfa.  Format the\nmessage as: 'f\"Warning -- {msg}\"'.  If 'msg' is made of multiple\nlines, add '\"Warning -- \"' prefix to each line.\n\nNew in version 3.9.\n\n-- Function: test.support.waitprocess (pid, *, exitcode, timeout=None)\n\nWait until process 'pid' completes and check that the process exit\ncode is 'exitcode'.\n\nRaise an *note AssertionError: 476. if the process exit code is not\nequal to 'exitcode'.\n\nIf the process runs longer than 'timeout' seconds (*note\nSHORTTIMEOUT: 1611. by default), kill the process and raise an\n*note AssertionError: 476.  The timeout feature is not available on\nWindows.\n\nNew in version 3.9.\n\n-- Function: test.support.calcobjsize (fmt)\n\nReturn the size of the *note PyObject: 6b1. whose structure members\nare defined by 'fmt'.  The returned value includes the size of the\nPython object header and alignment.\n\n-- Function: test.support.calcvobjsize (fmt)\n\nReturn the size of the *note PyVarObject: 3dfd. whose structure\nmembers are defined by 'fmt'.  The returned value includes the size\nof the Python object header and alignment.\n\n-- Function: test.support.checksizeof (test, o, size)\n\nFor testcase 'test', assert that the 'sys.getsizeof' for 'o' plus\nthe GC header size equals 'size'.\n\n-- Function: @test.support.anticipatefailure (condition)\n\nA decorator to conditionally mark tests with *note\nunittest.expectedFailure(): 3cdf.  Any use of this decorator should\nhave an associated comment identifying the relevant tracker issue.\n\n-- Function: test.support.systemmustvalidatecert (f)\n\nA decorator that skips the decorated test on TLS certification\nvalidation failures.\n\n-- Function: @test.support.runwithlocale (catstr, *locales)\n\nA decorator for running a function in a different locale, correctly\nresetting it after it has finished.  'catstr' is the locale\ncategory as a string (for example '\"LCALL\"').  The 'locales'\npassed will be tried sequentially, and the first valid locale will\nbe used.\n\n-- Function: @test.support.runwithtz (tz)\n\nA decorator for running a function in a specific timezone,\ncorrectly resetting it after it has finished.\n\n-- Function: @test.support.requiresfreebsdversion (*minversion)\n\nDecorator for the minimum version when running test on FreeBSD. If\nthe FreeBSD version is less than the minimum, the test is skipped.\n\n-- Function: @test.support.requireslinuxversion (*minversion)\n\nDecorator for the minimum version when running test on Linux.  If\nthe Linux version is less than the minimum, the test is skipped.\n\n-- Function: @test.support.requiresmacversion (*minversion)\n\nDecorator for the minimum version when running test on macOS. If\nthe macOS version is less than the minimum, the test is skipped.\n\n-- Function: @test.support.requiresIEEE754\n\nDecorator for skipping tests on non-IEEE 754 platforms.\n\n-- Function: @test.support.requireszlib\n\nDecorator for skipping tests if *note zlib: 12d. doesn't exist.\n\n-- Function: @test.support.requiresgzip\n\nDecorator for skipping tests if *note gzip: 62. doesn't exist.\n\n-- Function: @test.support.requiresbz2\n\nDecorator for skipping tests if *note bz2: 11. doesn't exist.\n\n-- Function: @test.support.requireslzma\n\nDecorator for skipping tests if *note lzma: 85. doesn't exist.\n\n-- Function: @test.support.requiresresource (resource)\n\nDecorator for skipping tests if 'resource' is not available.\n\n-- Function: @test.support.requiresdocstrings\n\nDecorator for only running the test if *note HAVEDOCSTRINGS: 3ddd.\n\n-- Function: @test.support.requireslimitedapi\n\nDecorator for only running the test if *note Limited C API: 2a8. is\navailable.\n\n-- Function: @test.support.cpythononly\n\nDecorator for tests only applicable to CPython.\n\n-- Function: @test.support.impldetail (msg=None, guards)\n\nDecorator for invoking *note checkimpldetail(): 3dec. on\n'guards'.  If that returns 'False', then uses 'msg' as the reason\nfor skipping the test.\n\n-- Function: @test.support.notracing\n\nDecorator to temporarily turn off tracing for the duration of the\ntest.\n\n-- Function: @test.support.refcounttest\n\nDecorator for tests which involve reference counting.  The\ndecorator does not run the test if it is not run by CPython.  Any\ntrace function is unset for the duration of the test to prevent\nunexpected refcounts caused by the trace function.\n\n-- Function: @test.support.bigmemtest (size, memuse, dryrun=True)\n\nDecorator for bigmem tests.\n\n'size' is a requested size for the test (in arbitrary,\ntest-interpreted units.)  'memuse' is the number of bytes per unit\nfor the test, or a good estimate of it.  For example, a test that\nneeds two byte buffers, of 4 GiB each, could be decorated with\n'@bigmemtest(size=4G, memuse=2)'.\n\nThe 'size' argument is normally passed to the decorated test method\nas an extra argument.  If 'dryrun' is 'True', the value passed to\nthe test method may be less than the requested value.  If 'dryrun'\nis 'False', it means the test doesn't support dummy runs when '-M'\nis not specified.\n\n-- Function: @test.support.bigaddrspacetest\n\nDecorator for tests that fill the address space.\n\n-- Function: test.support.checksyntaxerror (testcase, statement,\nerrtext='', *, lineno=None, offset=None)\n\nTest for syntax errors in 'statement' by attempting to compile\n'statement'.  'testcase' is the *note unittest: 101. instance for\nthe test.  'errtext' is the regular expression which should match\nthe string representation of the raised *note SyntaxError: 146.  If\n'lineno' is not 'None', compares to the line of the exception.  If\n'offset' is not 'None', compares to the offset of the exception.\n\n-- Function: test.support.openurlresource (url, *args, kw)\n\nOpen 'url'.  If open fails, raises *note TestFailed: 3dc8.\n\n-- Function: test.support.reapchildren ()\n\nUse this at the end of 'testmain' whenever sub-processes are\nstarted.  This will help ensure that no extra children (zombies)\nstick around to hog resources and create problems when looking for\nrefleaks.\n\n-- Function: test.support.getattribute (obj, name)\n\nGet an attribute, raising *note unittest.SkipTest: e57. if *note\nAttributeError: 395. is raised.\n\n-- Function: test.support.catchunraisableexception ()\n\nContext manager catching unraisable exception using *note\nsys.unraisablehook(): 448.\n\nStoring the exception value ('cm.unraisable.excvalue') creates a\nreference cycle.  The reference cycle is broken explicitly when the\ncontext manager exits.\n\nStoring the object ('cm.unraisable.object') can resurrect it if it\nis set to an object which is being finalized.  Exiting the context\nmanager clears the stored object.\n\nUsage:\n\nwith support.catchunraisableexception() as cm:\n# code creating an \"unraisable exception\"\n...\n\n# check the unraisable exception: use cm.unraisable\n...\n\n# cm.unraisable attribute no longer exists at this point\n# (to break a reference cycle)\n\nNew in version 3.8.\n\n-- Function: test.support.loadpackagetests (pkgdir, loader,\nstandardtests, pattern)\n\nGeneric implementation of the *note unittest: 101. 'loadtests'\nprotocol for use in test packages.  'pkgdir' is the root directory\nof the package; 'loader', 'standardtests', and 'pattern' are the\narguments expected by 'loadtests'.  In simple cases, the test\npackage's 'init.py' can be the following:\n\nimport os\nfrom test.support import loadpackagetests\n\ndef loadtests(*args):\nreturn loadpackagetests(os.path.dirname(file), *args)\n\n-- Function: test.support.detectapimismatch (refapi, otherapi, *,\nignore=())\n\nReturns the set of attributes, functions or methods of 'refapi'\nnot found on 'otherapi', except for a defined list of items to be\nignored in this check specified in 'ignore'.\n\nBy default this skips private attributes beginning with '' but\nincludes all magic methods, i.e.  those starting and ending in\n''.\n\nNew in version 3.5.\n\n-- Function: test.support.patch (testinstance, objecttopatch,\nattrname, newvalue)\n\nOverride 'objecttopatch.attrname' with 'newvalue'.  Also add\ncleanup procedure to 'testinstance' to restore 'objecttopatch'\nfor 'attrname'.  The 'attrname' should be a valid attribute for\n'objecttopatch'.\n\n-- Function: test.support.runinsubinterp (code)\n\nRun 'code' in subinterpreter.  Raise *note unittest.SkipTest: e57.\nif *note tracemalloc: fa. is enabled.\n\n-- Function: test.support.checkfreeafteriterating (test, iter, cls,\nargs=())\n\nAssert instances of 'cls' are deallocated after iterating.\n\n-- Function: test.support.missingcompilerexecutable (cmdnames=[])\n\nCheck for the existence of the compiler executables whose names are\nlisted in 'cmdnames' or all the compiler executables when\n'cmdnames' is empty and return the first missing executable or\n'None' when none is found missing.\n\n-- Function: test.support.checkall (testcase, module,\nnameofmodule=None, extra=(), notexported=())\n\nAssert that the 'all' variable of 'module' contains all public\nnames.\n\nThe module's public names (its API) are detected automatically\nbased on whether they match the public name convention and were\ndefined in 'module'.\n\nThe 'nameofmodule' argument can specify (as a string or tuple\nthereof) what module(s) an API could be defined in order to be\ndetected as a public API. One case for this is when 'module'\nimports part of its public API from other modules, possibly a C\nbackend (like 'csv' and its 'csv').\n\nThe 'extra' argument can be a set of names that wouldn't otherwise\nbe automatically detected as \"public\", like objects without a\nproper 'module' attribute.  If provided, it will be added to\nthe automatically detected ones.\n\nThe 'notexported' argument can be a set of names that must not be\ntreated as part of the public API even though their names indicate\notherwise.\n\nExample use:\n\nimport bar\nimport foo\nimport unittest\nfrom test import support\n\nclass MiscTestCase(unittest.TestCase):\ndef testall(self):\nsupport.checkall(self, foo)\n\nclass OtherTestCase(unittest.TestCase):\ndef testall(self):\nextra = {'BARCONST', 'FOOCONST'}\nnotexported = {'baz'}  # Undocumented name.\n# bar imports part of its API from bar.\nsupport.checkall(self, bar, ('bar', 'bar'),\nextra=extra, notexported=notexported)\n\nNew in version 3.6.\n\n-- Function: test.support.skipifbrokenmultiprocessingsynchronize ()\n\nSkip tests if the 'multiprocessing.synchronize' module is missing,\nif there is no available semaphore implementation, or if creating a\nlock raises an *note OSError: 613.\n\nNew in version 3.10.\n\n-- Function: test.support.checkdisallowinstantiation (testcase, tp,\n*args, kwds)\n\nAssert that type 'tp' cannot be instantiated using 'args' and\n'kwds'.\n\nNew in version 3.10.\n\n-- Function: test.support.adjustintmaxstrdigits (maxdigits)\n\nThis function returns a context manager that will change the global\n*note sys.setintmaxstrdigits(): 1515. setting for the duration\nof the context to allow execution of test code that needs a\ndifferent limit on the number of digits when converting between an\ninteger and string.\n\nNew in version 3.11.\n\nThe *note test.support: de. module defines the following classes:\n\n-- Class: test.support.SuppressCrashReport\n\nA context manager used to try to prevent crash dialog popups on\ntests that are expected to crash a subprocess.\n\nOn Windows, it disables Windows Error Reporting dialogs using\nSetErrorMode(1).\n\nOn UNIX, *note resource.setrlimit(): 3e21. is used to set *note\nresource.RLIMITCORE: 3e22.'s soft limit to 0 to prevent coredump\nfile creation.\n\nOn both platforms, the old value is restored by *note exit():\n1175.\n\n-- Class: test.support.SaveSignals\n\nClass to save and restore signal handlers registered by the Python\nsignal handler.\n\n-- Method: save (self)\n\nSave the signal handlers to a dictionary mapping signal\nnumbers to the current signal handler.\n\n-- Method: restore (self)\n\nSet the signal numbers from the *note save(): 3e24. dictionary\nto the saved handler.\n\n-- Class: test.support.Matcher\n\n-- Method: matches (self, d, kwargs)\n\nTry to match a single dict with the supplied arguments.\n\n-- Method: matchvalue (self, k, dv, v)\n\nTry to match a single stored value ('dv') with a supplied\nvalue ('v').\n\n---------- Footnotes ----------\n\n(1)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/ms680621.aspx\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: test support sockethelper -- Utilities for socket tests,  Next: test support scripthelper -- Utilities for the Python execution tests,  Prev: test support -- Utilities for the Python test suite,  Up: Development Tools": {
            "content": "The *note test.support.sockethelper: e3. module provides support for\nsocket tests.\n\nNew in version 3.9.\n\n-- Data: test.support.sockethelper.IPV6ENABLED\n\nSet to 'True' if IPv6 is enabled on this host, 'False' otherwise.\n\n-- Function: test.support.sockethelper.findunusedport\n(family=socket.AFINET, socktype=socket.SOCKSTREAM)\n\nReturns an unused port that should be suitable for binding.  This\nis achieved by creating a temporary socket with the same family and\ntype as the 'sock' parameter (default is *note AFINET: 157e, *note\nSOCKSTREAM: 1168.), and binding it to the specified host address\n(defaults to '0.0.0.0') with the port set to 0, eliciting an unused\nephemeral port from the OS. The temporary socket is then closed and\ndeleted, and the ephemeral port is returned.\n\nEither this method or *note bindport(): 3e2c. should be used for\nany tests where a server socket needs to be bound to a particular\nport for the duration of the test.  Which one to use depends on\nwhether the calling code is creating a Python socket, or if an\nunused port needs to be provided in a constructor or passed to an\nexternal program (i.e.  the '-accept' argument to openssl's\nsserver mode).  Always prefer *note bindport(): 3e2c. over *note\nfindunusedport(): 3e2b. where possible.  Using a hard coded port\nis discouraged since it can make multiple instances of the test\nimpossible to run simultaneously, which is a problem for buildbots.\n\n-- Function: test.support.sockethelper.bindport (sock, host=HOST)\n\nBind the socket to a free port and return the port number.  Relies\non ephemeral ports in order to ensure we are using an unbound port.\nThis is important as many tests may be running simultaneously,\nespecially in a buildbot environment.  This method raises an\nexception if the 'sock.family' is *note AFINET: 157e. and\n'sock.type' is *note SOCKSTREAM: 1168, and the socket has\n'SOREUSEADDR' or 'SOREUSEPORT' set on it.  Tests should never set\nthese socket options for TCP/IP sockets.  The only case for setting\nthese options is testing multicasting via multiple UDP sockets.\n\nAdditionally, if the 'SOEXCLUSIVEADDRUSE' socket option is\navailable (i.e.  on Windows), it will be set on the socket.  This\nwill prevent anyone else from binding to our host/port for the\nduration of the test.\n\n-- Function: test.support.sockethelper.bindunixsocket (sock, addr)\n\nBind a Unix socket, raising *note unittest.SkipTest: e57. if *note\nPermissionError: b9a. is raised.\n\n-- Function: @test.support.sockethelper.skipunlessbindunixsocket\n\nA decorator for running tests that require a functional 'bind()'\nfor Unix sockets.\n\n-- Function: test.support.sockethelper.transientinternet\n(resourcename, *, timeout=30.0, errnos=())\n\nA context manager that raises *note ResourceDenied: 3dc9. when\nvarious issues with the internet connection manifest themselves as\nexceptions.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: test support scripthelper -- Utilities for the Python execution tests,  Next: test support bytecodehelper -- Support tools for testing correct bytecode generation,  Prev: test support sockethelper -- Utilities for socket tests,  Up: Development Tools": {
            "content": "The *note test.support.scripthelper: e2. module provides support for\nPython's script execution tests.\n\n-- Function:\ntest.support.scripthelper.interpreterrequiresenvironment ()\n\nReturn 'True' if 'sys.executable interpreter' requires environment\nvariables in order to be able to run at all.\n\nThis is designed to be used with '@unittest.skipIf()' to annotate\ntests that need to use an 'assertpython*()' function to launch an\nisolated mode ('-I') or no environment mode ('-E') sub-interpreter\nprocess.\n\nA normal build & test does not run into this situation but it can\nhappen when trying to run the standard library test suite from an\ninterpreter that doesn't have an obvious home with Python's current\nhome finding logic.\n\nSetting *note PYTHONHOME: 334. is one way to get most of the\ntestsuite to run in that situation.  *note PYTHONPATH: e92. or\n'PYTHONUSERSITE' are other common environment variables that might\nimpact whether or not the interpreter can start.\n\n-- Function: test.support.scripthelper.runpythonuntilend (*args,\nenvvars)\n\nSet up the environment based on 'envvars' for running the\ninterpreter in a subprocess.  The values can include 'isolated',\n'cleanenv', 'cwd', and 'TERM'.\n\nChanged in version 3.9: The function no longer strips whitespaces\nfrom 'stderr'.\n\n-- Function: test.support.scripthelper.assertpythonok (*args,\nenvvars)\n\nAssert that running the interpreter with 'args' and optional\nenvironment variables 'envvars' succeeds ('rc == 0') and return a\n'(return code, stdout, stderr)' tuple.\n\nIf the 'cleanenv' keyword-only parameter is set, 'envvars' is\nused as a fresh environment.\n\nPython is started in isolated mode (command line option '-I'),\nexcept if the 'isolated' keyword-only parameter is set to\n'False'.\n\nChanged in version 3.9: The function no longer strips whitespaces\nfrom 'stderr'.\n\n-- Function: test.support.scripthelper.assertpythonfailure (*args,\nenvvars)\n\nAssert that running the interpreter with 'args' and optional\nenvironment variables 'envvars' fails ('rc != 0') and return a\n'(return code, stdout, stderr)' tuple.\n\nSee *note assertpythonok(): 3e32. for more options.\n\nChanged in version 3.9: The function no longer strips whitespaces\nfrom 'stderr'.\n\n-- Function: test.support.scripthelper.spawnpython (*args,\nstdout=subprocess.PIPE, stderr=subprocess.STDOUT, kw)\n\nRun a Python subprocess with the given arguments.\n\n'kw' is extra keyword args to pass to *note subprocess.Popen():\n8c3.  Returns a *note subprocess.Popen: 8c3. object.\n\n-- Function: test.support.scripthelper.killpython (p)\n\nRun the given *note subprocess.Popen: 8c3. process until completion\nand return stdout.\n\n-- Function: test.support.scripthelper.makescript (scriptdir,\nscriptbasename, source, omitsuffix=False)\n\nCreate script containing 'source' in path 'scriptdir' and\n'scriptbasename'.  If 'omitsuffix' is 'False', append '.py' to\nthe name.  Return the full script path.\n\n-- Function: test.support.scripthelper.makezipscript (zipdir,\nzipbasename, scriptname, nameinzip=None)\n\nCreate zip file at 'zipdir' and 'zipbasename' with extension\n'zip' which contains the files in 'scriptname'.  'nameinzip' is\nthe archive name.  Return a tuple containing '(full path, full path\nof archive name)'.\n\n-- Function: test.support.scripthelper.makepkg (pkgdir,\ninitsource='')\n\nCreate a directory named 'pkgdir' containing an 'init' file\nwith 'initsource' as its contents.\n\n-- Function: test.support.scripthelper.makezippkg (zipdir,\nzipbasename, pkgname, scriptbasename, source, depth=1,\ncompiled=False)\n\nCreate a zip package directory with a path of 'zipdir' and\n'zipbasename' containing an empty 'init' file and a file\n'scriptbasename' containing the 'source'.  If 'compiled' is\n'True', both source files will be compiled and added to the zip\npackage.  Return a tuple of the full zip path and the archive name\nfor the zip file.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: test support bytecodehelper -- Support tools for testing correct bytecode generation,  Next: test support threadinghelper -- Utilities for threading tests,  Prev: test support scripthelper -- Utilities for the Python execution tests,  Up: Development Tools": {
            "content": "The *note test.support.bytecodehelper: df. module provides support for\ntesting and inspecting bytecode generation.\n\nNew in version 3.9.\n\nThe module defines the following class:\n\n-- Class: test.support.bytecodehelper.BytecodeTestCase\n(unittest.TestCase)\n\nThis class has custom assertion methods for inspecting bytecode.\n\n-- Method: BytecodeTestCase.getdisassemblyasstring (co)\n\nReturn the disassembly of 'co' as string.\n\n-- Method: BytecodeTestCase.assertInBytecode (x, opname,\nargval=UNSPECIFIED)\n\nReturn instr if 'opname' is found, otherwise throws *note\nAssertionError: 476.\n\n-- Method: BytecodeTestCase.assertNotInBytecode (x, opname,\nargval=UNSPECIFIED)\n\nThrows *note AssertionError: 476. if 'opname' is found.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: test support threadinghelper -- Utilities for threading tests,  Next: test support oshelper -- Utilities for os tests,  Prev: test support bytecodehelper -- Support tools for testing correct bytecode generation,  Up: Development Tools": {
            "content": "The *note test.support.threadinghelper: e4. module provides support for\nthreading tests.\n\nNew in version 3.10.\n\n-- Function: test.support.threadinghelper.jointhread (thread,\ntimeout=None)\n\nJoin a 'thread' within 'timeout'.  Raise an *note AssertionError:\n476. if thread is still alive after 'timeout' seconds.\n\n-- Function: @test.support.threadinghelper.reapthreads\n\nDecorator to ensure the threads are cleaned up even if the test\nfails.\n\n-- Function: test.support.threadinghelper.startthreads (threads,\nunlock=None)\n\nContext manager to start 'threads', which is a sequence of threads.\n'unlock' is a function called after the threads are started, even\nif an exception was raised; an example would be *note\nthreading.Event.set(): 2d69.  'startthreads' will attempt to join\nthe started threads upon exit.\n\n-- Function: test.support.threadinghelper.threadingcleanup\n(*originalvalues)\n\nCleanup up threads not specified in 'originalvalues'.  Designed to\nemit a warning if a test leaves running threads in the background.\n\n-- Function: test.support.threadinghelper.threadingsetup ()\n\nReturn current thread count and copy of dangling threads.\n\n-- Function: test.support.threadinghelper.waitthreadsexit\n(timeout=None)\n\nContext manager to wait until all threads created in the 'with'\nstatement exit.\n\n-- Function: test.support.threadinghelper.catchthreadingexception ()\n\nContext manager catching *note threading.Thread: 76c. exception\nusing *note threading.excepthook(): 641.\n\nAttributes set when an exception is caught:\n\n* 'exctype'\n\n* 'excvalue'\n\n* 'exctraceback'\n\n* 'thread'\n\nSee *note threading.excepthook(): 641. documentation.\n\nThese attributes are deleted at the context manager exit.\n\nUsage:\n\nwith threadinghelper.catchthreadingexception() as cm:\n# code spawning a thread which raises an exception\n...\n\n# check the thread exception, use cm attributes:\n# exctype, excvalue, exctraceback, thread\n...\n\n# exctype, excvalue, exctraceback, thread attributes of cm no longer\n# exists at this point\n# (to avoid reference cycles)\n\nNew in version 3.8.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: test support oshelper -- Utilities for os tests,  Next: test support importhelper -- Utilities for import tests,  Prev: test support threadinghelper -- Utilities for threading tests,  Up: Development Tools": {
            "content": "The *note test.support.oshelper: e1. module provides support for os\ntests.\n\nNew in version 3.10.\n\n-- Data: test.support.oshelper.FSNONASCII\n\nA non-ASCII character encodable by *note os.fsencode(): a9e.\n\n-- Data: test.support.oshelper.SAVEDCWD\n\nSet to *note os.getcwd(): 1779.\n\n-- Data: test.support.oshelper.TESTFN\n\nSet to a name that is safe to use as the name of a temporary file.\nAny temporary file that is created should be closed and unlinked\n(removed).\n\n-- Data: test.support.oshelper.TESTFNNONASCII\n\nSet to a filename containing the *note FSNONASCII: 3e48.\ncharacter, if it exists.  This guarantees that if the filename\nexists, it can be encoded and decoded with the default filesystem\nencoding.  This allows tests that require a non-ASCII filename to\nbe easily skipped on platforms where they can't work.\n\n-- Data: test.support.oshelper.TESTFNUNENCODABLE\n\nSet to a filename (str type) that should not be able to be encoded\nby file system encoding in strict mode.  It may be 'None' if it's\nnot possible to generate such a filename.\n\n-- Data: test.support.oshelper.TESTFNUNDECODABLE\n\nSet to a filename (bytes type) that should not be able to be\ndecoded by file system encoding in strict mode.  It may be 'None'\nif it's not possible to generate such a filename.\n\n-- Data: test.support.oshelper.TESTFNUNICODE\n\nSet to a non-ASCII name for a temporary file.\n\n-- Class: test.support.oshelper.EnvironmentVarGuard\n\nClass used to temporarily set or unset environment variables.\nInstances can be used as a context manager and have a complete\ndictionary interface for querying/modifying the underlying\n'os.environ'.  After exit from the context manager all changes to\nenvironment variables done through this instance will be rolled\nback.\n\nChanged in version 3.1: Added dictionary interface.\n\n-- Class: test.support.oshelper.FakePath (path)\n\nSimple *note path-like object: 957.  It implements the *note\nfspath(): a9b. method which just returns the 'path' argument.\nIf 'path' is an exception, it will be raised in 'fspath()'.\n\n-- Method: EnvironmentVarGuard.set (envvar, value)\n\nTemporarily set the environment variable 'envvar' to the value of\n'value'.\n\n-- Method: EnvironmentVarGuard.unset (envvar)\n\nTemporarily unset the environment variable 'envvar'.\n\n-- Function: test.support.oshelper.cansymlink ()\n\nReturn 'True' if the OS supports symbolic links, 'False' otherwise.\n\n-- Function: test.support.oshelper.canxattr ()\n\nReturn 'True' if the OS supports xattr, 'False' otherwise.\n\n-- Function: test.support.oshelper.changecwd (path, quiet=False)\n\nA context manager that temporarily changes the current working\ndirectory to 'path' and yields the directory.\n\nIf 'quiet' is 'False', the context manager raises an exception on\nerror.  Otherwise, it issues only a warning and keeps the current\nworking directory the same.\n\n-- Function: test.support.oshelper.createemptyfile (filename)\n\nCreate an empty file with 'filename'.  If it already exists,\ntruncate it.\n\n-- Function: test.support.oshelper.fdcount ()\n\nCount the number of open file descriptors.\n\n-- Function: test.support.oshelper.fsiscaseinsensitive (directory)\n\nReturn 'True' if the file system for 'directory' is\ncase-insensitive.\n\n-- Function: test.support.oshelper.makebadfd ()\n\nCreate an invalid file descriptor by opening and closing a\ntemporary file, and returning its descriptor.\n\n-- Function: test.support.oshelper.rmdir (filename)\n\nCall *note os.rmdir(): f64. on 'filename'.  On Windows platforms,\nthis is wrapped with a wait loop that checks for the existence of\nthe file, which is needed due to antivirus programs that can hold\nfiles open and prevent deletion.\n\n-- Function: test.support.oshelper.rmtree (path)\n\nCall *note shutil.rmtree(): 1d5. on 'path' or call *note\nos.lstat(): 1c0. and *note os.rmdir(): f64. to remove a path and\nits contents.  As with *note rmdir(): 3e59, on Windows platforms\nthis is wrapped with a wait loop that checks for the existence of\nthe files.\n\n-- Function: @test.support.oshelper.skipunlesssymlink\n\nA decorator for running tests that require support for symbolic\nlinks.\n\n-- Function: @test.support.oshelper.skipunlessxattr\n\nA decorator for running tests that require support for xattr.\n\n-- Function: test.support.oshelper.tempcwd (name='tempcwd',\nquiet=False)\n\nA context manager that temporarily creates a new directory and\nchanges the current working directory (CWD).\n\nThe context manager creates a temporary directory in the current\ndirectory with name 'name' before temporarily changing the current\nworking directory.  If 'name' is 'None', the temporary directory is\ncreated using *note tempfile.mkdtemp(): 1eb.\n\nIf 'quiet' is 'False' and it is not possible to create or change\nthe CWD, an error is raised.  Otherwise, only a warning is raised\nand the original CWD is used.\n\n-- Function: test.support.oshelper.tempdir (path=None, quiet=False)\n\nA context manager that creates a temporary directory at 'path' and\nyields the directory.\n\nIf 'path' is 'None', the temporary directory is created using *note\ntempfile.mkdtemp(): 1eb.  If 'quiet' is 'False', the context\nmanager raises an exception on error.  Otherwise, if 'path' is\nspecified and cannot be created, only a warning is issued.\n\n-- Function: test.support.oshelper.tempumask (umask)\n\nA context manager that temporarily sets the process umask.\n\n-- Function: test.support.oshelper.unlink (filename)\n\nCall *note os.unlink(): f66. on 'filename'.  As with *note rmdir():\n3e59, on Windows platforms, this is wrapped with a wait loop that\nchecks for the existence of the file.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: test support importhelper -- Utilities for import tests,  Next: test support warningshelper -- Utilities for warnings tests,  Prev: test support oshelper -- Utilities for os tests,  Up: Development Tools": {
            "content": "The *note test.support.importhelper: e0. module provides support for\nimport tests.\n\nNew in version 3.10.\n\n-- Function: test.support.importhelper.forget (modulename)\n\nRemove the module named 'modulename' from 'sys.modules' and delete\nany byte-compiled files of the module.\n\n-- Function: test.support.importhelper.importfreshmodule (name,\nfresh=(), blocked=(), deprecated=False)\n\nThis function imports and returns a fresh copy of the named Python\nmodule by removing the named module from 'sys.modules' before doing\nthe import.  Note that unlike 'reload()', the original module is\nnot affected by this operation.\n\n'fresh' is an iterable of additional module names that are also\nremoved from the 'sys.modules' cache before doing the import.\n\n'blocked' is an iterable of module names that are replaced with\n'None' in the module cache during the import to ensure that\nattempts to import them raise *note ImportError: 145.\n\nThe named module and any modules named in the 'fresh' and 'blocked'\nparameters are saved before starting the import and then reinserted\ninto 'sys.modules' when the fresh import is complete.\n\nModule and package deprecation messages are suppressed during this\nimport if 'deprecated' is 'True'.\n\nThis function will raise *note ImportError: 145. if the named\nmodule cannot be imported.\n\nExample use:\n\n# Get copies of the warnings module for testing without affecting the\n# version being used by the rest of the test suite. One copy uses the\n# C implementation, the other is forced to use the pure Python fallback\n# implementation\npywarnings = importfreshmodule('warnings', blocked=['warnings'])\ncwarnings = importfreshmodule('warnings', fresh=['warnings'])\n\nNew in version 3.1.\n\n-- Function: test.support.importhelper.importmodule (name,\ndeprecated=False, *, requiredon=())\n\nThis function imports and returns the named module.  Unlike a\nnormal import, this function raises *note unittest.SkipTest: e57.\nif the module cannot be imported.\n\nModule and package deprecation messages are suppressed during this\nimport if 'deprecated' is 'True'.  If a module is required on a\nplatform but optional for others, set 'requiredon' to an iterable\nof platform prefixes which will be compared against *note\nsys.platform: 8bc.\n\nNew in version 3.1.\n\n-- Function: test.support.importhelper.modulessetup ()\n\nReturn a copy of *note sys.modules: 16d7.\n\n-- Function: test.support.importhelper.modulescleanup (oldmodules)\n\nRemove modules except for 'oldmodules' and 'encodings' in order to\npreserve internal cache.\n\n-- Function: test.support.importhelper.unload (name)\n\nDelete 'name' from 'sys.modules'.\n\n-- Function: test.support.importhelper.makelegacypyc (source)\n\nMove a PEP 3147(1)/ PEP 488(2) pyc file to its legacy pyc location\nand return the file system path to the legacy pyc file.  The\n'source' value is the file system path to the source file.  It does\nnot need to exist, however the PEP 3147/488 pyc file must exist.\n\n-- Class: test.support.importhelper.CleanImport (*modulenames)\n\nA context manager to force import to return a new module reference.\nThis is useful for testing module-level behaviors, such as the\nemission of a *note DeprecationWarning: 179. on import.  Example\nusage:\n\nwith CleanImport('foo'):\nimportlib.importmodule('foo')  # New reference.\n\n-- Class: test.support.importhelper.DirsOnSysPath (*paths)\n\nA context manager to temporarily add directories to *note sys.path:\n32c.\n\nThis makes a copy of *note sys.path: 32c, appends any directories\ngiven as positional arguments, then reverts *note sys.path: 32c. to\nthe copied settings when the context ends.\n\nNote that 'all' *note sys.path: 32c. modifications in the body of\nthe context manager, including replacement of the object, will be\nreverted at the end of the block.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3147/\n\n(2) https://peps.python.org/pep-0488/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: test support warningshelper -- Utilities for warnings tests,  Prev: test support importhelper -- Utilities for import tests,  Up: Development Tools": {
            "content": "The *note test.support.warningshelper: e5. module provides support for\nwarnings tests.\n\nNew in version 3.10.\n\n-- Function: test.support.warningshelper.ignorewarnings (*, category)\n\nSuppress warnings that are instances of 'category', which must be\n*note Warning: 1fc2. or a subclass.  Roughly equivalent to *note\nwarnings.catchwarnings(): 2e6. with *note\nwarnings.simplefilter('ignore', category=category): 491.  For\nexample:\n\n@warninghelper.ignorewarnings(category=DeprecationWarning)\ndef testsuppresswarning():\n# do something\n\nNew in version 3.8.\n\n-- Function: test.support.warningshelper.checknoresourcewarning\n(testcase)\n\nContext manager to check that no *note ResourceWarning: a86. was\nraised.  You must remove the object which may emit *note\nResourceWarning: a86. before the end of the context manager.\n\n-- Function: test.support.warningshelper.checksyntaxwarning\n(testcase, statement, errtext='', *, lineno=1, offset=None)\n\nTest for syntax warning in 'statement' by attempting to compile\n'statement'.  Test also that the *note SyntaxWarning: 178. is\nemitted only once, and that it will be converted to a *note\nSyntaxError: 146. when turned into error.  'testcase' is the *note\nunittest: 101. instance for the test.  'errtext' is the regular\nexpression which should match the string representation of the\nemitted *note SyntaxWarning: 178. and raised *note SyntaxError:\n146.  If 'lineno' is not 'None', compares to the line of the\nwarning and exception.  If 'offset' is not 'None', compares to the\noffset of the exception.\n\nNew in version 3.8.\n\n-- Function: test.support.warningshelper.checkwarnings (*filters,\nquiet=True)\n\nA convenience wrapper for *note warnings.catchwarnings(): 2e6.\nthat makes it easier to test that a warning was correctly raised.\nIt is approximately equivalent to calling\n'warnings.catchwarnings(record=True)' with *note\nwarnings.simplefilter(): 491. set to 'always' and with the option\nto automatically validate the results that are recorded.\n\n'checkwarnings' accepts 2-tuples of the form '(\"message regexp\",\nWarningCategory)' as positional arguments.  If one or more\n'filters' are provided, or if the optional keyword argument 'quiet'\nis 'False', it checks to make sure the warnings are as expected:\neach specified filter must match at least one of the warnings\nraised by the enclosed code or the test fails, and if any warnings\nare raised that do not match any of the specified filters the test\nfails.  To disable the first of these checks, set 'quiet' to\n'True'.\n\nIf no arguments are specified, it defaults to:\n\ncheckwarnings((\"\", Warning), quiet=True)\n\nIn this case all warnings are caught and no errors are raised.\n\nOn entry to the context manager, a 'WarningRecorder' instance is\nreturned.  The underlying warnings list from *note\ncatchwarnings(): 2e6. is available via the recorder object's *note\nwarnings: 10d. attribute.  As a convenience, the attributes of the\nobject representing the most recent warning can also be accessed\ndirectly through the recorder object (see example below).  If no\nwarning has been raised, then any of the attributes that would\notherwise be expected on an object representing a warning will\nreturn 'None'.\n\nThe recorder object also has a 'reset()' method, which clears the\nwarnings list.\n\nThe context manager is designed to be used like this:\n\nwith checkwarnings((\"assertion is always true\", SyntaxWarning),\n(\"\", UserWarning)):\nexec('assert(False, \"Hey!\")')\nwarnings.warn(UserWarning(\"Hide me!\"))\n\nIn this case if either warning was not raised, or some other\nwarning was raised, *note checkwarnings(): 3e6e. would raise an\nerror.\n\nWhen a test needs to look more deeply into the warnings, rather\nthan just checking whether or not they occurred, code like this can\nbe used:\n\nwith checkwarnings(quiet=True) as w:\nwarnings.warn(\"foo\")\nassert str(w.args[0]) == \"foo\"\nwarnings.warn(\"bar\")\nassert str(w.args[0]) == \"bar\"\nassert str(w.warnings[0].args[0]) == \"foo\"\nassert str(w.warnings[1].args[0]) == \"bar\"\nw.reset()\nassert len(w.warnings) == 0\n\nHere all warnings will be caught, and the test code tests the\ncaptured warnings directly.\n\nChanged in version 3.2: New optional arguments 'filters' and\n'quiet'.\n\n-- Class: test.support.warningshelper.WarningsRecorder\n\nClass used to record warnings for unit tests.  See documentation of\n*note checkwarnings(): 3e6e. above for more details.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Debugging and Profiling,  Next: Software Packaging and Distribution,  Prev: Development Tools,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.27 Debugging and Profiling",
                    "content": ""
                }
            ]
        },
        "These libraries help you with Python development: the debugger enables": {
            "content": "you to step through code, analyze stack frames and set breakpoints etc.,\nand the profilers run code and give you a detailed breakdown of\nexecution times, allowing you to identify bottlenecks in your programs.",
            "subsections": []
        },
        "Auditing events provide visibility into runtime behaviors that would": {
            "content": "otherwise require intrusive debugging or patching.\n\n* Menu:\n\n* Audit events table::\n* bdb -- Debugger framework::\n* faulthandler -- Dump the Python traceback::\n* pdb -- The Python Debugger::\n* The Python Profilers::\n* timeit -- Measure execution time of small code snippets::\n* trace -- Trace or track Python statement execution::\n* tracemalloc -- Trace memory allocations::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Audit events table,  Next: bdb -- Debugger framework,  Up: Debugging and Profiling": {
            "content": "This table contains all events raised by *note sys.audit(): 16dc. or\n*note PySysAudit(): 16ec. calls throughout the CPython runtime and the\nstandard library.  These calls were added in 3.8 or later (see PEP\n578(1)).\n\nSee *note sys.addaudithook(): 3e74. and *note PySysAddAuditHook():\n3e75. for information on handling these events.\n\n'CPython implementation detail:' This table is generated from the\nCPython documentation, and may not represent events raised by other\nimplementations.  See your runtime specific documentation for actual\nevents raised.\n",
            "subsections": []
        },
        "Audit event                        Arguments                                                   References": {
            "content": "-------------------------------------------------------------------------------------------------------------------\n\nthread.startnewthread           'function', 'args', 'kwargs'                                *note [1]: 3e76.\n\n\narray.new                      'typecode', 'initializer'                                   *note [1]: 18f.\n\n\nbuiltins.breakpoint                'breakpointhook'                                            *note [1]: 8f9.\n\n\nbuiltins.id                        'id'                                                        *note [1]: 1279.\n\n\nbuiltins.input                     'prompt'                                                    *note [1]: 114d.\n\n\nbuiltins.input/result              'result'                                                    *note [1]: 114d.\n\n\ncode.new                       'code', 'filename', 'name', 'argcount',                     *note [1]: 7f6.\n'posonlyargcount', 'kwonlyargcount', 'nlocals',\n'stacksize', 'flags'\n\n\ncompile                            'source', 'filename'                                        *note [1]: 528.\n\n\ncpython.PyInterpreterStateClear                                                               *note [1]: 3e77.\n\n\ncpython.PyInterpreterStateNew                                                                 *note [1]: 3e78.\n\n\ncpython.PySysClearAuditHooks                                                                 *note [1]: b67.\n\n\ncpython.runcommand                'command'                                                   *note [1]: 3a4.\n\n\ncpython.runfile                   'filename'                                                  *note [1]: 3e79.\n\n\ncpython.runinteractivehook        'hook'                                                      *note [1]: e3a.\n\n\ncpython.runmodule                 'module-name'                                               *note [1]: 3a5.\n\n\ncpython.runstartup                'filename'                                                  *note [1]: e3b.\n\n\ncpython.runstdin                                                                              *note [1]: 3e7a.\n\n\nctypes.addressof                   'obj'                                                       *note [1]: 2d1c.\n\n\nctypes.callfunction               'funcpointer', 'arguments'                                 *note [1]: 2d14.\n\n\nctypes.cdata                       'address'                                                   *note [1]: 2d2e.\n\n\nctypes.cdata/buffer                'pointer', 'size', 'offset'                                 *note [1]: 2d2c.*note [2]: 2d2d.\n\n\nctypes.createstringbuffer        'init', 'size'                                              *note [1]: 2ccf.\n\n\nctypes.createunicodebuffer       'init', 'size'                                              *note [1]: 1741.\n\n\nctypes.dlopen                      'name'                                                      *note [1]: 2d12.\n\n\nctypes.dlsym                       'library', 'name'                                           *note [1]: 2d12.\n\n\nctypes.dlsym/handle                'handle', 'name'                                            *note [1]: 2d12.\n\n\nctypes.geterrno                                                                               *note [1]: 2d0c.\n\n\nctypes.getlasterror                                                                          *note [1]: 2d0e.\n\n\nctypes.seterrno                   'errno'                                                     *note [1]: 2d0d.\n\n\nctypes.setexception               'code'                                                      *note [1]: 2d14.\n\n\nctypes.setlasterror              'error'                                                     *note [1]: 2d0f.\n\n\nctypes.stringat                   'address', 'size'                                           *note [1]: 2d25.\n\n\nctypes.wstringat                  'address', 'size'                                           *note [1]: 2d27.\n\n\nensurepip.bootstrap                'root'                                                      *note [1]: 3e7b.\n\n\nexec                               'codeobject'                                               *note [1]: 690.*note [2]: 691.\n\n\nfcntl.fcntl                        'fd', 'cmd', 'arg'                                          *note [1]: 3099.\n\n\nfcntl.flock                        'fd', 'operation'                                           *note [1]: 3e7c.\n\n\nfcntl.ioctl                        'fd', 'request', 'arg'                                      *note [1]: 12d0.\n\n\nfcntl.lockf                        'fd', 'cmd', 'len', 'start', 'whence'                       *note [1]: 1241.\n\n\nftplib.connect                     'self', 'host', 'port'                                      *note [1]: 36c2.\n\n\nftplib.sendcmd                     'self', 'cmd'                                               *note [1]: 36c7.*note [2]: 36c8.\n\n\nfunction.new                   'code'                                                      *note [1]: 68f.\n\n\ngc.getobjects                     'generation'                                                *note [1]: 5f6.\n\n\ngc.getreferents                   'objs'                                                      *note [1]: 5f8.\n\n\ngc.getreferrers                   'objs'                                                      *note [1]: 5f7.\n\n\nglob.glob                          'pathname', 'recursive'                                     *note [1]: 5fa.*note [2]: 5fb.\n\n\nglob.glob/2                        'pathname', 'recursive', 'rootdir', 'dirfd'               *note [1]: 5fa.*note [2]: 5fb.\n\n\nhttp.client.connect                'self', 'host', 'port'                                      *note [1]: 36a5.\n\n\nhttp.client.send                   'self', 'data'                                              *note [1]: 36aa.\n\n\nimaplib.open                       'self', 'host', 'port'                                      *note [1]: 720.\n\n\nimaplib.send                       'self', 'data'                                              *note [1]: 3719.\n\n\nimport                             'module', 'filename', 'sys.path', 'sys.metapath',          *note [1]: 3a6.\n'sys.pathhooks'\n\n\nmarshal.dumps                      'value', 'version'                                          *note [1]: 25b1.\n\n\nmarshal.load                                                                                   *note [1]: 178b.\n\n\nmarshal.loads                      'bytes'                                                     *note [1]: 178b.\n\n\nmmap.new                       'fileno', 'length', 'access', 'offset'                      *note [1]: 830.\n\n\nmsvcrt.getosfhandle               'fd'                                                        *note [1]: 3e7d.\n\n\nmsvcrt.locking                     'fd', 'mode', 'nbytes'                                      *note [1]: 3e7e.\n\n\nmsvcrt.openosfhandle              'handle', 'flags'                                           *note [1]: 3e7f.\n\n\nnntplib.connect                    'self', 'host', 'port'                                      *note [1]: 733.*note [2]: 734.\n\n\nnntplib.putline                    'self', 'line'                                              *note [1]: 733.*note [2]: 734.\n\n\nobject.delattr                 'obj', 'name'                                               *note [1]: 1c36.\n\n\nobject.getattr                 'obj', 'name'                                               *note [1]: a16.\n\n\nobject.setattr                 'obj', 'name', 'value'                                      *note [1]: 1c35.\n\n\nopen                               'path', 'mode', 'flags'                                     *note [1]: 26e.*note [2]: 26f.*note [3]: bee.\n\n\nos.adddlldirectory               'path'                                                      *note [1]: 810.\n\n\nos.chdir                           'path'                                                      *note [1]: 3d8.*note [2]: be4.\n\n\nos.chflags                         'path', 'flags'                                             *note [1]: f5c.*note [2]: 2875.\n\n\nos.chmod                           'path', 'mode', 'dirfd'                                    *note [1]: f5d.*note [2]: be5.*note [3]: 17b8.\n\n\nos.chown                           'path', 'uid', 'gid', 'dirfd'                              *note [1]: f5e.*note [2]: be6.*note [3]: 2876.\n\n\nos.exec                            'path', 'args', 'env'                                       *note [1]: 28b1.\n\n\nos.fork                                                                                        *note [1]: 231.\n\n\nos.forkpty                                                                                     *note [1]: 14d4.\n\n\nos.fwalk                           'top', 'topdown', 'onerror', 'followsymlinks', 'dirfd'    *note [1]: 998.\n\n\nos.getxattr                        'path', 'attribute'                                         *note [1]: f74.\n\n\nos.kill                            'pid', 'sig'                                                *note [1]: 11db.\n\n\nos.killpg                          'pgid', 'sig'                                               *note [1]: 1749.\n\n\nos.link                            'src', 'dst', 'srcdirfd', 'dstdirfd'                    *note [1]: f5f.\n\n\nos.listdir                         'path'                                                      *note [1]: f6a.\n\n\nos.listdrives                                                                                  *note [1]: 1bc.\n\n\nos.listmounts                      'volume'                                                    *note [1]: 1be.\n\n\nos.listvolumes                                                                                 *note [1]: 1bd.\n\n\nos.listxattr                       'path'                                                      *note [1]: f75.\n\n\nos.lockf                           'fd', 'cmd', 'len'                                          *note [1]: f83.\n\n\nos.mkdir                           'path', 'mode', 'dirfd'                                    *note [1]: 9a1.*note [2]: f60.\n\n\nos.posixspawn                     'path', 'argv', 'env'                                       *note [1]: 885.*note [2]: 17a8.\n\n\nos.putenv                          'key', 'value'                                              *note [1]: 73a.\n\n\nos.remove                          'path', 'dirfd'                                            *note [1]: f61.*note [2]: 287a.*note [3]: f66.\n\n\nos.removexattr                     'path', 'attribute'                                         *note [1]: f76.\n\n\nos.rename                          'src', 'dst', 'srcdirfd', 'dstdirfd'                    *note [1]: f62.*note [2]: 287b.*note [3]: f63.\n\n\nos.rmdir                           'path', 'dirfd'                                            *note [1]: f64.\n\n\nos.scandir                         'path'                                                      *note [1]: 88c.\n\n\nos.setxattr                        'path', 'attribute', 'value', 'flags'                       *note [1]: f77.\n\n\nos.spawn                           'mode', 'path', 'args', 'env'                               *note [1]: 1479.\n\n\nos.startfile                       'path', 'operation'                                         *note [1]: 1630.\n\n\nos.startfile/2                     'path', 'operation', 'arguments', 'cwd', 'showcmd'         *note [1]: 1630.\n\n\nos.symlink                         'src', 'dst', 'dirfd'                                      *note [1]: f65.\n\n\nos.system                          'command'                                                   *note [1]: 12b2.\n\n\nos.truncate                        'fd', 'length'                                              *note [1]: beb.*note [2]: c9b.\n\n\nos.unsetenv                        'key'                                                       *note [1]: 739.\n\n\nos.utime                           'path', 'times', 'ns', 'dirfd'                             *note [1]: f67.\n\n\nos.walk                            'top', 'topdown', 'onerror', 'followlinks'                  *note [1]: 1c8.\n\n\npathlib.Path.glob                  'self', 'pattern'                                           *note [1]: 1cc.\n\n\npathlib.Path.rglob                 'self', 'pattern'                                           *note [1]: 1cd.\n\n\npdb.Pdb                                                                                        *note [1]: 740.\n\n\npickle.findclass                  'module', 'name'                                            *note [1]: 258d.\n\n\npoplib.connect                     'self', 'host', 'port'                                      *note [1]: 742.*note [2]: 743.\n\n\npoplib.putline                     'self', 'line'                                              *note [1]: 742.*note [2]: 743.\n\n\npty.spawn                          'argv'                                                      *note [1]: df2.\n\n\nresource.prlimit                   'pid', 'resource', 'limits'                                 *note [1]: df9.\n\n\nresource.setrlimit                 'resource', 'limits'                                        *note [1]: 3e21.\n\n\nsetopencodehook                                                                                *note [1]: 146e.\n\n\nshutil.chown                       'path', 'user', 'group'                                     *note [1]: f9f.\n\n\nshutil.copyfile                    'src', 'dst'                                                *note [1]: 887.*note [2]: 888.*note [3]: 886.\n\n\nshutil.copymode                    'src', 'dst'                                                *note [1]: 887.*note [2]: 13cc.\n\n\nshutil.copystat                    'src', 'dst'                                                *note [1]: 888.*note [2]: fa0.\n\n\nshutil.copytree                    'src', 'dst'                                                *note [1]: 854.\n\n\nshutil.makearchive                'basename', 'format', 'rootdir', 'basedir'               *note [1]: 1d4.\n\n\nshutil.move                        'src', 'dst'                                                *note [1]: 889.\n\n\nshutil.rmtree                      'path', 'dirfd'                                            *note [1]: 1d5.\n\n\nshutil.unpackarchive              'filename', 'extractdir', 'format'                         *note [1]: 184.\n\n\nsignal.pthreadkill                'threadid', 'signalnum'                                    *note [1]: fa3.\n\n\nsmtplib.connect                    'self', 'host', 'port'                                      *note [1]: 1739.\n\n\nsmtplib.send                       'self', 'data'                                              *note [1]: 74b.\n\n\nsocket.new                     'self', 'family', 'type', 'protocol'                        *note [1]: bfd.\n\n\nsocket.bind                        'self', 'address'                                           *note [1]: 1394.\n\n\nsocket.connect                     'self', 'address'                                           *note [1]: bff.*note [2]: 1393.\n\n\nsocket.getaddrinfo                 'host', 'port', 'family', 'type', 'protocol'                *note [1]: 149f.\n\n\nsocket.gethostbyaddr               'ipaddress'                                                *note [1]: 1631.\n\n\nsocket.gethostbyname               'hostname'                                                  *note [1]: 308d.*note [2]: 1632.\n\n\nsocket.gethostname                                                                             *note [1]: 281f.\n\n\nsocket.getnameinfo                 'sockaddr'                                                  *note [1]: 1466.\n\n\nsocket.getservbyname               'servicename', 'protocolname'                               *note [1]: 308f.\n\n\nsocket.getservbyport               'port', 'protocolname'                                      *note [1]: 3090.\n\n\nsocket.sendmsg                     'self', 'address'                                           *note [1]: 191.\n\n\nsocket.sendto                      'self', 'address'                                           *note [1]: c05.\n\n\nsocket.sethostname                 'name'                                                      *note [1]: fad.\n\n\nsqlite3.connect                    'database'                                                  *note [1]: 1da.\n\n\nsqlite3.connect/handle             'connectionhandle'                                         *note [1]: 1da.\n\n\nsqlite3.enableloadextension      'connection', 'enabled'                                     *note [1]: 634.\n\n\nsqlite3.loadextension             'connection', 'path'                                        *note [1]: 1dc.\n\n\nsubprocess.Popen                   'executable', 'args', 'cwd', 'env'                          *note [1]: 8c3.\n\n\nsys.currentexceptions                                                                        *note [1]: 1e6.\n\n\nsys.currentframes                                                                            *note [1]: 128b.\n\n\nsys.getframe                      'frame'                                                     *note [1]: 4b0.\n\n\nsys.getframemodulename            'depth'                                                     *note [1]: 14c0.\n\n\nsys.addaudithook                                                                               *note [1]: 3e75.*note [2]: 3e74.\n\n\nsys.excepthook                     'hook', 'type', 'value', 'traceback'                        *note [1]: 5ff.\n\n\nsys.setasyncgenhooksfinalizer                                                               *note [1]: 1596.\n\n\nsys.setasyncgenhooksfirstiter                                                               *note [1]: 1596.\n\n\nsys.setprofile                                                                                 *note [1]: 1359.\n\n\nsys.settrace                                                                                   *note [1]: 135a.\n\n\nsys.unraisablehook                 'hook', 'unraisable'                                        *note [1]: 448.\n\n\nsyslog.closelog                                                                                *note [1]: 297.\n\n\nsyslog.openlog                     'ident', 'logoption', 'facility'                            *note [1]: 296.\n\n\nsyslog.setlogmask                  'maskpri'                                                   *note [1]: 3e80.\n\n\nsyslog.syslog                      'priority', 'message'                                       *note [1]: 298.\n\n\ntelnetlib.Telnet.open              'self', 'host', 'port'                                      *note [1]: 3e81.\n\n\ntelnetlib.Telnet.write             'self', 'buffer'                                            *note [1]: 3e82.\n\n\ntempfile.mkdtemp                   'fullpath'                                                  *note [1]: 10aa.*note [2]: 1eb.\n\n\ntempfile.mkstemp                   'fullpath'                                                  *note [1]: 1ea.*note [2]: 253f.*note [3]: 2540.\n\n\nurllib.Request                     'fullurl', 'data', 'headers', 'method'                      *note [1]: cf9.\n\n\nwebbrowser.open                    'url'                                                       *note [1]: 3585.\n\n\nwinreg.ConnectRegistry             'computername', 'key'                                      *note [1]: 3e83.\n\n\nwinreg.CreateKey                   'key', 'subkey', 'access'                                  *note [1]: 3e84.*note [2]: 11d6.\n\n\nwinreg.DeleteKey                   'key', 'subkey', 'access'                                  *note [1]: 3e85.*note [2]: 11d7.\n\n\nwinreg.DeleteValue                 'key', 'value'                                              *note [1]: 3e86.\n\n\nwinreg.DisableReflectionKey        'key'                                                       *note [1]: 11d8.\n\n\nwinreg.EnableReflectionKey         'key'                                                       *note [1]: 11d9.\n\n\nwinreg.EnumKey                     'key', 'index'                                              *note [1]: 3e87.\n\n\nwinreg.EnumValue                   'key', 'index'                                              *note [1]: 3e88.\n\n\nwinreg.ExpandEnvironmentStrings    'str'                                                       *note [1]: 124d.\n\n\nwinreg.LoadKey                     'key', 'subkey', 'filename'                               *note [1]: 3e89.\n\n\nwinreg.OpenKey                     'key', 'subkey', 'access'                                  *note [1]: 3e8a.\n\n\nwinreg.OpenKey/result              'key'                                                       *note [1]: 3e84.*note [2]: 11d6.*note [3]: 3e8a.\n\n\nwinreg.PyHKEY.Detach               'key'                                                       *note [1]: 3e8b.\n\n\nwinreg.QueryInfoKey                'key'                                                       *note [1]: 3e8c.\n\n\nwinreg.QueryReflectionKey          'key'                                                       *note [1]: 11da.\n\n\nwinreg.QueryValue                  'key', 'subkey', 'valuename'                              *note [1]: 3e8d.*note [2]: 3e8e.\n\n\nwinreg.SaveKey                     'key', 'filename'                                          *note [1]: 3e8f.\n\n\nwinreg.SetValue                    'key', 'subkey', 'type', 'value'                           *note [1]: 3e90.*note [2]: 14e2.\n\n",
            "subsections": []
        },
        "The following events are raised internally and do not correspond to any": {
            "content": "public API of CPython:\n",
            "subsections": []
        },
        "Audit event                    Arguments": {
            "content": "-------------------------------------------------------------------------------\n\nwinapi.CreateFile             'filename', 'desiredaccess', 'sharemode',\n'creationdisposition',\n'flagsandattributes'\n\n\nwinapi.CreateJunction         'srcpath', 'dstpath'\n\n\nwinapi.CreateNamedPipe        'name', 'openmode', 'pipemode'\n\n\nwinapi.CreatePipe\n\nwinapi.CreateProcess          'applicationname', 'commandline',\n'currentdirectory'\n\n\nwinapi.OpenProcess            'processid', 'desiredaccess'\n\n\nwinapi.TerminateProcess       'handle', 'exitcode'\n\n\nctypes.PyObjFromPtr           'obj'\n\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0578/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: bdb -- Debugger framework,  Next: faulthandler -- Dump the Python traceback,  Prev: Audit events table,  Up: Debugging and Profiling": {
            "content": "'Source code:' Lib/bdb.py(1)\n\n\n\nThe *note bdb: d. module handles basic debugger functions, like setting\nbreakpoints or managing execution via the debugger.\n\nThe following exception is defined:\n\n-- Exception: bdb.BdbQuit\n\nException raised by the *note Bdb: 1177. class for quitting the\ndebugger.\n\nThe *note bdb: d. module also defines two classes:\n\n-- Class: bdb.Breakpoint (self, file, line, temporary=False, cond=None,\nfuncname=None)\n\nThis class implements temporary breakpoints, ignore counts,\ndisabling and (re-)enabling, and conditionals.\n\nBreakpoints are indexed by number through a list called *note\nbpbynumber: 3e95. and by '(file, line)' pairs through *note bplist:\n3e96.  The former points to a single instance of class *note\nBreakpoint: 3e94.  The latter points to a list of such instances\nsince there may be more than one breakpoint per line.\n\nWhen creating a breakpoint, its associated *note file name: 3e97.\nshould be in canonical form.  If a *note funcname: 3e98. is\ndefined, a breakpoint *note hit: 3e99. will be counted when the\nfirst line of that function is executed.  A *note conditional:\n3e9a. breakpoint always counts a *note hit: 3e99.\n\n*note Breakpoint: 3e94. instances have the following methods:\n\n-- Method: deleteMe ()\n\nDelete the breakpoint from the list associated to a file/line.\nIf it is the last breakpoint in that position, it also deletes\nthe entry for the file/line.\n\n-- Method: enable ()\n\nMark the breakpoint as enabled.\n\n-- Method: disable ()\n\nMark the breakpoint as disabled.\n\n-- Method: bpformat ()\n\nReturn a string with all the information about the breakpoint,\nnicely formatted:\n\n* Breakpoint number.\n\n* Temporary status (del or keep).\n\n* File/line position.\n\n* Break condition.\n\n* Number of times to ignore.\n\n* Number of times hit.\n\nNew in version 3.2.\n\n-- Method: bpprint (out=None)\n\nPrint the output of *note bpformat(): 3e9e. to the file 'out',\nor if it is 'None', to standard output.\n\n*note Breakpoint: 3e94. instances have the following attributes:\n\n-- Attribute: file\n\nFile name of the *note Breakpoint: 3e94.\n\n-- Attribute: line\n\nLine number of the *note Breakpoint: 3e94. within *note file:\n3e97.\n\n-- Attribute: temporary\n\nTrue if a *note Breakpoint: 3e94. at (file, line) is\ntemporary.\n\n-- Attribute: cond\n\nCondition for evaluating a *note Breakpoint: 3e94. at (file,\nline).\n\n-- Attribute: funcname\n\nFunction name that defines whether a *note Breakpoint: 3e94.\nis hit upon entering the function.\n\n-- Attribute: enabled\n\nTrue if *note Breakpoint: 3e94. is enabled.\n\n-- Attribute: bpbynumber\n\nNumeric index for a single instance of a *note Breakpoint:\n3e94.\n\n-- Attribute: bplist\n\nDictionary of *note Breakpoint: 3e94. instances indexed by\n(*note file: 3e97, *note line: 3ea0.) tuples.\n\n-- Attribute: ignore\n\nNumber of times to ignore a *note Breakpoint: 3e94.\n\n-- Attribute: hits\n\nCount of the number of times a *note Breakpoint: 3e94. has\nbeen hit.\n\n-- Class: bdb.Bdb (skip=None)\n\nThe *note Bdb: 1177. class acts as a generic Python debugger base\nclass.\n\nThis class takes care of the details of the trace facility; a\nderived class should implement user interaction.  The standard\ndebugger class (*note pdb.Pdb: 740.) is an example.\n\nThe 'skip' argument, if given, must be an iterable of glob-style\nmodule name patterns.  The debugger will not step into frames that\noriginate in a module that matches one of these patterns.  Whether\na frame is considered to originate in a certain module is\ndetermined by the 'name' in the frame globals.\n\nChanged in version 3.1: Added the 'skip' parameter.\n\nThe following methods of *note Bdb: 1177. normally don't need to be\noverridden.\n\n-- Method: canonic (filename)\n\nReturn canonical form of 'filename'.\n\nFor real file names, the canonical form is an\noperating-system-dependent, *note case-normalized: 24ce. *note\nabsolute path: 1192.  A 'filename' with angle brackets, such\nas '\"<stdin>\"' generated in interactive mode, is returned\nunchanged.\n\n-- Method: reset ()\n\nSet the 'botframe', 'stopframe', 'returnframe' and *note\nquitting: 3ea6. attributes with values ready to start\ndebugging.\n\n-- Method: tracedispatch (frame, event, arg)\n\nThis function is installed as the trace function of debugged\nframes.  Its return value is the new trace function (in most\ncases, that is, itself).\n\nThe default implementation decides how to dispatch a frame,\ndepending on the type of event (passed as a string) that is\nabout to be executed.  'event' can be one of the following:\n\n* '\"line\"': A new line of code is going to be executed.\n\n* '\"call\"': A function is about to be called, or another\ncode block entered.\n\n* '\"return\"': A function or other code block is about to\nreturn.\n\n* '\"exception\"': An exception has occurred.\n\n* '\"ccall\"': A C function is about to be called.\n\n* '\"creturn\"': A C function has returned.\n\n* '\"cexception\"': A C function has raised an exception.\n\nFor the Python events, specialized functions (see below) are\ncalled.  For the C events, no action is taken.\n\nThe 'arg' parameter depends on the previous event.\n\nSee the documentation for *note sys.settrace(): 135a. for more\ninformation on the trace function.  For more information on\ncode and frame objects, refer to *note The standard type\nhierarchy: 1c05.\n\n-- Method: dispatchline (frame)\n\nIf the debugger should stop on the current line, invoke the\n*note userline(): 3ea9. method (which should be overridden in\nsubclasses).  Raise a *note BdbQuit: 3e93. exception if the\n*note quitting: 3ea6. flag is set (which can be set from *note\nuserline(): 3ea9.).  Return a reference to the *note\ntracedispatch(): 3ea7. method for further tracing in that\nscope.\n\n-- Method: dispatchcall (frame, arg)\n\nIf the debugger should stop on this function call, invoke the\n*note usercall(): 3eab. method (which should be overridden in\nsubclasses).  Raise a *note BdbQuit: 3e93. exception if the\n*note quitting: 3ea6. flag is set (which can be set from *note\nusercall(): 3eab.).  Return a reference to the *note\ntracedispatch(): 3ea7. method for further tracing in that\nscope.\n\n-- Method: dispatchreturn (frame, arg)\n\nIf the debugger should stop on this function return, invoke\nthe *note userreturn(): 3ead. method (which should be\noverridden in subclasses).  Raise a *note BdbQuit: 3e93.\nexception if the *note quitting: 3ea6. flag is set (which can\nbe set from *note userreturn(): 3ead.).  Return a reference\nto the *note tracedispatch(): 3ea7. method for further\ntracing in that scope.\n\n-- Method: dispatchexception (frame, arg)\n\nIf the debugger should stop at this exception, invokes the\n*note userexception(): 3eaf. method (which should be\noverridden in subclasses).  Raise a *note BdbQuit: 3e93.\nexception if the *note quitting: 3ea6. flag is set (which can\nbe set from *note userexception(): 3eaf.).  Return a\nreference to the *note tracedispatch(): 3ea7. method for\nfurther tracing in that scope.\n\nNormally derived classes don't override the following methods, but\nthey may if they want to redefine the definition of stopping and\nbreakpoints.\n\n-- Method: isskippedline (modulename)\n\nReturn True if 'modulename' matches any skip pattern.\n\n-- Method: stophere (frame)\n\nReturn True if 'frame' is below the starting frame in the\nstack.\n\n-- Method: breakhere (frame)\n\nReturn True if there is an effective breakpoint for this line.\n\nCheck whether a line or function breakpoint exists and is in\neffect.  Delete temporary breakpoints based on information\nfrom *note effective(): 3eb3.\n\n-- Method: breakanywhere (frame)\n\nReturn True if any breakpoint exists for 'frame''s filename.\n\nDerived classes should override these methods to gain control over\ndebugger operation.\n\n-- Method: usercall (frame, argumentlist)\n\nCalled from *note dispatchcall(): 3eaa. if a break might stop\ninside the called function.\n\n-- Method: userline (frame)\n\nCalled from *note dispatchline(): 3ea8. when either *note\nstophere(): 3eb1. or *note breakhere(): 3eb2. returns\n'True'.\n\n-- Method: userreturn (frame, returnvalue)\n\nCalled from *note dispatchreturn(): 3eac. when *note\nstophere(): 3eb1. returns 'True'.\n\n-- Method: userexception (frame, excinfo)\n\nCalled from *note dispatchexception(): 3eae. when *note\nstophere(): 3eb1. returns 'True'.\n\n-- Method: doclear (arg)\n\nHandle how a breakpoint must be removed when it is a temporary\none.\n\nThis method must be implemented by derived classes.\n\nDerived classes and clients can call the following methods to\naffect the stepping state.\n\n-- Method: setstep ()\n\nStop after one line of code.\n\n-- Method: setnext (frame)\n\nStop on the next line in or below the given frame.\n\n-- Method: setreturn (frame)\n\nStop when returning from the given frame.\n\n-- Method: setuntil (frame, lineno=None)\n\nStop when the line with the 'lineno' greater than the current\none is reached or when returning from current frame.\n\n-- Method: settrace ([frame])\n\nStart debugging from 'frame'.  If 'frame' is not specified,\ndebugging starts from caller's frame.\n\n-- Method: setcontinue ()\n\nStop only at breakpoints or when finished.  If there are no\nbreakpoints, set the system trace function to 'None'.\n\n-- Method: setquit ()\n\nSet the 'quitting' attribute to 'True'.  This raises *note\nBdbQuit: 3e93. in the next call to one of the 'dispatch*()'\nmethods.\n\nDerived classes and clients can call the following methods to\nmanipulate breakpoints.  These methods return a string containing\nan error message if something went wrong, or 'None' if all is well.\n\n-- Method: setbreak (filename, lineno, temporary=False,\ncond=None, funcname=None)\n\nSet a new breakpoint.  If the 'lineno' line doesn't exist for\nthe 'filename' passed as argument, return an error message.\nThe 'filename' should be in canonical form, as described in\nthe *note canonic(): 3ea4. method.\n\n-- Method: clearbreak (filename, lineno)\n\nDelete the breakpoints in 'filename' and 'lineno'.  If none\nwere set, return an error message.\n\n-- Method: clearbpbynumber (arg)\n\nDelete the breakpoint which has the index 'arg' in the *note\nBreakpoint.bpbynumber: 3e95.  If 'arg' is not numeric or out\nof range, return an error message.\n\n-- Method: clearallfilebreaks (filename)\n\nDelete all breakpoints in 'filename'.  If none were set,\nreturn an error message.\n\n-- Method: clearallbreaks ()\n\nDelete all existing breakpoints.  If none were set, return an\nerror message.\n\n-- Method: getbpbynumber (arg)\n\nReturn a breakpoint specified by the given number.  If 'arg'\nis a string, it will be converted to a number.  If 'arg' is a\nnon-numeric string, if the given breakpoint never existed or\nhas been deleted, a *note ValueError: 183. is raised.\n\nNew in version 3.2.\n\n-- Method: getbreak (filename, lineno)\n\nReturn True if there is a breakpoint for 'lineno' in\n'filename'.\n\n-- Method: getbreaks (filename, lineno)\n\nReturn all breakpoints for 'lineno' in 'filename', or an empty\nlist if none are set.\n\n-- Method: getfilebreaks (filename)\n\nReturn all breakpoints in 'filename', or an empty list if none\nare set.\n\n-- Method: getallbreaks ()\n\nReturn all breakpoints that are set.\n\nDerived classes and clients can call the following methods to get a\ndata structure representing a stack trace.\n\n-- Method: getstack (f, t)\n\nReturn a list of (frame, lineno) tuples in a stack trace, and\na size.\n\nThe most recently called frame is last in the list.  The size\nis the number of frames below the frame where the debugger was\ninvoked.\n\n-- Method: formatstackentry (framelineno, lprefix=': ')\n\nReturn a string with information about a stack entry, which is\na '(frame, lineno)' tuple.  The return string contains:\n\n* The canonical filename which contains the frame.\n\n* The function name or '\"<lambda>\"'.\n\n* The input arguments.\n\n* The return value.\n\n* The line of code (if it exists).\n\nThe following two methods can be called by clients to use a\ndebugger to debug a *note statement: 247d, given as a string.\n\n-- Method: run (cmd, globals=None, locals=None)\n\nDebug a statement executed via the *note exec(): 691.\nfunction.  'globals' defaults to 'main.dict', 'locals'\ndefaults to 'globals'.\n\n-- Method: runeval (expr, globals=None, locals=None)\n\nDebug an expression executed via the *note eval(): 690.\nfunction.  'globals' and 'locals' have the same meaning as in\n*note run(): 3ec8.\n\n-- Method: runctx (cmd, globals, locals)\n\nFor backwards compatibility.  Calls the *note run(): 3ec8.\nmethod.\n\n-- Method: runcall (func, /, *args, kwds)\n\nDebug a single function call, and return its result.\n\nFinally, the module defines the following functions:\n\n-- Function: bdb.checkfuncname (b, frame)\n\nReturn True if we should break here, depending on the way the *note\nBreakpoint: 3e94. 'b' was set.\n\nIf it was set via line number, it checks if *note b.line: 3ea0. is\nthe same as the one in 'frame'.  If the breakpoint was set via\n*note function name: 3e98, we have to check we are in the right\n'frame' (the right function) and if we are on its first executable\nline.\n\n-- Function: bdb.effective (file, line, frame)\n\nReturn '(active breakpoint, delete temporary flag)' or '(None,\nNone)' as the breakpoint to act upon.\n\nThe 'active breakpoint' is the first entry in *note bplist: 3e96.\nfor the (*note file: 3e97, *note line: 3ea0.) (which must exist)\nthat is *note enabled: 3ea2, for which *note checkfuncname(): 3ecb.\nis True, and that has neither a False *note condition: 3e9a. nor\npositive *note ignore: 3ea3. count.  The 'flag', meaning that a\ntemporary breakpoint should be deleted, is False only when the\n*note cond: 3e9a. cannot be evaluated (in which case, *note ignore:\n3ea3. count is ignored).\n\nIf no such entry exists, then (None, None) is returned.\n\n-- Function: bdb.settrace ()\n\nStart debugging with a *note Bdb: 1177. instance from caller's\nframe.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/bdb.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: faulthandler -- Dump the Python traceback,  Next: pdb -- The Python Debugger,  Prev: bdb -- Debugger framework,  Up: Debugging and Profiling": {
            "content": "New in version 3.3.\n\n\n",
            "subsections": []
        },
        "This module contains functions to dump Python tracebacks explicitly, on": {
            "content": "a fault, after a timeout, or on a user signal.  Call *note\nfaulthandler.enable(): aed. to install fault handlers for the 'SIGSEGV',\n'SIGFPE', 'SIGABRT', 'SIGBUS', and 'SIGILL' signals.  You can also\nenable them at startup by setting the *note PYTHONFAULTHANDLER: ef7.\nenvironment variable or by using the *note -X: 188. 'faulthandler'\ncommand line option.\n",
            "subsections": []
        },
        "The fault handler is compatible with system fault handlers like Apport": {
            "content": "or the Windows fault handler.  The module uses an alternative stack for\nsignal handlers if the 'sigaltstack()' function is available.  This\nallows it to dump the traceback even on a stack overflow.\n",
            "subsections": []
        },
        "The fault handler is called on catastrophic cases and therefore can only": {
            "content": "use signal-safe functions (e.g.  it cannot allocate memory on the heap).",
            "subsections": []
        },
        "Because of this limitation traceback dumping is minimal compared to": {
            "content": "normal Python tracebacks:\n\n* Only ASCII is supported.  The 'backslashreplace' error handler is\nused on encoding.\n\n* Each string is limited to 500 characters.\n\n* Only the filename, the function name and the line number are\ndisplayed.  (no source code)\n\n* It is limited to 100 frames and 100 threads.\n\n* The order is reversed: the most recent call is shown first.\n\nBy default, the Python traceback is written to *note sys.stderr: 757.",
            "subsections": []
        },
        "To see tracebacks, applications must be run in the terminal.  A log file": {
            "content": "can alternatively be passed to *note faulthandler.enable(): aed.\n",
            "subsections": []
        },
        "The module is implemented in C, so tracebacks can be dumped on a crash": {
            "content": "or when Python is deadlocked.\n\nThe *note Python Development Mode: 6e3. calls *note\nfaulthandler.enable(): aed. at Python startup.\n\nSee also\n........\n\nModule *note pdb: a0.\n\nInteractive source code debugger for Python programs.\n\nModule *note traceback: f9.\n\nStandard interface to extract, format and print stack traces of\nPython programs.\n\n* Menu:\n\n* Dumping the traceback::\n* Fault handler state::\n* Dumping the tracebacks after a timeout::\n* Dumping the traceback on a user signal::\n* Issue with file descriptors::\n* Example: Example<14>.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Dumping the traceback,  Next: Fault handler state,  Up: faulthandler -- Dump the Python traceback": {
            "content": "5.27.3.1 Dumping the traceback\n..............................\n\n-- Function: faulthandler.dumptraceback (file=sys.stderr,\nallthreads=True)\n\nDump the tracebacks of all threads into 'file'.  If 'allthreads'\nis 'False', dump only the current thread.\n\nSee also\n........\n\n*note traceback.printtb(): cea, which can be used to print a\ntraceback object.\n\nChanged in version 3.5: Added support for passing file descriptor\nto this function.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Fault handler state,  Next: Dumping the tracebacks after a timeout,  Prev: Dumping the traceback,  Up: faulthandler -- Dump the Python traceback": {
            "content": "5.27.3.2 Fault handler state\n............................\n\n-- Function: faulthandler.enable (file=sys.stderr, allthreads=True)\n\nEnable the fault handler: install handlers for the 'SIGSEGV',\n'SIGFPE', 'SIGABRT', 'SIGBUS' and 'SIGILL' signals to dump the\nPython traceback.  If 'allthreads' is 'True', produce tracebacks\nfor every running thread.  Otherwise, dump only the current thread.\n\nThe 'file' must be kept open until the fault handler is disabled:\nsee *note issue with file descriptors: 3ed1.\n\nChanged in version 3.5: Added support for passing file descriptor\nto this function.\n\nChanged in version 3.6: On Windows, a handler for Windows exception\nis also installed.\n\nChanged in version 3.10: The dump now mentions if a garbage\ncollector collection is running if 'allthreads' is true.\n\n-- Function: faulthandler.disable ()\n\nDisable the fault handler: uninstall the signal handlers installed\nby *note enable(): aed.\n\n-- Function: faulthandler.isenabled ()\n\nCheck if the fault handler is enabled.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "5.27.3.3 Dumping the tracebacks after a timeout\n...............................................\n\n-- Function: faulthandler.dumptracebacklater (timeout, repeat=False,\nfile=sys.stderr, exit=False)\n\nDump the tracebacks of all threads, after a timeout of 'timeout'\nseconds, or every 'timeout' seconds if 'repeat' is 'True'.  If\n'exit' is 'True', call 'exit()' with status=1 after dumping the\ntracebacks.  (Note 'exit()' exits the process immediately, which\nmeans it doesn't do any cleanup like flushing file buffers.)  If\nthe function is called twice, the new call replaces previous\nparameters and resets the timeout.  The timer has a sub-second\nresolution.\n\nThe 'file' must be kept open until the traceback is dumped or *note\ncanceldumptracebacklater(): 3ed5. is called: see *note issue\nwith file descriptors: 3ed1.\n\nThis function is implemented using a watchdog thread.\n\nChanged in version 3.5: Added support for passing file descriptor\nto this function.\n\nChanged in version 3.7: This function is now always available.\n\n-- Function: faulthandler.canceldumptracebacklater ()\n\nCancel the last call to *note dumptracebacklater(): c5c.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "5.27.3.4 Dumping the traceback on a user signal\n...............................................\n\n-- Function: faulthandler.register (signum, file=sys.stderr,\nallthreads=True, chain=False)\n\nRegister a user signal: install a handler for the 'signum' signal\nto dump the traceback of all threads, or of the current thread if\n'allthreads' is 'False', into 'file'.  Call the previous handler\nif chain is 'True'.\n\nThe 'file' must be kept open until the signal is unregistered by\n*note unregister(): 3ed7.: see *note issue with file descriptors:\n3ed1.\n\nNot available on Windows.\n\nChanged in version 3.5: Added support for passing file descriptor\nto this function.\n\n-- Function: faulthandler.unregister (signum)\n\nUnregister a user signal: uninstall the handler of the 'signum'\nsignal installed by *note register(): c5a.  Return 'True' if the\nsignal was registered, 'False' otherwise.\n\nNot available on Windows.\n\nFile: python3.12.info,  Node: Issue with file descriptors,  Next: Example<14>,  Prev: Dumping the traceback on a user signal,  Up: faulthandler -- Dump the Python traceback\n\n5.27.3.5 Issue with file descriptors\n....................................\n\n*note enable(): aed, *note dumptracebacklater(): c5c. and *note\nregister(): c5a. keep the file descriptor of their 'file' argument.  If\nthe file is closed and its file descriptor is reused by a new file, or\nif *note os.dup2(): 9a2. is used to replace the file descriptor, the\ntraceback will be written into a different file.  Call these functions\nagain each time that the file is replaced.\n\nFile: python3.12.info,  Node: Example<14>,  Prev: Issue with file descriptors,  Up: faulthandler -- Dump the Python traceback\n\n5.27.3.6 Example\n................\n",
            "subsections": []
        },
        "Example of a segmentation fault on Linux with and without enabling the": {
            "content": "fault handler:\n\n$ python -c \"import ctypes; ctypes.stringat(0)\"\nSegmentation fault\n\n$ python -q -X faulthandler\n>>> import ctypes\n>>> ctypes.stringat(0)\nFatal Python error: Segmentation fault\n\nCurrent thread 0x00007fb899f39700 (most recent call first):\nFile \"/home/python/cpython/Lib/ctypes/init.py\", line 486 in stringat\nFile \"<stdin>\", line 1 in <module>\nSegmentation fault\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: pdb -- The Python Debugger,  Next: The Python Profilers,  Prev: faulthandler -- Dump the Python traceback,  Up: Debugging and Profiling": {
            "content": "'Source code:' Lib/pdb.py(1)\n\n\n\nThe module *note pdb: a0. defines an interactive source code debugger\nfor Python programs.  It supports setting (conditional) breakpoints and\nsingle stepping at the source line level, inspection of stack frames,\nsource code listing, and evaluation of arbitrary Python code in the\ncontext of any stack frame.  It also supports post-mortem debugging and\ncan be called under program control.\n\nThe debugger is extensible - it is actually defined as the class *note",
            "subsections": []
        },
        "Pdb: 740.  This is currently undocumented but easily understood by": {
            "content": "reading the source.  The extension interface uses the modules *note bdb:\nd. and *note cmd: 17.\n\nSee also\n........\n\nModule *note faulthandler: 53.\n\nUsed to dump Python tracebacks explicitly, on a fault, after a\ntimeout, or on a user signal.\n\nModule *note traceback: f9.\n\nStandard interface to extract, format and print stack traces of\nPython programs.\n\nThe typical usage to break into the debugger is to insert:\n\nimport pdb; pdb.settrace()\n\nOr:\n\nbreakpoint()\n\nat the location you want to break into the debugger, and then run the\nprogram.  You can then step through the code following this statement,\nand continue running without the debugger using the *note continue:\n3edd. command.\n\nChanged in version 3.7: The built-in *note breakpoint(): 8f9, when\ncalled with defaults, can be used instead of 'import pdb;\npdb.settrace()'.\n\ndef double(x):\nbreakpoint()\nreturn x * 2\nval = 3\nprint(f\"{val} * 2 is {double(val)}\")\n",
            "subsections": []
        },
        "The debugger's prompt is '(Pdb)', which is the indicator that you are in": {
            "content": "debug mode:\n\n> ...(3)double()\n-> return x * 2\n(Pdb) p x\n3\n(Pdb) continue\n3 * 2 is 6\n\nChanged in version 3.3: Tab-completion via the *note readline: b5.\nmodule is available for commands and command arguments, e.g.  the\ncurrent global and local names are offered as arguments of the 'p'\ncommand.\n\nYou can also invoke *note pdb: a0. from the command line to debug other\nscripts.  For example:\n\npython -m pdb myscript.py\n",
            "subsections": []
        },
        "When invoked as a module, pdb will automatically enter post-mortem": {
            "content": "debugging if the program being debugged exits abnormally.  After\npost-mortem debugging (or after normal exit of the program), pdb will\nrestart the program.  Automatic restarting preserves pdb's state (such\nas breakpoints) and in most cases is more useful than quitting the\ndebugger upon program's exit.\n",
            "subsections": []
        },
        "Changed in version 3.2: Added the '-c' option to execute commands as if": {
            "content": "given in a '.pdbrc' file; see *note Debugger Commands: 3ede.\n",
            "subsections": []
        },
        "Changed in version 3.7: Added the '-m' option to execute modules similar": {
            "content": "to the way 'python -m' does.  As with a script, the debugger will pause\nexecution just before the first line of the module.\n\nTypical usage to execute a statement under control of the debugger is:\n\n>>> import pdb\n>>> def f(x):\n...     print(1 / x)\n>>> pdb.run(\"f(2)\")\n> <string>(1)<module>()\n(Pdb) continue\n0.5\n>>>\n\nThe typical usage to inspect a crashed program is:\n\n>>> import pdb\n>>> def f(x):\n...     print(1 / x)\n...\n>>> f(0)\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nFile \"<stdin>\", line 2, in f\nZeroDivisionError: division by zero\n>>> pdb.pm()\n> <stdin>(2)f()\n(Pdb) p x\n0\n(Pdb)\n",
            "subsections": []
        },
        "The module defines the following functions; each enters the debugger in": {
            "content": "a slightly different way:\n\n-- Function: pdb.run (statement, globals=None, locals=None)\n\nExecute the 'statement' (given as a string or a code object) under\ndebugger control.  The debugger prompt appears before any code is\nexecuted; you can set breakpoints and type *note continue: 3edd, or\nyou can step through the statement using *note step: 3edf. or *note\nnext: 3ee0. (all these commands are explained below).  The optional\n'globals' and 'locals' arguments specify the environment in which\nthe code is executed; by default the dictionary of the module *note\nmain: 1. is used.  (See the explanation of the built-in *note\nexec(): 691. or *note eval(): 690. functions.)\n\n-- Function: pdb.runeval (expression, globals=None, locals=None)\n\nEvaluate the 'expression' (given as a string or a code object)\nunder debugger control.  When *note runeval(): 3ee1. returns, it\nreturns the value of the 'expression'.  Otherwise this function is\nsimilar to *note run(): 3cb2.\n\n-- Function: pdb.runcall (function, *args, kwds)\n\nCall the 'function' (a function or method object, not a string)\nwith the given arguments.  When *note runcall(): 3ee2. returns, it\nreturns whatever the function call returned.  The debugger prompt\nappears as soon as the function is entered.\n\n-- Function: pdb.settrace (*, header=None)\n\nEnter the debugger at the calling stack frame.  This is useful to\nhard-code a breakpoint at a given point in a program, even if the\ncode is not otherwise being debugged (e.g.  when an assertion\nfails).  If given, 'header' is printed to the console just before\ndebugging begins.\n\nChanged in version 3.7: The keyword-only argument 'header'.\n\n-- Function: pdb.postmortem (traceback=None)\n\nEnter post-mortem debugging of the given 'traceback' object.  If no\n'traceback' is given, it uses the one of the exception that is\ncurrently being handled (an exception must be being handled if the\ndefault is to be used).\n\n-- Function: pdb.pm ()\n\nEnter post-mortem debugging of the traceback found in *note\nsys.lasttraceback: 1e5.\n\nThe 'run*' functions and *note settrace(): 9a6. are aliases for\ninstantiating the *note Pdb: 740. class and calling the method of the\nsame name.  If you want to access further features, you have to do this\nyourself:\n\n-- Class: pdb.Pdb (completekey='tab', stdin=None, stdout=None,\nskip=None, nosigint=False, readrc=True)\n\n*note Pdb: 740. is the debugger class.\n\nThe 'completekey', 'stdin' and 'stdout' arguments are passed to the\nunderlying *note cmd.Cmd: 3a47. class; see the description there.\n\nThe 'skip' argument, if given, must be an iterable of glob-style\nmodule name patterns.  The debugger will not step into frames that\noriginate in a module that matches one of these patterns.  (2)\n\nBy default, Pdb sets a handler for the SIGINT signal (which is sent\nwhen the user presses 'Ctrl-C' on the console) when you give a\n*note continue: 3edd. command.  This allows you to break into the\ndebugger again by pressing 'Ctrl-C'.  If you want Pdb not to touch\nthe SIGINT handler, set 'nosigint' to true.\n\nThe 'readrc' argument defaults to true and controls whether Pdb\nwill load .pdbrc files from the filesystem.\n\nExample call to enable tracing with 'skip':\n\nimport pdb; pdb.Pdb(skip=['django.*']).settrace()\n\nRaises an *note auditing event: 161d. 'pdb.Pdb' with no arguments.\n\nChanged in version 3.1: Added the 'skip' parameter.\n\nChanged in version 3.2: Added the 'nosigint' parameter.\nPreviously, a SIGINT handler was never set by Pdb.\n\nChanged in version 3.6: The 'readrc' argument.\n\n-- Method: run (statement, globals=None, locals=None)\n-- Method: runeval (expression, globals=None, locals=None)\n-- Method: runcall (function, *args, kwds)\n-- Method: settrace ()\n\nSee the documentation for the functions explained above.\n\n* Menu:\n\n* Debugger Commands::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/pdb.py\n\n(2) Whether a frame is considered to originate in a certain module is\ndetermined by the 'name' in the frame globals.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Debugger Commands,  Up: pdb -- The Python Debugger": {
            "content": "5.27.4.1 Debugger Commands\n..........................\n",
            "subsections": []
        },
        "The commands recognized by the debugger are listed below.  Most commands": {
            "content": "can be abbreviated to one or two letters as indicated; e.g.  'h(elp)'\nmeans that either 'h' or 'help' can be used to enter the help command\n(but not 'he' or 'hel', nor 'H' or 'Help' or 'HELP').  Arguments to\ncommands must be separated by whitespace (spaces or tabs).  Optional\narguments are enclosed in square brackets ('[]') in the command syntax;\nthe square brackets must not be typed.  Alternatives in the command\nsyntax are separated by a vertical bar ('|').\n",
            "subsections": []
        },
        "Entering a blank line repeats the last command entered.  Exception: if": {
            "content": "the last command was a *note list: 3ee9. command, the next 11 lines are\nlisted.\n",
            "subsections": []
        },
        "Commands that the debugger doesn't recognize are assumed to be Python": {
            "content": "statements and are executed in the context of the program being\ndebugged.  Python statements can also be prefixed with an exclamation\npoint ('!').  This is a powerful way to inspect the program being\ndebugged; it is even possible to change a variable or call a function.",
            "subsections": []
        },
        "When an exception occurs in such a statement, the exception name is": {
            "content": "printed but the debugger's state is not changed.\n\nThe debugger supports *note aliases: 3eea.  Aliases can have parameters\nwhich allows one a certain level of adaptability to the context under\nexamination.\n\nMultiple commands may be entered on a single line, separated by ';;'.\n(A single ';' is not used as it is the separator for multiple commands\nin a line that is passed to the Python parser.)  No intelligence is\napplied to separating the commands; the input is split at the first ';;'\npair, even if it is in the middle of a quoted string.  A workaround for\nstrings with double semicolons is to use implicit string concatenation\n'';'';'' or '\";\"\";\"'.\n",
            "subsections": []
        },
        "To set a temporary global variable, use a 'convenience variable'.  A": {
            "content": "'convenience variable' is a variable whose name starts with '$'.  For\nexample, '$foo = 1' sets a global variable '$foo' which you can use in\nthe debugger session.  The 'convenience variables' are cleared when the\nprogram resumes execution so it's less likely to interfere with your\nprogram compared to using normal variables like 'foo = 1'.\n\nThere are three preset 'convenience variables':\n\n* '$frame': the current frame you are debugging\n\n* '$retval': the return value if the frame is returning\n\n* '$exception': the exception if the frame is raising an exception\n\nNew in version 3.12.\n",
            "subsections": []
        },
        "If a file '.pdbrc' exists in the user's home directory or in the current": {
            "content": "directory, it is read with ''utf-8'' encoding and executed as if it had\nbeen typed at the debugger prompt, with the exception that empty lines\nand lines starting with '#' are ignored.  This is particularly useful\nfor aliases.  If both files exist, the one in the home directory is read\nfirst and aliases defined there can be overridden by the local file.\n",
            "subsections": []
        },
        "Changed in version 3.2: '.pdbrc' can now contain commands that continue": {
            "content": "debugging, such as *note continue: 3edd. or *note next: 3ee0.\nPreviously, these commands had no effect.\n\nChanged in version 3.11: '.pdbrc' is now read with ''utf-8'' encoding.\nPreviously, it was read with the system locale encoding.\n\n-- Pdbcommand: h(elp) [command]\n\nWithout argument, print the list of available commands.  With a\n'command' as argument, print help about that command.  'help pdb'\ndisplays the full documentation (the docstring of the *note pdb:\na0. module).  Since the 'command' argument must be an identifier,\n'help exec' must be entered to get help on the '!' command.\n\n-- Pdbcommand: w(here)\n\nPrint a stack trace, with the most recent frame at the bottom.  An\narrow ('>') indicates the current frame, which determines the\ncontext of most commands.\n\n-- Pdbcommand: d(own) [count]\n\nMove the current frame 'count' (default one) levels down in the\nstack trace (to a newer frame).\n\n-- Pdbcommand: u(p) [count]\n\nMove the current frame 'count' (default one) levels up in the stack\ntrace (to an older frame).\n\n-- Pdbcommand: b(reak) [([filename:]lineno | function) [, condition]]\n\nWith a 'lineno' argument, set a break there in the current file.\nWith a 'function' argument, set a break at the first executable\nstatement within that function.  The line number may be prefixed\nwith a filename and a colon, to specify a breakpoint in another\nfile (probably one that hasn't been loaded yet).  The file is\nsearched on *note sys.path: 32c.  Note that each breakpoint is\nassigned a number to which all the other breakpoint commands refer.\n\nIf a second argument is present, it is an expression which must\nevaluate to true before the breakpoint is honored.\n\nWithout argument, list all breaks, including for each breakpoint,\nthe number of times that breakpoint has been hit, the current\nignore count, and the associated condition if any.\n\n-- Pdbcommand: tbreak [([filename:]lineno | function) [, condition]]\n\nTemporary breakpoint, which is removed automatically when it is\nfirst hit.  The arguments are the same as for *note break: 3eef.\n\n-- Pdbcommand: cl(ear) [filename:lineno | bpnumber ...]\n\nWith a 'filename:lineno' argument, clear all the breakpoints at\nthis line.  With a space separated list of breakpoint numbers,\nclear those breakpoints.  Without argument, clear all breaks (but\nfirst ask confirmation).\n\n-- Pdbcommand: disable bpnumber [bpnumber ...]\n\nDisable the breakpoints given as a space separated list of\nbreakpoint numbers.  Disabling a breakpoint means it cannot cause\nthe program to stop execution, but unlike clearing a breakpoint, it\nremains in the list of breakpoints and can be (re-)enabled.\n\n-- Pdbcommand: enable bpnumber [bpnumber ...]\n\nEnable the breakpoints specified.\n\n-- Pdbcommand: ignore bpnumber [count]\n\nSet the ignore count for the given breakpoint number.  If 'count'\nis omitted, the ignore count is set to 0.  A breakpoint becomes\nactive when the ignore count is zero.  When non-zero, the 'count'\nis decremented each time the breakpoint is reached and the\nbreakpoint is not disabled and any associated condition evaluates\nto true.\n\n-- Pdbcommand: condition bpnumber [condition]\n\nSet a new 'condition' for the breakpoint, an expression which must\nevaluate to true before the breakpoint is honored.  If 'condition'\nis absent, any existing condition is removed; i.e., the breakpoint\nis made unconditional.\n\n-- Pdbcommand: commands [bpnumber]\n\nSpecify a list of commands for breakpoint number 'bpnumber'.  The\ncommands themselves appear on the following lines.  Type a line\ncontaining just 'end' to terminate the commands.  An example:\n\n(Pdb) commands 1\n(com) p somevariable\n(com) end\n(Pdb)\n\nTo remove all commands from a breakpoint, type 'commands' and\nfollow it immediately with 'end'; that is, give no commands.\n\nWith no 'bpnumber' argument, 'commands' refers to the last\nbreakpoint set.\n\nYou can use breakpoint commands to start your program up again.\nSimply use the *note continue: 3edd. command, or *note step: 3edf,\nor any other command that resumes execution.\n\nSpecifying any command resuming execution (currently *note\ncontinue: 3edd, *note step: 3edf, *note next: 3ee0, *note return:\n3ef7, *note jump: 3ef8, *note quit: 3ef9. and their abbreviations)\nterminates the command list (as if that command was immediately\nfollowed by end).  This is because any time you resume execution\n(even with a simple next or step), you may encounter another\nbreakpoint--which could have its own command list, leading to\nambiguities about which list to execute.\n\nIf you use the 'silent' command in the command list, the usual\nmessage about stopping at a breakpoint is not printed.  This may be\ndesirable for breakpoints that are to print a specific message and\nthen continue.  If none of the other commands print anything, you\nsee no sign that the breakpoint was reached.\n\n-- Pdbcommand: s(tep)\n\nExecute the current line, stop at the first possible occasion\n(either in a function that is called or on the next line in the\ncurrent function).\n\n-- Pdbcommand: n(ext)\n\nContinue execution until the next line in the current function is\nreached or it returns.  (The difference between *note next: 3ee0.\nand *note step: 3edf. is that *note step: 3edf. stops inside a\ncalled function, while *note next: 3ee0. executes called functions\nat (nearly) full speed, only stopping at the next line in the\ncurrent function.)\n\n-- Pdbcommand: unt(il) [lineno]\n\nWithout argument, continue execution until the line with a number\ngreater than the current one is reached.\n\nWith 'lineno', continue execution until a line with a number\ngreater or equal to 'lineno' is reached.  In both cases, also stop\nwhen the current frame returns.\n\nChanged in version 3.2: Allow giving an explicit line number.\n\n-- Pdbcommand: r(eturn)\n\nContinue execution until the current function returns.\n\n-- Pdbcommand: c(ont(inue))\n\nContinue execution, only stop when a breakpoint is encountered.\n\n-- Pdbcommand: j(ump) lineno\n\nSet the next line that will be executed.  Only available in the\nbottom-most frame.  This lets you jump back and execute code again,\nor jump forward to skip code that you don't want to run.\n\nIt should be noted that not all jumps are allowed - for instance it\nis not possible to jump into the middle of a *note for: 24e. loop\nor out of a *note finally: 7ee. clause.\n\n-- Pdbcommand: l(ist) [first[, last]]\n\nList source code for the current file.  Without arguments, list 11\nlines around the current line or continue the previous listing.\nWith '.' as argument, list 11 lines around the current line.  With\none argument, list 11 lines around at that line.  With two\narguments, list the given range; if the second argument is less\nthan the first, it is interpreted as a count.\n\nThe current line in the current frame is indicated by '->'.  If an\nexception is being debugged, the line where the exception was\noriginally raised or propagated is indicated by '>>', if it differs\nfrom the current line.\n\nChanged in version 3.2: Added the '>>' marker.\n\n-- Pdbcommand: ll | longlist\n\nList all source code for the current function or frame.\nInteresting lines are marked as for *note list: 3ee9.\n\nNew in version 3.2.\n\n-- Pdbcommand: a(rgs)\n\nPrint the arguments of the current function and their current\nvalues.\n\n-- Pdbcommand: p expression\n\nEvaluate 'expression' in the current context and print its value.\n\nNote: 'print()' can also be used, but is not a debugger\ncommand -- this executes the Python *note print(): de5.\nfunction.\n\n-- Pdbcommand: pp expression\n\nLike the *note p: de6. command, except the value of 'expression' is\npretty-printed using the *note pprint: a9. module.\n\n-- Pdbcommand: whatis expression\n\nPrint the type of 'expression'.\n\n-- Pdbcommand: source expression\n\nTry to get source code of 'expression' and display it.\n\nNew in version 3.2.\n\n-- Pdbcommand: display [expression]\n\nDisplay the value of 'expression' if it changed, each time\nexecution stops in the current frame.\n\nWithout 'expression', list all display expressions for the current\nframe.\n\nNote: Display evaluates 'expression' and compares to the\nresult of the previous evaluation of 'expression', so when the\nresult is mutable, display may not be able to pick up the\nchanges.\n\nExample:\n\nlst = []\nbreakpoint()\npass\nlst.append(1)\nprint(lst)\n\nDisplay won't realize 'lst' has been changed because the result of\nevaluation is modified in place by 'lst.append(1)' before being\ncompared:\n\n> example.py(3)<module>()\n-> pass\n(Pdb) display lst\ndisplay lst: []\n(Pdb) n\n> example.py(4)<module>()\n-> lst.append(1)\n(Pdb) n\n> example.py(5)<module>()\n-> print(lst)\n(Pdb)\n\nYou can do some tricks with copy mechanism to make it work:\n\n> example.py(3)<module>()\n-> pass\n(Pdb) display lst[:]\ndisplay lst[:]: []\n(Pdb) n\n> example.py(4)<module>()\n-> lst.append(1)\n(Pdb) n\n> example.py(5)<module>()\n-> print(lst)\ndisplay lst[:]: [1]  [old: []]\n(Pdb)\n\nNew in version 3.2.\n\n-- Pdbcommand: undisplay [expression]\n\nDo not display 'expression' anymore in the current frame.  Without\n'expression', clear all display expressions for the current frame.\n\nNew in version 3.2.\n\n-- Pdbcommand: interact\n\nStart an interactive interpreter (using the *note code: 18. module)\nwhose global namespace contains all the (global and local) names\nfound in the current scope.\n\nNew in version 3.2.\n\n-- Pdbcommand: alias [name [command]]\n\nCreate an alias called 'name' that executes 'command'.  The\n'command' must 'not' be enclosed in quotes.  Replaceable parameters\ncan be indicated by '%1', '%2', and so on, while '%*' is replaced\nby all the parameters.  If 'command' is omitted, the current alias\nfor 'name' is shown.  If no arguments are given, all aliases are\nlisted.\n\nAliases may be nested and can contain anything that can be legally\ntyped at the pdb prompt.  Note that internal pdb commands 'can' be\noverridden by aliases.  Such a command is then hidden until the\nalias is removed.  Aliasing is recursively applied to the first\nword of the command line; all other words in the line are left\nalone.\n\nAs an example, here are two useful aliases (especially when placed\nin the '.pdbrc' file):\n\n# Print instance variables (usage \"pi classInst\")\nalias pi for k in %1.dict.keys(): print(f\"%1.{k} = {%1.dict[k]}\")\n# Print instance variables in self\nalias ps pi self\n\n-- Pdbcommand: unalias name\n\nDelete the specified alias 'name'.\n\n-- Pdbcommand: ! statement\n\nExecute the (one-line) 'statement' in the context of the current\nstack frame.  The exclamation point can be omitted unless the first\nword of the statement resembles a debugger command, e.g.:\n\n(Pdb) ! n=42\n(Pdb)\n\nTo set a global variable, you can prefix the assignment command\nwith a *note global: 19a3. statement on the same line, e.g.:\n\n(Pdb) global listoptions; listoptions = ['-l']\n(Pdb)\n\n-- Pdbcommand: run [args ...]\n-- Pdbcommand: restart [args ...]\n\nRestart the debugged Python program.  If 'args' is supplied, it is\nsplit with *note shlex: bf. and the result is used as the new *note\nsys.argv: 10dd.  History, breakpoints, actions and debugger options\nare preserved.  *note restart: 3f07. is an alias for *note run:\n3f06.\n\n-- Pdbcommand: q(uit)\n\nQuit from the debugger.  The program being executed is aborted.\n\n-- Pdbcommand: debug code\n\nEnter a recursive debugger that steps through 'code' (which is an\narbitrary expression or statement to be executed in the current\nenvironment).\n\n-- Pdbcommand: retval\n\nPrint the return value for the last return of the current function.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The Python Profilers,  Next: timeit -- Measure execution time of small code snippets,  Prev: pdb -- The Python Debugger,  Up: Debugging and Profiling": {
            "content": "'Source code:' Lib/profile.py(1) and Lib/pstats.py(2)\n\n\n\n* Menu:\n\n* Introduction to the profilers::\n* Instant User's Manual::\n* profile and cProfile Module Reference::\n* The Stats Class::\n* What Is Deterministic Profiling?::\n* Limitations::\n* Calibration::\n* Using a custom timer::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/profile.py\n\n(2) https://github.com/python/cpython/tree/3.12/Lib/pstats.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Introduction to the profilers,  Next: Instant User's Manual,  Up: The Python Profilers": {
            "content": "5.27.5.1 Introduction to the profilers\n......................................\n\n*note cProfile: 25. and *note profile: aa. provide 'deterministic\nprofiling' of Python programs.  A 'profile' is a set of statistics that\ndescribes how often and for how long various parts of the program\nexecuted.  These statistics can be formatted into reports via the *note\npstats: ab. module.\n",
            "subsections": []
        },
        "The Python standard library provides two different implementations of": {
            "content": "the same profiling interface:\n\n1. *note cProfile: 25. is recommended for most users; it's a C\nextension with reasonable overhead that makes it suitable for\nprofiling long-running programs.  Based on 'lsprof', contributed by\nBrett Rosen and Ted Czotter.\n\n2. *note profile: aa, a pure Python module whose interface is imitated\nby *note cProfile: 25, but which adds significant overhead to\nprofiled programs.  If you're trying to extend the profiler in some\nway, the task might be easier with this module.  Originally\ndesigned and written by Jim Roskind.\n\nNote: The profiler modules are designed to provide an execution\nprofile for a given program, not for benchmarking purposes (for\nthat, there is *note timeit: e9. for reasonably accurate results).\nThis particularly applies to benchmarking Python code against C\ncode: the profilers introduce overhead for Python code, but not for\nC-level functions, and so the C code would seem faster than any\nPython one.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Instant User's Manual,  Next: profile and cProfile Module Reference,  Prev: Introduction to the profilers,  Up: The Python Profilers": {
            "content": "5.27.5.2 Instant User's Manual\n..............................\n\nThis section is provided for users that \"don't want to read the manual.\"",
            "subsections": []
        },
        "It provides a very brief overview, and allows a user to rapidly perform": {
            "content": "profiling on an existing application.\n\nTo profile a function that takes a single argument, you can do:\n\nimport cProfile\nimport re\ncProfile.run('re.compile(\"foo|bar\")')\n\n(Use *note profile: aa. instead of *note cProfile: 25. if the latter is\nnot available on your system.)\n\nThe above action would run *note re.compile(): a17. and print profile\nresults like the following:\n\n214 function calls (207 primitive calls) in 0.002 seconds\n\nOrdered by: cumulative time\n\nncalls  tottime  percall  cumtime  percall filename:lineno(function)\n1    0.000    0.000    0.002    0.002 {built-in method builtins.exec}\n1    0.000    0.000    0.001    0.001 <string>:1(<module>)\n1    0.000    0.000    0.001    0.001 init.py:250(compile)\n1    0.000    0.000    0.001    0.001 init.py:289(compile)\n1    0.000    0.000    0.000    0.000 compiler.py:759(compile)\n1    0.000    0.000    0.000    0.000 parser.py:937(parse)\n1    0.000    0.000    0.000    0.000 compiler.py:598(code)\n1    0.000    0.000    0.000    0.000 parser.py:435(parsesub)\n",
            "subsections": []
        },
        "The first line indicates that 214 calls were monitored.  Of those calls,": {
            "content": "207 were 'primitive', meaning that the call was not induced via\nrecursion.  The next line: 'Ordered by: cumulative time' indicates the\noutput is sorted by the 'cumtime' values.  The column headings include:\n\nncalls\n\nfor the number of calls.\n\ntottime\n\nfor the total time spent in the given function (and excluding time\nmade in calls to sub-functions)\n\npercall\n\nis the quotient of 'tottime' divided by 'ncalls'\n\ncumtime\n\nis the cumulative time spent in this and all subfunctions (from\ninvocation till exit).  This figure is accurate 'even' for\nrecursive functions.\n\npercall\n\nis the quotient of 'cumtime' divided by primitive calls\n\nfilename:lineno(function)\n\nprovides the respective data of each function\n",
            "subsections": []
        },
        "When there are two numbers in the first column (for example '3/1'), it": {
            "content": "means that the function recursed.  The second value is the number of\nprimitive calls and the former is the total number of calls.  Note that\nwhen the function does not recurse, these two values are the same, and\nonly the single figure is printed.\n",
            "subsections": []
        },
        "Instead of printing the output at the end of the profile run, you can": {
            "content": "save the results to a file by specifying a filename to the 'run()'\nfunction:\n\nimport cProfile\nimport re\ncProfile.run('re.compile(\"foo|bar\")', 'restats')\n\nThe *note pstats.Stats: 3f11. class reads profile results from a file\nand formats them in various ways.  The files *note cProfile: 25. and\n*note profile: aa. can also be invoked as a script to profile another\nscript.  For example:\n\npython -m cProfile [-o outputfile] [-s sortorder] (-m module | myscript.py)\n\n'-o' writes the profile results to a file instead of to stdout\n\n'-s' specifies one of the *note sortstats(): 3f13. sort values to sort\nthe output by.  This only applies when '-o' is not supplied.\n\n'-m' specifies that a module is being profiled instead of a script.\n\nNew in version 3.7: Added the '-m' option to *note cProfile: 25.\n\nNew in version 3.8: Added the '-m' option to *note profile: aa.\n\nThe *note pstats: ab. module's *note Stats: 3f11. class has a variety of\nmethods for manipulating and printing the data saved into a profile\nresults file:\n\nimport pstats\nfrom pstats import SortKey\np = pstats.Stats('restats')\np.stripdirs().sortstats(-1).printstats()\n\nThe *note stripdirs(): 3f14. method removed the extraneous path from\nall the module names.  The *note sortstats(): 3f13. method sorted all\nthe entries according to the standard module/line/name string that is\nprinted.  The *note printstats(): 3f15. method printed out all the\nstatistics.  You might try the following sort calls:\n\np.sortstats(SortKey.NAME)\np.printstats()\n",
            "subsections": []
        },
        "The first call will actually sort the list by function name, and the": {
            "content": "second call will print out the statistics.  The following are some\ninteresting calls to experiment with:\n\np.sortstats(SortKey.CUMULATIVE).printstats(10)\n",
            "subsections": []
        },
        "This sorts the profile by cumulative time in a function, and then only": {
            "content": "prints the ten most significant lines.  If you want to understand what\nalgorithms are taking time, the above line is what you would use.\n",
            "subsections": []
        },
        "If you were looking to see what functions were looping a lot, and taking": {
            "content": "a lot of time, you would do:\n\np.sortstats(SortKey.TIME).printstats(10)\n\nto sort according to time spent within each function, and then print the\nstatistics for the top ten functions.\n\nYou might also try:\n\np.sortstats(SortKey.FILENAME).printstats('init')\n",
            "subsections": []
        },
        "This will sort all the statistics by file name, and then print out": {
            "content": "statistics for only the class init methods (since they are spelled with\n'init' in them).  As one final example, you could try:\n\np.sortstats(SortKey.TIME, SortKey.CUMULATIVE).printstats(.5, 'init')\n",
            "subsections": []
        },
        "This line sorts statistics with a primary key of time, and a secondary": {
            "content": "key of cumulative time, and then prints out some of the statistics.  To\nbe specific, the list is first culled down to 50% (re: '.5') of its\noriginal size, then only lines containing 'init' are maintained, and\nthat sub-sub-list is printed.\n",
            "subsections": []
        },
        "If you wondered what functions called the above functions, you could now": {
            "content": "('p' is still sorted according to the last criteria) do:\n\np.printcallers(.5, 'init')\n\nand you would get a list of callers for each of the listed functions.\n",
            "subsections": []
        },
        "If you want more functionality, you're going to have to read the manual,": {
            "content": "or guess what the following functions do:\n\np.printcallees()\np.add('restats')\n\nInvoked as a script, the *note pstats: ab. module is a statistics\nbrowser for reading and examining profile dumps.  It has a simple\nline-oriented interface (implemented using *note cmd: 17.) and\ninteractive help.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: profile and cProfile Module Reference,  Next: The Stats Class,  Prev: Instant User's Manual,  Up: The Python Profilers": {
            "content": "5.27.5.3 'profile' and 'cProfile' Module Reference\n..................................................\n\nBoth the *note profile: aa. and *note cProfile: 25. modules provide the\nfollowing functions:\n\n-- Function: profile.run (command, filename=None, sort=-1)\n\nThis function takes a single argument that can be passed to the\n*note exec(): 691. function, and an optional file name.  In all\ncases this routine executes:\n\nexec(command, main.dict, main.dict)\n\nand gathers profiling statistics from the execution.  If no file\nname is present, then this function automatically creates a *note\nStats: 3f11. instance and prints a simple profiling report.  If the\nsort value is specified, it is passed to this *note Stats: 3f11.\ninstance to control how the results are sorted.\n\n-- Function: profile.runctx (command, globals, locals, filename=None,\nsort=-1)\n\nThis function is similar to *note run(): 3f17, with added arguments\nto supply the globals and locals dictionaries for the 'command'\nstring.  This routine executes:\n\nexec(command, globals, locals)\n\nand gathers profiling statistics as in the *note run(): 3f17.\nfunction above.\n\n-- Class: profile.Profile (timer=None, timeunit=0.0, subcalls=True,\nbuiltins=True)\n\nThis class is normally only used if more precise control over\nprofiling is needed than what the 'cProfile.run()' function\nprovides.\n\nA custom timer can be supplied for measuring how long code takes to\nrun via the 'timer' argument.  This must be a function that returns\na single number representing the current time.  If the number is an\ninteger, the 'timeunit' specifies a multiplier that specifies the\nduration of each unit of time.  For example, if the timer returns\ntimes measured in thousands of seconds, the time unit would be\n'.001'.\n\nDirectly using the *note Profile: 809. class allows formatting\nprofile results without writing the profile data to a file:\n\nimport cProfile, pstats, io\nfrom pstats import SortKey\npr = cProfile.Profile()\npr.enable()\n# ... do something ...\npr.disable()\ns = io.StringIO()\nsortby = SortKey.CUMULATIVE\nps = pstats.Stats(pr, stream=s).sortstats(sortby)\nps.printstats()\nprint(s.getvalue())\n\nThe *note Profile: 809. class can also be used as a context manager\n(supported only in *note cProfile: 25. module.  see *note Context\nManager Types: 1cc6.):\n\nimport cProfile\n\nwith cProfile.Profile() as pr:\n# ... do something ...\n\npr.printstats()\n\nChanged in version 3.8: Added context manager support.\n\n-- Method: enable ()\n\nStart collecting profiling data.  Only in *note cProfile: 25.\n\n-- Method: disable ()\n\nStop collecting profiling data.  Only in *note cProfile: 25.\n\n-- Method: createstats ()\n\nStop collecting profiling data and record the results\ninternally as the current profile.\n\n-- Method: printstats (sort=-1)\n\nCreate a *note Stats: 3f11. object based on the current\nprofile and print the results to stdout.\n\n-- Method: dumpstats (filename)\n\nWrite the results of the current profile to 'filename'.\n\n-- Method: run (cmd)\n\nProfile the cmd via *note exec(): 691.\n\n-- Method: runctx (cmd, globals, locals)\n\nProfile the cmd via *note exec(): 691. with the specified\nglobal and local environment.\n\n-- Method: runcall (func, /, *args, kwargs)\n\nProfile 'func(*args, kwargs)'\n",
            "subsections": []
        },
        "Note that profiling will only work if the called command/function": {
            "content": "actually returns.  If the interpreter is terminated (e.g.  via a *note\nsys.exit(): 11c2. call during the called command/function execution) no\nprofiling results will be printed.\n\nFile: python3.12.info,  Node: The Stats Class,  Next: What Is Deterministic Profiling?,  Prev: profile and cProfile Module Reference,  Up: The Python Profilers\n\n5.27.5.4 The 'Stats' Class\n..........................\n\nAnalysis of the profiler data is done using the *note Stats: 3f11.\nclass.\n\n-- Class: pstats.Stats (*filenames or profile, stream=sys.stdout)\n\nThis class constructor creates an instance of a \"statistics object\"\nfrom a 'filename' (or list of filenames) or from a 'Profile'\ninstance.  Output will be printed to the stream specified by\n'stream'.\n\nThe file selected by the above constructor must have been created\nby the corresponding version of *note profile: aa. or *note\ncProfile: 25.  To be specific, there is 'no' file compatibility\nguaranteed with future versions of this profiler, and there is no\ncompatibility with files produced by other profilers, or the same\nprofiler run on a different operating system.  If several files are\nprovided, all the statistics for identical functions will be\ncoalesced, so that an overall view of several processes can be\nconsidered in a single report.  If additional files need to be\ncombined with data in an existing *note Stats: 3f11. object, the\n*note add(): 3f22. method can be used.\n\nInstead of reading the profile data from a file, a\n'cProfile.Profile' or *note profile.Profile: 809. object can be\nused as the profile data source.\n\n*note Stats: 3f11. objects have the following methods:\n\n-- Method: stripdirs ()\n\nThis method for the *note Stats: 3f11. class removes all\nleading path information from file names.  It is very useful\nin reducing the size of the printout to fit within (close to)\n80 columns.  This method modifies the object, and the stripped\ninformation is lost.  After performing a strip operation, the\nobject is considered to have its entries in a \"random\" order,\nas it was just after object initialization and loading.  If\n*note stripdirs(): 3f14. causes two function names to be\nindistinguishable (they are on the same line of the same\nfilename, and have the same function name), then the\nstatistics for these two entries are accumulated into a single\nentry.\n\n-- Method: add (*filenames)\n\nThis method of the *note Stats: 3f11. class accumulates\nadditional profiling information into the current profiling\nobject.  Its arguments should refer to filenames created by\nthe corresponding version of *note profile.run(): 3f17. or\n'cProfile.run()'.  Statistics for identically named (re: file,\nline, name) functions are automatically accumulated into\nsingle function statistics.\n\n-- Method: dumpstats (filename)\n\nSave the data loaded into the *note Stats: 3f11. object to a\nfile named 'filename'.  The file is created if it does not\nexist, and is overwritten if it already exists.  This is\nequivalent to the method of the same name on the *note\nprofile.Profile: 809. and 'cProfile.Profile' classes.\n\n-- Method: sortstats (*keys)\n\nThis method modifies the *note Stats: 3f11. object by sorting\nit according to the supplied criteria.  The argument can be\neither a string or a SortKey enum identifying the basis of a\nsort (example: ''time'', ''name'', 'SortKey.TIME' or\n'SortKey.NAME').  The SortKey enums argument have advantage\nover the string argument in that it is more robust and less\nerror prone.\n\nWhen more than one key is provided, then additional keys are\nused as secondary criteria when there is equality in all keys\nselected before them.  For example, 'sortstats(SortKey.NAME,\nSortKey.FILE)' will sort all the entries according to their\nfunction name, and resolve all ties (identical function names)\nby sorting by file name.\n\nFor the string argument, abbreviations can be used for any key\nnames, as long as the abbreviation is unambiguous.\n\nThe following are the valid string and SortKey:\n\nValid String Arg       Valid enum Arg            Meaning\n\n----------------------------------------------------------------------------\n\n''calls''              SortKey.CALLS             call count\n\n\n''cumulative''         SortKey.CUMULATIVE        cumulative time\n\n\n''cumtime''            N/A                       cumulative time\n\n\n''file''               N/A                       file name\n\n\n''filename''           SortKey.FILENAME          file name\n\n\n''module''             N/A                       file name\n\n\n''ncalls''             N/A                       call count\n\n\n''pcalls''             SortKey.PCALLS            primitive call count\n\n\n''line''               SortKey.LINE              line number\n\n\n''name''               SortKey.NAME              function name\n\n\n''nfl''                SortKey.NFL               name/file/line\n\n\n''stdname''            SortKey.STDNAME           standard name\n\n\n''time''               SortKey.TIME              internal time\n\n\n''tottime''            N/A                       internal time\n\n\nNote that all sorts on statistics are in descending order\n(placing most time consuming items first), where as name,\nfile, and line number searches are in ascending order\n(alphabetical).  The subtle distinction between 'SortKey.NFL'\nand 'SortKey.STDNAME' is that the standard name is a sort of\nthe name as printed, which means that the embedded line\nnumbers get compared in an odd way.  For example, lines 3, 20,\nand 40 would (if the file names were the same) appear in the\nstring order 20, 3 and 40.  In contrast, 'SortKey.NFL' does a\nnumeric compare of the line numbers.  In fact,\n'sortstats(SortKey.NFL)' is the same as\n'sortstats(SortKey.NAME, SortKey.FILENAME, SortKey.LINE)'.\n\nFor backward-compatibility reasons, the numeric arguments\n'-1', '0', '1', and '2' are permitted.  They are interpreted\nas ''stdname'', ''calls'', ''time'', and ''cumulative''\nrespectively.  If this old style format (numeric) is used,\nonly one sort key (the numeric key) will be used, and\nadditional arguments will be silently ignored.\n\nNew in version 3.7: Added the SortKey enum.\n\n-- Method: reverseorder ()\n\nThis method for the *note Stats: 3f11. class reverses the\nordering of the basic list within the object.  Note that by\ndefault ascending vs descending order is properly selected\nbased on the sort key of choice.\n\n-- Method: printstats (*restrictions)\n\nThis method for the *note Stats: 3f11. class prints out a\nreport as described in the *note profile.run(): 3f17.\ndefinition.\n\nThe order of the printing is based on the last *note\nsortstats(): 3f13. operation done on the object (subject to\ncaveats in *note add(): 3f22. and *note stripdirs(): 3f14.).\n\nThe arguments provided (if any) can be used to limit the list\ndown to the significant entries.  Initially, the list is taken\nto be the complete set of profiled functions.  Each\nrestriction is either an integer (to select a count of lines),\nor a decimal fraction between 0.0 and 1.0 inclusive (to select\na percentage of lines), or a string that will interpreted as a\nregular expression (to pattern match the standard name that is\nprinted).  If several restrictions are provided, then they are\napplied sequentially.  For example:\n\nprintstats(.1, 'foo:')\n\nwould first limit the printing to first 10% of list, and then\nonly print functions that were part of filename '.*foo:'.  In\ncontrast, the command:\n\nprintstats('foo:', .1)\n\nwould limit the list to all functions having file names\n'.*foo:', and then proceed to only print the first 10% of\nthem.\n\n-- Method: printcallers (*restrictions)\n\nThis method for the *note Stats: 3f11. class prints a list of\nall functions that called each function in the profiled\ndatabase.  The ordering is identical to that provided by *note\nprintstats(): 3f15, and the definition of the restricting\nargument is also identical.  Each caller is reported on its\nown line.  The format differs slightly depending on the\nprofiler that produced the stats:\n\n* With *note profile: aa, a number is shown in parentheses\nafter each caller to show how many times this specific\ncall was made.  For convenience, a second\nnon-parenthesized number repeats the cumulative time\nspent in the function at the right.\n\n* With *note cProfile: 25, each caller is preceded by three\nnumbers: the number of times this specific call was made,\nand the total and cumulative times spent in the current\nfunction while it was invoked by this specific caller.\n\n-- Method: printcallees (*restrictions)\n\nThis method for the *note Stats: 3f11. class prints a list of\nall function that were called by the indicated function.\nAside from this reversal of direction of calls (re: called vs\nwas called by), the arguments and ordering are identical to\nthe *note printcallers(): 3f25. method.\n\n-- Method: getstatsprofile ()\n\nThis method returns an instance of StatsProfile, which\ncontains a mapping of function names to instances of\nFunctionProfile.  Each FunctionProfile instance holds\ninformation related to the function's profile such as how long\nthe function took to run, how many times it was called, etc...\n\nNew in version 3.9: Added the following dataclasses:\nStatsProfile, FunctionProfile.  Added the following function:\ngetstatsprofile.\n\nFile: python3.12.info,  Node: What Is Deterministic Profiling?,  Next: Limitations,  Prev: The Stats Class,  Up: The Python Profilers\n\n5.27.5.5 What Is Deterministic Profiling?\n.........................................\n\n'Deterministic profiling' is meant to reflect the fact that all\n'function call', 'function return', and 'exception' events are\nmonitored, and precise timings are made for the intervals between these\nevents (during which time the user's code is executing).  In contrast,\n'statistical profiling' (which is not done by this module) randomly\nsamples the effective instruction pointer, and deduces where time is\nbeing spent.  The latter technique traditionally involves less overhead\n(as the code does not need to be instrumented), but provides only\nrelative indications of where time is being spent.\n",
            "subsections": []
        },
        "In Python, since there is an interpreter active during execution, the": {
            "content": "presence of instrumented code is not required in order to do\ndeterministic profiling.  Python automatically provides a 'hook'\n(optional callback) for each event.  In addition, the interpreted nature\nof Python tends to add so much overhead to execution, that deterministic\nprofiling tends to only add small processing overhead in typical\napplications.  The result is that deterministic profiling is not that\nexpensive, yet provides extensive run time statistics about the\nexecution of a Python program.\n",
            "subsections": []
        },
        "Call count statistics can be used to identify bugs in code (surprising": {
            "content": "counts), and to identify possible inline-expansion points (high call\ncounts).  Internal time statistics can be used to identify \"hot loops\"\nthat should be carefully optimized.  Cumulative time statistics should\nbe used to identify high level errors in the selection of algorithms.",
            "subsections": []
        },
        "Note that the unusual handling of cumulative times in this profiler": {
            "content": "allows statistics for recursive implementations of algorithms to be\ndirectly compared to iterative implementations.\n\nFile: python3.12.info,  Node: Limitations,  Next: Calibration,  Prev: What Is Deterministic Profiling?,  Up: The Python Profilers\n\n5.27.5.6 Limitations\n....................\n",
            "subsections": []
        },
        "One limitation has to do with accuracy of timing information.  There is": {
            "content": "a fundamental problem with deterministic profilers involving accuracy.\nThe most obvious restriction is that the underlying \"clock\" is only\nticking at a rate (typically) of about .001 seconds.  Hence no\nmeasurements will be more accurate than the underlying clock.  If enough\nmeasurements are taken, then the \"error\" will tend to average out.",
            "subsections": []
        },
        "Unfortunately, removing this first error induces a second source of": {
            "content": "error.\n\nThe second problem is that it \"takes a while\" from when an event is\ndispatched until the profiler's call to get the time actually 'gets' the\nstate of the clock.  Similarly, there is a certain lag when exiting the\nprofiler event handler from the time that the clock's value was obtained\n(and then squirreled away), until the user's code is once again\nexecuting.  As a result, functions that are called many times, or call\nmany functions, will typically accumulate this error.  The error that\naccumulates in this fashion is typically less than the accuracy of the\nclock (less than one clock tick), but it 'can' accumulate and become\nvery significant.\n\nThe problem is more important with *note profile: aa. than with the\nlower-overhead *note cProfile: 25.  For this reason, *note profile: aa.\nprovides a means of calibrating itself for a given platform so that this\nerror can be probabilistically (on the average) removed.  After the\nprofiler is calibrated, it will be more accurate (in a least square\nsense), but it will sometimes produce negative numbers (when call counts\nare exceptionally low, and the gods of probability work against you :-).\n)  Do 'not' be alarmed by negative numbers in the profile.  They should\n'only' appear if you have calibrated your profiler, and the results are\nactually better than without calibration.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Calibration,  Next: Using a custom timer,  Prev: Limitations,  Up: The Python Profilers": {
            "content": "5.27.5.7 Calibration\n....................\n\nThe profiler of the *note profile: aa. module subtracts a constant from\neach event handling time to compensate for the overhead of calling the\ntime function, and socking away the results.  By default, the constant\nis 0.  The following procedure can be used to obtain a better constant\nfor a given platform (see *note Limitations: 3f2b.).\n\nimport profile\npr = profile.Profile()\nfor i in range(5):\nprint(pr.calibrate(10000))\n",
            "subsections": []
        },
        "The method executes the number of Python calls given by the argument,": {
            "content": "directly and again under the profiler, measuring the time for both.  It\nthen computes the hidden overhead per profiler event, and returns that\nas a float.  For example, on a 1.8Ghz Intel Core i5 running macOS, and\nusing Python's time.processtime() as the timer, the magical number is\nabout 4.04e-6.\n",
            "subsections": []
        },
        "The object of this exercise is to get a fairly consistent result.  If": {
            "content": "your computer is 'very' fast, or your timer function has poor\nresolution, you might have to pass 100000, or even 1000000, to get\nconsistent results.\n\nWhen you have a consistent answer, there are three ways you can use it:\n\nimport profile\n\n# 1. Apply computed bias to all Profile instances created hereafter.\nprofile.Profile.bias = yourcomputedbias\n\n# 2. Apply computed bias to a specific Profile instance.\npr = profile.Profile()\npr.bias = yourcomputedbias\n\n# 3. Specify computed bias in instance constructor.\npr = profile.Profile(bias=yourcomputedbias)\n",
            "subsections": []
        },
        "If you have a choice, you are better off choosing a smaller constant,": {
            "content": "and then your results will \"less often\" show up as negative in profile\nstatistics.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using a custom timer,  Prev: Calibration,  Up: The Python Profilers": {
            "content": "5.27.5.8 Using a custom timer\n.............................\n",
            "subsections": []
        },
        "If you want to change how current time is determined (for example, to": {
            "content": "force use of wall-clock time or elapsed process time), pass the timing\nfunction you want to the 'Profile' class constructor:\n\npr = profile.Profile(yourtimefunc)\n",
            "subsections": []
        },
        "The resulting profiler will then call 'yourtimefunc'.  Depending on": {
            "content": "whether you are using *note profile.Profile: 809. or 'cProfile.Profile',\n'yourtimefunc''s return value will be interpreted differently:\n\n*note profile.Profile: 809.\n\n'yourtimefunc' should return a single number, or a list of\nnumbers whose sum is the current time (like what *note os.times():\nf85. returns).  If the function returns a single time number, or\nthe list of returned numbers has length 2, then you will get an\nespecially fast version of the dispatch routine.\n\nBe warned that you should calibrate the profiler class for the\ntimer function that you choose (see *note Calibration: 3f2d.).  For\nmost machines, a timer that returns a lone integer value will\nprovide the best results in terms of low overhead during profiling.\n(*note os.times(): f85. is 'pretty' bad, as it returns a tuple of\nfloating point values).  If you want to substitute a better timer\nin the cleanest fashion, derive a class and hardwire a replacement\ndispatch method that best handles your timer call, along with the\nappropriate calibration constant.\n\n'cProfile.Profile'\n\n'yourtimefunc' should return a single number.  If it returns\nintegers, you can also invoke the class constructor with a second\nargument specifying the real duration of one unit of time.  For\nexample, if 'yourintegertimefunc' returns times measured in\nthousands of seconds, you would construct the 'Profile' instance as\nfollows:\n\npr = cProfile.Profile(yourintegertimefunc, 0.001)\n\nAs the 'cProfile.Profile' class cannot be calibrated, custom timer\nfunctions should be used with care and should be as fast as\npossible.  For the best results with a custom timer, it might be\nnecessary to hard-code it in the C source of the internal 'lsprof'\nmodule.\n\nPython 3.3 adds several new functions in *note time: e8. that can be\nused to make precise measurements of process or wall-clock time.  For\nexample, see *note time.perfcounter(): 8b6.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "'Source code:' Lib/timeit.py(1)\n\n\n",
            "subsections": []
        },
        "This module provides a simple way to time small bits of Python code.  It": {
            "content": "has both a *note Command-Line Interface: 3f32. as well as a *note\ncallable: 3f33. one.  It avoids a number of common traps for measuring\nexecution times.  See also Tim Peters' introduction to the \"Algorithms\"\nchapter in the second edition of 'Python Cookbook', published by\nO'Reilly.\n\n* Menu:\n\n* Basic Examples: Basic Examples<2>.\n* Python Interface::\n* Command-Line Interface: Command-Line Interface<4>.\n* Examples: Examples<29>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/timeit.py\n\nFile: python3.12.info,  Node: Basic Examples<2>,  Next: Python Interface,  Up: timeit -- Measure execution time of small code snippets\n\n5.27.6.1 Basic Examples\n.......................\n\nThe following example shows how the *note Command-Line Interface: 3f32.\ncan be used to compare three different expressions:\n\n$ python -m timeit \"'-'.join(str(n) for n in range(100))\"\n10000 loops, best of 5: 30.2 usec per loop\n$ python -m timeit \"'-'.join([str(n) for n in range(100)])\"\n10000 loops, best of 5: 27.5 usec per loop\n$ python -m timeit \"'-'.join(map(str, range(100)))\"\n10000 loops, best of 5: 23.2 usec per loop\n\nThis can be achieved from the *note Python Interface: 3f33. with:\n\n>>> import timeit\n>>> timeit.timeit('\"-\".join(str(n) for n in range(100))', number=10000)\n0.3018611848820001\n>>> timeit.timeit('\"-\".join([str(n) for n in range(100)])', number=10000)\n0.2727368790656328\n>>> timeit.timeit('\"-\".join(map(str, range(100)))', number=10000)\n0.23702679807320237\n\nA callable can also be passed from the *note Python Interface: 3f33.:\n\n>>> timeit.timeit(lambda: \"-\".join(map(str, range(100))), number=10000)\n0.19665591977536678\n\nNote however that *note timeit(): ce3. will automatically determine the\nnumber of repetitions only when the command-line interface is used.  In\nthe *note Examples: 3f35. section you can find more advanced examples.\n\nFile: python3.12.info,  Node: Python Interface,  Next: Command-Line Interface<4>,  Prev: Basic Examples<2>,  Up: timeit -- Measure execution time of small code snippets\n\n5.27.6.2 Python Interface\n.........................\n\nThe module defines three convenience functions and a public class:\n\n-- Function: timeit.timeit (stmt='pass', setup='pass', timer=<default\ntimer>, number=1000000, globals=None)\n\nCreate a *note Timer: 131f. instance with the given statement,\n'setup' code and 'timer' function and run its *note timeit(): b3d.\nmethod with 'number' executions.  The optional 'globals' argument\nspecifies a namespace in which to execute the code.\n\nChanged in version 3.5: The optional 'globals' parameter was added.\n\n-- Function: timeit.repeat (stmt='pass', setup='pass', timer=<default\ntimer>, repeat=5, number=1000000, globals=None)\n\nCreate a *note Timer: 131f. instance with the given statement,\n'setup' code and 'timer' function and run its *note repeat(): 3f38.\nmethod with the given 'repeat' count and 'number' executions.  The\noptional 'globals' argument specifies a namespace in which to\nexecute the code.\n\nChanged in version 3.5: The optional 'globals' parameter was added.\n\nChanged in version 3.7: Default value of 'repeat' changed from 3 to\n5.\n\n-- Function: timeit.defaulttimer ()\n\nThe default timer, which is always time.perfcounter(), returns\nfloat seconds.  An alternative, time.perfcounterns, returns\ninteger nanoseconds.\n\nChanged in version 3.3: *note time.perfcounter(): 8b6. is now the\ndefault timer.\n\n-- Class: timeit.Timer (stmt='pass', setup='pass', timer=<timer\nfunction>, globals=None)\n\nClass for timing execution speed of small code snippets.\n\nThe constructor takes a statement to be timed, an additional\nstatement used for setup, and a timer function.  Both statements\ndefault to ''pass''; the timer function is platform-dependent (see\nthe module doc string).  'stmt' and 'setup' may also contain\nmultiple statements separated by ';' or newlines, as long as they\ndon't contain multi-line string literals.  The statement will by\ndefault be executed within timeit's namespace; this behavior can be\ncontrolled by passing a namespace to 'globals'.\n\nTo measure the execution time of the first statement, use the *note\ntimeit(): b3d. method.  The *note repeat(): 3f38. and *note\nautorange(): b3c. methods are convenience methods to call *note\ntimeit(): b3d. multiple times.\n\nThe execution time of 'setup' is excluded from the overall timed\nexecution run.\n\nThe 'stmt' and 'setup' parameters can also take objects that are\ncallable without arguments.  This will embed calls to them in a\ntimer function that will then be executed by *note timeit(): b3d.\nNote that the timing overhead is a little larger in this case\nbecause of the extra function calls.\n\nChanged in version 3.5: The optional 'globals' parameter was added.\n\n-- Method: timeit (number=1000000)\n\nTime 'number' executions of the main statement.  This executes\nthe setup statement once, and then returns the time it takes\nto execute the main statement a number of times.  The default\ntimer returns seconds as a float.  The argument is the number\nof times through the loop, defaulting to one million.  The\nmain statement, the setup statement and the timer function to\nbe used are passed to the constructor.\n\nNote: By default, *note timeit(): b3d. temporarily turns\noff *note garbage collection: 167e. during the timing.\nThe advantage of this approach is that it makes\nindependent timings more comparable.  The disadvantage is\nthat GC may be an important component of the performance\nof the function being measured.  If so, GC can be\nre-enabled as the first statement in the 'setup' string.\nFor example:\n\ntimeit.Timer('for i in range(10): oct(i)', 'gc.enable()').timeit()\n\n-- Method: autorange (callback=None)\n\nAutomatically determine how many times to call *note timeit():\nb3d.\n\nThis is a convenience function that calls *note timeit(): b3d.\nrepeatedly so that the total time >= 0.2 second, returning the\neventual (number of loops, time taken for that number of\nloops).  It calls *note timeit(): b3d. with increasing numbers\nfrom the sequence 1, 2, 5, 10, 20, 50, ... until the time taken\nis at least 0.2 seconds.\n\nIf 'callback' is given and is not 'None', it will be called\nafter each trial with two arguments: 'callback(number,\ntimetaken)'.\n\nNew in version 3.6.\n\n-- Method: repeat (repeat=5, number=1000000)\n\nCall *note timeit(): b3d. a few times.\n\nThis is a convenience function that calls the *note timeit():\nb3d. repeatedly, returning a list of results.  The first\nargument specifies how many times to call *note timeit(): b3d.\nThe second argument specifies the 'number' argument for *note\ntimeit(): b3d.\n\nNote: It's tempting to calculate mean and standard\ndeviation from the result vector and report these.\nHowever, this is not very useful.  In a typical case, the\nlowest value gives a lower bound for how fast your\nmachine can run the given code snippet; higher values in\nthe result vector are typically not caused by variability\nin Python's speed, but by other processes interfering\nwith your timing accuracy.  So the *note min(): d6f. of\nthe result is probably the only number you should be\ninterested in.  After that, you should look at the entire\nvector and apply common sense rather than statistics.\n\nChanged in version 3.7: Default value of 'repeat' changed from\n3 to 5.\n\n-- Method: printexc (file=None)\n\nHelper to print a traceback from the timed code.\n\nTypical use:\n\nt = Timer(...)       # outside the try/except\ntry:\nt.timeit(...)    # or t.repeat(...)\nexcept Exception:\nt.printexc()\n\nThe advantage over the standard traceback is that source lines\nin the compiled template will be displayed.  The optional\n'file' argument directs where the traceback is sent; it\ndefaults to *note sys.stderr: 757.\n\nFile: python3.12.info,  Node: Command-Line Interface<4>,  Next: Examples<29>,  Prev: Python Interface,  Up: timeit -- Measure execution time of small code snippets\n\n5.27.6.3 Command-Line Interface\n...............................\n",
            "subsections": []
        },
        "When called as a program from the command line, the following form is": {
            "content": "used:\n\n$ python -m zipapp source [options]\n",
            "subsections": []
        },
        "It is possible to provide a setup statement that is executed only once": {
            "content": "at the beginning:\n\n$ python -m timeit -s \"text = 'sample string'; char = 'g'\" \"char in text\"\n5000000 loops, best of 5: 0.0877 usec per loop\n$ python -m timeit -s \"text = 'sample string'; char = 'g'\" \"text.find(char)\"\n1000000 loops, best of 5: 0.342 usec per loop\n",
            "subsections": []
        },
        "In the output, there are three fields.  The loop count, which tells you": {
            "content": "how many times the statement body was run per timing loop repetition.",
            "subsections": []
        },
        "The repetition count ('best of 5') which tells you how many times the": {
            "content": "timing loop was repeated, and finally the time the statement body took\non average within the best repetition of the timing loop.  That is, the\ntime the fastest repetition took divided by the loop count.\n\n>>> import timeit\n>>> timeit.timeit('char in text', setup='text = \"sample string\"; char = \"g\"')\n0.41440500499993504\n>>> timeit.timeit('text.find(char)', setup='text = \"sample string\"; char = \"g\"')\n1.7246671520006203\n\nThe same can be done using the *note Timer: 131f. class and its methods:\n\n>>> import timeit\n>>> t = timeit.Timer('char in text', setup='text = \"sample string\"; char = \"g\"')\n>>> t.timeit()\n0.3955516149999312\n>>> t.repeat()\n[0.40183617287970225, 0.37027556854118704, 0.38344867356679524, 0.3712595970846668, 0.37866875250654886]\n",
            "subsections": []
        },
        "The following examples show how to time expressions that contain": {
            "content": "multiple lines.  Here we compare the cost of using *note hasattr(): 1f7.\nvs.  *note try: 4bc./*note except: 379. to test for missing and present\nobject attributes:\n\n$ python -m timeit \"try:\" \"  str.bool\" \"except AttributeError:\" \"  pass\"\n20000 loops, best of 5: 15.7 usec per loop\n$ python -m timeit \"if hasattr(str, 'bool'): pass\"\n50000 loops, best of 5: 4.26 usec per loop\n\n$ python -m timeit \"try:\" \"  int.bool\" \"except AttributeError:\" \"  pass\"\n200000 loops, best of 5: 1.43 usec per loop\n$ python -m timeit \"if hasattr(int, 'bool'): pass\"\n100000 loops, best of 5: 2.23 usec per loop\n\n>>> import timeit\n>>> # attribute is missing\n>>> s = \"\"\"\\\n... try:\n...     str.bool\n... except AttributeError:\n...     pass\n... \"\"\"\n>>> timeit.timeit(stmt=s, number=100000)\n0.9138244460009446\n>>> s = \"if hasattr(str, 'bool'): pass\"\n>>> timeit.timeit(stmt=s, number=100000)\n0.5829014980008651\n>>>\n>>> # attribute is present\n>>> s = \"\"\"\\\n... try:\n...     int.bool\n... except AttributeError:\n...     pass\n... \"\"\"\n>>> timeit.timeit(stmt=s, number=100000)\n0.04215312199994514\n>>> s = \"if hasattr(int, 'bool'): pass\"\n>>> timeit.timeit(stmt=s, number=100000)\n0.08588060699912603\n\nTo give the *note timeit: e9. module access to functions you define, you\ncan pass a 'setup' parameter which contains an import statement:\n\ndef test():\n\"\"\"Stupid test function\"\"\"\nL = [i for i in range(100)]\n\nif name == 'main':\nimport timeit\nprint(timeit.timeit(\"test()\", setup=\"from main import test\"))\n\nAnother option is to pass *note globals(): 15c9. to the 'globals'\nparameter, which will cause the code to be executed within your current\nglobal namespace.  This can be more convenient than individually\nspecifying imports:\n\ndef f(x):\nreturn x2\ndef g(x):\nreturn x4\ndef h(x):\nreturn x8\n\nimport timeit\nprint(timeit.timeit('[func(42) for func in (f,g,h)]', globals=globals()))\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "'Source code:' Lib/trace.py(1)\n\n\n\nThe *note trace: f8. module allows you to trace program execution,\ngenerate annotated statement coverage listings, print caller/callee\nrelationships and list functions executed during a program run.  It can\nbe used in another program or from the command line.\n\nSee also\n........\n",
            "subsections": []
        },
        "Coverage.py(2)": {
            "content": "A popular third-party coverage tool that provides HTML output along\nwith advanced features such as branch coverage.\n\n* Menu:\n\n* Command-Line Usage: Command-Line Usage<3>.\n* Programmatic Interface::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/trace.py\n\n(2) https://coverage.readthedocs.io/\n\nFile: python3.12.info,  Node: Command-Line Usage<3>,  Next: Programmatic Interface,  Up: trace -- Trace or track Python statement execution\n\n5.27.7.1 Command-Line Usage\n...........................\n\nThe *note trace: f8. module can be invoked from the command line.  It\ncan be as simple as\n\npython -m trace --count -C . somefile.py ...\n",
            "subsections": []
        },
        "The above will execute 'somefile.py' and generate annotated listings of": {
            "content": "all Python modules imported during the execution into the current\ndirectory.\n\n-- Option: --help\n\nDisplay usage and exit.\n\n-- Option: --version\n\nDisplay the version of the module and exit.\n",
            "subsections": []
        },
        "New in version 3.8: Added '--module' option that allows to run an": {
            "content": "executable module.\n\n* Menu:\n\n* Main options::\n* Modifiers::\n* Filters::\n\nFile: python3.12.info,  Node: Main options,  Next: Modifiers,  Up: Command-Line Usage<3>\n\n5.27.7.2 Main options\n.....................\n",
            "subsections": []
        },
        "At least one of the following options must be specified when invoking": {
            "content": "*note trace: f8.  The *note -listfuncs: 3f52. option is mutually\nexclusive with the *note -trace: 3f53. and *note -count: 3f54. options.\nWhen *note -listfuncs: 3f52. is provided, neither *note -count: 3f54.\nnor *note -trace: 3f53. are accepted, and vice versa.\n\n-- Option: -c, --count\n\nProduce a set of annotated listing files upon program completion\nthat shows how many times each statement was executed.  See also\n*note -coverdir: 3f56, *note -file: 3f57. and *note -no-report:\n3f58. below.\n\n-- Option: -t, --trace\n\nDisplay lines as they are executed.\n\n-- Option: -l, --listfuncs\n\nDisplay the functions executed by running the program.\n\n-- Option: -r, --report\n\nProduce an annotated list from an earlier program run that used the\n*note -count: 3f54. and *note -file: 3f57. option.  This does not\nexecute any code.\n\n-- Option: -T, --trackcalls\n\nDisplay the calling relationships exposed by running the program.\n\nFile: python3.12.info,  Node: Modifiers,  Next: Filters,  Prev: Main options,  Up: Command-Line Usage<3>\n\n5.27.7.3 Modifiers\n..................\n\n-- Option: -f, --file=<file>\n\nName of a file to accumulate counts over several tracing runs.\nShould be used with the *note -count: 3f54. option.\n\n-- Option: -C, --coverdir=<dir>\n\nDirectory where the report files go.  The coverage report for\n'package.module' is written to file\n'`dir'/`package'/`module'.cover'.\n\n-- Option: -m, --missing\n\nWhen generating annotated listings, mark lines which were not\nexecuted with '>>>>>>'.\n\n-- Option: -s, --summary\n\nWhen using *note -count: 3f54. or *note -report: 3f5b, write a\nbrief summary to stdout for each file processed.\n\n-- Option: -R, --no-report\n\nDo not generate annotated listings.  This is useful if you intend\nto make several runs with *note -count: 3f54, and then produce a\nsingle set of annotated listings at the end.\n\n-- Option: -g, --timing\n\nPrefix each line with the time since the program started.  Only\nused while tracing.\n\nFile: python3.12.info,  Node: Filters,  Prev: Modifiers,  Up: Command-Line Usage<3>\n\n5.27.7.4 Filters\n................\n\nThese options may be repeated multiple times.\n\n-- Option: --ignore-module=<mod>\n\nIgnore each of the given module names and its submodules (if it is\na package).  The argument can be a list of names separated by a\ncomma.\n\n-- Option: --ignore-dir=<dir>\n\nIgnore all modules and packages in the named directory and\nsubdirectories.  The argument can be a list of directories\nseparated by *note os.pathsep: 1ac4.\n\nFile: python3.12.info,  Node: Programmatic Interface,  Prev: Command-Line Usage<3>,  Up: trace -- Trace or track Python statement execution\n\n5.27.7.5 Programmatic Interface\n...............................\n\n-- Class: trace.Trace (count=1, trace=1, countfuncs=0, countcallers=0,\nignoremods=(), ignoredirs=(), infile=None, outfile=None,\ntiming=False)\n\nCreate an object to trace execution of a single statement or\nexpression.  All parameters are optional.  'count' enables counting\nof line numbers.  'trace' enables line execution tracing.\n'countfuncs' enables listing of the functions called during the\nrun.  'countcallers' enables call relationship tracking.\n'ignoremods' is a list of modules or packages to ignore.\n'ignoredirs' is a list of directories whose modules or packages\nshould be ignored.  'infile' is the name of the file from which to\nread stored count information.  'outfile' is the name of the file\nin which to write updated count information.  'timing' enables a\ntimestamp relative to when tracing was started to be displayed.\n\n-- Method: run (cmd)\n\nExecute the command and gather statistics from the execution\nwith the current tracing parameters.  'cmd' must be a string\nor code object, suitable for passing into *note exec(): 691.\n\n-- Method: runctx (cmd, globals=None, locals=None)\n\nExecute the command and gather statistics from the execution\nwith the current tracing parameters, in the defined global and\nlocal environments.  If not defined, 'globals' and 'locals'\ndefault to empty dictionaries.\n\n-- Method: runfunc (func, /, *args, kwds)\n\nCall 'func' with the given arguments under control of the\n*note Trace: 3f6e. object with the current tracing parameters.\n\n-- Method: results ()\n\nReturn a *note CoverageResults: 3f72. object that contains the\ncumulative results of all previous calls to 'run', 'runctx'\nand 'runfunc' for the given *note Trace: 3f6e. instance.  Does\nnot reset the accumulated trace results.\n\n-- Class: trace.CoverageResults\n\nA container for coverage results, created by *note Trace.results():\n3f71.  Should not be created directly by the user.\n\n-- Method: update (other)\n\nMerge in data from another *note CoverageResults: 3f72.\nobject.\n\n-- Method: writeresults (showmissing=True, summary=False,\ncoverdir=None)\n\nWrite coverage results.  Set 'showmissing' to show lines that\nhad no hits.  Set 'summary' to include in the output the\ncoverage summary per module.  'coverdir' specifies the\ndirectory into which the coverage result files will be output.\nIf 'None', the results for each source file are placed in its\ndirectory.\n\nA simple example demonstrating the use of the programmatic interface:\n\nimport sys\nimport trace\n\n# create a Trace object, telling it what to ignore, and whether to\n# do tracing or line-counting or both.\ntracer = trace.Trace(\nignoredirs=[sys.prefix, sys.execprefix],\ntrace=0,\ncount=1)\n\n# run the new command using the given tracer\ntracer.run('main()')\n\n# make a report, placing output in the current directory\nr = tracer.results()\nr.writeresults(showmissing=True, coverdir=\".\")\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: tracemalloc -- Trace memory allocations,  Prev: trace -- Trace or track Python statement execution,  Up: Debugging and Profiling": {
            "content": "New in version 3.4.\n\n'Source code:' Lib/tracemalloc.py(1)\n\n\n",
            "subsections": []
        },
        "The tracemalloc module is a debug tool to trace memory blocks allocated": {
            "content": "by Python.  It provides the following information:\n\n* Traceback where an object was allocated\n\n* Statistics on allocated memory blocks per filename and per line\nnumber: total size, number and average size of allocated memory\nblocks\n\n* Compute the differences between two snapshots to detect memory\nleaks\n",
            "subsections": []
        },
        "To trace most memory blocks allocated by Python, the module should be": {
            "content": "started as early as possible by setting the *note PYTHONTRACEMALLOC:\n1abf. environment variable to '1', or by using *note -X: 188.\n'tracemalloc' command line option.  The *note tracemalloc.start(): 1abe.\nfunction can be called at runtime to start tracing Python memory\nallocations.\n",
            "subsections": []
        },
        "By default, a trace of an allocated memory block only stores the most": {
            "content": "recent frame (1 frame).  To store 25 frames at startup: set the *note\nPYTHONTRACEMALLOC: 1abf. environment variable to '25', or use the *note\n-X: 188. 'tracemalloc=25' command line option.\n\n* Menu:\n\n* Examples: Examples<30>.\n* API::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/tracemalloc.py\n\nFile: python3.12.info,  Node: Examples<30>,  Next: API,  Up: tracemalloc -- Trace memory allocations\n\n5.27.8.1 Examples\n.................\n\n* Menu:\n\n* Display the top 10::\n* Compute differences::\n* Get the traceback of a memory block::\n* Pretty top::\n\nFile: python3.12.info,  Node: Display the top 10,  Next: Compute differences,  Up: Examples<30>\n\n5.27.8.2 Display the top 10\n...........................\n\nDisplay the 10 files allocating the most memory:\n\nimport tracemalloc\n\ntracemalloc.start()\n\n# ... run your application ...\n\nsnapshot = tracemalloc.takesnapshot()\ntopstats = snapshot.statistics('lineno')\n\nprint(\"[ Top 10 ]\")\nfor stat in topstats[:10]:\nprint(stat)\n\nExample of output of the Python test suite:\n\n[ Top 10 ]\n<frozen importlib.bootstrap>:716: size=4855 KiB, count=39328, average=126 B\n<frozen importlib.bootstrap>:284: size=521 KiB, count=3199, average=167 B\n/usr/lib/python3.4/collections/init.py:368: size=244 KiB, count=2315, average=108 B\n/usr/lib/python3.4/unittest/case.py:381: size=185 KiB, count=779, average=243 B\n/usr/lib/python3.4/unittest/case.py:402: size=154 KiB, count=378, average=416 B\n/usr/lib/python3.4/abc.py:133: size=88.7 KiB, count=347, average=262 B\n<frozen importlib.bootstrap>:1446: size=70.4 KiB, count=911, average=79 B\n<frozen importlib.bootstrap>:1454: size=52.0 KiB, count=25, average=2131 B\n<string>:5: size=49.7 KiB, count=148, average=344 B\n/usr/lib/python3.4/sysconfig.py:411: size=48.0 KiB, count=1, average=48.0 KiB\n",
            "subsections": []
        },
        "We can see that Python loaded '4855 KiB' data (bytecode and constants)": {
            "content": "from modules and that the *note collections: 1b. module allocated '244\nKiB' to build *note namedtuple: 711. types.\n\nSee *note Snapshot.statistics(): 3f79. for more options.\n\nFile: python3.12.info,  Node: Compute differences,  Next: Get the traceback of a memory block,  Prev: Display the top 10,  Up: Examples<30>\n\n5.27.8.3 Compute differences\n............................\n\nTake two snapshots and display the differences:\n\nimport tracemalloc\ntracemalloc.start()\n# ... start your application ...\n\nsnapshot1 = tracemalloc.takesnapshot()\n# ... call the function leaking memory ...\nsnapshot2 = tracemalloc.takesnapshot()\n\ntopstats = snapshot2.compareto(snapshot1, 'lineno')\n\nprint(\"[ Top 10 differences ]\")\nfor stat in topstats[:10]:\nprint(stat)\n",
            "subsections": []
        },
        "Example of output before/after running some tests of the Python test": {
            "content": "suite:\n\n[ Top 10 differences ]\n<frozen importlib.bootstrap>:716: size=8173 KiB (+4428 KiB), count=71332 (+39369), average=117 B\n/usr/lib/python3.4/linecache.py:127: size=940 KiB (+940 KiB), count=8106 (+8106), average=119 B\n/usr/lib/python3.4/unittest/case.py:571: size=298 KiB (+298 KiB), count=589 (+589), average=519 B\n<frozen importlib.bootstrap>:284: size=1005 KiB (+166 KiB), count=7423 (+1526), average=139 B\n/usr/lib/python3.4/mimetypes.py:217: size=112 KiB (+112 KiB), count=1334 (+1334), average=86 B\n/usr/lib/python3.4/http/server.py:848: size=96.0 KiB (+96.0 KiB), count=1 (+1), average=96.0 KiB\n/usr/lib/python3.4/inspect.py:1465: size=83.5 KiB (+83.5 KiB), count=109 (+109), average=784 B\n/usr/lib/python3.4/unittest/mock.py:491: size=77.7 KiB (+77.7 KiB), count=143 (+143), average=557 B\n/usr/lib/python3.4/urllib/parse.py:476: size=71.8 KiB (+71.8 KiB), count=969 (+969), average=76 B\n/usr/lib/python3.4/contextlib.py:38: size=67.2 KiB (+67.2 KiB), count=126 (+126), average=546 B\n",
            "subsections": []
        },
        "We can see that Python has loaded '8173 KiB' of module data (bytecode": {
            "content": "and constants), and that this is '4428 KiB' more than had been loaded\nbefore the tests, when the previous snapshot was taken.  Similarly, the\n*note linecache: 80. module has cached '940 KiB' of Python source code\nto format tracebacks, all of it since the previous snapshot.\n",
            "subsections": []
        },
        "If the system has little free memory, snapshots can be written on disk": {
            "content": "using the *note Snapshot.dump(): 3f7b. method to analyze the snapshot\noffline.  Then use the *note Snapshot.load(): 3f7c. method reload the\nsnapshot.\n\nFile: python3.12.info,  Node: Get the traceback of a memory block,  Next: Pretty top,  Prev: Compute differences,  Up: Examples<30>\n\n5.27.8.4 Get the traceback of a memory block\n............................................\n\nCode to display the traceback of the biggest memory block:\n\nimport tracemalloc\n\n# Store 25 frames\ntracemalloc.start(25)\n\n# ... run your application ...\n\nsnapshot = tracemalloc.takesnapshot()\ntopstats = snapshot.statistics('traceback')\n\n# pick the biggest memory block\nstat = topstats[0]\nprint(\"%s memory blocks: %.1f KiB\" % (stat.count, stat.size / 1024))\nfor line in stat.traceback.format():\nprint(line)\n",
            "subsections": []
        },
        "Example of output of the Python test suite (traceback limited to 25": {
            "content": "frames):\n\n903 memory blocks: 870.1 KiB\nFile \"<frozen importlib.bootstrap>\", line 716\nFile \"<frozen importlib.bootstrap>\", line 1036\nFile \"<frozen importlib.bootstrap>\", line 934\nFile \"<frozen importlib.bootstrap>\", line 1068\nFile \"<frozen importlib.bootstrap>\", line 619\nFile \"<frozen importlib.bootstrap>\", line 1581\nFile \"<frozen importlib.bootstrap>\", line 1614\nFile \"/usr/lib/python3.4/doctest.py\", line 101\nimport pdb\nFile \"<frozen importlib.bootstrap>\", line 284\nFile \"<frozen importlib.bootstrap>\", line 938\nFile \"<frozen importlib.bootstrap>\", line 1068\nFile \"<frozen importlib.bootstrap>\", line 619\nFile \"<frozen importlib.bootstrap>\", line 1581\nFile \"<frozen importlib.bootstrap>\", line 1614\nFile \"/usr/lib/python3.4/test/support/init.py\", line 1728\nimport doctest\nFile \"/usr/lib/python3.4/test/testpickletools.py\", line 21\nsupport.rundoctest(pickletools)\nFile \"/usr/lib/python3.4/test/regrtest.py\", line 1276\ntestrunner()\nFile \"/usr/lib/python3.4/test/regrtest.py\", line 976\ndisplayfailure=not verbose)\nFile \"/usr/lib/python3.4/test/regrtest.py\", line 761\nmatchtests=ns.matchtests)\nFile \"/usr/lib/python3.4/test/regrtest.py\", line 1563\nmain()\nFile \"/usr/lib/python3.4/test/main.py\", line 3\nregrtest.mainintempcwd()\nFile \"/usr/lib/python3.4/runpy.py\", line 73\nexec(code, runglobals)\nFile \"/usr/lib/python3.4/runpy.py\", line 160\n\"main\", fname, loader, pkgname)\n\nWe can see that the most memory was allocated in the *note importlib:\n71. module to load data (bytecode and constants) from modules: '870.1\nKiB'.  The traceback is where the *note importlib: 71. loaded data most\nrecently: on the 'import pdb' line of the *note doctest: 36. module.\nThe traceback may change if a new module is loaded.\n\nFile: python3.12.info,  Node: Pretty top,  Prev: Get the traceback of a memory block,  Up: Examples<30>\n\n5.27.8.5 Pretty top\n...................\n",
            "subsections": []
        },
        "Code to display the 10 lines allocating the most memory with a pretty": {
            "content": "output, ignoring '<frozen importlib.bootstrap>' and '<unknown>' files:\n\nimport linecache\nimport os\nimport tracemalloc\n\ndef displaytop(snapshot, keytype='lineno', limit=10):\nsnapshot = snapshot.filtertraces((\ntracemalloc.Filter(False, \"<frozen importlib.bootstrap>\"),\ntracemalloc.Filter(False, \"<unknown>\"),\n))\ntopstats = snapshot.statistics(keytype)\n\nprint(\"Top %s lines\" % limit)\nfor index, stat in enumerate(topstats[:limit], 1):\nframe = stat.traceback[0]\nprint(\"#%s: %s:%s: %.1f KiB\"\n% (index, frame.filename, frame.lineno, stat.size / 1024))\nline = linecache.getline(frame.filename, frame.lineno).strip()\nif line:\nprint('    %s' % line)\n\nother = topstats[limit:]\nif other:\nsize = sum(stat.size for stat in other)\nprint(\"%s other: %.1f KiB\" % (len(other), size / 1024))\ntotal = sum(stat.size for stat in topstats)\nprint(\"Total allocated size: %.1f KiB\" % (total / 1024))\n\ntracemalloc.start()\n\n# ... run your application ...\n\nsnapshot = tracemalloc.takesnapshot()\ndisplaytop(snapshot)\n\nExample of output of the Python test suite:\n\nTop 10 lines\n#1: Lib/base64.py:414: 419.8 KiB\nb85chars2 = [(a + b) for a in b85chars for b in b85chars]\n#2: Lib/base64.py:306: 419.8 KiB\na85chars2 = [(a + b) for a in a85chars for b in a85chars]\n#3: collections/init.py:368: 293.6 KiB\nexec(classdefinition, namespace)\n#4: Lib/abc.py:133: 115.2 KiB\ncls = super().new(mcls, name, bases, namespace)\n#5: unittest/case.py:574: 103.1 KiB\ntestMethod()\n#6: Lib/linecache.py:127: 95.4 KiB\nlines = fp.readlines()\n#7: urllib/parse.py:476: 71.8 KiB\nfor a in hexdig for b in hexdig}\n#8: <string>:5: 62.0 KiB\n#9: Lib/weakrefset.py:37: 60.0 KiB\nself.data = set()\n#10: Lib/base64.py:142: 59.8 KiB\nb32tab2 = [a + b for a in b32tab for b in b32tab]\n6220 other: 3602.8 KiB\nTotal allocated size: 5303.1 KiB\n\nSee *note Snapshot.statistics(): 3f79. for more options.\n\n* Menu:\n\n* Record the current and peak size of all traced memory blocks::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Record the current and peak size of all traced memory blocks,  Up: Pretty top": {
            "content": "5.27.8.6 Record the current and peak size of all traced memory blocks\n.....................................................................\n\nThe following code computes two sums like '0 + 1 + 2 + ...'\ninefficiently, by creating a list of those numbers.  This list consumes\na lot of memory temporarily.  We can use *note gettracedmemory():\n3f80. and *note resetpeak(): 759. to observe the small memory usage\nafter the sum is computed as well as the peak memory usage during the\ncomputations:\n\nimport tracemalloc\n\ntracemalloc.start()\n\n# Example code: compute a sum with a large temporary list\nlargesum = sum(list(range(100000)))\n\nfirstsize, firstpeak = tracemalloc.gettracedmemory()\n\ntracemalloc.resetpeak()\n\n# Example code: compute a sum with a small temporary list\nsmallsum = sum(list(range(1000)))\n\nsecondsize, secondpeak = tracemalloc.gettracedmemory()\n\nprint(f\"{firstsize=}, {firstpeak=}\")\nprint(f\"{secondsize=}, {secondpeak=}\")\n\nOutput:\n\nfirstsize=664, firstpeak=3592984\nsecondsize=804, secondpeak=29704\n\nUsing *note resetpeak(): 759. ensured we could accurately record the\npeak during the computation of 'smallsum', even though it is much\nsmaller than the overall peak size of memory blocks since the *note\nstart(): 1abe. call.  Without the call to *note resetpeak(): 759,\n'secondpeak' would still be the peak from the computation 'largesum'\n(that is, equal to 'firstpeak').  In this case, both peaks are much\nhigher than the final memory usage, and which suggests we could optimise\n(by removing the unnecessary call to *note list: 3dc, and writing\n'sum(range(...))').\n\nFile: python3.12.info,  Node: API,  Prev: Examples<30>,  Up: tracemalloc -- Trace memory allocations\n\n5.27.8.7 API\n............\n\n* Menu:\n\n* Functions: Functions<11>.\n* DomainFilter::\n* Filter::\n* Frame::\n* Snapshot::\n* Statistic::\n* StatisticDiff::\n* Trace::\n* Traceback::\n\nFile: python3.12.info,  Node: Functions<11>,  Next: DomainFilter,  Up: API\n\n5.27.8.8 Functions\n..................\n\n-- Function: tracemalloc.cleartraces ()\n\nClear traces of memory blocks allocated by Python.\n\nSee also *note stop(): 3f84.\n\n-- Function: tracemalloc.getobjecttraceback (obj)\n\nGet the traceback where the Python object 'obj' was allocated.\nReturn a *note Traceback: 9d9. instance, or 'None' if the *note\ntracemalloc: fa. module is not tracing memory allocations or did\nnot trace the allocation of the object.\n\nSee also *note gc.getreferrers(): 5f7. and *note sys.getsizeof():\n14b9. functions.\n\n-- Function: tracemalloc.gettracebacklimit ()\n\nGet the maximum number of frames stored in the traceback of a\ntrace.\n\nThe *note tracemalloc: fa. module must be tracing memory\nallocations to get the limit, otherwise an exception is raised.\n\nThe limit is set by the *note start(): 1abe. function.\n\n-- Function: tracemalloc.gettracedmemory ()\n\nGet the current size and peak size of memory blocks traced by the\n*note tracemalloc: fa. module as a tuple: '(current: int, peak:\nint)'.\n\n-- Function: tracemalloc.resetpeak ()\n\nSet the peak size of memory blocks traced by the *note tracemalloc:\nfa. module to the current size.\n\nDo nothing if the *note tracemalloc: fa. module is not tracing\nmemory allocations.\n\nThis function only modifies the recorded peak size, and does not\nmodify or clear any traces, unlike *note cleartraces(): 3f83.\nSnapshots taken with *note takesnapshot(): 3f86. before a call to\n*note resetpeak(): 759. can be meaningfully compared to snapshots\ntaken after the call.\n\nSee also *note gettracedmemory(): 3f80.\n\nNew in version 3.9.\n\n-- Function: tracemalloc.gettracemallocmemory ()\n\nGet the memory usage in bytes of the *note tracemalloc: fa. module\nused to store traces of memory blocks.  Return an *note int: 17e.\n\n-- Function: tracemalloc.istracing ()\n\n'True' if the *note tracemalloc: fa. module is tracing Python\nmemory allocations, 'False' otherwise.\n\nSee also *note start(): 1abe. and *note stop(): 3f84. functions.\n\n-- Function: tracemalloc.start (nframe: int = 1)\n\nStart tracing Python memory allocations: install hooks on Python\nmemory allocators.  Collected tracebacks of traces will be limited\nto 'nframe' frames.  By default, a trace of a memory block only\nstores the most recent frame: the limit is '1'.  'nframe' must be\ngreater or equal to '1'.\n\nYou can still read the original number of total frames that\ncomposed the traceback by looking at the *note\nTraceback.totalnframe: 3f89. attribute.\n\nStoring more than '1' frame is only useful to compute statistics\ngrouped by ''traceback'' or to compute cumulative statistics: see\nthe *note Snapshot.compareto(): 3f8a. and *note\nSnapshot.statistics(): 3f79. methods.\n\nStoring more frames increases the memory and CPU overhead of the\n*note tracemalloc: fa. module.  Use the *note\ngettracemallocmemory(): 3f87. function to measure how much memory\nis used by the *note tracemalloc: fa. module.\n\nThe *note PYTHONTRACEMALLOC: 1abf. environment variable\n('PYTHONTRACEMALLOC=NFRAME') and the *note -X: 188.\n'tracemalloc=NFRAME' command line option can be used to start\ntracing at startup.\n\nSee also *note stop(): 3f84, *note istracing(): 3f88. and *note\ngettracebacklimit(): 3f85. functions.\n\n-- Function: tracemalloc.stop ()\n\nStop tracing Python memory allocations: uninstall hooks on Python\nmemory allocators.  Also clears all previously collected traces of\nmemory blocks allocated by Python.\n\nCall *note takesnapshot(): 3f86. function to take a snapshot of\ntraces before clearing them.\n\nSee also *note start(): 1abe, *note istracing(): 3f88. and *note\ncleartraces(): 3f83. functions.\n\n-- Function: tracemalloc.takesnapshot ()\n\nTake a snapshot of traces of memory blocks allocated by Python.\nReturn a new *note Snapshot: 3f8b. instance.\n\nThe snapshot does not include memory blocks allocated before the\n*note tracemalloc: fa. module started to trace memory allocations.\n\nTracebacks of traces are limited to *note gettracebacklimit():\n3f85. frames.  Use the 'nframe' parameter of the *note start():\n1abe. function to store more frames.\n\nThe *note tracemalloc: fa. module must be tracing memory\nallocations to take a snapshot, see the *note start(): 1abe.\nfunction.\n\nSee also the *note getobjecttraceback(): 18db. function.\n\nFile: python3.12.info,  Node: DomainFilter,  Next: Filter,  Prev: Functions<11>,  Up: API\n\n5.27.8.9 DomainFilter\n.....................\n\n-- Class: tracemalloc.DomainFilter (inclusive: bool, domain: int)\n\nFilter traces of memory blocks by their address space (domain).\n\nNew in version 3.6.\n\n-- Attribute: inclusive\n\nIf 'inclusive' is 'True' (include), match memory blocks\nallocated in the address space *note domain: 3f8e.\n\nIf 'inclusive' is 'False' (exclude), match memory blocks not\nallocated in the address space *note domain: 3f8e.\n\n-- Attribute: domain\n\nAddress space of a memory block ('int').  Read-only property.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Filter,  Next: Frame,  Prev: DomainFilter,  Up: API": {
            "content": "5.27.8.10 Filter\n................\n\n-- Class: tracemalloc.Filter (inclusive: bool, filenamepattern: str,\nlineno: int = None, allframes: bool = False, domain: int =\nNone)\n\nFilter on traces of memory blocks.\n\nSee the *note fnmatch.fnmatch(): 1601. function for the syntax of\n'filenamepattern'.  The ''.pyc'' file extension is replaced with\n''.py''.\n\nExamples:\n\n* 'Filter(True, subprocess.file)' only includes traces of\nthe *note subprocess: d0. module\n\n* 'Filter(False, tracemalloc.file)' excludes traces of the\n*note tracemalloc: fa. module\n\n* 'Filter(False, \"<unknown>\")' excludes empty tracebacks\n\nChanged in version 3.5: The ''.pyo'' file extension is no longer\nreplaced with ''.py''.\n\nChanged in version 3.6: Added the *note domain: 3f91. attribute.\n\n-- Attribute: domain\n\nAddress space of a memory block ('int' or 'None').\n\ntracemalloc uses the domain '0' to trace memory allocations\nmade by Python.  C extensions can use other domains to trace\nother resources.\n\n-- Attribute: inclusive\n\nIf 'inclusive' is 'True' (include), only match memory blocks\nallocated in a file with a name matching *note\nfilenamepattern: 3f93. at line number *note lineno: 3f94.\n\nIf 'inclusive' is 'False' (exclude), ignore memory blocks\nallocated in a file with a name matching *note\nfilenamepattern: 3f93. at line number *note lineno: 3f94.\n\n-- Attribute: lineno\n\nLine number ('int') of the filter.  If 'lineno' is 'None', the\nfilter matches any line number.\n\n-- Attribute: filenamepattern\n\nFilename pattern of the filter ('str').  Read-only property.\n\n-- Attribute: allframes\n\nIf 'allframes' is 'True', all frames of the traceback are\nchecked.  If 'allframes' is 'False', only the most recent\nframe is checked.\n\nThis attribute has no effect if the traceback limit is '1'.\nSee the *note gettracebacklimit(): 3f85. function and *note\nSnapshot.tracebacklimit: 3f96. attribute.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Frame,  Next: Snapshot,  Prev: Filter,  Up: API": {
            "content": "5.27.8.11 Frame\n...............\n\n-- Class: tracemalloc.Frame\n\nFrame of a traceback.\n\nThe *note Traceback: 9d9. class is a sequence of *note Frame: 3f98.\ninstances.\n\n-- Attribute: filename\n\nFilename ('str').\n\n-- Attribute: lineno\n\nLine number ('int').\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Snapshot,  Next: Statistic,  Prev: Frame,  Up: API": {
            "content": "5.27.8.12 Snapshot\n..................\n\n-- Class: tracemalloc.Snapshot\n\nSnapshot of traces of memory blocks allocated by Python.\n\nThe *note takesnapshot(): 3f86. function creates a snapshot\ninstance.\n\n-- Method: compareto (oldsnapshot: Snapshot, keytype: str,\ncumulative: bool = False)\n\nCompute the differences with an old snapshot.  Get statistics\nas a sorted list of *note StatisticDiff: 3f9c. instances\ngrouped by 'keytype'.\n\nSee the *note Snapshot.statistics(): 3f79. method for\n'keytype' and 'cumulative' parameters.\n\nThe result is sorted from the biggest to the smallest by:\nabsolute value of *note StatisticDiff.sizediff: 3f9d, *note\nStatisticDiff.size: 3f9e, absolute value of *note\nStatisticDiff.countdiff: 3f9f, *note Statistic.count: 3fa0.\nand then by *note StatisticDiff.traceback: 3fa1.\n\n-- Method: dump (filename)\n\nWrite the snapshot into a file.\n\nUse *note load(): 3f7c. to reload the snapshot.\n\n-- Method: filtertraces (filters)\n\nCreate a new *note Snapshot: 3f8b. instance with a filtered\n*note traces: 3fa3. sequence, 'filters' is a list of *note\nDomainFilter: b41. and *note Filter: 3f90. instances.  If\n'filters' is an empty list, return a new *note Snapshot: 3f8b.\ninstance with a copy of the traces.\n\nAll inclusive filters are applied at once, a trace is ignored\nif no inclusive filters match it.  A trace is ignored if at\nleast one exclusive filter matches it.\n\nChanged in version 3.6: *note DomainFilter: b41. instances are\nnow also accepted in 'filters'.\n\n-- Method: classmethod load (filename)\n\nLoad a snapshot from a file.\n\nSee also *note dump(): 3f7b.\n\n-- Method: statistics (keytype: str, cumulative: bool = False)\n\nGet statistics as a sorted list of *note Statistic: 3fa4.\ninstances grouped by 'keytype':\n\nkeytype                  description\n\n-------------------------------------------------------\n\n''filename''              filename\n\n\n''lineno''                filename and line number\n\n\n''traceback''             traceback\n\n\nIf 'cumulative' is 'True', cumulate size and count of memory\nblocks of all frames of the traceback of a trace, not only the\nmost recent frame.  The cumulative mode can only be used with\n'keytype' equals to ''filename'' and ''lineno''.\n\nThe result is sorted from the biggest to the smallest by:\n*note Statistic.size: 3fa5, *note Statistic.count: 3fa0. and\nthen by *note Statistic.traceback: 3fa6.\n\n-- Attribute: tracebacklimit\n\nMaximum number of frames stored in the traceback of *note\ntraces: 3fa3.: result of the *note gettracebacklimit():\n3f85. when the snapshot was taken.\n\n-- Attribute: traces\n\nTraces of all memory blocks allocated by Python: sequence of\n*note Trace: 3fa7. instances.\n\nThe sequence has an undefined order.  Use the *note\nSnapshot.statistics(): 3f79. method to get a sorted list of\nstatistics.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Statistic,  Next: StatisticDiff,  Prev: Snapshot,  Up: API": {
            "content": "5.27.8.13 Statistic\n...................\n\n-- Class: tracemalloc.Statistic\n\nStatistic on memory allocations.\n\n*note Snapshot.statistics(): 3f79. returns a list of *note\nStatistic: 3fa4. instances.\n\nSee also the *note StatisticDiff: 3f9c. class.\n\n-- Attribute: count\n\nNumber of memory blocks ('int').\n\n-- Attribute: size\n\nTotal size of memory blocks in bytes ('int').\n\n-- Attribute: traceback\n\nTraceback where the memory block was allocated, *note\nTraceback: 9d9. instance.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: StatisticDiff,  Next: Trace,  Prev: Statistic,  Up: API": {
            "content": "5.27.8.14 StatisticDiff\n.......................\n\n-- Class: tracemalloc.StatisticDiff\n\nStatistic difference on memory allocations between an old and a new\n*note Snapshot: 3f8b. instance.\n\n*note Snapshot.compareto(): 3f8a. returns a list of *note\nStatisticDiff: 3f9c. instances.  See also the *note Statistic:\n3fa4. class.\n\n-- Attribute: count\n\nNumber of memory blocks in the new snapshot ('int'): '0' if\nthe memory blocks have been released in the new snapshot.\n\n-- Attribute: countdiff\n\nDifference of number of memory blocks between the old and the\nnew snapshots ('int'): '0' if the memory blocks have been\nallocated in the new snapshot.\n\n-- Attribute: size\n\nTotal size of memory blocks in bytes in the new snapshot\n('int'): '0' if the memory blocks have been released in the\nnew snapshot.\n\n-- Attribute: sizediff\n\nDifference of total size of memory blocks in bytes between the\nold and the new snapshots ('int'): '0' if the memory blocks\nhave been allocated in the new snapshot.\n\n-- Attribute: traceback\n\nTraceback where the memory blocks were allocated, *note\nTraceback: 9d9. instance.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Trace,  Next: Traceback,  Prev: StatisticDiff,  Up: API": {
            "content": "5.27.8.15 Trace\n...............\n\n-- Class: tracemalloc.Trace\n\nTrace of a memory block.\n\nThe *note Snapshot.traces: 3fa3. attribute is a sequence of *note\nTrace: 3fa7. instances.\n\nChanged in version 3.6: Added the *note domain: 3fac. attribute.\n\n-- Attribute: domain\n\nAddress space of a memory block ('int').  Read-only property.\n\ntracemalloc uses the domain '0' to trace memory allocations\nmade by Python.  C extensions can use other domains to trace\nother resources.\n\n-- Attribute: size\n\nSize of the memory block in bytes ('int').\n\n-- Attribute: traceback\n\nTraceback where the memory block was allocated, *note\nTraceback: 9d9. instance.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Traceback,  Prev: Trace,  Up: API": {
            "content": "5.27.8.16 Traceback\n...................\n\n-- Class: tracemalloc.Traceback\n\nSequence of *note Frame: 3f98. instances sorted from the oldest\nframe to the most recent frame.\n\nA traceback contains at least '1' frame.  If the 'tracemalloc'\nmodule failed to get a frame, the filename '\"<unknown>\"' at line\nnumber '0' is used.\n\nWhen a snapshot is taken, tracebacks of traces are limited to *note\ngettracebacklimit(): 3f85. frames.  See the *note\ntakesnapshot(): 3f86. function.  The original number of frames of\nthe traceback is stored in the *note Traceback.totalnframe: 3f89.\nattribute.  That allows to know if a traceback has been truncated\nby the traceback limit.\n\nThe *note Trace.traceback: 3fae. attribute is an instance of *note\nTraceback: 9d9. instance.\n\nChanged in version 3.7: Frames are now sorted from the oldest to\nthe most recent, instead of most recent to oldest.\n\n-- Attribute: totalnframe\n\nTotal number of frames that composed the traceback before\ntruncation.  This attribute can be set to 'None' if the\ninformation is not available.\n\nChanged in version 3.9: The *note Traceback.totalnframe: 3f89.\nattribute was added.\n\n-- Method: format (limit=None, mostrecentfirst=False)\n\nFormat the traceback as a list of lines.  Use the *note\nlinecache: 80. module to retrieve lines from the source code.\nIf 'limit' is set, format the 'limit' most recent frames if\n'limit' is positive.  Otherwise, format the 'abs(limit)'\noldest frames.  If 'mostrecentfirst' is 'True', the order of\nthe formatted frames is reversed, returning the most recent\nframe first instead of last.\n\nSimilar to the *note traceback.formattb(): 3fb0. function,\nexcept that *note format(): 9da. does not include newlines.\n\nExample:\n\nprint(\"Traceback (most recent call first):\")\nfor line in traceback:\nprint(line)\n\nOutput:\n\nTraceback (most recent call first):\nFile \"test.py\", line 9\nobj = Object()\nFile \"test.py\", line 12\ntb = tracemalloc.getobjecttraceback(f())\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Software Packaging and Distribution,  Next: Python Runtime Services,  Prev: Debugging and Profiling,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.28 Software Packaging and Distribution",
                    "content": "These libraries help you with publishing and installing Python software."
                }
            ]
        },
        "While these modules are designed to work in conjunction with the Python": {
            "content": "",
            "subsections": []
        },
        "Package Index(1), they can also be used with a local index server, or": {
            "content": "without any index server at all.\n\n* Menu:\n\n* ensurepip -- Bootstrapping the pip installer::\n* venv -- Creation of virtual environments::\n* zipapp -- Manage executable Python zip archives::\n\n---------- Footnotes ----------\n\n(1) https://pypi.org\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ensurepip -- Bootstrapping the pip installer,  Next: venv -- Creation of virtual environments,  Up: Software Packaging and Distribution": {
            "content": "New in version 3.4.\n\n'Source code:' Lib/ensurepip(1)\n\n\n\nThe *note ensurepip: 50. package provides support for bootstrapping the\n'pip' installer into an existing Python installation or virtual\nenvironment.  This bootstrapping approach reflects the fact that 'pip'\nis an independent project with its own release cycle, and the latest\navailable stable version is bundled with maintenance and feature\nreleases of the CPython reference interpreter.\n",
            "subsections": []
        },
        "In most cases, end users of Python shouldn't need to invoke this module": {
            "content": "directly (as 'pip' should be bootstrapped by default), but it may be\nneeded if installing 'pip' was skipped when installing Python (or when\ncreating a virtual environment) or after explicitly uninstalling 'pip'.\n\nNote: This module 'does not' access the internet.  All of the\ncomponents needed to bootstrap 'pip' are included as internal parts\nof the package.\n\nSee also\n........\n\n*note Installing Python Modules: d5c.\n\nThe end user guide for installing Python packages\n\nPEP 453(2): Explicit bootstrapping of pip in Python installations\n\nThe original rationale and specification for this module.\n\n*note Availability: 1ad3.: not Emscripten, not WASI.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Command line interface,  Next: Module API,  Up: ensurepip -- Bootstrapping the pip installer": {
            "content": "5.28.1.1 Command line interface\n...............................\n",
            "subsections": []
        },
        "The command line interface is invoked using the interpreter's '-m'": {
            "content": "switch.\n\nThe simplest possible invocation is:\n\npython -m ensurepip\n",
            "subsections": []
        },
        "This invocation will install 'pip' if it is not already installed, but": {
            "content": "otherwise does nothing.  To ensure the installed version of 'pip' is at\nleast as recent as the one available in 'ensurepip', pass the\n'--upgrade' option:\n\npython -m ensurepip --upgrade\n",
            "subsections": []
        },
        "By default, 'pip' is installed into the current virtual environment (if": {
            "content": "one is active) or into the system site packages (if there is no active\nvirtual environment).  The installation location can be controlled\nthrough two additional command line options:\n\n* '--root DIR': Installs 'pip' relative to the given root directory\nrather than the root of the currently active virtual environment\n(if any) or the default root for the current Python installation.\n\n* '--user': Installs 'pip' into the user site packages directory\nrather than globally for the current Python installation (this\noption is not permitted inside an active virtual environment).\n",
            "subsections": []
        },
        "By default, the scripts 'pipX' and 'pipX.Y' will be installed (where X.Y": {
            "content": "stands for the version of Python used to invoke 'ensurepip').  The\nscripts installed can be controlled through two additional command line\noptions:\n\n* '--altinstall': if an alternate installation is requested, the\n'pipX' script will 'not' be installed.\n\n* '--default-pip': if a \"default pip\" installation is requested, the\n'pip' script will be installed in addition to the two regular\nscripts.\n",
            "subsections": []
        },
        "Providing both of the script selection options will trigger an": {
            "content": "exception.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Module API,  Prev: Command line interface,  Up: ensurepip -- Bootstrapping the pip installer": {
            "content": "5.28.1.2 Module API\n...................\n\n*note ensurepip: 50. exposes two functions for programmatic use:\n\n-- Function: ensurepip.version ()\n\nReturns a string specifying the available version of pip that will\nbe installed when bootstrapping an environment.\n\n-- Function: ensurepip.bootstrap (root=None, upgrade=False, user=False,\naltinstall=False, defaultpip=False, verbosity=0)\n\nBootstraps 'pip' into the current or designated environment.\n\n'root' specifies an alternative root directory to install relative\nto.  If 'root' is 'None', then installation uses the default\ninstall location for the current environment.\n\n'upgrade' indicates whether or not to upgrade an existing\ninstallation of an earlier version of 'pip' to the available\nversion.\n\n'user' indicates whether to use the user scheme rather than\ninstalling globally.\n\nBy default, the scripts 'pipX' and 'pipX.Y' will be installed\n(where X.Y stands for the current version of Python).\n\nIf 'altinstall' is set, then 'pipX' will 'not' be installed.\n\nIf 'defaultpip' is set, then 'pip' will be installed in addition\nto the two regular scripts.\n\nSetting both 'altinstall' and 'defaultpip' will trigger *note\nValueError: 183.\n\n'verbosity' controls the level of output to *note sys.stdout: 90c.\nfrom the bootstrapping operation.\n\nRaises an *note auditing event: 161d. 'ensurepip.bootstrap' with\nargument 'root'.\n\nNote: The bootstrapping process has side effects on both\n'sys.path' and 'os.environ'.  Invoking the command line\ninterface in a subprocess instead allows these side effects to\nbe avoided.\n\nNote: The bootstrapping process may install additional modules\nrequired by 'pip', but other software should not assume those\ndependencies will always be present by default (as the\ndependencies may be removed in a future version of 'pip').\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "New in version 3.3.\n\n'Source code:' Lib/venv/(1)\n\n\n\nThe 'venv' module supports creating lightweight \"virtual environments\",\neach with their own independent set of Python packages installed in\ntheir *note site: c2. directories.  A virtual environment is created on\ntop of an existing Python installation, known as the virtual\nenvironment's \"base\" Python, and may optionally be isolated from the\npackages in the base environment, so only those explicitly installed in\nthe virtual environment are available.\n",
            "subsections": []
        },
        "When used from within a virtual environment, common installation tools": {
            "content": "such as pip(2) will install Python packages into a virtual environment\nwithout needing to be told to do so explicitly.\n\nA virtual environment is (amongst other things):\n\n* Used to contain a specific Python interpreter and software\nlibraries and binaries which are needed to support a project\n(library or application).  These are by default isolated from\nsoftware in other virtual environments and Python interpreters and\nlibraries installed in the operating system.\n\n* Contained in a directory, conventionally either named 'venv' or\n'.venv' in the project directory, or under a container directory\nfor lots of virtual environments, such as '~/.virtualenvs'.\n\n* Not checked into source control systems such as Git.\n\n* Considered as disposable - it should be simple to delete and\nrecreate it from scratch.  You don't place any project code in the\nenvironment\n\n* Not considered as movable or copyable - you just recreate the same\nenvironment in the target location.\n\nSee PEP 405(3) for more background on Python virtual environments.\n\nSee also\n........\n",
            "subsections": []
        },
        "Python Packaging User Guide: Creating and using virtual environments(4)": {
            "content": "---------- Footnotes ----------\n\n(1) https://pypi.org\n\n(2) https://www.pypa.io/\n\n(3) https://github.com/pypa\n\n(4)\nhttps://packaging.python.org/installing/#creating-virtual-environments\n\nFile: python3.12.info,  Node: Basic usage,  Next: How do I ...?,  Prev: Key terms,  Up: Installing Python Modules\n",
            "subsections": [
                {
                    "name": "8.2 Basic usage",
                    "content": ""
                }
            ]
        },
        "File: python3.12.info,  Node: Creating virtual environments,  Next: How venvs work,  Up: venv -- Creation of virtual environments": {
            "content": "5.28.2.1 Creating virtual environments\n......................................\n\nCreation of *note virtual environments: 3fba. is done by executing the\ncommand 'venv':\n\npython -m venv /path/to/new/virtual/environment\n",
            "subsections": []
        },
        "Running this command creates the target directory (creating any parent": {
            "content": "directories that don't exist already) and places a 'pyvenv.cfg' file in\nit with a 'home' key pointing to the Python installation from which the\ncommand was run (a common name for the target directory is '.venv').  It\nalso creates a 'bin' (or 'Scripts' on Windows) subdirectory containing a\ncopy/symlink of the Python binary/binaries (as appropriate for the\nplatform or arguments used at environment creation time).  It also\ncreates an (initially empty) 'lib/pythonX.Y/site-packages' subdirectory\n(on Windows, this is 'Lib\\site-packages').  If an existing directory is\nspecified, it will be re-used.\n",
            "subsections": []
        },
        "Changed in version 3.5: The use of 'venv' is now recommended for": {
            "content": "creating virtual environments.\n\nSee also\n........\n",
            "subsections": []
        },
        "Deprecated since version 3.6: 'pyvenv' was the recommended tool for": {
            "content": "creating virtual environments for Python 3.3 and 3.4, and is *note\ndeprecated in Python 3.6: b87.\n\nOn Windows, invoke the 'venv' command as follows:\n\nc:\\>Python35\\python -m venv c:\\path\\to\\myenv\n",
            "subsections": []
        },
        "Alternatively, if you configured the 'PATH' and 'PATHEXT' variables for": {
            "content": "your *note Python installation: 8dc.:\n\nc:\\>python -m venv c:\\path\\to\\myenv\n\nThe command, if run with '-h', will show the available options:\n\nusage: venv [-h] [--system-site-packages] [--symlinks | --copies] [--clear]\n[--upgrade] [--without-pip] [--prompt PROMPT] [--upgrade-deps]\nENVDIR [ENVDIR ...]\n\nCreates virtual Python environments in one or more target directories.\n\npositional arguments:\nENVDIR               A directory to create the environment in.\n\noptional arguments:\n-h, --help            show this help message and exit",
            "subsections": [
                {
                    "name": "--system-site-packages",
                    "content": "Give the virtual environment access to the system\nsite-packages dir.\n--symlinks            Try to use symlinks rather than copies, when symlinks\nare not the default for the platform.\n--copies              Try to use copies rather than symlinks, even when\nsymlinks are the default for the platform.\n--clear               Delete the contents of the environment directory if it\nalready exists, before environment creation.\n--upgrade             Upgrade the environment directory to use this version\nof Python, assuming Python has been upgraded in-place.\n--without-pip         Skips installing or upgrading pip in the virtual\nenvironment (pip is bootstrapped by default)\n--prompt PROMPT       Provides an alternative prompt prefix for this\nenvironment.\n--upgrade-deps        Upgrade core dependencies (pip) to the\nlatest version in PyPI\n\nOnce an environment has been created, you may wish to activate it, e.g. by\nsourcing an activate script in its bin directory.\n",
                    "long": "--system-site-packages"
                }
            ]
        },
        "Changed in version 3.12: 'setuptools' is no longer a core venv": {
            "content": "dependency.\n\nChanged in version 3.9: Add '--upgrade-deps' option to upgrade pip +\nsetuptools to the latest on PyPI\n",
            "subsections": []
        },
        "Changed in version 3.4: Installs pip by default, added the": {
            "content": "'--without-pip' and '--copies' options\n",
            "subsections": []
        },
        "Changed in version 3.4: In earlier versions, if the target directory": {
            "content": "already existed, an error was raised, unless the '--clear' or\n'--upgrade' option was provided.\n\nNote: While symlinks are supported on Windows, they are not\nrecommended.  Of particular note is that double-clicking\n'python.exe' in File Explorer will resolve the symlink eagerly and\nignore the virtual environment.\n\nNote: On Microsoft Windows, it may be required to enable the\n'Activate.ps1' script by setting the execution policy for the user.\nYou can do this by issuing the following PowerShell command:\n\nPS C:> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope\nCurrentUser\n\nSee About Execution Policies(1) for more information.\n",
            "subsections": []
        },
        "The created 'pyvenv.cfg' file also includes the": {
            "content": "'include-system-site-packages' key, set to 'true' if 'venv' is run with\nthe '--system-site-packages' option, 'false' otherwise.\n\nUnless the '--without-pip' option is given, *note ensurepip: 50. will be\ninvoked to bootstrap 'pip' into the virtual environment.\n",
            "subsections": []
        },
        "Multiple paths can be given to 'venv', in which case an identical": {
            "content": "virtual environment will be created, according to the given options, at\neach provided path.\n\n---------- Footnotes ----------\n\n(1) https://go.microsoft.com/fwlink/?LinkID=135170\n\nFile: python3.12.info,  Node: How venvs work,  Next: API<2>,  Prev: Creating virtual environments,  Up: venv -- Creation of virtual environments\n\n5.28.2.2 How venvs work\n.......................\n\nWhen a Python interpreter is running from a virtual environment, *note\nsys.prefix: 32e. and *note sys.execprefix: 32a. point to the\ndirectories of the virtual environment, whereas *note sys.baseprefix:\n391e. and *note sys.baseexecprefix: 3fbe. point to those of the base",
            "subsections": []
        },
        "Python used to create the environment.  It is sufficient to check": {
            "content": "'sys.prefix != sys.baseprefix' to determine if the current interpreter\nis running from a virtual environment.\n\nA virtual environment may be \"activated\" using a script in its binary\ndirectory ('bin' on POSIX; 'Scripts' on Windows).  This will prepend\nthat directory to your 'PATH', so that running 'python' will invoke the\nenvironment's Python interpreter and you can run installed scripts\nwithout having to use their full path.  The invocation of the activation\nscript is platform-specific ('<VENV>' must be replaced by the path to\nthe directory containing the virtual environment):\n",
            "subsections": []
        },
        "Platform          Shell            Command to activate virtual environment": {
            "content": "------------------------------------------------------------------------------------------\n\nPOSIX             bash/zsh         '$ source <VENV>/bin/activate'\n\n\nfish              '$ source\n<VENV>/bin/activate.fish'\n\n\ncsh/tcsh          '$ source\n<VENV>/bin/activate.csh'\n\n\nPowerShell        '$\n<VENV>/bin/Activate.ps1'\n\n\nWindows           cmd.exe          'C:\\> <VENV>\\Scripts\\activate.bat'\n\n\nPowerShell        'PS C:\\>\n<VENV>\\Scripts\\Activate.ps1'\n\n\nNew in version 3.4: 'fish' and 'csh' activation scripts.\n",
            "subsections": []
        },
        "New in version 3.8: PowerShell activation scripts installed under POSIX": {
            "content": "for PowerShell Core support.\n",
            "subsections": []
        },
        "You don't specifically 'need' to activate a virtual environment, as you": {
            "content": "can just specify the full path to that environment's Python interpreter\nwhen invoking Python.  Furthermore, all scripts installed in the\nenvironment should be runnable without activating it.\n",
            "subsections": []
        },
        "In order to achieve this, scripts installed into virtual environments": {
            "content": "have a \"shebang\" line which points to the environment's Python\ninterpreter, i.e.  '#!/<PATH-TO-VENV>/bin/python'.  This means that the\nscript will run with that interpreter regardless of the value of 'PATH'.\nOn Windows, \"shebang\" line processing is supported if you have the *note",
            "subsections": []
        },
        "Python Launcher for Windows: 37f. installed.  Thus, double-clicking an": {
            "content": "installed script in a Windows Explorer window should run it with the\ncorrect interpreter without the environment needing to be activated or\non the 'PATH'.\n",
            "subsections": []
        },
        "When a virtual environment has been activated, the 'VIRTUALENV'": {
            "content": "environment variable is set to the path of the environment.  Since\nexplicitly activating a virtual environment is not required to use it,\n'VIRTUALENV' cannot be relied upon to determine whether a virtual\nenvironment is being used.\n\nWarning: Because scripts installed in environments should not\nexpect the environment to be activated, their shebang lines contain\nthe absolute paths to their environment's interpreters.  Because of\nthis, environments are inherently non-portable, in the general\ncase.  You should always have a simple means of recreating an\nenvironment (for example, if you have a requirements file\n'requirements.txt', you can invoke 'pip install -r\nrequirements.txt' using the environment's 'pip' to install all of\nthe packages needed by the environment).  If for any reason you\nneed to move the environment to a new location, you should recreate\nit at the desired location and delete the one at the old location.\nIf you move an environment because you moved a parent directory of\nit, you should recreate the environment in its new location.\nOtherwise, software installed into the environment may not work as\nexpected.\n",
            "subsections": []
        },
        "You can deactivate a virtual environment by typing 'deactivate' in your": {
            "content": "shell.  The exact mechanism is platform-specific and is an internal\nimplementation detail (typically, a script or shell function will be\nused).\n\nFile: python3.12.info,  Node: API<2>,  Next: An example of extending EnvBuilder,  Prev: How venvs work,  Up: venv -- Creation of virtual environments\n\n5.28.2.3 API\n............\n",
            "subsections": []
        },
        "The high-level method described above makes use of a simple API which": {
            "content": "provides mechanisms for third-party virtual environment creators to\ncustomize environment creation according to their needs, the *note\nEnvBuilder: e5b. class.\n\n-- Class: venv.EnvBuilder (systemsitepackages=False, clear=False,\nsymlinks=False, upgrade=False, withpip=False, prompt=None,\nupgradedeps=False)\n\nThe *note EnvBuilder: e5b. class accepts the following keyword\narguments on instantiation:\n\n* 'systemsitepackages' - a Boolean value indicating that the\nsystem Python site-packages should be available to the\nenvironment (defaults to 'False').\n\n* 'clear' - a Boolean value which, if true, will delete the\ncontents of any existing target directory, before creating the\nenvironment.\n\n* 'symlinks' - a Boolean value indicating whether to attempt to\nsymlink the Python binary rather than copying.\n\n* 'upgrade' - a Boolean value which, if true, will upgrade an\nexisting environment with the running Python - for use when\nthat Python has been upgraded in-place (defaults to 'False').\n\n* 'withpip' - a Boolean value which, if true, ensures pip is\ninstalled in the virtual environment.  This uses *note\nensurepip: 50. with the '--default-pip' option.\n\n* 'prompt' - a String to be used after virtual environment is\nactivated (defaults to 'None' which means directory name of\nthe environment would be used).  If the special string '\".\"'\nis provided, the basename of the current directory is used as\nthe prompt.\n\n* 'upgradedeps' - Update the base venv modules to the latest on\nPyPI\n\nChanged in version 3.4: Added the 'withpip' parameter\n\nChanged in version 3.6: Added the 'prompt' parameter\n\nChanged in version 3.9: Added the 'upgradedeps' parameter\n\nCreators of third-party virtual environment tools will be free to\nuse the provided *note EnvBuilder: e5b. class as a base class.\n\nThe returned env-builder is an object which has a method, 'create':\n\n-- Method: create (envdir)\n\nCreate a virtual environment by specifying the target\ndirectory (absolute or relative to the current directory)\nwhich is to contain the virtual environment.  The 'create'\nmethod will either create the environment in the specified\ndirectory, or raise an appropriate exception.\n\nThe 'create' method of the *note EnvBuilder: e5b. class\nillustrates the hooks available for subclass customization:\n\ndef create(self, envdir):\n\"\"\"\nCreate a virtualized Python environment in a directory.\nenvdir is the target directory to create an environment in.\n\"\"\"\nenvdir = os.path.abspath(envdir)\ncontext = self.ensuredirectories(envdir)\nself.createconfiguration(context)\nself.setuppython(context)\nself.setupscripts(context)\nself.postsetup(context)\n\nEach of the methods *note ensuredirectories(): 3fc1, *note\ncreateconfiguration(): 3fc2, *note setuppython(): 3fc3,\n*note setupscripts(): 3fc4. and *note postsetup(): 3fc5. can\nbe overridden.\n\n-- Method: ensuredirectories (envdir)\n\nCreates the environment directory and all necessary\nsubdirectories that don't already exist, and returns a context\nobject.  This context object is just a holder for attributes\n(such as paths) for use by the other methods.  If the *note\nEnvBuilder: e5b. is created with the arg 'clear=True',\ncontents of the environment directory will be cleared and then\nall necessary subdirectories will be recreated.\n\nThe returned context object is a *note types.SimpleNamespace:\n745. with the following attributes:\n\n* 'envdir' - The location of the virtual environment.\nUsed for 'VENVDIR' in activation scripts (see *note\ninstallscripts(): 3fc6.).\n\n* 'envname' - The name of the virtual environment.  Used\nfor 'VENVNAME' in activation scripts (see *note\ninstallscripts(): 3fc6.).\n\n* 'prompt' - The prompt to be used by the activation\nscripts.  Used for 'VENVPROMPT' in activation\nscripts (see *note installscripts(): 3fc6.).\n\n* 'executable' - The underlying Python executable used by\nthe virtual environment.  This takes into account the\ncase where a virtual environment is created from another\nvirtual environment.\n\n* 'incpath' - The include path for the virtual\nenvironment.\n\n* 'libpath' - The purelib path for the virtual\nenvironment.\n\n* 'binpath' - The script path for the virtual environment.\n\n* 'binname' - The name of the script path relative to the\nvirtual environment location.  Used for\n'VENVBINNAME' in activation scripts (see *note\ninstallscripts(): 3fc6.).\n\n* 'envexe' - The name of the Python interpreter in the\nvirtual environment.  Used for 'VENVPYTHON' in\nactivation scripts (see *note installscripts(): 3fc6.).\n\n* 'envexeccmd' - The name of the Python interpreter,\ntaking into account filesystem redirections.  This can be\nused to run Python in the virtual environment.\n\nChanged in version 3.11: The 'venv' *note sysconfig\ninstallation scheme: 45b. is used to construct the paths of\nthe created directories.\n\nChanged in version 3.12: The attribute 'libpath' was added to\nthe context, and the context object was documented.\n\n-- Method: createconfiguration (context)\n\nCreates the 'pyvenv.cfg' configuration file in the\nenvironment.\n\n-- Method: setuppython (context)\n\nCreates a copy or symlink to the Python executable in the\nenvironment.  On POSIX systems, if a specific executable\n'python3.x' was used, symlinks to 'python' and 'python3' will\nbe created pointing to that executable, unless files with\nthose names already exist.\n\n-- Method: setupscripts (context)\n\nInstalls activation scripts appropriate to the platform into\nthe virtual environment.\n\n-- Method: upgradedependencies (context)\n\nUpgrades the core venv dependency packages (currently 'pip')\nin the environment.  This is done by shelling out to the 'pip'\nexecutable in the environment.\n\nNew in version 3.9.\n\nChanged in version 3.12: 'setuptools' is no longer a core venv\ndependency.\n\n-- Method: postsetup (context)\n\nA placeholder method which can be overridden in third party\nimplementations to pre-install packages in the virtual\nenvironment or perform other post-creation steps.\n\nChanged in version 3.7.2: Windows now uses redirector scripts for\n'python[w].exe' instead of copying the actual binaries.  In 3.7.2\nonly *note setuppython(): 3fc3. does nothing unless running from a\nbuild in the source tree.\n\nChanged in version 3.7.3: Windows copies the redirector scripts as\npart of *note setuppython(): 3fc3. instead of *note\nsetupscripts(): 3fc4.  This was not the case in 3.7.2.  When using\nsymlinks, the original executables will be linked.\n\nIn addition, *note EnvBuilder: e5b. provides this utility method\nthat can be called from *note setupscripts(): 3fc4. or *note\npostsetup(): 3fc5. in subclasses to assist in installing custom\nscripts into the virtual environment.\n\n-- Method: installscripts (context, path)\n\n'path' is the path to a directory that should contain\nsubdirectories \"common\", \"posix\", \"nt\", each containing\nscripts destined for the bin directory in the environment.\nThe contents of \"common\" and the directory corresponding to\n*note os.name: 27f7. are copied after some text replacement of\nplaceholders:\n\n* 'VENVDIR' is replaced with the absolute path of the\nenvironment directory.\n\n* 'VENVNAME' is replaced with the environment name\n(final path segment of environment directory).\n\n* 'VENVPROMPT' is replaced with the prompt (the\nenvironment name surrounded by parentheses and with a\nfollowing space)\n\n* 'VENVBINNAME' is replaced with the name of the bin\ndirectory (either 'bin' or 'Scripts').\n\n* 'VENVPYTHON' is replaced with the absolute path of\nthe environment's executable.\n\nThe directories are allowed to exist (for when an existing\nenvironment is being upgraded).\n\nThere is also a module-level convenience function:\n\n-- Function: venv.create (envdir, systemsitepackages=False,\nclear=False, symlinks=False, withpip=False, prompt=None,\nupgradedeps=False)\n\nCreate an *note EnvBuilder: e5b. with the given keyword arguments,\nand call its *note create(): 3fc0. method with the 'envdir'\nargument.\n\nNew in version 3.3.\n\nChanged in version 3.4: Added the 'withpip' parameter\n\nChanged in version 3.6: Added the 'prompt' parameter\n\nChanged in version 3.9: Added the 'upgradedeps' parameter\n\nFile: python3.12.info,  Node: An example of extending EnvBuilder,  Prev: API<2>,  Up: venv -- Creation of virtual environments\n\n5.28.2.4 An example of extending 'EnvBuilder'\n.............................................\n\nThe following script shows how to extend *note EnvBuilder: e5b. by\nimplementing a subclass which installs setuptools and pip into a created\nvirtual environment:\n\nimport os\nimport os.path\nfrom subprocess import Popen, PIPE\nimport sys\nfrom threading import Thread\nfrom urllib.parse import urlparse\nfrom urllib.request import urlretrieve\nimport venv\n\nclass ExtendedEnvBuilder(venv.EnvBuilder):\n\"\"\"\nThis builder installs setuptools and pip so that you can pip or\neasyinstall other packages into the created virtual environment.\n\n:param nodist: If true, setuptools and pip are not installed into the\ncreated virtual environment.\n:param nopip: If true, pip is not installed into the created\nvirtual environment.\n:param progress: If setuptools or pip are installed, the progress of the\ninstallation can be monitored by passing a progress\ncallable. If specified, it is called with two\narguments: a string indicating some progress, and a\ncontext indicating where the string is coming from.\nThe context argument can have one of three values:\n'main', indicating that it is called from virtualize()\nitself, and 'stdout' and 'stderr', which are obtained\nby reading lines from the output streams of a subprocess\nwhich is used to install the app.\n\nIf a callable is not specified, default progress\ninformation is output to sys.stderr.\n\"\"\"\n\ndef init(self, *args, kwargs):\nself.nodist = kwargs.pop('nodist', False)\nself.nopip = kwargs.pop('nopip', False)\nself.progress = kwargs.pop('progress', None)\nself.verbose = kwargs.pop('verbose', False)\nsuper().init(*args, kwargs)\n\ndef postsetup(self, context):\n\"\"\"\nSet up any packages which need to be pre-installed into the\nvirtual environment being created.\n\n:param context: The information for the virtual environment\ncreation request being processed.\n\"\"\"\nos.environ['VIRTUALENV'] = context.envdir\nif not self.nodist:\nself.installsetuptools(context)\n# Can't install pip without setuptools\nif not self.nopip and not self.nodist:\nself.installpip(context)\n\ndef reader(self, stream, context):\n\"\"\"\nRead lines from a subprocess' output stream and either pass to a progress\ncallable (if specified) or write progress information to sys.stderr.\n\"\"\"\nprogress = self.progress\nwhile True:\ns = stream.readline()\nif not s:\nbreak\nif progress is not None:\nprogress(s, context)\nelse:\nif not self.verbose:\nsys.stderr.write('.')\nelse:\nsys.stderr.write(s.decode('utf-8'))\nsys.stderr.flush()\nstream.close()\n\ndef installscript(self, context, name, url):\n, , path, , ,  = urlparse(url)\nfn = os.path.split(path)[-1]\nbinpath = context.binpath\ndistpath = os.path.join(binpath, fn)\n# Download script into the virtual environment's binaries folder\nurlretrieve(url, distpath)\nprogress = self.progress\nif self.verbose:\nterm = '\\n'\nelse:\nterm = ''\nif progress is not None:\nprogress('Installing %s ...%s' % (name, term), 'main')\nelse:\nsys.stderr.write('Installing %s ...%s' % (name, term))\nsys.stderr.flush()\n# Install in the virtual environment\nargs = [context.envexe, fn]\np = Popen(args, stdout=PIPE, stderr=PIPE, cwd=binpath)\nt1 = Thread(target=self.reader, args=(p.stdout, 'stdout'))\nt1.start()\nt2 = Thread(target=self.reader, args=(p.stderr, 'stderr'))\nt2.start()\np.wait()\nt1.join()\nt2.join()\nif progress is not None:\nprogress('done.', 'main')\nelse:\nsys.stderr.write('done.\\n')\n# Clean up - no longer needed\nos.unlink(distpath)\n\ndef installsetuptools(self, context):\n\"\"\"\nInstall setuptools in the virtual environment.\n\n:param context: The information for the virtual environment\ncreation request being processed.\n\"\"\"\nurl = \"https://bootstrap.pypa.io/ezsetup.py\"\nself.installscript(context, 'setuptools', url)\n# clear up the setuptools archive which gets downloaded\npred = lambda o: o.startswith('setuptools-') and o.endswith('.tar.gz')\nfiles = filter(pred, os.listdir(context.binpath))\nfor f in files:\nf = os.path.join(context.binpath, f)\nos.unlink(f)\n\ndef installpip(self, context):\n\"\"\"\nInstall pip in the virtual environment.\n\n:param context: The information for the virtual environment\ncreation request being processed.\n\"\"\"\nurl = 'https://bootstrap.pypa.io/get-pip.py'\nself.installscript(context, 'pip', url)\n\n\ndef main(args=None):\nimport argparse\n\nparser = argparse.ArgumentParser(prog=name,\ndescription='Creates virtual Python '\n'environments in one or '\n'more target '\n'directories.')\nparser.addargument('dirs', metavar='ENVDIR', nargs='+',\nhelp='A directory in which to create the '\n'virtual environment.')\nparser.addargument('--no-setuptools', default=False,\naction='storetrue', dest='nodist',\nhelp=\"Don't install setuptools or pip in the \"\n\"virtual environment.\")\nparser.addargument('--no-pip', default=False,\naction='storetrue', dest='nopip',\nhelp=\"Don't install pip in the virtual \"\n\"environment.\")\nparser.addargument('--system-site-packages', default=False,\naction='storetrue', dest='systemsite',\nhelp='Give the virtual environment access to the '\n'system site-packages dir.')\nif os.name == 'nt':\nusesymlinks = False\nelse:\nusesymlinks = True\nparser.addargument('--symlinks', default=usesymlinks,\naction='storetrue', dest='symlinks',\nhelp='Try to use symlinks rather than copies, '\n'when symlinks are not the default for '\n'the platform.')\nparser.addargument('--clear', default=False, action='storetrue',\ndest='clear', help='Delete the contents of the '\n'virtual environment '\n'directory if it already '\n'exists, before virtual '\n'environment creation.')\nparser.addargument('--upgrade', default=False, action='storetrue',\ndest='upgrade', help='Upgrade the virtual '\n'environment directory to '\n'use this version of '\n'Python, assuming Python '\n'has been upgraded '\n'in-place.')\nparser.addargument('--verbose', default=False, action='storetrue',\ndest='verbose', help='Display the output '\n'from the scripts which '\n'install setuptools and pip.')\noptions = parser.parseargs(args)\nif options.upgrade and options.clear:\nraise ValueError('you cannot supply --upgrade and --clear together.')\nbuilder = ExtendedEnvBuilder(systemsitepackages=options.systemsite,\nclear=options.clear,\nsymlinks=options.symlinks,\nupgrade=options.upgrade,\nnodist=options.nodist,\nnopip=options.nopip,\nverbose=options.verbose)\nfor d in options.dirs:\nbuilder.create(d)\n\nif name == 'main':\nrc = 1\ntry:\nmain()\nrc = 0\nexcept Exception as e:\nprint('Error: %s' % e, file=sys.stderr)\nsys.exit(rc)\n\nThis script is also available for download online(1).\n\n---------- Footnotes ----------\n\n(1) https://gist.github.com/vsajip/4673395\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: zipapp -- Manage executable Python zip archives,  Prev: venv -- Creation of virtual environments,  Up: Software Packaging and Distribution": {
            "content": "New in version 3.5.\n\n'Source code:' Lib/zipapp.py(1)\n\n\n",
            "subsections": []
        },
        "This module provides tools to manage the creation of zip files": {
            "content": "containing Python code, which can be *note executed directly by the\nPython interpreter: 1aac.  The module provides both a *note Command-Line\nInterface: 3fcb. and a *note Python API: 3fcc.\n\n* Menu:\n\n* Basic Example::\n* Command-Line Interface: Command-Line Interface<5>.\n* Python API::\n* Examples: Examples<31>.\n* Specifying the Interpreter::\n* Creating Standalone Applications with zipapp::\n* The Python Zip Application Archive Format::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/zipapp.py\n\nFile: python3.12.info,  Node: Basic Example,  Next: Command-Line Interface<5>,  Up: zipapp -- Manage executable Python zip archives\n\n5.28.3.1 Basic Example\n......................\n\nThe following example shows how the *note Command-Line Interface: 3fcb.\ncan be used to create an executable archive from a directory containing",
            "subsections": []
        },
        "Python code.  When run, the archive will execute the 'main' function": {
            "content": "from the module 'myapp' in the archive.\n\n$ python -m zipapp myapp -m \"myapp:main\"\n$ python myapp.pyz\n<output from myapp>\n\nFile: python3.12.info,  Node: Command-Line Interface<5>,  Next: Python API,  Prev: Basic Example,  Up: zipapp -- Manage executable Python zip archives\n\n5.28.3.2 Command-Line Interface\n...............................\n",
            "subsections": []
        },
        "If 'source' is a directory, this will create an archive from the": {
            "content": "contents of 'source'.  If 'source' is a file, it should be an archive,\nand it will be copied to the target archive (or the contents of its\nshebang line will be displayed if the -info option is specified).\n\nThe following options are understood:\n\n-- Option: -o <output>, --output=<output>\n\nWrite the output to a file named 'output'.  If this option is not\nspecified, the output filename will be the same as the input\n'source', with the extension '.pyz' added.  If an explicit filename\nis given, it is used as is (so a '.pyz' extension should be\nincluded if required).\n\nAn output filename must be specified if the 'source' is an archive\n(and in that case, 'output' must not be the same as 'source').\n\n-- Option: -p <interpreter>, --python=<interpreter>\n\nAdd a '#!' line to the archive specifying 'interpreter' as the\ncommand to run.  Also, on POSIX, make the archive executable.  The\ndefault is to write no '#!' line, and not make the file executable.\n\n-- Option: -m <mainfn>, --main=<mainfn>\n\nWrite a 'main.py' file to the archive that executes 'mainfn'.\nThe 'mainfn' argument should have the form \"pkg.mod:fn\", where\n\"pkg.mod\" is a package/module in the archive, and \"fn\" is a\ncallable in the given module.  The 'main.py' file will execute\nthat callable.\n\n*note -main: 3fd3. cannot be specified when copying an archive.\n\n-- Option: -c, --compress\n\nCompress files with the deflate method, reducing the size of the\noutput file.  By default, files are stored uncompressed in the\narchive.\n\n*note -compress: 3fd5. has no effect when copying an archive.\n\nNew in version 3.7.\n\n-- Option: --info\n\nDisplay the interpreter embedded in the archive, for diagnostic\npurposes.  In this case, any other options are ignored and SOURCE\nmust be an archive, not a directory.\n\n-- Option: -h, --help\n\nPrint a short usage message and exit.\n\nFile: python3.12.info,  Node: Python API,  Next: Examples<31>,  Prev: Command-Line Interface<5>,  Up: zipapp -- Manage executable Python zip archives\n\n5.28.3.3 Python API\n...................\n\nThe module defines two convenience functions:\n\n-- Function: zipapp.createarchive (source, target=None,\ninterpreter=None, main=None, filter=None, compressed=False)\n\nCreate an application archive from 'source'.  The source can be any\nof the following:\n\n* The name of a directory, or a *note path-like object: 957.\nreferring to a directory, in which case a new application\narchive will be created from the content of that directory.\n\n* The name of an existing application archive file, or a *note\npath-like object: 957. referring to such a file, in which case\nthe file is copied to the target (modifying it to reflect the\nvalue given for the 'interpreter' argument).  The file name\nshould include the '.pyz' extension, if required.\n\n* A file object open for reading in bytes mode.  The content of\nthe file should be an application archive, and the file object\nis assumed to be positioned at the start of the archive.\n\nThe 'target' argument determines where the resulting archive will\nbe written:\n\n* If it is the name of a file, or a *note path-like object: 957,\nthe archive will be written to that file.\n\n* If it is an open file object, the archive will be written to\nthat file object, which must be open for writing in bytes\nmode.\n\n* If the target is omitted (or 'None'), the source must be a\ndirectory and the target will be a file with the same name as\nthe source, with a '.pyz' extension added.\n\nThe 'interpreter' argument specifies the name of the Python\ninterpreter with which the archive will be executed.  It is written\nas a \"shebang\" line at the start of the archive.  On POSIX, this\nwill be interpreted by the OS, and on Windows it will be handled by\nthe Python launcher.  Omitting the 'interpreter' results in no\nshebang line being written.  If an interpreter is specified, and\nthe target is a filename, the executable bit of the target file\nwill be set.\n\nThe 'main' argument specifies the name of a callable which will be\nused as the main program for the archive.  It can only be specified\nif the source is a directory, and the source does not already\ncontain a 'main.py' file.  The 'main' argument should take the\nform \"pkg.module:callable\" and the archive will be run by importing\n\"pkg.module\" and executing the given callable with no arguments.\nIt is an error to omit 'main' if the source is a directory and does\nnot contain a 'main.py' file, as otherwise the resulting\narchive would not be executable.\n\nThe optional 'filter' argument specifies a callback function that\nis passed a Path object representing the path to the file being\nadded (relative to the source directory).  It should return 'True'\nif the file is to be added.\n\nThe optional 'compressed' argument determines whether files are\ncompressed.  If set to 'True', files in the archive are compressed\nwith the deflate method; otherwise, files are stored uncompressed.\nThis argument has no effect when copying an existing archive.\n\nIf a file object is specified for 'source' or 'target', it is the\ncaller's responsibility to close it after calling createarchive.\n\nWhen copying an existing archive, file objects supplied only need\n'read' and 'readline', or 'write' methods.  When creating an\narchive from a directory, if the target is a file object it will be\npassed to the 'zipfile.ZipFile' class, and must supply the methods\nneeded by that class.\n\nChanged in version 3.7: Added the 'filter' and 'compressed'\nparameters.\n\n-- Function: zipapp.getinterpreter (archive)\n\nReturn the interpreter specified in the '#!' line at the start of\nthe archive.  If there is no '#!' line, return *note None: 43f.\nThe 'archive' argument can be a filename or a file-like object open\nfor reading in bytes mode.  It is assumed to be at the start of the\narchive.\n\nFile: python3.12.info,  Node: Examples<31>,  Next: Specifying the Interpreter,  Prev: Python API,  Up: zipapp -- Manage executable Python zip archives\n\n5.28.3.4 Examples\n.................\n\nPack up a directory into an archive, and run it.\n\n$ python -m zipapp myapp\n$ python myapp.pyz\n<output from myapp>\n\nThe same can be done using the *note createarchive(): 9f4. function:\n\n>>> import zipapp\n>>> zipapp.createarchive('myapp', 'myapp.pyz')\n",
            "subsections": []
        },
        "To make the application directly executable on POSIX, specify an": {
            "content": "interpreter to use.\n\n$ python -m zipapp myapp -p \"/usr/bin/env python\"\n$ ./myapp.pyz\n<output from myapp>\n",
            "subsections": []
        },
        "To replace the shebang line on an existing archive, create a modified": {
            "content": "archive using the *note createarchive(): 9f4. function:\n\n>>> import zipapp\n>>> zipapp.createarchive('oldarchive.pyz', 'newarchive.pyz', '/usr/bin/python3')\n\nTo update the file in place, do the replacement in memory using a *note",
            "subsections": []
        },
        "BytesIO: d08. object, and then overwrite the source afterwards.  Note": {
            "content": "that there is a risk when overwriting a file in place that an error will\nresult in the loss of the original file.  This code does not protect\nagainst such errors, but production code should do so.  Also, this\nmethod will only work if the archive fits in memory:\n\n>>> import zipapp\n>>> import io\n>>> temp = io.BytesIO()\n>>> zipapp.createarchive('myapp.pyz', temp, '/usr/bin/python2')\n>>> with open('myapp.pyz', 'wb') as f:\n>>>     f.write(temp.getvalue())\n\nFile: python3.12.info,  Node: Specifying the Interpreter,  Next: Creating Standalone Applications with zipapp,  Prev: Examples<31>,  Up: zipapp -- Manage executable Python zip archives\n\n5.28.3.5 Specifying the Interpreter\n...................................\n",
            "subsections": []
        },
        "Note that if you specify an interpreter and then distribute your": {
            "content": "application archive, you need to ensure that the interpreter used is\nportable.  The Python launcher for Windows supports most common forms of\nPOSIX '#!' line, but there are other issues to consider:\n\n* If you use \"/usr/bin/env python\" (or other forms of the \"python\"\ncommand, such as \"/usr/bin/python\"), you need to consider that your\nusers may have either Python 2 or Python 3 as their default, and\nwrite your code to work under both versions.\n\n* If you use an explicit version, for example \"/usr/bin/env python3\"\nyour application will not work for users who do not have that\nversion.  (This may be what you want if you have not made your code\nPython 2 compatible).\n\n* There is no way to say \"python X.Y or later\", so be careful of\nusing an exact version like \"/usr/bin/env python3.4\" as you will\nneed to change your shebang line for users of Python 3.5, for\nexample.\n\nTypically, you should use an \"/usr/bin/env python2\" or \"/usr/bin/env\npython3\", depending on whether your code is written for Python 2 or 3.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "5.28.3.6 Creating Standalone Applications with zipapp\n.....................................................\n\nUsing the *note zipapp: 12a. module, it is possible to create\nself-contained Python programs, which can be distributed to end users\nwho only need to have a suitable version of Python installed on their\nsystem.  The key to doing this is to bundle all of the application's\ndependencies into the archive, along with the application code.\n\nThe steps to create a standalone archive are as follows:\n\n1. Create your application in a directory as normal, so you have a\n'myapp' directory containing a 'main.py' file, and any\nsupporting application code.\n\n2. Install all of your application's dependencies into the 'myapp'\ndirectory, using pip:\n\n$ python -m pip install -r requirements.txt --target myapp\n\n(this assumes you have your project requirements in a\n'requirements.txt' file - if not, you can just list the\ndependencies manually on the pip command line).\n\n3. Package the application using:\n\n$ python -m zipapp -p \"interpreter\" myapp\n",
            "subsections": []
        },
        "This will produce a standalone executable, which can be run on any": {
            "content": "machine with the appropriate interpreter available.  See *note",
            "subsections": []
        },
        "Specifying the Interpreter: 3fdf. for details.  It can be shipped to": {
            "content": "users as a single file.\n",
            "subsections": []
        },
        "On Unix, the 'myapp.pyz' file is executable as it stands.  You can": {
            "content": "rename the file to remove the '.pyz' extension if you prefer a \"plain\"\ncommand name.  On Windows, the 'myapp.pyz[w]' file is executable by\nvirtue of the fact that the Python interpreter registers the '.pyz' and\n'.pyzw' file extensions when installed.\n\n* Menu:\n\n* Caveats::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Caveats,  Up: Creating Standalone Applications with zipapp": {
            "content": "5.28.3.7 Caveats\n................\n",
            "subsections": []
        },
        "If your application depends on a package that includes a C extension,": {
            "content": "that package cannot be run from a zip file (this is an OS limitation, as\nexecutable code must be present in the filesystem for the OS loader to\nload it).  In this case, you can exclude that dependency from the\nzipfile, and either require your users to have it installed, or ship it\nalongside your zipfile and add code to your 'main.py' to include the\ndirectory containing the unzipped module in 'sys.path'.  In this case,\nyou will need to make sure to ship appropriate binaries for your target\narchitecture(s) (and potentially pick the correct version to add to\n'sys.path' at runtime, based on the user's machine).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The Python Zip Application Archive Format,  Prev: Creating Standalone Applications with zipapp,  Up: zipapp -- Manage executable Python zip archives": {
            "content": "5.28.3.8 The Python Zip Application Archive Format\n..................................................\n",
            "subsections": []
        },
        "Python has been able to execute zip files which contain a 'main.py'": {
            "content": "file since version 2.6.  In order to be executed by Python, an\napplication archive simply has to be a standard zip file containing a\n'main.py' file which will be run as the entry point for the\napplication.  As usual for any Python script, the parent of the script\n(in this case the zip file) will be placed on *note sys.path: 32c. and\nthus further modules can be imported from the zip file.\n\nThe zip file format allows arbitrary data to be prepended to a zip file.",
            "subsections": []
        },
        "The zip application format uses this ability to prepend a standard POSIX": {
            "content": "\"shebang\" line to the file ('#!/path/to/interpreter').\n\nFormally, the Python zip application format is therefore:\n\n1. An optional shebang line, containing the characters 'b'#!''\nfollowed by an interpreter name, and then a newline ('b'\\n'')\ncharacter.  The interpreter name can be anything acceptable to the\nOS \"shebang\" processing, or the Python launcher on Windows.  The\ninterpreter should be encoded in UTF-8 on Windows, and in *note\nsys.getfilesystemencoding(): aa2. on POSIX.\n\n2. Standard zipfile data, as generated by the *note zipfile: 12b.\nmodule.  The zipfile content 'must' include a file called\n'main.py' (which must be in the \"root\" of the zipfile - i.e.,\nit cannot be in a subdirectory).  The zipfile data can be\ncompressed or uncompressed.\n",
            "subsections": []
        },
        "If an application archive has a shebang line, it may have the executable": {
            "content": "bit set on POSIX systems, to allow it to be executed directly.\n",
            "subsections": []
        },
        "There is no requirement that the tools in this module are used to create": {
            "content": "application archives - the module is a convenience, but archives in the\nabove format created by any means are acceptable to Python.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python Runtime Services,  Next: Custom Python Interpreters,  Prev: Software Packaging and Distribution,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.29 Python Runtime Services",
                    "content": ""
                }
            ]
        },
        "The modules described in this chapter provide a wide range of services": {
            "content": "related to the Python interpreter and its interaction with its\nenvironment.  Here's an overview:\n\n* Menu:\n\n* sys -- System-specific parameters and functions::\n* sys.monitoring -- Execution event monitoring: sys monitoring -- Execution event monitoring.\n* sysconfig -- Provide access to Python's configuration information::\n* builtins -- Built-in objects::\n* main -- Top-level code environment::\n* warnings -- Warning control::\n* dataclasses -- Data Classes::\n* contextlib -- Utilities for with-statement contexts::\n* abc -- Abstract Base Classes::\n* atexit -- Exit handlers::\n* traceback -- Print or retrieve a stack traceback::\n* future -- Future statement definitions::\n* gc -- Garbage Collector interface::\n* inspect -- Inspect live objects::\n* site -- Site-specific configuration hook::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: sys -- System-specific parameters and functions,  Next: sys monitoring -- Execution event monitoring,  Up: Python Runtime Services": {
            "content": "",
            "subsections": []
        },
        "This module provides access to some variables used or maintained by the": {
            "content": "interpreter and to functions that interact strongly with the\ninterpreter.  It is always available.\n\n-- Data: sys.abiflags\n\nOn POSIX systems where Python was built with the standard\n'configure' script, this contains the ABI flags as specified by PEP\n3149(1).\n\nNew in version 3.2.\n\nChanged in version 3.8: Default flags became an empty string ('m'\nflag for pymalloc has been removed).\n\n*note Availability: 1ad3.: Unix.\n\n-- Function: sys.addaudithook (hook)\n\nAppend the callable 'hook' to the list of active auditing hooks for\nthe current (sub)interpreter.\n\nWhen an auditing event is raised through the *note sys.audit():\n16dc. function, each hook will be called in the order it was added\nwith the event name and the tuple of arguments.  Native hooks added\nby *note PySysAddAuditHook(): 3e75. are called first, followed by\nhooks added in the current (sub)interpreter.  Hooks can then log\nthe event, raise an exception to abort the operation, or terminate\nthe process entirely.\n\nNote that audit hooks are primarily for collecting information\nabout internal or otherwise unobservable actions, whether by Python\nor libraries written in Python.  They are not suitable for\nimplementing a \"sandbox\".  In particular, malicious code can\ntrivially disable or bypass hooks added using this function.  At a\nminimum, any security-sensitive hooks must be added using the C API\n*note PySysAddAuditHook(): 3e75. before initialising the runtime,\nand any modules allowing arbitrary memory modification (such as\n*note ctypes: 28.) should be completely removed or closely\nmonitored.\n\nCalling *note sys.addaudithook(): 3e74. will itself raise an\nauditing event named 'sys.addaudithook' with no arguments.  If any\nexisting hooks raise an exception derived from *note RuntimeError:\n17a, the new hook will not be added and the exception suppressed.\nAs a result, callers cannot assume that their hook has been added\nunless they control all existing hooks.\n\nSee the *note audit events table: 15d2. for all events raised by\nCPython, and PEP 578(2) for the original design discussion.\n\nNew in version 3.8.\n\nChanged in version 3.8.1: Exceptions derived from *note Exception:\n7ff. but not *note RuntimeError: 17a. are no longer suppressed.\n\n'CPython implementation detail:' When tracing is enabled (see *note\nsettrace(): 135a.), Python hooks are only traced if the callable\nhas a 'cantrace' member that is set to a true value.\nOtherwise, trace functions will skip the hook.\n\n-- Data: sys.argv\n\nThe list of command line arguments passed to a Python script.\n'argv[0]' is the script name (it is operating system dependent\nwhether this is a full pathname or not).  If the command was\nexecuted using the *note -c: 3a4. command line option to the\ninterpreter, 'argv[0]' is set to the string ''-c''.  If no script\nname was passed to the Python interpreter, 'argv[0]' is the empty\nstring.\n\nTo loop over the standard input, or the list of files given on the\ncommand line, see the *note fileinput: 56. module.\n\nSee also *note sys.origargv: 636.\n\nNote: On Unix, command line arguments are passed by bytes from\nOS. Python decodes them with filesystem encoding and\n\"surrogateescape\" error handler.  When you need original\nbytes, you can get it by '[os.fsencode(arg) for arg in\nsys.argv]'.\n\n-- Function: sys.audit (event, *args)\n\nRaise an auditing event and trigger any active auditing hooks.\n'event' is a string identifying the event, and 'args' may contain\noptional arguments with more information about the event.  The\nnumber and types of arguments for a given event are considered a\npublic and stable API and should not be modified between releases.\n\nFor example, one auditing event is named 'os.chdir'.  This event\nhas one argument called 'path' that will contain the requested new\nworking directory.\n\n*note sys.audit(): 16dc. will call the existing auditing hooks,\npassing the event name and arguments, and will re-raise the first\nexception from any hook.  In general, if an exception is raised, it\nshould not be handled and the process should be terminated as\nquickly as possible.  This allows hook implementations to decide\nhow to respond to particular events: they can merely log the event\nor abort the operation by raising an exception.\n\nHooks are added using the *note sys.addaudithook(): 3e74. or *note\nPySysAddAuditHook(): 3e75. functions.\n\nThe native equivalent of this function is *note PySysAudit():\n16ec.  Using the native function is preferred when possible.\n\nSee the *note audit events table: 15d2. for all events raised by\nCPython.\n\nNew in version 3.8.\n\n-- Data: sys.baseexecprefix\n\nSet during Python startup, before 'site.py' is run, to the same\nvalue as *note execprefix: 32a.  If not running in a *note virtual\nenvironment: 3fba, the values will stay the same; if 'site.py'\nfinds that a virtual environment is in use, the values of *note\nprefix: 32e. and *note execprefix: 32a. will be changed to point\nto the virtual environment, whereas *note baseprefix: 391e. and\n*note baseexecprefix: 3fbe. will remain pointing to the base\nPython installation (the one which the virtual environment was\ncreated from).\n\nNew in version 3.3.\n\n-- Data: sys.baseprefix\n\nSet during Python startup, before 'site.py' is run, to the same\nvalue as *note prefix: 32e.  If not running in a *note virtual\nenvironment: 3fba, the values will stay the same; if 'site.py'\nfinds that a virtual environment is in use, the values of *note\nprefix: 32e. and *note execprefix: 32a. will be changed to point\nto the virtual environment, whereas *note baseprefix: 391e. and\n*note baseexecprefix: 3fbe. will remain pointing to the base\nPython installation (the one which the virtual environment was\ncreated from).\n\nNew in version 3.3.\n\n-- Data: sys.byteorder\n\nAn indicator of the native byte order.  This will have the value\n''big'' on big-endian (most-significant byte first) platforms, and\n''little'' on little-endian (least-significant byte first)\nplatforms.\n\n-- Data: sys.builtinmodulenames\n\nA tuple of strings containing the names of all modules that are\ncompiled into this Python interpreter.  (This information is not\navailable in any other way -- 'modules.keys()' only lists the\nimported modules.)\n\nSee also the *note sys.stdlibmodulenames: 637. list.\n\n-- Function: sys.calltracing (func, args)\n\nCall 'func(*args)', while tracing is enabled.  The tracing state is\nsaved, and restored afterwards.  This is intended to be called from\na debugger from a checkpoint, to recursively debug or profile some\nother code.\n\nTracing is suspended while calling a tracing function set by *note\nsettrace(): 135a. or *note setprofile(): 1359. to avoid infinite\nrecursion.  'calltracing()' enables explicit recursion of the\ntracing function.\n\n-- Data: sys.copyright\n\nA string containing the copyright pertaining to the Python\ninterpreter.\n\n-- Function: sys.cleartypecache ()\n\nClear the internal type cache.  The type cache is used to speed up\nattribute and method lookups.  Use the function 'only' to drop\nunnecessary references during reference leak debugging.\n\nThis function should be used for internal and specialized purposes\nonly.\n\n-- Function: sys.currentframes ()\n\nReturn a dictionary mapping each thread's identifier to the topmost\nstack frame currently active in that thread at the time the\nfunction is called.  Note that functions in the *note traceback:\nf9. module can build the call stack given such a frame.\n\nThis is most useful for debugging deadlock: this function does not\nrequire the deadlocked threads' cooperation, and such threads' call\nstacks are frozen for as long as they remain deadlocked.  The frame\nreturned for a non-deadlocked thread may bear no relationship to\nthat thread's current activity by the time calling code examines\nthe frame.\n\nThis function should be used for internal and specialized purposes\nonly.\n\nRaises an *note auditing event: 161d. 'sys.currentframes' with no\narguments.\n\n-- Function: sys.currentexceptions ()\n\nReturn a dictionary mapping each thread's identifier to the topmost\nexception currently active in that thread at the time the function\nis called.  If a thread is not currently handling an exception, it\nis not included in the result dictionary.\n\nThis is most useful for statistical profiling.\n\nThis function should be used for internal and specialized purposes\nonly.\n\nRaises an *note auditing event: 161d. 'sys.currentexceptions'\nwith no arguments.\n\nChanged in version 3.12: Each value in the dictionary is now a\nsingle exception instance, rather than a 3-tuple as returned from\n'sys.excinfo()'.\n\n-- Function: sys.breakpointhook ()\n\nThis hook function is called by built-in *note breakpoint(): 8f9.\nBy default, it drops you into the *note pdb: a0. debugger, but it\ncan be set to any other function so that you can choose which\ndebugger gets used.\n\nThe signature of this function is dependent on what it calls.  For\nexample, the default binding (e.g.  'pdb.settrace()') expects no\narguments, but you might bind it to a function that expects\nadditional arguments (positional and/or keyword).  The built-in\n'breakpoint()' function passes its '*args' and 'kws' straight\nthrough.  Whatever 'breakpointhooks()' returns is returned from\n'breakpoint()'.\n\nThe default implementation first consults the environment variable\n*note PYTHONBREAKPOINT: 911.  If that is set to '\"0\"' then this\nfunction returns immediately; i.e.  it is a no-op.  If the\nenvironment variable is not set, or is set to the empty string,\n'pdb.settrace()' is called.  Otherwise this variable should name a\nfunction to run, using Python's dotted-import nomenclature, e.g.\n'package.subpackage.module.function'.  In this case,\n'package.subpackage.module' would be imported and the resulting\nmodule must have a callable named 'function()'.  This is run,\npassing in '*args' and 'kws', and whatever 'function()' returns,\n'sys.breakpointhook()' returns to the built-in *note breakpoint():\n8f9. function.\n\nNote that if anything goes wrong while importing the callable named\nby *note PYTHONBREAKPOINT: 911, a *note RuntimeWarning: 8c9. is\nreported and the breakpoint is ignored.\n\nAlso note that if 'sys.breakpointhook()' is overridden\nprogrammatically, *note PYTHONBREAKPOINT: 911. is 'not' consulted.\n\nNew in version 3.7.\n\n-- Function: sys.debugmallocstats ()\n\nPrint low-level information to stderr about the state of CPython's\nmemory allocator.\n\nIf Python is *note built in debug mode: 67f. (*note configure\n-with-pydebug option: 1b04.), it also performs some expensive\ninternal consistency checks.\n\nNew in version 3.3.\n\n'CPython implementation detail:' This function is specific to\nCPython.  The exact output format is not defined here, and may\nchange.\n\n-- Data: sys.dllhandle\n\nInteger specifying the handle of the Python DLL.\n\n*note Availability: 1ad3.: Windows.\n\n-- Function: sys.displayhook (value)\n\nIf 'value' is not 'None', this function prints 'repr(value)' to\n'sys.stdout', and saves 'value' in 'builtins.'.  If 'repr(value)'\nis not encodable to 'sys.stdout.encoding' with 'sys.stdout.errors'\nerror handler (which is probably ''strict''), encode it to\n'sys.stdout.encoding' with ''backslashreplace'' error handler.\n\n'sys.displayhook' is called on the result of evaluating an *note\nexpression: 1c8d. entered in an interactive Python session.  The\ndisplay of these values can be customized by assigning another\none-argument function to 'sys.displayhook'.\n\nPseudo-code:\n\ndef displayhook(value):\nif value is None:\nreturn\n# Set '' to None to avoid recursion\nbuiltins. = None\ntext = repr(value)\ntry:\nsys.stdout.write(text)\nexcept UnicodeEncodeError:\nbytes = text.encode(sys.stdout.encoding, 'backslashreplace')\nif hasattr(sys.stdout, 'buffer'):\nsys.stdout.buffer.write(bytes)\nelse:\ntext = bytes.decode(sys.stdout.encoding, 'strict')\nsys.stdout.write(text)\nsys.stdout.write(\"\\n\")\nbuiltins. = value\n\nChanged in version 3.2: Use ''backslashreplace'' error handler on\n*note UnicodeEncodeError: 442.\n\n-- Data: sys.dontwritebytecode\n\nIf this is true, Python won't try to write '.pyc' files on the\nimport of source modules.  This value is initially set to 'True' or\n'False' depending on the *note -B: 1222. command line option and\nthe *note PYTHONDONTWRITEBYTECODE: 1223. environment variable, but\nyou can set it yourself to control bytecode file generation.\n\n-- Data: sys.emscripteninfo\n\nA *note named tuple: 417. holding information about the environment\non the 'wasm32-emscripten' platform.  The named tuple is\nprovisional and may change in the future.\n\n-- Attribute: emscripteninfo.emscriptenversion\n\nEmscripten version as tuple of ints (major, minor, micro),\ne.g.  '(3, 1, 8)'.\n\n-- Attribute: emscripteninfo.runtime\n\nRuntime string, e.g.  browser user agent, ''Node.js\nv14.18.2'', or ''UNKNOWN''.\n\n-- Attribute: emscripteninfo.pthreads\n\n'True' if Python is compiled with Emscripten pthreads support.\n\n-- Attribute: emscripteninfo.sharedmemory\n\n'True' if Python is compiled with shared memory support.\n\n*note Availability: 1ad3.: Emscripten.\n\nNew in version 3.11.\n\n-- Data: sys.pycacheprefix\n\nIf this is set (not 'None'), Python will write bytecode-cache\n'.pyc' files to (and read them from) a parallel directory tree\nrooted at this directory, rather than from 'pycache'\ndirectories in the source code tree.  Any 'pycache' directories\nin the source code tree will be ignored and new '.pyc' files\nwritten within the pycache prefix.  Thus if you use *note\ncompileall: 1e. as a pre-build step, you must ensure you run it\nwith the same pycache prefix (if any) that you will use at runtime.\n\nA relative path is interpreted relative to the current working\ndirectory.\n\nThis value is initially set based on the value of the *note -X:\n188. 'pycacheprefix=PATH' command-line option or the *note\nPYTHONPYCACHEPREFIX: 7c7. environment variable (command-line takes\nprecedence).  If neither are set, it is 'None'.\n\nNew in version 3.8.\n\n-- Function: sys.excepthook (type, value, traceback)\n\nThis function prints out a given traceback and exception to\n'sys.stderr'.\n\nWhen an exception other than *note SystemExit: b97. is raised and\nuncaught, the interpreter calls 'sys.excepthook' with three\narguments, the exception class, exception instance, and a traceback\nobject.  In an interactive session this happens just before control\nis returned to the prompt; in a Python program this happens just\nbefore the program exits.  The handling of such top-level\nexceptions can be customized by assigning another three-argument\nfunction to 'sys.excepthook'.\n\nRaise an auditing event 'sys.excepthook' with arguments 'hook',\n'type', 'value', 'traceback' when an uncaught exception occurs.  If\nno hook has been set, 'hook' may be 'None'.  If any hook raises an\nexception derived from *note RuntimeError: 17a. the call to the\nhook will be suppressed.  Otherwise, the audit hook exception will\nbe reported as unraisable and 'sys.excepthook' will be called.\n\nSee also\n........\n\nThe *note sys.unraisablehook(): 448. function handles unraisable\nexceptions and the *note threading.excepthook(): 641. function\nhandles exception raised by *note threading.Thread.run(): 868.\n\n-- Data: sys.breakpointhook\n-- Data: sys.displayhook\n-- Data: sys.excepthook\n-- Data: sys.unraisablehook\n\nThese objects contain the original values of 'breakpointhook',\n'displayhook', 'excepthook', and 'unraisablehook' at the start of\nthe program.  They are saved so that 'breakpointhook',\n'displayhook' and 'excepthook', 'unraisablehook' can be restored in\ncase they happen to get replaced with broken or alternative\nobjects.\n\nNew in version 3.7: breakpointhook\n\nNew in version 3.8: unraisablehook\n\n-- Function: sys.exception ()\n\nThis function, when called while an exception handler is executing\n(such as an 'except' or 'except*' clause), returns the exception\ninstance that was caught by this handler.  When exception handlers\nare nested within one another, only the exception handled by the\ninnermost handler is accessible.\n\nIf no exception handler is executing, this function returns 'None'.\n\nNew in version 3.11.\n\n-- Function: sys.excinfo ()\n\nThis function returns the old-style representation of the handled\nexception.  If an exception 'e' is currently handled (so *note\nexception(): 457. would return 'e'), *note excinfo(): 456. returns\nthe tuple '(type(e), e, e.traceback)'.  That is, a tuple\ncontaining the type of the exception (a subclass of *note\nBaseException: 37c.), the exception itself, and a *note traceback\nobject: 92b. which typically encapsulates the call stack at the\npoint where the exception last occurred.\n\nIf no exception is being handled anywhere on the stack, this\nfunction return a tuple containing three 'None' values.\n\nChanged in version 3.11: The 'type' and 'traceback' fields are now\nderived from the 'value' (the exception instance), so when an\nexception is modified while it is being handled, the changes are\nreflected in the results of subsequent calls to *note excinfo():\n456.\n\n-- Data: sys.execprefix\n\nA string giving the site-specific directory prefix where the\nplatform-dependent Python files are installed; by default, this is\nalso ''/usr/local''.  This can be set at build time with the\n'--exec-prefix' argument to the 'configure' script.  Specifically,\nall configuration files (e.g.  the 'pyconfig.h' header file) are\ninstalled in the directory '`execprefix'/lib/python`X.Y'/config',\nand shared library modules are installed in\n'`execprefix'/lib/python`X.Y'/lib-dynload', where 'X.Y' is the\nversion number of Python, for example '3.2'.\n\nNote: If a *note virtual environment: 3fba. is in effect, this\nvalue will be changed in 'site.py' to point to the virtual\nenvironment.  The value for the Python installation will still\nbe available, via *note baseexecprefix: 3fbe.\n\n-- Data: sys.executable\n\nA string giving the absolute path of the executable binary for the\nPython interpreter, on systems where this makes sense.  If Python\nis unable to retrieve the real path to its executable, *note\nsys.executable: 330. will be an empty string or 'None'.\n\n-- Function: sys.exit ([arg])\n\nRaise a *note SystemExit: b97. exception, signaling an intention to\nexit the interpreter.\n\nThe optional argument 'arg' can be an integer giving the exit\nstatus (defaulting to zero), or another type of object.  If it is\nan integer, zero is considered \"successful termination\" and any\nnonzero value is considered \"abnormal termination\" by shells and\nthe like.  Most systems require it to be in the range 0-127, and\nproduce undefined results otherwise.  Some systems have a\nconvention for assigning specific meanings to specific exit codes,\nbut these are generally underdeveloped; Unix programs generally use\n2 for command line syntax errors and 1 for all other kind of\nerrors.  If another type of object is passed, 'None' is equivalent\nto passing zero, and any other object is printed to *note stderr:\n757. and results in an exit code of 1.  In particular,\n'sys.exit(\"some error message\")' is a quick way to exit a program\nwhen an error occurs.\n\nSince *note exit(): 1e94. ultimately \"only\" raises an exception, it\nwill only exit the process when called from the main thread, and\nthe exception is not intercepted.  Cleanup actions specified by\nfinally clauses of *note try: 4bc. statements are honored, and it\nis possible to intercept the exit attempt at an outer level.\n\nChanged in version 3.6: If an error occurs in the cleanup after the\nPython interpreter has caught *note SystemExit: b97. (such as an\nerror flushing buffered data in the standard streams), the exit\nstatus is changed to 120.\n\n-- Data: sys.flags\n\nThe *note named tuple: 417. 'flags' exposes the status of command\nline flags.  The attributes are read only.\n\n-- Attribute: flags.debug                             *note -d: 1ab4.\n\n\n-- Attribute: flags.inspect                           *note -i: 1336.\n\n\n-- Attribute: flags.interactive                       *note -i: 1336.\n\n\n-- Attribute: flags.isolated                          *note -I: 77f.\n\n\n-- Attribute: flags.optimize                          *note -O: c11. or *note -OO: c12.\n\n\n-- Attribute: flags.dontwritebytecode               *note -B: 1222.\n\n\n-- Attribute: flags.nousersite                      *note -s: 1200.\n\n\n-- Attribute: flags.nosite                           *note -S: 101c.\n\n\n-- Attribute: flags.ignoreenvironment                *note -E: 77e.\n\n\n-- Attribute: flags.verbose                           *note -v: 127b.\n\n\n-- Attribute: flags.byteswarning                     *note -b: 3a8.\n\n\n-- Attribute: flags.quiet                             *note -q: 1ab7.\n\n\n-- Attribute: flags.hashrandomization                *note -R: 1818.\n\n\n-- Attribute: flags.devmode                          *note -X dev: 188.\n(*note Python Development Mode: 6e3.)\n\n\n-- Attribute: flags.utf8mode                         *note -X utf8: 188.\n\n\n-- Attribute: flags.safepath                         *note -P: 362.\n\n\n-- Attribute: flags.intmaxstrdigits                *note -X intmaxstrdigits: 188.\n(*note integer string conversion length limitation: 3bc.)\n\n\n-- Attribute: flags.warndefaultencoding             *note -X warndefaultencoding: 188.\n\n\nChanged in version 3.2: Added 'quiet' attribute for the new *note\n-q: 1ab7. flag.\n\nNew in version 3.2.3: The 'hashrandomization' attribute.\n\nChanged in version 3.3: Removed obsolete 'divisionwarning'\nattribute.\n\nChanged in version 3.4: Added 'isolated' attribute for *note -I:\n77f. 'isolated' flag.\n\nChanged in version 3.7: Added the 'devmode' attribute for the new\n*note Python Development Mode: 6e3. and the 'utf8mode' attribute\nfor the new *note -X: 188. 'utf8' flag.\n\nChanged in version 3.10: Added 'warndefaultencoding' attribute\nfor *note -X: 188. 'warndefaultencoding' flag.\n\nChanged in version 3.11: Added the 'safepath' attribute for *note\n-P: 362. option.\n\nChanged in version 3.11: Added the 'intmaxstrdigits' attribute.\n\n-- Data: sys.floatinfo\n\nA *note named tuple: 417. holding information about the float type.\nIt contains low level information about the precision and internal\nrepresentation.  The values correspond to the various\nfloating-point constants defined in the standard header file\n'float.h' for the 'C' programming language; see section 5.2.4.2.2\nof the 1999 ISO/IEC C standard *note [C99]: 4005, 'Characteristics\nof floating types', for details.  Attributes of the 'floatinfo'\nnamed tuple\n\nattribute                             float.h macro                         explanation\n\n------------------------------------------------------------------------------------------------------------------\n\n-- Attribute: floatinfo.epsilon     'DBLEPSILON'                         difference between 1.0 and the\nleast value greater than 1.0 that\nis representable as a float.\n\nSee also *note math.ulp(): 72e.\n\n\n-- Attribute: floatinfo.dig         'DBLDIG'                             The maximum number of decimal\ndigits that can be faithfully\nrepresented in a float; see below.\n\n\n-- Attribute: floatinfo.mantdig    'DBLMANTDIG'                        Float precision: the number of\nbase-'radix' digits in the\nsignificand of a float.\n\n\n-- Attribute: floatinfo.max         'DBLMAX'                             The maximum representable positive\nfinite float.\n\n\n-- Attribute: floatinfo.maxexp     'DBLMAXEXP'                         The maximum integer 'e' such that\n'radix(e-1)' is a representable\nfinite float.\n\n\n-- Attribute:                        'DBLMAX10EXP'                      The maximum integer 'e' such that\nfloatinfo.max10exp                                             '10e' is in the range of\nrepresentable finite floats.\n\n\n-- Attribute: floatinfo.min         'DBLMIN'                             The minimum representable positive\n'normalized' float.\n\nUse *note math.ulp(0.0): 72e. to\nget the smallest positive\n'denormalized' representable float.\n\n\n-- Attribute: floatinfo.minexp     'DBLMINEXP'                         The minimum integer 'e' such that\n'radix(e-1)' is a normalized\nfloat.\n\n\n-- Attribute:                        'DBLMIN10EXP'                      The minimum integer 'e' such that\nfloatinfo.min10exp                                             '10e' is a normalized float.\n\n\n-- Attribute: floatinfo.radix       'FLTRADIX'                           The radix of exponent\nrepresentation.\n\n\n-- Attribute: floatinfo.rounds      'FLTROUNDS'                          An integer representing the\nrounding mode for floating-point\narithmetic.  This reflects the\nvalue of the system 'FLTROUNDS'\nmacro at interpreter startup time:\n\n* '-1': indeterminable\n\n* '0': toward zero\n\n* '1': to nearest\n\n* '2': toward positive infinity\n\n* '3': toward negative infinity\n\nAll other values for 'FLTROUNDS'\ncharacterize implementation-defined\nrounding behavior.\n\n\nThe attribute *note sys.floatinfo.dig: 4007. needs further\nexplanation.  If 's' is any string representing a decimal number\nwith at most 'sys.floatinfo.dig' significant digits, then\nconverting 's' to a float and back again will recover a string\nrepresenting the same decimal value:\n\n>>> import sys\n>>> sys.floatinfo.dig\n15\n>>> s = '3.14159265358979'    # decimal string with 15 significant digits\n>>> format(float(s), '.15g')  # convert to float and back -> same value\n'3.14159265358979'\n\nBut for strings with more than *note sys.floatinfo.dig: 4007.\nsignificant digits, this isn't always true:\n\n>>> s = '9876543211234567'    # 16 significant digits is too many!\n>>> format(float(s), '.16g')  # conversion changes value\n'9876543211234568'\n\n-- Data: sys.floatreprstyle\n\nA string indicating how the *note repr(): 5f0. function behaves for\nfloats.  If the string has value ''short'' then for a finite float\n'x', 'repr(x)' aims to produce a short string with the property\nthat 'float(repr(x)) == x'.  This is the usual behaviour in Python\n3.1 and later.  Otherwise, 'floatreprstyle' has value ''legacy''\nand 'repr(x)' behaves in the same way as it did in versions of\nPython prior to 3.1.\n\nNew in version 3.1.\n\n-- Function: sys.getallocatedblocks ()\n\nReturn the number of memory blocks currently allocated by the\ninterpreter, regardless of their size.  This function is mainly\nuseful for tracking and debugging memory leaks.  Because of the\ninterpreter's internal caches, the result can vary from call to\ncall; you may have to call *note cleartypecache(): 3fe9. and\n*note gc.collect(): 865. to get more predictable results.\n\nIf a Python build or implementation cannot reasonably compute this\ninformation, *note getallocatedblocks(): e38. is allowed to return\n0 instead.\n\nNew in version 3.4.\n\n-- Function: sys.getunicodeinternedsize ()\n\nReturn the number of unicode objects that have been interned.\n\nNew in version 3.12.\n\n-- Function: sys.getandroidapilevel ()\n\nReturn the build time API version of Android as an integer.\n\n*note Availability: 1ad3.: Android.\n\nNew in version 3.7.\n\n-- Function: sys.getdefaultencoding ()\n\nReturn the name of the current default string encoding used by the\nUnicode implementation.\n\n-- Function: sys.getdlopenflags ()\n\nReturn the current value of the flags that are used for 'dlopen()'\ncalls.  Symbolic names for the flag values can be found in the\n*note os: 9c. module ('RTLDXXX' constants, e.g.  *note\nos.RTLDLAZY: f88.).\n\n*note Availability: 1ad3.: Unix.\n\n-- Function: sys.getfilesystemencoding ()\n\nGet the *note filesystem encoding: 291.: the encoding used with the\n*note filesystem error handler: 291. to convert between Unicode\nfilenames and bytes filenames.  The filesystem error handler is\nreturned from *note getfilesystemencodeerrors(): b35.\n\nFor best compatibility, str should be used for filenames in all\ncases, although representing filenames as bytes is also supported.\nFunctions accepting or returning filenames should support either\nstr or bytes and internally convert to the system's preferred\nrepresentation.\n\n*note os.fsencode(): a9e. and *note os.fsdecode(): a9d. should be\nused to ensure that the correct encoding and errors mode are used.\n\nThe *note filesystem encoding and error handler: 291. are\nconfigured at Python startup by the *note PyConfigRead(): 57e.\nfunction: see *note filesystemencoding: 313. and *note\nfilesystemerrors: 314. members of *note PyConfig: 318.\n\nChanged in version 3.2: *note getfilesystemencoding(): aa2. result\ncannot be 'None' anymore.\n\nChanged in version 3.6: Windows is no longer guaranteed to return\n''mbcs''.  See PEP 529(3) and *note\nenablelegacywindowsfsencoding(): aa4. for more information.\n\nChanged in version 3.7: Return ''utf-8'' if the *note Python UTF-8\nMode: 420. is enabled.\n\n-- Function: sys.getfilesystemencodeerrors ()\n\nGet the *note filesystem error handler: 291.: the error handler\nused with the *note filesystem encoding: 291. to convert between\nUnicode filenames and bytes filenames.  The filesystem encoding is\nreturned from *note getfilesystemencoding(): aa2.\n\n*note os.fsencode(): a9e. and *note os.fsdecode(): a9d. should be\nused to ensure that the correct encoding and errors mode are used.\n\nThe *note filesystem encoding and error handler: 291. are\nconfigured at Python startup by the *note PyConfigRead(): 57e.\nfunction: see *note filesystemencoding: 313. and *note\nfilesystemerrors: 314. members of *note PyConfig: 318.\n\nNew in version 3.6.\n\n-- Function: sys.getintmaxstrdigits ()\n\nReturns the current value for the *note integer string conversion\nlength limitation: 3bc.  See also *note setintmaxstrdigits():\n1515.\n\nNew in version 3.11.\n\n-- Function: sys.getrefcount (object)\n\nReturn the reference count of the 'object'.  The count returned is\ngenerally one higher than you might expect, because it includes the\n(temporary) reference as an argument to *note getrefcount(): 4013.\n\nNote that the returned value may not actually reflect how many\nreferences to the object are actually held.  For example, some\nobjects are \"immortal\" and have a very high refcount that does not\nreflect the actual number of references.  Consequently, do not rely\non the returned value to be accurate, other than a value of 0 or 1.\n\nChanged in version 3.12: Immortal objects have very large refcounts\nthat do not match the actual number of references to the object.\n\n-- Function: sys.getrecursionlimit ()\n\nReturn the current value of the recursion limit, the maximum depth\nof the Python interpreter stack.  This limit prevents infinite\nrecursion from causing an overflow of the C stack and crashing\nPython.  It can be set by *note setrecursionlimit(): 1e7.\n\n-- Function: sys.getsizeof (object[, default])\n\nReturn the size of an object in bytes.  The object can be any type\nof object.  All built-in objects will return correct results, but\nthis does not have to hold true for third-party extensions as it is\nimplementation specific.\n\nOnly the memory consumption directly attributed to the object is\naccounted for, not the memory consumption of objects it refers to.\n\nIf given, 'default' will be returned if the object does not provide\nmeans to retrieve the size.  Otherwise a *note TypeError: 28e. will\nbe raised.\n\n*note getsizeof(): 14b9. calls the object's 'sizeof' method and\nadds an additional garbage collector overhead if the object is\nmanaged by the garbage collector.\n\nSee recursive sizeof recipe(4) for an example of using *note\ngetsizeof(): 14b9. recursively to find the size of containers and\nall their contents.\n\n-- Function: sys.getswitchinterval ()\n\nReturn the interpreter's \"thread switch interval\"; see *note\nsetswitchinterval(): 76a.\n\nNew in version 3.2.\n\n-- Function: sys.getframe ([depth])\n\nReturn a frame object from the call stack.  If optional integer\n'depth' is given, return the frame object that many calls below the\ntop of the stack.  If that is deeper than the call stack, *note\nValueError: 183. is raised.  The default for 'depth' is zero,\nreturning the frame at the top of the call stack.\n\nRaises an *note auditing event: 161d. 'sys.getframe' with argument\n'frame'.\n\n'CPython implementation detail:' This function should be used for\ninternal and specialized purposes only.  It is not guaranteed to\nexist in all implementations of Python.\n\n-- Function: sys.getframemodulename ([depth])\n\nReturn the name of a module from the call stack.  If optional\ninteger 'depth' is given, return the module that many calls below\nthe top of the stack.  If that is deeper than the call stack, or if\nthe module is unidentifiable, 'None' is returned.  The default for\n'depth' is zero, returning the module at the top of the call stack.\n\nRaises an *note auditing event: 161d. 'sys.getframemodulename'\nwith argument 'depth'.\n\n'CPython implementation detail:' This function should be used for\ninternal and specialized purposes only.  It is not guaranteed to\nexist in all implementations of Python.\n\n-- Function: sys.getprofile ()\n\nGet the profiler function as set by *note setprofile(): 1359.\n\n-- Function: sys.gettrace ()\n\nGet the trace function as set by *note settrace(): 135a.\n\n'CPython implementation detail:' The *note gettrace(): 1236.\nfunction is intended only for implementing debuggers, profilers,\ncoverage tools and the like.  Its behavior is part of the\nimplementation platform, rather than part of the language\ndefinition, and thus may not be available in all Python\nimplementations.\n\n-- Function: sys.getwindowsversion ()\n\nReturn a named tuple describing the Windows version currently\nrunning.  The named elements are 'major', 'minor', 'build',\n'platform', 'servicepack', 'servicepackminor',\n'servicepackmajor', 'suitemask', 'producttype' and\n'platformversion'.  'servicepack' contains a string,\n'platformversion' a 3-tuple and all other values are integers.\nThe components can also be accessed by name, so\n'sys.getwindowsversion()[0]' is equivalent to\n'sys.getwindowsversion().major'.  For compatibility with prior\nversions, only the first 5 elements are retrievable by indexing.\n\n'platform' will be '2' (VERPLATFORMWIN32NT).\n\n'producttype' may be one of the following values:\n\nConstant                                    Meaning\n\n----------------------------------------------------------------------------------\n\n'1' (VERNTWORKSTATION)                    The system is a workstation.\n\n\n'2' (VERNTDOMAINCONTROLLER)              The system is a domain controller.\n\n\n'3' (VERNTSERVER)                         The system is a server, but not a\ndomain controller.\n\n\nThis function wraps the Win32 'GetVersionEx()' function; see the\nMicrosoft documentation on 'OSVERSIONINFOEX()' for more information\nabout these fields.\n\n'platformversion' returns the major version, minor version and\nbuild number of the current operating system, rather than the\nversion that is being emulated for the process.  It is intended for\nuse in logging rather than for feature detection.\n\nNote: 'platformversion' derives the version from kernel32.dll\nwhich can be of a different version than the OS version.\nPlease use *note platform: a5. module for achieving accurate\nOS version.\n\n*note Availability: 1ad3.: Windows.\n\nChanged in version 3.2: Changed to a named tuple and added\n'servicepackminor', 'servicepackmajor', 'suitemask', and\n'producttype'.\n\nChanged in version 3.6: Added 'platformversion'\n\n-- Function: sys.getasyncgenhooks ()\n\nReturns an 'asyncgenhooks' object, which is similar to a *note\nnamedtuple: 711. of the form '(firstiter, finalizer)', where\n'firstiter' and 'finalizer' are expected to be either 'None' or\nfunctions which take an *note asynchronous generator iterator:\n4014. as an argument, and are used to schedule finalization of an\nasynchronous generator by an event loop.\n\nNew in version 3.6: See PEP 525(5) for more details.\n\nNote: This function has been added on a provisional basis (see\nPEP 411(6) for details.)\n\n-- Function: sys.getcoroutineorigintrackingdepth ()\n\nGet the current coroutine origin tracking depth, as set by *note\nsetcoroutineorigintrackingdepth(): 9cf.\n\nNew in version 3.7.\n\nNote: This function has been added on a provisional basis (see\nPEP 411(7) for details.)  Use it only for debugging purposes.\n\n-- Data: sys.hashinfo\n\nA *note named tuple: 417. giving parameters of the numeric hash\nimplementation.  For more details about hashing of numeric types,\nsee *note Hashing of numeric types: 1eab.\n\n-- Attribute: hashinfo.width\n\nThe width in bits used for hash values\n\n-- Attribute: hashinfo.modulus\n\nThe prime modulus P used for numeric hash scheme\n\n-- Attribute: hashinfo.inf\n\nThe hash value returned for a positive infinity\n\n-- Attribute: hashinfo.nan\n\n(This attribute is no longer used)\n\n-- Attribute: hashinfo.imag\n\nThe multiplier used for the imaginary part of a complex number\n\n-- Attribute: hashinfo.algorithm\n\nThe name of the algorithm for hashing of str, bytes, and\nmemoryview\n\n-- Attribute: hashinfo.hashbits\n\nThe internal output size of the hash algorithm\n\n-- Attribute: hashinfo.seedbits\n\nThe size of the seed key of the hash algorithm\n\nNew in version 3.2.\n\nChanged in version 3.4: Added 'algorithm', 'hashbits' and\n'seedbits'\n\n-- Data: sys.hexversion\n\nThe version number encoded as a single integer.  This is guaranteed\nto increase with each version, including proper support for\nnon-production releases.  For example, to test that the Python\ninterpreter is at least version 1.5.2, use:\n\nif sys.hexversion >= 0x010502F0:\n# use some advanced feature\n...\nelse:\n# use an alternative implementation or warn the user\n...\n\nThis is called 'hexversion' since it only really looks meaningful\nwhen viewed as the result of passing it to the built-in *note\nhex(): 1143. function.  The *note named tuple: 417. *note\nsys.versioninfo: 46c. may be used for a more human-friendly\nencoding of the same information.\n\nMore details of 'hexversion' can be found at *note API and ABI\nVersioning: 401d.\n\n-- Data: sys.implementation\n\nAn object containing information about the implementation of the\ncurrently running Python interpreter.  The following attributes are\nrequired to exist in all Python implementations.\n\n'name' is the implementation's identifier, e.g.  ''cpython''.  The\nactual string is defined by the Python implementation, but it is\nguaranteed to be lower case.\n\n'version' is a named tuple, in the same format as *note\nsys.versioninfo: 46c.  It represents the version of the Python\n'implementation'.  This has a distinct meaning from the specific\nversion of the Python 'language' to which the currently running\ninterpreter conforms, which 'sys.versioninfo' represents.  For\nexample, for PyPy 1.8 'sys.implementation.version' might be\n'sys.versioninfo(1, 8, 0, 'final', 0)', whereas 'sys.versioninfo'\nwould be 'sys.versioninfo(2, 7, 2, 'final', 0)'.  For CPython they\nare the same value, since it is the reference implementation.\n\n'hexversion' is the implementation version in hexadecimal format,\nlike *note sys.hexversion: 401c.\n\n'cachetag' is the tag used by the import machinery in the\nfilenames of cached modules.  By convention, it would be a\ncomposite of the implementation's name and version, like\n''cpython-33''.  However, a Python implementation may use some\nother value if appropriate.  If 'cachetag' is set to 'None', it\nindicates that module caching should be disabled.\n\n*note sys.implementation: 269. may contain additional attributes\nspecific to the Python implementation.  These non-standard\nattributes must start with an underscore, and are not described\nhere.  Regardless of its contents, *note sys.implementation: 269.\nwill not change during a run of the interpreter, nor between\nimplementation versions.  (It may change between Python language\nversions, however.)  See PEP 421(8) for more information.\n\nNew in version 3.3.\n\nNote: The addition of new required attributes must go through\nthe normal PEP process.  See PEP 421(9) for more information.\n\n-- Data: sys.intinfo\n\nA *note named tuple: 417. that holds information about Python's\ninternal representation of integers.  The attributes are read only.\n\n-- Attribute: intinfo.bitsperdigit\n\nThe number of bits held in each digit.  Python integers are\nstored internally in base '2intinfo.bitsperdigit'.\n\n-- Attribute: intinfo.sizeofdigit\n\nThe size in bytes of the C type used to represent a digit.\n\n-- Attribute: intinfo.defaultmaxstrdigits\n\nThe default value for *note sys.getintmaxstrdigits():\n1f8b. when it is not otherwise explicitly configured.\n\n-- Attribute: intinfo.strdigitscheckthreshold\n\nThe minimum non-zero value for *note\nsys.setintmaxstrdigits(): 1515, *note\nPYTHONINTMAXSTRDIGITS: 1514, or *note -X intmaxstrdigits:\n188.\n\nNew in version 3.1.\n\nChanged in version 3.11: Added *note defaultmaxstrdigits: 1f8a.\nand *note strdigitscheckthreshold: 4020.\n\n-- Data: sys.interactivehook\n\nWhen this attribute exists, its value is automatically called (with\nno arguments) when the interpreter is launched in *note interactive\nmode: e39.  This is done after the *note PYTHONSTARTUP: e3b. file\nis read, so that you can set this hook there.  The *note site: c2.\nmodule *note sets this: e3c.\n\nRaises an *note auditing event: 161d. 'cpython.runinteractivehook'\nwith the hook object as the argument when the hook is called on\nstartup.\n\nNew in version 3.4.\n\n-- Function: sys.intern (string)\n\nEnter 'string' in the table of \"interned\" strings and return the\ninterned string - which is 'string' itself or a copy.  Interning\nstrings is useful to gain a little performance on dictionary lookup\n- if the keys in a dictionary are interned, and the lookup key is\ninterned, the key comparisons (after hashing) can be done by a\npointer compare instead of a string compare.  Normally, the names\nused in Python programs are automatically interned, and the\ndictionaries used to hold module, class or instance attributes have\ninterned keys.\n\nInterned strings are not immortal; you must keep a reference to the\nreturn value of *note intern(): 1150. around to benefit from it.\n\n-- Function: sys.isfinalizing ()\n\nReturn *note True: a53. if the Python interpreter is *note shutting\ndown: cd8, *note False: 971. otherwise.\n\nNew in version 3.5.\n\n-- Data: sys.lastexc\n\nThis variable is not always defined; it is set to the exception\ninstance when an exception is not handled and the interpreter\nprints an error message and a stack traceback.  Its intended use is\nto allow an interactive user to import a debugger module and engage\nin post-mortem debugging without having to re-execute the command\nthat caused the error.  (Typical use is 'import pdb; pdb.pm()' to\nenter the post-mortem debugger; see *note pdb: a0. module for more\ninformation.)\n\nNew in version 3.12.\n\n-- Data: sys.lasttype\n-- Data: sys.lastvalue\n-- Data: sys.lasttraceback\n\nThese three variables are deprecated; use *note sys.lastexc: 1e2.\ninstead.  They hold the legacy representation of 'sys.lastexc', as\nreturned from *note excinfo(): 456. above.\n\n-- Data: sys.maxsize\n\nAn integer giving the maximum value a variable of type *note\nPyssizet: 88d. can take.  It's usually '231 - 1' on a 32-bit\nplatform and '263 - 1' on a 64-bit platform.\n\n-- Data: sys.maxunicode\n\nAn integer giving the value of the largest Unicode code point, i.e.\n'1114111' ('0x10FFFF' in hexadecimal).\n\nChanged in version 3.3: Before PEP 393(10), 'sys.maxunicode' used\nto be either '0xFFFF' or '0x10FFFF', depending on the configuration\noption that specified whether Unicode characters were stored as\nUCS-2 or UCS-4.\n\n-- Data: sys.metapath\n\nA list of *note meta path finder: ee7. objects that have their\n*note findspec(): 666. methods called to see if one of the objects\ncan find the module to be imported.  By default, it holds entries\nthat implement Python's default import semantics.  The *note\nfindspec(): 666. method is called with at least the absolute name\nof the module being imported.  If the module to be imported is\ncontained in a package, then the parent package's *note path:\n19f3. attribute is passed in as a second argument.  The method\nreturns a *note module spec: 4021, or 'None' if the module cannot\nbe found.\n\nSee also\n........\n\n*note importlib.abc.MetaPathFinder: 669.\n\nThe abstract base class defining the interface of finder\nobjects on *note metapath: b80.\n\n*note importlib.machinery.ModuleSpec: 1d07.\n\nThe concrete class which *note findspec(): 666. should return\ninstances of.\n\nChanged in version 3.4: *note Module specs: 4021. were introduced\nin Python 3.4, by PEP 451(11).\n\nChanged in version 3.12: Removed the fallback that looked for a\n'findmodule()' method if a *note metapath: b80. entry didn't have\na *note findspec(): 666. method.\n\n-- Data: sys.modules\n\nThis is a dictionary that maps module names to modules which have\nalready been loaded.  This can be manipulated to force reloading of\nmodules and other tricks.  However, replacing the dictionary will\nnot necessarily work as expected and deleting essential items from\nthe dictionary may cause Python to fail.  If you want to iterate\nover this global dictionary always use 'sys.modules.copy()' or\n'tuple(sys.modules)' to avoid exceptions as its size may change\nduring iteration as a side effect of code or activity in other\nthreads.\n\n-- Data: sys.origargv\n\nThe list of the original command line arguments passed to the\nPython executable.\n\nThe elements of *note sys.origargv: 636. are the arguments to the\nPython interpreter, while the elements of *note sys.argv: 10dd. are\nthe arguments to the user's program.  Arguments consumed by the\ninterpreter itself will be present in *note sys.origargv: 636. and\nmissing from *note sys.argv: 10dd.\n\nNew in version 3.10.\n\n-- Data: sys.path\n\nA list of strings that specifies the search path for modules.\nInitialized from the environment variable *note PYTHONPATH: e92,\nplus an installation-dependent default.\n\nBy default, as initialized upon program startup, a potentially\nunsafe path is prepended to *note sys.path: 32c. ('before' the\nentries inserted as a result of *note PYTHONPATH: e92.):\n\n* 'python -m module' command line: prepend the current working\ndirectory.\n\n* 'python script.py' command line: prepend the script's\ndirectory.  If it's a symbolic link, resolve symbolic links.\n\n* 'python -c code' and 'python' (REPL) command lines: prepend an\nempty string, which means the current working directory.\n\nTo not prepend this potentially unsafe path, use the *note -P: 362.\ncommand line option or the *note PYTHONSAFEPATH: 363. environment\nvariable.\n\nA program is free to modify this list for its own purposes.  Only\nstrings should be added to *note sys.path: 32c.; all other data\ntypes are ignored during import.\n\nSee also\n........\n\n* Module *note site: c2. This describes how to use .pth files to\nextend *note sys.path: 32c.\n\n-- Data: sys.pathhooks\n\nA list of callables that take a path argument to try to create a\n*note finder: 1cfc. for the path.  If a finder can be created, it\nis to be returned by the callable, else raise *note ImportError:\n145.\n\nOriginally specified in PEP 302(12).\n\n-- Data: sys.pathimportercache\n\nA dictionary acting as a cache for *note finder: 1cfc. objects.\nThe keys are paths that have been passed to *note sys.pathhooks:\ne9b. and the values are the finders that are found.  If a path is a\nvalid file system path but no finder is found on *note\nsys.pathhooks: e9b. then 'None' is stored.\n\nOriginally specified in PEP 302(13).\n\n-- Data: sys.platform\n\nThis string contains a platform identifier that can be used to\nappend platform-specific components to *note sys.path: 32c, for\ninstance.\n\nFor Unix systems, except on Linux and AIX, this is the lowercased\nOS name as returned by 'uname -s' with the first part of the\nversion as returned by 'uname -r' appended, e.g.  ''sunos5'' or\n''freebsd8'', 'at the time when Python was built'.  Unless you want\nto test for a specific system version, it is therefore recommended\nto use the following idiom:\n\nif sys.platform.startswith('freebsd'):\n# FreeBSD-specific code here...\nelif sys.platform.startswith('linux'):\n# Linux-specific code here...\nelif sys.platform.startswith('aix'):\n# AIX-specific code here...\n\nFor other systems, the values are:\n\nSystem               'platform' value\n\n-----------------------------------------------------\n\nAIX                  ''aix''\n\n\nEmscripten           ''emscripten''\n\n\nLinux                ''linux''\n\n\nWASI                 ''wasi''\n\n\nWindows              ''win32''\n\n\nWindows/Cygwin       ''cygwin''\n\n\nmacOS                ''darwin''\n\n\nChanged in version 3.3: On Linux, *note sys.platform: 8bc. doesn't\ncontain the major version anymore.  It is always ''linux'', instead\nof ''linux2'' or ''linux3''.  Since older Python versions include\nthe version number, it is recommended to always use the\n'startswith' idiom presented above.\n\nChanged in version 3.8: On AIX, *note sys.platform: 8bc. doesn't\ncontain the major version anymore.  It is always ''aix'', instead\nof ''aix5'' or ''aix7''.  Since older Python versions include the\nversion number, it is recommended to always use the 'startswith'\nidiom presented above.\n\nSee also\n........\n\n*note os.name: 27f7. has a coarser granularity.  *note os.uname():\nf86. gives system-dependent version information.\n\nThe *note platform: a5. module provides detailed checks for the\nsystem's identity.\n\n-- Data: sys.platlibdir\n\nName of the platform-specific library directory.  It is used to\nbuild the path of standard library and the paths of installed\nextension modules.\n\nIt is equal to '\"lib\"' on most platforms.  On Fedora and SuSE, it\nis equal to '\"lib64\"' on 64-bit platforms which gives the following\n'sys.path' paths (where 'X.Y' is the Python 'major.minor' version):\n\n* '/usr/lib64/pythonX.Y/': Standard library (like 'os.py' of the\n*note os: 9c. module)\n\n* '/usr/lib64/pythonX.Y/lib-dynload/': C extension modules of\nthe standard library (like the *note errno: 52. module, the\nexact filename is platform specific)\n\n* '/usr/lib/pythonX.Y/site-packages/' (always use 'lib', not\n*note sys.platlibdir: 756.): Third-party modules\n\n* '/usr/lib64/pythonX.Y/site-packages/': C extension modules of\nthird-party packages\n\nNew in version 3.9.\n\n-- Data: sys.prefix\n\nA string giving the site-specific directory prefix where the\nplatform independent Python files are installed; on Unix, the\ndefault is '/usr/local'.  This can be set at build time with the\n*note -prefix: 1ae0. argument to the 'configure' script.  See *note\nInstallation paths: 45b. for derived paths.\n\nNote: If a *note virtual environment: 3fba. is in effect, this\nvalue will be changed in 'site.py' to point to the virtual\nenvironment.  The value for the Python installation will still\nbe available, via *note baseprefix: 391e.\n\n-- Data: sys.ps1\n-- Data: sys.ps2\n\nStrings specifying the primary and secondary prompt of the\ninterpreter.  These are only defined if the interpreter is in\ninteractive mode.  Their initial values in this case are ''>>> ''\nand ''... ''.  If a non-string object is assigned to either\nvariable, its *note str(): 157. is re-evaluated each time the\ninterpreter prepares to read a new interactive command; this can be\nused to implement a dynamic prompt.\n\n-- Function: sys.setdlopenflags (n)\n\nSet the flags used by the interpreter for 'dlopen()' calls, such as\nwhen the interpreter loads extension modules.  Among other things,\nthis will enable a lazy resolving of symbols when importing a\nmodule, if called as 'sys.setdlopenflags(0)'.  To share symbols\nacross extension modules, call as\n'sys.setdlopenflags(os.RTLDGLOBAL)'.  Symbolic names for the flag\nvalues can be found in the *note os: 9c. module ('RTLDXXX'\nconstants, e.g.  *note os.RTLDLAZY: f88.).\n\n*note Availability: 1ad3.: Unix.\n\n-- Function: sys.setintmaxstrdigits (maxdigits)\n\nSet the *note integer string conversion length limitation: 3bc.\nused by this interpreter.  See also *note getintmaxstrdigits():\n1f8b.\n\nNew in version 3.11.\n\n-- Function: sys.setprofile (profilefunc)\n\nSet the system's profile function, which allows you to implement a\nPython source code profiler in Python.  See chapter *note The\nPython Profilers: 3f0b. for more information on the Python\nprofiler.  The system's profile function is called similarly to the\nsystem's trace function (see *note settrace(): 135a.), but it is\ncalled with different events, for example it isn't called for each\nexecuted line of code (only on call and return, but the return\nevent is reported even when an exception has been set).  The\nfunction is thread-specific, but there is no way for the profiler\nto know about context switches between threads, so it does not make\nsense to use this in the presence of multiple threads.  Also, its\nreturn value is not used, so it can simply return 'None'.  Error in\nthe profile function will cause itself unset.\n\nNote: The same tracing mechanism is used for 'setprofile()' as\n*note settrace(): 135a.  To trace calls with 'setprofile()'\ninside a tracing function (e.g.  in a debugger breakpoint),\nsee *note calltracing(): 1594.\n\nProfile functions should have three arguments: 'frame', 'event',\nand 'arg'.  'frame' is the current stack frame.  'event' is a\nstring: ''call'', ''return'', ''ccall'', ''creturn'', or\n''cexception''.  'arg' depends on the event type.\n\nThe events have the following meaning:\n\n''call''\n\nA function is called (or some other code block entered).  The\nprofile function is called; 'arg' is 'None'.\n\n''return''\n\nA function (or other code block) is about to return.  The\nprofile function is called; 'arg' is the value that will be\nreturned, or 'None' if the event is caused by an exception\nbeing raised.\n\n''ccall''\n\nA C function is about to be called.  This may be an extension\nfunction or a built-in.  'arg' is the C function object.\n\n''creturn''\n\nA C function has returned.  'arg' is the C function object.\n\n''cexception''\n\nA C function has raised an exception.  'arg' is the C function\nobject.\n\nRaises an *note auditing event: 161d. 'sys.setprofile' with no\narguments.\n\n-- Function: sys.setrecursionlimit (limit)\n\nSet the maximum depth of the Python interpreter stack to 'limit'.\nThis limit prevents infinite recursion from causing an overflow of\nthe C stack and crashing Python.\n\nThe highest possible limit is platform-dependent.  A user may need\nto set the limit higher when they have a program that requires deep\nrecursion and a platform that supports a higher limit.  This should\nbe done with care, because a too-high limit can lead to a crash.\n\nIf the new limit is too low at the current recursion depth, a *note\nRecursionError: bc6. exception is raised.\n\nChanged in version 3.5.1: A *note RecursionError: bc6. exception is\nnow raised if the new limit is too low at the current recursion\ndepth.\n\n-- Function: sys.setswitchinterval (interval)\n\nSet the interpreter's thread switch interval (in seconds).  This\nfloating-point value determines the ideal duration of the\n\"timeslices\" allocated to concurrently running Python threads.\nPlease note that the actual value can be higher, especially if\nlong-running internal functions or methods are used.  Also, which\nthread becomes scheduled at the end of the interval is the\noperating system's decision.  The interpreter doesn't have its own\nscheduler.\n\nNew in version 3.2.\n\n-- Function: sys.settrace (tracefunc)\n\nSet the system's trace function, which allows you to implement a\nPython source code debugger in Python.  The function is\nthread-specific; for a debugger to support multiple threads, it\nmust register a trace function using *note settrace(): 135a. for\neach thread being debugged or use *note threading.settrace(): 63e.\n\nTrace functions should have three arguments: 'frame', 'event', and\n'arg'.  'frame' is the current stack frame.  'event' is a string:\n''call'', ''line'', ''return'', ''exception'' or ''opcode''.  'arg'\ndepends on the event type.\n\nThe trace function is invoked (with 'event' set to ''call'')\nwhenever a new local scope is entered; it should return a reference\nto a local trace function to be used for the new scope, or 'None'\nif the scope shouldn't be traced.\n\nThe local trace function should return a reference to itself, or to\nanother function which would then be used as the local trace\nfunction for the scope.\n\nIf there is any error occurred in the trace function, it will be\nunset, just like 'settrace(None)' is called.\n\nNote: Tracing is disabled while calling the trace function\n(e.g.  a function set by 'settrace()').  For recursive tracing\nsee *note calltracing(): 1594.\n\nThe events have the following meaning:\n\n''call''\n\nA function is called (or some other code block entered).  The\nglobal trace function is called; 'arg' is 'None'; the return\nvalue specifies the local trace function.\n\n''line''\n\nThe interpreter is about to execute a new line of code or\nre-execute the condition of a loop.  The local trace function\nis called; 'arg' is 'None'; the return value specifies the new\nlocal trace function.  See 'Objects/lnotabnotes.txt' for a\ndetailed explanation of how this works.  Per-line events may\nbe disabled for a frame by setting *note ftracelines: a1f.\nto *note False: 971. on that *note frame: 4af.\n\n''return''\n\nA function (or other code block) is about to return.  The\nlocal trace function is called; 'arg' is the value that will\nbe returned, or 'None' if the event is caused by an exception\nbeing raised.  The trace function's return value is ignored.\n\n''exception''\n\nAn exception has occurred.  The local trace function is\ncalled; 'arg' is a tuple '(exception, value, traceback)'; the\nreturn value specifies the new local trace function.\n\n''opcode''\n\nThe interpreter is about to execute a new opcode (see *note\ndis: 35. for opcode details).  The local trace function is\ncalled; 'arg' is 'None'; the return value specifies the new\nlocal trace function.  Per-opcode events are not emitted by\ndefault: they must be explicitly requested by setting *note\nftraceopcodes: a20. to *note True: a53. on the *note frame:\n4af.\n\nNote that as an exception is propagated down the chain of callers,\nan ''exception'' event is generated at each level.\n\nFor more fine-grained usage, it's possible to set a trace function\nby assigning 'frame.ftrace = tracefunc' explicitly, rather than\nrelying on it being set indirectly via the return value from an\nalready installed trace function.  This is also required for\nactivating the trace function on the current frame, which *note\nsettrace(): 135a. doesn't do.  Note that in order for this to work,\na global tracing function must have been installed with *note\nsettrace(): 135a. in order to enable the runtime tracing machinery,\nbut it doesn't need to be the same tracing function (e.g.  it could\nbe a low overhead tracing function that simply returns 'None' to\ndisable itself immediately on each frame).\n\nFor more information on code and frame objects, refer to *note The\nstandard type hierarchy: 1c05.\n\nRaises an *note auditing event: 161d. 'sys.settrace' with no\narguments.\n\n'CPython implementation detail:' The *note settrace(): 135a.\nfunction is intended only for implementing debuggers, profilers,\ncoverage tools and the like.  Its behavior is part of the\nimplementation platform, rather than part of the language\ndefinition, and thus may not be available in all Python\nimplementations.\n\nChanged in version 3.7: ''opcode'' event type added; *note\nftracelines: a1f. and *note ftraceopcodes: a20. attributes\nadded to frames\n\nChanged in version 3.12: ''opcode'' event will only be emitted if\n*note ftraceopcodes: a20. of at least one frame has been set to\n*note True: a53. before *note settrace(): 135a. is called.  This\nbehavior will be changed back in 3.13 to be consistent with\nprevious versions.\n\n-- Function: sys.setasyncgenhooks ([firstiter] [, finalizer])\n\nAccepts two optional keyword arguments which are callables that\naccept an *note asynchronous generator iterator: 4014. as an\nargument.  The 'firstiter' callable will be called when an\nasynchronous generator is iterated for the first time.  The\n'finalizer' will be called when an asynchronous generator is about\nto be garbage collected.\n\nRaises an *note auditing event: 161d.\n'sys.setasyncgenhooksfirstiter' with no arguments.\n\nRaises an *note auditing event: 161d.\n'sys.setasyncgenhooksfinalizer' with no arguments.\n\nTwo auditing events are raised because the underlying API consists\nof two calls, each of which must raise its own event.\n\nNew in version 3.6: See PEP 525(14) for more details, and for a\nreference example of a 'finalizer' method see the implementation of\n'asyncio.Loop.shutdownasyncgens' in Lib/asyncio/baseevents.py(15)\n\nNote: This function has been added on a provisional basis (see\nPEP 411(16) for details.)\n\n-- Function: sys.setcoroutineorigintrackingdepth (depth)\n\nAllows enabling or disabling coroutine origin tracking.  When\nenabled, the 'crorigin' attribute on coroutine objects will\ncontain a tuple of (filename, line number, function name) tuples\ndescribing the traceback where the coroutine object was created,\nwith the most recent call first.  When disabled, 'crorigin' will\nbe None.\n\nTo enable, pass a 'depth' value greater than zero; this sets the\nnumber of frames whose information will be captured.  To disable,\npass set 'depth' to zero.\n\nThis setting is thread-specific.\n\nNew in version 3.7.\n\nNote: This function has been added on a provisional basis (see\nPEP 411(17) for details.)  Use it only for debugging purposes.\n\n-- Function: sys.activatestacktrampoline (backend, /)\n\nActivate the stack profiler trampoline 'backend'.  The only\nsupported backend is '\"perf\"'.\n\n*note Availability: 1ad3.: Linux.\n\nNew in version 3.12.\n\nSee also\n........\n\n* *note Python support for the Linux perf profiler: 151.\n\n* 'https://perf.wiki.kernel.org'\n\n-- Function: sys.deactivatestacktrampoline ()\n\nDeactivate the current stack profiler trampoline backend.\n\nIf no stack profiler is activated, this function has no effect.\n\n*note Availability: 1ad3.: Linux.\n\nNew in version 3.12.\n\n-- Function: sys.isstacktrampolineactive ()\n\nReturn 'True' if a stack profiler trampoline is active.\n\n*note Availability: 1ad3.: Linux.\n\nNew in version 3.12.\n\n-- Function: sys.enablelegacywindowsfsencoding ()\n\nChanges the *note filesystem encoding and error handler: 291. to\n'mbcs' and 'replace' respectively, for consistency with versions of\nPython prior to 3.6.\n\nThis is equivalent to defining the *note\nPYTHONLEGACYWINDOWSFSENCODING: aa3. environment variable before\nlaunching Python.\n\nSee also *note sys.getfilesystemencoding(): aa2. and *note\nsys.getfilesystemencodeerrors(): b35.\n\n*note Availability: 1ad3.: Windows.\n\nNew in version 3.6: See PEP 529(18) for more details.\n\n-- Data: sys.stdin\n-- Data: sys.stdout\n-- Data: sys.stderr\n\n*note File objects: 1037. used by the interpreter for standard\ninput, output and errors:\n\n* 'stdin' is used for all interactive input (including calls to\n*note input(): 114d.);\n\n* 'stdout' is used for the output of *note print(): de5. and\n*note expression: 1c8d. statements and for the prompts of\n*note input(): 114d.;\n\n* The interpreter's own prompts and its error messages go to\n'stderr'.\n\nThese streams are regular *note text files: 1a0b. like those\nreturned by the *note open(): 26e. function.  Their parameters are\nchosen as follows:\n\n* The encoding and error handling are is initialized from *note\nPyConfig.stdioencoding: 4022. and *note\nPyConfig.stdioerrors: 4023.\n\nOn Windows, UTF-8 is used for the console device.\nNon-character devices such as disk files and pipes use the\nsystem locale encoding (i.e.  the ANSI codepage).  Non-console\ncharacter devices such as NUL (i.e.  where 'isatty()' returns\n'True') use the value of the console input and output\ncodepages at startup, respectively for stdin and\nstdout/stderr.  This defaults to the system *note locale\nencoding: 27fa. if the process is not initially attached to a\nconsole.\n\nThe special behaviour of the console can be overridden by\nsetting the environment variable PYTHONLEGACYWINDOWSSTDIO\nbefore starting Python.  In that case, the console codepages\nare used as for any other character device.\n\nUnder all platforms, you can override the character encoding\nby setting the *note PYTHONIOENCODING: e7e. environment\nvariable before starting Python or by using the new *note -X:\n188. 'utf8' command line option and *note PYTHONUTF8: 90e.\nenvironment variable.  However, for the Windows console, this\nonly applies when *note PYTHONLEGACYWINDOWSSTDIO: aa6. is also\nset.\n\n* When interactive, the 'stdout' stream is line-buffered.\nOtherwise, it is block-buffered like regular text files.  The\n'stderr' stream is line-buffered in both cases.  You can make\nboth streams unbuffered by passing the *note -u: 1712.\ncommand-line option or setting the *note PYTHONUNBUFFERED:\n1713. environment variable.\n\nChanged in version 3.9: Non-interactive 'stderr' is now\nline-buffered instead of fully buffered.\n\nNote: To write or read binary data from/to the standard\nstreams, use the underlying binary *note buffer: 111a. object.\nFor example, to write bytes to *note stdout: 90c, use\n'sys.stdout.buffer.write(b'abc')'.\n\nHowever, if you are writing a library (and do not control in\nwhich context its code will be executed), be aware that the\nstandard streams may be replaced with file-like objects like\n*note io.StringIO: d94. which do not support the 'buffer'\nattribute.\n\n-- Data: sys.stdin\n-- Data: sys.stdout\n-- Data: sys.stderr\n\nThese objects contain the original values of 'stdin', 'stderr' and\n'stdout' at the start of the program.  They are used during\nfinalization, and could be useful to print to the actual standard\nstream no matter if the 'sys.std*' object has been redirected.\n\nIt can also be used to restore the actual files to known working\nfile objects in case they have been overwritten with a broken\nobject.  However, the preferred way to do this is to explicitly\nsave the previous stream before replacing it, and restore the saved\nobject.\n\nNote: Under some conditions 'stdin', 'stdout' and 'stderr' as\nwell as the original values 'stdin', 'stdout' and\n'stderr' can be 'None'.  It is usually the case for\nWindows GUI apps that aren't connected to a console and Python\napps started with 'pythonw'.\n\n-- Data: sys.stdlibmodulenames\n\nA frozenset of strings containing the names of standard library\nmodules.\n\nIt is the same on all platforms.  Modules which are not available\non some platforms and modules disabled at Python build are also\nlisted.  All module kinds are listed: pure Python, built-in, frozen\nand extension modules.  Test modules are excluded.\n\nFor packages, only the main package is listed: sub-packages and\nsub-modules are not listed.  For example, the 'email' package is\nlisted, but the 'email.mime' sub-package and the 'email.message'\nsub-module are not listed.\n\nSee also the *note sys.builtinmodulenames: 19e4. list.\n\nNew in version 3.10.\n\n-- Data: sys.threadinfo\n\nA *note named tuple: 417. holding information about the thread\nimplementation.\n\n-- Attribute: threadinfo.name\n\nThe name of the thread implementation:\n\n* '\"nt\"': Windows threads\n\n* '\"pthread\"': POSIX threads\n\n* '\"pthread-stubs\"': stub POSIX threads (on WebAssembly\nplatforms without threading support)\n\n* '\"solaris\"': Solaris threads\n\n-- Attribute: threadinfo.lock\n\nThe name of the lock implementation:\n\n* '\"semaphore\"': a lock uses a semaphore\n\n* '\"mutex+cond\"': a lock uses a mutex and a condition\nvariable\n\n* 'None' if this information is unknown\n\n-- Attribute: threadinfo.version\n\nThe name and version of the thread library.  It is a string,\nor 'None' if this information is unknown.\n\nNew in version 3.3.\n\n-- Data: sys.tracebacklimit\n\nWhen this variable is set to an integer value, it determines the\nmaximum number of levels of traceback information printed when an\nunhandled exception occurs.  The default is '1000'.  When set to\n'0' or less, all traceback information is suppressed and only the\nexception type and value are printed.\n\n-- Function: sys.unraisablehook (unraisable, /)\n\nHandle an unraisable exception.\n\nCalled when an exception has occurred but there is no way for\nPython to handle it.  For example, when a destructor raises an\nexception or during garbage collection (*note gc.collect(): 865.).\n\nThe 'unraisable' argument has the following attributes:\n\n* 'exctype': Exception type.\n\n* 'excvalue': Exception value, can be 'None'.\n\n* 'exctraceback': Exception traceback, can be 'None'.\n\n* 'errmsg': Error message, can be 'None'.\n\n* 'object': Object causing the exception, can be 'None'.\n\nThe default hook formats 'errmsg' and 'object' as: 'f'{errmsg}:\n{object!r}''; use \"Exception ignored in\" error message if 'errmsg'\nis 'None'.\n\n*note sys.unraisablehook(): 448. can be overridden to control how\nunraisable exceptions are handled.\n\nSee also\n........\n\n*note excepthook(): 5ff. which handles uncaught exceptions.\n\nWarning: Storing 'excvalue' using a custom hook can create a\nreference cycle.  It should be cleared explicitly to break the\nreference cycle when the exception is no longer needed.\n\nStoring 'object' using a custom hook can resurrect it if it is\nset to an object which is being finalized.  Avoid storing\n'object' after the custom hook completes to avoid resurrecting\nobjects.\n\nRaise an auditing event 'sys.unraisablehook' with arguments 'hook',\n'unraisable' when an exception that cannot be handled occurs.  The\n'unraisable' object is the same as what will be passed to the hook.\nIf no hook has been set, 'hook' may be 'None'.\n\nNew in version 3.8.\n\n-- Data: sys.version\n\nA string containing the version number of the Python interpreter\nplus additional information on the build number and compiler used.\nThis string is displayed when the interactive interpreter is\nstarted.  Do not extract version information out of it, rather, use\n*note versioninfo: 46c. and the functions provided by the *note\nplatform: a5. module.\n\n-- Data: sys.apiversion\n\nThe C API version for this interpreter.  Programmers may find this\nuseful when debugging version conflicts between Python and\nextension modules.\n\n-- Data: sys.versioninfo\n\nA tuple containing the five components of the version number:\n'major', 'minor', 'micro', 'releaselevel', and 'serial'.  All\nvalues except 'releaselevel' are integers; the release level is\n''alpha'', ''beta'', ''candidate'', or ''final''.  The\n'versioninfo' value corresponding to the Python version 2.0 is\n'(2, 0, 0, 'final', 0)'.  The components can also be accessed by\nname, so 'sys.versioninfo[0]' is equivalent to\n'sys.versioninfo.major' and so on.\n\nChanged in version 3.1: Added named component attributes.\n\n-- Data: sys.warnoptions\n\nThis is an implementation detail of the warnings framework; do not\nmodify this value.  Refer to the *note warnings: 10d. module for\nmore information on the warnings framework.\n\n-- Data: sys.winver\n\nThe version number used to form registry keys on Windows platforms.\nThis is stored as string resource 1000 in the Python DLL. The value\nis normally the major and minor versions of the running Python\ninterpreter.  It is provided in the *note sys: d3. module for\ninformational purposes; modifying this value has no effect on the\nregistry keys used by Python.\n\n*note Availability: 1ad3.: Windows.\n\n-- Data: sys.monitoring\n\nNamespace containing functions and constants for register callbacks\nand controlling monitoring events.  See *note sys.monitoring: d4.\nfor details.\n\n-- Data: sys.xoptions\n\nA dictionary of the various implementation-specific flags passed\nthrough the *note -X: 188. command-line option.  Option names are\neither mapped to their values, if given explicitly, or to *note\nTrue: a53.  Example:\n\n$ ./python -Xa=b -Xc\nPython 3.2a3+ (py3k, Oct 16 2010, 20:14:50)\n[GCC 4.4.3] on linux2\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> import sys\n>>> sys.xoptions\n{'a': 'b', 'c': True}\n\n'CPython implementation detail:' This is a CPython-specific way of\naccessing options passed through *note -X: 188.  Other\nimplementations may export them through other means, or not at all.\n\nNew in version 3.2.\n",
            "subsections": []
        },
        "Citations": {
            "content": ".........\n\n(C99) ISO/IEC 9899:1999.  \"Programming languages - C.\" A public draft of\nthis standard is available at\n'https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf'.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3149/\n\n(2) https://peps.python.org/pep-0578/\n\n(3) https://peps.python.org/pep-0529/\n\n(4) https://code.activestate.com/recipes/577504/\n\n(5) https://peps.python.org/pep-0525/\n\n(6) https://peps.python.org/pep-0411/\n\n(7) https://peps.python.org/pep-0411/\n\n(8) https://peps.python.org/pep-0421/\n\n(9) https://peps.python.org/pep-0421/\n\n(10) https://peps.python.org/pep-0393/\n\n(11) https://peps.python.org/pep-0451/\n\n(12) https://peps.python.org/pep-0302/\n\n(13) https://peps.python.org/pep-0302/\n\n(14) https://peps.python.org/pep-0525/\n\n(15)\nhttps://github.com/python/cpython/tree/3.12/Lib/asyncio/baseevents.py\n\n(16) https://peps.python.org/pep-0411/\n\n(17) https://peps.python.org/pep-0411/\n\n(18) https://peps.python.org/pep-0529/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "New in version 3.12.\n\n\n\nNote: *note sys.monitoring: d4. is a namespace within the *note\nsys: d3. module, not an independent module, so there is no need to\n'import sys.monitoring', simply 'import sys' and then use\n'sys.monitoring'.\n",
            "subsections": []
        },
        "This namespace provides access to the functions and constants necessary": {
            "content": "to activate and control event monitoring.\n",
            "subsections": []
        },
        "As programs execute, events occur that might be of interest to tools": {
            "content": "that monitor execution.  The *note sys.monitoring: d4. namespace\nprovides means to receive callbacks when events of interest occur.\n\nThe monitoring API consists of three components:\n\n* *note Tool identifiers: 402d.\n\n* *note Events: 402e.\n\n* *note Callbacks: 402f.\n\n* Menu:\n\n* Tool identifiers::\n* Events::\n* Turning events on and off::\n* Registering callback functions::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Tool identifiers,  Next: Events,  Up: sys monitoring -- Execution event monitoring": {
            "content": "5.29.2.1 Tool identifiers\n.........................\n\nA tool identifier is an integer and the associated name.  Tool\nidentifiers are used to discourage tools from interfering with each\nother and to allow multiple tools to operate at the same time.",
            "subsections": []
        },
        "Currently tools are completely independent and cannot be used to monitor": {
            "content": "each other.  This restriction may be lifted in the future.\n",
            "subsections": []
        },
        "Before registering or activating events, a tool should choose an": {
            "content": "identifier.  Identifiers are integers in the range 0 to 5 inclusive.\n\n* Menu:\n\n* Registering and using tools::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Registering and using tools,  Up: Tool identifiers": {
            "content": "5.29.2.2 Registering and using tools\n....................................\n\n-- Function: sys.monitoring.usetoolid (toolid: int, name: str, /) ->\nNone\n\nMust be called before 'toolid' can be used.  'toolid' must be in\nthe range 0 to 5 inclusive.  Raises a *note ValueError: 183. if\n'toolid' is in use.\n\n-- Function: sys.monitoring.freetoolid (toolid: int, /) -> None\n\nShould be called once a tool no longer requires 'toolid'.\n\nNote: *note freetoolid(): 4032. will not disable global or local\nevents associated with 'toolid', nor will it unregister any\ncallback functions.  This function is only intended to be used to\nnotify the VM that the particular 'toolid' is no longer in use.\n\n-- Function: sys.monitoring.gettool (toolid: int, /) -> str | None\n\nReturns the name of the tool if 'toolid' is in use, otherwise it\nreturns 'None'.  'toolid' must be in the range 0 to 5 inclusive.\n",
            "subsections": []
        },
        "All IDs are treated the same by the VM with regard to events, but the": {
            "content": "following IDs are pre-defined to make co-operation of tools easier:\n\nsys.monitoring.DEBUGGERID = 0\nsys.monitoring.COVERAGEID = 1\nsys.monitoring.PROFILERID = 2\nsys.monitoring.OPTIMIZERID = 5\n",
            "subsections": []
        },
        "There is no obligation to set an ID, nor is there anything preventing a": {
            "content": "tool from using an ID even it is already in use.  However, tools are\nencouraged to use a unique ID and respect other tools.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Events,  Next: Turning events on and off,  Prev: Tool identifiers,  Up: sys monitoring -- Execution event monitoring": {
            "content": "5.29.2.3 Events\n...............\n\nThe following events are supported:\n\n-- monitoring-event: sys.monitoring.events.BRANCH\n\nA conditional branch is taken (or not).\n\n-- monitoring-event: sys.monitoring.events.CALL\n\nA call in Python code (event occurs before the call).\n\n-- monitoring-event: sys.monitoring.events.CRAISE\n\nAn exception raised from any callable, except for Python functions\n(event occurs after the exit).\n\n-- monitoring-event: sys.monitoring.events.CRETURN\n\nReturn from any callable, except for Python functions (event occurs\nafter the return).\n\n-- monitoring-event: sys.monitoring.events.EXCEPTIONHANDLED\n\nAn exception is handled.\n\n-- monitoring-event: sys.monitoring.events.INSTRUCTION\n\nA VM instruction is about to be executed.\n\n-- monitoring-event: sys.monitoring.events.JUMP\n\nAn unconditional jump in the control flow graph is made.\n\n-- monitoring-event: sys.monitoring.events.LINE\n\nAn instruction is about to be executed that has a different line\nnumber from the preceding instruction.\n\n-- monitoring-event: sys.monitoring.events.PYRESUME\n\nResumption of a Python function (for generator and coroutine\nfunctions), except for 'throw()' calls.\n\n-- monitoring-event: sys.monitoring.events.PYRETURN\n\nReturn from a Python function (occurs immediately before the\nreturn, the callee's frame will be on the stack).\n\n-- monitoring-event: sys.monitoring.events.PYSTART\n\nStart of a Python function (occurs immediately after the call, the\ncallee's frame will be on the stack)\n\n-- monitoring-event: sys.monitoring.events.PYTHROW\n\nA Python function is resumed by a 'throw()' call.\n\n-- monitoring-event: sys.monitoring.events.PYUNWIND\n\nExit from a Python function during exception unwinding.\n\n-- monitoring-event: sys.monitoring.events.PYYIELD\n\nYield from a Python function (occurs immediately before the yield,\nthe callee's frame will be on the stack).\n\n-- monitoring-event: sys.monitoring.events.RAISE\n\nAn exception is raised, except those that cause a *note\nSTOPITERATION: 4042. event.\n\n-- monitoring-event: sys.monitoring.events.RERAISE\n\nAn exception is re-raised, for example at the end of a *note\nfinally: 7ee. block.\n\n-- monitoring-event: sys.monitoring.events.STOPITERATION\n\nAn artificial *note StopIteration: a40. is raised; see *note the\nSTOPITERATION event: 4044.\n\nMore events may be added in the future.\n\nThese events are attributes of the 'sys.monitoring.events' namespace.",
            "subsections": []
        },
        "Each event is represented as a power-of-2 integer constant.  To define a": {
            "content": "set of events, simply bitwise or the individual events together.  For\nexample, to specify both *note PYRETURN: 403c. and *note PYSTART:\n403d. events, use the expression 'PYRETURN | PYSTART'.\n\n-- monitoring-event: sys.monitoring.events.NOEVENTS\n\nAn alias for '0' so users can do explict comparisions like:\n\nif getevents(DEBUGGERID) == NOEVENTS:\n...\n\nEvents are divided into three groups:\n\n* Menu:\n\n* Local events::\n* Ancillary events::\n* Other events::\n* The STOPITERATION event::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Local events,  Next: Ancillary events,  Up: Events": {
            "content": "5.29.2.4 Local events\n.....................\n",
            "subsections": []
        },
        "Local events are associated with normal execution of the program and": {
            "content": "happen at clearly defined locations.  All local events can be disabled.\nThe local events are:\n\n* *note PYSTART: 403d.\n\n* *note PYRESUME: 403b.\n\n* *note PYRETURN: 403c.\n\n* *note PYYIELD: 4040.\n\n* *note CALL: 13b0.\n\n* *note LINE: 403a.\n\n* *note INSTRUCTION: 4038.\n\n* *note JUMP: 4039.\n\n* *note BRANCH: 4034.\n\n* *note STOPITERATION: 4042.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Ancillary events,  Next: Other events,  Prev: Local events,  Up: Events": {
            "content": "5.29.2.5 Ancillary events\n.........................\n",
            "subsections": []
        },
        "Ancillary events can be monitored like other events, but are controlled": {
            "content": "by another event:\n\n* *note CRAISE: 4035.\n\n* *note CRETURN: 4036.\n\nThe *note CRETURN: 4036. and *note CRAISE: 4035. events are controlled\nby the *note CALL: 13b0. event.  *note CRETURN: 4036. and *note\nCRAISE: 4035. events will only be seen if the corresponding *note CALL:\n13b0. event is being monitored.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Other events,  Next: The STOPITERATION event,  Prev: Ancillary events,  Up: Events": {
            "content": "5.29.2.6 Other events\n.....................\n",
            "subsections": []
        },
        "Other events are not necessarily tied to a specific location in the": {
            "content": "program and cannot be individually disabled.\n\nThe other events that can be monitored are:\n\n* *note PYTHROW: 403e.\n\n* *note PYUNWIND: 403f.\n\n* *note RAISE: 4041.\n\n* *note EXCEPTIONHANDLED: 4037.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The STOPITERATION event,  Prev: Other events,  Up: Events": {
            "content": "5.29.2.7 The STOPITERATION event\n.................................\n\nPEP 380(1) specifies that a *note StopIteration: a40. exception is\nraised when returning a value from a generator or coroutine.  However,\nthis is a very inefficient way to return a value, so some Python\nimplementations, notably CPython 3.12+, do not raise an exception unless\nit would be visible to other code.\n",
            "subsections": []
        },
        "To allow tools to monitor for real exceptions without slowing down": {
            "content": "generators and coroutines, the *note STOPITERATION: 4042. event is\nprovided.  *note STOPITERATION: 4042. can be locally disabled, unlike\n*note RAISE: 4041.\n\n---------- Footnotes ----------\n\n(1)\nhttps://peps.python.org/pep-0380/#use-of-stopiteration-to-return-values\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Turning events on and off,  Next: Registering callback functions,  Prev: Events,  Up: sys monitoring -- Execution event monitoring": {
            "content": "5.29.2.8 Turning events on and off\n..................................\n",
            "subsections": []
        },
        "In order to monitor an event, it must be turned on and a corresponding": {
            "content": "callback must be registered.  Events can be turned on or off by setting\nthe events either globally or for a particular code object.\n\n* Menu:\n\n* Setting events globally::\n* Per code object events::\n* Disabling events::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Setting events globally,  Next: Per code object events,  Up: Turning events on and off": {
            "content": "5.29.2.9 Setting events globally\n................................\n",
            "subsections": []
        },
        "Events can be controlled globally by modifying the set of events being": {
            "content": "monitored.\n\n-- Function: sys.monitoring.getevents (toolid: int, /) -> int\n\nReturns the 'int' representing all the active events.\n\n-- Function: sys.monitoring.setevents (toolid: int, eventset: int,\n/) -> None\n\nActivates all events which are set in 'eventset'.  Raises a *note\nValueError: 183. if 'toolid' is not in use.\n\nNo events are active by default.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Per code object events,  Next: Disabling events,  Prev: Setting events globally,  Up: Turning events on and off": {
            "content": "5.29.2.10 Per code object events\n................................\n\nEvents can also be controlled on a per code object basis.\n\n-- Function: sys.monitoring.getlocalevents (toolid: int, code:\nCodeType, /) -> int\n\nReturns all the local events for 'code'\n\n-- Function: sys.monitoring.setlocalevents (toolid: int, code:\nCodeType, eventset: int, /) -> None\n\nActivates all the local events for 'code' which are set in\n'eventset'.  Raises a *note ValueError: 183. if 'toolid' is not\nin use.\n",
            "subsections": []
        },
        "Local events add to global events, but do not mask them.  In other": {
            "content": "words, all global events will trigger for a code object, regardless of\nthe local events.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Disabling events,  Prev: Per code object events,  Up: Turning events on and off": {
            "content": "5.29.2.11 Disabling events\n..........................\n\n-- Data: sys.monitoring.DISABLE\n\nA special value that can be returned from a callback function to\ndisable events for the current code location.\n",
            "subsections": []
        },
        "Local events can be disabled for a specific code location by returning": {
            "content": "*note sys.monitoring.DISABLE: 4051. from a callback function.  This does\nnot change which events are set, or any other code locations for the\nsame event.\n",
            "subsections": []
        },
        "Disabling events for specific locations is very important for high": {
            "content": "performance monitoring.  For example, a program can be run under a\ndebugger with no overhead if the debugger disables all monitoring except\nfor a few breakpoints.\n\n-- Function: sys.monitoring.restartevents () -> None\n\nEnable all the events that were disabled by *note\nsys.monitoring.DISABLE: 4051. for all tools.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Registering callback functions,  Prev: Turning events on and off,  Up: sys monitoring -- Execution event monitoring": {
            "content": "5.29.2.12 Registering callback functions\n........................................\n",
            "subsections": []
        },
        "To register a callable for events call": {
            "content": "-- Function: sys.monitoring.registercallback (toolid: int, event:\nint, func: Callable | None, /) -> Callable | None\n\nRegisters the callable 'func' for the 'event' with the given\n'toolid'\n\nIf another callback was registered for the given 'toolid' and\n'event', it is unregistered and returned.  Otherwise *note\nregistercallback(): 4054. returns 'None'.\n",
            "subsections": []
        },
        "Functions can be unregistered by calling": {
            "content": "'sys.monitoring.registercallback(toolid, event, None)'.\n\nCallback functions can be registered and unregistered at any time.\n\nRegistering or unregistering a callback function will generate a *note\nsys.audit(): 16dc. event.\n\n* Menu:\n\n* Callback function arguments::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Callback function arguments,  Up: Registering callback functions": {
            "content": "5.29.2.13 Callback function arguments\n.....................................\n\n-- Data: sys.monitoring.MISSING\n\nA special value that is passed to a callback function to indicate\nthat there are no arguments to the call.\n\nWhen an active event occurs, the registered callback function is called.",
            "subsections": []
        },
        "Different events will provide the callback function with different": {
            "content": "arguments, as follows:\n\n* *note PYSTART: 403d. and *note PYRESUME: 403b.:\n\nfunc(code: CodeType, instructionoffset: int) -> DISABLE | Any\n\n* *note PYRETURN: 403c. and *note PYYIELD: 4040.:\n\nfunc(code: CodeType, instructionoffset: int, retval: object) -> DISABLE | Any\n\n* *note CALL: 13b0, *note CRAISE: 4035. and *note CRETURN: 4036.:\n\nfunc(code: CodeType, instructionoffset: int, callable: object, arg0: object | MISSING) -> DISABLE | Any\n\nIf there are no arguments, 'arg0' is set to *note\nsys.monitoring.MISSING: 4056.\n\n* *note RAISE: 4041, *note RERAISE: 4043, *note EXCEPTIONHANDLED:\n4037, *note PYUNWIND: 403f, *note PYTHROW: 403e. and *note\nSTOPITERATION: 4042.:\n\nfunc(code: CodeType, instructionoffset: int, exception: BaseException) -> DISABLE | Any\n\n* *note LINE: 403a.:\n\nfunc(code: CodeType, linenumber: int) -> DISABLE | Any\n\n* *note BRANCH: 4034. and *note JUMP: 4039.:\n\nfunc(code: CodeType, instructionoffset: int, destinationoffset: int) -> DISABLE | Any\n\nNote that the 'destinationoffset' is where the code will next\nexecute.  For an untaken branch this will be the offset of the\ninstruction following the branch.\n\n* *note INSTRUCTION: 4038.:\n\nfunc(code: CodeType, instructionoffset: int) -> DISABLE | Any\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "New in version 3.2.\n\n'Source code:' Lib/sysconfig.py(1)\n\n\n\nThe *note sysconfig: d5. module provides access to Python's\nconfiguration information like the list of installation paths and the\nconfiguration variables relevant for the current platform.\n\n* Menu:\n\n* Configuration variables::\n* Installation paths::\n* User scheme::\n* Home scheme::\n* Prefix scheme::\n* Installation path functions::\n* Other functions: Other functions<3>.\n* Using sysconfig as a script::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/sysconfig.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Configuration variables,  Next: Installation paths,  Up: sysconfig -- Provide access to Python's configuration information": {
            "content": "5.29.3.1 Configuration variables\n................................\n\nA Python distribution contains a 'Makefile' and a 'pyconfig.h' header\nfile that are necessary to build both the Python binary itself and\nthird-party C extensions compiled using 'setuptools'.\n\n*note sysconfig: d5. puts all variables found in these files in a\ndictionary that can be accessed using *note getconfigvars(): ea3. or\n*note getconfigvar(): ea2.\n\nNotice that on Windows, it's a much smaller set.\n\n-- Function: sysconfig.getconfigvars (*args)\n\nWith no arguments, return a dictionary of all configuration\nvariables relevant for the current platform.\n\nWith arguments, return a list of values that result from looking up\neach argument in the configuration variable dictionary.\n\nFor each argument, if the value is not found, return 'None'.\n\n-- Function: sysconfig.getconfigvar (name)\n\nReturn the value of a single variable 'name'.  Equivalent to\n'getconfigvars().get(name)'.\n\nIf 'name' is not found, return 'None'.\n\nExample of usage:\n\n>>> import sysconfig\n>>> sysconfig.getconfigvar('PyENABLESHARED')\n0\n>>> sysconfig.getconfigvar('LIBDIR')\n'/usr/local/lib'\n>>> sysconfig.getconfigvars('AR', 'CXX')\n['ar', 'g++']\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Installation paths,  Next: User scheme,  Prev: Configuration variables,  Up: sysconfig -- Provide access to Python's configuration information": {
            "content": "5.29.3.2 Installation paths\n...........................\n",
            "subsections": []
        },
        "Python uses an installation scheme that differs depending on the": {
            "content": "platform and on the installation options.  These schemes are stored in\n*note sysconfig: d5. under unique identifiers based on the value\nreturned by *note os.name: 27f7.  The schemes are used by package\ninstallers to determine where to copy files to.\n\nPython currently supports nine schemes:\n\n- 'posixprefix': scheme for POSIX platforms like Linux or macOS.\nThis is the default scheme used when Python or a component is\ninstalled.\n\n- 'posixhome': scheme for POSIX platforms, when the 'home' option is\nused.  This scheme defines paths located under a specific home\nprefix.\n\n- 'posixuser': scheme for POSIX platforms, when the 'user' option is\nused.  This scheme defines paths located under the user's home\ndirectory (*note site.USERBASE: 1194.).\n\n- 'posixvenv': scheme for *note Python virtual environments: 10c. on\nPOSIX platforms; by default it is the same as 'posixprefix'.\n\n- 'nt': scheme for Windows.  This is the default scheme used when\nPython or a component is installed.\n\n- 'ntuser': scheme for Windows, when the 'user' option is used.\n\n- 'ntvenv': scheme for *note Python virtual environments: 10c. on\nWindows; by default it is the same as 'nt'.\n\n- 'venv': a scheme with values from either 'posixvenv' or 'ntvenv'\ndepending on the platform Python runs on.\n\n- 'osxframeworkuser': scheme for macOS, when the 'user' option is\nused.\n",
            "subsections": []
        },
        "Each scheme is itself composed of a series of paths and each path has a": {
            "content": "unique identifier.  Python currently uses eight paths:\n\n- 'stdlib': directory containing the standard Python library files\nthat are not platform-specific.\n\n- 'platstdlib': directory containing the standard Python library\nfiles that are platform-specific.\n\n- 'platlib': directory for site-specific, platform-specific files.\n\n- 'purelib': directory for site-specific, non-platform-specific files\n('pure' Python).\n\n- 'include': directory for non-platform-specific header files for the\nPython C-API.\n\n- 'platinclude': directory for platform-specific header files for the\nPython C-API.\n\n- 'scripts': directory for script files.\n\n- 'data': directory for data files.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: User scheme,  Next: Home scheme,  Prev: Installation paths,  Up: sysconfig -- Provide access to Python's configuration information": {
            "content": "5.29.3.3 User scheme\n....................\n",
            "subsections": []
        },
        "This scheme is designed to be the most convenient solution for users": {
            "content": "that don't have write permission to the global site-packages directory\nor don't want to install into it.\n\nFiles will be installed into subdirectories of *note site.USERBASE:\n1194. (written as '`userbase'' hereafter).  This scheme installs pure",
            "subsections": []
        },
        "Python modules and extension modules in the same location (also known as": {
            "content": "*note site.USERSITE: 1ab8.).\n\n* Menu:\n\n* posixuser::\n* ntuser::\n* osxframeworkuser::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: posixuser,  Next: ntuser,  Up: User scheme": {
            "content": "5.29.3.4 'posixuser'\n.....................\n",
            "subsections": []
        },
        "Path               Installation directory": {
            "content": "----------------------------------------------------------------------------------\n\n'stdlib'           '`prefix'\\Lib'\n\n\n'platstdlib'       '`prefix'\\Lib'\n\n\n'platlib'          '`prefix'\\Lib\\site-packages'\n\n\n'purelib'          '`prefix'\\Lib\\site-packages'\n\n\n'include'          '`prefix'\\Include'\n\n\n'platinclude'      '`prefix'\\Include'\n\n\n'scripts'          '`prefix'\\Scripts'\n\n\n'data'             '`prefix''\n\n\nFile: python3.12.info,  Node: Installation path functions,  Next: Other functions<3>,  Prev: Prefix scheme,  Up: sysconfig -- Provide access to Python's configuration information\n\n5.29.3.12 Installation path functions\n.....................................\n\n*note sysconfig: d5. provides some functions to determine these\ninstallation paths.\n\n-- Function: sysconfig.getschemenames ()\n\nReturn a tuple containing all schemes currently supported in *note\nsysconfig: d5.\n\n-- Function: sysconfig.getdefaultscheme ()\n\nReturn the default scheme name for the current platform.\n\nNew in version 3.10: This function was previously named\n'getdefaultscheme()' and considered an implementation detail.\n\nChanged in version 3.11: When Python runs from a virtual\nenvironment, the 'venv' scheme is returned.\n\n-- Function: sysconfig.getpreferredscheme (key)\n\nReturn a preferred scheme name for an installation layout specified\nby 'key'.\n\n'key' must be either '\"prefix\"', '\"home\"', or '\"user\"'.\n\nThe return value is a scheme name listed in *note\ngetschemenames(): 4067.  It can be passed to *note sysconfig: d5.\nfunctions that take a 'scheme' argument, such as *note getpaths():\n10ba.\n\nNew in version 3.10.\n\nChanged in version 3.11: When Python runs from a virtual\nenvironment and 'key=\"prefix\"', the 'venv' scheme is returned.\n\n-- Function: sysconfig.getpreferredschemes ()\n\nReturn a dict containing preferred scheme names on the current\nplatform.  Python implementers and redistributors may add their\npreferred schemes to the 'INSTALLSCHEMES' module-level global\nvalue, and modify this function to return those scheme names, to\ne.g.  provide different schemes for system and language package\nmanagers to use, so packages installed by either do not mix with\nthose by the other.\n\nEnd users should not use this function, but *note\ngetdefaultscheme(): 1585. and *note getpreferredscheme(): 45c.\ninstead.\n\nNew in version 3.10.\n\n-- Function: sysconfig.getpathnames ()\n\nReturn a tuple containing all path names currently supported in\n*note sysconfig: d5.\n\n-- Function: sysconfig.getpath (name[, scheme[, vars[, expand]]])\n\nReturn an installation path corresponding to the path 'name', from\nthe install scheme named 'scheme'.\n\n'name' has to be a value from the list returned by *note\ngetpathnames(): 4069.\n\n*note sysconfig: d5. stores installation paths corresponding to\neach path name, for each platform, with variables to be expanded.\nFor instance the 'stdlib' path for the 'nt' scheme is:\n'{base}/Lib'.\n\n*note getpath(): 11a6. will use the variables returned by *note\ngetconfigvars(): ea3. to expand the path.  All variables have\ndefault values for each platform so one may call this function and\nget the default value.\n\nIf 'scheme' is provided, it must be a value from the list returned\nby *note getschemenames(): 4067.  Otherwise, the default scheme\nfor the current platform is used.\n\nIf 'vars' is provided, it must be a dictionary of variables that\nwill update the dictionary returned by *note getconfigvars():\nea3.\n\nIf 'expand' is set to 'False', the path will not be expanded using\nthe variables.\n\nIf 'name' is not found, raise a *note KeyError: 8cf.\n\n-- Function: sysconfig.getpaths ([scheme[, vars[, expand]]])\n\nReturn a dictionary containing all installation paths corresponding\nto an installation scheme.  See *note getpath(): 11a6. for more\ninformation.\n\nIf 'scheme' is not provided, will use the default scheme for the\ncurrent platform.\n\nIf 'vars' is provided, it must be a dictionary of variables that\nwill update the dictionary used to expand the paths.\n\nIf 'expand' is set to false, the paths will not be expanded.\n\nIf 'scheme' is not an existing scheme, *note getpaths(): 10ba.\nwill raise a *note KeyError: 8cf.\n\nFile: python3.12.info,  Node: Other functions<3>,  Next: Using sysconfig as a script,  Prev: Installation path functions,  Up: sysconfig -- Provide access to Python's configuration information\n\n5.29.3.13 Other functions\n.........................\n\n-- Function: sysconfig.getpythonversion ()\n\nReturn the 'MAJOR.MINOR' Python version number as a string.\nSimilar to ''%d.%d' % sys.versioninfo[:2]'.\n\n-- Function: sysconfig.getplatform ()\n\nReturn a string that identifies the current platform.\n\nThis is used mainly to distinguish platform-specific build\ndirectories and platform-specific built distributions.  Typically\nincludes the OS name and version and the architecture (as supplied\nby 'os.uname()'), although the exact information included depends\non the OS; e.g., on Linux, the kernel version isn't particularly\nimportant.\n\nExamples of returned values:\n\n- linux-i586\n\n- linux-alpha (?)\n\n- solaris-2.6-sun4u\n\nWindows will return one of:\n\n- win-amd64 (64bit Windows on AMD64, aka x8664, Intel64, and\nEM64T)\n\n- win32 (all others - specifically, sys.platform is returned)\n\nmacOS can return:\n\n- macosx-10.6-ppc\n\n- macosx-10.4-ppc64\n\n- macosx-10.3-i386\n\n- macosx-10.4-fat\n\nFor other non-POSIX platforms, currently just returns *note\nsys.platform: 8bc.\n\n-- Function: sysconfig.ispythonbuild ()\n\nReturn 'True' if the running Python interpreter was built from\nsource and is being run from its built location, and not from a\nlocation resulting from e.g.  running 'make install' or installing\nvia a binary installer.\n\n-- Function: sysconfig.parseconfigh (fp[, vars])\n\nParse a 'config.h'-style file.\n\n'fp' is a file-like object pointing to the 'config.h'-like file.\n\nA dictionary containing name/value pairs is returned.  If an\noptional dictionary is passed in as the second argument, it is used\ninstead of a new dictionary, and updated with the values read in\nthe file.\n\n-- Function: sysconfig.getconfighfilename ()\n\nReturn the path of 'pyconfig.h'.\n\n-- Function: sysconfig.getmakefilefilename ()\n\nReturn the path of 'Makefile'.\n\nFile: python3.12.info,  Node: Using sysconfig as a script,  Prev: Other functions<3>,  Up: sysconfig -- Provide access to Python's configuration information\n\n5.29.3.14 Using 'sysconfig' as a script\n.......................................\n\nYou can use *note sysconfig: d5. as a script with Python's '-m' option:\n\n$ python -m sysconfig\nPlatform: \"macosx-10.4-i386\"\nPython version: \"3.2\"\nCurrent installation scheme: \"posixprefix\"\n\nPaths:\ndata = \"/usr/local\"\ninclude = \"/Users/tarek/Dev/svn.python.org/py3k/Include\"\nplatinclude = \".\"\nplatlib = \"/usr/local/lib/python3.2/site-packages\"\nplatstdlib = \"/usr/local/lib/python3.2\"\npurelib = \"/usr/local/lib/python3.2/site-packages\"\nscripts = \"/usr/local/bin\"\nstdlib = \"/usr/local/lib/python3.2\"\n\nVariables:\nACAPPLEUNIVERSALBUILD = \"0\"\nAIXGENUINECPLUSPLUS = \"0\"\nAR = \"ar\"\nARFLAGS = \"rc\"\n...\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ntuser,  Next: osxframeworkuser,  Prev: posixuser,  Up: User scheme": {
            "content": "5.29.3.5 'ntuser'\n..................\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: osxframeworkuser,  Prev: ntuser,  Up: User scheme": {
            "content": "5.29.3.6 'osxframeworkuser'\n.............................\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Home scheme,  Next: Prefix scheme,  Prev: User scheme,  Up: sysconfig -- Provide access to Python's configuration information": {
            "content": "5.29.3.7 Home scheme\n....................\n\nThe idea behind the \"home scheme\" is that you build and maintain a\npersonal stash of Python modules.  This scheme's name is derived from\nthe idea of a \"home\" directory on Unix, since it's not unusual for a",
            "subsections": []
        },
        "Unix user to make their home directory have a layout similar to '/usr/'": {
            "content": "or '/usr/local/'.  This scheme can be used by anyone, regardless of the\noperating system they are installing for.\n\n* Menu:\n\n* posixhome::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: posixhome,  Up: Home scheme": {
            "content": "5.29.3.8 'posixhome'\n.....................\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Prefix scheme,  Next: Installation path functions,  Prev: Home scheme,  Up: sysconfig -- Provide access to Python's configuration information": {
            "content": "5.29.3.9 Prefix scheme\n......................\n\nThe \"prefix scheme\" is useful when you wish to use one Python\ninstallation to perform the build/install (i.e., to run the setup\nscript), but install modules into the third-party module directory of a\ndifferent Python installation (or something that looks like a different",
            "subsections": []
        },
        "Python installation).  If this sounds a trifle unusual, it is--that's why": {
            "content": "the user and home schemes come before.  However, there are at least two\nknown cases where the prefix scheme will be useful.\n",
            "subsections": []
        },
        "First, consider that many Linux distributions put Python in '/usr',": {
            "content": "rather than the more traditional '/usr/local'.  This is entirely\nappropriate, since in those cases Python is part of \"the system\" rather\nthan a local add-on.  However, if you are installing Python modules from\nsource, you probably want them to go in '/usr/local/lib/python2.`X''\nrather than '/usr/lib/python2.`X''.\n",
            "subsections": []
        },
        "Another possibility is a network filesystem where the name used to write": {
            "content": "to a remote directory is different from the name used to read it: for\nexample, the Python interpreter accessed as '/usr/local/bin/python'\nmight search for modules in '/usr/local/lib/python2.`X'', but those\nmodules would have to be installed to, say,\n'/mnt/`@server'/export/lib/python2.`X''.\n\n* Menu:\n\n* posixprefix::\n* nt::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: posixprefix,  Next: nt,  Up: Prefix scheme": {
            "content": "5.29.3.10 'posixprefix'\n........................\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: nt,  Prev: posixprefix,  Up: Prefix scheme": {
            "content": "5.29.3.11 'nt'\n..............\n",
            "subsections": []
        },
        "This call will print in the standard output the information returned by": {
            "content": "*note getplatform(): 10b8, *note getpythonversion(): 10b9, *note\ngetpath(): 11a6. and *note getconfigvars(): ea3.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "This module provides direct access to all 'built-in' identifiers of": {
            "content": "",
            "subsections": []
        },
        "Python; for example, 'builtins.open' is the full name for the built-in": {
            "content": "function *note open(): 26e.  See *note Built-in Functions: 10d5. and\n*note Built-in Constants: 1e90. for documentation.\n",
            "subsections": []
        },
        "This module is not normally accessed explicitly by most applications,": {
            "content": "but can be useful in modules that provide objects with the same name as\na built-in value, but in which the built-in of that name is also needed.\nFor example, in a module that wants to implement an *note open(): 26e.\nfunction that wraps the built-in *note open(): 26e, this module can be\nused directly:\n\nimport builtins\n\ndef open(path):\nf = builtins.open(path, 'r')\nreturn UpperCaser(f)\n\nclass UpperCaser:\n'''Wrapper around a file that converts output to uppercase.'''\n\ndef init(self, f):\nself.f = f\n\ndef read(self, count=-1):\nreturn self.f.read(count).upper()\n\n# ...\n",
            "subsections": []
        },
        "As an implementation detail, most modules have the name 'builtins'": {
            "content": "made available as part of their globals.  The value of 'builtins' is\nnormally either this module or the value of this module's *note\ndict: aa8. attribute.  Since this is an implementation detail, it\nmay not be used by alternate implementations of Python.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: main -- Top-level code environment,  Next: warnings -- Warning control,  Prev: builtins -- Built-in objects,  Up: Python Runtime Services": {
            "content": "",
            "subsections": []
        },
        "In Python, the special name 'main' is used for two important": {
            "content": "constructs:\n\n1. the name of the top-level environment of the program, which can be\nchecked using the 'name == 'main'' expression; and\n\n2. the 'main.py' file in Python packages.\n",
            "subsections": []
        },
        "Both of these mechanisms are related to Python modules; how users": {
            "content": "interact with them and how they interact with each other.  They are\nexplained in detail below.  If you're new to Python modules, see the\ntutorial section *note Modules: 19db. for an introduction.\n\n* Menu:\n\n* name == 'main'::\n* main.py in Python Packages: main py in Python Packages.\n* import main::\n\nFile: python3.12.info,  Node: name == 'main',  Next: main py in Python Packages,  Up: main -- Top-level code environment\n\n5.29.5.1 'name == 'main''\n.................................\n",
            "subsections": []
        },
        "When a Python module or package is imported, 'name' is set to the": {
            "content": "module's name.  Usually, this is the name of the Python file itself\nwithout the '.py' extension:\n\n>>> import configparser\n>>> configparser.name\n'configparser'\n",
            "subsections": []
        },
        "If the file is part of a package, 'name' will also include the": {
            "content": "parent package's path:\n\n>>> from concurrent.futures import process\n>>> process.name\n'concurrent.futures.process'\n",
            "subsections": []
        },
        "However, if the module is executed in the top-level code environment,": {
            "content": "its 'name' is set to the string ''main''.\n\n* Menu:\n\n* What is the \"top-level code environment\"?::\n* Idiomatic Usage::\n* Packaging Considerations::\n\nFile: python3.12.info,  Node: What is the \"top-level code environment\"?,  Next: Idiomatic Usage,  Up: name == 'main'\n\n5.29.5.2 What is the \"top-level code environment\"?\n..................................................\n\n'main' is the name of the environment where top-level code is run.\n\"Top-level code\" is the first user-specified Python module that starts\nrunning.  It's \"top-level\" because it imports all other modules that the\nprogram needs.  Sometimes \"top-level code\" is called an 'entry point' to\nthe application.\n\nThe top-level code environment can be:\n\n* the scope of an interactive prompt:\n\n>>> name\n'main'\n\n* the Python module passed to the Python interpreter as a file\nargument:\n\n$ python helloworld.py\nHello, world!\n\n* the Python module or package passed to the Python interpreter with\nthe *note -m: 3a5. argument:\n\n$ python -m tarfile\nusage: tarfile.py [-h] [-v] (...)\n\n* Python code read by the Python interpreter from standard input:\n\n$ echo \"import this\" | python\nThe Zen of Python, by Tim Peters\n\nBeautiful is better than ugly.\nExplicit is better than implicit.\n...\n\n* Python code passed to the Python interpreter with the *note -c:\n3a4. argument:\n\n$ python -c \"import this\"\nThe Zen of Python, by Tim Peters\n\nBeautiful is better than ugly.\nExplicit is better than implicit.\n...\n",
            "subsections": []
        },
        "In each of these situations, the top-level module's 'name' is set to": {
            "content": "''main''.\n",
            "subsections": []
        },
        "As a result, a module can discover whether or not it is running in the": {
            "content": "top-level environment by checking its own 'name', which allows a\ncommon idiom for conditionally executing code when the module is not\ninitialized from an import statement:\n\nif name == 'main':\n# Execute when the module is not initialized from an import statement.\n...\n\nSee also\n........\n",
            "subsections": []
        },
        "For a more detailed look at how 'name' is set in all situations, see": {
            "content": "the tutorial section *note Modules: 19db.\n\nFile: python3.12.info,  Node: Idiomatic Usage,  Next: Packaging Considerations,  Prev: What is the \"top-level code environment\"?,  Up: name == 'main'\n\n5.29.5.3 Idiomatic Usage\n........................\n",
            "subsections": []
        },
        "Some modules contain code that is intended for script use only, like": {
            "content": "parsing command-line arguments or fetching data from standard input.  If\na module like this was imported from a different module, for example to\nunit test it, the script code would unintentionally execute as well.\n\nThis is where using the 'if name == 'main'' code block comes in\nhandy.  Code within this block won't run unless the module is executed\nin the top-level environment.\n\nPutting as few statements as possible in the block below 'if name ==\n'main'' can improve code clarity and correctness.  Most often, a\nfunction named 'main' encapsulates the program's primary behavior:\n\n# echo.py\n\nimport shlex\nimport sys\n\ndef echo(phrase: str) -> None:\n\"\"\"A dummy wrapper around print.\"\"\"\n# for demonstration purposes, you can imagine that there is some\n# valuable and reusable logic inside this function\nprint(phrase)\n\ndef main() -> int:\n\"\"\"Echo the input arguments to standard output\"\"\"\nphrase = shlex.join(sys.argv)\necho(phrase)\nreturn 0\n\nif name == 'main':\nsys.exit(main())  # next section explains the use of sys.exit\n",
            "subsections": []
        },
        "Note that if the module didn't encapsulate code inside the 'main'": {
            "content": "function but instead put it directly within the 'if name ==\n'main'' block, the 'phrase' variable would be global to the entire\nmodule.  This is error-prone as other functions within the module could\nbe unintentionally using the global variable instead of a local name.  A\n'main' function solves this problem.\n",
            "subsections": []
        },
        "Using a 'main' function has the added benefit of the 'echo' function": {
            "content": "itself being isolated and importable elsewhere.  When 'echo.py' is\nimported, the 'echo' and 'main' functions will be defined, but neither\nof them will be called, because 'name != 'main''.\n\nFile: python3.12.info,  Node: Packaging Considerations,  Prev: Idiomatic Usage,  Up: name == 'main'\n\n5.29.5.4 Packaging Considerations\n.................................\n\n'main' functions are often used to create command-line tools by\nspecifying them as entry points for console scripts.  When this is done,\npip(1) inserts the function call into a template script, where the\nreturn value of 'main' is passed into *note sys.exit(): 11c2.  For\nexample:\n\nsys.exit(main())\n\nSince the call to 'main' is wrapped in *note sys.exit(): 11c2, the\nexpectation is that your function will return some value acceptable as\nan input to *note sys.exit(): 11c2.; typically, an integer or 'None'\n(which is implicitly returned if your function does not have a return\nstatement).\n",
            "subsections": []
        },
        "By proactively following this convention ourselves, our module will have": {
            "content": "the same behavior when run directly (i.e.  'python echo.py') as it will\nhave if we later package it as a console script entry-point in a\npip-installable package.\n",
            "subsections": []
        },
        "In particular, be careful about returning strings from your 'main'": {
            "content": "function.  *note sys.exit(): 11c2. will interpret a string argument as a\nfailure message, so your program will have an exit code of '1',\nindicating failure, and the string will be written to *note sys.stderr:\n757.  The 'echo.py' example from earlier exemplifies using the\n'sys.exit(main())' convention.\n\nSee also\n........\n",
            "subsections": []
        },
        "Python Packaging User Guide(2) contains a collection of tutorials and": {
            "content": "references on how to distribute and install Python packages with modern\ntools.\n\n---------- Footnotes ----------\n\n(1) https://pip.pypa.io/\n\n(2) https://packaging.python.org/\n\nFile: python3.12.info,  Node: main py in Python Packages,  Next: import main,  Prev: name == 'main',  Up: main -- Top-level code environment\n\n5.29.5.5 'main.py' in Python Packages\n.........................................\n\nIf you are not familiar with Python packages, see section *note",
            "subsections": []
        },
        "Packages: 19ec. of the tutorial.  Most commonly, the 'main.py' file": {
            "content": "is used to provide a command-line interface for a package.  Consider the\nfollowing hypothetical package, \"bandclass\":\n\nbandclass\n????????? init.py\n????????? main.py\n????????? student.py\n\n'main.py' will be executed when the package itself is invoked\ndirectly from the command line using the *note -m: 3a5. flag.  For\nexample:\n\n$ python -m bandclass\n",
            "subsections": []
        },
        "This command will cause 'main.py' to run.  How you utilize this": {
            "content": "mechanism will depend on the nature of the package you are writing, but\nin this hypothetical case, it might make sense to allow the teacher to\nsearch for students:\n\n# bandclass/main.py\n\nimport sys\nfrom .student import searchstudents\n\nstudentname = sys.argv[1] if len(sys.argv) >= 2 else ''\nprint(f'Found student: {searchstudents(studentname)}')\n",
            "subsections": []
        },
        "Note that 'from .student import searchstudents' is an example of a": {
            "content": "relative import.  This import style can be used when referencing modules\nwithin a package.  For more details, see *note Intra-package References:\n19f1. in the *note Modules: 19db. section of the tutorial.\n\n* Menu:\n\n* Idiomatic Usage: Idiomatic Usage<2>.\n\nFile: python3.12.info,  Node: Idiomatic Usage<2>,  Up: main py in Python Packages\n\n5.29.5.6 Idiomatic Usage\n........................\n",
            "subsections": []
        },
        "The content of 'main.py' typically isn't fenced with an 'if name": {
            "content": "== 'main'' block.  Instead, those files are kept short and import\nfunctions to execute from other modules.  Those other modules can then\nbe easily unit-tested and are properly reusable.\n\nIf used, an 'if name == 'main'' block will still work as\nexpected for a 'main.py' file within a package, because its\n'name' attribute will include the package's path if imported:\n\n>>> import asyncio.main\n>>> asyncio.main.name\n'asyncio.main'\n",
            "subsections": []
        },
        "This won't work for 'main.py' files in the root directory of a .zip": {
            "content": "file though.  Hence, for consistency, minimal 'main.py' like the\n*note venv: 10c. one mentioned below are preferred.\n\nSee also\n........\n\nSee *note venv: 10c. for an example of a package with a minimal\n'main.py' in the standard library.  It doesn't contain a 'if\nname == 'main'' block.  You can invoke it with 'python -m venv\n[directory]'.\n\nSee *note runpy: b9. for more details on the *note -m: 3a5. flag to the\ninterpreter executable.\n\nSee *note zipapp: 12a. for how to run applications packaged as '.zip'\nfiles.  In this case Python looks for a 'main.py' file in the root\ndirectory of the archive.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: import main,  Prev: main py in Python Packages,  Up: main -- Top-level code environment": {
            "content": "5.29.5.7 'import main'\n..........................\n",
            "subsections": []
        },
        "Regardless of which module a Python program was started with, other": {
            "content": "modules running within that same program can import the top-level\nenvironment's scope (*note namespace: 19dc.) by importing the 'main'\nmodule.  This doesn't import a 'main.py' file but rather whichever\nmodule that received the special name ''main''.\n\nHere is an example module that consumes the 'main' namespace:\n\n# namely.py\n\nimport main\n\ndef diduserdefinetheirname():\nreturn 'myname' in dir(main)\n\ndef printusername():\nif not diduserdefinetheirname():\nraise ValueError('Define the variable `myname`!')\n\nif 'file' in dir(main):\nprint(main.myname, \"found in file\", main.file)\nelse:\nprint(main.myname)\n\nExample usage of this module could be as follows:\n\n# start.py\n\nimport sys\n\nfrom namely import printusername\n\n# myname = \"Dinsdale\"\n\ndef main():\ntry:\nprintusername()\nexcept ValueError as ve:\nreturn str(ve)\n\nif name == \"main\":\nsys.exit(main())\n\nNow, if we started our program, the result would look like this:\n\n$ python start.py\nDefine the variable `myname`!\n\nThe exit code of the program would be 1, indicating an error.\nUncommenting the line with 'myname = \"Dinsdale\"' fixes the program and\nnow it exits with status code 0, indicating success:\n\n$ python start.py\nDinsdale found in file /path/to/start.py\n",
            "subsections": []
        },
        "Note that importing 'main' doesn't cause any issues with": {
            "content": "unintentionally running top-level code meant for script use which is put\nin the 'if name == \"main\"' block of the 'start' module.  Why\ndoes this work?\n\nPython inserts an empty 'main' module in *note sys.modules: 16d7. at\ninterpreter startup, and populates it by running top-level code.  In our\nexample this is the 'start' module which runs line by line and imports\n'namely'.  In turn, 'namely' imports 'main' (which is really\n'start').  That's an import cycle!  Fortunately, since the partially\npopulated 'main' module is present in *note sys.modules: 16d7,\nPython passes that to 'namely'.  See *note Special considerations for\nmain: 1d19. in the import system's reference for details on how this\nworks.\n\nThe Python REPL is another example of a \"top-level environment\", so\nanything defined in the REPL becomes part of the 'main' scope:\n\n>>> import namely\n>>> namely.diduserdefinetheirname()\nFalse\n>>> namely.printusername()\nTraceback (most recent call last):\n...\nValueError: Define the variable `myname`!\n>>> myname = 'Jabberwocky'\n>>> namely.diduserdefinetheirname()\nTrue\n>>> namely.printusername()\nJabberwocky\n",
            "subsections": []
        },
        "Note that in this case the 'main' scope doesn't contain a 'file'": {
            "content": "attribute as it's interactive.\n\nThe 'main' scope is used in the implementation of *note pdb: a0. and\n*note rlcompleter: b8.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: warnings -- Warning control,  Next: dataclasses -- Data Classes,  Prev: main -- Top-level code environment,  Up: Python Runtime Services": {
            "content": "'Source code:' Lib/warnings.py(1)\n\n\n",
            "subsections": []
        },
        "Warning messages are typically issued in situations where it is useful": {
            "content": "to alert the user of some condition in a program, where that condition\n(normally) doesn't warrant raising an exception and terminating the\nprogram.  For example, one might want to issue a warning when a program\nuses an obsolete module.\n\nPython programmers issue warnings by calling the *note warn(): 1374.\nfunction defined in this module.  (C programmers use *note\nPyErrWarnEx(): 12a2.; see *note Exception Handling: 407e. for details).\n\nWarning messages are normally written to *note sys.stderr: 757, but\ntheir disposition can be changed flexibly, from ignoring all warnings to\nturning them into exceptions.  The disposition of warnings can vary\nbased on the *note warning category: 1fc1, the text of the warning\nmessage, and the source location where it is issued.  Repetitions of a\nparticular warning for the same source location are typically\nsuppressed.\n",
            "subsections": []
        },
        "There are two stages in warning control: first, each time a warning is": {
            "content": "issued, a determination is made whether a message should be issued or\nnot; next, if a message is to be issued, it is formatted and printed\nusing a user-settable hook.\n",
            "subsections": []
        },
        "The determination whether to issue a warning message is controlled by": {
            "content": "the *note warning filter: 6e1, which is a sequence of matching rules and\nactions.  Rules can be added to the filter by calling *note\nfilterwarnings(): 1301. and reset to its default state by calling *note\nresetwarnings(): 407f.\n\nThe printing of warning messages is done by calling *note showwarning():\n4080, which may be overridden; the default implementation of this\nfunction formats the message by calling *note formatwarning(): 178d,\nwhich is also available for use by custom implementations.\n\nSee also\n........\n\n*note logging.captureWarnings(): 2a0b. allows you to handle all warnings\nwith the standard logging infrastructure.\n\n* Menu:\n\n* Warning Categories::\n* The Warnings Filter::\n* Temporarily Suppressing Warnings::\n* Testing Warnings::\n* Updating Code For New Versions of Dependencies::\n* Available Functions::\n* Available Context Managers::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/warnings.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Warning Categories,  Next: The Warnings Filter,  Up: warnings -- Warning control": {
            "content": "5.29.6.1 Warning Categories\n...........................\n",
            "subsections": []
        },
        "There are a number of built-in exceptions that represent warning": {
            "content": "categories.  This categorization is useful to be able to filter out\ngroups of warnings.\n\nWhile these are technically *note built-in exceptions: 1fbf, they are\ndocumented here, because conceptually they belong to the warnings\nmechanism.\n",
            "subsections": []
        },
        "User code can define additional warning categories by subclassing one of": {
            "content": "the standard warning categories.  A warning category must always be a\nsubclass of the *note Warning: 1fc2. class.\n\nThe following warnings category classes are currently defined:\n",
            "subsections": []
        },
        "Class                                  Description": {
            "content": "-------------------------------------------------------------------------------------------\n\n*note Warning: 1fc2.                   This is the base class of all warning category\nclasses.  It is a subclass of\n*note Exception: 7ff.\n\n\n*note UserWarning: 1fc3.               The default category for *note warn(): 1374.\n\n\n*note DeprecationWarning: 179.         Base category for warnings about deprecated\nfeatures when those warnings are intended for\nother Python developers (ignored by default,\nunless triggered by code in 'main').\n\n\n*note SyntaxWarning: 178.              Base category for warnings about dubious\nsyntactic features.\n\n\n*note RuntimeWarning: 8c9.             Base category for warnings about dubious runtime\nfeatures.\n\n\n*note FutureWarning: 23f.              Base category for warnings about deprecated\nfeatures when those warnings are intended for end\nusers of applications that are written in Python.\n\n\n*note PendingDeprecationWarning: 6e0.  Base category for warnings about features that\nwill be deprecated in the future (ignored by\ndefault).\n\n\n*note ImportWarning: 243.              Base category for warnings triggered during the\nprocess of importing a module (ignored by\ndefault).\n\n\n*note UnicodeWarning: 127a.            Base category for warnings related to Unicode.\n\n\n*note BytesWarning: a6b.               Base category for warnings related to\n*note bytes: 295. and *note bytearray: 294.\n\n\n*note ResourceWarning: a86.            Base category for warnings related to resource\nusage (ignored by default).\n\n\nChanged in version 3.7: Previously *note DeprecationWarning: 179. and\n*note FutureWarning: 23f. were distinguished based on whether a feature\nwas being removed entirely or changing its behaviour.  They are now\ndistinguished based on their intended audience and the way they're\nhandled by the default warnings filters.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The Warnings Filter,  Next: Temporarily Suppressing Warnings,  Prev: Warning Categories,  Up: warnings -- Warning control": {
            "content": "5.29.6.2 The Warnings Filter\n............................\n",
            "subsections": []
        },
        "The warnings filter controls whether warnings are ignored, displayed, or": {
            "content": "turned into errors (raising an exception).\n",
            "subsections": []
        },
        "Conceptually, the warnings filter maintains an ordered list of filter": {
            "content": "specifications; any specific warning is matched against each filter\nspecification in the list in turn until a match is found; the filter\ndetermines the disposition of the match.  Each entry is a tuple of the\nform ('action', 'message', 'category', 'module', 'lineno'), where:\n\n* 'action' is one of the following strings:\n\nValue               Disposition\n\n-----------------------------------------------------------------------\n\n'\"default\"'         print the first occurrence of matching warnings\nfor each location (module + line number) where\nthe warning is issued\n\n\n'\"error\"'           turn matching warnings into exceptions\n\n\n'\"ignore\"'          never print matching warnings\n\n\n'\"always\"'          always print matching warnings\n\n\n'\"module\"'          print the first occurrence of matching warnings\nfor each module where the warning is issued\n(regardless of line number)\n\n\n'\"once\"'            print only the first occurrence of matching\nwarnings, regardless of location\n\n\n* 'message' is a string containing a regular expression that the\nstart of the warning message must match, case-insensitively.  In\n*note -W: 6df. and *note PYTHONWARNINGS: 9ee, 'message' is a\nliteral string that the start of the warning message must contain\n(case-insensitively), ignoring any whitespace at the start or end\nof 'message'.\n\n* 'category' is a class (a subclass of *note Warning: 1fc2.) of which\nthe warning category must be a subclass in order to match.\n\n* 'module' is a string containing a regular expression that the start\nof the fully qualified module name must match, case-sensitively.\nIn *note -W: 6df. and *note PYTHONWARNINGS: 9ee, 'module' is a\nliteral string that the fully qualified module name must be equal\nto (case-sensitively), ignoring any whitespace at the start or end\nof 'module'.\n\n* 'lineno' is an integer that the line number where the warning\noccurred must match, or '0' to match all line numbers.\n\nSince the *note Warning: 1fc2. class is derived from the built-in *note",
            "subsections": []
        },
        "Exception: 7ff. class, to turn a warning into an error we simply raise": {
            "content": "'category(message)'.\n",
            "subsections": []
        },
        "If a warning is reported and doesn't match any registered filter then": {
            "content": "the \"default\" action is applied (hence its name).\n\n* Menu:\n\n* Describing Warning Filters::\n* Default Warning Filter::\n* Overriding the default filter::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Describing Warning Filters,  Next: Default Warning Filter,  Up: The Warnings Filter": {
            "content": "5.29.6.3 Describing Warning Filters\n...................................\n\nThe warnings filter is initialized by *note -W: 6df. options passed to\nthe Python interpreter command line and the *note PYTHONWARNINGS: 9ee.\nenvironment variable.  The interpreter saves the arguments for all\nsupplied entries without interpretation in *note sys.warnoptions: 328.;\nthe *note warnings: 10d. module parses these when it is first imported\n(invalid options are ignored, after printing a message to *note\nsys.stderr: 757.).\n",
            "subsections": []
        },
        "Individual warnings filters are specified as a sequence of fields": {
            "content": "separated by colons:\n\naction:message:category:module:line\n\nThe meaning of each of these fields is as described in *note The",
            "subsections": []
        },
        "Warnings Filter: 6e1.  When listing multiple filters on a single line": {
            "content": "(as for *note PYTHONWARNINGS: 9ee.), the individual filters are\nseparated by commas and the filters listed later take precedence over\nthose listed before them (as they're applied left-to-right, and the most\nrecently applied filters take precedence over earlier ones).\n",
            "subsections": []
        },
        "Commonly used warning filters apply to either all warnings, warnings in": {
            "content": "a particular category, or warnings raised by particular modules or\npackages.  Some examples:\n\ndefault                      # Show all warnings (even those ignored by default)\nignore                       # Ignore all warnings\nerror                        # Convert all warnings to errors\nerror::ResourceWarning       # Treat ResourceWarning messages as errors\ndefault::DeprecationWarning  # Show DeprecationWarning messages\nignore,default:::mymodule    # Only report warnings triggered by \"mymodule\"\nerror:::mymodule             # Convert warnings to errors in \"mymodule\"\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Default Warning Filter,  Next: Overriding the default filter,  Prev: Describing Warning Filters,  Up: The Warnings Filter": {
            "content": "5.29.6.4 Default Warning Filter\n...............................\n",
            "subsections": []
        },
        "By default, Python installs several warning filters, which can be": {
            "content": "overridden by the *note -W: 6df. command-line option, the *note\nPYTHONWARNINGS: 9ee. environment variable and calls to *note\nfilterwarnings(): 1301.\n",
            "subsections": []
        },
        "In regular release builds, the default warning filter has the following": {
            "content": "entries (in order of precedence):\n\ndefault::DeprecationWarning:main\nignore::DeprecationWarning\nignore::PendingDeprecationWarning\nignore::ImportWarning\nignore::ResourceWarning\n\nIn a *note debug build: 67f, the list of default warning filters is\nempty.\n\nChanged in version 3.2: *note DeprecationWarning: 179. is now ignored by\ndefault in addition to *note PendingDeprecationWarning: 6e0.\n\nChanged in version 3.7: *note DeprecationWarning: 179. is once again\nshown by default when triggered directly by code in 'main'.\n\nChanged in version 3.7: *note BytesWarning: a6b. no longer appears in\nthe default filter list and is instead configured via *note\nsys.warnoptions: 328. when *note -b: 3a8. is specified twice.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Overriding the default filter,  Prev: Default Warning Filter,  Up: The Warnings Filter": {
            "content": "5.29.6.5 Overriding the default filter\n......................................\n",
            "subsections": []
        },
        "Developers of applications written in Python may wish to hide 'all'": {
            "content": "",
            "subsections": []
        },
        "Python level warnings from their users by default, and only display them": {
            "content": "when running tests or otherwise working on the application.  The *note\nsys.warnoptions: 328. attribute used to pass filter configurations to\nthe interpreter can be used as a marker to indicate whether or not\nwarnings should be disabled:\n\nimport sys\n\nif not sys.warnoptions:\nimport warnings\nwarnings.simplefilter(\"ignore\")\n",
            "subsections": []
        },
        "Developers of test runners for Python code are advised to instead ensure": {
            "content": "that 'all' warnings are displayed by default for the code under test,\nusing code like:\n\nimport sys\n\nif not sys.warnoptions:\nimport os, warnings\nwarnings.simplefilter(\"default\") # Change the filter in this process\nos.environ[\"PYTHONWARNINGS\"] = \"default\" # Also affect subprocesses\n",
            "subsections": []
        },
        "Finally, developers of interactive shells that run user code in a": {
            "content": "namespace other than 'main' are advised to ensure that *note",
            "subsections": []
        },
        "DeprecationWarning: 179. messages are made visible by default, using": {
            "content": "code like the following (where 'userns' is the module used to execute\ncode entered interactively):\n\nimport warnings\nwarnings.filterwarnings(\"default\", category=DeprecationWarning,\nmodule=userns.get(\"name\"))\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Temporarily Suppressing Warnings,  Next: Testing Warnings,  Prev: The Warnings Filter,  Up: warnings -- Warning control": {
            "content": "5.29.6.6 Temporarily Suppressing Warnings\n.........................................\n",
            "subsections": []
        },
        "If you are using code that you know will raise a warning, such as a": {
            "content": "deprecated function, but do not want to see the warning (even when\nwarnings have been explicitly configured via the command line), then it\nis possible to suppress the warning using the *note catchwarnings: 2e6.\ncontext manager:\n\nimport warnings\n\ndef fxn():\nwarnings.warn(\"deprecated\", DeprecationWarning)\n\nwith warnings.catchwarnings():\nwarnings.simplefilter(\"ignore\")\nfxn()\n\nWhile within the context manager all warnings will simply be ignored.",
            "subsections": []
        },
        "This allows you to use known-deprecated code without having to see the": {
            "content": "warning while not suppressing the warning for other code that might not\nbe aware of its use of deprecated code.  Note: this can only be\nguaranteed in a single-threaded application.  If two or more threads use\nthe *note catchwarnings: 2e6. context manager at the same time, the\nbehavior is undefined.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Testing Warnings,  Next: Updating Code For New Versions of Dependencies,  Prev: Temporarily Suppressing Warnings,  Up: warnings -- Warning control": {
            "content": "5.29.6.7 Testing Warnings\n.........................\n\nTo test warnings raised by code, use the *note catchwarnings: 2e6.\ncontext manager.  With it you can temporarily mutate the warnings filter\nto facilitate your testing.  For instance, do the following to capture\nall raised warnings to check:\n\nimport warnings\n\ndef fxn():\nwarnings.warn(\"deprecated\", DeprecationWarning)\n\nwith warnings.catchwarnings(record=True) as w:\n# Cause all warnings to always be triggered.\nwarnings.simplefilter(\"always\")\n# Trigger a warning.\nfxn()\n# Verify some things\nassert len(w) == 1\nassert issubclass(w[-1].category, DeprecationWarning)\nassert \"deprecated\" in str(w[-1].message)\n",
            "subsections": []
        },
        "One can also cause all warnings to be exceptions by using 'error'": {
            "content": "instead of 'always'.  One thing to be aware of is that if a warning has\nalready been raised because of a 'once'/'default' rule, then no matter\nwhat filters are set the warning will not be seen again unless the\nwarnings registry related to the warning has been cleared.\n",
            "subsections": []
        },
        "Once the context manager exits, the warnings filter is restored to its": {
            "content": "state when the context was entered.  This prevents tests from changing\nthe warnings filter in unexpected ways between tests and leading to\nindeterminate test results.  The *note showwarning(): 4080. function in\nthe module is also restored to its original value.  Note: this can only\nbe guaranteed in a single-threaded application.  If two or more threads\nuse the *note catchwarnings: 2e6. context manager at the same time, the\nbehavior is undefined.\n",
            "subsections": []
        },
        "When testing multiple operations that raise the same kind of warning, it": {
            "content": "is important to test them in a manner that confirms each operation is\nraising a new warning (e.g.  set warnings to be raised as exceptions and\ncheck the operations raise exceptions, check that the length of the\nwarning list continues to increase after each operation, or else delete\nthe previous entries from the warnings list before each new operation).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Updating Code For New Versions of Dependencies,  Next: Available Functions,  Prev: Testing Warnings,  Up: warnings -- Warning control": {
            "content": "5.29.6.8 Updating Code For New Versions of Dependencies\n.......................................................\n",
            "subsections": []
        },
        "Warning categories that are primarily of interest to Python developers": {
            "content": "(rather than end users of applications written in Python) are ignored by\ndefault.\n\nNotably, this \"ignored by default\" list includes *note",
            "subsections": []
        },
        "DeprecationWarning: 179. (for every module except 'main'), which": {
            "content": "means developers should make sure to test their code with typically\nignored warnings made visible in order to receive timely notifications\nof future breaking API changes (whether in the standard library or third\nparty packages).\n",
            "subsections": []
        },
        "In the ideal case, the code will have a suitable test suite, and the": {
            "content": "test runner will take care of implicitly enabling all warnings when\nrunning tests (the test runner provided by the *note unittest: 101.\nmodule does this).\n",
            "subsections": []
        },
        "In less ideal cases, applications can be checked for use of deprecated": {
            "content": "interfaces by passing *note -Wd: 6df. to the Python interpreter (this is\nshorthand for '-W default') or setting 'PYTHONWARNINGS=default' in the\nenvironment.  This enables default handling for all warnings, including\nthose that are ignored by default.  To change what action is taken for\nencountered warnings you can change what argument is passed to *note -W:\n6df. (e.g.  '-W error').  See the *note -W: 6df. flag for more details\non what is possible.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Available Functions,  Next: Available Context Managers,  Prev: Updating Code For New Versions of Dependencies,  Up: warnings -- Warning control": {
            "content": "5.29.6.9 Available Functions\n............................\n\n-- Function: warnings.warn (message, category=None, stacklevel=1,\nsource=None, *, skipfileprefixes=None)\n\nIssue a warning, or maybe ignore it or raise an exception.  The\n'category' argument, if given, must be a *note warning category\nclass: 1fc1.; it defaults to *note UserWarning: 1fc3.\nAlternatively, 'message' can be a *note Warning: 1fc2. instance, in\nwhich case 'category' will be ignored and 'message.class' will\nbe used.  In this case, the message text will be 'str(message)'.\nThis function raises an exception if the particular warning issued\nis changed into an error by the *note warnings filter: 6e1.  The\n'stacklevel' argument can be used by wrapper functions written in\nPython, like this:\n\ndef deprecatedapi(message):\nwarnings.warn(message, DeprecationWarning, stacklevel=2)\n\nThis makes the warning refer to 'deprecatedapi''s caller, rather\nthan to the source of 'deprecatedapi' itself (since the latter\nwould defeat the purpose of the warning message).\n\nThe 'skipfileprefixes' keyword argument can be used to indicate\nwhich stack frames are ignored when counting stack levels.  This\ncan be useful when you want the warning to always appear at call\nsites outside of a package when a constant 'stacklevel' does not\nfit all call paths or is otherwise challenging to maintain.  If\nsupplied, it must be a tuple of strings.  When prefixes are\nsupplied, stacklevel is implicitly overridden to be 'max(2,\nstacklevel)'.  To cause a warning to be attributed to the caller\nfrom outside of the current package you might write:\n\n# example/lower.py\nwarnskips = (os.path.dirname(file),)\n\ndef oneway(rluxuryyacht=None, twobblermangrove=None):\nif rluxuryyacht:\nwarnings.warn(\"Please migrate to twobblermangrove=.\",\nskipfileprefixes=warnskips)\n\n# example/higher.py\nfrom . import lower\n\ndef anotherway(kw):\nlower.oneway(kw)\n\nThis makes the warning refer to both the 'example.lower.oneway()'\nand 'package.higher.anotherway()' call sites only from calling\ncode living outside of 'example' package.\n\n'source', if supplied, is the destroyed object which emitted a\n*note ResourceWarning: a86.\n\nChanged in version 3.6: Added 'source' parameter.\n\nChanged in version 3.12: Added 'skipfileprefixes'.\n\n-- Function: warnings.warnexplicit (message, category, filename,\nlineno, module=None, registry=None, moduleglobals=None,\nsource=None)\n\nThis is a low-level interface to the functionality of *note warn():\n1374, passing in explicitly the message, category, filename and\nline number, and optionally the module name and the registry (which\nshould be the 'warningregistry' dictionary of the module).  The\nmodule name defaults to the filename with '.py' stripped; if no\nregistry is passed, the warning is never suppressed.  'message'\nmust be a string and 'category' a subclass of *note Warning: 1fc2.\nor 'message' may be a *note Warning: 1fc2. instance, in which case\n'category' will be ignored.\n\n'moduleglobals', if supplied, should be the global namespace in\nuse by the code for which the warning is issued.  (This argument is\nused to support displaying source for modules found in zipfiles or\nother non-filesystem import sources).\n\n'source', if supplied, is the destroyed object which emitted a\n*note ResourceWarning: a86.\n\nChanged in version 3.6: Add the 'source' parameter.\n\n-- Function: warnings.showwarning (message, category, filename, lineno,\nfile=None, line=None)\n\nWrite a warning to a file.  The default implementation calls\n'formatwarning(message, category, filename, lineno, line)' and\nwrites the resulting string to 'file', which defaults to *note\nsys.stderr: 757.  You may replace this function with any callable\nby assigning to 'warnings.showwarning'.  'line' is a line of source\ncode to be included in the warning message; if 'line' is not\nsupplied, *note showwarning(): 4080. will try to read the line\nspecified by 'filename' and 'lineno'.\n\n-- Function: warnings.formatwarning (message, category, filename,\nlineno, line=None)\n\nFormat a warning the standard way.  This returns a string which may\ncontain embedded newlines and ends in a newline.  'line' is a line\nof source code to be included in the warning message; if 'line' is\nnot supplied, *note formatwarning(): 178d. will try to read the\nline specified by 'filename' and 'lineno'.\n\n-- Function: warnings.filterwarnings (action, message='',\ncategory=Warning, module='', lineno=0, append=False)\n\nInsert an entry into the list of *note warnings filter\nspecifications: 6e1.  The entry is inserted at the front by\ndefault; if 'append' is true, it is inserted at the end.  This\nchecks the types of the arguments, compiles the 'message' and\n'module' regular expressions, and inserts them as a tuple in the\nlist of warnings filters.  Entries closer to the front of the list\noverride entries later in the list, if both match a particular\nwarning.  Omitted arguments default to a value that matches\neverything.\n\n-- Function: warnings.simplefilter (action, category=Warning, lineno=0,\nappend=False)\n\nInsert a simple entry into the list of *note warnings filter\nspecifications: 6e1.  The meaning of the function parameters is as\nfor *note filterwarnings(): 1301, but regular expressions are not\nneeded as the filter inserted always matches any message in any\nmodule as long as the category and line number match.\n\n-- Function: warnings.resetwarnings ()\n\nReset the warnings filter.  This discards the effect of all\nprevious calls to *note filterwarnings(): 1301, including that of\nthe *note -W: 6df. command line options and calls to *note\nsimplefilter(): 491.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Available Context Managers,  Prev: Available Functions,  Up: warnings -- Warning control": {
            "content": "5.29.6.10 Available Context Managers\n....................................\n\n-- Class: warnings.catchwarnings (*, record=False, module=None,\naction=None, category=Warning, lineno=0, append=False)\n\nA context manager that copies and, upon exit, restores the warnings\nfilter and the *note showwarning(): 4080. function.  If the\n'record' argument is *note False: 971. (the default) the context\nmanager returns *note None: 43f. on entry.  If 'record' is *note\nTrue: a53, a list is returned that is progressively populated with\nobjects as seen by a custom *note showwarning(): 4080. function\n(which also suppresses output to 'sys.stdout').  Each object in the\nlist has attributes with the same names as the arguments to *note\nshowwarning(): 4080.\n\nThe 'module' argument takes a module that will be used instead of\nthe module returned when you import *note warnings: 10d. whose\nfilter will be protected.  This argument exists primarily for\ntesting the *note warnings: 10d. module itself.\n\nIf the 'action' argument is not 'None', the remaining arguments are\npassed to *note simplefilter(): 491. as if it were called\nimmediately on entering the context.\n\nNote: The *note catchwarnings: 2e6. manager works by\nreplacing and then later restoring the module's *note\nshowwarning(): 4080. function and internal list of filter\nspecifications.  This means the context manager is modifying\nglobal state and therefore is not thread-safe.\n\nChanged in version 3.11: Added the 'action', 'category', 'lineno',\nand 'append' parameters.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: dataclasses -- Data Classes,  Next: contextlib -- Utilities for with-statement contexts,  Prev: warnings -- Warning control,  Up: Python Runtime Services": {
            "content": "'Source code:' Lib/dataclasses.py(1)\n\n\n",
            "subsections": []
        },
        "This module provides a decorator and functions for automatically adding": {
            "content": "generated *note special method: 160d.s such as *note init(): 47d.\nand *note repr(): 3e8. to user-defined classes.  It was originally\ndescribed in PEP 557(2).\n",
            "subsections": []
        },
        "The member variables to use in these generated methods are defined using": {
            "content": "PEP 526(3) type annotations.  For example, this code:\n\nfrom dataclasses import dataclass\n\n@dataclass\nclass InventoryItem:\n\"\"\"Class for keeping track of an item in inventory.\"\"\"\nname: str\nunitprice: float\nquantityonhand: int = 0\n\ndef totalcost(self) -> float:\nreturn self.unitprice * self.quantityonhand\n\nwill add, among other things, a 'init()' that looks like:\n\ndef init(self, name: str, unitprice: float, quantityonhand: int = 0):\nself.name = name\nself.unitprice = unitprice\nself.quantityonhand = quantityonhand\n",
            "subsections": []
        },
        "Note that this method is automatically added to the class: it is not": {
            "content": "directly specified in the 'InventoryItem' definition shown above.\n\nNew in version 3.7.\n\n* Menu:\n\n* Module contents: Module contents<4>.\n* Post-init processing::\n* Class variables::\n* Init-only variables::\n* Frozen instances::\n* Inheritance: Inheritance<2>.\n* Re-ordering of keyword-only parameters in init(): Re-ordering of keyword-only parameters in init.\n* Default factory functions::\n* Mutable default values::\n* Descriptor-typed fields::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/dataclasses.py\n\n(2) https://peps.python.org/pep-0557/\n\n(3) https://peps.python.org/pep-0526/\n\nFile: python3.12.info,  Node: Module contents<4>,  Next: Post-init processing,  Up: dataclasses -- Data Classes\n\n5.29.7.1 Module contents\n........................\n\n-- Function: @dataclasses.dataclass (*, init=True, repr=True, eq=True,\norder=False, unsafehash=False, frozen=False, matchargs=True,\nkwonly=False, slots=False, weakrefslot=False)\n\nThis function is a *note decorator: 514. that is used to add\ngenerated *note special methods: 160d. to classes, as described\nbelow.\n\nThe '@dataclass' decorator examines the class to find 'field's.  A\n'field' is defined as a class variable that has a *note type\nannotation: bb0.  With two exceptions described below, nothing in\n'@dataclass' examines the type specified in the variable\nannotation.\n\nThe order of the fields in all of the generated methods is the\norder in which they appear in the class definition.\n\nThe '@dataclass' decorator will add various \"dunder\" methods to the\nclass, described below.  If any of the added methods already exist\nin the class, the behavior depends on the parameter, as documented\nbelow.  The decorator returns the same class that it is called on;\nno new class is created.\n\nIf '@dataclass' is used just as a simple decorator with no\nparameters, it acts as if it has the default values documented in\nthis signature.  That is, these three uses of '@dataclass' are\nequivalent:\n\n@dataclass\nclass C:\n...\n\n@dataclass()\nclass C:\n...\n\n@dataclass(init=True, repr=True, eq=True, order=False, unsafehash=False, frozen=False,\nmatchargs=True, kwonly=False, slots=False, weakrefslot=False)\nclass C:\n...\n\nThe parameters to '@dataclass' are:\n\n- 'init': If true (the default), a *note init(): 47d. method\nwill be generated.\n\nIf the class already defines 'init()', this parameter is\nignored.\n\n- 'repr': If true (the default), a *note repr(): 3e8. method\nwill be generated.  The generated repr string will have the\nclass name and the name and repr of each field, in the order\nthey are defined in the class.  Fields that are marked as\nbeing excluded from the repr are not included.  For example:\n'InventoryItem(name='widget', unitprice=3.0,\nquantityonhand=10)'.\n\nIf the class already defines 'repr()', this parameter is\nignored.\n\n- 'eq': If true (the default), an *note eq(): 931. method\nwill be generated.  This method compares the class as if it\nwere a tuple of its fields, in order.  Both instances in the\ncomparison must be of the identical type.\n\nIf the class already defines 'eq()', this parameter is\nignored.\n\n- 'order': If true (the default is 'False'), *note lt():\n1180, *note le(): 1181, *note gt(): 1182, and *note\nge(): 1183. methods will be generated.  These compare the\nclass as if it were a tuple of its fields, in order.  Both\ninstances in the comparison must be of the identical type.  If\n'order' is true and 'eq' is false, a *note ValueError: 183. is\nraised.\n\nIf the class already defines any of 'lt()', 'le()',\n'gt()', or 'ge()', then *note TypeError: 28e. is\nraised.\n\n- 'unsafehash': If 'False' (the default), a *note hash():\n932. method is generated according to how 'eq' and 'frozen'\nare set.\n\n'hash()' is used by built-in *note hash(): 3b1, and when\nobjects are added to hashed collections such as dictionaries\nand sets.  Having a 'hash()' implies that instances of the\nclass are immutable.  Mutability is a complicated property\nthat depends on the programmer's intent, the existence and\nbehavior of 'eq()', and the values of the 'eq' and\n'frozen' flags in the '@dataclass' decorator.\n\nBy default, '@dataclass' will not implicitly add a *note\nhash(): 932. method unless it is safe to do so.  Neither\nwill it add or change an existing explicitly defined\n'hash()' method.  Setting the class attribute 'hash =\nNone' has a specific meaning to Python, as described in the\n'hash()' documentation.\n\nIf 'hash()' is not explicitly defined, or if it is set to\n'None', then '@dataclass' 'may' add an implicit 'hash()'\nmethod.  Although not recommended, you can force '@dataclass'\nto create a 'hash()' method with 'unsafehash=True'.  This\nmight be the case if your class is logically immutable but can\nstill be mutated.  This is a specialized use case and should\nbe considered carefully.\n\nHere are the rules governing implicit creation of a\n'hash()' method.  Note that you cannot both have an\nexplicit 'hash()' method in your dataclass and set\n'unsafehash=True'; this will result in a *note TypeError:\n28e.\n\nIf 'eq' and 'frozen' are both true, by default '@dataclass'\nwill generate a 'hash()' method for you.  If 'eq' is true\nand 'frozen' is false, 'hash()' will be set to 'None',\nmarking it unhashable (which it is, since it is mutable).  If\n'eq' is false, 'hash()' will be left untouched meaning the\n'hash()' method of the superclass will be used (if the\nsuperclass is *note object: 8bb, this means it will fall back\nto id-based hashing).\n\n- 'frozen': If true (the default is 'False'), assigning to\nfields will generate an exception.  This emulates read-only\nfrozen instances.  If *note setattr(): 1c35. or *note\ndelattr(): 1c36. is defined in the class, then *note\nTypeError: 28e. is raised.  See the discussion below.\n\n- 'matchargs': If true (the default is 'True'), the\n'matchargs' tuple will be created from the list of\nparameters to the generated *note init(): 47d. method\n(even if 'init()' is not generated, see above).  If false,\nor if 'matchargs' is already defined in the class, then\n'matchargs' will not be generated.\n\nNew in version 3.10.\n\n- 'kwonly': If true (the default value is 'False'), then all\nfields will be marked as keyword-only.  If a field is marked\nas keyword-only, then the only effect is that the *note\ninit(): 47d. parameter generated from a keyword-only field\nmust be specified with a keyword when 'init()' is called.\nThere is no effect on any other aspect of dataclasses.  See\nthe *note parameter: 1c1e. glossary entry for details.  Also\nsee the *note KWONLY: 4093. section.\n\nNew in version 3.10.\n\n- 'slots': If true (the default is 'False'), *note slots:\n1344. attribute will be generated and new class will be\nreturned instead of the original one.  If 'slots' is\nalready defined in the class, then *note TypeError: 28e. is\nraised.\n\nNew in version 3.10.\n\nChanged in version 3.11: If a field name is already included\nin the 'slots' of a base class, it will not be included in\nthe generated 'slots' to prevent *note overriding them:\n1c76.  Therefore, do not use 'slots' to retrieve the field\nnames of a dataclass.  Use *note fields(): 148c. instead.  To\nbe able to determine inherited slots, base class 'slots'\nmay be any iterable, but 'not' an iterator.\n\n- 'weakrefslot': If true (the default is 'False'), add a slot\nnamed \"weakref\", which is required to make an instance\nweakref-able.  It is an error to specify 'weakrefslot=True'\nwithout also specifying 'slots=True'.\n\nNew in version 3.11.\n\n'field's may optionally specify a default value, using normal\nPython syntax:\n\n@dataclass\nclass C:\na: int       # 'a' has no default value\nb: int = 0   # assign a default value for 'b'\n\nIn this example, both 'a' and 'b' will be included in the added\n*note init(): 47d. method, which will be defined as:\n\ndef init(self, a: int, b: int = 0):\n\n*note TypeError: 28e. will be raised if a field without a default\nvalue follows a field with a default value.  This is true whether\nthis occurs in a single class, or as a result of class inheritance.\n\n-- Function: dataclasses.field (*, default=MISSING,\ndefaultfactory=MISSING, init=True, repr=True, hash=None,\ncompare=True, metadata=None, kwonly=MISSING)\n\nFor common and simple use cases, no other functionality is\nrequired.  There are, however, some dataclass features that require\nadditional per-field information.  To satisfy this need for\nadditional information, you can replace the default field value\nwith a call to the provided 'field()' function.  For example:\n\n@dataclass\nclass C:\nmylist: list[int] = field(defaultfactory=list)\n\nc = C()\nc.mylist += [1, 2, 3]\n\nAs shown above, the *note MISSING: 4094. value is a sentinel object\nused to detect if some parameters are provided by the user.  This\nsentinel is used because 'None' is a valid value for some\nparameters with a distinct meaning.  No code should directly use\nthe *note MISSING: 4094. value.\n\nThe parameters to 'field()' are:\n\n- 'default': If provided, this will be the default value for\nthis field.  This is needed because the 'field()' call itself\nreplaces the normal position of the default value.\n\n- 'defaultfactory': If provided, it must be a zero-argument\ncallable that will be called when a default value is needed\nfor this field.  Among other purposes, this can be used to\nspecify fields with mutable default values, as discussed\nbelow.  It is an error to specify both 'default' and\n'defaultfactory'.\n\n- 'init': If true (the default), this field is included as a\nparameter to the generated *note init(): 47d. method.\n\n- 'repr': If true (the default), this field is included in the\nstring returned by the generated *note repr(): 3e8.\nmethod.\n\n- 'hash': This can be a bool or 'None'.  If true, this field is\nincluded in the generated *note hash(): 932. method.  If\n'None' (the default), use the value of 'compare': this would\nnormally be the expected behavior.  A field should be\nconsidered in the hash if it's used for comparisons.  Setting\nthis value to anything other than 'None' is discouraged.\n\nOne possible reason to set 'hash=False' but 'compare=True'\nwould be if a field is expensive to compute a hash value for,\nthat field is needed for equality testing, and there are other\nfields that contribute to the type's hash value.  Even if a\nfield is excluded from the hash, it will still be used for\ncomparisons.\n\n- 'compare': If true (the default), this field is included in\nthe generated equality and comparison methods (*note eq():\n931, *note gt(): 1182, et al.).\n\n- 'metadata': This can be a mapping or None.  None is treated as\nan empty dict.  This value is wrapped in *note\nMappingProxyType(): 186. to make it read-only, and exposed on\nthe *note Field: 1f63. object.  It is not used at all by Data\nClasses, and is provided as a third-party extension mechanism.\nMultiple third-parties can each have their own key, to use as\na namespace in the metadata.\n\n- 'kwonly': If true, this field will be marked as keyword-only.\nThis is used when the generated *note init(): 47d.\nmethod's parameters are computed.\n\nNew in version 3.10.\n\nIf the default value of a field is specified by a call to\n'field()', then the class attribute for this field will be replaced\nby the specified 'default' value.  If no 'default' is provided,\nthen the class attribute will be deleted.  The intent is that after\nthe *note @dataclass: 38d. decorator runs, the class attributes\nwill all contain the default values for the fields, just as if the\ndefault value itself were specified.  For example, after:\n\n@dataclass\nclass C:\nx: int\ny: int = field(repr=False)\nz: int = field(repr=False, default=10)\nt: int = 20\n\nThe class attribute 'C.z' will be '10', the class attribute 'C.t'\nwill be '20', and the class attributes 'C.x' and 'C.y' will not be\nset.\n\n-- Class: dataclasses.Field\n\n'Field' objects describe each defined field.  These objects are\ncreated internally, and are returned by the *note fields(): 148c.\nmodule-level method (see below).  Users should never instantiate a\n'Field' object directly.  Its documented attributes are:\n\n- 'name': The name of the field.\n\n- 'type': The type of the field.\n\n- 'default', 'defaultfactory', 'init', 'repr', 'hash',\n'compare', 'metadata', and 'kwonly' have the identical\nmeaning and values as they do in the *note field(): 1798.\nfunction.\n\nOther attributes may exist, but they are private and must not be\ninspected or relied on.\n\n-- Function: dataclasses.fields (classorinstance)\n\nReturns a tuple of *note Field: 1f63. objects that define the\nfields for this dataclass.  Accepts either a dataclass, or an\ninstance of a dataclass.  Raises *note TypeError: 28e. if not\npassed a dataclass or instance of one.  Does not return\npseudo-fields which are 'ClassVar' or 'InitVar'.\n\n-- Function: dataclasses.asdict (obj, *, dictfactory=dict)\n\nConverts the dataclass 'obj' to a dict (by using the factory\nfunction 'dictfactory').  Each dataclass is converted to a dict of\nits fields, as 'name: value' pairs.  dataclasses, dicts, lists, and\ntuples are recursed into.  Other objects are copied with *note\ncopy.deepcopy(): 9af.\n\nExample of using 'asdict()' on nested dataclasses:\n\n@dataclass\nclass Point:\nx: int\ny: int\n\n@dataclass\nclass C:\nmylist: list[Point]\n\np = Point(10, 20)\nassert asdict(p) == {'x': 10, 'y': 20}\n\nc = C([Point(0, 0), Point(10, 4)])\nassert asdict(c) == {'mylist': [{'x': 0, 'y': 0}, {'x': 10, 'y': 4}]}\n\nTo create a shallow copy, the following workaround may be used:\n\ndict((field.name, getattr(obj, field.name)) for field in fields(obj))\n\n'asdict()' raises *note TypeError: 28e. if 'obj' is not a dataclass\ninstance.\n\n-- Function: dataclasses.astuple (obj, *, tuplefactory=tuple)\n\nConverts the dataclass 'obj' to a tuple (by using the factory\nfunction 'tuplefactory').  Each dataclass is converted to a tuple\nof its field values.  dataclasses, dicts, lists, and tuples are\nrecursed into.  Other objects are copied with *note\ncopy.deepcopy(): 9af.\n\nContinuing from the previous example:\n\nassert astuple(p) == (10, 20)\nassert astuple(c) == ([(0, 0), (10, 4)],)\n\nTo create a shallow copy, the following workaround may be used:\n\ntuple(getattr(obj, field.name) for field in dataclasses.fields(obj))\n\n'astuple()' raises *note TypeError: 28e. if 'obj' is not a\ndataclass instance.\n\n-- Function: dataclasses.makedataclass (clsname, fields, *, bases=(),\nnamespace=None, init=True, repr=True, eq=True, order=False,\nunsafehash=False, frozen=False, matchargs=True,\nkwonly=False, slots=False, weakrefslot=False, module=None)\n\nCreates a new dataclass with name 'clsname', fields as defined in\n'fields', base classes as given in 'bases', and initialized with a\nnamespace as given in 'namespace'.  'fields' is an iterable whose\nelements are each either 'name', '(name, type)', or '(name, type,\nField)'.  If just 'name' is supplied, 'typing.Any' is used for\n'type'.  The values of 'init', 'repr', 'eq', 'order',\n'unsafehash', 'frozen', 'matchargs', 'kwonly', 'slots', and\n'weakrefslot' have the same meaning as they do in *note\n@dataclass: 38d.\n\nIf 'module' is defined, the 'module' attribute of the dataclass\nis set to that value.  By default, it is set to the module name of\nthe caller.\n\nThis function is not strictly required, because any Python\nmechanism for creating a new class with 'annotations' can then\napply the '@dataclass' function to convert that class to a\ndataclass.  This function is provided as a convenience.  For\nexample:\n\nC = makedataclass('C',\n[('x', int),\n'y',\n('z', int, field(default=5))],\nnamespace={'addone': lambda self: self.x + 1})\n\nIs equivalent to:\n\n@dataclass\nclass C:\nx: int\ny: 'typing.Any'\nz: int = 5\n\ndef addone(self):\nreturn self.x + 1\n\n-- Function: dataclasses.replace (obj, /, changes)\n\nCreates a new object of the same type as 'obj', replacing fields\nwith values from 'changes'.  If 'obj' is not a Data Class, raises\n*note TypeError: 28e.  If values in 'changes' do not specify\nfields, raises *note TypeError: 28e.\n\nThe newly returned object is created by calling the *note\ninit(): 47d. method of the dataclass.  This ensures that *note\npostinit(): 4095, if present, is also called.\n\nInit-only variables without default values, if any exist, must be\nspecified on the call to 'replace()' so that they can be passed to\n'init()' and *note postinit(): 4095.\n\nIt is an error for 'changes' to contain any fields that are defined\nas having 'init=False'.  A *note ValueError: 183. will be raised in\nthis case.\n\nBe forewarned about how 'init=False' fields work during a call to\n'replace()'.  They are not copied from the source object, but\nrather are initialized in *note postinit(): 4095, if they're\ninitialized at all.  It is expected that 'init=False' fields will\nbe rarely and judiciously used.  If they are used, it might be wise\nto have alternate class constructors, or perhaps a custom\n'replace()' (or similarly named) method which handles instance\ncopying.\n\n-- Function: dataclasses.isdataclass (obj)\n\nReturn 'True' if its parameter is a dataclass or an instance of\none, otherwise return 'False'.\n\nIf you need to know if a class is an instance of a dataclass (and\nnot a dataclass itself), then add a further check for 'not\nisinstance(obj, type)':\n\ndef isdataclassinstance(obj):\nreturn isdataclass(obj) and not isinstance(obj, type)\n\n-- Data: dataclasses.MISSING\n\nA sentinel value signifying a missing default or defaultfactory.\n\n-- Data: dataclasses.KWONLY\n\nA sentinel value used as a type annotation.  Any fields after a\npseudo-field with the type of 'KWONLY' are marked as keyword-only\nfields.  Note that a pseudo-field of type 'KWONLY' is otherwise\ncompletely ignored.  This includes the name of such a field.  By\nconvention, a name of '' is used for a 'KWONLY' field.\nKeyword-only fields signify *note init(): 47d. parameters that\nmust be specified as keywords when the class is instantiated.\n\nIn this example, the fields 'y' and 'z' will be marked as\nkeyword-only fields:\n\n@dataclass\nclass Point:\nx: float\n: KWONLY\ny: float\nz: float\n\np = Point(0, y=1.5, z=2.0)\n\nIn a single dataclass, it is an error to specify more than one\nfield whose type is 'KWONLY'.\n\nNew in version 3.10.\n\n-- Exception: dataclasses.FrozenInstanceError\n\nRaised when an implicitly defined *note setattr(): 1c35. or\n*note delattr(): 1c36. is called on a dataclass which was\ndefined with 'frozen=True'.  It is a subclass of *note\nAttributeError: 395.\n\nFile: python3.12.info,  Node: Post-init processing,  Next: Class variables,  Prev: Module contents<4>,  Up: dataclasses -- Data Classes\n\n5.29.7.2 Post-init processing\n.............................\n\n-- Function: dataclasses.postinit ()\n\nWhen defined on the class, it will be called by the generated *note\ninit(): 47d, normally as 'self.postinit()'.  However, if\nany 'InitVar' fields are defined, they will also be passed to\n'postinit()' in the order they were defined in the class.  If\nno 'init()' method is generated, then 'postinit()' will\nnot automatically be called.\n\nAmong other uses, this allows for initializing field values that\ndepend on one or more other fields.  For example:\n\n@dataclass\nclass C:\na: float\nb: float\nc: float = field(init=False)\n\ndef postinit(self):\nself.c = self.a + self.b\n\nThe *note init(): 47d. method generated by *note @dataclass: 38d.\ndoes not call base class 'init()' methods.  If the base class has an\n'init()' method that has to be called, it is common to call this\nmethod in a *note postinit(): 4095. method:\n\nclass Rectangle:\ndef init(self, height, width):\nself.height = height\nself.width = width\n\n@dataclass\nclass Square(Rectangle):\nside: float\n\ndef postinit(self):\nsuper().init(self.side, self.side)\n",
            "subsections": []
        },
        "Note, however, that in general the dataclass-generated 'init()'": {
            "content": "methods don't need to be called, since the derived dataclass will take\ncare of initializing all fields of any base class that is a dataclass\nitself.\n",
            "subsections": []
        },
        "See the section below on init-only variables for ways to pass parameters": {
            "content": "to 'postinit()'.  Also see the warning about how *note replace():\n1629. handles 'init=False' fields.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Class variables,  Next: Init-only variables,  Prev: Post-init processing,  Up: dataclasses -- Data Classes": {
            "content": "5.29.7.3 Class variables\n........................\n\nOne of the few places where *note @dataclass: 38d. actually inspects the\ntype of a field is to determine if a field is a class variable as\ndefined in PEP 526(1).  It does this by checking if the type of the\nfield is 'typing.ClassVar'.  If a field is a 'ClassVar', it is excluded\nfrom consideration as a field and is ignored by the dataclass\nmechanisms.  Such 'ClassVar' pseudo-fields are not returned by the\nmodule-level *note fields(): 148c. function.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0526/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Init-only variables,  Next: Frozen instances,  Prev: Class variables,  Up: dataclasses -- Data Classes": {
            "content": "5.29.7.4 Init-only variables\n............................\n\nAnother place where *note @dataclass: 38d. inspects a type annotation is\nto determine if a field is an init-only variable.  It does this by\nseeing if the type of a field is of type 'dataclasses.InitVar'.  If a\nfield is an 'InitVar', it is considered a pseudo-field called an\ninit-only field.  As it is not a true field, it is not returned by the\nmodule-level *note fields(): 148c. function.  Init-only fields are added\nas parameters to the generated *note init(): 47d. method, and are\npassed to the optional *note postinit(): 4095. method.  They are\nnot otherwise used by dataclasses.\n",
            "subsections": []
        },
        "For example, suppose a field will be initialized from a database, if a": {
            "content": "value is not provided when creating the class:\n\n@dataclass\nclass C:\ni: int\nj: int | None = None\ndatabase: InitVar[DatabaseType | None] = None\n\ndef postinit(self, database):\nif self.j is None and database is not None:\nself.j = database.lookup('j')\n\nc = C(10, database=mydatabase)\n\nIn this case, *note fields(): 148c. will return *note Field: 1f63.\nobjects for 'i' and 'j', but not for 'database'.\n\nFile: python3.12.info,  Node: Frozen instances,  Next: Inheritance<2>,  Prev: Init-only variables,  Up: dataclasses -- Data Classes\n\n5.29.7.5 Frozen instances\n.........................\n",
            "subsections": []
        },
        "It is not possible to create truly immutable Python objects.  However,": {
            "content": "by passing 'frozen=True' to the *note @dataclass: 38d. decorator you can\nemulate immutability.  In that case, dataclasses will add *note\nsetattr(): 1c35. and *note delattr(): 1c36. methods to the\nclass.  These methods will raise a *note FrozenInstanceError: 4096. when\ninvoked.\n\nThere is a tiny performance penalty when using 'frozen=True': *note\ninit(): 47d. cannot use simple assignment to initialize fields, and\nmust use 'setattr()'.\n\nFile: python3.12.info,  Node: Inheritance<2>,  Next: Re-ordering of keyword-only parameters in init,  Prev: Frozen instances,  Up: dataclasses -- Data Classes\n\n5.29.7.6 Inheritance\n....................\n\nWhen the dataclass is being created by the *note @dataclass: 38d.\ndecorator, it looks through all of the class's base classes in reverse\nMRO (that is, starting at *note object: 8bb.) and, for each dataclass\nthat it finds, adds the fields from that base class to an ordered\nmapping of fields.  After all of the base class fields are added, it\nadds its own fields to the ordered mapping.  All of the generated\nmethods will use this combined, calculated ordered mapping of fields.",
            "subsections": []
        },
        "Because the fields are in insertion order, derived classes override base": {
            "content": "classes.  An example:\n\n@dataclass\nclass Base:\nx: Any = 15.0\ny: int = 0\n\n@dataclass\nclass C(Base):\nz: int = 10\nx: int = 15\n",
            "subsections": []
        },
        "The final list of fields is, in order, 'x', 'y', 'z'.  The final type of": {
            "content": "'x' is 'int', as specified in class 'C'.\n\nThe generated *note init(): 47d. method for 'C' will look like:\n\ndef init(self, x: int = 15, y: int = 0, z: int = 10):\n\nFile: python3.12.info,  Node: Re-ordering of keyword-only parameters in init,  Next: Default factory functions,  Prev: Inheritance<2>,  Up: dataclasses -- Data Classes\n\n5.29.7.7 Re-ordering of keyword-only parameters in 'init()'\n...............................................................\n\nAfter the parameters needed for *note init(): 47d. are computed, any\nkeyword-only parameters are moved to come after all regular\n(non-keyword-only) parameters.  This is a requirement of how\nkeyword-only parameters are implemented in Python: they must come after\nnon-keyword-only parameters.\n",
            "subsections": []
        },
        "In this example, 'Base.y', 'Base.w', and 'D.t' are keyword-only fields,": {
            "content": "and 'Base.x' and 'D.z' are regular fields:\n\n@dataclass\nclass Base:\nx: Any = 15.0\n: KWONLY\ny: int = 0\nw: int = 1\n\n@dataclass\nclass D(Base):\nz: int = 10\nt: int = field(kwonly=True, default=0)\n\nThe generated 'init()' method for 'D' will look like:\n\ndef init(self, x: Any = 15.0, z: int = 10, *, y: int = 0, w: int = 1, t: int = 0):\n",
            "subsections": []
        },
        "Note that the parameters have been re-ordered from how they appear in": {
            "content": "the list of fields: parameters derived from regular fields are followed\nby parameters derived from keyword-only fields.\n",
            "subsections": []
        },
        "The relative ordering of keyword-only parameters is maintained in the": {
            "content": "re-ordered 'init()' parameter list.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Default factory functions,  Next: Mutable default values,  Prev: Re-ordering of keyword-only parameters in init,  Up: dataclasses -- Data Classes": {
            "content": "5.29.7.8 Default factory functions\n..................................\n\nIf a *note field(): 1798. specifies a 'defaultfactory', it is called\nwith zero arguments when a default value for the field is needed.  For\nexample, to create a new instance of a list, use:\n\nmylist: list = field(defaultfactory=list)\n\nIf a field is excluded from *note init(): 47d. (using 'init=False')\nand the field also specifies 'defaultfactory', then the default factory\nfunction will always be called from the generated 'init()' function.",
            "subsections": []
        },
        "This happens because there is no other way to give the field an initial": {
            "content": "value.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Mutable default values,  Next: Descriptor-typed fields,  Prev: Default factory functions,  Up: dataclasses -- Data Classes": {
            "content": "5.29.7.9 Mutable default values\n...............................\n\nPython stores default member variable values in class attributes.\nConsider this example, not using dataclasses:\n\nclass C:\nx = []\ndef add(self, element):\nself.x.append(element)\n\no1 = C()\no2 = C()\no1.add(1)\no2.add(2)\nassert o1.x == [1, 2]\nassert o1.x is o2.x\n",
            "subsections": []
        },
        "Note that the two instances of class 'C' share the same class variable": {
            "content": "'x', as expected.\n\nUsing dataclasses, 'if' this code was valid:\n\n@dataclass\nclass D:\nx: list = []      # This code raises ValueError\ndef add(self, element):\nself.x.append(element)\n\nit would generate code similar to:\n\nclass D:\nx = []\ndef init(self, x=x):\nself.x = x\ndef add(self, element):\nself.x.append(element)\n\nassert D().x is D().x\n",
            "subsections": []
        },
        "This has the same issue as the original example using class 'C'.  That": {
            "content": "is, two instances of class 'D' that do not specify a value for 'x' when\ncreating a class instance will share the same copy of 'x'.  Because\ndataclasses just use normal Python class creation they also share this\nbehavior.  There is no general way for Data Classes to detect this\ncondition.  Instead, the *note @dataclass: 38d. decorator will raise a\n*note ValueError: 183. if it detects an unhashable default parameter.",
            "subsections": []
        },
        "The assumption is that if a value is unhashable, it is mutable.  This is": {
            "content": "a partial solution, but it does protect against many common errors.\n",
            "subsections": []
        },
        "Using default factory functions is a way to create new instances of": {
            "content": "mutable types as default values for fields:\n\n@dataclass\nclass D:\nx: list = field(defaultfactory=list)\n\nassert D().x is not D().x\n",
            "subsections": []
        },
        "Changed in version 3.11: Instead of looking for and disallowing objects": {
            "content": "of type 'list', 'dict', or 'set', unhashable objects are now not allowed\nas default values.  Unhashability is used to approximate mutability.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Descriptor-typed fields,  Prev: Mutable default values,  Up: dataclasses -- Data Classes": {
            "content": "5.29.7.10 Descriptor-typed fields\n.................................\n\nFields that are assigned *note descriptor objects: a98. as their default\nvalue have the following special behaviors:\n\n* The value for the field passed to the dataclass's *note init():\n47d. method is passed to the descriptor's *note set(): 1c6f.\nmethod rather than overwriting the descriptor object.\n\n* Similarly, when getting or setting the field, the descriptor's\n*note get(): 1518. or 'set()' method is called rather than\nreturning or overwriting the descriptor object.\n\n* To determine whether a field contains a default value, *note\n@dataclass: 38d. will call the descriptor's 'get()' method\nusing its class access form: 'descriptor.get(obj=None,\ntype=cls)'.  If the descriptor returns a value in this case, it\nwill be used as the field's default.  On the other hand, if the\ndescriptor raises *note AttributeError: 395. in this situation, no\ndefault value will be provided for the field.\n\nclass IntConversionDescriptor:\ndef init(self, *, default):\nself.default = default\n\ndef setname(self, owner, name):\nself.name = \"\" + name\n\ndef get(self, obj, type):\nif obj is None:\nreturn self.default\n\nreturn getattr(obj, self.name, self.default)\n\ndef set(self, obj, value):\nsetattr(obj, self.name, int(value))\n\n@dataclass\nclass InventoryItem:\nquantityonhand: IntConversionDescriptor = IntConversionDescriptor(default=100)\n\ni = InventoryItem()\nprint(i.quantityonhand)   # 100\ni.quantityonhand = 2.5    # calls set with 2.5\nprint(i.quantityonhand)   # 2\n",
            "subsections": []
        },
        "Note that if a field is annotated with a descriptor type, but is not": {
            "content": "assigned a descriptor object as its default value, the field will act\nlike a normal field.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: contextlib -- Utilities for with-statement contexts,  Next: abc -- Abstract Base Classes,  Prev: dataclasses -- Data Classes,  Up: Python Runtime Services": {
            "content": "'Source code:' Lib/contextlib.py(1)\n\n\n\nThis module provides utilities for common tasks involving the *note\nwith: 396. statement.  For more information see also *note Context\nManager Types: 1cc6. and *note With Statement Context Managers: 1cc4.\n\n* Menu:\n\n* Utilities::\n* Examples and Recipes: Examples and Recipes<3>.\n* Single use, reusable and reentrant context managers: Single use reusable and reentrant context managers.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/contextlib.py\n\nFile: python3.12.info,  Node: Utilities,  Next: Examples and Recipes<3>,  Up: contextlib -- Utilities for with-statement contexts\n\n5.29.8.1 Utilities\n..................\n\nFunctions and classes provided:\n\n-- Class: contextlib.AbstractContextManager\n\nAn *note abstract base class: 102a. for classes that implement\n*note object.enter(): 389. and *note object.exit(): 1175.\nA default implementation for *note object.enter(): 389. is\nprovided which returns 'self' while *note object.exit(): 1175.\nis an abstract method which by default returns 'None'.  See also\nthe definition of *note Context Manager Types: 1cc6.\n\nNew in version 3.6.\n\n-- Class: contextlib.AbstractAsyncContextManager\n\nAn *note abstract base class: 102a. for classes that implement\n*note object.aenter(): 1cd7. and *note object.aexit():\n1cd8.  A default implementation for *note object.aenter():\n1cd7. is provided which returns 'self' while *note\nobject.aexit(): 1cd8. is an abstract method which by default\nreturns 'None'.  See also the definition of *note Asynchronous\nContext Managers: 3c4.\n\nNew in version 3.7.\n\n-- Function: @contextlib.contextmanager\n\nThis function is a *note decorator: 514. that can be used to define\na factory function for *note with: 396. statement context managers,\nwithout needing to create a class or separate *note enter():\n389. and *note exit(): 1175. methods.\n\nWhile many objects natively support use in with statements,\nsometimes a resource needs to be managed that isn't a context\nmanager in its own right, and doesn't implement a 'close()' method\nfor use with 'contextlib.closing'\n\nAn abstract example would be the following to ensure correct\nresource management:\n\nfrom contextlib import contextmanager\n\n@contextmanager\ndef managedresource(*args, kwds):\n# Code to acquire resource, e.g.:\nresource = acquireresource(*args, kwds)\ntry:\nyield resource\nfinally:\n# Code to release resource, e.g.:\nreleaseresource(resource)\n\nThe function can then be used like this:\n\n>>> with managedresource(timeout=3600) as resource:\n...     # Resource is released at the end of this block,\n...     # even if code in the block raises an exception\n\nThe function being decorated must return a *note generator:\neda.-iterator when called.  This iterator must yield exactly one\nvalue, which will be bound to the targets in the *note with: 396.\nstatement's 'as' clause, if any.\n\nAt the point where the generator yields, the block nested in the\n*note with: 396. statement is executed.  The generator is then\nresumed after the block is exited.  If an unhandled exception\noccurs in the block, it is reraised inside the generator at the\npoint where the yield occurred.  Thus, you can use a *note try:\n4bc....*note except: 379....*note finally: 7ee. statement to trap the\nerror (if any), or ensure that some cleanup takes place.  If an\nexception is trapped merely in order to log it or to perform some\naction (rather than to suppress it entirely), the generator must\nreraise that exception.  Otherwise the generator context manager\nwill indicate to the 'with' statement that the exception has been\nhandled, and execution will resume with the statement immediately\nfollowing the 'with' statement.\n\n*note contextmanager(): 1076. uses *note ContextDecorator: 1075. so\nthe context managers it creates can be used as decorators as well\nas in *note with: 396. statements.  When used as a decorator, a new\ngenerator instance is implicitly created on each function call\n(this allows the otherwise \"one-shot\" context managers created by\n*note contextmanager(): 1076. to meet the requirement that context\nmanagers support multiple invocations in order to be used as\ndecorators).\n\nChanged in version 3.2: Use of *note ContextDecorator: 1075.\n\n-- Function: @contextlib.asynccontextmanager\n\nSimilar to *note contextmanager(): 1076, but creates an *note\nasynchronous context manager: 3c4.\n\nThis function is a *note decorator: 514. that can be used to\ndefine a factory function for *note async with: 399. statement\nasynchronous context managers, without needing to create a\nclass or separate *note aenter(): 1cd7. and *note\naexit(): 1cd8. methods.  It must be applied to an *note\nasynchronous generator: 1d47. function.\n\nA simple example:\n\nfrom contextlib import asynccontextmanager\n\n@asynccontextmanager\nasync def getconnection():\nconn = await acquiredbconnection()\ntry:\nyield conn\nfinally:\nawait releasedbconnection(conn)\n\nasync def getallusers():\nasync with getconnection() as conn:\nreturn conn.query('SELECT ...')\n\nNew in version 3.7.\n\nContext managers defined with *note asynccontextmanager():\n963. can be used either as decorators or with *note async\nwith: 399. statements:\n\nimport time\nfrom contextlib import asynccontextmanager\n\n@asynccontextmanager\nasync def timeit():\nnow = time.monotonic()\ntry:\nyield\nfinally:\nprint(f'it took {time.monotonic() - now}s to run')\n\n@timeit()\nasync def main():\n# ... async code ...\n\nWhen used as a decorator, a new generator instance is\nimplicitly created on each function call.  This allows the\notherwise \"one-shot\" context managers created by *note\nasynccontextmanager(): 963. to meet the requirement that\ncontext managers support multiple invocations in order to be\nused as decorators.\n\nChanged in version 3.10: Async context managers created with *note\nasynccontextmanager(): 963. can be used as decorators.\n\n-- Function: contextlib.closing (thing)\n\nReturn a context manager that closes 'thing' upon completion of the\nblock.  This is basically equivalent to:\n\nfrom contextlib import contextmanager\n\n@contextmanager\ndef closing(thing):\ntry:\nyield thing\nfinally:\nthing.close()\n\nAnd lets you write code like this:\n\nfrom contextlib import closing\nfrom urllib.request import urlopen\n\nwith closing(urlopen('https://www.python.org')) as page:\nfor line in page:\nprint(line)\n\nwithout needing to explicitly close 'page'.  Even if an error\noccurs, 'page.close()' will be called when the *note with: 396.\nblock is exited.\n\nNote: Most types managing resources support the *note context\nmanager: 398. protocol, which closes 'thing' on leaving the\n*note with: 396. statement.  As such, 'closing()' is most\nuseful for third party types that don't support context\nmanagers.  This example is purely for illustration purposes,\nas *note urlopen(): cf9. would normally be used in a context\nmanager.\n\n-- Function: contextlib.aclosing (thing)\n\nReturn an async context manager that calls the 'aclose()' method of\n'thing' upon completion of the block.  This is basically equivalent\nto:\n\nfrom contextlib import asynccontextmanager\n\n@asynccontextmanager\nasync def aclosing(thing):\ntry:\nyield thing\nfinally:\nawait thing.aclose()\n\nSignificantly, 'aclosing()' supports deterministic cleanup of async\ngenerators when they happen to exit early by *note break: 8de. or\nan exception.  For example:\n\nfrom contextlib import aclosing\n\nasync with aclosing(mygenerator()) as values:\nasync for value in values:\nif value == 42:\nbreak\n\nThis pattern ensures that the generator's async exit code is\nexecuted in the same context as its iterations (so that exceptions\nand context variables work as expected, and the exit code isn't run\nafter the lifetime of some task it depends on).\n\nNew in version 3.10.\n\n-- Function: contextlib.nullcontext (enterresult=None)\n\nReturn a context manager that returns 'enterresult' from\n'enter', but otherwise does nothing.  It is intended to be used\nas a stand-in for an optional context manager, for example:\n\ndef myfunction(arg, ignoreexceptions=False):\nif ignoreexceptions:\n# Use suppress to ignore all exceptions.\ncm = contextlib.suppress(Exception)\nelse:\n# Do not ignore any exceptions, cm has no effect.\ncm = contextlib.nullcontext()\nwith cm:\n# Do something\n\nAn example using 'enterresult':\n\ndef processfile(fileorpath):\nif isinstance(fileorpath, str):\n# If string, open file\ncm = open(fileorpath)\nelse:\n# Caller is responsible for closing file\ncm = nullcontext(fileorpath)\n\nwith cm as file:\n# Perform processing on the file\n\nIt can also be used as a stand-in for *note asynchronous context\nmanagers: 3c4.:\n\nasync def sendhttp(session=None):\nif not session:\n# If no http session, create it with aiohttp\ncm = aiohttp.ClientSession()\nelse:\n# Caller is responsible for closing the session\ncm = nullcontext(session)\n\nasync with cm as session:\n# Send http requests with session\n\nNew in version 3.7.\n\nChanged in version 3.10: *note asynchronous context manager: 39b.\nsupport was added.\n\n-- Function: contextlib.suppress (*exceptions)\n\nReturn a context manager that suppresses any of the specified\nexceptions if they occur in the body of a 'with' statement and then\nresumes execution with the first statement following the end of the\n'with' statement.\n\nAs with any other mechanism that completely suppresses exceptions,\nthis context manager should be used only to cover very specific\nerrors where silently continuing with program execution is known to\nbe the right thing to do.\n\nFor example:\n\nfrom contextlib import suppress\n\nwith suppress(FileNotFoundError):\nos.remove('somefile.tmp')\n\nwith suppress(FileNotFoundError):\nos.remove('someotherfile.tmp')\n\nThis code is equivalent to:\n\ntry:\nos.remove('somefile.tmp')\nexcept FileNotFoundError:\npass\n\ntry:\nos.remove('someotherfile.tmp')\nexcept FileNotFoundError:\npass\n\nThis context manager is *note reentrant: 40a5.\n\nIf the code within the 'with' block raises a *note\nBaseExceptionGroup: 377, suppressed exceptions are removed from the\ngroup.  If any exceptions in the group are not suppressed, a group\ncontaining them is re-raised.\n\nNew in version 3.4.\n\nChanged in version 3.12: 'suppress' now supports suppressing\nexceptions raised as part of an *note BaseExceptionGroup: 377.\n\n-- Function: contextlib.redirectstdout (newtarget)\n\nContext manager for temporarily redirecting *note sys.stdout: 90c.\nto another file or file-like object.\n\nThis tool adds flexibility to existing functions or classes whose\noutput is hardwired to stdout.\n\nFor example, the output of *note help(): 6f0. normally is sent to\n'sys.stdout'.  You can capture that output in a string by\nredirecting the output to an *note io.StringIO: d94. object.  The\nreplacement stream is returned from the 'enter' method and so\nis available as the target of the *note with: 396. statement:\n\nwith redirectstdout(io.StringIO()) as f:\nhelp(pow)\ns = f.getvalue()\n\nTo send the output of *note help(): 6f0. to a file on disk,\nredirect the output to a regular file:\n\nwith open('help.txt', 'w') as f:\nwith redirectstdout(f):\nhelp(pow)\n\nTo send the output of *note help(): 6f0. to 'sys.stderr':\n\nwith redirectstdout(sys.stderr):\nhelp(pow)\n\nNote that the global side effect on *note sys.stdout: 90c. means\nthat this context manager is not suitable for use in library code\nand most threaded applications.  It also has no effect on the\noutput of subprocesses.  However, it is still a useful approach for\nmany utility scripts.\n\nThis context manager is *note reentrant: 40a5.\n\nNew in version 3.4.\n\n-- Function: contextlib.redirectstderr (newtarget)\n\nSimilar to *note redirectstdout(): c45. but redirecting *note\nsys.stderr: 757. to another file or file-like object.\n\nThis context manager is *note reentrant: 40a5.\n\nNew in version 3.5.\n\n-- Function: contextlib.chdir (path)\n\nNon parallel-safe context manager to change the current working\ndirectory.  As this changes a global state, the working directory,\nit is not suitable for use in most threaded or async contexts.  It\nis also not suitable for most non-linear code execution, like\ngenerators, where the program execution is temporarily relinquished\n- unless explicitly desired, you should not yield when this context\nmanager is active.\n\nThis is a simple wrapper around *note chdir(): 3d8, it changes the\ncurrent working directory upon entering and restores the old one on\nexit.\n\nThis context manager is *note reentrant: 40a5.\n\nNew in version 3.11.\n\n-- Class: contextlib.ContextDecorator\n\nA base class that enables a context manager to also be used as a\ndecorator.\n\nContext managers inheriting from 'ContextDecorator' have to\nimplement 'enter' and 'exit' as normal.  'exit' retains\nits optional exception handling even when used as a decorator.\n\n'ContextDecorator' is used by *note contextmanager(): 1076, so you\nget this functionality automatically.\n\nExample of 'ContextDecorator':\n\nfrom contextlib import ContextDecorator\n\nclass mycontext(ContextDecorator):\ndef enter(self):\nprint('Starting')\nreturn self\n\ndef exit(self, *exc):\nprint('Finishing')\nreturn False\n\nThe class can then be used like this:\n\n>>> @mycontext()\n... def function():\n...     print('The bit in the middle')\n...\n>>> function()\nStarting\nThe bit in the middle\nFinishing\n\n>>> with mycontext():\n...     print('The bit in the middle')\n...\nStarting\nThe bit in the middle\nFinishing\n\nThis change is just syntactic sugar for any construct of the\nfollowing form:\n\ndef f():\nwith cm():\n# Do stuff\n\n'ContextDecorator' lets you instead write:\n\n@cm()\ndef f():\n# Do stuff\n\nIt makes it clear that the 'cm' applies to the whole function,\nrather than just a piece of it (and saving an indentation level is\nnice, too).\n\nExisting context managers that already have a base class can be\nextended by using 'ContextDecorator' as a mixin class:\n\nfrom contextlib import ContextDecorator\n\nclass mycontext(ContextBaseClass, ContextDecorator):\ndef enter(self):\nreturn self\n\ndef exit(self, *exc):\nreturn False\n\nNote: As the decorated function must be able to be called\nmultiple times, the underlying context manager must support\nuse in multiple *note with: 396. statements.  If this is not\nthe case, then the original construct with the explicit 'with'\nstatement inside the function should be used.\n\nNew in version 3.2.\n\n-- Class: contextlib.AsyncContextDecorator\n\nSimilar to *note ContextDecorator: 1075. but only for asynchronous\nfunctions.\n\nExample of 'AsyncContextDecorator':\n\nfrom asyncio import run\nfrom contextlib import AsyncContextDecorator\n\nclass mycontext(AsyncContextDecorator):\nasync def aenter(self):\nprint('Starting')\nreturn self\n\nasync def aexit(self, *exc):\nprint('Finishing')\nreturn False\n\nThe class can then be used like this:\n\n>>> @mycontext()\n... async def function():\n...     print('The bit in the middle')\n...\n>>> run(function())\nStarting\nThe bit in the middle\nFinishing\n\n>>> async def function():\n...    async with mycontext():\n...         print('The bit in the middle')\n...\n>>> run(function())\nStarting\nThe bit in the middle\nFinishing\n\nNew in version 3.10.\n\n-- Class: contextlib.ExitStack\n\nA context manager that is designed to make it easy to\nprogrammatically combine other context managers and cleanup\nfunctions, especially those that are optional or otherwise driven\nby input data.\n\nFor example, a set of files may easily be handled in a single with\nstatement as follows:\n\nwith ExitStack() as stack:\nfiles = [stack.entercontext(open(fname)) for fname in filenames]\n# All opened files will automatically be closed at the end of\n# the with statement, even if attempts to open files later\n# in the list raise an exception\n\nThe *note enter(): 389. method returns the *note ExitStack:\n962. instance, and performs no additional operations.\n\nEach instance maintains a stack of registered callbacks that are\ncalled in reverse order when the instance is closed (either\nexplicitly or implicitly at the end of a *note with: 396.\nstatement).  Note that callbacks are 'not' invoked implicitly when\nthe context stack instance is garbage collected.\n\nThis stack model is used so that context managers that acquire\ntheir resources in their 'init' method (such as file objects)\ncan be handled correctly.\n\nSince registered callbacks are invoked in the reverse order of\nregistration, this ends up behaving as if multiple nested *note\nwith: 396. statements had been used with the registered set of\ncallbacks.  This even extends to exception handling - if an inner\ncallback suppresses or replaces an exception, then outer callbacks\nwill be passed arguments based on that updated state.\n\nThis is a relatively low level API that takes care of the details\nof correctly unwinding the stack of exit callbacks.  It provides a\nsuitable foundation for higher level context managers that\nmanipulate the exit stack in application specific ways.\n\nNew in version 3.3.\n\n-- Method: entercontext (cm)\n\nEnters a new context manager and adds its *note exit():\n1175. method to the callback stack.  The return value is the\nresult of the context manager's own *note enter(): 389.\nmethod.\n\nThese context managers may suppress exceptions just as they\nnormally would if used directly as part of a *note with: 396.\nstatement.\n\nChanged in version 3.11: Raises *note TypeError: 28e. instead\nof *note AttributeError: 395. if 'cm' is not a context\nmanager.\n\n-- Method: push (exit)\n\nAdds a context manager's *note exit(): 1175. method to the\ncallback stack.\n\nAs 'enter' is 'not' invoked, this method can be used to\ncover part of an *note enter(): 389. implementation with a\ncontext manager's own *note exit(): 1175. method.\n\nIf passed an object that is not a context manager, this method\nassumes it is a callback with the same signature as a context\nmanager's *note exit(): 1175. method and adds it directly\nto the callback stack.\n\nBy returning true values, these callbacks can suppress\nexceptions the same way context manager *note exit():\n1175. methods can.\n\nThe passed in object is returned from the function, allowing\nthis method to be used as a function decorator.\n\n-- Method: callback (callback, /, *args, kwds)\n\nAccepts an arbitrary callback function and arguments and adds\nit to the callback stack.\n\nUnlike the other methods, callbacks added this way cannot\nsuppress exceptions (as they are never passed the exception\ndetails).\n\nThe passed in callback is returned from the function, allowing\nthis method to be used as a function decorator.\n\n-- Method: popall ()\n\nTransfers the callback stack to a fresh *note ExitStack: 962.\ninstance and returns it.  No callbacks are invoked by this\noperation - instead, they will now be invoked when the new\nstack is closed (either explicitly or implicitly at the end of\na *note with: 396. statement).\n\nFor example, a group of files can be opened as an \"all or\nnothing\" operation as follows:\n\nwith ExitStack() as stack:\nfiles = [stack.entercontext(open(fname)) for fname in filenames]\n# Hold onto the close method, but don't call it yet.\nclosefiles = stack.popall().close\n# If opening any file fails, all previously opened files will be\n# closed automatically. If all files are opened successfully,\n# they will remain open even after the with statement ends.\n# closefiles() can then be invoked explicitly to close them all.\n\n-- Method: close ()\n\nImmediately unwinds the callback stack, invoking callbacks in\nthe reverse order of registration.  For any context managers\nand exit callbacks registered, the arguments passed in will\nindicate that no exception occurred.\n\n-- Class: contextlib.AsyncExitStack\n\nAn *note asynchronous context manager: 3c4, similar to *note\nExitStack: 962, that supports combining both synchronous and\nasynchronous context managers, as well as having coroutines for\ncleanup logic.\n\nThe *note close(): 40a9. method is not implemented; *note aclose():\n40aa. must be used instead.\n\n-- Method: coroutine enterasynccontext (cm)\n\nSimilar to *note ExitStack.entercontext(): 397. but expects\nan asynchronous context manager.\n\nChanged in version 3.11: Raises *note TypeError: 28e. instead\nof *note AttributeError: 395. if 'cm' is not an asynchronous\ncontext manager.\n\n-- Method: pushasyncexit (exit)\n\nSimilar to *note ExitStack.push(): 40a7. but expects either an\nasynchronous context manager or a coroutine function.\n\n-- Method: pushasynccallback (callback, /, *args, kwds)\n\nSimilar to *note ExitStack.callback(): 8b1. but expects a\ncoroutine function.\n\n-- Method: coroutine aclose ()\n\nSimilar to *note ExitStack.close(): 40a9. but properly handles\nawaitables.\n\nContinuing the example for *note asynccontextmanager(): 963.:\n\nasync with AsyncExitStack() as stack:\nconnections = [await stack.enterasynccontext(getconnection())\nfor i in range(5)]\n# All opened connections will automatically be released at the end of\n# the async with statement, even if attempts to open a connection\n# later in the list raise an exception.\n\nNew in version 3.7.\n\nFile: python3.12.info,  Node: Examples and Recipes<3>,  Next: Single use reusable and reentrant context managers,  Prev: Utilities,  Up: contextlib -- Utilities for with-statement contexts\n\n5.29.8.2 Examples and Recipes\n.............................\n",
            "subsections": []
        },
        "This section describes some examples and recipes for making effective": {
            "content": "use of the tools provided by *note contextlib: 21.\n\n* Menu:\n\n* Supporting a variable number of context managers::\n* Catching exceptions from enter methods::\n* Cleaning up in an enter implementation::\n* Replacing any use of try-finally and flag variables::\n* Using a context manager as a function decorator::\n\nFile: python3.12.info,  Node: Supporting a variable number of context managers,  Next: Catching exceptions from enter methods,  Up: Examples and Recipes<3>\n\n5.29.8.3 Supporting a variable number of context managers\n.........................................................\n\nThe primary use case for *note ExitStack: 962. is the one given in the\nclass documentation: supporting a variable number of context managers\nand other cleanup operations in a single *note with: 396. statement.",
            "subsections": []
        },
        "The variability may come from the number of context managers needed": {
            "content": "being driven by user input (such as opening a user specified collection\nof files), or from some of the context managers being optional:\n\nwith ExitStack() as stack:\nfor resource in resources:\nstack.entercontext(resource)\nif needspecialresource():\nspecial = acquirespecialresource()\nstack.callback(releasespecialresource, special)\n# Perform operations that use the acquired resources\n\nAs shown, *note ExitStack: 962. also makes it quite easy to use *note\nwith: 396. statements to manage arbitrary resources that don't natively\nsupport the context management protocol.\n\nFile: python3.12.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>\n\n5.29.8.4 Catching exceptions from 'enter' methods\n.....................................................\n",
            "subsections": []
        },
        "It is occasionally desirable to catch exceptions from an 'enter'": {
            "content": "method implementation, 'without' inadvertently catching exceptions from\nthe *note with: 396. statement body or the context manager's 'exit'\nmethod.  By using *note ExitStack: 962. the steps in the context\nmanagement protocol can be separated slightly in order to allow this:\n\nstack = ExitStack()\ntry:\nx = stack.entercontext(cm)\nexcept Exception:\n# handle enter exception\nelse:\nwith stack:\n# Handle normal case\n",
            "subsections": []
        },
        "Actually needing to do this is likely to indicate that the underlying": {
            "content": "API should be providing a direct resource management interface for use\nwith *note try: 4bc./*note except: 379./*note finally: 7ee. statements,\nbut not all APIs are well designed in that regard.  When a context\nmanager is the only resource management API provided, then *note",
            "subsections": []
        },
        "ExitStack: 962. can make it easier to handle various situations that": {
            "content": "can't be handled directly in a *note with: 396. statement.\n\nFile: python3.12.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>\n\n5.29.8.5 Cleaning up in an 'enter' implementation\n.....................................................\n\nAs noted in the documentation of *note ExitStack.push(): 40a7, this\nmethod can be useful in cleaning up an already allocated resource if\nlater steps in the *note enter(): 389. implementation fail.\n",
            "subsections": []
        },
        "Here's an example of doing this for a context manager that accepts": {
            "content": "resource acquisition and release functions, along with an optional\nvalidation function, and maps them to the context management protocol:\n\nfrom contextlib import contextmanager, AbstractContextManager, ExitStack\n\nclass ResourceManager(AbstractContextManager):\n\ndef init(self, acquireresource, releaseresource, checkresourceok=None):\nself.acquireresource = acquireresource\nself.releaseresource = releaseresource\nif checkresourceok is None:\ndef checkresourceok(resource):\nreturn True\nself.checkresourceok = checkresourceok\n\n@contextmanager\ndef cleanuponerror(self):\nwith ExitStack() as stack:\nstack.push(self)\nyield\n# The validation check passed and didn't raise an exception\n# Accordingly, we want to keep the resource, and pass it\n# back to our caller\nstack.popall()\n\ndef enter(self):\nresource = self.acquireresource()\nwith self.cleanuponerror():\nif not self.checkresourceok(resource):\nmsg = \"Failed validation for {!r}\"\nraise RuntimeError(msg.format(resource))\nreturn resource\n\ndef exit(self, *excdetails):\n# We don't need to duplicate any of our resource release logic\nself.releaseresource()\n\nFile: python3.12.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>\n\n5.29.8.6 Replacing any use of 'try-finally' and flag variables\n..............................................................\n\nA pattern you will sometimes see is a 'try-finally' statement with a\nflag variable to indicate whether or not the body of the 'finally'\nclause should be executed.  In its simplest form (that can't already be\nhandled just by using an 'except' clause instead), it looks something\nlike this:\n\ncleanupneeded = True\ntry:\nresult = performoperation()\nif result:\ncleanupneeded = False\nfinally:\nif cleanupneeded:\ncleanupresources()\n",
            "subsections": []
        },
        "As with any 'try' statement based code, this can cause problems for": {
            "content": "development and review, because the setup code and the cleanup code can\nend up being separated by arbitrarily long sections of code.\n\n*note ExitStack: 962. makes it possible to instead register a callback\nfor execution at the end of a 'with' statement, and then later decide to\nskip executing that callback:\n\nfrom contextlib import ExitStack\n\nwith ExitStack() as stack:\nstack.callback(cleanupresources)\nresult = performoperation()\nif result:\nstack.popall()\n",
            "subsections": []
        },
        "This allows the intended cleanup up behaviour to be made explicit up": {
            "content": "front, rather than requiring a separate flag variable.\n",
            "subsections": []
        },
        "If a particular application uses this pattern a lot, it can be": {
            "content": "simplified even further by means of a small helper class:\n\nfrom contextlib import ExitStack\n\nclass Callback(ExitStack):\ndef init(self, callback, /, *args, kwds):\nsuper().init()\nself.callback(callback, *args, kwds)\n\ndef cancel(self):\nself.popall()\n\nwith Callback(cleanupresources) as cb:\nresult = performoperation()\nif result:\ncb.cancel()\n",
            "subsections": []
        },
        "If the resource cleanup isn't already neatly bundled into a standalone": {
            "content": "function, then it is still possible to use the decorator form of *note\nExitStack.callback(): 8b1. to declare the resource cleanup in advance:\n\nfrom contextlib import ExitStack\n\nwith ExitStack() as stack:\n@stack.callback\ndef cleanupresources():\n...\nresult = performoperation()\nif result:\nstack.popall()\n",
            "subsections": []
        },
        "Due to the way the decorator protocol works, a callback function": {
            "content": "declared this way cannot take any parameters.  Instead, any resources to\nbe released must be accessed as closure variables.\n\nFile: python3.12.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>\n\n5.29.8.7 Using a context manager as a function decorator\n........................................................\n\n*note ContextDecorator: 1075. makes it possible to use a context manager\nin both an ordinary 'with' statement and also as a function decorator.\n",
            "subsections": []
        },
        "Note that there is one additional limitation when using context managers": {
            "content": "as function decorators: there's no way to access the return value of\n*note enter(): 389.  If that value is needed, then it is still\nnecessary to use an explicit 'with' statement.\n\nSee also\n........\n\nPEP 343(1) - The \"with\" statement\n\nThe specification, background, and examples for the Python *note\nwith: 396. statement.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0343/\n\nFile: python3.12.info,  Node: Single use reusable and reentrant context managers,  Prev: Examples and Recipes<3>,  Up: contextlib -- Utilities for with-statement contexts\n\n5.29.8.8 Single use, reusable and reentrant context managers\n............................................................\n",
            "subsections": []
        },
        "Most context managers are written in a way that means they can only be": {
            "content": "used effectively in a *note with: 396. statement once.  These single use\ncontext managers must be created afresh each time they're used -\nattempting to use them a second time will trigger an exception or\notherwise not work correctly.\n",
            "subsections": []
        },
        "This common limitation means that it is generally advisable to create": {
            "content": "context managers directly in the header of the *note with: 396.\nstatement where they are used (as shown in all of the usage examples\nabove).\n",
            "subsections": []
        },
        "Files are an example of effectively single use context managers, since": {
            "content": "the first *note with: 396. statement will close the file, preventing any\nfurther IO operations using that file object.\n\nContext managers created using *note contextmanager(): 1076. are also\nsingle use context managers, and will complain about the underlying\ngenerator failing to yield if an attempt is made to use them a second\ntime:\n\n>>> from contextlib import contextmanager\n>>> @contextmanager\n... def singleuse():\n...     print(\"Before\")\n...     yield\n...     print(\"After\")\n...\n>>> cm = singleuse()\n>>> with cm:\n...     pass\n...\nBefore\nAfter\n>>> with cm:\n...     pass\n...\nTraceback (most recent call last):\n...\nRuntimeError: generator didn't yield\n\n* Menu:\n\n* Reentrant context managers::\n* Reusable context managers::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Reentrant context managers,  Next: Reusable context managers,  Up: Single use reusable and reentrant context managers": {
            "content": "5.29.8.9 Reentrant context managers\n...................................\n\nMore sophisticated context managers may be \"reentrant\".  These context\nmanagers can not only be used in multiple *note with: 396. statements,\nbut may also be used 'inside' a 'with' statement that is already using\nthe same context manager.\n\n*note threading.RLock: 10cc. is an example of a reentrant context\nmanager, as are *note suppress(): d93, *note redirectstdout(): c45, and\n*note chdir(): 3d7.  Here's a very simple example of reentrant use:\n\n>>> from contextlib import redirectstdout\n>>> from io import StringIO\n>>> stream = StringIO()\n>>> writetostream = redirectstdout(stream)\n>>> with writetostream:\n...     print(\"This is written to the stream rather than stdout\")\n...     with writetostream:\n...         print(\"This is also written to the stream\")\n...\n>>> print(\"This is written directly to stdout\")\nThis is written directly to stdout\n>>> print(stream.getvalue())\nThis is written to the stream rather than stdout\nThis is also written to the stream\n",
            "subsections": []
        },
        "Real world examples of reentrancy are more likely to involve multiple": {
            "content": "functions calling each other and hence be far more complicated than this\nexample.\n",
            "subsections": []
        },
        "Note also that being reentrant is 'not' the same thing as being thread": {
            "content": "safe.  *note redirectstdout(): c45, for example, is definitely not\nthread safe, as it makes a global modification to the system state by\nbinding *note sys.stdout: 90c. to a different stream.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Reusable context managers,  Prev: Reentrant context managers,  Up: Single use reusable and reentrant context managers": {
            "content": "5.29.8.10 Reusable context managers\n...................................\n",
            "subsections": []
        },
        "Distinct from both single use and reentrant context managers are": {
            "content": "\"reusable\" context managers (or, to be completely explicit, \"reusable,\nbut not reentrant\" context managers, since reentrant context managers\nare also reusable).  These context managers support being used multiple\ntimes, but will fail (or otherwise not work correctly) if the specific\ncontext manager instance has already been used in a containing with\nstatement.\n\n*note threading.Lock: 2d58. is an example of a reusable, but not\nreentrant, context manager (for a reentrant lock, it is necessary to use\n*note threading.RLock: 10cc. instead).\n",
            "subsections": []
        },
        "Another example of a reusable, but not reentrant, context manager is": {
            "content": "*note ExitStack: 962, as it invokes 'all' currently registered callbacks\nwhen leaving any with statement, regardless of where those callbacks\nwere added:\n\n>>> from contextlib import ExitStack\n>>> stack = ExitStack()\n>>> with stack:\n...     stack.callback(print, \"Callback: from first context\")\n...     print(\"Leaving first context\")\n...\nLeaving first context\nCallback: from first context\n>>> with stack:\n...     stack.callback(print, \"Callback: from second context\")\n...     print(\"Leaving second context\")\n...\nLeaving second context\nCallback: from second context\n>>> with stack:\n...     stack.callback(print, \"Callback: from outer context\")\n...     with stack:\n...         stack.callback(print, \"Callback: from inner context\")\n...         print(\"Leaving inner context\")\n...     print(\"Leaving outer context\")\n...\nLeaving inner context\nCallback: from inner context\nCallback: from outer context\nLeaving outer context\n",
            "subsections": []
        },
        "As the output from the example shows, reusing a single stack object": {
            "content": "across multiple with statements works correctly, but attempting to nest\nthem will cause the stack to be cleared at the end of the innermost with\nstatement, which is unlikely to be desirable behaviour.\n\nUsing separate *note ExitStack: 962. instances instead of reusing a\nsingle instance avoids that problem:\n\n>>> from contextlib import ExitStack\n>>> with ExitStack() as outerstack:\n...     outerstack.callback(print, \"Callback: from outer context\")\n...     with ExitStack() as innerstack:\n...         innerstack.callback(print, \"Callback: from inner context\")\n...         print(\"Leaving inner context\")\n...     print(\"Leaving outer context\")\n...\nLeaving inner context\nCallback: from inner context\nLeaving outer context\nCallback: from outer context\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: abc -- Abstract Base Classes,  Next: atexit -- Exit handlers,  Prev: contextlib -- Utilities for with-statement contexts,  Up: Python Runtime Services": {
            "content": "'Source code:' Lib/abc.py(1)\n\n\n\nThis module provides the infrastructure for defining *note abstract base\nclasses: 102a. (ABCs) in Python, as outlined in PEP 3119(2); see the PEP\nfor why this was added to Python.  (See also PEP 3141(3) and the *note\nnumbers: 99. module regarding a type hierarchy for numbers based on\nABCs.)\n\nThe *note collections: 1b. module has some concrete classes that derive\nfrom ABCs; these can, of course, be further derived.  In addition, the\n*note collections.abc: 1c. submodule has some ABCs that can be used to\ntest whether a class or instance provides a particular interface, for\nexample, if it is *note hashable: 3db. or if it is a *note mapping:\n1030.\n\nThis module provides the metaclass *note ABCMeta: d80. for defining ABCs\nand a helper class *note ABC: d7f. to alternatively define ABCs through\ninheritance:\n\n-- Class: abc.ABC\n\nA helper class that has *note ABCMeta: d80. as its metaclass.  With\nthis class, an abstract base class can be created by simply\nderiving from 'ABC' avoiding sometimes confusing metaclass usage,\nfor example:\n\nfrom abc import ABC\n\nclass MyABC(ABC):\npass\n\nNote that the type of 'ABC' is still *note ABCMeta: d80, therefore\ninheriting from 'ABC' requires the usual precautions regarding\nmetaclass usage, as multiple inheritance may lead to metaclass\nconflicts.  One may also define an abstract base class by passing\nthe metaclass keyword and using 'ABCMeta' directly, for example:\n\nfrom abc import ABCMeta\n\nclass MyABC(metaclass=ABCMeta):\npass\n\nNew in version 3.4.\n\n-- Class: abc.ABCMeta\n\nMetaclass for defining Abstract Base Classes (ABCs).\n\nUse this metaclass to create an ABC. An ABC can be subclassed\ndirectly, and then acts as a mix-in class.  You can also register\nunrelated concrete classes (even built-in classes) and unrelated\nABCs as \"virtual subclasses\" - these and their descendants will be\nconsidered subclasses of the registering ABC by the built-in *note\nissubclass(): 5b4. function, but the registering ABC won't show up\nin their MRO (Method Resolution Order) nor will method\nimplementations defined by the registering ABC be callable (not\neven via *note super(): 204.).  (4)\n\nClasses created with a metaclass of 'ABCMeta' have the following\nmethod:\n\n-- Method: register (subclass)\n\nRegister 'subclass' as a \"virtual subclass\" of this ABC. For\nexample:\n\nfrom abc import ABC\n\nclass MyABC(ABC):\npass\n\nMyABC.register(tuple)\n\nassert issubclass(tuple, MyABC)\nassert isinstance((), MyABC)\n\nChanged in version 3.3: Returns the registered subclass, to\nallow usage as a class decorator.\n\nChanged in version 3.4: To detect calls to 'register()', you\ncan use the *note getcachetoken(): d7e. function.\n\nYou can also override this method in an abstract base class:\n\n-- Method: subclasshook (subclass)\n\n(Must be defined as a class method.)\n\nCheck whether 'subclass' is considered a subclass of this ABC.\nThis means that you can customize the behavior of *note\nissubclass(): 5b4. further without the need to call *note\nregister(): f00. on every class you want to consider a\nsubclass of the ABC. (This class method is called from the\n*note subclasscheck(): 1c85. method of the ABC.)\n\nThis method should return 'True', 'False' or *note\nNotImplemented: 5c5.  If it returns 'True', the 'subclass' is\nconsidered a subclass of this ABC. If it returns 'False', the\n'subclass' is not considered a subclass of this ABC, even if\nit would normally be one.  If it returns 'NotImplemented', the\nsubclass check is continued with the usual mechanism.\n\nFor a demonstration of these concepts, look at this example ABC\ndefinition:\n\nclass Foo:\ndef getitem(self, index):\n...\ndef len(self):\n...\ndef getiterator(self):\nreturn iter(self)\n\nclass MyIterable(ABC):\n\n@abstractmethod\ndef iter(self):\nwhile False:\nyield None\n\ndef getiterator(self):\nreturn self.iter()\n\n@classmethod\ndef subclasshook(cls, C):\nif cls is MyIterable:\nif any(\"iter\" in B.dict for B in C.mro):\nreturn True\nreturn NotImplemented\n\nMyIterable.register(Foo)\n\nThe ABC 'MyIterable' defines the standard iterable method, *note\niter(): 1a48, as an abstract method.  The implementation given\nhere can still be called from subclasses.  The 'getiterator()'\nmethod is also part of the 'MyIterable' abstract base class, but it\ndoes not have to be overridden in non-abstract derived classes.\n\nThe *note subclasshook(): 2231. class method defined here says\nthat any class that has an *note iter(): 1a48. method in its\n*note dict: aa8. (or in that of one of its base classes,\naccessed via the *note mro: 1e8c. list) is considered a\n'MyIterable' too.\n\nFinally, the last line makes 'Foo' a virtual subclass of\n'MyIterable', even though it does not define an *note iter():\n1a48. method (it uses the old-style iterable protocol, defined in\nterms of *note len(): 1c68. and *note getitem(): 4b9.).\nNote that this will not make 'getiterator' available as a method\nof 'Foo', so it is provided separately.\n\nThe 'abc' module also provides the following decorator:\n\n-- Function: @abc.abstractmethod\n\nA decorator indicating abstract methods.\n\nUsing this decorator requires that the class's metaclass is *note\nABCMeta: d80. or is derived from it.  A class that has a metaclass\nderived from 'ABCMeta' cannot be instantiated unless all of its\nabstract methods and properties are overridden.  The abstract\nmethods can be called using any of the normal 'super' call\nmechanisms.  'abstractmethod()' may be used to declare abstract\nmethods for properties and descriptors.\n\nDynamically adding abstract methods to a class, or attempting to\nmodify the abstraction status of a method or class once it is\ncreated, are only supported using the *note\nupdateabstractmethods(): 40b8. function.  The 'abstractmethod()'\nonly affects subclasses derived using regular inheritance; \"virtual\nsubclasses\" registered with the ABC's *note register(): f00. method\nare not affected.\n\nWhen 'abstractmethod()' is applied in combination with other method\ndescriptors, it should be applied as the innermost decorator, as\nshown in the following usage examples:\n\nclass C(ABC):\n@abstractmethod\ndef myabstractmethod(self, arg1):\n...\n@classmethod\n@abstractmethod\ndef myabstractclassmethod(cls, arg2):\n...\n@staticmethod\n@abstractmethod\ndef myabstractstaticmethod(arg3):\n...\n\n@property\n@abstractmethod\ndef myabstractproperty(self):\n...\n@myabstractproperty.setter\n@abstractmethod\ndef myabstractproperty(self, val):\n...\n\n@abstractmethod\ndef getx(self):\n...\n@abstractmethod\ndef setx(self, val):\n...\nx = property(getx, setx)\n\nIn order to correctly interoperate with the abstract base class\nmachinery, the descriptor must identify itself as abstract using\n'isabstractmethod'.  In general, this attribute should be\n'True' if any of the methods used to compose the descriptor are\nabstract.  For example, Python's built-in *note property: 3f6. does\nthe equivalent of:\n\nclass Descriptor:\n...\n@property\ndef isabstractmethod(self):\nreturn any(getattr(f, 'isabstractmethod', False) for\nf in (self.fget, self.fset, self.fdel))\n\nNote: Unlike Java abstract methods, these abstract methods may\nhave an implementation.  This implementation can be called via\nthe *note super(): 204. mechanism from the class that\noverrides it.  This could be useful as an end-point for a\nsuper-call in a framework that uses cooperative\nmultiple-inheritance.\n\nThe 'abc' module also supports the following legacy decorators:\n\n-- Function: @abc.abstractclassmethod\n\nNew in version 3.2.\n\nDeprecated since version 3.3: It is now possible to use *note\nclassmethod: 246. with *note abstractmethod(): efd, making this\ndecorator redundant.\n\nA subclass of the built-in *note classmethod(): 246, indicating an\nabstract classmethod.  Otherwise it is similar to *note\nabstractmethod(): efd.\n\nThis special case is deprecated, as the *note classmethod(): 246.\ndecorator is now correctly identified as abstract when applied to\nan abstract method:\n\nclass C(ABC):\n@classmethod\n@abstractmethod\ndef myabstractclassmethod(cls, arg):\n...\n\n-- Function: @abc.abstractstaticmethod\n\nNew in version 3.2.\n\nDeprecated since version 3.3: It is now possible to use *note\nstaticmethod: 5cc. with *note abstractmethod(): efd, making this\ndecorator redundant.\n\nA subclass of the built-in *note staticmethod(): 5cc, indicating an\nabstract staticmethod.  Otherwise it is similar to *note\nabstractmethod(): efd.\n\nThis special case is deprecated, as the *note staticmethod(): 5cc.\ndecorator is now correctly identified as abstract when applied to\nan abstract method:\n\nclass C(ABC):\n@staticmethod\n@abstractmethod\ndef myabstractstaticmethod(arg):\n...\n\n-- Function: @abc.abstractproperty\n\nDeprecated since version 3.3: It is now possible to use *note\nproperty: 3f6, *note property.getter(): 13b5, *note\nproperty.setter(): 13b6. and *note property.deleter(): 13b7. with\n*note abstractmethod(): efd, making this decorator redundant.\n\nA subclass of the built-in *note property(): 3f6, indicating an\nabstract property.\n\nThis special case is deprecated, as the *note property(): 3f6.\ndecorator is now correctly identified as abstract when applied to\nan abstract method:\n\nclass C(ABC):\n@property\n@abstractmethod\ndef myabstractproperty(self):\n...\n\nThe above example defines a read-only property; you can also define\na read-write abstract property by appropriately marking one or more\nof the underlying methods as abstract:\n\nclass C(ABC):\n@property\ndef x(self):\n...\n\n@x.setter\n@abstractmethod\ndef x(self, val):\n...\n\nIf only some components are abstract, only those components need to\nbe updated to create a concrete property in a subclass:\n\nclass D(C):\n@C.x.setter\ndef x(self, val):\n...\n\nThe 'abc' module also provides the following functions:\n\n-- Function: abc.getcachetoken ()\n\nReturns the current abstract base class cache token.\n\nThe token is an opaque object (that supports equality testing)\nidentifying the current version of the abstract base class cache\nfor virtual subclasses.  The token changes with every call to *note\nABCMeta.register(): f00. on any ABC.\n\nNew in version 3.4.\n\n-- Function: abc.updateabstractmethods (cls)\n\nA function to recalculate an abstract class's abstraction status.\nThis function should be called if a class's abstract methods have\nbeen implemented or changed after it was created.  Usually, this\nfunction should be called from within a class decorator.\n\nReturns 'cls', to allow usage as a class decorator.\n\nIf 'cls' is not an instance of *note ABCMeta: d80, does nothing.\n\nNote: This function assumes that 'cls''s superclasses are\nalready updated.  It does not update any subclasses.\n\nNew in version 3.10.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/abc.py\n\n(2) https://peps.python.org/pep-3119/\n\n(3) https://peps.python.org/pep-3141/\n\n(4) C++ programmers should note that Python's virtual base class\nconcept is not the same as C++'s.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: atexit -- Exit handlers,  Next: traceback -- Print or retrieve a stack traceback,  Prev: abc -- Abstract Base Classes,  Up: Python Runtime Services": {
            "content": "The *note atexit: a. module defines functions to register and unregister\ncleanup functions.  Functions thus registered are automatically executed\nupon normal interpreter termination.  *note atexit: a. runs these\nfunctions in the 'reverse' order in which they were registered; if you\nregister 'A', 'B', and 'C', at interpreter termination time they will be\nrun in the order 'C', 'B', 'A'.\n\n'Note:' The functions registered via this module are not called when the\nprogram is killed by a signal not handled by Python, when a Python fatal\ninternal error is detected, or when *note os.exit(): 1fa5. is called.\n\n'Note:' The effect of registering or unregistering functions from within\na cleanup function is undefined.\n",
            "subsections": []
        },
        "Changed in version 3.7: When used with C-API subinterpreters, registered": {
            "content": "functions are local to the interpreter they were registered in.\n\n-- Function: atexit.register (func, *args, kwargs)\n\nRegister 'func' as a function to be executed at termination.  Any\noptional arguments that are to be passed to 'func' must be passed\nas arguments to *note register(): 689.  It is possible to register\nthe same function and arguments more than once.\n\nAt normal program termination (for instance, if *note sys.exit():\n11c2. is called or the main module's execution completes), all\nfunctions registered are called in last in, first out order.  The\nassumption is that lower level modules will normally be imported\nbefore higher level modules and thus must be cleaned up later.\n\nIf an exception is raised during execution of the exit handlers, a\ntraceback is printed (unless *note SystemExit: b97. is raised) and\nthe exception information is saved.  After all exit handlers have\nhad a chance to run, the last exception to be raised is re-raised.\n\nThis function returns 'func', which makes it possible to use it as\na decorator.\n\nWarning: Starting new threads or calling *note os.fork(): 231.\nfrom a registered function can lead to race condition between\nthe main Python runtime thread freeing thread states while\ninternal *note threading: e7. routines or the new process try\nto use that state.  This can lead to crashes rather than clean\nshutdown.\n\nChanged in version 3.12: Attempts to start a new thread or *note\nos.fork(): 231. a new process in a registered function now leads to\n*note RuntimeError: 17a.\n\n-- Function: atexit.unregister (func)\n\nRemove 'func' from the list of functions to be run at interpreter\nshutdown.  *note unregister(): 40bb. silently does nothing if\n'func' was not previously registered.  If 'func' has been\nregistered more than once, every occurrence of that function in the\n*note atexit: a. call stack will be removed.  Equality comparisons\n('==') are used internally during unregistration, so function\nreferences do not need to have matching identities.\n\nSee also\n........\n\nModule *note readline: b5.\n\nUseful example of *note atexit: a. to read and write *note\nreadline: b5. history files.\n\n* Menu:\n\n* atexit Example::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: atexit Example,  Up: atexit -- Exit handlers": {
            "content": "5.29.10.1 'atexit' Example\n..........................\n",
            "subsections": []
        },
        "The following simple example demonstrates how a module can initialize a": {
            "content": "counter from a file when it is imported and save the counter's updated\nvalue automatically when the program terminates without relying on the\napplication making an explicit call into this module at termination.\n\ntry:\nwith open('counterfile') as infile:\ncount = int(infile.read())\nexcept FileNotFoundError:\ncount = 0\n\ndef incrcounter(n):\nglobal count\ncount = count + n\n\ndef savecounter():\nwith open('counterfile', 'w') as outfile:\noutfile.write('%d' % count)\n\nimport atexit\n\natexit.register(savecounter)\n\nPositional and keyword arguments may also be passed to *note register():\n689. to be passed along to the registered function when it is called:\n\ndef goodbye(name, adjective):\nprint('Goodbye %s, it was %s to meet you.' % (name, adjective))\n\nimport atexit\n\natexit.register(goodbye, 'Donny', 'nice')\n# or:\natexit.register(goodbye, adjective='nice', name='Donny')\n\nUsage as a *note decorator: 514.:\n\nimport atexit\n\n@atexit.register\ndef goodbye():\nprint('You are now leaving the Python sector.')\n\nThis only works with functions that can be called without arguments.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: traceback -- Print or retrieve a stack traceback,  Next: future -- Future statement definitions,  Prev: atexit -- Exit handlers,  Up: Python Runtime Services": {
            "content": "'Source code:' Lib/traceback.py(1)\n\n\n",
            "subsections": []
        },
        "This module provides a standard interface to extract, format and print": {
            "content": "stack traces of Python programs.  It exactly mimics the behavior of the",
            "subsections": []
        },
        "Python interpreter when it prints a stack trace.  This is useful when": {
            "content": "you want to print stack traces under program control, such as in a\n\"wrapper\" around the interpreter.\n\nThe module uses *note traceback objects: 92b. -- these are objects of\ntype *note types.TracebackType: 929, which are assigned to the *note\ntraceback: 113c. field of *note BaseException: 37c. instances.\n\nSee also\n........\n\nModule *note faulthandler: 53.\n\nUsed to dump Python tracebacks explicitly, on a fault, after a\ntimeout, or on a user signal.\n\nModule *note pdb: a0.\n\nInteractive source code debugger for Python programs.\n\nThe module defines the following functions:\n\n-- Function: traceback.printtb (tb, limit=None, file=None)\n\nPrint up to 'limit' stack trace entries from *note traceback\nobject: 92b. 'tb' (starting from the caller's frame) if 'limit' is\npositive.  Otherwise, print the last 'abs(limit)' entries.  If\n'limit' is omitted or 'None', all entries are printed.  If 'file'\nis omitted or 'None', the output goes to *note sys.stderr: 757.;\notherwise it should be an open *note file: 1037. or *note file-like\nobject: 229a. to receive the output.\n\nChanged in version 3.5: Added negative 'limit' support.\n\n-- Function: traceback.printexception (exc, /[, value, tb],\nlimit=None, file=None, chain=True)\n\nPrint exception information and stack trace entries from *note\ntraceback object: 92b. 'tb' to 'file'.  This differs from *note\nprinttb(): cea. in the following ways:\n\n* if 'tb' is not 'None', it prints a header 'Traceback (most\nrecent call last):'\n\n* it prints the exception type and 'value' after the stack trace\n\n* if 'type(value)' is *note SyntaxError: 146. and 'value' has\nthe appropriate format, it prints the line where the syntax\nerror occurred with a caret indicating the approximate\nposition of the error.\n\nSince Python 3.10, instead of passing 'value' and 'tb', an\nexception object can be passed as the first argument.  If 'value'\nand 'tb' are provided, the first argument is ignored in order to\nprovide backwards compatibility.\n\nThe optional 'limit' argument has the same meaning as for *note\nprinttb(): cea.  If 'chain' is true (the default), then chained\nexceptions (the *note cause: 113e. or *note context: 113d.\nattributes of the exception) will be printed as well, like the\ninterpreter itself does when printing an unhandled exception.\n\nChanged in version 3.5: The 'etype' argument is ignored and\ninferred from the type of 'value'.\n\nChanged in version 3.10: The 'etype' parameter has been renamed to\n'exc' and is now positional-only.\n\n-- Function: traceback.printexc (limit=None, file=None, chain=True)\n\nThis is a shorthand for 'printexception(sys.exception(), limit,\nfile, chain)'.\n\n-- Function: traceback.printlast (limit=None, file=None, chain=True)\n\nThis is a shorthand for 'printexception(sys.lastexc, limit, file,\nchain)'.  In general it will work only after an exception has\nreached an interactive prompt (see *note sys.lastexc: 1e2.).\n\n-- Function: traceback.printstack (f=None, limit=None, file=None)\n\nPrint up to 'limit' stack trace entries (starting from the\ninvocation point) if 'limit' is positive.  Otherwise, print the\nlast 'abs(limit)' entries.  If 'limit' is omitted or 'None', all\nentries are printed.  The optional 'f' argument can be used to\nspecify an alternate *note stack frame: 4af. to start.  The\noptional 'file' argument has the same meaning as for *note\nprinttb(): cea.\n\nChanged in version 3.5: Added negative 'limit' support.\n\n-- Function: traceback.extracttb (tb, limit=None)\n\nReturn a *note StackSummary: ce8. object representing a list of\n\"pre-processed\" stack trace entries extracted from the *note\ntraceback object: 92b. 'tb'.  It is useful for alternate formatting\nof stack traces.  The optional 'limit' argument has the same\nmeaning as for *note printtb(): cea.  A \"pre-processed\" stack\ntrace entry is a *note FrameSummary: ce9. object containing\nattributes *note filename: 40c2, *note lineno: 40c3, *note name:\n40c4, and *note line: 40c5. representing the information that is\nusually printed for a stack trace.\n\n-- Function: traceback.extractstack (f=None, limit=None)\n\nExtract the raw traceback from the current *note stack frame: 4af.\nThe return value has the same format as for *note extracttb():\n40c1.  The optional 'f' and 'limit' arguments have the same meaning\nas for *note printstack(): ceb.\n\n-- Function: traceback.formatlist (extractedlist)\n\nGiven a list of tuples or *note FrameSummary: ce9. objects as\nreturned by *note extracttb(): 40c1. or *note extractstack():\n40c6, return a list of strings ready for printing.  Each string in\nthe resulting list corresponds to the item with the same index in\nthe argument list.  Each string ends in a newline; the strings may\ncontain internal newlines as well, for those items whose source\ntext line is not 'None'.\n\n-- Function: traceback.formatexceptiononly (exc, /[, value])\n\nFormat the exception part of a traceback using an exception value\nsuch as given by *note sys.lastvalue: 1e4.  The return value is a\nlist of strings, each ending in a newline.  The list contains the\nexception's message, which is normally a single string; however,\nfor *note SyntaxError: 146. exceptions, it contains several lines\nthat (when printed) display detailed information about where the\nsyntax error occurred.  Following the message, the list contains\nthe exception's *note notes: 1f92.\n\nSince Python 3.10, instead of passing 'value', an exception object\ncan be passed as the first argument.  If 'value' is provided, the\nfirst argument is ignored in order to provide backwards\ncompatibility.\n\nChanged in version 3.10: The 'etype' parameter has been renamed to\n'exc' and is now positional-only.\n\nChanged in version 3.11: The returned list now includes any *note\nnotes: 1f92. attached to the exception.\n\n-- Function: traceback.formatexception (exc, /[, value, tb],\nlimit=None, chain=True)\n\nFormat a stack trace and the exception information.  The arguments\nhave the same meaning as the corresponding arguments to *note\nprintexception(): 645.  The return value is a list of strings,\neach ending in a newline and some containing internal newlines.\nWhen these lines are concatenated and printed, exactly the same\ntext is printed as does *note printexception(): 645.\n\nChanged in version 3.5: The 'etype' argument is ignored and\ninferred from the type of 'value'.\n\nChanged in version 3.10: This function's behavior and signature\nwere modified to match *note printexception(): 645.\n\n-- Function: traceback.formatexc (limit=None, chain=True)\n\nThis is like 'printexc(limit)' but returns a string instead of\nprinting to a file.\n\n-- Function: traceback.formattb (tb, limit=None)\n\nA shorthand for 'formatlist(extracttb(tb, limit))'.\n\n-- Function: traceback.formatstack (f=None, limit=None)\n\nA shorthand for 'formatlist(extractstack(f, limit))'.\n\n-- Function: traceback.clearframes (tb)\n\nClears the local variables of all the stack frames in a *note\ntraceback: 92b. 'tb' by calling the *note clear(): d72. method of\neach *note frame object: 4af.\n\nNew in version 3.4.\n\n-- Function: traceback.walkstack (f)\n\nWalk a stack following *note f.fback: 578. from the given frame,\nyielding the frame and line number for each frame.  If 'f' is\n'None', the current stack is used.  This helper is used with *note\nStackSummary.extract(): 40ca.\n\nNew in version 3.5.\n\n-- Function: traceback.walktb (tb)\n\nWalk a traceback following *note tbnext: 92a. yielding the frame\nand line number for each frame.  This helper is used with *note\nStackSummary.extract(): 40ca.\n\nNew in version 3.5.\n\nThe module also defines the following classes:\n\n* Menu:\n\n* TracebackException Objects::\n* StackSummary Objects::\n* FrameSummary Objects::\n* Traceback Examples::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/traceback.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: TracebackException Objects,  Next: StackSummary Objects,  Up: traceback -- Print or retrieve a stack traceback": {
            "content": "5.29.11.1 'TracebackException' Objects\n......................................\n\nNew in version 3.5.\n\n'TracebackException' objects are created from actual exceptions to\ncapture data for later printing in a lightweight fashion.\n\n-- Class: traceback.TracebackException (exctype, excvalue,\nexctraceback, *, limit=None, lookuplines=True,\ncapturelocals=False, compact=False, maxgroupwidth=15,\nmaxgroupdepth=10)\n\nCapture an exception for later rendering.  'limit', 'lookuplines'\nand 'capturelocals' are as for the *note StackSummary: ce8. class.\n\nIf 'compact' is true, only data that is required by\n'TracebackException''s *note format(): 3eb. method is saved in the\nclass attributes.  In particular, the *note context: 40cc.\nfield is calculated only if *note cause: 40cd. is 'None' and\n*note suppresscontext: 40ce. is false.\n\nNote that when locals are captured, they are also shown in the\ntraceback.\n\n'maxgroupwidth' and 'maxgroupdepth' control the formatting of\nexception groups (see *note BaseExceptionGroup: 377.).  The depth\nrefers to the nesting level of the group, and the width refers to\nthe size of a single exception group's exceptions array.  The\nformatted output is truncated when either limit is exceeded.\n\nChanged in version 3.10: Added the 'compact' parameter.\n\nChanged in version 3.11: Added the 'maxgroupwidth' and\n'maxgroupdepth' parameters.\n\n-- Attribute: cause\n\nA 'TracebackException' of the original *note cause: 113e.\n\n-- Attribute: context\n\nA 'TracebackException' of the original *note context:\n113d.\n\n-- Attribute: exceptions\n\nIf 'self' represents an *note ExceptionGroup: 17b, this field\nholds a list of 'TracebackException' instances representing\nthe nested exceptions.  Otherwise it is 'None'.\n\nNew in version 3.11.\n\n-- Attribute: suppresscontext\n\nThe *note suppresscontext: 1dbe. value from the original\nexception.\n\n-- Attribute: notes\n\nThe *note notes: 1f92. value from the original exception,\nor 'None' if the exception does not have any notes.  If it is\nnot 'None' is it formatted in the traceback after the\nexception string.\n\nNew in version 3.11.\n\n-- Attribute: stack\n\nA *note StackSummary: ce8. representing the traceback.\n\n-- Attribute: exctype\n\nThe class of the original traceback.\n\n-- Attribute: filename\n\nFor syntax errors - the file name where the error occurred.\n\n-- Attribute: lineno\n\nFor syntax errors - the line number where the error occurred.\n\n-- Attribute: endlineno\n\nFor syntax errors - the end line number where the error\noccurred.  Can be 'None' if not present.\n\nNew in version 3.10.\n\n-- Attribute: text\n\nFor syntax errors - the text where the error occurred.\n\n-- Attribute: offset\n\nFor syntax errors - the offset into the text where the error\noccurred.\n\n-- Attribute: endoffset\n\nFor syntax errors - the end offset into the text where the\nerror occurred.  Can be 'None' if not present.\n\nNew in version 3.10.\n\n-- Attribute: msg\n\nFor syntax errors - the compiler error message.\n\n-- Method: classmethod fromexception (exc, *, limit=None,\nlookuplines=True, capturelocals=False)\n\nCapture an exception for later rendering.  'limit',\n'lookuplines' and 'capturelocals' are as for the *note\nStackSummary: ce8. class.\n\nNote that when locals are captured, they are also shown in the\ntraceback.\n\n-- Method: print (*, file=None, chain=True)\n\nPrint to 'file' (default 'sys.stderr') the exception\ninformation returned by *note format(): 3eb.\n\nNew in version 3.11.\n\n-- Method: format (*, chain=True)\n\nFormat the exception.\n\nIf 'chain' is not 'True', *note cause: 40cd. and *note\ncontext: 40cc. will not be formatted.\n\nThe return value is a generator of strings, each ending in a\nnewline and some containing internal newlines.  *note\nprintexception(): 645. is a wrapper around this method which\njust prints the lines to a file.\n\n-- Method: formatexceptiononly ()\n\nFormat the exception part of the traceback.\n\nThe return value is a generator of strings, each ending in a\nnewline.\n\nThe generator emits the exception's message followed by its\nnotes (if it has any).  The exception message is normally a\nsingle string; however, for *note SyntaxError: 146.\nexceptions, it consists of several lines that (when printed)\ndisplay detailed information about where the syntax error\noccurred.\n\nChanged in version 3.11: The exception's *note notes: 1f92.\nare now included in the output.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: StackSummary Objects,  Next: FrameSummary Objects,  Prev: TracebackException Objects,  Up: traceback -- Print or retrieve a stack traceback": {
            "content": "5.29.11.2 'StackSummary' Objects\n................................\n\nNew in version 3.5.\n\n'StackSummary' objects represent a call stack ready for formatting.\n\n-- Class: traceback.StackSummary\n\n-- Method: classmethod extract (framegen, *, limit=None,\nlookuplines=True, capturelocals=False)\n\nConstruct a 'StackSummary' object from a frame generator (such\nas is returned by *note walkstack(): ce6. or *note walktb():\nce7.).\n\nIf 'limit' is supplied, only this many frames are taken from\n'framegen'.  If 'lookuplines' is 'False', the returned *note\nFrameSummary: ce9. objects will not have read their lines in\nyet, making the cost of creating the 'StackSummary' cheaper\n(which may be valuable if it may not actually get formatted).\nIf 'capturelocals' is 'True' the local variables in each\n'FrameSummary' are captured as object representations.\n\nChanged in version 3.12: Exceptions raised from *note repr():\n5f0. on a local variable (when 'capturelocals' is 'True') are\nno longer propagated to the caller.\n\n-- Method: classmethod fromlist (alist)\n\nConstruct a 'StackSummary' object from a supplied list of\n*note FrameSummary: ce9. objects or old-style list of tuples.\nEach tuple should be a 4-tuple with 'filename', 'lineno',\n'name', 'line' as the elements.\n\n-- Method: format ()\n\nReturns a list of strings ready for printing.  Each string in\nthe resulting list corresponds to a single *note frame: 4af.\nfrom the stack.  Each string ends in a newline; the strings\nmay contain internal newlines as well, for those items with\nsource text lines.\n\nFor long sequences of the same frame and line, the first few\nrepetitions are shown, followed by a summary line stating the\nexact number of further repetitions.\n\nChanged in version 3.6: Long sequences of repeated frames are\nnow abbreviated.\n\n-- Method: formatframesummary (framesummary)\n\nReturns a string for printing one of the *note frames: 4af.\ninvolved in the stack.  This method is called for each *note\nFrameSummary: ce9. object to be printed by *note\nStackSummary.format(): 40df.  If it returns 'None', the frame\nis omitted from the output.\n\nNew in version 3.11.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: FrameSummary Objects,  Next: Traceback Examples,  Prev: StackSummary Objects,  Up: traceback -- Print or retrieve a stack traceback": {
            "content": "5.29.11.3 'FrameSummary' Objects\n................................\n\nNew in version 3.5.\n\nA 'FrameSummary' object represents a single *note frame: 4af. in a *note\ntraceback: 92b.\n\n-- Class: traceback.FrameSummary (filename, lineno, name,\nlookupline=True, locals=None, line=None)\n\nRepresents a single *note frame: 4af. in the *note traceback: 92b.\nor stack that is being formatted or printed.  It may optionally\nhave a stringified version of the frame's locals included in it.\nIf 'lookupline' is 'False', the source code is not looked up until\nthe 'FrameSummary' has the *note line: 40c5. attribute accessed\n(which also happens when casting it to a *note tuple: 4b8.).  *note\nline: 40c5. may be directly provided, and will prevent line lookups\nhappening at all.  'locals' is an optional local variable\ndictionary, and if supplied the variable representations are stored\nin the summary for later display.\n\n'FrameSummary' instances have the following attributes:\n\n-- Attribute: filename\n\nThe filename of the source code for this frame.  Equivalent to\naccessing *note f.fcode.cofilename: 11e1. on a *note frame\nobject: 4af. 'f'.\n\n-- Attribute: lineno\n\nThe line number of the source code for this frame.\n\n-- Attribute: name\n\nEquivalent to accessing *note f.fcode.coname: 1c3c. on a\n*note frame object: 4af. 'f'.\n\n-- Attribute: line\n\nA string representing the source code for this frame, with\nleading and trailing whitespace stripped.  If the source is\nnot available, it is 'None'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Traceback Examples,  Prev: FrameSummary Objects,  Up: traceback -- Print or retrieve a stack traceback": {
            "content": "5.29.11.4 Traceback Examples\n............................\n",
            "subsections": []
        },
        "This simple example implements a basic read-eval-print loop, similar to": {
            "content": "(but less useful than) the standard Python interactive interpreter loop.",
            "subsections": []
        },
        "For a more complete implementation of the interpreter loop, refer to the": {
            "content": "*note code: 18. module.\n\nimport sys, traceback\n\ndef runusercode(envdir):\nsource = input(\">>> \")\ntry:\nexec(source, envdir)\nexcept Exception:\nprint(\"Exception in user code:\")\nprint(\"-\"*60)\ntraceback.printexc(file=sys.stdout)\nprint(\"-\"*60)\n\nenvdir = {}\nwhile True:\nrunusercode(envdir)\n",
            "subsections": []
        },
        "The following example demonstrates the different ways to print and": {
            "content": "format the exception and traceback:\n\nimport sys, traceback\n\ndef lumberjack():\nbrightsideoflife()\n\ndef brightsideoflife():\nreturn tuple()[0]\n\ntry:\nlumberjack()\nexcept IndexError:\nexc = sys.exception()\nprint(\"* printtb:\")\ntraceback.printtb(exc.traceback, limit=1, file=sys.stdout)\nprint(\"* printexception:\")\ntraceback.printexception(exc, limit=2, file=sys.stdout)\nprint(\"* printexc:\")\ntraceback.printexc(limit=2, file=sys.stdout)\nprint(\"* formatexc, first and last line:\")\nformattedlines = traceback.formatexc().splitlines()\nprint(formattedlines[0])\nprint(formattedlines[-1])\nprint(\"* formatexception:\")\nprint(repr(traceback.formatexception(exc)))\nprint(\"* extracttb:\")\nprint(repr(traceback.extracttb(exc.traceback)))\nprint(\"* formattb:\")\nprint(repr(traceback.formattb(exc.traceback)))\nprint(\"* tblineno:\", exc.traceback.tblineno)\n\nThe output for the example would look similar to this:\n\n* printtb:\nFile \"<doctest...>\", line 10, in <module>\nlumberjack()\n* printexception:\nTraceback (most recent call last):\nFile \"<doctest...>\", line 10, in <module>\nlumberjack()\nFile \"<doctest...>\", line 4, in lumberjack\nbrightsideoflife()\nIndexError: tuple index out of range\n* printexc:\nTraceback (most recent call last):\nFile \"<doctest...>\", line 10, in <module>\nlumberjack()\nFile \"<doctest...>\", line 4, in lumberjack\nbrightsideoflife()\nIndexError: tuple index out of range\n* formatexc, first and last line:\nTraceback (most recent call last):\nIndexError: tuple index out of range\n* formatexception:\n['Traceback (most recent call last):\\n',\n'  File \"<doctest default[0]>\", line 10, in <module>\\n    lumberjack()\\n',\n'  File \"<doctest default[0]>\", line 4, in lumberjack\\n    brightsideoflife()\\n',\n'  File \"<doctest default[0]>\", line 7, in brightsideoflife\\n    return tuple()[0]\\n           ~~~~~~~^^^\\n',\n'IndexError: tuple index out of range\\n']\n* extracttb:\n[<FrameSummary file <doctest...>, line 10 in <module>>,\n<FrameSummary file <doctest...>, line 4 in lumberjack>,\n<FrameSummary file <doctest...>, line 7 in brightsideoflife>]\n* formattb:\n['  File \"<doctest default[0]>\", line 10, in <module>\\n    lumberjack()\\n',\n'  File \"<doctest default[0]>\", line 4, in lumberjack\\n    brightsideoflife()\\n',\n'  File \"<doctest default[0]>\", line 7, in brightsideoflife\\n    return tuple()[0]\\n           ~~~~~~~^^^\\n']\n* tblineno: 10\n",
            "subsections": []
        },
        "The following example shows the different ways to print and format the": {
            "content": "stack:\n\n>>> import traceback\n>>> def anotherfunction():\n...     lumberstack()\n...\n>>> def lumberstack():\n...     traceback.printstack()\n...     print(repr(traceback.extractstack()))\n...     print(repr(traceback.formatstack()))\n...\n>>> anotherfunction()\nFile \"<doctest>\", line 10, in <module>\nanotherfunction()\nFile \"<doctest>\", line 3, in anotherfunction\nlumberstack()\nFile \"<doctest>\", line 6, in lumberstack\ntraceback.printstack()\n[('<doctest>', 10, '<module>', 'anotherfunction()'),\n('<doctest>', 3, 'anotherfunction', 'lumberstack()'),\n('<doctest>', 7, 'lumberstack', 'print(repr(traceback.extractstack()))')]\n['  File \"<doctest>\", line 10, in <module>\\n    anotherfunction()\\n',\n'  File \"<doctest>\", line 3, in anotherfunction\\n    lumberstack()\\n',\n'  File \"<doctest>\", line 8, in lumberstack\\n    print(repr(traceback.formatstack()))\\n']\n\nThis last example demonstrates the final few formatting functions:\n\n>>> import traceback\n>>> traceback.formatlist([('spam.py', 3, '<module>', 'spam.eggs()'),\n...                        ('eggs.py', 42, 'eggs', 'return \"bacon\"')])\n['  File \"spam.py\", line 3, in <module>\\n    spam.eggs()\\n',\n'  File \"eggs.py\", line 42, in eggs\\n    return \"bacon\"\\n']\n>>> anerror = IndexError('tuple index out of range')\n>>> traceback.formatexceptiononly(type(anerror), anerror)\n['IndexError: tuple index out of range\\n']\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: future -- Future statement definitions,  Next: gc -- Garbage Collector interface,  Prev: traceback -- Print or retrieve a stack traceback,  Up: Python Runtime Services": {
            "content": "'Source code:' Lib/future.py(1)\n\n\n\nImports of the form 'from future import feature' are called *note\nfuture statements: 390.  These are special-cased by the Python compiler\nto allow the use of new Python features in modules containing the future\nstatement before the release in which the feature becomes standard.\n",
            "subsections": []
        },
        "While these future statements are given additional special meaning by": {
            "content": "the Python compiler, they are still executed like any other import\nstatement and the *note future: 0. exists and is handled by the\nimport system the same way any other Python module would be.  This\ndesign serves three purposes:\n\n* To avoid confusing existing tools that analyze import statements\nand expect to find the modules they're importing.\n\n* To document when incompatible changes were introduced, and when\nthey will be -- or were -- made mandatory.  This is a form of\nexecutable documentation, and can be inspected programmatically via\nimporting *note future: 0. and examining its contents.\n\n* To ensure that *note future statements: 390. run under releases\nprior to Python 2.1 at least yield runtime exceptions (the import\nof *note future: 0. will fail, because there was no module of\nthat name prior to 2.1).\n\n* Menu:\n\n* Module Contents: Module Contents<5>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/future.py\n\nFile: python3.12.info,  Node: Module Contents<5>,  Up: future -- Future statement definitions\n\n5.29.12.1 Module Contents\n.........................\n\nNo feature description will ever be deleted from *note future: 0.",
            "subsections": []
        },
        "Since its introduction in Python 2.1 the following features have found": {
            "content": "their way into the language using this mechanism:\n\nfeature                optional in       mandatory in       effect\n\n--------------------------------------------------------------------------------------------------------------\n\nnestedscopes          2.1.0b1           2.2                PEP 227(1): 'Statically Nested Scopes'\n\n\ngenerators             2.2.0a1           2.3                PEP 255(2): 'Simple Generators'\n\n\ndivision               2.2.0a2           3.0                PEP 238(3): 'Changing the Division Operator'\n\n\nabsoluteimport        2.5.0a1           3.0                PEP 328(4): 'Imports: Multi-Line and\nAbsolute/Relative'\n\n\nwithstatement         2.5.0a1           2.6                PEP 343(5): 'The \"with\" Statement'\n\n\nprintfunction         2.6.0a2           3.0                PEP 3105(6): 'Make print a function'\n\n\nunicodeliterals       2.6.0a2           3.0                PEP 3112(7): 'Bytes literals in Python 3000'\n\n\ngeneratorstop         3.5.0b1           3.7                PEP 479(8): 'StopIteration handling inside\ngenerators'\n\n\nannotations            3.7.0b1           TBD (9)            PEP 563(10): 'Postponed evaluation of\nannotations'\n\n\n-- Class: future.Feature\n\nEach statement in 'future.py' is of the form:\n\nFeatureName = Feature(OptionalRelease, MandatoryRelease,\nCompilerFlag)\n\nwhere, normally, 'OptionalRelease' is less than 'MandatoryRelease',\nand both are 5-tuples of the same form as *note sys.versioninfo:\n46c.:\n\n(PYMAJORVERSION, # the 2 in 2.1.0a3; an int\nPYMINORVERSION, # the 1; an int\nPYMICROVERSION, # the 0; an int\nPYRELEASELEVEL, # \"alpha\", \"beta\", \"candidate\" or \"final\"; string\nPYRELEASESERIAL # the 3; an int\n)\n\n-- Method: Feature.getOptionalRelease ()\n\n'OptionalRelease' records the first release in which the feature\nwas accepted.\n\n-- Method: Feature.getMandatoryRelease ()\n\nIn the case of a 'MandatoryRelease' that has not yet occurred,\n'MandatoryRelease' predicts the release in which the feature will\nbecome part of the language.\n\nElse 'MandatoryRelease' records when the feature became part of the\nlanguage; in releases at or after that, modules no longer need a\nfuture statement to use the feature in question, but may continue\nto use such imports.\n\n'MandatoryRelease' may also be 'None', meaning that a planned\nfeature got dropped or that it is not yet decided.\n\n-- Attribute: Feature.compilerflag\n\n'CompilerFlag' is the (bitfield) flag that should be passed in the\nfourth argument to the built-in function *note compile(): 528. to\nenable the feature in dynamically compiled code.  This flag is\nstored in the *note Feature.compilerflag: 1e6e. attribute on\n*note Feature: 1e6f. instances.\n\nSee also\n........\n\n*note Future statements: 390.\n\nHow the compiler treats future imports.\n\nPEP 236(11) - Back to the future\n\nThe original proposal for the future mechanism.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0227/\n\n(2) https://peps.python.org/pep-0255/\n\n(3) https://peps.python.org/pep-0238/\n\n(4) https://peps.python.org/pep-0328/\n\n(5) https://peps.python.org/pep-0343/\n\n(6) https://peps.python.org/pep-3105/\n\n(7) https://peps.python.org/pep-3112/\n\n(8) https://peps.python.org/pep-0479/\n\n(9) 'from future import annotations' was previously scheduled to\nbecome mandatory in Python 3.10, but the Python Steering Council twice\ndecided to delay the change (announcement for Python 3.10\n(https://mail.python.org/archives/list/python-dev@python.org/message/CLVXXPQ2T2LQ5MP2Y53VVQFCXYWQJHKZ/);\nannouncement for Python 3.11\n(https://mail.python.org/archives/list/python-dev@python.org/message/VIZEBX5EYMSYIJNDBF6DMUMZOCWHARSO/)).",
            "subsections": []
        },
        "No final decision has been made yet.  See also PEP 563": {
            "content": "(https://peps.python.org/pep-0563/) and PEP 649\n(https://peps.python.org/pep-0649/).\n\n(10) https://peps.python.org/pep-0563/\n\n(11) https://peps.python.org/pep-0236/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: gc -- Garbage Collector interface,  Next: inspect -- Inspect live objects,  Prev: future -- Future statement definitions,  Up: Python Runtime Services": {
            "content": "",
            "subsections": []
        },
        "This module provides an interface to the optional garbage collector.  It": {
            "content": "provides the ability to disable the collector, tune the collection\nfrequency, and set debugging options.  It also provides access to\nunreachable objects that the collector found but cannot free.  Since the\ncollector supplements the reference counting already used in Python, you\ncan disable the collector if you are sure your program does not create\nreference cycles.  Automatic collection can be disabled by calling\n'gc.disable()'.  To debug a leaking program call\n'gc.setdebug(gc.DEBUGLEAK)'.  Notice that this includes\n'gc.DEBUGSAVEALL', causing garbage-collected objects to be saved in\ngc.garbage for inspection.\n\nThe *note gc: 5b. module provides the following functions:\n\n-- Function: gc.enable ()\n\nEnable automatic garbage collection.\n\n-- Function: gc.disable ()\n\nDisable automatic garbage collection.\n\n-- Function: gc.isenabled ()\n\nReturn 'True' if automatic collection is enabled.\n\n-- Function: gc.collect (generation=2)\n\nWith no arguments, run a full collection.  The optional argument\n'generation' may be an integer specifying which generation to\ncollect (from 0 to 2).  A *note ValueError: 183. is raised if the\ngeneration number is invalid.  The number of unreachable objects\nfound is returned.\n\nThe free lists maintained for a number of built-in types are\ncleared whenever a full collection or collection of the highest\ngeneration (2) is run.  Not all items in some free lists may be\nfreed due to the particular implementation, in particular *note\nfloat: 4b7.\n\nThe effect of calling 'gc.collect()' while the interpreter is\nalready performing a collection is undefined.\n\n-- Function: gc.setdebug (flags)\n\nSet the garbage collection debugging flags.  Debugging information\nwill be written to 'sys.stderr'.  See below for a list of debugging\nflags which can be combined using bit operations to control\ndebugging.\n\n-- Function: gc.getdebug ()\n\nReturn the debugging flags currently set.\n\n-- Function: gc.getobjects (generation=None)\n\nReturns a list of all objects tracked by the collector, excluding\nthe list returned.  If 'generation' is not None, return only the\nobjects tracked by the collector that are in that generation.\n\nChanged in version 3.8: New 'generation' parameter.\n\nRaises an *note auditing event: 161d. 'gc.getobjects' with\nargument 'generation'.\n\n-- Function: gc.getstats ()\n\nReturn a list of three per-generation dictionaries containing\ncollection statistics since interpreter start.  The number of keys\nmay change in the future, but currently each dictionary will\ncontain the following items:\n\n* 'collections' is the number of times this generation was\ncollected;\n\n* 'collected' is the total number of objects collected inside\nthis generation;\n\n* 'uncollectable' is the total number of objects which were\nfound to be uncollectable (and were therefore moved to the\n*note garbage: 1035. list) inside this generation.\n\nNew in version 3.4.\n\n-- Function: gc.setthreshold (threshold0[, threshold1[, threshold2]])\n\nSet the garbage collection thresholds (the collection frequency).\nSetting 'threshold0' to zero disables collection.\n\nThe GC classifies objects into three generations depending on how\nmany collection sweeps they have survived.  New objects are placed\nin the youngest generation (generation '0').  If an object survives\na collection it is moved into the next older generation.  Since\ngeneration '2' is the oldest generation, objects in that generation\nremain there after a collection.  In order to decide when to run,\nthe collector keeps track of the number object allocations and\ndeallocations since the last collection.  When the number of\nallocations minus the number of deallocations exceeds 'threshold0',\ncollection starts.  Initially only generation '0' is examined.  If\ngeneration '0' has been examined more than 'threshold1' times since\ngeneration '1' has been examined, then generation '1' is examined\nas well.  With the third generation, things are a bit more\ncomplicated, see Collecting the oldest generation(1) for more\ninformation.\n\n-- Function: gc.getcount ()\n\nReturn the current collection counts as a tuple of '(count0,\ncount1, count2)'.\n\n-- Function: gc.getthreshold ()\n\nReturn the current collection thresholds as a tuple of\n'(threshold0, threshold1, threshold2)'.\n\n-- Function: gc.getreferrers (*objs)\n\nReturn the list of objects that directly refer to any of objs.\nThis function will only locate those containers which support\ngarbage collection; extension types which do refer to other objects\nbut do not support garbage collection will not be found.\n\nNote that objects which have already been dereferenced, but which\nlive in cycles and have not yet been collected by the garbage\ncollector can be listed among the resulting referrers.  To get only\ncurrently live objects, call *note collect(): 865. before calling\n*note getreferrers(): 5f7.\n\nWarning: Care must be taken when using objects returned by\n*note getreferrers(): 5f7. because some of them could still\nbe under construction and hence in a temporarily invalid\nstate.  Avoid using *note getreferrers(): 5f7. for any\npurpose other than debugging.\n\nRaises an *note auditing event: 161d. 'gc.getreferrers' with\nargument 'objs'.\n\n-- Function: gc.getreferents (*objs)\n\nReturn a list of objects directly referred to by any of the\narguments.  The referents returned are those objects visited by the\narguments' C-level *note tptraverse: 569. methods (if any), and\nmay not be all objects actually directly reachable.  *note\ntptraverse: 569. methods are supported only by objects that\nsupport garbage collection, and are only required to visit objects\nthat may be involved in a cycle.  So, for example, if an integer is\ndirectly reachable from an argument, that integer object may or may\nnot appear in the result list.\n\nRaises an *note auditing event: 161d. 'gc.getreferents' with\nargument 'objs'.\n\n-- Function: gc.istracked (obj)\n\nReturns 'True' if the object is currently tracked by the garbage\ncollector, 'False' otherwise.  As a general rule, instances of\natomic types aren't tracked and instances of non-atomic types\n(containers, user-defined objects...) are.  However, some\ntype-specific optimizations can be present in order to suppress the\ngarbage collector footprint of simple instances (e.g.  dicts\ncontaining only atomic keys and values):\n\n>>> gc.istracked(0)\nFalse\n>>> gc.istracked(\"a\")\nFalse\n>>> gc.istracked([])\nTrue\n>>> gc.istracked({})\nFalse\n>>> gc.istracked({\"a\": 1})\nFalse\n>>> gc.istracked({\"a\": []})\nTrue\n\nNew in version 3.1.\n\n-- Function: gc.isfinalized (obj)\n\nReturns 'True' if the given object has been finalized by the\ngarbage collector, 'False' otherwise.\n\n>>> x = None\n>>> class Lazarus:\n...     def del(self):\n...         global x\n...         x = self\n...\n>>> lazarus = Lazarus()\n>>> gc.isfinalized(lazarus)\nFalse\n>>> del lazarus\n>>> gc.isfinalized(x)\nTrue\n\nNew in version 3.9.\n\n-- Function: gc.freeze ()\n\nFreeze all the objects tracked by the garbage collector; move them\nto a permanent generation and ignore them in all the future\ncollections.\n\nIf a process will 'fork()' without 'exec()', avoiding unnecessary\ncopy-on-write in child processes will maximize memory sharing and\nreduce overall memory usage.  This requires both avoiding creation\nof freed \"holes\" in memory pages in the parent process and ensuring\nthat GC collections in child processes won't touch the 'gcrefs'\ncounter of long-lived objects originating in the parent process.\nTo accomplish both, call 'gc.disable()' early in the parent\nprocess, 'gc.freeze()' right before 'fork()', and 'gc.enable()'\nearly in child processes.\n\nNew in version 3.7.\n\n-- Function: gc.unfreeze ()\n\nUnfreeze the objects in the permanent generation, put them back\ninto the oldest generation.\n\nNew in version 3.7.\n\n-- Function: gc.getfreezecount ()\n\nReturn the number of objects in the permanent generation.\n\nNew in version 3.7.\n",
            "subsections": []
        },
        "The following variables are provided for read-only access (you can": {
            "content": "mutate the values but should not rebind them):\n\n-- Data: gc.garbage\n\nA list of objects which the collector found to be unreachable but\ncould not be freed (uncollectable objects).  Starting with Python\n3.4, this list should be empty most of the time, except when using\ninstances of C extension types with a non-'NULL' 'tpdel' slot.\n\nIf *note DEBUGSAVEALL: 40f3. is set, then all unreachable objects\nwill be added to this list rather than freed.\n\nChanged in version 3.2: If this list is non-empty at *note\ninterpreter shutdown: cd8, a *note ResourceWarning: a86. is\nemitted, which is silent by default.  If *note DEBUGUNCOLLECTABLE:\n1036. is set, in addition all uncollectable objects are printed.\n\nChanged in version 3.4: Following PEP 442(2), objects with a *note\ndel(): 1c66. method don't end up in *note gc.garbage: 1035.\nanymore.\n\n-- Data: gc.callbacks\n\nA list of callbacks that will be invoked by the garbage collector\nbefore and after collection.  The callbacks will be called with two\narguments, 'phase' and 'info'.\n\n'phase' can be one of two values:\n\n\"start\": The garbage collection is about to start.\n\n\"stop\": The garbage collection has finished.\n\n'info' is a dict providing more information for the callback.  The\nfollowing keys are currently defined:\n\n\"generation\": The oldest generation being collected.\n\n\"collected\": When 'phase' is \"stop\", the number of objects\nsuccessfully collected.\n\n\"uncollectable\": When 'phase' is \"stop\", the number of objects\nthat could not be collected and were put in *note garbage:\n1035.\n\nApplications can add their own callbacks to this list.  The primary\nuse cases are:\n\nGathering statistics about garbage collection, such as how\noften various generations are collected, and how long the\ncollection takes.\n\nAllowing applications to identify and clear their own\nuncollectable types when they appear in *note garbage: 1035.\n\nNew in version 3.3.\n\nThe following constants are provided for use with *note setdebug():\n40ee.:\n\n-- Data: gc.DEBUGSTATS\n\nPrint statistics during collection.  This information can be useful\nwhen tuning the collection frequency.\n\n-- Data: gc.DEBUGCOLLECTABLE\n\nPrint information on collectable objects found.\n\n-- Data: gc.DEBUGUNCOLLECTABLE\n\nPrint information of uncollectable objects found (objects which are\nnot reachable but cannot be freed by the collector).  These objects\nwill be added to the 'garbage' list.\n\nChanged in version 3.2: Also print the contents of the *note\ngarbage: 1035. list at *note interpreter shutdown: cd8, if it isn't\nempty.\n\n-- Data: gc.DEBUGSAVEALL\n\nWhen set, all unreachable objects found will be appended to\n'garbage' rather than being freed.  This can be useful for\ndebugging a leaking program.\n\n-- Data: gc.DEBUGLEAK\n\nThe debugging flags necessary for the collector to print\ninformation about a leaking program (equal to 'DEBUGCOLLECTABLE |\nDEBUGUNCOLLECTABLE | DEBUGSAVEALL').\n\n---------- Footnotes ----------\n\n(1)\nhttps://devguide.python.org/garbagecollector/#collecting-the-oldest-generation\n\n(2) https://peps.python.org/pep-0442/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: inspect -- Inspect live objects,  Next: site -- Site-specific configuration hook,  Prev: gc -- Garbage Collector interface,  Up: Python Runtime Services": {
            "content": "'Source code:' Lib/inspect.py(1)\n\n\n\nThe *note inspect: 78. module provides several useful functions to help\nget information about live objects such as modules, classes, methods,\nfunctions, tracebacks, frame objects, and code objects.  For example, it\ncan help you examine the contents of a class, retrieve the source code\nof a method, extract and format the argument list for a function, or get\nall the information you need to display a detailed traceback.\n",
            "subsections": []
        },
        "There are four main kinds of services provided by this module: type": {
            "content": "checking, getting source code, inspecting classes and functions, and\nexamining the interpreter stack.\n\n* Menu:\n\n* Types and members::\n* Retrieving source code::\n* Introspecting callables with the Signature object::\n* Classes and functions: Classes and functions<2>.\n* The interpreter stack::\n* Fetching attributes statically::\n* Current State of Generators, Coroutines, and Asynchronous Generators: Current State of Generators Coroutines and Asynchronous Generators.\n* Code Objects Bit Flags::\n* Buffer flags::\n* Command Line Interface: Command Line Interface<3>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/inspect.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Types and members,  Next: Retrieving source code,  Up: inspect -- Inspect live objects": {
            "content": "5.29.14.1 Types and members\n...........................\n\nThe *note getmembers(): 15b7. function retrieves the members of an\nobject such as a class or module.  The functions whose names begin with\n\"is\" are mainly provided as convenient choices for the second argument\nto *note getmembers(): 15b7.  They also help you determine when you can\nexpect to find the following special attributes (see *note\nImport-related module attributes: 1d03. for module attributes):\n",
            "subsections": []
        },
        "Type            Attribute               Description": {
            "content": "------------------------------------------------------------------------\n\nclass           doc                 documentation string\n\n\nname                name with which this class\nwas defined\n\n\nqualname            qualified name\n\n\nmodule              name of module in which this\nclass was defined\n\n\ntypeparams         A tuple containing the\n*note type parameters: 166.\nof a generic class\n\n\nmethod          doc                 documentation string\n\n\nname                name with which this method\nwas defined\n\n\nqualname            qualified name\n\n\nfunc                function object containing\nimplementation of method\n\n\nself                instance to which this method\nis bound, or 'None'\n\n\nmodule              name of module in which this\nmethod was defined\n\n\nfunction        doc                 documentation string\n\n\nname                name with which this function\nwas defined\n\n\nqualname            qualified name\n\n\ncode                code object containing\ncompiled function\n*note bytecode: 370.\n\n\ndefaults            tuple of any default values\nfor positional or keyword\nparameters\n\n\nkwdefaults          mapping of any default values\nfor keyword-only parameters\n\n\nglobals             global namespace in which\nthis function was defined\n\n\nbuiltins            builtins namespace\n\n\nannotations         mapping of parameters names\nto annotations; '\"return\"'\nkey is reserved for return\nannotations.\n\n\ntypeparams         A tuple containing the\n*note type parameters: 166.\nof a generic function\n\n\nmodule              name of module in which this\nfunction was defined\n\n\ntraceback       tbframe                frame object at this level\n\n\ntblasti                index of last attempted\ninstruction in bytecode\n\n\ntblineno               current line number in Python\nsource code\n\n\ntbnext                 next inner traceback object\n(called by this level)\n\n\nframe           fback                  next outer frame object (this\nframe's caller)\n\n\nfbuiltins              builtins namespace seen by\nthis frame\n\n\nfcode                  code object being executed in\nthis frame\n\n\nfglobals               global namespace seen by this\nframe\n\n\nflasti                 index of last attempted\ninstruction in bytecode\n\n\nflineno                current line number in Python\nsource code\n\n\nflocals                local namespace seen by this\nframe\n\n\nftrace                 tracing function for this\nframe, or 'None'\n\n\ncode            coargcount             number of arguments (not\nincluding keyword only\narguments, * or  args)\n\n\ncocode                 string of raw compiled\nbytecode\n\n\ncocellvars             tuple of names of cell\nvariables (referenced by\ncontaining scopes)\n\n\ncoconsts               tuple of constants used in\nthe bytecode\n\n\ncofilename             name of file in which this\ncode object was created\n\n\ncofirstlineno          number of first line in\nPython source code\n\n\ncoflags                bitmap of 'CO*' flags, read\nmore *note here: 1c4b.\n\n\ncolnotab               encoded mapping of line\nnumbers to bytecode indices\n\n\ncofreevars             tuple of names of free\nvariables (referenced via a\nfunction's closure)\n\n\ncoposonlyargcount      number of positional only\narguments\n\n\ncokwonlyargcount       number of keyword only\narguments (not including\narg)\n\n\nconame                 name with which this code\nobject was defined\n\n\ncoqualname             fully qualified name with\nwhich this code object was\ndefined\n\n\nconames                tuple of names other than\narguments and function locals\n\n\nconlocals              number of local variables\n\n\ncostacksize            virtual machine stack space\nrequired\n\n\ncovarnames             tuple of names of arguments\nand local variables\n\n\ngenerator       name                name\n\n\nqualname            qualified name\n\n\ngiframe                frame\n\n\ngirunning              is the generator running?\n\n\ngicode                 code\n\n\ngiyieldfrom            object being iterated by\n'yield from', or 'None'\n\n\ncoroutine       name                name\n\n\nqualname            qualified name\n\n\ncrawait                object being awaited on, or\n'None'\n\n\ncrframe                frame\n\n\ncrrunning              is the coroutine running?\n\n\ncrcode                 code\n\n\ncrorigin               where coroutine was created,\nor 'None'.  See\n*note sys.setcoroutineorigintrackingdepth(): 9cf.\n\n\nbuiltin         doc                 documentation string\n\n\nname                original name of this\nfunction or method\n\n\nqualname            qualified name\n\n\nself                instance to which a method is\nbound, or 'None'\n\n",
            "subsections": []
        },
        "Changed in version 3.5: Add 'qualname' and 'giyieldfrom' attributes": {
            "content": "to generators.\n",
            "subsections": []
        },
        "The 'name' attribute of generators is now set from the function": {
            "content": "name, instead of the code name, and it can now be modified.\n\nChanged in version 3.7: Add 'crorigin' attribute to coroutines.\n\nChanged in version 3.10: Add 'builtins' attribute to functions.\n\n-- Function: inspect.getmembers (object[, predicate])\n\nReturn all the members of an object in a list of '(name, value)'\npairs sorted by name.  If the optional 'predicate' argument--which\nwill be called with the 'value' object of each member--is supplied,\nonly members for which the predicate returns a true value are\nincluded.\n\nNote: *note getmembers(): 15b7. will only return class\nattributes defined in the metaclass when the argument is a\nclass and those attributes have been listed in the metaclass'\ncustom *note dir(): 1c6c.\n\n-- Function: inspect.getmembersstatic (object[, predicate])\n\nReturn all the members of an object in a list of '(name, value)'\npairs sorted by name without triggering dynamic lookup via the\ndescriptor protocol, getattr or getattribute.  Optionally,\nonly return members that satisfy a given predicate.\n\nNote: *note getmembersstatic(): 412. may not be able to\nretrieve all members that getmembers can fetch (like\ndynamically created attributes) and may find members that\ngetmembers can't (like descriptors that raise AttributeError).\nIt can also return descriptor objects instead of instance\nmembers in some cases.\n\nNew in version 3.11.\n\n-- Function: inspect.getmodulename (path)\n\nReturn the name of the module named by the file 'path', without\nincluding the names of enclosing packages.  The file extension is\nchecked against all of the entries in *note\nimportlib.machinery.allsuffixes(): 40fa.  If it matches, the final\npath component is returned with the extension removed.  Otherwise,\n'None' is returned.\n\nNote that this function 'only' returns a meaningful name for actual\nPython modules - paths that potentially refer to Python packages\nwill still return 'None'.\n\nChanged in version 3.3: The function is based directly on *note\nimportlib: 71.\n\n-- Function: inspect.ismodule (object)\n\nReturn 'True' if the object is a module.\n\n-- Function: inspect.isclass (object)\n\nReturn 'True' if the object is a class, whether built-in or created\nin Python code.\n\n-- Function: inspect.ismethod (object)\n\nReturn 'True' if the object is a bound method written in Python.\n\n-- Function: inspect.isfunction (object)\n\nReturn 'True' if the object is a Python function, which includes\nfunctions created by a *note lambda: 2435. expression.\n\n-- Function: inspect.isgeneratorfunction (object)\n\nReturn 'True' if the object is a Python generator function.\n\nChanged in version 3.8: Functions wrapped in *note\nfunctools.partial(): d31. now return 'True' if the wrapped function\nis a Python generator function.\n\n-- Function: inspect.isgenerator (object)\n\nReturn 'True' if the object is a generator.\n\n-- Function: inspect.iscoroutinefunction (object)\n\nReturn 'True' if the object is a *note coroutine function: bd1. (a\nfunction defined with an *note async def: 394. syntax), a *note\nfunctools.partial(): d31. wrapping a *note coroutine function: bd1,\nor a sync function marked with *note markcoroutinefunction(): 1ad.\n\nNew in version 3.5.\n\nChanged in version 3.8: Functions wrapped in *note\nfunctools.partial(): d31. now return 'True' if the wrapped function\nis a *note coroutine function: bd1.\n\nChanged in version 3.12: Sync functions marked with *note\nmarkcoroutinefunction(): 1ad. now return 'True'.\n\n-- Function: inspect.markcoroutinefunction (func)\n\nDecorator to mark a callable as a *note coroutine function: bd1. if\nit would not otherwise be detected by *note iscoroutinefunction():\n1af.\n\nThis may be of use for sync functions that return a *note\ncoroutine: 1ae, if the function is passed to an API that requires\n*note iscoroutinefunction(): 1af.\n\nWhen possible, using an *note async def: 394. function is\npreferred.  Also acceptable is calling the function and testing the\nreturn with *note iscoroutine(): c75.\n\nNew in version 3.12.\n\n-- Function: inspect.iscoroutine (object)\n\nReturn 'True' if the object is a *note coroutine: 1ae. created by\nan *note async def: 394. function.\n\nNew in version 3.5.\n\n-- Function: inspect.isawaitable (object)\n\nReturn 'True' if the object can be used in *note await: 516.\nexpression.\n\nCan also be used to distinguish generator-based coroutines from\nregular generators:\n\nimport types\n\ndef gen():\nyield\n@types.coroutine\ndef gencoro():\nyield\n\nassert not isawaitable(gen())\nassert isawaitable(gencoro())\n\nNew in version 3.5.\n\n-- Function: inspect.isasyncgenfunction (object)\n\nReturn 'True' if the object is an *note asynchronous generator:\n1d47. function, for example:\n\n>>> async def agen():\n...     yield 1\n...\n>>> inspect.isasyncgenfunction(agen)\nTrue\n\nNew in version 3.6.\n\nChanged in version 3.8: Functions wrapped in *note\nfunctools.partial(): d31. now return 'True' if the wrapped function\nis a *note asynchronous generator: 1d47. function.\n\n-- Function: inspect.isasyncgen (object)\n\nReturn 'True' if the object is an *note asynchronous generator\niterator: 4014. created by an *note asynchronous generator: 1d47.\nfunction.\n\nNew in version 3.6.\n\n-- Function: inspect.istraceback (object)\n\nReturn 'True' if the object is a traceback.\n\n-- Function: inspect.isframe (object)\n\nReturn 'True' if the object is a frame.\n\n-- Function: inspect.iscode (object)\n\nReturn 'True' if the object is a code.\n\n-- Function: inspect.isbuiltin (object)\n\nReturn 'True' if the object is a built-in function or a bound\nbuilt-in method.\n\n-- Function: inspect.ismethodwrapper (object)\n\nReturn 'True' if the type of object is a *note MethodWrapperType:\n414.\n\nThese are instances of *note MethodWrapperType: 414, such as *note\nstr(): 3e9, *note eq(): 931. and *note repr(): 3e8.\n\nNew in version 3.11.\n\n-- Function: inspect.isroutine (object)\n\nReturn 'True' if the object is a user-defined or built-in function\nor method.\n\n-- Function: inspect.isabstract (object)\n\nReturn 'True' if the object is an abstract base class.\n\n-- Function: inspect.ismethoddescriptor (object)\n\nReturn 'True' if the object is a method descriptor, but not if\n*note ismethod(): 40fd, *note isclass(): 40fc, *note isfunction():\n40fe. or *note isbuiltin(): 4104. are true.\n\nThis, for example, is true of 'int.add'.  An object passing\nthis test has a *note get(): 1518. method but not a *note\nset(): 1c6f. method, but beyond that the set of attributes\nvaries.  A *note name: 1302. attribute is usually sensible, and\n'doc' often is.\n\nMethods implemented via descriptors that also pass one of the other\ntests return 'False' from the *note ismethoddescriptor(): 4106.\ntest, simply because the other tests promise more - you can, e.g.,\ncount on having the *note func: 1171. attribute (etc) when an\nobject passes *note ismethod(): 40fd.\n\n-- Function: inspect.isdatadescriptor (object)\n\nReturn 'True' if the object is a data descriptor.\n\nData descriptors have a *note set: 1c6f. or a *note delete:\n1c70. method.  Examples are properties (defined in Python),\ngetsets, and members.  The latter two are defined in C and there\nare more specific tests available for those types, which is robust\nacross Python implementations.  Typically, data descriptors will\nalso have *note name: 1302. and 'doc' attributes\n(properties, getsets, and members have both of these attributes),\nbut this is not guaranteed.\n\n-- Function: inspect.isgetsetdescriptor (object)\n\nReturn 'True' if the object is a getset descriptor.\n\n'CPython implementation detail:' getsets are attributes defined in\nextension modules via *note PyGetSetDef: 9fc. structures.  For\nPython implementations without such types, this method will always\nreturn 'False'.\n\n-- Function: inspect.ismemberdescriptor (object)\n\nReturn 'True' if the object is a member descriptor.\n\n'CPython implementation detail:' Member descriptors are attributes\ndefined in extension modules via *note PyMemberDef: 2a7.\nstructures.  For Python implementations without such types, this\nmethod will always return 'False'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Retrieving source code,  Next: Introspecting callables with the Signature object,  Prev: Types and members,  Up: inspect -- Inspect live objects": {
            "content": "5.29.14.2 Retrieving source code\n................................\n\n-- Function: inspect.getdoc (object)\n\nGet the documentation string for an object, cleaned up with *note\ncleandoc(): 410c.  If the documentation string for an object is not\nprovided and the object is a class, a method, a property or a\ndescriptor, retrieve the documentation string from the inheritance\nhierarchy.  Return 'None' if the documentation string is invalid or\nmissing.\n\nChanged in version 3.5: Documentation strings are now inherited if\nnot overridden.\n\n-- Function: inspect.getcomments (object)\n\nReturn in a single string any lines of comments immediately\npreceding the object's source code (for a class, function, or\nmethod), or at the top of the Python source file (if the object is\na module).  If the object's source code is unavailable, return\n'None'.  This could happen if the object has been defined in C or\nthe interactive shell.\n\n-- Function: inspect.getfile (object)\n\nReturn the name of the (text or binary) file in which an object was\ndefined.  This will fail with a *note TypeError: 28e. if the object\nis a built-in module, class, or function.\n\n-- Function: inspect.getmodule (object)\n\nTry to guess which module an object was defined in.  Return 'None'\nif the module cannot be determined.\n\n-- Function: inspect.getsourcefile (object)\n\nReturn the name of the Python source file in which an object was\ndefined or 'None' if no way can be identified to get the source.\nThis will fail with a *note TypeError: 28e. if the object is a\nbuilt-in module, class, or function.\n\n-- Function: inspect.getsourcelines (object)\n\nReturn a list of source lines and starting line number for an\nobject.  The argument may be a module, class, method, function,\ntraceback, frame, or code object.  The source code is returned as a\nlist of the lines corresponding to the object and the line number\nindicates where in the original source file the first line of code\nwas found.  An *note OSError: 613. is raised if the source code\ncannot be retrieved.  A *note TypeError: 28e. is raised if the\nobject is a built-in module, class, or function.\n\nChanged in version 3.3: *note OSError: 613. is raised instead of\n*note IOError: ecb, now an alias of the former.\n\n-- Function: inspect.getsource (object)\n\nReturn the text of the source code for an object.  The argument may\nbe a module, class, method, function, traceback, frame, or code\nobject.  The source code is returned as a single string.  An *note\nOSError: 613. is raised if the source code cannot be retrieved.  A\n*note TypeError: 28e. is raised if the object is a built-in module,\nclass, or function.\n\nChanged in version 3.3: *note OSError: 613. is raised instead of\n*note IOError: ecb, now an alias of the former.\n\n-- Function: inspect.cleandoc (doc)\n\nClean up indentation from docstrings that are indented to line up\nwith blocks of code.\n\nAll leading whitespace is removed from the first line.  Any leading\nwhitespace that can be uniformly removed from the second line\nonwards is removed.  Empty lines at the beginning and end are\nsubsequently removed.  Also, all tabs are expanded to spaces.\n\nFile: python3.12.info,  Node: Introspecting callables with the Signature object,  Next: Classes and functions<2>,  Prev: Retrieving source code,  Up: inspect -- Inspect live objects\n\n5.29.14.3 Introspecting callables with the Signature object\n...........................................................\n\nNew in version 3.3.\n\nThe *note Signature: 51e. object represents the call signature of a\ncallable object and its return annotation.  To retrieve a 'Signature'\nobject, use the 'signature()' function.\n\n-- Function: inspect.signature (callable, *, followwrapped=True,\nglobals=None, locals=None, evalstr=False)\n\nReturn a *note Signature: 51e. object for the given 'callable':\n\n>>> from inspect import signature\n>>> def foo(a, *, b:int, kwargs):\n...     pass\n\n>>> sig = signature(foo)\n\n>>> str(sig)\n'(a, *, b: int, kwargs)'\n\n>>> str(sig.parameters['b'])\n'b: int'\n\n>>> sig.parameters['b'].annotation\n<class 'int'>\n\nAccepts a wide range of Python callables, from plain functions and\nclasses to *note functools.partial(): d31. objects.\n\nFor objects defined in modules using stringized annotations ('from\nfuture import annotations'), *note signature(): 51c. will\nattempt to automatically un-stringize the annotations using *note\ngetannotations(): 606.  The 'globals', 'locals', and 'evalstr'\nparameters are passed into *note getannotations(): 606. when\nresolving the annotations; see the documentation for *note\ngetannotations(): 606. for instructions on how to use these\nparameters.\n\nRaises *note ValueError: 183. if no signature can be provided, and\n*note TypeError: 28e. if that type of object is not supported.\nAlso, if the annotations are stringized, and 'evalstr' is not\nfalse, the 'eval()' call(s) to un-stringize the annotations in\n*note getannotations(): 606. could potentially raise any kind of\nexception.\n\nA slash(/) in the signature of a function denotes that the\nparameters prior to it are positional-only.  For more info, see\n*note the FAQ entry on positional-only parameters: 1e7d.\n\nChanged in version 3.5: The 'followwrapped' parameter was added.\nPass 'False' to get a signature of 'callable' specifically\n('callable.wrapped' will not be used to unwrap decorated\ncallables.)\n\nChanged in version 3.10: The 'globals', 'locals', and 'evalstr'\nparameters were added.\n\nNote: Some callables may not be introspectable in certain\nimplementations of Python.  For example, in CPython, some\nbuilt-in functions defined in C provide no metadata about\ntheir arguments.\n\n'CPython implementation detail:' If the passed object has a\n'signature' attribute, we may use it to create the signature.\nThe exact semantics are an implementation detail and are subject to\nunannounced changes.  Consult the source code for current\nsemantics.\n\n-- Class: inspect.Signature (parameters=None, *,\nreturnannotation=Signature.empty)\n\nA 'Signature' object represents the call signature of a function\nand its return annotation.  For each parameter accepted by the\nfunction it stores a *note Parameter: c73. object in its *note\nparameters: 4110. collection.\n\nThe optional 'parameters' argument is a sequence of *note\nParameter: c73. objects, which is validated to check that there are\nno parameters with duplicate names, and that the parameters are in\nthe right order, i.e.  positional-only first, then\npositional-or-keyword, and that parameters with defaults follow\nparameters without defaults.\n\nThe optional 'returnannotation' argument can be an arbitrary\nPython object.  It represents the \"return\" annotation of the\ncallable.\n\n'Signature' objects are 'immutable'.  Use *note\nSignature.replace(): 4111. to make a modified copy.\n\nChanged in version 3.5: 'Signature' objects are now picklable and\n*note hashable: 3db.\n\n-- Attribute: empty\n\nA special class-level marker to specify absence of a return\nannotation.\n\n-- Attribute: parameters\n\nAn ordered mapping of parameters' names to the corresponding\n*note Parameter: c73. objects.  Parameters appear in strict\ndefinition order, including keyword-only parameters.\n\nChanged in version 3.7: Python only explicitly guaranteed that\nit preserved the declaration order of keyword-only parameters\nas of version 3.7, although in practice this order had always\nbeen preserved in Python 3.\n\n-- Attribute: returnannotation\n\nThe \"return\" annotation for the callable.  If the callable has\nno \"return\" annotation, this attribute is set to *note\nSignature.empty: 4112.\n\n-- Method: bind (*args, kwargs)\n\nCreate a mapping from positional and keyword arguments to\nparameters.  Returns *note BoundArguments: ee0. if '*args' and\n'kwargs' match the signature, or raises a *note TypeError:\n28e.\n\n-- Method: bindpartial (*args, kwargs)\n\nWorks the same way as *note Signature.bind(): 1526, but allows\nthe omission of some required arguments (mimics *note\nfunctools.partial(): d31. behavior.)  Returns *note\nBoundArguments: ee0, or raises a *note TypeError: 28e. if the\npassed arguments do not match the signature.\n\n-- Method: replace (*[, parameters][, returnannotation])\n\nCreate a new *note Signature: 51e. instance based on the\ninstance *note replace(): 4111. was invoked on.  It is\npossible to pass different 'parameters' and/or\n'returnannotation' to override the corresponding properties\nof the base signature.  To remove 'returnannotation' from the\ncopied 'Signature', pass in *note Signature.empty: 4112.\n\n>>> def test(a, b):\n...     pass\n...\n>>> sig = signature(test)\n>>> newsig = sig.replace(returnannotation=\"new return anno\")\n>>> str(newsig)\n\"(a, b) -> 'new return anno'\"\n\n-- Method: classmethod fromcallable (obj, *, followwrapped=True,\nglobals=None, locals=None, evalstr=False)\n\nReturn a *note Signature: 51e. (or its subclass) object for a\ngiven callable 'obj'.\n\nThis method simplifies subclassing of *note Signature: 51e.:\n\nclass MySignature(Signature):\npass\nsig = MySignature.fromcallable(sum)\nassert isinstance(sig, MySignature)\n\nIts behavior is otherwise identical to that of *note\nsignature(): 51c.\n\nNew in version 3.5.\n\nChanged in version 3.10: The 'globals', 'locals', and\n'evalstr' parameters were added.\n\n-- Class: inspect.Parameter (name, kind, *, default=Parameter.empty,\nannotation=Parameter.empty)\n\n'Parameter' objects are 'immutable'.  Instead of modifying a\n'Parameter' object, you can use *note Parameter.replace(): 4115. to\ncreate a modified copy.\n\nChanged in version 3.5: Parameter objects are now picklable and\n*note hashable: 3db.\n\n-- Attribute: empty\n\nA special class-level marker to specify absence of default\nvalues and annotations.\n\n-- Attribute: name\n\nThe name of the parameter as a string.  The name must be a\nvalid Python identifier.\n\n'CPython implementation detail:' CPython generates implicit\nparameter names of the form '.0' on the code objects used to\nimplement comprehensions and generator expressions.\n\nChanged in version 3.6: These parameter names are now exposed\nby this module as names like 'implicit0'.\n\n-- Attribute: default\n\nThe default value for the parameter.  If the parameter has no\ndefault value, this attribute is set to *note Parameter.empty:\n4116.\n\n-- Attribute: annotation\n\nThe annotation for the parameter.  If the parameter has no\nannotation, this attribute is set to *note Parameter.empty:\n4116.\n\n-- Attribute: kind\n\nDescribes how argument values are bound to the parameter.  The\npossible values are accessible via *note Parameter: c73. (like\n'Parameter.KEYWORDONLY'), and support comparison and\nordering, in the following order:\n\nName                         Meaning\n\n--------------------------------------------------------------------------------\n\n'POSITIONALONLY'            Value must be supplied as a positional argument.\nPositional only parameters are those which\nappear before a '/' entry (if present) in a\nPython function definition.\n\n\n'POSITIONALORKEYWORD'      Value may be supplied as either a keyword or\npositional argument (this is the standard\nbinding behaviour for functions implemented in\nPython.)\n\n\n'VARPOSITIONAL'             A tuple of positional arguments that aren't\nbound to any other parameter.  This corresponds\nto a '*args' parameter in a Python function\ndefinition.\n\n\n'KEYWORDONLY'               Value must be supplied as a keyword argument.\nKeyword only parameters are those which appear\nafter a '*' or '*args' entry in a Python\nfunction definition.\n\n\n'VARKEYWORD'                A dict of keyword arguments that aren't bound to\nany other parameter.  This corresponds to a\n'kwargs' parameter in a Python function\ndefinition.\n\n\nExample: print all keyword-only arguments without default\nvalues:\n\n>>> def foo(a, b, *, c, d=10):\n...     pass\n\n>>> sig = signature(foo)\n>>> for param in sig.parameters.values():\n...     if (param.kind == param.KEYWORDONLY and\n...                        param.default is param.empty):\n...         print('Parameter:', param)\nParameter: c\n\n-- Attribute: kind.description\n\nDescribes a enum value of *note Parameter.kind: 411a.\n\nNew in version 3.8.\n\nExample: print all descriptions of arguments:\n\n>>> def foo(a, b, *, c, d=10):\n...     pass\n\n>>> sig = signature(foo)\n>>> for param in sig.parameters.values():\n...     print(param.kind.description)\npositional or keyword\npositional or keyword\nkeyword-only\nkeyword-only\n\n-- Method: replace (*[, name][, kind][, default][, annotation])\n\nCreate a new *note Parameter: c73. instance based on the\ninstance replaced was invoked on.  To override a 'Parameter'\nattribute, pass the corresponding argument.  To remove a\ndefault value or/and an annotation from a 'Parameter', pass\n*note Parameter.empty: 4116.\n\n>>> from inspect import Parameter\n>>> param = Parameter('foo', Parameter.KEYWORDONLY, default=42)\n>>> str(param)\n'foo=42'\n\n>>> str(param.replace()) # Will create a shallow copy of 'param'\n'foo=42'\n\n>>> str(param.replace(default=Parameter.empty, annotation='spam'))\n\"foo: 'spam'\"\n\nChanged in version 3.4: In Python 3.3 *note Parameter: c73. objects\nwere allowed to have 'name' set to 'None' if their 'kind' was set\nto 'POSITIONALONLY'.  This is no longer permitted.\n\n-- Class: inspect.BoundArguments\n\nResult of a *note Signature.bind(): 1526. or *note\nSignature.bindpartial(): 4114. call.  Holds the mapping of\narguments to the function's parameters.\n\n-- Attribute: arguments\n\nA mutable mapping of parameters' names to arguments' values.\nContains only explicitly bound arguments.  Changes in *note\narguments: 727. will reflect in *note args: 411c. and *note\nkwargs: 411d.\n\nShould be used in conjunction with *note Signature.parameters:\n4110. for any argument processing purposes.\n\nNote: Arguments for which *note Signature.bind(): 1526.\nor *note Signature.bindpartial(): 4114. relied on a\ndefault value are skipped.  However, if needed, use *note\nBoundArguments.applydefaults(): c74. to add them.\n\nChanged in version 3.9: *note arguments: 727. is now of type\n*note dict: 237.  Formerly, it was of type *note\ncollections.OrderedDict: 39f.\n\n-- Attribute: args\n\nA tuple of positional arguments values.  Dynamically computed\nfrom the *note arguments: 727. attribute.\n\n-- Attribute: kwargs\n\nA dict of keyword arguments values.  Dynamically computed from\nthe *note arguments: 727. attribute.\n\n-- Attribute: signature\n\nA reference to the parent *note Signature: 51e. object.\n\n-- Method: applydefaults ()\n\nSet default values for missing arguments.\n\nFor variable-positional arguments ('*args') the default is an\nempty tuple.\n\nFor variable-keyword arguments ('kwargs') the default is an\nempty dict.\n\n>>> def foo(a, b='ham', *args): pass\n>>> ba = inspect.signature(foo).bind('spam')\n>>> ba.applydefaults()\n>>> ba.arguments\n{'a': 'spam', 'b': 'ham', 'args': ()}\n\nNew in version 3.5.\n\nThe *note args: 411c. and *note kwargs: 411d. properties can be\nused to invoke functions:\n\ndef test(a, *, b):\n...\n\nsig = signature(test)\nba = sig.bind(10, b=20)\ntest(*ba.args, ba.kwargs)\n\nSee also\n........\n\nPEP 362(1) - Function Signature Object.\n\nThe detailed specification, implementation details and examples.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0362/\n\nFile: python3.12.info,  Node: Classes and functions<2>,  Next: The interpreter stack,  Prev: Introspecting callables with the Signature object,  Up: inspect -- Inspect live objects\n\n5.29.14.4 Classes and functions\n...............................\n\n-- Function: inspect.getclasstree (classes, unique=False)\n\nArrange the given list of classes into a hierarchy of nested lists.\nWhere a nested list appears, it contains classes derived from the\nclass whose entry immediately precedes the list.  Each entry is a\n2-tuple containing a class and a tuple of its base classes.  If the\n'unique' argument is true, exactly one entry appears in the\nreturned structure for each class in the given list.  Otherwise,\nclasses using multiple inheritance and their descendants will\nappear multiple times.\n\n-- Function: inspect.getfullargspec (func)\n\nGet the names and default values of a Python function's parameters.\nA *note named tuple: 417. is returned:\n\n'FullArgSpec(args, varargs, varkw, defaults, kwonlyargs,\nkwonlydefaults, annotations)'\n\n'args' is a list of the positional parameter names.  'varargs' is\nthe name of the '*' parameter or 'None' if arbitrary positional\narguments are not accepted.  'varkw' is the name of the ''\nparameter or 'None' if arbitrary keyword arguments are not\naccepted.  'defaults' is an 'n'-tuple of default argument values\ncorresponding to the last 'n' positional parameters, or 'None' if\nthere are no such defaults defined.  'kwonlyargs' is a list of\nkeyword-only parameter names in declaration order.\n'kwonlydefaults' is a dictionary mapping parameter names from\n'kwonlyargs' to the default values used if no argument is supplied.\n'annotations' is a dictionary mapping parameter names to\nannotations.  The special key '\"return\"' is used to report the\nfunction return value annotation (if any).\n\nNote that *note signature(): 51c. and *note Signature Object: 410e.\nprovide the recommended API for callable introspection, and support\nadditional behaviours (like positional-only arguments) that are\nsometimes encountered in extension module APIs.  This function is\nretained primarily for use in code that needs to maintain\ncompatibility with the Python 2 'inspect' module API.\n\nChanged in version 3.4: This function is now based on *note\nsignature(): 51c, but still ignores 'wrapped' attributes and\nincludes the already bound first parameter in the signature output\nfor bound methods.\n\nChanged in version 3.6: This method was previously documented as\ndeprecated in favour of *note signature(): 51c. in Python 3.5, but\nthat decision has been reversed in order to restore a clearly\nsupported standard interface for single-source Python 2/3 code\nmigrating away from the legacy 'getargspec()' API.\n\nChanged in version 3.7: Python only explicitly guaranteed that it\npreserved the declaration order of keyword-only parameters as of\nversion 3.7, although in practice this order had always been\npreserved in Python 3.\n\n-- Function: inspect.getargvalues (frame)\n\nGet information about arguments passed into a particular frame.  A\n*note named tuple: 417. 'ArgInfo(args, varargs, keywords, locals)'\nis returned.  'args' is a list of the argument names.  'varargs'\nand 'keywords' are the names of the '*' and '' arguments or\n'None'.  'locals' is the locals dictionary of the given frame.\n\nNote: This function was inadvertently marked as deprecated in\nPython 3.5.\n\n-- Function: inspect.formatargvalues (args[, varargs, varkw, locals,\nformatarg, formatvarargs, formatvarkw, formatvalue])\n\nFormat a pretty argument spec from the four values returned by\n*note getargvalues(): d23.  The format* arguments are the\ncorresponding optional formatting functions that are called to turn\nnames and values into strings.\n\nNote: This function was inadvertently marked as deprecated in\nPython 3.5.\n\n-- Function: inspect.getmro (cls)\n\nReturn a tuple of class cls's base classes, including cls, in\nmethod resolution order.  No class appears more than once in this\ntuple.  Note that the method resolution order depends on cls's\ntype.  Unless a very peculiar user-defined metatype is in use, cls\nwill be the first element of the tuple.\n\n-- Function: inspect.getcallargs (func, /, *args, kwds)\n\nBind the 'args' and 'kwds' to the argument names of the Python\nfunction or method 'func', as if it was called with them.  For\nbound methods, bind also the first argument (typically named\n'self') to the associated instance.  A dict is returned, mapping\nthe argument names (including the names of the '*' and ''\narguments, if any) to their values from 'args' and 'kwds'.  In case\nof invoking 'func' incorrectly, i.e.  whenever 'func(*args,\nkwds)' would raise an exception because of incompatible\nsignature, an exception of the same type and the same or similar\nmessage is raised.  For example:\n\n>>> from inspect import getcallargs\n>>> def f(a, b=1, *pos, named):\n...     pass\n...\n>>> getcallargs(f, 1, 2, 3) == {'a': 1, 'named': {}, 'b': 2, 'pos': (3,)}\nTrue\n>>> getcallargs(f, a=2, x=4) == {'a': 2, 'named': {'x': 4}, 'b': 1, 'pos': ()}\nTrue\n>>> getcallargs(f)\nTraceback (most recent call last):\n...\nTypeError: f() missing 1 required positional argument: 'a'\n\nNew in version 3.2.\n\nDeprecated since version 3.5: Use *note Signature.bind(): 1526. and\n*note Signature.bindpartial(): 4114. instead.\n\n-- Function: inspect.getclosurevars (func)\n\nGet the mapping of external name references in a Python function or\nmethod 'func' to their current values.  A *note named tuple: 417.\n'ClosureVars(nonlocals, globals, builtins, unbound)' is returned.\n'nonlocals' maps referenced names to lexical closure variables,\n'globals' to the function's module globals and 'builtins' to the\nbuiltins visible from the function body.  'unbound' is the set of\nnames referenced in the function that could not be resolved at all\ngiven the current module globals and builtins.\n\n*note TypeError: 28e. is raised if 'func' is not a Python function\nor method.\n\nNew in version 3.3.\n\n-- Function: inspect.unwrap (func, *, stop=None)\n\nGet the object wrapped by 'func'.  It follows the chain of\n'wrapped' attributes returning the last object in the chain.\n\n'stop' is an optional callback accepting an object in the wrapper\nchain as its sole argument that allows the unwrapping to be\nterminated early if the callback returns a true value.  If the\ncallback never returns a true value, the last object in the chain\nis returned as usual.  For example, *note signature(): 51c. uses\nthis to stop unwrapping if any object in the chain has a\n'signature' attribute defined.\n\n*note ValueError: 183. is raised if a cycle is encountered.\n\nNew in version 3.4.\n\n-- Function: inspect.getannotations (obj, *, globals=None,\nlocals=None, evalstr=False)\n\nCompute the annotations dict for an object.\n\n'obj' may be a callable, class, or module.  Passing in an object of\nany other type raises *note TypeError: 28e.\n\nReturns a dict.  'getannotations()' returns a new dict every time\nit's called; calling it twice on the same object will return two\ndifferent but equivalent dicts.\n\nThis function handles several details for you:\n\n* If 'evalstr' is true, values of type 'str' will be\nun-stringized using *note eval(): 690.  This is intended for\nuse with stringized annotations ('from future import\nannotations').\n\n* If 'obj' doesn't have an annotations dict, returns an empty\ndict.  (Functions and methods always have an annotations dict;\nclasses, modules, and other types of callables may not.)\n\n* Ignores inherited annotations on classes.  If a class doesn't\nhave its own annotations dict, returns an empty dict.\n\n* All accesses to object members and dict values are done using\n'getattr()' and 'dict.get()' for safety.\n\n* Always, always, always returns a freshly created dict.\n\n'evalstr' controls whether or not values of type 'str' are\nreplaced with the result of calling *note eval(): 690. on those\nvalues:\n\n* If evalstr is true, *note eval(): 690. is called on values of\ntype 'str'.  (Note that 'getannotations' doesn't catch\nexceptions; if *note eval(): 690. raises an exception, it will\nunwind the stack past the 'getannotations' call.)\n\n* If evalstr is false (the default), values of type 'str' are\nunchanged.\n\n'globals' and 'locals' are passed in to *note eval(): 690.; see the\ndocumentation for *note eval(): 690. for more information.  If\n'globals' or 'locals' is 'None', this function may replace that\nvalue with a context-specific default, contingent on 'type(obj)':\n\n* If 'obj' is a module, 'globals' defaults to 'obj.dict'.\n\n* If 'obj' is a class, 'globals' defaults to\n'sys.modules[obj.module].dict' and 'locals' defaults\nto the 'obj' class namespace.\n\n* If 'obj' is a callable, 'globals' defaults to *note\nobj.globals: 1148, although if 'obj' is a wrapped function\n(using *note functools.updatewrapper(): e99.) it is first\nunwrapped.\n\nCalling 'getannotations' is best practice for accessing the\nannotations dict of any object.  See *note Annotations Best\nPractices: 5cd. for more information on annotations best practices.\n\nNew in version 3.10.\n\nFile: python3.12.info,  Node: The interpreter stack,  Next: Fetching attributes statically,  Prev: Classes and functions<2>,  Up: inspect -- Inspect live objects\n\n5.29.14.5 The interpreter stack\n...............................\n\nSome of the following functions return *note FrameInfo: 415. objects.",
            "subsections": []
        },
        "For backwards compatibility these objects allow tuple-like operations on": {
            "content": "all attributes except 'positions'.  This behavior is considered\ndeprecated and may be removed in the future.\n\n-- Class: inspect.FrameInfo\n\n-- Attribute: frame\n\nThe *note frame object: 4af. that the record corresponds to.\n\n-- Attribute: filename\n\nThe file name associated with the code being executed by the\nframe this record corresponds to.\n\n-- Attribute: lineno\n\nThe line number of the current line associated with the code\nbeing executed by the frame this record corresponds to.\n\n-- Attribute: function\n\nThe function name that is being executed by the frame this\nrecord corresponds to.\n\n-- Attribute: codecontext\n\nA list of lines of context from the source code that's being\nexecuted by the frame this record corresponds to.\n\n-- Attribute: index\n\nThe index of the current line being executed in the *note\ncodecontext: 4129. list.\n\n-- Attribute: positions\n\nA *note dis.Positions: 412c. object containing the start line\nnumber, end line number, start column offset, and end column\noffset associated with the instruction being executed by the\nframe this record corresponds to.\n\nChanged in version 3.5: Return a *note named tuple: 417. instead of\na *note tuple: 4b8.\n\nChanged in version 3.11: 'FrameInfo' is now a class instance (that\nis backwards compatible with the previous *note named tuple: 417.).\n\n-- Class: inspect.Traceback\n\n-- Attribute: filename\n\nThe file name associated with the code being executed by the\nframe this traceback corresponds to.\n\n-- Attribute: lineno\n\nThe line number of the current line associated with the code\nbeing executed by the frame this traceback corresponds to.\n\n-- Attribute: function\n\nThe function name that is being executed by the frame this\ntraceback corresponds to.\n\n-- Attribute: codecontext\n\nA list of lines of context from the source code that's being\nexecuted by the frame this traceback corresponds to.\n\n-- Attribute: index\n\nThe index of the current line being executed in the *note\ncodecontext: 4130. list.\n\n-- Attribute: positions\n\nA *note dis.Positions: 412c. object containing the start line\nnumber, end line number, start column offset, and end column\noffset associated with the instruction being executed by the\nframe this traceback corresponds to.\n\nChanged in version 3.11: 'Traceback' is now a class instance (that\nis backwards compatible with the previous *note named tuple: 417.).\n\nNote: Keeping references to frame objects, as found in the first\nelement of the frame records these functions return, can cause your\nprogram to create reference cycles.  Once a reference cycle has\nbeen created, the lifespan of all objects which can be accessed\nfrom the objects which form the cycle can become much longer even\nif Python's optional cycle detector is enabled.  If such cycles\nmust be created, it is important to ensure they are explicitly\nbroken to avoid the delayed destruction of objects and increased\nmemory consumption which occurs.\n\nThough the cycle detector will catch these, destruction of the\nframes (and local variables) can be made deterministic by removing\nthe cycle in a *note finally: 7ee. clause.  This is also important\nif the cycle detector was disabled when Python was compiled or\nusing *note gc.disable(): 40ec.  For example:\n\ndef handlestackframewithoutleak():\nframe = inspect.currentframe()\ntry:\n# do something with the frame\nfinally:\ndel frame\n\nIf you want to keep the frame around (for example to print a\ntraceback later), you can also break reference cycles by using the\n*note frame.clear(): d72. method.\n",
            "subsections": []
        },
        "The optional 'context' argument supported by most of these functions": {
            "content": "specifies the number of lines of context to return, which are centered\naround the current line.\n\n-- Function: inspect.getframeinfo (frame, context=1)\n\nGet information about a frame or traceback object.  A *note\nTraceback: 416. object is returned.\n\nChanged in version 3.11: A *note Traceback: 416. object is returned\ninstead of a named tuple.\n\n-- Function: inspect.getouterframes (frame, context=1)\n\nGet a list of *note FrameInfo: 415. objects for a frame and all\nouter frames.  These frames represent the calls that lead to the\ncreation of 'frame'.  The first entry in the returned list\nrepresents 'frame'; the last entry represents the outermost call on\n'frame''s stack.\n\nChanged in version 3.5: A list of *note named tuples: 417.\n'FrameInfo(frame, filename, lineno, function, codecontext, index)'\nis returned.\n\nChanged in version 3.11: A list of *note FrameInfo: 415. objects is\nreturned.\n\n-- Function: inspect.getinnerframes (traceback, context=1)\n\nGet a list of *note FrameInfo: 415. objects for a traceback's frame\nand all inner frames.  These frames represent calls made as a\nconsequence of 'frame'.  The first entry in the list represents\n'traceback'; the last entry represents where the exception was\nraised.\n\nChanged in version 3.5: A list of *note named tuples: 417.\n'FrameInfo(frame, filename, lineno, function, codecontext, index)'\nis returned.\n\nChanged in version 3.11: A list of *note FrameInfo: 415. objects is\nreturned.\n\n-- Function: inspect.currentframe ()\n\nReturn the frame object for the caller's stack frame.\n\n'CPython implementation detail:' This function relies on Python\nstack frame support in the interpreter, which isn't guaranteed to\nexist in all implementations of Python.  If running in an\nimplementation without Python stack frame support this function\nreturns 'None'.\n\n-- Function: inspect.stack (context=1)\n\nReturn a list of *note FrameInfo: 415. objects for the caller's\nstack.  The first entry in the returned list represents the caller;\nthe last entry represents the outermost call on the stack.\n\nChanged in version 3.5: A list of *note named tuples: 417.\n'FrameInfo(frame, filename, lineno, function, codecontext, index)'\nis returned.\n\nChanged in version 3.11: A list of *note FrameInfo: 415. objects is\nreturned.\n\n-- Function: inspect.trace (context=1)\n\nReturn a list of *note FrameInfo: 415. objects for the stack\nbetween the current frame and the frame in which an exception\ncurrently being handled was raised in.  The first entry in the list\nrepresents the caller; the last entry represents where the\nexception was raised.\n\nChanged in version 3.5: A list of *note named tuples: 417.\n'FrameInfo(frame, filename, lineno, function, codecontext, index)'\nis returned.\n\nChanged in version 3.11: A list of *note FrameInfo: 415. objects is\nreturned.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Fetching attributes statically,  Next: Current State of Generators Coroutines and Asynchronous Generators,  Prev: The interpreter stack,  Up: inspect -- Inspect live objects": {
            "content": "5.29.14.6 Fetching attributes statically\n........................................\n\nBoth *note getattr(): a15. and *note hasattr(): 1f7. can trigger code\nexecution when fetching or checking for the existence of attributes.\nDescriptors, like properties, will be invoked and *note getattr():\n1f8. and *note getattribute(): a16. may be called.\n",
            "subsections": []
        },
        "For cases where you want passive introspection, like documentation": {
            "content": "tools, this can be inconvenient.  *note getattrstatic(): 1b2. has the\nsame signature as *note getattr(): a15. but avoids executing code when\nit fetches attributes.\n\n-- Function: inspect.getattrstatic (obj, attr, default=None)\n\nRetrieve attributes without triggering dynamic lookup via the\ndescriptor protocol, *note getattr(): 1f8. or *note\ngetattribute(): a16.\n\nNote: this function may not be able to retrieve all attributes that\ngetattr can fetch (like dynamically created attributes) and may\nfind attributes that getattr can't (like descriptors that raise\nAttributeError).  It can also return descriptors objects instead of\ninstance members.\n\nIf the instance *note dict: aa8. is shadowed by another member\n(for example a property) then this function will be unable to find\ninstance members.\n\nNew in version 3.2.\n\n*note getattrstatic(): 1b2. does not resolve descriptors, for example\nslot descriptors or getset descriptors on objects implemented in C. The\ndescriptor object is returned instead of the underlying attribute.\n",
            "subsections": []
        },
        "You can handle these with code like the following.  Note that for": {
            "content": "arbitrary getset descriptors invoking these may trigger code execution:\n\n# example code for resolving the builtin descriptor types\nclass foo:\nslots = ['foo']\n\nslotdescriptor = type(foo.foo)\ngetsetdescriptor = type(type(open(file)).name)\nwrapperdescriptor = type(str.dict['add'])\ndescriptortypes = (slotdescriptor, getsetdescriptor, wrapperdescriptor)\n\nresult = getattrstatic(someobject, 'foo')\nif type(result) in descriptortypes:\ntry:\nresult = result.get()\nexcept AttributeError:\n# descriptors can raise AttributeError to\n# indicate there is no underlying value\n# in which case the descriptor itself will\n# have to do\npass\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Current State of Generators Coroutines and Asynchronous Generators,  Next: Code Objects Bit Flags,  Prev: Fetching attributes statically,  Up: inspect -- Inspect live objects": {
            "content": "5.29.14.7 Current State of Generators, Coroutines, and Asynchronous Generators\n..............................................................................\n",
            "subsections": []
        },
        "When implementing coroutine schedulers and for other advanced uses of": {
            "content": "generators, it is useful to determine whether a generator is currently\nexecuting, is waiting to start or resume or execution, or has already\nterminated.  *note getgeneratorstate(): 10ac. allows the current state\nof a generator to be determined easily.\n\n-- Function: inspect.getgeneratorstate (generator)\n\nGet current state of a generator-iterator.\n\nPossible states are:\n\n* GENCREATED: Waiting to start execution.\n\n* GENRUNNING: Currently being executed by the interpreter.\n\n* GENSUSPENDED: Currently suspended at a yield expression.\n\n* GENCLOSED: Execution has completed.\n\nNew in version 3.2.\n\n-- Function: inspect.getcoroutinestate (coroutine)\n\nGet current state of a coroutine object.  The function is intended\nto be used with coroutine objects created by *note async def: 394.\nfunctions, but will accept any coroutine-like object that has\n'crrunning' and 'crframe' attributes.\n\nPossible states are:\n\n* COROCREATED: Waiting to start execution.\n\n* CORORUNNING: Currently being executed by the interpreter.\n\n* COROSUSPENDED: Currently suspended at an await expression.\n\n* COROCLOSED: Execution has completed.\n\nNew in version 3.5.\n\n-- Function: inspect.getasyncgenstate (agen)\n\nGet current state of an asynchronous generator object.  The\nfunction is intended to be used with asynchronous iterator objects\ncreated by *note async def: 394. functions which use the *note\nyield: 7f1. statement, but will accept any asynchronous\ngenerator-like object that has 'agrunning' and 'agframe'\nattributes.\n\nPossible states are:\n\n* AGENCREATED: Waiting to start execution.\n\n* AGENRUNNING: Currently being executed by the interpreter.\n\n* AGENSUSPENDED: Currently suspended at a yield expression.\n\n* AGENCLOSED: Execution has completed.\n\nNew in version 3.12.\n",
            "subsections": []
        },
        "The current internal state of the generator can also be queried.  This": {
            "content": "is mostly useful for testing purposes, to ensure that internal state is\nbeing updated as expected:\n\n-- Function: inspect.getgeneratorlocals (generator)\n\nGet the mapping of live local variables in 'generator' to their\ncurrent values.  A dictionary is returned that maps from variable\nnames to values.  This is the equivalent of calling *note locals():\n173. in the body of the generator, and all the same caveats apply.\n\nIf 'generator' is a *note generator: eda. with no currently\nassociated frame, then an empty dictionary is returned.  *note\nTypeError: 28e. is raised if 'generator' is not a Python generator\nobject.\n\n'CPython implementation detail:' This function relies on the\ngenerator exposing a Python stack frame for introspection, which\nisn't guaranteed to be the case in all implementations of Python.\nIn such cases, this function will always return an empty\ndictionary.\n\nNew in version 3.3.\n\n-- Function: inspect.getcoroutinelocals (coroutine)\n\nThis function is analogous to *note getgeneratorlocals(): f46, but\nworks for coroutine objects created by *note async def: 394.\nfunctions.\n\nNew in version 3.5.\n\n-- Function: inspect.getasyncgenlocals (agen)\n\nThis function is analogous to *note getgeneratorlocals(): f46, but\nworks for asynchronous generator objects created by *note async\ndef: 394. functions which use the *note yield: 7f1. statement.\n\nNew in version 3.12.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Code Objects Bit Flags,  Next: Buffer flags,  Prev: Current State of Generators Coroutines and Asynchronous Generators,  Up: inspect -- Inspect live objects": {
            "content": "5.29.14.8 Code Objects Bit Flags\n................................\n\nPython code objects have a *note coflags: 1c4a. attribute, which is a\nbitmap of the following flags:\n\n-- Data: inspect.COOPTIMIZED\n\nThe code object is optimized, using fast locals.\n\n-- Data: inspect.CONEWLOCALS\n\nIf set, a new dict will be created for the frame's *note flocals:\n579. when the code object is executed.\n\n-- Data: inspect.COVARARGS\n\nThe code object has a variable positional parameter ('*args'-like).\n\n-- Data: inspect.COVARKEYWORDS\n\nThe code object has a variable keyword parameter ('kwargs'-like).\n\n-- Data: inspect.CONESTED\n\nThe flag is set when the code object is a nested function.\n\n-- Data: inspect.COGENERATOR\n\nThe flag is set when the code object is a generator function, i.e.\na generator object is returned when the code object is executed.\n\n-- Data: inspect.COCOROUTINE\n\nThe flag is set when the code object is a coroutine function.  When\nthe code object is executed it returns a coroutine object.  See PEP\n492(1) for more details.\n\nNew in version 3.5.\n\n-- Data: inspect.COITERABLECOROUTINE\n\nThe flag is used to transform generators into generator-based\ncoroutines.  Generator objects with this flag can be used in\n'await' expression, and can 'yield from' coroutine objects.  See\nPEP 492(2) for more details.\n\nNew in version 3.5.\n\n-- Data: inspect.COASYNCGENERATOR\n\nThe flag is set when the code object is an asynchronous generator\nfunction.  When the code object is executed it returns an\nasynchronous generator object.  See PEP 525(3) for more details.\n\nNew in version 3.6.\n\nNote: The flags are specific to CPython, and may not be defined in\nother Python implementations.  Furthermore, the flags are an\nimplementation detail, and can be removed or deprecated in future\nPython releases.  It's recommended to use public APIs from the\n*note inspect: 78. module for any introspection needs.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0492/\n\n(2) https://peps.python.org/pep-0492/\n\n(3) https://peps.python.org/pep-0525/\n\nFile: python3.12.info,  Node: Buffer flags,  Next: Command Line Interface<3>,  Prev: Code Objects Bit Flags,  Up: inspect -- Inspect live objects\n\n5.29.14.9 Buffer flags\n......................\n\n-- Class: inspect.BufferFlags\n\nThis is an *note enum.IntFlag: 200b. that represents the flags that\ncan be passed to the *note buffer(): 16f. method of objects\nimplementing the *note buffer protocol: 148.\n\nThe meaning of the flags is explained at *note Buffer request\ntypes: 4140.\n\n-- Attribute: SIMPLE\n\n-- Attribute: WRITABLE\n\n-- Attribute: FORMAT\n\n-- Attribute: ND\n\n-- Attribute: STRIDES\n\n-- Attribute: CCONTIGUOUS\n\n-- Attribute: FCONTIGUOUS\n\n-- Attribute: ANYCONTIGUOUS\n\n-- Attribute: INDIRECT\n\n-- Attribute: CONTIG\n\n-- Attribute: CONTIGRO\n\n-- Attribute: STRIDED\n\n-- Attribute: STRIDEDRO\n\n-- Attribute: RECORDS\n\n-- Attribute: RECORDSRO\n\n-- Attribute: FULL\n\n-- Attribute: FULLRO\n\n-- Attribute: READ\n\n-- Attribute: WRITE\n\nNew in version 3.12.\n\nFile: python3.12.info,  Node: Command Line Interface<3>,  Prev: Buffer flags,  Up: inspect -- Inspect live objects\n\n5.29.14.10 Command Line Interface\n.................................\n\nThe *note inspect: 78. module also provides a basic introspection\ncapability from the command line.\n",
            "subsections": []
        },
        "By default, accepts the name of a module and prints the source of that": {
            "content": "module.  A class or function within the module can be printed instead by\nappended a colon and the qualified name of the target object.\n\n-- Option: --details\n\nPrint information about the specified object rather than the source\ncode\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: site -- Site-specific configuration hook,  Prev: inspect -- Inspect live objects,  Up: Python Runtime Services": {
            "content": "'Source code:' Lib/site.py(1)\n\n\n\n'This module is automatically imported during initialization.'  The\nautomatic import can be suppressed using the interpreter's *note -S:\n101c. option.\n",
            "subsections": []
        },
        "Importing this module will append site-specific paths to the module": {
            "content": "search path and add a few builtins, unless *note -S: 101c. was used.  In\nthat case, this module can be safely imported with no automatic\nmodifications to the module search path or additions to the builtins.\nTo explicitly trigger the usual site-specific additions, call the *note\nmain(): 1ab9. function.\n",
            "subsections": []
        },
        "Changed in version 3.3: Importing the module used to trigger paths": {
            "content": "manipulation even when using *note -S: 101c.\n",
            "subsections": []
        },
        "It starts by constructing up to four directories from a head and a tail": {
            "content": "part.  For the head part, it uses 'sys.prefix' and 'sys.execprefix';\nempty heads are skipped.  For the tail part, it uses the empty string\nand then 'lib/site-packages' (on Windows) or\n'lib/python`X.Y'/site-packages' (on Unix and macOS). For each of the\ndistinct head-tail combinations, it sees if it refers to an existing\ndirectory, and if so, adds it to 'sys.path' and also inspects the newly\nadded path for configuration files.\n\nChanged in version 3.5: Support for the \"site-python\" directory has been\nremoved.\n\nIf a file named \"pyvenv.cfg\" exists one directory above sys.executable,\nsys.prefix and sys.execprefix are set to that directory and it is also\nchecked for site-packages (sys.baseprefix and sys.baseexecprefix will\nalways be the \"real\" prefixes of the Python installation).  If\n\"pyvenv.cfg\" (a bootstrap configuration file) contains the key\n\"include-system-site-packages\" set to anything other than \"true\"\n(case-insensitive), the system-level prefixes will not be searched for\nsite-packages; otherwise they will.\n\nA path configuration file is a file whose name has the form '`name'.pth'\nand exists in one of the four directories mentioned above; its contents\nare additional items (one per line) to be added to 'sys.path'.",
            "subsections": []
        },
        "Non-existing items are never added to 'sys.path', and no check is made": {
            "content": "that the item refers to a directory rather than a file.  No item is\nadded to 'sys.path' more than once.  Blank lines and lines beginning\nwith '#' are skipped.  Lines starting with 'import' (followed by space\nor tab) are executed.\n\nNote: An executable line in a '.pth' file is run at every Python\nstartup, regardless of whether a particular module is actually\ngoing to be used.  Its impact should thus be kept to a minimum.\nThe primary intended purpose of executable lines is to make the\ncorresponding module(s) importable (load 3rd-party import hooks,\nadjust 'PATH' etc).  Any other initialization is supposed to be\ndone upon a module's actual import, if and when it happens.\nLimiting a code chunk to a single line is a deliberate measure to\ndiscourage putting anything more complex here.\n",
            "subsections": []
        },
        "For example, suppose 'sys.prefix' and 'sys.execprefix' are set to": {
            "content": "'/usr/local'.  The Python X.Y library is then installed in\n'/usr/local/lib/python`X.Y''.  Suppose this has a subdirectory\n'/usr/local/lib/python`X.Y'/site-packages' with three subsubdirectories,\n'foo', 'bar' and 'spam', and two path configuration files, 'foo.pth' and\n'bar.pth'.  Assume 'foo.pth' contains the following:\n\n# foo package configuration\n\nfoo\nbar\nbletch\n\nand 'bar.pth' contains:\n\n# bar package configuration\n\nbar\n",
            "subsections": []
        },
        "Then the following version-specific directories are added to 'sys.path',": {
            "content": "in this order:\n\n/usr/local/lib/pythonX.Y/site-packages/bar\n/usr/local/lib/pythonX.Y/site-packages/foo\n",
            "subsections": []
        },
        "Note that 'bletch' is omitted because it doesn't exist; the 'bar'": {
            "content": "directory precedes the 'foo' directory because 'bar.pth' comes\nalphabetically before 'foo.pth'; and 'spam' is omitted because it is not\nmentioned in either path configuration file.\n\n* Menu:\n\n* sitecustomize::\n* usercustomize::\n* Readline configuration::\n* Module contents: Module contents<5>.\n* Command Line Interface: Command Line Interface<4>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/site.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: sitecustomize,  Next: usercustomize,  Up: site -- Site-specific configuration hook": {
            "content": "5.29.15.1 'sitecustomize'\n.........................\n",
            "subsections": []
        },
        "After these path manipulations, an attempt is made to import a module": {
            "content": "named *note sitecustomize: c3, which can perform arbitrary site-specific\ncustomizations.  It is typically created by a system administrator in\nthe site-packages directory.  If this import fails with an *note\nImportError: 145. or its subclass exception, and the exception's *note\nname: 1f96. attribute equals to ''sitecustomize'', it is silently\nignored.  If Python is started without output streams available, as with\n'pythonw.exe' on Windows (which is used by default to start IDLE),\nattempted output from *note sitecustomize: c3. is ignored.  Any other\nexception causes a silent and perhaps mysterious failure of the process.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: usercustomize,  Next: Readline configuration,  Prev: sitecustomize,  Up: site -- Site-specific configuration hook": {
            "content": "5.29.15.2 'usercustomize'\n.........................\n\nAfter this, an attempt is made to import a module named *note\nusercustomize: 109, which can perform arbitrary user-specific\ncustomizations, if *note ENABLEUSERSITE: 415a. is true.  This file is\nintended to be created in the user site-packages directory (see below),\nwhich is part of 'sys.path' unless disabled by *note -s: 1200.  If this\nimport fails with an *note ImportError: 145. or its subclass exception,\nand the exception's *note name: 1f96. attribute equals to\n''usercustomize'', it is silently ignored.\n",
            "subsections": []
        },
        "Note that for some non-Unix systems, 'sys.prefix' and 'sys.execprefix'": {
            "content": "are empty, and the path manipulations are skipped; however the import of\n*note sitecustomize: c3. and *note usercustomize: 109. is still\nattempted.\n\nFile: python3.12.info,  Node: Readline configuration,  Next: Module contents<5>,  Prev: usercustomize,  Up: site -- Site-specific configuration hook\n\n5.29.15.3 Readline configuration\n................................\n\nOn systems that support *note readline: b5, this module will also import\nand configure the *note rlcompleter: b8. module, if Python is started in\n*note interactive mode: e39. and without the *note -S: 101c. option.",
            "subsections": []
        },
        "The default behavior is enable tab-completion and to use": {
            "content": "'~/.pythonhistory' as the history save file.  To disable it, delete (or\noverride) the *note sys.interactivehook: e3a. attribute in your\n*note sitecustomize: c3. or *note usercustomize: 109. module or your\n*note PYTHONSTARTUP: e3b. file.\n",
            "subsections": []
        },
        "Changed in version 3.4: Activation of rlcompleter and history was made": {
            "content": "automatic.\n\nFile: python3.12.info,  Node: Module contents<5>,  Next: Command Line Interface<4>,  Prev: Readline configuration,  Up: site -- Site-specific configuration hook\n\n5.29.15.4 Module contents\n.........................\n\n-- Data: site.PREFIXES\n\nA list of prefixes for site-packages directories.\n\n-- Data: site.ENABLEUSERSITE\n\nFlag showing the status of the user site-packages directory.\n'True' means that it is enabled and was added to 'sys.path'.\n'False' means that it was disabled by user request (with *note -s:\n1200. or *note PYTHONNOUSERSITE: 1201.).  'None' means it was\ndisabled for security reasons (mismatch between user or group id\nand effective id) or by an administrator.\n\n-- Data: site.USERSITE\n\nPath to the user site-packages for the running Python.  Can be\n'None' if *note getusersitepackages(): 10b6. hasn't been called\nyet.  Default value is '~/.local/lib/python`X.Y'/site-packages' for\nUNIX and non-framework macOS builds,\n'~/Library/Python/`X.Y'/lib/python/site-packages' for macOS\nframework builds, and '`%APPDATA%'\\Python\\Python`XY'\\site-packages'\non Windows.  This directory is a site directory, which means that\n'.pth' files in it will be processed.\n\n-- Data: site.USERBASE\n\nPath to the base directory for the user site-packages.  Can be\n'None' if *note getuserbase(): 10b5. hasn't been called yet.\nDefault value is '~/.local' for UNIX and macOS non-framework\nbuilds, '~/Library/Python/`X.Y'' for macOS framework builds, and\n'`%APPDATA%'\\Python' for Windows.  This value is used to compute\nthe installation directories for scripts, data files, Python\nmodules, etc.  for the *note user installation scheme: 1ac7.  See\nalso *note PYTHONUSERBASE: 11ff.\n\n-- Function: site.main ()\n\nAdds all the standard site-specific directories to the module\nsearch path.  This function is called automatically when this\nmodule is imported, unless the Python interpreter was started with\nthe *note -S: 101c. flag.\n\nChanged in version 3.3: This function used to be called\nunconditionally.\n\n-- Function: site.addsitedir (sitedir, knownpaths=None)\n\nAdd a directory to sys.path and process its '.pth' files.\nTypically used in *note sitecustomize: c3. or *note usercustomize:\n109. (see above).\n\n-- Function: site.getsitepackages ()\n\nReturn a list containing all global site-packages directories.\n\nNew in version 3.2.\n\n-- Function: site.getuserbase ()\n\nReturn the path of the user base directory, *note USERBASE: 1194.\nIf it is not initialized yet, this function will also set it,\nrespecting *note PYTHONUSERBASE: 11ff.\n\nNew in version 3.2.\n\n-- Function: site.getusersitepackages ()\n\nReturn the path of the user-specific site-packages directory, *note\nUSERSITE: 1ab8.  If it is not initialized yet, this function will\nalso set it, respecting *note USERBASE: 1194.  To determine if the\nuser-specific site-packages was added to 'sys.path' *note\nENABLEUSERSITE: 415a. should be used.\n\nNew in version 3.2.\n\nFile: python3.12.info,  Node: Command Line Interface<4>,  Prev: Module contents<5>,  Up: site -- Site-specific configuration hook\n\n5.29.15.5 Command Line Interface\n................................\n\nThe *note site: c2. module also provides a way to get the user\ndirectories from the command line:\n\n$ python -m site --user-site\n/home/user/.local/lib/python3.11/site-packages\n\nIf it is called without arguments, it will print the contents of *note\nsys.path: 32c. on the standard output, followed by the value of *note\nUSERBASE: 1194. and whether the directory exists, then the same thing\nfor *note USERSITE: 1ab8, and finally the value of *note\nENABLEUSERSITE: 415a.\n\n-- Option: --user-base\n\nPrint the path to the user base directory.\n\n-- Option: --user-site\n\nPrint the path to the user site-packages directory.\n",
            "subsections": []
        },
        "If both options are given, user base and user site will be printed": {
            "content": "(always in this order), separated by *note os.pathsep: 1ac4.\n\nIf any option is given, the script will exit with one of these values:\n'0' if the user site-packages directory is enabled, '1' if it was\ndisabled by the user, '2' if it is disabled for security reasons or by\nan administrator, and a value greater than 2 if there is an error.\n\nSee also\n........\n\n* PEP 370(1) - Per user site-packages directory\n\n* *note The initialization of the sys.path module search path: 19e5.\n- The initialization of *note sys.path: 32c.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0370/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Custom Python Interpreters,  Next: Importing Modules,  Prev: Python Runtime Services,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.30 Custom Python Interpreters",
                    "content": ""
                }
            ]
        },
        "The modules described in this chapter allow writing interfaces similar": {
            "content": "to Python's interactive interpreter.  If you want a Python interpreter\nthat supports some special feature in addition to the Python language,\nyou should look at the *note code: 18. module.  (The *note codeop: 1a.\nmodule is lower-level, used to support compiling a possibly incomplete\nchunk of Python code.)\n\nThe full list of modules described in this chapter is:\n\n* Menu:\n\n* code -- Interpreter base classes::\n* codeop -- Compile Python code::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: code -- Interpreter base classes,  Next: codeop -- Compile Python code,  Up: Custom Python Interpreters": {
            "content": "'Source code:' Lib/code.py(1)\n\n\n",
            "subsections": []
        },
        "The 'code' module provides facilities to implement read-eval-print loops": {
            "content": "in Python.  Two classes and convenience functions are included which can\nbe used to build applications which provide an interactive interpreter\nprompt.\n\n-- Class: code.InteractiveInterpreter (locals=None)\n\nThis class deals with parsing and interpreter state (the user's\nnamespace); it does not deal with input buffering or prompting or\ninput file naming (the filename is always passed in explicitly).\nThe optional 'locals' argument specifies the dictionary in which\ncode will be executed; it defaults to a newly created dictionary\nwith key ''name'' set to ''console'' and key ''doc''\nset to 'None'.\n\n-- Class: code.InteractiveConsole (locals=None, filename='<console>')\n\nClosely emulate the behavior of the interactive Python interpreter.\nThis class builds on *note InteractiveInterpreter: 4168. and adds\nprompting using the familiar 'sys.ps1' and 'sys.ps2', and input\nbuffering.\n\n-- Function: code.interact (banner=None, readfunc=None, local=None,\nexitmsg=None)\n\nConvenience function to run a read-eval-print loop.  This creates a\nnew instance of *note InteractiveConsole: 20aa. and sets 'readfunc'\nto be used as the *note InteractiveConsole.rawinput(): 416a.\nmethod, if provided.  If 'local' is provided, it is passed to the\n*note InteractiveConsole: 20aa. constructor for use as the default\nnamespace for the interpreter loop.  The *note interact(): 416b.\nmethod of the instance is then run with 'banner' and 'exitmsg'\npassed as the banner and exit message to use, if provided.  The\nconsole object is discarded after use.\n\nChanged in version 3.6: Added 'exitmsg' parameter.\n\n-- Function: code.compilecommand (source, filename='<input>',\nsymbol='single')\n\nThis function is useful for programs that want to emulate Python's\ninterpreter main loop (a.k.a.  the read-eval-print loop).  The\ntricky part is to determine when the user has entered an incomplete\ncommand that can be completed by entering more text (as opposed to\na complete command or a syntax error).  This function 'almost'\nalways makes the same decision as the real interpreter main loop.\n\n'source' is the source string; 'filename' is the optional filename\nfrom which source was read, defaulting to ''<input>''; and 'symbol'\nis the optional grammar start symbol, which should be ''single''\n(the default), ''eval'' or ''exec''.\n\nReturns a code object (the same as 'compile(source, filename,\nsymbol)') if the command is complete and valid; 'None' if the\ncommand is incomplete; raises *note SyntaxError: 146. if the\ncommand is complete and contains a syntax error, or raises *note\nOverflowError: 68d. or *note ValueError: 183. if the command\ncontains an invalid literal.\n\n* Menu:\n\n* Interactive Interpreter Objects::\n* Interactive Console Objects::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/code.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Interactive Interpreter Objects,  Next: Interactive Console Objects,  Up: code -- Interpreter base classes": {
            "content": "5.30.1.1 Interactive Interpreter Objects\n........................................\n\n-- Method: InteractiveInterpreter.runsource (source,\nfilename='<input>', symbol='single')\n\nCompile and run some source in the interpreter.  Arguments are the\nsame as for *note compilecommand(): 416c.; the default for\n'filename' is ''<input>'', and for 'symbol' is ''single''.  One of\nseveral things can happen:\n\n* The input is incorrect; *note compilecommand(): 416c. raised\nan exception (*note SyntaxError: 146. or *note OverflowError:\n68d.).  A syntax traceback will be printed by calling the\n*note showsyntaxerror(): 4170. method.  *note runsource():\n416f. returns 'False'.\n\n* The input is incomplete, and more input is required; *note\ncompilecommand(): 416c. returned 'None'.  *note runsource():\n416f. returns 'True'.\n\n* The input is complete; *note compilecommand(): 416c. returned\na code object.  The code is executed by calling the *note\nruncode(): 4171. (which also handles run-time exceptions,\nexcept for *note SystemExit: b97.).  *note runsource(): 416f.\nreturns 'False'.\n\nThe return value can be used to decide whether to use 'sys.ps1' or\n'sys.ps2' to prompt the next line.\n\n-- Method: InteractiveInterpreter.runcode (code)\n\nExecute a code object.  When an exception occurs, *note\nshowtraceback(): c2c. is called to display a traceback.  All\nexceptions are caught except *note SystemExit: b97, which is\nallowed to propagate.\n\nA note about *note KeyboardInterrupt: 7f5.: this exception may\noccur elsewhere in this code, and may not always be caught.  The\ncaller should be prepared to deal with it.\n\n-- Method: InteractiveInterpreter.showsyntaxerror (filename=None)\n\nDisplay the syntax error that just occurred.  This does not display\na stack trace because there isn't one for syntax errors.  If\n'filename' is given, it is stuffed into the exception instead of\nthe default filename provided by Python's parser, because it always\nuses ''<string>'' when reading from a string.  The output is\nwritten by the *note write(): 4172. method.\n\n-- Method: InteractiveInterpreter.showtraceback ()\n\nDisplay the exception that just occurred.  We remove the first\nstack item because it is within the interpreter object\nimplementation.  The output is written by the *note write(): 4172.\nmethod.\n\nChanged in version 3.5: The full chained traceback is displayed\ninstead of just the primary traceback.\n\n-- Method: InteractiveInterpreter.write (data)\n\nWrite a string to the standard error stream ('sys.stderr').\nDerived classes should override this to provide the appropriate\noutput handling as needed.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Interactive Console Objects,  Prev: Interactive Interpreter Objects,  Up: code -- Interpreter base classes": {
            "content": "5.30.1.2 Interactive Console Objects\n....................................\n\nThe *note InteractiveConsole: 20aa. class is a subclass of *note",
            "subsections": []
        },
        "InteractiveInterpreter: 4168, and so offers all the methods of the": {
            "content": "interpreter objects as well as the following additions.\n\n-- Method: InteractiveConsole.interact (banner=None, exitmsg=None)\n\nClosely emulate the interactive Python console.  The optional\n'banner' argument specify the banner to print before the first\ninteraction; by default it prints a banner similar to the one\nprinted by the standard Python interpreter, followed by the class\nname of the console object in parentheses (so as not to confuse\nthis with the real interpreter - since it's so close!).\n\nThe optional 'exitmsg' argument specifies an exit message printed\nwhen exiting.  Pass the empty string to suppress the exit message.\nIf 'exitmsg' is not given or 'None', a default message is printed.\n\nChanged in version 3.4: To suppress printing any banner, pass an\nempty string.\n\nChanged in version 3.6: Print an exit message when exiting.\n\n-- Method: InteractiveConsole.push (line)\n\nPush a line of source text to the interpreter.  The line should not\nhave a trailing newline; it may have internal newlines.  The line\nis appended to a buffer and the interpreter's *note runsource():\n416f. method is called with the concatenated contents of the buffer\nas source.  If this indicates that the command was executed or\ninvalid, the buffer is reset; otherwise, the command is incomplete,\nand the buffer is left as it was after the line was appended.  The\nreturn value is 'True' if more input is required, 'False' if the\nline was dealt with in some way (this is the same as\n'runsource()').\n\n-- Method: InteractiveConsole.resetbuffer ()\n\nRemove any unhandled source text from the input buffer.\n\n-- Method: InteractiveConsole.rawinput (prompt='')\n\nWrite a prompt and read a line.  The returned line does not include\nthe trailing newline.  When the user enters the EOF key sequence,\n*note EOFError: 114e. is raised.  The base implementation reads\nfrom 'sys.stdin'; a subclass may replace this with a different\nimplementation.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: codeop -- Compile Python code,  Prev: code -- Interpreter base classes,  Up: Custom Python Interpreters": {
            "content": "'Source code:' Lib/codeop.py(1)\n\n\n\nThe *note codeop: 1a. module provides utilities upon which the Python\nread-eval-print loop can be emulated, as is done in the *note code: 18.\nmodule.  As a result, you probably don't want to use the module\ndirectly; if you want to include such a loop in your program you\nprobably want to use the *note code: 18. module instead.\n\nThere are two parts to this job:\n\n1. Being able to tell if a line of input completes a Python statement:\nin short, telling whether to print ''>>>'' or ''...'' next.\n\n2. Remembering which future statements the user has entered, so\nsubsequent input can be compiled with these in effect.\n\nThe *note codeop: 1a. module provides a way of doing each of these\nthings, and a way of doing them both.\n\nTo do just the former:\n\n-- Function: codeop.compilecommand (source, filename='<input>',\nsymbol='single')\n\nTries to compile 'source', which should be a string of Python code\nand return a code object if 'source' is valid Python code.  In that\ncase, the filename attribute of the code object will be 'filename',\nwhich defaults to ''<input>''.  Returns 'None' if 'source' is 'not'\nvalid Python code, but is a prefix of valid Python code.\n\nIf there is a problem with 'source', an exception will be raised.\n*note SyntaxError: 146. is raised if there is invalid Python\nsyntax, and *note OverflowError: 68d. or *note ValueError: 183. if\nthere is an invalid literal.\n\nThe 'symbol' argument determines whether 'source' is compiled as a\nstatement (''single'', the default), as a sequence of *note\nstatement: 247d. (''exec'') or as an *note expression: 1c8d.\n(''eval'').  Any other value will cause *note ValueError: 183. to\nbe raised.\n\nNote: It is possible (but not likely) that the parser stops\nparsing with a successful outcome before reaching the end of\nthe source; in this case, trailing symbols may be ignored\ninstead of causing an error.  For example, a backslash\nfollowed by two newlines may be followed by arbitrary garbage.\nThis will be fixed once the API for the parser is better.\n\n-- Class: codeop.Compile\n\nInstances of this class have *note call(): 2b1. methods\nidentical in signature to the built-in function *note compile():\n528, but with the difference that if the instance compiles program\ntext containing a *note future: 0. statement, the instance\n'remembers' and compiles all subsequent program texts with the\nstatement in force.\n\n-- Class: codeop.CommandCompiler\n\nInstances of this class have *note call(): 2b1. methods\nidentical in signature to *note compilecommand(): 1522.; the\ndifference is that if the instance compiles program text containing\na *note future: 0. statement, the instance 'remembers' and\ncompiles all subsequent program texts with the statement in force.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/codeop.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Importing Modules,  Next: Python Language Services,  Prev: Custom Python Interpreters,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.31 Importing Modules",
                    "content": ""
                }
            ]
        },
        "The modules described in this chapter provide new ways to import other": {
            "content": "Python modules and hooks for customizing the import process.\n\nThe full list of modules described in this chapter is:\n\n* Menu:\n\n* zipimport -- Import modules from Zip archives::\n* pkgutil -- Package extension utility::\n* modulefinder -- Find modules used by a script::\n* runpy -- Locating and executing Python modules::\n* importlib -- The implementation of import::\n* importlib.resources - Package resource reading, opening and access: importlib resources - Package resource reading opening and access.\n* importlib.resources.abc - Abstract base classes for resources: importlib resources abc - Abstract base classes for resources.\n* importlib.metadata - Accessing package metadata: importlib metadata - Accessing package metadata.\n* The initialization of the sys.path module search path: The initialization of the sys path module search path.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: zipimport -- Import modules from Zip archives,  Next: pkgutil -- Package extension utility,  Up: Importing Modules": {
            "content": "'Source code:' Lib/zipimport.py(1)\n\n\n\nThis module adds the ability to import Python modules ('*.py', '*.pyc')\nand packages from ZIP-format archives.  It is usually not needed to use\nthe *note zipimport: 12c. module explicitly; it is automatically used by\nthe built-in *note import: 3a6. mechanism for *note sys.path: 32c. items\nthat are paths to ZIP archives.\n\nTypically, *note sys.path: 32c. is a list of directory names as strings.\nThis module also allows an item of *note sys.path: 32c. to be a string\nnaming a ZIP file archive.  The ZIP archive can contain a subdirectory\nstructure to support package imports, and a path within the archive can\nbe specified to only import from a subdirectory.  For example, the path\n'example.zip/lib/' would only import from the 'lib/' subdirectory within\nthe archive.\n",
            "subsections": []
        },
        "Any files may be present in the ZIP archive, but importers are only": {
            "content": "invoked for '.py' and '.pyc' files.  ZIP import of dynamic modules\n('.pyd', '.so') is disallowed.  Note that if an archive only contains\n'.py' files, Python will not attempt to modify the archive by adding the\ncorresponding '.pyc' file, meaning that if a ZIP archive doesn't contain\n'.pyc' files, importing may be rather slow.\n",
            "subsections": []
        },
        "Changed in version 3.8: Previously, ZIP archives with an archive comment": {
            "content": "were not supported.\n\nSee also\n........\n\nPKZIP Application Note(2)\n\nDocumentation on the ZIP file format by Phil Katz, the creator of\nthe format and algorithms used.\n\nPEP 273(3) - Import Modules from Zip Archives\n\nWritten by James C. Ahlstrom, who also provided an implementation.\nPython 2.3 follows the specification in PEP 273(4), but uses an\nimplementation written by Just van Rossum that uses the import\nhooks described in PEP 302(5).\n\n*note importlib: 71. - The implementation of the import machinery\n\nPackage providing the relevant protocols for all importers to\nimplement.\n\nThis module defines an exception:\n\n-- Exception: zipimport.ZipImportError\n\nException raised by zipimporter objects.  It's a subclass of *note\nImportError: 145, so it can be caught as *note ImportError: 145,\ntoo.\n\n* Menu:\n\n* zipimporter Objects::\n* Examples: Examples<32>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/zipimport.py\n\n(2) https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT\n\n(3) https://peps.python.org/pep-0273/\n\n(4) https://peps.python.org/pep-0273/\n\n(5) https://peps.python.org/pep-0302/\n\nFile: python3.12.info,  Node: zipimporter Objects,  Next: Examples<32>,  Up: zipimport -- Import modules from Zip archives\n\n5.31.1.1 zipimporter Objects\n............................\n\n*note zipimporter: 4183. is the class for importing ZIP files.\n\n-- Class: zipimport.zipimporter (archivepath)\n\nCreate a new zipimporter instance.  'archivepath' must be a path to\na ZIP file, or to a specific path within a ZIP file.  For example,\nan 'archivepath' of 'foo/bar.zip/lib' will look for modules in the\n'lib' directory inside the ZIP file 'foo/bar.zip' (provided that it\nexists).\n\n*note ZipImportError: 4180. is raised if 'archivepath' doesn't\npoint to a valid ZIP archive.\n\nChanged in version 3.12: Methods 'findloader()' and\n'findmodule()', deprecated in 3.10 are now removed.  Use *note\nfindspec(): 658. instead.\n\n-- Method: createmodule (spec)\n\nImplementation of *note importlib.abc.Loader.createmodule():\nafd. that returns *note None: 43f. to explicitly request the\ndefault semantics.\n\nNew in version 3.10.\n\n-- Method: execmodule (module)\n\nImplementation of *note importlib.abc.Loader.execmodule():\n664.\n\nNew in version 3.10.\n\n-- Method: findspec (fullname, target=None)\n\nAn implementation of *note\nimportlib.abc.PathEntryFinder.findspec(): 667.\n\nNew in version 3.10.\n\n-- Method: getcode (fullname)\n\nReturn the code object for the specified module.  Raise *note\nZipImportError: 4180. if the module couldn't be imported.\n\n-- Method: getdata (pathname)\n\nReturn the data associated with 'pathname'.  Raise *note\nOSError: 613. if the file wasn't found.\n\nChanged in version 3.3: *note IOError: ecb. used to be raised,\nit is now an alias of *note OSError: 613.\n\n-- Method: getfilename (fullname)\n\nReturn the value 'file' would be set to if the specified\nmodule was imported.  Raise *note ZipImportError: 4180. if the\nmodule couldn't be imported.\n\nNew in version 3.1.\n\n-- Method: getsource (fullname)\n\nReturn the source code for the specified module.  Raise *note\nZipImportError: 4180. if the module couldn't be found, return\n*note None: 43f. if the archive does contain the module, but\nhas no source for it.\n\n-- Method: ispackage (fullname)\n\nReturn 'True' if the module specified by 'fullname' is a\npackage.  Raise *note ZipImportError: 4180. if the module\ncouldn't be found.\n\n-- Method: loadmodule (fullname)\n\nLoad the module specified by 'fullname'.  'fullname' must be\nthe fully qualified (dotted) module name.  Returns the\nimported module on success, raises *note ZipImportError: 4180.\non failure.\n\nDeprecated since version 3.10: Use *note execmodule(): 65a.\ninstead.\n\n-- Method: invalidatecaches ()\n\nClear out the internal cache of information about files found\nwithin the ZIP archive.\n\nNew in version 3.10.\n\n-- Attribute: archive\n\nThe file name of the importer's associated ZIP file, without a\npossible subpath.\n\n-- Attribute: prefix\n\nThe subpath within the ZIP file where modules are searched.\nThis is the empty string for zipimporter objects which point\nto the root of the ZIP file.\n\nThe *note archive: 418a. and *note prefix: 418b. attributes, when\ncombined with a slash, equal the original 'archivepath' argument\ngiven to the *note zipimporter: 4183. constructor.\n\nFile: python3.12.info,  Node: Examples<32>,  Prev: zipimporter Objects,  Up: zipimport -- Import modules from Zip archives\n\n5.31.1.2 Examples\n.................\n",
            "subsections": []
        },
        "Here is an example that imports a module from a ZIP archive - note that": {
            "content": "the *note zipimport: 12c. module is not explicitly used.\n\n$ unzip -l example.zip\nArchive:  example.zip\nLength     Date   Time    Name\n--------    ----   ----    ----\n8467  11-26-02 22:30   jwzthreading.py\n--------                   -------\n8467                   1 file\n$ ./python\nPython 2.3 (#1, Aug 1 2003, 19:54:32)\n>>> import sys\n>>> sys.path.insert(0, 'example.zip')  # Add .zip file to front of path\n>>> import jwzthreading\n>>> jwzthreading.file\n'example.zip/jwzthreading.py'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: pkgutil -- Package extension utility,  Next: modulefinder -- Find modules used by a script,  Prev: zipimport -- Import modules from Zip archives,  Up: Importing Modules": {
            "content": "'Source code:' Lib/pkgutil.py(1)\n\n\n",
            "subsections": []
        },
        "This module provides utilities for the import system, in particular": {
            "content": "package support.\n\n-- Class: pkgutil.ModuleInfo (modulefinder, name, ispkg)\n\nA namedtuple that holds a brief summary of a module's info.\n\nNew in version 3.6.\n\n-- Function: pkgutil.extendpath (path, name)\n\nExtend the search path for the modules which comprise a package.\nIntended use is to place the following code in a package's\n'init.py':\n\nfrom pkgutil import extendpath\npath = extendpath(path, name)\n\nFor each directory on *note sys.path: 32c. that has a subdirectory\nthat matches the package name, add the subdirectory to the\npackage's *note path: 19f3.  This is useful if one wants to\ndistribute different parts of a single logical package as multiple\ndirectories.\n\nIt also looks for '*.pkg' files beginning where '*' matches the\n'name' argument.  This feature is similar to '*.pth' files (see the\n*note site: c2. module for more information), except that it\ndoesn't special-case lines starting with 'import'.  A '*.pkg' file\nis trusted at face value: apart from checking for duplicates, all\nentries found in a '*.pkg' file are added to the path, regardless\nof whether they exist on the filesystem.  (This is a feature.)\n\nIf the input path is not a list (as is the case for frozen\npackages) it is returned unchanged.  The input path is not\nmodified; an extended copy is returned.  Items are only appended to\nthe copy at the end.\n\nIt is assumed that *note sys.path: 32c. is a sequence.  Items of\n*note sys.path: 32c. that are not strings referring to existing\ndirectories are ignored.  Unicode items on *note sys.path: 32c.\nthat cause errors when used as filenames may cause this function to\nraise an exception (in line with *note os.path.isdir(): 839.\nbehavior).\n\n-- Function: pkgutil.findloader (fullname)\n\nRetrieve a module *note loader: 13e6. for the given 'fullname'.\n\nThis is a backwards compatibility wrapper around *note\nimportlib.util.findspec(): 230. that converts most failures to\n*note ImportError: 145. and only returns the loader rather than the\nfull *note importlib.machinery.ModuleSpec: 1d07.\n\nChanged in version 3.3: Updated to be based directly on *note\nimportlib: 71. rather than relying on the package internal PEP\n302(2) import emulation.\n\nChanged in version 3.4: Updated to be based on PEP 451(3)\n\nDeprecated since version 3.12, will be removed in version 3.14: Use\n*note importlib.util.findspec(): 230. instead.\n\n-- Function: pkgutil.getimporter (pathitem)\n\nRetrieve a *note finder: 1cfc. for the given 'pathitem'.\n\nThe returned finder is cached in *note sys.pathimportercache:\n3a9. if it was newly created by a path hook.\n\nThe cache (or part of it) can be cleared manually if a rescan of\n*note sys.pathhooks: e9b. is necessary.\n\nChanged in version 3.3: Updated to be based directly on *note\nimportlib: 71. rather than relying on the package internal PEP\n302(4) import emulation.\n\n-- Function: pkgutil.getloader (moduleorname)\n\nGet a *note loader: 13e6. object for 'moduleorname'.\n\nIf the module or package is accessible via the normal import\nmechanism, a wrapper around the relevant part of that machinery is\nreturned.  Returns 'None' if the module cannot be found or\nimported.  If the named module is not already imported, its\ncontaining package (if any) is imported, in order to establish the\npackage 'path'.\n\nChanged in version 3.3: Updated to be based directly on *note\nimportlib: 71. rather than relying on the package internal PEP\n302(5) import emulation.\n\nChanged in version 3.4: Updated to be based on PEP 451(6)\n\nDeprecated since version 3.12, will be removed in version 3.14: Use\n*note importlib.util.findspec(): 230. instead.\n\n-- Function: pkgutil.iterimporters (fullname='')\n\nYield *note finder: 1cfc. objects for the given module name.\n\nIf fullname contains a ''.'', the finders will be for the package\ncontaining fullname, otherwise they will be all registered top\nlevel finders (i.e.  those on both *note sys.metapath: b80. and\n*note sys.pathhooks: e9b.).\n\nIf the named module is in a package, that package is imported as a\nside effect of invoking this function.\n\nIf no module name is specified, all top level finders are produced.\n\nChanged in version 3.3: Updated to be based directly on *note\nimportlib: 71. rather than relying on the package internal PEP\n302(7) import emulation.\n\n-- Function: pkgutil.itermodules (path=None, prefix='')\n\nYields *note ModuleInfo: ba4. for all submodules on 'path', or, if\n'path' is 'None', all top-level modules on *note sys.path: 32c.\n\n'path' should be either 'None' or a list of paths to look for\nmodules in.\n\n'prefix' is a string to output on the front of every module name on\noutput.\n\nNote: Only works for a *note finder: 1cfc. which defines an\n'itermodules()' method.  This interface is non-standard, so\nthe module also provides implementations for *note\nimportlib.machinery.FileFinder: ee9. and *note\nzipimport.zipimporter: 4183.\n\nChanged in version 3.3: Updated to be based directly on *note\nimportlib: 71. rather than relying on the package internal PEP\n302(8) import emulation.\n\n-- Function: pkgutil.walkpackages (path=None, prefix='', onerror=None)\n\nYields *note ModuleInfo: ba4. for all modules recursively on\n'path', or, if 'path' is 'None', all accessible modules.\n\n'path' should be either 'None' or a list of paths to look for\nmodules in.\n\n'prefix' is a string to output on the front of every module name on\noutput.\n\nNote that this function must import all 'packages' ('not' all\nmodules!)  on the given 'path', in order to access the 'path'\nattribute to find submodules.\n\n'onerror' is a function which gets called with one argument (the\nname of the package which was being imported) if any exception\noccurs while trying to import a package.  If no 'onerror' function\nis supplied, *note ImportError: 145.s are caught and ignored, while\nall other exceptions are propagated, terminating the search.\n\nExamples:\n\n# list all modules python can access\nwalkpackages()\n\n# list all submodules of ctypes\nwalkpackages(ctypes.path, ctypes.name + '.')\n\nNote: Only works for a *note finder: 1cfc. which defines an\n'itermodules()' method.  This interface is non-standard, so\nthe module also provides implementations for *note\nimportlib.machinery.FileFinder: ee9. and *note\nzipimport.zipimporter: 4183.\n\nChanged in version 3.3: Updated to be based directly on *note\nimportlib: 71. rather than relying on the package internal PEP\n302(9) import emulation.\n\n-- Function: pkgutil.getdata (package, resource)\n\nGet a resource from a package.\n\nThis is a wrapper for the *note loader: 13e6. *note getdata: 4193.\nAPI. The 'package' argument should be the name of a package, in\nstandard module format ('foo.bar').  The 'resource' argument should\nbe in the form of a relative filename, using '/' as the path\nseparator.  The parent directory name '..' is not allowed, and nor\nis a rooted name (starting with a '/').\n\nThe function returns a binary string that is the contents of the\nspecified resource.\n\nFor packages located in the filesystem, which have already been\nimported, this is the rough equivalent of:\n\nd = os.path.dirname(sys.modules[package].file)\ndata = open(os.path.join(d, resource), 'rb').read()\n\nIf the package cannot be located or loaded, or it uses a *note\nloader: 13e6. which does not support *note getdata: 4193, then\n'None' is returned.  In particular, the *note loader: 13e6. for\n*note namespace packages: 19ed. does not support *note getdata:\n4193.\n\n-- Function: pkgutil.resolvename (name)\n\nResolve a name to an object.\n\nThis functionality is used in numerous places in the standard\nlibrary (see bpo-12915(10)) - and equivalent functionality is also\nin widely used third-party packages such as setuptools, Django and\nPyramid.\n\nIt is expected that 'name' will be a string in one of the following\nformats, where W is shorthand for a valid Python identifier and dot\nstands for a literal period in these pseudo-regexes:\n\n* 'W(.W)*'\n\n* 'W(.W)*:(W(.W)*)?'\n\nThe first form is intended for backward compatibility only.  It\nassumes that some part of the dotted name is a package, and the\nrest is an object somewhere within that package, possibly nested\ninside other objects.  Because the place where the package stops\nand the object hierarchy starts can't be inferred by inspection,\nrepeated attempts to import must be done with this form.\n\nIn the second form, the caller makes the division point clear\nthrough the provision of a single colon: the dotted name to the\nleft of the colon is a package to be imported, and the dotted name\nto the right is the object hierarchy within that package.  Only one\nimport is needed in this form.  If it ends with the colon, then a\nmodule object is returned.\n\nThe function will return an object (which might be a module), or\nraise one of the following exceptions:\n\n*note ValueError: 183. - if 'name' isn't in a recognised format.\n\n*note ImportError: 145. - if an import failed when it shouldn't\nhave.\n\n*note AttributeError: 395. - If a failure occurred when traversing\nthe object hierarchy within the imported package to get to the\ndesired object.\n\nNew in version 3.9.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/pkgutil.py\n\n(2) https://peps.python.org/pep-0302/\n\n(3) https://peps.python.org/pep-0451/\n\n(4) https://peps.python.org/pep-0302/\n\n(5) https://peps.python.org/pep-0302/\n\n(6) https://peps.python.org/pep-0451/\n\n(7) https://peps.python.org/pep-0302/\n\n(8) https://peps.python.org/pep-0302/\n\n(9) https://peps.python.org/pep-0302/\n\n(10) https://bugs.python.org/issue?@action=redirect&bpo=12915\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: modulefinder -- Find modules used by a script,  Next: runpy -- Locating and executing Python modules,  Prev: pkgutil -- Package extension utility,  Up: Importing Modules": {
            "content": "'Source code:' Lib/modulefinder.py(1)\n\n\n\nThis module provides a *note ModuleFinder: 177b. class that can be used\nto determine the set of modules imported by a script.  'modulefinder.py'\ncan also be run as a script, giving the filename of a Python script as\nits argument, after which a report of the imported modules will be\nprinted.\n\n-- Function: modulefinder.AddPackagePath (pkgname, path)\n\nRecord that the package named 'pkgname' can be found in the\nspecified 'path'.\n\n-- Function: modulefinder.ReplacePackage (oldname, newname)\n\nAllows specifying that the module named 'oldname' is in fact the\npackage named 'newname'.\n\n-- Class: modulefinder.ModuleFinder (path=None, debug=0, excludes=[],\nreplacepaths=[])\n\nThis class provides *note runscript(): 4199. and *note report():\n419a. methods to determine the set of modules imported by a script.\n'path' can be a list of directories to search for modules; if not\nspecified, 'sys.path' is used.  'debug' sets the debugging level;\nhigher values make the class print debugging messages about what\nit's doing.  'excludes' is a list of module names to exclude from\nthe analysis.  'replacepaths' is a list of '(oldpath, newpath)'\ntuples that will be replaced in module paths.\n\n-- Method: report ()\n\nPrint a report to standard output that lists the modules\nimported by the script and their paths, as well as modules\nthat are missing or seem to be missing.\n\n-- Method: runscript (pathname)\n\nAnalyze the contents of the 'pathname' file, which must\ncontain Python code.\n\n-- Attribute: modules\n\nA dictionary mapping module names to modules.  See *note\nExample usage of ModuleFinder: 419c.\n\n* Menu:\n\n* Example usage of ModuleFinder::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/modulefinder.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Example usage of ModuleFinder,  Up: modulefinder -- Find modules used by a script": {
            "content": "5.31.3.1 Example usage of 'ModuleFinder'\n........................................\n\nThe script that is going to get analyzed later on (bacon.py):\n\nimport re, itertools\n\ntry:\nimport baconhameggs\nexcept ImportError:\npass\n\ntry:\nimport guido.python.ham\nexcept ImportError:\npass\n\nThe script that will output the report of bacon.py:\n\nfrom modulefinder import ModuleFinder\n\nfinder = ModuleFinder()\nfinder.runscript('bacon.py')\n\nprint('Loaded modules:')\nfor name, mod in finder.modules.items():\nprint('%s: ' % name, end='')\nprint(','.join(list(mod.globalnames.keys())[:3]))\n\nprint('-'*50)\nprint('Modules not imported:')\nprint('\\n'.join(finder.badmodules.keys()))\n\nSample output (may vary depending on the architecture):\n\nLoaded modules:\ntypes:\ncopyreg:  invertedregistry,slotnames,all\nre.compiler:  isstring,sre,optimizeunicode\nsre:\nre.constants:  REPEATONE,makedict,ATENDLINE\nsys:\nre:  module,finditer,expand\nitertools:\nmain:  re,itertools,baconhameggs\nre.parser:  PATTERNENDERS,SREFLAGUNICODE\narray:\nModules not imported:\nguido.python.ham\nbaconhameggs\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "'Source code:' Lib/runpy.py(1)\n\n\n\nThe *note runpy: b9. module is used to locate and run Python modules\nwithout importing them first.  Its main use is to implement the *note\n-m: 3a5. command line switch that allows scripts to be located using the\nPython module namespace rather than the filesystem.\n",
            "subsections": []
        },
        "Note that this is 'not' a sandbox module - all code is executed in the": {
            "content": "current process, and any side effects (such as cached imports of other\nmodules) will remain in place after the functions have returned.\n",
            "subsections": []
        },
        "Furthermore, any functions and classes defined by the executed code are": {
            "content": "not guaranteed to work correctly after a *note runpy: b9. function has\nreturned.  If that limitation is not acceptable for a given use case,\n*note importlib: 71. is likely to be a more suitable choice than this\nmodule.\n\nThe *note runpy: b9. module provides two functions:\n\n-- Function: runpy.runmodule (modname, initglobals=None,\nrunname=None, altersys=False)\n\nExecute the code of the specified module and return the resulting\nmodule globals dictionary.  The module's code is first located\nusing the standard import mechanism (refer to PEP 302(2) for\ndetails) and then executed in a fresh module namespace.\n\nThe 'modname' argument should be an absolute module name.  If the\nmodule name refers to a package rather than a normal module, then\nthat package is imported and the *note main: 1. submodule\nwithin that package is then executed and the resulting module\nglobals dictionary returned.\n\nThe optional dictionary argument 'initglobals' may be used to\npre-populate the module's globals dictionary before the code is\nexecuted.  The supplied dictionary will not be modified.  If any of\nthe special global variables below are defined in the supplied\ndictionary, those definitions are overridden by *note runmodule():\n156a.\n\nThe special global variables 'name', 'spec', 'file',\n'cached', 'loader' and 'package' are set in the globals\ndictionary before the module code is executed (Note that this is a\nminimal set of variables - other variables may be set implicitly as\nan interpreter implementation detail).\n\n'name' is set to 'runname' if this optional argument is not\n*note None: 43f, to 'modname + '.main'' if the named module is\na package and to the 'modname' argument otherwise.\n\n'spec' will be set appropriately for the 'actually' imported\nmodule (that is, 'spec.name' will always be 'modname' or\n'modname + '.main', never 'runname').\n\n'file', 'cached', 'loader' and 'package' are *note\nset as normal: 1d03. based on the module spec.\n\nIf the argument 'altersys' is supplied and evaluates to *note\nTrue: a53, then 'sys.argv[0]' is updated with the value of\n'file' and 'sys.modules[name]' is updated with a temporary\nmodule object for the module being executed.  Both 'sys.argv[0]'\nand 'sys.modules[name]' are restored to their original values\nbefore the function returns.\n\nNote that this manipulation of *note sys: d3. is not thread-safe.\nOther threads may see the partially initialised module, as well as\nthe altered list of arguments.  It is recommended that the 'sys'\nmodule be left alone when invoking this function from threaded\ncode.\n\nSee also\n........\n\nThe *note -m: 3a5. option offering equivalent functionality from\nthe command line.\n\nChanged in version 3.1: Added ability to execute packages by\nlooking for a *note main: 1. submodule.\n\nChanged in version 3.2: Added 'cached' global variable (see PEP\n3147(3)).\n\nChanged in version 3.4: Updated to take advantage of the module\nspec feature added by PEP 451(4).  This allows 'cached' to be\nset correctly for modules run this way, as well as ensuring the\nreal module name is always accessible as 'spec.name'.\n\nChanged in version 3.12: The setting of 'cached', 'loader',\nand 'package' are deprecated.  See *note ModuleSpec: 1d07. for\nalternatives.\n\n-- Function: runpy.runpath (pathname, initglobals=None,\nrunname=None)\n\nExecute the code at the named filesystem location and return the\nresulting module globals dictionary.  As with a script name\nsupplied to the CPython command line, the supplied path may refer\nto a Python source file, a compiled bytecode file or a valid *note\nsys.path: 32c. entry containing a *note main: 1. module (e.g.\na zipfile containing a top-level 'main.py' file).\n\nFor a simple script, the specified code is simply executed in a\nfresh module namespace.  For a valid *note sys.path: 32c. entry\n(typically a zipfile or directory), the entry is first added to the\nbeginning of 'sys.path'.  The function then looks for and executes\na *note main: 1. module using the updated path.  Note that\nthere is no special protection against invoking an existing\n'main' entry located elsewhere on 'sys.path' if there is no\nsuch module at the specified location.\n\nThe optional dictionary argument 'initglobals' may be used to\npre-populate the module's globals dictionary before the code is\nexecuted.  The supplied dictionary will not be modified.  If any of\nthe special global variables below are defined in the supplied\ndictionary, those definitions are overridden by *note runpath():\n1193.\n\nThe special global variables 'name', 'spec', 'file',\n'cached', 'loader' and 'package' are set in the globals\ndictionary before the module code is executed (Note that this is a\nminimal set of variables - other variables may be set implicitly as\nan interpreter implementation detail).\n\n'name' is set to 'runname' if this optional argument is not\n*note None: 43f. and to ''<runpath>'' otherwise.\n\nIf the supplied path directly references a script file (whether as\nsource or as precompiled byte code), then 'file' will be set to\nthe supplied path, and 'spec', 'cached', 'loader' and\n'package' will all be set to *note None: 43f.\n\nIf the supplied path is a reference to a valid *note sys.path: 32c.\nentry, then 'spec' will be set appropriately for the imported\n*note main: 1. module (that is, 'spec.name' will always be\n'main').  'file', 'cached', 'loader' and\n'package' will be *note set as normal: 1d03. based on the\nmodule spec.\n\nA number of alterations are also made to the *note sys: d3. module.\nFirstly, *note sys.path: 32c. may be altered as described above.\n'sys.argv[0]' is updated with the value of 'pathname' and\n'sys.modules[name]' is updated with a temporary module object\nfor the module being executed.  All modifications to items in *note\nsys: d3. are reverted before the function returns.\n\nNote that, unlike *note runmodule(): 156a, the alterations made to\n*note sys: d3. are not optional in this function as these\nadjustments are essential to allowing the execution of *note\nsys.path: 32c. entries.  As the thread-safety limitations still\napply, use of this function in threaded code should be either\nserialised with the import lock or delegated to a separate process.\n\nSee also\n........\n\n*note Interface options: 1aac. for equivalent functionality on the\ncommand line ('python path/to/script').\n\nNew in version 3.2.\n\nChanged in version 3.4: Updated to take advantage of the module\nspec feature added by PEP 451(5).  This allows 'cached' to be\nset correctly in the case where 'main' is imported from a valid\n*note sys.path: 32c. entry rather than being executed directly.\n\nChanged in version 3.12: The setting of 'cached', 'loader',\nand 'package' are deprecated.\n\nSee also\n........\n\nPEP 338(6) - Executing modules as scripts\n\nPEP written and implemented by Nick Coghlan.\n\nPEP 366(7) - Main module explicit relative imports\n\nPEP written and implemented by Nick Coghlan.\n\nPEP 451(8) - A ModuleSpec Type for the Import System\n\nPEP written and implemented by Eric Snow\n\n*note Command line and environment: 172e. - CPython command line details\n\nThe *note importlib.importmodule(): 26a. function\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/runpy.py\n\n(2) https://peps.python.org/pep-0302/\n\n(3) https://peps.python.org/pep-3147/\n\n(4) https://peps.python.org/pep-0451/\n\n(5) https://peps.python.org/pep-0451/\n\n(6) https://peps.python.org/pep-0338/\n\n(7) https://peps.python.org/pep-0366/\n\n(8) https://peps.python.org/pep-0451/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "New in version 3.1.\n\n'Source code:' Lib/importlib/init.py(1)\n\n\n\n* Menu:\n\n* Introduction: Introduction<10>.\n* Functions: Functions<12>.\n* importlib.abc - Abstract base classes related to import: importlib abc - Abstract base classes related to import.\n* importlib.machinery - Importers and path hooks: importlib machinery - Importers and path hooks.\n* importlib.util - Utility code for importers: importlib util - Utility code for importers.\n* Examples: Examples<33>.\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/importlib/init.py\n\nFile: python3.12.info,  Node: Introduction<10>,  Next: Functions<12>,  Up: importlib -- The implementation of import\n\n5.31.5.1 Introduction\n.....................\n\nThe purpose of the *note importlib: 71. package is three-fold.\n\nOne is to provide the implementation of the *note import: 3a6. statement\n(and thus, by extension, the *note import(): 6ed. function) in",
            "subsections": []
        },
        "Python source code.  This provides an implementation of 'import' which": {
            "content": "is portable to any Python interpreter.  This also provides an\nimplementation which is easier to comprehend than one implemented in a\nprogramming language other than Python.\n\nTwo, the components to implement *note import: 3a6. are exposed in this\npackage, making it easier for users to create their own custom objects\n(known generically as an *note importer: 1cfd.) to participate in the\nimport process.\n",
            "subsections": []
        },
        "Three, the package contains modules exposing additional functionality": {
            "content": "for managing aspects of Python packages:\n\n* *note importlib.metadata: 74. presents access to metadata from\nthird-party distributions.\n\n* *note importlib.resources: 75. provides routines for accessing\nnon-code \"resources\" from Python packages.\n\nSee also\n........\n\n*note The import statement: 3a6.\n\nThe language reference for the *note import: 3a6. statement.\n",
            "subsections": []
        },
        "Packages specification(1)": {
            "content": "Original specification of packages.  Some semantics have changed\nsince the writing of this document (e.g.  redirecting based on\n'None' in *note sys.modules: 16d7.).\n\nThe *note import(): ee4. function\n\nThe *note import: 3a6. statement is syntactic sugar for this\nfunction.\n\n*note The initialization of the sys.path module search path: 19e5.\n\nThe initialization of *note sys.path: 32c.\n\nPEP 235(2)\n\nImport on Case-Insensitive Platforms\n\nPEP 263(3)\n\nDefining Python Source Code Encodings\n\nPEP 302(4)\n\nNew Import Hooks\n\nPEP 328(5)\n\nImports: Multi-Line and Absolute/Relative\n\nPEP 366(6)\n\nMain module explicit relative imports\n\nPEP 420(7)\n\nImplicit namespace packages\n\nPEP 451(8)\n\nA ModuleSpec Type for the Import System\n\nPEP 488(9)\n\nElimination of PYO files\n\nPEP 489(10)\n\nMulti-phase extension module initialization\n\nPEP 552(11)\n\nDeterministic pycs\n\nPEP 3120(12)\n\nUsing UTF-8 as the Default Source Encoding\n\nPEP 3147(13)\n\nPYC Repository Directories\n\n---------- Footnotes ----------\n\n(1) https://www.python.org/doc/essays/packages/\n\n(2) https://peps.python.org/pep-0235/\n\n(3) https://peps.python.org/pep-0263/\n\n(4) https://peps.python.org/pep-0302/\n\n(5) https://peps.python.org/pep-0328/\n\n(6) https://peps.python.org/pep-0366/\n\n(7) https://peps.python.org/pep-0420/\n\n(8) https://peps.python.org/pep-0451/\n\n(9) https://peps.python.org/pep-0488/\n\n(10) https://peps.python.org/pep-0489/\n\n(11) https://peps.python.org/pep-0552/\n\n(12) https://peps.python.org/pep-3120/\n\n(13) https://peps.python.org/pep-3147/\n\nFile: python3.12.info,  Node: Functions<12>,  Next: importlib abc - Abstract base classes related to import,  Prev: Introduction<10>,  Up: importlib -- The implementation of import\n\n5.31.5.2 Functions\n..................\n\n-- Function: importlib.import (name, globals=None, locals=None,\nfromlist=(), level=0)\n\nAn implementation of the built-in *note import(): 6ed.\nfunction.\n\nNote: Programmatic importing of modules should use *note\nimportmodule(): 26a. instead of this function.\n\n-- Function: importlib.importmodule (name, package=None)\n\nImport a module.  The 'name' argument specifies what module to\nimport in absolute or relative terms (e.g.  either 'pkg.mod' or\n'..mod').  If the name is specified in relative terms, then the\n'package' argument must be set to the name of the package which is\nto act as the anchor for resolving the package name (e.g.\n'importmodule('..mod', 'pkg.subpkg')' will import 'pkg.mod').\n\nThe *note importmodule(): 26a. function acts as a simplifying\nwrapper around *note importlib.import(): ee4.  This means all\nsemantics of the function are derived from *note\nimportlib.import(): ee4.  The most important difference between\nthese two functions is that *note importmodule(): 26a. returns the\nspecified package or module (e.g.  'pkg.mod'), while *note\nimport(): 6ed. returns the top-level package or module (e.g.\n'pkg').\n\nIf you are dynamically importing a module that was created since\nthe interpreter began execution (e.g., created a Python source\nfile), you may need to call *note invalidatecaches(): a56. in\norder for the new module to be noticed by the import system.\n\nChanged in version 3.3: Parent packages are automatically imported.\n\n-- Function: importlib.invalidatecaches ()\n\nInvalidate the internal caches of finders stored at *note\nsys.metapath: b80.  If a finder implements 'invalidatecaches()'\nthen it will be called to perform the invalidation.  This function\nshould be called if any modules are created/installed while your\nprogram is running to guarantee all finders will notice the new\nmodule's existence.\n\nNew in version 3.3.\n\nChanged in version 3.10: Namespace packages created/installed in a\ndifferent *note sys.path: 32c. location after the same namespace\nwas already imported are noticed.\n\n-- Function: importlib.reload (module)\n\nReload a previously imported 'module'.  The argument must be a\nmodule object, so it must have been successfully imported before.\nThis is useful if you have edited the module source file using an\nexternal editor and want to try out the new version without leaving\nthe Python interpreter.  The return value is the module object\n(which can be different if re-importing causes a different object\nto be placed in *note sys.modules: 16d7.).\n\nWhen *note reload(): 26b. is executed:\n\n* Python module's code is recompiled and the module-level code\nre-executed, defining a new set of objects which are bound to\nnames in the module's dictionary by reusing the *note loader:\n13e6. which originally loaded the module.  The 'init' function\nof extension modules is not called a second time.\n\n* As with all other objects in Python the old objects are only\nreclaimed after their reference counts drop to zero.\n\n* The names in the module namespace are updated to point to any\nnew or changed objects.\n\n* Other references to the old objects (such as names external to\nthe module) are not rebound to refer to the new objects and\nmust be updated in each namespace where they occur if that is\ndesired.\n\nThere are a number of other caveats:\n\nWhen a module is reloaded, its dictionary (containing the module's\nglobal variables) is retained.  Redefinitions of names will\noverride the old definitions, so this is generally not a problem.\nIf the new version of a module does not define a name that was\ndefined by the old version, the old definition remains.  This\nfeature can be used to the module's advantage if it maintains a\nglobal table or cache of objects -- with a *note try: 4bc. statement\nit can test for the table's presence and skip its initialization if\ndesired:\n\ntry:\ncache\nexcept NameError:\ncache = {}\n\nIt is generally not very useful to reload built-in or dynamically\nloaded modules.  Reloading *note sys: d3, *note main: 1, *note\nbuiltins: 10. and other key modules is not recommended.  In many\ncases extension modules are not designed to be initialized more\nthan once, and may fail in arbitrary ways when reloaded.\n\nIf a module imports objects from another module using *note from:\n1123. ... *note import: 3a6. ..., calling *note reload(): 26b. for the\nother module does not redefine the objects imported from it -- one\nway around this is to re-execute the 'from' statement, another is\nto use 'import' and qualified names ('module.name') instead.\n\nIf a module instantiates instances of a class, reloading the module\nthat defines the class does not affect the method definitions of\nthe instances -- they continue to use the old class definition.  The\nsame is true for derived classes.\n\nNew in version 3.4.\n\nChanged in version 3.7: *note ModuleNotFoundError: 981. is raised\nwhen the module being reloaded lacks a *note ModuleSpec: 1d07.\n\nFile: python3.12.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\n\n5.31.5.3 'importlib.abc' - Abstract base classes related to import\n..................................................................\n\n'Source code:' Lib/importlib/abc.py(1)\n\n\n\nThe *note importlib.abc: 72. module contains all of the core abstract\nbase classes used by *note import: 3a6.  Some subclasses of the core\nabstract base classes are also provided to help in implementing the core\nABCs.\n\nABC hierarchy:\n\nobject\n+-- MetaPathFinder\n+-- PathEntryFinder\n+-- Loader\n+-- ResourceLoader --------+\n+-- InspectLoader          |\n+-- ExecutionLoader --+\n+-- FileLoader\n+-- SourceLoader\n\n-- Class: importlib.abc.MetaPathFinder\n\nAn abstract base class representing a *note meta path finder: ee7.\n\nNew in version 3.3.\n\nChanged in version 3.10: No longer a subclass of 'Finder'.\n\n-- Method: findspec (fullname, path, target=None)\n\nAn abstract method for finding a *note spec: 4021. for the\nspecified module.  If this is a top-level import, 'path' will\nbe 'None'.  Otherwise, this is a search for a subpackage or\nmodule and 'path' will be the value of *note path: 19f3.\nfrom the parent package.  If a spec cannot be found, 'None' is\nreturned.  When passed in, 'target' is a module object that\nthe finder may use to make a more educated guess about what\nspec to return.  *note importlib.util.specfromloader(): 668.\nmay be useful for implementing concrete 'MetaPathFinders'.\n\nNew in version 3.4.\n\n-- Method: invalidatecaches ()\n\nAn optional method which, when called, should invalidate any\ninternal cache used by the finder.  Used by *note\nimportlib.invalidatecaches(): a56. when invalidating the\ncaches of all finders on *note sys.metapath: b80.\n\nChanged in version 3.4: Returns 'None' when called instead of\n*note NotImplemented: 5c5.\n\n-- Class: importlib.abc.PathEntryFinder\n\nAn abstract base class representing a *note path entry finder: ee8.\nThough it bears some similarities to *note MetaPathFinder: 669,\n'PathEntryFinder' is meant for use only within the path-based\nimport subsystem provided by *note importlib.machinery.PathFinder:\ne9a.\n\nNew in version 3.3.\n\nChanged in version 3.10: No longer a subclass of 'Finder'.\n\n-- Method: findspec (fullname, target=None)\n\nAn abstract method for finding a *note spec: 4021. for the\nspecified module.  The finder will search for the module only\nwithin the *note path entry: 1d12. to which it is assigned.\nIf a spec cannot be found, 'None' is returned.  When passed\nin, 'target' is a module object that the finder may use to\nmake a more educated guess about what spec to return.  *note\nimportlib.util.specfromloader(): 668. may be useful for\nimplementing concrete 'PathEntryFinders'.\n\nNew in version 3.4.\n\n-- Method: invalidatecaches ()\n\nAn optional method which, when called, should invalidate any\ninternal cache used by the finder.  Used by *note\nimportlib.machinery.PathFinder.invalidatecaches(): a55. when\ninvalidating the caches of all cached finders.\n\n-- Class: importlib.abc.Loader\n\nAn abstract base class for a *note loader: 13e6.  See PEP 302(2)\nfor the exact definition for a loader.\n\nLoaders that wish to support resource reading should implement a\n'getresourcereader()' method as specified by *note\nimportlib.resources.abc.ResourceReader: 41a7.\n\nChanged in version 3.7: Introduced the optional\n'getresourcereader()' method.\n\n-- Method: createmodule (spec)\n\nA method that returns the module object to use when importing\na module.  This method may return 'None', indicating that\ndefault module creation semantics should take place.\n\nNew in version 3.4.\n\nChanged in version 3.6: This method is no longer optional when\n*note execmodule(): 664. is defined.\n\n-- Method: execmodule (module)\n\nAn abstract method that executes the module in its own\nnamespace when a module is imported or reloaded.  The module\nshould already be initialized when *note execmodule(): 664.\nis called.  When this method exists, *note createmodule():\nafd. must be defined.\n\nNew in version 3.4.\n\nChanged in version 3.6: *note createmodule(): afd. must also\nbe defined.\n\n-- Method: loadmodule (fullname)\n\nA legacy method for loading a module.  If the module cannot be\nloaded, *note ImportError: 145. is raised, otherwise the\nloaded module is returned.\n\nIf the requested module already exists in *note sys.modules:\n16d7, that module should be used and reloaded.  Otherwise the\nloader should create a new module and insert it into *note\nsys.modules: 16d7. before any loading begins, to prevent\nrecursion from the import.  If the loader inserted a module\nand the load fails, it must be removed by the loader from\n*note sys.modules: 16d7.; modules already in *note\nsys.modules: 16d7. before the loader began execution should be\nleft alone.\n\nThe loader should set several attributes on the module (note\nthat some of these attributes can change when a module is\nreloaded):\n\n-\n*note name: 11fd.\n\nThe module's fully qualified name.  It is\n''main'' for an executed module.\n\n-\n*note file: 1c32.\n\nThe location the *note loader: 13e6. used to load\nthe module.  For example, for modules loaded from a\n.py file this is the filename.  It is not set on all\nmodules (e.g.  built-in modules).\n\n-\n*note cached: 1029.\n\nThe filename of a compiled version of the module's\ncode.  It is not set on all modules (e.g.  built-in\nmodules).\n\n-\n*note path: 19f3.\n\nThe list of locations where the package's submodules\nwill be found.  Most of the time this is a single\ndirectory.  The import system passes this attribute\nto 'import()' and to finders in the same way as\n*note sys.path: 32c. but just for the package.  It\nis not set on non-package modules so it can be used\nas an indicator that the module is a package.\n\n-\n*note package: e94.\n\nThe fully qualified name of the package the module\nis in (or the empty string for a top-level module).\nIf the module is a package then this is the same as\n*note name: 11fd.\n\n-\n*note loader: e95.\n\nThe *note loader: 13e6. used to load the module.\n\nWhen *note execmodule(): 664. is available then\nbackwards-compatible functionality is provided.\n\nChanged in version 3.4: Raise *note ImportError: 145. when\ncalled instead of *note NotImplementedError: ba5.\nFunctionality provided when *note execmodule(): 664. is\navailable.\n\nDeprecated since version 3.4: The recommended API for loading\na module is *note execmodule(): 664. (and *note\ncreatemodule(): afd.).  Loaders should implement it instead\nof *note loadmodule(): 663.  The import machinery takes care\nof all the other responsibilities of *note loadmodule(): 663.\nwhen *note execmodule(): 664. is implemented.\n\n-- Class: importlib.abc.ResourceLoader\n\nAn abstract base class for a *note loader: 13e6. which implements\nthe optional PEP 302(3) protocol for loading arbitrary resources\nfrom the storage back-end.\n\nDeprecated since version 3.7: This ABC is deprecated in favour of\nsupporting resource loading through *note\nimportlib.resources.abc.ResourceReader: 41a7.\n\n-- Method: abstractmethod getdata (path)\n\nAn abstract method to return the bytes for the data located at\n'path'.  Loaders that have a file-like storage back-end that\nallows storing arbitrary data can implement this abstract\nmethod to give direct access to the data stored.  *note\nOSError: 613. is to be raised if the 'path' cannot be found.\nThe 'path' is expected to be constructed using a module's\n*note file: 1c32. attribute or an item from a package's\n*note path: 19f3.\n\nChanged in version 3.4: Raises *note OSError: 613. instead of\n*note NotImplementedError: ba5.\n\n-- Class: importlib.abc.InspectLoader\n\nAn abstract base class for a *note loader: 13e6. which implements\nthe optional PEP 302(4) protocol for loaders that inspect modules.\n\n-- Method: getcode (fullname)\n\nReturn the code object for a module, or 'None' if the module\ndoes not have a code object (as would be the case, for\nexample, for a built-in module).  Raise an *note ImportError:\n145. if loader cannot find the requested module.\n\nNote: While the method has a default implementation, it\nis suggested that it be overridden if possible for\nperformance.\n\nChanged in version 3.4: No longer abstract and a concrete\nimplementation is provided.\n\n-- Method: abstractmethod getsource (fullname)\n\nAn abstract method to return the source of a module.  It is\nreturned as a text string using *note universal newlines: b90,\ntranslating all recognized line separators into ''\\n''\ncharacters.  Returns 'None' if no source is available (e.g.  a\nbuilt-in module).  Raises *note ImportError: 145. if the\nloader cannot find the module specified.\n\nChanged in version 3.4: Raises *note ImportError: 145. instead\nof *note NotImplementedError: ba5.\n\n-- Method: ispackage (fullname)\n\nAn optional method to return a true value if the module is a\npackage, a false value otherwise.  *note ImportError: 145. is\nraised if the *note loader: 13e6. cannot find the module.\n\nChanged in version 3.4: Raises *note ImportError: 145. instead\nof *note NotImplementedError: ba5.\n\n-- Method: static sourcetocode (data, path='<string>')\n\nCreate a code object from Python source.\n\nThe 'data' argument can be whatever the *note compile(): 528.\nfunction supports (i.e.  string or bytes).  The 'path'\nargument should be the \"path\" to where the source code\noriginated from, which can be an abstract concept (e.g.\nlocation in a zip file).\n\nWith the subsequent code object one can execute it in a module\nby running 'exec(code, module.dict)'.\n\nNew in version 3.4.\n\nChanged in version 3.5: Made the method static.\n\n-- Method: execmodule (module)\n\nImplementation of *note Loader.execmodule(): 664.\n\nNew in version 3.4.\n\n-- Method: loadmodule (fullname)\n\nImplementation of *note Loader.loadmodule(): 663.\n\nDeprecated since version 3.4: use *note execmodule(): e86.\ninstead.\n\n-- Class: importlib.abc.ExecutionLoader\n\nAn abstract base class which inherits from *note InspectLoader:\ndc4. that, when implemented, helps a module to be executed as a\nscript.  The ABC represents an optional PEP 302(5) protocol.\n\n-- Method: abstractmethod getfilename (fullname)\n\nAn abstract method that is to return the value of *note\nfile: 1c32. for the specified module.  If no path is\navailable, *note ImportError: 145. is raised.\n\nIf source code is available, then the method should return the\npath to the source file, regardless of whether a bytecode was\nused to load the module.\n\nChanged in version 3.4: Raises *note ImportError: 145. instead\nof *note NotImplementedError: ba5.\n\n-- Class: importlib.abc.FileLoader (fullname, path)\n\nAn abstract base class which inherits from *note ResourceLoader:\na2c. and *note ExecutionLoader: 41aa, providing concrete\nimplementations of *note ResourceLoader.getdata(): 4193. and *note\nExecutionLoader.getfilename(): 41ab.\n\nThe 'fullname' argument is a fully resolved name of the module the\nloader is to handle.  The 'path' argument is the path to the file\nfor the module.\n\nNew in version 3.3.\n\n-- Attribute: name\n\nThe name of the module the loader can handle.\n\n-- Attribute: path\n\nPath to the file of the module.\n\n-- Method: loadmodule (fullname)\n\nCalls super's 'loadmodule()'.\n\nDeprecated since version 3.4: Use *note Loader.execmodule():\n664. instead.\n\n-- Method: abstractmethod getfilename (fullname)\n\nReturns *note path: 41ad.\n\n-- Method: abstractmethod getdata (path)\n\nReads 'path' as a binary file and returns the bytes from it.\n\n-- Class: importlib.abc.SourceLoader\n\nAn abstract base class for implementing source (and optionally\nbytecode) file loading.  The class inherits from both *note\nResourceLoader: a2c. and *note ExecutionLoader: 41aa, requiring the\nimplementation of:\n\n* *note ResourceLoader.getdata(): 4193.\n\n*\n*note ExecutionLoader.getfilename(): 41ab.\n\nShould only return the path to the source file;\nsourceless loading is not supported.\n\nThe abstract methods defined by this class are to add optional\nbytecode file support.  Not implementing these optional methods (or\ncausing them to raise *note NotImplementedError: ba5.) causes the\nloader to only work with source code.  Implementing the methods\nallows the loader to work with source 'and' bytecode files; it does\nnot allow for 'sourceless' loading where only bytecode is provided.\nBytecode files are an optimization to speed up loading by removing\nthe parsing step of Python's compiler, and so no bytecode-specific\nAPI is exposed.\n\n-- Method: pathstats (path)\n\nOptional abstract method which returns a *note dict: 237.\ncontaining metadata about the specified path.  Supported\ndictionary keys are:\n\n- ''mtime'' (mandatory): an integer or floating-point\nnumber representing the modification time of the source\ncode;\n\n- ''size'' (optional): the size in bytes of the source\ncode.\n\nAny other keys in the dictionary are ignored, to allow for\nfuture extensions.  If the path cannot be handled, *note\nOSError: 613. is raised.\n\nNew in version 3.3.\n\nChanged in version 3.4: Raise *note OSError: 613. instead of\n*note NotImplementedError: ba5.\n\n-- Method: pathmtime (path)\n\nOptional abstract method which returns the modification time\nfor the specified path.\n\nDeprecated since version 3.3: This method is deprecated in\nfavour of *note pathstats(): 1000.  You don't have to\nimplement it, but it is still available for compatibility\npurposes.  Raise *note OSError: 613. if the path cannot be\nhandled.\n\nChanged in version 3.4: Raise *note OSError: 613. instead of\n*note NotImplementedError: ba5.\n\n-- Method: setdata (path, data)\n\nOptional abstract method which writes the specified bytes to a\nfile path.  Any intermediate directories which do not exist\nare to be created automatically.\n\nWhen writing to the path fails because the path is read-only\n(*note errno.EACCES: 1fbc./*note PermissionError: b9a.), do\nnot propagate the exception.\n\nChanged in version 3.4: No longer raises *note\nNotImplementedError: ba5. when called.\n\n-- Method: getcode (fullname)\n\nConcrete implementation of *note InspectLoader.getcode():\ndc5.\n\n-- Method: execmodule (module)\n\nConcrete implementation of *note Loader.execmodule(): 664.\n\nNew in version 3.4.\n\n-- Method: loadmodule (fullname)\n\nConcrete implementation of *note Loader.loadmodule(): 663.\n\nDeprecated since version 3.4: Use *note execmodule(): e87.\ninstead.\n\n-- Method: getsource (fullname)\n\nConcrete implementation of *note InspectLoader.getsource():\ndc8.\n\n-- Method: ispackage (fullname)\n\nConcrete implementation of *note InspectLoader.ispackage():\n41a8.  A module is determined to be a package if its file path\n(as provided by *note ExecutionLoader.getfilename(): 41ab.)\nis a file named 'init' when the file extension is removed\n'and' the module name itself does not end in 'init'.\n\n-- Class: importlib.abc.ResourceReader\n\n'Superseded by TraversableResources'\n\nAn *note abstract base class: 102a. to provide the ability to read\n'resources'.\n\nFrom the perspective of this ABC, a 'resource' is a binary artifact\nthat is shipped within a package.  Typically this is something like\na data file that lives next to the 'init.py' file of the\npackage.  The purpose of this class is to help abstract out the\naccessing of such data files so that it does not matter if the\npackage and its data file(s) are stored in a e.g.  zip file versus\non the file system.\n\nFor any of methods of this class, a 'resource' argument is expected\nto be a *note path-like object: 957. which represents conceptually\njust a file name.  This means that no subdirectory paths should be\nincluded in the 'resource' argument.  This is because the location\nof the package the reader is for, acts as the \"directory\".  Hence\nthe metaphor for directories and file names is packages and\nresources, respectively.  This is also why instances of this class\nare expected to directly correlate to a specific package (instead\nof potentially representing multiple packages or a module).\n\nLoaders that wish to support resource reading are expected to\nprovide a method called 'getresourcereader(fullname)' which\nreturns an object implementing this ABC's interface.  If the module\nspecified by fullname is not a package, this method should return\n*note None: 43f.  An object compatible with this ABC should only be\nreturned when the specified module is a package.\n\nNew in version 3.7.\n\nDeprecated since version 3.12, will be removed in version 3.14: Use\n*note importlib.resources.abc.TraversableResources: 22a. instead.\n\n-- Method: abstractmethod openresource (resource)\n\nReturns an opened, *note file-like object: 229a. for binary\nreading of the 'resource'.\n\nIf the resource cannot be found, *note FileNotFoundError: 353.\nis raised.\n\n-- Method: abstractmethod resourcepath (resource)\n\nReturns the file system path to the 'resource'.\n\nIf the resource does not concretely exist on the file system,\nraise *note FileNotFoundError: 353.\n\n-- Method: abstractmethod isresource (name)\n\nReturns 'True' if the named 'name' is considered a resource.\n*note FileNotFoundError: 353. is raised if 'name' does not\nexist.\n\n-- Method: abstractmethod contents ()\n\nReturns an *note iterable: 109d. of strings over the contents\nof the package.  Do note that it is not required that all\nnames returned by the iterator be actual resources, e.g.  it\nis acceptable to return names for which *note isresource():\n41b8. would be false.\n\nAllowing non-resource names to be returned is to allow for\nsituations where how a package and its resources are stored\nare known a priori and the non-resource names would be useful.\nFor instance, returning subdirectory names is allowed so that\nwhen it is known that the package and resources are stored on\nthe file system then those subdirectory names can be used\ndirectly.\n\nThe abstract method returns an iterable of no items.\n\n-- Class: importlib.abc.Traversable\n\nAn object with a subset of *note pathlib.Path: 149. methods\nsuitable for traversing directories and opening files.\n\nFor a representation of the object on the file-system, use *note\nimportlib.resources.asfile(): 1aa.\n\nNew in version 3.9.\n\nDeprecated since version 3.12, will be removed in version 3.14: Use\n*note importlib.resources.abc.Traversable: 229. instead.\n\n-- Attribute: name\n\nAbstract.  The base name of this object without any parent\nreferences.\n\n-- Method: abstractmethod iterdir ()\n\nYield 'Traversable' objects in 'self'.\n\n-- Method: abstractmethod isdir ()\n\nReturn 'True' if 'self' is a directory.\n\n-- Method: abstractmethod isfile ()\n\nReturn 'True' if 'self' is a file.\n\n-- Method: abstractmethod joinpath (child)\n\nReturn Traversable child in 'self'.\n\n-- Method: abstractmethod truediv (child)\n\nReturn 'Traversable' child in 'self'.\n\n-- Method: abstractmethod open (mode='r', *args, kwargs)\n\n'mode' may be 'r' or 'rb' to open as text or binary.  Return a\nhandle suitable for reading (same as *note pathlib.Path.open:\n24bd.).\n\nWhen opening as text, accepts encoding parameters such as\nthose accepted by *note io.TextIOWrapper: b8f.\n\n-- Method: readbytes ()\n\nRead contents of 'self' as bytes.\n\n-- Method: readtext (encoding=None)\n\nRead contents of 'self' as text.\n\n-- Class: importlib.abc.TraversableResources\n\nAn abstract base class for resource readers capable of serving the\n*note importlib.resources.files(): 1ab. interface.  Subclasses\n*note importlib.resources.abc.ResourceReader: 41a7. and provides\nconcrete implementations of the *note\nimportlib.resources.abc.ResourceReader: 41a7.'s abstract methods.\nTherefore, any loader supplying *note\nimportlib.abc.TraversableResources: 15e5. also supplies\nResourceReader.\n\nLoaders that wish to support resource reading are expected to\nimplement this interface.\n\nNew in version 3.9.\n\nDeprecated since version 3.12, will be removed in version 3.14: Use\n*note importlib.resources.abc.TraversableResources: 22a. instead.\n\n-- Method: abstractmethod files ()\n\nReturns a *note importlib.resources.abc.Traversable: 229.\nobject for the loaded package.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/importlib/abc.py\n\n(2) https://peps.python.org/pep-0302/\n\n(3) https://peps.python.org/pep-0302/\n\n(4) https://peps.python.org/pep-0302/\n\n(5) https://peps.python.org/pep-0302/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "5.31.5.4 'importlib.machinery' - Importers and path hooks\n.........................................................\n\n'Source code:' Lib/importlib/machinery.py(1)\n\n\n\nThis module contains the various objects that help *note import: 3a6.\nfind and load modules.\n\n-- Attribute: importlib.machinery.SOURCESUFFIXES\n\nA list of strings representing the recognized file suffixes for\nsource modules.\n\nNew in version 3.3.\n\n-- Attribute: importlib.machinery.DEBUGBYTECODESUFFIXES\n\nA list of strings representing the file suffixes for non-optimized\nbytecode modules.\n\nNew in version 3.3.\n\nDeprecated since version 3.5: Use *note BYTECODESUFFIXES: 268.\ninstead.\n\n-- Attribute: importlib.machinery.OPTIMIZEDBYTECODESUFFIXES\n\nA list of strings representing the file suffixes for optimized\nbytecode modules.\n\nNew in version 3.3.\n\nDeprecated since version 3.5: Use *note BYTECODESUFFIXES: 268.\ninstead.\n\n-- Attribute: importlib.machinery.BYTECODESUFFIXES\n\nA list of strings representing the recognized file suffixes for\nbytecode modules (including the leading dot).\n\nNew in version 3.3.\n\nChanged in version 3.5: The value is no longer dependent on\n'debug'.\n\n-- Attribute: importlib.machinery.EXTENSIONSUFFIXES\n\nA list of strings representing the recognized file suffixes for\nextension modules.\n\nNew in version 3.3.\n\n-- Function: importlib.machinery.allsuffixes ()\n\nReturns a combined list of strings representing all file suffixes\nfor modules recognized by the standard import machinery.  This is a\nhelper for code which simply needs to know if a filesystem path\npotentially refers to a module without needing any details on the\nkind of module (for example, *note inspect.getmodulename(): b8e.).\n\nNew in version 3.3.\n\n-- Class: importlib.machinery.BuiltinImporter\n\nAn *note importer: 1cfd. for built-in modules.  All known built-in\nmodules are listed in *note sys.builtinmodulenames: 19e4.  This\nclass implements the *note importlib.abc.MetaPathFinder: 669. and\n*note importlib.abc.InspectLoader: dc4. ABCs.\n\nOnly class methods are defined by this class to alleviate the need\nfor instantiation.\n\nChanged in version 3.5: As part of PEP 489(2), the builtin importer\nnow implements 'Loader.createmodule()' and 'Loader.execmodule()'\n\n-- Class: importlib.machinery.FrozenImporter\n\nAn *note importer: 1cfd. for frozen modules.  This class implements\nthe *note importlib.abc.MetaPathFinder: 669. and *note\nimportlib.abc.InspectLoader: dc4. ABCs.\n\nOnly class methods are defined by this class to alleviate the need\nfor instantiation.\n\nChanged in version 3.4: Gained 'createmodule()' and\n'execmodule()' methods.\n\n-- Class: importlib.machinery.WindowsRegistryFinder\n\n*note Finder: 1cfc. for modules declared in the Windows registry.\nThis class implements the *note importlib.abc.MetaPathFinder: 669.\nABC.\n\nOnly class methods are defined by this class to alleviate the need\nfor instantiation.\n\nNew in version 3.3.\n\nDeprecated since version 3.6: Use *note site: c2. configuration\ninstead.  Future versions of Python may not enable this finder by\ndefault.\n\n-- Class: importlib.machinery.PathFinder\n\nA *note Finder: 1cfc. for *note sys.path: 32c. and package\n'path' attributes.  This class implements the *note\nimportlib.abc.MetaPathFinder: 669. ABC.\n\nOnly class methods are defined by this class to alleviate the need\nfor instantiation.\n\n-- Method: classmethod findspec (fullname, path=None,\ntarget=None)\n\nClass method that attempts to find a *note spec: 4021. for the\nmodule specified by 'fullname' on *note sys.path: 32c. or, if\ndefined, on 'path'.  For each path entry that is searched,\n*note sys.pathimportercache: 3a9. is checked.  If a\nnon-false object is found then it is used as the *note path\nentry finder: ee8. to look for the module being searched for.\nIf no entry is found in *note sys.pathimportercache: 3a9,\nthen *note sys.pathhooks: e9b. is searched for a finder for\nthe path entry and, if found, is stored in *note\nsys.pathimportercache: 3a9. along with being queried about\nthe module.  If no finder is ever found then 'None' is both\nstored in the cache and returned.\n\nNew in version 3.4.\n\nChanged in version 3.5: If the current working directory -\nrepresented by an empty string - is no longer valid then\n'None' is returned but no value is cached in *note\nsys.pathimportercache: 3a9.\n\n-- Method: classmethod invalidatecaches ()\n\nCalls *note importlib.abc.PathEntryFinder.invalidatecaches():\n41a6. on all finders stored in *note sys.pathimportercache:\n3a9. that define the method.  Otherwise entries in *note\nsys.pathimportercache: 3a9. set to 'None' are deleted.\n\nChanged in version 3.7: Entries of 'None' in *note\nsys.pathimportercache: 3a9. are deleted.\n\nChanged in version 3.4: Calls objects in *note sys.pathhooks: e9b.\nwith the current working directory for '''' (i.e.  the empty\nstring).\n\n-- Class: importlib.machinery.FileFinder (path, *loaderdetails)\n\nA concrete implementation of *note importlib.abc.PathEntryFinder:\n66a. which caches results from the file system.\n\nThe 'path' argument is the directory for which the finder is in\ncharge of searching.\n\nThe 'loaderdetails' argument is a variable number of 2-item tuples\neach containing a loader and a sequence of file suffixes the loader\nrecognizes.  The loaders are expected to be callables which accept\ntwo arguments of the module's name and the path to the file found.\n\nThe finder will cache the directory contents as necessary, making\nstat calls for each module search to verify the cache is not\noutdated.  Because cache staleness relies upon the granularity of\nthe operating system's state information of the file system, there\nis a potential race condition of searching for a module, creating a\nnew file, and then searching for the module the new file\nrepresents.  If the operations happen fast enough to fit within the\ngranularity of stat calls, then the module search will fail.  To\nprevent this from happening, when you create a module dynamically,\nmake sure to call *note importlib.invalidatecaches(): a56.\n\nNew in version 3.3.\n\n-- Attribute: path\n\nThe path the finder will search in.\n\n-- Method: findspec (fullname, target=None)\n\nAttempt to find the spec to handle 'fullname' within *note\npath: 41c6.\n\nNew in version 3.4.\n\n-- Method: invalidatecaches ()\n\nClear out the internal cache.\n\n-- Method: classmethod pathhook (*loaderdetails)\n\nA class method which returns a closure for use on *note\nsys.pathhooks: e9b.  An instance of *note FileFinder: ee9. is\nreturned by the closure using the path argument given to the\nclosure directly and 'loaderdetails' indirectly.\n\nIf the argument to the closure is not an existing directory,\n*note ImportError: 145. is raised.\n\n-- Class: importlib.machinery.SourceFileLoader (fullname, path)\n\nA concrete implementation of *note importlib.abc.SourceLoader:\n41b1. by subclassing *note importlib.abc.FileLoader: eea. and\nproviding some concrete implementations of other methods.\n\nNew in version 3.3.\n\n-- Attribute: name\n\nThe name of the module that this loader will handle.\n\n-- Attribute: path\n\nThe path to the source file.\n\n-- Method: ispackage (fullname)\n\nReturn 'True' if *note path: 41ca. appears to be for a\npackage.\n\n-- Method: pathstats (path)\n\nConcrete implementation of *note\nimportlib.abc.SourceLoader.pathstats(): 1000.\n\n-- Method: setdata (path, data)\n\nConcrete implementation of *note\nimportlib.abc.SourceLoader.setdata(): 41b2.\n\n-- Method: loadmodule (name=None)\n\nConcrete implementation of *note\nimportlib.abc.Loader.loadmodule(): 663. where specifying the\nname of the module to load is optional.\n\nDeprecated since version 3.6: Use *note\nimportlib.abc.Loader.execmodule(): 664. instead.\n\n-- Class: importlib.machinery.SourcelessFileLoader (fullname, path)\n\nA concrete implementation of *note importlib.abc.FileLoader: eea.\nwhich can import bytecode files (i.e.  no source code files exist).\n\nPlease note that direct use of bytecode files (and thus not source\ncode files) inhibits your modules from being usable by all Python\nimplementations or new versions of Python which change the bytecode\nformat.\n\nNew in version 3.3.\n\n-- Attribute: name\n\nThe name of the module the loader will handle.\n\n-- Attribute: path\n\nThe path to the bytecode file.\n\n-- Method: ispackage (fullname)\n\nDetermines if the module is a package based on *note path:\n41cf.\n\n-- Method: getcode (fullname)\n\nReturns the code object for *note name: 41ce. created from\n*note path: 41cf.\n\n-- Method: getsource (fullname)\n\nReturns 'None' as bytecode files have no source when this\nloader is used.\n\n-- Method: loadmodule (name=None)\n\nConcrete implementation of *note\nimportlib.abc.Loader.loadmodule(): 663. where specifying the name\nof the module to load is optional.\n\nDeprecated since version 3.6: Use *note\nimportlib.abc.Loader.execmodule(): 664. instead.\n\n-- Class: importlib.machinery.ExtensionFileLoader (fullname, path)\n\nA concrete implementation of *note importlib.abc.ExecutionLoader:\n41aa. for extension modules.\n\nThe 'fullname' argument specifies the name of the module the loader\nis to support.  The 'path' argument is the path to the extension\nmodule's file.\n\nNote that, by default, importing an extension module will fail in\nsubinterpreters if it doesn't implement multi-phase init (see PEP\n489(3)), even if it would otherwise import successfully.\n\nNew in version 3.3.\n\nChanged in version 3.12: Multi-phase init is now required for use\nin subinterpreters.\n\n-- Attribute: name\n\nName of the module the loader supports.\n\n-- Attribute: path\n\nPath to the extension module.\n\n-- Method: createmodule (spec)\n\nCreates the module object from the given specification in\naccordance with PEP 489(4).\n\nNew in version 3.5.\n\n-- Method: execmodule (module)\n\nInitializes the given module object in accordance with PEP\n489(5).\n\nNew in version 3.5.\n\n-- Method: ispackage (fullname)\n\nReturns 'True' if the file path points to a package's\n'init' module based on *note EXTENSIONSUFFIXES: 267.\n\n-- Method: getcode (fullname)\n\nReturns 'None' as extension modules lack a code object.\n\n-- Method: getsource (fullname)\n\nReturns 'None' as extension modules do not have source code.\n\n-- Method: getfilename (fullname)\n\nReturns *note path: 41d4.\n\nNew in version 3.4.\n\n-- Class: importlib.machinery.NamespaceLoader (name, path, pathfinder)\n\nA concrete implementation of *note importlib.abc.InspectLoader:\ndc4. for namespace packages.  This is an alias for a private class\nand is only made public for introspecting the 'loader'\nattribute on namespace packages:\n\n>>> from importlib.machinery import NamespaceLoader\n>>> import mynamespace\n>>> isinstance(mynamespace.loader, NamespaceLoader)\nTrue\n>>> import importlib.abc\n>>> isinstance(mynamespace.loader, importlib.abc.Loader)\nTrue\n\nNew in version 3.11.\n\n-- Class: importlib.machinery.ModuleSpec (name, loader, *, origin=None,\nloaderstate=None, ispackage=None)\n\nA specification for a module's import-system-related state.  This\nis typically exposed as the module's *note spec: 1d09.\nattribute.  In the descriptions below, the names in parentheses\ngive the corresponding attribute available directly on the module\nobject, e.g.  'module.spec.origin == module.file'.  Note,\nhowever, that while the 'values' are usually equivalent, they can\ndiffer since there is no synchronization between the two objects.\nFor example, it is possible to update the module's *note file:\n1c32. at runtime and this will not be automatically reflected in\nthe module's 'spec.origin', and vice versa.\n\nNew in version 3.4.\n\n-- Attribute: name\n\n(*note name: 11fd.)\n\nThe module's fully qualified name.  The *note finder: 1cfc. should\nalways set this attribute to a non-empty string.\n\n-- Attribute: loader\n\n(*note loader: e95.)\n\nThe *note loader: 13e6. used to load the module.  The *note finder:\n1cfc. should always set this attribute.\n\n-- Attribute: origin\n\n(*note file: 1c32.)\n\nThe location the *note loader: 13e6. should use to load the module.\nFor example, for modules loaded from a .py file this is the\nfilename.  The *note finder: 1cfc. should always set this attribute\nto a meaningful value for the *note loader: 13e6. to use.  In the\nuncommon case that there is not one (like for namespace packages),\nit should be set to 'None'.\n\n-- Attribute: submodulesearchlocations\n\n(*note path: 19f3.)\n\nThe list of locations where the package's submodules will be found.\nMost of the time this is a single directory.  The *note finder:\n1cfc. should set this attribute to a list, even an empty one, to\nindicate to the import system that the module is a package.  It\nshould be set to 'None' for non-package modules.  It is set\nautomatically later to a special object for namespace packages.\n\n-- Attribute: loaderstate\n\nThe *note finder: 1cfc. may set this attribute to an object\ncontaining additional, module-specific data to use when loading the\nmodule.  Otherwise it should be set to 'None'.\n\n-- Attribute: cached\n\n(*note cached: 1029.)\n\nThe filename of a compiled version of the module's code.  The *note\nfinder: 1cfc. should always set this attribute but it may be 'None'\nfor modules that do not need compiled code stored.\n\n-- Attribute: parent\n\n(*note package: e94.)\n\n(Read-only) The fully qualified name of the package the module is\nin (or the empty string for a top-level module).  If the module is\na package then this is the same as *note name: 2282.\n\n-- Attribute: haslocation\n\n'True' if the spec's *note origin: 41da. refers to a loadable location,\n\n'False' otherwise.  This value impacts how *note origin: 41da.\nis interpreted and how the module's *note file: 1c32. is\npopulated.\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/importlib/machinery.py\n\n(2) https://peps.python.org/pep-0489/\n\n(3) https://peps.python.org/pep-0489/\n\n(4) https://peps.python.org/pep-0489/\n\n(5) https://peps.python.org/pep-0489/\n\nFile: python3.12.info,  Node: importlib util - Utility code for importers,  Next: Examples<33>,  Prev: importlib machinery - Importers and path hooks,  Up: importlib -- The implementation of import\n\n5.31.5.5 'importlib.util' - Utility code for importers\n......................................................\n\n'Source code:' Lib/importlib/util.py(1)\n\n\n",
            "subsections": []
        },
        "This module contains the various objects that help in the construction": {
            "content": "of an *note importer: 1cfd.\n\n-- Attribute: importlib.util.MAGICNUMBER\n\nThe bytes which represent the bytecode version number.  If you need\nhelp with loading/writing bytecode then consider *note\nimportlib.abc.SourceLoader: 41b1.\n\nNew in version 3.4.\n\n-- Function: importlib.util.cachefromsource (path,\ndebugoverride=None, *, optimization=None)\n\nReturn the PEP 3147(2)/ PEP 488(3) path to the byte-compiled file\nassociated with the source 'path'.  For example, if 'path' is\n'/foo/bar/baz.py' the return value would be\n'/foo/bar/pycache/baz.cpython-32.pyc' for Python 3.2.  The\n'cpython-32' string comes from the current magic tag (see\n'gettag()'; if 'sys.implementation.cachetag' is not defined then\n*note NotImplementedError: ba5. will be raised).\n\nThe 'optimization' parameter is used to specify the optimization\nlevel of the bytecode file.  An empty string represents no\noptimization, so '/foo/bar/baz.py' with an 'optimization' of ''''\nwill result in a bytecode path of\n'/foo/bar/pycache/baz.cpython-32.pyc'.  'None' causes the\ninterpreter's optimization level to be used.  Any other value's\nstring representation is used, so '/foo/bar/baz.py' with an\n'optimization' of '2' will lead to the bytecode path of\n'/foo/bar/pycache/baz.cpython-32.opt-2.pyc'.  The string\nrepresentation of 'optimization' can only be alphanumeric, else\n*note ValueError: 183. is raised.\n\nThe 'debugoverride' parameter is deprecated and can be used to\noverride the system's value for 'debug'.  A 'True' value is the\nequivalent of setting 'optimization' to the empty string.  A\n'False' value is the same as setting 'optimization' to '1'.  If\nboth 'debugoverride' an 'optimization' are not 'None' then *note\nTypeError: 28e. is raised.\n\nNew in version 3.4.\n\nChanged in version 3.5: The 'optimization' parameter was added and\nthe 'debugoverride' parameter was deprecated.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: importlib.util.sourcefromcache (path)\n\nGiven the 'path' to a PEP 3147(4) file name, return the associated\nsource code file path.  For example, if 'path' is\n'/foo/bar/pycache/baz.cpython-32.pyc' the returned path would\nbe '/foo/bar/baz.py'.  'path' need not exist, however if it does\nnot conform to PEP 3147(5) or PEP 488(6) format, a *note\nValueError: 183. is raised.  If 'sys.implementation.cachetag' is\nnot defined, *note NotImplementedError: ba5. is raised.\n\nNew in version 3.4.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: importlib.util.decodesource (sourcebytes)\n\nDecode the given bytes representing source code and return it as a\nstring with universal newlines (as required by *note\nimportlib.abc.InspectLoader.getsource(): dc8.).\n\nNew in version 3.4.\n\n-- Function: importlib.util.resolvename (name, package)\n\nResolve a relative module name to an absolute one.\n\nIf 'name' has no leading dots, then 'name' is simply returned.\nThis allows for usage such as 'importlib.util.resolvename('sys',\nspec.parent)' without doing a check to see if the 'package'\nargument is needed.\n\n*note ImportError: 145. is raised if 'name' is a relative module\nname but 'package' is a false value (e.g.  'None' or the empty\nstring).  *note ImportError: 145. is also raised if a relative name\nwould escape its containing package (e.g.  requesting '..bacon'\nfrom within the 'spam' package).\n\nNew in version 3.3.\n\nChanged in version 3.9: To improve consistency with import\nstatements, raise *note ImportError: 145. instead of *note\nValueError: 183. for invalid relative import attempts.\n\n-- Function: importlib.util.findspec (name, package=None)\n\nFind the *note spec: 4021. for a module, optionally relative to the\nspecified 'package' name.  If the module is in *note sys.modules:\n16d7, then 'sys.modules[name].spec' is returned (unless the\nspec would be 'None' or is not set, in which case *note ValueError:\n183. is raised).  Otherwise a search using *note sys.metapath:\nb80. is done.  'None' is returned if no spec is found.\n\nIf 'name' is for a submodule (contains a dot), the parent module is\nautomatically imported.\n\n'name' and 'package' work the same as for 'importmodule()'.\n\nNew in version 3.4.\n\nChanged in version 3.7: Raises *note ModuleNotFoundError: 981.\ninstead of *note AttributeError: 395. if 'package' is in fact not a\npackage (i.e.  lacks a *note path: 19f3. attribute).\n\n-- Function: importlib.util.modulefromspec (spec)\n\nCreate a new module based on 'spec' and *note\nspec.loader.createmodule: afd.\n\nIf *note spec.loader.createmodule: afd. does not return 'None',\nthen any pre-existing attributes will not be reset.  Also, no *note\nAttributeError: 395. will be raised if triggered while accessing\n'spec' or setting an attribute on the module.\n\nThis function is preferred over using *note types.ModuleType: c71.\nto create a new module as 'spec' is used to set as many\nimport-controlled attributes on the module as possible.\n\nNew in version 3.5.\n\n-- Function: importlib.util.specfromloader (name, loader, *,\norigin=None, ispackage=None)\n\nA factory function for creating a *note ModuleSpec: 1d07. instance\nbased on a loader.  The parameters have the same meaning as they do\nfor ModuleSpec.  The function uses available *note loader: 13e6.\nAPIs, such as 'InspectLoader.ispackage()', to fill in any missing\ninformation on the spec.\n\nNew in version 3.4.\n\n-- Function: importlib.util.specfromfilelocation (name, location, *,\nloader=None, submodulesearchlocations=None)\n\nA factory function for creating a *note ModuleSpec: 1d07. instance\nbased on the path to a file.  Missing information will be filled in\non the spec by making use of loader APIs and by the implication\nthat the module will be file-based.\n\nNew in version 3.4.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- Function: importlib.util.sourcehash (sourcebytes)\n\nReturn the hash of 'sourcebytes' as bytes.  A hash-based '.pyc'\nfile embeds the *note sourcehash(): 41e0. of the corresponding\nsource file's contents in its header.\n\nNew in version 3.7.\n\n-- Function: importlib.util.incompatibleextensionmodulerestrictions\n(*, disablecheck)\n\nA context manager that can temporarily skip the compatibility check\nfor extension modules.  By default the check is enabled and will\nfail when a single-phase init module is imported in a\nsubinterpreter.  It will also fail for a multi-phase init module\nthat doesn't explicitly support a per-interpreter GIL, when\nimported in an interpreter with its own GIL.\n\nNote that this function is meant to accommodate an unusual case;\none which is likely to eventually go away.  There's is a pretty\ngood chance this is not what you were looking for.\n\nYou can get the same effect as this function by implementing the\nbasic interface of multi-phase init ( PEP 489(7)) and lying about\nsupport for multiple interpreters (or per-interpreter GIL).\n\nWarning: Using this function to disable the check can lead to\nunexpected behavior and even crashes.  It should only be used\nduring extension module development.\n\nNew in version 3.12.\n\n-- Class: importlib.util.LazyLoader (loader)\n\nA class which postpones the execution of the loader of a module\nuntil the module has an attribute accessed.\n\nThis class 'only' works with loaders that define *note\nexecmodule(): 664. as control over what module type is used for\nthe module is required.  For those same reasons, the loader's *note\ncreatemodule(): afd. method must return 'None' or a type for which\nits 'class' attribute can be mutated along with not using *note\nslots: 3a3.  Finally, modules which substitute the object placed\ninto *note sys.modules: 16d7. will not work as there is no way to\nproperly replace the module references throughout the interpreter\nsafely; *note ValueError: 183. is raised if such a substitution is\ndetected.\n\nNote: For projects where startup time is critical, this class\nallows for potentially minimizing the cost of loading a module\nif it is never used.  For projects where startup time is not\nessential then use of this class is 'heavily' discouraged due\nto error messages created during loading being postponed and\nthus occurring out of context.\n\nNew in version 3.5.\n\nChanged in version 3.6: Began calling *note createmodule(): afd,\nremoving the compatibility warning for *note\nimportlib.machinery.BuiltinImporter: afe. and *note\nimportlib.machinery.ExtensionFileLoader: aff.\n\n-- Method: classmethod factory (loader)\n\nA class method which returns a callable that creates a lazy\nloader.  This is meant to be used in situations where the\nloader is passed by class instead of by instance.\n\nsuffixes = importlib.machinery.SOURCESUFFIXES\nloader = importlib.machinery.SourceFileLoader\nlazyloader = importlib.util.LazyLoader.factory(loader)\nfinder = importlib.machinery.FileFinder(path, (lazyloader, suffixes))\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/importlib/util.py\n\n(2) https://peps.python.org/pep-3147/\n\n(3) https://peps.python.org/pep-0488/\n\n(4) https://peps.python.org/pep-3147/\n\n(5) https://peps.python.org/pep-3147/\n\n(6) https://peps.python.org/pep-0488/\n\n(7) https://peps.python.org/pep-0489/\n\nFile: python3.12.info,  Node: Examples<33>,  Prev: importlib util - Utility code for importers,  Up: importlib -- The implementation of import\n\n5.31.5.6 Examples\n.................\n\n* Menu:\n\n* Importing programmatically::\n* Checking if a module can be imported::\n* Importing a source file directly::\n* Implementing lazy imports::\n* Setting up an importer::\n* Approximating importlib.importmodule(): Approximating importlib importmodule.\n\nFile: python3.12.info,  Node: Importing programmatically,  Next: Checking if a module can be imported,  Up: Examples<33>\n\n5.31.5.7 Importing programmatically\n...................................\n\nTo programmatically import a module, use *note\nimportlib.importmodule(): 26a.\n\nimport importlib\n\nitertools = importlib.importmodule('itertools')\n\nFile: python3.12.info,  Node: Checking if a module can be imported,  Next: Importing a source file directly,  Prev: Importing programmatically,  Up: Examples<33>\n\n5.31.5.8 Checking if a module can be imported\n.............................................\n",
            "subsections": []
        },
        "If you need to find out if a module can be imported without actually": {
            "content": "doing the import, then you should use *note importlib.util.findspec():\n230.\n\nNote that if 'name' is a submodule (contains a dot), *note\nimportlib.util.findspec(): 230. will import the parent module.\n\nimport importlib.util\nimport sys\n\n# For illustrative purposes.\nname = 'itertools'\n\nif name in sys.modules:\nprint(f\"{name!r} already in sys.modules\")\nelif (spec := importlib.util.findspec(name)) is not None:\n# If you chose to perform the actual import ...\nmodule = importlib.util.modulefromspec(spec)\nsys.modules[name] = module\nspec.loader.execmodule(module)\nprint(f\"{name!r} has been imported\")\nelse:\nprint(f\"can't find the {name!r} module\")\n\nFile: python3.12.info,  Node: Importing a source file directly,  Next: Implementing lazy imports,  Prev: Checking if a module can be imported,  Up: Examples<33>\n\n5.31.5.9 Importing a source file directly\n.........................................\n\nTo import a Python source file directly, use the following recipe:\n\nimport importlib.util\nimport sys\n\n# For illustrative purposes.\nimport tokenize\nfilepath = tokenize.file\nmodulename = tokenize.name\n\nspec = importlib.util.specfromfilelocation(modulename, filepath)\nmodule = importlib.util.modulefromspec(spec)\nsys.modules[modulename] = module\nspec.loader.execmodule(module)\n\nFile: python3.12.info,  Node: Implementing lazy imports,  Next: Setting up an importer,  Prev: Importing a source file directly,  Up: Examples<33>\n\n5.31.5.10 Implementing lazy imports\n...................................\n\nThe example below shows how to implement lazy imports:\n\n>>> import importlib.util\n>>> import sys\n>>> def lazyimport(name):\n...     spec = importlib.util.findspec(name)\n...     loader = importlib.util.LazyLoader(spec.loader)\n...     spec.loader = loader\n...     module = importlib.util.modulefromspec(spec)\n...     sys.modules[name] = module\n...     loader.execmodule(module)\n...     return module\n...\n>>> lazytyping = lazyimport(\"typing\")\n>>> #lazytyping is a real module object,\n>>> #but it is not loaded in memory yet.\n>>> lazytyping.TYPECHECKING\nFalse\n\nFile: python3.12.info,  Node: Setting up an importer,  Next: Approximating importlib importmodule,  Prev: Implementing lazy imports,  Up: Examples<33>\n\n5.31.5.11 Setting up an importer\n................................\n",
            "subsections": []
        },
        "For deep customizations of import, you typically want to implement an": {
            "content": "*note importer: 1cfd.  This means managing both the *note finder: 1cfc.\nand *note loader: 13e6. side of things.  For finders there are two\nflavours to choose from depending on your needs: a *note meta path\nfinder: ee7. or a *note path entry finder: ee8.  The former is what you\nwould put on *note sys.metapath: b80. while the latter is what you\ncreate using a *note path entry hook: 1d14. on *note sys.pathhooks:\ne9b. which works with *note sys.path: 32c. entries to potentially create\na finder.  This example will show you how to register your own importers\nso that import will use them (for creating an importer for yourself,\nread the documentation for the appropriate classes defined within this\npackage):\n\nimport importlib.machinery\nimport sys\n\n# For illustrative purposes only.\nSpamMetaPathFinder = importlib.machinery.PathFinder\nSpamPathEntryFinder = importlib.machinery.FileFinder\nloaderdetails = (importlib.machinery.SourceFileLoader,\nimportlib.machinery.SOURCESUFFIXES)\n\n# Setting up a meta path finder.\n# Make sure to put the finder in the proper location in the list in terms of\n# priority.\nsys.metapath.append(SpamMetaPathFinder)\n\n# Setting up a path entry finder.\n# Make sure to put the path hook in the proper location in the list in terms\n# of priority.\nsys.pathhooks.append(SpamPathEntryFinder.pathhook(loaderdetails))\n\nFile: python3.12.info,  Node: Approximating importlib importmodule,  Prev: Setting up an importer,  Up: Examples<33>\n\n5.31.5.12 Approximating 'importlib.importmodule()'\n...................................................\n",
            "subsections": []
        },
        "Import itself is implemented in Python code, making it possible to": {
            "content": "expose most of the import machinery through importlib.  The following\nhelps illustrate the various APIs that importlib exposes by providing an\napproximate implementation of *note importlib.importmodule(): 26a.:\n\nimport importlib.util\nimport sys\n\ndef importmodule(name, package=None):\n\"\"\"An approximate implementation of import.\"\"\"\nabsolutename = importlib.util.resolvename(name, package)\ntry:\nreturn sys.modules[absolutename]\nexcept KeyError:\npass\n\npath = None\nif '.' in absolutename:\nparentname, , childname = absolutename.rpartition('.')\nparentmodule = importmodule(parentname)\npath = parentmodule.spec.submodulesearchlocations\nfor finder in sys.metapath:\nspec = finder.findspec(absolutename, path)\nif spec is not None:\nbreak\nelse:\nmsg = f'No module named {absolutename!r}'\nraise ModuleNotFoundError(msg, name=absolutename)\nmodule = importlib.util.modulefromspec(spec)\nsys.modules[absolutename] = module\nspec.loader.execmodule(module)\nif path is not None:\nsetattr(parentmodule, childname, module)\nreturn module\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "'Source code:' Lib/importlib/resources/init.py(1)\n\n\n\nNew in version 3.7.\n",
            "subsections": []
        },
        "This module leverages Python's import system to provide access to": {
            "content": "'resources' within 'packages'.\n\n\"Resources\" are file-like resources associated with a module or package\nin Python.  The resources may be contained directly in a package, within\na subdirectory contained in that package, or adjacent to modules outside\na package.  Resources may be text or binary.  As a result, Python module\nsources (.py) of a package and compilation artifacts (pycache) are\ntechnically de-facto resources of that package.  In practice, however,\nresources are primarily those non-Python artifacts exposed specifically\nby the package author.\n\nResources can be opened or read in either binary or text mode.\n",
            "subsections": []
        },
        "Resources are roughly akin to files inside directories, though it's": {
            "content": "important to keep in mind that this is just a metaphor.  Resources and\npackages 'do not' have to exist as physical files and directories on the\nfile system: for example, a package and its resources can be imported\nfrom a zip file using *note zipimport: 12c.\n\nNote: This module provides functionality similar to\npkgresources(2) Basic Resource Access(3) without the performance\noverhead of that package.  This makes reading resources included in\npackages easier, with more stable and consistent semantics.\n\nThe standalone backport of this module provides more information on\nusing importlib.resources(4) and migrating from pkgresources to\nimportlib.resources(5).\n\n*note Loaders: d2b. that wish to support resource reading should\nimplement a 'getresourcereader(fullname)' method as specified by *note\nimportlib.resources.abc.ResourceReader: 41a7.\n\n-- Class: importlib.resources.Anchor\n\nRepresents an anchor for resources, either a *note module object:\nc71. or a module name as a string.  Defined as 'Union[str,\nModuleType]'.\n\n-- Function: importlib.resources.files (anchor: Anchor | None = None)\n\nReturns a *note Traversable: 229. object representing the resource\ncontainer (think directory) and its resources (think files).  A\nTraversable may contain other containers (think subdirectories).\n\n'anchor' is an optional *note Anchor: 41ed.  If the anchor is a\npackage, resources are resolved from that package.  If a module,\nresources are resolved adjacent to that module (in the same package\nor the package root).  If the anchor is omitted, the caller's\nmodule is used.\n\nNew in version 3.9.\n\nChanged in version 3.12: 'package' parameter was renamed to\n'anchor'.  'anchor' can now be a non-package module and if omitted\nwill default to the caller's module.  'package' is still accepted\nfor compatibility but will raise a *note DeprecationWarning: 179.\nConsider passing the anchor positionally or using\n'importlibresources >= 5.10' for a compatible interface on older\nPythons.\n\n-- Function: importlib.resources.asfile (traversable)\n\nGiven a *note Traversable: 229. object representing a file or\ndirectory, typically from *note importlib.resources.files(): 1ab,\nreturn a context manager for use in a *note with: 396. statement.\nThe context manager provides a *note pathlib.Path: 149. object.\n\nExiting the context manager cleans up any temporary file or\ndirectory created when the resource was extracted from e.g.  a zip\nfile.\n\nUse 'asfile' when the Traversable methods ('readtext', etc) are\ninsufficient and an actual file or directory on the file system is\nrequired.\n\nNew in version 3.9.\n\nChanged in version 3.12: Added support for 'traversable'\nrepresenting a directory.\n\n* Menu:\n\n* Deprecated functions::\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/importlib/resources/init.py\n\n(2) https://setuptools.readthedocs.io/en/latest/pkgresources.html\n\n(3)\nhttps://setuptools.readthedocs.io/en/latest/pkgresources.html#basic-resource-access\n\n(4) https://importlib-resources.readthedocs.io/en/latest/using.html\n\n(5)\nhttps://importlib-resources.readthedocs.io/en/latest/migration.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Deprecated functions,  Up: importlib resources - Package resource reading opening and access": {
            "content": "5.31.6.1 Deprecated functions\n.............................\n",
            "subsections": []
        },
        "An older, deprecated set of functions is still available, but is": {
            "content": "scheduled for removal in a future version of Python.  The main drawback\nof these functions is that they do not support directories: they assume\nall resources are located directly within a 'package'.\n\n-- Data: importlib.resources.Package\n\nWhenever a function accepts a 'Package' argument, you can pass\nin either a *note module object: c71. or a module name as a\nstring.  You can only pass module objects whose\n'spec.submodulesearchlocations' is not 'None'.\n\nThe 'Package' type is defined as 'Union[str, ModuleType]'.\n\nDeprecated since version 3.12.\n\n-- Data: importlib.resources.Resource\n\nFor 'resource' arguments of the functions below, you can pass in\nthe name of a resource as a string or a *note path-like object:\na9a.\n\nThe 'Resource' type is defined as 'Union[str, os.PathLike]'.\n\n-- Function: importlib.resources.openbinary (package, resource)\n\nOpen for binary reading the 'resource' within 'package'.\n\n'package' is either a name or a module object which conforms to the\n'Package' requirements.  'resource' is the name of the resource to\nopen within 'package'; it may not contain path separators and it\nmay not have sub-resources (i.e.  it cannot be a directory).  This\nfunction returns a 'typing.BinaryIO' instance, a binary I/O stream\nopen for reading.\n\nDeprecated since version 3.11: Calls to this function can be\nreplaced by:\n\nfiles(package).joinpath(resource).open('rb')\n\n-- Function: importlib.resources.opentext (package, resource,\nencoding='utf-8', errors='strict')\n\nOpen for text reading the 'resource' within 'package'.  By default,\nthe resource is opened for reading as UTF-8.\n\n'package' is either a name or a module object which conforms to the\n'Package' requirements.  'resource' is the name of the resource to\nopen within 'package'; it may not contain path separators and it\nmay not have sub-resources (i.e.  it cannot be a directory).\n'encoding' and 'errors' have the same meaning as with built-in\n*note open(): 26e.\n\nThis function returns a 'typing.TextIO' instance, a text I/O stream\nopen for reading.\n\nDeprecated since version 3.11: Calls to this function can be\nreplaced by:\n\nfiles(package).joinpath(resource).open('r', encoding=encoding)\n\n-- Function: importlib.resources.readbinary (package, resource)\n\nRead and return the contents of the 'resource' within 'package' as\n'bytes'.\n\n'package' is either a name or a module object which conforms to the\n'Package' requirements.  'resource' is the name of the resource to\nopen within 'package'; it may not contain path separators and it\nmay not have sub-resources (i.e.  it cannot be a directory).  This\nfunction returns the contents of the resource as *note bytes: 295.\n\nDeprecated since version 3.11: Calls to this function can be\nreplaced by:\n\nfiles(package).joinpath(resource).readbytes()\n\n-- Function: importlib.resources.readtext (package, resource,\nencoding='utf-8', errors='strict')\n\nRead and return the contents of 'resource' within 'package' as a\n'str'.  By default, the contents are read as strict UTF-8.\n\n'package' is either a name or a module object which conforms to the\n'Package' requirements.  'resource' is the name of the resource to\nopen within 'package'; it may not contain path separators and it\nmay not have sub-resources (i.e.  it cannot be a directory).\n'encoding' and 'errors' have the same meaning as with built-in\n*note open(): 26e.  This function returns the contents of the\nresource as *note str: 157.\n\nDeprecated since version 3.11: Calls to this function can be\nreplaced by:\n\nfiles(package).joinpath(resource).readtext(encoding=encoding)\n\n-- Function: importlib.resources.path (package, resource)\n\nReturn the path to the 'resource' as an actual file system path.\nThis function returns a context manager for use in a *note with:\n396. statement.  The context manager provides a *note pathlib.Path:\n149. object.\n\nExiting the context manager cleans up any temporary file created\nwhen the resource needs to be extracted from e.g.  a zip file.\n\n'package' is either a name or a module object which conforms to the\n'Package' requirements.  'resource' is the name of the resource to\nopen within 'package'; it may not contain path separators and it\nmay not have sub-resources (i.e.  it cannot be a directory).\n\nDeprecated since version 3.11: Calls to this function can be\nreplaced using *note asfile(): 1aa.:\n\nasfile(files(package).joinpath(resource))\n\n-- Function: importlib.resources.isresource (package, name)\n\nReturn 'True' if there is a resource named 'name' in the package,\notherwise 'False'.  This function does not consider directories to\nbe resources.  'package' is either a name or a module object which\nconforms to the 'Package' requirements.\n\nDeprecated since version 3.11: Calls to this function can be\nreplaced by:\n\nfiles(package).joinpath(resource).isfile()\n\n-- Function: importlib.resources.contents (package)\n\nReturn an iterable over the named items within the package.  The\niterable returns *note str: 157. resources (e.g.  files) and\nnon-resources (e.g.  directories).  The iterable does not recurse\ninto subdirectories.\n\n'package' is either a name or a module object which conforms to the\n'Package' requirements.\n\nDeprecated since version 3.11: Calls to this function can be\nreplaced by:\n\n(resource.name for resource in files(package).iterdir() if resource.isfile())\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "'Source code:' Lib/importlib/resources/abc.py(1)\n\n\n\nNew in version 3.11.\n\n-- Class: importlib.resources.abc.ResourceReader\n\n'Superseded by TraversableResources'\n\nAn *note abstract base class: 102a. to provide the ability to read\n'resources'.\n\nFrom the perspective of this ABC, a 'resource' is a binary artifact\nthat is shipped within a package.  Typically this is something like\na data file that lives next to the 'init.py' file of the\npackage.  The purpose of this class is to help abstract out the\naccessing of such data files so that it does not matter if the\npackage and its data file(s) are stored in a e.g.  zip file versus\non the file system.\n\nFor any of methods of this class, a 'resource' argument is expected\nto be a *note path-like object: 957. which represents conceptually\njust a file name.  This means that no subdirectory paths should be\nincluded in the 'resource' argument.  This is because the location\nof the package the reader is for, acts as the \"directory\".  Hence\nthe metaphor for directories and file names is packages and\nresources, respectively.  This is also why instances of this class\nare expected to directly correlate to a specific package (instead\nof potentially representing multiple packages or a module).\n\nLoaders that wish to support resource reading are expected to\nprovide a method called 'getresourcereader(fullname)' which\nreturns an object implementing this ABC's interface.  If the module\nspecified by fullname is not a package, this method should return\n*note None: 43f.  An object compatible with this ABC should only be\nreturned when the specified module is a package.\n\nDeprecated since version 3.12, will be removed in version 3.14: Use\n*note importlib.resources.abc.TraversableResources: 22a. instead.\n\n-- Method: abstractmethod openresource (resource)\n\nReturns an opened, *note file-like object: 229a. for binary\nreading of the 'resource'.\n\nIf the resource cannot be found, *note FileNotFoundError: 353.\nis raised.\n\n-- Method: abstractmethod resourcepath (resource)\n\nReturns the file system path to the 'resource'.\n\nIf the resource does not concretely exist on the file system,\nraise *note FileNotFoundError: 353.\n\n-- Method: abstractmethod isresource (name)\n\nReturns 'True' if the named 'name' is considered a resource.\n*note FileNotFoundError: 353. is raised if 'name' does not\nexist.\n\n-- Method: abstractmethod contents ()\n\nReturns an *note iterable: 109d. of strings over the contents\nof the package.  Do note that it is not required that all\nnames returned by the iterator be actual resources, e.g.  it\nis acceptable to return names for which *note isresource():\n41f5. would be false.\n\nAllowing non-resource names to be returned is to allow for\nsituations where how a package and its resources are stored\nare known a priori and the non-resource names would be useful.\nFor instance, returning subdirectory names is allowed so that\nwhen it is known that the package and resources are stored on\nthe file system then those subdirectory names can be used\ndirectly.\n\nThe abstract method returns an iterable of no items.\n\n-- Class: importlib.resources.abc.Traversable\n\nAn object with a subset of *note pathlib.Path: 149. methods\nsuitable for traversing directories and opening files.\n\nFor a representation of the object on the file-system, use *note\nimportlib.resources.asfile(): 1aa.\n\n-- Attribute: name\n\nAbstract.  The base name of this object without any parent\nreferences.\n\n-- Method: abstractmethod iterdir ()\n\nYield Traversable objects in self.\n\n-- Method: abstractmethod isdir ()\n\nReturn True if self is a directory.\n\n-- Method: abstractmethod isfile ()\n\nReturn True if self is a file.\n\n-- Method: abstractmethod joinpath (*pathsegments)\n\nTraverse directories according to 'pathsegments' and return\nthe result as 'Traversable'.\n\nEach 'pathsegments' argument may contain multiple names\nseparated by forward slashes ('/', 'posixpath.sep' ).  For\nexample, the following are equivalent:\n\nfiles.joinpath('subdir', 'subsuddir', 'file.txt')\nfiles.joinpath('subdir/subsuddir/file.txt')\n\nNote that some 'Traversable' implementations might not be\nupdated to the latest version of the protocol.  For\ncompatibility with such implementations, provide a single\nargument without path separators to each call to 'joinpath'.\nFor example:\n\nfiles.joinpath('subdir').joinpath('subsubdir').joinpath('file.txt')\n\nChanged in version 3.11: 'joinpath' accepts multiple\n'pathsegments', and these segments may contain forward slashes\nas path separators.  Previously, only a single 'child'\nargument was accepted.\n\n-- Method: abstractmethod truediv (child)\n\nReturn Traversable child in self.  Equivalent to\n'joinpath(child)'.\n\n-- Method: abstractmethod open (mode='r', *args, kwargs)\n\n'mode' may be 'r' or 'rb' to open as text or binary.  Return a\nhandle suitable for reading (same as *note pathlib.Path.open:\n24bd.).\n\nWhen opening as text, accepts encoding parameters such as\nthose accepted by *note io.TextIOWrapper: b8f.\n\n-- Method: readbytes ()\n\nRead contents of self as bytes.\n\n-- Method: readtext (encoding=None)\n\nRead contents of self as text.\n\n-- Class: importlib.resources.abc.TraversableResources\n\nAn abstract base class for resource readers capable of serving the\n*note importlib.resources.files(): 1ab. interface.  Subclasses\n*note ResourceReader: 41a7. and provides concrete implementations\nof the 'ResourceReader''s abstract methods.  Therefore, any loader\nsupplying 'TraversableResources' also supplies 'ResourceReader'.\n\nLoaders that wish to support resource reading are expected to\nimplement this interface.\n\n-- Method: abstractmethod files ()\n\nReturns a *note importlib.resources.abc.Traversable: 229.\nobject for the loaded package.\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/importlib/resources/abc.py\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "New in version 3.8.\n\nChanged in version 3.10: 'importlib.metadata' is no longer provisional.\n\n'Source code:' Lib/importlib/metadata/init.py(1)\n\n'importlib.metadata' is a library that provides access to the metadata\nof an installed Distribution Package(2), such as its entry points or its\ntop-level names (Import Package(3)s, modules, if any).  Built in part on",
            "subsections": []
        },
        "Python's import system, this library intends to replace similar": {
            "content": "functionality in the entry point API(4) and metadata API(5) of\n'pkgresources'.  Along with *note importlib.resources: 75, this package\ncan eliminate the need to use the older and less efficient\n'pkgresources' package.\n\n'importlib.metadata' operates on third-party 'distribution packages'\ninstalled into Python's 'site-packages' directory via tools such as\npip(6).  Specifically, it works with distributions with discoverable\n'dist-info' or 'egg-info' directories, and metadata defined by the Core\nmetadata specifications(7).\n\nImportant: These are 'not' necessarily equivalent to or correspond\n1:1 with the top-level 'import package' names that can be imported\ninside Python code.  One 'distribution package' can contain\nmultiple 'import packages' (and single modules), and one top-level\n'import package' may map to multiple 'distribution packages' if it\nis a namespace package.  You can use *note packagedistributions():\n4204. to get a mapping between them.\n",
            "subsections": []
        },
        "By default, distribution metadata can live on the file system or in zip": {
            "content": "archives on *note sys.path: 32c.  Through an extension mechanism, the\nmetadata can live almost anywhere.\n\nSee also\n........\n\n'https://importlib-metadata.readthedocs.io/'\n\nThe documentation for 'importlibmetadata', which supplies a\nbackport of 'importlib.metadata'.  This includes an API\nreference(8) for this module's classes and functions, as well as a\nmigration guide(9) for existing users of 'pkgresources'.\n\n* Menu:\n\n* Overview: Overview<3>.\n* Functional API::\n* Distributions::\n* Distribution Discovery::\n* Extending the search algorithm::\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/importlib/metadata/init.py\n\n(2)\nhttps://packaging.python.org/en/latest/glossary/#term-Distribution-Package\n\n(3)\nhttps://packaging.python.org/en/latest/glossary/#term-Import-Package\n\n(4)\nhttps://setuptools.readthedocs.io/en/latest/pkgresources.html#entry-points\n\n(5)\nhttps://setuptools.readthedocs.io/en/latest/pkgresources.html#metadata-api\n\n(6) https://pypi.org/project/pip/\n\n(7)\nhttps://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata\n\n(8) https://importlib-metadata.readthedocs.io/en/latest/api.html\n\n(9)\nhttps://importlib-metadata.readthedocs.io/en/latest/migration.html\n\nFile: python3.12.info,  Node: Overview<3>,  Next: Functional API,  Up: importlib metadata - Accessing package metadata\n\n5.31.8.1 Overview\n.................\n",
            "subsections": []
        },
        "Let's say you wanted to get the version string for a Distribution": {
            "content": "",
            "subsections": []
        },
        "Package(1) you've installed using 'pip'.  We start by creating a virtual": {
            "content": "environment and installing something into it:\n\n$ python -m venv example\n$ source example/bin/activate\n(example) $ python -m pip install wheel\n\nYou can get the version string for 'wheel' by running the following:\n\n(example) $ python\n>>> from importlib.metadata import version\n>>> version('wheel')\n'0.32.3'\n",
            "subsections": []
        },
        "You can also get a collection of entry points selectable by properties": {
            "content": "of the EntryPoint (typically 'group' or 'name'), such as\n'consolescripts', 'distutils.commands' and others.  Each group contains\na collection of *note EntryPoint: 604. objects.\n\nYou can get the *note metadata for a distribution: 4206.:\n\n>>> list(metadata('wheel'))\n['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']\n\nYou can also get a *note distribution's version number: 4207, list its\n*note constituent files: 4208, and get a list of the distribution's\n*note Distribution requirements: 4209.\n\n---------- Footnotes ----------\n\n(1)\nhttps://packaging.python.org/en/latest/glossary/#term-Distribution-Package\n\nFile: python3.12.info,  Node: Functional API,  Next: Distributions,  Prev: Overview<3>,  Up: importlib metadata - Accessing package metadata\n\n5.31.8.2 Functional API\n.......................\n\nThis package provides the following functionality via its public API.\n\n* Menu:\n\n* Entry points::\n* Distribution metadata::\n* Distribution versions::\n* Distribution files::\n* Distribution requirements::\n* Mapping import to distribution packages::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Entry points,  Next: Distribution metadata,  Up: Functional API": {
            "content": "5.31.8.3 Entry points\n.....................\n\nThe 'entrypoints()' function returns a collection of entry points.",
            "subsections": []
        },
        "Entry points are represented by 'EntryPoint' instances; each": {
            "content": "'EntryPoint' has a '.name', '.group', and '.value' attributes and a\n'.load()' method to resolve the value.  There are also '.module',\n'.attr', and '.extras' attributes for getting the components of the\n'.value' attribute.\n\nQuery all entry points:\n\n>>> eps = entrypoints()\n",
            "subsections": []
        },
        "The 'entrypoints()' function returns an 'EntryPoints' object, a": {
            "content": "collection of all 'EntryPoint' objects with 'names' and 'groups'\nattributes for convenience:\n\n>>> sorted(eps.groups)\n['consolescripts', 'distutils.commands', 'distutils.setupkeywords', 'egginfo.writers', 'setuptools.installation']\n\n'EntryPoints' has a 'select' method to select entry points matching\nspecific properties.  Select entry points in the 'consolescripts'\ngroup:\n\n>>> scripts = eps.select(group='consolescripts')\n",
            "subsections": []
        },
        "Equivalently, since 'entrypoints' passes keyword arguments through to": {
            "content": "select:\n\n>>> scripts = entrypoints(group='consolescripts')\n\nPick out a specific script named \"wheel\" (found in the wheel project):\n\n>>> 'wheel' in scripts.names\nTrue\n>>> wheel = scripts['wheel']\n\nEquivalently, query for that entry point during selection:\n\n>>> (wheel,) = entrypoints(group='consolescripts', name='wheel')\n>>> (wheel,) = entrypoints().select(group='consolescripts', name='wheel')\n\nInspect the resolved entry point:\n\n>>> wheel\nEntryPoint(name='wheel', value='wheel.cli:main', group='consolescripts')\n>>> wheel.module\n'wheel.cli'\n>>> wheel.attr\n'main'\n>>> wheel.extras\n[]\n>>> main = wheel.load()\n>>> main\n<function main at 0x103528488>\n",
            "subsections": []
        },
        "The 'group' and 'name' are arbitrary values defined by the package": {
            "content": "author and usually a client will wish to resolve all entry points for a\nparticular group.  Read the setuptools docs(1) for more information on\nentry points, their definition, and usage.\n\n'Compatibility Note'\n\nThe \"selectable\" entry points were introduced in 'importlibmetadata'\n3.6 and Python 3.10.  Prior to those changes, 'entrypoints' accepted no\nparameters and always returned a dictionary of entry points, keyed by\ngroup.  With 'importlibmetadata' 5.0 and Python 3.12, 'entrypoints'\nalways returns an 'EntryPoints' object.  See\nbackports.entrypointsselectable(2) for compatibility options.\n\n---------- Footnotes ----------\n\n(1) https://setuptools.pypa.io/en/latest/userguide/entrypoint.html\n\n(2) https://pypi.org/project/backports.entry-points-selectable\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Distribution metadata,  Next: Distribution versions,  Prev: Entry points,  Up: Functional API": {
            "content": "5.31.8.4 Distribution metadata\n..............................\n",
            "subsections": []
        },
        "Every Distribution Package(1) includes some metadata, which you can": {
            "content": "extract using the 'metadata()' function:\n\n>>> wheelmetadata = metadata('wheel')\n",
            "subsections": []
        },
        "The keys of the returned data structure, a 'PackageMetadata', name the": {
            "content": "metadata keywords, and the values are returned unparsed from the\ndistribution metadata:\n\n>>> wheelmetadata['Requires-Python']\n'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'\n\n'PackageMetadata' also presents a 'json' attribute that returns all the\nmetadata in a JSON-compatible form per PEP 566(2):\n\n>>> wheelmetadata.json['requirespython']\n'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'\n\nNote: The actual type of the object returned by 'metadata()' is an\nimplementation detail and should be accessed only through the\ninterface described by the PackageMetadata protocol(3).\n",
            "subsections": []
        },
        "Changed in version 3.10: The 'Description' is now included in the": {
            "content": "metadata when presented through the payload.  Line continuation\ncharacters have been removed.\n\nThe 'json' attribute was added.\n\n---------- Footnotes ----------\n\n(1)\nhttps://packaging.python.org/en/latest/glossary/#term-Distribution-Package\n\n(2) https://peps.python.org/pep-0566/\n\n(3)\nhttps://importlib-metadata.readthedocs.io/en/latest/api.html#importlibmetadata.PackageMetadata\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Distribution versions,  Next: Distribution files,  Prev: Distribution metadata,  Up: Functional API": {
            "content": "5.31.8.5 Distribution versions\n..............................\n",
            "subsections": []
        },
        "The 'version()' function is the quickest way to get a Distribution": {
            "content": "Package(1)'s version number, as a string:\n\n>>> version('wheel')\n'0.32.3'\n\n---------- Footnotes ----------\n\n(1)\nhttps://packaging.python.org/en/latest/glossary/#term-Distribution-Package\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Distribution files,  Next: Distribution requirements,  Prev: Distribution versions,  Up: Functional API": {
            "content": "5.31.8.6 Distribution files\n...........................\n\nYou can also get the full set of files contained within a distribution.",
            "subsections": []
        },
        "The 'files()' function takes a Distribution Package(1) name and returns": {
            "content": "all of the files installed by this distribution.  Each file object\nreturned is a 'PackagePath', a *note pathlib.PurePath: 1c5. derived\nobject with additional 'dist', 'size', and 'hash' properties as\nindicated by the metadata.  For example:\n\n>>> util = [p for p in files('wheel') if 'util.py' in str(p)][0]\n>>> util\nPackagePath('wheel/util.py')\n>>> util.size\n859\n>>> util.dist\n<importlib.metadata.hooks.PathDistribution object at 0x101e0cef0>\n>>> util.hash\n<FileHash mode: sha256 value: bYkw5oMccfazVCoYQwKkkemoVyMAFoR34mmKBx8R1NI>\n\nOnce you have the file, you can also read its contents:\n\n>>> print(util.readtext())\nimport base64\nimport sys\n...\ndef asbytes(s):\nif isinstance(s, texttype):\nreturn s.encode('utf-8')\nreturn s\n",
            "subsections": []
        },
        "You can also use the 'locate' method to get a the absolute path to the": {
            "content": "file:\n\n>>> util.locate()\nPosixPath('/home/gustav/example/lib/site-packages/wheel/util.py')\n",
            "subsections": []
        },
        "In the case where the metadata file listing files (RECORD or": {
            "content": "SOURCES.txt) is missing, 'files()' will return 'None'.  The caller may\nwish to wrap calls to 'files()' in alwaysiterable(2) or otherwise guard\nagainst this condition if the target distribution is not known to have\nthe metadata present.\n\n---------- Footnotes ----------\n\n(1)\nhttps://packaging.python.org/en/latest/glossary/#term-Distribution-Package\n\n(2)\nhttps://more-itertools.readthedocs.io/en/stable/api.html#moreitertools.alwaysiterable\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Distribution requirements,  Next: Mapping import to distribution packages,  Prev: Distribution files,  Up: Functional API": {
            "content": "5.31.8.7 Distribution requirements\n..................................\n",
            "subsections": []
        },
        "To get the full set of requirements for a Distribution Package(1), use": {
            "content": "the 'requires()' function:\n\n>>> requires('wheel')\n[\"pytest (>=3.0.0) ; extra == 'test'\", \"pytest-cov ; extra == 'test'\"]\n\n---------- Footnotes ----------\n\n(1)\nhttps://packaging.python.org/en/latest/glossary/#term-Distribution-Package\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Mapping import to distribution packages,  Prev: Distribution requirements,  Up: Functional API": {
            "content": "5.31.8.8 Mapping import to distribution packages\n................................................\n\nA convenience method to resolve the Distribution Package(1) name (or\nnames, in the case of a namespace package) that provide each importable\ntop-level Python module or Import Package(2):\n\n>>> packagesdistributions()\n{'importlibmetadata': ['importlib-metadata'], 'yaml': ['PyYAML'], 'jaraco': ['jaraco.classes', 'jaraco.functools'], ...}\n",
            "subsections": []
        },
        "Some editable installs, do not supply top-level names(3), and thus this": {
            "content": "function is not reliable with such installs.\n\nNew in version 3.10.\n\n---------- Footnotes ----------\n\n(1)\nhttps://packaging.python.org/en/latest/glossary/#term-Distribution-Package\n\n(2)\nhttps://packaging.python.org/en/latest/glossary/#term-Import-Package\n\n(3) https://github.com/pypa/packaging-problems/issues/609\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Distributions,  Next: Distribution Discovery,  Prev: Functional API,  Up: importlib metadata - Accessing package metadata": {
            "content": "5.31.8.9 Distributions\n......................\n",
            "subsections": []
        },
        "While the above API is the most common and convenient usage, you can get": {
            "content": "all of that information from the 'Distribution' class.  A 'Distribution'\nis an abstract object that represents the metadata for a Python\nDistribution Package(1).  You can get the 'Distribution' instance:\n\n>>> from importlib.metadata import distribution\n>>> dist = distribution('wheel')\n",
            "subsections": []
        },
        "Thus, an alternative way to get the version number is through the": {
            "content": "'Distribution' instance:\n\n>>> dist.version\n'0.32.3'\n",
            "subsections": []
        },
        "There are all kinds of additional metadata available on the": {
            "content": "'Distribution' instance:\n\n>>> dist.metadata['Requires-Python']\n'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'\n>>> dist.metadata['License']\n'MIT'\n",
            "subsections": []
        },
        "The full set of available metadata is not described here.  See the Core": {
            "content": "metadata specifications(2) for additional details.\n\n---------- Footnotes ----------\n\n(1)\nhttps://packaging.python.org/en/latest/glossary/#term-Distribution-Package\n\n(2)\nhttps://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Distribution Discovery,  Next: Extending the search algorithm,  Prev: Distributions,  Up: importlib metadata - Accessing package metadata": {
            "content": "5.31.8.10 Distribution Discovery\n................................\n",
            "subsections": []
        },
        "By default, this package provides built-in support for discovery of": {
            "content": "metadata for file system and zip file Distribution Package(1)s.  This\nmetadata finder search defaults to 'sys.path', but varies slightly in\nhow it interprets those values from how other import machinery does.  In\nparticular:\n\n- 'importlib.metadata' does not honor *note bytes: 295. objects on\n'sys.path'.\n\n- 'importlib.metadata' will incidentally honor *note pathlib.Path:\n149. objects on 'sys.path' even though such values will be ignored\nfor imports.\n\n---------- Footnotes ----------\n\n(1)\nhttps://packaging.python.org/en/latest/glossary/#term-Distribution-Package\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Extending the search algorithm,  Prev: Distribution Discovery,  Up: importlib metadata - Accessing package metadata": {
            "content": "5.31.8.11 Extending the search algorithm\n........................................\n\nBecause Distribution Package(1) metadata is not available through *note\nsys.path: 32c. searches, or package loaders directly, the metadata for a\ndistribution is found through import system *note finders: 1cfa.  To\nfind a distribution package's metadata, 'importlib.metadata' queries the\nlist of *note meta path finders: ee7. on *note sys.metapath: b80.\n",
            "subsections": []
        },
        "By default 'importlib.metadata' installs a finder for distribution": {
            "content": "packages found on the file system.  This finder doesn't actually find\nany 'distributions', but it can find their metadata.\n\nThe abstract class *note importlib.abc.MetaPathFinder: 669. defines the\ninterface expected of finders by Python's import system.\n'importlib.metadata' extends this protocol by looking for an optional\n'finddistributions' callable on the finders from *note sys.metapath:\nb80. and presents this extended interface as the 'DistributionFinder'\nabstract base class, which defines this abstract method:\n\n@abc.abstractmethod\ndef finddistributions(context=DistributionFinder.Context()):\n\"\"\"Return an iterable of all Distribution instances capable of\nloading the metadata for packages for the indicated ``context``.\n\"\"\"\n",
            "subsections": []
        },
        "The 'DistributionFinder.Context' object provides '.path' and '.name'": {
            "content": "properties indicating the path to search and name to match and may\nsupply other relevant context.\n",
            "subsections": []
        },
        "What this means in practice is that to support finding distribution": {
            "content": "package metadata in locations other than the file system, subclass\n'Distribution' and implement the abstract methods.  Then from a custom\nfinder, return instances of this derived 'Distribution' in the\n'finddistributions()' method.\n\n---------- Footnotes ----------\n\n(1)\nhttps://packaging.python.org/en/latest/glossary/#term-Distribution-Package\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The initialization of the sys path module search path,  Prev: importlib metadata - Accessing package metadata,  Up: Importing Modules": {
            "content": "A module search path is initialized when Python starts.  This module\nsearch path may be accessed at *note sys.path: 32c.\n",
            "subsections": []
        },
        "The first entry in the module search path is the directory that contains": {
            "content": "the input script, if there is one.  Otherwise, the first entry is the\ncurrent directory, which is the case when executing the interactive\nshell, a *note -c: 3a4. command, or *note -m: 3a5. module.\n\nThe *note PYTHONPATH: e92. environment variable is often used to add\ndirectories to the search path.  If this environment variable is found\nthen the contents are added to the module search path.\n\nNote: *note PYTHONPATH: e92. will affect all installed Python\nversions/environments.  Be wary of setting this in your shell\nprofile or global environment variables.  The *note site: c2.\nmodule offers more nuanced techniques as mentioned below.\n",
            "subsections": []
        },
        "The next items added are the directories containing standard Python": {
            "content": "modules as well as any *note extension module: 4218.s that these modules\ndepend on.  Extension modules are '.pyd' files on Windows and '.so'\nfiles on other platforms.  The directory with the platform-independent",
            "subsections": []
        },
        "Python modules is called 'prefix'.  The directory with the extension": {
            "content": "modules is called 'execprefix'.\n\nThe *note PYTHONHOME: 334. environment variable may be used to set the\n'prefix' and 'execprefix' locations.  Otherwise these directories are\nfound by using the Python executable as a starting point and then\nlooking for various 'landmark' files and directories.  Note that any\nsymbolic links are followed so the real Python executable location is\nused as the search starting point.  The Python executable location is\ncalled 'home'.\n",
            "subsections": []
        },
        "Once 'home' is determined, the 'prefix' directory is found by first": {
            "content": "looking for 'python`majorversion'`minorversion'.zip' ('python311.zip').",
            "subsections": []
        },
        "On Windows the zip archive is searched for in 'home' and on Unix the": {
            "content": "archive is expected to be in 'lib'.  Note that the expected zip archive\nlocation is added to the module search path even if the archive does not\nexist.  If no archive was found, Python on Windows will continue the\nsearch for 'prefix' by looking for 'Lib\\os.py'.  Python on Unix will\nlook for 'lib/python`majorversion'.`minorversion'/os.py'\n('lib/python3.11/os.py').  On Windows 'prefix' and 'execprefix' are the\nsame, however on other platforms\n'lib/python`majorversion'.`minorversion'/lib-dynload'\n('lib/python3.11/lib-dynload') is searched for and used as an anchor for\n'execprefix'.  On some platforms 'lib' may be 'lib64' or another value,\nsee *note sys.platlibdir: 756. and *note PYTHONPLATLIBDIR: 16a6.\n\nOnce found, 'prefix' and 'execprefix' are available at *note\nsys.prefix: 32e. and *note sys.execprefix: 32a. respectively.\n\nFinally, the *note site: c2. module is processed and 'site-packages'\ndirectories are added to the module search path.  A common way to\ncustomize the search path is to create *note sitecustomize: c3. or *note\nusercustomize: 109. modules as described in the *note site: c2. module\ndocumentation.\n\nNote: Certain command line options may further affect path\ncalculations.  See *note -E: 77e, *note -I: 77f, *note -s: 1200.\nand *note -S: 101c. for further details.\n\n* Menu:\n\n* Virtual environments: Virtual environments<2>.\n* pth files::\n* Embedded Python::\n\nFile: python3.12.info,  Node: Virtual environments<2>,  Next: pth files,  Up: The initialization of the sys path module search path\n\n5.31.9.1 Virtual environments\n.............................\n\nIf Python is run in a virtual environment (as described at *note Virtual",
            "subsections": []
        },
        "Environments and Packages: 1a82.) then 'prefix' and 'execprefix' are": {
            "content": "specific to the virtual environment.\n",
            "subsections": []
        },
        "If a 'pyvenv.cfg' file is found alongside the main executable, or in the": {
            "content": "directory one level above the executable, the following variations\napply:\n\n* If 'home' is an absolute path and *note PYTHONHOME: 334. is not\nset, this path is used instead of the path to the main executable\nwhen deducing 'prefix' and 'execprefix'.\n\nFile: python3.12.info,  Node: pth files,  Next: Embedded Python,  Prev: Virtual environments<2>,  Up: The initialization of the sys path module search path\n\n5.31.9.2 pth files\n...................\n\nTo completely override *note sys.path: 32c. create a '.pth' file with\nthe same name as the shared library or executable ('python.pth' or\n'python311.pth').  The shared library path is always known on Windows,\nhowever it may not be available on other platforms.  In the '.pth' file\nspecify one line for each path to add to *note sys.path: 32c.  The file\nbased on the shared library name overrides the one based on the\nexecutable, which allows paths to be restricted for any program loading\nthe runtime if desired.\n",
            "subsections": []
        },
        "When the file exists, all registry and environment variables are": {
            "content": "ignored, isolated mode is enabled, and *note site: c2. is not imported\nunless one line in the file specifies 'import site'.  Blank paths and\nlines starting with '#' are ignored.  Each path may be absolute or\nrelative to the location of the file.  Import statements other than to\n'site' are not permitted, and arbitrary code cannot be specified.\n",
            "subsections": []
        },
        "Note that '.pth' files (without leading underscore) will be processed": {
            "content": "normally by the *note site: c2. module when 'import site' has been\nspecified.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Embedded Python,  Prev: pth files,  Up: The initialization of the sys path module search path": {
            "content": "5.31.9.3 Embedded Python\n........................\n\nIf Python is embedded within another application *note\nPyInitializeFromConfig(): 317. and the *note PyConfig: 318. structure\ncan be used to initialize Python.  The path specific details are\ndescribed at *note Python Path Configuration: 6c3.  Alternatively the\nolder *note PySetPath(): 1b74. can be used to bypass the initialization\nof the module search path.\n\nSee also\n........\n\n* *note Finding modules: a67. for detailed Windows notes.\n\n* *note Using Python on Unix platforms: 1ad8. for Unix details.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python Language Services,  Next: MS Windows Specific Services,  Prev: Importing Modules,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.32 Python Language Services",
                    "content": ""
                }
            ]
        },
        "Python provides a number of modules to assist in working with the Python": {
            "content": "language.  These modules support tokenizing, parsing, syntax analysis,\nbytecode disassembly, and various other facilities.\n\nThese modules include:\n\n* Menu:\n\n* ast -- Abstract Syntax Trees::\n* symtable -- Access to the compiler's symbol tables::\n* token -- Constants used with Python parse trees::\n* keyword -- Testing for Python keywords::\n* tokenize -- Tokenizer for Python source::\n* tabnanny -- Detection of ambiguous indentation::\n* pyclbr -- Python module browser support::\n* pycompile -- Compile Python source files::\n* compileall -- Byte-compile Python libraries::\n* dis -- Disassembler for Python bytecode::\n* pickletools -- Tools for pickle developers::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ast -- Abstract Syntax Trees,  Next: symtable -- Access to the compiler's symbol tables,  Up: Python Language Services": {
            "content": "'Source code:' Lib/ast.py(1)\n\n\n\nThe *note ast: 8. module helps Python applications to process trees of\nthe Python abstract syntax grammar.  The abstract syntax itself might\nchange with each Python release; this module helps to find out\nprogrammatically what the current grammar looks like.\n\nAn abstract syntax tree can be generated by passing *note\nast.PyCFONLYAST: 4221. as a flag to the *note compile(): 528. built-in\nfunction, or using the *note parse(): 182. helper provided in this\nmodule.  The result will be a tree of objects whose classes all inherit\nfrom *note ast.AST: 527.  An abstract syntax tree can be compiled into a\nPython code object using the built-in *note compile(): 528. function.\n\n* Menu:\n\n* Abstract Grammar::\n* Node classes::\n* ast Helpers::\n* Compiler Flags::\n* Command-Line Usage: Command-Line Usage<4>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/ast.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Abstract Grammar,  Next: Node classes,  Up: ast -- Abstract Syntax Trees": {
            "content": "5.32.1.1 Abstract Grammar\n.........................\n\nThe abstract grammar is currently defined as follows:\n\n-- ASDL's 4 builtin types are:\n-- identifier, int, string, constant\n\nmodule Python\n{\nmod = Module(stmt* body, typeignore* typeignores)\n| Interactive(stmt* body)\n| Expression(expr body)\n| FunctionType(expr* argtypes, expr returns)\n\nstmt = FunctionDef(identifier name, arguments args,\nstmt* body, expr* decoratorlist, expr? returns,\nstring? typecomment, typeparam* typeparams)\n| AsyncFunctionDef(identifier name, arguments args,\nstmt* body, expr* decoratorlist, expr? returns,\nstring? typecomment, typeparam* typeparams)\n\n| ClassDef(identifier name,\nexpr* bases,\nkeyword* keywords,\nstmt* body,\nexpr* decoratorlist,\ntypeparam* typeparams)\n| Return(expr? value)\n\n| Delete(expr* targets)\n| Assign(expr* targets, expr value, string? typecomment)\n| TypeAlias(expr name, typeparam* typeparams, expr value)\n| AugAssign(expr target, operator op, expr value)\n-- 'simple' indicates that we annotate simple name without parens\n| AnnAssign(expr target, expr annotation, expr? value, int simple)\n\n-- use 'orelse' because else is a keyword in target languages\n| For(expr target, expr iter, stmt* body, stmt* orelse, string? typecomment)\n| AsyncFor(expr target, expr iter, stmt* body, stmt* orelse, string? typecomment)\n| While(expr test, stmt* body, stmt* orelse)\n| If(expr test, stmt* body, stmt* orelse)\n| With(withitem* items, stmt* body, string? typecomment)\n| AsyncWith(withitem* items, stmt* body, string? typecomment)\n\n| Match(expr subject, matchcase* cases)\n\n| Raise(expr? exc, expr? cause)\n| Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)\n| TryStar(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)\n| Assert(expr test, expr? msg)\n\n| Import(alias* names)\n| ImportFrom(identifier? module, alias* names, int? level)\n\n| Global(identifier* names)\n| Nonlocal(identifier* names)\n| Expr(expr value)\n| Pass | Break | Continue\n\n-- coloffset is the byte offset in the utf8 string the parser uses\nattributes (int lineno, int coloffset, int? endlineno, int? endcoloffset)\n\n-- BoolOp() can use left & right?\nexpr = BoolOp(boolop op, expr* values)\n| NamedExpr(expr target, expr value)\n| BinOp(expr left, operator op, expr right)\n| UnaryOp(unaryop op, expr operand)\n| Lambda(arguments args, expr body)\n| IfExp(expr test, expr body, expr orelse)\n| Dict(expr* keys, expr* values)\n| Set(expr* elts)\n| ListComp(expr elt, comprehension* generators)\n| SetComp(expr elt, comprehension* generators)\n| DictComp(expr key, expr value, comprehension* generators)\n| GeneratorExp(expr elt, comprehension* generators)\n-- the grammar constrains where yield expressions can occur\n| Await(expr value)\n| Yield(expr? value)\n| YieldFrom(expr value)\n-- need sequences for compare to distinguish between\n-- x < 4 < 3 and (x < 4) < 3\n| Compare(expr left, cmpop* ops, expr* comparators)\n| Call(expr func, expr* args, keyword* keywords)\n| FormattedValue(expr value, int conversion, expr? formatspec)\n| JoinedStr(expr* values)\n| Constant(constant value, string? kind)\n\n-- the following expression can appear in assignment context\n| Attribute(expr value, identifier attr, exprcontext ctx)\n| Subscript(expr value, expr slice, exprcontext ctx)\n| Starred(expr value, exprcontext ctx)\n| Name(identifier id, exprcontext ctx)\n| List(expr* elts, exprcontext ctx)\n| Tuple(expr* elts, exprcontext ctx)\n\n-- can appear only in Subscript\n| Slice(expr? lower, expr? upper, expr? step)\n\n-- coloffset is the byte offset in the utf8 string the parser uses\nattributes (int lineno, int coloffset, int? endlineno, int? endcoloffset)\n\nexprcontext = Load | Store | Del\n\nboolop = And | Or\n\noperator = Add | Sub | Mult | MatMult | Div | Mod | Pow | LShift\n| RShift | BitOr | BitXor | BitAnd | FloorDiv\n\nunaryop = Invert | Not | UAdd | USub\n\ncmpop = Eq | NotEq | Lt | LtE | Gt | GtE | Is | IsNot | In | NotIn\n\ncomprehension = (expr target, expr iter, expr* ifs, int isasync)\n\nexcepthandler = ExceptHandler(expr? type, identifier? name, stmt* body)\nattributes (int lineno, int coloffset, int? endlineno, int? endcoloffset)\n\narguments = (arg* posonlyargs, arg* args, arg? vararg, arg* kwonlyargs,\nexpr* kwdefaults, arg? kwarg, expr* defaults)\n\narg = (identifier arg, expr? annotation, string? typecomment)\nattributes (int lineno, int coloffset, int? endlineno, int? endcoloffset)\n\n-- keyword arguments supplied to call (NULL identifier for kwargs)\nkeyword = (identifier? arg, expr value)\nattributes (int lineno, int coloffset, int? endlineno, int? endcoloffset)\n\n-- import name with optional 'as' alias.\nalias = (identifier name, identifier? asname)\nattributes (int lineno, int coloffset, int? endlineno, int? endcoloffset)\n\nwithitem = (expr contextexpr, expr? optionalvars)\n\nmatchcase = (pattern pattern, expr? guard, stmt* body)\n\npattern = MatchValue(expr value)\n| MatchSingleton(constant value)\n| MatchSequence(pattern* patterns)\n| MatchMapping(expr* keys, pattern* patterns, identifier? rest)\n| MatchClass(expr cls, pattern* patterns, identifier* kwdattrs, pattern* kwdpatterns)\n\n| MatchStar(identifier? name)\n-- The optional \"rest\" MatchMapping parameter handles capturing extra mapping keys\n\n| MatchAs(pattern? pattern, identifier? name)\n| MatchOr(pattern* patterns)\n\nattributes (int lineno, int coloffset, int endlineno, int endcoloffset)\n\ntypeignore = TypeIgnore(int lineno, string tag)\n\ntypeparam = TypeVar(identifier name, expr? bound)\n| ParamSpec(identifier name)\n| TypeVarTuple(identifier name)\nattributes (int lineno, int coloffset, int endlineno, int endcoloffset)\n}\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Node classes,  Next: ast Helpers,  Prev: Abstract Grammar,  Up: ast -- Abstract Syntax Trees": {
            "content": "5.32.1.2 Node classes\n.....................\n\n-- Class: ast.AST\n\nThis is the base of all AST node classes.  The actual node classes\nare derived from the 'Parser/Python.asdl' file, which is reproduced\n*note above: 4222.  They are defined in the 'ast' C module and\nre-exported in *note ast: 8.\n\nThere is one class defined for each left-hand side symbol in the\nabstract grammar (for example, 'ast.stmt' or 'ast.expr').  In\naddition, there is one class defined for each constructor on the\nright-hand side; these classes inherit from the classes for the\nleft-hand side trees.  For example, *note ast.BinOp: 173c. inherits\nfrom 'ast.expr'.  For production rules with alternatives (aka\n\"sums\"), the left-hand side class is abstract: only instances of\nspecific constructor nodes are ever created.\n\n-- Attribute: fields\n\nEach concrete class has an attribute *note fields: 4225.\nwhich gives the names of all child nodes.\n\nEach instance of a concrete class has one attribute for each\nchild node, of the type as defined in the grammar.  For\nexample, *note ast.BinOp: 173c. instances have an attribute\n'left' of type 'ast.expr'.\n\nIf these attributes are marked as optional in the grammar\n(using a question mark), the value might be 'None'.  If the\nattributes can have zero-or-more values (marked with an\nasterisk), the values are represented as Python lists.  All\npossible attributes must be present and have valid values when\ncompiling an AST with *note compile(): 528.\n\n-- Attribute: lineno\n-- Attribute: coloffset\n-- Attribute: endlineno\n-- Attribute: endcoloffset\n\nInstances of 'ast.expr' and 'ast.stmt' subclasses have *note\nlineno: 4226, *note coloffset: 4227, *note endlineno: 4228,\nand *note endcoloffset: 4229. attributes.  The *note lineno:\n4226. and *note endlineno: 4228. are the first and last line\nnumbers of source text span (1-indexed so the first line is\nline 1) and the *note coloffset: 4227. and *note\nendcoloffset: 4229. are the corresponding UTF-8 byte offsets\nof the first and last tokens that generated the node.  The\nUTF-8 offset is recorded because the parser uses UTF-8\ninternally.\n\nNote that the end positions are not required by the compiler\nand are therefore optional.  The end offset is 'after' the\nlast symbol, for example one can get the source segment of a\none-line expression node using 'sourceline[node.coloffset :\nnode.endcoloffset]'.\n\nThe constructor of a class 'ast.T' parses its arguments as follows:\n\n* If there are positional arguments, there must be as many as\nthere are items in 'T.fields'; they will be assigned as\nattributes of these names.\n\n* If there are keyword arguments, they will set the attributes\nof the same names to the given values.\n\nFor example, to create and populate an *note ast.UnaryOp: 422a.\nnode, you could use\n\nnode = ast.UnaryOp()\nnode.op = ast.USub()\nnode.operand = ast.Constant()\nnode.operand.value = 5\nnode.operand.lineno = 0\nnode.operand.coloffset = 0\nnode.lineno = 0\nnode.coloffset = 0\n\nor the more compact\n\nnode = ast.UnaryOp(ast.USub(), ast.Constant(5, lineno=0, coloffset=0),\nlineno=0, coloffset=0)\n\nChanged in version 3.8: Class *note ast.Constant: 215. is now used for\nall constants.\n",
            "subsections": []
        },
        "Changed in version 3.9: Simple indices are represented by their value,": {
            "content": "extended slices are represented as tuples.\n",
            "subsections": []
        },
        "Deprecated since version 3.8: Old classes 'ast.Num', 'ast.Str',": {
            "content": "'ast.Bytes', 'ast.NameConstant' and 'ast.Ellipsis' are still available,\nbut they will be removed in future Python releases.  In the meantime,\ninstantiating them will return an instance of a different class.\n",
            "subsections": []
        },
        "Deprecated since version 3.9: Old classes 'ast.Index' and 'ast.ExtSlice'": {
            "content": "are still available, but they will be removed in future Python releases.",
            "subsections": []
        },
        "In the meantime, instantiating them will return an instance of a": {
            "content": "different class.\n\nNote: The descriptions of the specific node classes displayed here\nwere initially adapted from the fantastic Green Tree Snakes(1)\nproject and all its contributors.\n\n* Menu:\n\n* Root nodes::\n* Literals: Literals<3>.\n* Variables::\n* Expressions: Expressions<2>.\n* Statements::\n* Control flow::\n* Pattern matching::\n* Type parameters::\n* Function and class definitions::\n* Async and await::\n\n---------- Footnotes ----------\n\n(1) https://greentreesnakes.readthedocs.io/en/latest/\n\nFile: python3.12.info,  Node: Root nodes,  Next: Literals<3>,  Up: Node classes\n\n5.32.1.3 Root nodes\n...................\n\n-- Class: ast.Module (body, typeignores)\n\nA Python module, as with *note file input: 1e48.  Node type\ngenerated by *note ast.parse(): 182. in the default '\"exec\"'\n'mode'.\n\n'body' is a *note list: 3dc. of the module's *note Statements:\n422e.\n\n'typeignores' is a *note list: 3dc. of the module's type ignore\ncomments; see *note ast.parse(): 182. for more details.\n\n>>> print(ast.dump(ast.parse('x = 1'), indent=4))\nModule(\nbody=[\nAssign(\ntargets=[\nName(id='x', ctx=Store())],\nvalue=Constant(value=1))],\ntypeignores=[])\n\n-- Class: ast.Expression (body)\n\nA single Python *note expression input: 1e4e.  Node type generated\nby *note ast.parse(): 182. when 'mode' is '\"eval\"'.\n\n'body' is a single node, one of the *note expression types: 4230.\n\n>>> print(ast.dump(ast.parse('123', mode='eval'), indent=4))\nExpression(\nbody=Constant(value=123))\n\n-- Class: ast.Interactive (body)\n\nA single *note interactive input: 1e4b, like in *note Interactive\nMode: 196f.  Node type generated by *note ast.parse(): 182. when\n'mode' is '\"single\"'.\n\n'body' is a *note list: 3dc. of *note statement nodes: 422e.\n\n>>> print(ast.dump(ast.parse('x = 1; y = 2', mode='single'), indent=4))\nInteractive(\nbody=[\nAssign(\ntargets=[\nName(id='x', ctx=Store())],\nvalue=Constant(value=1)),\nAssign(\ntargets=[\nName(id='y', ctx=Store())],\nvalue=Constant(value=2))])\n\n-- Class: ast.FunctionType (argtypes, returns)\n\nA representation of an old-style type comments for functions, as\nPython versions prior to 3.5 didn't support PEP 484(1) annotations.\nNode type generated by *note ast.parse(): 182. when 'mode' is\n'\"functype\"'.\n\nSuch type comments would look like this:\n\ndef sumtwonumber(a, b):\n# type: (int, int) -> int\nreturn a + b\n\n'argtypes' is a *note list: 3dc. of *note expression nodes: 4230.\n\n'returns' is a single *note expression node: 4230.\n\n>>> print(ast.dump(ast.parse('(int, str) -> List[int]', mode='functype'), indent=4))\nFunctionType(\nargtypes=[\nName(id='int', ctx=Load()),\nName(id='str', ctx=Load())],\nreturns=Subscript(\nvalue=Name(id='List', ctx=Load()),\nslice=Name(id='int', ctx=Load()),\nctx=Load()))\n\nNew in version 3.8.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0484/\n\nFile: python3.12.info,  Node: Literals<3>,  Next: Variables,  Prev: Root nodes,  Up: Node classes\n\n5.32.1.4 Literals\n.................\n\n-- Class: ast.Constant (value)\n\nA constant value.  The 'value' attribute of the 'Constant' literal\ncontains the Python object it represents.  The values represented\ncan be simple types such as a number, string or 'None', but also\nimmutable container types (tuples and frozensets) if all of their\nelements are constant.\n\n>>> print(ast.dump(ast.parse('123', mode='eval'), indent=4))\nExpression(\nbody=Constant(value=123))\n\n-- Class: ast.FormattedValue (value, conversion, formatspec)\n\nNode representing a single formatting field in an f-string.  If the\nstring contains a single formatting field and nothing else the node\ncan be isolated otherwise it appears in *note JoinedStr: 143b.\n\n* 'value' is any expression node (such as a literal, a variable,\nor a function call).\n\n* 'conversion' is an integer:\n\n* -1: no formatting\n\n* 115: '!s' string formatting\n\n* 114: '!r' repr formatting\n\n* 97: '!a' ascii formatting\n\n* 'formatspec' is a *note JoinedStr: 143b. node representing\nthe formatting of the value, or 'None' if no format was\nspecified.  Both 'conversion' and 'formatspec' can be set at\nthe same time.\n\n-- Class: ast.JoinedStr (values)\n\nAn f-string, comprising a series of *note FormattedValue: 4234. and\n*note Constant: 215. nodes.\n\n>>> print(ast.dump(ast.parse('f\"sin({a}) is {sin(a):.3}\"', mode='eval'), indent=4))\nExpression(\nbody=JoinedStr(\nvalues=[\nConstant(value='sin('),\nFormattedValue(\nvalue=Name(id='a', ctx=Load()),\nconversion=-1),\nConstant(value=') is '),\nFormattedValue(\nvalue=Call(\nfunc=Name(id='sin', ctx=Load()),\nargs=[\nName(id='a', ctx=Load())],\nkeywords=[]),\nconversion=-1,\nformatspec=JoinedStr(\nvalues=[\nConstant(value='.3')]))]))\n\n-- Class: ast.List (elts, ctx)\n-- Class: ast.Tuple (elts, ctx)\n\nA list or tuple.  'elts' holds a list of nodes representing the\nelements.  'ctx' is *note Store: 4237. if the container is an\nassignment target (i.e.  '(x,y)=something'), and *note Load: 4238.\notherwise.\n\n>>> print(ast.dump(ast.parse('[1, 2, 3]', mode='eval'), indent=4))\nExpression(\nbody=List(\nelts=[\nConstant(value=1),\nConstant(value=2),\nConstant(value=3)],\nctx=Load()))\n>>> print(ast.dump(ast.parse('(1, 2, 3)', mode='eval'), indent=4))\nExpression(\nbody=Tuple(\nelts=[\nConstant(value=1),\nConstant(value=2),\nConstant(value=3)],\nctx=Load()))\n\n-- Class: ast.Set (elts)\n\nA set.  'elts' holds a list of nodes representing the set's\nelements.\n\n>>> print(ast.dump(ast.parse('{1, 2, 3}', mode='eval'), indent=4))\nExpression(\nbody=Set(\nelts=[\nConstant(value=1),\nConstant(value=2),\nConstant(value=3)]))\n\n-- Class: ast.Dict (keys, values)\n\nA dictionary.  'keys' and 'values' hold lists of nodes representing\nthe keys and the values respectively, in matching order (what would\nbe returned when calling 'dictionary.keys()' and\n'dictionary.values()').\n\nWhen doing dictionary unpacking using dictionary literals the\nexpression to be expanded goes in the 'values' list, with a 'None'\nat the corresponding position in 'keys'.\n\n>>> print(ast.dump(ast.parse('{\"a\":1, d}', mode='eval'), indent=4))\nExpression(\nbody=Dict(\nkeys=[\nConstant(value='a'),\nNone],\nvalues=[\nConstant(value=1),\nName(id='d', ctx=Load())]))\n\nFile: python3.12.info,  Node: Variables,  Next: Expressions<2>,  Prev: Literals<3>,  Up: Node classes\n\n5.32.1.5 Variables\n..................\n\n-- Class: ast.Name (id, ctx)\n\nA variable name.  'id' holds the name as a string, and 'ctx' is one\nof the following types.\n\n-- Class: ast.Load\n-- Class: ast.Store\n-- Class: ast.Del\n\nVariable references can be used to load the value of a variable, to\nassign a new value to it, or to delete it.  Variable references are\ngiven a context to distinguish these cases.\n\n>>> print(ast.dump(ast.parse('a'), indent=4))\nModule(\nbody=[\nExpr(\nvalue=Name(id='a', ctx=Load()))],\ntypeignores=[])\n\n>>> print(ast.dump(ast.parse('a = 1'), indent=4))\nModule(\nbody=[\nAssign(\ntargets=[\nName(id='a', ctx=Store())],\nvalue=Constant(value=1))],\ntypeignores=[])\n\n>>> print(ast.dump(ast.parse('del a'), indent=4))\nModule(\nbody=[\nDelete(\ntargets=[\nName(id='a', ctx=Del())])],\ntypeignores=[])\n\n-- Class: ast.Starred (value, ctx)\n\nA '*var' variable reference.  'value' holds the variable, typically\na *note Name: 16a5. node.  This type must be used when building a\n*note Call: 423d. node with '*args'.\n\n>>> print(ast.dump(ast.parse('a, *b = it'), indent=4))\nModule(\nbody=[\nAssign(\ntargets=[\nTuple(\nelts=[\nName(id='a', ctx=Store()),\nStarred(\nvalue=Name(id='b', ctx=Store()),\nctx=Store())],\nctx=Store())],\nvalue=Name(id='it', ctx=Load()))],\ntypeignores=[])\n\nFile: python3.12.info,  Node: Expressions<2>,  Next: Statements,  Prev: Variables,  Up: Node classes\n\n5.32.1.6 Expressions\n....................\n\n-- Class: ast.Expr (value)\n\nWhen an expression, such as a function call, appears as a statement\nby itself with its return value not used or stored, it is wrapped\nin this container.  'value' holds one of the other nodes in this\nsection, a *note Constant: 215, a *note Name: 16a5, a *note Lambda:\n4240, a *note Yield: 4241. or *note YieldFrom: 4242. node.\n\n>>> print(ast.dump(ast.parse('-a'), indent=4))\nModule(\nbody=[\nExpr(\nvalue=UnaryOp(\nop=USub(),\noperand=Name(id='a', ctx=Load())))],\ntypeignores=[])\n\n-- Class: ast.UnaryOp (op, operand)\n\nA unary operation.  'op' is the operator, and 'operand' any\nexpression node.\n\n-- Class: ast.UAdd\n-- Class: ast.USub\n-- Class: ast.Not\n-- Class: ast.Invert\n\nUnary operator tokens.  *note Not: 4245. is the 'not' keyword,\n*note Invert: 4246. is the '~' operator.\n\n>>> print(ast.dump(ast.parse('not x', mode='eval'), indent=4))\nExpression(\nbody=UnaryOp(\nop=Not(),\noperand=Name(id='x', ctx=Load())))\n\n-- Class: ast.BinOp (left, op, right)\n\nA binary operation (like addition or division).  'op' is the\noperator, and 'left' and 'right' are any expression nodes.\n\n>>> print(ast.dump(ast.parse('x + y', mode='eval'), indent=4))\nExpression(\nbody=BinOp(\nleft=Name(id='x', ctx=Load()),\nop=Add(),\nright=Name(id='y', ctx=Load())))\n\n-- Class: ast.Add\n-- Class: ast.Sub\n-- Class: ast.Mult\n-- Class: ast.Div\n-- Class: ast.FloorDiv\n-- Class: ast.Mod\n-- Class: ast.Pow\n-- Class: ast.LShift\n-- Class: ast.RShift\n-- Class: ast.BitOr\n-- Class: ast.BitXor\n-- Class: ast.BitAnd\n-- Class: ast.MatMult\n\nBinary operator tokens.\n\n-- Class: ast.BoolOp (op, values)\n\nA boolean operation, 'or' or 'and'.  'op' is *note Or: 4255. or\n*note And: 4256.  'values' are the values involved.  Consecutive\noperations with the same operator, such as 'a or b or c', are\ncollapsed into one node with several values.\n\nThis doesn't include 'not', which is a *note UnaryOp: 422a.\n\n>>> print(ast.dump(ast.parse('x or y', mode='eval'), indent=4))\nExpression(\nbody=BoolOp(\nop=Or(),\nvalues=[\nName(id='x', ctx=Load()),\nName(id='y', ctx=Load())]))\n\n-- Class: ast.And\n-- Class: ast.Or\n\nBoolean operator tokens.\n\n-- Class: ast.Compare (left, ops, comparators)\n\nA comparison of two or more values.  'left' is the first value in\nthe comparison, 'ops' the list of operators, and 'comparators' the\nlist of values after the first element in the comparison.\n\n>>> print(ast.dump(ast.parse('1 <= a < 10', mode='eval'), indent=4))\nExpression(\nbody=Compare(\nleft=Constant(value=1),\nops=[\nLtE(),\nLt()],\ncomparators=[\nName(id='a', ctx=Load()),\nConstant(value=10)]))\n\n-- Class: ast.Eq\n-- Class: ast.NotEq\n-- Class: ast.Lt\n-- Class: ast.LtE\n-- Class: ast.Gt\n-- Class: ast.GtE\n-- Class: ast.Is\n-- Class: ast.IsNot\n-- Class: ast.In\n-- Class: ast.NotIn\n\nComparison operator tokens.\n\n-- Class: ast.Call (func, args, keywords)\n\nA function call.  'func' is the function, which will often be a\n*note Name: 16a5. or *note Attribute: 4262. object.  Of the\narguments:\n\n* 'args' holds a list of the arguments passed by position.\n\n* 'keywords' holds a list of *note keyword: 4263. objects\nrepresenting arguments passed by keyword.\n\nWhen creating a 'Call' node, 'args' and 'keywords' are required,\nbut they can be empty lists.\n\n>>> print(ast.dump(ast.parse('func(a, b=c, *d, e)', mode='eval'), indent=4))\nExpression(\nbody=Call(\nfunc=Name(id='func', ctx=Load()),\nargs=[\nName(id='a', ctx=Load()),\nStarred(\nvalue=Name(id='d', ctx=Load()),\nctx=Load())],\nkeywords=[\nkeyword(\narg='b',\nvalue=Name(id='c', ctx=Load())),\nkeyword(\nvalue=Name(id='e', ctx=Load()))]))\n\n-- Class: ast.keyword (arg, value)\n\nA keyword argument to a function call or class definition.  'arg'\nis a raw string of the parameter name, 'value' is a node to pass\nin.\n\n-- Class: ast.IfExp (test, body, orelse)\n\nAn expression such as 'a if b else c'.  Each field holds a single\nnode, so in the following example, all three are *note Name: 16a5.\nnodes.\n\n>>> print(ast.dump(ast.parse('a if b else c', mode='eval'), indent=4))\nExpression(\nbody=IfExp(\ntest=Name(id='b', ctx=Load()),\nbody=Name(id='a', ctx=Load()),\norelse=Name(id='c', ctx=Load())))\n\n-- Class: ast.Attribute (value, attr, ctx)\n\nAttribute access, e.g.  'd.keys'.  'value' is a node, typically a\n*note Name: 16a5.  'attr' is a bare string giving the name of the\nattribute, and 'ctx' is *note Load: 4238, *note Store: 4237. or\n*note Del: 423b. according to how the attribute is acted on.\n\n>>> print(ast.dump(ast.parse('snake.colour', mode='eval'), indent=4))\nExpression(\nbody=Attribute(\nvalue=Name(id='snake', ctx=Load()),\nattr='colour',\nctx=Load()))\n\n-- Class: ast.NamedExpr (target, value)\n\nA named expression.  This AST node is produced by the assignment\nexpressions operator (also known as the walrus operator).  As\nopposed to the *note Assign: 4266. node in which the first argument\ncan be multiple nodes, in this case both 'target' and 'value' must\nbe single nodes.\n\n>>> print(ast.dump(ast.parse('(x := 4)', mode='eval'), indent=4))\nExpression(\nbody=NamedExpr(\ntarget=Name(id='x', ctx=Store()),\nvalue=Constant(value=4)))\n\nNew in version 3.8.\n\n* Menu:\n\n* Subscripting::\n* Comprehensions::\n\nFile: python3.12.info,  Node: Subscripting,  Next: Comprehensions,  Up: Expressions<2>\n\n5.32.1.7 Subscripting\n.....................\n\n-- Class: ast.Subscript (value, slice, ctx)\n\nA subscript, such as 'l[1]'.  'value' is the subscripted object\n(usually sequence or mapping).  'slice' is an index, slice or key.\nIt can be a *note Tuple: 4236. and contain a *note Slice: 4269.\n'ctx' is *note Load: 4238, *note Store: 4237. or *note Del: 423b.\naccording to the action performed with the subscript.\n\n>>> print(ast.dump(ast.parse('l[1:2, 3]', mode='eval'), indent=4))\nExpression(\nbody=Subscript(\nvalue=Name(id='l', ctx=Load()),\nslice=Tuple(\nelts=[\nSlice(\nlower=Constant(value=1),\nupper=Constant(value=2)),\nConstant(value=3)],\nctx=Load()),\nctx=Load()))\n\n-- Class: ast.Slice (lower, upper, step)\n\nRegular slicing (on the form 'lower:upper' or 'lower:upper:step').\nCan occur only inside the 'slice' field of *note Subscript: 4268,\neither directly or as an element of *note Tuple: 4236.\n\n>>> print(ast.dump(ast.parse('l[1:2]', mode='eval'), indent=4))\nExpression(\nbody=Subscript(\nvalue=Name(id='l', ctx=Load()),\nslice=Slice(\nlower=Constant(value=1),\nupper=Constant(value=2)),\nctx=Load()))\n\nFile: python3.12.info,  Node: Comprehensions,  Prev: Subscripting,  Up: Expressions<2>\n\n5.32.1.8 Comprehensions\n.......................\n\n-- Class: ast.ListComp (elt, generators)\n-- Class: ast.SetComp (elt, generators)\n-- Class: ast.GeneratorExp (elt, generators)\n-- Class: ast.DictComp (key, value, generators)\n\nList and set comprehensions, generator expressions, and dictionary\ncomprehensions.  'elt' (or 'key' and 'value') is a single node\nrepresenting the part that will be evaluated for each item.\n\n'generators' is a list of *note comprehension: 426f. nodes.\n\n>>> print(ast.dump(ast.parse('[x for x in numbers]', mode='eval'), indent=4))\nExpression(\nbody=ListComp(\nelt=Name(id='x', ctx=Load()),\ngenerators=[\ncomprehension(\ntarget=Name(id='x', ctx=Store()),\niter=Name(id='numbers', ctx=Load()),\nifs=[],\nisasync=0)]))\n>>> print(ast.dump(ast.parse('{x: x2 for x in numbers}', mode='eval'), indent=4))\nExpression(\nbody=DictComp(\nkey=Name(id='x', ctx=Load()),\nvalue=BinOp(\nleft=Name(id='x', ctx=Load()),\nop=Pow(),\nright=Constant(value=2)),\ngenerators=[\ncomprehension(\ntarget=Name(id='x', ctx=Store()),\niter=Name(id='numbers', ctx=Load()),\nifs=[],\nisasync=0)]))\n>>> print(ast.dump(ast.parse('{x for x in numbers}', mode='eval'), indent=4))\nExpression(\nbody=SetComp(\nelt=Name(id='x', ctx=Load()),\ngenerators=[\ncomprehension(\ntarget=Name(id='x', ctx=Store()),\niter=Name(id='numbers', ctx=Load()),\nifs=[],\nisasync=0)]))\n\n-- Class: ast.comprehension (target, iter, ifs, isasync)\n\nOne 'for' clause in a comprehension.  'target' is the reference to\nuse for each element - typically a *note Name: 16a5. or *note\nTuple: 4236. node.  'iter' is the object to iterate over.  'ifs' is\na list of test expressions: each 'for' clause can have multiple\n'ifs'.\n\n'isasync' indicates a comprehension is asynchronous (using an\n'async for' instead of 'for').  The value is an integer (0 or 1).\n\n>>> print(ast.dump(ast.parse('[ord(c) for line in file for c in line]', mode='eval'),\n...                indent=4)) # Multiple comprehensions in one.\nExpression(\nbody=ListComp(\nelt=Call(\nfunc=Name(id='ord', ctx=Load()),\nargs=[\nName(id='c', ctx=Load())],\nkeywords=[]),\ngenerators=[\ncomprehension(\ntarget=Name(id='line', ctx=Store()),\niter=Name(id='file', ctx=Load()),\nifs=[],\nisasync=0),\ncomprehension(\ntarget=Name(id='c', ctx=Store()),\niter=Name(id='line', ctx=Load()),\nifs=[],\nisasync=0)]))\n\n>>> print(ast.dump(ast.parse('(n2 for n in it if n>5 if n<10)', mode='eval'),\n...                indent=4)) # generator comprehension\nExpression(\nbody=GeneratorExp(\nelt=BinOp(\nleft=Name(id='n', ctx=Load()),\nop=Pow(),\nright=Constant(value=2)),\ngenerators=[\ncomprehension(\ntarget=Name(id='n', ctx=Store()),\niter=Name(id='it', ctx=Load()),\nifs=[\nCompare(\nleft=Name(id='n', ctx=Load()),\nops=[\nGt()],\ncomparators=[\nConstant(value=5)]),\nCompare(\nleft=Name(id='n', ctx=Load()),\nops=[\nLt()],\ncomparators=[\nConstant(value=10)])],\nisasync=0)]))\n\n>>> print(ast.dump(ast.parse('[i async for i in soc]', mode='eval'),\n...                indent=4)) # Async comprehension\nExpression(\nbody=ListComp(\nelt=Name(id='i', ctx=Load()),\ngenerators=[\ncomprehension(\ntarget=Name(id='i', ctx=Store()),\niter=Name(id='soc', ctx=Load()),\nifs=[],\nisasync=1)]))\n\nFile: python3.12.info,  Node: Statements,  Next: Control flow,  Prev: Expressions<2>,  Up: Node classes\n\n5.32.1.9 Statements\n...................\n\n-- Class: ast.Assign (targets, value, typecomment)\n\nAn assignment.  'targets' is a list of nodes, and 'value' is a\nsingle node.\n\nMultiple nodes in 'targets' represents assigning the same value to\neach.  Unpacking is represented by putting a *note Tuple: 4236. or\n*note List: 4235. within 'targets'.\n\n-- Attribute: typecomment\n\n'typecomment' is an optional string with the type annotation\nas a comment.\n\n>>> print(ast.dump(ast.parse('a = b = 1'), indent=4)) # Multiple assignment\nModule(\nbody=[\nAssign(\ntargets=[\nName(id='a', ctx=Store()),\nName(id='b', ctx=Store())],\nvalue=Constant(value=1))],\ntypeignores=[])\n\n>>> print(ast.dump(ast.parse('a,b = c'), indent=4)) # Unpacking\nModule(\nbody=[\nAssign(\ntargets=[\nTuple(\nelts=[\nName(id='a', ctx=Store()),\nName(id='b', ctx=Store())],\nctx=Store())],\nvalue=Name(id='c', ctx=Load()))],\ntypeignores=[])\n\n-- Class: ast.AnnAssign (target, annotation, value, simple)\n\nAn assignment with a type annotation.  'target' is a single node\nand can be a *note Name: 16a5, a *note Attribute: 4262. or a *note\nSubscript: 4268.  'annotation' is the annotation, such as a *note\nConstant: 215. or *note Name: 16a5. node.  'value' is a single\noptional node.  'simple' is a boolean integer set to True for a\n*note Name: 16a5. node in 'target' that do not appear in between\nparenthesis and are hence pure names and not expressions.\n\n>>> print(ast.dump(ast.parse('c: int'), indent=4))\nModule(\nbody=[\nAnnAssign(\ntarget=Name(id='c', ctx=Store()),\nannotation=Name(id='int', ctx=Load()),\nsimple=1)],\ntypeignores=[])\n\n>>> print(ast.dump(ast.parse('(a): int = 1'), indent=4)) # Annotation with parenthesis\nModule(\nbody=[\nAnnAssign(\ntarget=Name(id='a', ctx=Store()),\nannotation=Name(id='int', ctx=Load()),\nvalue=Constant(value=1),\nsimple=0)],\ntypeignores=[])\n\n>>> print(ast.dump(ast.parse('a.b: int'), indent=4)) # Attribute annotation\nModule(\nbody=[\nAnnAssign(\ntarget=Attribute(\nvalue=Name(id='a', ctx=Load()),\nattr='b',\nctx=Store()),\nannotation=Name(id='int', ctx=Load()),\nsimple=0)],\ntypeignores=[])\n\n>>> print(ast.dump(ast.parse('a[1]: int'), indent=4)) # Subscript annotation\nModule(\nbody=[\nAnnAssign(\ntarget=Subscript(\nvalue=Name(id='a', ctx=Load()),\nslice=Constant(value=1),\nctx=Store()),\nannotation=Name(id='int', ctx=Load()),\nsimple=0)],\ntypeignores=[])\n\n-- Class: ast.AugAssign (target, op, value)\n\nAugmented assignment, such as 'a += 1'.  In the following example,\n'target' is a *note Name: 16a5. node for 'x' (with the *note Store:\n4237. context), 'op' is *note Add: 4247, and 'value' is a *note\nConstant: 215. with value for 1.\n\nThe 'target' attribute cannot be of class *note Tuple: 4236. or\n*note List: 4235, unlike the targets of *note Assign: 4266.\n\n>>> print(ast.dump(ast.parse('x += 2'), indent=4))\nModule(\nbody=[\nAugAssign(\ntarget=Name(id='x', ctx=Store()),\nop=Add(),\nvalue=Constant(value=2))],\ntypeignores=[])\n\n-- Class: ast.Raise (exc, cause)\n\nA 'raise' statement.  'exc' is the exception object to be raised,\nnormally a *note Call: 423d. or *note Name: 16a5, or 'None' for a\nstandalone 'raise'.  'cause' is the optional part for 'y' in 'raise\nx from y'.\n\n>>> print(ast.dump(ast.parse('raise x from y'), indent=4))\nModule(\nbody=[\nRaise(\nexc=Name(id='x', ctx=Load()),\ncause=Name(id='y', ctx=Load()))],\ntypeignores=[])\n\n-- Class: ast.Assert (test, msg)\n\nAn assertion.  'test' holds the condition, such as a *note Compare:\n4257. node.  'msg' holds the failure message.\n\n>>> print(ast.dump(ast.parse('assert x,y'), indent=4))\nModule(\nbody=[\nAssert(\ntest=Name(id='x', ctx=Load()),\nmsg=Name(id='y', ctx=Load()))],\ntypeignores=[])\n\n-- Class: ast.Delete (targets)\n\nRepresents a 'del' statement.  'targets' is a list of nodes, such\nas *note Name: 16a5, *note Attribute: 4262. or *note Subscript:\n4268. nodes.\n\n>>> print(ast.dump(ast.parse('del x,y,z'), indent=4))\nModule(\nbody=[\nDelete(\ntargets=[\nName(id='x', ctx=Del()),\nName(id='y', ctx=Del()),\nName(id='z', ctx=Del())])],\ntypeignores=[])\n\n-- Class: ast.Pass\n\nA 'pass' statement.\n\n>>> print(ast.dump(ast.parse('pass'), indent=4))\nModule(\nbody=[\nPass()],\ntypeignores=[])\n\n-- Class: ast.TypeAlias (name, typeparams, value)\n\nA *note type alias: 15f. created through the *note type: 13a.\nstatement.  'name' is the name of the alias, 'typeparams' is a\nlist of *note type parameters: 4278, and 'value' is the value of\nthe type alias.\n\n>>> print(ast.dump(ast.parse('type Alias = int'), indent=4))\nModule(\nbody=[\nTypeAlias(\nname=Name(id='Alias', ctx=Store()),\ntypeparams=[],\nvalue=Name(id='int', ctx=Load()))],\ntypeignores=[])\n\nNew in version 3.12.\n",
            "subsections": []
        },
        "Other statements which are only applicable inside functions or loops are": {
            "content": "described in other sections.\n\n* Menu:\n\n* Imports::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Imports,  Up: Statements": {
            "content": "5.32.1.10 Imports\n.................\n\n-- Class: ast.Import (names)\n\nAn import statement.  'names' is a list of *note alias: 1621.\nnodes.\n\n>>> print(ast.dump(ast.parse('import x,y,z'), indent=4))\nModule(\nbody=[\nImport(\nnames=[\nalias(name='x'),\nalias(name='y'),\nalias(name='z')])],\ntypeignores=[])\n\n-- Class: ast.ImportFrom (module, names, level)\n\nRepresents 'from x import y'.  'module' is a raw string of the\n'from' name, without any leading dots, or 'None' for statements\nsuch as 'from . import foo'.  'level' is an integer holding the\nlevel of the relative import (0 means absolute import).\n\n>>> print(ast.dump(ast.parse('from y import x,y,z'), indent=4))\nModule(\nbody=[\nImportFrom(\nmodule='y',\nnames=[\nalias(name='x'),\nalias(name='y'),\nalias(name='z')],\nlevel=0)],\ntypeignores=[])\n\n-- Class: ast.alias (name, asname)\n\nBoth parameters are raw strings of the names.  'asname' can be\n'None' if the regular name is to be used.\n\n>>> print(ast.dump(ast.parse('from ..foo.bar import a as b, c'), indent=4))\nModule(\nbody=[\nImportFrom(\nmodule='foo.bar',\nnames=[\nalias(name='a', asname='b'),\nalias(name='c')],\nlevel=2)],\ntypeignores=[])\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Control flow,  Next: Pattern matching,  Prev: Statements,  Up: Node classes": {
            "content": "5.32.1.11 Control flow\n......................\n\nNote: Optional clauses such as 'else' are stored as an empty list\nif they're not present.\n\n-- Class: ast.If (test, body, orelse)\n\nAn 'if' statement.  'test' holds a single node, such as a *note\nCompare: 4257. node.  'body' and 'orelse' each hold a list of\nnodes.\n\n'elif' clauses don't have a special representation in the AST, but\nrather appear as extra *note If: 427d. nodes within the 'orelse'\nsection of the previous one.\n\n>>> print(ast.dump(ast.parse(\"\"\"\n... if x:\n...    ...\n... elif y:\n...    ...\n... else:\n...    ...\n... \"\"\"), indent=4))\nModule(\nbody=[\nIf(\ntest=Name(id='x', ctx=Load()),\nbody=[\nExpr(\nvalue=Constant(value=Ellipsis))],\norelse=[\nIf(\ntest=Name(id='y', ctx=Load()),\nbody=[\nExpr(\nvalue=Constant(value=Ellipsis))],\norelse=[\nExpr(\nvalue=Constant(value=Ellipsis))])])],\ntypeignores=[])\n\n-- Class: ast.For (target, iter, body, orelse, typecomment)\n\nA 'for' loop.  'target' holds the variable(s) the loop assigns to,\nas a single *note Name: 16a5, *note Tuple: 4236, *note List: 4235,\n*note Attribute: 4262. or *note Subscript: 4268. node.  'iter'\nholds the item to be looped over, again as a single node.  'body'\nand 'orelse' contain lists of nodes to execute.  Those in 'orelse'\nare executed if the loop finishes normally, rather than via a\n'break' statement.\n\n-- Attribute: typecomment\n\n'typecomment' is an optional string with the type annotation\nas a comment.\n\n>>> print(ast.dump(ast.parse(\"\"\"\n... for x in y:\n...     ...\n... else:\n...     ...\n... \"\"\"), indent=4))\nModule(\nbody=[\nFor(\ntarget=Name(id='x', ctx=Store()),\niter=Name(id='y', ctx=Load()),\nbody=[\nExpr(\nvalue=Constant(value=Ellipsis))],\norelse=[\nExpr(\nvalue=Constant(value=Ellipsis))])],\ntypeignores=[])\n\n-- Class: ast.While (test, body, orelse)\n\nA 'while' loop.  'test' holds the condition, such as a *note\nCompare: 4257. node.\n\n>> print(ast.dump(ast.parse(\"\"\"\n... while x:\n...    ...\n... else:\n...    ...\n... \"\"\"), indent=4))\nModule(\nbody=[\nWhile(\ntest=Name(id='x', ctx=Load()),\nbody=[\nExpr(\nvalue=Constant(value=Ellipsis))],\norelse=[\nExpr(\nvalue=Constant(value=Ellipsis))])],\ntypeignores=[])\n\n-- Class: ast.Break\n-- Class: ast.Continue\n\nThe 'break' and 'continue' statements.\n\n>>> print(ast.dump(ast.parse(\"\"\"\\\n... for a in b:\n...     if a > 5:\n...         break\n...     else:\n...         continue\n...\n... \"\"\"), indent=4))\nModule(\nbody=[\nFor(\ntarget=Name(id='a', ctx=Store()),\niter=Name(id='b', ctx=Load()),\nbody=[\nIf(\ntest=Compare(\nleft=Name(id='a', ctx=Load()),\nops=[\nGt()],\ncomparators=[\nConstant(value=5)]),\nbody=[\nBreak()],\norelse=[\nContinue()])],\norelse=[])],\ntypeignores=[])\n\n-- Class: ast.Try (body, handlers, orelse, finalbody)\n\n'try' blocks.  All attributes are list of nodes to execute, except\nfor 'handlers', which is a list of *note ExceptHandler: 4284.\nnodes.\n\n>>> print(ast.dump(ast.parse(\"\"\"\n... try:\n...    ...\n... except Exception:\n...    ...\n... except OtherException as e:\n...    ...\n... else:\n...    ...\n... finally:\n...    ...\n... \"\"\"), indent=4))\nModule(\nbody=[\nTry(\nbody=[\nExpr(\nvalue=Constant(value=Ellipsis))],\nhandlers=[\nExceptHandler(\ntype=Name(id='Exception', ctx=Load()),\nbody=[\nExpr(\nvalue=Constant(value=Ellipsis))]),\nExceptHandler(\ntype=Name(id='OtherException', ctx=Load()),\nname='e',\nbody=[\nExpr(\nvalue=Constant(value=Ellipsis))])],\norelse=[\nExpr(\nvalue=Constant(value=Ellipsis))],\nfinalbody=[\nExpr(\nvalue=Constant(value=Ellipsis))])],\ntypeignores=[])\n\n-- Class: ast.TryStar (body, handlers, orelse, finalbody)\n\n'try' blocks which are followed by 'except*' clauses.  The\nattributes are the same as for *note Try: 4283. but the *note\nExceptHandler: 4284. nodes in 'handlers' are interpreted as\n'except*' blocks rather then 'except'.\n\n>>> print(ast.dump(ast.parse(\"\"\"\n... try:\n...    ...\n... except* Exception:\n...    ...\n... \"\"\"), indent=4))\nModule(\nbody=[\nTryStar(\nbody=[\nExpr(\nvalue=Constant(value=Ellipsis))],\nhandlers=[\nExceptHandler(\ntype=Name(id='Exception', ctx=Load()),\nbody=[\nExpr(\nvalue=Constant(value=Ellipsis))])],\norelse=[],\nfinalbody=[])],\ntypeignores=[])\n\nNew in version 3.11.\n\n-- Class: ast.ExceptHandler (type, name, body)\n\nA single 'except' clause.  'type' is the exception type it will\nmatch, typically a *note Name: 16a5. node (or 'None' for a\ncatch-all 'except:' clause).  'name' is a raw string for the name\nto hold the exception, or 'None' if the clause doesn't have 'as\nfoo'.  'body' is a list of nodes.\n\n>>> print(ast.dump(ast.parse(\"\"\"\\\n... try:\n...     a + 1\n... except TypeError:\n...     pass\n... \"\"\"), indent=4))\nModule(\nbody=[\nTry(\nbody=[\nExpr(\nvalue=BinOp(\nleft=Name(id='a', ctx=Load()),\nop=Add(),\nright=Constant(value=1)))],\nhandlers=[\nExceptHandler(\ntype=Name(id='TypeError', ctx=Load()),\nbody=[\nPass()])],\norelse=[],\nfinalbody=[])],\ntypeignores=[])\n\n-- Class: ast.With (items, body, typecomment)\n\nA 'with' block.  'items' is a list of *note withitem: 4287. nodes\nrepresenting the context managers, and 'body' is the indented block\ninside the context.\n\n-- Attribute: typecomment\n\n'typecomment' is an optional string with the type annotation\nas a comment.\n\n-- Class: ast.withitem (contextexpr, optionalvars)\n\nA single context manager in a 'with' block.  'contextexpr' is the\ncontext manager, often a *note Call: 423d. node.  'optionalvars'\nis a *note Name: 16a5, *note Tuple: 4236. or *note List: 4235. for\nthe 'as foo' part, or 'None' if that isn't used.\n\n>>> print(ast.dump(ast.parse(\"\"\"\\\n... with a as b, c as d:\n...    something(b, d)\n... \"\"\"), indent=4))\nModule(\nbody=[\nWith(\nitems=[\nwithitem(\ncontextexpr=Name(id='a', ctx=Load()),\noptionalvars=Name(id='b', ctx=Store())),\nwithitem(\ncontextexpr=Name(id='c', ctx=Load()),\noptionalvars=Name(id='d', ctx=Store()))],\nbody=[\nExpr(\nvalue=Call(\nfunc=Name(id='something', ctx=Load()),\nargs=[\nName(id='b', ctx=Load()),\nName(id='d', ctx=Load())],\nkeywords=[]))])],\ntypeignores=[])\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Pattern matching,  Next: Type parameters,  Prev: Control flow,  Up: Node classes": {
            "content": "5.32.1.12 Pattern matching\n..........................\n\n-- Class: ast.Match (subject, cases)\n\nA 'match' statement.  'subject' holds the subject of the match (the\nobject that is being matched against the cases) and 'cases'\ncontains an iterable of *note matchcase: 428b. nodes with the\ndifferent cases.\n\nNew in version 3.10.\n\n-- Class: ast.matchcase (pattern, guard, body)\n\nA single case pattern in a 'match' statement.  'pattern' contains\nthe match pattern that the subject will be matched against.  Note\nthat the *note AST: 527. nodes produced for patterns differ from\nthose produced for expressions, even when they share the same\nsyntax.\n\nThe 'guard' attribute contains an expression that will be evaluated\nif the pattern matches the subject.\n\n'body' contains a list of nodes to execute if the pattern matches\nand the result of evaluating the guard expression is true.\n\n>>> print(ast.dump(ast.parse(\"\"\"\n... match x:\n...     case [x] if x>0:\n...         ...\n...     case tuple():\n...         ...\n... \"\"\"), indent=4))\nModule(\nbody=[\nMatch(\nsubject=Name(id='x', ctx=Load()),\ncases=[\nmatchcase(\npattern=MatchSequence(\npatterns=[\nMatchAs(name='x')]),\nguard=Compare(\nleft=Name(id='x', ctx=Load()),\nops=[\nGt()],\ncomparators=[\nConstant(value=0)]),\nbody=[\nExpr(\nvalue=Constant(value=Ellipsis))]),\nmatchcase(\npattern=MatchClass(\ncls=Name(id='tuple', ctx=Load()),\npatterns=[],\nkwdattrs=[],\nkwdpatterns=[]),\nbody=[\nExpr(\nvalue=Constant(value=Ellipsis))])])],\ntypeignores=[])\n\nNew in version 3.10.\n\n-- Class: ast.MatchValue (value)\n\nA match literal or value pattern that compares by equality.\n'value' is an expression node.  Permitted value nodes are\nrestricted as described in the match statement documentation.  This\npattern succeeds if the match subject is equal to the evaluated\nvalue.\n\n>>> print(ast.dump(ast.parse(\"\"\"\n... match x:\n...     case \"Relevant\":\n...         ...\n... \"\"\"), indent=4))\nModule(\nbody=[\nMatch(\nsubject=Name(id='x', ctx=Load()),\ncases=[\nmatchcase(\npattern=MatchValue(\nvalue=Constant(value='Relevant')),\nbody=[\nExpr(\nvalue=Constant(value=Ellipsis))])])],\ntypeignores=[])\n\nNew in version 3.10.\n\n-- Class: ast.MatchSingleton (value)\n\nA match literal pattern that compares by identity.  'value' is the\nsingleton to be compared against: 'None', 'True', or 'False'.  This\npattern succeeds if the match subject is the given constant.\n\n>>> print(ast.dump(ast.parse(\"\"\"\n... match x:\n...     case None:\n...         ...\n... \"\"\"), indent=4))\nModule(\nbody=[\nMatch(\nsubject=Name(id='x', ctx=Load()),\ncases=[\nmatchcase(\npattern=MatchSingleton(value=None),\nbody=[\nExpr(\nvalue=Constant(value=Ellipsis))])])],\ntypeignores=[])\n\nNew in version 3.10.\n\n-- Class: ast.MatchSequence (patterns)\n\nA match sequence pattern.  'patterns' contains the patterns to be\nmatched against the subject elements if the subject is a sequence.\nMatches a variable length sequence if one of the subpatterns is a\n'MatchStar' node, otherwise matches a fixed length sequence.\n\n>>> print(ast.dump(ast.parse(\"\"\"\n... match x:\n...     case [1, 2]:\n...         ...\n... \"\"\"), indent=4))\nModule(\nbody=[\nMatch(\nsubject=Name(id='x', ctx=Load()),\ncases=[\nmatchcase(\npattern=MatchSequence(\npatterns=[\nMatchValue(\nvalue=Constant(value=1)),\nMatchValue(\nvalue=Constant(value=2))]),\nbody=[\nExpr(\nvalue=Constant(value=Ellipsis))])])],\ntypeignores=[])\n\nNew in version 3.10.\n\n-- Class: ast.MatchStar (name)\n\nMatches the rest of the sequence in a variable length match\nsequence pattern.  If 'name' is not 'None', a list containing the\nremaining sequence elements is bound to that name if the overall\nsequence pattern is successful.\n\n>>> print(ast.dump(ast.parse(\"\"\"\n... match x:\n...     case [1, 2, *rest]:\n...         ...\n...     case [*]:\n...         ...\n... \"\"\"), indent=4))\nModule(\nbody=[\nMatch(\nsubject=Name(id='x', ctx=Load()),\ncases=[\nmatchcase(\npattern=MatchSequence(\npatterns=[\nMatchValue(\nvalue=Constant(value=1)),\nMatchValue(\nvalue=Constant(value=2)),\nMatchStar(name='rest')]),\nbody=[\nExpr(\nvalue=Constant(value=Ellipsis))]),\nmatchcase(\npattern=MatchSequence(\npatterns=[\nMatchStar()]),\nbody=[\nExpr(\nvalue=Constant(value=Ellipsis))])])],\ntypeignores=[])\n\nNew in version 3.10.\n\n-- Class: ast.MatchMapping (keys, patterns, rest)\n\nA match mapping pattern.  'keys' is a sequence of expression nodes.\n'patterns' is a corresponding sequence of pattern nodes.  'rest' is\nan optional name that can be specified to capture the remaining\nmapping elements.  Permitted key expressions are restricted as\ndescribed in the match statement documentation.\n\nThis pattern succeeds if the subject is a mapping, all evaluated\nkey expressions are present in the mapping, and the value\ncorresponding to each key matches the corresponding subpattern.  If\n'rest' is not 'None', a dict containing the remaining mapping\nelements is bound to that name if the overall mapping pattern is\nsuccessful.\n\n>>> print(ast.dump(ast.parse(\"\"\"\n... match x:\n...     case {1: , 2: }:\n...         ...\n...     case {rest}:\n...         ...\n... \"\"\"), indent=4))\nModule(\nbody=[\nMatch(\nsubject=Name(id='x', ctx=Load()),\ncases=[\nmatchcase(\npattern=MatchMapping(\nkeys=[\nConstant(value=1),\nConstant(value=2)],\npatterns=[\nMatchAs(),\nMatchAs()]),\nbody=[\nExpr(\nvalue=Constant(value=Ellipsis))]),\nmatchcase(\npattern=MatchMapping(keys=[], patterns=[], rest='rest'),\nbody=[\nExpr(\nvalue=Constant(value=Ellipsis))])])],\ntypeignores=[])\n\nNew in version 3.10.\n\n-- Class: ast.MatchClass (cls, patterns, kwdattrs, kwdpatterns)\n\nA match class pattern.  'cls' is an expression giving the nominal\nclass to be matched.  'patterns' is a sequence of pattern nodes to\nbe matched against the class defined sequence of pattern matching\nattributes.  'kwdattrs' is a sequence of additional attributes to\nbe matched (specified as keyword arguments in the class pattern),\n'kwdpatterns' are the corresponding patterns (specified as keyword\nvalues in the class pattern).\n\nThis pattern succeeds if the subject is an instance of the\nnominated class, all positional patterns match the corresponding\nclass-defined attributes, and any specified keyword attributes\nmatch their corresponding pattern.\n\nNote: classes may define a property that returns self in order to\nmatch a pattern node against the instance being matched.  Several\nbuiltin types are also matched that way, as described in the match\nstatement documentation.\n\n>>> print(ast.dump(ast.parse(\"\"\"\n... match x:\n...     case Point2D(0, 0):\n...         ...\n...     case Point3D(x=0, y=0, z=0):\n...         ...\n... \"\"\"), indent=4))\nModule(\nbody=[\nMatch(\nsubject=Name(id='x', ctx=Load()),\ncases=[\nmatchcase(\npattern=MatchClass(\ncls=Name(id='Point2D', ctx=Load()),\npatterns=[\nMatchValue(\nvalue=Constant(value=0)),\nMatchValue(\nvalue=Constant(value=0))],\nkwdattrs=[],\nkwdpatterns=[]),\nbody=[\nExpr(\nvalue=Constant(value=Ellipsis))]),\nmatchcase(\npattern=MatchClass(\ncls=Name(id='Point3D', ctx=Load()),\npatterns=[],\nkwdattrs=[\n'x',\n'y',\n'z'],\nkwdpatterns=[\nMatchValue(\nvalue=Constant(value=0)),\nMatchValue(\nvalue=Constant(value=0)),\nMatchValue(\nvalue=Constant(value=0))]),\nbody=[\nExpr(\nvalue=Constant(value=Ellipsis))])])],\ntypeignores=[])\n\nNew in version 3.10.\n\n-- Class: ast.MatchAs (pattern, name)\n\nA match \"as-pattern\", capture pattern or wildcard pattern.\n'pattern' contains the match pattern that the subject will be\nmatched against.  If the pattern is 'None', the node represents a\ncapture pattern (i.e a bare name) and will always succeed.\n\nThe 'name' attribute contains the name that will be bound if the\npattern is successful.  If 'name' is 'None', 'pattern' must also be\n'None' and the node represents the wildcard pattern.\n\n>>> print(ast.dump(ast.parse(\"\"\"\n... match x:\n...     case [x] as y:\n...         ...\n...     case :\n...         ...\n... \"\"\"), indent=4))\nModule(\nbody=[\nMatch(\nsubject=Name(id='x', ctx=Load()),\ncases=[\nmatchcase(\npattern=MatchAs(\npattern=MatchSequence(\npatterns=[\nMatchAs(name='x')]),\nname='y'),\nbody=[\nExpr(\nvalue=Constant(value=Ellipsis))]),\nmatchcase(\npattern=MatchAs(),\nbody=[\nExpr(\nvalue=Constant(value=Ellipsis))])])],\ntypeignores=[])\n\nNew in version 3.10.\n\n-- Class: ast.MatchOr (patterns)\n\nA match \"or-pattern\".  An or-pattern matches each of its\nsubpatterns in turn to the subject, until one succeeds.  The\nor-pattern is then deemed to succeed.  If none of the subpatterns\nsucceed the or-pattern fails.  The 'patterns' attribute contains a\nlist of match pattern nodes that will be matched against the\nsubject.\n\n>>> print(ast.dump(ast.parse(\"\"\"\n... match x:\n...     case [x] | (y):\n...         ...\n... \"\"\"), indent=4))\nModule(\nbody=[\nMatch(\nsubject=Name(id='x', ctx=Load()),\ncases=[\nmatchcase(\npattern=MatchOr(\npatterns=[\nMatchSequence(\npatterns=[\nMatchAs(name='x')]),\nMatchAs(name='y')]),\nbody=[\nExpr(\nvalue=Constant(value=Ellipsis))])])],\ntypeignores=[])\n\nNew in version 3.10.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Type parameters,  Next: Function and class definitions,  Prev: Pattern matching,  Up: Node classes": {
            "content": "5.32.1.13 Type parameters\n.........................\n\n*note Type parameters: 166. can exist on classes, functions, and type\naliases.\n\n-- Class: ast.TypeVar (name, bound)\n\nA *note typing.TypeVar: 164.  'name' is the name of the type\nvariable.  'bound' is the bound or constraints, if any.  If 'bound'\nis a *note Tuple: 4236, it represents constraints; otherwise it\nrepresents the bound.\n\n>>> print(ast.dump(ast.parse(\"type Alias[T: int] = list[T]\"), indent=4))\nModule(\nbody=[\nTypeAlias(\nname=Name(id='Alias', ctx=Store()),\ntypeparams=[\nTypeVar(\nname='T',\nbound=Name(id='int', ctx=Load()))],\nvalue=Subscript(\nvalue=Name(id='list', ctx=Load()),\nslice=Name(id='T', ctx=Load()),\nctx=Load()))],\ntypeignores=[])\n\nNew in version 3.12.\n\n-- Class: ast.ParamSpec (name)\n\nA *note typing.ParamSpec: 163.  'name' is the name of the parameter\nspecification.\n\n>>> print(ast.dump(ast.parse(\"type Alias[P] = Callable[P, int]\"), indent=4))\nModule(\nbody=[\nTypeAlias(\nname=Name(id='Alias', ctx=Store()),\ntypeparams=[\nParamSpec(name='P')],\nvalue=Subscript(\nvalue=Name(id='Callable', ctx=Load()),\nslice=Tuple(\nelts=[\nName(id='P', ctx=Load()),\nName(id='int', ctx=Load())],\nctx=Load()),\nctx=Load()))],\ntypeignores=[])\n\nNew in version 3.12.\n\n-- Class: ast.TypeVarTuple (name)\n\nA *note typing.TypeVarTuple: 162.  'name' is the name of the type\nvariable tuple.\n\n>>> print(ast.dump(ast.parse(\"type Alias[*Ts] = tuple[*Ts]\"), indent=4))\nModule(\nbody=[\nTypeAlias(\nname=Name(id='Alias', ctx=Store()),\ntypeparams=[\nTypeVarTuple(name='Ts')],\nvalue=Subscript(\nvalue=Name(id='tuple', ctx=Load()),\nslice=Tuple(\nelts=[\nStarred(\nvalue=Name(id='Ts', ctx=Load()),\nctx=Load())],\nctx=Load()),\nctx=Load()))],\ntypeignores=[])\n\nNew in version 3.12.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Function and class definitions,  Next: Async and await,  Prev: Type parameters,  Up: Node classes": {
            "content": "5.32.1.14 Function and class definitions\n........................................\n\n-- Class: ast.FunctionDef (name, args, body, decoratorlist, returns,\ntypecomment, typeparams)\n\nA function definition.\n\n* 'name' is a raw string of the function name.\n\n* 'args' is an *note arguments: 4299. node.\n\n* 'body' is the list of nodes inside the function.\n\n* 'decoratorlist' is the list of decorators to be applied,\nstored outermost first (i.e.  the first in the list will be\napplied last).\n\n* 'returns' is the return annotation.\n\n* 'typeparams' is a list of *note type parameters: 4278.\n\n-- Attribute: typecomment\n\n'typecomment' is an optional string with the type annotation\nas a comment.\n\nChanged in version 3.12: Added 'typeparams'.\n\n-- Class: ast.Lambda (args, body)\n\n'lambda' is a minimal function definition that can be used inside\nan expression.  Unlike *note FunctionDef: 1456, 'body' holds a\nsingle node.\n\n>>> print(ast.dump(ast.parse('lambda x,y: ...'), indent=4))\nModule(\nbody=[\nExpr(\nvalue=Lambda(\nargs=arguments(\nposonlyargs=[],\nargs=[\narg(arg='x'),\narg(arg='y')],\nkwonlyargs=[],\nkwdefaults=[],\ndefaults=[]),\nbody=Constant(value=Ellipsis)))],\ntypeignores=[])\n\n-- Class: ast.arguments (posonlyargs, args, vararg, kwonlyargs,\nkwdefaults, kwarg, defaults)\n\nThe arguments for a function.\n\n* 'posonlyargs', 'args' and 'kwonlyargs' are lists of *note arg:\n429b. nodes.\n\n* 'vararg' and 'kwarg' are single *note arg: 429b. nodes,\nreferring to the '*args, kwargs' parameters.\n\n* 'kwdefaults' is a list of default values for keyword-only\narguments.  If one is 'None', the corresponding argument is\nrequired.\n\n* 'defaults' is a list of default values for arguments that can\nbe passed positionally.  If there are fewer defaults, they\ncorrespond to the last n arguments.\n\n-- Class: ast.arg (arg, annotation, typecomment)\n\nA single argument in a list.  'arg' is a raw string of the argument\nname; 'annotation' is its annotation, such as a *note Name: 16a5.\nnode.\n\n-- Attribute: typecomment\n\n'typecomment' is an optional string with the type annotation\nas a comment\n\n>>> print(ast.dump(ast.parse(\"\"\"\\\n... @decorator1\n... @decorator2\n... def f(a: 'annotation', b=1, c=2, *d, e, f=3, g) -> 'return annotation':\n...     pass\n... \"\"\"), indent=4))\nModule(\nbody=[\nFunctionDef(\nname='f',\nargs=arguments(\nposonlyargs=[],\nargs=[\narg(\narg='a',\nannotation=Constant(value='annotation')),\narg(arg='b'),\narg(arg='c')],\nvararg=arg(arg='d'),\nkwonlyargs=[\narg(arg='e'),\narg(arg='f')],\nkwdefaults=[\nNone,\nConstant(value=3)],\nkwarg=arg(arg='g'),\ndefaults=[\nConstant(value=1),\nConstant(value=2)]),\nbody=[\nPass()],\ndecoratorlist=[\nName(id='decorator1', ctx=Load()),\nName(id='decorator2', ctx=Load())],\nreturns=Constant(value='return annotation'),\ntypeparams=[])],\ntypeignores=[])\n\n-- Class: ast.Return (value)\n\nA 'return' statement.\n\n>>> print(ast.dump(ast.parse('return 4'), indent=4))\nModule(\nbody=[\nReturn(\nvalue=Constant(value=4))],\ntypeignores=[])\n\n-- Class: ast.Yield (value)\n-- Class: ast.YieldFrom (value)\n\nA 'yield' or 'yield from' expression.  Because these are\nexpressions, they must be wrapped in a *note Expr: 423f. node if\nthe value sent back is not used.\n\n>>> print(ast.dump(ast.parse('yield x'), indent=4))\nModule(\nbody=[\nExpr(\nvalue=Yield(\nvalue=Name(id='x', ctx=Load())))],\ntypeignores=[])\n\n>>> print(ast.dump(ast.parse('yield from x'), indent=4))\nModule(\nbody=[\nExpr(\nvalue=YieldFrom(\nvalue=Name(id='x', ctx=Load())))],\ntypeignores=[])\n\n-- Class: ast.Global (names)\n-- Class: ast.Nonlocal (names)\n\n'global' and 'nonlocal' statements.  'names' is a list of raw\nstrings.\n\n>>> print(ast.dump(ast.parse('global x,y,z'), indent=4))\nModule(\nbody=[\nGlobal(\nnames=[\n'x',\n'y',\n'z'])],\ntypeignores=[])\n\n>>> print(ast.dump(ast.parse('nonlocal x,y,z'), indent=4))\nModule(\nbody=[\nNonlocal(\nnames=[\n'x',\n'y',\n'z'])],\ntypeignores=[])\n\n-- Class: ast.ClassDef (name, bases, keywords, body, decoratorlist,\ntypeparams)\n\nA class definition.\n\n* 'name' is a raw string for the class name\n\n* 'bases' is a list of nodes for explicitly specified base\nclasses.\n\n* 'keywords' is a list of *note keyword: 4263. nodes,\nprincipally for 'metaclass'.  Other keywords will be passed to\nthe metaclass, as per PEP-3115(1).\n\n* 'body' is a list of nodes representing the code within the\nclass definition.\n\n* 'decoratorlist' is a list of nodes, as in *note FunctionDef:\n1456.\n\n* 'typeparams' is a list of *note type parameters: 4278.\n\n>>> print(ast.dump(ast.parse(\"\"\"\\\n... @decorator1\n... @decorator2\n... class Foo(base1, base2, metaclass=meta):\n...     pass\n... \"\"\"), indent=4))\nModule(\nbody=[\nClassDef(\nname='Foo',\nbases=[\nName(id='base1', ctx=Load()),\nName(id='base2', ctx=Load())],\nkeywords=[\nkeyword(\narg='metaclass',\nvalue=Name(id='meta', ctx=Load()))],\nbody=[\nPass()],\ndecoratorlist=[\nName(id='decorator1', ctx=Load()),\nName(id='decorator2', ctx=Load())],\ntypeparams=[])],\ntypeignores=[])\n\nChanged in version 3.12: Added 'typeparams'.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3115/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Async and await,  Prev: Function and class definitions,  Up: Node classes": {
            "content": "5.32.1.15 Async and await\n.........................\n\n-- Class: ast.AsyncFunctionDef (name, args, body, decoratorlist,\nreturns, typecomment, typeparams)\n\nAn 'async def' function definition.  Has the same fields as *note\nFunctionDef: 1456.\n\nChanged in version 3.12: Added 'typeparams'.\n\n-- Class: ast.Await (value)\n\nAn 'await' expression.  'value' is what it waits for.  Only valid\nin the body of an *note AsyncFunctionDef: 1455.\n\n>>> print(ast.dump(ast.parse(\"\"\"\\\n... async def f():\n...     await otherfunc()\n... \"\"\"), indent=4))\nModule(\nbody=[\nAsyncFunctionDef(\nname='f',\nargs=arguments(\nposonlyargs=[],\nargs=[],\nkwonlyargs=[],\nkwdefaults=[],\ndefaults=[]),\nbody=[\nExpr(\nvalue=Await(\nvalue=Call(\nfunc=Name(id='otherfunc', ctx=Load()),\nargs=[],\nkeywords=[])))],\ndecoratorlist=[],\ntypeparams=[])],\ntypeignores=[])\n\n-- Class: ast.AsyncFor (target, iter, body, orelse, typecomment)\n-- Class: ast.AsyncWith (items, body, typecomment)\n\n'async for' loops and 'async with' context managers.  They have the\nsame fields as *note For: 427e. and *note With: 4286, respectively.\nOnly valid in the body of an *note AsyncFunctionDef: 1455.\n\nNote: When a string is parsed by *note ast.parse(): 182, operator\nnodes (subclasses of 'ast.operator', 'ast.unaryop', 'ast.cmpop',\n'ast.boolop' and 'ast.exprcontext') on the returned tree will be\nsingletons.  Changes to one will be reflected in all other\noccurrences of the same value (e.g.  *note ast.Add: 4247.).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ast Helpers,  Next: Compiler Flags,  Prev: Node classes,  Up: ast -- Abstract Syntax Trees": {
            "content": "5.32.1.16 'ast' Helpers\n.......................\n\nApart from the node classes, the *note ast: 8. module defines these\nutility functions and classes for traversing abstract syntax trees:\n\n-- Function: ast.parse (source, filename='<unknown>', mode='exec', *,\ntypecomments=False, featureversion=None)\n\nParse the source into an AST node.  Equivalent to 'compile(source,\nfilename, mode, ast.PyCFONLYAST)'.\n\nIf 'typecomments=True' is given, the parser is modified to check\nand return type comments as specified by PEP 484(1) and PEP 526(2).\nThis is equivalent to adding *note ast.PyCFTYPECOMMENTS: 42a5. to\nthe flags passed to *note compile(): 528.  This will report syntax\nerrors for misplaced type comments.  Without this flag, type\ncomments will be ignored, and the 'typecomment' field on selected\nAST nodes will always be 'None'.  In addition, the locations of '#\ntype: ignore' comments will be returned as the 'typeignores'\nattribute of *note Module: 422d. (otherwise it is always an empty\nlist).\n\nIn addition, if 'mode' is ''functype'', the input syntax is\nmodified to correspond to PEP 484(3) \"signature type comments\",\ne.g.  '(str, int) -> List[str]'.\n\nSetting 'featureversion' to a tuple '(major, minor)' will result\nin a \"best-effort\" attempt to parse using that Python version's\ngrammar.  For example, setting 'featureversion=(3, 9)' will\nattempt to disallow parsing of *note match: 601. statements.\nCurrently 'major' must equal to '3'.  The lowest supported version\nis '(3, 4)' (and this may increase in future Python versions); the\nhighest is 'sys.versioninfo[0:2]'.  \"Best-effort\" attempt means\nthere is no guarantee that the parse (or success of the parse) is\nthe same as when run on the Python version corresponding to\n'featureversion'.\n\nIf source contains a null character ('\\0'), *note ValueError: 183.\nis raised.\n\nWarning: Note that successfully parsing source code into an\nAST object doesn't guarantee that the source code provided is\nvalid Python code that can be executed as the compilation step\ncan raise further *note SyntaxError: 146. exceptions.  For\ninstance, the source 'return 42' generates a valid AST node\nfor a return statement, but it cannot be compiled alone (it\nneeds to be inside a function node).\n\nIn particular, *note ast.parse(): 182. won't do any scoping\nchecks, which the compilation step does.\n\nWarning: It is possible to crash the Python interpreter with a\nsufficiently large/complex string due to stack depth\nlimitations in Python's AST compiler.\n\nChanged in version 3.8: Added 'typecomments', 'mode='functype''\nand 'featureversion'.\n\n-- Function: ast.unparse (astobj)\n\nUnparse an *note ast.AST: 527. object and generate a string with\ncode that would produce an equivalent *note ast.AST: 527. object if\nparsed back with *note ast.parse(): 182.\n\nWarning: The produced code string will not necessarily be\nequal to the original code that generated the *note ast.AST:\n527. object (without any compiler optimizations, such as\nconstant tuples/frozensets).\n\nWarning: Trying to unparse a highly complex expression would\nresult with *note RecursionError: bc6.\n\nNew in version 3.9.\n\n-- Function: ast.literaleval (nodeorstring)\n\nEvaluate an expression node or a string containing only a Python\nliteral or container display.  The string or node provided may only\nconsist of the following Python literal structures: strings, bytes,\nnumbers, tuples, lists, dicts, sets, booleans, 'None' and\n'Ellipsis'.\n\nThis can be used for evaluating strings containing Python values\nwithout the need to parse the values oneself.  It is not capable of\nevaluating arbitrarily complex expressions, for example involving\noperators or indexing.\n\nThis function had been documented as \"safe\" in the past without\ndefining what that meant.  That was misleading.  This is\nspecifically designed not to execute Python code, unlike the more\ngeneral *note eval(): 690.  There is no namespace, no name lookups,\nor ability to call out.  But it is not free from attack: A\nrelatively small input can lead to memory exhaustion or to C stack\nexhaustion, crashing the process.  There is also the possibility\nfor excessive CPU consumption denial of service on some inputs.\nCalling it on untrusted data is thus not recommended.\n\nWarning: It is possible to crash the Python interpreter due to\nstack depth limitations in Python's AST compiler.\n\nIt can raise *note ValueError: 183, *note TypeError: 28e,\n*note SyntaxError: 146, *note MemoryError: 13e3. and *note\nRecursionError: bc6. depending on the malformed input.\n\nChanged in version 3.2: Now allows bytes and set literals.\n\nChanged in version 3.9: Now supports creating empty sets with\n''set()''.\n\nChanged in version 3.10: For string inputs, leading spaces and tabs\nare now stripped.\n\n-- Function: ast.getdocstring (node, clean=True)\n\nReturn the docstring of the given 'node' (which must be a *note\nFunctionDef: 1456, *note AsyncFunctionDef: 1455, *note ClassDef:\n1454, or *note Module: 422d. node), or 'None' if it has no\ndocstring.  If 'clean' is true, clean up the docstring's\nindentation with *note inspect.cleandoc(): 410c.\n\nChanged in version 3.5: *note AsyncFunctionDef: 1455. is now\nsupported.\n\n-- Function: ast.getsourcesegment (source, node, *, padded=False)\n\nGet source code segment of the 'source' that generated 'node'.  If\nsome location information (*note lineno: 4226, *note endlineno:\n4228, *note coloffset: 4227, or *note endcoloffset: 4229.) is\nmissing, return 'None'.\n\nIf 'padded' is 'True', the first line of a multi-line statement\nwill be padded with spaces to match its original position.\n\nNew in version 3.8.\n\n-- Function: ast.fixmissinglocations (node)\n\nWhen you compile a node tree with *note compile(): 528, the\ncompiler expects *note lineno: 4226. and *note coloffset: 4227.\nattributes for every node that supports them.  This is rather\ntedious to fill in for generated nodes, so this helper adds these\nattributes recursively where not already set, by setting them to\nthe values of the parent node.  It works recursively starting at\n'node'.\n\n-- Function: ast.incrementlineno (node, n=1)\n\nIncrement the line number and end line number of each node in the\ntree starting at 'node' by 'n'.  This is useful to \"move code\" to a\ndifferent location in a file.\n\n-- Function: ast.copylocation (newnode, oldnode)\n\nCopy source location (*note lineno: 4226, *note coloffset: 4227,\n*note endlineno: 4228, and *note endcoloffset: 4229.) from\n'oldnode' to 'newnode' if possible, and return 'newnode'.\n\n-- Function: ast.iterfields (node)\n\nYield a tuple of '(fieldname, value)' for each field in\n'node.fields' that is present on 'node'.\n\n-- Function: ast.iterchildnodes (node)\n\nYield all direct child nodes of 'node', that is, all fields that\nare nodes and all items of fields that are lists of nodes.\n\n-- Function: ast.walk (node)\n\nRecursively yield all descendant nodes in the tree starting at\n'node' (including 'node' itself), in no specified order.  This is\nuseful if you only want to modify nodes in place and don't care\nabout the context.\n\n-- Class: ast.NodeVisitor\n\nA node visitor base class that walks the abstract syntax tree and\ncalls a visitor function for every node found.  This function may\nreturn a value which is forwarded by the *note visit(): 42ab.\nmethod.\n\nThis class is meant to be subclassed, with the subclass adding\nvisitor methods.\n\n-- Method: visit (node)\n\nVisit a node.  The default implementation calls the method\ncalled 'self.visitCLASSNAME' where 'classname' is the name of\nthe node class, or *note genericvisit(): 42ac. if that method\ndoesn't exist.\n\n-- Method: genericvisit (node)\n\nThis visitor calls *note visit(): 42ab. on all children of the\nnode.\n\nNote that child nodes of nodes that have a custom visitor\nmethod won't be visited unless the visitor calls *note\ngenericvisit(): 42ac. or visits them itself.\n\n-- Method: visitConstant (node)\n\nHandles all constant nodes.\n\nDon't use the *note NodeVisitor: 89b. if you want to apply changes\nto nodes during traversal.  For this a special visitor exists\n(*note NodeTransformer: 42ad.) that allows modifications.\n\nDeprecated since version 3.8: Methods 'visitNum()', 'visitStr()',\n'visitBytes()', 'visitNameConstant()' and 'visitEllipsis()' are\ndeprecated now and will not be called in future Python versions.\nAdd the *note visitConstant(): 89c. method to handle all constant\nnodes.\n\n-- Class: ast.NodeTransformer\n\nA *note NodeVisitor: 89b. subclass that walks the abstract syntax\ntree and allows modification of nodes.\n\nThe *note NodeTransformer: 42ad. will walk the AST and use the\nreturn value of the visitor methods to replace or remove the old\nnode.  If the return value of the visitor method is 'None', the\nnode will be removed from its location, otherwise it is replaced\nwith the return value.  The return value may be the original node\nin which case no replacement takes place.\n\nHere is an example transformer that rewrites all occurrences of\nname lookups ('foo') to 'data['foo']':\n\nclass RewriteName(NodeTransformer):\n\ndef visitName(self, node):\nreturn Subscript(\nvalue=Name(id='data', ctx=Load()),\nslice=Constant(value=node.id),\nctx=node.ctx\n)\n\nKeep in mind that if the node you're operating on has child nodes\nyou must either transform the child nodes yourself or call the\n*note genericvisit(): 42ac. method for the node first.\n\nFor nodes that were part of a collection of statements (that\napplies to all statement nodes), the visitor may also return a list\nof nodes rather than just a single node.\n\nIf *note NodeTransformer: 42ad. introduces new nodes (that weren't\npart of original tree) without giving them location information\n(such as *note lineno: 4226.), *note fixmissinglocations(): 42a6.\nshould be called with the new sub-tree to recalculate the location\ninformation:\n\ntree = ast.parse('foo', mode='eval')\nnewtree = fixmissinglocations(RewriteName().visit(tree))\n\nUsually you use the transformer like this:\n\nnode = YourTransformer().visit(node)\n\n-- Function: ast.dump (node, annotatefields=True,\nincludeattributes=False, *, indent=None)\n\nReturn a formatted dump of the tree in 'node'.  This is mainly\nuseful for debugging purposes.  If 'annotatefields' is true (by\ndefault), the returned string will show the names and the values\nfor fields.  If 'annotatefields' is false, the result string will\nbe more compact by omitting unambiguous field names.  Attributes\nsuch as line numbers and column offsets are not dumped by default.\nIf this is wanted, 'includeattributes' can be set to true.\n\nIf 'indent' is a non-negative integer or string, then the tree will\nbe pretty-printed with that indent level.  An indent level of 0,\nnegative, or '\"\"' will only insert newlines.  'None' (the default)\nselects the single line representation.  Using a positive integer\nindent indents that many spaces per level.  If 'indent' is a string\n(such as '\"\\t\"'), that string is used to indent each level.\n\nChanged in version 3.9: Added the 'indent' option.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0484/\n\n(2) https://peps.python.org/pep-0526/\n\n(3) https://peps.python.org/pep-0484/\n\nFile: python3.12.info,  Node: Compiler Flags,  Next: Command-Line Usage<4>,  Prev: ast Helpers,  Up: ast -- Abstract Syntax Trees\n\n5.32.1.17 Compiler Flags\n........................\n\nThe following flags may be passed to *note compile(): 528. in order to\nchange effects on the compilation of a program:\n\n-- Data: ast.PyCFALLOWTOPLEVELAWAIT\n\nEnables support for top-level 'await', 'async for', 'async with'\nand async comprehensions.\n\nNew in version 3.8.\n\n-- Data: ast.PyCFONLYAST\n\nGenerates and returns an abstract syntax tree instead of returning\na compiled code object.\n\n-- Data: ast.PyCFTYPECOMMENTS\n\nEnables support for PEP 484(1) and PEP 526(2) style type comments\n('# type: <type>', '# type: ignore <stuff>').\n\nNew in version 3.8.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0484/\n\n(2) https://peps.python.org/pep-0526/\n\nFile: python3.12.info,  Node: Command-Line Usage<4>,  Prev: Compiler Flags,  Up: ast -- Abstract Syntax Trees\n\n5.32.1.18 Command-Line Usage\n............................\n\nNew in version 3.9.\n\nThe *note ast: 8. module can be executed as a script from the command\nline.  It is as simple as:\n\npython -m ast [-m <mode>] [-a] [infile]\n\nThe following options are accepted:\n\n-- Option: -h, --help\n\nShow the help message and exit.\n\n-- Option: -m <mode>\n-- Option: --mode <mode>\n\nSpecify what kind of code must be compiled, like the 'mode'\nargument in *note parse(): 182.\n\n-- Option: --no-type-comments\n\nDon't parse type comments.\n\n-- Option: -a, --include-attributes\n\nInclude attributes such as line numbers and column offsets.\n\n-- Option: -i <indent>\n-- Option: --indent <indent>\n\nIndentation of nodes in AST (number of spaces).\n",
            "subsections": []
        },
        "If 'infile' is specified its contents are parsed to AST and dumped to": {
            "content": "stdout.  Otherwise, the content is read from stdin.\n\nSee also\n........\n",
            "subsections": []
        },
        "Green Tree Snakes(1), an external documentation resource, has good": {
            "content": "details on working with Python ASTs.\n\nASTTokens(2) annotates Python ASTs with the positions of tokens and text\nin the source code that generated them.  This is helpful for tools that\nmake source code transformations.\n\nleoAst.py(3) unifies the token-based and parse-tree-based views of\npython programs by inserting two-way links between tokens and ast nodes.\n",
            "subsections": []
        },
        "LibCST(4) parses code as a Concrete Syntax Tree that looks like an ast": {
            "content": "tree and keeps all formatting details.  It's useful for building\nautomated refactoring (codemod) applications and linters.\n",
            "subsections": []
        },
        "Parso(5) is a Python parser that supports error recovery and round-trip": {
            "content": "parsing for different Python versions (in multiple Python versions).\nParso is also able to list multiple syntax errors in your python file.\n\n---------- Footnotes ----------\n\n(1) https://greentreesnakes.readthedocs.io/\n\n(2) https://asttokens.readthedocs.io/en/latest/user-guide.html\n\n(3) https://leoeditor.com/appendices.html#leoast-py\n\n(4) https://libcst.readthedocs.io/\n\n(5) https://parso.readthedocs.io\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "'Source code:' Lib/symtable.py(1)\n\n\n",
            "subsections": []
        },
        "Symbol tables are generated by the compiler from AST just before": {
            "content": "bytecode is generated.  The symbol table is responsible for calculating\nthe scope of every identifier in the code.  *note symtable: d2. provides\nan interface to examine these tables.\n\n* Menu:\n\n* Generating Symbol Tables::\n* Examining Symbol Tables::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/symtable.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Generating Symbol Tables,  Next: Examining Symbol Tables,  Up: symtable -- Access to the compiler's symbol tables": {
            "content": "5.32.2.1 Generating Symbol Tables\n.................................\n\n-- Function: symtable.symtable (code, filename, compiletype)\n\nReturn the toplevel *note SymbolTable: 42be. for the Python source\n'code'.  'filename' is the name of the file containing the code.\n'compiletype' is like the 'mode' argument to *note compile(): 528.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Examining Symbol Tables,  Prev: Generating Symbol Tables,  Up: symtable -- Access to the compiler's symbol tables": {
            "content": "5.32.2.2 Examining Symbol Tables\n................................\n\n-- Class: symtable.SymbolTable\n\nA namespace table for a block.  The constructor is not public.\n\n-- Method: gettype ()\n\nReturn the type of the symbol table.  Possible values are\n''class'', ''module'', ''function'', ''annotation'', ''TypeVar\nbound'', ''type alias'', and ''type parameter''.  The latter\nfour refer to different flavors of *note annotation scopes:\n167.\n\nChanged in version 3.12: Added ''annotation'', ''TypeVar\nbound'', ''type alias'', and ''type parameter'' as possible\nreturn values.\n\n-- Method: getid ()\n\nReturn the table's identifier.\n\n-- Method: getname ()\n\nReturn the table's name.  This is the name of the class if the\ntable is for a class, the name of the function if the table is\nfor a function, or ''top'' if the table is global (*note\ngettype(): 42c0. returns ''module'').  For type parameter\nscopes (which are used for generic classes, functions, and\ntype aliases), it is the name of the underlying class,\nfunction, or type alias.  For type alias scopes, it is the\nname of the type alias.  For *note TypeVar: 164. bound scopes,\nit is the name of the 'TypeVar'.\n\n-- Method: getlineno ()\n\nReturn the number of the first line in the block this table\nrepresents.\n\n-- Method: isoptimized ()\n\nReturn 'True' if the locals in this table can be optimized.\n\n-- Method: isnested ()\n\nReturn 'True' if the block is a nested class or function.\n\n-- Method: haschildren ()\n\nReturn 'True' if the block has nested namespaces within it.\nThese can be obtained with *note getchildren(): 42c7.\n\n-- Method: getidentifiers ()\n\nReturn a view object containing the names of symbols in the\ntable.  See the *note documentation of view objects: 1f50.\n\n-- Method: lookup (name)\n\nLookup 'name' in the table and return a *note Symbol: 42ca.\ninstance.\n\n-- Method: getsymbols ()\n\nReturn a list of *note Symbol: 42ca. instances for names in\nthe table.\n\n-- Method: getchildren ()\n\nReturn a list of the nested symbol tables.\n\n-- Class: symtable.Function\n\nA namespace for a function or method.  This class inherits from\n*note SymbolTable: 42be.\n\n-- Method: getparameters ()\n\nReturn a tuple containing names of parameters to this\nfunction.\n\n-- Method: getlocals ()\n\nReturn a tuple containing names of locals in this function.\n\n-- Method: getglobals ()\n\nReturn a tuple containing names of globals in this function.\n\n-- Method: getnonlocals ()\n\nReturn a tuple containing names of nonlocals in this function.\n\n-- Method: getfrees ()\n\nReturn a tuple containing names of free variables in this\nfunction.\n\n-- Class: symtable.Class\n\nA namespace of a class.  This class inherits from *note\nSymbolTable: 42be.\n\n-- Method: getmethods ()\n\nReturn a tuple containing the names of methods declared in the\nclass.\n\n-- Class: symtable.Symbol\n\nAn entry in a *note SymbolTable: 42be. corresponding to an\nidentifier in the source.  The constructor is not public.\n\n-- Method: getname ()\n\nReturn the symbol's name.\n\n-- Method: isreferenced ()\n\nReturn 'True' if the symbol is used in its block.\n\n-- Method: isimported ()\n\nReturn 'True' if the symbol is created from an import\nstatement.\n\n-- Method: isparameter ()\n\nReturn 'True' if the symbol is a parameter.\n\n-- Method: isglobal ()\n\nReturn 'True' if the symbol is global.\n\n-- Method: isnonlocal ()\n\nReturn 'True' if the symbol is nonlocal.\n\n-- Method: isdeclaredglobal ()\n\nReturn 'True' if the symbol is declared global with a global\nstatement.\n\n-- Method: islocal ()\n\nReturn 'True' if the symbol is local to its block.\n\n-- Method: isannotated ()\n\nReturn 'True' if the symbol is annotated.\n\nNew in version 3.6.\n\n-- Method: isfree ()\n\nReturn 'True' if the symbol is referenced in its block, but\nnot assigned to.\n\n-- Method: isassigned ()\n\nReturn 'True' if the symbol is assigned to in its block.\n\n-- Method: isnamespace ()\n\nReturn 'True' if name binding introduces new namespace.\n\nIf the name is used as the target of a function or class\nstatement, this will be true.\n\nFor example:\n\n>>> table = symtable.symtable(\"def somefunc(): pass\", \"string\", \"exec\")\n>>> table.lookup(\"somefunc\").isnamespace()\nTrue\n\nNote that a single name can be bound to multiple objects.  If\nthe result is 'True', the name may also be bound to other\nobjects, like an int or list, that does not introduce a new\nnamespace.\n\n-- Method: getnamespaces ()\n\nReturn a list of namespaces bound to this name.\n\n-- Method: getnamespace ()\n\nReturn the namespace bound to this name.  If more than one or\nno namespace is bound to this name, a *note ValueError: 183.\nis raised.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "'Source code:' Lib/token.py(1)\n\n\n",
            "subsections": []
        },
        "This module provides constants which represent the numeric values of": {
            "content": "leaf nodes of the parse tree (terminal tokens).  Refer to the file\n'Grammar/Tokens' in the Python distribution for the definitions of the\nnames in the context of the language grammar.  The specific numeric\nvalues which the names map to may change between Python versions.\n",
            "subsections": []
        },
        "The module also provides a mapping from numeric codes to names and some": {
            "content": "functions.  The functions mirror definitions in the Python C header\nfiles.\n\n-- Data: token.tokname\n\nDictionary mapping the numeric values of the constants defined in\nthis module back to name strings, allowing more human-readable\nrepresentation of parse trees to be generated.\n\n-- Function: token.ISTERMINAL (x)\n\nReturn 'True' for terminal token values.\n\n-- Function: token.ISNONTERMINAL (x)\n\nReturn 'True' for non-terminal token values.\n\n-- Function: token.ISEOF (x)\n\nReturn 'True' if 'x' is the marker indicating the end of input.\n\nThe token constants are:\n\n-- Data: token.ENDMARKER\n\n-- Data: token.NAME\n\n-- Data: token.NUMBER\n\n-- Data: token.STRING\n\n-- Data: token.NEWLINE\n\n-- Data: token.INDENT\n\n-- Data: token.DEDENT\n\n-- Data: token.LPAR\n\nToken value for '\"(\"'.\n\n-- Data: token.RPAR\n\nToken value for '\")\"'.\n\n-- Data: token.LSQB\n\nToken value for '\"[\"'.\n\n-- Data: token.RSQB\n\nToken value for '\"]\"'.\n\n-- Data: token.COLON\n\nToken value for '\":\"'.\n\n-- Data: token.COMMA\n\nToken value for '\",\"'.\n\n-- Data: token.SEMI\n\nToken value for '\";\"'.\n\n-- Data: token.PLUS\n\nToken value for '\"+\"'.\n\n-- Data: token.MINUS\n\nToken value for '\"-\"'.\n\n-- Data: token.STAR\n\nToken value for '\"*\"'.\n\n-- Data: token.SLASH\n\nToken value for '\"/\"'.\n\n-- Data: token.VBAR\n\nToken value for '\"|\"'.\n\n-- Data: token.AMPER\n\nToken value for '\"&\"'.\n\n-- Data: token.LESS\n\nToken value for '\"<\"'.\n\n-- Data: token.GREATER\n\nToken value for '\">\"'.\n\n-- Data: token.EQUAL\n\nToken value for '\"=\"'.\n\n-- Data: token.DOT\n\nToken value for '\".\"'.\n\n-- Data: token.PERCENT\n\nToken value for '\"%\"'.\n\n-- Data: token.LBRACE\n\nToken value for '\"{\"'.\n\n-- Data: token.RBRACE\n\nToken value for '\"}\"'.\n\n-- Data: token.EQEQUAL\n\nToken value for '\"==\"'.\n\n-- Data: token.NOTEQUAL\n\nToken value for '\"!=\"'.\n\n-- Data: token.LESSEQUAL\n\nToken value for '\"<=\"'.\n\n-- Data: token.GREATEREQUAL\n\nToken value for '\">=\"'.\n\n-- Data: token.TILDE\n\nToken value for '\"~\"'.\n\n-- Data: token.CIRCUMFLEX\n\nToken value for '\"^\"'.\n\n-- Data: token.LEFTSHIFT\n\nToken value for '\"<<\"'.\n\n-- Data: token.RIGHTSHIFT\n\nToken value for '\">>\"'.\n\n-- Data: token.DOUBLESTAR\n\nToken value for '\"\"'.\n\n-- Data: token.PLUSEQUAL\n\nToken value for '\"+=\"'.\n\n-- Data: token.MINEQUAL\n\nToken value for '\"-=\"'.\n\n-- Data: token.STAREQUAL\n\nToken value for '\"*=\"'.\n\n-- Data: token.SLASHEQUAL\n\nToken value for '\"/=\"'.\n\n-- Data: token.PERCENTEQUAL\n\nToken value for '\"%=\"'.\n\n-- Data: token.AMPEREQUAL\n\nToken value for '\"&=\"'.\n\n-- Data: token.VBAREQUAL\n\nToken value for '\"|=\"'.\n\n-- Data: token.CIRCUMFLEXEQUAL\n\nToken value for '\"^=\"'.\n\n-- Data: token.LEFTSHIFTEQUAL\n\nToken value for '\"<<=\"'.\n\n-- Data: token.RIGHTSHIFTEQUAL\n\nToken value for '\">>=\"'.\n\n-- Data: token.DOUBLESTAREQUAL\n\nToken value for '\"=\"'.\n\n-- Data: token.DOUBLESLASH\n\nToken value for '\"//\"'.\n\n-- Data: token.DOUBLESLASHEQUAL\n\nToken value for '\"//=\"'.\n\n-- Data: token.AT\n\nToken value for '\"@\"'.\n\n-- Data: token.ATEQUAL\n\nToken value for '\"@=\"'.\n\n-- Data: token.RARROW\n\nToken value for '\"->\"'.\n\n-- Data: token.ELLIPSIS\n\nToken value for '\"...\"'.\n\n-- Data: token.COLONEQUAL\n\nToken value for '\":=\"'.\n\n-- Data: token.EXCLAMATION\n\nToken value for '\"!\"'.\n\n-- Data: token.OP\n\n-- Data: token.AWAIT\n\n-- Data: token.ASYNC\n\n-- Data: token.TYPEIGNORE\n\n-- Data: token.TYPECOMMENT\n\n-- Data: token.SOFTKEYWORD\n\n-- Data: token.FSTRINGSTART\n\n-- Data: token.FSTRINGMIDDLE\n\n-- Data: token.FSTRINGEND\n\n-- Data: token.COMMENT\n\n-- Data: token.NL\n\n-- Data: token.ERRORTOKEN\n\n-- Data: token.NTOKENS\n\n-- Data: token.NTOFFSET\n",
            "subsections": []
        },
        "The following token type values aren't used by the C tokenizer but are": {
            "content": "needed for the *note tokenize: f6. module.\n\n-- Data: token.COMMENT\n\nToken value used to indicate a comment.\n\n-- Data: token.NL\n\nToken value used to indicate a non-terminating newline.  The *note\nNEWLINE: 42ea. token indicates the end of a logical line of Python\ncode; 'NL' tokens are generated when a logical line of code is\ncontinued over multiple physical lines.\n\n-- Data: token.ENCODING\n\nToken value that indicates the encoding used to decode the source\nbytes into text.  The first token returned by *note\ntokenize.tokenize(): 202. will always be an 'ENCODING' token.\n\n-- Data: token.TYPECOMMENT\n\nToken value indicating that a type comment was recognized.  Such\ntokens are only produced when *note ast.parse(): 182. is invoked\nwith 'typecomments=True'.\n\nChanged in version 3.5: Added *note AWAIT: 431e. and *note ASYNC: 431f.\ntokens.\n\nChanged in version 3.7: Added *note COMMENT: 4326, *note NL: 4327. and\n*note ENCODING: 432b. tokens.\n\nChanged in version 3.7: Removed *note AWAIT: 431e. and *note ASYNC:\n431f. tokens.  \"async\" and \"await\" are now tokenized as *note NAME:\n42e7. tokens.\n\nChanged in version 3.8: Added *note TYPECOMMENT: 4321, *note\nTYPEIGNORE: 4320, *note COLONEQUAL: 431b.  Added *note AWAIT: 431e. and\n*note ASYNC: 431f. tokens back (they're needed to support parsing older\nPython versions for *note ast.parse(): 182. with 'featureversion' set\nto 6 or lower).\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/token.py\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "'Source code:' Lib/keyword.py(1)\n\n\n\nThis module allows a Python program to determine if a string is a *note\nkeyword: 1bbd. or *note soft keyword: 600.\n\n-- Function: keyword.iskeyword (s)\n\nReturn 'True' if 's' is a Python *note keyword: 1bbd.\n\n-- Data: keyword.kwlist\n\nSequence containing all the *note keywords: 1bbd. defined for the\ninterpreter.  If any keywords are defined to only be active when\nparticular *note future: 0. statements are in effect, these\nwill be included as well.\n\n-- Function: keyword.issoftkeyword (s)\n\nReturn 'True' if 's' is a Python *note soft keyword: 600.\n\nNew in version 3.9.\n\n-- Data: keyword.softkwlist\n\nSequence containing all the *note soft keywords: 600. defined for\nthe interpreter.  If any soft keywords are defined to only be\nactive when particular *note future: 0. statements are in\neffect, these will be included as well.\n\nNew in version 3.9.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/keyword.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: tokenize -- Tokenizer for Python source,  Next: tabnanny -- Detection of ambiguous indentation,  Prev: keyword -- Testing for Python keywords,  Up: Python Language Services": {
            "content": "'Source code:' Lib/tokenize.py(1)\n\n\n\nThe *note tokenize: f6. module provides a lexical scanner for Python\nsource code, implemented in Python.  The scanner in this module returns\ncomments as tokens as well, making it useful for implementing\n\"pretty-printers\", including colorizers for on-screen displays.\n\nTo simplify token stream handling, all *note operator: 1bfd. and *note\ndelimiter: 1bfe. tokens and *note Ellipsis: 1e91. are returned using the\ngeneric *note OP: 431d. token type.  The exact type can be determined by\nchecking the 'exacttype' property on the *note named tuple: 417.\nreturned from *note tokenize.tokenize(): 202.\n\nWarning: Note that the functions in this module are only designed\nto parse syntactically valid Python code (code that does not raise\nwhen parsed using *note ast.parse(): 182.).  The behavior of the\nfunctions in this module is 'undefined' when providing invalid\nPython code and it can change at any point.\n\n* Menu:\n\n* Tokenizing Input::\n* Command-Line Usage: Command-Line Usage<5>.\n* Examples: Examples<34>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/tokenize.py\n\nFile: python3.12.info,  Node: Tokenizing Input,  Next: Command-Line Usage<5>,  Up: tokenize -- Tokenizer for Python source\n\n5.32.5.1 Tokenizing Input\n.........................\n\nThe primary entry point is a *note generator: eda.:\n\n-- Function: tokenize.tokenize (readline)\n\nThe *note tokenize(): 202. generator requires one argument,\n'readline', which must be a callable object which provides the same\ninterface as the *note io.IOBase.readline(): 11a1. method of file\nobjects.  Each call to the function should return one line of input\nas bytes.\n\nThe generator produces 5-tuples with these members: the token type;\nthe token string; a 2-tuple '(srow, scol)' of ints specifying the\nrow and column where the token begins in the source; a 2-tuple\n'(erow, ecol)' of ints specifying the row and column where the\ntoken ends in the source; and the line on which the token was\nfound.  The line passed (the last tuple item) is the 'physical'\nline.  The 5 tuple is returned as a *note named tuple: 417. with\nthe field names: 'type string start end line'.\n\nThe returned *note named tuple: 417. has an additional property\nnamed 'exacttype' that contains the exact operator type for *note\nOP: 431d. tokens.  For all other token types 'exacttype' equals\nthe named tuple 'type' field.\n\nChanged in version 3.1: Added support for named tuples.\n\nChanged in version 3.3: Added support for 'exacttype'.\n\n*note tokenize(): 202. determines the source encoding of the file\nby looking for a UTF-8 BOM or encoding cookie, according to PEP\n263(1).\n\n-- Function: tokenize.generatetokens (readline)\n\nTokenize a source reading unicode strings instead of bytes.\n\nLike *note tokenize(): 202, the 'readline' argument is a callable\nreturning a single line of input.  However, *note\ngeneratetokens(): 203. expects 'readline' to return a str object\nrather than bytes.\n\nThe result is an iterator yielding named tuples, exactly like *note\ntokenize(): 202.  It does not yield an *note ENCODING: 432b. token.\n\nAll constants from the *note token: f5. module are also exported from\n*note tokenize: f6.\n",
            "subsections": []
        },
        "Another function is provided to reverse the tokenization process.  This": {
            "content": "is useful for creating tools that tokenize a script, modify the token\nstream, and write back the modified script.\n\n-- Function: tokenize.untokenize (iterable)\n\nConverts tokens back into Python source code.  The 'iterable' must\nreturn sequences with at least two elements, the token type and the\ntoken string.  Any additional sequence elements are ignored.\n\nThe reconstructed script is returned as a single string.  The\nresult is guaranteed to tokenize back to match the input so that\nthe conversion is lossless and round-trips are assured.  The\nguarantee applies only to the token type and token string as the\nspacing between tokens (column positions) may change.\n\nIt returns bytes, encoded using the *note ENCODING: 432b. token,\nwhich is the first token sequence output by *note tokenize(): 202.\nIf there is no encoding token in the input, it returns a str\ninstead.\n\n*note tokenize(): 202. needs to detect the encoding of source files it\ntokenizes.  The function it uses to do this is available:\n\n-- Function: tokenize.detectencoding (readline)\n\nThe *note detectencoding(): 2553. function is used to detect the\nencoding that should be used to decode a Python source file.  It\nrequires one argument, readline, in the same way as the *note\ntokenize(): 202. generator.\n\nIt will call readline a maximum of twice, and return the encoding\nused (as a string) and a list of any lines (not decoded from bytes)\nit has read in.\n\nIt detects the encoding from the presence of a UTF-8 BOM or an\nencoding cookie as specified in PEP 263(2).  If both a BOM and a\ncookie are present, but disagree, a *note SyntaxError: 146. will be\nraised.  Note that if the BOM is found, ''utf-8-sig'' will be\nreturned as an encoding.\n\nIf no encoding is specified, then the default of ''utf-8'' will be\nreturned.\n\nUse *note open(): 2552. to open Python source files: it uses *note\ndetectencoding(): 2553. to detect the file encoding.\n\n-- Function: tokenize.open (filename)\n\nOpen a file in read only mode using the encoding detected by *note\ndetectencoding(): 2553.\n\nNew in version 3.2.\n\n-- Exception: tokenize.TokenError\n\nRaised when either a docstring or expression that may be split over\nseveral lines is not completed anywhere in the file, for example:\n\n\"\"\"Beginning of\ndocstring\n\nor:\n\n[1,\n2,\n3\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0263/\n\n(2) https://peps.python.org/pep-0263/\n\nFile: python3.12.info,  Node: Command-Line Usage<5>,  Next: Examples<34>,  Prev: Tokenizing Input,  Up: tokenize -- Tokenizer for Python source\n\n5.32.5.2 Command-Line Usage\n...........................\n\nNew in version 3.3.\n\nThe *note tokenize: f6. module can be executed as a script from the\ncommand line.  It is as simple as:\n\npython -m tokenize [-e] [filename.py]\n\nThe following options are accepted:\n\n-- Option: -h, --help\n\nshow this help message and exit\n\n-- Option: -e, --exact\n\ndisplay token names using the exact type\n\nIf 'filename.py' is specified its contents are tokenized to stdout.\nOtherwise, tokenization is performed on stdin.\n\nFile: python3.12.info,  Node: Examples<34>,  Prev: Command-Line Usage<5>,  Up: tokenize -- Tokenizer for Python source\n\n5.32.5.3 Examples\n.................\n",
            "subsections": []
        },
        "Example of a script rewriter that transforms float literals into Decimal": {
            "content": "objects:\n\nfrom tokenize import tokenize, untokenize, NUMBER, STRING, NAME, OP\nfrom io import BytesIO\n\ndef decistmt(s):\n\"\"\"Substitute Decimals for floats in a string of statements.\n\n>>> from decimal import Decimal\n>>> s = 'print(+21.3e-5*-.1234/81.7)'\n>>> decistmt(s)\n\"print (+Decimal ('21.3e-5')*-Decimal ('.1234')/Decimal ('81.7'))\"\n\nThe format of the exponent is inherited from the platform C library.\nKnown cases are \"e-007\" (Windows) and \"e-07\" (not Windows).  Since\nwe're only showing 12 digits, and the 13th isn't close to 5, the\nrest of the output should be platform-independent.\n\n>>> exec(s)  #doctest: +ELLIPSIS\n-3.21716034272e-0...7\n\nOutput from calculations with Decimal should be identical across all\nplatforms.\n\n>>> exec(decistmt(s))\n-3.217160342717258261933904529E-7\n\"\"\"\nresult = []\ng = tokenize(BytesIO(s.encode('utf-8')).readline)  # tokenize the string\nfor toknum, tokval, , ,  in g:\nif toknum == NUMBER and '.' in tokval:  # replace NUMBER tokens\nresult.extend([\n(NAME, 'Decimal'),\n(OP, '('),\n(STRING, repr(tokval)),\n(OP, ')')\n])\nelse:\nresult.append((toknum, tokval))\nreturn untokenize(result).decode('utf-8')\n\nExample of tokenizing from the command line.  The script:\n\ndef sayhello():\nprint(\"Hello, World!\")\n\nsayhello()\n\nwill be tokenized to the following output where the first column is the\nrange of the line/column coordinates where the token is found, the\nsecond column is the name of the token, and the final column is the\nvalue of the token (if any)\n\n$ python -m tokenize hello.py\n0,0-0,0:            ENCODING       'utf-8'\n1,0-1,3:            NAME           'def'\n1,4-1,13:           NAME           'sayhello'\n1,13-1,14:          OP             '('\n1,14-1,15:          OP             ')'\n1,15-1,16:          OP             ':'\n1,16-1,17:          NEWLINE        '\\n'\n2,0-2,4:            INDENT         '    '\n2,4-2,9:            NAME           'print'\n2,9-2,10:           OP             '('\n2,10-2,25:          STRING         '\"Hello, World!\"'\n2,25-2,26:          OP             ')'\n2,26-2,27:          NEWLINE        '\\n'\n3,0-3,1:            NL             '\\n'\n4,0-4,0:            DEDENT         ''\n4,0-4,9:            NAME           'sayhello'\n4,9-4,10:           OP             '('\n4,10-4,11:          OP             ')'\n4,11-4,12:          NEWLINE        '\\n'\n5,0-5,0:            ENDMARKER      ''\n\nThe exact token type names can be displayed using the *note -e: 4338.\noption:\n\n$ python -m tokenize -e hello.py\n0,0-0,0:            ENCODING       'utf-8'\n1,0-1,3:            NAME           'def'\n1,4-1,13:           NAME           'sayhello'\n1,13-1,14:          LPAR           '('\n1,14-1,15:          RPAR           ')'\n1,15-1,16:          COLON          ':'\n1,16-1,17:          NEWLINE        '\\n'\n2,0-2,4:            INDENT         '    '\n2,4-2,9:            NAME           'print'\n2,9-2,10:           LPAR           '('\n2,10-2,25:          STRING         '\"Hello, World!\"'\n2,25-2,26:          RPAR           ')'\n2,26-2,27:          NEWLINE        '\\n'\n3,0-3,1:            NL             '\\n'\n4,0-4,0:            DEDENT         ''\n4,0-4,9:            NAME           'sayhello'\n4,9-4,10:           LPAR           '('\n4,10-4,11:          RPAR           ')'\n4,11-4,12:          NEWLINE        '\\n'\n5,0-5,0:            ENDMARKER      ''\n",
            "subsections": []
        },
        "Example of tokenizing a file programmatically, reading unicode strings": {
            "content": "instead of bytes with *note generatetokens(): 203.:\n\nimport tokenize\n\nwith tokenize.open('hello.py') as f:\ntokens = tokenize.generatetokens(f.readline)\nfor token in tokens:\nprint(token)\n\nOr reading bytes directly with *note tokenize(): 202.:\n\nimport tokenize\n\nwith open('hello.py', 'rb') as f:\ntokens = tokenize.tokenize(f.readline)\nfor token in tokens:\nprint(token)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: tabnanny -- Detection of ambiguous indentation,  Next: pyclbr -- Python module browser support,  Prev: tokenize -- Tokenizer for Python source,  Up: Python Language Services": {
            "content": "'Source code:' Lib/tabnanny.py(1)\n\n\n\nFor the time being this module is intended to be called as a script.",
            "subsections": []
        },
        "However it is possible to import it into an IDE and use the function": {
            "content": "*note check(): 433d. described below.\n\nNote: The API provided by this module is likely to change in future\nreleases; such changes may not be backward compatible.\n\n-- Function: tabnanny.check (fileordir)\n\nIf 'fileordir' is a directory and not a symbolic link, then\nrecursively descend the directory tree named by 'fileordir',\nchecking all '.py' files along the way.  If 'fileordir' is an\nordinary Python source file, it is checked for whitespace related\nproblems.  The diagnostic messages are written to standard output\nusing the *note print(): de5. function.\n\n-- Data: tabnanny.verbose\n\nFlag indicating whether to print verbose messages.  This is\nincremented by the '-v' option if called as a script.\n\n-- Data: tabnanny.filenameonly\n\nFlag indicating whether to print only the filenames of files\ncontaining whitespace related problems.  This is set to true by the\n'-q' option if called as a script.\n\n-- Exception: tabnanny.NannyNag\n\nRaised by *note processtokens(): 4341. if detecting an ambiguous\nindent.  Captured and handled in *note check(): 433d.\n\n-- Function: tabnanny.processtokens (tokens)\n\nThis function is used by *note check(): 433d. to process tokens\ngenerated by the *note tokenize: f6. module.\n\nSee also\n........\n\nModule *note tokenize: f6.\n\nLexical scanner for Python source code.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/tabnanny.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: pyclbr -- Python module browser support,  Next: pycompile -- Compile Python source files,  Prev: tabnanny -- Detection of ambiguous indentation,  Up: Python Language Services": {
            "content": "'Source code:' Lib/pyclbr.py(1)\n\n\n\nThe *note pyclbr: af. module provides limited information about the\nfunctions, classes, and methods defined in a Python-coded module.  The\ninformation is sufficient to implement a module browser.  The\ninformation is extracted from the Python source code rather than by\nimporting the module, so this module is safe to use with untrusted code.",
            "subsections": []
        },
        "This restriction makes it impossible to use this module with modules not": {
            "content": "implemented in Python, including all standard and optional extension\nmodules.\n\n-- Function: pyclbr.readmodule (module, path=None)\n\nReturn a dictionary mapping module-level class names to class\ndescriptors.  If possible, descriptors for imported base classes\nare included.  Parameter 'module' is a string with the name of the\nmodule to read; it may be the name of a module within a package.\nIf given, 'path' is a sequence of directory paths prepended to\n'sys.path', which is used to locate the module source code.\n\nThis function is the original interface and is only kept for back\ncompatibility.  It returns a filtered version of the following.\n\n-- Function: pyclbr.readmoduleex (module, path=None)\n\nReturn a dictionary-based tree containing a function or class\ndescriptors for each function and class defined in the module with\na 'def' or 'class' statement.  The returned dictionary maps\nmodule-level function and class names to their descriptors.  Nested\nobjects are entered into the children dictionary of their parent.\nAs with readmodule, 'module' names the module to be read and 'path'\nis prepended to sys.path.  If the module being read is a package,\nthe returned dictionary has a key ''path'' whose value is a\nlist containing the package search path.\n",
            "subsections": []
        },
        "New in version 3.7: Descriptors for nested definitions.  They are": {
            "content": "accessed through the new children attribute.  Each has a new parent\nattribute.\n",
            "subsections": []
        },
        "The descriptors returned by these functions are instances of Function": {
            "content": "and Class classes.  Users are not expected to create instances of these\nclasses.\n\n* Menu:\n\n* Function Objects::\n* Class Objects: Class Objects<2>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/pyclbr.py\n\nFile: python3.12.info,  Node: Function Objects,  Next: Class Objects<2>,  Up: pyclbr -- Python module browser support\n\n5.32.7.1 Function Objects\n.........................\n\n-- Class: pyclbr.Function\n\nClass 'Function' instances describe functions defined by def\nstatements.  They have the following attributes:\n\n-- Attribute: file\n\nName of the file in which the function is defined.\n\n-- Attribute: module\n\nThe name of the module defining the function described.\n\n-- Attribute: name\n\nThe name of the function.\n\n-- Attribute: lineno\n\nThe line number in the file where the definition starts.\n\n-- Attribute: parent\n\nFor top-level functions, 'None'.  For nested functions, the\nparent.\n\nNew in version 3.7.\n\n-- Attribute: children\n\nA *note dictionary: 237. mapping names to descriptors for\nnested functions and classes.\n\nNew in version 3.7.\n\n-- Attribute: isasync\n\n'True' for functions that are defined with the *note async:\n394. prefix, 'False' otherwise.\n\nNew in version 3.10.\n\nFile: python3.12.info,  Node: Class Objects<2>,  Prev: Function Objects,  Up: pyclbr -- Python module browser support\n\n5.32.7.2 Class Objects\n......................\n\n-- Class: pyclbr.Class\n\nClass 'Class' instances describe classes defined by class\nstatements.  They have the same attributes as *note Functions:\n4346. and two more.\n\n-- Attribute: file\n\nName of the file in which the class is defined.\n\n-- Attribute: module\n\nThe name of the module defining the class described.\n\n-- Attribute: name\n\nThe name of the class.\n\n-- Attribute: lineno\n\nThe line number in the file where the definition starts.\n\n-- Attribute: parent\n\nFor top-level classes, None.  For nested classes, the parent.\n\nNew in version 3.7.\n\n-- Attribute: children\n\nA dictionary mapping names to descriptors for nested functions\nand classes.\n\nNew in version 3.7.\n\n-- Attribute: super\n\nA list of 'Class' objects which describe the immediate base\nclasses of the class being described.  Classes which are named\nas superclasses but which are not discoverable by *note\nreadmoduleex(): 621. are listed as a string with the class\nname instead of as 'Class' objects.\n\n-- Attribute: methods\n\nA *note dictionary: 237. mapping method names to line numbers.\nThis can be derived from the newer *note children: 4356.\ndictionary, but remains for back-compatibility.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: pycompile -- Compile Python source files,  Next: compileall -- Byte-compile Python libraries,  Prev: pyclbr -- Python module browser support,  Up: Python Language Services": {
            "content": "'Source code:' Lib/pycompile.py(1)\n\n\n\nThe *note pycompile: ae. module provides a function to generate a\nbyte-code file from a source file, and another function used when the\nmodule source file is invoked as a script.\n",
            "subsections": []
        },
        "Though not often needed, this function can be useful when installing": {
            "content": "modules for shared use, especially if some of the users may not have\npermission to write the byte-code cache files in the directory\ncontaining the source code.\n\n-- Exception: pycompile.PyCompileError\n\nException raised when an error occurs while attempting to compile\nthe file.\n\n-- Function: pycompile.compile (file, cfile=None, dfile=None,\ndoraise=False, optimize=-1,\ninvalidationmode=PycInvalidationMode.TIMESTAMP, quiet=0)\n\nCompile a source file to byte-code and write out the byte-code\ncache file.  The source code is loaded from the file named 'file'.\nThe byte-code is written to 'cfile', which defaults to the PEP\n3147(2)/ PEP 488(3) path, ending in '.pyc'.  For example, if 'file'\nis '/foo/bar/baz.py' 'cfile' will default to\n'/foo/bar/pycache/baz.cpython-32.pyc' for Python 3.2.  If\n'dfile' is specified, it is used instead of 'file' as the name of\nthe source file from which source lines are obtained for display in\nexception tracebacks.  If 'doraise' is true, a *note\nPyCompileError: 435b. is raised when an error is encountered while\ncompiling 'file'.  If 'doraise' is false (the default), an error\nstring is written to 'sys.stderr', but no exception is raised.\nThis function returns the path to byte-compiled file, i.e.\nwhatever 'cfile' value was used.\n\nThe 'doraise' and 'quiet' arguments determine how errors are\nhandled while compiling file.  If 'quiet' is 0 or 1, and 'doraise'\nis false, the default behaviour is enabled: an error string is\nwritten to 'sys.stderr', and the function returns 'None' instead of\na path.  If 'doraise' is true, a *note PyCompileError: 435b. is\nraised instead.  However if 'quiet' is 2, no message is written,\nand 'doraise' has no effect.\n\nIf the path that 'cfile' becomes (either explicitly specified or\ncomputed) is a symlink or non-regular file, *note FileExistsError:\ne97. will be raised.  This is to act as a warning that import will\nturn those paths into regular files if it is allowed to write\nbyte-compiled files to those paths.  This is a side-effect of\nimport using file renaming to place the final byte-compiled file\ninto place to prevent concurrent file writing issues.\n\n'optimize' controls the optimization level and is passed to the\nbuilt-in *note compile(): 528. function.  The default of '-1'\nselects the optimization level of the current interpreter.\n\n'invalidationmode' should be a member of the *note\nPycInvalidationMode: 435c. enum and controls how the generated\nbytecode cache is invalidated at runtime.  The default is *note\nPycInvalidationMode.CHECKEDHASH: 435d. if the 'SOURCEDATEEPOCH'\nenvironment variable is set, otherwise the default is *note\nPycInvalidationMode.TIMESTAMP: 435e.\n\nChanged in version 3.2: Changed default value of 'cfile' to be PEP\n3147(4)-compliant.  Previous default was 'file' + ''c'' (''o'' if\noptimization was enabled).  Also added the 'optimize' parameter.\n\nChanged in version 3.4: Changed code to use *note importlib: 71.\nfor the byte-code cache file writing.  This means file\ncreation/writing semantics now match what *note importlib: 71.\ndoes, e.g.  permissions, write-and-move semantics, etc.  Also added\nthe caveat that *note FileExistsError: e97. is raised if 'cfile' is\na symlink or non-regular file.\n\nChanged in version 3.7: The 'invalidationmode' parameter was added\nas specified in PEP 552(5).  If the 'SOURCEDATEEPOCH' environment\nvariable is set, 'invalidationmode' will be forced to *note\nPycInvalidationMode.CHECKEDHASH: 435d.\n\nChanged in version 3.7.2: The 'SOURCEDATEEPOCH' environment\nvariable no longer overrides the value of the 'invalidationmode'\nargument, and determines its default value instead.\n\nChanged in version 3.8: The 'quiet' parameter was added.\n\n-- Class: pycompile.PycInvalidationMode\n\nA enumeration of possible methods the interpreter can use to\ndetermine whether a bytecode file is up to date with a source file.\nThe '.pyc' file indicates the desired invalidation mode in its\nheader.  See *note Cached bytecode invalidation: 3b2. for more\ninformation on how Python invalidates '.pyc' files at runtime.\n\nNew in version 3.7.\n\n-- Attribute: TIMESTAMP\n\nThe '.pyc' file includes the timestamp and size of the source\nfile, which Python will compare against the metadata of the\nsource file at runtime to determine if the '.pyc' file needs\nto be regenerated.\n\n-- Attribute: CHECKEDHASH\n\nThe '.pyc' file includes a hash of the source file content,\nwhich Python will compare against the source at runtime to\ndetermine if the '.pyc' file needs to be regenerated.\n\n-- Attribute: UNCHECKEDHASH\n\nLike *note CHECKEDHASH: 435d, the '.pyc' file includes a hash\nof the source file content.  However, Python will at runtime\nassume the '.pyc' file is up to date and not validate the\n'.pyc' against the source file at all.\n\nThis option is useful when the '.pycs' are kept up to date by\nsome system external to Python like a build system.\n\n* Menu:\n\n* Command-Line Interface: Command-Line Interface<6>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/pycompile.py\n\n(2) https://peps.python.org/pep-3147/\n\n(3) https://peps.python.org/pep-0488/\n\n(4) https://peps.python.org/pep-3147/\n\n(5) https://peps.python.org/pep-0552/\n\nFile: python3.12.info,  Node: Command-Line Interface<6>,  Up: pycompile -- Compile Python source files\n\n5.32.8.1 Command-Line Interface\n...............................\n\nThis module can be invoked as a script to compile several source files.",
            "subsections": []
        },
        "The files named in 'filenames' are compiled and the resulting bytecode": {
            "content": "is cached in the normal manner.  This program does not search a\ndirectory structure to locate source files; it only compiles files named\nexplicitly.  The exit status is nonzero if one of the files could not be\ncompiled.\n\n-- Option: <file> ... <fileN>\n-- Option: -\n\nPositional arguments are files to compile.  If '-' is the only\nparameter, the list of files is taken from standard input.\n\n-- Option: -q, --quiet\n\nSuppress errors output.\n\nChanged in version 3.2: Added support for '-'.\n\nChanged in version 3.10: Added support for *note -q: 4364.\n\nSee also\n........\n\nModule *note compileall: 1e.\n\nUtilities to compile all Python source files in a directory tree.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: compileall -- Byte-compile Python libraries,  Next: dis -- Disassembler for Python bytecode,  Prev: pycompile -- Compile Python source files,  Up: Python Language Services": {
            "content": "'Source code:' Lib/compileall.py(1)\n\n\n",
            "subsections": []
        },
        "This module provides some utility functions to support installing Python": {
            "content": "libraries.  These functions compile Python source files in a directory\ntree.  This module can be used to create the cached byte-code files at\nlibrary installation time, which makes them available for use even by\nusers who don't have write permission to the library directories.\n\n*note Availability: 1ad3.: not Emscripten, not WASI.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Command-line use,  Next: Public functions,  Up: compileall -- Byte-compile Python libraries": {
            "content": "5.32.9.1 Command-line use\n.........................\n",
            "subsections": []
        },
        "This module can work as a script (using 'python -m compileall') to": {
            "content": "compile Python sources.\n\n-- Option: directory ...\n-- Option: file ...\n\nPositional arguments are files to compile or directories that\ncontain source files, traversed recursively.  If no argument is\ngiven, behave as if the command line was '-l <DIRECTORIES FROM\nSYS.PATH>'.\n\n-- Option: -l\n\nDo not recurse into subdirectories, only compile source code files\ndirectly contained in the named or implied directories.\n\n-- Option: -f\n\nForce rebuild even if timestamps are up-to-date.\n\n-- Option: -q\n\nDo not print the list of files compiled.  If passed once, error\nmessages will still be printed.  If passed twice ('-qq'), all\noutput is suppressed.\n\n-- Option: -d destdir\n\nDirectory prepended to the path to each file being compiled.  This\nwill appear in compilation time tracebacks, and is also compiled in\nto the byte-code file, where it will be used in tracebacks and\nother messages in cases where the source file does not exist at the\ntime the byte-code file is executed.\n\n-- Option: -s stripprefix\n\n-- Option: -p prependprefix\n\nRemove ('-s') or append ('-p') the given prefix of paths recorded\nin the '.pyc' files.  Cannot be combined with '-d'.\n\n-- Option: -x regex\n\nregex is used to search the full path to each file considered for\ncompilation, and if the regex produces a match, the file is\nskipped.\n\n-- Option: -i list\n\nRead the file 'list' and add each line that it contains to the list\nof files and directories to compile.  If 'list' is '-', read lines\nfrom 'stdin'.\n\n-- Option: -b\n\nWrite the byte-code files to their legacy locations and names,\nwhich may overwrite byte-code files created by another version of\nPython.  The default is to write files to their PEP 3147(1)\nlocations and names, which allows byte-code files from multiple\nversions of Python to coexist.\n\n-- Option: -r\n\nControl the maximum recursion level for subdirectories.  If this is\ngiven, then '-l' option will not be taken into account.  'python -m\ncompileall <directory> -r 0' is equivalent to 'python -m compileall\n<directory> -l'.\n\n-- Option: -j N\n\nUse 'N' workers to compile the files within the given directory.\nIf '0' is used, then the result of *note os.cpucount(): 60b. will\nbe used.\n\n-- Option: --invalidation-mode [timestamp|checked-hash|unchecked-hash]\n\nControl how the generated byte-code files are invalidated at\nruntime.  The 'timestamp' value, means that '.pyc' files with the\nsource timestamp and size embedded will be generated.  The\n'checked-hash' and 'unchecked-hash' values cause hash-based pycs to\nbe generated.  Hash-based pycs embed a hash of the source file\ncontents rather than a timestamp.  See *note Cached bytecode\ninvalidation: 3b2. for more information on how Python validates\nbytecode cache files at runtime.  The default is 'timestamp' if the\n'SOURCEDATEEPOCH' environment variable is not set, and\n'checked-hash' if the 'SOURCEDATEEPOCH' environment variable is\nset.\n\n-- Option: -o level\n\nCompile with the given optimization level.  May be used multiple\ntimes to compile for multiple levels at a time (for example,\n'compileall -o 1 -o 2').\n\n-- Option: -e dir\n\nIgnore symlinks pointing outside the given directory.\n\n-- Option: --hardlink-dupes\n\nIf two '.pyc' files with different optimization level have the same\ncontent, use hard links to consolidate duplicate files.\n\nChanged in version 3.2: Added the '-i', '-b' and '-h' options.\n",
            "subsections": []
        },
        "Changed in version 3.5: Added the '-j', '-r', and '-qq' options.  '-q'": {
            "content": "option was changed to a multilevel value.  '-b' will always produce a\nbyte-code file ending in '.pyc', never '.pyo'.\n\nChanged in version 3.7: Added the '--invalidation-mode' option.\n",
            "subsections": []
        },
        "Changed in version 3.9: Added the '-s', '-p', '-e' and": {
            "content": "'--hardlink-dupes' options.  Raised the default recursion limit from 10\nto *note sys.getrecursionlimit(): 1e8.  Added the possibility to specify\nthe '-o' option multiple times.\n",
            "subsections": []
        },
        "There is no command-line option to control the optimization level used": {
            "content": "by the *note compile(): 528. function, because the Python interpreter\nitself already provides the option: 'python -O -m compileall'.\n\nSimilarly, the *note compile(): 528. function respects the *note\nsys.pycacheprefix: 7c8. setting.  The generated bytecode cache will\nonly be useful if *note compile(): 528. is run with the same *note\nsys.pycacheprefix: 7c8. (if any) that will be used at runtime.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3147/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Public functions,  Prev: Command-line use,  Up: compileall -- Byte-compile Python libraries": {
            "content": "5.32.9.2 Public functions\n.........................\n\n-- Function: compileall.compiledir (dir,\nmaxlevels=sys.getrecursionlimit(), ddir=None, force=False,\nrx=None, quiet=0, legacy=False, optimize=-1, workers=1,\ninvalidationmode=None, *, stripdir=None, prependdir=None,\nlimitsldest=None, hardlinkdupes=False)\n\nRecursively descend the directory tree named by 'dir', compiling\nall '.py' files along the way.  Return a true value if all the\nfiles compiled successfully, and a false value otherwise.\n\nThe 'maxlevels' parameter is used to limit the depth of the\nrecursion; it defaults to 'sys.getrecursionlimit()'.\n\nIf 'ddir' is given, it is prepended to the path to each file being\ncompiled for use in compilation time tracebacks, and is also\ncompiled in to the byte-code file, where it will be used in\ntracebacks and other messages in cases where the source file does\nnot exist at the time the byte-code file is executed.\n\nIf 'force' is true, modules are re-compiled even if the timestamps\nare up to date.\n\nIf 'rx' is given, its 'search' method is called on the complete\npath to each file considered for compilation, and if it returns a\ntrue value, the file is skipped.  This can be used to exclude files\nmatching a regular expression, given as a *note re.Pattern: df6.\nobject.\n\nIf 'quiet' is 'False' or '0' (the default), the filenames and other\ninformation are printed to standard out.  Set to '1', only errors\nare printed.  Set to '2', all output is suppressed.\n\nIf 'legacy' is true, byte-code files are written to their legacy\nlocations and names, which may overwrite byte-code files created by\nanother version of Python.  The default is to write files to their\nPEP 3147(1) locations and names, which allows byte-code files from\nmultiple versions of Python to coexist.\n\n'optimize' specifies the optimization level for the compiler.  It\nis passed to the built-in *note compile(): 528. function.  Accepts\nalso a sequence of optimization levels which lead to multiple\ncompilations of one '.py' file in one call.\n\nThe argument 'workers' specifies how many workers are used to\ncompile files in parallel.  The default is to not use multiple\nworkers.  If the platform can't use multiple workers and 'workers'\nargument is given, then sequential compilation will be used as a\nfallback.  If 'workers' is 0, the number of cores in the system is\nused.  If 'workers' is lower than '0', a *note ValueError: 183.\nwill be raised.\n\n'invalidationmode' should be a member of the *note\npycompile.PycInvalidationMode: 435c. enum and controls how the\ngenerated pycs are invalidated at runtime.\n\nThe 'stripdir', 'prependdir' and 'limitsldest' arguments\ncorrespond to the '-s', '-p' and '-e' options described above.\nThey may be specified as 'str' or *note os.PathLike: a9a.\n\nIf 'hardlinkdupes' is true and two '.pyc' files with different\noptimization level have the same content, use hard links to\nconsolidate duplicate files.\n\nChanged in version 3.2: Added the 'legacy' and 'optimize'\nparameter.\n\nChanged in version 3.5: Added the 'workers' parameter.\n\nChanged in version 3.5: 'quiet' parameter was changed to a\nmultilevel value.\n\nChanged in version 3.5: The 'legacy' parameter only writes out\n'.pyc' files, not '.pyo' files no matter what the value of\n'optimize' is.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\nChanged in version 3.7: The 'invalidationmode' parameter was\nadded.\n\nChanged in version 3.7.2: The 'invalidationmode' parameter's\ndefault value is updated to None.\n\nChanged in version 3.8: Setting 'workers' to 0 now chooses the\noptimal number of cores.\n\nChanged in version 3.9: Added 'stripdir', 'prependdir',\n'limitsldest' and 'hardlinkdupes' arguments.  Default value of\n'maxlevels' was changed from '10' to 'sys.getrecursionlimit()'\n\n-- Function: compileall.compilefile (fullname, ddir=None, force=False,\nrx=None, quiet=0, legacy=False, optimize=-1,\ninvalidationmode=None, *, stripdir=None, prependdir=None,\nlimitsldest=None, hardlinkdupes=False)\n\nCompile the file with path 'fullname'.  Return a true value if the\nfile compiled successfully, and a false value otherwise.\n\nIf 'ddir' is given, it is prepended to the path to the file being\ncompiled for use in compilation time tracebacks, and is also\ncompiled in to the byte-code file, where it will be used in\ntracebacks and other messages in cases where the source file does\nnot exist at the time the byte-code file is executed.\n\nIf 'rx' is given, its 'search' method is passed the full path name\nto the file being compiled, and if it returns a true value, the\nfile is not compiled and 'True' is returned.  This can be used to\nexclude files matching a regular expression, given as a *note\nre.Pattern: df6. object.\n\nIf 'quiet' is 'False' or '0' (the default), the filenames and other\ninformation are printed to standard out.  Set to '1', only errors\nare printed.  Set to '2', all output is suppressed.\n\nIf 'legacy' is true, byte-code files are written to their legacy\nlocations and names, which may overwrite byte-code files created by\nanother version of Python.  The default is to write files to their\nPEP 3147(2) locations and names, which allows byte-code files from\nmultiple versions of Python to coexist.\n\n'optimize' specifies the optimization level for the compiler.  It\nis passed to the built-in *note compile(): 528. function.  Accepts\nalso a sequence of optimization levels which lead to multiple\ncompilations of one '.py' file in one call.\n\n'invalidationmode' should be a member of the *note\npycompile.PycInvalidationMode: 435c. enum and controls how the\ngenerated pycs are invalidated at runtime.\n\nThe 'stripdir', 'prependdir' and 'limitsldest' arguments\ncorrespond to the '-s', '-p' and '-e' options described above.\nThey may be specified as 'str' or *note os.PathLike: a9a.\n\nIf 'hardlinkdupes' is true and two '.pyc' files with different\noptimization level have the same content, use hard links to\nconsolidate duplicate files.\n\nNew in version 3.2.\n\nChanged in version 3.5: 'quiet' parameter was changed to a\nmultilevel value.\n\nChanged in version 3.5: The 'legacy' parameter only writes out\n'.pyc' files, not '.pyo' files no matter what the value of\n'optimize' is.\n\nChanged in version 3.7: The 'invalidationmode' parameter was\nadded.\n\nChanged in version 3.7.2: The 'invalidationmode' parameter's\ndefault value is updated to None.\n\nChanged in version 3.9: Added 'stripdir', 'prependdir',\n'limitsldest' and 'hardlinkdupes' arguments.\n\n-- Function: compileall.compilepath (skipcurdir=True, maxlevels=0,\nforce=False, quiet=0, legacy=False, optimize=-1,\ninvalidationmode=None)\n\nByte-compile all the '.py' files found along 'sys.path'.  Return a\ntrue value if all the files compiled successfully, and a false\nvalue otherwise.\n\nIf 'skipcurdir' is true (the default), the current directory is\nnot included in the search.  All other parameters are passed to the\n*note compiledir(): 95f. function.  Note that unlike the other\ncompile functions, 'maxlevels' defaults to '0'.\n\nChanged in version 3.2: Added the 'legacy' and 'optimize'\nparameter.\n\nChanged in version 3.5: 'quiet' parameter was changed to a\nmultilevel value.\n\nChanged in version 3.5: The 'legacy' parameter only writes out\n'.pyc' files, not '.pyo' files no matter what the value of\n'optimize' is.\n\nChanged in version 3.7: The 'invalidationmode' parameter was\nadded.\n\nChanged in version 3.7.2: The 'invalidationmode' parameter's\ndefault value is updated to None.\n",
            "subsections": []
        },
        "To force a recompile of all the '.py' files in the 'Lib/' subdirectory": {
            "content": "and all its subdirectories:\n\nimport compileall\n\ncompileall.compiledir('Lib/', force=True)\n\n# Perform same compilation, excluding files in .svn directories.\nimport re\ncompileall.compiledir('Lib/', rx=re.compile(r'[/\\\\][.]svn'), force=True)\n\n# pathlib.Path objects can also be used.\nimport pathlib\ncompileall.compiledir(pathlib.Path('Lib/'), force=True)\n\nSee also\n........\n\nModule *note pycompile: ae.\n\nByte-compile a single source file.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3147/\n\n(2) https://peps.python.org/pep-3147/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: dis -- Disassembler for Python bytecode,  Next: pickletools -- Tools for pickle developers,  Prev: compileall -- Byte-compile Python libraries,  Up: Python Language Services": {
            "content": "'Source code:' Lib/dis.py(1)\n\n\n\nThe *note dis: 35. module supports the analysis of CPython *note\nbytecode: 370. by disassembling it.  The CPython bytecode which this\nmodule takes as an input is defined in the file 'Include/opcode.h' and\nused by the compiler and the interpreter.\n\n'CPython implementation detail:' Bytecode is an implementation detail of\nthe CPython interpreter.  No guarantees are made that bytecode will not\nbe added, removed, or changed between versions of Python.  Use of this\nmodule should not be considered to work across Python VMs or Python\nreleases.\n",
            "subsections": []
        },
        "Changed in version 3.6: Use 2 bytes for each instruction.  Previously": {
            "content": "the number of bytes varied by instruction.\n",
            "subsections": []
        },
        "Changed in version 3.10: The argument of jump, exception handling and": {
            "content": "loop instructions is now the instruction offset rather than the byte\noffset.\n",
            "subsections": []
        },
        "Changed in version 3.11: Some instructions are accompanied by one or": {
            "content": "more inline cache entries, which take the form of *note CACHE: 4cc.\ninstructions.  These instructions are hidden by default, but can be\nshown by passing 'showcaches=True' to any *note dis: 35. utility.",
            "subsections": []
        },
        "Furthermore, the interpreter now adapts the bytecode to specialize it": {
            "content": "for different runtime conditions.  The adaptive bytecode can be shown by\npassing 'adaptive=True'.\n",
            "subsections": []
        },
        "Changed in version 3.12: The argument of a jump is the offset of the": {
            "content": "target instruction relative to the instruction that appears immediately\nafter the jump instruction's *note CACHE: 4cc. entries.\n\nAs a consequence, the presence of the *note CACHE: 4cc. instructions is\ntransparent for forward jumps but needs to be taken into account when\nreasoning about backward jumps.\n\nExample: Given the function 'myfunc()':\n\ndef myfunc(alist):\nreturn len(alist)\n\nthe following command can be used to display the disassembly of\n'myfunc()':\n\n>>> dis.dis(myfunc)\n2           0 RESUME                   0\n\n3           2 LOADGLOBAL              1 (NULL + len)\n12 LOADFAST                0 (alist)\n14 CALL                     1\n22 RETURNVALUE\n\n(The \"2\" is a line number).\n\n* Menu:\n\n* Command-line interface: Command-line interface<2>.\n* Bytecode analysis::\n* Analysis functions::\n* Python Bytecode Instructions::\n* Opcode collections::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/dis.py\n\nFile: python3.12.info,  Node: Command-line interface<2>,  Next: Bytecode analysis,  Up: dis -- Disassembler for Python bytecode\n\n5.32.10.1 Command-line interface\n................................\n\nThe *note dis: 35. module can be invoked as a script from the command\nline:\n\npython -m dis [-h] [infile]\n\nThe following options are accepted:\n\n-- Program Option: -h, --help\n\nDisplay usage and exit.\n",
            "subsections": []
        },
        "If 'infile' is specified, its disassembled code will be written to": {
            "content": "stdout.  Otherwise, disassembly is performed on compiled source code\nrecieved from stdin.\n\nFile: python3.12.info,  Node: Bytecode analysis,  Next: Analysis functions,  Prev: Command-line interface<2>,  Up: dis -- Disassembler for Python bytecode\n\n5.32.10.2 Bytecode analysis\n...........................\n\nNew in version 3.4.\n",
            "subsections": []
        },
        "The bytecode analysis API allows pieces of Python code to be wrapped in": {
            "content": "a *note Bytecode: d9e. object that provides easy access to details of\nthe compiled code.\n\n-- Class: dis.Bytecode (x, *, firstline=None, currentoffset=None,\nshowcaches=False, adaptive=False)\n\nAnalyse the bytecode corresponding to a function, generator,\nasynchronous generator, coroutine, method, string of source code,\nor a code object (as returned by *note compile(): 528.).\n\nThis is a convenience wrapper around many of the functions listed\nbelow, most notably *note getinstructions(): d9d, as iterating\nover a *note Bytecode: d9e. instance yields the bytecode operations\nas *note Instruction: d9c. instances.\n\nIf 'firstline' is not 'None', it indicates the line number that\nshould be reported for the first source line in the disassembled\ncode.  Otherwise, the source line information (if any) is taken\ndirectly from the disassembled code object.\n\nIf 'currentoffset' is not 'None', it refers to an instruction\noffset in the disassembled code.  Setting this means *note dis():\nd9f. will display a \"current instruction\" marker against the\nspecified opcode.\n\nIf 'showcaches' is 'True', *note dis(): d9f. will display inline\ncache entries used by the interpreter to specialize the bytecode.\n\nIf 'adaptive' is 'True', *note dis(): d9f. will display specialized\nbytecode that may be different from the original bytecode.\n\n-- Method: classmethod fromtraceback (tb, *, showcaches=False)\n\nConstruct a *note Bytecode: d9e. instance from the given\ntraceback, setting 'currentoffset' to the instruction\nresponsible for the exception.\n\n-- Data: codeobj\n\nThe compiled code object.\n\n-- Data: firstline\n\nThe first source line of the code object (if available)\n\n-- Method: dis ()\n\nReturn a formatted view of the bytecode operations (the same\nas printed by *note dis.dis(): 96e, but returned as a\nmulti-line string).\n\n-- Method: info ()\n\nReturn a formatted multi-line string with detailed information\nabout the code object, like *note codeinfo(): 10af.\n\nChanged in version 3.7: This can now handle coroutine and\nasynchronous generator objects.\n\nChanged in version 3.11: Added the 'showcaches' and 'adaptive'\nparameters.\n\nExample:\n\n>>> bytecode = dis.Bytecode(myfunc)\n>>> for instr in bytecode:\n...     print(instr.opname)\n...\nRESUME\nLOADGLOBAL\nLOADFAST\nCALL\nRETURNVALUE\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Analysis functions,  Next: Python Bytecode Instructions,  Prev: Bytecode analysis,  Up: dis -- Disassembler for Python bytecode": {
            "content": "5.32.10.3 Analysis functions\n............................\n\nThe *note dis: 35. module also defines the following analysis functions\nthat convert the input directly to the desired output.  They can be\nuseful if only a single operation is being performed, so the\nintermediate analysis object isn't useful:\n\n-- Function: dis.codeinfo (x)\n\nReturn a formatted multi-line string with detailed code object\ninformation for the supplied function, generator, asynchronous\ngenerator, coroutine, method, source code string or code object.\n\nNote that the exact contents of code info strings are highly\nimplementation dependent and they may change arbitrarily across\nPython VMs or Python releases.\n\nNew in version 3.2.\n\nChanged in version 3.7: This can now handle coroutine and\nasynchronous generator objects.\n\n-- Function: dis.showcode (x, *, file=None)\n\nPrint detailed code object information for the supplied function,\nmethod, source code string or code object to 'file' (or\n'sys.stdout' if 'file' is not specified).\n\nThis is a convenient shorthand for 'print(codeinfo(x),\nfile=file)', intended for interactive exploration at the\ninterpreter prompt.\n\nNew in version 3.2.\n\nChanged in version 3.4: Added 'file' parameter.\n\n-- Function: dis.dis (x=None, *, file=None, depth=None,\nshowcaches=False, adaptive=False)\n\nDisassemble the 'x' object.  'x' can denote either a module, a\nclass, a method, a function, a generator, an asynchronous\ngenerator, a coroutine, a code object, a string of source code or a\nbyte sequence of raw bytecode.  For a module, it disassembles all\nfunctions.  For a class, it disassembles all methods (including\nclass and static methods).  For a code object or sequence of raw\nbytecode, it prints one line per bytecode instruction.  It also\nrecursively disassembles nested code objects.  These can include\ngenerator expressions, nested functions, the bodies of nested\nclasses, and the code objects used for *note annotation scopes:\n167.  Strings are first compiled to code objects with the *note\ncompile(): 528. built-in function before being disassembled.  If no\nobject is provided, this function disassembles the last traceback.\n\nThe disassembly is written as text to the supplied 'file' argument\nif provided and to 'sys.stdout' otherwise.\n\nThe maximal depth of recursion is limited by 'depth' unless it is\n'None'.  'depth=0' means no recursion.\n\nIf 'showcaches' is 'True', this function will display inline cache\nentries used by the interpreter to specialize the bytecode.\n\nIf 'adaptive' is 'True', this function will display specialized\nbytecode that may be different from the original bytecode.\n\nChanged in version 3.4: Added 'file' parameter.\n\nChanged in version 3.7: Implemented recursive disassembling and\nadded 'depth' parameter.\n\nChanged in version 3.7: This can now handle coroutine and\nasynchronous generator objects.\n\nChanged in version 3.11: Added the 'showcaches' and 'adaptive'\nparameters.\n\n-- Function: dis.distb (tb=None, *, file=None, showcaches=False,\nadaptive=False)\n\nDisassemble the top-of-stack function of a traceback, using the\nlast traceback if none was passed.  The instruction causing the\nexception is indicated.\n\nThe disassembly is written as text to the supplied 'file' argument\nif provided and to 'sys.stdout' otherwise.\n\nChanged in version 3.4: Added 'file' parameter.\n\nChanged in version 3.11: Added the 'showcaches' and 'adaptive'\nparameters.\n\n-- Function: dis.disassemble (code, lasti=-1, *, file=None,\nshowcaches=False, adaptive=False)\n-- Function: dis.disco (code, lasti=-1, *, file=None,\nshowcaches=False, adaptive=False)\n\nDisassemble a code object, indicating the last instruction if\n'lasti' was provided.  The output is divided in the following\ncolumns:\n\n1. the line number, for the first instruction of each line\n\n2. the current instruction, indicated as '-->',\n\n3. a labelled instruction, indicated with '>>',\n\n4. the address of the instruction,\n\n5. the operation code name,\n\n6. operation parameters, and\n\n7. interpretation of the parameters in parentheses.\n\nThe parameter interpretation recognizes local and global variable\nnames, constant values, branch targets, and compare operators.\n\nThe disassembly is written as text to the supplied 'file' argument\nif provided and to 'sys.stdout' otherwise.\n\nChanged in version 3.4: Added 'file' parameter.\n\nChanged in version 3.11: Added the 'showcaches' and 'adaptive'\nparameters.\n\n-- Function: dis.getinstructions (x, *, firstline=None,\nshowcaches=False, adaptive=False)\n\nReturn an iterator over the instructions in the supplied function,\nmethod, source code string or code object.\n\nThe iterator generates a series of *note Instruction: d9c. named\ntuples giving the details of each operation in the supplied code.\n\nIf 'firstline' is not 'None', it indicates the line number that\nshould be reported for the first source line in the disassembled\ncode.  Otherwise, the source line information (if any) is taken\ndirectly from the disassembled code object.\n\nThe 'showcaches' and 'adaptive' parameters work as they do in\n*note dis(): 35.\n\nNew in version 3.4.\n\nChanged in version 3.11: Added the 'showcaches' and 'adaptive'\nparameters.\n\n-- Function: dis.findlinestarts (code)\n\nThis generator function uses the *note colines(): 5a0. method of\nthe *note code object: 59f. 'code' to find the offsets which are\nstarts of lines in the source code.  They are generated as\n'(offset, lineno)' pairs.\n\nChanged in version 3.6: Line numbers can be decreasing.  Before,\nthey were always increasing.\n\nChanged in version 3.10: The PEP 626(1) *note colines(): 5a0.\nmethod is used instead of the *note cofirstlineno: 1c48. and *note\ncolnotab: 244. attributes of the *note code object: 59f.\n\n-- Function: dis.findlabels (code)\n\nDetect all offsets in the raw compiled bytecode string 'code' which\nare jump targets, and return a list of these offsets.\n\n-- Function: dis.stackeffect (opcode, oparg=None, *, jump=None)\n\nCompute the stack effect of 'opcode' with argument 'oparg'.\n\nIf the code has a jump target and 'jump' is 'True', *note\nstackeffect(): da1. will return the stack effect of jumping.  If\n'jump' is 'False', it will return the stack effect of not jumping.\nAnd if 'jump' is 'None' (default), it will return the maximal stack\neffect of both cases.\n\nNew in version 3.4.\n\nChanged in version 3.8: Added 'jump' parameter.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0626/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python Bytecode Instructions,  Next: Opcode collections,  Prev: Analysis functions,  Up: dis -- Disassembler for Python bytecode": {
            "content": "5.32.10.4 Python Bytecode Instructions\n......................................\n\nThe *note getinstructions(): d9d. function and *note Bytecode: d9e.\nclass provide details of bytecode instructions as *note Instruction:\nd9c. instances:\n\n-- Class: dis.Instruction\n\nDetails for a bytecode operation\n\n-- Data: opcode\n\nnumeric code for operation, corresponding to the opcode values\nlisted below and the bytecode values in the *note Opcode\ncollections: 438c.\n\n-- Data: opname\n\nhuman readable name for operation\n\n-- Data: arg\n\nnumeric argument to operation (if any), otherwise 'None'\n\n-- Data: argval\n\nresolved arg value (if any), otherwise 'None'\n\n-- Data: argrepr\n\nhuman readable description of operation argument (if any),\notherwise an empty string.\n\n-- Data: offset\n\nstart index of operation within bytecode sequence\n\n-- Data: startsline\n\nline started by this opcode (if any), otherwise 'None'\n\n-- Data: isjumptarget\n\n'True' if other code jumps to here, otherwise 'False'\n\n-- Data: positions\n\n*note dis.Positions: 412c. object holding the start and end\nlocations that are covered by this instruction.\n\nNew in version 3.4.\n\nChanged in version 3.11: Field 'positions' is added.\n\n-- Class: dis.Positions\n\nIn case the information is not available, some fields might be\n'None'.\n\n-- Data: lineno\n\n-- Data: endlineno\n\n-- Data: coloffset\n\n-- Data: endcoloffset\n\nNew in version 3.11.\n",
            "subsections": []
        },
        "The Python compiler currently generates the following bytecode": {
            "content": "instructions.\n\n'General instructions'\n",
            "subsections": []
        },
        "In the following, We will refer to the interpreter stack as 'STACK' and": {
            "content": "describe operations on it as if it was a Python list.  The top of the\nstack corresponds to 'STACK[-1]' in this language.\n\n-- Opcode: NOP\n\nDo nothing code.  Used as a placeholder by the bytecode optimizer,\nand to generate line tracing events.\n\n-- Opcode: POPTOP\n\nRemoves the top-of-stack item:\n\nSTACK.pop()\n\n-- Opcode: ENDFOR\n\nRemoves the top two values from the stack.  Equivalent to\n'POPTOP'; 'POPTOP'.  Used to clean up at the end of loops, hence\nthe name.\n\nNew in version 3.12.\n\n-- Opcode: ENDSEND\n\nImplements 'del STACK[-2]'.  Used to clean up when a generator\nexits.\n\nNew in version 3.12.\n\n-- Opcode: COPY (i)\n\nPush the i-th item to the top of the stack without removing it from\nits original location:\n\nassert i > 0\nSTACK.append(STACK[-i])\n\nNew in version 3.11.\n\n-- Opcode: SWAP (i)\n\nSwap the top of the stack with the i-th element:\n\nSTACK[-i], STACK[-1] = STACK[-1], STACK[-i]\n\nNew in version 3.11.\n\n-- Opcode: CACHE\n\nRather than being an actual instruction, this opcode is used to\nmark extra space for the interpreter to cache useful data directly\nin the bytecode itself.  It is automatically hidden by all 'dis'\nutilities, but can be viewed with 'showcaches=True'.\n\nLogically, this space is part of the preceding instruction.  Many\nopcodes expect to be followed by an exact number of caches, and\nwill instruct the interpreter to skip over them at runtime.\n\nPopulated caches can look like arbitrary instructions, so great\ncare should be taken when reading or modifying raw, adaptive\nbytecode containing quickened data.\n\nNew in version 3.11.\n\n'Unary operations'\n",
            "subsections": []
        },
        "Unary operations take the top of the stack, apply the operation, and": {
            "content": "push the result back on the stack.\n\n-- Opcode: UNARYNEGATIVE\n\nImplements 'STACK[-1] = -STACK[-1]'.\n\n-- Opcode: UNARYNOT\n\nImplements 'STACK[-1] = not STACK[-1]'.\n\n-- Opcode: UNARYINVERT\n\nImplements 'STACK[-1] = ~STACK[-1]'.\n\n-- Opcode: GETITER\n\nImplements 'STACK[-1] = iter(STACK[-1])'.\n\n-- Opcode: GETYIELDFROMITER\n\nIf 'STACK[-1]' is a *note generator iterator: a22. or *note\ncoroutine: 1ae. object it is left as is.  Otherwise, implements\n'STACK[-1] = iter(STACK[-1])'.\n\nNew in version 3.5.\n\n'Binary and in-place operations'\n\nBinary operations remove the top two items from the stack ('STACK[-1]'\nand 'STACK[-2]').  They perform the operation, then put the result back\non the stack.\n",
            "subsections": []
        },
        "In-place operations are like binary operations, but the operation is": {
            "content": "done in-place when 'STACK[-2]' supports it, and the resulting\n'STACK[-1]' may be (but does not have to be) the original 'STACK[-2]'.\n\n-- Opcode: BINARYOP (op)\n\nImplements the binary and in-place operators (depending on the\nvalue of 'op'):\n\nrhs = STACK.pop()\nlhs = STACK.pop()\nSTACK.append(lhs op rhs)\n\nNew in version 3.11.\n\n-- Opcode: BINARYSUBSCR\n\nImplements:\n\nkey = STACK.pop()\ncontainer = STACK.pop()\nSTACK.append(container[key])\n\n-- Opcode: STORESUBSCR\n\nImplements:\n\nkey = STACK.pop()\ncontainer = STACK.pop()\nvalue = STACK.pop()\ncontainer[key] = value\n\n-- Opcode: DELETESUBSCR\n\nImplements:\n\nkey = STACK.pop()\ncontainer = STACK.pop()\ndel container[key]\n\n-- Opcode: BINARYSLICE\n\nImplements:\n\nend = STACK.pop()\nstart = STACK.pop()\ncontainer = STACK.pop()\nSTACK.append(container[start:end])\n\nNew in version 3.12.\n\n-- Opcode: STORESLICE\n\nImplements:\n\nend = STACK.pop()\nstart = STACK.pop()\ncontainer = STACK.pop()\nvalues = STACK.pop()\ncontainer[start:end] = value\n\nNew in version 3.12.\n\n'Coroutine opcodes'\n\n-- Opcode: GETAWAITABLE (where)\n\nImplements 'STACK[-1] = getawaitable(STACK[-1])', where\n'getawaitable(o)' returns 'o' if 'o' is a coroutine object or a\ngenerator object with the *note COITERABLECOROUTINE: 413d. flag,\nor resolves 'o.await'.\n\nIf the 'where' operand is nonzero, it indicates where the\ninstruction occurs:\n\n* '1': After a call to 'aenter'\n\n* '2': After a call to 'aexit'\n\nNew in version 3.5.\n\nChanged in version 3.11: Previously, this instruction did not have\nan oparg.\n\n-- Opcode: GETAITER\n\nImplements 'STACK[-1] = STACK[-1].aiter()'.\n\nNew in version 3.5.\n\nChanged in version 3.7: Returning awaitable objects from\n'aiter' is no longer supported.\n\n-- Opcode: GETANEXT\n\nImplement 'STACK.append(getawaitable(STACK[-1].anext()))' to\nthe stack.  See 'GETAWAITABLE' for details about 'getawaitable'.\n\nNew in version 3.5.\n\n-- Opcode: ENDASYNCFOR\n\nTerminates an *note async for: 8e0. loop.  Handles an exception\nraised when awaiting a next item.  The stack contains the async\niterable in 'STACK[-2]' and the raised exception in 'STACK[-1]'.\nBoth are popped.  If the exception is not *note StopAsyncIteration:\n17a6, it is re-raised.\n\nNew in version 3.8.\n\nChanged in version 3.11: Exception representation on the stack now\nconsist of one, not three, items.\n\n-- Opcode: CLEANUPTHROW\n\nHandles an exception raised during a *note throw(): 241. or *note\nclose(): 1517. call through the current frame.  If 'STACK[-1]' is\nan instance of *note StopIteration: a40, pop three values from the\nstack and push its 'value' member.  Otherwise, re-raise\n'STACK[-1]'.\n\nNew in version 3.12.\n\n-- Opcode: BEFOREASYNCWITH\n\nResolves 'aenter' and 'aexit' from 'STACK[-1]'.  Pushes\n'aexit' and result of 'aenter()' to the stack:\n\nSTACK.extend((aexit, aenter())\n\nNew in version 3.5.\n\n'Miscellaneous opcodes'\n\n-- Opcode: SETADD (i)\n\nImplements:\n\nitem = STACK.pop()\nset.add(STACK[-i], item)\n\nUsed to implement set comprehensions.\n\n-- Opcode: LISTAPPEND (i)\n\nImplements:\n\nitem = STACK.pop()\nlist.append(STACK[-i], item)\n\nUsed to implement list comprehensions.\n\n-- Opcode: MAPADD (i)\n\nImplements:\n\nvalue = STACK.pop()\nkey = STACK.pop()\ndict.setitem(STACK[-i], key, value)\n\nUsed to implement dict comprehensions.\n\nNew in version 3.1.\n\nChanged in version 3.8: Map value is 'STACK[-1]' and map key is\n'STACK[-2]'.  Before, those were reversed.\n\nFor all of the *note SETADD: 43a6, *note LISTAPPEND: 43a7. and *note\nMAPADD: 8e1. instructions, while the added value or key/value pair is\npopped off, the container object remains on the stack so that it is\navailable for further iterations of the loop.\n\n-- Opcode: RETURNVALUE\n\nReturns with 'STACK[-1]' to the caller of the function.\n\n-- Opcode: RETURNCONST (consti)\n\nReturns with 'coconsts[consti]' to the caller of the function.\n\nNew in version 3.12.\n\n-- Opcode: YIELDVALUE\n\nYields 'STACK.pop()' from a *note generator: eda.\n\nChanged in version 3.11: oparg set to be the stack depth.\n\nChanged in version 3.12: oparg set to be the exception block depth,\nfor efficient closing of generators.\n\n-- Opcode: SETUPANNOTATIONS\n\nChecks whether 'annotations' is defined in 'locals()', if not\nit is set up to an empty 'dict'.  This opcode is only emitted if a\nclass or module body contains *note variable annotations: bb0.\nstatically.\n\nNew in version 3.6.\n\n-- Opcode: POPEXCEPT\n\nPops a value from the stack, which is used to restore the exception\nstate.\n\nChanged in version 3.11: Exception representation on the stack now\nconsist of one, not three, items.\n\n-- Opcode: RERAISE\n\nRe-raises the exception currently on top of the stack.  If oparg is\nnon-zero, pops an additional value from the stack which is used to\nset *note flasti: 696. of the current frame.\n\nNew in version 3.9.\n\nChanged in version 3.11: Exception representation on the stack now\nconsist of one, not three, items.\n\n-- Opcode: PUSHEXCINFO\n\nPops a value from the stack.  Pushes the current exception to the\ntop of the stack.  Pushes the value originally popped back to the\nstack.  Used in exception handlers.\n\nNew in version 3.11.\n\n-- Opcode: CHECKEXCMATCH\n\nPerforms exception matching for 'except'.  Tests whether the\n'STACK[-2]' is an exception matching 'STACK[-1]'.  Pops 'STACK[-1]'\nand pushes the boolean result of the test.\n\nNew in version 3.11.\n\n-- Opcode: CHECKEGMATCH\n\nPerforms exception matching for 'except*'.  Applies\n'split(STACK[-1])' on the exception group representing 'STACK[-2]'.\n\nIn case of a match, pops two items from the stack and pushes the\nnon-matching subgroup ('None' in case of full match) followed by\nthe matching subgroup.  When there is no match, pops one item (the\nmatch type) and pushes 'None'.\n\nNew in version 3.11.\n\n-- Opcode: WITHEXCEPTSTART\n\nCalls the function in position 4 on the stack with arguments (type,\nval, tb) representing the exception at the top of the stack.  Used\nto implement the call 'contextmanager.exit(*excinfo())' when\nan exception has occurred in a *note with: 396. statement.\n\nNew in version 3.9.\n\nChanged in version 3.11: The 'exit' function is in position 4\nof the stack rather than 7.  Exception representation on the stack\nnow consist of one, not three, items.\n\n-- Opcode: LOADASSERTIONERROR\n\nPushes *note AssertionError: 476. onto the stack.  Used by the\n*note assert: 78a. statement.\n\nNew in version 3.9.\n\n-- Opcode: LOADBUILDCLASS\n\nPushes 'builtins.buildclass()' onto the stack.  It is later\ncalled to construct a class.\n\n-- Opcode: BEFOREWITH\n\nThis opcode performs several operations before a with block starts.\nFirst, it loads *note exit(): 1175. from the context manager\nand pushes it onto the stack for later use by *note\nWITHEXCEPTSTART: 43aa.  Then, *note enter(): 389. is called.\nFinally, the result of calling the 'enter()' method is pushed\nonto the stack.\n\nNew in version 3.11.\n\n-- Opcode: GETLEN\n\nPerform 'STACK.append(len(STACK[-1]))'.\n\nNew in version 3.10.\n\n-- Opcode: MATCHMAPPING\n\nIf 'STACK[-1]' is an instance of *note collections.abc.Mapping:\n6e2. (or, more technically: if it has the *note PyTPFLAGSMAPPING:\n1605. flag set in its *note tpflags: 1620.), push 'True' onto the\nstack.  Otherwise, push 'False'.\n\nNew in version 3.10.\n\n-- Opcode: MATCHSEQUENCE\n\nIf 'STACK[-1]' is an instance of *note collections.abc.Sequence:\n1038. and is 'not' an instance of *note str: 157./*note bytes:\n295./*note bytearray: 294. (or, more technically: if it has the\n*note PyTPFLAGSSEQUENCE: 1606. flag set in its *note tpflags:\n1620.), push 'True' onto the stack.  Otherwise, push 'False'.\n\nNew in version 3.10.\n\n-- Opcode: MATCHKEYS\n\n'STACK[-1]' is a tuple of mapping keys, and 'STACK[-2]' is the\nmatch subject.  If 'STACK[-2]' contains all of the keys in\n'STACK[-1]', push a *note tuple: 4b8. containing the corresponding\nvalues.  Otherwise, push 'None'.\n\nNew in version 3.10.\n\nChanged in version 3.11: Previously, this instruction also pushed a\nboolean value indicating success ('True') or failure ('False').\n\n-- Opcode: STORENAME (namei)\n\nImplements 'name = STACK.pop()'.  'namei' is the index of 'name' in\nthe attribute *note conames: 1c47. of the *note code object: 59f.\nThe compiler tries to use *note STOREFAST: 43b0. or *note\nSTOREGLOBAL: 43b1. if possible.\n\n-- Opcode: DELETENAME (namei)\n\nImplements 'del name', where 'namei' is the index into *note\nconames: 1c47. attribute of the *note code object: 59f.\n\n-- Opcode: UNPACKSEQUENCE (count)\n\nUnpacks 'STACK[-1]' into 'count' individual values, which are put\nonto the stack right-to-left.  Require there to be exactly 'count'\nvalues.:\n\nassert(len(STACK[-1]) == count)\nSTACK.extend(STACK.pop()[:-count-1:-1])\n\n-- Opcode: UNPACKEX (counts)\n\nImplements assignment with a starred target: Unpacks an iterable in\n'STACK[-1]' into individual values, where the total number of\nvalues can be smaller than the number of items in the iterable: one\nof the new values will be a list of all leftover items.\n\nThe number of values before and after the list value is limited to\n255.\n\nThe number of values before the list value is encoded in the\nargument of the opcode.  The number of values after the list if any\nis encoded using an 'EXTENDEDARG'.  As a consequence, the argument\ncan be seen as a two bytes values where the low byte of 'counts' is\nthe number of values before the list value, the high byte of\n'counts' the number of values after it.\n\nThe extracted values are put onto the stack right-to-left, i.e.\n'a, *b, c = d' will be stored after execution as 'STACK.extend((a,\nb, c))'.\n\n-- Opcode: STOREATTR (namei)\n\nImplements:\n\nobj = STACK.pop()\nvalue = STACK.pop()\nobj.name = value\n\nwhere 'namei' is the index of name in *note conames: 1c47. of the\n*note code object: 59f.\n\n-- Opcode: DELETEATTR (namei)\n\nImplements:\n\nobj = STACK.pop()\ndel obj.name\n\nwhere 'namei' is the index of name into *note conames: 1c47. of\nthe *note code object: 59f.\n\n-- Opcode: STOREGLOBAL (namei)\n\nWorks as *note STORENAME: 43af, but stores the name as a global.\n\n-- Opcode: DELETEGLOBAL (namei)\n\nWorks as *note DELETENAME: 43b2, but deletes a global name.\n\n-- Opcode: LOADCONST (consti)\n\nPushes 'coconsts[consti]' onto the stack.\n\n-- Opcode: LOADNAME (namei)\n\nPushes the value associated with 'conames[namei]' onto the stack.\nThe name is looked up within the locals, then the globals, then the\nbuiltins.\n\n-- Opcode: LOADLOCALS\n\nPushes a reference to the locals dictionary onto the stack.  This\nis used to prepare namespace dictionaries for *note\nLOADFROMDICTORDEREF: 20f. and *note LOADFROMDICTORGLOBALS:\n210.\n\nNew in version 3.12.\n\n-- Opcode: LOADFROMDICTORGLOBALS (i)\n\nPops a mapping off the stack and looks up the value for\n'conames[namei]'.  If the name is not found there, looks it up in\nthe globals and then the builtins, similar to *note LOADGLOBAL:\n148a.  This is used for loading global variables in *note\nannotation scopes: 167. within class bodies.\n\nNew in version 3.12.\n\n-- Opcode: BUILDTUPLE (count)\n\nCreates a tuple consuming 'count' items from the stack, and pushes\nthe resulting tuple onto the stack.:\n\nassert count > 0\nSTACK, values = STACK[:-count], STACK[-count:]\nSTACK.append(tuple(values))\n\n-- Opcode: BUILDLIST (count)\n\nWorks as *note BUILDTUPLE: 43b8, but creates a list.\n\n-- Opcode: BUILDSET (count)\n\nWorks as *note BUILDTUPLE: 43b8, but creates a set.\n\n-- Opcode: BUILDMAP (count)\n\nPushes a new dictionary object onto the stack.  Pops '2 * count'\nitems so that the dictionary holds 'count' entries: '{...,\nSTACK[-4]: STACK[-3], STACK[-2]: STACK[-1]}'.\n\nChanged in version 3.5: The dictionary is created from stack items\ninstead of creating an empty dictionary pre-sized to hold 'count'\nitems.\n\n-- Opcode: BUILDCONSTKEYMAP (count)\n\nThe version of *note BUILDMAP: 13e4. specialized for constant\nkeys.  Pops the top element on the stack which contains a tuple of\nkeys, then starting from 'STACK[-2]', pops 'count' values to form\nvalues in the built dictionary.\n\nNew in version 3.6.\n\n-- Opcode: BUILDSTRING (count)\n\nConcatenates 'count' strings from the stack and pushes the\nresulting string onto the stack.\n\nNew in version 3.6.\n\n-- Opcode: LISTEXTEND (i)\n\nImplements:\n\nseq = STACK.pop()\nlist.extend(STACK[-i], seq)\n\nUsed to build lists.\n\nNew in version 3.9.\n\n-- Opcode: SETUPDATE (i)\n\nImplements:\n\nseq = STACK.pop()\nset.update(STACK[-i], seq)\n\nUsed to build sets.\n\nNew in version 3.9.\n\n-- Opcode: DICTUPDATE (i)\n\nImplements:\n\nmap = STACK.pop()\ndict.update(STACK[-i], map)\n\nUsed to build dicts.\n\nNew in version 3.9.\n\n-- Opcode: DICTMERGE (i)\n\nLike *note DICTUPDATE: 43bd. but raises an exception for duplicate\nkeys.\n\nNew in version 3.9.\n\n-- Opcode: LOADATTR (namei)\n\nIf the low bit of 'namei' is not set, this replaces 'STACK[-1]'\nwith 'getattr(STACK[-1], conames[namei>>1])'.\n\nIf the low bit of 'namei' is set, this will attempt to load a\nmethod named 'conames[namei>>1]' from the 'STACK[-1]' object.\n'STACK[-1]' is popped.  This bytecode distinguishes two cases: if\n'STACK[-1]' has a method with the correct name, the bytecode pushes\nthe unbound method and 'STACK[-1]'.  'STACK[-1]' will be used as\nthe first argument ('self') by *note CALL: 4db. when calling the\nunbound method.  Otherwise, 'NULL' and the object returned by the\nattribute lookup are pushed.\n\nChanged in version 3.12: If the low bit of 'namei' is set, then a\n'NULL' or 'self' is pushed to the stack before the attribute or\nunbound method respectively.\n\n-- Opcode: LOADSUPERATTR (namei)\n\nThis opcode implements *note super(): 204, both in its\nzero-argument and two-argument forms (e.g.  'super().method()',\n'super().attr' and 'super(cls, self).method()', 'super(cls,\nself).attr').\n\nIt pops three values from the stack (from top of stack down): -\n'self': the first argument to the current method - 'cls': the class\nwithin which the current method was defined - the global 'super'\n\nWith respect to its argument, it works similarly to *note\nLOADATTR: 207, except that 'namei' is shifted left by 2 bits\ninstead of 1.\n\nThe low bit of 'namei' signals to attempt a method load, as with\n*note LOADATTR: 207, which results in pushing 'NULL' and the\nloaded method.  When it is unset a single value is pushed to the\nstack.\n\nThe second-low bit of 'namei', if set, means that this was a\ntwo-argument call to *note super(): 204. (unset means\nzero-argument).\n\nNew in version 3.12.\n\n-- Opcode: COMPAREOP (opname)\n\nPerforms a Boolean operation.  The operation name can be found in\n'cmpop[opname]'.\n\n-- Opcode: ISOP (invert)\n\nPerforms 'is' comparison, or 'is not' if 'invert' is 1.\n\nNew in version 3.9.\n\n-- Opcode: CONTAINSOP (invert)\n\nPerforms 'in' comparison, or 'not in' if 'invert' is 1.\n\nNew in version 3.9.\n\n-- Opcode: IMPORTNAME (namei)\n\nImports the module 'conames[namei]'.  'STACK[-1]' and 'STACK[-2]'\nare popped and provide the 'fromlist' and 'level' arguments of\n*note import(): 6ed.  The module object is pushed onto the\nstack.  The current namespace is not affected: for a proper import\nstatement, a subsequent *note STOREFAST: 43b0. instruction\nmodifies the namespace.\n\n-- Opcode: IMPORTFROM (namei)\n\nLoads the attribute 'conames[namei]' from the module found in\n'STACK[-1]'.  The resulting object is pushed onto the stack, to be\nsubsequently stored by a *note STOREFAST: 43b0. instruction.\n\n-- Opcode: JUMPFORWARD (delta)\n\nIncrements bytecode counter by 'delta'.\n\n-- Opcode: JUMPBACKWARD (delta)\n\nDecrements bytecode counter by 'delta'.  Checks for interrupts.\n\nNew in version 3.11.\n\n-- Opcode: JUMPBACKWARDNOINTERRUPT (delta)\n\nDecrements bytecode counter by 'delta'.  Does not check for\ninterrupts.\n\nNew in version 3.11.\n\n-- Opcode: POPJUMPIFTRUE (delta)\n\nIf 'STACK[-1]' is true, increments the bytecode counter by 'delta'.\n'STACK[-1]' is popped.\n\nChanged in version 3.11: The oparg is now a relative delta rather\nthan an absolute target.  This opcode is a pseudo-instruction,\nreplaced in final bytecode by the directed versions\n(forward/backward).\n\nChanged in version 3.12: This is no longer a pseudo-instruction.\n\n-- Opcode: POPJUMPIFFALSE (delta)\n\nIf 'STACK[-1]' is false, increments the bytecode counter by\n'delta'.  'STACK[-1]' is popped.\n\nChanged in version 3.11: The oparg is now a relative delta rather\nthan an absolute target.  This opcode is a pseudo-instruction,\nreplaced in final bytecode by the directed versions\n(forward/backward).\n\nChanged in version 3.12: This is no longer a pseudo-instruction.\n\n-- Opcode: POPJUMPIFNOTNONE (delta)\n\nIf 'STACK[-1]' is not 'None', increments the bytecode counter by\n'delta'.  'STACK[-1]' is popped.\n\nThis opcode is a pseudo-instruction, replaced in final bytecode by\nthe directed versions (forward/backward).\n\nNew in version 3.11.\n\nChanged in version 3.12: This is no longer a pseudo-instruction.\n\n-- Opcode: POPJUMPIFNONE (delta)\n\nIf 'STACK[-1]' is 'None', increments the bytecode counter by\n'delta'.  'STACK[-1]' is popped.\n\nThis opcode is a pseudo-instruction, replaced in final bytecode by\nthe directed versions (forward/backward).\n\nNew in version 3.11.\n\nChanged in version 3.12: This is no longer a pseudo-instruction.\n\n-- Opcode: FORITER (delta)\n\n'STACK[-1]' is an *note iterator: 16a9.  Call its *note next():\n1141. method.  If this yields a new value, push it on the stack\n(leaving the iterator below it).  If the iterator indicates it is\nexhausted then the byte code counter is incremented by 'delta'.\n\nChanged in version 3.12: Up until 3.11 the iterator was popped when\nit was exhausted.\n\n-- Opcode: LOADGLOBAL (namei)\n\nLoads the global named 'conames[namei>>1]' onto the stack.\n\nChanged in version 3.11: If the low bit of 'namei' is set, then a\n'NULL' is pushed to the stack before the global variable.\n\n-- Opcode: LOADFAST (varnum)\n\nPushes a reference to the local 'covarnames[varnum]' onto the\nstack.\n\nChanged in version 3.12: This opcode is now only used in situations\nwhere the local variable is guaranteed to be initialized.  It\ncannot raise *note UnboundLocalError: 1390.\n\n-- Opcode: LOADFASTCHECK (varnum)\n\nPushes a reference to the local 'covarnames[varnum]' onto the\nstack, raising an *note UnboundLocalError: 1390. if the local\nvariable has not been initialized.\n\nNew in version 3.12.\n\n-- Opcode: LOADFASTANDCLEAR (varnum)\n\nPushes a reference to the local 'covarnames[varnum]' onto the\nstack (or pushes 'NULL' onto the stack if the local variable has\nnot been initialized) and sets 'covarnames[varnum]' to 'NULL'.\n\nNew in version 3.12.\n\n-- Opcode: STOREFAST (varnum)\n\nStores 'STACK.pop()' into the local 'covarnames[varnum]'.\n\n-- Opcode: DELETEFAST (varnum)\n\nDeletes local 'covarnames[varnum]'.\n\n-- Opcode: MAKECELL (i)\n\nCreates a new cell in slot 'i'.  If that slot is nonempty then that\nvalue is stored into the new cell.\n\nNew in version 3.11.\n\n-- Opcode: LOADCLOSURE (i)\n\nPushes a reference to the cell contained in slot 'i' of the \"fast\nlocals\" storage.  The name of the variable is\n'cofastlocalnames[i]'.\n\nNote that 'LOADCLOSURE' is effectively an alias for 'LOADFAST'.\nIt exists to keep bytecode a little more readable.\n\nChanged in version 3.11: 'i' is no longer offset by the length of\n'covarnames'.\n\n-- Opcode: LOADDEREF (i)\n\nLoads the cell contained in slot 'i' of the \"fast locals\" storage.\nPushes a reference to the object the cell contains on the stack.\n\nChanged in version 3.11: 'i' is no longer offset by the length of\n*note covarnames: 1c42.\n\n-- Opcode: LOADFROMDICTORDEREF (i)\n\nPops a mapping off the stack and looks up the name associated with\nslot 'i' of the \"fast locals\" storage in this mapping.  If the name\nis not found there, loads it from the cell contained in slot 'i',\nsimilar to *note LOADDEREF: 43c7.  This is used for loading free\nvariables in class bodies (which previously used 'LOADCLASSDEREF')\nand in *note annotation scopes: 167. within class bodies.\n\nNew in version 3.12.\n\n-- Opcode: STOREDEREF (i)\n\nStores 'STACK.pop()' into the cell contained in slot 'i' of the\n\"fast locals\" storage.\n\nChanged in version 3.11: 'i' is no longer offset by the length of\n*note covarnames: 1c42.\n\n-- Opcode: DELETEDEREF (i)\n\nEmpties the cell contained in slot 'i' of the \"fast locals\"\nstorage.  Used by the *note del: 14fb. statement.\n\nNew in version 3.2.\n\nChanged in version 3.11: 'i' is no longer offset by the length of\n*note covarnames: 1c42.\n\n-- Opcode: COPYFREEVARS (n)\n\nCopies the 'n' free variables from the closure into the frame.\nRemoves the need for special code on the caller's side when calling\nclosures.\n\nNew in version 3.11.\n\n-- Opcode: RAISEVARARGS (argc)\n\nRaises an exception using one of the 3 forms of the 'raise'\nstatement, depending on the value of 'argc':\n\n* 0: 'raise' (re-raise previous exception)\n\n* 1: 'raise STACK[-1]' (raise exception instance or type at\n'STACK[-1]')\n\n* 2: 'raise STACK[-2] from STACK[-1]' (raise exception instance\nor type at 'STACK[-2]' with 'cause' set to 'STACK[-1]')\n\n-- Opcode: CALL (argc)\n\nCalls a callable object with the number of arguments specified by\n'argc', including the named arguments specified by the preceding\n*note KWNAMES: 146b, if any.  On the stack are (in ascending\norder), either:\n\n* NULL\n\n* The callable\n\n* The positional arguments\n\n* The named arguments\n\nor:\n\n* The callable\n\n* 'self'\n\n* The remaining positional arguments\n\n* The named arguments\n\n'argc' is the total of the positional and named arguments,\nexcluding 'self' when a 'NULL' is not present.\n\n'CALL' pops all arguments and the callable object off the stack,\ncalls the callable object with those arguments, and pushes the\nreturn value returned by the callable object.\n\nNew in version 3.11.\n\n-- Opcode: CALLFUNCTIONEX (flags)\n\nCalls a callable object with variable set of positional and keyword\narguments.  If the lowest bit of 'flags' is set, the top of the\nstack contains a mapping object containing additional keyword\narguments.  Before the callable is called, the mapping object and\niterable object are each \"unpacked\" and their contents passed in as\nkeyword and positional arguments respectively.  'CALLFUNCTIONEX'\npops all arguments and the callable object off the stack, calls the\ncallable object with those arguments, and pushes the return value\nreturned by the callable object.\n\nNew in version 3.6.\n\n-- Opcode: PUSHNULL\n\nPushes a 'NULL' to the stack.  Used in the call sequence to match\nthe 'NULL' pushed by *note LOADMETHOD: a65. for non-method calls.\n\nNew in version 3.11.\n\n-- Opcode: KWNAMES (consti)\n\nPrefixes *note CALL: 4db.  Stores a reference to\n'coconsts[consti]' into an internal variable for use by *note\nCALL: 4db.  'coconsts[consti]' must be a tuple of strings.\n\nNew in version 3.11.\n\n-- Opcode: MAKEFUNCTION (flags)\n\nPushes a new function object on the stack.  From bottom to top, the\nconsumed stack must consist of values if the argument carries a\nspecified flag value\n\n* '0x01' a tuple of default values for positional-only and\npositional-or-keyword parameters in positional order\n\n* '0x02' a dictionary of keyword-only parameters' default values\n\n* '0x04' a tuple of strings containing parameters' annotations\n\n* '0x08' a tuple containing cells for free variables, making a\nclosure\n\n* the code associated with the function (at 'STACK[-1]')\n\nChanged in version 3.10: Flag value '0x04' is a tuple of strings\ninstead of dictionary\n\nChanged in version 3.11: Qualified name at 'STACK[-1]' was removed.\n\n-- Opcode: BUILDSLICE (argc)\n\nPushes a slice object on the stack.  'argc' must be 2 or 3.  If it\nis 2, implements:\n\nend = STACK.pop()\nstart = STACK.pop()\nSTACK.append(slice(start, stop))\n\nif it is 3, implements:\n\nstep = STACK.pop()\nend = STACK.pop()\nstart = STACK.pop()\nSTACK.append(slice(start, end, step))\n\nSee the *note slice(): 180. built-in function for more information.\n\n-- Opcode: EXTENDEDARG (ext)\n\nPrefixes any opcode which has an argument too big to fit into the\ndefault one byte.  'ext' holds an additional byte which act as\nhigher bits in the argument.  For each opcode, at most three\nprefixal 'EXTENDEDARG' are allowed, forming an argument from\ntwo-byte to four-byte.\n\n-- Opcode: FORMATVALUE (flags)\n\nUsed for implementing formatted literal strings (f-strings).  Pops\nan optional 'fmtspec' from the stack, then a required 'value'.\n'flags' is interpreted as follows:\n\n* '(flags & 0x03) == 0x00': 'value' is formatted as-is.\n\n* '(flags & 0x03) == 0x01': call *note str(): 157. on 'value'\nbefore formatting it.\n\n* '(flags & 0x03) == 0x02': call *note repr(): 5f0. on 'value'\nbefore formatting it.\n\n* '(flags & 0x03) == 0x03': call *note ascii(): 123b. on 'value'\nbefore formatting it.\n\n* '(flags & 0x04) == 0x04': pop 'fmtspec' from the stack and\nuse it, else use an empty 'fmtspec'.\n\nFormatting is performed using *note PyObjectFormat(): 43cc.  The\nresult is pushed on the stack.\n\nNew in version 3.6.\n\n-- Opcode: MATCHCLASS (count)\n\n'STACK[-1]' is a tuple of keyword attribute names, 'STACK[-2]' is\nthe class being matched against, and 'STACK[-3]' is the match\nsubject.  'count' is the number of positional sub-patterns.\n\nPop 'STACK[-1]', 'STACK[-2]', and 'STACK[-3]'.  If 'STACK[-3]' is\nan instance of 'STACK[-2]' and has the positional and keyword\nattributes required by 'count' and 'STACK[-1]', push a tuple of\nextracted attributes.  Otherwise, push 'None'.\n\nNew in version 3.10.\n\nChanged in version 3.11: Previously, this instruction also pushed a\nboolean value indicating success ('True') or failure ('False').\n\n-- Opcode: RESUME (where)\n\nA no-op.  Performs internal tracing, debugging and optimization\nchecks.\n\nThe 'where' operand marks where the 'RESUME' occurs:\n\n* '0' The start of a function, which is neither a generator,\ncoroutine nor an async generator\n\n* '1' After a 'yield' expression\n\n* '2' After a 'yield from' expression\n\n* '3' After an 'await' expression\n\nNew in version 3.11.\n\n-- Opcode: RETURNGENERATOR\n\nCreate a generator, coroutine, or async generator from the current\nframe.  Used as first opcode of in code object for the above\nmentioned callables.  Clear the current frame and return the newly\ncreated generator.\n\nNew in version 3.11.\n\n-- Opcode: SEND (delta)\n\nEquivalent to 'STACK[-1] = STACK[-2].send(STACK[-1])'.  Used in\n'yield from' and 'await' statements.\n\nIf the call raises *note StopIteration: a40, pop the top value from\nthe stack, push the exception's 'value' attribute, and increment\nthe bytecode counter by 'delta'.\n\nNew in version 3.11.\n\n-- Opcode: HAVEARGUMENT\n\nThis is not really an opcode.  It identifies the dividing line\nbetween opcodes in the range [0,255] which don't use their argument\nand those that do ('< HAVEARGUMENT' and '>= HAVEARGUMENT',\nrespectively).\n\nIf your application uses pseudo instructions, use the *note hasarg:\n1a5. collection instead.\n\nChanged in version 3.6: Now every instruction has an argument, but\nopcodes '< HAVEARGUMENT' ignore it.  Before, only opcodes '>=\nHAVEARGUMENT' had an argument.\n\nChanged in version 3.12: Pseudo instructions were added to the\n*note dis: 35. module, and for them it is not true that comparison\nwith 'HAVEARGUMENT' indicates whether they use their arg.\n\n-- Opcode: CALLINTRINSIC1\n\nCalls an intrinsic function with one argument.  Passes 'STACK[-1]'\nas the argument and sets 'STACK[-1]' to the result.  Used to\nimplement functionality that is not performance critical.\n\nThe operand determines which intrinsic function is called:\n\nOperand                                 Description\n\n--------------------------------------------------------------------------------\n\n'INTRINSIC1INVALID'                   Not valid\n\n\n'INTRINSICPRINT'                       Prints the argument to standard out.\nUsed in the REPL.\n\n\n'INTRINSICIMPORTSTAR'                 Performs 'import *' for the named\nmodule.\n\n\n'INTRINSICSTOPITERATIONERROR'         Extracts the return value from a\n'StopIteration' exception.\n\n\n'INTRINSICASYNCGENWRAP'              Wraps an aync generator value\n\n\n'INTRINSICUNARYPOSITIVE'              Performs the unary '+' operation\n\n\n'INTRINSICLISTTOTUPLE'               Converts a list to a tuple\n\n\n'INTRINSICTYPEVAR'                     Creates a *note typing.TypeVar: 164.\n\n\n'INTRINSICPARAMSPEC'                   Creates a\n*note typing.ParamSpec: 163.\n\n\n'INTRINSICTYPEVARTUPLE'                Creates a\n*note typing.TypeVarTuple: 162.\n\n\n'INTRINSICSUBSCRIPTGENERIC'           Returns *note typing.Generic: 1453.\nsubscripted with the argument\n\n\n'INTRINSICTYPEALIAS'                   Creates a\n*note typing.TypeAliasType: 160.;\nused in the *note type: 13a.\nstatement.  The argument is a tuple\nof the type alias's name, type\nparameters, and value.\n\n\nNew in version 3.12.\n\n-- Opcode: CALLINTRINSIC2\n\nCalls an intrinsic function with two arguments.  Used to implement\nfunctionality that is not performance critical:\n\narg2 = STACK.pop()\narg1 = STACK.pop()\nresult = intrinsic2(arg1, arg2)\nSTACK.push(result)\n\nThe operand determines which intrinsic function is called:\n\nOperand                                      Description\n\n-------------------------------------------------------------------------------------\n\n'INTRINSIC2INVALID'                        Not valid\n\n\n'INTRINSICPREPRERAISESTAR'                Calculates the\n*note ExceptionGroup: 17b. to raise\nfrom a 'try-except*'.\n\n\n'INTRINSICTYPEVARWITHBOUND'               Creates a *note typing.TypeVar: 164.\nwith a bound.\n\n\n'INTRINSICTYPEVARWITHCONSTRAINTS'         Creates a *note typing.TypeVar: 164.\nwith constraints.\n\n\n'INTRINSICSETFUNCTIONTYPEPARAMS'         Sets the 'typeparams' attribute\nof a function.\n\n\nNew in version 3.12.\n\n'Pseudo-instructions'\n",
            "subsections": []
        },
        "These opcodes do not appear in Python bytecode.  They are used by the": {
            "content": "compiler but are replaced by real opcodes or removed before bytecode is\ngenerated.\n\n-- Opcode: SETUPFINALLY (target)\n\nSet up an exception handler for the following code block.  If an\nexception occurs, the value stack level is restored to its current\nstate and control is transferred to the exception handler at\n'target'.\n\n-- Opcode: SETUPCLEANUP (target)\n\nLike 'SETUPFINALLY', but in case of an exception also pushes the\nlast instruction ('lasti') to the stack so that 'RERAISE' can\nrestore it.  If an exception occurs, the value stack level and the\nlast instruction on the frame are restored to their current state,\nand control is transferred to the exception handler at 'target'.\n\n-- Opcode: SETUPWITH (target)\n\nLike 'SETUPCLEANUP', but in case of an exception one more item is\npopped from the stack before control is transferred to the\nexception handler at 'target'.\n\nThis variant is used in *note with: 396. and *note async with: 399.\nconstructs, which push the return value of the context manager's\n*note enter(): 389. or *note aenter(): 1cd7. to the stack.\n\n-- Opcode: POPBLOCK\n\nMarks the end of the code block associated with the last\n'SETUPFINALLY', 'SETUPCLEANUP' or 'SETUPWITH'.\n\n-- Opcode: JUMP\n\n-- Opcode: JUMPNOINTERRUPT\n\nUndirected relative jump instructions which are replaced by their\ndirected (forward/backward) counterparts by the assembler.\n\n-- Opcode: LOADMETHOD\n\nOptimized unbound method lookup.  Emitted as a 'LOADATTR' opcode\nwith a flag set in the arg.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Opcode collections,  Prev: Python Bytecode Instructions,  Up: dis -- Disassembler for Python bytecode": {
            "content": "5.32.10.5 Opcode collections\n............................\n",
            "subsections": []
        },
        "These collections are provided for automatic introspection of bytecode": {
            "content": "instructions:\n",
            "subsections": []
        },
        "Changed in version 3.12: The collections now contain pseudo instructions": {
            "content": "and instrumented instructions as well.  These are opcodes with values\n'>= MINPSEUDOOPCODE' and '>= MININSTRUMENTEDOPCODE'.\n\n-- Data: dis.opname\n\nSequence of operation names, indexable using the bytecode.\n\n-- Data: dis.opmap\n\nDictionary mapping operation names to bytecodes.\n\n-- Data: dis.cmpop\n\nSequence of all compare operation names.\n\n-- Data: dis.hasarg\n\nSequence of bytecodes that use their argument.\n\nNew in version 3.12.\n\n-- Data: dis.hasconst\n\nSequence of bytecodes that access a constant.\n\n-- Data: dis.hasfree\n\nSequence of bytecodes that access a free variable.  'free' in this\ncontext refers to names in the current scope that are referenced by\ninner scopes or names in outer scopes that are referenced from this\nscope.  It does 'not' include references to global or builtin\nscopes.\n\n-- Data: dis.hasname\n\nSequence of bytecodes that access an attribute by name.\n\n-- Data: dis.hasjrel\n\nSequence of bytecodes that have a relative jump target.\n\n-- Data: dis.hasjabs\n\nSequence of bytecodes that have an absolute jump target.\n\n-- Data: dis.haslocal\n\nSequence of bytecodes that access a local variable.\n\n-- Data: dis.hascompare\n\nSequence of bytecodes of Boolean operations.\n\n-- Data: dis.hasexc\n\nSequence of bytecodes that set an exception handler.\n\nNew in version 3.12.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: pickletools -- Tools for pickle developers,  Prev: dis -- Disassembler for Python bytecode,  Up: Python Language Services": {
            "content": "'Source code:' Lib/pickletools.py(1)\n\n\n",
            "subsections": []
        },
        "This module contains various constants relating to the intimate details": {
            "content": "of the *note pickle: a1. module, some lengthy comments about the\nimplementation, and a few useful functions for analyzing pickled data.",
            "subsections": []
        },
        "The contents of this module are useful for Python core developers who": {
            "content": "are working on the *note pickle: a1.; ordinary users of the *note\npickle: a1. module probably won't find the *note pickletools: a2. module\nrelevant.\n\n* Menu:\n\n* Command line usage: Command line usage<2>.\n* Programmatic Interface: Programmatic Interface<2>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/pickletools.py\n\nFile: python3.12.info,  Node: Command line usage<2>,  Next: Programmatic Interface<2>,  Up: pickletools -- Tools for pickle developers\n\n5.32.11.1 Command line usage\n............................\n\nNew in version 3.2.\n",
            "subsections": []
        },
        "When invoked from the command line, 'python -m pickletools' will": {
            "content": "disassemble the contents of one or more pickle files.  Note that if you\nwant to see the Python object stored in the pickle rather than the\ndetails of pickle format, you may want to use '-m pickle' instead.",
            "subsections": []
        },
        "However, when the pickle file that you want to examine comes from an": {
            "content": "untrusted source, '-m pickletools' is a safer option because it does not\nexecute pickle bytecode.\n\nFor example, with a tuple '(1, 2)' pickled in file 'x.pickle':\n\n$ python -m pickle x.pickle\n(1, 2)\n\n$ python -m pickletools x.pickle\n0: \\x80 PROTO      3\n2: K    BININT1    1\n4: K    BININT1    2\n6: \\x86 TUPLE2\n7: q    BINPUT     0\n9: .    STOP\nhighest protocol among opcodes = 2\n\n* Menu:\n\n* Command line options: Command line options<3>.\n\nFile: python3.12.info,  Node: Command line options<3>,  Up: Command line usage<2>\n\n5.32.11.2 Command line options\n..............................\n\n-- Option: -a, --annotate\n\nAnnotate each line with a short opcode description.\n\n-- Option: -o, --output=<file>\n\nName of a file where the output should be written.\n\n-- Option: -l, --indentlevel=<num>\n\nThe number of blanks by which to indent a new MARK level.\n\n-- Option: -m, --memo\n\nWhen multiple objects are disassembled, preserve memo between\ndisassemblies.\n\n-- Option: -p, --preamble=<preamble>\n\nWhen more than one pickle file are specified, print given preamble\nbefore each disassembly.\n\nFile: python3.12.info,  Node: Programmatic Interface<2>,  Prev: Command line usage<2>,  Up: pickletools -- Tools for pickle developers\n\n5.32.11.3 Programmatic Interface\n................................\n\n-- Function: pickletools.dis (pickle, out=None, memo=None,\nindentlevel=4, annotate=0)\n\nOutputs a symbolic disassembly of the pickle to the file-like\nobject 'out', defaulting to 'sys.stdout'.  'pickle' can be a string\nor a file-like object.  'memo' can be a Python dictionary that will\nbe used as the pickle's memo; it can be used to perform\ndisassemblies across multiple pickles created by the same pickler.\nSuccessive levels, indicated by 'MARK' opcodes in the stream, are\nindented by 'indentlevel' spaces.  If a nonzero value is given to\n'annotate', each opcode in the output is annotated with a short\ndescription.  The value of 'annotate' is used as a hint for the\ncolumn where annotation should start.\n\nChanged in version 3.2: Added the 'annotate' parameter.\n\n-- Function: pickletools.genops (pickle)\n\nProvides an *note iterator: 16a9. over all of the opcodes in a\npickle, returning a sequence of '(opcode, arg, pos)' triples.\n'opcode' is an instance of an 'OpcodeInfo' class; 'arg' is the\ndecoded value, as a Python object, of the opcode's argument; 'pos'\nis the position at which this opcode is located.  'pickle' can be a\nstring or a file-like object.\n\n-- Function: pickletools.optimize (picklestring)\n\nReturns a new equivalent pickle string after eliminating unused\n'PUT' opcodes.  The optimized pickle is shorter, takes less\ntransmission time, requires less storage space, and unpickles more\nefficiently.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: MS Windows Specific Services,  Next: Unix Specific Services,  Prev: Python Language Services,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.33 MS Windows Specific Services",
                    "content": ""
                }
            ]
        },
        "This chapter describes modules that are only available on MS Windows": {
            "content": "platforms.\n\n* Menu:\n\n* msvcrt -- Useful routines from the MS VC++ runtime::\n* winreg -- Windows registry access::\n* winsound -- Sound-playing interface for Windows::\n\nFile: python3.12.info,  Node: msvcrt -- Useful routines from the MS VC++ runtime,  Next: winreg -- Windows registry access,  Up: MS Windows Specific Services\n\n\n\n",
            "subsections": []
        },
        "These functions provide access to some useful capabilities on Windows": {
            "content": "platforms.  Some higher-level modules use these functions to build the\nWindows implementations of their services.  For example, the *note\ngetpass: 5d. module uses this in the implementation of the *note\ngetpass(): 5d. function.\n",
            "subsections": []
        },
        "Further documentation on these functions can be found in the Platform": {
            "content": "API documentation.\n",
            "subsections": []
        },
        "The module implements both the normal and wide char variants of the": {
            "content": "console I/O api.  The normal API deals only with ASCII characters and is\nof limited use for internationalized applications.  The wide char API\nshould be used where ever possible.\n\nChanged in version 3.3: Operations in this module now raise *note\nOSError: 613. where *note IOError: ecb. was raised.\n\n* Menu:\n\n* File Operations::\n* Console I/O::\n* Other Functions::\n\nFile: python3.12.info,  Node: File Operations,  Next: Console I/O,  Up: msvcrt -- Useful routines from the MS VC++ runtime\n\n5.33.1.1 File Operations\n........................\n\n-- Function: msvcrt.locking (fd, mode, nbytes)\n\nLock part of a file based on file descriptor 'fd' from the C\nruntime.  Raises *note OSError: 613. on failure.  The locked region\nof the file extends from the current file position for 'nbytes'\nbytes, and may continue beyond the end of the file.  'mode' must be\none of the 'LK*' constants listed below.  Multiple regions in a\nfile may be locked at the same time, but may not overlap.  Adjacent\nregions are not merged; they must be unlocked individually.\n\nRaises an *note auditing event: 161d. 'msvcrt.locking' with\narguments 'fd', 'mode', 'nbytes'.\n\n-- Data: msvcrt.LKLOCK\n-- Data: msvcrt.LKRLCK\n\nLocks the specified bytes.  If the bytes cannot be locked, the\nprogram immediately tries again after 1 second.  If, after 10\nattempts, the bytes cannot be locked, *note OSError: 613. is\nraised.\n\n-- Data: msvcrt.LKNBLCK\n-- Data: msvcrt.LKNBRLCK\n\nLocks the specified bytes.  If the bytes cannot be locked, *note\nOSError: 613. is raised.\n\n-- Data: msvcrt.LKUNLCK\n\nUnlocks the specified bytes, which must have been previously\nlocked.\n\n-- Function: msvcrt.setmode (fd, flags)\n\nSet the line-end translation mode for the file descriptor 'fd'.  To\nset it to text mode, 'flags' should be *note os.OTEXT: 284e.; for\nbinary, it should be *note os.OBINARY: 283f.\n\n-- Function: msvcrt.openosfhandle (handle, flags)\n\nCreate a C runtime file descriptor from the file handle 'handle'.\nThe 'flags' parameter should be a bitwise OR of *note os.OAPPEND:\n2841, *note os.ORDONLY: 283d, and *note os.OTEXT: 284e.  The\nreturned file descriptor may be used as a parameter to *note\nos.fdopen(): 1c38. to create a file object.\n\nRaises an *note auditing event: 161d. 'msvcrt.openosfhandle' with\narguments 'handle', 'flags'.\n\n-- Function: msvcrt.getosfhandle (fd)\n\nReturn the file handle for the file descriptor 'fd'.  Raises *note\nOSError: 613. if 'fd' is not recognized.\n\nRaises an *note auditing event: 161d. 'msvcrt.getosfhandle' with\nargument 'fd'.\n\nFile: python3.12.info,  Node: Console I/O,  Next: Other Functions,  Prev: File Operations,  Up: msvcrt -- Useful routines from the MS VC++ runtime\n\n5.33.1.2 Console I/O\n....................\n\n-- Function: msvcrt.kbhit ()\n\nReturn 'True' if a keypress is waiting to be read.\n\n-- Function: msvcrt.getch ()\n\nRead a keypress and return the resulting character as a byte\nstring.  Nothing is echoed to the console.  This call will block if\na keypress is not already available, but will not wait for 'Enter'\nto be pressed.  If the pressed key was a special function key, this\nwill return ''\\000'' or ''\\xe0''; the next call will return the\nkeycode.  The 'Control-C' keypress cannot be read with this\nfunction.\n\n-- Function: msvcrt.getwch ()\n\nWide char variant of *note getch(): 43fd, returning a Unicode\nvalue.\n\n-- Function: msvcrt.getche ()\n\nSimilar to *note getch(): 43fd, but the keypress will be echoed if\nit represents a printable character.\n\n-- Function: msvcrt.getwche ()\n\nWide char variant of *note getche(): 43fe, returning a Unicode\nvalue.\n\n-- Function: msvcrt.putch (char)\n\nPrint the byte string 'char' to the console without buffering.\n\n-- Function: msvcrt.putwch (unicodechar)\n\nWide char variant of *note putch(): 43ff, accepting a Unicode\nvalue.\n\n-- Function: msvcrt.ungetch (char)\n\nCause the byte string 'char' to be \"pushed back\" into the console\nbuffer; it will be the next character read by *note getch(): 43fd.\nor *note getche(): 43fe.\n\n-- Function: msvcrt.ungetwch (unicodechar)\n\nWide char variant of *note ungetch(): 4400, accepting a Unicode\nvalue.\n\nFile: python3.12.info,  Node: Other Functions,  Prev: Console I/O,  Up: msvcrt -- Useful routines from the MS VC++ runtime\n\n5.33.1.3 Other Functions\n........................\n\n-- Function: msvcrt.heapmin ()\n\nForce the 'malloc()' heap to clean itself up and return unused\nblocks to the operating system.  On failure, this raises *note\nOSError: 613.\n\n-- Data: msvcrt.CRTASSEMBLYVERSION\n\nThe CRT Assembly version, from the 'crtassem.h' header file.\n\n-- Data: msvcrt.VCASSEMBLYPUBLICKEYTOKEN\n\nThe VC Assembly public key token, from the 'crtassem.h' header\nfile.\n\n-- Data: msvcrt.LIBRARIESASSEMBLYNAMEPREFIX\n\nThe Libraries Assembly name prefix, from the 'crtassem.h' header\nfile.\n\nFile: python3.12.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\n\n\n\n",
            "subsections": []
        },
        "These functions expose the Windows registry API to Python.  Instead of": {
            "content": "using an integer as the registry handle, a *note handle object: 4407. is\nused to ensure that the handles are closed correctly, even if the\nprogrammer neglects to explicitly close them.\n",
            "subsections": []
        },
        "Changed in version 3.3: Several functions in this module used to raise a": {
            "content": "*note WindowsError: ecd, which is now an alias of *note OSError: 613.\n\n* Menu:\n\n* Functions: Functions<13>.\n* Constants: Constants<10>.\n* Registry Handle Objects::\n\nFile: python3.12.info,  Node: Functions<13>,  Next: Constants<10>,  Up: winreg -- Windows registry access\n\n5.33.2.1 Functions\n..................\n\nThis module offers the following functions:\n\n-- Function: winreg.CloseKey (hkey)\n\nCloses a previously opened registry key.  The 'hkey' argument\nspecifies a previously opened key.\n\nNote: If 'hkey' is not closed using this method (or via *note\nhkey.Close(): 440c.), it is closed when the 'hkey' object is\ndestroyed by Python.\n\n-- Function: winreg.ConnectRegistry (computername, key)\n\nEstablishes a connection to a predefined registry handle on another\ncomputer, and returns a *note handle object: 4407.\n\n'computername' is the name of the remote computer, of the form\n'r\"\\\\computername\"'.  If 'None', the local computer is used.\n\n'key' is the predefined handle to connect to.\n\nThe return value is the handle of the opened key.  If the function\nfails, an *note OSError: 613. exception is raised.\n\nRaises an *note auditing event: 161d. 'winreg.ConnectRegistry' with\narguments 'computername', 'key'.\n\nChanged in version 3.3: See *note above: 4408.\n\n-- Function: winreg.CreateKey (key, subkey)\n\nCreates or opens the specified key, returning a *note handle\nobject: 4407.\n\n'key' is an already open key, or one of the predefined *note HKEY*\nconstants: 440d.\n\n'subkey' is a string that names the key this method opens or\ncreates.\n\nIf 'key' is one of the predefined keys, 'subkey' may be 'None'.\nIn that case, the handle returned is the same key handle passed in\nto the function.\n\nIf the key already exists, this function opens the existing key.\n\nThe return value is the handle of the opened key.  If the function\nfails, an *note OSError: 613. exception is raised.\n\nRaises an *note auditing event: 161d. 'winreg.CreateKey' with\narguments 'key', 'subkey', 'access'.\n\nRaises an *note auditing event: 161d. 'winreg.OpenKey/result' with\nargument 'key'.\n\nChanged in version 3.3: See *note above: 4408.\n\n-- Function: winreg.CreateKeyEx (key, subkey, reserved=0,\naccess=KEYWRITE)\n\nCreates or opens the specified key, returning a *note handle\nobject: 4407.\n\n'key' is an already open key, or one of the predefined *note HKEY*\nconstants: 440d.\n\n'subkey' is a string that names the key this method opens or\ncreates.\n\n'reserved' is a reserved integer, and must be zero.  The default is\nzero.\n\n'access' is an integer that specifies an access mask that describes\nthe desired security access for the key.  Default is *note\nKEYWRITE: 440e.  See *note Access Rights: 440f. for other allowed\nvalues.\n\nIf 'key' is one of the predefined keys, 'subkey' may be 'None'.\nIn that case, the handle returned is the same key handle passed in\nto the function.\n\nIf the key already exists, this function opens the existing key.\n\nThe return value is the handle of the opened key.  If the function\nfails, an *note OSError: 613. exception is raised.\n\nRaises an *note auditing event: 161d. 'winreg.CreateKey' with\narguments 'key', 'subkey', 'access'.\n\nRaises an *note auditing event: 161d. 'winreg.OpenKey/result' with\nargument 'key'.\n\nNew in version 3.2.\n\nChanged in version 3.3: See *note above: 4408.\n\n-- Function: winreg.DeleteKey (key, subkey)\n\nDeletes the specified key.\n\n'key' is an already open key, or one of the predefined *note HKEY*\nconstants: 440d.\n\n'subkey' is a string that must be a subkey of the key identified\nby the 'key' parameter.  This value must not be 'None', and the key\nmay not have subkeys.\n\n'This method can not delete keys with subkeys.'\n\nIf the method succeeds, the entire key, including all of its\nvalues, is removed.  If the method fails, an *note OSError: 613.\nexception is raised.\n\nRaises an *note auditing event: 161d. 'winreg.DeleteKey' with\narguments 'key', 'subkey', 'access'.\n\nChanged in version 3.3: See *note above: 4408.\n\n-- Function: winreg.DeleteKeyEx (key, subkey, access=KEYWOW6464KEY,\nreserved=0)\n\nDeletes the specified key.\n\n'key' is an already open key, or one of the predefined *note HKEY*\nconstants: 440d.\n\n'subkey' is a string that must be a subkey of the key identified\nby the 'key' parameter.  This value must not be 'None', and the key\nmay not have subkeys.\n\n'reserved' is a reserved integer, and must be zero.  The default is\nzero.\n\n'access' is an integer that specifies an access mask that describes\nthe desired security access for the key.  Default is *note\nKEYWOW6464KEY: 4410.  On 32-bit Windows, the WOW64 constants are\nignored.  See *note Access Rights: 440f. for other allowed values.\n\n'This method can not delete keys with subkeys.'\n\nIf the method succeeds, the entire key, including all of its\nvalues, is removed.  If the method fails, an *note OSError: 613.\nexception is raised.\n\nOn unsupported Windows versions, *note NotImplementedError: ba5. is\nraised.\n\nRaises an *note auditing event: 161d. 'winreg.DeleteKey' with\narguments 'key', 'subkey', 'access'.\n\nNew in version 3.2.\n\nChanged in version 3.3: See *note above: 4408.\n\n-- Function: winreg.DeleteValue (key, value)\n\nRemoves a named value from a registry key.\n\n'key' is an already open key, or one of the predefined *note HKEY*\nconstants: 440d.\n\n'value' is a string that identifies the value to remove.\n\nRaises an *note auditing event: 161d. 'winreg.DeleteValue' with\narguments 'key', 'value'.\n\n-- Function: winreg.EnumKey (key, index)\n\nEnumerates subkeys of an open registry key, returning a string.\n\n'key' is an already open key, or one of the predefined *note HKEY*\nconstants: 440d.\n\n'index' is an integer that identifies the index of the key to\nretrieve.\n\nThe function retrieves the name of one subkey each time it is\ncalled.  It is typically called repeatedly until an *note OSError:\n613. exception is raised, indicating, no more values are available.\n\nRaises an *note auditing event: 161d. 'winreg.EnumKey' with\narguments 'key', 'index'.\n\nChanged in version 3.3: See *note above: 4408.\n\n-- Function: winreg.EnumValue (key, index)\n\nEnumerates values of an open registry key, returning a tuple.\n\n'key' is an already open key, or one of the predefined *note HKEY*\nconstants: 440d.\n\n'index' is an integer that identifies the index of the value to\nretrieve.\n\nThe function retrieves the name of one subkey each time it is\ncalled.  It is typically called repeatedly, until an *note OSError:\n613. exception is raised, indicating no more values.\n\nThe result is a tuple of 3 items:\n\nIndex       Meaning\n\n-------------------------------------------------------------\n\n'0'         A string that identifies the value name\n\n\n'1'         An object that holds the value data, and whose\ntype depends on the underlying registry type\n\n\n'2'         An integer that identifies the type of the\nvalue data (see table in docs for\n*note SetValueEx(): 14e2.)\n\n\nRaises an *note auditing event: 161d. 'winreg.EnumValue' with\narguments 'key', 'index'.\n\nChanged in version 3.3: See *note above: 4408.\n\n-- Function: winreg.ExpandEnvironmentStrings (str)\n\nExpands environment variable placeholders '%NAME%' in strings like\n*note REGEXPANDSZ: 4411.:\n\n>>> ExpandEnvironmentStrings('%windir%')\n'C:\\\\Windows'\n\nRaises an *note auditing event: 161d.\n'winreg.ExpandEnvironmentStrings' with argument 'str'.\n\n-- Function: winreg.FlushKey (key)\n\nWrites all the attributes of a key to the registry.\n\n'key' is an already open key, or one of the predefined *note HKEY*\nconstants: 440d.\n\nIt is not necessary to call *note FlushKey(): 4412. to change a\nkey.  Registry changes are flushed to disk by the registry using\nits lazy flusher.  Registry changes are also flushed to disk at\nsystem shutdown.  Unlike *note CloseKey(): 440b, the *note\nFlushKey(): 4412. method returns only when all the data has been\nwritten to the registry.  An application should only call *note\nFlushKey(): 4412. if it requires absolute certainty that registry\nchanges are on disk.\n\nNote: If you don't know whether a *note FlushKey(): 4412. call\nis required, it probably isn't.\n\n-- Function: winreg.LoadKey (key, subkey, filename)\n\nCreates a subkey under the specified key and stores registration\ninformation from a specified file into that subkey.\n\n'key' is a handle returned by *note ConnectRegistry(): 3e83. or one\nof the constants *note HKEYUSERS: 4413. or *note\nHKEYLOCALMACHINE: 4414.\n\n'subkey' is a string that identifies the subkey to load.\n\n'filename' is the name of the file to load registry data from.\nThis file must have been created with the *note SaveKey(): 3e8f.\nfunction.  Under the file allocation table (FAT) file system, the\nfilename may not have an extension.\n\nA call to *note LoadKey(): 3e89. fails if the calling process does\nnot have the 'SERESTOREPRIVILEGE' privilege.  Note that\nprivileges are different from permissions - see the RegLoadKey\ndocumentation(1) for more details.\n\nIf 'key' is a handle returned by *note ConnectRegistry(): 3e83,\nthen the path specified in 'filename' is relative to the remote\ncomputer.\n\nRaises an *note auditing event: 161d. 'winreg.LoadKey' with\narguments 'key', 'subkey', 'filename'.\n\n-- Function: winreg.OpenKey (key, subkey, reserved=0, access=KEYREAD)\n-- Function: winreg.OpenKeyEx (key, subkey, reserved=0,\naccess=KEYREAD)\n\nOpens the specified key, returning a *note handle object: 4407.\n\n'key' is an already open key, or one of the predefined *note HKEY*\nconstants: 440d.\n\n'subkey' is a string that identifies the subkey to open.\n\n'reserved' is a reserved integer, and must be zero.  The default is\nzero.\n\n'access' is an integer that specifies an access mask that describes\nthe desired security access for the key.  Default is *note\nKEYREAD: 4416.  See *note Access Rights: 440f. for other allowed\nvalues.\n\nThe result is a new handle to the specified key.\n\nIf the function fails, *note OSError: 613. is raised.\n\nRaises an *note auditing event: 161d. 'winreg.OpenKey' with\narguments 'key', 'subkey', 'access'.\n\nRaises an *note auditing event: 161d. 'winreg.OpenKey/result' with\nargument 'key'.\n\nChanged in version 3.2: Allow the use of named arguments.\n\nChanged in version 3.3: See *note above: 4408.\n\n-- Function: winreg.QueryInfoKey (key)\n\nReturns information about a key, as a tuple.\n\n'key' is an already open key, or one of the predefined *note HKEY*\nconstants: 440d.\n\nThe result is a tuple of 3 items:\n\nIndex       Meaning\n\n--------------------------------------------------------------\n\n'0'         An integer giving the number of sub keys this\nkey has.\n\n\n'1'         An integer giving the number of values this key\nhas.\n\n\n'2'         An integer giving when the key was last\nmodified (if available) as 100's of nanoseconds\nsince Jan 1, 1601.\n\n\nRaises an *note auditing event: 161d. 'winreg.QueryInfoKey' with\nargument 'key'.\n\n-- Function: winreg.QueryValue (key, subkey)\n\nRetrieves the unnamed value for a key, as a string.\n\n'key' is an already open key, or one of the predefined *note HKEY*\nconstants: 440d.\n\n'subkey' is a string that holds the name of the subkey with which\nthe value is associated.  If this parameter is 'None' or empty, the\nfunction retrieves the value set by the *note SetValue(): 3e90.\nmethod for the key identified by 'key'.\n\nValues in the registry have name, type, and data components.  This\nmethod retrieves the data for a key's first value that has a 'NULL'\nname.  But the underlying API call doesn't return the type, so\nalways use *note QueryValueEx(): 3e8e. if possible.\n\nRaises an *note auditing event: 161d. 'winreg.QueryValue' with\narguments 'key', 'subkey', 'valuename'.\n\n-- Function: winreg.QueryValueEx (key, valuename)\n\nRetrieves the type and data for a specified value name associated\nwith an open registry key.\n\n'key' is an already open key, or one of the predefined *note HKEY*\nconstants: 440d.\n\n'valuename' is a string indicating the value to query.\n\nThe result is a tuple of 2 items:\n\nIndex       Meaning\n\n----------------------------------------------------------\n\n'0'         The value of the registry item.\n\n\n'1'         An integer giving the registry type for\nthis value (see table in docs for\n*note SetValueEx(): 14e2.)\n\n\nRaises an *note auditing event: 161d. 'winreg.QueryValue' with\narguments 'key', 'subkey', 'valuename'.\n\n-- Function: winreg.SaveKey (key, filename)\n\nSaves the specified key, and all its subkeys to the specified file.\n\n'key' is an already open key, or one of the predefined *note HKEY*\nconstants: 440d.\n\n'filename' is the name of the file to save registry data to.  This\nfile cannot already exist.  If this filename includes an extension,\nit cannot be used on file allocation table (FAT) file systems by\nthe *note LoadKey(): 3e89. method.\n\nIf 'key' represents a key on a remote computer, the path described\nby 'filename' is relative to the remote computer.  The caller of\nthis method must possess the 'SeBackupPrivilege' security\nprivilege.  Note that privileges are different than permissions -\nsee the Conflicts Between User Rights and Permissions\ndocumentation(2) for more details.\n\nThis function passes 'NULL' for 'securityattributes' to the API.\n\nRaises an *note auditing event: 161d. 'winreg.SaveKey' with\narguments 'key', 'filename'.\n\n-- Function: winreg.SetValue (key, subkey, type, value)\n\nAssociates a value with a specified key.\n\n'key' is an already open key, or one of the predefined *note HKEY*\nconstants: 440d.\n\n'subkey' is a string that names the subkey with which the value is\nassociated.\n\n'type' is an integer that specifies the type of the data.\nCurrently this must be *note REGSZ: 4417, meaning only strings are\nsupported.  Use the *note SetValueEx(): 14e2. function for support\nfor other data types.\n\n'value' is a string that specifies the new value.\n\nIf the key specified by the 'subkey' parameter does not exist, the\nSetValue function creates it.\n\nValue lengths are limited by available memory.  Long values (more\nthan 2048 bytes) should be stored as files with the filenames\nstored in the configuration registry.  This helps the registry\nperform efficiently.\n\nThe key identified by the 'key' parameter must have been opened\nwith *note KEYSETVALUE: 4418. access.\n\nRaises an *note auditing event: 161d. 'winreg.SetValue' with\narguments 'key', 'subkey', 'type', 'value'.\n\n-- Function: winreg.SetValueEx (key, valuename, reserved, type, value)\n\nStores data in the value field of an open registry key.\n\n'key' is an already open key, or one of the predefined *note HKEY*\nconstants: 440d.\n\n'valuename' is a string that names the subkey with which the value\nis associated.\n\n'reserved' can be anything - zero is always passed to the API.\n\n'type' is an integer that specifies the type of the data.  See\n*note Value Types: 4419. for the available types.\n\n'value' is a string that specifies the new value.\n\nThis method can also set additional value and type information for\nthe specified key.  The key identified by the key parameter must\nhave been opened with *note KEYSETVALUE: 4418. access.\n\nTo open the key, use the *note CreateKey(): 3e84. or *note\nOpenKey(): 3e8a. methods.\n\nValue lengths are limited by available memory.  Long values (more\nthan 2048 bytes) should be stored as files with the filenames\nstored in the configuration registry.  This helps the registry\nperform efficiently.\n\nRaises an *note auditing event: 161d. 'winreg.SetValue' with\narguments 'key', 'subkey', 'type', 'value'.\n\n-- Function: winreg.DisableReflectionKey (key)\n\nDisables registry reflection for 32-bit processes running on a\n64-bit operating system.\n\n'key' is an already open key, or one of the predefined *note HKEY*\nconstants: 440d.\n\nWill generally raise *note NotImplementedError: ba5. if executed on\na 32-bit operating system.\n\nIf the key is not on the reflection list, the function succeeds but\nhas no effect.  Disabling reflection for a key does not affect\nreflection of any subkeys.\n\nRaises an *note auditing event: 161d. 'winreg.DisableReflectionKey'\nwith argument 'key'.\n\n-- Function: winreg.EnableReflectionKey (key)\n\nRestores registry reflection for the specified disabled key.\n\n'key' is an already open key, or one of the predefined *note HKEY*\nconstants: 440d.\n\nWill generally raise *note NotImplementedError: ba5. if executed on\na 32-bit operating system.\n\nRestoring reflection for a key does not affect reflection of any\nsubkeys.\n\nRaises an *note auditing event: 161d. 'winreg.EnableReflectionKey'\nwith argument 'key'.\n\n-- Function: winreg.QueryReflectionKey (key)\n\nDetermines the reflection state for the specified key.\n\n'key' is an already open key, or one of the predefined *note HKEY*\nconstants: 440d.\n\nReturns 'True' if reflection is disabled.\n\nWill generally raise *note NotImplementedError: ba5. if executed on\na 32-bit operating system.\n\nRaises an *note auditing event: 161d. 'winreg.QueryReflectionKey'\nwith argument 'key'.\n\n---------- Footnotes ----------\n\n(1)\nhttps://msdn.microsoft.com/en-us/library/ms724889%28v=VS.85%29.aspx\n\n(2)\nhttps://msdn.microsoft.com/en-us/library/ms724878%28v=VS.85%29.aspx\n\nFile: python3.12.info,  Node: Constants<10>,  Next: Registry Handle Objects,  Prev: Functions<13>,  Up: winreg -- Windows registry access\n\n5.33.2.2 Constants\n..................\n\nThe following constants are defined for use in many *note winreg: 111.\nfunctions.\n\n* Menu:\n\n* HKEY* Constants::\n* Access Rights::\n* Value Types::\n\nFile: python3.12.info,  Node: HKEY* Constants,  Next: Access Rights,  Up: Constants<10>\n\n5.33.2.3 HKEY* Constants\n.........................\n\n-- Data: winreg.HKEYCLASSESROOT\n\nRegistry entries subordinate to this key define types (or classes)\nof documents and the properties associated with those types.  Shell\nand COM applications use the information stored under this key.\n\n-- Data: winreg.HKEYCURRENTUSER\n\nRegistry entries subordinate to this key define the preferences of\nthe current user.  These preferences include the settings of\nenvironment variables, data about program groups, colors, printers,\nnetwork connections, and application preferences.\n\n-- Data: winreg.HKEYLOCALMACHINE\n\nRegistry entries subordinate to this key define the physical state\nof the computer, including data about the bus type, system memory,\nand installed hardware and software.\n\n-- Data: winreg.HKEYUSERS\n\nRegistry entries subordinate to this key define the default user\nconfiguration for new users on the local computer and the user\nconfiguration for the current user.\n\n-- Data: winreg.HKEYPERFORMANCEDATA\n\nRegistry entries subordinate to this key allow you to access\nperformance data.  The data is not actually stored in the registry;\nthe registry functions cause the system to collect the data from\nits source.\n\n-- Data: winreg.HKEYCURRENTCONFIG\n\nContains information about the current hardware profile of the\nlocal computer system.\n\n-- Data: winreg.HKEYDYNDATA\n\nThis key is not used in versions of Windows after 98.\n\nFile: python3.12.info,  Node: Access Rights,  Next: Value Types,  Prev: HKEY* Constants,  Up: Constants<10>\n\n5.33.2.4 Access Rights\n......................\n\nFor more information, see Registry Key Security and Access(1).\n\n-- Data: winreg.KEYALLACCESS\n\nCombines the STANDARDRIGHTSREQUIRED, *note KEYQUERYVALUE: 4424,\n*note KEYSETVALUE: 4418, *note KEYCREATESUBKEY: 4425, *note\nKEYENUMERATESUBKEYS: 4426, *note KEYNOTIFY: 4427, and *note\nKEYCREATELINK: 4428. access rights.\n\n-- Data: winreg.KEYWRITE\n\nCombines the STANDARDRIGHTSWRITE, *note KEYSETVALUE: 4418, and\n*note KEYCREATESUBKEY: 4425. access rights.\n\n-- Data: winreg.KEYREAD\n\nCombines the STANDARDRIGHTSREAD, *note KEYQUERYVALUE: 4424,\n*note KEYENUMERATESUBKEYS: 4426, and *note KEYNOTIFY: 4427.\nvalues.\n\n-- Data: winreg.KEYEXECUTE\n\nEquivalent to *note KEYREAD: 4416.\n\n-- Data: winreg.KEYQUERYVALUE\n\nRequired to query the values of a registry key.\n\n-- Data: winreg.KEYSETVALUE\n\nRequired to create, delete, or set a registry value.\n\n-- Data: winreg.KEYCREATESUBKEY\n\nRequired to create a subkey of a registry key.\n\n-- Data: winreg.KEYENUMERATESUBKEYS\n\nRequired to enumerate the subkeys of a registry key.\n\n-- Data: winreg.KEYNOTIFY\n\nRequired to request change notifications for a registry key or for\nsubkeys of a registry key.\n\n-- Data: winreg.KEYCREATELINK\n\nReserved for system use.\n\n* Menu:\n\n* 64-bit Specific::\n\n---------- Footnotes ----------\n\n(1)\nhttps://msdn.microsoft.com/en-us/library/ms724878%28v=VS.85%29.aspx\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: 64-bit Specific,  Up: Access Rights": {
            "content": "5.33.2.5 64-bit Specific\n........................\n\nFor more information, see Accessing an Alternate Registry View(1).\n\n-- Data: winreg.KEYWOW6464KEY\n\nIndicates that an application on 64-bit Windows should operate on\nthe 64-bit registry view.  On 32-bit Windows, this constant is\nignored.\n\n-- Data: winreg.KEYWOW6432KEY\n\nIndicates that an application on 64-bit Windows should operate on\nthe 32-bit registry view.  On 32-bit Windows, this constant is\nignored.\n\n---------- Footnotes ----------\n\n(1) https://msdn.microsoft.com/en-us/library/aa384129(v=VS.85).aspx\n\nFile: python3.12.info,  Node: Value Types,  Prev: Access Rights,  Up: Constants<10>\n\n5.33.2.6 Value Types\n....................\n\nFor more information, see Registry Value Types(1).\n\n-- Data: winreg.REGBINARY\n\nBinary data in any form.\n\n-- Data: winreg.REGDWORD\n\n32-bit number.\n\n-- Data: winreg.REGDWORDLITTLEENDIAN\n\nA 32-bit number in little-endian format.  Equivalent to *note\nREGDWORD: 442f.\n\n-- Data: winreg.REGDWORDBIGENDIAN\n\nA 32-bit number in big-endian format.\n\n-- Data: winreg.REGEXPANDSZ\n\nNull-terminated string containing references to environment\nvariables ('%PATH%').\n\n-- Data: winreg.REGLINK\n\nA Unicode symbolic link.\n\n-- Data: winreg.REGMULTISZ\n\nA sequence of null-terminated strings, terminated by two null\ncharacters.  (Python handles this termination automatically.)\n\n-- Data: winreg.REGNONE\n\nNo defined value type.\n\n-- Data: winreg.REGQWORD\n\nA 64-bit number.\n\nNew in version 3.6.\n\n-- Data: winreg.REGQWORDLITTLEENDIAN\n\nA 64-bit number in little-endian format.  Equivalent to *note\nREGQWORD: b52.\n\nNew in version 3.6.\n\n-- Data: winreg.REGRESOURCELIST\n\nA device-driver resource list.\n\n-- Data: winreg.REGFULLRESOURCEDESCRIPTOR\n\nA hardware setting.\n\n-- Data: winreg.REGRESOURCEREQUIREMENTSLIST\n\nA hardware resource list.\n\n-- Data: winreg.REGSZ\n\nA null-terminated string.\n\n---------- Footnotes ----------\n\n(1)\nhttps://msdn.microsoft.com/en-us/library/ms724884%28v=VS.85%29.aspx\n\nFile: python3.12.info,  Node: Registry Handle Objects,  Prev: Constants<10>,  Up: winreg -- Windows registry access\n\n5.33.2.7 Registry Handle Objects\n................................\n",
            "subsections": []
        },
        "This object wraps a Windows HKEY object, automatically closing it when": {
            "content": "the object is destroyed.  To guarantee cleanup, you can call either the\n*note Close(): 440c. method on the object, or the *note CloseKey():\n440b. function.\n\nAll registry functions in this module return one of these objects.\n",
            "subsections": []
        },
        "All registry functions in this module which accept a handle object also": {
            "content": "accept an integer, however, use of the handle object is encouraged.\n\nHandle objects provide semantics for *note bool(): 114a. - thus\n\nif handle:\nprint(\"Yes\")\n\nwill print 'Yes' if the handle is currently valid (has not been closed\nor detached).\n",
            "subsections": []
        },
        "The object also support comparison semantics, so handle objects will": {
            "content": "compare true if they both reference the same underlying Windows handle\nvalue.\n",
            "subsections": []
        },
        "Handle objects can be converted to an integer (e.g., using the built-in": {
            "content": "*note int(): 17e. function), in which case the underlying Windows handle\nvalue is returned.  You can also use the *note Detach(): 3e8b. method to\nreturn the integer handle, and also disconnect the Windows handle from\nthe handle object.\n\n-- Method: PyHKEY.Close ()\n\nCloses the underlying Windows handle.\n\nIf the handle is already closed, no error is raised.\n\n-- Method: PyHKEY.Detach ()\n\nDetaches the Windows handle from the handle object.\n\nThe result is an integer that holds the value of the handle before\nit is detached.  If the handle is already detached or closed, this\nwill return zero.\n\nAfter calling this function, the handle is effectively invalidated,\nbut the handle is not closed.  You would call this function when\nyou need the underlying Win32 handle to exist beyond the lifetime\nof the handle object.\n\nRaises an *note auditing event: 161d. 'winreg.PyHKEY.Detach' with\nargument 'key'.\n\n-- Method: PyHKEY.enter ()\n-- Method: PyHKEY.exit (*excinfo)\n\nThe HKEY object implements *note enter(): 389. and *note\nexit(): 1175. and thus supports the context protocol for the\n*note with: 396. statement:\n\nwith OpenKey(HKEYLOCALMACHINE, \"foo\") as key:\n...  # work with key\n\nwill automatically close 'key' when control leaves the *note with:\n396. block.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: winsound -- Sound-playing interface for Windows,  Prev: winreg -- Windows registry access,  Up: MS Windows Specific Services": {
            "content": "The *note winsound: 112. module provides access to the basic\nsound-playing machinery provided by Windows platforms.  It includes\nfunctions and several constants.\n\n-- Function: winsound.Beep (frequency, duration)\n\nBeep the PC's speaker.  The 'frequency' parameter specifies\nfrequency, in hertz, of the sound, and must be in the range 37\nthrough 32,767.  The 'duration' parameter specifies the number of\nmilliseconds the sound should last.  If the system is not able to\nbeep the speaker, *note RuntimeError: 17a. is raised.\n\n-- Function: winsound.PlaySound (sound, flags)\n\nCall the underlying 'PlaySound()' function from the Platform API.\nThe 'sound' parameter may be a filename, a system sound alias,\naudio data as a *note bytes-like object: b82, or 'None'.  Its\ninterpretation depends on the value of 'flags', which can be a\nbitwise ORed combination of the constants described below.  If the\n'sound' parameter is 'None', any currently playing waveform sound\nis stopped.  If the system indicates an error, *note RuntimeError:\n17a. is raised.\n\n-- Function: winsound.MessageBeep (type=MBOK)\n\nCall the underlying 'MessageBeep()' function from the Platform API.\nThis plays a sound as specified in the registry.  The 'type'\nargument specifies which sound to play; possible values are '-1',\n'MBICONASTERISK', 'MBICONEXCLAMATION', 'MBICONHAND',\n'MBICONQUESTION', and 'MBOK', all described below.  The value\n'-1' produces a \"simple beep\"; this is the final fallback if a\nsound cannot be played otherwise.  If the system indicates an\nerror, *note RuntimeError: 17a. is raised.\n\n-- Data: winsound.SNDFILENAME\n\nThe 'sound' parameter is the name of a WAV file.  Do not use with\n*note SNDALIAS: 443e.\n\n-- Data: winsound.SNDALIAS\n\nThe 'sound' parameter is a sound association name from the\nregistry.  If the registry contains no such name, play the system\ndefault sound unless *note SNDNODEFAULT: 443f. is also specified.\nIf no default sound is registered, raise *note RuntimeError: 17a.\nDo not use with *note SNDFILENAME: 443d.\n\nAll Win32 systems support at least the following; most systems\nsupport many more:\n\n*note PlaySound(): b56.        Corresponding Control Panel Sound name\n'name'\n\n----------------------------------------------------------------------------\n\n''SystemAsterisk''             Asterisk\n\n\n''SystemExclamation''          Exclamation\n\n\n''SystemExit''                 Exit Windows\n\n\n''SystemHand''                 Critical Stop\n\n\n''SystemQuestion''             Question\n\n\nFor example:\n\nimport winsound\n# Play Windows exit sound.\nwinsound.PlaySound(\"SystemExit\", winsound.SNDALIAS)\n\n# Probably play Windows default sound, if any is registered (because\n# \"*\" probably isn't the registered name of any sound).\nwinsound.PlaySound(\"*\", winsound.SNDALIAS)\n\n-- Data: winsound.SNDLOOP\n\nPlay the sound repeatedly.  The *note SNDASYNC: 4441. flag must\nalso be used to avoid blocking.  Cannot be used with *note\nSNDMEMORY: 4442.\n\n-- Data: winsound.SNDMEMORY\n\nThe 'sound' parameter to *note PlaySound(): b56. is a memory image\nof a WAV file, as a *note bytes-like object: b82.\n\nNote: This module does not support playing from a memory image\nasynchronously, so a combination of this flag and *note\nSNDASYNC: 4441. will raise *note RuntimeError: 17a.\n\n-- Data: winsound.SNDPURGE\n\nStop playing all instances of the specified sound.\n\nNote: This flag is not supported on modern Windows platforms.\n\n-- Data: winsound.SNDASYNC\n\nReturn immediately, allowing sounds to play asynchronously.\n\n-- Data: winsound.SNDNODEFAULT\n\nIf the specified sound cannot be found, do not play the system\ndefault sound.\n\n-- Data: winsound.SNDNOSTOP\n\nDo not interrupt sounds currently playing.\n\n-- Data: winsound.SNDNOWAIT\n\nReturn immediately if the sound driver is busy.\n\nNote: This flag is not supported on modern Windows platforms.\n\n-- Data: winsound.MBICONASTERISK\n\nPlay the 'SystemDefault' sound.\n\n-- Data: winsound.MBICONEXCLAMATION\n\nPlay the 'SystemExclamation' sound.\n\n-- Data: winsound.MBICONHAND\n\nPlay the 'SystemHand' sound.\n\n-- Data: winsound.MBICONQUESTION\n\nPlay the 'SystemQuestion' sound.\n\n-- Data: winsound.MBOK\n\nPlay the 'SystemDefault' sound.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Unix Specific Services,  Next: Modules command-line interface CLI,  Prev: MS Windows Specific Services,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.34 Unix Specific Services",
                    "content": ""
                }
            ]
        },
        "The modules described in this chapter provide interfaces to features": {
            "content": "that are unique to the Unix operating system, or in some cases to some\nor many variants of it.  Here's an overview:\n\n* Menu:\n\n* posix -- The most common POSIX system calls::\n* pwd -- The password database::\n* grp -- The group database::\n* termios -- POSIX style tty control::\n* tty -- Terminal control functions::\n* pty -- Pseudo-terminal utilities::\n* fcntl -- The fcntl and ioctl system calls::\n* resource -- Resource usage information::\n* syslog -- Unix syslog library routines::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: posix -- The most common POSIX system calls,  Next: pwd -- The password database,  Up: Unix Specific Services": {
            "content": "",
            "subsections": []
        },
        "This module provides access to operating system functionality that is": {
            "content": "standardized by the C Standard and the POSIX standard (a thinly\ndisguised Unix interface).\n\n*note Availability: 1ad3.: Unix.\n\n'Do not import this module directly.'  Instead, import the module *note\nos: 9c, which provides a 'portable' version of this interface.  On Unix,\nthe *note os: 9c. module provides a superset of the *note posix: a8.\ninterface.  On non-Unix operating systems the *note posix: a8. module is\nnot available, but a subset is always available through the *note os:\n9c. interface.  Once *note os: 9c. is imported, there is 'no'\nperformance penalty in using it instead of *note posix: a8.  In\naddition, *note os: 9c. provides some additional functionality, such as\nautomatically calling *note putenv(): 73a. when an entry in 'os.environ'\nis changed.\n",
            "subsections": []
        },
        "Errors are reported as exceptions; the usual exceptions are given for": {
            "content": "type errors, while errors reported by the system calls raise *note\nOSError: 613.\n\n* Menu:\n\n* Large File Support::\n* Notable Module Contents::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Large File Support,  Next: Notable Module Contents,  Up: posix -- The most common POSIX system calls": {
            "content": "5.34.1.1 Large File Support\n...........................\n",
            "subsections": []
        },
        "Several operating systems (including AIX and Solaris) provide support": {
            "content": "for files that are larger than 2 GiB from a C programming model where\nint and long are 32-bit values.  This is typically accomplished by\ndefining the relevant size and offset types as 64-bit values.  Such\nfiles are sometimes referred to as 'large files'.\n",
            "subsections": []
        },
        "Large file support is enabled in Python when the size of an 'offt' is": {
            "content": "larger than a long and the long long is at least as large as an 'offt'.",
            "subsections": []
        },
        "It may be necessary to configure and compile Python with certain": {
            "content": "compiler flags to enable this mode.  For example, with Solaris 2.6 and\n2.7 you need to do something like:\n\nCFLAGS=\"`getconf LFSCFLAGS`\" OPT=\"-g -O2 $CFLAGS\" \\\n./configure\n\nOn large-file-capable Linux systems, this might work:\n\nCFLAGS='-DLARGEFILE64SOURCE -DFILEOFFSETBITS=64' OPT=\"-g -O2 $CFLAGS\" \\\n./configure\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Notable Module Contents,  Prev: Large File Support,  Up: posix -- The most common POSIX system calls": {
            "content": "5.34.1.2 Notable Module Contents\n................................\n\nIn addition to many functions described in the *note os: 9c. module\ndocumentation, *note posix: a8. defines the following data item:\n\n-- Data: posix.environ\n\nA dictionary representing the string environment at the time the\ninterpreter was started.  Keys and values are bytes on Unix and str\non Windows.  For example, 'environ[b'HOME']' ('environ['HOME']' on\nWindows) is the pathname of your home directory, equivalent to\n'getenv(\"HOME\")' in C.\n\nModifying this dictionary does not affect the string environment\npassed on by *note execv(): 2812, *note popen(): 8b5. or *note\nsystem(): 12b2.; if you need to change the environment, pass\n'environ' to *note execve(): f69. or add variable assignments and\nexport statements to the command string for *note system(): 12b2.\nor *note popen(): 8b5.\n\nChanged in version 3.2: On Unix, keys and values are bytes.\n\nNote: The *note os: 9c. module provides an alternate\nimplementation of 'environ' which updates the environment on\nmodification.  Note also that updating *note os.environ: 102e.\nwill render this dictionary obsolete.  Use of the *note os:\n9c. module version of this is recommended over direct access\nto the *note posix: a8. module.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: pwd -- The password database,  Next: grp -- The group database,  Prev: posix -- The most common POSIX system calls,  Up: Unix Specific Services": {
            "content": "",
            "subsections": []
        },
        "This module provides access to the Unix user account and password": {
            "content": "database.  It is available on all Unix versions.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n",
            "subsections": []
        },
        "Password database entries are reported as a tuple-like object, whose": {
            "content": "attributes correspond to the members of the 'passwd' structure\n(Attribute field below, see '<pwd.h>'):\n",
            "subsections": []
        },
        "Index       Attribute           Meaning": {
            "content": "----------------------------------------------------------------------\n\n0           'spnamp'           Login name\n\n\n1           'sppwdp'           Encrypted password\n\n\n2           'splstchg'         Date of last change\n\n\n3           'spmin'            Minimal number of days between\nchanges\n\n\n4           'spmax'            Maximum number of days between\nchanges\n\n\n5           'spwarn'           Number of days before password\nexpires to warn user about it\n\n\n6           'spinact'          Number of days after password\nexpires until account is disabled\n\n\n7           'spexpire'         Number of days since 1970-01-01\nwhen account expires\n\n\n8           'spflag'           Reserved\n\n\nThe spnamp and sppwdp items are strings, all others are integers.\n*note KeyError: 8cf. is raised if the entry asked for cannot be found.\n\nThe following functions are defined:\n\n-- Function: spwd.getspnam (name)\n\nReturn the shadow password database entry for the given user name.\n\nChanged in version 3.6: Raises a *note PermissionError: b9a.\ninstead of *note KeyError: 8cf. if the user doesn't have\nprivileges.\n\n-- Function: spwd.getspall ()\n\nReturn a list of all available shadow password database entries, in\narbitrary order.\n\nSee also\n........\n\nModule *note grp: 61.\n\nAn interface to the group database, similar to this.\n\nModule *note pwd: ad.\n\nAn interface to the normal password database, similar to this.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0594/#spwd\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: grp -- The group database,  Next: termios -- POSIX style tty control,  Prev: pwd -- The password database,  Up: Unix Specific Services": {
            "content": "",
            "subsections": []
        },
        "This module provides access to the Unix group database.  It is available": {
            "content": "on all Unix versions.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n",
            "subsections": []
        },
        "Group database entries are reported as a tuple-like object, whose": {
            "content": "attributes correspond to the members of the 'group' structure (Attribute\nfield below, see '<grp.h>'):\n",
            "subsections": []
        },
        "Index       Attribute       Meaning": {
            "content": "------------------------------------------------------------------\n\n0           grname         the name of the group\n\n\n1           grpasswd       the (encrypted) group password;\noften empty\n\n\n2           grgid          the numerical group ID\n\n\n3           grmem          all the group member's user names\n\n",
            "subsections": []
        },
        "The gid is an integer, name and password are strings, and the member": {
            "content": "list is a list of strings.  (Note that most users are not explicitly\nlisted as members of the group they are in according to the password\ndatabase.  Check both databases to get complete membership information.\nAlso note that a 'grname' that starts with a '+' or '-' is likely to be\na YP/NIS reference and may not be accessible via *note getgrnam(): 2e57.\nor *note getgrgid(): b7b.)\n\nIt defines the following items:\n\n-- Function: grp.getgrgid (id)\n\nReturn the group database entry for the given numeric group ID.\n*note KeyError: 8cf. is raised if the entry asked for cannot be\nfound.\n\nChanged in version 3.10: *note TypeError: 28e. is raised for\nnon-integer arguments like floats or strings.\n\n-- Function: grp.getgrnam (name)\n\nReturn the group database entry for the given group name.  *note\nKeyError: 8cf. is raised if the entry asked for cannot be found.\n\n-- Function: grp.getgrall ()\n\nReturn a list of all available group entries, in arbitrary order.\n\nSee also\n........\n\nModule *note pwd: ad.\n\nAn interface to the user database, similar to this.\n\nModule *note spwd: c8.\n\nAn interface to the shadow password database, similar to this.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: termios -- POSIX style tty control,  Next: tty -- Terminal control functions,  Prev: grp -- The group database,  Up: Unix Specific Services": {
            "content": "",
            "subsections": []
        },
        "This module provides an interface to the POSIX calls for tty I/O": {
            "content": "control.  For a complete description of these calls, see 'termios(3)'",
            "subsections": []
        },
        "Unix manual page.  It is only available for those Unix versions that": {
            "content": "support POSIX 'termios' style tty I/O control configured during\ninstallation.\n\n*note Availability: 1ad3.: Unix.\n",
            "subsections": []
        },
        "All functions in this module take a file descriptor 'fd' as their first": {
            "content": "argument.  This can be an integer file descriptor, such as returned by\n'sys.stdin.fileno()', or an *note io.IOBase: 823. object, such as\n'sys.stdin' itself, which provides a *note fileno(): 2542. that returns\na genuine file descriptor.\n\nChanged in version 3.3: Operations in this module used to raise an *note\nIOError: ecb. where they now raise an *note OSError: 613.\n",
            "subsections": []
        },
        "This module also defines all the constants needed to work with the": {
            "content": "functions provided here; these have the same name as their counterparts\nin C. Please refer to your system documentation for more information on\nusing these terminal control interfaces.\n\nThe module defines the following functions:\n\n-- Function: termios.tcgetattr (fd)\n\nReturn a list containing the tty attributes for file descriptor\n'fd', as follows: '[iflag, oflag, cflag, lflag, ispeed, ospeed,\ncc]' where 'cc' is a list of the tty special characters (each a\nstring of length 1, except the items with indices 'VMIN' and\n'VTIME', which are integers when these fields are defined).  The\ninterpretation of the flags and the speeds as well as the indexing\nin the 'cc' array must be done using the symbolic constants defined\nin the *note termios: db. module.\n\n-- Function: termios.tcsetattr (fd, when, attributes)\n\nSet the tty attributes for file descriptor 'fd' from the\n'attributes', which is a list like the one returned by *note\ntcgetattr(): 13c7.  The 'when' argument determines when the\nattributes are changed:\n\n-- Data: termios.TCSANOW\n\nChange attributes immediately.\n\n-- Data: termios.TCSADRAIN\n\nChange attributes after transmitting all queued output.\n\n-- Data: termios.TCSAFLUSH\n\nChange attributes after transmitting all queued output and\ndiscarding all queued input.\n\n-- Function: termios.tcsendbreak (fd, duration)\n\nSend a break on file descriptor 'fd'.  A zero 'duration' sends a\nbreak for 0.25-0.5 seconds; a nonzero 'duration' has a system\ndependent meaning.\n\n-- Function: termios.tcdrain (fd)\n\nWait until all output written to file descriptor 'fd' has been\ntransmitted.\n\n-- Function: termios.tcflush (fd, queue)\n\nDiscard queued data on file descriptor 'fd'.  The 'queue' selector\nspecifies which queue: 'TCIFLUSH' for the input queue, 'TCOFLUSH'\nfor the output queue, or 'TCIOFLUSH' for both queues.\n\n-- Function: termios.tcflow (fd, action)\n\nSuspend or resume input or output on file descriptor 'fd'.  The\n'action' argument can be 'TCOOFF' to suspend output, 'TCOON' to\nrestart output, 'TCIOFF' to suspend input, or 'TCION' to restart\ninput.\n\n-- Function: termios.tcgetwinsize (fd)\n\nReturn a tuple '(wsrow, wscol)' containing the tty window size\nfor file descriptor 'fd'.  Requires 'termios.TIOCGWINSZ' or\n'termios.TIOCGSIZE'.\n\nNew in version 3.11.\n\n-- Function: termios.tcsetwinsize (fd, winsize)\n\nSet the tty window size for file descriptor 'fd' from 'winsize',\nwhich is a two-item tuple '(wsrow, wscol)' like the one returned\nby *note tcgetwinsize(): 4464.  Requires at least one of the pairs\n('termios.TIOCGWINSZ', 'termios.TIOCSWINSZ'); ('termios.TIOCGSIZE',\n'termios.TIOCSSIZE') to be defined.\n\nNew in version 3.11.\n\nSee also\n........\n\nModule *note tty: fb.\n\nConvenience functions for common terminal control operations.\n\n* Menu:\n\n* Example: Example<15>.\n\nFile: python3.12.info,  Node: Example<15>,  Up: termios -- POSIX style tty control\n\n5.34.4.1 Example\n................\n\nHere's a function that prompts for a password with echoing turned off.\nNote the technique using a separate *note tcgetattr(): 13c7. call and a\n*note try: 4bc. ... *note finally: 7ee. statement to ensure that the old\ntty attributes are restored exactly no matter what happens:\n\ndef getpass(prompt=\"Password: \"):\nimport termios, sys\nfd = sys.stdin.fileno()\nold = termios.tcgetattr(fd)\nnew = termios.tcgetattr(fd)\nnew[3] = new[3] & ~termios.ECHO          # lflags\ntry:\ntermios.tcsetattr(fd, termios.TCSADRAIN, new)\npasswd = input(prompt)\nfinally:\ntermios.tcsetattr(fd, termios.TCSADRAIN, old)\nreturn passwd\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: tty -- Terminal control functions,  Next: pty -- Pseudo-terminal utilities,  Prev: termios -- POSIX style tty control,  Up: Unix Specific Services": {
            "content": "'Source code:' Lib/tty.py(1)\n\n\n\nThe *note tty: fb. module defines functions for putting the tty into\ncbreak and raw modes.\n\n*note Availability: 1ad3.: Unix.\n\nBecause it requires the *note termios: db. module, it will work only on\nUnix.\n\nThe *note tty: fb. module defines the following functions:\n\n-- Function: tty.cfmakeraw (mode)\n\nConvert the tty attribute list 'mode', which is a list like the one\nreturned by *note termios.tcgetattr(): 13c7, to that of a tty in\nraw mode.\n\nNew in version 3.12.\n\n-- Function: tty.cfmakecbreak (mode)\n\nConvert the tty attribute list 'mode', which is a list like the one\nreturned by *note termios.tcgetattr(): 13c7, to that of a tty in\ncbreak mode.\n\nThis clears the 'ECHO' and 'ICANON' local mode flags in 'mode' as\nwell as setting the minimum input to 1 byte with no delay.\n\nNew in version 3.12.\n\nChanged in version 3.12.2: The 'ICRNL' flag is no longer cleared.\nThis matches Linux and macOS 'stty cbreak' behavior and what *note\nsetcbreak(): 13c8. historically did.\n\n-- Function: tty.setraw (fd, when=termios.TCSAFLUSH)\n\nChange the mode of the file descriptor 'fd' to raw.  If 'when' is\nomitted, it defaults to *note termios.TCSAFLUSH: 445f, and is\npassed to *note termios.tcsetattr(): 13f4.  The return value of\n*note termios.tcgetattr(): 13c7. is saved before setting 'fd' to\nraw mode; this value is returned.\n\nChanged in version 3.12: The return value is now the original tty\nattributes, instead of None.\n\n-- Function: tty.setcbreak (fd, when=termios.TCSAFLUSH)\n\nChange the mode of file descriptor 'fd' to cbreak.  If 'when' is\nomitted, it defaults to *note termios.TCSAFLUSH: 445f, and is\npassed to *note termios.tcsetattr(): 13f4.  The return value of\n*note termios.tcgetattr(): 13c7. is saved before setting 'fd' to\ncbreak mode; this value is returned.\n\nThis clears the 'ECHO' and 'ICANON' local mode flags as well as\nsetting the minimum input to 1 byte with no delay.\n\nChanged in version 3.12: The return value is now the original tty\nattributes, instead of None.\n\nChanged in version 3.12.2: The 'ICRNL' flag is no longer cleared.\nThis restores the behavior of Python 3.11 and earlier as well as\nmatching what Linux, macOS, & BSDs describe in their 'stty(1)' man\npages regarding cbreak mode.\n\nSee also\n........\n\nModule *note termios: db.\n\nLow-level terminal control interface.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/tty.py\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: pty -- Pseudo-terminal utilities,  Next: fcntl -- The fcntl and ioctl system calls,  Prev: tty -- Terminal control functions,  Up: Unix Specific Services": {
            "content": "'Source code:' Lib/pty.py(1)\n\n\n\nThe *note pty: ac. module defines operations for handling the\npseudo-terminal concept: starting another process and being able to\nwrite to and read from its controlling terminal programmatically.\n\n*note Availability: 1ad3.: Unix.\n",
            "subsections": []
        },
        "Pseudo-terminal handling is highly platform dependent.  This code is": {
            "content": "mainly tested on Linux, FreeBSD, and macOS (it is supposed to work on\nother POSIX platforms but it's not been thoroughly tested).\n\nThe *note pty: ac. module defines the following functions:\n\n-- Function: pty.fork ()\n\nFork.  Connect the child's controlling terminal to a\npseudo-terminal.  Return value is '(pid, fd)'.  Note that the child\ngets 'pid' 0, and the 'fd' is 'invalid'.  The parent's return value\nis the 'pid' of the child, and 'fd' is a file descriptor connected\nto the child's controlling terminal (and also to the child's\nstandard input and output).\n\nWarning: On macOS the use of this function is unsafe when\nmixed with using higher-level system APIs, and that includes\nusing *note urllib.request: 106.\n\n-- Function: pty.openpty ()\n\nOpen a new pseudo-terminal pair, using *note os.openpty(): 2854. if\npossible, or emulation code for generic Unix systems.  Return a\npair of file descriptors '(master, slave)', for the master and the\nslave end, respectively.\n\n-- Function: pty.spawn (argv[, masterread[, stdinread]])\n\nSpawn a process, and connect its controlling terminal with the\ncurrent process's standard io.  This is often used to baffle\nprograms which insist on reading from the controlling terminal.  It\nis expected that the process spawned behind the pty will eventually\nterminate, and when it does 'spawn' will return.\n\nA loop copies STDIN of the current process to the child and data\nreceived from the child to STDOUT of the current process.  It is\nnot signaled to the child if STDIN of the current process closes\ndown.\n\nThe functions 'masterread' and 'stdinread' are passed a file\ndescriptor which they should read from, and they should always\nreturn a byte string.  In order to force spawn to return before the\nchild process exits an empty byte array should be returned to\nsignal end of file.\n\nThe default implementation for both functions will read and return\nup to 1024 bytes each time the function is called.  The\n'masterread' callback is passed the pseudoterminal's master file\ndescriptor to read output from the child process, and 'stdinread'\nis passed file descriptor 0, to read from the parent process's\nstandard input.\n\nReturning an empty byte string from either callback is interpreted\nas an end-of-file (EOF) condition, and that callback will not be\ncalled after that.  If 'stdinread' signals EOF the controlling\nterminal can no longer communicate with the parent process OR the\nchild process.  Unless the child process will quit without any\ninput, 'spawn' will then loop forever.  If 'masterread' signals\nEOF the same behavior results (on linux at least).\n\nReturn the exit status value from *note os.waitpid(): bf6. on the\nchild process.\n\n*note os.waitstatustoexitcode(): 73b. can be used to convert the\nexit status into an exit code.\n\nRaises an *note auditing event: 161d. 'pty.spawn' with argument\n'argv'.\n\nChanged in version 3.4: *note spawn(): df2. now returns the status\nvalue from *note os.waitpid(): bf6. on the child process.\n\n* Menu:\n\n* Example: Example<16>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/pty.py\n\nFile: python3.12.info,  Node: Example<16>,  Up: pty -- Pseudo-terminal utilities\n\n5.34.6.1 Example\n................\n",
            "subsections": []
        },
        "The following program acts like the Unix command 'script(1)', using a": {
            "content": "pseudo-terminal to record all input and output of a terminal session in\na \"typescript\".\n\nimport argparse\nimport os\nimport pty\nimport sys\nimport time\n\nparser = argparse.ArgumentParser()\nparser.addargument('-a', dest='append', action='storetrue')\nparser.addargument('-p', dest='usepython', action='storetrue')\nparser.addargument('filename', nargs='?', default='typescript')\noptions = parser.parseargs()\n\nshell = sys.executable if options.usepython else os.environ.get('SHELL', 'sh')\nfilename = options.filename\nmode = 'ab' if options.append else 'wb'\n\nwith open(filename, mode) as script:\ndef read(fd):\ndata = os.read(fd, 1024)\nscript.write(data)\nreturn data\n\nprint('Script started, file is', filename)\nscript.write(('Script started on %s\\n' % time.asctime()).encode())\n\npty.spawn(shell, read)\n\nscript.write(('Script done on %s\\n' % time.asctime()).encode())\nprint('Script done, file is', filename)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: fcntl -- The fcntl and ioctl system calls,  Next: resource -- Resource usage information,  Prev: pty -- Pseudo-terminal utilities,  Up: Unix Specific Services": {
            "content": "",
            "subsections": []
        },
        "This module performs file and I/O control on file descriptors.  It is an": {
            "content": "interface to the 'fcntl()' and 'ioctl()' Unix routines.  See the\n'fcntl(2)' and 'ioctl(2)' Unix manual pages for full details.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n",
            "subsections": []
        },
        "Changed in version 3.8: The fcntl module now contains 'FADDSEALS',": {
            "content": "'FGETSEALS', and 'FSEAL*' constants for sealing of *note\nos.memfdcreate(): 834. file descriptors.\n",
            "subsections": []
        },
        "Changed in version 3.9: On macOS, the fcntl module exposes the": {
            "content": "'FGETPATH' constant, which obtains the path of a file from a file\ndescriptor.  On Linux(>=3.15), the fcntl module exposes the\n'FOFDGETLK', 'FOFDSETLK' and 'FOFDSETLKW' constants, which are\nused when working with open file description locks.\n\nChanged in version 3.10: On Linux >= 2.6.11, the fcntl module exposes\nthe 'FGETPIPESZ' and 'FSETPIPESZ' constants, which allow to check\nand modify a pipe's size respectively.\n",
            "subsections": []
        },
        "Changed in version 3.11: On FreeBSD, the fcntl module exposes the": {
            "content": "'FDUP2FD' and 'FDUP2FDCLOEXEC' constants, which allow to duplicate a\nfile descriptor, the latter setting 'FDCLOEXEC' flag in addition.\n\nChanged in version 3.12: On Linux >= 4.5, the *note fcntl: 54. module\nexposes the 'FICLONE' and 'FICLONERANGE' constants, which allow to share\nsome data of one file with another file by reflinking on some\nfilesystems (e.g., btrfs, OCFS2, and XFS). This behavior is commonly\nreferred to as \"copy-on-write\".\n\nThe module defines the following functions:\n\n-- Function: fcntl.fcntl (fd, cmd, arg=0)\n\nPerform the operation 'cmd' on file descriptor 'fd' (file objects\nproviding a *note fileno(): 2542. method are accepted as well).\nThe values used for 'cmd' are operating system dependent, and are\navailable as constants in the *note fcntl: 54. module, using the\nsame names as used in the relevant C header files.  The argument\n'arg' can either be an integer value, or a *note bytes: 295.\nobject.  With an integer value, the return value of this function\nis the integer return value of the C 'fcntl()' call.  When the\nargument is bytes it represents a binary structure, e.g.  created\nby *note struct.pack(): 10ef.  The binary data is copied to a\nbuffer whose address is passed to the C 'fcntl()' call.  The return\nvalue after a successful call is the contents of the buffer,\nconverted to a *note bytes: 295. object.  The length of the\nreturned object will be the same as the length of the 'arg'\nargument.  This is limited to 1024 bytes.  If the information\nreturned in the buffer by the operating system is larger than 1024\nbytes, this is most likely to result in a segmentation violation or\na more subtle data corruption.\n\nIf the 'fcntl()' call fails, an *note OSError: 613. is raised.\n\nRaises an *note auditing event: 161d. 'fcntl.fcntl' with arguments\n'fd', 'cmd', 'arg'.\n\n-- Function: fcntl.ioctl (fd, request, arg=0, mutateflag=True)\n\nThis function is identical to the *note fcntl(): 3099. function,\nexcept that the argument handling is even more complicated.\n\nThe 'request' parameter is limited to values that can fit in\n32-bits.  Additional constants of interest for use as the 'request'\nargument can be found in the *note termios: db. module, under the\nsame names as used in the relevant C header files.\n\nThe parameter 'arg' can be one of an integer, an object supporting\nthe read-only buffer interface (like *note bytes: 295.) or an\nobject supporting the read-write buffer interface (like *note\nbytearray: 294.).\n\nIn all but the last case, behaviour is as for the *note fcntl():\n3099. function.\n\nIf a mutable buffer is passed, then the behaviour is determined by\nthe value of the 'mutateflag' parameter.\n\nIf it is false, the buffer's mutability is ignored and behaviour is\nas for a read-only buffer, except that the 1024 byte limit\nmentioned above is avoided - so long as the buffer you pass is at\nleast as long as what the operating system wants to put there,\nthings should work.\n\nIf 'mutateflag' is true (the default), then the buffer is (in\neffect) passed to the underlying *note ioctl(): 12d0. system call,\nthe latter's return code is passed back to the calling Python, and\nthe buffer's new contents reflect the action of the *note ioctl():\n12d0.  This is a slight simplification, because if the supplied\nbuffer is less than 1024 bytes long it is first copied into a\nstatic buffer 1024 bytes long which is then passed to *note\nioctl(): 12d0. and copied back into the supplied buffer.\n\nIf the 'ioctl()' call fails, an *note OSError: 613. exception is\nraised.\n\nAn example:\n\n>>> import array, fcntl, struct, termios, os\n>>> os.getpgrp()\n13341\n>>> struct.unpack('h', fcntl.ioctl(0, termios.TIOCGPGRP, \"  \"))[0]\n13341\n>>> buf = array.array('h', [0])\n>>> fcntl.ioctl(0, termios.TIOCGPGRP, buf, 1)\n0\n>>> buf\narray('h', [13341])\n\nRaises an *note auditing event: 161d. 'fcntl.ioctl' with arguments\n'fd', 'request', 'arg'.\n\n-- Function: fcntl.flock (fd, operation)\n\nPerform the lock operation 'operation' on file descriptor 'fd'\n(file objects providing a *note fileno(): 2542. method are accepted\nas well).  See the Unix manual 'flock(2)' for details.  (On some\nsystems, this function is emulated using 'fcntl()'.)\n\nIf the 'flock()' call fails, an *note OSError: 613. exception is\nraised.\n\nRaises an *note auditing event: 161d. 'fcntl.flock' with arguments\n'fd', 'operation'.\n\n-- Function: fcntl.lockf (fd, cmd, len=0, start=0, whence=0)\n\nThis is essentially a wrapper around the *note fcntl(): 3099.\nlocking calls.  'fd' is the file descriptor (file objects providing\na *note fileno(): 2542. method are accepted as well) of the file to\nlock or unlock, and 'cmd' is one of the following values:\n\n-- Data: fcntl.LOCKUN\n\nRelease an existing lock.\n\n-- Data: fcntl.LOCKSH\n\nAcquire a shared lock.\n\n-- Data: fcntl.LOCKEX\n\nAcquire an exclusive lock.\n\n-- Data: fcntl.LOCKNB\n\nBitwise OR with any of the other three 'LOCK*' constants to\nmake the request non-blocking.\n\nIf 'LOCKNB' is used and the lock cannot be acquired, an *note\nOSError: 613. will be raised and the exception will have an 'errno'\nattribute set to *note EACCES: 1fbc. or *note EAGAIN: 1fad.\n(depending on the operating system; for portability, check for both\nvalues).  On at least some systems, 'LOCKEX' can only be used if\nthe file descriptor refers to a file opened for writing.\n\n'len' is the number of bytes to lock, 'start' is the byte offset at\nwhich the lock starts, relative to 'whence', and 'whence' is as\nwith *note io.IOBase.seek(): 1105, specifically:\n\n* '0' - relative to the start of the file (*note os.SEEKSET:\n1106.)\n\n* '1' - relative to the current buffer position (*note\nos.SEEKCUR: 1107.)\n\n* '2' - relative to the end of the file (*note os.SEEKEND:\n1108.)\n\nThe default for 'start' is 0, which means to start at the beginning\nof the file.  The default for 'len' is 0 which means to lock to the\nend of the file.  The default for 'whence' is also 0.\n\nRaises an *note auditing event: 161d. 'fcntl.lockf' with arguments\n'fd', 'cmd', 'len', 'start', 'whence'.\n\nExamples (all on a SVR4 compliant system):\n\nimport struct, fcntl, os\n\nf = open(...)\nrv = fcntl.fcntl(f, fcntl.FSETFL, os.ONDELAY)\n\nlockdata = struct.pack('hhllhh', fcntl.FWRLCK, 0, 0, 0, 0, 0)\nrv = fcntl.fcntl(f, fcntl.FSETLKW, lockdata)\n",
            "subsections": []
        },
        "Note that in the first example the return value variable 'rv' will hold": {
            "content": "an integer value; in the second example it will hold a *note bytes: 295.\nobject.  The structure lay-out for the 'lockdata' variable is system\ndependent -- therefore using the *note flock(): 3e7c. call may be better.\n\nSee also\n........\n\nModule *note os: 9c.\n\nIf the locking flags *note OSHLOCK: 1287. and *note OEXLOCK:\n1288. are present in the *note os: 9c. module (on BSD only), the\n*note os.open(): bee. function provides an alternative to the *note\nlockf(): 1241. and *note flock(): 3e7c. functions.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: resource -- Resource usage information,  Next: syslog -- Unix syslog library routines,  Prev: fcntl -- The fcntl and ioctl system calls,  Up: Unix Specific Services": {
            "content": "",
            "subsections": []
        },
        "This module provides basic mechanisms for measuring and controlling": {
            "content": "system resources utilized by a program.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n",
            "subsections": []
        },
        "Symbolic constants are used to specify particular system resources and": {
            "content": "to request usage information about either the current process or its\nchildren.\n\nAn *note OSError: 613. is raised on syscall failure.\n\n-- Exception: resource.error\n\nA deprecated alias of *note OSError: 613.\n\nChanged in version 3.3: Following PEP 3151(1), this class was made\nan alias of *note OSError: 613.\n\n* Menu:\n\n* Resource Limits::\n* Resource Usage::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3151/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Resource Limits,  Next: Resource Usage,  Up: resource -- Resource usage information": {
            "content": "5.34.8.1 Resource Limits\n........................\n\nResources usage can be limited using the *note setrlimit(): 3e21.\nfunction described below.  Each resource is controlled by a pair of\nlimits: a soft limit and a hard limit.  The soft limit is the current\nlimit, and may be lowered or raised by a process over time.  The soft\nlimit can never exceed the hard limit.  The hard limit can be lowered to\nany value greater than the soft limit, but not raised.  (Only processes\nwith the effective UID of the super-user can raise a hard limit.)\n",
            "subsections": []
        },
        "The specific resources that can be limited are system dependent.  They": {
            "content": "are described in the 'getrlimit(2)' man page.  The resources listed\nbelow are supported when the underlying operating system supports them;\nresources which cannot be checked or controlled by the operating system\nare not defined in this module for those platforms.\n\n-- Data: resource.RLIMINFINITY\n\nConstant used to represent the limit for an unlimited resource.\n\n-- Function: resource.getrlimit (resource)\n\nReturns a tuple '(soft, hard)' with the current soft and hard\nlimits of 'resource'.  Raises *note ValueError: 183. if an invalid\nresource is specified, or *note error: 4475. if the underlying\nsystem call fails unexpectedly.\n\n-- Function: resource.setrlimit (resource, limits)\n\nSets new limits of consumption of 'resource'.  The 'limits'\nargument must be a tuple '(soft, hard)' of two integers describing\nthe new limits.  A value of *note RLIMINFINITY: 4477. can be used\nto request a limit that is unlimited.\n\nRaises *note ValueError: 183. if an invalid resource is specified,\nif the new soft limit exceeds the hard limit, or if a process tries\nto raise its hard limit.  Specifying a limit of *note\nRLIMINFINITY: 4477. when the hard or system limit for that\nresource is not unlimited will result in a *note ValueError: 183.\nA process with the effective UID of super-user can request any\nvalid limit value, including unlimited, but *note ValueError: 183.\nwill still be raised if the requested limit exceeds the system\nimposed limit.\n\n'setrlimit' may also raise *note error: 4475. if the underlying\nsystem call fails.\n\nVxWorks only supports setting *note RLIMITNOFILE: 4479.\n\nRaises an *note auditing event: 161d. 'resource.setrlimit' with\narguments 'resource', 'limits'.\n\n-- Function: resource.prlimit (pid, resource[, limits])\n\nCombines *note setrlimit(): 3e21. and *note getrlimit(): 4478. in\none function and supports to get and set the resources limits of an\narbitrary process.  If 'pid' is 0, then the call applies to the\ncurrent process.  'resource' and 'limits' have the same meaning as\nin *note setrlimit(): 3e21, except that 'limits' is optional.\n\nWhen 'limits' is not given the function returns the 'resource'\nlimit of the process 'pid'.  When 'limits' is given the 'resource'\nlimit of the process is set and the former resource limit is\nreturned.\n\nRaises *note ProcessLookupError: ed4. when 'pid' can't be found and\n*note PermissionError: b9a. when the user doesn't have\n'CAPSYSRESOURCE' for the process.\n\nRaises an *note auditing event: 161d. 'resource.prlimit' with\narguments 'pid', 'resource', 'limits'.\n\n*note Availability: 1ad3.: Linux >= 2.6.36 with glibc >= 2.13.\n\nNew in version 3.4.\n",
            "subsections": []
        },
        "These symbols define resources whose consumption can be controlled using": {
            "content": "the *note setrlimit(): 3e21. and *note getrlimit(): 4478. functions\ndescribed below.  The values of these symbols are exactly the constants\nused by C programs.\n\nThe Unix man page for 'getrlimit(2)' lists the available resources.",
            "subsections": []
        },
        "Note that not all systems use the same symbol or same value to denote": {
            "content": "the same resource.  This module does not attempt to mask platform\ndifferences -- symbols not defined for a platform will not be available\nfrom this module on that platform.\n\n-- Data: resource.RLIMITCORE\n\nThe maximum size (in bytes) of a core file that the current process\ncan create.  This may result in the creation of a partial core file\nif a larger core would be required to contain the entire process\nimage.\n\n-- Data: resource.RLIMITCPU\n\nThe maximum amount of processor time (in seconds) that a process\ncan use.  If this limit is exceeded, a 'SIGXCPU' signal is sent to\nthe process.  (See the *note signal: c1. module documentation for\ninformation about how to catch this signal and do something useful,\ne.g.  flush open files to disk.)\n\n-- Data: resource.RLIMITFSIZE\n\nThe maximum size of a file which the process may create.\n\n-- Data: resource.RLIMITDATA\n\nThe maximum size (in bytes) of the process's heap.\n\n-- Data: resource.RLIMITSTACK\n\nThe maximum size (in bytes) of the call stack for the current\nprocess.  This only affects the stack of the main thread in a\nmulti-threaded process.\n\n-- Data: resource.RLIMITRSS\n\nThe maximum resident set size that should be made available to the\nprocess.\n\n-- Data: resource.RLIMITNPROC\n\nThe maximum number of processes the current process may create.\n\n-- Data: resource.RLIMITNOFILE\n\nThe maximum number of open file descriptors for the current\nprocess.\n\n-- Data: resource.RLIMITOFILE\n\nThe BSD name for *note RLIMITNOFILE: 4479.\n\n-- Data: resource.RLIMITMEMLOCK\n\nThe maximum address space which may be locked in memory.\n\n-- Data: resource.RLIMITVMEM\n\nThe largest area of mapped memory which the process may occupy.\n\n*note Availability: 1ad3.: FreeBSD >= 11.\n\n-- Data: resource.RLIMITAS\n\nThe maximum area (in bytes) of address space which may be taken by\nthe process.\n\n-- Data: resource.RLIMITMSGQUEUE\n\nThe number of bytes that can be allocated for POSIX message queues.\n\n*note Availability: 1ad3.: Linux >= 2.6.8.\n\nNew in version 3.4.\n\n-- Data: resource.RLIMITNICE\n\nThe ceiling for the process's nice level (calculated as 20 -\nrlimcur).\n\n*note Availability: 1ad3.: Linux >= 2.6.12.\n\nNew in version 3.4.\n\n-- Data: resource.RLIMITRTPRIO\n\nThe ceiling of the real-time priority.\n\n*note Availability: 1ad3.: Linux >= 2.6.12.\n\nNew in version 3.4.\n\n-- Data: resource.RLIMITRTTIME\n\nThe time limit (in microseconds) on CPU time that a process can\nspend under real-time scheduling without making a blocking syscall.\n\n*note Availability: 1ad3.: Linux >= 2.6.25.\n\nNew in version 3.4.\n\n-- Data: resource.RLIMITSIGPENDING\n\nThe number of signals which the process may queue.\n\n*note Availability: 1ad3.: Linux >= 2.6.8.\n\nNew in version 3.4.\n\n-- Data: resource.RLIMITSBSIZE\n\nThe maximum size (in bytes) of socket buffer usage for this user.\nThis limits the amount of network memory, and hence the amount of\nmbufs, that this user may hold at any time.\n\n*note Availability: 1ad3.: FreeBSD.\n\nNew in version 3.4.\n\n-- Data: resource.RLIMITSWAP\n\nThe maximum size (in bytes) of the swap space that may be reserved\nor used by all of this user id's processes.  This limit is enforced\nonly if bit 1 of the vm.overcommit sysctl is set.  Please see\ntuning(7)(1) for a complete description of this sysctl.\n\n*note Availability: 1ad3.: FreeBSD.\n\nNew in version 3.4.\n\n-- Data: resource.RLIMITNPTS\n\nThe maximum number of pseudo-terminals created by this user id.\n\n*note Availability: 1ad3.: FreeBSD.\n\nNew in version 3.4.\n\n-- Data: resource.RLIMITKQUEUES\n\nThe maximum number of kqueues this user id is allowed to create.\n\n*note Availability: 1ad3.: FreeBSD >= 11.\n\nNew in version 3.10.\n\n---------- Footnotes ----------\n\n(1) https://man.freebsd.org/cgi/man.cgi?query=tuning&sektion=7\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Resource Usage,  Prev: Resource Limits,  Up: resource -- Resource usage information": {
            "content": "5.34.8.2 Resource Usage\n.......................\n\nThese functions are used to retrieve resource usage information:\n\n-- Function: resource.getrusage (who)\n\nThis function returns an object that describes the resources\nconsumed by either the current process or its children, as\nspecified by the 'who' parameter.  The 'who' parameter should be\nspecified using one of the 'RUSAGE*' constants described below.\n\nA simple example:\n\nfrom resource import *\nimport time\n\n# a non CPU-bound task\ntime.sleep(3)\nprint(getrusage(RUSAGESELF))\n\n# a CPU-bound task\nfor i in range(10  8):\n= 1 + 1\nprint(getrusage(RUSAGESELF))\n\nThe fields of the return value each describe how a particular\nsystem resource has been used, e.g.  amount of time spent running\nis user mode or number of times the process was swapped out of main\nmemory.  Some values are dependent on the clock tick internal, e.g.\nthe amount of memory the process is using.\n\nFor backward compatibility, the return value is also accessible as\na tuple of 16 elements.\n\nThe fields 'ruutime' and 'rustime' of the return value are\nfloating point values representing the amount of time spent\nexecuting in user mode and the amount of time spent executing in\nsystem mode, respectively.  The remaining values are integers.\nConsult the 'getrusage(2)' man page for detailed information about\nthese values.  A brief summary is presented here:\n\nIndex        Field                     Resource\n\n-----------------------------------------------------------------------------------\n\n'0'          'ruutime'                time in user mode (float seconds)\n\n\n'1'          'rustime'                time in system mode (float seconds)\n\n\n'2'          'rumaxrss'               maximum resident set size\n\n\n'3'          'ruixrss'                shared memory size\n\n\n'4'          'ruidrss'                unshared memory size\n\n\n'5'          'ruisrss'                unshared stack size\n\n\n'6'          'ruminflt'               page faults not requiring I/O\n\n\n'7'          'rumajflt'               page faults requiring I/O\n\n\n'8'          'runswap'                number of swap outs\n\n\n'9'          'ruinblock'              block input operations\n\n\n'10'         'ruoublock'              block output operations\n\n\n'11'         'rumsgsnd'               messages sent\n\n\n'12'         'rumsgrcv'               messages received\n\n\n'13'         'runsignals'             signals received\n\n\n'14'         'runvcsw'                voluntary context switches\n\n\n'15'         'runivcsw'               involuntary context switches\n\n\nThis function will raise a *note ValueError: 183. if an invalid\n'who' parameter is specified.  It may also raise *note error: 4475.\nexception in unusual circumstances.\n\n-- Function: resource.getpagesize ()\n\nReturns the number of bytes in a system page.  (This need not be\nthe same as the hardware page size.)\n\nThe following 'RUSAGE*' symbols are passed to the *note getrusage():\n1289. function to specify which processes information should be provided\nfor.\n\n-- Data: resource.RUSAGESELF\n\nPass to *note getrusage(): 1289. to request resources consumed by\nthe calling process, which is the sum of resources used by all\nthreads in the process.\n\n-- Data: resource.RUSAGECHILDREN\n\nPass to *note getrusage(): 1289. to request resources consumed by\nchild processes of the calling process which have been terminated\nand waited for.\n\n-- Data: resource.RUSAGEBOTH\n\nPass to *note getrusage(): 1289. to request resources consumed by\nboth the current process and child processes.  May not be available\non all systems.\n\n-- Data: resource.RUSAGETHREAD\n\nPass to *note getrusage(): 1289. to request resources consumed by\nthe current thread.  May not be available on all systems.\n\nNew in version 3.2.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: syslog -- Unix syslog library routines,  Prev: resource -- Resource usage information,  Up: Unix Specific Services": {
            "content": "This module provides an interface to the Unix 'syslog' library routines.",
            "subsections": []
        },
        "Refer to the Unix manual pages for a detailed description of the": {
            "content": "'syslog' facility.\n\n*note Availability: 1ad3.: Unix, not Emscripten, not WASI.\n",
            "subsections": []
        },
        "This module wraps the system 'syslog' family of routines.  A pure Python": {
            "content": "library that can speak to a syslog server is available in the *note\nlogging.handlers: 84. module as 'SysLogHandler'.\n\nThe module defines the following functions:\n\n-- Function: syslog.syslog (message)\n\n-- Function: syslog.syslog (priority, message)\n\nSend the string 'message' to the system logger.  A trailing newline\nis added if necessary.  Each message is tagged with a priority\ncomposed of a 'facility' and a 'level'.  The optional 'priority'\nargument, which defaults to 'LOGINFO', determines the message\npriority.  If the facility is not encoded in 'priority' using\nlogical-or ('LOGINFO | LOGUSER'), the value given in the *note\nopenlog(): 296. call is used.\n\nIf *note openlog(): 296. has not been called prior to the call to\n*note syslog(): d6, *note openlog(): 296. will be called with no\narguments.\n\nRaises an *note auditing event: 161d. 'syslog.syslog' with\narguments 'priority', 'message'.\n\nChanged in version 3.2: In previous versions, *note openlog(): 296.\nwould not be called automatically if it wasn't called prior to the\ncall to *note syslog(): d6, deferring to the syslog implementation\nto call 'openlog()'.\n\nChanged in version 3.12: This function is restricted in\nsubinterpreters.  (Only code that runs in multiple interpreters is\naffected and the restriction is not relevant for most users.)\n*note openlog(): 296. must be called in the main interpreter before\n*note syslog(): d6. may be used in a subinterpreter.  Otherwise it\nwill raise *note RuntimeError: 17a.\n\n-- Function: syslog.openlog ([ident[, logoption[, facility]]])\n\nLogging options of subsequent *note syslog(): d6. calls can be set\nby calling *note openlog(): 296.  *note syslog(): d6. will call\n*note openlog(): 296. with no arguments if the log is not currently\nopen.\n\nThe optional 'ident' keyword argument is a string which is\nprepended to every message, and defaults to 'sys.argv[0]' with\nleading path components stripped.  The optional 'logoption' keyword\nargument (default is 0) is a bit field - see below for possible\nvalues to combine.  The optional 'facility' keyword argument\n(default is 'LOGUSER') sets the default facility for messages\nwhich do not have a facility explicitly encoded.\n\nRaises an *note auditing event: 161d. 'syslog.openlog' with\narguments 'ident', 'logoption', 'facility'.\n\nChanged in version 3.2: In previous versions, keyword arguments\nwere not allowed, and 'ident' was required.\n\nChanged in version 3.12: This function is restricted in\nsubinterpreters.  (Only code that runs in multiple interpreters is\naffected and the restriction is not relevant for most users.)  This\nmay only be called in the main interpreter.  It will raise *note\nRuntimeError: 17a. if called in a subinterpreter.\n\n-- Function: syslog.closelog ()\n\nReset the syslog module values and call the system library\n'closelog()'.\n\nThis causes the module to behave as it does when initially\nimported.  For example, *note openlog(): 296. will be called on the\nfirst *note syslog(): d6. call (if *note openlog(): 296. hasn't\nalready been called), and 'ident' and other *note openlog(): 296.\nparameters are reset to defaults.\n\nRaises an *note auditing event: 161d. 'syslog.closelog' with no\narguments.\n\nChanged in version 3.12: This function is restricted in\nsubinterpreters.  (Only code that runs in multiple interpreters is\naffected and the restriction is not relevant for most users.)  This\nmay only be called in the main interpreter.  It will raise *note\nRuntimeError: 17a. if called in a subinterpreter.\n\n-- Function: syslog.setlogmask (maskpri)\n\nSet the priority mask to 'maskpri' and return the previous mask\nvalue.  Calls to *note syslog(): d6. with a priority level not set\nin 'maskpri' are ignored.  The default is to log all priorities.\nThe function 'LOGMASK(pri)' calculates the mask for the individual\npriority 'pri'.  The function 'LOGUPTO(pri)' calculates the mask\nfor all priorities up to and including 'pri'.\n\nRaises an *note auditing event: 161d. 'syslog.setlogmask' with\nargument 'maskpri'.\n\nThe module defines the following constants:\n\nPriority levels (high to low):\n\n'LOGEMERG', 'LOGALERT', 'LOGCRIT', 'LOGERR', 'LOGWARNING',\n'LOGNOTICE', 'LOGINFO', 'LOGDEBUG'.\n\nFacilities:\n\n'LOGKERN', 'LOGUSER', 'LOGMAIL', 'LOGDAEMON', 'LOGAUTH',\n'LOGLPR', 'LOGNEWS', 'LOGUUCP', 'LOGCRON', 'LOGSYSLOG',\n'LOGLOCAL0' to 'LOGLOCAL7', and, if defined in '<syslog.h>',\n'LOGAUTHPRIV'.\n\nLog options:\n\n'LOGPID', 'LOGCONS', 'LOGNDELAY', and, if defined in\n'<syslog.h>', 'LOGODELAY', 'LOGNOWAIT', and 'LOGPERROR'.\n\n* Menu:\n\n* Examples: Examples<35>.\n\nFile: python3.12.info,  Node: Examples<35>,  Up: syslog -- Unix syslog library routines\n\n5.34.9.1 Examples\n.................\n\n* Menu:\n\n* Simple example::\n\nFile: python3.12.info,  Node: Simple example,  Up: Examples<35>\n\n5.34.9.2 Simple example\n.......................\n\nA simple set of examples:\n\nimport syslog\n\nsyslog.syslog('Processing started')\nif error:\nsyslog.syslog(syslog.LOGERR, 'Processing started')\n",
            "subsections": []
        },
        "An example of setting some log options, these would include the process": {
            "content": "ID in logged messages, and write the messages to the destination\nfacility used for mail logging:\n\nsyslog.openlog(logoption=syslog.LOGPID, facility=syslog.LOGMAIL)\nsyslog.syslog('E-mail processing initiated...')\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Modules command-line interface CLI,  Next: Superseded Modules,  Prev: Unix Specific Services,  Up: The Python Standard Library": {
            "content": "",
            "subsections": [
                {
                    "name": "5.35 Modules command-line interface (CLI)",
                    "content": "The following modules have a command-line interface.\n\n* *note ast: 42b0.\n\n* *note asyncio: 2ed3.\n\n* *note base64: c.\n\n* *note calendar: 21f3.\n\n* *note code: 18.\n\n* *note compileall: 4369.\n\n* *note cProfile: 25.: see *note profile: 3f12.\n\n* *note difflib: 2042.\n\n* *note dis: 437f.\n\n* *note doctest: 36.\n\n* 'encodings.rot13'\n\n* *note ensurepip: 50.\n\n* *note filecmp: 55.\n\n* *note fileinput: 56.\n\n* *note ftplib: 59.\n\n* *note gzip: 2662.\n\n* *note http.server: dc1.\n\n* 'idlelib'\n\n* *note inspect: dcb.\n\n* *note json.tool: 32ae.\n\n* *note mimetypes: 8a.\n\n* *note pdb: a0.\n\n* *note pickle: a1.\n\n* *note pickletools: 43e0.\n\n* *note platform: a5.\n\n* *note poplib: a7.\n\n* *note profile: 3f12.\n\n* *note pstats: ab.\n\n* *note pycompile: 4361.\n\n* *note pyclbr: af.\n\n* *note pydoc: b0.\n\n* *note quopri: b2.\n\n* *note runpy: b9.\n\n* *note site: 4160.\n\n* *note sqlite3: 14a.\n\n* *note sysconfig: 406e.\n\n* *note tabnanny: d7.\n\n* *note tarfile: e3e.\n\n* 'this'\n\n* *note timeit: 3f32.\n\n* *note tokenize: 4335.\n\n* *note trace: 3f4e.\n\n* *note turtledemo: fd.\n\n* *note unittest: 3cc5.\n\n* *note uuid: 14d.\n\n* *note venv: 10c.\n\n* *note webbrowser: 110.\n\n* *note zipapp: 3fcb.\n\n* *note zipfile: 26ca.\n\nSee also the *note Python command-line interface: 172e.\n\nFile: python3.12.info,  Node: Superseded Modules,  Next: Security Considerations<4>,  Prev: Modules command-line interface CLI,  Up: The Python Standard Library\n"
                },
                {
                    "name": "5.36 Superseded Modules",
                    "content": ""
                }
            ]
        },
        "The modules described in this chapter are deprecated and only kept for": {
            "content": "backwards compatibility.  They have been superseded by other modules.\n\n* Menu:\n\n* aifc -- Read and write AIFF and AIFC files::\n* audioop -- Manipulate raw audio data::\n* cgi -- Common Gateway Interface support::\n* cgitb -- Traceback manager for CGI scripts::\n* chunk -- Read IFF chunked data::\n* crypt -- Function to check Unix passwords::\n* imghdr -- Determine the type of an image::\n* mailcap -- Mailcap file handling::\n* msilib -- Read and write Microsoft Installer files::\n* nis -- Interface to Sun's NIS (Yellow Pages): nis -- Interface to Sun's NIS Yellow Pages.\n* nntplib -- NNTP protocol client::\n* optparse -- Parser for command line options::\n* ossaudiodev -- Access to OSS-compatible audio devices::\n* pipes -- Interface to shell pipelines::\n* sndhdr -- Determine type of sound file::\n* spwd -- The shadow password database::\n* sunau -- Read and write Sun AU files::\n* telnetlib -- Telnet client::\n* uu -- Encode and decode uuencode files::\n* xdrlib -- Encode and decode XDR data::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: aifc -- Read and write AIFF and AIFC files,  Next: audioop -- Manipulate raw audio data,  Up: Superseded Modules": {
            "content": "'Source code:' Lib/aifc.py(1)\n",
            "subsections": []
        },
        "This module provides support for reading and writing AIFF and AIFF-C": {
            "content": "files.  AIFF is Audio Interchange File Format, a format for storing\ndigital audio samples in a file.  AIFF-C is a newer version of the\nformat that includes the ability to compress the audio data.\n\nAudio files have a number of parameters that describe the audio data.",
            "subsections": []
        },
        "The sampling rate or frame rate is the number of times per second the": {
            "content": "sound is sampled.  The number of channels indicate if the audio is mono,\nstereo, or quadro.  Each frame consists of one sample per channel.  The\nsample size is the size in bytes of each sample.  Thus a frame consists\nof 'nchannels * samplesize' bytes, and a second's worth of audio\nconsists of 'nchannels * samplesize * framerate' bytes.\n",
            "subsections": []
        },
        "For example, CD quality audio has a sample size of two bytes (16 bits),": {
            "content": "uses two channels (stereo) and has a frame rate of 44,100 frames/second.\nThis gives a frame size of 4 bytes (2*2), and a second's worth occupies\n2*2*44100 bytes (176,400 bytes).\n\nModule *note aifc: 5. defines the following function:\n\n-- Function: aifc.open (file, mode=None)\n\nOpen an AIFF or AIFF-C file and return an object instance with\nmethods that are described below.  The argument 'file' is either a\nstring naming a file or a *note file object: 1037.  'mode' must be\n''r'' or ''rb'' when the file must be opened for reading, or ''w''\nor ''wb'' when the file must be opened for writing.  If omitted,\n'file.mode' is used if it exists, otherwise ''rb'' is used.  When\nused for writing, the file object should be seekable, unless you\nknow ahead of time how many samples you are going to write in total\nand use 'writeframesraw()' and 'setnframes()'.  The *note open():\na25. function may be used in a *note with: 396. statement.  When\nthe 'with' block completes, the *note close(): d83. method is\ncalled.\n\nChanged in version 3.4: Support for the *note with: 396. statement\nwas added.\n\nObjects returned by *note open(): a25. when a file is opened for reading\nhave the following methods:\n\n-- Method: aifc.getnchannels ()\n\nReturn the number of audio channels (1 for mono, 2 for stereo).\n\n-- Method: aifc.getsampwidth ()\n\nReturn the size in bytes of individual samples.\n\n-- Method: aifc.getframerate ()\n\nReturn the sampling rate (number of audio frames per second).\n\n-- Method: aifc.getnframes ()\n\nReturn the number of audio frames in the file.\n\n-- Method: aifc.getcomptype ()\n\nReturn a bytes array of length 4 describing the type of compression\nused in the audio file.  For AIFF files, the returned value is\n'b'NONE''.\n\n-- Method: aifc.getcompname ()\n\nReturn a bytes array convertible to a human-readable description of\nthe type of compression used in the audio file.  For AIFF files,\nthe returned value is 'b'not compressed''.\n\n-- Method: aifc.getparams ()\n\nReturns a *note namedtuple(): 711. '(nchannels, sampwidth,\nframerate, nframes, comptype, compname)', equivalent to output of\nthe 'get*()' methods.\n\n-- Method: aifc.getmarkers ()\n\nReturn a list of markers in the audio file.  A marker consists of a\ntuple of three elements.  The first is the mark ID (an integer),\nthe second is the mark position in frames from the beginning of the\ndata (an integer), the third is the name of the mark (a string).\n\n-- Method: aifc.getmark (id)\n\nReturn the tuple as described in *note getmarkers(): 449b. for the\nmark with the given 'id'.\n\n-- Method: aifc.readframes (nframes)\n\nRead and return the next 'nframes' frames from the audio file.  The\nreturned data is a string containing for each frame the\nuncompressed samples of all channels.\n\n-- Method: aifc.rewind ()\n\nRewind the read pointer.  The next *note readframes(): 449d. will\nstart from the beginning.\n\n-- Method: aifc.setpos (pos)\n\nSeek to the specified frame number.\n\n-- Method: aifc.tell ()\n\nReturn the current frame number.\n\n-- Method: aifc.close ()\n\nClose the AIFF file.  After calling this method, the object can no\nlonger be used.\n\nObjects returned by *note open(): a25. when a file is opened for writing\nhave all the above methods, except for 'readframes()' and 'setpos()'.\nIn addition the following methods exist.  The 'get*()' methods can only\nbe called after the corresponding 'set*()' methods have been called.",
            "subsections": []
        },
        "Before the first 'writeframes()' or 'writeframesraw()', all parameters": {
            "content": "except for the number of frames must be filled in.\n\n-- Method: aifc.aiff ()\n\nCreate an AIFF file.  The default is that an AIFF-C file is\ncreated, unless the name of the file ends in ''.aiff'' in which\ncase the default is an AIFF file.\n\n-- Method: aifc.aifc ()\n\nCreate an AIFF-C file.  The default is that an AIFF-C file is\ncreated, unless the name of the file ends in ''.aiff'' in which\ncase the default is an AIFF file.\n\n-- Method: aifc.setnchannels (nchannels)\n\nSpecify the number of channels in the audio file.\n\n-- Method: aifc.setsampwidth (width)\n\nSpecify the size in bytes of audio samples.\n\n-- Method: aifc.setframerate (rate)\n\nSpecify the sampling frequency in frames per second.\n\n-- Method: aifc.setnframes (nframes)\n\nSpecify the number of frames that are to be written to the audio\nfile.  If this parameter is not set, or not set correctly, the file\nneeds to support seeking.\n\n-- Method: aifc.setcomptype (type, name)\n\nSpecify the compression type.  If not specified, the audio data\nwill not be compressed.  In AIFF files, compression is not\npossible.  The name parameter should be a human-readable\ndescription of the compression type as a bytes array, the type\nparameter should be a bytes array of length 4.  Currently the\nfollowing compression types are supported: 'b'NONE'', 'b'ULAW'',\n'b'ALAW'', 'b'G722''.\n\n-- Method: aifc.setparams (nchannels, sampwidth, framerate, comptype,\ncompname)\n\nSet all the above parameters at once.  The argument is a tuple\nconsisting of the various parameters.  This means that it is\npossible to use the result of a *note getparams(): d82. call as\nargument to *note setparams(): 44a8.\n\n-- Method: aifc.setmark (id, pos, name)\n\nAdd a mark with the given id (larger than 0), and the given name at\nthe given position.  This method can be called at any time before\n*note close(): d83.\n\n-- Method: aifc.tell ()\n\nReturn the current write position in the output file.  Useful in\ncombination with *note setmark(): 44a9.\n\n-- Method: aifc.writeframes (data)\n\nWrite data to the output file.  This method can only be called\nafter the audio file parameters have been set.\n\nChanged in version 3.4: Any *note bytes-like object: b82. is now\naccepted.\n\n-- Method: aifc.writeframesraw (data)\n\nLike *note writeframes(): d85, except that the header of the audio\nfile is not updated.\n\nChanged in version 3.4: Any *note bytes-like object: b82. is now\naccepted.\n\n-- Method: aifc.close ()\n\nClose the AIFF file.  The header of the file is updated to reflect\nthe actual size of the audio data.  After calling this method, the\nobject can no longer be used.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/aifc.py\n\n(2) https://peps.python.org/pep-0594/#aifc\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: audioop -- Manipulate raw audio data,  Next: cgi -- Common Gateway Interface support,  Prev: aifc -- Read and write AIFF and AIFC files,  Up: Superseded Modules": {
            "content": "",
            "subsections": []
        },
        "Changed in version 3.4: Support for 24-bit samples was added.  All": {
            "content": "functions now accept any *note bytes-like object: b82.  String input now\nresults in an immediate error.\n",
            "subsections": []
        },
        "This module provides support for a-LAW, u-LAW and Intel/DVI ADPCM": {
            "content": "encodings.\n\nA few of the more complicated operations only take 16-bit samples,\notherwise the sample size (in bytes) is always a parameter of the\noperation.\n\nThe module defines the following variables and functions:\n\n-- Exception: audioop.error\n\nThis exception is raised on all errors, such as unknown number of\nbytes per sample, etc.\n\n-- Function: audioop.add (fragment1, fragment2, width)\n\nReturn a fragment which is the addition of the two samples passed\nas parameters.  'width' is the sample width in bytes, either '1',\n'2', '3' or '4'.  Both fragments should have the same length.\nSamples are truncated in case of overflow.\n\n-- Function: audioop.adpcm2lin (adpcmfragment, width, state)\n\nDecode an Intel/DVI ADPCM coded fragment to a linear fragment.  See\nthe description of *note lin2adpcm(): 44af. for details on ADPCM\ncoding.  Return a tuple '(sample, newstate)' where the sample has\nthe width specified in 'width'.\n\n-- Function: audioop.alaw2lin (fragment, width)\n\nConvert sound fragments in a-LAW encoding to linearly encoded sound\nfragments.  a-LAW encoding always uses 8 bits samples, so 'width'\nrefers only to the sample width of the output fragment here.\n\n-- Function: audioop.avg (fragment, width)\n\nReturn the average over all samples in the fragment.\n\n-- Function: audioop.avgpp (fragment, width)\n\nReturn the average peak-peak value over all samples in the\nfragment.  No filtering is done, so the usefulness of this routine\nis questionable.\n\n-- Function: audioop.bias (fragment, width, bias)\n\nReturn a fragment that is the original fragment with a bias added\nto each sample.  Samples wrap around in case of overflow.\n\n-- Function: audioop.byteswap (fragment, width)\n\n\"Byteswap\" all samples in a fragment and returns the modified\nfragment.  Converts big-endian samples to little-endian and vice\nversa.\n\nNew in version 3.4.\n\n-- Function: audioop.cross (fragment, width)\n\nReturn the number of zero crossings in the fragment passed as an\nargument.\n\n-- Function: audioop.findfactor (fragment, reference)\n\nReturn a factor 'F' such that 'rms(add(fragment, mul(reference,\n-F)))' is minimal, i.e., return the factor with which you should\nmultiply 'reference' to make it match as well as possible to\n'fragment'.  The fragments should both contain 2-byte samples.\n\nThe time taken by this routine is proportional to 'len(fragment)'.\n\n-- Function: audioop.findfit (fragment, reference)\n\nTry to match 'reference' as well as possible to a portion of\n'fragment' (which should be the longer fragment).  This is\n(conceptually) done by taking slices out of 'fragment', using *note\nfindfactor(): 44b5. to compute the best match, and minimizing the\nresult.  The fragments should both contain 2-byte samples.  Return\na tuple '(offset, factor)' where 'offset' is the (integer) offset\ninto 'fragment' where the optimal match started and 'factor' is the\n(floating-point) factor as per *note findfactor(): 44b5.\n\n-- Function: audioop.findmax (fragment, length)\n\nSearch 'fragment' for a slice of length 'length' samples (not\nbytes!)  with maximum energy, i.e., return 'i' for which\n'rms(fragment[i*2:(i+length)*2])' is maximal.  The fragments should\nboth contain 2-byte samples.\n\nThe routine takes time proportional to 'len(fragment)'.\n\n-- Function: audioop.getsample (fragment, width, index)\n\nReturn the value of sample 'index' from the fragment.\n\n-- Function: audioop.lin2adpcm (fragment, width, state)\n\nConvert samples to 4 bit Intel/DVI ADPCM encoding.  ADPCM coding is\nan adaptive coding scheme, whereby each 4 bit number is the\ndifference between one sample and the next, divided by a (varying)\nstep.  The Intel/DVI ADPCM algorithm has been selected for use by\nthe IMA, so it may well become a standard.\n\n'state' is a tuple containing the state of the coder.  The coder\nreturns a tuple '(adpcmfrag, newstate)', and the 'newstate' should\nbe passed to the next call of *note lin2adpcm(): 44af.  In the\ninitial call, 'None' can be passed as the state.  'adpcmfrag' is\nthe ADPCM coded fragment packed 2 4-bit values per byte.\n\n-- Function: audioop.lin2alaw (fragment, width)\n\nConvert samples in the audio fragment to a-LAW encoding and return\nthis as a bytes object.  a-LAW is an audio encoding format whereby\nyou get a dynamic range of about 13 bits using only 8 bit samples.\nIt is used by the Sun audio hardware, among others.\n\n-- Function: audioop.lin2lin (fragment, width, newwidth)\n\nConvert samples between 1-, 2-, 3- and 4-byte formats.\n\nNote: In some audio formats, such as .WAV files, 16, 24 and 32\nbit samples are signed, but 8 bit samples are unsigned.  So\nwhen converting to 8 bit wide samples for these formats, you\nneed to also add 128 to the result:\n\nnewframes = audioop.lin2lin(frames, oldwidth, 1)\nnewframes = audioop.bias(newframes, 1, 128)\n\nThe same, in reverse, has to be applied when converting from 8\nto 16, 24 or 32 bit width samples.\n\n-- Function: audioop.lin2ulaw (fragment, width)\n\nConvert samples in the audio fragment to u-LAW encoding and return\nthis as a bytes object.  u-LAW is an audio encoding format whereby\nyou get a dynamic range of about 14 bits using only 8 bit samples.\nIt is used by the Sun audio hardware, among others.\n\n-- Function: audioop.max (fragment, width)\n\nReturn the maximum of the 'absolute value' of all samples in a\nfragment.\n\n-- Function: audioop.maxpp (fragment, width)\n\nReturn the maximum peak-peak value in the sound fragment.\n\n-- Function: audioop.minmax (fragment, width)\n\nReturn a tuple consisting of the minimum and maximum values of all\nsamples in the sound fragment.\n\n-- Function: audioop.mul (fragment, width, factor)\n\nReturn a fragment that has all samples in the original fragment\nmultiplied by the floating-point value 'factor'.  Samples are\ntruncated in case of overflow.\n\n-- Function: audioop.ratecv (fragment, width, nchannels, inrate,\noutrate, state[, weightA[, weightB]])\n\nConvert the frame rate of the input fragment.\n\n'state' is a tuple containing the state of the converter.  The\nconverter returns a tuple '(newfragment, newstate)', and 'newstate'\nshould be passed to the next call of *note ratecv(): 44c0.  The\ninitial call should pass 'None' as the state.\n\nThe 'weightA' and 'weightB' arguments are parameters for a simple\ndigital filter and default to '1' and '0' respectively.\n\n-- Function: audioop.reverse (fragment, width)\n\nReverse the samples in a fragment and returns the modified\nfragment.\n\n-- Function: audioop.rms (fragment, width)\n\nReturn the root-mean-square of the fragment, i.e.\n'sqrt(sum(Si^2)/n)'.\n\nThis is a measure of the power in an audio signal.\n\n-- Function: audioop.tomono (fragment, width, lfactor, rfactor)\n\nConvert a stereo fragment to a mono fragment.  The left channel is\nmultiplied by 'lfactor' and the right channel by 'rfactor' before\nadding the two channels to give a mono signal.\n\n-- Function: audioop.tostereo (fragment, width, lfactor, rfactor)\n\nGenerate a stereo fragment from a mono fragment.  Each pair of\nsamples in the stereo fragment are computed from the mono sample,\nwhereby left channel samples are multiplied by 'lfactor' and right\nchannel samples by 'rfactor'.\n\n-- Function: audioop.ulaw2lin (fragment, width)\n\nConvert sound fragments in u-LAW encoding to linearly encoded sound\nfragments.  u-LAW encoding always uses 8 bits samples, so 'width'\nrefers only to the sample width of the output fragment here.\n\nNote that operations such as *note mul(): 44bf. or *note max(): 44bc.\nmake no distinction between mono and stereo fragments, i.e.  all samples\nare treated equal.  If this is a problem the stereo fragment should be\nsplit into two mono fragments first and recombined later.  Here is an\nexample of how to do that:\n\ndef mulstereo(sample, width, lfactor, rfactor):\nlsample = audioop.tomono(sample, width, 1, 0)\nrsample = audioop.tomono(sample, width, 0, 1)\nlsample = audioop.mul(lsample, width, lfactor)\nrsample = audioop.mul(rsample, width, rfactor)\nlsample = audioop.tostereo(lsample, width, 1, 0)\nrsample = audioop.tostereo(rsample, width, 0, 1)\nreturn audioop.add(lsample, rsample, width)\n",
            "subsections": []
        },
        "If you use the ADPCM coder to build network packets and you want your": {
            "content": "protocol to be stateless (i.e.  to be able to tolerate packet loss) you\nshould not only transmit the data but also the state.  Note that you\nshould send the 'initial' state (the one you passed to *note\nlin2adpcm(): 44af.) along to the decoder, not the final state (as\nreturned by the coder).  If you want to use *note struct.Struct: 13e7.\nto store the state in binary you can code the first element (the\npredicted value) in 16 bits and the second (the delta index) in 8.\n",
            "subsections": []
        },
        "The ADPCM coders have never been tried against other ADPCM coders, only": {
            "content": "against themselves.  It could well be that I misinterpreted the\nstandards in which case they will not be interoperable with the\nrespective standards.\n\nThe 'find*()' routines might look a bit funny at first sight.  They are\nprimarily meant to do echo cancellation.  A reasonably fast way to do\nthis is to pick the most energetic piece of the output sample, locate\nthat in the input sample and subtract the whole output sample from the\ninput sample:\n\ndef echocancel(outputdata, inputdata):\npos = audioop.findmax(outputdata, 800)    # one tenth second\nouttest = outputdata[pos*2:]\nintest = inputdata[pos*2:]\nipos, factor = audioop.findfit(intest, outtest)\n# Optional (for better cancellation):\n# factor = audioop.findfactor(intest[ipos*2:ipos*2+len(outtest)],\n#              outtest)\nprefill = '\\0'*(pos+ipos)*2\npostfill = '\\0'*(len(inputdata)-len(prefill)-len(outputdata))\noutputdata = prefill + audioop.mul(outputdata, 2, -factor) + postfill\nreturn audioop.add(inputdata, outputdata, 2)\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0594/#audioop\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: cgi -- Common Gateway Interface support,  Next: cgitb -- Traceback manager for CGI scripts,  Prev: audioop -- Manipulate raw audio data,  Up: Superseded Modules": {
            "content": "'Source code:' Lib/cgi.py(1)\n",
            "subsections": []
        },
        "This module defines a number of utilities for use by CGI scripts written": {
            "content": "in Python.\n",
            "subsections": []
        },
        "The global variable 'maxlen' can be set to an integer indicating the": {
            "content": "maximum size of a POST request.  POST requests larger than this size\nwill result in a *note ValueError: 183. being raised during parsing.",
            "subsections": []
        },
        "The default value of this variable is '0', meaning the request size is": {
            "content": "unlimited.\n\n*note Availability: 1ad3.: not Emscripten, not WASI.\n",
            "subsections": []
        },
        "Most often, CGI scripts live in the server's special 'cgi-bin'": {
            "content": "directory.  The HTTP server places all sorts of information about the\nrequest (such as the client's hostname, the requested URL, the query\nstring, and lots of other goodies) in the script's shell environment,\nexecutes the script, and sends the script's output back to the client.\n",
            "subsections": []
        },
        "The script's input is connected to the client too, and sometimes the": {
            "content": "form data is read this way; at other times the form data is passed via\nthe \"query string\" part of the URL. This module is intended to take care\nof the different cases and provide a simpler interface to the Python\nscript.  It also provides a number of utilities that help in debugging\nscripts, and the latest addition is support for file uploads from a form\n(if your browser supports it).\n",
            "subsections": []
        },
        "The output of a CGI script should consist of two sections, separated by": {
            "content": "a blank line.  The first section contains a number of headers, telling\nthe client what kind of data is following.  Python code to generate a\nminimal header section looks like this:\n\nprint(\"Content-Type: text/html\")    # HTML is following\nprint()                             # blank line, end of headers\n",
            "subsections": []
        },
        "The second section is usually HTML, which allows the client software to": {
            "content": "display nicely formatted text with header, in-line images, etc.  Here's\nPython code that prints a simple piece of HTML:\n\nprint(\"<TITLE>CGI script output</TITLE>\")\nprint(\"<H1>This is my first CGI script</H1>\")\nprint(\"Hello, world!\")\n\nFile: python3.12.info,  Node: Using the cgi module,  Next: Higher Level Interface,  Prev: Introduction<11>,  Up: cgi -- Common Gateway Interface support\n\n5.36.3.2 Using the cgi module\n.............................\n\nBegin by writing 'import cgi'.\n\nWhen you write a new script, consider adding these lines:\n\nimport cgitb\ncgitb.enable()\n",
            "subsections": []
        },
        "This activates a special exception handler that will display detailed": {
            "content": "reports in the web browser if any errors occur.  If you'd rather not\nshow the guts of your program to users of your script, you can have the\nreports saved to files instead, with code like this:\n\nimport cgitb\ncgitb.enable(display=0, logdir=\"/path/to/logdir\")\n",
            "subsections": []
        },
        "It's very helpful to use this feature during script development.  The": {
            "content": "reports produced by *note cgitb: 14. provide information that can save\nyou a lot of time in tracking down bugs.  You can always remove the\n'cgitb' line later when you have tested your script and are confident\nthat it works correctly.\n",
            "subsections": []
        },
        "To get at submitted form data, use the 'FieldStorage' class.  If the": {
            "content": "form contains non-ASCII characters, use the 'encoding' keyword parameter\nset to the value of the encoding defined for the document.  It is\nusually contained in the META tag in the HEAD section of the HTML\ndocument or by the 'Content-Type' header.  This reads the form contents\nfrom the standard input or the environment (depending on the value of\nvarious environment variables set according to the CGI standard).  Since\nit may consume standard input, it should be instantiated only once.\n",
            "subsections": []
        },
        "The 'FieldStorage' instance can be indexed like a Python dictionary.  It": {
            "content": "allows membership testing with the *note in: 250. operator, and also\nsupports the standard dictionary method *note keys(): 5bf. and the\nbuilt-in function *note len(): 3fb.  Form fields containing empty\nstrings are ignored and do not appear in the dictionary; to keep such\nvalues, provide a true value for the optional 'keepblankvalues'\nkeyword parameter when creating the 'FieldStorage' instance.\n",
            "subsections": []
        },
        "For instance, the following code (which assumes that the 'Content-Type'": {
            "content": "header and blank line have already been printed) checks that the fields\n'name' and 'addr' are both set to a non-empty string:\n\nform = cgi.FieldStorage()\nif \"name\" not in form or \"addr\" not in form:\nprint(\"<H1>Error</H1>\")\nprint(\"Please fill in the name and addr fields.\")\nreturn\nprint(\"<p>name:\", form[\"name\"].value)\nprint(\"<p>addr:\", form[\"addr\"].value)\n...further form processing here...\n\nHere the fields, accessed through 'form[key]', are themselves instances\nof 'FieldStorage' (or 'MiniFieldStorage', depending on the form\nencoding).  The 'value' attribute of the instance yields the string\nvalue of the field.  The 'getvalue()' method returns this string value\ndirectly; it also accepts an optional second argument as a default to\nreturn if the requested key is not present.\n",
            "subsections": []
        },
        "If the submitted form data contains more than one field with the same": {
            "content": "name, the object retrieved by 'form[key]' is not a 'FieldStorage' or\n'MiniFieldStorage' instance but a list of such instances.  Similarly, in\nthis situation, 'form.getvalue(key)' would return a list of strings.  If\nyou expect this possibility (when your HTML form contains multiple\nfields with the same name), use the *note getlist(): 44cd. method, which\nalways returns a list of values (so that you do not need to special-case\nthe single item case).  For example, this code concatenates any number\nof username fields, separated by commas:\n\nvalue = form.getlist(\"username\")\nusernames = \",\".join(value)\n",
            "subsections": []
        },
        "If a field represents an uploaded file, accessing the value via the": {
            "content": "'value' attribute or the 'getvalue()' method reads the entire file in\nmemory as bytes.  This may not be what you want.  You can test for an\nuploaded file by testing either the 'filename' attribute or the 'file'\nattribute.  You can then read the data from the 'file' attribute before\nit is automatically closed as part of the garbage collection of the\n'FieldStorage' instance (the *note read(): c7b. and *note readline():\n11a1. methods will return bytes):\n\nfileitem = form[\"userfile\"]\nif fileitem.file:\n# It's an uploaded file; count lines\nlinecount = 0\nwhile True:\nline = fileitem.file.readline()\nif not line: break\nlinecount = linecount + 1\n\n'FieldStorage' objects also support being used in a *note with: 396.\nstatement, which will automatically close them when done.\n",
            "subsections": []
        },
        "If an error is encountered when obtaining the contents of an uploaded": {
            "content": "file (for example, when the user interrupts the form submission by\nclicking on a Back or Cancel button) the 'done' attribute of the object\nfor the field will be set to the value -1.\n",
            "subsections": []
        },
        "The file upload draft standard entertains the possibility of uploading": {
            "content": "multiple files from one field (using a recursive 'multipart/*'\nencoding).  When this occurs, the item will be a dictionary-like\n'FieldStorage' item.  This can be determined by testing its 'type'\nattribute, which should be 'multipart/form-data' (or perhaps another\nMIME type matching 'multipart/*').  In this case, it can be iterated\nover recursively just like the top-level form object.\n\nWhen a form is submitted in the \"old\" format (as the query string or as\na single data part of type 'application/x-www-form-urlencoded'), the\nitems will actually be instances of the class 'MiniFieldStorage'.  In\nthis case, the 'list', 'file', and 'filename' attributes are always\n'None'.\n\nA form submitted via POST that also has a query string will contain both\n'FieldStorage' and 'MiniFieldStorage' items.\n",
            "subsections": []
        },
        "Changed in version 3.4: The 'file' attribute is automatically closed": {
            "content": "upon the garbage collection of the creating 'FieldStorage' instance.\n",
            "subsections": []
        },
        "Changed in version 3.5: Added support for the context management": {
            "content": "protocol to the 'FieldStorage' class.\n\nFile: python3.12.info,  Node: Higher Level Interface,  Next: Functions<14>,  Prev: Using the cgi module,  Up: cgi -- Common Gateway Interface support\n\n5.36.3.3 Higher Level Interface\n...............................\n",
            "subsections": []
        },
        "The previous section explains how to read CGI form data using the": {
            "content": "'FieldStorage' class.  This section describes a higher level interface\nwhich was added to this class to allow one to do it in a more readable\nand intuitive way.  The interface doesn't make the techniques described\nin previous sections obsolete -- they are still useful to process file\nuploads efficiently, for example.\n",
            "subsections": []
        },
        "The interface consists of two simple methods.  Using the methods you can": {
            "content": "process form data in a generic way, without the need to worry whether\nonly one or more values were posted under one name.\n",
            "subsections": []
        },
        "In the previous section, you learned to write following code anytime you": {
            "content": "expected a user to post more than one value under one name:\n\nitem = form.getvalue(\"item\")\nif isinstance(item, list):\n# The user is requesting more than one item.\nelse:\n# The user is requesting only one item.\n",
            "subsections": []
        },
        "This situation is common for example when a form contains a group of": {
            "content": "multiple checkboxes with the same name:\n\n<input type=\"checkbox\" name=\"item\" value=\"1\" />\n<input type=\"checkbox\" name=\"item\" value=\"2\" />\n",
            "subsections": []
        },
        "In most situations, however, there's only one form control with a": {
            "content": "particular name in a form and then you expect and need only one value\nassociated with this name.  So you write a script containing for example\nthis code:\n\nuser = form.getvalue(\"user\").upper()\n",
            "subsections": []
        },
        "The problem with the code is that you should never expect that a client": {
            "content": "will provide valid input to your scripts.  For example, if a curious\nuser appends another 'user=foo' pair to the query string, then the\nscript would crash, because in this situation the 'getvalue(\"user\")'\nmethod call returns a list instead of a string.  Calling the *note\nupper(): 1eda. method on a list is not valid (since lists do not have a\nmethod of this name) and results in an *note AttributeError: 395.\nexception.\n",
            "subsections": []
        },
        "Therefore, the appropriate way to read form data values was to always": {
            "content": "use the code which checks whether the obtained value is a single value\nor a list of values.  That's annoying and leads to less readable\nscripts.\n\nA more convenient approach is to use the methods *note getfirst(): 44cf.\nand *note getlist(): 44cd. provided by this higher level interface.\n\n-- Method: FieldStorage.getfirst (name, default=None)\n\nThis method always returns only one value associated with form\nfield 'name'.  The method returns only the first value in case that\nmore values were posted under such name.  Please note that the\norder in which the values are received may vary from browser to\nbrowser and should not be counted on.  (1)  If no such form field\nor value exists then the method returns the value specified by the\noptional parameter 'default'.  This parameter defaults to 'None' if\nnot specified.\n\n-- Method: FieldStorage.getlist (name)\n\nThis method always returns a list of values associated with form\nfield 'name'.  The method returns an empty list if no such form\nfield or value exists for 'name'.  It returns a list consisting of\none item if only one such value exists.\n\nUsing these methods you can write nice compact code:\n\nimport cgi\nform = cgi.FieldStorage()\nuser = form.getfirst(\"user\", \"\").upper()    # This way it's safe.\nfor item in form.getlist(\"item\"):\ndosomething(item)\n\n---------- Footnotes ----------\n\n(1) Note that some recent versions of the HTML specification do state\nwhat order the field values should be supplied in, but knowing whether a\nrequest was received from a conforming browser, or even from a browser\nat all, is tedious and error-prone.\n\nFile: python3.12.info,  Node: Functions<14>,  Next: Caring about security,  Prev: Higher Level Interface,  Up: cgi -- Common Gateway Interface support\n\n5.36.3.4 Functions\n..................\n",
            "subsections": []
        },
        "These are useful if you want more control, or if you want to employ some": {
            "content": "of the algorithms implemented in this module in other circumstances.\n\n-- Function: cgi.parse (fp=None, environ=os.environ,\nkeepblankvalues=False, strictparsing=False, separator='&')\n\nParse a query in the environment or from a file (the file defaults\nto 'sys.stdin').  The 'keepblankvalues', 'strictparsing' and\n'separator' parameters are passed to *note urllib.parse.parseqs():\n651. unchanged.\n\nDeprecated since version 3.11, will be removed in version 3.13:\nThis function, like the rest of the *note cgi: 13. module, is\ndeprecated.  It can be replaced by calling *note\nurllib.parse.parseqs(): 651. directly on the desired query string\n(except for 'multipart/form-data' input, which can be handled as\ndescribed for *note parsemultipart(): 654.).\n\n-- Function: cgi.parsemultipart (fp, pdict, encoding='utf-8',\nerrors='replace', separator='&')\n\nParse input of type 'multipart/form-data' (for file uploads).\nArguments are 'fp' for the input file, 'pdict' for a dictionary\ncontaining other parameters in the 'Content-Type' header, and\n'encoding', the request encoding.\n\nReturns a dictionary just like *note urllib.parse.parseqs(): 651.:\nkeys are the field names, each value is a list of values for that\nfield.  For non-file fields, the value is a list of strings.\n\nThis is easy to use but not much good if you are expecting\nmegabytes to be uploaded -- in that case, use the 'FieldStorage'\nclass instead which is much more flexible.\n\nChanged in version 3.7: Added the 'encoding' and 'errors'\nparameters.  For non-file fields, the value is now a list of\nstrings, not bytes.\n\nChanged in version 3.10: Added the 'separator' parameter.\n\nDeprecated since version 3.11, will be removed in version 3.13:\nThis function, like the rest of the *note cgi: 13. module, is\ndeprecated.  It can be replaced with the functionality in the *note\nemail: 37. package (e.g.  *note email.message.EmailMessage:\nae8./*note email.message.Message: ae7.) which implements the same\nMIME RFCs, or with the multipart(1) PyPI project.\n\n-- Function: cgi.parseheader (string)\n\nParse a MIME header (such as 'Content-Type') into a main value and\na dictionary of parameters.\n\nDeprecated since version 3.11, will be removed in version 3.13:\nThis function, like the rest of the *note cgi: 13. module, is\ndeprecated.  It can be replaced with the functionality in the *note\nemail: 37. package, which implements the same MIME RFCs.\n\nFor example, with *note email.message.EmailMessage: ae8.:\n\nfrom email.message import EmailMessage\nmsg = EmailMessage()\nmsg['content-type'] = 'application/json; charset=\"utf8\"'\nmain, params = msg.getcontenttype(), msg['content-type'].params\n\n-- Function: cgi.test ()\n\nRobust test CGI script, usable as main program.  Writes minimal\nHTTP headers and formats all information provided to the script in\nHTML format.\n\n-- Function: cgi.printenviron ()\n\nFormat the shell environment in HTML.\n\n-- Function: cgi.printform (form)\n\nFormat a form in HTML.\n\n-- Function: cgi.printdirectory ()\n\nFormat the current directory in HTML.\n\n-- Function: cgi.printenvironusage ()\n\nPrint a list of useful (used by CGI) environment variables in HTML.\n\n---------- Footnotes ----------\n\n(1) https://pypi.org/project/multipart/\n\nFile: python3.12.info,  Node: Caring about security,  Next: Installing your CGI script on a Unix system,  Prev: Functions<14>,  Up: cgi -- Common Gateway Interface support\n\n5.36.3.5 Caring about security\n..............................\n\nThere's one important rule: if you invoke an external program (via *note\nos.system(): 12b2, *note os.popen(): 8b5. or other functions with\nsimilar functionality), make very sure you don't pass arbitrary strings\nreceived from the client to the shell.  This is a well-known security\nhole whereby clever hackers anywhere on the web can exploit a gullible\nCGI script to invoke arbitrary shell commands.  Even parts of the URL or\nfield names cannot be trusted, since the request doesn't have to come\nfrom your form!\n",
            "subsections": []
        },
        "To be on the safe side, if you must pass a string gotten from a form to": {
            "content": "a shell command, you should make sure the string contains only\nalphanumeric characters, dashes, underscores, and periods.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Installing your CGI script on a Unix system,  Next: Testing your CGI script,  Prev: Caring about security,  Up: cgi -- Common Gateway Interface support": {
            "content": "5.36.3.6 Installing your CGI script on a Unix system\n....................................................\n",
            "subsections": []
        },
        "Read the documentation for your HTTP server and check with your local": {
            "content": "system administrator to find the directory where CGI scripts should be\ninstalled; usually this is in a directory 'cgi-bin' in the server tree.\n\nMake sure that your script is readable and executable by \"others\"; the\nUnix file mode should be '0o755' octal (use 'chmod 0755 filename').\nMake sure that the first line of the script contains '#!' starting in\ncolumn 1 followed by the pathname of the Python interpreter, for\ninstance:\n\n#!/usr/local/bin/python\n\nMake sure the Python interpreter exists and is executable by \"others\".\n",
            "subsections": []
        },
        "Make sure that any files your script needs to read or write are readable": {
            "content": "or writable, respectively, by \"others\" -- their mode should be '0o644'\nfor readable and '0o666' for writable.  This is because, for security\nreasons, the HTTP server executes your script as user \"nobody\", without\nany special privileges.  It can only read (write, execute) files that\neverybody can read (write, execute).  The current directory at execution\ntime is also different (it is usually the server's cgi-bin directory)\nand the set of environment variables is also different from what you get\nwhen you log in.  In particular, don't count on the shell's search path\nfor executables ( 'PATH') or the Python module search path ( *note\nPYTHONPATH: e92.) to be set to anything interesting.\n",
            "subsections": []
        },
        "If you need to load modules from a directory which is not on Python's": {
            "content": "default module search path, you can change the path in your script,\nbefore importing other modules.  For example:\n\nimport sys\nsys.path.insert(0, \"/usr/home/joe/lib/python\")\nsys.path.insert(0, \"/usr/local/lib/python\")\n\n(This way, the directory inserted last will be searched first!)\n",
            "subsections": []
        },
        "Instructions for non-Unix systems will vary; check your HTTP server's": {
            "content": "documentation (it will usually have a section on CGI scripts).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Testing your CGI script,  Next: Debugging CGI scripts,  Prev: Installing your CGI script on a Unix system,  Up: cgi -- Common Gateway Interface support": {
            "content": "5.36.3.7 Testing your CGI script\n................................\n",
            "subsections": []
        },
        "Unfortunately, a CGI script will generally not run when you try it from": {
            "content": "the command line, and a script that works perfectly from the command\nline may fail mysteriously when run from the server.  There's one reason\nwhy you should still test your script from the command line: if it\ncontains a syntax error, the Python interpreter won't execute it at all,\nand the HTTP server will most likely send a cryptic error to the client.\n",
            "subsections": []
        },
        "Assuming your script has no syntax errors, yet it does not work, you": {
            "content": "have no choice but to read the next section.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Debugging CGI scripts,  Next: Common problems and solutions,  Prev: Testing your CGI script,  Up: cgi -- Common Gateway Interface support": {
            "content": "5.36.3.8 Debugging CGI scripts\n..............................\n",
            "subsections": []
        },
        "First of all, check for trivial installation errors -- reading the": {
            "content": "section above on installing your CGI script carefully can save you a lot\nof time.  If you wonder whether you have understood the installation\nprocedure correctly, try installing a copy of this module file\n('cgi.py') as a CGI script.  When invoked as a script, the file will\ndump its environment and the contents of the form in HTML format.  Give\nit the right mode etc., and send it a request.  If it's installed in the\nstandard 'cgi-bin' directory, it should be possible to send it a request\nby entering a URL into your browser of the form:\n\nhttp://yourhostname/cgi-bin/cgi.py?name=Joe+Blow&addr=At+Home\n",
            "subsections": []
        },
        "If this gives an error of type 404, the server cannot find the script -": {
            "content": "perhaps you need to install it in a different directory.  If it gives\nanother error, there's an installation problem that you should fix\nbefore trying to go any further.  If you get a nicely formatted listing\nof the environment and form content (in this example, the fields should\nbe listed as \"addr\" with value \"At Home\" and \"name\" with value \"Joe\nBlow\"), the 'cgi.py' script has been installed correctly.  If you follow\nthe same procedure for your own script, you should now be able to debug\nit.\n\nThe next step could be to call the *note cgi: 13. module's *note test():\ndc. function from your script: replace its main code with the single\nstatement\n\ncgi.test()\n",
            "subsections": []
        },
        "This should produce the same results as those gotten from installing the": {
            "content": "'cgi.py' file itself.\n",
            "subsections": []
        },
        "When an ordinary Python script raises an unhandled exception (for": {
            "content": "whatever reason: of a typo in a module name, a file that can't be\nopened, etc.), the Python interpreter prints a nice traceback and exits.",
            "subsections": []
        },
        "While the Python interpreter will still do this when your CGI script": {
            "content": "raises an exception, most likely the traceback will end up in one of the\nHTTP server's log files, or be discarded altogether.\n",
            "subsections": []
        },
        "Fortunately, once you have managed to get your script to execute 'some'": {
            "content": "code, you can easily send tracebacks to the web browser using the *note\ncgitb: 14. module.  If you haven't done so already, just add the lines:\n\nimport cgitb\ncgitb.enable()\n\nto the top of your script.  Then try running it again; when a problem\noccurs, you should see a detailed report that will likely make apparent\nthe cause of the crash.\n\nIf you suspect that there may be a problem in importing the *note cgitb:\n14. module, you can use an even more robust approach (which only uses\nbuilt-in modules):\n\nimport sys\nsys.stderr = sys.stdout\nprint(\"Content-Type: text/plain\")\nprint()\n...your code here...\n",
            "subsections": []
        },
        "This relies on the Python interpreter to print the traceback.  The": {
            "content": "content type of the output is set to plain text, which disables all HTML\nprocessing.  If your script works, the raw HTML will be displayed by\nyour client.  If it raises an exception, most likely after the first two\nlines have been printed, a traceback will be displayed.  Because no HTML\ninterpretation is going on, the traceback will be readable.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Common problems and solutions,  Prev: Debugging CGI scripts,  Up: cgi -- Common Gateway Interface support": {
            "content": "5.36.3.9 Common problems and solutions\n......................................\n\n* Most HTTP servers buffer the output from CGI scripts until the\nscript is completed.  This means that it is not possible to display\na progress report on the client's display while the script is\nrunning.\n\n* Check the installation instructions above.\n\n* Check the HTTP server's log files.  ('tail -f logfile' in a\nseparate window may be useful!)\n\n* Always check a script for syntax errors first, by doing something\nlike 'python script.py'.\n\n* If your script does not have any syntax errors, try adding 'import\ncgitb; cgitb.enable()' to the top of the script.\n\n* When invoking external programs, make sure they can be found.\nUsually, this means using absolute path names -- 'PATH' is usually\nnot set to a very useful value in a CGI script.\n\n* When reading or writing external files, make sure they can be read\nor written by the userid under which your CGI script will be\nrunning: this is typically the userid under which the web server is\nrunning, or some explicitly specified userid for a web server's\n'suexec' feature.\n\n* Don't try to give a CGI script a set-uid mode.  This doesn't work\non most systems, and is a security liability as well.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: cgitb -- Traceback manager for CGI scripts,  Next: chunk -- Read IFF chunked data,  Prev: cgi -- Common Gateway Interface support,  Up: Superseded Modules": {
            "content": "'Source code:' Lib/cgitb.py(1)\n",
            "subsections": []
        },
        "Python scripts.  (Its name is a bit misleading.  It was originally": {
            "content": "designed to display extensive traceback information in HTML for CGI\nscripts.  It was later generalized to also display this information in\nplain text.)  After this module is activated, if an uncaught exception\noccurs, a detailed, formatted report will be displayed.  The report\nincludes a traceback showing excerpts of the source code for each level,\nas well as the values of the arguments and local variables to currently\nrunning functions, to help you debug the problem.  Optionally, you can\nsave this information to a file instead of sending it to the browser.\n\nTo enable this feature, simply add this to the top of your CGI script:\n\nimport cgitb\ncgitb.enable()\n\nThe options to the *note enable(): 44df. function control whether the\nreport is displayed in the browser and whether the report is logged to a\nfile for later analysis.\n\n-- Function: cgitb.enable (display=1, logdir=None, context=5,\nformat='html')\n\nThis function causes the *note cgitb: 14. module to take over the\ninterpreter's default handling for exceptions by setting the value\nof *note sys.excepthook: 5ff.\n\nThe optional argument 'display' defaults to '1' and can be set to\n'0' to suppress sending the traceback to the browser.  If the\nargument 'logdir' is present, the traceback reports are written to\nfiles.  The value of 'logdir' should be a directory where these\nfiles will be placed.  The optional argument 'context' is the\nnumber of lines of context to display around the current line of\nsource code in the traceback; this defaults to '5'.  If the\noptional argument 'format' is '\"html\"', the output is formatted as\nHTML. Any other value forces plain text output.  The default value\nis '\"html\"'.\n\n-- Function: cgitb.text (info, context=5)\n\nThis function handles the exception described by 'info' (a 3-tuple\ncontaining the result of *note sys.excinfo(): 456.), formatting\nits traceback as text and returning the result as a string.  The\noptional argument 'context' is the number of lines of context to\ndisplay around the current line of source code in the traceback;\nthis defaults to '5'.\n\n-- Function: cgitb.html (info, context=5)\n\nThis function handles the exception described by 'info' (a 3-tuple\ncontaining the result of *note sys.excinfo(): 456.), formatting\nits traceback as HTML and returning the result as a string.  The\noptional argument 'context' is the number of lines of context to\ndisplay around the current line of source code in the traceback;\nthis defaults to '5'.\n\n-- Function: cgitb.handler (info=None)\n\nThis function handles an exception using the default settings (that\nis, show a report in the browser, but don't log to a file).  This\ncan be used when you've caught an exception and want to report it\nusing *note cgitb: 14.  The optional 'info' argument should be a\n3-tuple containing an exception type, exception value, and\ntraceback object, exactly like the tuple returned by *note\nsys.excinfo(): 456.  If the 'info' argument is not supplied, the\ncurrent exception is obtained from *note sys.excinfo(): 456.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/cgitb.py\n\n(2) https://peps.python.org/pep-0594/#cgitb\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: chunk -- Read IFF chunked data,  Next: crypt -- Function to check Unix passwords,  Prev: cgitb -- Traceback manager for CGI scripts,  Up: Superseded Modules": {
            "content": "'Source code:' Lib/chunk.py(1)\n",
            "subsections": []
        },
        "This module provides an interface for reading files that use EA IFF 85": {
            "content": "chunks.  (3)  This format is used in at least the Audio Interchange File",
            "subsections": []
        },
        "Format (AIFF/AIFF-C) and the Real Media File Format (RMFF). The WAVE": {
            "content": "audio file format is closely related and can also be read using this\nmodule.\n\nA chunk has the following structure:\n",
            "subsections": []
        },
        "Offset        Length       Contents": {
            "content": "---------------------------------------------------------------\n\n0             4            Chunk ID\n\n\n4             4            Size of chunk in big-endian byte\norder, not including the header\n\n\n8             'n'          Data bytes, where 'n' is the size\ngiven in the preceding field\n\n\n8 + 'n'       0 or 1       Pad byte needed if 'n' is odd and\nchunk alignment is used\n\n\nThe ID is a 4-byte string which identifies the type of chunk.\n",
            "subsections": []
        },
        "The size field (a 32-bit value, encoded using big-endian byte order)": {
            "content": "gives the size of the chunk data, not including the 8-byte header.\n",
            "subsections": []
        },
        "Usually an IFF-type file consists of one or more chunks.  The proposed": {
            "content": "usage of the *note Chunk: 44e5. class defined here is to instantiate an\ninstance at the start of each chunk and read from the instance until it\nreaches the end, after which a new instance can be instantiated.  At the\nend of the file, creating a new instance will fail with an *note\nEOFError: 114e. exception.\n\n-- Class: chunk.Chunk (file, align=True, bigendian=True,\ninclheader=False)\n\nClass which represents a chunk.  The 'file' argument is expected to\nbe a file-like object.  An instance of this class is specifically\nallowed.  The only method that is needed is 'read()'.  If the\nmethods *note seek(): 1105. and *note tell(): 26a2. are present and\ndon't raise an exception, they are also used.  If these methods are\npresent and raise an exception, they are expected to not have\naltered the object.  If the optional argument 'align' is true,\nchunks are assumed to be aligned on 2-byte boundaries.  If 'align'\nis false, no alignment is assumed.  The default value is true.  If\nthe optional argument 'bigendian' is false, the chunk size is\nassumed to be in little-endian order.  This is needed for WAVE\naudio files.  The default value is true.  If the optional argument\n'inclheader' is true, the size given in the chunk header includes\nthe size of the header.  The default value is false.\n\nA *note Chunk: 44e5. object supports the following methods:\n\n-- Method: getname ()\n\nReturns the name (ID) of the chunk.  This is the first 4 bytes\nof the chunk.\n\n-- Method: getsize ()\n\nReturns the size of the chunk.\n\n-- Method: close ()\n\nClose and skip to the end of the chunk.  This does not close\nthe underlying file.\n\nThe remaining methods will raise *note OSError: 613. if called\nafter the *note close(): 44e8. method has been called.  Before\nPython 3.3, they used to raise *note IOError: ecb, now an alias of\n*note OSError: 613.\n\n-- Method: isatty ()\n\nReturns 'False'.\n\n-- Method: seek (pos, whence=0)\n\nSet the chunk's current position.  The 'whence' argument is\noptional and defaults to '0' (absolute file positioning);\nother values are '1' (seek relative to the current position)\nand '2' (seek relative to the file's end).  There is no return\nvalue.  If the underlying file does not allow seek, only\nforward seeks are allowed.\n\n-- Method: tell ()\n\nReturn the current position into the chunk.\n\n-- Method: read (size=-1)\n\nRead at most 'size' bytes from the chunk (less if the read\nhits the end of the chunk before obtaining 'size' bytes).  If\nthe 'size' argument is negative or omitted, read all data\nuntil the end of the chunk.  An empty bytes object is returned\nwhen the end of the chunk is encountered immediately.\n\n-- Method: skip ()\n\nSkip to the end of the chunk.  All further calls to *note\nread(): 44ec. for the chunk will return 'b'''.  If you are not\ninterested in the contents of the chunk, this method should be\ncalled so that the file points to the start of the next chunk.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/chunk.py\n\n(2) https://peps.python.org/pep-0594/#chunk\n\n(3) \"EA IFF 85\" Standard for Interchange Format Files, Jerry\nMorrison, Electronic Arts, January 1985.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: crypt -- Function to check Unix passwords,  Next: imghdr -- Determine the type of an image,  Prev: chunk -- Read IFF chunked data,  Up: Superseded Modules": {
            "content": "'Source code:' Lib/crypt.py(1)\n",
            "subsections": []
        },
        "This module implements an interface to the 'crypt(3)' routine, which is": {
            "content": "a one-way hash function based upon a modified DES algorithm; see the",
            "subsections": []
        },
        "Unix man page for further details.  Possible uses include storing hashed": {
            "content": "passwords so you can check passwords without storing the actual\npassword, or attempting to crack Unix passwords with a dictionary.\n",
            "subsections": []
        },
        "Notice that the behavior of this module depends on the actual": {
            "content": "implementation of the 'crypt(3)' routine in the running system.",
            "subsections": []
        },
        "Therefore, any extensions available on the current implementation will": {
            "content": "also be available on this module.\n\n*note Availability: 1ad3.: Unix, not VxWorks.\n\n*note Availability: 1ad3.: not Emscripten, not WASI.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Hashing Methods,  Next: Module Attributes,  Up: crypt -- Function to check Unix passwords": {
            "content": "5.36.6.1 Hashing Methods\n........................\n\nNew in version 3.3.\n\nThe *note crypt: 26. module defines the list of hashing methods (not all\nmethods are available on all platforms):\n\n-- Data: crypt.METHODSHA512\n\nA Modular Crypt Format method with 16 character salt and 86\ncharacter hash based on the SHA-512 hash function.  This is the\nstrongest method.\n\n-- Data: crypt.METHODSHA256\n\nAnother Modular Crypt Format method with 16 character salt and 43\ncharacter hash based on the SHA-256 hash function.\n\n-- Data: crypt.METHODBLOWFISH\n\nAnother Modular Crypt Format method with 22 character salt and 31\ncharacter hash based on the Blowfish cipher.\n\nNew in version 3.7.\n\n-- Data: crypt.METHODMD5\n\nAnother Modular Crypt Format method with 8 character salt and 22\ncharacter hash based on the MD5 hash function.\n\n-- Data: crypt.METHODCRYPT\n\nThe traditional method with a 2 character salt and 13 characters of\nhash.  This is the weakest method.\n\nFile: python3.12.info,  Node: Module Attributes,  Next: Module Functions<2>,  Prev: Hashing Methods,  Up: crypt -- Function to check Unix passwords\n\n5.36.6.2 Module Attributes\n..........................\n\nNew in version 3.3.\n\n-- Attribute: crypt.methods\n\nA list of available password hashing algorithms, as\n'crypt.METHOD*' objects.  This list is sorted from strongest to\nweakest.\n\nFile: python3.12.info,  Node: Module Functions<2>,  Next: Examples<36>,  Prev: Module Attributes,  Up: crypt -- Function to check Unix passwords\n\n5.36.6.3 Module Functions\n.........................\n\nThe *note crypt: 26. module defines the following functions:\n\n-- Function: crypt.crypt (word, salt=None)\n\n'word' will usually be a user's password as typed at a prompt or in\na graphical interface.  The optional 'salt' is either a string as\nreturned from *note mksalt(): 968, one of the 'crypt.METHOD*'\nvalues (though not all may be available on all platforms), or a\nfull encrypted password including salt, as returned by this\nfunction.  If 'salt' is not provided, the strongest method\navailable in *note methods: 44f6. will be used.\n\nChecking a password is usually done by passing the plain-text\npassword as 'word' and the full results of a previous *note\ncrypt(): 26. call, which should be the same as the results of this\ncall.\n\n'salt' (either a random 2 or 16 character string, possibly prefixed\nwith '$digit$' to indicate the method) which will be used to\nperturb the encryption algorithm.  The characters in 'salt' must be\nin the set '[./a-zA-Z0-9]', with the exception of Modular Crypt\nFormat which prefixes a '$digit$'.\n\nReturns the hashed password as a string, which will be composed of\ncharacters from the same alphabet as the salt.\n\nSince a few 'crypt(3)' extensions allow different values, with\ndifferent sizes in the 'salt', it is recommended to use the full\ncrypted password as salt when checking for a password.\n\nChanged in version 3.3: Accept 'crypt.METHOD*' values in addition\nto strings for 'salt'.\n\n-- Function: crypt.mksalt (method=None, *, rounds=None)\n\nReturn a randomly generated salt of the specified method.  If no\n'method' is given, the strongest method available in *note methods:\n44f6. is used.\n\nThe return value is a string suitable for passing as the 'salt'\nargument to *note crypt(): 26.\n\n'rounds' specifies the number of rounds for 'METHODSHA256',\n'METHODSHA512' and 'METHODBLOWFISH'.  For 'METHODSHA256' and\n'METHODSHA512' it must be an integer between '1000' and\n'999999999', the default is '5000'.  For 'METHODBLOWFISH' it\nmust be a power of two between '16' (2^4) and '2147483648'\n(2^31), the default is '4096' (2^12).\n\nNew in version 3.3.\n\nChanged in version 3.7: Added the 'rounds' parameter.\n\nFile: python3.12.info,  Node: Examples<36>,  Prev: Module Functions<2>,  Up: crypt -- Function to check Unix passwords\n\n5.36.6.4 Examples\n.................\n\nA simple example illustrating typical use (a constant-time comparison\noperation is needed to limit exposure to timing attacks.  *note\nhmac.comparedigest(): f39. is suitable for this purpose):\n\nimport pwd\nimport crypt\nimport getpass\nfrom hmac import comparedigest as comparehash\n\ndef login():\nusername = input('Python login: ')\ncryptedpasswd = pwd.getpwnam(username)[1]\nif cryptedpasswd:\nif cryptedpasswd == 'x' or cryptedpasswd == '*':\nraise ValueError('no support for shadow passwords')\ncleartext = getpass.getpass()\nreturn comparehash(crypt.crypt(cleartext, cryptedpasswd), cryptedpasswd)\nelse:\nreturn True\n",
            "subsections": []
        },
        "To generate a hash of a password using the strongest available method": {
            "content": "and check it against the original:\n\nimport crypt\nfrom hmac import comparedigest as comparehash\n\nhashed = crypt.crypt(plaintext)\nif not comparehash(hashed, crypt.crypt(plaintext, hashed)):\nraise ValueError(\"hashed version doesn't validate against original\")\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: imghdr -- Determine the type of an image,  Next: mailcap -- Mailcap file handling,  Prev: crypt -- Function to check Unix passwords,  Up: Superseded Modules": {
            "content": "'Source code:' Lib/imghdr.py(1)\n",
            "subsections": []
        },
        "The following image types are recognized, as listed below with the": {
            "content": "return value from *note what(): c6d.:\n",
            "subsections": []
        },
        "Value            Image format": {
            "content": "---------------------------------------------------------\n\n''rgb''          SGI ImgLib Files\n\n\n''gif''          GIF 87a and 89a Files\n\n\n''pbm''          Portable Bitmap Files\n\n\n''pgm''          Portable Graymap Files\n\n\n''ppm''          Portable Pixmap Files\n\n\n''tiff''         TIFF Files\n\n\n''rast''         Sun Raster Files\n\n\n''xbm''          X Bitmap Files\n\n\n''jpeg''         JPEG data in JFIF or Exif formats\n\n\n''bmp''          BMP files\n\n\n''png''          Portable Network Graphics\n\n\n''webp''         WebP files\n\n\n''exr''          OpenEXR Files\n\n\nNew in version 3.5: The 'exr' and 'webp' formats were added.\n\nYou can extend the list of file types *note imghdr: 70. can recognize by\nappending to this variable:\n\n-- Data: imghdr.tests\n\nA list of functions performing the individual tests.  Each function\ntakes two arguments: the byte-stream and an open file-like object.\nWhen *note what(): c6d. is called with a byte-stream, the file-like\nobject will be 'None'.\n\nThe test function should return a string describing the image type\nif the test succeeded, or 'None' if it failed.\n\nExample:\n\n>>> import imghdr\n>>> imghdr.what('bass.gif')\n'gif'\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/imghdr.py\n\n(2) https://peps.python.org/pep-0594/#imghdr\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: mailcap -- Mailcap file handling,  Next: msilib -- Read and write Microsoft Installer files,  Prev: imghdr -- Determine the type of an image,  Up: Superseded Modules": {
            "content": "'Source code:' Lib/mailcap.py(1)\n",
            "subsections": []
        },
        "Mailcap files are used to configure how MIME-aware applications such as": {
            "content": "mail readers and web browsers react to files with different MIME types.\n(The name \"mailcap\" is derived from the phrase \"mail capability\".)  For\nexample, a mailcap file might contain a line like 'video/mpeg; xmpeg\n%s'.  Then, if the user encounters an email message or web document with\nthe MIME type 'video/mpeg', '%s' will be replaced by a filename (usually\none belonging to a temporary file) and the 'xmpeg' program can be\nautomatically started to view the file.\n\nThe mailcap format is documented in RFC 1524(3), \"A User Agent\nConfiguration Mechanism For Multimedia Mail Format Information\", but is\nnot an internet standard.  However, mailcap files are supported on most\nUnix systems.\n\n-- Function: mailcap.findmatch (caps, MIMEtype, key='view',\nfilename='/dev/null', plist=[])\n\nReturn a 2-tuple; the first element is a string containing the\ncommand line to be executed (which can be passed to *note\nos.system(): 12b2.), and the second element is the mailcap entry\nfor a given MIME type.  If no matching MIME type can be found,\n'(None, None)' is returned.\n\n'key' is the name of the field desired, which represents the type\nof activity to be performed; the default value is 'view', since in\nthe most common case you simply want to view the body of the\nMIME-typed data.  Other possible values might be 'compose' and\n'edit', if you wanted to create a new body of the given MIME type\nor alter the existing body data.  See RFC 1524(4) for a complete\nlist of these fields.\n\n'filename' is the filename to be substituted for '%s' in the\ncommand line; the default value is ''/dev/null'' which is almost\ncertainly not what you want, so usually you'll override it by\nspecifying a filename.\n\n'plist' can be a list containing named parameters; the default\nvalue is simply an empty list.  Each entry in the list must be a\nstring containing the parameter name, an equals sign (''=''), and\nthe parameter's value.  Mailcap entries can contain named\nparameters like '%{foo}', which will be replaced by the value of\nthe parameter named 'foo'.  For example, if the command line\n'showpartial %{id} %{number} %{total}' was in a mailcap file, and\n'plist' was set to '['id=1', 'number=2', 'total=3']', the resulting\ncommand line would be ''showpartial 1 2 3''.\n\nIn a mailcap file, the \"test\" field can optionally be specified to\ntest some external condition (such as the machine architecture, or\nthe window system in use) to determine whether or not the mailcap\nline applies.  *note findmatch(): 44ff. will automatically check\nsuch conditions and skip the entry if the check fails.\n\nChanged in version 3.11: To prevent security issues with shell\nmetacharacters (symbols that have special effects in a shell\ncommand line), 'findmatch' will refuse to inject ASCII characters\nother than alphanumerics and '@+=:,./-' into the returned command\nline.\n\nIf a disallowed character appears in 'filename', 'findmatch' will\nalways return '(None, None)' as if no entry was found.  If such a\ncharacter appears elsewhere (a value in 'plist' or in 'MIMEtype'),\n'findmatch' will ignore all mailcap entries which use that value.\nA *note warning: 10d. will be raised in either case.\n\n-- Function: mailcap.getcaps ()\n\nReturns a dictionary mapping MIME types to a list of mailcap file\nentries.  This dictionary must be passed to the *note findmatch():\n44ff. function.  An entry is stored as a list of dictionaries, but\nit shouldn't be necessary to know the details of this\nrepresentation.\n\nThe information is derived from all of the mailcap files found on\nthe system.  Settings in the user's mailcap file '$HOME/.mailcap'\nwill override settings in the system mailcap files '/etc/mailcap',\n'/usr/etc/mailcap', and '/usr/local/etc/mailcap'.\n\nAn example usage:\n\n>>> import mailcap\n>>> d = mailcap.getcaps()\n>>> mailcap.findmatch(d, 'video/mpeg', filename='tmp1223')\n('xmpeg tmp1223', {'view': 'xmpeg %s'})\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/mailcap.py\n\n(2) https://peps.python.org/pep-0594/#mailcap\n\n(3) https://datatracker.ietf.org/doc/html/rfc1524.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc1524.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: msilib -- Read and write Microsoft Installer files,  Next: nis -- Interface to Sun's NIS Yellow Pages,  Prev: mailcap -- Mailcap file handling,  Up: Superseded Modules": {
            "content": "'Source code:' Lib/msilib/init.py(1)\n",
            "subsections": []
        },
        "This package aims to provide complete access to all tables in an '.msi'": {
            "content": "file, therefore, it is a fairly low-level API. One primary application\nof this package is the creation of Python installer package itself\n(although that currently uses a different version of 'msilib').\n",
            "subsections": []
        },
        "The package contents can be roughly split into four parts: low-level CAB": {
            "content": "routines, low-level MSI routines, higher-level MSI routines, and\nstandard table structures.\n\n-- Function: msilib.FCICreate (cabname, files)\n\nCreate a new CAB file named 'cabname'.  'files' must be a list of\ntuples, each containing the name of the file on disk, and the name\nof the file inside the CAB file.\n\nThe files are added to the CAB file in the order they appear in the\nlist.  All files are added into a single CAB file, using the MSZIP\ncompression algorithm.\n\nCallbacks to Python for the various steps of MSI creation are\ncurrently not exposed.\n\n-- Function: msilib.UuidCreate ()\n\nReturn the string representation of a new unique identifier.  This\nwraps the Windows API functions 'UuidCreate()' and\n'UuidToString()'.\n\n-- Function: msilib.OpenDatabase (path, persist)\n\nReturn a new database object by calling MsiOpenDatabase.  'path' is\nthe file name of the MSI file; 'persist' can be one of the\nconstants 'MSIDBOPENCREATEDIRECT', 'MSIDBOPENCREATE',\n'MSIDBOPENDIRECT', 'MSIDBOPENREADONLY', or 'MSIDBOPENTRANSACT',\nand may include the flag 'MSIDBOPENPATCHFILE'.  See the Microsoft\ndocumentation for the meaning of these flags; depending on the\nflags, an existing database is opened, or a new one created.\n\n-- Function: msilib.CreateRecord (count)\n\nReturn a new record object by calling 'MSICreateRecord()'.  'count'\nis the number of fields of the record.\n\n-- Function: msilib.initdatabase (name, schema, ProductName,\nProductCode, ProductVersion, Manufacturer)\n\nCreate and return a new database 'name', initialize it with\n'schema', and set the properties 'ProductName', 'ProductCode',\n'ProductVersion', and 'Manufacturer'.\n\n'schema' must be a module object containing 'tables' and\n'Validationrecords' attributes; typically, *note msilib.schema:\n4506. should be used.\n\nThe database will contain just the schema and the validation\nrecords when this function returns.\n\n-- Function: msilib.adddata (database, table, records)\n\nAdd all 'records' to the table named 'table' in 'database'.\n\nThe 'table' argument must be one of the predefined tables in the\nMSI schema, e.g.  ''Feature'', ''File'', ''Component'', ''Dialog'',\n''Control'', etc.\n\n'records' should be a list of tuples, each one containing all\nfields of a record according to the schema of the table.  For\noptional fields, 'None' can be passed.\n\nField values can be ints, strings, or instances of the Binary\nclass.\n\n-- Class: msilib.Binary (filename)\n\nRepresents entries in the Binary table; inserting such an object\nusing *note adddata(): 4507. reads the file named 'filename' into\nthe table.\n\n-- Function: msilib.addtables (database, module)\n\nAdd all table content from 'module' to 'database'.  'module' must\ncontain an attribute 'tables' listing all tables for which content\nshould be added, and one attribute per table that has the actual\ncontent.\n\nThis is typically used to install the sequence tables.\n\n-- Function: msilib.addstream (database, name, path)\n\nAdd the file 'path' into the 'Stream' table of 'database', with\nthe stream name 'name'.\n\n-- Function: msilib.genuuid ()\n\nReturn a new UUID, in the format that MSI typically requires (i.e.\nin curly braces, and with all hexdigits in uppercase).\n\nSee also\n........\n\nFCICreate(3) UuidCreate(4) UuidToString(5)\n\n* Menu:\n\n* Database Objects::\n* View Objects::\n* Summary Information Objects::\n* Record Objects::\n* Errors::\n* CAB Objects::\n* Directory Objects::\n* Features: Features<3>.\n* GUI classes::\n* Precomputed tables::\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/msilib/init.py\n\n(2) https://peps.python.org/pep-0594/#msilib\n\n(3) https://msdn.microsoft.com/en-us/library/bb432265.aspx\n\n(4)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa379205.aspx\n\n(5)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa379352.aspx\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Database Objects,  Next: View Objects,  Up: msilib -- Read and write Microsoft Installer files": {
            "content": "5.36.9.1 Database Objects\n.........................\n\n-- Method: Database.OpenView (sql)\n\nReturn a view object, by calling 'MSIDatabaseOpenView()'.  'sql' is\nthe SQL statement to execute.\n\n-- Method: Database.Commit ()\n\nCommit the changes pending in the current transaction, by calling\n'MSIDatabaseCommit()'.\n\n-- Method: Database.GetSummaryInformation (count)\n\nReturn a new summary information object, by calling\n'MsiGetSummaryInformation()'.  'count' is the maximum number of\nupdated values.\n\n-- Method: Database.Close ()\n\nClose the database object, through 'MsiCloseHandle()'.\n\nNew in version 3.7.\n\nSee also\n........\n\nMSIDatabaseOpenView(1) MSIDatabaseCommit(2) MSIGetSummaryInformation(3)",
            "subsections": []
        },
        "MsiCloseHandle(4)": {
            "content": "---------- Footnotes ----------\n\n(1)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa370082.aspx\n\n(2)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa370075.aspx\n\n(3)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa370301.aspx\n\n(4)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa370067.aspx\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: View Objects,  Next: Summary Information Objects,  Prev: Database Objects,  Up: msilib -- Read and write Microsoft Installer files": {
            "content": "5.36.9.2 View Objects\n.....................\n\n-- Method: View.Execute (params)\n\nExecute the SQL query of the view, through 'MSIViewExecute()'.  If\n'params' is not 'None', it is a record describing actual values of\nthe parameter tokens in the query.\n\n-- Method: View.GetColumnInfo (kind)\n\nReturn a record describing the columns of the view, through calling\n'MsiViewGetColumnInfo()'.  'kind' can be either 'MSICOLINFONAMES'\nor 'MSICOLINFOTYPES'.\n\n-- Method: View.Fetch ()\n\nReturn a result record of the query, through calling\n'MsiViewFetch()'.\n\n-- Method: View.Modify (kind, data)\n\nModify the view, by calling 'MsiViewModify()'.  'kind' can be one\nof 'MSIMODIFYSEEK', 'MSIMODIFYREFRESH', 'MSIMODIFYINSERT',\n'MSIMODIFYUPDATE', 'MSIMODIFYASSIGN', 'MSIMODIFYREPLACE',\n'MSIMODIFYMERGE', 'MSIMODIFYDELETE',\n'MSIMODIFYINSERTTEMPORARY', 'MSIMODIFYVALIDATE',\n'MSIMODIFYVALIDATENEW', 'MSIMODIFYVALIDATEFIELD', or\n'MSIMODIFYVALIDATEDELETE'.\n\n'data' must be a record describing the new data.\n\n-- Method: View.Close ()\n\nClose the view, through 'MsiViewClose()'.\n\nSee also\n........\n",
            "subsections": []
        },
        "MsiViewExecute(1) MSIViewGetColumnInfo(2) MsiViewFetch(3)": {
            "content": "",
            "subsections": []
        },
        "MsiViewModify(4) MsiViewClose(5)": {
            "content": "---------- Footnotes ----------\n\n(1)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa370513.aspx\n\n(2)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa370516.aspx\n\n(3)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa370514.aspx\n\n(4)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa370519.aspx\n\n(5)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa370510.aspx\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Summary Information Objects,  Next: Record Objects,  Prev: View Objects,  Up: msilib -- Read and write Microsoft Installer files": {
            "content": "5.36.9.3 Summary Information Objects\n....................................\n\n-- Method: SummaryInformation.GetProperty (field)\n\nReturn a property of the summary, through\n'MsiSummaryInfoGetProperty()'.  'field' is the name of the\nproperty, and can be one of the constants 'PIDCODEPAGE',\n'PIDTITLE', 'PIDSUBJECT', 'PIDAUTHOR', 'PIDKEYWORDS',\n'PIDCOMMENTS', 'PIDTEMPLATE', 'PIDLASTAUTHOR', 'PIDREVNUMBER',\n'PIDLASTPRINTED', 'PIDCREATEDTM', 'PIDLASTSAVEDTM',\n'PIDPAGECOUNT', 'PIDWORDCOUNT', 'PIDCHARCOUNT', 'PIDAPPNAME',\nor 'PIDSECURITY'.\n\n-- Method: SummaryInformation.GetPropertyCount ()\n\nReturn the number of summary properties, through\n'MsiSummaryInfoGetPropertyCount()'.\n\n-- Method: SummaryInformation.SetProperty (field, value)\n\nSet a property through 'MsiSummaryInfoSetProperty()'.  'field' can\nhave the same values as in *note GetProperty(): 1761, 'value' is\nthe new value of the property.  Possible value types are integer\nand string.\n\n-- Method: SummaryInformation.Persist ()\n\nWrite the modified properties to the summary information stream,\nusing 'MsiSummaryInfoPersist()'.\n\nSee also\n........\n",
            "subsections": []
        },
        "MsiSummaryInfoGetProperty(1) MsiSummaryInfoGetPropertyCount(2)": {
            "content": "",
            "subsections": []
        },
        "MsiSummaryInfoSetProperty(3) MsiSummaryInfoPersist(4)": {
            "content": "---------- Footnotes ----------\n\n(1)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa370409.aspx\n\n(2)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa370488.aspx\n\n(3)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa370491.aspx\n\n(4)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa370490.aspx\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Record Objects,  Next: Errors,  Prev: Summary Information Objects,  Up: msilib -- Read and write Microsoft Installer files": {
            "content": "5.36.9.4 Record Objects\n.......................\n\n-- Method: Record.GetFieldCount ()\n\nReturn the number of fields of the record, through\n'MsiRecordGetFieldCount()'.\n\n-- Method: Record.GetInteger (field)\n\nReturn the value of 'field' as an integer where possible.  'field'\nmust be an integer.\n\n-- Method: Record.GetString (field)\n\nReturn the value of 'field' as a string where possible.  'field'\nmust be an integer.\n\n-- Method: Record.SetString (field, value)\n\nSet 'field' to 'value' through 'MsiRecordSetString()'.  'field'\nmust be an integer; 'value' a string.\n\n-- Method: Record.SetStream (field, value)\n\nSet 'field' to the contents of the file named 'value', through\n'MsiRecordSetStream()'.  'field' must be an integer; 'value' a\nstring.\n\n-- Method: Record.SetInteger (field, value)\n\nSet 'field' to 'value' through 'MsiRecordSetInteger()'.  Both\n'field' and 'value' must be an integer.\n\n-- Method: Record.ClearData ()\n\nSet all fields of the record to 0, through 'MsiRecordClearData()'.\n\nSee also\n........\n",
            "subsections": []
        },
        "MsiRecordGetFieldCount(1) MsiRecordSetString(2) MsiRecordSetStream(3)": {
            "content": "",
            "subsections": []
        },
        "MsiRecordSetInteger(4) MsiRecordClearData(5)": {
            "content": "---------- Footnotes ----------\n\n(1)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa370366.aspx\n\n(2)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa370373.aspx\n\n(3)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa370372.aspx\n\n(4)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa370371.aspx\n\n(5)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa370364.aspx\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Errors,  Next: CAB Objects,  Prev: Record Objects,  Up: msilib -- Read and write Microsoft Installer files": {
            "content": "5.36.9.5 Errors\n...............\n",
            "subsections": []
        },
        "All wrappers around MSI functions raise 'MSIError'; the string inside": {
            "content": "the exception will contain more detail.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: CAB Objects,  Next: Directory Objects,  Prev: Errors,  Up: msilib -- Read and write Microsoft Installer files": {
            "content": "5.36.9.6 CAB Objects\n....................\n\n-- Class: msilib.CAB (name)\n\nThe class *note CAB: 4527. represents a CAB file.  During MSI\nconstruction, files will be added simultaneously to the 'Files'\ntable, and to a CAB file.  Then, when all files have been added,\nthe CAB file can be written, then added to the MSI file.\n\n'name' is the name of the CAB file in the MSI file.\n\n-- Method: append (full, file, logical)\n\nAdd the file with the pathname 'full' to the CAB file, under\nthe name 'logical'.  If there is already a file named\n'logical', a new file name is created.\n\nReturn the index of the file in the CAB file, and the new name\nof the file inside the CAB file.\n\n-- Method: commit (database)\n\nGenerate a CAB file, add it as a stream to the MSI file, put\nit into the 'Media' table, and remove the generated file from\nthe disk.\n\nFile: python3.12.info,  Node: Directory Objects,  Next: Features<3>,  Prev: CAB Objects,  Up: msilib -- Read and write Microsoft Installer files\n\n5.36.9.7 Directory Objects\n..........................\n\n-- Class: msilib.Directory (database, cab, basedir, physical, logical,\ndefault[, componentflags])\n\nCreate a new directory in the Directory table.  There is a current\ncomponent at each point in time for the directory, which is either\nexplicitly created through *note startcomponent(): 1762, or\nimplicitly when files are added for the first time.  Files are\nadded into the current component, and into the cab file.  To create\na directory, a base directory object needs to be specified (can be\n'None'), the path to the physical directory, and a logical\ndirectory name.  'default' specifies the DefaultDir slot in the\ndirectory table.  'componentflags' specifies the default flags that\nnew components get.\n\n-- Method: startcomponent (component=None, feature=None,\nflags=None, keyfile=None, uuid=None)\n\nAdd an entry to the Component table, and make this component\nthe current component for this directory.  If no component\nname is given, the directory name is used.  If no 'feature' is\ngiven, the current feature is used.  If no 'flags' are given,\nthe directory's default flags are used.  If no 'keyfile' is\ngiven, the KeyPath is left null in the Component table.\n\n-- Method: addfile (file, src=None, version=None, language=None)\n\nAdd a file to the current component of the directory, starting\na new one if there is no current component.  By default, the\nfile name in the source and the file table will be identical.\nIf the 'src' file is specified, it is interpreted relative to\nthe current directory.  Optionally, a 'version' and a\n'language' can be specified for the entry in the File table.\n\n-- Method: glob (pattern, exclude=None)\n\nAdd a list of files to the current component as specified in\nthe glob pattern.  Individual files can be excluded in the\n'exclude' list.\n\n-- Method: removepyc ()\n\nRemove '.pyc' files on uninstall.\n\nSee also\n........\n",
            "subsections": []
        },
        "Directory Table(1) File Table(2) Component Table(3) FeatureComponents": {
            "content": "",
            "subsections": []
        },
        "Table(4)": {
            "content": "---------- Footnotes ----------\n\n(1)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa368295.aspx\n\n(2)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa368596.aspx\n\n(3)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa368007.aspx\n\n(4)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa368579.aspx\n\nFile: python3.12.info,  Node: Features<3>,  Next: GUI classes,  Prev: Directory Objects,  Up: msilib -- Read and write Microsoft Installer files\n\n5.36.9.8 Features\n.................\n\n-- Class: msilib.Feature (db, id, title, desc, display, level=1,\nparent=None, directory=None, attributes=0)\n\nAdd a new record to the 'Feature' table, using the values 'id',\n'parent.id', 'title', 'desc', 'display', 'level', 'directory', and\n'attributes'.  The resulting feature object can be passed to the\n'startcomponent()' method of *note Directory: 452c.\n\n-- Method: setcurrent ()\n\nMake this feature the current feature of *note msilib: 8d.\nNew components are automatically added to the default feature,\nunless a feature is explicitly specified.\n\nSee also\n........\n",
            "subsections": []
        },
        "Feature Table(1)": {
            "content": "---------- Footnotes ----------\n\n(1)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa368585.aspx\n\nFile: python3.12.info,  Node: GUI classes,  Next: Precomputed tables,  Prev: Features<3>,  Up: msilib -- Read and write Microsoft Installer files\n\n5.36.9.9 GUI classes\n....................\n\n*note msilib: 8d. provides several classes that wrap the GUI tables in\nan MSI database.  However, no standard user interface is provided.\n\n-- Class: msilib.Control (dlg, name)\n\nBase class of the dialog controls.  'dlg' is the dialog object the\ncontrol belongs to, and 'name' is the control's name.\n\n-- Method: event (event, argument, condition=1, ordering=None)\n\nMake an entry into the 'ControlEvent' table for this control.\n\n-- Method: mapping (event, attribute)\n\nMake an entry into the 'EventMapping' table for this control.\n\n-- Method: condition (action, condition)\n\nMake an entry into the 'ControlCondition' table for this\ncontrol.\n\n-- Class: msilib.RadioButtonGroup (dlg, name, property)\n\nCreate a radio button control named 'name'.  'property' is the\ninstaller property that gets set when a radio button is selected.\n\n-- Method: add (name, x, y, width, height, text, value=None)\n\nAdd a radio button named 'name' to the group, at the\ncoordinates 'x', 'y', 'width', 'height', and with the label\n'text'.  If 'value' is 'None', it defaults to 'name'.\n\n-- Class: msilib.Dialog (db, name, x, y, w, h, attr, title, first,\ndefault, cancel)\n\nReturn a new *note Dialog: 453c. object.  An entry in the 'Dialog'\ntable is made, with the specified coordinates, dialog attributes,\ntitle, name of the first, default, and cancel controls.\n\n-- Method: control (name, type, x, y, width, height, attributes,\nproperty, text, controlnext, help)\n\nReturn a new *note Control: 4536. object.  An entry in the\n'Control' table is made with the specified parameters.\n\nThis is a generic method; for specific types, specialized\nmethods are provided.\n\n-- Method: text (name, x, y, width, height, attributes, text)\n\nAdd and return a 'Text' control.\n\n-- Method: bitmap (name, x, y, width, height, text)\n\nAdd and return a 'Bitmap' control.\n\n-- Method: line (name, x, y, width, height)\n\nAdd and return a 'Line' control.\n\n-- Method: pushbutton (name, x, y, width, height, attributes,\ntext, nextcontrol)\n\nAdd and return a 'PushButton' control.\n\n-- Method: radiogroup (name, x, y, width, height, attributes,\nproperty, text, nextcontrol)\n\nAdd and return a 'RadioButtonGroup' control.\n\n-- Method: checkbox (name, x, y, width, height, attributes,\nproperty, text, nextcontrol)\n\nAdd and return a 'CheckBox' control.\n\nSee also\n........\n",
            "subsections": []
        },
        "Dialog Table(1) Control Table(2) Control Types(3) ControlCondition": {
            "content": "",
            "subsections": []
        },
        "Table(4) ControlEvent Table(5) EventMapping Table(6) RadioButton": {
            "content": "",
            "subsections": []
        },
        "Table(7)": {
            "content": "---------- Footnotes ----------\n\n(1)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa368286.aspx\n\n(2)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa368044.aspx\n\n(3)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa368039.aspx\n\n(4)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa368035.aspx\n\n(5)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa368037.aspx\n\n(6)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa368559.aspx\n\n(7)\nhttps://msdn.microsoft.com/en-us/library/windows/desktop/aa370962.aspx\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Precomputed tables,  Prev: GUI classes,  Up: msilib -- Read and write Microsoft Installer files": {
            "content": "5.36.9.10 Precomputed tables\n............................\n\n*note msilib: 8d. provides a few subpackages that contain only schema\nand table definitions.  Currently, these definitions are based on MSI\nversion 2.0.\n\n-- Data: msilib.schema\n\nThis is the standard MSI schema for MSI 2.0, with the 'tables'\nvariable providing a list of table definitions, and\n'Validationrecords' providing the data for MSI validation.\n\n-- Data: msilib.sequence\n\nThis module contains table contents for the standard sequence\ntables: 'AdminExecuteSequence', 'AdminUISequence',\n'AdvtExecuteSequence', 'InstallExecuteSequence', and\n'InstallUISequence'.\n\n-- Data: msilib.text\n\nThis module contains definitions for the UIText and ActionText\ntables, for the standard installer actions.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: nis -- Interface to Sun's NIS Yellow Pages,  Next: nntplib -- NNTP protocol client,  Prev: msilib -- Read and write Microsoft Installer files,  Up: Superseded Modules": {
            "content": "",
            "subsections": []
        },
        "Because NIS exists only on Unix systems, this module is only available": {
            "content": "for Unix.\n\n*note Availability: 1ad3.: not Emscripten, not WASI.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: nntplib -- NNTP protocol client,  Next: optparse -- Parser for command line options,  Prev: nis -- Interface to Sun's NIS Yellow Pages,  Up: Superseded Modules": {
            "content": "'Source code:' Lib/nntplib.py(1)\n\nDeprecated since version 3.11: The *note nntplib: 98. module is\ndeprecated (see PEP 594(2) for details).\n\n\n\nThis module defines the class *note NNTP: 733. which implements the\nclient side of the Network News Transfer Protocol.  It can be used to\nimplement a news reader or poster, or automated news processors.  It is\ncompatible with RFC 3977(3) as well as the older RFC 977(4) and RFC\n2980(5).\n\n*note Availability: 1ad3.: not Emscripten, not WASI.\n",
            "subsections": []
        },
        "Here are two small examples of how it can be used.  To list some": {
            "content": "statistics about a newsgroup and print the subjects of the last 10\narticles:\n\n>>> s = nntplib.NNTP('news.gmane.io')\n>>> resp, count, first, last, name = s.group('gmane.comp.python.committers')\n>>> print('Group', name, 'has', count, 'articles, range', first, 'to', last)\nGroup gmane.comp.python.committers has 1096 articles, range 1 to 1096\n>>> resp, overviews = s.over((last - 9, last))\n>>> for id, over in overviews:\n...     print(id, nntplib.decodeheader(over['subject']))\n...\n1087 Re: Commit privileges for ??ukasz Langa\n1088 Re: 3.2 alpha 2 freeze\n1089 Re: 3.2 alpha 2 freeze\n1090 Re: Commit privileges for ??ukasz Langa\n1091 Re: Commit privileges for ??ukasz Langa\n1092 Updated ssh key\n1093 Re: Updated ssh key\n1094 Re: Updated ssh key\n1095 Hello fellow committers!\n1096 Re: Hello fellow committers!\n>>> s.quit()\n'205 Bye!'\n",
            "subsections": []
        },
        "To post an article from a binary file (this assumes that the article has": {
            "content": "valid headers, and that you have right to post on the particular\nnewsgroup):\n\n>>> s = nntplib.NNTP('news.gmane.io')\n>>> f = open('article.txt', 'rb')\n>>> s.post(f)\n'240 Article posted successfully.'\n>>> s.quit()\n'205 Bye!'\n\nThe module itself defines the following classes:\n\n-- Class: nntplib.NNTP (host, port=119, user=None, password=None,\nreadermode=None, usenetrc=False[, timeout])\n\nReturn a new *note NNTP: 733. object, representing a connection to\nthe NNTP server running on host 'host', listening at port 'port'.\nAn optional 'timeout' can be specified for the socket connection.\nIf the optional 'user' and 'password' are provided, or if suitable\ncredentials are present in '/.netrc' and the optional flag\n'usenetrc' is true, the 'AUTHINFO USER' and 'AUTHINFO PASS'\ncommands are used to identify and authenticate the user to the\nserver.  If the optional flag 'readermode' is true, then a 'mode\nreader' command is sent before authentication is performed.  Reader\nmode is sometimes necessary if you are connecting to an NNTP server\non the local machine and intend to call reader-specific commands,\nsuch as 'group'.  If you get unexpected *note NNTPPermanentError:\n454f.s, you might need to set 'readermode'.  The *note NNTP: 733.\nclass supports the *note with: 396. statement to unconditionally\nconsume *note OSError: 613. exceptions and to close the NNTP\nconnection when done, e.g.:\n\n>>> from nntplib import NNTP\n>>> with NNTP('news.gmane.io') as n:\n...     n.group('gmane.comp.python.committers')\n...\n('211 1755 1 1755 gmane.comp.python.committers', 1755, 1, 1755, 'gmane.comp.python.committers')\n>>>\n\nRaises an *note auditing event: 161d. 'nntplib.connect' with\narguments 'self', 'host', 'port'.\n\nAll commands will raise an *note auditing event: 161d.\n'nntplib.putline' with arguments 'self' and 'line', where 'line' is\nthe bytes about to be sent to the remote host.\n\nChanged in version 3.2: 'usenetrc' is now 'False' by default.\n\nChanged in version 3.3: Support for the *note with: 396. statement\nwas added.\n\nChanged in version 3.9: If the 'timeout' parameter is set to be\nzero, it will raise a *note ValueError: 183. to prevent the\ncreation of a non-blocking socket.\n\n-- Class: nntplib.NNTPSSL (host, port=563, user=None, password=None,\nsslcontext=None, readermode=None, usenetrc=False[, timeout])\n\nReturn a new *note NNTPSSL: 734. object, representing an encrypted\nconnection to the NNTP server running on host 'host', listening at\nport 'port'.  *note NNTPSSL: 734. objects have the same methods as\n*note NNTP: 733. objects.  If 'port' is omitted, port 563 (NNTPS)\nis used.  'sslcontext' is also optional, and is a *note\nSSLContext: 278. object.  Please read *note Security\nconsiderations: 2f9c. for best practices.  All other parameters\nbehave the same as for *note NNTP: 733.\n\nNote that SSL-on-563 is discouraged per RFC 4642(6), in favor of\nSTARTTLS as described below.  However, some servers only support\nthe former.\n\nRaises an *note auditing event: 161d. 'nntplib.connect' with\narguments 'self', 'host', 'port'.\n\nAll commands will raise an *note auditing event: 161d.\n'nntplib.putline' with arguments 'self' and 'line', where 'line' is\nthe bytes about to be sent to the remote host.\n\nNew in version 3.2.\n\nChanged in version 3.4: The class now supports hostname check with\n*note ssl.SSLContext.checkhostname: 30ba. and 'Server Name\nIndication' (see *note ssl.HASSNI: 30c7.).\n\nChanged in version 3.9: If the 'timeout' parameter is set to be\nzero, it will raise a *note ValueError: 183. to prevent the\ncreation of a non-blocking socket.\n\n-- Exception: nntplib.NNTPError\n\nDerived from the standard exception *note Exception: 7ff, this is\nthe base class for all exceptions raised by the *note nntplib: 98.\nmodule.  Instances of this class have the following attribute:\n\n-- Attribute: response\n\nThe response of the server if available, as a *note str: 157.\nobject.\n\n-- Exception: nntplib.NNTPReplyError\n\nException raised when an unexpected reply is received from the\nserver.\n\n-- Exception: nntplib.NNTPTemporaryError\n\nException raised when a response code in the range 400-499 is\nreceived.\n\n-- Exception: nntplib.NNTPPermanentError\n\nException raised when a response code in the range 500-599 is\nreceived.\n\n-- Exception: nntplib.NNTPProtocolError\n\nException raised when a reply is received from the server that does\nnot begin with a digit in the range 1-5.\n\n-- Exception: nntplib.NNTPDataError\n\nException raised when there is some error in the response data.\n\n* Menu:\n\n* NNTP Objects::\n* Utility functions: Utility functions<2>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/nntplib.py\n\n(2) https://peps.python.org/pep-0594/\n\n(3) https://datatracker.ietf.org/doc/html/rfc3977.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc977.html\n\n(5) https://datatracker.ietf.org/doc/html/rfc2980.html\n\n(6) https://datatracker.ietf.org/doc/html/rfc4642.html\n\nFile: python3.12.info,  Node: NNTP Objects,  Next: Utility functions<2>,  Up: nntplib -- NNTP protocol client\n\n5.36.11.1 NNTP Objects\n......................\n\nWhen connected, *note NNTP: 733. and *note NNTPSSL: 734. objects\nsupport the following methods and attributes.\n\n* Menu:\n\n* Attributes: Attributes<2>.\n* Methods: Methods<3>.\n\nFile: python3.12.info,  Node: Attributes<2>,  Next: Methods<3>,  Up: NNTP Objects\n\n5.36.11.2 Attributes\n....................\n\n-- Attribute: NNTP.nntpversion\n\nAn integer representing the version of the NNTP protocol supported\nby the server.  In practice, this should be '2' for servers\nadvertising RFC 3977(1) compliance and '1' for others.\n\nNew in version 3.2.\n\n-- Attribute: NNTP.nntpimplementation\n\nA string describing the software name and version of the NNTP\nserver, or *note None: 43f. if not advertised by the server.\n\nNew in version 3.2.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc3977.html\n\nFile: python3.12.info,  Node: Methods<3>,  Prev: Attributes<2>,  Up: NNTP Objects\n\n5.36.11.3 Methods\n.................\n",
            "subsections": []
        },
        "The 'response' that is returned as the first item in the return tuple of": {
            "content": "almost all methods is the server's response: a string beginning with a\nthree-digit code.  If the server's response indicates an error, the\nmethod raises one of the above exceptions.\n",
            "subsections": []
        },
        "Many of the following methods take an optional keyword-only argument": {
            "content": "'file'.  When the 'file' argument is supplied, it must be either a *note\nfile object: 1037. opened for binary writing, or the name of an on-disk\nfile to be written to.  The method will then write any data returned by\nthe server (except for the response line and the terminating dot) to the\nfile; any list of lines, tuples or objects that the method normally\nreturns will be empty.\n",
            "subsections": []
        },
        "Changed in version 3.2: Many of the following methods have been reworked": {
            "content": "and fixed, which makes them incompatible with their 3.1 counterparts.\n\n-- Method: NNTP.quit ()\n\nSend a 'QUIT' command and close the connection.  Once this method\nhas been called, no other methods of the NNTP object should be\ncalled.\n\n-- Method: NNTP.getwelcome ()\n\nReturn the welcome message sent by the server in reply to the\ninitial connection.  (This message sometimes contains disclaimers\nor help information that may be relevant to the user.)\n\n-- Method: NNTP.getcapabilities ()\n\nReturn the RFC 3977(1) capabilities advertised by the server, as a\n*note dict: 237. instance mapping capability names to (possibly\nempty) lists of values.  On legacy servers which don't understand\nthe 'CAPABILITIES' command, an empty dictionary is returned\ninstead.\n\n>>> s = NNTP('news.gmane.io')\n>>> 'POST' in s.getcapabilities()\nTrue\n\nNew in version 3.2.\n\n-- Method: NNTP.login (user=None, password=None, usenetrc=True)\n\nSend 'AUTHINFO' commands with the user name and password.  If\n'user' and 'password' are 'None' and 'usenetrc' is true,\ncredentials from '~/.netrc' will be used if possible.\n\nUnless intentionally delayed, login is normally performed during\nthe *note NNTP: 733. object initialization and separately calling\nthis function is unnecessary.  To force authentication to be\ndelayed, you must not set 'user' or 'password' when creating the\nobject, and must set 'usenetrc' to False.\n\nNew in version 3.2.\n\n-- Method: NNTP.starttls (context=None)\n\nSend a 'STARTTLS' command.  This will enable encryption on the NNTP\nconnection.  The 'context' argument is optional and should be a\n*note ssl.SSLContext: 278. object.  Please read *note Security\nconsiderations: 2f9c. for best practices.\n\nNote that this may not be done after authentication information has\nbeen transmitted, and authentication occurs by default if possible\nduring a *note NNTP: 733. object initialization.  See *note\nNNTP.login(): 455f. for information on suppressing this behavior.\n\nNew in version 3.2.\n\nChanged in version 3.4: The method now supports hostname check with\n*note ssl.SSLContext.checkhostname: 30ba. and 'Server Name\nIndication' (see *note ssl.HASSNI: 30c7.).\n\n-- Method: NNTP.newgroups (date, *, file=None)\n\nSend a 'NEWGROUPS' command.  The 'date' argument should be a *note\ndatetime.date: 70f. or *note datetime.datetime: 222. object.\nReturn a pair '(response, groups)' where 'groups' is a list\nrepresenting the groups that are new since the given 'date'.  If\n'file' is supplied, though, then 'groups' will be empty.\n\n>>> from datetime import date, timedelta\n>>> resp, groups = s.newgroups(date.today() - timedelta(days=3))\n>>> len(groups)\n85\n>>> groups[0]\nGroupInfo(group='gmane.network.tor.devel', last='4', first='1', flag='m')\n\n-- Method: NNTP.newnews (group, date, *, file=None)\n\nSend a 'NEWNEWS' command.  Here, 'group' is a group name or ''*'',\nand 'date' has the same meaning as for *note newgroups(): 4560.\nReturn a pair '(response, articles)' where 'articles' is a list of\nmessage ids.\n\nThis command is frequently disabled by NNTP server administrators.\n\n-- Method: NNTP.list (grouppattern=None, *, file=None)\n\nSend a 'LIST' or 'LIST ACTIVE' command.  Return a pair '(response,\nlist)' where 'list' is a list of tuples representing all the groups\navailable from this NNTP server, optionally matching the pattern\nstring 'grouppattern'.  Each tuple has the form '(group, last,\nfirst, flag)', where 'group' is a group name, 'last' and 'first'\nare the last and first article numbers, and 'flag' usually takes\none of these values:\n\n* 'y': Local postings and articles from peers are allowed.\n\n* 'm': The group is moderated and all postings must be approved.\n\n* 'n': No local postings are allowed, only articles from peers.\n\n* 'j': Articles from peers are filed in the junk group instead.\n\n* 'x': No local postings, and articles from peers are ignored.\n\n* '=foo.bar': Articles are filed in the 'foo.bar' group instead.\n\nIf 'flag' has another value, then the status of the newsgroup\nshould be considered unknown.\n\nThis command can return very large results, especially if\n'grouppattern' is not specified.  It is best to cache the results\noffline unless you really need to refresh them.\n\nChanged in version 3.2: 'grouppattern' was added.\n\n-- Method: NNTP.descriptions (grouppattern)\n\nSend a 'LIST NEWSGROUPS' command, where 'grouppattern' is a wildmat\nstring as specified in RFC 3977(2) (it's essentially the same as\nDOS or UNIX shell wildcard strings).  Return a pair '(response,\ndescriptions)', where 'descriptions' is a dictionary mapping group\nnames to textual descriptions.\n\n>>> resp, descs = s.descriptions('gmane.comp.python.*')\n>>> len(descs)\n295\n>>> descs.popitem()\n('gmane.comp.python.bio.general', 'BioPython discussion list (Moderated)')\n\n-- Method: NNTP.description (group)\n\nGet a description for a single group 'group'.  If more than one\ngroup matches (if 'group' is a real wildmat string), return the\nfirst match.  If no group matches, return an empty string.\n\nThis elides the response code from the server.  If the response\ncode is needed, use *note descriptions(): 767.\n\n-- Method: NNTP.group (name)\n\nSend a 'GROUP' command, where 'name' is the group name.  The group\nis selected as the current group, if it exists.  Return a tuple\n'(response, count, first, last, name)' where 'count' is the\n(estimated) number of articles in the group, 'first' is the first\narticle number in the group, 'last' is the last article number in\nthe group, and 'name' is the group name.\n\n-- Method: NNTP.over (messagespec, *, file=None)\n\nSend an 'OVER' command, or an 'XOVER' command on legacy servers.\n'messagespec' can be either a string representing a message id, or\na '(first, last)' tuple of numbers indicating a range of articles\nin the current group, or a '(first, None)' tuple indicating a range\nof articles starting from 'first' to the last article in the\ncurrent group, or *note None: 43f. to select the current article in\nthe current group.\n\nReturn a pair '(response, overviews)'.  'overviews' is a list of\n'(articlenumber, overview)' tuples, one for each article selected\nby 'messagespec'.  Each 'overview' is a dictionary with the same\nnumber of items, but this number depends on the server.  These\nitems are either message headers (the key is then the lower-cased\nheader name) or metadata items (the key is then the metadata name\nprepended with '\":\"').  The following items are guaranteed to be\npresent by the NNTP specification:\n\n* the 'subject', 'from', 'date', 'message-id' and 'references'\nheaders\n\n* the ':bytes' metadata: the number of bytes in the entire raw\narticle (including headers and body)\n\n* the ':lines' metadata: the number of lines in the article body\n\nThe value of each item is either a string, or *note None: 43f. if\nnot present.\n\nIt is advisable to use the *note decodeheader(): 4565. function on\nheader values when they may contain non-ASCII characters:\n\n>>> , , first, last,  = s.group('gmane.comp.python.devel')\n>>> resp, overviews = s.over((last, last))\n>>> artnum, over = overviews[0]\n>>> artnum\n117216\n>>> list(over.keys())\n['xref', 'from', ':lines', ':bytes', 'references', 'date', 'message-id', 'subject']\n>>> over['from']\n'=?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?= <martin@v.loewis.de>'\n>>> nntplib.decodeheader(over['from'])\n'\"Martin v. Lo\"wis\" <martin@v.loewis.de>'\n\nNew in version 3.2.\n\n-- Method: NNTP.help (*, file=None)\n\nSend a 'HELP' command.  Return a pair '(response, list)' where\n'list' is a list of help strings.\n\n-- Method: NNTP.stat (messagespec=None)\n\nSend a 'STAT' command, where 'messagespec' is either a message id\n(enclosed in ''<'' and ''>'') or an article number in the current\ngroup.  If 'messagespec' is omitted or *note None: 43f, the\ncurrent article in the current group is considered.  Return a\ntriple '(response, number, id)' where 'number' is the article\nnumber and 'id' is the message id.\n\n>>> , , first, last,  = s.group('gmane.comp.python.devel')\n>>> resp, number, messageid = s.stat(first)\n>>> number, messageid\n(9099, '<20030112190404.GE29873@epoch.metaslash.com>')\n\n-- Method: NNTP.next ()\n\nSend a 'NEXT' command.  Return as for *note stat(): 4567.\n\n-- Method: NNTP.last ()\n\nSend a 'LAST' command.  Return as for *note stat(): 4567.\n\n-- Method: NNTP.article (messagespec=None, *, file=None)\n\nSend an 'ARTICLE' command, where 'messagespec' has the same\nmeaning as for *note stat(): 4567.  Return a tuple '(response,\ninfo)' where 'info' is a *note namedtuple: 711. with three\nattributes 'number', 'messageid' and 'lines' (in that order).\n'number' is the article number in the group (or 0 if the\ninformation is not available), 'messageid' the message id as a\nstring, and 'lines' a list of lines (without terminating newlines)\ncomprising the raw message including headers and body.\n\n>>> resp, info = s.article('<20030112190404.GE29873@epoch.metaslash.com>')\n>>> info.number\n0\n>>> info.messageid\n'<20030112190404.GE29873@epoch.metaslash.com>'\n>>> len(info.lines)\n65\n>>> info.lines[0]\nb'Path: main.gmane.org!not-for-mail'\n>>> info.lines[1]\nb'From: Neal Norwitz <neal@metaslash.com>'\n>>> info.lines[-3:]\n[b'There is a patch for 2.3 as well as 2.2.', b'', b'Neal']\n\n-- Method: NNTP.head (messagespec=None, *, file=None)\n\nSame as *note article(): 456a, but sends a 'HEAD' command.  The\n'lines' returned (or written to 'file') will only contain the\nmessage headers, not the body.\n\n-- Method: NNTP.body (messagespec=None, *, file=None)\n\nSame as *note article(): 456a, but sends a 'BODY' command.  The\n'lines' returned (or written to 'file') will only contain the\nmessage body, not the headers.\n\n-- Method: NNTP.post (data)\n\nPost an article using the 'POST' command.  The 'data' argument is\neither a *note file object: 1037. opened for binary reading, or any\niterable of bytes objects (representing raw lines of the article to\nbe posted).  It should represent a well-formed news article,\nincluding the required headers.  The *note post(): 456d. method\nautomatically escapes lines beginning with '.' and appends the\ntermination line.\n\nIf the method succeeds, the server's response is returned.  If the\nserver refuses posting, a *note NNTPReplyError: 4552. is raised.\n\n-- Method: NNTP.ihave (messageid, data)\n\nSend an 'IHAVE' command.  'messageid' is the id of the message to\nsend to the server (enclosed in ''<'' and ''>'').  The 'data'\nparameter and the return value are the same as for *note post():\n456d.\n\n-- Method: NNTP.date ()\n\nReturn a pair '(response, date)'.  'date' is a *note datetime: 222.\nobject containing the current date and time of the server.\n\n-- Method: NNTP.slave ()\n\nSend a 'SLAVE' command.  Return the server's 'response'.\n\n-- Method: NNTP.setdebuglevel (level)\n\nSet the instance's debugging level.  This controls the amount of\ndebugging output printed.  The default, '0', produces no debugging\noutput.  A value of '1' produces a moderate amount of debugging\noutput, generally a single line per request or response.  A value\nof '2' or higher produces the maximum amount of debugging output,\nlogging each line sent and received on the connection (including\nmessage text).\n",
            "subsections": []
        },
        "The following are optional NNTP extensions defined in RFC 2980(3).  Some": {
            "content": "of them have been superseded by newer commands in RFC 3977(4).\n\n-- Method: NNTP.xhdr (hdr, str, *, file=None)\n\nSend an 'XHDR' command.  The 'hdr' argument is a header keyword,\ne.g.  ''subject''.  The 'str' argument should have the form\n''first-last'' where 'first' and 'last' are the first and last\narticle numbers to search.  Return a pair '(response, list)', where\n'list' is a list of pairs '(id, text)', where 'id' is an article\nnumber (as a string) and 'text' is the text of the requested header\nfor that article.  If the 'file' parameter is supplied, then the\noutput of the 'XHDR' command is stored in a file.  If 'file' is a\nstring, then the method will open a file with that name, write to\nit then close it.  If 'file' is a *note file object: 1037, then it\nwill start calling 'write()' on it to store the lines of the\ncommand output.  If 'file' is supplied, then the returned 'list' is\nan empty list.\n\n-- Method: NNTP.xover (start, end, *, file=None)\n\nSend an 'XOVER' command.  'start' and 'end' are article numbers\ndelimiting the range of articles to select.  The return value is\nthe same of for *note over(): 4564.  It is recommended to use *note\nover(): 4564. instead, since it will automatically use the newer\n'OVER' command if available.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc3977.html\n\n(2) https://datatracker.ietf.org/doc/html/rfc3977.html\n\n(3) https://datatracker.ietf.org/doc/html/rfc2980.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc3977.html\n\nFile: python3.12.info,  Node: Utility functions<2>,  Prev: NNTP Objects,  Up: nntplib -- NNTP protocol client\n\n5.36.11.4 Utility functions\n...........................\n\nThe module also defines the following utility function:\n\n-- Function: nntplib.decodeheader (headerstr)\n\nDecode a header value, un-escaping any escaped non-ASCII\ncharacters.  'headerstr' must be a *note str: 157. object.  The\nunescaped value is returned.  Using this function is recommended to\ndisplay some headers in a human readable form:\n\n>>> decodeheader(\"Some subject\")\n'Some subject'\n>>> decodeheader(\"=?ISO-8859-15?Q?D=E9buterenPython?=\")\n'De'buter en Python'\n>>> decodeheader(\"Re: =?UTF-8?B?cHJvYmzDqG1lIGRlIG1hdHJpY2U=?=\")\n'Re: proble`me de matrice'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: optparse -- Parser for command line options,  Next: ossaudiodev -- Access to OSS-compatible audio devices,  Prev: nntplib -- NNTP protocol client,  Up: Superseded Modules": {
            "content": "'Source code:' Lib/optparse.py(1)\n\nDeprecated since version 3.2: The *note optparse: 9b. module is\ndeprecated and will not be developed further; development will continue\nwith the *note argparse: 6. module.\n\n\n\n*note optparse: 9b. is a more convenient, flexible, and powerful library\nfor parsing command-line options than the old *note getopt: 5c. module.\n*note optparse: 9b. uses a more declarative style of command-line\nparsing: you create an instance of *note OptionParser: 1328, populate it\nwith options, and parse the command line.  *note optparse: 9b. allows\nusers to specify options in the conventional GNU/POSIX syntax, and\nadditionally generates usage and help messages for you.\n\nHere's an example of using *note optparse: 9b. in a simple script:\n\nfrom optparse import OptionParser\n...\nparser = OptionParser()\nparser.addoption(\"-f\", \"--file\", dest=\"filename\",\nhelp=\"write report to FILE\", metavar=\"FILE\")\nparser.addoption(\"-q\", \"--quiet\",\naction=\"storefalse\", dest=\"verbose\", default=True,\nhelp=\"don't print status messages to stdout\")\n\n(options, args) = parser.parseargs()\n\nWith these few lines of code, users of your script can now do the \"usual\nthing\" on the command-line, for example:\n\n<yourscript> --file=outfile -q\n\nAs it parses the command line, *note optparse: 9b. sets attributes of\nthe 'options' object returned by *note parseargs(): 1329. based on\nuser-supplied command-line values.  When *note parseargs(): 1329.\nreturns from parsing this command line, 'options.filename' will be\n'\"outfile\"' and 'options.verbose' will be 'False'.  *note optparse: 9b.\nsupports both long and short options, allows short options to be merged\ntogether, and allows options to be associated with their arguments in a\nvariety of ways.  Thus, the following command lines are all equivalent\nto the above example:\n\n<yourscript> -f outfile --quiet\n<yourscript> --quiet --file outfile\n<yourscript> -q -foutfile\n<yourscript> -qfoutfile\n",
            "subsections": []
        },
        "Additionally, users can run one of the following": {
            "content": "<yourscript> -h\n<yourscript> --help\n\nand *note optparse: 9b. will print out a brief summary of your script's\noptions:\n\nUsage: <yourscript> [options]\n\nOptions:\n-h, --help            show this help message and exit\n-f FILE, --file=FILE  write report to FILE\n-q, --quiet           don't print status messages to stdout\n\nwhere the value of 'yourscript' is determined at runtime (normally from\n'sys.argv[0]').\n\n* Menu:\n\n* Background::\n* Tutorial: Tutorial<4>.\n* Reference Guide::\n* Option Callbacks::\n* Extending optparse::\n* Exceptions: Exceptions<19>.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/optparse.py\n\nFile: python3.12.info,  Node: Background,  Next: Tutorial<4>,  Up: optparse -- Parser for command line options\n\n5.36.12.1 Background\n....................\n\n*note optparse: 9b. was explicitly designed to encourage the creation of\nprograms with straightforward, conventional command-line interfaces.  To\nthat end, it supports only the most common command-line syntax and\nsemantics conventionally used under Unix.  If you are unfamiliar with\nthese conventions, read this section to acquaint yourself with them.\n\n* Menu:\n\n* Terminology::\n* What are options for?::\n* What are positional arguments for?::\n\nFile: python3.12.info,  Node: Terminology,  Next: What are options for?,  Up: Background\n\n5.36.12.2 Terminology\n.....................\n\nargument\n\na string entered on the command-line, and passed by the shell to\n'execl()' or 'execv()'.  In Python, arguments are elements of\n'sys.argv[1:]' ('sys.argv[0]' is the name of the program being\nexecuted).  Unix shells also use the term \"word\".\n\nIt is occasionally desirable to substitute an argument list other\nthan 'sys.argv[1:]', so you should read \"argument\" as \"an element\nof 'sys.argv[1:]', or of some other list provided as a substitute\nfor 'sys.argv[1:]'\".\n\noption\n\nan argument used to supply extra information to guide or customize\nthe execution of a program.  There are many different syntaxes for\noptions; the traditional Unix syntax is a hyphen (\"-\") followed by\na single letter, e.g.  '-x' or '-F'.  Also, traditional Unix syntax\nallows multiple options to be merged into a single argument, e.g.\n'-x -F' is equivalent to '-xF'.  The GNU project introduced '--'\nfollowed by a series of hyphen-separated words, e.g.  '--file' or\n'--dry-run'.  These are the only two option syntaxes provided by\n*note optparse: 9b.\n\nSome other option syntaxes that the world has seen include:\n\n* a hyphen followed by a few letters, e.g.  '-pf' (this is 'not'\nthe same as multiple options merged into a single argument)\n\n* a hyphen followed by a whole word, e.g.  '-file' (this is\ntechnically equivalent to the previous syntax, but they aren't\nusually seen in the same program)\n\n* a plus sign followed by a single letter, or a few letters, or\na word, e.g.  '+f', '+rgb'\n\n* a slash followed by a letter, or a few letters, or a word,\ne.g.  '/f', '/file'\n\nThese option syntaxes are not supported by *note optparse: 9b, and\nthey never will be.  This is deliberate: the first three are\nnon-standard on any environment, and the last only makes sense if\nyou're exclusively targeting Windows or certain legacy platforms\n(e.g.  VMS, MS-DOS).\n\noption argument\n\nan argument that follows an option, is closely associated with that\noption, and is consumed from the argument list when that option is.\nWith *note optparse: 9b, option arguments may either be in a\nseparate argument from their option:\n\n-f foo\n--file foo\n\nor included in the same argument:\n\n-ffoo\n--file=foo\n\nTypically, a given option either takes an argument or it doesn't.\nLots of people want an \"optional option arguments\" feature, meaning\nthat some options will take an argument if they see it, and won't\nif they don't.  This is somewhat controversial, because it makes\nparsing ambiguous: if '-a' takes an optional argument and '-b' is\nanother option entirely, how do we interpret '-ab'?  Because of\nthis ambiguity, *note optparse: 9b. does not support this feature.\n\npositional argument\n\nsomething leftover in the argument list after options have been\nparsed, i.e.  after options and their arguments have been parsed\nand removed from the argument list.\n\nrequired option\n\nan option that must be supplied on the command-line; note that the\nphrase \"required option\" is self-contradictory in English.  *note\noptparse: 9b. doesn't prevent you from implementing required\noptions, but doesn't give you much help at it either.\n\nFor example, consider this hypothetical command-line:\n\nprog -v --report report.txt foo bar\n\n'-v' and '--report' are both options.  Assuming that '--report' takes\none argument, 'report.txt' is an option argument.  'foo' and 'bar' are\npositional arguments.\n\nFile: python3.12.info,  Node: What are options for?,  Next: What are positional arguments for?,  Prev: Terminology,  Up: Background\n\n5.36.12.3 What are options for?\n...............................\n",
            "subsections": []
        },
        "Options are used to provide extra information to tune or customize the": {
            "content": "execution of a program.  In case it wasn't clear, options are usually\n'optional'.  A program should be able to run just fine with no options\nwhatsoever.  (Pick a random program from the Unix or GNU toolsets.  Can\nit run without any options at all and still make sense?  The main\nexceptions are 'find', 'tar', and 'dd'--all of which are mutant oddballs\nthat have been rightly criticized for their non-standard syntax and\nconfusing interfaces.)\n\nLots of people want their programs to have \"required options\".  Think\nabout it.  If it's required, then it's 'not optional'!  If there is a\npiece of information that your program absolutely requires in order to\nrun successfully, that's what positional arguments are for.\n",
            "subsections": []
        },
        "As an example of good command-line interface design, consider the humble": {
            "content": "'cp' utility, for copying files.  It doesn't make much sense to try to\ncopy files without supplying a destination and at least one source.",
            "subsections": []
        },
        "Hence, 'cp' fails if you run it with no arguments.  However, it has a": {
            "content": "flexible, useful syntax that does not require any options at all:\n\ncp SOURCE DEST\ncp SOURCE ... DEST-DIR\n",
            "subsections": []
        },
        "You can get pretty far with just that.  Most 'cp' implementations": {
            "content": "provide a bunch of options to tweak exactly how the files are copied:\nyou can preserve mode and modification time, avoid following symlinks,\nask before clobbering existing files, etc.  But none of this distracts\nfrom the core mission of 'cp', which is to copy either one file to\nanother, or several files to another directory.\n\nFile: python3.12.info,  Node: What are positional arguments for?,  Prev: What are options for?,  Up: Background\n\n5.36.12.4 What are positional arguments for?\n............................................\n",
            "subsections": []
        },
        "Positional arguments are for those pieces of information that your": {
            "content": "program absolutely, positively requires to run.\n\nA good user interface should have as few absolute requirements as\npossible.  If your program requires 17 distinct pieces of information in\norder to run successfully, it doesn't much matter 'how' you get that\ninformation from the user--most people will give up and walk away before\nthey successfully run the program.  This applies whether the user\ninterface is a command-line, a configuration file, or a GUI: if you make\nthat many demands on your users, most of them will simply give up.\n",
            "subsections": []
        },
        "In short, try to minimize the amount of information that users are": {
            "content": "absolutely required to supply--use sensible defaults whenever possible.\nOf course, you also want to make your programs reasonably flexible.",
            "subsections": []
        },
        "That's what options are for.  Again, it doesn't matter if they are": {
            "content": "entries in a config file, widgets in the \"Preferences\" dialog of a GUI,\nor command-line options--the more options you implement, the more\nflexible your program is, and the more complicated its implementation\nbecomes.  Too much flexibility has drawbacks as well, of course; too\nmany options can overwhelm users and make your code much harder to\nmaintain.\n\nFile: python3.12.info,  Node: Tutorial<4>,  Next: Reference Guide,  Prev: Background,  Up: optparse -- Parser for command line options\n\n5.36.12.5 Tutorial\n..................\n\nWhile *note optparse: 9b. is quite flexible and powerful, it's also\nstraightforward to use in most cases.  This section covers the code\npatterns that are common to any *note optparse: 9b.-based program.\n",
            "subsections": []
        },
        "First, you need to import the OptionParser class; then, early in the": {
            "content": "main program, create an OptionParser instance:\n\nfrom optparse import OptionParser\n...\nparser = OptionParser()\n\nThen you can start defining options.  The basic syntax is:\n\nparser.addoption(optstr, ...,\nattr=value, ...)\n",
            "subsections": []
        },
        "Each option has one or more option strings, such as '-f' or '--file',": {
            "content": "and several option attributes that tell *note optparse: 9b. what to\nexpect and what to do when it encounters that option on the command\nline.\n",
            "subsections": []
        },
        "Typically, each option will have one short option string and one long": {
            "content": "option string, e.g.:\n\nparser.addoption(\"-f\", \"--file\", ...)\n",
            "subsections": []
        },
        "You're free to define as many short option strings and as many long": {
            "content": "option strings as you like (including zero), as long as there is at\nleast one option string overall.\n\nThe option strings passed to *note OptionParser.addoption(): 29a9. are\neffectively labels for the option defined by that call.  For brevity, we\nwill frequently refer to 'encountering an option' on the command line;\nin reality, *note optparse: 9b. encounters 'option strings' and looks up\noptions from them.\n\nOnce all of your options are defined, instruct *note optparse: 9b. to\nparse your program's command line:\n\n(options, args) = parser.parseargs()\n\n(If you like, you can pass a custom argument list to *note parseargs():\n1329, but that's rarely necessary: by default it uses 'sys.argv[1:]'.)\n\n*note parseargs(): 1329. returns two values:\n\n* 'options', an object containing values for all of your options--e.g.\nif '--file' takes a single string argument, then 'options.file'\nwill be the filename supplied by the user, or 'None' if the user\ndid not supply that option\n\n* 'args', the list of positional arguments leftover after parsing\noptions\n",
            "subsections": []
        },
        "This tutorial section only covers the four most important option": {
            "content": "attributes: *note action: 4581, *note type: 4582, *note dest: 4583.\n(destination), and *note help: 4584.  Of these, *note action: 4581. is\nthe most fundamental.\n\n* Menu:\n\n* Understanding option actions::\n* The store action::\n* Handling boolean (flag) options: Handling boolean flag options.\n* Other actions::\n* Default values::\n* Generating help::\n* Printing a version string::\n* How optparse handles errors::\n* Putting it all together::\n\nFile: python3.12.info,  Node: Understanding option actions,  Next: The store action,  Up: Tutorial<4>\n\n5.36.12.6 Understanding option actions\n......................................\n\nActions tell *note optparse: 9b. what to do when it encounters an option\non the command line.  There is a fixed set of actions hard-coded into\n*note optparse: 9b.; adding new actions is an advanced topic covered in\nsection *note Extending optparse: 4587.  Most actions tell *note\noptparse: 9b. to store a value in some variable--for example, take a\nstring from the command line and store it in an attribute of 'options'.\n\nIf you don't specify an option action, *note optparse: 9b. defaults to\n'store'.\n\nFile: python3.12.info,  Node: The store action,  Next: Handling boolean flag options,  Prev: Understanding option actions,  Up: Tutorial<4>\n\n5.36.12.7 The store action\n..........................\n\nThe most common option action is 'store', which tells *note optparse:\n9b. to take the next argument (or the remainder of the current\nargument), ensure that it is of the correct type, and store it to your\nchosen destination.\n\nFor example:\n\nparser.addoption(\"-f\", \"--file\",\naction=\"store\", type=\"string\", dest=\"filename\")\n\nNow let's make up a fake command line and ask *note optparse: 9b. to\nparse it:\n\nargs = [\"-f\", \"foo.txt\"]\n(options, args) = parser.parseargs(args)\n\nWhen *note optparse: 9b. sees the option string '-f', it consumes the\nnext argument, 'foo.txt', and stores it in 'options.filename'.  So,\nafter this call to *note parseargs(): 1329, 'options.filename' is\n'\"foo.txt\"'.\n\nSome other option types supported by *note optparse: 9b. are 'int' and\n'float'.  Here's an option that expects an integer argument:\n\nparser.addoption(\"-n\", type=\"int\", dest=\"num\")\n",
            "subsections": []
        },
        "Note that this option has no long option string, which is perfectly": {
            "content": "acceptable.  Also, there's no explicit action, since the default is\n'store'.\n",
            "subsections": []
        },
        "Let's parse another fake command-line.  This time, we'll jam the option": {
            "content": "argument right up against the option: since '-n42' (one argument) is\nequivalent to '-n 42' (two arguments), the code\n\n(options, args) = parser.parseargs([\"-n42\"])\nprint(options.num)\n\nwill print '42'.\n\nIf you don't specify a type, *note optparse: 9b. assumes 'string'.",
            "subsections": []
        },
        "Combined with the fact that the default action is 'store', that means": {
            "content": "our first example can be a lot shorter:\n\nparser.addoption(\"-f\", \"--file\", dest=\"filename\")\n\nIf you don't supply a destination, *note optparse: 9b. figures out a\nsensible default from the option strings: if the first long option\nstring is '--foo-bar', then the default destination is 'foobar'.  If\nthere are no long option strings, *note optparse: 9b. looks at the first\nshort option string: the default destination for '-f' is 'f'.\n\n*note optparse: 9b. also includes the built-in 'complex' type.  Adding\ntypes is covered in section *note Extending optparse: 4587.\n\nFile: python3.12.info,  Node: Handling boolean flag options,  Next: Other actions,  Prev: The store action,  Up: Tutorial<4>\n\n5.36.12.8 Handling boolean (flag) options\n.........................................\n",
            "subsections": []
        },
        "Flag options--set a variable to true or false when a particular option is": {
            "content": "seen--are quite common.  *note optparse: 9b. supports them with two\nseparate actions, 'storetrue' and 'storefalse'.  For example, you\nmight have a 'verbose' flag that is turned on with '-v' and off with\n'-q':\n\nparser.addoption(\"-v\", action=\"storetrue\", dest=\"verbose\")\nparser.addoption(\"-q\", action=\"storefalse\", dest=\"verbose\")\n",
            "subsections": []
        },
        "Here we have two different options with the same destination, which is": {
            "content": "perfectly OK. (It just means you have to be a bit careful when setting\ndefault values--see below.)\n\nWhen *note optparse: 9b. encounters '-v' on the command line, it sets\n'options.verbose' to 'True'; when it encounters '-q', 'options.verbose'\nis set to 'False'.\n\nFile: python3.12.info,  Node: Other actions,  Next: Default values,  Prev: Handling boolean flag options,  Up: Tutorial<4>\n\n5.36.12.9 Other actions\n.......................\n\nSome other actions supported by *note optparse: 9b. are:\n\n'\"storeconst\"'\n\nstore a constant value, pre-set via *note Option.const: 458e.\n\n'\"append\"'\n\nappend this option's argument to a list\n\n'\"count\"'\n\nincrement a counter by one\n\n'\"callback\"'\n\ncall a specified function\n\nThese are covered in section *note Reference Guide: 458f, and section\n*note Option Callbacks: 4590.\n\nFile: python3.12.info,  Node: Default values,  Next: Generating help,  Prev: Other actions,  Up: Tutorial<4>\n\n5.36.12.10 Default values\n.........................\n",
            "subsections": []
        },
        "All of the above examples involve setting some variable (the": {
            "content": "\"destination\") when certain command-line options are seen.  What happens\nif those options are never seen?  Since we didn't supply any defaults,\nthey are all set to 'None'.  This is usually fine, but sometimes you\nwant more control.  *note optparse: 9b. lets you supply a default value\nfor each destination, which is assigned before the command line is\nparsed.\n\nFirst, consider the verbose/quiet example.  If we want *note optparse:\n9b. to set 'verbose' to 'True' unless '-q' is seen, then we can do this:\n\nparser.addoption(\"-v\", action=\"storetrue\", dest=\"verbose\", default=True)\nparser.addoption(\"-q\", action=\"storefalse\", dest=\"verbose\")\n",
            "subsections": []
        },
        "Since default values apply to the 'destination' rather than to any": {
            "content": "particular option, and these two options happen to have the same\ndestination, this is exactly equivalent:\n\nparser.addoption(\"-v\", action=\"storetrue\", dest=\"verbose\")\nparser.addoption(\"-q\", action=\"storefalse\", dest=\"verbose\", default=True)\n\nConsider this:\n\nparser.addoption(\"-v\", action=\"storetrue\", dest=\"verbose\", default=False)\nparser.addoption(\"-q\", action=\"storefalse\", dest=\"verbose\", default=True)\n",
            "subsections": []
        },
        "Again, the default value for 'verbose' will be 'True': the last default": {
            "content": "value supplied for any particular destination is the one that counts.\n\nA clearer way to specify default values is the 'setdefaults()' method\nof OptionParser, which you can call at any time before calling *note\nparseargs(): 1329.:\n\nparser.setdefaults(verbose=True)\nparser.addoption(...)\n(options, args) = parser.parseargs()\n",
            "subsections": []
        },
        "As before, the last value specified for a given option destination is": {
            "content": "the one that counts.  For clarity, try to use one method or the other of\nsetting default values, not both.\n\nFile: python3.12.info,  Node: Generating help,  Next: Printing a version string,  Prev: Default values,  Up: Tutorial<4>\n\n5.36.12.11 Generating help\n..........................\n\n*note optparse: 9b.'s ability to generate help and usage text\nautomatically is useful for creating user-friendly command-line\ninterfaces.  All you have to do is supply a *note help: 4584. value for\neach option, and optionally a short usage message for your whole\nprogram.  Here's an OptionParser populated with user-friendly\n(documented) options:\n\nusage = \"usage: %prog [options] arg1 arg2\"\nparser = OptionParser(usage=usage)\nparser.addoption(\"-v\", \"--verbose\",\naction=\"storetrue\", dest=\"verbose\", default=True,\nhelp=\"make lots of noise [default]\")\nparser.addoption(\"-q\", \"--quiet\",\naction=\"storefalse\", dest=\"verbose\",\nhelp=\"be vewwy quiet (I'm hunting wabbits)\")\nparser.addoption(\"-f\", \"--filename\",\nmetavar=\"FILE\", help=\"write output to FILE\")\nparser.addoption(\"-m\", \"--mode\",\ndefault=\"intermediate\",\nhelp=\"interaction mode: novice, intermediate, \"\n\"or expert [default: %default]\")\n\nIf *note optparse: 9b. encounters either '-h' or '--help' on the\ncommand-line, or if you just call 'parser.printhelp()', it prints the\nfollowing to standard output:\n\nUsage: <yourscript> [options] arg1 arg2\n\nOptions:\n-h, --help            show this help message and exit\n-v, --verbose         make lots of noise [default]\n-q, --quiet           be vewwy quiet (I'm hunting wabbits)\n-f FILE, --filename=FILE\nwrite output to FILE\n-m MODE, --mode=MODE  interaction mode: novice, intermediate, or\nexpert [default: intermediate]\n\n(If the help output is triggered by a help option, *note optparse: 9b.\nexits after printing the help text.)\n\nThere's a lot going on here to help *note optparse: 9b. generate the\nbest possible help message:\n\n* the script defines its own usage message:\n\nusage = \"usage: %prog [options] arg1 arg2\"\n\n*note optparse: 9b. expands '%prog' in the usage string to the name\nof the current program, i.e.  'os.path.basename(sys.argv[0])'.  The\nexpanded string is then printed before the detailed option help.\n\nIf you don't supply a usage string, *note optparse: 9b. uses a\nbland but sensible default: '\"Usage: %prog [options]\"', which is\nfine if your script doesn't take any positional arguments.\n\n* every option defines a help string, and doesn't worry about\nline-wrapping--*note optparse: 9b. takes care of wrapping lines and\nmaking the help output look good.\n\n* options that take a value indicate this fact in their automatically\ngenerated help message, e.g.  for the \"mode\" option:\n\n-m MODE, --mode=MODE\n\nHere, \"MODE\" is called the meta-variable: it stands for the\nargument that the user is expected to supply to '-m'/'--mode'.  By\ndefault, *note optparse: 9b. converts the destination variable name\nto uppercase and uses that for the meta-variable.  Sometimes,\nthat's not what you want--for example, the '--filename' option\nexplicitly sets 'metavar=\"FILE\"', resulting in this automatically\ngenerated option description:\n\n-f FILE, --filename=FILE\n\nThis is important for more than just saving space, though: the\nmanually written help text uses the meta-variable 'FILE' to clue\nthe user in that there's a connection between the semi-formal\nsyntax '-f FILE' and the informal semantic description \"write\noutput to FILE\".  This is a simple but effective way to make your\nhelp text a lot clearer and more useful for end users.\n\n* options that have a default value can include '%default' in the\nhelp string--*note optparse: 9b. will replace it with *note str():\n157. of the option's default value.  If an option has no default\nvalue (or the default value is 'None'), '%default' expands to\n'none'.\n\n* Menu:\n\n* Grouping Options::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Grouping Options,  Up: Generating help": {
            "content": "5.36.12.12 Grouping Options\n...........................\n",
            "subsections": []
        },
        "When dealing with many options, it is convenient to group these options": {
            "content": "for better help output.  An *note OptionParser: 1328. can contain\nseveral option groups, each of which can contain several options.\n\nAn option group is obtained using the class *note OptionGroup: 4596.:\n\n-- Class: optparse.OptionGroup (parser, title, description=None)\n\nwhere\n\n* parser is the *note OptionParser: 1328. instance the group\nwill be inserted in to\n\n* title is the group title\n\n* description, optional, is a long description of the group\n\n*note OptionGroup: 4596. inherits from 'OptionContainer' (like *note",
            "subsections": []
        },
        "OptionParser: 1328.) and so the 'addoption()' method can be used to add": {
            "content": "an option to the group.\n\nOnce all the options are declared, using the *note OptionParser: 1328.\nmethod 'addoptiongroup()' the group is added to the previously defined\nparser.\n",
            "subsections": []
        },
        "Continuing with the parser defined in the previous section, adding an": {
            "content": "*note OptionGroup: 4596. to a parser is easy:\n\ngroup = OptionGroup(parser, \"Dangerous Options\",\n\"Caution: use these options at your own risk.  \"\n\"It is believed that some of them bite.\")\ngroup.addoption(\"-g\", action=\"storetrue\", help=\"Group option.\")\nparser.addoptiongroup(group)\n\nThis would result in the following help output:\n\nUsage: <yourscript> [options] arg1 arg2\n\nOptions:\n-h, --help            show this help message and exit\n-v, --verbose         make lots of noise [default]\n-q, --quiet           be vewwy quiet (I'm hunting wabbits)\n-f FILE, --filename=FILE\nwrite output to FILE\n-m MODE, --mode=MODE  interaction mode: novice, intermediate, or\nexpert [default: intermediate]\n\nDangerous Options:\nCaution: use these options at your own risk.  It is believed that some\nof them bite.\n\n-g                  Group option.\n\nA bit more complete example might involve using more than one group:\nstill extending the previous example:\n\ngroup = OptionGroup(parser, \"Dangerous Options\",\n\"Caution: use these options at your own risk.  \"\n\"It is believed that some of them bite.\")\ngroup.addoption(\"-g\", action=\"storetrue\", help=\"Group option.\")\nparser.addoptiongroup(group)\n\ngroup = OptionGroup(parser, \"Debug Options\")\ngroup.addoption(\"-d\", \"--debug\", action=\"storetrue\",\nhelp=\"Print debug information\")\ngroup.addoption(\"-s\", \"--sql\", action=\"storetrue\",\nhelp=\"Print all SQL statements executed\")\ngroup.addoption(\"-e\", action=\"storetrue\", help=\"Print every action done\")\nparser.addoptiongroup(group)\n\nthat results in the following output:\n\nUsage: <yourscript> [options] arg1 arg2\n\nOptions:\n-h, --help            show this help message and exit\n-v, --verbose         make lots of noise [default]\n-q, --quiet           be vewwy quiet (I'm hunting wabbits)\n-f FILE, --filename=FILE\nwrite output to FILE\n-m MODE, --mode=MODE  interaction mode: novice, intermediate, or expert\n[default: intermediate]\n\nDangerous Options:\nCaution: use these options at your own risk.  It is believed that some\nof them bite.\n\n-g                  Group option.\n\nDebug Options:\n-d, --debug         Print debug information\n-s, --sql           Print all SQL statements executed\n-e                  Print every action done\n",
            "subsections": []
        },
        "Another interesting method, in particular when working programmatically": {
            "content": "with option groups is:\n\n-- Method: OptionParser.getoptiongroup (optstr)\n\nReturn the *note OptionGroup: 4596. to which the short or long\noption string 'optstr' (e.g.  ''-o'' or ''--option'') belongs.  If\nthere's no such *note OptionGroup: 4596, return 'None'.\n\nFile: python3.12.info,  Node: Printing a version string,  Next: How optparse handles errors,  Prev: Generating help,  Up: Tutorial<4>\n\n5.36.12.13 Printing a version string\n....................................\n\nSimilar to the brief usage string, *note optparse: 9b. can also print a\nversion string for your program.  You have to supply the string as the\n'version' argument to OptionParser:\n\nparser = OptionParser(usage=\"%prog [-f] [-q]\", version=\"%prog 1.0\")\n\n'%prog' is expanded just like it is in 'usage'.  Apart from that,\n'version' can contain anything you like.  When you supply it, *note\noptparse: 9b. automatically adds a '--version' option to your parser.",
            "subsections": []
        },
        "If it encounters this option on the command line, it expands your": {
            "content": "'version' string (by replacing '%prog'), prints it to stdout, and exits.\n\nFor example, if your script is called '/usr/bin/foo':\n\n$ /usr/bin/foo --version\nfoo 1.0\n",
            "subsections": []
        },
        "The following two methods can be used to print and get the 'version'": {
            "content": "string:\n\n-- Method: OptionParser.printversion (file=None)\n\nPrint the version message for the current program ('self.version')\nto 'file' (default stdout).  As with *note printusage(): 459b, any\noccurrence of '%prog' in 'self.version' is replaced with the name\nof the current program.  Does nothing if 'self.version' is empty or\nundefined.\n\n-- Method: OptionParser.getversion ()\n\nSame as *note printversion(): 459a. but returns the version string\ninstead of printing it.\n\nFile: python3.12.info,  Node: How optparse handles errors,  Next: Putting it all together,  Prev: Printing a version string,  Up: Tutorial<4>\n\n5.36.12.14 How 'optparse' handles errors\n........................................\n\nThere are two broad classes of errors that *note optparse: 9b. has to\nworry about: programmer errors and user errors.  Programmer errors are\nusually erroneous calls to *note OptionParser.addoption(): 29a9, e.g.\ninvalid option strings, unknown option attributes, missing option\nattributes, etc.  These are dealt with in the usual way: raise an\nexception (either *note optparse.OptionError: 29ac. or *note TypeError:\n28e.) and let the program crash.\n",
            "subsections": []
        },
        "Handling user errors is much more important, since they are guaranteed": {
            "content": "to happen no matter how stable your code is.  *note optparse: 9b. can\nautomatically detect some user errors, such as bad option arguments\n(passing '-n 4x' where '-n' takes an integer argument), missing\narguments ('-n' at the end of the command line, where '-n' takes an\nargument of any type).  Also, you can call 'OptionParser.error()' to\nsignal an application-defined error condition:\n\n(options, args) = parser.parseargs()\n...\nif options.a and options.b:\nparser.error(\"options -a and -b are mutually exclusive\")\n\nIn either case, *note optparse: 9b. handles the error the same way: it\nprints the program's usage message and an error message to standard\nerror and exits with error status 2.\n",
            "subsections": []
        },
        "Consider the first example above, where the user passes '4x' to an": {
            "content": "option that takes an integer:\n\n$ /usr/bin/foo -n 4x\nUsage: foo [options]\n\nfoo: error: option -n: invalid integer value: '4x'\n\nOr, where the user fails to pass a value at all:\n\n$ /usr/bin/foo -n\nUsage: foo [options]\n\nfoo: error: -n option requires an argument\n\n*note optparse: 9b.-generated error messages take care always to mention\nthe option involved in the error; be sure to do the same when calling\n'OptionParser.error()' from your application code.\n\nIf *note optparse: 9b.'s default error-handling behaviour does not suit\nyour needs, you'll need to subclass OptionParser and override its\n'exit()' and/or 'error()' methods.\n\nFile: python3.12.info,  Node: Putting it all together,  Prev: How optparse handles errors,  Up: Tutorial<4>\n\n5.36.12.15 Putting it all together\n..................................\n\nHere's what *note optparse: 9b.-based scripts usually look like:\n\nfrom optparse import OptionParser\n...\ndef main():\nusage = \"usage: %prog [options] arg\"\nparser = OptionParser(usage)\nparser.addoption(\"-f\", \"--file\", dest=\"filename\",\nhelp=\"read data from FILENAME\")\nparser.addoption(\"-v\", \"--verbose\",\naction=\"storetrue\", dest=\"verbose\")\nparser.addoption(\"-q\", \"--quiet\",\naction=\"storefalse\", dest=\"verbose\")\n...\n(options, args) = parser.parseargs()\nif len(args) != 1:\nparser.error(\"incorrect number of arguments\")\nif options.verbose:\nprint(\"reading %s...\" % options.filename)\n...\n\nif name == \"main\":\nmain()\n\nFile: python3.12.info,  Node: Reference Guide,  Next: Option Callbacks,  Prev: Tutorial<4>,  Up: optparse -- Parser for command line options\n\n5.36.12.16 Reference Guide\n..........................\n\n* Menu:\n\n* Creating the parser::\n* Populating the parser::\n* Defining options::\n* Option attributes::\n* Standard option actions::\n* Standard option types::\n* Parsing arguments: Parsing arguments<2>.\n* Querying and manipulating your option parser::\n* Conflicts between options::\n* Cleanup: Cleanup<2>.\n* Other methods::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Creating the parser,  Next: Populating the parser,  Up: Reference Guide": {
            "content": "5.36.12.17 Creating the parser\n..............................\n\nThe first step in using *note optparse: 9b. is to create an OptionParser\ninstance.\n\n-- Class: optparse.OptionParser (...)\n\nThe OptionParser constructor has no required arguments, but a\nnumber of optional keyword arguments.  You should always pass them\nas keyword arguments, i.e.  do not rely on the order in which the\narguments are declared.\n\n'usage' (default: '\"%prog [options]\"')\n\nThe usage summary to print when your program is run\nincorrectly or with a help option.  When *note optparse: 9b.\nprints the usage string, it expands '%prog' to\n'os.path.basename(sys.argv[0])' (or to 'prog' if you passed\nthat keyword argument).  To suppress a usage message, pass the\nspecial value 'optparse.SUPPRESSUSAGE'.\n\n'optionlist' (default: '[]')\n\nA list of Option objects to populate the parser with.  The\noptions in 'optionlist' are added after any options in\n'standardoptionlist' (a class attribute that may be set by\nOptionParser subclasses), but before any version or help\noptions.  Deprecated; use *note addoption(): 29a9. after\ncreating the parser instead.\n\n'optionclass' (default: optparse.Option)\n\nClass to use when adding options to the parser in *note\naddoption(): 29a9.\n\n'version' (default: 'None')\n\nA version string to print when the user supplies a version\noption.  If you supply a true value for 'version', *note\noptparse: 9b. automatically adds a version option with the\nsingle option string '--version'.  The substring '%prog' is\nexpanded the same as for 'usage'.\n\n'conflicthandler' (default: '\"error\"')\n\nSpecifies what to do when options with conflicting option\nstrings are added to the parser; see section *note Conflicts\nbetween options: 45a4.\n\n'description' (default: 'None')\n\nA paragraph of text giving a brief overview of your program.\n*note optparse: 9b. reformats this paragraph to fit the\ncurrent terminal width and prints it when the user requests\nhelp (after 'usage', but before the list of options).\n\n'formatter' (default: a new 'IndentedHelpFormatter')\n\nAn instance of optparse.HelpFormatter that will be used for\nprinting help text.  *note optparse: 9b. provides two concrete\nclasses for this purpose: IndentedHelpFormatter and\nTitledHelpFormatter.\n\n'addhelpoption' (default: 'True')\n\nIf true, *note optparse: 9b. will add a help option (with\noption strings '-h' and '--help') to the parser.\n\n'prog'\n\nThe string to use when expanding '%prog' in 'usage' and\n'version' instead of 'os.path.basename(sys.argv[0])'.\n\n'epilog' (default: 'None')\n\nA paragraph of help text to print after the option help.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Populating the parser,  Next: Defining options,  Prev: Creating the parser,  Up: Reference Guide": {
            "content": "5.36.12.18 Populating the parser\n................................\n",
            "subsections": []
        },
        "There are several ways to populate the parser with options.  The": {
            "content": "preferred way is by using *note OptionParser.addoption(): 29a9, as\nshown in section *note Tutorial: 457f.  'addoption()' can be called in\none of two ways:\n\n* pass it an Option instance (as returned by 'makeoption()')\n\n* pass it any combination of positional and keyword arguments that\nare acceptable to 'makeoption()' (i.e., to the Option\nconstructor), and it will create the Option instance for you\n",
            "subsections": []
        },
        "The other alternative is to pass a list of pre-constructed Option": {
            "content": "instances to the OptionParser constructor, as in:\n\noptionlist = [\nmakeoption(\"-f\", \"--filename\",\naction=\"store\", type=\"string\", dest=\"filename\"),\nmakeoption(\"-q\", \"--quiet\",\naction=\"storefalse\", dest=\"verbose\"),\n]\nparser = OptionParser(optionlist=optionlist)\n\n('makeoption()' is a factory function for creating Option instances;\ncurrently it is an alias for the Option constructor.  A future version\nof *note optparse: 9b. may split Option into several classes, and\n'makeoption()' will pick the right class to instantiate.  Do not\ninstantiate Option directly.)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Defining options,  Next: Option attributes,  Prev: Populating the parser,  Up: Reference Guide": {
            "content": "5.36.12.19 Defining options\n...........................\n",
            "subsections": []
        },
        "Each Option instance represents a set of synonymous command-line option": {
            "content": "strings, e.g.  '-f' and '--file'.  You can specify any number of short\nor long option strings, but you must specify at least one overall option\nstring.\n\nThe canonical way to create an *note Option: 45a9. instance is with the\n'addoption()' method of *note OptionParser: 1328.\n\n-- Method: OptionParser.addoption (option)\n\n-- Method: OptionParser.addoption (*optstr, attr=value, ...)\n\nTo define an option with only a short option string:\n\nparser.addoption(\"-f\", attr=value, ...)\n\nAnd to define an option with only a long option string:\n\nparser.addoption(\"--foo\", attr=value, ...)\n\nThe keyword arguments define attributes of the new Option object.\nThe most important option attribute is *note action: 4581, and it\nlargely determines which other attributes are relevant or required.\nIf you pass irrelevant option attributes, or fail to pass required\nones, *note optparse: 9b. raises an *note OptionError: 29ac.\nexception explaining your mistake.\n\nAn option's 'action' determines what *note optparse: 9b. does when\nit encounters this option on the command-line.  The standard option\nactions hard-coded into *note optparse: 9b. are:\n\n'\"store\"'\n\nstore this option's argument (default)\n\n'\"storeconst\"'\n\nstore a constant value, pre-set via *note Option.const: 458e.\n\n'\"storetrue\"'\n\nstore 'True'\n\n'\"storefalse\"'\n\nstore 'False'\n\n'\"append\"'\n\nappend this option's argument to a list\n\n'\"appendconst\"'\n\nappend a constant value to a list, pre-set via *note\nOption.const: 458e.\n\n'\"count\"'\n\nincrement a counter by one\n\n'\"callback\"'\n\ncall a specified function\n\n'\"help\"'\n\nprint a usage message including all options and the\ndocumentation for them\n\n(If you don't supply an action, the default is '\"store\"'.  For this\naction, you may also supply *note type: 4582. and *note dest: 4583.\noption attributes; see *note Standard option actions: 45aa.)\n",
            "subsections": []
        },
        "As you can see, most actions involve storing or updating a value": {
            "content": "somewhere.  *note optparse: 9b. always creates a special object for\nthis, conventionally called 'options', which is an instance of *note\noptparse.Values: 29ab.\n\n-- Class: optparse.Values\n\nAn object holding parsed argument names and values as attributes.\nNormally created by calling when calling *note\nOptionParser.parseargs(): 1329, and can be overridden by a custom\nsubclass passed to the 'values' argument of *note\nOptionParser.parseargs(): 1329. (as described in *note Parsing\narguments: 45ab.).\n",
            "subsections": []
        },
        "Option arguments (and various other values) are stored as attributes of": {
            "content": "this object, according to the *note dest: 4583. (destination) option\nattribute.\n",
            "subsections": []
        },
        "For example, when you call": {
            "content": "parser.parseargs()\n\none of the first things *note optparse: 9b. does is create the 'options'\nobject:\n\noptions = Values()\n",
            "subsections": []
        },
        "If one of the options in this parser is defined with": {
            "content": "parser.addoption(\"-f\", \"--file\", action=\"store\", type=\"string\", dest=\"filename\")\n\nand the command-line being parsed includes any of the following:\n",
            "subsections": [
                {
                    "name": "-ffoo",
                    "content": "-f foo\n--file=foo\n--file foo\n\nthen *note optparse: 9b, on seeing this option, will do the equivalent\nof\n\noptions.filename = \"foo\"\n\nThe *note type: 4582. and *note dest: 4583. option attributes are almost\nas important as *note action: 4581, but *note action: 4581. is the only\none that makes sense for 'all' options.\n"
                }
            ]
        },
        "File: python3.12.info,  Node: Option attributes,  Next: Standard option actions,  Prev: Defining options,  Up: Reference Guide": {
            "content": "5.36.12.20 Option attributes\n............................\n\n-- Class: optparse.Option\n\nA single command line argument, with various attributes passed by\nkeyword to the constructor.  Normally created with *note\nOptionParser.addoption(): 29a9. rather than directly, and can be\noverridden by a custom class via the 'optionclass' argument to\n*note OptionParser: 1328.\n",
            "subsections": []
        },
        "The following option attributes may be passed as keyword arguments to": {
            "content": "*note OptionParser.addoption(): 29a9.  If you pass an option attribute\nthat is not relevant to a particular option, or fail to pass a required\noption attribute, *note optparse: 9b. raises *note OptionError: 29ac.\n\n-- Attribute: Option.action\n\n(default: '\"store\"')\n\nDetermines *note optparse: 9b.'s behaviour when this option is seen\non the command line; the available options are documented *note\nhere: 45aa.\n\n-- Attribute: Option.type\n\n(default: '\"string\"')\n\nThe argument type expected by this option (e.g., '\"string\"' or\n'\"int\"'); the available option types are documented *note here:\n45ae.\n\n-- Attribute: Option.dest\n\n(default: derived from option strings)\n\nIf the option's action implies writing or modifying a value\nsomewhere, this tells *note optparse: 9b. where to write it: *note\ndest: 4583. names an attribute of the 'options' object that *note\noptparse: 9b. builds as it parses the command line.\n\n-- Attribute: Option.default\n\nThe value to use for this option's destination if the option is not\nseen on the command line.  See also *note\nOptionParser.setdefaults(): 45b0.\n\n-- Attribute: Option.nargs\n\n(default: 1)\n\nHow many arguments of type *note type: 4582. should be consumed\nwhen this option is seen.  If > 1, *note optparse: 9b. will store a\ntuple of values to *note dest: 4583.\n\n-- Attribute: Option.const\n\nFor actions that store a constant value, the constant value to\nstore.\n\n-- Attribute: Option.choices\n\nFor options of type '\"choice\"', the list of strings the user may\nchoose from.\n\n-- Attribute: Option.callback\n\nFor options with action '\"callback\"', the callable to call when\nthis option is seen.  See section *note Option Callbacks: 4590. for\ndetail on the arguments passed to the callable.\n\n-- Attribute: Option.callbackargs\n-- Attribute: Option.callbackkwargs\n\nAdditional positional and keyword arguments to pass to 'callback'\nafter the four standard callback arguments.\n\n-- Attribute: Option.help\n\nHelp text to print for this option when listing all available\noptions after the user supplies a *note help: 4584. option (such as\n'--help').  If no help text is supplied, the option will be listed\nwithout help text.  To hide this option, use the special value\n'optparse.SUPPRESSHELP'.\n\n-- Attribute: Option.metavar\n\n(default: derived from option strings)\n\nStand-in for the option argument(s) to use when printing help text.\nSee section *note Tutorial: 457f. for an example.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Standard option actions,  Next: Standard option types,  Prev: Option attributes,  Up: Reference Guide": {
            "content": "5.36.12.21 Standard option actions\n..................................\n",
            "subsections": []
        },
        "The various option actions all have slightly different requirements and": {
            "content": "effects.  Most actions have several relevant option attributes which you\nmay specify to guide *note optparse: 9b.'s behaviour; a few have\nrequired attributes, which you must specify for any option using that\naction.\n\n* '\"store\"' [relevant: *note type: 4582, *note dest: 4583, *note\nnargs: 45b1, *note choices: 45b2.]\n\nThe option must be followed by an argument, which is converted to a\nvalue according to *note type: 4582. and stored in *note dest:\n4583.  If *note nargs: 45b1. > 1, multiple arguments will be\nconsumed from the command line; all will be converted according to\n*note type: 4582. and stored to *note dest: 4583. as a tuple.  See\nthe *note Standard option types: 45ae. section.\n\nIf *note choices: 45b2. is supplied (a list or tuple of strings),\nthe type defaults to '\"choice\"'.\n\nIf *note type: 4582. is not supplied, it defaults to '\"string\"'.\n\nIf *note dest: 4583. is not supplied, *note optparse: 9b. derives a\ndestination from the first long option string (e.g., '--foo-bar'\nimplies 'foobar').  If there are no long option strings, *note\noptparse: 9b. derives a destination from the first short option\nstring (e.g., '-f' implies 'f').\n\nExample:\n\nparser.addoption(\"-f\")\nparser.addoption(\"-p\", type=\"float\", nargs=3, dest=\"point\")\n\nAs it parses the command line\n\n-f foo.txt -p 1 -3.5 4 -fbar.txt\n\n*note optparse: 9b. will set\n\noptions.f = \"foo.txt\"\noptions.point = (1.0, -3.5, 4.0)\noptions.f = \"bar.txt\"\n\n* '\"storeconst\"' [required: *note const: 458e.; relevant: *note\ndest: 4583.]\n\nThe value *note const: 458e. is stored in *note dest: 4583.\n\nExample:\n\nparser.addoption(\"-q\", \"--quiet\",\naction=\"storeconst\", const=0, dest=\"verbose\")\nparser.addoption(\"-v\", \"--verbose\",\naction=\"storeconst\", const=1, dest=\"verbose\")\nparser.addoption(\"--noisy\",\naction=\"storeconst\", const=2, dest=\"verbose\")\n\nIf '--noisy' is seen, *note optparse: 9b. will set\n\noptions.verbose = 2\n\n* '\"storetrue\"' [relevant: *note dest: 4583.]\n\nA special case of '\"storeconst\"' that stores 'True' to *note dest:\n4583.\n\n* '\"storefalse\"' [relevant: *note dest: 4583.]\n\nLike '\"storetrue\"', but stores 'False'.\n\nExample:\n\nparser.addoption(\"--clobber\", action=\"storetrue\", dest=\"clobber\")\nparser.addoption(\"--no-clobber\", action=\"storefalse\", dest=\"clobber\")\n\n* '\"append\"' [relevant: *note type: 4582, *note dest: 4583, *note\nnargs: 45b1, *note choices: 45b2.]\n\nThe option must be followed by an argument, which is appended to\nthe list in *note dest: 4583.  If no default value for *note dest:\n4583. is supplied, an empty list is automatically created when\n*note optparse: 9b. first encounters this option on the\ncommand-line.  If *note nargs: 45b1. > 1, multiple arguments are\nconsumed, and a tuple of length *note nargs: 45b1. is appended to\n*note dest: 4583.\n\nThe defaults for *note type: 4582. and *note dest: 4583. are the\nsame as for the '\"store\"' action.\n\nExample:\n\nparser.addoption(\"-t\", \"--tracks\", action=\"append\", type=\"int\")\n\nIf '-t3' is seen on the command-line, *note optparse: 9b. does the\nequivalent of:\n\noptions.tracks = []\noptions.tracks.append(int(\"3\"))\n\nIf, a little later on, '--tracks=4' is seen, it does:\n\noptions.tracks.append(int(\"4\"))\n\nThe 'append' action calls the 'append' method on the current value\nof the option.  This means that any default value specified must\nhave an 'append' method.  It also means that if the default value\nis non-empty, the default elements will be present in the parsed\nvalue for the option, with any values from the command line\nappended after those default values:\n\n>>> parser.addoption(\"--files\", action=\"append\", default=['~/.mypkg/defaults'])\n>>> opts, args = parser.parseargs(['--files', 'overrides.mypkg'])\n>>> opts.files\n['~/.mypkg/defaults', 'overrides.mypkg']\n\n* '\"appendconst\"' [required: *note const: 458e.; relevant: *note\ndest: 4583.]\n\nLike '\"storeconst\"', but the value *note const: 458e. is appended\nto *note dest: 4583.; as with '\"append\"', *note dest: 4583.\ndefaults to 'None', and an empty list is automatically created the\nfirst time the option is encountered.\n\n* '\"count\"' [relevant: *note dest: 4583.]\n\nIncrement the integer stored at *note dest: 4583.  If no default\nvalue is supplied, *note dest: 4583. is set to zero before being\nincremented the first time.\n\nExample:\n\nparser.addoption(\"-v\", action=\"count\", dest=\"verbosity\")\n\nThe first time '-v' is seen on the command line, *note optparse:\n9b. does the equivalent of:\n\noptions.verbosity = 0\noptions.verbosity += 1\n\nEvery subsequent occurrence of '-v' results in\n\noptions.verbosity += 1\n\n* '\"callback\"' [required: *note callback: 45b3.; relevant: *note\ntype: 4582, *note nargs: 45b1, *note callbackargs: 45b4, *note\ncallbackkwargs: 45b5.]\n\nCall the function specified by *note callback: 45b3, which is\ncalled as\n\nfunc(option, optstr, value, parser, *args, kwargs)\n\nSee section *note Option Callbacks: 4590. for more detail.\n\n* '\"help\"'\n\nPrints a complete help message for all the options in the current\noption parser.  The help message is constructed from the 'usage'\nstring passed to OptionParser's constructor and the *note help:\n4584. string passed to every option.\n\nIf no *note help: 4584. string is supplied for an option, it will\nstill be listed in the help message.  To omit an option entirely,\nuse the special value 'optparse.SUPPRESSHELP'.\n\n*note optparse: 9b. automatically adds a *note help: 4584. option\nto all OptionParsers, so you do not normally need to create one.\n\nExample:\n\nfrom optparse import OptionParser, SUPPRESSHELP\n\n# usually, a help option is added automatically, but that can\n# be suppressed using the addhelpoption argument\nparser = OptionParser(addhelpoption=False)\n\nparser.addoption(\"-h\", \"--help\", action=\"help\")\nparser.addoption(\"-v\", action=\"storetrue\", dest=\"verbose\",\nhelp=\"Be moderately verbose\")\nparser.addoption(\"--file\", dest=\"filename\",\nhelp=\"Input file to read data from\")\nparser.addoption(\"--secret\", help=SUPPRESSHELP)\n\nIf *note optparse: 9b. sees either '-h' or '--help' on the command\nline, it will print something like the following help message to\nstdout (assuming 'sys.argv[0]' is '\"foo.py\"'):\n\nUsage: foo.py [options]\n\nOptions:\n-h, --help        Show this help message and exit\n-v                Be moderately verbose\n--file=FILENAME   Input file to read data from\n\nAfter printing the help message, *note optparse: 9b. terminates\nyour process with 'sys.exit(0)'.\n\n* '\"version\"'\n\nPrints the version number supplied to the OptionParser to stdout\nand exits.  The version number is actually formatted and printed by\nthe 'printversion()' method of OptionParser.  Generally only\nrelevant if the 'version' argument is supplied to the OptionParser\nconstructor.  As with *note help: 4584. options, you will rarely\ncreate 'version' options, since *note optparse: 9b. automatically\nadds them when needed.\n\nFile: python3.12.info,  Node: Standard option types,  Next: Parsing arguments<2>,  Prev: Standard option actions,  Up: Reference Guide\n\n5.36.12.22 Standard option types\n................................\n\n*note optparse: 9b. has five built-in option types: '\"string\"', '\"int\"',\n'\"choice\"', '\"float\"' and '\"complex\"'.  If you need to add new option\ntypes, see section *note Extending optparse: 4587.\n",
            "subsections": []
        },
        "Arguments to string options are not checked or converted in any way: the": {
            "content": "text on the command line is stored in the destination (or passed to the\ncallback) as-is.\n\nInteger arguments (type '\"int\"') are parsed as follows:\n\n* if the number starts with '0x', it is parsed as a hexadecimal\nnumber\n\n* if the number starts with '0', it is parsed as an octal number\n\n* if the number starts with '0b', it is parsed as a binary number\n\n* otherwise, the number is parsed as a decimal number\n\nThe conversion is done by calling *note int(): 17e. with the appropriate\nbase (2, 8, 10, or 16).  If this fails, so will *note optparse: 9b,\nalthough with a more useful error message.\n\n'\"float\"' and '\"complex\"' option arguments are converted directly with\n*note float(): 4b7. and *note complex(): 3ad, with similar\nerror-handling.\n\n'\"choice\"' options are a subtype of '\"string\"' options.  The *note\nchoices: 45b2. option attribute (a sequence of strings) defines the set\nof allowed option arguments.  'optparse.checkchoice()' compares\nuser-supplied option arguments against this master list and raises *note\nOptionValueError: 29ad. if an invalid string is given.\n\nFile: python3.12.info,  Node: Parsing arguments<2>,  Next: Querying and manipulating your option parser,  Prev: Standard option types,  Up: Reference Guide\n\n5.36.12.23 Parsing arguments\n............................\n",
            "subsections": []
        },
        "The whole point of creating and populating an OptionParser is to call": {
            "content": "its *note parseargs(): 1329. method.\n\n-- Method: OptionParser.parseargs (args=None, values=None)\n\nParse the command-line options found in 'args'.\n\nThe input parameters are\n\n'args'\n\nthe list of arguments to process (default: 'sys.argv[1:]')\n\n'values'\n\nan *note Values: 29ab. object to store option arguments in\n(default: a new instance of *note Values: 29ab.) - if you give\nan existing object, the option defaults will not be\ninitialized on it\n\nand the return value is a pair '(options, args)' where\n\n'options'\n\nthe same object that was passed in as 'values', or the\n'optparse.Values' instance created by *note optparse: 9b.\n\n'args'\n\nthe leftover positional arguments after all options have been\nprocessed\n",
            "subsections": []
        },
        "The most common usage is to supply neither keyword argument.  If you": {
            "content": "supply 'values', it will be modified with repeated *note setattr():\n1e63. calls (roughly one for every option argument stored to an option\ndestination) and returned by *note parseargs(): 1329.\n\nIf *note parseargs(): 1329. encounters any errors in the argument list,\nit calls the OptionParser's 'error()' method with an appropriate\nend-user error message.  This ultimately terminates your process with an\nexit status of 2 (the traditional Unix exit status for command-line\nerrors).\n\nFile: python3.12.info,  Node: Querying and manipulating your option parser,  Next: Conflicts between options,  Prev: Parsing arguments<2>,  Up: Reference Guide\n\n5.36.12.24 Querying and manipulating your option parser\n.......................................................\n",
            "subsections": []
        },
        "The default behavior of the option parser can be customized slightly,": {
            "content": "and you can also poke around your option parser and see what's there.\nOptionParser provides several methods to help you out:\n\n-- Method: OptionParser.disableinterspersedargs ()\n\nSet parsing to stop on the first non-option.  For example, if '-a'\nand '-b' are both simple options that take no arguments, *note\noptparse: 9b. normally accepts this syntax:\n\nprog -a arg1 -b arg2\n\nand treats it as equivalent to\n\nprog -a -b arg1 arg2\n\nTo disable this feature, call *note disableinterspersedargs():\n29aa.  This restores traditional Unix syntax, where option parsing\nstops with the first non-option argument.\n\nUse this if you have a command processor which runs another command\nwhich has options of its own and you want to make sure these\noptions don't get confused.  For example, each command might have a\ndifferent set of options.\n\n-- Method: OptionParser.enableinterspersedargs ()\n\nSet parsing to not stop on the first non-option, allowing\ninterspersing switches with command arguments.  This is the default\nbehavior.\n\n-- Method: OptionParser.getoption (optstr)\n\nReturns the Option instance with the option string 'optstr', or\n'None' if no options have that option string.\n\n-- Method: OptionParser.hasoption (optstr)\n\nReturn 'True' if the OptionParser has an option with option string\n'optstr' (e.g., '-q' or '--verbose').\n\n-- Method: OptionParser.removeoption (optstr)\n\nIf the *note OptionParser: 1328. has an option corresponding to\n'optstr', that option is removed.  If that option provided any\nother option strings, all of those option strings become invalid.\nIf 'optstr' does not occur in any option belonging to this *note\nOptionParser: 1328, raises *note ValueError: 183.\n\nFile: python3.12.info,  Node: Conflicts between options,  Next: Cleanup<2>,  Prev: Querying and manipulating your option parser,  Up: Reference Guide\n\n5.36.12.25 Conflicts between options\n....................................\n",
            "subsections": []
        },
        "If you're not careful, it's easy to define options with conflicting": {
            "content": "option strings:\n\nparser.addoption(\"-n\", \"--dry-run\", ...)\n...\nparser.addoption(\"-n\", \"--noisy\", ...)\n\n(This is particularly true if you've defined your own OptionParser\nsubclass with some standard options.)\n\nEvery time you add an option, *note optparse: 9b. checks for conflicts\nwith existing options.  If it finds any, it invokes the current\nconflict-handling mechanism.  You can set the conflict-handling\nmechanism either in the constructor:\n\nparser = OptionParser(..., conflicthandler=handler)\n\nor with a separate call:\n\nparser.setconflicthandler(handler)\n\nThe available conflict handlers are:\n\n'\"error\"' (default)\n\nassume option conflicts are a programming error and raise\n*note OptionConflictError: 45c1.\n\n'\"resolve\"'\n\nresolve option conflicts intelligently (see below)\n\nAs an example, let's define an *note OptionParser: 1328. that resolves\nconflicts intelligently and add conflicting options to it:\n\nparser = OptionParser(conflicthandler=\"resolve\")\nparser.addoption(\"-n\", \"--dry-run\", ..., help=\"do no harm\")\nparser.addoption(\"-n\", \"--noisy\", ..., help=\"be noisy\")\n\nAt this point, *note optparse: 9b. detects that a previously added\noption is already using the '-n' option string.  Since\n'conflicthandler' is '\"resolve\"', it resolves the situation by removing\n'-n' from the earlier option's list of option strings.  Now '--dry-run'\nis the only way for the user to activate that option.  If the user asks\nfor help, the help message will reflect that:\n\nOptions:\n--dry-run     do no harm\n...\n-n, --noisy   be noisy\n",
            "subsections": []
        },
        "It's possible to whittle away the option strings for a previously added": {
            "content": "option until there are none left, and the user has no way of invoking\nthat option from the command-line.  In that case, *note optparse: 9b.\nremoves that option completely, so it doesn't show up in help text or\nanywhere else.  Carrying on with our existing OptionParser:\n\nparser.addoption(\"--dry-run\", ..., help=\"new dry-run option\")\n",
            "subsections": []
        },
        "At this point, the original '-n'/'--dry-run' option is no longer": {
            "content": "accessible, so *note optparse: 9b. removes it, leaving this help text:\n\nOptions:\n...\n-n, --noisy   be noisy\n--dry-run     new dry-run option\n\nFile: python3.12.info,  Node: Cleanup<2>,  Next: Other methods,  Prev: Conflicts between options,  Up: Reference Guide\n\n5.36.12.26 Cleanup\n..................\n",
            "subsections": []
        },
        "OptionParser instances have several cyclic references.  This should not": {
            "content": "be a problem for Python's garbage collector, but you may wish to break\nthe cyclic references explicitly by calling 'destroy()' on your",
            "subsections": []
        },
        "OptionParser once you are done with it.  This is particularly useful in": {
            "content": "long-running applications where large object graphs are reachable from\nyour OptionParser.\n\nFile: python3.12.info,  Node: Other methods,  Prev: Cleanup<2>,  Up: Reference Guide\n\n5.36.12.27 Other methods\n........................\n\nOptionParser supports several other public methods:\n\n-- Method: OptionParser.setusage (usage)\n\nSet the usage string according to the rules described above for the\n'usage' constructor keyword argument.  Passing 'None' sets the\ndefault usage string; use 'optparse.SUPPRESSUSAGE' to suppress a\nusage message.\n\n-- Method: OptionParser.printusage (file=None)\n\nPrint the usage message for the current program ('self.usage') to\n'file' (default stdout).  Any occurrence of the string '%prog' in\n'self.usage' is replaced with the name of the current program.\nDoes nothing if 'self.usage' is empty or not defined.\n\n-- Method: OptionParser.getusage ()\n\nSame as *note printusage(): 459b. but returns the usage string\ninstead of printing it.\n\n-- Method: OptionParser.setdefaults (dest=value, ...)\n\nSet default values for several option destinations at once.  Using\n*note setdefaults(): 45b0. is the preferred way to set default\nvalues for options, since multiple options can share the same\ndestination.  For example, if several \"mode\" options all set the\nsame destination, any one of them can set the default, and the last\none wins:\n\nparser.addoption(\"--advanced\", action=\"storeconst\",\ndest=\"mode\", const=\"advanced\",\ndefault=\"novice\")    # overridden below\nparser.addoption(\"--novice\", action=\"storeconst\",\ndest=\"mode\", const=\"novice\",\ndefault=\"advanced\")  # overrides above setting\n\nTo avoid this confusion, use *note setdefaults(): 45b0.:\n\nparser.setdefaults(mode=\"advanced\")\nparser.addoption(\"--advanced\", action=\"storeconst\",\ndest=\"mode\", const=\"advanced\")\nparser.addoption(\"--novice\", action=\"storeconst\",\ndest=\"mode\", const=\"novice\")\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Option Callbacks,  Next: Extending optparse,  Prev: Reference Guide,  Up: optparse -- Parser for command line options": {
            "content": "5.36.12.28 Option Callbacks\n...........................\n\nWhen *note optparse: 9b.'s built-in actions and types aren't quite\nenough for your needs, you have two choices: extend *note optparse: 9b.\nor define a callback option.  Extending *note optparse: 9b. is more\ngeneral, but overkill for a lot of simple cases.  Quite often a simple\ncallback is all you need.\n\nThere are two steps to defining a callback option:\n\n* define the option itself using the '\"callback\"' action\n\n* write the callback; this is a function (or method) that takes at\nleast four arguments, as described below\n\n* Menu:\n\n* Defining a callback option::\n* How callbacks are called::\n* Raising errors in a callback::\n* Callback example 1; trivial callback: Callback example 1 trivial callback.\n* Callback example 2; check option order: Callback example 2 check option order.\n* Callback example 3; check option order (generalized): Callback example 3 check option order generalized.\n* Callback example 4; check arbitrary condition: Callback example 4 check arbitrary condition.\n* Callback example 5; fixed arguments: Callback example 5 fixed arguments.\n* Callback example 6; variable arguments: Callback example 6 variable arguments.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Defining a callback option,  Next: How callbacks are called,  Up: Option Callbacks": {
            "content": "5.36.12.29 Defining a callback option\n.....................................\n",
            "subsections": []
        },
        "As always, the easiest way to define a callback option is by using the": {
            "content": "*note OptionParser.addoption(): 29a9. method.  Apart from *note action:\n4581, the only option attribute you must specify is 'callback', the\nfunction to call:\n\nparser.addoption(\"-c\", action=\"callback\", callback=mycallback)\n\n'callback' is a function (or other callable object), so you must have\nalready defined 'mycallback()' when you create this callback option.\nIn this simple case, *note optparse: 9b. doesn't even know if '-c' takes\nany arguments, which usually means that the option takes no\narguments--the mere presence of '-c' on the command-line is all it needs\nto know.  In some circumstances, though, you might want your callback to\nconsume an arbitrary number of command-line arguments.  This is where\nwriting callbacks gets tricky; it's covered later in this section.\n\n*note optparse: 9b. always passes four particular arguments to your\ncallback, and it will only pass additional arguments if you specify them\nvia *note callbackargs: 45b4. and *note callbackkwargs: 45b5.  Thus,\nthe minimal callback function signature is:\n\ndef mycallback(option, opt, value, parser):\n\nThe four arguments to a callback are described below.\n",
            "subsections": []
        },
        "There are several other option attributes that you can supply when you": {
            "content": "define a callback option:\n\n*note type: 4582.\n\nhas its usual meaning: as with the '\"store\"' or '\"append\"' actions,\nit instructs *note optparse: 9b. to consume one argument and\nconvert it to *note type: 4582.  Rather than storing the converted\nvalue(s) anywhere, though, *note optparse: 9b. passes it to your\ncallback function.\n\n*note nargs: 45b1.\n\nalso has its usual meaning: if it is supplied and > 1, *note\noptparse: 9b. will consume *note nargs: 45b1. arguments, each of\nwhich must be convertible to *note type: 4582.  It then passes a\ntuple of converted values to your callback.\n\n*note callbackargs: 45b4.\n\na tuple of extra positional arguments to pass to the callback\n\n*note callbackkwargs: 45b5.\n\na dictionary of extra keyword arguments to pass to the callback\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: How callbacks are called,  Next: Raising errors in a callback,  Prev: Defining a callback option,  Up: Option Callbacks": {
            "content": "5.36.12.30 How callbacks are called\n...................................\n\nAll callbacks are called as follows:\n\nfunc(option, optstr, value, parser, *args, kwargs)\n\nwhere\n\n'option'\n\nis the Option instance that's calling the callback\n\n'optstr'\n\nis the option string seen on the command-line that's triggering the\ncallback.  (If an abbreviated long option was used, 'optstr' will\nbe the full, canonical option string--e.g.  if the user puts '--foo'\non the command-line as an abbreviation for '--foobar', then\n'optstr' will be '\"--foobar\"'.)\n\n'value'\n\nis the argument to this option seen on the command-line.  *note\noptparse: 9b. will only expect an argument if *note type: 4582. is\nset; the type of 'value' will be the type implied by the option's\ntype.  If *note type: 4582. for this option is 'None' (no argument\nexpected), then 'value' will be 'None'.  If *note nargs: 45b1. > 1,\n'value' will be a tuple of values of the appropriate type.\n\n'parser'\n\nis the OptionParser instance driving the whole thing, mainly useful\nbecause you can access some other interesting data through its\ninstance attributes:\n\n'parser.largs'\n\nthe current list of leftover arguments, ie.  arguments that\nhave been consumed but are neither options nor option\narguments.  Feel free to modify 'parser.largs', e.g.  by\nadding more arguments to it.  (This list will become 'args',\nthe second return value of *note parseargs(): 1329.)\n\n'parser.rargs'\n\nthe current list of remaining arguments, ie.  with 'optstr'\nand 'value' (if applicable) removed, and only the arguments\nfollowing them still there.  Feel free to modify\n'parser.rargs', e.g.  by consuming more arguments.\n\n'parser.values'\n\nthe object where option values are by default stored (an\ninstance of optparse.OptionValues).  This lets callbacks use\nthe same mechanism as the rest of *note optparse: 9b. for\nstoring option values; you don't need to mess around with\nglobals or closures.  You can also access or modify the\nvalue(s) of any options already encountered on the\ncommand-line.\n\n'args'\n\nis a tuple of arbitrary positional arguments supplied via the *note\ncallbackargs: 45b4. option attribute.\n\n'kwargs'\n\nis a dictionary of arbitrary keyword arguments supplied via *note\ncallbackkwargs: 45b5.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Raising errors in a callback,  Next: Callback example 1 trivial callback,  Prev: How callbacks are called,  Up: Option Callbacks": {
            "content": "5.36.12.31 Raising errors in a callback\n.......................................\n\nThe callback function should raise *note OptionValueError: 29ad. if\nthere are any problems with the option or its argument(s).  *note\noptparse: 9b. catches this and terminates the program, printing the\nerror message you supply to stderr.  Your message should be clear,\nconcise, accurate, and mention the option at fault.  Otherwise, the user\nwill have a hard time figuring out what they did wrong.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Callback example 1 trivial callback,  Next: Callback example 2 check option order,  Prev: Raising errors in a callback,  Up: Option Callbacks": {
            "content": "5.36.12.32 Callback example 1: trivial callback\n...............................................\n",
            "subsections": []
        },
        "Here's an example of a callback option that takes no arguments, and": {
            "content": "simply records that the option was seen:\n\ndef recordfooseen(option, optstr, value, parser):\nparser.values.sawfoo = True\n\nparser.addoption(\"--foo\", action=\"callback\", callback=recordfooseen)\n\nOf course, you could do that with the '\"storetrue\"' action.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Callback example 2 check option order,  Next: Callback example 3 check option order generalized,  Prev: Callback example 1 trivial callback,  Up: Option Callbacks": {
            "content": "5.36.12.33 Callback example 2: check option order\n.................................................\n",
            "subsections": []
        },
        "Here's a slightly more interesting example: record the fact that '-a' is": {
            "content": "seen, but blow up if it comes after '-b' in the command-line.\n\ndef checkorder(option, optstr, value, parser):\nif parser.values.b:\nraise OptionValueError(\"can't use -a after -b\")\nparser.values.a = 1\n...\nparser.addoption(\"-a\", action=\"callback\", callback=checkorder)\nparser.addoption(\"-b\", action=\"storetrue\", dest=\"b\")\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Callback example 3 check option order generalized,  Next: Callback example 4 check arbitrary condition,  Prev: Callback example 2 check option order,  Up: Option Callbacks": {
            "content": "5.36.12.34 Callback example 3: check option order (generalized)\n...............................................................\n",
            "subsections": []
        },
        "If you want to re-use this callback for several similar options (set a": {
            "content": "flag, but blow up if '-b' has already been seen), it needs a bit of\nwork: the error message and the flag that it sets must be generalized.\n\ndef checkorder(option, optstr, value, parser):\nif parser.values.b:\nraise OptionValueError(\"can't use %s after -b\" % optstr)\nsetattr(parser.values, option.dest, 1)\n...\nparser.addoption(\"-a\", action=\"callback\", callback=checkorder, dest='a')\nparser.addoption(\"-b\", action=\"storetrue\", dest=\"b\")\nparser.addoption(\"-c\", action=\"callback\", callback=checkorder, dest='c')\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Callback example 4 check arbitrary condition,  Next: Callback example 5 fixed arguments,  Prev: Callback example 3 check option order generalized,  Up: Option Callbacks": {
            "content": "5.36.12.35 Callback example 4: check arbitrary condition\n........................................................\n",
            "subsections": []
        },
        "Of course, you could put any condition in there--you're not limited to": {
            "content": "checking the values of already-defined options.  For example, if you\nhave options that should not be called when the moon is full, all you\nhave to do is this:\n\ndef checkmoon(option, optstr, value, parser):\nif ismoonfull():\nraise OptionValueError(\"%s option invalid when moon is full\"\n% optstr)\nsetattr(parser.values, option.dest, 1)\n...\nparser.addoption(\"--foo\",\naction=\"callback\", callback=checkmoon, dest=\"foo\")\n\n(The definition of 'ismoonfull()' is left as an exercise for the\nreader.)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Callback example 5 fixed arguments,  Next: Callback example 6 variable arguments,  Prev: Callback example 4 check arbitrary condition,  Up: Option Callbacks": {
            "content": "5.36.12.36 Callback example 5: fixed arguments\n..............................................\n",
            "subsections": []
        },
        "Things get slightly more interesting when you define callback options": {
            "content": "that take a fixed number of arguments.  Specifying that a callback\noption takes arguments is similar to defining a '\"store\"' or '\"append\"'\noption: if you define *note type: 4582, then the option takes one\nargument that must be convertible to that type; if you further define\n*note nargs: 45b1, then the option takes *note nargs: 45b1. arguments.\n\nHere's an example that just emulates the standard '\"store\"' action:\n\ndef storevalue(option, optstr, value, parser):\nsetattr(parser.values, option.dest, value)\n...\nparser.addoption(\"--foo\",\naction=\"callback\", callback=storevalue,\ntype=\"int\", nargs=3, dest=\"foo\")\n\nNote that *note optparse: 9b. takes care of consuming 3 arguments and\nconverting them to integers for you; all you have to do is store them.\n(Or whatever; obviously you don't need a callback for this example.)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Callback example 6 variable arguments,  Prev: Callback example 5 fixed arguments,  Up: Option Callbacks": {
            "content": "5.36.12.37 Callback example 6: variable arguments\n.................................................\n",
            "subsections": []
        },
        "Things get hairy when you want an option to take a variable number of": {
            "content": "arguments.  For this case, you must write a callback, as *note optparse:\n9b. doesn't provide any built-in capabilities for it.  And you have to\ndeal with certain intricacies of conventional Unix command-line parsing\nthat *note optparse: 9b. normally handles for you.  In particular,\ncallbacks should implement the conventional rules for bare '--' and '-'\narguments:\n\n* either '--' or '-' can be option arguments\n\n* bare '--' (if not the argument to some option): halt command-line\nprocessing and discard the '--'\n\n* bare '-' (if not the argument to some option): halt command-line\nprocessing but keep the '-' (append it to 'parser.largs')\n",
            "subsections": []
        },
        "If you want an option that takes a variable number of arguments, there": {
            "content": "are several subtle, tricky issues to worry about.  The exact\nimplementation you choose will be based on which trade-offs you're\nwilling to make for your application (which is why *note optparse: 9b.\ndoesn't support this sort of thing directly).\n",
            "subsections": []
        },
        "Nevertheless, here's a stab at a callback for an option with variable": {
            "content": "arguments:\n\ndef varargcallback(option, optstr, value, parser):\nassert value is None\nvalue = []\n\ndef floatable(str):\ntry:\nfloat(str)\nreturn True\nexcept ValueError:\nreturn False\n\nfor arg in parser.rargs:\n# stop on --foo like options\nif arg[:2] == \"--\" and len(arg) > 2:\nbreak\n# stop on -a, but not on -3 or -3.0\nif arg[:1] == \"-\" and len(arg) > 1 and not floatable(arg):\nbreak\nvalue.append(arg)\n\ndel parser.rargs[:len(value)]\nsetattr(parser.values, option.dest, value)\n\n...\nparser.addoption(\"-c\", \"--callback\", dest=\"varargattr\",\naction=\"callback\", callback=varargcallback)\n\nFile: python3.12.info,  Node: Extending optparse,  Next: Exceptions<19>,  Prev: Option Callbacks,  Up: optparse -- Parser for command line options\n\n5.36.12.38 Extending 'optparse'\n...............................\n\nSince the two major controlling factors in how *note optparse: 9b.\ninterprets command-line options are the action and type of each option,\nthe most likely direction of extension is to add new actions and new\ntypes.\n\n* Menu:\n\n* Adding new types::\n* Adding new actions::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Adding new types,  Next: Adding new actions,  Up: Extending optparse": {
            "content": "5.36.12.39 Adding new types\n...........................\n\nTo add new types, you need to define your own subclass of *note\noptparse: 9b.'s *note Option: 45a9. class.  This class has a couple of\nattributes that define *note optparse: 9b.'s types: *note TYPES: 45de.\nand *note TYPECHECKER: 45df.\n\n-- Attribute: Option.TYPES\n\nA tuple of type names; in your subclass, simply define a new tuple\n*note TYPES: 45de. that builds on the standard one.\n\n-- Attribute: Option.TYPECHECKER\n\nA dictionary mapping type names to type-checking functions.  A\ntype-checking function has the following signature:\n\ndef checkmytype(option, opt, value)\n\nwhere 'option' is an *note Option: 45a9. instance, 'opt' is an\noption string (e.g., '-f'), and 'value' is the string from the\ncommand line that must be checked and converted to your desired\ntype.  'checkmytype()' should return an object of the hypothetical\ntype 'mytype'.  The value returned by a type-checking function will\nwind up in the OptionValues instance returned by *note\nOptionParser.parseargs(): 1329, or be passed to a callback as the\n'value' parameter.\n\nYour type-checking function should raise *note OptionValueError:\n29ad. if it encounters any problems.  *note OptionValueError: 29ad.\ntakes a single string argument, which is passed as-is to *note\nOptionParser: 1328.'s 'error()' method, which in turn prepends the\nprogram name and the string '\"error:\"' and prints everything to\nstderr before terminating the process.\n\nHere's a silly example that demonstrates adding a '\"complex\"' option\ntype to parse Python-style complex numbers on the command line.  (This\nis even sillier than it used to be, because *note optparse: 9b. 1.3\nadded built-in support for complex numbers, but never mind.)\n\nFirst, the necessary imports:\n\nfrom copy import copy\nfrom optparse import Option, OptionValueError\n",
            "subsections": []
        },
        "You need to define your type-checker first, since it's referred to later": {
            "content": "(in the *note TYPECHECKER: 45df. class attribute of your Option\nsubclass):\n\ndef checkcomplex(option, opt, value):\ntry:\nreturn complex(value)\nexcept ValueError:\nraise OptionValueError(\n\"option %s: invalid complex value: %r\" % (opt, value))\n\nFinally, the Option subclass:\n\nclass MyOption (Option):\nTYPES = Option.TYPES + (\"complex\",)\nTYPECHECKER = copy(Option.TYPECHECKER)\nTYPECHECKER[\"complex\"] = checkcomplex\n\n(If we didn't make a *note copy(): 23. of *note Option.TYPECHECKER:\n45df, we would end up modifying the *note TYPECHECKER: 45df. attribute\nof *note optparse: 9b.'s Option class.  This being Python, nothing stops\nyou from doing that except good manners and common sense.)\n\nThat's it!  Now you can write a script that uses the new option type\njust like any other *note optparse: 9b.-based script, except you have to\ninstruct your OptionParser to use MyOption instead of Option:\n\nparser = OptionParser(optionclass=MyOption)\nparser.addoption(\"-c\", type=\"complex\")\n",
            "subsections": []
        },
        "Alternately, you can build your own option list and pass it to": {
            "content": "",
            "subsections": []
        },
        "OptionParser; if you don't use 'addoption()' in the above way, you": {
            "content": "don't need to tell OptionParser which option class to use:\n\noptionlist = [MyOption(\"-c\", action=\"store\", type=\"complex\", dest=\"c\")]\nparser = OptionParser(optionlist=optionlist)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Adding new actions,  Prev: Adding new types,  Up: Extending optparse": {
            "content": "5.36.12.40 Adding new actions\n.............................\n",
            "subsections": []
        },
        "Adding new actions is a bit trickier, because you have to understand": {
            "content": "that *note optparse: 9b. has a couple of classifications for actions:\n\n\"store\" actions\n\nactions that result in *note optparse: 9b. storing a value to an\nattribute of the current OptionValues instance; these options\nrequire a *note dest: 4583. attribute to be supplied to the Option\nconstructor.\n\n\"typed\" actions\n\nactions that take a value from the command line and expect it to be\nof a certain type; or rather, a string that can be converted to a\ncertain type.  These options require a *note type: 4582. attribute\nto the Option constructor.\n\nThese are overlapping sets: some default \"store\" actions are '\"store\"',\n'\"storeconst\"', '\"append\"', and '\"count\"', while the default \"typed\"\nactions are '\"store\"', '\"append\"', and '\"callback\"'.\n",
            "subsections": []
        },
        "When you add an action, you need to categorize it by listing it in at": {
            "content": "least one of the following class attributes of Option (all are lists of\nstrings):\n\n-- Attribute: Option.ACTIONS\n\nAll actions must be listed in ACTIONS.\n\n-- Attribute: Option.STOREACTIONS\n\n\"store\" actions are additionally listed here.\n\n-- Attribute: Option.TYPEDACTIONS\n\n\"typed\" actions are additionally listed here.\n\n-- Attribute: Option.ALWAYSTYPEDACTIONS\n\nActions that always take a type (i.e.  whose options always take a\nvalue) are additionally listed here.  The only effect of this is\nthat *note optparse: 9b. assigns the default type, '\"string\"', to\noptions with no explicit type whose action is listed in *note\nALWAYSTYPEDACTIONS: 45e5.\n",
            "subsections": []
        },
        "In order to actually implement your new action, you must override": {
            "content": "",
            "subsections": []
        },
        "Option's 'takeaction()' method and add a case that recognizes your": {
            "content": "action.\n\nFor example, let's add an '\"extend\"' action.  This is similar to the\nstandard '\"append\"' action, but instead of taking a single value from\nthe command-line and appending it to an existing list, '\"extend\"' will\ntake multiple values in a single comma-delimited string, and extend an\nexisting list with them.  That is, if '--names' is an '\"extend\"' option\nof type '\"string\"', the command line\n\n--names=foo,bar --names blah --names ding,dong\n\nwould result in a list\n\n[\"foo\", \"bar\", \"blah\", \"ding\", \"dong\"]\n\nAgain we define a subclass of Option:\n\nclass MyOption(Option):\n\nACTIONS = Option.ACTIONS + (\"extend\",)\nSTOREACTIONS = Option.STOREACTIONS + (\"extend\",)\nTYPEDACTIONS = Option.TYPEDACTIONS + (\"extend\",)\nALWAYSTYPEDACTIONS = Option.ALWAYSTYPEDACTIONS + (\"extend\",)\n\ndef takeaction(self, action, dest, opt, value, values, parser):\nif action == \"extend\":\nlvalue = value.split(\",\")\nvalues.ensurevalue(dest, []).extend(lvalue)\nelse:\nOption.takeaction(\nself, action, dest, opt, value, values, parser)\n\nFeatures of note:\n\n* '\"extend\"' both expects a value on the command-line and stores that\nvalue somewhere, so it goes in both *note STOREACTIONS: 45e3. and\n*note TYPEDACTIONS: 45e4.\n\n* to ensure that *note optparse: 9b. assigns the default type of\n'\"string\"' to '\"extend\"' actions, we put the '\"extend\"' action in\n*note ALWAYSTYPEDACTIONS: 45e5. as well.\n\n* 'MyOption.takeaction()' implements just this one new action, and\npasses control back to 'Option.takeaction()' for the standard\n*note optparse: 9b. actions.\n\n* 'values' is an instance of the optparseparser.Values class, which\nprovides the very useful 'ensurevalue()' method.  'ensurevalue()'\nis essentially *note getattr(): a15. with a safety valve; it is\ncalled as\n\nvalues.ensurevalue(attr, value)\n\nIf the 'attr' attribute of 'values' doesn't exist or is 'None',\nthen ensurevalue() first sets it to 'value', and then returns\n'value'.  This is very handy for actions like '\"extend\"',\n'\"append\"', and '\"count\"', all of which accumulate data in a\nvariable and expect that variable to be of a certain type (a list\nfor the first two, an integer for the latter).  Using\n'ensurevalue()' means that scripts using your action don't have to\nworry about setting a default value for the option destinations in\nquestion; they can just leave the default as 'None' and\n'ensurevalue()' will take care of getting it right when it's\nneeded.\n\nFile: python3.12.info,  Node: Exceptions<19>,  Prev: Extending optparse,  Up: optparse -- Parser for command line options\n\n5.36.12.41 Exceptions\n.....................\n\n-- Exception: optparse.OptionError\n\nRaised if an *note Option: 45a9. instance is created with invalid\nor inconsistent arguments.\n\n-- Exception: optparse.OptionConflictError\n\nRaised if conflicting options are added to an *note OptionParser:\n1328.\n\n-- Exception: optparse.OptionValueError\n\nRaised if an invalid option value is encountered on the command\nline.\n\n-- Exception: optparse.BadOptionError\n\nRaised if an invalid option is passed on the command line.\n\n-- Exception: optparse.AmbiguousOptionError\n\nRaised if an ambiguous option is passed on the command line.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ossaudiodev -- Access to OSS-compatible audio devices,  Next: pipes -- Interface to shell pipelines,  Prev: optparse -- Parser for command line options,  Up: Superseded Modules": {
            "content": "",
            "subsections": []
        },
        "This module allows you to access the OSS (Open Sound System) audio": {
            "content": "interface.  OSS is available for a wide range of open-source and\ncommercial Unices, and is the standard audio interface for Linux and\nrecent versions of FreeBSD.\n\nChanged in version 3.3: Operations in this module now raise *note\nOSError: 613. where *note IOError: ecb. was raised.\n\nSee also\n........\n",
            "subsections": []
        },
        "Open Sound System Programmer's Guide(2)": {
            "content": "the official documentation for the OSS C API\n",
            "subsections": []
        },
        "The module defines a large number of constants supplied by the OSS": {
            "content": "device driver; see '<sys/soundcard.h>' on either Linux or FreeBSD for a\nlisting.\n\n*note ossaudiodev: 9e. defines the following variables and functions:\n\n-- Exception: ossaudiodev.OSSAudioError\n\nThis exception is raised on certain errors.  The argument is a\nstring describing what went wrong.\n\n(If *note ossaudiodev: 9e. receives an error from a system call\nsuch as 'open()', 'write()', or 'ioctl()', it raises *note OSError:\n613.  Errors detected directly by *note ossaudiodev: 9e. result in\n*note OSSAudioError: 45eb.)\n\n(For backwards compatibility, the exception class is also available\nas 'ossaudiodev.error'.)\n\n-- Function: ossaudiodev.open (mode)\n\n-- Function: ossaudiodev.open (device, mode)\n\nOpen an audio device and return an OSS audio device object.  This\nobject supports many file-like methods, such as 'read()',\n'write()', and 'fileno()' (although there are subtle differences\nbetween conventional Unix read/write semantics and those of OSS\naudio devices).  It also supports a number of audio-specific\nmethods; see below for the complete list of methods.\n\n'device' is the audio device filename to use.  If it is not\nspecified, this module first looks in the environment variable\n'AUDIODEV' for a device to use.  If not found, it falls back to\n'/dev/dsp'.\n\n'mode' is one of ''r'' for read-only (record) access, ''w'' for\nwrite-only (playback) access and ''rw'' for both.  Since many sound\ncards only allow one process to have the recorder or player open at\na time, it is a good idea to open the device only for the activity\nneeded.  Further, some sound cards are half-duplex: they can be\nopened for reading or writing, but not both at once.\n\nNote the unusual calling syntax: the 'first' argument is optional,\nand the second is required.  This is a historical artifact for\ncompatibility with the older 'linuxaudiodev' module which *note\nossaudiodev: 9e. supersedes.\n\n-- Function: ossaudiodev.openmixer ([device])\n\nOpen a mixer device and return an OSS mixer device object.\n'device' is the mixer device filename to use.  If it is not\nspecified, this module first looks in the environment variable\n'MIXERDEV' for a device to use.  If not found, it falls back to\n'/dev/mixer'.\n\n* Menu:\n\n* Audio Device Objects::\n* Mixer Device Objects::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0594/#ossaudiodev\n\n(2) http://www.opensound.com/pguide/oss.pdf\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Audio Device Objects,  Next: Mixer Device Objects,  Up: ossaudiodev -- Access to OSS-compatible audio devices": {
            "content": "5.36.13.1 Audio Device Objects\n..............................\n",
            "subsections": []
        },
        "Before you can write to or read from an audio device, you must call": {
            "content": "three methods in the correct order:\n\n1. 'setfmt()' to set the output format\n\n2. 'channels()' to set the number of channels\n\n3. 'speed()' to set the sample rate\n",
            "subsections": []
        },
        "Alternately, you can use the 'setparameters()' method to set all three": {
            "content": "audio parameters at once.  This is more convenient, but may not be as\nflexible in all cases.\n\nThe audio device objects returned by *note open(): 45ec. define the\nfollowing methods and (read-only) attributes:\n\n-- Method: ossaudiodevice.close ()\n\nExplicitly close the audio device.  When you are done writing to or\nreading from an audio device, you should explicitly close it.  A\nclosed device cannot be used again.\n\n-- Method: ossaudiodevice.fileno ()\n\nReturn the file descriptor associated with the device.\n\n-- Method: ossaudiodevice.read (size)\n\nRead 'size' bytes from the audio input and return them as a Python\nstring.  Unlike most Unix device drivers, OSS audio devices in\nblocking mode (the default) will block *note read(): 45f2. until\nthe entire requested amount of data is available.\n\n-- Method: ossaudiodevice.write (data)\n\nWrite a *note bytes-like object: b82. 'data' to the audio device\nand return the number of bytes written.  If the audio device is in\nblocking mode (the default), the entire data is always written\n(again, this is different from usual Unix device semantics).  If\nthe device is in non-blocking mode, some data may not be\nwritten--see *note writeall(): 45f4.\n\nChanged in version 3.5: Writable *note bytes-like object: b82. is\nnow accepted.\n\n-- Method: ossaudiodevice.writeall (data)\n\nWrite a *note bytes-like object: b82. 'data' to the audio device:\nwaits until the audio device is able to accept data, writes as much\ndata as it will accept, and repeats until 'data' has been\ncompletely written.  If the device is in blocking mode (the\ndefault), this has the same effect as *note write(): 45f3.; *note\nwriteall(): 45f4. is only useful in non-blocking mode.  Has no\nreturn value, since the amount of data written is always equal to\nthe amount of data supplied.\n\nChanged in version 3.5: Writable *note bytes-like object: b82. is\nnow accepted.\n",
            "subsections": []
        },
        "Changed in version 3.2: Audio device objects also support the context": {
            "content": "management protocol, i.e.  they can be used in a *note with: 396.\nstatement.\n\nThe following methods each map to exactly one 'ioctl()' system call.",
            "subsections": []
        },
        "The correspondence is obvious: for example, 'setfmt()' corresponds to": {
            "content": "the 'SNDCTLDSPSETFMT' ioctl, and 'sync()' to 'SNDCTLDSPSYNC' (this\ncan be useful when consulting the OSS documentation).  If the underlying\n'ioctl()' fails, they all raise *note OSError: 613.\n\n-- Method: ossaudiodevice.nonblock ()\n\nPut the device into non-blocking mode.  Once in non-blocking mode,\nthere is no way to return it to blocking mode.\n\n-- Method: ossaudiodevice.getfmts ()\n\nReturn a bitmask of the audio output formats supported by the\nsoundcard.  Some of the formats supported by OSS are:\n\nFormat                        Description\n\n--------------------------------------------------------------------------------\n\n'AFMTMULAW'                 a logarithmic encoding (used by Sun '.au' files\nand '/dev/audio')\n\n\n'AFMTALAW'                  a logarithmic encoding\n\n\n'AFMTIMAADPCM'              a 4:1 compressed format defined by the\nInteractive Multimedia Association\n\n\n'AFMTU8'                     Unsigned, 8-bit audio\n\n\n'AFMTS16LE'                 Signed, 16-bit audio, little-endian byte order\n(as used by Intel processors)\n\n\n'AFMTS16BE'                 Signed, 16-bit audio, big-endian byte order (as\nused by 68k, PowerPC, Sparc)\n\n\n'AFMTS8'                     Signed, 8 bit audio\n\n\n'AFMTU16LE'                 Unsigned, 16-bit little-endian audio\n\n\n'AFMTU16BE'                 Unsigned, 16-bit big-endian audio\n\n\nConsult the OSS documentation for a full list of audio formats, and\nnote that most devices support only a subset of these formats.\nSome older devices only support 'AFMTU8'; the most common format\nused today is 'AFMTS16LE'.\n\n-- Method: ossaudiodevice.setfmt (format)\n\nTry to set the current audio format to 'format'--see *note\ngetfmts(): 45f6. for a list.  Returns the audio format that the\ndevice was set to, which may not be the requested format.  May also\nbe used to return the current audio format--do this by passing an\n\"audio format\" of 'AFMTQUERY'.\n\n-- Method: ossaudiodevice.channels (nchannels)\n\nSet the number of output channels to 'nchannels'.  A value of 1\nindicates monophonic sound, 2 stereophonic.  Some devices may have\nmore than 2 channels, and some high-end devices may not support\nmono.  Returns the number of channels the device was set to.\n\n-- Method: ossaudiodevice.speed (samplerate)\n\nTry to set the audio sampling rate to 'samplerate' samples per\nsecond.  Returns the rate actually set.  Most sound devices don't\nsupport arbitrary sampling rates.  Common rates are:\n\nRate        Description\n\n------------------------------------------------------------\n\n8000        default rate for '/dev/audio'\n\n\n11025       speech recording\n\n\n22050\n\n44100       CD quality audio (at 16 bits/sample and 2\nchannels)\n\n\n96000       DVD quality audio (at 24 bits/sample)\n\n\n-- Method: ossaudiodevice.sync ()\n\nWait until the sound device has played every byte in its buffer.\n(This happens implicitly when the device is closed.)  The OSS\ndocumentation recommends closing and re-opening the device rather\nthan using *note sync(): 45fa.\n\n-- Method: ossaudiodevice.reset ()\n\nImmediately stop playing or recording and return the device to a\nstate where it can accept commands.  The OSS documentation\nrecommends closing and re-opening the device after calling *note\nreset(): 45fb.\n\n-- Method: ossaudiodevice.post ()\n\nTell the driver that there is likely to be a pause in the output,\nmaking it possible for the device to handle the pause more\nintelligently.  You might use this after playing a spot sound\neffect, before waiting for user input, or before doing disk I/O.\n",
            "subsections": []
        },
        "The following convenience methods combine several ioctls, or one ioctl": {
            "content": "and some simple calculations.\n\n-- Method: ossaudiodevice.setparameters (format, nchannels,\nsamplerate[, strict=False])\n\nSet the key audio sampling parameters--sample format, number of\nchannels, and sampling rate--in one method call.  'format',\n'nchannels', and 'samplerate' should be as specified in the *note\nsetfmt(): 45f7, *note channels(): 45f8, and *note speed(): 45f9.\nmethods.  If 'strict' is true, *note setparameters(): 45fd. checks\nto see if each parameter was actually set to the requested value,\nand raises *note OSSAudioError: 45eb. if not.  Returns a tuple\n('format', 'nchannels', 'samplerate') indicating the parameter\nvalues that were actually set by the device driver (i.e., the same\nas the return values of *note setfmt(): 45f7, *note channels():\n45f8, and *note speed(): 45f9.).\n\nFor example,\n\n(fmt, channels, rate) = dsp.setparameters(fmt, channels, rate)\n\nis equivalent to\n\nfmt = dsp.setfmt(fmt)\nchannels = dsp.channels(channels)\nrate = dsp.rate(rate)\n\n-- Method: ossaudiodevice.bufsize ()\n\nReturns the size of the hardware buffer, in samples.\n\n-- Method: ossaudiodevice.obufcount ()\n\nReturns the number of samples that are in the hardware buffer yet\nto be played.\n\n-- Method: ossaudiodevice.obuffree ()\n\nReturns the number of samples that could be queued into the\nhardware buffer to be played without blocking.\n\nAudio device objects also support several read-only attributes:\n\n-- Attribute: ossaudiodevice.closed\n\nBoolean indicating whether the device has been closed.\n\n-- Attribute: ossaudiodevice.name\n\nString containing the name of the device file.\n\n-- Attribute: ossaudiodevice.mode\n\nThe I/O mode for the file, either '\"r\"', '\"rw\"', or '\"w\"'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Mixer Device Objects,  Prev: Audio Device Objects,  Up: ossaudiodev -- Access to OSS-compatible audio devices": {
            "content": "5.36.13.2 Mixer Device Objects\n..............................\n\nThe mixer object provides two file-like methods:\n\n-- Method: ossmixerdevice.close ()\n\nThis method closes the open mixer device file.  Any further\nattempts to use the mixer after this file is closed will raise an\n*note OSError: 613.\n\n-- Method: ossmixerdevice.fileno ()\n\nReturns the file handle number of the open mixer device file.\n",
            "subsections": []
        },
        "Changed in version 3.2: Mixer objects also support the context": {
            "content": "management protocol.\n\nThe remaining methods are specific to audio mixing:\n\n-- Method: ossmixerdevice.controls ()\n\nThis method returns a bitmask specifying the available mixer\ncontrols (\"Control\" being a specific mixable \"channel\", such as\n'SOUNDMIXERPCM' or 'SOUNDMIXERSYNTH').  This bitmask indicates\na subset of all available mixer controls--the 'SOUNDMIXER*'\nconstants defined at module level.  To determine if, for example,\nthe current mixer object supports a PCM mixer, use the following\nPython code:\n\nmixer=ossaudiodev.openmixer()\nif mixer.controls() & (1 << ossaudiodev.SOUNDMIXERPCM):\n# PCM is supported\n... code ...\n\nFor most purposes, the 'SOUNDMIXERVOLUME' (master volume) and\n'SOUNDMIXERPCM' controls should suffice--but code that uses the\nmixer should be flexible when it comes to choosing mixer controls.\nOn the Gravis Ultrasound, for example, 'SOUNDMIXERVOLUME' does\nnot exist.\n\n-- Method: ossmixerdevice.stereocontrols ()\n\nReturns a bitmask indicating stereo mixer controls.  If a bit is\nset, the corresponding control is stereo; if it is unset, the\ncontrol is either monophonic or not supported by the mixer (use in\ncombination with *note controls(): 4608. to determine which).\n\nSee the code example for the *note controls(): 4608. function for\nan example of getting data from a bitmask.\n\n-- Method: ossmixerdevice.reccontrols ()\n\nReturns a bitmask specifying the mixer controls that may be used to\nrecord.  See the code example for *note controls(): 4608. for an\nexample of reading from a bitmask.\n\n-- Method: ossmixerdevice.get (control)\n\nReturns the volume of a given mixer control.  The returned volume\nis a 2-tuple '(leftvolume,rightvolume)'.  Volumes are specified\nas numbers from 0 (silent) to 100 (full volume).  If the control is\nmonophonic, a 2-tuple is still returned, but both volumes are the\nsame.\n\nRaises *note OSSAudioError: 45eb. if an invalid control is\nspecified, or *note OSError: 613. if an unsupported control is\nspecified.\n\n-- Method: ossmixerdevice.set (control, (left, right))\n\nSets the volume for a given mixer control to '(left,right)'.\n'left' and 'right' must be ints and between 0 (silent) and 100\n(full volume).  On success, the new volume is returned as a\n2-tuple.  Note that this may not be exactly the same as the volume\nspecified, because of the limited resolution of some soundcard's\nmixers.\n\nRaises *note OSSAudioError: 45eb. if an invalid mixer control was\nspecified, or if the specified volumes were out-of-range.\n\n-- Method: ossmixerdevice.getrecsrc ()\n\nThis method returns a bitmask indicating which control(s) are\ncurrently being used as a recording source.\n\n-- Method: ossmixerdevice.setrecsrc (bitmask)\n\nCall this function to specify a recording source.  Returns a\nbitmask indicating the new recording source (or sources) if\nsuccessful; raises *note OSError: 613. if an invalid source was\nspecified.  To set the current recording source to the microphone\ninput:\n\nmixer.setrecsrc (1 << ossaudiodev.SOUNDMIXERMIC)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: pipes -- Interface to shell pipelines,  Next: sndhdr -- Determine type of sound file,  Prev: ossaudiodev -- Access to OSS-compatible audio devices,  Up: Superseded Modules": {
            "content": "'Source code:' Lib/pipes.py(1)\n",
            "subsections": []
        },
        "Because the module uses '/bin/sh' command lines, a POSIX or compatible": {
            "content": "shell for *note os.system(): 12b2. and *note os.popen(): 8b5. is\nrequired.\n\n*note Availability: 1ad3.: Unix, not VxWorks.\n\nThe *note pipes: a3. module defines the following class:\n\n-- Class: pipes.Template\n\nAn abstraction of a pipeline.\n\nExample:\n\n>>> import pipes\n>>> t = pipes.Template()\n>>> t.append('tr a-z A-Z', '--')\n>>> f = t.open('pipefile', 'w')\n>>> f.write('hello world')\n>>> f.close()\n>>> open('pipefile').read()\n'HELLO WORLD'\n\n* Menu:\n\n* Template Objects::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/pipes.py\n\n(2) https://peps.python.org/pep-0594/#pipes\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Template Objects,  Up: pipes -- Interface to shell pipelines": {
            "content": "5.36.14.1 Template Objects\n..........................\n\nTemplate objects following methods:\n\n-- Method: Template.reset ()\n\nRestore a pipeline template to its initial state.\n\n-- Method: Template.clone ()\n\nReturn a new, equivalent, pipeline template.\n\n-- Method: Template.debug (flag)\n\nIf 'flag' is true, turn debugging on.  Otherwise, turn debugging\noff.  When debugging is on, commands to be executed are printed,\nand the shell is given 'set -x' command to be more verbose.\n\n-- Method: Template.append (cmd, kind)\n\nAppend a new action at the end.  The 'cmd' variable must be a valid\nbourne shell command.  The 'kind' variable consists of two letters.\n\nThe first letter can be either of ''-'' (which means the command\nreads its standard input), ''f'' (which means the commands reads a\ngiven file on the command line) or ''.'' (which means the commands\nreads no input, and hence must be first.)\n\nSimilarly, the second letter can be either of ''-'' (which means\nthe command writes to standard output), ''f'' (which means the\ncommand writes a file on the command line) or ''.'' (which means\nthe command does not write anything, and hence must be last.)\n\n-- Method: Template.prepend (cmd, kind)\n\nAdd a new action at the beginning.  See *note append(): 4617. for\nexplanations of the arguments.\n\n-- Method: Template.open (file, mode)\n\nReturn a file-like object, open to 'file', but read from or written\nto by the pipeline.  Note that only one of ''r'', ''w'' may be\ngiven.\n\n-- Method: Template.copy (infile, outfile)\n\nCopy 'infile' to 'outfile' through the pipe.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: sndhdr -- Determine type of sound file,  Next: spwd -- The shadow password database,  Prev: pipes -- Interface to shell pipelines,  Up: Superseded Modules": {
            "content": "'Source code:' Lib/sndhdr.py(1)\n",
            "subsections": []
        },
        "Similarly, 'channels' will be either the number of channels or '0' if it": {
            "content": "cannot be determined or if the value is difficult to decode.  The value\nfor 'frames' will be either the number of frames or '-1'.  The last item\nin the tuple, 'bitspersample', will either be the sample size in bits\nor ''A'' for A-LAW or ''U'' for u-LAW.\n\n-- Function: sndhdr.what (filename)\n\nDetermines the type of sound data stored in the file 'filename'\nusing *note whathdr(): cbe.  If it succeeds, returns a namedtuple\nas described above, otherwise 'None' is returned.\n\nChanged in version 3.5: Result changed from a tuple to a\nnamedtuple.\n\n-- Function: sndhdr.whathdr (filename)\n\nDetermines the type of sound data stored in a file based on the\nfile header.  The name of the file is given by 'filename'.  This\nfunction returns a namedtuple as described above on success, or\n'None'.\n\nChanged in version 3.5: Result changed from a tuple to a\nnamedtuple.\n",
            "subsections": []
        },
        "The following sound header types are recognized, as listed below with": {
            "content": "the return value from *note whathdr(): cbe.: and *note what(): cbd.:\n",
            "subsections": []
        },
        "Value            Sound header format": {
            "content": "----------------------------------------------------------\n\n''aifc''         Compressed Audio Interchange Files\n\n\n''aiff''         Audio Interchange Files\n\n\n''au''           Au Files\n\n\n''hcom''         HCOM Files\n\n\n''sndt''         Sndtool Sound Files\n\n\n''voc''          Creative Labs Audio Files\n\n\n''wav''          Waveform Audio File Format Files\n\n\n''8svx''         8-Bit Sampled Voice Files\n\n\n''sb''           Signed Byte Audio Data Files\n\n\n''ub''           UB Files\n\n\n''ul''           uLAW Audio Files\n\n\n-- Data: sndhdr.tests\n\nA list of functions performing the individual tests.  Each function\ntakes two arguments: the byte-stream and an open file-like object.\nWhen *note what(): cbd. is called with a byte-stream, the file-like\nobject will be 'None'.\n\nThe test function should return a string describing the image type\nif the test succeeded, or 'None' if it failed.\n\nExample:\n\n>>> import sndhdr\n>>> imghdr.what('bass.wav')\n'wav'\n>>> imghdr.whathdr('bass.wav')\n'wav'\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/sndhdr.py\n\n(2) https://peps.python.org/pep-0594/#sndhdr\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: spwd -- The shadow password database,  Next: sunau -- Read and write Sun AU files,  Prev: sndhdr -- Determine type of sound file,  Up: Superseded Modules": {
            "content": "",
            "subsections": []
        },
        "This module provides access to the Unix shadow password database.  It is": {
            "content": "available on various Unix versions.\n\n*note Availability: 1ad3.: not Emscripten, not WASI.\n",
            "subsections": []
        },
        "You must have enough privileges to access the shadow password database": {
            "content": "(this usually means you have to be root).\n",
            "subsections": []
        },
        "Shadow password database entries are reported as a tuple-like object,": {
            "content": "whose attributes correspond to the members of the 'spwd' structure\n(Attribute field below, see '<shadow.h>'):\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: sunau -- Read and write Sun AU files,  Next: telnetlib -- Telnet client,  Prev: spwd -- The shadow password database,  Up: Superseded Modules": {
            "content": "'Source code:' Lib/sunau.py(1)\n",
            "subsections": []
        },
        "An audio file consists of a header followed by the data.  The fields of": {
            "content": "the header are:\n",
            "subsections": []
        },
        "Field               Contents": {
            "content": "------------------------------------------------------------------------\n\nmagic word          The four bytes '.snd'.\n\n\nheader size         Size of the header, including info, in bytes.\n\n\ndata size           Physical size of the data, in bytes.\n\n\nencoding            Indicates how the audio samples are encoded.\n\n\nsample rate         The sampling rate.\n\n\n# of channels       The number of channels in the samples.\n\n\ninfo                ASCII string giving a description of the audio\nfile (padded with null bytes).\n\n",
            "subsections": []
        },
        "Apart from the info field, all header fields are 4 bytes in size.  They": {
            "content": "are all 32-bit unsigned integers encoded in big-endian byte order.\n\nThe *note sunau: d1. module defines the following functions:\n\n-- Function: sunau.open (file, mode)\n\nIf 'file' is a string, open the file by that name, otherwise treat\nit as a seekable file-like object.  'mode' can be any of\n\n''r''\n\nRead only mode.\n\n''w''\n\nWrite only mode.\n\nNote that it does not allow read/write files.\n\nA 'mode' of ''r'' returns an 'AUread' object, while a 'mode' of\n''w'' or ''wb'' returns an 'AUwrite' object.\n\nThe *note sunau: d1. module defines the following exception:\n\n-- Exception: sunau.Error\n\nAn error raised when something is impossible because of Sun AU\nspecs or implementation deficiency.\n\nThe *note sunau: d1. module defines the following data items:\n\n-- Data: sunau.AUDIOFILEMAGIC\n\nAn integer every valid Sun AU file begins with, stored in\nbig-endian form.  This is the string '.snd' interpreted as an\ninteger.\n\n-- Data: sunau.AUDIOFILEENCODINGMULAW8\n-- Data: sunau.AUDIOFILEENCODINGLINEAR8\n-- Data: sunau.AUDIOFILEENCODINGLINEAR16\n-- Data: sunau.AUDIOFILEENCODINGLINEAR24\n-- Data: sunau.AUDIOFILEENCODINGLINEAR32\n-- Data: sunau.AUDIOFILEENCODINGALAW8\n\nValues of the encoding field from the AU header which are supported\nby this module.\n\n-- Data: sunau.AUDIOFILEENCODINGFLOAT\n-- Data: sunau.AUDIOFILEENCODINGDOUBLE\n-- Data: sunau.AUDIOFILEENCODINGADPCMG721\n-- Data: sunau.AUDIOFILEENCODINGADPCMG722\n-- Data: sunau.AUDIOFILEENCODINGADPCMG7233\n-- Data: sunau.AUDIOFILEENCODINGADPCMG7235\n\nAdditional known values of the encoding field from the AU header,\nbut which are not supported by this module.\n\n* Menu:\n\n* AUread Objects::\n* AUwrite Objects::\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/sunau.py\n\n(2) https://peps.python.org/pep-0594/#sunau\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: AUread Objects,  Next: AUwrite Objects,  Up: sunau -- Read and write Sun AU files": {
            "content": "5.36.17.1 AUread Objects\n.........................\n\nAUread objects, as returned by *note open(): a33. above, have the\nfollowing methods:\n\n-- Method: AUread.close ()\n\nClose the stream, and make the instance unusable.  (This is called\nautomatically on deletion.)\n\n-- Method: AUread.getnchannels ()\n\nReturns number of audio channels (1 for mono, 2 for stereo).\n\n-- Method: AUread.getsampwidth ()\n\nReturns sample width in bytes.\n\n-- Method: AUread.getframerate ()\n\nReturns sampling frequency.\n\n-- Method: AUread.getnframes ()\n\nReturns number of audio frames.\n\n-- Method: AUread.getcomptype ()\n\nReturns compression type.  Supported compression types are\n''ULAW'', ''ALAW'' and ''NONE''.\n\n-- Method: AUread.getcompname ()\n\nHuman-readable version of *note getcomptype(): 4638.  The supported\ntypes have the respective names ''CCITT G.711 u-law'', ''CCITT\nG.711 A-law'' and ''not compressed''.\n\n-- Method: AUread.getparams ()\n\nReturns a *note namedtuple(): 711. '(nchannels, sampwidth,\nframerate, nframes, comptype, compname)', equivalent to output of\nthe 'get*()' methods.\n\n-- Method: AUread.readframes (n)\n\nReads and returns at most 'n' frames of audio, as a *note bytes:\n295. object.  The data will be returned in linear format.  If the\noriginal data is in u-LAW format, it will be converted.\n\n-- Method: AUread.rewind ()\n\nRewind the file pointer to the beginning of the audio stream.\n\nThe following two methods define a term \"position\" which is compatible\nbetween them, and is otherwise implementation dependent.\n\n-- Method: AUread.setpos (pos)\n\nSet the file pointer to the specified position.  Only values\nreturned from *note tell(): 463e. should be used for 'pos'.\n\n-- Method: AUread.tell ()\n\nReturn current file pointer position.  Note that the returned value\nhas nothing to do with the actual position in the file.\n\nThe following two functions are defined for compatibility with the *note\naifc: 5, and don't do anything interesting.\n\n-- Method: AUread.getmarkers ()\n\nReturns 'None'.\n\n-- Method: AUread.getmark (id)\n\nRaise an error.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: AUwrite Objects,  Prev: AUread Objects,  Up: sunau -- Read and write Sun AU files": {
            "content": "5.36.17.2 AUwrite Objects\n..........................\n\nAUwrite objects, as returned by *note open(): a33. above, have the\nfollowing methods:\n\n-- Method: AUwrite.setnchannels (n)\n\nSet the number of channels.\n\n-- Method: AUwrite.setsampwidth (n)\n\nSet the sample width (in bytes.)\n\nChanged in version 3.4: Added support for 24-bit samples.\n\n-- Method: AUwrite.setframerate (n)\n\nSet the frame rate.\n\n-- Method: AUwrite.setnframes (n)\n\nSet the number of frames.  This can be later changed, when and if\nmore frames are written.\n\n-- Method: AUwrite.setcomptype (type, name)\n\nSet the compression type and description.  Only ''NONE'' and\n''ULAW'' are supported on output.\n\n-- Method: AUwrite.setparams (tuple)\n\nThe 'tuple' should be '(nchannels, sampwidth, framerate, nframes,\ncomptype, compname)', with values valid for the 'set*()' methods.\nSet all parameters.\n\n-- Method: AUwrite.tell ()\n\nReturn current position in the file, with the same disclaimer for\nthe *note AUread.tell(): 463e. and *note AUread.setpos(): 463d.\nmethods.\n\n-- Method: AUwrite.writeframesraw (data)\n\nWrite audio frames, without correcting 'nframes'.\n\nChanged in version 3.4: Any *note bytes-like object: b82. is now\naccepted.\n\n-- Method: AUwrite.writeframes (data)\n\nWrite audio frames and make sure 'nframes' is correct.\n\nChanged in version 3.4: Any *note bytes-like object: b82. is now\naccepted.\n\n-- Method: AUwrite.close ()\n\nMake sure 'nframes' is correct, and close the file.\n\nThis method is called upon deletion.\n",
            "subsections": []
        },
        "Note that it is invalid to set any parameters after calling": {
            "content": "'writeframes()' or 'writeframesraw()'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: telnetlib -- Telnet client,  Next: uu -- Encode and decode uuencode files,  Prev: sunau -- Read and write Sun AU files,  Up: Superseded Modules": {
            "content": "'Source code:' Lib/telnetlib.py(1)\n",
            "subsections": []
        },
        "The symbolic constants for the telnet commands are: IAC, DONT, DO, WONT,": {
            "content": "WILL, SE (Subnegotiation End), NOP (No Operation), DM (Data Mark), BRK\n(Break), IP (Interrupt process), AO (Abort output), AYT (Are You There),\nEC (Erase Character), EL (Erase Line), GA (Go Ahead), SB (Subnegotiation\nBegin).\n\n*note Availability: 1ad3.: not Emscripten, not WASI.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Telnet Objects,  Next: Telnet Example,  Up: telnetlib -- Telnet client": {
            "content": "5.36.18.1 Telnet Objects\n........................\n\n*note Telnet: b38. instances have the following methods:\n\n-- Method: Telnet.readuntil (expected, timeout=None)\n\nRead until a given byte string, 'expected', is encountered or until\n'timeout' seconds have passed.\n\nWhen no match is found, return whatever is available instead,\npossibly empty bytes.  Raise *note EOFError: 114e. if the\nconnection is closed and no cooked data is available.\n\n-- Method: Telnet.readall ()\n\nRead all data until EOF as bytes; block until connection closed.\n\n-- Method: Telnet.readsome ()\n\nRead at least one byte of cooked data unless EOF is hit.  Return\n'b''' if EOF is hit.  Block if no data is immediately available.\n\n-- Method: Telnet.readveryeager ()\n\nRead everything that can be without blocking in I/O (eager).\n\nRaise *note EOFError: 114e. if connection closed and no cooked data\navailable.  Return 'b''' if no cooked data available otherwise.  Do\nnot block unless in the midst of an IAC sequence.\n\n-- Method: Telnet.readeager ()\n\nRead readily available data.\n\nRaise *note EOFError: 114e. if connection closed and no cooked data\navailable.  Return 'b''' if no cooked data available otherwise.  Do\nnot block unless in the midst of an IAC sequence.\n\n-- Method: Telnet.readlazy ()\n\nProcess and return data already in the queues (lazy).\n\nRaise *note EOFError: 114e. if connection closed and no data\navailable.  Return 'b''' if no cooked data available otherwise.  Do\nnot block unless in the midst of an IAC sequence.\n\n-- Method: Telnet.readverylazy ()\n\nReturn any data available in the cooked queue (very lazy).\n\nRaise *note EOFError: 114e. if connection closed and no data\navailable.  Return 'b''' if no cooked data available otherwise.\nThis method never blocks.\n\n-- Method: Telnet.readsbdata ()\n\nReturn the data collected between a SB/SE pair (suboption\nbegin/end).  The callback should access these data when it was\ninvoked with a 'SE' command.  This method never blocks.\n\n-- Method: Telnet.open (host, port=0[, timeout])\n\nConnect to a host.  The optional second argument is the port\nnumber, which defaults to the standard Telnet port (23).  The\noptional 'timeout' parameter specifies a timeout in seconds for\nblocking operations like the connection attempt (if not specified,\nthe global default timeout setting will be used).\n\nDo not try to reopen an already connected instance.\n\nRaises an *note auditing event: 161d. 'telnetlib.Telnet.open' with\narguments 'self', 'host', 'port'.\n\n-- Method: Telnet.msg (msg, *args)\n\nPrint a debug message when the debug level is '>' 0.  If extra\narguments are present, they are substituted in the message using\nthe standard string formatting operator.\n\n-- Method: Telnet.setdebuglevel (debuglevel)\n\nSet the debug level.  The higher the value of 'debuglevel', the\nmore debug output you get (on 'sys.stdout').\n\n-- Method: Telnet.close ()\n\nClose the connection.\n\n-- Method: Telnet.getsocket ()\n\nReturn the socket object used internally.\n\n-- Method: Telnet.fileno ()\n\nReturn the file descriptor of the socket object used internally.\n\n-- Method: Telnet.write (buffer)\n\nWrite a byte string to the socket, doubling any IAC characters.\nThis can block if the connection is blocked.  May raise *note\nOSError: 613. if the connection is closed.\n\nRaises an *note auditing event: 161d. 'telnetlib.Telnet.write' with\narguments 'self', 'buffer'.\n\nChanged in version 3.3: This method used to raise *note\nsocket.error: ece, which is now an alias of *note OSError: 613.\n\n-- Method: Telnet.interact ()\n\nInteraction function, emulates a very dumb Telnet client.\n\n-- Method: Telnet.mtinteract ()\n\nMultithreaded version of *note interact(): 465b.\n\n-- Method: Telnet.expect (list, timeout=None)\n\nRead until one from a list of a regular expressions matches.\n\nThe first argument is a list of regular expressions, either\ncompiled (*note regex objects: df6.) or uncompiled (byte strings).\nThe optional second argument is a timeout, in seconds; the default\nis to block indefinitely.\n\nReturn a tuple of three items: the index in the list of the first\nregular expression that matches; the match object returned; and the\nbytes read up till and including the match.\n\nIf end of file is found and no bytes were read, raise *note\nEOFError: 114e.  Otherwise, when nothing matches, return '(-1,\nNone, data)' where 'data' is the bytes received so far (may be\nempty bytes if a timeout happened).\n\nIf a regular expression ends with a greedy match (such as '.*') or\nif more than one expression can match the same input, the results\nare non-deterministic, and may depend on the I/O timing.\n\n-- Method: Telnet.setoptionnegotiationcallback (callback)\n\nEach time a telnet option is read on the input flow, this\n'callback' (if set) is called with the following parameters:\ncallback(telnet socket, command (DO/DONT/WILL/WONT), option).  No\nother action is done afterwards by telnetlib.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Telnet Example,  Prev: Telnet Objects,  Up: telnetlib -- Telnet client": {
            "content": "5.36.18.2 Telnet Example\n........................\n\nA simple example illustrating typical use:\n\nimport getpass\nimport telnetlib\n\nHOST = \"localhost\"\nuser = input(\"Enter your remote account: \")\npassword = getpass.getpass()\n\ntn = telnetlib.Telnet(HOST)\n\ntn.readuntil(b\"login: \")\ntn.write(user.encode('ascii') + b\"\\n\")\nif password:\ntn.readuntil(b\"Password: \")\ntn.write(password.encode('ascii') + b\"\\n\")\n\ntn.write(b\"ls\\n\")\ntn.write(b\"exit\\n\")\n\nprint(tn.readall().decode('ascii'))\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: uu -- Encode and decode uuencode files,  Next: xdrlib -- Encode and decode XDR data,  Prev: telnetlib -- Telnet client,  Up: Superseded Modules": {
            "content": "'Source code:' Lib/uu.py(1)\n",
            "subsections": []
        },
        "This module encodes and decodes files in uuencode format, allowing": {
            "content": "arbitrary binary data to be transferred over ASCII-only connections.",
            "subsections": []
        },
        "Wherever a file argument is expected, the methods accept a file-like": {
            "content": "object.  For backwards compatibility, a string containing a pathname is\nalso accepted, and the corresponding file will be opened for reading and\nwriting; the pathname ''-'' is understood to mean the standard input or\noutput.  However, this interface is deprecated; it's better for the\ncaller to open the file itself, and be sure that, when required, the\nmode is ''rb'' or ''wb'' on Windows.\n",
            "subsections": []
        },
        "This code was contributed by Lance Ellinghouse, and modified by Jack": {
            "content": "Jansen.\n\nThe *note uu: 10a. module defines the following functions:\n\n-- Function: uu.encode (infile, outfile, name=None, mode=None, *,\nbacktick=False)\n\nUuencode file 'infile' into file 'outfile'.  The uuencoded file\nwill have the header specifying 'name' and 'mode' as the defaults\nfor the results of decoding the file.  The default defaults are\ntaken from 'infile', or ''-'' and '0o666' respectively.  If\n'backtick' is true, zeros are represented by ''`'' instead of\nspaces.\n\nChanged in version 3.7: Added the 'backtick' parameter.\n\n-- Function: uu.decode (infile, outfile=None, mode=None, quiet=False)\n\nThis call decodes uuencoded file 'infile' placing the result on\nfile 'outfile'.  If 'outfile' is a pathname, 'mode' is used to\nset the permission bits if the file must be created.  Defaults for\n'outfile' and 'mode' are taken from the uuencode header.  However,\nif the file specified in the header already exists, a *note\nuu.Error: 4663. is raised.\n\n*note decode(): 1460. may print a warning to standard error if the\ninput was produced by an incorrect uuencoder and Python could\nrecover from that error.  Setting 'quiet' to a true value silences\nthis warning.\n\n-- Exception: uu.Error\n\nSubclass of *note Exception: 7ff, this can be raised by *note\nuu.decode(): 1460. under various situations, such as described\nabove, but also including a badly formatted header, or truncated\ninput file.\n\nSee also\n........\n\nModule *note binascii: e.\n\nSupport module containing ASCII-to-binary and binary-to-ASCII\nconversions.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Lib/uu.py\n\n(2) https://peps.python.org/pep-0594/#uu-and-the-uu-encoding\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: xdrlib -- Encode and decode XDR data,  Prev: uu -- Encode and decode uuencode files,  Up: Superseded Modules": {
            "content": "'Source code:' Lib/xdrlib.py(1)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Packer Objects,  Next: Unpacker Objects,  Up: xdrlib -- Encode and decode XDR data": {
            "content": "5.36.20.1 Packer Objects\n........................\n\n*note Packer: 4666. instances have the following methods:\n\n-- Method: Packer.getbuffer ()\n\nReturns the current pack buffer as a string.\n\n-- Method: Packer.reset ()\n\nResets the pack buffer to the empty string.\n",
            "subsections": []
        },
        "In general, you can pack any of the most common XDR data types by": {
            "content": "calling the appropriate 'packtype()' method.  Each method takes a\nsingle argument, the value to pack.  The following simple data type\npacking methods are supported: 'packuint()', 'packint()',\n'packenum()', 'packbool()', 'packuhyper()', and 'packhyper()'.\n\n-- Method: Packer.packfloat (value)\n\nPacks the single-precision floating point number 'value'.\n\n-- Method: Packer.packdouble (value)\n\nPacks the double-precision floating point number 'value'.\n\nThe following methods support packing strings, bytes, and opaque data:\n\n-- Method: Packer.packfstring (n, s)\n\nPacks a fixed length string, 's'.  'n' is the length of the string\nbut it is 'not' packed into the data buffer.  The string is padded\nwith null bytes if necessary to guaranteed 4 byte alignment.\n\n-- Method: Packer.packfopaque (n, data)\n\nPacks a fixed length opaque data stream, similarly to *note\npackfstring(): 466e.\n\n-- Method: Packer.packstring (s)\n\nPacks a variable length string, 's'.  The length of the string is\nfirst packed as an unsigned integer, then the string data is packed\nwith *note packfstring(): 466e.\n\n-- Method: Packer.packopaque (data)\n\nPacks a variable length opaque data string, similarly to *note\npackstring(): 4670.\n\n-- Method: Packer.packbytes (bytes)\n\nPacks a variable length byte stream, similarly to *note\npackstring(): 4670.\n\nThe following methods support packing arrays and lists:\n\n-- Method: Packer.packlist (list, packitem)\n\nPacks a 'list' of homogeneous items.  This method is useful for\nlists with an indeterminate size; i.e.  the size is not available\nuntil the entire list has been walked.  For each item in the list,\nan unsigned integer '1' is packed first, followed by the data value\nfrom the list.  'packitem' is the function that is called to pack\nthe individual item.  At the end of the list, an unsigned integer\n'0' is packed.\n\nFor example, to pack a list of integers, the code might appear like\nthis:\n\nimport xdrlib\np = xdrlib.Packer()\np.packlist([1, 2, 3], p.packint)\n\n-- Method: Packer.packfarray (n, array, packitem)\n\nPacks a fixed length list ('array') of homogeneous items.  'n' is\nthe length of the list; it is 'not' packed into the buffer, but a\n*note ValueError: 183. exception is raised if 'len(array)' is not\nequal to 'n'.  As above, 'packitem' is the function used to pack\neach element.\n\n-- Method: Packer.packarray (list, packitem)\n\nPacks a variable length 'list' of homogeneous items.  First, the\nlength of the list is packed as an unsigned integer, then each\nelement is packed as in *note packfarray(): 4674. above.\n\nFile: python3.12.info,  Node: Unpacker Objects,  Next: Exceptions<20>,  Prev: Packer Objects,  Up: xdrlib -- Encode and decode XDR data\n\n5.36.20.2 Unpacker Objects\n..........................\n\nThe *note Unpacker: 4667. class offers the following methods:\n\n-- Method: Unpacker.reset (data)\n\nResets the string buffer with the given 'data'.\n\n-- Method: Unpacker.getposition ()\n\nReturns the current unpack position in the data buffer.\n\n-- Method: Unpacker.setposition (position)\n\nSets the data buffer unpack position to 'position'.  You should be\ncareful about using *note getposition(): 4679. and *note\nsetposition(): 467a.\n\n-- Method: Unpacker.getbuffer ()\n\nReturns the current unpack data buffer as a string.\n\n-- Method: Unpacker.done ()\n\nIndicates unpack completion.  Raises an *note Error: 467d.\nexception if all of the data has not been unpacked.\n\nIn addition, every data type that can be packed with a *note Packer:\n4666, can be unpacked with an *note Unpacker: 4667.  Unpacking methods\nare of the form 'unpacktype()', and take no arguments.  They return the\nunpacked object.\n\n-- Method: Unpacker.unpackfloat ()\n\nUnpacks a single-precision floating point number.\n\n-- Method: Unpacker.unpackdouble ()\n\nUnpacks a double-precision floating point number, similarly to\n*note unpackfloat(): 467e.\n",
            "subsections": []
        },
        "In addition, the following methods unpack strings, bytes, and opaque": {
            "content": "data:\n\n-- Method: Unpacker.unpackfstring (n)\n\nUnpacks and returns a fixed length string.  'n' is the number of\ncharacters expected.  Padding with null bytes to guaranteed 4 byte\nalignment is assumed.\n\n-- Method: Unpacker.unpackfopaque (n)\n\nUnpacks and returns a fixed length opaque data stream, similarly to\n*note unpackfstring(): 4680.\n\n-- Method: Unpacker.unpackstring ()\n\nUnpacks and returns a variable length string.  The length of the\nstring is first unpacked as an unsigned integer, then the string\ndata is unpacked with *note unpackfstring(): 4680.\n\n-- Method: Unpacker.unpackopaque ()\n\nUnpacks and returns a variable length opaque data string, similarly\nto *note unpackstring(): 4682.\n\n-- Method: Unpacker.unpackbytes ()\n\nUnpacks and returns a variable length byte stream, similarly to\n*note unpackstring(): 4682.\n\nThe following methods support unpacking arrays and lists:\n\n-- Method: Unpacker.unpacklist (unpackitem)\n\nUnpacks and returns a list of homogeneous items.  The list is\nunpacked one element at a time by first unpacking an unsigned\ninteger flag.  If the flag is '1', then the item is unpacked and\nappended to the list.  A flag of '0' indicates the end of the list.\n'unpackitem' is the function that is called to unpack the items.\n\n-- Method: Unpacker.unpackfarray (n, unpackitem)\n\nUnpacks and returns (as a list) a fixed length array of homogeneous\nitems.  'n' is number of list elements to expect in the buffer.  As\nabove, 'unpackitem' is the function used to unpack each element.\n\n-- Method: Unpacker.unpackarray (unpackitem)\n\nUnpacks and returns a variable length 'list' of homogeneous items.\nFirst, the length of the list is unpacked as an unsigned integer,\nthen each element is unpacked as in *note unpackfarray(): 4686.\nabove.\n\nFile: python3.12.info,  Node: Exceptions<20>,  Prev: Unpacker Objects,  Up: xdrlib -- Encode and decode XDR data\n\n5.36.20.3 Exceptions\n....................\n\nExceptions in this module are coded as class instances:\n\n-- Exception: xdrlib.Error\n\nThe base exception class.  *note Error: 467d. has a single public\nattribute 'msg' containing the description of the error.\n\n-- Exception: xdrlib.ConversionError\n\nClass derived from *note Error: 467d.  Contains no additional\ninstance variables.\n\nHere is an example of how you would catch one of these exceptions:\n\nimport xdrlib\np = xdrlib.Packer()\ntry:\np.packdouble(8.01)\nexcept xdrlib.ConversionError as instance:\nprint('packing the double failed:', instance.msg)\n\nFile: python3.12.info,  Node: Security Considerations<4>,  Prev: Superseded Modules,  Up: The Python Standard Library\n",
            "subsections": [
                {
                    "name": "5.37 Security Considerations",
                    "content": "The following modules have specific security considerations:\n\n* *note base64: c.: *note base64 security considerations: 337b. in\nRFC 4648(1)\n\n* *note cgi: 13.: *note CGI security considerations: 44d8.\n\n* *note hashlib: 63.: *note all constructors take a \"usedforsecurity\"\nkeyword-only argument disabling known insecure and blocked\nalgorithms: 27bf.\n\n* *note http.server: 6d. is not suitable for production use, only\nimplementing basic security checks.  See the *note security\nconsiderations: 37a4.\n\n* *note logging: 82.: *note Logging configuration uses eval(): 2a13.\n\n* *note multiprocessing: 8f.: *note Connection.recv() uses pickle:\n2dbe.\n\n* *note pickle: a1.: *note Restricting globals in pickle: 258e.\n\n* *note random: b3. shouldn't be used for security purposes, use\n*note secrets: bb. instead\n\n* *note shelve: be.: *note shelve is based on pickle and thus\nunsuitable for dealing with untrusted sources: 25ac.\n\n* *note ssl: ca.: *note SSL/TLS security considerations: 2f9c.\n\n* *note subprocess: d0.: *note Subprocess security considerations:\n2e67.\n\n* *note tempfile: da.: *note mktemp is deprecated due to\nvulnerability to race conditions: 254b.\n\n* *note xml: 11b.: *note XML vulnerabilities: 33aa.\n\n* *note zipfile: 12b.: *note maliciously prepared .zip files can\ncause disk volume exhaustion: 26d9.\n\nThe *note -I: 77f. command line option can be used to run Python in\nisolated mode.  When it cannot be used, the *note -P: 362. option or the\n*note PYTHONSAFEPATH: 363. environment variable can be used to not\nprepend a potentially unsafe path to *note sys.path: 32c. such as the\ncurrent directory, the script's directory or an empty string.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc4648.html\n"
                }
            ]
        },
        "File: python3.12.info,  Node: Extending and Embedding the Python Interpreter,  Next: Python/C API Reference Manual,  Prev: The Python Standard Library,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "6 Extending and Embedding the Python Interpreter": {
            "content": "This document describes how to write modules in C or C++ to extend the",
            "subsections": []
        },
        "Python interpreter with new modules.  Those modules can not only define": {
            "content": "new functions but also new object types and their methods.  The document\nalso describes how to embed the Python interpreter in another\napplication, for use as an extension language.  Finally, it shows how to\ncompile and link extension modules so that they can be loaded\ndynamically (at run time) into the interpreter, if the underlying\noperating system supports this feature.\n",
            "subsections": []
        },
        "This document assumes basic knowledge about Python.  For an informal": {
            "content": "introduction to the language, see *note The Python Tutorial: 195d.\n*note The Python Language Reference: 13e. gives a more formal definition\nof the language.  *note The Python Standard Library: 13d. documents the\nexisting object types, functions and modules (both built-in and written\nin Python) that give the language its wide application range.\n",
            "subsections": []
        },
        "For a detailed description of the whole Python/C API, see the separate": {
            "content": "*note Python/C API Reference Manual: 195f.\n\n* Menu:\n\n* Recommended third party tools::\n* Creating extensions without third party tools::\n* Embedding the CPython runtime in a larger application::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Recommended third party tools,  Next: Creating extensions without third party tools,  Up: Extending and Embedding the Python Interpreter": {
            "content": "",
            "subsections": [
                {
                    "name": "6.1 Recommended third party tools",
                    "content": ""
                }
            ]
        },
        "This guide only covers the basic tools for creating extensions provided": {
            "content": "as part of this version of CPython.  Third party tools like Cython(1),\ncffi(2), SWIG(3) and Numba(4) offer both simpler and more sophisticated\napproaches to creating C and C++ extensions for Python.\n\nSee also\n........\n",
            "subsections": []
        },
        "Python Packaging User Guide: Binary Extensions(5)": {
            "content": "The Python Packaging User Guide not only covers several available\ntools that simplify the creation of binary extensions, but also\ndiscusses the various reasons why creating an extension module may\nbe desirable in the first place.\n\n---------- Footnotes ----------\n\n(1) https://cython.org/\n\n(2) https://cffi.readthedocs.io\n\n(3) https://www.swig.org\n\n(4) https://numba.pydata.org/\n\n(5) https://packaging.python.org/guides/packaging-binary-extensions/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": [
                {
                    "name": "6.2 Creating extensions without third party tools",
                    "content": "This section of the guide covers creating C and C++ extensions without\nassistance from third party tools.  It is intended primarily for\ncreators of those tools, rather than being a recommended way to create\nyour own C extensions.\n\n* Menu:\n\n* Extending Python with C or C++::\n* Defining Extension Types; Tutorial: Defining Extension Types Tutorial.\n* Defining Extension Types; Assorted Topics: Defining Extension Types Assorted Topics.\n* Building C and C++ Extensions::\n* Building C and C++ Extensions on Windows::\n\nFile: python3.12.info,  Node: Extending Python with C or C++,  Next: Defining Extension Types Tutorial,  Up: Creating extensions without third party tools\n\n"
                }
            ]
        },
        "It is quite easy to add new built-in modules to Python, if you know how": {
            "content": "to program in C. Such 'extension modules' can do two things that can't\nbe done directly in Python: they can implement new built-in object\ntypes, and they can call C library functions and system calls.\n",
            "subsections": []
        },
        "To support extensions, the Python API (Application Programmers": {
            "content": "",
            "subsections": []
        },
        "Interface) defines a set of functions, macros and variables that provide": {
            "content": "access to most aspects of the Python run-time system.  The Python API is\nincorporated in a C source file by including the header '\"Python.h\"'.\n",
            "subsections": []
        },
        "The compilation of an extension module depends on its intended use as": {
            "content": "well as on your system setup; details are given in later chapters.\n\nNote: The C extension interface is specific to CPython, and\nextension modules do not work on other Python implementations.  In\nmany cases, it is possible to avoid writing C extensions and\npreserve portability to other implementations.  For example, if\nyour use case is calling C library functions or system calls, you\nshould consider using the *note ctypes: 28. module or the cffi(1)\nlibrary rather than writing custom C code.  These modules let you\nwrite Python code to interface with C code and are more portable\nbetween implementations of Python than writing and compiling a C\nextension module.\n\n* Menu:\n\n* A Simple Example::\n* Intermezzo; Errors and Exceptions: Intermezzo Errors and Exceptions.\n* Back to the Example::\n* The Module's Method Table and Initialization Function::\n* Compilation and Linkage::\n* Calling Python Functions from C::\n* Extracting Parameters in Extension Functions::\n* Keyword Parameters for Extension Functions::\n* Building Arbitrary Values::\n* Reference Counts::\n* Writing Extensions in C++::\n* Providing a C API for an Extension Module::\n\n---------- Footnotes ----------\n\n(1) https://cffi.readthedocs.io/\n\nFile: python3.12.info,  Node: A Simple Example,  Next: Intermezzo Errors and Exceptions,  Up: Extending Python with C or C++\n\n6.2.1.1 A Simple Example\n........................\n",
            "subsections": []
        },
        "Let's create an extension module called 'spam' (the favorite food of": {
            "content": "",
            "subsections": []
        },
        "Monty Python fans...) and let's say we want to create a Python interface": {
            "content": "to the C library function 'system()' (1).  This function takes a\nnull-terminated character string as argument and returns an integer.  We\nwant this function to be callable from Python as follows:\n\n>>> import spam\n>>> status = spam.system(\"ls -l\")\n",
            "subsections": []
        },
        "Begin by creating a file 'spammodule.c'.  (Historically, if a module is": {
            "content": "called 'spam', the C file containing its implementation is called\n'spammodule.c'; if the module name is very long, like 'spammify', the\nmodule name can be just 'spammify.c'.)\n\nThe first two lines of our file can be:\n\n#define PYSSIZETCLEAN\n#include <Python.h>\n\nwhich pulls in the Python API (you can add a comment describing the\npurpose of the module and a copyright notice if you like).\n\nNote: Since Python may define some pre-processor definitions which\naffect the standard headers on some systems, you 'must' include\n'Python.h' before any standard headers are included.\n\nIt is recommended to always define 'PYSSIZETCLEAN' before\nincluding 'Python.h'.  See *note Extracting Parameters in Extension\nFunctions: 4697. for a description of this macro.\n",
            "subsections": []
        },
        "All user-visible symbols defined by 'Python.h' have a prefix of 'Py' or": {
            "content": "'PY', except those defined in standard header files.  For convenience,\nand since they are used extensively by the Python interpreter,\n'\"Python.h\"' includes a few standard header files: '<stdio.h>',\n'<string.h>', '<errno.h>', and '<stdlib.h>'.  If the latter header file\ndoes not exist on your system, it declares the functions 'malloc()',\n'free()' and 'realloc()' directly.\n",
            "subsections": []
        },
        "The next thing we add to our module file is the C function that will be": {
            "content": "called when the Python expression 'spam.system(string)' is evaluated\n(we'll see shortly how it ends up being called):\n\nstatic PyObject *\nspamsystem(PyObject *self, PyObject *args)\n{\nconst char *command;\nint sts;\n\nif (!PyArgParseTuple(args, \"s\", &command))\nreturn NULL;\nsts = system(command);\nreturn PyLongFromLong(sts);\n}\n",
            "subsections": []
        },
        "There is a straightforward translation from the argument list in Python": {
            "content": "(for example, the single expression '\"ls -l\"') to the arguments passed\nto the C function.  The C function always has two arguments,\nconventionally named 'self' and 'args'.\n",
            "subsections": []
        },
        "The 'self' argument points to the module object for module-level": {
            "content": "functions; for a method it would point to the object instance.\n",
            "subsections": []
        },
        "The 'args' argument will be a pointer to a Python tuple object": {
            "content": "containing the arguments.  Each item of the tuple corresponds to an\nargument in the call's argument list.  The arguments are Python objects\n-- in order to do anything with them in our C function we have to convert\nthem to C values.  The function *note PyArgParseTuple(): 2d1. in the",
            "subsections": []
        },
        "Python API checks the argument types and converts them to C values.  It": {
            "content": "uses a template string to determine the required types of the arguments\nas well as the types of the C variables into which to store the\nconverted values.  More about this later.\n\n*note PyArgParseTuple(): 2d1. returns true (nonzero) if all arguments\nhave the right type and its components have been stored in the variables\nwhose addresses are passed.  It returns false (zero) if an invalid\nargument list was passed.  In the latter case it also raises an\nappropriate exception so the calling function can return 'NULL'\nimmediately (as we saw in the example).\n\n---------- Footnotes ----------\n\n(1) An interface for this function already exists in the standard\nmodule *note os: 9c. -- it was chosen as a simple and straightforward\nexample.\n\nFile: python3.12.info,  Node: Intermezzo Errors and Exceptions,  Next: Back to the Example,  Prev: A Simple Example,  Up: Extending Python with C or C++\n\n6.2.1.2 Intermezzo: Errors and Exceptions\n.........................................\n",
            "subsections": []
        },
        "An important convention throughout the Python interpreter is the": {
            "content": "following: when a function fails, it should set an exception condition\nand return an error value (usually '-1' or a 'NULL' pointer).  Exception\ninformation is stored in three members of the interpreter's thread\nstate.  These are 'NULL' if there is no exception.  Otherwise they are\nthe C equivalents of the members of the Python tuple returned by *note\nsys.excinfo(): 456.  These are the exception type, exception instance,\nand a traceback object.  It is important to know about them to\nunderstand how errors are passed around.\n",
            "subsections": []
        },
        "The Python API defines a number of functions to set various types of": {
            "content": "exceptions.\n\nThe most common one is *note PyErrSetString(): 2de.  Its arguments are\nan exception object and a C string.  The exception object is usually a\npredefined object like 'PyExcZeroDivisionError'.  The C string\nindicates the cause of the error and is converted to a Python string\nobject and stored as the \"associated value\" of the exception.\n\nAnother useful function is *note PyErrSetFromErrno(): 469a, which only\ntakes an exception argument and constructs the associated value by\ninspection of the global variable 'errno'.  The most general function is\n*note PyErrSetObject(): 2dd, which takes two object arguments, the\nexception and its associated value.  You don't need to *note\nPyINCREF(): 2ce. the objects passed to any of these functions.\n",
            "subsections": []
        },
        "You can test non-destructively whether an exception has been set with": {
            "content": "*note PyErrOccurred(): 1656.  This returns the current exception\nobject, or 'NULL' if no exception has occurred.  You normally don't need\nto call *note PyErrOccurred(): 1656. to see whether an error occurred\nin a function call, since you should be able to tell from the return\nvalue.\n",
            "subsections": []
        },
        "When a function 'f' that calls another function 'g' detects that the": {
            "content": "latter fails, 'f' should itself return an error value (usually 'NULL' or\n'-1').  It should 'not' call one of the 'PyErr*' functions -- one has\nalready been called by 'g'.  'f''s caller is then supposed to also\nreturn an error indication to 'its' caller, again 'without' calling\n'PyErr*', and so on -- the most detailed cause of the error was already\nreported by the function that first detected it.  Once the error reaches\nthe Python interpreter's main loop, this aborts the currently executing",
            "subsections": []
        },
        "Python code and tries to find an exception handler specified by the": {
            "content": "Python programmer.\n\n(There are situations where a module can actually give a more detailed\nerror message by calling another 'PyErr*' function, and in such cases\nit is fine to do so.  As a general rule, however, this is not necessary,\nand can cause information about the cause of the error to be lost: most\noperations can fail for a variety of reasons.)\n",
            "subsections": []
        },
        "To ignore an exception set by a function call that failed, the exception": {
            "content": "condition must be cleared explicitly by calling *note PyErrClear():\nea8.  The only time C code should call *note PyErrClear(): ea8. is if\nit doesn't want to pass the error on to the interpreter but wants to\nhandle it completely by itself (possibly by trying something else, or\npretending nothing went wrong).\n",
            "subsections": []
        },
        "Every failing 'malloc()' call must be turned into an exception -- the": {
            "content": "direct caller of 'malloc()' (or 'realloc()') must call *note",
            "subsections": []
        },
        "PyErrNoMemory(): 469b. and return a failure indicator itself.  All the": {
            "content": "object-creating functions (for example, *note PyLongFromLong(): 159c.)\nalready do this, so this note is only relevant to those who call\n'malloc()' directly.\n\nAlso note that, with the important exception of *note",
            "subsections": []
        },
        "PyArgParseTuple(): 2d1. and friends, functions that return an integer": {
            "content": "status usually return a positive value or zero for success and '-1' for\nfailure, like Unix system calls.\n\nFinally, be careful to clean up garbage (by making *note PyXDECREF():\n57d. or *note PyDECREF(): 2cf. calls for objects you have already\ncreated) when you return an error indicator!\n",
            "subsections": []
        },
        "The choice of which exception to raise is entirely yours.  There are": {
            "content": "predeclared C objects corresponding to all built-in Python exceptions,\nsuch as 'PyExcZeroDivisionError', which you can use directly.  Of\ncourse, you should choose exceptions wisely -- don't use\n'PyExcTypeError' to mean that a file couldn't be opened (that should\nprobably be 'PyExcOSError').  If something's wrong with the argument\nlist, the *note PyArgParseTuple(): 2d1. function usually raises\n'PyExcTypeError'.  If you have an argument whose value must be in a\nparticular range or must satisfy other conditions, 'PyExcValueError' is\nappropriate.\n",
            "subsections": []
        },
        "You can also define a new exception that is unique to your module.  For": {
            "content": "this, you usually declare a static object variable at the beginning of\nyour file:\n\nstatic PyObject *SpamError;\n\nand initialize it in your module's initialization function\n('PyInitspam()') with an exception object:\n\nPyMODINITFUNC\nPyInitspam(void)\n{\nPyObject *m;\n\nm = PyModuleCreate(&spammodule);\nif (m == NULL)\nreturn NULL;\n\nSpamError = PyErrNewException(\"spam.error\", NULL, NULL);\nPyXINCREF(SpamError);\nif (PyModuleAddObject(m, \"error\", SpamError) < 0) {\nPyXDECREF(SpamError);\nPyCLEAR(SpamError);\nPyDECREF(m);\nreturn NULL;\n}\n\nreturn m;\n}\n",
            "subsections": []
        },
        "Note that the Python name for the exception object is 'spam.error'.  The": {
            "content": "*note PyErrNewException(): 10e2. function may create a class with the\nbase class being *note Exception: 7ff. (unless another class is passed\nin instead of 'NULL'), described in *note Built-in Exceptions: 15e6.\n",
            "subsections": []
        },
        "Note also that the 'SpamError' variable retains a reference to the newly": {
            "content": "created exception class; this is intentional!  Since the exception could\nbe removed from the module by external code, an owned reference to the\nclass is needed to ensure that it will not be discarded, causing\n'SpamError' to become a dangling pointer.  Should it become a dangling\npointer, C code which raises the exception could cause a core dump or\nother unintended side effects.\n\nWe discuss the use of *note PyMODINITFUNC: 132e. as a function return\ntype later in this sample.\n",
            "subsections": []
        },
        "The 'spam.error' exception can be raised in your extension module using": {
            "content": "a call to *note PyErrSetString(): 2de. as shown below:\n\nstatic PyObject *\nspamsystem(PyObject *self, PyObject *args)\n{\nconst char *command;\nint sts;\n\nif (!PyArgParseTuple(args, \"s\", &command))\nreturn NULL;\nsts = system(command);\nif (sts < 0) {\nPyErrSetString(SpamError, \"System command failed\");\nreturn NULL;\n}\nreturn PyLongFromLong(sts);\n}\n\nFile: python3.12.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++\n\n6.2.1.3 Back to the Example\n...........................\n",
            "subsections": []
        },
        "Going back to our example function, you should now be able to understand": {
            "content": "this statement:\n\nif (!PyArgParseTuple(args, \"s\", &command))\nreturn NULL;\n",
            "subsections": []
        },
        "It returns 'NULL' (the error indicator for functions returning object": {
            "content": "pointers) if an error is detected in the argument list, relying on the\nexception set by *note PyArgParseTuple(): 2d1.  Otherwise the string\nvalue of the argument has been copied to the local variable 'command'.",
            "subsections": []
        },
        "This is a pointer assignment and you are not supposed to modify the": {
            "content": "string to which it points (so in Standard C, the variable 'command'\nshould properly be declared as 'const char *command').\n",
            "subsections": []
        },
        "The next statement is a call to the Unix function 'system()', passing it": {
            "content": "the string we just got from *note PyArgParseTuple(): 2d1.:\n\nsts = system(command);\n",
            "subsections": []
        },
        "Our 'spam.system()' function must return the value of 'sts' as a Python": {
            "content": "object.  This is done using the function *note PyLongFromLong(): 159c.\n\nreturn PyLongFromLong(sts);\n",
            "subsections": []
        },
        "In this case, it will return an integer object.  (Yes, even integers are": {
            "content": "objects on the heap in Python!)\n",
            "subsections": []
        },
        "If you have a C function that returns no useful argument (a function": {
            "content": "returning void), the corresponding Python function must return 'None'.\nYou need this idiom to do so (which is implemented by the *note\nPyRETURNNONE: 12c8. macro):\n\nPyINCREF(PyNone);\nreturn PyNone;\n\n*note PyNone: 469e. is the C name for the special Python object 'None'.",
            "subsections": []
        },
        "It is a genuine Python object rather than a 'NULL' pointer, which means": {
            "content": "\"error\" in most contexts, as we have seen.\n\nFile: python3.12.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++\n\n6.2.1.4 The Module's Method Table and Initialization Function\n.............................................................\n\nI promised to show how 'spamsystem()' is called from Python programs.\nFirst, we need to list its name and address in a \"method table\":\n\nstatic PyMethodDef SpamMethods[] = {\n...\n{\"system\",  spamsystem, METHVARARGS,\n\"Execute a shell command.\"},\n...\n{NULL, NULL, 0, NULL}        /* Sentinel */\n};\n",
            "subsections": []
        },
        "Note the third entry ('METHVARARGS').  This is a flag telling the": {
            "content": "interpreter the calling convention to be used for the C function.  It\nshould normally always be 'METHVARARGS' or 'METHVARARGS |\nMETHKEYWORDS'; a value of '0' means that an obsolete variant of *note\nPyArgParseTuple(): 2d1. is used.\n",
            "subsections": []
        },
        "When using only 'METHVARARGS', the function should expect the": {
            "content": "",
            "subsections": []
        },
        "Python-level parameters to be passed in as a tuple acceptable for": {
            "content": "parsing via *note PyArgParseTuple(): 2d1.; more information on this\nfunction is provided below.\n\nThe *note METHKEYWORDS: 46a1. bit may be set in the third field if\nkeyword arguments should be passed to the function.  In this case, the C\nfunction should accept a third 'PyObject *' parameter which will be a\ndictionary of keywords.  Use *note PyArgParseTupleAndKeywords(): b68.\nto parse the arguments to such a function.\n\nThe method table must be referenced in the module definition structure:\n\nstatic struct PyModuleDef spammodule = {\nPyModuleDefHEADINIT,\n\"spam\",   /* name of module */\nspamdoc, /* module documentation, may be NULL */\n-1,       /* size of per-interpreter state of the module,\nor -1 if the module keeps state in global variables. */\nSpamMethods\n};\n",
            "subsections": []
        },
        "This structure, in turn, must be passed to the interpreter in the": {
            "content": "module's initialization function.  The initialization function must be\nnamed 'PyInitname()', where 'name' is the name of the module, and\nshould be the only non-'static' item defined in the module file:\n\nPyMODINITFUNC\nPyInitspam(void)\n{\nreturn PyModuleCreate(&spammodule);\n}\n\nNote that *note PyMODINITFUNC: 132e. declares the function as 'PyObject\n*' return type, declares any special linkage declarations required by\nthe platform, and for C++ declares the function as 'extern \"C\"'.\n",
            "subsections": []
        },
        "When the Python program imports module 'spam' for the first time,": {
            "content": "'PyInitspam()' is called.  (See below for comments about embedding\nPython.)  It calls *note PyModuleCreate(): 46a2, which returns a module\nobject, and inserts built-in function objects into the newly created\nmodule based upon the table (an array of *note PyMethodDef: 1332.\nstructures) found in the module definition.  *note PyModuleCreate():\n46a2. returns a pointer to the module object that it creates.  It may\nabort with a fatal error for certain errors, or return 'NULL' if the\nmodule could not be initialized satisfactorily.  The init function must\nreturn the module object to its caller, so that it then gets inserted\ninto 'sys.modules'.\n",
            "subsections": []
        },
        "When embedding Python, the 'PyInitspam()' function is not called": {
            "content": "automatically unless there's an entry in the 'PyImportInittab' table.\nTo add the module to the initialization table, use *note",
            "subsections": []
        },
        "PyImportAppendInittab(): 14f8, optionally followed by an import of the": {
            "content": "module:\n\nint\nmain(int argc, char *argv[])\n{\nwchart *program = PyDecodeLocale(argv[0], NULL);\nif (program == NULL) {\nfprintf(stderr, \"Fatal error: cannot decode argv[0]\\n\");\nexit(1);\n}\n\n/* Add a built-in module, before PyInitialize */\nif (PyImportAppendInittab(\"spam\", PyInitspam) == -1) {\nfprintf(stderr, \"Error: could not extend in-built modules table\\n\");\nexit(1);\n}\n\n/* Pass argv[0] to the Python interpreter */\nPySetProgramName(program);\n\n/* Initialize the Python interpreter.  Required.\nIf this step fails, it will be a fatal error. */\nPyInitialize();\n\n/* Optionally import the module; alternatively,\nimport can be deferred until the embedded script\nimports it. */\nPyObject *pmodule = PyImportImportModule(\"spam\");\nif (!pmodule) {\nPyErrPrint();\nfprintf(stderr, \"Error: could not import module 'spam'\\n\");\n}\n\n...\n\nPyMemRawFree(program);\nreturn 0;\n}\n\nNote: Removing entries from 'sys.modules' or importing compiled\nmodules into multiple interpreters within a process (or following a\n'fork()' without an intervening 'exec()') can create problems for\nsome extension modules.  Extension module authors should exercise\ncaution when initializing internal data structures.\n\nA more substantial example module is included in the Python source\ndistribution as 'Modules/xxmodule.c'.  This file may be used as a\ntemplate or simply read as an example.\n\nNote: Unlike our 'spam' example, 'xxmodule' uses 'multi-phase\ninitialization' (new in Python 3.5), where a PyModuleDef structure\nis returned from 'PyInitspam', and creation of the module is left\nto the import machinery.  For details on multi-phase\ninitialization, see PEP 489(1).\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0489/\n\nFile: python3.12.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++\n\n6.2.1.5 Compilation and Linkage\n...............................\n\nThere are two more things to do before you can use your new extension:\ncompiling and linking it with the Python system.  If you use dynamic\nloading, the details may depend on the style of dynamic loading your\nsystem uses; see the chapters about building extension modules (chapter\n*note Building C and C++ Extensions: 46a5.) and additional information\nthat pertains only to building on Windows (chapter *note Building C and\nC++ Extensions on Windows: 1b7a.) for more information about this.\n",
            "subsections": []
        },
        "If you can't use dynamic loading, or if you want to make your module a": {
            "content": "permanent part of the Python interpreter, you will have to change the\nconfiguration setup and rebuild the interpreter.  Luckily, this is very\nsimple on Unix: just place your file ('spammodule.c' for example) in the\n'Modules/' directory of an unpacked source distribution, add a line to\nthe file 'Modules/Setup.local' describing your file:\n\nspam spammodule.o\n\nand rebuild the interpreter by running 'make' in the toplevel directory.",
            "subsections": []
        },
        "You can also run 'make' in the 'Modules/' subdirectory, but then you": {
            "content": "must first rebuild 'Makefile' there by running ''make' Makefile'.  (This\nis necessary each time you change the 'Setup' file.)\n",
            "subsections": []
        },
        "If your module requires additional libraries to link with, these can be": {
            "content": "listed on the line in the configuration file as well, for instance:\n\nspam spammodule.o -lX11\n\nFile: python3.12.info,  Node: Calling Python Functions from C,  Next: Extracting Parameters in Extension Functions,  Prev: Compilation and Linkage,  Up: Extending Python with C or C++\n\n6.2.1.6 Calling Python Functions from C\n.......................................\n\nSo far we have concentrated on making C functions callable from Python.",
            "subsections": []
        },
        "The reverse is also useful: calling Python functions from C. This is": {
            "content": "especially the case for libraries that support so-called \"callback\"\nfunctions.  If a C interface makes use of callbacks, the equivalent",
            "subsections": []
        },
        "Python often needs to provide a callback mechanism to the Python": {
            "content": "programmer; the implementation will require calling the Python callback\nfunctions from a C callback.  Other uses are also imaginable.\n",
            "subsections": []
        },
        "Fortunately, the Python interpreter is easily called recursively, and": {
            "content": "there is a standard interface to call a Python function.  (I won't dwell\non how to call the Python parser with a particular string as input -- if\nyou're interested, have a look at the implementation of the *note -c:\n3a4. command line option in 'Modules/main.c' from the Python source\ncode.)\n",
            "subsections": []
        },
        "Calling a Python function is easy.  First, the Python program must": {
            "content": "somehow pass you the Python function object.  You should provide a\nfunction (or some other interface) to do this.  When this function is\ncalled, save a pointer to the Python function object (be careful to\n*note PyINCREF(): 2ce. it!)  in a global variable -- or wherever you see\nfit.  For example, the following function might be part of a module\ndefinition:\n\nstatic PyObject *mycallback = NULL;\n\nstatic PyObject *\nmysetcallback(PyObject *dummy, PyObject *args)\n{\nPyObject *result = NULL;\nPyObject *temp;\n\nif (PyArgParseTuple(args, \"O:setcallback\", &temp)) {\nif (!PyCallableCheck(temp)) {\nPyErrSetString(PyExcTypeError, \"parameter must be callable\");\nreturn NULL;\n}\nPyXINCREF(temp);         /* Add a reference to new callback */\nPyXDECREF(mycallback);  /* Dispose of previous callback */\nmycallback = temp;       /* Remember new callback */\n/* Boilerplate to return \"None\" */\nPyINCREF(PyNone);\nresult = PyNone;\n}\nreturn result;\n}\n\nThis function must be registered with the interpreter using the *note\nMETHVARARGS: 1364. flag; this is described in section *note The\nModule's Method Table and Initialization Function: 469f.  The *note",
            "subsections": []
        },
        "PyArgParseTuple(): 2d1. function and its arguments are documented in": {
            "content": "section *note Extracting Parameters in Extension Functions: 4697.\n\nThe macros *note PyXINCREF(): 892. and *note PyXDECREF(): 57d.\nincrement/decrement the reference count of an object and are safe in the\npresence of 'NULL' pointers (but note that 'temp' will not be 'NULL' in\nthis context).  More info on them in section *note Reference Counts:\n46a8.\n",
            "subsections": []
        },
        "Later, when it is time to call the function, you call the C function": {
            "content": "*note PyObjectCallObject(): 46a9.  This function has two arguments,\nboth pointers to arbitrary Python objects: the Python function, and the\nargument list.  The argument list must always be a tuple object, whose\nlength is the number of arguments.  To call the Python function with no\narguments, pass in 'NULL', or an empty tuple; to call it with one\nargument, pass a singleton tuple.  *note PyBuildValue(): 6bb. returns a\ntuple when its format string consists of zero or more format codes\nbetween parentheses.  For example:\n\nint arg;\nPyObject *arglist;\nPyObject *result;\n...\narg = 123;\n...\n/* Time to call the callback */\narglist = PyBuildValue(\"(i)\", arg);\nresult = PyObjectCallObject(mycallback, arglist);\nPyDECREF(arglist);\n\n*note PyObjectCallObject(): 46a9. returns a Python object pointer: this\nis the return value of the Python function.  *note\nPyObjectCallObject(): 46a9. is \"reference-count-neutral\" with respect\nto its arguments.  In the example a new tuple was created to serve as\nthe argument list, which is *note PyDECREF(): 2cf.-ed immediately after\nthe *note PyObjectCallObject(): 46a9. call.\n\nThe return value of *note PyObjectCallObject(): 46a9. is \"new\": either\nit is a brand new object, or it is an existing object whose reference\ncount has been incremented.  So, unless you want to save it in a global\nvariable, you should somehow *note PyDECREF(): 2cf. the result, even\n(especially!)  if you are not interested in its value.\n",
            "subsections": []
        },
        "Before you do this, however, it is important to check that the return": {
            "content": "value isn't 'NULL'.  If it is, the Python function terminated by raising\nan exception.  If the C code that called *note PyObjectCallObject():\n46a9. is called from Python, it should now return an error indication to\nits Python caller, so the interpreter can print a stack trace, or the\ncalling Python code can handle the exception.  If this is not possible\nor desirable, the exception should be cleared by calling *note\nPyErrClear(): ea8.  For example:\n\nif (result == NULL)\nreturn NULL; /* Pass error back */\n...use result...\nPyDECREF(result);\n",
            "subsections": []
        },
        "Depending on the desired interface to the Python callback function, you": {
            "content": "may also have to provide an argument list to *note",
            "subsections": []
        },
        "PyObjectCallObject(): 46a9.  In some cases the argument list is also": {
            "content": "provided by the Python program, through the same interface that\nspecified the callback function.  It can then be saved and used in the\nsame manner as the function object.  In other cases, you may have to\nconstruct a new tuple to pass as the argument list.  The simplest way to\ndo this is to call *note PyBuildValue(): 6bb.  For example, if you want\nto pass an integral event code, you might use the following code:\n\nPyObject *arglist;\n...\narglist = PyBuildValue(\"(l)\", eventcode);\nresult = PyObjectCallObject(mycallback, arglist);\nPyDECREF(arglist);\nif (result == NULL)\nreturn NULL; /* Pass error back */\n/* Here maybe use the result */\nPyDECREF(result);\n",
            "subsections": []
        },
        "Note the placement of 'PyDECREF(arglist)' immediately after the call,": {
            "content": "before the error check!  Also note that strictly speaking this code is\nnot complete: *note PyBuildValue(): 6bb. may run out of memory, and\nthis should be checked.\n\nYou may also call a function with keyword arguments by using *note\nPyObjectCall(): 787, which supports arguments and keyword arguments.\nAs in the above example, we use *note PyBuildValue(): 6bb. to construct\nthe dictionary.\n\nPyObject *dict;\n...\ndict = PyBuildValue(\"{s:i}\", \"name\", val);\nresult = PyObjectCall(mycallback, NULL, dict);\nPyDECREF(dict);\nif (result == NULL)\nreturn NULL; /* Pass error back */\n/* Here maybe use the result */\nPyDECREF(result);\n\nFile: python3.12.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++\n\n6.2.1.7 Extracting Parameters in Extension Functions\n....................................................\n\nThe *note PyArgParseTuple(): 2d1. function is declared as follows:\n\nint PyArgParseTuple(PyObject *arg, const char *format, ...);\n",
            "subsections": []
        },
        "The 'arg' argument must be a tuple object containing an argument list": {
            "content": "passed from Python to a C function.  The 'format' argument must be a\nformat string, whose syntax is explained in *note Parsing arguments and\nbuilding values: 6bc. in the Python/C API Reference Manual.  The\nremaining arguments must be addresses of variables whose type is\ndetermined by the format string.\n\nNote that while *note PyArgParseTuple(): 2d1. checks that the Python\narguments have the required types, it cannot check the validity of the\naddresses of C variables passed to the call: if you make mistakes there,\nyour code will probably crash or at least overwrite random bits in\nmemory.  So be careful!\n",
            "subsections": []
        },
        "Note that any Python object references which are provided to the caller": {
            "content": "are 'borrowed' references; do not release them (i.e.  do not decrement\ntheir reference count)!\n",
            "subsections": []
        },
        "PyArgParseTuple(): 2d1. function.  The 'kwdict' parameter is the": {
            "content": "dictionary of keywords received as the third parameter from the Python\nruntime.  The 'kwlist' parameter is a 'NULL'-terminated list of strings\nwhich identify the parameters; the names are matched with the type\ninformation from 'format' from left to right.  On success, *note",
            "subsections": []
        },
        "PyArgParseTupleAndKeywords(): b68. returns true, otherwise it returns": {
            "content": "false and raises an appropriate exception.\n\nNote: Nested tuples cannot be parsed when using keyword arguments!\nKeyword parameters passed in which are not present in the 'kwlist'\nwill cause *note TypeError: 28e. to be raised.\n",
            "subsections": []
        },
        "Here is an example module which uses keywords, based on an example by": {
            "content": "Geoff Philbrick (<philbrick@hks.com>):\n\n#define PYSSIZETCLEAN  /* Make \"s#\" use Pyssizet rather than int. */\n#include <Python.h>\n\nstatic PyObject *\nkeywdargparrot(PyObject *self, PyObject *args, PyObject *keywds)\n{\nint voltage;\nconst char *state = \"a stiff\";\nconst char *action = \"voom\";\nconst char *type = \"Norwegian Blue\";\n\nstatic char *kwlist[] = {\"voltage\", \"state\", \"action\", \"type\", NULL};\n\nif (!PyArgParseTupleAndKeywords(args, keywds, \"i|sss\", kwlist,\n&voltage, &state, &action, &type))\nreturn NULL;\n\nprintf(\"-- This parrot wouldn't %s if you put %i Volts through it.\\n\",\naction, voltage);\nprintf(\"-- Lovely plumage, the %s -- It's %s!\\n\", type, state);\n\nPyRETURNNONE;\n}\n\nstatic PyMethodDef keywdargmethods[] = {\n/* The cast of the function is necessary since PyCFunction values\n* only take two PyObject* parameters, and keywdargparrot() takes\n* three.\n*/\n{\"parrot\", (PyCFunction)(void(*)(void))keywdargparrot, METHVARARGS | METHKEYWORDS,\n\"Print a lovely skit to standard output.\"},\n{NULL, NULL, 0, NULL}   /* sentinel */\n};\n\nstatic struct PyModuleDef keywdargmodule = {\nPyModuleDefHEADINIT,\n\"keywdarg\",\nNULL,\n-1,\nkeywdargmethods\n};\n\nPyMODINITFUNC\nPyInitkeywdarg(void)\n{\nreturn PyModuleCreate(&keywdargmodule);\n}\n\nFile: python3.12.info,  Node: Building Arbitrary Values,  Next: Reference Counts,  Prev: Keyword Parameters for Extension Functions,  Up: Extending Python with C or C++\n\n6.2.1.9 Building Arbitrary Values\n.................................\n\nThis function is the counterpart to *note PyArgParseTuple(): 2d1.  It\nis declared as follows:\n\nPyObject *PyBuildValue(const char *format, ...);\n",
            "subsections": []
        },
        "It recognizes a set of format units similar to the ones recognized by": {
            "content": "*note PyArgParseTuple(): 2d1, but the arguments (which are input to the\nfunction, not output) must not be pointers, just values.  It returns a\nnew Python object, suitable for returning from a C function called from\nPython.\n\nOne difference with *note PyArgParseTuple(): 2d1.: while the latter\nrequires its first argument to be a tuple (since Python argument lists\nare always represented as tuples internally), *note PyBuildValue():\n6bb. does not always build a tuple.  It builds a tuple only if its\nformat string contains two or more format units.  If the format string\nis empty, it returns 'None'; if it contains exactly one format unit, it\nreturns whatever object is described by that format unit.  To force it\nto return a tuple of size 0 or one, parenthesize the format string.\n",
            "subsections": []
        },
        "Examples (to the left the call, to the right the resulting Python": {
            "content": "value):\n\nPyBuildValue(\"\")                        None\nPyBuildValue(\"i\", 123)                  123\nPyBuildValue(\"iii\", 123, 456, 789)      (123, 456, 789)\nPyBuildValue(\"s\", \"hello\")              'hello'\nPyBuildValue(\"y\", \"hello\")              b'hello'\nPyBuildValue(\"ss\", \"hello\", \"world\")    ('hello', 'world')\nPyBuildValue(\"s#\", \"hello\", 4)          'hell'\nPyBuildValue(\"y#\", \"hello\", 4)          b'hell'\nPyBuildValue(\"()\")                      ()\nPyBuildValue(\"(i)\", 123)                (123,)\nPyBuildValue(\"(ii)\", 123, 456)          (123, 456)\nPyBuildValue(\"(i,i)\", 123, 456)         (123, 456)\nPyBuildValue(\"[i,i]\", 123, 456)         [123, 456]\nPyBuildValue(\"{s:i,s:i}\",\n\"abc\", 123, \"def\", 456)    {'abc': 123, 'def': 456}\nPyBuildValue(\"((ii)(ii)) (ii)\",\n1, 2, 3, 4, 5, 6)          (((1, 2), (3, 4)), (5, 6))\n\nFile: python3.12.info,  Node: Reference Counts,  Next: Writing Extensions in C++,  Prev: Building Arbitrary Values,  Up: Extending Python with C or C++\n\n6.2.1.10 Reference Counts\n.........................\n\nIn languages like C or C++, the programmer is responsible for dynamic\nallocation and deallocation of memory on the heap.  In C, this is done\nusing the functions 'malloc()' and 'free()'.  In C++, the operators\n'new' and 'delete' are used with essentially the same meaning and we'll\nrestrict the following discussion to the C case.\n",
            "subsections": []
        },
        "Every block of memory allocated with 'malloc()' should eventually be": {
            "content": "returned to the pool of available memory by exactly one call to\n'free()'.  It is important to call 'free()' at the right time.  If a\nblock's address is forgotten but 'free()' is not called for it, the\nmemory it occupies cannot be reused until the program terminates.  This\nis called a 'memory leak'.  On the other hand, if a program calls\n'free()' for a block and then continues to use the block, it creates a\nconflict with re-use of the block through another 'malloc()' call.  This\nis called 'using freed memory'.  It has the same bad consequences as\nreferencing uninitialized data -- core dumps, wrong results, mysterious\ncrashes.\n",
            "subsections": []
        },
        "Common causes of memory leaks are unusual paths through the code.  For": {
            "content": "instance, a function may allocate a block of memory, do some\ncalculation, and then free the block again.  Now a change in the\nrequirements for the function may add a test to the calculation that\ndetects an error condition and can return prematurely from the function.",
            "subsections": []
        },
        "It's easy to forget to free the allocated memory block when taking this": {
            "content": "premature exit, especially when it is added later to the code.  Such\nleaks, once introduced, often go undetected for a long time: the error\nexit is taken only in a small fraction of all calls, and most modern\nmachines have plenty of virtual memory, so the leak only becomes\napparent in a long-running process that uses the leaking function\nfrequently.  Therefore, it's important to prevent leaks from happening\nby having a coding convention or strategy that minimizes this kind of\nerrors.\n",
            "subsections": []
        },
        "Since Python makes heavy use of 'malloc()' and 'free()', it needs a": {
            "content": "strategy to avoid memory leaks as well as the use of freed memory.  The\nchosen method is called 'reference counting'.  The principle is simple:\nevery object contains a counter, which is incremented when a reference\nto the object is stored somewhere, and which is decremented when a\nreference to it is deleted.  When the counter reaches zero, the last\nreference to the object has been deleted and the object is freed.\n\nAn alternative strategy is called 'automatic garbage collection'.\n(Sometimes, reference counting is also referred to as a garbage\ncollection strategy, hence my use of \"automatic\" to distinguish the\ntwo.)  The big advantage of automatic garbage collection is that the\nuser doesn't need to call 'free()' explicitly.  (Another claimed\nadvantage is an improvement in speed or memory usage -- this is no hard\nfact however.)  The disadvantage is that for C, there is no truly\nportable automatic garbage collector, while reference counting can be\nimplemented portably (as long as the functions 'malloc()' and 'free()'\nare available -- which the C Standard guarantees).  Maybe some day a\nsufficiently portable automatic garbage collector will be available for\nC. Until then, we'll have to live with reference counts.\n",
            "subsections": []
        },
        "While Python uses the traditional reference counting implementation, it": {
            "content": "also offers a cycle detector that works to detect reference cycles.",
            "subsections": []
        },
        "This allows applications to not worry about creating direct or indirect": {
            "content": "circular references; these are the weakness of garbage collection\nimplemented using only reference counting.  Reference cycles consist of\nobjects which contain (possibly indirect) references to themselves, so\nthat each object in the cycle has a reference count which is non-zero.",
            "subsections": []
        },
        "Typical reference counting implementations are not able to reclaim the": {
            "content": "memory belonging to any objects in a reference cycle, or referenced from\nthe objects in the cycle, even though there are no further references to\nthe cycle itself.\n",
            "subsections": []
        },
        "The cycle detector is able to detect garbage cycles and can reclaim": {
            "content": "them.  The *note gc: 5b. module exposes a way to run the detector (the\n*note collect(): 865. function), as well as configuration interfaces and\nthe ability to disable the detector at runtime.\n\n* Menu:\n\n* Reference Counting in Python::\n* Ownership Rules::\n* Thin Ice::\n* NULL Pointers::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Reference Counting in Python,  Next: Ownership Rules,  Up: Reference Counts": {
            "content": "6.2.1.11 Reference Counting in Python\n.....................................\n",
            "subsections": []
        },
        "There are two macros, 'PyINCREF(x)' and 'PyDECREF(x)', which handle": {
            "content": "the incrementing and decrementing of the reference count.  *note\nPyDECREF(): 2cf. also frees the object when the count reaches zero.",
            "subsections": []
        },
        "For flexibility, it doesn't call 'free()' directly -- rather, it makes a": {
            "content": "call through a function pointer in the object's 'type object'.  For this\npurpose (and others), every object also contains a pointer to its type\nobject.\n",
            "subsections": []
        },
        "The big question now remains: when to use 'PyINCREF(x)' and": {
            "content": "'PyDECREF(x)'?  Let's first introduce some terms.  Nobody \"owns\" an\nobject; however, you can 'own a reference' to an object.  An object's\nreference count is now defined as the number of owned references to it.\nThe owner of a reference is responsible for calling *note PyDECREF():\n2cf. when the reference is no longer needed.  Ownership of a reference\ncan be transferred.  There are three ways to dispose of an owned\nreference: pass it on, store it, or call *note PyDECREF(): 2cf.\nForgetting to dispose of an owned reference creates a memory leak.\n",
            "subsections": []
        },
        "It is also possible to 'borrow' (1) a reference to an object.  The": {
            "content": "borrower of a reference should not call *note PyDECREF(): 2cf.  The\nborrower must not hold on to the object longer than the owner from which\nit was borrowed.  Using a borrowed reference after the owner has\ndisposed of it risks using freed memory and should be avoided completely\n(2).\n",
            "subsections": []
        },
        "The advantage of borrowing over owning a reference is that you don't": {
            "content": "need to take care of disposing of the reference on all possible paths\nthrough the code -- in other words, with a borrowed reference you don't\nrun the risk of leaking when a premature exit is taken.  The\ndisadvantage of borrowing over owning is that there are some subtle\nsituations where in seemingly correct code a borrowed reference can be\nused after the owner from which it was borrowed has in fact disposed of\nit.\n\nA borrowed reference can be changed into an owned reference by calling\n*note PyINCREF(): 2ce.  This does not affect the status of the owner\nfrom which the reference was borrowed -- it creates a new owned\nreference, and gives full owner responsibilities (the new owner must\ndispose of the reference properly, as well as the previous owner).\n\n---------- Footnotes ----------\n\n(1) The metaphor of \"borrowing\" a reference is not completely\ncorrect: the owner still has a copy of the reference.\n\n(2) Checking that the reference count is at least 1 'does not work' --\nthe reference count itself could be in freed memory and may thus be\nreused for another object!\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Ownership Rules,  Next: Thin Ice,  Prev: Reference Counting in Python,  Up: Reference Counts": {
            "content": "6.2.1.12 Ownership Rules\n........................\n",
            "subsections": []
        },
        "Whenever an object reference is passed into or out of a function, it is": {
            "content": "part of the function's interface specification whether ownership is\ntransferred with the reference or not.\n",
            "subsections": []
        },
        "Most functions that return a reference to an object pass on ownership": {
            "content": "with the reference.  In particular, all functions whose function it is\nto create a new object, such as *note PyLongFromLong(): 159c. and *note",
            "subsections": []
        },
        "PyBuildValue(): 6bb, pass ownership to the receiver.  Even if the": {
            "content": "object is not actually new, you still receive ownership of a new\nreference to that object.  For instance, *note PyLongFromLong(): 159c.\nmaintains a cache of popular values and can return a reference to a\ncached item.\n",
            "subsections": []
        },
        "Many functions that extract objects from other objects also transfer": {
            "content": "ownership with the reference, for instance *note",
            "subsections": []
        },
        "PyObjectGetAttrString(): 46b4.  The picture is less clear, here,": {
            "content": "however, since a few common routines are exceptions: *note\nPyTupleGetItem(): 46b5, *note PyListGetItem(): 46b6, *note\nPyDictGetItem(): 6bf, and *note PyDictGetItemString(): 46b7. all\nreturn references that you borrow from the tuple, list or dictionary.\n\nThe function *note PyImportAddModule(): 46b8. also returns a borrowed\nreference, even though it may actually create the object it returns:\nthis is possible because an owned reference to the object is stored in\n'sys.modules'.\n",
            "subsections": []
        },
        "When you pass an object reference into another function, in general, the": {
            "content": "function borrows the reference from you -- if it needs to store it, it\nwill use *note PyINCREF(): 2ce. to become an independent owner.  There\nare exactly two important exceptions to this rule: *note\nPyTupleSetItem(): 46b9. and *note PyListSetItem(): 46ba.  These\nfunctions take over ownership of the item passed to them -- even if they\nfail!  (Note that *note PyDictSetItem(): 46bb. and friends don't take\nover ownership -- they are \"normal.\")\n",
            "subsections": []
        },
        "When a C function is called from Python, it borrows references to its": {
            "content": "arguments from the caller.  The caller owns a reference to the object,\nso the borrowed reference's lifetime is guaranteed until the function\nreturns.  Only when such a borrowed reference must be stored or passed\non, it must be turned into an owned reference by calling *note\nPyINCREF(): 2ce.\n",
            "subsections": []
        },
        "The object reference returned from a C function that is called from": {
            "content": "",
            "subsections": []
        },
        "Python must be an owned reference -- ownership is transferred from the": {
            "content": "function to its caller.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Thin Ice,  Next: NULL Pointers,  Prev: Ownership Rules,  Up: Reference Counts": {
            "content": "6.2.1.13 Thin Ice\n.................\n",
            "subsections": []
        },
        "There are a few situations where seemingly harmless use of a borrowed": {
            "content": "reference can lead to problems.  These all have to do with implicit\ninvocations of the interpreter, which can cause the owner of a reference\nto dispose of it.\n\nThe first and most important case to know about is using *note",
            "subsections": []
        },
        "PyDECREF(): 2cf. on an unrelated object while borrowing a reference to": {
            "content": "a list item.  For instance:\n\nvoid\nbug(PyObject *list)\n{\nPyObject *item = PyListGetItem(list, 0);\n\nPyListSetItem(list, 1, PyLongFromLong(0L));\nPyObjectPrint(item, stdout, 0); /* BUG! */\n}\n\nThis function first borrows a reference to 'list[0]', then replaces\n'list[1]' with the value '0', and finally prints the borrowed reference.\nLooks harmless, right?  But it's not!\n\nLet's follow the control flow into *note PyListSetItem(): 46ba.  The\nlist owns references to all its items, so when item 1 is replaced, it\nhas to dispose of the original item 1.  Now let's suppose the original\nitem 1 was an instance of a user-defined class, and let's further\nsuppose that the class defined a 'del()' method.  If this class\ninstance has a reference count of 1, disposing of it will call its\n'del()' method.\n",
            "subsections": []
        },
        "Since it is written in Python, the 'del()' method can execute": {
            "content": "arbitrary Python code.  Could it perhaps do something to invalidate the\nreference to 'item' in 'bug()'?  You bet!  Assuming that the list passed\ninto 'bug()' is accessible to the 'del()' method, it could execute a\nstatement to the effect of 'del list[0]', and assuming this was the last\nreference to that object, it would free the memory associated with it,\nthereby invalidating 'item'.\n\nThe solution, once you know the source of the problem, is easy:\ntemporarily increment the reference count.  The correct version of the\nfunction reads:\n\nvoid\nnobug(PyObject *list)\n{\nPyObject *item = PyListGetItem(list, 0);\n\nPyINCREF(item);\nPyListSetItem(list, 1, PyLongFromLong(0L));\nPyObjectPrint(item, stdout, 0);\nPyDECREF(item);\n}\n",
            "subsections": []
        },
        "This is a true story.  An older version of Python contained variants of": {
            "content": "this bug and someone spent a considerable amount of time in a C debugger\nto figure out why his 'del()' methods would fail...\n",
            "subsections": []
        },
        "The second case of problems with a borrowed reference is a variant": {
            "content": "involving threads.  Normally, multiple threads in the Python interpreter\ncan't get in each other's way, because there is a global lock protecting",
            "subsections": []
        },
        "Python's entire object space.  However, it is possible to temporarily": {
            "content": "release this lock using the macro *note PyBEGINALLOWTHREADS: 46be,\nand to re-acquire it using *note PyENDALLOWTHREADS: 8be.  This is\ncommon around blocking I/O calls, to let other threads use the processor\nwhile waiting for the I/O to complete.  Obviously, the following\nfunction has the same problem as the previous one:\n\nvoid\nbug(PyObject *list)\n{\nPyObject *item = PyListGetItem(list, 0);\nPyBEGINALLOWTHREADS\n...some blocking I/O call...\nPyENDALLOWTHREADS\nPyObjectPrint(item, stdout, 0); /* BUG! */\n}\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: NULL Pointers,  Prev: Thin Ice,  Up: Reference Counts": {
            "content": "6.2.1.14 NULL Pointers\n......................\n",
            "subsections": []
        },
        "In general, functions that take object references as arguments do not": {
            "content": "expect you to pass them 'NULL' pointers, and will dump core (or cause\nlater core dumps) if you do so.  Functions that return object references\ngenerally return 'NULL' only to indicate that an exception occurred.",
            "subsections": []
        },
        "The reason for not testing for 'NULL' arguments is that functions often": {
            "content": "pass the objects they receive on to other function -- if each function\nwere to test for 'NULL', there would be a lot of redundant tests and the\ncode would run more slowly.\n\nIt is better to test for 'NULL' only at the \"source:\" when a pointer\nthat may be 'NULL' is received, for example, from 'malloc()' or from a\nfunction that may raise an exception.\n\nThe macros *note PyINCREF(): 2ce. and *note PyDECREF(): 2cf. do not\ncheck for 'NULL' pointers -- however, their variants *note PyXINCREF():\n892. and *note PyXDECREF(): 57d. do.\n",
            "subsections": []
        },
        "The macros for checking for a particular object type ('PytypeCheck()')": {
            "content": "don't check for 'NULL' pointers -- again, there is much code that calls\nseveral of these in a row to test an object against various different\nexpected types, and this would generate redundant tests.  There are no\nvariants with 'NULL' checking.\n",
            "subsections": []
        },
        "The C function calling mechanism guarantees that the argument list": {
            "content": "passed to C functions ('args' in the examples) is never 'NULL' -- in fact\nit guarantees that it is always a tuple (1).\n\nIt is a severe error to ever let a 'NULL' pointer \"escape\" to the Python\nuser.\n\n---------- Footnotes ----------\n\n(1) These guarantees don't hold when you use the \"old\" style calling\nconvention -- this is still found in much existing code.\n\nFile: python3.12.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++\n\n6.2.1.15 Writing Extensions in C++\n..................................\n\nIt is possible to write extension modules in C++.  Some restrictions\napply.  If the main program (the Python interpreter) is compiled and\nlinked by the C compiler, global or static objects with constructors\ncannot be used.  This is not a problem if the main program is linked by\nthe C++ compiler.  Functions that will be called by the Python\ninterpreter (in particular, module initialization functions) have to be\ndeclared using 'extern \"C\"'.  It is unnecessary to enclose the Python\nheader files in 'extern \"C\" {...}' -- they use this form already if the\nsymbol 'cplusplus' is defined (all recent C++ compilers define this\nsymbol).\n\nFile: python3.12.info,  Node: Providing a C API for an Extension Module,  Prev: Writing Extensions in C++,  Up: Extending Python with C or C++\n\n6.2.1.16 Providing a C API for an Extension Module\n..................................................\n",
            "subsections": []
        },
        "Many extension modules just provide new functions and types to be used": {
            "content": "from Python, but sometimes the code in an extension module can be useful\nfor other extension modules.  For example, an extension module could\nimplement a type \"collection\" which works like lists without order.",
            "subsections": []
        },
        "Just like the standard Python list type has a C API which permits": {
            "content": "extension modules to create and manipulate lists, this new collection\ntype should have a set of C functions for direct manipulation from other\nextension modules.\n",
            "subsections": []
        },
        "At first sight this seems easy: just write the functions (without": {
            "content": "declaring them 'static', of course), provide an appropriate header file,\nand document the C API. And in fact this would work if all extension\nmodules were always linked statically with the Python interpreter.  When\nmodules are used as shared libraries, however, the symbols defined in\none module may not be visible to another module.  The details of\nvisibility depend on the operating system; some systems use one global\nnamespace for the Python interpreter and all extension modules (Windows,\nfor example), whereas others require an explicit list of imported\nsymbols at module link time (AIX is one example), or offer a choice of\ndifferent strategies (most Unices).  And even if symbols are globally\nvisible, the module whose functions one wishes to call might not have\nbeen loaded yet!\n",
            "subsections": []
        },
        "Portability therefore requires not to make any assumptions about symbol": {
            "content": "visibility.  This means that all symbols in extension modules should be\ndeclared 'static', except for the module's initialization function, in\norder to avoid name clashes with other extension modules (as discussed\nin section *note The Module's Method Table and Initialization Function:\n469f.).  And it means that symbols that 'should' be accessible from\nother extension modules must be exported in a different way.\n",
            "subsections": []
        },
        "Python provides a special mechanism to pass C-level information": {
            "content": "(pointers) from one extension module to another one: Capsules.  A\nCapsule is a Python data type which stores a pointer (void*).  Capsules\ncan only be created and accessed via their C API, but they can be passed\naround like any other Python object.  In particular, they can be\nassigned to a name in an extension module's namespace.  Other extension\nmodules can then import this module, retrieve the value of this name,\nand then retrieve the pointer from the Capsule.\n",
            "subsections": []
        },
        "There are many ways in which Capsules can be used to export the C API of": {
            "content": "an extension module.  Each function could get its own Capsule, or all C\nAPI pointers could be stored in an array whose address is published in a",
            "subsections": []
        },
        "Capsule.  And the various tasks of storing and retrieving the pointers": {
            "content": "can be distributed in different ways between the module providing the\ncode and the client modules.\n",
            "subsections": []
        },
        "Whichever method you choose, it's important to name your Capsules": {
            "content": "properly.  The function *note PyCapsuleNew(): 46c4. takes a name\nparameter (const char*); you're permitted to pass in a 'NULL' name, but\nwe strongly encourage you to specify a name.  Properly named Capsules\nprovide a degree of runtime type-safety; there is no feasible way to\ntell one unnamed Capsule from another.\n",
            "subsections": []
        },
        "In particular, Capsules used to expose C APIs should be given a name": {
            "content": "following this convention:\n\nmodulename.attributename\n\nThe convenience function *note PyCapsuleImport(): 15cf. makes it easy\nto load a C API provided via a Capsule, but only if the Capsule's name\nmatches this convention.  This behavior gives C API users a high degree\nof certainty that the Capsule they load contains the correct C API.\n",
            "subsections": []
        },
        "The following example demonstrates an approach that puts most of the": {
            "content": "burden on the writer of the exporting module, which is appropriate for\ncommonly used library modules.  It stores all C API pointers (just one\nin the example!)  in an array of void pointers which becomes the value\nof a Capsule.  The header file corresponding to the module provides a\nmacro that takes care of importing the module and retrieving its C API\npointers; client modules only have to call this macro before accessing\nthe C API.\n",
            "subsections": []
        },
        "The exporting module is a modification of the 'spam' module from section": {
            "content": "*note A Simple Example: 4696.  The function 'spam.system()' does not\ncall the C library function 'system()' directly, but a function\n'PySpamSystem()', which would of course do something more complicated\nin reality (such as adding \"spam\" to every command).  This function\n'PySpamSystem()' is also exported to other extension modules.\n",
            "subsections": []
        },
        "The function 'PySpamSystem()' is a plain C function, declared 'static'": {
            "content": "like everything else:\n\nstatic int\nPySpamSystem(const char *command)\n{\nreturn system(command);\n}\n\nThe function 'spamsystem()' is modified in a trivial way:\n\nstatic PyObject *\nspamsystem(PyObject *self, PyObject *args)\n{\nconst char *command;\nint sts;\n\nif (!PyArgParseTuple(args, \"s\", &command))\nreturn NULL;\nsts = PySpamSystem(command);\nreturn PyLongFromLong(sts);\n}\n",
            "subsections": []
        },
        "In the beginning of the module, right after the line": {
            "content": "#include <Python.h>\n\ntwo more lines must be added:\n\n#define SPAMMODULE\n#include \"spammodule.h\"\n\nThe '#define' is used to tell the header file that it is being included\nin the exporting module, not a client module.  Finally, the module's\ninitialization function must take care of initializing the C API pointer\narray:\n\nPyMODINITFUNC\nPyInitspam(void)\n{\nPyObject *m;\nstatic void *PySpamAPI[PySpamAPIpointers];\nPyObject *capiobject;\n\nm = PyModuleCreate(&spammodule);\nif (m == NULL)\nreturn NULL;\n\n/* Initialize the C API pointer array */\nPySpamAPI[PySpamSystemNUM] = (void *)PySpamSystem;\n\n/* Create a Capsule containing the API pointer array's address */\ncapiobject = PyCapsuleNew((void *)PySpamAPI, \"spam.CAPI\", NULL);\n\nif (PyModuleAddObject(m, \"CAPI\", capiobject) < 0) {\nPyXDECREF(capiobject);\nPyDECREF(m);\nreturn NULL;\n}\n\nreturn m;\n}\n",
            "subsections": []
        },
        "Note that 'PySpamAPI' is declared 'static'; otherwise the pointer array": {
            "content": "would disappear when 'PyInitspam()' terminates!\n",
            "subsections": []
        },
        "The bulk of the work is in the header file 'spammodule.h', which looks": {
            "content": "like this:\n\n#ifndef PySPAMMODULEH\n#define PySPAMMODULEH\n#ifdef cplusplus\nextern \"C\" {\n#endif\n\n/* Header file for spammodule */\n\n/* C API functions */\n#define PySpamSystemNUM 0\n#define PySpamSystemRETURN int\n#define PySpamSystemPROTO (const char *command)\n\n/* Total number of C API pointers */\n#define PySpamAPIpointers 1\n\n\n#ifdef SPAMMODULE\n/* This section is used when compiling spammodule.c */\n\nstatic PySpamSystemRETURN PySpamSystem PySpamSystemPROTO;\n\n#else\n/* This section is used in modules that use spammodule's API */\n\nstatic void PySpamAPI;\n\n#define PySpamSystem \\\n(*(PySpamSystemRETURN (*)PySpamSystemPROTO) PySpamAPI[PySpamSystemNUM])\n\n/* Return -1 on error, 0 on success.\n* PyCapsuleImport will set an exception if there's an error.\n*/\nstatic int\nimportspam(void)\n{\nPySpamAPI = (void )PyCapsuleImport(\"spam.CAPI\", 0);\nreturn (PySpamAPI != NULL) ? 0 : -1;\n}\n\n#endif\n\n#ifdef cplusplus\n}\n#endif\n\n#endif /* !defined(PySPAMMODULEH) */\n",
            "subsections": []
        },
        "All that a client module must do in order to have access to the function": {
            "content": "'PySpamSystem()' is to call the function (or rather macro)\n'importspam()' in its initialization function:\n\nPyMODINITFUNC\nPyInitclient(void)\n{\nPyObject *m;\n\nm = PyModuleCreate(&clientmodule);\nif (m == NULL)\nreturn NULL;\nif (importspam() < 0)\nreturn NULL;\n/* additional initialization can happen here */\nreturn m;\n}\n",
            "subsections": []
        },
        "The main disadvantage of this approach is that the file 'spammodule.h'": {
            "content": "is rather complicated.  However, the basic structure is the same for\neach function that is exported, so it has to be learned only once.\n",
            "subsections": []
        },
        "Finally it should be mentioned that Capsules offer additional": {
            "content": "functionality, which is especially useful for memory allocation and\ndeallocation of the pointer stored in a Capsule.  The details are\ndescribed in the Python/C API Reference Manual in the section *note",
            "subsections": []
        },
        "Capsules: 46c5. and in the implementation of Capsules (files": {
            "content": "'Include/pycapsule.h' and 'Objects/pycapsule.c' in the Python source\ncode distribution).\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "Python allows the writer of a C extension module to define new types": {
            "content": "that can be manipulated from Python code, much like the built-in *note\nstr: 157. and *note list: 3dc. types.  The code for all extension types\nfollows a pattern, but there are some details that you need to\nunderstand before you can get started.  This document is a gentle\nintroduction to the topic.\n\n* Menu:\n\n* The Basics::\n* Adding data and methods to the Basic example::\n* Providing finer control over data attributes::\n* Supporting cyclic garbage collection::\n* Subclassing other types::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The Basics,  Next: Adding data and methods to the Basic example,  Up: Defining Extension Types Tutorial": {
            "content": "6.2.2.1 The Basics\n..................\n\nThe *note CPython: 4c9. runtime sees all Python objects as variables of\ntype *note PyObject: 6b1.*, which serves as a \"base type\" for all Python\nobjects.  The *note PyObject: 6b1. structure itself only contains the\nobject's *note reference count: 46ca. and a pointer to the object's\n\"type object\".  This is where the action is; the type object determines\nwhich (C) functions get called by the interpreter when, for instance, an\nattribute gets looked up on an object, a method called, or it is\nmultiplied by another object.  These C functions are called \"type\nmethods\".\n",
            "subsections": []
        },
        "So, if you want to define a new extension type, you need to create a new": {
            "content": "type object.\n",
            "subsections": []
        },
        "This sort of thing can only be explained by example, so here's a": {
            "content": "minimal, but complete, module that defines a new type named 'Custom'\ninside a C extension module 'custom':\n\nNote: What we're showing here is the traditional way of defining\n'static' extension types.  It should be adequate for most uses.\nThe C API also allows defining heap-allocated extension types using\nthe *note PyTypeFromSpec(): 2df. function, which isn't covered in\nthis tutorial.\n\n#define PYSSIZETCLEAN\n#include <Python.h>\n\ntypedef struct {\nPyObjectHEAD\n/* Type-specific fields go here. */\n} CustomObject;\n\nstatic PyTypeObject CustomType = {\n.obbase = PyVarObjectHEADINIT(NULL, 0)\n.tpname = \"custom.Custom\",\n.tpdoc = PyDocSTR(\"Custom objects\"),\n.tpbasicsize = sizeof(CustomObject),\n.tpitemsize = 0,\n.tpflags = PyTPFLAGSDEFAULT,\n.tpnew = PyTypeGenericNew,\n};\n\nstatic PyModuleDef custommodule = {\n.mbase = PyModuleDefHEADINIT,\n.mname = \"custom\",\n.mdoc = \"Example module that creates an extension type.\",\n.msize = -1,\n};\n\nPyMODINITFUNC\nPyInitcustom(void)\n{\nPyObject *m;\nif (PyTypeReady(&CustomType) < 0)\nreturn NULL;\n\nm = PyModuleCreate(&custommodule);\nif (m == NULL)\nreturn NULL;\n\nPyINCREF(&CustomType);\nif (PyModuleAddObject(m, \"Custom\", (PyObject *) &CustomType) < 0) {\nPyDECREF(&CustomType);\nPyDECREF(m);\nreturn NULL;\n}\n\nreturn m;\n}\n",
            "subsections": []
        },
        "Now that's quite a bit to take in at once, but hopefully bits will seem": {
            "content": "familiar from the previous chapter.  This file defines three things:\n\n1. What a 'Custom' 'object' contains: this is the 'CustomObject'\nstruct, which is allocated once for each 'Custom' instance.\n\n2. How the 'Custom' 'type' behaves: this is the 'CustomType' struct,\nwhich defines a set of flags and function pointers that the\ninterpreter inspects when specific operations are requested.\n\n3. How to initialize the 'custom' module: this is the 'PyInitcustom'\nfunction and the associated 'custommodule' struct.\n\nThe first bit is:\n\ntypedef struct {\nPyObjectHEAD\n} CustomObject;\n",
            "subsections": []
        },
        "This is what a Custom object will contain.  'PyObjectHEAD' is mandatory": {
            "content": "at the start of each object struct and defines a field called 'obbase'\nof type *note PyObject: 6b1, containing a pointer to a type object and a\nreference count (these can be accessed using the macros *note PyTYPE:\n56b. and *note PyREFCNT: 6bd. respectively).  The reason for the macro\nis to abstract away the layout and to enable additional fields in *note\ndebug builds: 67f.\n\nNote: There is no semicolon above after the *note PyObjectHEAD:\n1153. macro.  Be wary of adding one by accident: some compilers\nwill complain.\n",
            "subsections": []
        },
        "Of course, objects generally store additional data besides the standard": {
            "content": "'PyObjectHEAD' boilerplate; for example, here is the definition for\nstandard Python floats:\n\ntypedef struct {\nPyObjectHEAD\ndouble obfval;\n} PyFloatObject;\n\nThe second bit is the definition of the type object.\n\nstatic PyTypeObject CustomType = {\n.obbase = PyVarObjectHEADINIT(NULL, 0)\n.tpname = \"custom.Custom\",\n.tpdoc = PyDocSTR(\"Custom objects\"),\n.tpbasicsize = sizeof(CustomObject),\n.tpitemsize = 0,\n.tpflags = PyTPFLAGSDEFAULT,\n.tpnew = PyTypeGenericNew,\n};\n\nNote: We recommend using C99-style designated initializers as\nabove, to avoid listing all the *note PyTypeObject: 8da. fields\nthat you don't care about and also to avoid caring about the\nfields' declaration order.\n\nThe actual definition of *note PyTypeObject: 8da. in 'object.h' has many\nmore *note fields: 7b1. than the definition above.  The remaining fields\nwill be filled with zeros by the C compiler, and it's common practice to\nnot specify them explicitly unless you need them.\n\nWe're going to pick it apart, one field at a time:\n\n.obbase = PyVarObjectHEADINIT(NULL, 0)\n",
            "subsections": []
        },
        "This line is mandatory boilerplate to initialize the 'obbase' field": {
            "content": "mentioned above.\n\n.tpname = \"custom.Custom\",\n",
            "subsections": []
        },
        "The name of our type.  This will appear in the default textual": {
            "content": "representation of our objects and in some error messages, for example:\n\n>>> \"\" + custom.Custom()\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nTypeError: can only concatenate str (not \"custom.Custom\") to str\n",
            "subsections": []
        },
        "Note that the name is a dotted name that includes both the module name": {
            "content": "and the name of the type within the module.  The module in this case is\n'custom' and the type is 'Custom', so we set the type name to\n'custom.Custom'.  Using the real dotted import path is important to make\nyour type compatible with the *note pydoc: b0. and *note pickle: a1.\nmodules.\n\n.tpbasicsize = sizeof(CustomObject),\n.tpitemsize = 0,\n",
            "subsections": []
        },
        "This is so that Python knows how much memory to allocate when creating": {
            "content": "new 'Custom' instances.  *note tpitemsize: 1c77. is only used for\nvariable-sized objects and should otherwise be zero.\n\nNote: If you want your type to be subclassable from Python, and\nyour type has the same *note tpbasicsize: 7ab. as its base type,\nyou may have problems with multiple inheritance.  A Python subclass\nof your type will have to list your type first in its *note\nbases: 1303, or else it will not be able to call your type's\n*note new(): 2e2. method without getting an error.  You can\navoid this problem by ensuring that your type has a larger value\nfor *note tpbasicsize: 7ab. than its base type does.  Most of the\ntime, this will be true anyway, because either your base type will\nbe *note object: 8bb, or else you will be adding data members to\nyour base type, and therefore increasing its size.\n\nWe set the class flags to *note PyTPFLAGSDEFAULT: 46cb.\n\n.tpflags = PyTPFLAGSDEFAULT,\n",
            "subsections": []
        },
        "All types should include this constant in their flags.  It enables all": {
            "content": "of the members defined until at least Python 3.3.  If you need further\nmembers, you will need to OR the corresponding flags.\n\nWe provide a doc string for the type in *note tpdoc: 46cc.\n\n.tpdoc = PyDocSTR(\"Custom objects\"),\n\nTo enable object creation, we have to provide a *note tpnew: 2e1.\nhandler.  This is the equivalent of the Python method *note new():\n2e2, but has to be specified explicitly.  In this case, we can just use\nthe default implementation provided by the API function *note\nPyTypeGenericNew(): 46cd.\n\n.tpnew = PyTypeGenericNew,\n",
            "subsections": []
        },
        "Everything else in the file should be familiar, except for some code in": {
            "content": "'PyInitcustom()':\n\nif (PyTypeReady(&CustomType) < 0)\nreturn;\n",
            "subsections": []
        },
        "This initializes the 'Custom' type, filling in a number of members to": {
            "content": "the appropriate default values, including *note obtype: 46ce. that we\ninitially set to 'NULL'.\n\nPyINCREF(&CustomType);\nif (PyModuleAddObject(m, \"Custom\", (PyObject *) &CustomType) < 0) {\nPyDECREF(&CustomType);\nPyDECREF(m);\nreturn NULL;\n}\n",
            "subsections": []
        },
        "This adds the type to the module dictionary.  This allows us to create": {
            "content": "'Custom' instances by calling the 'Custom' class:\n\n>>> import custom\n>>> mycustom = custom.Custom()\n\nThat's it!  All that remains is to build it; put the above code in a\nfile called 'custom.c',\n\n[build-system]\nrequires = [\"setuptools\"]\nbuild-backend = \"setuptools.buildmeta\"\n\n[project]\nname = \"custom\"\nversion = \"1\"\n\nin a file called 'pyproject.toml', and\n\nfrom setuptools import Extension, setup\nsetup(extmodules=[Extension(\"custom\", [\"custom.c\"])])\n\nin a file called 'setup.py'; then typing\n\n$ python -m pip install .\n\nin a shell should produce a file 'custom.so' in a subdirectory and\ninstall it; now fire up Python -- you should be able to 'import custom'\nand play around with 'Custom' objects.\n\nThat wasn't so hard, was it?\n",
            "subsections": []
        },
        "Of course, the current Custom type is pretty uninteresting.  It has no": {
            "content": "data and doesn't do anything.  It can't even be subclassed.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "6.2.2.2 Adding data and methods to the Basic example\n....................................................\n",
            "subsections": []
        },
        "Let's extend the basic example to add some data and methods.  Let's also": {
            "content": "make the type usable as a base class.  We'll create a new module,\n'custom2' that adds these capabilities:\n\n#define PYSSIZETCLEAN\n#include <Python.h>\n#include <stddef.h> /* for offsetof() */\n\ntypedef struct {\nPyObjectHEAD\nPyObject *first; /* first name */\nPyObject *last;  /* last name */\nint number;\n} CustomObject;\n\nstatic void\nCustomdealloc(CustomObject *self)\n{\nPyXDECREF(self->first);\nPyXDECREF(self->last);\nPyTYPE(self)->tpfree((PyObject *) self);\n}\n\nstatic PyObject *\nCustomnew(PyTypeObject *type, PyObject *args, PyObject *kwds)\n{\nCustomObject *self;\nself = (CustomObject *) type->tpalloc(type, 0);\nif (self != NULL) {\nself->first = PyUnicodeFromString(\"\");\nif (self->first == NULL) {\nPyDECREF(self);\nreturn NULL;\n}\nself->last = PyUnicodeFromString(\"\");\nif (self->last == NULL) {\nPyDECREF(self);\nreturn NULL;\n}\nself->number = 0;\n}\nreturn (PyObject *) self;\n}\n\nstatic int\nCustominit(CustomObject *self, PyObject *args, PyObject *kwds)\n{\nstatic char *kwlist[] = {\"first\", \"last\", \"number\", NULL};\nPyObject *first = NULL, *last = NULL;\n\nif (!PyArgParseTupleAndKeywords(args, kwds, \"|OOi\", kwlist,\n&first, &last,\n&self->number))\nreturn -1;\n\nif (first) {\nPyXSETREF(self->first, PyNewRef(first));\n}\nif (last) {\nPyXSETREF(self->last, PyNewRef(last));\n}\nreturn 0;\n}\n\nstatic PyMemberDef Custommembers[] = {\n{\"first\", PyTOBJECTEX, offsetof(CustomObject, first), 0,\n\"first name\"},\n{\"last\", PyTOBJECTEX, offsetof(CustomObject, last), 0,\n\"last name\"},\n{\"number\", PyTINT, offsetof(CustomObject, number), 0,\n\"custom number\"},\n{NULL}  /* Sentinel */\n};\n\nstatic PyObject *\nCustomname(CustomObject *self, PyObject *PyUNUSED(ignored))\n{\nif (self->first == NULL) {\nPyErrSetString(PyExcAttributeError, \"first\");\nreturn NULL;\n}\nif (self->last == NULL) {\nPyErrSetString(PyExcAttributeError, \"last\");\nreturn NULL;\n}\nreturn PyUnicodeFromFormat(\"%S %S\", self->first, self->last);\n}\n\nstatic PyMethodDef Custommethods[] = {\n{\"name\", (PyCFunction) Customname, METHNOARGS,\n\"Return the name, combining the first and last name\"\n},\n{NULL}  /* Sentinel */\n};\n\nstatic PyTypeObject CustomType = {\n.obbase = PyVarObjectHEADINIT(NULL, 0)\n.tpname = \"custom2.Custom\",\n.tpdoc = PyDocSTR(\"Custom objects\"),\n.tpbasicsize = sizeof(CustomObject),\n.tpitemsize = 0,\n.tpflags = PyTPFLAGSDEFAULT | PyTPFLAGSBASETYPE,\n.tpnew = Customnew,\n.tpinit = (initproc) Custominit,\n.tpdealloc = (destructor) Customdealloc,\n.tpmembers = Custommembers,\n.tpmethods = Custommethods,\n};\n\nstatic PyModuleDef custommodule = {\n.mbase =PyModuleDefHEADINIT,\n.mname = \"custom2\",\n.mdoc = \"Example module that creates an extension type.\",\n.msize = -1,\n};\n\nPyMODINITFUNC\nPyInitcustom2(void)\n{\nPyObject *m;\nif (PyTypeReady(&CustomType) < 0)\nreturn NULL;\n\nm = PyModuleCreate(&custommodule);\nif (m == NULL)\nreturn NULL;\n\nif (PyModuleAddObjectRef(m, \"Custom\", (PyObject *) &CustomType) < 0) {\nPyDECREF(m);\nreturn NULL;\n}\n\nreturn m;\n}\n\nThis version of the module has a number of changes.\n",
            "subsections": []
        },
        "The 'Custom' type now has three data attributes in its C struct,": {
            "content": "'first', 'last', and 'number'.  The 'first' and 'last' variables are",
            "subsections": []
        },
        "Python strings containing first and last names.  The 'number' attribute": {
            "content": "is a C integer.\n\nThe object structure is updated accordingly:\n\ntypedef struct {\nPyObjectHEAD\nPyObject *first; /* first name */\nPyObject *last;  /* last name */\nint number;\n} CustomObject;\n",
            "subsections": []
        },
        "Because we now have data to manage, we have to be more careful about": {
            "content": "object allocation and deallocation.  At a minimum, we need a\ndeallocation method:\n\nstatic void\nCustomdealloc(CustomObject *self)\n{\nPyXDECREF(self->first);\nPyXDECREF(self->last);\nPyTYPE(self)->tpfree((PyObject *) self);\n}\n\nwhich is assigned to the *note tpdealloc: 46d0. member:\n\n.tpdealloc = (destructor) Customdealloc,\n",
            "subsections": []
        },
        "This method first clears the reference counts of the two Python": {
            "content": "attributes.  *note PyXDECREF(): 57d. correctly handles the case where\nits argument is 'NULL' (which might happen here if 'tpnew' failed\nmidway).  It then calls the *note tpfree: 46d1. member of the object's\ntype (computed by 'PyTYPE(self)') to free the object's memory.  Note\nthat the object's type might not be 'CustomType', because the object may\nbe an instance of a subclass.\n\nNote: The explicit cast to 'destructor' above is needed because we\ndefined 'Customdealloc' to take a 'CustomObject *' argument, but\nthe 'tpdealloc' function pointer expects to receive a 'PyObject *'\nargument.  Otherwise, the compiler will emit a warning.  This is\nobject-oriented polymorphism, in C!\n",
            "subsections": []
        },
        "We want to make sure that the first and last names are initialized to": {
            "content": "empty strings, so we provide a 'tpnew' implementation:\n\nstatic PyObject *\nCustomnew(PyTypeObject *type, PyObject *args, PyObject *kwds)\n{\nCustomObject *self;\nself = (CustomObject *) type->tpalloc(type, 0);\nif (self != NULL) {\nself->first = PyUnicodeFromString(\"\");\nif (self->first == NULL) {\nPyDECREF(self);\nreturn NULL;\n}\nself->last = PyUnicodeFromString(\"\");\nif (self->last == NULL) {\nPyDECREF(self);\nreturn NULL;\n}\nself->number = 0;\n}\nreturn (PyObject *) self;\n}\n\nand install it in the *note tpnew: 2e1. member:\n\n.tpnew = Customnew,\n",
            "subsections": []
        },
        "The 'tpnew' handler is responsible for creating (as opposed to": {
            "content": "initializing) objects of the type.  It is exposed in Python as the *note\nnew(): 2e2. method.  It is not required to define a 'tpnew' member,\nand indeed many extension types will simply reuse *note",
            "subsections": []
        },
        "PyTypeGenericNew(): 46cd. as done in the first version of the 'Custom'": {
            "content": "type above.  In this case, we use the 'tpnew' handler to initialize the\n'first' and 'last' attributes to non-'NULL' default values.\n\n'tpnew' is passed the type being instantiated (not necessarily\n'CustomType', if a subclass is instantiated) and any arguments passed\nwhen the type was called, and is expected to return the instance\ncreated.  'tpnew' handlers always accept positional and keyword\narguments, but they often ignore the arguments, leaving the argument\nhandling to initializer (a.k.a.  'tpinit' in C or 'init' in Python)\nmethods.\n\nNote: 'tpnew' shouldn't call 'tpinit' explicitly, as the\ninterpreter will do it itself.\n\nThe 'tpnew' implementation calls the *note tpalloc: 46d2. slot to\nallocate memory:\n\nself = (CustomObject *) type->tpalloc(type, 0);\n\nSince memory allocation may fail, we must check the *note tpalloc:\n46d2. result against 'NULL' before proceeding.\n\nNote: We didn't fill the *note tpalloc: 46d2. slot ourselves.\nRather *note PyTypeReady(): 567. fills it for us by inheriting it\nfrom our base class, which is *note object: 8bb. by default.  Most\ntypes use the default allocation strategy.\n\nNote: If you are creating a co-operative *note tpnew: 2e1. (one\nthat calls a base type's *note tpnew: 2e1. or *note new():\n2e2.), you must 'not' try to determine what method to call using\nmethod resolution order at runtime.  Always statically determine\nwhat type you are going to call, and call its *note tpnew: 2e1.\ndirectly, or via 'type->tpbase->tpnew'.  If you do not do this,\nPython subclasses of your type that also inherit from other\nPython-defined classes may not work correctly.  (Specifically, you\nmay not be able to create instances of such subclasses without\ngetting a *note TypeError: 28e.)\n",
            "subsections": []
        },
        "We also define an initialization function which accepts arguments to": {
            "content": "provide initial values for our instance:\n\nstatic int\nCustominit(CustomObject *self, PyObject *args, PyObject *kwds)\n{\nstatic char *kwlist[] = {\"first\", \"last\", \"number\", NULL};\nPyObject *first = NULL, *last = NULL, *tmp;\n\nif (!PyArgParseTupleAndKeywords(args, kwds, \"|OOi\", kwlist,\n&first, &last,\n&self->number))\nreturn -1;\n\nif (first) {\ntmp = self->first;\nPyINCREF(first);\nself->first = first;\nPyXDECREF(tmp);\n}\nif (last) {\ntmp = self->last;\nPyINCREF(last);\nself->last = last;\nPyXDECREF(tmp);\n}\nreturn 0;\n}\n\nby filling the *note tpinit: 2e3. slot.\n\n.tpinit = (initproc) Custominit,\n\nThe *note tpinit: 2e3. slot is exposed in Python as the *note\ninit(): 47d. method.  It is used to initialize an object after it's\ncreated.  Initializers always accept positional and keyword arguments,\nand they should return either '0' on success or '-1' on error.\n",
            "subsections": []
        },
        "Unlike the 'tpnew' handler, there is no guarantee that 'tpinit' is": {
            "content": "called at all (for example, the *note pickle: a1. module by default\ndoesn't call *note init(): 47d. on unpickled instances).  It can\nalso be called multiple times.  Anyone can call the 'init()' method\non our objects.  For this reason, we have to be extra careful when\nassigning the new attribute values.  We might be tempted, for example to\nassign the 'first' member like this:\n\nif (first) {\nPyXDECREF(self->first);\nPyINCREF(first);\nself->first = first;\n}\n",
            "subsections": []
        },
        "But this would be risky.  Our type doesn't restrict the type of the": {
            "content": "'first' member, so it could be any kind of object.  It could have a\ndestructor that causes code to be executed that tries to access the\n'first' member; or that destructor could release the *note Global\ninterpreter Lock: 6c0. and let arbitrary code run in other threads that\naccesses and modifies our object.\n",
            "subsections": []
        },
        "To be paranoid and protect ourselves against this possibility, we almost": {
            "content": "always reassign members before decrementing their reference counts.\nWhen don't we have to do this?\n\n* when we absolutely know that the reference count is greater than 1;\n\n* when we know that deallocation of the object (1) will neither\nrelease the *note GIL: 6c0. nor cause any calls back into our\ntype's code;\n\n* when decrementing a reference count in a *note tpdealloc: 46d0.\nhandler on a type which doesn't support cyclic garbage collection\n(2).\n",
            "subsections": []
        },
        "We want to expose our instance variables as attributes.  There are a": {
            "content": "number of ways to do that.  The simplest way is to define member\ndefinitions:\n\nstatic PyMemberDef Custommembers[] = {\n{\"first\", PyTOBJECTEX, offsetof(CustomObject, first), 0,\n\"first name\"},\n{\"last\", PyTOBJECTEX, offsetof(CustomObject, last), 0,\n\"last name\"},\n{\"number\", PyTINT, offsetof(CustomObject, number), 0,\n\"custom number\"},\n{NULL}  /* Sentinel */\n};\n\nand put the definitions in the *note tpmembers: 46d3. slot:\n\n.tpmembers = Custommembers,\n",
            "subsections": []
        },
        "Each member definition has a member name, type, offset, access flags and": {
            "content": "documentation string.  See the *note Generic Attribute Management: 46d4.\nsection below for details.\n\nA disadvantage of this approach is that it doesn't provide a way to\nrestrict the types of objects that can be assigned to the Python\nattributes.  We expect the first and last names to be strings, but any",
            "subsections": []
        },
        "Python objects can be assigned.  Further, the attributes can be deleted,": {
            "content": "setting the C pointers to 'NULL'.  Even though we can make sure the\nmembers are initialized to non-'NULL' values, the members can be set to\n'NULL' if the attributes are deleted.\n",
            "subsections": []
        },
        "We define a single method, 'Custom.name()', that outputs the objects": {
            "content": "name as the concatenation of the first and last names.\n\nstatic PyObject *\nCustomname(CustomObject *self, PyObject *PyUNUSED(ignored))\n{\nif (self->first == NULL) {\nPyErrSetString(PyExcAttributeError, \"first\");\nreturn NULL;\n}\nif (self->last == NULL) {\nPyErrSetString(PyExcAttributeError, \"last\");\nreturn NULL;\n}\nreturn PyUnicodeFromFormat(\"%S %S\", self->first, self->last);\n}\n",
            "subsections": []
        },
        "The method is implemented as a C function that takes a 'Custom' (or": {
            "content": "'Custom' subclass) instance as the first argument.  Methods always take\nan instance as the first argument.  Methods often take positional and\nkeyword arguments as well, but in this case we don't take any and don't\nneed to accept a positional argument tuple or keyword argument\ndictionary.  This method is equivalent to the Python method:\n\ndef name(self):\nreturn \"%s %s\" % (self.first, self.last)\n",
            "subsections": []
        },
        "Note that we have to check for the possibility that our 'first' and": {
            "content": "'last' members are 'NULL'.  This is because they can be deleted, in\nwhich case they are set to 'NULL'.  It would be better to prevent\ndeletion of these attributes and to restrict the attribute values to be\nstrings.  We'll see how to do that in the next section.\n",
            "subsections": []
        },
        "Now that we've defined the method, we need to create an array of method": {
            "content": "definitions:\n\nstatic PyMethodDef Custommethods[] = {\n{\"name\", (PyCFunction) Customname, METHNOARGS,\n\"Return the name, combining the first and last name\"\n},\n{NULL}  /* Sentinel */\n};\n\n(note that we used the *note METHNOARGS: 132f. flag to indicate that\nthe method is expecting no arguments other than 'self')\n\nand assign it to the *note tpmethods: 46d5. slot:\n\n.tpmethods = Custommethods,\n\nFinally, we'll make our type usable as a base class for subclassing.",
            "subsections": []
        },
        "We've written our methods carefully so far so that they don't make any": {
            "content": "assumptions about the type of the object being created or used, so all\nwe need to do is to add the *note PyTPFLAGSBASETYPE: 46d6. to our\nclass flag definition:\n\n.tpflags = PyTPFLAGSDEFAULT | PyTPFLAGSBASETYPE,\n",
            "subsections": []
        },
        "We rename 'PyInitcustom()' to 'PyInitcustom2()', update the module": {
            "content": "name in the *note PyModuleDef: 7a1. struct, and update the full class\nname in the *note PyTypeObject: 8da. struct.\n",
            "subsections": []
        },
        "Finally, we update our 'setup.py' file to include the new module,": {
            "content": "from setuptools import Extension, setup\nsetup(extmodules=[\nExtension(\"custom\", [\"custom.c\"]),\nExtension(\"custom2\", [\"custom2.c\"]),\n])\n\nand then we re-install so that we can 'import custom2':\n\n$ python -m pip install .\n\n---------- Footnotes ----------\n\n(1) This is true when we know that the object is a basic type, like a\nstring or a float.\n\n(2) We relied on this in the *note tpdealloc: 46d0. handler in this\nexample, because our type doesn't support garbage collection.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "6.2.2.3 Providing finer control over data attributes\n....................................................\n",
            "subsections": []
        },
        "In this section, we'll provide finer control over how the 'first' and": {
            "content": "'last' attributes are set in the 'Custom' example.  In the previous\nversion of our module, the instance variables 'first' and 'last' could\nbe set to non-string values or even deleted.  We want to make sure that\nthese attributes always contain strings.\n\n#define PYSSIZETCLEAN\n#include <Python.h>\n#include <stddef.h> /* for offsetof() */\n\ntypedef struct {\nPyObjectHEAD\nPyObject *first; /* first name */\nPyObject *last;  /* last name */\nint number;\n} CustomObject;\n\nstatic void\nCustomdealloc(CustomObject *self)\n{\nPyXDECREF(self->first);\nPyXDECREF(self->last);\nPyTYPE(self)->tpfree((PyObject *) self);\n}\n\nstatic PyObject *\nCustomnew(PyTypeObject *type, PyObject *args, PyObject *kwds)\n{\nCustomObject *self;\nself = (CustomObject *) type->tpalloc(type, 0);\nif (self != NULL) {\nself->first = PyUnicodeFromString(\"\");\nif (self->first == NULL) {\nPyDECREF(self);\nreturn NULL;\n}\nself->last = PyUnicodeFromString(\"\");\nif (self->last == NULL) {\nPyDECREF(self);\nreturn NULL;\n}\nself->number = 0;\n}\nreturn (PyObject *) self;\n}\n\nstatic int\nCustominit(CustomObject *self, PyObject *args, PyObject *kwds)\n{\nstatic char *kwlist[] = {\"first\", \"last\", \"number\", NULL};\nPyObject *first = NULL, *last = NULL;\n\nif (!PyArgParseTupleAndKeywords(args, kwds, \"|UUi\", kwlist,\n&first, &last,\n&self->number))\nreturn -1;\n\nif (first) {\nPySETREF(self->first, PyNewRef(first));\n}\nif (last) {\nPySETREF(self->last, PyNewRef(last));\n}\nreturn 0;\n}\n\nstatic PyMemberDef Custommembers[] = {\n{\"number\", PyTINT, offsetof(CustomObject, number), 0,\n\"custom number\"},\n{NULL}  /* Sentinel */\n};\n\nstatic PyObject *\nCustomgetfirst(CustomObject *self, void *closure)\n{\nreturn PyNewRef(self->first);\n}\n\nstatic int\nCustomsetfirst(CustomObject *self, PyObject *value, void *closure)\n{\nif (value == NULL) {\nPyErrSetString(PyExcTypeError, \"Cannot delete the first attribute\");\nreturn -1;\n}\nif (!PyUnicodeCheck(value)) {\nPyErrSetString(PyExcTypeError,\n\"The first attribute value must be a string\");\nreturn -1;\n}\nPySETREF(self->first, PyNewRef(value));\nreturn 0;\n}\n\nstatic PyObject *\nCustomgetlast(CustomObject *self, void *closure)\n{\nreturn PyNewRef(self->last);\n}\n\nstatic int\nCustomsetlast(CustomObject *self, PyObject *value, void *closure)\n{\nif (value == NULL) {\nPyErrSetString(PyExcTypeError, \"Cannot delete the last attribute\");\nreturn -1;\n}\nif (!PyUnicodeCheck(value)) {\nPyErrSetString(PyExcTypeError,\n\"The last attribute value must be a string\");\nreturn -1;\n}\nPySETREF(self->last, PyNewRef(value));\nreturn 0;\n}\n\nstatic PyGetSetDef Customgetsetters[] = {\n{\"first\", (getter) Customgetfirst, (setter) Customsetfirst,\n\"first name\", NULL},\n{\"last\", (getter) Customgetlast, (setter) Customsetlast,\n\"last name\", NULL},\n{NULL}  /* Sentinel */\n};\n\nstatic PyObject *\nCustomname(CustomObject *self, PyObject *PyUNUSED(ignored))\n{\nreturn PyUnicodeFromFormat(\"%S %S\", self->first, self->last);\n}\n\nstatic PyMethodDef Custommethods[] = {\n{\"name\", (PyCFunction) Customname, METHNOARGS,\n\"Return the name, combining the first and last name\"\n},\n{NULL}  /* Sentinel */\n};\n\nstatic PyTypeObject CustomType = {\n.obbase = PyVarObjectHEADINIT(NULL, 0)\n.tpname = \"custom3.Custom\",\n.tpdoc = PyDocSTR(\"Custom objects\"),\n.tpbasicsize = sizeof(CustomObject),\n.tpitemsize = 0,\n.tpflags = PyTPFLAGSDEFAULT | PyTPFLAGSBASETYPE,\n.tpnew = Customnew,\n.tpinit = (initproc) Custominit,\n.tpdealloc = (destructor) Customdealloc,\n.tpmembers = Custommembers,\n.tpmethods = Custommethods,\n.tpgetset = Customgetsetters,\n};\n\nstatic PyModuleDef custommodule = {\n.mbase = PyModuleDefHEADINIT,\n.mname = \"custom3\",\n.mdoc = \"Example module that creates an extension type.\",\n.msize = -1,\n};\n\nPyMODINITFUNC\nPyInitcustom3(void)\n{\nPyObject *m;\nif (PyTypeReady(&CustomType) < 0)\nreturn NULL;\n\nm = PyModuleCreate(&custommodule);\nif (m == NULL)\nreturn NULL;\n\nif (PyModuleAddObjectRef(m, \"Custom\", (PyObject *) &CustomType) < 0) {\nPyDECREF(m);\nreturn NULL;\n}\n\nreturn m;\n}\n",
            "subsections": []
        },
        "To provide greater control, over the 'first' and 'last' attributes,": {
            "content": "we'll use custom getter and setter functions.  Here are the functions\nfor getting and setting the 'first' attribute:\n\nstatic PyObject *\nCustomgetfirst(CustomObject *self, void *closure)\n{\nPyINCREF(self->first);\nreturn self->first;\n}\n\nstatic int\nCustomsetfirst(CustomObject *self, PyObject *value, void *closure)\n{\nPyObject *tmp;\nif (value == NULL) {\nPyErrSetString(PyExcTypeError, \"Cannot delete the first attribute\");\nreturn -1;\n}\nif (!PyUnicodeCheck(value)) {\nPyErrSetString(PyExcTypeError,\n\"The first attribute value must be a string\");\nreturn -1;\n}\ntmp = self->first;\nPyINCREF(value);\nself->first = value;\nPyDECREF(tmp);\nreturn 0;\n}\n\nThe getter function is passed a 'Custom' object and a \"closure\", which\nis a void pointer.  In this case, the closure is ignored.  (The closure\nsupports an advanced usage in which definition data is passed to the\ngetter and setter.  This could, for example, be used to allow a single\nset of getter and setter functions that decide the attribute to get or\nset based on data in the closure.)\n",
            "subsections": []
        },
        "The setter function is passed the 'Custom' object, the new value, and": {
            "content": "the closure.  The new value may be 'NULL', in which case the attribute\nis being deleted.  In our setter, we raise an error if the attribute is\ndeleted or if its new value is not a string.\n\nWe create an array of *note PyGetSetDef: 9fc. structures:\n\nstatic PyGetSetDef Customgetsetters[] = {\n{\"first\", (getter) Customgetfirst, (setter) Customsetfirst,\n\"first name\", NULL},\n{\"last\", (getter) Customgetlast, (setter) Customsetlast,\n\"last name\", NULL},\n{NULL}  /* Sentinel */\n};\n\nand register it in the *note tpgetset: 46d8. slot:\n\n.tpgetset = Customgetsetters,\n\nThe last item in a *note PyGetSetDef: 9fc. structure is the \"closure\"\nmentioned above.  In this case, we aren't using a closure, so we just\npass 'NULL'.\n\nWe also remove the member definitions for these attributes:\n\nstatic PyMemberDef Custommembers[] = {\n{\"number\", PyTINT, offsetof(CustomObject, number), 0,\n\"custom number\"},\n{NULL}  /* Sentinel */\n};\n\nWe also need to update the *note tpinit: 2e3. handler to only allow\nstrings (1) to be passed:\n\nstatic int\nCustominit(CustomObject *self, PyObject *args, PyObject *kwds)\n{\nstatic char *kwlist[] = {\"first\", \"last\", \"number\", NULL};\nPyObject *first = NULL, *last = NULL, *tmp;\n\nif (!PyArgParseTupleAndKeywords(args, kwds, \"|UUi\", kwlist,\n&first, &last,\n&self->number))\nreturn -1;\n\nif (first) {\ntmp = self->first;\nPyINCREF(first);\nself->first = first;\nPyDECREF(tmp);\n}\nif (last) {\ntmp = self->last;\nPyINCREF(last);\nself->last = last;\nPyDECREF(tmp);\n}\nreturn 0;\n}\n",
            "subsections": []
        },
        "With these changes, we can assure that the 'first' and 'last' members": {
            "content": "are never 'NULL' so we can remove checks for 'NULL' values in almost all\ncases.  This means that most of the *note PyXDECREF(): 57d. calls can\nbe converted to *note PyDECREF(): 2cf. calls.  The only place we can't\nchange these calls is in the 'tpdealloc' implementation, where there is\nthe possibility that the initialization of these members failed in\n'tpnew'.\n",
            "subsections": []
        },
        "We also rename the module initialization function and module name in the": {
            "content": "initialization function, as we did before, and we add an extra\ndefinition to the 'setup.py' file.\n\n---------- Footnotes ----------\n\n(1) We now know that the first and last members are strings, so\nperhaps we could be less careful about decrementing their reference\ncounts, however, we accept instances of string subclasses.  Even though\ndeallocating normal strings won't call back into our objects, we can't\nguarantee that deallocating an instance of a string subclass won't call\nback into our objects.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Supporting cyclic garbage collection,  Next: Subclassing other types,  Prev: Providing finer control over data attributes,  Up: Defining Extension Types Tutorial": {
            "content": "6.2.2.4 Supporting cyclic garbage collection\n............................................\n\nPython has a *note cyclic garbage collector (GC): 167e. that can\nidentify unneeded objects even when their reference counts are not zero.",
            "subsections": []
        },
        "This can happen when objects are involved in cycles.  For example,": {
            "content": "consider:\n\n>>> l = []\n>>> l.append(l)\n>>> del l\n",
            "subsections": []
        },
        "In this example, we create a list that contains itself.  When we delete": {
            "content": "it, it still has a reference from itself.  Its reference count doesn't\ndrop to zero.  Fortunately, Python's cyclic garbage collector will\neventually figure out that the list is garbage and free it.\n",
            "subsections": []
        },
        "In the second version of the 'Custom' example, we allowed any kind of": {
            "content": "object to be stored in the 'first' or 'last' attributes (1).  Besides,\nin the second and third versions, we allowed subclassing 'Custom', and\nsubclasses may add arbitrary attributes.  For any of those two reasons,\n'Custom' objects can participate in cycles:\n\n>>> import custom3\n>>> class Derived(custom3.Custom): pass\n...\n>>> n = Derived()\n>>> n.someattribute = n\n",
            "subsections": []
        },
        "To allow a 'Custom' instance participating in a reference cycle to be": {
            "content": "properly detected and collected by the cyclic GC, our 'Custom' type\nneeds to fill two additional slots and to enable a flag that enables\nthese slots:\n\n#define PYSSIZETCLEAN\n#include <Python.h>\n#include <stddef.h> /* for offsetof() */\n\ntypedef struct {\nPyObjectHEAD\nPyObject *first; /* first name */\nPyObject *last;  /* last name */\nint number;\n} CustomObject;\n\nstatic int\nCustomtraverse(CustomObject *self, visitproc visit, void *arg)\n{\nPyVISIT(self->first);\nPyVISIT(self->last);\nreturn 0;\n}\n\nstatic int\nCustomclear(CustomObject *self)\n{\nPyCLEAR(self->first);\nPyCLEAR(self->last);\nreturn 0;\n}\n\nstatic void\nCustomdealloc(CustomObject *self)\n{\nPyObjectGCUnTrack(self);\nCustomclear(self);\nPyTYPE(self)->tpfree((PyObject *) self);\n}\n\nstatic PyObject *\nCustomnew(PyTypeObject *type, PyObject *args, PyObject *kwds)\n{\nCustomObject *self;\nself = (CustomObject *) type->tpalloc(type, 0);\nif (self != NULL) {\nself->first = PyUnicodeFromString(\"\");\nif (self->first == NULL) {\nPyDECREF(self);\nreturn NULL;\n}\nself->last = PyUnicodeFromString(\"\");\nif (self->last == NULL) {\nPyDECREF(self);\nreturn NULL;\n}\nself->number = 0;\n}\nreturn (PyObject *) self;\n}\n\nstatic int\nCustominit(CustomObject *self, PyObject *args, PyObject *kwds)\n{\nstatic char *kwlist[] = {\"first\", \"last\", \"number\", NULL};\nPyObject *first = NULL, *last = NULL;\n\nif (!PyArgParseTupleAndKeywords(args, kwds, \"|UUi\", kwlist,\n&first, &last,\n&self->number))\nreturn -1;\n\nif (first) {\nPySETREF(self->first, PyNewRef(first));\n}\nif (last) {\nPySETREF(self->last, PyNewRef(last));\n}\nreturn 0;\n}\n\nstatic PyMemberDef Custommembers[] = {\n{\"number\", PyTINT, offsetof(CustomObject, number), 0,\n\"custom number\"},\n{NULL}  /* Sentinel */\n};\n\nstatic PyObject *\nCustomgetfirst(CustomObject *self, void *closure)\n{\nreturn PyNewRef(self->first);\n}\n\nstatic int\nCustomsetfirst(CustomObject *self, PyObject *value, void *closure)\n{\nif (value == NULL) {\nPyErrSetString(PyExcTypeError, \"Cannot delete the first attribute\");\nreturn -1;\n}\nif (!PyUnicodeCheck(value)) {\nPyErrSetString(PyExcTypeError,\n\"The first attribute value must be a string\");\nreturn -1;\n}\nPyXSETREF(self->first, PyNewRef(value));\nreturn 0;\n}\n\nstatic PyObject *\nCustomgetlast(CustomObject *self, void *closure)\n{\nreturn PyNewRef(self->last);\n}\n\nstatic int\nCustomsetlast(CustomObject *self, PyObject *value, void *closure)\n{\nif (value == NULL) {\nPyErrSetString(PyExcTypeError, \"Cannot delete the last attribute\");\nreturn -1;\n}\nif (!PyUnicodeCheck(value)) {\nPyErrSetString(PyExcTypeError,\n\"The last attribute value must be a string\");\nreturn -1;\n}\nPyXSETREF(self->last, PyNewRef(value));\nreturn 0;\n}\n\nstatic PyGetSetDef Customgetsetters[] = {\n{\"first\", (getter) Customgetfirst, (setter) Customsetfirst,\n\"first name\", NULL},\n{\"last\", (getter) Customgetlast, (setter) Customsetlast,\n\"last name\", NULL},\n{NULL}  /* Sentinel */\n};\n\nstatic PyObject *\nCustomname(CustomObject *self, PyObject *PyUNUSED(ignored))\n{\nreturn PyUnicodeFromFormat(\"%S %S\", self->first, self->last);\n}\n\nstatic PyMethodDef Custommethods[] = {\n{\"name\", (PyCFunction) Customname, METHNOARGS,\n\"Return the name, combining the first and last name\"\n},\n{NULL}  /* Sentinel */\n};\n\nstatic PyTypeObject CustomType = {\n.obbase = PyVarObjectHEADINIT(NULL, 0)\n.tpname = \"custom4.Custom\",\n.tpdoc = PyDocSTR(\"Custom objects\"),\n.tpbasicsize = sizeof(CustomObject),\n.tpitemsize = 0,\n.tpflags = PyTPFLAGSDEFAULT | PyTPFLAGSBASETYPE | PyTPFLAGSHAVEGC,\n.tpnew = Customnew,\n.tpinit = (initproc) Custominit,\n.tpdealloc = (destructor) Customdealloc,\n.tptraverse = (traverseproc) Customtraverse,\n.tpclear = (inquiry) Customclear,\n.tpmembers = Custommembers,\n.tpmethods = Custommethods,\n.tpgetset = Customgetsetters,\n};\n\nstatic PyModuleDef custommodule = {\n.mbase = PyModuleDefHEADINIT,\n.mname = \"custom4\",\n.mdoc = \"Example module that creates an extension type.\",\n.msize = -1,\n};\n\nPyMODINITFUNC\nPyInitcustom4(void)\n{\nPyObject *m;\nif (PyTypeReady(&CustomType) < 0)\nreturn NULL;\n\nm = PyModuleCreate(&custommodule);\nif (m == NULL)\nreturn NULL;\n\nif (PyModuleAddObjectRef(m, \"Custom\", (PyObject *) &CustomType) < 0) {\nPyDECREF(m);\nreturn NULL;\n}\n\nreturn m;\n}\n",
            "subsections": []
        },
        "First, the traversal method lets the cyclic GC know about subobjects": {
            "content": "that could participate in cycles:\n\nstatic int\nCustomtraverse(CustomObject *self, visitproc visit, void *arg)\n{\nint vret;\nif (self->first) {\nvret = visit(self->first, arg);\nif (vret != 0)\nreturn vret;\n}\nif (self->last) {\nvret = visit(self->last, arg);\nif (vret != 0)\nreturn vret;\n}\nreturn 0;\n}\n",
            "subsections": []
        },
        "For each subobject that can participate in cycles, we need to call the": {
            "content": "'visit()' function, which is passed to the traversal method.  The\n'visit()' function takes as arguments the subobject and the extra\nargument 'arg' passed to the traversal method.  It returns an integer\nvalue that must be returned if it is non-zero.\n\nPython provides a *note PyVISIT(): 46da. macro that automates calling\nvisit functions.  With *note PyVISIT(): 46da, we can minimize the\namount of boilerplate in 'Customtraverse':\n\nstatic int\nCustomtraverse(CustomObject *self, visitproc visit, void *arg)\n{\nPyVISIT(self->first);\nPyVISIT(self->last);\nreturn 0;\n}\n\nNote: The *note tptraverse: 569. implementation must name its\narguments exactly 'visit' and 'arg' in order to use *note\nPyVISIT(): 46da.\n",
            "subsections": []
        },
        "Second, we need to provide a method for clearing any subobjects that can": {
            "content": "participate in cycles:\n\nstatic int\nCustomclear(CustomObject *self)\n{\nPyCLEAR(self->first);\nPyCLEAR(self->last);\nreturn 0;\n}\n\nNotice the use of the *note PyCLEAR(): 2da. macro.  It is the\nrecommended and safe way to clear data attributes of arbitrary types\nwhile decrementing their reference counts.  If you were to call *note",
            "subsections": []
        },
        "PyXDECREF(): 57d. instead on the attribute before setting it to 'NULL',": {
            "content": "there is a possibility that the attribute's destructor would call back\ninto code that reads the attribute again ('especially' if there is a\nreference cycle).\n\nNote: You could emulate *note PyCLEAR(): 2da. by writing:\n\nPyObject *tmp;\ntmp = self->first;\nself->first = NULL;\nPyXDECREF(tmp);\n\nNevertheless, it is much easier and less error-prone to always use\n*note PyCLEAR(): 2da. when deleting an attribute.  Don't try to\nmicro-optimize at the expense of robustness!\n",
            "subsections": []
        },
        "The deallocator 'Customdealloc' may call arbitrary code when clearing": {
            "content": "attributes.  It means the circular GC can be triggered inside the\nfunction.  Since the GC assumes reference count is not zero, we need to\nuntrack the object from the GC by calling *note PyObjectGCUnTrack():\n1361. before clearing members.  Here is our reimplemented deallocator\nusing *note PyObjectGCUnTrack(): 1361. and 'Customclear':\n\nstatic void\nCustomdealloc(CustomObject *self)\n{\nPyObjectGCUnTrack(self);\nCustomclear(self);\nPyTYPE(self)->tpfree((PyObject *) self);\n}\n\nFinally, we add the *note PyTPFLAGSHAVEGC: 568. flag to the class\nflags:\n\n.tpflags = PyTPFLAGSDEFAULT | PyTPFLAGSBASETYPE | PyTPFLAGSHAVEGC,\n\nThat's pretty much it.  If we had written custom *note tpalloc: 46d2.\nor *note tpfree: 46d1. handlers, we'd need to modify them for cyclic\ngarbage collection.  Most extensions will use the versions automatically\nprovided.\n\n---------- Footnotes ----------\n\n(1) Also, even with our attributes restricted to strings instances,\nthe user could pass arbitrary *note str: 157. subclasses and therefore\nstill create reference cycles.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Subclassing other types,  Prev: Supporting cyclic garbage collection,  Up: Defining Extension Types Tutorial": {
            "content": "6.2.2.5 Subclassing other types\n...............................\n",
            "subsections": []
        },
        "It is possible to create new extension types that are derived from": {
            "content": "existing types.  It is easiest to inherit from the built in types, since\nan extension can easily use the *note PyTypeObject: 8da. it needs.  It\ncan be difficult to share these *note PyTypeObject: 8da. structures\nbetween extension modules.\n",
            "subsections": []
        },
        "In this example we will create a 'SubList' type that inherits from the": {
            "content": "built-in *note list: 3dc. type.  The new type will be completely\ncompatible with regular lists, but will have an additional 'increment()'\nmethod that increases an internal counter:\n\n>>> import sublist\n>>> s = sublist.SubList(range(3))\n>>> s.extend(s)\n>>> print(len(s))\n6\n>>> print(s.increment())\n1\n>>> print(s.increment())\n2\n\n#define PYSSIZETCLEAN\n#include <Python.h>\n\ntypedef struct {\nPyListObject list;\nint state;\n} SubListObject;\n\nstatic PyObject *\nSubListincrement(SubListObject *self, PyObject *unused)\n{\nself->state++;\nreturn PyLongFromLong(self->state);\n}\n\nstatic PyMethodDef SubListmethods[] = {\n{\"increment\", (PyCFunction) SubListincrement, METHNOARGS,\nPyDocSTR(\"increment state counter\")},\n{NULL},\n};\n\nstatic int\nSubListinit(SubListObject *self, PyObject *args, PyObject *kwds)\n{\nif (PyListType.tpinit((PyObject *) self, args, kwds) < 0)\nreturn -1;\nself->state = 0;\nreturn 0;\n}\n\nstatic PyTypeObject SubListType = {\nPyVarObjectHEADINIT(NULL, 0)\n.tpname = \"sublist.SubList\",\n.tpdoc = PyDocSTR(\"SubList objects\"),\n.tpbasicsize = sizeof(SubListObject),\n.tpitemsize = 0,\n.tpflags = PyTPFLAGSDEFAULT | PyTPFLAGSBASETYPE,\n.tpinit = (initproc) SubListinit,\n.tpmethods = SubListmethods,\n};\n\nstatic PyModuleDef sublistmodule = {\nPyModuleDefHEADINIT,\n.mname = \"sublist\",\n.mdoc = \"Example module that creates an extension type.\",\n.msize = -1,\n};\n\nPyMODINITFUNC\nPyInitsublist(void)\n{\nPyObject *m;\nSubListType.tpbase = &PyListType;\nif (PyTypeReady(&SubListType) < 0)\nreturn NULL;\n\nm = PyModuleCreate(&sublistmodule);\nif (m == NULL)\nreturn NULL;\n\nPyINCREF(&SubListType);\nif (PyModuleAddObject(m, \"SubList\", (PyObject *) &SubListType) < 0) {\nPyDECREF(&SubListType);\nPyDECREF(m);\nreturn NULL;\n}\n\nreturn m;\n}\n",
            "subsections": []
        },
        "As you can see, the source code closely resembles the 'Custom' examples": {
            "content": "in previous sections.  We will break down the main differences between\nthem.\n\ntypedef struct {\nPyListObject list;\nint state;\n} SubListObject;\n",
            "subsections": []
        },
        "The primary difference for derived type objects is that the base type's": {
            "content": "object structure must be the first value.  The base type will already\ninclude the *note PyObjectHEAD(): 1153. at the beginning of its\nstructure.\n\nWhen a Python object is a 'SubList' instance, its 'PyObject *' pointer\ncan be safely cast to both 'PyListObject *' and 'SubListObject *':\n\nstatic int\nSubListinit(SubListObject *self, PyObject *args, PyObject *kwds)\n{\nif (PyListType.tpinit((PyObject *) self, args, kwds) < 0)\nreturn -1;\nself->state = 0;\nreturn 0;\n}\n\nWe see above how to call through to the *note init(): 47d. method of\nthe base type.\n\nThis pattern is important when writing a type with custom *note tpnew:\n2e1. and *note tpdealloc: 46d0. members.  The *note tpnew: 2e1.\nhandler should not actually create the memory for the object with its\n*note tpalloc: 46d2, but let the base class handle it by calling its\nown *note tpnew: 2e1.\n\nThe *note PyTypeObject: 8da. struct supports a *note tpbase: 46dc.\nspecifying the type's concrete base class.  Due to cross-platform\ncompiler issues, you can't fill that field directly with a reference to\n*note PyListType: 46dd.; it should be done later in the module\ninitialization function:\n\nPyMODINITFUNC\nPyInitsublist(void)\n{\nPyObject* m;\nSubListType.tpbase = &PyListType;\nif (PyTypeReady(&SubListType) < 0)\nreturn NULL;\n\nm = PyModuleCreate(&sublistmodule);\nif (m == NULL)\nreturn NULL;\n\nPyINCREF(&SubListType);\nif (PyModuleAddObject(m, \"SubList\", (PyObject *) &SubListType) < 0) {\nPyDECREF(&SubListType);\nPyDECREF(m);\nreturn NULL;\n}\n\nreturn m;\n}\n\nBefore calling *note PyTypeReady(): 567, the type structure must have\nthe *note tpbase: 46dc. slot filled in.  When we are deriving an\nexisting type, it is not necessary to fill out the *note tpalloc: 46d2.\nslot with *note PyTypeGenericNew(): 46cd. - the allocation function\nfrom the base type will be inherited.\n\nAfter that, calling *note PyTypeReady(): 567. and adding the type\nobject to the module is the same as with the basic 'Custom' examples.\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "This section aims to give a quick fly-by on the various type methods you": {
            "content": "can implement and what they do.\n\nHere is the definition of *note PyTypeObject: 8da, with some fields only\nused in *note debug builds: 67f. omitted:\n\ntypedef struct typeobject {\nPyObjectVARHEAD\nconst char *tpname; /* For printing, in format \"<module>.<name>\" */\nPyssizet tpbasicsize, tpitemsize; /* For allocation */\n\n/* Methods to implement standard operations */\n\ndestructor tpdealloc;\nPyssizet tpvectorcalloffset;\ngetattrfunc tpgetattr;\nsetattrfunc tpsetattr;\nPyAsyncMethods *tpasasync; /* formerly known as tpcompare (Python 2)\nor tpreserved (Python 3) */\nreprfunc tprepr;\n\n/* Method suites for standard classes */\n\nPyNumberMethods *tpasnumber;\nPySequenceMethods *tpassequence;\nPyMappingMethods *tpasmapping;\n\n/* More standard operations (here for binary compatibility) */\n\nhashfunc tphash;\nternaryfunc tpcall;\nreprfunc tpstr;\ngetattrofunc tpgetattro;\nsetattrofunc tpsetattro;\n\n/* Functions to access object as input/output buffer */\nPyBufferProcs *tpasbuffer;\n\n/* Flags to define presence of optional/expanded features */\nunsigned long tpflags;\n\nconst char *tpdoc; /* Documentation string */\n\n/* Assigned meaning in release 2.0 */\n/* call function for all accessible objects */\ntraverseproc tptraverse;\n\n/* delete references to contained objects */\ninquiry tpclear;\n\n/* Assigned meaning in release 2.1 */\n/* rich comparisons */\nrichcmpfunc tprichcompare;\n\n/* weak reference enabler */\nPyssizet tpweaklistoffset;\n\n/* Iterators */\ngetiterfunc tpiter;\niternextfunc tpiternext;\n\n/* Attribute descriptor and subclassing stuff */\nstruct PyMethodDef *tpmethods;\nstruct PyMemberDef *tpmembers;\nstruct PyGetSetDef *tpgetset;\n// Strong reference on a heap type, borrowed reference on a static type\nstruct typeobject *tpbase;\nPyObject *tpdict;\ndescrgetfunc tpdescrget;\ndescrsetfunc tpdescrset;\nPyssizet tpdictoffset;\ninitproc tpinit;\nallocfunc tpalloc;\nnewfunc tpnew;\nfreefunc tpfree; /* Low-level free-memory routine */\ninquiry tpisgc; /* For PyObjectISGC */\nPyObject *tpbases;\nPyObject *tpmro; /* method resolution order */\nPyObject *tpcache;\nPyObject *tpsubclasses;\nPyObject *tpweaklist;\ndestructor tpdel;\n\n/* Type attribute cache version tag. Added in version 2.6 */\nunsigned int tpversiontag;\n\ndestructor tpfinalize;\nvectorcallfunc tpvectorcall;\n\n/* bitset of which type-watchers care about this type */\nunsigned char tpwatched;\n} PyTypeObject;\n",
            "subsections": []
        },
        "Now that's a 'lot' of methods.  Don't worry too much though - if you": {
            "content": "have a type you want to define, the chances are very good that you will\nonly implement a handful of these.\n",
            "subsections": []
        },
        "As you probably expect by now, we're going to go over this and give more": {
            "content": "information about the various handlers.  We won't go in the order they\nare defined in the structure, because there is a lot of historical\nbaggage that impacts the ordering of the fields.  It's often easiest to\nfind an example that includes the fields you need and then change the\nvalues to suit your new type.\n\nconst char *tpname; /* For printing */\n",
            "subsections": []
        },
        "The name of the type - as mentioned in the previous chapter, this will": {
            "content": "appear in various places, almost entirely for diagnostic purposes.  Try\nto choose something that will be helpful in such a situation!\n\nPyssizet tpbasicsize, tpitemsize; /* For allocation */\n",
            "subsections": []
        },
        "These fields tell the runtime how much memory to allocate when new": {
            "content": "objects of this type are created.  Python has some built-in support for\nvariable length structures (think: strings, tuples) which is where the\n*note tpitemsize: 1c77. field comes in.  This will be dealt with later.\n\nconst char *tpdoc;\n",
            "subsections": []
        },
        "Here you can put a string (or its address) that you want returned when": {
            "content": "the Python script references 'obj.doc' to retrieve the doc string.\n",
            "subsections": []
        },
        "Now we come to the basic type methods - the ones most extension types": {
            "content": "will implement.\n\n* Menu:\n\n* Finalization and De-allocation::\n* Object Presentation::\n* Attribute Management::\n* Object Comparison::\n* Abstract Protocol Support::\n* Weak Reference Support::\n* More Suggestions::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Finalization and De-allocation,  Next: Object Presentation,  Up: Defining Extension Types Assorted Topics": {
            "content": "6.2.3.1 Finalization and De-allocation\n......................................\n\ndestructor tpdealloc;\n",
            "subsections": []
        },
        "This function is called when the reference count of the instance of your": {
            "content": "type is reduced to zero and the Python interpreter wants to reclaim it.",
            "subsections": []
        },
        "If your type has memory to free or other clean-up to perform, you can": {
            "content": "put it here.  The object itself needs to be freed here as well.  Here is\nan example of this function:\n\nstatic void\nnewdatatypedealloc(newdatatypeobject *obj)\n{\nfree(obj->objUnderlyingDatatypePtr);\nPyTYPE(obj)->tpfree((PyObject *)obj);\n}\n",
            "subsections": []
        },
        "If your type supports garbage collection, the destructor should call": {
            "content": "*note PyObjectGCUnTrack(): 1361. before clearing any member fields:\n\nstatic void\nnewdatatypedealloc(newdatatypeobject *obj)\n{\nPyObjectGCUnTrack(obj);\nPyCLEAR(obj->otherobj);\n...\nPyTYPE(obj)->tpfree((PyObject *)obj);\n}\n",
            "subsections": []
        },
        "One important requirement of the deallocator function is that it leaves": {
            "content": "any pending exceptions alone.  This is important since deallocators are\nfrequently called as the interpreter unwinds the Python stack; when the\nstack is unwound due to an exception (rather than normal returns),\nnothing is done to protect the deallocators from seeing that an\nexception has already been set.  Any actions which a deallocator\nperforms which may cause additional Python code to be executed may\ndetect that an exception has been set.  This can lead to misleading\nerrors from the interpreter.  The proper way to protect against this is\nto save a pending exception before performing the unsafe action, and\nrestoring it when done.  This can be done using the *note PyErrFetch():\n2c7. and *note PyErrRestore(): 2c8. functions:\n\nstatic void\nmydealloc(PyObject *obj)\n{\nMyObject *self = (MyObject *) obj;\nPyObject *cbresult;\n\nif (self->mycallback != NULL) {\nPyObject *errtype, *errvalue, *errtraceback;\n\n/* This saves the current exception state */\nPyErrFetch(&errtype, &errvalue, &errtraceback);\n\ncbresult = PyObjectCallNoArgs(self->mycallback);\nif (cbresult == NULL)\nPyErrWriteUnraisable(self->mycallback);\nelse\nPyDECREF(cbresult);\n\n/* This restores the saved exception state */\nPyErrRestore(errtype, errvalue, errtraceback);\n\nPyDECREF(self->mycallback);\n}\nPyTYPE(obj)->tpfree((PyObject*)self);\n}\n\nNote: There are limitations to what you can safely do in a\ndeallocator function.  First, if your type supports garbage\ncollection (using *note tptraverse: 569. and/or *note tpclear:\n46e3.), some of the object's members can have been cleared or\nfinalized by the time *note tpdealloc: 46d0. is called.  Second,\nin *note tpdealloc: 46d0, your object is in an unstable state: its\nreference count is equal to zero.  Any call to a non-trivial object\nor API (as in the example above) might end up calling *note\ntpdealloc: 46d0. again, causing a double free and a crash.\n\nStarting with Python 3.4, it is recommended not to put any complex\nfinalization code in *note tpdealloc: 46d0, and instead use the\nnew *note tpfinalize: 8db. type method.\n\nSee also\n........\n\nPEP 442(1) explains the new finalization scheme.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0442/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Object Presentation,  Next: Attribute Management,  Prev: Finalization and De-allocation,  Up: Defining Extension Types Assorted Topics": {
            "content": "6.2.3.2 Object Presentation\n...........................\n",
            "subsections": []
        },
        "In Python, there are two ways to generate a textual representation of an": {
            "content": "object: the *note repr(): 5f0. function, and the *note str(): 157.\nfunction.  (The *note print(): de5. function just calls *note str():\n157.)  These handlers are both optional.\n\nreprfunc tprepr;\nreprfunc tpstr;\n\nThe *note tprepr: 46e5. handler should return a string object\ncontaining a representation of the instance for which it is called.\nHere is a simple example:\n\nstatic PyObject *\nnewdatatyperepr(newdatatypeobject *obj)\n{\nreturn PyUnicodeFromFormat(\"Repr-ifiednewdatatype{{size:%d}}\",\nobj->objUnderlyingDatatypePtr->size);\n}\n\nIf no *note tprepr: 46e5. handler is specified, the interpreter will\nsupply a representation that uses the type's *note tpname: 1657. and a\nuniquely identifying value for the object.\n\nThe *note tpstr: 46e6. handler is to *note str(): 157. what the *note\ntprepr: 46e5. handler described above is to *note repr(): 5f0.; that\nis, it is called when Python code calls *note str(): 157. on an instance\nof your object.  Its implementation is very similar to the *note\ntprepr: 46e5. function, but the resulting string is intended for human\nconsumption.  If *note tpstr: 46e6. is not specified, the *note\ntprepr: 46e5. handler is used instead.\n\nHere is a simple example:\n\nstatic PyObject *\nnewdatatypestr(newdatatypeobject *obj)\n{\nreturn PyUnicodeFromFormat(\"Stringifiednewdatatype{{size:%d}}\",\nobj->objUnderlyingDatatypePtr->size);\n}\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Attribute Management,  Next: Object Comparison,  Prev: Object Presentation,  Up: Defining Extension Types Assorted Topics": {
            "content": "6.2.3.3 Attribute Management\n............................\n",
            "subsections": []
        },
        "For every object which can support attributes, the corresponding type": {
            "content": "must provide the functions that control how the attributes are resolved.",
            "subsections": []
        },
        "There needs to be a function which can retrieve attributes (if any are": {
            "content": "defined), and another to set attributes (if setting attributes is\nallowed).  Removing an attribute is a special case, for which the new\nvalue passed to the handler is 'NULL'.\n",
            "subsections": []
        },
        "Python supports two pairs of attribute handlers; a type that supports": {
            "content": "attributes only needs to implement the functions for one pair.  The\ndifference is that one pair takes the name of the attribute as a char*,\nwhile the other accepts a *note PyObject: 6b1.*.  Each type can use\nwhichever pair makes more sense for the implementation's convenience.\n\ngetattrfunc  tpgetattr;        /* char * version */\nsetattrfunc  tpsetattr;\n/* ... */\ngetattrofunc tpgetattro;       /* PyObject * version */\nsetattrofunc tpsetattro;\n",
            "subsections": []
        },
        "If accessing attributes of an object is always a simple operation (this": {
            "content": "will be explained shortly), there are generic implementations which can\nbe used to provide the *note PyObject: 6b1.* version of the attribute\nmanagement functions.  The actual need for type-specific attribute\nhandlers almost completely disappeared starting with Python 2.2, though\nthere are many examples which have not been updated to use some of the\nnew generic mechanism that is available.\n\n* Menu:\n\n* Generic Attribute Management::\n* Type-specific Attribute Management::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Generic Attribute Management,  Next: Type-specific Attribute Management,  Up: Attribute Management": {
            "content": "6.2.3.4 Generic Attribute Management\n....................................\n",
            "subsections": []
        },
        "Most extension types only use 'simple' attributes.  So, what makes the": {
            "content": "attributes simple?  There are only a couple of conditions that must be\nmet:\n\n1. The name of the attributes must be known when *note PyTypeReady():\n567. is called.\n\n2. No special processing is needed to record that an attribute was\nlooked up or set, nor do actions need to be taken based on the\nvalue.\n",
            "subsections": []
        },
        "Note that this list does not place any restrictions on the values of the": {
            "content": "attributes, when the values are computed, or how relevant data is\nstored.\n\nWhen *note PyTypeReady(): 567. is called, it uses three tables\nreferenced by the type object to create *note descriptor: 1c78.s which\nare placed in the dictionary of the type object.  Each descriptor\ncontrols access to one attribute of the instance object.  Each of the\ntables is optional; if all three are 'NULL', instances of the type will\nonly have attributes that are inherited from their base type, and should\nleave the *note tpgetattro: 46e9. and *note tpsetattro: 46ea. fields\n'NULL' as well, allowing the base type to handle attributes.\n\nThe tables are declared as three fields of the type object:\n\nstruct PyMethodDef *tpmethods;\nstruct PyMemberDef *tpmembers;\nstruct PyGetSetDef *tpgetset;\n\nIf *note tpmethods: 46d5. is not 'NULL', it must refer to an array of\n*note PyMethodDef: 1332. structures.  Each entry in the table is an\ninstance of this structure:\n\ntypedef struct PyMethodDef {\nconst char  *mlname;       /* method name */\nPyCFunction  mlmeth;       /* implementation function */\nint          mlflags;      /* flags */\nconst char  *mldoc;        /* docstring */\n} PyMethodDef;\n",
            "subsections": []
        },
        "One entry should be defined for each method provided by the type; no": {
            "content": "entries are needed for methods inherited from a base type.  One\nadditional entry is needed at the end; it is a sentinel that marks the\nend of the array.  The *note mlname: 46eb. field of the sentinel must\nbe 'NULL'.\n",
            "subsections": []
        },
        "The second table is used to define attributes which map directly to data": {
            "content": "stored in the instance.  A variety of primitive C types are supported,\nand access may be read-only or read-write.  The structures in the table\nare defined as:\n\ntypedef struct PyMemberDef {\nconst char *name;\nint         type;\nint         offset;\nint         flags;\nconst char *doc;\n} PyMemberDef;\n\nFor each entry in the table, a *note descriptor: 1c78. will be\nconstructed and added to the type which will be able to extract a value\nfrom the instance structure.  The *note type: 46ec. field should contain\na type code like *note PyTINT: 31b. or *note PyTDOUBLE: 31c.; the\nvalue will be used to determine how to convert Python values to and from\nC values.  The *note flags: 46ed. field is used to store flags which\ncontrol how the attribute can be accessed: you can set it to *note\nPyREADONLY: 31d. to prevent Python code from setting it.\n\nAn interesting advantage of using the *note tpmembers: 46d3. table to\nbuild descriptors that are used at runtime is that any attribute defined\nthis way can have an associated doc string simply by providing the text\nin the table.  An application can use the introspection API to retrieve\nthe descriptor from the class object, and get the doc string using its\n'doc' attribute.\n\nAs with the *note tpmethods: 46d5. table, a sentinel entry with a *note\nmlname: 46eb. value of 'NULL' is required.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Type-specific Attribute Management,  Prev: Generic Attribute Management,  Up: Attribute Management": {
            "content": "6.2.3.5 Type-specific Attribute Management\n..........................................\n\nFor simplicity, only the char* version will be demonstrated here; the\ntype of the name parameter is the only difference between the char* and\n*note PyObject: 6b1.* flavors of the interface.  This example\neffectively does the same thing as the generic example above, but does\nnot use the generic support added in Python 2.2.  It explains how the\nhandler functions are called, so that if you do need to extend their\nfunctionality, you'll understand what needs to be done.\n\nThe *note tpgetattr: 46ef. handler is called when the object requires\nan attribute look-up.  It is called in the same situations where the\n*note getattr(): 1f8. method of a class would be called.\n\nHere is an example:\n\nstatic PyObject *\nnewdatatypegetattr(newdatatypeobject *obj, char *name)\n{\nif (strcmp(name, \"data\") == 0)\n{\nreturn PyLongFromLong(obj->data);\n}\n\nPyErrFormat(PyExcAttributeError,\n\"'%.100s' object has no attribute '%.400s'\",\nPyTYPE(obj)->tpname, name);\nreturn NULL;\n}\n\nThe *note tpsetattr: 46f0. handler is called when the *note\nsetattr(): 1c35. or *note delattr(): 1c36. method of a class\ninstance would be called.  When an attribute should be deleted, the\nthird parameter will be 'NULL'.  Here is an example that simply raises\nan exception; if this were really all you wanted, the *note tpsetattr:\n46f0. handler should be set to 'NULL'.\n\nstatic int\nnewdatatypesetattr(newdatatypeobject *obj, char *name, PyObject *v)\n{\nPyErrFormat(PyExcRuntimeError, \"Read-only attribute: %s\", name);\nreturn -1;\n}\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Object Comparison,  Next: Abstract Protocol Support,  Prev: Attribute Management,  Up: Defining Extension Types Assorted Topics": {
            "content": "6.2.3.6 Object Comparison\n.........................\n\nrichcmpfunc tprichcompare;\n\nThe *note tprichcompare: 46f2. handler is called when comparisons are\nneeded.  It is analogous to the *note rich comparison methods: 1c67,\nlike 'lt()', and also called by *note PyObjectRichCompare(): 46f3.\nand *note PyObjectRichCompareBool(): 1711.\n",
            "subsections": []
        },
        "This function is called with two Python objects and the operator as": {
            "content": "arguments, where the operator is one of 'PyEQ', 'PyNE', 'PyLE',\n'PyGE', 'PyLT' or 'PyGT'.  It should compare the two objects with\nrespect to the specified operator and return 'PyTrue' or 'PyFalse' if\nthe comparison is successful, 'PyNotImplemented' to indicate that\ncomparison is not implemented and the other object's comparison method\nshould be tried, or 'NULL' if an exception was set.\n",
            "subsections": []
        },
        "Here is a sample implementation, for a datatype that is considered equal": {
            "content": "if the size of an internal pointer is equal:\n\nstatic PyObject *\nnewdatatyperichcmp(newdatatypeobject *obj1, newdatatypeobject *obj2, int op)\n{\nPyObject *result;\nint c, size1, size2;\n\n/* code to make sure that both arguments are of type\nnewdatatype omitted */\n\nsize1 = obj1->objUnderlyingDatatypePtr->size;\nsize2 = obj2->objUnderlyingDatatypePtr->size;\n\nswitch (op) {\ncase PyLT: c = size1 <  size2; break;\ncase PyLE: c = size1 <= size2; break;\ncase PyEQ: c = size1 == size2; break;\ncase PyNE: c = size1 != size2; break;\ncase PyGT: c = size1 >  size2; break;\ncase PyGE: c = size1 >= size2; break;\n}\nresult = c ? PyTrue : PyFalse;\nPyINCREF(result);\nreturn result;\n}\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Abstract Protocol Support,  Next: Weak Reference Support,  Prev: Object Comparison,  Up: Defining Extension Types Assorted Topics": {
            "content": "6.2.3.7 Abstract Protocol Support\n.................................\n",
            "subsections": []
        },
        "Python supports a variety of 'abstract' 'protocols;' the specific": {
            "content": "interfaces provided to use these interfaces are documented in *note\nAbstract Objects Layer: 46f5.\n\nA number of these abstract interfaces were defined early in the\ndevelopment of the Python implementation.  In particular, the number,\nmapping, and sequence protocols have been part of Python since the\nbeginning.  Other protocols have been added over time.  For protocols\nwhich depend on several handler routines from the type implementation,\nthe older protocols have been defined as optional blocks of handlers\nreferenced by the type object.  For newer protocols there are additional\nslots in the main type object, with a flag bit being set to indicate\nthat the slots are present and should be checked by the interpreter.\n(The flag bit does not indicate that the slot values are non-'NULL'.",
            "subsections": []
        },
        "The flag may be set to indicate the presence of a slot, but a slot may": {
            "content": "still be unfilled.)\n\nPyNumberMethods   *tpasnumber;\nPySequenceMethods *tpassequence;\nPyMappingMethods  *tpasmapping;\n",
            "subsections": []
        },
        "If you wish your object to be able to act like a number, a sequence, or": {
            "content": "a mapping object, then you place the address of a structure that\nimplements the C type *note PyNumberMethods: 1274, *note\nPySequenceMethods: 46f6, or *note PyMappingMethods: 46f7, respectively.",
            "subsections": []
        },
        "It is up to you to fill in this structure with appropriate values.  You": {
            "content": "can find examples of the use of each of these in the 'Objects' directory\nof the Python source distribution.\n\nhashfunc tphash;\n",
            "subsections": []
        },
        "This function, if you choose to provide it, should return a hash number": {
            "content": "for an instance of your data type.  Here is a simple example:\n\nstatic Pyhasht\nnewdatatypehash(newdatatypeobject *obj)\n{\nPyhasht result;\nresult = obj->somesize + 32767 * obj->somenumber;\nif (result == -1)\nresult = -2;\nreturn result;\n}\n\n'Pyhasht' is a signed integer type with a platform-varying width.\nReturning '-1' from *note tphash: 46f8. indicates an error, which is\nwhy you should be careful to avoid returning it when hash computation is\nsuccessful, as seen above.\n\nternaryfunc tpcall;\n\nThis function is called when an instance of your data type is \"called\",\nfor example, if 'obj1' is an instance of your data type and the Python\nscript contains 'obj1('hello')', the *note tpcall: 2b3. handler is\ninvoked.\n\nThis function takes three arguments:\n\n1. 'self' is the instance of the data type which is the subject of the\ncall.  If the call is 'obj1('hello')', then 'self' is 'obj1'.\n\n2. 'args' is a tuple containing the arguments to the call.  You can\nuse *note PyArgParseTuple(): 2d1. to extract the arguments.\n\n3. 'kwds' is a dictionary of keyword arguments that were passed.  If\nthis is non-'NULL' and you support keyword arguments, use *note\nPyArgParseTupleAndKeywords(): b68. to extract the arguments.  If\nyou do not want to support keyword arguments and this is\nnon-'NULL', raise a *note TypeError: 28e. with a message saying\nthat keyword arguments are not supported.\n\nHere is a toy 'tpcall' implementation:\n\nstatic PyObject *\nnewdatatypecall(newdatatypeobject *obj, PyObject *args, PyObject *kwds)\n{\nPyObject *result;\nconst char *arg1;\nconst char *arg2;\nconst char *arg3;\n\nif (!PyArgParseTuple(args, \"sss:call\", &arg1, &arg2, &arg3)) {\nreturn NULL;\n}\nresult = PyUnicodeFromFormat(\n\"Returning -- value: [%d] arg1: [%s] arg2: [%s] arg3: [%s]\\n\",\nobj->objUnderlyingDatatypePtr->size,\narg1, arg2, arg3);\nreturn result;\n}\n\n/* Iterators */\ngetiterfunc tpiter;\niternextfunc tpiternext;\n",
            "subsections": []
        },
        "These functions provide support for the iterator protocol.  Both": {
            "content": "handlers take exactly one parameter, the instance for which they are\nbeing called, and return a new reference.  In the case of an error, they\nshould set an exception and return 'NULL'.  *note tpiter: 1348.\ncorresponds to the Python *note iter(): 1c61. method, while *note\ntpiternext: 1349. corresponds to the Python *note next(): 1141.\nmethod.\n\nAny *note iterable: 109d. object must implement the *note tpiter: 1348.\nhandler, which must return an *note iterator: 16a9. object.  Here the\nsame guidelines apply as for Python classes:\n\n* For collections (such as lists and tuples) which can support\nmultiple independent iterators, a new iterator should be created\nand returned by each call to *note tpiter: 1348.\n\n* Objects which can only be iterated over once (usually due to side\neffects of iteration, such as file objects) can implement *note\ntpiter: 1348. by returning a new reference to themselves - and\nshould also therefore implement the *note tpiternext: 1349.\nhandler.\n\nAny *note iterator: 16a9. object should implement both *note tpiter:\n1348. and *note tpiternext: 1349.  An iterator's *note tpiter: 1348.\nhandler should return a new reference to the iterator.  Its *note\ntpiternext: 1349. handler should return a new reference to the next\nobject in the iteration, if there is one.  If the iteration has reached\nthe end, *note tpiternext: 1349. may return 'NULL' without setting an\nexception, or it may set *note StopIteration: a40. 'in addition' to\nreturning 'NULL'; avoiding the exception can yield slightly better\nperformance.  If an actual error occurs, *note tpiternext: 1349. should\nalways set an exception and return 'NULL'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Weak Reference Support,  Next: More Suggestions,  Prev: Abstract Protocol Support,  Up: Defining Extension Types Assorted Topics": {
            "content": "6.2.3.8 Weak Reference Support\n..............................\n",
            "subsections": []
        },
        "One of the goals of Python's weak reference implementation is to allow": {
            "content": "any type to participate in the weak reference mechanism without\nincurring the overhead on performance-critical objects (such as\nnumbers).\n\nSee also\n........\n\nDocumentation for the *note weakref: 10f. module.\n",
            "subsections": []
        },
        "For an object to be weakly referencable, the extension type must set the": {
            "content": "'PyTPFLAGSMANAGEDWEAKREF' bit of the *note tpflags: 1620. field.\nThe legacy *note tpweaklistoffset: 7ac. field should be left as zero.\n\nConcretely, here is how the statically declared type object would look:\n\nstatic PyTypeObject TrivialType = {\nPyVarObjectHEADINIT(NULL, 0)\n/* ... other members omitted for brevity ... */\n.tpflags = PyTPFLAGSMANAGEDWEAKREF | ...,\n};\n",
            "subsections": []
        },
        "The only further addition is that 'tpdealloc' needs to clear any weak": {
            "content": "references (by calling *note PyObjectClearWeakRefs(): 2d8.):\n\nstatic void\nTrivialdealloc(TrivialObject *self)\n{\n/* Clear weakrefs first before calling any destructors */\nPyObjectClearWeakRefs((PyObject *) self);\n/* ... remainder of destruction code omitted for brevity ... */\nPyTYPE(self)->tpfree((PyObject *) self);\n}\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: More Suggestions,  Prev: Weak Reference Support,  Up: Defining Extension Types Assorted Topics": {
            "content": "6.2.3.9 More Suggestions\n........................\n",
            "subsections": []
        },
        "In order to learn how to implement any specific method for your new data": {
            "content": "type, get the *note CPython: 4c9. source code.  Go to the 'Objects'\ndirectory, then search the C source files for 'tp' plus the function\nyou want (for example, 'tprichcompare').  You will find examples of the\nfunction you want to implement.\n",
            "subsections": []
        },
        "When you need to verify that an object is a concrete instance of the": {
            "content": "type you are implementing, use the *note PyObjectTypeCheck(): 165c.\nfunction.  A sample of its use might be something like the following:\n\nif (!PyObjectTypeCheck(someobject, &MyType)) {\nPyErrSetString(PyExcTypeError, \"arg #1 not a mything\");\nreturn NULL;\n}\n\nSee also\n........\n\nDownload CPython source releases.\n\n'https://www.python.org/downloads/source/'\n\nThe CPython project on GitHub, where the CPython source code is developed.\n\n'https://github.com/python/cpython'\n\nFile: python3.12.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\n\n\nA C extension for CPython is a shared library (e.g.  a '.so' file on\nLinux, '.pyd' on Windows), which exports an 'initialization function'.\n\nTo be importable, the shared library must be available on *note\nPYTHONPATH: e92, and must be named after the module name, with an\nappropriate extension.  When using setuptools, the correct filename is\ngenerated automatically.\n\nThe initialization function has the signature:\n\n-- C Function: *note PyObject: 6b1. *PyInitmodulename (void)\n\nIt returns either a fully initialized module, or a *note PyModuleDef:\n7a1. instance.  See *note Initializing C modules: 46fe. for details.\n",
            "subsections": []
        },
        "For modules with ASCII-only names, the function must be named": {
            "content": "'PyInit<modulename>', with '<modulename>' replaced by the name of the\nmodule.  When using *note Multi-phase initialization: 46ff, non-ASCII\nmodule names are allowed.  In this case, the initialization function\nname is 'PyInitU<modulename>', with '<modulename>' encoded using",
            "subsections": []
        },
        "Python's 'punycode' encoding with hyphens replaced by underscores.  In": {
            "content": "Python:\n\ndef initfuncname(name):\ntry:\nsuffix = b'' + name.encode('ascii')\nexcept UnicodeEncodeError:\nsuffix = b'U' + name.encode('punycode').replace(b'-', b'')\nreturn b'PyInit' + suffix\n",
            "subsections": []
        },
        "It is possible to export multiple modules from a single shared library": {
            "content": "by defining multiple initialization functions.  However, importing them\nrequires using symbolic links or a custom importer, because by default\nonly the function corresponding to the filename is found.  See the\n'\"Multiple modules in one library\"' section in PEP 489(1) for details.\n* Menu:\n\n* Building C and C++ Extensions with setuptools::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0489/\n\nFile: python3.12.info,  Node: Building C and C++ Extensions with setuptools,  Up: Building C and C++ Extensions\n\n6.2.4.1 Building C and C++ Extensions with setuptools\n.....................................................\n",
            "subsections": []
        },
        "Python 3.12 and newer no longer come with distutils.  Please refer to": {
            "content": "the 'setuptools' documentation at\n'https://setuptools.readthedocs.io/en/latest/setuptools.html' to learn\nmore about how build and distribute C/C++ extensions with setuptools.\n\nFile: python3.12.info,  Node: Building C and C++ Extensions on Windows,  Prev: Building C and C++ Extensions,  Up: Creating extensions without third party tools\n\n",
            "subsections": []
        },
        "This chapter briefly explains how to create a Windows extension module": {
            "content": "for Python using Microsoft Visual C++, and follows with more detailed\nbackground information on how it works.  The explanatory material is\nuseful for both the Windows programmer learning to build Python\nextensions and the Unix programmer interested in producing software\nwhich can be successfully built on both Unix and Windows.\n",
            "subsections": []
        },
        "Module authors are encouraged to use the distutils approach for building": {
            "content": "extension modules, instead of the one described in this section.  You\nwill still need the C compiler that was used to build Python; typically\nMicrosoft Visual C++.\n\nNote: This chapter mentions a number of filenames that include an\nencoded Python version number.  These filenames are represented\nwith the version number shown as 'XY'; in practice, ''X'' will be\nthe major version number and ''Y'' will be the minor version number\nof the Python release you're working with.  For example, if you are\nusing Python 2.2.1, 'XY' will actually be '22'.\n\n* Menu:\n\n* A Cookbook Approach::\n* Differences Between Unix and Windows::\n* Using DLLs in Practice::\n\nFile: python3.12.info,  Node: A Cookbook Approach,  Next: Differences Between Unix and Windows,  Up: Building C and C++ Extensions on Windows\n\n6.2.5.1 A Cookbook Approach\n...........................\n",
            "subsections": []
        },
        "There are two approaches to building extension modules on Windows, just": {
            "content": "as there are on Unix: use the 'setuptools' package to control the build\nprocess, or do things manually.  The setuptools approach works well for\nmost extensions; documentation on using 'setuptools' to build and\npackage extension modules is available in *note Building C and C++",
            "subsections": []
        },
        "Extensions with setuptools: d5e.  If you find you really need to do": {
            "content": "things manually, it may be instructive to study the project file for the\nwinsound(1) standard library module.\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/PCbuild/winsound.vcxproj\n\nFile: python3.12.info,  Node: Differences Between Unix and Windows,  Next: Using DLLs in Practice,  Prev: A Cookbook Approach,  Up: Building C and C++ Extensions on Windows\n\n6.2.5.2 Differences Between Unix and Windows\n............................................\n",
            "subsections": []
        },
        "Unix and Windows use completely different paradigms for run-time loading": {
            "content": "of code.  Before you try to build a module that can be dynamically\nloaded, be aware of how your system works.\n",
            "subsections": []
        },
        "In Unix, a shared object ('.so') file contains code to be used by the": {
            "content": "program, and also the names of functions and data that it expects to\nfind in the program.  When the file is joined to the program, all\nreferences to those functions and data in the file's code are changed to\npoint to the actual locations in the program where the functions and\ndata are placed in memory.  This is basically a link operation.\n",
            "subsections": []
        },
        "In Windows, a dynamic-link library ('.dll') file has no dangling": {
            "content": "references.  Instead, an access to functions or data goes through a\nlookup table.  So the DLL code does not have to be fixed up at runtime\nto refer to the program's memory; instead, the code already uses the\nDLL's lookup table, and the lookup table is modified at runtime to point\nto the functions and data.\n",
            "subsections": []
        },
        "In Unix, there is only one type of library file ('.a') which contains": {
            "content": "code from several object files ('.o').  During the link step to create a\nshared object file ('.so'), the linker may find that it doesn't know\nwhere an identifier is defined.  The linker will look for it in the\nobject files in the libraries; if it finds it, it will include all the\ncode from that object file.\n",
            "subsections": []
        },
        "In Windows, there are two types of library, a static library and an": {
            "content": "import library (both called '.lib').  A static library is like a Unix\n'.a' file; it contains code to be included as necessary.  An import\nlibrary is basically used only to reassure the linker that a certain\nidentifier is legal, and will be present in the program when the DLL is\nloaded.  So the linker uses the information from the import library to\nbuild the lookup table for using identifiers that are not included in\nthe DLL. When an application or a DLL is linked, an import library may\nbe generated, which will need to be used for all future DLLs that depend\non the symbols in the application or DLL.\n",
            "subsections": []
        },
        "Suppose you are building two dynamic-load modules, B and C, which should": {
            "content": "share another block of code A. On Unix, you would 'not' pass 'A.a' to\nthe linker for 'B.so' and 'C.so'; that would cause it to be included\ntwice, so that B and C would each have their own copy.  In Windows,\nbuilding 'A.dll' will also build 'A.lib'.  You 'do' pass 'A.lib' to the\nlinker for B and C. 'A.lib' does not contain code; it just contains\ninformation which will be used at runtime to access A's code.\n",
            "subsections": []
        },
        "In Windows, using an import library is sort of like using 'import spam';": {
            "content": "it gives you access to spam's names, but does not create a separate\ncopy.  On Unix, linking with a library is more like 'from spam import\n*'; it does create a separate copy.\n\nFile: python3.12.info,  Node: Using DLLs in Practice,  Prev: Differences Between Unix and Windows,  Up: Building C and C++ Extensions on Windows\n\n6.2.5.3 Using DLLs in Practice\n..............................\n\nWindows Python is built in Microsoft Visual C++; using other compilers\nmay or may not work.  The rest of this section is MSVC++ specific.\n",
            "subsections": []
        },
        "When creating DLLs in Windows, you must pass 'pythonXY.lib' to the": {
            "content": "linker.  To build two DLLs, spam and ni (which uses C functions found in\nspam), you could use these commands:\n\ncl /LD /I/python/include spam.c ../libs/pythonXY.lib\ncl /LD /I/python/include ni.c spam.lib ../libs/pythonXY.lib\n",
            "subsections": []
        },
        "The first command created three files: 'spam.obj', 'spam.dll' and": {
            "content": "'spam.lib'.  'Spam.dll' does not contain any Python functions (such as\n*note PyArgParseTuple(): 2d1.), but it does know how to find the Python\ncode thanks to 'pythonXY.lib'.\n",
            "subsections": []
        },
        "The second command created 'ni.dll' (and '.obj' and '.lib'), which knows": {
            "content": "how to find the necessary functions from spam, and also from the Python\nexecutable.\n",
            "subsections": []
        },
        "Not every identifier is exported to the lookup table.  If you want any": {
            "content": "other modules (including Python) to be able to see your identifiers, you\nhave to say 'declspec(dllexport)', as in 'void declspec(dllexport)\ninitspam(void)' or 'PyObject declspec(dllexport) *NiGetSpamData(void)'.\n",
            "subsections": []
        },
        "Developer Studio will throw in a lot of import libraries that you do not": {
            "content": "really need, adding about 100K to your executable.  To get rid of them,\nuse the Project Settings dialog, Link tab, to specify 'ignore default\nlibraries'.  Add the correct 'msvcrt`xx'.lib' to the list of libraries.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Embedding the CPython runtime in a larger application,  Prev: Creating extensions without third party tools,  Up: Extending and Embedding the Python Interpreter": {
            "content": "",
            "subsections": [
                {
                    "name": "6.3 Embedding the CPython runtime in a larger application",
                    "content": ""
                }
            ]
        },
        "Sometimes, rather than creating an extension that runs inside the Python": {
            "content": "interpreter as the main application, it is desirable to instead embed\nthe CPython runtime inside a larger application.  This section covers\nsome of the details involved in doing that successfully.\n\n* Menu:\n\n* Embedding Python in Another Application::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Embedding Python in Another Application,  Up: Embedding the CPython runtime in a larger application": {
            "content": "",
            "subsections": []
        },
        "The previous chapters discussed how to extend Python, that is, how to": {
            "content": "extend the functionality of Python by attaching a library of C functions\nto it.  It is also possible to do it the other way around: enrich your\nC/C++ application by embedding Python in it.  Embedding provides your\napplication with the ability to implement some of the functionality of\nyour application in Python rather than C or C++.  This can be used for\nmany purposes; one example would be to allow users to tailor the\napplication to their needs by writing some scripts in Python.  You can\nalso use it yourself if some of the functionality can be written in\nPython more easily.\n",
            "subsections": []
        },
        "Embedding Python is similar to extending it, but not quite.  The": {
            "content": "difference is that when you extend Python, the main program of the\napplication is still the Python interpreter, while if you embed Python,\nthe main program may have nothing to do with Python -- instead, some\nparts of the application occasionally call the Python interpreter to run\nsome Python code.\n\nSo if you are embedding Python, you are providing your own main program.",
            "subsections": []
        },
        "One of the things this main program has to do is initialize the Python": {
            "content": "interpreter.  At the very least, you have to call the function *note",
            "subsections": []
        },
        "PyInitialize(): 6c2.  There are optional calls to pass command line": {
            "content": "arguments to Python.  Then later you can call the interpreter from any\npart of the application.\n",
            "subsections": []
        },
        "There are several different ways to call the interpreter: you can pass a": {
            "content": "string containing Python statements to *note PyRunSimpleString(): 470d,\nor you can pass a stdio file pointer and a file name (for identification\nin error messages only) to *note PyRunSimpleFile(): 470e.  You can also\ncall the lower-level operations described in the previous chapters to\nconstruct and use Python objects.\n\nSee also\n........\n\n*note Python/C API Reference Manual: 195f.\n\nThe details of Python's C interface are given in this manual.  A\ngreat deal of necessary information can be found here.\n\n* Menu:\n\n* Very High Level Embedding::\n* Beyond Very High Level Embedding; An overview: Beyond Very High Level Embedding An overview.\n* Pure Embedding::\n* Extending Embedded Python::\n* Embedding Python in C++::\n* Compiling and Linking under Unix-like systems::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Very High Level Embedding,  Next: Beyond Very High Level Embedding An overview,  Up: Embedding Python in Another Application": {
            "content": "6.3.1.1 Very High Level Embedding\n.................................\n",
            "subsections": []
        },
        "The simplest form of embedding Python is the use of the very high level": {
            "content": "interface.  This interface is intended to execute a Python script\nwithout needing to interact with the application directly.  This can for\nexample be used to perform some operation on a file.\n\n#define PYSSIZETCLEAN\n#include <Python.h>\n\nint\nmain(int argc, char *argv[])\n{\nwchart *program = PyDecodeLocale(argv[0], NULL);\nif (program == NULL) {\nfprintf(stderr, \"Fatal error: cannot decode argv[0]\\n\");\nexit(1);\n}\nPySetProgramName(program);  /* optional but recommended */\nPyInitialize();\nPyRunSimpleString(\"from time import time,ctime\\n\"\n\"print('Today is', ctime(time()))\\n\");\nif (PyFinalizeEx() < 0) {\nexit(120);\n}\nPyMemRawFree(program);\nreturn 0;\n}\n\nThe *note PySetProgramName(): 181f. function should be called before\n*note PyInitialize(): 6c2. to inform the interpreter about paths to",
            "subsections": []
        },
        "Python run-time libraries.  Next, the Python interpreter is initialized": {
            "content": "with *note PyInitialize(): 6c2, followed by the execution of a\nhard-coded Python script that prints the date and time.  Afterwards, the\n*note PyFinalizeEx(): b67. call shuts the interpreter down, followed by\nthe end of the program.  In a real program, you may want to get the",
            "subsections": []
        },
        "Python script from another source, perhaps a text-editor routine, a": {
            "content": "file, or a database.  Getting the Python code from a file can better be\ndone by using the *note PyRunSimpleFile(): 470e. function, which saves\nyou the trouble of allocating memory space and loading the file\ncontents.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Beyond Very High Level Embedding An overview,  Next: Pure Embedding,  Prev: Very High Level Embedding,  Up: Embedding Python in Another Application": {
            "content": "6.3.1.2 Beyond Very High Level Embedding: An overview\n.....................................................\n",
            "subsections": []
        },
        "The high level interface gives you the ability to execute arbitrary": {
            "content": "pieces of Python code from your application, but exchanging data values\nis quite cumbersome to say the least.  If you want that, you should use\nlower level calls.  At the cost of having to write more C code, you can\nachieve almost anything.\n",
            "subsections": []
        },
        "It should be noted that extending Python and embedding Python is quite": {
            "content": "the same activity, despite the different intent.  Most topics discussed\nin the previous chapters are still valid.  To show this, consider what\nthe extension code from Python to C really does:\n\n1. Convert data values from Python to C,\n\n2. Perform a function call to a C routine using the converted values,\nand\n\n3. Convert the data values from the call from C to Python.\n\nWhen embedding Python, the interface code does:\n\n1. Convert data values from C to Python,\n\n2. Perform a function call to a Python interface routine using the\nconverted values, and\n\n3. Convert the data values from the call from Python to C.\n",
            "subsections": []
        },
        "As you can see, the data conversion steps are simply swapped to": {
            "content": "accommodate the different direction of the cross-language transfer.  The\nonly difference is the routine that you call between both data\nconversions.  When extending, you call a C routine, when embedding, you\ncall a Python routine.\n",
            "subsections": []
        },
        "This chapter will not discuss how to convert data from Python to C and": {
            "content": "vice versa.  Also, proper use of references and dealing with errors is\nassumed to be understood.  Since these aspects do not differ from\nextending the interpreter, you can refer to earlier chapters for the\nrequired information.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Pure Embedding,  Next: Extending Embedded Python,  Prev: Beyond Very High Level Embedding An overview,  Up: Embedding Python in Another Application": {
            "content": "6.3.1.3 Pure Embedding\n......................\n",
            "subsections": []
        },
        "The first program aims to execute a function in a Python script.  Like": {
            "content": "in the section about the very high level interface, the Python\ninterpreter does not directly interact with the application (but that\nwill change in the next section).\n\nThe code to run a function defined in a Python script is:\n\n#define PYSSIZETCLEAN\n#include <Python.h>\n\nint\nmain(int argc, char *argv[])\n{\nPyObject *pName, *pModule, *pFunc;\nPyObject *pArgs, *pValue;\nint i;\n\nif (argc < 3) {\nfprintf(stderr,\"Usage: call pythonfile funcname [args]\\n\");\nreturn 1;\n}\n\nPyInitialize();\npName = PyUnicodeDecodeFSDefault(argv[1]);\n/* Error checking of pName left out */\n\npModule = PyImportImport(pName);\nPyDECREF(pName);\n\nif (pModule != NULL) {\npFunc = PyObjectGetAttrString(pModule, argv[2]);\n/* pFunc is a new reference */\n\nif (pFunc && PyCallableCheck(pFunc)) {\npArgs = PyTupleNew(argc - 3);\nfor (i = 0; i < argc - 3; ++i) {\npValue = PyLongFromLong(atoi(argv[i + 3]));\nif (!pValue) {\nPyDECREF(pArgs);\nPyDECREF(pModule);\nfprintf(stderr, \"Cannot convert argument\\n\");\nreturn 1;\n}\n/* pValue reference stolen here: */\nPyTupleSetItem(pArgs, i, pValue);\n}\npValue = PyObjectCallObject(pFunc, pArgs);\nPyDECREF(pArgs);\nif (pValue != NULL) {\nprintf(\"Result of call: %ld\\n\", PyLongAsLong(pValue));\nPyDECREF(pValue);\n}\nelse {\nPyDECREF(pFunc);\nPyDECREF(pModule);\nPyErrPrint();\nfprintf(stderr,\"Call failed\\n\");\nreturn 1;\n}\n}\nelse {\nif (PyErrOccurred())\nPyErrPrint();\nfprintf(stderr, \"Cannot find function \\\"%s\\\"\\n\", argv[2]);\n}\nPyXDECREF(pFunc);\nPyDECREF(pModule);\n}\nelse {\nPyErrPrint();\nfprintf(stderr, \"Failed to load \\\"%s\\\"\\n\", argv[1]);\nreturn 1;\n}\nif (PyFinalizeEx() < 0) {\nreturn 120;\n}\nreturn 0;\n}\n\nThis code loads a Python script using 'argv[1]', and calls the function\nnamed in 'argv[2]'.  Its integer arguments are the other values of the\n'argv' array.  If you *note compile and link: 4715. this program (let's\ncall the finished executable 'call'), and use it to execute a Python\nscript, such as:\n\ndef multiply(a,b):\nprint(\"Will compute\", a, \"times\", b)\nc = 0\nfor i in range(0, a):\nc = c + b\nreturn c\n\nthen the result should be:\n\n$ call multiply multiply 3 2\nWill compute 3 times 2\nResult of call: 6\n",
            "subsections": []
        },
        "Although the program is quite large for its functionality, most of the": {
            "content": "code is for data conversion between Python and C, and for error\nreporting.  The interesting part with respect to embedding Python starts\nwith\n\nPyInitialize();\npName = PyUnicodeDecodeFSDefault(argv[1]);\n/* Error checking of pName left out */\npModule = PyImportImport(pName);\n\nAfter initializing the interpreter, the script is loaded using *note",
            "subsections": []
        },
        "PyImportImport(): 1253.  This routine needs a Python string as its": {
            "content": "argument, which is constructed using the *note PyUnicodeFromString():\n4716. data conversion routine.\n\npFunc = PyObjectGetAttrString(pModule, argv[2]);\n/* pFunc is a new reference */\n\nif (pFunc && PyCallableCheck(pFunc)) {\n...\n}\nPyXDECREF(pFunc);\n",
            "subsections": []
        },
        "Once the script is loaded, the name we're looking for is retrieved using": {
            "content": "*note PyObjectGetAttrString(): 46b4.  If the name exists, and the\nobject returned is callable, you can safely assume that it is a\nfunction.  The program then proceeds by constructing a tuple of\narguments as normal.  The call to the Python function is then made with:\n\npValue = PyObjectCallObject(pFunc, pArgs);\n",
            "subsections": []
        },
        "Upon return of the function, 'pValue' is either 'NULL' or it contains a": {
            "content": "reference to the return value of the function.  Be sure to release the\nreference after examining the value.\n\nFile: python3.12.info,  Node: Extending Embedded Python,  Next: Embedding Python in C++,  Prev: Pure Embedding,  Up: Embedding Python in Another Application\n\n6.3.1.4 Extending Embedded Python\n.................................\n",
            "subsections": []
        },
        "Until now, the embedded Python interpreter had no access to": {
            "content": "functionality from the application itself.  The Python API allows this\nby extending the embedded interpreter.  That is, the embedded\ninterpreter gets extended with routines provided by the application.",
            "subsections": []
        },
        "While it sounds complex, it is not so bad.  Simply forget for a while": {
            "content": "that the application starts the Python interpreter.  Instead, consider\nthe application to be a set of subroutines, and write some glue code\nthat gives Python access to those routines, just like you would write a\nnormal Python extension.  For example:\n\nstatic int numargs=0;\n\n/* Return the number of arguments of the application command line */\nstatic PyObject*\nembnumargs(PyObject *self, PyObject *args)\n{\nif(!PyArgParseTuple(args, \":numargs\"))\nreturn NULL;\nreturn PyLongFromLong(numargs);\n}\n\nstatic PyMethodDef EmbMethods[] = {\n{\"numargs\", embnumargs, METHVARARGS,\n\"Return the number of arguments received by the process.\"},\n{NULL, NULL, 0, NULL}\n};\n\nstatic PyModuleDef EmbModule = {\nPyModuleDefHEADINIT, \"emb\", NULL, -1, EmbMethods,\nNULL, NULL, NULL, NULL\n};\n\nstatic PyObject*\nPyInitemb(void)\n{\nreturn PyModuleCreate(&EmbModule);\n}\n",
            "subsections": []
        },
        "Insert the above code just above the 'main()' function.  Also, insert": {
            "content": "the following two statements before the call to *note PyInitialize():\n6c2.:\n\nnumargs = argc;\nPyImportAppendInittab(\"emb\", &PyInitemb);\n",
            "subsections": []
        },
        "These two lines initialize the 'numargs' variable, and make the": {
            "content": "'emb.numargs()' function accessible to the embedded Python interpreter.",
            "subsections": []
        },
        "With these extensions, the Python script can do things like": {
            "content": "import emb\nprint(\"Number of arguments\", emb.numargs())\n",
            "subsections": []
        },
        "In a real application, the methods will expose an API of the application": {
            "content": "to Python.\n\nFile: python3.12.info,  Node: Embedding Python in C++,  Next: Compiling and Linking under Unix-like systems,  Prev: Extending Embedded Python,  Up: Embedding Python in Another Application\n\n6.3.1.5 Embedding Python in C++\n...............................\n\nIt is also possible to embed Python in a C++ program; precisely how this\nis done will depend on the details of the C++ system used; in general\nyou will need to write the main program in C++, and use the C++ compiler\nto compile and link your program.  There is no need to recompile Python\nitself using C++.\n\nFile: python3.12.info,  Node: Compiling and Linking under Unix-like systems,  Prev: Embedding Python in C++,  Up: Embedding Python in Another Application\n\n6.3.1.6 Compiling and Linking under Unix-like systems\n.....................................................\n",
            "subsections": []
        },
        "It is not necessarily trivial to find the right flags to pass to your": {
            "content": "compiler (and linker) in order to embed the Python interpreter into your\napplication, particularly because Python needs to load library modules\nimplemented as C dynamic extensions ('.so' files) linked against it.\n",
            "subsections": []
        },
        "To find out the required compiler and linker flags, you can execute the": {
            "content": "'python`X.Y'-config' script which is generated as part of the\ninstallation process (a 'python3-config' script may also be available).",
            "subsections": []
        },
        "This script has several options, of which the following will be directly": {
            "content": "useful to you:\n\n* 'pythonX.Y-config --cflags' will give you the recommended flags\nwhen compiling:\n\n$ /opt/bin/python3.11-config --cflags\n-I/opt/include/python3.11 -I/opt/include/python3.11 -Wsign-compare  -DNDEBUG -g -fwrapv -O3 -Wall\n\n* 'pythonX.Y-config --ldflags --embed' will give you the recommended\nflags when linking:\n\n$ /opt/bin/python3.11-config --ldflags --embed\n-L/opt/lib/python3.11/config-3.11-x8664-linux-gnu -L/opt/lib -lpython3.11 -lpthread -ldl  -lutil -lm\n\nNote: To avoid confusion between several Python installations (and\nespecially between the system Python and your own compiled Python),\nit is recommended that you use the absolute path to\n'python`X.Y'-config', as in the above example.\n",
            "subsections": []
        },
        "If this procedure doesn't work for you (it is not guaranteed to work for": {
            "content": "all Unix-like platforms; however, we welcome *note bug reports: 471c.)\nyou will have to read your system's documentation about dynamic linking\nand/or examine Python's 'Makefile' (use *note\nsysconfig.getmakefilefilename(): 406d. to find its location) and\ncompilation options.  In this case, the *note sysconfig: d5. module is a\nuseful tool to programmatically extract the configuration values that\nyou will want to combine together.  For example:\n\n>>> import sysconfig\n>>> sysconfig.getconfigvar('LIBS')\n'-lpthread -ldl  -lutil'\n>>> sysconfig.getconfigvar('LINKFORSHARED')\n'-Xlinker -export-dynamic'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python/C API Reference Manual,  Next: Installing Python Modules,  Prev: Extending and Embedding the Python Interpreter,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "7 Python/C API Reference Manual": {
            "content": "This manual documents the API used by C and C++ programmers who want to\nwrite extension modules or embed Python.  It is a companion to *note",
            "subsections": []
        },
        "Extending and Embedding the Python Interpreter: 195e, which describes": {
            "content": "the general principles of extension writing but does not document the\nAPI functions in detail.\n\n* Menu:\n\n* Introduction: Introduction<12>.\n* C API Stability::\n* The Very High Level Layer::\n* Reference Counting::\n* Exception Handling::\n* Utilities: Utilities<2>.\n* Abstract Objects Layer::\n* Concrete Objects Layer::\n* Initialization, Finalization, and Threads: Initialization Finalization and Threads.\n* Python Initialization Configuration::\n* Memory Management::\n* Object Implementation Support::\n* API and ABI Versioning::\n\nFile: python3.12.info,  Node: Introduction<12>,  Next: C API Stability,  Up: Python/C API Reference Manual\n",
            "subsections": [
                {
                    "name": "7.1 Introduction",
                    "content": "The Application Programmer's Interface to Python gives C and C++\nprogrammers access to the Python interpreter at a variety of levels.\nThe API is equally usable from C++, but for brevity it is generally\nreferred to as the Python/C API. There are two fundamentally different\nreasons for using the Python/C API. The first reason is to write\n'extension modules' for specific purposes; these are C modules that\nextend the Python interpreter.  This is probably the most common use."
                }
            ]
        },
        "The second reason is to use Python as a component in a larger": {
            "content": "application; this technique is generally referred to as 'embedding'\nPython in an application.\n",
            "subsections": []
        },
        "Writing an extension module is a relatively well-understood process,": {
            "content": "where a \"cookbook\" approach works well.  There are several tools that\nautomate the process to some extent.  While people have embedded Python\nin other applications since its early existence, the process of\nembedding Python is less straightforward than writing an extension.\n",
            "subsections": []
        },
        "Many API functions are useful independent of whether you're embedding or": {
            "content": "extending Python; moreover, most applications that embed Python will\nneed to provide a custom extension as well, so it's probably a good idea\nto become familiar with writing an extension before attempting to embed\nPython in a real application.\n\n* Menu:\n\n* Coding standards::\n* Include Files::\n* Useful macros::\n* Objects, Types and Reference Counts: Objects Types and Reference Counts.\n* Exceptions: Exceptions<21>.\n* Embedding Python: Embedding Python<2>.\n* Debugging Builds::\n\nFile: python3.12.info,  Node: Coding standards,  Next: Include Files,  Up: Introduction<12>\n\n",
            "subsections": []
        },
        "If you're writing C code for inclusion in CPython, you 'must' follow the": {
            "content": "guidelines and standards defined in PEP 7(1).  These guidelines apply\nregardless of the version of Python you are contributing to.  Following\nthese conventions is not necessary for your own third party extension\nmodules, unless you eventually expect to contribute them to Python.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0007/\n\nFile: python3.12.info,  Node: Include Files,  Next: Useful macros,  Prev: Coding standards,  Up: Introduction<12>\n\n",
            "subsections": []
        },
        "All function, type and macro definitions needed to use the Python/C API": {
            "content": "are included in your code by the following line:\n\n#define PYSSIZETCLEAN\n#include <Python.h>\n\nThis implies inclusion of the following standard headers: '<stdio.h>',\n'<string.h>', '<errno.h>', '<limits.h>', '<assert.h>' and '<stdlib.h>'\n(if available).\n\nNote: Since Python may define some pre-processor definitions which\naffect the standard headers on some systems, you 'must' include\n'Python.h' before any standard headers are included.\n\nIt is recommended to always define 'PYSSIZETCLEAN' before\nincluding 'Python.h'.  See *note Parsing arguments and building\nvalues: 6bc. for a description of this macro.\n",
            "subsections": []
        },
        "All user visible names defined by Python.h (except those defined by the": {
            "content": "included standard headers) have one of the prefixes 'Py' or 'Py'.",
            "subsections": []
        },
        "Names beginning with 'Py' are for internal use by the Python": {
            "content": "implementation and should not be used by extension writers.  Structure\nmember names do not have a reserved prefix.\n\nNote: User code should never define names that begin with 'Py' or\n'Py'.  This confuses the reader, and jeopardizes the portability\nof the user code to future Python versions, which may define\nadditional names beginning with one of these prefixes.\n",
            "subsections": []
        },
        "The header files are typically installed with Python.  On Unix, these": {
            "content": "are located in the directories '`prefix'/include/pythonversion/' and\n'`execprefix'/include/pythonversion/', where *note prefix: 1ae0. and\n*note execprefix: 1ae1. are defined by the corresponding parameters to\nPython's 'configure' script and 'version' is ''%d.%d' %\nsys.versioninfo[:2]'.  On Windows, the headers are installed in\n'`prefix'/include', where 'prefix' is the installation directory\nspecified to the installer.\n",
            "subsections": []
        },
        "To include the headers, place both directories (if different) on your": {
            "content": "compiler's search path for includes.  Do 'not' place the parent\ndirectories on the search path and then use '#include\n<pythonX.Y/Python.h>'; this will break on multi-platform builds since\nthe platform independent headers under *note prefix: 1ae0. include the\nplatform specific headers from *note execprefix: 1ae1.\n\nC++ users should note that although the API is defined entirely using C,\nthe header files properly declare the entry points to be 'extern \"C\"'.",
            "subsections": []
        },
        "As a result, there is no need to do anything special to use the API from": {
            "content": "C++.\n\nFile: python3.12.info,  Node: Useful macros,  Next: Objects Types and Reference Counts,  Prev: Include Files,  Up: Introduction<12>\n\n",
            "subsections": []
        },
        "Several useful macros are defined in the Python header files.  Many are": {
            "content": "defined closer to where they are useful (e.g.  *note PyRETURNNONE:\n12c8.).  Others of a more general utility are defined here.  This is not\nnecessarily a complete listing.\n\n-- C Macro: PyMODINITFUNC\n\nDeclare an extension module 'PyInit' initialization function.  The\nfunction return type is *note PyObject: 6b1.*.  The macro declares\nany special linkage declarations required by the platform, and for\nC++ declares the function as 'extern \"C\"'.\n\nThe initialization function must be named 'PyInitNAME', where\n'name' is the name of the module, and should be the only\nnon-'static' item defined in the module file.  Example:\n\nstatic struct PyModuleDef spammodule = {\nPyModuleDefHEADINIT,\n.mname = \"spam\",\n...\n};\n\nPyMODINITFUNC\nPyInitspam(void)\n{\nreturn PyModuleCreate(&spammodule);\n}\n\n-- C Macro: PyABS (x)\n\nReturn the absolute value of 'x'.\n\nNew in version 3.3.\n\n-- C Macro: PyALWAYSINLINE\n\nAsk the compiler to always inline a static inline function.  The\ncompiler can ignore it and decides to not inline the function.\n\nIt can be used to inline performance critical static inline\nfunctions when building Python in debug mode with function inlining\ndisabled.  For example, MSC disables function inlining when\nbuilding in debug mode.\n\nMarking blindly a static inline function with PyALWAYSINLINE can\nresult in worse performances (due to increased code size for\nexample).  The compiler is usually smarter than the developer for\nthe cost/benefit analysis.\n\nIf Python is *note built in debug mode: 67f. (if the *note\nPyDEBUG: 3dd3. macro is defined), the *note PyALWAYSINLINE:\n1619. macro does nothing.\n\nIt must be specified before the function return type.  Usage:\n\nstatic inline PyALWAYSINLINE int random(void) { return 4; }\n\nNew in version 3.11.\n\n-- C Macro: PyCHARMASK (c)\n\nArgument must be a character or an integer in the range [-128, 127]\nor [0, 255].  This macro returns 'c' cast to an 'unsigned char'.\n\n-- C Macro: PyDEPRECATED (version)\n\nUse this for deprecated declarations.  The macro must be placed\nbefore the symbol name.\n\nExample:\n\nPyDEPRECATED(3.8) PyAPIFUNC(int) PyOldFunction(void);\n\nChanged in version 3.8: MSVC support was added.\n\n-- C Macro: PyGETENV (s)\n\nLike 'getenv(s)', but returns 'NULL' if *note -E: 77e. was passed\non the command line (see *note PyConfig.useenvironment: 303.).\n\n-- C Macro: PyMAX (x, y)\n\nReturn the maximum value between 'x' and 'y'.\n\nNew in version 3.3.\n\n-- C Macro: PyMEMBERSIZE (type, member)\n\nReturn the size of a structure ('type') 'member' in bytes.\n\nNew in version 3.6.\n\n-- C Macro: PyMIN (x, y)\n\nReturn the minimum value between 'x' and 'y'.\n\nNew in version 3.3.\n\n-- C Macro: PyNOINLINE\n\nDisable inlining on a function.  For example, it reduces the C\nstack consumption: useful on LTO+PGO builds which heavily inline\ncode (see bpo-33720(1)).\n\nUsage:\n\nPyNOINLINE static int random(void) { return 4; }\n\nNew in version 3.11.\n\n-- C Macro: PySTRINGIFY (x)\n\nConvert 'x' to a C string.  E.g.  'PySTRINGIFY(123)' returns\n'\"123\"'.\n\nNew in version 3.4.\n\n-- C Macro: PyUNREACHABLE ()\n\nUse this when you have a code path that cannot be reached by\ndesign.  For example, in the 'default:' clause in a 'switch'\nstatement for which all possible values are covered in 'case'\nstatements.  Use this in places where you might be tempted to put\nan 'assert(0)' or 'abort()' call.\n\nIn release mode, the macro helps the compiler to optimize the code,\nand avoids a warning about unreachable code.  For example, the\nmacro is implemented with 'builtinunreachable()' on GCC in\nrelease mode.\n\nA use for 'PyUNREACHABLE()' is following a call a function that\nnever returns but that is not declared 'PyNORETURN'.\n\nIf a code path is very unlikely code but can be reached under\nexceptional case, this macro must not be used.  For example, under\nlow memory condition or if a system call returns a value out of the\nexpected range.  In this case, it's better to report the error to\nthe caller.  If the error cannot be reported to caller, *note\nPyFatalError(): 7a7. can be used.\n\nNew in version 3.7.\n\n-- C Macro: PyUNUSED (arg)\n\nUse this for unused arguments in a function definition to silence\ncompiler warnings.  Example: 'int func(int a, int PyUNUSED(b)) {\nreturn a; }'.\n\nNew in version 3.4.\n\n-- C Macro: PyDocSTRVAR (name, str)\n\nCreates a variable with name 'name' that can be used in docstrings.\nIf Python is built without docstrings, the value will be empty.\n\nUse *note PyDocSTRVAR: 16df. for docstrings to support building\nPython without docstrings, as specified in PEP 7(2).\n\nExample:\n\nPyDocSTRVAR(popdoc, \"Remove and return the rightmost element.\");\n\nstatic PyMethodDef dequemethods[] = {\n// ...\n{\"pop\", (PyCFunction)dequepop, METHNOARGS, popdoc},\n// ...\n}\n\n-- C Macro: PyDocSTR (str)\n\nCreates a docstring for the given input string or an empty string\nif docstrings are disabled.\n\nUse *note PyDocSTR: 1569. in specifying docstrings to support\nbuilding Python without docstrings, as specified in PEP 7(3).\n\nExample:\n\nstatic PyMethodDef pysqliterowmethods[] = {\n{\"keys\", (PyCFunction)pysqliterowkeys, METHNOARGS,\nPyDocSTR(\"Returns the keys of the row.\")},\n{NULL, NULL}\n};\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=33720\n\n(2) https://peps.python.org/pep-0007/\n\n(3) https://peps.python.org/pep-0007/\n\nFile: python3.12.info,  Node: Objects Types and Reference Counts,  Next: Exceptions<21>,  Prev: Useful macros,  Up: Introduction<12>\n\n",
            "subsections": []
        },
        "Most Python/C API functions have one or more arguments as well as a": {
            "content": "return value of type *note PyObject: 6b1.*.  This type is a pointer to\nan opaque data type representing an arbitrary Python object.  Since all",
            "subsections": []
        },
        "Python object types are treated the same way by the Python language in": {
            "content": "most situations (e.g., assignments, scope rules, and argument passing),\nit is only fitting that they should be represented by a single C type.",
            "subsections": []
        },
        "Almost all Python objects live on the heap: you never declare an": {
            "content": "automatic or static variable of type *note PyObject: 6b1, only pointer\nvariables of type *note PyObject: 6b1.* can be declared.  The sole\nexception are the type objects; since these must never be deallocated,\nthey are typically static *note PyTypeObject: 8da. objects.\n",
            "subsections": []
        },
        "All Python objects (even Python integers) have a 'type' and a 'reference": {
            "content": "count'.  An object's type determines what kind of object it is (e.g., an\ninteger, a list, or a user-defined function; there are many more as\nexplained in *note The standard type hierarchy: 1c05.).  For each of the\nwell-known types there is a macro to check whether an object is of that\ntype; for instance, 'PyListCheck(a)' is true if (and only if) the\nobject pointed to by 'a' is a Python list.\n\n* Menu:\n\n* Reference Counts: Reference Counts<2>.\n* Types::\n\nFile: python3.12.info,  Node: Reference Counts<2>,  Next: Types,  Up: Objects Types and Reference Counts\n\n7.1.4.1 Reference Counts\n........................\n",
            "subsections": []
        },
        "The reference count is important because today's computers have a finite": {
            "content": "(and often severely limited) memory size; it counts how many different\nplaces there are that have a *note strong reference: 57c. to an object.",
            "subsections": []
        },
        "Such a place could be another object, or a global (or static) C": {
            "content": "variable, or a local variable in some C function.  When the last *note\nstrong reference: 57c. to an object is released (i.e.  its reference\ncount becomes zero), the object is deallocated.  If it contains\nreferences to other objects, those references are released.  Those other\nobjects may be deallocated in turn, if there are no more references to\nthem, and so on.  (There's an obvious problem with objects that\nreference each other here; for now, the solution is \"don't do that.\")\n",
            "subsections": []
        },
        "Reference counts are always manipulated explicitly.  The normal way is": {
            "content": "to use the macro *note PyINCREF(): 2ce. to take a new reference to an\nobject (i.e.  increment its reference count by one), and *note",
            "subsections": []
        },
        "PyDECREF(): 2cf. to release that reference (i.e.  decrement the": {
            "content": "reference count by one).  The *note PyDECREF(): 2cf. macro is\nconsiderably more complex than the incref one, since it must check\nwhether the reference count becomes zero and then cause the object's\ndeallocator to be called.  The deallocator is a function pointer\ncontained in the object's type structure.  The type-specific deallocator\ntakes care of releasing references for other objects contained in the\nobject if this is a compound object type, such as a list, as well as\nperforming any additional finalization that's needed.  There's no chance\nthat the reference count can overflow; at least as many bits are used to\nhold the reference count as there are distinct memory locations in\nvirtual memory (assuming 'sizeof(Pyssizet) >= sizeof(void*)').  Thus,\nthe reference count increment is a simple operation.\n\nIt is not necessary to hold a *note strong reference: 57c. (i.e.\nincrement the reference count) for every local variable that contains a\npointer to an object.  In theory, the object's reference count goes up\nby one when the variable is made to point to it and it goes down by one\nwhen the variable goes out of scope.  However, these two cancel each\nother out, so at the end the reference count hasn't changed.  The only\nreal reason to use the reference count is to prevent the object from\nbeing deallocated as long as our variable is pointing to it.  If we know\nthat there is at least one other reference to the object that lives at\nleast as long as our variable, there is no need to take a new *note\nstrong reference: 57c. (i.e.  increment the reference count)\ntemporarily.  An important situation where this arises is in objects\nthat are passed as arguments to C functions in an extension module that\nare called from Python; the call mechanism guarantees to hold a\nreference to every argument for the duration of the call.\n",
            "subsections": []
        },
        "However, a common pitfall is to extract an object from a list and hold": {
            "content": "on to it for a while without taking a new reference.  Some other\noperation might conceivably remove the object from the list, releasing\nthat reference, and possibly deallocating it.  The real danger is that\ninnocent-looking operations may invoke arbitrary Python code which could\ndo this; there is a code path which allows control to flow back to the\nuser from a *note PyDECREF(): 2cf, so almost any operation is\npotentially dangerous.\n\nA safe approach is to always use the generic operations (functions whose\nname begins with 'PyObject', 'PyNumber', 'PySequence' or\n'PyMapping').  These operations always create a new *note strong\nreference: 57c. (i.e.  increment the reference count) of the object they\nreturn.  This leaves the caller with the responsibility to call *note",
            "subsections": []
        },
        "PyDECREF(): 2cf. when they are done with the result; this soon becomes": {
            "content": "second nature.\n\n* Menu:\n\n* Reference Count Details::\n\nFile: python3.12.info,  Node: Reference Count Details,  Up: Reference Counts<2>\n\n7.1.4.2 Reference Count Details\n...............................\n",
            "subsections": []
        },
        "The reference count behavior of functions in the Python/C API is best": {
            "content": "explained in terms of 'ownership of references'.  Ownership pertains to\nreferences, never to objects (objects are not owned: they are always\nshared).  \"Owning a reference\" means being responsible for calling",
            "subsections": []
        },
        "PyDECREF on it when the reference is no longer needed.  Ownership can": {
            "content": "also be transferred, meaning that the code that receives ownership of\nthe reference then becomes responsible for eventually releasing it by\ncalling *note PyDECREF(): 2cf. or *note PyXDECREF(): 57d. when it's no\nlonger needed--or passing on this responsibility (usually to its caller).",
            "subsections": []
        },
        "When a function passes ownership of a reference on to its caller, the": {
            "content": "caller is said to receive a 'new' reference.  When no ownership is\ntransferred, the caller is said to 'borrow' the reference.  Nothing\nneeds to be done for a *note borrowed reference: 4732.\n",
            "subsections": []
        },
        "Conversely, when a calling function passes in a reference to an object,": {
            "content": "there are two possibilities: the function 'steals' a reference to the\nobject, or it does not.  'Stealing a reference' means that when you pass\na reference to a function, that function assumes that it now owns that\nreference, and you are not responsible for it any longer.\n\nFew functions steal references; the two notable exceptions are *note\nPyListSetItem(): 46ba. and *note PyTupleSetItem(): 46b9, which steal a\nreference to the item (but not to the tuple or list into which the item\nis put!).  These functions were designed to steal a reference because of\na common idiom for populating a tuple or list with newly created\nobjects; for example, the code to create the tuple '(1, 2, \"three\")'\ncould look like this (forgetting about error handling for the moment; a\nbetter way to code this is shown below):\n\nPyObject *t;\n\nt = PyTupleNew(3);\nPyTupleSetItem(t, 0, PyLongFromLong(1L));\nPyTupleSetItem(t, 1, PyLongFromLong(2L));\nPyTupleSetItem(t, 2, PyUnicodeFromString(\"three\"));\n\nHere, *note PyLongFromLong(): 159c. returns a new reference which is\nimmediately stolen by *note PyTupleSetItem(): 46b9.  When you want to\nkeep using an object although the reference to it will be stolen, use\n*note PyINCREF(): 2ce. to grab another reference before calling the\nreference-stealing function.\n\nIncidentally, *note PyTupleSetItem(): 46b9. is the 'only' way to set\ntuple items; *note PySequenceSetItem(): 17d5. and *note",
            "subsections": []
        },
        "PyObjectSetItem(): 4733. refuse to do this since tuples are an": {
            "content": "immutable data type.  You should only use *note PyTupleSetItem(): 46b9.\nfor tuples that you are creating yourself.\n\nEquivalent code for populating a list can be written using *note\nPyListNew(): 4734. and *note PyListSetItem(): 46ba.\n",
            "subsections": []
        },
        "However, in practice, you will rarely use these ways of creating and": {
            "content": "populating a tuple or list.  There's a generic function, *note",
            "subsections": []
        },
        "PyBuildValue(): 6bb, that can create most common objects from C values,": {
            "content": "directed by a 'format string'.  For example, the above two blocks of\ncode could be replaced by the following (which also takes care of the\nerror checking):\n\nPyObject *tuple, *list;\n\ntuple = PyBuildValue(\"(iis)\", 1, 2, \"three\");\nlist = PyBuildValue(\"[iis]\", 1, 2, \"three\");\n\nIt is much more common to use *note PyObjectSetItem(): 4733. and\nfriends with items whose references you are only borrowing, like\narguments that were passed in to the function you are writing.  In that\ncase, their behaviour regarding references is much saner, since you\ndon't have to take a new reference just so you can give that reference\naway (\"have it be stolen\").  For example, this function sets all items\nof a list (actually, any mutable sequence) to a given item:\n\nint\nsetall(PyObject *target, PyObject *item)\n{\nPyssizet i, n;\n\nn = PyObjectLength(target);\nif (n < 0)\nreturn -1;\nfor (i = 0; i < n; i++) {\nPyObject *index = PyLongFromSsizet(i);\nif (!index)\nreturn -1;\nif (PyObjectSetItem(target, index, item) < 0) {\nPyDECREF(index);\nreturn -1;\n}\nPyDECREF(index);\n}\nreturn 0;\n}\n",
            "subsections": []
        },
        "The situation is slightly different for function return values.  While": {
            "content": "passing a reference to most functions does not change your ownership\nresponsibilities for that reference, many functions that return a\nreference to an object give you ownership of the reference.  The reason\nis simple: in many cases, the returned object is created on the fly, and\nthe reference you get is the only reference to the object.  Therefore,\nthe generic functions that return object references, like *note\nPyObjectGetItem(): 4735. and *note PySequenceGetItem(): 17d4, always\nreturn a new reference (the caller becomes the owner of the reference).\n",
            "subsections": []
        },
        "It is important to realize that whether you own a reference returned by": {
            "content": "a function depends on which function you call only -- 'the plumage' (the\ntype of the object passed as an argument to the function) 'doesn't enter\ninto it!'  Thus, if you extract an item from a list using *note",
            "subsections": []
        },
        "PyListGetItem(): 46b6, you don't own the reference -- but if you obtain": {
            "content": "the same item from the same list using *note PySequenceGetItem(): 17d4.\n(which happens to take exactly the same arguments), you do own a\nreference to the returned object.\n",
            "subsections": []
        },
        "Here is an example of how you could write a function that computes the": {
            "content": "sum of the items in a list of integers; once using *note\nPyListGetItem(): 46b6, and once using *note PySequenceGetItem(): 17d4.\n\nlong\nsumlist(PyObject *list)\n{\nPyssizet i, n;\nlong total = 0, value;\nPyObject *item;\n\nn = PyListSize(list);\nif (n < 0)\nreturn -1; /* Not a list */\nfor (i = 0; i < n; i++) {\nitem = PyListGetItem(list, i); /* Can't fail */\nif (!PyLongCheck(item)) continue; /* Skip non-integers */\nvalue = PyLongAsLong(item);\nif (value == -1 && PyErrOccurred())\n/* Integer too big to fit in a C long, bail out */\nreturn -1;\ntotal += value;\n}\nreturn total;\n}\n\nlong\nsumsequence(PyObject *sequence)\n{\nPyssizet i, n;\nlong total = 0, value;\nPyObject *item;\nn = PySequenceLength(sequence);\nif (n < 0)\nreturn -1; /* Has no length */\nfor (i = 0; i < n; i++) {\nitem = PySequenceGetItem(sequence, i);\nif (item == NULL)\nreturn -1; /* Not a sequence, or other failure */\nif (PyLongCheck(item)) {\nvalue = PyLongAsLong(item);\nPyDECREF(item);\nif (value == -1 && PyErrOccurred())\n/* Integer too big to fit in a C long, bail out */\nreturn -1;\ntotal += value;\n}\nelse {\nPyDECREF(item); /* Discard reference ownership */\n}\n}\nreturn total;\n}\n\nFile: python3.12.info,  Node: Types,  Prev: Reference Counts<2>,  Up: Objects Types and Reference Counts\n\n7.1.4.3 Types\n.............\n",
            "subsections": []
        },
        "There are few other data types that play a significant role in the": {
            "content": "",
            "subsections": []
        },
        "Python/C API; most are simple C types such as int, long, double and": {
            "content": "char*.  A few structure types are used to describe static tables used to\nlist the functions exported by a module or the data attributes of a new\nobject type, and another is used to describe the value of a complex\nnumber.  These will be discussed together with the functions that use\nthem.\n\n-- C Type: type Pyssizet\n' Part of the *note Stable ABI: 2ac.'  A signed integral type such\nthat 'sizeof(Pyssizet) == sizeof(sizet)'.  C99 doesn't define\nsuch a thing directly (sizet is an unsigned integral type).  See\nPEP 353(1) for details.  'PYSSIZETMAX' is the largest positive\nvalue of type *note Pyssizet: 88d.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0353/\n\nFile: python3.12.info,  Node: Exceptions<21>,  Next: Embedding Python<2>,  Prev: Objects Types and Reference Counts,  Up: Introduction<12>\n\n",
            "subsections": []
        },
        "The Python programmer only needs to deal with exceptions if specific": {
            "content": "error handling is required; unhandled exceptions are automatically\npropagated to the caller, then to the caller's caller, and so on, until\nthey reach the top-level interpreter, where they are reported to the\nuser accompanied by a stack traceback.\n\nFor C programmers, however, error checking always has to be explicit.",
            "subsections": []
        },
        "All functions in the Python/C API can raise exceptions, unless an": {
            "content": "explicit claim is made otherwise in a function's documentation.  In\ngeneral, when a function encounters an error, it sets an exception,\ndiscards any object references that it owns, and returns an error\nindicator.  If not documented otherwise, this indicator is either 'NULL'\nor '-1', depending on the function's return type.  A few functions\nreturn a Boolean true/false result, with false indicating an error.",
            "subsections": []
        },
        "Very few functions return no explicit error indicator or have an": {
            "content": "ambiguous return value, and require explicit testing for errors with\n*note PyErrOccurred(): 1656.  These exceptions are always explicitly\ndocumented.\n",
            "subsections": []
        },
        "Exception state is maintained in per-thread storage (this is equivalent": {
            "content": "to using global storage in an unthreaded application).  A thread can be\nin one of two states: an exception has occurred, or not.  The function\n*note PyErrOccurred(): 1656. can be used to check for this: it returns\na borrowed reference to the exception type object when an exception has\noccurred, and 'NULL' otherwise.  There are a number of functions to set\nthe exception state: *note PyErrSetString(): 2de. is the most common\n(though not the most general) function to set the exception state, and\n*note PyErrClear(): ea8. clears the exception state.\n",
            "subsections": []
        },
        "The full exception state consists of three objects (all of which can be": {
            "content": "'NULL'): the exception type, the corresponding exception value, and the\ntraceback.  These have the same meanings as the Python result of\n'sys.excinfo()'; however, they are not the same: the Python objects\nrepresent the last exception being handled by a Python *note try: 4bc. ...\n*note except: 379. statement, while the C level exception state only\nexists while an exception is being passed on between C functions until\nit reaches the Python bytecode interpreter's main loop, which takes care\nof transferring it to 'sys.excinfo()' and friends.\n",
            "subsections": []
        },
        "Note that starting with Python 1.5, the preferred, thread-safe way to": {
            "content": "access the exception state from Python code is to call the function\n*note sys.excinfo(): 456, which returns the per-thread exception state\nfor Python code.  Also, the semantics of both ways to access the\nexception state have changed so that a function which catches an\nexception will save and restore its thread's exception state so as to\npreserve the exception state of its caller.  This prevents common bugs\nin exception handling code caused by an innocent-looking function\noverwriting the exception being handled; it also reduces the often\nunwanted lifetime extension for objects that are referenced by the stack\nframes in the traceback.\n",
            "subsections": []
        },
        "As a general principle, a function that calls another function to": {
            "content": "perform some task should check whether the called function raised an\nexception, and if so, pass the exception state on to its caller.  It\nshould discard any object references that it owns, and return an error\nindicator, but it should 'not' set another exception -- that would\noverwrite the exception that was just raised, and lose important\ninformation about the exact cause of the error.\n\nA simple example of detecting exceptions and passing them on is shown in\nthe 'sumsequence()' example above.  It so happens that this example\ndoesn't need to clean up any owned references when it detects an error.",
            "subsections": []
        },
        "The following example function shows some error cleanup.  First, to": {
            "content": "remind you why you like Python, we show the equivalent Python code:\n\ndef incritem(dict, key):\ntry:\nitem = dict[key]\nexcept KeyError:\nitem = 0\ndict[key] = item + 1\n\nHere is the corresponding C code, in all its glory:\n\nint\nincritem(PyObject *dict, PyObject *key)\n{\n/* Objects all initialized to NULL for PyXDECREF */\nPyObject *item = NULL, *constone = NULL, *incrementeditem = NULL;\nint rv = -1; /* Return value initialized to -1 (failure) */\n\nitem = PyObjectGetItem(dict, key);\nif (item == NULL) {\n/* Handle KeyError only: */\nif (!PyErrExceptionMatches(PyExcKeyError))\ngoto error;\n\n/* Clear the error and use zero: */\nPyErrClear();\nitem = PyLongFromLong(0L);\nif (item == NULL)\ngoto error;\n}\nconstone = PyLongFromLong(1L);\nif (constone == NULL)\ngoto error;\n\nincrementeditem = PyNumberAdd(item, constone);\nif (incrementeditem == NULL)\ngoto error;\n\nif (PyObjectSetItem(dict, key, incrementeditem) < 0)\ngoto error;\nrv = 0; /* Success */\n/* Continue with cleanup code */\n\nerror:\n/* Cleanup code, shared by success and failure path */\n\n/* Use PyXDECREF() to ignore NULL references */\nPyXDECREF(item);\nPyXDECREF(constone);\nPyXDECREF(incrementeditem);\n\nreturn rv; /* -1 for error, 0 for success */\n}\n\nThis example represents an endorsed use of the 'goto' statement in C! It\nillustrates the use of *note PyErrExceptionMatches(): 473a. and *note\nPyErrClear(): ea8. to handle specific exceptions, and the use of *note",
            "subsections": []
        },
        "PyXDECREF(): 57d. to dispose of owned references that may be 'NULL'": {
            "content": "(note the ''X'' in the name; *note PyDECREF(): 2cf. would crash when\nconfronted with a 'NULL' reference).  It is important that the variables\nused to hold owned references are initialized to 'NULL' for this to\nwork; likewise, the proposed return value is initialized to '-1'\n(failure) and only set to success after the final call made is\nsuccessful.\n\nFile: python3.12.info,  Node: Embedding Python<2>,  Next: Debugging Builds,  Prev: Exceptions<21>,  Up: Introduction<12>\n\n",
            "subsections": []
        },
        "The one important task that only embedders (as opposed to extension": {
            "content": "writers) of the Python interpreter have to worry about is the\ninitialization, and possibly the finalization, of the Python\ninterpreter.  Most functionality of the interpreter can only be used\nafter the interpreter has been initialized.\n\nThe basic initialization function is *note PyInitialize(): 6c2.  This\ninitializes the table of loaded modules, and creates the fundamental\nmodules *note builtins: 10, *note main: 1, and *note sys: d3.  It\nalso initializes the module search path ('sys.path').\n\n*note PyInitialize(): 6c2. does not set the \"script argument list\"\n('sys.argv').  If this variable is needed by Python code that will be\nexecuted later, setting *note PyConfig.argv: 168d. and *note\nPyConfig.parseargv: 168e. must be set: see *note Python Initialization\nConfiguration: 581.\n",
            "subsections": []
        },
        "On most systems (in particular, on Unix and Windows, although the": {
            "content": "details are slightly different), *note PyInitialize(): 6c2. calculates\nthe module search path based upon its best guess for the location of the\nstandard Python interpreter executable, assuming that the Python library\nis found in a fixed location relative to the Python interpreter\nexecutable.  In particular, it looks for a directory named\n'lib/python`X.Y'' relative to the parent directory where the executable\nnamed 'python' is found on the shell command search path (the\nenvironment variable 'PATH').\n",
            "subsections": []
        },
        "For instance, if the Python executable is found in": {
            "content": "'/usr/local/bin/python', it will assume that the libraries are in\n'/usr/local/lib/python`X.Y''.  (In fact, this particular path is also\nthe \"fallback\" location, used when no executable file named 'python' is\nfound along 'PATH'.)  The user can override this behavior by setting the\nenvironment variable *note PYTHONHOME: 334, or insert additional\ndirectories in front of the standard path by setting *note PYTHONPATH:\ne92.\n",
            "subsections": []
        },
        "The embedding application can steer the search by calling": {
            "content": "'PySetProgramName(file)' 'before' calling *note PyInitialize(): 6c2.\nNote that *note PYTHONHOME: 334. still overrides this and *note\nPYTHONPATH: e92. is still inserted in front of the standard path.  An\napplication that requires total control has to provide its own\nimplementation of *note PyGetPath(): 32b, *note PyGetPrefix(): 32d,\n*note PyGetExecPrefix(): 329, and *note PyGetProgramFullPath(): 32f.\n(all defined in 'Modules/getpath.c').\n\nSometimes, it is desirable to \"uninitialize\" Python.  For instance, the\napplication may want to start over (make another call to *note",
            "subsections": []
        },
        "PyInitialize(): 6c2.) or the application is simply done with its use of": {
            "content": "",
            "subsections": []
        },
        "Python and wants to free memory allocated by Python.  This can be": {
            "content": "accomplished by calling *note PyFinalizeEx(): b67.  The function *note",
            "subsections": []
        },
        "PyIsInitialized(): 473d. returns true if Python is currently in the": {
            "content": "initialized state.  More information about these functions is given in a\nlater chapter.  Notice that *note PyFinalizeEx(): b67. does 'not' free\nall memory allocated by the Python interpreter, e.g.  memory allocated\nby extension modules currently cannot be released.\n\nFile: python3.12.info,  Node: Debugging Builds,  Prev: Embedding Python<2>,  Up: Introduction<12>\n\n",
            "subsections": []
        },
        "Python can be built with several macros to enable extra checks of the": {
            "content": "interpreter and extension modules.  These checks tend to add a large\namount of overhead to the runtime so they are not enabled by default.\n\nA full list of the various types of debugging builds is in the file\n'Misc/SpecialBuilds.txt' in the Python source distribution.  Builds are\navailable that support tracing of reference counts, debugging the memory\nallocator, or low-level profiling of the main interpreter loop.  Only\nthe most frequently used builds will be described in the remainder of\nthis section.\n\n-- C Macro: PyDEBUG\n",
            "subsections": []
        },
        "Compiling the interpreter with the 'PyDEBUG' macro defined produces": {
            "content": "what is generally meant by *note a debug build of Python: 67f.\n'PyDEBUG' is enabled in the Unix build by adding *note -with-pydebug:\n1b04. to the './configure' command.  It is also implied by the presence\nof the not-Python-specific 'DEBUG' macro.  When 'PyDEBUG' is enabled\nin the Unix build, compiler optimization is disabled.\n",
            "subsections": []
        },
        "In addition to the reference count debugging described below, extra": {
            "content": "checks are performed, see *note Python Debug Build: 67f.\n\nDefining 'PyTRACEREFS' enables reference tracing (see the *note\nconfigure -with-trace-refs option: 6b2.).  When defined, a circular\ndoubly linked list of active objects is maintained by adding two extra\nfields to every *note PyObject: 6b1.  Total allocations are tracked as\nwell.  Upon exit, all existing references are printed.  (In interactive\nmode this happens after every statement run by the interpreter.)\n",
            "subsections": []
        },
        "Please refer to 'Misc/SpecialBuilds.txt' in the Python source": {
            "content": "distribution for more detailed information.\n\nFile: python3.12.info,  Node: C API Stability,  Next: The Very High Level Layer,  Prev: Introduction<12>,  Up: Python/C API Reference Manual\n",
            "subsections": [
                {
                    "name": "7.2 C API Stability",
                    "content": ""
                }
            ]
        },
        "Unless documented otherwise, Python's C API is covered by the Backwards": {
            "content": "",
            "subsections": []
        },
        "Compatibility Policy, PEP 387(1).  Most changes to it are": {
            "content": "source-compatible (typically by only adding new API). Changing existing\nAPI or removing API is only done after a deprecation period or to fix\nserious issues.\n\nCPython's Application Binary Interface (ABI) is forward- and\nbackwards-compatible across a minor release (if these are compiled the\nsame way; see *note Platform Considerations: 4742. below).  So, code\ncompiled for Python 3.10.0 will work on 3.10.8 and vice versa, but will\nneed to be compiled separately for 3.9.x and 3.11.x.\n\nThere are two tiers of C API with different stability expectations:\n\n- *note Unstable API: 29f, may change in minor versions without a\ndeprecation period.  It is marked by the 'PyUnstable' prefix in\nnames.\n\n- *note Limited API: 2a8, is compatible across several minor\nreleases.  When *note PyLIMITEDAPI: 586. is defined, only this\nsubset is exposed from 'Python.h'.\n\nThese are discussed in more detail below.\n",
            "subsections": []
        },
        "Names prefixed by an underscore, such as 'PyInternalState', are": {
            "content": "private API that can change without notice even in patch releases.  If\nyou need to use this API, consider reaching out to CPython developers(2)\nto discuss adding public API for your use case.\n\n* Menu:\n\n* Unstable C API::\n* Stable Application Binary Interface::\n* Platform Considerations::\n* Contents of Limited API::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0387/\n\n(2) https://discuss.python.org/c/core-dev/c-api/30\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Unstable C API,  Next: Stable Application Binary Interface,  Up: C API Stability": {
            "content": "",
            "subsections": []
        },
        "Any API named with the 'PyUnstable' prefix exposes CPython": {
            "content": "implementation details, and may change in every minor release (e.g.\nfrom 3.9 to 3.10) without any deprecation warnings.  However, it will\nnot change in a bugfix release (e.g.  from 3.10.0 to 3.10.1).\n",
            "subsections": []
        },
        "It is generally intended for specialized, low-level tools like": {
            "content": "debuggers.\n",
            "subsections": []
        },
        "Projects that use this API are expected to follow CPython development": {
            "content": "and spend extra effort adjusting to changes.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Stable Application Binary Interface,  Next: Platform Considerations,  Prev: Unstable C API,  Up: C API Stability": {
            "content": "",
            "subsections": []
        },
        "For simplicity, this document talks about 'extensions', but the Limited": {
            "content": "API and Stable ABI work the same way for all uses of the API - for\nexample, embedding Python.\n\n* Menu:\n\n* Limited C API::\n* Stable ABI::\n* Limited API Scope and Performance::\n* Limited API Caveats::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Limited C API,  Next: Stable ABI,  Up: Stable Application Binary Interface": {
            "content": "7.2.2.1 Limited C API\n.....................\n\nPython 3.2 introduced the 'Limited API', a subset of Python's C API.",
            "subsections": []
        },
        "Extensions that only use the Limited API can be compiled once and work": {
            "content": "with multiple versions of Python.  Contents of the Limited API are *note\nlisted below: 58b.\n\n-- C Macro: PyLIMITEDAPI\n\nDefine this macro before including 'Python.h' to opt in to only use\nthe Limited API, and to select the Limited API version.\n\nDefine 'PyLIMITEDAPI' to the value of *note PYVERSIONHEX: 53e.\ncorresponding to the lowest Python version your extension supports.\nThe extension will work without recompilation with all Python 3\nreleases from the specified one onward, and can use Limited API\nintroduced up to that version.\n\nRather than using the 'PYVERSIONHEX' macro directly, hardcode a\nminimum minor version (e.g.  '0x030A0000' for Python 3.10) for\nstability when compiling with future Python versions.\n\nYou can also define 'PyLIMITEDAPI' to '3'.  This works the same\nas '0x03020000' (Python 3.2, the version that introduced Limited\nAPI).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Stable ABI,  Next: Limited API Scope and Performance,  Prev: Limited C API,  Up: Stable Application Binary Interface": {
            "content": "7.2.2.2 Stable ABI\n..................\n",
            "subsections": []
        },
        "To enable this, Python provides a 'Stable ABI': a set of symbols that": {
            "content": "will remain compatible across Python 3.x versions.\n\nThe Stable ABI contains symbols exposed in the *note Limited API: 2a8,\nbut also other ones - for example, functions necessary to support older\nversions of the Limited API.\n",
            "subsections": []
        },
        "On Windows, extensions that use the Stable ABI should be linked against": {
            "content": "'python3.dll' rather than a version-specific library such as\n'python39.dll'.\n",
            "subsections": []
        },
        "On some platforms, Python will look for and load shared library files": {
            "content": "named with the 'abi3' tag (e.g.  'mymodule.abi3.so').  It does not check\nif such extensions conform to a Stable ABI. The user (or their packaging\ntools) need to ensure that, for example, extensions built with the 3.10+\nLimited API are not installed for lower versions of Python.\n",
            "subsections": []
        },
        "All functions in the Stable ABI are present as functions in Python's": {
            "content": "shared library, not solely as macros.  This makes them usable from\nlanguages that don't use the C preprocessor.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Limited API Scope and Performance,  Next: Limited API Caveats,  Prev: Stable ABI,  Up: Stable Application Binary Interface": {
            "content": "7.2.2.3 Limited API Scope and Performance\n.........................................\n",
            "subsections": []
        },
        "The goal for the Limited API is to allow everything that is possible": {
            "content": "with the full C API, but possibly with a performance penalty.\n\nFor example, while *note PyListGetItem(): 46b6. is available, its\n\"unsafe\" macro variant *note PyListGETITEM(): 4749. is not.  The macro\ncan be faster because it can rely on version-specific implementation\ndetails of the list object.\n",
            "subsections": []
        },
        "Without 'PyLIMITEDAPI' defined, some C API functions are inlined or": {
            "content": "replaced by macros.  Defining 'PyLIMITEDAPI' disables this inlining,\nallowing stability as Python's data structures are improved, but\npossibly reducing performance.\n",
            "subsections": []
        },
        "By leaving out the 'PyLIMITEDAPI' definition, it is possible to": {
            "content": "compile a Limited API extension with a version-specific ABI. This can\nimprove performance for that Python version, but will limit\ncompatibility.  Compiling with 'PyLIMITEDAPI' will then yield an\nextension that can be distributed where a version-specific one is not\navailable - for example, for prereleases of an upcoming Python version.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Limited API Caveats,  Prev: Limited API Scope and Performance,  Up: Stable Application Binary Interface": {
            "content": "7.2.2.4 Limited API Caveats\n...........................\n",
            "subsections": []
        },
        "Note that compiling with 'PyLIMITEDAPI' is 'not' a complete guarantee": {
            "content": "that code conforms to the *note Limited API: 2a8. or the *note Stable\nABI: 4747.  'PyLIMITEDAPI' only covers definitions, but an API also\nincludes other issues, such as expected semantics.\n",
            "subsections": []
        },
        "One issue that 'PyLIMITEDAPI' does not guard against is calling a": {
            "content": "function with arguments that are invalid in a lower Python version.  For\nexample, consider a function that starts accepting 'NULL' for an\nargument.  In Python 3.9, 'NULL' now selects a default behavior, but in",
            "subsections": []
        },
        "Python 3.8, the argument will be used directly, causing a 'NULL'": {
            "content": "dereference and crash.  A similar argument works for fields of structs.\n",
            "subsections": []
        },
        "Another issue is that some struct fields are currently not hidden when": {
            "content": "'PyLIMITEDAPI' is defined, even though they're part of the Limited\nAPI.\n",
            "subsections": []
        },
        "For these reasons, we recommend testing an extension with 'all' minor": {
            "content": "",
            "subsections": []
        },
        "Python versions it supports, and preferably to build with the 'lowest'": {
            "content": "such version.\n",
            "subsections": []
        },
        "We also recommend reviewing documentation of all used API to check if it": {
            "content": "is explicitly part of the Limited API. Even with 'PyLIMITEDAPI'\ndefined, a few private declarations are exposed for technical reasons\n(or even unintentionally, as bugs).\n",
            "subsections": []
        },
        "Also note that the Limited API is not necessarily stable: compiling with": {
            "content": "'PyLIMITEDAPI' with Python 3.8 means that the extension will run with",
            "subsections": []
        },
        "Python 3.12, but it will not necessarily 'compile' with Python 3.12.  In": {
            "content": "particular, parts of the Limited API may be deprecated and removed,\nprovided that the Stable ABI stays stable.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Platform Considerations,  Next: Contents of Limited API,  Prev: Stable Application Binary Interface,  Up: C API Stability": {
            "content": "ABI stability depends not only on Python, but also on the compiler used,\nlower-level libraries and compiler options.  For the purposes of the\n*note Stable ABI: 4747, these details define a \"platform\".  They usually\ndepend on the OS type and processor architecture\n",
            "subsections": []
        },
        "It is the responsibility of each particular distributor of Python to": {
            "content": "ensure that all Python versions on a particular platform are built in a\nway that does not break the Stable ABI. This is the case with Windows\nand macOS releases from 'python.org' and many third-party distributors.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Contents of Limited API,  Prev: Platform Considerations,  Up: C API Stability": {
            "content": "Currently, the *note Limited API: 2a8. includes the following items:\n\n* *note PYVECTORCALLARGUMENTSOFFSET: 2b8.\n\n* *note PyAIterCheck(): 474d.\n\n* *note PyArgParse(): 1757.\n\n* *note PyArgParseTuple(): 2d1.\n\n* *note PyArgParseTupleAndKeywords(): b68.\n\n* *note PyArgUnpackTuple(): 1362.\n\n* *note PyArgVaParse(): 474e.\n\n* *note PyArgVaParseTupleAndKeywords(): 12cb.\n\n* *note PyArgValidateKeywordArguments(): 474f.\n\n* 'PyBaseObjectType'\n\n* *note PyBoolFromLong(): 4750.\n\n* *note PyBoolType: 4751.\n\n* *note PyBufferFillContiguousStrides(): 548.\n\n* *note PyBufferFillInfo(): 549.\n\n* *note PyBufferFromContiguous(): 545.\n\n* *note PyBufferGetPointer(): 542.\n\n* *note PyBufferIsContiguous(): 547.\n\n* *note PyBufferRelease(): 54a.\n\n* *note PyBufferSizeFromFormat(): 543.\n\n* *note PyBufferToContiguous(): 544.\n\n* 'PyByteArrayIterType'\n\n* *note PyByteArrayAsString(): 4752.\n\n* *note PyByteArrayConcat(): 4753.\n\n* *note PyByteArrayFromObject(): 120b.\n\n* *note PyByteArrayFromStringAndSize(): 120c.\n\n* *note PyByteArrayResize(): 4754.\n\n* *note PyByteArraySize(): 4755.\n\n* *note PyByteArrayType: 4756.\n\n* 'PyBytesIterType'\n\n* *note PyBytesAsString(): 695.\n\n* *note PyBytesAsStringAndSize(): 4757.\n\n* *note PyBytesConcat(): 4758.\n\n* *note PyBytesConcatAndDel(): 4759.\n\n* 'PyBytesDecodeEscape()'\n\n* *note PyBytesFromFormat(): 17a1.\n\n* *note PyBytesFromFormatV(): 475a.\n\n* *note PyBytesFromObject(): 475b.\n\n* *note PyBytesFromString(): 475c.\n\n* *note PyBytesFromStringAndSize(): 120a.\n\n* 'PyBytesRepr()'\n\n* *note PyBytesSize(): 475d.\n\n* *note PyBytesType: 475e.\n\n* *note PyCFunction: 12cd.\n\n* *note PyCFunctionWithKeywords: 475f.\n\n* 'PyCFunctionCall()'\n\n* 'PyCFunctionGetFlags()'\n\n* 'PyCFunctionGetFunction()'\n\n* 'PyCFunctionGetSelf()'\n\n* *note PyCFunctionNew(): 1658.\n\n* *note PyCFunctionNewEx(): 16fb.\n\n* 'PyCFunctionType'\n\n* *note PyCMethodNew(): 1652.\n\n* *note PyCallIterNew(): 4760.\n\n* *note PyCallIterType: 4761.\n\n* *note PyCallableCheck(): 4762.\n\n* *note PyCapsuleDestructor: 4763.\n\n* *note PyCapsuleGetContext(): 4764.\n\n* *note PyCapsuleGetDestructor(): 4765.\n\n* *note PyCapsuleGetName(): 4766.\n\n* *note PyCapsuleGetPointer(): 4767.\n\n* *note PyCapsuleImport(): 15cf.\n\n* *note PyCapsuleIsValid(): 11d0.\n\n* *note PyCapsuleNew(): 46c4.\n\n* *note PyCapsuleSetContext(): 4768.\n\n* *note PyCapsuleSetDestructor(): 4769.\n\n* *note PyCapsuleSetName(): 476a.\n\n* *note PyCapsuleSetPointer(): 476b.\n\n* 'PyCapsuleType'\n\n* 'PyClassMethodDescrType'\n\n* *note PyCodecBackslashReplaceErrors(): 476c.\n\n* *note PyCodecDecode(): 33f.\n\n* *note PyCodecDecoder(): 476d.\n\n* *note PyCodecEncode(): 340.\n\n* *note PyCodecEncoder(): 476e.\n\n* *note PyCodecIgnoreErrors(): 476f.\n\n* *note PyCodecIncrementalDecoder(): 4770.\n\n* *note PyCodecIncrementalEncoder(): 4771.\n\n* *note PyCodecKnownEncoding(): 4772.\n\n* *note PyCodecLookupError(): 4773.\n\n* *note PyCodecNameReplaceErrors(): d14.\n\n* *note PyCodecRegister(): 4774.\n\n* *note PyCodecRegisterError(): 4775.\n\n* *note PyCodecReplaceErrors(): 4776.\n\n* *note PyCodecStreamReader(): 4777.\n\n* *note PyCodecStreamWriter(): 4778.\n\n* *note PyCodecStrictErrors(): 4779.\n\n* *note PyCodecUnregister(): 6a6.\n\n* *note PyCodecXMLCharRefReplaceErrors(): 477a.\n\n* *note PyComplexFromDoubles(): 477b.\n\n* *note PyComplexImagAsDouble(): 477c.\n\n* *note PyComplexRealAsDouble(): 477d.\n\n* *note PyComplexType: 477e.\n\n* *note PyDescrNewClassMethod(): 477f.\n\n* *note PyDescrNewGetSet(): 4780.\n\n* *note PyDescrNewMember(): 4781.\n\n* *note PyDescrNewMethod(): 16fa.\n\n* 'PyDictItemsType'\n\n* 'PyDictIterItemType'\n\n* 'PyDictIterKeyType'\n\n* 'PyDictIterValueType'\n\n* 'PyDictKeysType'\n\n* *note PyDictProxyNew(): 4782.\n\n* 'PyDictProxyType'\n\n* 'PyDictRevIterItemType'\n\n* 'PyDictRevIterKeyType'\n\n* 'PyDictRevIterValueType'\n\n* 'PyDictValuesType'\n\n* *note PyDictClear(): 4783.\n\n* *note PyDictContains(): 4784.\n\n* *note PyDictCopy(): 4785.\n\n* *note PyDictDelItem(): 4786.\n\n* *note PyDictDelItemString(): 4787.\n\n* *note PyDictGetItem(): 6bf.\n\n* *note PyDictGetItemString(): 46b7.\n\n* *note PyDictGetItemWithError(): 4788.\n\n* *note PyDictItems(): 4789.\n\n* *note PyDictKeys(): 478a.\n\n* *note PyDictMerge(): 478b.\n\n* *note PyDictMergeFromSeq2(): 478c.\n\n* *note PyDictNew(): 478d.\n\n* *note PyDictNext(): 478e.\n\n* *note PyDictSetItem(): 46bb.\n\n* *note PyDictSetItemString(): 478f.\n\n* *note PyDictSize(): 4790.\n\n* *note PyDictType: 4791.\n\n* *note PyDictUpdate(): 4792.\n\n* *note PyDictValues(): 4793.\n\n* 'PyEllipsisType'\n\n* 'PyEnumType'\n\n* *note PyErrBadArgument(): 4794.\n\n* *note PyErrBadInternalCall(): 4795.\n\n* *note PyErrCheckSignals(): 17c.\n\n* *note PyErrClear(): ea8.\n\n* 'PyErrDisplay()'\n\n* *note PyErrDisplayException(): 2cc.\n\n* *note PyErrExceptionMatches(): 473a.\n\n* *note PyErrFetch(): 2c7.\n\n* *note PyErrFormat(): d16.\n\n* *note PyErrFormatV(): d15.\n\n* *note PyErrGetExcInfo(): 55d.\n\n* *note PyErrGetHandledException(): 55a.\n\n* *note PyErrGetRaisedException(): 2c5.\n\n* *note PyErrGivenExceptionMatches(): 4796.\n\n* *note PyErrNewException(): 10e2.\n\n* *note PyErrNewExceptionWithDoc(): 10e1.\n\n* *note PyErrNoMemory(): 469b.\n\n* *note PyErrNormalizeException(): 337.\n\n* *note PyErrOccurred(): 1656.\n\n* *note PyErrPrint(): 16ac.\n\n* *note PyErrPrintEx(): 4797.\n\n* 'PyErrProgramText()'\n\n* *note PyErrResourceWarning(): b6a.\n\n* *note PyErrRestore(): 2c8.\n\n* *note PyErrSetExcFromWindowsErr(): 4798.\n\n* *note PyErrSetExcFromWindowsErrWithFilename(): 1422.\n\n* *note PyErrSetExcFromWindowsErrWithFilenameObject(): 4799.\n\n* *note PyErrSetExcFromWindowsErrWithFilenameObjects(): 479a.\n\n* *note PyErrSetExcInfo(): 55c.\n\n* *note PyErrSetFromErrno(): 469a.\n\n* *note PyErrSetFromErrnoWithFilename(): 1421.\n\n* *note PyErrSetFromErrnoWithFilenameObject(): 479b.\n\n* *note PyErrSetFromErrnoWithFilenameObjects(): 479c.\n\n* *note PyErrSetFromWindowsErr(): 479d.\n\n* *note PyErrSetFromWindowsErrWithFilename(): 1423.\n\n* *note PyErrSetHandledException(): 55b.\n\n* *note PyErrSetImportError(): b94.\n\n* *note PyErrSetImportErrorSubclass(): b69.\n\n* *note PyErrSetInterrupt(): 479e.\n\n* *note PyErrSetInterruptEx(): 6af.\n\n* *note PyErrSetNone(): 479f.\n\n* *note PyErrSetObject(): 2dd.\n\n* *note PyErrSetRaisedException(): 2c6.\n\n* *note PyErrSetString(): 2de.\n\n* *note PyErrSyntaxLocation(): 47a0.\n\n* *note PyErrSyntaxLocationEx(): 47a1.\n\n* *note PyErrWarnEx(): 12a2.\n\n* *note PyErrWarnExplicit(): 144a.\n\n* *note PyErrWarnFormat(): 47a2.\n\n* *note PyErrWriteUnraisable(): 175d.\n\n* *note PyEvalAcquireLock(): 47a3.\n\n* *note PyEvalAcquireThread(): 47a4.\n\n* 'PyEvalCallFunction()'\n\n* 'PyEvalCallMethod()'\n\n* 'PyEvalCallObjectWithKeywords()'\n\n* *note PyEvalEvalCode(): 694.\n\n* *note PyEvalEvalCodeEx(): 14b8.\n\n* *note PyEvalEvalFrame(): 47a5.\n\n* *note PyEvalEvalFrameEx(): ea5.\n\n* *note PyEvalGetBuiltins(): 47a6.\n\n* *note PyEvalGetFrame(): 1513.\n\n* *note PyEvalGetFuncDesc(): 47a7.\n\n* *note PyEvalGetFuncName(): 47a8.\n\n* *note PyEvalGetGlobals(): 47a9.\n\n* *note PyEvalGetLocals(): 47aa.\n\n* *note PyEvalInitThreads(): 47ab.\n\n* *note PyEvalReleaseLock(): 47ac.\n\n* *note PyEvalReleaseThread(): 47ad.\n\n* *note PyEvalRestoreThread(): 8bd.\n\n* *note PyEvalSaveThread(): 10f3.\n\n* *note PyEvalThreadsInitialized(): 47ae.\n\n* 'PyExcArithmeticError'\n\n* 'PyExcAssertionError'\n\n* 'PyExcAttributeError'\n\n* 'PyExcBaseException'\n\n* 'PyExcBaseExceptionGroup'\n\n* 'PyExcBlockingIOError'\n\n* 'PyExcBrokenPipeError'\n\n* 'PyExcBufferError'\n\n* 'PyExcBytesWarning'\n\n* 'PyExcChildProcessError'\n\n* 'PyExcConnectionAbortedError'\n\n* 'PyExcConnectionError'\n\n* 'PyExcConnectionRefusedError'\n\n* 'PyExcConnectionResetError'\n\n* 'PyExcDeprecationWarning'\n\n* 'PyExcEOFError'\n\n* 'PyExcEncodingWarning'\n\n* 'PyExcEnvironmentError'\n\n* 'PyExcException'\n\n* 'PyExcFileExistsError'\n\n* 'PyExcFileNotFoundError'\n\n* 'PyExcFloatingPointError'\n\n* 'PyExcFutureWarning'\n\n* 'PyExcGeneratorExit'\n\n* 'PyExcIOError'\n\n* 'PyExcImportError'\n\n* 'PyExcImportWarning'\n\n* 'PyExcIndentationError'\n\n* 'PyExcIndexError'\n\n* 'PyExcInterruptedError'\n\n* 'PyExcIsADirectoryError'\n\n* 'PyExcKeyError'\n\n* 'PyExcKeyboardInterrupt'\n\n* 'PyExcLookupError'\n\n* 'PyExcMemoryError'\n\n* 'PyExcModuleNotFoundError'\n\n* 'PyExcNameError'\n\n* 'PyExcNotADirectoryError'\n\n* 'PyExcNotImplementedError'\n\n* 'PyExcOSError'\n\n* 'PyExcOverflowError'\n\n* 'PyExcPendingDeprecationWarning'\n\n* 'PyExcPermissionError'\n\n* 'PyExcProcessLookupError'\n\n* 'PyExcRecursionError'\n\n* 'PyExcReferenceError'\n\n* 'PyExcResourceWarning'\n\n* 'PyExcRuntimeError'\n\n* 'PyExcRuntimeWarning'\n\n* 'PyExcStopAsyncIteration'\n\n* 'PyExcStopIteration'\n\n* 'PyExcSyntaxError'\n\n* 'PyExcSyntaxWarning'\n\n* 'PyExcSystemError'\n\n* 'PyExcSystemExit'\n\n* 'PyExcTabError'\n\n* 'PyExcTimeoutError'\n\n* 'PyExcTypeError'\n\n* 'PyExcUnboundLocalError'\n\n* 'PyExcUnicodeDecodeError'\n\n* 'PyExcUnicodeEncodeError'\n\n* 'PyExcUnicodeError'\n\n* 'PyExcUnicodeTranslateError'\n\n* 'PyExcUnicodeWarning'\n\n* 'PyExcUserWarning'\n\n* 'PyExcValueError'\n\n* 'PyExcWarning'\n\n* 'PyExcWindowsError'\n\n* 'PyExcZeroDivisionError'\n\n* 'PyExceptionClassName()'\n\n* *note PyExceptionGetArgs(): 2c9.\n\n* *note PyExceptionGetCause(): 47af.\n\n* *note PyExceptionGetContext(): 47b0.\n\n* *note PyExceptionGetTraceback(): 47b1.\n\n* *note PyExceptionSetArgs(): 2ca.\n\n* *note PyExceptionSetCause(): 47b2.\n\n* *note PyExceptionSetContext(): 47b3.\n\n* *note PyExceptionSetTraceback(): 175e.\n\n* *note PyFileFromFd(): 47b4.\n\n* *note PyFileGetLine(): 47b5.\n\n* *note PyFileWriteObject(): 47b6.\n\n* *note PyFileWriteString(): 47b7.\n\n* 'PyFilterType'\n\n* *note PyFloatAsDouble(): 897.\n\n* *note PyFloatFromDouble(): 47b8.\n\n* *note PyFloatFromString(): 47b9.\n\n* *note PyFloatGetInfo(): 1245.\n\n* *note PyFloatGetMax(): 1243.\n\n* *note PyFloatGetMin(): 1244.\n\n* *note PyFloatType: 47ba.\n\n* *note PyFrameObject: 575.\n\n* *note PyFrameGetCode(): 576.\n\n* *note PyFrameGetLineNumber(): 577.\n\n* *note PyFrozenSetNew(): 129d.\n\n* *note PyFrozenSetType: 47bb.\n\n* *note PyGCCollect(): 7b2.\n\n* *note PyGCDisable(): 6b8.\n\n* *note PyGCEnable(): 6b7.\n\n* *note PyGCIsEnabled(): 6b9.\n\n* *note PyGILStateEnsure(): 8bf.\n\n* *note PyGILStateGetThisThreadState(): 47bc.\n\n* *note PyGILStateRelease(): 47bd.\n\n* 'PyGILStateSTATE'\n\n* *note PyGetSetDef: 9fc.\n\n* 'PyGetSetDescrType'\n\n* *note PyImportAddModule(): 46b8.\n\n* *note PyImportAddModuleObject(): 47be.\n\n* *note PyImportAppendInittab(): 14f8.\n\n* *note PyImportExecCodeModule(): 47bf.\n\n* *note PyImportExecCodeModuleEx(): 47c0.\n\n* *note PyImportExecCodeModuleObject(): 47c1.\n\n* *note PyImportExecCodeModuleWithPathnames(): 47c2.\n\n* *note PyImportGetImporter(): 1402.\n\n* *note PyImportGetMagicNumber(): 1017.\n\n* *note PyImportGetMagicTag(): 47c3.\n\n* *note PyImportGetModule(): 9f7.\n\n* *note PyImportGetModuleDict(): 47c4.\n\n* *note PyImportImport(): 1253.\n\n* *note PyImportImportFrozenModule(): 47c5.\n\n* *note PyImportImportFrozenModuleObject(): 47c6.\n\n* *note PyImportImportModule(): 325.\n\n* *note PyImportImportModuleLevel(): 1018.\n\n* *note PyImportImportModuleLevelObject(): 47c7.\n\n* *note PyImportImportModuleNoBlock(): 324.\n\n* *note PyImportReloadModule(): 47c8.\n\n* *note PyIndexCheck(): 7ae.\n\n* *note PyInterpreterState: 6d5.\n\n* *note PyInterpreterStateClear(): 3e77.\n\n* *note PyInterpreterStateDelete(): 47c9.\n\n* *note PyInterpreterStateGet(): 794.\n\n* *note PyInterpreterStateGetDict(): 47ca.\n\n* *note PyInterpreterStateGetID(): a0a.\n\n* *note PyInterpreterStateNew(): 3e78.\n\n* *note PyIterCheck(): 1659.\n\n* *note PyIterNext(): 47cb.\n\n* *note PyIterSend(): 6a7.\n\n* 'PyListIterType'\n\n* 'PyListRevIterType'\n\n* *note PyListAppend(): 47cc.\n\n* *note PyListAsTuple(): 47cd.\n\n* *note PyListGetItem(): 46b6.\n\n* *note PyListGetSlice(): 47ce.\n\n* *note PyListInsert(): 47cf.\n\n* *note PyListNew(): 4734.\n\n* *note PyListReverse(): 47d0.\n\n* *note PyListSetItem(): 46ba.\n\n* *note PyListSetSlice(): 47d1.\n\n* *note PyListSize(): 1270.\n\n* *note PyListSort(): 47d2.\n\n* *note PyListType: 46dd.\n\n* *note PyLongObject: 2ea.\n\n* 'PyLongRangeIterType'\n\n* *note PyLongAsDouble(): 47d3.\n\n* *note PyLongAsLong(): 893.\n\n* *note PyLongAsLongAndOverflow(): 10df.\n\n* *note PyLongAsLongLong(): 47d4.\n\n* *note PyLongAsLongLongAndOverflow(): 10de.\n\n* *note PyLongAsSizet(): 47d5.\n\n* *note PyLongAsSsizet(): 47d6.\n\n* *note PyLongAsUnsignedLong(): 47d7.\n\n* *note PyLongAsUnsignedLongLong(): 110d.\n\n* *note PyLongAsUnsignedLongLongMask(): 1759.\n\n* *note PyLongAsUnsignedLongMask(): 47d8.\n\n* *note PyLongAsVoidPtr(): 47d9.\n\n* *note PyLongFromDouble(): 760.\n\n* *note PyLongFromLong(): 159c.\n\n* *note PyLongFromLongLong(): 159d.\n\n* *note PyLongFromSizet(): 1732.\n\n* *note PyLongFromSsizet(): 47da.\n\n* *note PyLongFromString(): 47db.\n\n* *note PyLongFromUnsignedLong(): 1730.\n\n* *note PyLongFromUnsignedLongLong(): 1731.\n\n* *note PyLongFromVoidPtr(): 47dc.\n\n* 'PyLongGetInfo()'\n\n* *note PyLongType: 47dd.\n\n* 'PyMapType'\n\n* *note PyMappingCheck(): 47de.\n\n* *note PyMappingGetItemString(): 47df.\n\n* *note PyMappingHasKey(): 47e0.\n\n* *note PyMappingHasKeyString(): 47e1.\n\n* *note PyMappingItems(): a02.\n\n* *note PyMappingKeys(): a00.\n\n* *note PyMappingLength(): 47e2.\n\n* *note PyMappingSetItemString(): 47e3.\n\n* *note PyMappingSize(): 17d7.\n\n* *note PyMappingValues(): a01.\n\n* *note PyMemCalloc(): d12.\n\n* *note PyMemFree(): 129a.\n\n* *note PyMemMalloc(): ab1.\n\n* *note PyMemRealloc(): eab.\n\n* *note PyMemberDef: 2a7.\n\n* 'PyMemberDescrType'\n\n* *note PyMemberGetOne(): 319.\n\n* *note PyMemberSetOne(): 31a.\n\n* *note PyMemoryViewFromBuffer(): 54b.\n\n* *note PyMemoryViewFromMemory(): fe5.\n\n* *note PyMemoryViewFromObject(): 47e4.\n\n* *note PyMemoryViewGetContiguous(): 47e5.\n\n* 'PyMemoryViewType'\n\n* *note PyMethodDef: 1332.\n\n* 'PyMethodDescrType'\n\n* *note PyModuleDef: 7a1.\n\n* 'PyModuleDefBase'\n\n* *note PyModuleDefInit(): 47e6.\n\n* 'PyModuleDefType'\n\n* *note PyModuleAddFunctions(): 47e7.\n\n* *note PyModuleAddIntConstant(): 1396.\n\n* *note PyModuleAddObject(): 6aa.\n\n* *note PyModuleAddObjectRef(): 6a9.\n\n* *note PyModuleAddStringConstant(): 1397.\n\n* *note PyModuleAddType(): 799.\n\n* *note PyModuleCreate2(): 47e8.\n\n* *note PyModuleExecDef(): d19.\n\n* *note PyModuleFromDefAndSpec2(): d18.\n\n* *note PyModuleGetDef(): 47e9.\n\n* *note PyModuleGetDict(): 47ea.\n\n* *note PyModuleGetFilename(): 338.\n\n* *note PyModuleGetFilenameObject(): 339.\n\n* *note PyModuleGetName(): 47eb.\n\n* *note PyModuleGetNameObject(): 47ec.\n\n* *note PyModuleGetState(): 7a4.\n\n* *note PyModuleNew(): 47ed.\n\n* *note PyModuleNewObject(): 47ee.\n\n* *note PyModuleSetDocString(): 47ef.\n\n* *note PyModuleType: 47f0.\n\n* *note PyNumberAbsolute(): 47f1.\n\n* *note PyNumberAdd(): 47f2.\n\n* *note PyNumberAnd(): 47f3.\n\n* *note PyNumberAsSsizet(): 47f4.\n\n* *note PyNumberCheck(): 894.\n\n* *note PyNumberDivmod(): 47f5.\n\n* *note PyNumberFloat(): 896.\n\n* *note PyNumberFloorDivide(): 47f6.\n\n* *note PyNumberInPlaceAdd(): 47f7.\n\n* *note PyNumberInPlaceAnd(): 47f8.\n\n* *note PyNumberInPlaceFloorDivide(): 47f9.\n\n* *note PyNumberInPlaceLshift(): 47fa.\n\n* *note PyNumberInPlaceMatrixMultiply(): d1b.\n\n* *note PyNumberInPlaceMultiply(): 47fb.\n\n* *note PyNumberInPlaceOr(): 47fc.\n\n* *note PyNumberInPlacePower(): 47fd.\n\n* *note PyNumberInPlaceRemainder(): 47fe.\n\n* *note PyNumberInPlaceRshift(): 47ff.\n\n* *note PyNumberInPlaceSubtract(): 4800.\n\n* *note PyNumberInPlaceTrueDivide(): 4801.\n\n* *note PyNumberInPlaceXor(): 4802.\n\n* *note PyNumberIndex(): 6a1.\n\n* *note PyNumberInvert(): 4803.\n\n* *note PyNumberLong(): 895.\n\n* *note PyNumberLshift(): 4804.\n\n* *note PyNumberMatrixMultiply(): d1a.\n\n* *note PyNumberMultiply(): 4805.\n\n* *note PyNumberNegative(): 4806.\n\n* *note PyNumberOr(): 4807.\n\n* *note PyNumberPositive(): 4808.\n\n* *note PyNumberPower(): 4809.\n\n* *note PyNumberRemainder(): 480a.\n\n* *note PyNumberRshift(): 480b.\n\n* *note PyNumberSubtract(): 480c.\n\n* *note PyNumberToBase(): 1547.\n\n* *note PyNumberTrueDivide(): 480d.\n\n* *note PyNumberXor(): 480e.\n\n* *note PyOSAfterFork(): 33a.\n\n* *note PyOSAfterForkChild(): 33b.\n\n* *note PyOSAfterForkParent(): a04.\n\n* *note PyOSBeforeFork(): a03.\n\n* *note PyOSCheckStack(): 1575.\n\n* *note PyOSFSPath(): b6b.\n\n* *note PyOSInputHook: 2e7.\n\n* 'PyOSInterruptOccurred()'\n\n* *note PyOSdoubletostring(): 480f.\n\n* *note PyOSgetsig(): 1398.\n\n* 'PyOSmystricmp()'\n\n* 'PyOSmystrnicmp()'\n\n* *note PyOSsetsig(): 1399.\n\n* *note PyOSsighandlert: 4810.\n\n* *note PyOSsnprintf(): 1365.\n\n* *note PyOSstringtodouble(): 110e.\n\n* *note PyOSstrtol(): 4811.\n\n* *note PyOSstrtoul(): 4812.\n\n* *note PyOSvsnprintf(): 1366.\n\n* *note PyObject: 6b1.\n\n* *note PyObject.obrefcnt: 6b0.\n\n* *note PyObject.obtype: 46ce.\n\n* *note PyObjectASCII(): 4813.\n\n* *note PyObjectAsCharBuffer(): 4814.\n\n* *note PyObjectAsFileDescriptor(): 4815.\n\n* *note PyObjectAsReadBuffer(): 4816.\n\n* *note PyObjectAsWriteBuffer(): 4817.\n\n* *note PyObjectBytes(): 4818.\n\n* *note PyObjectCall(): 787.\n\n* *note PyObjectCallFunction(): 8d6.\n\n* *note PyObjectCallFunctionObjArgs(): 4819.\n\n* *note PyObjectCallMethod(): 2d4.\n\n* *note PyObjectCallMethodObjArgs(): 1774.\n\n* *note PyObjectCallNoArgs(): 796.\n\n* *note PyObjectCallObject(): 46a9.\n\n* *note PyObjectCalloc(): d13.\n\n* *note PyObjectCheckBuffer(): 540.\n\n* *note PyObjectCheckReadBuffer(): 481a.\n\n* *note PyObjectClearWeakRefs(): 2d8.\n\n* *note PyObjectCopyData(): 546.\n\n* *note PyObjectDelItem(): 481b.\n\n* 'PyObjectDelItemString()'\n\n* *note PyObjectDir(): 481c.\n\n* *note PyObjectFormat(): 43cc.\n\n* *note PyObjectFree(): ab0.\n\n* *note PyObjectGCDel(): 135f.\n\n* *note PyObjectGCIsFinalized(): 79b.\n\n* *note PyObjectGCIsTracked(): 79a.\n\n* *note PyObjectGCTrack(): 1360.\n\n* *note PyObjectGCUnTrack(): 1361.\n\n* *note PyObjectGenericGetAttr(): 481d.\n\n* *note PyObjectGenericGetDict(): 16a0.\n\n* *note PyObjectGenericSetAttr(): 481e.\n\n* *note PyObjectGenericSetDict(): 481f.\n\n* *note PyObjectGetAIter(): 4820.\n\n* *note PyObjectGetAttr(): 4821.\n\n* *note PyObjectGetAttrString(): 46b4.\n\n* *note PyObjectGetBuffer(): 541.\n\n* *note PyObjectGetItem(): 4735.\n\n* *note PyObjectGetIter(): 4822.\n\n* *note PyObjectGetTypeData(): 2a1.\n\n* *note PyObjectHasAttr(): 4823.\n\n* *note PyObjectHasAttrString(): 1462.\n\n* *note PyObjectHash(): 342.\n\n* *note PyObjectHashNotImplemented(): 121b.\n\n* *note PyObjectInit(): 898.\n\n* *note PyObjectInitVar(): 16bf.\n\n* *note PyObjectIsInstance(): d0a.\n\n* *note PyObjectIsSubclass(): d0b.\n\n* *note PyObjectIsTrue(): 4824.\n\n* *note PyObjectLength(): 4825.\n\n* *note PyObjectMalloc(): ab3.\n\n* *note PyObjectNot(): 4826.\n\n* *note PyObjectRealloc(): 129b.\n\n* *note PyObjectRepr(): ea6.\n\n* *note PyObjectRichCompare(): 46f3.\n\n* *note PyObjectRichCompareBool(): 1711.\n\n* 'PyObjectSelfIter()'\n\n* *note PyObjectSetAttr(): 4827.\n\n* *note PyObjectSetAttrString(): 4828.\n\n* *note PyObjectSetItem(): 4733.\n\n* *note PyObjectSize(): 4829.\n\n* *note PyObjectStr(): ea7.\n\n* *note PyObjectType(): 482a.\n\n* *note PyObjectVectorcall(): 2b6.\n\n* *note PyObjectVectorcallMethod(): 2b7.\n\n* *note PyPropertyType: 482b.\n\n* 'PyRangeIterType'\n\n* 'PyRangeType'\n\n* 'PyReversedType'\n\n* *note PySeqIterNew(): 482c.\n\n* *note PySeqIterType: 482d.\n\n* *note PySequenceCheck(): 482e.\n\n* *note PySequenceConcat(): 482f.\n\n* *note PySequenceContains(): 4830.\n\n* *note PySequenceCount(): 4831.\n\n* *note PySequenceDelItem(): 17d6.\n\n* *note PySequenceDelSlice(): 4832.\n\n* *note PySequenceFast(): 4833.\n\n* *note PySequenceGetItem(): 17d4.\n\n* *note PySequenceGetSlice(): 4834.\n\n* 'PySequenceIn()'\n\n* *note PySequenceInPlaceConcat(): 4835.\n\n* *note PySequenceInPlaceRepeat(): 4836.\n\n* *note PySequenceIndex(): 4837.\n\n* *note PySequenceLength(): 4838.\n\n* *note PySequenceList(): 4839.\n\n* *note PySequenceRepeat(): 483a.\n\n* *note PySequenceSetItem(): 17d5.\n\n* *note PySequenceSetSlice(): 483b.\n\n* *note PySequenceSize(): 17d3.\n\n* *note PySequenceTuple(): 483c.\n\n* 'PySetIterType'\n\n* *note PySetAdd(): 129e.\n\n* *note PySetClear(): 483d.\n\n* *note PySetContains(): 12a0.\n\n* *note PySetDiscard(): 129f.\n\n* *note PySetNew(): 129c.\n\n* *note PySetPop(): 483e.\n\n* *note PySetSize(): 12a1.\n\n* *note PySetType: 483f.\n\n* *note PySliceAdjustIndices(): 33e.\n\n* *note PySliceGetIndices(): 4840.\n\n* *note PySliceGetIndicesEx(): 33c.\n\n* *note PySliceNew(): 4841.\n\n* *note PySliceType: 4842.\n\n* *note PySliceUnpack(): 33d.\n\n* *note PyStateAddModule(): 4843.\n\n* *note PyStateFindModule(): 4844.\n\n* *note PyStateRemoveModule(): 4845.\n\n* *note PyStructSequenceDesc: 9fe.\n\n* *note PyStructSequenceField: 9fd.\n\n* *note PyStructSequenceGetItem(): 4846.\n\n* *note PyStructSequenceNew(): 4847.\n\n* *note PyStructSequenceNewType(): 4848.\n\n* *note PyStructSequenceSetItem(): 4849.\n\n* *note PyStructSequenceUnnamedField: 7a6.\n\n* 'PySuperType'\n\n* *note PySysAddWarnOption(): a6a.\n\n* *note PySysAddWarnOptionUnicode(): a69.\n\n* *note PySysAddXOption(): 484a.\n\n* *note PySysFormatStderr(): 484b.\n\n* *note PySysFormatStdout(): 484c.\n\n* *note PySysGetObject(): 57f.\n\n* *note PySysGetXOptions(): 484d.\n\n* 'PySysHasWarnOptions()'\n\n* *note PySysResetWarnOptions(): 327.\n\n* *note PySysSetArgv(): 11cc.\n\n* *note PySysSetArgvEx(): 11cb.\n\n* *note PySysSetObject(): 484e.\n\n* *note PySysSetPath(): 1573.\n\n* *note PySysWriteStderr(): 484f.\n\n* *note PySysWriteStdout(): 4850.\n\n* *note PyThreadState: 57a.\n\n* *note PyThreadStateClear(): 16d4.\n\n* *note PyThreadStateDelete(): 170e.\n\n* *note PyThreadStateGet(): 4851.\n\n* *note PyThreadStateGetDict(): 4852.\n\n* *note PyThreadStateGetFrame(): 57b.\n\n* *note PyThreadStateGetID(): 795.\n\n* *note PyThreadStateGetInterpreter(): 793.\n\n* *note PyThreadStateNew(): 4853.\n\n* *note PyThreadStateSetAsyncExc(): a08.\n\n* *note PyThreadStateSwap(): 4854.\n\n* 'PyThreadGetInfo()'\n\n* *note PyThreadReInitTLS(): 34d.\n\n* 'PyThreadacquirelock()'\n\n* 'PyThreadacquirelocktimed()'\n\n* 'PyThreadallocatelock()'\n\n* *note PyThreadcreatekey(): 343.\n\n* *note PyThreaddeletekey(): 345.\n\n* *note PyThreaddeletekeyvalue(): 34b.\n\n* 'PyThreadexitthread()'\n\n* 'PyThreadfreelock()'\n\n* *note PyThreadgetkeyvalue(): 349.\n\n* 'PyThreadgetstacksize()'\n\n* 'PyThreadgetthreadident()'\n\n* 'PyThreadgetthreadnativeid()'\n\n* 'PyThreadinitthread()'\n\n* 'PyThreadreleaselock()'\n\n* *note PyThreadsetkeyvalue(): 347.\n\n* 'PyThreadsetstacksize()'\n\n* 'PyThreadstartnewthread()'\n\n* *note PyThreadtssalloc(): 344.\n\n* *note PyThreadtsscreate(): 4855.\n\n* *note PyThreadtssdelete(): 34c.\n\n* *note PyThreadtssfree(): 346.\n\n* *note PyThreadtssget(): 34a.\n\n* *note PyThreadtssiscreated(): 4856.\n\n* *note PyThreadtssset(): 348.\n\n* 'PyTraceBackHere()'\n\n* 'PyTraceBackPrint()'\n\n* 'PyTraceBackType'\n\n* 'PyTupleIterType'\n\n* *note PyTupleGetItem(): 46b5.\n\n* *note PyTupleGetSlice(): 4857.\n\n* *note PyTupleNew(): 4858.\n\n* *note PyTuplePack(): 4859.\n\n* *note PyTupleSetItem(): 46b9.\n\n* *note PyTupleSize(): 485a.\n\n* *note PyTupleType: 485b.\n\n* *note PyTypeObject: 8da.\n\n* *note PyTypeClearCache(): 485c.\n\n* *note PyTypeFromMetaclass(): 2a9.\n\n* *note PyTypeFromModuleAndSpec(): 2aa.\n\n* *note PyTypeFromSpec(): 2df.\n\n* *note PyTypeFromSpecWithBases(): 2e0.\n\n* *note PyTypeGenericAlloc(): 899.\n\n* *note PyTypeGenericNew(): 46cd.\n\n* *note PyTypeGetFlags(): 16be.\n\n* *note PyTypeGetModule(): 790.\n\n* *note PyTypeGetModuleState(): 791.\n\n* *note PyTypeGetName(): 539.\n\n* *note PyTypeGetQualName(): 53a.\n\n* *note PyTypeGetSlot(): 6ad.\n\n* *note PyTypeGetTypeDataSize(): 2a2.\n\n* *note PyTypeIsSubtype(): 485d.\n\n* *note PyTypeModified(): 154f.\n\n* *note PyTypeReady(): 567.\n\n* *note PyTypeSlot: 485e.\n\n* *note PyTypeSpec: 1425.\n\n* *note PyTypeType: 2a5.\n\n* *note PyUnicodeDecodeErrorCreate(): 485f.\n\n* *note PyUnicodeDecodeErrorGetEncoding(): 4860.\n\n* *note PyUnicodeDecodeErrorGetEnd(): 4861.\n\n* *note PyUnicodeDecodeErrorGetObject(): 4862.\n\n* *note PyUnicodeDecodeErrorGetReason(): 4863.\n\n* *note PyUnicodeDecodeErrorGetStart(): 4864.\n\n* *note PyUnicodeDecodeErrorSetEnd(): 4865.\n\n* *note PyUnicodeDecodeErrorSetReason(): 4866.\n\n* *note PyUnicodeDecodeErrorSetStart(): 4867.\n\n* *note PyUnicodeEncodeErrorGetEncoding(): 4868.\n\n* *note PyUnicodeEncodeErrorGetEnd(): 4869.\n\n* *note PyUnicodeEncodeErrorGetObject(): 486a.\n\n* *note PyUnicodeEncodeErrorGetReason(): 486b.\n\n* *note PyUnicodeEncodeErrorGetStart(): 486c.\n\n* *note PyUnicodeEncodeErrorSetEnd(): 486d.\n\n* *note PyUnicodeEncodeErrorSetReason(): 486e.\n\n* *note PyUnicodeEncodeErrorSetStart(): 486f.\n\n* 'PyUnicodeIterType'\n\n* *note PyUnicodeTranslateErrorGetEnd(): 4870.\n\n* *note PyUnicodeTranslateErrorGetObject(): 4871.\n\n* *note PyUnicodeTranslateErrorGetReason(): 4872.\n\n* *note PyUnicodeTranslateErrorGetStart(): 4873.\n\n* *note PyUnicodeTranslateErrorSetEnd(): 4874.\n\n* *note PyUnicodeTranslateErrorSetReason(): 4875.\n\n* *note PyUnicodeTranslateErrorSetStart(): 4876.\n\n* 'PyUnicodeAppend()'\n\n* 'PyUnicodeAppendAndDel()'\n\n* *note PyUnicodeAsASCIIString(): 1008.\n\n* *note PyUnicodeAsCharmapString(): 4877.\n\n* 'PyUnicodeAsDecodedObject()'\n\n* 'PyUnicodeAsDecodedUnicode()'\n\n* 'PyUnicodeAsEncodedObject()'\n\n* *note PyUnicodeAsEncodedString(): 4878.\n\n* 'PyUnicodeAsEncodedUnicode()'\n\n* *note PyUnicodeAsLatin1String(): 1007.\n\n* *note PyUnicodeAsMBCSString(): 1009.\n\n* *note PyUnicodeAsRawUnicodeEscapeString(): 1006.\n\n* *note PyUnicodeAsUCS4(): fee.\n\n* *note PyUnicodeAsUCS4Copy(): 6d3.\n\n* *note PyUnicodeAsUTF16String(): 4879.\n\n* *note PyUnicodeAsUTF32String(): 487a.\n\n* *note PyUnicodeAsUTF8AndSize(): 6a8.\n\n* *note PyUnicodeAsUTF8String(): 1004.\n\n* *note PyUnicodeAsUnicodeEscapeString(): 1005.\n\n* *note PyUnicodeAsWideChar(): 17d8.\n\n* *note PyUnicodeAsWideCharString(): 6d4.\n\n* 'PyUnicodeBuildEncodingMap()'\n\n* *note PyUnicodeCompare(): 6cf.\n\n* *note PyUnicodeCompareWithASCIIString(): 10e0.\n\n* *note PyUnicodeConcat(): 1015.\n\n* *note PyUnicodeContains(): 487b.\n\n* *note PyUnicodeCount(): 487c.\n\n* *note PyUnicodeDecode(): 1755.\n\n* *note PyUnicodeDecodeASCII(): 487d.\n\n* *note PyUnicodeDecodeCharmap(): 487e.\n\n* 'PyUnicodeDecodeCodePageStateful()'\n\n* *note PyUnicodeDecodeFSDefault(): 1424.\n\n* *note PyUnicodeDecodeFSDefaultAndSize(): 487f.\n\n* *note PyUnicodeDecodeLatin1(): 4880.\n\n* *note PyUnicodeDecodeLocale(): 4881.\n\n* *note PyUnicodeDecodeLocaleAndSize(): a0d.\n\n* *note PyUnicodeDecodeMBCS(): 4882.\n\n* *note PyUnicodeDecodeMBCSStateful(): 4883.\n\n* *note PyUnicodeDecodeRawUnicodeEscape(): 4884.\n\n* *note PyUnicodeDecodeUTF16(): 4885.\n\n* *note PyUnicodeDecodeUTF16Stateful(): 4886.\n\n* *note PyUnicodeDecodeUTF32(): 4887.\n\n* *note PyUnicodeDecodeUTF32Stateful(): 4888.\n\n* *note PyUnicodeDecodeUTF7(): 4889.\n\n* *note PyUnicodeDecodeUTF7Stateful(): 488a.\n\n* *note PyUnicodeDecodeUTF8(): 488b.\n\n* *note PyUnicodeDecodeUTF8Stateful(): 14f4.\n\n* *note PyUnicodeDecodeUnicodeEscape(): 488c.\n\n* *note PyUnicodeEncodeCodePage(): 100a.\n\n* *note PyUnicodeEncodeFSDefault(): 17d1.\n\n* *note PyUnicodeEncodeLocale(): a0e.\n\n* *note PyUnicodeFSConverter(): b6c.\n\n* *note PyUnicodeFSDecoder(): 2d9.\n\n* *note PyUnicodeFind(): 488d.\n\n* *note PyUnicodeFindChar(): 6d1.\n\n* *note PyUnicodeFormat(): 488e.\n\n* *note PyUnicodeFromEncodedObject(): 488f.\n\n* *note PyUnicodeFromFormat(): 2d5.\n\n* *note PyUnicodeFromFormatV(): 2d6.\n\n* *note PyUnicodeFromObject(): 4890.\n\n* 'PyUnicodeFromOrdinal()'\n\n* *note PyUnicodeFromString(): 4716.\n\n* *note PyUnicodeFromStringAndSize(): 4891.\n\n* *note PyUnicodeFromWideChar(): 1002.\n\n* 'PyUnicodeGetDefaultEncoding()'\n\n* *note PyUnicodeGetLength(): 6cb.\n\n* *note PyUnicodeInternFromString(): 4892.\n\n* *note PyUnicodeInternInPlace(): 6c9.\n\n* *note PyUnicodeIsIdentifier(): 170b.\n\n* *note PyUnicodeJoin(): 1016.\n\n* 'PyUnicodePartition()'\n\n* 'PyUnicodeRPartition()'\n\n* 'PyUnicodeRSplit()'\n\n* *note PyUnicodeReadChar(): fe6.\n\n* *note PyUnicodeReplace(): 4893.\n\n* 'PyUnicodeResize()'\n\n* *note PyUnicodeRichCompare(): 4894.\n\n* *note PyUnicodeSplit(): 4895.\n\n* *note PyUnicodeSplitlines(): 4896.\n\n* *note PyUnicodeSubstring(): 6ce.\n\n* *note PyUnicodeTailmatch(): 6d0.\n\n* *note PyUnicodeTranslate(): 4897.\n\n* *note PyUnicodeType: 4898.\n\n* *note PyUnicodeWriteChar(): fe7.\n\n* *note PyVarObject: 3dfd.\n\n* 'PyVarObject.obbase'\n\n* *note PyVarObject.obsize: 4899.\n\n* *note PyVectorcallCall(): 2af.\n\n* *note PyVectorcallNARGS(): 2ae.\n\n* 'PyWeakReference'\n\n* *note PyWeakrefGetObject(): 489a.\n\n* *note PyWeakrefNewProxy(): 489b.\n\n* *note PyWeakrefNewRef(): 15b2.\n\n* 'PyWrapperDescrType'\n\n* *note PyWrapperNew(): 489c.\n\n* 'PyZipType'\n\n* *note PyAddPendingCall(): 7a5.\n\n* *note PyAtExit(): 489d.\n\n* *note PyBEGINALLOWTHREADS: 46be.\n\n* *note PyBLOCKTHREADS: 489e.\n\n* *note PyBuildValue(): 6bb.\n\n* *note PyBytesMain(): 7e5.\n\n* *note PyCompileString(): 693.\n\n* *note PyDecRef(): 489f.\n\n* *note PyDecodeLocale(): a0b.\n\n* *note PyENDALLOWTHREADS: 8be.\n\n* *note PyEncodeLocale(): a0c.\n\n* *note PyEndInterpreter(): 15c1.\n\n* *note PyEnterRecursiveCall(): 797.\n\n* *note PyExit(): ba8.\n\n* *note PyFatalError(): 7a7.\n\n* 'PyFileSystemDefaultEncodeErrors'\n\n* 'PyFileSystemDefaultEncoding'\n\n* *note PyFinalize(): 11cd.\n\n* *note PyFinalizeEx(): b67.\n\n* *note PyGenericAlias(): 48a0.\n\n* *note PyGenericAliasType: 48a1.\n\n* *note PyGetBuildInfo(): 128a.\n\n* *note PyGetCompiler(): 48a2.\n\n* *note PyGetCopyright(): 48a3.\n\n* *note PyGetExecPrefix(): 329.\n\n* *note PyGetPath(): 32b.\n\n* *note PyGetPlatform(): 48a4.\n\n* *note PyGetPrefix(): 32d.\n\n* *note PyGetProgramFullPath(): 32f.\n\n* *note PyGetProgramName(): 331.\n\n* *note PyGetPythonHome(): 332.\n\n* 'PyGetRecursionLimit()'\n\n* *note PyGetVersion(): 48a5.\n\n* 'PyHasFileSystemDefaultEncoding'\n\n* *note PyIncRef(): 48a6.\n\n* *note PyInitialize(): 6c2.\n\n* *note PyInitializeEx(): 48a7.\n\n* *note PyIs(): 6b3.\n\n* *note PyIsFalse(): 6b6.\n\n* *note PyIsInitialized(): 473d.\n\n* *note PyIsNone(): 6b4.\n\n* *note PyIsTrue(): 6b5.\n\n* *note PyLeaveRecursiveCall(): 798.\n\n* *note PyMain(): a6d.\n\n* 'PyMakePendingCalls()'\n\n* *note PyNewInterpreter(): 150d.\n\n* *note PyNewRef(): 6ab.\n\n* *note PyReprEnter(): 48a8.\n\n* *note PyReprLeave(): 48a9.\n\n* *note PySetPath(): 1b74.\n\n* *note PySetProgramName(): 181f.\n\n* *note PySetPythonHome(): 1820.\n\n* 'PySetRecursionLimit()'\n\n* *note PyUCS4: fea.\n\n* *note PyUNBLOCKTHREADS: 48aa.\n\n* 'PyUTF8Mode'\n\n* *note PyVaBuildValue(): 48ab.\n\n* *note PyVersion: 53d.\n\n* *note PyXNewRef(): 6ac.\n\n* *note Pybuffer: 53f.\n\n* 'Pyintptrt'\n\n* *note Pyssizet: 88d.\n\n* 'Pyuintptrt'\n\n* *note allocfunc: 48ac.\n\n* *note binaryfunc: 48ad.\n\n* *note descrgetfunc: 48ae.\n\n* *note descrsetfunc: 48af.\n\n* *note destructor: 48b0.\n\n* *note getattrfunc: 48b1.\n\n* *note getattrofunc: 48b2.\n\n* *note getbufferproc: 48b3.\n\n* *note getiterfunc: 48b4.\n\n* *note getter: 48b5.\n\n* *note hashfunc: 48b6.\n\n* *note initproc: 48b7.\n\n* *note inquiry: 48b8.\n\n* *note iternextfunc: 48b9.\n\n* *note lenfunc: 48ba.\n\n* *note newfunc: 48bb.\n\n* *note objobjargproc: 48bc.\n\n* *note objobjproc: 48bd.\n\n* *note releasebufferproc: 48be.\n\n* *note reprfunc: 48bf.\n\n* *note richcmpfunc: 48c0.\n\n* *note setattrfunc: 48c1.\n\n* *note setattrofunc: 48c2.\n\n* *note setter: 48c3.\n\n* *note ssizeargfunc: 48c4.\n\n* *note ssizeobjargproc: 48c5.\n\n* 'ssizessizeargfunc'\n\n* 'ssizessizeobjargproc'\n\n* 'symtable'\n\n* *note ternaryfunc: 48c6.\n\n* *note traverseproc: 48c7.\n\n* *note unaryfunc: 48c8.\n\n* *note vectorcallfunc: 2b0.\n\n* *note visitproc: 48c9.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The Very High Level Layer,  Next: Reference Counting,  Prev: C API Stability,  Up: Python/C API Reference Manual": {
            "content": "",
            "subsections": [
                {
                    "name": "7.3 The Very High Level Layer",
                    "content": ""
                }
            ]
        },
        "The functions in this chapter will let you execute Python source code": {
            "content": "given in a file or a buffer, but they will not let you interact in a\nmore detailed way with the interpreter.\n",
            "subsections": []
        },
        "Several of these functions accept a start symbol from the grammar as a": {
            "content": "parameter.  The available start symbols are *note Pyevalinput: 48cd,\n*note Pyfileinput: 48ce, and *note Pysingleinput: 48cf.  These are\ndescribed following the functions which accept them as parameters.\n\nNote also that several of these functions take FILE* parameters.  One\nparticular issue which needs to be handled carefully is that the 'FILE'\nstructure for different C libraries can be different and incompatible.",
            "subsections": []
        },
        "Under Windows (at least), it is possible for dynamically linked": {
            "content": "extensions to actually use different libraries, so care should be taken\nthat FILE* parameters are only passed to these functions if it is\ncertain that they were created by the same library that the Python\nruntime is using.\n\n-- C Function: int PyMain (int argc, wchart argv)\n' Part of the *note Stable ABI: 2ac.'  The main program for the\nstandard interpreter.  This is made available for programs which\nembed Python.  The 'argc' and 'argv' parameters should be prepared\nexactly as those which are passed to a C program's 'main()'\nfunction (converted to wchart according to the user's locale).  It\nis important to note that the argument list may be modified (but\nthe contents of the strings pointed to by the argument list are\nnot).  The return value will be '0' if the interpreter exits\nnormally (i.e., without an exception), '1' if the interpreter exits\ndue to an exception, or '2' if the parameter list does not\nrepresent a valid Python command line.\n\nNote that if an otherwise unhandled *note SystemExit: b97. is\nraised, this function will not return '1', but exit the process, as\nlong as *note PyConfig.inspect: 2f9. is zero.\n\n-- C Function: int PyBytesMain (int argc, char argv)\n' Part of the *note Stable ABI: 2ac. since version 3.8.'  Similar\nto *note PyMain(): a6d. but 'argv' is an array of bytes strings.\n\nNew in version 3.8.\n\n-- C Function: int PyRunAnyFile (FILE *fp, const char *filename)\n\nThis is a simplified interface to *note PyRunAnyFileExFlags():\n48d1. below, leaving 'closeit' set to '0' and 'flags' set to\n'NULL'.\n\n-- C Function: int PyRunAnyFileFlags (FILE *fp, const char *filename,\nPyCompilerFlags *flags)\n\nThis is a simplified interface to *note PyRunAnyFileExFlags():\n48d1. below, leaving the 'closeit' argument set to '0'.\n\n-- C Function: int PyRunAnyFileEx (FILE *fp, const char *filename, int\ncloseit)\n\nThis is a simplified interface to *note PyRunAnyFileExFlags():\n48d1. below, leaving the 'flags' argument set to 'NULL'.\n\n-- C Function: int PyRunAnyFileExFlags (FILE *fp, const char\n*filename, int closeit, PyCompilerFlags *flags)\n\nIf 'fp' refers to a file associated with an interactive device\n(console or terminal input or Unix pseudo-terminal), return the\nvalue of *note PyRunInteractiveLoop(): 48d4, otherwise return the\nresult of *note PyRunSimpleFile(): 470e.  'filename' is decoded\nfrom the filesystem encoding (*note sys.getfilesystemencoding():\naa2.).  If 'filename' is 'NULL', this function uses '\"???\"' as the\nfilename.  If 'closeit' is true, the file is closed before\n'PyRunSimpleFileExFlags()' returns.\n\n-- C Function: int PyRunSimpleString (const char *command)\n\nThis is a simplified interface to *note PyRunSimpleStringFlags():\n48d5. below, leaving the *note PyCompilerFlags: 8d5.* argument set\nto 'NULL'.\n\n-- C Function: int PyRunSimpleStringFlags (const char *command,\nPyCompilerFlags *flags)\n\nExecutes the Python source code from 'command' in the *note\nmain: 1. module according to the 'flags' argument.  If *note\nmain: 1. does not already exist, it is created.  Returns '0' on\nsuccess or '-1' if an exception was raised.  If there was an error,\nthere is no way to get the exception information.  For the meaning\nof 'flags', see below.\n\nNote that if an otherwise unhandled *note SystemExit: b97. is\nraised, this function will not return '-1', but exit the process,\nas long as *note PyConfig.inspect: 2f9. is zero.\n\n-- C Function: int PyRunSimpleFile (FILE *fp, const char *filename)\n\nThis is a simplified interface to *note PyRunSimpleFileExFlags():\n166d. below, leaving 'closeit' set to '0' and 'flags' set to\n'NULL'.\n\n-- C Function: int PyRunSimpleFileEx (FILE *fp, const char *filename,\nint closeit)\n\nThis is a simplified interface to *note PyRunSimpleFileExFlags():\n166d. below, leaving 'flags' set to 'NULL'.\n\n-- C Function: int PyRunSimpleFileExFlags (FILE *fp, const char\n*filename, int closeit, PyCompilerFlags *flags)\n\nSimilar to *note PyRunSimpleStringFlags(): 48d5, but the Python\nsource code is read from 'fp' instead of an in-memory string.\n'filename' should be the name of the file, it is decoded from *note\nfilesystem encoding and error handler: 291.  If 'closeit' is true,\nthe file is closed before 'PyRunSimpleFileExFlags()' returns.\n\nNote: On Windows, 'fp' should be opened as binary mode (e.g.\n'fopen(filename, \"rb\")').  Otherwise, Python may not handle\nscript file with LF line ending correctly.\n\n-- C Function: int PyRunInteractiveOne (FILE *fp, const char\n*filename)\n\nThis is a simplified interface to *note\nPyRunInteractiveOneFlags(): 48d8. below, leaving 'flags' set to\n'NULL'.\n\n-- C Function: int PyRunInteractiveOneFlags (FILE *fp, const char\n*filename, PyCompilerFlags *flags)\n\nRead and execute a single statement from a file associated with an\ninteractive device according to the 'flags' argument.  The user\nwill be prompted using 'sys.ps1' and 'sys.ps2'.  'filename' is\ndecoded from the *note filesystem encoding and error handler: 291.\n\nReturns '0' when the input was executed successfully, '-1' if there\nwas an exception, or an error code from the 'errcode.h' include\nfile distributed as part of Python if there was a parse error.\n(Note that 'errcode.h' is not included by 'Python.h', so must be\nincluded specifically if needed.)\n\n-- C Function: int PyRunInteractiveLoop (FILE *fp, const char\n*filename)\n\nThis is a simplified interface to *note\nPyRunInteractiveLoopFlags(): 48d9. below, leaving 'flags' set to\n'NULL'.\n\n-- C Function: int PyRunInteractiveLoopFlags (FILE *fp, const char\n*filename, PyCompilerFlags *flags)\n\nRead and execute statements from a file associated with an\ninteractive device until EOF is reached.  The user will be prompted\nusing 'sys.ps1' and 'sys.ps2'.  'filename' is decoded from the\n*note filesystem encoding and error handler: 291.  Returns '0' at\nEOF or a negative number upon failure.\n\n-- C Variable: int (*PyOSInputHook)(void)\n' Part of the *note Stable ABI: 2ac.'  Can be set to point to a\nfunction with the prototype 'int func(void)'.  The function will be\ncalled when Python's interpreter prompt is about to become idle and\nwait for user input from the terminal.  The return value is\nignored.  Overriding this hook can be used to integrate the\ninterpreter's prompt with other event loops, as done in the\n'Modules/tkinter.c' in the Python source code.\n\nChanged in version 3.12: This function is only called from the\n*note main interpreter: 2e9.\n\n-- C Variable: char *(*PyOSReadlineFunctionPointer)(FILE*, FILE*,\nconst char*)\n\nCan be set to point to a function with the prototype 'char\n*func(FILE *stdin, FILE *stdout, char *prompt)', overriding the\ndefault function used to read a single line of input at the\ninterpreter's prompt.  The function is expected to output the\nstring 'prompt' if it's not 'NULL', and then read a line of input\nfrom the provided standard input file, returning the resulting\nstring.  For example, The *note readline: b5. module sets this hook\nto provide line-editing and tab-completion features.\n\nThe result must be a string allocated by *note PyMemRawMalloc():\nea9. or *note PyMemRawRealloc(): eaa, or 'NULL' if an error\noccurred.\n\nChanged in version 3.4: The result must be allocated by *note\nPyMemRawMalloc(): ea9. or *note PyMemRawRealloc(): eaa, instead\nof being allocated by *note PyMemMalloc(): ab1. or *note\nPyMemRealloc(): eab.\n\nChanged in version 3.12: This function is only called from the\n*note main interpreter: 2e9.\n\n-- C Function: *note PyObject: 6b1. *PyRunString (const char *str, int\nstart, PyObject *globals, PyObject *locals)\n'Return value: New reference.'  This is a simplified interface to\n*note PyRunStringFlags(): 48da. below, leaving 'flags' set to\n'NULL'.\n\n-- C Function: *note PyObject: 6b1. *PyRunStringFlags (const char\n*str, int start, PyObject *globals, PyObject *locals,\nPyCompilerFlags *flags)\n'Return value: New reference.'  Execute Python source code from\n'str' in the context specified by the objects 'globals' and\n'locals' with the compiler flags specified by 'flags'.  'globals'\nmust be a dictionary; 'locals' can be any object that implements\nthe mapping protocol.  The parameter 'start' specifies the start\ntoken that should be used to parse the source code.\n\nReturns the result of executing the code as a Python object, or\n'NULL' if an exception was raised.\n\n-- C Function: *note PyObject: 6b1. *PyRunFile (FILE *fp, const char\n*filename, int start, PyObject *globals, PyObject *locals)\n'Return value: New reference.'  This is a simplified interface to\n*note PyRunFileExFlags(): 48dc. below, leaving 'closeit' set to\n'0' and 'flags' set to 'NULL'.\n\n-- C Function: *note PyObject: 6b1. *PyRunFileEx (FILE *fp, const char\n*filename, int start, PyObject *globals, PyObject *locals, int\ncloseit)\n'Return value: New reference.'  This is a simplified interface to\n*note PyRunFileExFlags(): 48dc. below, leaving 'flags' set to\n'NULL'.\n\n-- C Function: *note PyObject: 6b1. *PyRunFileFlags (FILE *fp, const\nchar *filename, int start, PyObject *globals, PyObject\n*locals, PyCompilerFlags *flags)\n'Return value: New reference.'  This is a simplified interface to\n*note PyRunFileExFlags(): 48dc. below, leaving 'closeit' set to\n'0'.\n\n-- C Function: *note PyObject: 6b1. *PyRunFileExFlags (FILE *fp, const\nchar *filename, int start, PyObject *globals, PyObject\n*locals, int closeit, PyCompilerFlags *flags)\n'Return value: New reference.'  Similar to *note\nPyRunStringFlags(): 48da, but the Python source code is read from\n'fp' instead of an in-memory string.  'filename' should be the name\nof the file, it is decoded from the *note filesystem encoding and\nerror handler: 291.  If 'closeit' is true, the file is closed\nbefore *note PyRunFileExFlags(): 48dc. returns.\n\n-- C Function: *note PyObject: 6b1. *PyCompileString (const char *str,\nconst char *filename, int start)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  This is a simplified interface to *note\nPyCompileStringFlags(): 48df. below, leaving 'flags' set to\n'NULL'.\n\n-- C Function: *note PyObject: 6b1. *PyCompileStringFlags (const char\n*str, const char *filename, int start, PyCompilerFlags *flags)\n'Return value: New reference.'  This is a simplified interface to\n*note PyCompileStringExFlags(): 48e0. below, with 'optimize' set\nto '-1'.\n\n-- C Function: *note PyObject: 6b1. *PyCompileStringObject (const char\n*str, PyObject *filename, int start, PyCompilerFlags *flags,\nint optimize)\n'Return value: New reference.'  Parse and compile the Python source\ncode in 'str', returning the resulting code object.  The start\ntoken is given by 'start'; this can be used to constrain the code\nwhich can be compiled and should be *note Pyevalinput: 48cd,\n*note Pyfileinput: 48ce, or *note Pysingleinput: 48cf.  The\nfilename specified by 'filename' is used to construct the code\nobject and may appear in tracebacks or *note SyntaxError: 146.\nexception messages.  This returns 'NULL' if the code cannot be\nparsed or compiled.\n\nThe integer 'optimize' specifies the optimization level of the\ncompiler; a value of '-1' selects the optimization level of the\ninterpreter as given by *note -O: c11. options.  Explicit levels\nare '0' (no optimization; 'debug' is true), '1' (asserts are\nremoved, 'debug' is false) or '2' (docstrings are removed too).\n\nNew in version 3.4.\n\n-- C Function: *note PyObject: 6b1. *PyCompileStringExFlags (const\nchar *str, const char *filename, int start, PyCompilerFlags\n*flags, int optimize)\n'Return value: New reference.'  Like *note\nPyCompileStringObject(): 48e1, but 'filename' is a byte string\ndecoded from the *note filesystem encoding and error handler: 291.\n\nNew in version 3.2.\n\n-- C Function: *note PyObject: 6b1. *PyEvalEvalCode (PyObject *co,\nPyObject *globals, PyObject *locals)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  This is a simplified interface to *note PyEvalEvalCodeEx():\n14b8, with just the code object, and global and local variables.\nThe other arguments are set to 'NULL'.\n\n-- C Function: *note PyObject: 6b1. *PyEvalEvalCodeEx (PyObject *co,\nPyObject *globals, PyObject *locals, PyObject *const *args,\nint argcount, PyObject *const *kws, int kwcount, PyObject\n*const *defs, int defcount, PyObject *kwdefs, PyObject\n*closure)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Evaluate a precompiled code object, given a particular\nenvironment for its evaluation.  This environment consists of a\ndictionary of global variables, a mapping object of local\nvariables, arrays of arguments, keywords and defaults, a dictionary\nof default values for *note keyword-only: 8b8. arguments and a\nclosure tuple of cells.\n\n-- C Function: *note PyObject: 6b1. *PyEvalEvalFrame (PyFrameObject\n*f)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Evaluate an execution frame.  This is a simplified interface\nto *note PyEvalEvalFrameEx(): ea5, for backward compatibility.\n\n-- C Function: *note PyObject: 6b1. *PyEvalEvalFrameEx (PyFrameObject\n*f, int throwflag)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  This is the main, unvarnished function of Python\ninterpretation.  The code object associated with the execution\nframe 'f' is executed, interpreting bytecode and executing calls as\nneeded.  The additional 'throwflag' parameter can mostly be ignored\n- if true, then it causes an exception to immediately be thrown;\nthis is used for the *note throw(): 241. methods of generator\nobjects.\n\nChanged in version 3.4: This function now includes a debug\nassertion to help ensure that it does not silently discard an\nactive exception.\n\n-- C Function: int PyEvalMergeCompilerFlags (PyCompilerFlags *cf)\n\nThis function changes the flags of the current evaluation frame,\nand returns true on success, false on failure.\n\n-- C Variable: int Pyevalinput\n\nThe start symbol from the Python grammar for isolated expressions;\nfor use with *note PyCompileString(): 693.\n\n-- C Variable: int Pyfileinput\n\nThe start symbol from the Python grammar for sequences of\nstatements as read from a file or other source; for use with *note\nPyCompileString(): 693.  This is the symbol to use when compiling\narbitrarily long Python source code.\n\n-- C Variable: int Pysingleinput\n\nThe start symbol from the Python grammar for a single statement;\nfor use with *note PyCompileString(): 693.  This is the symbol\nused for the interactive interpreter loop.\n\n-- C Struct: struct PyCompilerFlags\n\nThis is the structure used to hold compiler flags.  In cases where\ncode is only being compiled, it is passed as 'int flags', and in\ncases where code is being executed, it is passed as\n'PyCompilerFlags *flags'.  In this case, 'from future import'\ncan modify 'flags'.\n\nWhenever 'PyCompilerFlags *flags' is 'NULL', *note cfflags: 48e3.\nis treated as equal to '0', and any modification due to 'from\nfuture import' is discarded.\n\n-- C Member: int cfflags\n\nCompiler flags.\n\n-- C Member: int cffeatureversion\n\n'cffeatureversion' is the minor Python version.  It should\nbe initialized to 'PYMINORVERSION'.\n\nThe field is ignored by default, it is used if and only if\n'PyCFONLYAST' flag is set in *note cfflags: 48e3.\n\nChanged in version 3.8: Added 'cffeatureversion' field.\n\n-- C Variable: int COFUTUREDIVISION\n\nThis bit can be set in 'flags' to cause division operator '/' to be\ninterpreted as \"true division\" according to PEP 238(1).\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0238/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Reference Counting,  Next: Exception Handling,  Prev: The Very High Level Layer,  Up: Python/C API Reference Manual": {
            "content": "",
            "subsections": [
                {
                    "name": "7.4 Reference Counting",
                    "content": ""
                }
            ]
        },
        "The functions and macros in this section are used for managing reference": {
            "content": "counts of Python objects.\n\n-- C Function: *note Pyssizet: 88d. PyREFCNT (PyObject *o)\n\nGet the reference count of the Python object 'o'.\n\nNote that the returned value may not actually reflect how many\nreferences to the object are actually held.  For example, some\nobjects are \"immortal\" and have a very high refcount that does not\nreflect the actual number of references.  Consequently, do not rely\non the returned value to be accurate, other than a value of 0 or 1.\n\nUse the *note PySETREFCNT(): 6be. function to set an object\nreference count.\n\nChanged in version 3.10: *note PyREFCNT(): 6bd. is changed to the\ninline static function.\n\nChanged in version 3.11: The parameter type is no longer const\n*note PyObject: 6b1.*.\n\n-- C Function: void PySETREFCNT (PyObject *o, Pyssizet refcnt)\n\nSet the object 'o' reference counter to 'refcnt'.\n\nNote that this function has no effect on immortal(1) objects.\n\nNew in version 3.9.\n\nChanged in version 3.12: Immortal objects are not modified.\n\n-- C Function: void PyINCREF (PyObject *o)\n\nIndicate taking a new *note strong reference: 57c. to object 'o',\nindicating it is in use and should not be destroyed.\n\nThis function is usually used to convert a *note borrowed\nreference: 4732. to a *note strong reference: 57c. in-place.  The\n*note PyNewRef(): 6ab. function can be used to create a new *note\nstrong reference: 57c.\n\nWhen done using the object, release it by calling *note\nPyDECREF(): 2cf.\n\nThe object must not be 'NULL'; if you aren't sure that it isn't\n'NULL', use *note PyXINCREF(): 892.\n\nDo not expect this function to actually modify 'o' in any way.  For\nat least some objects(2), this function has no effect.\n\nChanged in version 3.12: Immortal objects are not modified.\n\n-- C Function: void PyXINCREF (PyObject *o)\n\nSimilar to *note PyINCREF(): 2ce, but the object 'o' can be\n'NULL', in which case this has no effect.\n\nSee also *note PyXNewRef(): 6ac.\n\n-- C Function: *note PyObject: 6b1. *PyNewRef (PyObject *o)\n' Part of the *note Stable ABI: 2ac. since version 3.10.'  Create a\nnew *note strong reference: 57c. to an object: call *note\nPyINCREF(): 2ce. on 'o' and return the object 'o'.\n\nWhen the *note strong reference: 57c. is no longer needed, *note\nPyDECREF(): 2cf. should be called on it to release the reference.\n\nThe object 'o' must not be 'NULL'; use *note PyXNewRef(): 6ac. if\n'o' can be 'NULL'.\n\nFor example:\n\nPyINCREF(obj);\nself->attr = obj;\n\ncan be written as:\n\nself->attr = PyNewRef(obj);\n\nSee also *note PyINCREF(): 2ce.\n\nNew in version 3.10.\n\n-- C Function: *note PyObject: 6b1. *PyXNewRef (PyObject *o)\n' Part of the *note Stable ABI: 2ac. since version 3.10.'  Similar\nto *note PyNewRef(): 6ab, but the object 'o' can be NULL.\n\nIf the object 'o' is 'NULL', the function just returns 'NULL'.\n\nNew in version 3.10.\n\n-- C Function: void PyDECREF (PyObject *o)\n\nRelease a *note strong reference: 57c. to object 'o', indicating\nthe reference is no longer used.\n\nOnce the last *note strong reference: 57c. is released (i.e.  the\nobject's reference count reaches 0), the object's type's\ndeallocation function (which must not be 'NULL') is invoked.\n\nThis function is usually used to delete a *note strong reference:\n57c. before exiting its scope.\n\nThe object must not be 'NULL'; if you aren't sure that it isn't\n'NULL', use *note PyXDECREF(): 57d.\n\nDo not expect this function to actually modify 'o' in any way.  For\nat least some objects(3), this function has no effect.\n\nWarning: The deallocation function can cause arbitrary Python\ncode to be invoked (e.g.  when a class instance with a *note\ndel(): 1c66. method is deallocated).  While exceptions in\nsuch code are not propagated, the executed code has free\naccess to all Python global variables.  This means that any\nobject that is reachable from a global variable should be in a\nconsistent state before *note PyDECREF(): 2cf. is invoked.\nFor example, code to delete an object from a list should copy\na reference to the deleted object in a temporary variable,\nupdate the list data structure, and then call *note\nPyDECREF(): 2cf. for the temporary variable.\n\nChanged in version 3.12: Immortal objects are not modified.\n\n-- C Function: void PyXDECREF (PyObject *o)\n\nSimilar to *note PyDECREF(): 2cf, but the object 'o' can be\n'NULL', in which case this has no effect.  The same warning from\n*note PyDECREF(): 2cf. applies here as well.\n\n-- C Function: void PyCLEAR (PyObject *o)\n\nRelease a *note strong reference: 57c. for object 'o'.  The object\nmay be 'NULL', in which case the macro has no effect; otherwise the\neffect is the same as for *note PyDECREF(): 2cf, except that the\nargument is also set to 'NULL'.  The warning for *note PyDECREF():\n2cf. does not apply with respect to the object passed because the\nmacro carefully uses a temporary variable and sets the argument to\n'NULL' before releasing the reference.\n\nIt is a good idea to use this macro whenever releasing a reference\nto an object that might be traversed during garbage collection.\n\nChanged in version 3.12: The macro argument is now only evaluated\nonce.  If the argument has side effects, these are no longer\nduplicated.\n\n-- C Function: void PyIncRef (PyObject *o)\n' Part of the *note Stable ABI: 2ac.'  Indicate taking a new *note\nstrong reference: 57c. to object 'o'.  A function version of *note\nPyXINCREF(): 892.  It can be used for runtime dynamic embedding of\nPython.\n\n-- C Function: void PyDecRef (PyObject *o)\n' Part of the *note Stable ABI: 2ac.'  Release a *note strong\nreference: 57c. to object 'o'.  A function version of *note\nPyXDECREF(): 57d.  It can be used for runtime dynamic embedding of\nPython.\n\n-- C Macro: PySETREF (dst, src)\n\nMacro safely releasing a *note strong reference: 57c. to object\n'dst' and setting 'dst' to 'src'.\n\nAs in case of *note PyCLEAR(): 2da, \"the obvious\" code can be\ndeadly:\n\nPyDECREF(dst);\ndst = src;\n\nThe safe way is:\n\nPySETREF(dst, src);\n\nThat arranges to set 'dst' to 'src' before releasing the\nreference to the old value of 'dst', so that any code triggered as\na side-effect of 'dst' getting torn down no longer believes 'dst'\npoints to a valid object.\n\nNew in version 3.6.\n\nChanged in version 3.12: The macro arguments are now only evaluated\nonce.  If an argument has side effects, these are no longer\nduplicated.\n\n-- C Macro: PyXSETREF (dst, src)\n\nVariant of *note PySETREF: 2db. macro that uses *note\nPyXDECREF(): 57d. instead of *note PyDECREF(): 2cf.\n\nNew in version 3.6.\n\nChanged in version 3.12: The macro arguments are now only evaluated\nonce.  If an argument has side effects, these are no longer\nduplicated.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0683/\n\n(2) https://peps.python.org/pep-0683/\n\n(3) https://peps.python.org/pep-0683/\n\nFile: python3.12.info,  Node: Exception Handling,  Next: Utilities<2>,  Prev: Reference Counting,  Up: Python/C API Reference Manual\n",
            "subsections": [
                {
                    "name": "7.5 Exception Handling",
                    "content": ""
                }
            ]
        },
        "The functions described in this chapter will let you handle and raise": {
            "content": "",
            "subsections": []
        },
        "Python exceptions.  It is important to understand some of the basics of": {
            "content": "",
            "subsections": []
        },
        "Python exception handling.  It works somewhat like the POSIX 'errno'": {
            "content": "variable: there is a global indicator (per thread) of the last error\nthat occurred.  Most C API functions don't clear this on success, but\nwill set it to indicate the cause of the error on failure.  Most C API\nfunctions also return an error indicator, usually 'NULL' if they are\nsupposed to return a pointer, or '-1' if they return an integer\n(exception: the 'PyArg*' functions return '1' for success and '0' for\nfailure).\n",
            "subsections": []
        },
        "Concretely, the error indicator consists of three object pointers: the": {
            "content": "exception's type, the exception's value, and the traceback object.  Any\nof those pointers can be 'NULL' if non-set (although some combinations\nare forbidden, for example you can't have a non-'NULL' traceback if the\nexception type is 'NULL').\n",
            "subsections": []
        },
        "When a function must fail because some function it called failed, it": {
            "content": "generally doesn't set the error indicator; the function it called\nalready set it.  It is responsible for either handling the error and\nclearing the exception or returning after cleaning up any resources it\nholds (such as object references or memory allocations); it should 'not'\ncontinue normally if it is not prepared to handle the error.  If\nreturning due to an error, it is important to indicate to the caller\nthat an error has been set.  If the error is not handled or carefully\npropagated, additional calls into the Python/C API may not behave as\nintended and may fail in mysterious ways.\n\nNote: The error indicator is 'not' the result of *note\nsys.excinfo(): 456.  The former corresponds to an exception that\nis not yet caught (and is therefore still propagating), while the\nlatter returns an exception after it is caught (and has therefore\nstopped propagating).\n\n* Menu:\n\n* Printing and clearing::\n* Raising exceptions::\n* Issuing warnings::\n* Querying the error indicator::\n* Signal Handling: Signal Handling<2>.\n* Exception Classes::\n* Exception Objects::\n* Unicode Exception Objects::\n* Recursion Control::\n* Standard Exceptions::\n* Standard Warning Categories::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Printing and clearing,  Next: Raising exceptions,  Up: Exception Handling": {
            "content": "-- C Function: void PyErrClear ()\n' Part of the *note Stable ABI: 2ac.'  Clear the error indicator.\nIf the error indicator is not set, there is no effect.\n\n-- C Function: void PyErrPrintEx (int setsyslastvars)\n' Part of the *note Stable ABI: 2ac.'  Print a standard traceback\nto 'sys.stderr' and clear the error indicator.  'Unless' the error\nis a 'SystemExit', in that case no traceback is printed and the\nPython process will exit with the error code specified by the\n'SystemExit' instance.\n\nCall this function 'only' when the error indicator is set.\nOtherwise it will cause a fatal error!\n\nIf 'setsyslastvars' is nonzero, the variable *note sys.lastexc:\n1e2. is set to the printed exception.  For backwards compatibility,\nthe deprecated variables *note sys.lasttype: 1e3, *note\nsys.lastvalue: 1e4. and *note sys.lasttraceback: 1e5. are also\nset to the type, value and traceback of this exception,\nrespectively.\n\nChanged in version 3.12: The setting of *note sys.lastexc: 1e2.\nwas added.\n\n-- C Function: void PyErrPrint ()\n' Part of the *note Stable ABI: 2ac.'  Alias for\n'PyErrPrintEx(1)'.\n\n-- C Function: void PyErrWriteUnraisable (PyObject *obj)\n' Part of the *note Stable ABI: 2ac.'  Call *note\nsys.unraisablehook(): 448. using the current exception and 'obj'\nargument.\n\nThis utility function prints a warning message to 'sys.stderr' when\nan exception has been set but it is impossible for the interpreter\nto actually raise the exception.  It is used, for example, when an\nexception occurs in an *note del(): 1c66. method.\n\nThe function is called with a single argument 'obj' that identifies\nthe context in which the unraisable exception occurred.  If\npossible, the repr of 'obj' will be printed in the warning message.\nIf 'obj' is 'NULL', only the traceback is printed.\n\nAn exception must be set when calling this function.\n\nChanged in version 3.4: Print a traceback.  Print only traceback if\n'obj' is 'NULL'.\n\nChanged in version 3.8: Use *note sys.unraisablehook(): 448.\n\n-- C Function: void PyErrDisplayException (PyObject *exc)\n' Part of the *note Stable ABI: 2ac. since version 3.12.'  Print\nthe standard traceback display of 'exc' to 'sys.stderr', including\nchained exceptions and notes.\n\nNew in version 3.12.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Raising exceptions,  Next: Issuing warnings,  Prev: Printing and clearing,  Up: Exception Handling": {
            "content": "",
            "subsections": []
        },
        "These functions help you set the current thread's error indicator.  For": {
            "content": "convenience, some of these functions will always return a 'NULL' pointer\nfor use in a 'return' statement.\n\n-- C Function: void PyErrSetString (PyObject *type, const char\n*message)\n' Part of the *note Stable ABI: 2ac.'  This is the most common way\nto set the error indicator.  The first argument specifies the\nexception type; it is normally one of the standard exceptions, e.g.\n'PyExcRuntimeError'.  You need not create a new *note strong\nreference: 57c. to it (e.g.  with *note PyINCREF(): 2ce.).  The\nsecond argument is an error message; it is decoded from ''utf-8''.\n\n-- C Function: void PyErrSetObject (PyObject *type, PyObject *value)\n' Part of the *note Stable ABI: 2ac.'  This function is similar to\n*note PyErrSetString(): 2de. but lets you specify an arbitrary\nPython object for the \"value\" of the exception.\n\n-- C Function: *note PyObject: 6b1. *PyErrFormat (PyObject *exception,\nconst char *format, ...)\n'Return value: Always NULL.'' Part of the *note Stable ABI: 2ac.'\nThis function sets the error indicator and returns 'NULL'.\n'exception' should be a Python exception class.  The 'format' and\nsubsequent parameters help format the error message; they have the\nsame meaning and values as in *note PyUnicodeFromFormat(): 2d5.\n'format' is an ASCII-encoded string.\n\n-- C Function: *note PyObject: 6b1. *PyErrFormatV (PyObject\n*exception, const char *format, valist vargs)\n'Return value: Always NULL.'' Part of the *note Stable ABI: 2ac.\nsince version 3.5.'  Same as *note PyErrFormat(): d16, but taking\na 'valist' argument rather than a variable number of arguments.\n\nNew in version 3.5.\n\n-- C Function: void PyErrSetNone (PyObject *type)\n' Part of the *note Stable ABI: 2ac.'  This is a shorthand for\n'PyErrSetObject(type, PyNone)'.\n\n-- C Function: int PyErrBadArgument ()\n' Part of the *note Stable ABI: 2ac.'  This is a shorthand for\n'PyErrSetString(PyExcTypeError, message)', where 'message'\nindicates that a built-in operation was invoked with an illegal\nargument.  It is mostly for internal use.\n\n-- C Function: *note PyObject: 6b1. *PyErrNoMemory ()\n'Return value: Always NULL.'' Part of the *note Stable ABI: 2ac.'\nThis is a shorthand for 'PyErrSetNone(PyExcMemoryError)'; it\nreturns 'NULL' so an object allocation function can write 'return\nPyErrNoMemory();' when it runs out of memory.\n\n-- C Function: *note PyObject: 6b1. *PyErrSetFromErrno (PyObject\n*type)\n'Return value: Always NULL.'' Part of the *note Stable ABI: 2ac.'\n\nThis is a convenience function to raise an exception when a C\nlibrary function has returned an error and set the C variable\n'errno'.  It constructs a tuple object whose first item is the\ninteger 'errno' value and whose second item is the corresponding\nerror message (gotten from 'strerror()'), and then calls\n'PyErrSetObject(type, object)'.  On Unix, when the 'errno' value\nis 'EINTR', indicating an interrupted system call, this calls *note\nPyErrCheckSignals(): 17c, and if that set the error indicator,\nleaves it set to that.  The function always returns 'NULL', so a\nwrapper function around a system call can write 'return\nPyErrSetFromErrno(type);' when the system call returns an error.\n\n-- C Function: *note PyObject: 6b1.\n*PyErrSetFromErrnoWithFilenameObject (PyObject *type,\nPyObject *filenameObject)\n'Return value: Always NULL.'' Part of the *note Stable ABI: 2ac.'\nSimilar to *note PyErrSetFromErrno(): 469a, with the additional\nbehavior that if 'filenameObject' is not 'NULL', it is passed to\nthe constructor of 'type' as a third parameter.  In the case of\n*note OSError: 613. exception, this is used to define the\n'filename' attribute of the exception instance.\n\n-- C Function: *note PyObject: 6b1.\n*PyErrSetFromErrnoWithFilenameObjects (PyObject *type,\nPyObject *filenameObject, PyObject *filenameObject2)\n'Return value: Always NULL.'' Part of the *note Stable ABI: 2ac.\nsince version 3.7.'  Similar to *note\nPyErrSetFromErrnoWithFilenameObject(): 479b, but takes a second\nfilename object, for raising errors when a function that takes two\nfilenames fails.\n\nNew in version 3.4.\n\n-- C Function: *note PyObject: 6b1. *PyErrSetFromErrnoWithFilename\n(PyObject *type, const char *filename)\n'Return value: Always NULL.'' Part of the *note Stable ABI: 2ac.'\nSimilar to *note PyErrSetFromErrnoWithFilenameObject(): 479b, but\nthe filename is given as a C string.  'filename' is decoded from\nthe *note filesystem encoding and error handler: 291.\n\n-- C Function: *note PyObject: 6b1. *PyErrSetFromWindowsErr (int ierr)\n'Return value: Always NULL.'' Part of the *note Stable ABI: 2ac. on\nWindows since version 3.7.'  This is a convenience function to\nraise *note WindowsError: ecd.  If called with 'ierr' of '0', the\nerror code returned by a call to 'GetLastError()' is used instead.\nIt calls the Win32 function 'FormatMessage()' to retrieve the\nWindows description of error code given by 'ierr' or\n'GetLastError()', then it constructs a tuple object whose first\nitem is the 'ierr' value and whose second item is the corresponding\nerror message (gotten from 'FormatMessage()'), and then calls\n'PyErrSetObject(PyExcWindowsError, object)'.  This function\nalways returns 'NULL'.\n\n*note Availability: 1ad3.: Windows.\n\n-- C Function: *note PyObject: 6b1. *PyErrSetExcFromWindowsErr\n(PyObject *type, int ierr)\n'Return value: Always NULL.'' Part of the *note Stable ABI: 2ac. on\nWindows since version 3.7.'  Similar to *note\nPyErrSetFromWindowsErr(): 479d, with an additional parameter\nspecifying the exception type to be raised.\n\n*note Availability: 1ad3.: Windows.\n\n-- C Function: *note PyObject: 6b1.\n*PyErrSetFromWindowsErrWithFilename (int ierr, const char\n*filename)\n'Return value: Always NULL.'' Part of the *note Stable ABI: 2ac. on\nWindows since version 3.7.'  Similar to *note\nPyErrSetFromWindowsErr(): 479d, with the additional behavior that\nif 'filename' is not 'NULL', it is decoded from the filesystem\nencoding (*note os.fsdecode(): a9d.) and passed to the constructor\nof *note OSError: 613. as a third parameter to be used to define\nthe 'filename' attribute of the exception instance.\n\n*note Availability: 1ad3.: Windows.\n\n-- C Function: *note PyObject: 6b1.\n*PyErrSetExcFromWindowsErrWithFilenameObject (PyObject *type,\nint ierr, PyObject *filename)\n'Return value: Always NULL.'' Part of the *note Stable ABI: 2ac. on\nWindows since version 3.7.'  Similar to *note\nPyErrSetExcFromWindowsErr(): 4798, with the additional behavior\nthat if 'filename' is not 'NULL', it is passed to the constructor\nof *note OSError: 613. as a third parameter to be used to define\nthe 'filename' attribute of the exception instance.\n\n*note Availability: 1ad3.: Windows.\n\n-- C Function: *note PyObject: 6b1.\n*PyErrSetExcFromWindowsErrWithFilenameObjects (PyObject\n*type, int ierr, PyObject *filename, PyObject *filename2)\n'Return value: Always NULL.'' Part of the *note Stable ABI: 2ac. on\nWindows since version 3.7.'  Similar to *note\nPyErrSetExcFromWindowsErrWithFilenameObject(): 4799, but accepts a\nsecond filename object.\n\n*note Availability: 1ad3.: Windows.\n\nNew in version 3.4.\n\n-- C Function: *note PyObject: 6b1.\n*PyErrSetExcFromWindowsErrWithFilename (PyObject *type, int\nierr, const char *filename)\n'Return value: Always NULL.'' Part of the *note Stable ABI: 2ac. on\nWindows since version 3.7.'  Similar to *note\nPyErrSetFromWindowsErrWithFilename(): 1423, with an additional\nparameter specifying the exception type to be raised.\n\n*note Availability: 1ad3.: Windows.\n\n-- C Function: *note PyObject: 6b1. *PyErrSetImportError (PyObject\n*msg, PyObject *name, PyObject *path)\n'Return value: Always NULL.'' Part of the *note Stable ABI: 2ac.\nsince version 3.7.'  This is a convenience function to raise *note\nImportError: 145.  'msg' will be set as the exception's message\nstring.  'name' and 'path', both of which can be 'NULL', will be\nset as the *note ImportError: 145.'s respective 'name' and 'path'\nattributes.\n\nNew in version 3.3.\n\n-- C Function: *note PyObject: 6b1. *PyErrSetImportErrorSubclass\n(PyObject *exception, PyObject *msg, PyObject *name, PyObject\n*path)\n'Return value: Always NULL.'' Part of the *note Stable ABI: 2ac.\nsince version 3.6.'  Much like *note PyErrSetImportError(): b94.\nbut this function allows for specifying a subclass of *note\nImportError: 145. to raise.\n\nNew in version 3.6.\n\n-- C Function: void PyErrSyntaxLocationObject (PyObject *filename, int\nlineno, int coloffset)\n\nSet file, line, and offset information for the current exception.\nIf the current exception is not a *note SyntaxError: 146, then it\nsets additional attributes, which make the exception printing\nsubsystem think the exception is a *note SyntaxError: 146.\n\nNew in version 3.4.\n\n-- C Function: void PyErrSyntaxLocationEx (const char *filename, int\nlineno, int coloffset)\n' Part of the *note Stable ABI: 2ac. since version 3.7.'  Like\n*note PyErrSyntaxLocationObject(): 48ed, but 'filename' is a byte\nstring decoded from the *note filesystem encoding and error\nhandler: 291.\n\nNew in version 3.2.\n\n-- C Function: void PyErrSyntaxLocation (const char *filename, int\nlineno)\n' Part of the *note Stable ABI: 2ac.'  Like *note\nPyErrSyntaxLocationEx(): 47a1, but the 'coloffset' parameter is\nomitted.\n\n-- C Function: void PyErrBadInternalCall ()\n' Part of the *note Stable ABI: 2ac.'  This is a shorthand for\n'PyErrSetString(PyExcSystemError, message)', where 'message'\nindicates that an internal operation (e.g.  a Python/C API\nfunction) was invoked with an illegal argument.  It is mostly for\ninternal use.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Issuing warnings,  Next: Querying the error indicator,  Prev: Raising exceptions,  Up: Exception Handling": {
            "content": "",
            "subsections": []
        },
        "Use these functions to issue warnings from C code.  They mirror similar": {
            "content": "functions exported by the Python *note warnings: 10d. module.  They\nnormally print a warning message to 'sys.stderr'; however, it is also\npossible that the user has specified that warnings are to be turned into\nerrors, and in that case they will raise an exception.  It is also\npossible that the functions raise an exception because of a problem with\nthe warning machinery.  The return value is '0' if no exception is\nraised, or '-1' if an exception is raised.  (It is not possible to\ndetermine whether a warning message is actually printed, nor what the\nreason is for the exception; this is intentional.)  If an exception is\nraised, the caller should do its normal exception handling (for example,\n*note PyDECREF(): 2cf. owned references and return an error value).\n\n-- C Function: int PyErrWarnEx (PyObject *category, const char\n*message, Pyssizet stacklevel)\n' Part of the *note Stable ABI: 2ac.'  Issue a warning message.\nThe 'category' argument is a warning category (see below) or\n'NULL'; the 'message' argument is a UTF-8 encoded string.\n'stacklevel' is a positive number giving a number of stack frames;\nthe warning will be issued from the currently executing line of\ncode in that stack frame.  A 'stacklevel' of 1 is the function\ncalling *note PyErrWarnEx(): 12a2, 2 is the function above that,\nand so forth.\n\nWarning categories must be subclasses of 'PyExcWarning';\n'PyExcWarning' is a subclass of 'PyExcException'; the default\nwarning category is 'PyExcRuntimeWarning'.  The standard Python\nwarning categories are available as global variables whose names\nare enumerated at *note Standard Warning Categories: 48ef.\n\nFor information about warning control, see the documentation for\nthe *note warnings: 10d. module and the *note -W: 6df. option in\nthe command line documentation.  There is no C API for warning\ncontrol.\n\n-- C Function: int PyErrWarnExplicitObject (PyObject *category,\nPyObject *message, PyObject *filename, int lineno, PyObject\n*module, PyObject *registry)\n\nIssue a warning message with explicit control over all warning\nattributes.  This is a straightforward wrapper around the Python\nfunction *note warnings.warnexplicit(): b50.; see there for more\ninformation.  The 'module' and 'registry' arguments may be set to\n'NULL' to get the default effect described there.\n\nNew in version 3.4.\n\n-- C Function: int PyErrWarnExplicit (PyObject *category, const char\n*message, const char *filename, int lineno, const char\n*module, PyObject *registry)\n' Part of the *note Stable ABI: 2ac.'  Similar to *note\nPyErrWarnExplicitObject(): 48f0. except that 'message' and\n'module' are UTF-8 encoded strings, and 'filename' is decoded from\nthe *note filesystem encoding and error handler: 291.\n\n-- C Function: int PyErrWarnFormat (PyObject *category, Pyssizet\nstacklevel, const char *format, ...)\n' Part of the *note Stable ABI: 2ac.'  Function similar to *note\nPyErrWarnEx(): 12a2, but use *note PyUnicodeFromFormat(): 2d5. to\nformat the warning message.  'format' is an ASCII-encoded string.\n\nNew in version 3.2.\n\n-- C Function: int PyErrResourceWarning (PyObject *source, Pyssizet\nstacklevel, const char *format, ...)\n' Part of the *note Stable ABI: 2ac. since version 3.6.'  Function\nsimilar to *note PyErrWarnFormat(): 47a2, but 'category' is *note\nResourceWarning: a86. and it passes 'source' to\n'warnings.WarningMessage'.\n\nNew in version 3.6.\n\nFile: python3.12.info,  Node: Querying the error indicator,  Next: Signal Handling<2>,  Prev: Issuing warnings,  Up: Exception Handling\n\n\n-- C Function: *note PyObject: 6b1. *PyErrOccurred ()\n'Return value: Borrowed reference.''  Part of the *note Stable ABI:\n2ac.'  Test whether the error indicator is set.  If set, return the\nexception 'type' (the first argument to the last call to one of the\n'PyErrSet*' functions or to *note PyErrRestore(): 2c8.).  If not\nset, return 'NULL'.  You do not own a reference to the return\nvalue, so you do not need to *note PyDECREF(): 2cf. it.\n\nThe caller must hold the GIL.\n\nNote: Do not compare the return value to a specific exception;\nuse *note PyErrExceptionMatches(): 473a. instead, shown\nbelow.  (The comparison could easily fail since the exception\nmay be an instance instead of a class, in the case of a class\nexception, or it may be a subclass of the expected exception.)\n\n-- C Function: int PyErrExceptionMatches (PyObject *exc)\n' Part of the *note Stable ABI: 2ac.'  Equivalent to\n'PyErrGivenExceptionMatches(PyErrOccurred(), exc)'.  This should\nonly be called when an exception is actually set; a memory access\nviolation will occur if no exception has been raised.\n\n-- C Function: int PyErrGivenExceptionMatches (PyObject *given,\nPyObject *exc)\n' Part of the *note Stable ABI: 2ac.'  Return true if the 'given'\nexception matches the exception type in 'exc'.  If 'exc' is a class\nobject, this also returns true when 'given' is an instance of a\nsubclass.  If 'exc' is a tuple, all exception types in the tuple\n(and recursively in subtuples) are searched for a match.\n\n-- C Function: *note PyObject: 6b1. *PyErrGetRaisedException (void)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\nsince version 3.12.'  Return the exception currently being raised,\nclearing the error indicator at the same time.  Return 'NULL' if\nthe error indicator is not set.\n\nThis function is used by code that needs to catch exceptions, or\ncode that needs to save and restore the error indicator\ntemporarily.\n\nFor example:\n\n{\nPyObject *exc = PyErrGetRaisedException();\n\n/* ... code that might produce other errors ... */\n\nPyErrSetRaisedException(exc);\n}\n\nSee also\n........\n\n*note PyErrGetHandledException(): 55a, to save the exception\ncurrently being handled.\n\nNew in version 3.12.\n\n-- C Function: void PyErrSetRaisedException (PyObject *exc)\n' Part of the *note Stable ABI: 2ac. since version 3.12.'  Set\n'exc' as the exception currently being raised, clearing the\nexisting exception if one is set.\n\nWarning: This call steals a reference to 'exc', which must be\na valid exception.\n\nNew in version 3.12.\n\n-- C Function: void PyErrFetch (PyObject ptype, PyObject pvalue,\nPyObject ptraceback)\n' Part of the *note Stable ABI: 2ac.'\n\nDeprecated since version 3.12: Use *note\nPyErrGetRaisedException(): 2c5. instead.\n\nRetrieve the error indicator into three variables whose addresses\nare passed.  If the error indicator is not set, set all three\nvariables to 'NULL'.  If it is set, it will be cleared and you own\na reference to each object retrieved.  The value and traceback\nobject may be 'NULL' even when the type object is not.\n\nNote: This function is normally only used by legacy code that\nneeds to catch exceptions or save and restore the error\nindicator temporarily.\n\nFor example:\n\n{\nPyObject *type, *value, *traceback;\nPyErrFetch(&type, &value, &traceback);\n\n/* ... code that might produce other errors ... */\n\nPyErrRestore(type, value, traceback);\n}\n\n-- C Function: void PyErrRestore (PyObject *type, PyObject *value,\nPyObject *traceback)\n' Part of the *note Stable ABI: 2ac.'\n\nDeprecated since version 3.12: Use *note\nPyErrSetRaisedException(): 2c6. instead.\n\nSet the error indicator from the three objects, 'type', 'value',\nand 'traceback', clearing the existing exception if one is set.  If\nthe objects are 'NULL', the error indicator is cleared.  Do not\npass a 'NULL' type and non-'NULL' value or traceback.  The\nexception type should be a class.  Do not pass an invalid exception\ntype or value.  (Violating these rules will cause subtle problems\nlater.)  This call takes away a reference to each object: you must\nown a reference to each object before the call and after the call\nyou no longer own these references.  (If you don't understand this,\ndon't use this function.  I warned you.)\n\nNote: This function is normally only used by legacy code that\nneeds to save and restore the error indicator temporarily.\nUse *note PyErrFetch(): 2c7. to save the current error\nindicator.\n\n-- C Function: void PyErrNormalizeException (PyObject exc, PyObject\nval, PyObject tb)\n' Part of the *note Stable ABI: 2ac.'\n\nDeprecated since version 3.12: Use *note\nPyErrGetRaisedException(): 2c5. instead, to avoid any possible\nde-normalization.\n\nUnder certain circumstances, the values returned by *note\nPyErrFetch(): 2c7. below can be \"unnormalized\", meaning that\n'*exc' is a class object but '*val' is not an instance of the same\nclass.  This function can be used to instantiate the class in that\ncase.  If the values are already normalized, nothing happens.  The\ndelayed normalization is implemented to improve performance.\n\nNote: This function 'does not' implicitly set the *note\ntraceback: 113c. attribute on the exception value.  If\nsetting the traceback appropriately is desired, the following\nadditional snippet is needed:\n\nif (tb != NULL) {\nPyExceptionSetTraceback(val, tb);\n}\n\n-- C Function: *note PyObject: 6b1. *PyErrGetHandledException (void)\n' Part of the *note Stable ABI: 2ac. since version 3.11.'  Retrieve\nthe active exception instance, as would be returned by *note\nsys.exception(): 457.  This refers to an exception that was\n'already caught', not to an exception that was freshly raised.\nReturns a new reference to the exception or 'NULL'.  Does not\nmodify the interpreter's exception state.\n\nNote: This function is not normally used by code that wants to\nhandle exceptions.  Rather, it can be used when code needs to\nsave and restore the exception state temporarily.  Use *note\nPyErrSetHandledException(): 55b. to restore or clear the\nexception state.\n\nNew in version 3.11.\n\n-- C Function: void PyErrSetHandledException (PyObject *exc)\n' Part of the *note Stable ABI: 2ac. since version 3.11.'  Set the\nactive exception, as known from 'sys.exception()'.  This refers to\nan exception that was 'already caught', not to an exception that\nwas freshly raised.  To clear the exception state, pass 'NULL'.\n\nNote: This function is not normally used by code that wants to\nhandle exceptions.  Rather, it can be used when code needs to\nsave and restore the exception state temporarily.  Use *note\nPyErrGetHandledException(): 55a. to get the exception state.\n\nNew in version 3.11.\n\n-- C Function: void PyErrGetExcInfo (PyObject ptype, PyObject\npvalue, PyObject ptraceback)\n' Part of the *note Stable ABI: 2ac. since version 3.7.'  Retrieve\nthe old-style representation of the exception info, as known from\n*note sys.excinfo(): 456.  This refers to an exception that was\n'already caught', not to an exception that was freshly raised.\nReturns new references for the three objects, any of which may be\n'NULL'.  Does not modify the exception info state.  This function\nis kept for backwards compatibility.  Prefer using *note\nPyErrGetHandledException(): 55a.\n\nNote: This function is not normally used by code that wants to\nhandle exceptions.  Rather, it can be used when code needs to\nsave and restore the exception state temporarily.  Use *note\nPyErrSetExcInfo(): 55c. to restore or clear the exception\nstate.\n\nNew in version 3.3.\n\n-- C Function: void PyErrSetExcInfo (PyObject *type, PyObject *value,\nPyObject *traceback)\n' Part of the *note Stable ABI: 2ac. since version 3.7.'  Set the\nexception info, as known from 'sys.excinfo()'.  This refers to an\nexception that was 'already caught', not to an exception that was\nfreshly raised.  This function steals the references of the\narguments.  To clear the exception state, pass 'NULL' for all three\narguments.  This function is kept for backwards compatibility.\nPrefer using *note PyErrSetHandledException(): 55b.\n\nNote: This function is not normally used by code that wants to\nhandle exceptions.  Rather, it can be used when code needs to\nsave and restore the exception state temporarily.  Use *note\nPyErrGetExcInfo(): 55d. to read the exception state.\n\nNew in version 3.3.\n\nChanged in version 3.11: The 'type' and 'traceback' arguments are\nno longer used and can be NULL. The interpreter now derives them\nfrom the exception instance (the 'value' argument).  The function\nstill steals references of all three arguments.\n\nFile: python3.12.info,  Node: Signal Handling<2>,  Next: Exception Classes,  Prev: Querying the error indicator,  Up: Exception Handling\n\n\n-- C Function: int PyErrCheckSignals ()\n' Part of the *note Stable ABI: 2ac.'\n\nThis function interacts with Python's signal handling.\n\nIf the function is called from the main thread and under the main\nPython interpreter, it checks whether a signal has been sent to the\nprocesses and if so, invokes the corresponding signal handler.  If\nthe *note signal: c1. module is supported, this can invoke a signal\nhandler written in Python.\n\nThe function attempts to handle all pending signals, and then\nreturns '0'.  However, if a Python signal handler raises an\nexception, the error indicator is set and the function returns '-1'\nimmediately (such that other pending signals may not have been\nhandled yet: they will be on the next *note PyErrCheckSignals():\n17c. invocation).\n\nIf the function is called from a non-main thread, or under a\nnon-main Python interpreter, it does nothing and returns '0'.\n\nThis function can be called by long-running C code that wants to be\ninterruptible by user requests (such as by pressing Ctrl-C).\n\nNote: The default Python signal handler for 'SIGINT' raises\nthe *note KeyboardInterrupt: 7f5. exception.\n\n-- C Function: void PyErrSetInterrupt ()\n' Part of the *note Stable ABI: 2ac.'\n\nSimulate the effect of a 'SIGINT' signal arriving.  This is\nequivalent to 'PyErrSetInterruptEx(SIGINT)'.\n\nNote: This function is async-signal-safe.  It can be called\nwithout the *note GIL: 6c0. and from a C signal handler.\n\n-- C Function: int PyErrSetInterruptEx (int signum)\n' Part of the *note Stable ABI: 2ac. since version 3.10.'\n\nSimulate the effect of a signal arriving.  The next time *note\nPyErrCheckSignals(): 17c. is called, the Python signal handler for\nthe given signal number will be called.\n\nThis function can be called by C code that sets up its own signal\nhandling and wants Python signal handlers to be invoked as expected\nwhen an interruption is requested (for example when the user\npresses Ctrl-C to interrupt an operation).\n\nIf the given signal isn't handled by Python (it was set to *note\nsignal.SIGDFL: 1583. or *note signal.SIGIGN: 1582.), it will be\nignored.\n\nIf 'signum' is outside of the allowed range of signal numbers, '-1'\nis returned.  Otherwise, '0' is returned.  The error indicator is\nnever changed by this function.\n\nNote: This function is async-signal-safe.  It can be called\nwithout the *note GIL: 6c0. and from a C signal handler.\n\nNew in version 3.10.\n\n-- C Function: int PySignalSetWakeupFd (int fd)\n\nThis utility function specifies a file descriptor to which the\nsignal number is written as a single byte whenever a signal is\nreceived.  'fd' must be non-blocking.  It returns the previous such\nfile descriptor.\n\nThe value '-1' disables the feature; this is the initial state.\nThis is equivalent to *note signal.setwakeupfd(): 9b1. in Python,\nbut without any error checking.  'fd' should be a valid file\ndescriptor.  The function should only be called from the main\nthread.\n\nChanged in version 3.5: On Windows, the function now also supports\nsocket handles.\n\nFile: python3.12.info,  Node: Exception Classes,  Next: Exception Objects,  Prev: Signal Handling<2>,  Up: Exception Handling\n\n\n-- C Function: *note PyObject: 6b1. *PyErrNewException (const char\n*name, PyObject *base, PyObject *dict)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  This utility function creates and returns a new exception\nclass.  The 'name' argument must be the name of the new exception,\na C string of the form 'module.classname'.  The 'base' and 'dict'\narguments are normally 'NULL'.  This creates a class object derived\nfrom *note Exception: 7ff. (accessible in C as 'PyExcException').\n\nThe 'module' attribute of the new class is set to the first\npart (up to the last dot) of the 'name' argument, and the class\nname is set to the last part (after the last dot).  The 'base'\nargument can be used to specify alternate base classes; it can\neither be only one class or a tuple of classes.  The 'dict'\nargument can be used to specify a dictionary of class variables and\nmethods.\n\n-- C Function: *note PyObject: 6b1. *PyErrNewExceptionWithDoc (const\nchar *name, const char *doc, PyObject *base, PyObject *dict)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Same as *note PyErrNewException(): 10e2, except that the\nnew exception class can easily be given a docstring: If 'doc' is\nnon-'NULL', it will be used as the docstring for the exception\nclass.\n\nNew in version 3.2.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Exception Objects,  Next: Unicode Exception Objects,  Prev: Exception Classes,  Up: Exception Handling": {
            "content": "-- C Function: *note PyObject: 6b1. *PyExceptionGetTraceback (PyObject\n*ex)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return the traceback associated with the exception as a new\nreference, as accessible from Python through the *note\ntraceback: 113c. attribute.  If there is no traceback\nassociated, this returns 'NULL'.\n\n-- C Function: int PyExceptionSetTraceback (PyObject *ex, PyObject\n*tb)\n' Part of the *note Stable ABI: 2ac.'  Set the traceback associated\nwith the exception to 'tb'.  Use 'PyNone' to clear it.\n\n-- C Function: *note PyObject: 6b1. *PyExceptionGetContext (PyObject\n*ex)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return the context (another exception instance during whose\nhandling 'ex' was raised) associated with the exception as a new\nreference, as accessible from Python through the *note context:\n113d. attribute.  If there is no context associated, this returns\n'NULL'.\n\n-- C Function: void PyExceptionSetContext (PyObject *ex, PyObject\n*ctx)\n' Part of the *note Stable ABI: 2ac.'  Set the context associated\nwith the exception to 'ctx'.  Use 'NULL' to clear it.  There is no\ntype check to make sure that 'ctx' is an exception instance.  This\nsteals a reference to 'ctx'.\n\n-- C Function: *note PyObject: 6b1. *PyExceptionGetCause (PyObject\n*ex)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return the cause (either an exception instance, or 'None',\nset by 'raise ... from ...') associated with the exception as a new\nreference, as accessible from Python through the *note cause:\n113e. attribute.\n\n-- C Function: void PyExceptionSetCause (PyObject *ex, PyObject\n*cause)\n' Part of the *note Stable ABI: 2ac.'  Set the cause associated\nwith the exception to 'cause'.  Use 'NULL' to clear it.  There is\nno type check to make sure that 'cause' is either an exception\ninstance or 'None'.  This steals a reference to 'cause'.\n\nThe *note suppresscontext: 1dbe. attribute is implicitly set\nto 'True' by this function.\n\n-- C Function: *note PyObject: 6b1. *PyExceptionGetArgs (PyObject *ex)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\nsince version 3.12.'  Return *note args: 2cb. of exception 'ex'.\n\n-- C Function: void PyExceptionSetArgs (PyObject *ex, PyObject *args)\n' Part of the *note Stable ABI: 2ac. since version 3.12.'  Set\n*note args: 2cb. of exception 'ex' to 'args'.\n\n-- C Function: *note PyObject: 6b1. *PyUnstableExcPrepReraiseStar\n(PyObject *orig, PyObject *excs)\n\nThis is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 29f. It may change without warning in minor releases.':\nImplement part of the interpreter's implementation of 'except*'.\n'orig' is the original exception that was caught, and 'excs' is the\nlist of the exceptions that need to be raised.  This list contains\nthe unhandled part of 'orig', if any, as well as the exceptions\nthat were raised from the 'except*' clauses (so they have a\ndifferent traceback from 'orig') and those that were reraised (and\nhave the same traceback as 'orig').  Return the *note\nExceptionGroup: 17b. that needs to be reraised in the end, or\n'None' if there is nothing to reraise.\n\nNew in version 3.12.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Unicode Exception Objects,  Next: Recursion Control,  Prev: Exception Objects,  Up: Exception Handling": {
            "content": "",
            "subsections": []
        },
        "The following functions are used to create and modify Unicode exceptions": {
            "content": "from C.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeDecodeErrorCreate (const\nchar *encoding, const char *object, Pyssizet length,\nPyssizet start, Pyssizet end, const char *reason)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Create a *note UnicodeDecodeError: 83c. object with the\nattributes 'encoding', 'object', 'length', 'start', 'end' and\n'reason'.  'encoding' and 'reason' are UTF-8 encoded strings.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeDecodeErrorGetEncoding\n(PyObject *exc)\n-- C Function: *note PyObject: 6b1. *PyUnicodeEncodeErrorGetEncoding\n(PyObject *exc)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return the 'encoding' attribute of the given exception\nobject.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeDecodeErrorGetObject\n(PyObject *exc)\n-- C Function: *note PyObject: 6b1. *PyUnicodeEncodeErrorGetObject\n(PyObject *exc)\n-- C Function: *note PyObject: 6b1. *PyUnicodeTranslateErrorGetObject\n(PyObject *exc)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return the 'object' attribute of the given exception object.\n\n-- C Function: int PyUnicodeDecodeErrorGetStart (PyObject *exc,\nPyssizet *start)\n-- C Function: int PyUnicodeEncodeErrorGetStart (PyObject *exc,\nPyssizet *start)\n-- C Function: int PyUnicodeTranslateErrorGetStart (PyObject *exc,\nPyssizet *start)\n' Part of the *note Stable ABI: 2ac.'  Get the 'start' attribute of\nthe given exception object and place it into '*start'.  'start'\nmust not be 'NULL'.  Return '0' on success, '-1' on failure.\n\n-- C Function: int PyUnicodeDecodeErrorSetStart (PyObject *exc,\nPyssizet start)\n-- C Function: int PyUnicodeEncodeErrorSetStart (PyObject *exc,\nPyssizet start)\n-- C Function: int PyUnicodeTranslateErrorSetStart (PyObject *exc,\nPyssizet start)\n' Part of the *note Stable ABI: 2ac.'  Set the 'start' attribute of\nthe given exception object to 'start'.  Return '0' on success, '-1'\non failure.\n\n-- C Function: int PyUnicodeDecodeErrorGetEnd (PyObject *exc,\nPyssizet *end)\n-- C Function: int PyUnicodeEncodeErrorGetEnd (PyObject *exc,\nPyssizet *end)\n-- C Function: int PyUnicodeTranslateErrorGetEnd (PyObject *exc,\nPyssizet *end)\n' Part of the *note Stable ABI: 2ac.'  Get the 'end' attribute of\nthe given exception object and place it into '*end'.  'end' must\nnot be 'NULL'.  Return '0' on success, '-1' on failure.\n\n-- C Function: int PyUnicodeDecodeErrorSetEnd (PyObject *exc,\nPyssizet end)\n-- C Function: int PyUnicodeEncodeErrorSetEnd (PyObject *exc,\nPyssizet end)\n-- C Function: int PyUnicodeTranslateErrorSetEnd (PyObject *exc,\nPyssizet end)\n' Part of the *note Stable ABI: 2ac.'  Set the 'end' attribute of\nthe given exception object to 'end'.  Return '0' on success, '-1'\non failure.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeDecodeErrorGetReason\n(PyObject *exc)\n-- C Function: *note PyObject: 6b1. *PyUnicodeEncodeErrorGetReason\n(PyObject *exc)\n-- C Function: *note PyObject: 6b1. *PyUnicodeTranslateErrorGetReason\n(PyObject *exc)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return the 'reason' attribute of the given exception object.\n\n-- C Function: int PyUnicodeDecodeErrorSetReason (PyObject *exc, const\nchar *reason)\n-- C Function: int PyUnicodeEncodeErrorSetReason (PyObject *exc, const\nchar *reason)\n-- C Function: int PyUnicodeTranslateErrorSetReason (PyObject *exc,\nconst char *reason)\n' Part of the *note Stable ABI: 2ac.'  Set the 'reason' attribute\nof the given exception object to 'reason'.  Return '0' on success,\n'-1' on failure.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Recursion Control,  Next: Standard Exceptions,  Prev: Unicode Exception Objects,  Up: Exception Handling": {
            "content": "",
            "subsections": []
        },
        "These two functions provide a way to perform safe recursive calls at the": {
            "content": "C level, both in the core and in extension modules.  They are needed if\nthe recursive code does not necessarily invoke Python code (which tracks\nits recursion depth automatically).  They are also not needed for\n'tpcall' implementations because the *note call protocol: 2e5. takes\ncare of recursion handling.\n\n-- C Function: int PyEnterRecursiveCall (const char *where)\n' Part of the *note Stable ABI: 2ac. since version 3.9.'  Marks a\npoint where a recursive C-level call is about to be performed.\n\nIf 'USESTACKCHECK' is defined, this function checks if the OS\nstack overflowed using *note PyOSCheckStack(): 1575.  If this is\nthe case, it sets a *note MemoryError: 13e3. and returns a nonzero\nvalue.\n\nThe function then checks if the recursion limit is reached.  If\nthis is the case, a *note RecursionError: bc6. is set and a nonzero\nvalue is returned.  Otherwise, zero is returned.\n\n'where' should be a UTF-8 encoded string such as '\" in instance\ncheck\"' to be concatenated to the *note RecursionError: bc6.\nmessage caused by the recursion depth limit.\n\nChanged in version 3.9: This function is now also available in the\n*note limited API: 2a8.\n\n-- C Function: void PyLeaveRecursiveCall (void)\n' Part of the *note Stable ABI: 2ac. since version 3.9.'  Ends a\n*note PyEnterRecursiveCall(): 797.  Must be called once for each\n'successful' invocation of *note PyEnterRecursiveCall(): 797.\n\nChanged in version 3.9: This function is now also available in the\n*note limited API: 2a8.\n\nProperly implementing *note tprepr: 46e5. for container types requires\nspecial recursion handling.  In addition to protecting the stack, *note\ntprepr: 46e5. also needs to track objects to prevent cycles.  The\nfollowing two functions facilitate this functionality.  Effectively,\nthese are the C equivalent to *note reprlib.recursiverepr(): 1067.\n\n-- C Function: int PyReprEnter (PyObject *object)\n' Part of the *note Stable ABI: 2ac.'  Called at the beginning of\nthe *note tprepr: 46e5. implementation to detect cycles.\n\nIf the object has already been processed, the function returns a\npositive integer.  In that case the *note tprepr: 46e5.\nimplementation should return a string object indicating a cycle.\nAs examples, *note dict: 237. objects return '{...}' and *note\nlist: 3dc. objects return '[...]'.\n\nThe function will return a negative integer if the recursion limit\nis reached.  In that case the *note tprepr: 46e5. implementation\nshould typically return 'NULL'.\n\nOtherwise, the function returns zero and the *note tprepr: 46e5.\nimplementation can continue normally.\n\n-- C Function: void PyReprLeave (PyObject *object)\n' Part of the *note Stable ABI: 2ac.'  Ends a *note PyReprEnter():\n48a8.  Must be called once for each invocation of *note\nPyReprEnter(): 48a8. that returns zero.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Standard Exceptions,  Next: Standard Warning Categories,  Prev: Recursion Control,  Up: Exception Handling": {
            "content": "",
            "subsections": []
        },
        "All standard Python exceptions are available as global variables whose": {
            "content": "names are 'PyExc' followed by the Python exception name.  These have\nthe type *note PyObject: 6b1.*; they are all class objects.  For\ncompleteness, here are all the variables:\n\nC Name                                        Python Name                           Notes\n\n---------------------------------------------------------------------------------------------------\n\n'PyExcBaseException'                         *note BaseException: 37c.             (1)\n\n\n'PyExcException'                             *note Exception: 7ff.                 (2)\n\n\n'PyExcArithmeticError'                       *note ArithmeticError: 1f93.          (3)\n\n\n'PyExcAssertionError'                        *note AssertionError: 476.\n\n\n'PyExcAttributeError'                        *note AttributeError: 395.\n\n\n'PyExcBlockingIOError'                       *note BlockingIOError: ed0.\n\n\n'PyExcBrokenPipeError'                       *note BrokenPipeError: ed5.\n\n\n'PyExcBufferError'                           *note BufferError: 1586.\n\n\n'PyExcChildProcessError'                     *note ChildProcessError: ed1.\n\n\n'PyExcConnectionAbortedError'                *note ConnectionAbortedError: ed6.\n\n\n'PyExcConnectionError'                       *note ConnectionError: c67.\n\n\n'PyExcConnectionRefusedError'                *note ConnectionRefusedError: ed7.\n\n\n'PyExcConnectionResetError'                  *note ConnectionResetError: ed8.\n\n\n'PyExcEOFError'                              *note EOFError: 114e.\n\n\n'PyExcFileExistsError'                       *note FileExistsError: e97.\n\n\n'PyExcFileNotFoundError'                     *note FileNotFoundError: 353.\n\n\n'PyExcFloatingPointError'                    *note FloatingPointError: 1f94.\n\n\n'PyExcGeneratorExit'                         *note GeneratorExit: 121c.\n\n\n'PyExcImportError'                           *note ImportError: 145.\n\n\n'PyExcIndentationError'                      *note IndentationError: 59a.\n\n\n'PyExcIndexError'                            *note IndexError: 138f.\n\n\n'PyExcInterruptedError'                      *note InterruptedError: be3.\n\n\n'PyExcIsADirectoryError'                     *note IsADirectoryError: ed2.\n\n\n'PyExcKeyError'                              *note KeyError: 8cf.\n\n\n'PyExcKeyboardInterrupt'                     *note KeyboardInterrupt: 7f5.\n\n\n'PyExcLookupError'                           *note LookupError: 1ed9.              (4)\n\n\n'PyExcMemoryError'                           *note MemoryError: 13e3.\n\n\n'PyExcModuleNotFoundError'                   *note ModuleNotFoundError: 981.\n\n\n'PyExcNameError'                             *note NameError: 144.\n\n\n'PyExcNotADirectoryError'                    *note NotADirectoryError: ed3.\n\n\n'PyExcNotImplementedError'                   *note NotImplementedError: ba5.\n\n\n'PyExcOSError'                               *note OSError: 613.                   (5)\n\n\n'PyExcOverflowError'                         *note OverflowError: 68d.\n\n\n'PyExcPermissionError'                       *note PermissionError: b9a.\n\n\n'PyExcProcessLookupError'                    *note ProcessLookupError: ed4.\n\n\n'PyExcRecursionError'                        *note RecursionError: bc6.\n\n\n'PyExcReferenceError'                        *note ReferenceError: 1369.\n\n\n'PyExcRuntimeError'                          *note RuntimeError: 17a.\n\n\n'PyExcStopAsyncIteration'                    *note StopAsyncIteration: 17a6.\n\n\n'PyExcStopIteration'                         *note StopIteration: a40.\n\n\n'PyExcSyntaxError'                           *note SyntaxError: 146.\n\n\n'PyExcSystemError'                           *note SystemError: 2d7.\n\n\n'PyExcSystemExit'                            *note SystemExit: b97.\n\n\n'PyExcTabError'                              *note TabError: 29b.\n\n\n'PyExcTimeoutError'                          *note TimeoutError: 62a.\n\n\n'PyExcTypeError'                             *note TypeError: 28e.\n\n\n'PyExcUnboundLocalError'                     *note UnboundLocalError: 1390.\n\n\n'PyExcUnicodeDecodeError'                    *note UnicodeDecodeError: 83c.\n\n\n'PyExcUnicodeEncodeError'                    *note UnicodeEncodeError: 442.\n\n\n'PyExcUnicodeError'                          *note UnicodeError: 111b.\n\n\n'PyExcUnicodeTranslateError'                 *note UnicodeTranslateError: 1fac.\n\n\n'PyExcValueError'                            *note ValueError: 183.\n\n\n'PyExcZeroDivisionError'                     *note ZeroDivisionError: 763.\n\n",
            "subsections": []
        },
        "New in version 3.3: 'PyExcBlockingIOError', 'PyExcBrokenPipeError',": {
            "content": "'PyExcChildProcessError', 'PyExcConnectionError',\n'PyExcConnectionAbortedError', 'PyExcConnectionRefusedError',\n'PyExcConnectionResetError', 'PyExcFileExistsError',\n'PyExcFileNotFoundError', 'PyExcInterruptedError',\n'PyExcIsADirectoryError', 'PyExcNotADirectoryError',\n'PyExcPermissionError', 'PyExcProcessLookupError' and\n'PyExcTimeoutError' were introduced following PEP 3151(6).\n",
            "subsections": []
        },
        "New in version 3.5: 'PyExcStopAsyncIteration' and": {
            "content": "'PyExcRecursionError'.\n\nNew in version 3.6: 'PyExcModuleNotFoundError'.\n\nThese are compatibility aliases to 'PyExcOSError':\n\nC Name                                    Notes\n\n---------------------------------------------------------\n\n'PyExcEnvironmentError'\n\n'PyExcIOError'\n\n'PyExcWindowsError'                      (7)\n\n",
            "subsections": []
        },
        "Changed in version 3.3: These aliases used to be separate exception": {
            "content": "types.\n\nNotes:\n\n---------- Footnotes ----------\n\n(1) This is a base class for other standard exceptions.\n\n(2) This is a base class for other standard exceptions.\n\n(3) This is a base class for other standard exceptions.\n\n(4) This is a base class for other standard exceptions.\n\n(5) This is a base class for other standard exceptions.\n\n(6) https://peps.python.org/pep-3151/\n\n(7) Only defined on Windows; protect code that uses this by testing\nthat the preprocessor macro 'MSWINDOWS' is defined.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Standard Warning Categories,  Prev: Standard Exceptions,  Up: Exception Handling": {
            "content": "",
            "subsections": []
        },
        "All standard Python warning categories are available as global variables": {
            "content": "whose names are 'PyExc' followed by the Python exception name.  These\nhave the type *note PyObject: 6b1.*; they are all class objects.  For\ncompleteness, here are all the variables:\n\nC Name                                         Python Name                           Notes\n\n----------------------------------------------------------------------------------------------------\n\n'PyExcWarning'                                *note Warning: 1fc2.                  (1)\n\n\n'PyExcBytesWarning'                           *note BytesWarning: a6b.\n\n\n'PyExcDeprecationWarning'                     *note DeprecationWarning: 179.\n\n\n'PyExcFutureWarning'                          *note FutureWarning: 23f.\n\n\n'PyExcImportWarning'                          *note ImportWarning: 243.\n\n\n'PyExcPendingDeprecationWarning'              *note PendingDeprecationWarning: 6e0.\n\n\n'PyExcResourceWarning'                        *note ResourceWarning: a86.\n\n\n'PyExcRuntimeWarning'                         *note RuntimeWarning: 8c9.\n\n\n'PyExcSyntaxWarning'                          *note SyntaxWarning: 178.\n\n\n'PyExcUnicodeWarning'                         *note UnicodeWarning: 127a.\n\n\n'PyExcUserWarning'                            *note UserWarning: 1fc3.\n\n\nNew in version 3.2: 'PyExcResourceWarning'.\n\nNotes:\n\n---------- Footnotes ----------\n\n(1) This is a base class for other standard warning categories.\n\nFile: python3.12.info,  Node: Utilities<2>,  Next: Abstract Objects Layer,  Prev: Exception Handling,  Up: Python/C API Reference Manual\n",
            "subsections": [
                {
                    "name": "7.6 Utilities",
                    "content": ""
                }
            ]
        },
        "The functions in this chapter perform various utility tasks, ranging": {
            "content": "from helping C code be more portable across platforms, using Python\nmodules from C, and parsing function arguments and constructing Python\nvalues from C values.\n\n* Menu:\n\n* Operating System Utilities::\n* System Functions::\n* Process Control::\n* Importing Modules: Importing Modules<2>.\n* Data marshalling support::\n* Parsing arguments and building values::\n* String conversion and formatting::\n* PyHash API::\n* Reflection::\n* Codec registry and support functions::\n* Support for Perf Maps::\n\nFile: python3.12.info,  Node: Operating System Utilities,  Next: System Functions,  Up: Utilities<2>\n\n\n-- C Function: *note PyObject: 6b1. *PyOSFSPath (PyObject *path)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\nsince version 3.6.'  Return the file system representation for\n'path'.  If the object is a *note str: 157. or *note bytes: 295.\nobject, then a new *note strong reference: 57c. is returned.  If\nthe object implements the *note os.PathLike: a9a. interface, then\n*note fspath(): a9b. is returned as long as it is a *note str:\n157. or *note bytes: 295. object.  Otherwise *note TypeError: 28e.\nis raised and 'NULL' is returned.\n\nNew in version 3.6.\n\n-- C Function: int PyFdIsInteractive (FILE *fp, const char *filename)\n\nReturn true (nonzero) if the standard I/O file 'fp' with name\n'filename' is deemed interactive.  This is the case for files for\nwhich 'isatty(fileno(fp))' is true.  If the *note\nPyConfig.interactive: 2f7. is non-zero, this function also returns\ntrue if the 'filename' pointer is 'NULL' or if the name is equal to\none of the strings ''<stdin>'' or ''???''.\n\nThis function must not be called before Python is initialized.\n\n-- C Function: void PyOSBeforeFork ()\n' Part of the *note Stable ABI: 2ac. on platforms with fork() since\nversion 3.7.'  Function to prepare some internal state before a\nprocess fork.  This should be called before calling 'fork()' or any\nsimilar function that clones the current process.  Only available\non systems where 'fork()' is defined.\n\nWarning: The C 'fork()' call should only be made from the\n*note \"main\" thread: 4904. (of the *note \"main\" interpreter:\n2e9.).  The same is true for 'PyOSBeforeFork()'.\n\nNew in version 3.7.\n\n-- C Function: void PyOSAfterForkParent ()\n' Part of the *note Stable ABI: 2ac. on platforms with fork() since\nversion 3.7.'  Function to update some internal state after a\nprocess fork.  This should be called from the parent process after\ncalling 'fork()' or any similar function that clones the current\nprocess, regardless of whether process cloning was successful.\nOnly available on systems where 'fork()' is defined.\n\nWarning: The C 'fork()' call should only be made from the\n*note \"main\" thread: 4904. (of the *note \"main\" interpreter:\n2e9.).  The same is true for 'PyOSAfterForkParent()'.\n\nNew in version 3.7.\n\n-- C Function: void PyOSAfterForkChild ()\n' Part of the *note Stable ABI: 2ac. on platforms with fork() since\nversion 3.7.'  Function to update internal interpreter state after\na process fork.  This must be called from the child process after\ncalling 'fork()', or any similar function that clones the current\nprocess, if there is any chance the process will call back into the\nPython interpreter.  Only available on systems where 'fork()' is\ndefined.\n\nWarning: The C 'fork()' call should only be made from the\n*note \"main\" thread: 4904. (of the *note \"main\" interpreter:\n2e9.).  The same is true for 'PyOSAfterForkChild()'.\n\nNew in version 3.7.\n\nSee also\n........\n\n*note os.registeratfork(): 99a. allows registering custom Python\nfunctions to be called by *note PyOSBeforeFork(): a03, *note\nPyOSAfterForkParent(): a04. and *note PyOSAfterForkChild():\n33b.\n\n-- C Function: void PyOSAfterFork ()\n' Part of the *note Stable ABI: 2ac. on platforms with fork().'\nFunction to update some internal state after a process fork; this\nshould be called in the new process if the Python interpreter will\ncontinue to be used.  If a new executable is loaded into the new\nprocess, this function does not need to be called.\n\nDeprecated since version 3.7: This function is superseded by *note\nPyOSAfterForkChild(): 33b.\n\n-- C Function: int PyOSCheckStack ()\n' Part of the *note Stable ABI: 2ac. on platforms with\nUSESTACKCHECK since version 3.7.'\n\nReturn true when the interpreter runs out of stack space.  This is\na reliable check, but is only available when 'USESTACKCHECK' is\ndefined (currently on certain versions of Windows using the\nMicrosoft Visual C++ compiler).  'USESTACKCHECK' will be defined\nautomatically; you should never change the definition in your own\ncode.\n\n-- C Type: typedef void (*PyOSsighandlert)(int)\n' Part of the *note Stable ABI: 2ac.'\n\n-- C Function: *note PyOSsighandlert: 4810. PyOSgetsig (int i)\n' Part of the *note Stable ABI: 2ac.'  Return the current signal\nhandler for signal 'i'.  This is a thin wrapper around either\n'sigaction()' or 'signal()'.  Do not call those functions directly!\n\n-- C Function: *note PyOSsighandlert: 4810. PyOSsetsig (int i,\nPyOSsighandlert h)\n' Part of the *note Stable ABI: 2ac.'  Set the signal handler for\nsignal 'i' to be 'h'; return the old signal handler.  This is a\nthin wrapper around either 'sigaction()' or 'signal()'.  Do not\ncall those functions directly!\n\n-- C Function: wchart *PyDecodeLocale (const char *arg, sizet *size)\n' Part of the *note Stable ABI: 2ac. since version 3.7.'\nWarning: This function should not be called directly: use the\n*note PyConfig: 318. API with the *note\nPyConfigSetBytesString(): 7d8. function which ensures that\n*note Python is preinitialized: 3980.\n\nThis function must not be called before *note Python is\npreinitialized: 3980. and so that the LCCTYPE locale is\nproperly configured: see the *note PyPreInitialize(): 316.\nfunction.\n\nDecode a byte string from the *note filesystem encoding and error\nhandler: 291.  If the error handler is *note surrogateescape error\nhandler: 20f3, undecodable bytes are decoded as characters in range\nU+DC80..U+DCFF; and if a byte sequence can be decoded as a\nsurrogate character, the bytes are escaped using the\nsurrogateescape error handler instead of decoding them.\n\nReturn a pointer to a newly allocated wide character string, use\n*note PyMemRawFree(): 4905. to free the memory.  If size is not\n'NULL', write the number of wide characters excluding the null\ncharacter into '*size'\n\nReturn 'NULL' on decoding error or memory allocation error.  If\n'size' is not 'NULL', '*size' is set to '(sizet)-1' on memory\nerror or set to '(sizet)-2' on decoding error.\n\nThe *note filesystem encoding and error handler: 291. are selected\nby *note PyConfigRead(): 57e.: see *note filesystemencoding: 313.\nand *note filesystemerrors: 314. members of *note PyConfig: 318.\n\nDecoding errors should never happen, unless there is a bug in the C\nlibrary.\n\nUse the *note PyEncodeLocale(): a0c. function to encode the\ncharacter string back to a byte string.\n\nSee also\n........\n\nThe *note PyUnicodeDecodeFSDefaultAndSize(): 487f. and *note\nPyUnicodeDecodeLocaleAndSize(): a0d. functions.\n\nNew in version 3.5.\n\nChanged in version 3.7: The function now uses the UTF-8 encoding in\nthe *note Python UTF-8 Mode: 420.\n\nChanged in version 3.8: The function now uses the UTF-8 encoding on\nWindows if *note PyPreConfig.legacywindowsfsencoding: 310. is\nzero;\n\n-- C Function: char *PyEncodeLocale (const wchart *text, sizet\n*errorpos)\n' Part of the *note Stable ABI: 2ac. since version 3.7.'  Encode a\nwide character string to the *note filesystem encoding and error\nhandler: 291.  If the error handler is *note surrogateescape error\nhandler: 20f3, surrogate characters in the range U+DC80..U+DCFF are\nconverted to bytes 0x80..0xFF.\n\nReturn a pointer to a newly allocated byte string, use *note\nPyMemFree(): 129a. to free the memory.  Return 'NULL' on encoding\nerror or memory allocation error.\n\nIf errorpos is not 'NULL', '*errorpos' is set to '(sizet)-1' on\nsuccess, or set to the index of the invalid character on encoding\nerror.\n\nThe *note filesystem encoding and error handler: 291. are selected\nby *note PyConfigRead(): 57e.: see *note filesystemencoding: 313.\nand *note filesystemerrors: 314. members of *note PyConfig: 318.\n\nUse the *note PyDecodeLocale(): a0b. function to decode the bytes\nstring back to a wide character string.\n\nWarning: This function must not be called before *note Python\nis preinitialized: 3980. and so that the LCCTYPE locale is\nproperly configured: see the *note PyPreInitialize(): 316.\nfunction.\n\nSee also\n........\n\nThe *note PyUnicodeEncodeFSDefault(): 17d1. and *note\nPyUnicodeEncodeLocale(): a0e. functions.\n\nNew in version 3.5.\n\nChanged in version 3.7: The function now uses the UTF-8 encoding in\nthe *note Python UTF-8 Mode: 420.\n\nChanged in version 3.8: The function now uses the UTF-8 encoding on\nWindows if *note PyPreConfig.legacywindowsfsencoding: 310. is\nzero.\n\nFile: python3.12.info,  Node: System Functions,  Next: Process Control,  Prev: Operating System Utilities,  Up: Utilities<2>\n\n\nThese are utility functions that make functionality from the *note sys:\nd3. module accessible to C code.  They all work with the current\ninterpreter thread's *note sys: d3. module's dict, which is contained in\nthe internal thread state structure.\n\n-- C Function: *note PyObject: 6b1. *PySysGetObject (const char *name)\n'Return value: Borrowed reference.''  Part of the *note Stable ABI:\n2ac.'  Return the object 'name' from the *note sys: d3. module or\n'NULL' if it does not exist, without setting an exception.\n\n-- C Function: int PySysSetObject (const char *name, PyObject *v)\n' Part of the *note Stable ABI: 2ac.'  Set 'name' in the *note sys:\nd3. module to 'v' unless 'v' is 'NULL', in which case 'name' is\ndeleted from the sys module.  Returns '0' on success, '-1' on\nerror.\n\n-- C Function: void PySysResetWarnOptions ()\n' Part of the *note Stable ABI: 2ac.'  Reset *note sys.warnoptions:\n328. to an empty list.  This function may be called prior to *note\nPyInitialize(): 6c2.\n\n-- C Function: void PySysAddWarnOption (const wchart *s)\n' Part of the *note Stable ABI: 2ac.'  This API is kept for\nbackward compatibility: setting *note PyConfig.warnoptions: 4908.\nshould be used instead, see *note Python Initialization\nConfiguration: 581.\n\nAppend 's' to *note sys.warnoptions: 328.  This function must be\ncalled prior to *note PyInitialize(): 6c2. in order to affect the\nwarnings filter list.\n\nDeprecated since version 3.11.\n\n-- C Function: void PySysAddWarnOptionUnicode (PyObject *unicode)\n' Part of the *note Stable ABI: 2ac.'  This API is kept for\nbackward compatibility: setting *note PyConfig.warnoptions: 4908.\nshould be used instead, see *note Python Initialization\nConfiguration: 581.\n\nAppend 'unicode' to *note sys.warnoptions: 328.\n\nNote: this function is not currently usable from outside the\nCPython implementation, as it must be called prior to the implicit\nimport of *note warnings: 10d. in *note PyInitialize(): 6c2. to be\neffective, but can't be called until enough of the runtime has been\ninitialized to permit the creation of Unicode objects.\n\nDeprecated since version 3.11.\n\n-- C Function: void PySysSetPath (const wchart *path)\n' Part of the *note Stable ABI: 2ac.'  This API is kept for\nbackward compatibility: setting *note PyConfig.modulesearchpaths:\n3b6. and *note PyConfig.modulesearchpathsset: 3b5. should be\nused instead, see *note Python Initialization Configuration: 581.\n\nSet *note sys.path: 32c. to a list object of paths found in 'path'\nwhich should be a list of paths separated with the platform's\nsearch path delimiter (':' on Unix, ';' on Windows).\n\nDeprecated since version 3.11.\n\n-- C Function: void PySysWriteStdout (const char *format, ...)\n' Part of the *note Stable ABI: 2ac.'  Write the output string\ndescribed by 'format' to *note sys.stdout: 90c.  No exceptions are\nraised, even if truncation occurs (see below).\n\n'format' should limit the total size of the formatted output string\nto 1000 bytes or less - after 1000 bytes, the output string is\ntruncated.  In particular, this means that no unrestricted \"%s\"\nformats should occur; these should be limited using \"%.<N>s\" where\n<N> is a decimal number calculated so that <N> plus the maximum\nsize of other formatted text does not exceed 1000 bytes.  Also\nwatch out for \"%f\", which can print hundreds of digits for very\nlarge numbers.\n\nIf a problem occurs, or *note sys.stdout: 90c. is unset, the\nformatted message is written to the real (C level) 'stdout'.\n\n-- C Function: void PySysWriteStderr (const char *format, ...)\n' Part of the *note Stable ABI: 2ac.'  As *note\nPySysWriteStdout(): 4850, but write to *note sys.stderr: 757. or\n'stderr' instead.\n\n-- C Function: void PySysFormatStdout (const char *format, ...)\n' Part of the *note Stable ABI: 2ac.'  Function similar to\nPySysWriteStdout() but format the message using *note\nPyUnicodeFromFormatV(): 2d6. and don't truncate the message to an\narbitrary length.\n\nNew in version 3.2.\n\n-- C Function: void PySysFormatStderr (const char *format, ...)\n' Part of the *note Stable ABI: 2ac.'  As *note\nPySysFormatStdout(): 484c, but write to *note sys.stderr: 757. or\n'stderr' instead.\n\nNew in version 3.2.\n\n-- C Function: void PySysAddXOption (const wchart *s)\n' Part of the *note Stable ABI: 2ac. since version 3.7.'  This API\nis kept for backward compatibility: setting *note\nPyConfig.xoptions: 4909. should be used instead, see *note Python\nInitialization Configuration: 581.\n\nParse 's' as a set of *note -X: 188. options and add them to the\ncurrent options mapping as returned by *note PySysGetXOptions():\n484d.  This function may be called prior to *note PyInitialize():\n6c2.\n\nNew in version 3.2.\n\nDeprecated since version 3.11.\n\n-- C Function: *note PyObject: 6b1. *PySysGetXOptions ()\n'Return value: Borrowed reference.''  Part of the *note Stable ABI:\n2ac. since version 3.7.'  Return the current dictionary of *note\n-X: 188. options, similarly to *note sys.xoptions: 1ac1.  On\nerror, 'NULL' is returned and an exception is set.\n\nNew in version 3.2.\n\n-- C Function: int PySysAudit (const char *event, const char *format,\n...)\n\nRaise an auditing event with any active hooks.  Return zero for\nsuccess and non-zero with an exception set on failure.\n\nIf any hooks have been added, 'format' and other arguments will be\nused to construct a tuple to pass.  Apart from 'N', the same format\ncharacters as used in *note PyBuildValue(): 6bb. are available.\nIf the built value is not a tuple, it will be added into a\nsingle-element tuple.  (The 'N' format option consumes a reference,\nbut since there is no way to know whether arguments to this\nfunction will be consumed, using it may cause reference leaks.)\n\nNote that '#' format characters should always be treated as *note\nPyssizet: 88d, regardless of whether 'PYSSIZETCLEAN' was\ndefined.\n\n*note sys.audit(): 16dc. performs the same function from Python\ncode.\n\nNew in version 3.8.\n\nChanged in version 3.8.2: Require *note Pyssizet: 88d. for '#'\nformat characters.  Previously, an unavoidable deprecation warning\nwas raised.\n\n-- C Function: int PySysAddAuditHook (PyAuditHookFunction hook, void\n*userData)\n\nAppend the callable 'hook' to the list of active auditing hooks.\nReturn zero on success and non-zero on failure.  If the runtime has\nbeen initialized, also set an error on failure.  Hooks added\nthrough this API are called for all interpreters created by the\nruntime.\n\nThe 'userData' pointer is passed into the hook function.  Since\nhook functions may be called from different runtimes, this pointer\nshould not refer directly to Python state.\n\nThis function is safe to call before *note PyInitialize(): 6c2.\nWhen called after runtime initialization, existing audit hooks are\nnotified and may silently abort the operation by raising an error\nsubclassed from *note Exception: 7ff. (other errors will not be\nsilenced).\n\nThe hook function is always called with the GIL held by the Python\ninterpreter that raised the event.\n\nSee PEP 578(1) for a detailed description of auditing.  Functions\nin the runtime and standard library that raise events are listed in\nthe *note audit events table: 15d2.  Details are in each function's\ndocumentation.\n\nIf the interpreter is initialized, this function raises an auditing\nevent 'sys.addaudithook' with no arguments.  If any existing hooks\nraise an exception derived from *note Exception: 7ff, the new hook\nwill not be added and the exception is cleared.  As a result,\ncallers cannot assume that their hook has been added unless they\ncontrol all existing hooks.\n\n-- C Type: typedef int (*PyAuditHookFunction)(const char *event,\n*note PyObject: 6b1. *args, void *userData)\n\nThe type of the hook function.  'event' is the C string event\nargument passed to *note PySysAudit(): 16ec.  'args' is\nguaranteed to be a *note PyTupleObject: 490b.  'userData' is\nthe argument passed to PySysAddAuditHook().\n\nNew in version 3.8.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0578/\n\nFile: python3.12.info,  Node: Process Control,  Next: Importing Modules<2>,  Prev: System Functions,  Up: Utilities<2>\n\n\n-- C Function: void PyFatalError (const char *message)\n' Part of the *note Stable ABI: 2ac.'\n\nPrint a fatal error message and kill the process.  No cleanup is\nperformed.  This function should only be invoked when a condition\nis detected that would make it dangerous to continue using the\nPython interpreter; e.g., when the object administration appears to\nbe corrupted.  On Unix, the standard C library function 'abort()'\nis called which will attempt to produce a 'core' file.\n\nThe 'PyFatalError()' function is replaced with a macro which logs\nautomatically the name of the current function, unless the\n'PyLIMITEDAPI' macro is defined.\n\nChanged in version 3.9: Log the function name automatically.\n\n-- C Function: void PyExit (int status)\n' Part of the *note Stable ABI: 2ac.'\n\nExit the current process.  This calls *note PyFinalizeEx(): b67.\nand then calls the standard C library function 'exit(status)'.  If\n*note PyFinalizeEx(): b67. indicates an error, the exit status is\nset to 120.\n\nChanged in version 3.6: Errors from finalization no longer ignored.\n\n-- C Function: int PyAtExit (void (*func)())\n' Part of the *note Stable ABI: 2ac.'\n\nRegister a cleanup function to be called by *note PyFinalizeEx():\nb67.  The cleanup function will be called with no arguments and\nshould return no value.  At most 32 cleanup functions can be\nregistered.  When the registration is successful, *note\nPyAtExit(): 489d. returns '0'; on failure, it returns '-1'.  The\ncleanup function registered last is called first.  Each cleanup\nfunction will be called at most once.  Since Python's internal\nfinalization will have completed before the cleanup function, no\nPython APIs should be called by 'func'.\n\nFile: python3.12.info,  Node: Importing Modules<2>,  Next: Data marshalling support,  Prev: Process Control,  Up: Utilities<2>\n\n\n-- C Function: *note PyObject: 6b1. *PyImportImportModule (const char\n*name)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'\n\nThis is a wrapper around *note PyImportImport(): 1253. which takes\na const char* as an argument instead of a *note PyObject: 6b1.*.\n\n-- C Function: *note PyObject: 6b1. *PyImportImportModuleNoBlock\n(const char *name)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  This function is a deprecated alias of *note\nPyImportImportModule(): 325.\n\nChanged in version 3.3: This function used to fail immediately when\nthe import lock was held by another thread.  In Python 3.3 though,\nthe locking scheme switched to per-module locks for most purposes,\nso this function's special behaviour isn't needed anymore.\n\n-- C Function: *note PyObject: 6b1. *PyImportImportModuleEx (const\nchar *name, PyObject *globals, PyObject *locals, PyObject\n*fromlist)\n'Return value: New reference.'\n\nImport a module.  This is best described by referring to the\nbuilt-in Python function *note import(): 6ed.\n\nThe return value is a new reference to the imported module or\ntop-level package, or 'NULL' with an exception set on failure.\nLike for *note import(): 6ed, the return value when a submodule\nof a package was requested is normally the top-level package,\nunless a non-empty 'fromlist' was given.\n\nFailing imports remove incomplete module objects, like with *note\nPyImportImportModule(): 325.\n\n-- C Function: *note PyObject: 6b1. *PyImportImportModuleLevelObject\n(PyObject *name, PyObject *globals, PyObject *locals, PyObject\n*fromlist, int level)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\nsince version 3.7.'  Import a module.  This is best described by\nreferring to the built-in Python function *note import(): 6ed,\nas the standard *note import(): 6ed. function calls this\nfunction directly.\n\nThe return value is a new reference to the imported module or\ntop-level package, or 'NULL' with an exception set on failure.\nLike for *note import(): 6ed, the return value when a submodule\nof a package was requested is normally the top-level package,\nunless a non-empty 'fromlist' was given.\n\nNew in version 3.3.\n\n-- C Function: *note PyObject: 6b1. *PyImportImportModuleLevel (const\nchar *name, PyObject *globals, PyObject *locals, PyObject\n*fromlist, int level)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Similar to *note PyImportImportModuleLevelObject(): 47c7,\nbut the name is a UTF-8 encoded string instead of a Unicode object.\n\nChanged in version 3.3: Negative values for 'level' are no longer\naccepted.\n\n-- C Function: *note PyObject: 6b1. *PyImportImport (PyObject *name)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  This is a higher-level interface that calls the current\n\"import hook function\" (with an explicit 'level' of 0, meaning\nabsolute import).  It invokes the *note import(): 6ed. function\nfrom the 'builtins' of the current globals.  This means that\nthe import is done using whatever import hooks are installed in the\ncurrent environment.\n\nThis function always uses absolute imports.\n\n-- C Function: *note PyObject: 6b1. *PyImportReloadModule (PyObject\n*m)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Reload a module.  Return a new reference to the reloaded\nmodule, or 'NULL' with an exception set on failure (the module\nstill exists in this case).\n\n-- C Function: *note PyObject: 6b1. *PyImportAddModuleObject (PyObject\n*name)\n'Return value: Borrowed reference.''  Part of the *note Stable ABI:\n2ac. since version 3.7.'  Return the module object corresponding to\na module name.  The 'name' argument may be of the form\n'package.module'.  First check the modules dictionary if there's\none there, and if not, create a new one and insert it in the\nmodules dictionary.  Return 'NULL' with an exception set on\nfailure.\n\nNote: This function does not load or import the module; if the\nmodule wasn't already loaded, you will get an empty module\nobject.  Use *note PyImportImportModule(): 325. or one of its\nvariants to import a module.  Package structures implied by a\ndotted name for 'name' are not created if not already present.\n\nNew in version 3.3.\n\n-- C Function: *note PyObject: 6b1. *PyImportAddModule (const char\n*name)\n'Return value: Borrowed reference.''  Part of the *note Stable ABI:\n2ac.'  Similar to *note PyImportAddModuleObject(): 47be, but the\nname is a UTF-8 encoded string instead of a Unicode object.\n\n-- C Function: *note PyObject: 6b1. *PyImportExecCodeModule (const\nchar *name, PyObject *co)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'\n\nGiven a module name (possibly of the form 'package.module') and a\ncode object read from a Python bytecode file or obtained from the\nbuilt-in function *note compile(): 528, load the module.  Return a\nnew reference to the module object, or 'NULL' with an exception set\nif an error occurred.  'name' is removed from *note sys.modules:\n16d7. in error cases, even if 'name' was already in *note\nsys.modules: 16d7. on entry to *note PyImportExecCodeModule():\n47bf.  Leaving incompletely initialized modules in *note\nsys.modules: 16d7. is dangerous, as imports of such modules have no\nway to know that the module object is an unknown (and probably\ndamaged with respect to the module author's intents) state.\n\nThe module's *note spec: 1d09. and *note loader: e95. will\nbe set, if not set already, with the appropriate values.  The\nspec's loader will be set to the module's 'loader' (if set) and\nto an instance of *note SourceFileLoader: eeb. otherwise.\n\nThe module's *note file: 1c32. attribute will be set to the\ncode object's *note cofilename: 11e1.  If applicable, *note\ncached: 1029. will also be set.\n\nThis function will reload the module if it was already imported.\nSee *note PyImportReloadModule(): 47c8. for the intended way to\nreload a module.\n\nIf 'name' points to a dotted name of the form 'package.module', any\npackage structures not already created will still not be created.\n\nSee also *note PyImportExecCodeModuleEx(): 47c0. and *note\nPyImportExecCodeModuleWithPathnames(): 47c2.\n\nChanged in version 3.12: The setting of *note cached: 1029. and\n*note loader: e95. is deprecated.  See *note ModuleSpec: 1d07.\nfor alternatives.\n\n-- C Function: *note PyObject: 6b1. *PyImportExecCodeModuleEx (const\nchar *name, PyObject *co, const char *pathname)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Like *note PyImportExecCodeModule(): 47bf, but the *note\nfile: 1c32. attribute of the module object is set to 'pathname'\nif it is non-'NULL'.\n\nSee also *note PyImportExecCodeModuleWithPathnames(): 47c2.\n\n-- C Function: *note PyObject: 6b1. *PyImportExecCodeModuleObject\n(PyObject *name, PyObject *co, PyObject *pathname, PyObject\n*cpathname)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\nsince version 3.7.'  Like *note PyImportExecCodeModuleEx(): 47c0,\nbut the *note cached: 1029. attribute of the module object is\nset to 'cpathname' if it is non-'NULL'.  Of the three functions,\nthis is the preferred one to use.\n\nNew in version 3.3.\n\nChanged in version 3.12: Setting *note cached: 1029. is\ndeprecated.  See *note ModuleSpec: 1d07. for alternatives.\n\n-- C Function: *note PyObject: 6b1.\n*PyImportExecCodeModuleWithPathnames (const char *name,\nPyObject *co, const char *pathname, const char *cpathname)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Like *note PyImportExecCodeModuleObject(): 47c1, but\n'name', 'pathname' and 'cpathname' are UTF-8 encoded strings.\nAttempts are also made to figure out what the value for 'pathname'\nshould be from 'cpathname' if the former is set to 'NULL'.\n\nNew in version 3.2.\n\nChanged in version 3.3: Uses 'imp.sourcefromcache()' in\ncalculating the source path if only the bytecode path is provided.\n\nChanged in version 3.12: No longer uses the removed 'imp' module.\n\n-- C Function: long PyImportGetMagicNumber ()\n' Part of the *note Stable ABI: 2ac.'  Return the magic number for\nPython bytecode files (a.k.a.  '.pyc' file).  The magic number\nshould be present in the first four bytes of the bytecode file, in\nlittle-endian byte order.  Returns '-1' on error.\n\nChanged in version 3.3: Return value of '-1' upon failure.\n\n-- C Function: const char *PyImportGetMagicTag ()\n' Part of the *note Stable ABI: 2ac.'  Return the magic tag string\nfor PEP 3147(1) format Python bytecode file names.  Keep in mind\nthat the value at 'sys.implementation.cachetag' is authoritative\nand should be used instead of this function.\n\nNew in version 3.2.\n\n-- C Function: *note PyObject: 6b1. *PyImportGetModuleDict ()\n'Return value: Borrowed reference.''  Part of the *note Stable ABI:\n2ac.'  Return the dictionary used for the module administration\n(a.k.a.  'sys.modules').  Note that this is a per-interpreter\nvariable.\n\n-- C Function: *note PyObject: 6b1. *PyImportGetModule (PyObject\n*name)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\nsince version 3.8.'  Return the already imported module with the\ngiven name.  If the module has not been imported yet then returns\n'NULL' but does not set an error.  Returns 'NULL' and sets an error\nif the lookup failed.\n\nNew in version 3.7.\n\n-- C Function: *note PyObject: 6b1. *PyImportGetImporter (PyObject\n*path)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a finder object for a *note sys.path:\n32c./'pkg.path' item 'path', possibly by fetching it from the\n*note sys.pathimportercache: 3a9. dict.  If it wasn't yet cached,\ntraverse *note sys.pathhooks: e9b. until a hook is found that can\nhandle the path item.  Return 'None' if no hook could; this tells\nour caller that the *note path based finder: 1d01. could not find a\nfinder for this path item.  Cache the result in *note\nsys.pathimportercache: 3a9.  Return a new reference to the finder\nobject.\n\n-- C Function: int PyImportImportFrozenModuleObject (PyObject *name)\n' Part of the *note Stable ABI: 2ac. since version 3.7.'  Load a\nfrozen module named 'name'.  Return '1' for success, '0' if the\nmodule is not found, and '-1' with an exception set if the\ninitialization failed.  To access the imported module on a\nsuccessful load, use *note PyImportImportModule(): 325.  (Note the\nmisnomer -- this function would reload the module if it was already\nimported.)\n\nNew in version 3.3.\n\nChanged in version 3.4: The 'file' attribute is no longer set\non the module.\n\n-- C Function: int PyImportImportFrozenModule (const char *name)\n' Part of the *note Stable ABI: 2ac.'  Similar to *note\nPyImportImportFrozenModuleObject(): 47c6, but the name is a UTF-8\nencoded string instead of a Unicode object.\n\n-- C Struct: struct frozen\n\nThis is the structure type definition for frozen module\ndescriptors, as generated by the 'freeze' utility (see\n'Tools/freeze/' in the Python source distribution).  Its\ndefinition, found in 'Include/import.h', is:\n\nstruct frozen {\nconst char *name;\nconst unsigned char *code;\nint size;\nbool ispackage;\n};\n\nChanged in version 3.11: The new 'ispackage' field indicates\nwhether the module is a package or not.  This replaces setting the\n'size' field to a negative value.\n\n-- C Variable: const struct *note frozen: 560. *PyImportFrozenModules\n\nThis pointer is initialized to point to an array of *note frozen:\n560. records, terminated by one whose members are all 'NULL' or\nzero.  When a frozen module is imported, it is searched in this\ntable.  Third-party code could play tricks with this to provide a\ndynamically created collection of frozen modules.\n\n-- C Function: int PyImportAppendInittab (const char *name, PyObject\n*(*initfunc)(void))\n' Part of the *note Stable ABI: 2ac.'  Add a single module to the\nexisting table of built-in modules.  This is a convenience wrapper\naround *note PyImportExtendInittab(): 14f9, returning '-1' if the\ntable could not be extended.  The new module can be imported by the\nname 'name', and uses the function 'initfunc' as the initialization\nfunction called on the first attempted import.  This should be\ncalled before *note PyInitialize(): 6c2.\n\n-- C Struct: struct inittab\n\nStructure describing a single entry in the list of built-in\nmodules.  Programs which embed Python may use an array of these\nstructures in conjunction with *note PyImportExtendInittab():\n14f9. to provide additional built-in modules.  The structure\nconsists of two members:\n\n-- C Member: const char *name\n\nThe module name, as an ASCII encoded string.\n\n-- C Member: *note PyObject: 6b1. *(*initfunc)(void)\n\nInitialization function for a module built into the\ninterpreter.\n\n-- C Function: int PyImportExtendInittab (struct inittab *newtab)\n\nAdd a collection of modules to the table of built-in modules.  The\n'newtab' array must end with a sentinel entry which contains 'NULL'\nfor the *note name: 4912. field; failure to provide the sentinel\nvalue can result in a memory fault.  Returns '0' on success or '-1'\nif insufficient memory could be allocated to extend the internal\ntable.  In the event of failure, no modules are added to the\ninternal table.  This must be called before *note PyInitialize():\n6c2.\n\nIf Python is initialized multiple times, *note\nPyImportAppendInittab(): 14f8. or *note PyImportExtendInittab():\n14f9. must be called before each Python initialization.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3147/\n\nFile: python3.12.info,  Node: Data marshalling support,  Next: Parsing arguments and building values,  Prev: Importing Modules<2>,  Up: Utilities<2>\n\n",
            "subsections": []
        },
        "These routines allow C code to work with serialized objects using the": {
            "content": "same data format as the *note marshal: 88. module.  There are functions\nto write data into the serialization format, and additional functions\nthat can be used to read the data back.  Files used to store marshalled\ndata must be opened in binary mode.\n\nNumeric values are stored with the least significant byte first.\n",
            "subsections": []
        },
        "The module supports two versions of the data format: version 0 is the": {
            "content": "historical version, version 1 shares interned strings in the file, and\nupon unmarshalling.  Version 2 uses a binary format for floating point\nnumbers.  'PyMARSHALVERSION' indicates the current file format\n(currently 2).\n\n-- C Function: void PyMarshalWriteLongToFile (long value, FILE *file,\nint version)\n\nMarshal a long integer, 'value', to 'file'.  This will only write\nthe least-significant 32 bits of 'value'; regardless of the size of\nthe native long type.  'version' indicates the file format.\n\nThis function can fail, in which case it sets the error indicator.\nUse *note PyErrOccurred(): 1656. to check for that.\n\n-- C Function: void PyMarshalWriteObjectToFile (PyObject *value, FILE\n*file, int version)\n\nMarshal a Python object, 'value', to 'file'.  'version' indicates\nthe file format.\n\nThis function can fail, in which case it sets the error indicator.\nUse *note PyErrOccurred(): 1656. to check for that.\n\n-- C Function: *note PyObject: 6b1. *PyMarshalWriteObjectToString\n(PyObject *value, int version)\n'Return value: New reference.'  Return a bytes object containing\nthe marshalled representation of 'value'.  'version' indicates the\nfile format.\n\nThe following functions allow marshalled values to be read back in.\n\n-- C Function: long PyMarshalReadLongFromFile (FILE *file)\n\nReturn a C long from the data stream in a FILE* opened for reading.\nOnly a 32-bit value can be read in using this function, regardless\nof the native size of long.\n\nOn error, sets the appropriate exception (*note EOFError: 114e.)\nand returns '-1'.\n\n-- C Function: int PyMarshalReadShortFromFile (FILE *file)\n\nReturn a C short from the data stream in a FILE* opened for\nreading.  Only a 16-bit value can be read in using this function,\nregardless of the native size of short.\n\nOn error, sets the appropriate exception (*note EOFError: 114e.)\nand returns '-1'.\n\n-- C Function: *note PyObject: 6b1. *PyMarshalReadObjectFromFile (FILE\n*file)\n'Return value: New reference.'  Return a Python object from the\ndata stream in a FILE* opened for reading.\n\nOn error, sets the appropriate exception (*note EOFError: 114e,\n*note ValueError: 183. or *note TypeError: 28e.) and returns\n'NULL'.\n\n-- C Function: *note PyObject: 6b1. *PyMarshalReadLastObjectFromFile\n(FILE *file)\n'Return value: New reference.'  Return a Python object from the\ndata stream in a FILE* opened for reading.  Unlike *note\nPyMarshalReadObjectFromFile(): 4919, this function assumes that no\nfurther objects will be read from the file, allowing it to\naggressively load file data into memory so that the\nde-serialization can operate from data in memory rather than\nreading a byte at a time from the file.  Only use these variant if\nyou are certain that you won't be reading anything else from the\nfile.\n\nOn error, sets the appropriate exception (*note EOFError: 114e,\n*note ValueError: 183. or *note TypeError: 28e.) and returns\n'NULL'.\n\n-- C Function: *note PyObject: 6b1. *PyMarshalReadObjectFromString\n(const char *data, Pyssizet len)\n'Return value: New reference.'  Return a Python object from the\ndata stream in a byte buffer containing 'len' bytes pointed to by\n'data'.\n\nOn error, sets the appropriate exception (*note EOFError: 114e,\n*note ValueError: 183. or *note TypeError: 28e.) and returns\n'NULL'.\n\nFile: python3.12.info,  Node: Parsing arguments and building values,  Next: String conversion and formatting,  Prev: Data marshalling support,  Up: Utilities<2>\n\n",
            "subsections": []
        },
        "These functions are useful when creating your own extensions functions": {
            "content": "and methods.  Additional information and examples are available in *note\nExtending and Embedding the Python Interpreter: 195e.\n\nThe first three of these functions described, *note PyArgParseTuple():\n2d1, *note PyArgParseTupleAndKeywords(): b68, and *note PyArgParse():\n1757, all use 'format strings' which are used to tell the function about\nthe expected arguments.  The format strings use the same syntax for each\nof these functions.\n\n* Menu:\n\n* Parsing arguments: Parsing arguments<3>.\n* Building values::\n\nFile: python3.12.info,  Node: Parsing arguments<3>,  Next: Building values,  Up: Parsing arguments and building values\n\n7.6.6.1 Parsing arguments\n.........................\n\nA format string consists of zero or more \"format units.\" A format unit\ndescribes one Python object; it is usually a single character or a\nparenthesized sequence of format units.  With a few exceptions, a format\nunit that is not a parenthesized sequence normally corresponds to a\nsingle address argument to these functions.  In the following\ndescription, the quoted form is the format unit; the entry in (round)\nparentheses is the Python object type that matches the format unit; and\nthe entry in [square] brackets is the type of the C variable(s) whose\naddress should be passed.\n\n* Menu:\n\n* Strings and buffers::\n* Numbers: Numbers<2>.\n* Other objects::\n* API Functions::\n\nFile: python3.12.info,  Node: Strings and buffers,  Next: Numbers<2>,  Up: Parsing arguments<3>\n\n7.6.6.2 Strings and buffers\n...........................\n\nThese formats allow accessing an object as a contiguous chunk of memory.",
            "subsections": []
        },
        "You don't have to provide raw storage for the returned unicode or bytes": {
            "content": "area.\n\nUnless otherwise stated, buffers are not NUL-terminated.\n\nThere are three ways strings and buffers can be converted to C:\n\n* Formats such as 'y*' and 's*' fill a *note Pybuffer: 53f.\nstructure.  This locks the underlying buffer so that the caller can\nsubsequently use the buffer even inside a *note\nPyBEGINALLOWTHREADS: 46be. block without the risk of mutable\ndata being resized or destroyed.  As a result, 'you have to call'\n*note PyBufferRelease(): 54a. after you have finished processing\nthe data (or in any early abort case).\n\n* The 'es', 'es#', 'et' and 'et#' formats allocate the result buffer.\n'You have to call' *note PyMemFree(): 129a. after you have\nfinished processing the data (or in any early abort case).\n\n* Other formats take a *note str: 157. or a read-only *note\nbytes-like object: b82, such as *note bytes: 295, and provide a\n'const char *' pointer to its buffer.  In this case the buffer is\n\"borrowed\": it is managed by the corresponding Python object, and\nshares the lifetime of this object.  You won't have to release any\nmemory yourself.\n\nTo ensure that the underlying buffer may be safely borrowed, the\nobject's *note PyBufferProcs.bfreleasebuffer: 54d. field must be\n'NULL'.  This disallows common mutable objects such as *note\nbytearray: 294, but also some read-only objects such as *note\nmemoryview: 17f. of *note bytes: 295.\n\nBesides this 'bfreleasebuffer' requirement, there is no check to\nverify whether the input object is immutable (e.g.  whether it\nwould honor a request for a writable buffer, or whether another\nthread can mutate the data).\n\nNote: For all '#' variants of formats ('s#', 'y#', etc.), the macro\n'PYSSIZETCLEAN' must be defined before including 'Python.h'.  On\nPython 3.9 and older, the type of the length argument is *note\nPyssizet: 88d. if the 'PYSSIZETCLEAN' macro is defined, or int\notherwise.\n\n's' (*note str: 157.) [const char *]\n\nConvert a Unicode object to a C pointer to a character string.  A\npointer to an existing string is stored in the character pointer\nvariable whose address you pass.  The C string is NUL-terminated.\nThe Python string must not contain embedded null code points; if it\ndoes, a *note ValueError: 183. exception is raised.  Unicode\nobjects are converted to C strings using ''utf-8'' encoding.  If\nthis conversion fails, a *note UnicodeError: 111b. is raised.\n\nNote: This format does not accept *note bytes-like objects:\nb82.  If you want to accept filesystem paths and convert them\nto C character strings, it is preferable to use the 'O&'\nformat with *note PyUnicodeFSConverter(): b6c. as\n'converter'.\n\nChanged in version 3.5: Previously, *note TypeError: 28e. was\nraised when embedded null code points were encountered in the\nPython string.\n\n's*' (*note str: 157. or *note bytes-like object: b82.) [Pybuffer]\n\nThis format accepts Unicode objects as well as bytes-like objects.\nIt fills a *note Pybuffer: 53f. structure provided by the caller.\nIn this case the resulting C string may contain embedded NUL bytes.\nUnicode objects are converted to C strings using ''utf-8''\nencoding.\n\n's#' (*note str: 157, read-only *note bytes-like object: b82.) [const char *, *note Pyssizet: 88d.]\n\nLike 's*', except that it provides a *note borrowed buffer: 491f.\nThe result is stored into two C variables, the first one a pointer\nto a C string, the second one its length.  The string may contain\nembedded null bytes.  Unicode objects are converted to C strings\nusing ''utf-8'' encoding.\n\n'z' (*note str: 157. or 'None') [const char *]\n\nLike 's', but the Python object may also be 'None', in which case\nthe C pointer is set to 'NULL'.\n\n'z*' (*note str: 157, *note bytes-like object: b82. or 'None') [Pybuffer]\n\nLike 's*', but the Python object may also be 'None', in which case\nthe 'buf' member of the *note Pybuffer: 53f. structure is set to\n'NULL'.\n\n'z#' (*note str: 157, read-only *note bytes-like object: b82. or 'None') [const char *, *note Pyssizet: 88d.]\n\nLike 's#', but the Python object may also be 'None', in which case\nthe C pointer is set to 'NULL'.\n\n'y' (read-only *note bytes-like object: b82.) [const char *]\n\nThis format converts a bytes-like object to a C pointer to a *note\nborrowed: 491f. character string; it does not accept Unicode\nobjects.  The bytes buffer must not contain embedded null bytes; if\nit does, a *note ValueError: 183. exception is raised.\n\nChanged in version 3.5: Previously, *note TypeError: 28e. was\nraised when embedded null bytes were encountered in the bytes\nbuffer.\n\n'y*' (*note bytes-like object: b82.) [Pybuffer]\n\nThis variant on 's*' doesn't accept Unicode objects, only\nbytes-like objects.  'This is the recommended way to accept binary\ndata.'\n\n'y#' (read-only *note bytes-like object: b82.) [const char *, *note Pyssizet: 88d.]\n\nThis variant on 's#' doesn't accept Unicode objects, only\nbytes-like objects.\n\n'S' (*note bytes: 295.) [PyBytesObject *]\n\nRequires that the Python object is a *note bytes: 295. object,\nwithout attempting any conversion.  Raises *note TypeError: 28e. if\nthe object is not a bytes object.  The C variable may also be\ndeclared as *note PyObject: 6b1.*.\n\n'Y' (*note bytearray: 294.) [PyByteArrayObject *]\n\nRequires that the Python object is a *note bytearray: 294. object,\nwithout attempting any conversion.  Raises *note TypeError: 28e. if\nthe object is not a *note bytearray: 294. object.  The C variable\nmay also be declared as *note PyObject: 6b1.*.\n\n'U' (*note str: 157.) [PyObject *]\n\nRequires that the Python object is a Unicode object, without\nattempting any conversion.  Raises *note TypeError: 28e. if the\nobject is not a Unicode object.  The C variable may also be\ndeclared as *note PyObject: 6b1.*.\n\n'w*' (read-write *note bytes-like object: b82.) [Pybuffer]\n\nThis format accepts any object which implements the read-write\nbuffer interface.  It fills a *note Pybuffer: 53f. structure\nprovided by the caller.  The buffer may contain embedded null\nbytes.  The caller have to call *note PyBufferRelease(): 54a. when\nit is done with the buffer.\n\n'es' (*note str: 157.) [const char *encoding, char buffer]\n\nThis variant on 's' is used for encoding Unicode into a character\nbuffer.  It only works for encoded data without embedded NUL bytes.\n\nThis format requires two arguments.  The first is only used as\ninput, and must be a const char* which points to the name of an\nencoding as a NUL-terminated string, or 'NULL', in which case\n''utf-8'' encoding is used.  An exception is raised if the named\nencoding is not known to Python.  The second argument must be a\nchar; the value of the pointer it references will be set to a\nbuffer with the contents of the argument text.  The text will be\nencoded in the encoding specified by the first argument.\n\n*note PyArgParseTuple(): 2d1. will allocate a buffer of the needed\nsize, copy the encoded data into this buffer and adjust '*buffer'\nto reference the newly allocated storage.  The caller is\nresponsible for calling *note PyMemFree(): 129a. to free the\nallocated buffer after use.\n\n'et' (*note str: 157, *note bytes: 295. or *note bytearray: 294.) [const char *encoding, char buffer]\n\nSame as 'es' except that byte string objects are passed through\nwithout recoding them.  Instead, the implementation assumes that\nthe byte string object uses the encoding passed in as parameter.\n\n'es#' (*note str: 157.) [const char *encoding, char buffer, *note Pyssizet: 88d. *bufferlength]\n\nThis variant on 's#' is used for encoding Unicode into a character\nbuffer.  Unlike the 'es' format, this variant allows input data\nwhich contains NUL characters.\n\nIt requires three arguments.  The first is only used as input, and\nmust be a const char* which points to the name of an encoding as a\nNUL-terminated string, or 'NULL', in which case ''utf-8'' encoding\nis used.  An exception is raised if the named encoding is not known\nto Python.  The second argument must be a char; the value of the\npointer it references will be set to a buffer with the contents of\nthe argument text.  The text will be encoded in the encoding\nspecified by the first argument.  The third argument must be a\npointer to an integer; the referenced integer will be set to the\nnumber of bytes in the output buffer.\n\nThere are two modes of operation:\n\nIf '*buffer' points a 'NULL' pointer, the function will allocate a\nbuffer of the needed size, copy the encoded data into this buffer\nand set '*buffer' to reference the newly allocated storage.  The\ncaller is responsible for calling *note PyMemFree(): 129a. to free\nthe allocated buffer after usage.\n\nIf '*buffer' points to a non-'NULL' pointer (an already allocated\nbuffer), *note PyArgParseTuple(): 2d1. will use this location as\nthe buffer and interpret the initial value of '*bufferlength' as\nthe buffer size.  It will then copy the encoded data into the\nbuffer and NUL-terminate it.  If the buffer is not large enough, a\n*note ValueError: 183. will be set.\n\nIn both cases, '*bufferlength' is set to the length of the encoded\ndata without the trailing NUL byte.\n\n'et#' (*note str: 157, *note bytes: 295. or *note bytearray: 294.) [const char *encoding, char buffer, *note Pyssizet: 88d. *bufferlength]\n\nSame as 'es#' except that byte string objects are passed through\nwithout recoding them.  Instead, the implementation assumes that\nthe byte string object uses the encoding passed in as parameter.\n\nChanged in version 3.12: 'u', 'u#', 'Z', and 'Z#' are removed because\nthey used a legacy 'PyUNICODE*' representation.\n\nFile: python3.12.info,  Node: Numbers<2>,  Next: Other objects,  Prev: Strings and buffers,  Up: Parsing arguments<3>\n\n7.6.6.3 Numbers\n...............\n\n'b' (*note int: 17e.) [unsigned char]\n\nConvert a nonnegative Python integer to an unsigned tiny int,\nstored in a C unsigned char.\n\n'B' (*note int: 17e.) [unsigned char]\n\nConvert a Python integer to a tiny int without overflow checking,\nstored in a C unsigned char.\n\n'h' (*note int: 17e.) [short int]\n\nConvert a Python integer to a C short int.\n\n'H' (*note int: 17e.) [unsigned short int]\n\nConvert a Python integer to a C unsigned short int, without\noverflow checking.\n\n'i' (*note int: 17e.) [int]\n\nConvert a Python integer to a plain C int.\n\n'I' (*note int: 17e.) [unsigned int]\n\nConvert a Python integer to a C unsigned int, without overflow\nchecking.\n\n'l' (*note int: 17e.) [long int]\n\nConvert a Python integer to a C long int.\n\n'k' (*note int: 17e.) [unsigned long]\n\nConvert a Python integer to a C unsigned long without overflow\nchecking.\n\n'L' (*note int: 17e.) [long long]\n\nConvert a Python integer to a C long long.\n\n'K' (*note int: 17e.) [unsigned long long]\n\nConvert a Python integer to a C unsigned long long without overflow\nchecking.\n\n'n' (*note int: 17e.) [*note Pyssizet: 88d.]\n\nConvert a Python integer to a C *note Pyssizet: 88d.\n\n'c' (*note bytes: 295. or *note bytearray: 294. of length 1) [char]\n\nConvert a Python byte, represented as a *note bytes: 295. or *note\nbytearray: 294. object of length 1, to a C char.\n\nChanged in version 3.3: Allow *note bytearray: 294. objects.\n\n'C' (*note str: 157. of length 1) [int]\n\nConvert a Python character, represented as a *note str: 157. object\nof length 1, to a C int.\n\n'f' (*note float: 4b7.) [float]\n\nConvert a Python floating point number to a C float.\n\n'd' (*note float: 4b7.) [double]\n\nConvert a Python floating point number to a C double.\n\n'D' (*note complex: 3ad.) [Pycomplex]\n\nConvert a Python complex number to a C *note Pycomplex: 4921.\nstructure.\n\nFile: python3.12.info,  Node: Other objects,  Next: API Functions,  Prev: Numbers<2>,  Up: Parsing arguments<3>\n\n7.6.6.4 Other objects\n.....................\n\n'O' (object) [PyObject *]\n\nStore a Python object (without any conversion) in a C object\npointer.  The C program thus receives the actual object that was\npassed.  A new *note strong reference: 57c. to the object is not\ncreated (i.e.  its reference count is not increased).  The pointer\nstored is not 'NULL'.\n\n'O!' (object) ['typeobject', PyObject *]\n\nStore a Python object in a C object pointer.  This is similar to\n'O', but takes two C arguments: the first is the address of a\nPython type object, the second is the address of the C variable (of\ntype *note PyObject: 6b1.*) into which the object pointer is\nstored.  If the Python object does not have the required type,\n*note TypeError: 28e. is raised.\n\n'O&' (object) ['converter', 'anything']\n\nConvert a Python object to a C variable through a 'converter'\nfunction.  This takes two arguments: the first is a function, the\nsecond is the address of a C variable (of arbitrary type),\nconverted to void*.  The 'converter' function in turn is called as\nfollows:\n\nstatus = converter(object, address);\n\nwhere 'object' is the Python object to be converted and 'address'\nis the void* argument that was passed to the 'PyArgParse*'\nfunction.  The returned 'status' should be '1' for a successful\nconversion and '0' if the conversion has failed.  When the\nconversion fails, the 'converter' function should raise an\nexception and leave the content of 'address' unmodified.\n\nIf the 'converter' returns 'PyCLEANUPSUPPORTED', it may get\ncalled a second time if the argument parsing eventually fails,\ngiving the converter a chance to release any memory that it had\nalready allocated.  In this second call, the 'object' parameter\nwill be 'NULL'; 'address' will have the same value as in the\noriginal call.\n\nChanged in version 3.1: 'PyCLEANUPSUPPORTED' was added.\n\n'p' (*note bool: 17d.) [int]\n\nTests the value passed in for truth (a boolean 'p'redicate) and\nconverts the result to its equivalent C true/false integer value.\nSets the int to '1' if the expression was true and '0' if it was\nfalse.  This accepts any valid Python value.  See *note Truth Value\nTesting: 1e66. for more information about how Python tests values\nfor truth.\n\nNew in version 3.3.\n\n'(items)' (*note tuple: 4b8.) ['matching-items']\n\nThe object must be a Python sequence whose length is the number of\nformat units in 'items'.  The C arguments must correspond to the\nindividual format units in 'items'.  Format units for sequences may\nbe nested.\n\nIt is possible to pass \"long\" integers (integers whose value exceeds the\nplatform's 'LONGMAX') however no proper range checking is done -- the\nmost significant bits are silently truncated when the receiving field is\ntoo small to receive the value (actually, the semantics are inherited\nfrom downcasts in C -- your mileage may vary).\n\nA few other characters have a meaning in a format string.  These may not\noccur inside nested parentheses.  They are:\n\n'|'\n\nIndicates that the remaining arguments in the Python argument list\nare optional.  The C variables corresponding to optional arguments\nshould be initialized to their default value -- when an optional\nargument is not specified, *note PyArgParseTuple(): 2d1. does not\ntouch the contents of the corresponding C variable(s).\n\n'$'\n\n*note PyArgParseTupleAndKeywords(): b68. only: Indicates that the\nremaining arguments in the Python argument list are keyword-only.\nCurrently, all keyword-only arguments must also be optional\narguments, so '|' must always be specified before '$' in the format\nstring.\n\nNew in version 3.3.\n\n':'\n\nThe list of format units ends here; the string after the colon is\nused as the function name in error messages (the \"associated value\"\nof the exception that *note PyArgParseTuple(): 2d1. raises).\n\n';'\n\nThe list of format units ends here; the string after the semicolon\nis used as the error message 'instead' of the default error\nmessage.  ':' and ';' mutually exclude each other.\n",
            "subsections": []
        },
        "Additional arguments passed to these functions must be addresses of": {
            "content": "variables whose type is determined by the format string; these are used\nto store values from the input tuple.  There are a few cases, as\ndescribed in the list of format units above, where these parameters are\nused as input values; they should match what is specified for the\ncorresponding format unit in that case.\n",
            "subsections": []
        },
        "For the conversion to succeed, the 'arg' object must match the format": {
            "content": "and the format must be exhausted.  On success, the 'PyArgParse*'\nfunctions return true, otherwise they return false and raise an\nappropriate exception.  When the 'PyArgParse*' functions fail due to\nconversion failure in one of the format units, the variables at the\naddresses corresponding to that and the following format units are left\nuntouched.\n\nFile: python3.12.info,  Node: API Functions,  Prev: Other objects,  Up: Parsing arguments<3>\n\n7.6.6.5 API Functions\n.....................\n\n-- C Function: int PyArgParseTuple (PyObject *args, const char\n*format, ...)\n' Part of the *note Stable ABI: 2ac.'  Parse the parameters of a\nfunction that takes only positional parameters into local\nvariables.  Returns true on success; on failure, it returns false\nand raises the appropriate exception.\n\n-- C Function: int PyArgVaParse (PyObject *args, const char *format,\nvalist vargs)\n' Part of the *note Stable ABI: 2ac.'  Identical to *note\nPyArgParseTuple(): 2d1, except that it accepts a valist rather\nthan a variable number of arguments.\n\n-- C Function: int PyArgParseTupleAndKeywords (PyObject *args,\nPyObject *kw, const char *format, char *keywords[], ...)\n' Part of the *note Stable ABI: 2ac.'  Parse the parameters of a\nfunction that takes both positional and keyword parameters into\nlocal variables.  The 'keywords' argument is a 'NULL'-terminated\narray of keyword parameter names.  Empty names denote *note\npositional-only parameters: 8b3.  Returns true on success; on\nfailure, it returns false and raises the appropriate exception.\n\nChanged in version 3.6: Added support for *note positional-only\nparameters: 8b3.\n\n-- C Function: int PyArgVaParseTupleAndKeywords (PyObject *args,\nPyObject *kw, const char *format, char *keywords[], valist\nvargs)\n' Part of the *note Stable ABI: 2ac.'  Identical to *note\nPyArgParseTupleAndKeywords(): b68, except that it accepts a\nvalist rather than a variable number of arguments.\n\n-- C Function: int PyArgValidateKeywordArguments (PyObject*)\n' Part of the *note Stable ABI: 2ac.'  Ensure that the keys in the\nkeywords argument dictionary are strings.  This is only needed if\n*note PyArgParseTupleAndKeywords(): b68. is not used, since the\nlatter already does this check.\n\nNew in version 3.2.\n\n-- C Function: int PyArgParse (PyObject *args, const char *format,\n...)\n' Part of the *note Stable ABI: 2ac.'  Function used to deconstruct\nthe argument lists of \"old-style\" functions -- these are functions\nwhich use the 'METHOLDARGS' parameter parsing method, which has\nbeen removed in Python 3.  This is not recommended for use in\nparameter parsing in new code, and most code in the standard\ninterpreter has been modified to no longer use this for that\npurpose.  It does remain a convenient way to decompose other\ntuples, however, and may continue to be used for that purpose.\n\n-- C Function: int PyArgUnpackTuple (PyObject *args, const char *name,\nPyssizet min, Pyssizet max, ...)\n' Part of the *note Stable ABI: 2ac.'  A simpler form of parameter\nretrieval which does not use a format string to specify the types\nof the arguments.  Functions which use this method to retrieve\ntheir parameters should be declared as *note METHVARARGS: 1364. in\nfunction or method tables.  The tuple containing the actual\nparameters should be passed as 'args'; it must actually be a tuple.\nThe length of the tuple must be at least 'min' and no more than\n'max'; 'min' and 'max' may be equal.  Additional arguments must be\npassed to the function, each of which should be a pointer to a\n*note PyObject: 6b1.* variable; these will be filled in with the\nvalues from 'args'; they will contain *note borrowed references:\n4732.  The variables which correspond to optional parameters not\ngiven by 'args' will not be filled in; these should be initialized\nby the caller.  This function returns true on success and false if\n'args' is not a tuple or contains the wrong number of elements; an\nexception will be set if there was a failure.\n\nThis is an example of the use of this function, taken from the\nsources for the 'weakref' helper module for weak references:\n\nstatic PyObject *\nweakrefref(PyObject *self, PyObject *args)\n{\nPyObject *object;\nPyObject *callback = NULL;\nPyObject *result = NULL;\n\nif (PyArgUnpackTuple(args, \"ref\", 1, 2, &object, &callback)) {\nresult = PyWeakrefNewRef(object, callback);\n}\nreturn result;\n}\n\nThe call to *note PyArgUnpackTuple(): 1362. in this example is\nentirely equivalent to this call to *note PyArgParseTuple(): 2d1.:\n\nPyArgParseTuple(args, \"O|O:ref\", &object, &callback)\n\nFile: python3.12.info,  Node: Building values,  Prev: Parsing arguments<3>,  Up: Parsing arguments and building values\n\n7.6.6.6 Building values\n.......................\n\n-- C Function: *note PyObject: 6b1. *PyBuildValue (const char *format,\n...)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Create a new value based on a format string similar to those\naccepted by the 'PyArgParse*' family of functions and a sequence\nof values.  Returns the value or 'NULL' in the case of an error; an\nexception will be raised if 'NULL' is returned.\n\n*note PyBuildValue(): 6bb. does not always build a tuple.  It\nbuilds a tuple only if its format string contains two or more\nformat units.  If the format string is empty, it returns 'None'; if\nit contains exactly one format unit, it returns whatever object is\ndescribed by that format unit.  To force it to return a tuple of\nsize 0 or one, parenthesize the format string.\n\nWhen memory buffers are passed as parameters to supply data to\nbuild objects, as for the 's' and 's#' formats, the required data\nis copied.  Buffers provided by the caller are never referenced by\nthe objects created by *note PyBuildValue(): 6bb.  In other words,\nif your code invokes 'malloc()' and passes the allocated memory to\n*note PyBuildValue(): 6bb, your code is responsible for calling\n'free()' for that memory once *note PyBuildValue(): 6bb. returns.\n\nIn the following description, the quoted form is the format unit;\nthe entry in (round) parentheses is the Python object type that the\nformat unit will return; and the entry in [square] brackets is the\ntype of the C value(s) to be passed.\n\nThe characters space, tab, colon and comma are ignored in format\nstrings (but not within format units such as 's#').  This can be\nused to make long format strings a tad more readable.\n\n's' (*note str: 157. or 'None') [const char *]\n\nConvert a null-terminated C string to a Python *note str: 157.\nobject using ''utf-8'' encoding.  If the C string pointer is\n'NULL', 'None' is used.\n\n's#' (*note str: 157. or 'None') [const char *, *note Pyssizet: 88d.]\n\nConvert a C string and its length to a Python *note str: 157.\nobject using ''utf-8'' encoding.  If the C string pointer is\n'NULL', the length is ignored and 'None' is returned.\n\n'y' (*note bytes: 295.) [const char *]\n\nThis converts a C string to a Python *note bytes: 295. object.\nIf the C string pointer is 'NULL', 'None' is returned.\n\n'y#' (*note bytes: 295.) [const char *, *note Pyssizet: 88d.]\n\nThis converts a C string and its lengths to a Python object.\nIf the C string pointer is 'NULL', 'None' is returned.\n\n'z' (*note str: 157. or 'None') [const char *]\n\nSame as 's'.\n\n'z#' (*note str: 157. or 'None') [const char *, *note Pyssizet: 88d.]\n\nSame as 's#'.\n\n'u' (*note str: 157.) [const wchart *]\n\nConvert a null-terminated 'wchart' buffer of Unicode (UTF-16\nor UCS-4) data to a Python Unicode object.  If the Unicode\nbuffer pointer is 'NULL', 'None' is returned.\n\n'u#' (*note str: 157.) [const wchart *, *note Pyssizet: 88d.]\n\nConvert a Unicode (UTF-16 or UCS-4) data buffer and its length\nto a Python Unicode object.  If the Unicode buffer pointer is\n'NULL', the length is ignored and 'None' is returned.\n\n'U' (*note str: 157. or 'None') [const char *]\n\nSame as 's'.\n\n'U#' (*note str: 157. or 'None') [const char *, *note Pyssizet: 88d.]\n\nSame as 's#'.\n\n'i' (*note int: 17e.) [int]\n\nConvert a plain C int to a Python integer object.\n\n'b' (*note int: 17e.) [char]\n\nConvert a plain C char to a Python integer object.\n\n'h' (*note int: 17e.) [short int]\n\nConvert a plain C short int to a Python integer object.\n\n'l' (*note int: 17e.) [long int]\n\nConvert a C long int to a Python integer object.\n\n'B' (*note int: 17e.) [unsigned char]\n\nConvert a C unsigned char to a Python integer object.\n\n'H' (*note int: 17e.) [unsigned short int]\n\nConvert a C unsigned short int to a Python integer object.\n\n'I' (*note int: 17e.) [unsigned int]\n\nConvert a C unsigned int to a Python integer object.\n\n'k' (*note int: 17e.) [unsigned long]\n\nConvert a C unsigned long to a Python integer object.\n\n'L' (*note int: 17e.) [long long]\n\nConvert a C long long to a Python integer object.\n\n'K' (*note int: 17e.) [unsigned long long]\n\nConvert a C unsigned long long to a Python integer object.\n\n'n' (*note int: 17e.) [*note Pyssizet: 88d.]\n\nConvert a C *note Pyssizet: 88d. to a Python integer.\n\n'c' (*note bytes: 295. of length 1) [char]\n\nConvert a C int representing a byte to a Python *note bytes:\n295. object of length 1.\n\n'C' (*note str: 157. of length 1) [int]\n\nConvert a C int representing a character to Python *note str:\n157. object of length 1.\n\n'd' (*note float: 4b7.) [double]\n\nConvert a C double to a Python floating point number.\n\n'f' (*note float: 4b7.) [float]\n\nConvert a C float to a Python floating point number.\n\n'D' (*note complex: 3ad.) [Pycomplex *]\n\nConvert a C *note Pycomplex: 4921. structure to a Python\ncomplex number.\n\n'O' (object) [PyObject *]\n\nPass a Python object untouched but create a new *note strong\nreference: 57c. to it (i.e.  its reference count is\nincremented by one).  If the object passed in is a 'NULL'\npointer, it is assumed that this was caused because the call\nproducing the argument found an error and set an exception.\nTherefore, *note PyBuildValue(): 6bb. will return 'NULL' but\nwon't raise an exception.  If no exception has been raised\nyet, *note SystemError: 2d7. is set.\n\n'S' (object) [PyObject *]\n\nSame as 'O'.\n\n'N' (object) [PyObject *]\n\nSame as 'O', except it doesn't create a new *note strong\nreference: 57c.  Useful when the object is created by a call\nto an object constructor in the argument list.\n\n'O&' (object) ['converter', 'anything']\n\nConvert 'anything' to a Python object through a 'converter'\nfunction.  The function is called with 'anything' (which\nshould be compatible with void*) as its argument and should\nreturn a \"new\" Python object, or 'NULL' if an error occurred.\n\n'(items)' (*note tuple: 4b8.) ['matching-items']\n\nConvert a sequence of C values to a Python tuple with the same\nnumber of items.\n\n'[items]' (*note list: 3dc.) ['matching-items']\n\nConvert a sequence of C values to a Python list with the same\nnumber of items.\n\n'{items}' (*note dict: 237.) ['matching-items']\n\nConvert a sequence of C values to a Python dictionary.  Each\npair of consecutive C values adds one item to the dictionary,\nserving as key and value, respectively.\n\nIf there is an error in the format string, the *note SystemError:\n2d7. exception is set and 'NULL' returned.\n\n-- C Function: *note PyObject: 6b1. *PyVaBuildValue (const char\n*format, valist vargs)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Identical to *note PyBuildValue(): 6bb, except that it\naccepts a valist rather than a variable number of arguments.\n\nFile: python3.12.info,  Node: String conversion and formatting,  Next: PyHash API,  Prev: Parsing arguments and building values,  Up: Utilities<2>\n\n\nFunctions for number conversion and formatted string output.\n\n-- C Function: int PyOSsnprintf (char *str, sizet size, const char\n*format, ...)\n' Part of the *note Stable ABI: 2ac.'  Output not more than 'size'\nbytes to 'str' according to the format string 'format' and the\nextra arguments.  See the Unix man page 'snprintf(3)'.\n\n-- C Function: int PyOSvsnprintf (char *str, sizet size, const char\n*format, valist va)\n' Part of the *note Stable ABI: 2ac.'  Output not more than 'size'\nbytes to 'str' according to the format string 'format' and the\nvariable argument list 'va'.  Unix man page 'vsnprintf(3)'.\n\n*note PyOSsnprintf(): 1365. and *note PyOSvsnprintf(): 1366. wrap the",
            "subsections": []
        },
        "Standard C library functions 'snprintf()' and 'vsnprintf()'.  Their": {
            "content": "purpose is to guarantee consistent behavior in corner cases, which the\nStandard C functions do not.\n\nThe wrappers ensure that 'str[size-1]' is always ''\\0'' upon return.\nThey never write more than 'size' bytes (including the trailing ''\\0'')\ninto str.  Both functions require that 'str != NULL', 'size > 0',\n'format != NULL' and 'size < INTMAX'.  Note that this means there is no\nequivalent to the C99 'n = snprintf(NULL, 0, ...)' which would determine\nthe necessary buffer size.\n",
            "subsections": []
        },
        "The return value ('rv') for these functions should be interpreted as": {
            "content": "follows:\n\n* When '0 <= rv < size', the output conversion was successful and\n'rv' characters were written to 'str' (excluding the trailing\n''\\0'' byte at 'str[rv]').\n\n* When 'rv >= size', the output conversion was truncated and a buffer\nwith 'rv + 1' bytes would have been needed to succeed.\n'str[size-1]' is ''\\0'' in this case.\n\n* When 'rv < 0', \"something bad happened.\" 'str[size-1]' is ''\\0'' in\nthis case too, but the rest of 'str' is undefined.  The exact cause\nof the error depends on the underlying platform.\n",
            "subsections": []
        },
        "The following functions provide locale-independent string to number": {
            "content": "conversions.\n\n-- C Function: unsigned long PyOSstrtoul (const char *str, char ptr,\nint base)\n' Part of the *note Stable ABI: 2ac.'  Convert the initial part of\nthe string in 'str' to an unsigned long value according to the\ngiven 'base', which must be between '2' and '36' inclusive, or be\nthe special value '0'.\n\nLeading white space and case of characters are ignored.  If 'base'\nis zero it looks for a leading '0b', '0o' or '0x' to tell which\nbase.  If these are absent it defaults to '10'.  Base must be 0 or\nbetween 2 and 36 (inclusive).  If 'ptr' is non-'NULL' it will\ncontain a pointer to the end of the scan.\n\nIf the converted value falls out of range of corresponding return\ntype, range error occurs ('errno' is set to 'ERANGE') and\n'ULONGMAX' is returned.  If no conversion can be performed, '0' is\nreturned.\n\nSee also the Unix man page 'strtoul(3)'.\n\nNew in version 3.2.\n\n-- C Function: long PyOSstrtol (const char *str, char ptr, int base)\n' Part of the *note Stable ABI: 2ac.'  Convert the initial part of\nthe string in 'str' to an long value according to the given 'base',\nwhich must be between '2' and '36' inclusive, or be the special\nvalue '0'.\n\nSame as *note PyOSstrtoul(): 4812, but return a long value instead\nand 'LONGMAX' on overflows.\n\nSee also the Unix man page 'strtol(3)'.\n\nNew in version 3.2.\n\n-- C Function: double PyOSstringtodouble (const char *s, char\nendptr, PyObject *overflowexception)\n' Part of the *note Stable ABI: 2ac.'  Convert a string 's' to a\ndouble, raising a Python exception on failure.  The set of accepted\nstrings corresponds to the set of strings accepted by Python's\n*note float(): 4b7. constructor, except that 's' must not have\nleading or trailing whitespace.  The conversion is independent of\nthe current locale.\n\nIf 'endptr' is 'NULL', convert the whole string.  Raise *note\nValueError: 183. and return '-1.0' if the string is not a valid\nrepresentation of a floating-point number.\n\nIf endptr is not 'NULL', convert as much of the string as possible\nand set '*endptr' to point to the first unconverted character.  If\nno initial segment of the string is the valid representation of a\nfloating-point number, set '*endptr' to point to the beginning of\nthe string, raise ValueError, and return '-1.0'.\n\nIf 's' represents a value that is too large to store in a float\n(for example, '\"1e500\"' is such a string on many platforms) then if\n'overflowexception' is 'NULL' return 'PyHUGEVAL' (with an\nappropriate sign) and don't set any exception.  Otherwise,\n'overflowexception' must point to a Python exception object; raise\nthat exception and return '-1.0'.  In both cases, set '*endptr' to\npoint to the first character after the converted value.\n\nIf any other error occurs during the conversion (for example an\nout-of-memory error), set the appropriate Python exception and\nreturn '-1.0'.\n\nNew in version 3.1.\n\n-- C Function: char *PyOSdoubletostring (double val, char\nformatcode, int precision, int flags, int *ptype)\n' Part of the *note Stable ABI: 2ac.'  Convert a double 'val' to a\nstring using supplied 'formatcode', 'precision', and 'flags'.\n\n'formatcode' must be one of ''e'', ''E'', ''f'', ''F'', ''g'',\n''G'' or ''r''.  For ''r'', the supplied 'precision' must be 0 and\nis ignored.  The ''r'' format code specifies the standard *note\nrepr(): 5f0. format.\n\n'flags' can be zero or more of the values 'PyDTSFSIGN',\n'PyDTSFADDDOT0', or 'PyDTSFALT', or-ed together:\n\n* 'PyDTSFSIGN' means to always precede the returned string\nwith a sign character, even if 'val' is non-negative.\n\n* 'PyDTSFADDDOT0' means to ensure that the returned string\nwill not look like an integer.\n\n* 'PyDTSFALT' means to apply \"alternate\" formatting rules.\nSee the documentation for the *note PyOSsnprintf(): 1365.\n''#'' specifier for details.\n\nIf 'ptype' is non-'NULL', then the value it points to will be set\nto one of 'PyDTSTFINITE', 'PyDTSTINFINITE', or 'PyDTSTNAN',\nsignifying that 'val' is a finite number, an infinite number, or\nnot a number, respectively.\n\nThe return value is a pointer to 'buffer' with the converted string\nor 'NULL' if the conversion failed.  The caller is responsible for\nfreeing the returned string by calling *note PyMemFree(): 129a.\n\nNew in version 3.1.\n\n-- C Function: int PyOSstricmp (const char *s1, const char *s2)\n\nCase insensitive comparison of strings.  The function works almost\nidentically to 'strcmp()' except that it ignores the case.\n\n-- C Function: int PyOSstrnicmp (const char *s1, const char *s2,\nPyssizet size)\n\nCase insensitive comparison of strings.  The function works almost\nidentically to 'strncmp()' except that it ignores the case.\n\nFile: python3.12.info,  Node: PyHash API,  Next: Reflection,  Prev: String conversion and formatting,  Up: Utilities<2>\n\n\nSee also the *note PyTypeObject.tphash: 46f8. member.\n\n-- C Type: type Pyhasht\n\nHash value type: signed integer.\n\nNew in version 3.2.\n\n-- C Type: type Pyuhasht\n\nHash value type: unsigned integer.\n\nNew in version 3.2.\n\n-- C Type: type PyHashFuncDef\n\nHash function definition used by *note PyHashGetFuncDef(): 492f.\n\n-- C Member: const char *name\n\nHash function name (UTF-8 encoded string).\n\n-- C Member: const int hashbits\n\nInternal size of the hash value in bits.\n\n-- C Member: const int seedbits\n\nSize of seed input in bits.\n\nNew in version 3.4.\n\n-- C Function: *note PyHashFuncDef: 492e. *PyHashGetFuncDef (void)\n\nGet the hash function definition.\n\nSee also\n........\n\nPEP 456(1) \"Secure and interchangeable hash algorithm\".\n\nNew in version 3.4.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0456/\n\nFile: python3.12.info,  Node: Reflection,  Next: Codec registry and support functions,  Prev: PyHash API,  Up: Utilities<2>\n\n\n-- C Function: *note PyObject: 6b1. *PyEvalGetBuiltins (void)\n'Return value: Borrowed reference.''  Part of the *note Stable ABI:\n2ac.'  Return a dictionary of the builtins in the current execution\nframe, or the interpreter of the thread state if no frame is\ncurrently executing.\n\n-- C Function: *note PyObject: 6b1. *PyEvalGetLocals (void)\n'Return value: Borrowed reference.''  Part of the *note Stable ABI:\n2ac.'  Return a dictionary of the local variables in the current\nexecution frame, or 'NULL' if no frame is currently executing.\n\n-- C Function: *note PyObject: 6b1. *PyEvalGetGlobals (void)\n'Return value: Borrowed reference.''  Part of the *note Stable ABI:\n2ac.'  Return a dictionary of the global variables in the current\nexecution frame, or 'NULL' if no frame is currently executing.\n\n-- C Function: *note PyFrameObject: 575. *PyEvalGetFrame (void)\n'Return value: Borrowed reference.''  Part of the *note Stable ABI:\n2ac.'  Return the current thread state's frame, which is 'NULL' if\nno frame is currently executing.\n\nSee also *note PyThreadStateGetFrame(): 57b.\n\n-- C Function: const char *PyEvalGetFuncName (PyObject *func)\n' Part of the *note Stable ABI: 2ac.'  Return the name of 'func' if\nit is a function, class or instance object, else the name of\n'func's type.\n\n-- C Function: const char *PyEvalGetFuncDesc (PyObject *func)\n' Part of the *note Stable ABI: 2ac.'  Return a description string,\ndepending on the type of 'func'.  Return values include \"()\" for\nfunctions and methods, \" constructor\", \" instance\", and \" object\".\nConcatenated with the result of *note PyEvalGetFuncName(): 47a8,\nthe result will be a description of 'func'.\n\nFile: python3.12.info,  Node: Codec registry and support functions,  Next: Support for Perf Maps,  Prev: Reflection,  Up: Utilities<2>\n\n\n-- C Function: int PyCodecRegister (PyObject *searchfunction)\n' Part of the *note Stable ABI: 2ac.'  Register a new codec search\nfunction.\n\nAs side effect, this tries to load the 'encodings' package, if not\nyet done, to make sure that it is always first in the list of\nsearch functions.\n\n-- C Function: int PyCodecUnregister (PyObject *searchfunction)\n' Part of the *note Stable ABI: 2ac. since version 3.10.'\nUnregister a codec search function and clear the registry's cache.\nIf the search function is not registered, do nothing.  Return 0 on\nsuccess.  Raise an exception and return -1 on error.\n\nNew in version 3.10.\n\n-- C Function: int PyCodecKnownEncoding (const char *encoding)\n' Part of the *note Stable ABI: 2ac.'  Return '1' or '0' depending\non whether there is a registered codec for the given 'encoding'.\nThis function always succeeds.\n\n-- C Function: *note PyObject: 6b1. *PyCodecEncode (PyObject *object,\nconst char *encoding, const char *errors)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Generic codec based encoding API.\n\n'object' is passed through the encoder function found for the given\n'encoding' using the error handling method defined by 'errors'.\n'errors' may be 'NULL' to use the default method defined for the\ncodec.  Raises a *note LookupError: 1ed9. if no encoder can be\nfound.\n\n-- C Function: *note PyObject: 6b1. *PyCodecDecode (PyObject *object,\nconst char *encoding, const char *errors)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Generic codec based decoding API.\n\n'object' is passed through the decoder function found for the given\n'encoding' using the error handling method defined by 'errors'.\n'errors' may be 'NULL' to use the default method defined for the\ncodec.  Raises a *note LookupError: 1ed9. if no encoder can be\nfound.\n\n* Menu:\n\n* Codec lookup API::\n* Registry API for Unicode encoding error handlers::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Codec lookup API,  Next: Registry API for Unicode encoding error handlers,  Up: Codec registry and support functions": {
            "content": "7.6.10.1 Codec lookup API\n.........................\n",
            "subsections": []
        },
        "In the following functions, the 'encoding' string is looked up converted": {
            "content": "to all lower-case characters, which makes encodings looked up through\nthis mechanism effectively case-insensitive.  If no codec is found, a\n*note KeyError: 8cf. is set and 'NULL' returned.\n\n-- C Function: *note PyObject: 6b1. *PyCodecEncoder (const char\n*encoding)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Get an encoder function for the given 'encoding'.\n\n-- C Function: *note PyObject: 6b1. *PyCodecDecoder (const char\n*encoding)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Get a decoder function for the given 'encoding'.\n\n-- C Function: *note PyObject: 6b1. *PyCodecIncrementalEncoder (const\nchar *encoding, const char *errors)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Get an *note IncrementalEncoder: 20d7. object for the given\n'encoding'.\n\n-- C Function: *note PyObject: 6b1. *PyCodecIncrementalDecoder (const\nchar *encoding, const char *errors)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Get an *note IncrementalDecoder: 20d8. object for the given\n'encoding'.\n\n-- C Function: *note PyObject: 6b1. *PyCodecStreamReader (const char\n*encoding, PyObject *stream, const char *errors)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Get a *note StreamReader: 20dc. factory function for the\ngiven 'encoding'.\n\n-- C Function: *note PyObject: 6b1. *PyCodecStreamWriter (const char\n*encoding, PyObject *stream, const char *errors)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Get a *note StreamWriter: 20db. factory function for the\ngiven 'encoding'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Registry API for Unicode encoding error handlers,  Prev: Codec lookup API,  Up: Codec registry and support functions": {
            "content": "7.6.10.2 Registry API for Unicode encoding error handlers\n.........................................................\n\n-- C Function: int PyCodecRegisterError (const char *name, PyObject\n*error)\n' Part of the *note Stable ABI: 2ac.'  Register the error handling\ncallback function 'error' under the given 'name'.  This callback\nfunction will be called by a codec when it encounters unencodable\ncharacters/undecodable bytes and 'name' is specified as the error\nparameter in the call to the encode/decode function.\n\nThe callback gets a single argument, an instance of *note\nUnicodeEncodeError: 442, *note UnicodeDecodeError: 83c. or *note\nUnicodeTranslateError: 1fac. that holds information about the\nproblematic sequence of characters or bytes and their offset in the\noriginal string (see *note Unicode Exception Objects: 48f7. for\nfunctions to extract this information).  The callback must either\nraise the given exception, or return a two-item tuple containing\nthe replacement for the problematic sequence, and an integer giving\nthe offset in the original string at which encoding/decoding should\nbe resumed.\n\nReturn '0' on success, '-1' on error.\n\n-- C Function: *note PyObject: 6b1. *PyCodecLookupError (const char\n*name)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Lookup the error handling callback function registered under\n'name'.  As a special case 'NULL' can be passed, in which case the\nerror handling callback for \"strict\" will be returned.\n\n-- C Function: *note PyObject: 6b1. *PyCodecStrictErrors (PyObject\n*exc)\n'Return value: Always NULL.'' Part of the *note Stable ABI: 2ac.'\nRaise 'exc' as an exception.\n\n-- C Function: *note PyObject: 6b1. *PyCodecIgnoreErrors (PyObject\n*exc)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Ignore the unicode error, skipping the faulty input.\n\n-- C Function: *note PyObject: 6b1. *PyCodecReplaceErrors (PyObject\n*exc)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Replace the unicode encode error with '?' or 'U+FFFD'.\n\n-- C Function: *note PyObject: 6b1. *PyCodecXMLCharRefReplaceErrors\n(PyObject *exc)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Replace the unicode encode error with XML character\nreferences.\n\n-- C Function: *note PyObject: 6b1. *PyCodecBackslashReplaceErrors\n(PyObject *exc)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Replace the unicode encode error with backslash escapes\n('\\x', '\\u' and '\\U').\n\n-- C Function: *note PyObject: 6b1. *PyCodecNameReplaceErrors\n(PyObject *exc)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\nsince version 3.7.'  Replace the unicode encode error with\n'\\N{...}' escapes.\n\nNew in version 3.5.\n\nFile: python3.12.info,  Node: Support for Perf Maps,  Prev: Codec registry and support functions,  Up: Utilities<2>\n\n",
            "subsections": []
        },
        "On supported platforms (as of this writing, only Linux), the runtime can": {
            "content": "take advantage of 'perf map files' to make Python functions visible to\nan external profiling tool (such as perf(1)).  A running process may\ncreate a file in the '/tmp' directory, which contains entries that can\nmap a section of executable code to a name.  This interface is described\nin the documentation of the Linux Perf tool(2).\n",
            "subsections": []
        },
        "In Python, these helper APIs can be used by libraries and features that": {
            "content": "rely on generating machine code on the fly.\n",
            "subsections": []
        },
        "Note that holding the Global Interpreter Lock (GIL) is not required for": {
            "content": "these APIs.\n\n-- C Function: int PyUnstablePerfMapStateInit (void)\n\nThis is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 29f. It may change without warning in minor releases.':\nOpen the '/tmp/perf-$pid.map' file, unless it's already opened, and\ncreate a lock to ensure thread-safe writes to the file (provided\nthe writes are done through *note PyUnstableWritePerfMapEntry():\n1482.).  Normally, there's no need to call this explicitly; just\nuse *note PyUnstableWritePerfMapEntry(): 1482. and it will\ninitialize the state on first call.\n\nReturns '0' on success, '-1' on failure to create/open the perf map\nfile, or '-2' on failure to create a lock.  Check 'errno' for more\ninformation about the cause of a failure.\n\n-- C Function: int PyUnstableWritePerfMapEntry (const void *codeaddr,\nunsigned int codesize, const char *entryname)\n\nThis is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 29f. It may change without warning in minor releases.':\nWrite one single entry to the '/tmp/perf-$pid.map' file.  This\nfunction is thread safe.  Here is what an example entry looks like:\n\n# address      size  name\n7f3529fcf759 b     py::bar:/run/t.py\n\nWill call *note PyUnstablePerfMapStateInit(): 1483. before\nwriting the entry, if the perf map file is not already opened.\nReturns '0' on success, or the same error codes as *note\nPyUnstablePerfMapStateInit(): 1483. on failure.\n\n-- C Function: void PyUnstablePerfMapStateFini (void)\n\nThis is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 29f. It may change without warning in minor releases.':\nClose the perf map file opened by *note\nPyUnstablePerfMapStateInit(): 1483.  This is called by the\nruntime itself during interpreter shut-down.  In general, there\nshouldn't be a reason to explicitly call this, except to handle\nspecific scenarios such as forking.\n\n---------- Footnotes ----------\n\n(1) https://perf.wiki.kernel.org/index.php/MainPage\n\n(2)\nhttps://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/Documentation/jit-interface.txt\n\nFile: python3.12.info,  Node: Abstract Objects Layer,  Next: Concrete Objects Layer,  Prev: Utilities<2>,  Up: Python/C API Reference Manual\n",
            "subsections": [
                {
                    "name": "7.7 Abstract Objects Layer",
                    "content": ""
                }
            ]
        },
        "The functions in this chapter interact with Python objects regardless of": {
            "content": "their type, or with wide classes of object types (e.g.  all numerical\ntypes, or all sequence types).  When used on object types for which they\ndo not apply, they will raise a Python exception.\n",
            "subsections": []
        },
        "It is not possible to use these functions on objects that are not": {
            "content": "properly initialized, such as a list object that has been created by\n*note PyListNew(): 4734, but whose items have not been set to some\nnon-'NULL' value yet.\n\n* Menu:\n\n* Object Protocol::\n* Call Protocol::\n* Number Protocol::\n* Sequence Protocol::\n* Mapping Protocol::\n* Iterator Protocol::\n* Buffer Protocol::\n* Old Buffer Protocol::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Object Protocol,  Next: Call Protocol,  Up: Abstract Objects Layer": {
            "content": "-- C Variable: *note PyObject: 6b1. *PyNotImplemented\n\nThe 'NotImplemented' singleton, used to signal that an operation is\nnot implemented for the given type combination.\n\n-- C Macro: PyRETURNNOTIMPLEMENTED\n\nProperly handle returning *note PyNotImplemented: 4942. from\nwithin a C function (that is, create a new *note strong reference:\n57c. to NotImplemented and return it).\n\n-- C Macro: PyPRINTRAW\n\nFlag to be used with multiple functions that print the object (like\n*note PyObjectPrint(): 17d2. and *note PyFileWriteObject():\n47b6.).  If passed, these function would use the *note str(): 157.\nof the object instead of the *note repr(): 5f0.\n\n-- C Function: int PyObjectPrint (PyObject *o, FILE *fp, int flags)\n\nPrint an object 'o', on file 'fp'.  Returns '-1' on error.  The\nflags argument is used to enable certain printing options.  The\nonly option currently supported is *note PyPRINTRAW: 4944.; if\ngiven, the *note str(): 157. of the object is written instead of\nthe *note repr(): 5f0.\n\n-- C Function: int PyObjectHasAttr (PyObject *o, PyObject *attrname)\n' Part of the *note Stable ABI: 2ac.'  Returns '1' if 'o' has the\nattribute 'attrname', and '0' otherwise.  This is equivalent to\nthe Python expression 'hasattr(o, attrname)'.  This function\nalways succeeds.\n\nNote: Exceptions that occur when this calls *note\ngetattr(): 1f8. and *note getattribute(): a16. methods\nare silently ignored.  For proper error handling, use *note\nPyObjectGetAttr(): 4821. instead.\n\n-- C Function: int PyObjectHasAttrString (PyObject *o, const char\n*attrname)\n' Part of the *note Stable ABI: 2ac.'  This is the same as *note\nPyObjectHasAttr(): 4823, but 'attrname' is specified as a const\nchar* UTF-8 encoded bytes string, rather than a *note PyObject:\n6b1.*.\n\nNote: Exceptions that occur when this calls *note\ngetattr(): 1f8. and *note getattribute(): a16. methods\nor while creating the temporary *note str: 157. object are\nsilently ignored.  For proper error handling, use *note\nPyObjectGetAttrString(): 46b4. instead.\n\n-- C Function: *note PyObject: 6b1. *PyObjectGetAttr (PyObject *o,\nPyObject *attrname)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Retrieve an attribute named 'attrname' from object 'o'.\nReturns the attribute value on success, or 'NULL' on failure.  This\nis the equivalent of the Python expression 'o.attrname'.\n\n-- C Function: *note PyObject: 6b1. *PyObjectGetAttrString (PyObject\n*o, const char *attrname)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  This is the same as *note PyObjectGetAttr(): 4821, but\n'attrname' is specified as a const char* UTF-8 encoded bytes\nstring, rather than a *note PyObject: 6b1.*.\n\n-- C Function: *note PyObject: 6b1. *PyObjectGenericGetAttr (PyObject\n*o, PyObject *name)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Generic attribute getter function that is meant to be put\ninto a type object's 'tpgetattro' slot.  It looks for a descriptor\nin the dictionary of classes in the object's MRO as well as an\nattribute in the object's *note dict: aa8. (if present).  As\noutlined in *note Implementing Descriptors: a98, data descriptors\ntake preference over instance attributes, while non-data\ndescriptors don't.  Otherwise, an *note AttributeError: 395. is\nraised.\n\n-- C Function: int PyObjectSetAttr (PyObject *o, PyObject *attrname,\nPyObject *v)\n' Part of the *note Stable ABI: 2ac.'  Set the value of the\nattribute named 'attrname', for object 'o', to the value 'v'.\nRaise an exception and return '-1' on failure; return '0' on\nsuccess.  This is the equivalent of the Python statement\n'o.attrname = v'.\n\nIf 'v' is 'NULL', the attribute is deleted.  This behaviour is\ndeprecated in favour of using *note PyObjectDelAttr(): 4945, but\nthere are currently no plans to remove it.\n\n-- C Function: int PyObjectSetAttrString (PyObject *o, const char\n*attrname, PyObject *v)\n' Part of the *note Stable ABI: 2ac.'  This is the same as *note\nPyObjectSetAttr(): 4827, but 'attrname' is specified as a const\nchar* UTF-8 encoded bytes string, rather than a *note PyObject:\n6b1.*.\n\nIf 'v' is 'NULL', the attribute is deleted, but this feature is\ndeprecated in favour of using *note PyObjectDelAttrString(): 4946.\n\n-- C Function: int PyObjectGenericSetAttr (PyObject *o, PyObject\n*name, PyObject *value)\n' Part of the *note Stable ABI: 2ac.'  Generic attribute setter and\ndeleter function that is meant to be put into a type object's *note\ntpsetattro: 46ea. slot.  It looks for a data descriptor in the\ndictionary of classes in the object's MRO, and if found it takes\npreference over setting or deleting the attribute in the instance\ndictionary.  Otherwise, the attribute is set or deleted in the\nobject's *note dict: aa8. (if present).  On success, '0' is\nreturned, otherwise an *note AttributeError: 395. is raised and\n'-1' is returned.\n\n-- C Function: int PyObjectDelAttr (PyObject *o, PyObject *attrname)\n\nDelete attribute named 'attrname', for object 'o'.  Returns '-1'\non failure.  This is the equivalent of the Python statement 'del\no.attrname'.\n\n-- C Function: int PyObjectDelAttrString (PyObject *o, const char\n*attrname)\n\nThis is the same as *note PyObjectDelAttr(): 4945, but 'attrname'\nis specified as a const char* UTF-8 encoded bytes string, rather\nthan a *note PyObject: 6b1.*.\n\n-- C Function: *note PyObject: 6b1. *PyObjectGenericGetDict (PyObject\n*o, void *context)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\nsince version 3.10.'  A generic implementation for the getter of a\n'dict' descriptor.  It creates the dictionary if necessary.\n\nThis function may also be called to get the *note dict: aa8. of\nthe object 'o'.  Pass 'NULL' for 'context' when calling it.  Since\nthis function may need to allocate memory for the dictionary, it\nmay be more efficient to call *note PyObjectGetAttr(): 4821. when\naccessing an attribute on the object.\n\nOn failure, returns 'NULL' with an exception set.\n\nNew in version 3.3.\n\n-- C Function: int PyObjectGenericSetDict (PyObject *o, PyObject\n*value, void *context)\n' Part of the *note Stable ABI: 2ac. since version 3.7.'  A generic\nimplementation for the setter of a 'dict' descriptor.  This\nimplementation does not allow the dictionary to be deleted.\n\nNew in version 3.3.\n\n-- C Function: *note PyObject: 6b1. PyObjectGetDictPtr (PyObject\n*obj)\n\nReturn a pointer to *note dict: aa8. of the object 'obj'.  If\nthere is no 'dict', return 'NULL' without setting an exception.\n\nThis function may need to allocate memory for the dictionary, so it\nmay be more efficient to call *note PyObjectGetAttr(): 4821. when\naccessing an attribute on the object.\n\n-- C Function: *note PyObject: 6b1. *PyObjectRichCompare (PyObject\n*o1, PyObject *o2, int opid)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Compare the values of 'o1' and 'o2' using the operation\nspecified by 'opid', which must be one of *note PyLT: 4948, *note\nPyLE: 4949, *note PyEQ: 494a, *note PyNE: 494b, *note PyGT:\n494c, or *note PyGE: 494d, corresponding to '<', '<=', '==', '!=',\n'>', or '>=' respectively.  This is the equivalent of the Python\nexpression 'o1 op o2', where 'op' is the operator corresponding to\n'opid'.  Returns the value of the comparison on success, or 'NULL'\non failure.\n\n-- C Function: int PyObjectRichCompareBool (PyObject *o1, PyObject\n*o2, int opid)\n' Part of the *note Stable ABI: 2ac.'  Compare the values of 'o1'\nand 'o2' using the operation specified by 'opid', like *note\nPyObjectRichCompare(): 46f3, but returns '-1' on error, '0' if the\nresult is false, '1' otherwise.\n\nNote: If 'o1' and 'o2' are the same object, *note\nPyObjectRichCompareBool(): 1711. will always return '1' for *note\nPyEQ: 494a. and '0' for *note PyNE: 494b.\n\n-- C Function: *note PyObject: 6b1. *PyObjectFormat (PyObject *obj,\nPyObject *formatspec)\n' Part of the *note Stable ABI: 2ac.'  Format 'obj' using\n'formatspec'.  This is equivalent to the Python expression\n'format(obj, formatspec)'.\n\n'formatspec' may be 'NULL'.  In this case the call is equivalent\nto 'format(obj)'.  Returns the formatted string on success, 'NULL'\non failure.\n\n-- C Function: *note PyObject: 6b1. *PyObjectRepr (PyObject *o)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'\n\nCompute a string representation of object 'o'.  Returns the string\nrepresentation on success, 'NULL' on failure.  This is the\nequivalent of the Python expression 'repr(o)'.  Called by the *note\nrepr(): 5f0. built-in function.\n\nChanged in version 3.4: This function now includes a debug\nassertion to help ensure that it does not silently discard an\nactive exception.\n\n-- C Function: *note PyObject: 6b1. *PyObjectASCII (PyObject *o)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'\n\nAs *note PyObjectRepr(): ea6, compute a string representation of\nobject 'o', but escape the non-ASCII characters in the string\nreturned by *note PyObjectRepr(): ea6. with '\\x', '\\u' or '\\U'\nescapes.  This generates a string similar to that returned by *note\nPyObjectRepr(): ea6. in Python 2.  Called by the *note ascii():\n123b. built-in function.\n\n-- C Function: *note PyObject: 6b1. *PyObjectStr (PyObject *o)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Compute a string representation of object 'o'.  Returns the\nstring representation on success, 'NULL' on failure.  This is the\nequivalent of the Python expression 'str(o)'.  Called by the *note\nstr(): 157. built-in function and, therefore, by the *note print():\nde5. function.\n\nChanged in version 3.4: This function now includes a debug\nassertion to help ensure that it does not silently discard an\nactive exception.\n\n-- C Function: *note PyObject: 6b1. *PyObjectBytes (PyObject *o)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'\n\nCompute a bytes representation of object 'o'.  'NULL' is returned\non failure and a bytes object on success.  This is equivalent to\nthe Python expression 'bytes(o)', when 'o' is not an integer.\nUnlike 'bytes(o)', a TypeError is raised when 'o' is an integer\ninstead of a zero-initialized bytes object.\n\n-- C Function: int PyObjectIsSubclass (PyObject *derived, PyObject\n*cls)\n' Part of the *note Stable ABI: 2ac.'  Return '1' if the class\n'derived' is identical to or derived from the class 'cls',\notherwise return '0'.  In case of an error, return '-1'.\n\nIf 'cls' is a tuple, the check will be done against every entry in\n'cls'.  The result will be '1' when at least one of the checks\nreturns '1', otherwise it will be '0'.\n\nIf 'cls' has a *note subclasscheck(): 1c85. method, it will be\ncalled to determine the subclass status as described in PEP\n3119(1).  Otherwise, 'derived' is a subclass of 'cls' if it is a\ndirect or indirect subclass, i.e.  contained in 'cls.mro'.\n\nNormally only class objects, i.e.  instances of *note type: ba0. or\na derived class, are considered classes.  However, objects can\noverride this by having a *note bases: 1303. attribute (which\nmust be a tuple of base classes).\n\n-- C Function: int PyObjectIsInstance (PyObject *inst, PyObject *cls)\n' Part of the *note Stable ABI: 2ac.'  Return '1' if 'inst' is an\ninstance of the class 'cls' or a subclass of 'cls', or '0' if not.\nOn error, returns '-1' and sets an exception.\n\nIf 'cls' is a tuple, the check will be done against every entry in\n'cls'.  The result will be '1' when at least one of the checks\nreturns '1', otherwise it will be '0'.\n\nIf 'cls' has a *note instancecheck(): 1c84. method, it will be\ncalled to determine the subclass status as described in PEP\n3119(2).  Otherwise, 'inst' is an instance of 'cls' if its class is\na subclass of 'cls'.\n\nAn instance 'inst' can override what is considered its class by\nhaving a *note class: 1304. attribute.\n\nAn object 'cls' can override if it is considered a class, and what\nits base classes are, by having a *note bases: 1303. attribute\n(which must be a tuple of base classes).\n\n-- C Function: *note Pyhasht: 10dc. PyObjectHash (PyObject *o)\n' Part of the *note Stable ABI: 2ac.'\n\nCompute and return the hash value of an object 'o'.  On failure,\nreturn '-1'.  This is the equivalent of the Python expression\n'hash(o)'.\n\nChanged in version 3.2: The return type is now Pyhasht.  This is\na signed integer the same size as *note Pyssizet: 88d.\n\n-- C Function: *note Pyhasht: 10dc. PyObjectHashNotImplemented\n(PyObject *o)\n' Part of the *note Stable ABI: 2ac.'  Set a *note TypeError: 28e.\nindicating that 'type(o)' is not *note hashable: 3db. and return\n'-1'.  This function receives special treatment when stored in a\n'tphash' slot, allowing a type to explicitly indicate to the\ninterpreter that it is not hashable.\n\n-- C Function: int PyObjectIsTrue (PyObject *o)\n' Part of the *note Stable ABI: 2ac.'  Returns '1' if the object\n'o' is considered to be true, and '0' otherwise.  This is\nequivalent to the Python expression 'not not o'.  On failure,\nreturn '-1'.\n\n-- C Function: int PyObjectNot (PyObject *o)\n' Part of the *note Stable ABI: 2ac.'  Returns '0' if the object\n'o' is considered to be true, and '1' otherwise.  This is\nequivalent to the Python expression 'not o'.  On failure, return\n'-1'.\n\n-- C Function: *note PyObject: 6b1. *PyObjectType (PyObject *o)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'\n\nWhen 'o' is non-'NULL', returns a type object corresponding to the\nobject type of object 'o'.  On failure, raises *note SystemError:\n2d7. and returns 'NULL'.  This is equivalent to the Python\nexpression 'type(o)'.  This function creates a new *note strong\nreference: 57c. to the return value.  There's really no reason to\nuse this function instead of the *note PyTYPE(): 56b. function,\nwhich returns a pointer of type *note PyTypeObject: 8da.*, except\nwhen a new *note strong reference: 57c. is needed.\n\n-- C Function: int PyObjectTypeCheck (PyObject *o, PyTypeObject *type)\n\nReturn non-zero if the object 'o' is of type 'type' or a subtype of\n'type', and '0' otherwise.  Both parameters must be non-'NULL'.\n\n-- C Function: *note Pyssizet: 88d. PyObjectSize (PyObject *o)\n-- C Function: *note Pyssizet: 88d. PyObjectLength (PyObject *o)\n' Part of the *note Stable ABI: 2ac.'\n\nReturn the length of object 'o'.  If the object 'o' provides either\nthe sequence and mapping protocols, the sequence length is\nreturned.  On error, '-1' is returned.  This is the equivalent to\nthe Python expression 'len(o)'.\n\n-- C Function: *note Pyssizet: 88d. PyObjectLengthHint (PyObject *o,\nPyssizet defaultvalue)\n\nReturn an estimated length for the object 'o'.  First try to return\nits actual length, then an estimate using *note lengthhint():\nd73, and finally return the default value.  On error return '-1'.\nThis is the equivalent to the Python expression\n'operator.lengthhint(o, defaultvalue)'.\n\nNew in version 3.4.\n\n-- C Function: *note PyObject: 6b1. *PyObjectGetItem (PyObject *o,\nPyObject *key)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return element of 'o' corresponding to the object 'key' or\n'NULL' on failure.  This is the equivalent of the Python expression\n'o[key]'.\n\n-- C Function: int PyObjectSetItem (PyObject *o, PyObject *key,\nPyObject *v)\n' Part of the *note Stable ABI: 2ac.'  Map the object 'key' to the\nvalue 'v'.  Raise an exception and return '-1' on failure; return\n'0' on success.  This is the equivalent of the Python statement\n'o[key] = v'.  This function 'does not' steal a reference to 'v'.\n\n-- C Function: int PyObjectDelItem (PyObject *o, PyObject *key)\n' Part of the *note Stable ABI: 2ac.'  Remove the mapping for the\nobject 'key' from the object 'o'.  Return '-1' on failure.  This is\nequivalent to the Python statement 'del o[key]'.\n\n-- C Function: *note PyObject: 6b1. *PyObjectDir (PyObject *o)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  This is equivalent to the Python expression 'dir(o)',\nreturning a (possibly empty) list of strings appropriate for the\nobject argument, or 'NULL' if there was an error.  If the argument\nis 'NULL', this is like the Python 'dir()', returning the names of\nthe current locals; in this case, if no execution frame is active\nthen 'NULL' is returned but *note PyErrOccurred(): 1656. will\nreturn false.\n\n-- C Function: *note PyObject: 6b1. *PyObjectGetIter (PyObject *o)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  This is equivalent to the Python expression 'iter(o)'.  It\nreturns a new iterator for the object argument, or the object\nitself if the object is already an iterator.  Raises *note\nTypeError: 28e. and returns 'NULL' if the object cannot be\niterated.\n\n-- C Function: *note PyObject: 6b1. *PyObjectGetAIter (PyObject *o)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\nsince version 3.10.'  This is the equivalent to the Python\nexpression 'aiter(o)'.  Takes an 'AsyncIterable' object and returns\nan 'AsyncIterator' for it.  This is typically a new iterator but if\nthe argument is an 'AsyncIterator', this returns itself.  Raises\n*note TypeError: 28e. and returns 'NULL' if the object cannot be\niterated.\n\nNew in version 3.10.\n\n-- C Function: void *PyObjectGetTypeData (PyObject *o, PyTypeObject\n*cls)\n' Part of the *note Stable ABI: 2ac. since version 3.12.'  Get a\npointer to subclass-specific data reserved for 'cls'.\n\nThe object 'o' must be an instance of 'cls', and 'cls' must have\nbeen created using negative *note PyTypeSpec.basicsize: 2a0.\nPython does not check this.\n\nOn error, set an exception and return 'NULL'.\n\nNew in version 3.12.\n\n-- C Function: *note Pyssizet: 88d. PyTypeGetTypeDataSize\n(PyTypeObject *cls)\n' Part of the *note Stable ABI: 2ac. since version 3.12.'  Return\nthe size of the instance memory space reserved for 'cls', i.e.  the\nsize of the memory *note PyObjectGetTypeData(): 2a1. returns.\n\nThis may be larger than requested using *note\n-PyTypeSpec.basicsize: 2a0.; it is safe to use this larger size\n(e.g.  with 'memset()').\n\nThe type 'cls' 'must' have been created using negative *note\nPyTypeSpec.basicsize: 2a0.  Python does not check this.\n\nOn error, set an exception and return a negative value.\n\nNew in version 3.12.\n\n-- C Function: void *PyObjectGetItemData (PyObject *o)\n\nGet a pointer to per-item data for a class with *note\nPyTPFLAGSITEMSATEND: 2a3.\n\nOn error, set an exception and return 'NULL'.  *note TypeError:\n28e. is raised if 'o' does not have *note PyTPFLAGSITEMSATEND:\n2a3. set.\n\nNew in version 3.12.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3119/\n\n(2) https://peps.python.org/pep-3119/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Call Protocol,  Next: Number Protocol,  Prev: Object Protocol,  Up: Abstract Objects Layer": {
            "content": "CPython supports two different calling protocols: 'tpcall' and\nvectorcall.\n\n* Menu:\n\n* The tpcall Protocol::\n* The Vectorcall Protocol::\n* Object Calling API::\n* Call Support API::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The tpcall Protocol,  Next: The Vectorcall Protocol,  Up: Call Protocol": {
            "content": "7.7.2.1 The 'tpcall' Protocol\n..............................\n\nInstances of classes that set *note tpcall: 2b3. are callable.  The\nsignature of the slot is:\n\nPyObject *tpcall(PyObject *callable, PyObject *args, PyObject *kwargs);\n\nA call is made using a tuple for the positional arguments and a dict for\nthe keyword arguments, similarly to 'callable(*args, kwargs)' in",
            "subsections": []
        },
        "Python code.  'args' must be non-NULL (use an empty tuple if there are": {
            "content": "no arguments) but 'kwargs' may be 'NULL' if there are no keyword\narguments.\n\nThis convention is not only used by 'tpcall': *note tpnew: 2e1. and\n*note tpinit: 2e3. also pass arguments this way.\n\nTo call an object, use *note PyObjectCall(): 787. or another *note call\nAPI: 4951.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The Vectorcall Protocol,  Next: Object Calling API,  Prev: The tpcall Protocol,  Up: Call Protocol": {
            "content": "7.7.2.2 The Vectorcall Protocol\n...............................\n\nNew in version 3.9.\n",
            "subsections": []
        },
        "The vectorcall protocol was introduced in PEP 590(1) as an additional": {
            "content": "protocol for making calls more efficient.\n",
            "subsections": []
        },
        "As rule of thumb, CPython will prefer the vectorcall for internal calls": {
            "content": "if the callable supports it.  However, this is not a hard rule.",
            "subsections": []
        },
        "Additionally, some third-party extensions use 'tpcall' directly (rather": {
            "content": "than using *note PyObjectCall(): 787.).  Therefore, a class supporting\nvectorcall must also implement *note tpcall: 2b3.  Moreover, the\ncallable must behave the same regardless of which protocol is used.  The\nrecommended way to achieve this is by setting *note tpcall: 2b3. to\n*note PyVectorcallCall(): 2af.  This bears repeating:\n\nWarning: A class supporting vectorcall 'must' also implement *note\ntpcall: 2b3. with the same semantics.\n\nChanged in version 3.12: The *note PyTPFLAGSHAVEVECTORCALL: 2ad. flag\nis now removed from a class when the class's *note call(): 2b1.\nmethod is reassigned.  (This internally sets *note tpcall: 2b3. only,\nand thus may make it behave differently than the vectorcall function.)\nIn earlier Python versions, vectorcall should only be used with *note\nimmutable: 2b2. or static types.\n\nA class should not implement vectorcall if that would be slower than\n'tpcall'.  For example, if the callee needs to convert the arguments to\nan args tuple and kwargs dict anyway, then there is no point in\nimplementing vectorcall.\n\nClasses can implement the vectorcall protocol by enabling the *note\nPyTPFLAGSHAVEVECTORCALL: 2ad. flag and setting *note\ntpvectorcalloffset: 4953. to the offset inside the object structure\nwhere a 'vectorcallfunc' appears.  This is a pointer to a function with\nthe following signature:\n\n-- C Type: typedef *note PyObject: 6b1. *(*vectorcallfunc)(*note\nPyObject: 6b1. *callable, *note PyObject: 6b1. *const *args,\nsizet nargsf, *note PyObject: 6b1. *kwnames)\n' Part of the *note Stable ABI: 2ac. since version 3.12.'\n\n- 'callable' is the object being called.\n\n-\n'args' is a C array consisting of the positional arguments followed by the\n\nvalues of the keyword arguments.  This can be 'NULL' if there\nare no arguments.\n\n-\n'nargsf' is the number of positional arguments plus possibly the\n\n*note PYVECTORCALLARGUMENTSOFFSET: 2b8. flag.  To get the\nactual number of positional arguments from 'nargsf', use *note\nPyVectorcallNARGS(): 2ae.\n\n-\n'kwnames' is a tuple containing the names of the keyword arguments;\n\nin other words, the keys of the kwargs dict.  These names must\nbe strings (instances of 'str' or a subclass) and they must be\nunique.  If there are no keyword arguments, then 'kwnames' can\ninstead be 'NULL'.\n\n-- C Macro: PYVECTORCALLARGUMENTSOFFSET\n' Part of the *note Stable ABI: 2ac. since version 3.12.'  If this\nflag is set in a vectorcall 'nargsf' argument, the callee is\nallowed to temporarily change 'args[-1]'.  In other words, 'args'\npoints to argument 1 (not 0) in the allocated vector.  The callee\nmust restore the value of 'args[-1]' before returning.\n\nFor *note PyObjectVectorcallMethod(): 2b7, this flag means instead\nthat 'args[0]' may be changed.\n\nWhenever they can do so cheaply (without additional allocation),\ncallers are encouraged to use *note PYVECTORCALLARGUMENTSOFFSET:\n2b8.  Doing so will allow callables such as bound methods to make\ntheir onward calls (which include a prepended 'self' argument) very\nefficiently.\n\nNew in version 3.8.\n\nTo call an object that implements vectorcall, use a *note call API:\n4951. function as with any other callable.  *note PyObjectVectorcall():\n2b6. will usually be most efficient.\n\nNote: In CPython 3.8, the vectorcall API and related functions were\navailable provisionally under names with a leading underscore:\n'PyObjectVectorcall', 'PyTPFLAGSHAVEVECTORCALL',\n'PyObjectVectorcallMethod', 'PyVectorcallFunction',\n'PyObjectCallOneArg', 'PyObjectCallMethodNoArgs',\n'PyObjectCallMethodOneArg'.  Additionally,\n'PyObjectVectorcallDict' was available as\n'PyObjectFastCallDict'.  The old names are still defined as\naliases of the new, non-underscored names.\n\n* Menu:\n\n* Recursion Control: Recursion Control<2>.\n* Vectorcall Support API::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0590/\n\nFile: python3.12.info,  Node: Recursion Control<2>,  Next: Vectorcall Support API,  Up: The Vectorcall Protocol\n\n7.7.2.3 Recursion Control\n.........................\n\nWhen using 'tpcall', callees do not need to worry about *note\nrecursion: 48f8.: CPython uses *note PyEnterRecursiveCall(): 797. and\n*note PyLeaveRecursiveCall(): 798. for calls made using 'tpcall'.\n\nFor efficiency, this is not the case for calls done using vectorcall:\nthe callee should use 'PyEnterRecursiveCall' and\n'PyLeaveRecursiveCall' if needed.\n\nFile: python3.12.info,  Node: Vectorcall Support API,  Prev: Recursion Control<2>,  Up: The Vectorcall Protocol\n\n7.7.2.4 Vectorcall Support API\n..............................\n\n-- C Function: *note Pyssizet: 88d. PyVectorcallNARGS (sizet\nnargsf)\n' Part of the *note Stable ABI: 2ac. since version 3.12.'  Given a\nvectorcall 'nargsf' argument, return the actual number of\narguments.  Currently equivalent to:\n\n(Pyssizet)(nargsf & ~PYVECTORCALLARGUMENTSOFFSET)\n\nHowever, the function 'PyVectorcallNARGS' should be used to allow\nfor future extensions.\n\nNew in version 3.8.\n\n-- C Function: *note vectorcallfunc: 2b0. PyVectorcallFunction\n(PyObject *op)\n\nIf 'op' does not support the vectorcall protocol (either because\nthe type does not or because the specific instance does not),\nreturn 'NULL'. Otherwise, return the vectorcall function pointer\nstored in 'op'.  This function never raises an exception.\n\nThis is mostly useful to check whether or not 'op' supports\nvectorcall, which can be done by checking\n'PyVectorcallFunction(op) != NULL'.\n\nNew in version 3.9.\n\n-- C Function: *note PyObject: 6b1. *PyVectorcallCall (PyObject\n*callable, PyObject *tuple, PyObject *dict)\n' Part of the *note Stable ABI: 2ac. since version 3.12.'  Call\n'callable''s *note vectorcallfunc: 2b0. with positional and keyword\narguments given in a tuple and dict, respectively.\n\nThis is a specialized function, intended to be put in the *note\ntpcall: 2b3. slot or be used in an implementation of 'tpcall'.\nIt does not check the *note PyTPFLAGSHAVEVECTORCALL: 2ad. flag\nand it does not fall back to 'tpcall'.\n\nNew in version 3.8.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Object Calling API,  Next: Call Support API,  Prev: The Vectorcall Protocol,  Up: Call Protocol": {
            "content": "7.7.2.5 Object Calling API\n..........................\n",
            "subsections": []
        },
        "Various functions are available for calling a Python object.  Each": {
            "content": "converts its arguments to a convention supported by the called object -\neither 'tpcall' or vectorcall.  In order to do as little conversion as\npossible, pick one that best fits the format of data you have available.\n",
            "subsections": []
        },
        "The following table summarizes the available functions; please see": {
            "content": "individual documentation for details.\n",
            "subsections": []
        },
        "Function                                       callable               args                     kwargs": {
            "content": "-------------------------------------------------------------------------------------------------------------------\n\n*note PyObjectCall(): 787.                    'PyObject *'           tuple                    dict/'NULL'\n\n\n*note PyObjectCallNoArgs(): 796.              'PyObject *'           --                        --\n\n\n*note PyObjectCallOneArg(): 79c.              'PyObject *'           1 object                 --\n\n\n*note PyObjectCallObject(): 46a9.             'PyObject *'           tuple/'NULL'             --\n\n\n*note PyObjectCallFunction(): 8d6.            'PyObject *'           format                   --\n\n\n*note PyObjectCallMethod(): 2d4.              obj + 'char*'          format                   --\n\n\n*note PyObjectCallFunctionObjArgs(): 4819.    'PyObject *'           variadic                 --\n\n\n*note PyObjectCallMethodObjArgs(): 1774.      obj + name             variadic                 --\n\n\n*note PyObjectCallMethodNoArgs(): 4958.       obj + name             --                        --\n\n\n*note PyObjectCallMethodOneArg(): 4959.       obj + name             1 object                 --\n\n\n*note PyObjectVectorcall(): 2b6.              'PyObject *'           vectorcall               vectorcall\n\n\n*note PyObjectVectorcallDict(): 495a.         'PyObject *'           vectorcall               dict/'NULL'\n\n\n*note PyObjectVectorcallMethod(): 2b7.        arg + name             vectorcall               vectorcall\n\n\n-- C Function: *note PyObject: 6b1. *PyObjectCall (PyObject *callable,\nPyObject *args, PyObject *kwargs)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Call a callable Python object 'callable', with arguments\ngiven by the tuple 'args', and named arguments given by the\ndictionary 'kwargs'.\n\n'args' must not be 'NULL'; use an empty tuple if no arguments are\nneeded.  If no named arguments are needed, 'kwargs' can be 'NULL'.\n\nReturn the result of the call on success, or raise an exception and\nreturn 'NULL' on failure.\n\nThis is the equivalent of the Python expression: 'callable(*args,\nkwargs)'.\n\n-- C Function: *note PyObject: 6b1. *PyObjectCallNoArgs (PyObject\n*callable)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\nsince version 3.10.'  Call a callable Python object 'callable'\nwithout any arguments.  It is the most efficient way to call a\ncallable Python object without any argument.\n\nReturn the result of the call on success, or raise an exception and\nreturn 'NULL' on failure.\n\nNew in version 3.9.\n\n-- C Function: *note PyObject: 6b1. *PyObjectCallOneArg (PyObject\n*callable, PyObject *arg)\n'Return value: New reference.'  Call a callable Python object\n'callable' with exactly 1 positional argument 'arg' and no keyword\narguments.\n\nReturn the result of the call on success, or raise an exception and\nreturn 'NULL' on failure.\n\nNew in version 3.9.\n\n-- C Function: *note PyObject: 6b1. *PyObjectCallObject (PyObject\n*callable, PyObject *args)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Call a callable Python object 'callable', with arguments\ngiven by the tuple 'args'.  If no arguments are needed, then 'args'\ncan be 'NULL'.\n\nReturn the result of the call on success, or raise an exception and\nreturn 'NULL' on failure.\n\nThis is the equivalent of the Python expression: 'callable(*args)'.\n\n-- C Function: *note PyObject: 6b1. *PyObjectCallFunction (PyObject\n*callable, const char *format, ...)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Call a callable Python object 'callable', with a variable\nnumber of C arguments.  The C arguments are described using a *note\nPyBuildValue(): 6bb. style format string.  The format can be\n'NULL', indicating that no arguments are provided.\n\nReturn the result of the call on success, or raise an exception and\nreturn 'NULL' on failure.\n\nThis is the equivalent of the Python expression: 'callable(*args)'.\n\nNote that if you only pass *note PyObject: 6b1.* args, *note\nPyObjectCallFunctionObjArgs(): 4819. is a faster alternative.\n\nChanged in version 3.4: The type of 'format' was changed from 'char\n*'.\n\n-- C Function: *note PyObject: 6b1. *PyObjectCallMethod (PyObject\n*obj, const char *name, const char *format, ...)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Call the method named 'name' of object 'obj' with a variable\nnumber of C arguments.  The C arguments are described by a *note\nPyBuildValue(): 6bb. format string that should produce a tuple.\n\nThe format can be 'NULL', indicating that no arguments are\nprovided.\n\nReturn the result of the call on success, or raise an exception and\nreturn 'NULL' on failure.\n\nThis is the equivalent of the Python expression: 'obj.name(arg1,\narg2, ...)'.\n\nNote that if you only pass *note PyObject: 6b1.* args, *note\nPyObjectCallMethodObjArgs(): 1774. is a faster alternative.\n\nChanged in version 3.4: The types of 'name' and 'format' were\nchanged from 'char *'.\n\n-- C Function: *note PyObject: 6b1. *PyObjectCallFunctionObjArgs\n(PyObject *callable, ...)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Call a callable Python object 'callable', with a variable\nnumber of *note PyObject: 6b1.* arguments.  The arguments are\nprovided as a variable number of parameters followed by 'NULL'.\n\nReturn the result of the call on success, or raise an exception and\nreturn 'NULL' on failure.\n\nThis is the equivalent of the Python expression: 'callable(arg1,\narg2, ...)'.\n\n-- C Function: *note PyObject: 6b1. *PyObjectCallMethodObjArgs\n(PyObject *obj, PyObject *name, ...)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Call a method of the Python object 'obj', where the name of\nthe method is given as a Python string object in 'name'.  It is\ncalled with a variable number of *note PyObject: 6b1.* arguments.\nThe arguments are provided as a variable number of parameters\nfollowed by 'NULL'.\n\nReturn the result of the call on success, or raise an exception and\nreturn 'NULL' on failure.\n\n-- C Function: *note PyObject: 6b1. *PyObjectCallMethodNoArgs\n(PyObject *obj, PyObject *name)\n\nCall a method of the Python object 'obj' without arguments, where\nthe name of the method is given as a Python string object in\n'name'.\n\nReturn the result of the call on success, or raise an exception and\nreturn 'NULL' on failure.\n\nNew in version 3.9.\n\n-- C Function: *note PyObject: 6b1. *PyObjectCallMethodOneArg\n(PyObject *obj, PyObject *name, PyObject *arg)\n\nCall a method of the Python object 'obj' with a single positional\nargument 'arg', where the name of the method is given as a Python\nstring object in 'name'.\n\nReturn the result of the call on success, or raise an exception and\nreturn 'NULL' on failure.\n\nNew in version 3.9.\n\n-- C Function: *note PyObject: 6b1. *PyObjectVectorcall (PyObject\n*callable, PyObject *const *args, sizet nargsf, PyObject\n*kwnames)\n' Part of the *note Stable ABI: 2ac. since version 3.12.'  Call a\ncallable Python object 'callable'.  The arguments are the same as\nfor *note vectorcallfunc: 2b0.  If 'callable' supports *note\nvectorcall: 2ab, this directly calls the vectorcall function stored\nin 'callable'.\n\nReturn the result of the call on success, or raise an exception and\nreturn 'NULL' on failure.\n\nNew in version 3.9.\n\n-- C Function: *note PyObject: 6b1. *PyObjectVectorcallDict (PyObject\n*callable, PyObject *const *args, sizet nargsf, PyObject\n*kwdict)\n\nCall 'callable' with positional arguments passed exactly as in the\n*note vectorcall: 2ab. protocol, but with keyword arguments passed\nas a dictionary 'kwdict'.  The 'args' array contains only the\npositional arguments.\n\nRegardless of which protocol is used internally, a conversion of\narguments needs to be done.  Therefore, this function should only\nbe used if the caller already has a dictionary ready to use for the\nkeyword arguments, but not a tuple for the positional arguments.\n\nNew in version 3.9.\n\n-- C Function: *note PyObject: 6b1. *PyObjectVectorcallMethod\n(PyObject *name, PyObject *const *args, sizet nargsf,\nPyObject *kwnames)\n' Part of the *note Stable ABI: 2ac. since version 3.12.'  Call a\nmethod using the vectorcall calling convention.  The name of the\nmethod is given as a Python string 'name'.  The object whose method\nis called is 'args[0]', and the 'args' array starting at 'args[1]'\nrepresents the arguments of the call.  There must be at least one\npositional argument.  'nargsf' is the number of positional\narguments including 'args[0]', plus *note\nPYVECTORCALLARGUMENTSOFFSET: 2b8. if the value of 'args[0]' may\ntemporarily be changed.  Keyword arguments can be passed just like\nin *note PyObjectVectorcall(): 2b6.\n\nIf the object has the *note PyTPFLAGSMETHODDESCRIPTOR: 495b.\nfeature, this will call the unbound method object with the full\n'args' vector as arguments.\n\nReturn the result of the call on success, or raise an exception and\nreturn 'NULL' on failure.\n\nNew in version 3.9.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Call Support API,  Prev: Object Calling API,  Up: Call Protocol": {
            "content": "7.7.2.6 Call Support API\n........................\n\n-- C Function: int PyCallableCheck (PyObject *o)\n' Part of the *note Stable ABI: 2ac.'  Determine if the object 'o'\nis callable.  Return '1' if the object is callable and '0'\notherwise.  This function always succeeds.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Number Protocol,  Next: Sequence Protocol,  Prev: Call Protocol,  Up: Abstract Objects Layer": {
            "content": "-- C Function: int PyNumberCheck (PyObject *o)\n' Part of the *note Stable ABI: 2ac.'  Returns '1' if the object\n'o' provides numeric protocols, and false otherwise.  This function\nalways succeeds.\n\nChanged in version 3.8: Returns '1' if 'o' is an index integer.\n\n-- C Function: *note PyObject: 6b1. *PyNumberAdd (PyObject *o1,\nPyObject *o2)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Returns the result of adding 'o1' and 'o2', or 'NULL' on\nfailure.  This is the equivalent of the Python expression 'o1 +\no2'.\n\n-- C Function: *note PyObject: 6b1. *PyNumberSubtract (PyObject *o1,\nPyObject *o2)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Returns the result of subtracting 'o2' from 'o1', or 'NULL'\non failure.  This is the equivalent of the Python expression 'o1 -\no2'.\n\n-- C Function: *note PyObject: 6b1. *PyNumberMultiply (PyObject *o1,\nPyObject *o2)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Returns the result of multiplying 'o1' and 'o2', or 'NULL'\non failure.  This is the equivalent of the Python expression 'o1 *\no2'.\n\n-- C Function: *note PyObject: 6b1. *PyNumberMatrixMultiply (PyObject\n*o1, PyObject *o2)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\nsince version 3.7.'  Returns the result of matrix multiplication on\n'o1' and 'o2', or 'NULL' on failure.  This is the equivalent of the\nPython expression 'o1 @ o2'.\n\nNew in version 3.5.\n\n-- C Function: *note PyObject: 6b1. *PyNumberFloorDivide (PyObject\n*o1, PyObject *o2)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return the floor of 'o1' divided by 'o2', or 'NULL' on\nfailure.  This is the equivalent of the Python expression 'o1 //\no2'.\n\n-- C Function: *note PyObject: 6b1. *PyNumberTrueDivide (PyObject *o1,\nPyObject *o2)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a reasonable approximation for the mathematical value\nof 'o1' divided by 'o2', or 'NULL' on failure.  The return value is\n\"approximate\" because binary floating point numbers are\napproximate; it is not possible to represent all real numbers in\nbase two.  This function can return a floating point value when\npassed two integers.  This is the equivalent of the Python\nexpression 'o1 / o2'.\n\n-- C Function: *note PyObject: 6b1. *PyNumberRemainder (PyObject *o1,\nPyObject *o2)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Returns the remainder of dividing 'o1' by 'o2', or 'NULL' on\nfailure.  This is the equivalent of the Python expression 'o1 %\no2'.\n\n-- C Function: *note PyObject: 6b1. *PyNumberDivmod (PyObject *o1,\nPyObject *o2)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'\n\nSee the built-in function *note divmod(): 7c5.  Returns 'NULL' on\nfailure.  This is the equivalent of the Python expression\n'divmod(o1, o2)'.\n\n-- C Function: *note PyObject: 6b1. *PyNumberPower (PyObject *o1,\nPyObject *o2, PyObject *o3)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'\n\nSee the built-in function *note pow(): 7f7.  Returns 'NULL' on\nfailure.  This is the equivalent of the Python expression 'pow(o1,\no2, o3)', where 'o3' is optional.  If 'o3' is to be ignored, pass\n*note PyNone: 469e. in its place (passing 'NULL' for 'o3' would\ncause an illegal memory access).\n\n-- C Function: *note PyObject: 6b1. *PyNumberNegative (PyObject *o)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Returns the negation of 'o' on success, or 'NULL' on\nfailure.  This is the equivalent of the Python expression '-o'.\n\n-- C Function: *note PyObject: 6b1. *PyNumberPositive (PyObject *o)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Returns 'o' on success, or 'NULL' on failure.  This is the\nequivalent of the Python expression '+o'.\n\n-- C Function: *note PyObject: 6b1. *PyNumberAbsolute (PyObject *o)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'\n\nReturns the absolute value of 'o', or 'NULL' on failure.  This is\nthe equivalent of the Python expression 'abs(o)'.\n\n-- C Function: *note PyObject: 6b1. *PyNumberInvert (PyObject *o)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Returns the bitwise negation of 'o' on success, or 'NULL' on\nfailure.  This is the equivalent of the Python expression '~o'.\n\n-- C Function: *note PyObject: 6b1. *PyNumberLshift (PyObject *o1,\nPyObject *o2)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Returns the result of left shifting 'o1' by 'o2' on success,\nor 'NULL' on failure.  This is the equivalent of the Python\nexpression 'o1 << o2'.\n\n-- C Function: *note PyObject: 6b1. *PyNumberRshift (PyObject *o1,\nPyObject *o2)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Returns the result of right shifting 'o1' by 'o2' on\nsuccess, or 'NULL' on failure.  This is the equivalent of the\nPython expression 'o1 >> o2'.\n\n-- C Function: *note PyObject: 6b1. *PyNumberAnd (PyObject *o1,\nPyObject *o2)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Returns the \"bitwise and\" of 'o1' and 'o2' on success and\n'NULL' on failure.  This is the equivalent of the Python expression\n'o1 & o2'.\n\n-- C Function: *note PyObject: 6b1. *PyNumberXor (PyObject *o1,\nPyObject *o2)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Returns the \"bitwise exclusive or\" of 'o1' by 'o2' on\nsuccess, or 'NULL' on failure.  This is the equivalent of the\nPython expression 'o1 ^ o2'.\n\n-- C Function: *note PyObject: 6b1. *PyNumberOr (PyObject *o1,\nPyObject *o2)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Returns the \"bitwise or\" of 'o1' and 'o2' on success, or\n'NULL' on failure.  This is the equivalent of the Python expression\n'o1 | o2'.\n\n-- C Function: *note PyObject: 6b1. *PyNumberInPlaceAdd (PyObject *o1,\nPyObject *o2)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Returns the result of adding 'o1' and 'o2', or 'NULL' on\nfailure.  The operation is done 'in-place' when 'o1' supports it.\nThis is the equivalent of the Python statement 'o1 += o2'.\n\n-- C Function: *note PyObject: 6b1. *PyNumberInPlaceSubtract (PyObject\n*o1, PyObject *o2)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Returns the result of subtracting 'o2' from 'o1', or 'NULL'\non failure.  The operation is done 'in-place' when 'o1' supports\nit.  This is the equivalent of the Python statement 'o1 -= o2'.\n\n-- C Function: *note PyObject: 6b1. *PyNumberInPlaceMultiply (PyObject\n*o1, PyObject *o2)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Returns the result of multiplying 'o1' and 'o2', or 'NULL'\non failure.  The operation is done 'in-place' when 'o1' supports\nit.  This is the equivalent of the Python statement 'o1 *= o2'.\n\n-- C Function: *note PyObject: 6b1. *PyNumberInPlaceMatrixMultiply\n(PyObject *o1, PyObject *o2)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\nsince version 3.7.'  Returns the result of matrix multiplication on\n'o1' and 'o2', or 'NULL' on failure.  The operation is done\n'in-place' when 'o1' supports it.  This is the equivalent of the\nPython statement 'o1 @= o2'.\n\nNew in version 3.5.\n\n-- C Function: *note PyObject: 6b1. *PyNumberInPlaceFloorDivide\n(PyObject *o1, PyObject *o2)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Returns the mathematical floor of dividing 'o1' by 'o2', or\n'NULL' on failure.  The operation is done 'in-place' when 'o1'\nsupports it.  This is the equivalent of the Python statement 'o1\n//= o2'.\n\n-- C Function: *note PyObject: 6b1. *PyNumberInPlaceTrueDivide\n(PyObject *o1, PyObject *o2)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a reasonable approximation for the mathematical value\nof 'o1' divided by 'o2', or 'NULL' on failure.  The return value is\n\"approximate\" because binary floating point numbers are\napproximate; it is not possible to represent all real numbers in\nbase two.  This function can return a floating point value when\npassed two integers.  The operation is done 'in-place' when 'o1'\nsupports it.  This is the equivalent of the Python statement 'o1 /=\no2'.\n\n-- C Function: *note PyObject: 6b1. *PyNumberInPlaceRemainder\n(PyObject *o1, PyObject *o2)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Returns the remainder of dividing 'o1' by 'o2', or 'NULL' on\nfailure.  The operation is done 'in-place' when 'o1' supports it.\nThis is the equivalent of the Python statement 'o1 %= o2'.\n\n-- C Function: *note PyObject: 6b1. *PyNumberInPlacePower (PyObject\n*o1, PyObject *o2, PyObject *o3)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'\n\nSee the built-in function *note pow(): 7f7.  Returns 'NULL' on\nfailure.  The operation is done 'in-place' when 'o1' supports it.\nThis is the equivalent of the Python statement 'o1 = o2' when o3\nis *note PyNone: 469e, or an in-place variant of 'pow(o1, o2, o3)'\notherwise.  If 'o3' is to be ignored, pass *note PyNone: 469e. in\nits place (passing 'NULL' for 'o3' would cause an illegal memory\naccess).\n\n-- C Function: *note PyObject: 6b1. *PyNumberInPlaceLshift (PyObject\n*o1, PyObject *o2)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Returns the result of left shifting 'o1' by 'o2' on success,\nor 'NULL' on failure.  The operation is done 'in-place' when 'o1'\nsupports it.  This is the equivalent of the Python statement 'o1\n<<= o2'.\n\n-- C Function: *note PyObject: 6b1. *PyNumberInPlaceRshift (PyObject\n*o1, PyObject *o2)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Returns the result of right shifting 'o1' by 'o2' on\nsuccess, or 'NULL' on failure.  The operation is done 'in-place'\nwhen 'o1' supports it.  This is the equivalent of the Python\nstatement 'o1 >>= o2'.\n\n-- C Function: *note PyObject: 6b1. *PyNumberInPlaceAnd (PyObject *o1,\nPyObject *o2)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Returns the \"bitwise and\" of 'o1' and 'o2' on success and\n'NULL' on failure.  The operation is done 'in-place' when 'o1'\nsupports it.  This is the equivalent of the Python statement 'o1 &=\no2'.\n\n-- C Function: *note PyObject: 6b1. *PyNumberInPlaceXor (PyObject *o1,\nPyObject *o2)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Returns the \"bitwise exclusive or\" of 'o1' by 'o2' on\nsuccess, or 'NULL' on failure.  The operation is done 'in-place'\nwhen 'o1' supports it.  This is the equivalent of the Python\nstatement 'o1 ^= o2'.\n\n-- C Function: *note PyObject: 6b1. *PyNumberInPlaceOr (PyObject *o1,\nPyObject *o2)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Returns the \"bitwise or\" of 'o1' and 'o2' on success, or\n'NULL' on failure.  The operation is done 'in-place' when 'o1'\nsupports it.  This is the equivalent of the Python statement 'o1 |=\no2'.\n\n-- C Function: *note PyObject: 6b1. *PyNumberLong (PyObject *o)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'\n\nReturns the 'o' converted to an integer object on success, or\n'NULL' on failure.  This is the equivalent of the Python expression\n'int(o)'.\n\n-- C Function: *note PyObject: 6b1. *PyNumberFloat (PyObject *o)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'\n\nReturns the 'o' converted to a float object on success, or 'NULL'\non failure.  This is the equivalent of the Python expression\n'float(o)'.\n\n-- C Function: *note PyObject: 6b1. *PyNumberIndex (PyObject *o)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Returns the 'o' converted to a Python int on success or\n'NULL' with a *note TypeError: 28e. exception raised on failure.\n\nChanged in version 3.10: The result always has exact type *note\nint: 17e.  Previously, the result could have been an instance of a\nsubclass of 'int'.\n\n-- C Function: *note PyObject: 6b1. *PyNumberToBase (PyObject *n, int\nbase)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Returns the integer 'n' converted to base 'base' as a\nstring.  The 'base' argument must be one of 2, 8, 10, or 16.  For\nbase 2, 8, or 16, the returned string is prefixed with a base\nmarker of ''0b'', ''0o'', or ''0x'', respectively.  If 'n' is not a\nPython int, it is converted with *note PyNumberIndex(): 6a1.\nfirst.\n\n-- C Function: *note Pyssizet: 88d. PyNumberAsSsizet (PyObject *o,\nPyObject *exc)\n' Part of the *note Stable ABI: 2ac.'  Returns 'o' converted to a\n*note Pyssizet: 88d. value if 'o' can be interpreted as an\ninteger.  If the call fails, an exception is raised and '-1' is\nreturned.\n\nIf 'o' can be converted to a Python int but the attempt to convert\nto a *note Pyssizet: 88d. value would raise an *note\nOverflowError: 68d, then the 'exc' argument is the type of\nexception that will be raised (usually *note IndexError: 138f. or\n*note OverflowError: 68d.).  If 'exc' is 'NULL', then the exception\nis cleared and the value is clipped to 'PYSSIZETMIN' for a\nnegative integer or 'PYSSIZETMAX' for a positive integer.\n\n-- C Function: int PyIndexCheck (PyObject *o)\n' Part of the *note Stable ABI: 2ac. since version 3.8.'  Returns\n'1' if 'o' is an index integer (has the 'nbindex' slot of the\n'tpasnumber' structure filled in), and '0' otherwise.  This\nfunction always succeeds.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Sequence Protocol,  Next: Mapping Protocol,  Prev: Number Protocol,  Up: Abstract Objects Layer": {
            "content": "-- C Function: int PySequenceCheck (PyObject *o)\n' Part of the *note Stable ABI: 2ac.'  Return '1' if the object\nprovides the sequence protocol, and '0' otherwise.  Note that it\nreturns '1' for Python classes with a *note getitem(): 4b9.\nmethod, unless they are *note dict: 237. subclasses, since in\ngeneral it is impossible to determine what type of keys the class\nsupports.  This function always succeeds.\n\n-- C Function: *note Pyssizet: 88d. PySequenceSize (PyObject *o)\n-- C Function: *note Pyssizet: 88d. PySequenceLength (PyObject *o)\n' Part of the *note Stable ABI: 2ac.'\n\nReturns the number of objects in sequence 'o' on success, and '-1'\non failure.  This is equivalent to the Python expression 'len(o)'.\n\n-- C Function: *note PyObject: 6b1. *PySequenceConcat (PyObject *o1,\nPyObject *o2)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return the concatenation of 'o1' and 'o2' on success, and\n'NULL' on failure.  This is the equivalent of the Python expression\n'o1 + o2'.\n\n-- C Function: *note PyObject: 6b1. *PySequenceRepeat (PyObject *o,\nPyssizet count)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return the result of repeating sequence object 'o' 'count'\ntimes, or 'NULL' on failure.  This is the equivalent of the Python\nexpression 'o * count'.\n\n-- C Function: *note PyObject: 6b1. *PySequenceInPlaceConcat (PyObject\n*o1, PyObject *o2)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return the concatenation of 'o1' and 'o2' on success, and\n'NULL' on failure.  The operation is done 'in-place' when 'o1'\nsupports it.  This is the equivalent of the Python expression 'o1\n+= o2'.\n\n-- C Function: *note PyObject: 6b1. *PySequenceInPlaceRepeat (PyObject\n*o, Pyssizet count)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return the result of repeating sequence object 'o' 'count'\ntimes, or 'NULL' on failure.  The operation is done 'in-place' when\n'o' supports it.  This is the equivalent of the Python expression\n'o *= count'.\n\n-- C Function: *note PyObject: 6b1. *PySequenceGetItem (PyObject *o,\nPyssizet i)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return the 'i'th element of 'o', or 'NULL' on failure.  This\nis the equivalent of the Python expression 'o[i]'.\n\n-- C Function: *note PyObject: 6b1. *PySequenceGetSlice (PyObject *o,\nPyssizet i1, Pyssizet i2)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return the slice of sequence object 'o' between 'i1' and\n'i2', or 'NULL' on failure.  This is the equivalent of the Python\nexpression 'o[i1:i2]'.\n\n-- C Function: int PySequenceSetItem (PyObject *o, Pyssizet i,\nPyObject *v)\n' Part of the *note Stable ABI: 2ac.'  Assign object 'v' to the\n'i'th element of 'o'.  Raise an exception and return '-1' on\nfailure; return '0' on success.  This is the equivalent of the\nPython statement 'o[i] = v'.  This function 'does not' steal a\nreference to 'v'.\n\nIf 'v' is 'NULL', the element is deleted, but this feature is\ndeprecated in favour of using *note PySequenceDelItem(): 17d6.\n\n-- C Function: int PySequenceDelItem (PyObject *o, Pyssizet i)\n' Part of the *note Stable ABI: 2ac.'  Delete the 'i'th element of\nobject 'o'.  Returns '-1' on failure.  This is the equivalent of\nthe Python statement 'del o[i]'.\n\n-- C Function: int PySequenceSetSlice (PyObject *o, Pyssizet i1,\nPyssizet i2, PyObject *v)\n' Part of the *note Stable ABI: 2ac.'  Assign the sequence object\n'v' to the slice in sequence object 'o' from 'i1' to 'i2'.  This is\nthe equivalent of the Python statement 'o[i1:i2] = v'.\n\n-- C Function: int PySequenceDelSlice (PyObject *o, Pyssizet i1,\nPyssizet i2)\n' Part of the *note Stable ABI: 2ac.'  Delete the slice in sequence\nobject 'o' from 'i1' to 'i2'.  Returns '-1' on failure.  This is\nthe equivalent of the Python statement 'del o[i1:i2]'.\n\n-- C Function: *note Pyssizet: 88d. PySequenceCount (PyObject *o,\nPyObject *value)\n' Part of the *note Stable ABI: 2ac.'  Return the number of\noccurrences of 'value' in 'o', that is, return the number of keys\nfor which 'o[key] == value'.  On failure, return '-1'.  This is\nequivalent to the Python expression 'o.count(value)'.\n\n-- C Function: int PySequenceContains (PyObject *o, PyObject *value)\n' Part of the *note Stable ABI: 2ac.'  Determine if 'o' contains\n'value'.  If an item in 'o' is equal to 'value', return '1',\notherwise return '0'.  On error, return '-1'.  This is equivalent\nto the Python expression 'value in o'.\n\n-- C Function: *note Pyssizet: 88d. PySequenceIndex (PyObject *o,\nPyObject *value)\n' Part of the *note Stable ABI: 2ac.'  Return the first index 'i'\nfor which 'o[i] == value'.  On error, return '-1'.  This is\nequivalent to the Python expression 'o.index(value)'.\n\n-- C Function: *note PyObject: 6b1. *PySequenceList (PyObject *o)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a list object with the same contents as the sequence\nor iterable 'o', or 'NULL' on failure.  The returned list is\nguaranteed to be new.  This is equivalent to the Python expression\n'list(o)'.\n\n-- C Function: *note PyObject: 6b1. *PySequenceTuple (PyObject *o)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'\n\nReturn a tuple object with the same contents as the sequence or\niterable 'o', or 'NULL' on failure.  If 'o' is a tuple, a new\nreference will be returned, otherwise a tuple will be constructed\nwith the appropriate contents.  This is equivalent to the Python\nexpression 'tuple(o)'.\n\n-- C Function: *note PyObject: 6b1. *PySequenceFast (PyObject *o,\nconst char *m)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return the sequence or iterable 'o' as an object usable by\nthe other 'PySequenceFast*' family of functions.  If the object is\nnot a sequence or iterable, raises *note TypeError: 28e. with 'm'\nas the message text.  Returns 'NULL' on failure.\n\nThe 'PySequenceFast*' functions are thus named because they assume\n'o' is a *note PyTupleObject: 490b. or a *note PyListObject: 4963.\nand access the data fields of 'o' directly.\n\nAs a CPython implementation detail, if 'o' is already a sequence or\nlist, it will be returned.\n\n-- C Function: *note Pyssizet: 88d. PySequenceFastGETSIZE\n(PyObject *o)\n\nReturns the length of 'o', assuming that 'o' was returned by *note\nPySequenceFast(): 4833. and that 'o' is not 'NULL'.  The size can\nalso be retrieved by calling *note PySequenceSize(): 17d3. on 'o',\nbut *note PySequenceFastGETSIZE(): 4964. is faster because it\ncan assume 'o' is a list or tuple.\n\n-- C Function: *note PyObject: 6b1. *PySequenceFastGETITEM (PyObject\n*o, Pyssizet i)\n'Return value: Borrowed reference.'  Return the 'i'th element of\n'o', assuming that 'o' was returned by *note PySequenceFast():\n4833, 'o' is not 'NULL', and that 'i' is within bounds.\n\n-- C Function: *note PyObject: 6b1. PySequenceFastITEMS (PyObject\n*o)\n\nReturn the underlying array of PyObject pointers.  Assumes that 'o'\nwas returned by *note PySequenceFast(): 4833. and 'o' is not\n'NULL'.\n\nNote, if a list gets resized, the reallocation may relocate the\nitems array.  So, only use the underlying array pointer in contexts\nwhere the sequence cannot change.\n\n-- C Function: *note PyObject: 6b1. *PySequenceITEM (PyObject *o,\nPyssizet i)\n'Return value: New reference.'  Return the 'i'th element of 'o' or\n'NULL' on failure.  Faster form of *note PySequenceGetItem():\n17d4. but without checking that *note PySequenceCheck(): 482e. on\n'o' is true and without adjustment for negative indices.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Mapping Protocol,  Next: Iterator Protocol,  Prev: Sequence Protocol,  Up: Abstract Objects Layer": {
            "content": "See also *note PyObjectGetItem(): 4735, *note PyObjectSetItem(): 4733.\nand *note PyObjectDelItem(): 481b.\n\n-- C Function: int PyMappingCheck (PyObject *o)\n' Part of the *note Stable ABI: 2ac.'  Return '1' if the object\nprovides the mapping protocol or supports slicing, and '0'\notherwise.  Note that it returns '1' for Python classes with a\n*note getitem(): 4b9. method, since in general it is impossible\nto determine what type of keys the class supports.  This function\nalways succeeds.\n\n-- C Function: *note Pyssizet: 88d. PyMappingSize (PyObject *o)\n-- C Function: *note Pyssizet: 88d. PyMappingLength (PyObject *o)\n' Part of the *note Stable ABI: 2ac.'\n\nReturns the number of keys in object 'o' on success, and '-1' on\nfailure.  This is equivalent to the Python expression 'len(o)'.\n\n-- C Function: *note PyObject: 6b1. *PyMappingGetItemString (PyObject\n*o, const char *key)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  This is the same as *note PyObjectGetItem(): 4735, but\n'key' is specified as a const char* UTF-8 encoded bytes string,\nrather than a *note PyObject: 6b1.*.\n\n-- C Function: int PyMappingSetItemString (PyObject *o, const char\n*key, PyObject *v)\n' Part of the *note Stable ABI: 2ac.'  This is the same as *note\nPyObjectSetItem(): 4733, but 'key' is specified as a const char*\nUTF-8 encoded bytes string, rather than a *note PyObject: 6b1.*.\n\n-- C Function: int PyMappingDelItem (PyObject *o, PyObject *key)\n\nThis is an alias of *note PyObjectDelItem(): 481b.\n\n-- C Function: int PyMappingDelItemString (PyObject *o, const char\n*key)\n\nThis is the same as *note PyObjectDelItem(): 481b, but 'key' is\nspecified as a const char* UTF-8 encoded bytes string, rather than\na *note PyObject: 6b1.*.\n\n-- C Function: int PyMappingHasKey (PyObject *o, PyObject *key)\n' Part of the *note Stable ABI: 2ac.'  Return '1' if the mapping\nobject has the key 'key' and '0' otherwise.  This is equivalent to\nthe Python expression 'key in o'.  This function always succeeds.\n\nNote: Exceptions which occur when this calls *note\ngetitem(): 4b9. method are silently ignored.  For proper\nerror handling, use *note PyObjectGetItem(): 4735. instead.\n\n-- C Function: int PyMappingHasKeyString (PyObject *o, const char\n*key)\n' Part of the *note Stable ABI: 2ac.'  This is the same as *note\nPyMappingHasKey(): 47e0, but 'key' is specified as a const char*\nUTF-8 encoded bytes string, rather than a *note PyObject: 6b1.*.\n\nNote: Exceptions that occur when this calls *note\ngetitem(): 4b9. method or while creating the temporary\n*note str: 157. object are silently ignored.  For proper error\nhandling, use *note PyMappingGetItemString(): 47df. instead.\n\n-- C Function: *note PyObject: 6b1. *PyMappingKeys (PyObject *o)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  On success, return a list of the keys in object 'o'.  On\nfailure, return 'NULL'.\n\nChanged in version 3.7: Previously, the function returned a list or\na tuple.\n\n-- C Function: *note PyObject: 6b1. *PyMappingValues (PyObject *o)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  On success, return a list of the values in object 'o'.  On\nfailure, return 'NULL'.\n\nChanged in version 3.7: Previously, the function returned a list or\na tuple.\n\n-- C Function: *note PyObject: 6b1. *PyMappingItems (PyObject *o)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  On success, return a list of the items in object 'o', where\neach item is a tuple containing a key-value pair.  On failure,\nreturn 'NULL'.\n\nChanged in version 3.7: Previously, the function returned a list or\na tuple.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Iterator Protocol,  Next: Buffer Protocol,  Prev: Mapping Protocol,  Up: Abstract Objects Layer": {
            "content": "There are two functions specifically for working with iterators.\n\n-- C Function: int PyIterCheck (PyObject *o)\n' Part of the *note Stable ABI: 2ac. since version 3.8.'  Return\nnon-zero if the object 'o' can be safely passed to *note\nPyIterNext(): 47cb, and '0' otherwise.  This function always\nsucceeds.\n\n-- C Function: int PyAIterCheck (PyObject *o)\n' Part of the *note Stable ABI: 2ac. since version 3.10.'  Return\nnon-zero if the object 'o' provides the 'AsyncIterator' protocol,\nand '0' otherwise.  This function always succeeds.\n\nNew in version 3.10.\n\n-- C Function: *note PyObject: 6b1. *PyIterNext (PyObject *o)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return the next value from the iterator 'o'.  The object\nmust be an iterator according to *note PyIterCheck(): 1659. (it is\nup to the caller to check this).  If there are no remaining values,\nreturns 'NULL' with no exception set.  If an error occurs while\nretrieving the item, returns 'NULL' and passes along the exception.\n",
            "subsections": []
        },
        "To write a loop which iterates over an iterator, the C code should look": {
            "content": "something like this:\n\nPyObject *iterator = PyObjectGetIter(obj);\nPyObject *item;\n\nif (iterator == NULL) {\n/* propagate error */\n}\n\nwhile ((item = PyIterNext(iterator))) {\n/* do something with item */\n...\n/* release reference when done */\nPyDECREF(item);\n}\n\nPyDECREF(iterator);\n\nif (PyErrOccurred()) {\n/* propagate error */\n}\nelse {\n/* continue doing useful work */\n}\n\n-- C Type: type PySendResult\n\nThe enum value used to represent different results of *note\nPyIterSend(): 6a7.\n\nNew in version 3.10.\n\n-- C Function: *note PySendResult: 4970. PyIterSend (PyObject *iter,\nPyObject *arg, PyObject presult)\n' Part of the *note Stable ABI: 2ac. since version 3.10.'  Sends\nthe 'arg' value into the iterator 'iter'.  Returns:\n\n- 'PYGENRETURN' if iterator returns.  Return value is returned\nvia 'presult'.\n\n- 'PYGENNEXT' if iterator yields.  Yielded value is returned\nvia 'presult'.\n\n- 'PYGENERROR' if iterator has raised and exception.  'presult'\nis set to 'NULL'.\n\nNew in version 3.10.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Buffer Protocol,  Next: Old Buffer Protocol,  Prev: Iterator Protocol,  Up: Abstract Objects Layer": {
            "content": "",
            "subsections": []
        },
        "Certain objects available in Python wrap access to an underlying memory": {
            "content": "array or 'buffer'.  Such objects include the built-in *note bytes: 295.\nand *note bytearray: 294, and some extension types like *note\narray.array: 18f.  Third-party libraries may define their own types for\nspecial purposes, such as image processing or numeric analysis.\n",
            "subsections": []
        },
        "While each of these types have their own semantics, they share the": {
            "content": "common characteristic of being backed by a possibly large memory buffer.",
            "subsections": []
        },
        "It is then desirable, in some situations, to access that buffer directly": {
            "content": "and without intermediate copying.\n\nPython provides such a facility at the C level in the form of the *note\nbuffer protocol: 148.  This protocol has two sides:\n\n- on the producer side, a type can export a \"buffer interface\" which\nallows objects of that type to expose information about their\nunderlying buffer.  This interface is described in the section\n*note Buffer Object Structures: 4973.;\n\n- on the consumer side, several means are available to obtain a\npointer to the raw underlying data of an object (for example a\nmethod parameter).\n\nSimple objects such as *note bytes: 295. and *note bytearray: 294.\nexpose their underlying buffer in byte-oriented form.  Other forms are\npossible; for example, the elements exposed by an *note array.array:\n18f. can be multi-byte values.\n\nAn example consumer of the buffer interface is the *note write(): b2a.\nmethod of file objects: any object that can export a series of bytes\nthrough the buffer interface can be written to a file.  While 'write()'\nonly needs read-only access to the internal contents of the object\npassed to it, other methods such as *note readinto(): 2917. need write\naccess to the contents of their argument.  The buffer interface allows\nobjects to selectively allow or reject exporting of read-write and\nread-only buffers.\n",
            "subsections": []
        },
        "There are two ways for a consumer of the buffer interface to acquire a": {
            "content": "buffer over a target object:\n\n* call *note PyObjectGetBuffer(): 541. with the right parameters;\n\n* call *note PyArgParseTuple(): 2d1. (or one of its siblings) with\none of the 'y*', 'w*' or 's*' *note format codes: 6bc.\n\nIn both cases, *note PyBufferRelease(): 54a. must be called when the\nbuffer isn't needed anymore.  Failure to do so could lead to various\nissues such as resource leaks.\n\n* Menu:\n\n* Buffer structure::\n* Buffer request types::\n* Complex arrays::\n* Buffer-related functions::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Buffer structure,  Next: Buffer request types,  Up: Buffer Protocol": {
            "content": "7.7.7.1 Buffer structure\n........................\n\nBuffer structures (or simply \"buffers\") are useful as a way to expose\nthe binary data from another object to the Python programmer.  They can\nalso be used as a zero-copy slicing mechanism.  Using their ability to\nreference a block of memory, it is possible to expose any data to the",
            "subsections": []
        },
        "Python programmer quite easily.  The memory could be a large, constant": {
            "content": "array in a C extension, it could be a raw block of memory for\nmanipulation before passing to an operating system library, or it could\nbe used to pass around structured data in its native, in-memory format.\n",
            "subsections": []
        },
        "Contrary to most data types exposed by the Python interpreter, buffers": {
            "content": "are not *note PyObject: 6b1. pointers but rather simple C structures.",
            "subsections": []
        },
        "This allows them to be created and copied very simply.  When a generic": {
            "content": "wrapper around a buffer is needed, a *note memoryview: 4976. object can\nbe created.\n\nFor short instructions how to write an exporting object, see *note\nBuffer Object Structures: 4973.  For obtaining a buffer, see *note\nPyObjectGetBuffer(): 541.\n\n-- C Type: type Pybuffer\n' Part of the *note Stable ABI: 2ac. (including all members) since\nversion 3.11.'\n-- C Member: void *buf\n\nA pointer to the start of the logical structure described by\nthe buffer fields.  This can be any location within the\nunderlying physical memory block of the exporter.  For\nexample, with negative *note strides: 4978. the value may\npoint to the end of the memory block.\n\nFor *note contiguous: 1f33. arrays, the value points to the\nbeginning of the memory block.\n\n-- C Member: *note PyObject: 6b1. *obj\n\nA new reference to the exporting object.  The reference is\nowned by the consumer and automatically released (i.e.\nreference count decremented) and set to 'NULL' by *note\nPyBufferRelease(): 54a.  The field is the equivalent of the\nreturn value of any standard C-API function.\n\nAs a special case, for 'temporary' buffers that are wrapped by\n*note PyMemoryViewFromBuffer(): 54b. or *note\nPyBufferFillInfo(): 549. this field is 'NULL'.  In general,\nexporting objects MUST NOT use this scheme.\n\n-- C Member: *note Pyssizet: 88d. len\n\n'product(shape) * itemsize'.  For contiguous arrays, this is\nthe length of the underlying memory block.  For non-contiguous\narrays, it is the length that the logical structure would have\nif it were copied to a contiguous representation.\n\nAccessing '((char *)buf)[0] up to ((char *)buf)[len-1]' is\nonly valid if the buffer has been obtained by a request that\nguarantees contiguity.  In most cases such a request will be\n*note PyBUFSIMPLE: 497b. or *note PyBUFWRITABLE: 120f.\n\n-- C Member: int readonly\n\nAn indicator of whether the buffer is read-only.  This field\nis controlled by the *note PyBUFWRITABLE: 120f. flag.\n\n-- C Member: *note Pyssizet: 88d. itemsize\n\nItem size in bytes of a single element.  Same as the value of\n*note struct.calcsize(): 1733. called on non-'NULL' *note\nformat: 497e. values.\n\nImportant exception: If a consumer requests a buffer without\nthe *note PyBUFFORMAT: 497f. flag, *note format: 497e. will\nbe set to 'NULL', but *note itemsize: 497d. still has the\nvalue for the original format.\n\nIf *note shape: 4980. is present, the equality 'product(shape)\n* itemsize == len' still holds and the consumer can use *note\nitemsize: 497d. to navigate the buffer.\n\nIf *note shape: 4980. is 'NULL' as a result of a *note\nPyBUFSIMPLE: 497b. or a *note PyBUFWRITABLE: 120f. request,\nthe consumer must disregard *note itemsize: 497d. and assume\n'itemsize == 1'.\n\n-- C Member: const char *format\n\nA 'NUL' terminated string in *note struct: cf. module style\nsyntax describing the contents of a single item.  If this is\n'NULL', '\"B\"' (unsigned bytes) is assumed.\n\nThis field is controlled by the *note PyBUFFORMAT: 497f.\nflag.\n\n-- C Member: int ndim\n\nThe number of dimensions the memory represents as an\nn-dimensional array.  If it is '0', *note buf: 4977. points to\na single item representing a scalar.  In this case, *note\nshape: 4980, *note strides: 4978. and *note suboffsets: 4982.\nMUST be 'NULL'.  The maximum number of dimensions is given by\n*note PyBUFMAXNDIM: 4983.\n\n-- C Member: *note Pyssizet: 88d. *shape\n\nAn array of *note Pyssizet: 88d. of length *note ndim: 4981.\nindicating the shape of the memory as an n-dimensional array.\nNote that 'shape[0] * ... * shape[ndim-1] * itemsize' MUST be\nequal to *note len: 497a.\n\nShape values are restricted to 'shape[n] >= 0'.  The case\n'shape[n] == 0' requires special attention.  See *note complex\narrays: 4984. for further information.\n\nThe shape array is read-only for the consumer.\n\n-- C Member: *note Pyssizet: 88d. *strides\n\nAn array of *note Pyssizet: 88d. of length *note ndim: 4981.\ngiving the number of bytes to skip to get to a new element in\neach dimension.\n\nStride values can be any integer.  For regular arrays, strides\nare usually positive, but a consumer MUST be able to handle\nthe case 'strides[n] <= 0'.  See *note complex arrays: 4984.\nfor further information.\n\nThe strides array is read-only for the consumer.\n\n-- C Member: *note Pyssizet: 88d. *suboffsets\n\nAn array of *note Pyssizet: 88d. of length *note ndim: 4981.\nIf 'suboffsets[n] >= 0', the values stored along the nth\ndimension are pointers and the suboffset value dictates how\nmany bytes to add to each pointer after de-referencing.  A\nsuboffset value that is negative indicates that no\nde-referencing should occur (striding in a contiguous memory\nblock).\n\nIf all suboffsets are negative (i.e.  no de-referencing is\nneeded), then this field must be 'NULL' (the default value).\n\nThis type of array representation is used by the Python\nImaging Library (PIL). See *note complex arrays: 4984. for\nfurther information how to access elements of such an array.\n\nThe suboffsets array is read-only for the consumer.\n\n-- C Member: void *internal\n\nThis is for use internally by the exporting object.  For\nexample, this might be re-cast as an integer by the exporter\nand used to store flags about whether or not the shape,\nstrides, and suboffsets arrays must be freed when the buffer\nis released.  The consumer MUST NOT alter this value.\n\nConstants:\n\n-- C Macro: PyBUFMAXNDIM\n\nThe maximum number of dimensions the memory represents.  Exporters\nMUST respect this limit, consumers of multi-dimensional buffers\nSHOULD be able to handle up to 'PyBUFMAXNDIM' dimensions.\nCurrently set to 64.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Buffer request types,  Next: Complex arrays,  Prev: Buffer structure,  Up: Buffer Protocol": {
            "content": "7.7.7.2 Buffer request types\n............................\n",
            "subsections": []
        },
        "Buffers are usually obtained by sending a buffer request to an exporting": {
            "content": "object via *note PyObjectGetBuffer(): 541.  Since the complexity of the\nlogical structure of the memory can vary drastically, the consumer uses\nthe 'flags' argument to specify the exact buffer type it can handle.\n\nAll *note Pybuffer: 53f. fields are unambiguously defined by the\nrequest type.\n\n* Menu:\n\n* request-independent fields::\n* readonly, format: readonly format.\n* shape, strides, suboffsets: shape strides suboffsets.\n* contiguity requests::\n* compound requests::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: request-independent fields,  Next: readonly format,  Up: Buffer request types": {
            "content": "7.7.7.3 request-independent fields\n..................................\n",
            "subsections": []
        },
        "The following fields are not influenced by 'flags' and must always be": {
            "content": "filled in with the correct values: *note obj: 4979, *note buf: 4977,\n*note len: 497a, *note itemsize: 497d, *note ndim: 4981.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: readonly format,  Next: shape strides suboffsets,  Prev: request-independent fields,  Up: Buffer request types": {
            "content": "7.7.7.4 readonly, format\n........................\n\n-- C Macro: PyBUFWRITABLE\n\nControls the *note readonly: 497c. field.  If set, the\nexporter MUST provide a writable buffer or else report\nfailure.  Otherwise, the exporter MAY provide either a\nread-only or writable buffer, but the choice MUST be\nconsistent for all consumers.\n\n-- C Macro: PyBUFFORMAT\n\nControls the *note format: 497e. field.  If set, this field\nMUST be filled in correctly.  Otherwise, this field MUST be\n'NULL'.\n\n*note PyBUFWRITABLE: 120f. can be |'d to any of the flags in the next\nsection.  Since *note PyBUFSIMPLE: 497b. is defined as 0, *note",
            "subsections": []
        },
        "PyBUFWRITABLE: 120f. can be used as a stand-alone flag to request a": {
            "content": "simple writable buffer.\n\n*note PyBUFFORMAT: 497f. can be |'d to any of the flags except *note",
            "subsections": []
        },
        "PyBUFSIMPLE: 497b.  The latter already implies format 'B' (unsigned": {
            "content": "bytes).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: shape strides suboffsets,  Next: contiguity requests,  Prev: readonly format,  Up: Buffer request types": {
            "content": "7.7.7.5 shape, strides, suboffsets\n..................................\n",
            "subsections": []
        },
        "The flags that control the logical structure of the memory are listed in": {
            "content": "decreasing order of complexity.  Note that each flag contains all bits\nof the flags below it.\n",
            "subsections": []
        },
        "Request                           shape       strides       suboffsets": {
            "content": "-----------------------------------------------------------------------------\n\n-- C Macro: PyBUFINDIRECT       yes         yes           if needed\n\n\n-- C Macro: PyBUFSTRIDES        yes         yes           NULL\n\n\n-- C Macro: PyBUFND             yes         NULL          NULL\n\n\n-- C Macro: PyBUFSIMPLE         NULL        NULL          NULL\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: contiguity requests,  Next: compound requests,  Prev: shape strides suboffsets,  Up: Buffer request types": {
            "content": "7.7.7.6 contiguity requests\n...........................\n\nC or Fortran *note contiguity: 1f33. can be explicitly requested, with\nand without stride information.  Without stride information, the buffer\nmust be C-contiguous.\n",
            "subsections": []
        },
        "Request                                 shape       strides       suboffsets       contig": {
            "content": "------------------------------------------------------------------------------------------------\n\n-- C Macro: PyBUFCCONTIGUOUS         yes         yes           NULL             C\n\n\n-- C Macro: PyBUFFCONTIGUOUS         yes         yes           NULL             F\n\n\n-- C Macro: PyBUFANYCONTIGUOUS       yes         yes           NULL             C or F\n\n\n*note PyBUFND: 498c.                   yes         NULL          NULL             C\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: compound requests,  Prev: contiguity requests,  Up: Buffer request types": {
            "content": "7.7.7.7 compound requests\n.........................\n",
            "subsections": []
        },
        "All possible requests are fully defined by some combination of the flags": {
            "content": "in the previous section.  For convenience, the buffer protocol provides\nfrequently used combinations as single flags.\n",
            "subsections": []
        },
        "In the following table 'U' stands for undefined contiguity.  The": {
            "content": "consumer would have to call *note PyBufferIsContiguous(): 547. to\ndetermine contiguity.\n",
            "subsections": []
        },
        "Request                             shape       strides       suboffsets       contig       readonly       format": {
            "content": "------------------------------------------------------------------------------------------------------------------------\n\n-- C Macro: PyBUFFULL             yes         yes           if needed        U            0              yes\n\n\n-- C Macro: PyBUFFULLRO          yes         yes           if needed        U            1 or 0         yes\n\n\n-- C Macro: PyBUFRECORDS          yes         yes           NULL             U            0              yes\n\n\n-- C Macro: PyBUFRECORDSRO       yes         yes           NULL             U            1 or 0         yes\n\n\n-- C Macro: PyBUFSTRIDED          yes         yes           NULL             U            0              NULL\n\n\n-- C Macro: PyBUFSTRIDEDRO       yes         yes           NULL             U            1 or 0         NULL\n\n\n-- C Macro: PyBUFCONTIG           yes         NULL          NULL             C            0              NULL\n\n\n-- C Macro: PyBUFCONTIGRO        yes         NULL          NULL             C            1 or 0         NULL\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Complex arrays,  Next: Buffer-related functions,  Prev: Buffer request types,  Up: Buffer Protocol": {
            "content": "7.7.7.8 Complex arrays\n......................\n\n* Menu:\n\n* NumPy-style; shape and strides: NumPy-style shape and strides.\n* PIL-style; shape, strides and suboffsets: PIL-style shape strides and suboffsets.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: NumPy-style shape and strides,  Next: PIL-style shape strides and suboffsets,  Up: Complex arrays": {
            "content": "7.7.7.9 NumPy-style: shape and strides\n......................................\n\nThe logical structure of NumPy-style arrays is defined by *note\nitemsize: 497d, *note ndim: 4981, *note shape: 4980. and *note strides:\n4978.\n\nIf 'ndim == 0', the memory location pointed to by *note buf: 4977. is\ninterpreted as a scalar of size *note itemsize: 497d.  In that case,\nboth *note shape: 4980. and *note strides: 4978. are 'NULL'.\n\nIf *note strides: 4978. is 'NULL', the array is interpreted as a\nstandard n-dimensional C-array.  Otherwise, the consumer must access an\nn-dimensional array as follows:\n\nptr = (char *)buf + indices[0] * strides[0] + ... + indices[n-1] * strides[n-1];\nitem = *((typeof(item) *)ptr);\n\nAs noted above, *note buf: 4977. can point to any location within the\nactual memory block.  An exporter can check the validity of a buffer\nwith this function:\n\ndef verifystructure(memlen, itemsize, ndim, shape, strides, offset):\n\"\"\"Verify that the parameters represent a valid array within\nthe bounds of the allocated memory:\nchar *mem: start of the physical memory block\nmemlen: length of the physical memory block\noffset: (char *)buf - mem\n\"\"\"\nif offset % itemsize:\nreturn False\nif offset < 0 or offset+itemsize > memlen:\nreturn False\nif any(v % itemsize for v in strides):\nreturn False\n\nif ndim <= 0:\nreturn ndim == 0 and not shape and not strides\nif 0 in shape:\nreturn True\n\nimin = sum(strides[j]*(shape[j]-1) for j in range(ndim)\nif strides[j] <= 0)\nimax = sum(strides[j]*(shape[j]-1) for j in range(ndim)\nif strides[j] > 0)\n\nreturn 0 <= offset+imin and offset+imax+itemsize <= memlen\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: PIL-style shape strides and suboffsets,  Prev: NumPy-style shape and strides,  Up: Complex arrays": {
            "content": "7.7.7.10 PIL-style: shape, strides and suboffsets\n.................................................\n",
            "subsections": []
        },
        "In addition to the regular items, PIL-style arrays can contain pointers": {
            "content": "that must be followed in order to get to the next element in a\ndimension.  For example, the regular three-dimensional C-array 'char\nv[2][2][3]' can also be viewed as an array of 2 pointers to 2\ntwo-dimensional arrays: 'char (*v[2])[2][3]'.  In suboffsets\nrepresentation, those two pointers can be embedded at the start of *note\nbuf: 4977, pointing to two 'char x[2][3]' arrays that can be located\nanywhere in memory.\n",
            "subsections": []
        },
        "Here is a function that returns a pointer to the element in an N-D array": {
            "content": "pointed to by an N-dimensional index when there are both non-'NULL'\nstrides and suboffsets:\n\nvoid *getitempointer(int ndim, void *buf, Pyssizet *strides,\nPyssizet *suboffsets, Pyssizet *indices) {\nchar *pointer = (char*)buf;\nint i;\nfor (i = 0; i < ndim; i++) {\npointer += strides[i] * indices[i];\nif (suboffsets[i] >=0 ) {\npointer = *((char)pointer) + suboffsets[i];\n}\n}\nreturn (void*)pointer;\n}\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Buffer-related functions,  Prev: Complex arrays,  Up: Buffer Protocol": {
            "content": "7.7.7.11 Buffer-related functions\n.................................\n\n-- C Function: int PyObjectCheckBuffer (PyObject *obj)\n' Part of the *note Stable ABI: 2ac. since version 3.11.'  Return\n'1' if 'obj' supports the buffer interface otherwise '0'.  When '1'\nis returned, it doesn't guarantee that *note PyObjectGetBuffer():\n541. will succeed.  This function always succeeds.\n\n-- C Function: int PyObjectGetBuffer (PyObject *exporter, Pybuffer\n*view, int flags)\n' Part of the *note Stable ABI: 2ac. since version 3.11.'  Send a\nrequest to 'exporter' to fill in 'view' as specified by 'flags'.\nIf the exporter cannot provide a buffer of the exact type, it MUST\nraise *note BufferError: 1586, set 'view->obj' to 'NULL' and return\n'-1'.\n\nOn success, fill in 'view', set 'view->obj' to a new reference to\n'exporter' and return 0.  In the case of chained buffer providers\nthat redirect requests to a single object, 'view->obj' MAY refer to\nthis object instead of 'exporter' (See *note Buffer Object\nStructures: 4973.).\n\nSuccessful calls to *note PyObjectGetBuffer(): 541. must be paired\nwith calls to *note PyBufferRelease(): 54a, similar to 'malloc()'\nand 'free()'.  Thus, after the consumer is done with the buffer,\n*note PyBufferRelease(): 54a. must be called exactly once.\n\n-- C Function: void PyBufferRelease (Pybuffer *view)\n' Part of the *note Stable ABI: 2ac. since version 3.11.'  Release\nthe buffer 'view' and release the *note strong reference: 57c.\n(i.e.  decrement the reference count) to the view's supporting\nobject, 'view->obj'.  This function MUST be called when the buffer\nis no longer being used, otherwise reference leaks may occur.\n\nIt is an error to call this function on a buffer that was not\nobtained via *note PyObjectGetBuffer(): 541.\n\n-- C Function: *note Pyssizet: 88d. PyBufferSizeFromFormat (const\nchar *format)\n' Part of the *note Stable ABI: 2ac. since version 3.11.'  Return\nthe implied *note itemsize: 497d. from *note format: 497e.  On\nerror, raise an exception and return -1.\n\nNew in version 3.9.\n\n-- C Function: int PyBufferIsContiguous (const Pybuffer *view, char\norder)\n' Part of the *note Stable ABI: 2ac. since version 3.11.'  Return\n'1' if the memory defined by the 'view' is C-style ('order' is\n''C'') or Fortran-style ('order' is ''F'') *note contiguous: 1f33.\nor either one ('order' is ''A'').  Return '0' otherwise.  This\nfunction always succeeds.\n\n-- C Function: void *PyBufferGetPointer (const Pybuffer *view, const\nPyssizet *indices)\n' Part of the *note Stable ABI: 2ac. since version 3.11.'  Get the\nmemory area pointed to by the 'indices' inside the given 'view'.\n'indices' must point to an array of 'view->ndim' indices.\n\n-- C Function: int PyBufferFromContiguous (const Pybuffer *view,\nconst void *buf, Pyssizet len, char fort)\n' Part of the *note Stable ABI: 2ac. since version 3.11.'  Copy\ncontiguous 'len' bytes from 'buf' to 'view'.  'fort' can be ''C''\nor ''F'' (for C-style or Fortran-style ordering).  '0' is returned\non success, '-1' on error.\n\n-- C Function: int PyBufferToContiguous (void *buf, const Pybuffer\n*src, Pyssizet len, char order)\n' Part of the *note Stable ABI: 2ac. since version 3.11.'  Copy\n'len' bytes from 'src' to its contiguous representation in 'buf'.\n'order' can be ''C'' or ''F'' or ''A'' (for C-style or\nFortran-style ordering or either one).  '0' is returned on success,\n'-1' on error.\n\nThis function fails if 'len' != 'src->len'.\n\n-- C Function: int PyObjectCopyData (PyObject *dest, PyObject *src)\n' Part of the *note Stable ABI: 2ac. since version 3.11.'  Copy\ndata from 'src' to 'dest' buffer.  Can convert between C-style and\nor Fortran-style buffers.\n\n'0' is returned on success, '-1' on error.\n\n-- C Function: void PyBufferFillContiguousStrides (int ndims,\nPyssizet *shape, Pyssizet *strides, int itemsize, char\norder)\n' Part of the *note Stable ABI: 2ac. since version 3.11.'  Fill the\n'strides' array with byte-strides of a *note contiguous: 1f33.\n(C-style if 'order' is ''C'' or Fortran-style if 'order' is ''F'')\narray of the given shape with the given number of bytes per\nelement.\n\n-- C Function: int PyBufferFillInfo (Pybuffer *view, PyObject\n*exporter, void *buf, Pyssizet len, int readonly, int flags)\n' Part of the *note Stable ABI: 2ac. since version 3.11.'  Handle\nbuffer requests for an exporter that wants to expose 'buf' of size\n'len' with writability set according to 'readonly'.  'buf' is\ninterpreted as a sequence of unsigned bytes.\n\nThe 'flags' argument indicates the request type.  This function\nalways fills in 'view' as specified by flags, unless 'buf' has been\ndesignated as read-only and *note PyBUFWRITABLE: 120f. is set in\n'flags'.\n\nOn success, set 'view->obj' to a new reference to 'exporter' and\nreturn 0.  Otherwise, raise *note BufferError: 1586, set\n'view->obj' to 'NULL' and return '-1';\n\nIf this function is used as part of a *note getbufferproc: 4973,\n'exporter' MUST be set to the exporting object and 'flags' must be\npassed unmodified.  Otherwise, 'exporter' MUST be 'NULL'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Old Buffer Protocol,  Prev: Buffer Protocol,  Up: Abstract Objects Layer": {
            "content": "Deprecated since version 3.0.\n\nThese functions were part of the \"old buffer protocol\" API in Python 2.",
            "subsections": []
        },
        "In Python 3, this protocol doesn't exist anymore but the functions are": {
            "content": "still exposed to ease porting 2.x code.  They act as a compatibility\nwrapper around the *note new buffer protocol: 148, but they don't give\nyou control over the lifetime of the resources acquired when a buffer is\nexported.\n\nTherefore, it is recommended that you call *note PyObjectGetBuffer():\n541. (or the 'y*' or 'w*' *note format codes: 6bc. with the *note",
            "subsections": []
        },
        "PyArgParseTuple(): 2d1. family of functions) to get a buffer view over": {
            "content": "an object, and *note PyBufferRelease(): 54a. when the buffer view can\nbe released.\n\n-- C Function: int PyObjectAsCharBuffer (PyObject *obj, const char\nbuffer, Pyssizet *bufferlen)\n' Part of the *note Stable ABI: 2ac.'  Returns a pointer to a\nread-only memory location usable as character-based input.  The\n'obj' argument must support the single-segment character buffer\ninterface.  On success, returns '0', sets 'buffer' to the memory\nlocation and 'bufferlen' to the buffer length.  Returns '-1' and\nsets a *note TypeError: 28e. on error.\n\n-- C Function: int PyObjectAsReadBuffer (PyObject *obj, const void\nbuffer, Pyssizet *bufferlen)\n' Part of the *note Stable ABI: 2ac.'  Returns a pointer to a\nread-only memory location containing arbitrary data.  The 'obj'\nargument must support the single-segment readable buffer interface.\nOn success, returns '0', sets 'buffer' to the memory location and\n'bufferlen' to the buffer length.  Returns '-1' and sets a *note\nTypeError: 28e. on error.\n\n-- C Function: int PyObjectCheckReadBuffer (PyObject *o)\n' Part of the *note Stable ABI: 2ac.'  Returns '1' if 'o' supports\nthe single-segment readable buffer interface.  Otherwise returns\n'0'.  This function always succeeds.\n\nNote that this function tries to get and release a buffer, and\nexceptions which occur while calling corresponding functions will\nget suppressed.  To get error reporting use *note\nPyObjectGetBuffer(): 541. instead.\n\n-- C Function: int PyObjectAsWriteBuffer (PyObject *obj, void\nbuffer, Pyssizet *bufferlen)\n' Part of the *note Stable ABI: 2ac.'  Returns a pointer to a\nwritable memory location.  The 'obj' argument must support the\nsingle-segment, character buffer interface.  On success, returns\n'0', sets 'buffer' to the memory location and 'bufferlen' to the\nbuffer length.  Returns '-1' and sets a *note TypeError: 28e. on\nerror.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Concrete Objects Layer,  Next: Initialization Finalization and Threads,  Prev: Abstract Objects Layer,  Up: Python/C API Reference Manual": {
            "content": "",
            "subsections": [
                {
                    "name": "7.8 Concrete Objects Layer",
                    "content": ""
                }
            ]
        },
        "The functions in this chapter are specific to certain Python object": {
            "content": "types.  Passing them an object of the wrong type is not a good idea; if\nyou receive an object from a Python program and you are not sure that it\nhas the right type, you must perform a type check first; for example, to\ncheck that an object is a dictionary, use *note PyDictCheck(): 49a0.\nThe chapter is structured like the \"family tree\" of Python object types.\n\nWarning: While the functions described in this chapter carefully\ncheck the type of the objects which are passed in, many of them do\nnot check for 'NULL' being passed instead of a valid object.\nAllowing 'NULL' to be passed in can cause memory access violations\nand immediate termination of the interpreter.\n\n* Menu:\n\n* Fundamental Objects::\n* Numeric Objects::\n* Sequence Objects::\n* Container Objects::\n* Function Objects: Function Objects<2>.\n* Other Objects::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Fundamental Objects,  Next: Numeric Objects,  Up: Concrete Objects Layer": {
            "content": "",
            "subsections": []
        },
        "This section describes Python type objects and the singleton object": {
            "content": "'None'.\n\n* Menu:\n\n* Type Objects: Type Objects<2>.\n* The None Object::\n\nFile: python3.12.info,  Node: Type Objects<2>,  Next: The None Object,  Up: Fundamental Objects\n\n7.8.1.1 Type Objects\n....................\n\n-- C Type: type PyTypeObject\n' Part of the *note Limited API: 2ac. (as an opaque struct).'  The\nC structure of the objects used to describe built-in types.\n\n-- C Variable: *note PyTypeObject: 8da. PyTypeType\n' Part of the *note Stable ABI: 2ac.'  This is the type object for\ntype objects; it is the same object as *note type: ba0. in the\nPython layer.\n\n-- C Function: int PyTypeCheck (PyObject *o)\n\nReturn non-zero if the object 'o' is a type object, including\ninstances of types derived from the standard type object.  Return 0\nin all other cases.  This function always succeeds.\n\n-- C Function: int PyTypeCheckExact (PyObject *o)\n\nReturn non-zero if the object 'o' is a type object, but not a\nsubtype of the standard type object.  Return 0 in all other cases.\nThis function always succeeds.\n\n-- C Function: unsigned int PyTypeClearCache ()\n' Part of the *note Stable ABI: 2ac.'  Clear the internal lookup\ncache.  Return the current version tag.\n\n-- C Function: unsigned long PyTypeGetFlags (PyTypeObject *type)\n' Part of the *note Stable ABI: 2ac.'  Return the *note tpflags:\n1620. member of 'type'.  This function is primarily meant for use\nwith 'PyLIMITEDAPI'; the individual flag bits are guaranteed to\nbe stable across Python releases, but access to *note tpflags:\n1620. itself is not part of the *note limited API: 2a8.\n\nNew in version 3.2.\n\nChanged in version 3.4: The return type is now 'unsigned long'\nrather than 'long'.\n\n-- C Function: *note PyObject: 6b1. *PyTypeGetDict (PyTypeObject\n*type)\n\nReturn the type object's internal namespace, which is otherwise\nonly exposed via a read-only proxy ('cls.dict').  This is a\nreplacement for accessing *note tpdict: 1443. directly.  The\nreturned dictionary must be treated as read-only.\n\nThis function is meant for specific embedding and language-binding\ncases, where direct access to the dict is necessary and indirect\naccess (e.g.  via the proxy or *note PyObjectGetAttr(): 4821.)\nisn't adequate.\n\nExtension modules should continue to use 'tpdict', directly or\nindirectly, when setting up their own types.\n\nNew in version 3.12.\n\n-- C Function: void PyTypeModified (PyTypeObject *type)\n' Part of the *note Stable ABI: 2ac.'  Invalidate the internal\nlookup cache for the type and all of its subtypes.  This function\nmust be called after any manual modification of the attributes or\nbase classes of the type.\n\n-- C Function: int PyTypeAddWatcher (PyTypeWatchCallback callback)\n\nRegister 'callback' as a type watcher.  Return a non-negative\ninteger ID which must be passed to future calls to *note\nPyTypeWatch(): 2c0.  In case of error (e.g.  no more watcher IDs\navailable), return '-1' and set an exception.\n\nNew in version 3.12.\n\n-- C Function: int PyTypeClearWatcher (int watcherid)\n\nClear watcher identified by 'watcherid' (previously returned from\n*note PyTypeAddWatcher(): 2bf.).  Return '0' on success, '-1' on\nerror (e.g.  if 'watcherid' was never registered.)\n\nAn extension should never call 'PyTypeClearWatcher' with a\n'watcherid' that was not returned to it by a previous call to\n*note PyTypeAddWatcher(): 2bf.\n\nNew in version 3.12.\n\n-- C Function: int PyTypeWatch (int watcherid, PyObject *type)\n\nMark 'type' as watched.  The callback granted 'watcherid' by *note\nPyTypeAddWatcher(): 2bf. will be called whenever *note\nPyTypeModified(): 154f. reports a change to 'type'.  (The callback\nmay be called only once for a series of consecutive modifications\nto 'type', if 'PyTypeLookup()' is not called on 'type' between\nthe modifications; this is an implementation detail and subject to\nchange.)\n\nAn extension should never call 'PyTypeWatch' with a 'watcherid'\nthat was not returned to it by a previous call to *note\nPyTypeAddWatcher(): 2bf.\n\nNew in version 3.12.\n\n-- C Type: typedef int (*PyTypeWatchCallback)(*note PyObject: 6b1.\n*type)\n\nType of a type-watcher callback function.\n\nThe callback must not modify 'type' or cause *note\nPyTypeModified(): 154f. to be called on 'type' or any type in its\nMRO; violating this rule could cause infinite recursion.\n\nNew in version 3.12.\n\n-- C Function: int PyTypeHasFeature (PyTypeObject *o, int feature)\n\nReturn non-zero if the type object 'o' sets the feature 'feature'.\nType features are denoted by single bit flags.\n\n-- C Function: int PyTypeISGC (PyTypeObject *o)\n\nReturn true if the type object includes support for the cycle\ndetector; this tests the type flag *note PyTPFLAGSHAVEGC: 568.\n\n-- C Function: int PyTypeIsSubtype (PyTypeObject *a, PyTypeObject *b)\n' Part of the *note Stable ABI: 2ac.'  Return true if 'a' is a\nsubtype of 'b'.\n\nThis function only checks for actual subtypes, which means that\n*note subclasscheck(): 1c85. is not called on 'b'.  Call *note\nPyObjectIsSubclass(): d0b. to do the same check that *note\nissubclass(): 5b4. would do.\n\n-- C Function: *note PyObject: 6b1. *PyTypeGenericAlloc (PyTypeObject\n*type, Pyssizet nitems)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Generic handler for the *note tpalloc: 46d2. slot of a type\nobject.  Use Python's default memory allocation mechanism to\nallocate a new instance and initialize all its contents to 'NULL'.\n\n-- C Function: *note PyObject: 6b1. *PyTypeGenericNew (PyTypeObject\n*type, PyObject *args, PyObject *kwds)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Generic handler for the *note tpnew: 2e1. slot of a type\nobject.  Create a new instance using the type's *note tpalloc:\n46d2. slot.\n\n-- C Function: int PyTypeReady (PyTypeObject *type)\n' Part of the *note Stable ABI: 2ac.'  Finalize a type object.\nThis should be called on all type objects to finish their\ninitialization.  This function is responsible for adding inherited\nslots from a type's base class.  Return '0' on success, or return\n'-1' and sets an exception on error.\n\nNote: If some of the base classes implements the GC protocol\nand the provided type does not include the *note\nPyTPFLAGSHAVEGC: 568. in its flags, then the GC protocol\nwill be automatically implemented from its parents.  On the\ncontrary, if the type being created does include *note\nPyTPFLAGSHAVEGC: 568. in its flags then it 'must' implement\nthe GC protocol itself by at least implementing the *note\ntptraverse: 569. handle.\n\n-- C Function: *note PyObject: 6b1. *PyTypeGetName (PyTypeObject\n*type)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\nsince version 3.11.'  Return the type's name.  Equivalent to\ngetting the type's 'name' attribute.\n\nNew in version 3.11.\n\n-- C Function: *note PyObject: 6b1. *PyTypeGetQualName (PyTypeObject\n*type)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\nsince version 3.11.'  Return the type's qualified name.  Equivalent\nto getting the type's 'qualname' attribute.\n\nNew in version 3.11.\n\n-- C Function: void *PyTypeGetSlot (PyTypeObject *type, int slot)\n' Part of the *note Stable ABI: 2ac. since version 3.4.'  Return\nthe function pointer stored in the given slot.  If the result is\n'NULL', this indicates that either the slot is 'NULL', or that the\nfunction was called with invalid parameters.  Callers will\ntypically cast the result pointer into the appropriate function\ntype.\n\nSee *note PyTypeSlot.slot: 49a9. for possible values of the 'slot'\nargument.\n\nNew in version 3.4.\n\nChanged in version 3.10: *note PyTypeGetSlot(): 6ad. can now\naccept all types.  Previously, it was limited to *note heap types:\n786.\n\n-- C Function: *note PyObject: 6b1. *PyTypeGetModule (PyTypeObject\n*type)\n' Part of the *note Stable ABI: 2ac. since version 3.10.'  Return\nthe module object associated with the given type when the type was\ncreated using *note PyTypeFromModuleAndSpec(): 2aa.\n\nIf no module is associated with the given type, sets *note\nTypeError: 28e. and returns 'NULL'.\n\nThis function is usually used to get the module in which a method\nis defined.  Note that in such a method,\n'PyTypeGetModule(PyTYPE(self))' may not return the intended\nresult.  'PyTYPE(self)' may be a 'subclass' of the intended class,\nand subclasses are not necessarily defined in the same module as\ntheir superclass.  See *note PyCMethod: 54f. to get the class that\ndefines the method.  See *note PyTypeGetModuleByDef(): 54e. for\ncases when 'PyCMethod' cannot be used.\n\nNew in version 3.9.\n\n-- C Function: void *PyTypeGetModuleState (PyTypeObject *type)\n' Part of the *note Stable ABI: 2ac. since version 3.10.'  Return\nthe state of the module object associated with the given type.\nThis is a shortcut for calling *note PyModuleGetState(): 7a4. on\nthe result of *note PyTypeGetModule(): 790.\n\nIf no module is associated with the given type, sets *note\nTypeError: 28e. and returns 'NULL'.\n\nIf the 'type' has an associated module but its state is 'NULL',\nreturns 'NULL' without setting an exception.\n\nNew in version 3.9.\n\n-- C Function: *note PyObject: 6b1. *PyTypeGetModuleByDef\n(PyTypeObject *type, struct PyModuleDef *def)\n\nFind the first superclass whose module was created from the given\n*note PyModuleDef: 7a1. 'def', and return that module.\n\nIf no module is found, raises a *note TypeError: 28e. and returns\n'NULL'.\n\nThis function is intended to be used together with *note\nPyModuleGetState(): 7a4. to get module state from slot methods\n(such as *note tpinit: 2e3. or *note nbadd: 49aa.) and other\nplaces where a method's defining class cannot be passed using the\n*note PyCMethod: 54f. calling convention.\n\nNew in version 3.11.\n\n-- C Function: int PyUnstableTypeAssignVersionTag (PyTypeObject\n*type)\n\nThis is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 29f. It may change without warning in minor releases.':\nAttempt to assign a version tag to the given type.\n\nReturns 1 if the type already had a valid version tag or a new one\nwas assigned, or 0 if a new tag could not be assigned.\n\nNew in version 3.12.\n\n* Menu:\n\n* Creating Heap-Allocated Types::\n\nFile: python3.12.info,  Node: Creating Heap-Allocated Types,  Up: Type Objects<2>\n\n7.8.1.2 Creating Heap-Allocated Types\n.....................................\n\nThe following functions and structs are used to create *note heap types:\n786.\n\n-- C Function: *note PyObject: 6b1. *PyTypeFromMetaclass (PyTypeObject\n*metaclass, PyObject *module, PyTypeSpec *spec, PyObject\n*bases)\n' Part of the *note Stable ABI: 2ac. since version 3.12.'  Create\nand return a *note heap type: 786. from the 'spec' (see *note\nPyTPFLAGSHEAPTYPE: 6c7.).\n\nThe metaclass 'metaclass' is used to construct the resulting type\nobject.  When 'metaclass' is 'NULL', the metaclass is derived from\n'bases' (or 'Pytpbase[s]' slots if 'bases' is 'NULL', see below).\n\nMetaclasses that override *note tpnew: 2e1. are not supported,\nexcept if 'tpnew' is 'NULL'.  (For backwards compatibility, other\n'PyTypeFrom*' functions allow such metaclasses.  They ignore\n'tpnew', which may result in incomplete initialization.  This is\ndeprecated and in Python 3.14+ such metaclasses will not be\nsupported.)\n\nThe 'bases' argument can be used to specify base classes; it can\neither be only one class or a tuple of classes.  If 'bases' is\n'NULL', the 'Pytpbases' slot is used instead.  If that also is\n'NULL', the 'Pytpbase' slot is used instead.  If that also is\n'NULL', the new type derives from *note object: 8bb.\n\nThe 'module' argument can be used to record the module in which the\nnew class is defined.  It must be a module object or 'NULL'.  If\nnot 'NULL', the module is associated with the new type and can\nlater be retrieved with *note PyTypeGetModule(): 790.  The\nassociated module is not inherited by subclasses; it must be\nspecified for each class individually.\n\nThis function calls *note PyTypeReady(): 567. on the new type.\n\nNote that this function does 'not' fully match the behavior of\ncalling *note type(): ba0. or using the *note class: 114c.\nstatement.  With user-provided base types or metaclasses, prefer\n*note calling: 4951. *note type: ba0. (or the metaclass) over\n'PyTypeFrom*' functions.  Specifically:\n\n* *note new(): 2e2. is not called on the new class (and it\nmust be set to 'type.new').\n\n* *note init(): 47d. is not called on the new class.\n\n* *note initsubclass(): 3fe. is not called on any bases.\n\n* *note setname(): a97. is not called on new descriptors.\n\nNew in version 3.12.\n\n-- C Function: *note PyObject: 6b1. *PyTypeFromModuleAndSpec (PyObject\n*module, PyTypeSpec *spec, PyObject *bases)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\nsince version 3.10.'  Equivalent to 'PyTypeFromMetaclass(NULL,\nmodule, spec, bases)'.\n\nNew in version 3.9.\n\nChanged in version 3.10: The function now accepts a single class as\nthe 'bases' argument and 'NULL' as the 'tpdoc' slot.\n\nChanged in version 3.12: The function now finds and uses a\nmetaclass corresponding to the provided base classes.  Previously,\nonly *note type: ba0. instances were returned.\n\nThe *note tpnew: 2e1. of the metaclass is 'ignored'.  which may\nresult in incomplete initialization.  Creating classes whose\nmetaclass overrides *note tpnew: 2e1. is deprecated and in Python\n3.14+ it will be no longer allowed.\n\n-- C Function: *note PyObject: 6b1. *PyTypeFromSpecWithBases\n(PyTypeSpec *spec, PyObject *bases)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\nsince version 3.3.'  Equivalent to 'PyTypeFromMetaclass(NULL,\nNULL, spec, bases)'.\n\nNew in version 3.3.\n\nChanged in version 3.12: The function now finds and uses a\nmetaclass corresponding to the provided base classes.  Previously,\nonly *note type: ba0. instances were returned.\n\nThe *note tpnew: 2e1. of the metaclass is 'ignored'.  which may\nresult in incomplete initialization.  Creating classes whose\nmetaclass overrides *note tpnew: 2e1. is deprecated and in Python\n3.14+ it will be no longer allowed.\n\n-- C Function: *note PyObject: 6b1. *PyTypeFromSpec (PyTypeSpec\n*spec)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Equivalent to 'PyTypeFromMetaclass(NULL, NULL, spec,\nNULL)'.\n\nChanged in version 3.12: The function now finds and uses a\nmetaclass corresponding to the base classes provided in\n'Pytpbase[s]' slots.  Previously, only *note type: ba0. instances\nwere returned.\n\nThe *note tpnew: 2e1. of the metaclass is 'ignored'.  which may\nresult in incomplete initialization.  Creating classes whose\nmetaclass overrides *note tpnew: 2e1. is deprecated and in Python\n3.14+ it will be no longer allowed.\n\n-- C Type: type PyTypeSpec\n' Part of the *note Stable ABI: 2ac. (including all members).'\nStructure defining a type's behavior.\n\n-- C Member: const char *name\n\nName of the type, used to set *note PyTypeObject.tpname:\n1657.\n\n-- C Member: int basicsize\n\nIf positive, specifies the size of the instance in bytes.  It\nis used to set *note PyTypeObject.tpbasicsize: 7ab.\n\nIf zero, specifies that *note tpbasicsize: 7ab. should be\ninherited.\n\nIf negative, the absolute value specifies how much space\ninstances of the class need 'in addition' to the superclass.\nUse *note PyObjectGetTypeData(): 2a1. to get a pointer to\nsubclass-specific memory reserved this way.\n\nChanged in version 3.12: Previously, this field could not be\nnegative.\n\n-- C Member: int itemsize\n\nSize of one element of a variable-size type, in bytes.  Used\nto set *note PyTypeObject.tpitemsize: 1c77.  See\n'tpitemsize' documentation for caveats.\n\nIf zero, *note tpitemsize: 1c77. is inherited.  Extending\narbitrary variable-sized classes is dangerous, since some\ntypes use a fixed offset for variable-sized memory, which can\nthen overlap fixed-sized memory used by a subclass.  To help\nprevent mistakes, inheriting 'itemsize' is only possible in\nthe following situations:\n\n- The base is not variable-sized (its *note tpitemsize:\n1c77.).\n\n- The requested *note PyTypeSpec.basicsize: 2a0. is\npositive, suggesting that the memory layout of the base\nclass is known.\n\n- The requested *note PyTypeSpec.basicsize: 2a0. is zero,\nsuggesting that the subclass does not access the\ninstance's memory directly.\n\n- With the *note PyTPFLAGSITEMSATEND: 2a3. flag.\n\n-- C Member: unsigned int flags\n\nType flags, used to set *note PyTypeObject.tpflags: 1620.\n\nIf the 'PyTPFLAGSHEAPTYPE' flag is not set, *note\nPyTypeFromSpecWithBases(): 2e0. sets it automatically.\n\n-- C Member: *note PyTypeSlot: 485e. *slots\n\nArray of *note PyTypeSlot: 485e. structures.  Terminated by\nthe special slot value '{0, NULL}'.\n\nEach slot ID should be specified at most once.\n\n-- C Type: type PyTypeSlot\n' Part of the *note Stable ABI: 2ac. (including all members).'\nStructure defining optional functionality of a type, containing a\nslot ID and a value pointer.\n\n-- C Member: int slot\n\nA slot ID.\n\nSlot IDs are named like the field names of the structures\n*note PyTypeObject: 8da, *note PyNumberMethods: 1274,\n*note PySequenceMethods: 46f6, *note PyMappingMethods:\n46f7. and *note PyAsyncMethods: 49b1. with an added 'Py'\nprefix.  For example, use:\n\n* 'Pytpdealloc' to set *note\nPyTypeObject.tpdealloc: 46d0.\n\n* 'Pynbadd' to set *note PyNumberMethods.nbadd:\n49aa.\n\n* 'Pysqlength' to set *note\nPySequenceMethods.sqlength: 49b2.\n\nThe following \"offset\" fields cannot be set using *note\nPyTypeSlot: 485e.:\n\n* *note tpweaklistoffset: 7ac. (use *note\nPyTPFLAGSMANAGEDWEAKREF: 2b5. instead if\npossible)\n\n* *note tpdictoffset: 49b3. (use *note\nPyTPFLAGSMANAGEDDICT: 2b4. instead if\npossible)\n\n* *note tpvectorcalloffset: 4953. (use\n'\"vectorcalloffset\"' in *note PyMemberDef:\n49b4.)\n\nIf it is not possible to switch to a 'MANAGED' flag\n(for example, for vectorcall or to support Python\nolder than 3.12), specify the offset in *note\nPytpmembers: 46d3.  See *note PyMemberDef\ndocumentation: 49b4. for details.\n\nThe following fields cannot be set at all when creating a\nheap type:\n\n* *note tpvectorcall: 49b5. (use *note tpnew: 2e1.\nand/or *note tpinit: 2e3.)\n\n* Internal fields: *note tpdict: 1443, *note tpmro:\n49b6, *note tpcache: 49b7, *note tpsubclasses:\n2d2, and *note tpweaklist: 49b8.\n\nSetting 'Pytpbases' or 'Pytpbase' may be problematic\non some platforms.  To avoid issues, use the 'bases'\nargument of *note PyTypeFromSpecWithBases(): 2e0.\ninstead.\n\nChanged in version 3.9: Slots in *note PyBufferProcs: 49b9.\nmay be set in the unlimited API.\n\nChanged in version 3.11: *note bfgetbuffer: 54c. and *note\nbfreleasebuffer: 54d. are now available under the *note\nlimited API: 2a8.\n\n-- C Member: void *pfunc\n\nThe desired value of the slot.  In most cases, this is a\npointer to a function.\n\nSlots other than 'Pytpdoc' may not be 'NULL'.\n\nFile: python3.12.info,  Node: The None Object,  Prev: Type Objects<2>,  Up: Fundamental Objects\n\n7.8.1.3 The 'None' Object\n.........................\n\nNote that the *note PyTypeObject: 8da. for 'None' is not directly\nexposed in the Python/C API. Since 'None' is a singleton, testing for\nobject identity (using '==' in C) is sufficient.  There is no\n'PyNoneCheck()' function for the same reason.\n\n-- C Variable: *note PyObject: 6b1. *PyNone\n\nThe Python 'None' object, denoting lack of value.  This object has\nno methods and is immortal(1).\n\nChanged in version 3.12: *note PyNone: 469e. is immortal.\n\n-- C Macro: PyRETURNNONE\n\nReturn *note PyNone: 469e. from a function.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0683/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Numeric Objects,  Next: Sequence Objects,  Prev: Fundamental Objects,  Up: Concrete Objects Layer": {
            "content": "* Menu:\n\n* Integer Objects::\n* Boolean Objects::\n* Floating Point Objects::\n* Complex Number Objects::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Integer Objects,  Next: Boolean Objects,  Up: Numeric Objects": {
            "content": "7.8.2.1 Integer Objects\n.......................\n\nAll integers are implemented as \"long\" integer objects of arbitrary\nsize.\n\nOn error, most 'PyLongAs*' APIs return '(return type)-1' which cannot\nbe distinguished from a number.  Use *note PyErrOccurred(): 1656. to\ndisambiguate.\n\n-- C Type: type PyLongObject\n' Part of the *note Limited API: 2ac. (as an opaque struct).'  This\nsubtype of *note PyObject: 6b1. represents a Python integer object.\n\n-- C Variable: *note PyTypeObject: 8da. PyLongType\n' Part of the *note Stable ABI: 2ac.'  This instance of *note\nPyTypeObject: 8da. represents the Python integer type.  This is the\nsame object as *note int: 17e. in the Python layer.\n\n-- C Function: int PyLongCheck (PyObject *p)\n\nReturn true if its argument is a *note PyLongObject: 2ea. or a\nsubtype of *note PyLongObject: 2ea.  This function always succeeds.\n\n-- C Function: int PyLongCheckExact (PyObject *p)\n\nReturn true if its argument is a *note PyLongObject: 2ea, but not a\nsubtype of *note PyLongObject: 2ea.  This function always succeeds.\n\n-- C Function: *note PyObject: 6b1. *PyLongFromLong (long v)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a new *note PyLongObject: 2ea. object from 'v', or\n'NULL' on failure.\n\nThe current implementation keeps an array of integer objects for\nall integers between '-5' and '256'.  When you create an int in\nthat range you actually just get back a reference to the existing\nobject.\n\n-- C Function: *note PyObject: 6b1. *PyLongFromUnsignedLong (unsigned\nlong v)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a new *note PyLongObject: 2ea. object from a C\nunsigned long, or 'NULL' on failure.\n\n-- C Function: *note PyObject: 6b1. *PyLongFromSsizet (Pyssizet v)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a new *note PyLongObject: 2ea. object from a C *note\nPyssizet: 88d, or 'NULL' on failure.\n\n-- C Function: *note PyObject: 6b1. *PyLongFromSizet (sizet v)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a new *note PyLongObject: 2ea. object from a C\n'sizet', or 'NULL' on failure.\n\n-- C Function: *note PyObject: 6b1. *PyLongFromLongLong (long long v)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a new *note PyLongObject: 2ea. object from a C long\nlong, or 'NULL' on failure.\n\n-- C Function: *note PyObject: 6b1. *PyLongFromUnsignedLongLong\n(unsigned long long v)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a new *note PyLongObject: 2ea. object from a C\nunsigned long long, or 'NULL' on failure.\n\n-- C Function: *note PyObject: 6b1. *PyLongFromDouble (double v)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a new *note PyLongObject: 2ea. object from the\ninteger part of 'v', or 'NULL' on failure.\n\n-- C Function: *note PyObject: 6b1. *PyLongFromString (const char\n*str, char pend, int base)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a new *note PyLongObject: 2ea. based on the string\nvalue in 'str', which is interpreted according to the radix in\n'base', or 'NULL' on failure.  If 'pend' is non-'NULL', '*pend'\nwill point to the end of 'str' on success or to the first character\nthat could not be processed on error.  If 'base' is '0', 'str' is\ninterpreted using the *note Integer literals: 1be6. definition; in\nthis case, leading zeros in a non-zero decimal number raises a\n*note ValueError: 183.  If 'base' is not '0', it must be between\n'2' and '36', inclusive.  Leading and trailing whitespace and\nsingle underscores after a base specifier and between digits are\nignored.  If there are no digits or 'str' is not NULL-terminated\nfollowing the digits and trailing whitespace, *note ValueError:\n183. will be raised.\n\nSee also\n........\n\nPython methods *note int.tobytes(): 15f2. and *note\nint.frombytes(): 15b3. to convert a *note PyLongObject: 2ea.\nto/from an array of bytes in base '256'.  You can call those from C\nusing *note PyObjectCallMethod(): 2d4.\n\n-- C Function: *note PyObject: 6b1. *PyLongFromUnicodeObject (PyObject\n*u, int base)\n'Return value: New reference.'  Convert a sequence of Unicode\ndigits in the string 'u' to a Python integer value.\n\nNew in version 3.3.\n\n-- C Function: *note PyObject: 6b1. *PyLongFromVoidPtr (void *p)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Create a Python integer from the pointer 'p'.  The pointer\nvalue can be retrieved from the resulting value using *note\nPyLongAsVoidPtr(): 47d9.\n\n-- C Function: long PyLongAsLong (PyObject *obj)\n' Part of the *note Stable ABI: 2ac.'\n\nReturn a C long representation of 'obj'.  If 'obj' is not an\ninstance of *note PyLongObject: 2ea, first call its *note\nindex(): 4f1. method (if present) to convert it to a *note\nPyLongObject: 2ea.\n\nRaise *note OverflowError: 68d. if the value of 'obj' is out of\nrange for a long.\n\nReturns '-1' on error.  Use *note PyErrOccurred(): 1656. to\ndisambiguate.\n\nChanged in version 3.8: Use *note index(): 4f1. if available.\n\nChanged in version 3.10: This function will no longer use *note\nint(): 4f0.\n\n-- C Function: long PyLongAsLongAndOverflow (PyObject *obj, int\n*overflow)\n' Part of the *note Stable ABI: 2ac.'  Return a C long\nrepresentation of 'obj'.  If 'obj' is not an instance of *note\nPyLongObject: 2ea, first call its *note index(): 4f1. method\n(if present) to convert it to a *note PyLongObject: 2ea.\n\nIf the value of 'obj' is greater than 'LONGMAX' or less than\n'LONGMIN', set '*overflow' to '1' or '-1', respectively, and\nreturn '-1'; otherwise, set '*overflow' to '0'.  If any other\nexception occurs set '*overflow' to '0' and return '-1' as usual.\n\nReturns '-1' on error.  Use *note PyErrOccurred(): 1656. to\ndisambiguate.\n\nChanged in version 3.8: Use *note index(): 4f1. if available.\n\nChanged in version 3.10: This function will no longer use *note\nint(): 4f0.\n\n-- C Function: long long PyLongAsLongLong (PyObject *obj)\n' Part of the *note Stable ABI: 2ac.'\n\nReturn a C long long representation of 'obj'.  If 'obj' is not an\ninstance of *note PyLongObject: 2ea, first call its *note\nindex(): 4f1. method (if present) to convert it to a *note\nPyLongObject: 2ea.\n\nRaise *note OverflowError: 68d. if the value of 'obj' is out of\nrange for a long long.\n\nReturns '-1' on error.  Use *note PyErrOccurred(): 1656. to\ndisambiguate.\n\nChanged in version 3.8: Use *note index(): 4f1. if available.\n\nChanged in version 3.10: This function will no longer use *note\nint(): 4f0.\n\n-- C Function: long long PyLongAsLongLongAndOverflow (PyObject *obj,\nint *overflow)\n' Part of the *note Stable ABI: 2ac.'  Return a C long long\nrepresentation of 'obj'.  If 'obj' is not an instance of *note\nPyLongObject: 2ea, first call its *note index(): 4f1. method\n(if present) to convert it to a *note PyLongObject: 2ea.\n\nIf the value of 'obj' is greater than 'LLONGMAX' or less than\n'LLONGMIN', set '*overflow' to '1' or '-1', respectively, and\nreturn '-1'; otherwise, set '*overflow' to '0'.  If any other\nexception occurs set '*overflow' to '0' and return '-1' as usual.\n\nReturns '-1' on error.  Use *note PyErrOccurred(): 1656. to\ndisambiguate.\n\nNew in version 3.2.\n\nChanged in version 3.8: Use *note index(): 4f1. if available.\n\nChanged in version 3.10: This function will no longer use *note\nint(): 4f0.\n\n-- C Function: *note Pyssizet: 88d. PyLongAsSsizet (PyObject\n*pylong)\n' Part of the *note Stable ABI: 2ac.'\n\nReturn a C *note Pyssizet: 88d. representation of 'pylong'.\n'pylong' must be an instance of *note PyLongObject: 2ea.\n\nRaise *note OverflowError: 68d. if the value of 'pylong' is out of\nrange for a *note Pyssizet: 88d.\n\nReturns '-1' on error.  Use *note PyErrOccurred(): 1656. to\ndisambiguate.\n\n-- C Function: unsigned long PyLongAsUnsignedLong (PyObject *pylong)\n' Part of the *note Stable ABI: 2ac.'\n\nReturn a C unsigned long representation of 'pylong'.  'pylong' must\nbe an instance of *note PyLongObject: 2ea.\n\nRaise *note OverflowError: 68d. if the value of 'pylong' is out of\nrange for a unsigned long.\n\nReturns '(unsigned long)-1' on error.  Use *note PyErrOccurred():\n1656. to disambiguate.\n\n-- C Function: sizet PyLongAsSizet (PyObject *pylong)\n' Part of the *note Stable ABI: 2ac.'\n\nReturn a C 'sizet' representation of 'pylong'.  'pylong' must be\nan instance of *note PyLongObject: 2ea.\n\nRaise *note OverflowError: 68d. if the value of 'pylong' is out of\nrange for a 'sizet'.\n\nReturns '(sizet)-1' on error.  Use *note PyErrOccurred(): 1656.\nto disambiguate.\n\n-- C Function: unsigned long long PyLongAsUnsignedLongLong (PyObject\n*pylong)\n' Part of the *note Stable ABI: 2ac.'\n\nReturn a C unsigned long long representation of 'pylong'.  'pylong'\nmust be an instance of *note PyLongObject: 2ea.\n\nRaise *note OverflowError: 68d. if the value of 'pylong' is out of\nrange for an unsigned long long.\n\nReturns '(unsigned long long)-1' on error.  Use *note\nPyErrOccurred(): 1656. to disambiguate.\n\nChanged in version 3.1: A negative 'pylong' now raises *note\nOverflowError: 68d, not *note TypeError: 28e.\n\n-- C Function: unsigned long PyLongAsUnsignedLongMask (PyObject *obj)\n' Part of the *note Stable ABI: 2ac.'  Return a C unsigned long\nrepresentation of 'obj'.  If 'obj' is not an instance of *note\nPyLongObject: 2ea, first call its *note index(): 4f1. method\n(if present) to convert it to a *note PyLongObject: 2ea.\n\nIf the value of 'obj' is out of range for an unsigned long, return\nthe reduction of that value modulo 'ULONGMAX + 1'.\n\nReturns '(unsigned long)-1' on error.  Use *note PyErrOccurred():\n1656. to disambiguate.\n\nChanged in version 3.8: Use *note index(): 4f1. if available.\n\nChanged in version 3.10: This function will no longer use *note\nint(): 4f0.\n\n-- C Function: unsigned long long PyLongAsUnsignedLongLongMask\n(PyObject *obj)\n' Part of the *note Stable ABI: 2ac.'  Return a C unsigned long\nlong representation of 'obj'.  If 'obj' is not an instance of *note\nPyLongObject: 2ea, first call its *note index(): 4f1. method\n(if present) to convert it to a *note PyLongObject: 2ea.\n\nIf the value of 'obj' is out of range for an unsigned long long,\nreturn the reduction of that value modulo 'ULLONGMAX + 1'.\n\nReturns '(unsigned long long)-1' on error.  Use *note\nPyErrOccurred(): 1656. to disambiguate.\n\nChanged in version 3.8: Use *note index(): 4f1. if available.\n\nChanged in version 3.10: This function will no longer use *note\nint(): 4f0.\n\n-- C Function: double PyLongAsDouble (PyObject *pylong)\n' Part of the *note Stable ABI: 2ac.'  Return a C double\nrepresentation of 'pylong'.  'pylong' must be an instance of *note\nPyLongObject: 2ea.\n\nRaise *note OverflowError: 68d. if the value of 'pylong' is out of\nrange for a double.\n\nReturns '-1.0' on error.  Use *note PyErrOccurred(): 1656. to\ndisambiguate.\n\n-- C Function: void *PyLongAsVoidPtr (PyObject *pylong)\n' Part of the *note Stable ABI: 2ac.'  Convert a Python integer\n'pylong' to a C void pointer.  If 'pylong' cannot be converted, an\n*note OverflowError: 68d. will be raised.  This is only assured to\nproduce a usable void pointer for values created with *note\nPyLongFromVoidPtr(): 47dc.\n\nReturns 'NULL' on error.  Use *note PyErrOccurred(): 1656. to\ndisambiguate.\n\n-- C Function: int PyUnstableLongIsCompact (const PyLongObject *op)\n\nThis is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 29f. It may change without warning in minor releases.':\nReturn 1 if 'op' is compact, 0 otherwise.\n\nThis function makes it possible for performance-critical code to\nimplement a \"fast path\" for small integers.  For compact values use\n*note PyUnstableLongCompactValue(): 2ec.; for others fall back to\na *note PyLongAs*: 47d5. function or *note calling: 2d4. *note\nint.tobytes(): 15f2.\n\nThe speedup is expected to be negligible for most users.\n\nExactly what values are considered compact is an implementation\ndetail and is subject to change.\n\n-- C Function: *note Pyssizet: 88d. PyUnstableLongCompactValue\n(const PyLongObject *op)\n\nThis is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 29f. It may change without warning in minor releases.':\nIf 'op' is compact, as determined by *note\nPyUnstableLongIsCompact(): 2eb, return its value.\n\nOtherwise, the return value is undefined.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Boolean Objects,  Next: Floating Point Objects,  Prev: Integer Objects,  Up: Numeric Objects": {
            "content": "7.8.2.2 Boolean Objects\n.......................\n",
            "subsections": []
        },
        "Booleans in Python are implemented as a subclass of integers.  There are": {
            "content": "only two booleans, *note PyFalse: 49c8. and *note PyTrue: 49c9.  As\nsuch, the normal creation and deletion functions don't apply to\nbooleans.  The following macros are available, however.\n\n-- C Variable: *note PyTypeObject: 8da. PyBoolType\n' Part of the *note Stable ABI: 2ac.'  This instance of *note\nPyTypeObject: 8da. represents the Python boolean type; it is the\nsame object as *note bool: 17d. in the Python layer.\n\n-- C Function: int PyBoolCheck (PyObject *o)\n\nReturn true if 'o' is of type *note PyBoolType: 4751.  This\nfunction always succeeds.\n\n-- C Variable: *note PyObject: 6b1. *PyFalse\n\nThe Python 'False' object.  This object has no methods and is\nimmortal(1).\n\nChanged in version 3.12: *note PyFalse: 49c8. is immortal.\n\n-- C Variable: *note PyObject: 6b1. *PyTrue\n\nThe Python 'True' object.  This object has no methods and is\nimmortal(2).\n\nChanged in version 3.12: *note PyTrue: 49c9. is immortal.\n\n-- C Macro: PyRETURNFALSE\n\nReturn *note PyFalse: 49c8. from a function.\n\n-- C Macro: PyRETURNTRUE\n\nReturn *note PyTrue: 49c9. from a function.\n\n-- C Function: *note PyObject: 6b1. *PyBoolFromLong (long v)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return *note PyTrue: 49c9. or *note PyFalse: 49c8,\ndepending on the truth value of 'v'.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0683/\n\n(2) https://peps.python.org/pep-0683/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Floating Point Objects,  Next: Complex Number Objects,  Prev: Boolean Objects,  Up: Numeric Objects": {
            "content": "7.8.2.3 Floating Point Objects\n..............................\n\n-- C Type: type PyFloatObject\n\nThis subtype of *note PyObject: 6b1. represents a Python floating\npoint object.\n\n-- C Variable: *note PyTypeObject: 8da. PyFloatType\n' Part of the *note Stable ABI: 2ac.'  This instance of *note\nPyTypeObject: 8da. represents the Python floating point type.  This\nis the same object as *note float: 4b7. in the Python layer.\n\n-- C Function: int PyFloatCheck (PyObject *p)\n\nReturn true if its argument is a *note PyFloatObject: 49ce. or a\nsubtype of *note PyFloatObject: 49ce.  This function always\nsucceeds.\n\n-- C Function: int PyFloatCheckExact (PyObject *p)\n\nReturn true if its argument is a *note PyFloatObject: 49ce, but not\na subtype of *note PyFloatObject: 49ce.  This function always\nsucceeds.\n\n-- C Function: *note PyObject: 6b1. *PyFloatFromString (PyObject *str)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Create a *note PyFloatObject: 49ce. object based on the\nstring value in 'str', or 'NULL' on failure.\n\n-- C Function: *note PyObject: 6b1. *PyFloatFromDouble (double v)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Create a *note PyFloatObject: 49ce. object from 'v', or\n'NULL' on failure.\n\n-- C Function: double PyFloatAsDouble (PyObject *pyfloat)\n' Part of the *note Stable ABI: 2ac.'  Return a C double\nrepresentation of the contents of 'pyfloat'.  If 'pyfloat' is not a\nPython floating point object but has a *note float(): 7f0.\nmethod, this method will first be called to convert 'pyfloat' into\na float.  If 'float()' is not defined then it falls back to\n*note index(): 4f1.  This method returns '-1.0' upon failure,\nso one should call *note PyErrOccurred(): 1656. to check for\nerrors.\n\nChanged in version 3.8: Use *note index(): 4f1. if available.\n\n-- C Function: double PyFloatASDOUBLE (PyObject *pyfloat)\n\nReturn a C double representation of the contents of 'pyfloat', but\nwithout error checking.\n\n-- C Function: *note PyObject: 6b1. *PyFloatGetInfo (void)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a structseq instance which contains information about\nthe precision, minimum and maximum values of a float.  It's a thin\nwrapper around the header file 'float.h'.\n\n-- C Function: double PyFloatGetMax ()\n' Part of the *note Stable ABI: 2ac.'  Return the maximum\nrepresentable finite float 'DBLMAX' as C double.\n\n-- C Function: double PyFloatGetMin ()\n' Part of the *note Stable ABI: 2ac.'  Return the minimum\nnormalized positive float 'DBLMIN' as C double.\n\n* Menu:\n\n* Pack and Unpack functions::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Pack and Unpack functions,  Up: Floating Point Objects": {
            "content": "7.8.2.4 Pack and Unpack functions\n.................................\n",
            "subsections": []
        },
        "The pack and unpack functions provide an efficient platform-independent": {
            "content": "way to store floating-point values as byte strings.  The Pack routines\nproduce a bytes string from a C double, and the Unpack routines produce\na C double from such a bytes string.  The suffix (2, 4 or 8) specifies\nthe number of bytes in the bytes string.\n",
            "subsections": []
        },
        "On platforms that appear to use IEEE 754 formats these functions work by": {
            "content": "copying bits.  On other platforms, the 2-byte format is identical to the\nIEEE 754 binary16 half-precision format, the 4-byte format (32-bit) is\nidentical to the IEEE 754 binary32 single precision format, and the\n8-byte format to the IEEE 754 binary64 double precision format, although\nthe packing of INFs and NaNs (if such things exist on the platform)\nisn't handled correctly, and attempting to unpack a bytes string\ncontaining an IEEE INF or NaN will raise an exception.\n",
            "subsections": []
        },
        "On non-IEEE platforms with more precision, or larger dynamic range, than": {
            "content": "IEEE 754 supports, not all values can be packed; on non-IEEE platforms\nwith less precision, or smaller dynamic range, not all values can be\nunpacked.  What happens in such cases is partly accidental (alas).\n\nNew in version 3.11.\n\n* Menu:\n\n* Pack functions::\n* Unpack functions::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Pack functions,  Next: Unpack functions,  Up: Pack and Unpack functions": {
            "content": "7.8.2.5 Pack functions\n......................\n",
            "subsections": []
        },
        "The pack routines write 2, 4 or 8 bytes, starting at 'p'.  'le' is an": {
            "content": "int argument, non-zero if you want the bytes string in little-endian\nformat (exponent last, at 'p+1', 'p+3', or 'p+6' 'p+7'), zero if you\nwant big-endian format (exponent first, at 'p').  The 'PYBIGENDIAN'\nconstant can be used to use the native endian: it is equal to '1' on big\nendian processor, or '0' on little endian processor.\n",
            "subsections": []
        },
        "Return value: '0' if all is OK, '-1' if error (and an exception is set,": {
            "content": "most likely *note OverflowError: 68d.).\n\nThere are two problems on non-IEEE platforms:\n\n* What this does is undefined if 'x' is a NaN or infinity.\n\n* '-0.0' and '+0.0' produce the same bytes string.\n\n-- C Function: int PyFloatPack2 (double x, unsigned char *p, int le)\n\nPack a C double as the IEEE 754 binary16 half-precision format.\n\n-- C Function: int PyFloatPack4 (double x, unsigned char *p, int le)\n\nPack a C double as the IEEE 754 binary32 single precision format.\n\n-- C Function: int PyFloatPack8 (double x, unsigned char *p, int le)\n\nPack a C double as the IEEE 754 binary64 double precision format.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Unpack functions,  Prev: Pack functions,  Up: Pack and Unpack functions": {
            "content": "7.8.2.6 Unpack functions\n........................\n",
            "subsections": []
        },
        "The unpack routines read 2, 4 or 8 bytes, starting at 'p'.  'le' is an": {
            "content": "int argument, non-zero if the bytes string is in little-endian format\n(exponent last, at 'p+1', 'p+3' or 'p+6' and 'p+7'), zero if big-endian\n(exponent first, at 'p').  The 'PYBIGENDIAN' constant can be used to\nuse the native endian: it is equal to '1' on big endian processor, or\n'0' on little endian processor.\n\nReturn value: The unpacked double.  On error, this is '-1.0' and *note",
            "subsections": []
        },
        "PyErrOccurred(): 1656. is true (and an exception is set, most likely": {
            "content": "*note OverflowError: 68d.).\n",
            "subsections": []
        },
        "Note that on a non-IEEE platform this will refuse to unpack a bytes": {
            "content": "string that represents a NaN or infinity.\n\n-- C Function: double PyFloatUnpack2 (const unsigned char *p, int le)\n\nUnpack the IEEE 754 binary16 half-precision format as a C double.\n\n-- C Function: double PyFloatUnpack4 (const unsigned char *p, int le)\n\nUnpack the IEEE 754 binary32 single precision format as a C double.\n\n-- C Function: double PyFloatUnpack8 (const unsigned char *p, int le)\n\nUnpack the IEEE 754 binary64 double precision format as a C double.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Complex Number Objects,  Prev: Floating Point Objects,  Up: Numeric Objects": {
            "content": "7.8.2.7 Complex Number Objects\n..............................\n",
            "subsections": []
        },
        "Python's complex number objects are implemented as two distinct types": {
            "content": "when viewed from the C API: one is the Python object exposed to Python\nprograms, and the other is a C structure which represents the actual\ncomplex number value.  The API provides functions for working with both.\n\n* Menu:\n\n* Complex Numbers as C Structures::\n* Complex Numbers as Python Objects::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Complex Numbers as C Structures,  Next: Complex Numbers as Python Objects,  Up: Complex Number Objects": {
            "content": "7.8.2.8 Complex Numbers as C Structures\n.......................................\n",
            "subsections": []
        },
        "Note that the functions which accept these structures as parameters and": {
            "content": "return them as results do so 'by value' rather than dereferencing them\nthrough pointers.  This is consistent throughout the API.\n\n-- C Type: type Pycomplex\n\nThe C structure which corresponds to the value portion of a Python\ncomplex number object.  Most of the functions for dealing with\ncomplex number objects use structures of this type as input or\noutput values, as appropriate.  It is defined as:\n\ntypedef struct {\ndouble real;\ndouble imag;\n} Pycomplex;\n\n-- C Function: *note Pycomplex: 4921. Pycsum (Pycomplex left,\nPycomplex right)\n\nReturn the sum of two complex numbers, using the C *note\nPycomplex: 4921. representation.\n\n-- C Function: *note Pycomplex: 4921. Pycdiff (Pycomplex left,\nPycomplex right)\n\nReturn the difference between two complex numbers, using the C\n*note Pycomplex: 4921. representation.\n\n-- C Function: *note Pycomplex: 4921. Pycneg (Pycomplex num)\n\nReturn the negation of the complex number 'num', using the C *note\nPycomplex: 4921. representation.\n\n-- C Function: *note Pycomplex: 4921. Pycprod (Pycomplex left,\nPycomplex right)\n\nReturn the product of two complex numbers, using the C *note\nPycomplex: 4921. representation.\n\n-- C Function: *note Pycomplex: 4921. Pycquot (Pycomplex dividend,\nPycomplex divisor)\n\nReturn the quotient of two complex numbers, using the C *note\nPycomplex: 4921. representation.\n\nIf 'divisor' is null, this method returns zero and sets 'errno' to\n'EDOM'.\n\n-- C Function: *note Pycomplex: 4921. Pycpow (Pycomplex num,\nPycomplex exp)\n\nReturn the exponentiation of 'num' by 'exp', using the C *note\nPycomplex: 4921. representation.\n\nIf 'num' is null and 'exp' is not a positive real number, this\nmethod returns zero and sets 'errno' to 'EDOM'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Complex Numbers as Python Objects,  Prev: Complex Numbers as C Structures,  Up: Complex Number Objects": {
            "content": "7.8.2.9 Complex Numbers as Python Objects\n.........................................\n\n-- C Type: type PyComplexObject\n\nThis subtype of *note PyObject: 6b1. represents a Python complex\nnumber object.\n\n-- C Variable: *note PyTypeObject: 8da. PyComplexType\n' Part of the *note Stable ABI: 2ac.'  This instance of *note\nPyTypeObject: 8da. represents the Python complex number type.  It\nis the same object as *note complex: 3ad. in the Python layer.\n\n-- C Function: int PyComplexCheck (PyObject *p)\n\nReturn true if its argument is a *note PyComplexObject: 49e0. or a\nsubtype of *note PyComplexObject: 49e0.  This function always\nsucceeds.\n\n-- C Function: int PyComplexCheckExact (PyObject *p)\n\nReturn true if its argument is a *note PyComplexObject: 49e0, but\nnot a subtype of *note PyComplexObject: 49e0.  This function always\nsucceeds.\n\n-- C Function: *note PyObject: 6b1. *PyComplexFromCComplex (Pycomplex\nv)\n'Return value: New reference.'  Create a new Python complex number\nobject from a C *note Pycomplex: 4921. value.\n\n-- C Function: *note PyObject: 6b1. *PyComplexFromDoubles (double\nreal, double imag)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a new *note PyComplexObject: 49e0. object from 'real'\nand 'imag'.\n\n-- C Function: double PyComplexRealAsDouble (PyObject *op)\n' Part of the *note Stable ABI: 2ac.'  Return the real part of 'op'\nas a C double.\n\n-- C Function: double PyComplexImagAsDouble (PyObject *op)\n' Part of the *note Stable ABI: 2ac.'  Return the imaginary part of\n'op' as a C double.\n\n-- C Function: *note Pycomplex: 4921. PyComplexAsCComplex (PyObject\n*op)\n\nReturn the *note Pycomplex: 4921. value of the complex number\n'op'.\n\nIf 'op' is not a Python complex number object but has a *note\ncomplex(): 3ac. method, this method will first be called to\nconvert 'op' to a Python complex number object.  If 'complex()'\nis not defined then it falls back to *note float(): 7f0.  If\n'float()' is not defined then it falls back to *note\nindex(): 4f1.  Upon failure, this method returns '-1.0' as a\nreal value.\n\nChanged in version 3.8: Use *note index(): 4f1. if available.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Sequence Objects,  Next: Container Objects,  Prev: Numeric Objects,  Up: Concrete Objects Layer": {
            "content": "",
            "subsections": []
        },
        "Generic operations on sequence objects were discussed in the previous": {
            "content": "chapter; this section deals with the specific kinds of sequence objects\nthat are intrinsic to the Python language.\n\n* Menu:\n\n* Bytes Objects: Bytes Objects<2>.\n* Byte Array Objects::\n* Unicode Objects and Codecs::\n* Tuple Objects::\n* Struct Sequence Objects::\n* List Objects::\n\nFile: python3.12.info,  Node: Bytes Objects<2>,  Next: Byte Array Objects,  Up: Sequence Objects\n\n7.8.3.1 Bytes Objects\n.....................\n\nThese functions raise *note TypeError: 28e. when expecting a bytes\nparameter and called with a non-bytes parameter.\n\n-- C Type: type PyBytesObject\n\nThis subtype of *note PyObject: 6b1. represents a Python bytes\nobject.\n\n-- C Variable: *note PyTypeObject: 8da. PyBytesType\n' Part of the *note Stable ABI: 2ac.'  This instance of *note\nPyTypeObject: 8da. represents the Python bytes type; it is the same\nobject as *note bytes: 295. in the Python layer.\n\n-- C Function: int PyBytesCheck (PyObject *o)\n\nReturn true if the object 'o' is a bytes object or an instance of a\nsubtype of the bytes type.  This function always succeeds.\n\n-- C Function: int PyBytesCheckExact (PyObject *o)\n\nReturn true if the object 'o' is a bytes object, but not an\ninstance of a subtype of the bytes type.  This function always\nsucceeds.\n\n-- C Function: *note PyObject: 6b1. *PyBytesFromString (const char *v)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a new bytes object with a copy of the string 'v' as\nvalue on success, and 'NULL' on failure.  The parameter 'v' must\nnot be 'NULL'; it will not be checked.\n\n-- C Function: *note PyObject: 6b1. *PyBytesFromStringAndSize (const\nchar *v, Pyssizet len)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a new bytes object with a copy of the string 'v' as\nvalue and length 'len' on success, and 'NULL' on failure.  If 'v'\nis 'NULL', the contents of the bytes object are uninitialized.\n\n-- C Function: *note PyObject: 6b1. *PyBytesFromFormat (const char\n*format, ...)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Take a C 'printf()'-style 'format' string and a variable\nnumber of arguments, calculate the size of the resulting Python\nbytes object and return a bytes object with the values formatted\ninto it.  The variable arguments must be C types and must\ncorrespond exactly to the format characters in the 'format' string.\nThe following format characters are allowed:\n\nFormat Characters       Type                Comment\n\n---------------------------------------------------------------------------------\n\n'%%'                    'n/a'               The literal % character.\n\n\n'%c'                    int                 A single byte, represented as a C\nint.\n\n\n'%d'                    int                 Equivalent to 'printf(\"%d\")'.  (1)\n\n\n'%u'                    unsigned int        Equivalent to 'printf(\"%u\")'.  (2)\n\n\n'%ld'                   long                Equivalent to 'printf(\"%ld\")'.\n(3)\n\n\n'%lu'                   unsigned long       Equivalent to 'printf(\"%lu\")'.\n(4)\n\n\n'%zd'                   *note Pyssizet: 88d.Equivalent to 'printf(\"%zd\")'.\n(5)\n\n\n'%zu'                   sizet              Equivalent to 'printf(\"%zu\")'.\n(6)\n\n\n'%i'                    int                 Equivalent to 'printf(\"%i\")'.  (7)\n\n\n'%x'                    int                 Equivalent to 'printf(\"%x\")'.  (8)\n\n\n'%s'                    const char*         A null-terminated C character\narray.\n\n\n'%p'                    const void*         The hex representation of a C\npointer.  Mostly equivalent to\n'printf(\"%p\")' except that it is\nguaranteed to start with the\nliteral '0x' regardless of what\nthe platform's 'printf' yields.\n\n\nAn unrecognized format character causes all the rest of the format\nstring to be copied as-is to the result object, and any extra\narguments discarded.\n\n-- C Function: *note PyObject: 6b1. *PyBytesFromFormatV (const char\n*format, valist vargs)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Identical to *note PyBytesFromFormat(): 17a1. except that\nit takes exactly two arguments.\n\n-- C Function: *note PyObject: 6b1. *PyBytesFromObject (PyObject *o)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return the bytes representation of object 'o' that\nimplements the buffer protocol.\n\n-- C Function: *note Pyssizet: 88d. PyBytesSize (PyObject *o)\n' Part of the *note Stable ABI: 2ac.'  Return the length of the\nbytes in bytes object 'o'.\n\n-- C Function: *note Pyssizet: 88d. PyBytesGETSIZE (PyObject *o)\n\nSimilar to *note PyBytesSize(): 475d, but without error checking.\n\n-- C Function: char *PyBytesAsString (PyObject *o)\n' Part of the *note Stable ABI: 2ac.'  Return a pointer to the\ncontents of 'o'.  The pointer refers to the internal buffer of 'o',\nwhich consists of 'len(o) + 1' bytes.  The last byte in the buffer\nis always null, regardless of whether there are any other null\nbytes.  The data must not be modified in any way, unless the object\nwas just created using 'PyBytesFromStringAndSize(NULL, size)'.  It\nmust not be deallocated.  If 'o' is not a bytes object at all,\n*note PyBytesAsString(): 695. returns 'NULL' and raises *note\nTypeError: 28e.\n\n-- C Function: char *PyBytesASSTRING (PyObject *string)\n\nSimilar to *note PyBytesAsString(): 695, but without error\nchecking.\n\n-- C Function: int PyBytesAsStringAndSize (PyObject *obj, char\nbuffer, Pyssizet *length)\n' Part of the *note Stable ABI: 2ac.'  Return the null-terminated\ncontents of the object 'obj' through the output variables 'buffer'\nand 'length'.  Returns '0' on success.\n\nIf 'length' is 'NULL', the bytes object may not contain embedded\nnull bytes; if it does, the function returns '-1' and a *note\nValueError: 183. is raised.\n\nThe buffer refers to an internal buffer of 'obj', which includes an\nadditional null byte at the end (not counted in 'length').  The\ndata must not be modified in any way, unless the object was just\ncreated using 'PyBytesFromStringAndSize(NULL, size)'.  It must not\nbe deallocated.  If 'obj' is not a bytes object at all, *note\nPyBytesAsStringAndSize(): 4757. returns '-1' and raises *note\nTypeError: 28e.\n\nChanged in version 3.5: Previously, *note TypeError: 28e. was\nraised when embedded null bytes were encountered in the bytes\nobject.\n\n-- C Function: void PyBytesConcat (PyObject bytes, PyObject\n*newpart)\n' Part of the *note Stable ABI: 2ac.'  Create a new bytes object in\n'*bytes' containing the contents of 'newpart' appended to 'bytes';\nthe caller will own the new reference.  The reference to the old\nvalue of 'bytes' will be stolen.  If the new object cannot be\ncreated, the old reference to 'bytes' will still be discarded and\nthe value of '*bytes' will be set to 'NULL'; the appropriate\nexception will be set.\n\n-- C Function: void PyBytesConcatAndDel (PyObject bytes, PyObject\n*newpart)\n' Part of the *note Stable ABI: 2ac.'  Create a new bytes object in\n'*bytes' containing the contents of 'newpart' appended to 'bytes'.\nThis version releases the *note strong reference: 57c. to 'newpart'\n(i.e.  decrements its reference count).\n\n-- C Function: int PyBytesResize (PyObject bytes, Pyssizet\nnewsize)\n\nA way to resize a bytes object even though it is \"immutable\".  Only\nuse this to build up a brand new bytes object; don't use this if\nthe bytes may already be known in other parts of the code.  It is\nan error to call this function if the refcount on the input bytes\nobject is not one.  Pass the address of an existing bytes object as\nan lvalue (it may be written into), and the new size desired.  On\nsuccess, '*bytes' holds the resized bytes object and '0' is\nreturned; the address in '*bytes' may differ from its input value.\nIf the reallocation fails, the original bytes object at '*bytes' is\ndeallocated, '*bytes' is set to 'NULL', *note MemoryError: 13e3. is\nset, and '-1' is returned.\n\n---------- Footnotes ----------\n\n(1) For integer specifiers (d, u, ld, lu, zd, zu, i, x): the\n0-conversion flag has effect even when a precision is given.\n\n(2) For integer specifiers (d, u, ld, lu, zd, zu, i, x): the\n0-conversion flag has effect even when a precision is given.\n\n(3) For integer specifiers (d, u, ld, lu, zd, zu, i, x): the\n0-conversion flag has effect even when a precision is given.\n\n(4) For integer specifiers (d, u, ld, lu, zd, zu, i, x): the\n0-conversion flag has effect even when a precision is given.\n\n(5) For integer specifiers (d, u, ld, lu, zd, zu, i, x): the\n0-conversion flag has effect even when a precision is given.\n\n(6) For integer specifiers (d, u, ld, lu, zd, zu, i, x): the\n0-conversion flag has effect even when a precision is given.\n\n(7) For integer specifiers (d, u, ld, lu, zd, zu, i, x): the\n0-conversion flag has effect even when a precision is given.\n\n(8) For integer specifiers (d, u, ld, lu, zd, zu, i, x): the\n0-conversion flag has effect even when a precision is given.\n\nFile: python3.12.info,  Node: Byte Array Objects,  Next: Unicode Objects and Codecs,  Prev: Bytes Objects<2>,  Up: Sequence Objects\n\n7.8.3.2 Byte Array Objects\n..........................\n\n-- C Type: type PyByteArrayObject\n\nThis subtype of *note PyObject: 6b1. represents a Python bytearray\nobject.\n\n-- C Variable: *note PyTypeObject: 8da. PyByteArrayType\n' Part of the *note Stable ABI: 2ac.'  This instance of *note\nPyTypeObject: 8da. represents the Python bytearray type; it is the\nsame object as *note bytearray: 294. in the Python layer.\n\n* Menu:\n\n* Type check macros::\n* Direct API functions::\n* Macros::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Type check macros,  Next: Direct API functions,  Up: Byte Array Objects": {
            "content": "7.8.3.3 Type check macros\n.........................\n\n-- C Function: int PyByteArrayCheck (PyObject *o)\n\nReturn true if the object 'o' is a bytearray object or an instance\nof a subtype of the bytearray type.  This function always succeeds.\n\n-- C Function: int PyByteArrayCheckExact (PyObject *o)\n\nReturn true if the object 'o' is a bytearray object, but not an\ninstance of a subtype of the bytearray type.  This function always\nsucceeds.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Direct API functions,  Next: Macros,  Prev: Type check macros,  Up: Byte Array Objects": {
            "content": "7.8.3.4 Direct API functions\n............................\n\n-- C Function: *note PyObject: 6b1. *PyByteArrayFromObject (PyObject\n*o)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a new bytearray object from any object, 'o', that\nimplements the *note buffer protocol: 148.\n\n-- C Function: *note PyObject: 6b1. *PyByteArrayFromStringAndSize\n(const char *string, Pyssizet len)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Create a new bytearray object from 'string' and its length,\n'len'.  On failure, 'NULL' is returned.\n\n-- C Function: *note PyObject: 6b1. *PyByteArrayConcat (PyObject *a,\nPyObject *b)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Concat bytearrays 'a' and 'b' and return a new bytearray\nwith the result.\n\n-- C Function: *note Pyssizet: 88d. PyByteArraySize (PyObject\n*bytearray)\n' Part of the *note Stable ABI: 2ac.'  Return the size of\n'bytearray' after checking for a 'NULL' pointer.\n\n-- C Function: char *PyByteArrayAsString (PyObject *bytearray)\n' Part of the *note Stable ABI: 2ac.'  Return the contents of\n'bytearray' as a char array after checking for a 'NULL' pointer.\nThe returned array always has an extra null byte appended.\n\n-- C Function: int PyByteArrayResize (PyObject *bytearray, Pyssizet\nlen)\n' Part of the *note Stable ABI: 2ac.'  Resize the internal buffer\nof 'bytearray' to 'len'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Macros,  Prev: Direct API functions,  Up: Byte Array Objects": {
            "content": "7.8.3.5 Macros\n..............\n\nThese macros trade safety for speed and they don't check pointers.\n\n-- C Function: char *PyByteArrayASSTRING (PyObject *bytearray)\n\nSimilar to *note PyByteArrayAsString(): 4752, but without error\nchecking.\n\n-- C Function: *note Pyssizet: 88d. PyByteArrayGETSIZE (PyObject\n*bytearray)\n\nSimilar to *note PyByteArraySize(): 4755, but without error\nchecking.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Unicode Objects and Codecs,  Next: Tuple Objects,  Prev: Byte Array Objects,  Up: Sequence Objects": {
            "content": "7.8.3.6 Unicode Objects and Codecs\n..................................\n\n* Menu:\n\n* Unicode Objects::\n* Built-in Codecs::\n* Methods and Slot Functions::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Unicode Objects,  Next: Built-in Codecs,  Up: Unicode Objects and Codecs": {
            "content": "7.8.3.7 Unicode Objects\n.......................\n",
            "subsections": []
        },
        "Since the implementation of PEP 393(1) in Python 3.3, Unicode objects": {
            "content": "internally use a variety of representations, in order to allow handling\nthe complete range of Unicode characters while staying memory efficient.",
            "subsections": []
        },
        "There are special cases for strings where all code points are below 128,": {
            "content": "256, or 65536; otherwise, code points must be below 1114112 (which is\nthe full Unicode range).\n\nUTF-8 representation is created on demand and cached in the Unicode\nobject.\n\nNote: The *note PyUNICODE: 326. representation has been removed\nsince Python 3.12 with deprecated APIs.  See PEP 623(2) for more\ninformation.\n\n* Menu:\n\n* Unicode Type::\n* Unicode Character Properties::\n* Creating and accessing Unicode strings::\n* Locale Encoding::\n* File System Encoding::\n* wchart Support::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0393/\n\n(2) https://peps.python.org/pep-0623/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Unicode Type,  Next: Unicode Character Properties,  Up: Unicode Objects": {
            "content": "7.8.3.8 Unicode Type\n....................\n",
            "subsections": []
        },
        "These are the basic Unicode object types used for the Unicode": {
            "content": "implementation in Python:\n\n-- C Type: type PyUCS4\n-- C Type: type PyUCS2\n-- C Type: type PyUCS1\n' Part of the *note Stable ABI: 2ac.'  These types are typedefs for\nunsigned integer types wide enough to contain characters of 32\nbits, 16 bits and 8 bits, respectively.  When dealing with single\nUnicode characters, use *note PyUCS4: fea.\n\nNew in version 3.3.\n\n-- C Type: type PyUNICODE\n\nThis is a typedef of 'wchart', which is a 16-bit type or 32-bit\ntype depending on the platform.\n\nChanged in version 3.3: In previous versions, this was a 16-bit\ntype or a 32-bit type depending on whether you selected a \"narrow\"\nor \"wide\" Unicode version of Python at build time.\n\n-- C Type: type PyASCIIObject\n-- C Type: type PyCompactUnicodeObject\n-- C Type: type PyUnicodeObject\n\nThese subtypes of *note PyObject: 6b1. represent a Python Unicode\nobject.  In almost all cases, they shouldn't be used directly,\nsince all API functions that deal with Unicode objects take and\nreturn *note PyObject: 6b1. pointers.\n\nNew in version 3.3.\n\n-- C Variable: *note PyTypeObject: 8da. PyUnicodeType\n' Part of the *note Stable ABI: 2ac.'  This instance of *note\nPyTypeObject: 8da. represents the Python Unicode type.  It is\nexposed to Python code as 'str'.\n",
            "subsections": []
        },
        "The following APIs are C macros and static inlined functions for fast": {
            "content": "checks and access to internal read-only data of Unicode objects:\n\n-- C Function: int PyUnicodeCheck (PyObject *obj)\n\nReturn true if the object 'obj' is a Unicode object or an instance\nof a Unicode subtype.  This function always succeeds.\n\n-- C Function: int PyUnicodeCheckExact (PyObject *obj)\n\nReturn true if the object 'obj' is a Unicode object, but not an\ninstance of a subtype.  This function always succeeds.\n\n-- C Function: int PyUnicodeREADY (PyObject *unicode)\n\nReturns '0'.  This API is kept only for backward compatibility.\n\nNew in version 3.3.\n\nDeprecated since version 3.10: This API does nothing since Python\n3.12.\n\n-- C Function: *note Pyssizet: 88d. PyUnicodeGETLENGTH (PyObject\n*unicode)\n\nReturn the length of the Unicode string, in code points.  'unicode'\nhas to be a Unicode object in the \"canonical\" representation (not\nchecked).\n\nNew in version 3.3.\n\n-- C Function: *note PyUCS1: fe8. *PyUnicode1BYTEDATA (PyObject\n*unicode)\n-- C Function: *note PyUCS2: fe9. *PyUnicode2BYTEDATA (PyObject\n*unicode)\n-- C Function: *note PyUCS4: fea. *PyUnicode4BYTEDATA (PyObject\n*unicode)\n\nReturn a pointer to the canonical representation cast to UCS1, UCS2\nor UCS4 integer types for direct character access.  No checks are\nperformed if the canonical representation has the correct character\nsize; use *note PyUnicodeKIND(): ff3. to select the right\nfunction.\n\nNew in version 3.3.\n\n-- C Macro: PyUnicode1BYTEKIND\n-- C Macro: PyUnicode2BYTEKIND\n-- C Macro: PyUnicode4BYTEKIND\n\nReturn values of the *note PyUnicodeKIND(): ff3. macro.\n\nNew in version 3.3.\n\nChanged in version 3.12: 'PyUnicodeWCHARKIND' has been removed.\n\n-- C Function: int PyUnicodeKIND (PyObject *unicode)\n\nReturn one of the PyUnicode kind constants (see above) that\nindicate how many bytes per character this Unicode object uses to\nstore its data.  'unicode' has to be a Unicode object in the\n\"canonical\" representation (not checked).\n\nNew in version 3.3.\n\n-- C Function: void *PyUnicodeDATA (PyObject *unicode)\n\nReturn a void pointer to the raw Unicode buffer.  'unicode' has to\nbe a Unicode object in the \"canonical\" representation (not\nchecked).\n\nNew in version 3.3.\n\n-- C Function: void PyUnicodeWRITE (int kind, void *data, Pyssizet\nindex, PyUCS4 value)\n\nWrite into a canonical representation 'data' (as obtained with\n*note PyUnicodeDATA(): fef.).  This function performs no sanity\nchecks, and is intended for usage in loops.  The caller should\ncache the 'kind' value and 'data' pointer as obtained from other\ncalls.  'index' is the index in the string (starts at 0) and\n'value' is the new code point value which should be written to that\nlocation.\n\nNew in version 3.3.\n\n-- C Function: *note PyUCS4: fea. PyUnicodeREAD (int kind, void\n*data, Pyssizet index)\n\nRead a code point from a canonical representation 'data' (as\nobtained with *note PyUnicodeDATA(): fef.).  No checks or ready\ncalls are performed.\n\nNew in version 3.3.\n\n-- C Function: *note PyUCS4: fea. PyUnicodeREADCHAR (PyObject\n*unicode, Pyssizet index)\n\nRead a character from a Unicode object 'unicode', which must be in\nthe \"canonical\" representation.  This is less efficient than *note\nPyUnicodeREAD(): ff7. if you do multiple consecutive reads.\n\nNew in version 3.3.\n\n-- C Function: *note PyUCS4: fea. PyUnicodeMAXCHARVALUE (PyObject\n*unicode)\n\nReturn the maximum code point that is suitable for creating another\nstring based on 'unicode', which must be in the \"canonical\"\nrepresentation.  This is always an approximation but more efficient\nthan iterating over the string.\n\nNew in version 3.3.\n\n-- C Function: int PyUnicodeIsIdentifier (PyObject *unicode)\n' Part of the *note Stable ABI: 2ac.'  Return '1' if the string is\na valid identifier according to the language definition, section\n*note Identifiers and keywords: 1bb5.  Return '0' otherwise.\n\nChanged in version 3.9: The function does not call *note\nPyFatalError(): 7a7. anymore if the string is not ready.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Unicode Character Properties,  Next: Creating and accessing Unicode strings,  Prev: Unicode Type,  Up: Unicode Objects": {
            "content": "7.8.3.9 Unicode Character Properties\n....................................\n",
            "subsections": []
        },
        "Unicode provides many different character properties.  The most often": {
            "content": "needed ones are available through these macros which are mapped to C\nfunctions depending on the Python configuration.\n\n-- C Function: int PyUNICODEISSPACE (PyUCS4 ch)\n\nReturn '1' or '0' depending on whether 'ch' is a whitespace\ncharacter.\n\n-- C Function: int PyUNICODEISLOWER (PyUCS4 ch)\n\nReturn '1' or '0' depending on whether 'ch' is a lowercase\ncharacter.\n\n-- C Function: int PyUNICODEISUPPER (PyUCS4 ch)\n\nReturn '1' or '0' depending on whether 'ch' is an uppercase\ncharacter.\n\n-- C Function: int PyUNICODEISTITLE (PyUCS4 ch)\n\nReturn '1' or '0' depending on whether 'ch' is a titlecase\ncharacter.\n\n-- C Function: int PyUNICODEISLINEBREAK (PyUCS4 ch)\n\nReturn '1' or '0' depending on whether 'ch' is a linebreak\ncharacter.\n\n-- C Function: int PyUNICODEISDECIMAL (PyUCS4 ch)\n\nReturn '1' or '0' depending on whether 'ch' is a decimal character.\n\n-- C Function: int PyUNICODEISDIGIT (PyUCS4 ch)\n\nReturn '1' or '0' depending on whether 'ch' is a digit character.\n\n-- C Function: int PyUNICODEISNUMERIC (PyUCS4 ch)\n\nReturn '1' or '0' depending on whether 'ch' is a numeric character.\n\n-- C Function: int PyUNICODEISALPHA (PyUCS4 ch)\n\nReturn '1' or '0' depending on whether 'ch' is an alphabetic\ncharacter.\n\n-- C Function: int PyUNICODEISALNUM (PyUCS4 ch)\n\nReturn '1' or '0' depending on whether 'ch' is an alphanumeric\ncharacter.\n\n-- C Function: int PyUNICODEISPRINTABLE (PyUCS4 ch)\n\nReturn '1' or '0' depending on whether 'ch' is a printable\ncharacter.  Nonprintable characters are those characters defined in\nthe Unicode character database as \"Other\" or \"Separator\", excepting\nthe ASCII space (0x20) which is considered printable.  (Note that\nprintable characters in this context are those which should not be\nescaped when *note repr(): 5f0. is invoked on a string.  It has no\nbearing on the handling of strings written to *note sys.stdout:\n90c. or *note sys.stderr: 757.)\n\nThese APIs can be used for fast direct character conversions:\n\n-- C Function: *note PyUCS4: fea. PyUNICODETOLOWER (PyUCS4 ch)\n\nReturn the character 'ch' converted to lower case.\n\nDeprecated since version 3.3: This function uses simple case\nmappings.\n\n-- C Function: *note PyUCS4: fea. PyUNICODETOUPPER (PyUCS4 ch)\n\nReturn the character 'ch' converted to upper case.\n\nDeprecated since version 3.3: This function uses simple case\nmappings.\n\n-- C Function: *note PyUCS4: fea. PyUNICODETOTITLE (PyUCS4 ch)\n\nReturn the character 'ch' converted to title case.\n\nDeprecated since version 3.3: This function uses simple case\nmappings.\n\n-- C Function: int PyUNICODETODECIMAL (PyUCS4 ch)\n\nReturn the character 'ch' converted to a decimal positive integer.\nReturn '-1' if this is not possible.  This function does not raise\nexceptions.\n\n-- C Function: int PyUNICODETODIGIT (PyUCS4 ch)\n\nReturn the character 'ch' converted to a single digit integer.\nReturn '-1' if this is not possible.  This function does not raise\nexceptions.\n\n-- C Function: double PyUNICODETONUMERIC (PyUCS4 ch)\n\nReturn the character 'ch' converted to a double.  Return '-1.0' if\nthis is not possible.  This function does not raise exceptions.\n\nThese APIs can be used to work with surrogates:\n\n-- C Function: int PyUNICODEISSURROGATE (PyUCS4 ch)\n\nCheck if 'ch' is a surrogate ('0xD800 <= ch <= 0xDFFF').\n\n-- C Function: int PyUNICODEISHIGHSURROGATE (PyUCS4 ch)\n\nCheck if 'ch' is a high surrogate ('0xD800 <= ch <= 0xDBFF').\n\n-- C Function: int PyUNICODEISLOWSURROGATE (PyUCS4 ch)\n\nCheck if 'ch' is a low surrogate ('0xDC00 <= ch <= 0xDFFF').\n\n-- C Function: *note PyUCS4: fea. PyUNICODEJOINSURROGATES (PyUCS4\nhigh, PyUCS4 low)\n\nJoin two surrogate characters and return a single *note PyUCS4:\nfea. value.  'high' and 'low' are respectively the leading and\ntrailing surrogates in a surrogate pair.  'high' must be in the\nrange [0xD800; 0xDBFF] and 'low' must be in the range [0xDC00;\n0xDFFF].\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Creating and accessing Unicode strings,  Next: Locale Encoding,  Prev: Unicode Character Properties,  Up: Unicode Objects": {
            "content": "7.8.3.10 Creating and accessing Unicode strings\n...............................................\n",
            "subsections": []
        },
        "To create Unicode objects and access their basic sequence properties,": {
            "content": "use these APIs:\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeNew (Pyssizet size,\nPyUCS4 maxchar)\n'Return value: New reference.'  Create a new Unicode object.\n'maxchar' should be the true maximum code point to be placed in the\nstring.  As an approximation, it can be rounded up to the nearest\nvalue in the sequence 127, 255, 65535, 1114111.\n\nThis is the recommended way to allocate a new Unicode object.\nObjects created using this function are not resizable.\n\nNew in version 3.3.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeFromKindAndData (int\nkind, const void *buffer, Pyssizet size)\n'Return value: New reference.'  Create a new Unicode object with\nthe given 'kind' (possible values are *note PyUnicode1BYTEKIND:\nff4. etc., as returned by *note PyUnicodeKIND(): ff3.).  The\n'buffer' must point to an array of 'size' units of 1, 2 or 4 bytes\nper character, as given by the kind.\n\nIf necessary, the input 'buffer' is copied and transformed into the\ncanonical representation.  For example, if the 'buffer' is a UCS4\nstring (*note PyUnicode4BYTEKIND: ff6.) and it consists only of\ncodepoints in the UCS1 range, it will be transformed into UCS1\n(*note PyUnicode1BYTEKIND: ff4.).\n\nNew in version 3.3.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeFromStringAndSize (const\nchar *str, Pyssizet size)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Create a Unicode object from the char buffer 'str'.  The\nbytes will be interpreted as being UTF-8 encoded.  The buffer is\ncopied into the new object.  The return value might be a shared\nobject, i.e.  modification of the data is not allowed.\n\nThis function raises *note SystemError: 2d7. when:\n\n* 'size' < 0,\n\n* 'str' is 'NULL' and 'size' > 0\n\nChanged in version 3.12: 'str' == 'NULL' with 'size' > 0 is not\nallowed anymore.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeFromString (const char\n*str)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Create a Unicode object from a UTF-8 encoded null-terminated\nchar buffer 'str'.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeFromFormat (const char\n*format, ...)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Take a C 'printf()'-style 'format' string and a variable\nnumber of arguments, calculate the size of the resulting Python\nUnicode string and return a string with the values formatted into\nit.  The variable arguments must be C types and must correspond\nexactly to the format characters in the 'format' ASCII-encoded\nstring.\n\nA conversion specifier contains two or more characters and has the\nfollowing components, which must occur in this order:\n\n1. The ''%'' character, which marks the start of the specifier.\n\n2. Conversion flags (optional), which affect the result of some\nconversion types.\n\n3. Minimum field width (optional).  If specified as an ''*''\n(asterisk), the actual width is given in the next argument,\nwhich must be of type int, and the object to convert comes\nafter the minimum field width and optional precision.\n\n4. Precision (optional), given as a ''.'' (dot) followed by the\nprecision.  If specified as ''*'' (an asterisk), the actual\nprecision is given in the next argument, which must be of type\nint, and the value to convert comes after the precision.\n\n5. Length modifier (optional).\n\n6. Conversion type.\n\nThe conversion flag characters are:\n\nFlag        Meaning\n\n------------------------------------------------------------------------------\n\n'0'         The conversion will be zero padded for numeric values.\n\n\n'-'         The converted value is left adjusted (overrides the '0' flag if\nboth are given).\n\n\nThe length modifiers for following integer conversions ('d', 'i',\n'o', 'u', 'x', or 'X') specify the type of the argument (int by\ndefault):\n\nModifier       Types\n\n-------------------------------------------------------------------------\n\n'l'            long or unsigned long\n\n\n'll'           long long or unsigned long long\n\n\n'j'            'intmaxt' or 'uintmaxt'\n\n\n'z'            'sizet' or 'ssizet'\n\n\n't'            'ptrdifft'\n\n\nThe length modifier 'l' for following conversions 's' or 'V'\nspecify that the type of the argument is const wchart*.\n\nThe conversion specifiers are:\n\nConversion Specifier                  Type                                  Comment\n\n------------------------------------------------------------------------------------------------------------------\n\n'%'                                   'n/a'                                 The literal '%' character.\n\n\n'd', 'i'                              Specified by the length modifier      The decimal representation of a\nsigned C integer.\n\n\n'u'                                   Specified by the length modifier      The decimal representation of an\nunsigned C integer.\n\n\n'o'                                   Specified by the length modifier      The octal representation of an\nunsigned C integer.\n\n\n'x'                                   Specified by the length modifier      The hexadecimal representation of\nan unsigned C integer (lowercase).\n\n\n'X'                                   Specified by the length modifier      The hexadecimal representation of\nan unsigned C integer (uppercase).\n\n\n'c'                                   int                                   A single character.\n\n\n's'                                   const char* or const wchart*         A null-terminated C character\narray.\n\n\n'p'                                   const void*                           The hex representation of a C\npointer.  Mostly equivalent to\n'printf(\"%p\")' except that it is\nguaranteed to start with the\nliteral '0x' regardless of what the\nplatform's 'printf' yields.\n\n\n'A'                                   *note PyObject: 6b1.*                 The result of calling\n*note ascii(): 123b.\n\n\n'U'                                   *note PyObject: 6b1.*                 A Unicode object.\n\n\n'V'                                   *note PyObject: 6b1.*, const char*    A Unicode object (which may be\nor const wchart*                     'NULL') and a null-terminated C\ncharacter array as a second\nparameter (which will be used, if\nthe first parameter is 'NULL').\n\n\n'S'                                   *note PyObject: 6b1.*                 The result of calling\n*note PyObjectStr(): ea7.\n\n\n'R'                                   *note PyObject: 6b1.*                 The result of calling\n*note PyObjectRepr(): ea6.\n\n\nNote: The width formatter unit is number of characters rather\nthan bytes.  The precision formatter unit is number of bytes\nor 'wchart' items (if the length modifier 'l' is used) for\n'\"%s\"' and '\"%V\"' (if the 'PyObject*' argument is 'NULL'), and\na number of characters for '\"%A\"', '\"%U\"', '\"%S\"', '\"%R\"' and\n'\"%V\"' (if the 'PyObject*' argument is not 'NULL').\n\nNote: Unlike to C 'printf()' the '0' flag has effect even when\na precision is given for integer conversions ('d', 'i', 'u',\n'o', 'x', or 'X').\n\nChanged in version 3.2: Support for '\"%lld\"' and '\"%llu\"' added.\n\nChanged in version 3.3: Support for '\"%li\"', '\"%lli\"' and '\"%zi\"'\nadded.\n\nChanged in version 3.4: Support width and precision formatter for\n'\"%s\"', '\"%A\"', '\"%U\"', '\"%V\"', '\"%S\"', '\"%R\"' added.\n\nChanged in version 3.12: Support for conversion specifiers 'o' and\n'X'.  Support for length modifiers 'j' and 't'.  Length modifiers\nare now applied to all integer conversions.  Length modifier 'l' is\nnow applied to conversion specifiers 's' and 'V'.  Support for\nvariable width and precision '*'.  Support for flag '-'.\n\nAn unrecognized format character now sets a *note SystemError: 2d7.\nIn previous versions it caused all the rest of the format string to\nbe copied as-is to the result string, and any extra arguments\ndiscarded.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeFromFormatV (const char\n*format, valist vargs)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Identical to *note PyUnicodeFromFormat(): 2d5. except that\nit takes exactly two arguments.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeFromObject (PyObject\n*obj)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Copy an instance of a Unicode subtype to a new true Unicode\nobject if necessary.  If 'obj' is already a true Unicode object\n(not a subtype), return a new *note strong reference: 57c. to the\nobject.\n\nObjects other than Unicode or its subtypes will cause a *note\nTypeError: 28e.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeFromEncodedObject\n(PyObject *obj, const char *encoding, const char *errors)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Decode an encoded object 'obj' to a Unicode object.\n\n*note bytes: 295, *note bytearray: 294. and other *note bytes-like\nobjects: b82. are decoded according to the given 'encoding' and\nusing the error handling defined by 'errors'.  Both can be 'NULL'\nto have the interface use the default values (see *note Built-in\nCodecs: 4a13. for details).\n\nAll other objects, including Unicode objects, cause a *note\nTypeError: 28e. to be set.\n\nThe API returns 'NULL' if there was an error.  The caller is\nresponsible for decref'ing the returned objects.\n\n-- C Function: *note Pyssizet: 88d. PyUnicodeGetLength (PyObject\n*unicode)\n' Part of the *note Stable ABI: 2ac. since version 3.7.'  Return\nthe length of the Unicode object, in code points.\n\nNew in version 3.3.\n\n-- C Function: *note Pyssizet: 88d. PyUnicodeCopyCharacters\n(PyObject *to, Pyssizet tostart, PyObject *from, Pyssizet\nfromstart, Pyssizet howmany)\n\nCopy characters from one Unicode object into another.  This\nfunction performs character conversion when necessary and falls\nback to 'memcpy()' if possible.  Returns '-1' and sets an exception\non error, otherwise returns the number of copied characters.\n\nNew in version 3.3.\n\n-- C Function: *note Pyssizet: 88d. PyUnicodeFill (PyObject\n*unicode, Pyssizet start, Pyssizet length, PyUCS4\nfillchar)\n\nFill a string with a character: write 'fillchar' into\n'unicode[start:start+length]'.\n\nFail if 'fillchar' is bigger than the string maximum character, or\nif the string has more than 1 reference.\n\nReturn the number of written character, or return '-1' and raise an\nexception on error.\n\nNew in version 3.3.\n\n-- C Function: int PyUnicodeWriteChar (PyObject *unicode, Pyssizet\nindex, PyUCS4 character)\n' Part of the *note Stable ABI: 2ac. since version 3.7.'  Write a\ncharacter to a string.  The string must have been created through\n*note PyUnicodeNew(): 6c1.  Since Unicode strings are supposed to\nbe immutable, the string must not be shared, or have been hashed\nyet.\n\nThis function checks that 'unicode' is a Unicode object, that the\nindex is not out of bounds, and that the object can be modified\nsafely (i.e.  that it its reference count is one).\n\nNew in version 3.3.\n\n-- C Function: *note PyUCS4: fea. PyUnicodeReadChar (PyObject\n*unicode, Pyssizet index)\n' Part of the *note Stable ABI: 2ac. since version 3.7.'  Read a\ncharacter from a string.  This function checks that 'unicode' is a\nUnicode object and the index is not out of bounds, in contrast to\n*note PyUnicodeREADCHAR(): ff8, which performs no error checking.\n\nNew in version 3.3.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeSubstring (PyObject\n*unicode, Pyssizet start, Pyssizet end)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\nsince version 3.7.'  Return a substring of 'unicode', from\ncharacter index 'start' (included) to character index 'end'\n(excluded).  Negative indices are not supported.\n\nNew in version 3.3.\n\n-- C Function: *note PyUCS4: fea. *PyUnicodeAsUCS4 (PyObject\n*unicode, PyUCS4 *buffer, Pyssizet buflen, int copynull)\n' Part of the *note Stable ABI: 2ac. since version 3.7.'  Copy the\nstring 'unicode' into a UCS4 buffer, including a null character, if\n'copynull' is set.  Returns 'NULL' and sets an exception on error\n(in particular, a *note SystemError: 2d7. if 'buflen' is smaller\nthan the length of 'unicode').  'buffer' is returned on success.\n\nNew in version 3.3.\n\n-- C Function: *note PyUCS4: fea. *PyUnicodeAsUCS4Copy (PyObject\n*unicode)\n' Part of the *note Stable ABI: 2ac. since version 3.7.'  Copy the\nstring 'unicode' into a new UCS4 buffer that is allocated using\n*note PyMemMalloc(): ab1.  If this fails, 'NULL' is returned with\na *note MemoryError: 13e3. set.  The returned buffer always has an\nextra null code point appended.\n\nNew in version 3.3.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Locale Encoding,  Next: File System Encoding,  Prev: Creating and accessing Unicode strings,  Up: Unicode Objects": {
            "content": "7.8.3.11 Locale Encoding\n........................\n",
            "subsections": []
        },
        "The current locale encoding can be used to decode text from the": {
            "content": "operating system.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeDecodeLocaleAndSize\n(const char *str, Pyssizet length, const char *errors)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\nsince version 3.7.'  Decode a string from UTF-8 on Android and\nVxWorks, or from the current locale encoding on other platforms.\nThe supported error handlers are '\"strict\"' and '\"surrogateescape\"'\n( PEP 383(1)).  The decoder uses '\"strict\"' error handler if\n'errors' is 'NULL'.  'str' must end with a null character but\ncannot contain embedded null characters.\n\nUse *note PyUnicodeDecodeFSDefaultAndSize(): 487f. to decode a\nstring from the *note filesystem encoding and error handler: 291.\n\nThis function ignores the *note Python UTF-8 Mode: 420.\n\nSee also\n........\n\nThe *note PyDecodeLocale(): a0b. function.\n\nNew in version 3.3.\n\nChanged in version 3.7: The function now also uses the current\nlocale encoding for the 'surrogateescape' error handler, except on\nAndroid.  Previously, *note PyDecodeLocale(): a0b. was used for\nthe 'surrogateescape', and the current locale encoding was used for\n'strict'.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeDecodeLocale (const char\n*str, const char *errors)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\nsince version 3.7.'  Similar to *note\nPyUnicodeDecodeLocaleAndSize(): a0d, but compute the string length\nusing 'strlen()'.\n\nNew in version 3.3.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeEncodeLocale (PyObject\n*unicode, const char *errors)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\nsince version 3.7.'  Encode a Unicode object to UTF-8 on Android\nand VxWorks, or to the current locale encoding on other platforms.\nThe supported error handlers are '\"strict\"' and '\"surrogateescape\"'\n( PEP 383(2)).  The encoder uses '\"strict\"' error handler if\n'errors' is 'NULL'.  Return a *note bytes: 295. object.  'unicode'\ncannot contain embedded null characters.\n\nUse *note PyUnicodeEncodeFSDefault(): 17d1. to encode a string to\nthe *note filesystem encoding and error handler: 291.\n\nThis function ignores the *note Python UTF-8 Mode: 420.\n\nSee also\n........\n\nThe *note PyEncodeLocale(): a0c. function.\n\nNew in version 3.3.\n\nChanged in version 3.7: The function now also uses the current\nlocale encoding for the 'surrogateescape' error handler, except on\nAndroid.  Previously, *note PyEncodeLocale(): a0c. was used for\nthe 'surrogateescape', and the current locale encoding was used for\n'strict'.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0383/\n\n(2) https://peps.python.org/pep-0383/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: File System Encoding,  Next: wchart Support,  Prev: Locale Encoding,  Up: Unicode Objects": {
            "content": "7.8.3.12 File System Encoding\n.............................\n\nFunctions encoding to and decoding from the *note filesystem encoding\nand error handler: 291. ( PEP 383(1) and PEP 529(2)).\n\nTo encode file names to *note bytes: 295. during argument parsing, the\n'\"O&\"' converter should be used, passing *note PyUnicodeFSConverter():\nb6c. as the conversion function:\n\n-- C Function: int PyUnicodeFSConverter (PyObject *obj, void *result)\n' Part of the *note Stable ABI: 2ac.'  ParseTuple converter: encode\n*note str: 157. objects - obtained directly or through the *note\nos.PathLike: a9a. interface - to *note bytes: 295. using *note\nPyUnicodeEncodeFSDefault(): 17d1.; *note bytes: 295. objects are\noutput as-is.  'result' must be a *note PyBytesObject: 582.* which\nmust be released when it is no longer used.\n\nNew in version 3.1.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\nTo decode file names to *note str: 157. during argument parsing, the\n'\"O&\"' converter should be used, passing *note PyUnicodeFSDecoder():\n2d9. as the conversion function:\n\n-- C Function: int PyUnicodeFSDecoder (PyObject *obj, void *result)\n' Part of the *note Stable ABI: 2ac.'  ParseTuple converter: decode\n*note bytes: 295. objects - obtained either directly or indirectly\nthrough the *note os.PathLike: a9a. interface - to *note str: 157.\nusing *note PyUnicodeDecodeFSDefaultAndSize(): 487f.; *note str:\n157. objects are output as-is.  'result' must be a *note\nPyUnicodeObject: 584.* which must be released when it is no longer\nused.\n\nNew in version 3.2.\n\nChanged in version 3.6: Accepts a *note path-like object: 957.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeDecodeFSDefaultAndSize\n(const char *str, Pyssizet size)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Decode a string from the *note filesystem encoding and error\nhandler: 291.\n\nIf you need to decode a string from the current locale encoding,\nuse *note PyUnicodeDecodeLocaleAndSize(): a0d.\n\nSee also\n........\n\nThe *note PyDecodeLocale(): a0b. function.\n\nChanged in version 3.6: The *note filesystem error handler: 291. is\nnow used.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeDecodeFSDefault (const\nchar *str)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Decode a null-terminated string from the *note filesystem\nencoding and error handler: 291.\n\nIf the string length is known, use *note\nPyUnicodeDecodeFSDefaultAndSize(): 487f.\n\nChanged in version 3.6: The *note filesystem error handler: 291. is\nnow used.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeEncodeFSDefault\n(PyObject *unicode)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Encode a Unicode object to the *note filesystem encoding and\nerror handler: 291, and return *note bytes: 295.  Note that the\nresulting *note bytes: 295. object can contain null bytes.\n\nIf you need to encode a string to the current locale encoding, use\n*note PyUnicodeEncodeLocale(): a0e.\n\nSee also\n........\n\nThe *note PyEncodeLocale(): a0c. function.\n\nNew in version 3.2.\n\nChanged in version 3.6: The *note filesystem error handler: 291. is\nnow used.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0383/\n\n(2) https://peps.python.org/pep-0529/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: wchart Support,  Prev: File System Encoding,  Up: Unicode Objects": {
            "content": "7.8.3.13 wchart Support\n........................\n\n'wchart' support for platforms which support it:\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeFromWideChar (const\nwchart *wstr, Pyssizet size)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Create a Unicode object from the 'wchart' buffer 'wstr' of\nthe given 'size'.  Passing '-1' as the 'size' indicates that the\nfunction must itself compute the length, using 'wcslen()'.  Return\n'NULL' on failure.\n\n-- C Function: *note Pyssizet: 88d. PyUnicodeAsWideChar (PyObject\n*unicode, wchart *wstr, Pyssizet size)\n' Part of the *note Stable ABI: 2ac.'  Copy the Unicode object\ncontents into the 'wchart' buffer 'wstr'.  At most 'size'\n'wchart' characters are copied (excluding a possibly trailing null\ntermination character).  Return the number of 'wchart' characters\ncopied or '-1' in case of an error.\n\nWhen 'wstr' is 'NULL', instead return the 'size' that would be\nrequired to store all of 'unicode' including a terminating null.\n\nNote that the resulting wchart* string may or may not be\nnull-terminated.  It is the responsibility of the caller to make\nsure that the wchart* string is null-terminated in case this is\nrequired by the application.  Also, note that the wchart* string\nmight contain null characters, which would cause the string to be\ntruncated when used with most C functions.\n\n-- C Function: wchart *PyUnicodeAsWideCharString (PyObject *unicode,\nPyssizet *size)\n' Part of the *note Stable ABI: 2ac. since version 3.7.'  Convert\nthe Unicode object to a wide character string.  The output string\nalways ends with a null character.  If 'size' is not 'NULL', write\nthe number of wide characters (excluding the trailing null\ntermination character) into '*size'.  Note that the resulting\n'wchart' string might contain null characters, which would cause\nthe string to be truncated when used with most C functions.  If\n'size' is 'NULL' and the wchart* string contains null characters a\n*note ValueError: 183. is raised.\n\nReturns a buffer allocated by *note PyMemNew: 137f. (use *note\nPyMemFree(): 129a. to free it) on success.  On error, returns\n'NULL' and '*size' is undefined.  Raises a *note MemoryError: 13e3.\nif memory allocation is failed.\n\nNew in version 3.2.\n\nChanged in version 3.7: Raises a *note ValueError: 183. if 'size'\nis 'NULL' and the wchart* string contains null characters.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Built-in Codecs,  Next: Methods and Slot Functions,  Prev: Unicode Objects,  Up: Unicode Objects and Codecs": {
            "content": "7.8.3.14 Built-in Codecs\n........................\n",
            "subsections": []
        },
        "Python provides a set of built-in codecs which are written in C for": {
            "content": "speed.  All of these codecs are directly usable via the following\nfunctions.\n",
            "subsections": []
        },
        "Many of the following APIs take two arguments encoding and errors, and": {
            "content": "they have the same semantics as the ones of the built-in *note str():\n157. string object constructor.\n",
            "subsections": []
        },
        "Setting encoding to 'NULL' causes the default encoding to be used which": {
            "content": "is UTF-8.  The file system calls should use *note",
            "subsections": []
        },
        "PyUnicodeFSConverter(): b6c. for encoding file names.  This uses the": {
            "content": "*note filesystem encoding and error handler: 291. internally.\n",
            "subsections": []
        },
        "Error handling is set by errors which may also be set to 'NULL' meaning": {
            "content": "to use the default handling defined for the codec.  Default error\nhandling for all built-in codecs is \"strict\" (*note ValueError: 183. is\nraised).\n",
            "subsections": []
        },
        "The codecs all use a similar interface.  Only deviations from the": {
            "content": "following generic ones are documented for simplicity.\n\n* Menu:\n\n* Generic Codecs::\n* UTF-8 Codecs::\n* UTF-32 Codecs::\n* UTF-16 Codecs::\n* UTF-7 Codecs::\n* Unicode-Escape Codecs::\n* Raw-Unicode-Escape Codecs::\n* Latin-1 Codecs::\n* ASCII Codecs::\n* Character Map Codecs::\n* MBCS codecs for Windows::\n* Methods & Slots::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Generic Codecs,  Next: UTF-8 Codecs,  Up: Built-in Codecs": {
            "content": "7.8.3.15 Generic Codecs\n.......................\n\nThese are the generic codec APIs:\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeDecode (const char *str,\nPyssizet size, const char *encoding, const char *errors)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Create a Unicode object by decoding 'size' bytes of the\nencoded string 'str'.  'encoding' and 'errors' have the same\nmeaning as the parameters of the same name in the *note str(): 157.\nbuilt-in function.  The codec to be used is looked up using the\nPython codec registry.  Return 'NULL' if an exception was raised by\nthe codec.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeAsEncodedString\n(PyObject *unicode, const char *encoding, const char *errors)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Encode a Unicode object and return the result as Python\nbytes object.  'encoding' and 'errors' have the same meaning as the\nparameters of the same name in the Unicode *note encode(): 6ee.\nmethod.  The codec to be used is looked up using the Python codec\nregistry.  Return 'NULL' if an exception was raised by the codec.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: UTF-8 Codecs,  Next: UTF-32 Codecs,  Prev: Generic Codecs,  Up: Built-in Codecs": {
            "content": "7.8.3.16 UTF-8 Codecs\n.....................\n\nThese are the UTF-8 codec APIs:\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeDecodeUTF8 (const char\n*str, Pyssizet size, const char *errors)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Create a Unicode object by decoding 'size' bytes of the\nUTF-8 encoded string 'str'.  Return 'NULL' if an exception was\nraised by the codec.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeDecodeUTF8Stateful\n(const char *str, Pyssizet size, const char *errors,\nPyssizet *consumed)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  If 'consumed' is 'NULL', behave like *note\nPyUnicodeDecodeUTF8(): 488b.  If 'consumed' is not 'NULL',\ntrailing incomplete UTF-8 byte sequences will not be treated as an\nerror.  Those bytes will not be decoded and the number of bytes\nthat have been decoded will be stored in 'consumed'.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeAsUTF8String (PyObject\n*unicode)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Encode a Unicode object using UTF-8 and return the result as\nPython bytes object.  Error handling is \"strict\".  Return 'NULL' if\nan exception was raised by the codec.\n\n-- C Function: const char *PyUnicodeAsUTF8AndSize (PyObject *unicode,\nPyssizet *size)\n' Part of the *note Stable ABI: 2ac. since version 3.10.'  Return a\npointer to the UTF-8 encoding of the Unicode object, and store the\nsize of the encoded representation (in bytes) in 'size'.  The\n'size' argument can be 'NULL'; in this case no size will be stored.\nThe returned buffer always has an extra null byte appended (not\nincluded in 'size'), regardless of whether there are any other null\ncode points.\n\nIn the case of an error, 'NULL' is returned with an exception set\nand no 'size' is stored.\n\nThis caches the UTF-8 representation of the string in the Unicode\nobject, and subsequent calls will return a pointer to the same\nbuffer.  The caller is not responsible for deallocating the buffer.\nThe buffer is deallocated and pointers to it become invalid when\nthe Unicode object is garbage collected.\n\nNew in version 3.3.\n\nChanged in version 3.7: The return type is now 'const char *'\nrather of 'char *'.\n\nChanged in version 3.10: This function is a part of the *note\nlimited API: 2a8.\n\n-- C Function: const char *PyUnicodeAsUTF8 (PyObject *unicode)\n\nAs *note PyUnicodeAsUTF8AndSize(): 6a8, but does not store the\nsize.\n\nNew in version 3.3.\n\nChanged in version 3.7: The return type is now 'const char *'\nrather of 'char *'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: UTF-32 Codecs,  Next: UTF-16 Codecs,  Prev: UTF-8 Codecs,  Up: Built-in Codecs": {
            "content": "7.8.3.17 UTF-32 Codecs\n......................\n\nThese are the UTF-32 codec APIs:\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeDecodeUTF32 (const char\n*str, Pyssizet size, const char *errors, int *byteorder)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Decode 'size' bytes from a UTF-32 encoded buffer string and\nreturn the corresponding Unicode object.  'errors' (if non-'NULL')\ndefines the error handling.  It defaults to \"strict\".\n\nIf 'byteorder' is non-'NULL', the decoder starts decoding using the\ngiven byte order:\n\n*byteorder == -1: little endian\n*byteorder == 0:  native order\n*byteorder == 1:  big endian\n\nIf '*byteorder' is zero, and the first four bytes of the input data\nare a byte order mark (BOM), the decoder switches to this byte\norder and the BOM is not copied into the resulting Unicode string.\nIf '*byteorder' is '-1' or '1', any byte order mark is copied to\nthe output.\n\nAfter completion, '*byteorder' is set to the current byte order at\nthe end of input data.\n\nIf 'byteorder' is 'NULL', the codec starts in native order mode.\n\nReturn 'NULL' if an exception was raised by the codec.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeDecodeUTF32Stateful\n(const char *str, Pyssizet size, const char *errors, int\n*byteorder, Pyssizet *consumed)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  If 'consumed' is 'NULL', behave like *note\nPyUnicodeDecodeUTF32(): 4887.  If 'consumed' is not 'NULL', *note\nPyUnicodeDecodeUTF32Stateful(): 4888. will not treat trailing\nincomplete UTF-32 byte sequences (such as a number of bytes not\ndivisible by four) as an error.  Those bytes will not be decoded\nand the number of bytes that have been decoded will be stored in\n'consumed'.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeAsUTF32String (PyObject\n*unicode)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a Python byte string using the UTF-32 encoding in\nnative byte order.  The string always starts with a BOM mark.\nError handling is \"strict\".  Return 'NULL' if an exception was\nraised by the codec.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: UTF-16 Codecs,  Next: UTF-7 Codecs,  Prev: UTF-32 Codecs,  Up: Built-in Codecs": {
            "content": "7.8.3.18 UTF-16 Codecs\n......................\n\nThese are the UTF-16 codec APIs:\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeDecodeUTF16 (const char\n*str, Pyssizet size, const char *errors, int *byteorder)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Decode 'size' bytes from a UTF-16 encoded buffer string and\nreturn the corresponding Unicode object.  'errors' (if non-'NULL')\ndefines the error handling.  It defaults to \"strict\".\n\nIf 'byteorder' is non-'NULL', the decoder starts decoding using the\ngiven byte order:\n\n*byteorder == -1: little endian\n*byteorder == 0:  native order\n*byteorder == 1:  big endian\n\nIf '*byteorder' is zero, and the first two bytes of the input data\nare a byte order mark (BOM), the decoder switches to this byte\norder and the BOM is not copied into the resulting Unicode string.\nIf '*byteorder' is '-1' or '1', any byte order mark is copied to\nthe output (where it will result in either a '\\ufeff' or a '\\ufffe'\ncharacter).\n\nAfter completion, '*byteorder' is set to the current byte order at\nthe end of input data.\n\nIf 'byteorder' is 'NULL', the codec starts in native order mode.\n\nReturn 'NULL' if an exception was raised by the codec.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeDecodeUTF16Stateful\n(const char *str, Pyssizet size, const char *errors, int\n*byteorder, Pyssizet *consumed)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  If 'consumed' is 'NULL', behave like *note\nPyUnicodeDecodeUTF16(): 4885.  If 'consumed' is not 'NULL', *note\nPyUnicodeDecodeUTF16Stateful(): 4886. will not treat trailing\nincomplete UTF-16 byte sequences (such as an odd number of bytes or\na split surrogate pair) as an error.  Those bytes will not be\ndecoded and the number of bytes that have been decoded will be\nstored in 'consumed'.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeAsUTF16String (PyObject\n*unicode)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a Python byte string using the UTF-16 encoding in\nnative byte order.  The string always starts with a BOM mark.\nError handling is \"strict\".  Return 'NULL' if an exception was\nraised by the codec.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: UTF-7 Codecs,  Next: Unicode-Escape Codecs,  Prev: UTF-16 Codecs,  Up: Built-in Codecs": {
            "content": "7.8.3.19 UTF-7 Codecs\n.....................\n\nThese are the UTF-7 codec APIs:\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeDecodeUTF7 (const char\n*str, Pyssizet size, const char *errors)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Create a Unicode object by decoding 'size' bytes of the\nUTF-7 encoded string 'str'.  Return 'NULL' if an exception was\nraised by the codec.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeDecodeUTF7Stateful\n(const char *str, Pyssizet size, const char *errors,\nPyssizet *consumed)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  If 'consumed' is 'NULL', behave like *note\nPyUnicodeDecodeUTF7(): 4889.  If 'consumed' is not 'NULL',\ntrailing incomplete UTF-7 base-64 sections will not be treated as\nan error.  Those bytes will not be decoded and the number of bytes\nthat have been decoded will be stored in 'consumed'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Unicode-Escape Codecs,  Next: Raw-Unicode-Escape Codecs,  Prev: UTF-7 Codecs,  Up: Built-in Codecs": {
            "content": "7.8.3.20 Unicode-Escape Codecs\n..............................\n\nThese are the \"Unicode Escape\" codec APIs:\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeDecodeUnicodeEscape\n(const char *str, Pyssizet size, const char *errors)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Create a Unicode object by decoding 'size' bytes of the\nUnicode-Escape encoded string 'str'.  Return 'NULL' if an exception\nwas raised by the codec.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeAsUnicodeEscapeString\n(PyObject *unicode)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Encode a Unicode object using Unicode-Escape and return the\nresult as a bytes object.  Error handling is \"strict\".  Return\n'NULL' if an exception was raised by the codec.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Raw-Unicode-Escape Codecs,  Next: Latin-1 Codecs,  Prev: Unicode-Escape Codecs,  Up: Built-in Codecs": {
            "content": "7.8.3.21 Raw-Unicode-Escape Codecs\n..................................\n\nThese are the \"Raw Unicode Escape\" codec APIs:\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeDecodeRawUnicodeEscape\n(const char *str, Pyssizet size, const char *errors)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Create a Unicode object by decoding 'size' bytes of the\nRaw-Unicode-Escape encoded string 'str'.  Return 'NULL' if an\nexception was raised by the codec.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeAsRawUnicodeEscapeString\n(PyObject *unicode)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Encode a Unicode object using Raw-Unicode-Escape and return\nthe result as a bytes object.  Error handling is \"strict\".  Return\n'NULL' if an exception was raised by the codec.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Latin-1 Codecs,  Next: ASCII Codecs,  Prev: Raw-Unicode-Escape Codecs,  Up: Built-in Codecs": {
            "content": "7.8.3.22 Latin-1 Codecs\n.......................\n",
            "subsections": []
        },
        "These are the Latin-1 codec APIs: Latin-1 corresponds to the first 256": {
            "content": "",
            "subsections": []
        },
        "Unicode ordinals and only these are accepted by the codecs during": {
            "content": "encoding.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeDecodeLatin1 (const char\n*str, Pyssizet size, const char *errors)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Create a Unicode object by decoding 'size' bytes of the\nLatin-1 encoded string 'str'.  Return 'NULL' if an exception was\nraised by the codec.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeAsLatin1String (PyObject\n*unicode)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Encode a Unicode object using Latin-1 and return the result\nas Python bytes object.  Error handling is \"strict\".  Return 'NULL'\nif an exception was raised by the codec.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ASCII Codecs,  Next: Character Map Codecs,  Prev: Latin-1 Codecs,  Up: Built-in Codecs": {
            "content": "7.8.3.23 ASCII Codecs\n.....................\n",
            "subsections": []
        },
        "These are the ASCII codec APIs.  Only 7-bit ASCII data is accepted.  All": {
            "content": "other codes generate errors.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeDecodeASCII (const char\n*str, Pyssizet size, const char *errors)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Create a Unicode object by decoding 'size' bytes of the\nASCII encoded string 'str'.  Return 'NULL' if an exception was\nraised by the codec.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeAsASCIIString (PyObject\n*unicode)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Encode a Unicode object using ASCII and return the result as\nPython bytes object.  Error handling is \"strict\".  Return 'NULL' if\nan exception was raised by the codec.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Character Map Codecs,  Next: MBCS codecs for Windows,  Prev: ASCII Codecs,  Up: Built-in Codecs": {
            "content": "7.8.3.24 Character Map Codecs\n.............................\n",
            "subsections": []
        },
        "This codec is special in that it can be used to implement many different": {
            "content": "codecs (and this is in fact what was done to obtain most of the standard\ncodecs included in the 'encodings' package).  The codec uses mappings to\nencode and decode characters.  The mapping objects provided must support\nthe *note getitem(): 4b9. mapping interface; dictionaries and\nsequences work well.\n\nThese are the mapping codec APIs:\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeDecodeCharmap (const\nchar *str, Pyssizet length, PyObject *mapping, const char\n*errors)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Create a Unicode object by decoding 'size' bytes of the\nencoded string 'str' using the given 'mapping' object.  Return\n'NULL' if an exception was raised by the codec.\n\nIf 'mapping' is 'NULL', Latin-1 decoding will be applied.  Else\n'mapping' must map bytes ordinals (integers in the range from 0 to\n255) to Unicode strings, integers (which are then interpreted as\nUnicode ordinals) or 'None'.  Unmapped data bytes - ones which\ncause a *note LookupError: 1ed9, as well as ones which get mapped\nto 'None', '0xFFFE' or ''\\ufffe'', are treated as undefined\nmappings and cause an error.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeAsCharmapString\n(PyObject *unicode, PyObject *mapping)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Encode a Unicode object using the given 'mapping' object and\nreturn the result as a bytes object.  Error handling is \"strict\".\nReturn 'NULL' if an exception was raised by the codec.\n\nThe 'mapping' object must map Unicode ordinal integers to bytes\nobjects, integers in the range from 0 to 255 or 'None'.  Unmapped\ncharacter ordinals (ones which cause a *note LookupError: 1ed9.) as\nwell as mapped to 'None' are treated as \"undefined mapping\" and\ncause an error.\n\nThe following codec API is special in that maps Unicode to Unicode.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeTranslate (PyObject\n*unicode, PyObject *table, const char *errors)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Translate a string by applying a character mapping table to\nit and return the resulting Unicode object.  Return 'NULL' if an\nexception was raised by the codec.\n\nThe mapping table must map Unicode ordinal integers to Unicode\nordinal integers or 'None' (causing deletion of the character).\n\nMapping tables need only provide the *note getitem(): 4b9.\ninterface; dictionaries and sequences work well.  Unmapped\ncharacter ordinals (ones which cause a *note LookupError: 1ed9.)\nare left untouched and are copied as-is.\n\n'errors' has the usual meaning for codecs.  It may be 'NULL' which\nindicates to use the default error handling.\n\nFile: python3.12.info,  Node: MBCS codecs for Windows,  Next: Methods & Slots,  Prev: Character Map Codecs,  Up: Built-in Codecs\n\n7.8.3.25 MBCS codecs for Windows\n................................\n",
            "subsections": []
        },
        "These are the MBCS codec APIs.  They are currently only available on": {
            "content": "Windows and use the Win32 MBCS converters to implement the conversions.",
            "subsections": []
        },
        "Note that MBCS (or DBCS) is a class of encodings, not just one.  The": {
            "content": "target encoding is defined by the user settings on the machine running\nthe codec.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeDecodeMBCS (const char\n*str, Pyssizet size, const char *errors)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\non Windows since version 3.7.'  Create a Unicode object by decoding\n'size' bytes of the MBCS encoded string 'str'.  Return 'NULL' if an\nexception was raised by the codec.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeDecodeMBCSStateful\n(const char *str, Pyssizet size, const char *errors,\nPyssizet *consumed)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\non Windows since version 3.7.'  If 'consumed' is 'NULL', behave\nlike *note PyUnicodeDecodeMBCS(): 4882.  If 'consumed' is not\n'NULL', *note PyUnicodeDecodeMBCSStateful(): 4883. will not decode\ntrailing lead byte and the number of bytes that have been decoded\nwill be stored in 'consumed'.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeAsMBCSString (PyObject\n*unicode)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\non Windows since version 3.7.'  Encode a Unicode object using MBCS\nand return the result as Python bytes object.  Error handling is\n\"strict\".  Return 'NULL' if an exception was raised by the codec.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeEncodeCodePage (int\ncodepage, PyObject *unicode, const char *errors)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\non Windows since version 3.7.'  Encode the Unicode object using the\nspecified code page and return a Python bytes object.  Return\n'NULL' if an exception was raised by the codec.  Use 'CPACP' code\npage to get the MBCS encoder.\n\nNew in version 3.3.\n\nFile: python3.12.info,  Node: Methods & Slots,  Prev: MBCS codecs for Windows,  Up: Built-in Codecs\n\n7.8.3.26 Methods & Slots\n........................\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Methods and Slot Functions,  Prev: Built-in Codecs,  Up: Unicode Objects and Codecs": {
            "content": "7.8.3.27 Methods and Slot Functions\n...................................\n",
            "subsections": []
        },
        "The following APIs are capable of handling Unicode objects and strings": {
            "content": "on input (we refer to them as strings in the descriptions) and return\nUnicode objects or integers as appropriate.\n\nThey all return 'NULL' or '-1' if an exception occurs.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeConcat (PyObject *left,\nPyObject *right)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Concat two strings giving a new Unicode string.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeSplit (PyObject\n*unicode, PyObject *sep, Pyssizet maxsplit)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Split a string giving a list of Unicode strings.  If 'sep'\nis 'NULL', splitting will be done at all whitespace substrings.\nOtherwise, splits occur at the given separator.  At most 'maxsplit'\nsplits will be done.  If negative, no limit is set.  Separators are\nnot included in the resulting list.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeSplitlines (PyObject\n*unicode, int keepends)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Split a Unicode string at line breaks, returning a list of\nUnicode strings.  CRLF is considered to be one line break.  If\n'keepends' is '0', the Line break characters are not included in\nthe resulting strings.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeJoin (PyObject\n*separator, PyObject *seq)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Join a sequence of strings using the given 'separator' and\nreturn the resulting Unicode string.\n\n-- C Function: *note Pyssizet: 88d. PyUnicodeTailmatch (PyObject\n*unicode, PyObject *substr, Pyssizet start, Pyssizet end,\nint direction)\n' Part of the *note Stable ABI: 2ac.'  Return '1' if 'substr'\nmatches 'unicode[start:end]' at the given tail end ('direction' ==\n'-1' means to do a prefix match, 'direction' == '1' a suffix\nmatch), '0' otherwise.  Return '-1' if an error occurred.\n\n-- C Function: *note Pyssizet: 88d. PyUnicodeFind (PyObject\n*unicode, PyObject *substr, Pyssizet start, Pyssizet end,\nint direction)\n' Part of the *note Stable ABI: 2ac.'  Return the first position of\n'substr' in 'unicode[start:end]' using the given 'direction'\n('direction' == '1' means to do a forward search, 'direction' ==\n'-1' a backward search).  The return value is the index of the\nfirst match; a value of '-1' indicates that no match was found, and\n'-2' indicates that an error occurred and an exception has been\nset.\n\n-- C Function: *note Pyssizet: 88d. PyUnicodeFindChar (PyObject\n*unicode, PyUCS4 ch, Pyssizet start, Pyssizet end, int\ndirection)\n' Part of the *note Stable ABI: 2ac. since version 3.7.'  Return\nthe first position of the character 'ch' in 'unicode[start:end]'\nusing the given 'direction' ('direction' == '1' means to do a\nforward search, 'direction' == '-1' a backward search).  The return\nvalue is the index of the first match; a value of '-1' indicates\nthat no match was found, and '-2' indicates that an error occurred\nand an exception has been set.\n\nNew in version 3.3.\n\nChanged in version 3.7: 'start' and 'end' are now adjusted to\nbehave like 'unicode[start:end]'.\n\n-- C Function: *note Pyssizet: 88d. PyUnicodeCount (PyObject\n*unicode, PyObject *substr, Pyssizet start, Pyssizet end)\n' Part of the *note Stable ABI: 2ac.'  Return the number of\nnon-overlapping occurrences of 'substr' in 'unicode[start:end]'.\nReturn '-1' if an error occurred.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeReplace (PyObject\n*unicode, PyObject *substr, PyObject *replstr, Pyssizet\nmaxcount)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Replace at most 'maxcount' occurrences of 'substr' in\n'unicode' with 'replstr' and return the resulting Unicode object.\n'maxcount' == '-1' means replace all occurrences.\n\n-- C Function: int PyUnicodeCompare (PyObject *left, PyObject *right)\n' Part of the *note Stable ABI: 2ac.'  Compare two strings and\nreturn '-1', '0', '1' for less than, equal, and greater than,\nrespectively.\n\nThis function returns '-1' upon failure, so one should call *note\nPyErrOccurred(): 1656. to check for errors.\n\n-- C Function: int PyUnicodeCompareWithASCIIString (PyObject *unicode,\nconst char *string)\n' Part of the *note Stable ABI: 2ac.'  Compare a Unicode object,\n'unicode', with 'string' and return '-1', '0', '1' for less than,\nequal, and greater than, respectively.  It is best to pass only\nASCII-encoded strings, but the function interprets the input string\nas ISO-8859-1 if it contains non-ASCII characters.\n\nThis function does not raise exceptions.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeRichCompare (PyObject\n*left, PyObject *right, int op)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Rich compare two Unicode strings and return one of the\nfollowing:\n\n* 'NULL' in case an exception was raised\n\n* *note PyTrue: 49c9. or *note PyFalse: 49c8. for successful\ncomparisons\n\n* *note PyNotImplemented: 4942. in case the type combination is\nunknown\n\nPossible values for 'op' are *note PyGT: 494c, *note PyGE: 494d,\n*note PyEQ: 494a, *note PyNE: 494b, *note PyLT: 4948, and *note\nPyLE: 4949.\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeFormat (PyObject\n*format, PyObject *args)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a new string object from 'format' and 'args'; this is\nanalogous to 'format % args'.\n\n-- C Function: int PyUnicodeContains (PyObject *unicode, PyObject\n*substr)\n' Part of the *note Stable ABI: 2ac.'  Check whether 'substr' is\ncontained in 'unicode' and return true or false accordingly.\n\n'substr' has to coerce to a one element Unicode string.  '-1' is\nreturned if there was an error.\n\n-- C Function: void PyUnicodeInternInPlace (PyObject punicode)\n' Part of the *note Stable ABI: 2ac.'  Intern the argument note\npunicode: 6c9. in place.  The argument must be the address of a\npointer variable pointing to a Python Unicode string object.  If\nthere is an existing interned string that is the same as note\npunicode: 6c9, it sets note punicode: 6c9. to it (releasing the\nreference to the old string object and creating a new *note strong\nreference: 57c. to the interned string object), otherwise it leaves\nnote punicode: 6c9. alone and interns it (creating a new *note\nstrong reference: 57c.).  (Clarification: even though there is a\nlot of talk about references, think of this function as\nreference-neutral; you own the object after the call if and only if\nyou owned it before the call.)\n\n-- C Function: *note PyObject: 6b1. *PyUnicodeInternFromString (const\nchar *str)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  A combination of *note PyUnicodeFromString(): 4716. and\n*note PyUnicodeInternInPlace(): 6c9, returning either a new\nUnicode string object that has been interned, or a new (\"owned\")\nreference to an earlier interned string object with the same value.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Tuple Objects,  Next: Struct Sequence Objects,  Prev: Unicode Objects and Codecs,  Up: Sequence Objects": {
            "content": "7.8.3.28 Tuple Objects\n......................\n\n-- C Type: type PyTupleObject\n\nThis subtype of *note PyObject: 6b1. represents a Python tuple\nobject.\n\n-- C Variable: *note PyTypeObject: 8da. PyTupleType\n' Part of the *note Stable ABI: 2ac.'  This instance of *note\nPyTypeObject: 8da. represents the Python tuple type; it is the same\nobject as *note tuple: 4b8. in the Python layer.\n\n-- C Function: int PyTupleCheck (PyObject *p)\n\nReturn true if 'p' is a tuple object or an instance of a subtype of\nthe tuple type.  This function always succeeds.\n\n-- C Function: int PyTupleCheckExact (PyObject *p)\n\nReturn true if 'p' is a tuple object, but not an instance of a\nsubtype of the tuple type.  This function always succeeds.\n\n-- C Function: *note PyObject: 6b1. *PyTupleNew (Pyssizet len)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a new tuple object of size 'len', or 'NULL' on\nfailure.\n\n-- C Function: *note PyObject: 6b1. *PyTuplePack (Pyssizet n, ...)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a new tuple object of size 'n', or 'NULL' on failure.\nThe tuple values are initialized to the subsequent 'n' C arguments\npointing to Python objects.  'PyTuplePack(2, a, b)' is equivalent\nto 'PyBuildValue(\"(OO)\", a, b)'.\n\n-- C Function: *note Pyssizet: 88d. PyTupleSize (PyObject *p)\n' Part of the *note Stable ABI: 2ac.'  Take a pointer to a tuple\nobject, and return the size of that tuple.\n\n-- C Function: *note Pyssizet: 88d. PyTupleGETSIZE (PyObject *p)\n\nReturn the size of the tuple 'p', which must be non-'NULL' and\npoint to a tuple; no error checking is performed.\n\n-- C Function: *note PyObject: 6b1. *PyTupleGetItem (PyObject *p,\nPyssizet pos)\n'Return value: Borrowed reference.''  Part of the *note Stable ABI:\n2ac.'  Return the object at position 'pos' in the tuple pointed to\nby 'p'.  If 'pos' is negative or out of bounds, return 'NULL' and\nset an *note IndexError: 138f. exception.\n\n-- C Function: *note PyObject: 6b1. *PyTupleGETITEM (PyObject *p,\nPyssizet pos)\n'Return value: Borrowed reference.'  Like *note PyTupleGetItem():\n46b5, but does no checking of its arguments.\n\n-- C Function: *note PyObject: 6b1. *PyTupleGetSlice (PyObject *p,\nPyssizet low, Pyssizet high)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return the slice of the tuple pointed to by 'p' between\n'low' and 'high', or 'NULL' on failure.  This is the equivalent of\nthe Python expression 'p[low:high]'.  Indexing from the end of the\ntuple is not supported.\n\n-- C Function: int PyTupleSetItem (PyObject *p, Pyssizet pos,\nPyObject *o)\n' Part of the *note Stable ABI: 2ac.'  Insert a reference to object\n'o' at position 'pos' of the tuple pointed to by 'p'.  Return '0'\non success.  If 'pos' is out of bounds, return '-1' and set an\n*note IndexError: 138f. exception.\n\nNote: This function \"steals\" a reference to 'o' and discards a\nreference to an item already in the tuple at the affected\nposition.\n\n-- C Function: void PyTupleSETITEM (PyObject *p, Pyssizet pos,\nPyObject *o)\n\nLike *note PyTupleSetItem(): 46b9, but does no error checking, and\nshould 'only' be used to fill in brand new tuples.\n\nNote: This function \"steals\" a reference to 'o', and, unlike\n*note PyTupleSetItem(): 46b9, does 'not' discard a reference\nto any item that is being replaced; any reference in the tuple\nat position 'pos' will be leaked.\n\n-- C Function: int PyTupleResize (PyObject p, Pyssizet newsize)\n\nCan be used to resize a tuple.  'newsize' will be the new length of\nthe tuple.  Because tuples are 'supposed' to be immutable, this\nshould only be used if there is only one reference to the object.\nDo 'not' use this if the tuple may already be known to some other\npart of the code.  The tuple will always grow or shrink at the end.\nThink of this as destroying the old tuple and creating a new one,\nonly more efficiently.  Returns '0' on success.  Client code should\nnever assume that the resulting value of '*p' will be the same as\nbefore calling this function.  If the object referenced by '*p' is\nreplaced, the original '*p' is destroyed.  On failure, returns '-1'\nand sets '*p' to 'NULL', and raises *note MemoryError: 13e3. or\n*note SystemError: 2d7.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Struct Sequence Objects,  Next: List Objects,  Prev: Tuple Objects,  Up: Sequence Objects": {
            "content": "7.8.3.29 Struct Sequence Objects\n................................\n\nStruct sequence objects are the C equivalent of *note namedtuple(): 711.\nobjects, i.e.  a sequence whose items can also be accessed through\nattributes.  To create a struct sequence, you first have to create a\nspecific struct sequence type.\n\n-- C Function: *note PyTypeObject: 8da. *PyStructSequenceNewType\n(PyStructSequenceDesc *desc)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Create a new struct sequence type from the data in 'desc',\ndescribed below.  Instances of the resulting type can be created\nwith *note PyStructSequenceNew(): 4847.\n\n-- C Function: void PyStructSequenceInitType (PyTypeObject *type,\nPyStructSequenceDesc *desc)\n\nInitializes a struct sequence type 'type' from 'desc' in place.\n\n-- C Function: int PyStructSequenceInitType2 (PyTypeObject *type,\nPyStructSequenceDesc *desc)\n\nThe same as 'PyStructSequenceInitType', but returns '0' on success\nand '-1' on failure.\n\nNew in version 3.4.\n\n-- C Type: type PyStructSequenceDesc\n' Part of the *note Stable ABI: 2ac. (including all members).'\nContains the meta information of a struct sequence type to create.\n\n-- C Member: const char *name\n\nName of the struct sequence type.\n\n-- C Member: const char *doc\n\nPointer to docstring for the type or 'NULL' to omit.\n\n-- C Member: *note PyStructSequenceField: 9fd. *fields\n\nPointer to 'NULL'-terminated array with field names of the new\ntype.\n\n-- C Member: int ninsequence\n\nNumber of fields visible to the Python side (if used as\ntuple).\n\n-- C Type: type PyStructSequenceField\n' Part of the *note Stable ABI: 2ac. (including all members).'\nDescribes a field of a struct sequence.  As a struct sequence is\nmodeled as a tuple, all fields are typed as *note PyObject: 6b1.*.\nThe index in the *note fields: 4a30. array of the *note\nPyStructSequenceDesc: 9fe. determines which field of the struct\nsequence is described.\n\n-- C Member: const char *name\n\nName for the field or 'NULL' to end the list of named fields,\nset to *note PyStructSequenceUnnamedField: 7a6. to leave\nunnamed.\n\n-- C Member: const char *doc\n\nField docstring or 'NULL' to omit.\n\n-- C Variable: const char *const PyStructSequenceUnnamedField\n' Part of the *note Stable ABI: 2ac. since version 3.11.'  Special\nvalue for a field name to leave it unnamed.\n\nChanged in version 3.9: The type was changed from 'char *'.\n\n-- C Function: *note PyObject: 6b1. *PyStructSequenceNew (PyTypeObject\n*type)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Creates an instance of 'type', which must have been created\nwith *note PyStructSequenceNewType(): 4848.\n\n-- C Function: *note PyObject: 6b1. *PyStructSequenceGetItem (PyObject\n*p, Pyssizet pos)\n'Return value: Borrowed reference.''  Part of the *note Stable ABI:\n2ac.'  Return the object at position 'pos' in the struct sequence\npointed to by 'p'.  No bounds checking is performed.\n\n-- C Function: *note PyObject: 6b1. *PyStructSequenceGETITEM\n(PyObject *p, Pyssizet pos)\n'Return value: Borrowed reference.'  Macro equivalent of *note\nPyStructSequenceGetItem(): 4846.\n\n-- C Function: void PyStructSequenceSetItem (PyObject *p, Pyssizet\npos, PyObject *o)\n' Part of the *note Stable ABI: 2ac.'  Sets the field at index\n'pos' of the struct sequence 'p' to value 'o'.  Like *note\nPyTupleSETITEM(): 6c5, this should only be used to fill in brand\nnew instances.\n\nNote: This function \"steals\" a reference to 'o'.\n\n-- C Function: void PyStructSequenceSETITEM (PyObject *p, Pyssizet\n*pos, PyObject *o)\n\nSimilar to *note PyStructSequenceSetItem(): 4849, but implemented\nas a static inlined function.\n\nNote: This function \"steals\" a reference to 'o'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: List Objects,  Prev: Struct Sequence Objects,  Up: Sequence Objects": {
            "content": "7.8.3.30 List Objects\n.....................\n\n-- C Type: type PyListObject\n\nThis subtype of *note PyObject: 6b1. represents a Python list\nobject.\n\n-- C Variable: *note PyTypeObject: 8da. PyListType\n' Part of the *note Stable ABI: 2ac.'  This instance of *note\nPyTypeObject: 8da. represents the Python list type.  This is the\nsame object as *note list: 3dc. in the Python layer.\n\n-- C Function: int PyListCheck (PyObject *p)\n\nReturn true if 'p' is a list object or an instance of a subtype of\nthe list type.  This function always succeeds.\n\n-- C Function: int PyListCheckExact (PyObject *p)\n\nReturn true if 'p' is a list object, but not an instance of a\nsubtype of the list type.  This function always succeeds.\n\n-- C Function: *note PyObject: 6b1. *PyListNew (Pyssizet len)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a new list of length 'len' on success, or 'NULL' on\nfailure.\n\nNote: If 'len' is greater than zero, the returned list\nobject's items are set to 'NULL'.  Thus you cannot use\nabstract API functions such as *note PySequenceSetItem():\n17d5. or expose the object to Python code before setting all\nitems to a real object with *note PyListSetItem(): 46ba.\n\n-- C Function: *note Pyssizet: 88d. PyListSize (PyObject *list)\n' Part of the *note Stable ABI: 2ac.'\n\nReturn the length of the list object in 'list'; this is equivalent\nto 'len(list)' on a list object.\n\n-- C Function: *note Pyssizet: 88d. PyListGETSIZE (PyObject *list)\n\nSimilar to *note PyListSize(): 1270, but without error checking.\n\n-- C Function: *note PyObject: 6b1. *PyListGetItem (PyObject *list,\nPyssizet index)\n'Return value: Borrowed reference.''  Part of the *note Stable ABI:\n2ac.'  Return the object at position 'index' in the list pointed to\nby 'list'.  The position must be non-negative; indexing from the\nend of the list is not supported.  If 'index' is out of bounds (<0\nor >=len(list)), return 'NULL' and set an *note IndexError: 138f.\nexception.\n\n-- C Function: *note PyObject: 6b1. *PyListGETITEM (PyObject *list,\nPyssizet i)\n'Return value: Borrowed reference.'  Similar to *note\nPyListGetItem(): 46b6, but without error checking.\n\n-- C Function: int PyListSetItem (PyObject *list, Pyssizet index,\nPyObject *item)\n' Part of the *note Stable ABI: 2ac.'  Set the item at index\n'index' in list to 'item'.  Return '0' on success.  If 'index' is\nout of bounds, return '-1' and set an *note IndexError: 138f.\nexception.\n\nNote: This function \"steals\" a reference to 'item' and\ndiscards a reference to an item already in the list at the\naffected position.\n\n-- C Function: void PyListSETITEM (PyObject *list, Pyssizet i,\nPyObject *o)\n\nMacro form of *note PyListSetItem(): 46ba. without error checking.\nThis is normally only used to fill in new lists where there is no\nprevious content.\n\nNote: This macro \"steals\" a reference to 'item', and, unlike\n*note PyListSetItem(): 46ba, does 'not' discard a reference\nto any item that is being replaced; any reference in 'list' at\nposition 'i' will be leaked.\n\n-- C Function: int PyListInsert (PyObject *list, Pyssizet index,\nPyObject *item)\n' Part of the *note Stable ABI: 2ac.'  Insert the item 'item' into\nlist 'list' in front of index 'index'.  Return '0' if successful;\nreturn '-1' and set an exception if unsuccessful.  Analogous to\n'list.insert(index, item)'.\n\n-- C Function: int PyListAppend (PyObject *list, PyObject *item)\n' Part of the *note Stable ABI: 2ac.'  Append the object 'item' at\nthe end of list 'list'.  Return '0' if successful; return '-1' and\nset an exception if unsuccessful.  Analogous to\n'list.append(item)'.\n\n-- C Function: *note PyObject: 6b1. *PyListGetSlice (PyObject *list,\nPyssizet low, Pyssizet high)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a list of the objects in 'list' containing the\nobjects 'between' 'low' and 'high'.  Return 'NULL' and set an\nexception if unsuccessful.  Analogous to 'list[low:high]'.\nIndexing from the end of the list is not supported.\n\n-- C Function: int PyListSetSlice (PyObject *list, Pyssizet low,\nPyssizet high, PyObject *itemlist)\n' Part of the *note Stable ABI: 2ac.'  Set the slice of 'list'\nbetween 'low' and 'high' to the contents of 'itemlist'.  Analogous\nto 'list[low:high] = itemlist'.  The 'itemlist' may be 'NULL',\nindicating the assignment of an empty list (slice deletion).\nReturn '0' on success, '-1' on failure.  Indexing from the end of\nthe list is not supported.\n\n-- C Function: int PyListSort (PyObject *list)\n' Part of the *note Stable ABI: 2ac.'  Sort the items of 'list' in\nplace.  Return '0' on success, '-1' on failure.  This is equivalent\nto 'list.sort()'.\n\n-- C Function: int PyListReverse (PyObject *list)\n' Part of the *note Stable ABI: 2ac.'  Reverse the items of 'list'\nin place.  Return '0' on success, '-1' on failure.  This is the\nequivalent of 'list.reverse()'.\n\n-- C Function: *note PyObject: 6b1. *PyListAsTuple (PyObject *list)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'\n\nReturn a new tuple object containing the contents of 'list';\nequivalent to 'tuple(list)'.\n\nFile: python3.12.info,  Node: Container Objects,  Next: Function Objects<2>,  Prev: Sequence Objects,  Up: Concrete Objects Layer\n\n\n* Menu:\n\n* Dictionary Objects::\n* Set Objects::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Dictionary Objects,  Next: Set Objects,  Up: Container Objects": {
            "content": "7.8.4.1 Dictionary Objects\n..........................\n\n-- C Type: type PyDictObject\n\nThis subtype of *note PyObject: 6b1. represents a Python dictionary\nobject.\n\n-- C Variable: *note PyTypeObject: 8da. PyDictType\n' Part of the *note Stable ABI: 2ac.'  This instance of *note\nPyTypeObject: 8da. represents the Python dictionary type.  This is\nthe same object as *note dict: 237. in the Python layer.\n\n-- C Function: int PyDictCheck (PyObject *p)\n\nReturn true if 'p' is a dict object or an instance of a subtype of\nthe dict type.  This function always succeeds.\n\n-- C Function: int PyDictCheckExact (PyObject *p)\n\nReturn true if 'p' is a dict object, but not an instance of a\nsubtype of the dict type.  This function always succeeds.\n\n-- C Function: *note PyObject: 6b1. *PyDictNew ()\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a new empty dictionary, or 'NULL' on failure.\n\n-- C Function: *note PyObject: 6b1. *PyDictProxyNew (PyObject\n*mapping)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a *note types.MappingProxyType: 186. object for a\nmapping which enforces read-only behavior.  This is normally used\nto create a view to prevent modification of the dictionary for\nnon-dynamic class types.\n\n-- C Function: void PyDictClear (PyObject *p)\n' Part of the *note Stable ABI: 2ac.'  Empty an existing dictionary\nof all key-value pairs.\n\n-- C Function: int PyDictContains (PyObject *p, PyObject *key)\n' Part of the *note Stable ABI: 2ac.'  Determine if dictionary 'p'\ncontains 'key'.  If an item in 'p' is matches 'key', return '1',\notherwise return '0'.  On error, return '-1'.  This is equivalent\nto the Python expression 'key in p'.\n\n-- C Function: *note PyObject: 6b1. *PyDictCopy (PyObject *p)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a new dictionary that contains the same key-value\npairs as 'p'.\n\n-- C Function: int PyDictSetItem (PyObject *p, PyObject *key, PyObject\n*val)\n' Part of the *note Stable ABI: 2ac.'  Insert 'val' into the\ndictionary 'p' with a key of 'key'.  'key' must be *note hashable:\n3db.; if it isn't, *note TypeError: 28e. will be raised.  Return\n'0' on success or '-1' on failure.  This function 'does not' steal\na reference to 'val'.\n\n-- C Function: int PyDictSetItemString (PyObject *p, const char *key,\nPyObject *val)\n' Part of the *note Stable ABI: 2ac.'  This is the same as *note\nPyDictSetItem(): 46bb, but 'key' is specified as a const char*\nUTF-8 encoded bytes string, rather than a *note PyObject: 6b1.*.\n\n-- C Function: int PyDictDelItem (PyObject *p, PyObject *key)\n' Part of the *note Stable ABI: 2ac.'  Remove the entry in\ndictionary 'p' with key 'key'.  'key' must be *note hashable: 3db.;\nif it isn't, *note TypeError: 28e. is raised.  If 'key' is not in\nthe dictionary, *note KeyError: 8cf. is raised.  Return '0' on\nsuccess or '-1' on failure.\n\n-- C Function: int PyDictDelItemString (PyObject *p, const char *key)\n' Part of the *note Stable ABI: 2ac.'  This is the same as *note\nPyDictDelItem(): 4786, but 'key' is specified as a const char*\nUTF-8 encoded bytes string, rather than a *note PyObject: 6b1.*.\n\n-- C Function: *note PyObject: 6b1. *PyDictGetItem (PyObject *p,\nPyObject *key)\n'Return value: Borrowed reference.''  Part of the *note Stable ABI:\n2ac.'  Return the object from dictionary 'p' which has a key 'key'.\nReturn 'NULL' if the key 'key' is not present, but 'without'\nsetting an exception.\n\nNote: Exceptions that occur while this calls *note hash():\n932. and *note eq(): 931. methods are silently ignored.\nPrefer the *note PyDictGetItemWithError(): 4788. function\ninstead.\n\nChanged in version 3.10: Calling this API without *note GIL: 6c0.\nheld had been allowed for historical reason.  It is no longer\nallowed.\n\n-- C Function: *note PyObject: 6b1. *PyDictGetItemWithError (PyObject\n*p, PyObject *key)\n'Return value: Borrowed reference.''  Part of the *note Stable ABI:\n2ac.'  Variant of *note PyDictGetItem(): 6bf. that does not\nsuppress exceptions.  Return 'NULL' 'with' an exception set if an\nexception occurred.  Return 'NULL' 'without' an exception set if\nthe key wasn't present.\n\n-- C Function: *note PyObject: 6b1. *PyDictGetItemString (PyObject *p,\nconst char *key)\n'Return value: Borrowed reference.''  Part of the *note Stable ABI:\n2ac.'  This is the same as *note PyDictGetItem(): 6bf, but 'key'\nis specified as a const char* UTF-8 encoded bytes string, rather\nthan a *note PyObject: 6b1.*.\n\nNote: Exceptions that occur while this calls *note hash():\n932. and *note eq(): 931. methods or while creating the\ntemporary *note str: 157. object are silently ignored.  Prefer\nusing the *note PyDictGetItemWithError(): 4788. function with\nyour own *note PyUnicodeFromString(): 4716. 'key' instead.\n\n-- C Function: *note PyObject: 6b1. *PyDictSetDefault (PyObject *p,\nPyObject *key, PyObject *defaultobj)\n'Return value: Borrowed reference.'  This is the same as the\nPython-level *note dict.setdefault(): ef0.  If present, it returns\nthe value corresponding to 'key' from the dictionary 'p'.  If the\nkey is not in the dict, it is inserted with value 'defaultobj' and\n'defaultobj' is returned.  This function evaluates the hash\nfunction of 'key' only once, instead of evaluating it independently\nfor the lookup and the insertion.\n\nNew in version 3.4.\n\n-- C Function: *note PyObject: 6b1. *PyDictItems (PyObject *p)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a *note PyListObject: 4963. containing all the items\nfrom the dictionary.\n\n-- C Function: *note PyObject: 6b1. *PyDictKeys (PyObject *p)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a *note PyListObject: 4963. containing all the keys\nfrom the dictionary.\n\n-- C Function: *note PyObject: 6b1. *PyDictValues (PyObject *p)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a *note PyListObject: 4963. containing all the values\nfrom the dictionary 'p'.\n\n-- C Function: *note Pyssizet: 88d. PyDictSize (PyObject *p)\n' Part of the *note Stable ABI: 2ac.'\n\nReturn the number of items in the dictionary.  This is equivalent\nto 'len(p)' on a dictionary.\n\n-- C Function: int PyDictNext (PyObject *p, Pyssizet *ppos, PyObject\npkey, PyObject pvalue)\n' Part of the *note Stable ABI: 2ac.'  Iterate over all key-value\npairs in the dictionary 'p'.  The *note Pyssizet: 88d. referred\nto by 'ppos' must be initialized to '0' prior to the first call to\nthis function to start the iteration; the function returns true for\neach pair in the dictionary, and false once all pairs have been\nreported.  The parameters 'pkey' and 'pvalue' should either point\nto *note PyObject: 6b1.* variables that will be filled in with each\nkey and value, respectively, or may be 'NULL'.  Any references\nreturned through them are borrowed.  'ppos' should not be altered\nduring iteration.  Its value represents offsets within the internal\ndictionary structure, and since the structure is sparse, the\noffsets are not consecutive.\n\nFor example:\n\nPyObject *key, *value;\nPyssizet pos = 0;\n\nwhile (PyDictNext(self->dict, &pos, &key, &value)) {\n/* do something interesting with the values... */\n...\n}\n\nThe dictionary 'p' should not be mutated during iteration.  It is\nsafe to modify the values of the keys as you iterate over the\ndictionary, but only so long as the set of keys does not change.\nFor example:\n\nPyObject *key, *value;\nPyssizet pos = 0;\n\nwhile (PyDictNext(self->dict, &pos, &key, &value)) {\nlong i = PyLongAsLong(value);\nif (i == -1 && PyErrOccurred()) {\nreturn -1;\n}\nPyObject *o = PyLongFromLong(i + 1);\nif (o == NULL)\nreturn -1;\nif (PyDictSetItem(self->dict, key, o) < 0) {\nPyDECREF(o);\nreturn -1;\n}\nPyDECREF(o);\n}\n\n-- C Function: int PyDictMerge (PyObject *a, PyObject *b, int\noverride)\n' Part of the *note Stable ABI: 2ac.'  Iterate over mapping object\n'b' adding key-value pairs to dictionary 'a'.  'b' may be a\ndictionary, or any object supporting *note PyMappingKeys(): a00.\nand *note PyObjectGetItem(): 4735.  If 'override' is true,\nexisting pairs in 'a' will be replaced if a matching key is found\nin 'b', otherwise pairs will only be added if there is not a\nmatching key in 'a'.  Return '0' on success or '-1' if an exception\nwas raised.\n\n-- C Function: int PyDictUpdate (PyObject *a, PyObject *b)\n' Part of the *note Stable ABI: 2ac.'  This is the same as\n'PyDictMerge(a, b, 1)' in C, and is similar to 'a.update(b)' in\nPython except that *note PyDictUpdate(): 4792. doesn't fall back\nto the iterating over a sequence of key value pairs if the second\nargument has no \"keys\" attribute.  Return '0' on success or '-1' if\nan exception was raised.\n\n-- C Function: int PyDictMergeFromSeq2 (PyObject *a, PyObject *seq2,\nint override)\n' Part of the *note Stable ABI: 2ac.'  Update or merge into\ndictionary 'a', from the key-value pairs in 'seq2'.  'seq2' must be\nan iterable object producing iterable objects of length 2, viewed\nas key-value pairs.  In case of duplicate keys, the last wins if\n'override' is true, else the first wins.  Return '0' on success or\n'-1' if an exception was raised.  Equivalent Python (except for the\nreturn value):\n\ndef PyDictMergeFromSeq2(a, seq2, override):\nfor key, value in seq2:\nif override or key not in a:\na[key] = value\n\n-- C Function: int PyDictAddWatcher (PyDictWatchCallback callback)\n\nRegister 'callback' as a dictionary watcher.  Return a non-negative\ninteger id which must be passed to future calls to *note\nPyDictWatch(): 2be.  In case of error (e.g.  no more watcher IDs\navailable), return '-1' and set an exception.\n\nNew in version 3.12.\n\n-- C Function: int PyDictClearWatcher (int watcherid)\n\nClear watcher identified by 'watcherid' previously returned from\n*note PyDictAddWatcher(): 2bd.  Return '0' on success, '-1' on\nerror (e.g.  if the given 'watcherid' was never registered.)\n\nNew in version 3.12.\n\n-- C Function: int PyDictWatch (int watcherid, PyObject *dict)\n\nMark dictionary 'dict' as watched.  The callback granted\n'watcherid' by *note PyDictAddWatcher(): 2bd. will be called when\n'dict' is modified or deallocated.  Return '0' on success or '-1'\non error.\n\nNew in version 3.12.\n\n-- C Function: int PyDictUnwatch (int watcherid, PyObject *dict)\n\nMark dictionary 'dict' as no longer watched.  The callback granted\n'watcherid' by *note PyDictAddWatcher(): 2bd. will no longer be\ncalled when 'dict' is modified or deallocated.  The dict must\npreviously have been watched by this watcher.  Return '0' on\nsuccess or '-1' on error.\n\nNew in version 3.12.\n\n-- C Type: type PyDictWatchEvent\n\nEnumeration of possible dictionary watcher events:\n'PyDictEVENTADDED', 'PyDictEVENTMODIFIED',\n'PyDictEVENTDELETED', 'PyDictEVENTCLONED',\n'PyDictEVENTCLEARED', or 'PyDictEVENTDEALLOCATED'.\n\nNew in version 3.12.\n\n-- C Type: typedef int (*PyDictWatchCallback)(*note PyDictWatchEvent:\n4a45. event, *note PyObject: 6b1. *dict, *note PyObject: 6b1.\n*key, *note PyObject: 6b1. *newvalue)\n\nType of a dict watcher callback function.\n\nIf 'event' is 'PyDictEVENTCLEARED' or 'PyDictEVENTDEALLOCATED',\nboth 'key' and 'newvalue' will be 'NULL'.  If 'event' is\n'PyDictEVENTADDED' or 'PyDictEVENTMODIFIED', 'newvalue' will\nbe the new value for 'key'.  If 'event' is 'PyDictEVENTDELETED',\n'key' is being deleted from the dictionary and 'newvalue' will be\n'NULL'.\n\n'PyDictEVENTCLONED' occurs when 'dict' was previously empty and\nanother dict is merged into it.  To maintain efficiency of this\noperation, per-key 'PyDictEVENTADDED' events are not issued in\nthis case; instead a single 'PyDictEVENTCLONED' is issued, and\n'key' will be the source dictionary.\n\nThe callback may inspect but must not modify 'dict'; doing so could\nhave unpredictable effects, including infinite recursion.  Do not\ntrigger Python code execution in the callback, as it could modify\nthe dict as a side effect.\n\nIf 'event' is 'PyDictEVENTDEALLOCATED', taking a new reference in\nthe callback to the about-to-be-destroyed dictionary will resurrect\nit and prevent it from being freed at this time.  When the\nresurrected object is destroyed later, any watcher callbacks active\nat that time will be called again.\n\nCallbacks occur before the notified modification to 'dict' takes\nplace, so the prior state of 'dict' can be inspected.\n\nIf the callback sets an exception, it must return '-1'; this\nexception will be printed as an unraisable exception using *note\nPyErrWriteUnraisable(): 175d.  Otherwise it should return '0'.\n\nThere may already be a pending exception set on entry to the\ncallback.  In this case, the callback should return '0' with the\nsame exception still set.  This means the callback may not call any\nother API that can set an exception unless it saves and clears the\nexception state first, and restores it before returning.\n\nNew in version 3.12.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Set Objects,  Prev: Dictionary Objects,  Up: Container Objects": {
            "content": "7.8.4.2 Set Objects\n...................\n\nThis section details the public API for *note set: 39d. and *note\nfrozenset: 39e. objects.  Any functionality not listed below is best\naccessed using either the abstract object protocol (including *note\nPyObjectCallMethod(): 2d4, *note PyObjectRichCompareBool(): 1711,\n*note PyObjectHash(): 342, *note PyObjectRepr(): ea6, *note\nPyObjectIsTrue(): 4824, *note PyObjectPrint(): 17d2, and *note",
            "subsections": []
        },
        "PyObjectGetIter(): 4822.) or the abstract number protocol (including": {
            "content": "*note PyNumberAnd(): 47f3, *note PyNumberSubtract(): 480c, *note\nPyNumberOr(): 4807, *note PyNumberXor(): 480e, *note\nPyNumberInPlaceAnd(): 47f8, *note PyNumberInPlaceSubtract(): 4800,\n*note PyNumberInPlaceOr(): 47fc, and *note PyNumberInPlaceXor():\n4802.).\n\n-- C Type: type PySetObject\n\nThis subtype of *note PyObject: 6b1. is used to hold the internal\ndata for both *note set: 39d. and *note frozenset: 39e. objects.\nIt is like a *note PyDictObject: 2ef. in that it is a fixed size\nfor small sets (much like tuple storage) and will point to a\nseparate, variable sized block of memory for medium and large sized\nsets (much like list storage).  None of the fields of this\nstructure should be considered public and all are subject to\nchange.  All access should be done through the documented API\nrather than by manipulating the values in the structure.\n\n-- C Variable: *note PyTypeObject: 8da. PySetType\n' Part of the *note Stable ABI: 2ac.'  This is an instance of *note\nPyTypeObject: 8da. representing the Python *note set: 39d. type.\n\n-- C Variable: *note PyTypeObject: 8da. PyFrozenSetType\n' Part of the *note Stable ABI: 2ac.'  This is an instance of *note\nPyTypeObject: 8da. representing the Python *note frozenset: 39e.\ntype.\n\nThe following type check macros work on pointers to any Python object.",
            "subsections": []
        },
        "Likewise, the constructor functions work with any iterable Python": {
            "content": "object.\n\n-- C Function: int PySetCheck (PyObject *p)\n\nReturn true if 'p' is a *note set: 39d. object or an instance of a\nsubtype.  This function always succeeds.\n\n-- C Function: int PyFrozenSetCheck (PyObject *p)\n\nReturn true if 'p' is a *note frozenset: 39e. object or an instance\nof a subtype.  This function always succeeds.\n\n-- C Function: int PyAnySetCheck (PyObject *p)\n\nReturn true if 'p' is a *note set: 39d. object, a *note frozenset:\n39e. object, or an instance of a subtype.  This function always\nsucceeds.\n\n-- C Function: int PySetCheckExact (PyObject *p)\n\nReturn true if 'p' is a *note set: 39d. object but not an instance\nof a subtype.  This function always succeeds.\n\nNew in version 3.10.\n\n-- C Function: int PyAnySetCheckExact (PyObject *p)\n\nReturn true if 'p' is a *note set: 39d. object or a *note\nfrozenset: 39e. object but not an instance of a subtype.  This\nfunction always succeeds.\n\n-- C Function: int PyFrozenSetCheckExact (PyObject *p)\n\nReturn true if 'p' is a *note frozenset: 39e. object but not an\ninstance of a subtype.  This function always succeeds.\n\n-- C Function: *note PyObject: 6b1. *PySetNew (PyObject *iterable)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a new *note set: 39d. containing objects returned by\nthe 'iterable'.  The 'iterable' may be 'NULL' to create a new empty\nset.  Return the new set on success or 'NULL' on failure.  Raise\n*note TypeError: 28e. if 'iterable' is not actually iterable.  The\nconstructor is also useful for copying a set ('c=set(s)').\n\n-- C Function: *note PyObject: 6b1. *PyFrozenSetNew (PyObject\n*iterable)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a new *note frozenset: 39e. containing objects\nreturned by the 'iterable'.  The 'iterable' may be 'NULL' to create\na new empty frozenset.  Return the new set on success or 'NULL' on\nfailure.  Raise *note TypeError: 28e. if 'iterable' is not actually\niterable.\n\nThe following functions and macros are available for instances of *note\nset: 39d. or *note frozenset: 39e. or instances of their subtypes.\n\n-- C Function: *note Pyssizet: 88d. PySetSize (PyObject *anyset)\n' Part of the *note Stable ABI: 2ac.'\n\nReturn the length of a *note set: 39d. or *note frozenset: 39e.\nobject.  Equivalent to 'len(anyset)'.  Raises a *note SystemError:\n2d7. if 'anyset' is not a *note set: 39d, *note frozenset: 39e, or\nan instance of a subtype.\n\n-- C Function: *note Pyssizet: 88d. PySetGETSIZE (PyObject *anyset)\n\nMacro form of *note PySetSize(): 12a1. without error checking.\n\n-- C Function: int PySetContains (PyObject *anyset, PyObject *key)\n' Part of the *note Stable ABI: 2ac.'  Return '1' if found, '0' if\nnot found, and '-1' if an error is encountered.  Unlike the Python\n*note contains(): 1c63. method, this function does not\nautomatically convert unhashable sets into temporary frozensets.\nRaise a *note TypeError: 28e. if the 'key' is unhashable.  Raise\n*note SystemError: 2d7. if 'anyset' is not a *note set: 39d, *note\nfrozenset: 39e, or an instance of a subtype.\n\n-- C Function: int PySetAdd (PyObject *set, PyObject *key)\n' Part of the *note Stable ABI: 2ac.'  Add 'key' to a *note set:\n39d. instance.  Also works with *note frozenset: 39e. instances\n(like *note PyTupleSetItem(): 46b9. it can be used to fill in the\nvalues of brand new frozensets before they are exposed to other\ncode).  Return '0' on success or '-1' on failure.  Raise a *note\nTypeError: 28e. if the 'key' is unhashable.  Raise a *note\nMemoryError: 13e3. if there is no room to grow.  Raise a *note\nSystemError: 2d7. if 'set' is not an instance of *note set: 39d. or\nits subtype.\n\nThe following functions are available for instances of *note set: 39d.\nor its subtypes but not for instances of *note frozenset: 39e. or its\nsubtypes.\n\n-- C Function: int PySetDiscard (PyObject *set, PyObject *key)\n' Part of the *note Stable ABI: 2ac.'  Return '1' if found and\nremoved, '0' if not found (no action taken), and '-1' if an error\nis encountered.  Does not raise *note KeyError: 8cf. for missing\nkeys.  Raise a *note TypeError: 28e. if the 'key' is unhashable.\nUnlike the Python *note discard(): 1f49. method, this function does\nnot automatically convert unhashable sets into temporary\nfrozensets.  Raise *note SystemError: 2d7. if 'set' is not an\ninstance of *note set: 39d. or its subtype.\n\n-- C Function: *note PyObject: 6b1. *PySetPop (PyObject *set)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a new reference to an arbitrary object in the 'set',\nand removes the object from the 'set'.  Return 'NULL' on failure.\nRaise *note KeyError: 8cf. if the set is empty.  Raise a *note\nSystemError: 2d7. if 'set' is not an instance of *note set: 39d. or\nits subtype.\n\n-- C Function: int PySetClear (PyObject *set)\n' Part of the *note Stable ABI: 2ac.'  Empty an existing set of all\nelements.  Return '0' on success.  Return '-1' and raise *note\nSystemError: 2d7. if 'set' is not an instance of *note set: 39d. or\nits subtype.\n\nFile: python3.12.info,  Node: Function Objects<2>,  Next: Other Objects,  Prev: Container Objects,  Up: Concrete Objects Layer\n\n\n* Menu:\n\n* Function Objects: Function Objects<3>.\n* Instance Method Objects::\n* Method Objects: Method Objects<2>.\n* Cell Objects::\n* Code Objects: Code Objects<2>.\n* Extra information::\n\nFile: python3.12.info,  Node: Function Objects<3>,  Next: Instance Method Objects,  Up: Function Objects<2>\n\n7.8.5.1 Function Objects\n........................\n\nThere are a few functions specific to Python functions.\n\n-- C Type: type PyFunctionObject\n\nThe C structure used for functions.\n\n-- C Variable: *note PyTypeObject: 8da. PyFunctionType\n\nThis is an instance of *note PyTypeObject: 8da. and represents the\nPython function type.  It is exposed to Python programmers as\n'types.FunctionType'.\n\n-- C Function: int PyFunctionCheck (PyObject *o)\n\nReturn true if 'o' is a function object (has type *note\nPyFunctionType: 4a56.).  The parameter must not be 'NULL'.  This\nfunction always succeeds.\n\n-- C Function: *note PyObject: 6b1. *PyFunctionNew (PyObject *code,\nPyObject *globals)\n'Return value: New reference.'  Return a new function object\nassociated with the code object 'code'.  'globals' must be a\ndictionary with the global variables accessible to the function.\n\nThe function's docstring and name are retrieved from the code\nobject.  *note module: 1c1d. is retrieved from 'globals'.  The\nargument defaults, annotations and closure are set to 'NULL'.\n*note qualname: 1c1b. is set to the same value as the code\nobject's *note coqualname: 1c3d. field.\n\n-- C Function: *note PyObject: 6b1. *PyFunctionNewWithQualName\n(PyObject *code, PyObject *globals, PyObject *qualname)\n'Return value: New reference.'  As *note PyFunctionNew(): 4a58,\nbut also allows setting the function object's *note qualname:\n1c1b. attribute.  'qualname' should be a unicode object or 'NULL';\nif 'NULL', the 'qualname' attribute is set to the same value as\nthe code object's *note coqualname: 1c3d. field.\n\nNew in version 3.3.\n\n-- C Function: *note PyObject: 6b1. *PyFunctionGetCode (PyObject *op)\n'Return value: Borrowed reference.'  Return the code object\nassociated with the function object 'op'.\n\n-- C Function: *note PyObject: 6b1. *PyFunctionGetGlobals (PyObject\n*op)\n'Return value: Borrowed reference.'  Return the globals dictionary\nassociated with the function object 'op'.\n\n-- C Function: *note PyObject: 6b1. *PyFunctionGetModule (PyObject\n*op)\n'Return value: Borrowed reference.'  Return a *note borrowed\nreference: 4732. to the *note module: 1c1d. attribute of the\n*note function object: 1a42. 'op'.  It can be 'NULL'.\n\nThis is normally a *note string: 157. containing the module name,\nbut can be set to any other object by Python code.\n\n-- C Function: *note PyObject: 6b1. *PyFunctionGetDefaults (PyObject\n*op)\n'Return value: Borrowed reference.'  Return the argument default\nvalues of the function object 'op'.  This can be a tuple of\narguments or 'NULL'.\n\n-- C Function: int PyFunctionSetDefaults (PyObject *op, PyObject\n*defaults)\n\nSet the argument default values for the function object 'op'.\n'defaults' must be 'PyNone' or a tuple.\n\nRaises *note SystemError: 2d7. and returns '-1' on failure.\n\n-- C Function: void PyFunctionSetVectorcall (PyFunctionObject *func,\nvectorcallfunc vectorcall)\n\nSet the vectorcall field of a given function object 'func'.\n\nWarning: extensions using this API must preserve the behavior of\nthe unaltered (default) vectorcall function!\n\nNew in version 3.12.\n\n-- C Function: *note PyObject: 6b1. *PyFunctionGetClosure (PyObject\n*op)\n'Return value: Borrowed reference.'  Return the closure associated\nwith the function object 'op'.  This can be 'NULL' or a tuple of\ncell objects.\n\n-- C Function: int PyFunctionSetClosure (PyObject *op, PyObject\n*closure)\n\nSet the closure associated with the function object 'op'.\n'closure' must be 'PyNone' or a tuple of cell objects.\n\nRaises *note SystemError: 2d7. and returns '-1' on failure.\n\n-- C Function: *note PyObject: 6b1. *PyFunctionGetAnnotations\n(PyObject *op)\n'Return value: Borrowed reference.'  Return the annotations of the\nfunction object 'op'.  This can be a mutable dictionary or 'NULL'.\n\n-- C Function: int PyFunctionSetAnnotations (PyObject *op, PyObject\n*annotations)\n\nSet the annotations for the function object 'op'.  'annotations'\nmust be a dictionary or 'PyNone'.\n\nRaises *note SystemError: 2d7. and returns '-1' on failure.\n\n-- C Function: int PyFunctionAddWatcher (PyFunctionWatchCallback\ncallback)\n\nRegister 'callback' as a function watcher for the current\ninterpreter.  Return an ID which may be passed to *note\nPyFunctionClearWatcher(): 4a63.  In case of error (e.g.  no more\nwatcher IDs available), return '-1' and set an exception.\n\nNew in version 3.12.\n\n-- C Function: int PyFunctionClearWatcher (int watcherid)\n\nClear watcher identified by 'watcherid' previously returned from\n*note PyFunctionAddWatcher(): 4a62. for the current interpreter.\nReturn '0' on success, or '-1' and set an exception on error (e.g.\nif the given 'watcherid' was never registered.)\n\nNew in version 3.12.\n\n-- C Type: type PyFunctionWatchEvent\n\nEnumeration of possible function watcher events: -\n'PyFunctionEVENTCREATE' - 'PyFunctionEVENTDESTROY' -\n'PyFunctionEVENTMODIFYCODE' - 'PyFunctionEVENTMODIFYDEFAULTS'\n- 'PyFunctionEVENTMODIFYKWDEFAULTS'\n\nNew in version 3.12.\n\n-- C Type: typedef int (*PyFunctionWatchCallback)(*note\nPyFunctionWatchEvent: 4a64. event, *note PyFunctionObject:\n2bc. *func, *note PyObject: 6b1. *newvalue)\n\nType of a function watcher callback function.\n\nIf 'event' is 'PyFunctionEVENTCREATE' or\n'PyFunctionEVENTDESTROY' then 'newvalue' will be 'NULL'.\nOtherwise, 'newvalue' will hold a *note borrowed reference: 4732.\nto the new value that is about to be stored in 'func' for the\nattribute that is being modified.\n\nThe callback may inspect but must not modify 'func'; doing so could\nhave unpredictable effects, including infinite recursion.\n\nIf 'event' is 'PyFunctionEVENTCREATE', then the callback is\ninvoked after 'func' has been fully initialized.  Otherwise, the\ncallback is invoked before the modification to 'func' takes place,\nso the prior state of 'func' can be inspected.  The runtime is\npermitted to optimize away the creation of function objects when\npossible.  In such cases no event will be emitted.  Although this\ncreates the possibility of an observable difference of runtime\nbehavior depending on optimization decisions, it does not change\nthe semantics of the Python code being executed.\n\nIf 'event' is 'PyFunctionEVENTDESTROY', Taking a reference in the\ncallback to the about-to-be-destroyed function will resurrect it,\npreventing it from being freed at this time.  When the resurrected\nobject is destroyed later, any watcher callbacks active at that\ntime will be called again.\n\nIf the callback sets an exception, it must return '-1'; this\nexception will be printed as an unraisable exception using *note\nPyErrWriteUnraisable(): 175d.  Otherwise it should return '0'.\n\nThere may already be a pending exception set on entry to the\ncallback.  In this case, the callback should return '0' with the\nsame exception still set.  This means the callback may not call any\nother API that can set an exception unless it saves and clears the\nexception state first, and restores it before returning.\n\nNew in version 3.12.\n\nFile: python3.12.info,  Node: Instance Method Objects,  Next: Method Objects<2>,  Prev: Function Objects<3>,  Up: Function Objects<2>\n\n7.8.5.2 Instance Method Objects\n...............................\n\nAn instance method is a wrapper for a *note PyCFunction: 12cd. and the\nnew way to bind a *note PyCFunction: 12cd. to a class object.  It\nreplaces the former call 'PyMethodNew(func, NULL, class)'.\n\n-- C Variable: *note PyTypeObject: 8da. PyInstanceMethodType\n\nThis instance of *note PyTypeObject: 8da. represents the Python\ninstance method type.  It is not exposed to Python programs.\n\n-- C Function: int PyInstanceMethodCheck (PyObject *o)\n\nReturn true if 'o' is an instance method object (has type *note\nPyInstanceMethodType: 4a69.).  The parameter must not be 'NULL'.\nThis function always succeeds.\n\n-- C Function: *note PyObject: 6b1. *PyInstanceMethodNew (PyObject\n*func)\n'Return value: New reference.'  Return a new instance method\nobject, with 'func' being any callable object.  'func' is the\nfunction that will be called when the instance method is called.\n\n-- C Function: *note PyObject: 6b1. *PyInstanceMethodFunction\n(PyObject *im)\n'Return value: Borrowed reference.'  Return the function object\nassociated with the instance method 'im'.\n\n-- C Function: *note PyObject: 6b1. *PyInstanceMethodGETFUNCTION\n(PyObject *im)\n'Return value: Borrowed reference.'  Macro version of *note\nPyInstanceMethodFunction(): 4a6c. which avoids error checking.\n\nFile: python3.12.info,  Node: Method Objects<2>,  Next: Cell Objects,  Prev: Instance Method Objects,  Up: Function Objects<2>\n\n7.8.5.3 Method Objects\n......................\n",
            "subsections": []
        },
        "Methods are bound function objects.  Methods are always bound to an": {
            "content": "instance of a user-defined class.  Unbound methods (methods bound to a\nclass object) are no longer available.\n\n-- C Variable: *note PyTypeObject: 8da. PyMethodType\n\nThis instance of *note PyTypeObject: 8da. represents the Python\nmethod type.  This is exposed to Python programs as\n'types.MethodType'.\n\n-- C Function: int PyMethodCheck (PyObject *o)\n\nReturn true if 'o' is a method object (has type *note\nPyMethodType: 4a70.).  The parameter must not be 'NULL'.  This\nfunction always succeeds.\n\n-- C Function: *note PyObject: 6b1. *PyMethodNew (PyObject *func,\nPyObject *self)\n'Return value: New reference.'  Return a new method object, with\n'func' being any callable object and 'self' the instance the method\nshould be bound.  'func' is the function that will be called when\nthe method is called.  'self' must not be 'NULL'.\n\n-- C Function: *note PyObject: 6b1. *PyMethodFunction (PyObject *meth)\n'Return value: Borrowed reference.'  Return the function object\nassociated with the method 'meth'.\n\n-- C Function: *note PyObject: 6b1. *PyMethodGETFUNCTION (PyObject\n*meth)\n'Return value: Borrowed reference.'  Macro version of *note\nPyMethodFunction(): 4a73. which avoids error checking.\n\n-- C Function: *note PyObject: 6b1. *PyMethodSelf (PyObject *meth)\n'Return value: Borrowed reference.'  Return the instance associated\nwith the method 'meth'.\n\n-- C Function: *note PyObject: 6b1. *PyMethodGETSELF (PyObject *meth)\n'Return value: Borrowed reference.'  Macro version of *note\nPyMethodSelf(): 4a75. which avoids error checking.\n\nFile: python3.12.info,  Node: Cell Objects,  Next: Code Objects<2>,  Prev: Method Objects<2>,  Up: Function Objects<2>\n\n7.8.5.4 Cell Objects\n....................\n\n\"Cell\" objects are used to implement variables referenced by multiple\nscopes.  For each such variable, a cell object is created to store the\nvalue; the local variables of each stack frame that references the value\ncontains a reference to the cells from outer scopes which also use that\nvariable.  When the value is accessed, the value contained in the cell\nis used instead of the cell object itself.  This de-referencing of the\ncell object requires support from the generated byte-code; these are not\nautomatically de-referenced when accessed.  Cell objects are not likely\nto be useful elsewhere.\n\n-- C Type: type PyCellObject\n\nThe C structure used for cell objects.\n\n-- C Variable: *note PyTypeObject: 8da. PyCellType\n\nThe type object corresponding to cell objects.\n\n-- C Function: int PyCellCheck (PyObject *ob)\n\nReturn true if 'ob' is a cell object; 'ob' must not be 'NULL'.\nThis function always succeeds.\n\n-- C Function: *note PyObject: 6b1. *PyCellNew (PyObject *ob)\n'Return value: New reference.'  Create and return a new cell object\ncontaining the value 'ob'.  The parameter may be 'NULL'.\n\n-- C Function: *note PyObject: 6b1. *PyCellGet (PyObject *cell)\n'Return value: New reference.'  Return the contents of the cell\n'cell'.\n\n-- C Function: *note PyObject: 6b1. *PyCellGET (PyObject *cell)\n'Return value: Borrowed reference.'  Return the contents of the\ncell 'cell', but without checking that 'cell' is non-'NULL' and a\ncell object.\n\n-- C Function: int PyCellSet (PyObject *cell, PyObject *value)\n\nSet the contents of the cell object 'cell' to 'value'.  This\nreleases the reference to any current content of the cell.  'value'\nmay be 'NULL'.  'cell' must be non-'NULL'; if it is not a cell\nobject, '-1' will be returned.  On success, '0' will be returned.\n\n-- C Function: void PyCellSET (PyObject *cell, PyObject *value)\n\nSets the value of the cell object 'cell' to 'value'.  No reference\ncounts are adjusted, and no checks are made for safety; 'cell' must\nbe non-'NULL' and must be a cell object.\n\nFile: python3.12.info,  Node: Code Objects<2>,  Next: Extra information,  Prev: Cell Objects,  Up: Function Objects<2>\n\n7.8.5.5 Code Objects\n....................\n",
            "subsections": []
        },
        "Code objects are a low-level detail of the CPython implementation.  Each": {
            "content": "one represents a chunk of executable code that hasn't yet been bound\ninto a function.\n\n-- C Type: type PyCodeObject\n\nThe C structure of the objects used to describe code objects.  The\nfields of this type are subject to change at any time.\n\n-- C Variable: *note PyTypeObject: 8da. PyCodeType\n\nThis is an instance of *note PyTypeObject: 8da. representing the\nPython *note code object: 59f.\n\n-- C Function: int PyCodeCheck (PyObject *co)\n\nReturn true if 'co' is a *note code object: 59f.  This function\nalways succeeds.\n\n-- C Function: *note Pyssizet: 88d. PyCodeGetNumFree (PyCodeObject\n*co)\n\nReturn the number of free variables in a code object.\n\n-- C Function: int PyCodeGetFirstFree (PyCodeObject *co)\n\nReturn the position of the first free variable in a code object.\n\n-- C Function: *note PyCodeObject: 562. *PyUnstableCodeNew (int\nargcount, int kwonlyargcount, int nlocals, int stacksize, int\nflags, PyObject *code, PyObject *consts, PyObject *names,\nPyObject *varnames, PyObject *freevars, PyObject *cellvars,\nPyObject *filename, PyObject *name, PyObject *qualname, int\nfirstlineno, PyObject *linetable, PyObject *exceptiontable)\n\nThis is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 29f. It may change without warning in minor releases.':\nReturn a new code object.  If you need a dummy code object to\ncreate a frame, use *note PyCodeNewEmpty(): 11ca. instead.\n\nSince the definition of the bytecode changes often, calling *note\nPyUnstableCodeNew(): 4a86. directly can bind you to a precise\nPython version.\n\nThe many arguments of this function are inter-dependent in complex\nways, meaning that subtle changes to values are likely to result in\nincorrect execution or VM crashes.  Use this function only with\nextreme care.\n\nChanged in version 3.11: Added 'qualname' and 'exceptiontable'\nparameters.\n\nChanged in version 3.12: Renamed from 'PyCodeNew' as part of *note\nUnstable C API: 29f.  The old name is deprecated, but will remain\navailable until the signature changes again.\n\n-- C Function: *note PyCodeObject: 562.\n*PyUnstableCodeNewWithPosOnlyArgs (int argcount, int\nposonlyargcount, int kwonlyargcount, int nlocals, int\nstacksize, int flags, PyObject *code, PyObject *consts,\nPyObject *names, PyObject *varnames, PyObject *freevars,\nPyObject *cellvars, PyObject *filename, PyObject *name,\nPyObject *qualname, int firstlineno, PyObject *linetable,\nPyObject *exceptiontable)\n\nThis is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 29f. It may change without warning in minor releases.':\nSimilar to *note PyUnstableCodeNew(): 4a86, but with an extra\n\"posonlyargcount\" for positional-only arguments.  The same caveats\nthat apply to 'PyUnstableCodeNew' also apply to this function.\n\nNew in version 3.8: as 'PyCodeNewWithPosOnlyArgs'\n\nChanged in version 3.11: Added 'qualname' and 'exceptiontable'\nparameters.\n\nChanged in version 3.12: Renamed to\n'PyUnstableCodeNewWithPosOnlyArgs'.  The old name is deprecated,\nbut will remain available until the signature changes again.\n\n-- C Function: *note PyCodeObject: 562. *PyCodeNewEmpty (const char\n*filename, const char *funcname, int firstlineno)\n'Return value: New reference.'  Return a new empty code object with\nthe specified filename, function name, and first line number.  The\nresulting code object will raise an 'Exception' if executed.\n\n-- C Function: int PyCodeAddr2Line (PyCodeObject *co, int byteoffset)\n\nReturn the line number of the instruction that occurs on or before\n'byteoffset' and ends after it.  If you just need the line number\nof a frame, use *note PyFrameGetLineNumber(): 577. instead.\n\nFor efficiently iterating over the line numbers in a code object,\nuse the API described in PEP 626(1).\n\n-- C Function: int PyCodeAddr2Location (PyObject *co, int byteoffset,\nint *startline, int *startcolumn, int *endline, int\n*endcolumn)\n\nSets the passed 'int' pointers to the source code line and column\nnumbers for the instruction at 'byteoffset'.  Sets the value to\n'0' when information is not available for any particular element.\n\nReturns '1' if the function succeeds and 0 otherwise.\n\nNew in version 3.11.\n\n-- C Function: *note PyObject: 6b1. *PyCodeGetCode (PyCodeObject *co)\n\nEquivalent to the Python code 'getattr(co, 'cocode')'.  Returns a\nstrong reference to a *note PyBytesObject: 582. representing the\nbytecode in a code object.  On error, 'NULL' is returned and an\nexception is raised.\n\nThis 'PyBytesObject' may be created on-demand by the interpreter\nand does not necessarily represent the bytecode actually executed\nby CPython.  The primary use case for this function is debuggers\nand profilers.\n\nNew in version 3.11.\n\n-- C Function: *note PyObject: 6b1. *PyCodeGetVarnames (PyCodeObject\n*co)\n\nEquivalent to the Python code 'getattr(co, 'covarnames')'.\nReturns a new reference to a *note PyTupleObject: 490b. containing\nthe names of the local variables.  On error, 'NULL' is returned and\nan exception is raised.\n\nNew in version 3.11.\n\n-- C Function: *note PyObject: 6b1. *PyCodeGetCellvars (PyCodeObject\n*co)\n\nEquivalent to the Python code 'getattr(co, 'cocellvars')'.\nReturns a new reference to a *note PyTupleObject: 490b. containing\nthe names of the local variables that are referenced by nested\nfunctions.  On error, 'NULL' is returned and an exception is\nraised.\n\nNew in version 3.11.\n\n-- C Function: *note PyObject: 6b1. *PyCodeGetFreevars (PyCodeObject\n*co)\n\nEquivalent to the Python code 'getattr(co, 'cofreevars')'.\nReturns a new reference to a *note PyTupleObject: 490b. containing\nthe names of the free variables.  On error, 'NULL' is returned and\nan exception is raised.\n\nNew in version 3.11.\n\n-- C Function: int PyCodeAddWatcher (PyCodeWatchCallback callback)\n\nRegister 'callback' as a code object watcher for the current\ninterpreter.  Return an ID which may be passed to *note\nPyCodeClearWatcher(): 2c2.  In case of error (e.g.  no more\nwatcher IDs available), return '-1' and set an exception.\n\nNew in version 3.12.\n\n-- C Function: int PyCodeClearWatcher (int watcherid)\n\nClear watcher identified by 'watcherid' previously returned from\n*note PyCodeAddWatcher(): 2c1. for the current interpreter.\nReturn '0' on success, or '-1' and set an exception on error (e.g.\nif the given 'watcherid' was never registered.)\n\nNew in version 3.12.\n\n-- C Type: type PyCodeEvent\n\nEnumeration of possible code object watcher events: -\n'PYCODEEVENTCREATE' - 'PYCODEEVENTDESTROY'\n\nNew in version 3.12.\n\n-- C Type: typedef int (*PyCodeWatchCallback)(*note PyCodeEvent: 4a88.\nevent, *note PyCodeObject: 562. *co)\n\nType of a code object watcher callback function.\n\nIf 'event' is 'PYCODEEVENTCREATE', then the callback is invoked\nafter 'co' has been fully initialized.  Otherwise, the callback is\ninvoked before the destruction of 'co' takes place, so the prior\nstate of 'co' can be inspected.\n\nIf 'event' is 'PYCODEEVENTDESTROY', taking a reference in the\ncallback to the about-to-be-destroyed code object will resurrect it\nand prevent it from being freed at this time.  When the resurrected\nobject is destroyed later, any watcher callbacks active at that\ntime will be called again.\n\nUsers of this API should not rely on internal runtime\nimplementation details.  Such details may include, but are not\nlimited to, the exact order and timing of creation and destruction\nof code objects.  While changes in these details may result in\ndifferences observable by watchers (including whether a callback is\ninvoked or not), it does not change the semantics of the Python\ncode being executed.\n\nIf the callback sets an exception, it must return '-1'; this\nexception will be printed as an unraisable exception using *note\nPyErrWriteUnraisable(): 175d.  Otherwise it should return '0'.\n\nThere may already be a pending exception set on entry to the\ncallback.  In this case, the callback should return '0' with the\nsame exception still set.  This means the callback may not call any\nother API that can set an exception unless it saves and clears the\nexception state first, and restores it before returning.\n\nNew in version 3.12.\n\n---------- Footnotes ----------\n\n(1)\nhttps://peps.python.org/pep-0626/#out-of-process-debuggers-and-profilers\n\nFile: python3.12.info,  Node: Extra information,  Prev: Code Objects<2>,  Up: Function Objects<2>\n\n7.8.5.6 Extra information\n.........................\n",
            "subsections": []
        },
        "To support low-level extensions to frame evaluation, such as external": {
            "content": "just-in-time compilers, it is possible to attach arbitrary extra data to\ncode objects.\n",
            "subsections": []
        },
        "These functions are part of the unstable C API tier: this functionality": {
            "content": "is a CPython implementation detail, and the API may change without\ndeprecation warnings.\n\n-- C Function: *note Pyssizet: 88d.\nPyUnstableEvalRequestCodeExtraIndex (freefunc free)\n\nThis is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 29f. It may change without warning in minor releases.':\nReturn a new an opaque index value used to adding data to code\nobjects.\n\nYou generally call this function once (per interpreter) and use the\nresult with 'PyCodeGetExtra' and 'PyCodeSetExtra' to manipulate\ndata on individual code objects.\n\nIf 'free' is not 'NULL': when a code object is deallocated, 'free'\nwill be called on non-'NULL' data stored under the new index.  Use\n*note PyDecRef(): 489f. when storing *note PyObject: 6b1.\n\nNew in version 3.6: as 'PyEvalRequestCodeExtraIndex'\n\nChanged in version 3.12: Renamed to\n'PyUnstableEvalRequestCodeExtraIndex'.  The old private name is\ndeprecated, but will be available until the API changes.\n\n-- C Function: int PyUnstableCodeGetExtra (PyObject *code, Pyssizet\nindex, void extra)\n\nThis is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 29f. It may change without warning in minor releases.':\nSet 'extra' to the extra data stored under the given index.  Return\n0 on success.  Set an exception and return -1 on failure.\n\nIf no data was set under the index, set 'extra' to 'NULL' and\nreturn 0 without setting an exception.\n\nNew in version 3.6: as 'PyCodeGetExtra'\n\nChanged in version 3.12: Renamed to 'PyUnstableCodeGetExtra'.\nThe old private name is deprecated, but will be available until the\nAPI changes.\n\n-- C Function: int PyUnstableCodeSetExtra (PyObject *code, Pyssizet\nindex, void *extra)\n\nThis is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 29f. It may change without warning in minor releases.':\nSet the extra data stored under the given index to 'extra'.  Return\n0 on success.  Set an exception and return -1 on failure.\n\nNew in version 3.6: as 'PyCodeSetExtra'\n\nChanged in version 3.12: Renamed to 'PyUnstableCodeSetExtra'.\nThe old private name is deprecated, but will be available until the\nAPI changes.\n\nFile: python3.12.info,  Node: Other Objects,  Prev: Function Objects<2>,  Up: Concrete Objects Layer\n\n\n* Menu:\n\n* File Objects::\n* Module Objects::\n* Iterator Objects::\n* Descriptor Objects::\n* Slice Objects::\n* MemoryView objects::\n* Weak Reference Objects: Weak Reference Objects<2>.\n* Capsules: Capsules<2>.\n* Frame Objects::\n* Generator Objects::\n* Coroutine Objects: Coroutine Objects<2>.\n* Context Variables Objects::\n* DateTime Objects: DateTime Objects<2>.\n* Objects for Type Hinting::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: File Objects,  Next: Module Objects,  Up: Other Objects": {
            "content": "7.8.6.1 File Objects\n....................\n",
            "subsections": []
        },
        "These APIs are a minimal emulation of the Python 2 C API for built-in": {
            "content": "file objects, which used to rely on the buffered I/O (FILE*) support\nfrom the C standard library.  In Python 3, files and streams use the new\n*note io: 79. module, which defines several layers over the low-level\nunbuffered I/O of the operating system.  The functions described below\nare convenience C wrappers over these new APIs, and meant mostly for\ninternal error reporting in the interpreter; third-party code is advised\nto access the *note io: 79. APIs instead.\n\n-- C Function: *note PyObject: 6b1. *PyFileFromFd (int fd, const char\n*name, const char *mode, int buffering, const char *encoding,\nconst char *errors, const char *newline, int closefd)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Create a Python file object from the file descriptor of an\nalready opened file 'fd'.  The arguments 'name', 'encoding',\n'errors' and 'newline' can be 'NULL' to use the defaults;\n'buffering' can be '-1' to use the default.  'name' is ignored and\nkept for backward compatibility.  Return 'NULL' on failure.  For a\nmore comprehensive description of the arguments, please refer to\nthe *note io.open(): 26f. function documentation.\n\nWarning: Since Python streams have their own buffering layer,\nmixing them with OS-level file descriptors can produce various\nissues (such as unexpected ordering of data).\n\nChanged in version 3.2: Ignore 'name' attribute.\n\n-- C Function: int PyObjectAsFileDescriptor (PyObject *p)\n' Part of the *note Stable ABI: 2ac.'  Return the file descriptor\nassociated with 'p' as an int.  If the object is an integer, its\nvalue is returned.  If not, the object's *note fileno(): 2542.\nmethod is called if it exists; the method must return an integer,\nwhich is returned as the file descriptor value.  Sets an exception\nand returns '-1' on failure.\n\n-- C Function: *note PyObject: 6b1. *PyFileGetLine (PyObject *p, int\nn)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'\n\nEquivalent to 'p.readline([n])', this function reads one line from\nthe object 'p'.  'p' may be a file object or any object with a\n*note readline(): 11a1. method.  If 'n' is '0', exactly one line is\nread, regardless of the length of the line.  If 'n' is greater than\n'0', no more than 'n' bytes will be read from the file; a partial\nline can be returned.  In both cases, an empty string is returned\nif the end of the file is reached immediately.  If 'n' is less than\n'0', however, one line is read regardless of length, but *note\nEOFError: 114e. is raised if the end of the file is reached\nimmediately.\n\n-- C Function: int PyFileSetOpenCodeHook (PyOpenCodeHookFunction\nhandler)\n\nOverrides the normal behavior of *note io.opencode(): 146a. to\npass its parameter through the provided handler.\n\nThe handler is a function of type:\n\n-- C Type: type PyOpenCodeHookFunction\n\nEquivalent of *note PyObject: 6b1. *(*)(*note PyObject: 6b1.\n*path, void *userData), where 'path' is guaranteed to be *note\nPyUnicodeObject: 584.\n\nThe 'userData' pointer is passed into the hook function.  Since\nhook functions may be called from different runtimes, this pointer\nshould not refer directly to Python state.\n\nAs this hook is intentionally used during import, avoid importing\nnew modules during its execution unless they are known to be frozen\nor available in 'sys.modules'.\n\nOnce a hook has been set, it cannot be removed or replaced, and\nlater calls to *note PyFileSetOpenCodeHook(): 146e. will fail.  On\nfailure, the function returns -1 and sets an exception if the\ninterpreter has been initialized.\n\nThis function is safe to call before *note PyInitialize(): 6c2.\n\nRaises an *note auditing event: 161d. 'setopencodehook' with no\narguments.\n\nNew in version 3.8.\n\n-- C Function: int PyFileWriteObject (PyObject *obj, PyObject *p, int\nflags)\n' Part of the *note Stable ABI: 2ac.'\n\nWrite object 'obj' to file object 'p'.  The only supported flag for\n'flags' is *note PyPRINTRAW: 4944.; if given, the *note str():\n157. of the object is written instead of the *note repr(): 5f0.\nReturn '0' on success or '-1' on failure; the appropriate exception\nwill be set.\n\n-- C Function: int PyFileWriteString (const char *s, PyObject *p)\n' Part of the *note Stable ABI: 2ac.'  Write string 's' to file\nobject 'p'.  Return '0' on success or '-1' on failure; the\nappropriate exception will be set.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Module Objects,  Next: Iterator Objects,  Prev: File Objects,  Up: Other Objects": {
            "content": "7.8.6.2 Module Objects\n......................\n\n-- C Variable: *note PyTypeObject: 8da. PyModuleType\n' Part of the *note Stable ABI: 2ac.'\n\nThis instance of *note PyTypeObject: 8da. represents the Python\nmodule type.  This is exposed to Python programs as\n'types.ModuleType'.\n\n-- C Function: int PyModuleCheck (PyObject *p)\n\nReturn true if 'p' is a module object, or a subtype of a module\nobject.  This function always succeeds.\n\n-- C Function: int PyModuleCheckExact (PyObject *p)\n\nReturn true if 'p' is a module object, but not a subtype of *note\nPyModuleType: 47f0.  This function always succeeds.\n\n-- C Function: *note PyObject: 6b1. *PyModuleNewObject (PyObject\n*name)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\nsince version 3.7.'\n\nReturn a new module object with the *note name: 11fd. attribute\nset to 'name'.  The module's *note name: 11fd, 'doc', *note\npackage: e94, and *note loader: e95. attributes are filled\nin (all but *note name: 11fd. are set to 'None'); the caller is\nresponsible for providing a *note file: 1c32. attribute.\n\nNew in version 3.3.\n\nChanged in version 3.4: *note package: e94. and *note\nloader: e95. are set to 'None'.\n\n-- C Function: *note PyObject: 6b1. *PyModuleNew (const char *name)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Similar to *note PyModuleNewObject(): 47ee, but the name is\na UTF-8 encoded string instead of a Unicode object.\n\n-- C Function: *note PyObject: 6b1. *PyModuleGetDict (PyObject\n*module)\n'Return value: Borrowed reference.''  Part of the *note Stable ABI:\n2ac.'\n\nReturn the dictionary object that implements 'module''s namespace;\nthis object is the same as the *note dict: aa8. attribute of\nthe module object.  If 'module' is not a module object (or a\nsubtype of a module object), *note SystemError: 2d7. is raised and\n'NULL' is returned.\n\nIt is recommended extensions use other 'PyModule*' and\n'PyObject*' functions rather than directly manipulate a module's\n*note dict: aa8.\n\n-- C Function: *note PyObject: 6b1. *PyModuleGetNameObject (PyObject\n*module)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\nsince version 3.7.'\n\nReturn 'module''s *note name: 11fd. value.  If the module does\nnot provide one, or if it is not a string, *note SystemError: 2d7.\nis raised and 'NULL' is returned.\n\nNew in version 3.3.\n\n-- C Function: const char *PyModuleGetName (PyObject *module)\n' Part of the *note Stable ABI: 2ac.'  Similar to *note\nPyModuleGetNameObject(): 47ec. but return the name encoded to\n''utf-8''.\n\n-- C Function: void *PyModuleGetState (PyObject *module)\n' Part of the *note Stable ABI: 2ac.'  Return the \"state\" of the\nmodule, that is, a pointer to the block of memory allocated at\nmodule creation time, or 'NULL'.  See *note PyModuleDef.msize:\n7a3.\n\n-- C Function: *note PyModuleDef: 7a1. *PyModuleGetDef (PyObject\n*module)\n' Part of the *note Stable ABI: 2ac.'  Return a pointer to the\n*note PyModuleDef: 7a1. struct from which the module was created,\nor 'NULL' if the module wasn't created from a definition.\n\n-- C Function: *note PyObject: 6b1. *PyModuleGetFilenameObject\n(PyObject *module)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'\n\nReturn the name of the file from which 'module' was loaded using\n'module''s *note file: 1c32. attribute.  If this is not\ndefined, or if it is not a unicode string, raise *note SystemError:\n2d7. and return 'NULL'; otherwise return a reference to a Unicode\nobject.\n\nNew in version 3.2.\n\n-- C Function: const char *PyModuleGetFilename (PyObject *module)\n' Part of the *note Stable ABI: 2ac.'  Similar to *note\nPyModuleGetFilenameObject(): 339. but return the filename encoded\nto 'utf-8'.\n\nDeprecated since version 3.2: *note PyModuleGetFilename(): 338.\nraises *note UnicodeEncodeError: 442. on unencodable filenames, use\n*note PyModuleGetFilenameObject(): 339. instead.\n\n* Menu:\n\n* Initializing C modules::\n* Module lookup::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Initializing C modules,  Next: Module lookup,  Up: Module Objects": {
            "content": "7.8.6.3 Initializing C modules\n..............................\n",
            "subsections": []
        },
        "Modules objects are usually created from extension modules (shared": {
            "content": "libraries which export an initialization function), or compiled-in\nmodules (where the initialization function is added using *note\nPyImportAppendInittab(): 14f8.).  See *note Building C and C++\nExtensions: 46a5. or *note Extending Embedded Python: 4718. for details.\n",
            "subsections": []
        },
        "The initialization function can either pass a module definition instance": {
            "content": "to *note PyModuleCreate(): 46a2, and return the resulting module\nobject, or request \"multi-phase initialization\" by returning the\ndefinition struct itself.\n\n-- C Type: type PyModuleDef\n' Part of the *note Stable ABI: 2ac. (including all members).'  The\nmodule definition struct, which holds all information needed to\ncreate a module object.  There is usually only one statically\ninitialized variable of this type for each module.\n\n-- C Member: PyModuleDefBase mbase\n\nAlways initialize this member to 'PyModuleDefHEADINIT'.\n\n-- C Member: const char *mname\n\nName for the new module.\n\n-- C Member: const char *mdoc\n\nDocstring for the module; usually a docstring variable created\nwith *note PyDocSTRVAR: 16df. is used.\n\n-- C Member: *note Pyssizet: 88d. msize\n\nModule state may be kept in a per-module memory area that can\nbe retrieved with *note PyModuleGetState(): 7a4, rather than\nin static globals.  This makes modules safe for use in\nmultiple sub-interpreters.\n\nThis memory area is allocated based on 'msize' on module\ncreation, and freed when the module object is deallocated,\nafter the *note mfree: 7a0. function has been called, if\npresent.\n\nSetting 'msize' to '-1' means that the module does not\nsupport sub-interpreters, because it has global state.\n\nSetting it to a non-negative value means that the module can\nbe re-initialized and specifies the additional amount of\nmemory it requires for its state.  Non-negative 'msize' is\nrequired for multi-phase initialization.\n\nSee PEP 3121(1) for more details.\n\n-- C Member: *note PyMethodDef: 1332. *mmethods\n\nA pointer to a table of module-level functions, described by\n*note PyMethodDef: 1332. values.  Can be 'NULL' if no\nfunctions are present.\n\n-- C Member: *note PyModuleDefSlot: 4a9e. *mslots\n\nAn array of slot definitions for multi-phase initialization,\nterminated by a '{0, NULL}' entry.  When using single-phase\ninitialization, 'mslots' must be 'NULL'.\n\nChanged in version 3.5: Prior to version 3.5, this member was\nalways set to 'NULL', and was defined as:\n\n-- C Member: *note inquiry: 48b8. mreload\n\n-- C Member: *note traverseproc: 48c7. mtraverse\n\nA traversal function to call during GC traversal of the module\nobject, or 'NULL' if not needed.\n\nThis function is not called if the module state was requested\nbut is not allocated yet.  This is the case immediately after\nthe module is created and before the module is executed (*note\nPymodexec: 7a2. function).  More precisely, this function is\nnot called if *note msize: 7a3. is greater than 0 and the\nmodule state (as returned by *note PyModuleGetState(): 7a4.)\nis 'NULL'.\n\nChanged in version 3.9: No longer called before the module\nstate is allocated.\n\n-- C Member: *note inquiry: 48b8. mclear\n\nA clear function to call during GC clearing of the module\nobject, or 'NULL' if not needed.\n\nThis function is not called if the module state was requested\nbut is not allocated yet.  This is the case immediately after\nthe module is created and before the module is executed (*note\nPymodexec: 7a2. function).  More precisely, this function is\nnot called if *note msize: 7a3. is greater than 0 and the\nmodule state (as returned by *note PyModuleGetState(): 7a4.)\nis 'NULL'.\n\nLike *note PyTypeObject.tpclear: 46e3, this function is not\n'always' called before a module is deallocated.  For example,\nwhen reference counting is enough to determine that an object\nis no longer used, the cyclic garbage collector is not\ninvolved and *note mfree: 7a0. is called directly.\n\nChanged in version 3.9: No longer called before the module\nstate is allocated.\n\n-- C Member: *note freefunc: 4aa0. mfree\n\nA function to call during deallocation of the module object,\nor 'NULL' if not needed.\n\nThis function is not called if the module state was requested\nbut is not allocated yet.  This is the case immediately after\nthe module is created and before the module is executed (*note\nPymodexec: 7a2. function).  More precisely, this function is\nnot called if *note msize: 7a3. is greater than 0 and the\nmodule state (as returned by *note PyModuleGetState(): 7a4.)\nis 'NULL'.\n\nChanged in version 3.9: No longer called before the module\nstate is allocated.\n\n* Menu:\n\n* Single-phase initialization::\n* Multi-phase initialization::\n* Low-level module creation functions::\n* Support functions::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3121/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Single-phase initialization,  Next: Multi-phase initialization,  Up: Initializing C modules": {
            "content": "7.8.6.4 Single-phase initialization\n...................................\n",
            "subsections": []
        },
        "The module initialization function may create and return the module": {
            "content": "object directly.  This is referred to as \"single-phase initialization\",\nand uses one of the following two module creation functions:\n\n-- C Function: *note PyObject: 6b1. *PyModuleCreate (PyModuleDef *def)\n'Return value: New reference.'  Create a new module object, given\nthe definition in 'def'.  This behaves like *note\nPyModuleCreate2(): 47e8. with 'moduleapiversion' set to\n'PYTHONAPIVERSION'.\n\n-- C Function: *note PyObject: 6b1. *PyModuleCreate2 (PyModuleDef\n*def, int moduleapiversion)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Create a new module object, given the definition in 'def',\nassuming the API version 'moduleapiversion'.  If that version\ndoes not match the version of the running interpreter, a *note\nRuntimeWarning: 8c9. is emitted.\n\nNote: Most uses of this function should be using *note\nPyModuleCreate(): 46a2. instead; only use this if you are\nsure you need it.\n",
            "subsections": []
        },
        "Before it is returned from in the initialization function, the resulting": {
            "content": "module object is typically populated using functions like *note\nPyModuleAddObjectRef(): 6a9.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Multi-phase initialization,  Next: Low-level module creation functions,  Prev: Single-phase initialization,  Up: Initializing C modules": {
            "content": "7.8.6.5 Multi-phase initialization\n..................................\n\nAn alternate way to specify extensions is to request \"multi-phase\ninitialization\".  Extension modules created this way behave more like",
            "subsections": []
        },
        "Python modules: the initialization is split between the 'creation": {
            "content": "phase', when the module object is created, and the 'execution phase',\nwhen it is populated.  The distinction is similar to the 'new()' and\n'init()' methods of classes.\n",
            "subsections": []
        },
        "Unlike modules created using single-phase initialization, these modules": {
            "content": "are not singletons: if the 'sys.modules' entry is removed and the module\nis re-imported, a new module object is created, and the old module is\nsubject to normal garbage collection - as with Python modules.  By\ndefault, multiple modules created from the same definition should be\nindependent: changes to one should not affect the others.  This means\nthat all state should be specific to the module object (using e.g.\nusing *note PyModuleGetState(): 7a4.), or its contents (such as the\nmodule's *note dict: aa8. or individual classes created with *note\nPyTypeFromSpec(): 2df.).\n",
            "subsections": []
        },
        "All modules created using multi-phase initialization are expected to": {
            "content": "support *note sub-interpreters: 2e9.  Making sure multiple modules are\nindependent is typically enough to achieve this.\n",
            "subsections": []
        },
        "To request multi-phase initialization, the initialization function": {
            "content": "(PyInitmodulename) returns a *note PyModuleDef: 7a1. instance with\nnon-empty *note mslots: 4a9d.  Before it is returned, the 'PyModuleDef'\ninstance must be initialized with the following function:\n\n-- C Function: *note PyObject: 6b1. *PyModuleDefInit (PyModuleDef\n*def)\n'Return value: Borrowed reference.''  Part of the *note Stable ABI:\n2ac. since version 3.5.'  Ensures a module definition is a properly\ninitialized Python object that correctly reports its type and\nreference count.\n\nReturns 'def' cast to 'PyObject*', or 'NULL' if an error occurred.\n\nNew in version 3.5.\n",
            "subsections": []
        },
        "The 'mslots' member of the module definition must point to an array of": {
            "content": "'PyModuleDefSlot' structures:\n\n-- C Type: type PyModuleDefSlot\n\n-- C Member: int slot\n\nA slot ID, chosen from the available values explained below.\n\n-- C Member: void *value\n\nValue of the slot, whose meaning depends on the slot ID.\n\nNew in version 3.5.\n\nThe 'mslots' array must be terminated by a slot with id 0.\n\nThe available slot types are:\n\n-- C Macro: Pymodcreate\n\nSpecifies a function that is called to create the module object\nitself.  The 'value' pointer of this slot must point to a function\nof the signature:\n\n-- C Function: *note PyObject: 6b1. *createmodule (PyObject\n*spec, PyModuleDef *def)\n\nThe function receives a *note ModuleSpec: 1d07. instance, as\ndefined in PEP 451(1), and the module definition.  It should return\na new module object, or set an error and return 'NULL'.\n\nThis function should be kept minimal.  In particular, it should not\ncall arbitrary Python code, as trying to import the same module\nagain may result in an infinite loop.\n\nMultiple 'Pymodcreate' slots may not be specified in one module\ndefinition.\n\nIf 'Pymodcreate' is not specified, the import machinery will\ncreate a normal module object using *note PyModuleNew(): 47ed.\nThe name is taken from 'spec', not the definition, to allow\nextension modules to dynamically adjust to their place in the\nmodule hierarchy and be imported under different names through\nsymlinks, all while sharing a single module definition.\n\nThere is no requirement for the returned object to be an instance\nof *note PyModuleType: 47f0.  Any type can be used, as long as it\nsupports setting and getting import-related attributes.  However,\nonly 'PyModuleType' instances may be returned if the 'PyModuleDef'\nhas non-'NULL' 'mtraverse', 'mclear', 'mfree'; non-zero\n'msize'; or slots other than 'Pymodcreate'.\n\n-- C Macro: Pymodexec\n\nSpecifies a function that is called to 'execute' the module.  This\nis equivalent to executing the code of a Python module: typically,\nthis function adds classes and constants to the module.  The\nsignature of the function is:\n\n-- C Function: int execmodule (PyObject *module)\n\nIf multiple 'Pymodexec' slots are specified, they are processed\nin the order they appear in the 'mslots' array.\n\n-- C Macro: Pymodmultipleinterpreters\n\nSpecifies one of the following values:\n\n-- C Macro: PyMODMULTIPLEINTERPRETERSNOTSUPPORTED\n\nThe module does not support being imported in subinterpreters.\n\n-- C Macro: PyMODMULTIPLEINTERPRETERSSUPPORTED\n\nThe module supports being imported in subinterpreters, but\nonly when they share the main interpreter's GIL. (See *note\nIsolating Extension Modules: 4aa9.)\n\n-- C Macro: PyMODPERINTERPRETERGILSUPPORTED\n\nThe module supports being imported in subinterpreters, even\nwhen they have their own GIL. (See *note Isolating Extension\nModules: 4aa9.)\n\nThis slot determines whether or not importing this module in a\nsubinterpreter will fail.\n\nMultiple 'Pymodmultipleinterpreters' slots may not be specified\nin one module definition.\n\nIf 'Pymodmultipleinterpreters' is not specified, the import\nmachinery defaults to 'PyMODMULTIPLEINTERPRETERSNOTSUPPORTED'.\n\nNew in version 3.12.\n\nSee PEP 489(2) for more details on multi-phase initialization.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0451/\n\n(2) https://peps.python.org/pep-0489/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Low-level module creation functions,  Next: Support functions,  Prev: Multi-phase initialization,  Up: Initializing C modules": {
            "content": "7.8.6.6 Low-level module creation functions\n...........................................\n",
            "subsections": []
        },
        "The following functions are called under the hood when using multi-phase": {
            "content": "initialization.  They can be used directly, for example when creating\nmodule objects dynamically.  Note that both 'PyModuleFromDefAndSpec'\nand 'PyModuleExecDef' must be called to fully initialize a module.\n\n-- C Function: *note PyObject: 6b1. *PyModuleFromDefAndSpec\n(PyModuleDef *def, PyObject *spec)\n'Return value: New reference.'  Create a new module object, given\nthe definition in 'def' and the ModuleSpec 'spec'.  This behaves\nlike *note PyModuleFromDefAndSpec2(): d18. with\n'moduleapiversion' set to 'PYTHONAPIVERSION'.\n\nNew in version 3.5.\n\n-- C Function: *note PyObject: 6b1. *PyModuleFromDefAndSpec2\n(PyModuleDef *def, PyObject *spec, int moduleapiversion)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\nsince version 3.7.'  Create a new module object, given the\ndefinition in 'def' and the ModuleSpec 'spec', assuming the API\nversion 'moduleapiversion'.  If that version does not match the\nversion of the running interpreter, a *note RuntimeWarning: 8c9. is\nemitted.\n\nNote: Most uses of this function should be using *note\nPyModuleFromDefAndSpec(): d17. instead; only use this if you\nare sure you need it.\n\nNew in version 3.5.\n\n-- C Function: int PyModuleExecDef (PyObject *module, PyModuleDef\n*def)\n' Part of the *note Stable ABI: 2ac. since version 3.7.'  Process\nany execution slots (*note Pymodexec: 7a2.) given in 'def'.\n\nNew in version 3.5.\n\n-- C Function: int PyModuleSetDocString (PyObject *module, const char\n*docstring)\n' Part of the *note Stable ABI: 2ac. since version 3.7.'  Set the\ndocstring for 'module' to 'docstring'.  This function is called\nautomatically when creating a module from 'PyModuleDef', using\neither 'PyModuleCreate' or 'PyModuleFromDefAndSpec'.\n\nNew in version 3.5.\n\n-- C Function: int PyModuleAddFunctions (PyObject *module, PyMethodDef\n*functions)\n' Part of the *note Stable ABI: 2ac. since version 3.7.'  Add the\nfunctions from the 'NULL' terminated 'functions' array to 'module'.\nRefer to the *note PyMethodDef: 1332. documentation for details on\nindividual entries (due to the lack of a shared module namespace,\nmodule level \"functions\" implemented in C typically receive the\nmodule as their first parameter, making them similar to instance\nmethods on Python classes).  This function is called automatically\nwhen creating a module from 'PyModuleDef', using either\n'PyModuleCreate' or 'PyModuleFromDefAndSpec'.\n\nNew in version 3.5.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Support functions,  Prev: Low-level module creation functions,  Up: Initializing C modules": {
            "content": "7.8.6.7 Support functions\n.........................\n",
            "subsections": []
        },
        "The module initialization function (if using single phase": {
            "content": "initialization) or a function called from a module execution slot (if\nusing multi-phase initialization), can use the following functions to\nhelp initialize the module state:\n\n-- C Function: int PyModuleAddObjectRef (PyObject *module, const char\n*name, PyObject *value)\n' Part of the *note Stable ABI: 2ac. since version 3.10.'  Add an\nobject to 'module' as 'name'.  This is a convenience function which\ncan be used from the module's initialization function.\n\nOn success, return '0'.  On error, raise an exception and return\n'-1'.\n\nReturn 'NULL' if 'value' is 'NULL'.  It must be called with an\nexception raised in this case.\n\nExample usage:\n\nstatic int\naddspam(PyObject *module, int value)\n{\nPyObject *obj = PyLongFromLong(value);\nif (obj == NULL) {\nreturn -1;\n}\nint res = PyModuleAddObjectRef(module, \"spam\", obj);\nPyDECREF(obj);\nreturn res;\n}\n\nThe example can also be written without checking explicitly if\n'obj' is 'NULL':\n\nstatic int\naddspam(PyObject *module, int value)\n{\nPyObject *obj = PyLongFromLong(value);\nint res = PyModuleAddObjectRef(module, \"spam\", obj);\nPyXDECREF(obj);\nreturn res;\n}\n\nNote that 'PyXDECREF()' should be used instead of 'PyDECREF()' in\nthis case, since 'obj' can be 'NULL'.\n\nNew in version 3.10.\n\n-- C Function: int PyModuleAddObject (PyObject *module, const char\n*name, PyObject *value)\n' Part of the *note Stable ABI: 2ac.'  Similar to *note\nPyModuleAddObjectRef(): 6a9, but steals a reference to 'value' on\nsuccess (if it returns '0').\n\nThe new *note PyModuleAddObjectRef(): 6a9. function is\nrecommended, since it is easy to introduce reference leaks by\nmisusing the *note PyModuleAddObject(): 6aa. function.\n\nNote: Unlike other functions that steal references,\n'PyModuleAddObject()' only releases the reference to 'value'\n'on success'.\n\nThis means that its return value must be checked, and calling\ncode must *note PyDECREF(): 2cf. 'value' manually on error.\n\nExample usage:\n\nstatic int\naddspam(PyObject *module, int value)\n{\nPyObject *obj = PyLongFromLong(value);\nif (obj == NULL) {\nreturn -1;\n}\nif (PyModuleAddObject(module, \"spam\", obj) < 0) {\nPyDECREF(obj);\nreturn -1;\n}\n// PyModuleAddObject() stole a reference to obj:\n// PyDECREF(obj) is not needed here\nreturn 0;\n}\n\nThe example can also be written without checking explicitly if\n'obj' is 'NULL':\n\nstatic int\naddspam(PyObject *module, int value)\n{\nPyObject *obj = PyLongFromLong(value);\nif (PyModuleAddObject(module, \"spam\", obj) < 0) {\nPyXDECREF(obj);\nreturn -1;\n}\n// PyModuleAddObject() stole a reference to obj:\n// PyDECREF(obj) is not needed here\nreturn 0;\n}\n\nNote that 'PyXDECREF()' should be used instead of 'PyDECREF()' in\nthis case, since 'obj' can be 'NULL'.\n\n-- C Function: int PyModuleAddIntConstant (PyObject *module, const\nchar *name, long value)\n' Part of the *note Stable ABI: 2ac.'  Add an integer constant to\n'module' as 'name'.  This convenience function can be used from the\nmodule's initialization function.  Return '-1' on error, '0' on\nsuccess.\n\n-- C Function: int PyModuleAddStringConstant (PyObject *module, const\nchar *name, const char *value)\n' Part of the *note Stable ABI: 2ac.'  Add a string constant to\n'module' as 'name'.  This convenience function can be used from the\nmodule's initialization function.  The string 'value' must be\n'NULL'-terminated.  Return '-1' on error, '0' on success.\n\n-- C Macro: PyModuleAddIntMacro (module, macro)\n\nAdd an int constant to 'module'.  The name and the value are taken\nfrom 'macro'.  For example 'PyModuleAddIntMacro(module, AFINET)'\nadds the int constant 'AFINET' with the value of 'AFINET' to\n'module'.  Return '-1' on error, '0' on success.\n\n-- C Macro: PyModuleAddStringMacro (module, macro)\n\nAdd a string constant to 'module'.\n\n-- C Function: int PyModuleAddType (PyObject *module, PyTypeObject\n*type)\n' Part of the *note Stable ABI: 2ac. since version 3.10.'  Add a\ntype object to 'module'.  The type object is finalized by calling\ninternally *note PyTypeReady(): 567.  The name of the type object\nis taken from the last component of *note tpname: 1657. after dot.\nReturn '-1' on error, '0' on success.\n\nNew in version 3.9.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Module lookup,  Prev: Initializing C modules,  Up: Module Objects": {
            "content": "7.8.6.8 Module lookup\n.....................\n",
            "subsections": []
        },
        "Single-phase initialization creates singleton modules that can be looked": {
            "content": "up in the context of the current interpreter.  This allows the module\nobject to be retrieved later with only a reference to the module\ndefinition.\n",
            "subsections": []
        },
        "These functions will not work on modules created using multi-phase": {
            "content": "initialization, since multiple such modules can be created from a single\ndefinition.\n\n-- C Function: *note PyObject: 6b1. *PyStateFindModule (PyModuleDef\n*def)\n'Return value: Borrowed reference.''  Part of the *note Stable ABI:\n2ac.'  Returns the module object that was created from 'def' for\nthe current interpreter.  This method requires that the module\nobject has been attached to the interpreter state with *note\nPyStateAddModule(): 4843. beforehand.  In case the corresponding\nmodule object is not found or has not been attached to the\ninterpreter state yet, it returns 'NULL'.\n\n-- C Function: int PyStateAddModule (PyObject *module, PyModuleDef\n*def)\n' Part of the *note Stable ABI: 2ac. since version 3.3.'  Attaches\nthe module object passed to the function to the interpreter state.\nThis allows the module object to be accessible via *note\nPyStateFindModule(): 4844.\n\nOnly effective on modules created using single-phase\ninitialization.\n\nPython calls 'PyStateAddModule' automatically after importing a\nmodule, so it is unnecessary (but harmless) to call it from module\ninitialization code.  An explicit call is needed only if the\nmodule's own init code subsequently calls 'PyStateFindModule'.\nThe function is mainly intended for implementing alternative import\nmechanisms (either by calling it directly, or by referring to its\nimplementation for details of the required state updates).\n\nThe caller must hold the GIL.\n\nReturn 0 on success or -1 on failure.\n\nNew in version 3.3.\n\n-- C Function: int PyStateRemoveModule (PyModuleDef *def)\n' Part of the *note Stable ABI: 2ac. since version 3.3.'  Removes\nthe module object created from 'def' from the interpreter state.\nReturn 0 on success or -1 on failure.\n\nThe caller must hold the GIL.\n\nNew in version 3.3.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Iterator Objects,  Next: Descriptor Objects,  Prev: Module Objects,  Up: Other Objects": {
            "content": "7.8.6.9 Iterator Objects\n........................\n",
            "subsections": []
        },
        "Python provides two general-purpose iterator objects.  The first, a": {
            "content": "sequence iterator, works with an arbitrary sequence supporting the *note\ngetitem(): 4b9. method.  The second works with a callable object and\na sentinel value, calling the callable for each item in the sequence,\nand ending the iteration when the sentinel value is returned.\n\n-- C Variable: *note PyTypeObject: 8da. PySeqIterType\n' Part of the *note Stable ABI: 2ac.'  Type object for iterator\nobjects returned by *note PySeqIterNew(): 482c. and the\none-argument form of the *note iter(): 5ca. built-in function for\nbuilt-in sequence types.\n\n-- C Function: int PySeqIterCheck (PyObject *op)\n\nReturn true if the type of 'op' is *note PySeqIterType: 482d.\nThis function always succeeds.\n\n-- C Function: *note PyObject: 6b1. *PySeqIterNew (PyObject *seq)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return an iterator that works with a general sequence\nobject, 'seq'.  The iteration ends when the sequence raises *note\nIndexError: 138f. for the subscripting operation.\n\n-- C Variable: *note PyTypeObject: 8da. PyCallIterType\n' Part of the *note Stable ABI: 2ac.'  Type object for iterator\nobjects returned by *note PyCallIterNew(): 4760. and the\ntwo-argument form of the *note iter(): 5ca. built-in function.\n\n-- C Function: int PyCallIterCheck (PyObject *op)\n\nReturn true if the type of 'op' is *note PyCallIterType: 4761.\nThis function always succeeds.\n\n-- C Function: *note PyObject: 6b1. *PyCallIterNew (PyObject\n*callable, PyObject *sentinel)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a new iterator.  The first parameter, 'callable', can\nbe any Python callable object that can be called with no\nparameters; each call to it should return the next item in the\niteration.  When 'callable' returns a value equal to 'sentinel',\nthe iteration will be terminated.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Descriptor Objects,  Next: Slice Objects,  Prev: Iterator Objects,  Up: Other Objects": {
            "content": "7.8.6.10 Descriptor Objects\n...........................\n\n\"Descriptors\" are objects that describe some attribute of an object.\nThey are found in the dictionary of type objects.\n\n-- C Variable: *note PyTypeObject: 8da. PyPropertyType\n' Part of the *note Stable ABI: 2ac.'  The type object for the\nbuilt-in descriptor types.\n\n-- C Function: *note PyObject: 6b1. *PyDescrNewGetSet (PyTypeObject\n*type, struct PyGetSetDef *getset)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'\n\n-- C Function: *note PyObject: 6b1. *PyDescrNewMember (PyTypeObject\n*type, struct PyMemberDef *meth)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'\n\n-- C Function: *note PyObject: 6b1. *PyDescrNewMethod (PyTypeObject\n*type, struct PyMethodDef *meth)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'\n\n-- C Function: *note PyObject: 6b1. *PyDescrNewWrapper (PyTypeObject\n*type, struct wrapperbase *wrapper, void *wrapped)\n'Return value: New reference.'\n\n-- C Function: *note PyObject: 6b1. *PyDescrNewClassMethod\n(PyTypeObject *type, PyMethodDef *method)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'\n\n-- C Function: int PyDescrIsData (PyObject *descr)\n\nReturn non-zero if the descriptor objects 'descr' describes a data\nattribute, or '0' if it describes a method.  'descr' must be a\ndescriptor object; there is no error checking.\n\n-- C Function: *note PyObject: 6b1. *PyWrapperNew (PyObject*,\nPyObject*)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Slice Objects,  Next: MemoryView objects,  Prev: Descriptor Objects,  Up: Other Objects": {
            "content": "7.8.6.11 Slice Objects\n......................\n\n-- C Variable: *note PyTypeObject: 8da. PySliceType\n' Part of the *note Stable ABI: 2ac.'  The type object for slice\nobjects.  This is the same as *note slice: 180. in the Python\nlayer.\n\n-- C Function: int PySliceCheck (PyObject *ob)\n\nReturn true if 'ob' is a slice object; 'ob' must not be 'NULL'.\nThis function always succeeds.\n\n-- C Function: *note PyObject: 6b1. *PySliceNew (PyObject *start,\nPyObject *stop, PyObject *step)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a new slice object with the given values.  The\n'start', 'stop', and 'step' parameters are used as the values of\nthe slice object attributes of the same names.  Any of the values\nmay be 'NULL', in which case the 'None' will be used for the\ncorresponding attribute.  Return 'NULL' if the new object could not\nbe allocated.\n\n-- C Function: int PySliceGetIndices (PyObject *slice, Pyssizet\nlength, Pyssizet *start, Pyssizet *stop, Pyssizet *step)\n' Part of the *note Stable ABI: 2ac.'  Retrieve the start, stop and\nstep indices from the slice object 'slice', assuming a sequence of\nlength 'length'.  Treats indices greater than 'length' as errors.\n\nReturns '0' on success and '-1' on error with no exception set\n(unless one of the indices was not 'None' and failed to be\nconverted to an integer, in which case '-1' is returned with an\nexception set).\n\nYou probably do not want to use this function.\n\nChanged in version 3.2: The parameter type for the 'slice'\nparameter was 'PySliceObject*' before.\n\n-- C Function: int PySliceGetIndicesEx (PyObject *slice, Pyssizet\nlength, Pyssizet *start, Pyssizet *stop, Pyssizet *step,\nPyssizet *slicelength)\n' Part of the *note Stable ABI: 2ac.'  Usable replacement for *note\nPySliceGetIndices(): 4840.  Retrieve the start, stop, and step\nindices from the slice object 'slice' assuming a sequence of length\n'length', and store the length of the slice in 'slicelength'.  Out\nof bounds indices are clipped in a manner consistent with the\nhandling of normal slices.\n\nReturns '0' on success and '-1' on error with exception set.\n\nNote: This function is considered not safe for resizable\nsequences.  Its invocation should be replaced by a combination\nof *note PySliceUnpack(): 33d. and *note\nPySliceAdjustIndices(): 33e. where\n\nif (PySliceGetIndicesEx(slice, length, &start, &stop, &step, &slicelength) < 0) {\n// return error\n}\n\nis replaced by\n\nif (PySliceUnpack(slice, &start, &stop, &step) < 0) {\n// return error\n}\nslicelength = PySliceAdjustIndices(length, &start, &stop, step);\n\nChanged in version 3.2: The parameter type for the 'slice'\nparameter was 'PySliceObject*' before.\n\nChanged in version 3.6.1: If 'PyLIMITEDAPI' is not set or set to\nthe value between '0x03050400' and '0x03060000' (not including) or\n'0x03060100' or higher 'PySliceGetIndicesEx()' is implemented as a\nmacro using 'PySliceUnpack()' and 'PySliceAdjustIndices()'.\nArguments 'start', 'stop' and 'step' are evaluated more than once.\n\nDeprecated since version 3.6.1: If 'PyLIMITEDAPI' is set to the\nvalue less than '0x03050400' or between '0x03060000' and\n'0x03060100' (not including) 'PySliceGetIndicesEx()' is a\ndeprecated function.\n\n-- C Function: int PySliceUnpack (PyObject *slice, Pyssizet *start,\nPyssizet *stop, Pyssizet *step)\n' Part of the *note Stable ABI: 2ac. since version 3.7.'  Extract\nthe start, stop and step data members from a slice object as C\nintegers.  Silently reduce values larger than 'PYSSIZETMAX' to\n'PYSSIZETMAX', silently boost the start and stop values less\nthan 'PYSSIZETMIN' to 'PYSSIZETMIN', and silently boost the\nstep values less than '-PYSSIZETMAX' to '-PYSSIZETMAX'.\n\nReturn '-1' on error, '0' on success.\n\nNew in version 3.6.1.\n\n-- C Function: *note Pyssizet: 88d. PySliceAdjustIndices (Pyssizet\nlength, Pyssizet *start, Pyssizet *stop, Pyssizet step)\n' Part of the *note Stable ABI: 2ac. since version 3.7.'  Adjust\nstart/end slice indices assuming a sequence of the specified\nlength.  Out of bounds indices are clipped in a manner consistent\nwith the handling of normal slices.\n\nReturn the length of the slice.  Always successful.  Doesn't call\nPython code.\n\nNew in version 3.6.1.\n\n* Menu:\n\n* Ellipsis Object::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Ellipsis Object,  Up: Slice Objects": {
            "content": "7.8.6.12 Ellipsis Object\n........................\n\n-- C Variable: *note PyObject: 6b1. *PyEllipsis\n\nThe Python 'Ellipsis' object.  This object has no methods.  Like\n*note PyNone: 469e, it is an immortal(1).  singleton object.\n\nChanged in version 3.12: *note PyEllipsis: 4abc. is immortal.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0683/\n\nFile: python3.12.info,  Node: MemoryView objects,  Next: Weak Reference Objects<2>,  Prev: Slice Objects,  Up: Other Objects\n\n7.8.6.13 MemoryView objects\n...........................\n\nA *note memoryview: 17f. object exposes the C level *note buffer\ninterface: 148. as a Python object which can then be passed around like\nany other object.\n\n-- C Function: *note PyObject: 6b1. *PyMemoryViewFromObject (PyObject\n*obj)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Create a memoryview object from an object that provides the\nbuffer interface.  If 'obj' supports writable buffer exports, the\nmemoryview object will be read/write, otherwise it may be either\nread-only or read/write at the discretion of the exporter.\n\n-- C Macro: PyBUFREAD\n\nFlag to request a readonly buffer.\n\n-- C Macro: PyBUFWRITE\n\nFlag to request a writable buffer.\n\n-- C Function: *note PyObject: 6b1. *PyMemoryViewFromMemory (char\n*mem, Pyssizet size, int flags)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\nsince version 3.7.'  Create a memoryview object using 'mem' as the\nunderlying buffer.  'flags' can be one of *note PyBUFREAD: 4abf.\nor *note PyBUFWRITE: 4ac0.\n\nNew in version 3.3.\n\n-- C Function: *note PyObject: 6b1. *PyMemoryViewFromBuffer (const\nPybuffer *view)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\nsince version 3.11.'  Create a memoryview object wrapping the given\nbuffer structure 'view'.  For simple byte buffers, *note\nPyMemoryViewFromMemory(): fe5. is the preferred function.\n\n-- C Function: *note PyObject: 6b1. *PyMemoryViewGetContiguous\n(PyObject *obj, int buffertype, char order)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Create a memoryview object to a *note contiguous: 1f33.\nchunk of memory (in either 'C' or 'F'ortran 'order') from an object\nthat defines the buffer interface.  If memory is contiguous, the\nmemoryview object points to the original memory.  Otherwise, a copy\nis made and the memoryview points to a new bytes object.\n\n'buffertype' can be one of *note PyBUFREAD: 4abf. or *note\nPyBUFWRITE: 4ac0.\n\n-- C Function: int PyMemoryViewCheck (PyObject *obj)\n\nReturn true if the object 'obj' is a memoryview object.  It is not\ncurrently allowed to create subclasses of *note memoryview: 17f.\nThis function always succeeds.\n\n-- C Function: *note Pybuffer: 53f. *PyMemoryViewGETBUFFER (PyObject\n*mview)\n\nReturn a pointer to the memoryview's private copy of the exporter's\nbuffer.  'mview' 'must' be a memoryview instance; this macro\ndoesn't check its type, you must do it yourself or you will risk\ncrashes.\n\n-- C Function: *note PyObject: 6b1. *PyMemoryViewGETBASE (PyObject\n*mview)\n\nReturn either a pointer to the exporting object that the memoryview\nis based on or 'NULL' if the memoryview has been created by one of\nthe functions *note PyMemoryViewFromMemory(): fe5. or *note\nPyMemoryViewFromBuffer(): 54b.  'mview' 'must' be a memoryview\ninstance.\n\nFile: python3.12.info,  Node: Weak Reference Objects<2>,  Next: Capsules<2>,  Prev: MemoryView objects,  Up: Other Objects\n\n7.8.6.14 Weak Reference Objects\n...............................\n",
            "subsections": []
        },
        "Python supports 'weak references' as first-class objects.  There are two": {
            "content": "specific object types which directly implement weak references.  The\nfirst is a simple reference object, and the second acts as a proxy for\nthe original object as much as it can.\n\n-- C Function: int PyWeakrefCheck (PyObject *ob)\n\nReturn true if 'ob' is either a reference or proxy object.  This\nfunction always succeeds.\n\n-- C Function: int PyWeakrefCheckRef (PyObject *ob)\n\nReturn true if 'ob' is a reference object.  This function always\nsucceeds.\n\n-- C Function: int PyWeakrefCheckProxy (PyObject *ob)\n\nReturn true if 'ob' is a proxy object.  This function always\nsucceeds.\n\n-- C Function: *note PyObject: 6b1. *PyWeakrefNewRef (PyObject *ob,\nPyObject *callback)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a weak reference object for the object 'ob'.  This\nwill always return a new reference, but is not guaranteed to create\na new object; an existing reference object may be returned.  The\nsecond parameter, 'callback', can be a callable object that\nreceives notification when 'ob' is garbage collected; it should\naccept a single parameter, which will be the weak reference object\nitself.  'callback' may also be 'None' or 'NULL'.  If 'ob' is not a\nweakly referencable object, or if 'callback' is not callable,\n'None', or 'NULL', this will return 'NULL' and raise *note\nTypeError: 28e.\n\n-- C Function: *note PyObject: 6b1. *PyWeakrefNewProxy (PyObject *ob,\nPyObject *callback)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Return a weak reference proxy object for the object 'ob'.\nThis will always return a new reference, but is not guaranteed to\ncreate a new object; an existing proxy object may be returned.  The\nsecond parameter, 'callback', can be a callable object that\nreceives notification when 'ob' is garbage collected; it should\naccept a single parameter, which will be the weak reference object\nitself.  'callback' may also be 'None' or 'NULL'.  If 'ob' is not a\nweakly referencable object, or if 'callback' is not callable,\n'None', or 'NULL', this will return 'NULL' and raise *note\nTypeError: 28e.\n\n-- C Function: *note PyObject: 6b1. *PyWeakrefGetObject (PyObject\n*ref)\n'Return value: Borrowed reference.''  Part of the *note Stable ABI:\n2ac.'  Return the referenced object from a weak reference, 'ref'.\nIf the referent is no longer live, returns 'PyNone'.\n\nNote: This function returns a *note borrowed reference: 4732.\nto the referenced object.  This means that you should always\ncall *note PyINCREF(): 2ce. on the object except when it\ncannot be destroyed before the last usage of the borrowed\nreference.\n\n-- C Function: *note PyObject: 6b1. *PyWeakrefGETOBJECT (PyObject\n*ref)\n'Return value: Borrowed reference.'  Similar to *note\nPyWeakrefGetObject(): 489a, but does no error checking.\n\n-- C Function: void PyObjectClearWeakRefs (PyObject *object)\n' Part of the *note Stable ABI: 2ac.'  This function is called by\nthe *note tpdealloc: 46d0. handler to clear weak references.\n\nThis iterates through the weak references for 'object' and calls\ncallbacks for those references which have one.  It returns when all\ncallbacks have been attempted.\n\nFile: python3.12.info,  Node: Capsules<2>,  Next: Frame Objects,  Prev: Weak Reference Objects<2>,  Up: Other Objects\n\n7.8.6.15 Capsules\n.................\n\nRefer to *note Providing a C API for an Extension Module: 11d1. for more\ninformation on using these objects.\n\nNew in version 3.1.\n\n-- C Type: type PyCapsule\n\nThis subtype of *note PyObject: 6b1. represents an opaque value,\nuseful for C extension modules who need to pass an opaque value (as\na void* pointer) through Python code to other C code.  It is often\nused to make a C function pointer defined in one module available\nto other modules, so the regular import mechanism can be used to\naccess C APIs defined in dynamically loaded modules.\n\n-- C Type: type PyCapsuleDestructor\n' Part of the *note Stable ABI: 2ac.'  The type of a destructor\ncallback for a capsule.  Defined as:\n\ntypedef void (*PyCapsuleDestructor)(PyObject *);\n\nSee *note PyCapsuleNew(): 46c4. for the semantics of\nPyCapsuleDestructor callbacks.\n\n-- C Function: int PyCapsuleCheckExact (PyObject *p)\n\nReturn true if its argument is a *note PyCapsule: 10eb.  This\nfunction always succeeds.\n\n-- C Function: *note PyObject: 6b1. *PyCapsuleNew (void *pointer,\nconst char *name, PyCapsuleDestructor destructor)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Create a *note PyCapsule: 10eb. encapsulating the 'pointer'.\nThe 'pointer' argument may not be 'NULL'.\n\nOn failure, set an exception and return 'NULL'.\n\nThe 'name' string may either be 'NULL' or a pointer to a valid C\nstring.  If non-'NULL', this string must outlive the capsule.\n(Though it is permitted to free it inside the 'destructor'.)\n\nIf the 'destructor' argument is not 'NULL', it will be called with\nthe capsule as its argument when it is destroyed.\n\nIf this capsule will be stored as an attribute of a module, the\n'name' should be specified as 'modulename.attributename'.  This\nwill enable other modules to import the capsule using *note\nPyCapsuleImport(): 15cf.\n\n-- C Function: void *PyCapsuleGetPointer (PyObject *capsule, const\nchar *name)\n' Part of the *note Stable ABI: 2ac.'  Retrieve the 'pointer'\nstored in the capsule.  On failure, set an exception and return\n'NULL'.\n\nThe 'name' parameter must compare exactly to the name stored in the\ncapsule.  If the name stored in the capsule is 'NULL', the 'name'\npassed in must also be 'NULL'.  Python uses the C function\n'strcmp()' to compare capsule names.\n\n-- C Function: *note PyCapsuleDestructor: 4763.\nPyCapsuleGetDestructor (PyObject *capsule)\n' Part of the *note Stable ABI: 2ac.'  Return the current\ndestructor stored in the capsule.  On failure, set an exception and\nreturn 'NULL'.\n\nIt is legal for a capsule to have a 'NULL' destructor.  This makes\na 'NULL' return code somewhat ambiguous; use *note\nPyCapsuleIsValid(): 11d0. or *note PyErrOccurred(): 1656. to\ndisambiguate.\n\n-- C Function: void *PyCapsuleGetContext (PyObject *capsule)\n' Part of the *note Stable ABI: 2ac.'  Return the current context\nstored in the capsule.  On failure, set an exception and return\n'NULL'.\n\nIt is legal for a capsule to have a 'NULL' context.  This makes a\n'NULL' return code somewhat ambiguous; use *note\nPyCapsuleIsValid(): 11d0. or *note PyErrOccurred(): 1656. to\ndisambiguate.\n\n-- C Function: const char *PyCapsuleGetName (PyObject *capsule)\n' Part of the *note Stable ABI: 2ac.'  Return the current name\nstored in the capsule.  On failure, set an exception and return\n'NULL'.\n\nIt is legal for a capsule to have a 'NULL' name.  This makes a\n'NULL' return code somewhat ambiguous; use *note\nPyCapsuleIsValid(): 11d0. or *note PyErrOccurred(): 1656. to\ndisambiguate.\n\n-- C Function: void *PyCapsuleImport (const char *name, int noblock)\n' Part of the *note Stable ABI: 2ac.'  Import a pointer to a C\nobject from a capsule attribute in a module.  The 'name' parameter\nshould specify the full name to the attribute, as in\n'module.attribute'.  The 'name' stored in the capsule must match\nthis string exactly.\n\nReturn the capsule's internal 'pointer' on success.  On failure,\nset an exception and return 'NULL'.\n\nChanged in version 3.3: 'noblock' has no effect anymore.\n\n-- C Function: int PyCapsuleIsValid (PyObject *capsule, const char\n*name)\n' Part of the *note Stable ABI: 2ac.'  Determines whether or not\n'capsule' is a valid capsule.  A valid capsule is non-'NULL',\npasses *note PyCapsuleCheckExact(): 4acc, has a non-'NULL' pointer\nstored in it, and its internal name matches the 'name' parameter.\n(See *note PyCapsuleGetPointer(): 4767. for information on how\ncapsule names are compared.)\n\nIn other words, if *note PyCapsuleIsValid(): 11d0. returns a true\nvalue, calls to any of the accessors (any function starting with\n'PyCapsuleGet') are guaranteed to succeed.\n\nReturn a nonzero value if the object is valid and matches the name\npassed in.  Return '0' otherwise.  This function will not fail.\n\n-- C Function: int PyCapsuleSetContext (PyObject *capsule, void\n*context)\n' Part of the *note Stable ABI: 2ac.'  Set the context pointer\ninside 'capsule' to 'context'.\n\nReturn '0' on success.  Return nonzero and set an exception on\nfailure.\n\n-- C Function: int PyCapsuleSetDestructor (PyObject *capsule,\nPyCapsuleDestructor destructor)\n' Part of the *note Stable ABI: 2ac.'  Set the destructor inside\n'capsule' to 'destructor'.\n\nReturn '0' on success.  Return nonzero and set an exception on\nfailure.\n\n-- C Function: int PyCapsuleSetName (PyObject *capsule, const char\n*name)\n' Part of the *note Stable ABI: 2ac.'  Set the name inside\n'capsule' to 'name'.  If non-'NULL', the name must outlive the\ncapsule.  If the previous 'name' stored in the capsule was not\n'NULL', no attempt is made to free it.\n\nReturn '0' on success.  Return nonzero and set an exception on\nfailure.\n\n-- C Function: int PyCapsuleSetPointer (PyObject *capsule, void\n*pointer)\n' Part of the *note Stable ABI: 2ac.'  Set the void pointer inside\n'capsule' to 'pointer'.  The pointer may not be 'NULL'.\n\nReturn '0' on success.  Return nonzero and set an exception on\nfailure.\n\nFile: python3.12.info,  Node: Frame Objects,  Next: Generator Objects,  Prev: Capsules<2>,  Up: Other Objects\n\n7.8.6.16 Frame Objects\n......................\n\n-- C Type: type PyFrameObject\n' Part of the *note Limited API: 2ac. (as an opaque struct).'  The\nC structure of the objects used to describe frame objects.\n\nThere are no public members in this structure.\n\nChanged in version 3.11: The members of this structure were removed\nfrom the public C API. Refer to the *note What's New entry: 574.\nfor details.\n\nThe *note PyEvalGetFrame(): 1513. and *note PyThreadStateGetFrame():\n57b. functions can be used to get a frame object.\n\nSee also *note Reflection: 4935.\n\n-- C Variable: *note PyTypeObject: 8da. PyFrameType\n\nThe type of frame objects.  It is the same object as *note\ntypes.FrameType: 15b5. in the Python layer.\n\nChanged in version 3.11: Previously, this type was only available\nafter including '<frameobject.h>'.\n\n-- C Function: int PyFrameCheck (PyObject *obj)\n\nReturn non-zero if 'obj' is a frame object.\n\nChanged in version 3.11: Previously, this function was only\navailable after including '<frameobject.h>'.\n\n-- C Function: *note PyFrameObject: 575. *PyFrameGetBack\n(PyFrameObject *frame)\n\nGet the 'frame' next outer frame.\n\nReturn a *note strong reference: 57c, or 'NULL' if 'frame' has no\nouter frame.\n\nNew in version 3.9.\n\n-- C Function: *note PyObject: 6b1. *PyFrameGetBuiltins (PyFrameObject\n*frame)\n\nGet the 'frame''s *note fbuiltins: 1c52. attribute.\n\nReturn a *note strong reference: 57c.  The result cannot be 'NULL'.\n\nNew in version 3.11.\n\n-- C Function: *note PyCodeObject: 562. *PyFrameGetCode (PyFrameObject\n*frame)\n' Part of the *note Stable ABI: 2ac. since version 3.10.'  Get the\n'frame' code.\n\nReturn a *note strong reference: 57c.\n\nThe result (frame code) cannot be 'NULL'.\n\nNew in version 3.9.\n\n-- C Function: *note PyObject: 6b1. *PyFrameGetGenerator\n(PyFrameObject *frame)\n\nGet the generator, coroutine, or async generator that owns this\nframe, or 'NULL' if this frame is not owned by a generator.  Does\nnot raise an exception, even if the return value is 'NULL'.\n\nReturn a *note strong reference: 57c, or 'NULL'.\n\nNew in version 3.11.\n\n-- C Function: *note PyObject: 6b1. *PyFrameGetGlobals (PyFrameObject\n*frame)\n\nGet the 'frame''s *note fglobals: 1c51. attribute.\n\nReturn a *note strong reference: 57c.  The result cannot be 'NULL'.\n\nNew in version 3.11.\n\n-- C Function: int PyFrameGetLasti (PyFrameObject *frame)\n\nGet the 'frame''s *note flasti: 696. attribute.\n\nReturns -1 if 'frame.flasti' is 'None'.\n\nNew in version 3.11.\n\n-- C Function: *note PyObject: 6b1. *PyFrameGetVar (PyFrameObject\n*frame, PyObject *name)\n\nGet the variable 'name' of 'frame'.\n\n* Return a *note strong reference: 57c. to the variable value on\nsuccess.\n\n* Raise *note NameError: 144. and return 'NULL' if the variable\ndoes not exist.\n\n* Raise an exception and return 'NULL' on error.\n\n'name' type must be a *note str: 157.\n\nNew in version 3.12.\n\n-- C Function: *note PyObject: 6b1. *PyFrameGetVarString\n(PyFrameObject *frame, const char *name)\n\nSimilar to *note PyFrameGetVar(): 2c3, but the variable name is a\nC string encoded in UTF-8.\n\nNew in version 3.12.\n\n-- C Function: *note PyObject: 6b1. *PyFrameGetLocals (PyFrameObject\n*frame)\n\nGet the 'frame''s *note flocals: 579. attribute (*note dict:\n237.).\n\nReturn a *note strong reference: 57c.\n\nNew in version 3.11.\n\n-- C Function: int PyFrameGetLineNumber (PyFrameObject *frame)\n' Part of the *note Stable ABI: 2ac. since version 3.10.'  Return\nthe line number that 'frame' is currently executing.\n\n* Menu:\n\n* Internal Frames::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Internal Frames,  Up: Frame Objects": {
            "content": "7.8.6.17 Internal Frames\n........................\n\nUnless using PEP 523(1), you will not need this.\n\n-- C Struct: struct PyInterpreterFrame\n\nThe interpreter's internal frame representation.\n\nNew in version 3.11.\n\n-- C Function: *note PyObject: 6b1.\n*PyUnstableInterpreterFrameGetCode (struct\nPyInterpreterFrame *frame);\n\nThis is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 29f. It may change without warning in minor releases.':\nReturn a *note strong reference: 57c. to the code object for\nthe frame.\n\nNew in version 3.12.\n\n-- C Function: int PyUnstableInterpreterFrameGetLasti (struct\nPyInterpreterFrame *frame);\n\nThis is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 29f. It may change without warning in minor releases.':\nReturn the byte offset into the last executed instruction.\n\nNew in version 3.12.\n\n-- C Function: int PyUnstableInterpreterFrameGetLine (struct\nPyInterpreterFrame *frame);\n\nThis is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 29f. It may change without warning in minor releases.':\nReturn the currently executing line number, or -1 if there is no\nline number.\n\nNew in version 3.12.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0523/\n\nFile: python3.12.info,  Node: Generator Objects,  Next: Coroutine Objects<2>,  Prev: Frame Objects,  Up: Other Objects\n\n7.8.6.18 Generator Objects\n..........................\n\nGenerator objects are what Python uses to implement generator iterators.",
            "subsections": []
        },
        "They are normally created by iterating over a function that yields": {
            "content": "values, rather than explicitly calling *note PyGenNew(): 4ad7. or *note\nPyGenNewWithQualName(): 4ad8.\n\n-- C Type: type PyGenObject\n\nThe C structure used for generator objects.\n\n-- C Variable: *note PyTypeObject: 8da. PyGenType\n\nThe type object corresponding to generator objects.\n\n-- C Function: int PyGenCheck (PyObject *ob)\n\nReturn true if 'ob' is a generator object; 'ob' must not be 'NULL'.\nThis function always succeeds.\n\n-- C Function: int PyGenCheckExact (PyObject *ob)\n\nReturn true if 'ob''s type is *note PyGenType: 4ada.; 'ob' must\nnot be 'NULL'.  This function always succeeds.\n\n-- C Function: *note PyObject: 6b1. *PyGenNew (PyFrameObject *frame)\n'Return value: New reference.'  Create and return a new generator\nobject based on the 'frame' object.  A reference to 'frame' is\nstolen by this function.  The argument must not be 'NULL'.\n\n-- C Function: *note PyObject: 6b1. *PyGenNewWithQualName\n(PyFrameObject *frame, PyObject *name, PyObject *qualname)\n'Return value: New reference.'  Create and return a new generator\nobject based on the 'frame' object, with 'name' and\n'qualname' set to 'name' and 'qualname'.  A reference to\n'frame' is stolen by this function.  The 'frame' argument must not\nbe 'NULL'.\n\nFile: python3.12.info,  Node: Coroutine Objects<2>,  Next: Context Variables Objects,  Prev: Generator Objects,  Up: Other Objects\n\n7.8.6.19 Coroutine Objects\n..........................\n\nNew in version 3.5.\n",
            "subsections": []
        },
        "Coroutine objects are what functions declared with an 'async' keyword": {
            "content": "return.\n\n-- C Type: type PyCoroObject\n\nThe C structure used for coroutine objects.\n\n-- C Variable: *note PyTypeObject: 8da. PyCoroType\n\nThe type object corresponding to coroutine objects.\n\n-- C Function: int PyCoroCheckExact (PyObject *ob)\n\nReturn true if 'ob''s type is *note PyCoroType: 4ae0.; 'ob' must\nnot be 'NULL'.  This function always succeeds.\n\n-- C Function: *note PyObject: 6b1. *PyCoroNew (PyFrameObject *frame,\nPyObject *name, PyObject *qualname)\n'Return value: New reference.'  Create and return a new coroutine\nobject based on the 'frame' object, with 'name' and\n'qualname' set to 'name' and 'qualname'.  A reference to\n'frame' is stolen by this function.  The 'frame' argument must not\nbe 'NULL'.\n\nFile: python3.12.info,  Node: Context Variables Objects,  Next: DateTime Objects<2>,  Prev: Coroutine Objects<2>,  Up: Other Objects\n\n7.8.6.20 Context Variables Objects\n..................................\n\nNew in version 3.7.\n\nChanged in version 3.7.1:\n\nNote: In Python 3.7.1 the signatures of all context variables C\nAPIs were 'changed' to use *note PyObject: 6b1. pointers instead of\n*note PyContext: 4ae5, *note PyContextVar: 4ae6, and *note\nPyContextToken: 4ae7, e.g.:\n\n// in 3.7.0:\nPyContext *PyContextNew(void);\n\n// in 3.7.1+:\nPyObject *PyContextNew(void);\n\nSee bpo-34762(1) for more details.\n\nThis section details the public C API for the *note contextvars: 22.\nmodule.\n\n-- C Type: type PyContext\n\nThe C structure used to represent a *note contextvars.Context:\n2ea5. object.\n\n-- C Type: type PyContextVar\n\nThe C structure used to represent a *note contextvars.ContextVar:\n2ea3. object.\n\n-- C Type: type PyContextToken\n\nThe C structure used to represent a *note contextvars.Token: 2eaa.\nobject.\n\n-- C Variable: *note PyTypeObject: 8da. PyContextType\n\nThe type object representing the 'context' type.\n\n-- C Variable: *note PyTypeObject: 8da. PyContextVarType\n\nThe type object representing the 'context variable' type.\n\n-- C Variable: *note PyTypeObject: 8da. PyContextTokenType\n\nThe type object representing the 'context variable token' type.\n\nType-check macros:\n\n-- C Function: int PyContextCheckExact (PyObject *o)\n\nReturn true if 'o' is of type *note PyContextType: 4ae8.  'o' must\nnot be 'NULL'.  This function always succeeds.\n\n-- C Function: int PyContextVarCheckExact (PyObject *o)\n\nReturn true if 'o' is of type *note PyContextVarType: 4ae9.  'o'\nmust not be 'NULL'.  This function always succeeds.\n\n-- C Function: int PyContextTokenCheckExact (PyObject *o)\n\nReturn true if 'o' is of type *note PyContextTokenType: 4aea.  'o'\nmust not be 'NULL'.  This function always succeeds.\n\nContext object management functions:\n\n-- C Function: *note PyObject: 6b1. *PyContextNew (void)\n'Return value: New reference.'  Create a new empty context object.\nReturns 'NULL' if an error has occurred.\n\n-- C Function: *note PyObject: 6b1. *PyContextCopy (PyObject *ctx)\n'Return value: New reference.'  Create a shallow copy of the passed\n'ctx' context object.  Returns 'NULL' if an error has occurred.\n\n-- C Function: *note PyObject: 6b1. *PyContextCopyCurrent (void)\n'Return value: New reference.'  Create a shallow copy of the\ncurrent thread context.  Returns 'NULL' if an error has occurred.\n\n-- C Function: int PyContextEnter (PyObject *ctx)\n\nSet 'ctx' as the current context for the current thread.  Returns\n'0' on success, and '-1' on error.\n\n-- C Function: int PyContextExit (PyObject *ctx)\n\nDeactivate the 'ctx' context and restore the previous context as\nthe current context for the current thread.  Returns '0' on\nsuccess, and '-1' on error.\n\nContext variable functions:\n\n-- C Function: *note PyObject: 6b1. *PyContextVarNew (const char\n*name, PyObject *def)\n'Return value: New reference.'  Create a new 'ContextVar' object.\nThe 'name' parameter is used for introspection and debug purposes.\nThe 'def' parameter specifies a default value for the context\nvariable, or 'NULL' for no default.  If an error has occurred, this\nfunction returns 'NULL'.\n\n-- C Function: int PyContextVarGet (PyObject *var, PyObject\n*defaultvalue, PyObject value)\n\nGet the value of a context variable.  Returns '-1' if an error has\noccurred during lookup, and '0' if no error occurred, whether or\nnot a value was found.\n\nIf the context variable was found, 'value' will be a pointer to it.\nIf the context variable was 'not' found, 'value' will point to:\n\n- 'defaultvalue', if not 'NULL';\n\n- the default value of 'var', if not 'NULL';\n\n- 'NULL'\n\nExcept for 'NULL', the function returns a new reference.\n\n-- C Function: *note PyObject: 6b1. *PyContextVarSet (PyObject *var,\nPyObject *value)\n'Return value: New reference.'  Set the value of 'var' to 'value'\nin the current context.  Returns a new token object for this\nchange, or 'NULL' if an error has occurred.\n\n-- C Function: int PyContextVarReset (PyObject *var, PyObject *token)\n\nReset the state of the 'var' context variable to that it was in\nbefore *note PyContextVarSet(): 4af5. that returned the 'token'\nwas called.  This function returns '0' on success and '-1' on\nerror.\n\n---------- Footnotes ----------\n\n(1) https://bugs.python.org/issue?@action=redirect&bpo=34762\n\nFile: python3.12.info,  Node: DateTime Objects<2>,  Next: Objects for Type Hinting,  Prev: Context Variables Objects,  Up: Other Objects\n\n7.8.6.21 DateTime Objects\n.........................\n\nVarious date and time objects are supplied by the *note datetime: 2e.\nmodule.  Before using any of these functions, the header file\n'datetime.h' must be included in your source (note that this is not\nincluded by 'Python.h'), and the macro 'PyDateTimeIMPORT' must be\ninvoked, usually as part of the module initialisation function.  The\nmacro puts a pointer to a C structure into a static variable,\n'PyDateTimeAPI', that is used by the following macros.\n\n-- C Type: type PyDateTimeDate\n\nThis subtype of *note PyObject: 6b1. represents a Python date\nobject.\n\n-- C Type: type PyDateTimeDateTime\n\nThis subtype of *note PyObject: 6b1. represents a Python datetime\nobject.\n\n-- C Type: type PyDateTimeTime\n\nThis subtype of *note PyObject: 6b1. represents a Python time\nobject.\n\n-- C Type: type PyDateTimeDelta\n\nThis subtype of *note PyObject: 6b1. represents the difference\nbetween two datetime values.\n\n-- C Variable: *note PyTypeObject: 8da. PyDateTimeDateType\n\nThis instance of *note PyTypeObject: 8da. represents the Python\ndate type; it is the same object as *note datetime.date: 70f. in\nthe Python layer.\n\n-- C Variable: *note PyTypeObject: 8da. PyDateTimeDateTimeType\n\nThis instance of *note PyTypeObject: 8da. represents the Python\ndatetime type; it is the same object as *note datetime.datetime:\n222. in the Python layer.\n\n-- C Variable: *note PyTypeObject: 8da. PyDateTimeTimeType\n\nThis instance of *note PyTypeObject: 8da. represents the Python\ntime type; it is the same object as *note datetime.time: 6a5. in\nthe Python layer.\n\n-- C Variable: *note PyTypeObject: 8da. PyDateTimeDeltaType\n\nThis instance of *note PyTypeObject: 8da. represents Python type\nfor the difference between two datetime values; it is the same\nobject as *note datetime.timedelta: 7f3. in the Python layer.\n\n-- C Variable: *note PyTypeObject: 8da. PyDateTimeTZInfoType\n\nThis instance of *note PyTypeObject: 8da. represents the Python\ntime zone info type; it is the same object as *note\ndatetime.tzinfo: 3a2. in the Python layer.\n\nMacro for access to the UTC singleton:\n\n-- C Variable: *note PyObject: 6b1. *PyDateTimeTimeZoneUTC\n\nReturns the time zone singleton representing UTC, the same object\nas *note datetime.timezone.utc: 3df.\n\nNew in version 3.7.\n\nType-check macros:\n\n-- C Function: int PyDateCheck (PyObject *ob)\n\nReturn true if 'ob' is of type *note PyDateTimeDateType: 4afe. or\na subtype of 'PyDateTimeDateType'.  'ob' must not be 'NULL'.  This\nfunction always succeeds.\n\n-- C Function: int PyDateCheckExact (PyObject *ob)\n\nReturn true if 'ob' is of type *note PyDateTimeDateType: 4afe.\n'ob' must not be 'NULL'.  This function always succeeds.\n\n-- C Function: int PyDateTimeCheck (PyObject *ob)\n\nReturn true if 'ob' is of type *note PyDateTimeDateTimeType: 4aff.\nor a subtype of 'PyDateTimeDateTimeType'.  'ob' must not be\n'NULL'.  This function always succeeds.\n\n-- C Function: int PyDateTimeCheckExact (PyObject *ob)\n\nReturn true if 'ob' is of type *note PyDateTimeDateTimeType: 4aff.\n'ob' must not be 'NULL'.  This function always succeeds.\n\n-- C Function: int PyTimeCheck (PyObject *ob)\n\nReturn true if 'ob' is of type *note PyDateTimeTimeType: 4b00. or\na subtype of 'PyDateTimeTimeType'.  'ob' must not be 'NULL'.  This\nfunction always succeeds.\n\n-- C Function: int PyTimeCheckExact (PyObject *ob)\n\nReturn true if 'ob' is of type *note PyDateTimeTimeType: 4b00.\n'ob' must not be 'NULL'.  This function always succeeds.\n\n-- C Function: int PyDeltaCheck (PyObject *ob)\n\nReturn true if 'ob' is of type *note PyDateTimeDeltaType: 4b01. or\na subtype of 'PyDateTimeDeltaType'.  'ob' must not be 'NULL'.\nThis function always succeeds.\n\n-- C Function: int PyDeltaCheckExact (PyObject *ob)\n\nReturn true if 'ob' is of type *note PyDateTimeDeltaType: 4b01.\n'ob' must not be 'NULL'.  This function always succeeds.\n\n-- C Function: int PyTZInfoCheck (PyObject *ob)\n\nReturn true if 'ob' is of type *note PyDateTimeTZInfoType: 4b02.\nor a subtype of 'PyDateTimeTZInfoType'.  'ob' must not be 'NULL'.\nThis function always succeeds.\n\n-- C Function: int PyTZInfoCheckExact (PyObject *ob)\n\nReturn true if 'ob' is of type *note PyDateTimeTZInfoType: 4b02.\n'ob' must not be 'NULL'.  This function always succeeds.\n\nMacros to create objects:\n\n-- C Function: *note PyObject: 6b1. *PyDateFromDate (int year, int\nmonth, int day)\n'Return value: New reference.'  Return a *note datetime.date: 70f.\nobject with the specified year, month and day.\n\n-- C Function: *note PyObject: 6b1. *PyDateTimeFromDateAndTime (int\nyear, int month, int day, int hour, int minute, int second,\nint usecond)\n'Return value: New reference.'  Return a *note datetime.datetime:\n222. object with the specified year, month, day, hour, minute,\nsecond and microsecond.\n\n-- C Function: *note PyObject: 6b1. *PyDateTimeFromDateAndTimeAndFold\n(int year, int month, int day, int hour, int minute, int\nsecond, int usecond, int fold)\n'Return value: New reference.'  Return a *note datetime.datetime:\n222. object with the specified year, month, day, hour, minute,\nsecond, microsecond and fold.\n\nNew in version 3.6.\n\n-- C Function: *note PyObject: 6b1. *PyTimeFromTime (int hour, int\nminute, int second, int usecond)\n'Return value: New reference.'  Return a *note datetime.time: 6a5.\nobject with the specified hour, minute, second and microsecond.\n\n-- C Function: *note PyObject: 6b1. *PyTimeFromTimeAndFold (int hour,\nint minute, int second, int usecond, int fold)\n'Return value: New reference.'  Return a *note datetime.time: 6a5.\nobject with the specified hour, minute, second, microsecond and\nfold.\n\nNew in version 3.6.\n\n-- C Function: *note PyObject: 6b1. *PyDeltaFromDSU (int days, int\nseconds, int useconds)\n'Return value: New reference.'  Return a *note datetime.timedelta:\n7f3. object representing the given number of days, seconds and\nmicroseconds.  Normalization is performed so that the resulting\nnumber of microseconds and seconds lie in the ranges documented for\n*note datetime.timedelta: 7f3. objects.\n\n-- C Function: *note PyObject: 6b1. *PyTimeZoneFromOffset (PyObject\n*offset)\n'Return value: New reference.'  Return a *note datetime.timezone:\nf2f. object with an unnamed fixed offset represented by the\n'offset' argument.\n\nNew in version 3.7.\n\n-- C Function: *note PyObject: 6b1. *PyTimeZoneFromOffsetAndName\n(PyObject *offset, PyObject *name)\n'Return value: New reference.'  Return a *note datetime.timezone:\nf2f. object with a fixed offset represented by the 'offset'\nargument and with tzname 'name'.\n\nNew in version 3.7.\n",
            "subsections": []
        },
        "Macros to extract fields from date objects.  The argument must be an": {
            "content": "instance of *note PyDateTimeDate: 4afa, including subclasses (such as\n*note PyDateTimeDateTime: 4afb.).  The argument must not be 'NULL', and\nthe type is not checked:\n\n-- C Function: int PyDateTimeGETYEAR (PyDateTimeDate *o)\n\nReturn the year, as a positive int.\n\n-- C Function: int PyDateTimeGETMONTH (PyDateTimeDate *o)\n\nReturn the month, as an int from 1 through 12.\n\n-- C Function: int PyDateTimeGETDAY (PyDateTimeDate *o)\n\nReturn the day, as an int from 1 through 31.\n",
            "subsections": []
        },
        "Macros to extract fields from datetime objects.  The argument must be an": {
            "content": "instance of *note PyDateTimeDateTime: 4afb, including subclasses.  The\nargument must not be 'NULL', and the type is not checked:\n\n-- C Function: int PyDateTimeDATEGETHOUR (PyDateTimeDateTime *o)\n\nReturn the hour, as an int from 0 through 23.\n\n-- C Function: int PyDateTimeDATEGETMINUTE (PyDateTimeDateTime *o)\n\nReturn the minute, as an int from 0 through 59.\n\n-- C Function: int PyDateTimeDATEGETSECOND (PyDateTimeDateTime *o)\n\nReturn the second, as an int from 0 through 59.\n\n-- C Function: int PyDateTimeDATEGETMICROSECOND (PyDateTimeDateTime\n*o)\n\nReturn the microsecond, as an int from 0 through 999999.\n\n-- C Function: int PyDateTimeDATEGETFOLD (PyDateTimeDateTime *o)\n\nReturn the fold, as an int from 0 through 1.\n\nNew in version 3.6.\n\n-- C Function: *note PyObject: 6b1. *PyDateTimeDATEGETTZINFO\n(PyDateTimeDateTime *o)\n\nReturn the tzinfo (which may be 'None').\n\nNew in version 3.10.\n",
            "subsections": []
        },
        "Macros to extract fields from time objects.  The argument must be an": {
            "content": "instance of *note PyDateTimeTime: 4afc, including subclasses.  The\nargument must not be 'NULL', and the type is not checked:\n\n-- C Function: int PyDateTimeTIMEGETHOUR (PyDateTimeTime *o)\n\nReturn the hour, as an int from 0 through 23.\n\n-- C Function: int PyDateTimeTIMEGETMINUTE (PyDateTimeTime *o)\n\nReturn the minute, as an int from 0 through 59.\n\n-- C Function: int PyDateTimeTIMEGETSECOND (PyDateTimeTime *o)\n\nReturn the second, as an int from 0 through 59.\n\n-- C Function: int PyDateTimeTIMEGETMICROSECOND (PyDateTimeTime *o)\n\nReturn the microsecond, as an int from 0 through 999999.\n\n-- C Function: int PyDateTimeTIMEGETFOLD (PyDateTimeTime *o)\n\nReturn the fold, as an int from 0 through 1.\n\nNew in version 3.6.\n\n-- C Function: *note PyObject: 6b1. *PyDateTimeTIMEGETTZINFO\n(PyDateTimeTime *o)\n\nReturn the tzinfo (which may be 'None').\n\nNew in version 3.10.\n",
            "subsections": []
        },
        "Macros to extract fields from time delta objects.  The argument must be": {
            "content": "an instance of *note PyDateTimeDelta: 4afd, including subclasses.  The\nargument must not be 'NULL', and the type is not checked:\n\n-- C Function: int PyDateTimeDELTAGETDAYS (PyDateTimeDelta *o)\n\nReturn the number of days, as an int from -999999999 to 999999999.\n\nNew in version 3.3.\n\n-- C Function: int PyDateTimeDELTAGETSECONDS (PyDateTimeDelta *o)\n\nReturn the number of seconds, as an int from 0 through 86399.\n\nNew in version 3.3.\n\n-- C Function: int PyDateTimeDELTAGETMICROSECONDS (PyDateTimeDelta\n*o)\n\nReturn the number of microseconds, as an int from 0 through 999999.\n\nNew in version 3.3.\n\nMacros for the convenience of modules implementing the DB API:\n\n-- C Function: *note PyObject: 6b1. *PyDateTimeFromTimestamp (PyObject\n*args)\n'Return value: New reference.'  Create and return a new *note\ndatetime.datetime: 222. object given an argument tuple suitable for\npassing to *note datetime.datetime.fromtimestamp(): 226.\n\n-- C Function: *note PyObject: 6b1. *PyDateFromTimestamp (PyObject\n*args)\n'Return value: New reference.'  Create and return a new *note\ndatetime.date: 70f. object given an argument tuple suitable for\npassing to *note datetime.date.fromtimestamp(): 2153.\n\nFile: python3.12.info,  Node: Objects for Type Hinting,  Prev: DateTime Objects<2>,  Up: Other Objects\n\n7.8.6.22 Objects for Type Hinting\n.................................\n",
            "subsections": []
        },
        "Various built-in types for type hinting are provided.  Currently, two": {
            "content": "types exist - *note GenericAlias: 480. and *note Union: 5b5.  Only\n'GenericAlias' is exposed to C.\n\n-- C Function: *note PyObject: 6b1. *PyGenericAlias (PyObject *origin,\nPyObject *args)\n' Part of the *note Stable ABI: 2ac. since version 3.9.'  Create a\n*note GenericAlias: 480. object.  Equivalent to calling the Python\nclass *note types.GenericAlias: 5df.  The 'origin' and 'args'\narguments set the 'GenericAlias''s 'origin' and 'args'\nattributes respectively.  'origin' should be a *note PyTypeObject:\n8da.*, and 'args' can be a *note PyTupleObject: 490b.* or any\n'PyObject*'.  If 'args' passed is not a tuple, a 1-tuple is\nautomatically constructed and 'args' is set to '(args,)'.\nMinimal checking is done for the arguments, so the function will\nsucceed even if 'origin' is not a type.  The 'GenericAlias''s\n'parameters' attribute is constructed lazily from 'args'.\nOn failure, an exception is raised and 'NULL' is returned.\n\nHere's an example of how to make an extension type generic:\n\n...\nstatic PyMethodDef myobjmethods[] = {\n// Other methods.\n...\n{\"classgetitem\", PyGenericAlias, METHO|METHCLASS, \"See PEP 585\"}\n...\n}\n\nSee also\n........\n\nThe data model method *note classgetitem(): 520.\n\nNew in version 3.9.\n\n-- C Variable: *note PyTypeObject: 8da. PyGenericAliasType\n' Part of the *note Stable ABI: 2ac. since version 3.9.'  The C\ntype of the object returned by *note PyGenericAlias(): 48a0.\nEquivalent to *note types.GenericAlias: 5df. in Python.\n\nNew in version 3.9.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Initialization Finalization and Threads,  Next: Python Initialization Configuration,  Prev: Concrete Objects Layer,  Up: Python/C API Reference Manual": {
            "content": "",
            "subsections": [
                {
                    "name": "7.9 Initialization, Finalization, and Threads",
                    "content": "See also *note Python Initialization Configuration: 581.\n\n* Menu:\n\n* Before Python Initialization::\n* Global configuration variables::\n* Initializing and finalizing the interpreter::\n* Process-wide parameters::\n* Thread State and the Global Interpreter Lock::\n* Sub-interpreter support::\n* Asynchronous Notifications::\n* Profiling and Tracing::\n* Advanced Debugger Support::\n* Thread Local Storage Support::\n"
                }
            ]
        },
        "File: python3.12.info,  Node: Before Python Initialization,  Next: Global configuration variables,  Up: Initialization Finalization and Threads": {
            "content": "In an application embedding Python, the *note PyInitialize(): 6c2.\nfunction must be called before using any other Python/C API functions;\nwith the exception of a few functions and the *note global configuration\nvariables: 4b2b.\n",
            "subsections": []
        },
        "The following functions can be safely called before Python is": {
            "content": "initialized:\n\n* Configuration functions:\n\n* *note PyImportAppendInittab(): 14f8.\n\n* *note PyImportExtendInittab(): 14f9.\n\n* 'PyInitFrozenExtensions()'\n\n* *note PyMemSetAllocator(): 2ed.\n\n* *note PyMemSetupDebugHooks(): ab5.\n\n* *note PyObjectSetArenaAllocator(): 4b2c.\n\n* *note PySetPath(): 1b74.\n\n* *note PySetProgramName(): 181f.\n\n* *note PySetPythonHome(): 1820.\n\n* *note PySetStandardStreamEncoding(): e75.\n\n* *note PySysAddWarnOption(): a6a.\n\n* *note PySysAddXOption(): 484a.\n\n* *note PySysResetWarnOptions(): 327.\n\n* Informative functions:\n\n* *note PyIsInitialized(): 473d.\n\n* *note PyMemGetAllocator(): 4b2d.\n\n* *note PyObjectGetArenaAllocator(): 4b2e.\n\n* *note PyGetBuildInfo(): 128a.\n\n* *note PyGetCompiler(): 48a2.\n\n* *note PyGetCopyright(): 48a3.\n\n* *note PyGetPlatform(): 48a4.\n\n* *note PyGetVersion(): 48a5.\n\n* Utilities:\n\n* *note PyDecodeLocale(): a0b.\n\n* Memory allocators:\n\n* *note PyMemRawMalloc(): ea9.\n\n* *note PyMemRawRealloc(): eaa.\n\n* *note PyMemRawCalloc(): d11.\n\n* *note PyMemRawFree(): 4905.\n\nNote: The following functions 'should not be called' before *note\nPyInitialize(): 6c2.: *note PyEncodeLocale(): a0c, *note\nPyGetPath(): 32b, *note PyGetPrefix(): 32d, *note\nPyGetExecPrefix(): 329, *note PyGetProgramFullPath(): 32f, *note\nPyGetPythonHome(): 332, *note PyGetProgramName(): 331. and *note\nPyEvalInitThreads(): 47ab.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Global configuration variables,  Next: Initializing and finalizing the interpreter,  Prev: Before Python Initialization,  Up: Initialization Finalization and Threads": {
            "content": "",
            "subsections": []
        },
        "Python has variables for the global configuration to control different": {
            "content": "features and options.  By default, these flags are controlled by *note\ncommand line options: 1aac.\n",
            "subsections": []
        },
        "When a flag is set by an option, the value of the flag is the number of": {
            "content": "times that the option was set.  For example, '-b' sets *note\nPyBytesWarningFlag: 2fe. to 1 and '-bb' sets *note PyBytesWarningFlag:\n2fe. to 2.\n\n-- C Variable: int PyBytesWarningFlag\n\nThis API is kept for backward compatibility: setting *note\nPyConfig.byteswarning: 2ff. should be used instead, see *note\nPython Initialization Configuration: 581.\n\nIssue a warning when comparing *note bytes: 295. or *note\nbytearray: 294. with *note str: 157. or *note bytes: 295. with\n*note int: 17e.  Issue an error if greater or equal to '2'.\n\nSet by the *note -b: 3a8. option.\n\nDeprecated since version 3.12.\n\n-- C Variable: int PyDebugFlag\n\nThis API is kept for backward compatibility: setting *note\nPyConfig.parserdebug: 2f1. should be used instead, see *note\nPython Initialization Configuration: 581.\n\nTurn on parser debugging output (for expert only, depending on\ncompilation options).\n\nSet by the *note -d: 1ab4. option and the *note PYTHONDEBUG: 1ab5.\nenvironment variable.\n\nDeprecated since version 3.12.\n\n-- C Variable: int PyDontWriteBytecodeFlag\n\nThis API is kept for backward compatibility: setting *note\nPyConfig.writebytecode: 305. should be used instead, see *note\nPython Initialization Configuration: 581.\n\nIf set to non-zero, Python won't try to write '.pyc' files on the\nimport of source modules.\n\nSet by the *note -B: 1222. option and the *note\nPYTHONDONTWRITEBYTECODE: 1223. environment variable.\n\nDeprecated since version 3.12.\n\n-- C Variable: int PyFrozenFlag\n\nThis API is kept for backward compatibility: setting *note\nPyConfig.pathconfigwarnings: 301. should be used instead, see\n*note Python Initialization Configuration: 581.\n\nSuppress error messages when calculating the module search path in\n*note PyGetPath(): 32b.\n\nPrivate flag used by 'freezemodule' and 'frozenmain' programs.\n\nDeprecated since version 3.12.\n\n-- C Variable: int PyHashRandomizationFlag\n\nThis API is kept for backward compatibility: setting *note\nPyConfig.hashseed: 30c. and *note PyConfig.usehashseed: 30b.\nshould be used instead, see *note Python Initialization\nConfiguration: 581.\n\nSet to '1' if the *note PYTHONHASHSEED: ef4. environment variable\nis set to a non-empty string.\n\nIf the flag is non-zero, read the *note PYTHONHASHSEED: ef4.\nenvironment variable to initialize the secret hash seed.\n\nDeprecated since version 3.12.\n\n-- C Variable: int PyIgnoreEnvironmentFlag\n\nThis API is kept for backward compatibility: setting *note\nPyConfig.useenvironment: 303. should be used instead, see *note\nPython Initialization Configuration: 581.\n\nIgnore all 'PYTHON*' environment variables, e.g.  *note PYTHONPATH:\ne92. and *note PYTHONHOME: 334, that might be set.\n\nSet by the *note -E: 77e. and *note -I: 77f. options.\n\nDeprecated since version 3.12.\n\n-- C Variable: int PyInspectFlag\n\nThis API is kept for backward compatibility: setting *note\nPyConfig.inspect: 2f9. should be used instead, see *note Python\nInitialization Configuration: 581.\n\nWhen a script is passed as first argument or the *note -c: 3a4.\noption is used, enter interactive mode after executing the script\nor the command, even when *note sys.stdin: 293. does not appear to\nbe a terminal.\n\nSet by the *note -i: 1336. option and the *note PYTHONINSPECT:\n1335. environment variable.\n\nDeprecated since version 3.12.\n\n-- C Variable: int PyInteractiveFlag\n\nThis API is kept for backward compatibility: setting *note\nPyConfig.interactive: 2f7. should be used instead, see *note Python\nInitialization Configuration: 581.\n\nSet by the *note -i: 1336. option.\n\nDeprecated since version 3.12.\n\n-- C Variable: int PyIsolatedFlag\n\nThis API is kept for backward compatibility: setting *note\nPyConfig.isolated: 30e. should be used instead, see *note Python\nInitialization Configuration: 581.\n\nRun Python in isolated mode.  In isolated mode *note sys.path: 32c.\ncontains neither the script's directory nor the user's\nsite-packages directory.\n\nSet by the *note -I: 77f. option.\n\nNew in version 3.4.\n\nDeprecated since version 3.12.\n\n-- C Variable: int PyLegacyWindowsFSEncodingFlag\n\nThis API is kept for backward compatibility: setting *note\nPyPreConfig.legacywindowsfsencoding: 310. should be used\ninstead, see *note Python Initialization Configuration: 581.\n\nIf the flag is non-zero, use the 'mbcs' encoding with 'replace'\nerror handler, instead of the UTF-8 encoding with 'surrogatepass'\nerror handler, for the *note filesystem encoding and error handler:\n291.\n\nSet to '1' if the *note PYTHONLEGACYWINDOWSFSENCODING: aa3.\nenvironment variable is set to a non-empty string.\n\nSee PEP 529(1) for more details.\n\n*note Availability: 1ad3.: Windows.\n\nDeprecated since version 3.12.\n\n-- C Variable: int PyLegacyWindowsStdioFlag\n\nThis API is kept for backward compatibility: setting *note\nPyConfig.legacywindowsstdio: 312. should be used instead, see\n*note Python Initialization Configuration: 581.\n\nIf the flag is non-zero, use *note io.FileIO: 1186. instead of\n'io.WindowsConsoleIO' for *note sys: d3. standard streams.\n\nSet to '1' if the *note PYTHONLEGACYWINDOWSSTDIO: aa6. environment\nvariable is set to a non-empty string.\n\nSee PEP 528(2) for more details.\n\n*note Availability: 1ad3.: Windows.\n\nDeprecated since version 3.12.\n\n-- C Variable: int PyNoSiteFlag\n\nThis API is kept for backward compatibility: setting *note\nPyConfig.siteimport: 2fd. should be used instead, see *note Python\nInitialization Configuration: 581.\n\nDisable the import of the module *note site: c2. and the\nsite-dependent manipulations of *note sys.path: 32c. that it\nentails.  Also disable these manipulations if *note site: c2. is\nexplicitly imported later (call *note site.main(): 1ab9. if you\nwant them to be triggered).\n\nSet by the *note -S: 101c. option.\n\nDeprecated since version 3.12.\n\n-- C Variable: int PyNoUserSiteDirectory\n\nThis API is kept for backward compatibility: setting *note\nPyConfig.usersitedirectory: 307. should be used instead, see\n*note Python Initialization Configuration: 581.\n\nDon't add the *note user site-packages directory: 1ab8. to *note\nsys.path: 32c.\n\nSet by the *note -s: 1200. and *note -I: 77f. options, and the\n*note PYTHONNOUSERSITE: 1201. environment variable.\n\nDeprecated since version 3.12.\n\n-- C Variable: int PyOptimizeFlag\n\nThis API is kept for backward compatibility: setting *note\nPyConfig.optimizationlevel: 2fb. should be used instead, see *note\nPython Initialization Configuration: 581.\n\nSet by the *note -O: c11. option and the *note PYTHONOPTIMIZE:\n1ab6. environment variable.\n\nDeprecated since version 3.12.\n\n-- C Variable: int PyQuietFlag\n\nThis API is kept for backward compatibility: setting *note\nPyConfig.quiet: 2f5. should be used instead, see *note Python\nInitialization Configuration: 581.\n\nDon't display the copyright and version messages even in\ninteractive mode.\n\nSet by the *note -q: 1ab7. option.\n\nNew in version 3.2.\n\nDeprecated since version 3.12.\n\n-- C Variable: int PyUnbufferedStdioFlag\n\nThis API is kept for backward compatibility: setting *note\nPyConfig.bufferedstdio: 309. should be used instead, see *note\nPython Initialization Configuration: 581.\n\nForce the stdout and stderr streams to be unbuffered.\n\nSet by the *note -u: 1712. option and the *note PYTHONUNBUFFERED:\n1713. environment variable.\n\nDeprecated since version 3.12.\n\n-- C Variable: int PyVerboseFlag\n\nThis API is kept for backward compatibility: setting *note\nPyConfig.verbose: 2f3. should be used instead, see *note Python\nInitialization Configuration: 581.\n\nPrint a message each time a module is initialized, showing the\nplace (filename or built-in module) from which it is loaded.  If\ngreater or equal to '2', print a message for each file that is\nchecked for when searching for a module.  Also provides information\non module cleanup at exit.\n\nSet by the *note -v: 127b. option and the *note PYTHONVERBOSE:\n1aba. environment variable.\n\nDeprecated since version 3.12.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0529/\n\n(2) https://peps.python.org/pep-0528/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Initializing and finalizing the interpreter,  Next: Process-wide parameters,  Prev: Global configuration variables,  Up: Initialization Finalization and Threads": {
            "content": "-- C Function: void PyInitialize ()\n' Part of the *note Stable ABI: 2ac.'\n\nInitialize the Python interpreter.  In an application embedding\nPython, this should be called before using any other Python/C API\nfunctions; see *note Before Python Initialization: a09. for the few\nexceptions.\n\nThis initializes the table of loaded modules ('sys.modules'), and\ncreates the fundamental modules *note builtins: 10, *note main:\n1. and *note sys: d3.  It also initializes the module search path\n('sys.path').  It does not set 'sys.argv'; use *note\nPySysSetArgvEx(): 11cb. for that.  This is a no-op when called for\na second time (without calling *note PyFinalizeEx(): b67. first).\nThere is no return value; it is a fatal error if the initialization\nfails.\n\nUse the *note PyInitializeFromConfig(): 317. function to customize\nthe *note Python Initialization Configuration: 581.\n\nNote: On Windows, changes the console mode from 'OTEXT' to\n'OBINARY', which will also affect non-Python uses of the\nconsole using the C Runtime.\n\n-- C Function: void PyInitializeEx (int initsigs)\n' Part of the *note Stable ABI: 2ac.'  This function works like\n*note PyInitialize(): 6c2. if 'initsigs' is '1'.  If 'initsigs' is\n'0', it skips initialization registration of signal handlers, which\nmight be useful when Python is embedded.\n\nUse the *note PyInitializeFromConfig(): 317. function to customize\nthe *note Python Initialization Configuration: 581.\n\n-- C Function: int PyIsInitialized ()\n' Part of the *note Stable ABI: 2ac.'  Return true (nonzero) when\nthe Python interpreter has been initialized, false (zero) if not.\nAfter *note PyFinalizeEx(): b67. is called, this returns false\nuntil *note PyInitialize(): 6c2. is called again.\n\n-- C Function: int PyFinalizeEx ()\n' Part of the *note Stable ABI: 2ac. since version 3.6.'  Undo all\ninitializations made by *note PyInitialize(): 6c2. and subsequent\nuse of Python/C API functions, and destroy all sub-interpreters\n(see *note PyNewInterpreter(): 150d. below) that were created and\nnot yet destroyed since the last call to *note PyInitialize():\n6c2.  Ideally, this frees all memory allocated by the Python\ninterpreter.  This is a no-op when called for a second time\n(without calling *note PyInitialize(): 6c2. again first).\nNormally the return value is '0'.  If there were errors during\nfinalization (flushing buffered data), '-1' is returned.\n\nThis function is provided for a number of reasons.  An embedding\napplication might want to restart Python without having to restart\nthe application itself.  An application that has loaded the Python\ninterpreter from a dynamically loadable library (or DLL) might want\nto free all memory allocated by Python before unloading the DLL.\nDuring a hunt for memory leaks in an application a developer might\nwant to free all memory allocated by Python before exiting from the\napplication.\n\n'Bugs and caveats:' The destruction of modules and objects in\nmodules is done in random order; this may cause destructors (*note\ndel(): 1c66. methods) to fail when they depend on other objects\n(even functions) or modules.  Dynamically loaded extension modules\nloaded by Python are not unloaded.  Small amounts of memory\nallocated by the Python interpreter may not be freed (if you find a\nleak, please report it).  Memory tied up in circular references\nbetween objects is not freed.  Some memory allocated by extension\nmodules may not be freed.  Some extensions may not work properly if\ntheir initialization routine is called more than once; this can\nhappen if an application calls *note PyInitialize(): 6c2. and\n*note PyFinalizeEx(): b67. more than once.\n\nRaises an *note auditing event: 161d.\n'cpython.PySysClearAuditHooks' with no arguments.\n\nNew in version 3.6.\n\n-- C Function: void PyFinalize ()\n' Part of the *note Stable ABI: 2ac.'  This is a\nbackwards-compatible version of *note PyFinalizeEx(): b67. that\ndisregards the return value.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Process-wide parameters,  Next: Thread State and the Global Interpreter Lock,  Prev: Initializing and finalizing the interpreter,  Up: Initialization Finalization and Threads": {
            "content": "-- C Function: int PySetStandardStreamEncoding (const char *encoding,\nconst char *errors)\n\nThis API is kept for backward compatibility: setting *note\nPyConfig.stdioencoding: 4022. and *note PyConfig.stdioerrors:\n4023. should be used instead, see *note Python Initialization\nConfiguration: 581.\n\nThis function should be called before *note PyInitialize(): 6c2,\nif it is called at all.  It specifies which encoding and error\nhandling to use with standard IO, with the same meanings as in\n*note str.encode(): 6ee.\n\nIt overrides *note PYTHONIOENCODING: e7e. values, and allows\nembedding code to control IO encoding when the environment variable\ndoes not work.\n\n'encoding' and/or 'errors' may be 'NULL' to use *note\nPYTHONIOENCODING: e7e. and/or default values (depending on other\nsettings).\n\nNote that *note sys.stderr: 757. always uses the \"backslashreplace\"\nerror handler, regardless of this (or any other) setting.\n\nIf *note PyFinalizeEx(): b67. is called, this function will need\nto be called again in order to affect subsequent calls to *note\nPyInitialize(): 6c2.\n\nReturns '0' if successful, a nonzero value on error (e.g.  calling\nafter the interpreter has already been initialized).\n\nNew in version 3.4.\n\nDeprecated since version 3.11.\n\n-- C Function: void PySetProgramName (const wchart *name)\n' Part of the *note Stable ABI: 2ac.'\n\nThis API is kept for backward compatibility: setting *note\nPyConfig.programname: 4b32. should be used instead, see *note\nPython Initialization Configuration: 581.\n\nThis function should be called before *note PyInitialize(): 6c2.\nis called for the first time, if it is called at all.  It tells the\ninterpreter the value of the 'argv[0]' argument to the 'main()'\nfunction of the program (converted to wide characters).  This is\nused by *note PyGetPath(): 32b. and some other functions below to\nfind the Python run-time libraries relative to the interpreter\nexecutable.  The default value is ''python''.  The argument should\npoint to a zero-terminated wide character string in static storage\nwhose contents will not change for the duration of the program's\nexecution.  No code in the Python interpreter will change the\ncontents of this storage.\n\nUse *note PyDecodeLocale(): a0b. to decode a bytes string to get a\nwchart* string.\n\nDeprecated since version 3.11.\n\n-- C Function: wchart *PyGetProgramName ()\n' Part of the *note Stable ABI: 2ac.'\n\nReturn the program name set with *note PySetProgramName(): 181f,\nor the default.  The returned string points into static storage;\nthe caller should not modify its value.\n\nThis function should not be called before *note PyInitialize():\n6c2, otherwise it returns 'NULL'.\n\nChanged in version 3.10: It now returns 'NULL' if called before\n*note PyInitialize(): 6c2.\n\n-- C Function: wchart *PyGetPrefix ()\n' Part of the *note Stable ABI: 2ac.'  Return the 'prefix' for\ninstalled platform-independent files.  This is derived through a\nnumber of complicated rules from the program name set with *note\nPySetProgramName(): 181f. and some environment variables; for\nexample, if the program name is ''/usr/local/bin/python'', the\nprefix is ''/usr/local''.  The returned string points into static\nstorage; the caller should not modify its value.  This corresponds\nto the 'prefix' variable in the top-level 'Makefile' and the *note\n-prefix: 1ae0. argument to the 'configure' script at build time.\nThe value is available to Python code as 'sys.prefix'.  It is only\nuseful on Unix.  See also the next function.\n\nThis function should not be called before *note PyInitialize():\n6c2, otherwise it returns 'NULL'.\n\nChanged in version 3.10: It now returns 'NULL' if called before\n*note PyInitialize(): 6c2.\n\n-- C Function: wchart *PyGetExecPrefix ()\n' Part of the *note Stable ABI: 2ac.'  Return the 'exec-prefix' for\ninstalled platform-'dependent' files.  This is derived through a\nnumber of complicated rules from the program name set with *note\nPySetProgramName(): 181f. and some environment variables; for\nexample, if the program name is ''/usr/local/bin/python'', the\nexec-prefix is ''/usr/local''.  The returned string points into\nstatic storage; the caller should not modify its value.  This\ncorresponds to the 'execprefix' variable in the top-level\n'Makefile' and the '--exec-prefix' argument to the 'configure'\nscript at build time.  The value is available to Python code as\n'sys.execprefix'.  It is only useful on Unix.\n\nBackground: The exec-prefix differs from the prefix when platform\ndependent files (such as executables and shared libraries) are\ninstalled in a different directory tree.  In a typical\ninstallation, platform dependent files may be installed in the\n'/usr/local/plat' subtree while platform independent may be\ninstalled in '/usr/local'.\n\nGenerally speaking, a platform is a combination of hardware and\nsoftware families, e.g.  Sparc machines running the Solaris 2.x\noperating system are considered the same platform, but Intel\nmachines running Solaris 2.x are another platform, and Intel\nmachines running Linux are yet another platform.  Different major\nrevisions of the same operating system generally also form\ndifferent platforms.  Non-Unix operating systems are a different\nstory; the installation strategies on those systems are so\ndifferent that the prefix and exec-prefix are meaningless, and set\nto the empty string.  Note that compiled Python bytecode files are\nplatform independent (but not independent from the Python version\nby which they were compiled!).\n\nSystem administrators will know how to configure the 'mount' or\n'automount' programs to share '/usr/local' between platforms while\nhaving '/usr/local/plat' be a different filesystem for each\nplatform.\n\nThis function should not be called before *note PyInitialize():\n6c2, otherwise it returns 'NULL'.\n\nChanged in version 3.10: It now returns 'NULL' if called before\n*note PyInitialize(): 6c2.\n\n-- C Function: wchart *PyGetProgramFullPath ()\n' Part of the *note Stable ABI: 2ac.'\n\nReturn the full program name of the Python executable; this is\ncomputed as a side-effect of deriving the default module search\npath from the program name (set by *note PySetProgramName(): 181f.\nabove).  The returned string points into static storage; the caller\nshould not modify its value.  The value is available to Python code\nas 'sys.executable'.\n\nThis function should not be called before *note PyInitialize():\n6c2, otherwise it returns 'NULL'.\n\nChanged in version 3.10: It now returns 'NULL' if called before\n*note PyInitialize(): 6c2.\n\n-- C Function: wchart *PyGetPath ()\n' Part of the *note Stable ABI: 2ac.'\n\nReturn the default module search path; this is computed from the\nprogram name (set by *note PySetProgramName(): 181f. above) and\nsome environment variables.  The returned string consists of a\nseries of directory names separated by a platform dependent\ndelimiter character.  The delimiter character is '':'' on Unix and\nmacOS, '';'' on Windows.  The returned string points into static\nstorage; the caller should not modify its value.  The list *note\nsys.path: 32c. is initialized with this value on interpreter\nstartup; it can be (and usually is) modified later to change the\nsearch path for loading modules.\n\nThis function should not be called before *note PyInitialize():\n6c2, otherwise it returns 'NULL'.\n\nChanged in version 3.10: It now returns 'NULL' if called before\n*note PyInitialize(): 6c2.\n\n-- C Function: void PySetPath (const wchart*)\n' Part of the *note Stable ABI: 2ac. since version 3.7.'\n\nThis API is kept for backward compatibility: setting *note\nPyConfig.modulesearchpaths: 3b6. and *note\nPyConfig.modulesearchpathsset: 3b5. should be used instead, see\n*note Python Initialization Configuration: 581.\n\nSet the default module search path.  If this function is called\nbefore *note PyInitialize(): 6c2, then *note PyGetPath(): 32b.\nwon't attempt to compute a default search path but uses the one\nprovided instead.  This is useful if Python is embedded by an\napplication that has full knowledge of the location of all modules.\nThe path components should be separated by the platform dependent\ndelimiter character, which is '':'' on Unix and macOS, '';'' on\nWindows.\n\nThis also causes *note sys.executable: 330. to be set to the\nprogram full path (see *note PyGetProgramFullPath(): 32f.) and for\n*note sys.prefix: 32e. and *note sys.execprefix: 32a. to be empty.\nIt is up to the caller to modify these if required after calling\n*note PyInitialize(): 6c2.\n\nUse *note PyDecodeLocale(): a0b. to decode a bytes string to get a\nwchar* string.\n\nThe path argument is copied internally, so the caller may free it\nafter the call completes.\n\nChanged in version 3.8: The program full path is now used for *note\nsys.executable: 330, instead of the program name.\n\nDeprecated since version 3.11.\n\n-- C Function: const char *PyGetVersion ()\n' Part of the *note Stable ABI: 2ac.'  Return the version of this\nPython interpreter.  This is a string that looks something like\n\n\"3.0a5+ (py3k:63103M, May 12 2008, 00:53:55) \\n[GCC 4.2.3]\"\n\nThe first word (up to the first space character) is the current\nPython version; the first characters are the major and minor\nversion separated by a period.  The returned string points into\nstatic storage; the caller should not modify its value.  The value\nis available to Python code as *note sys.version: b70.\n\nSee also the *note PyVersion: 53d. constant.\n\n-- C Function: const char *PyGetPlatform ()\n' Part of the *note Stable ABI: 2ac.'\n\nReturn the platform identifier for the current platform.  On Unix,\nthis is formed from the \"official\" name of the operating system,\nconverted to lower case, followed by the major revision number;\ne.g., for Solaris 2.x, which is also known as SunOS 5.x, the value\nis ''sunos5''.  On macOS, it is ''darwin''.  On Windows, it is\n''win''.  The returned string points into static storage; the\ncaller should not modify its value.  The value is available to\nPython code as 'sys.platform'.\n\n-- C Function: const char *PyGetCopyright ()\n' Part of the *note Stable ABI: 2ac.'  Return the official\ncopyright string for the current Python version, for example\n\n''Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam''\n\nThe returned string points into static storage; the caller should\nnot modify its value.  The value is available to Python code as\n'sys.copyright'.\n\n-- C Function: const char *PyGetCompiler ()\n' Part of the *note Stable ABI: 2ac.'  Return an indication of the\ncompiler used to build the current Python version, in square\nbrackets, for example:\n\n\"[GCC 2.7.2.2]\"\n\nThe returned string points into static storage; the caller should\nnot modify its value.  The value is available to Python code as\npart of the variable 'sys.version'.\n\n-- C Function: const char *PyGetBuildInfo ()\n' Part of the *note Stable ABI: 2ac.'  Return information about the\nsequence number and build date and time of the current Python\ninterpreter instance, for example\n\n\"#67, Aug  1 1997, 22:34:28\"\n\nThe returned string points into static storage; the caller should\nnot modify its value.  The value is available to Python code as\npart of the variable 'sys.version'.\n\n-- C Function: void PySysSetArgvEx (int argc, wchart argv, int\nupdatepath)\n' Part of the *note Stable ABI: 2ac.'\n\nThis API is kept for backward compatibility: setting *note\nPyConfig.argv: 168d, *note PyConfig.parseargv: 168e. and *note\nPyConfig.safepath: 55e. should be used instead, see *note Python\nInitialization Configuration: 581.\n\nSet *note sys.argv: 10dd. based on 'argc' and 'argv'.  These\nparameters are similar to those passed to the program's 'main()'\nfunction with the difference that the first entry should refer to\nthe script file to be executed rather than the executable hosting\nthe Python interpreter.  If there isn't a script that will be run,\nthe first entry in 'argv' can be an empty string.  If this function\nfails to initialize *note sys.argv: 10dd, a fatal condition is\nsignalled using *note PyFatalError(): 7a7.\n\nIf 'updatepath' is zero, this is all the function does.  If\n'updatepath' is non-zero, the function also modifies *note\nsys.path: 32c. according to the following algorithm:\n\n- If the name of an existing script is passed in 'argv[0]', the\nabsolute path of the directory where the script is located is\nprepended to *note sys.path: 32c.\n\n- Otherwise (that is, if 'argc' is '0' or 'argv[0]' doesn't\npoint to an existing file name), an empty string is prepended\nto *note sys.path: 32c, which is the same as prepending the\ncurrent working directory ('\".\"').\n\nUse *note PyDecodeLocale(): a0b. to decode a bytes string to get a\nwchar* string.\n\nSee also *note PyConfig.origargv: 6a2. and *note PyConfig.argv:\n168d. members of the *note Python Initialization Configuration:\n581.\n\nNote: It is recommended that applications embedding the Python\ninterpreter for purposes other than executing a single script\npass '0' as 'updatepath', and update *note sys.path: 32c.\nthemselves if desired.  See CVE-2008-5983(1).\n\nOn versions before 3.1.3, you can achieve the same effect by\nmanually popping the first *note sys.path: 32c. element after\nhaving called *note PySysSetArgv(): 11cc, for example using:\n\nPyRunSimpleString(\"import sys; sys.path.pop(0)\\n\");\n\nNew in version 3.1.3.\n\nDeprecated since version 3.11.\n\n-- C Function: void PySysSetArgv (int argc, wchart argv)\n' Part of the *note Stable ABI: 2ac.'  This API is kept for\nbackward compatibility: setting *note PyConfig.argv: 168d. and\n*note PyConfig.parseargv: 168e. should be used instead, see *note\nPython Initialization Configuration: 581.\n\nThis function works like *note PySysSetArgvEx(): 11cb. with\n'updatepath' set to '1' unless the 'python' interpreter was started\nwith the *note -I: 77f.\n\nUse *note PyDecodeLocale(): a0b. to decode a bytes string to get a\nwchar* string.\n\nSee also *note PyConfig.origargv: 6a2. and *note PyConfig.argv:\n168d. members of the *note Python Initialization Configuration:\n581.\n\nChanged in version 3.4: The 'updatepath' value depends on *note -I:\n77f.\n\nDeprecated since version 3.11.\n\n-- C Function: void PySetPythonHome (const wchart *home)\n' Part of the *note Stable ABI: 2ac.'  This API is kept for\nbackward compatibility: setting *note PyConfig.home: 333. should be\nused instead, see *note Python Initialization Configuration: 581.\n\nSet the default \"home\" directory, that is, the location of the\nstandard Python libraries.  See *note PYTHONHOME: 334. for the\nmeaning of the argument string.\n\nThe argument should point to a zero-terminated character string in\nstatic storage whose contents will not change for the duration of\nthe program's execution.  No code in the Python interpreter will\nchange the contents of this storage.\n\nUse *note PyDecodeLocale(): a0b. to decode a bytes string to get a\nwchar* string.\n\nDeprecated since version 3.11.\n\n-- C Function: wchart *PyGetPythonHome ()\n' Part of the *note Stable ABI: 2ac.'  Return the default \"home\",\nthat is, the value set by a previous call to *note\nPySetPythonHome(): 1820, or the value of the *note PYTHONHOME:\n334. environment variable if it is set.\n\nThis function should not be called before *note PyInitialize():\n6c2, otherwise it returns 'NULL'.\n\nChanged in version 3.10: It now returns 'NULL' if called before\n*note PyInitialize(): 6c2.\n\n---------- Footnotes ----------\n\n(1) https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-5983\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Thread State and the Global Interpreter Lock,  Next: Sub-interpreter support,  Prev: Process-wide parameters,  Up: Initialization Finalization and Threads": {
            "content": "",
            "subsections": []
        },
        "The Python interpreter is not fully thread-safe.  In order to support": {
            "content": "multi-threaded Python programs, there's a global lock, called the *note\nglobal interpreter lock: 141. or *note GIL: 6c0, that must be held by\nthe current thread before it can safely access Python objects.  Without\nthe lock, even the simplest operations could cause problems in a\nmulti-threaded program: for example, when two threads simultaneously\nincrement the reference count of the same object, the reference count\ncould end up being incremented only once instead of twice.\n",
            "subsections": []
        },
        "Therefore, the rule exists that only the thread that has acquired the": {
            "content": "*note GIL: 6c0. may operate on Python objects or call Python/C API\nfunctions.  In order to emulate concurrency of execution, the\ninterpreter regularly tries to switch threads (see *note\nsys.setswitchinterval(): 76a.).  The lock is also released around\npotentially blocking I/O operations like reading or writing a file, so\nthat other Python threads can run in the meantime.\n",
            "subsections": []
        },
        "The Python interpreter keeps some thread-specific bookkeeping": {
            "content": "information inside a data structure called *note PyThreadState: 57a.\nThere's also one global variable pointing to the current *note\nPyThreadState: 57a.: it can be retrieved using *note\nPyThreadStateGet(): 4851.\n\n* Menu:\n\n* Releasing the GIL from extension code::\n* Non-Python created threads::\n* Cautions about fork(): Cautions about fork.\n* High-level API::\n* Low-level API::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Releasing the GIL from extension code,  Next: Non-Python created threads,  Up: Thread State and the Global Interpreter Lock": {
            "content": "7.9.5.1 Releasing the GIL from extension code\n.............................................\n\nMost extension code manipulating the *note GIL: 6c0. has the following\nsimple structure:\n\nSave the thread state in a local variable.\nRelease the global interpreter lock.\n... Do some blocking I/O operation ...\nReacquire the global interpreter lock.\nRestore the thread state from the local variable.\n\nThis is so common that a pair of macros exists to simplify it:\n\nPyBEGINALLOWTHREADS\n... Do some blocking I/O operation ...\nPyENDALLOWTHREADS\n\nThe *note PyBEGINALLOWTHREADS: 46be. macro opens a new block and\ndeclares a hidden local variable; the *note PyENDALLOWTHREADS: 8be.\nmacro closes the block.\n\nThe block above expands to the following code:\n\nPyThreadState *save;\n\nsave = PyEvalSaveThread();\n... Do some blocking I/O operation ...\nPyEvalRestoreThread(save);\n",
            "subsections": []
        },
        "Here is how these functions work: the global interpreter lock is used to": {
            "content": "protect the pointer to the current thread state.  When releasing the\nlock and saving the thread state, the current thread state pointer must\nbe retrieved before the lock is released (since another thread could\nimmediately acquire the lock and store its own thread state in the\nglobal variable).  Conversely, when acquiring the lock and restoring the\nthread state, the lock must be acquired before storing the thread state\npointer.\n\nNote: Calling system I/O functions is the most common use case for\nreleasing the GIL, but it can also be useful before calling\nlong-running computations which don't need access to Python\nobjects, such as compression or cryptographic functions operating\nover memory buffers.  For example, the standard *note zlib: 12d.\nand *note hashlib: 63. modules release the GIL when compressing or\nhashing data.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "7.9.5.2 Non-Python created threads\n..................................\n",
            "subsections": []
        },
        "When threads are created using the dedicated Python APIs (such as the": {
            "content": "*note threading: e7. module), a thread state is automatically associated\nto them and the code showed above is therefore correct.  However, when\nthreads are created from C (for example by a third-party library with\nits own thread management), they don't hold the GIL, nor is there a\nthread state structure for them.\n",
            "subsections": []
        },
        "If you need to call Python code from these threads (often this will be": {
            "content": "part of a callback API provided by the aforementioned third-party\nlibrary), you must first register these threads with the interpreter by\ncreating a thread state data structure, then acquiring the GIL, and\nfinally storing their thread state pointer, before you can start using\nthe Python/C API. When you are done, you should reset the thread state\npointer, release the GIL, and finally free the thread state data\nstructure.\n\nThe *note PyGILStateEnsure(): 8bf. and *note PyGILStateRelease():\n47bd. functions do all of the above automatically.  The typical idiom\nfor calling into Python from a C thread is:\n\nPyGILStateSTATE gstate;\ngstate = PyGILStateEnsure();\n\n/* Perform Python actions here. */\nresult = CallSomeFunction();\n/* evaluate result or handle exception */\n\n/* Release the thread. No Python API allowed beyond this point. */\nPyGILStateRelease(gstate);\n\nNote that the 'PyGILState*' functions assume there is only one global\ninterpreter (created automatically by *note PyInitialize(): 6c2.).\nPython supports the creation of additional interpreters (using *note",
            "subsections": []
        },
        "PyNewInterpreter(): 150d.), but mixing multiple interpreters and the": {
            "content": "'PyGILState*' API is unsupported.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Cautions about fork,  Next: High-level API,  Prev: Non-Python created threads,  Up: Thread State and the Global Interpreter Lock": {
            "content": "7.9.5.3 Cautions about fork()\n.............................\n",
            "subsections": []
        },
        "Another important thing to note about threads is their behaviour in the": {
            "content": "face of the C 'fork()' call.  On most systems with 'fork()', after a\nprocess forks only the thread that issued the fork will exist.  This has\na concrete impact both on how locks must be handled and on all stored\nstate in CPython's runtime.\n\nThe fact that only the \"current\" thread remains means any locks held by\nother threads will never be released.  Python solves this for *note\nos.fork(): 231. by acquiring the locks it uses internally before the\nfork, and releasing them afterwards.  In addition, it resets any *note",
            "subsections": []
        },
        "Lock Objects: 2d56. in the child.  When extending or embedding Python,": {
            "content": "there is no way to inform Python of additional (non-Python) locks that\nneed to be acquired before or reset after a fork.  OS facilities such as\n'pthreadatfork()' would need to be used to accomplish the same thing.",
            "subsections": []
        },
        "Additionally, when extending or embedding Python, calling 'fork()'": {
            "content": "directly rather than through *note os.fork(): 231. (and returning to or\ncalling into Python) may result in a deadlock by one of Python's\ninternal locks being held by a thread that is defunct after the fork.\n*note PyOSAfterForkChild(): 33b. tries to reset the necessary locks,\nbut is not always able to.\n",
            "subsections": []
        },
        "The fact that all other threads go away also means that CPython's": {
            "content": "runtime state there must be cleaned up properly, which *note os.fork():\n231. does.  This means finalizing all other *note PyThreadState: 57a.\nobjects belonging to the current interpreter and all other *note",
            "subsections": []
        },
        "PyInterpreterState: 6d5. objects.  Due to this and the special nature of": {
            "content": "the *note \"main\" interpreter: 2e9, 'fork()' should only be called in\nthat interpreter's \"main\" thread, where the CPython global runtime was\noriginally initialized.  The only exception is if 'exec()' will be\ncalled immediately after.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: High-level API,  Next: Low-level API,  Prev: Cautions about fork,  Up: Thread State and the Global Interpreter Lock": {
            "content": "7.9.5.4 High-level API\n......................\n",
            "subsections": []
        },
        "These are the most commonly used types and functions when writing C": {
            "content": "extension code, or when embedding the Python interpreter:\n\n-- C Type: type PyInterpreterState\n' Part of the *note Limited API: 2ac. (as an opaque struct).'  This\ndata structure represents the state shared by a number of\ncooperating threads.  Threads belonging to the same interpreter\nshare their module administration and a few other internal items.\nThere are no public members in this structure.\n\nThreads belonging to different interpreters initially share\nnothing, except process state like available memory, open file\ndescriptors and such.  The global interpreter lock is also shared\nby all threads, regardless of to which interpreter they belong.\n\n-- C Type: type PyThreadState\n' Part of the *note Limited API: 2ac. (as an opaque struct).'  This\ndata structure represents the state of a single thread.  The only\npublic data member is:\n\n-- C Member: *note PyInterpreterState: 6d5. *interp\n\nThis thread's interpreter state.\n\n-- C Function: void PyEvalInitThreads ()\n' Part of the *note Stable ABI: 2ac.'\n\nDeprecated function which does nothing.\n\nIn Python 3.6 and older, this function created the GIL if it didn't\nexist.\n\nChanged in version 3.9: The function now does nothing.\n\nChanged in version 3.7: This function is now called by *note\nPyInitialize(): 6c2, so you don't have to call it yourself\nanymore.\n\nChanged in version 3.2: This function cannot be called before *note\nPyInitialize(): 6c2. anymore.\n\nDeprecated since version 3.9.\n\n-- C Function: int PyEvalThreadsInitialized ()\n' Part of the *note Stable ABI: 2ac.'  Returns a non-zero value if\n*note PyEvalInitThreads(): 47ab. has been called.  This function\ncan be called without holding the GIL, and therefore can be used to\navoid calls to the locking API when running single-threaded.\n\nChanged in version 3.7: The *note GIL: 6c0. is now initialized by\n*note PyInitialize(): 6c2.\n\nDeprecated since version 3.9.\n\n-- C Function: *note PyThreadState: 57a. *PyEvalSaveThread ()\n' Part of the *note Stable ABI: 2ac.'  Release the global\ninterpreter lock (if it has been created) and reset the thread\nstate to 'NULL', returning the previous thread state (which is not\n'NULL').  If the lock has been created, the current thread must\nhave acquired it.\n\n-- C Function: void PyEvalRestoreThread (PyThreadState *tstate)\n' Part of the *note Stable ABI: 2ac.'  Acquire the global\ninterpreter lock (if it has been created) and set the thread state\nto 'tstate', which must not be 'NULL'.  If the lock has been\ncreated, the current thread must not have acquired it, otherwise\ndeadlock ensues.\n\nNote: Calling this function from a thread when the runtime is\nfinalizing will terminate the thread, even if the thread was\nnot created by Python.  You can use 'PyIsFinalizing()' or\n*note sys.isfinalizing(): 8c0. to check if the interpreter is\nin process of being finalized before calling this function to\navoid unwanted termination.\n\n-- C Function: *note PyThreadState: 57a. *PyThreadStateGet ()\n' Part of the *note Stable ABI: 2ac.'  Return the current thread\nstate.  The global interpreter lock must be held.  When the current\nthread state is 'NULL', this issues a fatal error (so that the\ncaller needn't check for 'NULL').\n\n-- C Function: *note PyThreadState: 57a. *PyThreadStateSwap\n(PyThreadState *tstate)\n' Part of the *note Stable ABI: 2ac.'  Swap the current thread\nstate with the thread state given by the argument 'tstate', which\nmay be 'NULL'.  The global interpreter lock must be held and is not\nreleased.\n",
            "subsections": []
        },
        "The following functions use thread-local storage, and are not compatible": {
            "content": "with sub-interpreters:\n\n-- C Function: PyGILStateSTATE PyGILStateEnsure ()\n' Part of the *note Stable ABI: 2ac.'  Ensure that the current\nthread is ready to call the Python C API regardless of the current\nstate of Python, or of the global interpreter lock.  This may be\ncalled as many times as desired by a thread as long as each call is\nmatched with a call to *note PyGILStateRelease(): 47bd.  In\ngeneral, other thread-related APIs may be used between *note\nPyGILStateEnsure(): 8bf. and *note PyGILStateRelease(): 47bd.\ncalls as long as the thread state is restored to its previous state\nbefore the Release().  For example, normal usage of the *note\nPyBEGINALLOWTHREADS: 46be. and *note PyENDALLOWTHREADS: 8be.\nmacros is acceptable.\n\nThe return value is an opaque \"handle\" to the thread state when\n*note PyGILStateEnsure(): 8bf. was called, and must be passed to\n*note PyGILStateRelease(): 47bd. to ensure Python is left in the\nsame state.  Even though recursive calls are allowed, these handles\n'cannot' be shared - each unique call to *note PyGILStateEnsure():\n8bf. must save the handle for its call to *note\nPyGILStateRelease(): 47bd.\n\nWhen the function returns, the current thread will hold the GIL and\nbe able to call arbitrary Python code.  Failure is a fatal error.\n\nNote: Calling this function from a thread when the runtime is\nfinalizing will terminate the thread, even if the thread was\nnot created by Python.  You can use 'PyIsFinalizing()' or\n*note sys.isfinalizing(): 8c0. to check if the interpreter is\nin process of being finalized before calling this function to\navoid unwanted termination.\n\n-- C Function: void PyGILStateRelease (PyGILStateSTATE)\n' Part of the *note Stable ABI: 2ac.'  Release any resources\npreviously acquired.  After this call, Python's state will be the\nsame as it was prior to the corresponding *note\nPyGILStateEnsure(): 8bf. call (but generally this state will be\nunknown to the caller, hence the use of the GILState API).\n\nEvery call to *note PyGILStateEnsure(): 8bf. must be matched by a\ncall to *note PyGILStateRelease(): 47bd. on the same thread.\n\n-- C Function: *note PyThreadState: 57a. *PyGILStateGetThisThreadState\n()\n' Part of the *note Stable ABI: 2ac.'  Get the current thread state\nfor this thread.  May return 'NULL' if no GILState API has been\nused on the current thread.  Note that the main thread always has\nsuch a thread-state, even if no auto-thread-state call has been\nmade on the main thread.  This is mainly a helper/diagnostic\nfunction.\n\n-- C Function: int PyGILStateCheck ()\n\nReturn '1' if the current thread is holding the GIL and '0'\notherwise.  This function can be called from any thread at any\ntime.  Only if it has had its Python thread state initialized and\ncurrently is holding the GIL will it return '1'.  This is mainly a\nhelper/diagnostic function.  It can be useful for example in\ncallback contexts or memory allocation functions when knowing that\nthe GIL is locked can allow the caller to perform sensitive actions\nor otherwise behave differently.\n\nNew in version 3.4.\n",
            "subsections": []
        },
        "The following macros are normally used without a trailing semicolon;": {
            "content": "look for example usage in the Python source distribution.\n\n-- C Macro: PyBEGINALLOWTHREADS\n' Part of the *note Stable ABI: 2ac.'  This macro expands to '{\nPyThreadState *save; save = PyEvalSaveThread();'.  Note that it\ncontains an opening brace; it must be matched with a following\n*note PyENDALLOWTHREADS: 8be. macro.  See above for further\ndiscussion of this macro.\n\n-- C Macro: PyENDALLOWTHREADS\n' Part of the *note Stable ABI: 2ac.'  This macro expands to\n'PyEvalRestoreThread(save); }'.  Note that it contains a closing\nbrace; it must be matched with an earlier *note\nPyBEGINALLOWTHREADS: 46be. macro.  See above for further\ndiscussion of this macro.\n\n-- C Macro: PyBLOCKTHREADS\n' Part of the *note Stable ABI: 2ac.'  This macro expands to\n'PyEvalRestoreThread(save);': it is equivalent to *note\nPyENDALLOWTHREADS: 8be. without the closing brace.\n\n-- C Macro: PyUNBLOCKTHREADS\n' Part of the *note Stable ABI: 2ac.'  This macro expands to 'save\n= PyEvalSaveThread();': it is equivalent to *note\nPyBEGINALLOWTHREADS: 46be. without the opening brace and\nvariable declaration.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Low-level API,  Prev: High-level API,  Up: Thread State and the Global Interpreter Lock": {
            "content": "7.9.5.5 Low-level API\n.....................\n\nAll of the following functions must be called after *note\nPyInitialize(): 6c2.\n\nChanged in version 3.7: *note PyInitialize(): 6c2. now initializes the\n*note GIL: 6c0.\n\n-- C Function: *note PyInterpreterState: 6d5. *PyInterpreterStateNew\n()\n' Part of the *note Stable ABI: 2ac.'  Create a new interpreter\nstate object.  The global interpreter lock need not be held, but\nmay be held if it is necessary to serialize calls to this function.\n\nRaises an *note auditing event: 161d.\n'cpython.PyInterpreterStateNew' with no arguments.\n\n-- C Function: void PyInterpreterStateClear (PyInterpreterState\n*interp)\n' Part of the *note Stable ABI: 2ac.'  Reset all information in an\ninterpreter state object.  The global interpreter lock must be\nheld.\n\nRaises an *note auditing event: 161d.\n'cpython.PyInterpreterStateClear' with no arguments.\n\n-- C Function: void PyInterpreterStateDelete (PyInterpreterState\n*interp)\n' Part of the *note Stable ABI: 2ac.'  Destroy an interpreter state\nobject.  The global interpreter lock need not be held.  The\ninterpreter state must have been reset with a previous call to\n*note PyInterpreterStateClear(): 3e77.\n\n-- C Function: *note PyThreadState: 57a. *PyThreadStateNew\n(PyInterpreterState *interp)\n' Part of the *note Stable ABI: 2ac.'  Create a new thread state\nobject belonging to the given interpreter object.  The global\ninterpreter lock need not be held, but may be held if it is\nnecessary to serialize calls to this function.\n\n-- C Function: void PyThreadStateClear (PyThreadState *tstate)\n' Part of the *note Stable ABI: 2ac.'  Reset all information in a\nthread state object.  The global interpreter lock must be held.\n\nChanged in version 3.9: This function now calls the\n'PyThreadState.ondelete' callback.  Previously, that happened in\n*note PyThreadStateDelete(): 170e.\n\n-- C Function: void PyThreadStateDelete (PyThreadState *tstate)\n' Part of the *note Stable ABI: 2ac.'  Destroy a thread state\nobject.  The global interpreter lock need not be held.  The thread\nstate must have been reset with a previous call to *note\nPyThreadStateClear(): 16d4.\n\n-- C Function: void PyThreadStateDeleteCurrent (void)\n\nDestroy the current thread state and release the global interpreter\nlock.  Like *note PyThreadStateDelete(): 170e, the global\ninterpreter lock need not be held.  The thread state must have been\nreset with a previous call to *note PyThreadStateClear(): 16d4.\n\n-- C Function: *note PyFrameObject: 575. *PyThreadStateGetFrame\n(PyThreadState *tstate)\n' Part of the *note Stable ABI: 2ac. since version 3.10.'  Get the\ncurrent frame of the Python thread state 'tstate'.\n\nReturn a *note strong reference: 57c.  Return 'NULL' if no frame is\ncurrently executing.\n\nSee also *note PyEvalGetFrame(): 1513.\n\n'tstate' must not be 'NULL'.\n\nNew in version 3.9.\n\n-- C Function: uint64t PyThreadStateGetID (PyThreadState *tstate)\n' Part of the *note Stable ABI: 2ac. since version 3.10.'  Get the\nunique thread state identifier of the Python thread state 'tstate'.\n\n'tstate' must not be 'NULL'.\n\nNew in version 3.9.\n\n-- C Function: *note PyInterpreterState: 6d5.\n*PyThreadStateGetInterpreter (PyThreadState *tstate)\n' Part of the *note Stable ABI: 2ac. since version 3.10.'  Get the\ninterpreter of the Python thread state 'tstate'.\n\n'tstate' must not be 'NULL'.\n\nNew in version 3.9.\n\n-- C Function: void PyThreadStateEnterTracing (PyThreadState *tstate)\n\nSuspend tracing and profiling in the Python thread state 'tstate'.\n\nResume them using the *note PyThreadStateLeaveTracing(): 53c.\nfunction.\n\nNew in version 3.11.\n\n-- C Function: void PyThreadStateLeaveTracing (PyThreadState *tstate)\n\nResume tracing and profiling in the Python thread state 'tstate'\nsuspended by the *note PyThreadStateEnterTracing(): 53b. function.\n\nSee also *note PyEvalSetTrace(): 1358. and *note\nPyEvalSetProfile(): 1357. functions.\n\nNew in version 3.11.\n\n-- C Function: *note PyInterpreterState: 6d5. *PyInterpreterStateGet\n(void)\n' Part of the *note Stable ABI: 2ac. since version 3.9.'  Get the\ncurrent interpreter.\n\nIssue a fatal error if there no current Python thread state or no\ncurrent interpreter.  It cannot return NULL.\n\nThe caller must hold the GIL.\n\nNew in version 3.9.\n\n-- C Function: int64t PyInterpreterStateGetID (PyInterpreterState\n*interp)\n' Part of the *note Stable ABI: 2ac. since version 3.7.'  Return\nthe interpreter's unique ID. If there was any error in doing so\nthen '-1' is returned and an error is set.\n\nThe caller must hold the GIL.\n\nNew in version 3.7.\n\n-- C Function: *note PyObject: 6b1. *PyInterpreterStateGetDict\n(PyInterpreterState *interp)\n' Part of the *note Stable ABI: 2ac. since version 3.8.'  Return a\ndictionary in which interpreter-specific data may be stored.  If\nthis function returns 'NULL' then no exception has been raised and\nthe caller should assume no interpreter-specific dict is available.\n\nThis is not a replacement for *note PyModuleGetState(): 7a4, which\nextensions should use to store interpreter-specific state\ninformation.\n\nNew in version 3.8.\n\n-- C Type: typedef *note PyObject: 6b1. *(*PyFrameEvalFunction)(*note\nPyThreadState: 57a. *tstate, *note PyInterpreterFrame: 4ad0.\n*frame, int throwflag)\n\nType of a frame evaluation function.\n\nThe 'throwflag' parameter is used by the 'throw()' method of\ngenerators: if non-zero, handle the current exception.\n\nChanged in version 3.9: The function now takes a 'tstate'\nparameter.\n\nChanged in version 3.11: The 'frame' parameter changed from\n'PyFrameObject*' to 'PyInterpreterFrame*'.\n\n-- C Function: *note PyFrameEvalFunction: 561.\nPyInterpreterStateGetEvalFrameFunc (PyInterpreterState\n*interp)\n\nGet the frame evaluation function.\n\nSee the PEP 523(1) \"Adding a frame evaluation API to CPython\".\n\nNew in version 3.9.\n\n-- C Function: void PyInterpreterStateSetEvalFrameFunc\n(PyInterpreterState *interp, PyFrameEvalFunction evalframe)\n\nSet the frame evaluation function.\n\nSee the PEP 523(2) \"Adding a frame evaluation API to CPython\".\n\nNew in version 3.9.\n\n-- C Function: *note PyObject: 6b1. *PyThreadStateGetDict ()\n'Return value: Borrowed reference.''  Part of the *note Stable ABI:\n2ac.'  Return a dictionary in which extensions can store\nthread-specific state information.  Each extension should use a\nunique key to use to store state in the dictionary.  It is okay to\ncall this function when no current thread state is available.  If\nthis function returns 'NULL', no exception has been raised and the\ncaller should assume no current thread state is available.\n\n-- C Function: int PyThreadStateSetAsyncExc (unsigned long id,\nPyObject *exc)\n' Part of the *note Stable ABI: 2ac.'  Asynchronously raise an\nexception in a thread.  The 'id' argument is the thread id of the\ntarget thread; 'exc' is the exception object to be raised.  This\nfunction does not steal any references to 'exc'.  To prevent naive\nmisuse, you must write your own C extension to call this.  Must be\ncalled with the GIL held.  Returns the number of thread states\nmodified; this is normally one, but will be zero if the thread id\nisn't found.  If 'exc' is 'NULL', the pending exception (if any)\nfor the thread is cleared.  This raises no exceptions.\n\nChanged in version 3.7: The type of the 'id' parameter changed from\nlong to unsigned long.\n\n-- C Function: void PyEvalAcquireThread (PyThreadState *tstate)\n' Part of the *note Stable ABI: 2ac.'  Acquire the global\ninterpreter lock and set the current thread state to 'tstate',\nwhich must not be 'NULL'.  The lock must have been created earlier.\nIf this thread already has the lock, deadlock ensues.\n\nNote: Calling this function from a thread when the runtime is\nfinalizing will terminate the thread, even if the thread was\nnot created by Python.  You can use 'PyIsFinalizing()' or\n*note sys.isfinalizing(): 8c0. to check if the interpreter is\nin process of being finalized before calling this function to\navoid unwanted termination.\n\nChanged in version 3.8: Updated to be consistent with *note\nPyEvalRestoreThread(): 8bd, *note PyENDALLOWTHREADS(): 8be, and\n*note PyGILStateEnsure(): 8bf, and terminate the current thread if\ncalled while the interpreter is finalizing.\n\n*note PyEvalRestoreThread(): 8bd. is a higher-level function which\nis always available (even when threads have not been initialized).\n\n-- C Function: void PyEvalReleaseThread (PyThreadState *tstate)\n' Part of the *note Stable ABI: 2ac.'  Reset the current thread\nstate to 'NULL' and release the global interpreter lock.  The lock\nmust have been created earlier and must be held by the current\nthread.  The 'tstate' argument, which must not be 'NULL', is only\nused to check that it represents the current thread state -- if it\nisn't, a fatal error is reported.\n\n*note PyEvalSaveThread(): 10f3. is a higher-level function which\nis always available (even when threads have not been initialized).\n\n-- C Function: void PyEvalAcquireLock ()\n' Part of the *note Stable ABI: 2ac.'  Acquire the global\ninterpreter lock.  The lock must have been created earlier.  If\nthis thread already has the lock, a deadlock ensues.\n\nDeprecated since version 3.2: This function does not update the\ncurrent thread state.  Please use *note PyEvalRestoreThread():\n8bd. or *note PyEvalAcquireThread(): 47a4. instead.\n\nNote: Calling this function from a thread when the runtime is\nfinalizing will terminate the thread, even if the thread was\nnot created by Python.  You can use 'PyIsFinalizing()' or\n*note sys.isfinalizing(): 8c0. to check if the interpreter is\nin process of being finalized before calling this function to\navoid unwanted termination.\n\nChanged in version 3.8: Updated to be consistent with *note\nPyEvalRestoreThread(): 8bd, *note PyENDALLOWTHREADS(): 8be, and\n*note PyGILStateEnsure(): 8bf, and terminate the current thread if\ncalled while the interpreter is finalizing.\n\n-- C Function: void PyEvalReleaseLock ()\n' Part of the *note Stable ABI: 2ac.'  Release the global\ninterpreter lock.  The lock must have been created earlier.\n\nDeprecated since version 3.2: This function does not update the\ncurrent thread state.  Please use *note PyEvalSaveThread(): 10f3.\nor *note PyEvalReleaseThread(): 47ad. instead.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0523/\n\n(2) https://peps.python.org/pep-0523/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Sub-interpreter support,  Next: Asynchronous Notifications,  Prev: Thread State and the Global Interpreter Lock,  Up: Initialization Finalization and Threads": {
            "content": "",
            "subsections": []
        },
        "While in most uses, you will only embed a single Python interpreter,": {
            "content": "there are cases where you need to create several independent\ninterpreters in the same process and perhaps even in the same thread.\nSub-interpreters allow you to do that.\n\nThe \"main\" interpreter is the first one created when the runtime\ninitializes.  It is usually the only Python interpreter in a process.",
            "subsections": []
        },
        "Unlike sub-interpreters, the main interpreter has unique process-global": {
            "content": "responsibilities like signal handling.  It is also responsible for\nexecution during runtime initialization and is usually the active\ninterpreter during runtime finalization.  The *note",
            "subsections": []
        },
        "PyInterpreterStateMain(): 4b3e. function returns a pointer to its": {
            "content": "state.\n\nYou can switch between sub-interpreters using the *note",
            "subsections": []
        },
        "PyThreadStateSwap(): 4854. function.  You can create and destroy them": {
            "content": "using the following functions:\n\n-- C Type: type PyInterpreterConfig\n\nStructure containing most parameters to configure a\nsub-interpreter.  Its values are used only in *note\nPyNewInterpreterFromConfig(): 16c. and never modified by the\nruntime.\n\nNew in version 3.12.\n\nStructure fields:\n\n-- C Member: int usemainobmalloc\n\nIf this is '0' then the sub-interpreter will use its own\n\"object\" allocator state.  Otherwise it will use (share) the\nmain interpreter's.\n\nIf this is '0' then *note checkmultiinterpextensions: 4b40.\nmust be '1' (non-zero).  If this is '1' then *note gil: 4b41.\nmust not be *note PyInterpreterConfigOWNGIL: 4b42.\n\n-- C Member: int allowfork\n\nIf this is '0' then the runtime will not support forking the\nprocess in any thread where the sub-interpreter is currently\nactive.  Otherwise fork is unrestricted.\n\nNote that the *note subprocess: d0. module still works when\nfork is disallowed.\n\n-- C Member: int allowexec\n\nIf this is '0' then the runtime will not support replacing the\ncurrent process via exec (e.g.  *note os.execv(): 2812.) in\nany thread where the sub-interpreter is currently active.\nOtherwise exec is unrestricted.\n\nNote that the *note subprocess: d0. module still works when\nexec is disallowed.\n\n-- C Member: int allowthreads\n\nIf this is '0' then the sub-interpreter's *note threading: e7.\nmodule won't create threads.  Otherwise threads are allowed.\n\n-- C Member: int allowdaemonthreads\n\nIf this is '0' then the sub-interpreter's *note threading: e7.\nmodule won't create daemon threads.  Otherwise daemon threads\nare allowed (as long as *note allowthreads: 4b45. is\nnon-zero).\n\n-- C Member: int checkmultiinterpextensions\n\nIf this is '0' then all extension modules may be imported,\nincluding legacy (single-phase init) modules, in any thread\nwhere the sub-interpreter is currently active.  Otherwise only\nmulti-phase init extension modules (see PEP 489(1)) may be\nimported.  (Also see *note Pymodmultipleinterpreters:\n4aa6.)\n\nThis must be '1' (non-zero) if *note usemainobmalloc: 4b3f.\nis '0'.\n\n-- C Member: int gil\n\nThis determines the operation of the GIL for the\nsub-interpreter.  It may be one of the following:\n\n-- C Macro: PyInterpreterConfigDEFAULTGIL\n\nUse the default selection (*note\nPyInterpreterConfigSHAREDGIL: 4b48.).\n\n-- C Macro: PyInterpreterConfigSHAREDGIL\n\nUse (share) the main interpreter's GIL.\n\n-- C Macro: PyInterpreterConfigOWNGIL\n\nUse the sub-interpreter's own GIL.\n\nIf this is *note PyInterpreterConfigOWNGIL: 4b42. then *note\nPyInterpreterConfig.usemainobmalloc: 4b3f. must be '0'.\n\n-- C Function: *note PyStatus: 7d1. PyNewInterpreterFromConfig\n(PyThreadState tstatep, const PyInterpreterConfig *config)\n\nCreate a new sub-interpreter.  This is an (almost) totally separate\nenvironment for the execution of Python code.  In particular, the\nnew interpreter has separate, independent versions of all imported\nmodules, including the fundamental modules *note builtins: 10,\n*note main: 1. and *note sys: d3.  The table of loaded modules\n('sys.modules') and the module search path ('sys.path') are also\nseparate.  The new environment has no 'sys.argv' variable.  It has\nnew standard I/O stream file objects 'sys.stdin', 'sys.stdout' and\n'sys.stderr' (however these refer to the same underlying file\ndescriptors).\n\nThe given 'config' controls the options with which the interpreter\nis initialized.\n\nUpon success, 'tstatep' will be set to the first thread state\ncreated in the new sub-interpreter.  This thread state is made in\nthe current thread state.  Note that no actual thread is created;\nsee the discussion of thread states below.  If creation of the new\ninterpreter is unsuccessful, 'tstatep' is set to 'NULL'; no\nexception is set since the exception state is stored in the current\nthread state and there may not be a current thread state.\n\nLike all other Python/C API functions, the global interpreter lock\nmust be held before calling this function and is still held when it\nreturns.  Likewise a current thread state must be set on entry.  On\nsuccess, the returned thread state will be set as current.  If the\nsub-interpreter is created with its own GIL then the GIL of the\ncalling interpreter will be released.  When the function returns,\nthe new interpreter's GIL will be held by the current thread and\nthe previously interpreter's GIL will remain released here.\n\nNew in version 3.12.\n\nSub-interpreters are most effective when isolated from each other,\nwith certain functionality restricted:\n\nPyInterpreterConfig config = {\n.usemainobmalloc = 0,\n.allowfork = 0,\n.allowexec = 0,\n.allowthreads = 1,\n.allowdaemonthreads = 0,\n.checkmultiinterpextensions = 1,\n.gil = PyInterpreterConfigOWNGIL,\n};\nPyThreadState *tstate = PyNewInterpreterFromConfig(&config);\n\nNote that the config is used only briefly and does not get\nmodified.  During initialization the config's values are converted\ninto various *note PyInterpreterState: 6d5. values.  A read-only\ncopy of the config may be stored internally on the *note\nPyInterpreterState: 6d5.\n\nExtension modules are shared between (sub-)interpreters as follows:\n\n* For modules using multi-phase initialization, e.g.  *note\nPyModuleFromDefAndSpec(): d17, a separate module object is\ncreated and initialized for each interpreter.  Only C-level\nstatic and global variables are shared between these module\nobjects.\n\n* For modules using single-phase initialization, e.g.  *note\nPyModuleCreate(): 46a2, the first time a particular extension\nis imported, it is initialized normally, and a (shallow) copy\nof its module's dictionary is squirreled away.  When the same\nextension is imported by another (sub-)interpreter, a new\nmodule is initialized and filled with the contents of this\ncopy; the extension's 'init' function is not called.  Objects\nin the module's dictionary thus end up shared across\n(sub-)interpreters, which might cause unwanted behavior (see\n*note Bugs and caveats: 4b49. below).\n\nNote that this is different from what happens when an\nextension is imported after the interpreter has been\ncompletely re-initialized by calling *note PyFinalizeEx():\nb67. and *note PyInitialize(): 6c2.; in that case, the\nextension's 'initmodule' function 'is' called again.  As with\nmulti-phase initialization, this means that only C-level\nstatic and global variables are shared between these modules.\n\n-- C Function: *note PyThreadState: 57a. *PyNewInterpreter (void)\n' Part of the *note Stable ABI: 2ac.'\n\nCreate a new sub-interpreter.  This is essentially just a wrapper\naround *note PyNewInterpreterFromConfig(): 16c. with a config that\npreserves the existing behavior.  The result is an unisolated\nsub-interpreter that shares the main interpreter's GIL, allows\nfork/exec, allows daemon threads, and allows single-phase init\nmodules.\n\n-- C Function: void PyEndInterpreter (PyThreadState *tstate)\n' Part of the *note Stable ABI: 2ac.'\n\nDestroy the (sub-)interpreter represented by the given thread\nstate.  The given thread state must be the current thread state.\nSee the discussion of thread states below.  When the call returns,\nthe current thread state is 'NULL'.  All thread states associated\nwith this interpreter are destroyed.  The global interpreter lock\nused by the target interpreter must be held before calling this\nfunction.  No GIL is held when it returns.\n\n*note PyFinalizeEx(): b67. will destroy all sub-interpreters that\nhaven't been explicitly destroyed at that point.\n\n* Menu:\n\n* A Per-Interpreter GIL::\n* Bugs and caveats::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0489/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: A Per-Interpreter GIL,  Next: Bugs and caveats,  Up: Sub-interpreter support": {
            "content": "7.9.6.1 A Per-Interpreter GIL\n.............................\n\nUsing *note PyNewInterpreterFromConfig(): 16c. you can create a\nsub-interpreter that is completely isolated from other interpreters,\nincluding having its own GIL. The most important benefit of this\nisolation is that such an interpreter can execute Python code without\nbeing blocked by other interpreters or blocking any others.  Thus a\nsingle Python process can truly take advantage of multiple CPU cores\nwhen running Python code.  The isolation also encourages a different\napproach to concurrency than that of just using threads.  (See PEP\n554(1).)\n",
            "subsections": []
        },
        "Using an isolated interpreter requires vigilance in preserving that": {
            "content": "isolation.  That especially means not sharing any objects or mutable\nstate without guarantees about thread-safety.  Even objects that are\notherwise immutable (e.g.  'None', '(1, 5)') can't normally be shared\nbecause of the refcount.  One simple but less-efficient approach around\nthis is to use a global lock around all use of some state (or object).",
            "subsections": []
        },
        "Alternately, effectively immutable objects (like integers or strings)": {
            "content": "can be made safe in spite of their refcounts by making them \"immortal\".",
            "subsections": []
        },
        "In fact, this has been done for the builtin singletons, small integers,": {
            "content": "and a number of other builtin objects.\n",
            "subsections": []
        },
        "If you preserve isolation then you will have access to proper multi-core": {
            "content": "computing without the complications that come with free-threading.",
            "subsections": []
        },
        "Failure to preserve isolation will expose you to the full consequences": {
            "content": "of free-threading, including races and hard-to-debug crashes.\n",
            "subsections": []
        },
        "Aside from that, one of the main challenges of using multiple isolated": {
            "content": "interpreters is how to communicate between them safely (not break\nisolation) and efficiently.  The runtime and stdlib do not provide any\nstandard approach to this yet.  A future stdlib module would help\nmitigate the effort of preserving isolation and expose effective tools\nfor communicating (and sharing) data between interpreters.\n\nNew in version 3.12.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0554/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Bugs and caveats,  Prev: A Per-Interpreter GIL,  Up: Sub-interpreter support": {
            "content": "7.9.6.2 Bugs and caveats\n........................\n",
            "subsections": []
        },
        "Because sub-interpreters (and the main interpreter) are part of the same": {
            "content": "process, the insulation between them isn't perfect -- for example, using\nlow-level file operations like *note os.close(): 9b5. they can\n(accidentally or maliciously) affect each other's open files.  Because\nof the way extensions are shared between (sub-)interpreters, some\nextensions may not work properly; this is especially likely when using\nsingle-phase initialization or (static) global variables.  It is\npossible to insert objects created in one sub-interpreter into a\nnamespace of another (sub-)interpreter; this should be avoided if\npossible.\n",
            "subsections": []
        },
        "Special care should be taken to avoid sharing user-defined functions,": {
            "content": "methods, instances or classes between sub-interpreters, since import\noperations executed by such objects may affect the wrong\n(sub-)interpreter's dictionary of loaded modules.  It is equally\nimportant to avoid sharing objects from which the above are reachable.\n\nAlso note that combining this functionality with 'PyGILState*' APIs is\ndelicate, because these APIs assume a bijection between Python thread\nstates and OS-level threads, an assumption broken by the presence of\nsub-interpreters.  It is highly recommended that you don't switch\nsub-interpreters between a pair of matching *note PyGILStateEnsure():\n8bf. and *note PyGILStateRelease(): 47bd. calls.  Furthermore,\nextensions (such as *note ctypes: 28.) using these APIs to allow calling\nof Python code from non-Python created threads will probably be broken\nwhen using sub-interpreters.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Asynchronous Notifications,  Next: Profiling and Tracing,  Prev: Sub-interpreter support,  Up: Initialization Finalization and Threads": {
            "content": "A mechanism is provided to make asynchronous notifications to the main\ninterpreter thread.  These notifications take the form of a function\npointer and a void pointer argument.\n\n-- C Function: int PyAddPendingCall (int (*func)(void*), void *arg)\n' Part of the *note Stable ABI: 2ac.'  Schedule a function to be\ncalled from the main interpreter thread.  On success, '0' is\nreturned and 'func' is queued for being called in the main thread.\nOn failure, '-1' is returned without setting any exception.\n\nWhen successfully queued, 'func' will be 'eventually' called from\nthe main interpreter thread with the argument 'arg'.  It will be\ncalled asynchronously with respect to normally running Python code,\nbut with both these conditions met:\n\n* on a *note bytecode: 370. boundary;\n\n* with the main thread holding the *note global interpreter\nlock: 141. ('func' can therefore use the full C API).\n\n'func' must return '0' on success, or '-1' on failure with an\nexception set.  'func' won't be interrupted to perform another\nasynchronous notification recursively, but it can still be\ninterrupted to switch threads if the global interpreter lock is\nreleased.\n\nThis function doesn't need a current thread state to run, and it\ndoesn't need the global interpreter lock.\n\nTo call this function in a subinterpreter, the caller must hold the\nGIL. Otherwise, the function 'func' can be scheduled to be called\nfrom the wrong interpreter.\n\nWarning: This is a low-level function, only useful for very\nspecial cases.  There is no guarantee that 'func' will be\ncalled as quick as possible.  If the main thread is busy\nexecuting a system call, 'func' won't be called before the\nsystem call returns.  This function is generally 'not'\nsuitable for calling Python code from arbitrary C threads.\nInstead, use the *note PyGILState API: 4b36.\n\nNew in version 3.1.\n\nChanged in version 3.9: If this function is called in a\nsubinterpreter, the function 'func' is now scheduled to be called\nfrom the subinterpreter, rather than being called from the main\ninterpreter.  Each subinterpreter now has its own list of scheduled\ncalls.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Profiling and Tracing,  Next: Advanced Debugger Support,  Prev: Asynchronous Notifications,  Up: Initialization Finalization and Threads": {
            "content": "",
            "subsections": []
        },
        "The Python interpreter provides some low-level support for attaching": {
            "content": "profiling and execution tracing facilities.  These are used for\nprofiling, debugging, and coverage analysis tools.\n",
            "subsections": []
        },
        "This C interface allows the profiling or tracing code to avoid the": {
            "content": "overhead of calling through Python-level callable objects, making a\ndirect C function call instead.  The essential attributes of the\nfacility have not changed; the interface allows trace functions to be\ninstalled per-thread, and the basic events reported to the trace\nfunction are the same as had been reported to the Python-level trace\nfunctions in previous versions.\n\n-- C Type: typedef int (*Pytracefunc)(*note PyObject: 6b1. *obj, *note\nPyFrameObject: 575. *frame, int what, *note PyObject: 6b1.\n*arg)\n\nThe type of the trace function registered using *note\nPyEvalSetProfile(): 1357. and *note PyEvalSetTrace(): 1358.  The\nfirst parameter is the object passed to the registration function\nas 'obj', 'frame' is the frame object to which the event pertains,\n'what' is one of the constants *note PyTraceCALL: 4b4f, *note\nPyTraceEXCEPTION: 4b50, *note PyTraceLINE: 4b51, *note\nPyTraceRETURN: 4b52, *note PyTraceCCALL: 4b53, *note\nPyTraceCEXCEPTION: 4b54, *note PyTraceCRETURN: 4b55, or *note\nPyTraceOPCODE: 4b56, and 'arg' depends on the value of 'what':\n\nValue of 'what'                     Meaning of 'arg'\n\n---------------------------------------------------------------------------------\n\n*note PyTraceCALL: 4b4f.           Always *note PyNone: 469e.\n\n\n*note PyTraceEXCEPTION: 4b50.      Exception information as returned by\n*note sys.excinfo(): 456.\n\n\n*note PyTraceLINE: 4b51.           Always *note PyNone: 469e.\n\n\n*note PyTraceRETURN: 4b52.         Value being returned to the caller, or\n'NULL' if caused by an exception.\n\n\n*note PyTraceCCALL: 4b53.         Function object being called.\n\n\n*note PyTraceCEXCEPTION: 4b54.    Function object being called.\n\n\n*note PyTraceCRETURN: 4b55.       Function object being called.\n\n\n*note PyTraceOPCODE: 4b56.         Always *note PyNone: 469e.\n\n\n-- C Variable: int PyTraceCALL\n\nThe value of the 'what' parameter to a *note Pytracefunc: 4b4e.\nfunction when a new call to a function or method is being reported,\nor a new entry into a generator.  Note that the creation of the\niterator for a generator function is not reported as there is no\ncontrol transfer to the Python bytecode in the corresponding frame.\n\n-- C Variable: int PyTraceEXCEPTION\n\nThe value of the 'what' parameter to a *note Pytracefunc: 4b4e.\nfunction when an exception has been raised.  The callback function\nis called with this value for 'what' when after any bytecode is\nprocessed after which the exception becomes set within the frame\nbeing executed.  The effect of this is that as exception\npropagation causes the Python stack to unwind, the callback is\ncalled upon return to each frame as the exception propagates.  Only\ntrace functions receives these events; they are not needed by the\nprofiler.\n\n-- C Variable: int PyTraceLINE\n\nThe value passed as the 'what' parameter to a *note Pytracefunc:\n4b4e. function (but not a profiling function) when a line-number\nevent is being reported.  It may be disabled for a frame by setting\n*note ftracelines: a1f. to '0' on that frame.\n\n-- C Variable: int PyTraceRETURN\n\nThe value for the 'what' parameter to *note Pytracefunc: 4b4e.\nfunctions when a call is about to return.\n\n-- C Variable: int PyTraceCCALL\n\nThe value for the 'what' parameter to *note Pytracefunc: 4b4e.\nfunctions when a C function is about to be called.\n\n-- C Variable: int PyTraceCEXCEPTION\n\nThe value for the 'what' parameter to *note Pytracefunc: 4b4e.\nfunctions when a C function has raised an exception.\n\n-- C Variable: int PyTraceCRETURN\n\nThe value for the 'what' parameter to *note Pytracefunc: 4b4e.\nfunctions when a C function has returned.\n\n-- C Variable: int PyTraceOPCODE\n\nThe value for the 'what' parameter to *note Pytracefunc: 4b4e.\nfunctions (but not profiling functions) when a new opcode is about\nto be executed.  This event is not emitted by default: it must be\nexplicitly requested by setting *note ftraceopcodes: a20. to '1'\non the frame.\n\n-- C Function: void PyEvalSetProfile (Pytracefunc func, PyObject\n*obj)\n\nSet the profiler function to 'func'.  The 'obj' parameter is passed\nto the function as its first parameter, and may be any Python\nobject, or 'NULL'.  If the profile function needs to maintain\nstate, using a different value for 'obj' for each thread provides a\nconvenient and thread-safe place to store it.  The profile function\nis called for all monitored events except *note PyTraceLINE: 4b51.\n*note PyTraceOPCODE: 4b56. and *note PyTraceEXCEPTION: 4b50.\n\nSee also the *note sys.setprofile(): 1359. function.\n\nThe caller must hold the *note GIL: 6c0.\n\n-- C Function: void PyEvalSetProfileAllThreads (Pytracefunc func,\nPyObject *obj)\n\nLike *note PyEvalSetProfile(): 1357. but sets the profile function\nin all running threads belonging to the current interpreter instead\nof the setting it only on the current thread.\n\nThe caller must hold the *note GIL: 6c0.\n\nAs *note PyEvalSetProfile(): 1357, this function ignores any\nexceptions raised while setting the profile functions in all\nthreads.\n\nNew in version 3.12.\n\n-- C Function: void PyEvalSetTrace (Pytracefunc func, PyObject *obj)\n\nSet the tracing function to 'func'.  This is similar to *note\nPyEvalSetProfile(): 1357, except the tracing function does receive\nline-number events and per-opcode events, but does not receive any\nevent related to C function objects being called.  Any trace\nfunction registered using *note PyEvalSetTrace(): 1358. will not\nreceive *note PyTraceCCALL: 4b53, *note PyTraceCEXCEPTION:\n4b54. or *note PyTraceCRETURN: 4b55. as a value for the 'what'\nparameter.\n\nSee also the *note sys.settrace(): 135a. function.\n\nThe caller must hold the *note GIL: 6c0.\n\n-- C Function: void PyEvalSetTraceAllThreads (Pytracefunc func,\nPyObject *obj)\n\nLike *note PyEvalSetTrace(): 1358. but sets the tracing function\nin all running threads belonging to the current interpreter instead\nof the setting it only on the current thread.\n\nThe caller must hold the *note GIL: 6c0.\n\nAs *note PyEvalSetTrace(): 1358, this function ignores any\nexceptions raised while setting the trace functions in all threads.\n\nNew in version 3.12.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Advanced Debugger Support,  Next: Thread Local Storage Support,  Prev: Profiling and Tracing,  Up: Initialization Finalization and Threads": {
            "content": "",
            "subsections": []
        },
        "These functions are only intended to be used by advanced debugging": {
            "content": "tools.\n\n-- C Function: *note PyInterpreterState: 6d5. *PyInterpreterStateHead\n()\n\nReturn the interpreter state object at the head of the list of all\nsuch objects.\n\n-- C Function: *note PyInterpreterState: 6d5. *PyInterpreterStateMain\n()\n\nReturn the main interpreter state object.\n\n-- C Function: *note PyInterpreterState: 6d5. *PyInterpreterStateNext\n(PyInterpreterState *interp)\n\nReturn the next interpreter state object after 'interp' from the\nlist of all such objects.\n\n-- C Function: *note PyThreadState: 57a. *PyInterpreterStateThreadHead\n(PyInterpreterState *interp)\n\nReturn the pointer to the first *note PyThreadState: 57a. object in\nthe list of threads associated with the interpreter 'interp'.\n\n-- C Function: *note PyThreadState: 57a. *PyThreadStateNext\n(PyThreadState *tstate)\n\nReturn the next thread state object after 'tstate' from the list of\nall such objects belonging to the same *note PyInterpreterState:\n6d5. object.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Thread Local Storage Support,  Prev: Advanced Debugger Support,  Up: Initialization Finalization and Threads": {
            "content": "",
            "subsections": []
        },
        "The Python interpreter provides low-level support for thread-local": {
            "content": "storage (TLS) which wraps the underlying native TLS implementation to\nsupport the Python-level thread local storage API (*note\nthreading.local: 14bb.).  The CPython C level APIs are similar to those\noffered by pthreads and Windows: use a thread key and functions to\nassociate a void* value per thread.\n",
            "subsections": []
        },
        "The GIL does 'not' need to be held when calling these functions; they": {
            "content": "supply their own locking.\n",
            "subsections": []
        },
        "Note that 'Python.h' does not include the declaration of the TLS APIs,": {
            "content": "you need to include 'pythread.h' to use thread-local storage.\n\nNote: None of these API functions handle memory management on\nbehalf of the void* values.  You need to allocate and deallocate\nthem yourself.  If the void* values happen to be *note PyObject:\n6b1.*, these functions don't do refcount operations on them either.\n\n* Menu:\n\n* Thread Specific Storage (TSS) API: Thread Specific Storage TSS API.\n* Thread Local Storage (TLS) API: Thread Local Storage TLS API.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Thread Specific Storage TSS API,  Next: Thread Local Storage TLS API,  Up: Thread Local Storage Support": {
            "content": "7.9.10.1 Thread Specific Storage (TSS) API\n..........................................\n\nTSS API is introduced to supersede the use of the existing TLS API\nwithin the CPython interpreter.  This API uses a new type *note\nPytsst: 915. instead of int to represent thread keys.\n\nNew in version 3.7.\n\nSee also\n........\n\n\"A New C-API for Thread-Local Storage in CPython\" ( PEP 539(1))\n\n-- C Type: type Pytsst\n\nThis data structure represents the state of a thread key, the\ndefinition of which may depend on the underlying TLS\nimplementation, and it has an internal field representing the key's\ninitialization state.  There are no public members in this\nstructure.\n\nWhen *note PyLIMITEDAPI: 2ac. is not defined, static allocation\nof this type by *note PytssNEEDSINIT: 4b5c. is allowed.\n\n-- C Macro: PytssNEEDSINIT\n\nThis macro expands to the initializer for *note Pytsst: 915.\nvariables.  Note that this macro won't be defined with *note\nPyLIMITEDAPI: 2ac.\n\n* Menu:\n\n* Dynamic Allocation::\n* Methods: Methods<4>.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0539/\n\nFile: python3.12.info,  Node: Dynamic Allocation,  Next: Methods<4>,  Up: Thread Specific Storage TSS API\n\n7.9.10.2 Dynamic Allocation\n...........................\n\nDynamic allocation of the *note Pytsst: 915, required in extension\nmodules built with *note PyLIMITEDAPI: 2ac, where static allocation of\nthis type is not possible due to its implementation being opaque at\nbuild time.\n\n-- C Function: *note Pytsst: 915. *PyThreadtssalloc ()\n' Part of the *note Stable ABI: 2ac. since version 3.7.'  Return a\nvalue which is the same state as a value initialized with *note\nPytssNEEDSINIT: 4b5c, or 'NULL' in the case of dynamic\nallocation failure.\n\n-- C Function: void PyThreadtssfree (Pytsst *key)\n' Part of the *note Stable ABI: 2ac. since version 3.7.'  Free the\ngiven 'key' allocated by *note PyThreadtssalloc(): 344, after\nfirst calling *note PyThreadtssdelete(): 34c. to ensure any\nassociated thread locals have been unassigned.  This is a no-op if\nthe 'key' argument is 'NULL'.\n\nNote: A freed key becomes a dangling pointer.  You should\nreset the key to 'NULL'.\n\nFile: python3.12.info,  Node: Methods<4>,  Prev: Dynamic Allocation,  Up: Thread Specific Storage TSS API\n\n7.9.10.3 Methods\n................\n",
            "subsections": []
        },
        "The parameter 'key' of these functions must not be 'NULL'.  Moreover,": {
            "content": "the behaviors of *note PyThreadtssset(): 348. and *note\nPyThreadtssget(): 34a. are undefined if the given *note Pytsst: 915.\nhas not been initialized by *note PyThreadtsscreate(): 4855.\n\n-- C Function: int PyThreadtssiscreated (Pytsst *key)\n' Part of the *note Stable ABI: 2ac. since version 3.7.'  Return a\nnon-zero value if the given *note Pytsst: 915. has been\ninitialized by *note PyThreadtsscreate(): 4855.\n\n-- C Function: int PyThreadtsscreate (Pytsst *key)\n' Part of the *note Stable ABI: 2ac. since version 3.7.'  Return a\nzero value on successful initialization of a TSS key.  The behavior\nis undefined if the value pointed to by the 'key' argument is not\ninitialized by *note PytssNEEDSINIT: 4b5c.  This function can be\ncalled repeatedly on the same key - calling it on an already\ninitialized key is a no-op and immediately returns success.\n\n-- C Function: void PyThreadtssdelete (Pytsst *key)\n' Part of the *note Stable ABI: 2ac. since version 3.7.'  Destroy a\nTSS key to forget the values associated with the key across all\nthreads, and change the key's initialization state to\nuninitialized.  A destroyed key is able to be initialized again by\n*note PyThreadtsscreate(): 4855.  This function can be called\nrepeatedly on the same key - calling it on an already destroyed key\nis a no-op.\n\n-- C Function: int PyThreadtssset (Pytsst *key, void *value)\n' Part of the *note Stable ABI: 2ac. since version 3.7.'  Return a\nzero value to indicate successfully associating a void* value with\na TSS key in the current thread.  Each thread has a distinct\nmapping of the key to a void* value.\n\n-- C Function: void *PyThreadtssget (Pytsst *key)\n' Part of the *note Stable ABI: 2ac. since version 3.7.'  Return\nthe void* value associated with a TSS key in the current thread.\nThis returns 'NULL' if no value is associated with the key in the\ncurrent thread.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Thread Local Storage TLS API,  Prev: Thread Specific Storage TSS API,  Up: Thread Local Storage Support": {
            "content": "7.9.10.4 Thread Local Storage (TLS) API\n.......................................\n\nDeprecated since version 3.7: This API is superseded by *note Thread\nSpecific Storage (TSS) API: 914.\n\nNote: This version of the API does not support platforms where the\nnative TLS key is defined in a way that cannot be safely cast to\n'int'.  On such platforms, *note PyThreadcreatekey(): 343. will\nreturn immediately with a failure status, and the other TLS\nfunctions will all be no-ops on such platforms.\n",
            "subsections": []
        },
        "Due to the compatibility problem noted above, this version of the API": {
            "content": "should not be used in new code.\n\n-- C Function: int PyThreadcreatekey ()\n' Part of the *note Stable ABI: 2ac.'\n\n-- C Function: void PyThreaddeletekey (int key)\n' Part of the *note Stable ABI: 2ac.'\n\n-- C Function: int PyThreadsetkeyvalue (int key, void *value)\n' Part of the *note Stable ABI: 2ac.'\n\n-- C Function: void *PyThreadgetkeyvalue (int key)\n' Part of the *note Stable ABI: 2ac.'\n\n-- C Function: void PyThreaddeletekeyvalue (int key)\n' Part of the *note Stable ABI: 2ac.'\n\n-- C Function: void PyThreadReInitTLS ()\n' Part of the *note Stable ABI: 2ac.'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python Initialization Configuration,  Next: Memory Management,  Prev: Initialization Finalization and Threads,  Up: Python/C API Reference Manual": {
            "content": "",
            "subsections": [
                {
                    "name": "7.10 Python Initialization Configuration",
                    "content": "New in version 3.8.\n\nPython can be initialized with *note PyInitializeFromConfig(): 317. and\nthe *note PyConfig: 318. structure.  It can be preinitialized with *note\nPyPreInitialize(): 316. and the *note PyPreConfig: 7d0. structure.\n\nThere are two kinds of configuration:\n\n* The *note Python Configuration: 4b62. can be used to build a\ncustomized Python which behaves as the regular Python.  For\nexample, environment variables and command line arguments are used\nto configure Python.\n\n* The *note Isolated Configuration: 4b63. can be used to embed Python\ninto an application.  It isolates Python from the system.  For\nexample, environment variables are ignored, the LCCTYPE locale is\nleft unchanged and no signal handler is registered.\n\nThe *note PyRunMain(): 7e9. function can be used to write a customized\nPython program.\n\nSee also *note Initialization, Finalization, and Threads: 4b28.\n\nSee also\n........\n\nPEP 587(1) \"Python Initialization Configuration\".\n\n* Menu:\n\n* Example: Example<17>.\n* PyWideStringList::\n* PyStatus::\n* PyPreConfig::\n* Preinitialize Python with PyPreConfig::\n* PyConfig::\n* Initialization with PyConfig::\n* Isolated Configuration::\n* Python Configuration::\n* Python Path Configuration::\n* PyRunMain(): PyRunMain.\n* PyGetArgcArgv(): PyGetArgcArgv.\n* Multi-Phase Initialization Private Provisional API::\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0587/\n\nFile: python3.12.info,  Node: Example<17>,  Next: PyWideStringList,  Up: Python Initialization Configuration\n\n\nExample of customized Python always running in isolated mode:\n\nint main(int argc, char argv)\n{\nPyStatus status;\n\nPyConfig config;\nPyConfigInitPythonConfig(&config);\nconfig.isolated = 1;\n\n/* Decode command line arguments.\nImplicitly preinitialize Python (in isolated mode). */\nstatus = PyConfigSetBytesArgv(&config, argc, argv);\nif (PyStatusException(status)) {\ngoto exception;\n}\n\nstatus = PyInitializeFromConfig(&config);\nif (PyStatusException(status)) {\ngoto exception;\n}\nPyConfigClear(&config);\n\nreturn PyRunMain();\n\nexception:\nPyConfigClear(&config);\nif (PyStatusIsExit(status)) {\nreturn status.exitcode;\n}\n/* Display the error message and exit the process with\nnon-zero exit code */\nPyExitStatusException(status);\n}\n\nFile: python3.12.info,  Node: PyWideStringList,  Next: PyStatus,  Prev: Example<17>,  Up: Python Initialization Configuration\n\n\n-- C Type: type PyWideStringList\n\nList of 'wchart*' strings.\n\nIf 'length' is non-zero, 'items' must be non-'NULL' and all strings\nmust be non-'NULL'.\n\nMethods:\n\n-- C Function: *note PyStatus: 7d1. PyWideStringListAppend\n(PyWideStringList *list, const wchart *item)\n\nAppend 'item' to 'list'.\n\nPython must be preinitialized to call this function.\n\n-- C Function: *note PyStatus: 7d1. PyWideStringListInsert\n(PyWideStringList *list, Pyssizet index, const wchart\n*item)\n\nInsert 'item' into 'list' at 'index'.\n\nIf 'index' is greater than or equal to 'list' length, append\n'item' to 'list'.\n\n'index' must be greater than or equal to '0'.\n\nPython must be preinitialized to call this function.\n\nStructure fields:\n\n-- C Member: *note Pyssizet: 88d. length\n\nList length.\n\n-- C Member: wchart items\n\nList items.\n"
                }
            ]
        },
        "File: python3.12.info,  Node: PyStatus,  Next: PyPreConfig,  Prev: PyWideStringList,  Up: Python Initialization Configuration": {
            "content": "-- C Type: type PyStatus\n\nStructure to store an initialization function status: success,\nerror or exit.\n\nFor an error, it can store the C function name which created the\nerror.\n\nStructure fields:\n\n-- C Member: int exitcode\n\nExit code.  Argument passed to 'exit()'.\n\n-- C Member: const char *errmsg\n\nError message.\n\n-- C Member: const char *func\n\nName of the function which created an error, can be 'NULL'.\n\nFunctions to create a status:\n\n-- C Function: *note PyStatus: 7d1. PyStatusOk (void)\n\nSuccess.\n\n-- C Function: *note PyStatus: 7d1. PyStatusError (const char\n*errmsg)\n\nInitialization error with a message.\n\n'errmsg' must not be 'NULL'.\n\n-- C Function: *note PyStatus: 7d1. PyStatusNoMemory (void)\n\nMemory allocation failure (out of memory).\n\n-- C Function: *note PyStatus: 7d1. PyStatusExit (int exitcode)\n\nExit Python with the specified exit code.\n\nFunctions to handle a status:\n\n-- C Function: int PyStatusException (PyStatus status)\n\nIs the status an error or an exit?  If true, the exception\nmust be handled; by calling *note PyExitStatusException():\n7e6. for example.\n\n-- C Function: int PyStatusIsError (PyStatus status)\n\nIs the result an error?\n\n-- C Function: int PyStatusIsExit (PyStatus status)\n\nIs the result an exit?\n\n-- C Function: void PyExitStatusException (PyStatus status)\n\nCall 'exit(exitcode)' if 'status' is an exit.  Print the error\nmessage and exit with a non-zero exit code if 'status' is an\nerror.  Must only be called if 'PyStatusException(status)' is\nnon-zero.\n\nNote: Internally, Python uses macros which set 'PyStatus.func',\nwhereas functions to create a status set 'func' to 'NULL'.\n\nExample:\n\nPyStatus alloc(void ptr, sizet size)\n{\n*ptr = PyMemRawMalloc(size);\nif (*ptr == NULL) {\nreturn PyStatusNoMemory();\n}\nreturn PyStatusOk();\n}\n\nint main(int argc, char argv)\n{\nvoid *ptr;\nPyStatus status = alloc(&ptr, 16);\nif (PyStatusException(status)) {\nPyExitStatusException(status);\n}\nPyMemFree(ptr);\nreturn 0;\n}\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: PyPreConfig,  Next: Preinitialize Python with PyPreConfig,  Prev: PyStatus,  Up: Python Initialization Configuration": {
            "content": "-- C Type: type PyPreConfig\n\nStructure used to preinitialize Python.\n\nFunction to initialize a preconfiguration:\n\n-- C Function: void PyPreConfigInitPythonConfig (PyPreConfig\n*preconfig)\n\nInitialize the preconfiguration with *note Python\nConfiguration: 4b62.\n\n-- C Function: void PyPreConfigInitIsolatedConfig (PyPreConfig\n*preconfig)\n\nInitialize the preconfiguration with *note Isolated\nConfiguration: 4b63.\n\nStructure fields:\n\n-- C Member: int allocator\n\nName of the Python memory allocators:\n\n* 'PYMEMALLOCATORNOTSET' ('0'): don't change memory\nallocators (use defaults).\n\n* 'PYMEMALLOCATORDEFAULT' ('1'): *note default memory\nallocators: 1ad0.\n\n* 'PYMEMALLOCATORDEBUG' ('2'): *note default memory\nallocators: 1ad0. with *note debug hooks: 1ad2.\n\n* 'PYMEMALLOCATORMALLOC' ('3'): use 'malloc()' of the C\nlibrary.\n\n* 'PYMEMALLOCATORMALLOCDEBUG' ('4'): force usage of\n'malloc()' with *note debug hooks: 1ad2.\n\n* 'PYMEMALLOCATORPYMALLOC' ('5'): *note Python pymalloc\nmemory allocator: b61.\n\n* 'PYMEMALLOCATORPYMALLOCDEBUG' ('6'): *note Python\npymalloc memory allocator: b61. with *note debug hooks:\n1ad2.\n\n'PYMEMALLOCATORPYMALLOC' and\n'PYMEMALLOCATORPYMALLOCDEBUG' are not supported if Python\nis *note configured using -without-pymalloc: 1b00.\n\nSee *note Memory Management: 4b6e.\n\nDefault: 'PYMEMALLOCATORNOTSET'.\n\n-- C Member: int configurelocale\n\nSet the LCCTYPE locale to the user preferred locale.\n\nIf equals to '0', set *note coerceclocale: 4b70. and *note\ncoerceclocalewarn: 4b71. members to '0'.\n\nSee the *note locale encoding: 27fa.\n\nDefault: '1' in Python config, '0' in isolated config.\n\n-- C Member: int coerceclocale\n\nIf equals to '2', coerce the C locale.\n\nIf equals to '1', read the LCCTYPE locale to decide if it\nshould be coerced.\n\nSee the *note locale encoding: 27fa.\n\nDefault: '-1' in Python config, '0' in isolated config.\n\n-- C Member: int coerceclocalewarn\n\nIf non-zero, emit a warning if the C locale is coerced.\n\nDefault: '-1' in Python config, '0' in isolated config.\n\n-- C Member: int devmode\n\n*note Python Development Mode: 6e3.: see *note\nPyConfig.devmode: 4b73.\n\nDefault: '-1' in Python mode, '0' in isolated mode.\n\n-- C Member: int isolated\n\nIsolated mode: see *note PyConfig.isolated: 30e.\n\nDefault: '0' in Python mode, '1' in isolated mode.\n\n-- C Member: int legacywindowsfsencoding\n\nIf non-zero:\n\n* Set *note PyPreConfig.utf8mode: 315. to '0',\n\n* Set *note PyConfig.filesystemencoding: 313. to '\"mbcs\"',\n\n* Set *note PyConfig.filesystemerrors: 314. to\n'\"replace\"'.\n\nInitialized the from *note PYTHONLEGACYWINDOWSFSENCODING: aa3.\nenvironment variable value.\n\nOnly available on Windows.  '#ifdef MSWINDOWS' macro can be\nused for Windows specific code.\n\nDefault: '0'.\n\n-- C Member: int parseargv\n\nIf non-zero, *note PyPreInitializeFromArgs(): 7e7. and *note\nPyPreInitializeFromBytesArgs(): 7e8. parse their 'argv'\nargument the same way the regular Python parses command line\narguments: see *note Command Line Arguments: e7b.\n\nDefault: '1' in Python config, '0' in isolated config.\n\n-- C Member: int useenvironment\n\nUse *note environment variables: 3b8.?  See *note\nPyConfig.useenvironment: 303.\n\nDefault: '1' in Python config and '0' in isolated config.\n\n-- C Member: int utf8mode\n\nIf non-zero, enable the *note Python UTF-8 Mode: 420.\n\nSet to '0' or '1' by the *note -X utf8: 188. command line\noption and the *note PYTHONUTF8: 90e. environment variable.\n\nAlso set to '1' if the 'LCCTYPE' locale is 'C' or 'POSIX'.\n\nDefault: '-1' in Python config and '0' in isolated config.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Preinitialize Python with PyPreConfig,  Next: PyConfig,  Prev: PyPreConfig,  Up: Python Initialization Configuration": {
            "content": "The preinitialization of Python:\n\n* Set the Python memory allocators (*note PyPreConfig.allocator:\n4b6d.)\n\n* Configure the LCCTYPE locale (*note locale encoding: 27fa.)\n\n* Set the *note Python UTF-8 Mode: 420. (*note PyPreConfig.utf8mode:\n315.)\n",
            "subsections": []
        },
        "The current preconfiguration ('PyPreConfig' type) is stored in": {
            "content": "'PyRuntime.preconfig'.\n\nFunctions to preinitialize Python:\n\n-- C Function: *note PyStatus: 7d1. PyPreInitialize (const PyPreConfig\n*preconfig)\n\nPreinitialize Python from 'preconfig' preconfiguration.\n\n'preconfig' must not be 'NULL'.\n\n-- C Function: *note PyStatus: 7d1. PyPreInitializeFromBytesArgs\n(const PyPreConfig *preconfig, int argc, char *const *argv)\n\nPreinitialize Python from 'preconfig' preconfiguration.\n\nParse 'argv' command line arguments (bytes strings) if *note\nparseargv: 4b75. of 'preconfig' is non-zero.\n\n'preconfig' must not be 'NULL'.\n\n-- C Function: *note PyStatus: 7d1. PyPreInitializeFromArgs (const\nPyPreConfig *preconfig, int argc, wchart *const *argv)\n\nPreinitialize Python from 'preconfig' preconfiguration.\n\nParse 'argv' command line arguments (wide strings) if *note\nparseargv: 4b75. of 'preconfig' is non-zero.\n\n'preconfig' must not be 'NULL'.\n",
            "subsections": []
        },
        "The caller is responsible to handle exceptions (error or exit) using": {
            "content": "*note PyStatusException(): 7dd. and *note PyExitStatusException():\n7e6.\n\nIf *note PyImportFrozenModules(): 2cff, *note PyImportAppendInittab():\n14f8. or *note PyImportExtendInittab(): 14f9. are used, they must be\nset or called after Python preinitialization and before the Python\ninitialization.  If Python is initialized multiple times, *note\nPyImportAppendInittab(): 14f8. or *note PyImportExtendInittab(): 14f9.\nmust be called before each Python initialization.\n",
            "subsections": []
        },
        "PyPreConfigInitPythonConfig(): 7db.), if Python is initialized with": {
            "content": "command line arguments, the command line arguments must also be passed\nto preinitialize Python, since they have an effect on the\npre-configuration like encodings.  For example, the *note -X utf8: 188.\ncommand line option enables the *note Python UTF-8 Mode: 420.\n\n'PyMemSetAllocator()' can be called after *note PyPreInitialize():\n316. and before *note PyInitializeFromConfig(): 317. to install a\ncustom memory allocator.  It can be called before *note\nPyPreInitialize(): 316. if *note PyPreConfig.allocator: 4b6d. is set to\n'PYMEMALLOCATORNOTSET'.\n\nPython memory allocation functions like *note PyMemRawMalloc(): ea9.\nmust not be used before the Python preinitialization, whereas calling\ndirectly 'malloc()' and 'free()' is always safe.  *note",
            "subsections": []
        },
        "PyDecodeLocale(): a0b. must not be called before the Python": {
            "content": "preinitialization.\n\nExample using the preinitialization to enable the *note Python UTF-8\nMode: 420.:\n\nPyStatus status;\nPyPreConfig preconfig;\nPyPreConfigInitPythonConfig(&preconfig);\n\npreconfig.utf8mode = 1;\n\nstatus = PyPreInitialize(&preconfig);\nif (PyStatusException(status)) {\nPyExitStatusException(status);\n}\n\n/* at this point, Python speaks UTF-8 */\n\nPyInitialize();\n/* ... use Python API here ... */\nPyFinalize();\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: PyConfig,  Next: Initialization with PyConfig,  Prev: Preinitialize Python with PyPreConfig,  Up: Python Initialization Configuration": {
            "content": "-- C Type: type PyConfig\n\nStructure containing most parameters to configure Python.\n\nWhen done, the *note PyConfigClear(): 7d3. function must be used\nto release the configuration memory.\n\nStructure methods:\n\n-- C Function: void PyConfigInitPythonConfig (PyConfig *config)\n\nInitialize configuration with the *note Python Configuration:\n4b62.\n\n-- C Function: void PyConfigInitIsolatedConfig (PyConfig *config)\n\nInitialize configuration with the *note Isolated\nConfiguration: 4b63.\n\n-- C Function: *note PyStatus: 7d1. PyConfigSetString (PyConfig\n*config, wchart *const *configstr, const wchart *str)\n\nCopy the wide character string 'str' into '*configstr'.\n\n*note Preinitialize Python: 3980. if needed.\n\n-- C Function: *note PyStatus: 7d1. PyConfigSetBytesString\n(PyConfig *config, wchart *const *configstr, const char\n*str)\n\nDecode 'str' using *note PyDecodeLocale(): a0b. and set the\nresult into '*configstr'.\n\n*note Preinitialize Python: 3980. if needed.\n\n-- C Function: *note PyStatus: 7d1. PyConfigSetArgv (PyConfig\n*config, int argc, wchart *const *argv)\n\nSet command line arguments (*note argv: 168d. member of\n'config') from the 'argv' list of wide character strings.\n\n*note Preinitialize Python: 3980. if needed.\n\n-- C Function: *note PyStatus: 7d1. PyConfigSetBytesArgv\n(PyConfig *config, int argc, char *const *argv)\n\nSet command line arguments (*note argv: 168d. member of\n'config') from the 'argv' list of bytes strings.  Decode bytes\nusing *note PyDecodeLocale(): a0b.\n\n*note Preinitialize Python: 3980. if needed.\n\n-- C Function: *note PyStatus: 7d1. PyConfigSetWideStringList\n(PyConfig *config, PyWideStringList *list, Pyssizet\nlength, wchart items)\n\nSet the list of wide strings 'list' to 'length' and 'items'.\n\n*note Preinitialize Python: 3980. if needed.\n\n-- C Function: *note PyStatus: 7d1. PyConfigRead (PyConfig\n*config)\n\nRead all Python configuration.\n\nFields which are already initialized are left unchanged.\n\nFields for *note path configuration: 6c3. are no longer\ncalculated or modified when calling this function, as of\nPython 3.11.\n\nThe *note PyConfigRead(): 57e. function only parses *note\nPyConfig.argv: 168d. arguments once: *note\nPyConfig.parseargv: 168e. is set to '2' after arguments are\nparsed.  Since Python arguments are strippped from *note\nPyConfig.argv: 168d, parsing arguments twice would parse the\napplication options as Python options.\n\n*note Preinitialize Python: 3980. if needed.\n\nChanged in version 3.10: The *note PyConfig.argv: 168d.\narguments are now only parsed once, *note PyConfig.parseargv:\n168e. is set to '2' after arguments are parsed, and arguments\nare only parsed if *note PyConfig.parseargv: 168e. equals\n'1'.\n\nChanged in version 3.11: *note PyConfigRead(): 57e. no longer\ncalculates all paths, and so fields listed under *note Python\nPath Configuration: 6c3. may no longer be updated until *note\nPyInitializeFromConfig(): 317. is called.\n\n-- C Function: void PyConfigClear (PyConfig *config)\n\nRelease configuration memory.\n\nMost 'PyConfig' methods *note preinitialize Python: 3980. if\nneeded.  In that case, the Python preinitialization configuration\n(*note PyPreConfig: 7d0.) in based on the *note PyConfig: 318.  If\nconfiguration fields which are in common with *note PyPreConfig:\n7d0. are tuned, they must be set before calling a *note PyConfig:\n318. method:\n\n* *note PyConfig.devmode: 4b73.\n\n* *note PyConfig.isolated: 30e.\n\n* *note PyConfig.parseargv: 168e.\n\n* *note PyConfig.useenvironment: 303.\n\nMoreover, if *note PyConfigSetArgv(): 7d6. or *note\nPyConfigSetBytesArgv(): 7d7. is used, this method must be called\nbefore other methods, since the preinitialization configuration\ndepends on command line arguments (if *note parseargv: 168e. is\nnon-zero).\n\nThe caller of these methods is responsible to handle exceptions\n(error or exit) using 'PyStatusException()' and\n'PyExitStatusException()'.\n\nStructure fields:\n\n-- C Member: *note PyWideStringList: 7d2. argv\n\nCommand line arguments: *note sys.argv: 10dd.\n\nSet *note parseargv: 168e. to '1' to parse *note argv: 168d.\nthe same way the regular Python parses Python command line\narguments and then to strip Python arguments from *note argv:\n168d.\n\nIf *note argv: 168d. is empty, an empty string is added to\nensure that *note sys.argv: 10dd. always exists and is never\nempty.\n\nDefault: 'NULL'.\n\nSee also the *note origargv: 6a2. member.\n\n-- C Member: int safepath\n\nIf equals to zero, 'PyRunMain()' prepends a potentially\nunsafe path to *note sys.path: 32c. at startup:\n\n* If *note argv[0]: 168d. is equal to 'L\"-m\"' ('python -m\nmodule'), prepend the current working directory.\n\n* If running a script ('python script.py'), prepend the\nscript's directory.  If it's a symbolic link, resolve\nsymbolic links.\n\n* Otherwise ('python -c code' and 'python'), prepend an\nempty string, which means the current working directory.\n\nSet to '1' by the *note -P: 362. command line option and the\n*note PYTHONSAFEPATH: 363. environment variable.\n\nDefault: '0' in Python config, '1' in isolated config.\n\nNew in version 3.11.\n\n-- C Member: wchart *baseexecprefix\n\n*note sys.baseexecprefix: 3fbe.\n\nDefault: 'NULL'.\n\nPart of the *note Python Path Configuration: 6c3. output.\n\n-- C Member: wchart *baseexecutable\n\nPython base executable: 'sys.baseexecutable'.\n\nSet by the 'PYVENVLAUNCHER' environment variable.\n\nSet from *note PyConfig.executable: 4b7b. if 'NULL'.\n\nDefault: 'NULL'.\n\nPart of the *note Python Path Configuration: 6c3. output.\n\n-- C Member: wchart *baseprefix\n\n*note sys.baseprefix: 391e.\n\nDefault: 'NULL'.\n\nPart of the *note Python Path Configuration: 6c3. output.\n\n-- C Member: int bufferedstdio\n\nIf equals to '0' and *note configurecstdio: 4b7d. is\nnon-zero, disable buffering on the C streams stdout and\nstderr.\n\nSet to '0' by the *note -u: 1712. command line option and the\n*note PYTHONUNBUFFERED: 1713. environment variable.\n\nstdin is always opened in buffered mode.\n\nDefault: '1'.\n\n-- C Member: int byteswarning\n\nIf equals to '1', issue a warning when comparing *note bytes:\n295. or *note bytearray: 294. with *note str: 157, or\ncomparing *note bytes: 295. with *note int: 17e.\n\nIf equal or greater to '2', raise a *note BytesWarning: a6b.\nexception in these cases.\n\nIncremented by the *note -b: 3a8. command line option.\n\nDefault: '0'.\n\n-- C Member: int warndefaultencoding\n\nIf non-zero, emit a *note EncodingWarning: 1ac0. warning when\n*note io.TextIOWrapper: b8f. uses its default encoding.  See\n*note Opt-in EncodingWarning: 1ad4. for details.\n\nDefault: '0'.\n\nNew in version 3.10.\n\n-- C Member: int codedebugranges\n\nIf equals to '0', disables the inclusion of the end line and\ncolumn mappings in code objects.  Also disables traceback\nprinting carets to specific error locations.\n\nSet to '0' by the *note PYTHONNODEBUGRANGES: 375. environment\nvariable and by the *note -X nodebugranges: 188. command\nline option.\n\nDefault: '1'.\n\nNew in version 3.11.\n\n-- C Member: wchart *checkhashpycsmode\n\nControl the validation behavior of hash-based '.pyc' files:\nvalue of the *note -check-hash-based-pycs: 1ab3. command line\noption.\n\nValid values:\n\n- 'L\"always\"': Hash the source file for invalidation\nregardless of value of the 'checksource' flag.\n\n- 'L\"never\"': Assume that hash-based pycs always are valid.\n\n- 'L\"default\"': The 'checksource' flag in hash-based pycs\ndetermines invalidation.\n\nDefault: 'L\"default\"'.\n\nSee also PEP 552(1) \"Deterministic pycs\".\n\n-- C Member: int configurecstdio\n\nIf non-zero, configure C standard streams:\n\n* On Windows, set the binary mode ('OBINARY') on stdin,\nstdout and stderr.\n\n* If *note bufferedstdio: 309. equals zero, disable\nbuffering of stdin, stdout and stderr streams.\n\n* If *note interactive: 2f7. is non-zero, enable stream\nbuffering on stdin and stdout (only stdout on Windows).\n\nDefault: '1' in Python config, '0' in isolated config.\n\n-- C Member: int devmode\n\nIf non-zero, enable the *note Python Development Mode: 6e3.\n\nSet to '1' by the *note -X dev: 188. option and the *note\nPYTHONDEVMODE: 924. environment variable.\n\nDefault: '-1' in Python mode, '0' in isolated mode.\n\n-- C Member: int dumprefs\n\nDump Python references?\n\nIf non-zero, dump all objects which are still alive at exit.\n\nSet to '1' by the *note PYTHONDUMPREFS: 7ca. environment\nvariable.\n\nNeed a special build of Python with the 'PyTRACEREFS' macro\ndefined: see the *note configure -with-trace-refs option: 6b2.\n\nDefault: '0'.\n\n-- C Member: wchart *execprefix\n\nThe site-specific directory prefix where the\nplatform-dependent Python files are installed: *note\nsys.execprefix: 32a.\n\nDefault: 'NULL'.\n\nPart of the *note Python Path Configuration: 6c3. output.\n\n-- C Member: wchart *executable\n\nThe absolute path of the executable binary for the Python\ninterpreter: *note sys.executable: 330.\n\nDefault: 'NULL'.\n\nPart of the *note Python Path Configuration: 6c3. output.\n\n-- C Member: int faulthandler\n\nEnable faulthandler?\n\nIf non-zero, call *note faulthandler.enable(): aed. at\nstartup.\n\nSet to '1' by *note -X faulthandler: 188. and the *note\nPYTHONFAULTHANDLER: ef7. environment variable.\n\nDefault: '-1' in Python mode, '0' in isolated mode.\n\n-- C Member: wchart *filesystemencoding\n\n*note Filesystem encoding: 291.: *note\nsys.getfilesystemencoding(): aa2.\n\nOn macOS, Android and VxWorks: use '\"utf-8\"' by default.\n\nOn Windows: use '\"utf-8\"' by default, or '\"mbcs\"' if *note\nlegacywindowsfsencoding: 310. of *note PyPreConfig: 7d0. is\nnon-zero.\n\nDefault encoding on other platforms:\n\n* '\"utf-8\"' if *note PyPreConfig.utf8mode: 315. is\nnon-zero.\n\n* '\"ascii\"' if Python detects that 'nllanginfo(CODESET)'\nannounces the ASCII encoding, whereas the 'mbstowcs()'\nfunction decodes from a different encoding (usually\nLatin1).\n\n* '\"utf-8\"' if 'nllanginfo(CODESET)' returns an empty\nstring.\n\n* Otherwise, use the *note locale encoding: 27fa.:\n'nllanginfo(CODESET)' result.\n\nAt Python startup, the encoding name is normalized to the\nPython codec name.  For example, '\"ANSIX3.4-1968\"' is\nreplaced with '\"ascii\"'.\n\nSee also the *note filesystemerrors: 314. member.\n\n-- C Member: wchart *filesystemerrors\n\n*note Filesystem error handler: 291.: *note\nsys.getfilesystemencodeerrors(): b35.\n\nOn Windows: use '\"surrogatepass\"' by default, or '\"replace\"'\nif *note legacywindowsfsencoding: 310. of *note\nPyPreConfig: 7d0. is non-zero.\n\nOn other platforms: use '\"surrogateescape\"' by default.\n\nSupported error handlers:\n\n* '\"strict\"'\n\n* '\"surrogateescape\"'\n\n* '\"surrogatepass\"' (only supported with the UTF-8\nencoding)\n\nSee also the *note filesystemencoding: 313. member.\n\n-- C Member: unsigned long hashseed\n\n-- C Member: int usehashseed\n\nRandomized hash function seed.\n\nIf *note usehashseed: 30b. is zero, a seed is chosen\nrandomly at Python startup, and *note hashseed: 30c. is\nignored.\n\nSet by the *note PYTHONHASHSEED: ef4. environment variable.\n\nDefault 'usehashseed' value: '-1' in Python mode, '0' in\nisolated mode.\n\n-- C Member: wchart *home\n\nPython home directory.\n\nIf *note PySetPythonHome(): 1820. has been called, use its\nargument if it is not 'NULL'.\n\nSet by the *note PYTHONHOME: 334. environment variable.\n\nDefault: 'NULL'.\n\nPart of the *note Python Path Configuration: 6c3. input.\n\n-- C Member: int importtime\n\nIf non-zero, profile import time.\n\nSet the '1' by the *note -X importtime: 188. option and the\n*note PYTHONPROFILEIMPORTTIME: 92c. environment variable.\n\nDefault: '0'.\n\n-- C Member: int inspect\n\nEnter interactive mode after executing a script or a command.\n\nIf greater than '0', enable inspect: when a script is passed\nas first argument or the -c option is used, enter interactive\nmode after executing the script or the command, even when\n*note sys.stdin: 293. does not appear to be a terminal.\n\nIncremented by the *note -i: 1336. command line option.  Set\nto '1' if the *note PYTHONINSPECT: 1335. environment variable\nis non-empty.\n\nDefault: '0'.\n\n-- C Member: int installsignalhandlers\n\nInstall Python signal handlers?\n\nDefault: '1' in Python mode, '0' in isolated mode.\n\n-- C Member: int interactive\n\nIf greater than '0', enable the interactive mode (REPL).\n\nIncremented by the *note -i: 1336. command line option.\n\nDefault: '0'.\n\n-- C Member: int intmaxstrdigits\n\nConfigures the *note integer string conversion length\nlimitation: 3bc.  An initial value of '-1' means the value\nwill be taken from the command line or environment or\notherwise default to 4300 (*note\nsys.intinfo.defaultmaxstrdigits: 1f8a.).  A value of '0'\ndisables the limitation.  Values greater than zero but less\nthan 640 (*note sys.intinfo.strdigitscheckthreshold:\n4020.) are unsupported and will produce an error.\n\nConfigured by the *note -X intmaxstrdigits: 188. command\nline flag or the *note PYTHONINTMAXSTRDIGITS: 1514.\nenvironment variable.\n\nDefault: '-1' in Python mode.  4300 (*note\nsys.intinfo.defaultmaxstrdigits: 1f8a.) in isolated mode.\n\nNew in version 3.12.\n\n-- C Member: int isolated\n\nIf greater than '0', enable isolated mode:\n\n* Set *note safepath: 55e. to '1': don't prepend a\npotentially unsafe path to *note sys.path: 32c. at Python\nstartup, such as the current directory, the script's\ndirectory or an empty string.\n\n* Set *note useenvironment: 303. to '0': ignore 'PYTHON'\nenvironment variables.\n\n* Set *note usersitedirectory: 307. to '0': don't add the\nuser site directory to *note sys.path: 32c.\n\n* Python REPL doesn't import *note readline: b5. nor enable\ndefault readline configuration on interactive prompts.\n\nSet to '1' by the *note -I: 77f. command line option.\n\nDefault: '0' in Python mode, '1' in isolated mode.\n\nSee also the *note Isolated Configuration: 4b63. and *note\nPyPreConfig.isolated: 4b74.\n\n-- C Member: int legacywindowsstdio\n\nIf non-zero, use *note io.FileIO: 1186. instead of\n'io.WindowsConsoleIO' for *note sys.stdin: 293, *note\nsys.stdout: 90c. and *note sys.stderr: 757.\n\nSet to '1' if the *note PYTHONLEGACYWINDOWSSTDIO: aa6.\nenvironment variable is set to a non-empty string.\n\nOnly available on Windows.  '#ifdef MSWINDOWS' macro can be\nused for Windows specific code.\n\nDefault: '0'.\n\nSee also the PEP 528(2) (Change Windows console encoding to\nUTF-8).\n\n-- C Member: int mallocstats\n\nIf non-zero, dump statistics on *note Python pymalloc memory\nallocator: b61. at exit.\n\nSet to '1' by the *note PYTHONMALLOCSTATS: 18d9. environment\nvariable.\n\nThe option is ignored if Python is *note configured using the\n-without-pymalloc option: 1b00.\n\nDefault: '0'.\n\n-- C Member: wchart *platlibdir\n\nPlatform library directory name: *note sys.platlibdir: 756.\n\nSet by the *note PYTHONPLATLIBDIR: 16a6. environment variable.\n\nDefault: value of the 'PLATLIBDIR' macro which is set by the\n*note configure -with-platlibdir option: 1af6. (default:\n'\"lib\"', or '\"DLLs\"' on Windows).\n\nPart of the *note Python Path Configuration: 6c3. input.\n\nNew in version 3.9.\n\nChanged in version 3.11: This macro is now used on Windows to\nlocate the standard library extension modules, typically under\n'DLLs'.  However, for compatibility, note that this value is\nignored for any non-standard layouts, including in-tree builds\nand virtual environments.\n\n-- C Member: wchart *pythonpathenv\n\nModule search paths (*note sys.path: 32c.) as a string\nseparated by 'DELIM' (*note os.pathsep: 1ac4.).\n\nSet by the *note PYTHONPATH: e92. environment variable.\n\nDefault: 'NULL'.\n\nPart of the *note Python Path Configuration: 6c3. input.\n\n-- C Member: *note PyWideStringList: 7d2. modulesearchpaths\n\n-- C Member: int modulesearchpathsset\n\nModule search paths: *note sys.path: 32c.\n\nIf *note modulesearchpathsset: 3b5. is equal to '0', *note\nPyInitializeFromConfig(): 317. will replace *note\nmodulesearchpaths: 3b6. and sets *note\nmodulesearchpathsset: 3b5. to '1'.\n\nDefault: empty list ('modulesearchpaths') and '0'\n('modulesearchpathsset').\n\nPart of the *note Python Path Configuration: 6c3. output.\n\n-- C Member: int optimizationlevel\n\nCompilation optimization level:\n\n* '0': Peephole optimizer, set 'debug' to 'True'.\n\n* '1': Level 0, remove assertions, set 'debug' to\n'False'.\n\n* '2': Level 1, strip docstrings.\n\nIncremented by the *note -O: c11. command line option.  Set to\nthe *note PYTHONOPTIMIZE: 1ab6. environment variable value.\n\nDefault: '0'.\n\n-- C Member: *note PyWideStringList: 7d2. origargv\n\nThe list of the original command line arguments passed to the\nPython executable: *note sys.origargv: 636.\n\nIf *note origargv: 6a2. list is empty and *note argv: 168d.\nis not a list only containing an empty string, *note\nPyConfigRead(): 57e. copies *note argv: 168d. into *note\norigargv: 6a2. before modifying *note argv: 168d. (if *note\nparseargv: 168e. is non-zero).\n\nSee also the *note argv: 168d. member and the *note\nPyGetArgcArgv(): 16c0. function.\n\nDefault: empty list.\n\nNew in version 3.10.\n\n-- C Member: int parseargv\n\nParse command line arguments?\n\nIf equals to '1', parse *note argv: 168d. the same way the\nregular Python parses *note command line arguments: e7b, and\nstrip Python arguments from *note argv: 168d.\n\nThe *note PyConfigRead(): 57e. function only parses *note\nPyConfig.argv: 168d. arguments once: *note\nPyConfig.parseargv: 168e. is set to '2' after arguments are\nparsed.  Since Python arguments are strippped from *note\nPyConfig.argv: 168d, parsing arguments twice would parse the\napplication options as Python options.\n\nDefault: '1' in Python mode, '0' in isolated mode.\n\nChanged in version 3.10: The *note PyConfig.argv: 168d.\narguments are now only parsed if *note PyConfig.parseargv:\n168e. equals to '1'.\n\n-- C Member: int parserdebug\n\nParser debug mode.  If greater than '0', turn on parser\ndebugging output (for expert only, depending on compilation\noptions).\n\nIncremented by the *note -d: 1ab4. command line option.  Set\nto the *note PYTHONDEBUG: 1ab5. environment variable value.\n\nNeed a *note debug build of Python: 67f. (the 'PyDEBUG' macro\nmust be defined).\n\nDefault: '0'.\n\n-- C Member: int pathconfigwarnings\n\nIf non-zero, calculation of path configuration is allowed to\nlog warnings into 'stderr'.  If equals to '0', suppress these\nwarnings.\n\nDefault: '1' in Python mode, '0' in isolated mode.\n\nPart of the *note Python Path Configuration: 6c3. input.\n\nChanged in version 3.11: Now also applies on Windows.\n\n-- C Member: wchart *prefix\n\nThe site-specific directory prefix where the platform\nindependent Python files are installed: *note sys.prefix: 32e.\n\nDefault: 'NULL'.\n\nPart of the *note Python Path Configuration: 6c3. output.\n\n-- C Member: wchart *programname\n\nProgram name used to initialize *note executable: 4b7b. and in\nearly error messages during Python initialization.\n\n* If 'PySetProgramName()' has been called, use its\nargument.\n\n* On macOS, use *note PYTHONEXECUTABLE: 1ac8. environment\nvariable if set.\n\n* If the 'WITHNEXTFRAMEWORK' macro is defined, use\n'PYVENVLAUNCHER' environment variable if set.\n\n* Use 'argv[0]' of *note argv: 168d. if available and\nnon-empty.\n\n* Otherwise, use 'L\"python\"' on Windows, or 'L\"python3\"' on\nother platforms.\n\nDefault: 'NULL'.\n\nPart of the *note Python Path Configuration: 6c3. input.\n\n-- C Member: wchart *pycacheprefix\n\nDirectory where cached '.pyc' files are written: *note\nsys.pycacheprefix: 7c8.\n\nSet by the *note -X pycacheprefix=PATH: 188. command line\noption and the *note PYTHONPYCACHEPREFIX: 7c7. environment\nvariable.\n\nIf 'NULL', *note sys.pycacheprefix: 7c8. is set to 'None'.\n\nDefault: 'NULL'.\n\n-- C Member: int quiet\n\nQuiet mode.  If greater than '0', don't display the copyright\nand version at Python startup in interactive mode.\n\nIncremented by the *note -q: 1ab7. command line option.\n\nDefault: '0'.\n\n-- C Member: wchart *runcommand\n\nValue of the *note -c: 3a4. command line option.\n\nUsed by *note PyRunMain(): 7e9.\n\nDefault: 'NULL'.\n\n-- C Member: wchart *runfilename\n\nFilename passed on the command line: trailing command line\nargument without *note -c: 3a4. or *note -m: 3a5.  It is used\nby the *note PyRunMain(): 7e9. function.\n\nFor example, it is set to 'script.py' by the 'python3\nscript.py arg' command line.\n\nSee also the *note PyConfig.skipsourcefirstline: 4b8c.\noption.\n\nDefault: 'NULL'.\n\n-- C Member: wchart *runmodule\n\nValue of the *note -m: 3a5. command line option.\n\nUsed by *note PyRunMain(): 7e9.\n\nDefault: 'NULL'.\n\n-- C Member: int showrefcount\n\nShow total reference count at exit (excluding immortal\nobjects)?\n\nSet to '1' by *note -X showrefcount: 188. command line option.\n\nNeed a *note debug build of Python: 67f. (the 'PyREFDEBUG'\nmacro must be defined).\n\nDefault: '0'.\n\n-- C Member: int siteimport\n\nImport the *note site: c2. module at startup?\n\nIf equal to zero, disable the import of the module site and\nthe site-dependent manipulations of *note sys.path: 32c. that\nit entails.\n\nAlso disable these manipulations if the *note site: c2. module\nis explicitly imported later (call *note site.main(): 1ab9. if\nyou want them to be triggered).\n\nSet to '0' by the *note -S: 101c. command line option.\n\n*note sys.flags.nosite: 458. is set to the inverted value of\n*note siteimport: 2fd.\n\nDefault: '1'.\n\n-- C Member: int skipsourcefirstline\n\nIf non-zero, skip the first line of the *note\nPyConfig.runfilename: 4b8b. source.\n\nIt allows the usage of non-Unix forms of '#!cmd'.  This is\nintended for a DOS specific hack only.\n\nSet to '1' by the *note -x: 1abd. command line option.\n\nDefault: '0'.\n\n-- C Member: wchart *stdioencoding\n\n-- C Member: wchart *stdioerrors\n\nEncoding and encoding errors of *note sys.stdin: 293, *note\nsys.stdout: 90c. and *note sys.stderr: 757. (but *note\nsys.stderr: 757. always uses '\"backslashreplace\"' error\nhandler).\n\nIf *note PySetStandardStreamEncoding(): e75. has been called,\nuse its 'error' and 'errors' arguments if they are not 'NULL'.\n\nUse the *note PYTHONIOENCODING: e7e. environment variable if\nit is non-empty.\n\nDefault encoding:\n\n* '\"UTF-8\"' if *note PyPreConfig.utf8mode: 315. is\nnon-zero.\n\n* Otherwise, use the *note locale encoding: 27fa.\n\nDefault error handler:\n\n* On Windows: use '\"surrogateescape\"'.\n\n* '\"surrogateescape\"' if *note PyPreConfig.utf8mode: 315.\nis non-zero, or if the LCCTYPE locale is \"C\" or \"POSIX\".\n\n* '\"strict\"' otherwise.\n\n-- C Member: int tracemalloc\n\nEnable tracemalloc?\n\nIf non-zero, call *note tracemalloc.start(): 1abe. at startup.\n\nSet by *note -X tracemalloc=N: 188. command line option and by\nthe *note PYTHONTRACEMALLOC: 1abf. environment variable.\n\nDefault: '-1' in Python mode, '0' in isolated mode.\n\n-- C Member: int perfprofiling\n\nEnable compatibility mode with the perf profiler?\n\nIf non-zero, initialize the perf trampoline.  See *note Python\nsupport for the Linux perf profiler: 151. for more\ninformation.\n\nSet by *note -X perf: 188. command line option and by the\n*note PYTHONPERFSUPPORT: 187. environment variable.\n\nDefault: '-1'.\n\nNew in version 3.12.\n\n-- C Member: int useenvironment\n\nUse *note environment variables: 3b8.?\n\nIf equals to zero, ignore the *note environment variables:\n3b8.\n\nSet to '0' by the *note -E: 77e. environment variable.\n\nDefault: '1' in Python config and '0' in isolated config.\n\n-- C Member: int usersitedirectory\n\nIf non-zero, add the user site directory to *note sys.path:\n32c.\n\nSet to '0' by the *note -s: 1200. and *note -I: 77f. command\nline options.\n\nSet to '0' by the *note PYTHONNOUSERSITE: 1201. environment\nvariable.\n\nDefault: '1' in Python mode, '0' in isolated mode.\n\n-- C Member: int verbose\n\nVerbose mode.  If greater than '0', print a message each time\na module is imported, showing the place (filename or built-in\nmodule) from which it is loaded.\n\nIf greater than or equal to '2', print a message for each file\nthat is checked for when searching for a module.  Also\nprovides information on module cleanup at exit.\n\nIncremented by the *note -v: 127b. command line option.\n\nSet by the *note PYTHONVERBOSE: 1aba. environment variable\nvalue.\n\nDefault: '0'.\n\n-- C Member: *note PyWideStringList: 7d2. warnoptions\n\nOptions of the *note warnings: 10d. module to build warnings\nfilters, lowest to highest priority: *note sys.warnoptions:\n328.\n\nThe *note warnings: 10d. module adds *note sys.warnoptions:\n328. in the reverse order: the last *note\nPyConfig.warnoptions: 4908. item becomes the first item of\n'warnings.filters' which is checked first (highest priority).\n\nThe *note -W: 6df. command line options adds its value to\n*note warnoptions: 4908, it can be used multiple times.\n\nThe *note PYTHONWARNINGS: 9ee. environment variable can also\nbe used to add warning options.  Multiple options can be\nspecified, separated by commas (',').\n\nDefault: empty list.\n\n-- C Member: int writebytecode\n\nIf equal to '0', Python won't try to write '.pyc' files on the\nimport of source modules.\n\nSet to '0' by the *note -B: 1222. command line option and the\n*note PYTHONDONTWRITEBYTECODE: 1223. environment variable.\n\n*note sys.dontwritebytecode: 3fec. is initialized to the\ninverted value of *note writebytecode: 305.\n\nDefault: '1'.\n\n-- C Member: *note PyWideStringList: 7d2. xoptions\n\nValues of the *note -X: 188. command line options: *note\nsys.xoptions: 1ac1.\n\nDefault: empty list.\n\nIf *note parseargv: 168e. is non-zero, *note argv: 168d. arguments are\nparsed the same way the regular Python parses *note command line\narguments: e7b, and Python arguments are stripped from *note argv: 168d.\n\nThe *note xoptions: 4909. options are parsed to set other options: see\nthe *note -X: 188. command line option.\n\nChanged in version 3.9: The 'showalloccount' field has been removed.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0552/\n\n(2) https://peps.python.org/pep-0528/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Initialization with PyConfig,  Next: Isolated Configuration,  Prev: PyConfig,  Up: Python Initialization Configuration": {
            "content": "Function to initialize Python:\n\n-- C Function: *note PyStatus: 7d1. PyInitializeFromConfig (const\nPyConfig *config)\n\nInitialize Python from 'config' configuration.\n",
            "subsections": []
        },
        "The current configuration ('PyConfig' type) is stored in": {
            "content": "'PyInterpreterState.config'.\n\nExample setting the program name:\n\nvoid initpython(void)\n{\nPyStatus status;\n\nPyConfig config;\nPyConfigInitPythonConfig(&config);\n\n/* Set the program name. Implicitly preinitialize Python. */\nstatus = PyConfigSetString(&config, &config.programname,\nL\"/path/to/myprogram\");\nif (PyStatusException(status)) {\ngoto exception;\n}\n\nstatus = PyInitializeFromConfig(&config);\nif (PyStatusException(status)) {\ngoto exception;\n}\nPyConfigClear(&config);\nreturn;\n\nexception:\nPyConfigClear(&config);\nPyExitStatusException(status);\n}\n",
            "subsections": []
        },
        "More complete example modifying the default configuration, read the": {
            "content": "configuration, and then override some parameters.  Note that since 3.11,\nmany parameters are not calculated until initialization, and so values\ncannot be read from the configuration structure.  Any values set before\ninitialize is called will be left unchanged by initialization:\n\nPyStatus initpython(const char *programname)\n{\nPyStatus status;\n\nPyConfig config;\nPyConfigInitPythonConfig(&config);\n\n/* Set the program name before reading the configuration\n(decode byte string from the locale encoding).\n\nImplicitly preinitialize Python. */\nstatus = PyConfigSetBytesString(&config, &config.programname,\nprogramname);\nif (PyStatusException(status)) {\ngoto done;\n}\n\n/* Read all configuration at once */\nstatus = PyConfigRead(&config);\nif (PyStatusException(status)) {\ngoto done;\n}\n\n/* Specify sys.path explicitly */\n/* If you want to modify the default set of paths, finish\ninitialization first and then use PySysGetObject(\"path\") */\nconfig.modulesearchpathsset = 1;\nstatus = PyWideStringListAppend(&config.modulesearchpaths,\nL\"/path/to/stdlib\");\nif (PyStatusException(status)) {\ngoto done;\n}\nstatus = PyWideStringListAppend(&config.modulesearchpaths,\nL\"/path/to/more/modules\");\nif (PyStatusException(status)) {\ngoto done;\n}\n\n/* Override executable computed by PyConfigRead() */\nstatus = PyConfigSetString(&config, &config.executable,\nL\"/path/to/myexecutable\");\nif (PyStatusException(status)) {\ngoto done;\n}\n\nstatus = PyInitializeFromConfig(&config);\n\ndone:\nPyConfigClear(&config);\nreturn status;\n}\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Isolated Configuration,  Next: Python Configuration,  Prev: Initialization with PyConfig,  Up: Python Initialization Configuration": {
            "content": "*note PyPreConfigInitIsolatedConfig(): 7da. and *note",
            "subsections": []
        },
        "PyConfigInitIsolatedConfig(): 7d4. functions create a configuration to": {
            "content": "isolate Python from the system.  For example, to embed Python into an\napplication.\n",
            "subsections": []
        },
        "This configuration ignores global configuration variables, environment": {
            "content": "variables, command line arguments (*note PyConfig.argv: 168d. is not\nparsed) and user site directory.  The C standard streams (ex: 'stdout')\nand the LCCTYPE locale are left unchanged.  Signal handlers are not\ninstalled.\n",
            "subsections": []
        },
        "Configuration files are still used with this configuration to determine": {
            "content": "paths that are unspecified.  Ensure *note PyConfig.home: 333. is\nspecified to avoid computing the default path configuration.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python Configuration,  Next: Python Path Configuration,  Prev: Isolated Configuration,  Up: Python Initialization Configuration": {
            "content": "*note PyPreConfigInitPythonConfig(): 7db. and *note",
            "subsections": []
        },
        "PyConfigInitPythonConfig(): 7d5. functions create a configuration to": {
            "content": "build a customized Python which behaves as the regular Python.\n",
            "subsections": []
        },
        "Environments variables and command line arguments are used to configure": {
            "content": "Python, whereas global configuration variables are ignored.\n\nThis function enables C locale coercion ( PEP 538(1)) and *note Python\nUTF-8 Mode: 420. ( PEP 540(2)) depending on the LCCTYPE locale, *note\nPYTHONUTF8: 90e. and *note PYTHONCOERCECLOCALE: 90b. environment\nvariables.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0538/\n\n(2) https://peps.python.org/pep-0540/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python Path Configuration,  Next: PyRunMain,  Prev: Python Configuration,  Up: Python Initialization Configuration": {
            "content": "*note PyConfig: 318. contains multiple fields for the path\nconfiguration:\n\n* Path configuration inputs:\n\n* *note PyConfig.home: 333.\n\n* *note PyConfig.platlibdir: 16a4.\n\n* *note PyConfig.pathconfigwarnings: 301.\n\n* *note PyConfig.programname: 4b32.\n\n* *note PyConfig.pythonpathenv: 4b87.\n\n* current working directory: to get absolute paths\n\n* 'PATH' environment variable to get the program full path (from\n*note PyConfig.programname: 4b32.)\n\n* 'PYVENVLAUNCHER' environment variable\n\n* (Windows only) Application paths in the registry under\n\"SoftwarePythonPythonCoreX.YPythonPath\" of HKEYCURRENTUSER\nand HKEYLOCALMACHINE (where X.Y is the Python version).\n\n* Path configuration output fields:\n\n* *note PyConfig.baseexecprefix: 4b79.\n\n* *note PyConfig.baseexecutable: 4b7a.\n\n* *note PyConfig.baseprefix: 4b7c.\n\n* *note PyConfig.execprefix: 4b82.\n\n* *note PyConfig.executable: 4b7b.\n\n* *note PyConfig.modulesearchpathsset: 3b5, *note\nPyConfig.modulesearchpaths: 3b6.\n\n* *note PyConfig.prefix: 4b88.\n\nIf at least one \"output field\" is not set, Python calculates the path\nconfiguration to fill unset fields.  If *note modulesearchpathsset:\n3b5. is equal to '0', *note modulesearchpaths: 3b6. is overridden and\n*note modulesearchpathsset: 3b5. is set to '1'.\n",
            "subsections": []
        },
        "It is possible to completely ignore the function calculating the default": {
            "content": "path configuration by setting explicitly all path configuration output\nfields listed above.  A string is considered as set even if it is\nnon-empty.  'modulesearchpaths' is considered as set if\n'modulesearchpathsset' is set to '1'.  In this case,\n'modulesearchpaths' will be used without modification.\n\nSet *note pathconfigwarnings: 301. to '0' to suppress warnings when\ncalculating the path configuration (Unix only, Windows does not log any\nwarning).\n\nIf *note baseprefix: 4b7c. or *note baseexecprefix: 4b79. fields are\nnot set, they inherit their value from *note prefix: 4b88. and *note\nexecprefix: 4b82. respectively.\n\n*note PyRunMain(): 7e9. and *note PyMain(): a6d. modify *note\nsys.path: 32c.:\n\n* If *note runfilename: 4b8b. is set and is a directory which\ncontains a 'main.py' script, prepend *note runfilename: 4b8b.\nto *note sys.path: 32c.\n\n* If *note isolated: 30e. is zero:\n\n* If *note runmodule: 4b8d. is set, prepend the current\ndirectory to *note sys.path: 32c.  Do nothing if the current\ndirectory cannot be read.\n\n* If *note runfilename: 4b8b. is set, prepend the directory of\nthe filename to *note sys.path: 32c.\n\n* Otherwise, prepend an empty string to *note sys.path: 32c.\n\nIf *note siteimport: 2fd. is non-zero, *note sys.path: 32c. can be\nmodified by the *note site: c2. module.  If *note usersitedirectory:\n307. is non-zero and the user's site-package directory exists, the *note\nsite: c2. module appends the user's site-package directory to *note\nsys.path: 32c.\n\nThe following configuration files are used by the path configuration:\n\n* 'pyvenv.cfg'\n\n* '.pth' file (ex: 'python.pth')\n\n* 'pybuilddir.txt' (Unix only)\n\nIf a '.pth' file is present:\n\n* Set *note isolated: 30e. to '1'.\n\n* Set *note useenvironment: 303. to '0'.\n\n* Set *note siteimport: 2fd. to '0'.\n\n* Set *note safepath: 55e. to '1'.\n\nThe 'PYVENVLAUNCHER' environment variable is used to set *note\nPyConfig.baseexecutable: 4b7a.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: PyRunMain,  Next: PyGetArgcArgv,  Prev: Python Path Configuration,  Up: Python Initialization Configuration": {
            "content": "-- C Function: int PyRunMain (void)\n\nExecute the command (*note PyConfig.runcommand: 4b8a.), the script\n(*note PyConfig.runfilename: 4b8b.) or the module (*note\nPyConfig.runmodule: 4b8d.) specified on the command line or in the\nconfiguration.\n\nBy default and when if *note -i: 1336. option is used, run the\nREPL.\n\nFinally, finalizes Python and returns an exit status that can be\npassed to the 'exit()' function.\n\nSee *note Python Configuration: 4b62. for an example of customized\nPython always running in isolated mode using *note PyRunMain(): 7e9.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: PyGetArgcArgv,  Next: Multi-Phase Initialization Private Provisional API,  Prev: PyRunMain,  Up: Python Initialization Configuration": {
            "content": "-- C Function: void PyGetArgcArgv (int *argc, wchart *argv)\n\nGet the original command line arguments, before Python modified\nthem.\n\nSee also *note PyConfig.origargv: 6a2. member.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Multi-Phase Initialization Private Provisional API,  Prev: PyGetArgcArgv,  Up: Python Initialization Configuration": {
            "content": "",
            "subsections": []
        },
        "This section is a private provisional API introducing multi-phase": {
            "content": "initialization, the core feature of PEP 432(1):\n\n* \"Core\" initialization phase, \"bare minimum Python\":\n\n* Builtin types;\n\n* Builtin exceptions;\n\n* Builtin and frozen modules;\n\n* The *note sys: d3. module is only partially initialized (ex:\n*note sys.path: 32c. doesn't exist yet).\n\n* \"Main\" initialization phase, Python is fully initialized:\n\n* Install and configure *note importlib: 71.;\n\n* Apply the *note Path Configuration: 6c3.;\n\n* Install signal handlers;\n\n* Finish *note sys: d3. module initialization (ex: create *note\nsys.stdout: 90c. and *note sys.path: 32c.);\n\n* Enable optional features like *note faulthandler: 53. and\n*note tracemalloc: fa.;\n\n* Import the *note site: c2. module;\n\n* etc.\n\nPrivate provisional API:\n\n* 'PyConfig.initmain': if set to '0', *note\nPyInitializeFromConfig(): 317. stops at the \"Core\" initialization\nphase.\n\n-- C Function: *note PyStatus: 7d1. PyInitializeMain (void)\n\nMove to the \"Main\" initialization phase, finish the Python\ninitialization.\n\nNo module is imported during the \"Core\" phase and the 'importlib' module\nis not configured: the *note Path Configuration: 6c3. is only applied\nduring the \"Main\" phase.  It may allow to customize Python in Python to\noverride or tune the *note Path Configuration: 6c3, maybe install a\ncustom *note sys.metapath: b80. importer or an import hook, etc.\n\nIt may become possible to calculate the *note Path Configuration: 6c3.\nin Python, after the Core phase and before the Main phase, which is one\nof the PEP 432(2) motivation.\n\nThe \"Core\" phase is not properly defined: what should be and what should\nnot be available at this phase is not specified yet.  The API is marked\nas private and provisional: the API can be modified or even be removed\nanytime until a proper public API is designed.\n\nExample running Python code between \"Core\" and \"Main\" initialization\nphases:\n\nvoid initpython(void)\n{\nPyStatus status;\n\nPyConfig config;\nPyConfigInitPythonConfig(&config);\nconfig.initmain = 0;\n\n/* ... customize 'config' configuration ... */\n\nstatus = PyInitializeFromConfig(&config);\nPyConfigClear(&config);\nif (PyStatusException(status)) {\nPyExitStatusException(status);\n}\n\n/* Use sys.stderr because sys.stdout is only created\nby PyInitializeMain() */\nint res = PyRunSimpleString(\n\"import sys; \"\n\"print('Run Python code before PyInitializeMain', \"\n\"file=sys.stderr)\");\nif (res < 0) {\nexit(1);\n}\n\n/* ... put more configuration code here ... */\n\nstatus = PyInitializeMain();\nif (PyStatusException(status)) {\nPyExitStatusException(status);\n}\n}\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0432/\n\n(2) https://peps.python.org/pep-0432/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Memory Management,  Next: Object Implementation Support,  Prev: Python Initialization Configuration,  Up: Python/C API Reference Manual": {
            "content": "",
            "subsections": [
                {
                    "name": "7.11 Memory Management",
                    "content": "* Menu:\n\n* Overview: Overview<4>.\n* Allocator Domains::\n* Raw Memory Interface::\n* Memory Interface::\n* Object allocators::\n* Default Memory Allocators::\n* Customize Memory Allocators::\n* Debug hooks on the Python memory allocators::\n* The pymalloc allocator::\n* tracemalloc C API::\n* Examples: Examples<37>.\n\nFile: python3.12.info,  Node: Overview<4>,  Next: Allocator Domains,  Up: Memory Management\n\n"
                }
            ]
        },
        "Memory management in Python involves a private heap containing all": {
            "content": "",
            "subsections": []
        },
        "Python objects and data structures.  The management of this private heap": {
            "content": "is ensured internally by the 'Python memory manager'.  The Python memory\nmanager has different components which deal with various dynamic storage\nmanagement aspects, like sharing, segmentation, preallocation or\ncaching.\n",
            "subsections": []
        },
        "At the lowest level, a raw memory allocator ensures that there is enough": {
            "content": "room in the private heap for storing all Python-related data by\ninteracting with the memory manager of the operating system.  On top of\nthe raw memory allocator, several object-specific allocators operate on\nthe same heap and implement distinct memory management policies adapted\nto the peculiarities of every object type.  For example, integer objects\nare managed differently within the heap than strings, tuples or\ndictionaries because integers imply different storage requirements and\nspeed/space tradeoffs.  The Python memory manager thus delegates some of\nthe work to the object-specific allocators, but ensures that the latter\noperate within the bounds of the private heap.\n",
            "subsections": []
        },
        "It is important to understand that the management of the Python heap is": {
            "content": "performed by the interpreter itself and that the user has no control\nover it, even if they regularly manipulate object pointers to memory\nblocks inside that heap.  The allocation of heap space for Python\nobjects and other internal buffers is performed on demand by the Python\nmemory manager through the Python/C API functions listed in this\ndocument.\n",
            "subsections": []
        },
        "To avoid memory corruption, extension writers should never try to": {
            "content": "operate on Python objects with the functions exported by the C library:\n'malloc()', 'calloc()', 'realloc()' and 'free()'.  This will result in\nmixed calls between the C allocator and the Python memory manager with\nfatal consequences, because they implement different algorithms and\noperate on different heaps.  However, one may safely allocate and\nrelease memory blocks with the C library allocator for individual\npurposes, as shown in the following example:\n\nPyObject *res;\nchar *buf = (char *) malloc(BUFSIZ); /* for I/O */\n\nif (buf == NULL)\nreturn PyErrNoMemory();\n...Do some I/O operation involving buf...\nres = PyBytesFromString(buf);\nfree(buf); /* malloc'ed */\nreturn res;\n",
            "subsections": []
        },
        "In this example, the memory request for the I/O buffer is handled by the": {
            "content": "C library allocator.  The Python memory manager is involved only in the\nallocation of the bytes object returned as a result.\n",
            "subsections": []
        },
        "In most situations, however, it is recommended to allocate memory from": {
            "content": "the Python heap specifically because the latter is under control of the",
            "subsections": []
        },
        "Python memory manager.  For example, this is required when the": {
            "content": "interpreter is extended with new object types written in C. Another\nreason for using the Python heap is the desire to 'inform' the Python\nmemory manager about the memory needs of the extension module.  Even\nwhen the requested memory is used exclusively for internal, highly\nspecific purposes, delegating all memory requests to the Python memory\nmanager causes the interpreter to have a more accurate image of its\nmemory footprint as a whole.  Consequently, under certain circumstances,\nthe Python memory manager may or may not trigger appropriate actions,\nlike garbage collection, memory compaction or other preventive\nprocedures.  Note that by using the C library allocator as shown in the\nprevious example, the allocated memory for the I/O buffer escapes\ncompletely the Python memory manager.\n\nSee also\n........\n\nThe *note PYTHONMALLOC: aaf. environment variable can be used to\nconfigure the memory allocators used by Python.\n\nThe *note PYTHONMALLOCSTATS: 18d9. environment variable can be used to\nprint statistics of the *note pymalloc memory allocator: b61. every time\na new pymalloc object arena is created, and on shutdown.\n\nFile: python3.12.info,  Node: Allocator Domains,  Next: Raw Memory Interface,  Prev: Overview<4>,  Up: Memory Management\n\n\nAll allocating functions belong to one of three different \"domains\" (see\nalso *note PyMemAllocatorDomain: 4b9f.).  These domains represent\ndifferent allocation strategies and are optimized for different\npurposes.  The specific details on how every domain allocates memory or\nwhat internal functions each domain calls is considered an\nimplementation detail, but for debugging purposes a simplified table can\nbe found at *note here: 1ad0.  There is no hard requirement to use the\nmemory returned by the allocation functions belonging to a given domain\nfor only the purposes hinted by that domain (although this is the\nrecommended practice).  For example, one could use the memory returned\nby *note PyMemRawMalloc(): ea9. for allocating Python objects or the\nmemory returned by *note PyObjectMalloc(): ab3. for allocating memory\nfor buffers.\n\nThe three allocation domains are:\n\n* Raw domain: intended for allocating memory for general-purpose\nmemory buffers where the allocation 'must' go to the system\nallocator or where the allocator can operate without the *note GIL:\n6c0.  The memory is requested directly to the system.\n\n* \"Mem\" domain: intended for allocating memory for Python buffers and\ngeneral-purpose memory buffers where the allocation must be\nperformed with the *note GIL: 6c0. held.  The memory is taken from\nthe Python private heap.\n\n* Object domain: intended for allocating memory belonging to Python\nobjects.  The memory is taken from the Python private heap.\n",
            "subsections": []
        },
        "When freeing memory previously allocated by the allocating functions": {
            "content": "belonging to a given domain,the matching specific deallocating functions\nmust be used.  For example, *note PyMemFree(): 129a. must be used to\nfree memory allocated using *note PyMemMalloc(): ab1.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Raw Memory Interface,  Next: Memory Interface,  Prev: Allocator Domains,  Up: Memory Management": {
            "content": "",
            "subsections": []
        },
        "The following function sets are wrappers to the system allocator.  These": {
            "content": "functions are thread-safe, the *note GIL: 141. does not need to be held.\n\nThe *note default raw memory allocator: 1ad0. uses the following\nfunctions: 'malloc()', 'calloc()', 'realloc()' and 'free()'; call\n'malloc(1)' (or 'calloc(1, 1)') when requesting zero bytes.\n\nNew in version 3.4.\n\n-- C Function: void *PyMemRawMalloc (sizet n)\n\nAllocates 'n' bytes and returns a pointer of type void* to the\nallocated memory, or 'NULL' if the request fails.\n\nRequesting zero bytes returns a distinct non-'NULL' pointer if\npossible, as if 'PyMemRawMalloc(1)' had been called instead.  The\nmemory will not have been initialized in any way.\n\n-- C Function: void *PyMemRawCalloc (sizet nelem, sizet elsize)\n\nAllocates 'nelem' elements each whose size in bytes is 'elsize' and\nreturns a pointer of type void* to the allocated memory, or 'NULL'\nif the request fails.  The memory is initialized to zeros.\n\nRequesting zero elements or elements of size zero bytes returns a\ndistinct non-'NULL' pointer if possible, as if 'PyMemRawCalloc(1,\n1)' had been called instead.\n\nNew in version 3.5.\n\n-- C Function: void *PyMemRawRealloc (void *p, sizet n)\n\nResizes the memory block pointed to by 'p' to 'n' bytes.  The\ncontents will be unchanged to the minimum of the old and the new\nsizes.\n\nIf 'p' is 'NULL', the call is equivalent to 'PyMemRawMalloc(n)';\nelse if 'n' is equal to zero, the memory block is resized but is\nnot freed, and the returned pointer is non-'NULL'.\n\nUnless 'p' is 'NULL', it must have been returned by a previous call\nto *note PyMemRawMalloc(): ea9, *note PyMemRawRealloc(): eaa. or\n*note PyMemRawCalloc(): d11.\n\nIf the request fails, *note PyMemRawRealloc(): eaa. returns 'NULL'\nand 'p' remains a valid pointer to the previous memory area.\n\n-- C Function: void PyMemRawFree (void *p)\n\nFrees the memory block pointed to by 'p', which must have been\nreturned by a previous call to *note PyMemRawMalloc(): ea9, *note\nPyMemRawRealloc(): eaa. or *note PyMemRawCalloc(): d11.\nOtherwise, or if 'PyMemRawFree(p)' has been called before,\nundefined behavior occurs.\n\nIf 'p' is 'NULL', no operation is performed.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Memory Interface,  Next: Object allocators,  Prev: Raw Memory Interface,  Up: Memory Management": {
            "content": "",
            "subsections": []
        },
        "The following function sets, modeled after the ANSI C standard, but": {
            "content": "specifying behavior when requesting zero bytes, are available for\nallocating and releasing memory from the Python heap.\n\nNote: There is no guarantee that the memory returned by these\nallocators can be successfully cast to a Python object when\nintercepting the allocating functions in this domain by the methods\ndescribed in the *note Customize Memory Allocators: 4ba5. section.\n\nThe *note default object allocator: 1ad0. uses the *note pymalloc memory\nallocator: b61.\n\nWarning: The *note GIL: 141. must be held when using these\nfunctions.\n\n-- C Function: void *PyObjectMalloc (sizet n)\n' Part of the *note Stable ABI: 2ac.'  Allocates 'n' bytes and\nreturns a pointer of type void* to the allocated memory, or 'NULL'\nif the request fails.\n\nRequesting zero bytes returns a distinct non-'NULL' pointer if\npossible, as if 'PyObjectMalloc(1)' had been called instead.  The\nmemory will not have been initialized in any way.\n\n-- C Function: void *PyObjectCalloc (sizet nelem, sizet elsize)\n' Part of the *note Stable ABI: 2ac. since version 3.7.'  Allocates\n'nelem' elements each whose size in bytes is 'elsize' and returns a\npointer of type void* to the allocated memory, or 'NULL' if the\nrequest fails.  The memory is initialized to zeros.\n\nRequesting zero elements or elements of size zero bytes returns a\ndistinct non-'NULL' pointer if possible, as if 'PyObjectCalloc(1,\n1)' had been called instead.\n\nNew in version 3.5.\n\n-- C Function: void *PyObjectRealloc (void *p, sizet n)\n' Part of the *note Stable ABI: 2ac.'  Resizes the memory block\npointed to by 'p' to 'n' bytes.  The contents will be unchanged to\nthe minimum of the old and the new sizes.\n\nIf 'p' is 'NULL', the call is equivalent to 'PyObjectMalloc(n)';\nelse if 'n' is equal to zero, the memory block is resized but is\nnot freed, and the returned pointer is non-'NULL'.\n\nUnless 'p' is 'NULL', it must have been returned by a previous call\nto *note PyObjectMalloc(): ab3, *note PyObjectRealloc(): 129b. or\n*note PyObjectCalloc(): d13.\n\nIf the request fails, *note PyObjectRealloc(): 129b. returns\n'NULL' and 'p' remains a valid pointer to the previous memory area.\n\n-- C Function: void PyObjectFree (void *p)\n' Part of the *note Stable ABI: 2ac.'  Frees the memory block\npointed to by 'p', which must have been returned by a previous call\nto *note PyObjectMalloc(): ab3, *note PyObjectRealloc(): 129b. or\n*note PyObjectCalloc(): d13.  Otherwise, or if 'PyObjectFree(p)'\nhas been called before, undefined behavior occurs.\n\nIf 'p' is 'NULL', no operation is performed.\n",
            "subsections": []
        },
        "Changed in version 3.6: The default allocator is now pymalloc instead of": {
            "content": "system 'malloc()'.\n\n-- C Function: void *PyMemMalloc (sizet n)\n' Part of the *note Stable ABI: 2ac.'  Allocates 'n' bytes and\nreturns a pointer of type void* to the allocated memory, or 'NULL'\nif the request fails.\n\nRequesting zero bytes returns a distinct non-'NULL' pointer if\npossible, as if 'PyMemMalloc(1)' had been called instead.  The\nmemory will not have been initialized in any way.\n\n-- C Function: void *PyMemCalloc (sizet nelem, sizet elsize)\n' Part of the *note Stable ABI: 2ac. since version 3.7.'  Allocates\n'nelem' elements each whose size in bytes is 'elsize' and returns a\npointer of type void* to the allocated memory, or 'NULL' if the\nrequest fails.  The memory is initialized to zeros.\n\nRequesting zero elements or elements of size zero bytes returns a\ndistinct non-'NULL' pointer if possible, as if 'PyMemCalloc(1, 1)'\nhad been called instead.\n\nNew in version 3.5.\n\n-- C Function: void *PyMemRealloc (void *p, sizet n)\n' Part of the *note Stable ABI: 2ac.'  Resizes the memory block\npointed to by 'p' to 'n' bytes.  The contents will be unchanged to\nthe minimum of the old and the new sizes.\n\nIf 'p' is 'NULL', the call is equivalent to 'PyMemMalloc(n)'; else\nif 'n' is equal to zero, the memory block is resized but is not\nfreed, and the returned pointer is non-'NULL'.\n\nUnless 'p' is 'NULL', it must have been returned by a previous call\nto *note PyMemMalloc(): ab1, *note PyMemRealloc(): eab. or *note\nPyMemCalloc(): d12.\n\nIf the request fails, *note PyMemRealloc(): eab. returns 'NULL'\nand 'p' remains a valid pointer to the previous memory area.\n\n-- C Function: void PyMemFree (void *p)\n' Part of the *note Stable ABI: 2ac.'  Frees the memory block\npointed to by 'p', which must have been returned by a previous call\nto *note PyMemMalloc(): ab1, *note PyMemRealloc(): eab. or *note\nPyMemCalloc(): d12.  Otherwise, or if 'PyMemFree(p)' has been\ncalled before, undefined behavior occurs.\n\nIf 'p' is 'NULL', no operation is performed.\n",
            "subsections": []
        },
        "The following type-oriented macros are provided for convenience.  Note": {
            "content": "that 'TYPE' refers to any C type.\n\n-- C Macro: PyMemNew (TYPE, n)\n\nSame as *note PyMemMalloc(): ab1, but allocates '(n *\nsizeof(TYPE))' bytes of memory.  Returns a pointer cast to 'TYPE*'.\nThe memory will not have been initialized in any way.\n\n-- C Macro: PyMemResize (p, TYPE, n)\n\nSame as *note PyMemRealloc(): eab, but the memory block is resized\nto '(n * sizeof(TYPE))' bytes.  Returns a pointer cast to 'TYPE*'.\nOn return, 'p' will be a pointer to the new memory area, or 'NULL'\nin the event of failure.\n\nThis is a C preprocessor macro; 'p' is always reassigned.  Save the\noriginal value of 'p' to avoid losing memory when handling errors.\n\n-- C Function: void PyMemDel (void *p)\n\nSame as *note PyMemFree(): 129a.\n",
            "subsections": []
        },
        "In addition, the following macro sets are provided for calling the": {
            "content": "",
            "subsections": []
        },
        "Python memory allocator directly, without involving the C API functions": {
            "content": "listed above.  However, note that their use does not preserve binary\ncompatibility across Python versions and is therefore deprecated in\nextension modules.\n\n* 'PyMemMALLOC(size)'\n\n* 'PyMemNEW(type, size)'\n\n* 'PyMemREALLOC(ptr, size)'\n\n* 'PyMemRESIZE(ptr, type, size)'\n\n* 'PyMemFREE(ptr)'\n\n* 'PyMemDEL(ptr)'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Object allocators,  Next: Default Memory Allocators,  Prev: Memory Interface,  Up: Memory Management": {
            "content": "",
            "subsections": []
        },
        "File: python3.12.info,  Node: Default Memory Allocators,  Next: Customize Memory Allocators,  Prev: Object allocators,  Up: Memory Management": {
            "content": "Default memory allocators:\n",
            "subsections": []
        },
        "Configuration                       Name                     PyMemRawMalloc        PyMemMalloc              PyObjectMalloc": {
            "content": "---------------------------------------------------------------------------------------------------------------------------------------\n\nRelease build                       '\"pymalloc\"'             'malloc'               'pymalloc'                'pymalloc'\n\n\nDebug build                         '\"pymallocdebug\"'       'malloc' + debug       'pymalloc' + debug        'pymalloc' + debug\n\n\nRelease build, without pymalloc     '\"malloc\"'               'malloc'               'malloc'                  'malloc'\n\n\nDebug build, without pymalloc       '\"mallocdebug\"'         'malloc' + debug       'malloc' + debug          'malloc' + debug\n\n\nLegend:\n\n* Name: value for *note PYTHONMALLOC: aaf. environment variable.\n\n* 'malloc': system allocators from the standard C library, C\nfunctions: 'malloc()', 'calloc()', 'realloc()' and 'free()'.\n\n* 'pymalloc': *note pymalloc memory allocator: b61.\n\n* \"+ debug\": with *note debug hooks on the Python memory allocators:\n1ad2.\n\n* \"Debug build\": *note Python build in debug mode: 67f.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Customize Memory Allocators,  Next: Debug hooks on the Python memory allocators,  Prev: Default Memory Allocators,  Up: Memory Management": {
            "content": "New in version 3.4.\n\n-- C Type: type PyMemAllocatorEx\n\nStructure used to describe a memory block allocator.  The structure\nhas the following fields:\n\nField                                                          Meaning\n\n-----------------------------------------------------------------------------------------------------------\n\n'void *ctx'                                                    user context passed as first argument\n\n\n'void* malloc(void *ctx, sizet size)'                         allocate a memory block\n\n\n'void* calloc(void *ctx, sizet nelem, sizet elsize)'         allocate a memory block initialized with\nzeros\n\n\n'void* realloc(void *ctx, void *ptr, sizet newsize)'         allocate or resize a memory block\n\n\n'void free(void *ctx, void *ptr)'                              free a memory block\n\n\nChanged in version 3.5: The 'PyMemAllocator' structure was renamed\nto *note PyMemAllocatorEx: d33. and a new 'calloc' field was added.\n\n-- C Type: type PyMemAllocatorDomain\n\nEnum used to identify an allocator domain.  Domains:\n\n-- C Macro: PYMEMDOMAINRAW\n\nFunctions:\n\n* *note PyMemRawMalloc(): ea9.\n\n* *note PyMemRawRealloc(): eaa.\n\n* *note PyMemRawCalloc(): d11.\n\n* *note PyMemRawFree(): 4905.\n\n-- C Macro: PYMEMDOMAINMEM\n\nFunctions:\n\n* *note PyMemMalloc(): ab1,\n\n* *note PyMemRealloc(): eab.\n\n* *note PyMemCalloc(): d12.\n\n* *note PyMemFree(): 129a.\n\n-- C Macro: PYMEMDOMAINOBJ\n\nFunctions:\n\n* *note PyObjectMalloc(): ab3.\n\n* *note PyObjectRealloc(): 129b.\n\n* *note PyObjectCalloc(): d13.\n\n* *note PyObjectFree(): ab0.\n\n-- C Function: void PyMemGetAllocator (PyMemAllocatorDomain domain,\nPyMemAllocatorEx *allocator)\n\nGet the memory block allocator of the specified domain.\n\n-- C Function: void PyMemSetAllocator (PyMemAllocatorDomain domain,\nPyMemAllocatorEx *allocator)\n\nSet the memory block allocator of the specified domain.\n\nThe new allocator must return a distinct non-'NULL' pointer when\nrequesting zero bytes.\n\nFor the *note PYMEMDOMAINRAW: 1ad1. domain, the allocator must be\nthread-safe: the *note GIL: 141. is not held when the allocator is\ncalled.\n\nFor the remaining domains, the allocator must also be thread-safe:\nthe allocator may be called in different interpreters that do not\nshare a 'GIL'.\n\nIf the new allocator is not a hook (does not call the previous\nallocator), the *note PyMemSetupDebugHooks(): ab5. function must\nbe called to reinstall the debug hooks on top on the new allocator.\n\nSee also *note PyPreConfig.allocator: 4b6d. and *note Preinitialize\nPython with PyPreConfig: 3980.\n\nWarning: *note PyMemSetAllocator(): 2ed. does have the\nfollowing contract:\n\n* It can be called after *note PyPreInitialize(): 316. and\nbefore *note PyInitializeFromConfig(): 317. to install a\ncustom memory allocator.  There are no restrictions over\nthe installed allocator other than the ones imposed by\nthe domain (for instance, the Raw Domain allows the\nallocator to be called without the GIL held).  See *note\nthe section on allocator domains: 4b9e. for more\ninformation.\n\n* If called after Python has finish initializing (after\n*note PyInitializeFromConfig(): 317. has been called)\nthe allocator 'must' wrap the existing allocator.\nSubstituting the current allocator for some other\narbitrary one is 'not supported'.\n\nChanged in version 3.12: All allocators must be thread-safe.\n\n-- C Function: void PyMemSetupDebugHooks (void)\n\nSetup *note debug hooks in the Python memory allocators: 1ad2. to\ndetect memory errors.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Debug hooks on the Python memory allocators,  Next: The pymalloc allocator,  Prev: Customize Memory Allocators,  Up: Memory Management": {
            "content": "When *note Python is built in debug mode: 67f, the *note\nPyMemSetupDebugHooks(): ab5. function is called at the *note Python\npreinitialization: 3980. to setup debug hooks on Python memory\nallocators to detect memory errors.\n\nThe *note PYTHONMALLOC: aaf. environment variable can be used to install\ndebug hooks on a Python compiled in release mode (ex:\n'PYTHONMALLOC=debug').\n\nThe *note PyMemSetupDebugHooks(): ab5. function can be used to set\ndebug hooks after calling *note PyMemSetAllocator(): 2ed.\n",
            "subsections": []
        },
        "These debug hooks fill dynamically allocated memory blocks with special,": {
            "content": "recognizable bit patterns.  Newly allocated memory is filled with the\nbyte '0xCD' ('PYMEMCLEANBYTE'), freed memory is filled with the byte\n'0xDD' ('PYMEMDEADBYTE').  Memory blocks are surrounded by \"forbidden\nbytes\" filled with the byte '0xFD' ('PYMEMFORBIDDENBYTE').  Strings of\nthese bytes are unlikely to be valid addresses, floats, or ASCII\nstrings.\n\nRuntime checks:\n\n- Detect API violations.  For example, detect if *note\nPyObjectFree(): ab0. is called on a memory block allocated by\n*note PyMemMalloc(): ab1.\n\n- Detect write before the start of the buffer (buffer underflow).\n\n- Detect write after the end of the buffer (buffer overflow).\n\n- Check that the *note GIL: 141. is held when allocator functions of\n*note PYMEMDOMAINOBJ: ab2. (ex: *note PyObjectMalloc(): ab3.)\nand *note PYMEMDOMAINMEM: ab4. (ex: *note PyMemMalloc(): ab1.)\ndomains are called.\n\nOn error, the debug hooks use the *note tracemalloc: fa. module to get\nthe traceback where a memory block was allocated.  The traceback is only\ndisplayed if *note tracemalloc: fa. is tracing Python memory allocations\nand the memory block was traced.\n\nLet 'S' = 'sizeof(sizet)'.  '2*S' bytes are added at each end of each\nblock of 'N' bytes requested.  The memory layout is like so, where p\nrepresents the address returned by a malloc-like or realloc-like\nfunction ('p[i:j]' means the slice of bytes from '*(p+i)' inclusive up\nto '*(p+j)' exclusive; note that the treatment of negative indices\ndiffers from a Python slice):\n\n'p[-2*S:-S]'\n\nNumber of bytes originally asked for.  This is a sizet, big-endian\n(easier to read in a memory dump).\n\n'p[-S]'\n\nAPI identifier (ASCII character):\n\n* ''r'' for *note PYMEMDOMAINRAW: 1ad1.\n\n* ''m'' for *note PYMEMDOMAINMEM: ab4.\n\n* ''o'' for *note PYMEMDOMAINOBJ: ab2.\n\n'p[-S+1:0]'\n\nCopies of PYMEMFORBIDDENBYTE. Used to catch under- writes and\nreads.\n\n'p[0:N]'\n\nThe requested memory, filled with copies of PYMEMCLEANBYTE, used\nto catch reference to uninitialized memory.  When a realloc-like\nfunction is called requesting a larger memory block, the new excess\nbytes are also filled with PYMEMCLEANBYTE. When a free-like\nfunction is called, these are overwritten with PYMEMDEADBYTE, to\ncatch reference to freed memory.  When a realloc- like function is\ncalled requesting a smaller memory block, the excess old bytes are\nalso filled with PYMEMDEADBYTE.\n\n'p[N:N+S]'\n\nCopies of PYMEMFORBIDDENBYTE. Used to catch over- writes and\nreads.\n\n'p[N+S:N+2*S]'\n\nOnly used if the 'PYMEMDEBUGSERIALNO' macro is defined (not\ndefined by default).\n\nA serial number, incremented by 1 on each call to a malloc-like or\nrealloc-like function.  Big-endian 'sizet'.  If \"bad memory\" is\ndetected later, the serial number gives an excellent way to set a\nbreakpoint on the next run, to capture the instant at which this\nblock was passed out.  The static function bumpserialno() in\nobmalloc.c is the only place the serial number is incremented, and\nexists so you can set such a breakpoint easily.\n\nA realloc-like or free-like function first checks that the\nPYMEMFORBIDDENBYTE bytes at each end are intact.  If they've been\naltered, diagnostic output is written to stderr, and the program is\naborted via PyFatalError().  The other main failure mode is provoking a\nmemory error when a program reads up one of the special bit patterns and\ntries to use it as an address.  If you get in a debugger then and look\nat the object, you're likely to see that it's entirely filled with\nPYMEMDEADBYTE (meaning freed memory is getting used) or PYMEMCLEANBYTE\n(meaning uninitialized memory is getting used).\n\nChanged in version 3.6: The *note PyMemSetupDebugHooks(): ab5. function\nnow also works on Python compiled in release mode.  On error, the debug\nhooks now use *note tracemalloc: fa. to get the traceback where a memory\nblock was allocated.  The debug hooks now also check if the GIL is held\nwhen functions of *note PYMEMDOMAINOBJ: ab2. and *note\nPYMEMDOMAINMEM: ab4. domains are called.\n",
            "subsections": []
        },
        "Changed in version 3.8: Byte patterns '0xCB' ('PYMEMCLEANBYTE'), '0xDB'": {
            "content": "('PYMEMDEADBYTE') and '0xFB' ('PYMEMFORBIDDENBYTE') have been replaced\nwith '0xCD', '0xDD' and '0xFD' to use the same values than Windows CRT\ndebug 'malloc()' and 'free()'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The pymalloc allocator,  Next: tracemalloc C API,  Prev: Debug hooks on the Python memory allocators,  Up: Memory Management": {
            "content": "",
            "subsections": []
        },
        "Python has a 'pymalloc' allocator optimized for small objects (smaller": {
            "content": "or equal to 512 bytes) with a short lifetime.  It uses memory mappings\ncalled \"arenas\" with a fixed size of either 256 KiB on 32-bit platforms\nor 1 MiB on 64-bit platforms.  It falls back to *note PyMemRawMalloc():\nea9. and *note PyMemRawRealloc(): eaa. for allocations larger than 512\nbytes.\n\n'pymalloc' is the *note default allocator: 1ad0. of the *note\nPYMEMDOMAINMEM: ab4. (ex: *note PyMemMalloc(): ab1.) and *note\nPYMEMDOMAINOBJ: ab2. (ex: *note PyObjectMalloc(): ab3.) domains.\n\nThe arena allocator uses the following functions:\n\n* 'VirtualAlloc()' and 'VirtualFree()' on Windows,\n\n* 'mmap()' and 'munmap()' if available,\n\n* 'malloc()' and 'free()' otherwise.\n\nThis allocator is disabled if Python is configured with the *note\n-without-pymalloc: 1b00. option.  It can also be disabled at runtime\nusing the *note PYTHONMALLOC: aaf. environment variable (ex:\n'PYTHONMALLOC=malloc').\n\n* Menu:\n\n* Customize pymalloc Arena Allocator::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Customize pymalloc Arena Allocator,  Up: The pymalloc allocator": {
            "content": "7.11.9.1 Customize pymalloc Arena Allocator\n...........................................\n\nNew in version 3.4.\n\n-- C Type: type PyObjectArenaAllocator\n\nStructure used to describe an arena allocator.  The structure has\nthree fields:\n\nField                                                  Meaning\n\n---------------------------------------------------------------------------------------------------\n\n'void *ctx'                                            user context passed as first argument\n\n\n'void* alloc(void *ctx, sizet size)'                  allocate an arena of size bytes\n\n\n'void free(void *ctx, void *ptr, sizet size)'         free an arena\n\n\n-- C Function: void PyObjectGetArenaAllocator (PyObjectArenaAllocator\n*allocator)\n\nGet the arena allocator.\n\n-- C Function: void PyObjectSetArenaAllocator (PyObjectArenaAllocator\n*allocator)\n\nSet the arena allocator.\n\nFile: python3.12.info,  Node: tracemalloc C API,  Next: Examples<37>,  Prev: The pymalloc allocator,  Up: Memory Management\n\n\nNew in version 3.7.\n\n-- C Function: int PyTraceMallocTrack (unsigned int domain, uintptrt\nptr, sizet size)\n\nTrack an allocated memory block in the *note tracemalloc: fa.\nmodule.\n\nReturn '0' on success, return '-1' on error (failed to allocate\nmemory to store the trace).  Return '-2' if tracemalloc is\ndisabled.\n\nIf memory block is already tracked, update the existing trace.\n\n-- C Function: int PyTraceMallocUntrack (unsigned int domain,\nuintptrt ptr)\n\nUntrack an allocated memory block in the *note tracemalloc: fa.\nmodule.  Do nothing if the block was not tracked.\n\nReturn '-2' if tracemalloc is disabled, otherwise return '0'.\n\nFile: python3.12.info,  Node: Examples<37>,  Prev: tracemalloc C API,  Up: Memory Management\n\n\nHere is the example from section *note Overview: 4b9b, rewritten so that\nthe I/O buffer is allocated from the Python heap by using the first\nfunction set:\n\nPyObject *res;\nchar *buf = (char *) PyMemMalloc(BUFSIZ); /* for I/O */\n\nif (buf == NULL)\nreturn PyErrNoMemory();\n/* ...Do some I/O operation involving buf... */\nres = PyBytesFromString(buf);\nPyMemFree(buf); /* allocated with PyMemMalloc */\nreturn res;\n\nThe same code using the type-oriented function set:\n\nPyObject *res;\nchar *buf = PyMemNew(char, BUFSIZ); /* for I/O */\n\nif (buf == NULL)\nreturn PyErrNoMemory();\n/* ...Do some I/O operation involving buf... */\nres = PyBytesFromString(buf);\nPyMemDel(buf); /* allocated with PyMemNew */\nreturn res;\n",
            "subsections": []
        },
        "Note that in the two examples above, the buffer is always manipulated": {
            "content": "via functions belonging to the same set.  Indeed, it is required to use\nthe same memory API family for a given memory block, so that the risk of\nmixing different allocators is reduced to a minimum.  The following code\nsequence contains two errors, one of which is labeled as 'fatal' because\nit mixes two different allocators operating on different heaps.\n\nchar *buf1 = PyMemNew(char, BUFSIZ);\nchar *buf2 = (char *) malloc(BUFSIZ);\nchar *buf3 = (char *) PyMemMalloc(BUFSIZ);\n...\nPyMemDel(buf3);  /* Wrong -- should be PyMemFree() */\nfree(buf2);       /* Right -- allocated via malloc() */\nfree(buf1);       /* Fatal -- should be PyMemDel()  */\n",
            "subsections": []
        },
        "In addition to the functions aimed at handling raw memory blocks from": {
            "content": "the Python heap, objects in Python are allocated and released with *note\nPyObjectNew: 7a9, *note PyObjectNewVar: 7aa. and *note PyObjectDel():\n132c.\n",
            "subsections": []
        },
        "These will be explained in the next chapter on defining and implementing": {
            "content": "new object types in C.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Object Implementation Support,  Next: API and ABI Versioning,  Prev: Memory Management,  Up: Python/C API Reference Manual": {
            "content": "",
            "subsections": [
                {
                    "name": "7.12 Object Implementation Support",
                    "content": ""
                }
            ]
        },
        "This chapter describes the functions, types, and macros used when": {
            "content": "defining new object types.\n\n* Menu:\n\n* Allocating Objects on the Heap::\n* Common Object Structures::\n* Type Objects: Type Objects<3>.\n* Number Object Structures::\n* Mapping Object Structures::\n* Sequence Object Structures::\n* Buffer Object Structures::\n* Async Object Structures::\n* Slot Type typedefs::\n* Examples: Examples<38>.\n* Supporting Cyclic Garbage Collection::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Allocating Objects on the Heap,  Next: Common Object Structures,  Up: Object Implementation Support": {
            "content": "-- C Function: *note PyObject: 6b1. *PyObjectNew (PyTypeObject *type)\n'Return value: New reference.'\n\n-- C Function: *note PyVarObject: 3dfd. *PyObjectNewVar (PyTypeObject\n*type, Pyssizet size)\n'Return value: New reference.'\n\n-- C Function: *note PyObject: 6b1. *PyObjectInit (PyObject *op,\nPyTypeObject *type)\n'Return value: Borrowed reference.''  Part of the *note Stable ABI:\n2ac.'  Initialize a newly allocated object 'op' with its type and\ninitial reference.  Returns the initialized object.  If 'type'\nindicates that the object participates in the cyclic garbage\ndetector, it is added to the detector's set of observed objects.\nOther fields of the object are not affected.\n\n-- C Function: *note PyVarObject: 3dfd. *PyObjectInitVar (PyVarObject\n*op, PyTypeObject *type, Pyssizet size)\n'Return value: Borrowed reference.''  Part of the *note Stable ABI:\n2ac.'  This does everything *note PyObjectInit(): 898. does, and\nalso initializes the length information for a variable-size object.\n\n-- C Macro: PyObjectNew (TYPE, typeobj)\n\nAllocate a new Python object using the C structure type 'TYPE' and\nthe Python type object 'typeobj' ('PyTypeObject*').  Fields not\ndefined by the Python object header are not initialized.  The\ncaller will own the only reference to the object (i.e.  its\nreference count will be one).  The size of the memory allocation is\ndetermined from the *note tpbasicsize: 7ab. field of the type\nobject.\n\n-- C Macro: PyObjectNewVar (TYPE, typeobj, size)\n\nAllocate a new Python object using the C structure type 'TYPE' and\nthe Python type object 'typeobj' ('PyTypeObject*').  Fields not\ndefined by the Python object header are not initialized.  The\nallocated memory allows for the 'TYPE' structure plus 'size'\n('Pyssizet') fields of the size given by the *note tpitemsize:\n1c77. field of 'typeobj'.  This is useful for implementing objects\nlike tuples, which are able to determine their size at construction\ntime.  Embedding the array of fields into the same allocation\ndecreases the number of allocations, improving the memory\nmanagement efficiency.\n\n-- C Function: void PyObjectDel (void *op)\n\nReleases memory allocated to an object using *note PyObjectNew:\n7a9. or *note PyObjectNewVar: 7aa.  This is normally called from\nthe *note tpdealloc: 46d0. handler specified in the object's type.\nThe fields of the object should not be accessed after this call as\nthe memory is no longer a valid Python object.\n\n-- C Variable: *note PyObject: 6b1. PyNoneStruct\n\nObject which is visible in Python as 'None'.  This should only be\naccessed using the *note PyNone: 469e. macro, which evaluates to a\npointer to this object.\n\nSee also\n........\n\n*note PyModuleCreate(): 46a2.\n\nTo allocate and create extension modules.\n\nFile: python3.12.info,  Node: Common Object Structures,  Next: Type Objects<3>,  Prev: Allocating Objects on the Heap,  Up: Object Implementation Support\n\n",
            "subsections": []
        },
        "There are a large number of structures which are used in the definition": {
            "content": "of object types for Python.  This section describes these structures and\nhow they are used.\n\n* Menu:\n\n* Base object types and macros::\n* Implementing functions and methods::\n* Accessing attributes of extension types::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Base object types and macros,  Next: Implementing functions and methods,  Up: Common Object Structures": {
            "content": "7.12.2.1 Base object types and macros\n.....................................\n",
            "subsections": []
        },
        "All Python objects ultimately share a small number of fields at the": {
            "content": "beginning of the object's representation in memory.  These are\nrepresented by the *note PyObject: 6b1. and *note PyVarObject: 3dfd.\ntypes, which are defined, in turn, by the expansions of some macros also\nused, whether directly or indirectly, in the definition of all other\nPython objects.  Additional macros can be found under *note reference\ncounting: 48e7.\n\n-- C Type: type PyObject\n' Part of the *note Limited API: 2ac.  (Only some members are part\nof the stable ABI.)' All object types are extensions of this type.\nThis is a type which contains the information Python needs to treat\na pointer to an object as an object.  In a normal \"release\" build,\nit contains only the object's reference count and a pointer to the\ncorresponding type object.  Nothing is actually declared to be a\n*note PyObject: 6b1, but every pointer to a Python object can be\ncast to a *note PyObject: 6b1.*.  Access to the members must be\ndone by using the macros *note PyREFCNT: 6bd. and *note PyTYPE:\n56b.\n\n-- C Type: type PyVarObject\n' Part of the *note Limited API: 2ac.  (Only some members are part\nof the stable ABI.)' This is an extension of *note PyObject: 6b1.\nthat adds the *note obsize: 4899. field.  This is only used for\nobjects that have some notion of 'length'.  This type does not\noften appear in the Python/C API. Access to the members must be\ndone by using the macros *note PyREFCNT: 6bd, *note PyTYPE: 56b,\nand *note PySIZE: 56d.\n\n-- C Macro: PyObjectHEAD\n\nThis is a macro used when declaring new types which represent\nobjects without a varying length.  The PyObjectHEAD macro expands\nto:\n\nPyObject obbase;\n\nSee documentation of *note PyObject: 6b1. above.\n\n-- C Macro: PyObjectVARHEAD\n\nThis is a macro used when declaring new types which represent\nobjects with a length that varies from instance to instance.  The\nPyObjectVARHEAD macro expands to:\n\nPyVarObject obbase;\n\nSee documentation of *note PyVarObject: 3dfd. above.\n\n-- C Function: int PyIs (PyObject *x, PyObject *y)\n' Part of the *note Stable ABI: 2ac. since version 3.10.'  Test if\nthe 'x' object is the 'y' object, the same as 'x is y' in Python.\n\nNew in version 3.10.\n\n-- C Function: int PyIsNone (PyObject *x)\n' Part of the *note Stable ABI: 2ac. since version 3.10.'  Test if\nan object is the 'None' singleton, the same as 'x is None' in\nPython.\n\nNew in version 3.10.\n\n-- C Function: int PyIsTrue (PyObject *x)\n' Part of the *note Stable ABI: 2ac. since version 3.10.'  Test if\nan object is the 'True' singleton, the same as 'x is True' in\nPython.\n\nNew in version 3.10.\n\n-- C Function: int PyIsFalse (PyObject *x)\n' Part of the *note Stable ABI: 2ac. since version 3.10.'  Test if\nan object is the 'False' singleton, the same as 'x is False' in\nPython.\n\nNew in version 3.10.\n\n-- C Function: *note PyTypeObject: 8da. *PyTYPE (PyObject *o)\n\nGet the type of the Python object 'o'.\n\nReturn a *note borrowed reference: 4732.\n\nUse the *note PySETTYPE(): 56c. function to set an object type.\n\nChanged in version 3.11: *note PyTYPE(): 56b. is changed to an\ninline static function.  The parameter type is no longer const\n*note PyObject: 6b1.*.\n\n-- C Function: int PyISTYPE (PyObject *o, PyTypeObject *type)\n\nReturn non-zero if the object 'o' type is 'type'.  Return zero\notherwise.  Equivalent to: 'PyTYPE(o) == type'.\n\nNew in version 3.9.\n\n-- C Function: void PySETTYPE (PyObject *o, PyTypeObject *type)\n\nSet the object 'o' type to 'type'.\n\nNew in version 3.9.\n\n-- C Function: *note Pyssizet: 88d. PySIZE (PyVarObject *o)\n\nGet the size of the Python object 'o'.\n\nUse the *note PySETSIZE(): 56e. function to set an object size.\n\nChanged in version 3.11: *note PySIZE(): 56d. is changed to an\ninline static function.  The parameter type is no longer const\n*note PyVarObject: 3dfd.*.\n\n-- C Function: void PySETSIZE (PyVarObject *o, Pyssizet size)\n\nSet the object 'o' size to 'size'.\n\nNew in version 3.9.\n\n-- C Macro: PyObjectHEADINIT (type)\n\nThis is a macro which expands to initialization values for a new\n*note PyObject: 6b1. type.  This macro expands to:\n\nPyObjectEXTRAINIT\n1, type,\n\n-- C Macro: PyVarObjectHEADINIT (type, size)\n\nThis is a macro which expands to initialization values for a new\n*note PyVarObject: 3dfd. type, including the *note obsize: 4899.\nfield.  This macro expands to:\n\nPyObjectEXTRAINIT\n1, type, size,\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Implementing functions and methods,  Next: Accessing attributes of extension types,  Prev: Base object types and macros,  Up: Common Object Structures": {
            "content": "7.12.2.2 Implementing functions and methods\n...........................................\n\n-- C Type: type PyCFunction\n' Part of the *note Stable ABI: 2ac.'  Type of the functions used\nto implement most Python callables in C. Functions of this type\ntake two *note PyObject: 6b1.* parameters and return one such\nvalue.  If the return value is 'NULL', an exception shall have been\nset.  If not 'NULL', the return value is interpreted as the return\nvalue of the function as exposed in Python.  The function must\nreturn a new reference.\n\nThe function signature is:\n\nPyObject *PyCFunction(PyObject *self,\nPyObject *args);\n\n-- C Type: type PyCFunctionWithKeywords\n' Part of the *note Stable ABI: 2ac.'  Type of the functions used\nto implement Python callables in C with signature *note\nMETHVARARGS | METHKEYWORDS: 4bc0.  The function signature is:\n\nPyObject *PyCFunctionWithKeywords(PyObject *self,\nPyObject *args,\nPyObject *kwargs);\n\n-- C Type: type PyCFunctionFast\n\nType of the functions used to implement Python callables in C with\nsignature *note METHFASTCALL: 157b.  The function signature is:\n\nPyObject *PyCFunctionFast(PyObject *self,\nPyObject *const *args,\nPyssizet nargs);\n\n-- C Type: type PyCFunctionFastWithKeywords\n\nType of the functions used to implement Python callables in C with\nsignature *note METHFASTCALL | METHKEYWORDS: 4bc3.  The function\nsignature is:\n\nPyObject *PyCFunctionFastWithKeywords(PyObject *self,\nPyObject *const *args,\nPyssizet nargs,\nPyObject *kwnames);\n\n-- C Type: type PyCMethod\n\nType of the functions used to implement Python callables in C with\nsignature *note METHMETHOD | METHFASTCALL | METHKEYWORDS: 13de.\nThe function signature is:\n\nPyObject *PyCMethod(PyObject *self,\nPyTypeObject *definingclass,\nPyObject *const *args,\nPyssizet nargs,\nPyObject *kwnames)\n\nNew in version 3.9.\n\n-- C Type: type PyMethodDef\n' Part of the *note Stable ABI: 2ac. (including all members).'\nStructure used to describe a method of an extension type.  This\nstructure has four fields:\n\n-- C Member: const char *mlname\n\nName of the method.\n\n-- C Member: *note PyCFunction: 12cd. mlmeth\n\nPointer to the C implementation.\n\n-- C Member: int mlflags\n\nFlags bits indicating how the call should be constructed.\n\n-- C Member: const char *mldoc\n\nPoints to the contents of the docstring.\n\nThe *note mlmeth: 4bc4. is a C function pointer.  The functions may be\nof different types, but they always return *note PyObject: 6b1.*.  If\nthe function is not of the *note PyCFunction: 12cd, the compiler will\nrequire a cast in the method table.  Even though *note PyCFunction:\n12cd. defines the first parameter as *note PyObject: 6b1.*, it is common\nthat the method implementation uses the specific C type of the 'self'\nobject.\n\nThe *note mlflags: 4bc5. field is a bitfield which can include the\nfollowing flags.  The individual flags indicate either a calling\nconvention or a binding convention.\n\nThere are these calling conventions:\n\n-- C Macro: METHVARARGS\n\nThis is the typical calling convention, where the methods have the\ntype *note PyCFunction: 12cd.  The function expects two *note\nPyObject: 6b1.* values.  The first one is the 'self' object for\nmethods; for module functions, it is the module object.  The second\nparameter (often called 'args') is a tuple object representing all\narguments.  This parameter is typically processed using *note\nPyArgParseTuple(): 2d1. or *note PyArgUnpackTuple(): 1362.\n\n-- C Macro: METHKEYWORDS\n\nCan only be used in certain combinations with other flags: *note\nMETHVARARGS | METHKEYWORDS: 4bc0, *note METHFASTCALL |\nMETHKEYWORDS: 4bc3. and *note METHMETHOD | METHFASTCALL |\nMETHKEYWORDS: 13de.\n\n*note METHVARARGS: 1364. | *note METHKEYWORDS: 46a1.\n\nMethods with these flags must be of type *note\nPyCFunctionWithKeywords: 475f.  The function expects three\nparameters: 'self', 'args', 'kwargs' where 'kwargs' is a dictionary\nof all the keyword arguments or possibly 'NULL' if there are no\nkeyword arguments.  The parameters are typically processed using\n*note PyArgParseTupleAndKeywords(): b68.\n\n-- C Macro: METHFASTCALL\n\nFast calling convention supporting only positional arguments.  The\nmethods have the type *note PyCFunctionFast: 4bc1.  The first\nparameter is 'self', the second parameter is a C array of *note\nPyObject: 6b1.* values indicating the arguments and the third\nparameter is the number of arguments (the length of the array).\n\nNew in version 3.7.\n\nChanged in version 3.10: 'METHFASTCALL' is now part of the *note\nstable ABI: 4747.\n\n*note METHFASTCALL: 157b. | *note METHKEYWORDS: 46a1.\n\nExtension of *note METHFASTCALL: 157b. supporting also keyword\narguments, with methods of type *note PyCFunctionFastWithKeywords:\n4bc2.  Keyword arguments are passed the same way as in the *note\nvectorcall protocol: 2ab.: there is an additional fourth *note\nPyObject: 6b1.* parameter which is a tuple representing the names\nof the keyword arguments (which are guaranteed to be strings) or\npossibly 'NULL' if there are no keywords.  The values of the\nkeyword arguments are stored in the 'args' array, after the\npositional arguments.\n\nNew in version 3.7.\n\n-- C Macro: METHMETHOD\n\nCan only be used in the combination with other flags: *note\nMETHMETHOD | METHFASTCALL | METHKEYWORDS: 13de.\n\n*note METHMETHOD: 792. | *note METHFASTCALL: 157b. | *note METHKEYWORDS: 46a1.\n\nExtension of *note METHFASTCALL | METHKEYWORDS: 4bc3. supporting\nthe 'defining class', that is, the class that contains the method\nin question.  The defining class might be a superclass of\n'PyTYPE(self)'.\n\nThe method needs to be of type *note PyCMethod: 54f, the same as\nfor 'METHFASTCALL | METHKEYWORDS' with 'definingclass' argument\nadded after 'self'.\n\nNew in version 3.9.\n\n-- C Macro: METHNOARGS\n\nMethods without parameters don't need to check whether arguments\nare given if they are listed with the *note METHNOARGS: 132f.\nflag.  They need to be of type *note PyCFunction: 12cd.  The first\nparameter is typically named 'self' and will hold a reference to\nthe module or object instance.  In all cases the second parameter\nwill be 'NULL'.\n\nThe function must have 2 parameters.  Since the second parameter is\nunused, *note PyUNUSED: 147f. can be used to prevent a compiler\nwarning.\n\n-- C Macro: METHO\n\nMethods with a single object argument can be listed with the *note\nMETHO: 1363. flag, instead of invoking *note PyArgParseTuple():\n2d1. with a '\"O\"' argument.  They have the type *note PyCFunction:\n12cd, with the 'self' parameter, and a *note PyObject: 6b1.*\nparameter representing the single argument.\n",
            "subsections": []
        },
        "These two constants are not used to indicate the calling convention but": {
            "content": "the binding when use with methods of classes.  These may not be used for\nfunctions defined for modules.  At most one of these flags may be set\nfor any given method.\n\n-- C Macro: METHCLASS\n\nThe method will be passed the type object as the first parameter\nrather than an instance of the type.  This is used to create 'class\nmethods', similar to what is created when using the *note\nclassmethod(): 246. built-in function.\n\n-- C Macro: METHSTATIC\n\nThe method will be passed 'NULL' as the first parameter rather than\nan instance of the type.  This is used to create 'static methods',\nsimilar to what is created when using the *note staticmethod():\n5cc. built-in function.\n",
            "subsections": []
        },
        "One other constant controls whether a method is loaded in place of": {
            "content": "another definition with the same method name.\n\n-- C Macro: METHCOEXIST\n\nThe method will be loaded in place of existing definitions.\nWithout 'METHCOEXIST', the default is to skip repeated\ndefinitions.  Since slot wrappers are loaded before the method\ntable, the existence of a 'sqcontains' slot, for example, would\ngenerate a wrapped method named *note contains(): 1c63. and\npreclude the loading of a corresponding PyCFunction with the same\nname.  With the flag defined, the PyCFunction will be loaded in\nplace of the wrapper object and will co-exist with the slot.  This\nis helpful because calls to PyCFunctions are optimized more than\nwrapper object calls.\n\n-- C Function: *note PyObject: 6b1. *PyCMethodNew (PyMethodDef *ml,\nPyObject *self, PyObject *module, PyTypeObject *cls)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\nsince version 3.9.'  Turn 'ml' into a Python *note callable: 25e6.\nobject.  The caller must ensure that 'ml' outlives the *note\ncallable: 25e6.  Typically, 'ml' is defined as a static variable.\n\nThe 'self' parameter will be passed as the 'self' argument to the C\nfunction in 'ml->mlmeth' when invoked.  'self' can be 'NULL'.\n\nThe *note callable: 25e6. object's 'module' attribute can be\nset from the given 'module' argument.  'module' should be a Python\nstring, which will be used as name of the module the function is\ndefined in.  If unavailable, it can be set to *note None: 43f. or\n'NULL'.\n\nSee also\n........\n\n*note function.module: 1c1d.\n\nThe 'cls' parameter will be passed as the 'definingclass' argument\nto the C function.  Must be set if *note METHMETHOD: 792. is set\non 'ml->mlflags'.\n\nNew in version 3.9.\n\n-- C Function: *note PyObject: 6b1. *PyCFunctionNewEx (PyMethodDef\n*ml, PyObject *self, PyObject *module)\n'Return value: New reference.''  Part of the *note Stable ABI:\n2ac.'  Equivalent to 'PyCMethodNew(ml, self, module, NULL)'.\n\n-- C Function: *note PyObject: 6b1. *PyCFunctionNew (PyMethodDef *ml,\nPyObject *self)\n'Return value: New reference.''  Part of the *note Stable ABI: 2ac.\nsince version 3.4.'  Equivalent to 'PyCMethodNew(ml, self, NULL,\nNULL)'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Accessing attributes of extension types,  Prev: Implementing functions and methods,  Up: Common Object Structures": {
            "content": "7.12.2.3 Accessing attributes of extension types\n................................................\n\n-- C Type: type PyMemberDef\n' Part of the *note Stable ABI: 2ac. (including all members).'\nStructure which describes an attribute of a type which corresponds\nto a C struct member.  When defining a class, put a NULL-terminated\narray of these structures in the *note tpmembers: 46d3. slot.\n\nIts fields are, in order:\n\n-- C Member: const char *name\n\nName of the member.  A NULL value marks the end of a\n'PyMemberDef[]' array.\n\nThe string should be static, no copy is made of it.\n\n-- C Member: int type\n\nThe type of the member in the C struct.  See *note Member\ntypes: 13c4. for the possible values.\n\n-- C Member: *note Pyssizet: 88d. offset\n\nThe offset in bytes that the member is located on the type's\nobject struct.\n\n-- C Member: int flags\n\nZero or more of the *note Member flags: 4bca, combined using\nbitwise OR.\n\n-- C Member: const char *doc\n\nThe docstring, or NULL. The string should be static, no copy\nis made of it.  Typically, it is defined using *note\nPyDocSTR: 1569.\n\nBy default (when *note flags: 46ed. is '0'), members allow both\nread and write access.  Use the *note PyREADONLY: 31d. flag for\nread-only access.  Certain types, like *note PyTSTRING: 4bcc,\nimply *note PyREADONLY: 31d.  Only *note PyTOBJECTEX: 320. (and\nlegacy *note TOBJECT: 31f.) members can be deleted.  For\nheap-allocated types (created using *note PyTypeFromSpec(): 2df.\nor similar), 'PyMemberDef' may contain a definition for the special\nmember '\"vectorcalloffset\"', corresponding to *note\ntpvectorcalloffset: 4953. in type objects.  These must be defined\nwith 'PyTPYSSIZET' and 'PyREADONLY', for example:\n\nstatic PyMemberDef spamtypemembers[] = {\n{\"vectorcalloffset\", PyTPYSSIZET,\noffsetof(Spamobject, vectorcall), PyREADONLY},\n{NULL}  /* Sentinel */\n};\n\n(You may need to '#include <stddef.h>' for 'offsetof()'.)\n\nThe legacy offsets *note tpdictoffset: 49b3. and *note\ntpweaklistoffset: 7ac. can be defined similarly using\n'\"dictoffset\"' and '\"weaklistoffset\"' members, but\nextensions are strongly encouraged to use *note\nPyTPFLAGSMANAGEDDICT: 2b4. and *note PyTPFLAGSMANAGEDWEAKREF:\n2b5. instead.\n\nChanged in version 3.12: 'PyMemberDef' is always available.\nPreviously, it required including '\"structmember.h\"'.\n\n-- C Function: *note PyObject: 6b1. *PyMemberGetOne (const char\n*objaddr, struct PyMemberDef *m)\n' Part of the *note Stable ABI: 2ac.'  Get an attribute belonging\nto the object at address 'objaddr'.  The attribute is described by\n'PyMemberDef' 'm'.  Returns 'NULL' on error.\n\nChanged in version 3.12: 'PyMemberGetOne' is always available.\nPreviously, it required including '\"structmember.h\"'.\n\n-- C Function: int PyMemberSetOne (char *objaddr, struct PyMemberDef\n*m, PyObject *o)\n' Part of the *note Stable ABI: 2ac.'  Set an attribute belonging\nto the object at address 'objaddr' to object 'o'.  The attribute\nto set is described by 'PyMemberDef' 'm'.  Returns '0' if\nsuccessful and a negative value on failure.\n\nChanged in version 3.12: 'PyMemberSetOne' is always available.\nPreviously, it required including '\"structmember.h\"'.\n\n* Menu:\n\n* Member flags::\n* Member types::\n* Defining Getters and Setters::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Member flags,  Next: Member types,  Up: Accessing attributes of extension types": {
            "content": "7.12.2.4 Member flags\n.....................\n\nThe following flags can be used with *note PyMemberDef.flags: 46ed.:\n\n-- C Macro: PyREADONLY\n\nNot writable.\n\n-- C Macro: PyAUDITREAD\n\nEmit an 'object.getattr' *note audit event: 15d2. before\nreading.\n\n-- C Macro: PyRELATIVEOFFSET\n\nIndicates that the *note offset: 4bc9. of this 'PyMemberDef' entry\nindicates an offset from the subclass-specific data, rather than\nfrom 'PyObject'.\n\nCan only be used as part of *note Pytpmembers: 46d3. *note slot:\n485e. when creating a class using negative *note basicsize: 2a0.\nIt is mandatory in that case.\n\nThis flag is only used in *note PyTypeSlot: 485e.  When setting\n*note tpmembers: 46d3. during class creation, Python clears it and\nsets *note PyMemberDef.offset: 4bc9. to the offset from the\n'PyObject' struct.\n",
            "subsections": []
        },
        "Changed in version 3.10: The 'RESTRICTED', 'READRESTRICTED' and": {
            "content": "'WRITERESTRICTED' macros available with '#include \"structmember.h\"' are\ndeprecated.  'READRESTRICTED' and 'RESTRICTED' are equivalent to *note\nPyAUDITREAD: 31e.; 'WRITERESTRICTED' does nothing.\n\nChanged in version 3.12: The 'READONLY' macro was renamed to *note",
            "subsections": []
        },
        "PyREADONLY: 31d.  The 'PYAUDITREAD' macro was renamed with the 'Py'": {
            "content": "prefix.  The new names are now always available.  Previously, these\nrequired '#include \"structmember.h\"'.  The header is still available and\nit provides the old names.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Member types,  Next: Defining Getters and Setters,  Prev: Member flags,  Up: Accessing attributes of extension types": {
            "content": "7.12.2.5 Member types\n.....................\n\n*note PyMemberDef.type: 46ec. can be one of the following macros\ncorresponding to various C types.  When the member is accessed in",
            "subsections": []
        },
        "Python, it will be converted to the equivalent Python type.  When it is": {
            "content": "set from Python, it will be converted back to the C type.  If that is\nnot possible, an exception such as *note TypeError: 28e. or *note\nValueError: 183. is raised.\n",
            "subsections": []
        },
        "Unless marked (D), attributes defined this way cannot be deleted using": {
            "content": "e.g.  *note del: 14fb. or *note delattr(): 1e5c.\n",
            "subsections": []
        },
        "Macro name                           C type                            Python type": {
            "content": "--------------------------------------------------------------------------------------------------\n\n-- C Macro: PyTBYTE               char                              *note int: 17e.\n\n\n-- C Macro: PyTSHORT              short                             *note int: 17e.\n\n\n-- C Macro: PyTINT                int                               *note int: 17e.\n\n\n-- C Macro: PyTLONG               long                              *note int: 17e.\n\n\n-- C Macro: PyTLONGLONG           long long                         *note int: 17e.\n\n\n-- C Macro: PyTUBYTE              unsigned char                     *note int: 17e.\n\n\n-- C Macro: PyTUINT               unsigned int                      *note int: 17e.\n\n\n-- C Macro: PyTUSHORT             unsigned short                    *note int: 17e.\n\n\n-- C Macro: PyTULONG              unsigned long                     *note int: 17e.\n\n\n-- C Macro: PyTULONGLONG          unsigned long long                *note int: 17e.\n\n\n-- C Macro: PyTPYSSIZET           *note Pyssizet: 88d.            *note int: 17e.\n\n\n-- C Macro: PyTFLOAT              float                             *note float: 4b7.\n\n\n-- C Macro: PyTDOUBLE             double                            *note float: 4b7.\n\n\n-- C Macro: PyTBOOL               char (written as 0 or 1)          *note bool: 17d.\n\n\n-- C Macro: PyTSTRING             const char* (*)                   *note str: 157. (RO)\n\n\n-- C Macro: PyTSTRINGINPLACE     const char[] (*)                  *note str: 157. (RO)\n\n\n-- C Macro: PyTCHAR               char (0-127)                      *note str: 157. ()\n\n\n-- C Macro: PyTOBJECTEX          *note PyObject: 6b1.*             *note object: 8bb. (D)\n\n\n(*): Zero-terminated, UTF8-encoded C string.  With 'PyTSTRING'\nthe C representation is a pointer; with 'PyTSTRINGINPLACE' the\nstring is stored directly in the structure.\n\n(): String of length 1.  Only ASCII is accepted.\n\n(RO): Implies *note PyREADONLY: 31d.\n\n(D): Can be deleted, in which case the pointer is set to 'NULL'.\nReading a 'NULL' pointer raises *note AttributeError: 395.\n",
            "subsections": []
        },
        "New in version 3.12: In previous versions, the macros were only": {
            "content": "available with '#include \"structmember.h\"' and were named without the\n'Py' prefix (e.g.  as 'TINT').  The header is still available and\ncontains the old names, along with the following deprecated types:\n\n-- C Macro: TOBJECT\n\nLike 'PyTOBJECTEX', but 'NULL' is converted to 'None'.  This\nresults in surprising behavior in Python: deleting the attribute\neffectively sets it to 'None'.\n\n-- C Macro: TNONE\n\nAlways 'None'.  Must be used with *note PyREADONLY: 31d.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Defining Getters and Setters,  Prev: Member types,  Up: Accessing attributes of extension types": {
            "content": "7.12.2.6 Defining Getters and Setters\n.....................................\n\n-- C Type: type PyGetSetDef\n' Part of the *note Stable ABI: 2ac. (including all members).'\nStructure to define property-like access for a type.  See also\ndescription of the *note PyTypeObject.tpgetset: 46d8. slot.\n\n-- C Member: const char *name\n\nattribute name\n\n-- C Member: *note getter: 48b5. get\n\nC function to get the attribute.\n\n-- C Member: *note setter: 48c3. set\n\nOptional C function to set or delete the attribute.  If\n'NULL', the attribute is read-only.\n\n-- C Member: const char *doc\n\noptional docstring\n\n-- C Member: void *closure\n\nOptional user data pointer, providing additional data for\ngetter and setter.\n\n-- C Type: typedef *note PyObject: 6b1. *(*getter)(*note PyObject:\n6b1.*, void*)\n' Part of the *note Stable ABI: 2ac.'  The 'get' function takes one\n*note PyObject: 6b1.* parameter (the instance) and a user data\npointer (the associated 'closure'):\n\nIt should return a new reference on success or 'NULL' with a set\nexception on failure.\n\n-- C Type: typedef int (*setter)(*note PyObject: 6b1.*, *note PyObject:\n6b1.*, void*)\n' Part of the *note Stable ABI: 2ac.'  'set' functions take two\n*note PyObject: 6b1.* parameters (the instance and the value to be\nset) and a user data pointer (the associated 'closure'):\n\nIn case the attribute should be deleted the second parameter is\n'NULL'.  Should return '0' on success or '-1' with a set exception\non failure.\n\nFile: python3.12.info,  Node: Type Objects<3>,  Next: Number Object Structures,  Prev: Common Object Structures,  Up: Object Implementation Support\n\n",
            "subsections": []
        },
        "Perhaps one of the most important structures of the Python object system": {
            "content": "is the structure that defines a new type: the *note PyTypeObject: 8da.\nstructure.  Type objects can be handled using any of the 'PyObject*' or\n'PyType*' functions, but do not offer much that's interesting to most",
            "subsections": []
        },
        "Python applications.  These objects are fundamental to how objects": {
            "content": "behave, so they are very important to the interpreter itself and to any\nextension module that implements new types.\n\nType objects are fairly large compared to most of the standard types.",
            "subsections": []
        },
        "The reason for the size is that each type object stores a large number": {
            "content": "of values, mostly C function pointers, each of which implements a small\npart of the type's functionality.  The fields of the type object are\nexamined in detail in this section.  The fields will be described in the\norder in which they occur in the structure.\n\nIn addition to the following quick reference, the *note Examples: 4be5.\nsection provides at-a-glance insight into the meaning and use of *note\nPyTypeObject: 8da.\n\n* Menu:\n\n* Quick Reference::\n* PyTypeObject Definition::\n* PyObject Slots::\n* PyVarObject Slots::\n* PyTypeObject Slots::\n* Static Types::\n* Heap Types::\n\nFile: python3.12.info,  Node: Quick Reference,  Next: PyTypeObject Definition,  Up: Type Objects<3>\n\n7.12.3.1 Quick Reference\n........................\n\n* Menu:\n\n* \"tp slots\"::\n* sub-slots::\n* slot typedefs::\n\nFile: python3.12.info,  Node: \"tp slots\",  Next: sub-slots,  Up: Quick Reference\n\n7.12.3.2 \"tp slots\"\n...................\n\nPyTypeObject Slot      *note Type: 4be9.      special                Info\n(1)                                           methods/attrs          (2)\n\n---------------------------------------------------------------------------------------------\n\nO                      T                      D                      I\n\n\n<R>                    const char *           name               X     X\n*note tpname: 1657.\n\n*note tpbasicsize: 7ab.*note Pyssizet: 88d.                       X     X           X\n\n\n*note tpitemsize: 1c77.*note Pyssizet: 88d.                             X           X\n\n\n*note tpdealloc: 46d0.*note destructor: 48b0.                       X     X           X\n\n\n*note tpvectorcalloffset: 4953.*note Pyssizet: 88d.                    X           X\n\n\n(*note tpgetattr: 46ef.)*note getattrfunc: 48b1.getattribute,                     G\ngetattr\n\n\n(*note tpsetattr: 46f0.)*note setattrfunc: 48c1.setattr,                          G\ndelattr\n\n\n*note tpasasync: d34.*note PyAsyncMethods: 49b1.*note sub-slots: 4bea.               %\n*\n\n\n*note tprepr: 46e5.   *note reprfunc: 48bf.  repr               X     X           X\n\n\n*note tpasnumber: 7af.*note PyNumberMethods: 1274.*note sub-slots: 4bea.             %\n*\n\n\n*note tpassequence: 4beb.*note PySequenceMethods: 46f6.*note sub-slots: 4bea.        %\n*\n\n\n*note tpasmapping: 4bec.*note PyMappingMethods: 46f7.*note sub-slots: 4bea.          %\n*\n\n\n*note tphash: 46f8.   *note hashfunc: 48b6.  hash               X                 G\n\n\n*note tpcall: 2b3.    *note ternaryfunc: 48c6.call                    X           X\n\n\n*note tpstr: 46e6.    *note reprfunc: 48bf.  str                X                 X\n\n\n*note tpgetattro: 46e9.*note getattrofunc: 48b2.getattribute,   X     X           G\ngetattr\n\n\n*note tpsetattro: 46ea.*note setattrofunc: 48c2.setattr,        X     X           G\ndelattr\n\n\n*note tpasbuffer: 7ad.*note PyBufferProcs: 49b9.                                     %\n*\n\n\n*note tpflags: 1620.  unsigned long                                 X     X           ?\n\n\n*note tpdoc: 46cc.    const char *           doc                X     X\n\n\n*note tptraverse: 569.*note traverseproc: 48c7.                           X           G\n\n\n*note tpclear: 46e3.  *note inquiry: 48b8.                                X           G\n\n\n*note tprichcompare: 46f2.*note richcmpfunc: 48c0.lt, le,   X                 G\neq, ne,\ngt, ge\n\n\n(*note tpweaklistoffset: 7ac.)*note Pyssizet: 88d.                      X           ?\n\n\n*note tpiter: 1348.   *note getiterfunc: 48b4.iter                                X\n\n\n*note tpiternext: 1349.*note iternextfunc: 48b9.next                              X\n\n\n*note tpmethods: 46d5.*note PyMethodDef: 1332.                      X     X\n[]\n\n\n*note tpmembers: 46d3.*note PyMemberDef: 2a7.                             X\n[]\n\n\n*note tpgetset: 46d8. *note PyGetSetDef: 9fc.                       X     X\n[]\n\n\n*note tpbase: 46dc.   *note PyTypeObject: 8da.base                          X\n*\n\n\n*note tpdict: 1443.   *note PyObject: 6b1.   dict                           ?\n*\n\n\n*note tpdescrget: 4bed.*note descrgetfunc: 48ae.get                              X\n\n\n*note tpdescrset: 165b.*note descrsetfunc: 48af.set, delete                  X\n\n\n(*note tpdictoffset: 49b3.)*note Pyssizet: 88d.                         X           ?\n\n\n*note tpinit: 2e3.    *note initproc: 48b7.  init               X     X           X\n\n\n*note tpalloc: 46d2.  *note allocfunc: 48ac.                        X           ?     ?\n\n\n*note tpnew: 2e1.     *note newfunc: 48bb.   new                X     X     ?     ?\n\n\n*note tpfree: 46d1.   *note freefunc: 4aa0.                         X     X     ?     ?\n\n\n*note tpisgc: 4bee.  *note inquiry: 48b8.                                X           X\n\n\n<*note tpbases: 4bef.>*note PyObject: 6b1.   bases                          ~\n*\n\n\n<*note tpmro: 49b6.>  *note PyObject: 6b1.   mro                            ~\n*\n\n\n[*note tpcache: 49b7.]*note PyObject: 6b1.\n*\n\n\n[*note tpsubclasses: 2d2.]void *             subclasses\n\n\n[*note tpweaklist: 49b8.]*note PyObject: 6b1.\n*\n\n\n(*note tpdel: 4bf0.)  *note destructor: 48b0.\n\n\n[*note tpversiontag: 4bf1.]unsigned int\n\n\n*note tpfinalize: 8db.*note destructor: 48b0.del                                  X\n\n\n*note tpvectorcall: 49b5.*note vectorcallfunc: 2b0.\n\n\n[*note tpwatched: 4bf2.]unsigned char\n\n\n---------- Footnotes ----------\n\n(1) '()': A slot name in parentheses indicates it is (effectively)\ndeprecated.\n\n'<>': Names in angle brackets should be initially set to 'NULL' and\ntreated as read-only.\n\n'[]': Names in square brackets are for internal use only.\n\n'<R>' (as a prefix) means the field is required (must be non-'NULL').\n\n(2) Columns:\n\n'\"O\"': set on 'PyBaseObjectType'\n\n'\"T\"': set on *note PyTypeType: 2a5.\n\n'\"D\"': default (if slot is set to 'NULL')\n\nX - PyTypeReady sets this value if it is NULL\n~ - PyTypeReady always sets this value (it should be NULL)\n? - PyTypeReady may set this value depending on other slots\n\nAlso see the inheritance column (\"I\").\n\n'\"I\"': inheritance\n\nX - type slot is inherited via *PyTypeReady* if defined with a *NULL* value\n% - the slots of the sub-struct are inherited individually\nG - inherited, but only in combination with other slots; see the slot's description\n? - it's complicated; see the slot's description\n",
            "subsections": []
        },
        "Note that some slots are effectively inherited through the normal": {
            "content": "attribute lookup chain.\n\nFile: python3.12.info,  Node: sub-slots,  Next: slot typedefs,  Prev: \"tp slots\",  Up: Quick Reference\n\n7.12.3.3 sub-slots\n..................\n\nSlot                           *note Type: 4be9.     special\nmethods\n\n----------------------------------------------------------------------\n\n*note amawait: 4bf4.          *note unaryfunc: 48c8.await\n\n\n*note amaiter: 4bf5.          *note unaryfunc: 48c8.aiter\n\n\n*note amanext: 4bf6.          *note unaryfunc: 48c8.anext\n\n\n*note amsend: 4bf7.           *note sendfunc: 4bf8.\n\n\n\n*note nbadd: 49aa.            *note binaryfunc: 48ad.add\nradd\n\n\n*note nbinplaceadd: 4bf9.    *note binaryfunc: 48ad.iadd\n\n\n*note nbsubtract: 4bfa.       *note binaryfunc: 48ad.sub\nrsub\n\n\n*note nbinplacesubtract: 4bfb.*note binaryfunc: 48ad.isub\n\n\n*note nbmultiply: 4bfc.       *note binaryfunc: 48ad.mul\nrmul\n\n\n*note nbinplacemultiply: 4bfd.*note binaryfunc: 48ad.imul\n\n\n*note nbremainder: 4bfe.      *note binaryfunc: 48ad.mod\nrmod\n\n\n*note nbinplaceremainder: 4bff.*note binaryfunc: 48ad.imod\n\n\n*note nbdivmod: 4c00.         *note binaryfunc: 48ad.divmod\nrdivmod\n\n\n*note nbpower: 4c01.          *note ternaryfunc: 48c6.pow\nrpow\n\n\n*note nbinplacepower: 4c02.  *note ternaryfunc: 48c6.ipow\n\n\n*note nbnegative: 4c03.       *note unaryfunc: 48c8.neg\n\n\n*note nbpositive: 4c04.       *note unaryfunc: 48c8.pos\n\n\n*note nbabsolute: 4c05.       *note unaryfunc: 48c8.abs\n\n\n*note nbbool: 4c06.           *note inquiry: 48b8.  bool\n\n\n*note nbinvert: 4c07.         *note unaryfunc: 48c8.invert\n\n\n*note nblshift: 4c08.         *note binaryfunc: 48ad.lshift\nrlshift\n\n\n*note nbinplacelshift: 4c09. *note binaryfunc: 48ad.ilshift\n\n\n*note nbrshift: 4c0a.         *note binaryfunc: 48ad.rshift\nrrshift\n\n\n*note nbinplacershift: 4c0b. *note binaryfunc: 48ad.irshift\n\n\n*note nband: 4c0c.            *note binaryfunc: 48ad.and\nrand\n\n\n*note nbinplaceand: 4c0d.    *note binaryfunc: 48ad.iand\n\n\n*note nbxor: 4c0e.            *note binaryfunc: 48ad.xor\nrxor\n\n\n*note nbinplacexor: 4c0f.    *note binaryfunc: 48ad.ixor\n\n\n*note nbor: 4c10.             *note binaryfunc: 48ad.or ror\n\n\n*note nbinplaceor: 4c11.     *note binaryfunc: 48ad.ior\n\n\n*note nbint: 4c12.            *note unaryfunc: 48c8.int\n\n\n*note nbreserved: 4c13.       void *\n\n\n*note nbfloat: 4c14.          *note unaryfunc: 48c8.float\n\n\n*note nbfloordivide: 4c15.   *note binaryfunc: 48ad.floordiv\n\n\n*note nbinplacefloordivide: 4c16.*note binaryfunc: 48ad.ifloordiv\n\n\n*note nbtruedivide: 4c17.    *note binaryfunc: 48ad.truediv\n\n\n*note nbinplacetruedivide: 4c18.*note binaryfunc: 48ad.itruediv\n\n\n*note nbindex: 1273.          *note unaryfunc: 48c8.index\n\n\n*note nbmatrixmultiply: 4c19.*note binaryfunc: 48ad.matmul\nrmatmul\n\n\n*note nbinplacematrixmultiply: 4c1a.*note binaryfunc: 48ad.imatmul\n\n\n\n*note mplength: 4c1b.         *note lenfunc: 48ba.  len\n\n\n*note mpsubscript: 1693.      *note binaryfunc: 48ad.getitem\n\n\n*note mpasssubscript: 4c1c.  *note objobjargproc: 48bc.setitem,\ndelitem\n\n\n\n*note sqlength: 49b2.         *note lenfunc: 48ba.  len\n\n\n*note sqconcat: 4c1d.         *note binaryfunc: 48ad.add\n\n\n*note sqrepeat: 4c1e.         *note ssizeargfunc: 48c4.mul\n\n\n*note sqitem: 1692.           *note ssizeargfunc: 48c4.getitem\n\n\n*note sqassitem: 4c1f.       *note ssizeobjargproc: 48c5.setitem\ndelitem\n\n\n*note sqcontains: 4c20.       *note objobjproc: 48bd.contains\n\n\n*note sqinplaceconcat: 4c21. *note binaryfunc: 48ad.iadd\n\n\n*note sqinplacerepeat: 4c22. *note ssizeargfunc: 48c4.imul\n\n\n\n*note bfgetbuffer: 54c.       *note getbufferproc(): 48b3.\n\n\n*note bfreleasebuffer: 54d.   *note releasebufferproc(): 48be.\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: slot typedefs,  Prev: sub-slots,  Up: Quick Reference": {
            "content": "7.12.3.4 slot typedefs\n......................\n\ntypedef                           Parameter Types                   Return Type\n\n-----------------------------------------------------------------------------------------------\n\n*note allocfunc: 48ac.                 *note PyTypeObject: 8da. *   *note PyObject: 6b1. *\n*note Pyssizet: 88d.\n\n\n*note destructor: 48b0.           *note PyObject: 6b1. *            void\n\n\n*note freefunc: 4aa0.             void *                            void\n\n\n*note traverseproc: 48c7.              *note PyObject: 6b1. *       int\n*note visitproc: 48c9.\nvoid *\n\n\n*note newfunc: 48bb.                   *note PyObject: 6b1. *       *note PyObject: 6b1. *\n*note PyObject: 6b1. *\n*note PyObject: 6b1. *\n\n\n*note initproc: 48b7.                  *note PyObject: 6b1. *       int\n*note PyObject: 6b1. *\n*note PyObject: 6b1. *\n\n\n*note reprfunc: 48bf.             *note PyObject: 6b1. *            *note PyObject: 6b1. *\n\n\n*note getattrfunc: 48b1.               *note PyObject: 6b1. *       *note PyObject: 6b1. *\nconst char *\n\n\n*note setattrfunc: 48c1.               *note PyObject: 6b1. *       int\nconst char *\n*note PyObject: 6b1. *\n\n\n*note getattrofunc: 48b2.              *note PyObject: 6b1. *       *note PyObject: 6b1. *\n*note PyObject: 6b1. *\n\n\n*note setattrofunc: 48c2.              *note PyObject: 6b1. *       int\n*note PyObject: 6b1. *\n*note PyObject: 6b1. *\n\n\n*note descrgetfunc: 48ae.              *note PyObject: 6b1. *       *note PyObject: 6b1. *\n*note PyObject: 6b1. *\n*note PyObject: 6b1. *\n\n\n*note descrsetfunc: 48af.              *note PyObject: 6b1. *       int\n*note PyObject: 6b1. *\n*note PyObject: 6b1. *\n\n\n*note hashfunc: 48b6.             *note PyObject: 6b1. *            Pyhasht\n\n\n*note richcmpfunc: 48c0.               *note PyObject: 6b1. *       *note PyObject: 6b1. *\n*note PyObject: 6b1. *\nint\n\n\n*note getiterfunc: 48b4.          *note PyObject: 6b1. *            *note PyObject: 6b1. *\n\n\n*note iternextfunc: 48b9.         *note PyObject: 6b1. *            *note PyObject: 6b1. *\n\n\n*note lenfunc: 48ba.              *note PyObject: 6b1. *            *note Pyssizet: 88d.\n\n\n*note getbufferproc: 48b3.             *note PyObject: 6b1. *       int\n*note Pybuffer: 53f. *\nint\n\n\n*note releasebufferproc: 48be.         *note PyObject: 6b1. *       void\n*note Pybuffer: 53f. *\n\n\n*note inquiry: 48b8.              *note PyObject: 6b1. *            int\n\n\n*note unaryfunc: 48c8.                 *note PyObject: 6b1. *       *note PyObject: 6b1. *\n\n\n*note binaryfunc: 48ad.                *note PyObject: 6b1. *       *note PyObject: 6b1. *\n*note PyObject: 6b1. *\n\n\n*note ternaryfunc: 48c6.               *note PyObject: 6b1. *       *note PyObject: 6b1. *\n*note PyObject: 6b1. *\n*note PyObject: 6b1. *\n\n\n*note ssizeargfunc: 48c4.              *note PyObject: 6b1. *       *note PyObject: 6b1. *\n*note Pyssizet: 88d.\n\n\n*note ssizeobjargproc: 48c5.           *note PyObject: 6b1. *       int\n*note Pyssizet: 88d.\n*note PyObject: 6b1. *\n\n\n*note objobjproc: 48bd.                *note PyObject: 6b1. *       int\n*note PyObject: 6b1. *\n\n\n*note objobjargproc: 48bc.             *note PyObject: 6b1. *       int\n*note PyObject: 6b1. *\n*note PyObject: 6b1. *\n\n\nSee *note Slot Type typedefs: 4c24. below for more detail.\n\nFile: python3.12.info,  Node: PyTypeObject Definition,  Next: PyObject Slots,  Prev: Quick Reference,  Up: Type Objects<3>\n\n7.12.3.5 PyTypeObject Definition\n................................\n\nThe structure definition for *note PyTypeObject: 8da. can be found in\n'Include/object.h'.  For convenience of reference, this repeats the\ndefinition found there:\n\ntypedef struct typeobject {\nPyObjectVARHEAD\nconst char *tpname; /* For printing, in format \"<module>.<name>\" */\nPyssizet tpbasicsize, tpitemsize; /* For allocation */\n\n/* Methods to implement standard operations */\n\ndestructor tpdealloc;\nPyssizet tpvectorcalloffset;\ngetattrfunc tpgetattr;\nsetattrfunc tpsetattr;\nPyAsyncMethods *tpasasync; /* formerly known as tpcompare (Python 2)\nor tpreserved (Python 3) */\nreprfunc tprepr;\n\n/* Method suites for standard classes */\n\nPyNumberMethods *tpasnumber;\nPySequenceMethods *tpassequence;\nPyMappingMethods *tpasmapping;\n\n/* More standard operations (here for binary compatibility) */\n\nhashfunc tphash;\nternaryfunc tpcall;\nreprfunc tpstr;\ngetattrofunc tpgetattro;\nsetattrofunc tpsetattro;\n\n/* Functions to access object as input/output buffer */\nPyBufferProcs *tpasbuffer;\n\n/* Flags to define presence of optional/expanded features */\nunsigned long tpflags;\n\nconst char *tpdoc; /* Documentation string */\n\n/* Assigned meaning in release 2.0 */\n/* call function for all accessible objects */\ntraverseproc tptraverse;\n\n/* delete references to contained objects */\ninquiry tpclear;\n\n/* Assigned meaning in release 2.1 */\n/* rich comparisons */\nrichcmpfunc tprichcompare;\n\n/* weak reference enabler */\nPyssizet tpweaklistoffset;\n\n/* Iterators */\ngetiterfunc tpiter;\niternextfunc tpiternext;\n\n/* Attribute descriptor and subclassing stuff */\nstruct PyMethodDef *tpmethods;\nstruct PyMemberDef *tpmembers;\nstruct PyGetSetDef *tpgetset;\n// Strong reference on a heap type, borrowed reference on a static type\nstruct typeobject *tpbase;\nPyObject *tpdict;\ndescrgetfunc tpdescrget;\ndescrsetfunc tpdescrset;\nPyssizet tpdictoffset;\ninitproc tpinit;\nallocfunc tpalloc;\nnewfunc tpnew;\nfreefunc tpfree; /* Low-level free-memory routine */\ninquiry tpisgc; /* For PyObjectISGC */\nPyObject *tpbases;\nPyObject *tpmro; /* method resolution order */\nPyObject *tpcache;\nPyObject *tpsubclasses;\nPyObject *tpweaklist;\ndestructor tpdel;\n\n/* Type attribute cache version tag. Added in version 2.6 */\nunsigned int tpversiontag;\n\ndestructor tpfinalize;\nvectorcallfunc tpvectorcall;\n\n/* bitset of which type-watchers care about this type */\nunsigned char tpwatched;\n} PyTypeObject;\n\nFile: python3.12.info,  Node: PyObject Slots,  Next: PyVarObject Slots,  Prev: PyTypeObject Definition,  Up: Type Objects<3>\n\n7.12.3.6 PyObject Slots\n.......................\n\nThe type object structure extends the *note PyVarObject: 3dfd.\nstructure.  The *note obsize: 4899. field is used for dynamic types\n(created by 'typenew()', usually called from a class statement).  Note\nthat *note PyTypeType: 2a5. (the metatype) initializes *note\ntpitemsize: 1c77, which means that its instances (i.e.  type objects)\n'must' have the *note obsize: 4899. field.\n\n-- C Member: *note Pyssizet: 88d. *note PyObject: 6b1.obrefcnt\n' Part of the *note Stable ABI: 2ac.'  This is the type object's\nreference count, initialized to '1' by the 'PyObjectHEADINIT'\nmacro.  Note that for *note statically allocated type objects: 56a,\nthe type's instances (objects whose *note obtype: 46ce. points\nback to the type) do 'not' count as references.  But for *note\ndynamically allocated type objects: 786, the instances 'do' count\nas references.\n\n'Inheritance:'\n\nThis field is not inherited by subtypes.\n\n-- C Member: *note PyTypeObject: 8da. note PyObject: 6b1.obtype\n' Part of the *note Stable ABI: 2ac.'  This is the type's type, in\nother words its metatype.  It is initialized by the argument to the\n'PyObjectHEADINIT' macro, and its value should normally be\n'&PyTypeType'.  However, for dynamically loadable extension\nmodules that must be usable on Windows (at least), the compiler\ncomplains that this is not a valid initializer.  Therefore, the\nconvention is to pass 'NULL' to the 'PyObjectHEADINIT' macro and\nto initialize this field explicitly at the start of the module's\ninitialization function, before doing anything else.  This is\ntypically done like this:\n\nFooType.obtype = &PyTypeType;\n\nThis should be done before any instances of the type are created.\n*note PyTypeReady(): 567. checks if *note obtype: 46ce. is\n'NULL', and if so, initializes it to the *note obtype: 46ce. field\nof the base class.  *note PyTypeReady(): 567. will not change this\nfield if it is non-zero.\n\n'Inheritance:'\n\nThis field is inherited by subtypes.\n\n-- C Member: *note PyObject: 6b1. note PyObject: 6b1.obnext\n-- C Member: *note PyObject: 6b1. note PyObject: 6b1.obprev\n\nThese fields are only present when the macro 'PyTRACEREFS' is\ndefined (see the *note configure -with-trace-refs option: 6b2.).\n\nTheir initialization to 'NULL' is taken care of by the\n'PyObjectHEADINIT' macro.  For *note statically allocated\nobjects: 56a, these fields always remain 'NULL'.  For *note\ndynamically allocated objects: 786, these two fields are used to\nlink the object into a doubly linked list of 'all' live objects on\nthe heap.\n\nThis could be used for various debugging purposes; currently the\nonly uses are the 'sys.getobjects()' function and to print the\nobjects that are still alive at the end of a run when the\nenvironment variable *note PYTHONDUMPREFS: 7ca. is set.\n\n'Inheritance:'\n\nThese fields are not inherited by subtypes.\n\nFile: python3.12.info,  Node: PyVarObject Slots,  Next: PyTypeObject Slots,  Prev: PyObject Slots,  Up: Type Objects<3>\n\n7.12.3.7 PyVarObject Slots\n..........................\n\n-- C Member: *note Pyssizet: 88d. *note PyVarObject: 3dfd.obsize\n' Part of the *note Stable ABI: 2ac.'  For *note statically\nallocated type objects: 56a, this should be initialized to zero.\nFor *note dynamically allocated type objects: 786, this field has a\nspecial internal meaning.\n\n'Inheritance:'\n\nThis field is not inherited by subtypes.\n\nFile: python3.12.info,  Node: PyTypeObject Slots,  Next: Static Types,  Prev: PyVarObject Slots,  Up: Type Objects<3>\n\n7.12.3.8 PyTypeObject Slots\n...........................\n\nEach slot has a section describing inheritance.  If *note",
            "subsections": []
        },
        "PyTypeReady(): 567. may set a value when the field is set to 'NULL'": {
            "content": "then there will also be a \"Default\" section.  (Note that many fields set\non 'PyBaseObjectType' and *note PyTypeType: 2a5. effectively act as\ndefaults.)\n\n-- C Member: const char note PyTypeObject: 8da.tpname\n\nPointer to a NUL-terminated string containing the name of the type.\nFor types that are accessible as module globals, the string should\nbe the full module name, followed by a dot, followed by the type\nname; for built-in types, it should be just the type name.  If the\nmodule is a submodule of a package, the full package name is part\nof the full module name.  For example, a type named 'T' defined in\nmodule 'M' in subpackage 'Q' in package 'P' should have the *note\ntpname: 1657. initializer '\"P.Q.M.T\"'.\n\nFor *note dynamically allocated type objects: 786, this should just\nbe the type name, and the module name explicitly stored in the type\ndict as the value for key ''module''.\n\nFor *note statically allocated type objects: 56a, the 'tpname'\nfield should contain a dot.  Everything before the last dot is made\naccessible as the 'module' attribute, and everything after the\nlast dot is made accessible as the *note name: 1302. attribute.\n\nIf no dot is present, the entire *note tpname: 1657. field is made\naccessible as the *note name: 1302. attribute, and the\n'module' attribute is undefined (unless explicitly set in the\ndictionary, as explained above).  This means your type will be\nimpossible to pickle.  Additionally, it will not be listed in\nmodule documentations created with pydoc.\n\nThis field must not be 'NULL'.  It is the only required field in\n*note PyTypeObject(): 8da. (other than potentially *note\ntpitemsize: 1c77.).\n\n'Inheritance:'\n\nThis field is not inherited by subtypes.\n\n-- C Member: *note Pyssizet: 88d. *note PyTypeObject:\n8da.tpbasicsize\n-- C Member: *note Pyssizet: 88d. *note PyTypeObject: 8da.tpitemsize\n\nThese fields allow calculating the size in bytes of instances of\nthe type.\n\nThere are two kinds of types: types with fixed-length instances\nhave a zero *note tpitemsize: 1c77. field, types with\nvariable-length instances have a non-zero *note tpitemsize: 1c77.\nfield.  For a type with fixed-length instances, all instances have\nthe same size, given in *note tpbasicsize: 7ab.\n\nFor a type with variable-length instances, the instances must have\nan *note obsize: 4899. field, and the instance size is *note\ntpbasicsize: 7ab. plus N times *note tpitemsize: 1c77, where N is\nthe \"length\" of the object.  The value of N is typically stored in\nthe instance's *note obsize: 4899. field.  There are exceptions:\nfor example, ints use a negative *note obsize: 4899. to indicate a\nnegative number, and N is 'abs(obsize)' there.  Also, the presence\nof an *note obsize: 4899. field in the instance layout doesn't\nmean that the instance structure is variable-length (for example,\nthe structure for the list type has fixed-length instances, yet\nthose instances have a meaningful *note obsize: 4899. field).\n\nThe basic size includes the fields in the instance declared by the\nmacro *note PyObjectHEAD: 1153. or *note PyObjectVARHEAD: 4bbc.\n(whichever is used to declare the instance struct) and this in turn\nincludes the *note obprev: 4c28. and *note obnext: 4c27. fields\nif they are present.  This means that the only correct way to get\nan initializer for the *note tpbasicsize: 7ab. is to use the\n'sizeof' operator on the struct used to declare the instance\nlayout.  The basic size does not include the GC header size.\n\nA note about alignment: if the variable items require a particular\nalignment, this should be taken care of by the value of *note\ntpbasicsize: 7ab.  Example: suppose a type implements an array of\n'double'.  *note tpitemsize: 1c77. is 'sizeof(double)'.  It is the\nprogrammer's responsibility that *note tpbasicsize: 7ab. is a\nmultiple of 'sizeof(double)' (assuming this is the alignment\nrequirement for 'double').\n\nFor any type with variable-length instances, this field must not be\n'NULL'.\n\n'Inheritance:'\n\nThese fields are inherited separately by subtypes.  If the base\ntype has a non-zero *note tpitemsize: 1c77, it is generally not\nsafe to set *note tpitemsize: 1c77. to a different non-zero value\nin a subtype (though this depends on the implementation of the base\ntype).\n\n-- C Member: *note destructor: 48b0. *note PyTypeObject: 8da.tpdealloc\n\nA pointer to the instance destructor function.  This function must\nbe defined unless the type guarantees that its instances will never\nbe deallocated (as is the case for the singletons 'None' and\n'Ellipsis').  The function signature is:\n\nvoid tpdealloc(PyObject *self);\n\nThe destructor function is called by the *note PyDECREF(): 2cf.\nand *note PyXDECREF(): 57d. macros when the new reference count is\nzero.  At this point, the instance is still in existence, but there\nare no references to it.  The destructor function should free all\nreferences which the instance owns, free all memory buffers owned\nby the instance (using the freeing function corresponding to the\nallocation function used to allocate the buffer), and call the\ntype's *note tpfree: 46d1. function.  If the type is not\nsubtypable (doesn't have the *note PyTPFLAGSBASETYPE: 46d6. flag\nbit set), it is permissible to call the object deallocator directly\ninstead of via *note tpfree: 46d1.  The object deallocator should\nbe the one used to allocate the instance; this is normally *note\nPyObjectDel(): 132c. if the instance was allocated using *note\nPyObjectNew: 7a9. or *note PyObjectNewVar: 7aa, or *note\nPyObjectGCDel(): 135f. if the instance was allocated using *note\nPyObjectGCNew: 8d7. or *note PyObjectGCNewVar: 8d8.\n\nIf the type supports garbage collection (has the *note\nPyTPFLAGSHAVEGC: 568. flag bit set), the destructor should call\n*note PyObjectGCUnTrack(): 1361. before clearing any member\nfields.\n\nstatic void foodealloc(fooobject *self) {\nPyObjectGCUnTrack(self);\nPyCLEAR(self->ref);\nPyTYPE(self)->tpfree((PyObject *)self);\n}\n\nFinally, if the type is heap allocated (*note PyTPFLAGSHEAPTYPE:\n6c7.), the deallocator should release the owned reference to its\ntype object (via *note PyDECREF(): 2cf.) after calling the type\ndeallocator.  In order to avoid dangling pointers, the recommended\nway to achieve this is:\n\nstatic void foodealloc(fooobject *self) {\nPyTypeObject *tp = PyTYPE(self);\n// free references and buffers here\ntp->tpfree(self);\nPyDECREF(tp);\n}\n\n'Inheritance:'\n\nThis field is inherited by subtypes.\n\n-- C Member: *note Pyssizet: 88d. *note PyTypeObject:\n8da.tpvectorcalloffset\n\nAn optional offset to a per-instance function that implements\ncalling the object using the *note vectorcall protocol: 2ab, a more\nefficient alternative of the simpler *note tpcall: 2b3.\n\nThis field is only used if the flag *note\nPyTPFLAGSHAVEVECTORCALL: 2ad. is set.  If so, this must be a\npositive integer containing the offset in the instance of a *note\nvectorcallfunc: 2b0. pointer.\n\nThe 'vectorcallfunc' pointer may be 'NULL', in which case the\ninstance behaves as if *note PyTPFLAGSHAVEVECTORCALL: 2ad. was\nnot set: calling the instance falls back to *note tpcall: 2b3.\n\nAny class that sets 'PyTPFLAGSHAVEVECTORCALL' must also set\n*note tpcall: 2b3. and make sure its behaviour is consistent with\nthe 'vectorcallfunc' function.  This can be done by setting\n'tpcall' to *note PyVectorcallCall(): 2af.\n\nChanged in version 3.8: Before version 3.8, this slot was named\n'tpprint'.  In Python 2.x, it was used for printing to a file.  In\nPython 3.0 to 3.7, it was unused.\n\nChanged in version 3.12: Before version 3.12, it was not\nrecommended for *note mutable heap types: 786. to implement the\nvectorcall protocol.  When a user sets *note call: 2b1. in\nPython code, only 'tpcall' is updated, likely making it\ninconsistent with the vectorcall function.  Since 3.12, setting\n'call' will disable vectorcall optimization by clearing the\n*note PyTPFLAGSHAVEVECTORCALL: 2ad. flag.\n\n'Inheritance:'\n\nThis field is always inherited.  However, the *note\nPyTPFLAGSHAVEVECTORCALL: 2ad. flag is not always inherited.  If\nit's not set, then the subclass won't use *note vectorcall: 2ab,\nexcept when *note PyVectorcallCall(): 2af. is explicitly called.\n\n-- C Member: *note getattrfunc: 48b1. *note PyTypeObject:\n8da.tpgetattr\n\nAn optional pointer to the get-attribute-string function.\n\nThis field is deprecated.  When it is defined, it should point to a\nfunction that acts the same as the *note tpgetattro: 46e9.\nfunction, but taking a C string instead of a Python string object\nto give the attribute name.\n\n'Inheritance:'\n\nGroup: *note tpgetattr: 46ef, *note tpgetattro: 46e9.\n\nThis field is inherited by subtypes together with *note\ntpgetattro: 46e9.: a subtype inherits both *note tpgetattr: 46ef.\nand *note tpgetattro: 46e9. from its base type when the subtype's\n*note tpgetattr: 46ef. and *note tpgetattro: 46e9. are both\n'NULL'.\n\n-- C Member: *note setattrfunc: 48c1. *note PyTypeObject:\n8da.tpsetattr\n\nAn optional pointer to the function for setting and deleting\nattributes.\n\nThis field is deprecated.  When it is defined, it should point to a\nfunction that acts the same as the *note tpsetattro: 46ea.\nfunction, but taking a C string instead of a Python string object\nto give the attribute name.\n\n'Inheritance:'\n\nGroup: *note tpsetattr: 46f0, *note tpsetattro: 46ea.\n\nThis field is inherited by subtypes together with *note\ntpsetattro: 46ea.: a subtype inherits both *note tpsetattr: 46f0.\nand *note tpsetattro: 46ea. from its base type when the subtype's\n*note tpsetattr: 46f0. and *note tpsetattro: 46ea. are both\n'NULL'.\n\n-- C Member: *note PyAsyncMethods: 49b1. note PyTypeObject:\n8da.tpasasync\n\nPointer to an additional structure that contains fields relevant\nonly to objects which implement *note awaitable: ac3. and *note\nasynchronous iterator: bd4. protocols at the C-level.  See *note\nAsync Object Structures: 4c2b. for details.\n\nNew in version 3.5: Formerly known as 'tpcompare' and\n'tpreserved'.\n\n'Inheritance:'\n\nThe *note tpasasync: d34. field is not inherited, but the\ncontained fields are inherited individually.\n\n-- C Member: *note reprfunc: 48bf. *note PyTypeObject: 8da.tprepr\n\nAn optional pointer to a function that implements the built-in\nfunction *note repr(): 5f0.\n\nThe signature is the same as for *note PyObjectRepr(): ea6.:\n\nPyObject *tprepr(PyObject *self);\n\nThe function must return a string or a Unicode object.  Ideally,\nthis function should return a string that, when passed to *note\neval(): 690, given a suitable environment, returns an object with\nthe same value.  If this is not feasible, it should return a string\nstarting with ''<'' and ending with ''>'' from which both the type\nand the value of the object can be deduced.\n\n'Inheritance:'\n\nThis field is inherited by subtypes.\n\n'Default:'\n\nWhen this field is not set, a string of the form '<%s object at\n%p>' is returned, where '%s' is replaced by the type name, and '%p'\nby the object's memory address.\n\n-- C Member: *note PyNumberMethods: 1274. note PyTypeObject:\n8da.tpasnumber\n\nPointer to an additional structure that contains fields relevant\nonly to objects which implement the number protocol.  These fields\nare documented in *note Number Object Structures: 4c2c.\n\n'Inheritance:'\n\nThe *note tpasnumber: 7af. field is not inherited, but the\ncontained fields are inherited individually.\n\n-- C Member: *note PySequenceMethods: 46f6. note PyTypeObject:\n8da.tpassequence\n\nPointer to an additional structure that contains fields relevant\nonly to objects which implement the sequence protocol.  These\nfields are documented in *note Sequence Object Structures: 4c2d.\n\n'Inheritance:'\n\nThe *note tpassequence: 4beb. field is not inherited, but the\ncontained fields are inherited individually.\n\n-- C Member: *note PyMappingMethods: 46f7. note PyTypeObject:\n8da.tpasmapping\n\nPointer to an additional structure that contains fields relevant\nonly to objects which implement the mapping protocol.  These fields\nare documented in *note Mapping Object Structures: 4c2e.\n\n'Inheritance:'\n\nThe *note tpasmapping: 4bec. field is not inherited, but the\ncontained fields are inherited individually.\n\n-- C Member: *note hashfunc: 48b6. *note PyTypeObject: 8da.tphash\n\nAn optional pointer to a function that implements the built-in\nfunction *note hash(): 3b1.\n\nThe signature is the same as for *note PyObjectHash(): 342.:\n\nPyhasht tphash(PyObject *);\n\nThe value '-1' should not be returned as a normal return value;\nwhen an error occurs during the computation of the hash value, the\nfunction should set an exception and return '-1'.\n\nWhen this field is not set ('and' *note tprichcompare: 46f2. is\nnot set), an attempt to take the hash of the object raises *note\nTypeError: 28e.  This is the same as setting it to *note\nPyObjectHashNotImplemented(): 121b.\n\nThis field can be set explicitly to *note\nPyObjectHashNotImplemented(): 121b. to block inheritance of the\nhash method from a parent type.  This is interpreted as the\nequivalent of 'hash = None' at the Python level, causing\n'isinstance(o, collections.Hashable)' to correctly return 'False'.\nNote that the converse is also true - setting 'hash = None' on\na class at the Python level will result in the 'tphash' slot being\nset to *note PyObjectHashNotImplemented(): 121b.\n\n'Inheritance:'\n\nGroup: *note tphash: 46f8, *note tprichcompare: 46f2.\n\nThis field is inherited by subtypes together with *note\ntprichcompare: 46f2.: a subtype inherits both of *note\ntprichcompare: 46f2. and *note tphash: 46f8, when the subtype's\n*note tprichcompare: 46f2. and *note tphash: 46f8. are both\n'NULL'.\n\n-- C Member: *note ternaryfunc: 48c6. *note PyTypeObject: 8da.tpcall\n\nAn optional pointer to a function that implements calling the\nobject.  This should be 'NULL' if the object is not callable.  The\nsignature is the same as for *note PyObjectCall(): 787.:\n\nPyObject *tpcall(PyObject *self, PyObject *args, PyObject *kwargs);\n\n'Inheritance:'\n\nThis field is inherited by subtypes.\n\n-- C Member: *note reprfunc: 48bf. *note PyTypeObject: 8da.tpstr\n\nAn optional pointer to a function that implements the built-in\noperation *note str(): 157.  (Note that *note str: 157. is a type\nnow, and *note str(): 157. calls the constructor for that type.\nThis constructor calls *note PyObjectStr(): ea7. to do the actual\nwork, and *note PyObjectStr(): ea7. will call this handler.)\n\nThe signature is the same as for *note PyObjectStr(): ea7.:\n\nPyObject *tpstr(PyObject *self);\n\nThe function must return a string or a Unicode object.  It should\nbe a \"friendly\" string representation of the object, as this is the\nrepresentation that will be used, among other things, by the *note\nprint(): de5. function.\n\n'Inheritance:'\n\nThis field is inherited by subtypes.\n\n'Default:'\n\nWhen this field is not set, *note PyObjectRepr(): ea6. is called\nto return a string representation.\n\n-- C Member: *note getattrofunc: 48b2. *note PyTypeObject:\n8da.tpgetattro\n\nAn optional pointer to the get-attribute function.\n\nThe signature is the same as for *note PyObjectGetAttr(): 4821.:\n\nPyObject *tpgetattro(PyObject *self, PyObject *attr);\n\nIt is usually convenient to set this field to *note\nPyObjectGenericGetAttr(): 481d, which implements the normal way of\nlooking for object attributes.\n\n'Inheritance:'\n\nGroup: *note tpgetattr: 46ef, *note tpgetattro: 46e9.\n\nThis field is inherited by subtypes together with *note tpgetattr:\n46ef.: a subtype inherits both *note tpgetattr: 46ef. and *note\ntpgetattro: 46e9. from its base type when the subtype's *note\ntpgetattr: 46ef. and *note tpgetattro: 46e9. are both 'NULL'.\n\n'Default:'\n\n'PyBaseObjectType' uses *note PyObjectGenericGetAttr(): 481d.\n\n-- C Member: *note setattrofunc: 48c2. *note PyTypeObject:\n8da.tpsetattro\n\nAn optional pointer to the function for setting and deleting\nattributes.\n\nThe signature is the same as for *note PyObjectSetAttr(): 4827.:\n\nint tpsetattro(PyObject *self, PyObject *attr, PyObject *value);\n\nIn addition, setting 'value' to 'NULL' to delete an attribute must\nbe supported.  It is usually convenient to set this field to *note\nPyObjectGenericSetAttr(): 481e, which implements the normal way of\nsetting object attributes.\n\n'Inheritance:'\n\nGroup: *note tpsetattr: 46f0, *note tpsetattro: 46ea.\n\nThis field is inherited by subtypes together with *note tpsetattr:\n46f0.: a subtype inherits both *note tpsetattr: 46f0. and *note\ntpsetattro: 46ea. from its base type when the subtype's *note\ntpsetattr: 46f0. and *note tpsetattro: 46ea. are both 'NULL'.\n\n'Default:'\n\n'PyBaseObjectType' uses *note PyObjectGenericSetAttr(): 481e.\n\n-- C Member: *note PyBufferProcs: 49b9. note PyTypeObject:\n8da.tpasbuffer\n\nPointer to an additional structure that contains fields relevant\nonly to objects which implement the buffer interface.  These fields\nare documented in *note Buffer Object Structures: 4973.\n\n'Inheritance:'\n\nThe *note tpasbuffer: 7ad. field is not inherited, but the\ncontained fields are inherited individually.\n\n-- C Member: unsigned long *note PyTypeObject: 8da.tpflags\n\nThis field is a bit mask of various flags.  Some flags indicate\nvariant semantics for certain situations; others are used to\nindicate that certain fields in the type object (or in the\nextension structures referenced via *note tpasnumber: 7af, *note\ntpassequence: 4beb, *note tpasmapping: 4bec, and *note\ntpasbuffer: 7ad.) that were historically not always present are\nvalid; if such a flag bit is clear, the type fields it guards must\nnot be accessed and must be considered to have a zero or 'NULL'\nvalue instead.\n\n'Inheritance:'\n\nInheritance of this field is complicated.  Most flag bits are\ninherited individually, i.e.  if the base type has a flag bit set,\nthe subtype inherits this flag bit.  The flag bits that pertain to\nextension structures are strictly inherited if the extension\nstructure is inherited, i.e.  the base type's value of the flag bit\nis copied into the subtype together with a pointer to the extension\nstructure.  The *note PyTPFLAGSHAVEGC: 568. flag bit is\ninherited together with the *note tptraverse: 569. and *note\ntpclear: 46e3. fields, i.e.  if the *note PyTPFLAGSHAVEGC: 568.\nflag bit is clear in the subtype and the *note tptraverse: 569.\nand *note tpclear: 46e3. fields in the subtype exist and have\n'NULL' values.  ..  XXX are most flag bits 'really' inherited\nindividually?\n\n'Default:'\n\n'PyBaseObjectType' uses 'PyTPFLAGSDEFAULT |\nPyTPFLAGSBASETYPE'.\n\n'Bit Masks:'\n\nThe following bit masks are currently defined; these can be ORed\ntogether using the '|' operator to form the value of the *note\ntpflags: 1620. field.  The macro *note PyTypeHasFeature(): 16bd.\ntakes a type and a flags value, 'tp' and 'f', and checks whether\n'tp->tpflags & f' is non-zero.\n\n-- C Macro: PyTPFLAGSHEAPTYPE\n\nThis bit is set when the type object itself is allocated on\nthe heap, for example, types created dynamically using *note\nPyTypeFromSpec(): 2df.  In this case, the *note obtype:\n46ce. field of its instances is considered a reference to the\ntype, and the type object is INCREF'ed when a new instance is\ncreated, and DECREF'ed when an instance is destroyed (this\ndoes not apply to instances of subtypes; only the type\nreferenced by the instance's obtype gets INCREF'ed or\nDECREF'ed).\n\n'Inheritance:'\n\n???\n\n-- C Macro: PyTPFLAGSBASETYPE\n\nThis bit is set when the type can be used as the base type of\nanother type.  If this bit is clear, the type cannot be\nsubtyped (similar to a \"final\" class in Java).\n\n'Inheritance:'\n\n???\n\n-- C Macro: PyTPFLAGSREADY\n\nThis bit is set when the type object has been fully\ninitialized by *note PyTypeReady(): 567.\n\n'Inheritance:'\n\n???\n\n-- C Macro: PyTPFLAGSREADYING\n\nThis bit is set while *note PyTypeReady(): 567. is in the\nprocess of initializing the type object.\n\n'Inheritance:'\n\n???\n\n-- C Macro: PyTPFLAGSHAVEGC\n\nThis bit is set when the object supports garbage collection.\nIf this bit is set, instances must be created using *note\nPyObjectGCNew: 8d7. and destroyed using *note\nPyObjectGCDel(): 135f.  More information in section *note\nSupporting Cyclic Garbage Collection: 4c31.  This bit also\nimplies that the GC-related fields *note tptraverse: 569. and\n*note tpclear: 46e3. are present in the type object.\n\n'Inheritance:'\n\nGroup: *note PyTPFLAGSHAVEGC: 568, *note tptraverse: 569,\n*note tpclear: 46e3.\n\nThe *note PyTPFLAGSHAVEGC: 568. flag bit is inherited\ntogether with the *note tptraverse: 569. and *note tpclear:\n46e3. fields, i.e.  if the *note PyTPFLAGSHAVEGC: 568. flag\nbit is clear in the subtype and the *note tptraverse: 569.\nand *note tpclear: 46e3. fields in the subtype exist and have\n'NULL' values.\n\n-- C Macro: PyTPFLAGSDEFAULT\n\nThis is a bitmask of all the bits that pertain to the\nexistence of certain fields in the type object and its\nextension structures.  Currently, it includes the following\nbits: 'PyTPFLAGSHAVESTACKLESSEXTENSION'.\n\n'Inheritance:'\n\n???\n\n-- C Macro: PyTPFLAGSMETHODDESCRIPTOR\n\nThis bit indicates that objects behave like unbound methods.\n\nIf this flag is set for 'type(meth)', then:\n\n- 'meth.get(obj, cls)(*args, kwds)' (with 'obj' not\nNone) must be equivalent to 'meth(obj, *args, kwds)'.\n\n- 'meth.get(None, cls)(*args, kwds)' must be\nequivalent to 'meth(*args, kwds)'.\n\nThis flag enables an optimization for typical method calls\nlike 'obj.meth()': it avoids creating a temporary \"bound\nmethod\" object for 'obj.meth'.\n\nNew in version 3.8.\n\n'Inheritance:'\n\nThis flag is never inherited by types without the *note\nPyTPFLAGSIMMUTABLETYPE: 2b2. flag set.  For extension types,\nit is inherited whenever *note tpdescrget: 4bed. is\ninherited.\n\n-- C Macro: PyTPFLAGSMANAGEDDICT\n\nThis bit indicates that instances of the class have a\n'dict' attribute, and that the space for the dictionary is\nmanaged by the VM.\n\nIf this flag is set, *note PyTPFLAGSHAVEGC: 568. should\nalso be set.\n\nNew in version 3.12.\n\n'Inheritance:'\n\nThis flag is inherited unless the *note tpdictoffset: 49b3.\nfield is set in a superclass.\n\n-- C Macro: PyTPFLAGSMANAGEDWEAKREF\n\nThis bit indicates that instances of the class should be\nweakly referenceable.\n\nNew in version 3.12.\n\n'Inheritance:'\n\nThis flag is inherited unless the *note tpweaklistoffset:\n7ac. field is set in a superclass.\n\n-- C Macro: PyTPFLAGSITEMSATEND\n\nOnly usable with variable-size types, i.e.  ones with non-zero\n*note tpitemsize: 1c77.\n\nIndicates that the variable-sized portion of an instance of\nthis type is at the end of the instance's memory area, at an\noffset of 'PyTYPE(obj)->tpbasicsize' (which may be different\nin each subclass).\n\nWhen setting this flag, be sure that all superclasses either\nuse this memory layout, or are not variable-sized.  Python\ndoes not check this.\n\nNew in version 3.12.\n\n'Inheritance:'\n\nThis flag is inherited.\n\n-- C Macro: PyTPFLAGSLONGSUBCLASS\n\n-- C Macro: PyTPFLAGSLISTSUBCLASS\n\n-- C Macro: PyTPFLAGSTUPLESUBCLASS\n\n-- C Macro: PyTPFLAGSBYTESSUBCLASS\n\n-- C Macro: PyTPFLAGSUNICODESUBCLASS\n\n-- C Macro: PyTPFLAGSDICTSUBCLASS\n\n-- C Macro: PyTPFLAGSBASEEXCSUBCLASS\n\n-- C Macro: PyTPFLAGSTYPESUBCLASS\n\nThese flags are used by functions such as *note\nPyLongCheck(): 49c3. to quickly determine if a type is a\nsubclass of a built-in type; such specific checks are faster\nthan a generic check, like *note PyObjectIsInstance(): d0a.\nCustom types that inherit from built-ins should have their\n*note tpflags: 1620. set appropriately, or the code that\ninteracts with such types will behave differently depending on\nwhat kind of check is used.\n\n-- C Macro: PyTPFLAGSHAVEFINALIZE\n\nThis bit is set when the *note tpfinalize: 8db. slot is\npresent in the type structure.\n\nNew in version 3.4.\n\nDeprecated since version 3.8: This flag isn't necessary\nanymore, as the interpreter assumes the *note tpfinalize:\n8db. slot is always present in the type structure.\n\n-- C Macro: PyTPFLAGSHAVEVECTORCALL\n\nThis bit is set when the class implements the *note vectorcall\nprotocol: 2ab.  See *note tpvectorcalloffset: 4953. for\ndetails.\n\n'Inheritance:'\n\nThis bit is inherited if *note tpcall: 2b3. is also\ninherited.\n\nNew in version 3.9.\n\nChanged in version 3.12: This flag is now removed from a class\nwhen the class's *note call(): 2b1. method is reassigned.\n\nThis flag can now be inherited by mutable classes.\n\n-- C Macro: PyTPFLAGSIMMUTABLETYPE\n\nThis bit is set for type objects that are immutable: type\nattributes cannot be set nor deleted.\n\n*note PyTypeReady(): 567. automatically applies this flag to\n*note static types: 56a.\n\n'Inheritance:'\n\nThis flag is not inherited.\n\nNew in version 3.10.\n\n-- C Macro: PyTPFLAGSDISALLOWINSTANTIATION\n\nDisallow creating instances of the type: set *note tpnew:\n2e1. to NULL and don't create the 'new' key in the type\ndictionary.\n\nThe flag must be set before creating the type, not after.  For\nexample, it must be set before *note PyTypeReady(): 567. is\ncalled on the type.\n\nThe flag is set automatically on *note static types: 56a. if\n*note tpbase: 46dc. is NULL or '&PyBaseObjectType' and *note\ntpnew: 2e1. is NULL.\n\n'Inheritance:'\n\nThis flag is not inherited.  However, subclasses will not be\ninstantiable unless they provide a non-NULL *note tpnew: 2e1.\n(which is only possible via the C API).\n\nNote: To disallow instantiating a class directly but\nallow instantiating its subclasses (e.g.  for an *note\nabstract base class: 102a.), do not use this flag.\nInstead, make *note tpnew: 2e1. only succeed for\nsubclasses.\n\nNew in version 3.10.\n\n-- C Macro: PyTPFLAGSMAPPING\n\nThis bit indicates that instances of the class may match\nmapping patterns when used as the subject of a *note match:\n601. block.  It is automatically set when registering or\nsubclassing *note collections.abc.Mapping: 6e2, and unset when\nregistering *note collections.abc.Sequence: 1038.\n\nNote: *note PyTPFLAGSMAPPING: 1605. and *note\nPyTPFLAGSSEQUENCE: 1606. are mutually exclusive; it is\nan error to enable both flags simultaneously.\n\n'Inheritance:'\n\nThis flag is inherited by types that do not already set *note\nPyTPFLAGSSEQUENCE: 1606.\n\nSee also\n........\n\nPEP 634(1) - Structural Pattern Matching: Specification\n\nNew in version 3.10.\n\n-- C Macro: PyTPFLAGSSEQUENCE\n\nThis bit indicates that instances of the class may match\nsequence patterns when used as the subject of a *note match:\n601. block.  It is automatically set when registering or\nsubclassing *note collections.abc.Sequence: 1038, and unset\nwhen registering *note collections.abc.Mapping: 6e2.\n\nNote: *note PyTPFLAGSMAPPING: 1605. and *note\nPyTPFLAGSSEQUENCE: 1606. are mutually exclusive; it is\nan error to enable both flags simultaneously.\n\n'Inheritance:'\n\nThis flag is inherited by types that do not already set *note\nPyTPFLAGSMAPPING: 1605.\n\nSee also\n........\n\nPEP 634(2) - Structural Pattern Matching: Specification\n\nNew in version 3.10.\n\n-- C Macro: PyTPFLAGSVALIDVERSIONTAG\n\nInternal.  Do not set or unset this flag.  To indicate that a\nclass has changed call *note PyTypeModified(): 154f.\n\nWarning: This flag is present in header files, but is an\ninternal feature and should not be used.  It will be\nremoved in a future version of CPython\n\n-- C Member: const char note PyTypeObject: 8da.tpdoc\n\nAn optional pointer to a NUL-terminated C string giving the\ndocstring for this type object.  This is exposed as the 'doc'\nattribute on the type and instances of the type.\n\n'Inheritance:'\n\nThis field is 'not' inherited by subtypes.\n\n-- C Member: *note traverseproc: 48c7. *note PyTypeObject:\n8da.tptraverse\n\nAn optional pointer to a traversal function for the garbage\ncollector.  This is only used if the *note PyTPFLAGSHAVEGC: 568.\nflag bit is set.  The signature is:\n\nint tptraverse(PyObject *self, visitproc visit, void *arg);\n\nMore information about Python's garbage collection scheme can be\nfound in section *note Supporting Cyclic Garbage Collection: 4c31.\n\nThe *note tptraverse: 569. pointer is used by the garbage\ncollector to detect reference cycles.  A typical implementation of\na *note tptraverse: 569. function simply calls *note PyVISIT():\n46da. on each of the instance's members that are Python objects\nthat the instance owns.  For example, this is function\n'localtraverse()' from the 'thread' extension module:\n\nstatic int\nlocaltraverse(localobject *self, visitproc visit, void *arg)\n{\nPyVISIT(self->args);\nPyVISIT(self->kw);\nPyVISIT(self->dict);\nreturn 0;\n}\n\nNote that *note PyVISIT(): 46da. is called only on those members\nthat can participate in reference cycles.  Although there is also a\n'self->key' member, it can only be 'NULL' or a Python string and\ntherefore cannot be part of a reference cycle.\n\nOn the other hand, even if you know a member can never be part of a\ncycle, as a debugging aid you may want to visit it anyway just so\nthe *note gc: 5b. module's *note getreferents(): 5f8. function\nwill include it.\n\nWarning: When implementing *note tptraverse: 569, only the\nmembers that the instance 'owns' (by having *note strong\nreferences: 57c. to them) must be visited.  For instance, if\nan object supports weak references via the *note tpweaklist:\n49b8. slot, the pointer supporting the linked list (what\n'tpweaklist' points to) must 'not' be visited as the instance\ndoes not directly own the weak references to itself (the\nweakreference list is there to support the weak reference\nmachinery, but the instance has no strong reference to the\nelements inside it, as they are allowed to be removed even if\nthe instance is still alive).\n\nNote that *note PyVISIT(): 46da. requires the 'visit' and 'arg'\nparameters to 'localtraverse()' to have these specific names;\ndon't name them just anything.\n\nInstances of *note heap-allocated types: 786. hold a reference to\ntheir type.  Their traversal function must therefore either visit\n*note PyTYPE(self): 56b, or delegate this responsibility by\ncalling 'tptraverse' of another heap-allocated type (such as a\nheap-allocated superclass).  If they do not, the type object may\nnot be garbage-collected.\n\nChanged in version 3.9: Heap-allocated types are expected to visit\n'PyTYPE(self)' in 'tptraverse'.  In earlier versions of Python,\ndue to bug 40217(3), doing this may lead to crashes in subclasses.\n\n'Inheritance:'\n\nGroup: *note PyTPFLAGSHAVEGC: 568, *note tptraverse: 569, *note\ntpclear: 46e3.\n\nThis field is inherited by subtypes together with *note tpclear:\n46e3. and the *note PyTPFLAGSHAVEGC: 568. flag bit: the flag\nbit, *note tptraverse: 569, and *note tpclear: 46e3. are all\ninherited from the base type if they are all zero in the subtype.\n\n-- C Member: *note inquiry: 48b8. *note PyTypeObject: 8da.tpclear\n\nAn optional pointer to a clear function for the garbage collector.\nThis is only used if the *note PyTPFLAGSHAVEGC: 568. flag bit is\nset.  The signature is:\n\nint tpclear(PyObject *);\n\nThe *note tpclear: 46e3. member function is used to break\nreference cycles in cyclic garbage detected by the garbage\ncollector.  Taken together, all *note tpclear: 46e3. functions in\nthe system must combine to break all reference cycles.  This is\nsubtle, and if in any doubt supply a *note tpclear: 46e3.\nfunction.  For example, the tuple type does not implement a *note\ntpclear: 46e3. function, because it's possible to prove that no\nreference cycle can be composed entirely of tuples.  Therefore the\n*note tpclear: 46e3. functions of other types must be sufficient\nto break any cycle containing a tuple.  This isn't immediately\nobvious, and there's rarely a good reason to avoid implementing\n*note tpclear: 46e3.\n\nImplementations of *note tpclear: 46e3. should drop the instance's\nreferences to those of its members that may be Python objects, and\nset its pointers to those members to 'NULL', as in the following\nexample:\n\nstatic int\nlocalclear(localobject *self)\n{\nPyCLEAR(self->key);\nPyCLEAR(self->args);\nPyCLEAR(self->kw);\nPyCLEAR(self->dict);\nreturn 0;\n}\n\nThe *note PyCLEAR(): 2da. macro should be used, because clearing\nreferences is delicate: the reference to the contained object must\nnot be released (via *note PyDECREF(): 2cf.) until after the\npointer to the contained object is set to 'NULL'.  This is because\nreleasing the reference may cause the contained object to become\ntrash, triggering a chain of reclamation activity that may include\ninvoking arbitrary Python code (due to finalizers, or weakref\ncallbacks, associated with the contained object).  If it's possible\nfor such code to reference 'self' again, it's important that the\npointer to the contained object be 'NULL' at that time, so that\n'self' knows the contained object can no longer be used.  The *note\nPyCLEAR(): 2da. macro performs the operations in a safe order.\n\nNote that *note tpclear: 46e3. is not 'always' called before an\ninstance is deallocated.  For example, when reference counting is\nenough to determine that an object is no longer used, the cyclic\ngarbage collector is not involved and *note tpdealloc: 46d0. is\ncalled directly.\n\nBecause the goal of *note tpclear: 46e3. functions is to break\nreference cycles, it's not necessary to clear contained objects\nlike Python strings or Python integers, which can't participate in\nreference cycles.  On the other hand, it may be convenient to clear\nall contained Python objects, and write the type's *note\ntpdealloc: 46d0. function to invoke *note tpclear: 46e3.\n\nMore information about Python's garbage collection scheme can be\nfound in section *note Supporting Cyclic Garbage Collection: 4c31.\n\n'Inheritance:'\n\nGroup: *note PyTPFLAGSHAVEGC: 568, *note tptraverse: 569, *note\ntpclear: 46e3.\n\nThis field is inherited by subtypes together with *note\ntptraverse: 569. and the *note PyTPFLAGSHAVEGC: 568. flag bit:\nthe flag bit, *note tptraverse: 569, and *note tpclear: 46e3. are\nall inherited from the base type if they are all zero in the\nsubtype.\n\n-- C Member: *note richcmpfunc: 48c0. *note PyTypeObject:\n8da.tprichcompare\n\nAn optional pointer to the rich comparison function, whose\nsignature is:\n\nPyObject *tprichcompare(PyObject *self, PyObject *other, int op);\n\nThe first parameter is guaranteed to be an instance of the type\nthat is defined by *note PyTypeObject: 8da.\n\nThe function should return the result of the comparison (usually\n'PyTrue' or 'PyFalse').  If the comparison is undefined, it must\nreturn 'PyNotImplemented', if another error occurred it must\nreturn 'NULL' and set an exception condition.\n\nThe following constants are defined to be used as the third\nargument for *note tprichcompare: 46f2. and for *note\nPyObjectRichCompare(): 46f3.:\n\nConstant                 Comparison\n\n------------------------------------------\n\n-- C Macro: PyLT       '<'\n\n\n-- C Macro: PyLE       '<='\n\n\n-- C Macro: PyEQ       '=='\n\n\n-- C Macro: PyNE       '!='\n\n\n-- C Macro: PyGT       '>'\n\n\n-- C Macro: PyGE       '>='\n\n\nThe following macro is defined to ease writing rich comparison\nfunctions:\n\n-- C Macro: PyRETURNRICHCOMPARE (VALA, VALB, op)\n\nReturn 'PyTrue' or 'PyFalse' from the function, depending on\nthe result of a comparison.  VALA and VALB must be orderable\nby C comparison operators (for example, they may be C ints or\nfloats).  The third argument specifies the requested\noperation, as for *note PyObjectRichCompare(): 46f3.\n\nThe returned value is a new *note strong reference: 57c.\n\nOn error, sets an exception and returns 'NULL' from the\nfunction.\n\nNew in version 3.7.\n\n'Inheritance:'\n\nGroup: *note tphash: 46f8, *note tprichcompare: 46f2.\n\nThis field is inherited by subtypes together with *note tphash:\n46f8.: a subtype inherits *note tprichcompare: 46f2. and *note\ntphash: 46f8. when the subtype's *note tprichcompare: 46f2. and\n*note tphash: 46f8. are both 'NULL'.\n\n'Default:'\n\n'PyBaseObjectType' provides a *note tprichcompare: 46f2.\nimplementation, which may be inherited.  However, if only *note\ntphash: 46f8. is defined, not even the inherited function is used\nand instances of the type will not be able to participate in any\ncomparisons.\n\n-- C Member: *note Pyssizet: 88d. *note PyTypeObject:\n8da.tpweaklistoffset\n\nWhile this field is still supported, *note\nPyTPFLAGSMANAGEDWEAKREF: 2b5. should be used instead, if at all\npossible.\n\nIf the instances of this type are weakly referenceable, this field\nis greater than zero and contains the offset in the instance\nstructure of the weak reference list head (ignoring the GC header,\nif present); this offset is used by *note PyObjectClearWeakRefs():\n2d8. and the 'PyWeakref*' functions.  The instance structure needs\nto include a field of type *note PyObject: 6b1.* which is\ninitialized to 'NULL'.\n\nDo not confuse this field with *note tpweaklist: 49b8.; that is\nthe list head for weak references to the type object itself.\n\nIt is an error to set both the *note PyTPFLAGSMANAGEDWEAKREF:\n2b5. bit and *note tpweaklist: 49b8.\n\n'Inheritance:'\n\nThis field is inherited by subtypes, but see the rules listed\nbelow.  A subtype may override this offset; this means that the\nsubtype uses a different weak reference list head than the base\ntype.  Since the list head is always found via *note\ntpweaklistoffset: 7ac, this should not be a problem.\n\n'Default:'\n\nIf the *note PyTPFLAGSMANAGEDWEAKREF: 2b5. bit is set in the\n*note tpdict: 1443. field, then *note tpweaklistoffset: 7ac. will\nbe set to a negative value, to indicate that it is unsafe to use\nthis field.\n\n-- C Member: *note getiterfunc: 48b4. *note PyTypeObject: 8da.tpiter\n\nAn optional pointer to a function that returns an *note iterator:\n16a9. for the object.  Its presence normally signals that the\ninstances of this type are *note iterable: 109d. (although\nsequences may be iterable without this function).\n\nThis function has the same signature as *note PyObjectGetIter():\n4822.:\n\nPyObject *tpiter(PyObject *self);\n\n'Inheritance:'\n\nThis field is inherited by subtypes.\n\n-- C Member: *note iternextfunc: 48b9. *note PyTypeObject:\n8da.tpiternext\n\nAn optional pointer to a function that returns the next item in an\n*note iterator: 16a9.  The signature is:\n\nPyObject *tpiternext(PyObject *self);\n\nWhen the iterator is exhausted, it must return 'NULL'; a *note\nStopIteration: a40. exception may or may not be set.  When another\nerror occurs, it must return 'NULL' too.  Its presence signals that\nthe instances of this type are iterators.\n\nIterator types should also define the *note tpiter: 1348.\nfunction, and that function should return the iterator instance\nitself (not a new iterator instance).\n\nThis function has the same signature as *note PyIterNext(): 47cb.\n\n'Inheritance:'\n\nThis field is inherited by subtypes.\n\n-- C Member: struct *note PyMethodDef: 1332. note PyTypeObject:\n8da.tpmethods\n\nAn optional pointer to a static 'NULL'-terminated array of *note\nPyMethodDef: 1332. structures, declaring regular methods of this\ntype.\n\nFor each entry in the array, an entry is added to the type's\ndictionary (see *note tpdict: 1443. below) containing a method\ndescriptor.\n\n'Inheritance:'\n\nThis field is not inherited by subtypes (methods are inherited\nthrough a different mechanism).\n\n-- C Member: struct *note PyMemberDef: 2a7. note PyTypeObject:\n8da.tpmembers\n\nAn optional pointer to a static 'NULL'-terminated array of *note\nPyMemberDef: 2a7. structures, declaring regular data members\n(fields or slots) of instances of this type.\n\nFor each entry in the array, an entry is added to the type's\ndictionary (see *note tpdict: 1443. below) containing a member\ndescriptor.\n\n'Inheritance:'\n\nThis field is not inherited by subtypes (members are inherited\nthrough a different mechanism).\n\n-- C Member: struct *note PyGetSetDef: 9fc. note PyTypeObject:\n8da.tpgetset\n\nAn optional pointer to a static 'NULL'-terminated array of *note\nPyGetSetDef: 9fc. structures, declaring computed attributes of\ninstances of this type.\n\nFor each entry in the array, an entry is added to the type's\ndictionary (see *note tpdict: 1443. below) containing a getset\ndescriptor.\n\n'Inheritance:'\n\nThis field is not inherited by subtypes (computed attributes are\ninherited through a different mechanism).\n\n-- C Member: *note PyTypeObject: 8da. note PyTypeObject: 8da.tpbase\n\nAn optional pointer to a base type from which type properties are\ninherited.  At this level, only single inheritance is supported;\nmultiple inheritance require dynamically creating a type object by\ncalling the metatype.\n\nNote:\nSlot initialization is subject to the rules of initializing\nglobals.  C99 requires the initializers to be \"address\nconstants\".  Function designators like *note\nPyTypeGenericNew(): 46cd, with implicit conversion to a\npointer, are valid C99 address constants.\n\nHowever, the unary '&' operator applied to a non-static\nvariable like 'PyBaseObjectType' is not required to produce\nan address constant.  Compilers may support this (gcc does),\nMSVC does not.  Both compilers are strictly standard\nconforming in this particular behavior.\n\nConsequently, *note tpbase: 46dc. should be set in the\nextension module's init function.\n\n'Inheritance:'\n\nThis field is not inherited by subtypes (obviously).\n\n'Default:'\n\nThis field defaults to '&PyBaseObjectType' (which to Python\nprogrammers is known as the type *note object: 8bb.).\n\n-- C Member: *note PyObject: 6b1. note PyTypeObject: 8da.tpdict\n\nThe type's dictionary is stored here by *note PyTypeReady(): 567.\n\nThis field should normally be initialized to 'NULL' before\nPyTypeReady is called; it may also be initialized to a dictionary\ncontaining initial attributes for the type.  Once *note\nPyTypeReady(): 567. has initialized the type, extra attributes for\nthe type may be added to this dictionary only if they don't\ncorrespond to overloaded operations (like *note add(): 1c93.).\nOnce initialization for the type has finished, this field should be\ntreated as read-only.\n\nSome types may not store their dictionary in this slot.  Use *note\nPyTypeGetDict(): 1442. to retrieve the dictionary for an arbitrary\ntype.\n\nChanged in version 3.12: Internals detail: For static builtin\ntypes, this is always 'NULL'.  Instead, the dict for such types is\nstored on 'PyInterpreterState'.  Use *note PyTypeGetDict(): 1442.\nto get the dict for an arbitrary type.\n\n'Inheritance:'\n\nThis field is not inherited by subtypes (though the attributes\ndefined in here are inherited through a different mechanism).\n\n'Default:'\n\nIf this field is 'NULL', *note PyTypeReady(): 567. will assign a\nnew dictionary to it.\n\nWarning: It is not safe to use *note PyDictSetItem(): 46bb.\non or otherwise modify *note tpdict: 1443. with the\ndictionary C-API.\n\n-- C Member: *note descrgetfunc: 48ae. *note PyTypeObject:\n8da.tpdescrget\n\nAn optional pointer to a \"descriptor get\" function.\n\nThe function signature is:\n\nPyObject * tpdescrget(PyObject *self, PyObject *obj, PyObject *type);\n\n'Inheritance:'\n\nThis field is inherited by subtypes.\n\n-- C Member: *note descrsetfunc: 48af. *note PyTypeObject:\n8da.tpdescrset\n\nAn optional pointer to a function for setting and deleting a\ndescriptor's value.\n\nThe function signature is:\n\nint tpdescrset(PyObject *self, PyObject *obj, PyObject *value);\n\nThe 'value' argument is set to 'NULL' to delete the value.\n\n'Inheritance:'\n\nThis field is inherited by subtypes.\n\n-- C Member: *note Pyssizet: 88d. *note PyTypeObject:\n8da.tpdictoffset\n\nWhile this field is still supported, *note PyTPFLAGSMANAGEDDICT:\n2b4. should be used instead, if at all possible.\n\nIf the instances of this type have a dictionary containing instance\nvariables, this field is non-zero and contains the offset in the\ninstances of the type of the instance variable dictionary; this\noffset is used by *note PyObjectGenericGetAttr(): 481d.\n\nDo not confuse this field with *note tpdict: 1443.; that is the\ndictionary for attributes of the type object itself.\n\nThe value specifies the offset of the dictionary from the start of\nthe instance structure.\n\nThe *note tpdictoffset: 49b3. should be regarded as write-only.\nTo get the pointer to the dictionary call *note\nPyObjectGenericGetDict(): 16a0.  Calling *note\nPyObjectGenericGetDict(): 16a0. may need to allocate memory for\nthe dictionary, so it is may be more efficient to call *note\nPyObjectGetAttr(): 4821. when accessing an attribute on the\nobject.\n\nIt is an error to set both the *note PyTPFLAGSMANAGEDWEAKREF:\n2b5. bit and *note tpdictoffset: 49b3.\n\n'Inheritance:'\n\nThis field is inherited by subtypes.  A subtype should not override\nthis offset; doing so could be unsafe, if C code tries to access\nthe dictionary at the previous offset.  To properly support\ninheritance, use *note PyTPFLAGSMANAGEDDICT: 2b4.\n\n'Default:'\n\nThis slot has no default.  For *note static types: 56a, if the\nfield is 'NULL' then no *note dict: aa8. gets created for\ninstances.\n\nIf the *note PyTPFLAGSMANAGEDDICT: 2b4. bit is set in the *note\ntpdict: 1443. field, then *note tpdictoffset: 49b3. will be set\nto '-1', to indicate that it is unsafe to use this field.\n\n-- C Member: *note initproc: 48b7. *note PyTypeObject: 8da.tpinit\n\nAn optional pointer to an instance initialization function.\n\nThis function corresponds to the *note init(): 47d. method of\nclasses.  Like 'init()', it is possible to create an instance\nwithout calling 'init()', and it is possible to reinitialize an\ninstance by calling its 'init()' method again.\n\nThe function signature is:\n\nint tpinit(PyObject *self, PyObject *args, PyObject *kwds);\n\nThe self argument is the instance to be initialized; the 'args' and\n'kwds' arguments represent positional and keyword arguments of the\ncall to *note init(): 47d.\n\nThe *note tpinit: 2e3. function, if not 'NULL', is called when an\ninstance is created normally by calling its type, after the type's\n*note tpnew: 2e1. function has returned an instance of the type.\nIf the *note tpnew: 2e1. function returns an instance of some\nother type that is not a subtype of the original type, no *note\ntpinit: 2e3. function is called; if *note tpnew: 2e1. returns an\ninstance of a subtype of the original type, the subtype's *note\ntpinit: 2e3. is called.\n\nReturns '0' on success, '-1' and sets an exception on error.\n\n'Inheritance:'\n\nThis field is inherited by subtypes.\n\n'Default:'\n\nFor *note static types: 56a. this field does not have a default.\n\n-- C Member: *note allocfunc: 48ac. *note PyTypeObject: 8da.tpalloc\n\nAn optional pointer to an instance allocation function.\n\nThe function signature is:\n\nPyObject *tpalloc(PyTypeObject *self, Pyssizet nitems);\n\n'Inheritance:'\n\nThis field is inherited by static subtypes, but not by dynamic\nsubtypes (subtypes created by a class statement).\n\n'Default:'\n\nFor dynamic subtypes, this field is always set to *note\nPyTypeGenericAlloc(): 899, to force a standard heap allocation\nstrategy.\n\nFor static subtypes, 'PyBaseObjectType' uses *note\nPyTypeGenericAlloc(): 899.  That is the recommended value for all\nstatically defined types.\n\n-- C Member: *note newfunc: 48bb. *note PyTypeObject: 8da.tpnew\n\nAn optional pointer to an instance creation function.\n\nThe function signature is:\n\nPyObject *tpnew(PyTypeObject *subtype, PyObject *args, PyObject *kwds);\n\nThe 'subtype' argument is the type of the object being created; the\n'args' and 'kwds' arguments represent positional and keyword\narguments of the call to the type.  Note that 'subtype' doesn't\nhave to equal the type whose *note tpnew: 2e1. function is called;\nit may be a subtype of that type (but not an unrelated type).\n\nThe *note tpnew: 2e1. function should call\n'subtype->tpalloc(subtype, nitems)' to allocate space for the\nobject, and then do only as much further initialization as is\nabsolutely necessary.  Initialization that can safely be ignored or\nrepeated should be placed in the *note tpinit: 2e3. handler.  A\ngood rule of thumb is that for immutable types, all initialization\nshould take place in *note tpnew: 2e1, while for mutable types,\nmost initialization should be deferred to *note tpinit: 2e3.\n\nSet the *note PyTPFLAGSDISALLOWINSTANTIATION: 2e4. flag to\ndisallow creating instances of the type in Python.\n\n'Inheritance:'\n\nThis field is inherited by subtypes, except it is not inherited by\n*note static types: 56a. whose *note tpbase: 46dc. is 'NULL' or\n'&PyBaseObjectType'.\n\n'Default:'\n\nFor *note static types: 56a. this field has no default.  This means\nif the slot is defined as 'NULL', the type cannot be called to\ncreate new instances; presumably there is some other way to create\ninstances, like a factory function.\n\n-- C Member: *note freefunc: 4aa0. *note PyTypeObject: 8da.tpfree\n\nAn optional pointer to an instance deallocation function.  Its\nsignature is:\n\nvoid tpfree(void *self);\n\nAn initializer that is compatible with this signature is *note\nPyObjectFree(): ab0.\n\n'Inheritance:'\n\nThis field is inherited by static subtypes, but not by dynamic\nsubtypes (subtypes created by a class statement)\n\n'Default:'\n\nIn dynamic subtypes, this field is set to a deallocator suitable to\nmatch *note PyTypeGenericAlloc(): 899. and the value of the *note\nPyTPFLAGSHAVEGC: 568. flag bit.\n\nFor static subtypes, 'PyBaseObjectType' uses *note PyObjectDel():\n132c.\n\n-- C Member: *note inquiry: 48b8. *note PyTypeObject: 8da.tpisgc\n\nAn optional pointer to a function called by the garbage collector.\n\nThe garbage collector needs to know whether a particular object is\ncollectible or not.  Normally, it is sufficient to look at the\nobject's type's *note tpflags: 1620. field, and check the *note\nPyTPFLAGSHAVEGC: 568. flag bit.  But some types have a mixture\nof statically and dynamically allocated instances, and the\nstatically allocated instances are not collectible.  Such types\nshould define this function; it should return '1' for a collectible\ninstance, and '0' for a non-collectible instance.  The signature\nis:\n\nint tpisgc(PyObject *self);\n\n(The only example of this are types themselves.  The metatype,\n*note PyTypeType: 2a5, defines this function to distinguish\nbetween statically and *note dynamically allocated types: 786.)\n\n'Inheritance:'\n\nThis field is inherited by subtypes.\n\n'Default:'\n\nThis slot has no default.  If this field is 'NULL', *note\nPyTPFLAGSHAVEGC: 568. is used as the functional equivalent.\n\n-- C Member: *note PyObject: 6b1. note PyTypeObject: 8da.tpbases\n\nTuple of base types.\n\nThis field should be set to 'NULL' and treated as read-only.\nPython will fill it in when the type is *note initialized: 567.\n\nFor dynamically created classes, the 'Pytpbases' *note slot:\n485e. can be used instead of the 'bases' argument of *note\nPyTypeFromSpecWithBases(): 2e0.  The argument form is preferred.\n\nWarning: Multiple inheritance does not work well for\nstatically defined types.  If you set 'tpbases' to a tuple,\nPython will not raise an error, but some slots will only be\ninherited from the first base.\n\n'Inheritance:'\n\nThis field is not inherited.\n\n-- C Member: *note PyObject: 6b1. note PyTypeObject: 8da.tpmro\n\nTuple containing the expanded set of base types, starting with the\ntype itself and ending with *note object: 8bb, in Method Resolution\nOrder.\n\nThis field should be set to 'NULL' and treated as read-only.\nPython will fill it in when the type is *note initialized: 567.\n\n'Inheritance:'\n\nThis field is not inherited; it is calculated fresh by *note\nPyTypeReady(): 567.\n\n-- C Member: *note PyObject: 6b1. note PyTypeObject: 8da.tpcache\n\nUnused.  Internal use only.\n\n'Inheritance:'\n\nThis field is not inherited.\n\n-- C Member: void note PyTypeObject: 8da.tpsubclasses\n\nA collection of subclasses.  Internal use only.  May be an invalid\npointer.\n\nTo get a list of subclasses, call the Python method *note\nsubclasses(): 2d3.\n\nChanged in version 3.12: For some types, this field does not hold a\nvalid *note PyObject: 6b1.*.  The type was changed to void* to\nindicate this.\n\n'Inheritance:'\n\nThis field is not inherited.\n\n-- C Member: *note PyObject: 6b1. note PyTypeObject: 8da.tpweaklist\n\nWeak reference list head, for weak references to this type object.\nNot inherited.  Internal use only.\n\nChanged in version 3.12: Internals detail: For the static builtin\ntypes this is always 'NULL', even if weakrefs are added.  Instead,\nthe weakrefs for each are stored on 'PyInterpreterState'.  Use the\npublic C-API or the internal 'PyObjectGETWEAKREFSLISTPTR()'\nmacro to avoid the distinction.\n\n'Inheritance:'\n\nThis field is not inherited.\n\n-- C Member: *note destructor: 48b0. *note PyTypeObject: 8da.tpdel\n\nThis field is deprecated.  Use *note tpfinalize: 8db. instead.\n\n-- C Member: unsigned int *note PyTypeObject: 8da.tpversiontag\n\nUsed to index into the method cache.  Internal use only.\n\n'Inheritance:'\n\nThis field is not inherited.\n\n-- C Member: *note destructor: 48b0. *note PyTypeObject:\n8da.tpfinalize\n\nAn optional pointer to an instance finalization function.  Its\nsignature is:\n\nvoid tpfinalize(PyObject *self);\n\nIf *note tpfinalize: 8db. is set, the interpreter calls it once\nwhen finalizing an instance.  It is called either from the garbage\ncollector (if the instance is part of an isolated reference cycle)\nor just before the object is deallocated.  Either way, it is\nguaranteed to be called before attempting to break reference\ncycles, ensuring that it finds the object in a sane state.\n\n*note tpfinalize: 8db. should not mutate the current exception\nstatus; therefore, a recommended way to write a non-trivial\nfinalizer is:\n\nstatic void\nlocalfinalize(PyObject *self)\n{\nPyObject *errortype, *errorvalue, *errortraceback;\n\n/* Save the current exception, if any. */\nPyErrFetch(&errortype, &errorvalue, &errortraceback);\n\n/* ... */\n\n/* Restore the saved exception. */\nPyErrRestore(errortype, errorvalue, errortraceback);\n}\n\nAlso, note that, in a garbage collected Python, *note tpdealloc:\n46d0. may be called from any Python thread, not just the thread\nwhich created the object (if the object becomes part of a refcount\ncycle, that cycle might be collected by a garbage collection on any\nthread).  This is not a problem for Python API calls, since the\nthread on which tpdealloc is called will own the Global\nInterpreter Lock (GIL). However, if the object being destroyed in\nturn destroys objects from some other C or C++ library, care should\nbe taken to ensure that destroying those objects on the thread\nwhich called tpdealloc will not violate any assumptions of the\nlibrary.\n\n'Inheritance:'\n\nThis field is inherited by subtypes.\n\nNew in version 3.4.\n\nChanged in version 3.8: Before version 3.8 it was necessary to set\nthe *note PyTPFLAGSHAVEFINALIZE: 336. flags bit in order for\nthis field to be used.  This is no longer required.\n\nSee also\n........\n\n\"Safe object finalization\" ( PEP 442(4))\n\n-- C Member: *note vectorcallfunc: 2b0. *note PyTypeObject:\n8da.tpvectorcall\n\nVectorcall function to use for calls of this type object.  In other\nwords, it is used to implement *note vectorcall: 2ab. for\n'type.call'.  If 'tpvectorcall' is 'NULL', the default call\nimplementation using *note new(): 2e2. and *note init():\n47d. is used.\n\n'Inheritance:'\n\nThis field is never inherited.\n\nNew in version 3.9: (the field exists since 3.8 but it's only used\nsince 3.9)\n\n-- C Member: unsigned char *note PyTypeObject: 8da.tpwatched\n\nInternal.  Do not use.\n\nNew in version 3.12.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0634/\n\n(2) https://peps.python.org/pep-0634/\n\n(3) https://bugs.python.org/issue40217\n\n(4) https://peps.python.org/pep-0442/\n\nFile: python3.12.info,  Node: Static Types,  Next: Heap Types,  Prev: PyTypeObject Slots,  Up: Type Objects<3>\n\n7.12.3.9 Static Types\n.....................\n",
            "subsections": []
        },
        "Traditionally, types defined in C code are 'static', that is, a static": {
            "content": "*note PyTypeObject: 8da. structure is defined directly in code and\ninitialized using *note PyTypeReady(): 567.\n",
            "subsections": []
        },
        "This results in types that are limited relative to types defined in": {
            "content": "Python:\n\n* Static types are limited to one base, i.e.  they cannot use\nmultiple inheritance.\n\n* Static type objects (but not necessarily their instances) are\nimmutable.  It is not possible to add or modify the type object's\nattributes from Python.\n\n* Static type objects are shared across *note sub-interpreters: 2e9,\nso they should not include any subinterpreter-specific state.\n\nAlso, since *note PyTypeObject: 8da. is only part of the *note Limited\nAPI: 2a8. as an opaque struct, any extension modules using static types\nmust be compiled for a specific Python minor version.\n\nFile: python3.12.info,  Node: Heap Types,  Prev: Static Types,  Up: Type Objects<3>\n\n7.12.3.10 Heap Types\n....................\n\nAn alternative to *note static types: 56a. is 'heap-allocated types', or\n'heap types' for short, which correspond closely to classes created by\nPython's 'class' statement.  Heap types have the *note\nPyTPFLAGSHEAPTYPE: 6c7. flag set.\n\nThis is done by filling a *note PyTypeSpec: 1425. structure and calling\n*note PyTypeFromSpec(): 2df, *note PyTypeFromSpecWithBases(): 2e0,\n*note PyTypeFromModuleAndSpec(): 2aa, or *note PyTypeFromMetaclass():\n2a9.\n\nFile: python3.12.info,  Node: Number Object Structures,  Next: Mapping Object Structures,  Prev: Type Objects<3>,  Up: Object Implementation Support\n\n\n-- C Type: type PyNumberMethods\n\nThis structure holds pointers to the functions which an object uses\nto implement the number protocol.  Each function is used by the\nfunction of similar name documented in the *note Number Protocol:\n495e. section.\n\nHere is the structure definition:\n\ntypedef struct {\nbinaryfunc nbadd;\nbinaryfunc nbsubtract;\nbinaryfunc nbmultiply;\nbinaryfunc nbremainder;\nbinaryfunc nbdivmod;\nternaryfunc nbpower;\nunaryfunc nbnegative;\nunaryfunc nbpositive;\nunaryfunc nbabsolute;\ninquiry nbbool;\nunaryfunc nbinvert;\nbinaryfunc nblshift;\nbinaryfunc nbrshift;\nbinaryfunc nband;\nbinaryfunc nbxor;\nbinaryfunc nbor;\nunaryfunc nbint;\nvoid *nbreserved;\nunaryfunc nbfloat;\n\nbinaryfunc nbinplaceadd;\nbinaryfunc nbinplacesubtract;\nbinaryfunc nbinplacemultiply;\nbinaryfunc nbinplaceremainder;\nternaryfunc nbinplacepower;\nbinaryfunc nbinplacelshift;\nbinaryfunc nbinplacershift;\nbinaryfunc nbinplaceand;\nbinaryfunc nbinplacexor;\nbinaryfunc nbinplaceor;\n\nbinaryfunc nbfloordivide;\nbinaryfunc nbtruedivide;\nbinaryfunc nbinplacefloordivide;\nbinaryfunc nbinplacetruedivide;\n\nunaryfunc nbindex;\n\nbinaryfunc nbmatrixmultiply;\nbinaryfunc nbinplacematrixmultiply;\n} PyNumberMethods;\n\nNote: Binary and ternary functions must check the type of all\ntheir operands, and implement the necessary conversions (at\nleast one of the operands is an instance of the defined type).\nIf the operation is not defined for the given operands, binary\nand ternary functions must return 'PyNotImplemented', if\nanother error occurred they must return 'NULL' and set an\nexception.\n\nNote: The *note nbreserved: 4c13. field should always be\n'NULL'.  It was previously called 'nblong', and was renamed\nin Python 3.0.1.\n\n-- C Member: *note binaryfunc: 48ad. *note PyNumberMethods: 1274.nbadd\n\n-- C Member: *note binaryfunc: 48ad. *note PyNumberMethods:\n1274.nbsubtract\n\n-- C Member: *note binaryfunc: 48ad. *note PyNumberMethods:\n1274.nbmultiply\n\n-- C Member: *note binaryfunc: 48ad. *note PyNumberMethods:\n1274.nbremainder\n\n-- C Member: *note binaryfunc: 48ad. *note PyNumberMethods:\n1274.nbdivmod\n\n-- C Member: *note ternaryfunc: 48c6. *note PyNumberMethods:\n1274.nbpower\n\n-- C Member: *note unaryfunc: 48c8. *note PyNumberMethods:\n1274.nbnegative\n\n-- C Member: *note unaryfunc: 48c8. *note PyNumberMethods:\n1274.nbpositive\n\n-- C Member: *note unaryfunc: 48c8. *note PyNumberMethods:\n1274.nbabsolute\n\n-- C Member: *note inquiry: 48b8. *note PyNumberMethods: 1274.nbbool\n\n-- C Member: *note unaryfunc: 48c8. *note PyNumberMethods:\n1274.nbinvert\n\n-- C Member: *note binaryfunc: 48ad. *note PyNumberMethods:\n1274.nblshift\n\n-- C Member: *note binaryfunc: 48ad. *note PyNumberMethods:\n1274.nbrshift\n\n-- C Member: *note binaryfunc: 48ad. *note PyNumberMethods: 1274.nband\n\n-- C Member: *note binaryfunc: 48ad. *note PyNumberMethods: 1274.nbxor\n\n-- C Member: *note binaryfunc: 48ad. *note PyNumberMethods: 1274.nbor\n\n-- C Member: *note unaryfunc: 48c8. *note PyNumberMethods: 1274.nbint\n\n-- C Member: void note PyNumberMethods: 1274.nbreserved\n\n-- C Member: *note unaryfunc: 48c8. *note PyNumberMethods:\n1274.nbfloat\n\n-- C Member: *note binaryfunc: 48ad. *note PyNumberMethods:\n1274.nbinplaceadd\n\n-- C Member: *note binaryfunc: 48ad. *note PyNumberMethods:\n1274.nbinplacesubtract\n\n-- C Member: *note binaryfunc: 48ad. *note PyNumberMethods:\n1274.nbinplacemultiply\n\n-- C Member: *note binaryfunc: 48ad. *note PyNumberMethods:\n1274.nbinplaceremainder\n\n-- C Member: *note ternaryfunc: 48c6. *note PyNumberMethods:\n1274.nbinplacepower\n\n-- C Member: *note binaryfunc: 48ad. *note PyNumberMethods:\n1274.nbinplacelshift\n\n-- C Member: *note binaryfunc: 48ad. *note PyNumberMethods:\n1274.nbinplacershift\n\n-- C Member: *note binaryfunc: 48ad. *note PyNumberMethods:\n1274.nbinplaceand\n\n-- C Member: *note binaryfunc: 48ad. *note PyNumberMethods:\n1274.nbinplacexor\n\n-- C Member: *note binaryfunc: 48ad. *note PyNumberMethods:\n1274.nbinplaceor\n\n-- C Member: *note binaryfunc: 48ad. *note PyNumberMethods:\n1274.nbfloordivide\n\n-- C Member: *note binaryfunc: 48ad. *note PyNumberMethods:\n1274.nbtruedivide\n\n-- C Member: *note binaryfunc: 48ad. *note PyNumberMethods:\n1274.nbinplacefloordivide\n\n-- C Member: *note binaryfunc: 48ad. *note PyNumberMethods:\n1274.nbinplacetruedivide\n\n-- C Member: *note unaryfunc: 48c8. *note PyNumberMethods:\n1274.nbindex\n\n-- C Member: *note binaryfunc: 48ad. *note PyNumberMethods:\n1274.nbmatrixmultiply\n\n-- C Member: *note binaryfunc: 48ad. *note PyNumberMethods:\n1274.nbinplacematrixmultiply\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Mapping Object Structures,  Next: Sequence Object Structures,  Prev: Number Object Structures,  Up: Object Implementation Support": {
            "content": "-- C Type: type PyMappingMethods\n\nThis structure holds pointers to the functions which an object uses\nto implement the mapping protocol.  It has three members:\n\n-- C Member: *note lenfunc: 48ba. *note PyMappingMethods:\n46f7.mplength\n\nThis function is used by *note PyMappingSize(): 17d7. and *note\nPyObjectSize(): 4829, and has the same signature.  This slot may\nbe set to 'NULL' if the object has no defined length.\n\n-- C Member: *note binaryfunc: 48ad. *note PyMappingMethods:\n46f7.mpsubscript\n\nThis function is used by *note PyObjectGetItem(): 4735. and *note\nPySequenceGetSlice(): 4834, and has the same signature as\n'PyObjectGetItem()'.  This slot must be filled for the *note\nPyMappingCheck(): 47de. function to return '1', it can be 'NULL'\notherwise.\n\n-- C Member: *note objobjargproc: 48bc. *note PyMappingMethods:\n46f7.mpasssubscript\n\nThis function is used by *note PyObjectSetItem(): 4733, *note\nPyObjectDelItem(): 481b, *note PySequenceSetSlice(): 483b. and\n*note PySequenceDelSlice(): 4832.  It has the same signature as\n'PyObjectSetItem()', but 'v' can also be set to 'NULL' to delete\nan item.  If this slot is 'NULL', the object does not support item\nassignment and deletion.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Sequence Object Structures,  Next: Buffer Object Structures,  Prev: Mapping Object Structures,  Up: Object Implementation Support": {
            "content": "-- C Type: type PySequenceMethods\n\nThis structure holds pointers to the functions which an object uses\nto implement the sequence protocol.\n\n-- C Member: *note lenfunc: 48ba. *note PySequenceMethods:\n46f6.sqlength\n\nThis function is used by *note PySequenceSize(): 17d3. and *note\nPyObjectSize(): 4829, and has the same signature.  It is also used\nfor handling negative indices via the *note sqitem: 1692. and the\n*note sqassitem: 4c1f. slots.\n\n-- C Member: *note binaryfunc: 48ad. *note PySequenceMethods:\n46f6.sqconcat\n\nThis function is used by *note PySequenceConcat(): 482f. and has\nthe same signature.  It is also used by the '+' operator, after\ntrying the numeric addition via the *note nbadd: 49aa. slot.\n\n-- C Member: *note ssizeargfunc: 48c4. *note PySequenceMethods:\n46f6.sqrepeat\n\nThis function is used by *note PySequenceRepeat(): 483a. and has\nthe same signature.  It is also used by the '*' operator, after\ntrying numeric multiplication via the *note nbmultiply: 4bfc.\nslot.\n\n-- C Member: *note ssizeargfunc: 48c4. *note PySequenceMethods:\n46f6.sqitem\n\nThis function is used by *note PySequenceGetItem(): 17d4. and has\nthe same signature.  It is also used by *note PyObjectGetItem():\n4735, after trying the subscription via the *note mpsubscript:\n1693. slot.  This slot must be filled for the *note\nPySequenceCheck(): 482e. function to return '1', it can be 'NULL'\notherwise.\n\nNegative indexes are handled as follows: if the *note sqlength:\n49b2. slot is filled, it is called and the sequence length is used\nto compute a positive index which is passed to *note sqitem: 1692.\nIf 'sqlength' is 'NULL', the index is passed as is to the\nfunction.\n\n-- C Member: *note ssizeobjargproc: 48c5. *note PySequenceMethods:\n46f6.sqassitem\n\nThis function is used by *note PySequenceSetItem(): 17d5. and has\nthe same signature.  It is also used by *note PyObjectSetItem():\n4733. and *note PyObjectDelItem(): 481b, after trying the item\nassignment and deletion via the *note mpasssubscript: 4c1c. slot.\nThis slot may be left to 'NULL' if the object does not support item\nassignment and deletion.\n\n-- C Member: *note objobjproc: 48bd. *note PySequenceMethods:\n46f6.sqcontains\n\nThis function may be used by *note PySequenceContains(): 4830. and\nhas the same signature.  This slot may be left to 'NULL', in this\ncase 'PySequenceContains()' simply traverses the sequence until it\nfinds a match.\n\n-- C Member: *note binaryfunc: 48ad. *note PySequenceMethods:\n46f6.sqinplaceconcat\n\nThis function is used by *note PySequenceInPlaceConcat(): 4835.\nand has the same signature.  It should modify its first operand,\nand return it.  This slot may be left to 'NULL', in this case\n'PySequenceInPlaceConcat()' will fall back to *note\nPySequenceConcat(): 482f.  It is also used by the augmented\nassignment '+=', after trying numeric in-place addition via the\n*note nbinplaceadd: 4bf9. slot.\n\n-- C Member: *note ssizeargfunc: 48c4. *note PySequenceMethods:\n46f6.sqinplacerepeat\n\nThis function is used by *note PySequenceInPlaceRepeat(): 4836.\nand has the same signature.  It should modify its first operand,\nand return it.  This slot may be left to 'NULL', in this case\n'PySequenceInPlaceRepeat()' will fall back to *note\nPySequenceRepeat(): 483a.  It is also used by the augmented\nassignment '*=', after trying numeric in-place multiplication via\nthe *note nbinplacemultiply: 4bfd. slot.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Buffer Object Structures,  Next: Async Object Structures,  Prev: Sequence Object Structures,  Up: Object Implementation Support": {
            "content": "-- C Type: type PyBufferProcs\n\nThis structure holds pointers to the functions required by the\n*note Buffer protocol: 148.  The protocol defines how an exporter\nobject can expose its internal data to consumer objects.\n\n-- C Member: *note getbufferproc: 48b3. *note PyBufferProcs:\n49b9.bfgetbuffer\n\nThe signature of this function is:\n\nint (PyObject *exporter, Pybuffer *view, int flags);\n\nHandle a request to 'exporter' to fill in 'view' as specified by\n'flags'.  Except for point (3), an implementation of this function\nMUST take these steps:\n\n1. Check if the request can be met.  If not, raise *note\nBufferError: 1586, set view->obj to 'NULL' and return '-1'.\n\n2. Fill in the requested fields.\n\n3. Increment an internal counter for the number of exports.\n\n4. Set view->obj to 'exporter' and increment view->obj.\n\n5. Return '0'.\n\nIf 'exporter' is part of a chain or tree of buffer providers, two\nmain schemes can be used:\n\n* Re-export: Each member of the tree acts as the exporting\nobject and sets view->obj to a new reference to itself.\n\n* Redirect: The buffer request is redirected to the root object\nof the tree.  Here, view->obj will be a new reference to the\nroot object.\n\nThe individual fields of 'view' are described in section *note\nBuffer structure: 4974, the rules how an exporter must react to\nspecific requests are in section *note Buffer request types: 4140.\n\nAll memory pointed to in the *note Pybuffer: 53f. structure\nbelongs to the exporter and must remain valid until there are no\nconsumers left.  *note format: 497e, *note shape: 4980, *note\nstrides: 4978, *note suboffsets: 4982. and *note internal: 4985.\nare read-only for the consumer.\n\n*note PyBufferFillInfo(): 549. provides an easy way of exposing a\nsimple bytes buffer while dealing correctly with all request types.\n\n*note PyObjectGetBuffer(): 541. is the interface for the consumer\nthat wraps this function.\n\n-- C Member: *note releasebufferproc: 48be. *note PyBufferProcs:\n49b9.bfreleasebuffer\n\nThe signature of this function is:\n\nvoid (PyObject *exporter, Pybuffer *view);\n\nHandle a request to release the resources of the buffer.  If no\nresources need to be released, *note\nPyBufferProcs.bfreleasebuffer: 54d. may be 'NULL'.  Otherwise, a\nstandard implementation of this function will take these optional\nsteps:\n\n1. Decrement an internal counter for the number of exports.\n\n2. If the counter is '0', free all memory associated with 'view'.\n\nThe exporter MUST use the *note internal: 4985. field to keep track\nof buffer-specific resources.  This field is guaranteed to remain\nconstant, while a consumer MAY pass a copy of the original buffer\nas the 'view' argument.\n\nThis function MUST NOT decrement view->obj, since that is done\nautomatically in *note PyBufferRelease(): 54a. (this scheme is\nuseful for breaking reference cycles).\n\n*note PyBufferRelease(): 54a. is the interface for the consumer\nthat wraps this function.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Async Object Structures,  Next: Slot Type typedefs,  Prev: Buffer Object Structures,  Up: Object Implementation Support": {
            "content": "New in version 3.5.\n\n-- C Type: type PyAsyncMethods\n\nThis structure holds pointers to the functions required to\nimplement *note awaitable: ac3. and *note asynchronous iterator:\nbd4. objects.\n\nHere is the structure definition:\n\ntypedef struct {\nunaryfunc amawait;\nunaryfunc amaiter;\nunaryfunc amanext;\nsendfunc amsend;\n} PyAsyncMethods;\n\n-- C Member: *note unaryfunc: 48c8. *note PyAsyncMethods: 49b1.amawait\n\nThe signature of this function is:\n\nPyObject *amawait(PyObject *self);\n\nThe returned object must be an *note iterator: 16a9, i.e.  *note\nPyIterCheck(): 1659. must return '1' for it.\n\nThis slot may be set to 'NULL' if an object is not an *note\nawaitable: ac3.\n\n-- C Member: *note unaryfunc: 48c8. *note PyAsyncMethods: 49b1.amaiter\n\nThe signature of this function is:\n\nPyObject *amaiter(PyObject *self);\n\nMust return an *note asynchronous iterator: bd4. object.  See *note\nanext(): 1c2a. for details.\n\nThis slot may be set to 'NULL' if an object does not implement\nasynchronous iteration protocol.\n\n-- C Member: *note unaryfunc: 48c8. *note PyAsyncMethods: 49b1.amanext\n\nThe signature of this function is:\n\nPyObject *amanext(PyObject *self);\n\nMust return an *note awaitable: ac3. object.  See *note\nanext(): 1c2a. for details.  This slot may be set to 'NULL'.\n\n-- C Member: *note sendfunc: 4bf8. *note PyAsyncMethods: 49b1.amsend\n\nThe signature of this function is:\n\nPySendResult amsend(PyObject *self, PyObject *arg, PyObject result);\n\nSee *note PyIterSend(): 6a7. for details.  This slot may be set to\n'NULL'.\n\nNew in version 3.10.\n\nFile: python3.12.info,  Node: Slot Type typedefs,  Next: Examples<38>,  Prev: Async Object Structures,  Up: Object Implementation Support\n\n\n-- C Type: typedef *note PyObject: 6b1. *(*allocfunc)(*note\nPyTypeObject: 8da. *cls, *note Pyssizet: 88d. nitems)\n' Part of the *note Stable ABI: 2ac.'  The purpose of this function\nis to separate memory allocation from memory initialization.  It\nshould return a pointer to a block of memory of adequate length for\nthe instance, suitably aligned, and initialized to zeros, but with\n*note obrefcnt: 6b0. set to '1' and *note obtype: 46ce. set to\nthe type argument.  If the type's *note tpitemsize: 1c77. is\nnon-zero, the object's *note obsize: 4899. field should be\ninitialized to 'nitems' and the length of the allocated memory\nblock should be 'tpbasicsize + nitems*tpitemsize', rounded up to\na multiple of 'sizeof(void*)'; otherwise, 'nitems' is not used and\nthe length of the block should be *note tpbasicsize: 7ab.\n\nThis function should not do any other instance initialization, not\neven to allocate additional memory; that should be done by *note\ntpnew: 2e1.\n\n-- C Type: typedef void (*destructor)(*note PyObject: 6b1.*)\n' Part of the *note Stable ABI: 2ac.'\n\n-- C Type: typedef void (*freefunc)(void*)\n\nSee *note tpfree: 46d1.\n\n-- C Type: typedef *note PyObject: 6b1. *(*newfunc)(*note PyObject:\n6b1.*, *note PyObject: 6b1.*, *note PyObject: 6b1.*)\n' Part of the *note Stable ABI: 2ac.'  See *note tpnew: 2e1.\n\n-- C Type: typedef int (*initproc)(*note PyObject: 6b1.*, *note\nPyObject: 6b1.*, *note PyObject: 6b1.*)\n' Part of the *note Stable ABI: 2ac.'  See *note tpinit: 2e3.\n\n-- C Type: typedef *note PyObject: 6b1. *(*reprfunc)(*note PyObject:\n6b1.*)\n' Part of the *note Stable ABI: 2ac.'  See *note tprepr: 46e5.\n\n-- C Type: typedef *note PyObject: 6b1. *(*getattrfunc)(*note PyObject:\n6b1. *self, char *attr)\n' Part of the *note Stable ABI: 2ac.'  Return the value of the\nnamed attribute for the object.\n\n-- C Type: typedef int (*setattrfunc)(*note PyObject: 6b1. *self, char\n*attr, *note PyObject: 6b1. *value)\n' Part of the *note Stable ABI: 2ac.'  Set the value of the named\nattribute for the object.  The value argument is set to 'NULL' to\ndelete the attribute.\n\n-- C Type: typedef *note PyObject: 6b1. *(*getattrofunc)(*note\nPyObject: 6b1. *self, *note PyObject: 6b1. *attr)\n' Part of the *note Stable ABI: 2ac.'  Return the value of the\nnamed attribute for the object.\n\nSee *note tpgetattro: 46e9.\n\n-- C Type: typedef int (*setattrofunc)(*note PyObject: 6b1. *self,\n*note PyObject: 6b1. *attr, *note PyObject: 6b1. *value)\n' Part of the *note Stable ABI: 2ac.'  Set the value of the named\nattribute for the object.  The value argument is set to 'NULL' to\ndelete the attribute.\n\nSee *note tpsetattro: 46ea.\n\n-- C Type: typedef *note PyObject: 6b1. *(*descrgetfunc)(*note\nPyObject: 6b1.*, *note PyObject: 6b1.*, *note PyObject: 6b1.*)\n' Part of the *note Stable ABI: 2ac.'  See *note tpdescrget:\n4bed.\n\n-- C Type: typedef int (*descrsetfunc)(*note PyObject: 6b1.*, *note\nPyObject: 6b1.*, *note PyObject: 6b1.*)\n' Part of the *note Stable ABI: 2ac.'  See *note tpdescrset:\n165b.\n\n-- C Type: typedef *note Pyhasht: 10dc. (*hashfunc)(*note PyObject:\n6b1.*)\n' Part of the *note Stable ABI: 2ac.'  See *note tphash: 46f8.\n\n-- C Type: typedef *note PyObject: 6b1. *(*richcmpfunc)(*note PyObject:\n6b1.*, *note PyObject: 6b1.*, int)\n' Part of the *note Stable ABI: 2ac.'  See *note tprichcompare:\n46f2.\n\n-- C Type: typedef *note PyObject: 6b1. *(*getiterfunc)(*note PyObject:\n6b1.*)\n' Part of the *note Stable ABI: 2ac.'  See *note tpiter: 1348.\n\n-- C Type: typedef *note PyObject: 6b1. *(*iternextfunc)(*note\nPyObject: 6b1.*)\n' Part of the *note Stable ABI: 2ac.'  See *note tpiternext: 1349.\n\n-- C Type: typedef *note Pyssizet: 88d. (*lenfunc)(*note PyObject:\n6b1.*)\n' Part of the *note Stable ABI: 2ac.'\n\n-- C Type: typedef int (*getbufferproc)(*note PyObject: 6b1.*, *note\nPybuffer: 53f.*, int)\n' Part of the *note Stable ABI: 2ac. since version 3.12.'\n\n-- C Type: typedef void (*releasebufferproc)(*note PyObject: 6b1.*,\n*note Pybuffer: 53f.*)\n' Part of the *note Stable ABI: 2ac. since version 3.12.'\n\n-- C Type: typedef *note PyObject: 6b1. *(*unaryfunc)(*note PyObject:\n6b1.*)\n' Part of the *note Stable ABI: 2ac.'\n\n-- C Type: typedef *note PyObject: 6b1. *(*binaryfunc)(*note PyObject:\n6b1.*, *note PyObject: 6b1.*)\n' Part of the *note Stable ABI: 2ac.'\n\n-- C Type: typedef *note PySendResult: 4970. (*sendfunc)(*note\nPyObject: 6b1.*, *note PyObject: 6b1.*, *note PyObject:\n6b1.)\n\nSee *note amsend: 4bf7.\n\n-- C Type: typedef *note PyObject: 6b1. *(*ternaryfunc)(*note PyObject:\n6b1.*, *note PyObject: 6b1.*, *note PyObject: 6b1.*)\n' Part of the *note Stable ABI: 2ac.'\n\n-- C Type: typedef *note PyObject: 6b1. *(*ssizeargfunc)(*note\nPyObject: 6b1.*, *note Pyssizet: 88d.)\n' Part of the *note Stable ABI: 2ac.'\n\n-- C Type: typedef int (*ssizeobjargproc)(*note PyObject: 6b1.*, *note\nPyssizet: 88d, *note PyObject: 6b1.*)\n' Part of the *note Stable ABI: 2ac.'\n\n-- C Type: typedef int (*objobjproc)(*note PyObject: 6b1.*, *note\nPyObject: 6b1.*)\n' Part of the *note Stable ABI: 2ac.'\n\n-- C Type: typedef int (*objobjargproc)(*note PyObject: 6b1.*, *note\nPyObject: 6b1.*, *note PyObject: 6b1.*)\n' Part of the *note Stable ABI: 2ac.'\n\nFile: python3.12.info,  Node: Examples<38>,  Next: Supporting Cyclic Garbage Collection,  Prev: Slot Type typedefs,  Up: Object Implementation Support\n\n",
            "subsections": []
        },
        "The following are simple examples of Python type definitions.  They": {
            "content": "include common usage you may encounter.  Some demonstrate tricky corner\ncases.  For more examples, practical info, and a tutorial, see *note\nDefining Extension Types; Tutorial: 46c7. and *note Defining Extension\nTypes; Assorted Topics: 46e0.\n\nA basic *note static type: 56a.:\n\ntypedef struct {\nPyObjectHEAD\nconst char *data;\n} MyObject;\n\nstatic PyTypeObject MyObjectType = {\nPyVarObjectHEADINIT(NULL, 0)\n.tpname = \"mymod.MyObject\",\n.tpbasicsize = sizeof(MyObject),\n.tpdoc = PyDocSTR(\"My objects\"),\n.tpnew = myobjnew,\n.tpdealloc = (destructor)myobjdealloc,\n.tprepr = (reprfunc)myobjrepr,\n};\n",
            "subsections": []
        },
        "You may also find older code (especially in the CPython code base) with": {
            "content": "a more verbose initializer:\n\nstatic PyTypeObject MyObjectType = {\nPyVarObjectHEADINIT(NULL, 0)\n\"mymod.MyObject\",               /* tpname */\nsizeof(MyObject),               /* tpbasicsize */\n0,                              /* tpitemsize */\n(destructor)myobjdealloc,      /* tpdealloc */\n0,                              /* tpvectorcalloffset */\n0,                              /* tpgetattr */\n0,                              /* tpsetattr */\n0,                              /* tpasasync */\n(reprfunc)myobjrepr,           /* tprepr */\n0,                              /* tpasnumber */\n0,                              /* tpassequence */\n0,                              /* tpasmapping */\n0,                              /* tphash */\n0,                              /* tpcall */\n0,                              /* tpstr */\n0,                              /* tpgetattro */\n0,                              /* tpsetattro */\n0,                              /* tpasbuffer */\n0,                              /* tpflags */\nPyDocSTR(\"My objects\"),        /* tpdoc */\n0,                              /* tptraverse */\n0,                              /* tpclear */\n0,                              /* tprichcompare */\n0,                              /* tpweaklistoffset */\n0,                              /* tpiter */\n0,                              /* tpiternext */\n0,                              /* tpmethods */\n0,                              /* tpmembers */\n0,                              /* tpgetset */\n0,                              /* tpbase */\n0,                              /* tpdict */\n0,                              /* tpdescrget */\n0,                              /* tpdescrset */\n0,                              /* tpdictoffset */\n0,                              /* tpinit */\n0,                              /* tpalloc */\nmyobjnew,                      /* tpnew */\n};\n\nA type that supports weakrefs, instance dicts, and hashing:\n\ntypedef struct {\nPyObjectHEAD\nconst char *data;\n} MyObject;\n\nstatic PyTypeObject MyObjectType = {\nPyVarObjectHEADINIT(NULL, 0)\n.tpname = \"mymod.MyObject\",\n.tpbasicsize = sizeof(MyObject),\n.tpdoc = PyDocSTR(\"My objects\"),\n.tpflags = PyTPFLAGSDEFAULT | PyTPFLAGSBASETYPE |\nPyTPFLAGSHAVEGC | PyTPFLAGSMANAGEDDICT |\nPyTPFLAGSMANAGEDWEAKREF,\n.tpnew = myobjnew,\n.tptraverse = (traverseproc)myobjtraverse,\n.tpclear = (inquiry)myobjclear,\n.tpalloc = PyTypeGenericNew,\n.tpdealloc = (destructor)myobjdealloc,\n.tprepr = (reprfunc)myobjrepr,\n.tphash = (hashfunc)myobjhash,\n.tprichcompare = PyBaseObjectType.tprichcompare,\n};\n\nA str subclass that cannot be subclassed and cannot be called to create\ninstances (e.g.  uses a separate factory func) using *note\nPyTPFLAGSDISALLOWINSTANTIATION: 2e4. flag:\n\ntypedef struct {\nPyUnicodeObject raw;\nchar *extra;\n} MyStr;\n\nstatic PyTypeObject MyStrType = {\nPyVarObjectHEADINIT(NULL, 0)\n.tpname = \"mymod.MyStr\",\n.tpbasicsize = sizeof(MyStr),\n.tpbase = NULL,  // set to &PyUnicodeType in module init\n.tpdoc = PyDocSTR(\"my custom str\"),\n.tpflags = PyTPFLAGSDEFAULT | PyTPFLAGSDISALLOWINSTANTIATION,\n.tprepr = (reprfunc)myobjrepr,\n};\n\nThe simplest *note static type: 56a. with fixed-length instances:\n\ntypedef struct {\nPyObjectHEAD\n} MyObject;\n\nstatic PyTypeObject MyObjectType = {\nPyVarObjectHEADINIT(NULL, 0)\n.tpname = \"mymod.MyObject\",\n};\n\nThe simplest *note static type: 56a. with variable-length instances:\n\ntypedef struct {\nPyObjectVARHEAD\nconst char *data[1];\n} MyObject;\n\nstatic PyTypeObject MyObjectType = {\nPyVarObjectHEADINIT(NULL, 0)\n.tpname = \"mymod.MyObject\",\n.tpbasicsize = sizeof(MyObject) - sizeof(char *),\n.tpitemsize = sizeof(char *),\n};\n\nFile: python3.12.info,  Node: Supporting Cyclic Garbage Collection,  Prev: Examples<38>,  Up: Object Implementation Support\n\n",
            "subsections": []
        },
        "Python's support for detecting and collecting garbage which involves": {
            "content": "circular references requires support from object types which are\n\"containers\" for other objects which may also be containers.  Types\nwhich do not store references to other objects, or which only store\nreferences to atomic types (such as numbers or strings), do not need to\nprovide any explicit support for garbage collection.\n\nTo create a container type, the *note tpflags: 1620. field of the type\nobject must include the *note PyTPFLAGSHAVEGC: 568. and provide an\nimplementation of the *note tptraverse: 569. handler.  If instances of\nthe type are mutable, a *note tpclear: 46e3. implementation must also\nbe provided.\n\n*note PyTPFLAGSHAVEGC: 568.\n\nObjects with a type with this flag set must conform with the rules\ndocumented here.  For convenience these objects will be referred to\nas container objects.\n\nConstructors for container types must conform to two rules:\n\n1. The memory for the object must be allocated using *note\nPyObjectGCNew: 8d7. or *note PyObjectGCNewVar: 8d8.\n\n2. Once all the fields which may contain references to other\ncontainers are initialized, it must call *note PyObjectGCTrack():\n1360.\n",
            "subsections": []
        },
        "Similarly, the deallocator for the object must conform to a similar pair": {
            "content": "of rules:\n\n1. Before fields which refer to other containers are invalidated,\n*note PyObjectGCUnTrack(): 1361. must be called.\n\n2. The object's memory must be deallocated using *note\nPyObjectGCDel(): 135f.\n\nWarning: If a type adds the PyTPFLAGSHAVEGC, then it 'must'\nimplement at least a *note tptraverse: 569. handler or\nexplicitly use one from its subclass or subclasses.\n\nWhen calling *note PyTypeReady(): 567. or some of the APIs\nthat indirectly call it like *note PyTypeFromSpecWithBases():\n2e0. or *note PyTypeFromSpec(): 2df. the interpreter will\nautomatically populate the *note tpflags: 1620, *note\ntptraverse: 569. and *note tpclear: 46e3. fields if the type\ninherits from a class that implements the garbage collector\nprotocol and the child class does 'not' include the *note\nPyTPFLAGSHAVEGC: 568. flag.\n\n-- C Macro: PyObjectGCNew (TYPE, typeobj)\n\nAnalogous to *note PyObjectNew: 7a9. but for container objects\nwith the *note PyTPFLAGSHAVEGC: 568. flag set.\n\n-- C Macro: PyObjectGCNewVar (TYPE, typeobj, size)\n\nAnalogous to *note PyObjectNewVar: 7aa. but for container objects\nwith the *note PyTPFLAGSHAVEGC: 568. flag set.\n\n-- C Function: *note PyObject: 6b1.\n*PyUnstableObjectGCNewWithExtraData (PyTypeObject *type,\nsizet extrasize)\n\nThis is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 29f. It may change without warning in minor releases.':\nAnalogous to *note PyObjectGCNew: 8d7. but allocates 'extrasize'\nbytes at the end of the object (at offset *note tpbasicsize:\n7ab.).  The allocated memory is initialized to zeros, except for\nthe *note Python object header: 6b1.\n\nThe extra data will be deallocated with the object, but otherwise\nit is not managed by Python.\n\nWarning: The function is marked as unstable because the final\nmechanism for reserving extra data after an instance is not\nyet decided.  For allocating a variable number of fields,\nprefer using *note PyVarObject: 3dfd. and *note tpitemsize:\n1c77. instead.\n\nNew in version 3.12.\n\n-- C Macro: PyObjectGCResize (TYPE, op, newsize)\n\nResize an object allocated by *note PyObjectNewVar: 7aa.  Returns\nthe resized object of type 'TYPE*' (refers to any C type) or 'NULL'\non failure.\n\n'op' must be of type *note PyVarObject: 3dfd.* and must not be\ntracked by the collector yet.  'newsize' must be of type *note\nPyssizet: 88d.\n\n-- C Function: void PyObjectGCTrack (PyObject *op)\n' Part of the *note Stable ABI: 2ac.'  Adds the object 'op' to the\nset of container objects tracked by the collector.  The collector\ncan run at unexpected times so objects must be valid while being\ntracked.  This should be called once all the fields followed by the\n*note tptraverse: 569. handler become valid, usually near the end\nof the constructor.\n\n-- C Function: int PyObjectISGC (PyObject *obj)\n\nReturns non-zero if the object implements the garbage collector\nprotocol, otherwise returns 0.\n\nThe object cannot be tracked by the garbage collector if this\nfunction returns 0.\n\n-- C Function: int PyObjectGCIsTracked (PyObject *op)\n' Part of the *note Stable ABI: 2ac. since version 3.9.'  Returns 1\nif the object type of 'op' implements the GC protocol and 'op' is\nbeing currently tracked by the garbage collector and 0 otherwise.\n\nThis is analogous to the Python function *note gc.istracked():\n1184.\n\nNew in version 3.9.\n\n-- C Function: int PyObjectGCIsFinalized (PyObject *op)\n' Part of the *note Stable ABI: 2ac. since version 3.9.'  Returns 1\nif the object type of 'op' implements the GC protocol and 'op' has\nbeen already finalized by the garbage collector and 0 otherwise.\n\nThis is analogous to the Python function *note gc.isfinalized():\n718.\n\nNew in version 3.9.\n\n-- C Function: void PyObjectGCDel (void *op)\n' Part of the *note Stable ABI: 2ac.'  Releases memory allocated to\nan object using *note PyObjectGCNew: 8d7. or *note\nPyObjectGCNewVar: 8d8.\n\n-- C Function: void PyObjectGCUnTrack (void *op)\n' Part of the *note Stable ABI: 2ac.'  Remove the object 'op' from\nthe set of container objects tracked by the collector.  Note that\n*note PyObjectGCTrack(): 1360. can be called again on this object\nto add it back to the set of tracked objects.  The deallocator\n(*note tpdealloc: 46d0. handler) should call this for the object\nbefore any of the fields used by the *note tptraverse: 569.\nhandler become invalid.\n",
            "subsections": []
        },
        "Changed in version 3.8: The 'PyObjectGCTRACK()' and": {
            "content": "'PyObjectGCUNTRACK()' macros have been removed from the public C API.\n\nThe *note tptraverse: 569. handler accepts a function parameter of this\ntype:\n\n-- C Type: typedef int (*visitproc)(*note PyObject: 6b1. *object, void\n*arg)\n' Part of the *note Stable ABI: 2ac.'  Type of the visitor function\npassed to the *note tptraverse: 569. handler.  The function should\nbe called with an object to traverse as 'object' and the third\nparameter to the *note tptraverse: 569. handler as 'arg'.  The\nPython core uses several visitor functions to implement cyclic\ngarbage detection; it's not expected that users will need to write\ntheir own visitor functions.\n\nThe *note tptraverse: 569. handler must have the following type:\n\n-- C Type: typedef int (*traverseproc)(*note PyObject: 6b1. *self,\n*note visitproc: 48c9. visit, void *arg)\n' Part of the *note Stable ABI: 2ac.'  Traversal function for a\ncontainer object.  Implementations must call the 'visit' function\nfor each object directly contained by 'self', with the parameters\nto 'visit' being the contained object and the 'arg' value passed to\nthe handler.  The 'visit' function must not be called with a 'NULL'\nobject argument.  If 'visit' returns a non-zero value that value\nshould be returned immediately.\n\nTo simplify writing *note tptraverse: 569. handlers, a *note",
            "subsections": []
        },
        "PyVISIT(): 46da. macro is provided.  In order to use this macro, the": {
            "content": "*note tptraverse: 569. implementation must name its arguments exactly\n'visit' and 'arg':\n\n-- C Function: void PyVISIT (PyObject *o)\n\nIf 'o' is not 'NULL', call the 'visit' callback, with arguments 'o'\nand 'arg'.  If 'visit' returns a non-zero value, then return it.\nUsing this macro, *note tptraverse: 569. handlers look like:\n\nstatic int\nmytraverse(Noddy *self, visitproc visit, void *arg)\n{\nPyVISIT(self->foo);\nPyVISIT(self->bar);\nreturn 0;\n}\n\nThe *note tpclear: 46e3. handler must be of the *note inquiry: 48b8.\ntype, or 'NULL' if the object is immutable.\n\n-- C Type: typedef int (*inquiry)(*note PyObject: 6b1. *self)\n' Part of the *note Stable ABI: 2ac.'  Drop references that may\nhave created reference cycles.  Immutable objects do not have to\ndefine this method since they can never directly create reference\ncycles.  Note that the object must still be valid after calling\nthis method (don't just call *note PyDECREF(): 2cf. on a\nreference).  The collector will call this method if it detects that\nthis object is involved in a reference cycle.\n\n* Menu:\n\n* Controlling the Garbage Collector State::\n* Querying Garbage Collector State::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Controlling the Garbage Collector State,  Next: Querying Garbage Collector State,  Up: Supporting Cyclic Garbage Collection": {
            "content": "7.12.11.1 Controlling the Garbage Collector State\n.................................................\n",
            "subsections": []
        },
        "The C-API provides the following functions for controlling garbage": {
            "content": "collection runs.\n\n-- C Function: *note Pyssizet: 88d. PyGCCollect (void)\n' Part of the *note Stable ABI: 2ac.'  Perform a full garbage\ncollection, if the garbage collector is enabled.  (Note that *note\ngc.collect(): 865. runs it unconditionally.)\n\nReturns the number of collected + unreachable objects which cannot\nbe collected.  If the garbage collector is disabled or already\ncollecting, returns '0' immediately.  Errors during garbage\ncollection are passed to *note sys.unraisablehook: 448.  This\nfunction does not raise exceptions.\n\n-- C Function: int PyGCEnable (void)\n' Part of the *note Stable ABI: 2ac. since version 3.10.'  Enable\nthe garbage collector: similar to *note gc.enable(): 40eb.  Returns\nthe previous state, 0 for disabled and 1 for enabled.\n\nNew in version 3.10.\n\n-- C Function: int PyGCDisable (void)\n' Part of the *note Stable ABI: 2ac. since version 3.10.'  Disable\nthe garbage collector: similar to *note gc.disable(): 40ec.\nReturns the previous state, 0 for disabled and 1 for enabled.\n\nNew in version 3.10.\n\n-- C Function: int PyGCIsEnabled (void)\n' Part of the *note Stable ABI: 2ac. since version 3.10.'  Query\nthe state of the garbage collector: similar to *note\ngc.isenabled(): 40ed.  Returns the current state, 0 for disabled\nand 1 for enabled.\n\nNew in version 3.10.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Querying Garbage Collector State,  Prev: Controlling the Garbage Collector State,  Up: Supporting Cyclic Garbage Collection": {
            "content": "7.12.11.2 Querying Garbage Collector State\n..........................................\n",
            "subsections": []
        },
        "The C-API provides the following interface for querying information": {
            "content": "about the garbage collector.\n\n-- C Function: void PyUnstableGCVisitObjects (gcvisitobjectst\ncallback, void *arg)\n\nThis is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 29f. It may change without warning in minor releases.':\nRun supplied 'callback' on all live GC-capable objects.  'arg' is\npassed through to all invocations of 'callback'.\n\nWarning: If new objects are (de)allocated by the callback it\nis undefined if they will be visited.\n\nGarbage collection is disabled during operation.  Explicitly\nrunning a collection in the callback may lead to undefined\nbehaviour e.g.  visiting the same objects multiple times or\nnot at all.\n\nNew in version 3.12.\n\n-- C Type: typedef int (*gcvisitobjectst)(*note PyObject: 6b1.\n*object, void *arg)\n\nType of the visitor function to be passed to *note\nPyUnstableGCVisitObjects(): 4c48.  'arg' is the same as the 'arg'\npassed to 'PyUnstableGCVisitObjects'.  Return '0' to continue\niteration, return '1' to stop iteration.  Other return values are\nreserved for now so behavior on returning anything else is\nundefined.\n\nNew in version 3.12.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: API and ABI Versioning,  Prev: Object Implementation Support,  Up: Python/C API Reference Manual": {
            "content": "",
            "subsections": [
                {
                    "name": "7.13 API and ABI Versioning",
                    "content": "CPython exposes its version number in the following macros.  Note that\nthese correspond to the version code is 'built' with, not necessarily\nthe version used at 'run time'.\n\nSee *note C API Stability: 2ac. for a discussion of API and ABI\nstability across versions.\n\n-- C Macro: PYMAJORVERSION\n\nThe '3' in '3.4.1a2'.\n\n-- C Macro: PYMINORVERSION\n\nThe '4' in '3.4.1a2'.\n\n-- C Macro: PYMICROVERSION\n\nThe '1' in '3.4.1a2'.\n\n-- C Macro: PYRELEASELEVEL\n\nThe 'a' in '3.4.1a2'.  This can be '0xA' for alpha, '0xB' for beta,\n'0xC' for release candidate or '0xF' for final.\n\n-- C Macro: PYRELEASESERIAL\n\nThe '2' in '3.4.1a2'.  Zero for final releases.\n\n-- C Macro: PYVERSIONHEX\n\nThe Python version number encoded in a single integer.\n\nThe underlying version information can be found by treating it as a\n32 bit number in the following manner:\n\nBytes       Bits (big endian order)       Meaning                       Value for '3.4.1a2'\n\n-------------------------------------------------------------------------------------------------------\n\n1           1-8                           'PYMAJORVERSION'            '0x03'\n\n\n2           9-16                          'PYMINORVERSION'            '0x04'\n\n\n3           17-24                         'PYMICROVERSION'            '0x01'\n\n\n4           25-28                         'PYRELEASELEVEL'            '0xA'\n\n\n29-32       'PYRELEASESERIAL'           '0x2'\n\n\nThus '3.4.1a2' is hexversion '0x030401a2' and '3.10.0' is\nhexversion '0x030a00f0'.\n\nUse this for numeric comparisons, e.g.  '#if PYVERSIONHEX >=\n...'.\n\nThis version is also available via the symbol *note PyVersion:\n53d.\n\n-- C Variable: const unsigned long PyVersion\n' Part of the *note Stable ABI: 2ac. since version 3.11.'  The\nPython runtime version number encoded in a single constant integer,\nwith the same format as the *note PYVERSIONHEX: 53e. macro.  This\ncontains the Python version used at run time.\n\nNew in version 3.11.\n\nAll the given macros are defined in Include/patchlevel.h(1).\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Include/patchlevel.h\n"
                }
            ]
        },
        "File: python3.12.info,  Node: Installing Python Modules,  Next: Python HOWTOs,  Prev: Python/C API Reference Manual,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "8 Installing Python Modules": {
            "content": "Email: <distutils-sig@python.org>\n",
            "subsections": []
        },
        "As a popular open source development project, Python has an active": {
            "content": "supporting community of contributors and users that also make their\nsoftware available for other Python developers to use under open source\nlicense terms.\n",
            "subsections": []
        },
        "This allows Python users to share and collaborate effectively,": {
            "content": "benefiting from the solutions others have already created to common (and\nsometimes even rare!)  problems, as well as potentially contributing\ntheir own solutions to the common pool.\n",
            "subsections": []
        },
        "This guide covers the installation part of the process.  For a guide to": {
            "content": "creating and sharing your own Python projects, refer to the Python\npackaging user guide(1).\n\nNote: For corporate and other institutional users, be aware that\nmany organisations have their own policies around using and\ncontributing to open source software.  Please take such policies\ninto account when making use of the distribution and installation\ntools provided with Python.\n\n* Menu:\n\n* Key terms::\n* Basic usage::\n* How do I ...?::\n* Common installation issues::\n\n---------- Footnotes ----------\n\n(1)\nhttps://packaging.python.org/en/latest/tutorials/packaging-projects/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Key terms,  Next: Basic usage,  Up: Installing Python Modules": {
            "content": "",
            "subsections": [
                {
                    "name": "8.1 Key terms",
                    "content": "* 'pip' is the preferred installer program.  Starting with Python\n3.4, it is included by default with the Python binary installers.\n\n* A 'virtual environment' is a semi-isolated Python environment that\nallows packages to be installed for use by a particular\napplication, rather than being installed system wide.\n\n* 'venv' is the standard tool for creating virtual environments, and\nhas been part of Python since Python 3.3.  Starting with Python\n3.4, it defaults to installing 'pip' into all created virtual\nenvironments.\n\n* 'virtualenv' is a third party alternative (and predecessor) to\n'venv'.  It allows virtual environments to be used on versions of\nPython prior to 3.4, which either don't provide 'venv' at all, or\naren't able to automatically install 'pip' into created\nenvironments.\n\n* The Python Package Index(1) is a public repository of open source\nlicensed packages made available for use by other Python users.\n\n* the Python Packaging Authority(2) is the group of developers and\ndocumentation authors responsible for the maintenance and evolution\nof the standard packaging tools and the associated metadata and\nfile format standards.  They maintain a variety of tools,\ndocumentation, and issue trackers on GitHub(3).\n\n* 'distutils' is the original build and distribution system first\nadded to the Python standard library in 1998.  While direct use of\n'distutils' is being phased out, it still laid the foundation for\nthe current packaging and distribution infrastructure, and it not\nonly remains part of the standard library, but its name lives on in\nother ways (such as the name of the mailing list used to coordinate\nPython packaging standards development).\n"
                }
            ]
        },
        "The standard packaging tools are all designed to be used from the": {
            "content": "command line.\n",
            "subsections": []
        },
        "The following command will install the latest version of a module and": {
            "content": "its dependencies from the Python Package Index:\n\npython -m pip install SomePackage\n\nNote: For POSIX users (including macOS and Linux users), the\nexamples in this guide assume the use of a *note virtual\nenvironment: 1a85.\n\nFor Windows users, the examples in this guide assume that the\noption to adjust the system PATH environment variable was selected\nwhen installing Python.\n",
            "subsections": []
        },
        "It's also possible to specify an exact or minimum version directly on": {
            "content": "the command line.  When using comparator operators such as '>', '<' or\nsome other special character which get interpreted by shell, the package\nname and the version should be enclosed within double quotes:\n\npython -m pip install SomePackage==1.0.4    # specific version\npython -m pip install \"SomePackage>=1.0.4\"  # minimum version\n",
            "subsections": []
        },
        "Normally, if a suitable module is already installed, attempting to": {
            "content": "install it again will have no effect.  Upgrading existing modules must\nbe requested explicitly:\n\npython -m pip install --upgrade SomePackage\n",
            "subsections": []
        },
        "More information and resources regarding 'pip' and its capabilities can": {
            "content": "be found in the Python Packaging User Guide(1).\n\nCreation of virtual environments is done through the *note venv: 10c.\nmodule.  Installing packages into an active virtual environment uses the\ncommands shown above.\n\nSee also\n........\n",
            "subsections": []
        },
        "Python Packaging User Guide: Installing Python Distribution Packages(2)": {
            "content": "---------- Footnotes ----------\n\n(1) https://packaging.python.org\n\n(2) https://packaging.python.org/installing/\n\nFile: python3.12.info,  Node: How do I ...?,  Next: Common installation issues,  Prev: Basic usage,  Up: Installing Python Modules\n",
            "subsections": [
                {
                    "name": "8.3 How do I ...?",
                    "content": "These are quick answers or links for some common tasks.\n\n* Menu:\n\n* ... install pip in versions of Python prior to Python 3.4?: ... install pip in versions of Python prior to Python 3 4?.\n* ... install packages just for the current user?::\n* ... install scientific Python packages?::\n* ... work with multiple versions of Python installed in parallel?::\n\nFile: python3.12.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 ...?\n\n"
                }
            ]
        },
        "Python only started bundling 'pip' with Python 3.4.  For earlier": {
            "content": "versions, 'pip' needs to be \"bootstrapped\" as described in the Python\nPackaging User Guide.\n\nSee also\n........\n",
            "subsections": []
        },
        "Python Packaging User Guide: Requirements for Installing Packages(1)": {
            "content": "---------- Footnotes ----------\n\n(1)\nhttps://packaging.python.org/installing/#requirements-for-installing-packages\n\nFile: python3.12.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 ...?\n\n",
            "subsections": []
        },
        "Passing the '--user' option to 'python -m pip install' will install a": {
            "content": "package just for the current user, rather than for all users of the\nsystem.\n\nFile: python3.12.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 ...?\n\n\nA number of scientific Python packages have complex binary dependencies,\nand aren't currently easy to install using 'pip' directly.  At this\npoint in time, it will often be easier for users to install these\npackages by other means(1) rather than attempting to install them with\n'pip'.\n\nSee also\n........\n",
            "subsections": []
        },
        "Python Packaging User Guide: Installing Scientific Packages(2)": {
            "content": "---------- Footnotes ----------\n\n(1) https://packaging.python.org/science/\n\n(2) https://packaging.python.org/science/\n\nFile: python3.12.info,  Node: ... work with multiple versions of Python installed in parallel?,  Prev: ... install scientific Python packages?,  Up: How do I ...?\n\n",
            "subsections": []
        },
        "On Linux, macOS, and other POSIX systems, use the versioned Python": {
            "content": "commands in combination with the '-m' switch to run the appropriate copy\nof 'pip':\n\npython2   -m pip install SomePackage  # default Python 2\npython2.7 -m pip install SomePackage  # specifically Python 2.7\npython3   -m pip install SomePackage  # default Python 3\npython3.4 -m pip install SomePackage  # specifically Python 3.4\n\nAppropriately versioned 'pip' commands may also be available.\n",
            "subsections": []
        },
        "On Windows, use the 'py' Python launcher in combination with the '-m'": {
            "content": "switch:\n\npy -2   -m pip install SomePackage  # default Python 2\npy -2.7 -m pip install SomePackage  # specifically Python 2.7\npy -3   -m pip install SomePackage  # default Python 3\npy -3.4 -m pip install SomePackage  # specifically Python 3.4\n\nFile: python3.12.info,  Node: Common installation issues,  Prev: How do I ...?,  Up: Installing Python Modules\n",
            "subsections": [
                {
                    "name": "8.4 Common installation issues",
                    "content": "* Menu:\n\n* Installing into the system Python on Linux::\n* Pip not installed::\n* Installing binary extensions::\n"
                }
            ]
        },
        "File: python3.12.info,  Node: Installing into the system Python on Linux,  Next: Pip not installed,  Up: Common installation issues": {
            "content": "",
            "subsections": []
        },
        "On Linux systems, a Python installation will typically be included as": {
            "content": "part of the distribution.  Installing into this Python installation\nrequires root access to the system, and may interfere with the operation\nof the system package manager and other components of the system if a\ncomponent is unexpectedly upgraded using 'pip'.\n",
            "subsections": []
        },
        "On such systems, it is often better to use a virtual environment or a": {
            "content": "per-user installation when installing packages with 'pip'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Pip not installed,  Next: Installing binary extensions,  Prev: Installing into the system Python on Linux,  Up: Common installation issues": {
            "content": "",
            "subsections": []
        },
        "It is possible that 'pip' does not get installed by default.  One": {
            "content": "potential fix is:\n\npython -m ensurepip --default-pip\n",
            "subsections": []
        },
        "There are also additional resources for installing pip.(1)": {
            "content": "---------- Footnotes ----------\n\n(1)\nhttps://packaging.python.org/en/latest/tutorials/installing-packages/#ensure-pip-setuptools-and-wheel-are-up-to-date\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Installing binary extensions,  Prev: Pip not installed,  Up: Common installation issues": {
            "content": "",
            "subsections": []
        },
        "Python has typically relied heavily on source based distribution, with": {
            "content": "end users being expected to compile extension modules from source as\npart of the installation process.\n",
            "subsections": []
        },
        "With the introduction of support for the binary 'wheel' format, and the": {
            "content": "ability to publish wheels for at least Windows and macOS through the",
            "subsections": []
        },
        "Python Package Index, this problem is expected to diminish over time, as": {
            "content": "users are more regularly able to install pre-built extensions rather\nthan needing to build them themselves.\n",
            "subsections": []
        },
        "Some of the solutions for installing scientific software(1) that are not": {
            "content": "yet available as pre-built 'wheel' files may also help with obtaining\nother binary extensions without needing to build them locally.\n\nSee also\n........\n",
            "subsections": []
        },
        "Python Packaging User Guide: Binary Extensions(2)": {
            "content": "---------- Footnotes ----------\n\n(1) https://packaging.python.org/science/\n\n(2) https://packaging.python.org/extensions/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python HOWTOs,  Next: Python Frequently Asked Questions,  Prev: Installing Python Modules,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "9 Python HOWTOs": {
            "content": "",
            "subsections": []
        },
        "Python HOWTOs are documents that cover a single, specific topic, and": {
            "content": "attempt to cover it fairly completely.  Modelled on the Linux",
            "subsections": []
        },
        "Documentation Project's HOWTO collection, this collection is an effort": {
            "content": "to foster documentation that's more detailed than the Python Library\nReference.\n\nCurrently, the HOWTOs are:\n\n* Menu:\n\n* Porting Extension Modules to Python 3::\n* Curses Programming with Python::\n* Descriptor Guide::\n* Debugging C API extensions and CPython Internals with GDB::\n* Enum HOWTO::\n* Functional Programming HOWTO::\n* Logging HOWTO::\n* Logging Cookbook::\n* Regular Expression HOWTO::\n* Socket Programming HOWTO::\n* Sorting Techniques::\n* Unicode HOWTO::\n* HOWTO Fetch Internet Resources Using The urllib Package::\n* Argparse Tutorial::\n* An introduction to the ipaddress module::\n* Instrumenting CPython with DTrace and SystemTap::\n* Python support for the Linux perf profiler::\n* Annotations Best Practices::\n* Isolating Extension Modules::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Porting Extension Modules to Python 3,  Next: Curses Programming with Python,  Up: Python HOWTOs": {
            "content": "",
            "subsections": [
                {
                    "name": "9.1 Porting Extension Modules to Python 3",
                    "content": ""
                }
            ]
        },
        "We recommend the following resources for porting extension modules to": {
            "content": "Python 3:\n\n* The Migrating C extensions(1) chapter from 'Supporting Python 3: An\nin-depth guide', a book on moving from Python 2 to Python 3 in\ngeneral, guides the reader through porting an extension module.\n\n* The Porting guide(2) from the 'py3c' project provides opinionated\nsuggestions with supporting code.\n\n* The Cython(3) and CFFI(4) libraries offer abstractions over\nPython's C API. Extensions generally need to be re-written to use\none of them, but the library then handles differences between\nvarious Python versions and implementations.\n\n---------- Footnotes ----------\n\n(1) http://python3porting.com/cextensions.html\n\n(2) https://py3c.readthedocs.io/en/latest/guide.html\n\n(3) https://cython.org/\n\n(4) https://cffi.readthedocs.io/en/latest/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Curses Programming with Python,  Next: Descriptor Guide,  Prev: Porting Extension Modules to Python 3,  Up: Python HOWTOs": {
            "content": "",
            "subsections": [
                {
                    "name": "9.2 Curses Programming with Python",
                    "content": ""
                }
            ]
        },
        "Author: A.M. Kuchling, Eric S. Raymond": {
            "content": "",
            "subsections": []
        },
        "Release: 2.04": {
            "content": "",
            "subsections": []
        },
        "Abstract": {
            "content": "........\n",
            "subsections": []
        },
        "The curses library supplies a terminal-independent screen-painting and": {
            "content": "keyboard-handling facility for text-based terminals; such terminals\ninclude VT100s, the Linux console, and the simulated terminal provided\nby various programs.  Display terminals support various control codes to\nperform common operations such as moving the cursor, scrolling the\nscreen, and erasing areas.  Different terminals use widely differing\ncodes, and often have their own minor quirks.\n\nIn a world of graphical displays, one might ask \"why bother\"?  It's true\nthat character-cell display terminals are an obsolete technology, but\nthere are niches in which being able to do fancy things with them are\nstill valuable.  One niche is on small-footprint or embedded Unixes that\ndon't run an X server.  Another is tools such as OS installers and\nkernel configurators that may have to run before any graphical support\nis available.\n",
            "subsections": []
        },
        "The curses library provides fairly basic functionality, providing the": {
            "content": "programmer with an abstraction of a display containing multiple\nnon-overlapping windows of text.  The contents of a window can be\nchanged in various ways--adding text, erasing it, changing its\nappearance--and the curses library will figure out what control codes\nneed to be sent to the terminal to produce the right output.  curses\ndoesn't provide many user-interface concepts such as buttons,\ncheckboxes, or dialogs; if you need such features, consider a user\ninterface library such as Urwid(1).\n",
            "subsections": []
        },
        "The curses library was originally written for BSD Unix; the later System": {
            "content": "V versions of Unix from AT&T added many enhancements and new functions.\nBSD curses is no longer maintained, having been replaced by ncurses,\nwhich is an open-source implementation of the AT&T interface.  If you're\nusing an open-source Unix such as Linux or FreeBSD, your system almost\ncertainly uses ncurses.  Since most current commercial Unix versions are\nbased on System V code, all the functions described here will probably\nbe available.  The older versions of curses carried by some proprietary\nUnixes may not support everything, though.\n\nThe Windows version of Python doesn't include the *note curses: 29.\nmodule.  A ported version called UniCurses(2) is available.\n\n* Menu:\n\n* The Python curses module::\n\n---------- Footnotes ----------\n\n(1) https://pypi.org/project/urwid/\n\n(2) https://pypi.org/project/UniCurses\n\nFile: python3.12.info,  Node: The Python curses module,  Up: What is curses?\n\n9.2.1.1 The Python curses module\n................................\n",
            "subsections": []
        },
        "The Python module is a fairly simple wrapper over the C functions": {
            "content": "provided by curses; if you're already familiar with curses programming\nin C, it's really easy to transfer that knowledge to Python.  The\nbiggest difference is that the Python interface makes things simpler by\nmerging different C functions such as 'addstr()', 'mvaddstr()', and\n'mvwaddstr()' into a single *note addstr(): 2aa9. method.  You'll see\nthis covered in more detail later.\n",
            "subsections": []
        },
        "This HOWTO is an introduction to writing text-mode programs with curses": {
            "content": "and Python.  It doesn't attempt to be a complete guide to the curses\nAPI; for that, see the Python library guide's section on ncurses, and\nthe C manual pages for ncurses.  It will, however, give you the basic\nideas.\n\nFile: python3.12.info,  Node: Starting and ending a curses application,  Next: Windows and Pads,  Prev: What is curses?,  Up: Curses Programming with Python\n\n",
            "subsections": []
        },
        "Before doing anything, curses must be initialized.  This is done by": {
            "content": "calling the *note initscr(): 2aaf. function, which will determine the\nterminal type, send any required setup codes to the terminal, and create\nvarious internal data structures.  If successful, 'initscr()' returns a\nwindow object representing the entire screen; this is usually called\n'stdscr' after the name of the corresponding C variable.\n\nimport curses\nstdscr = curses.initscr()\n",
            "subsections": []
        },
        "Usually curses applications turn off automatic echoing of keys to the": {
            "content": "screen, in order to be able to read keys and only display them under\ncertain circumstances.  This requires calling the *note noecho(): 2ad6.\nfunction.\n\ncurses.noecho()\n",
            "subsections": []
        },
        "Applications will also commonly need to react to keys instantly, without": {
            "content": "requiring the Enter key to be pressed; this is called cbreak mode, as\nopposed to the usual buffered input mode.\n\ncurses.cbreak()\n",
            "subsections": []
        },
        "Terminals usually return special keys, such as the cursor keys or": {
            "content": "navigation keys such as Page Up and Home, as a multibyte escape\nsequence.  While you could write your application to expect such\nsequences and process them accordingly, curses can do it for you,\nreturning a special value such as *note curses.KEYLEFT: 2b51.  To get\ncurses to do the job, you'll have to enable keypad mode.\n\nstdscr.keypad(True)\n\nTerminating a curses application is much easier than starting one.\nYou'll need to call:\n\ncurses.nocbreak()\nstdscr.keypad(False)\ncurses.echo()\n\nto reverse the curses-friendly terminal settings.  Then call the *note\nendwin(): 2aac. function to restore the terminal to its original\noperating mode.\n\ncurses.endwin()\n\nA common problem when debugging a curses application is to get your\nterminal messed up when the application dies without restoring the\nterminal to its previous state.  In Python this commonly happens when\nyour code is buggy and raises an uncaught exception.  Keys are no longer\nechoed to the screen when you type them, for example, which makes using\nthe shell difficult.\n",
            "subsections": []
        },
        "In Python you can avoid these complications and make debugging much": {
            "content": "easier by importing the *note curses.wrapper(): 8ae. function and using\nit like this:\n\nfrom curses import wrapper\n\ndef main(stdscr):\n# Clear screen\nstdscr.clear()\n\n# This raises ZeroDivisionError when i == 10.\nfor i in range(0, 11):\nv = i-10\nstdscr.addstr(i, 0, '10 divided by {} is {}'.format(v, 10/v))\n\nstdscr.refresh()\nstdscr.getkey()\n\nwrapper(main)\n\nThe *note wrapper(): 8ae. function takes a callable object and does the\ninitializations described above, also initializing colors if color\nsupport is present.  'wrapper()' then runs your provided callable.  Once\nthe callable returns, 'wrapper()' will restore the original state of the\nterminal.  The callable is called inside a *note try: 4bc....*note except:\n379. that catches exceptions, restores the state of the terminal, and\nthen re-raises the exception.  Therefore your terminal won't be left in\na funny state on exception and you'll be able to read the exception's\nmessage and traceback.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Windows and Pads,  Next: Displaying Text,  Prev: Starting and ending a curses application,  Up: Curses Programming with Python": {
            "content": "",
            "subsections": []
        },
        "Windows are the basic abstraction in curses.  A window object represents": {
            "content": "a rectangular area of the screen, and supports methods to display text,\nerase it, allow the user to input strings, and so forth.\n\nThe 'stdscr' object returned by the *note initscr(): 2aaf. function is a\nwindow object that covers the entire screen.  Many programs may need\nonly this single window, but you might wish to divide the screen into\nsmaller windows, in order to redraw or clear them separately.  The *note\nnewwin(): 2ad4. function creates a new window of a given size, returning\nthe new window object.\n\nbeginx = 20; beginy = 7\nheight = 5; width = 40\nwin = curses.newwin(height, width, beginy, beginx)\n",
            "subsections": []
        },
        "Note that the coordinate system used in curses is unusual.  Coordinates": {
            "content": "are always passed in the order 'y,x', and the top-left corner of a\nwindow is coordinate (0,0).  This breaks the normal convention for\nhandling coordinates where the 'x' coordinate comes first.  This is an\nunfortunate difference from most other computer applications, but it's\nbeen part of curses since it was first written, and it's too late to\nchange things now.\n\nYour application can determine the size of the screen by using the *note\ncurses.LINES: 142e. and *note curses.COLS: 142f. variables to obtain the\n'y' and 'x' sizes.  Legal coordinates will then extend from '(0,0)' to\n'(curses.LINES - 1, curses.COLS - 1)'.\n",
            "subsections": []
        },
        "When you call a method to display or erase text, the effect doesn't": {
            "content": "immediately show up on the display.  Instead you must call the *note\nrefresh(): 2aaa. method of window objects to update the screen.\n",
            "subsections": []
        },
        "This is because curses was originally written with slow 300-baud": {
            "content": "terminal connections in mind; with these terminals, minimizing the time\nrequired to redraw the screen was very important.  Instead curses\naccumulates changes to the screen and displays them in the most\nefficient manner when you call 'refresh()'.  For example, if your\nprogram displays some text in a window and then clears the window,\nthere's no need to send the original text because they're never visible.\n",
            "subsections": []
        },
        "In practice, explicitly telling curses to redraw a window doesn't really": {
            "content": "complicate programming with curses much.  Most programs go into a flurry\nof activity, and then pause waiting for a keypress or some other action\non the part of the user.  All you have to do is to be sure that the\nscreen has been redrawn before pausing to wait for user input, by first\ncalling 'stdscr.refresh()' or the 'refresh()' method of some other\nrelevant window.\n\nA pad is a special case of a window; it can be larger than the actual\ndisplay screen, and only a portion of the pad displayed at a time.",
            "subsections": []
        },
        "Creating a pad requires the pad's height and width, while refreshing a": {
            "content": "pad requires giving the coordinates of the on-screen area where a\nsubsection of the pad will be displayed.\n\npad = curses.newpad(100, 100)\n# These loops fill the pad with letters; addch() is\n# explained in the next section\nfor y in range(0, 99):\nfor x in range(0, 99):\npad.addch(y,x, ord('a') + (x*x+y*y) % 26)\n\n# Displays a section of the pad in the middle of the screen.\n# (0,0) : coordinate of upper-left corner of pad area to display.\n# (5,5) : coordinate of upper-left corner of window area to be filled\n#         with pad content.\n# (20, 75) : coordinate of lower-right corner of window area to be\n#          : filled with pad content.\npad.refresh( 0,0, 5,5, 20,75)\n",
            "subsections": []
        },
        "The 'refresh()' call displays a section of the pad in the rectangle": {
            "content": "extending from coordinate (5,5) to coordinate (20,75) on the screen; the\nupper left corner of the displayed section is coordinate (0,0) on the\npad.  Beyond that difference, pads are exactly like ordinary windows and\nsupport the same methods.\n",
            "subsections": []
        },
        "If you have multiple windows and pads on screen there is a more": {
            "content": "efficient way to update the screen and prevent annoying screen flicker\nas each part of the screen gets updated.  'refresh()' actually does two\nthings:\n\n1. Calls the *note noutrefresh(): 2aa8. method of each window to\nupdate an underlying data structure representing the desired state\nof the screen.\n\n2. Calls the function *note doupdate(): 2aa7. function to change the\nphysical screen to match the desired state recorded in the data\nstructure.\n",
            "subsections": []
        },
        "Instead you can call 'noutrefresh()' on a number of windows to update": {
            "content": "the data structure, and then call 'doupdate()' to update the screen.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Displaying Text,  Next: User Input,  Prev: Windows and Pads,  Up: Curses Programming with Python": {
            "content": "",
            "subsections": []
        },
        "From a C programmer's point of view, curses may sometimes look like a": {
            "content": "twisty maze of functions, all subtly different.  For example, 'addstr()'\ndisplays a string at the current cursor location in the 'stdscr' window,\nwhile 'mvaddstr()' moves to a given y,x coordinate first before\ndisplaying the string.  'waddstr()' is just like 'addstr()', but allows\nspecifying a window to use instead of using 'stdscr' by default.\n'mvwaddstr()' allows specifying both a window and a coordinate.\n",
            "subsections": []
        },
        "Fortunately the Python interface hides all these details.  'stdscr' is a": {
            "content": "window object like any other, and methods such as *note addstr(): 2aa9.\naccept multiple argument forms.  Usually there are four different forms.\n",
            "subsections": []
        },
        "Form                                  Description": {
            "content": "------------------------------------------------------------------------------------------\n\n'str' or 'ch'                         Display the string 'str' or character 'ch' at the\ncurrent position\n\n\n'str' or 'ch', 'attr'                 Display the string 'str' or character 'ch', using\nattribute 'attr' at the current position\n\n\n'y', 'x', 'str' or 'ch'               Move to position 'y,x' within the window, and\ndisplay 'str' or 'ch'\n\n\n'y', 'x', 'str' or 'ch', 'attr'       Move to position 'y,x' within the window, and\ndisplay 'str' or 'ch', using attribute 'attr'\n\n",
            "subsections": []
        },
        "Attributes allow displaying text in highlighted forms such as boldface,": {
            "content": "underline, reverse code, or in color.  They'll be explained in more\ndetail in the next subsection.\n\nThe *note addstr(): 2aa9. method takes a Python string or bytestring as\nthe value to be displayed.  The contents of bytestrings are sent to the\nterminal as-is.  Strings are encoded to bytes using the value of the\nwindow's *note encoding: f0d. attribute; this defaults to the default\nsystem encoding as returned by *note locale.getencoding(): 41f.\n\nThe *note addch(): 2af0. methods take a character, which can be either a\nstring of length 1, a bytestring of length 1, or an integer.\n",
            "subsections": []
        },
        "Constants are provided for extension characters; these constants are": {
            "content": "integers greater than 255.  For example, *note ACSPLMINUS: 2bbe. is a\n+/- symbol, and *note ACSULCORNER: 2afa. is the upper left corner of a\nbox (handy for drawing borders).  You can also use the appropriate\nUnicode character.\n",
            "subsections": []
        },
        "Windows remember where the cursor was left after the last operation, so": {
            "content": "if you leave out the 'y,x' coordinates, the string or character will be\ndisplayed wherever the last operation left off.  You can also move the\ncursor with the 'move(y,x)' method.  Because some terminals always\ndisplay a flashing cursor, you may want to ensure that the cursor is\npositioned in some location where it won't be distracting; it can be\nconfusing to have the cursor blinking at some apparently random\nlocation.\n",
            "subsections": []
        },
        "If your application doesn't need a blinking cursor at all, you can call": {
            "content": "'cursset(False)' to make it invisible.  For compatibility with older\ncurses versions, there's a 'leaveok(bool)' function that's a synonym for\n*note cursset(): 2aa1.  When 'bool' is true, the curses library will\nattempt to suppress the flashing cursor, and you won't need to worry\nabout leaving it in odd locations.\n\n* Menu:\n\n* Attributes and Color::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Attributes and Color,  Up: Displaying Text": {
            "content": "9.2.4.1 Attributes and Color\n............................\n",
            "subsections": []
        },
        "Characters can be displayed in different ways.  Status lines in a": {
            "content": "text-based application are commonly shown in reverse video, or a text\nviewer may need to highlight certain words.  curses supports this by\nallowing you to specify an attribute for each cell on the screen.\n\nAn attribute is an integer, each bit representing a different attribute.",
            "subsections": []
        },
        "You can try to display text with multiple attribute bits set, but curses": {
            "content": "doesn't guarantee that all the possible combinations are available, or\nthat they're all visually distinct.  That depends on the ability of the\nterminal being used, so it's safest to stick to the most commonly\navailable attributes, listed here.\n",
            "subsections": []
        },
        "Attribute                  Description": {
            "content": "----------------------------------------------------------------------\n\n*note ABLINK: 2b3d.       Blinking text\n\n\n*note ABOLD: 2b3e.        Extra bright or bold text\n\n\n*note ADIM: 2b3f.         Half bright text\n\n\n*note AREVERSE: 2a9f.     Reverse-video text\n\n\n*note ASTANDOUT: 2a9e.    The best highlighting mode available\n\n\n*note AUNDERLINE: 2b43.   Underlined text\n\n",
            "subsections": []
        },
        "So, to display a reverse-video status line on the top line of the": {
            "content": "screen, you could code:\n\nstdscr.addstr(0, 0, \"Current mode: Typing mode\",\ncurses.AREVERSE)\nstdscr.refresh()\n",
            "subsections": []
        },
        "The curses library also supports color on those terminals that provide": {
            "content": "it.  The most common such terminal is probably the Linux console,\nfollowed by color xterms.\n\nTo use color, you must call the *note startcolor(): 2ae1. function soon\nafter calling *note initscr(): 2aaf, to initialize the default color set\n(the *note curses.wrapper(): 8ae. function does this automatically).\nOnce that's done, the *note hascolors(): 2ac1. function returns TRUE if\nthe terminal in use can actually display color.  (Note: curses uses the",
            "subsections": []
        },
        "American spelling 'color', instead of the Canadian/British spelling": {
            "content": "'colour'.  If you're used to the British spelling, you'll have to resign\nyourself to misspelling it for the sake of these functions.)\n",
            "subsections": []
        },
        "The curses library maintains a finite number of color pairs, containing": {
            "content": "a foreground (or text) color and a background color.  You can get the\nattribute value corresponding to a color pair with the *note\ncolorpair(): 2a9d. function; this can be bitwise-OR'ed with other\nattributes such as *note AREVERSE: 2a9f, but again, such combinations\nare not guaranteed to work on all terminals.\n\nAn example, which displays a line of text using color pair 1:\n\nstdscr.addstr(\"Pretty text\", curses.colorpair(1))\nstdscr.refresh()\n",
            "subsections": []
        },
        "As I said before, a color pair consists of a foreground and background": {
            "content": "color.  The 'initpair(n, f, b)' function changes the definition of\ncolor pair 'n', to foreground color f and background color b.  Color\npair 0 is hard-wired to white on black, and cannot be changed.\n\nColors are numbered, and *note startcolor(): 2ae1. initializes 8 basic\ncolors when it activates color mode.  They are: 0:black, 1:red, 2:green,\n3:yellow, 4:blue, 5:magenta, 6:cyan, and 7:white.  The *note curses: 29.\nmodule defines named constants for each of these colors: *note\ncurses.COLORBLACK: 2bd0, *note curses.COLORRED: 2bd5, and so forth.\n",
            "subsections": []
        },
        "Let's put all this together.  To change color 1 to red text on a white": {
            "content": "background, you would call:\n\ncurses.initpair(1, curses.COLORRED, curses.COLORWHITE)\n",
            "subsections": []
        },
        "When you change a color pair, any text already displayed using that": {
            "content": "color pair will change to the new colors.  You can also display new text\nin this color with:\n\nstdscr.addstr(0,0, \"RED ALERT!\", curses.colorpair(1))\n",
            "subsections": []
        },
        "Very fancy terminals can change the definitions of the actual colors to": {
            "content": "a given RGB value.  This lets you change color 1, which is usually red,\nto purple or blue or any other color you like.  Unfortunately, the Linux\nconsole doesn't support this, so I'm unable to try it out, and can't\nprovide any examples.  You can check if your terminal can do this by\ncalling *note canchangecolor(): 2a9a, which returns 'True' if the\ncapability is there.  If you're lucky enough to have such a talented\nterminal, consult your system's man pages for more information.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: User Input,  Next: For More Information,  Prev: Displaying Text,  Up: Curses Programming with Python": {
            "content": "",
            "subsections": []
        },
        "The C curses library offers only very simple input mechanisms.  Python's": {
            "content": "*note curses: 29. module adds a basic text-input widget.  (Other\nlibraries such as Urwid(1) have more extensive collections of widgets.)\n\nThere are two methods for getting input from a window:\n\n* *note getch(): 2ab3. refreshes the screen and then waits for the\nuser to hit a key, displaying the key if *note echo(): 2aab. has\nbeen called earlier.  You can optionally specify a coordinate to\nwhich the cursor should be moved before pausing.\n\n* *note getkey(): 2b0e. does the same thing but converts the integer\nto a string.  Individual characters are returned as 1-character\nstrings, and special keys such as function keys return longer\nstrings containing a key name such as 'KEYUP' or '^G'.\n\nIt's possible to not wait for the user using the *note nodelay(): 2b24.\nwindow method.  After 'nodelay(True)', 'getch()' and 'getkey()' for the\nwindow become non-blocking.  To signal that no input is ready, 'getch()'\nreturns 'curses.ERR' (a value of -1) and 'getkey()' raises an exception.\nThere's also a *note halfdelay(): 2ac5. function, which can be used to\n(in effect) set a timer on each 'getch()'; if no input becomes available\nwithin a specified delay (measured in tenths of a second), curses raises\nan exception.\n",
            "subsections": []
        },
        "The 'getch()' method returns an integer; if it's between 0 and 255, it": {
            "content": "represents the ASCII code of the key pressed.  Values greater than 255\nare special keys such as Page Up, Home, or the cursor keys.  You can\ncompare the value returned to constants such as *note curses.KEYPPAGE:\n2b62, *note curses.KEYHOME: 2b53, or *note curses.KEYLEFT: 2b51.  The\nmain loop of your program may look something like this:\n\nwhile True:\nc = stdscr.getch()\nif c == ord('p'):\nPrintDocument()\nelif c == ord('q'):\nbreak  # Exit the while loop\nelif c == curses.KEYHOME:\nx = y = 0\n\nThe *note curses.ascii: 2a. module supplies ASCII class membership\nfunctions that take either integer or 1-character string arguments;\nthese may be useful in writing more readable tests for such loops.  It\nalso supplies conversion functions that take either integer or\n1-character-string arguments and return the same type.  For example,\n*note curses.ascii.ctrl(): 2c17. returns the control character\ncorresponding to its argument.\n\nThere's also a method to retrieve an entire string, *note getstr():\n2b11.  It isn't used very often, because its functionality is quite\nlimited; the only editing keys available are the backspace key and the",
            "subsections": []
        },
        "Enter key, which terminates the string.  It can optionally be limited to": {
            "content": "a fixed number of characters.\n\ncurses.echo()            # Enable echoing of characters\n\n# Get a 15-character string, with the cursor on the top line\ns = stdscr.getstr(0,0, 15)\n\nThe *note curses.textpad: 2c. module supplies a text box that supports\nan Emacs-like set of keybindings.  Various methods of the *note Textbox:\n2bd9. class support editing with input validation and gathering the edit\nresults either with or without trailing spaces.  Here's an example:\n\nimport curses\nfrom curses.textpad import Textbox, rectangle\n\ndef main(stdscr):\nstdscr.addstr(0, 0, \"Enter IM message: (hit Ctrl-G to send)\")\n\neditwin = curses.newwin(5,30, 2,1)\nrectangle(stdscr, 1,0, 1+5+1, 1+30+1)\nstdscr.refresh()\n\nbox = Textbox(editwin)\n\n# Let the user edit until Ctrl-G is struck.\nbox.edit()\n\n# Get resulting contents\nmessage = box.gather()\n\nSee the library documentation on *note curses.textpad: 2c. for more\ndetails.\n\n---------- Footnotes ----------\n\n(1) https://pypi.org/project/urwid/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: For More Information,  Prev: User Input,  Up: Curses Programming with Python": {
            "content": "",
            "subsections": []
        },
        "This HOWTO doesn't cover some advanced topics, such as reading the": {
            "content": "contents of the screen or capturing mouse events from an xterm instance,\nbut the Python library page for the *note curses: 29. module is now\nreasonably complete.  You should browse it next.\n",
            "subsections": []
        },
        "If you're in doubt about the detailed behavior of the curses functions,": {
            "content": "consult the manual pages for your curses implementation, whether it's\nncurses or a proprietary Unix vendor's.  The manual pages will document\nany quirks, and provide complete lists of all the functions, attributes,\nand *note ACS*: 2baa. characters available to you.\n",
            "subsections": []
        },
        "Because the curses API is so large, some functions aren't supported in": {
            "content": "the Python interface.  Often this isn't because they're difficult to\nimplement, but because no one has needed them yet.  Also, Python doesn't\nyet support the menu library associated with ncurses.  Patches adding\nsupport for these would be welcome; see the Python Developer's Guide(1)\nto learn more about submitting patches to Python.\n\n* Writing Programs with NCURSES(2): a lengthy tutorial for C\nprogrammers.\n\n* The ncurses man page(3)\n\n* The ncurses FAQ(4)\n\n* \"Use curses...  don't swear\"(5): video of a PyCon 2013 talk on\ncontrolling terminals using curses or Urwid.\n\n* \"Console Applications with Urwid\"(6): video of a PyCon CA 2012 talk\ndemonstrating some applications written using Urwid.\n\n---------- Footnotes ----------\n\n(1) https://devguide.python.org/\n\n(2) https://invisible-island.net/ncurses/ncurses-intro.html\n\n(3) https://linux.die.net/man/3/ncurses\n\n(4) https://invisible-island.net/ncurses/ncurses.faq.html\n\n(5) https://www.youtube.com/watch?v=eN1eZtjLEnU\n\n(6) https://pyvideo.org/video/1568/console-applications-with-urwid\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Descriptor Guide,  Next: Debugging C API extensions and CPython Internals with GDB,  Prev: Curses Programming with Python,  Up: Python HOWTOs": {
            "content": "",
            "subsections": [
                {
                    "name": "9.3 Descriptor Guide",
                    "content": ""
                }
            ]
        },
        "File: python3.12.info,  Node: Primer,  Next: Complete Practical Example,  Up: Descriptor Guide": {
            "content": "",
            "subsections": []
        },
        "In this primer, we start with the most basic possible example and then": {
            "content": "we'll add new capabilities one by one.\n\n* Menu:\n\n* Simple example; A descriptor that returns a constant: Simple example A descriptor that returns a constant.\n* Dynamic lookups::\n* Managed attributes::\n* Customized names::\n* Closing thoughts::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Simple example A descriptor that returns a constant,  Next: Dynamic lookups,  Up: Primer": {
            "content": "9.3.1.1 Simple example: A descriptor that returns a constant\n............................................................\n",
            "subsections": []
        },
        "The 'Ten' class is a descriptor whose 'get()' method always returns": {
            "content": "the constant '10':\n\nclass Ten:\ndef get(self, obj, objtype=None):\nreturn 10\n",
            "subsections": []
        },
        "To use the descriptor, it must be stored as a class variable in another": {
            "content": "class:\n\nclass A:\nx = 5                       # Regular class attribute\ny = Ten()                   # Descriptor instance\n",
            "subsections": []
        },
        "An interactive session shows the difference between normal attribute": {
            "content": "lookup and descriptor lookup:\n\n>>> a = A()                     # Make an instance of class A\n>>> a.x                         # Normal attribute lookup\n5\n>>> a.y                         # Descriptor lookup\n10\n",
            "subsections": []
        },
        "In the 'a.x' attribute lookup, the dot operator finds ''x': 5' in the": {
            "content": "class dictionary.  In the 'a.y' lookup, the dot operator finds a\ndescriptor instance, recognized by its 'get' method.  Calling that\nmethod returns '10'.\n",
            "subsections": []
        },
        "Note that the value '10' is not stored in either the class dictionary or": {
            "content": "the instance dictionary.  Instead, the value '10' is computed on demand.\n",
            "subsections": []
        },
        "This example shows how a simple descriptor works, but it isn't very": {
            "content": "useful.  For retrieving constants, normal attribute lookup would be\nbetter.\n",
            "subsections": []
        },
        "In the next section, we'll create something more useful, a dynamic": {
            "content": "lookup.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Dynamic lookups,  Next: Managed attributes,  Prev: Simple example A descriptor that returns a constant,  Up: Primer": {
            "content": "9.3.1.2 Dynamic lookups\n.......................\n",
            "subsections": []
        },
        "Interesting descriptors typically run computations instead of returning": {
            "content": "constants:\n\nimport os\n\nclass DirectorySize:\n\ndef get(self, obj, objtype=None):\nreturn len(os.listdir(obj.dirname))\n\nclass Directory:\n\nsize = DirectorySize()              # Descriptor instance\n\ndef init(self, dirname):\nself.dirname = dirname          # Regular instance attribute\n",
            "subsections": []
        },
        "An interactive session shows that the lookup is dynamic -- it computes": {
            "content": "different, updated answers each time:\n\n>>> s = Directory('songs')\n>>> g = Directory('games')\n>>> s.size                              # The songs directory has twenty files\n20\n>>> g.size                              # The games directory has three files\n3\n>>> os.remove('games/chess')            # Delete a game\n>>> g.size                              # File count is automatically updated\n2\n",
            "subsections": []
        },
        "Besides showing how descriptors can run computations, this example also": {
            "content": "reveals the purpose of the parameters to 'get()'.  The 'self'\nparameter is 'size', an instance of 'DirectorySize'.  The 'obj'\nparameter is either 'g' or 's', an instance of 'Directory'.  It is the\n'obj' parameter that lets the 'get()' method learn the target\ndirectory.  The 'objtype' parameter is the class 'Directory'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Managed attributes,  Next: Customized names,  Prev: Dynamic lookups,  Up: Primer": {
            "content": "9.3.1.3 Managed attributes\n..........................\n\nA popular use for descriptors is managing access to instance data.  The\ndescriptor is assigned to a public attribute in the class dictionary\nwhile the actual data is stored as a private attribute in the instance\ndictionary.  The descriptor's 'get()' and 'set()' methods are\ntriggered when the public attribute is accessed.\n",
            "subsections": []
        },
        "In the following example, 'age' is the public attribute and 'age' is": {
            "content": "the private attribute.  When the public attribute is accessed, the\ndescriptor logs the lookup or update:\n\nimport logging\n\nlogging.basicConfig(level=logging.INFO)\n\nclass LoggedAgeAccess:\n\ndef get(self, obj, objtype=None):\nvalue = obj.age\nlogging.info('Accessing %r giving %r', 'age', value)\nreturn value\n\ndef set(self, obj, value):\nlogging.info('Updating %r to %r', 'age', value)\nobj.age = value\n\nclass Person:\n\nage = LoggedAgeAccess()             # Descriptor instance\n\ndef init(self, name, age):\nself.name = name                # Regular instance attribute\nself.age = age                  # Calls set()\n\ndef birthday(self):\nself.age += 1                   # Calls both get() and set()\n",
            "subsections": []
        },
        "An interactive session shows that all access to the managed attribute": {
            "content": "'age' is logged, but that the regular attribute 'name' is not logged:\n\n>>> mary = Person('Mary M', 30)         # The initial age update is logged\nINFO:root:Updating 'age' to 30\n>>> dave = Person('David D', 40)\nINFO:root:Updating 'age' to 40\n\n>>> vars(mary)                          # The actual data is in a private attribute\n{'name': 'Mary M', 'age': 30}\n>>> vars(dave)\n{'name': 'David D', 'age': 40}\n\n>>> mary.age                            # Access the data and log the lookup\nINFO:root:Accessing 'age' giving 30\n30\n>>> mary.birthday()                     # Updates are logged as well\nINFO:root:Accessing 'age' giving 30\nINFO:root:Updating 'age' to 31\n\n>>> dave.name                           # Regular attribute lookup isn't logged\n'David D'\n>>> dave.age                            # Only the managed attribute is logged\nINFO:root:Accessing 'age' giving 40\n40\n",
            "subsections": []
        },
        "One major issue with this example is that the private name 'age' is": {
            "content": "hardwired in the 'LoggedAgeAccess' class.  That means that each instance\ncan only have one logged attribute and that its name is unchangeable.\nIn the next example, we'll fix that problem.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Customized names,  Next: Closing thoughts,  Prev: Managed attributes,  Up: Primer": {
            "content": "9.3.1.4 Customized names\n........................\n",
            "subsections": []
        },
        "When a class uses descriptors, it can inform each descriptor about which": {
            "content": "variable name was used.\n",
            "subsections": []
        },
        "In this example, the 'Person' class has two descriptor instances, 'name'": {
            "content": "and 'age'.  When the 'Person' class is defined, it makes a callback to\n'setname()' in 'LoggedAccess' so that the field names can be\nrecorded, giving each descriptor its own 'publicname' and\n'privatename':\n\nimport logging\n\nlogging.basicConfig(level=logging.INFO)\n\nclass LoggedAccess:\n\ndef setname(self, owner, name):\nself.publicname = name\nself.privatename = '' + name\n\ndef get(self, obj, objtype=None):\nvalue = getattr(obj, self.privatename)\nlogging.info('Accessing %r giving %r', self.publicname, value)\nreturn value\n\ndef set(self, obj, value):\nlogging.info('Updating %r to %r', self.publicname, value)\nsetattr(obj, self.privatename, value)\n\nclass Person:\n\nname = LoggedAccess()                # First descriptor instance\nage = LoggedAccess()                 # Second descriptor instance\n\ndef init(self, name, age):\nself.name = name                 # Calls the first descriptor\nself.age = age                   # Calls the second descriptor\n\ndef birthday(self):\nself.age += 1\n",
            "subsections": []
        },
        "An interactive session shows that the 'Person' class has called": {
            "content": "'setname()' so that the field names would be recorded.  Here we\ncall *note vars(): 17c1. to look up the descriptor without triggering\nit:\n\n>>> vars(vars(Person)['name'])\n{'publicname': 'name', 'privatename': 'name'}\n>>> vars(vars(Person)['age'])\n{'publicname': 'age', 'privatename': 'age'}\n\nThe new class now logs access to both 'name' and 'age':\n\n>>> pete = Person('Peter P', 10)\nINFO:root:Updating 'name' to 'Peter P'\nINFO:root:Updating 'age' to 10\n>>> kate = Person('Catherine C', 20)\nINFO:root:Updating 'name' to 'Catherine C'\nINFO:root:Updating 'age' to 20\n\nThe two 'Person' instances contain only the private names:\n\n>>> vars(pete)\n{'name': 'Peter P', 'age': 10}\n>>> vars(kate)\n{'name': 'Catherine C', 'age': 20}\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Closing thoughts,  Prev: Customized names,  Up: Primer": {
            "content": "9.3.1.5 Closing thoughts\n........................\n\nA *note descriptor: 1c78. is what we call any object that defines\n'get()', 'set()', or 'delete()'.\n",
            "subsections": []
        },
        "Optionally, descriptors can have a 'setname()' method.  This is": {
            "content": "only used in cases where a descriptor needs to know either the class\nwhere it was created or the name of class variable it was assigned to.\n(This method, if present, is called even if the class is not a\ndescriptor.)\n",
            "subsections": []
        },
        "Descriptors get invoked by the dot operator during attribute lookup.  If": {
            "content": "a descriptor is accessed indirectly with\n'vars(someclass)[descriptorname]', the descriptor instance is returned\nwithout invoking it.\n",
            "subsections": []
        },
        "Descriptors only work when used as class variables.  When put in": {
            "content": "instances, they have no effect.\n",
            "subsections": []
        },
        "The main motivation for descriptors is to provide a hook allowing": {
            "content": "objects stored in class variables to control what happens during\nattribute lookup.\n\nTraditionally, the calling class controls what happens during lookup.",
            "subsections": []
        },
        "Descriptors invert that relationship and allow the data being looked-up": {
            "content": "to have a say in the matter.\n",
            "subsections": []
        },
        "Descriptors are used throughout the language.  It is how functions turn": {
            "content": "into bound methods.  Common tools like *note classmethod(): 246, *note\nstaticmethod(): 5cc, *note property(): 3f6, and *note\nfunctools.cachedproperty(): 299. are all implemented as descriptors.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Complete Practical Example,  Next: Technical Tutorial,  Prev: Primer,  Up: Descriptor Guide": {
            "content": "",
            "subsections": []
        },
        "In this example, we create a practical and powerful tool for locating": {
            "content": "notoriously hard to find data corruption bugs.\n\n* Menu:\n\n* Validator class::\n* Custom validators::\n* Practical application::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Validator class,  Next: Custom validators,  Up: Complete Practical Example": {
            "content": "9.3.2.1 Validator class\n.......................\n\nA validator is a descriptor for managed attribute access.  Prior to\nstoring any data, it verifies that the new value meets various type and\nrange restrictions.  If those restrictions aren't met, it raises an\nexception to prevent data corruption at its source.\n\nThis 'Validator' class is both an *note abstract base class: 102a. and a\nmanaged attribute descriptor:\n\nfrom abc import ABC, abstractmethod\n\nclass Validator(ABC):\n\ndef setname(self, owner, name):\nself.privatename = '' + name\n\ndef get(self, obj, objtype=None):\nreturn getattr(obj, self.privatename)\n\ndef set(self, obj, value):\nself.validate(value)\nsetattr(obj, self.privatename, value)\n\n@abstractmethod\ndef validate(self, value):\npass\n",
            "subsections": []
        },
        "Custom validators need to inherit from 'Validator' and must supply a": {
            "content": "'validate()' method to test various restrictions as needed.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Custom validators,  Next: Practical application,  Prev: Validator class,  Up: Complete Practical Example": {
            "content": "9.3.2.2 Custom validators\n.........................\n\nHere are three practical data validation utilities:\n\n1. 'OneOf' verifies that a value is one of a restricted set of\noptions.\n\n2. 'Number' verifies that a value is either an *note int: 17e. or\n*note float: 4b7.  Optionally, it verifies that a value is between\na given minimum or maximum.\n\n3. 'String' verifies that a value is a *note str: 157.  Optionally, it\nvalidates a given minimum or maximum length.  It can validate a\nuser-defined predicate(1) as well.\n\nclass OneOf(Validator):\n\ndef init(self, *options):\nself.options = set(options)\n\ndef validate(self, value):\nif value not in self.options:\nraise ValueError(f'Expected {value!r} to be one of {self.options!r}')\n\nclass Number(Validator):\n\ndef init(self, minvalue=None, maxvalue=None):\nself.minvalue = minvalue\nself.maxvalue = maxvalue\n\ndef validate(self, value):\nif not isinstance(value, (int, float)):\nraise TypeError(f'Expected {value!r} to be an int or float')\nif self.minvalue is not None and value < self.minvalue:\nraise ValueError(\nf'Expected {value!r} to be at least {self.minvalue!r}'\n)\nif self.maxvalue is not None and value > self.maxvalue:\nraise ValueError(\nf'Expected {value!r} to be no more than {self.maxvalue!r}'\n)\n\nclass String(Validator):\n\ndef init(self, minsize=None, maxsize=None, predicate=None):\nself.minsize = minsize\nself.maxsize = maxsize\nself.predicate = predicate\n\ndef validate(self, value):\nif not isinstance(value, str):\nraise TypeError(f'Expected {value!r} to be an str')\nif self.minsize is not None and len(value) < self.minsize:\nraise ValueError(\nf'Expected {value!r} to be no smaller than {self.minsize!r}'\n)\nif self.maxsize is not None and len(value) > self.maxsize:\nraise ValueError(\nf'Expected {value!r} to be no bigger than {self.maxsize!r}'\n)\nif self.predicate is not None and not self.predicate(value):\nraise ValueError(\nf'Expected {self.predicate} to be true for {value!r}'\n)\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Predicate(mathematicallogic)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Practical application,  Prev: Custom validators,  Up: Complete Practical Example": {
            "content": "9.3.2.3 Practical application\n.............................\n\nHere's how the data validators can be used in a real class:\n\nclass Component:\n\nname = String(minsize=3, maxsize=10, predicate=str.isupper)\nkind = OneOf('wood', 'metal', 'plastic')\nquantity = Number(minvalue=0)\n\ndef init(self, name, kind, quantity):\nself.name = name\nself.kind = kind\nself.quantity = quantity\n\nThe descriptors prevent invalid instances from being created:\n\n>>> Component('Widget', 'metal', 5)      # Blocked: 'Widget' is not all uppercase\nTraceback (most recent call last):\n...\nValueError: Expected <method 'isupper' of 'str' objects> to be true for 'Widget'\n\n>>> Component('WIDGET', 'metle', 5)      # Blocked: 'metle' is misspelled\nTraceback (most recent call last):\n...\nValueError: Expected 'metle' to be one of {'metal', 'plastic', 'wood'}\n\n>>> Component('WIDGET', 'metal', -5)     # Blocked: -5 is negative\nTraceback (most recent call last):\n...\nValueError: Expected -5 to be at least 0\n>>> Component('WIDGET', 'metal', 'V')    # Blocked: 'V' isn't a number\nTraceback (most recent call last):\n...\nTypeError: Expected 'V' to be an int or float\n\n>>> c = Component('WIDGET', 'metal', 5)  # Allowed:  The inputs are valid\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Technical Tutorial,  Next: Pure Python Equivalents,  Prev: Complete Practical Example,  Up: Descriptor Guide": {
            "content": "",
            "subsections": []
        },
        "What follows is a more technical tutorial for the mechanics and details": {
            "content": "of how descriptors work.\n\n* Menu:\n\n* Abstract::\n* Definition and introduction::\n* Descriptor protocol::\n* Overview of descriptor invocation::\n* Invocation from an instance::\n* Invocation from a class::\n* Invocation from super::\n* Summary of invocation logic::\n* Automatic name notification::\n* ORM example::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Abstract,  Next: Definition and introduction,  Up: Technical Tutorial": {
            "content": "9.3.3.1 Abstract\n................\n",
            "subsections": []
        },
        "Defines descriptors, summarizes the protocol, and shows how descriptors": {
            "content": "are called.  Provides an example showing how object relational mappings\nwork.\n",
            "subsections": []
        },
        "Learning about descriptors not only provides access to a larger toolset,": {
            "content": "it creates a deeper understanding of how Python works.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Definition and introduction,  Next: Descriptor protocol,  Prev: Abstract,  Up: Technical Tutorial": {
            "content": "9.3.3.2 Definition and introduction\n...................................\n",
            "subsections": []
        },
        "In general, a descriptor is an attribute value that has one of the": {
            "content": "methods in the descriptor protocol.  Those methods are 'get()',\n'set()', and 'delete()'.  If any of those methods are defined\nfor an attribute, it is said to be a *note descriptor: 1c78.\n",
            "subsections": []
        },
        "Descriptors are a powerful, general purpose protocol.  They are the": {
            "content": "mechanism behind properties, methods, static methods, class methods, and\n*note super(): 204.  They are used throughout Python itself.",
            "subsections": []
        },
        "Descriptors simplify the underlying C code and offer a flexible set of": {
            "content": "new tools for everyday Python programs.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Descriptor protocol,  Next: Overview of descriptor invocation,  Prev: Definition and introduction,  Up: Technical Tutorial": {
            "content": "9.3.3.3 Descriptor protocol\n...........................\n\n'descr.get(self, obj, type=None)'\n\n'descr.set(self, obj, value)'\n\n'descr.delete(self, obj)'\n",
            "subsections": []
        },
        "That is all there is to it.  Define any of these methods and an object": {
            "content": "is considered a descriptor and can override default behavior upon being\nlooked up as an attribute.\n",
            "subsections": []
        },
        "If an object defines 'set()' or 'delete()', it is considered a": {
            "content": "data descriptor.  Descriptors that only define 'get()' are called\nnon-data descriptors (they are often used for methods but other uses are\npossible).\n",
            "subsections": []
        },
        "Data and non-data descriptors differ in how overrides are calculated": {
            "content": "with respect to entries in an instance's dictionary.  If an instance's\ndictionary has an entry with the same name as a data descriptor, the\ndata descriptor takes precedence.  If an instance's dictionary has an\nentry with the same name as a non-data descriptor, the dictionary entry\ntakes precedence.\n",
            "subsections": []
        },
        "To make a read-only data descriptor, define both 'get()' and": {
            "content": "'set()' with the 'set()' raising an *note AttributeError: 395.\nwhen called.  Defining the 'set()' method with an exception raising\nplaceholder is enough to make it a data descriptor.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Overview of descriptor invocation,  Next: Invocation from an instance,  Prev: Descriptor protocol,  Up: Technical Tutorial": {
            "content": "9.3.3.4 Overview of descriptor invocation\n.........................................\n\nA descriptor can be called directly with 'desc.get(obj)' or\n'desc.get(None, cls)'.\n",
            "subsections": []
        },
        "But it is more common for a descriptor to be invoked automatically from": {
            "content": "attribute access.\n",
            "subsections": []
        },
        "The expression 'obj.x' looks up the attribute 'x' in the chain of": {
            "content": "namespaces for 'obj'.  If the search finds a descriptor outside of the\ninstance 'dict', its 'get()' method is invoked according to the\nprecedence rules listed below.\n",
            "subsections": []
        },
        "The details of invocation depend on whether 'obj' is an object, class,": {
            "content": "or instance of super.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Invocation from an instance,  Next: Invocation from a class,  Prev: Overview of descriptor invocation,  Up: Technical Tutorial": {
            "content": "9.3.3.5 Invocation from an instance\n...................................\n",
            "subsections": []
        },
        "Instance lookup scans through a chain of namespaces giving data": {
            "content": "descriptors the highest priority, followed by instance variables, then\nnon-data descriptors, then class variables, and lastly 'getattr()'\nif it is provided.\n\nIf a descriptor is found for 'a.x', then it is invoked with:\n'desc.get(a, type(a))'.\n\nThe logic for a dotted lookup is in *note object.getattribute():\na16.  Here is a pure Python equivalent:\n\ndef findnameinmro(cls, name, default):\n\"Emulate PyTypeLookup() in Objects/typeobject.c\"\nfor base in cls.mro:\nif name in vars(base):\nreturn vars(base)[name]\nreturn default\n\ndef objectgetattribute(obj, name):\n\"Emulate PyObjectGenericGetAttr() in Objects/object.c\"\nnull = object()\nobjtype = type(obj)\nclsvar = findnameinmro(objtype, name, null)\ndescrget = getattr(type(clsvar), 'get', null)\nif descrget is not null:\nif (hasattr(type(clsvar), 'set')\nor hasattr(type(clsvar), 'delete')):\nreturn descrget(clsvar, obj, objtype)     # data descriptor\nif hasattr(obj, 'dict') and name in vars(obj):\nreturn vars(obj)[name]                          # instance variable\nif descrget is not null:\nreturn descrget(clsvar, obj, objtype)         # non-data descriptor\nif clsvar is not null:\nreturn clsvar                                  # class variable\nraise AttributeError(name)\n\nNote, there is no 'getattr()' hook in the 'getattribute()' code.",
            "subsections": []
        },
        "That is why calling 'getattribute()' directly or with": {
            "content": "'super().getattribute' will bypass 'getattr()' entirely.\n\nInstead, it is the dot operator and the *note getattr(): a15. function\nthat are responsible for invoking 'getattr()' whenever\n'getattribute()' raises an *note AttributeError: 395.  Their logic\nis encapsulated in a helper function:\n\ndef getattrhook(obj, name):\n\"Emulate slottpgetattrhook() in Objects/typeobject.c\"\ntry:\nreturn obj.getattribute(name)\nexcept AttributeError:\nif not hasattr(type(obj), 'getattr'):\nraise\nreturn type(obj).getattr(obj, name)             # getattr\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Invocation from a class,  Next: Invocation from super,  Prev: Invocation from an instance,  Up: Technical Tutorial": {
            "content": "9.3.3.6 Invocation from a class\n...............................\n",
            "subsections": []
        },
        "The logic for a dotted lookup such as 'A.x' is in": {
            "content": "'type.getattribute()'.  The steps are similar to those for *note\nobject.getattribute(): a16. but the instance dictionary lookup is\nreplaced by a search through the class's *note method resolution order:\n1e8b.\n\nIf a descriptor is found, it is invoked with 'desc.get(None, A)'.\n",
            "subsections": []
        },
        "The full C implementation can be found in 'typegetattro()' and": {
            "content": "'PyTypeLookup()' in Objects/typeobject.c(1).\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Objects/typeobject.c\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Invocation from super,  Next: Summary of invocation logic,  Prev: Invocation from a class,  Up: Technical Tutorial": {
            "content": "9.3.3.7 Invocation from super\n.............................\n",
            "subsections": []
        },
        "The logic for super's dotted lookup is in the 'getattribute()'": {
            "content": "method for object returned by *note super(): 204.\n\nA dotted lookup such as 'super(A, obj).m' searches\n'obj.class.mro' for the base class 'B' immediately following 'A'\nand then returns 'B.dict['m'].get(obj, A)'.  If not a\ndescriptor, 'm' is returned unchanged.\n",
            "subsections": []
        },
        "The full C implementation can be found in 'supergetattro()' in": {
            "content": "",
            "subsections": []
        },
        "Objects/typeobject.c(1).  A pure Python equivalent can be found in": {
            "content": "Guido's Tutorial(2).\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Objects/typeobject.c\n\n(2)\nhttps://www.python.org/download/releases/2.2.3/descrintro/#cooperation\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Summary of invocation logic,  Next: Automatic name notification,  Prev: Invocation from super,  Up: Technical Tutorial": {
            "content": "9.3.3.8 Summary of invocation logic\n...................................\n",
            "subsections": []
        },
        "The mechanism for descriptors is embedded in the 'getattribute()'": {
            "content": "methods for *note object: 8bb, *note type: ba0, and *note super(): 204.\n\nThe important points to remember are:\n\n* Descriptors are invoked by the 'getattribute()' method.\n\n* Classes inherit this machinery from *note object: 8bb, *note type:\nba0, or *note super(): 204.\n\n* Overriding 'getattribute()' prevents automatic descriptor calls\nbecause all the descriptor logic is in that method.\n\n* *note object.getattribute(): a16. and 'type.getattribute()'\nmake different calls to 'get()'.  The first includes the\ninstance and may include the class.  The second puts in 'None' for\nthe instance and always includes the class.\n\n* Data descriptors always override instance dictionaries.\n\n* Non-data descriptors may be overridden by instance dictionaries.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Automatic name notification,  Next: ORM example,  Prev: Summary of invocation logic,  Up: Technical Tutorial": {
            "content": "9.3.3.9 Automatic name notification\n...................................\n",
            "subsections": []
        },
        "Sometimes it is desirable for a descriptor to know what class variable": {
            "content": "name it was assigned to.  When a new class is created, the *note type:\nba0. metaclass scans the dictionary of the new class.  If any of the\nentries are descriptors and if they define 'setname()', that method\nis called with two arguments.  The 'owner' is the class where the\ndescriptor is used, and the 'name' is the class variable the descriptor\nwas assigned to.\n",
            "subsections": []
        },
        "The implementation details are in 'typenew()' and 'setnames()' in": {
            "content": "Objects/typeobject.c(1).\n",
            "subsections": []
        },
        "Since the update logic is in 'type.new()', notifications only take": {
            "content": "place at the time of class creation.  If descriptors are added to the\nclass afterwards, 'setname()' will need to be called manually.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Objects/typeobject.c\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ORM example,  Prev: Automatic name notification,  Up: Technical Tutorial": {
            "content": "9.3.3.10 ORM example\n....................\n",
            "subsections": []
        },
        "The following code is a simplified skeleton showing how data descriptors": {
            "content": "could be used to implement an object relational mapping(1).\n\nThe essential idea is that the data is stored in an external database.\nThe Python instances only hold keys to the database's tables.\nDescriptors take care of lookups or updates:\n\nclass Field:\n\ndef setname(self, owner, name):\nself.fetch = f'SELECT {name} FROM {owner.table} WHERE {owner.key}=?;'\nself.store = f'UPDATE {owner.table} SET {name}=? WHERE {owner.key}=?;'\n\ndef get(self, obj, objtype=None):\nreturn conn.execute(self.fetch, [obj.key]).fetchone()[0]\n\ndef set(self, obj, value):\nconn.execute(self.store, [value, obj.key])\nconn.commit()\n",
            "subsections": []
        },
        "We can use the 'Field' class to define models(2) that describe the": {
            "content": "schema for each table in a database:\n\nclass Movie:\ntable = 'Movies'                    # Table name\nkey = 'title'                       # Primary key\ndirector = Field()\nyear = Field()\n\ndef init(self, key):\nself.key = key\n\nclass Song:\ntable = 'Music'\nkey = 'title'\nartist = Field()\nyear = Field()\ngenre = Field()\n\ndef init(self, key):\nself.key = key\n\nTo use the models, first connect to the database:\n\n>>> import sqlite3\n>>> conn = sqlite3.connect('entertainment.db')\n",
            "subsections": []
        },
        "An interactive session shows how data is retrieved from the database and": {
            "content": "how it can be updated:\n\n>>> Movie('Star Wars').director\n'George Lucas'\n>>> jaws = Movie('Jaws')\n>>> f'Released in {jaws.year} by {jaws.director}'\n'Released in 1975 by Steven Spielberg'\n\n>>> Song('Country Roads').artist\n'John Denver'\n\n>>> Movie('Star Wars').director = 'J.J. Abrams'\n>>> Movie('Star Wars').director\n'J.J. Abrams'\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Object%E2%80%93relationalmapping\n\n(2) https://en.wikipedia.org/wiki/Databasemodel\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Pure Python Equivalents,  Prev: Technical Tutorial,  Up: Descriptor Guide": {
            "content": "The descriptor protocol is simple and offers exciting possibilities.",
            "subsections": []
        },
        "Several use cases are so common that they have been prepackaged into": {
            "content": "built-in tools.  Properties, bound methods, static methods, class\nmethods, and slots are all based on the descriptor protocol.\n\n* Menu:\n\n* Properties::\n* Functions and methods::\n* Kinds of methods::\n* Static methods::\n* Class methods::\n* Member objects and slots::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Properties,  Next: Functions and methods,  Up: Pure Python Equivalents": {
            "content": "9.3.4.1 Properties\n..................\n\nCalling *note property(): 3f6. is a succinct way of building a data\ndescriptor that triggers a function call upon access to an attribute.\nIts signature is:\n\nproperty(fget=None, fset=None, fdel=None, doc=None) -> property\n\nThe documentation shows a typical use to define a managed attribute 'x':\n\nclass C:\ndef getx(self): return self.x\ndef setx(self, value): self.x = value\ndef delx(self): del self.x\nx = property(getx, setx, delx, \"I'm the 'x' property.\")\n\nTo see how *note property(): 3f6. is implemented in terms of the\ndescriptor protocol, here is a pure Python equivalent:\n\nclass Property:\n\"Emulate PyPropertyType() in Objects/descrobject.c\"\n\ndef init(self, fget=None, fset=None, fdel=None, doc=None):\nself.fget = fget\nself.fset = fset\nself.fdel = fdel\nif doc is None and fget is not None:\ndoc = fget.doc\nself.doc = doc\nself.name = ''\n\ndef setname(self, owner, name):\nself.name = name\n\ndef get(self, obj, objtype=None):\nif obj is None:\nreturn self\nif self.fget is None:\nraise AttributeError(\nf'property {self.name!r} of {type(obj).name!r} object has no getter'\n)\nreturn self.fget(obj)\n\ndef set(self, obj, value):\nif self.fset is None:\nraise AttributeError(\nf'property {self.name!r} of {type(obj).name!r} object has no setter'\n)\nself.fset(obj, value)\n\ndef delete(self, obj):\nif self.fdel is None:\nraise AttributeError(\nf'property {self.name!r} of {type(obj).name!r} object has no deleter'\n)\nself.fdel(obj)\n\ndef getter(self, fget):\nprop = type(self)(fget, self.fset, self.fdel, self.doc)\nprop.name = self.name\nreturn prop\n\ndef setter(self, fset):\nprop = type(self)(self.fget, fset, self.fdel, self.doc)\nprop.name = self.name\nreturn prop\n\ndef deleter(self, fdel):\nprop = type(self)(self.fget, self.fset, fdel, self.doc)\nprop.name = self.name\nreturn prop\n\nThe *note property(): 3f6. builtin helps whenever a user interface has\ngranted attribute access and then subsequent changes require the\nintervention of a method.\n",
            "subsections": []
        },
        "For instance, a spreadsheet class may grant access to a cell value": {
            "content": "through 'Cell('b10').value'.  Subsequent improvements to the program\nrequire the cell to be recalculated on every access; however, the\nprogrammer does not want to affect existing client code accessing the\nattribute directly.  The solution is to wrap access to the value\nattribute in a property data descriptor:\n\nclass Cell:\n...\n\n@property\ndef value(self):\n\"Recalculate the cell before returning value\"\nself.recalc()\nreturn self.value\n\nEither the built-in *note property(): 3f6. or our 'Property()'\nequivalent would work in this example.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Functions and methods,  Next: Kinds of methods,  Prev: Properties,  Up: Pure Python Equivalents": {
            "content": "9.3.4.2 Functions and methods\n.............................\n",
            "subsections": []
        },
        "Python's object oriented features are built upon a function based": {
            "content": "environment.  Using non-data descriptors, the two are merged seamlessly.\n",
            "subsections": []
        },
        "Functions stored in class dictionaries get turned into methods when": {
            "content": "invoked.  Methods only differ from regular functions in that the object\ninstance is prepended to the other arguments.  By convention, the\ninstance is called 'self' but could be called 'this' or any other\nvariable name.\n\nMethods can be created manually with *note types.MethodType: 1558. which\nis roughly equivalent to:\n\nclass MethodType:\n\"Emulate PyMethodType in Objects/classobject.c\"\n\ndef init(self, func, obj):\nself.func = func\nself.self = obj\n\ndef call(self, *args, kwargs):\nfunc = self.func\nobj = self.self\nreturn func(obj, *args, kwargs)\n",
            "subsections": []
        },
        "To support automatic creation of methods, functions include the": {
            "content": "'get()' method for binding methods during attribute access.  This\nmeans that functions are non-data descriptors that return bound methods\nduring dotted lookup from an instance.  Here's how it works:\n\nclass Function:\n...\n\ndef get(self, obj, objtype=None):\n\"Simulate funcdescrget() in Objects/funcobject.c\"\nif obj is None:\nreturn self\nreturn MethodType(self, obj)\n",
            "subsections": []
        },
        "Running the following class in the interpreter shows how the function": {
            "content": "descriptor works in practice:\n\nclass D:\ndef f(self, x):\nreturn x\n\nThe function has a *note qualified name: 16a7. attribute to support\nintrospection:\n\n>>> D.f.qualname\n'D.f'\n",
            "subsections": []
        },
        "Accessing the function through the class dictionary does not invoke": {
            "content": "'get()'.  Instead, it just returns the underlying function object:\n\n>>> D.dict['f']\n<function D.f at 0x00C45070>\n",
            "subsections": []
        },
        "Dotted access from a class calls 'get()' which just returns the": {
            "content": "underlying function unchanged:\n\n>>> D.f\n<function D.f at 0x00C45070>\n\nThe interesting behavior occurs during dotted access from an instance.\nThe dotted lookup calls 'get()' which returns a bound method object:\n\n>>> d = D()\n>>> d.f\n<bound method D.f of <main.D object at 0x00B18C90>>\n",
            "subsections": []
        },
        "Internally, the bound method stores the underlying function and the": {
            "content": "bound instance:\n\n>>> d.f.func\n<function D.f at 0x00C45070>\n\n>>> d.f.self\n<main.D object at 0x00B18C90>\n",
            "subsections": []
        },
        "If you have ever wondered where 'self' comes from in regular methods or": {
            "content": "where 'cls' comes from in class methods, this is it!\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Kinds of methods,  Next: Static methods,  Prev: Functions and methods,  Up: Pure Python Equivalents": {
            "content": "9.3.4.3 Kinds of methods\n........................\n",
            "subsections": []
        },
        "Non-data descriptors provide a simple mechanism for variations on the": {
            "content": "usual patterns of binding functions into methods.\n",
            "subsections": []
        },
        "To recap, functions have a 'get()' method so that they can be": {
            "content": "converted to a method when accessed as attributes.  The non-data\ndescriptor transforms an 'obj.f(*args)' call into 'f(obj, *args)'.\nCalling 'cls.f(*args)' becomes 'f(*args)'.\n\nThis chart summarizes the binding and its two most useful variants:\n\nTransformation        Called from an object      Called from a class\n\n------------------------------------------------------------------------\n\nfunction              f(obj, *args)              f(*args)\n\n\nstaticmethod          f(*args)                   f(*args)\n\n\nclassmethod           f(type(obj), *args)        f(cls, *args)\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Static methods,  Next: Class methods,  Prev: Kinds of methods,  Up: Pure Python Equivalents": {
            "content": "9.3.4.4 Static methods\n......................\n",
            "subsections": []
        },
        "Static methods return the underlying function without changes.  Calling": {
            "content": "either 'c.f' or 'C.f' is the equivalent of a direct lookup into\n'object.getattribute(c, \"f\")' or 'object.getattribute(C, \"f\")'.",
            "subsections": []
        },
        "As a result, the function becomes identically accessible from either an": {
            "content": "object or a class.\n",
            "subsections": []
        },
        "Good candidates for static methods are methods that do not reference the": {
            "content": "'self' variable.\n",
            "subsections": []
        },
        "For instance, a statistics package may include a container class for": {
            "content": "experimental data.  The class provides normal methods for computing the\naverage, mean, median, and other descriptive statistics that depend on\nthe data.  However, there may be useful functions which are conceptually\nrelated but do not depend on the data.  For instance, 'erf(x)' is handy\nconversion routine that comes up in statistical work but does not\ndirectly depend on a particular dataset.  It can be called either from\nan object or the class: 's.erf(1.5) --> .9332' or 'Sample.erf(1.5) -->\n.9332'.\n",
            "subsections": []
        },
        "Since static methods return the underlying function with no changes, the": {
            "content": "example calls are unexciting:\n\nclass E:\n@staticmethod\ndef f(x):\nreturn x * 10\n\n>>> E.f(3)\n30\n>>> E().f(3)\n30\n\nUsing the non-data descriptor protocol, a pure Python version of *note\nstaticmethod(): 5cc. would look like this:\n\nimport functools\n\nclass StaticMethod:\n\"Emulate PyStaticMethodType() in Objects/funcobject.c\"\n\ndef init(self, f):\nself.f = f\nfunctools.updatewrapper(self, f)\n\ndef get(self, obj, objtype=None):\nreturn self.f\n\ndef call(self, *args, kwds):\nreturn self.f(*args, kwds)\n\nThe *note functools.updatewrapper(): e99. call adds a 'wrapped'\nattribute that refers to the underlying function.  Also it carries\nforward the attributes necessary to make the wrapper look like the\nwrapped function: *note name: 1149, *note qualname: 1c1b, *note\ndoc: 104d, and *note annotations: 104c.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Class methods,  Next: Member objects and slots,  Prev: Static methods,  Up: Pure Python Equivalents": {
            "content": "9.3.4.5 Class methods\n.....................\n",
            "subsections": []
        },
        "Unlike static methods, class methods prepend the class reference to the": {
            "content": "argument list before calling the function.  This format is the same for\nwhether the caller is an object or a class:\n\nclass F:\n@classmethod\ndef f(cls, x):\nreturn cls.name, x\n\n>>> F.f(3)\n('F', 3)\n>>> F().f(3)\n('F', 3)\n",
            "subsections": []
        },
        "This behavior is useful whenever the method only needs to have a class": {
            "content": "reference and does not rely on data stored in a specific instance.  One\nuse for class methods is to create alternate class constructors.  For\nexample, the classmethod *note dict.fromkeys(): 1f4e. creates a new\ndictionary from a list of keys.  The pure Python equivalent is:\n\nclass Dict(dict):\n@classmethod\ndef fromkeys(cls, iterable, value=None):\n\"Emulate dictfromkeys() in Objects/dictobject.c\"\nd = cls()\nfor key in iterable:\nd[key] = value\nreturn d\n\nNow a new dictionary of unique keys can be constructed like this:\n\n>>> d = Dict.fromkeys('abracadabra')\n>>> type(d) is Dict\nTrue\n>>> d\n{'a': None, 'b': None, 'r': None, 'c': None, 'd': None}\n\nUsing the non-data descriptor protocol, a pure Python version of *note\nclassmethod(): 246. would look like this:\n\nimport functools\n\nclass ClassMethod:\n\"Emulate PyClassMethodType() in Objects/funcobject.c\"\n\ndef init(self, f):\nself.f = f\nfunctools.updatewrapper(self, f)\n\ndef get(self, obj, cls=None):\nif cls is None:\ncls = type(obj)\nif hasattr(type(self.f), 'get'):\n# This code path was added in Python 3.9\n# and was deprecated in Python 3.11.\nreturn self.f.get(cls, cls)\nreturn MethodType(self.f, cls)\n",
            "subsections": []
        },
        "The code path for 'hasattr(type(self.f), 'get')' was added in Python": {
            "content": "3.9 and makes it possible for *note classmethod(): 246. to support\nchained decorators.  For example, a classmethod and property could be\nchained together.  In Python 3.11, this functionality was deprecated.\n\nclass G:\n@classmethod\n@property\ndef doc(cls):\nreturn f'A doc for {cls.name!r}'\n\n>>> G.doc\n\"A doc for 'G'\"\n\nThe *note functools.updatewrapper(): e99. call in 'ClassMethod' adds a\n'wrapped' attribute that refers to the underlying function.  Also it\ncarries forward the attributes necessary to make the wrapper look like\nthe wrapped function: *note name: 1149, *note qualname: 1c1b,\n*note doc: 104d, and *note annotations: 104c.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Member objects and slots,  Prev: Class methods,  Up: Pure Python Equivalents": {
            "content": "9.3.4.6 Member objects and slots\n....................................\n",
            "subsections": []
        },
        "When a class defines 'slots', it replaces instance dictionaries with": {
            "content": "a fixed-length array of slot values.  From a user point of view that has\nseveral effects:\n\n1.  Provides immediate detection of bugs due to misspelled attribute\nassignments.  Only attribute names specified in 'slots' are allowed:\n\nclass Vehicle:\nslots = ('idnumber', 'make', 'model')\n\n>>> auto = Vehicle()\n>>> auto.idnubmer = 'VYE483814LQEX'\nTraceback (most recent call last):\n...\nAttributeError: 'Vehicle' object has no attribute 'idnubmer'\n\n2.  Helps create immutable objects where descriptors manage access to\nprivate attributes stored in 'slots':\n\nclass Immutable:\n\nslots = ('dept', 'name')          # Replace the instance dictionary\n\ndef init(self, dept, name):\nself.dept = dept                   # Store to private attribute\nself.name = name                   # Store to private attribute\n\n@property                               # Read-only descriptor\ndef dept(self):\nreturn self.dept\n\n@property\ndef name(self):                         # Read-only descriptor\nreturn self.name\n\n>>> mark = Immutable('Botany', 'Mark Watney')\n>>> mark.dept\n'Botany'\n>>> mark.dept = 'Space Pirate'\nTraceback (most recent call last):\n...\nAttributeError: property 'dept' of 'Immutable' object has no setter\n>>> mark.location = 'Mars'\nTraceback (most recent call last):\n...\nAttributeError: 'Immutable' object has no attribute 'location'\n\n3.  Saves memory.  On a 64-bit Linux build, an instance with two\nattributes takes 48 bytes with 'slots' and 152 bytes without.  This\nflyweight design pattern(1) likely only matters when a large number of\ninstances are going to be created.\n\n4.  Improves speed.  Reading instance variables is 35% faster with\n'slots' (as measured with Python 3.10 on an Apple M1 processor).\n\n5.  Blocks tools like *note functools.cachedproperty(): 299. which\nrequire an instance dictionary to function correctly:\n\nfrom functools import cachedproperty\n\nclass CP:\nslots = ()                          # Eliminates the instance dict\n\n@cachedproperty                        # Requires an instance dict\ndef pi(self):\nreturn 4 * sum((-1.0)n / (2.0*n + 1.0)\nfor n in reversed(range(100000)))\n\n>>> CP().pi\nTraceback (most recent call last):\n...\nTypeError: No 'dict' attribute on 'CP' instance to cache 'pi' property.\n",
            "subsections": []
        },
        "It is not possible to create an exact drop-in pure Python version of": {
            "content": "'slots' because it requires direct access to C structures and\ncontrol over object memory allocation.  However, we can build a mostly\nfaithful simulation where the actual C structure for slots is emulated\nby a private 'slotvalues' list.  Reads and writes to that private\nstructure are managed by member descriptors:\n\nnull = object()\n\nclass Member:\n\ndef init(self, name, clsname, offset):\n'Emulate PyMemberDef in Include/structmember.h'\n# Also see descrnew() in Objects/descrobject.c\nself.name = name\nself.clsname = clsname\nself.offset = offset\n\ndef get(self, obj, objtype=None):\n'Emulate memberget() in Objects/descrobject.c'\n# Also see PyMemberGetOne() in Python/structmember.c\nif obj is None:\nreturn self\nvalue = obj.slotvalues[self.offset]\nif value is null:\nraise AttributeError(self.name)\nreturn value\n\ndef set(self, obj, value):\n'Emulate memberset() in Objects/descrobject.c'\nobj.slotvalues[self.offset] = value\n\ndef delete(self, obj):\n'Emulate memberdelete() in Objects/descrobject.c'\nvalue = obj.slotvalues[self.offset]\nif value is null:\nraise AttributeError(self.name)\nobj.slotvalues[self.offset] = null\n\ndef repr(self):\n'Emulate memberrepr() in Objects/descrobject.c'\nreturn f'<Member {self.name!r} of {self.clsname!r}>'\n",
            "subsections": []
        },
        "The 'type.new()' method takes care of adding member objects to class": {
            "content": "variables:\n\nclass Type(type):\n'Simulate how the type metaclass adds member objects for slots'\n\ndef new(mcls, clsname, bases, mapping, kwargs):\n'Emulate typenew() in Objects/typeobject.c'\n# typenew() calls PyTypeReady() which calls addmethods()\nslotnames = mapping.get('slotnames', [])\nfor offset, name in enumerate(slotnames):\nmapping[name] = Member(name, clsname, offset)\nreturn type.new(mcls, clsname, bases, mapping, kwargs)\n\nThe *note object.new(): 2e2. method takes care of creating instances\nthat have slots instead of an instance dictionary.  Here is a rough\nsimulation in pure Python:\n\nclass Object:\n'Simulate how object.new() allocates memory for slots'\n\ndef new(cls, *args, kwargs):\n'Emulate objectnew() in Objects/typeobject.c'\ninst = super().new(cls)\nif hasattr(cls, 'slotnames'):\nemptyslots = [null] * len(cls.slotnames)\nobject.setattr(inst, 'slotvalues', emptyslots)\nreturn inst\n\ndef setattr(self, name, value):\n'Emulate PyObjectGenericSetAttrWithDict() Objects/object.c'\ncls = type(self)\nif hasattr(cls, 'slotnames') and name not in cls.slotnames:\nraise AttributeError(\nf'{cls.name!r} object has no attribute {name!r}'\n)\nsuper().setattr(name, value)\n\ndef delattr(self, name):\n'Emulate PyObjectGenericSetAttrWithDict() Objects/object.c'\ncls = type(self)\nif hasattr(cls, 'slotnames') and name not in cls.slotnames:\nraise AttributeError(\nf'{cls.name!r} object has no attribute {name!r}'\n)\nsuper().delattr(name)\n",
            "subsections": []
        },
        "To use the simulation in a real class, just inherit from 'Object' and": {
            "content": "set the *note metaclass: 1c8e. to 'Type':\n\nclass H(Object, metaclass=Type):\n'Instance variables stored in slots'\n\nslotnames = ['x', 'y']\n\ndef init(self, x, y):\nself.x = x\nself.y = y\n\nAt this point, the metaclass has loaded member objects for 'x' and 'y':\n\n>>> from pprint import pp\n>>> pp(dict(vars(H)))\n{'module': 'main',\n'doc': 'Instance variables stored in slots',\n'slotnames': ['x', 'y'],\n'init': <function H.init at 0x7fb5d302f9d0>,\n'x': <Member 'x' of 'H'>,\n'y': <Member 'y' of 'H'>}\n",
            "subsections": []
        },
        "When instances are created, they have a 'slotvalues' list where the": {
            "content": "attributes are stored:\n\n>>> h = H(10, 20)\n>>> vars(h)\n{'slotvalues': [10, 20]}\n>>> h.x = 55\n>>> vars(h)\n{'slotvalues': [55, 20]}\n\nMisspelled or unassigned attributes will raise an exception:\n\n>>> h.xz\nTraceback (most recent call last):\n...\nAttributeError: 'H' object has no attribute 'xz'\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Flyweightpattern\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Debugging C API extensions and CPython Internals with GDB,  Next: Enum HOWTO,  Prev: Descriptor Guide,  Up: Python HOWTOs": {
            "content": "",
            "subsections": [
                {
                    "name": "9.4 Debugging C API extensions and CPython Internals with GDB",
                    "content": ""
                }
            ]
        },
        "This document explains how the Python GDB extension, 'python-gdb.py',": {
            "content": "can be used with the GDB debugger to debug CPython extensions and the\nCPython interpreter itself.\n",
            "subsections": []
        },
        "When debugging low-level problems such as crashes or deadlocks, a": {
            "content": "low-level debugger, such as GDB, is useful to diagnose and correct the\nissue.  By default, GDB (or any of its front-ends) doesn't support\nhigh-level information specific to the CPython interpreter.\n",
            "subsections": []
        },
        "The 'python-gdb.py' extension adds CPython interpreter information to": {
            "content": "GDB. The extension helps introspect the stack of currently executing\nPython functions.  Given a Python object represented by a *note\nPyObject: 6b1.* pointer, the extension surfaces the type and value of\nthe object.\n",
            "subsections": []
        },
        "Developers who are working on CPython extensions or tinkering with parts": {
            "content": "of CPython that are written in C can use this document to learn how to\nuse the 'python-gdb.py' extension with GDB.\n\nNote: This document assumes that you are familiar with the basics\nof GDB and the CPython C API. It consolidates guidance from the\ndevguide(1) and the Python wiki(2).\n\n* Menu:\n\n* Prerequisites::\n* Using the Debug build and Development mode::\n* Using the python-gdb extension::\n* Use with GDB commands::\n\n---------- Footnotes ----------\n\n(1) https://devguide.python.org\n\n(2) https://wiki.python.org/moin/DebuggingWithGdb\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Prerequisites,  Next: Using the Debug build and Development mode,  Up: Debugging C API extensions and CPython Internals with GDB": {
            "content": "You need to have:\n\n- GDB 7 or later.  (For earlier versions of GDB, see 'Misc/gdbinit'\nin the sources of Python 3.11 or earlier.)\n\n- GDB-compatible debugging information for Python and any extension\nyou are debugging.\n\n- The 'python-gdb.py' extension.\n",
            "subsections": []
        },
        "The extension is built with Python, but might be distributed separately": {
            "content": "or not at all.  Below, we include tips for a few common systems as\nexamples.  Note that even if the instructions match your system, they\nmight be outdated.\n\n* Menu:\n\n* Setup with Python built from source::\n* Setup for Python from a Linux distro::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Setup with Python built from source,  Next: Setup for Python from a Linux distro,  Up: Prerequisites": {
            "content": "9.4.1.1 Setup with Python built from source\n...........................................\n",
            "subsections": []
        },
        "When you build CPython from source, debugging information should be": {
            "content": "available, and the build should add a 'python-gdb.py' file to the root\ndirectory of your repository.\n",
            "subsections": []
        },
        "To activate support, you must add the directory containing": {
            "content": "'python-gdb.py' to GDB's \"auto-load-safe-path\".  If you haven't done\nthis, recent versions of GDB will print out a warning with instructions\non how to do this.\n\nNote: If you do not see instructions for your version of GDB, put\nthis in your configuration file ('~/.gdbinit' or\n'~/.config/gdb/gdbinit'):\n\nadd-auto-load-safe-path /path/to/cpython\n\nYou can also add multiple paths, separated by ':'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Setup for Python from a Linux distro,  Prev: Setup with Python built from source,  Up: Prerequisites": {
            "content": "9.4.1.2 Setup for Python from a Linux distro\n............................................\n",
            "subsections": []
        },
        "Most Linux systems provide debug information for the system Python in a": {
            "content": "package called 'python-debuginfo', 'python-dbg' or similar.  For\nexample:\n\n- Fedora:\n\nsudo dnf install gdb\nsudo dnf debuginfo-install python3\n\n- Ubuntu:\n\nsudo apt install gdb python3-dbg\n",
            "subsections": []
        },
        "On several recent Linux systems, GDB can download debugging symbols": {
            "content": "automatically using 'debuginfod'.  However, this will not install the\n'python-gdb.py' extension; you generally do need to install the debug\ninfo package separately.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "For easier debugging, you might want to:\n\n- Use a *note debug build: 67f. of Python.  (When building from\nsource, use 'configure --with-pydebug'.  On Linux distros, install\nand run a package like 'python-debug' or 'python-dbg', if\navailable.)\n\n- Use the runtime *note development mode: 6e3. ('-X dev').\n",
            "subsections": []
        },
        "Both enable extra assertions and disable some optimizations.  Sometimes": {
            "content": "this hides the bug you are trying to find, but in most cases they make\nthe process easier.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "When the extension is loaded, it provides two main features: pretty": {
            "content": "printers for Python values, and additional commands.\n\n* Menu:\n\n* Pretty-printers::\n* py-list::\n* py-up and py-down::\n* py-bt::\n* py-print::\n* py-locals::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Pretty-printers,  Next: py-list,  Up: Using the python-gdb extension": {
            "content": "9.4.3.1 Pretty-printers\n.......................\n",
            "subsections": []
        },
        "This is what a GDB backtrace looks like (truncated) when this extension": {
            "content": "is enabled:\n\n#0  0x000000000041a6b1 in PyObjectMalloc (nbytes=Cannot access memory at address 0x7fffff7fefe8\n) at Objects/obmalloc.c:748\n#1  0x000000000041b7c0 in PyObjectDebugMallocApi (id=111 'o', nbytes=24) at Objects/obmalloc.c:1445\n#2  0x000000000041b717 in PyObjectDebugMalloc (nbytes=24) at Objects/obmalloc.c:1412\n#3  0x000000000044060a in PyUnicodeNew (length=11) at Objects/unicodeobject.c:346\n#4  0x00000000004466aa in PyUnicodeUCS2DecodeUTF8Stateful (s=0x5c2b8d \"lltrace\", size=11, errors=0x0, consumed=\n0x0) at Objects/unicodeobject.c:2531\n#5  0x0000000000446647 in PyUnicodeUCS2DecodeUTF8 (s=0x5c2b8d \"lltrace\", size=11, errors=0x0)\nat Objects/unicodeobject.c:2495\n#6  0x0000000000440d1b in PyUnicodeUCS2FromStringAndSize (u=0x5c2b8d \"lltrace\", size=11)\nat Objects/unicodeobject.c:551\n#7  0x0000000000440d94 in PyUnicodeUCS2FromString (u=0x5c2b8d \"lltrace\") at Objects/unicodeobject.c:569\n#8  0x0000000000584abd in PyDictGetItemString (v=\n{'Yuck': <type at remote 0xad4730>, 'builtins': <module at remote 0x7ffff7fd5ee8>, 'file': 'Lib/test/crashers/nastyeqvsdict.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=\n0x5c2b8d \"lltrace\") at Objects/dictobject.c:2171\n",
            "subsections": []
        },
        "Notice how the dictionary argument to 'PyDictGetItemString' is": {
            "content": "displayed as its 'repr()', rather than an opaque 'PyObject *' pointer.\n",
            "subsections": []
        },
        "The extension works by supplying a custom printing routine for values of": {
            "content": "type 'PyObject *'.  If you need to access lower-level details of an\nobject, then cast the value to a pointer of the appropriate type.  For\nexample:\n\n(gdb) p globals\n$1 = {'builtins': <module at remote 0x7ffff7fb1868>, 'name':\n'main', 'ctypes': <module at remote 0x7ffff7f14360>, 'doc': None,\n'package': None}\n\n(gdb) p *(PyDictObject*)globals\n$2 = {obrefcnt = 3, obtype = 0x3dbdf85820, mafill = 5, maused = 5,\nmamask = 7, matable = 0x63d0f8, malookup = 0x3dbdc7ea70\n<lookdictstring>, masmalltable = {{mehash = 7065186196740147912,\nmekey = 'builtins', mevalue = <module at remote 0x7ffff7fb1868>},\n{mehash = -368181376027291943, mekey = 'name',\nmevalue ='main'}, {mehash = 0, mekey = 0x0, mevalue = 0x0},\n{mehash = 0, mekey = 0x0, mevalue = 0x0},\n{mehash = -9177857982131165996, mekey = 'ctypes',\nmevalue = <module at remote 0x7ffff7f14360>},\n{mehash = -8518757509529533123, mekey = 'doc', mevalue = None},\n{mehash = 0, mekey = 0x0, mevalue = 0x0}, {\nmehash = 6614918939584953775, mekey = 'package', mevalue = None}}}\n",
            "subsections": []
        },
        "Note that the pretty-printers do not actually call 'repr()'.  For basic": {
            "content": "types, they try to match its result closely.\n",
            "subsections": []
        },
        "An area that can be confusing is that the custom printer for some types": {
            "content": "look a lot like GDB's built-in printer for standard types.  For example,\nthe pretty-printer for a Python 'int' (*note PyLongObject: 2ea.*) gives\na representation that is not distinguishable from one of a regular\nmachine-level integer:\n\n(gdb) p somemachineinteger\n$3 = 42\n\n(gdb) p somepythoninteger\n$4 = 42\n\nThe internal structure can be revealed with a cast to *note\nPyLongObject: 2ea.*:\n\n(gdb) p '(PyLongObject')somepythoninteger $5 = {obbase =\n{obbase = {obrefcnt = 8, obtype = 0x3dad39f5e0}, obsize = 1},\nobdigit = {42}}\n\nA similar confusion can arise with the 'str' type, where the output\nlooks a lot like gdb's built-in printer for 'char *':\n\n(gdb) p ptrtopythonstr\n$6 = 'builtins'\n",
            "subsections": []
        },
        "The pretty-printer for 'str' instances defaults to using single-quotes": {
            "content": "(as does Python's 'repr' for strings) whereas the standard printer for\n'char *' values uses double-quotes and contains a hexadecimal address:\n\n(gdb) p ptrtocharstar\n$7 = 0x6d72c0 \"hello world\"\n\nAgain, the implementation details can be revealed with a cast to *note\nPyUnicodeObject: 584.*:\n\n(gdb) p *(PyUnicodeObject*)$6\n$8 = {obbase = {obrefcnt = 33, obtype = 0x3dad3a95a0}, length = 12,\nstr = 0x7ffff2128500, hash = 7065186196740147912, state = 1, defenc = 0x0}\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: py-list,  Next: py-up and py-down,  Prev: Pretty-printers,  Up: Using the python-gdb extension": {
            "content": "9.4.3.2 'py-list'\n.................\n\nThe extension adds a 'py-list' command, which lists the Python\nsource code (if any) for the current frame in the selected thread.\nThe current line is marked with a \">\":\n\n(gdb) py-list\n901        if options.profile:\n902            options.profile = False\n903            profileme()\n904            return\n905\n>906        u = UI()\n907        if not u.quit:\n908            try:\n909                gtk.main()\n910            except KeyboardInterrupt:\n911                # properly quit on a keyboard interrupt...\n\nUse 'py-list START' to list at a different line number within the\nPython source, and 'py-list START,END' to list a specific range of\nlines within the Python source.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: py-up and py-down,  Next: py-bt,  Prev: py-list,  Up: Using the python-gdb extension": {
            "content": "9.4.3.3 'py-up' and 'py-down'\n.............................\n\nThe 'py-up' and 'py-down' commands are analogous to GDB's regular\n'up' and 'down' commands, but try to move at the level of CPython\nframes, rather than C frames.\n\nGDB is not always able to read the relevant frame information,\ndepending on the optimization level with which CPython was\ncompiled.  Internally, the commands look for C frames that are\nexecuting the default frame evaluation function (that is, the core\nbytecode interpreter loop within CPython) and look up the value of\nthe related 'PyFrameObject *'.\n\nThey emit the frame number (at the C level) within the thread.\n\nFor example:\n\n(gdb) py-up\n#37 Frame 0x9420b04, for file /usr/lib/python2.6/site-packages/\ngnomesudoku/main.py, line 906, in startgame ()\nu = UI()\n(gdb) py-up\n#40 Frame 0x948e82c, for file /usr/lib/python2.6/site-packages/\ngnomesudoku/gnomesudoku.py, line 22, in startgame(main=<module at remote 0xb771b7f4>)\nmain.startgame()\n(gdb) py-up\nUnable to find an older python frame\n\nso we're at the top of the Python stack.\n\nThe frame numbers correspond to those displayed by GDB's standard\n'backtrace' command.  The command skips C frames which are not\nexecuting Python code.\n\nGoing back down:\n\n(gdb) py-down\n#37 Frame 0x9420b04, for file /usr/lib/python2.6/site-packages/gnomesudoku/main.py, line 906, in startgame ()\nu = UI()\n(gdb) py-down\n#34 (unable to read python frame information)\n(gdb) py-down\n#23 (unable to read python frame information)\n(gdb) py-down\n#19 (unable to read python frame information)\n(gdb) py-down\n#14 Frame 0x99262ac, for file /usr/lib/python2.6/site-packages/gnomesudoku/gameselector.py, line 201, in runswalloweddialog (self=<NewOrSavedGameSelector(newgamemodel=<gtk.ListStore at remote 0x98fab44>, puzzle=None, savedgames=[{'gsd.autofills': 0, 'tracking': {}, 'trackers': {}, 'notes': [], 'savedat': 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.impossiblehints': 0, 'timer.absolutestarttime': <float at remote 0x984b474>, 'gsd.hints': 0, 'timer.activetime': <float at remote 0x984b494>, 'timer.totaltime': <float at remote 0x984b464>}], dialog=<gtk.Dialog at remote 0x98faaa4>, savedgamemodel=<gtk.ListStore at remote 0x98fad24>, sudokumaker=<SudokuMaker(terminated=False, played=[], batchsiz...(truncated)\nswallower.rundialog(self.dialog)\n(gdb) py-down\n#11 Frame 0x9aead74, for file /usr/lib/python2.6/site-packages/gnomesudoku/dialogswallower.py, line 48, in rundialog (self=<SwappableArea(running=<gtk.Dialog at remote 0x98faaa4>, mainpage=0) at remote 0x98fa6e4>, d=<gtk.Dialog at remote 0x98faaa4>)\ngtk.main()\n(gdb) py-down\n#8 (unable to read python frame information)\n(gdb) py-down\nUnable to find a newer python frame\n\nand we're at the bottom of the Python stack.\n\nNote that in Python 3.12 and newer, the same C stack frame can be\nused for multiple Python stack frames.  This means that 'py-up' and\n'py-down' may move multiple Python frames at once.  For example:\n\n(gdb) py-up\n#6 Frame 0x7ffff7fb62b0, for file /tmp/rec.py, line 5, in recursivefunction (n=0)\ntime.sleep(5)\n#6 Frame 0x7ffff7fb6240, for file /tmp/rec.py, line 7, in recursivefunction (n=1)\nrecursivefunction(n-1)\n#6 Frame 0x7ffff7fb61d0, for file /tmp/rec.py, line 7, in recursivefunction (n=2)\nrecursivefunction(n-1)\n#6 Frame 0x7ffff7fb6160, for file /tmp/rec.py, line 7, in recursivefunction (n=3)\nrecursivefunction(n-1)\n#6 Frame 0x7ffff7fb60f0, for file /tmp/rec.py, line 7, in recursivefunction (n=4)\nrecursivefunction(n-1)\n#6 Frame 0x7ffff7fb6080, for file /tmp/rec.py, line 7, in recursivefunction (n=5)\nrecursivefunction(n-1)\n#6 Frame 0x7ffff7fb6020, for file /tmp/rec.py, line 9, in <module> ()\nrecursivefunction(5)\n(gdb) py-up\nUnable to find an older python frame\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: py-bt,  Next: py-print,  Prev: py-up and py-down,  Up: Using the python-gdb extension": {
            "content": "9.4.3.4 'py-bt'\n...............\n\nThe 'py-bt' command attempts to display a Python-level backtrace of\nthe current thread.\n\nFor example:\n\n(gdb) py-bt\n#8 (unable to read python frame information)\n#11 Frame 0x9aead74, for file /usr/lib/python2.6/site-packages/gnomesudoku/dialogswallower.py, line 48, in rundialog (self=<SwappableArea(running=<gtk.Dialog at remote 0x98faaa4>, mainpage=0) at remote 0x98fa6e4>, d=<gtk.Dialog at remote 0x98faaa4>)\ngtk.main()\n#14 Frame 0x99262ac, for file /usr/lib/python2.6/site-packages/gnomesudoku/gameselector.py, line 201, in runswalloweddialog (self=<NewOrSavedGameSelector(newgamemodel=<gtk.ListStore at remote 0x98fab44>, puzzle=None, savedgames=[{'gsd.autofills': 0, 'tracking': {}, 'trackers': {}, 'notes': [], 'savedat': 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.impossiblehints': 0, 'timer.absolutestarttime': <float at remote 0x984b474>, 'gsd.hints': 0, 'timer.activetime': <float at remote 0x984b494>, 'timer.totaltime': <float at remote 0x984b464>}], dialog=<gtk.Dialog at remote 0x98faaa4>, savedgamemodel=<gtk.ListStore at remote 0x98fad24>, sudokumaker=<SudokuMaker(terminated=False, played=[], batchsiz...(truncated)\nswallower.rundialog(self.dialog)\n#19 (unable to read python frame information)\n#23 (unable to read python frame information)\n#34 (unable to read python frame information)\n#37 Frame 0x9420b04, for file /usr/lib/python2.6/site-packages/gnomesudoku/main.py, line 906, in startgame ()\nu = UI()\n#40 Frame 0x948e82c, for file /usr/lib/python2.6/site-packages/gnomesudoku/gnomesudoku.py, line 22, in startgame (main=<module at remote 0xb771b7f4>)\nmain.startgame()\n\nThe frame numbers correspond to those displayed by GDB's standard\n'backtrace' command.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: py-print,  Next: py-locals,  Prev: py-bt,  Up: Using the python-gdb extension": {
            "content": "9.4.3.5 'py-print'\n..................\n\nThe 'py-print' command looks up a Python name and tries to print\nit.  It looks in locals within the current thread, then globals,\nthen finally builtins:\n\n(gdb) py-print self\nlocal 'self' = <SwappableArea(running=<gtk.Dialog at remote 0x98faaa4>,\nmainpage=0) at remote 0x98fa6e4>\n(gdb) py-print name\nglobal 'name' = 'gnomesudoku.dialogswallower'\n(gdb) py-print len\nbuiltin 'len' = <built-in function len>\n(gdb) py-print scarletpimpernel\n'scarletpimpernel' not found\n\nIf the current C frame corresponds to multiple Python frames,\n'py-print' only considers the first one.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: py-locals,  Prev: py-print,  Up: Using the python-gdb extension": {
            "content": "9.4.3.6 'py-locals'\n...................\n\nThe 'py-locals' command looks up all Python locals within the\ncurrent Python frame in the selected thread, and prints their\nrepresentations:\n\n(gdb) py-locals\nself = <SwappableArea(running=<gtk.Dialog at remote 0x98faaa4>,\nmainpage=0) at remote 0x98fa6e4>\nd = <gtk.Dialog at remote 0x98faaa4>\n\nIf the current C frame corresponds to multiple Python frames,\nlocals from all of them will be shown:\n\n(gdb) py-locals\nLocals for recursivefunction\nn = 0\nLocals for recursivefunction\nn = 1\nLocals for recursivefunction\nn = 2\nLocals for recursivefunction\nn = 3\nLocals for recursivefunction\nn = 4\nLocals for recursivefunction\nn = 5\nLocals for <module>\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Use with GDB commands,  Prev: Using the python-gdb extension,  Up: Debugging C API extensions and CPython Internals with GDB": {
            "content": "",
            "subsections": []
        },
        "The extension commands complement GDB's built-in commands.  For example,": {
            "content": "you can use a frame numbers shown by 'py-bt' with the 'frame' command to\ngo a specific frame within the selected thread, like this:\n\n(gdb) py-bt\n(output snipped)\n#68 Frame 0xaa4560, for file Lib/test/regrtest.py, line 1548, in <module> ()\nmain()\n(gdb) frame 68\n#68 0x00000000004cd1e6 in PyEvalEvalFrameEx (f=Frame 0xaa4560, for file Lib/test/regrtest.py, line 1548, in <module> (), throwflag=0) at Python/ceval.c:2665\n2665                            x = callfunction(&sp, oparg);\n(gdb) py-list\n1543        # Run the tests in a context manager that temporary changes the CWD to a\n1544        # temporary and writable directory. If it's not possible to create or\n1545        # change the CWD, the original CWD will be used. The original CWD is\n1546        # available from testsupport.SAVEDCWD.\n1547        with testsupport.tempcwd(TESTCWD, quiet=True):\n>1548            main()\n",
            "subsections": []
        },
        "The 'info threads' command will give you a list of the threads within": {
            "content": "the process, and you can use the 'thread' command to select a different\none:\n\n(gdb) info threads\n105 Thread 0x7fffefa18710 (LWP 10260)  semwait () at ../nptl/sysdeps/unix/sysv/linux/x8664/semwait.S:86\n104 Thread 0x7fffdf5fe710 (LWP 10259)  semwait () at ../nptl/sysdeps/unix/sysv/linux/x8664/semwait.S:86\n* 1 Thread 0x7ffff7fe2700 (LWP 10145)  0x00000038e46d73e3 in select () at ../sysdeps/unix/syscall-template.S:82\n",
            "subsections": []
        },
        "You can use 'thread apply all COMMAND' or ('t a a COMMAND' for short) to": {
            "content": "run a command on all threads.  With 'py-bt', this lets you see what\nevery thread is doing at the Python level:\n\n(gdb) t a a py-bt\n\nThread 105 (Thread 0x7fffefa18710 (LWP 10260)):\n#5 Frame 0x7fffd00019d0, for file /home/david/coding/python-svn/Lib/threading.py, line 155, in acquirerestore (self=<RLock(Verboseverbose=False, RLockowner=140737354016512, RLockblock=<thread.lock at remote 0x858770>, RLockcount=1) at remote 0xd7ff40>, countowner=(1, 140737213728528), count=1, owner=140737213728528)\nself.block.acquire()\n#8 Frame 0x7fffac001640, for file /home/david/coding/python-svn/Lib/threading.py, line 269, in wait (self=<Condition(Conditionlock=<RLock(Verboseverbose=False, RLockowner=140737354016512, RLockblock=<thread.lock at remote 0x858770>, RLockcount=1) at remote 0xd7ff40>, acquire=<instancemethod at remote 0xd80260>, isowned=<instancemethod at remote 0xd80160>, releasesave=<instancemethod at remote 0xd803e0>, release=<instancemethod at remote 0xd802e0>, acquirerestore=<instancemethod at remote 0xd7ee60>, Verboseverbose=False, Conditionwaiters=[]) at remote 0xd7fd10>, timeout=None, waiter=<thread.lock at remote 0x858a90>, savedstate=(1, 140737213728528))\nself.acquirerestore(savedstate)\n#12 Frame 0x7fffb8001a10, for file /home/david/coding/python-svn/Lib/test/locktests.py, line 348, in f ()\ncond.wait()\n#16 Frame 0x7fffb8001c40, for file /home/david/coding/python-svn/Lib/test/locktests.py, line 37, in task (tid=140737213728528)\nf()\n\nThread 104 (Thread 0x7fffdf5fe710 (LWP 10259)):\n#5 Frame 0x7fffe4001580, for file /home/david/coding/python-svn/Lib/threading.py, line 155, in acquirerestore (self=<RLock(Verboseverbose=False, RLockowner=140737354016512, RLockblock=<thread.lock at remote 0x858770>, RLockcount=1) at remote 0xd7ff40>, countowner=(1, 140736940992272), count=1, owner=140736940992272)\nself.block.acquire()\n#8 Frame 0x7fffc8002090, for file /home/david/coding/python-svn/Lib/threading.py, line 269, in wait (self=<Condition(Conditionlock=<RLock(Verboseverbose=False, RLockowner=140737354016512, RLockblock=<thread.lock at remote 0x858770>, RLockcount=1) at remote 0xd7ff40>, acquire=<instancemethod at remote 0xd80260>, isowned=<instancemethod at remote 0xd80160>, releasesave=<instancemethod at remote 0xd803e0>, release=<instancemethod at remote 0xd802e0>, acquirerestore=<instancemethod at remote 0xd7ee60>, Verboseverbose=False, Conditionwaiters=[]) at remote 0xd7fd10>, timeout=None, waiter=<thread.lock at remote 0x858860>, savedstate=(1, 140736940992272))\nself.acquirerestore(savedstate)\n#12 Frame 0x7fffac001c90, for file /home/david/coding/python-svn/Lib/test/locktests.py, line 348, in f ()\ncond.wait()\n#16 Frame 0x7fffac0011c0, for file /home/david/coding/python-svn/Lib/test/locktests.py, line 37, in task (tid=140736940992272)\nf()\n\nThread 1 (Thread 0x7ffff7fe2700 (LWP 10145)):\n#5 Frame 0xcb5380, for file /home/david/coding/python-svn/Lib/test/locktests.py, line 16, in wait ()\ntime.sleep(0.01)\n#8 Frame 0x7fffd00024a0, for file /home/david/coding/python-svn/Lib/test/locktests.py, line 378, in checknotify (self=<ConditionTests(testMethodName='testnotify', resultForDoCleanups=<TestResult(originalstdout=<cStringIO.StringO at remote 0xc191e0>, skipped=[], mirrorOutput=False, testsRun=39, buffer=False, originalstderr=<file at remote 0x7ffff7fc6340>, stdoutbuffer=<cStringIO.StringO at remote 0xc9c7f8>, stderrbuffer=<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=[], typeequalityfuncs={<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)\nwait()\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Enum HOWTO,  Next: Functional Programming HOWTO,  Prev: Debugging C API extensions and CPython Internals with GDB,  Up: Python HOWTOs": {
            "content": "",
            "subsections": [
                {
                    "name": "9.5 Enum HOWTO",
                    "content": "An *note Enum: 3fd. is a set of symbolic names bound to unique values.\nThey are similar to global variables, but they offer a more useful *note\nrepr(): 5f0, grouping, type-safety, and a few other features.\n"
                }
            ]
        },
        "They are most useful when you have a variable that can take one of a": {
            "content": "limited selection of values.  For example, the days of the week:\n\n>>> from enum import Enum\n>>> class Weekday(Enum):\n...     MONDAY = 1\n...     TUESDAY = 2\n...     WEDNESDAY = 3\n...     THURSDAY = 4\n...     FRIDAY = 5\n...     SATURDAY = 6\n...     SUNDAY = 7\n\nOr perhaps the RGB primary colors:\n\n>>> from enum import Enum\n>>> class Color(Enum):\n...     RED = 1\n...     GREEN = 2\n...     BLUE = 3\n\nAs you can see, creating an *note Enum: 3fd. is as simple as writing a\nclass that inherits from *note Enum: 3fd. itself.\n\nNote: Case of Enum Members\n\nBecause Enums are used to represent constants, and to help avoid\nissues with name clashes between mixin-class methods/attributes and\nenum names, we strongly recommend using UPPERCASE names for\nmembers, and will be using that style in our examples.\n",
            "subsections": []
        },
        "Depending on the nature of the enum a member's value may or may not be": {
            "content": "important, but either way that value can be used to get the\ncorresponding member:\n\n>>> Weekday(3)\n<Weekday.WEDNESDAY: 3>\n",
            "subsections": []
        },
        "As you can see, the 'repr()' of a member shows the enum name, the member": {
            "content": "name, and the value.  The 'str()' of a member shows only the enum name\nand member name:\n\n>>> print(Weekday.THURSDAY)\nWeekday.THURSDAY\n\nThe 'type' of an enumeration member is the enum it belongs to:\n\n>>> type(Weekday.MONDAY)\n<enum 'Weekday'>\n>>> isinstance(Weekday.FRIDAY, Weekday)\nTrue\n\nEnum members have an attribute that contains just their 'name':\n\n>>> print(Weekday.TUESDAY.name)\nTUESDAY\n\nLikewise, they have an attribute for their 'value':\n\n>>> Weekday.WEDNESDAY.value\n3\n",
            "subsections": []
        },
        "Unlike many languages that treat enumerations solely as name/value": {
            "content": "pairs, Python Enums can have behavior added.  For example, *note\ndatetime.date: 70f. has two methods for returning the weekday:\n'weekday()' and 'isoweekday()'.  The difference is that one of them\ncounts from 0-6 and the other from 1-7.  Rather than keep track of that\nourselves we can add a method to the 'Weekday' enum to extract the day\nfrom the 'date' instance and return the matching enum member:\n\n@classmethod\ndef fromdate(cls, date):\nreturn cls(date.isoweekday())\n\nThe complete 'Weekday' enum now looks like this:\n\n>>> class Weekday(Enum):\n...     MONDAY = 1\n...     TUESDAY = 2\n...     WEDNESDAY = 3\n...     THURSDAY = 4\n...     FRIDAY = 5\n...     SATURDAY = 6\n...     SUNDAY = 7\n...     #\n...     @classmethod\n...     def fromdate(cls, date):\n...         return cls(date.isoweekday())\n\nNow we can find out what today is!  Observe:\n\n>>> from datetime import date\n>>> Weekday.fromdate(date.today())\n<Weekday.TUESDAY: 2>\n",
            "subsections": []
        },
        "Of course, if you're reading this on some other day, you'll see that day": {
            "content": "instead.\n",
            "subsections": []
        },
        "This 'Weekday' enum is great if our variable only needs one day, but": {
            "content": "what if we need several?  Maybe we're writing a function to plot chores\nduring a week, and don't want to use a *note list: 3dc. - we could use a\ndifferent type of *note Enum: 3fd.:\n\n>>> from enum import Flag\n>>> class Weekday(Flag):\n...     MONDAY = 1\n...     TUESDAY = 2\n...     WEDNESDAY = 4\n...     THURSDAY = 8\n...     FRIDAY = 16\n...     SATURDAY = 32\n...     SUNDAY = 64\n\nWe've changed two things: we're inherited from *note Flag: 3ef, and the\nvalues are all powers of 2.\n",
            "subsections": []
        },
        "Just like the original 'Weekday' enum above, we can have a single": {
            "content": "selection:\n\n>>> firstweekday = Weekday.MONDAY\n>>> firstweekday\n<Weekday.MONDAY: 1>\n\nBut *note Flag: 3ef. also allows us to combine several members into a\nsingle variable:\n\n>>> weekend = Weekday.SATURDAY | Weekday.SUNDAY\n>>> weekend\n<Weekday.SATURDAY|SUNDAY: 96>\n\nYou can even iterate over a *note Flag: 3ef. variable:\n\n>>> for day in weekend:\n...     print(day)\nWeekday.SATURDAY\nWeekday.SUNDAY\n\nOkay, let's get some chores set up:\n\n>>> choresforethan = {\n...     'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | Weekday.FRIDAY,\n...     'do the dishes': Weekday.TUESDAY | Weekday.THURSDAY,\n...     'answer SO questions': Weekday.SATURDAY,\n...     }\n\nAnd a function to display the chores for a given day:\n\n>>> def showchores(chores, day):\n...     for chore, days in chores.items():\n...         if day in days:\n...             print(chore)\n...\n>>> showchores(choresforethan, Weekday.SATURDAY)\nanswer SO questions\n",
            "subsections": []
        },
        "In cases where the actual values of the members do not matter, you can": {
            "content": "save yourself some work and use *note auto(): aeb. for the values:\n\n>>> from enum import auto\n>>> class Weekday(Flag):\n...     MONDAY = auto()\n...     TUESDAY = auto()\n...     WEDNESDAY = auto()\n...     THURSDAY = auto()\n...     FRIDAY = auto()\n...     SATURDAY = auto()\n...     SUNDAY = auto()\n...     WEEKEND = SATURDAY | SUNDAY\n\n* Menu:\n\n* Programmatic access to enumeration members and their attributes::\n* Duplicating enum members and values::\n* Ensuring unique enumeration values::\n* Using automatic values::\n* Iteration: Iteration<2>.\n* Comparisons: Comparisons<3>.\n* Allowed members and attributes of enumerations::\n* Restricted Enum subclassing::\n* Dataclass support::\n* Pickling::\n* Functional API: Functional API<2>.\n* Derived Enumerations::\n* When to use new() vs. init(): When to use new vs init.\n* How are Enums and Flags different?::\n* Enum Cookbook::\n* Subclassing EnumType::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Programmatic access to enumeration members and their attributes,  Next: Duplicating enum members and values,  Up: Enum HOWTO": {
            "content": "",
            "subsections": []
        },
        "Sometimes it's useful to access members in enumerations programmatically": {
            "content": "(i.e.  situations where 'Color.RED' won't do because the exact color is\nnot known at program-writing time).  'Enum' allows such access:\n\n>>> Color(1)\n<Color.RED: 1>\n>>> Color(3)\n<Color.BLUE: 3>\n\nIf you want to access enum members by 'name', use item access:\n\n>>> Color['RED']\n<Color.RED: 1>\n>>> Color['GREEN']\n<Color.GREEN: 2>\n\nIf you have an enum member and need its 'name' or 'value':\n\n>>> member = Color.RED\n>>> member.name\n'RED'\n>>> member.value\n1\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Duplicating enum members and values,  Next: Ensuring unique enumeration values,  Prev: Programmatic access to enumeration members and their attributes,  Up: Enum HOWTO": {
            "content": "Having two enum members with the same name is invalid:\n\n>>> class Shape(Enum):\n...     SQUARE = 2\n...     SQUARE = 3\n...\nTraceback (most recent call last):\n...\nTypeError: 'SQUARE' already defined as 2\n",
            "subsections": []
        },
        "However, an enum member can have other names associated with it.  Given": {
            "content": "two entries 'A' and 'B' with the same value (and 'A' defined first), 'B'\nis an alias for the member 'A'.  By-value lookup of the value of 'A'\nwill return the member 'A'.  By-name lookup of 'A' will return the\nmember 'A'.  By-name lookup of 'B' will also return the member 'A':\n\n>>> class Shape(Enum):\n...     SQUARE = 2\n...     DIAMOND = 1\n...     CIRCLE = 3\n...     ALIASFORSQUARE = 2\n...\n>>> Shape.SQUARE\n<Shape.SQUARE: 2>\n>>> Shape.ALIASFORSQUARE\n<Shape.SQUARE: 2>\n>>> Shape(2)\n<Shape.SQUARE: 2>\n\nNote: Attempting to create a member with the same name as an\nalready defined attribute (another member, a method, etc.)  or\nattempting to create an attribute with the same name as a member is\nnot allowed.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Ensuring unique enumeration values,  Next: Using automatic values,  Prev: Duplicating enum members and values,  Up: Enum HOWTO": {
            "content": "",
            "subsections": []
        },
        "By default, enumerations allow multiple names as aliases for the same": {
            "content": "value.  When this behavior isn't desired, you can use the *note\nunique(): 22c1. decorator:\n\n>>> from enum import Enum, unique\n>>> @unique\n... class Mistake(Enum):\n...     ONE = 1\n...     TWO = 2\n...     THREE = 3\n...     FOUR = 3\n...\nTraceback (most recent call last):\n...\nValueError: duplicate values found in <enum 'Mistake'>: FOUR -> THREE\n\nFile: python3.12.info,  Node: Using automatic values,  Next: Iteration<2>,  Prev: Ensuring unique enumeration values,  Up: Enum HOWTO\n\n\nIf the exact value is unimportant you can use *note auto: aeb.:\n\n>>> from enum import Enum, auto\n>>> class Color(Enum):\n...     RED = auto()\n...     BLUE = auto()\n...     GREEN = auto()\n...\n>>> [member.value for member in Color]\n[1, 2, 3]\n",
            "subsections": []
        },
        "The values are chosen by 'generatenextvalue()', which can be": {
            "content": "overridden:\n\n>>> class AutoName(Enum):\n...     @staticmethod\n...     def generatenextvalue(name, start, count, lastvalues):\n...         return name\n...\n>>> class Ordinal(AutoName):\n...     NORTH = auto()\n...     SOUTH = auto()\n...     EAST = auto()\n...     WEST = auto()\n...\n>>> [member.value for member in Ordinal]\n['NORTH', 'SOUTH', 'EAST', 'WEST']\n\nNote: The 'generatenextvalue()' method must be defined before\nany members.\n\nFile: python3.12.info,  Node: Iteration<2>,  Next: Comparisons<3>,  Prev: Using automatic values,  Up: Enum HOWTO\n\n\nIterating over the members of an enum does not provide the aliases:\n\n>>> list(Shape)\n[<Shape.SQUARE: 2>, <Shape.DIAMOND: 1>, <Shape.CIRCLE: 3>]\n>>> list(Weekday)\n[<Weekday.MONDAY: 1>, <Weekday.TUESDAY: 2>, <Weekday.WEDNESDAY: 4>, <Weekday.THURSDAY: 8>, <Weekday.FRIDAY: 16>, <Weekday.SATURDAY: 32>, <Weekday.SUNDAY: 64>]\n",
            "subsections": []
        },
        "Note that the aliases 'Shape.ALIASFORSQUARE' and 'Weekday.WEEKEND'": {
            "content": "aren't shown.\n",
            "subsections": []
        },
        "The special attribute 'members' is a read-only ordered mapping of": {
            "content": "names to members.  It includes all names defined in the enumeration,\nincluding the aliases:\n\n>>> for name, member in Shape.members.items():\n...     name, member\n...\n('SQUARE', <Shape.SQUARE: 2>)\n('DIAMOND', <Shape.DIAMOND: 1>)\n('CIRCLE', <Shape.CIRCLE: 3>)\n('ALIASFORSQUARE', <Shape.SQUARE: 2>)\n",
            "subsections": []
        },
        "The 'members' attribute can be used for detailed programmatic access": {
            "content": "to the enumeration members.  For example, finding all the aliases:\n\n>>> [name for name, member in Shape.members.items() if member.name != name]\n['ALIASFORSQUARE']\n\nNote: Aliases for flags include values with multiple flags set,\nsuch as '3', and no flags set, i.e.  '0'.\n\nFile: python3.12.info,  Node: Comparisons<3>,  Next: Allowed members and attributes of enumerations,  Prev: Iteration<2>,  Up: Enum HOWTO\n\n\nEnumeration members are compared by identity:\n\n>>> Color.RED is Color.RED\nTrue\n>>> Color.RED is Color.BLUE\nFalse\n>>> Color.RED is not Color.BLUE\nTrue\n\nOrdered comparisons between enumeration values are 'not' supported.\nEnum members are not integers (but see *note IntEnum: 4ca1. below):\n\n>>> Color.RED < Color.BLUE\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nTypeError: '<' not supported between instances of 'Color' and 'Color'\n\nEquality comparisons are defined though:\n\n>>> Color.BLUE == Color.RED\nFalse\n>>> Color.BLUE != Color.RED\nTrue\n>>> Color.BLUE == Color.BLUE\nTrue\n",
            "subsections": []
        },
        "Comparisons against non-enumeration values will always compare not equal": {
            "content": "(again, *note IntEnum: b2e. was explicitly designed to behave\ndifferently, see below):\n\n>>> Color.BLUE == 2\nFalse\n\nWarning: It is possible to reload modules - if a reloaded module\ncontains enums, they will be recreated, and the new members may not\ncompare identical/equal to the original members.\n\nFile: python3.12.info,  Node: Allowed members and attributes of enumerations,  Next: Restricted Enum subclassing,  Prev: Comparisons<3>,  Up: Enum HOWTO\n\n",
            "subsections": []
        },
        "Most of the examples above use integers for enumeration values.  Using": {
            "content": "integers is short and handy (and provided by default by the *note",
            "subsections": []
        },
        "Functional API: 4ca3.), but not strictly enforced.  In the vast majority": {
            "content": "of use-cases, one doesn't care what the actual value of an enumeration\nis.  But if the value 'is' important, enumerations can have arbitrary\nvalues.\n",
            "subsections": []
        },
        "Enumerations are Python classes, and can have methods and special": {
            "content": "methods as usual.  If we have this enumeration:\n\n>>> class Mood(Enum):\n...     FUNKY = 1\n...     HAPPY = 3\n...\n...     def describe(self):\n...         # self is the member here\n...         return self.name, self.value\n...\n...     def str(self):\n...         return 'my custom str! {0}'.format(self.value)\n...\n...     @classmethod\n...     def favoritemood(cls):\n...         # cls here is the enumeration\n...         return cls.HAPPY\n...\n\nThen:\n\n>>> Mood.favoritemood()\n<Mood.HAPPY: 3>\n>>> Mood.HAPPY.describe()\n('HAPPY', 3)\n>>> str(Mood.FUNKY)\n'my custom str! 1'\n",
            "subsections": []
        },
        "The rules for what is allowed are as follows: names that start and end": {
            "content": "with a single underscore are reserved by enum and cannot be used; all\nother attributes defined within an enumeration will become members of\nthis enumeration, with the exception of special methods ('str()',\n'add()', etc.), descriptors (methods are also descriptors), and\nvariable names listed in 'ignore'.\n",
            "subsections": []
        },
        "Note: if your enumeration defines 'new()' and/or 'init()', any": {
            "content": "value(s) given to the enum member will be passed into those methods.\nSee *note Planet: 4ca4. for an example.\n\nNote: The 'new()' method, if defined, is used during creation\nof the Enum members; it is then replaced by Enum's 'new()'\nwhich is used after class creation for lookup of existing members.\nSee *note When to use new() vs.  init(): 4ca5. for more\ndetails.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Restricted Enum subclassing,  Next: Dataclass support,  Prev: Allowed members and attributes of enumerations,  Up: Enum HOWTO": {
            "content": "A new *note Enum: 3fd. class must have one base enum class, up to one\nconcrete data type, and as many *note object: 8bb.-based mixin classes\nas needed.  The order of these base classes is:\n\nclass EnumName([mix-in, ...,] [data-type,] base-enum):\npass\n",
            "subsections": []
        },
        "Also, subclassing an enumeration is allowed only if the enumeration does": {
            "content": "not define any members.  So this is forbidden:\n\n>>> class MoreColor(Color):\n...     PINK = 17\n...\nTraceback (most recent call last):\n...\nTypeError: <enum 'MoreColor'> cannot extend <enum 'Color'>\n\nBut this is allowed:\n\n>>> class Foo(Enum):\n...     def somebehavior(self):\n...         pass\n...\n>>> class Bar(Foo):\n...     HAPPY = 1\n...     SAD = 2\n...\n",
            "subsections": []
        },
        "Allowing subclassing of enums that define members would lead to a": {
            "content": "violation of some important invariants of types and instances.  On the\nother hand, it makes sense to allow sharing some common behavior between\na group of enumerations.  (See *note OrderedEnum: 4ca7. for an example.)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Dataclass support,  Next: Pickling,  Prev: Restricted Enum subclassing,  Up: Enum HOWTO": {
            "content": "When inheriting from a *note dataclass: 38d, the *note repr(): 14d7.\nomits the inherited class' name.  For example:\n\n>>> from dataclasses import dataclass, field\n>>> @dataclass\n... class CreatureDataMixin:\n...     size: str\n...     legs: int\n...     tail: bool = field(repr=False, default=True)\n...\n>>> class Creature(CreatureDataMixin, Enum):\n...     BEETLE = 'small', 6\n...     DOG = 'medium', 4\n...\n>>> Creature.DOG\n<Creature.DOG: size='medium', legs=4>\n\nUse the 'dataclass()' argument 'repr=False' to use the standard *note\nrepr(): 5f0.\n",
            "subsections": []
        },
        "Changed in version 3.12: Only the dataclass fields are shown in the": {
            "content": "value area, not the dataclass' name.\n\nFile: python3.12.info,  Node: Pickling,  Next: Functional API<2>,  Prev: Dataclass support,  Up: Enum HOWTO\n\n\nEnumerations can be pickled and unpickled:\n\n>>> from test.testenum import Fruit\n>>> from pickle import dumps, loads\n>>> Fruit.TOMATO is loads(dumps(Fruit.TOMATO))\nTrue\n",
            "subsections": []
        },
        "The usual restrictions for pickling apply: picklable enums must be": {
            "content": "defined in the top level of a module, since unpickling requires them to\nbe importable from that module.\n\nNote: With pickle protocol version 4 it is possible to easily\npickle enums nested in other classes.\n",
            "subsections": []
        },
        "It is possible to modify how enum members are pickled/unpickled by": {
            "content": "defining 'reduceex()' in the enumeration class.  The default method\nis by-value, but enums with complicated values may want to use by-name:\n\n>>> import enum\n>>> class MyEnum(enum.Enum):\n...     reduceex = enum.picklebyenumname\n\nNote: Using by-name for flags is not recommended, as unnamed\naliases will not unpickle.\n\nFile: python3.12.info,  Node: Functional API<2>,  Next: Derived Enumerations,  Prev: Pickling,  Up: Enum HOWTO\n\n\nThe *note Enum: 3fd. class is callable, providing the following\nfunctional API:\n\n>>> Animal = Enum('Animal', 'ANT BEE CAT DOG')\n>>> Animal\n<enum 'Animal'>\n>>> Animal.ANT\n<Animal.ANT: 1>\n>>> list(Animal)\n[<Animal.ANT: 1>, <Animal.BEE: 2>, <Animal.CAT: 3>, <Animal.DOG: 4>]\n\nThe semantics of this API resemble *note namedtuple: 711.  The first\nargument of the call to *note Enum: 3fd. is the name of the enumeration.\n",
            "subsections": []
        },
        "The second argument is the 'source' of enumeration member names.  It can": {
            "content": "be a whitespace-separated string of names, a sequence of names, a\nsequence of 2-tuples with key/value pairs, or a mapping (e.g.\ndictionary) of names to values.  The last two options enable assigning\narbitrary values to enumerations; the others auto-assign increasing\nintegers starting with 1 (use the 'start' parameter to specify a\ndifferent starting value).  A new class derived from *note Enum: 3fd. is\nreturned.  In other words, the above assignment to 'Animal' is\nequivalent to:\n\n>>> class Animal(Enum):\n...     ANT = 1\n...     BEE = 2\n...     CAT = 3\n...     DOG = 4\n...\n",
            "subsections": []
        },
        "The reason for defaulting to '1' as the starting number and not '0' is": {
            "content": "that '0' is 'False' in a boolean sense, but by default enum members all\nevaluate to 'True'.\n",
            "subsections": []
        },
        "Pickling enums created with the functional API can be tricky as frame": {
            "content": "stack implementation details are used to try and figure out which module\nthe enumeration is being created in (e.g.  it will fail if you use a\nutility function in a separate module, and also may not work on",
            "subsections": []
        },
        "IronPython or Jython).  The solution is to specify the module name": {
            "content": "explicitly as follows:\n\n>>> Animal = Enum('Animal', 'ANT BEE CAT DOG', module=name)\n\nWarning: If 'module' is not supplied, and Enum cannot determine\nwhat it is, the new Enum members will not be unpicklable; to keep\nerrors closer to the source, pickling will be disabled.\n\nThe new pickle protocol 4 also, in some circumstances, relies on *note\nqualname: 1c1c. being set to the location where pickle will be able\nto find the class.  For example, if the class was made available in\nclass SomeData in the global scope:\n\n>>> Animal = Enum('Animal', 'ANT BEE CAT DOG', qualname='SomeData.Animal')\n\nThe complete signature is:\n\nEnum(\nvalue='NewEnumName',\nnames=<...>,\n*,\nmodule='...',\nqualname='...',\ntype=<mixed-in class>,\nstart=1,\n)\n\n* 'value': What the new enum class will record as its name.\n\n* 'names': The enum members.  This can be a whitespace- or\ncomma-separated string (values will start at 1 unless otherwise\nspecified):\n\n'RED GREEN BLUE' | 'RED,GREEN,BLUE' | 'RED, GREEN, BLUE'\n\nor an iterator of names:\n\n['RED', 'GREEN', 'BLUE']\n\nor an iterator of (name, value) pairs:\n\n[('CYAN', 4), ('MAGENTA', 5), ('YELLOW', 6)]\n\nor a mapping:\n\n{'CHARTREUSE': 7, 'SEAGREEN': 11, 'ROSEMARY': 42}\n\n* 'module': name of module where new enum class can be found.\n\n* 'qualname': where in module new enum class can be found.\n\n* 'type': type to mix in to new enum class.\n\n* 'start': number to start counting at if only names are passed in.\n\nChanged in version 3.5: The 'start' parameter was added.\n\nFile: python3.12.info,  Node: Derived Enumerations,  Next: When to use new vs init,  Prev: Functional API<2>,  Up: Enum HOWTO\n\n\n* Menu:\n\n* IntEnum::\n* StrEnum::\n* IntFlag::\n* Flag::\n* Others: Others<2>.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: IntEnum,  Next: StrEnum,  Up: Derived Enumerations": {
            "content": "9.5.12.1 IntEnum\n................\n\nThe first variation of *note Enum: 3fd. that is provided is also a\nsubclass of *note int: 17e.  Members of an *note IntEnum: b2e. can be\ncompared to integers; by extension, integer enumerations of different\ntypes can also be compared to each other:\n\n>>> from enum import IntEnum\n>>> class Shape(IntEnum):\n...     CIRCLE = 1\n...     SQUARE = 2\n...\n>>> class Request(IntEnum):\n...     POST = 1\n...     GET = 2\n...\n>>> Shape == 1\nFalse\n>>> Shape.CIRCLE == 1\nTrue\n>>> Shape.CIRCLE == Request.POST\nTrue\n\nHowever, they still can't be compared to standard *note Enum: 3fd.\nenumerations:\n\n>>> class Shape(IntEnum):\n...     CIRCLE = 1\n...     SQUARE = 2\n...\n>>> class Color(Enum):\n...     RED = 1\n...     GREEN = 2\n...\n>>> Shape.CIRCLE == Color.RED\nFalse\n\n*note IntEnum: b2e. values behave like integers in other ways you'd\nexpect:\n\n>>> int(Shape.CIRCLE)\n1\n>>> ['a', 'b', 'c'][Shape.CIRCLE]\n'b'\n>>> [i for i in range(Shape.SQUARE)]\n[0, 1]\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: StrEnum,  Next: IntFlag,  Prev: IntEnum,  Up: Derived Enumerations": {
            "content": "9.5.12.2 StrEnum\n................\n\nThe second variation of *note Enum: 3fd. that is provided is also a\nsubclass of *note str: 157.  Members of a *note StrEnum: 3e6. can be\ncompared to strings; by extension, string enumerations of different\ntypes can also be compared to each other.\n\nNew in version 3.11.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: IntFlag,  Next: Flag,  Prev: StrEnum,  Up: Derived Enumerations": {
            "content": "9.5.12.3 IntFlag\n................\n\nThe next variation of *note Enum: 3fd. provided, *note IntFlag: 200b, is\nalso based on *note int: 17e.  The difference being *note IntFlag: 200b.\nmembers can be combined using the bitwise operators (&, |, ^, ~) and the\nresult is still an *note IntFlag: 200b. member, if possible.  Like *note\nIntEnum: b2e, *note IntFlag: 200b. members are also integers and can be\nused wherever an *note int: 17e. is used.\n\nNote: Any operation on an *note IntFlag: 200b. member besides the\nbit-wise operations will lose the *note IntFlag: 200b. membership.\n\nBit-wise operations that result in invalid *note IntFlag: 200b.\nvalues will lose the *note IntFlag: 200b. membership.  See *note\nFlagBoundary: 3f0. for details.\n\nNew in version 3.6.\n\nChanged in version 3.11.\n\nSample *note IntFlag: 200b. class:\n\n>>> from enum import IntFlag\n>>> class Perm(IntFlag):\n...     R = 4\n...     W = 2\n...     X = 1\n...\n>>> Perm.R | Perm.W\n<Perm.R|W: 6>\n>>> Perm.R + Perm.W\n6\n>>> RW = Perm.R | Perm.W\n>>> Perm.R in RW\nTrue\n\nIt is also possible to name the combinations:\n\n>>> class Perm(IntFlag):\n...     R = 4\n...     W = 2\n...     X = 1\n...     RWX = 7\n...\n>>> Perm.RWX\n<Perm.RWX: 7>\n>>> ~Perm.RWX\n<Perm: 0>\n>>> Perm(7)\n<Perm.RWX: 7>\n\nNote: Named combinations are considered aliases.  Aliases do not\nshow up during iteration, but can be returned from by-value\nlookups.\n\nChanged in version 3.11.\n\nAnother important difference between *note IntFlag: 200b. and *note",
            "subsections": []
        },
        "Enum: 3fd. is that if no flags are set (the value is 0), its boolean": {
            "content": "evaluation is *note False: 971.:\n\n>>> Perm.R & Perm.X\n<Perm: 0>\n>>> bool(Perm.R & Perm.X)\nFalse\n\nBecause *note IntFlag: 200b. members are also subclasses of *note int:\n17e. they can be combined with them (but may lose *note IntFlag: 200b.\nmembership:\n\n>>> Perm.X | 4\n<Perm.R|X: 5>\n\n>>> Perm.X + 8\n9\n\nNote: The negation operator, '~', always returns an *note IntFlag:\n200b. member with a positive value:\n\n>>> (~Perm.X).value == (Perm.R|Perm.W).value == 6\nTrue\n\n*note IntFlag: 200b. members can also be iterated over:\n\n>>> list(RW)\n[<Perm.R: 4>, <Perm.W: 2>]\n\nNew in version 3.11.\n\nFile: python3.12.info,  Node: Flag,  Next: Others<2>,  Prev: IntFlag,  Up: Derived Enumerations\n\n9.5.12.4 Flag\n.............\n\nThe last variation is *note Flag: 3ef.  Like *note IntFlag: 200b, *note\nFlag: 3ef. members can be combined using the bitwise operators (&, |, ^,\n~).  Unlike *note IntFlag: 200b, they cannot be combined with, nor\ncompared against, any other *note Flag: 3ef. enumeration, nor *note int:\n17e.  While it is possible to specify the values directly it is\nrecommended to use *note auto: aeb. as the value and let *note Flag:\n3ef. select an appropriate value.\n\nNew in version 3.6.\n\nLike *note IntFlag: 200b, if a combination of *note Flag: 3ef. members\nresults in no flags being set, the boolean evaluation is *note False:\n971.:\n\n>>> from enum import Flag, auto\n>>> class Color(Flag):\n...     RED = auto()\n...     BLUE = auto()\n...     GREEN = auto()\n...\n>>> Color.RED & Color.GREEN\n<Color: 0>\n>>> bool(Color.RED & Color.GREEN)\nFalse\n",
            "subsections": []
        },
        "Individual flags should have values that are powers of two (1, 2, 4, 8,": {
            "content": "...), while combinations of flags will not:\n\n>>> class Color(Flag):\n...     RED = auto()\n...     BLUE = auto()\n...     GREEN = auto()\n...     WHITE = RED | BLUE | GREEN\n...\n>>> Color.WHITE\n<Color.WHITE: 7>\n\nGiving a name to the \"no flags set\" condition does not change its\nboolean value:\n\n>>> class Color(Flag):\n...     BLACK = 0\n...     RED = auto()\n...     BLUE = auto()\n...     GREEN = auto()\n...\n>>> Color.BLACK\n<Color.BLACK: 0>\n>>> bool(Color.BLACK)\nFalse\n\n*note Flag: 3ef. members can also be iterated over:\n\n>>> purple = Color.RED | Color.BLUE\n>>> list(purple)\n[<Color.RED: 1>, <Color.BLUE: 2>]\n\nNew in version 3.11.\n\nNote: For the majority of new code, *note Enum: 3fd. and *note\nFlag: 3ef. are strongly recommended, since *note IntEnum: b2e. and\n*note IntFlag: 200b. break some semantic promises of an enumeration\n(by being comparable to integers, and thus by transitivity to other\nunrelated enumerations).  *note IntEnum: b2e. and *note IntFlag:\n200b. should be used only in cases where *note Enum: 3fd. and *note\nFlag: 3ef. will not do; for example, when integer constants are\nreplaced with enumerations, or for interoperability with other\nsystems.\n\nFile: python3.12.info,  Node: Others<2>,  Prev: Flag,  Up: Derived Enumerations\n\n9.5.12.5 Others\n...............\n\nWhile *note IntEnum: b2e. is part of the *note enum: 51. module, it\nwould be very simple to implement independently:\n\nclass IntEnum(int, Enum):\npass\n",
            "subsections": []
        },
        "This demonstrates how similar derived enumerations can be defined; for": {
            "content": "example a 'FloatEnum' that mixes in *note float: 4b7. instead of *note\nint: 17e.\n\nSome rules:\n\n1. When subclassing *note Enum: 3fd, mix-in types must appear before\n*note Enum: 3fd. itself in the sequence of bases, as in the *note\nIntEnum: b2e. example above.\n\n2. Mix-in types must be subclassable.  For example, *note bool: 17d.\nand *note range: 761. are not subclassable and will throw an error\nduring Enum creation if used as the mix-in type.\n\n3. While *note Enum: 3fd. can have members of any type, once you mix\nin an additional type, all the members must have values of that\ntype, e.g.  *note int: 17e. above.  This restriction does not apply\nto mix-ins which only add methods and don't specify another type.\n\n4. When another data type is mixed in, the 'value' attribute is 'not\nthe same' as the enum member itself, although it is equivalent and\nwill compare equal.\n\n5. A 'data type' is a mixin that defines 'new()', or a *note\ndataclass: 38d.\n\n6. %-style formatting: '%s' and '%r' call the *note Enum: 3fd. class's\n'str()' and 'repr()' respectively; other codes (such as\n'%i' or '%h' for IntEnum) treat the enum member as its mixed-in\ntype.\n\n7. *note Formatted string literals: 7cd, *note str.format(): 3ed, and\n*note format(): 3eb. will use the enum's 'str()' method.\n\nNote: Because *note IntEnum: b2e, *note IntFlag: 200b, and *note\nStrEnum: 3e6. are designed to be drop-in replacements for existing\nconstants, their 'str()' method has been reset to their data\ntypes' 'str()' method.\n\nFile: python3.12.info,  Node: When to use new vs init,  Next: How are Enums and Flags different?,  Prev: Derived Enumerations,  Up: Enum HOWTO\n\n\n'new()' must be used whenever you want to customize the actual value\nof the *note Enum: 3fd. member.  Any other modifications may go in\neither 'new()' or 'init()', with 'init()' being preferred.\n",
            "subsections": []
        },
        "For example, if you want to pass several items to the constructor, but": {
            "content": "only want one of them to be the value:\n\n>>> class Coordinate(bytes, Enum):\n...     \"\"\"\n...     Coordinate with binary codes that can be indexed by the int code.\n...     \"\"\"\n...     def new(cls, value, label, unit):\n...         obj = bytes.new(cls, [value])\n...         obj.value = value\n...         obj.label = label\n...         obj.unit = unit\n...         return obj\n...     PX = (0, 'P.X', 'km')\n...     PY = (1, 'P.Y', 'km')\n...     VX = (2, 'V.X', 'km/s')\n...     VY = (3, 'V.Y', 'km/s')\n...\n\n>>> print(Coordinate['PY'])\nCoordinate.PY\n\n>>> print(Coordinate(3))\nCoordinate.VY\n\nWarning: 'Do not' call 'super().new()', as the lookup-only\n'new' is the one that is found; instead, use the data type\ndirectly.\n\n* Menu:\n\n* Finer Points::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Finer Points,  Up: When to use new vs init": {
            "content": "9.5.13.1 Finer Points\n.....................\n\n* Menu:\n\n* Supported dunder names: Supported dunder names<2>.\n* Supported sunder names: Supported sunder names<2>.\n* Privatenames::\n* Enum member type::\n* Creating members that are mixed with other data types::\n* Boolean value of Enum classes and members::\n* Enum classes with methods::\n* Combining members of Flag::\n* Flag and IntFlag minutia::\n\nFile: python3.12.info,  Node: Supported dunder names<2>,  Next: Supported sunder names<2>,  Up: Finer Points\n\n9.5.13.2 Supported 'dunder' names\n.....................................\n\n'members' is a read-only ordered mapping of 'membername':'member'\nitems.  It is only available on the class.\n\n'new()', if specified, must create and return the enum members; it\nis also a very good idea to set the member's 'value' appropriately.\nOnce all the members are created it is no longer used.\n\nFile: python3.12.info,  Node: Supported sunder names<2>,  Next: Privatenames,  Prev: Supported dunder names<2>,  Up: Finer Points\n\n9.5.13.3 Supported 'sunder' names\n...................................\n\n- 'name' - name of the member\n\n- 'value' - value of the member; can be set / modified in 'new'\n\n- 'missing' - a lookup function used when a value is not found; may\nbe overridden\n\n- 'ignore' - a list of names, either as a *note list: 3dc. or a\n*note str: 157, that will not be transformed into members, and will\nbe removed from the final class\n\n- 'order' - used in Python 2/3 code to ensure member order is\nconsistent (class attribute, removed during class creation)\n\n- 'generatenextvalue' - used by the *note Functional API: 4ca3.\nand by *note auto: aeb. to get an appropriate value for an enum\nmember; may be overridden\n\nNote: For standard *note Enum: 3fd. classes the next value chosen\nis the last value seen incremented by one.\n\nFor *note Flag: 3ef. classes the next value chosen will be the next\nhighest power-of-two, regardless of the last value seen.\n",
            "subsections": []
        },
        "To help keep Python 2 / Python 3 code in sync an 'order' attribute can": {
            "content": "be provided.  It will be checked against the actual order of the\nenumeration and raise an error if the two do not match:\n\n>>> class Color(Enum):\n...     order = 'RED GREEN BLUE'\n...     RED = 1\n...     BLUE = 3\n...     GREEN = 2\n...\nTraceback (most recent call last):\n...\nTypeError: member order does not match order:\n['RED', 'BLUE', 'GREEN']\n['RED', 'GREEN', 'BLUE']\n\nNote: In Python 2 code the 'order' attribute is necessary as\ndefinition order is lost before it can be recorded.\n\nFile: python3.12.info,  Node: Privatenames,  Next: Enum member type,  Prev: Supported sunder names<2>,  Up: Finer Points\n\n9.5.13.4 Privatenames\n........................\n\n*note Private names: 1d28. are not converted to enum members, but remain\nnormal attributes.\n\nChanged in version 3.11.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Enum member type,  Next: Creating members that are mixed with other data types,  Prev: Privatenames,  Up: Finer Points": {
            "content": "9.5.13.5 'Enum' member type\n...........................\n",
            "subsections": []
        },
        "Enum members are instances of their enum class, and are normally": {
            "content": "accessed as 'EnumClass.member'.  In certain situations, such as writing\ncustom enum behavior, being able to access one member directly from\nanother is useful, and is supported; however, in order to avoid name\nclashes between member names and attributes/methods from mixed-in\nclasses, upper-case names are strongly recommended.\n\nChanged in version 3.5.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "9.5.13.6 Creating members that are mixed with other data types\n..............................................................\n\nWhen subclassing other data types, such as *note int: 17e. or *note str:\n157, with an *note Enum: 3fd, all values after the '=' are passed to\nthat data type's constructor.  For example:\n\n>>> class MyEnum(IntEnum):      # help(int) -> int(x, base=10) -> integer\n...     example = '11', 16      # so x='11' and base=16\n...\n>>> MyEnum.example.value        # and hex(11) is...\n17\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "9.5.13.7 Boolean value of 'Enum' classes and members\n....................................................\n\nEnum classes that are mixed with non-*note Enum: 3fd. types (such as\n*note int: 17e, *note str: 157, etc.)  are evaluated according to the\nmixed-in type's rules; otherwise, all members evaluate as *note True:\na53.  To make your own enum's boolean evaluation depend on the member's\nvalue add the following to your class:\n\ndef bool(self):\nreturn bool(self.value)\n\nPlain *note Enum: 3fd. classes always evaluate as *note True: a53.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Enum classes with methods,  Next: Combining members of Flag,  Prev: Boolean value of Enum classes and members,  Up: Finer Points": {
            "content": "9.5.13.8 'Enum' classes with methods\n....................................\n\nIf you give your enum subclass extra methods, like the *note Planet:\n4ca4. class below, those methods will show up in a *note dir(): 3ff. of\nthe member, but not of the class:\n\n>>> dir(Planet)\n['EARTH', 'JUPITER', 'MARS', 'MERCURY', 'NEPTUNE', 'SATURN', 'URANUS', 'VENUS', 'class', 'doc', 'members', 'module']\n>>> dir(Planet.EARTH)\n['class', 'doc', 'module', 'mass', 'name', 'radius', 'surfacegravity', 'value']\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Combining members of Flag,  Next: Flag and IntFlag minutia,  Prev: Enum classes with methods,  Up: Finer Points": {
            "content": "9.5.13.9 Combining members of 'Flag'\n....................................\n\nIterating over a combination of *note Flag: 3ef. members will only\nreturn the members that are comprised of a single bit:\n\n>>> class Color(Flag):\n...     RED = auto()\n...     GREEN = auto()\n...     BLUE = auto()\n...     MAGENTA = RED | BLUE\n...     YELLOW = RED | GREEN\n...     CYAN = GREEN | BLUE\n...\n>>> Color(3)  # named combination\n<Color.YELLOW: 3>\n>>> Color(7)      # not named combination\n<Color.RED|GREEN|BLUE: 7>\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Flag and IntFlag minutia,  Prev: Combining members of Flag,  Up: Finer Points": {
            "content": "9.5.13.10 'Flag' and 'IntFlag' minutia\n......................................\n\nUsing the following snippet for our examples:\n\n>>> class Color(IntFlag):\n...     BLACK = 0\n...     RED = 1\n...     GREEN = 2\n...     BLUE = 4\n...     PURPLE = RED | BLUE\n...     WHITE = RED | GREEN | BLUE\n...\n\nthe following are true:\n\n- single-bit flags are canonical\n\n- multi-bit and zero-bit flags are aliases\n\n- only canonical flags are returned during iteration:\n\n>>> list(Color.WHITE)\n[<Color.RED: 1>, <Color.GREEN: 2>, <Color.BLUE: 4>]\n\n- negating a flag or flag set returns a new flag/flag set with the\ncorresponding positive integer value:\n\n>>> Color.BLUE\n<Color.BLUE: 4>\n\n>>> ~Color.BLUE\n<Color.RED|GREEN: 3>\n\n- names of pseudo-flags are constructed from their members' names:\n\n>>> (Color.RED | Color.GREEN).name\n'RED|GREEN'\n\n- multi-bit flags, aka aliases, can be returned from operations:\n\n>>> Color.RED | Color.BLUE\n<Color.PURPLE: 5>\n\n>>> Color(7)  # or Color(-1)\n<Color.WHITE: 7>\n\n>>> Color(0)\n<Color.BLACK: 0>\n\n- membership / containment checking: zero-valued flags are always\nconsidered to be contained:\n\n>>> Color.BLACK in Color.WHITE\nTrue\n\notherwise, only if all bits of one flag are in the other flag will\nTrue be returned:\n\n>>> Color.PURPLE in Color.WHITE\nTrue\n\n>>> Color.GREEN in Color.PURPLE\nFalse\n",
            "subsections": []
        },
        "There is a new boundary mechanism that controls how out-of-range /": {
            "content": "invalid bits are handled: 'STRICT', 'CONFORM', 'EJECT', and 'KEEP':\n\n* STRICT -> raises an exception when presented with invalid values\n\n* CONFORM -> discards any invalid bits\n\n* EJECT -> lose Flag status and become a normal int with the given\nvalue\n\n* KEEP -> keep the extra bits\n\n- keeps Flag status and extra bits\n\n- extra bits do not show up in iteration\n\n- extra bits do show up in repr() and str()\n",
            "subsections": []
        },
        "The default for Flag is 'STRICT', the default for 'IntFlag' is 'EJECT',": {
            "content": "and the default for 'convert' is 'KEEP' (see 'ssl.Options' for an\nexample of when 'KEEP' is needed).\n\nFile: python3.12.info,  Node: How are Enums and Flags different?,  Next: Enum Cookbook,  Prev: When to use new vs init,  Up: Enum HOWTO\n\n",
            "subsections": []
        },
        "Enums have a custom metaclass that affects many aspects of both derived": {
            "content": "*note Enum: 3fd. classes and their instances (members).\n\n* Menu:\n\n* Enum Classes::\n* Flag Classes::\n* Enum Members (aka instances): Enum Members aka instances.\n* Flag Members::\n\nFile: python3.12.info,  Node: Enum Classes,  Next: Flag Classes,  Up: How are Enums and Flags different?\n\n9.5.14.1 Enum Classes\n.....................\n\nThe *note EnumType: 3e5. metaclass is responsible for providing the\n'contains()', 'dir()', 'iter()' and other methods that allow\none to do things with an *note Enum: 3fd. class that fail on a typical\nclass, such as 'list(Color)' or 'someenumvar in Color'.  *note",
            "subsections": []
        },
        "EnumType: 3e5. is responsible for ensuring that various other methods on": {
            "content": "the final *note Enum: 3fd. class are correct (such as 'new()',\n'getnewargs()', 'str()' and 'repr()').\n\nFile: python3.12.info,  Node: Flag Classes,  Next: Enum Members aka instances,  Prev: Enum Classes,  Up: How are Enums and Flags different?\n\n9.5.14.2 Flag Classes\n.....................\n",
            "subsections": []
        },
        "Flags have an expanded view of aliasing: to be canonical, the value of a": {
            "content": "flag needs to be a power-of-two value, and not a duplicate name.  So, in\naddition to the *note Enum: 3fd. definition of alias, a flag with no\nvalue (a.k.a.  '0') or with more than one power-of-two value (e.g.  '3')\nis considered an alias.\n\nFile: python3.12.info,  Node: Enum Members aka instances,  Next: Flag Members,  Prev: Flag Classes,  Up: How are Enums and Flags different?\n\n9.5.14.3 Enum Members (aka instances)\n.....................................\n",
            "subsections": []
        },
        "The most interesting thing about enum members is that they are": {
            "content": "singletons.  *note EnumType: 3e5. creates them all while it is creating\nthe enum class itself, and then puts a custom 'new()' in place to\nensure that no new ones are ever instantiated by returning only the\nexisting member instances.\n\nFile: python3.12.info,  Node: Flag Members,  Prev: Enum Members aka instances,  Up: How are Enums and Flags different?\n\n9.5.14.4 Flag Members\n.....................\n\nFlag members can be iterated over just like the *note Flag: 3ef. class,\nand only the canonical members will be returned.  For example:\n\n>>> list(Color)\n[<Color.RED: 1>, <Color.GREEN: 2>, <Color.BLUE: 4>]\n\n(Note that 'BLACK', 'PURPLE', and 'WHITE' do not show up.)\n",
            "subsections": []
        },
        "Inverting a flag member returns the corresponding positive value, rather": {
            "content": "than a negative value -- for example:\n\n>>> ~Color.RED\n<Color.GREEN|BLUE: 6>\n",
            "subsections": []
        },
        "Flag members have a length corresponding to the number of power-of-two": {
            "content": "values they contain.  For example:\n\n>>> len(Color.PURPLE)\n2\n\nFile: python3.12.info,  Node: Enum Cookbook,  Next: Subclassing EnumType,  Prev: How are Enums and Flags different?,  Up: Enum HOWTO\n\n\nWhile *note Enum: 3fd, *note IntEnum: b2e, *note StrEnum: 3e6, *note\nFlag: 3ef, and *note IntFlag: 200b. are expected to cover the majority\nof use-cases, they cannot cover them all.  Here are recipes for some\ndifferent types of enumerations that can be used directly, or as\nexamples for creating one's own.\n\n* Menu:\n\n* Omitting values::\n* OrderedEnum::\n* DuplicateFreeEnum::\n* Planet::\n* TimePeriod::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Omitting values,  Next: OrderedEnum,  Up: Enum Cookbook": {
            "content": "9.5.15.1 Omitting values\n........................\n",
            "subsections": []
        },
        "In many use-cases, one doesn't care what the actual value of an": {
            "content": "enumeration is.  There are several ways to define this type of simple\nenumeration:\n\n- use instances of *note auto: aeb. for the value\n\n- use instances of *note object: 8bb. as the value\n\n- use a descriptive string as the value\n\n- use a tuple as the value and a custom 'new()' to replace the\ntuple with an *note int: 17e. value\n",
            "subsections": []
        },
        "Using any of these methods signifies to the user that these values are": {
            "content": "not important, and also enables one to add, remove, or reorder members\nwithout having to renumber the remaining members.\n\n* Menu:\n\n* Using auto::\n* Using object::\n* Using a descriptive string::\n* Using a custom new(): Using a custom new.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using auto,  Next: Using object,  Up: Omitting values": {
            "content": "9.5.15.2 Using 'auto'\n.....................\n\nUsing *note auto: aeb. would look like:\n\n>>> class Color(Enum):\n...     RED = auto()\n...     BLUE = auto()\n...     GREEN = auto()\n...\n>>> Color.GREEN\n<Color.GREEN: 3>\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using object,  Next: Using a descriptive string,  Prev: Using auto,  Up: Omitting values": {
            "content": "9.5.15.3 Using 'object'\n.......................\n\nUsing *note object: 8bb. would look like:\n\n>>> class Color(Enum):\n...     RED = object()\n...     GREEN = object()\n...     BLUE = object()\n...\n>>> Color.GREEN\n<Color.GREEN: <object object at 0x...>>\n",
            "subsections": []
        },
        "This is also a good example of why you might want to write your own": {
            "content": "'repr()':\n\n>>> class Color(Enum):\n...     RED = object()\n...     GREEN = object()\n...     BLUE = object()\n...     def repr(self):\n...         return \"<%s.%s>\" % (self.class.name, self.name)\n...\n>>> Color.GREEN\n<Color.GREEN>\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using a descriptive string,  Next: Using a custom new,  Prev: Using object,  Up: Omitting values": {
            "content": "9.5.15.4 Using a descriptive string\n...................................\n\nUsing a string as the value would look like:\n\n>>> class Color(Enum):\n...     RED = 'stop'\n...     GREEN = 'go'\n...     BLUE = 'too fast!'\n...\n>>> Color.GREEN\n<Color.GREEN: 'go'>\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using a custom new,  Prev: Using a descriptive string,  Up: Omitting values": {
            "content": "9.5.15.5 Using a custom 'new()'\n...................................\n\nUsing an auto-numbering 'new()' would look like:\n\n>>> class AutoNumber(Enum):\n...     def new(cls):\n...         value = len(cls.members) + 1\n...         obj = object.new(cls)\n...         obj.value = value\n...         return obj\n...\n>>> class Color(AutoNumber):\n...     RED = ()\n...     GREEN = ()\n...     BLUE = ()\n...\n>>> Color.GREEN\n<Color.GREEN: 2>\n\nTo make a more general purpose 'AutoNumber', add '*args' to the\nsignature:\n\n>>> class AutoNumber(Enum):\n...     def new(cls, *args):      # this is the only change from above\n...         value = len(cls.members) + 1\n...         obj = object.new(cls)\n...         obj.value = value\n...         return obj\n...\n",
            "subsections": []
        },
        "Then when you inherit from 'AutoNumber' you can write your own": {
            "content": "'init' to handle any extra arguments:\n\n>>> class Swatch(AutoNumber):\n...     def init(self, pantone='unknown'):\n...         self.pantone = pantone\n...     AUBURN = '3497'\n...     SEAGREEN = '1246'\n...     BLEACHEDCORAL = () # New color, no Pantone code yet!\n...\n>>> Swatch.SEAGREEN\n<Swatch.SEAGREEN: 2>\n>>> Swatch.SEAGREEN.pantone\n'1246'\n>>> Swatch.BLEACHEDCORAL.pantone\n'unknown'\n\nNote: The 'new()' method, if defined, is used during creation\nof the Enum members; it is then replaced by Enum's 'new()'\nwhich is used after class creation for lookup of existing members.\n\nWarning: 'Do not' call 'super().new()', as the lookup-only\n'new' is the one that is found; instead, use the data type\ndirectly - e.g.:\n\nobj = int.new(cls, value)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: OrderedEnum,  Next: DuplicateFreeEnum,  Prev: Omitting values,  Up: Enum Cookbook": {
            "content": "9.5.15.6 OrderedEnum\n....................\n\nAn ordered enumeration that is not based on *note IntEnum: b2e. and so\nmaintains the normal *note Enum: 3fd. invariants (such as not being\ncomparable to other enumerations):\n\n>>> class OrderedEnum(Enum):\n...     def ge(self, other):\n...         if self.class is other.class:\n...             return self.value >= other.value\n...         return NotImplemented\n...     def gt(self, other):\n...         if self.class is other.class:\n...             return self.value > other.value\n...         return NotImplemented\n...     def le(self, other):\n...         if self.class is other.class:\n...             return self.value <= other.value\n...         return NotImplemented\n...     def lt(self, other):\n...         if self.class is other.class:\n...             return self.value < other.value\n...         return NotImplemented\n...\n>>> class Grade(OrderedEnum):\n...     A = 5\n...     B = 4\n...     C = 3\n...     D = 2\n...     F = 1\n...\n>>> Grade.C < Grade.A\nTrue\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: DuplicateFreeEnum,  Next: Planet,  Prev: OrderedEnum,  Up: Enum Cookbook": {
            "content": "9.5.15.7 DuplicateFreeEnum\n..........................\n",
            "subsections": []
        },
        "Raises an error if a duplicate member value is found instead of creating": {
            "content": "an alias:\n\n>>> class DuplicateFreeEnum(Enum):\n...     def init(self, *args):\n...         cls = self.class\n...         if any(self.value == e.value for e in cls):\n...             a = self.name\n...             e = cls(self.value).name\n...             raise ValueError(\n...                 \"aliases not allowed in DuplicateFreeEnum:  %r --> %r\"\n...                 % (a, e))\n...\n>>> class Color(DuplicateFreeEnum):\n...     RED = 1\n...     GREEN = 2\n...     BLUE = 3\n...     GRENE = 2\n...\nTraceback (most recent call last):\n...\nValueError: aliases not allowed in DuplicateFreeEnum:  'GRENE' --> 'GREEN'\n\nNote: This is a useful example for subclassing Enum to add or\nchange other behaviors as well as disallowing aliases.  If the only\ndesired change is disallowing aliases, the *note unique(): 22c1.\ndecorator can be used instead.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Planet,  Next: TimePeriod,  Prev: DuplicateFreeEnum,  Up: Enum Cookbook": {
            "content": "9.5.15.8 Planet\n...............\n",
            "subsections": []
        },
        "If 'new()' or 'init()' is defined, the value of the enum member": {
            "content": "will be passed to those methods:\n\n>>> class Planet(Enum):\n...     MERCURY = (3.303e+23, 2.4397e6)\n...     VENUS   = (4.869e+24, 6.0518e6)\n...     EARTH   = (5.976e+24, 6.37814e6)\n...     MARS    = (6.421e+23, 3.3972e6)\n...     JUPITER = (1.9e+27,   7.1492e7)\n...     SATURN  = (5.688e+26, 6.0268e7)\n...     URANUS  = (8.686e+25, 2.5559e7)\n...     NEPTUNE = (1.024e+26, 2.4746e7)\n...     def init(self, mass, radius):\n...         self.mass = mass       # in kilograms\n...         self.radius = radius   # in meters\n...     @property\n...     def surfacegravity(self):\n...         # universal gravitational constant  (m3 kg-1 s-2)\n...         G = 6.67300E-11\n...         return G * self.mass / (self.radius * self.radius)\n...\n>>> Planet.EARTH.value\n(5.976e+24, 6378140.0)\n>>> Planet.EARTH.surfacegravity\n9.802652743337129\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: TimePeriod,  Prev: Planet,  Up: Enum Cookbook": {
            "content": "9.5.15.9 TimePeriod\n...................\n\nAn example to show the 'ignore' attribute in use:\n\n>>> from datetime import timedelta\n>>> class Period(timedelta, Enum):\n...     \"different lengths of time\"\n...     ignore = 'Period i'\n...     Period = vars()\n...     for i in range(367):\n...         Period['day%d' % i] = i\n...\n>>> list(Period)[:2]\n[<Period.day0: datetime.timedelta(0)>, <Period.day1: datetime.timedelta(days=1)>]\n>>> list(Period)[-2:]\n[<Period.day365: datetime.timedelta(days=365)>, <Period.day366: datetime.timedelta(days=366)>]\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Subclassing EnumType,  Prev: Enum Cookbook,  Up: Enum HOWTO": {
            "content": "While most enum needs can be met by customizing *note Enum: 3fd.\nsubclasses, either with class decorators or custom functions, *note\nEnumType: 3e5. can be subclassed to provide a different Enum experience.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Functional Programming HOWTO,  Next: Logging HOWTO,  Prev: Enum HOWTO,  Up: Python HOWTOs": {
            "content": "",
            "subsections": [
                {
                    "name": "9.6 Functional Programming HOWTO",
                    "content": ""
                }
            ]
        },
        "Author: A. M. Kuchling": {
            "content": "",
            "subsections": []
        },
        "Release: 0.32": {
            "content": "",
            "subsections": []
        },
        "In this document, we'll take a tour of Python's features suitable for": {
            "content": "implementing programs in a functional style.  After an introduction to\nthe concepts of functional programming, we'll look at language features\nsuch as *note iterator: 16a9.s and *note generator: eda.s and relevant\nlibrary modules such as *note itertools: 7b. and *note functools: 5a.\n\n* Menu:\n\n* Introduction: Introduction<13>.\n* Iterators: Iterators<2>.\n* Generator expressions and list comprehensions::\n* Generators: Generators<2>.\n* Built-in functions: Built-in functions<2>.\n* The itertools module::\n* The functools module::\n* Small functions and the lambda expression::\n* Revision History and Acknowledgements::\n* References: References<2>.\n\nFile: python3.12.info,  Node: Introduction<13>,  Next: Iterators<2>,  Up: Functional Programming HOWTO\n\n",
            "subsections": []
        },
        "This section explains the basic concept of functional programming; if": {
            "content": "you're just interested in learning about Python language features, skip\nto the next section on *note Iterators: 4ccb.\n",
            "subsections": []
        },
        "Programming languages support decomposing problems in several different": {
            "content": "ways:\n\n* Most programming languages are 'procedural': programs are lists of\ninstructions that tell the computer what to do with the program's\ninput.  C, Pascal, and even Unix shells are procedural languages.\n\n* In 'declarative' languages, you write a specification that\ndescribes the problem to be solved, and the language implementation\nfigures out how to perform the computation efficiently.  SQL is the\ndeclarative language you're most likely to be familiar with; a SQL\nquery describes the data set you want to retrieve, and the SQL\nengine decides whether to scan tables or use indexes, which\nsubclauses should be performed first, etc.\n\n* 'Object-oriented' programs manipulate collections of objects.\nObjects have internal state and support methods that query or\nmodify this internal state in some way.  Smalltalk and Java are\nobject-oriented languages.  C++ and Python are languages that\nsupport object-oriented programming, but don't force the use of\nobject-oriented features.\n\n* 'Functional' programming decomposes a problem into a set of\nfunctions.  Ideally, functions only take inputs and produce\noutputs, and don't have any internal state that affects the output\nproduced for a given input.  Well-known functional languages\ninclude the ML family (Standard ML, OCaml, and other variants) and\nHaskell.\n",
            "subsections": []
        },
        "The designers of some computer languages choose to emphasize one": {
            "content": "particular approach to programming.  This often makes it difficult to\nwrite programs that use a different approach.  Other languages are\nmulti-paradigm languages that support several different approaches.\nLisp, C++, and Python are multi-paradigm; you can write programs or\nlibraries that are largely procedural, object-oriented, or functional in\nall of these languages.  In a large program, different sections might be\nwritten using different approaches; the GUI might be object-oriented\nwhile the processing logic is procedural or functional, for example.\n",
            "subsections": []
        },
        "In a functional program, input flows through a set of functions.  Each": {
            "content": "function operates on its input and produces some output.  Functional\nstyle discourages functions with side effects that modify internal state\nor make other changes that aren't visible in the function's return\nvalue.  Functions that have no side effects at all are called 'purely\nfunctional'.  Avoiding side effects means not using data structures that\nget updated as a program runs; every function's output must only depend\non its input.\n",
            "subsections": []
        },
        "Some languages are very strict about purity and don't even have": {
            "content": "assignment statements such as 'a=3' or 'c = a + b', but it's difficult\nto avoid all side effects, such as printing to the screen or writing to\na disk file.  Another example is a call to the *note print(): de5. or\n*note time.sleep(): 469. function, neither of which returns a useful\nvalue.  Both are called only for their side effects of sending some text\nto the screen or pausing execution for a second.\n",
            "subsections": []
        },
        "Python programs written in functional style usually won't go to the": {
            "content": "extreme of avoiding all I/O or all assignments; instead, they'll provide\na functional-appearing interface but will use non-functional features\ninternally.  For example, the implementation of a function will still\nuse assignments to local variables, but won't modify global variables or\nhave other side effects.\n",
            "subsections": []
        },
        "Functional programming can be considered the opposite of object-oriented": {
            "content": "programming.  Objects are little capsules containing some internal state\nalong with a collection of method calls that let you modify this state,\nand programs consist of making the right set of state changes.",
            "subsections": []
        },
        "Functional programming wants to avoid state changes as much as possible": {
            "content": "and works with data flowing between functions.  In Python you might\ncombine the two approaches by writing functions that take and return\ninstances representing objects in your application (e-mail messages,\ntransactions, etc.).\n",
            "subsections": []
        },
        "Functional design may seem like an odd constraint to work under.  Why": {
            "content": "should you avoid objects and side effects?  There are theoretical and\npractical advantages to the functional style:\n\n* Formal provability.\n\n* Modularity.\n\n* Composability.\n\n* Ease of debugging and testing.\n\n* Menu:\n\n* Formal provability::\n* Modularity::\n* Ease of debugging and testing::\n* Composability::\n\nFile: python3.12.info,  Node: Formal provability,  Next: Modularity,  Up: Introduction<13>\n\n9.6.1.1 Formal provability\n..........................\n\nA theoretical benefit is that it's easier to construct a mathematical\nproof that a functional program is correct.\n",
            "subsections": []
        },
        "For a long time researchers have been interested in finding ways to": {
            "content": "mathematically prove programs correct.  This is different from testing a\nprogram on numerous inputs and concluding that its output is usually\ncorrect, or reading a program's source code and concluding that the code\nlooks right; the goal is instead a rigorous proof that a program\nproduces the right result for all possible inputs.\n",
            "subsections": []
        },
        "The technique used to prove programs correct is to write down": {
            "content": "'invariants', properties of the input data and of the program's\nvariables that are always true.  For each line of code, you then show\nthat if invariants X and Y are true 'before' the line is executed, the\nslightly different invariants X' and Y' are true 'after' the line is\nexecuted.  This continues until you reach the end of the program, at\nwhich point the invariants should match the desired conditions on the\nprogram's output.\n",
            "subsections": []
        },
        "Functional programming's avoidance of assignments arose because": {
            "content": "assignments are difficult to handle with this technique; assignments can\nbreak invariants that were true before the assignment without producing\nany new invariants that can be propagated onward.\n",
            "subsections": []
        },
        "Unfortunately, proving programs correct is largely impractical and not": {
            "content": "relevant to Python software.  Even trivial programs require proofs that\nare several pages long; the proof of correctness for a moderately\ncomplicated program would be enormous, and few or none of the programs\nyou use daily (the Python interpreter, your XML parser, your web\nbrowser) could be proven correct.  Even if you wrote down or generated a\nproof, there would then be the question of verifying the proof; maybe\nthere's an error in it, and you wrongly believe you've proved the\nprogram correct.\n\nFile: python3.12.info,  Node: Modularity,  Next: Ease of debugging and testing,  Prev: Formal provability,  Up: Introduction<13>\n\n9.6.1.2 Modularity\n..................\n\nA more practical benefit of functional programming is that it forces you\nto break apart your problem into small pieces.  Programs are more\nmodular as a result.  It's easier to specify and write a small function\nthat does one thing than a large function that performs a complicated\ntransformation.  Small functions are also easier to read and to check\nfor errors.\n\nFile: python3.12.info,  Node: Ease of debugging and testing,  Next: Composability,  Prev: Modularity,  Up: Introduction<13>\n\n9.6.1.3 Ease of debugging and testing\n.....................................\n\nTesting and debugging a functional-style program is easier.\n",
            "subsections": []
        },
        "Debugging is simplified because functions are generally small and": {
            "content": "clearly specified.  When a program doesn't work, each function is an\ninterface point where you can check that the data are correct.  You can\nlook at the intermediate inputs and outputs to quickly isolate the\nfunction that's responsible for a bug.\n",
            "subsections": []
        },
        "Testing is easier because each function is a potential subject for a": {
            "content": "unit test.  Functions don't depend on system state that needs to be\nreplicated before running a test; instead you only have to synthesize\nthe right input and then check that the output matches expectations.\n\nFile: python3.12.info,  Node: Composability,  Prev: Ease of debugging and testing,  Up: Introduction<13>\n\n9.6.1.4 Composability\n.....................\n",
            "subsections": []
        },
        "As you work on a functional-style program, you'll write a number of": {
            "content": "functions with varying inputs and outputs.  Some of these functions will\nbe unavoidably specialized to a particular application, but others will\nbe useful in a wide variety of programs.  For example, a function that\ntakes a directory path and returns all the XML files in the directory,\nor a function that takes a filename and returns its contents, can be\napplied to many different situations.\n",
            "subsections": []
        },
        "Over time you'll form a personal library of utilities.  Often you'll": {
            "content": "assemble new programs by arranging existing functions in a new\nconfiguration and writing a few functions specialized for the current\ntask.\n\nFile: python3.12.info,  Node: Iterators<2>,  Next: Generator expressions and list comprehensions,  Prev: Introduction<13>,  Up: Functional Programming HOWTO\n\n\nI'll start by looking at a Python language feature that's an important\nfoundation for writing functional-style programs: iterators.\n",
            "subsections": []
        },
        "An iterator is an object representing a stream of data; this object": {
            "content": "returns the data one element at a time.  A Python iterator must support\na method called *note next(): 1141. that takes no arguments and\nalways returns the next element of the stream.  If there are no more\nelements in the stream, *note next(): 1141. must raise the *note",
            "subsections": []
        },
        "StopIteration: a40. exception.  Iterators don't have to be finite,": {
            "content": "though; it's perfectly reasonable to write an iterator that produces an\ninfinite stream of data.\n\nThe built-in *note iter(): 5ca. function takes an arbitrary object and\ntries to return an iterator that will return the object's contents or\nelements, raising *note TypeError: 28e. if the object doesn't support\niteration.  Several of Python's built-in data types support iteration,\nthe most common being lists and dictionaries.  An object is called *note\niterable: 109d. if you can get an iterator for it.\n\nYou can experiment with the iteration interface manually:\n\n>>> L = [1, 2, 3]\n>>> it = iter(L)\n>>> it\n<...iterator object at ...>\n>>> it.next()  # same as next(it)\n1\n>>> next(it)\n2\n>>> next(it)\n3\n>>> next(it)\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nStopIteration\n>>>\n",
            "subsections": []
        },
        "Python expects iterable objects in several different contexts, the most": {
            "content": "important being the *note for: 24e. statement.  In the statement 'for X\nin Y', Y must be an iterator or some object for which *note iter(): 5ca.\ncan create an iterator.  These two statements are equivalent:\n\nfor i in iter(obj):\nprint(i)\n\nfor i in obj:\nprint(i)\n\nIterators can be materialized as lists or tuples by using the *note\nlist(): 3dc. or *note tuple(): 4b8. constructor functions:\n\n>>> L = [1, 2, 3]\n>>> iterator = iter(L)\n>>> t = tuple(iterator)\n>>> t\n(1, 2, 3)\n",
            "subsections": []
        },
        "Sequence unpacking also supports iterators: if you know an iterator will": {
            "content": "return N elements, you can unpack them into an N-tuple:\n\n>>> L = [1, 2, 3]\n>>> iterator = iter(L)\n>>> a, b, c = iterator\n>>> a, b, c\n(1, 2, 3)\n\nBuilt-in functions such as *note max(): d70. and *note min(): d6f. can\ntake a single iterator argument and will return the largest or smallest\nelement.  The '\"in\"' and '\"not in\"' operators also support iterators: 'X\nin iterator' is true if X is found in the stream returned by the\niterator.  You'll run into obvious problems if the iterator is infinite;\n*note max(): d70, *note min(): d6f. will never return, and if the\nelement X never appears in the stream, the '\"in\"' and '\"not in\"'\noperators won't return either.\n",
            "subsections": []
        },
        "Iterator objects can optionally provide these additional capabilities,": {
            "content": "but the iterator protocol only specifies the *note next(): 1141.\nmethod.  Functions may therefore consume all of the iterator's output,\nand if you need to do something different with the same stream, you'll\nhave to create a new iterator.\n\n* Menu:\n\n* Data Types That Support Iterators::\n\nFile: python3.12.info,  Node: Data Types That Support Iterators,  Up: Iterators<2>\n\n9.6.2.1 Data Types That Support Iterators\n.........................................\n",
            "subsections": []
        },
        "We've already seen how lists and tuples support iterators.  In fact, any": {
            "content": "",
            "subsections": []
        },
        "Python sequence type, such as strings, will automatically support": {
            "content": "creation of an iterator.\n\nCalling *note iter(): 5ca. on a dictionary returns an iterator that will\nloop over the dictionary's keys:\n\n>>> m = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6,\n...      'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12}\n>>> for key in m:\n...     print(key, m[key])\nJan 1\nFeb 2\nMar 3\nApr 4\nMay 5\nJun 6\nJul 7\nAug 8\nSep 9\nOct 10\nNov 11\nDec 12\n",
            "subsections": []
        },
        "Note that starting with Python 3.7, dictionary iteration order is": {
            "content": "guaranteed to be the same as the insertion order.  In earlier versions,\nthe behaviour was unspecified and could vary between implementations.\n\nApplying *note iter(): 5ca. to a dictionary always loops over the keys,\nbut dictionaries have methods that return other iterators.  If you want\nto iterate over values or key/value pairs, you can explicitly call the\n*note values(): 5c0. or *note items(): 5c1. methods to get an\nappropriate iterator.\n\nThe *note dict(): 237. constructor can accept an iterator that returns a\nfinite stream of '(key, value)' tuples:\n\n>>> L = [('Italy', 'Rome'), ('France', 'Paris'), ('US', 'Washington DC')]\n>>> dict(iter(L))\n{'Italy': 'Rome', 'France': 'Paris', 'US': 'Washington DC'}\n\nFiles also support iteration by calling the *note readline(): 1a40.\nmethod until there are no more lines in the file.  This means you can\nread each line of a file like this:\n\nfor line in file:\n# do something for each line\n...\n",
            "subsections": []
        },
        "Sets can take their contents from an iterable and let you iterate over": {
            "content": "the set's elements:\n\n>>> S = {2, 3, 5, 7, 11, 13}\n>>> for i in S:\n...     print(i)\n2\n3\n5\n7\n11\n13\n\nFile: python3.12.info,  Node: Generator expressions and list comprehensions,  Next: Generators<2>,  Prev: Iterators<2>,  Up: Functional Programming HOWTO\n\n",
            "subsections": []
        },
        "Two common operations on an iterator's output are 1) performing some": {
            "content": "operation for every element, 2) selecting a subset of elements that meet\nsome condition.  For example, given a list of strings, you might want to\nstrip off trailing whitespace from each line or extract all the strings\ncontaining a given substring.\n\nList comprehensions and generator expressions (short form: \"listcomps\"\nand \"genexps\") are a concise notation for such operations, borrowed from\nthe functional programming language Haskell\n('https://www.haskell.org/').  You can strip all the whitespace from a\nstream of strings with the following code:\n\n>>> linelist = ['  line 1\\n', 'line 2  \\n', ' \\n', '']\n\n>>> # Generator expression -- returns iterator\n>>> strippediter = (line.strip() for line in linelist)\n\n>>> # List comprehension -- returns list\n>>> strippedlist = [line.strip() for line in linelist]\n\nYou can select only certain elements by adding an '\"if\"' condition:\n\n>>> strippedlist = [line.strip() for line in linelist\n...                  if line != \"\"]\n",
            "subsections": []
        },
        "With a list comprehension, you get back a Python list; 'strippedlist'": {
            "content": "is a list containing the resulting lines, not an iterator.  Generator\nexpressions return an iterator that computes the values as necessary,\nnot needing to materialize all the values at once.  This means that list\ncomprehensions aren't useful if you're working with iterators that\nreturn an infinite stream or a very large amount of data.  Generator\nexpressions are preferable in these situations.\n\nGenerator expressions are surrounded by parentheses (\"()\") and list\ncomprehensions are surrounded by square brackets (\"[]\").  Generator\nexpressions have the form:\n\n( expression for expr in sequence1\nif condition1\nfor expr2 in sequence2\nif condition2\nfor expr3 in sequence3\n...\nif condition3\nfor exprN in sequenceN\nif conditionN )\n",
            "subsections": []
        },
        "Again, for a list comprehension only the outside brackets are different": {
            "content": "(square brackets instead of parentheses).\n",
            "subsections": []
        },
        "The elements of the generated output will be the successive values of": {
            "content": "'expression'.  The 'if' clauses are all optional; if present,\n'expression' is only evaluated and added to the result when 'condition'\nis true.\n",
            "subsections": []
        },
        "Generator expressions always have to be written inside parentheses, but": {
            "content": "the parentheses signalling a function call also count.  If you want to\ncreate an iterator that will be immediately passed to a function you can\nwrite:\n\nobjtotal = sum(obj.count for obj in listallobjects())\n",
            "subsections": []
        },
        "The 'for...in' clauses contain the sequences to be iterated over.  The": {
            "content": "sequences do not have to be the same length, because they are iterated\nover from left to right, 'not' in parallel.  For each element in\n'sequence1', 'sequence2' is looped over from the beginning.  'sequence3'\nis then looped over for each resulting pair of elements from 'sequence1'\nand 'sequence2'.\n",
            "subsections": []
        },
        "To put it another way, a list comprehension or generator expression is": {
            "content": "equivalent to the following Python code:\n\nfor expr1 in sequence1:\nif not (condition1):\ncontinue   # Skip this element\nfor expr2 in sequence2:\nif not (condition2):\ncontinue   # Skip this element\n...\nfor exprN in sequenceN:\nif not (conditionN):\ncontinue   # Skip this element\n\n# Output the value of\n# the expression.\n",
            "subsections": []
        },
        "This means that when there are multiple 'for...in' clauses but no 'if'": {
            "content": "clauses, the length of the resulting output will be equal to the product\nof the lengths of all the sequences.  If you have two lists of length 3,\nthe output list is 9 elements long:\n\n>>> seq1 = 'abc'\n>>> seq2 = (1, 2, 3)\n>>> [(x, y) for x in seq1 for y in seq2]\n[('a', 1), ('a', 2), ('a', 3),\n('b', 1), ('b', 2), ('b', 3),\n('c', 1), ('c', 2), ('c', 3)]\n",
            "subsections": []
        },
        "Generators are a special class of functions that simplify the task of": {
            "content": "writing iterators.  Regular functions compute a value and return it, but\ngenerators return an iterator that returns a stream of values.\n",
            "subsections": []
        },
        "You're doubtless familiar with how regular function calls work in Python": {
            "content": "or C. When you call a function, it gets a private namespace where its\nlocal variables are created.  When the function reaches a 'return'\nstatement, the local variables are destroyed and the value is returned\nto the caller.  A later call to the same function creates a new private\nnamespace and a fresh set of local variables.  But, what if the local\nvariables weren't thrown away on exiting a function?  What if you could\nlater resume the function where it left off?  This is what generators\nprovide; they can be thought of as resumable functions.\n\nHere's the simplest example of a generator function:\n\n>>> def generateints(N):\n...    for i in range(N):\n...        yield i\n\nAny function containing a *note yield: 7f1. keyword is a generator\nfunction; this is detected by Python's *note bytecode: 370. compiler\nwhich compiles the function specially as a result.\n",
            "subsections": []
        },
        "Inside a generator function, 'return value' causes": {
            "content": "'StopIteration(value)' to be raised from the *note next(): 1a49.\nmethod.  Once this happens, or the bottom of the function is reached,\nthe procession of values ends and the generator cannot yield any further\nvalues.\n",
            "subsections": []
        },
        "The test suite included with Python's library,": {
            "content": "",
            "subsections": []
        },
        "Lib/test/testgenerators.py(1), contains a number of more interesting": {
            "content": "examples.  Here's one generator that implements an in-order traversal of\na tree using generators recursively.\n\n# A recursive generator that generates Tree leaves in in-order.\ndef inorder(t):\nif t:\nfor x in inorder(t.left):\nyield x\n\nyield t.label\n\nfor x in inorder(t.right):\nyield x\n",
            "subsections": []
        },
        "Two other examples in 'testgenerators.py' produce solutions for the": {
            "content": "N-Queens problem (placing N queens on an NxN chess board so that no\nqueen threatens another) and the Knight's Tour (finding a route that\ntakes a knight to every square of an NxN chessboard without visiting any\nsquare twice).\n\n* Menu:\n\n* Passing values into a generator::\n\n---------- Footnotes ----------\n\n(1)\nhttps://github.com/python/cpython/tree/3.12/Lib/test/testgenerators.py\n\nFile: python3.12.info,  Node: Passing values into a generator,  Up: Generators<2>\n\n9.6.4.1 Passing values into a generator\n.......................................\n",
            "subsections": []
        },
        "In Python 2.4 and earlier, generators only produced output.  Once a": {
            "content": "generator's code was invoked to create an iterator, there was no way to\npass any new information into the function when its execution is\nresumed.  You could hack together this ability by making the generator\nlook at a global variable or by passing in some mutable object that\ncallers then modify, but these approaches are messy.\n\nIn Python 2.5 there's a simple way to pass values into a generator.\n*note yield: 7f1. became an expression, returning a value that can be\nassigned to a variable or otherwise operated on:\n\nval = (yield i)\n\nI recommend that you 'always' put parentheses around a 'yield'\nexpression when you're doing something with the returned value, as in\nthe above example.  The parentheses aren't always necessary, but it's\neasier to always add them instead of having to remember when they're\nneeded.\n\n( PEP 342(1) explains the exact rules, which are that a\n'yield'-expression must always be parenthesized except when it occurs at\nthe top-level expression on the right-hand side of an assignment.  This\nmeans you can write 'val = yield i' but have to use parentheses when\nthere's an operation, as in 'val = (yield i) + 12'.)\n\nValues are sent into a generator by calling its *note send(value): 1cd3.\nmethod.  This method resumes the generator's code and the 'yield'\nexpression returns the specified value.  If the regular *note\nnext(): 1a49. method is called, the 'yield' returns 'None'.\n",
            "subsections": []
        },
        "Here's a simple counter that increments by 1 and allows changing the": {
            "content": "value of the internal counter.\n\ndef counter(maximum):\ni = 0\nwhile i < maximum:\nval = (yield i)\n# If value provided, change counter\nif val is not None:\ni = val\nelse:\ni += 1\n\nAnd here's an example of changing the counter:\n\n>>> it = counter(10)\n>>> next(it)\n0\n>>> next(it)\n1\n>>> it.send(8)\n8\n>>> next(it)\n9\n>>> next(it)\nTraceback (most recent call last):\nFile \"t.py\", line 15, in <module>\nit.next()\nStopIteration\n",
            "subsections": []
        },
        "Because 'yield' will often be returning 'None', you should always check": {
            "content": "for this case.  Don't just use its value in expressions unless you're\nsure that the *note send(): 1cd3. method will be the only method used to\nresume your generator function.\n\nIn addition to *note send(): 1cd3, there are two other methods on\ngenerators:\n\n* *note throw(value): 241. is used to raise an exception inside the\ngenerator; the exception is raised by the 'yield' expression where\nthe generator's execution is paused.\n\n* *note close(): 1517. raises a *note GeneratorExit: 121c. exception\ninside the generator to terminate the iteration.  On receiving this\nexception, the generator's code must either raise *note\nGeneratorExit: 121c. or *note StopIteration: a40.; catching the\nexception and doing anything else is illegal and will trigger a\n*note RuntimeError: 17a.  *note close(): 1517. will also be called\nby Python's garbage collector when the generator is\ngarbage-collected.\n\nIf you need to run cleanup code when a *note GeneratorExit: 121c.\noccurs, I suggest using a 'try: ... finally:' suite instead of\ncatching *note GeneratorExit: 121c.\n",
            "subsections": []
        },
        "Let's look in more detail at built-in functions often used with": {
            "content": "iterators.\n\nTwo of Python's built-in functions, *note map(): 65f. and *note\nfilter(): 660. duplicate the features of generator expressions:\n\n*note map(f, iterA, iterB, ...): 65f. returns an iterator over the sequence\n\n'f(iterA[0], iterB[0]), f(iterA[1], iterB[1]), f(iterA[2],\niterB[2]), ...'.\n\n>>> def upper(s):\n...     return s.upper()\n\n>>> list(map(upper, ['sentence', 'fragment']))\n['SENTENCE', 'FRAGMENT']\n>>> [upper(s) for s in ['sentence', 'fragment']]\n['SENTENCE', 'FRAGMENT']\n\nYou can of course achieve the same effect with a list comprehension.\n\n*note filter(predicate, iter): 660. returns an iterator over all the\nsequence elements that meet a certain condition, and is similarly\nduplicated by list comprehensions.  A 'predicate' is a function that\nreturns the truth value of some condition; for use with *note filter():\n660, the predicate must take a single value.\n\n>>> def iseven(x):\n...     return (x % 2) == 0\n\n>>> list(filter(iseven, range(10)))\n[0, 2, 4, 6, 8]\n\nThis can also be written as a list comprehension:\n\n>>> list(x for x in range(10) if iseven(x))\n[0, 2, 4, 6, 8]\n\n*note enumerate(iter, start=0): 12d5. counts off the elements in the\niterable returning 2-tuples containing the count (from 'start') and each\nelement.\n\n>>> for item in enumerate(['subject', 'verb', 'object']):\n...     print(item)\n(0, 'subject')\n(1, 'verb')\n(2, 'object')\n\n*note enumerate(): 12d5. is often used when looping through a list and\nrecording the indexes at which certain conditions are met:\n\nf = open('data.txt', 'r')\nfor i, line in enumerate(f):\nif line.strip() == '':\nprint('Blank line at line #%i' % i)\n\n*note sorted(iterable, key=None, reverse=False): a12. collects all the\nelements of the iterable into a list, sorts the list, and returns the\nsorted result.  The 'key' and 'reverse' arguments are passed through to\nthe constructed list's *note sort(): a13. method.\n\n>>> import random\n>>> # Generate 8 random numbers between [0, 10000)\n>>> randlist = random.sample(range(10000), 8)\n>>> randlist\n[769, 7953, 9828, 6431, 8442, 9878, 6213, 2207]\n>>> sorted(randlist)\n[769, 2207, 6213, 6431, 7953, 8442, 9828, 9878]\n>>> sorted(randlist, reverse=True)\n[9878, 9828, 8442, 7953, 6431, 6213, 2207, 769]\n\n(For a more detailed discussion of sorting, see the *note Sorting",
            "subsections": []
        },
        "Techniques: 1e89.)": {
            "content": "The *note any(iter): 1277. and *note all(iter): 1278. built-ins look at\nthe truth values of an iterable's contents.  *note any(): 1277. returns\n'True' if any element in the iterable is a true value, and *note all():\n1278. returns 'True' if all of the elements are true values:\n\n>>> any([0, 1, 0])\nTrue\n>>> any([0, 0, 0])\nFalse\n>>> any([1, 1, 1])\nTrue\n>>> all([0, 1, 0])\nFalse\n>>> all([0, 0, 0])\nFalse\n>>> all([1, 1, 1])\nTrue\n\n*note zip(iterA, iterB, ...): 5c2. takes one element from each iterable\nand returns them in a tuple:\n\nzip(['a', 'b', 'c'], (1, 2, 3)) =>\n('a', 1), ('b', 2), ('c', 3)\n",
            "subsections": []
        },
        "It doesn't construct an in-memory list and exhaust all the input": {
            "content": "iterators before returning; instead tuples are constructed and returned\nonly if they're requested.  (The technical term for this behaviour is\nlazy evaluation(1).)\n",
            "subsections": []
        },
        "This iterator is intended to be used with iterables that are all of the": {
            "content": "same length.  If the iterables are of different lengths, the resulting\nstream will be the same length as the shortest iterable.\n\nzip(['a', 'b'], (1, 2, 3)) =>\n('a', 1), ('b', 2)\n",
            "subsections": []
        },
        "You should avoid doing this, though, because an element may be taken": {
            "content": "from the longer iterators and discarded.  This means you can't go on to\nuse the iterators further because you risk skipping a discarded element.\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Lazyevaluation\n\nFile: python3.12.info,  Node: The itertools module,  Next: The functools module,  Prev: Built-in functions<2>,  Up: Functional Programming HOWTO\n\n\nThe *note itertools: 7b. module contains a number of commonly used\niterators as well as functions for combining several iterators.  This\nsection will introduce the module's contents by showing small examples.\n\nThe module's functions fall into a few broad classes:\n\n* Functions that create a new iterator based on an existing iterator.\n\n* Functions for treating an iterator's elements as function\narguments.\n\n* Functions for selecting portions of an iterator's output.\n\n* A function for grouping an iterator's output.\n\n* Menu:\n\n* Creating new iterators::\n* Calling functions on elements::\n* Selecting elements::\n* Combinatoric functions::\n* Grouping elements::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Creating new iterators,  Next: Calling functions on elements,  Up: The itertools module": {
            "content": "9.6.6.1 Creating new iterators\n..............................\n\n*note itertools.count(start, step): 10fc. returns an infinite stream of\nevenly spaced values.  You can optionally supply the starting number,\nwhich defaults to 0, and the interval between numbers, which defaults to\n1:\n\nitertools.count() =>\n0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...\nitertools.count(10) =>\n10, 11, 12, 13, 14, 15, 16, 17, 18, 19, ...\nitertools.count(10, 5) =>\n10, 15, 20, 25, 30, 35, 40, 45, 50, 55, ...\n\n*note itertools.cycle(iter): 2426. saves a copy of the contents of a\nprovided iterable and returns a new iterator that returns its elements\nfrom first to last.  The new iterator will repeat these elements\ninfinitely.\n\nitertools.cycle([1, 2, 3, 4, 5]) =>\n1, 2, 3, 4, 5, 1, 2, 3, 4, 5, ...\n\n*note itertools.repeat(elem, [n]): 2427. returns the provided element\n'n' times, or returns the element endlessly if 'n' is not provided.\n\nitertools.repeat('abc') =>\nabc, abc, abc, abc, abc, abc, abc, abc, abc, abc, ...\nitertools.repeat('abc', 5) =>\nabc, abc, abc, abc, abc\n\n*note itertools.chain(iterA, iterB, ...): 1e8a. takes an arbitrary\nnumber of iterables as input, and returns all the elements of the first\niterator, then all the elements of the second, and so on, until all of\nthe iterables have been exhausted.\n\nitertools.chain(['a', 'b', 'c'], (1, 2, 3)) =>\na, b, c, 1, 2, 3\n\n*note itertools.islice(iter, [start], stop, [step]): 988. returns a\nstream that's a slice of the iterator.  With a single 'stop' argument,\nit will return the first 'stop' elements.  If you supply a starting\nindex, you'll get 'stop-start' elements, and if you supply a value for\n'step', elements will be skipped accordingly.  Unlike Python's string\nand list slicing, you can't use negative values for 'start', 'stop', or\n'step'.\n\nitertools.islice(range(10), 8) =>\n0, 1, 2, 3, 4, 5, 6, 7\nitertools.islice(range(10), 2, 8) =>\n2, 3, 4, 5, 6, 7\nitertools.islice(range(10), 2, 8, 2) =>\n2, 4, 6\n\n*note itertools.tee(iter, [n]): 242c. replicates an iterator; it returns\n'n' independent iterators that will all return the contents of the\nsource iterator.  If you don't supply a value for 'n', the default is 2.",
            "subsections": []
        },
        "Replicating iterators requires saving some of the contents of the source": {
            "content": "iterator, so this can consume significant memory if the iterator is\nlarge and one of the new iterators is consumed more than the others.\n\nitertools.tee( itertools.count() ) =>\niterA, iterB\n\nwhere iterA ->\n0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...\n\nand   iterB ->\n0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Calling functions on elements,  Next: Selecting elements,  Prev: Creating new iterators,  Up: The itertools module": {
            "content": "9.6.6.2 Calling functions on elements\n.....................................\n\nThe *note operator: 9a. module contains a set of functions corresponding\nto Python's operators.  Some examples are *note operator.add(a, b):\n244f. (adds two values), *note operator.ne(a, b): 243f. (same as 'a !=\nb'), and *note operator.attrgetter('id'): c92. (returns a callable that\nfetches the '.id' attribute).\n\n*note itertools.starmap(func, iter): f53. assumes that the iterable will\nreturn a stream of tuples, and calls 'func' using these tuples as the\narguments:\n\nitertools.starmap(os.path.join,\n[('/bin', 'python'), ('/usr', 'bin', 'java'),\n('/usr', 'bin', 'perl'), ('/usr', 'bin', 'ruby')])\n=>\n/bin/python, /usr/bin/java, /usr/bin/perl, /usr/bin/ruby\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Selecting elements,  Next: Combinatoric functions,  Prev: Calling functions on elements,  Up: The itertools module": {
            "content": "9.6.6.3 Selecting elements\n..........................\n",
            "subsections": []
        },
        "Another group of functions chooses a subset of an iterator's elements": {
            "content": "based on a predicate.\n\n*note itertools.filterfalse(predicate, iter): 1e72. is the opposite of\n*note filter(): 660, returning all elements for which the predicate\nreturns false:\n\nitertools.filterfalse(iseven, itertools.count()) =>\n1, 3, 5, 7, 9, 11, 13, 15, ...\n\n*note itertools.takewhile(predicate, iter): 242b. returns elements for\nas long as the predicate returns true.  Once the predicate returns\nfalse, the iterator will signal the end of its results.\n\ndef lessthan10(x):\nreturn x < 10\n\nitertools.takewhile(lessthan10, itertools.count()) =>\n0, 1, 2, 3, 4, 5, 6, 7, 8, 9\n\nitertools.takewhile(iseven, itertools.count()) =>\n0\n\n*note itertools.dropwhile(predicate, iter): 2429. discards elements\nwhile the predicate returns true, and then returns the rest of the\niterable's results.\n\nitertools.dropwhile(lessthan10, itertools.count()) =>\n10, 11, 12, 13, 14, 15, 16, 17, 18, 19, ...\n\nitertools.dropwhile(iseven, itertools.count()) =>\n1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...\n\n*note itertools.compress(data, selectors): 10fb. takes two iterators and\nreturns only those elements of 'data' for which the corresponding\nelement of 'selectors' is true, stopping whenever either one is\nexhausted:\n\nitertools.compress([1, 2, 3, 4, 5], [True, True, False, False, True]) =>\n1, 2, 5\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Combinatoric functions,  Next: Grouping elements,  Prev: Selecting elements,  Up: The itertools module": {
            "content": "9.6.6.4 Combinatoric functions\n..............................\n\nThe *note itertools.combinations(iterable, r): 1188. returns an iterator\ngiving all possible 'r'-tuple combinations of the elements contained in\n'iterable'.\n\nitertools.combinations([1, 2, 3, 4, 5], 2) =>\n(1, 2), (1, 3), (1, 4), (1, 5),\n(2, 3), (2, 4), (2, 5),\n(3, 4), (3, 5),\n(4, 5)\n\nitertools.combinations([1, 2, 3, 4, 5], 3) =>\n(1, 2, 3), (1, 2, 4), (1, 2, 5), (1, 3, 4), (1, 3, 5), (1, 4, 5),\n(2, 3, 4), (2, 3, 5), (2, 4, 5),\n(3, 4, 5)\n",
            "subsections": []
        },
        "The elements within each tuple remain in the same order as 'iterable'": {
            "content": "returned them.  For example, the number 1 is always before 2, 3, 4, or 5\nin the examples above.  A similar function, *note\nitertools.permutations(iterable, r=None): 167f, removes this constraint\non the order, returning all possible arrangements of length 'r':\n\nitertools.permutations([1, 2, 3, 4, 5], 2) =>\n(1, 2), (1, 3), (1, 4), (1, 5),\n(2, 1), (2, 3), (2, 4), (2, 5),\n(3, 1), (3, 2), (3, 4), (3, 5),\n(4, 1), (4, 2), (4, 3), (4, 5),\n(5, 1), (5, 2), (5, 3), (5, 4)\n\nitertools.permutations([1, 2, 3, 4, 5]) =>\n(1, 2, 3, 4, 5), (1, 2, 3, 5, 4), (1, 2, 4, 3, 5),\n...\n(5, 4, 3, 2, 1)\n",
            "subsections": []
        },
        "If you don't supply a value for 'r' the length of the iterable is used,": {
            "content": "meaning that all the elements are permuted.\n",
            "subsections": []
        },
        "Note that these functions produce all of the possible combinations by": {
            "content": "position and don't require that the contents of 'iterable' are unique:\n\nitertools.permutations('aba', 3) =>\n('a', 'b', 'a'), ('a', 'a', 'b'), ('b', 'a', 'a'),\n('b', 'a', 'a'), ('a', 'a', 'b'), ('a', 'b', 'a')\n",
            "subsections": []
        },
        "The identical tuple '('a', 'a', 'b')' occurs twice, but the two 'a'": {
            "content": "strings came from different positions.\n\nThe *note itertools.combinationswithreplacement(iterable, r): 10fa.\nfunction relaxes a different constraint: elements can be repeated within\na single tuple.  Conceptually an element is selected for the first\nposition of each tuple and then is replaced before the second element is\nselected.\n\nitertools.combinationswithreplacement([1, 2, 3, 4, 5], 2) =>\n(1, 1), (1, 2), (1, 3), (1, 4), (1, 5),\n(2, 2), (2, 3), (2, 4), (2, 5),\n(3, 3), (3, 4), (3, 5),\n(4, 4), (4, 5),\n(5, 5)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Grouping elements,  Prev: Combinatoric functions,  Up: The itertools module": {
            "content": "9.6.6.5 Grouping elements\n.........................\n\nThe last function I'll discuss, *note itertools.groupby(iter,\nkeyfunc=None): 242a, is the most complicated.  'keyfunc(elem)' is a\nfunction that can compute a key value for each element returned by the\niterable.  If you don't supply a key function, the key is simply each\nelement itself.\n\n*note groupby(): 242a. collects all the consecutive elements from the\nunderlying iterable that have the same key value, and returns a stream\nof 2-tuples containing a key value and an iterator for the elements with\nthat key.\n\ncitylist = [('Decatur', 'AL'), ('Huntsville', 'AL'), ('Selma', 'AL'),\n('Anchorage', 'AK'), ('Nome', 'AK'),\n('Flagstaff', 'AZ'), ('Phoenix', 'AZ'), ('Tucson', 'AZ'),\n...\n]\n\ndef getstate(citystate):\nreturn citystate[1]\n\nitertools.groupby(citylist, getstate) =>\n('AL', iterator-1),\n('AK', iterator-2),\n('AZ', iterator-3), ...\n\nwhere\niterator-1 =>\n('Decatur', 'AL'), ('Huntsville', 'AL'), ('Selma', 'AL')\niterator-2 =>\n('Anchorage', 'AK'), ('Nome', 'AK')\niterator-3 =>\n('Flagstaff', 'AZ'), ('Phoenix', 'AZ'), ('Tucson', 'AZ')\n\n*note groupby(): 242a. assumes that the underlying iterable's contents\nwill already be sorted based on the key.  Note that the returned\niterators also use the underlying iterable, so you have to consume the\nresults of iterator-1 before requesting iterator-2 and its corresponding\nkey.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The functools module,  Next: Small functions and the lambda expression,  Prev: The itertools module,  Up: Functional Programming HOWTO": {
            "content": "The *note functools: 5a. module contains some higher-order functions.  A\n'higher-order function' takes one or more functions as input and returns\na new function.  The most useful tool in this module is the *note\nfunctools.partial(): d31. function.\n",
            "subsections": []
        },
        "For programs written in a functional style, you'll sometimes want to": {
            "content": "construct variants of existing functions that have some of the\nparameters filled in.  Consider a Python function 'f(a, b, c)'; you may\nwish to create a new function 'g(b, c)' that's equivalent to 'f(1, b,\nc)'; you're filling in a value for one of 'f()''s parameters.  This is\ncalled \"partial function application\".\n\nThe constructor for *note partial(): d31. takes the arguments\n'(function, arg1, arg2, ..., kwarg1=value1, kwarg2=value2)'.  The\nresulting object is callable, so you can just call it to invoke\n'function' with the filled-in arguments.\n\nHere's a small but realistic example:\n\nimport functools\n\ndef log(message, subsystem):\n\"\"\"Write the contents of 'message' to the specified subsystem.\"\"\"\nprint('%s: %s' % (subsystem, message))\n...\n\nserverlog = functools.partial(log, subsystem='server')\nserverlog('Unable to open socket')\n\n*note functools.reduce(func, iter, [initialvalue]): 1151. cumulatively\nperforms an operation on all the iterable's elements and, therefore,\ncan't be applied to infinite iterables.  'func' must be a function that\ntakes two elements and returns a single value.  *note\nfunctools.reduce(): 1151. takes the first two elements A and B returned\nby the iterator and calculates 'func(A, B)'.  It then requests the third\nelement, C, calculates 'func(func(A, B), C)', combines this result with\nthe fourth element returned, and continues until the iterable is\nexhausted.  If the iterable returns no values at all, a *note TypeError:\n28e. exception is raised.  If the initial value is supplied, it's used\nas a starting point and 'func(initialvalue, A)' is the first\ncalculation.\n\n>>> import operator, functools\n>>> functools.reduce(operator.concat, ['A', 'BB', 'C'])\n'ABBC'\n>>> functools.reduce(operator.concat, [])\nTraceback (most recent call last):\n...\nTypeError: reduce() of empty sequence with no initial value\n>>> functools.reduce(operator.mul, [1, 2, 3], 1)\n6\n>>> functools.reduce(operator.mul, [], 1)\n1\n\nIf you use *note operator.add(): 244f. with *note functools.reduce():\n1151, you'll add up all the elements of the iterable.  This case is so\ncommon that there's a special built-in called *note sum(): 181. to\ncompute it:\n\n>>> import functools, operator\n>>> functools.reduce(operator.add, [1, 2, 3, 4], 0)\n10\n>>> sum([1, 2, 3, 4])\n10\n>>> sum([])\n0\n\nFor many uses of *note functools.reduce(): 1151, though, it can be\nclearer to just write the obvious *note for: 24e. loop:\n\nimport functools\n# Instead of:\nproduct = functools.reduce(operator.mul, [1, 2, 3], 1)\n\n# You can write:\nproduct = 1\nfor i in [1, 2, 3]:\nproduct *= i\n\nA related function is *note itertools.accumulate(iterable,\nfunc=operator.add): 825.  It performs the same calculation, but instead\nof returning only the final result, *note accumulate(): 825. returns an\niterator that also yields each partial result:\n\nitertools.accumulate([1, 2, 3, 4, 5]) =>\n1, 3, 6, 10, 15\n\nitertools.accumulate([1, 2, 3, 4, 5], operator.mul) =>\n1, 2, 6, 24, 120\n\n* Menu:\n\n* The operator module::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The operator module,  Up: The functools module": {
            "content": "9.6.7.1 The operator module\n...........................\n\nThe *note operator: 9a. module was mentioned earlier.  It contains a set\nof functions corresponding to Python's operators.  These functions are\noften useful in functional-style code because they save you from writing\ntrivial functions that perform a single operation.\n\nSome of the functions in this module are:\n\n* Math operations: 'add()', 'sub()', 'mul()', 'floordiv()', 'abs()',\n...\n\n* Logical operations: 'not()', 'truth()'.\n\n* Bitwise operations: 'and()', 'or()', 'invert()'.\n\n* Comparisons: 'eq()', 'ne()', 'lt()', 'le()', 'gt()', and 'ge()'.\n\n* Object identity: 'is()', 'isnot()'.\n\nConsult the operator module's documentation for a complete list.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Small functions and the lambda expression,  Next: Revision History and Acknowledgements,  Prev: The functools module,  Up: Functional Programming HOWTO": {
            "content": "",
            "subsections": []
        },
        "When writing functional-style programs, you'll often need little": {
            "content": "functions that act as predicates or that combine elements in some way.\n",
            "subsections": []
        },
        "If there's a Python built-in or a module function that's suitable, you": {
            "content": "don't need to define a new function at all:\n\nstrippedlines = [line.strip() for line in lines]\nexistingfiles = filter(os.path.exists, filelist)\n",
            "subsections": []
        },
        "If the function you need doesn't exist, you need to write it.  One way": {
            "content": "to write small functions is to use the *note lambda: 1115. expression.\n'lambda' takes a number of parameters and an expression combining these\nparameters, and creates an anonymous function that returns the value of\nthe expression:\n\nadder = lambda x, y: x+y\n\nprintassign = lambda name, value: name + '=' + str(value)\n",
            "subsections": []
        },
        "An alternative is to just use the 'def' statement and define a function": {
            "content": "in the usual way:\n\ndef adder(x, y):\nreturn x + y\n\ndef printassign(name, value):\nreturn name + '=' + str(value)\n\nWhich alternative is preferable?  That's a style question; my usual\ncourse is to avoid using 'lambda'.\n",
            "subsections": []
        },
        "One reason for my preference is that 'lambda' is quite limited in the": {
            "content": "functions it can define.  The result has to be computable as a single\nexpression, which means you can't have multiway 'if... elif... else'\ncomparisons or 'try... except' statements.  If you try to do too much in\na 'lambda' statement, you'll end up with an overly complicated\nexpression that's hard to read.  Quick, what's the following code doing?\n\nimport functools\ntotal = functools.reduce(lambda a, b: (0, a[1] + b[1]), items)[1]\n",
            "subsections": []
        },
        "You can figure it out, but it takes time to disentangle the expression": {
            "content": "to figure out what's going on.  Using a short nested 'def' statements\nmakes things a little bit better:\n\nimport functools\ndef combine(a, b):\nreturn 0, a[1] + b[1]\n\ntotal = functools.reduce(combine, items)[1]\n\nBut it would be best of all if I had simply used a 'for' loop:\n\ntotal = 0\nfor a, b in items:\ntotal += b\n\nOr the *note sum(): 181. built-in and a generator expression:\n\ntotal = sum(b for a, b in items)\n\nMany uses of *note functools.reduce(): 1151. are clearer when written as\n'for' loops.\n",
            "subsections": []
        },
        "Fredrik Lundh once suggested the following set of rules for refactoring": {
            "content": "uses of 'lambda':\n\n1. Write a lambda function.\n\n2. Write a comment explaining what the heck that lambda does.\n\n3. Study the comment for a while, and think of a name that captures\nthe essence of the comment.\n\n4. Convert the lambda to a def statement, using that name.\n\n5. Remove the comment.\n\nI really like these rules, but you're free to disagree about whether\nthis lambda-free style is better.\n\nFile: python3.12.info,  Node: Revision History and Acknowledgements,  Next: References<2>,  Prev: Small functions and the lambda expression,  Up: Functional Programming HOWTO\n\n",
            "subsections": []
        },
        "Jewett, Mike Krell, Leandro Lameiro, Jussi Salmela, Collin Winter, Blake": {
            "content": "Winton.\n\nVersion 0.1: posted June 30 2006.\n\nVersion 0.11: posted July 1 2006.  Typo fixes.\n",
            "subsections": []
        },
        "Version 0.2: posted July 10 2006.  Merged genexp and listcomp sections": {
            "content": "into one.  Typo fixes.\n\nVersion 0.21: Added more references suggested on the tutor mailing list.\n",
            "subsections": []
        },
        "Version 0.30: Adds a section on the 'functional' module written by": {
            "content": "",
            "subsections": []
        },
        "Collin Winter; adds short section on the operator module; a few other": {
            "content": "edits.\n\nFile: python3.12.info,  Node: References<2>,  Prev: Revision History and Acknowledgements,  Up: Functional Programming HOWTO\n\n\n* Menu:\n\n* General::\n* Python-specific::\n* Python documentation::\n\nFile: python3.12.info,  Node: General,  Next: Python-specific,  Up: References<2>\n\n9.6.10.1 General\n................\n\n'Structure and Interpretation of Computer Programs', by Harold Abelson\nand Gerald Jay Sussman with Julie Sussman.  The book can be found at\n'https://mitpress.mit.edu/sicp'.  In this classic textbook of computer\nscience, chapters 2 and 3 discuss the use of sequences and streams to\norganize the data flow inside a program.  The book uses Scheme for its\nexamples, but many of the design approaches described in these chapters\nare applicable to functional-style Python code.\n\n'https://www.defmacro.org/ramblings/fp.html': A general introduction to\nfunctional programming that uses Java examples and has a lengthy\nhistorical introduction.\n\n'https://en.wikipedia.org/wiki/Functionalprogramming': General\nWikipedia entry describing functional programming.\n\n'https://en.wikipedia.org/wiki/Coroutine': Entry for coroutines.\n\n'https://en.wikipedia.org/wiki/Partialapplication': Entry for the\nconcept of partial function application.\n\n'https://en.wikipedia.org/wiki/Currying': Entry for the concept of\ncurrying.\n\nFile: python3.12.info,  Node: Python-specific,  Next: Python documentation,  Prev: General,  Up: References<2>\n\n9.6.10.2 Python-specific\n........................\n\n'https://gnosis.cx/TPiP/': The first chapter of David Mertz's book 'Text",
            "subsections": []
        },
        "Processing in Python' discusses functional programming for text": {
            "content": "processing, in the section titled \"Utilizing Higher-Order Functions in\nText Processing\".\n",
            "subsections": []
        },
        "Mertz also wrote a 3-part series of articles on functional programming": {
            "content": "for IBM's DeveloperWorks site; see part 1(1), part 2(2), and part 3(3),\n\n---------- Footnotes ----------\n\n(1) https://developer.ibm.com/articles/l-prog/\n\n(2) https://developer.ibm.com/tutorials/l-prog2/\n\n(3) https://developer.ibm.com/tutorials/l-prog3/\n\nFile: python3.12.info,  Node: Python documentation,  Prev: Python-specific,  Up: References<2>\n\n9.6.10.3 Python documentation\n.............................\n\nDocumentation for the *note itertools: 7b. module.\n\nDocumentation for the *note functools: 5a. module.\n\nDocumentation for the *note operator: 9a. module.\n\nPEP 289(1): \"Generator Expressions\"\n\nPEP 342(2): \"Coroutines via Enhanced Generators\" describes the new\ngenerator features in Python 2.5.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0289/\n\n(2) https://peps.python.org/pep-0342/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Logging HOWTO,  Next: Logging Cookbook,  Prev: Functional Programming HOWTO,  Up: Python HOWTOs": {
            "content": "",
            "subsections": [
                {
                    "name": "9.7 Logging HOWTO",
                    "content": "Author: Vinay Sajip <vinaysajip at red-dove dot com>\n"
                }
            ]
        },
        "This page contains tutorial information.  For links to reference": {
            "content": "information and a logging cookbook, please see *note Other resources:\n4ce6.\n\n* Menu:\n\n* Basic Logging Tutorial::\n* Advanced Logging Tutorial::\n* Logging Levels: Logging Levels<2>.\n* Useful Handlers::\n* Exceptions raised during logging::\n* Using arbitrary objects as messages::\n* Optimization::\n* Other resources::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Basic Logging Tutorial,  Next: Advanced Logging Tutorial,  Up: Logging HOWTO": {
            "content": "",
            "subsections": []
        },
        "Logging is a means of tracking events that happen when some software": {
            "content": "runs.  The software's developer adds logging calls to their code to\nindicate that certain events have occurred.  An event is described by a\ndescriptive message which can optionally contain variable data (i.e.\ndata that is potentially different for each occurrence of the event).",
            "subsections": []
        },
        "Events also have an importance which the developer ascribes to the": {
            "content": "event; the importance can also be called the 'level' or 'severity'.\n\n* Menu:\n\n* When to use logging::\n* A simple example::\n* Logging to a file::\n* Logging variable data::\n* Changing the format of displayed messages::\n* Displaying the date/time in messages::\n* Next Steps::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: When to use logging,  Next: A simple example,  Up: Basic Logging Tutorial": {
            "content": "9.7.1.1 When to use logging\n...........................\n\nYou can access logging functionality by creating a logger via 'logger =\ngetLogger(name)', and then calling the logger's *note debug(): c89,\n*note info(): 29c2, *note warning(): 29c4, *note error(): 29c5. and\n*note critical(): c88. methods.  To determine when to use logging, and\nto see which logger methods to use when, see the table below.  It\nstates, for each of a set of common tasks, the best tool to use for that\ntask.\n",
            "subsections": []
        },
        "Task you want to perform                  The best tool for the task": {
            "content": "-------------------------------------------------------------------------------------\n\nDisplay console output for ordinary       *note print(): de5.\nusage of a command line script or\nprogram\n\nReport events that occur during normal    A logger's *note info(): 29c2. (or\noperation of a program (e.g.  for         *note debug(): c89. method for very\nstatus monitoring or fault                detailed output for diagnostic purposes)\ninvestigation)\n\nIssue a warning regarding a particular    *note warnings.warn(): 1374. in library\nruntime event                             code if the issue is avoidable and the\nclient application should be modified to\neliminate the warning\n\nA logger's *note warning(): 29c4. method\nif there is nothing the client\napplication can do about the situation,\nbut the event should still be noted\n\n",
            "subsections": []
        },
        "Report an error regarding a particular    Raise an exception": {
            "content": "runtime event\n\nReport suppression of an error without    A logger's *note error(): 29c5,\nraising an exception (e.g.  error         *note exception(): c87. or\nhandler in a long-running server          *note critical(): c88. method as\nprocess)                                  appropriate for the specific error and\napplication domain\n\n",
            "subsections": []
        },
        "The logger methods are named after the level or severity of the events": {
            "content": "they are used to track.  The standard levels and their applicability are\ndescribed below (in increasing order of severity):\n",
            "subsections": []
        },
        "Level              When it's used": {
            "content": "---------------------------------------------------------------------\n\n'DEBUG'            Detailed information, typically of interest\nonly when diagnosing problems.\n\n\n'INFO'             Confirmation that things are working as\nexpected.\n\n\n'WARNING'          An indication that something unexpected\nhappened, or indicative of some problem in the\nnear future (e.g.  'disk space low').  The\nsoftware is still working as expected.\n\n\n'ERROR'            Due to a more serious problem, the software has\nnot been able to perform some function.\n\n\n'CRITICAL'         A serious error, indicating that the program\nitself may be unable to continue running.\n\n",
            "subsections": []
        },
        "The default level is 'WARNING', which means that only events of this": {
            "content": "level and above will be tracked, unless the logging package is\nconfigured to do otherwise.\n",
            "subsections": []
        },
        "Events that are tracked can be handled in different ways.  The simplest": {
            "content": "way of handling tracked events is to print them to the console.  Another\ncommon way is to write them to a disk file.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: A simple example,  Next: Logging to a file,  Prev: When to use logging,  Up: Basic Logging Tutorial": {
            "content": "9.7.1.2 A simple example\n........................\n\nA very simple example is:\n\nimport logging\nlogging.warning('Watch out!')  # will print a message to the console\nlogging.info('I told you so')  # will not print anything\n\nIf you type these lines into a script and run it, you'll see:\n\nWARNING:root:Watch out!\n\nprinted out on the console.  The 'INFO' message doesn't appear because\nthe default level is 'WARNING'.  The printed message includes the\nindication of the level and the description of the event provided in the\nlogging call, i.e.  'Watch out!'.  The actual output can be formatted\nquite flexibly if you need that; formatting options will also be\nexplained later.\n",
            "subsections": []
        },
        "Notice that in this example, we use functions directly on the 'logging'": {
            "content": "module, like 'logging.debug', rather than creating a logger and calling\nfunctions on it.  These functions operation on the root logger, but can\nbe useful as they will call *note basicConfig(): 828. for you if it has\nnot been called yet, like in this example.  In larger programs you'll\nusually want to control the logging configuration explicitly however -\nso for that reason as well as others, it's better to create loggers and\ncall their methods.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Logging to a file,  Next: Logging variable data,  Prev: A simple example,  Up: Basic Logging Tutorial": {
            "content": "9.7.1.3 Logging to a file\n.........................\n\nA very common situation is that of recording logging events in a file,\nso let's look at that next.  Be sure to try the following in a newly\nstarted Python interpreter, and don't just continue from the session\ndescribed above:\n\nimport logging\nlogger = logging.getLogger(name)\nlogging.basicConfig(filename='example.log', encoding='utf-8', level=logging.DEBUG)\nlogger.debug('This message should go to the log file')\nlogger.info('So should this')\nlogger.warning('And this, too')\nlogger.error('And non-ASCII stuff, too, like ??resund and Malmo\"')\n",
            "subsections": []
        },
        "Changed in version 3.9: The 'encoding' argument was added.  In earlier": {
            "content": "",
            "subsections": []
        },
        "Python versions, or if not specified, the encoding used is the default": {
            "content": "value used by *note open(): 26e.  While not shown in the above example,\nan 'errors' argument can also now be passed, which determines how\nencoding errors are handled.  For available values and the default, see\nthe documentation for *note open(): 26e.\n",
            "subsections": []
        },
        "And now if we open the file and look at what we have, we should find the": {
            "content": "log messages:\n\nDEBUG:main:This message should go to the log file\nINFO:main:So should this\nWARNING:main:And this, too\nERROR:main:And non-ASCII stuff, too, like ??resund and Malmo\"\n",
            "subsections": []
        },
        "This example also shows how you can set the logging level which acts as": {
            "content": "the threshold for tracking.  In this case, because we set the threshold\nto 'DEBUG', all of the messages were printed.\n\nIf you want to set the logging level from a command-line option such as:\n\n--log=INFO\n\nand you have the value of the parameter passed for '--log' in some\nvariable 'loglevel', you can use:\n\ngetattr(logging, loglevel.upper())\n\nto get the value which you'll pass to *note basicConfig(): 828. via the\n'level' argument.  You may want to error check any user input value,\nperhaps as in the following example:\n\n# assuming loglevel is bound to the string value obtained from the\n# command line argument. Convert to upper case to allow the user to\n# specify --log=DEBUG or --log=debug\nnumericlevel = getattr(logging, loglevel.upper(), None)\nif not isinstance(numericlevel, int):\nraise ValueError('Invalid log level: %s' % loglevel)\nlogging.basicConfig(level=numericlevel, ...)\n\nThe call to *note basicConfig(): 828. should come 'before' any calls to\na logger's methods such as *note debug(): c89, *note info(): 29c2, etc.\nOtherwise, that logging event may not be handled in the desired manner.\n",
            "subsections": []
        },
        "If you run the above script several times, the messages from successive": {
            "content": "runs are appended to the file 'example.log'.  If you want each run to\nstart afresh, not remembering the messages from earlier runs, you can\nspecify the 'filemode' argument, by changing the call in the above\nexample to:\n\nlogging.basicConfig(filename='example.log', filemode='w', level=logging.DEBUG)\n",
            "subsections": []
        },
        "The output will be the same as before, but the log file is no longer": {
            "content": "appended to, so the messages from earlier runs are lost.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Logging variable data,  Next: Changing the format of displayed messages,  Prev: Logging to a file,  Up: Basic Logging Tutorial": {
            "content": "9.7.1.4 Logging variable data\n.............................\n",
            "subsections": []
        },
        "To log variable data, use a format string for the event description": {
            "content": "message and append the variable data as arguments.  For example:\n\nimport logging\nlogging.warning('%s before you %s', 'Look', 'leap!')\n\nwill display:\n\nWARNING:root:Look before you leap!\n",
            "subsections": []
        },
        "As you can see, merging of variable data into the event description": {
            "content": "message uses the old, %-style of string formatting.  This is for\nbackwards compatibility: the logging package pre-dates newer formatting\noptions such as *note str.format(): 3ed. and *note string.Template: 453.",
            "subsections": []
        },
        "These newer formatting options 'are' supported, but exploring them is": {
            "content": "outside the scope of this tutorial: see *note Using particular\nformatting styles throughout your application: 29e3. for more\ninformation.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Changing the format of displayed messages,  Next: Displaying the date/time in messages,  Prev: Logging variable data,  Up: Basic Logging Tutorial": {
            "content": "9.7.1.5 Changing the format of displayed messages\n.................................................\n",
            "subsections": []
        },
        "To change the format which is used to display messages, you need to": {
            "content": "specify the format you want to use:\n\nimport logging\nlogging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG)\nlogging.debug('This message should appear on the console')\nlogging.info('So should this')\nlogging.warning('And this, too')\n\nwhich would print:\n\nDEBUG:This message should appear on the console\nINFO:So should this\nWARNING:And this, too\n",
            "subsections": []
        },
        "Notice that the 'root' which appeared in earlier examples has": {
            "content": "disappeared.  For a full set of things that can appear in format\nstrings, you can refer to the documentation for *note LogRecord\nattributes: 29c1, but for simple usage, you just need the 'levelname'\n(severity), 'message' (event description, including variable data) and\nperhaps to display when the event occurred.  This is described in the\nnext section.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Displaying the date/time in messages,  Next: Next Steps,  Prev: Changing the format of displayed messages,  Up: Basic Logging Tutorial": {
            "content": "9.7.1.6 Displaying the date/time in messages\n............................................\n\nTo display the date and time of an event, you would place '%(asctime)s'\nin your format string:\n\nimport logging\nlogging.basicConfig(format='%(asctime)s %(message)s')\nlogging.warning('is when this event was logged.')\n\nwhich should print something like this:\n\n2010-12-12 11:41:42,612 is when this event was logged.\n",
            "subsections": []
        },
        "The default format for date/time display (shown above) is like ISO8601": {
            "content": "or RFC 3339(1).  If you need more control over the formatting of the\ndate/time, provide a 'datefmt' argument to 'basicConfig', as in this\nexample:\n\nimport logging\nlogging.basicConfig(format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p')\nlogging.warning('is when this event was logged.')\n\nwhich would display something like this:\n\n12/12/2010 11:46:36 AM is when this event was logged.\n\nThe format of the 'datefmt' argument is the same as supported by *note\ntime.strftime(): 105d.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc3339.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Next Steps,  Prev: Displaying the date/time in messages,  Up: Basic Logging Tutorial": {
            "content": "9.7.1.7 Next Steps\n..................\n",
            "subsections": []
        },
        "That concludes the basic tutorial.  It should be enough to get you up": {
            "content": "and running with logging.  There's a lot more that the logging package\noffers, but to get the best out of it, you'll need to invest a little\nmore of your time in reading the following sections.  If you're ready\nfor that, grab some of your favourite beverage and carry on.\n",
            "subsections": []
        },
        "If your logging needs are simple, then use the above examples to": {
            "content": "incorporate logging into your own scripts, and if you run into problems\nor don't understand something, please post a question on the\ncomp.lang.python Usenet group (available at\n'https://groups.google.com/g/comp.lang.python') and you should receive\nhelp before too long.\n\nStill here?  You can carry on reading the next few sections, which\nprovide a slightly more advanced/in-depth tutorial than the basic one\nabove.  After that, you can take a look at the *note Logging Cookbook:\n106b.\n\nFile: python3.12.info,  Node: Advanced Logging Tutorial,  Next: Logging Levels<2>,  Prev: Basic Logging Tutorial,  Up: Logging HOWTO\n\n",
            "subsections": []
        },
        "The logging library takes a modular approach and offers several": {
            "content": "categories of components: loggers, handlers, filters, and formatters.\n\n* Loggers expose the interface that application code directly uses.\n\n* Handlers send the log records (created by loggers) to the\nappropriate destination.\n\n* Filters provide a finer grained facility for determining which log\nrecords to output.\n\n* Formatters specify the layout of log records in the final output.\n",
            "subsections": []
        },
        "Log event information is passed between loggers, handlers, filters and": {
            "content": "formatters in a *note LogRecord: e59. instance.\n\nLogging is performed by calling methods on instances of the *note",
            "subsections": []
        },
        "Logger: 98b. class (hereafter called 'loggers').  Each instance has a": {
            "content": "name, and they are conceptually arranged in a namespace hierarchy using\ndots (periods) as separators.  For example, a logger named 'scan' is the\nparent of loggers 'scan.text', 'scan.html' and 'scan.pdf'.  Logger names\ncan be anything you want, and indicate the area of an application in\nwhich a logged message originates.\n\nA good convention to use when naming loggers is to use a module-level\nlogger, in each module which uses logging, named as follows:\n\nlogger = logging.getLogger(name)\n",
            "subsections": []
        },
        "This means that logger names track the package/module hierarchy, and": {
            "content": "it's intuitively obvious where events are logged just from the logger\nname.\n",
            "subsections": []
        },
        "The root of the hierarchy of loggers is called the root logger.  That's": {
            "content": "the logger used by the functions *note debug(): 29c3, *note info():\n29ee, *note warning(): 12e8, *note error(): 2a02. and *note critical():\n2a03, which just call the same-named method of the root logger.  The\nfunctions and the methods have the same signatures.  The root logger's\nname is printed as 'root' in the logged output.\n\nIt is, of course, possible to log messages to different destinations.",
            "subsections": []
        },
        "Support is included in the package for writing log messages to files,": {
            "content": "HTTP GET/POST locations, email via SMTP, generic sockets, queues, or\nOS-specific logging mechanisms such as syslog or the Windows NT event\nlog.  Destinations are served by 'handler' classes.  You can create your\nown log destination class if you have special requirements not met by\nany of the built-in handler classes.\n",
            "subsections": []
        },
        "By default, no destination is set for any logging messages.  You can": {
            "content": "specify a destination (such as console or file) by using *note\nbasicConfig(): 828. as in the tutorial examples.  If you call the\nfunctions *note debug(): 29c3, *note info(): 29ee, *note warning():\n12e8, *note error(): 2a02. and *note critical(): 2a03, they will check\nto see if no destination is set; and if one is not set, they will set a\ndestination of the console ('sys.stderr') and a default format for the\ndisplayed message before delegating to the root logger to do the actual\nmessage output.\n\nThe default format set by *note basicConfig(): 828. for messages is:\n\nseverity:logger name:message\n\nYou can change this by passing a format string to *note basicConfig():\n828. with the 'format' keyword argument.  For all options regarding how\na format string is constructed, see *note Formatter Objects: 29e0.\n\n* Menu:\n\n* Logging Flow::\n* Loggers::\n* Handlers::\n* Formatters::\n* Configuring Logging::\n* What happens if no configuration is provided::\n* Configuring Logging for a Library::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Logging Flow,  Next: Loggers,  Up: Advanced Logging Tutorial": {
            "content": "9.7.2.1 Logging Flow\n....................\n",
            "subsections": []
        },
        "The flow of log event information in loggers and handlers is illustrated": {
            "content": "in the following diagram.\n\n\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Loggers,  Next: Handlers,  Prev: Logging Flow,  Up: Advanced Logging Tutorial": {
            "content": "9.7.2.2 Loggers\n...............\n\n*note Logger: 98b. objects have a threefold job.  First, they expose\nseveral methods to application code so that applications can log\nmessages at runtime.  Second, logger objects determine which log\nmessages to act upon based upon severity (the default filtering\nfacility) or filter objects.  Third, logger objects pass along relevant\nlog messages to all interested log handlers.\n\nThe most widely used methods on logger objects fall into two categories:\nconfiguration and message sending.\n\nThese are the most common configuration methods:\n\n* *note Logger.setLevel(): 12e7. specifies the lowest-severity log\nmessage a logger will handle, where debug is the lowest built-in\nseverity level and critical is the highest built-in severity.  For\nexample, if the severity level is INFO, the logger will handle only\nINFO, WARNING, ERROR, and CRITICAL messages and will ignore DEBUG\nmessages.\n\n* *note Logger.addHandler(): 29bc. and *note Logger.removeHandler():\n29bd. add and remove handler objects from the logger object.\nHandlers are covered in more detail in *note Handlers: 4cf3.\n\n* *note Logger.addFilter(): 29c6. and *note Logger.removeFilter():\n29c7. add and remove filter objects from the logger object.\nFilters are covered in more detail in *note Filter Objects: 29eb.\n\nYou don't need to always call these methods on every logger you create.\nSee the last two paragraphs in this section.\n",
            "subsections": []
        },
        "With the logger object configured, the following methods create log": {
            "content": "messages:\n\n* *note Logger.debug(): c89, *note Logger.info(): 29c2, *note\nLogger.warning(): 29c4, *note Logger.error(): 29c5, and *note\nLogger.critical(): c88. all create log records with a message and a\nlevel that corresponds to their respective method names.  The\nmessage is actually a format string, which may contain the standard\nstring substitution syntax of '%s', '%d', '%f', and so on.  The\nrest of their arguments is a list of objects that correspond with\nthe substitution fields in the message.  With regard to 'kwargs',\nthe logging methods care only about a keyword of 'excinfo' and use\nit to determine whether to log exception information.\n\n* *note Logger.exception(): c87. creates a log message similar to\n*note Logger.error(): 29c5.  The difference is that *note\nLogger.exception(): c87. dumps a stack trace along with it.  Call\nthis method only from an exception handler.\n\n* *note Logger.log(): c86. takes a log level as an explicit argument.\nThis is a little more verbose for logging messages than using the\nlog level convenience methods listed above, but this is how to log\nat custom log levels.\n\n*note getLogger(): 781. returns a reference to a logger instance with\nthe specified name if it is provided, or 'root' if not.  The names are\nperiod-separated hierarchical structures.  Multiple calls to *note\ngetLogger(): 781. with the same name will return a reference to the same\nlogger object.  Loggers that are further down in the hierarchical list\nare children of loggers higher up in the list.  For example, given a\nlogger with a name of 'foo', loggers with names of 'foo.bar',\n'foo.bar.baz', and 'foo.bam' are all descendants of 'foo'.\n",
            "subsections": []
        },
        "Loggers have a concept of 'effective level'.  If a level is not": {
            "content": "explicitly set on a logger, the level of its parent is used instead as\nits effective level.  If the parent has no explicit level set, 'its'\nparent is examined, and so on - all ancestors are searched until an\nexplicitly set level is found.  The root logger always has an explicit\nlevel set ('WARNING' by default).  When deciding whether to process an\nevent, the effective level of the logger is used to determine whether\nthe event is passed to the logger's handlers.\n",
            "subsections": []
        },
        "Child loggers propagate messages up to the handlers associated with": {
            "content": "their ancestor loggers.  Because of this, it is unnecessary to define\nand configure handlers for all the loggers an application uses.  It is\nsufficient to configure handlers for a top-level logger and create child\nloggers as needed.  (You can, however, turn off propagation by setting\nthe 'propagate' attribute of a logger to 'False'.)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Handlers,  Next: Formatters,  Prev: Loggers,  Up: Advanced Logging Tutorial": {
            "content": "9.7.2.3 Handlers\n................\n\n*note Handler: 12eb. objects are responsible for dispatching the\nappropriate log messages (based on the log messages' severity) to the\nhandler's specified destination.  *note Logger: 98b. objects can add\nzero or more handler objects to themselves with an *note addHandler():\n29bc. method.  As an example scenario, an application may want to send\nall log messages to a log file, all log messages of error or higher to\nstdout, and all messages of critical to an email address.  This scenario\nrequires three individual handlers where each handler is responsible for\nsending messages of a specific severity to a specific location.\n\nThe standard library includes quite a few handler types (see *note\nUseful Handlers: 4cf5.); the tutorials use mainly *note StreamHandler:\n106c. and *note FileHandler: 1600. in its examples.\n",
            "subsections": []
        },
        "There are very few methods in a handler for application developers to": {
            "content": "concern themselves with.  The only handler methods that seem relevant\nfor application developers who are using the built-in handler objects\n(that is, not creating custom handlers) are the following configuration\nmethods:\n\n* The *note setLevel(): 29d4. method, just as in logger objects,\nspecifies the lowest severity that will be dispatched to the\nappropriate destination.  Why are there two *note setLevel(): 29d4.\nmethods?  The level set in the logger determines which severity of\nmessages it will pass to its handlers.  The level set in each\nhandler determines which messages that handler will send on.\n\n* *note setFormatter(): 29d5. selects a Formatter object for this\nhandler to use.\n\n* *note addFilter(): 29d6. and *note removeFilter(): 29d7.\nrespectively configure and deconfigure filter objects on handlers.\n",
            "subsections": []
        },
        "Application code should not directly instantiate and use instances of": {
            "content": "*note Handler: 12eb.  Instead, the *note Handler: 12eb. class is a base\nclass that defines the interface that all handlers should have and\nestablishes some default behavior that child classes can use (or\noverride).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Formatters,  Next: Configuring Logging,  Prev: Handlers,  Up: Advanced Logging Tutorial": {
            "content": "9.7.2.4 Formatters\n..................\n",
            "subsections": []
        },
        "Formatter objects configure the final order, structure, and contents of": {
            "content": "the log message.  Unlike the base *note logging.Handler: 12eb. class,\napplication code may instantiate formatter classes, although you could\nlikely subclass the formatter if your application needs special\nbehavior.  The constructor takes three optional arguments - a message\nformat string, a date format string and a style indicator.\n\n-- Method: logging.Formatter.init (fmt=None, datefmt=None,\nstyle='%')\n",
            "subsections": []
        },
        "If there is no message format string, the default is to use the raw": {
            "content": "message.  If there is no date format string, the default date format is:\n\n%Y-%m-%d %H:%M:%S\n\nwith the milliseconds tacked on at the end.  The 'style' is one of\n''%'', ''{'', or ''$''.  If one of these is not specified, then ''%''\nwill be used.\n\nIf the 'style' is ''%'', the message format string uses '%(<dictionary\nkey>)s' styled string substitution; the possible keys are documented in\n*note LogRecord attributes: 29c1.  If the style is ''{'', the message\nformat string is assumed to be compatible with *note str.format(): 3ed.\n(using keyword arguments), while if the style is ''$'' then the message\nformat string should conform to what is expected by *note\nstring.Template.substitute(): 1a6e.\n\nChanged in version 3.2: Added the 'style' parameter.\n",
            "subsections": []
        },
        "The following message format string will log the time in a": {
            "content": "human-readable format, the severity of the message, and the contents of\nthe message, in that order:\n\n'%(asctime)s - %(levelname)s - %(message)s'\n",
            "subsections": []
        },
        "Formatters use a user-configurable function to convert the creation time": {
            "content": "of a record to a tuple.  By default, *note time.localtime(): 1353. is\nused; to change this for a particular formatter instance, set the\n'converter' attribute of the instance to a function with the same\nsignature as *note time.localtime(): 1353. or *note time.gmtime(): 1034.",
            "subsections": []
        },
        "To change it for all formatters, for example if you want all logging": {
            "content": "times to be shown in GMT, set the 'converter' attribute in the Formatter\nclass (to 'time.gmtime' for GMT display).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Configuring Logging,  Next: What happens if no configuration is provided,  Prev: Formatters,  Up: Advanced Logging Tutorial": {
            "content": "9.7.2.5 Configuring Logging\n...........................\n\nProgrammers can configure logging in three ways:\n\n1. Creating loggers, handlers, and formatters explicitly using Python\ncode that calls the configuration methods listed above.\n\n2. Creating a logging config file and reading it using the *note\nfileConfig(): 98d. function.\n\n3. Creating a dictionary of configuration information and passing it\nto the *note dictConfig(): 1023. function.\n\nFor the reference documentation on the last two options, see *note",
            "subsections": []
        },
        "Configuration functions: 1166.  The following example configures a very": {
            "content": "simple logger, a console handler, and a simple formatter using Python\ncode:\n\nimport logging\n\n# create logger\nlogger = logging.getLogger('simpleexample')\nlogger.setLevel(logging.DEBUG)\n\n# create console handler and set level to debug\nch = logging.StreamHandler()\nch.setLevel(logging.DEBUG)\n\n# create formatter\nformatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n\n# add formatter to ch\nch.setFormatter(formatter)\n\n# add ch to logger\nlogger.addHandler(ch)\n\n# 'application' code\nlogger.debug('debug message')\nlogger.info('info message')\nlogger.warning('warn message')\nlogger.error('error message')\nlogger.critical('critical message')\n\nRunning this module from the command line produces the following output:\n\n$ python simpleloggingmodule.py\n2005-03-19 15:10:26,618 - simpleexample - DEBUG - debug message\n2005-03-19 15:10:26,620 - simpleexample - INFO - info message\n2005-03-19 15:10:26,695 - simpleexample - WARNING - warn message\n2005-03-19 15:10:26,697 - simpleexample - ERROR - error message\n2005-03-19 15:10:26,773 - simpleexample - CRITICAL - critical message\n",
            "subsections": []
        },
        "The following Python module creates a logger, handler, and formatter": {
            "content": "nearly identical to those in the example listed above, with the only\ndifference being the names of the objects:\n\nimport logging\nimport logging.config\n\nlogging.config.fileConfig('logging.conf')\n\n# create logger\nlogger = logging.getLogger('simpleExample')\n\n# 'application' code\nlogger.debug('debug message')\nlogger.info('info message')\nlogger.warning('warn message')\nlogger.error('error message')\nlogger.critical('critical message')\n\nHere is the logging.conf file:\n\n[loggers]\nkeys=root,simpleExample\n\n[handlers]\nkeys=consoleHandler\n\n[formatters]\nkeys=simpleFormatter\n\n[loggerroot]\nlevel=DEBUG\nhandlers=consoleHandler\n\n[loggersimpleExample]\nlevel=DEBUG\nhandlers=consoleHandler\nqualname=simpleExample\npropagate=0\n\n[handlerconsoleHandler]\nclass=StreamHandler\nlevel=DEBUG\nformatter=simpleFormatter\nargs=(sys.stdout,)\n\n[formattersimpleFormatter]\nformat=%(asctime)s - %(name)s - %(levelname)s - %(message)s\n",
            "subsections": []
        },
        "The output is nearly identical to that of the non-config-file-based": {
            "content": "example:\n\n$ python simpleloggingconfig.py\n2005-03-19 15:38:55,977 - simpleExample - DEBUG - debug message\n2005-03-19 15:38:55,979 - simpleExample - INFO - info message\n2005-03-19 15:38:56,054 - simpleExample - WARNING - warn message\n2005-03-19 15:38:56,055 - simpleExample - ERROR - error message\n2005-03-19 15:38:56,130 - simpleExample - CRITICAL - critical message\n",
            "subsections": []
        },
        "You can see that the config file approach has a few advantages over the": {
            "content": "",
            "subsections": []
        },
        "Python code approach, mainly separation of configuration and code and": {
            "content": "the ability of noncoders to easily modify the logging properties.\n\nWarning: The *note fileConfig(): 98d. function takes a default\nparameter, 'disableexistingloggers', which defaults to 'True' for\nreasons of backward compatibility.  This may or may not be what you\nwant, since it will cause any non-root loggers existing before the\n*note fileConfig(): 98d. call to be disabled unless they (or an\nancestor) are explicitly named in the configuration.  Please refer\nto the reference documentation for more information, and specify\n'False' for this parameter if you wish.\n\nThe dictionary passed to *note dictConfig(): 1023. can also specify\na Boolean value with key 'disableexistingloggers', which if not\nspecified explicitly in the dictionary also defaults to being\ninterpreted as 'True'.  This leads to the logger-disabling\nbehaviour described above, which may not be what you want - in\nwhich case, provide the key explicitly with a value of 'False'.\n",
            "subsections": []
        },
        "Note that the class names referenced in config files need to be either": {
            "content": "relative to the logging module, or absolute values which can be resolved\nusing normal import mechanisms.  Thus, you could use either *note",
            "subsections": []
        },
        "WatchedFileHandler: 2a3f. (relative to the logging module) or": {
            "content": "'mypackage.mymodule.MyHandler' (for a class defined in package\n'mypackage' and module 'mymodule', where 'mypackage' is available on the\nPython import path).\n",
            "subsections": []
        },
        "In Python 3.2, a new means of configuring logging has been introduced,": {
            "content": "using dictionaries to hold configuration information.  This provides a\nsuperset of the functionality of the config-file-based approach outlined\nabove, and is the recommended configuration method for new applications\nand deployments.  Because a Python dictionary is used to hold\nconfiguration information, and since you can populate that dictionary\nusing different means, you have more options for configuration.  For\nexample, you can use a configuration file in JSON format, or, if you\nhave access to YAML processing functionality, a file in YAML format, to\npopulate the configuration dictionary.  Or, of course, you can construct\nthe dictionary in Python code, receive it in pickled form over a socket,\nor use whatever approach makes sense for your application.\n",
            "subsections": []
        },
        "Here's an example of the same configuration as above, in YAML format for": {
            "content": "the new dictionary-based approach:\n\nversion: 1\nformatters:\nsimple:\nformat: '%(asctime)s - %(name)s - %(levelname)s - %(message)s'\nhandlers:\nconsole:\nclass: logging.StreamHandler\nlevel: DEBUG\nformatter: simple\nstream: ext://sys.stdout\nloggers:\nsimpleExample:\nlevel: DEBUG\nhandlers: [console]\npropagate: no\nroot:\nlevel: DEBUG\nhandlers: [console]\n\nFor more information about logging using a dictionary, see *note\nConfiguration functions: 1166.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: What happens if no configuration is provided,  Next: Configuring Logging for a Library,  Prev: Configuring Logging,  Up: Advanced Logging Tutorial": {
            "content": "9.7.2.6 What happens if no configuration is provided\n....................................................\n",
            "subsections": []
        },
        "If no logging configuration is provided, it is possible to have a": {
            "content": "situation where a logging event needs to be output, but no handlers can\nbe found to output the event.\n\nThe event is output using a 'handler of last resort', stored in *note\nlastResort: 106e.  This internal handler is not associated with any\nlogger, and acts like a *note StreamHandler: 106c. which writes the\nevent description message to the current value of 'sys.stderr'\n(therefore respecting any redirections which may be in effect).  No\nformatting is done on the message - just the bare event description\nmessage is printed.  The handler's level is set to 'WARNING', so all\nevents at this and greater severities will be output.\n",
            "subsections": []
        },
        "Changed in version 3.2: For versions of Python prior to 3.2, the": {
            "content": "behaviour is as follows:\n\n* If *note raiseExceptions: 106d. is 'False' (production mode), the\nevent is silently dropped.\n\n* If *note raiseExceptions: 106d. is 'True' (development mode), a\nmessage 'No handlers could be found for logger X.Y.Z' is printed\nonce.\n\nTo obtain the pre-3.2 behaviour, *note lastResort: 106e. can be set to\n'None'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Configuring Logging for a Library,  Prev: What happens if no configuration is provided,  Up: Advanced Logging Tutorial": {
            "content": "9.7.2.7 Configuring Logging for a Library\n.........................................\n",
            "subsections": []
        },
        "When developing a library which uses logging, you should take care to": {
            "content": "document how the library uses logging - for example, the names of\nloggers used.  Some consideration also needs to be given to its logging\nconfiguration.  If the using application does not use logging, and\nlibrary code makes logging calls, then (as described in the previous\nsection) events of severity 'WARNING' and greater will be printed to\n'sys.stderr'.  This is regarded as the best default behaviour.\n",
            "subsections": []
        },
        "If for some reason you 'don't' want these messages printed in the": {
            "content": "absence of any logging configuration, you can attach a do-nothing\nhandler to the top-level logger for your library.  This avoids the\nmessage being printed, since a handler will always be found for the\nlibrary's events: it just doesn't produce any output.  If the library\nuser configures logging for application use, presumably that\nconfiguration will add some handlers, and if levels are suitably\nconfigured then logging calls made in library code will send output to\nthose handlers, as normal.\n\nA do-nothing handler is included in the logging package: *note",
            "subsections": []
        },
        "NullHandler: 10fd. (since Python 3.1).  An instance of this handler": {
            "content": "could be added to the top-level logger of the logging namespace used by\nthe library ('if' you want to prevent your library's logged events being\noutput to 'sys.stderr' in the absence of logging configuration).  If all\nlogging by a library 'foo' is done using loggers with names matching\n'foo.x', 'foo.x.y', etc.  then the code:\n\nimport logging\nlogging.getLogger('foo').addHandler(logging.NullHandler())\n\nshould have the desired effect.  If an organisation produces a number of\nlibraries, then the logger name specified can be 'orgname.foo' rather\nthan just 'foo'.\n\nNote: It is strongly advised that you 'do not log to the root\nlogger' in your library.  Instead, use a logger with a unique and\neasily identifiable name, such as the 'name' for your library's\ntop-level package or module.  Logging to the root logger will make\nit difficult or impossible for the application developer to\nconfigure the logging verbosity or handlers of your library as they\nwish.\n\nNote: It is strongly advised that you 'do not add any handlers\nother than' *note NullHandler: 10fd. 'to your library's loggers'.\nThis is because the configuration of handlers is the prerogative of\nthe application developer who uses your library.  The application\ndeveloper knows their target audience and what handlers are most\nappropriate for their application: if you add handlers 'under the\nhood', you might well interfere with their ability to carry out\nunit tests and deliver logs which suit their requirements.\n\nFile: python3.12.info,  Node: Logging Levels<2>,  Next: Useful Handlers,  Prev: Advanced Logging Tutorial,  Up: Logging HOWTO\n\n\nThe numeric values of logging levels are given in the following table.",
            "subsections": []
        },
        "Level              Numeric value": {
            "content": "---------------------------------------\n\n'CRITICAL'         50\n\n\n'ERROR'            40\n\n\n'WARNING'          30\n\n\n'INFO'             20\n\n\n'DEBUG'            10\n\n\n'NOTSET'           0\n\n",
            "subsections": []
        },
        "Levels can also be associated with loggers, being set either by the": {
            "content": "developer or through loading a saved logging configuration.  When a\nlogging method is called on a logger, the logger compares its own level\nwith the level associated with the method call.  If the logger's level\nis higher than the method call's, no logging message is actually\ngenerated.  This is the basic mechanism controlling the verbosity of\nlogging output.\n\nLogging messages are encoded as instances of the *note LogRecord: e59.\nclass.  When a logger decides to actually log an event, a *note\nLogRecord: e59. instance is created from the logging message.\n",
            "subsections": []
        },
        "Logging messages are subjected to a dispatch mechanism through the use": {
            "content": "of 'handlers', which are instances of subclasses of the *note Handler:\n12eb. class.  Handlers are responsible for ensuring that a logged\nmessage (in the form of a *note LogRecord: e59.) ends up in a particular\nlocation (or set of locations) which is useful for the target audience\nfor that message (such as end users, support desk staff, system\nadministrators, developers).  Handlers are passed *note LogRecord: e59.\ninstances intended for particular destinations.  Each logger can have\nzero, one or more handlers associated with it (via the *note\naddHandler(): 29bc. method of *note Logger: 98b.).  In addition to any\nhandlers directly associated with a logger, 'all handlers associated\nwith all ancestors of the logger' are called to dispatch the message\n(unless the 'propagate' flag for a logger is set to a false value, at\nwhich point the passing to ancestor handlers stops).\n",
            "subsections": []
        },
        "Just as for loggers, handlers can have levels associated with them.  A": {
            "content": "handler's level acts as a filter in the same way as a logger's level\ndoes.  If a handler decides to actually dispatch an event, the *note\nemit(): 29de. method is used to send the message to its destination.\nMost user-defined subclasses of *note Handler: 12eb. will need to\noverride this *note emit(): 29de.\n\n* Menu:\n\n* Custom Levels::\n\nFile: python3.12.info,  Node: Custom Levels,  Up: Logging Levels<2>\n\n9.7.3.1 Custom Levels\n.....................\n",
            "subsections": []
        },
        "Defining your own levels is possible, but should not be necessary, as": {
            "content": "the existing levels have been chosen on the basis of practical\nexperience.  However, if you are convinced that you need custom levels,\ngreat care should be exercised when doing this, and it is possibly 'a\nvery bad idea to define custom levels if you are developing a library'.",
            "subsections": []
        },
        "That's because if multiple library authors all define their own custom": {
            "content": "levels, there is a chance that the logging output from such multiple\nlibraries used together will be difficult for the using developer to\ncontrol and/or interpret, because a given numeric value might mean\ndifferent things for different libraries.\n\nFile: python3.12.info,  Node: Useful Handlers,  Next: Exceptions raised during logging,  Prev: Logging Levels<2>,  Up: Logging HOWTO\n\n\nIn addition to the base *note Handler: 12eb. class, many useful\nsubclasses are provided:\n\n1. *note StreamHandler: 106c. instances send messages to streams\n(file-like objects).\n\n2. *note FileHandler: 1600. instances send messages to disk files.\n\n3. *note BaseRotatingHandler: 2a43. is the base class for handlers\nthat rotate log files at a certain point.  It is not meant to be\ninstantiated directly.  Instead, use *note RotatingFileHandler:\n2a1a. or *note TimedRotatingFileHandler: dd1.\n\n4. *note RotatingFileHandler: 2a1a. instances send messages to disk\nfiles, with support for maximum log file sizes and log file\nrotation.\n\n5. *note TimedRotatingFileHandler: dd1. instances send messages to\ndisk files, rotating the log file at certain timed intervals.\n\n6. *note SocketHandler: dd2. instances send messages to TCP/IP\nsockets.  Since 3.4, Unix domain sockets are also supported.\n\n7. *note DatagramHandler: dd3. instances send messages to UDP sockets.\nSince 3.4, Unix domain sockets are also supported.\n\n8. *note SMTPHandler: 2a6f. instances send messages to a designated\nemail address.\n\n9. *note SysLogHandler: 426. instances send messages to a Unix syslog\ndaemon, possibly on a remote machine.\n\n10. *note NTEventLogHandler: 2a67. instances send messages to a\nWindows NT/2000/XP event log.\n\n11. *note MemoryHandler: 2a25. instances send messages to a buffer in\nmemory, which is flushed whenever specific criteria are met.\n\n12. *note HTTPHandler: c8a. instances send messages to an HTTP server\nusing either 'GET' or 'POST' semantics.\n\n13. *note WatchedFileHandler: 2a3f. instances watch the file they are\nlogging to.  If the file changes, it is closed and reopened using\nthe file name.  This handler is only useful on Unix-like systems;\nWindows does not support the underlying mechanism used.\n\n14. *note QueueHandler: 1534. instances send messages to a queue, such\nas those implemented in the *note queue: b1. or *note\nmultiprocessing: 8f. modules.\n\n15. *note NullHandler: 10fd. instances do nothing with error messages.\nThey are used by library developers who want to use logging, but\nwant to avoid the 'No handlers could be found for logger 'XXX''\nmessage which can be displayed if the library user has not\nconfigured logging.  See *note Configuring Logging for a Library:\n2a3c. for more information.\n\nNew in version 3.1: The *note NullHandler: 10fd. class.\n\nNew in version 3.2: The *note QueueHandler: 1534. class.\n\nThe *note NullHandler: 10fd, *note StreamHandler: 106c. and *note",
            "subsections": []
        },
        "FileHandler: 1600. classes are defined in the core logging package.  The": {
            "content": "other handlers are defined in a sub-module, *note logging.handlers: 84.\n(There is also another sub-module, *note logging.config: 83, for\nconfiguration functionality.)\n",
            "subsections": []
        },
        "Logged messages are formatted for presentation through instances of the": {
            "content": "*note Formatter: 12ec. class.  They are initialized with a format string\nsuitable for use with the % operator and a dictionary.\n\nFor formatting multiple messages in a batch, instances of *note",
            "subsections": []
        },
        "BufferingFormatter: 29e7. can be used.  In addition to the format string": {
            "content": "(which is applied to each message in the batch), there is provision for\nheader and trailer format strings.\n",
            "subsections": []
        },
        "When filtering based on logger level and/or handler level is not enough,": {
            "content": "instances of *note Filter: 106f. can be added to both *note Logger: 98b.\nand *note Handler: 12eb. instances (through their *note addFilter():\n29d6. method).  Before deciding to process a message further, both\nloggers and handlers consult all their filters for permission.  If any\nfilter returns a false value, the message is not processed further.\n\nThe basic *note Filter: 106f. functionality allows filtering by specific\nlogger name.  If this feature is used, messages sent to the named logger\nand its children are allowed through the filter, and all others dropped.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Exceptions raised during logging,  Next: Using arbitrary objects as messages,  Prev: Useful Handlers,  Up: Logging HOWTO": {
            "content": "",
            "subsections": []
        },
        "The logging package is designed to swallow exceptions which occur while": {
            "content": "logging in production.  This is so that errors which occur while\nhandling logging events - such as logging misconfiguration, network or\nother similar errors - do not cause the application using logging to\nterminate prematurely.\n\n*note SystemExit: b97. and *note KeyboardInterrupt: 7f5. exceptions are\nnever swallowed.  Other exceptions which occur during the *note emit():\n29de. method of a *note Handler: 12eb. subclass are passed to its *note\nhandleError(): 29dd. method.\n\nThe default implementation of *note handleError(): 29dd. in *note\nHandler: 12eb. checks to see if a module-level variable, *note\nraiseExceptions: 106d, is set.  If set, a traceback is printed to *note\nsys.stderr: 757.  If not set, the exception is swallowed.\n\nNote: The default value of *note raiseExceptions: 106d. is 'True'.\nThis is because during development, you typically want to be\nnotified of any exceptions that occur.  It's advised that you set\n*note raiseExceptions: 106d. to 'False' for production usage.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using arbitrary objects as messages,  Next: Optimization,  Prev: Exceptions raised during logging,  Up: Logging HOWTO": {
            "content": "",
            "subsections": []
        },
        "In the preceding sections and examples, it has been assumed that the": {
            "content": "message passed when logging the event is a string.  However, this is not\nthe only possibility.  You can pass an arbitrary object as a message,\nand its *note str(): 3e9. method will be called when the logging\nsystem needs to convert it to a string representation.  In fact, if you\nwant to, you can avoid computing a string representation altogether -\nfor example, the *note SocketHandler: dd2. emits an event by pickling it\nand sending it over the wire.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Optimization,  Next: Other resources,  Prev: Using arbitrary objects as messages,  Up: Logging HOWTO": {
            "content": "Formatting of message arguments is deferred until it cannot be avoided.",
            "subsections": []
        },
        "However, computing the arguments passed to the logging method can also": {
            "content": "be expensive, and you may want to avoid doing it if the logger will just\nthrow away your event.  To decide what to do, you can call the *note\nisEnabledFor(): 116b. method which takes a level argument and returns\ntrue if the event would be created by the Logger for that level of call.\nYou can write code like this:\n\nif logger.isEnabledFor(logging.DEBUG):\nlogger.debug('Message with %s, %s', expensivefunc1(),\nexpensivefunc2())\n\nso that if the logger's threshold is set above 'DEBUG', the calls to\n'expensivefunc1' and 'expensivefunc2' are never made.\n\nNote: In some cases, *note isEnabledFor(): 116b. can itself be more\nexpensive than you'd like (e.g.  for deeply nested loggers where an\nexplicit level is only set high up in the logger hierarchy).  In\nsuch cases (or if you want to avoid calling a method in tight\nloops), you can cache the result of a call to *note isEnabledFor():\n116b. in a local or instance variable, and use that instead of\ncalling the method each time.  Such a cached value would only need\nto be recomputed when the logging configuration changes dynamically\nwhile the application is running (which is not all that common).\n",
            "subsections": []
        },
        "There are other optimizations which can be made for specific": {
            "content": "applications which need more precise control over what logging\ninformation is collected.  Here's a list of things you can do to avoid\nprocessing during logging which you don't need:\n",
            "subsections": []
        },
        "What you don't want to collect                            How to avoid collecting it": {
            "content": "------------------------------------------------------------------------------------------------------------------\n",
            "subsections": []
        },
        "Information about where calls were made from.             Set 'logging.srcfile' to 'None'.  This avoids": {
            "content": "calling *note sys.getframe(): 4b0, which may help to\nspeed up your code in environments like PyPy (which\ncan't speed up code that uses\n*note sys.getframe(): 4b0.).\n\n\nThreading information.                                    Set 'logging.logThreads' to 'False'.\n\n\nCurrent process ID (*note os.getpid(): 27f5.)             Set 'logging.logProcesses' to 'False'.\n\n\nCurrent process name when using 'multiprocessing' to      Set 'logging.logMultiprocessing' to 'False'.\nmanage multiple processes.\n\nCurrent *note asyncio.Task: 201. name when using          Set 'logging.logAsyncioTasks' to 'False'.\n'asyncio'.\n\nAlso note that the core logging module only includes the basic handlers.\nIf you don't import *note logging.handlers: 84. and *note\nlogging.config: 83, they won't take up any memory.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Other resources,  Prev: Optimization,  Up: Logging HOWTO": {
            "content": "See also\n........\n\nModule *note logging: 82.\n\nAPI reference for the logging module.\n\nModule *note logging.config: 83.\n\nConfiguration API for the logging module.\n\nModule *note logging.handlers: 84.\n\nUseful handlers included with the logging module.\n\n*note A logging cookbook: 106b.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Logging Cookbook,  Next: Regular Expression HOWTO,  Prev: Logging HOWTO,  Up: Python HOWTOs": {
            "content": "",
            "subsections": [
                {
                    "name": "9.8 Logging Cookbook",
                    "content": "Author: Vinay Sajip <vinaysajip at red-dove dot com>\n"
                }
            ]
        },
        "This page contains a number of recipes related to logging, which have": {
            "content": "been found useful in the past.  For links to tutorial and reference\ninformation, please see *note Other resources: 4d05.\n\n* Menu:\n\n* Using logging in multiple modules::\n* Logging from multiple threads::\n* Multiple handlers and formatters::\n* Logging to multiple destinations::\n* Custom handling of levels::\n* Configuration server example::\n* Dealing with handlers that block::\n* Sending and receiving logging events across a network::\n* Adding contextual information to your logging output::\n* Use of contextvars::\n* Imparting contextual information in handlers::\n* Logging to a single file from multiple processes::\n* Using file rotation::\n* Use of alternative formatting styles::\n* Customizing LogRecord::\n* Subclassing QueueHandler and QueueListener- a ZeroMQ example::\n* Subclassing QueueHandler and QueueListener- a pynng example::\n* An example dictionary-based configuration::\n* Using a rotator and namer to customize log rotation processing::\n* A more elaborate multiprocessing example::\n* Inserting a BOM into messages sent to a SysLogHandler::\n* Implementing structured logging::\n* Customizing handlers with dictConfig(): Customizing handlers with dictConfig.\n* Using particular formatting styles throughout your application::\n* Configuring filters with dictConfig(): Configuring filters with dictConfig.\n* Customized exception formatting::\n* Speaking logging messages::\n* Buffering logging messages and outputting them conditionally::\n* Sending logging messages to email, with buffering: Sending logging messages to email with buffering.\n* Formatting times using UTC (GMT) via configuration: Formatting times using UTC GMT via configuration.\n* Using a context manager for selective logging::\n* A CLI application starter template::\n* A Qt GUI for logging::\n* Logging to syslog with RFC5424 support::\n* How to treat a logger like an output stream::\n* Patterns to avoid::\n* Other resources: Other resources<2>.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using logging in multiple modules,  Next: Logging from multiple threads,  Up: Logging Cookbook": {
            "content": "",
            "subsections": []
        },
        "Multiple calls to 'logging.getLogger('someLogger')' return a reference": {
            "content": "to the same logger object.  This is true not only within the same\nmodule, but also across modules as long as it is in the same Python\ninterpreter process.  It is true for references to the same object;\nadditionally, application code can define and configure a parent logger\nin one module and create (but not configure) a child logger in a\nseparate module, and all logger calls to the child will pass up to the\nparent.  Here is a main module:\n\nimport logging\nimport auxiliarymodule\n\n# create logger with 'spamapplication'\nlogger = logging.getLogger('spamapplication')\nlogger.setLevel(logging.DEBUG)\n# create file handler which logs even debug messages\nfh = logging.FileHandler('spam.log')\nfh.setLevel(logging.DEBUG)\n# create console handler with a higher log level\nch = logging.StreamHandler()\nch.setLevel(logging.ERROR)\n# create formatter and add it to the handlers\nformatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')\nfh.setFormatter(formatter)\nch.setFormatter(formatter)\n# add the handlers to the logger\nlogger.addHandler(fh)\nlogger.addHandler(ch)\n\nlogger.info('creating an instance of auxiliarymodule.Auxiliary')\na = auxiliarymodule.Auxiliary()\nlogger.info('created an instance of auxiliarymodule.Auxiliary')\nlogger.info('calling auxiliarymodule.Auxiliary.dosomething')\na.dosomething()\nlogger.info('finished auxiliarymodule.Auxiliary.dosomething')\nlogger.info('calling auxiliarymodule.somefunction()')\nauxiliarymodule.somefunction()\nlogger.info('done with auxiliarymodule.somefunction()')\n\nHere is the auxiliary module:\n\nimport logging\n\n# create logger\nmodulelogger = logging.getLogger('spamapplication.auxiliary')\n\nclass Auxiliary:\ndef init(self):\nself.logger = logging.getLogger('spamapplication.auxiliary.Auxiliary')\nself.logger.info('creating an instance of Auxiliary')\n\ndef dosomething(self):\nself.logger.info('doing something')\na = 1 + 1\nself.logger.info('done doing something')\n\ndef somefunction():\nmodulelogger.info('received a call to \"somefunction\"')\n\nThe output looks like this:\n\n2005-03-23 23:47:11,663 - spamapplication - INFO -\ncreating an instance of auxiliarymodule.Auxiliary\n2005-03-23 23:47:11,665 - spamapplication.auxiliary.Auxiliary - INFO -\ncreating an instance of Auxiliary\n2005-03-23 23:47:11,665 - spamapplication - INFO -\ncreated an instance of auxiliarymodule.Auxiliary\n2005-03-23 23:47:11,668 - spamapplication - INFO -\ncalling auxiliarymodule.Auxiliary.dosomething\n2005-03-23 23:47:11,668 - spamapplication.auxiliary.Auxiliary - INFO -\ndoing something\n2005-03-23 23:47:11,669 - spamapplication.auxiliary.Auxiliary - INFO -\ndone doing something\n2005-03-23 23:47:11,670 - spamapplication - INFO -\nfinished auxiliarymodule.Auxiliary.dosomething\n2005-03-23 23:47:11,671 - spamapplication - INFO -\ncalling auxiliarymodule.somefunction()\n2005-03-23 23:47:11,672 - spamapplication.auxiliary - INFO -\nreceived a call to 'somefunction'\n2005-03-23 23:47:11,673 - spamapplication - INFO -\ndone with auxiliarymodule.somefunction()\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Logging from multiple threads,  Next: Multiple handlers and formatters,  Prev: Using logging in multiple modules,  Up: Logging Cookbook": {
            "content": "",
            "subsections": []
        },
        "Logging from multiple threads requires no special effort.  The following": {
            "content": "example shows logging from the main (initial) thread and another thread:\n\nimport logging\nimport threading\nimport time\n\ndef worker(arg):\nwhile not arg['stop']:\nlogging.debug('Hi from myfunc')\ntime.sleep(0.5)\n\ndef main():\nlogging.basicConfig(level=logging.DEBUG, format='%(relativeCreated)6d %(threadName)s %(message)s')\ninfo = {'stop': False}\nthread = threading.Thread(target=worker, args=(info,))\nthread.start()\nwhile True:\ntry:\nlogging.debug('Hello from main')\ntime.sleep(0.75)\nexcept KeyboardInterrupt:\ninfo['stop'] = True\nbreak\nthread.join()\n\nif name == 'main':\nmain()\n\nWhen run, the script should print something like the following:\n\n0 Thread-1 Hi from myfunc\n3 MainThread Hello from main\n505 Thread-1 Hi from myfunc\n755 MainThread Hello from main\n1007 Thread-1 Hi from myfunc\n1507 MainThread Hello from main\n1508 Thread-1 Hi from myfunc\n2010 Thread-1 Hi from myfunc\n2258 MainThread Hello from main\n2512 Thread-1 Hi from myfunc\n3009 MainThread Hello from main\n3013 Thread-1 Hi from myfunc\n3515 Thread-1 Hi from myfunc\n3761 MainThread Hello from main\n4017 Thread-1 Hi from myfunc\n4513 MainThread Hello from main\n4518 Thread-1 Hi from myfunc\n",
            "subsections": []
        },
        "This shows the logging output interspersed as one might expect.  This": {
            "content": "approach works for more threads than shown here, of course.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Multiple handlers and formatters,  Next: Logging to multiple destinations,  Prev: Logging from multiple threads,  Up: Logging Cookbook": {
            "content": "Loggers are plain Python objects.  The *note addHandler(): 29bc. method\nhas no minimum or maximum quota for the number of handlers you may add.",
            "subsections": []
        },
        "Sometimes it will be beneficial for an application to log all messages": {
            "content": "of all severities to a text file while simultaneously logging errors or\nabove to the console.  To set this up, simply configure the appropriate\nhandlers.  The logging calls in the application code will remain\nunchanged.  Here is a slight modification to the previous simple\nmodule-based configuration example:\n\nimport logging\n\nlogger = logging.getLogger('simpleexample')\nlogger.setLevel(logging.DEBUG)\n# create file handler which logs even debug messages\nfh = logging.FileHandler('spam.log')\nfh.setLevel(logging.DEBUG)\n# create console handler with a higher log level\nch = logging.StreamHandler()\nch.setLevel(logging.ERROR)\n# create formatter and add it to the handlers\nformatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')\nch.setFormatter(formatter)\nfh.setFormatter(formatter)\n# add the handlers to logger\nlogger.addHandler(ch)\nlogger.addHandler(fh)\n\n# 'application' code\nlogger.debug('debug message')\nlogger.info('info message')\nlogger.warning('warn message')\nlogger.error('error message')\nlogger.critical('critical message')\n",
            "subsections": []
        },
        "Notice that the 'application' code does not care about multiple": {
            "content": "handlers.  All that changed was the addition and configuration of a new\nhandler named 'fh'.\n",
            "subsections": []
        },
        "The ability to create new handlers with higher- or lower-severity": {
            "content": "filters can be very helpful when writing and testing an application.",
            "subsections": []
        },
        "Instead of using many 'print' statements for debugging, use": {
            "content": "'logger.debug': Unlike the print statements, which you will have to\ndelete or comment out later, the logger.debug statements can remain\nintact in the source code and remain dormant until you need them again.",
            "subsections": []
        },
        "At that time, the only change that needs to happen is to modify the": {
            "content": "severity level of the logger and/or handler to debug.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Logging to multiple destinations,  Next: Custom handling of levels,  Prev: Multiple handlers and formatters,  Up: Logging Cookbook": {
            "content": "",
            "subsections": []
        },
        "Let's say you want to log to console and file with different message": {
            "content": "formats and in differing circumstances.  Say you want to log messages\nwith levels of DEBUG and higher to file, and those messages at level\nINFO and higher to the console.  Let's also assume that the file should\ncontain timestamps, but the console messages should not.  Here's how you\ncan achieve this:\n\nimport logging\n\n# set up logging to file - see previous section for more details\nlogging.basicConfig(level=logging.DEBUG,\nformat='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',\ndatefmt='%m-%d %H:%M',\nfilename='/tmp/myapp.log',\nfilemode='w')\n# define a Handler which writes INFO messages or higher to the sys.stderr\nconsole = logging.StreamHandler()\nconsole.setLevel(logging.INFO)\n# set a format which is simpler for console use\nformatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s')\n# tell the handler to use this format\nconsole.setFormatter(formatter)\n# add the handler to the root logger\nlogging.getLogger('').addHandler(console)\n\n# Now, we can log to the root logger, or any other logger. First the root...\nlogging.info('Jackdaws love my big sphinx of quartz.')\n\n# Now, define a couple of other loggers which might represent areas in your\n# application:\n\nlogger1 = logging.getLogger('myapp.area1')\nlogger2 = logging.getLogger('myapp.area2')\n\nlogger1.debug('Quick zephyrs blow, vexing daft Jim.')\nlogger1.info('How quickly daft jumping zebras vex.')\nlogger2.warning('Jail zesty vixen who grabbed pay from quack.')\nlogger2.error('The five boxing wizards jump quickly.')\n",
            "subsections": []
        },
        "When you run this, on the console you will see": {
            "content": "root        : INFO     Jackdaws love my big sphinx of quartz.\nmyapp.area1 : INFO     How quickly daft jumping zebras vex.\nmyapp.area2 : WARNING  Jail zesty vixen who grabbed pay from quack.\nmyapp.area2 : ERROR    The five boxing wizards jump quickly.\n\nand in the file you will see something like\n\n10-22 22:19 root         INFO     Jackdaws love my big sphinx of quartz.\n10-22 22:19 myapp.area1  DEBUG    Quick zephyrs blow, vexing daft Jim.\n10-22 22:19 myapp.area1  INFO     How quickly daft jumping zebras vex.\n10-22 22:19 myapp.area2  WARNING  Jail zesty vixen who grabbed pay from quack.\n10-22 22:19 myapp.area2  ERROR    The five boxing wizards jump quickly.\n",
            "subsections": []
        },
        "As you can see, the DEBUG message only shows up in the file.  The other": {
            "content": "messages are sent to both destinations.\n",
            "subsections": []
        },
        "This example uses console and file handlers, but you can use any number": {
            "content": "and combination of handlers you choose.\n",
            "subsections": []
        },
        "Note that the above choice of log filename '/tmp/myapp.log' implies use": {
            "content": "of a standard location for temporary files on POSIX systems.  On",
            "subsections": []
        },
        "Windows, you may need to choose a different directory name for the log -": {
            "content": "just ensure that the directory exists and that you have the permissions\nto create and update files in it.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Custom handling of levels,  Next: Configuration server example,  Prev: Logging to multiple destinations,  Up: Logging Cookbook": {
            "content": "",
            "subsections": []
        },
        "Sometimes, you might want to do something slightly different from the": {
            "content": "standard handling of levels in handlers, where all levels above a\nthreshold get processed by a handler.  To do this, you need to use\nfilters.  Let's look at a scenario where you want to arrange things as\nfollows:\n\n* Send messages of severity 'INFO' and 'WARNING' to 'sys.stdout'\n\n* Send messages of severity 'ERROR' and above to 'sys.stderr'\n\n* Send messages of severity 'DEBUG' and above to file 'app.log'\n\nSuppose you configure logging with the following JSON:\n\n{\n\"version\": 1,\n\"disableexistingloggers\": false,\n\"formatters\": {\n\"simple\": {\n\"format\": \"%(levelname)-8s - %(message)s\"\n}\n},\n\"handlers\": {\n\"stdout\": {\n\"class\": \"logging.StreamHandler\",\n\"level\": \"INFO\",\n\"formatter\": \"simple\",\n\"stream\": \"ext://sys.stdout\"\n},\n\"stderr\": {\n\"class\": \"logging.StreamHandler\",\n\"level\": \"ERROR\",\n\"formatter\": \"simple\",\n\"stream\": \"ext://sys.stderr\"\n},\n\"file\": {\n\"class\": \"logging.FileHandler\",\n\"formatter\": \"simple\",\n\"filename\": \"app.log\",\n\"mode\": \"w\"\n}\n},\n\"root\": {\n\"level\": \"DEBUG\",\n\"handlers\": [\n\"stderr\",\n\"stdout\",\n\"file\"\n]\n}\n}\n",
            "subsections": []
        },
        "This configuration does 'almost' what we want, except that 'sys.stdout'": {
            "content": "would show messages of severity 'ERROR' and above as well as 'INFO' and\n'WARNING' messages.  To prevent this, we can set up a filter which\nexcludes those messages and add it to the relevant handler.  This can be\nconfigured by adding a 'filters' section parallel to 'formatters' and\n'handlers':\n\n{\n\"filters\": {\n\"warningsandbelow\": {\n\"()\" : \"main.filtermaker\",\n\"level\": \"WARNING\"\n}\n}\n}\n\nand changing the section on the 'stdout' handler to add it:\n\n{\n\"stdout\": {\n\"class\": \"logging.StreamHandler\",\n\"level\": \"INFO\",\n\"formatter\": \"simple\",\n\"stream\": \"ext://sys.stdout\",\n\"filters\": [\"warningsandbelow\"]\n}\n}\n\nA filter is just a function, so we can define the 'filtermaker' (a\nfactory function) as follows:\n\ndef filtermaker(level):\nlevel = getattr(logging, level)\n\ndef filter(record):\nreturn record.levelno <= level\n\nreturn filter\n",
            "subsections": []
        },
        "This converts the string argument passed in to a numeric level, and": {
            "content": "returns a function which only returns 'True' if the level of the passed\nin record is at or below the specified level.  Note that in this example\nI have defined the 'filtermaker' in a test script 'main.py' that I run\nfrom the command line, so its module will be 'main' - hence the\n'main.filtermaker' in the filter configuration.  You will need to\nchange that if you define it in a different module.\n\nWith the filter added, we can run 'main.py', which in full is:\n\nimport json\nimport logging\nimport logging.config\n\nCONFIG = '''\n{\n\"version\": 1,\n\"disableexistingloggers\": false,\n\"formatters\": {\n\"simple\": {\n\"format\": \"%(levelname)-8s - %(message)s\"\n}\n},\n\"filters\": {\n\"warningsandbelow\": {\n\"()\" : \"main.filtermaker\",\n\"level\": \"WARNING\"\n}\n},\n\"handlers\": {\n\"stdout\": {\n\"class\": \"logging.StreamHandler\",\n\"level\": \"INFO\",\n\"formatter\": \"simple\",\n\"stream\": \"ext://sys.stdout\",\n\"filters\": [\"warningsandbelow\"]\n},\n\"stderr\": {\n\"class\": \"logging.StreamHandler\",\n\"level\": \"ERROR\",\n\"formatter\": \"simple\",\n\"stream\": \"ext://sys.stderr\"\n},\n\"file\": {\n\"class\": \"logging.FileHandler\",\n\"formatter\": \"simple\",\n\"filename\": \"app.log\",\n\"mode\": \"w\"\n}\n},\n\"root\": {\n\"level\": \"DEBUG\",\n\"handlers\": [\n\"stderr\",\n\"stdout\",\n\"file\"\n]\n}\n}\n'''\n\ndef filtermaker(level):\nlevel = getattr(logging, level)\n\ndef filter(record):\nreturn record.levelno <= level\n\nreturn filter\n\nlogging.config.dictConfig(json.loads(CONFIG))\nlogging.debug('A DEBUG message')\nlogging.info('An INFO message')\nlogging.warning('A WARNING message')\nlogging.error('An ERROR message')\nlogging.critical('A CRITICAL message')\n\nAnd after running it like this:\n\npython main.py 2>stderr.log >stdout.log\n\nWe can see the results are as expected:\n\n$ more *.log\n::::::::::::::\napp.log\n::::::::::::::\nDEBUG    - A DEBUG message\nINFO     - An INFO message\nWARNING  - A WARNING message\nERROR    - An ERROR message\nCRITICAL - A CRITICAL message\n::::::::::::::\nstderr.log\n::::::::::::::\nERROR    - An ERROR message\nCRITICAL - A CRITICAL message\n::::::::::::::\nstdout.log\n::::::::::::::\nINFO     - An INFO message\nWARNING  - A WARNING message\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Configuration server example,  Next: Dealing with handlers that block,  Prev: Custom handling of levels,  Up: Logging Cookbook": {
            "content": "Here is an example of a module using the logging configuration server:\n\nimport logging\nimport logging.config\nimport time\nimport os\n\n# read initial config file\nlogging.config.fileConfig('logging.conf')\n\n# create and start listener on port 9999\nt = logging.config.listen(9999)\nt.start()\n\nlogger = logging.getLogger('simpleExample')\n\ntry:\n# loop through logging calls to see the difference\n# new configurations make, until Ctrl+C is pressed\nwhile True:\nlogger.debug('debug message')\nlogger.info('info message')\nlogger.warning('warn message')\nlogger.error('error message')\nlogger.critical('critical message')\ntime.sleep(5)\nexcept KeyboardInterrupt:\n# cleanup\nlogging.config.stopListening()\nt.join()\n",
            "subsections": []
        },
        "And here is a script that takes a filename and sends that file to the": {
            "content": "server, properly preceded with the binary-encoded length, as the new\nlogging configuration:\n\n#!/usr/bin/env python\nimport socket, sys, struct\n\nwith open(sys.argv[1], 'rb') as f:\ndatatosend = f.read()\n\nHOST = 'localhost'\nPORT = 9999\ns = socket.socket(socket.AFINET, socket.SOCKSTREAM)\nprint('connecting...')\ns.connect((HOST, PORT))\nprint('sending config...')\ns.send(struct.pack('>L', len(datatosend)))\ns.send(datatosend)\ns.close()\nprint('complete')\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Dealing with handlers that block,  Next: Sending and receiving logging events across a network,  Prev: Configuration server example,  Up: Logging Cookbook": {
            "content": "",
            "subsections": []
        },
        "Sometimes you have to get your logging handlers to do their work without": {
            "content": "blocking the thread you're logging from.  This is common in web\napplications, though of course it also occurs in other scenarios.\n\nA common culprit which demonstrates sluggish behaviour is the *note\nSMTPHandler: 2a6f.: sending emails can take a long time, for a number of\nreasons outside the developer's control (for example, a poorly\nperforming mail or network infrastructure).  But almost any\nnetwork-based handler can block: Even a *note SocketHandler: dd2.\noperation may do a DNS query under the hood which is too slow (and this\nquery can be deep in the socket library code, below the Python layer,\nand outside your control).\n",
            "subsections": []
        },
        "One solution is to use a two-part approach.  For the first part, attach": {
            "content": "only a *note QueueHandler: 1534. to those loggers which are accessed\nfrom performance-critical threads.  They simply write to their queue,\nwhich can be sized to a large enough capacity or initialized with no\nupper bound to their size.  The write to the queue will typically be\naccepted quickly, though you will probably need to catch the *note\nqueue.Full: 2da2. exception as a precaution in your code.  If you are a\nlibrary developer who has performance-critical threads in their code, be\nsure to document this (together with a suggestion to attach only\n'QueueHandlers' to your loggers) for the benefit of other developers who\nwill use your code.\n\nThe second part of the solution is *note QueueListener: c8b, which has\nbeen designed as the counterpart to *note QueueHandler: 1534.  A *note",
            "subsections": []
        },
        "QueueListener: c8b. is very simple: it's passed a queue and some": {
            "content": "handlers, and it fires up an internal thread which listens to its queue\nfor LogRecords sent from 'QueueHandlers' (or any other source of\n'LogRecords', for that matter).  The 'LogRecords' are removed from the\nqueue and passed to the handlers for processing.\n\nThe advantage of having a separate *note QueueListener: c8b. class is\nthat you can use the same instance to service multiple 'QueueHandlers'.",
            "subsections": []
        },
        "This is more resource-friendly than, say, having threaded versions of": {
            "content": "the existing handler classes, which would eat up one thread per handler\nfor no particular benefit.\n\nAn example of using these two classes follows (imports omitted):\n\nque = queue.Queue(-1)  # no limit on size\nqueuehandler = QueueHandler(que)\nhandler = logging.StreamHandler()\nlistener = QueueListener(que, handler)\nroot = logging.getLogger()\nroot.addHandler(queuehandler)\nformatter = logging.Formatter('%(threadName)s: %(message)s')\nhandler.setFormatter(formatter)\nlistener.start()\n# The log output will display the thread which generated\n# the event (the main thread) rather than the internal\n# thread which monitors the internal queue. This is what\n# you want to happen.\nroot.warning('Look out!')\nlistener.stop()\n\nwhich, when run, will produce:\n\nMainThread: Look out!\n\nNote: Although the earlier discussion wasn't specifically talking\nabout async code, but rather about slow logging handlers, it should\nbe noted that when logging from async code, network and even file\nhandlers could lead to problems (blocking the event loop) because\nsome logging is done from *note asyncio: 9. internals.  It might be\nbest, if any async code is used in an application, to use the above\napproach for logging, so that any blocking code runs only in the\n'QueueListener' thread.\n\nChanged in version 3.5: Prior to Python 3.5, the *note QueueListener:\nc8b. always passed every message received from the queue to every\nhandler it was initialized with.  (This was because it was assumed that\nlevel filtering was all done on the other side, where the queue is\nfilled.)  From 3.5 onwards, this behaviour can be changed by passing a\nkeyword argument 'respecthandlerlevel=True' to the listener's\nconstructor.  When this is done, the listener compares the level of each\nmessage with the handler's level, and only passes a message to a handler\nif it's appropriate to do so.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "Let's say you want to send logging events across a network, and handle": {
            "content": "them at the receiving end.  A simple way of doing this is attaching a\n*note SocketHandler: dd2. instance to the root logger at the sending\nend:\n\nimport logging, logging.handlers\n\nrootLogger = logging.getLogger('')\nrootLogger.setLevel(logging.DEBUG)\nsocketHandler = logging.handlers.SocketHandler('localhost',\nlogging.handlers.DEFAULTTCPLOGGINGPORT)\n# don't bother with a formatter, since a socket handler sends the event as\n# an unformatted pickle\nrootLogger.addHandler(socketHandler)\n\n# Now, we can log to the root logger, or any other logger. First the root...\nlogging.info('Jackdaws love my big sphinx of quartz.')\n\n# Now, define a couple of other loggers which might represent areas in your\n# application:\n\nlogger1 = logging.getLogger('myapp.area1')\nlogger2 = logging.getLogger('myapp.area2')\n\nlogger1.debug('Quick zephyrs blow, vexing daft Jim.')\nlogger1.info('How quickly daft jumping zebras vex.')\nlogger2.warning('Jail zesty vixen who grabbed pay from quack.')\nlogger2.error('The five boxing wizards jump quickly.')\n\nAt the receiving end, you can set up a receiver using the *note\nsocketserver: c7. module.  Here is a basic working example:\n\nimport pickle\nimport logging\nimport logging.handlers\nimport socketserver\nimport struct\n\n\nclass LogRecordStreamHandler(socketserver.StreamRequestHandler):\n\"\"\"Handler for a streaming logging request.\n\nThis basically logs the record using whatever logging policy is\nconfigured locally.\n\"\"\"\n\ndef handle(self):\n\"\"\"\nHandle multiple requests - each expected to be a 4-byte length,\nfollowed by the LogRecord in pickle format. Logs the record\naccording to whatever policy is configured locally.\n\"\"\"\nwhile True:\nchunk = self.connection.recv(4)\nif len(chunk) < 4:\nbreak\nslen = struct.unpack('>L', chunk)[0]\nchunk = self.connection.recv(slen)\nwhile len(chunk) < slen:\nchunk = chunk + self.connection.recv(slen - len(chunk))\nobj = self.unPickle(chunk)\nrecord = logging.makeLogRecord(obj)\nself.handleLogRecord(record)\n\ndef unPickle(self, data):\nreturn pickle.loads(data)\n\ndef handleLogRecord(self, record):\n# if a name is specified, we use the named logger rather than the one\n# implied by the record.\nif self.server.logname is not None:\nname = self.server.logname\nelse:\nname = record.name\nlogger = logging.getLogger(name)\n# N.B. EVERY record gets logged. This is because Logger.handle\n# is normally called AFTER logger-level filtering. If you want\n# to do filtering, do it at the client end to save wasting\n# cycles and network bandwidth!\nlogger.handle(record)\n\nclass LogRecordSocketReceiver(socketserver.ThreadingTCPServer):\n\"\"\"\nSimple TCP socket-based logging receiver suitable for testing.\n\"\"\"\n\nallowreuseaddress = True\n\ndef init(self, host='localhost',\nport=logging.handlers.DEFAULTTCPLOGGINGPORT,\nhandler=LogRecordStreamHandler):\nsocketserver.ThreadingTCPServer.init(self, (host, port), handler)\nself.abort = 0\nself.timeout = 1\nself.logname = None\n\ndef serveuntilstopped(self):\nimport select\nabort = 0\nwhile not abort:\nrd, wr, ex = select.select([self.socket.fileno()],\n[], [],\nself.timeout)\nif rd:\nself.handlerequest()\nabort = self.abort\n\ndef main():\nlogging.basicConfig(\nformat='%(relativeCreated)5d %(name)-15s %(levelname)-8s %(message)s')\ntcpserver = LogRecordSocketReceiver()\nprint('About to start TCP server...')\ntcpserver.serveuntilstopped()\n\nif name == 'main':\nmain()\n",
            "subsections": []
        },
        "First run the server, and then the client.  On the client side, nothing": {
            "content": "is printed on the console; on the server side, you should see something\nlike:\n\nAbout to start TCP server...\n59 root            INFO     Jackdaws love my big sphinx of quartz.\n59 myapp.area1     DEBUG    Quick zephyrs blow, vexing daft Jim.\n69 myapp.area1     INFO     How quickly daft jumping zebras vex.\n69 myapp.area2     WARNING  Jail zesty vixen who grabbed pay from quack.\n69 myapp.area2     ERROR    The five boxing wizards jump quickly.\n\nNote that there are some security issues with pickle in some scenarios.",
            "subsections": []
        },
        "If these affect you, you can use an alternative serialization scheme by": {
            "content": "overriding the *note makePickle(): 2a58. method and implementing your\nalternative there, as well as adapting the above script to use your\nalternative serialization.\n\n* Menu:\n\n* Running a logging socket listener in production::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Running a logging socket listener in production,  Up: Sending and receiving logging events across a network": {
            "content": "9.8.8.1 Running a logging socket listener in production\n.......................................................\n",
            "subsections": []
        },
        "To run a logging listener in production, you may need to use a": {
            "content": "process-management tool such as Supervisor(1).  Here is a Gist(2) which\nprovides the bare-bones files to run the above functionality using\nSupervisor.  It consists of the following files:\n",
            "subsections": []
        },
        "File                          Purpose": {
            "content": "---------------------------------------------------------------------------------------\n\n'prepare.sh'                  A Bash script to prepare the environment for testing\n\n\n'supervisor.conf'             The Supervisor configuration file, which has entries\nfor the listener and a multi-process web application\n\n\n'ensureapp.sh'               A Bash script to ensure that Supervisor is running\nwith the above configuration\n\n\n'loglistener.py'             The socket listener program which receives log events\nand records them to a file\n\n\n'main.py'                     A simple web application which performs logging via a\nsocket connected to the listener\n\n\n'webapp.json'                 A JSON configuration file for the web application\n\n\n'client.py'                   A Python script to exercise the web application\n\n",
            "subsections": []
        },
        "The web application uses Gunicorn(3), which is a popular web application": {
            "content": "server that starts multiple worker processes to handle requests.  This\nexample setup shows how the workers can write to the same log file\nwithout conflicting with one another -- they all go through the socket\nlistener.\n\nTo test these files, do the following in a POSIX environment:\n\n1. Download the Gist(4) as a ZIP archive using the Download ZIP\nbutton.\n\n2. Unzip the above files from the archive into a scratch directory.\n\n3. In the scratch directory, run 'bash prepare.sh' to get things\nready.  This creates a 'run' subdirectory to contain\nSupervisor-related and log files, and a 'venv' subdirectory to\ncontain a virtual environment into which 'bottle', 'gunicorn' and\n'supervisor' are installed.\n\n4. Run 'bash ensureapp.sh' to ensure that Supervisor is running with\nthe above configuration.\n\n5. Run 'venv/bin/python client.py' to exercise the web application,\nwhich will lead to records being written to the log.\n\n6. Inspect the log files in the 'run' subdirectory.  You should see\nthe most recent log lines in files matching the pattern 'app.log*'.\nThey won't be in any particular order, since they have been handled\nconcurrently by different worker processes in a non-deterministic\nway.\n\n7. You can shut down the listener and the web application by running\n'venv/bin/supervisorctl -c supervisor.conf shutdown'.\n",
            "subsections": []
        },
        "You may need to tweak the configuration files in the unlikely event that": {
            "content": "the configured ports clash with something else in your test environment.\n\n---------- Footnotes ----------\n\n(1) http://supervisord.org/\n\n(2) https://gist.github.com/vsajip/4b227eeec43817465ca835ca66f75e2b\n\n(3) https://gunicorn.org/\n\n(4) https://gist.github.com/vsajip/4b227eeec43817465ca835ca66f75e2b\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "Sometimes you want logging output to contain contextual information in": {
            "content": "addition to the parameters passed to the logging call.  For example, in\na networked application, it may be desirable to log client-specific\ninformation in the log (e.g.  remote client's username, or IP address).",
            "subsections": []
        },
        "Although you could use the 'extra' parameter to achieve this, it's not": {
            "content": "always convenient to pass the information in this way.  While it might\nbe tempting to create *note Logger: 98b. instances on a per-connection\nbasis, this is not a good idea because these instances are not garbage\ncollected.  While this is not a problem in practice, when the number of\n*note Logger: 98b. instances is dependent on the level of granularity\nyou want to use in logging an application, it could be hard to manage if\nthe number of *note Logger: 98b. instances becomes effectively\nunbounded.\n\n* Menu:\n\n* Using LoggerAdapters to impart contextual information::\n* Using Filters to impart contextual information::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using LoggerAdapters to impart contextual information,  Next: Using Filters to impart contextual information,  Up: Adding contextual information to your logging output": {
            "content": "9.8.9.1 Using LoggerAdapters to impart contextual information\n.............................................................\n",
            "subsections": []
        },
        "An easy way in which you can pass contextual information to be output": {
            "content": "along with logging event information is to use the *note LoggerAdapter:\n116a. class.  This class is designed to look like a *note Logger: 98b,\nso that you can call *note debug(): 29c3, *note info(): 29ee, *note\nwarning(): 12e8, *note error(): 2a02, *note exception(): 12e9, *note\ncritical(): 2a03. and *note log(): 2a04.  These methods have the same\nsignatures as their counterparts in *note Logger: 98b, so you can use\nthe two types of instances interchangeably.\n\nWhen you create an instance of *note LoggerAdapter: 116a, you pass it a\n*note Logger: 98b. instance and a dict-like object which contains your\ncontextual information.  When you call one of the logging methods on an\ninstance of *note LoggerAdapter: 116a, it delegates the call to the\nunderlying instance of *note Logger: 98b. passed to its constructor, and\narranges to pass the contextual information in the delegated call.\nHere's a snippet from the code of *note LoggerAdapter: 116a.:\n\ndef debug(self, msg, /, *args, kwargs):\n\"\"\"\nDelegate a debug call to the underlying logger, after adding\ncontextual information from this adapter instance.\n\"\"\"\nmsg, kwargs = self.process(msg, kwargs)\nself.logger.debug(msg, *args, kwargs)\n\nThe *note process(): 29fb. method of *note LoggerAdapter: 116a. is where\nthe contextual information is added to the logging output.  It's passed\nthe message and keyword arguments of the logging call, and it passes\nback (potentially) modified versions of these to use in the call to the\nunderlying logger.  The default implementation of this method leaves the\nmessage alone, but inserts an 'extra' key in the keyword argument whose\nvalue is the dict-like object passed to the constructor.  Of course, if\nyou had passed an 'extra' keyword argument in the call to the adapter,\nit will be silently overwritten.\n",
            "subsections": []
        },
        "The advantage of using 'extra' is that the values in the dict-like": {
            "content": "object are merged into the *note LogRecord: e59. instance's dict,\nallowing you to use customized strings with your *note Formatter: 12ec.\ninstances which know about the keys of the dict-like object.  If you\nneed a different method, e.g.  if you want to prepend or append the\ncontextual information to the message string, you just need to subclass\n*note LoggerAdapter: 116a. and override *note process(): 29fb. to do\nwhat you need.  Here is a simple example:\n\nclass CustomAdapter(logging.LoggerAdapter):\n\"\"\"\nThis example adapter expects the passed in dict-like object to have a\n'connid' key, whose value in brackets is prepended to the log message.\n\"\"\"\ndef process(self, msg, kwargs):\nreturn '[%s] %s' % (self.extra['connid'], msg), kwargs\n\nwhich you can use like this:\n\nlogger = logging.getLogger(name)\nadapter = CustomAdapter(logger, {'connid': someconnid})\n",
            "subsections": []
        },
        "Then any events that you log to the adapter will have the value of": {
            "content": "'someconnid' prepended to the log messages.\n\n* Menu:\n\n* Using objects other than dicts to pass contextual information::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using objects other than dicts to pass contextual information,  Up: Using LoggerAdapters to impart contextual information": {
            "content": "9.8.9.2 Using objects other than dicts to pass contextual information\n.....................................................................\n\nYou don't need to pass an actual dict to a *note LoggerAdapter: 116a. -\nyou could pass an instance of a class which implements 'getitem' and\n'iter' so that it looks like a dict to logging.  This would be\nuseful if you want to generate values dynamically (whereas the values in\na dict would be constant).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using Filters to impart contextual information,  Prev: Using LoggerAdapters to impart contextual information,  Up: Adding contextual information to your logging output": {
            "content": "9.8.9.3 Using Filters to impart contextual information\n......................................................\n",
            "subsections": []
        },
        "You can also add contextual information to log output using a": {
            "content": "user-defined *note Filter: 106f.  'Filter' instances are allowed to\nmodify the 'LogRecords' passed to them, including adding additional\nattributes which can then be output using a suitable format string, or\nif needed a custom *note Formatter: 12ec.\n",
            "subsections": []
        },
        "For example in a web application, the request being processed (or at": {
            "content": "least, the interesting parts of it) can be stored in a threadlocal\n(*note threading.local: 14bb.) variable, and then accessed from a\n'Filter' to add, say, information from the request - say, the remote IP\naddress and remote user's username - to the 'LogRecord', using the\nattribute names 'ip' and 'user' as in the 'LoggerAdapter' example above.",
            "subsections": []
        },
        "In that case, the same format string can be used to get similar output": {
            "content": "to that shown above.  Here's an example script:\n\nimport logging\nfrom random import choice\n\nclass ContextFilter(logging.Filter):\n\"\"\"\nThis is a filter which injects contextual information into the log.\n\nRather than use actual contextual information, we just use random\ndata in this demo.\n\"\"\"\n\nUSERS = ['jim', 'fred', 'sheila']\nIPS = ['123.231.231.123', '127.0.0.1', '192.168.0.1']\n\ndef filter(self, record):\n\nrecord.ip = choice(ContextFilter.IPS)\nrecord.user = choice(ContextFilter.USERS)\nreturn True\n\nif name == 'main':\nlevels = (logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR, logging.CRITICAL)\nlogging.basicConfig(level=logging.DEBUG,\nformat='%(asctime)-15s %(name)-5s %(levelname)-8s IP: %(ip)-15s User: %(user)-8s %(message)s')\na1 = logging.getLogger('a.b.c')\na2 = logging.getLogger('d.e.f')\n\nf = ContextFilter()\na1.addFilter(f)\na2.addFilter(f)\na1.debug('A debug message')\na1.info('An info message with %s', 'some parameters')\nfor x in range(10):\nlvl = choice(levels)\nlvlname = logging.getLevelName(lvl)\na2.log(lvl, 'A message at %s level with %d %s', lvlname, 2, 'parameters')\n\nwhich, when run, produces something like:\n\n2010-09-06 22:38:15,292 a.b.c DEBUG    IP: 123.231.231.123 User: fred     A debug message\n2010-09-06 22:38:15,300 a.b.c INFO     IP: 192.168.0.1     User: sheila   An info message with some parameters\n2010-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\n2010-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\n2010-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\n2010-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\n2010-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\n2010-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\n2010-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\n2010-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\n2010-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\n2010-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\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Use of contextvars,  Next: Imparting contextual information in handlers,  Prev: Adding contextual information to your logging output,  Up: Logging Cookbook": {
            "content": "Since Python 3.7, the *note contextvars: 22. module has provided\ncontext-local storage which works for both *note threading: e7. and\n*note asyncio: 9. processing needs.  This type of storage may thus be\ngenerally preferable to thread-locals.  The following example shows how,\nin a multi-threaded environment, logs can populated with contextual\ninformation such as, for example, request attributes handled by web\napplications.\n",
            "subsections": []
        },
        "For the purposes of illustration, say that you have different web": {
            "content": "applications, each independent of the other but running in the same",
            "subsections": []
        },
        "Python process and using a library common to them.  How can each of": {
            "content": "these applications have their own log, where all logging messages from\nthe library (and other request processing code) are directed to the\nappropriate application's log file, while including in the log\nadditional contextual information such as client IP, HTTP request method\nand client username?\n\nLet's assume that the library can be simulated by the following code:\n\n# webapplib.py\nimport logging\nimport time\n\nlogger = logging.getLogger(name)\n\ndef useful():\n# Just a representative event logged from the library\nlogger.debug('Hello from webapplib!')\n# Just sleep for a bit so other threads get to run\ntime.sleep(0.01)\n",
            "subsections": []
        },
        "We can simulate the multiple web applications by means of two simple": {
            "content": "classes, 'Request' and 'WebApp'.  These simulate how real threaded web\napplications work - each request is handled by a thread:\n\n# main.py\nimport argparse\nfrom contextvars import ContextVar\nimport logging\nimport os\nfrom random import choice\nimport threading\nimport webapplib\n\nlogger = logging.getLogger(name)\nroot = logging.getLogger()\nroot.setLevel(logging.DEBUG)\n\nclass Request:\n\"\"\"\nA simple dummy request class which just holds dummy HTTP request method,\nclient IP address and client username\n\"\"\"\ndef init(self, method, ip, user):\nself.method = method\nself.ip = ip\nself.user = user\n\n# A dummy set of requests which will be used in the simulation - we'll just pick\n# from this list randomly. Note that all GET requests are from 192.168.2.XXX\n# addresses, whereas POST requests are from 192.16.3.XXX addresses. Three users\n# are represented in the sample requests.\n\nREQUESTS = [\nRequest('GET', '192.168.2.20', 'jim'),\nRequest('POST', '192.168.3.20', 'fred'),\nRequest('GET', '192.168.2.21', 'sheila'),\nRequest('POST', '192.168.3.21', 'jim'),\nRequest('GET', '192.168.2.22', 'fred'),\nRequest('POST', '192.168.3.22', 'sheila'),\n]\n\n# Note that the format string includes references to request context information\n# such as HTTP method, client IP and username\n\nformatter = logging.Formatter('%(threadName)-11s %(appName)s %(name)-9s %(user)-6s %(ip)s %(method)-4s %(message)s')\n\n# Create our context variables. These will be filled at the start of request\n# processing, and used in the logging that happens during that processing\n\nctxrequest = ContextVar('request')\nctxappname = ContextVar('appname')\n\nclass InjectingFilter(logging.Filter):\n\"\"\"\nA filter which injects context-specific information into logs and ensures\nthat only information for a specific webapp is included in its log\n\"\"\"\ndef init(self, app):\nself.app = app\n\ndef filter(self, record):\nrequest = ctxrequest.get()\nrecord.method = request.method\nrecord.ip = request.ip\nrecord.user = request.user\nrecord.appName = appName = ctxappname.get()\nreturn appName == self.app.name\n\nclass WebApp:\n\"\"\"\nA dummy web application class which has its own handler and filter for a\nwebapp-specific log.\n\"\"\"\ndef init(self, name):\nself.name = name\nhandler = logging.FileHandler(name + '.log', 'w')\nf = InjectingFilter(self)\nhandler.setFormatter(formatter)\nhandler.addFilter(f)\nroot.addHandler(handler)\nself.numrequests = 0\n\ndef processrequest(self, request):\n\"\"\"\nThis is the dummy method for processing a request. It's called on a\ndifferent thread for every request. We store the context information into\nthe context vars before doing anything else.\n\"\"\"\nctxrequest.set(request)\nctxappname.set(self.name)\nself.numrequests += 1\nlogger.debug('Request processing started')\nwebapplib.useful()\nlogger.debug('Request processing finished')\n\ndef main():\nfn = os.path.splitext(os.path.basename(file))[0]\nadhf = argparse.ArgumentDefaultsHelpFormatter\nap = argparse.ArgumentParser(formatterclass=adhf, prog=fn,\ndescription='Simulate a couple of web '\n'applications handling some '\n'requests, showing how request '\n'context can be used to '\n'populate logs')\naa = ap.addargument\naa('--count', '-c', type=int, default=100, help='How many requests to simulate')\noptions = ap.parseargs()\n\n# Create the dummy webapps and put them in a list which we can use to select\n# from randomly\napp1 = WebApp('app1')\napp2 = WebApp('app2')\napps = [app1, app2]\nthreads = []\n# Add a common handler which will capture all events\nhandler = logging.FileHandler('app.log', 'w')\nhandler.setFormatter(formatter)\nroot.addHandler(handler)\n\n# Generate calls to process requests\nfor i in range(options.count):\ntry:\n# Pick an app at random and a request for it to process\napp = choice(apps)\nrequest = choice(REQUESTS)\n# Process the request in its own thread\nt = threading.Thread(target=app.processrequest, args=(request,))\nthreads.append(t)\nt.start()\nexcept KeyboardInterrupt:\nbreak\n\n# Wait for the threads to terminate\nfor t in threads:\nt.join()\n\nfor app in apps:\nprint('%s processed %s requests' % (app.name, app.numrequests))\n\nif name == 'main':\nmain()\n",
            "subsections": []
        },
        "If you run the above, you should find that roughly half the requests go": {
            "content": "into 'app1.log' and the rest into 'app2.log', and the all the requests\nare logged to 'app.log'.  Each webapp-specific log will contain only log\nentries for only that webapp, and the request information will be\ndisplayed consistently in the log (i.e.  the information in each dummy\nrequest will always appear together in a log line).  This is illustrated\nby the following shell output:\n\n~/logging-contextual-webapp$ python main.py\napp1 processed 51 requests\napp2 processed 49 requests\n~/logging-contextual-webapp$ wc -l *.log\n153 app1.log\n147 app2.log\n300 app.log\n600 total\n~/logging-contextual-webapp$ head -3 app1.log\nThread-3 (processrequest) app1 main  jim    192.168.3.21 POST Request processing started\nThread-3 (processrequest) app1 webapplib jim    192.168.3.21 POST Hello from webapplib!\nThread-5 (processrequest) app1 main  jim    192.168.3.21 POST Request processing started\n~/logging-contextual-webapp$ head -3 app2.log\nThread-1 (processrequest) app2 main  sheila 192.168.2.21 GET  Request processing started\nThread-1 (processrequest) app2 webapplib sheila 192.168.2.21 GET  Hello from webapplib!\nThread-2 (processrequest) app2 main  jim    192.168.2.20 GET  Request processing started\n~/logging-contextual-webapp$ head app.log\nThread-1 (processrequest) app2 main  sheila 192.168.2.21 GET  Request processing started\nThread-1 (processrequest) app2 webapplib sheila 192.168.2.21 GET  Hello from webapplib!\nThread-2 (processrequest) app2 main  jim    192.168.2.20 GET  Request processing started\nThread-3 (processrequest) app1 main  jim    192.168.3.21 POST Request processing started\nThread-2 (processrequest) app2 webapplib jim    192.168.2.20 GET  Hello from webapplib!\nThread-3 (processrequest) app1 webapplib jim    192.168.3.21 POST Hello from webapplib!\nThread-4 (processrequest) app2 main  fred   192.168.2.22 GET  Request processing started\nThread-5 (processrequest) app1 main  jim    192.168.3.21 POST Request processing started\nThread-4 (processrequest) app2 webapplib fred   192.168.2.22 GET  Hello from webapplib!\nThread-6 (processrequest) app1 main  jim    192.168.3.21 POST Request processing started\n~/logging-contextual-webapp$ grep app1 app1.log | wc -l\n153\n~/logging-contextual-webapp$ grep app2 app2.log | wc -l\n147\n~/logging-contextual-webapp$ grep app1 app.log | wc -l\n153\n~/logging-contextual-webapp$ grep app2 app.log | wc -l\n147\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Imparting contextual information in handlers,  Next: Logging to a single file from multiple processes,  Prev: Use of contextvars,  Up: Logging Cookbook": {
            "content": "Each *note Handler: 12eb. has its own chain of filters.  If you want to\nadd contextual information to a *note LogRecord: e59. without leaking it\nto other handlers, you can use a filter that returns a new *note",
            "subsections": []
        },
        "LogRecord: e59. instead of modifying it in-place, as shown in the": {
            "content": "following script:\n\nimport copy\nimport logging\n\ndef filter(record: logging.LogRecord):\nrecord = copy.copy(record)\nrecord.user = 'jim'\nreturn record\n\nif name == 'main':\nlogger = logging.getLogger()\nlogger.setLevel(logging.INFO)\nhandler = logging.StreamHandler()\nformatter = logging.Formatter('%(message)s from %(user)-8s')\nhandler.setFormatter(formatter)\nhandler.addFilter(filter)\nlogger.addHandler(handler)\n\nlogger.info('A log message')\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Logging to a single file from multiple processes,  Next: Using file rotation,  Prev: Imparting contextual information in handlers,  Up: Logging Cookbook": {
            "content": "",
            "subsections": []
        },
        "Although logging is thread-safe, and logging to a single file from": {
            "content": "multiple threads in a single process 'is' supported, logging to a single\nfile from 'multiple processes' is 'not' supported, because there is no\nstandard way to serialize access to a single file across multiple\nprocesses in Python.  If you need to log to a single file from multiple\nprocesses, one way of doing this is to have all the processes log to a\n*note SocketHandler: dd2, and have a separate process which implements a\nsocket server which reads from the socket and logs to file.  (If you\nprefer, you can dedicate one thread in one of the existing processes to\nperform this function.)  *note This section: 4d0f. documents this\napproach in more detail and includes a working socket receiver which can\nbe used as a starting point for you to adapt in your own applications.\n\nYou could also write your own handler which uses the *note Lock: 2d85.\nclass from the *note multiprocessing: 8f. module to serialize access to\nthe file from your processes.  The existing *note FileHandler: 1600. and\nsubclasses do not make use of *note multiprocessing: 8f. at present,\nthough they may do so in the future.  Note that at present, the *note\nmultiprocessing: 8f. module does not provide working lock functionality\non all platforms (see 'https://bugs.python.org/issue3770').\n\nAlternatively, you can use a 'Queue' and a *note QueueHandler: 1534. to\nsend all logging events to one of the processes in your multi-process\napplication.  The following example script demonstrates how you can do\nthis; in the example a separate listener process listens for events sent\nby other processes and logs them according to its own logging\nconfiguration.  Although the example only demonstrates one way of doing\nit (for example, you may want to use a listener thread rather than a\nseparate listener process - the implementation would be analogous) it\ndoes allow for completely different logging configurations for the\nlistener and the other processes in your application, and can be used as\nthe basis for code meeting your own specific requirements:\n\n# You'll need these imports in your own code\nimport logging\nimport logging.handlers\nimport multiprocessing\n\n# Next two import lines for this demo only\nfrom random import choice, random\nimport time\n\n#\n# Because you'll want to define the logging configurations for listener and workers, the\n# listener and worker process functions take a configurer parameter which is a callable\n# for configuring logging for that process. These functions are also passed the queue,\n# which they use for communication.\n#\n# In practice, you can configure the listener however you want, but note that in this\n# simple example, the listener does not apply level or filter logic to received records.\n# In practice, you would probably want to do this logic in the worker processes, to avoid\n# sending events which would be filtered out between processes.\n#\n# The size of the rotated files is made small so you can see the results easily.\ndef listenerconfigurer():\nroot = logging.getLogger()\nh = logging.handlers.RotatingFileHandler('mptest.log', 'a', 300, 10)\nf = logging.Formatter('%(asctime)s %(processName)-10s %(name)s %(levelname)-8s %(message)s')\nh.setFormatter(f)\nroot.addHandler(h)\n\n# This is the listener process top-level loop: wait for logging events\n# (LogRecords)on the queue and handle them, quit when you get a None for a\n# LogRecord.\ndef listenerprocess(queue, configurer):\nconfigurer()\nwhile True:\ntry:\nrecord = queue.get()\nif record is None:  # We send this as a sentinel to tell the listener to quit.\nbreak\nlogger = logging.getLogger(record.name)\nlogger.handle(record)  # No level or filter logic applied - just do it!\nexcept Exception:\nimport sys, traceback\nprint('Whoops! Problem:', file=sys.stderr)\ntraceback.printexc(file=sys.stderr)\n\n# Arrays used for random selections in this demo\n\nLEVELS = [logging.DEBUG, logging.INFO, logging.WARNING,\nlogging.ERROR, logging.CRITICAL]\n\nLOGGERS = ['a.b.c', 'd.e.f']\n\nMESSAGES = [\n'Random message #1',\n'Random message #2',\n'Random message #3',\n]\n\n# The worker configuration is done at the start of the worker process run.\n# Note that on Windows you can't rely on fork semantics, so each process\n# will run the logging configuration code when it starts.\ndef workerconfigurer(queue):\nh = logging.handlers.QueueHandler(queue)  # Just the one handler needed\nroot = logging.getLogger()\nroot.addHandler(h)\n# send all messages, for demo; no other level or filter logic applied.\nroot.setLevel(logging.DEBUG)\n\n# This is the worker process top-level loop, which just logs ten events with\n# random intervening delays before terminating.\n# The print messages are just so you know it's doing something!\ndef workerprocess(queue, configurer):\nconfigurer(queue)\nname = multiprocessing.currentprocess().name\nprint('Worker started: %s' % name)\nfor i in range(10):\ntime.sleep(random())\nlogger = logging.getLogger(choice(LOGGERS))\nlevel = choice(LEVELS)\nmessage = choice(MESSAGES)\nlogger.log(level, message)\nprint('Worker finished: %s' % name)\n\n# Here's where the demo gets orchestrated. Create the queue, create and start\n# the listener, create ten workers and start them, wait for them to finish,\n# then send a None to the queue to tell the listener to finish.\ndef main():\nqueue = multiprocessing.Queue(-1)\nlistener = multiprocessing.Process(target=listenerprocess,\nargs=(queue, listenerconfigurer))\nlistener.start()\nworkers = []\nfor i in range(10):\nworker = multiprocessing.Process(target=workerprocess,\nargs=(queue, workerconfigurer))\nworkers.append(worker)\nworker.start()\nfor w in workers:\nw.join()\nqueue.putnowait(None)\nlistener.join()\n\nif name == 'main':\nmain()\n\nA variant of the above script keeps the logging in the main process, in\na separate thread:\n\nimport logging\nimport logging.config\nimport logging.handlers\nfrom multiprocessing import Process, Queue\nimport random\nimport threading\nimport time\n\ndef loggerthread(q):\nwhile True:\nrecord = q.get()\nif record is None:\nbreak\nlogger = logging.getLogger(record.name)\nlogger.handle(record)\n\n\ndef workerprocess(q):\nqh = logging.handlers.QueueHandler(q)\nroot = logging.getLogger()\nroot.setLevel(logging.DEBUG)\nroot.addHandler(qh)\nlevels = [logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR,\nlogging.CRITICAL]\nloggers = ['foo', 'foo.bar', 'foo.bar.baz',\n'spam', 'spam.ham', 'spam.ham.eggs']\nfor i in range(100):\nlvl = random.choice(levels)\nlogger = logging.getLogger(random.choice(loggers))\nlogger.log(lvl, 'Message no. %d', i)\n\nif name == 'main':\nq = Queue()\nd = {\n'version': 1,\n'formatters': {\n'detailed': {\n'class': 'logging.Formatter',\n'format': '%(asctime)s %(name)-15s %(levelname)-8s %(processName)-10s %(message)s'\n}\n},\n'handlers': {\n'console': {\n'class': 'logging.StreamHandler',\n'level': 'INFO',\n},\n'file': {\n'class': 'logging.FileHandler',\n'filename': 'mplog.log',\n'mode': 'w',\n'formatter': 'detailed',\n},\n'foofile': {\n'class': 'logging.FileHandler',\n'filename': 'mplog-foo.log',\n'mode': 'w',\n'formatter': 'detailed',\n},\n'errors': {\n'class': 'logging.FileHandler',\n'filename': 'mplog-errors.log',\n'mode': 'w',\n'level': 'ERROR',\n'formatter': 'detailed',\n},\n},\n'loggers': {\n'foo': {\n'handlers': ['foofile']\n}\n},\n'root': {\n'level': 'DEBUG',\n'handlers': ['console', 'file', 'errors']\n},\n}\nworkers = []\nfor i in range(5):\nwp = Process(target=workerprocess, name='worker %d' % (i + 1), args=(q,))\nworkers.append(wp)\nwp.start()\nlogging.config.dictConfig(d)\nlp = threading.Thread(target=loggerthread, args=(q,))\nlp.start()\n# At this point, the main process could do some useful work of its own\n# Once it's done that, it can wait for the workers to terminate...\nfor wp in workers:\nwp.join()\n# And now tell the logging thread to finish up, too\nq.put(None)\nlp.join()\n",
            "subsections": []
        },
        "This variant shows how you can e.g.  apply configuration for particular": {
            "content": "loggers - e.g.  the 'foo' logger has a special handler which stores all\nevents in the 'foo' subsystem in a file 'mplog-foo.log'.  This will be\nused by the logging machinery in the main process (even though the\nlogging events are generated in the worker processes) to direct the\nmessages to the appropriate destinations.\n\n* Menu:\n\n* Using concurrent.futures.ProcessPoolExecutor: Using concurrent futures ProcessPoolExecutor.\n* Deploying Web applications using Gunicorn and uWSGI::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using concurrent futures ProcessPoolExecutor,  Next: Deploying Web applications using Gunicorn and uWSGI,  Up: Logging to a single file from multiple processes": {
            "content": "9.8.12.1 Using concurrent.futures.ProcessPoolExecutor\n.....................................................\n\nIf you want to use *note concurrent.futures.ProcessPoolExecutor: 707. to\nstart your worker processes, you need to create the queue slightly\ndifferently.  Instead of\n\nqueue = multiprocessing.Queue(-1)\n\nyou should use\n\nqueue = multiprocessing.Manager().Queue(-1)  # also works with the examples above\n\nand you can then replace the worker creation from this:\n\nworkers = []\nfor i in range(10):\nworker = multiprocessing.Process(target=workerprocess,\nargs=(queue, workerconfigurer))\nworkers.append(worker)\nworker.start()\nfor w in workers:\nw.join()\n\nto this (remembering to first import *note concurrent.futures: 1f.):\n\nwith concurrent.futures.ProcessPoolExecutor(maxworkers=10) as executor:\nfor i in range(10):\nexecutor.submit(workerprocess, queue, workerconfigurer)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Deploying Web applications using Gunicorn and uWSGI,  Prev: Using concurrent futures ProcessPoolExecutor,  Up: Logging to a single file from multiple processes": {
            "content": "9.8.12.2 Deploying Web applications using Gunicorn and uWSGI\n............................................................\n",
            "subsections": []
        },
        "When deploying Web applications using Gunicorn(1) or uWSGI(2) (or": {
            "content": "similar), multiple worker processes are created to handle client\nrequests.  In such environments, avoid creating file-based handlers\ndirectly in your web application.  Instead, use a *note SocketHandler:\ndd2. to log from the web application to a listener in a separate\nprocess.  This can be set up using a process management tool such as\nSupervisor - see *note Running a logging socket listener in production:\n4d11. for more details.\n\n---------- Footnotes ----------\n\n(1) https://gunicorn.org/\n\n(2) https://uwsgi-docs.readthedocs.io/en/latest/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using file rotation,  Next: Use of alternative formatting styles,  Prev: Logging to a single file from multiple processes,  Up: Logging Cookbook": {
            "content": "",
            "subsections": []
        },
        "Sometimes you want to let a log file grow to a certain size, then open a": {
            "content": "new file and log to that.  You may want to keep a certain number of\nthese files, and when that many files have been created, rotate the\nfiles so that the number of files and the size of the files both remain\nbounded.  For this usage pattern, the logging package provides a *note\nRotatingFileHandler: 2a1a.:\n\nimport glob\nimport logging\nimport logging.handlers\n\nLOGFILENAME = 'loggingrotatingfileexample.out'\n\n# Set up a specific logger with our desired output level\nmylogger = logging.getLogger('MyLogger')\nmylogger.setLevel(logging.DEBUG)\n\n# Add the log message handler to the logger\nhandler = logging.handlers.RotatingFileHandler(\nLOGFILENAME, maxBytes=20, backupCount=5)\n\nmylogger.addHandler(handler)\n\n# Log some messages\nfor i in range(20):\nmylogger.debug('i = %d' % i)\n\n# See what files are created\nlogfiles = glob.glob('%s*' % LOGFILENAME)\n\nfor filename in logfiles:\nprint(filename)\n",
            "subsections": []
        },
        "The result should be 6 separate files, each with part of the log history": {
            "content": "for the application:\n\nloggingrotatingfileexample.out\nloggingrotatingfileexample.out.1\nloggingrotatingfileexample.out.2\nloggingrotatingfileexample.out.3\nloggingrotatingfileexample.out.4\nloggingrotatingfileexample.out.5\n",
            "subsections": []
        },
        "The most current file is always 'loggingrotatingfileexample.out', and": {
            "content": "each time it reaches the size limit it is renamed with the suffix '.1'.",
            "subsections": []
        },
        "Each of the existing backup files is renamed to increment the suffix": {
            "content": "('.1' becomes '.2', etc.)  and the '.6' file is erased.\n",
            "subsections": []
        },
        "Obviously this example sets the log length much too small as an extreme": {
            "content": "example.  You would want to set 'maxBytes' to an appropriate value.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Use of alternative formatting styles,  Next: Customizing LogRecord,  Prev: Using file rotation,  Up: Logging Cookbook": {
            "content": "",
            "subsections": []
        },
        "When logging was added to the Python standard library, the only way of": {
            "content": "formatting messages with variable content was to use the %-formatting\nmethod.  Since then, Python has gained two new formatting approaches:\n*note string.Template: 453. (added in Python 2.4) and *note\nstr.format(): 3ed. (added in Python 2.6).\n",
            "subsections": []
        },
        "Logging (as of 3.2) provides improved support for these two additional": {
            "content": "formatting styles.  The *note Formatter: 12ec. class been enhanced to\ntake an additional, optional keyword parameter named 'style'.  This\ndefaults to ''%'', but other possible values are ''{'' and ''$'', which\ncorrespond to the other two formatting styles.  Backwards compatibility\nis maintained by default (as you would expect), but by explicitly\nspecifying a style parameter, you get the ability to specify format\nstrings which work with *note str.format(): 3ed. or *note\nstring.Template: 453.  Here's an example console session to show the\npossibilities:\n\n>>> import logging\n>>> root = logging.getLogger()\n>>> root.setLevel(logging.DEBUG)\n>>> handler = logging.StreamHandler()\n>>> bf = logging.Formatter('{asctime} {name} {levelname:8s} {message}',\n...                        style='{')\n>>> handler.setFormatter(bf)\n>>> root.addHandler(handler)\n>>> logger = logging.getLogger('foo.bar')\n>>> logger.debug('This is a DEBUG message')\n2010-10-28 15:11:55,341 foo.bar DEBUG    This is a DEBUG message\n>>> logger.critical('This is a CRITICAL message')\n2010-10-28 15:12:11,526 foo.bar CRITICAL This is a CRITICAL message\n>>> df = logging.Formatter('$asctime $name ${levelname} $message',\n...                        style='$')\n>>> handler.setFormatter(df)\n>>> logger.debug('This is a DEBUG message')\n2010-10-28 15:13:06,924 foo.bar DEBUG This is a DEBUG message\n>>> logger.critical('This is a CRITICAL message')\n2010-10-28 15:13:11,494 foo.bar CRITICAL This is a CRITICAL message\n>>>\n",
            "subsections": []
        },
        "Note that the formatting of logging messages for final output to logs is": {
            "content": "completely independent of how an individual logging message is\nconstructed.  That can still use %-formatting, as shown here:\n\n>>> logger.error('This is an%s %s %s', 'other,', 'ERROR,', 'message')\n2010-10-28 15:19:29,833 foo.bar ERROR This is another, ERROR, message\n>>>\n",
            "subsections": []
        },
        "Logging calls ('logger.debug()', 'logger.info()' etc.)  only take": {
            "content": "positional parameters for the actual logging message itself, with\nkeyword parameters used only for determining options for how to handle\nthe actual logging call (e.g.  the 'excinfo' keyword parameter to\nindicate that traceback information should be logged, or the 'extra'\nkeyword parameter to indicate additional contextual information to be\nadded to the log).  So you cannot directly make logging calls using\n*note str.format(): 3ed. or *note string.Template: 453. syntax, because\ninternally the logging package uses %-formatting to merge the format\nstring and the variable arguments.  There would be no changing this\nwhile preserving backward compatibility, since all logging calls which\nare out there in existing code will be using %-format strings.\n\nThere is, however, a way that you can use {}- and $- formatting to\nconstruct your individual log messages.  Recall that for a message you\ncan use an arbitrary object as a message format string, and that the\nlogging package will call 'str()' on that object to get the actual\nformat string.  Consider the following two classes:\n\nclass BraceMessage:\ndef init(self, fmt, /, *args, kwargs):\nself.fmt = fmt\nself.args = args\nself.kwargs = kwargs\n\ndef str(self):\nreturn self.fmt.format(*self.args, self.kwargs)\n\nclass DollarMessage:\ndef init(self, fmt, /, kwargs):\nself.fmt = fmt\nself.kwargs = kwargs\n\ndef str(self):\nfrom string import Template\nreturn Template(self.fmt).substitute(self.kwargs)\n\nEither of these can be used in place of a format string, to allow {}- or\n$-formatting to be used to build the actual \"message\" part which appears\nin the formatted log output in place of \"%(message)s\" or \"{message}\" or\n\"$message\".  It's a little unwieldy to use the class names whenever you\nwant to log something, but it's quite palatable if you use an alias such\nas  (double underscore -- not to be confused with , the single\nunderscore used as a synonym/alias for *note gettext.gettext(): 12be. or\nits brethren).\n",
            "subsections": []
        },
        "The above classes are not included in Python, though they're easy enough": {
            "content": "to copy and paste into your own code.  They can be used as follows\n(assuming that they're declared in a module called 'wherever'):\n\n>>> from wherever import BraceMessage as\n>>> print(('Message with {0} {name}', 2, name='placeholders'))\nMessage with 2 placeholders\n>>> class Point: pass\n...\n>>> p = Point()\n>>> p.x = 0.5\n>>> p.y = 0.5\n>>> print(('Message with coordinates: ({point.x:.2f}, {point.y:.2f})',\n...       point=p))\nMessage with coordinates: (0.50, 0.50)\n>>> from wherever import DollarMessage as\n>>> print(('Message with $num $what', num=2, what='placeholders'))\nMessage with 2 placeholders\n>>>\n",
            "subsections": []
        },
        "While the above examples use 'print()' to show how the formatting works,": {
            "content": "you would of course use 'logger.debug()' or similar to actually log\nusing this approach.\n",
            "subsections": []
        },
        "One thing to note is that you pay no significant performance penalty": {
            "content": "with this approach: the actual formatting happens not when you make the\nlogging call, but when (and if) the logged message is actually about to\nbe output to a log by a handler.  So the only slightly unusual thing\nwhich might trip you up is that the parentheses go around the format\nstring and the arguments, not just the format string.  That's because\nthe  notation is just syntax sugar for a constructor call to one of\nthe 'XXXMessage' classes shown above.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Customizing LogRecord,  Next: Subclassing QueueHandler and QueueListener- a ZeroMQ example,  Prev: Use of alternative formatting styles,  Up: Logging Cookbook": {
            "content": "Every logging event is represented by a *note LogRecord: e59. instance.",
            "subsections": []
        },
        "When an event is logged and not filtered out by a logger's level, a": {
            "content": "*note LogRecord: e59. is created, populated with information about the\nevent and then passed to the handlers for that logger (and its\nancestors, up to and including the logger where further propagation up\nthe hierarchy is disabled).  Before Python 3.2, there were only two\nplaces where this creation was done:\n\n* *note Logger.makeRecord(): 29cb, which is called in the normal\nprocess of logging an event.  This invoked *note LogRecord: e59.\ndirectly to create an instance.\n\n* *note makeLogRecord(): 29f2, which is called with a dictionary\ncontaining attributes to be added to the LogRecord.  This is\ntypically invoked when a suitable dictionary has been received over\nthe network (e.g.  in pickle form via a *note SocketHandler: dd2,\nor in JSON form via an *note HTTPHandler: c8a.).\n",
            "subsections": []
        },
        "This has usually meant that if you need to do anything special with a": {
            "content": "*note LogRecord: e59, you've had to do one of the following.\n\n* Create your own *note Logger: 98b. subclass, which overrides *note\nLogger.makeRecord(): 29cb, and set it using *note setLoggerClass():\n2a01. before any loggers that you care about are instantiated.\n\n* Add a *note Filter: 106f. to a logger or handler, which does the\nnecessary special manipulation you need when its *note filter():\n29ed. method is called.\n",
            "subsections": []
        },
        "The first approach would be a little unwieldy in the scenario where": {
            "content": "(say) several different libraries wanted to do different things.  Each\nwould attempt to set its own *note Logger: 98b. subclass, and the one\nwhich did this last would win.\n",
            "subsections": []
        },
        "The second approach works reasonably well for many cases, but does not": {
            "content": "allow you to e.g.  use a specialized subclass of *note LogRecord: e59.",
            "subsections": []
        },
        "Library developers can set a suitable filter on their loggers, but they": {
            "content": "would have to remember to do this every time they introduced a new\nlogger (which they would do simply by adding new packages or modules and\ndoing\n\nlogger = logging.getLogger(name)\n\nat module level).  It's probably one too many things to think about.\nDevelopers could also add the filter to a *note NullHandler: 10fd.\nattached to their top-level logger, but this would not be invoked if an\napplication developer attached a handler to a lower-level library logger\n-- so output from that handler would not reflect the intentions of the\nlibrary developer.\n\nIn Python 3.2 and later, *note LogRecord: e59. creation is done through\na factory, which you can specify.  The factory is just a callable you\ncan set with *note setLogRecordFactory(): 29f6, and interrogate with\n*note getLogRecordFactory(): 29f5.  The factory is invoked with the same\nsignature as the *note LogRecord: e59. constructor, as *note LogRecord:\ne59. is the default setting for the factory.\n",
            "subsections": []
        },
        "This approach allows a custom factory to control all aspects of": {
            "content": "",
            "subsections": []
        },
        "LogRecord creation.  For example, you could return a subclass, or just": {
            "content": "add some additional attributes to the record once created, using a\npattern similar to this:\n\noldfactory = logging.getLogRecordFactory()\n\ndef recordfactory(*args, kwargs):\nrecord = oldfactory(*args, kwargs)\nrecord.customattribute = 0xdecafbad\nreturn record\n\nlogging.setLogRecordFactory(recordfactory)\n",
            "subsections": []
        },
        "This pattern allows different libraries to chain factories together, and": {
            "content": "as long as they don't overwrite each other's attributes or\nunintentionally overwrite the attributes provided as standard, there\nshould be no surprises.  However, it should be borne in mind that each\nlink in the chain adds run-time overhead to all logging operations, and\nthe technique should only be used when the use of a *note Filter: 106f.\ndoes not provide the desired result.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Subclassing QueueHandler and QueueListener- a ZeroMQ example,  Next: Subclassing QueueHandler and QueueListener- a pynng example,  Prev: Customizing LogRecord,  Up: Logging Cookbook": {
            "content": "* Menu:\n\n* Subclass QueueHandler::\n* Subclass QueueListener::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Subclass QueueHandler,  Next: Subclass QueueListener,  Up: Subclassing QueueHandler and QueueListener- a ZeroMQ example": {
            "content": "9.8.16.1 Subclass 'QueueHandler'\n................................\n\nYou can use a *note QueueHandler: 1534. subclass to send messages to\nother kinds of queues, for example a ZeroMQ 'publish' socket.  In the\nexample below,the socket is created separately and passed to the handler\n(as its 'queue'):\n\nimport zmq   # using pyzmq, the Python binding for ZeroMQ\nimport json  # for serializing records portably\n\nctx = zmq.Context()\nsock = zmq.Socket(ctx, zmq.PUB)  # or zmq.PUSH, or other suitable value\nsock.bind('tcp://*:5556')        # or wherever\n\nclass ZeroMQSocketHandler(QueueHandler):\ndef enqueue(self, record):\nself.queue.sendjson(record.dict)\n\n\nhandler = ZeroMQSocketHandler(sock)\n",
            "subsections": []
        },
        "Of course there are other ways of organizing this, for example passing": {
            "content": "in the data needed by the handler to create the socket:\n\nclass ZeroMQSocketHandler(QueueHandler):\ndef init(self, uri, socktype=zmq.PUB, ctx=None):\nself.ctx = ctx or zmq.Context()\nsocket = zmq.Socket(self.ctx, socktype)\nsocket.bind(uri)\nsuper().init(socket)\n\ndef enqueue(self, record):\nself.queue.sendjson(record.dict)\n\ndef close(self):\nself.queue.close()\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Subclass QueueListener,  Prev: Subclass QueueHandler,  Up: Subclassing QueueHandler and QueueListener- a ZeroMQ example": {
            "content": "9.8.16.2 Subclass 'QueueListener'\n.................................\n\nYou can also subclass *note QueueListener: c8b. to get messages from\nother kinds of queues, for example a ZeroMQ 'subscribe' socket.  Here's\nan example:\n\nclass ZeroMQSocketListener(QueueListener):\ndef init(self, uri, /, *handlers, kwargs):\nself.ctx = kwargs.get('ctx') or zmq.Context()\nsocket = zmq.Socket(self.ctx, zmq.SUB)\nsocket.setsockoptstring(zmq.SUBSCRIBE, '')  # subscribe to everything\nsocket.connect(uri)\nsuper().init(socket, *handlers, kwargs)\n\ndef dequeue(self):\nmsg = self.queue.recvjson()\nreturn logging.makeLogRecord(msg)\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "In a similar way to the above section, we can implement a listener and": {
            "content": "handler using pynng(1), which is a Python binding to NNG(2), billed as a\nspiritual successor to ZeroMQ. The following snippets illustrate - you\ncan test them in an environment which has 'pynng' installed.  Just for\nvariety, we present the listener first.\n\n* Menu:\n\n* Subclass QueueListener: Subclass QueueListener<2>.\n* Subclass QueueHandler: Subclass QueueHandler<2>.\n\n---------- Footnotes ----------\n\n(1) https://pypi.org/project/pynng/\n\n(2) https://nng.nanomsg.org/\n\nFile: python3.12.info,  Node: Subclass QueueListener<2>,  Next: Subclass QueueHandler<2>,  Up: Subclassing QueueHandler and QueueListener- a pynng example\n\n9.8.17.1 Subclass 'QueueListener'\n.................................\n\n# listener.py\nimport json\nimport logging\nimport logging.handlers\n\nimport pynng\n\nDEFAULTADDR = \"tcp://localhost:13232\"\n\ninterrupted = False\n\nclass NNGSocketListener(logging.handlers.QueueListener):\n\ndef init(self, uri, /, *handlers, kwargs):\n# Have a timeout for interruptability, and open a\n# subscriber socket\nsocket = pynng.Sub0(listen=uri, recvtimeout=500)\n# The b'' subscription matches all topics\ntopics = kwargs.pop('topics', None) or b''\nsocket.subscribe(topics)\n# We treat the socket as a queue\nsuper().init(socket, *handlers, kwargs)\n\ndef dequeue(self, block):\ndata = None\n# Keep looping while not interrupted and no data received over the\n# socket\nwhile not interrupted:\ntry:\ndata = self.queue.recv(block=block)\nbreak\nexcept pynng.Timeout:\npass\nexcept pynng.Closed:  # sometimes happens when you hit Ctrl-C\nbreak\nif data is None:\nreturn None\n# Get the logging event sent from a publisher\nevent = json.loads(data.decode('utf-8'))\nreturn logging.makeLogRecord(event)\n\ndef enqueuesentinel(self):\n# Not used in this implementation, as the socket isn't really a\n# queue\npass\n\nlogging.getLogger('pynng').propagate = False\nlistener = NNGSocketListener(DEFAULTADDR, logging.StreamHandler(), topics=b'')\nlistener.start()\nprint('Press Ctrl-C to stop.')\ntry:\nwhile True:\npass\nexcept KeyboardInterrupt:\ninterrupted = True\nfinally:\nlistener.stop()\n\nFile: python3.12.info,  Node: Subclass QueueHandler<2>,  Prev: Subclass QueueListener<2>,  Up: Subclassing QueueHandler and QueueListener- a pynng example\n\n9.8.17.2 Subclass 'QueueHandler'\n................................\n\n# sender.py\nimport json\nimport logging\nimport logging.handlers\nimport time\nimport random\n\nimport pynng\n\nDEFAULTADDR = \"tcp://localhost:13232\"\n\nclass NNGSocketHandler(logging.handlers.QueueHandler):\n\ndef init(self, uri):\nsocket = pynng.Pub0(dial=uri, sendtimeout=500)\nsuper().init(socket)\n\ndef enqueue(self, record):\n# Send the record as UTF-8 encoded JSON\nd = dict(record.dict)\ndata = json.dumps(d)\nself.queue.send(data.encode('utf-8'))\n\ndef close(self):\nself.queue.close()\n\nlogging.getLogger('pynng').propagate = False\nhandler = NNGSocketHandler(DEFAULTADDR)\n# Make sure the process ID is in the output\nlogging.basicConfig(level=logging.DEBUG,\nhandlers=[logging.StreamHandler(), handler],\nformat='%(levelname)-8s %(name)10s %(process)6s %(message)s')\nlevels = (logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR,\nlogging.CRITICAL)\nloggernames = ('myapp', 'myapp.lib1', 'myapp.lib2')\nmsgno = 1\nwhile True:\n# Just randomly select some loggers and levels and log away\nlevel = random.choice(levels)\nlogger = logging.getLogger(random.choice(loggernames))\nlogger.log(level, 'Message no. %5d' % msgno)\nmsgno += 1\ndelay = random.random() * 2 + 0.5\ntime.sleep(delay)\n",
            "subsections": []
        },
        "You can run the above two snippets in separate command shells.  If we": {
            "content": "run the listener in one shell and run the sender in two separate shells,\nwe should see something like the following.  In the first sender shell:\n\n$ python sender.py\nDEBUG         myapp    613 Message no.     1\nWARNING  myapp.lib2    613 Message no.     2\nCRITICAL myapp.lib2    613 Message no.     3\nWARNING  myapp.lib2    613 Message no.     4\nCRITICAL myapp.lib1    613 Message no.     5\nDEBUG         myapp    613 Message no.     6\nCRITICAL myapp.lib1    613 Message no.     7\nINFO     myapp.lib1    613 Message no.     8\n(and so on)\n\nIn the second sender shell:\n\n$ python sender.py\nINFO     myapp.lib2    657 Message no.     1\nCRITICAL myapp.lib2    657 Message no.     2\nCRITICAL      myapp    657 Message no.     3\nCRITICAL myapp.lib1    657 Message no.     4\nINFO     myapp.lib1    657 Message no.     5\nWARNING  myapp.lib2    657 Message no.     6\nCRITICAL      myapp    657 Message no.     7\nDEBUG    myapp.lib1    657 Message no.     8\n(and so on)\n\nIn the listener shell:\n\n$ python listener.py\nPress Ctrl-C to stop.\nDEBUG         myapp    613 Message no.     1\nWARNING  myapp.lib2    613 Message no.     2\nINFO     myapp.lib2    657 Message no.     1\nCRITICAL myapp.lib2    613 Message no.     3\nCRITICAL myapp.lib2    657 Message no.     2\nCRITICAL      myapp    657 Message no.     3\nWARNING  myapp.lib2    613 Message no.     4\nCRITICAL myapp.lib1    613 Message no.     5\nCRITICAL myapp.lib1    657 Message no.     4\nINFO     myapp.lib1    657 Message no.     5\nDEBUG         myapp    613 Message no.     6\nWARNING  myapp.lib2    657 Message no.     6\nCRITICAL      myapp    657 Message no.     7\nCRITICAL myapp.lib1    613 Message no.     7\nINFO     myapp.lib1    613 Message no.     8\nDEBUG    myapp.lib1    657 Message no.     8\n(and so on)\n",
            "subsections": []
        },
        "As you can see, the logging from the two sender processes is interleaved": {
            "content": "in the listener's output.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "Below is an example of a logging configuration dictionary - it's taken": {
            "content": "from the documentation on the Django project(1).  This dictionary is\npassed to *note dictConfig(): 1023. to put the configuration into\neffect:\n\nLOGGING = {\n'version': 1,\n'disableexistingloggers': False,\n'formatters': {\n'verbose': {\n'format': '{levelname} {asctime} {module} {process:d} {thread:d} {message}',\n'style': '{',\n},\n'simple': {\n'format': '{levelname} {message}',\n'style': '{',\n},\n},\n'filters': {\n'special': {\n'()': 'project.logging.SpecialFilter',\n'foo': 'bar',\n},\n},\n'handlers': {\n'console': {\n'level': 'INFO',\n'class': 'logging.StreamHandler',\n'formatter': 'simple',\n},\n'mailadmins': {\n'level': 'ERROR',\n'class': 'django.utils.log.AdminEmailHandler',\n'filters': ['special']\n}\n},\n'loggers': {\n'django': {\n'handlers': ['console'],\n'propagate': True,\n},\n'django.request': {\n'handlers': ['mailadmins'],\n'level': 'ERROR',\n'propagate': False,\n},\n'myproject.custom': {\n'handlers': ['console', 'mailadmins'],\n'level': 'INFO',\n'filters': ['special']\n}\n}\n}\n",
            "subsections": []
        },
        "For more information about this configuration, you can see the relevant": {
            "content": "section(2) of the Django documentation.\n\n---------- Footnotes ----------\n\n(1)\nhttps://docs.djangoproject.com/en/stable/topics/logging/#configuring-logging\n\n(2)\nhttps://docs.djangoproject.com/en/stable/topics/logging/#configuring-logging\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "An example of how you can define a namer and rotator is given in the": {
            "content": "following runnable script, which shows gzip compression of the log file:\n\nimport gzip\nimport logging\nimport logging.handlers\nimport os\nimport shutil\n\ndef namer(name):\nreturn name + \".gz\"\n\ndef rotator(source, dest):\nwith open(source, 'rb') as fin:\nwith gzip.open(dest, 'wb') as fout:\nshutil.copyfileobj(fin, fout)\nos.remove(source)\n\n\nrh = logging.handlers.RotatingFileHandler('rotated.log', maxBytes=128, backupCount=5)\nrh.rotator = rotator\nrh.namer = namer\n\nroot = logging.getLogger()\nroot.setLevel(logging.INFO)\nroot.addHandler(rh)\nf = logging.Formatter('%(asctime)s %(message)s')\nrh.setFormatter(f)\nfor i in range(1000):\nroot.info(f'Message no. {i + 1}')\n",
            "subsections": []
        },
        "After running this, you will see six new files, five of which are": {
            "content": "compressed:\n\n$ ls rotated.log*\nrotated.log       rotated.log.2.gz  rotated.log.4.gz\nrotated.log.1.gz  rotated.log.3.gz  rotated.log.5.gz\n$ zcat rotated.log.1.gz\n2023-01-20 02:28:17,767 Message no. 996\n2023-01-20 02:28:17,767 Message no. 997\n2023-01-20 02:28:17,767 Message no. 998\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "The following working example shows how logging can be used with": {
            "content": "multiprocessing using configuration files.  The configurations are\nfairly simple, but serve to illustrate how more complex ones could be\nimplemented in a real multiprocessing scenario.\n",
            "subsections": []
        },
        "In the example, the main process spawns a listener process and some": {
            "content": "worker processes.  Each of the main process, the listener and the\nworkers have three separate configurations (the workers all share the\nsame configuration).  We can see logging in the main process, how the\nworkers log to a QueueHandler and how the listener implements a",
            "subsections": []
        },
        "QueueListener and a more complex logging configuration, and arranges to": {
            "content": "dispatch events received via the queue to the handlers specified in the\nconfiguration.  Note that these configurations are purely illustrative,\nbut you should be able to adapt this example to your own scenario.\n",
            "subsections": []
        },
        "Here's the script - the docstrings and the comments hopefully explain": {
            "content": "how it works:\n\nimport logging\nimport logging.config\nimport logging.handlers\nfrom multiprocessing import Process, Queue, Event, currentprocess\nimport os\nimport random\nimport time\n\nclass MyHandler:\n\"\"\"\nA simple handler for logging events. It runs in the listener process and\ndispatches events to loggers based on the name in the received record,\nwhich then get dispatched, by the logging system, to the handlers\nconfigured for those loggers.\n\"\"\"\n\ndef handle(self, record):\nif record.name == \"root\":\nlogger = logging.getLogger()\nelse:\nlogger = logging.getLogger(record.name)\n\nif logger.isEnabledFor(record.levelno):\n# The process name is transformed just to show that it's the listener\n# doing the logging to files and console\nrecord.processName = '%s (for %s)' % (currentprocess().name, record.processName)\nlogger.handle(record)\n\ndef listenerprocess(q, stopevent, config):\n\"\"\"\nThis could be done in the main process, but is just done in a separate\nprocess for illustrative purposes.\n\nThis initialises logging according to the specified configuration,\nstarts the listener and waits for the main process to signal completion\nvia the event. The listener is then stopped, and the process exits.\n\"\"\"\nlogging.config.dictConfig(config)\nlistener = logging.handlers.QueueListener(q, MyHandler())\nlistener.start()\nif os.name == 'posix':\n# On POSIX, the setup logger will have been configured in the\n# parent process, but should have been disabled following the\n# dictConfig call.\n# On Windows, since fork isn't used, the setup logger won't\n# exist in the child, so it would be created and the message\n# would appear - hence the \"if posix\" clause.\nlogger = logging.getLogger('setup')\nlogger.critical('Should not appear, because of disabled logger ...')\nstopevent.wait()\nlistener.stop()\n\ndef workerprocess(config):\n\"\"\"\nA number of these are spawned for the purpose of illustration. In\npractice, they could be a heterogeneous bunch of processes rather than\nones which are identical to each other.\n\nThis initialises logging according to the specified configuration,\nand logs a hundred messages with random levels to randomly selected\nloggers.\n\nA small sleep is added to allow other processes a chance to run. This\nis not strictly needed, but it mixes the output from the different\nprocesses a bit more than if it's left out.\n\"\"\"\nlogging.config.dictConfig(config)\nlevels = [logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR,\nlogging.CRITICAL]\nloggers = ['foo', 'foo.bar', 'foo.bar.baz',\n'spam', 'spam.ham', 'spam.ham.eggs']\nif os.name == 'posix':\n# On POSIX, the setup logger will have been configured in the\n# parent process, but should have been disabled following the\n# dictConfig call.\n# On Windows, since fork isn't used, the setup logger won't\n# exist in the child, so it would be created and the message\n# would appear - hence the \"if posix\" clause.\nlogger = logging.getLogger('setup')\nlogger.critical('Should not appear, because of disabled logger ...')\nfor i in range(100):\nlvl = random.choice(levels)\nlogger = logging.getLogger(random.choice(loggers))\nlogger.log(lvl, 'Message no. %d', i)\ntime.sleep(0.01)\n\ndef main():\nq = Queue()\n# The main process gets a simple configuration which prints to the console.\nconfiginitial = {\n'version': 1,\n'handlers': {\n'console': {\n'class': 'logging.StreamHandler',\n'level': 'INFO'\n}\n},\n'root': {\n'handlers': ['console'],\n'level': 'DEBUG'\n}\n}\n# The worker process configuration is just a QueueHandler attached to the\n# root logger, which allows all messages to be sent to the queue.\n# We disable existing loggers to disable the \"setup\" logger used in the\n# parent process. This is needed on POSIX because the logger will\n# be there in the child following a fork().\nconfigworker = {\n'version': 1,\n'disableexistingloggers': True,\n'handlers': {\n'queue': {\n'class': 'logging.handlers.QueueHandler',\n'queue': q\n}\n},\n'root': {\n'handlers': ['queue'],\n'level': 'DEBUG'\n}\n}\n# The listener process configuration shows that the full flexibility of\n# logging configuration is available to dispatch events to handlers however\n# you want.\n# We disable existing loggers to disable the \"setup\" logger used in the\n# parent process. This is needed on POSIX because the logger will\n# be there in the child following a fork().\nconfiglistener = {\n'version': 1,\n'disableexistingloggers': True,\n'formatters': {\n'detailed': {\n'class': 'logging.Formatter',\n'format': '%(asctime)s %(name)-15s %(levelname)-8s %(processName)-10s %(message)s'\n},\n'simple': {\n'class': 'logging.Formatter',\n'format': '%(name)-15s %(levelname)-8s %(processName)-10s %(message)s'\n}\n},\n'handlers': {\n'console': {\n'class': 'logging.StreamHandler',\n'formatter': 'simple',\n'level': 'INFO'\n},\n'file': {\n'class': 'logging.FileHandler',\n'filename': 'mplog.log',\n'mode': 'w',\n'formatter': 'detailed'\n},\n'foofile': {\n'class': 'logging.FileHandler',\n'filename': 'mplog-foo.log',\n'mode': 'w',\n'formatter': 'detailed'\n},\n'errors': {\n'class': 'logging.FileHandler',\n'filename': 'mplog-errors.log',\n'mode': 'w',\n'formatter': 'detailed',\n'level': 'ERROR'\n}\n},\n'loggers': {\n'foo': {\n'handlers': ['foofile']\n}\n},\n'root': {\n'handlers': ['console', 'file', 'errors'],\n'level': 'DEBUG'\n}\n}\n# Log some initial events, just to show that logging in the parent works\n# normally.\nlogging.config.dictConfig(configinitial)\nlogger = logging.getLogger('setup')\nlogger.info('About to create workers ...')\nworkers = []\nfor i in range(5):\nwp = Process(target=workerprocess, name='worker %d' % (i + 1),\nargs=(configworker,))\nworkers.append(wp)\nwp.start()\nlogger.info('Started worker: %s', wp.name)\nlogger.info('About to create listener ...')\nstopevent = Event()\nlp = Process(target=listenerprocess, name='listener',\nargs=(q, stopevent, configlistener))\nlp.start()\nlogger.info('Started listener')\n# We now hang around for the workers to finish their work.\nfor wp in workers:\nwp.join()\n# Workers all done, listening can now stop.\n# Logging in the parent still works normally.\nlogger.info('Telling listener to stop ...')\nstopevent.set()\nlp.join()\nlogger.info('All done.')\n\nif name == 'main':\nmain()\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Inserting a BOM into messages sent to a SysLogHandler,  Next: Implementing structured logging,  Prev: A more elaborate multiprocessing example,  Up: Logging Cookbook": {
            "content": "RFC 5424(1) requires that a Unicode message be sent to a syslog daemon\nas a set of bytes which have the following structure: an optional\npure-ASCII component, followed by a UTF-8 Byte Order Mark (BOM),\nfollowed by Unicode encoded using UTF-8.  (See the relevant section of\nthe specification(2).)\n\nIn Python 3.1, code was added to *note SysLogHandler: 426. to insert a\nBOM into the message, but unfortunately, it was implemented incorrectly,\nwith the BOM appearing at the beginning of the message and hence not\nallowing any pure-ASCII component to appear before it.\n",
            "subsections": []
        },
        "As this behaviour is broken, the incorrect BOM insertion code is being": {
            "content": "removed from Python 3.2.4 and later.  However, it is not being replaced,\nand if you want to produce RFC 5424(3)-compliant messages which include\na BOM, an optional pure-ASCII sequence before it and arbitrary Unicode\nafter it, encoded using UTF-8, then you need to do the following:\n\n1. Attach a *note Formatter: 12ec. instance to your *note\nSysLogHandler: 426. instance, with a format string such as:\n\n'ASCII section\\ufeffUnicode section'\n\nThe Unicode code point U+FEFF, when encoded using UTF-8, will be\nencoded as a UTF-8 BOM - the byte-string 'b'\\xef\\xbb\\xbf''.\n\n2. Replace the ASCII section with whatever placeholders you like, but\nmake sure that the data that appears in there after substitution is\nalways ASCII (that way, it will remain unchanged after UTF-8\nencoding).\n\n3. Replace the Unicode section with whatever placeholders you like; if\nthe data which appears there after substitution contains characters\noutside the ASCII range, that's fine - it will be encoded using\nUTF-8.\n",
            "subsections": []
        },
        "The formatted message 'will' be encoded using UTF-8 encoding by": {
            "content": "'SysLogHandler'.  If you follow the above rules, you should be able to\nproduce RFC 5424(4)-compliant messages.  If you don't, logging may not\ncomplain, but your messages will not be RFC 5424-compliant, and your\nsyslog daemon may complain.\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc5424.html\n\n(2) https://datatracker.ietf.org/doc/html/rfc5424.html#section-6\n\n(3) https://datatracker.ietf.org/doc/html/rfc5424.html\n\n(4) https://datatracker.ietf.org/doc/html/rfc5424.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Implementing structured logging,  Next: Customizing handlers with dictConfig,  Prev: Inserting a BOM into messages sent to a SysLogHandler,  Up: Logging Cookbook": {
            "content": "",
            "subsections": []
        },
        "Although most logging messages are intended for reading by humans, and": {
            "content": "thus not readily machine-parseable, there might be circumstances where\nyou want to output messages in a structured format which 'is' capable of\nbeing parsed by a program (without needing complex regular expressions\nto parse the log message).  This is straightforward to achieve using the\nlogging package.  There are a number of ways in which this could be\nachieved, but the following is a simple approach which uses JSON to\nserialise the event in a machine-parseable manner:\n\nimport json\nimport logging\n\nclass StructuredMessage:\ndef init(self, message, /, kwargs):\nself.message = message\nself.kwargs = kwargs\n\ndef str(self):\nreturn '%s >>> %s' % (self.message, json.dumps(self.kwargs))\n\n= StructuredMessage   # optional, to improve readability\n\nlogging.basicConfig(level=logging.INFO, format='%(message)s')\nlogging.info(('message 1', foo='bar', bar='baz', num=123, fnum=123.456))\n\nIf the above script is run, it prints:\n\nmessage 1 >>> {\"fnum\": 123.456, \"num\": 123, \"bar\": \"baz\", \"foo\": \"bar\"}\n",
            "subsections": []
        },
        "Note that the order of items might be different according to the version": {
            "content": "of Python used.\n",
            "subsections": []
        },
        "If you need more specialised processing, you can use a custom JSON": {
            "content": "encoder, as in the following complete example:\n\nimport json\nimport logging\n\n\nclass Encoder(json.JSONEncoder):\ndef default(self, o):\nif isinstance(o, set):\nreturn tuple(o)\nelif isinstance(o, str):\nreturn o.encode('unicodeescape').decode('ascii')\nreturn super().default(o)\n\nclass StructuredMessage:\ndef init(self, message, /, kwargs):\nself.message = message\nself.kwargs = kwargs\n\ndef str(self):\ns = Encoder().encode(self.kwargs)\nreturn '%s >>> %s' % (self.message, s)\n\n= StructuredMessage   # optional, to improve readability\n\ndef main():\nlogging.basicConfig(level=logging.INFO, format='%(message)s')\nlogging.info(('message 1', setvalue={1, 2, 3}, snowman='\\u2603'))\n\nif name == 'main':\nmain()\n\nWhen the above script is run, it prints:\n\nmessage 1 >>> {\"snowman\": \"\\u2603\", \"setvalue\": [1, 2, 3]}\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Customizing handlers with dictConfig,  Next: Using particular formatting styles throughout your application,  Prev: Implementing structured logging,  Up: Logging Cookbook": {
            "content": "",
            "subsections": []
        },
        "There are times when you want to customize logging handlers in": {
            "content": "particular ways, and if you use *note dictConfig(): 1023. you may be\nable to do this without subclassing.  As an example, consider that you\nmay want to set the ownership of a log file.  On POSIX, this is easily\ndone using *note shutil.chown(): f9f, but the file handlers in the\nstdlib don't offer built-in support.  You can customize handler creation\nusing a plain function such as:\n\ndef ownedfilehandler(filename, mode='a', encoding=None, owner=None):\nif owner:\nif not os.path.exists(filename):\nopen(filename, 'a').close()\nshutil.chown(filename, *owner)\nreturn logging.FileHandler(filename, mode, encoding)\n\nYou can then specify, in a logging configuration passed to *note\ndictConfig(): 1023, that a logging handler be created by calling this\nfunction:\n\nLOGGING = {\n'version': 1,\n'disableexistingloggers': False,\n'formatters': {\n'default': {\n'format': '%(asctime)s %(levelname)s %(name)s %(message)s'\n},\n},\n'handlers': {\n'file':{\n# The values below are popped from this dictionary and\n# used to create the handler, set the handler's level and\n# its formatter.\n'()': ownedfilehandler,\n'level':'DEBUG',\n'formatter': 'default',\n# The values below are passed to the handler creator callable\n# as keyword arguments.\n'owner': ['pulse', 'pulse'],\n'filename': 'chowntest.log',\n'mode': 'w',\n'encoding': 'utf-8',\n},\n},\n'root': {\n'handlers': ['file'],\n'level': 'DEBUG',\n},\n}\n",
            "subsections": []
        },
        "In this example I am setting the ownership using the 'pulse' user and": {
            "content": "group, just for the purposes of illustration.  Putting it together into\na working script, 'chowntest.py':\n\nimport logging, logging.config, os, shutil\n\ndef ownedfilehandler(filename, mode='a', encoding=None, owner=None):\nif owner:\nif not os.path.exists(filename):\nopen(filename, 'a').close()\nshutil.chown(filename, *owner)\nreturn logging.FileHandler(filename, mode, encoding)\n\nLOGGING = {\n'version': 1,\n'disableexistingloggers': False,\n'formatters': {\n'default': {\n'format': '%(asctime)s %(levelname)s %(name)s %(message)s'\n},\n},\n'handlers': {\n'file':{\n# The values below are popped from this dictionary and\n# used to create the handler, set the handler's level and\n# its formatter.\n'()': ownedfilehandler,\n'level':'DEBUG',\n'formatter': 'default',\n# The values below are passed to the handler creator callable\n# as keyword arguments.\n'owner': ['pulse', 'pulse'],\n'filename': 'chowntest.log',\n'mode': 'w',\n'encoding': 'utf-8',\n},\n},\n'root': {\n'handlers': ['file'],\n'level': 'DEBUG',\n},\n}\n\nlogging.config.dictConfig(LOGGING)\nlogger = logging.getLogger('mylogger')\nlogger.debug('A debug message')\n\nTo run this, you will probably need to run as 'root':\n\n$ sudo python3.3 chowntest.py\n$ cat chowntest.log\n2013-11-05 09:34:51,128 DEBUG mylogger A debug message\n$ ls -l chowntest.log\n-rw-r--r-- 1 pulse pulse 55 2013-11-05 09:34 chowntest.log\n\nNote that this example uses Python 3.3 because that's where *note\nshutil.chown(): f9f. makes an appearance.  This approach should work\nwith any Python version that supports *note dictConfig(): 1023. -\nnamely, Python 2.7, 3.2 or later.  With pre-3.3 versions, you would need\nto implement the actual ownership change using e.g.  *note os.chown():\nf5e.\n",
            "subsections": []
        },
        "In practice, the handler-creating function may be in a utility module": {
            "content": "somewhere in your project.  Instead of the line in the configuration:\n\n'()': ownedfilehandler,\n\nyou could use e.g.:\n\n'()': 'ext://project.util.ownedfilehandler',\n\nwhere 'project.util' can be replaced with the actual name of the package\nwhere the function resides.  In the above working script, using\n''ext://main.ownedfilehandler'' should work.  Here, the actual\ncallable is resolved by *note dictConfig(): 1023. from the 'ext://'\nspecification.\n",
            "subsections": []
        },
        "This example hopefully also points the way to how you could implement": {
            "content": "other types of file change - e.g.  setting specific POSIX permission\nbits - in the same way, using *note os.chmod(): f5d.\n",
            "subsections": []
        },
        "Of course, the approach could also be extended to types of handler other": {
            "content": "than a *note FileHandler: 1600. - for example, one of the rotating file\nhandlers, or a different type of handler altogether.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using particular formatting styles throughout your application,  Next: Configuring filters with dictConfig,  Prev: Customizing handlers with dictConfig,  Up: Logging Cookbook": {
            "content": "In Python 3.2, the *note Formatter: 12ec. gained a 'style' keyword\nparameter which, while defaulting to '%' for backward compatibility,\nallowed the specification of '{' or '$' to support the formatting\napproaches supported by *note str.format(): 3ed. and *note\nstring.Template: 453.  Note that this governs the formatting of logging\nmessages for final output to logs, and is completely orthogonal to how\nan individual logging message is constructed.\n\nLogging calls (*note debug(): c89, *note info(): 29c2. etc.)  only take\npositional parameters for the actual logging message itself, with\nkeyword parameters used only for determining options for how to handle\nthe logging call (e.g.  the 'excinfo' keyword parameter to indicate\nthat traceback information should be logged, or the 'extra' keyword\nparameter to indicate additional contextual information to be added to\nthe log).  So you cannot directly make logging calls using *note\nstr.format(): 3ed. or *note string.Template: 453. syntax, because\ninternally the logging package uses %-formatting to merge the format\nstring and the variable arguments.  There would be no changing this\nwhile preserving backward compatibility, since all logging calls which\nare out there in existing code will be using %-format strings.\n",
            "subsections": []
        },
        "There have been suggestions to associate format styles with specific": {
            "content": "loggers, but that approach also runs into backward compatibility\nproblems because any existing code could be using a given logger name\nand using %-formatting.\n",
            "subsections": []
        },
        "For logging to work interoperably between any third-party libraries and": {
            "content": "your code, decisions about formatting need to be made at the level of\nthe individual logging call.  This opens up a couple of ways in which\nalternative formatting styles can be accommodated.\n\n* Menu:\n\n* Using LogRecord factories::\n* Using custom message objects::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using LogRecord factories,  Next: Using custom message objects,  Up: Using particular formatting styles throughout your application": {
            "content": "9.8.24.1 Using LogRecord factories\n..................................\n\nIn Python 3.2, along with the *note Formatter: 12ec. changes mentioned\nabove, the logging package gained the ability to allow users to set\ntheir own *note LogRecord: e59. subclasses, using the *note\nsetLogRecordFactory(): 29f6. function.  You can use this to set your own\nsubclass of *note LogRecord: e59, which does the Right Thing by\noverriding the *note getMessage(): 29f4. method.  The base class\nimplementation of this method is where the 'msg % args' formatting\nhappens, and where you can substitute your alternate formatting;\nhowever, you should be careful to support all formatting styles and\nallow %-formatting as the default, to ensure interoperability with other\ncode.  Care should also be taken to call 'str(self.msg)', just as the\nbase implementation does.\n\nRefer to the reference documentation on *note setLogRecordFactory():\n29f6. and *note LogRecord: e59. for more information.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using custom message objects,  Prev: Using LogRecord factories,  Up: Using particular formatting styles throughout your application": {
            "content": "9.8.24.2 Using custom message objects\n.....................................\n\nThere is another, perhaps simpler way that you can use {}- and $-\nformatting to construct your individual log messages.  You may recall\n(from *note Using arbitrary objects as messages: 29f3.) that when\nlogging you can use an arbitrary object as a message format string, and\nthat the logging package will call *note str(): 157. on that object to\nget the actual format string.  Consider the following two classes:\n\nclass BraceMessage:\ndef init(self, fmt, /, *args, kwargs):\nself.fmt = fmt\nself.args = args\nself.kwargs = kwargs\n\ndef str(self):\nreturn self.fmt.format(*self.args, self.kwargs)\n\nclass DollarMessage:\ndef init(self, fmt, /, kwargs):\nself.fmt = fmt\nself.kwargs = kwargs\n\ndef str(self):\nfrom string import Template\nreturn Template(self.fmt).substitute(self.kwargs)\n\nEither of these can be used in place of a format string, to allow {}- or\n$-formatting to be used to build the actual \"message\" part which appears\nin the formatted log output in place of \"%(message)s\" or \"{message}\" or\n\"$message\".  If you find it a little unwieldy to use the class names\nwhenever you want to log something, you can make it more palatable if\nyou use an alias such as 'M' or '' for the message (or perhaps '', if\nyou are using '' for localization).\n",
            "subsections": []
        },
        "Examples of this approach are given below.  Firstly, formatting with": {
            "content": "*note str.format(): 3ed.:\n\n>>>  = BraceMessage\n>>> print(('Message with {0} {1}', 2, 'placeholders'))\nMessage with 2 placeholders\n>>> class Point: pass\n...\n>>> p = Point()\n>>> p.x = 0.5\n>>> p.y = 0.5\n>>> print(('Message with coordinates: ({point.x:.2f}, {point.y:.2f})', point=p))\nMessage with coordinates: (0.50, 0.50)\n\nSecondly, formatting with *note string.Template: 453.:\n\n>>>  = DollarMessage\n>>> print(('Message with $num $what', num=2, what='placeholders'))\nMessage with 2 placeholders\n>>>\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Configuring filters with dictConfig,  Next: Customized exception formatting,  Prev: Using particular formatting styles throughout your application,  Up: Logging Cookbook": {
            "content": "You 'can' configure filters using *note dictConfig(): 1023, though it\nmight not be obvious at first glance how to do it (hence this recipe).\nSince *note Filter: 106f. is the only filter class included in the\nstandard library, and it is unlikely to cater to many requirements (it's\nonly there as a base class), you will typically need to define your own\n*note Filter: 106f. subclass with an overridden *note filter(): 29ed.\nmethod.  To do this, specify the '()' key in the configuration\ndictionary for the filter, specifying a callable which will be used to\ncreate the filter (a class is the most obvious, but you can provide any\ncallable which returns a *note Filter: 106f. instance).  Here is a\ncomplete example:\n\nimport logging\nimport logging.config\nimport sys\n\nclass MyFilter(logging.Filter):\ndef init(self, param=None):\nself.param = param\n\ndef filter(self, record):\nif self.param is None:\nallow = True\nelse:\nallow = self.param not in record.msg\nif allow:\nrecord.msg = 'changed: ' + record.msg\nreturn allow\n\nLOGGING = {\n'version': 1,\n'filters': {\n'myfilter': {\n'()': MyFilter,\n'param': 'noshow',\n}\n},\n'handlers': {\n'console': {\n'class': 'logging.StreamHandler',\n'filters': ['myfilter']\n}\n},\n'root': {\n'level': 'DEBUG',\n'handlers': ['console']\n},\n}\n\nif name == 'main':\nlogging.config.dictConfig(LOGGING)\nlogging.debug('hello')\nlogging.debug('hello - noshow')\n",
            "subsections": []
        },
        "This example shows how you can pass configuration data to the callable": {
            "content": "which constructs the instance, in the form of keyword parameters.  When\nrun, the above script will print:\n\nchanged: hello\n\nwhich shows that the filter is working as configured.\n\nA couple of extra points to note:\n\n* If you can't refer to the callable directly in the configuration\n(e.g.  if it lives in a different module, and you can't import it\ndirectly where the configuration dictionary is), you can use the\nform 'ext://...' as described in *note Access to external objects:\n2a22.  For example, you could have used the text\n''ext://main.MyFilter'' instead of 'MyFilter' in the above\nexample.\n\n* As well as for filters, this technique can also be used to\nconfigure custom handlers and formatters.  See *note User-defined\nobjects: 2a15. for more information on how logging supports using\nuser-defined objects in its configuration, and see the other\ncookbook recipe *note Customizing handlers with dictConfig(): 4d2e.\nabove.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Customized exception formatting,  Next: Speaking logging messages,  Prev: Configuring filters with dictConfig,  Up: Logging Cookbook": {
            "content": "",
            "subsections": []
        },
        "There might be times when you want to do customized exception formatting": {
            "content": "- for argument's sake, let's say you want exactly one line per logged\nevent, even when exception information is present.  You can do this with\na custom formatter class, as shown in the following example:\n\nimport logging\n\nclass OneLineExceptionFormatter(logging.Formatter):\ndef formatException(self, excinfo):\n\"\"\"\nFormat an exception so that it prints on a single line.\n\"\"\"\nresult = super().formatException(excinfo)\nreturn repr(result)  # or format into one line however you want to\n\ndef format(self, record):\ns = super().format(record)\nif record.exctext:\ns = s.replace('\\n', '') + '|'\nreturn s\n\ndef configurelogging():\nfh = logging.FileHandler('output.txt', 'w')\nf = OneLineExceptionFormatter('%(asctime)s|%(levelname)s|%(message)s|',\n'%d/%m/%Y %H:%M:%S')\nfh.setFormatter(f)\nroot = logging.getLogger()\nroot.setLevel(logging.DEBUG)\nroot.addHandler(fh)\n\ndef main():\nconfigurelogging()\nlogging.info('Sample message')\ntry:\nx = 1 / 0\nexcept ZeroDivisionError as e:\nlogging.exception('ZeroDivisionError: %s', e)\n\nif name == 'main':\nmain()\n\nWhen run, this produces a file with exactly two lines:\n\n28/01/2015 07:21:23|INFO|Sample message|\n28/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'|\n",
            "subsections": []
        },
        "While the above treatment is simplistic, it points the way to how": {
            "content": "exception information can be formatted to your liking.  The *note\ntraceback: f9. module may be helpful for more specialized needs.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Speaking logging messages,  Next: Buffering logging messages and outputting them conditionally,  Prev: Customized exception formatting,  Up: Logging Cookbook": {
            "content": "",
            "subsections": []
        },
        "There might be situations when it is desirable to have logging messages": {
            "content": "rendered in an audible rather than a visible format.  This is easy to do\nif you have text-to-speech (TTS) functionality available in your system,\neven if it doesn't have a Python binding.  Most TTS systems have a\ncommand line program you can run, and this can be invoked from a handler\nusing *note subprocess: d0.  It's assumed here that TTS command line\nprograms won't expect to interact with users or take a long time to\ncomplete, and that the frequency of logged messages will be not so high\nas to swamp the user with messages, and that it's acceptable to have the\nmessages spoken one at a time rather than concurrently, The example\nimplementation below waits for one message to be spoken before the next\nis processed, and this might cause other handlers to be kept waiting.",
            "subsections": []
        },
        "Here is a short example showing the approach, which assumes that the": {
            "content": "'espeak' TTS package is available:\n\nimport logging\nimport subprocess\nimport sys\n\nclass TTSHandler(logging.Handler):\ndef emit(self, record):\nmsg = self.format(record)\n# Speak slowly in a female English voice\ncmd = ['espeak', '-s150', '-ven+f3', msg]\np = subprocess.Popen(cmd, stdout=subprocess.PIPE,\nstderr=subprocess.STDOUT)\n# wait for the program to finish\np.communicate()\n\ndef configurelogging():\nh = TTSHandler()\nroot = logging.getLogger()\nroot.addHandler(h)\n# the default formatter just returns the message\nroot.setLevel(logging.DEBUG)\n\ndef main():\nlogging.info('Hello')\nlogging.debug('Goodbye')\n\nif name == 'main':\nconfigurelogging()\nsys.exit(main())\n\nWhen run, this script should say \"Hello\" and then \"Goodbye\" in a female\nvoice.\n",
            "subsections": []
        },
        "The above approach can, of course, be adapted to other TTS systems and": {
            "content": "even other systems altogether which can process messages via external\nprograms run from a command line.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Buffering logging messages and outputting them conditionally,  Next: Sending logging messages to email with buffering,  Prev: Speaking logging messages,  Up: Logging Cookbook": {
            "content": "",
            "subsections": []
        },
        "There might be situations where you want to log messages in a temporary": {
            "content": "area and only output them if a certain condition occurs.  For example,\nyou may want to start logging debug events in a function, and if the\nfunction completes without errors, you don't want to clutter the log\nwith the collected debug information, but if there is an error, you want\nall the debug information to be output as well as the error.\n",
            "subsections": []
        },
        "Here is an example which shows how you could do this using a decorator": {
            "content": "for your functions where you want logging to behave this way.  It makes\nuse of the *note logging.handlers.MemoryHandler: 2a25, which allows\nbuffering of logged events until some condition occurs, at which point\nthe buffered events are 'flushed' - passed to another handler (the\n'target' handler) for processing.  By default, the 'MemoryHandler'\nflushed when its buffer gets filled up or an event whose level is\ngreater than or equal to a specified threshold is seen.  You can use\nthis recipe with a more specialised subclass of 'MemoryHandler' if you\nwant custom flushing behavior.\n",
            "subsections": []
        },
        "The example script has a simple function, 'foo', which just cycles": {
            "content": "through all the logging levels, writing to 'sys.stderr' to say what\nlevel it's about to log at, and then actually logging a message at that\nlevel.  You can pass a parameter to 'foo' which, if true, will log at\nERROR and CRITICAL levels - otherwise, it only logs at DEBUG, INFO and\nWARNING levels.\n",
            "subsections": []
        },
        "The script just arranges to decorate 'foo' with a decorator which will": {
            "content": "do the conditional logging that's required.  The decorator takes a\nlogger as a parameter and attaches a memory handler for the duration of\nthe call to the decorated function.  The decorator can be additionally\nparameterised using a target handler, a level at which flushing should\noccur, and a capacity for the buffer (number of records buffered).\nThese default to a *note StreamHandler: 106c. which writes to\n'sys.stderr', 'logging.ERROR' and '100' respectively.\n\nHere's the script:\n\nimport logging\nfrom logging.handlers import MemoryHandler\nimport sys\n\nlogger = logging.getLogger(name)\nlogger.addHandler(logging.NullHandler())\n\ndef logiferrors(logger, targethandler=None, flushlevel=None, capacity=None):\nif targethandler is None:\ntargethandler = logging.StreamHandler()\nif flushlevel is None:\nflushlevel = logging.ERROR\nif capacity is None:\ncapacity = 100\nhandler = MemoryHandler(capacity, flushLevel=flushlevel, target=targethandler)\n\ndef decorator(fn):\ndef wrapper(*args, kwargs):\nlogger.addHandler(handler)\ntry:\nreturn fn(*args, kwargs)\nexcept Exception:\nlogger.exception('call failed')\nraise\nfinally:\nsuper(MemoryHandler, handler).flush()\nlogger.removeHandler(handler)\nreturn wrapper\n\nreturn decorator\n\ndef writeline(s):\nsys.stderr.write('%s\\n' % s)\n\ndef foo(fail=False):\nwriteline('about to log at DEBUG ...')\nlogger.debug('Actually logged at DEBUG')\nwriteline('about to log at INFO ...')\nlogger.info('Actually logged at INFO')\nwriteline('about to log at WARNING ...')\nlogger.warning('Actually logged at WARNING')\nif fail:\nwriteline('about to log at ERROR ...')\nlogger.error('Actually logged at ERROR')\nwriteline('about to log at CRITICAL ...')\nlogger.critical('Actually logged at CRITICAL')\nreturn fail\n\ndecoratedfoo = logiferrors(logger)(foo)\n\nif name == 'main':\nlogger.setLevel(logging.DEBUG)\nwriteline('Calling undecorated foo with False')\nassert not foo(False)\nwriteline('Calling undecorated foo with True')\nassert foo(True)\nwriteline('Calling decorated foo with False')\nassert not decoratedfoo(False)\nwriteline('Calling decorated foo with True')\nassert decoratedfoo(True)\n\nWhen this script is run, the following output should be observed:\n\nCalling undecorated foo with False\nabout to log at DEBUG ...\nabout to log at INFO ...\nabout to log at WARNING ...\nCalling undecorated foo with True\nabout to log at DEBUG ...\nabout to log at INFO ...\nabout to log at WARNING ...\nabout to log at ERROR ...\nabout to log at CRITICAL ...\nCalling decorated foo with False\nabout to log at DEBUG ...\nabout to log at INFO ...\nabout to log at WARNING ...\nCalling decorated foo with True\nabout to log at DEBUG ...\nabout to log at INFO ...\nabout to log at WARNING ...\nabout to log at ERROR ...\nActually logged at DEBUG\nActually logged at INFO\nActually logged at WARNING\nActually logged at ERROR\nabout to log at CRITICAL ...\nActually logged at CRITICAL\n",
            "subsections": []
        },
        "As you can see, actual logging output only occurs when an event is": {
            "content": "logged whose severity is ERROR or greater, but in that case, any\nprevious events at lower severities are also logged.\n\nYou can of course use the conventional means of decoration:\n\n@logiferrors(logger)\ndef foo(fail=False):\n...\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "To illustrate how you can send log messages via email, so that a set": {
            "content": "number of messages are sent per email, you can subclass *note",
            "subsections": []
        },
        "BufferingHandler: 2a74.  In the following example, which you can adapt": {
            "content": "to suit your specific needs, a simple test harness is provided which\nallows you to run the script with command line arguments specifying what\nyou typically need to send things via SMTP. (Run the downloaded script\nwith the '-h' argument to see the required and optional arguments.)\n\nimport logging\nimport logging.handlers\nimport smtplib\n\nclass BufferingSMTPHandler(logging.handlers.BufferingHandler):\ndef init(self, mailhost, port, username, password, fromaddr, toaddrs,\nsubject, capacity):\nlogging.handlers.BufferingHandler.init(self, capacity)\nself.mailhost = mailhost\nself.mailport = port\nself.username = username\nself.password = password\nself.fromaddr = fromaddr\nif isinstance(toaddrs, str):\ntoaddrs = [toaddrs]\nself.toaddrs = toaddrs\nself.subject = subject\nself.setFormatter(logging.Formatter(\"%(asctime)s %(levelname)-5s %(message)s\"))\n\ndef flush(self):\nif len(self.buffer) > 0:\ntry:\nsmtp = smtplib.SMTP(self.mailhost, self.mailport)\nsmtp.starttls()\nsmtp.login(self.username, self.password)\nmsg = \"From: %s\\r\\nTo: %s\\r\\nSubject: %s\\r\\n\\r\\n\" % (self.fromaddr, ','.join(self.toaddrs), self.subject)\nfor record in self.buffer:\ns = self.format(record)\nmsg = msg + s + \"\\r\\n\"\nsmtp.sendmail(self.fromaddr, self.toaddrs, msg)\nsmtp.quit()\nexcept Exception:\nif logging.raiseExceptions:\nraise\nself.buffer = []\n\nif name == 'main':\nimport argparse\n\nap = argparse.ArgumentParser()\naa = ap.addargument\naa('host', metavar='HOST', help='SMTP server')\naa('--port', '-p', type=int, default=587, help='SMTP port')\naa('user', metavar='USER', help='SMTP username')\naa('password', metavar='PASSWORD', help='SMTP password')\naa('to', metavar='TO', help='Addressee for emails')\naa('sender', metavar='SENDER', help='Sender email address')\naa('--subject', '-s',\ndefault='Test Logging email from Python logging module (buffering)',\nhelp='Subject of email')\noptions = ap.parseargs()\nlogger = logging.getLogger()\nlogger.setLevel(logging.DEBUG)\nh = BufferingSMTPHandler(options.host, options.port, options.user,\noptions.password, options.sender,\noptions.to, options.subject, 10)\nlogger.addHandler(h)\nfor i in range(102):\nlogger.info(\"Info index = %d\", i)\nh.flush()\nh.close()\n",
            "subsections": []
        },
        "If you run this script and your SMTP server is correctly set up, you": {
            "content": "should find that it sends eleven emails to the addressee you specify.",
            "subsections": []
        },
        "The first ten emails will each have ten log messages, and the eleventh": {
            "content": "will have two messages.  That makes up 102 messages as specified in the\nscript.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "Sometimes you want to format times using UTC, which can be done using a": {
            "content": "class such as 'UTCFormatter', shown below:\n\nimport logging\nimport time\n\nclass UTCFormatter(logging.Formatter):\nconverter = time.gmtime\n\nand you can then use the 'UTCFormatter' in your code instead of *note",
            "subsections": []
        },
        "Formatter: 12ec.  If you want to do that via configuration, you can use": {
            "content": "the *note dictConfig(): 1023. API with an approach illustrated by the\nfollowing complete example:\n\nimport logging\nimport logging.config\nimport time\n\nclass UTCFormatter(logging.Formatter):\nconverter = time.gmtime\n\nLOGGING = {\n'version': 1,\n'disableexistingloggers': False,\n'formatters': {\n'utc': {\n'()': UTCFormatter,\n'format': '%(asctime)s %(message)s',\n},\n'local': {\n'format': '%(asctime)s %(message)s',\n}\n},\n'handlers': {\n'console1': {\n'class': 'logging.StreamHandler',\n'formatter': 'utc',\n},\n'console2': {\n'class': 'logging.StreamHandler',\n'formatter': 'local',\n},\n},\n'root': {\n'handlers': ['console1', 'console2'],\n}\n}\n\nif name == 'main':\nlogging.config.dictConfig(LOGGING)\nlogging.warning('The local time is %s', time.asctime())\n\nWhen this script is run, it should print something like:\n\n2015-10-17 12:53:29,501 The local time is Sat Oct 17 13:53:29 2015\n2015-10-17 13:53:29,501 The local time is Sat Oct 17 13:53:29 2015\n\nshowing how the time is formatted both as local time and UTC, one for\neach handler.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "There are times when it would be useful to temporarily change the": {
            "content": "logging configuration and revert it back after doing something.  For\nthis, a context manager is the most obvious way of saving and restoring\nthe logging context.  Here is a simple example of such a context\nmanager, which allows you to optionally change the logging level and add\na logging handler purely in the scope of the context manager:\n\nimport logging\nimport sys\n\nclass LoggingContext:\ndef init(self, logger, level=None, handler=None, close=True):\nself.logger = logger\nself.level = level\nself.handler = handler\nself.close = close\n\ndef enter(self):\nif self.level is not None:\nself.oldlevel = self.logger.level\nself.logger.setLevel(self.level)\nif self.handler:\nself.logger.addHandler(self.handler)\n\ndef exit(self, et, ev, tb):\nif self.level is not None:\nself.logger.setLevel(self.oldlevel)\nif self.handler:\nself.logger.removeHandler(self.handler)\nif self.handler and self.close:\nself.handler.close()\n# implicit return of None => don't swallow exceptions\n",
            "subsections": []
        },
        "If you specify a level value, the logger's level is set to that value in": {
            "content": "the scope of the with block covered by the context manager.  If you\nspecify a handler, it is added to the logger on entry to the block and\nremoved on exit from the block.  You can also ask the manager to close\nthe handler for you on block exit - you could do this if you don't need\nthe handler any more.\n",
            "subsections": []
        },
        "To illustrate how it works, we can add the following block of code to": {
            "content": "the above:\n\nif name == 'main':\nlogger = logging.getLogger('foo')\nlogger.addHandler(logging.StreamHandler())\nlogger.setLevel(logging.INFO)\nlogger.info('1. This should appear just once on stderr.')\nlogger.debug('2. This should not appear.')\nwith LoggingContext(logger, level=logging.DEBUG):\nlogger.debug('3. This should appear once on stderr.')\nlogger.debug('4. This should not appear.')\nh = logging.StreamHandler(sys.stdout)\nwith LoggingContext(logger, level=logging.DEBUG, handler=h, close=True):\nlogger.debug('5. This should appear twice - once on stderr and once on stdout.')\nlogger.info('6. This should appear just once on stderr.')\nlogger.debug('7. This should not appear.')\n\nWe initially set the logger's level to 'INFO', so message #1 appears and\nmessage #2 doesn't.  We then change the level to 'DEBUG' temporarily in\nthe following 'with' block, and so message #3 appears.  After the block\nexits, the logger's level is restored to 'INFO' and so message #4\ndoesn't appear.  In the next 'with' block, we set the level to 'DEBUG'\nagain but also add a handler writing to 'sys.stdout'.  Thus, message #5\nappears twice on the console (once via 'stderr' and once via 'stdout').",
            "subsections": []
        },
        "After the 'with' statement's completion, the status is as it was before": {
            "content": "so message #6 appears (like message #1) whereas message #7 doesn't (just\nlike message #2).\n\nIf we run the resulting script, the result is as follows:\n\n$ python logctx.py\n1. This should appear just once on stderr.\n3. This should appear once on stderr.\n5. This should appear twice - once on stderr and once on stdout.\n5. This should appear twice - once on stderr and once on stdout.\n6. This should appear just once on stderr.\n",
            "subsections": []
        },
        "If we run it again, but pipe 'stderr' to '/dev/null', we see the": {
            "content": "following, which is the only message written to 'stdout':\n\n$ python logctx.py 2>/dev/null\n5. This should appear twice - once on stderr and once on stdout.\n\nOnce again, but piping 'stdout' to '/dev/null', we get:\n\n$ python logctx.py >/dev/null\n1. This should appear just once on stderr.\n3. This should appear once on stderr.\n5. This should appear twice - once on stderr and once on stdout.\n6. This should appear just once on stderr.\n\nIn this case, the message #5 printed to 'stdout' doesn't appear, as\nexpected.\n",
            "subsections": []
        },
        "Of course, the approach described here can be generalised, for example": {
            "content": "to attach logging filters temporarily.  Note that the above code works\nin Python 2 as well as Python 3.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: A CLI application starter template,  Next: A Qt GUI for logging,  Prev: Using a context manager for selective logging,  Up: Logging Cookbook": {
            "content": "Here's an example which shows how you can:\n\n* Use a logging level based on command-line arguments\n\n* Dispatch to multiple subcommands in separate files, all logging at\nthe same level in a consistent way\n\n* Make use of simple, minimal configuration\n",
            "subsections": []
        },
        "Suppose we have a command-line application whose job is to stop, start": {
            "content": "or restart some services.  This could be organised for the purposes of\nillustration as a file 'app.py' that is the main script for the\napplication, with individual commands implemented in 'start.py',\n'stop.py' and 'restart.py'.  Suppose further that we want to control the\nverbosity of the application via a command-line argument, defaulting to\n'logging.INFO'.  Here's one way that 'app.py' could be written:\n\nimport argparse\nimport importlib\nimport logging\nimport os\nimport sys\n\ndef main(args=None):\nscriptname = os.path.basename(file)\nparser = argparse.ArgumentParser(scriptname)\nlevels = ('DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL')\nparser.addargument('--log-level', default='INFO', choices=levels)\nsubparsers = parser.addsubparsers(dest='command',\nhelp='Available commands:')\nstartcmd = subparsers.addparser('start', help='Start a service')\nstartcmd.addargument('name', metavar='NAME',\nhelp='Name of service to start')\nstopcmd = subparsers.addparser('stop',\nhelp='Stop one or more services')\nstopcmd.addargument('names', metavar='NAME', nargs='+',\nhelp='Name of service to stop')\nrestartcmd = subparsers.addparser('restart',\nhelp='Restart one or more services')\nrestartcmd.addargument('names', metavar='NAME', nargs='+',\nhelp='Name of service to restart')\noptions = parser.parseargs()\n# the code to dispatch commands could all be in this file. For the purposes\n# of illustration only, we implement each command in a separate module.\ntry:\nmod = importlib.importmodule(options.command)\ncmd = getattr(mod, 'command')\nexcept (ImportError, AttributeError):\nprint('Unable to find the code for command \\'%s\\'' % options.command)\nreturn 1\n# Could get fancy here and load configuration from file or dictionary\nlogging.basicConfig(level=options.loglevel,\nformat='%(levelname)s %(name)s %(message)s')\ncmd(options)\n\nif name == 'main':\nsys.exit(main())\n",
            "subsections": []
        },
        "And the 'start', 'stop' and 'restart' commands can be implemented in": {
            "content": "separate modules, like so for starting:\n\n# start.py\nimport logging\n\nlogger = logging.getLogger(name)\n\ndef command(options):\nlogger.debug('About to start %s', options.name)\n# actually do the command processing here ...\nlogger.info('Started the \\'%s\\' service.', options.name)\n\nand thus for stopping:\n\n# stop.py\nimport logging\n\nlogger = logging.getLogger(name)\n\ndef command(options):\nn = len(options.names)\nif n == 1:\nplural = ''\nservices = '\\'%s\\'' % options.names[0]\nelse:\nplural = 's'\nservices = ', '.join('\\'%s\\'' % name for name in options.names)\ni = services.rfind(', ')\nservices = services[:i] + ' and ' + services[i + 2:]\nlogger.debug('About to stop %s', services)\n# actually do the command processing here ...\nlogger.info('Stopped the %s service%s.', services, plural)\n\nand similarly for restarting:\n\n# restart.py\nimport logging\n\nlogger = logging.getLogger(name)\n\ndef command(options):\nn = len(options.names)\nif n == 1:\nplural = ''\nservices = '\\'%s\\'' % options.names[0]\nelse:\nplural = 's'\nservices = ', '.join('\\'%s\\'' % name for name in options.names)\ni = services.rfind(', ')\nservices = services[:i] + ' and ' + services[i + 2:]\nlogger.debug('About to restart %s', services)\n# actually do the command processing here ...\nlogger.info('Restarted the %s service%s.', services, plural)\n",
            "subsections": []
        },
        "If we run this application with the default log level, we get output": {
            "content": "like this:\n\n$ python app.py start foo\nINFO start Started the 'foo' service.\n\n$ python app.py stop foo bar\nINFO stop Stopped the 'foo' and 'bar' services.\n\n$ python app.py restart foo bar baz\nINFO restart Restarted the 'foo', 'bar' and 'baz' services.\n",
            "subsections": []
        },
        "The first word is the logging level, and the second word is the module": {
            "content": "or package name of the place where the event was logged.\n",
            "subsections": []
        },
        "If we change the logging level, then we can change the information sent": {
            "content": "to the log.  For example, if we want more information:\n\n$ python app.py --log-level DEBUG start foo\nDEBUG start About to start foo\nINFO start Started the 'foo' service.\n\n$ python app.py --log-level DEBUG stop foo bar\nDEBUG stop About to stop 'foo' and 'bar'\nINFO stop Stopped the 'foo' and 'bar' services.\n\n$ python app.py --log-level DEBUG restart foo bar baz\nDEBUG restart About to restart 'foo', 'bar' and 'baz'\nINFO restart Restarted the 'foo', 'bar' and 'baz' services.\n\nAnd if we want less:\n\n$ python app.py --log-level WARNING start foo\n$ python app.py --log-level WARNING stop foo bar\n$ python app.py --log-level WARNING restart foo bar baz\n",
            "subsections": []
        },
        "In this case, the commands don't print anything to the console, since": {
            "content": "nothing at 'WARNING' level or above is logged by them.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: A Qt GUI for logging,  Next: Logging to syslog with RFC5424 support,  Prev: A CLI application starter template,  Up: Logging Cookbook": {
            "content": "A question that comes up from time to time is about how to log to a GUI\napplication.  The Qt(1) framework is a popular cross-platform UI\nframework with Python bindings using PySide2(2) or PyQt5(3) libraries.\n",
            "subsections": []
        },
        "The following example shows how to log to a Qt GUI. This introduces a": {
            "content": "simple 'QtHandler' class which takes a callable, which should be a slot\nin the main thread that does GUI updates.  A worker thread is also\ncreated to show how you can log to the GUI from both the UI itself (via\na button for manual logging) as well as a worker thread doing work in\nthe background (here, just logging messages at random levels with random\nshort delays in between).\n",
            "subsections": []
        },
        "The worker thread is implemented using Qt's 'QThread' class rather than": {
            "content": "the *note threading: e7. module, as there are circumstances where one\nhas to use 'QThread', which offers better integration with other 'Qt'\ncomponents.\n",
            "subsections": []
        },
        "The code should work with recent releases of any of 'PySide6', 'PyQt6',": {
            "content": "'PySide2' or 'PyQt5'.  You should be able to adapt the approach to\nearlier versions of Qt.  Please refer to the comments in the code\nsnippet for more detailed information.\n\nimport datetime\nimport logging\nimport random\nimport sys\nimport time\n\n# Deal with minor differences between different Qt packages\ntry:\nfrom PySide6 import QtCore, QtGui, QtWidgets\nSignal = QtCore.Signal\nSlot = QtCore.Slot\nexcept ImportError:\ntry:\nfrom PyQt6 import QtCore, QtGui, QtWidgets\nSignal = QtCore.pyqtSignal\nSlot = QtCore.pyqtSlot\nexcept ImportError:\ntry:\nfrom PySide2 import QtCore, QtGui, QtWidgets\nSignal = QtCore.Signal\nSlot = QtCore.Slot\nexcept ImportError:\nfrom PyQt5 import QtCore, QtGui, QtWidgets\nSignal = QtCore.pyqtSignal\nSlot = QtCore.pyqtSlot\n\nlogger = logging.getLogger(name)\n\n\n#\n# Signals need to be contained in a QObject or subclass in order to be correctly\n# initialized.\n#\nclass Signaller(QtCore.QObject):\nsignal = Signal(str, logging.LogRecord)\n\n#\n# Output to a Qt GUI is only supposed to happen on the main thread. So, this\n# handler is designed to take a slot function which is set up to run in the main\n# thread. In this example, the function takes a string argument which is a\n# formatted log message, and the log record which generated it. The formatted\n# string is just a convenience - you could format a string for output any way\n# you like in the slot function itself.\n#\n# You specify the slot function to do whatever GUI updates you want. The handler\n# doesn't know or care about specific UI elements.\n#\nclass QtHandler(logging.Handler):\ndef init(self, slotfunc, *args, kwargs):\nsuper().init(*args, kwargs)\nself.signaller = Signaller()\nself.signaller.signal.connect(slotfunc)\n\ndef emit(self, record):\ns = self.format(record)\nself.signaller.signal.emit(s, record)\n\n#\n# This example uses QThreads, which means that the threads at the Python level\n# are named something like \"Dummy-1\". The function below gets the Qt name of the\n# current thread.\n#\ndef ctname():\nreturn QtCore.QThread.currentThread().objectName()\n\n\n#\n# Used to generate random levels for logging.\n#\nLEVELS = (logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR,\nlogging.CRITICAL)\n\n#\n# This worker class represents work that is done in a thread separate to the\n# main thread. The way the thread is kicked off to do work is via a button press\n# that connects to a slot in the worker.\n#\n# Because the default threadName value in the LogRecord isn't much use, we add\n# a qThreadName which contains the QThread name as computed above, and pass that\n# value in an \"extra\" dictionary which is used to update the LogRecord with the\n# QThread name.\n#\n# This example worker just outputs messages sequentially, interspersed with\n# random delays of the order of a few seconds.\n#\nclass Worker(QtCore.QObject):\n@Slot()\ndef start(self):\nextra = {'qThreadName': ctname() }\nlogger.debug('Started work', extra=extra)\ni = 1\n# Let the thread run until interrupted. This allows reasonably clean\n# thread termination.\nwhile not QtCore.QThread.currentThread().isInterruptionRequested():\ndelay = 0.5 + random.random() * 2\ntime.sleep(delay)\ntry:\nif random.random() < 0.1:\nraise ValueError('Exception raised: %d' % i)\nelse:\nlevel = random.choice(LEVELS)\nlogger.log(level, 'Message after delay of %3.1f: %d', delay, i, extra=extra)\nexcept ValueError as e:\nlogger.exception('Failed: %s', e, extra=extra)\ni += 1\n\n#\n# Implement a simple UI for this cookbook example. This contains:\n#\n# * A read-only text edit window which holds formatted log messages\n# * A button to start work and log stuff in a separate thread\n# * A button to log something from the main thread\n# * A button to clear the log window\n#\nclass Window(QtWidgets.QWidget):\n\nCOLORS = {\nlogging.DEBUG: 'black',\nlogging.INFO: 'blue',\nlogging.WARNING: 'orange',\nlogging.ERROR: 'red',\nlogging.CRITICAL: 'purple',\n}\n\ndef init(self, app):\nsuper().init()\nself.app = app\nself.textedit = te = QtWidgets.QPlainTextEdit(self)\n# Set whatever the default monospace font is for the platform\nf = QtGui.QFont('nosuchfont')\nif hasattr(f, 'Monospace'):\nf.setStyleHint(f.Monospace)\nelse:\nf.setStyleHint(f.StyleHint.Monospace)  # for Qt6\nte.setFont(f)\nte.setReadOnly(True)\nPB = QtWidgets.QPushButton\nself.workbutton = PB('Start background work', self)\nself.logbutton = PB('Log a message at a random level', self)\nself.clearbutton = PB('Clear log window', self)\nself.handler = h = QtHandler(self.updatestatus)\n# Remember to use qThreadName rather than threadName in the format string.\nfs = '%(asctime)s %(qThreadName)-12s %(levelname)-8s %(message)s'\nformatter = logging.Formatter(fs)\nh.setFormatter(formatter)\nlogger.addHandler(h)\n# Set up to terminate the QThread when we exit\napp.aboutToQuit.connect(self.forcequit)\n\n# Lay out all the widgets\nlayout = QtWidgets.QVBoxLayout(self)\nlayout.addWidget(te)\nlayout.addWidget(self.workbutton)\nlayout.addWidget(self.logbutton)\nlayout.addWidget(self.clearbutton)\nself.setFixedSize(900, 400)\n\n# Connect the non-worker slots and signals\nself.logbutton.clicked.connect(self.manualupdate)\nself.clearbutton.clicked.connect(self.cleardisplay)\n\n# Start a new worker thread and connect the slots for the worker\nself.startthread()\nself.workbutton.clicked.connect(self.worker.start)\n# Once started, the button should be disabled\nself.workbutton.clicked.connect(lambda : self.workbutton.setEnabled(False))\n\ndef startthread(self):\nself.worker = Worker()\nself.workerthread = QtCore.QThread()\nself.worker.setObjectName('Worker')\nself.workerthread.setObjectName('WorkerThread')  # for qThreadName\nself.worker.moveToThread(self.workerthread)\n# This will start an event loop in the worker thread\nself.workerthread.start()\n\ndef killthread(self):\n# Just tell the worker to stop, then tell it to quit and wait for that\n# to happen\nself.workerthread.requestInterruption()\nif self.workerthread.isRunning():\nself.workerthread.quit()\nself.workerthread.wait()\nelse:\nprint('worker has already exited.')\n\ndef forcequit(self):\n# For use when the window is closed\nif self.workerthread.isRunning():\nself.killthread()\n\n# The functions below update the UI and run in the main thread because\n# that's where the slots are set up\n\n@Slot(str, logging.LogRecord)\ndef updatestatus(self, status, record):\ncolor = self.COLORS.get(record.levelno, 'black')\ns = '<pre><font color=\"%s\">%s</font></pre>' % (color, status)\nself.textedit.appendHtml(s)\n\n@Slot()\ndef manualupdate(self):\n# This function uses the formatted message passed in, but also uses\n# information from the record to format the message in an appropriate\n# color according to its severity (level).\nlevel = random.choice(LEVELS)\nextra = {'qThreadName': ctname() }\nlogger.log(level, 'Manually logged!', extra=extra)\n\n@Slot()\ndef cleardisplay(self):\nself.textedit.clear()\n\n\ndef main():\nQtCore.QThread.currentThread().setObjectName('MainThread')\nlogging.getLogger().setLevel(logging.DEBUG)\napp = QtWidgets.QApplication(sys.argv)\nexample = Window(app)\nexample.show()\nif hasattr(app, 'exec'):\nrc = app.exec()\nelse:\nrc = app.exec()\nsys.exit(rc)\n\nif name=='main':\nmain()\n\n---------- Footnotes ----------\n\n(1) https://www.qt.io/\n\n(2) https://pypi.org/project/PySide2/\n\n(3) https://pypi.org/project/PyQt5/\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "Although RFC 5424(1) dates from 2009, most syslog servers are configured": {
            "content": "by default to use the older RFC 3164(2), which hails from 2001.  When\n'logging' was added to Python in 2003, it supported the earlier (and\nonly existing) protocol at the time.  Since RFC5424 came out, as there\nhas not been widespread deployment of it in syslog servers, the *note\nSysLogHandler: 426. functionality has not been updated.\n\nRFC 5424 contains some useful features such as support for structured\ndata, and if you need to be able to log to a syslog server with support\nfor it, you can do so with a subclassed handler which looks something\nlike this:\n\nimport datetime\nimport logging.handlers\nimport re\nimport socket\nimport time\n\nclass SysLogHandler5424(logging.handlers.SysLogHandler):\n\ntzoffset = re.compile(r'([+-]\\d{2})(\\d{2})$')\nescaped = re.compile(r'([\\]\"\\\\])')\n\ndef init(self, *args, kwargs):\nself.msgid = kwargs.pop('msgid', None)\nself.appname = kwargs.pop('appname', None)\nsuper().init(*args, kwargs)\n\ndef format(self, record):\nversion = 1\nasctime = datetime.datetime.fromtimestamp(record.created).isoformat()\nm = self.tzoffset.match(time.strftime('%z'))\nhasoffset = False\nif m and time.timezone:\nhrs, mins = m.groups()\nif int(hrs) or int(mins):\nhasoffset = True\nif not hasoffset:\nasctime += 'Z'\nelse:\nasctime += f'{hrs}:{mins}'\ntry:\nhostname = socket.gethostname()\nexcept Exception:\nhostname = '-'\nappname = self.appname or '-'\nprocid = record.process\nmsgid = '-'\nmsg = super().format(record)\nsdata = '-'\nif hasattr(record, 'structureddata'):\nsd = record.structureddata\n# This should be a dict where the keys are SD-ID and the value is a\n# dict mapping PARAM-NAME to PARAM-VALUE (refer to the RFC for what these\n# mean)\n# There's no error checking here - it's purely for illustration, and you\n# can adapt this code for use in production environments\nparts = []\n\ndef replacer(m):\ng = m.groups()\nreturn '\\\\' + g[0]\n\nfor sdid, dv in sd.items():\npart = f'[{sdid}'\nfor k, v in dv.items():\ns = str(v)\ns = self.escaped.sub(replacer, s)\npart += f' {k}=\"{s}\"'\npart += ']'\nparts.append(part)\nsdata = ''.join(parts)\nreturn f'{version} {asctime} {hostname} {appname} {procid} {msgid} {sdata} {msg}'\n",
            "subsections": []
        },
        "You'll need to be familiar with RFC 5424 to fully understand the above": {
            "content": "code, and it may be that you have slightly different needs (e.g.  for\nhow you pass structural data to the log).  Nevertheless, the above\nshould be adaptable to your speciric needs.  With the above handler,\nyou'd pass structured data using something like this:\n\nsd = {\n'foo@12345': {'bar': 'baz', 'baz': 'bozz', 'fizz': r'buzz'},\n'foo@54321': {'rab': 'baz', 'zab': 'bozz', 'zzif': r'buzz'}\n}\nextra = {'structureddata': sd}\ni = 1\nlogger.debug('Message %d', i, extra=extra)\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc5424.html\n\n(2) https://datatracker.ietf.org/doc/html/rfc3164.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: How to treat a logger like an output stream,  Next: Patterns to avoid,  Prev: Logging to syslog with RFC5424 support,  Up: Logging Cookbook": {
            "content": "",
            "subsections": []
        },
        "Sometimes, you need to interface to a third-party API which expects a": {
            "content": "file-like object to write to, but you want to direct the API's output to\na logger.  You can do this using a class which wraps a logger with a\nfile-like API. Here's a short script illustrating such a class:\n\nimport logging\n\nclass LoggerWriter:\ndef init(self, logger, level):\nself.logger = logger\nself.level = level\n\ndef write(self, message):\nif message != '\\n':  # avoid printing bare newlines, if you like\nself.logger.log(self.level, message)\n\ndef flush(self):\n# doesn't actually do anything, but might be expected of a file-like\n# object - so optional depending on your situation\npass\n\ndef close(self):\n# doesn't actually do anything, but might be expected of a file-like\n# object - so optional depending on your situation. You might want\n# to set a flag so that later calls to write raise an exception\npass\n\ndef main():\nlogging.basicConfig(level=logging.DEBUG)\nlogger = logging.getLogger('demo')\ninfofp = LoggerWriter(logger, logging.INFO)\ndebugfp = LoggerWriter(logger, logging.DEBUG)\nprint('An INFO message', file=infofp)\nprint('A DEBUG message', file=debugfp)\n\nif name == \"main\":\nmain()\n",
            "subsections": []
        },
        "When this script is run, it prints": {
            "content": "INFO:demo:An INFO message\nDEBUG:demo:A DEBUG message\n",
            "subsections": []
        },
        "You could also use 'LoggerWriter' to redirect 'sys.stdout' and": {
            "content": "'sys.stderr' by doing something like this:\n\nimport sys\n\nsys.stdout = LoggerWriter(logger, logging.INFO)\nsys.stderr = LoggerWriter(logger, logging.WARNING)\n",
            "subsections": []
        },
        "You should do this 'after' configuring logging for your needs.  In the": {
            "content": "above example, the *note basicConfig(): 828. call does this (using the\n'sys.stderr' value 'before' it is overwritten by a 'LoggerWriter'\ninstance).  Then, you'd get this kind of result:\n\n>>> print('Foo')\nINFO:demo:Foo\n>>> print('Bar', file=sys.stderr)\nWARNING:demo:Bar\n>>>\n",
            "subsections": []
        },
        "Of course, the examples above show output according to the format used": {
            "content": "by *note basicConfig(): 828, but you can use a different formatter when\nyou configure logging.\n",
            "subsections": []
        },
        "Note that with the above scheme, you are somewhat at the mercy of": {
            "content": "buffering and the sequence of write calls which you are intercepting.",
            "subsections": []
        },
        "For example, with the definition of 'LoggerWriter' above, if you have": {
            "content": "the snippet\n\nsys.stderr = LoggerWriter(logger, logging.WARNING)\n1 / 0\n\nthen running the script results in\n\nWARNING:demo:Traceback (most recent call last):\n\nWARNING:demo:  File \"/home/runner/cookbook-loggerwriter/test.py\", line 53, in <module>\n\nWARNING:demo:\nWARNING:demo:main()\nWARNING:demo:  File \"/home/runner/cookbook-loggerwriter/test.py\", line 49, in main\n\nWARNING:demo:\nWARNING:demo:1 / 0\nWARNING:demo:ZeroDivisionError\nWARNING:demo::\nWARNING:demo:division by zero\n",
            "subsections": []
        },
        "As you can see, this output isn't ideal.  That's because the underlying": {
            "content": "code which writes to 'sys.stderr' makes multiple writes, each of which\nresults in a separate logged line (for example, the last three lines\nabove).  To get around this problem, you need to buffer things and only\noutput log lines when newlines are seen.  Let's use a slghtly better\nimplementation of 'LoggerWriter':\n\nclass BufferingLoggerWriter(LoggerWriter):\ndef init(self, logger, level):\nsuper().init(logger, level)\nself.buffer = ''\n\ndef write(self, message):\nif '\\n' not in message:\nself.buffer += message\nelse:\nparts = message.split('\\n')\nif self.buffer:\ns = self.buffer + parts.pop(0)\nself.logger.log(self.level, s)\nself.buffer = parts.pop()\nfor part in parts:\nself.logger.log(self.level, part)\n",
            "subsections": []
        },
        "This just buffers up stuff until a newline is seen, and then logs": {
            "content": "complete lines.  With this approach, you get better output:\n\nWARNING:demo:Traceback (most recent call last):\nWARNING:demo:  File \"/home/runner/cookbook-loggerwriter/main.py\", line 55, in <module>\nWARNING:demo:    main()\nWARNING:demo:  File \"/home/runner/cookbook-loggerwriter/main.py\", line 52, in main\nWARNING:demo:    1/0\nWARNING:demo:ZeroDivisionError: division by zero\n\nFile: python3.12.info,  Node: Patterns to avoid,  Next: Other resources<2>,  Prev: How to treat a logger like an output stream,  Up: Logging Cookbook\n\n",
            "subsections": []
        },
        "Although the preceding sections have described ways of doing things you": {
            "content": "might need to do or deal with, it is worth mentioning some usage\npatterns which are 'unhelpful', and which should therefore be avoided in\nmost cases.  The following sections are in no particular order.\n\n* Menu:\n\n* Opening the same log file multiple times::\n* Using loggers as attributes in a class or passing them as parameters::\n* Adding handlers other than NullHandler to a logger in a library::\n* Creating a lot of loggers::\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "9.8.36.1 Opening the same log file multiple times\n.................................................\n",
            "subsections": []
        },
        "On Windows, you will generally not be able to open the same file": {
            "content": "multiple times as this will lead to a \"file is in use by another\nprocess\" error.  However, on POSIX platforms you'll not get any errors\nif you open the same file multiple times.  This could be done\naccidentally, for example by:\n\n* Adding a file handler more than once which references the same file\n(e.g.  by a copy/paste/forget-to-change error).\n\n* Opening two files that look different, as they have different\nnames, but are the same because one is a symbolic link to the\nother.\n\n* Forking a process, following which both parent and child have a\nreference to the same file.  This might be through use of the *note\nmultiprocessing: 8f. module, for example.\n",
            "subsections": []
        },
        "Opening a file multiple times might 'appear' to work most of the time,": {
            "content": "but can lead to a number of problems in practice:\n\n* Logging output can be garbled because multiple threads or processes\ntry to write to the same file.  Although logging guards against\nconcurrent use of the same handler instance by multiple threads,\nthere is no such protection if concurrent writes are attempted by\ntwo different threads using two different handler instances which\nhappen to point to the same file.\n\n* An attempt to delete a file (e.g.  during file rotation) silently\nfails, because there is another reference pointing to it.  This can\nlead to confusion and wasted debugging time - log entries end up in\nunexpected places, or are lost altogether.  Or a file that was\nsupposed to be moved remains in place, and grows in size\nunexpectedly despite size-based rotation being supposedly in place.\n\nUse the techniques outlined in *note Logging to a single file from\nmultiple processes: 4d19. to circumvent such issues.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "9.8.36.2 Using loggers as attributes in a class or passing them as parameters\n.............................................................................\n",
            "subsections": []
        },
        "While there might be unusual cases where you'll need to do this, in": {
            "content": "general there is no point because loggers are singletons.  Code can\nalways access a given logger instance by name using\n'logging.getLogger(name)', so passing instances around and holding them\nas instance attributes is pointless.  Note that in other languages such\nas Java and C#, loggers are often static class attributes.  However,\nthis pattern doesn't make sense in Python, where the module (and not the\nclass) is the unit of software decomposition.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "9.8.36.3 Adding handlers other than 'NullHandler' to a logger in a library\n..........................................................................\n",
            "subsections": []
        },
        "Configuring logging by adding handlers, formatters and filters is the": {
            "content": "responsibility of the application developer, not the library developer.",
            "subsections": []
        },
        "If you are maintaining a library, ensure that you don't add handlers to": {
            "content": "any of your loggers other than a *note NullHandler: 10fd. instance.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Creating a lot of loggers,  Prev: Adding handlers other than NullHandler to a logger in a library,  Up: Patterns to avoid": {
            "content": "9.8.36.4 Creating a lot of loggers\n..................................\n",
            "subsections": []
        },
        "Loggers are singletons that are never freed during a script execution,": {
            "content": "and so creating lots of loggers will use up memory which can't then be\nfreed.  Rather than create a logger per e.g.  file processed or network\nconnection made, use the *note existing mechanisms: 29fa. for passing\ncontextual information into your logs and restrict the loggers created\nto those describing areas within your application (generally modules,\nbut occasionally slightly more fine-grained than that).\n\nFile: python3.12.info,  Node: Other resources<2>,  Prev: Patterns to avoid,  Up: Logging Cookbook\n\n\nSee also\n........\n\nModule *note logging: 82.\n\nAPI reference for the logging module.\n\nModule *note logging.config: 83.\n\nConfiguration API for the logging module.\n\nModule *note logging.handlers: 84.\n\nUseful handlers included with the logging module.\n\n*note Basic Tutorial: 1069.\n\n*note Advanced Tutorial: 106a.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Regular Expression HOWTO,  Next: Socket Programming HOWTO,  Prev: Logging Cookbook,  Up: Python HOWTOs": {
            "content": "",
            "subsections": [
                {
                    "name": "9.9 Regular Expression HOWTO",
                    "content": "Author: A.M. Kuchling <<amk@amk.ca>>\n"
                }
            ]
        },
        "This document is an introductory tutorial to using regular expressions": {
            "content": "in Python with the *note re: b4. module.  It provides a gentler\nintroduction than the corresponding section in the Library Reference.\n\n* Menu:\n\n* Introduction: Introduction<14>.\n* Simple Patterns::\n* Using Regular Expressions::\n* More Pattern Power::\n* Modifying Strings::\n* Common Problems::\n* Feedback::\n\nFile: python3.12.info,  Node: Introduction<14>,  Next: Simple Patterns,  Up: Regular Expression HOWTO\n\n",
            "subsections": []
        },
        "Regular expressions (called REs, or regexes, or regex patterns) are": {
            "content": "essentially a tiny, highly specialized programming language embedded\ninside Python and made available through the *note re: b4. module.",
            "subsections": []
        },
        "Using this little language, you specify the rules for the set of": {
            "content": "possible strings that you want to match; this set might contain English\nsentences, or e-mail addresses, or TeX commands, or anything you like.\nYou can then ask questions such as \"Does this string match the\npattern?\", or \"Is there a match for the pattern anywhere in this\nstring?\".  You can also use REs to modify a string or to split it apart\nin various ways.\n",
            "subsections": []
        },
        "Regular expression patterns are compiled into a series of bytecodes": {
            "content": "which are then executed by a matching engine written in C. For advanced\nuse, it may be necessary to pay careful attention to how the engine will\nexecute a given RE, and write the RE in a certain way in order to\nproduce bytecode that runs faster.  Optimization isn't covered in this\ndocument, because it requires that you have a good understanding of the\nmatching engine's internals.\n",
            "subsections": []
        },
        "The regular expression language is relatively small and restricted, so": {
            "content": "not all possible string processing tasks can be done using regular\nexpressions.  There are also tasks that 'can' be done with regular\nexpressions, but the expressions turn out to be very complicated.  In\nthese cases, you may be better off writing Python code to do the\nprocessing; while Python code will be slower than an elaborate regular\nexpression, it will also probably be more understandable.\n\nFile: python3.12.info,  Node: Simple Patterns,  Next: Using Regular Expressions,  Prev: Introduction<14>,  Up: Regular Expression HOWTO\n\n\nWe'll start by learning about the simplest possible regular expressions.",
            "subsections": []
        },
        "Since regular expressions are used to operate on strings, we'll begin": {
            "content": "with the most common task: matching characters.\n",
            "subsections": []
        },
        "For a detailed explanation of the computer science underlying regular": {
            "content": "expressions (deterministic and non-deterministic finite automata), you\ncan refer to almost any textbook on writing compilers.\n\n* Menu:\n\n* Matching Characters::\n* Repeating Things::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Matching Characters,  Next: Repeating Things,  Up: Simple Patterns": {
            "content": "9.9.2.1 Matching Characters\n...........................\n",
            "subsections": []
        },
        "Most letters and characters will simply match themselves.  For example,": {
            "content": "the regular expression 'test' will match the string 'test' exactly.\n(You can enable a case-insensitive mode that would let this RE match\n'Test' or 'TEST' as well; more about this later.)\n",
            "subsections": []
        },
        "There are exceptions to this rule; some characters are special": {
            "content": "'metacharacters', and don't match themselves.  Instead, they signal that\nsome out-of-the-ordinary thing should be matched, or they affect other\nportions of the RE by repeating them or changing their meaning.  Much of\nthis document is devoted to discussing various metacharacters and what\nthey do.\n",
            "subsections": []
        },
        "Here's a complete list of the metacharacters; their meanings will be": {
            "content": "discussed in the rest of this HOWTO.\n\n. ^ $ * + ? { } [ ] \\ | ( )\n\nThe first metacharacters we'll look at are '[' and ']'.  They're used\nfor specifying a character class, which is a set of characters that you\nwish to match.  Characters can be listed individually, or a range of\ncharacters can be indicated by giving two characters and separating them\nby a ''-''.  For example, '[abc]' will match any of the characters 'a',\n'b', or 'c'; this is the same as '[a-c]', which uses a range to express\nthe same set of characters.  If you wanted to match only lowercase\nletters, your RE would be '[a-z]'.\n\nMetacharacters (except '\\') are not active inside classes.  For example,\n'[akm$]' will match any of the characters ''a'', ''k'', ''m'', or ''$'';\n''$'' is usually a metacharacter, but inside a character class it's\nstripped of its special nature.\n",
            "subsections": []
        },
        "You can match the characters not listed within the class by": {
            "content": "'complementing' the set.  This is indicated by including a ''^'' as the\nfirst character of the class.  For example, '[^5]' will match any\ncharacter except ''5''.  If the caret appears elsewhere in a character\nclass, it does not have special meaning.  For example: '[5^]' will match\neither a ''5'' or a ''^''.\n\nPerhaps the most important metacharacter is the backslash, '\\'.  As in",
            "subsections": []
        },
        "Python string literals, the backslash can be followed by various": {
            "content": "characters to signal various special sequences.  It's also used to\nescape all the metacharacters so you can still match them in patterns;\nfor example, if you need to match a '[' or '\\', you can precede them\nwith a backslash to remove their special meaning: '\\[' or '\\\\'.\n\nSome of the special sequences beginning with ''\\'' represent predefined\nsets of characters that are often useful, such as the set of digits, the\nset of letters, or the set of anything that isn't whitespace.\n\nLet's take an example: '\\w' matches any alphanumeric character.  If the\nregex pattern is expressed in bytes, this is equivalent to the class\n'[a-zA-Z0-9]'.  If the regex pattern is a string, '\\w' will match all\nthe characters marked as letters in the Unicode database provided by the\n*note unicodedata: 100. module.  You can use the more restricted\ndefinition of '\\w' in a string pattern by supplying the *note re.ASCII:\n3f9. flag when compiling the regular expression.\n",
            "subsections": []
        },
        "The following list of special sequences isn't complete.  For a complete": {
            "content": "list of sequences and expanded class definitions for Unicode string\npatterns, see the last part of *note Regular Expression Syntax: 503. in\nthe Standard Library reference.  In general, the Unicode versions match\nany character that's in the appropriate category in the Unicode\ndatabase.\n\n'\\d'\n\nMatches any decimal digit; this is equivalent to the class '[0-9]'.\n\n'\\D'\n\nMatches any non-digit character; this is equivalent to the class\n'[^0-9]'.\n\n'\\s'\n\nMatches any whitespace character; this is equivalent to the class\n'[ \\t\\n\\r\\f\\v]'.\n\n'\\S'\n\nMatches any non-whitespace character; this is equivalent to the\nclass '[^ \\t\\n\\r\\f\\v]'.\n\n'\\w'\n\nMatches any alphanumeric character; this is equivalent to the class\n'[a-zA-Z0-9]'.\n\n'\\W'\n\nMatches any non-alphanumeric character; this is equivalent to the\nclass '[^a-zA-Z0-9]'.\n",
            "subsections": []
        },
        "These sequences can be included inside a character class.  For example,": {
            "content": "'[\\s,.]' is a character class that will match any whitespace character,\nor '','' or ''.''.\n",
            "subsections": []
        },
        "The final metacharacter in this section is '.'.  It matches anything": {
            "content": "except a newline character, and there's an alternate mode (*note\nre.DOTALL: 1ffe.) where it will match even a newline.  '.' is often used\nwhere you want to match \"any character\".\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Repeating Things,  Prev: Matching Characters,  Up: Simple Patterns": {
            "content": "9.9.2.2 Repeating Things\n........................\n",
            "subsections": []
        },
        "Being able to match varying sets of characters is the first thing": {
            "content": "regular expressions can do that isn't already possible with the methods\navailable on strings.  However, if that was the only additional\ncapability of regexes, they wouldn't be much of an advance.  Another\ncapability is that you can specify that portions of the RE must be\nrepeated a certain number of times.\n\nThe first metacharacter for repeating things that we'll look at is '*'.\n'*' doesn't match the literal character ''*''; instead, it specifies\nthat the previous character can be matched zero or more times, instead\nof exactly once.\n\nFor example, 'ca*t' will match ''ct'' (0 ''a'' characters), ''cat'' (1\n''a''), ''caaat'' (3 ''a'' characters), and so forth.\n\nRepetitions such as '*' are 'greedy'; when repeating a RE, the matching\nengine will try to repeat it as many times as possible.  If later\nportions of the pattern don't match, the matching engine will then back\nup and try again with fewer repetitions.\n\nA step-by-step example will make this more obvious.  Let's consider the\nexpression 'a[bcd]*b'.  This matches the letter ''a'', zero or more\nletters from the class '[bcd]', and finally ends with a ''b''.  Now\nimagine matching this RE against the string ''abcbd''.\n",
            "subsections": []
        },
        "Step       Matched         Explanation": {
            "content": "-----------------------------------------------------------------\n\n1          'a'             The 'a' in the RE matches.\n\n\n2          'abcbd'         The engine matches '[bcd]*', going\nas far as it can, which is to the\nend of the string.\n\n\n3          'Failure'       The engine tries to match 'b', but\nthe current position is at the end\nof the string, so it fails.\n\n\n4          'abcb'          Back up, so that '[bcd]*' matches\none less character.\n\n\n5          'Failure'       Try 'b' again, but the current\nposition is at the last character,\nwhich is a ''d''.\n\n\n6          'abc'           Back up again, so that '[bcd]*' is\nonly matching 'bc'.\n\n\n6          'abcb'          Try 'b' again.  This time the\ncharacter at the current position\nis ''b'', so it succeeds.\n\n\nThe end of the RE has now been reached, and it has matched ''abcb''.",
            "subsections": []
        },
        "This demonstrates how the matching engine goes as far as it can at": {
            "content": "first, and if no match is found it will then progressively back up and\nretry the rest of the RE again and again.  It will back up until it has\ntried zero matches for '[bcd]*', and if that subsequently fails, the\nengine will conclude that the string doesn't match the RE at all.\n\nAnother repeating metacharacter is '+', which matches one or more times.\nPay careful attention to the difference between '*' and '+'; '*' matches\n'zero' or more times, so whatever's being repeated may not be present at\nall, while '+' requires at least 'one' occurrence.  To use a similar\nexample, 'ca+t' will match ''cat'' (1 ''a''), ''caaat'' (3 ''a''s), but\nwon't match ''ct''.\n",
            "subsections": []
        },
        "There are two more repeating operators or quantifiers.  The question": {
            "content": "mark character, '?', matches either once or zero times; you can think of\nit as marking something as being optional.  For example, 'home-?brew'\nmatches either ''homebrew'' or ''home-brew''.\n\nThe most complicated quantifier is '{m,n}', where 'm' and 'n' are\ndecimal integers.  This quantifier means there must be at least 'm'\nrepetitions, and at most 'n'.  For example, 'a/{1,3}b' will match\n''a/b'', ''a//b'', and ''a///b''.  It won't match ''ab'', which has no\nslashes, or ''a////b'', which has four.\n",
            "subsections": []
        },
        "You can omit either 'm' or 'n'; in that case, a reasonable value is": {
            "content": "assumed for the missing value.  Omitting 'm' is interpreted as a lower\nlimit of 0, while omitting 'n' results in an upper bound of infinity.\n\nThe simplest case '{m}' matches the preceding item exactly 'm' times.\nFor example, 'a/{2}b' will only match ''a//b''.\n",
            "subsections": []
        },
        "Readers of a reductionist bent may notice that the three other": {
            "content": "quantifiers can all be expressed using this notation.  '{0,}' is the\nsame as '*', '{1,}' is equivalent to '+', and '{0,1}' is the same as\n'?'.  It's better to use '*', '+', or '?' when you can, simply because\nthey're shorter and easier to read.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using Regular Expressions,  Next: More Pattern Power,  Prev: Simple Patterns,  Up: Regular Expression HOWTO": {
            "content": "",
            "subsections": []
        },
        "Now that we've looked at some simple regular expressions, how do we": {
            "content": "actually use them in Python?  The *note re: b4. module provides an\ninterface to the regular expression engine, allowing you to compile REs\ninto objects and then perform matches with them.\n\n* Menu:\n\n* Compiling Regular Expressions::\n* The Backslash Plague::\n* Performing Matches::\n* Module-Level Functions: Module-Level Functions<2>.\n* Compilation Flags::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Compiling Regular Expressions,  Next: The Backslash Plague,  Up: Using Regular Expressions": {
            "content": "9.9.3.1 Compiling Regular Expressions\n.....................................\n",
            "subsections": []
        },
        "Regular expressions are compiled into pattern objects, which have": {
            "content": "methods for various operations such as searching for pattern matches or\nperforming string substitutions.\n\n>>> import re\n>>> p = re.compile('ab*')\n>>> p\nre.compile('ab*')\n\n*note re.compile(): a17. also accepts an optional 'flags' argument, used\nto enable various special features and syntax variations.  We'll go over\nthe available settings later, but for now a single example will do:\n\n>>> p = re.compile('ab*', re.IGNORECASE)\n\nThe RE is passed to *note re.compile(): a17. as a string.  REs are\nhandled as strings because regular expressions aren't part of the core\nPython language, and no special syntax was created for expressing them.\n(There are applications that don't need REs at all, so there's no need\nto bloat the language specification by including them.)  Instead, the\n*note re: b4. module is simply a C extension module included with\nPython, just like the *note socket: c6. or *note zlib: 12d. modules.\n",
            "subsections": []
        },
        "Putting REs in strings keeps the Python language simpler, but has one": {
            "content": "disadvantage which is the topic of the next section.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The Backslash Plague,  Next: Performing Matches,  Prev: Compiling Regular Expressions,  Up: Using Regular Expressions": {
            "content": "9.9.3.2 The Backslash Plague\n............................\n",
            "subsections": []
        },
        "As stated earlier, regular expressions use the backslash character": {
            "content": "(''\\'') to indicate special forms or to allow special characters to be\nused without invoking their special meaning.  This conflicts with",
            "subsections": []
        },
        "Python's usage of the same character for the same purpose in string": {
            "content": "literals.\n\nLet's say you want to write a RE that matches the string '\\section',\nwhich might be found in a LaTeX file.  To figure out what to write in\nthe program code, start with the desired string to be matched.  Next,\nyou must escape any backslashes and other metacharacters by preceding\nthem with a backslash, resulting in the string '\\\\section'.  The\nresulting string that must be passed to *note re.compile(): a17. must be\n'\\\\section'.  However, to express this as a Python string literal, both\nbackslashes must be escaped 'again'.\n",
            "subsections": []
        },
        "Characters              Stage": {
            "content": "-----------------------------------------------------------------------\n\n'\\section'              Text string to be matched\n\n\n'\\\\section'             Escaped backslash for\n*note re.compile(): a17.\n\n\n'\"\\\\\\\\section\"'         Escaped backslashes for a string literal\n\n\nIn short, to match a literal backslash, one has to write ''\\\\\\\\'' as the\nRE string, because the regular expression must be '\\\\', and each\nbackslash must be expressed as '\\\\' inside a regular Python string\nliteral.  In REs that feature backslashes repeatedly, this leads to lots\nof repeated backslashes and makes the resulting strings difficult to\nunderstand.\n",
            "subsections": []
        },
        "In addition, special escape sequences that are valid in regular": {
            "content": "expressions, but not valid as Python string literals, now result in a\n*note DeprecationWarning: 179. and will eventually become a *note",
            "subsections": []
        },
        "SyntaxError: 146, which means the sequences will be invalid if raw": {
            "content": "string notation or escaping the backslashes isn't used.\n",
            "subsections": []
        },
        "Regular String          Raw string": {
            "content": "-----------------------------------------------\n\n'\"ab*\"'                 'r\"ab*\"'\n\n\n'\"\\\\\\\\section\"'         'r\"\\\\section\"'\n\n\n'\"\\\\w+\\\\s+\\\\1\"'         'r\"\\w+\\s+\\1\"'\n\n\nFile: python3.12.info,  Node: Performing Matches,  Next: Module-Level Functions<2>,  Prev: The Backslash Plague,  Up: Using Regular Expressions\n\n9.9.3.3 Performing Matches\n..........................\n",
            "subsections": []
        },
        "Once you have an object representing a compiled regular expression, what": {
            "content": "do you do with it?  Pattern objects have several methods and attributes.\nOnly the most significant ones will be covered here; consult the *note\nre: b4. docs for a complete listing.\n",
            "subsections": []
        },
        "Method/Attribute       Purpose": {
            "content": "---------------------------------------------------------------------------\n\n'split()'              Split the string into a list, splitting it\nwherever the RE matches\n\n\n'sub()'                Find all substrings where the RE matches, and\nreplace them with a different string\n\n\n'subn()'               Does the same thing as 'sub()', but returns the\nnew string and the number of replacements\n\n\n* Menu:\n\n* Splitting Strings::\n* Search and Replace: Search and Replace<2>.\n\nFile: python3.12.info,  Node: Splitting Strings,  Next: Search and Replace<2>,  Up: Modifying Strings\n\n9.9.5.1 Splitting Strings\n.........................\n\nThe *note split(): 2016. method of a pattern splits a string apart\nwherever the RE matches, returning a list of the pieces.  It's similar\nto the *note split(): d0e. method of strings but provides much more\ngenerality in the delimiters that you can split by; string 'split()'\nonly supports splitting by whitespace or by a fixed string.  As you'd\nexpect, there's a module-level *note re.split(): 9ae. function, too.\n\n-- Method: .split (string[, maxsplit=0])\n\nSplit 'string' by the matches of the regular expression.  If\ncapturing parentheses are used in the RE, then their contents will\nalso be returned as part of the resulting list.  If 'maxsplit' is\nnonzero, at most 'maxsplit' splits are performed.\n",
            "subsections": []
        },
        "Now, let's try it on a string that it should match, such as 'tempo'.  In": {
            "content": "this case, *note match(): 2010. will return a *note match object: df7,\nso you should store the result in a variable for later use.\n\n>>> m = p.match('tempo')\n>>> m\n<re.Match object; span=(0, 5), match='tempo'>\n\nNow you can query the *note match object: df7. for information about the\nmatching string.  Match object instances also have several methods and\nattributes; the most important ones are:\n",
            "subsections": []
        },
        "The 'r' prefix, making the literal a raw string literal, is needed in": {
            "content": "this example because escape sequences in a normal \"cooked\" string\nliteral that are not recognized by Python, as opposed to regular\nexpressions, now result in a *note DeprecationWarning: 179. and will\neventually become a *note SyntaxError: 146.  See *note The Backslash\nPlague: 4d56.\n\n*note findall(): 2017. has to create the entire list before it can be\nreturned as the result.  The *note finditer(): 2018. method returns a\nsequence of *note match object: df7. instances as an *note iterator:\n16a9.:\n\n>>> iterator = p.finditer('12 drummers drumming, 11 ... 10 ...')\n>>> iterator\n<callableiterator object at 0x...>\n>>> for match in iterator:\n...     print(match.span())\n...\n(0, 2)\n(22, 24)\n(29, 31)\n\nFile: python3.12.info,  Node: Module-Level Functions<2>,  Next: Compilation Flags,  Prev: Performing Matches,  Up: Using Regular Expressions\n\n9.9.3.4 Module-Level Functions\n..............................\n",
            "subsections": []
        },
        "You don't have to create a pattern object and call its methods; the": {
            "content": "*note re: b4. module also provides top-level functions called *note\nmatch(): 10a3, *note search(): 10a2, *note findall(): ea1, *note sub():\n1ff, and so forth.  These functions take the same arguments as the\ncorresponding pattern method with the RE string added as the first\nargument, and still return either 'None' or a *note match object: df7.\ninstance.\n\n>>> print(re.match(r'From\\s+', 'Fromage amk'))\nNone\n>>> re.match(r'From\\s+', 'From amk Thu May 14 19:12:10 1998')\n<re.Match object; span=(0, 5), match='From '>\n",
            "subsections": []
        },
        "Under the hood, these functions simply create a pattern object for you": {
            "content": "and call the appropriate method on it.  They also store the compiled\nobject in a cache, so future calls using the same RE won't need to parse\nthe pattern again and again.\n",
            "subsections": []
        },
        "Should you use these module-level functions, or should you get the": {
            "content": "pattern and call its methods yourself?  If you're accessing a regex\nwithin a loop, pre-compiling it will save a few function calls.  Outside\nof loops, there's not much difference thanks to the internal cache.\n\nFile: python3.12.info,  Node: Compilation Flags,  Prev: Module-Level Functions<2>,  Up: Using Regular Expressions\n\n9.9.3.5 Compilation Flags\n.........................\n",
            "subsections": []
        },
        "Compilation flags let you modify some aspects of how regular expressions": {
            "content": "work.  Flags are available in the *note re: b4. module under two names,\na long name such as *note IGNORECASE: 1467. and a short, one-letter form\nsuch as *note I: 2002.  (If you're familiar with Perl's pattern\nmodifiers, the one-letter forms use the same letters; the short form of\n*note re.VERBOSE: 200e. is *note re.X: 2007, for example.)  Multiple\nflags can be specified by bitwise OR-ing them; 're.I | re.M' sets both\nthe *note I: 2002. and *note M: 2004. flags, for example.\n",
            "subsections": []
        },
        "Here's a table of the available flags, followed by a more detailed": {
            "content": "explanation of each one.\n",
            "subsections": []
        },
        "Flag                                  Meaning": {
            "content": "---------------------------------------------------------------------------------------\n\n*note ASCII: 3f9, *note A: 2001.      Makes several escapes like '\\w', '\\b', '\\s'\nand '\\d' match only on ASCII characters with\nthe respective property.\n\n\n*note DOTALL: 1ffe, *note S: 2005.    Make '.' match any character, including\nnewlines.\n\n\n*note IGNORECASE: 1467,               Do case-insensitive matches.\n*note I: 2002.\n\n*note LOCALE: 9ac, *note L: 2003.     Do a locale-aware match.\n\n\n*note MULTILINE: 1fff,                Multi-line matching, affecting '^' and '$'.\n*note M: 2004.\n\n*note VERBOSE: 200e, *note X: 2007.   Enable verbose REs, which can be organized\n(for 'extended')                      more cleanly and understandably.\n\n\n-- Data: re.I\n\n-- Data: re.IGNORECASE\n\nPerform case-insensitive matching; character class and literal\nstrings will match letters by ignoring case.  For example, '[A-Z]'\nwill match lowercase letters, too.  Full Unicode matching also\nworks unless the *note ASCII: 3f9. flag is used to disable\nnon-ASCII matches.  When the Unicode patterns '[a-z]' or '[A-Z]'\nare used in combination with the *note IGNORECASE: 1467. flag, they\nwill match the 52 ASCII letters and 4 additional non-ASCII letters:\n'??' (U+0130, Latin capital letter I with dot above), '??' (U+0131,\nLatin small letter dotless i), '??' (U+017F, Latin small letter long\ns) and '???' (U+212A, Kelvin sign).  'Spam' will match ''Spam'',\n''spam'', ''spAM'', or ''??pam'' (the latter is matched only in\nUnicode mode).  This lowercasing doesn't take the current locale\ninto account; it will if you also set the *note LOCALE: 9ac. flag.\n\n-- Data: re.L\n\n-- Data: re.LOCALE\n\nMake '\\w', '\\W', '\\b', '\\B' and case-insensitive matching dependent\non the current locale instead of the Unicode database.\n\nLocales are a feature of the C library intended to help in writing\nprograms that take account of language differences.  For example,\nif you're processing encoded French text, you'd want to be able to\nwrite '\\w+' to match words, but '\\w' only matches the character\nclass '[A-Za-z]' in bytes patterns; it won't match bytes\ncorresponding to 'e'' or 'c,'.  If your system is configured properly\nand a French locale is selected, certain C functions will tell the\nprogram that the byte corresponding to 'e'' should also be\nconsidered a letter.  Setting the *note LOCALE: 9ac. flag when\ncompiling a regular expression will cause the resulting compiled\nobject to use these C functions for '\\w'; this is slower, but also\nenables '\\w+' to match French words as you'd expect.  The use of\nthis flag is discouraged in Python 3 as the locale mechanism is\nvery unreliable, it only handles one \"culture\" at a time, and it\nonly works with 8-bit locales.  Unicode matching is already enabled\nby default in Python 3 for Unicode (str) patterns, and it is able\nto handle different locales/languages.\n\n-- Data: re.M\n\n-- Data: re.MULTILINE\n\n('^' and '$' haven't been explained yet; they'll be introduced in\nsection *note More Metacharacters: 4d5a.)\n\nUsually '^' matches only at the beginning of the string, and '$'\nmatches only at the end of the string and immediately before the\nnewline (if any) at the end of the string.  When this flag is\nspecified, '^' matches at the beginning of the string and at the\nbeginning of each line within the string, immediately following\neach newline.  Similarly, the '$' metacharacter matches either at\nthe end of the string and at the end of each line (immediately\npreceding each newline).\n\n-- Data: re.S\n\n-- Data: re.DOTALL\n\nMakes the ''.'' special character match any character at all,\nincluding a newline; without this flag, ''.'' will match anything\n'except' a newline.\n\n-- Data: re.A\n\n-- Data: re.ASCII\n\nMake '\\w', '\\W', '\\b', '\\B', '\\s' and '\\S' perform ASCII-only\nmatching instead of full Unicode matching.  This is only meaningful\nfor Unicode patterns, and is ignored for byte patterns.\n\n-- Data: re.X\n\n-- Data: re.VERBOSE\n\nThis flag allows you to write regular expressions that are more\nreadable by granting you more flexibility in how you can format\nthem.  When this flag has been specified, whitespace within the RE\nstring is ignored, except when the whitespace is in a character\nclass or preceded by an unescaped backslash; this lets you organize\nand indent the RE more clearly.  This flag also lets you put\ncomments within a RE that will be ignored by the engine; comments\nare marked by a ''#'' that's neither in a character class or\npreceded by an unescaped backslash.\n\nFor example, here's a RE that uses *note re.VERBOSE: 200e.; see how\nmuch easier it is to read?\n\ncharref = re.compile(r\"\"\"\n&[#]                # Start of a numeric entity reference\n(\n0[0-7]+         # Octal form\n| [0-9]+          # Decimal form\n| x[0-9a-fA-F]+   # Hexadecimal form\n)\n;                   # Trailing semicolon\n\"\"\", re.VERBOSE)\n\nWithout the verbose setting, the RE would look like this:\n\ncharref = re.compile(\"&#(0[0-7]+\"\n\"|[0-9]+\"\n\"|x[0-9a-fA-F]+);\")\n\nIn the above example, Python's automatic concatenation of string\nliterals has been used to break up the RE into smaller pieces, but\nit's still more difficult to understand than the version using\n*note re.VERBOSE: 200e.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: More Pattern Power,  Next: Modifying Strings,  Prev: Using Regular Expressions,  Up: Regular Expression HOWTO": {
            "content": "So far we've only covered a part of the features of regular expressions.",
            "subsections": []
        },
        "In this section, we'll cover some new metacharacters, and how to use": {
            "content": "groups to retrieve portions of the text that was matched.\n\n* Menu:\n\n* More Metacharacters::\n* Grouping::\n* Non-capturing and Named Groups::\n* Lookahead Assertions::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: More Metacharacters,  Next: Grouping,  Up: More Pattern Power": {
            "content": "9.9.4.1 More Metacharacters\n...........................\n",
            "subsections": []
        },
        "There are some metacharacters that we haven't covered yet.  Most of them": {
            "content": "will be covered in this section.\n",
            "subsections": []
        },
        "Some of the remaining metacharacters to be discussed are 'zero-width": {
            "content": "assertions'.  They don't cause the engine to advance through the string;\ninstead, they consume no characters at all, and simply succeed or fail.\nFor example, '\\b' is an assertion that the current position is located\nat a word boundary; the position isn't changed by the '\\b' at all.  This\nmeans that zero-width assertions should never be repeated, because if\nthey match once at a given location, they can obviously be matched an\ninfinite number of times.\n\n'|'\n\nAlternation, or the \"or\" operator.  If 'A' and 'B' are regular\nexpressions, 'A|B' will match any string that matches either 'A' or\n'B'. '|' has very low precedence in order to make it work\nreasonably when you're alternating multi-character strings.\n'Crow|Servo' will match either ''Crow'' or ''Servo'', not ''Cro'',\na ''w'' or an ''S'', and ''ervo''.\n\nTo match a literal ''|'', use '\\|', or enclose it inside a\ncharacter class, as in '[|]'.\n\n'^'\n\nMatches at the beginning of lines.  Unless the *note MULTILINE:\n1fff. flag has been set, this will only match at the beginning of\nthe string.  In *note MULTILINE: 1fff. mode, this also matches\nimmediately after each newline within the string.\n\nFor example, if you wish to match the word 'From' only at the\nbeginning of a line, the RE to use is '^From'.\n\n>>> print(re.search('^From', 'From Here to Eternity'))\n<re.Match object; span=(0, 4), match='From'>\n>>> print(re.search('^From', 'Reciting From Memory'))\nNone\n\nTo match a literal ''^'', use '\\^'.\n\n'$'\n\nMatches at the end of a line, which is defined as either the end of\nthe string, or any location followed by a newline character.\n\n>>> print(re.search('}$', '{block}'))\n<re.Match object; span=(6, 7), match='}'>\n>>> print(re.search('}$', '{block} '))\nNone\n>>> print(re.search('}$', '{block}\\n'))\n<re.Match object; span=(6, 7), match='}'>\n\nTo match a literal ''$'', use '\\$' or enclose it inside a character\nclass, as in '[$]'.\n\n'\\A'\n\nMatches only at the start of the string.  When not in *note\nMULTILINE: 1fff. mode, '\\A' and '^' are effectively the same.  In\n*note MULTILINE: 1fff. mode, they're different: '\\A' still matches\nonly at the beginning of the string, but '^' may match at any\nlocation inside the string that follows a newline character.\n\n'\\Z'\n\nMatches only at the end of the string.\n\n'\\b'\n\nWord boundary.  This is a zero-width assertion that matches only at\nthe beginning or end of a word.  A word is defined as a sequence of\nalphanumeric characters, so the end of a word is indicated by\nwhitespace or a non-alphanumeric character.\n\nThe following example matches 'class' only when it's a complete\nword; it won't match when it's contained inside another word.\n\n>>> p = re.compile(r'\\bclass\\b')\n>>> print(p.search('no class at all'))\n<re.Match object; span=(3, 8), match='class'>\n>>> print(p.search('the declassified algorithm'))\nNone\n>>> print(p.search('one subclass is'))\nNone\n\nThere are two subtleties you should remember when using this\nspecial sequence.  First, this is the worst collision between\nPython's string literals and regular expression sequences.  In\nPython's string literals, '\\b' is the backspace character, ASCII\nvalue 8.  If you're not using raw strings, then Python will convert\nthe '\\b' to a backspace, and your RE won't match as you expect it\nto.  The following example looks the same as our previous RE, but\nomits the ''r'' in front of the RE string.\n\n>>> p = re.compile('\\bclass\\b')\n>>> print(p.search('no class at all'))\nNone\n>>> print(p.search('\\b' + 'class' + '\\b'))\n<re.Match object; span=(0, 7), match='\\x08class\\x08'>\n\nSecond, inside a character class, where there's no use for this\nassertion, '\\b' represents the backspace character, for\ncompatibility with Python's string literals.\n\n'\\B'\n\nAnother zero-width assertion, this is the opposite of '\\b', only\nmatching when the current position is not at a word boundary.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Grouping,  Next: Non-capturing and Named Groups,  Prev: More Metacharacters,  Up: More Pattern Power": {
            "content": "9.9.4.2 Grouping\n................\n",
            "subsections": []
        },
        "Frequently you need to obtain more information than just whether the RE": {
            "content": "matched or not.  Regular expressions are often used to dissect strings\nby writing a RE divided into several subgroups which match different\ncomponents of interest.  For example, an RFC-822 header line is divided\ninto a header name and a value, separated by a '':'', like this:\n\nFrom: author@example.com\nUser-Agent: Thunderbird 1.5.0.9 (X11/20061227)\nMIME-Version: 1.0\nTo: editor@example.com\n",
            "subsections": []
        },
        "This can be handled by writing a regular expression which matches an": {
            "content": "entire header line, and has one group which matches the header name, and\nanother group which matches the header's value.\n",
            "subsections": []
        },
        "Groups are marked by the ''('', '')'' metacharacters.  ''('' and '')''": {
            "content": "have much the same meaning as they do in mathematical expressions; they\ngroup together the expressions contained inside them, and you can repeat\nthe contents of a group with a quantifier, such as '*', '+', '?', or\n'{m,n}'.  For example, '(ab)*' will match zero or more repetitions of\n'ab'.\n\n>>> p = re.compile('(ab)*')\n>>> print(p.match('ababababab').span())\n(0, 10)\n",
            "subsections": []
        },
        "Groups indicated with ''('', '')'' also capture the starting and ending": {
            "content": "index of the text that they match; this can be retrieved by passing an\nargument to *note group(): 2021, *note start(): 2025, *note end(): 2026,\nand *note span(): 2027.  Groups are numbered starting with 0.  Group 0\nis always present; it's the whole RE, so *note match object: df7.\nmethods all have group 0 as their default argument.  Later we'll see how\nto express groups that don't capture the span of text that they match.\n\n>>> p = re.compile('(a)b')\n>>> m = p.match('ab')\n>>> m.group()\n'ab'\n>>> m.group(0)\n'ab'\n",
            "subsections": []
        },
        "Subgroups are numbered from left to right, from 1 upward.  Groups can be": {
            "content": "nested; to determine the number, just count the opening parenthesis\ncharacters, going from left to right.\n\n>>> p = re.compile('(a(b)c)d')\n>>> m = p.match('abcd')\n>>> m.group(0)\n'abcd'\n>>> m.group(1)\n'abc'\n>>> m.group(2)\n'b'\n\n*note group(): 2021. can be passed multiple group numbers at a time, in\nwhich case it will return a tuple containing the corresponding values\nfor those groups.\n\n>>> m.group(2,1,2)\n('b', 'abc', 'b')\n\nThe *note groups(): 2023. method returns a tuple containing the strings\nfor all the subgroups, from 1 up to however many there are.\n\n>>> m.groups()\n('abc', 'b')\n",
            "subsections": []
        },
        "Backreferences in a pattern allow you to specify that the contents of an": {
            "content": "earlier capturing group must also be found at the current location in\nthe string.  For example, '\\1' will succeed if the exact contents of\ngroup 1 can be found at the current position, and fails otherwise.",
            "subsections": []
        },
        "Remember that Python's string literals also use a backslash followed by": {
            "content": "numbers to allow including arbitrary characters in a string, so be sure\nto use a raw string when incorporating backreferences in a RE.\n\nFor example, the following RE detects doubled words in a string.\n\n>>> p = re.compile(r'\\b(\\w+)\\s+\\1\\b')\n>>> p.search('Paris in the the spring').group()\n'the the'\n",
            "subsections": []
        },
        "Backreferences like this aren't often useful for just searching through": {
            "content": "a string -- there are few text formats which repeat data in this way --\nbut you'll soon find out that they're 'very' useful when performing\nstring substitutions.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Non-capturing and Named Groups,  Next: Lookahead Assertions,  Prev: Grouping,  Up: More Pattern Power": {
            "content": "9.9.4.3 Non-capturing and Named Groups\n......................................\n",
            "subsections": []
        },
        "Elaborate REs may use many groups, both to capture substrings of": {
            "content": "interest, and to group and structure the RE itself.  In complex REs, it\nbecomes difficult to keep track of the group numbers.  There are two\nfeatures which help with this problem.  Both of them use a common syntax\nfor regular expression extensions, so we'll look at that first.\n",
            "subsections": []
        },
        "Perl 5 is well known for its powerful additions to standard regular": {
            "content": "expressions.  For these new features the Perl developers couldn't choose\nnew single-keystroke metacharacters or new special sequences beginning\nwith '\\' without making Perl's regular expressions confusingly different\nfrom standard REs.  If they chose '&' as a new metacharacter, for\nexample, old expressions would be assuming that '&' was a regular\ncharacter and wouldn't have escaped it by writing '\\&' or '[&]'.\n\nThe solution chosen by the Perl developers was to use '(?...)' as the\nextension syntax.  '?' immediately after a parenthesis was a syntax\nerror because the '?' would have nothing to repeat, so this didn't\nintroduce any compatibility problems.  The characters immediately after\nthe '?' indicate what extension is being used, so '(?=foo)' is one thing\n(a positive lookahead assertion) and '(?:foo)' is something else (a\nnon-capturing group containing the subexpression 'foo').\n",
            "subsections": []
        },
        "Python supports several of Perl's extensions and adds an extension": {
            "content": "syntax to Perl's extension syntax.  If the first character after the\nquestion mark is a 'P', you know that it's an extension that's specific\nto Python.\n",
            "subsections": []
        },
        "Now that we've looked at the general extension syntax, we can return to": {
            "content": "the features that simplify working with groups in complex REs.\n",
            "subsections": []
        },
        "Sometimes you'll want to use a group to denote a part of a regular": {
            "content": "expression, but aren't interested in retrieving the group's contents.\nYou can make this fact explicit by using a non-capturing group:\n'(?:...)', where you can replace the '...' with any other regular\nexpression.\n\n>>> m = re.match(\"([abc])+\", \"abc\")\n>>> m.groups()\n('c',)\n>>> m = re.match(\"(?:[abc])+\", \"abc\")\n>>> m.groups()\n()\n",
            "subsections": []
        },
        "Except for the fact that you can't retrieve the contents of what the": {
            "content": "group matched, a non-capturing group behaves exactly the same as a\ncapturing group; you can put anything inside it, repeat it with a\nrepetition metacharacter such as '*', and nest it within other groups\n(capturing or non-capturing).  '(?:...)' is particularly useful when\nmodifying an existing pattern, since you can add new groups without\nchanging how all the other groups are numbered.  It should be mentioned\nthat there's no performance difference in searching between capturing\nand non-capturing groups; neither form is any faster than the other.\n\nA more significant feature is named groups: instead of referring to them\nby numbers, groups can be referenced by a name.\n\nThe syntax for a named group is one of the Python-specific extensions:\n'(?P<name>...)'.  'name' is, obviously, the name of the group.  Named\ngroups behave exactly like capturing groups, and additionally associate\na name with a group.  The *note match object: df7. methods that deal\nwith capturing groups all accept either integers that refer to the group\nby number or strings that contain the desired group's name.  Named\ngroups are still given numbers, so you can retrieve information about a\ngroup in two ways:\n\n>>> p = re.compile(r'(?P<word>\\b\\w+\\b)')\n>>> m = p.search( '(((( Lots of punctuation )))' )\n>>> m.group('word')\n'Lots'\n>>> m.group(1)\n'Lots'\n\nAdditionally, you can retrieve named groups as a dictionary with *note\ngroupdict(): 2024.:\n\n>>> m = re.match(r'(?P<first>\\w+) (?P<last>\\w+)', 'Jane Doe')\n>>> m.groupdict()\n{'first': 'Jane', 'last': 'Doe'}\n",
            "subsections": []
        },
        "Named groups are handy because they let you use easily remembered names,": {
            "content": "instead of having to remember numbers.  Here's an example RE from the\n*note imaplib: 6f. module:\n\nInternalDate = re.compile(r'INTERNALDATE \"'\nr'(?P<day>[ 123][0-9])-(?P<mon>[A-Z][a-z][a-z])-'\nr'(?P<year>[0-9][0-9][0-9][0-9])'\nr' (?P<hour>[0-9][0-9]):(?P<min>[0-9][0-9]):(?P<sec>[0-9][0-9])'\nr' (?P<zonen>[-+])(?P<zoneh>[0-9][0-9])(?P<zonem>[0-9][0-9])'\nr'\"')\n",
            "subsections": []
        },
        "It's obviously much easier to retrieve 'm.group('zonem')', instead of": {
            "content": "having to remember to retrieve group 9.\n\nThe syntax for backreferences in an expression such as '(...)\\1' refers\nto the number of the group.  There's naturally a variant that uses the\ngroup name instead of the number.  This is another Python extension:\n'(?P=name)' indicates that the contents of the group called 'name'\nshould again be matched at the current point.  The regular expression\nfor finding doubled words, '\\b(\\w+)\\s+\\1\\b' can also be written as\n'\\b(?P<word>\\w+)\\s+(?P=word)\\b':\n\n>>> p = re.compile(r'\\b(?P<word>\\w+)\\s+(?P=word)\\b')\n>>> p.search('Paris in the the spring').group()\n'the the'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Lookahead Assertions,  Prev: Non-capturing and Named Groups,  Up: More Pattern Power": {
            "content": "9.9.4.4 Lookahead Assertions\n............................\n",
            "subsections": []
        },
        "Another zero-width assertion is the lookahead assertion.  Lookahead": {
            "content": "assertions are available in both positive and negative form, and look\nlike this:\n\n'(?=...)'\n\nPositive lookahead assertion.  This succeeds if the contained\nregular expression, represented here by '...', successfully matches\nat the current location, and fails otherwise.  But, once the\ncontained expression has been tried, the matching engine doesn't\nadvance at all; the rest of the pattern is tried right where the\nassertion started.\n\n'(?!...)'\n\nNegative lookahead assertion.  This is the opposite of the positive\nassertion; it succeeds if the contained expression 'doesn't' match\nat the current position in the string.\n\nTo make this concrete, let's look at a case where a lookahead is useful.",
            "subsections": []
        },
        "Consider a simple pattern to match a filename and split it apart into a": {
            "content": "base name and an extension, separated by a '.'.  For example, in\n'news.rc', 'news' is the base name, and 'rc' is the filename's\nextension.\n\nThe pattern to match this is quite simple:\n\n'.*[.].*$'\n",
            "subsections": []
        },
        "Notice that the '.' needs to be treated specially because it's a": {
            "content": "metacharacter, so it's inside a character class to only match that\nspecific character.  Also notice the trailing '$'; this is added to\nensure that all the rest of the string must be included in the\nextension.  This regular expression matches 'foo.bar' and 'autoexec.bat'\nand 'sendmail.cf' and 'printers.conf'.\n",
            "subsections": []
        },
        "Now, consider complicating the problem a bit; what if you want to match": {
            "content": "filenames where the extension is not 'bat'?  Some incorrect attempts:\n\n'.*[.][^b].*$' The first attempt above tries to exclude 'bat' by\nrequiring that the first character of the extension is not a 'b'.  This\nis wrong, because the pattern also doesn't match 'foo.bar'.\n\n'.*[.]([^b]..|.[^a].|..[^t])$'\n",
            "subsections": []
        },
        "The expression gets messier when you try to patch up the first solution": {
            "content": "by requiring one of the following cases to match: the first character of\nthe extension isn't 'b'; the second character isn't 'a'; or the third\ncharacter isn't 't'.  This accepts 'foo.bar' and rejects 'autoexec.bat',\nbut it requires a three-letter extension and won't accept a filename\nwith a two-letter extension such as 'sendmail.cf'.  We'll complicate the\npattern again in an effort to fix it.\n\n'.*[.]([^b].?.?|.[^a]?.?|..?[^t]?)$'\n",
            "subsections": []
        },
        "In the third attempt, the second and third letters are all made optional": {
            "content": "in order to allow matching extensions shorter than three characters,\nsuch as 'sendmail.cf'.\n",
            "subsections": []
        },
        "The pattern's getting really complicated now, which makes it hard to": {
            "content": "read and understand.  Worse, if the problem changes and you want to\nexclude both 'bat' and 'exe' as extensions, the pattern would get even\nmore complicated and confusing.\n\nA negative lookahead cuts through all this confusion:\n\n'.*[.](?!bat$)[^.]*$' The negative lookahead means: if the expression\n'bat' doesn't match at this point, try the rest of the pattern; if\n'bat$' does match, the whole pattern will fail.  The trailing '$' is\nrequired to ensure that something like 'sample.batch', where the\nextension only starts with 'bat', will be allowed.  The '[^.]*' makes\nsure that the pattern works when there are multiple dots in the\nfilename.\n",
            "subsections": []
        },
        "Excluding another filename extension is now easy; simply add it as an": {
            "content": "alternative inside the assertion.  The following pattern excludes\nfilenames that end in either 'bat' or 'exe':\n\n'.*[.](?!bat$|exe$)[^.]*$'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Modifying Strings,  Next: Common Problems,  Prev: More Pattern Power,  Up: Regular Expression HOWTO": {
            "content": "",
            "subsections": []
        },
        "Up to this point, we've simply performed searches against a static": {
            "content": "string.  Regular expressions are also commonly used to modify strings in\nvarious ways, using the following pattern methods:\n",
            "subsections": []
        },
        "You can limit the number of splits made, by passing a value for": {
            "content": "'maxsplit'.  When 'maxsplit' is nonzero, at most 'maxsplit' splits will\nbe made, and the remainder of the string is returned as the final\nelement of the list.  In the following example, the delimiter is any\nsequence of non-alphanumeric characters.\n\n>>> p = re.compile(r'\\W+')\n>>> p.split('This is a test, short and sweet, of split().')\n['This', 'is', 'a', 'test', 'short', 'and', 'sweet', 'of', 'split', '']\n>>> p.split('This is a test, short and sweet, of split().', 3)\n['This', 'is', 'a', 'test, short and sweet, of split().']\n",
            "subsections": []
        },
        "Sometimes you're not only interested in what the text between delimiters": {
            "content": "is, but also need to know what the delimiter was.  If capturing\nparentheses are used in the RE, then their values are also returned as\npart of the list.  Compare the following calls:\n\n>>> p = re.compile(r'\\W+')\n>>> p2 = re.compile(r'(\\W+)')\n>>> p.split('This... is a test.')\n['This', 'is', 'a', 'test', '']\n>>> p2.split('This... is a test.')\n['This', '... ', 'is', ' ', 'a', ' ', 'test', '.', '']\n\nThe module-level function *note re.split(): 9ae. adds the RE to be used\nas the first argument, but is otherwise the same.\n\n>>> re.split(r'[\\W]+', 'Words, words, words.')\n['Words', 'words', 'words', '']\n>>> re.split(r'([\\W]+)', 'Words, words, words.')\n['Words', ', ', 'words', ', ', 'words', '.', '']\n>>> re.split(r'[\\W]+', 'Words, words, words.', 1)\n['Words', 'words, words.']\n\nFile: python3.12.info,  Node: Search and Replace<2>,  Prev: Splitting Strings,  Up: Modifying Strings\n\n9.9.5.2 Search and Replace\n..........................\n",
            "subsections": []
        },
        "Another common task is to find all the matches for a pattern, and": {
            "content": "replace them with a different string.  The *note sub(): 2019. method\ntakes a replacement value, which can be either a string or a function,\nand the string to be processed.\n\n-- Method: .sub (replacement, string[, count=0])\n\nReturns the string obtained by replacing the leftmost\nnon-overlapping occurrences of the RE in 'string' by the\nreplacement 'replacement'.  If the pattern isn't found, 'string' is\nreturned unchanged.\n\nThe optional argument 'count' is the maximum number of pattern\noccurrences to be replaced; 'count' must be a non-negative integer.\nThe default value of 0 means to replace all occurrences.\n\nHere's a simple example of using the *note sub(): 2019. method.  It\nreplaces colour names with the word 'colour':\n\n>>> p = re.compile('(blue|white|red)')\n>>> p.sub('colour', 'blue socks and red shoes')\n'colour socks and colour shoes'\n>>> p.sub('colour', 'blue socks and red shoes', count=1)\n'colour socks and red shoes'\n\nThe *note subn(): 201a. method does the same work, but returns a 2-tuple\ncontaining the new string value and the number of replacements that were\nperformed:\n\n>>> p = re.compile('(blue|white|red)')\n>>> p.subn('colour', 'blue socks and red shoes')\n('colour socks and colour shoes', 2)\n>>> p.subn('colour', 'no colours at all')\n('no colours at all', 0)\n",
            "subsections": []
        },
        "Empty matches are replaced only when they're not adjacent to a previous": {
            "content": "empty match.\n\n>>> p = re.compile('x*')\n>>> p.sub('-', 'abxd')\n'-a-b--d-'\n\nIf 'replacement' is a string, any backslash escapes in it are processed.\nThat is, '\\n' is converted to a single newline character, '\\r' is\nconverted to a carriage return, and so forth.  Unknown escapes such as\n'\\&' are left alone.  Backreferences, such as '\\6', are replaced with\nthe substring matched by the corresponding group in the RE. This lets\nyou incorporate portions of the original text in the resulting\nreplacement string.\n",
            "subsections": []
        },
        "This example matches the word 'section' followed by a string enclosed in": {
            "content": "'{', '}', and changes 'section' to 'subsection':\n\n>>> p = re.compile('section{ ( [^}]* ) }', re.VERBOSE)\n>>> p.sub(r'subsection{\\1}','section{First} section{second}')\n'subsection{First} subsection{second}'\n",
            "subsections": []
        },
        "There's also a syntax for referring to named groups as defined by the": {
            "content": "'(?P<name>...)' syntax.  '\\g<name>' will use the substring matched by\nthe group named 'name', and '\\g<number>' uses the corresponding group\nnumber.  '\\g<2>' is therefore equivalent to '\\2', but isn't ambiguous in\na replacement string such as '\\g<2>0'.  ('\\20' would be interpreted as a\nreference to group 20, not a reference to group 2 followed by the\nliteral character ''0''.)  The following substitutions are all\nequivalent, but use all three variations of the replacement string.\n\n>>> p = re.compile('section{ (?P<name> [^}]* ) }', re.VERBOSE)\n>>> p.sub(r'subsection{\\1}','section{First}')\n'subsection{First}'\n>>> p.sub(r'subsection{\\g<1>}','section{First}')\n'subsection{First}'\n>>> p.sub(r'subsection{\\g<name>}','section{First}')\n'subsection{First}'\n\n'replacement' can also be a function, which gives you even more control.",
            "subsections": []
        },
        "If 'replacement' is a function, the function is called for every": {
            "content": "non-overlapping occurrence of 'pattern'.  On each call, the function is\npassed a *note match object: df7. argument for the match and can use\nthis information to compute the desired replacement string and return\nit.\n",
            "subsections": []
        },
        "In the following example, the replacement function translates decimals": {
            "content": "into hexadecimal:\n\n>>> def hexrepl(match):\n...     \"Return the hex string for a decimal number\"\n...     value = int(match.group())\n...     return hex(value)\n...\n>>> p = re.compile(r'\\d+')\n>>> p.sub(hexrepl, 'Call 65490 for printing, 49152 for user code.')\n'Call 0xffd2 for printing, 0xc000 for user code.'\n\nWhen using the module-level *note re.sub(): 1ff. function, the pattern\nis passed as the first argument.  The pattern may be provided as an\nobject or as a string; if you need to specify regular expression flags,\nyou must either use a pattern object as the first parameter, or use\nembedded modifiers in the pattern string, e.g.  'sub(\"(?i)b+\", \"x\",\n\"bbbb BBBB\")' returns ''x x''.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Common Problems,  Next: Feedback,  Prev: Modifying Strings,  Up: Regular Expression HOWTO": {
            "content": "",
            "subsections": []
        },
        "Regular expressions are a powerful tool for some applications, but in": {
            "content": "some ways their behaviour isn't intuitive and at times they don't behave\nthe way you may expect them to.  This section will point out some of the\nmost common pitfalls.\n\n* Menu:\n\n* Use String Methods::\n* match() versus search(): match versus search.\n* Greedy versus Non-Greedy::\n* Using re.VERBOSE: Using re VERBOSE.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Use String Methods,  Next: match versus search,  Up: Common Problems": {
            "content": "9.9.6.1 Use String Methods\n..........................\n\nSometimes using the *note re: b4. module is a mistake.  If you're\nmatching a fixed string, or a single character class, and you're not\nusing any *note re: b4. features such as the *note IGNORECASE: 1467.\nflag, then the full power of regular expressions may not be required.",
            "subsections": []
        },
        "Strings have several methods for performing operations with fixed": {
            "content": "strings and they're usually much faster, because the implementation is a\nsingle small C loop that's been optimized for the purpose, instead of\nthe large, more generalized regular expression engine.\n",
            "subsections": []
        },
        "One example might be replacing a single fixed string with another one;": {
            "content": "for example, you might replace 'word' with 'deed'.  *note re.sub(): 1ff.\nseems like the function to use for this, but consider the *note\nreplace(): 10cf. method.  Note that 'replace()' will also replace 'word'\ninside words, turning 'swordfish' into 'sdeedfish', but the naive RE\n'word' would have done that, too.  (To avoid performing the substitution\non parts of words, the pattern would have to be '\\bword\\b', in order to\nrequire that 'word' have a word boundary on either side.  This takes the\njob beyond 'replace()''s abilities.)\n",
            "subsections": []
        },
        "Another common task is deleting every occurrence of a single character": {
            "content": "from a string or replacing it with another single character.  You might\ndo this with something like 're.sub('\\n', ' ', S)', but *note\ntranslate(): 1ed5. is capable of doing both tasks and will be faster\nthan any regular expression operation can be.\n\nIn short, before turning to the *note re: b4. module, consider whether\nyour problem can be solved with a faster and simpler string method.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: match versus search,  Next: Greedy versus Non-Greedy,  Prev: Use String Methods,  Up: Common Problems": {
            "content": "9.9.6.2 match() versus search()\n...............................\n\nThe *note match(): 10a3. function only checks if the RE matches at the\nbeginning of the string while *note search(): 10a2. will scan forward\nthrough the string for a match.  It's important to keep this distinction\nin mind.  Remember, 'match()' will only report a successful match which\nwill start at 0; if the match wouldn't start at zero, 'match()' will\n'not' report it.\n\n>>> print(re.match('super', 'superstition').span())\n(0, 5)\n>>> print(re.match('super', 'insuperable'))\nNone\n\nOn the other hand, *note search(): 10a2. will scan forward through the\nstring, reporting the first match it finds.\n\n>>> print(re.search('super', 'superstition').span())\n(0, 5)\n>>> print(re.search('super', 'insuperable').span())\n(2, 7)\n\nSometimes you'll be tempted to keep using *note re.match(): 10a3, and\njust add '.*' to the front of your RE. Resist this temptation and use\n*note re.search(): 10a2. instead.  The regular expression compiler does\nsome analysis of REs in order to speed up the process of looking for a\nmatch.  One such analysis figures out what the first character of a\nmatch must be; for example, a pattern starting with 'Crow' must match\nstarting with a ''C''.  The analysis lets the engine quickly scan\nthrough the string looking for the starting character, only trying the\nfull match if a ''C'' is found.\n\nAdding '.*' defeats this optimization, requiring scanning to the end of\nthe string and then backtracking to find a match for the rest of the RE.\nUse *note re.search(): 10a2. instead.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Greedy versus Non-Greedy,  Next: Using re VERBOSE,  Prev: match versus search,  Up: Common Problems": {
            "content": "9.9.6.3 Greedy versus Non-Greedy\n................................\n\nWhen repeating a regular expression, as in 'a*', the resulting action is\nto consume as much of the pattern as possible.  This fact often bites\nyou when you're trying to match a pair of balanced delimiters, such as\nthe angle brackets surrounding an HTML tag.  The naive pattern for\nmatching a single HTML tag doesn't work because of the greedy nature of\n'.*'.\n\n>>> s = '<html><head><title>Title</title>'\n>>> len(s)\n32\n>>> print(re.match('<.*>', s).span())\n(0, 32)\n>>> print(re.match('<.*>', s).group())\n<html><head><title>Title</title>\n\nThe RE matches the ''<'' in ''<html>'', and the '.*' consumes the rest\nof the string.  There's still more left in the RE, though, and the '>'\ncan't match at the end of the string, so the regular expression engine\nhas to backtrack character by character until it finds a match for the\n'>'.  The final match extends from the ''<'' in ''<html>'' to the ''>''\nin ''</title>'', which isn't what you want.\n\nIn this case, the solution is to use the non-greedy quantifiers '*?',\n'+?', '??', or '{m,n}?', which match as 'little' text as possible.  In\nthe above example, the ''>'' is tried immediately after the first ''<''\nmatches, and when it fails, the engine advances a character at a time,\nretrying the ''>'' at every step.  This produces just the right result:\n\n>>> print(re.match('<.*?>', s).group())\n<html>\n\n(Note that parsing HTML or XML with regular expressions is painful.",
            "subsections": []
        },
        "Quick-and-dirty patterns will handle common cases, but HTML and XML have": {
            "content": "special cases that will break the obvious regular expression; by the\ntime you've written a regular expression that handles all of the\npossible cases, the patterns will be 'very' complicated.  Use an HTML or\nXML parser module for such tasks.)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using re VERBOSE,  Prev: Greedy versus Non-Greedy,  Up: Common Problems": {
            "content": "9.9.6.4 Using re.VERBOSE\n........................\n",
            "subsections": []
        },
        "By now you've probably noticed that regular expressions are a very": {
            "content": "compact notation, but they're not terribly readable.  REs of moderate\ncomplexity can become lengthy collections of backslashes, parentheses,\nand metacharacters, making them difficult to read and understand.\n\nFor such REs, specifying the *note re.VERBOSE: 200e. flag when compiling\nthe regular expression can be helpful, because it allows you to format\nthe regular expression more clearly.\n",
            "subsections": []
        },
        "The 're.VERBOSE' flag has several effects.  Whitespace in the regular": {
            "content": "expression that 'isn't' inside a character class is ignored.  This means\nthat an expression such as 'dog | cat' is equivalent to the less\nreadable 'dog|cat', but '[a b]' will still match the characters ''a'',\n''b'', or a space.  In addition, you can also put comments inside a RE;\ncomments extend from a '#' character to the next newline.  When used\nwith triple-quoted strings, this enables REs to be formatted more\nneatly:\n\npat = re.compile(r\"\"\"\n\\s*                 # Skip leading whitespace\n(?P<header>[^:]+)   # Header name\n\\s* :               # Whitespace, and a colon\n(?P<value>.*?)      # The header's value -- *? used to\n# lose the following trailing whitespace\n\\s*$                # Trailing whitespace to end-of-line\n\"\"\", re.VERBOSE)\n\nThis is far more readable than:\n\npat = re.compile(r\"\\s*(?P<header>[^:]+)\\s*:(?P<value>.*?)\\s*$\")\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Feedback,  Prev: Common Problems,  Up: Regular Expression HOWTO": {
            "content": "",
            "subsections": []
        },
        "Regular expressions are a complicated topic.  Did this document help you": {
            "content": "understand them?  Were there parts that were unclear, or Problems you\nencountered that weren't covered here?  If so, please send suggestions\nfor improvements to the author.\n",
            "subsections": []
        },
        "The most complete book on regular expressions is almost certainly": {
            "content": "Jeffrey Friedl's Mastering Regular Expressions, published by O'Reilly.",
            "subsections": []
        },
        "Unfortunately, it exclusively concentrates on Perl and Java's flavours": {
            "content": "of regular expressions, and doesn't contain any Python material at all,\nso it won't be useful as a reference for programming in Python.  (The\nfirst edition covered Python's now-removed 'regex' module, which won't\nhelp you much.)  Consider checking it out from your library.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Socket Programming HOWTO,  Next: Sorting Techniques,  Prev: Regular Expression HOWTO,  Up: Python HOWTOs": {
            "content": "",
            "subsections": [
                {
                    "name": "9.10 Socket Programming HOWTO",
                    "content": ""
                }
            ]
        },
        "Author: Gordon McMillan": {
            "content": "",
            "subsections": []
        },
        "Sockets are used nearly everywhere, but are one of the most severely": {
            "content": "misunderstood technologies around.  This is a 10,000 foot overview of\nsockets.  It's not really a tutorial - you'll still have work to do in\ngetting things operational.  It doesn't cover the fine points (and there\nare a lot of them), but I hope it will give you enough background to\nbegin using them decently.\n\n* Menu:\n\n* Sockets::\n* Creating a Socket::\n* Using a Socket::\n* Disconnecting::\n* Non-blocking Sockets::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Sockets,  Next: Creating a Socket,  Up: Socket Programming HOWTO": {
            "content": "I'm only going to talk about INET (i.e.  IPv4) sockets, but they account\nfor at least 99% of the sockets in use.  And I'll only talk about STREAM\n(i.e.  TCP) sockets - unless you really know what you're doing (in which\ncase this HOWTO isn't for you!), you'll get better behavior and\nperformance from a STREAM socket than anything else.  I will try to\nclear up the mystery of what a socket is, as well as some hints on how\nto work with blocking and non-blocking sockets.  But I'll start by\ntalking about blocking sockets.  You'll need to know how they work\nbefore dealing with non-blocking sockets.\n\nPart of the trouble with understanding these things is that \"socket\" can\nmean a number of subtly different things, depending on context.  So\nfirst, let's make a distinction between a \"client\" socket - an endpoint\nof a conversation, and a \"server\" socket, which is more like a\nswitchboard operator.  The client application (your browser, for\nexample) uses \"client\" sockets exclusively; the web server it's talking\nto uses both \"server\" sockets and \"client\" sockets.\n\n* Menu:\n\n* History::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: History,  Up: Sockets": {
            "content": "9.10.1.1 History\n................\n",
            "subsections": []
        },
        "Of the various forms of IPC (Inter Process Communication), sockets are": {
            "content": "by far the most popular.  On any given platform, there are likely to be\nother forms of IPC that are faster, but for cross-platform\ncommunication, sockets are about the only game in town.\n",
            "subsections": []
        },
        "They were invented in Berkeley as part of the BSD flavor of Unix.  They": {
            "content": "spread like wildfire with the internet.  With good reason -- the\ncombination of sockets with INET makes talking to arbitrary machines\naround the world unbelievably easy (at least compared to other schemes).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Creating a Socket,  Next: Using a Socket,  Prev: Sockets,  Up: Socket Programming HOWTO": {
            "content": "",
            "subsections": []
        },
        "Roughly speaking, when you clicked on the link that brought you to this": {
            "content": "page, your browser did something like the following:\n\n# create an INET, STREAMing socket\ns = socket.socket(socket.AFINET, socket.SOCKSTREAM)\n# now connect to the web server on port 80 - the normal http port\ns.connect((\"www.python.org\", 80))\n",
            "subsections": []
        },
        "When the 'connect' completes, the socket 's' can be used to send in a": {
            "content": "request for the text of the page.  The same socket will read the reply,\nand then be destroyed.  That's right, destroyed.  Client sockets are\nnormally only used for one exchange (or a small set of sequential\nexchanges).\n",
            "subsections": []
        },
        "What happens in the web server is a bit more complex.  First, the web": {
            "content": "server creates a \"server socket\":\n\n# create an INET, STREAMing socket\nserversocket = socket.socket(socket.AFINET, socket.SOCKSTREAM)\n# bind the socket to a public host, and a well-known port\nserversocket.bind((socket.gethostname(), 80))\n# become a server socket\nserversocket.listen(5)\n\nA couple things to notice: we used 'socket.gethostname()' so that the\nsocket would be visible to the outside world.  If we had used\n's.bind(('localhost', 80))' or 's.bind(('127.0.0.1', 80))' we would\nstill have a \"server\" socket, but one that was only visible within the\nsame machine.  's.bind(('', 80))' specifies that the socket is reachable\nby any address the machine happens to have.\n\nA second thing to note: low number ports are usually reserved for \"well\nknown\" services (HTTP, SNMP etc).  If you're playing around, use a nice\nhigh number (4 digits).\n",
            "subsections": []
        },
        "Finally, the argument to 'listen' tells the socket library that we want": {
            "content": "it to queue up as many as 5 connect requests (the normal max) before\nrefusing outside connections.  If the rest of the code is written\nproperly, that should be plenty.\n\nNow that we have a \"server\" socket, listening on port 80, we can enter\nthe mainloop of the web server:\n\nwhile True:\n# accept connections from outside\n(clientsocket, address) = serversocket.accept()\n# now do something with the clientsocket\n# in this case, we'll pretend this is a threaded server\nct = clientthread(clientsocket)\nct.run()\n",
            "subsections": []
        },
        "There's actually 3 general ways in which this loop could work -": {
            "content": "dispatching a thread to handle 'clientsocket', create a new process to\nhandle 'clientsocket', or restructure this app to use non-blocking\nsockets, and multiplex between our \"server\" socket and any active\n'clientsocket's using 'select'.  More about that later.  The important\nthing to understand now is this: this is 'all' a \"server\" socket does.",
            "subsections": []
        },
        "It doesn't send any data.  It doesn't receive any data.  It just": {
            "content": "produces \"client\" sockets.  Each 'clientsocket' is created in response\nto some 'other' \"client\" socket doing a 'connect()' to the host and port\nwe're bound to.  As soon as we've created that 'clientsocket', we go\nback to listening for more connections.  The two \"clients\" are free to\nchat it up - they are using some dynamically allocated port which will\nbe recycled when the conversation ends.\n\n* Menu:\n\n* IPC::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: IPC,  Up: Creating a Socket": {
            "content": "9.10.2.1 IPC\n............\n",
            "subsections": []
        },
        "If you need fast IPC between two processes on one machine, you should": {
            "content": "look into pipes or shared memory.  If you do decide to use AFINET\nsockets, bind the \"server\" socket to ''localhost''.  On most platforms,\nthis will take a shortcut around a couple of layers of network code and\nbe quite a bit faster.\n\nSee also\n........\n\nThe *note multiprocessing: 8f. integrates cross-platform IPC into a\nhigher-level API.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using a Socket,  Next: Disconnecting,  Prev: Creating a Socket,  Up: Socket Programming HOWTO": {
            "content": "The first thing to note, is that the web browser's \"client\" socket and\nthe web server's \"client\" socket are identical beasts.  That is, this is\na \"peer to peer\" conversation.  Or to put it another way, 'as the\ndesigner, you will have to decide what the rules of etiquette are for a\nconversation'.  Normally, the 'connect'ing socket starts the\nconversation, by sending in a request, or perhaps a signon.  But that's\na design decision - it's not a rule of sockets.\n",
            "subsections": []
        },
        "Now there are two sets of verbs to use for communication.  You can use": {
            "content": "'send' and 'recv', or you can transform your client socket into a\nfile-like beast and use 'read' and 'write'.  The latter is the way Java\npresents its sockets.  I'm not going to talk about it here, except to\nwarn you that you need to use 'flush' on sockets.  These are buffered\n\"files\", and a common mistake is to 'write' something, and then 'read'\nfor a reply.  Without a 'flush' in there, you may wait forever for the\nreply, because the request may still be in your output buffer.\n",
            "subsections": []
        },
        "Now we come to the major stumbling block of sockets - 'send' and 'recv'": {
            "content": "operate on the network buffers.  They do not necessarily handle all the\nbytes you hand them (or expect from them), because their major focus is\nhandling the network buffers.  In general, they return when the\nassociated network buffers have been filled ('send') or emptied\n('recv').  They then tell you how many bytes they handled.  It is 'your'\nresponsibility to call them again until your message has been completely\ndealt with.\n",
            "subsections": []
        },
        "When a 'recv' returns 0 bytes, it means the other side has closed (or is": {
            "content": "in the process of closing) the connection.  You will not receive any\nmore data on this connection.  Ever.  You may be able to send data\nsuccessfully; I'll talk more about this later.\n\nA protocol like HTTP uses a socket for only one transfer.  The client\nsends a request, then reads a reply.  That's it.  The socket is\ndiscarded.  This means that a client can detect the end of the reply by\nreceiving 0 bytes.\n",
            "subsections": []
        },
        "But if you plan to reuse your socket for further transfers, you need to": {
            "content": "realize that 'there is no' EOT (End of Transfer) 'on a socket.'  I\nrepeat: if a socket 'send' or 'recv' returns after handling 0 bytes, the\nconnection has been broken.  If the connection has 'not' been broken,\nyou may wait on a 'recv' forever, because the socket will 'not' tell you\nthat there's nothing more to read (for now).  Now if you think about\nthat a bit, you'll come to realize a fundamental truth of sockets:\n'messages must either be fixed length' (yuck), 'or be delimited'\n(shrug), 'or indicate how long they are' (much better), 'or end by\nshutting down the connection'.  The choice is entirely yours, (but some\nways are righter than others).\n",
            "subsections": []
        },
        "Assuming you don't want to end the connection, the simplest solution is": {
            "content": "a fixed length message:\n\nclass MySocket:\n\"\"\"demonstration class only\n- coded for clarity, not efficiency\n\"\"\"\n\ndef init(self, sock=None):\nif sock is None:\nself.sock = socket.socket(\nsocket.AFINET, socket.SOCKSTREAM)\nelse:\nself.sock = sock\n\ndef connect(self, host, port):\nself.sock.connect((host, port))\n\ndef mysend(self, msg):\ntotalsent = 0\nwhile totalsent < MSGLEN:\nsent = self.sock.send(msg[totalsent:])\nif sent == 0:\nraise RuntimeError(\"socket connection broken\")\ntotalsent = totalsent + sent\n\ndef myreceive(self):\nchunks = []\nbytesrecd = 0\nwhile bytesrecd < MSGLEN:\nchunk = self.sock.recv(min(MSGLEN - bytesrecd, 2048))\nif chunk == b'':\nraise RuntimeError(\"socket connection broken\")\nchunks.append(chunk)\nbytesrecd = bytesrecd + len(chunk)\nreturn b''.join(chunks)\n",
            "subsections": []
        },
        "The sending code here is usable for almost any messaging scheme - in": {
            "content": "",
            "subsections": []
        },
        "Python you send strings, and you can use 'len()' to determine its length": {
            "content": "(even if it has embedded '\\0' characters).  It's mostly the receiving\ncode that gets more complex.  (And in C, it's not much worse, except you\ncan't use 'strlen' if the message has embedded '\\0's.)\n",
            "subsections": []
        },
        "The easiest enhancement is to make the first character of the message an": {
            "content": "indicator of message type, and have the type determine the length.  Now\nyou have two 'recv's - the first to get (at least) that first character\nso you can look up the length, and the second in a loop to get the rest.",
            "subsections": []
        },
        "If you decide to go the delimited route, you'll be receiving in some": {
            "content": "arbitrary chunk size, (4096 or 8192 is frequently a good match for\nnetwork buffer sizes), and scanning what you've received for a\ndelimiter.\n",
            "subsections": []
        },
        "One complication to be aware of: if your conversational protocol allows": {
            "content": "multiple messages to be sent back to back (without some kind of reply),\nand you pass 'recv' an arbitrary chunk size, you may end up reading the\nstart of a following message.  You'll need to put that aside and hold\nonto it, until it's needed.\n",
            "subsections": []
        },
        "Prefixing the message with its length (say, as 5 numeric characters)": {
            "content": "gets more complex, because (believe it or not), you may not get all 5\ncharacters in one 'recv'.  In playing around, you'll get away with it;\nbut in high network loads, your code will very quickly break unless you\nuse two 'recv' loops - the first to determine the length, the second to\nget the data part of the message.  Nasty.  This is also when you'll\ndiscover that 'send' does not always manage to get rid of everything in\none pass.  And despite having read this, you will eventually get bit by\nit!\n",
            "subsections": []
        },
        "In the interests of space, building your character, (and preserving my": {
            "content": "competitive position), these enhancements are left as an exercise for\nthe reader.  Lets move on to cleaning up.\n\n* Menu:\n\n* Binary Data::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Binary Data,  Up: Using a Socket": {
            "content": "9.10.3.1 Binary Data\n....................\n",
            "subsections": []
        },
        "It is perfectly possible to send binary data over a socket.  The major": {
            "content": "problem is that not all machines use the same formats for binary data.",
            "subsections": []
        },
        "For example, network byte order(1) is big-endian, with the most": {
            "content": "significant byte first, so a 16 bit integer with the value '1' would be\nthe two hex bytes '00 01'.  However, most common processors (x86/AMD64,\nARM, RISC-V), are little-endian, with the least significant byte first -\nthat same '1' would be '01 00'.\n",
            "subsections": []
        },
        "Socket libraries have calls for converting 16 and 32 bit integers -": {
            "content": "'ntohl, htonl, ntohs, htons' where \"n\" means 'network' and \"h\" means\n'host', \"s\" means 'short' and \"l\" means 'long'.  Where network order is\nhost order, these do nothing, but where the machine is byte-reversed,\nthese swap the bytes around appropriately.\n",
            "subsections": []
        },
        "In these days of 64-bit machines, the ASCII representation of binary": {
            "content": "data is frequently smaller than the binary representation.  That's\nbecause a surprising amount of the time, most integers have the value 0,\nor maybe 1.  The string '\"0\"' would be two bytes, while a full 64-bit\ninteger would be 8.  Of course, this doesn't fit well with fixed-length\nmessages.  Decisions, decisions.\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Endianness#Networking\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Disconnecting,  Next: Non-blocking Sockets,  Prev: Using a Socket,  Up: Socket Programming HOWTO": {
            "content": "",
            "subsections": []
        },
        "Strictly speaking, you're supposed to use 'shutdown' on a socket before": {
            "content": "you 'close' it.  The 'shutdown' is an advisory to the socket at the\nother end.  Depending on the argument you pass it, it can mean \"I'm not\ngoing to send anymore, but I'll still listen\", or \"I'm not listening,\ngood riddance!\".  Most socket libraries, however, are so used to\nprogrammers neglecting to use this piece of etiquette that normally a\n'close' is the same as 'shutdown(); close()'.  So in most situations, an\nexplicit 'shutdown' is not needed.\n",
            "subsections": []
        },
        "One way to use 'shutdown' effectively is in an HTTP-like exchange.  The": {
            "content": "client sends a request and then does a 'shutdown(1)'.  This tells the\nserver \"This client is done sending, but can still receive.\" The server\ncan detect \"EOF\" by a receive of 0 bytes.  It can assume it has the\ncomplete request.  The server sends a reply.  If the 'send' completes\nsuccessfully then, indeed, the client was still receiving.\n",
            "subsections": []
        },
        "Python takes the automatic shutdown a step further, and says that when a": {
            "content": "socket is garbage collected, it will automatically do a 'close' if it's\nneeded.  But relying on this is a very bad habit.  If your socket just\ndisappears without doing a 'close', the socket at the other end may hang\nindefinitely, thinking you're just being slow.  'Please' 'close' your\nsockets when you're done.\n\n* Menu:\n\n* When Sockets Die::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: When Sockets Die,  Up: Disconnecting": {
            "content": "9.10.4.1 When Sockets Die\n.........................\n",
            "subsections": []
        },
        "Probably the worst thing about using blocking sockets is what happens": {
            "content": "when the other side comes down hard (without doing a 'close').  Your\nsocket is likely to hang.  TCP is a reliable protocol, and it will wait\na long, long time before giving up on a connection.  If you're using\nthreads, the entire thread is essentially dead.  There's not much you\ncan do about it.  As long as you aren't doing something dumb, like\nholding a lock while doing a blocking read, the thread isn't really\nconsuming much in the way of resources.  Do 'not' try to kill the thread\n- part of the reason that threads are more efficient than processes is\nthat they avoid the overhead associated with the automatic recycling of\nresources.  In other words, if you do manage to kill the thread, your\nwhole process is likely to be screwed up.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Non-blocking Sockets,  Prev: Disconnecting,  Up: Socket Programming HOWTO": {
            "content": "",
            "subsections": []
        },
        "If you've understood the preceding, you already know most of what you": {
            "content": "need to know about the mechanics of using sockets.  You'll still use the\nsame calls, in much the same ways.  It's just that, if you do it right,\nyour app will be almost inside-out.\n\nIn Python, you use 'socket.setblocking(False)' to make it non-blocking.",
            "subsections": []
        },
        "In C, it's more complex, (for one thing, you'll need to choose between": {
            "content": "the BSD flavor 'ONONBLOCK' and the almost indistinguishable POSIX\nflavor 'ONDELAY', which is completely different from 'TCPNODELAY'),\nbut it's the exact same idea.  You do this after creating the socket,\nbut before using it.  (Actually, if you're nuts, you can switch back and\nforth.)\n",
            "subsections": []
        },
        "The major mechanical difference is that 'send', 'recv', 'connect' and": {
            "content": "'accept' can return without having done anything.  You have (of course)\na number of choices.  You can check return code and error codes and\ngenerally drive yourself crazy.  If you don't believe me, try it\nsometime.  Your app will grow large, buggy and suck CPU. So let's skip\nthe brain-dead solutions and do it right.\n\nUse 'select'.\n",
            "subsections": []
        },
        "In C, coding 'select' is fairly complex.  In Python, it's a piece of": {
            "content": "cake, but it's close enough to the C version that if you understand\n'select' in Python, you'll have little trouble with it in C:\n\nreadytoread, readytowrite, inerror = \\\nselect.select(\npotentialreaders,\npotentialwriters,\npotentialerrs,\ntimeout)\n",
            "subsections": []
        },
        "You pass 'select' three lists: the first contains all sockets that you": {
            "content": "might want to try reading; the second all the sockets you might want to\ntry writing to, and the last (normally left empty) those that you want\nto check for errors.  You should note that a socket can go into more\nthan one list.  The 'select' call is blocking, but you can give it a\ntimeout.  This is generally a sensible thing to do - give it a nice long\ntimeout (say a minute) unless you have good reason to do otherwise.\n",
            "subsections": []
        },
        "In return, you will get three lists.  They contain the sockets that are": {
            "content": "actually readable, writable and in error.  Each of these lists is a\nsubset (possibly empty) of the corresponding list you passed in.\n",
            "subsections": []
        },
        "If a socket is in the output readable list, you can be": {
            "content": "as-close-to-certain-as-we-ever-get-in-this-business that a 'recv' on\nthat socket will return 'something'.  Same idea for the writable list.",
            "subsections": []
        },
        "You'll be able to send 'something'.  Maybe not all you want to, but": {
            "content": "'something' is better than nothing.  (Actually, any reasonably healthy\nsocket will return as writable - it just means outbound network buffer\nspace is available.)\n\nIf you have a \"server\" socket, put it in the potentialreaders list.  If\nit comes out in the readable list, your 'accept' will (almost certainly)\nwork.  If you have created a new socket to 'connect' to someone else,\nput it in the potentialwriters list.  If it shows up in the writable\nlist, you have a decent chance that it has connected.\n",
            "subsections": []
        },
        "Actually, 'select' can be handy even with blocking sockets.  It's one": {
            "content": "way of determining whether you will block - the socket returns as\nreadable when there's something in the buffers.  However, this still\ndoesn't help with the problem of determining whether the other end is\ndone, or just busy with something else.\n\n'Portability alert': On Unix, 'select' works both with the sockets and\nfiles.  Don't try this on Windows.  On Windows, 'select' works with\nsockets only.  Also note that in C, many of the more advanced socket\noptions are done differently on Windows.  In fact, on Windows I usually\nuse threads (which work very, very well) with my sockets.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Sorting Techniques,  Next: Unicode HOWTO,  Prev: Socket Programming HOWTO,  Up: Python HOWTOs": {
            "content": "",
            "subsections": [
                {
                    "name": "9.11 Sorting Techniques",
                    "content": ""
                }
            ]
        },
        "Author: Andrew Dalke and Raymond Hettinger": {
            "content": "Python lists have a built-in *note list.sort(): a13. method that\nmodifies the list in-place.  There is also a *note sorted(): a12.\nbuilt-in function that builds a new sorted list from an iterable.\n",
            "subsections": []
        },
        "In this document, we explore the various techniques for sorting data": {
            "content": "using Python.\n\n* Menu:\n\n* Sorting Basics::\n* Key Functions::\n* Operator Module Functions and Partial Function Evaluation::\n* Ascending and Descending::\n* Sort Stability and Complex Sorts::\n* Decorate-Sort-Undecorate::\n* Comparison Functions::\n* Odds and Ends: Odds and Ends<2>.\n* Partial Sorts::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Sorting Basics,  Next: Key Functions,  Up: Sorting Techniques": {
            "content": "A simple ascending sort is very easy: just call the *note sorted(): a12.\nfunction.  It returns a new sorted list:\n\n>>> sorted([5, 2, 3, 1, 4])\n[1, 2, 3, 4, 5]\n\nYou can also use the *note list.sort(): a13. method.  It modifies the\nlist in-place (and returns 'None' to avoid confusion).  Usually it's\nless convenient than *note sorted(): a12. - but if you don't need the\noriginal list, it's slightly more efficient.\n\n>>> a = [5, 2, 3, 1, 4]\n>>> a.sort()\n>>> a\n[1, 2, 3, 4, 5]\n\nAnother difference is that the *note list.sort(): a13. method is only\ndefined for lists.  In contrast, the *note sorted(): a12. function\naccepts any iterable.\n\n>>> sorted({1: 'D', 2: 'B', 3: 'B', 4: 'E', 5: 'A'})\n[1, 2, 3, 4, 5]\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Key Functions,  Next: Operator Module Functions and Partial Function Evaluation,  Prev: Sorting Basics,  Up: Sorting Techniques": {
            "content": "Both *note list.sort(): a13. and *note sorted(): a12. have a 'key'\nparameter to specify a function (or other callable) to be called on each\nlist element prior to making comparisons.\n\nFor example, here's a case-insensitive string comparison:\n\n>>> sorted(\"This is a test string from Andrew\".split(), key=str.casefold)\n['a', 'Andrew', 'from', 'is', 'string', 'test', 'This']\n",
            "subsections": []
        },
        "The value of the 'key' parameter should be a function (or other": {
            "content": "callable) that takes a single argument and returns a key to use for\nsorting purposes.  This technique is fast because the key function is\ncalled exactly once for each input record.\n\nA common pattern is to sort complex objects using some of the object's\nindices as keys.  For example:\n\n>>> studenttuples = [\n...     ('john', 'A', 15),\n...     ('jane', 'B', 12),\n...     ('dave', 'B', 10),\n... ]\n>>> sorted(studenttuples, key=lambda student: student[2])   # sort by age\n[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]\n",
            "subsections": []
        },
        "The same technique works for objects with named attributes.  For": {
            "content": "example:\n\n>>> class Student:\n...     def init(self, name, grade, age):\n...         self.name = name\n...         self.grade = grade\n...         self.age = age\n...     def repr(self):\n...         return repr((self.name, self.grade, self.age))\n\n>>> studentobjects = [\n...     Student('john', 'A', 15),\n...     Student('jane', 'B', 12),\n...     Student('dave', 'B', 10),\n... ]\n>>> sorted(studentobjects, key=lambda student: student.age)   # sort by age\n[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]\n",
            "subsections": []
        },
        "Objects with named attributes can be made by a regular class as shown": {
            "content": "above, or they can be instances of *note dataclass: 38d. or a *note\nnamed tuple: 417.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Operator Module Functions and Partial Function Evaluation,  Next: Ascending and Descending,  Prev: Key Functions,  Up: Sorting Techniques": {
            "content": "The *note key function: c62. patterns shown above are very common, so",
            "subsections": []
        },
        "Python provides convenience functions to make accessor functions easier": {
            "content": "and faster.  The *note operator: 9a. module has *note itemgetter(): 88f,\n*note attrgetter(): c92, and a *note methodcaller(): c93. function.\n\nUsing those functions, the above examples become simpler and faster:\n\n>>> from operator import itemgetter, attrgetter\n\n>>> sorted(studenttuples, key=itemgetter(2))\n[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]\n\n>>> sorted(studentobjects, key=attrgetter('age'))\n[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]\n",
            "subsections": []
        },
        "The operator module functions allow multiple levels of sorting.  For": {
            "content": "example, to sort by 'grade' then by 'age':\n\n>>> sorted(studenttuples, key=itemgetter(1,2))\n[('john', 'A', 15), ('dave', 'B', 10), ('jane', 'B', 12)]\n\n>>> sorted(studentobjects, key=attrgetter('grade', 'age'))\n[('john', 'A', 15), ('dave', 'B', 10), ('jane', 'B', 12)]\n\nThe *note functools: 5a. module provides another helpful tool for making\nkey-functions.  The *note partial(): d31. function can reduce the\narity(1) of a multi-argument function making it suitable for use as a\nkey-function.\n\n>>> from functools import partial\n>>> from unicodedata import normalize\n\n>>> names = 'Zoe\" ??bj??rn N??n~ez ??lana Zeke Abe Nubia Eloise'.split()\n\n>>> sorted(names, key=partial(normalize, 'NFD'))\n['Abe', '??bj??rn', 'Eloise', '??lana', 'Nubia', 'N??n~ez', 'Zeke', 'Zoe\"']\n\n>>> sorted(names, key=partial(normalize, 'NFC'))\n['Abe', 'Eloise', 'Nubia', 'N??n~ez', 'Zeke', 'Zoe\"', '??bj??rn', '??lana']\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Arity\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Ascending and Descending,  Next: Sort Stability and Complex Sorts,  Prev: Operator Module Functions and Partial Function Evaluation,  Up: Sorting Techniques": {
            "content": "Both *note list.sort(): a13. and *note sorted(): a12. accept a 'reverse'\nparameter with a boolean value.  This is used to flag descending sorts.\nFor example, to get the student data in reverse 'age' order:\n\n>>> sorted(studenttuples, key=itemgetter(2), reverse=True)\n[('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]\n\n>>> sorted(studentobjects, key=attrgetter('age'), reverse=True)\n[('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Sort Stability and Complex Sorts,  Next: Decorate-Sort-Undecorate,  Prev: Ascending and Descending,  Up: Sorting Techniques": {
            "content": "",
            "subsections": []
        },
        "Sorts are guaranteed to be stable(1).  That means that when multiple": {
            "content": "records have the same key, their original order is preserved.\n\n>>> data = [('red', 1), ('blue', 1), ('red', 2), ('blue', 2)]\n>>> sorted(data, key=itemgetter(0))\n[('blue', 1), ('blue', 2), ('red', 1), ('red', 2)]\n",
            "subsections": []
        },
        "Notice how the two records for 'blue' retain their original order so": {
            "content": "that '('blue', 1)' is guaranteed to precede '('blue', 2)'.\n",
            "subsections": []
        },
        "This wonderful property lets you build complex sorts in a series of": {
            "content": "sorting steps.  For example, to sort the student data by descending\n'grade' and then ascending 'age', do the 'age' sort first and then sort\nagain using 'grade':\n\n>>> s = sorted(studentobjects, key=attrgetter('age'))     # sort on secondary key\n>>> sorted(s, key=attrgetter('grade'), reverse=True)       # now sort on primary key, descending\n[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]\n",
            "subsections": []
        },
        "This can be abstracted out into a wrapper function that can take a list": {
            "content": "and tuples of field and order to sort them on multiple passes.\n\n>>> def multisort(xs, specs):\n...     for key, reverse in reversed(specs):\n...         xs.sort(key=attrgetter(key), reverse=reverse)\n...     return xs\n\n>>> multisort(list(studentobjects), (('grade', True), ('age', False)))\n[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]\n",
            "subsections": []
        },
        "The Timsort(2) algorithm used in Python does multiple sorts efficiently": {
            "content": "because it can take advantage of any ordering already present in a\ndataset.\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Sortingalgorithm#Stability\n\n(2) https://en.wikipedia.org/wiki/Timsort\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Decorate-Sort-Undecorate,  Next: Comparison Functions,  Prev: Sort Stability and Complex Sorts,  Up: Sorting Techniques": {
            "content": "This idiom is called Decorate-Sort-Undecorate after its three steps:\n\n* First, the initial list is decorated with new values that control\nthe sort order.\n\n* Second, the decorated list is sorted.\n\n* Finally, the decorations are removed, creating a list that contains\nonly the initial values in the new order.\n\nFor example, to sort the student data by 'grade' using the DSU approach:\n\n>>> decorated = [(student.grade, i, student) for i, student in enumerate(studentobjects)]\n>>> decorated.sort()\n>>> [student for grade, i, student in decorated]               # undecorate\n[('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]\n",
            "subsections": []
        },
        "This idiom works because tuples are compared lexicographically; the": {
            "content": "first items are compared; if they are the same then the second items are\ncompared, and so on.\n",
            "subsections": []
        },
        "It is not strictly necessary in all cases to include the index 'i' in": {
            "content": "the decorated list, but including it gives two benefits:\n\n* The sort is stable - if two items have the same key, their order\nwill be preserved in the sorted list.\n\n* The original items do not have to be comparable because the\nordering of the decorated tuples will be determined by at most the\nfirst two items.  So for example the original list could contain\ncomplex numbers which cannot be sorted directly.\n\nAnother name for this idiom is Schwartzian transform(1), after Randal L.\nSchwartz, who popularized it among Perl programmers.\n",
            "subsections": []
        },
        "Now that Python sorting provides key-functions, this technique is not": {
            "content": "often needed.\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/Schwartziantransform\n\nFile: python3.12.info,  Node: Comparison Functions,  Next: Odds and Ends<2>,  Prev: Decorate-Sort-Undecorate,  Up: Sorting Techniques\n\n",
            "subsections": []
        },
        "Unlike key functions that return an absolute value for sorting, a": {
            "content": "comparison function computes the relative ordering for two inputs.\n",
            "subsections": []
        },
        "For example, a balance scale(1) compares two samples giving a relative": {
            "content": "ordering: lighter, equal, or heavier.  Likewise, a comparison function\nsuch as 'cmp(a, b)' will return a negative value for less-than, zero if\nthe inputs are equal, or a positive value for greater-than.\n",
            "subsections": []
        },
        "It is common to encounter comparison functions when translating": {
            "content": "algorithms from other languages.  Also, some libraries provide\ncomparison functions as part of their API. For example, *note\nlocale.strcoll(): 3982. is a comparison function.\n\nTo accommodate those situations, Python provides *note\nfunctools.cmptokey: 104e. to wrap the comparison function to make it\nusable as a key function:\n\nsorted(words, key=cmptokey(strcoll))  # locale-aware sort order\n\n---------- Footnotes ----------\n\n(1)\nhttps://upload.wikimedia.org/wikipedia/commons/1/17/Balancea`tabac1850.JPG\n\nFile: python3.12.info,  Node: Odds and Ends<2>,  Next: Partial Sorts,  Prev: Comparison Functions,  Up: Sorting Techniques\n\n\n* For locale aware sorting, use *note locale.strxfrm(): 3984. for a\nkey function or *note locale.strcoll(): 3982. for a comparison\nfunction.  This is necessary because \"alphabetical\" sort orderings\ncan vary across cultures even if the underlying alphabet is the\nsame.\n\n* The 'reverse' parameter still maintains sort stability (so that\nrecords with equal keys retain the original order).  Interestingly,\nthat effect can be simulated without the parameter by using the\nbuiltin *note reversed(): 661. function twice:\n\n>>> data = [('red', 1), ('blue', 1), ('red', 2), ('blue', 2)]\n>>> standardway = sorted(data, key=itemgetter(0), reverse=True)\n>>> doublereversed = list(reversed(sorted(reversed(data), key=itemgetter(0))))\n>>> assert standardway == doublereversed\n>>> standardway\n[('red', 1), ('red', 2), ('blue', 1), ('blue', 2)]\n\n* The sort routines use '<' when making comparisons between two\nobjects.  So, it is easy to add a standard sort order to a class by\ndefining an *note lt(): 1180. method:\n\n>>> Student.lt = lambda self, other: self.age < other.age\n>>> sorted(studentobjects)\n[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]\n\nHowever, note that '<' can fall back to using *note gt(): 1182.\nif *note lt(): 1180. is not implemented (see *note\nobject.lt(): 1180. for details on the mechanics).  To avoid\nsurprises, PEP 8(1) recommends that all six comparison methods be\nimplemented.  The *note totalordering(): db2. decorator is\nprovided to make that task easier.\n\n* Key functions need not depend directly on the objects being sorted.\nA key function can also access external resources.  For instance,\nif the student grades are stored in a dictionary, they can be used\nto sort a separate list of student names:\n\n>>> students = ['dave', 'john', 'jane']\n>>> newgrades = {'john': 'F', 'jane':'A', 'dave': 'C'}\n>>> sorted(students, key=newgrades.getitem)\n['jane', 'dave', 'john']\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0008/\n\nFile: python3.12.info,  Node: Partial Sorts,  Prev: Odds and Ends<2>,  Up: Sorting Techniques\n\n",
            "subsections": []
        },
        "Some applications require only some of the data to be ordered.  The": {
            "content": "standard library provides several tools that do less work than a full\nsort:\n\n* *note min(): d6f. and *note max(): d70. return the smallest and\nlargest values, respectively.  These functions make a single pass\nover the input data and require almost no auxiliary memory.\n\n* *note heapq.nsmallest(): 223a. and *note heapq.nlargest(): 2239.\nreturn the 'n' smallest and largest values, respectively.  These\nfunctions make a single pass over the data keeping only 'n'\nelements in memory at a time.  For values of 'n' that are small\nrelative to the number of inputs, these functions make far fewer\ncomparisons than a full sort.\n\n* *note heapq.heappush(): 1313. and *note heapq.heappop(): 1314.\ncreate and maintain a partially sorted arrangement of data that\nkeeps the smallest element at position '0'.  These functions are\nsuitable for implementing priority queues which are commonly used\nfor task scheduling.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Unicode HOWTO,  Next: HOWTO Fetch Internet Resources Using The urllib Package,  Prev: Sorting Techniques,  Up: Python HOWTOs": {
            "content": "",
            "subsections": [
                {
                    "name": "9.12 Unicode HOWTO",
                    "content": ""
                }
            ]
        },
        "Release: 1.12": {
            "content": "",
            "subsections": []
        },
        "This HOWTO discusses Python's support for the Unicode specification for": {
            "content": "representing textual data, and explains various problems that people\ncommonly encounter when trying to work with Unicode.\n\n* Menu:\n\n* Introduction to Unicode::\n* Python's Unicode Support::\n* Reading and Writing Unicode Data::\n* Acknowledgements: Acknowledgements<10>.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Introduction to Unicode,  Next: Python's Unicode Support,  Up: Unicode HOWTO": {
            "content": "* Menu:\n\n* Definitions::\n* Encodings::\n* References: References<3>.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Definitions,  Next: Encodings,  Up: Introduction to Unicode": {
            "content": "9.12.1.1 Definitions\n....................\n\nToday's programs need to be able to handle a wide variety of characters.",
            "subsections": []
        },
        "Applications are often internationalized to display messages and output": {
            "content": "in a variety of user-selectable languages; the same program might need\nto output an error message in English, French, Japanese, Hebrew, or",
            "subsections": []
        },
        "Russian.  Web content can be written in any of these languages and can": {
            "content": "also include a variety of emoji symbols.  Python's string type uses the",
            "subsections": []
        },
        "Unicode Standard for representing characters, which lets Python programs": {
            "content": "work with all these different possible characters.\n",
            "subsections": []
        },
        "Unicode ('https://www.unicode.org/') is a specification that aims to": {
            "content": "list every character used by human languages and give each character its\nown unique code.  The Unicode specifications are continually revised and\nupdated to add new languages and symbols.\n\nA 'character' is the smallest possible component of a text.  'A', 'B',\n'C', etc., are all different characters.  So are '??' and '??'.",
            "subsections": []
        },
        "Characters vary depending on the language or context you're talking": {
            "content": "about.  For example, there's a character for \"Roman Numeral One\", '???',\nthat's separate from the uppercase letter 'I'.  They'll usually look the\nsame, but these are two different characters that have different\nmeanings.\n",
            "subsections": []
        },
        "The Unicode standard describes how characters are represented by 'code": {
            "content": "points'.  A code point value is an integer in the range 0 to 0x10FFFF\n(about 1.1 million values, the actual number assigned(1) is less than\nthat).  In the standard and in this document, a code point is written\nusing the notation 'U+265E' to mean the character with value '0x265e'\n(9,822 in decimal).\n",
            "subsections": []
        },
        "The Unicode standard contains a lot of tables listing characters and": {
            "content": "their corresponding code points:\n\n0061    'a'; LATIN SMALL LETTER A\n0062    'b'; LATIN SMALL LETTER B\n0063    'c'; LATIN SMALL LETTER C\n...\n007B    '{'; LEFT CURLY BRACKET\n...\n2167    '???'; ROMAN NUMERAL EIGHT\n2168    '???'; ROMAN NUMERAL NINE\n...\n265E    '???'; BLACK CHESS KNIGHT\n265F    '???'; BLACK CHESS PAWN\n...\n1F600   '????'; GRINNING FACE\n1F609   '????'; WINKING FACE\n...\n",
            "subsections": []
        },
        "Strictly, these definitions imply that it's meaningless to say 'this is": {
            "content": "character 'U+265E''.  'U+265E' is a code point, which represents some\nparticular character; in this case, it represents the character 'BLACK\nCHESS KNIGHT', '???'.  In informal contexts, this distinction between code\npoints and characters will sometimes be forgotten.\n\nA character is represented on a screen or on paper by a set of graphical\nelements that's called a 'glyph'.  The glyph for an uppercase A, for\nexample, is two diagonal strokes and a horizontal stroke, though the\nexact details will depend on the font being used.  Most Python code\ndoesn't need to worry about glyphs; figuring out the correct glyph to\ndisplay is generally the job of a GUI toolkit or a terminal's font\nrenderer.\n\n---------- Footnotes ----------\n\n(1) https://www.unicode.org/versions/latest/#Summary\n\nFile: python3.12.info,  Node: Encodings,  Next: References<3>,  Prev: Definitions,  Up: Introduction to Unicode\n\n9.12.1.2 Encodings\n..................\n",
            "subsections": []
        },
        "To summarize the previous section: a Unicode string is a sequence of": {
            "content": "code points, which are numbers from 0 through '0x10FFFF' (1,114,111\ndecimal).  This sequence of code points needs to be represented in\nmemory as a set of 'code units', and 'code units' are then mapped to\n8-bit bytes.  The rules for translating a Unicode string into a sequence\nof bytes are called a 'character encoding', or just an 'encoding'.\n",
            "subsections": []
        },
        "The first encoding you might think of is using 32-bit integers as the": {
            "content": "code unit, and then using the CPU's representation of 32-bit integers.\nIn this representation, the string \"Python\" might look like this:\n\nP           y           t           h           o           n\n0x50 00 00 00 79 00 00 00 74 00 00 00 68 00 00 00 6f 00 00 00 6e 00 00 00\n0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23\n",
            "subsections": []
        },
        "This representation is straightforward but using it presents a number of": {
            "content": "problems.\n\n1. It's not portable; different processors order the bytes\ndifferently.\n\n2. It's very wasteful of space.  In most texts, the majority of the\ncode points are less than 127, or less than 255, so a lot of space\nis occupied by '0x00' bytes.  The above string takes 24 bytes\ncompared to the 6 bytes needed for an ASCII representation.\nIncreased RAM usage doesn't matter too much (desktop computers have\ngigabytes of RAM, and strings aren't usually that large), but\nexpanding our usage of disk and network bandwidth by a factor of 4\nis intolerable.\n\n3. It's not compatible with existing C functions such as 'strlen()',\nso a new family of wide string functions would need to be used.\n",
            "subsections": []
        },
        "Therefore this encoding isn't used very much, and people instead choose": {
            "content": "other encodings that are more efficient and convenient, such as UTF-8.\n\nUTF-8 is one of the most commonly used encodings, and Python often\ndefaults to using it.  UTF stands for \"Unicode Transformation Format\",\nand the '8' means that 8-bit values are used in the encoding.  (There\nare also UTF-16 and UTF-32 encodings, but they are less frequently used\nthan UTF-8.)  UTF-8 uses the following rules:\n\n1. If the code point is < 128, it's represented by the corresponding\nbyte value.\n\n2. If the code point is >= 128, it's turned into a sequence of two,\nthree, or four bytes, where each byte of the sequence is between\n128 and 255.\n\nUTF-8 has several convenient properties:\n\n1. It can handle any Unicode code point.\n\n2. A Unicode string is turned into a sequence of bytes that contains\nembedded zero bytes only where they represent the null character\n(U+0000).  This means that UTF-8 strings can be processed by C\nfunctions such as 'strcpy()' and sent through protocols that can't\nhandle zero bytes for anything other than end-of-string markers.\n\n3. A string of ASCII text is also valid UTF-8 text.\n\n4. UTF-8 is fairly compact; the majority of commonly used characters\ncan be represented with one or two bytes.\n\n5. If bytes are corrupted or lost, it's possible to determine the\nstart of the next UTF-8-encoded code point and resynchronize.  It's\nalso unlikely that random 8-bit data will look like valid UTF-8.\n\n6. UTF-8 is a byte oriented encoding.  The encoding specifies that\neach character is represented by a specific sequence of one or more\nbytes.  This avoids the byte-ordering issues that can occur with\ninteger and word oriented encodings, like UTF-16 and UTF-32, where\nthe sequence of bytes varies depending on the hardware on which the\nstring was encoded.\n\nFile: python3.12.info,  Node: References<3>,  Prev: Encodings,  Up: Introduction to Unicode\n\n9.12.1.3 References\n...................\n",
            "subsections": []
        },
        "The Unicode Consortium site(1) has character charts, a glossary, and PDF": {
            "content": "versions of the Unicode specification.  Be prepared for some difficult\nreading.  A chronology(2) of the origin and development of Unicode is\nalso available on the site.\n",
            "subsections": []
        },
        "On the Computerphile Youtube channel, Tom Scott briefly discusses the": {
            "content": "history of Unicode and UTF-8(3) (9 minutes 36 seconds).\n",
            "subsections": []
        },
        "To help understand the standard, Jukka Korpela has written an": {
            "content": "introductory guide(4) to reading the Unicode character tables.\n",
            "subsections": []
        },
        "Another good introductory article(5) was written by Joel Spolsky.  If": {
            "content": "this introduction didn't make things clear to you, you should try\nreading this alternate article before continuing.\n\nWikipedia entries are often helpful; see the entries for \"character\nencoding(6)\" and UTF-8(7), for example.\n\n---------- Footnotes ----------\n\n(1) https://www.unicode.org\n\n(2) https://www.unicode.org/history/\n\n(3) https://www.youtube.com/watch?v=MijmeoH9LT4\n\n(4) https://jkorpela.fi/unicode/guide.html\n\n(5)\nhttps://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/\n\n(6) https://en.wikipedia.org/wiki/Characterencoding\n\n(7) https://en.wikipedia.org/wiki/UTF-8\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python's Unicode Support,  Next: Reading and Writing Unicode Data,  Prev: Introduction to Unicode,  Up: Unicode HOWTO": {
            "content": "",
            "subsections": []
        },
        "Now that you've learned the rudiments of Unicode, we can look at": {
            "content": "Python's Unicode features.\n\n* Menu:\n\n* The String Type::\n* Converting to Bytes::\n* Unicode Literals in Python Source Code::\n* Unicode Properties::\n* Comparing Strings::\n* Unicode Regular Expressions::\n* References: References<4>.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The String Type,  Next: Converting to Bytes,  Up: Python's Unicode Support": {
            "content": "9.12.2.1 The String Type\n........................\n\nSince Python 3.0, the language's *note str: 157. type contains Unicode\ncharacters, meaning any string created using '\"unicode rocks!\"',\n''unicode rocks!'', or the triple-quoted string syntax is stored as\nUnicode.\n",
            "subsections": []
        },
        "The default encoding for Python source code is UTF-8, so you can simply": {
            "content": "include a Unicode character in a string literal:\n\ntry:\nwith open('/tmp/input.txt', 'r') as f:\n...\nexcept OSError:\n# 'File not found' error message.\nprint(\"Fichier non trouve'\")\n",
            "subsections": []
        },
        "Side note: Python 3 also supports using Unicode characters in": {
            "content": "identifiers:\n\nre'pertoire = \"/tmp/records.log\"\nwith open(re'pertoire, \"w\") as f:\nf.write(\"test\\n\")\n",
            "subsections": []
        },
        "If you can't enter a particular character in your editor or want to keep": {
            "content": "the source code ASCII-only for some reason, you can also use escape\nsequences in string literals.  (Depending on your system, you may see\nthe actual capital-delta glyph instead of a u escape.)\n\n>>> \"\\N{GREEK CAPITAL LETTER DELTA}\"  # Using the character name\n'\\u0394'\n>>> \"\\u0394\"                          # Using a 16-bit hex value\n'\\u0394'\n>>> \"\\U00000394\"                      # Using a 32-bit hex value\n'\\u0394'\n\nIn addition, one can create a string using the *note decode(): 6ef.\nmethod of *note bytes: 295.  This method takes an 'encoding' argument,\nsuch as 'UTF-8', and optionally an 'errors' argument.\n",
            "subsections": []
        },
        "The 'errors' argument specifies the response when the input string can't": {
            "content": "be converted according to the encoding's rules.  Legal values for this\nargument are ''strict'' (raise a *note UnicodeDecodeError: 83c.\nexception), ''replace'' (use 'U+FFFD', 'REPLACEMENT CHARACTER'),\n''ignore'' (just leave the character out of the Unicode result), or\n''backslashreplace'' (inserts a '\\xNN' escape sequence).  The following\nexamples show the differences:\n\n>>> b'\\x80abc'.decode(\"utf-8\", \"strict\")\nTraceback (most recent call last):\n...\nUnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0:\ninvalid start byte\n>>> b'\\x80abc'.decode(\"utf-8\", \"replace\")\n'\\ufffdabc'\n>>> b'\\x80abc'.decode(\"utf-8\", \"backslashreplace\")\n'\\\\x80abc'\n>>> b'\\x80abc'.decode(\"utf-8\", \"ignore\")\n'abc'\n\nEncodings are specified as strings containing the encoding's name.",
            "subsections": []
        },
        "Python comes with roughly 100 different encodings; see the Python": {
            "content": "Library Reference at *note Standard Encodings: c15. for a list.  Some\nencodings have multiple names; for example, ''latin-1'', ''iso88591''\nand ''8859'' are all synonyms for the same encoding.\n\nOne-character Unicode strings can also be created with the *note chr():\n1c11. built-in function, which takes integers and returns a Unicode\nstring of length 1 that contains the corresponding code point.  The\nreverse operation is the built-in *note ord(): 1c10. function that takes\na one-character Unicode string and returns the code point value:\n\n>>> chr(57344)\n'\\ue000'\n>>> ord('\\ue000')\n57344\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Converting to Bytes,  Next: Unicode Literals in Python Source Code,  Prev: The String Type,  Up: Python's Unicode Support": {
            "content": "9.12.2.2 Converting to Bytes\n............................\n\nThe opposite method of *note bytes.decode(): 6ef. is *note str.encode():\n6ee, which returns a *note bytes: 295. representation of the Unicode\nstring, encoded in the requested 'encoding'.\n\nThe 'errors' parameter is the same as the parameter of the *note\ndecode(): 6ef. method but supports a few more possible handlers.  As\nwell as ''strict'', ''ignore'', and ''replace'' (which in this case\ninserts a question mark instead of the unencodable character), there is\nalso ''xmlcharrefreplace'' (inserts an XML character reference),\n'backslashreplace' (inserts a '\\uNNNN' escape sequence) and\n'namereplace' (inserts a '\\N{...}' escape sequence).\n\nThe following example shows the different results:\n\n>>> u = chr(40960) + 'abcd' + chr(1972)\n>>> u.encode('utf-8')\nb'\\xea\\x80\\x80abcd\\xde\\xb4'\n>>> u.encode('ascii')\nTraceback (most recent call last):\n...\nUnicodeEncodeError: 'ascii' codec can't encode character '\\ua000' in\nposition 0: ordinal not in range(128)\n>>> u.encode('ascii', 'ignore')\nb'abcd'\n>>> u.encode('ascii', 'replace')\nb'?abcd?'\n>>> u.encode('ascii', 'xmlcharrefreplace')\nb'&#40960;abcd&#1972;'\n>>> u.encode('ascii', 'backslashreplace')\nb'\\\\ua000abcd\\\\u07b4'\n>>> u.encode('ascii', 'namereplace')\nb'\\\\N{YI SYLLABLE IT}abcd\\\\u07b4'\n",
            "subsections": []
        },
        "The low-level routines for registering and accessing the available": {
            "content": "encodings are found in the *note codecs: 19. module.  Implementing new\nencodings also requires understanding the *note codecs: 19. module.",
            "subsections": []
        },
        "However, the encoding and decoding functions returned by this module are": {
            "content": "usually more low-level than is comfortable, and writing new encodings is\na specialized task, so the module won't be covered in this HOWTO.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Unicode Literals in Python Source Code,  Next: Unicode Properties,  Prev: Converting to Bytes,  Up: Python's Unicode Support": {
            "content": "9.12.2.3 Unicode Literals in Python Source Code\n...............................................\n",
            "subsections": []
        },
        "In Python source code, specific Unicode code points can be written using": {
            "content": "the '\\u' escape sequence, which is followed by four hex digits giving\nthe code point.  The '\\U' escape sequence is similar, but expects eight\nhex digits, not four:\n\n>>> s = \"a\\xac\\u1234\\u20ac\\U00008000\"\n... #     ^^^^ two-digit hex escape\n... #         ^^^^^^ four-digit Unicode escape\n... #                     ^^^^^^^^^^ eight-digit Unicode escape\n>>> [ord(c) for c in s]\n[97, 172, 4660, 8364, 32768]\n",
            "subsections": []
        },
        "Using escape sequences for code points greater than 127 is fine in small": {
            "content": "doses, but becomes an annoyance if you're using many accented\ncharacters, as you would in a program with messages in French or some\nother accent-using language.  You can also assemble strings using the\n*note chr(): 1c11. built-in function, but this is even more tedious.\n",
            "subsections": []
        },
        "Ideally, you'd want to be able to write literals in your language's": {
            "content": "natural encoding.  You could then edit Python source code with your\nfavorite editor which would display the accented characters naturally,\nand have the right characters used at runtime.\n",
            "subsections": []
        },
        "Python supports writing source code in UTF-8 by default, but you can use": {
            "content": "almost any encoding if you declare the encoding being used.  This is\ndone by including a special comment as either the first or second line\nof the source file:\n\n#!/usr/bin/env python\n# -*- coding: latin-1 -*-\n\nu = 'abcde''\nprint(ord(u[-1]))\n",
            "subsections": []
        },
        "The syntax is inspired by Emacs's notation for specifying variables": {
            "content": "local to a file.  Emacs supports many different variables, but Python\nonly supports 'coding'.  The '-*-' symbols indicate to Emacs that the\ncomment is special; they have no significance to Python but are a\nconvention.  Python looks for 'coding: name' or 'coding=name' in the\ncomment.\n",
            "subsections": []
        },
        "If you don't include such a comment, the default encoding used will be": {
            "content": "UTF-8 as already mentioned.  See also PEP 263(1) for more information.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0263/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Unicode Properties,  Next: Comparing Strings,  Prev: Unicode Literals in Python Source Code,  Up: Python's Unicode Support": {
            "content": "9.12.2.4 Unicode Properties\n...........................\n",
            "subsections": []
        },
        "The Unicode specification includes a database of information about code": {
            "content": "points.  For each defined code point, the information includes the\ncharacter's name, its category, the numeric value if applicable (for\ncharacters representing numeric concepts such as the Roman numerals,\nfractions such as one-third and four-fifths, etc.).  There are also\ndisplay-related properties, such as how to use the code point in\nbidirectional text.\n",
            "subsections": []
        },
        "The following program displays some information about several": {
            "content": "characters, and prints the numeric value of one particular character:\n\nimport unicodedata\n\nu = chr(233) + chr(0x0bf2) + chr(3972) + chr(6000) + chr(13231)\n\nfor i, c in enumerate(u):\nprint(i, '%04x' % ord(c), unicodedata.category(c), end=\" \")\nprint(unicodedata.name(c))\n\n# Get numeric value of second character\nprint(unicodedata.numeric(u[1]))\n\nWhen run, this prints:\n\n0 00e9 Ll LATIN SMALL LETTER E WITH ACUTE\n1 0bf2 No TAMIL NUMBER ONE THOUSAND\n2 0f84 Mn TIBETAN MARK HALANTA\n3 1770 Lo TAGBANWA LETTER SA\n4 33af So SQUARE RAD OVER S SQUARED\n1000.0\n",
            "subsections": []
        },
        "The category codes are abbreviations describing the nature of the": {
            "content": "character.  These are grouped into categories such as \"Letter\",\n\"Number\", \"Punctuation\", or \"Symbol\", which in turn are broken up into\nsubcategories.  To take the codes from the above output, ''Ll'' means\n'Letter, lowercase', ''No'' means \"Number, other\", ''Mn'' is \"Mark,\nnonspacing\", and ''So'' is \"Symbol, other\".  See the General Category",
            "subsections": []
        },
        "Values section of the Unicode Character Database documentation(1) for a": {
            "content": "list of category codes.\n\n---------- Footnotes ----------\n\n(1) https://www.unicode.org/reports/tr44/#GeneralCategoryValues\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Comparing Strings,  Next: Unicode Regular Expressions,  Prev: Unicode Properties,  Up: Python's Unicode Support": {
            "content": "9.12.2.5 Comparing Strings\n..........................\n",
            "subsections": []
        },
        "Unicode adds some complication to comparing strings, because the same": {
            "content": "set of characters can be represented by different sequences of code\npoints.  For example, a letter like 'e^' can be represented as a single\ncode point U+00EA, or as U+0065 U+0302, which is the code point for 'e'\nfollowed by a code point for 'COMBINING CIRCUMFLEX ACCENT'.  These will\nproduce the same output when printed, but one is a string of length 1\nand the other is of length 2.\n\nOne tool for a case-insensitive comparison is the *note casefold(): c33.\nstring method that converts a string to a case-insensitive form\nfollowing an algorithm described by the Unicode Standard.  This\nalgorithm has special handling for characters such as the German letter\n'ss' (code point U+00DF), which becomes the pair of lowercase letters\n'ss'.\n\n>>> street = 'Gu\"rzenichstrasse'\n>>> street.casefold()\n'gu\"rzenichstrasse'\n\nA second tool is the *note unicodedata: 100. module's *note normalize():\n4a4. function that converts strings to one of several normal forms,\nwhere letters followed by a combining character are replaced with single\ncharacters.  *note normalize(): 4a4. can be used to perform string\ncomparisons that won't falsely report inequality if two strings use\ncombining characters differently:\n\nimport unicodedata\n\ndef comparestrs(s1, s2):\ndef NFD(s):\nreturn unicodedata.normalize('NFD', s)\n\nreturn NFD(s1) == NFD(s2)\n\nsinglechar = 'e^'\nmultiplechars = '\\N{LATIN SMALL LETTER E}\\N{COMBINING CIRCUMFLEX ACCENT}'\nprint('length of first string=', len(singlechar))\nprint('length of second string=', len(multiplechars))\nprint(comparestrs(singlechar, multiplechars))\n\nWhen run, this outputs:\n\n$ python compare-strs.py\nlength of first string= 1\nlength of second string= 2\nTrue\n\nThe first argument to the *note normalize(): 4a4. function is a string\ngiving the desired normalization form, which can be one of 'NFC',\n'NFKC', 'NFD', and 'NFKD'.\n\nThe Unicode Standard also specifies how to do caseless comparisons:\n\nimport unicodedata\n\ndef comparecaseless(s1, s2):\ndef NFD(s):\nreturn unicodedata.normalize('NFD', s)\n\nreturn NFD(NFD(s1).casefold()) == NFD(NFD(s2).casefold())\n\n# Example usage\nsinglechar = 'e^'\nmultiplechars = '\\N{LATIN CAPITAL LETTER E}\\N{COMBINING CIRCUMFLEX ACCENT}'\n\nprint(comparecaseless(singlechar, multiplechars))\n\nThis will print 'True'.  (Why is 'NFD()' invoked twice?  Because there\nare a few characters that make *note casefold(): c33. return a\nnon-normalized string, so the result needs to be normalized again.  See\nsection 3.13 of the Unicode Standard for a discussion and an example.)\n\nFile: python3.12.info,  Node: Unicode Regular Expressions,  Next: References<4>,  Prev: Comparing Strings,  Up: Python's Unicode Support\n\n9.12.2.6 Unicode Regular Expressions\n....................................\n\nThe regular expressions supported by the *note re: b4. module can be\nprovided either as bytes or strings.  Some of the special character\nsequences such as '\\d' and '\\w' have different meanings depending on\nwhether the pattern is supplied as bytes or a string.  For example, '\\d'\nwill match the characters '[0-9]' in bytes but in strings will match any\ncharacter that's in the ''Nd'' category.\n",
            "subsections": []
        },
        "The string in this example has the number 57 written in both Thai and": {
            "content": "Arabic numerals:\n\nimport re\np = re.compile(r'\\d+')\n\ns = \"Over \\u0e55\\u0e57 57 flavours\"\nm = p.search(s)\nprint(repr(m.group()))\n\nWhen executed, '\\d+' will match the Thai numerals and print them out.\nIf you supply the *note re.ASCII: 3f9. flag to *note compile(): a17,\n'\\d+' will match the substring \"57\" instead.\n\nSimilarly, '\\w' matches a wide variety of Unicode characters but only\n'[a-zA-Z0-9]' in bytes or if *note re.ASCII: 3f9. is supplied, and '\\s'\nwill match either Unicode whitespace characters or '[ \\t\\n\\r\\f\\v]'.\n\nFile: python3.12.info,  Node: References<4>,  Prev: Unicode Regular Expressions,  Up: Python's Unicode Support\n\n9.12.2.7 References\n...................\n\nSome good alternative discussions of Python's Unicode support are:\n\n* Processing Text Files in Python 3(1), by Nick Coghlan.\n\n* Pragmatic Unicode(2), a PyCon 2012 presentation by Ned Batchelder.\n\nThe *note str: 157. type is described in the Python library reference at\n*note Text Sequence Type -- str: 1983.\n\nThe documentation for the *note unicodedata: 100. module.\n\nThe documentation for the *note codecs: 19. module.\n\nMarc-Andre' Lemburg gave a presentation titled \"Python and Unicode\" (PDF\nslides)(3) at EuroPython 2002.  The slides are an excellent overview of\nthe design of Python 2's Unicode features (where the Unicode string type\nis called 'unicode' and literals start with 'u').\n\n---------- Footnotes ----------\n\n(1)\nhttps://python-notes.curiousefficiency.org/en/latest/python3/textfileprocessing.html\n\n(2) https://nedbatchelder.com/text/unipain.html\n\n(3) https://downloads.egenix.com/python/Unicode-EPC2002-Talk.pdf\n\nFile: python3.12.info,  Node: Reading and Writing Unicode Data,  Next: Acknowledgements<10>,  Prev: Python's Unicode Support,  Up: Unicode HOWTO\n\n",
            "subsections": []
        },
        "Once you've written some code that works with Unicode data, the next": {
            "content": "problem is input/output.  How do you get Unicode strings into your\nprogram, and how do you convert Unicode into a form suitable for storage\nor transmission?\n",
            "subsections": []
        },
        "It's possible that you may not need to do anything depending on your": {
            "content": "input sources and output destinations; you should check whether the\nlibraries used in your application support Unicode natively.  XML\nparsers often return Unicode data, for example.  Many relational\ndatabases also support Unicode-valued columns and can return Unicode\nvalues from an SQL query.\n",
            "subsections": []
        },
        "Unicode data is usually converted to a particular encoding before it": {
            "content": "gets written to disk or sent over a socket.  It's possible to do all the\nwork yourself: open a file, read an 8-bit bytes object from it, and\nconvert the bytes with 'bytes.decode(encoding)'.  However, the manual\napproach is not recommended.\n",
            "subsections": []
        },
        "One problem is the multi-byte nature of encodings; one Unicode character": {
            "content": "can be represented by several bytes.  If you want to read the file in\narbitrary-sized chunks (say, 1024 or 4096 bytes), you need to write\nerror-handling code to catch the case where only part of the bytes\nencoding a single Unicode character are read at the end of a chunk.  One\nsolution would be to read the entire file into memory and then perform\nthe decoding, but that prevents you from working with files that are\nextremely large; if you need to read a 2 GiB file, you need 2 GiB of\nRAM.  (More, really, since for at least a moment you'd need to have both\nthe encoded string and its Unicode version in memory.)\n",
            "subsections": []
        },
        "The solution would be to use the low-level decoding interface to catch": {
            "content": "the case of partial coding sequences.  The work of implementing this has\nalready been done for you: the built-in *note open(): 26e. function can\nreturn a file-like object that assumes the file's contents are in a\nspecified encoding and accepts Unicode parameters for methods such as\n*note read(): 1a0a. and *note write(): 19f9.  This works through *note\nopen(): 26e.'s 'encoding' and 'errors' parameters which are interpreted\njust like those in *note str.encode(): 6ee. and *note bytes.decode():\n6ef.\n\nReading Unicode from a file is therefore simple:\n\nwith open('unicode.txt', encoding='utf-8') as f:\nfor line in f:\nprint(repr(line))\n",
            "subsections": []
        },
        "It's also possible to open files in update mode, allowing both reading": {
            "content": "and writing:\n\nwith open('test', encoding='utf-8', mode='w+') as f:\nf.write('\\u4500 blah blah blah\\n')\nf.seek(0)\nprint(repr(f.readline()[:1]))\n\nThe Unicode character 'U+FEFF' is used as a byte-order mark (BOM), and\nis often written as the first character of a file in order to assist\nwith autodetection of the file's byte ordering.  Some encodings, such as\nUTF-16, expect a BOM to be present at the start of a file; when such an\nencoding is used, the BOM will be automatically written as the first\ncharacter and will be silently dropped when the file is read.  There are\nvariants of these encodings, such as 'utf-16-le' and 'utf-16-be' for\nlittle-endian and big-endian encodings, that specify one particular byte\nordering and don't skip the BOM.\n\nIn some areas, it is also convention to use a \"BOM\" at the start of\nUTF-8 encoded files; the name is misleading since UTF-8 is not\nbyte-order dependent.  The mark simply announces that the file is\nencoded in UTF-8.  For reading such files, use the 'utf-8-sig' codec to\nautomatically skip the mark if present.\n\n* Menu:\n\n* Unicode filenames::\n* Tips for Writing Unicode-aware Programs::\n* References: References<5>.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Unicode filenames,  Next: Tips for Writing Unicode-aware Programs,  Up: Reading and Writing Unicode Data": {
            "content": "9.12.3.1 Unicode filenames\n..........................\n",
            "subsections": []
        },
        "Most of the operating systems in common use today support filenames that": {
            "content": "contain arbitrary Unicode characters.  Usually this is implemented by\nconverting the Unicode string into some encoding that varies depending\non the system.  Today Python is converging on using UTF-8: Python on",
            "subsections": []
        },
        "MacOS has used UTF-8 for several versions, and Python 3.6 switched to": {
            "content": "using UTF-8 on Windows as well.  On Unix systems, there will only be a\n*note filesystem encoding: 291.  if you've set the 'LANG' or 'LCCTYPE'\nenvironment variables; if you haven't, the default encoding is again\nUTF-8.\n\nThe *note sys.getfilesystemencoding(): aa2. function returns the\nencoding to use on your current system, in case you want to do the\nencoding manually, but there's not much reason to bother.  When opening\na file for reading or writing, you can usually just provide the Unicode\nstring as the filename, and it will be automatically converted to the\nright encoding for you:\n\nfilename = 'filename\\u4500abc'\nwith open(filename, 'w') as f:\nf.write('blah\\n')\n\nFunctions in the *note os: 9c. module such as *note os.stat(): 1bf. will\nalso accept Unicode filenames.\n\nThe *note os.listdir(): f6a. function returns filenames, which raises an\nissue: should it return the Unicode version of filenames, or should it\nreturn bytes containing the encoded versions?  *note os.listdir(): f6a.\ncan do both, depending on whether you provided the directory path as\nbytes or a Unicode string.  If you pass a Unicode string as the path,\nfilenames will be decoded using the filesystem's encoding and a list of",
            "subsections": []
        },
        "Unicode strings will be returned, while passing a byte path will return": {
            "content": "the filenames as bytes.  For example, assuming the default *note\nfilesystem encoding: 291. is UTF-8, running the following program:\n\nfn = 'filename\\u4500abc'\nf = open(fn, 'w')\nf.close()\n\nimport os\nprint(os.listdir(b'.'))\nprint(os.listdir('.'))\n\nwill produce the following output:\n\n$ python listdir-test.py\n[b'filename\\xe4\\x94\\x80abc', ...]\n['filename\\u4500abc', ...]\n",
            "subsections": []
        },
        "The first list contains UTF-8-encoded filenames, and the second list": {
            "content": "contains the Unicode versions.\n",
            "subsections": []
        },
        "Note that on most occasions, you should can just stick with using": {
            "content": "",
            "subsections": []
        },
        "Unicode with these APIs.  The bytes APIs should only be used on systems": {
            "content": "where undecodable file names can be present; that's pretty much only\nUnix systems now.\n\nFile: python3.12.info,  Node: Tips for Writing Unicode-aware Programs,  Next: References<5>,  Prev: Unicode filenames,  Up: Reading and Writing Unicode Data\n\n9.12.3.2 Tips for Writing Unicode-aware Programs\n................................................\n",
            "subsections": []
        },
        "This section provides some suggestions on writing software that deals": {
            "content": "with Unicode.\n\nThe most important tip is:\n\nSoftware should only work with Unicode strings internally, decoding\nthe input data as soon as possible and encoding the output only at\nthe end.\n",
            "subsections": []
        },
        "If you attempt to write processing functions that accept both Unicode": {
            "content": "and byte strings, you will find your program vulnerable to bugs wherever\nyou combine the two different kinds of strings.  There is no automatic\nencoding or decoding: if you do e.g.  'str + bytes', a *note TypeError:\n28e. will be raised.\n",
            "subsections": []
        },
        "When using data coming from a web browser or some other untrusted": {
            "content": "source, a common technique is to check for illegal characters in a\nstring before using the string in a generated command line or storing it\nin a database.  If you're doing this, be careful to check the decoded\nstring, not the encoded bytes data; some encodings may have interesting\nproperties, such as not being bijective or not being fully\nASCII-compatible.  This is especially true if the input data also\nspecifies the encoding, since the attacker can then choose a clever way\nto hide malicious text in the encoded bytestream.\n\n* Menu:\n\n* Converting Between File Encodings::\n* Files in an Unknown Encoding::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Converting Between File Encodings,  Next: Files in an Unknown Encoding,  Up: Tips for Writing Unicode-aware Programs": {
            "content": "9.12.3.3 Converting Between File Encodings\n..........................................\n\nThe *note StreamRecoder: 1768. class can transparently convert between\nencodings, taking a stream that returns data in encoding #1 and behaving\nlike a stream returning data in encoding #2.\n",
            "subsections": []
        },
        "For example, if you have an input file 'f' that's in Latin-1, you can": {
            "content": "wrap it with a *note StreamRecoder: 1768. to return bytes encoded in\nUTF-8:\n\nnewf = codecs.StreamRecoder(f,\n# en/decoder: used by read() to encode its results and\n# by write() to decode its input.\ncodecs.getencoder('utf-8'), codecs.getdecoder('utf-8'),\n\n# reader/writer: used to read and write to the stream.\ncodecs.getreader('latin-1'), codecs.getwriter('latin-1') )\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Files in an Unknown Encoding,  Prev: Converting Between File Encodings,  Up: Tips for Writing Unicode-aware Programs": {
            "content": "9.12.3.4 Files in an Unknown Encoding\n.....................................\n",
            "subsections": []
        },
        "What can you do if you need to make a change to a file, but don't know": {
            "content": "the file's encoding?  If you know the encoding is ASCII-compatible and\nonly want to examine or modify the ASCII parts, you can open the file\nwith the 'surrogateescape' error handler:\n\nwith open(fname, 'r', encoding=\"ascii\", errors=\"surrogateescape\") as f:\ndata = f.read()\n\n# make changes to the string 'data'\n\nwith open(fname + '.new', 'w',\nencoding=\"ascii\", errors=\"surrogateescape\") as f:\nf.write(data)\n",
            "subsections": []
        },
        "The 'surrogateescape' error handler will decode any non-ASCII bytes as": {
            "content": "code points in a special range running from U+DC80 to U+DCFF. These code\npoints will then turn back into the same bytes when the\n'surrogateescape' error handler is used to encode the data and write it\nback out.\n\nFile: python3.12.info,  Node: References<5>,  Prev: Tips for Writing Unicode-aware Programs,  Up: Reading and Writing Unicode Data\n\n9.12.3.5 References\n...................\n",
            "subsections": []
        },
        "One section of Mastering Python 3 Input/Output(1), a PyCon 2010 talk by": {
            "content": "David Beazley, discusses text processing and binary data handling.\n\nThe PDF slides for Marc-Andre' Lemburg's presentation \"Writing\nUnicode-aware Applications in Python\"(2) discuss questions of character\nencodings as well as how to internationalize and localize an\napplication.  These slides cover Python 2.x only.\n",
            "subsections": []
        },
        "The Guts of Unicode in Python(3) is a PyCon 2013 talk by Benjamin": {
            "content": "",
            "subsections": []
        },
        "Peterson that discusses the internal Unicode representation in Python": {
            "content": "3.3.\n\n---------- Footnotes ----------\n\n(1) https://pyvideo.org/video/289/pycon-2010-mastering-python-3-i-o\n\n(2)\nhttps://downloads.egenix.com/python/LSM2005-Developing-Unicode-aware-applications-in-Python.pdf\n\n(3) https://pyvideo.org/video/1768/the-guts-of-unicode-in-python\n\nFile: python3.12.info,  Node: Acknowledgements<10>,  Prev: Reading and Writing Unicode Data,  Up: Unicode HOWTO\n\n",
            "subsections": []
        },
        "The initial draft of this document was written by Andrew Kuchling.  It": {
            "content": "has since been revised further by Alexander Belopolsky, Georg Brandl,\nAndrew Kuchling, and Ezio Melotti.\n",
            "subsections": []
        },
        "Thanks to the following people who have noted errors or offered": {
            "content": "suggestions on this article: ??ric Araujo, Nicholas Bastin, Nick Coghlan,",
            "subsections": []
        },
        "Marius Gedminas, Kent Johnson, Ken Krugler, Marc-Andre' Lemburg, Martin": {
            "content": "von Lo\"wis, Terry J. Reedy, Serhiy Storchaka, Eryk Sun, Chad Whitacre,\nGraham Wideman.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: HOWTO Fetch Internet Resources Using The urllib Package,  Next: Argparse Tutorial,  Prev: Unicode HOWTO,  Up: Python HOWTOs": {
            "content": "",
            "subsections": [
                {
                    "name": "9.13 HOWTO Fetch Internet Resources Using The urllib Package",
                    "content": ""
                }
            ]
        },
        "Author: Michael Foord(1)": {
            "content": "* Menu:\n\n* Introduction: Introduction<15>.\n* Fetching URLs::\n* Handling Exceptions: Handling Exceptions<2>.\n* info and geturl::\n* Openers and Handlers::\n* Basic Authentication::\n* Proxies::\n* Sockets and Layers::\n* Footnotes::\n\n---------- Footnotes ----------\n\n(1) https://agileabstractions.com/\n\nFile: python3.12.info,  Node: Introduction<15>,  Next: Fetching URLs,  Up: HOWTO Fetch Internet Resources Using The urllib Package\n\n",
            "subsections": []
        },
        "Related Articles": {
            "content": "................\n",
            "subsections": []
        },
        "You may also find useful the following article on fetching web resources": {
            "content": "with Python:\n\n* Basic Authentication(1)\n\nA tutorial on 'Basic Authentication', with examples in Python.\n\n'urllib.request' is a Python module for fetching URLs (Uniform Resource",
            "subsections": []
        },
        "Locators).  It offers a very simple interface, in the form of the": {
            "content": "'urlopen' function.  This is capable of fetching URLs using a variety of\ndifferent protocols.  It also offers a slightly more complex interface\nfor handling common situations - like basic authentication, cookies,\nproxies and so on.  These are provided by objects called handlers and\nopeners.\n\nurllib.request supports fetching URLs for many \"URL schemes\" (identified\nby the string before the '\":\"' in URL - for example '\"ftp\"' is the URL\nscheme of '\"ftp://python.org/\"') using their associated network\nprotocols (e.g.  FTP, HTTP). This tutorial focuses on the most common\ncase, HTTP.\n",
            "subsections": []
        },
        "For straightforward situations 'urlopen' is very easy to use.  But as": {
            "content": "soon as you encounter errors or non-trivial cases when opening HTTP\nURLs, you will need some understanding of the HyperText Transfer",
            "subsections": []
        },
        "Protocol.  The most comprehensive and authoritative reference to HTTP is": {
            "content": "RFC 2616(2).  This is a technical document and not intended to be easy\nto read.  This HOWTO aims to illustrate using 'urllib', with enough\ndetail about HTTP to help you through.  It is not intended to replace\nthe *note urllib.request: 106. docs, but is supplementary to them.\n\n---------- Footnotes ----------\n\n(1)\nhttps://web.archive.org/web/20201215133350/http://www.voidspace.org.uk/python/articles/authentication.shtml\n\n(2) https://datatracker.ietf.org/doc/html/rfc2616.html\n\nFile: python3.12.info,  Node: Fetching URLs,  Next: Handling Exceptions<2>,  Prev: Introduction<15>,  Up: HOWTO Fetch Internet Resources Using The urllib Package\n\n\nThe simplest way to use urllib.request is as follows:\n\nimport urllib.request\nwith urllib.request.urlopen('http://python.org/') as response:\nhtml = response.read()\n",
            "subsections": []
        },
        "If you wish to retrieve a resource via URL and store it in a temporary": {
            "content": "location, you can do so via the *note shutil.copyfileobj(): 88a. and\n*note tempfile.NamedTemporaryFile(): 1ea. functions:\n\nimport shutil\nimport tempfile\nimport urllib.request\n\nwith urllib.request.urlopen('http://python.org/') as response:\nwith tempfile.NamedTemporaryFile(delete=False) as tmpfile:\nshutil.copyfileobj(response, tmpfile)\n\nwith open(tmpfile.name) as html:\npass\n",
            "subsections": []
        },
        "Many uses of urllib will be that simple (note that instead of an 'http:'": {
            "content": "URL we could have used a URL starting with 'ftp:', 'file:', etc.).",
            "subsections": []
        },
        "However, it's the purpose of this tutorial to explain the more": {
            "content": "complicated cases, concentrating on HTTP.\n\nHTTP is based on requests and responses - the client makes requests and\nservers send responses.  urllib.request mirrors this with a 'Request'\nobject which represents the HTTP request you are making.  In its\nsimplest form you create a Request object that specifies the URL you\nwant to fetch.  Calling 'urlopen' with this Request object returns a\nresponse object for the URL requested.  This response is a file-like\nobject, which means you can for example call '.read()' on the response:\n\nimport urllib.request\n\nreq = urllib.request.Request('http://python.org/')\nwith urllib.request.urlopen(req) as response:\nthepage = response.read()\n",
            "subsections": []
        },
        "Note that urllib.request makes use of the same Request interface to": {
            "content": "handle all URL schemes.  For example, you can make an FTP request like\nso:\n\nreq = urllib.request.Request('ftp://example.com/')\n",
            "subsections": []
        },
        "In the case of HTTP, there are two extra things that Request objects": {
            "content": "allow you to do: First, you can pass data to be sent to the server.\nSecond, you can pass extra information (\"metadata\") 'about' the data or\nabout the request itself, to the server - this information is sent as\nHTTP \"headers\".  Let's look at each of these in turn.\n\n* Menu:\n\n* Data::\n* Headers::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Data,  Next: Headers,  Up: Fetching URLs": {
            "content": "9.13.2.1 Data\n.............\n",
            "subsections": []
        },
        "Sometimes you want to send data to a URL (often the URL will refer to a": {
            "content": "CGI (Common Gateway Interface) script or other web application).  With\nHTTP, this is often done using what's known as a 'POST' request.  This\nis often what your browser does when you submit a HTML form that you\nfilled in on the web.  Not all POSTs have to come from forms: you can\nuse a POST to transmit arbitrary data to your own application.  In the\ncommon case of HTML forms, the data needs to be encoded in a standard\nway, and then passed to the Request object as the 'data' argument.  The\nencoding is done using a function from the *note urllib.parse: 105.\nlibrary.\n\nimport urllib.parse\nimport urllib.request\n\nurl = 'http://www.someserver.com/cgi-bin/register.cgi'\nvalues = {'name' : 'Michael Foord',\n'location' : 'Northampton',\n'language' : 'Python' }\n\ndata = urllib.parse.urlencode(values)\ndata = data.encode('ascii') # data should be bytes\nreq = urllib.request.Request(url, data)\nwith urllib.request.urlopen(req) as response:\nthepage = response.read()\n",
            "subsections": []
        },
        "Note that other encodings are sometimes required (e.g.  for file upload": {
            "content": "from HTML forms - see HTML Specification, Form Submission(1) for more\ndetails).\n\nIf you do not pass the 'data' argument, urllib uses a 'GET' request.",
            "subsections": []
        },
        "One way in which GET and POST requests differ is that POST requests": {
            "content": "often have \"side-effects\": they change the state of the system in some\nway (for example by placing an order with the website for a\nhundredweight of tinned spam to be delivered to your door).  Though the\nHTTP standard makes it clear that POSTs are intended to 'always' cause\nside-effects, and GET requests 'never' to cause side-effects, nothing\nprevents a GET request from having side-effects, nor a POST requests\nfrom having no side-effects.  Data can also be passed in an HTTP GET\nrequest by encoding it in the URL itself.\n\nThis is done as follows:\n\n>>> import urllib.request\n>>> import urllib.parse\n>>> data = {}\n>>> data['name'] = 'Somebody Here'\n>>> data['location'] = 'Northampton'\n>>> data['language'] = 'Python'\n>>> urlvalues = urllib.parse.urlencode(data)\n>>> print(urlvalues)  # The order may differ from below.\nname=Somebody+Here&language=Python&location=Northampton\n>>> url = 'http://www.example.com/example.cgi'\n>>> fullurl = url + '?' + urlvalues\n>>> data = urllib.request.urlopen(fullurl)\n\nNotice that the full URL is created by adding a '?' to the URL, followed\nby the encoded values.\n\n---------- Footnotes ----------\n\n(1) https://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Headers,  Prev: Data,  Up: Fetching URLs": {
            "content": "9.13.2.2 Headers\n................\n",
            "subsections": []
        },
        "We'll discuss here one particular HTTP header, to illustrate how to add": {
            "content": "headers to your HTTP request.\n",
            "subsections": []
        },
        "Some websites (1) dislike being browsed by programs, or send different": {
            "content": "versions to different browsers (2).  By default urllib identifies itself\nas 'Python-urllib/x.y' (where 'x' and 'y' are the major and minor\nversion numbers of the Python release, e.g.  'Python-urllib/2.5'), which\nmay confuse the site, or just plain not work.  The way a browser\nidentifies itself is through the 'User-Agent' header (3).  When you\ncreate a Request object you can pass a dictionary of headers in.  The\nfollowing example makes the same request as above, but identifies itself\nas a version of Internet Explorer (4).\n\nimport urllib.parse\nimport urllib.request\n\nurl = 'http://www.someserver.com/cgi-bin/register.cgi'\nuseragent = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64)'\nvalues = {'name': 'Michael Foord',\n'location': 'Northampton',\n'language': 'Python' }\nheaders = {'User-Agent': useragent}\n\ndata = urllib.parse.urlencode(values)\ndata = data.encode('ascii')\nreq = urllib.request.Request(url, data, headers)\nwith urllib.request.urlopen(req) as response:\nthepage = response.read()\n\nThe response also has two useful methods.  See the section on *note info\nand geturl: 4d9a. which comes after we have a look at what happens when\nthings go wrong.\n\n---------- Footnotes ----------\n\n(1) Google for example.\n\n(2) Browser sniffing is a very bad practice for website design -\nbuilding sites using web standards is much more sensible.  Unfortunately\na lot of sites still send different versions to different browsers.\n\n(3) The user agent for MSIE 6 is ''Mozilla/4.0 (compatible; MSIE 6.0;",
            "subsections": []
        },
        "Windows NT 5.1; SV1; .NET CLR 1.1.4322)''": {
            "content": "(4) For details of more HTTP request headers, see Quick Reference to\nHTTP Headers (https://jkorpela.fi/http.html).\n\nFile: python3.12.info,  Node: Handling Exceptions<2>,  Next: info and geturl,  Prev: Fetching URLs,  Up: HOWTO Fetch Internet Resources Using The urllib Package\n\n\n'urlopen' raises *note URLError: 35d6. when it cannot handle a response\n(though as usual with Python APIs, built-in exceptions such as *note\nValueError: 183, *note TypeError: 28e. etc.  may also be raised).\n\n*note HTTPError: e51. is the subclass of *note URLError: 35d6. raised in\nthe specific case of HTTP URLs.\n\nThe exception classes are exported from the *note urllib.error: 104.\nmodule.\n\n* Menu:\n\n* URLError::\n* HTTPError::\n* Wrapping it Up::\n\nFile: python3.12.info,  Node: URLError,  Next: HTTPError,  Up: Handling Exceptions<2>\n\n9.13.3.1 URLError\n.................\n",
            "subsections": []
        },
        "Often, URLError is raised because there is no network connection (no": {
            "content": "route to the specified server), or the specified server doesn't exist.",
            "subsections": []
        },
        "In this case, the exception raised will have a 'reason' attribute, which": {
            "content": "is a tuple containing an error code and a text error message.\n\ne.g.\n\n>>> req = urllib.request.Request('http://www.pretendserver.org')\n>>> try: urllib.request.urlopen(req)\n... except urllib.error.URLError as e:\n...     print(e.reason)\n...\n(4, 'getaddrinfo failed')\n\nFile: python3.12.info,  Node: HTTPError,  Next: Wrapping it Up,  Prev: URLError,  Up: Handling Exceptions<2>\n\n9.13.3.2 HTTPError\n..................\n\nEvery HTTP response from the server contains a numeric \"status code\".",
            "subsections": []
        },
        "Sometimes the status code indicates that the server is unable to fulfil": {
            "content": "the request.  The default handlers will handle some of these responses\nfor you (for example, if the response is a \"redirection\" that requests\nthe client fetch the document from a different URL, urllib will handle\nthat for you).  For those it can't handle, urlopen will raise an *note\nHTTPError: e51.  Typical errors include '404' (page not found), '403'\n(request forbidden), and '401' (authentication required).\n",
            "subsections": []
        },
        "See section 10 of RFC 2616(1) for a reference on all the HTTP error": {
            "content": "codes.\n\nThe *note HTTPError: e51. instance raised will have an integer 'code'\nattribute, which corresponds to the error sent by the server.\n\n* Menu:\n\n* Error Codes::\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc2616.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Error Codes,  Up: HTTPError": {
            "content": "9.13.3.3 Error Codes\n....................\n",
            "subsections": []
        },
        "Because the default handlers handle redirects (codes in the 300 range),": {
            "content": "and codes in the 100-299 range indicate success, you will usually only\nsee error codes in the 400-599 range.\n\n*note http.server.BaseHTTPRequestHandler.responses: 3678. is a useful\ndictionary of response codes in that shows all the response codes used\nby RFC 2616(1).  The dictionary is reproduced here for convenience\n\n# Table mapping response codes to messages; entries have the\n# form {code: (shortmessage, longmessage)}.\nresponses = {\n100: ('Continue', 'Request received, please continue'),\n101: ('Switching Protocols',\n'Switching to new protocol; obey Upgrade header'),\n\n200: ('OK', 'Request fulfilled, document follows'),\n201: ('Created', 'Document created, URL follows'),\n202: ('Accepted',\n'Request accepted, processing continues off-line'),\n203: ('Non-Authoritative Information', 'Request fulfilled from cache'),\n204: ('No Content', 'Request fulfilled, nothing follows'),\n205: ('Reset Content', 'Clear input form for further input.'),\n206: ('Partial Content', 'Partial content follows.'),\n\n300: ('Multiple Choices',\n'Object has several resources -- see URI list'),\n301: ('Moved Permanently', 'Object moved permanently -- see URI list'),\n302: ('Found', 'Object moved temporarily -- see URI list'),\n303: ('See Other', 'Object moved -- see Method and URL list'),\n304: ('Not Modified',\n'Document has not changed since given time'),\n305: ('Use Proxy',\n'You must use proxy specified in Location to access this '\n'resource.'),\n307: ('Temporary Redirect',\n'Object moved temporarily -- see URI list'),\n\n400: ('Bad Request',\n'Bad request syntax or unsupported method'),\n401: ('Unauthorized',\n'No permission -- see authorization schemes'),\n402: ('Payment Required',\n'No payment -- see charging schemes'),\n403: ('Forbidden',\n'Request forbidden -- authorization will not help'),\n404: ('Not Found', 'Nothing matches the given URI'),\n405: ('Method Not Allowed',\n'Specified method is invalid for this server.'),\n406: ('Not Acceptable', 'URI not available in preferred format.'),\n407: ('Proxy Authentication Required', 'You must authenticate with '\n'this proxy before proceeding.'),\n408: ('Request Timeout', 'Request timed out; try again later.'),\n409: ('Conflict', 'Request conflict.'),\n410: ('Gone',\n'URI no longer exists and has been permanently removed.'),\n411: ('Length Required', 'Client must specify Content-Length.'),\n412: ('Precondition Failed', 'Precondition in headers is false.'),\n413: ('Request Entity Too Large', 'Entity is too large.'),\n414: ('Request-URI Too Long', 'URI is too long.'),\n415: ('Unsupported Media Type', 'Entity body in unsupported format.'),\n416: ('Requested Range Not Satisfiable',\n'Cannot satisfy request range.'),\n417: ('Expectation Failed',\n'Expect condition could not be satisfied.'),\n\n500: ('Internal Server Error', 'Server got itself in trouble'),\n501: ('Not Implemented',\n'Server does not support this operation'),\n502: ('Bad Gateway', 'Invalid responses from another server/proxy.'),\n503: ('Service Unavailable',\n'The server cannot process the request due to a high load'),\n504: ('Gateway Timeout',\n'The gateway server did not receive a timely response'),\n505: ('HTTP Version Not Supported', 'Cannot fulfill request.'),\n}\n",
            "subsections": []
        },
        "When an error is raised the server responds by returning an HTTP error": {
            "content": "code 'and' an error page.  You can use the *note HTTPError: e51.\ninstance as a response on the page returned.  This means that as well as\nthe code attribute, it also has read, geturl, and info, methods as\nreturned by the 'urllib.response' module:\n\n>>> req = urllib.request.Request('http://www.python.org/fish.html')\n>>> try:\n...     urllib.request.urlopen(req)\n... except urllib.error.HTTPError as e:\n...     print(e.code)\n...     print(e.read())\n...\n404\nb'<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\\n\\n\\n<html\n...\n<title>Page Not Found</title>\\n\n...\n\n---------- Footnotes ----------\n\n(1) https://datatracker.ietf.org/doc/html/rfc2616.html\n\nFile: python3.12.info,  Node: Wrapping it Up,  Prev: HTTPError,  Up: Handling Exceptions<2>\n\n9.13.3.4 Wrapping it Up\n.......................\n\nSo if you want to be prepared for *note HTTPError: e51. 'or' *note\nURLError: 35d6. there are two basic approaches.  I prefer the second\napproach.\n\n* Menu:\n\n* Number 1::\n* Number 2::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Number 1,  Next: Number 2,  Up: Wrapping it Up": {
            "content": "9.13.3.5 Number 1\n.................\n\nfrom urllib.request import Request, urlopen\nfrom urllib.error import URLError, HTTPError\nreq = Request(someurl)\ntry:\nresponse = urlopen(req)\nexcept HTTPError as e:\nprint('The server couldn\\'t fulfill the request.')\nprint('Error code: ', e.code)\nexcept URLError as e:\nprint('We failed to reach a server.')\nprint('Reason: ', e.reason)\nelse:\n# everything is fine\n\nNote: The 'except HTTPError' 'must' come first, otherwise 'except\nURLError' will 'also' catch an *note HTTPError: e51.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Number 2,  Prev: Number 1,  Up: Wrapping it Up": {
            "content": "9.13.3.6 Number 2\n.................\n\nfrom urllib.request import Request, urlopen\nfrom urllib.error import URLError\nreq = Request(someurl)\ntry:\nresponse = urlopen(req)\nexcept URLError as e:\nif hasattr(e, 'reason'):\nprint('We failed to reach a server.')\nprint('Reason: ', e.reason)\nelif hasattr(e, 'code'):\nprint('The server couldn\\'t fulfill the request.')\nprint('Error code: ', e.code)\nelse:\n# everything is fine\n\nFile: python3.12.info,  Node: info and geturl,  Next: Openers and Handlers,  Prev: Handling Exceptions<2>,  Up: HOWTO Fetch Internet Resources Using The urllib Package\n\n\nThe response returned by urlopen (or the *note HTTPError: e51. instance)\nhas two useful methods 'info()' and 'geturl()' and is defined in the\nmodule *note urllib.response: 107.\n\n* 'geturl' - this returns the real URL of the page fetched.  This is\nuseful because 'urlopen' (or the opener object used) may have\nfollowed a redirect.  The URL of the page fetched may not be the\nsame as the URL requested.\n\n* 'info' - this returns a dictionary-like object that describes the\npage fetched, particularly the headers sent by the server.  It is\ncurrently an *note http.client.HTTPMessage: 368f. instance.\n\nTypical headers include 'Content-length', 'Content-type', and so on.",
            "subsections": []
        },
        "See the Quick Reference to HTTP Headers(1) for a useful listing of HTTP": {
            "content": "headers with brief explanations of their meaning and use.\n\n---------- Footnotes ----------\n\n(1) https://jkorpela.fi/http.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Openers and Handlers,  Next: Basic Authentication,  Prev: info and geturl,  Up: HOWTO Fetch Internet Resources Using The urllib Package": {
            "content": "",
            "subsections": []
        },
        "When you fetch a URL you use an opener (an instance of the perhaps": {
            "content": "confusingly named *note urllib.request.OpenerDirector: 35d7.).  Normally\nwe have been using the default opener - via 'urlopen' - but you can\ncreate custom openers.  Openers use handlers.  All the \"heavy lifting\"\nis done by the handlers.  Each handler knows how to open URLs for a\nparticular URL scheme (http, ftp, etc.), or how to handle an aspect of\nURL opening, for example HTTP redirections or HTTP cookies.\n",
            "subsections": []
        },
        "You will want to create openers if you want to fetch URLs with specific": {
            "content": "handlers installed, for example to get an opener that handles cookies,\nor to get an opener that does not handle redirections.\n",
            "subsections": []
        },
        "To create an opener, instantiate an 'OpenerDirector', and then call": {
            "content": "'.addhandler(somehandlerinstance)' repeatedly.\n",
            "subsections": []
        },
        "Alternatively, you can use 'buildopener', which is a convenience": {
            "content": "function for creating opener objects with a single function call.\n'buildopener' adds several handlers by default, but provides a quick\nway to add more and/or override the default handlers.\n",
            "subsections": []
        },
        "Other sorts of handlers you might want to can handle proxies,": {
            "content": "authentication, and other common but slightly specialised situations.\n\n'installopener' can be used to make an 'opener' object the (global)\ndefault opener.  This means that calls to 'urlopen' will use the opener\nyou have installed.\n",
            "subsections": []
        },
        "Opener objects have an 'open' method, which can be called directly to": {
            "content": "fetch urls in the same way as the 'urlopen' function: there's no need to\ncall 'installopener', except as a convenience.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Basic Authentication,  Next: Proxies,  Prev: Openers and Handlers,  Up: HOWTO Fetch Internet Resources Using The urllib Package": {
            "content": "",
            "subsections": []
        },
        "To illustrate creating and installing a handler we will use the": {
            "content": "'HTTPBasicAuthHandler'.  For a more detailed discussion of this subject\n- including an explanation of how Basic Authentication works - see the\nBasic Authentication Tutorial(1).\n",
            "subsections": []
        },
        "When authentication is required, the server sends a header (as well as": {
            "content": "the 401 error code) requesting authentication.  This specifies the\nauthentication scheme and a 'realm'.  The header looks like:\n'WWW-Authenticate: SCHEME realm=\"REALM\"'.\n\ne.g.\n\nWWW-Authenticate: Basic realm=\"cPanel Users\"\n",
            "subsections": []
        },
        "The client should then retry the request with the appropriate name and": {
            "content": "password for the realm included as a header in the request.  This is\n'basic authentication'.  In order to simplify this process we can create\nan instance of 'HTTPBasicAuthHandler' and an opener to use this handler.\n",
            "subsections": []
        },
        "The 'HTTPBasicAuthHandler' uses an object called a password manager to": {
            "content": "handle the mapping of URLs and realms to passwords and usernames.  If\nyou know what the realm is (from the authentication header sent by the\nserver), then you can use a 'HTTPPasswordMgr'.  Frequently one doesn't\ncare what the realm is.  In that case, it is convenient to use\n'HTTPPasswordMgrWithDefaultRealm'.  This allows you to specify a default\nusername and password for a URL. This will be supplied in the absence of\nyou providing an alternative combination for a specific realm.  We\nindicate this by providing 'None' as the realm argument to the\n'addpassword' method.\n",
            "subsections": []
        },
        "The top-level URL is the first URL that requires authentication.  URLs": {
            "content": "\"deeper\" than the URL you pass to .addpassword() will also match.\n\n# create a password manager\npasswordmgr = urllib.request.HTTPPasswordMgrWithDefaultRealm()\n\n# Add the username and password.\n# If we knew the realm, we could use it instead of None.\ntoplevelurl = \"http://example.com/foo/\"\npasswordmgr.addpassword(None, toplevelurl, username, password)\n\nhandler = urllib.request.HTTPBasicAuthHandler(passwordmgr)\n\n# create \"opener\" (OpenerDirector instance)\nopener = urllib.request.buildopener(handler)\n\n# use the opener to fetch a URL\nopener.open(aurl)\n\n# Install the opener.\n# Now all calls to urllib.request.urlopen use our opener.\nurllib.request.installopener(opener)\n\nNote: In the above example we only supplied our\n'HTTPBasicAuthHandler' to 'buildopener'.  By default openers have\nthe handlers for normal situations - 'ProxyHandler' (if a proxy\nsetting such as an 'httpproxy' environment variable is set),\n'UnknownHandler', 'HTTPHandler', 'HTTPDefaultErrorHandler',\n'HTTPRedirectHandler', 'FTPHandler', 'FileHandler', 'DataHandler',\n'HTTPErrorProcessor'.\n\n'toplevelurl' is in fact 'either' a full URL (including the 'http:'\nscheme component and the hostname and optionally the port number) e.g.\n'\"http://example.com/\"' 'or' an \"authority\" (i.e.  the hostname,\noptionally including the port number) e.g.  '\"example.com\"' or\n'\"example.com:8080\"' (the latter example includes a port number).  The\nauthority, if present, must NOT contain the \"userinfo\" component - for\nexample '\"joe:password@example.com\"' is not correct.\n\n---------- Footnotes ----------\n\n(1)\nhttps://web.archive.org/web/20201215133350/http://www.voidspace.org.uk/python/articles/authentication.shtml\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Proxies,  Next: Sockets and Layers,  Prev: Basic Authentication,  Up: HOWTO Fetch Internet Resources Using The urllib Package": {
            "content": "'urllib' will auto-detect your proxy settings and use those.  This is\nthrough the 'ProxyHandler', which is part of the normal handler chain\nwhen a proxy setting is detected.  Normally that's a good thing, but\nthere are occasions when it may not be helpful (1).  One way to do this\nis to setup our own 'ProxyHandler', with no proxies defined.  This is\ndone using similar steps to setting up a Basic Authentication(2)\nhandler:\n\n>>> proxysupport = urllib.request.ProxyHandler({})\n>>> opener = urllib.request.buildopener(proxysupport)\n>>> urllib.request.installopener(opener)\n\nNote: Currently 'urllib.request' 'does not' support fetching of\n'https' locations through a proxy.  However, this can be enabled by\nextending urllib.request as shown in the recipe (3).\n\nNote: 'HTTPPROXY' will be ignored if a variable 'REQUESTMETHOD'\nis set; see the documentation on *note getproxies(): 35d2.\n\n---------- Footnotes ----------\n\n(1) In my case I have to use a proxy to access the internet at work.",
            "subsections": []
        },
        "If you attempt to fetch 'localhost' URLs through this proxy it blocks": {
            "content": "them.  IE is set to use the proxy, which urllib picks up on.  In order\nto test scripts with a localhost server, I have to prevent urllib from\nusing the proxy.\n\n(2)\nhttps://web.archive.org/web/20201215133350/http://www.voidspace.org.uk/python/articles/authentication.shtml\n\n(3) urllib opener for SSL proxy (CONNECT method): ASPN Cookbook\nRecipe (https://code.activestate.com/recipes/456195/).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Sockets and Layers,  Next: Footnotes,  Prev: Proxies,  Up: HOWTO Fetch Internet Resources Using The urllib Package": {
            "content": "The Python support for fetching resources from the web is layered.\nurllib uses the *note http.client: 6a. library, which in turn uses the\nsocket library.\n",
            "subsections": []
        },
        "As of Python 2.3 you can specify how long a socket should wait for a": {
            "content": "response before timing out.  This can be useful in applications which\nhave to fetch web pages.  By default the socket module has 'no timeout'\nand can hang.  Currently, the socket timeout is not exposed at the\nhttp.client or urllib.request levels.  However, you can set the default\ntimeout globally for all sockets using\n\nimport socket\nimport urllib.request\n\n# timeout in seconds\ntimeout = 10\nsocket.setdefaulttimeout(timeout)\n\n# this call to urllib.request.urlopen now uses the default timeout\n# we have set in the socket module\nreq = urllib.request.Request('http://www.voidspace.org.uk')\nresponse = urllib.request.urlopen(req)\n\n\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Footnotes,  Prev: Sockets and Layers,  Up: HOWTO Fetch Internet Resources Using The urllib Package": {
            "content": "This document was reviewed and revised by John Lee.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Argparse Tutorial,  Next: An introduction to the ipaddress module,  Prev: HOWTO Fetch Internet Resources Using The urllib Package,  Up: Python HOWTOs": {
            "content": "",
            "subsections": [
                {
                    "name": "9.14 Argparse Tutorial",
                    "content": "author: Tshepang Mbambo\n\nThis tutorial is intended to be a gentle introduction to *note argparse:\n6, the recommended command-line parsing module in the Python standard\nlibrary.\n\nNote: There are two other modules that fulfill the same task,\nnamely *note getopt: 5c. (an equivalent for 'getopt()' from the C\nlanguage) and the deprecated *note optparse: 9b.  Note also that\n*note argparse: 6. is based on *note optparse: 9b, and therefore\nvery similar in terms of usage.\n\n* Menu:\n\n* Concepts::\n* The basics::\n* Introducing Positional arguments::\n* Introducing Optional arguments::\n* Combining Positional and Optional arguments::\n* Getting a little more advanced::\n* How to translate the argparse output::\n* Conclusion::\n"
                }
            ]
        },
        "File: python3.12.info,  Node: Concepts,  Next: The basics,  Up: Argparse Tutorial": {
            "content": "",
            "subsections": []
        },
        "Let's show the sort of functionality that we are going to explore in": {
            "content": "this introductory tutorial by making use of the 'ls' command:\n\n$ ls\ncpython  devguide  prog.py  pypy  rm-unused-function.patch\n$ ls pypy\nctypesconfigure  demo  dotviewer  include  libpypy  lib-python ...\n$ ls -l\ntotal 20\ndrwxr-xr-x 19 wena wena 4096 Feb 18 18:51 cpython\ndrwxr-xr-x  4 wena wena 4096 Feb  8 12:04 devguide\n-rwxr-xr-x  1 wena wena  535 Feb 19 00:05 prog.py\ndrwxr-xr-x 14 wena wena 4096 Feb  7 00:59 pypy\n-rw-r--r--  1 wena wena  741 Feb 18 01:01 rm-unused-function.patch\n$ ls --help\nUsage: ls [OPTION]... [FILE]...\nList information about the FILEs (the current directory by default).\nSort entries alphabetically if none of -cftuvSUX nor --sort is specified.\n...\n\nA few concepts we can learn from the four commands:\n\n* The 'ls' command is useful when run without any options at all.  It\ndefaults to displaying the contents of the current directory.\n\n* If we want beyond what it provides by default, we tell it a bit\nmore.  In this case, we want it to display a different directory,\n'pypy'.  What we did is specify what is known as a positional\nargument.  It's named so because the program should know what to do\nwith the value, solely based on where it appears on the command\nline.  This concept is more relevant to a command like 'cp', whose\nmost basic usage is 'cp SRC DEST'.  The first position is 'what you\nwant copied,' and the second position is 'where you want it copied\nto'.\n\n* Now, say we want to change behaviour of the program.  In our\nexample, we display more info for each file instead of just showing\nthe file names.  The '-l' in that case is known as an optional\nargument.\n\n* That's a snippet of the help text.  It's very useful in that you\ncan come across a program you have never used before, and can\nfigure out how it works simply by reading its help text.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: The basics,  Next: Introducing Positional arguments,  Prev: Concepts,  Up: Argparse Tutorial": {
            "content": "Let us start with a very simple example which does (almost) nothing:\n\nimport argparse\nparser = argparse.ArgumentParser()\nparser.parseargs()\n\nFollowing is a result of running the code:\n\n$ python prog.py\n$ python prog.py --help\nusage: prog.py [-h]\n\noptions:\n-h, --help  show this help message and exit\n$ python prog.py --verbose\nusage: prog.py [-h]\nprog.py: error: unrecognized arguments: --verbose\n$ python prog.py foo\nusage: prog.py [-h]\nprog.py: error: unrecognized arguments: foo\n\nHere is what is happening:\n\n* Running the script without any options results in nothing displayed\nto stdout.  Not so useful.\n\n* The second one starts to display the usefulness of the *note\nargparse: 6. module.  We have done almost nothing, but already we\nget a nice help message.\n\n* The '--help' option, which can also be shortened to '-h', is the\nonly option we get for free (i.e.  no need to specify it).\nSpecifying anything else results in an error.  But even then, we do\nget a useful usage message, also for free.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Introducing Positional arguments,  Next: Introducing Optional arguments,  Prev: The basics,  Up: Argparse Tutorial": {
            "content": "An example:\n\nimport argparse\nparser = argparse.ArgumentParser()\nparser.addargument(\"echo\")\nargs = parser.parseargs()\nprint(args.echo)\n\nAnd running the code:\n\n$ python prog.py\nusage: prog.py [-h] echo\nprog.py: error: the following arguments are required: echo\n$ python prog.py --help\nusage: prog.py [-h] echo\n\npositional arguments:\necho\n\noptions:\n-h, --help  show this help message and exit\n$ python prog.py foo\nfoo\n\nHere is what's happening:\n\n* We've added the *note addargument(): 14a2. method, which is what\nwe use to specify which command-line options the program is willing\nto accept.  In this case, I've named it 'echo' so that it's in line\nwith its function.\n\n* Calling our program now requires us to specify an option.\n\n* The *note parseargs(): 2953. method actually returns some data\nfrom the options specified, in this case, 'echo'.\n\n* The variable is some form of 'magic' that *note argparse: 6.\nperforms for free (i.e.  no need to specify which variable that\nvalue is stored in).  You will also notice that its name matches\nthe string argument given to the method, 'echo'.\n",
            "subsections": []
        },
        "Note however that, although the help display looks nice and all, it": {
            "content": "currently is not as helpful as it can be.  For example we see that we\ngot 'echo' as a positional argument, but we don't know what it does,\nother than by guessing or by reading the source code.  So, let's make it\na bit more useful:\n\nimport argparse\nparser = argparse.ArgumentParser()\nparser.addargument(\"echo\", help=\"echo the string you use here\")\nargs = parser.parseargs()\nprint(args.echo)\n\nAnd we get:\n\n$ python prog.py -h\nusage: prog.py [-h] echo\n\npositional arguments:\necho        echo the string you use here\n\noptions:\n-h, --help  show this help message and exit\n\nNow, how about doing something even more useful:\n\nimport argparse\nparser = argparse.ArgumentParser()\nparser.addargument(\"square\", help=\"display a square of a given number\")\nargs = parser.parseargs()\nprint(args.square2)\n\nFollowing is a result of running the code:\n\n$ python prog.py 4\nTraceback (most recent call last):\nFile \"prog.py\", line 5, in <module>\nprint(args.square2)\nTypeError: unsupported operand type(s) for  or pow(): 'str' and 'int'\n\nThat didn't go so well.  That's because *note argparse: 6. treats the\noptions we give it as strings, unless we tell it otherwise.  So, let's\ntell *note argparse: 6. to treat that input as an integer:\n\nimport argparse\nparser = argparse.ArgumentParser()\nparser.addargument(\"square\", help=\"display a square of a given number\",\ntype=int)\nargs = parser.parseargs()\nprint(args.square2)\n\nFollowing is a result of running the code:\n\n$ python prog.py 4\n16\n$ python prog.py four\nusage: prog.py [-h] square\nprog.py: error: argument square: invalid int value: 'four'\n",
            "subsections": []
        },
        "That went well.  The program now even helpfully quits on bad illegal": {
            "content": "input before proceeding.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Introducing Optional arguments,  Next: Combining Positional and Optional arguments,  Prev: Introducing Positional arguments,  Up: Argparse Tutorial": {
            "content": "",
            "subsections": []
        },
        "So far we have been playing with positional arguments.  Let us have a": {
            "content": "look on how to add optional ones:\n\nimport argparse\nparser = argparse.ArgumentParser()\nparser.addargument(\"--verbosity\", help=\"increase output verbosity\")\nargs = parser.parseargs()\nif args.verbosity:\nprint(\"verbosity turned on\")\n\nAnd the output:\n\n$ python prog.py --verbosity 1\nverbosity turned on\n$ python prog.py\n$ python prog.py --help\nusage: prog.py [-h] [--verbosity VERBOSITY]\n\noptions:\n-h, --help            show this help message and exit\n--verbosity VERBOSITY\nincrease output verbosity\n$ python prog.py --verbosity\nusage: prog.py [-h] [--verbosity VERBOSITY]\nprog.py: error: argument --verbosity: expected one argument\n\nHere is what is happening:\n\n* The program is written so as to display something when\n'--verbosity' is specified and display nothing when not.\n\n* To show that the option is actually optional, there is no error\nwhen running the program without it.  Note that by default, if an\noptional argument isn't used, the relevant variable, in this case\n'args.verbosity', is given 'None' as a value, which is the reason\nit fails the truth test of the *note if: 24f. statement.\n\n* The help message is a bit different.\n\n* When using the '--verbosity' option, one must also specify some\nvalue, any value.\n",
            "subsections": []
        },
        "The above example accepts arbitrary integer values for '--verbosity',": {
            "content": "but for our simple program, only two values are actually useful, 'True'\nor 'False'.  Let's modify the code accordingly:\n\nimport argparse\nparser = argparse.ArgumentParser()\nparser.addargument(\"--verbose\", help=\"increase output verbosity\",\naction=\"storetrue\")\nargs = parser.parseargs()\nif args.verbose:\nprint(\"verbosity turned on\")\n\nAnd the output:\n\n$ python prog.py --verbose\nverbosity turned on\n$ python prog.py --verbose 1\nusage: prog.py [-h] [--verbose]\nprog.py: error: unrecognized arguments: 1\n$ python prog.py --help\nusage: prog.py [-h] [--verbose]\n\noptions:\n-h, --help  show this help message and exit\n--verbose   increase output verbosity\n\nHere is what is happening:\n\n* The option is now more of a flag than something that requires a\nvalue.  We even changed the name of the option to match that idea.\nNote that we now specify a new keyword, 'action', and give it the\nvalue '\"storetrue\"'.  This means that, if the option is specified,\nassign the value 'True' to 'args.verbose'.  Not specifying it\nimplies 'False'.\n\n* It complains when you specify a value, in true spirit of what flags\nactually are.\n\n* Notice the different help text.\n\n* Menu:\n\n* Short options::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Short options,  Up: Introducing Optional arguments": {
            "content": "9.14.4.1 Short options\n......................\n",
            "subsections": []
        },
        "If you are familiar with command line usage, you will notice that I": {
            "content": "haven't yet touched on the topic of short versions of the options.  It's\nquite simple:\n\nimport argparse\nparser = argparse.ArgumentParser()\nparser.addargument(\"-v\", \"--verbose\", help=\"increase output verbosity\",\naction=\"storetrue\")\nargs = parser.parseargs()\nif args.verbose:\nprint(\"verbosity turned on\")\n\nAnd here goes:\n\n$ python prog.py -v\nverbosity turned on\n$ python prog.py --help\nusage: prog.py [-h] [-v]\n\noptions:\n-h, --help     show this help message and exit\n-v, --verbose  increase output verbosity\n\nNote that the new ability is also reflected in the help text.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Combining Positional and Optional arguments,  Next: Getting a little more advanced,  Prev: Introducing Optional arguments,  Up: Argparse Tutorial": {
            "content": "Our program keeps growing in complexity:\n\nimport argparse\nparser = argparse.ArgumentParser()\nparser.addargument(\"square\", type=int,\nhelp=\"display a square of a given number\")\nparser.addargument(\"-v\", \"--verbose\", action=\"storetrue\",\nhelp=\"increase output verbosity\")\nargs = parser.parseargs()\nanswer = args.square2\nif args.verbose:\nprint(f\"the square of {args.square} equals {answer}\")\nelse:\nprint(answer)\n\nAnd now the output:\n\n$ python prog.py\nusage: prog.py [-h] [-v] square\nprog.py: error: the following arguments are required: square\n$ python prog.py 4\n16\n$ python prog.py 4 --verbose\nthe square of 4 equals 16\n$ python prog.py --verbose 4\nthe square of 4 equals 16\n\n* We've brought back a positional argument, hence the complaint.\n\n* Note that the order does not matter.\n",
            "subsections": []
        },
        "How about we give this program of ours back the ability to have multiple": {
            "content": "verbosity values, and actually get to use them:\n\nimport argparse\nparser = argparse.ArgumentParser()\nparser.addargument(\"square\", type=int,\nhelp=\"display a square of a given number\")\nparser.addargument(\"-v\", \"--verbosity\", type=int,\nhelp=\"increase output verbosity\")\nargs = parser.parseargs()\nanswer = args.square2\nif args.verbosity == 2:\nprint(f\"the square of {args.square} equals {answer}\")\nelif args.verbosity == 1:\nprint(f\"{args.square}^2 == {answer}\")\nelse:\nprint(answer)\n\nAnd the output:\n\n$ python prog.py 4\n16\n$ python prog.py 4 -v\nusage: prog.py [-h] [-v VERBOSITY] square\nprog.py: error: argument -v/--verbosity: expected one argument\n$ python prog.py 4 -v 1\n4^2 == 16\n$ python prog.py 4 -v 2\nthe square of 4 equals 16\n$ python prog.py 4 -v 3\n16\n",
            "subsections": []
        },
        "These all look good except the last one, which exposes a bug in our": {
            "content": "program.  Let's fix it by restricting the values the '--verbosity'\noption can accept:\n\nimport argparse\nparser = argparse.ArgumentParser()\nparser.addargument(\"square\", type=int,\nhelp=\"display a square of a given number\")\nparser.addargument(\"-v\", \"--verbosity\", type=int, choices=[0, 1, 2],\nhelp=\"increase output verbosity\")\nargs = parser.parseargs()\nanswer = args.square2\nif args.verbosity == 2:\nprint(f\"the square of {args.square} equals {answer}\")\nelif args.verbosity == 1:\nprint(f\"{args.square}^2 == {answer}\")\nelse:\nprint(answer)\n\nAnd the output:\n\n$ python prog.py 4 -v 3\nusage: prog.py [-h] [-v {0,1,2}] square\nprog.py: error: argument -v/--verbosity: invalid choice: 3 (choose from 0, 1, 2)\n$ python prog.py 4 -h\nusage: prog.py [-h] [-v {0,1,2}] square\n\npositional arguments:\nsquare                display a square of a given number\n\noptions:\n-h, --help            show this help message and exit\n-v {0,1,2}, --verbosity {0,1,2}\nincrease output verbosity\n",
            "subsections": []
        },
        "Note that the change also reflects both in the error message as well as": {
            "content": "the help string.\n",
            "subsections": []
        },
        "Now, let's use a different approach of playing with verbosity, which is": {
            "content": "pretty common.  It also matches the way the CPython executable handles\nits own verbosity argument (check the output of 'python --help'):\n\nimport argparse\nparser = argparse.ArgumentParser()\nparser.addargument(\"square\", type=int,\nhelp=\"display the square of a given number\")\nparser.addargument(\"-v\", \"--verbosity\", action=\"count\",\nhelp=\"increase output verbosity\")\nargs = parser.parseargs()\nanswer = args.square2\nif args.verbosity == 2:\nprint(f\"the square of {args.square} equals {answer}\")\nelif args.verbosity == 1:\nprint(f\"{args.square}^2 == {answer}\")\nelse:\nprint(answer)\n\nWe have introduced another action, \"count\", to count the number of\noccurrences of specific options.\n\n$ python prog.py 4\n16\n$ python prog.py 4 -v\n4^2 == 16\n$ python prog.py 4 -vv\nthe square of 4 equals 16\n$ python prog.py 4 --verbosity --verbosity\nthe square of 4 equals 16\n$ python prog.py 4 -v 1\nusage: prog.py [-h] [-v] square\nprog.py: error: unrecognized arguments: 1\n$ python prog.py 4 -h\nusage: prog.py [-h] [-v] square\n\npositional arguments:\nsquare           display a square of a given number\n\noptions:\n-h, --help       show this help message and exit\n-v, --verbosity  increase output verbosity\n$ python prog.py 4 -vvv\n16\n\n* Yes, it's now more of a flag (similar to 'action=\"storetrue\"') in\nthe previous version of our script.  That should explain the\ncomplaint.\n\n* It also behaves similar to \"storetrue\" action.\n\n* Now here's a demonstration of what the \"count\" action gives.\nYou've probably seen this sort of usage before.\n\n* And if you don't specify the '-v' flag, that flag is considered to\nhave 'None' value.\n\n* As should be expected, specifying the long form of the flag, we\nshould get the same output.\n\n* Sadly, our help output isn't very informative on the new ability\nour script has acquired, but that can always be fixed by improving\nthe documentation for our script (e.g.  via the 'help' keyword\nargument).\n\n* That last output exposes a bug in our program.\n\nLet's fix:\n\nimport argparse\nparser = argparse.ArgumentParser()\nparser.addargument(\"square\", type=int,\nhelp=\"display a square of a given number\")\nparser.addargument(\"-v\", \"--verbosity\", action=\"count\",\nhelp=\"increase output verbosity\")\nargs = parser.parseargs()\nanswer = args.square2\n\n# bugfix: replace == with >=\nif args.verbosity >= 2:\nprint(f\"the square of {args.square} equals {answer}\")\nelif args.verbosity >= 1:\nprint(f\"{args.square}^2 == {answer}\")\nelse:\nprint(answer)\n\nAnd this is what it gives:\n\n$ python prog.py 4 -vvv\nthe square of 4 equals 16\n$ python prog.py 4 -vvvv\nthe square of 4 equals 16\n$ python prog.py 4\nTraceback (most recent call last):\nFile \"prog.py\", line 11, in <module>\nif args.verbosity >= 2:\nTypeError: '>=' not supported between instances of 'NoneType' and 'int'\n\n* First output went well, and fixes the bug we had before.  That is,\nwe want any value >= 2 to be as verbose as possible.\n\n* Third output not so good.\n\nLet's fix that bug:\n\nimport argparse\nparser = argparse.ArgumentParser()\nparser.addargument(\"square\", type=int,\nhelp=\"display a square of a given number\")\nparser.addargument(\"-v\", \"--verbosity\", action=\"count\", default=0,\nhelp=\"increase output verbosity\")\nargs = parser.parseargs()\nanswer = args.square2\nif args.verbosity >= 2:\nprint(f\"the square of {args.square} equals {answer}\")\nelif args.verbosity >= 1:\nprint(f\"{args.square}^2 == {answer}\")\nelse:\nprint(answer)\n",
            "subsections": []
        },
        "We've just introduced yet another keyword, 'default'.  We've set it to": {
            "content": "'0' in order to make it comparable to the other int values.  Remember\nthat by default, if an optional argument isn't specified, it gets the\n'None' value, and that cannot be compared to an int value (hence the\n*note TypeError: 28e. exception).\n\nAnd:\n\n$ python prog.py 4\n16\n",
            "subsections": []
        },
        "You can go quite far just with what we've learned so far, and we have": {
            "content": "only scratched the surface.  The *note argparse: 6. module is very\npowerful, and we'll explore a bit more of it before we end this\ntutorial.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Getting a little more advanced,  Next: How to translate the argparse output,  Prev: Combining Positional and Optional arguments,  Up: Argparse Tutorial": {
            "content": "",
            "subsections": []
        },
        "What if we wanted to expand our tiny program to perform other powers,": {
            "content": "not just squares:\n\nimport argparse\nparser = argparse.ArgumentParser()\nparser.addargument(\"x\", type=int, help=\"the base\")\nparser.addargument(\"y\", type=int, help=\"the exponent\")\nparser.addargument(\"-v\", \"--verbosity\", action=\"count\", default=0)\nargs = parser.parseargs()\nanswer = args.xargs.y\nif args.verbosity >= 2:\nprint(f\"{args.x} to the power {args.y} equals {answer}\")\nelif args.verbosity >= 1:\nprint(f\"{args.x}^{args.y} == {answer}\")\nelse:\nprint(answer)\n\nOutput:\n\n$ python prog.py\nusage: prog.py [-h] [-v] x y\nprog.py: error: the following arguments are required: x, y\n$ python prog.py -h\nusage: prog.py [-h] [-v] x y\n\npositional arguments:\nx                the base\ny                the exponent\n\noptions:\n-h, --help       show this help message and exit",
            "subsections": [
                {
                    "name": "-v, --verbosity",
                    "content": "$ python prog.py 4 2 -v\n4^2 == 16\n",
                    "flag": "-v",
                    "long": "--verbosity"
                }
            ]
        },
        "Notice that so far we've been using verbosity level to 'change' the text": {
            "content": "that gets displayed.  The following example instead uses verbosity level\nto display 'more' text instead:\n\nimport argparse\nparser = argparse.ArgumentParser()\nparser.addargument(\"x\", type=int, help=\"the base\")\nparser.addargument(\"y\", type=int, help=\"the exponent\")\nparser.addargument(\"-v\", \"--verbosity\", action=\"count\", default=0)\nargs = parser.parseargs()\nanswer = args.xargs.y\nif args.verbosity >= 2:\nprint(f\"Running '{file}'\")\nif args.verbosity >= 1:\nprint(f\"{args.x}^{args.y} == \", end=\"\")\nprint(answer)\n\nOutput:\n\n$ python prog.py 4 2\n16\n$ python prog.py 4 2 -v\n4^2 == 16\n$ python prog.py 4 2 -vv\nRunning 'prog.py'\n4^2 == 16\n\n* Menu:\n\n* Specifying ambiguous arguments::\n* Conflicting options::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Specifying ambiguous arguments,  Next: Conflicting options,  Up: Getting a little more advanced": {
            "content": "9.14.6.1 Specifying ambiguous arguments\n.......................................\n",
            "subsections": []
        },
        "When there is ambiguity in deciding whether an argument is positional or": {
            "content": "for an argument, '--' can be used to tell *note parseargs(): 2953. that\neverything after that is a positional argument:\n\n>>> parser = argparse.ArgumentParser(prog='PROG')\n>>> parser.addargument('-n', nargs='+')\n>>> parser.addargument('args', nargs='*')\n\n>>> # ambiguous, so parseargs assumes it's an option\n>>> parser.parseargs(['-f'])\nusage: PROG [-h] [-n N [N ...]] [args ...]\nPROG: error: unrecognized arguments: -f\n\n>>> parser.parseargs(['--', '-f'])\nNamespace(args=['-f'], n=None)\n\n>>> # ambiguous, so the -n option greedily accepts arguments\n>>> parser.parseargs(['-n', '1', '2', '3'])\nNamespace(args=[], n=['1', '2', '3'])\n\n>>> parser.parseargs(['-n', '1', '--', '2', '3'])\nNamespace(args=['2', '3'], n=['1'])\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Conflicting options,  Prev: Specifying ambiguous arguments,  Up: Getting a little more advanced": {
            "content": "9.14.6.2 Conflicting options\n............................\n\nSo far, we have been working with two methods of an *note\nargparse.ArgumentParser: 28f. instance.  Let's introduce a third one,\n*note addmutuallyexclusivegroup(): 2999.  It allows for us to specify\noptions that conflict with each other.  Let's also change the rest of\nthe program so that the new functionality makes more sense: we'll\nintroduce the '--quiet' option, which will be the opposite of the\n'--verbose' one:\n\nimport argparse\n\nparser = argparse.ArgumentParser()\ngroup = parser.addmutuallyexclusivegroup()\ngroup.addargument(\"-v\", \"--verbose\", action=\"storetrue\")\ngroup.addargument(\"-q\", \"--quiet\", action=\"storetrue\")\nparser.addargument(\"x\", type=int, help=\"the base\")\nparser.addargument(\"y\", type=int, help=\"the exponent\")\nargs = parser.parseargs()\nanswer = args.xargs.y\n\nif args.quiet:\nprint(answer)\nelif args.verbose:\nprint(f\"{args.x} to the power {args.y} equals {answer}\")\nelse:\nprint(f\"{args.x}^{args.y} == {answer}\")\n",
            "subsections": []
        },
        "Our program is now simpler, and we've lost some functionality for the": {
            "content": "sake of demonstration.  Anyways, here's the output:\n\n$ python prog.py 4 2\n4^2 == 16\n$ python prog.py 4 2 -q\n16\n$ python prog.py 4 2 -v\n4 to the power 2 equals 16\n$ python prog.py 4 2 -vq\nusage: prog.py [-h] [-v | -q] x y\nprog.py: error: argument -q/--quiet: not allowed with argument -v/--verbose\n$ python prog.py 4 2 -v --quiet\nusage: prog.py [-h] [-v | -q] x y\nprog.py: error: argument -q/--quiet: not allowed with argument -v/--verbose\n",
            "subsections": []
        },
        "That should be easy to follow.  I've added that last output so you can": {
            "content": "see the sort of flexibility you get, i.e.  mixing long form options with\nshort form ones.\n",
            "subsections": []
        },
        "Before we conclude, you probably want to tell your users the main": {
            "content": "purpose of your program, just in case they don't know:\n\nimport argparse\n\nparser = argparse.ArgumentParser(description=\"calculate X to the power of Y\")\ngroup = parser.addmutuallyexclusivegroup()\ngroup.addargument(\"-v\", \"--verbose\", action=\"storetrue\")\ngroup.addargument(\"-q\", \"--quiet\", action=\"storetrue\")\nparser.addargument(\"x\", type=int, help=\"the base\")\nparser.addargument(\"y\", type=int, help=\"the exponent\")\nargs = parser.parseargs()\nanswer = args.xargs.y\n\nif args.quiet:\nprint(answer)\nelif args.verbose:\nprint(f\"{args.x} to the power {args.y} equals {answer}\")\nelse:\nprint(f\"{args.x}^{args.y} == {answer}\")\n\nNote that slight difference in the usage text.  Note the '[-v | -q]',\nwhich tells us that we can either use '-v' or '-q', but not both at the\nsame time:\n\n$ python prog.py --help\nusage: prog.py [-h] [-v | -q] x y\n\ncalculate X to the power of Y\n\npositional arguments:\nx              the base\ny              the exponent\n\noptions:\n-h, --help     show this help message and exit",
            "subsections": [
                {
                    "name": "-v, --verbose",
                    "content": "",
                    "flag": "-v",
                    "long": "--verbose"
                },
                {
                    "name": "-q, --quiet",
                    "content": "",
                    "flag": "-q",
                    "long": "--quiet"
                }
            ]
        },
        "File: python3.12.info,  Node: How to translate the argparse output,  Next: Conclusion,  Prev: Getting a little more advanced,  Up: Argparse Tutorial": {
            "content": "The output of the *note argparse: 6. module such as its help text and\nerror messages are all made translatable using the *note gettext: 5e.\nmodule.  This allows applications to easily localize messages produced\nby *note argparse: 6.  See also *note Internationalizing your programs\nand modules: 393b.\n\nFor instance, in this *note argparse: 6. output:\n\n$ python prog.py --help\nusage: prog.py [-h] [-v | -q] x y\n\ncalculate X to the power of Y\n\npositional arguments:\nx              the base\ny              the exponent\n\noptions:\n-h, --help     show this help message and exit",
            "subsections": [
                {
                    "name": "-v, --verbose",
                    "content": "",
                    "flag": "-v",
                    "long": "--verbose"
                },
                {
                    "name": "-q, --quiet",
                    "content": "",
                    "flag": "-q",
                    "long": "--quiet"
                }
            ]
        },
        "The strings 'usage:', 'positional arguments:', 'options:' and 'show this": {
            "content": "help message and exit' are all translatable.\n",
            "subsections": []
        },
        "In order to translate these strings, they must first be extracted into a": {
            "content": "'.po' file.  For example, using Babel(1), run this command:\n\n$ pybabel extract -o messages.po /usr/lib/python3.12/argparse.py\n\nThis command will extract all translatable strings from the *note\nargparse: 6. module and output them into a file named 'messages.po'.\nThis command assumes that your Python installation is in '/usr/lib'.\n\nYou can find out the location of the *note argparse: 6. module on your\nsystem using this script:\n\nimport argparse\nprint(argparse.file)\n",
            "subsections": []
        },
        "Once the messages in the '.po' file are translated and the translations": {
            "content": "are installed using *note gettext: 5e, *note argparse: 6. will be able\nto display the translated messages.\n\nTo translate your own strings in the *note argparse: 6. output, use\n*note gettext: 5e.\n\n---------- Footnotes ----------\n\n(1) https://babel.pocoo.org/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Conclusion,  Prev: How to translate the argparse output,  Up: Argparse Tutorial": {
            "content": "The *note argparse: 6. module offers a lot more than shown here.  Its\ndocs are quite detailed and thorough, and full of examples.  Having gone\nthrough this tutorial, you should easily digest them without feeling\noverwhelmed.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: An introduction to the ipaddress module,  Next: Instrumenting CPython with DTrace and SystemTap,  Prev: Argparse Tutorial,  Up: Python HOWTOs": {
            "content": "",
            "subsections": [
                {
                    "name": "9.15 An introduction to the ipaddress module",
                    "content": "author: Peter Moody\n\n\nauthor: Nick Coghlan\n"
                }
            ]
        },
        "File: python3.12.info,  Node: Creating Address/Network/Interface objects,  Next: Inspecting Address/Network/Interface Objects,  Up: An introduction to the ipaddress module": {
            "content": "Since *note ipaddress: 7a. is a module for inspecting and manipulating\nIP addresses, the first thing you'll want to do is create some objects.\nYou can use *note ipaddress: 7a. to create objects from strings and\nintegers.\n\n* Menu:\n\n* A Note on IP Versions::\n* IP Host Addresses::\n* Defining Networks::\n* Host Interfaces::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: A Note on IP Versions,  Next: IP Host Addresses,  Up: Creating Address/Network/Interface objects": {
            "content": "9.15.1.1 A Note on IP Versions\n..............................\n",
            "subsections": []
        },
        "For readers that aren't particularly familiar with IP addressing, it's": {
            "content": "important to know that the Internet Protocol (IP) is currently in the\nprocess of moving from version 4 of the protocol to version 6.  This\ntransition is occurring largely because version 4 of the protocol\ndoesn't provide enough addresses to handle the needs of the whole world,\nespecially given the increasing number of devices with direct\nconnections to the internet.\n",
            "subsections": []
        },
        "Explaining the details of the differences between the two versions of": {
            "content": "the protocol is beyond the scope of this introduction, but readers need\nto at least be aware that these two versions exist, and it will\nsometimes be necessary to force the use of one version or the other.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: IP Host Addresses,  Next: Defining Networks,  Prev: A Note on IP Versions,  Up: Creating Address/Network/Interface objects": {
            "content": "9.15.1.2 IP Host Addresses\n..........................\n\nAddresses, often referred to as \"host addresses\" are the most basic unit\nwhen working with IP addressing.  The simplest way to create addresses\nis to use the *note ipaddress.ipaddress(): 3878. factory function,\nwhich automatically determines whether to create an IPv4 or IPv6 address\nbased on the passed in value:\n\n>>> ipaddress.ipaddress('192.0.2.1')\nIPv4Address('192.0.2.1')\n>>> ipaddress.ipaddress('2001:DB8::1')\nIPv6Address('2001:db8::1')\n",
            "subsections": []
        },
        "Addresses can also be created directly from integers.  Values that will": {
            "content": "fit within 32 bits are assumed to be IPv4 addresses:\n\n>>> ipaddress.ipaddress(3221225985)\nIPv4Address('192.0.2.1')\n>>> ipaddress.ipaddress(42540766411282592856903984951653826561)\nIPv6Address('2001:db8::1')\n",
            "subsections": []
        },
        "To force the use of IPv4 or IPv6 addresses, the relevant classes can be": {
            "content": "invoked directly.  This is particularly useful to force creation of IPv6\naddresses for small integers:\n\n>>> ipaddress.ipaddress(1)\nIPv4Address('0.0.0.1')\n>>> ipaddress.IPv4Address(1)\nIPv4Address('0.0.0.1')\n>>> ipaddress.IPv6Address(1)\nIPv6Address('::1')\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Defining Networks,  Next: Host Interfaces,  Prev: IP Host Addresses,  Up: Creating Address/Network/Interface objects": {
            "content": "9.15.1.3 Defining Networks\n..........................\n\nHost addresses are usually grouped together into IP networks, so *note\nipaddress: 7a. provides a way to create, inspect and manipulate network\ndefinitions.  IP network objects are constructed from strings that\ndefine the range of host addresses that are part of that network.  The\nsimplest form for that information is a \"network address/network prefix\"\npair, where the prefix defines the number of leading bits that are\ncompared to determine whether or not an address is part of the network\nand the network address defines the expected value of those bits.\n",
            "subsections": []
        },
        "As for addresses, a factory function is provided that determines the": {
            "content": "correct IP version automatically:\n\n>>> ipaddress.ipnetwork('192.0.2.0/24')\nIPv4Network('192.0.2.0/24')\n>>> ipaddress.ipnetwork('2001:db8::0/96')\nIPv6Network('2001:db8::/96')\n",
            "subsections": []
        },
        "Network objects cannot have any host bits set.  The practical effect of": {
            "content": "this is that '192.0.2.1/24' does not describe a network.  Such\ndefinitions are referred to as interface objects since the\nip-on-a-network notation is commonly used to describe network interfaces\nof a computer on a given network and are described further in the next\nsection.\n",
            "subsections": []
        },
        "By default, attempting to create a network object with host bits set": {
            "content": "will result in *note ValueError: 183. being raised.  To request that the\nadditional bits instead be coerced to zero, the flag 'strict=False' can\nbe passed to the constructor:\n\n>>> ipaddress.ipnetwork('192.0.2.1/24')\nTraceback (most recent call last):\n...\nValueError: 192.0.2.1/24 has host bits set\n>>> ipaddress.ipnetwork('192.0.2.1/24', strict=False)\nIPv4Network('192.0.2.0/24')\n",
            "subsections": []
        },
        "While the string form offers significantly more flexibility, networks": {
            "content": "can also be defined with integers, just like host addresses.  In this\ncase, the network is considered to contain only the single address\nidentified by the integer, so the network prefix includes the entire\nnetwork address:\n\n>>> ipaddress.ipnetwork(3221225984)\nIPv4Network('192.0.2.0/32')\n>>> ipaddress.ipnetwork(42540766411282592856903984951653826560)\nIPv6Network('2001:db8::/128')\n",
            "subsections": []
        },
        "As with addresses, creation of a particular kind of network can be": {
            "content": "forced by calling the class constructor directly instead of using the\nfactory function.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Host Interfaces,  Prev: Defining Networks,  Up: Creating Address/Network/Interface objects": {
            "content": "9.15.1.4 Host Interfaces\n........................\n",
            "subsections": []
        },
        "As mentioned just above, if you need to describe an address on a": {
            "content": "particular network, neither the address nor the network classes are\nsufficient.  Notation like '192.0.2.1/24' is commonly used by network\nengineers and the people who write tools for firewalls and routers as\nshorthand for \"the host '192.0.2.1' on the network '192.0.2.0/24'\",\nAccordingly, *note ipaddress: 7a. provides a set of hybrid classes that\nassociate an address with a particular network.  The interface for\ncreation is identical to that for defining network objects, except that\nthe address portion isn't constrained to being a network address.\n\n>>> ipaddress.ipinterface('192.0.2.1/24')\nIPv4Interface('192.0.2.1/24')\n>>> ipaddress.ipinterface('2001:db8::1/96')\nIPv6Interface('2001:db8::1/96')\n",
            "subsections": []
        },
        "Integer inputs are accepted (as with networks), and use of a particular": {
            "content": "IP version can be forced by calling the relevant constructor directly.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "You've gone to the trouble of creating an": {
            "content": "IPv(4|6)(Address|Network|Interface) object, so you probably want to get\ninformation about it.  *note ipaddress: 7a. tries to make doing this\neasy and intuitive.\n\nExtracting the IP version:\n\n>>> addr4 = ipaddress.ipaddress('192.0.2.1')\n>>> addr6 = ipaddress.ipaddress('2001:db8::1')\n>>> addr6.version\n6\n>>> addr4.version\n4\n\nObtaining the network from an interface:\n\n>>> host4 = ipaddress.ipinterface('192.0.2.1/24')\n>>> host4.network\nIPv4Network('192.0.2.0/24')\n>>> host6 = ipaddress.ipinterface('2001:db8::1/96')\n>>> host6.network\nIPv6Network('2001:db8::/96')\n\nFinding out how many individual addresses are in a network:\n\n>>> net4 = ipaddress.ipnetwork('192.0.2.0/24')\n>>> net4.numaddresses\n256\n>>> net6 = ipaddress.ipnetwork('2001:db8::0/96')\n>>> net6.numaddresses\n4294967296\n\nIterating through the \"usable\" addresses on a network:\n\n>>> net4 = ipaddress.ipnetwork('192.0.2.0/24')\n>>> for x in net4.hosts():\n...     print(x)\n192.0.2.1\n192.0.2.2\n192.0.2.3\n192.0.2.4\n...\n192.0.2.252\n192.0.2.253\n192.0.2.254\n",
            "subsections": []
        },
        "Obtaining the netmask (i.e.  set bits corresponding to the network": {
            "content": "prefix) or the hostmask (any bits that are not part of the netmask):\n\n>>> net4 = ipaddress.ipnetwork('192.0.2.0/24')\n>>> net4.netmask\nIPv4Address('255.255.255.0')\n>>> net4.hostmask\nIPv4Address('0.0.0.255')\n>>> net6 = ipaddress.ipnetwork('2001:db8::0/96')\n>>> net6.netmask\nIPv6Address('ffff:ffff:ffff:ffff:ffff:ffff::')\n>>> net6.hostmask\nIPv6Address('::ffff:ffff')\n\nExploding or compressing the address:\n\n>>> addr6.exploded\n'2001:0db8:0000:0000:0000:0000:0000:0001'\n>>> addr6.compressed\n'2001:db8::1'\n>>> net6.exploded\n'2001:0db8:0000:0000:0000:0000:0000:0000/96'\n>>> net6.compressed\n'2001:db8::/96'\n",
            "subsections": []
        },
        "While IPv4 doesn't support explosion or compression, the associated": {
            "content": "objects still provide the relevant properties so that version neutral\ncode can easily ensure the most concise or most verbose form is used for\nIPv6 addresses while still correctly handling IPv4 addresses.\n\nFile: python3.12.info,  Node: Networks as lists of Addresses,  Next: Comparisons<4>,  Prev: Inspecting Address/Network/Interface Objects,  Up: An introduction to the ipaddress module\n\n",
            "subsections": []
        },
        "It's sometimes useful to treat networks as lists.  This means it is": {
            "content": "possible to index them like this:\n\n>>> net4[1]\nIPv4Address('192.0.2.1')\n>>> net4[-1]\nIPv4Address('192.0.2.255')\n>>> net6[1]\nIPv6Address('2001:db8::1')\n>>> net6[-1]\nIPv6Address('2001:db8::ffff:ffff')\n",
            "subsections": []
        },
        "It also means that network objects lend themselves to using the list": {
            "content": "membership test syntax like this:\n\nif address in network:\n# do something\n\nContainment testing is done efficiently based on the network prefix:\n\n>>> addr4 = ipaddress.ipaddress('192.0.2.1')\n>>> addr4 in ipaddress.ipnetwork('192.0.2.0/24')\nTrue\n>>> addr4 in ipaddress.ipnetwork('192.0.3.0/24')\nFalse\n\nFile: python3.12.info,  Node: Comparisons<4>,  Next: Using IP Addresses with other modules,  Prev: Networks as lists of Addresses,  Up: An introduction to the ipaddress module\n\n\n*note ipaddress: 7a. provides some simple, hopefully intuitive ways to\ncompare objects, where it makes sense:\n\n>>> ipaddress.ipaddress('192.0.2.1') < ipaddress.ipaddress('192.0.2.2')\nTrue\n\nA *note TypeError: 28e. exception is raised if you try to compare\nobjects of different versions or different types.\n\nFile: python3.12.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\n\n\nOther modules that use IP addresses (such as *note socket: c6.) usually\nwon't accept objects from this module directly.  Instead, they must be\ncoerced to an integer or string that the other module will accept:\n\n>>> addr4 = ipaddress.ipaddress('192.0.2.1')\n>>> str(addr4)\n'192.0.2.1'\n>>> int(addr4)\n3221225985\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Getting more detail when instance creation fails,  Prev: Using IP Addresses with other modules,  Up: An introduction to the ipaddress module": {
            "content": "",
            "subsections": []
        },
        "When creating address/network/interface objects using the": {
            "content": "version-agnostic factory functions, any errors will be reported as *note",
            "subsections": []
        },
        "ValueError: 183. with a generic error message that simply says the": {
            "content": "passed in value was not recognized as an object of that type.  The lack\nof a specific error is because it's necessary to know whether the value\nis 'supposed' to be IPv4 or IPv6 in order to provide more detail on why\nit has been rejected.\n",
            "subsections": []
        },
        "To support use cases where it is useful to have access to this": {
            "content": "additional detail, the individual class constructors actually raise the\n*note ValueError: 183. subclasses *note ipaddress.AddressValueError:\n387e. and *note ipaddress.NetmaskValueError: 38a3. to indicate exactly\nwhich part of the definition failed to parse correctly.\n",
            "subsections": []
        },
        "The error messages are significantly more detailed when using the class": {
            "content": "constructors directly.  For example:\n\n>>> ipaddress.ipaddress(\"192.168.0.256\")\nTraceback (most recent call last):\n...\nValueError: '192.168.0.256' does not appear to be an IPv4 or IPv6 address\n>>> ipaddress.IPv4Address(\"192.168.0.256\")\nTraceback (most recent call last):\n...\nipaddress.AddressValueError: Octet 256 (> 255) not permitted in '192.168.0.256'\n\n>>> ipaddress.ipnetwork(\"192.168.0.1/64\")\nTraceback (most recent call last):\n...\nValueError: '192.168.0.1/64' does not appear to be an IPv4 or IPv6 network\n>>> ipaddress.IPv4Network(\"192.168.0.1/64\")\nTraceback (most recent call last):\n...\nipaddress.NetmaskValueError: '64' is not a valid netmask\n\nHowever, both of the module specific exceptions have *note ValueError:\n183. as their parent class, so if you're not concerned with the\nparticular type of error, you can still write code like the following:\n\ntry:\nnetwork = ipaddress.IPv4Network(address)\nexcept ValueError:\nprint('address/netmask is invalid for IPv4:', address)\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": [
                {
                    "name": "9.16 Instrumenting CPython with DTrace and SystemTap",
                    "content": "author: David Malcolm\n\n\nauthor: ??ukasz Langa\n\nDTrace and SystemTap are monitoring tools, each providing a way to\ninspect what the processes on a computer system are doing.  They both\nuse domain-specific languages allowing a user to write scripts which:\n\n- filter which processes are to be observed\n\n- gather data from the processes of interest\n\n- generate reports on the data\n\nAs of Python 3.6, CPython can be built with embedded \"markers\", also\nknown as \"probes\", that can be observed by a DTrace or SystemTap script,\nmaking it easier to monitor what the CPython processes on a system are\ndoing.\n\n'CPython implementation detail:' DTrace markers are implementation\ndetails of the CPython interpreter.  No guarantees are made about probe\ncompatibility between versions of CPython.  DTrace scripts can stop\nworking or work incorrectly without warning when changing CPython\nversions.\n\n* Menu:\n\n* Enabling the static markers::\n* Static DTrace probes::\n* Static SystemTap markers::\n* Available static markers::\n* SystemTap Tapsets::\n* Examples: Examples<39>.\n"
                }
            ]
        },
        "File: python3.12.info,  Node: Enabling the static markers,  Next: Static DTrace probes,  Up: Instrumenting CPython with DTrace and SystemTap": {
            "content": "macOS comes with built-in support for DTrace.  On Linux, in order to\nbuild CPython with the embedded markers for SystemTap, the SystemTap\ndevelopment tools must be installed.\n\nOn a Linux machine, this can be done via:\n\n$ yum install systemtap-sdt-devel\n\nor:\n\n$ sudo apt-get install systemtap-sdt-dev\n\nCPython must then be *note configured with the -with-dtrace option:\n1b09.:\n\nchecking for --with-dtrace... yes\n",
            "subsections": []
        },
        "On macOS, you can list available DTrace probes by running a Python": {
            "content": "process in the background and listing all probes made available by the\nPython provider:\n\n$ python3.6 -q &\n$ sudo dtrace -l -P python$!  # or: dtrace -l -m python3.6\n\nID   PROVIDER            MODULE                          FUNCTION NAME\n29564 python18035        python3.6          PyEvalEvalFrameDefault function-entry\n29565 python18035        python3.6             dtracefunctionentry function-entry\n29566 python18035        python3.6          PyEvalEvalFrameDefault function-return\n29567 python18035        python3.6            dtracefunctionreturn function-return\n29568 python18035        python3.6                           collect gc-done\n29569 python18035        python3.6                           collect gc-start\n29570 python18035        python3.6          PyEvalEvalFrameDefault line\n29571 python18035        python3.6                 maybedtraceline line\n",
            "subsections": []
        },
        "On Linux, you can verify if the SystemTap static markers are present in": {
            "content": "the built binary by seeing if it contains a \".note.stapsdt\" section.\n\n$ readelf -S ./python | grep .note.stapsdt\n[30] .note.stapsdt        NOTE         0000000000000000 00308d78\n\nIf you've built Python as a shared library (with the *note\n-enable-shared: 65e. configure option), you need to look instead within\nthe shared library.  For example:\n\n$ readelf -S libpython3.3dm.so.1.0 | grep .note.stapsdt\n[29] .note.stapsdt        NOTE         0000000000000000 00365b68\n\nSufficiently modern readelf can print the metadata:\n\n$ readelf -n ./python\n\nDisplaying notes found at file offset 0x00000254 with length 0x00000020:\nOwner                 Data size          Description\nGNU                  0x00000010          NTGNUABITAG (ABI version tag)\nOS: Linux, ABI: 2.6.32\n\nDisplaying notes found at file offset 0x00000274 with length 0x00000024:\nOwner                 Data size          Description\nGNU                  0x00000014          NTGNUBUILDID (unique build ID bitstring)\nBuild ID: df924a2b08a7e89f6e11251d4602022977af2670\n\nDisplaying notes found at file offset 0x002d6c30 with length 0x00000144:\nOwner                 Data size          Description\nstapsdt              0x00000031          NTSTAPSDT (SystemTap probe descriptors)\nProvider: python\nName: gcstart\nLocation: 0x00000000004371c3, Base: 0x0000000000630ce2, Semaphore: 0x00000000008d6bf6\nArguments: -4@%ebx\nstapsdt              0x00000030          NTSTAPSDT (SystemTap probe descriptors)\nProvider: python\nName: gcdone\nLocation: 0x00000000004374e1, Base: 0x0000000000630ce2, Semaphore: 0x00000000008d6bf8\nArguments: -8@%rax\nstapsdt              0x00000045          NTSTAPSDT (SystemTap probe descriptors)\nProvider: python\nName: functionentry\nLocation: 0x000000000053db6c, Base: 0x0000000000630ce2, Semaphore: 0x00000000008d6be8\nArguments: 8@%rbp 8@%r12 -4@%eax\nstapsdt              0x00000046          NTSTAPSDT (SystemTap probe descriptors)\nProvider: python\nName: functionreturn\nLocation: 0x000000000053dba8, Base: 0x0000000000630ce2, Semaphore: 0x00000000008d6bea\nArguments: 8@%rbp 8@%r12 -4@%eax\n",
            "subsections": []
        },
        "The above metadata contains information for SystemTap describing how it": {
            "content": "can patch strategically placed machine code instructions to enable the\ntracing hooks used by a SystemTap script.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Static DTrace probes,  Next: Static SystemTap markers,  Prev: Enabling the static markers,  Up: Instrumenting CPython with DTrace and SystemTap": {
            "content": "",
            "subsections": []
        },
        "The following example DTrace script can be used to show the call/return": {
            "content": "hierarchy of a Python script, only tracing within the invocation of a\nfunction called \"start\".  In other words, import-time function\ninvocations are not going to be listed:\n\nself int indent;\n\npython$target:::function-entry\n/copyinstr(arg1) == \"start\"/\n{\nself->trace = 1;\n}\n\npython$target:::function-entry\n/self->trace/\n{\nprintf(\"%d\\t%*s:\", timestamp, 15, probename);\nprintf(\"%*s\", self->indent, \"\");\nprintf(\"%s:%s:%d\\n\", basename(copyinstr(arg0)), copyinstr(arg1), arg2);\nself->indent++;\n}\n\npython$target:::function-return\n/self->trace/\n{\nself->indent--;\nprintf(\"%d\\t%*s:\", timestamp, 15, probename);\nprintf(\"%*s\", self->indent, \"\");\nprintf(\"%s:%s:%d\\n\", basename(copyinstr(arg0)), copyinstr(arg1), arg2);\n}\n\npython$target:::function-return\n/copyinstr(arg1) == \"start\"/\n{\nself->trace = 0;\n}\n\nIt can be invoked like this:\n\n$ sudo dtrace -q -s callstack.d -c \"python3.6 script.py\"\n\nThe output looks like this:\n\n156641360502280  function-entry:callstack.py:start:23\n156641360518804  function-entry: callstack.py:function1:1\n156641360532797  function-entry:  callstack.py:function3:9\n156641360546807 function-return:  callstack.py:function3:10\n156641360563367 function-return: callstack.py:function1:2\n156641360578365  function-entry: callstack.py:function2:5\n156641360591757  function-entry:  callstack.py:function1:1\n156641360605556  function-entry:   callstack.py:function3:9\n156641360617482 function-return:   callstack.py:function3:10\n156641360629814 function-return:  callstack.py:function1:2\n156641360642285 function-return: callstack.py:function2:6\n156641360656770  function-entry: callstack.py:function3:9\n156641360669707 function-return: callstack.py:function3:10\n156641360687853  function-entry: callstack.py:function4:13\n156641360700719 function-return: callstack.py:function4:14\n156641360719640  function-entry: callstack.py:function5:18\n156641360732567 function-return: callstack.py:function5:21\n156641360747370 function-return:callstack.py:start:28\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Static SystemTap markers,  Next: Available static markers,  Prev: Static DTrace probes,  Up: Instrumenting CPython with DTrace and SystemTap": {
            "content": "",
            "subsections": []
        },
        "The low-level way to use the SystemTap integration is to use the static": {
            "content": "markers directly.  This requires you to explicitly state the binary file\ncontaining them.\n",
            "subsections": []
        },
        "For example, this SystemTap script can be used to show the call/return": {
            "content": "hierarchy of a Python script:\n\nprobe process(\"python\").mark(\"functionentry\") {\nfilename = userstring($arg1);\nfuncname = userstring($arg2);\nlineno = $arg3;\n\nprintf(\"%s => %s in %s:%d\\\\n\",\nthreadindent(1), funcname, filename, lineno);\n}\n\nprobe process(\"python\").mark(\"functionreturn\") {\nfilename = userstring($arg1);\nfuncname = userstring($arg2);\nlineno = $arg3;\n\nprintf(\"%s <= %s in %s:%d\\\\n\",\nthreadindent(-1), funcname, filename, lineno);\n}\n\nIt can be invoked like this:\n\n$ stap \\\nshow-call-hierarchy.stp \\\n-c \"./python test.py\"\n\nThe output looks like this:\n\n11408 python(8274):        => contains in Lib/abcoll.py:362\n11414 python(8274):         => getitem in Lib/os.py:425\n11418 python(8274):          => encode in Lib/os.py:490\n11424 python(8274):          <= encode in Lib/os.py:493\n11428 python(8274):         <= getitem in Lib/os.py:426\n11433 python(8274):        <= contains in Lib/abcoll.py:366\n\nwhere the columns are:\n\n- time in microseconds since start of script\n\n- name of executable\n\n- PID of process\n\nand the remainder indicates the call/return hierarchy as the script\nexecutes.\n\nFor a *note -enable-shared: 65e. build of CPython, the markers are\ncontained within the libpython shared library, and the probe's dotted\npath needs to reflect this.  For example, this line from the above\nexample:\n\nprobe process(\"python\").mark(\"functionentry\") {\n\nshould instead read:\n\nprobe process(\"python\").library(\"libpython3.6dm.so.1.0\").mark(\"functionentry\") {\n\n(assuming a *note debug build: 67f. of CPython 3.6)\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Available static markers,  Next: SystemTap Tapsets,  Prev: Static SystemTap markers,  Up: Instrumenting CPython with DTrace and SystemTap": {
            "content": "-- Object: functionentry(str filename, str funcname, int lineno)\n\nThis marker indicates that execution of a Python function has\nbegun.  It is only triggered for pure-Python (bytecode) functions.\n\nThe filename, function name, and line number are provided back to\nthe tracing script as positional arguments, which must be accessed\nusing '$arg1', '$arg2', '$arg3':\n\n* '$arg1' : '(const char *)' filename, accessible using\n'userstring($arg1)'\n\n* '$arg2' : '(const char *)' function name, accessible\nusing 'userstring($arg2)'\n\n* '$arg3' : 'int' line number\n\n-- Object: functionreturn(str filename, str funcname, int lineno)\n\nThis marker is the converse of 'functionentry()', and indicates\nthat execution of a Python function has ended (either via 'return',\nor via an exception).  It is only triggered for pure-Python\n(bytecode) functions.\n\nThe arguments are the same as for 'functionentry()'\n\n-- Object: line(str filename, str funcname, int lineno)\n\nThis marker indicates a Python line is about to be executed.  It is\nthe equivalent of line-by-line tracing with a Python profiler.  It\nis not triggered within C functions.\n\nThe arguments are the same as for 'functionentry()'.\n\n-- Object: gcstart(int generation)\n\nFires when the Python interpreter starts a garbage collection\ncycle.  'arg0' is the generation to scan, like *note gc.collect():\n865.\n\n-- Object: gcdone(long collected)\n\nFires when the Python interpreter finishes a garbage collection\ncycle.  'arg0' is the number of collected objects.\n\n-- Object: importfindloadstart(str modulename)\n\nFires before *note importlib: 71. attempts to find and load the\nmodule.  'arg0' is the module name.\n\nNew in version 3.7.\n\n-- Object: importfindloaddone(str modulename, int found)\n\nFires after *note importlib: 71.'s findandload function is\ncalled.  'arg0' is the module name, 'arg1' indicates if module was\nsuccessfully loaded.\n\nNew in version 3.7.\n\n-- Object: audit(str event, void *tuple)\n\nFires when *note sys.audit(): 16dc. or *note PySysAudit(): 16ec.\nis called.  'arg0' is the event name as C string, 'arg1' is a *note\nPyObject: 6b1. pointer to a tuple object.\n\nNew in version 3.8.\n\nFile: python3.12.info,  Node: SystemTap Tapsets,  Next: Examples<39>,  Prev: Available static markers,  Up: Instrumenting CPython with DTrace and SystemTap\n\n",
            "subsections": []
        },
        "The higher-level way to use the SystemTap integration is to use a": {
            "content": "\"tapset\": SystemTap's equivalent of a library, which hides some of the\nlower-level details of the static markers.\n\nHere is a tapset file, based on a non-shared build of CPython:\n\n/*\nProvide a higher-level wrapping around the functionentry and\nfunctionreturn markers:\n\\*/\nprobe python.function.entry = process(\"python\").mark(\"functionentry\")\n{\nfilename = userstring($arg1);\nfuncname = userstring($arg2);\nlineno = $arg3;\nframeptr = $arg4\n}\nprobe python.function.return = process(\"python\").mark(\"functionreturn\")\n{\nfilename = userstring($arg1);\nfuncname = userstring($arg2);\nlineno = $arg3;\nframeptr = $arg4\n}\n\nIf this file is installed in SystemTap's tapset directory (e.g.\n'/usr/share/systemtap/tapset'), then these additional probepoints become\navailable:\n\n-- Object: python.function.entry(str filename, str funcname, int\nlineno, frameptr)\n\nThis probe point indicates that execution of a Python function has\nbegun.  It is only triggered for pure-Python (bytecode) functions.\n\n-- Object: python.function.return(str filename, str funcname, int\nlineno, frameptr)\n\nThis probe point is the converse of 'python.function.return', and\nindicates that execution of a Python function has ended (either via\n'return', or via an exception).  It is only triggered for\npure-Python (bytecode) functions.\n\nFile: python3.12.info,  Node: Examples<39>,  Prev: SystemTap Tapsets,  Up: Instrumenting CPython with DTrace and SystemTap\n\n",
            "subsections": []
        },
        "This SystemTap script uses the tapset above to more cleanly implement": {
            "content": "the example given above of tracing the Python function-call hierarchy,\nwithout needing to directly name the static markers:\n\nprobe python.function.entry\n{\nprintf(\"%s => %s in %s:%d\\n\",\nthreadindent(1), funcname, filename, lineno);\n}\n\nprobe python.function.return\n{\nprintf(\"%s <= %s in %s:%d\\n\",\nthreadindent(-1), funcname, filename, lineno);\n}\n",
            "subsections": []
        },
        "The following script uses the tapset above to provide a top-like view of": {
            "content": "all running CPython code, showing the top 20 most frequently entered\nbytecode frames, each second, across the whole system:\n\nglobal fncalls;\n\nprobe python.function.entry\n{\nfncalls[pid(), filename, funcname, lineno] += 1;\n}\n\nprobe timer.ms(1000) {\nprintf(\"\\033[2J\\033[1;1H\") /* clear screen \\*/\nprintf(\"%6s %80s %6s %30s %6s\\n\",\n\"PID\", \"FILENAME\", \"LINE\", \"FUNCTION\", \"CALLS\")\nforeach ([pid, filename, funcname, lineno] in fncalls- limit 20) {\nprintf(\"%6d %80s %6d %30s %6d\\n\",\npid, filename, lineno, funcname,\nfncalls[pid, filename, funcname, lineno]);\n}\ndelete fncalls;\n}\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python support for the Linux perf profiler,  Next: Annotations Best Practices,  Prev: Instrumenting CPython with DTrace and SystemTap,  Up: Python HOWTOs": {
            "content": "",
            "subsections": [
                {
                    "name": "9.17 Python support for the Linux 'perf' profiler",
                    "content": "author: Pablo Galindo\n"
                }
            ]
        },
        "The Linux perf profiler(1) is a very powerful tool that allows you to": {
            "content": "profile and obtain information about the performance of your\napplication.  'perf' also has a very vibrant ecosystem of tools that aid\nwith the analysis of the data that it produces.\n",
            "subsections": []
        },
        "The main problem with using the 'perf' profiler with Python applications": {
            "content": "is that 'perf' only gets information about native symbols, that is, the\nnames of functions and procedures written in C. This means that the\nnames and file names of Python functions in your code will not appear in\nthe output of 'perf'.\n",
            "subsections": []
        },
        "Since Python 3.12, the interpreter can run in a special mode that allows": {
            "content": "",
            "subsections": []
        },
        "Python functions to appear in the output of the 'perf' profiler.  When": {
            "content": "this mode is enabled, the interpreter will interpose a small piece of\ncode compiled on the fly before the execution of every Python function\nand it will teach 'perf' the relationship between this piece of code and\nthe associated Python function using *note perf map files: 493a.\n\nNote: Support for the 'perf' profiler is currently only available\nfor Linux on select architectures.  Check the output of the\n'configure' build step or check the output of 'python -m sysconfig\n| grep HAVEPERFTRAMPOLINE' to see if your system is supported.\n\nFor example, consider the following script:\n\ndef foo(n):\nresult = 0\nfor  in range(n):\nresult += 1\nreturn result\n\ndef bar(n):\nfoo(n)\n\ndef baz(n):\nbar(n)\n\nif name == \"main\":\nbaz(1000000)\n\nWe can run 'perf' to sample CPU stack traces at 9999 hertz:\n\n$ perf record -F 9999 -g -o perf.data python myscript.py\n\nThen we can use 'perf report' to analyze the data:\n\n$ perf report --stdio -n -g\n\n# Children      Self       Samples  Command     Shared Object       Symbol\n# ........  ........  ............  ..........  ..................  ..........................................\n#\n91.08%     0.00%             0  python.exe  python.exe          [.] start\n|\n---start\n|\n--90.71%--libcstartmain\nPyBytesMain\n|\n|--56.88%--pymainrunpython.constprop.0\n|          |\n|          |--56.13%--PyRunAnyFileObject\n|          |          PyRunSimpleFileObject\n|          |          |\n|          |          |--55.02%--runmod\n|          |          |          |\n|          |          |           --54.65%--PyEvalEvalCode\n|          |          |                     PyEvalEvalFrameDefault\n|          |          |                     PyObjectVectorcall\n|          |          |                     PyEvalVector\n|          |          |                     PyEvalEvalFrameDefault\n|          |          |                     PyObjectVectorcall\n|          |          |                     PyEvalVector\n|          |          |                     PyEvalEvalFrameDefault\n|          |          |                     PyObjectVectorcall\n|          |          |                     PyEvalVector\n|          |          |                     |\n|          |          |                     |--51.67%--PyEvalEvalFrameDefault\n|          |          |                     |          |\n|          |          |                     |          |--11.52%--PyLongAdd\n|          |          |                     |          |          |\n|          |          |                     |          |          |--2.97%--PyObjectMalloc\n...\n",
            "subsections": []
        },
        "As you can see, the Python functions are not shown in the output, only": {
            "content": "'PyEvalEvalFrameDefault' (the function that evaluates the Python\nbytecode) shows up.  Unfortunately that's not very useful because all",
            "subsections": []
        },
        "Python functions use the same C function to evaluate bytecode so we": {
            "content": "cannot know which Python function corresponds to which\nbytecode-evaluating function.\n",
            "subsections": []
        },
        "Instead, if we run the same experiment with 'perf' support enabled we": {
            "content": "get:\n\n$ perf report --stdio -n -g\n\n# Children      Self       Samples  Command     Shared Object       Symbol\n# ........  ........  ............  ..........  ..................  .....................................................................\n#\n90.58%     0.36%             1  python.exe  python.exe          [.] start\n|\n---start\n|\n--89.86%--libcstartmain\nPyBytesMain\n|\n|--55.43%--pymainrunpython.constprop.0\n|          |\n|          |--54.71%--PyRunAnyFileObject\n|          |          PyRunSimpleFileObject\n|          |          |\n|          |          |--53.62%--runmod\n|          |          |          |\n|          |          |           --53.26%--PyEvalEvalCode\n|          |          |                     py::<module>:/src/script.py\n|          |          |                     PyEvalEvalFrameDefault\n|          |          |                     PyObjectVectorcall\n|          |          |                     PyEvalVector\n|          |          |                     py::baz:/src/script.py\n|          |          |                     PyEvalEvalFrameDefault\n|          |          |                     PyObjectVectorcall\n|          |          |                     PyEvalVector\n|          |          |                     py::bar:/src/script.py\n|          |          |                     PyEvalEvalFrameDefault\n|          |          |                     PyObjectVectorcall\n|          |          |                     PyEvalVector\n|          |          |                     py::foo:/src/script.py\n|          |          |                     |\n|          |          |                     |--51.81%--PyEvalEvalFrameDefault\n|          |          |                     |          |\n|          |          |                     |          |--13.77%--PyLongAdd\n|          |          |                     |          |          |\n|          |          |                     |          |          |--3.26%--PyObjectMalloc\n\n* Menu:\n\n* How to enable perf profiling support::\n* How to obtain the best results::\n\n---------- Footnotes ----------\n\n(1) https://perf.wiki.kernel.org\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: How to enable perf profiling support,  Next: How to obtain the best results,  Up: Python support for the Linux perf profiler": {
            "content": "'perf' profiling support can be enabled either from the start using the\nenvironment variable *note PYTHONPERFSUPPORT: 187. or the *note -X perf:\n188. option, or dynamically using *note sys.activatestacktrampoline():\n189. and *note sys.deactivatestacktrampoline(): 18a.\n",
            "subsections": []
        },
        "The 'sys' functions take precedence over the '-X' option, the '-X'": {
            "content": "option takes precedence over the environment variable.\n\nExample, using the environment variable:\n\n$ PYTHONPERFSUPPORT=1 python script.py\n$ perf report -g -i perf.data\n\nExample, using the '-X' option:\n\n$ python -X perf script.py\n$ perf report -g -i perf.data\n\nExample, using the *note sys: d3. APIs in file 'example.py':\n\nimport sys\n\nsys.activatestacktrampoline(\"perf\")\ndoprofiledstuff()\nsys.deactivatestacktrampoline()\n\nnonprofiledstuff()\n\n...then:\n\n$ python ./example.py\n$ perf report -g -i perf.data\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: How to obtain the best results,  Prev: How to enable perf profiling support,  Up: Python support for the Linux perf profiler": {
            "content": "",
            "subsections": []
        },
        "For best results, Python should be compiled with": {
            "content": "'CFLAGS=\"-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer\"' as this\nallows profilers to unwind using only the frame pointer and not on DWARF\ndebug information.  This is because as the code that is interposed to\nallow 'perf' support is dynamically generated it doesn't have any DWARF\ndebugging information available.\n",
            "subsections": []
        },
        "You can check if your system has been compiled with this flag by": {
            "content": "running:\n\n$ python -m sysconfig | grep 'no-omit-frame-pointer'\n",
            "subsections": []
        },
        "If you don't see any output it means that your interpreter has not been": {
            "content": "compiled with frame pointers and therefore it may not be able to show\nPython functions in the output of 'perf'.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Annotations Best Practices,  Next: Isolating Extension Modules,  Prev: Python support for the Linux perf profiler,  Up: Python HOWTOs": {
            "content": "",
            "subsections": [
                {
                    "name": "9.18 Annotations Best Practices",
                    "content": "author: Larry Hastings\n"
                }
            ]
        },
        "This document is designed to encapsulate the best practices for working": {
            "content": "with annotations dicts.  If you write Python code that examines\n'annotations' on Python objects, we encourage you to follow the\nguidelines described below.\n",
            "subsections": []
        },
        "The document is organized into four sections: best practices for": {
            "content": "accessing the annotations of an object in Python versions 3.10 and\nnewer, best practices for accessing the annotations of an object in",
            "subsections": []
        },
        "Python versions 3.9 and older, other best practices for": {
            "content": "'annotations' that apply to any Python version, and quirks of\n'annotations'.\n",
            "subsections": []
        },
        "Note that this document is specifically about working with": {
            "content": "'annotations', not uses 'for' annotations.  If you're looking for\ninformation on how to use \"type hints\" in your code, please see the\n*note typing: ff. module.\n\n* Menu:\n\n* 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.\n* 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.\n* Manually Un-Stringizing Stringized Annotations::\n* Best Practices For annotations In Any Python Version::\n* annotations Quirks::\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "Python 3.10 adds a new function to the standard library: *note\ninspect.getannotations(): 606.  In Python versions 3.10 and newer,\ncalling this function is the best practice for accessing the annotations\ndict of any object that supports annotations.  This function can also\n\"un-stringize\" stringized annotations for you.\n\nIf for some reason *note inspect.getannotations(): 606. isn't viable\nfor your use case, you may access the 'annotations' data member\nmanually.  Best practice for this changed in Python 3.10 as well: as of",
            "subsections": []
        },
        "Python 3.10, 'o.annotations' is guaranteed to 'always' work on": {
            "content": "",
            "subsections": []
        },
        "Python functions, classes, and modules.  If you're certain the object": {
            "content": "you're examining is one of these three 'specific' objects, you may\nsimply use 'o.annotations' to get at the object's annotations dict.\n",
            "subsections": []
        },
        "However, other types of callables-for example, callables created by": {
            "content": "*note functools.partial(): d31.-may not have an 'annotations'\nattribute defined.  When accessing the 'annotations' of a possibly\nunknown object, best practice in Python versions 3.10 and newer is to\ncall *note getattr(): a15. with three arguments, for example 'getattr(o,\n'annotations', None)'.\n",
            "subsections": []
        },
        "Before Python 3.10, accessing 'annotations' on a class that defines": {
            "content": "no annotations but that has a parent class with annotations would return\nthe parent's 'annotations'.  In Python 3.10 and newer, the child\nclass's annotations will be an empty dict instead.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": []
        },
        "In Python 3.9 and older, accessing the annotations dict of an object is": {
            "content": "much more complicated than in newer versions.  The problem is a design\nflaw in these older versions of Python, specifically to do with class\nannotations.\n",
            "subsections": []
        },
        "Best practice for accessing the annotations dict of other": {
            "content": "objects-functions, other callables, and modules-is the same as best\npractice for 3.10, assuming you aren't calling *note\ninspect.getannotations(): 606.: you should use three-argument *note\ngetattr(): a15. to access the object's 'annotations' attribute.\n",
            "subsections": []
        },
        "Unfortunately, this isn't best practice for classes.  The problem is": {
            "content": "that, since 'annotations' is optional on classes, and because\nclasses can inherit attributes from their base classes, accessing the\n'annotations' attribute of a class may inadvertently return the\nannotations dict of a 'base class.'  As an example:\n\nclass Base:\na: int = 3\nb: str = 'abc'\n\nclass Derived(Base):\npass\n\nprint(Derived.annotations)\n\nThis will print the annotations dict from 'Base', not 'Derived'.\n",
            "subsections": []
        },
        "Your code will have to have a separate code path if the object you're": {
            "content": "examining is a class ('isinstance(o, type)').  In that case, best\npractice relies on an implementation detail of Python 3.9 and before: if\na class has annotations defined, they are stored in the class's\n'dict' dictionary.  Since the class may or may not have annotations\ndefined, best practice is to call the 'get' method on the class dict.\n",
            "subsections": []
        },
        "To put it all together, here is some sample code that safely accesses": {
            "content": "the 'annotations' attribute on an arbitrary object in Python 3.9 and\nbefore:\n\nif isinstance(o, type):\nann = o.dict.get('annotations', None)\nelse:\nann = getattr(o, 'annotations', None)\n\nAfter running this code, 'ann' should be either a dictionary or 'None'.\nYou're encouraged to double-check the type of 'ann' using *note\nisinstance(): 14b. before further examination.\n",
            "subsections": []
        },
        "Note that some exotic or malformed type objects may not have a": {
            "content": "'dict' attribute, so for extra safety you may also wish to use *note\ngetattr(): a15. to access 'dict'.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "In situations where some annotations may be \"stringized\", and you wish\nto evaluate those strings to produce the Python values they represent,\nit really is best to call *note inspect.getannotations(): 606. to do\nthis work for you.\n",
            "subsections": []
        },
        "If you're using Python 3.9 or older, or if for some reason you can't use": {
            "content": "*note inspect.getannotations(): 606, you'll need to duplicate its\nlogic.  You're encouraged to examine the implementation of *note\ninspect.getannotations(): 606. in the current Python version and follow\na similar approach.\n",
            "subsections": []
        },
        "In a nutshell, if you wish to evaluate a stringized annotation on an": {
            "content": "arbitrary object 'o':\n\n* If 'o' is a module, use 'o.dict' as the 'globals' when calling\n*note eval(): 690.\n\n* If 'o' is a class, use 'sys.modules[o.module].dict' as the\n'globals', and 'dict(vars(o))' as the 'locals', when calling *note\neval(): 690.\n\n* If 'o' is a wrapped callable using *note\nfunctools.updatewrapper(): e99, *note functools.wraps(): dcd, or\n*note functools.partial(): d31, iteratively unwrap it by accessing\neither 'o.wrapped' or 'o.func' as appropriate, until you have\nfound the root unwrapped function.\n\n* If 'o' is a callable (but not a class), use *note o.globals:\n1148. as the globals when calling *note eval(): 690.\n",
            "subsections": []
        },
        "However, not all string values used as annotations can be successfully": {
            "content": "turned into Python values by *note eval(): 690.  String values could\ntheoretically contain any valid string, and in practice there are valid\nuse cases for type hints that require annotating with string values that\nspecifically 'can't' be evaluated.  For example:\n\n* PEP 604(1) union types using '|', before support for this was added\nto Python 3.10.\n\n* Definitions that aren't needed at runtime, only imported when *note\ntyping.TYPECHECKING: b44. is true.\n\nIf *note eval(): 690. attempts to evaluate such values, it will fail and\nraise an exception.  So, when designing a library API that works with\nannotations, it's recommended to only attempt to evaluate string values\nwhen explicitly requested to by the caller.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0604/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Best Practices For annotations In Any Python Version,  Next: annotations Quirks,  Prev: Manually Un-Stringizing Stringized Annotations,  Up: Annotations Best Practices": {
            "content": "* You should avoid assigning to the 'annotations' member of\nobjects directly.  Let Python manage setting 'annotations'.\n\n* If you do assign directly to the 'annotations' member of an\nobject, you should always set it to a 'dict' object.\n\n* If you directly access the 'annotations' member of an object,\nyou should ensure that it's a dictionary before attempting to\nexamine its contents.\n\n* You should avoid modifying 'annotations' dicts.\n\n* You should avoid deleting the 'annotations' attribute of an\nobject.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: annotations Quirks,  Prev: Best Practices For annotations In Any Python Version,  Up: Annotations Best Practices": {
            "content": "",
            "subsections": []
        },
        "In all versions of Python 3, function objects lazy-create an annotations": {
            "content": "dict if no annotations are defined on that object.  You can delete the\n'annotations' attribute using 'del fn.annotations', but if you\nthen access 'fn.annotations' the object will create a new empty dict\nthat it will store and return as its annotations.  Deleting the\nannotations on a function before it has lazily created its annotations\ndict will throw an 'AttributeError'; using 'del fn.annotations'\ntwice in a row is guaranteed to always throw an 'AttributeError'.\n",
            "subsections": []
        },
        "Everything in the above paragraph also applies to class and module": {
            "content": "objects in Python 3.10 and newer.\n",
            "subsections": []
        },
        "In all versions of Python 3, you can set 'annotations' on a function": {
            "content": "object to 'None'.  However, subsequently accessing the annotations on\nthat object using 'fn.annotations' will lazy-create an empty\ndictionary as per the first paragraph of this section.  This is 'not'\ntrue of modules and classes, in any Python version; those objects permit\nsetting 'annotations' to any Python value, and will retain whatever\nvalue is set.\n",
            "subsections": []
        },
        "If Python stringizes your annotations for you (using 'from future": {
            "content": "import annotations'), and you specify a string as an annotation, the\nstring will itself be quoted.  In effect the annotation is quoted\n'twice.'  For example:\n\nfrom future import annotations\ndef foo(a: \"str\"): pass\n\nprint(foo.annotations)\n\nThis prints '{'a': \"'str'\"}'.  This shouldn't really be considered a\n\"quirk\"; it's mentioned here simply because it might be surprising.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Isolating Extension Modules,  Prev: Annotations Best Practices,  Up: Python HOWTOs": {
            "content": "",
            "subsections": [
                {
                    "name": "9.19 Isolating Extension Modules",
                    "content": ""
                }
            ]
        },
        "Traditionally, state belonging to Python extension modules was kept in C": {
            "content": "'static' variables, which have process-wide scope.  This document\ndescribes problems of such per-process state and shows a safer way:\nper-module state.\n",
            "subsections": []
        },
        "The document also describes how to switch to per-module state where": {
            "content": "possible.  This transition involves allocating space for that state,\npotentially switching from static types to heap types, and--perhaps most\nimportantly--accessing per-module state from code.\n\n* Menu:\n\n* Who should read this::\n* Background: Background<2>.\n* Making Modules Safe with Multiple Interpreters::\n* Heap Types: Heap Types<2>.\n* Open Issues::\n\nFile: python3.12.info,  Node: Who should read this,  Next: Background<2>,  Up: Isolating Extension Modules\n\n\nThis guide is written for maintainers of *note C-API: 195f. extensions\nwho would like to make that extension safer to use in applications where\nPython itself is used as a library.\n\nFile: python3.12.info,  Node: Background<2>,  Next: Making Modules Safe with Multiple Interpreters,  Prev: Who should read this,  Up: Isolating Extension Modules\n\n",
            "subsections": []
        },
        "An 'interpreter' is the context in which Python code runs.  It contains": {
            "content": "configuration (e.g.  the import path) and runtime state (e.g.  the set\nof imported modules).\n",
            "subsections": []
        },
        "Python supports running multiple interpreters in one process.  There are": {
            "content": "two cases to think about--users may run interpreters:\n\n- in sequence, with several *note PyInitializeEx(): 48a7./*note\nPyFinalizeEx(): b67. cycles, and\n\n- in parallel, managing \"sub-interpreters\" using *note\nPyNewInterpreter(): 150d./*note PyEndInterpreter(): 15c1.\n",
            "subsections": []
        },
        "Both cases (and combinations of them) would be most useful when": {
            "content": "embedding Python within a library.  Libraries generally shouldn't make\nassumptions about the application that uses them, which include assuming\na process-wide \"main Python interpreter\".\n\nHistorically, Python extension modules don't handle this use case well.",
            "subsections": []
        },
        "Many extension modules (and even some stdlib modules) use 'per-process'": {
            "content": "global state, because C 'static' variables are extremely easy to use.",
            "subsections": []
        },
        "Thus, data that should be specific to an interpreter ends up being": {
            "content": "shared between interpreters.  Unless the extension developer is careful,\nit is very easy to introduce edge cases that lead to crashes when a\nmodule is loaded in more than one interpreter in the same process.\n\nUnfortunately, 'per-interpreter' state is not easy to achieve.",
            "subsections": []
        },
        "Extension authors tend to not keep multiple interpreters in mind when": {
            "content": "developing, and it is currently cumbersome to test the behavior.\n\n* Menu:\n\n* Enter Per-Module State::\n* Isolated Module Objects::\n* Surprising Edge Cases::\n\nFile: python3.12.info,  Node: Enter Per-Module State,  Next: Isolated Module Objects,  Up: Background<2>\n\n9.19.2.1 Enter Per-Module State\n...............................\n",
            "subsections": []
        },
        "Instead of focusing on per-interpreter state, Python's C API is evolving": {
            "content": "to better support the more granular 'per-module' state.  This means that\nC-level data should be attached to a 'module object'.  Each interpreter\ncreates its own module object, keeping the data separate.  For testing\nthe isolation, multiple module objects corresponding to a single\nextension can even be loaded in a single interpreter.\n",
            "subsections": []
        },
        "Per-module state provides an easy way to think about lifetime and": {
            "content": "resource ownership: the extension module will initialize when a module\nobject is created, and clean up when it's freed.  In this regard, a\nmodule is just like any other *note PyObject: 6b1.*; there are no \"on\ninterpreter shutdown\" hooks to think--or forget--about.\n\nNote that there are use cases for different kinds of \"globals\":\nper-process, per-interpreter, per-thread or per-task state.  With\nper-module state as the default, these are still possible, but you\nshould treat them as exceptional cases: if you need them, you should\ngive them additional care and testing.  (Note that this guide does not\ncover them.)\n\nFile: python3.12.info,  Node: Isolated Module Objects,  Next: Surprising Edge Cases,  Prev: Enter Per-Module State,  Up: Background<2>\n\n9.19.2.2 Isolated Module Objects\n................................\n",
            "subsections": []
        },
        "The key point to keep in mind when developing an extension module is": {
            "content": "that several module objects can be created from a single shared library.\nFor example:\n\n>>> import sys\n>>> import binascii\n>>> oldbinascii = binascii\n>>> del sys.modules['binascii']\n>>> import binascii  # create a new module object\n>>> oldbinascii == binascii\nFalse\n\nAs a rule of thumb, the two modules should be completely independent.",
            "subsections": []
        },
        "All objects and state specific to the module should be encapsulated": {
            "content": "within the module object, not shared with other module objects, and\ncleaned up when the module object is deallocated.  Since this just is a\nrule of thumb, exceptions are possible (see *note Managing Global State:\n4dd8.), but they will need more thought and attention to edge cases.\n",
            "subsections": []
        },
        "While some modules could do with less stringent restrictions, isolated": {
            "content": "modules make it easier to set clear expectations and guidelines that\nwork across a variety of use cases.\n\nFile: python3.12.info,  Node: Surprising Edge Cases,  Prev: Isolated Module Objects,  Up: Background<2>\n\n9.19.2.3 Surprising Edge Cases\n..............................\n",
            "subsections": []
        },
        "Note that isolated modules do create some surprising edge cases.  Most": {
            "content": "notably, each module object will typically not share its classes and\nexceptions with other similar modules.  Continuing from the *note\nexample above: 4dd7, note that 'oldbinascii.Error' and 'binascii.Error'\nare separate objects.  In the following code, the exception is 'not'\ncaught:\n\n>>> oldbinascii.Error == binascii.Error\nFalse\n>>> try:\n...     oldbinascii.unhexlify(b'qwertyuiop')\n... except binascii.Error:\n...     print('boo')\n...\nTraceback (most recent call last):\nFile \"<stdin>\", line 2, in <module>\nbinascii.Error: Non-hexadecimal digit found\n\nThis is expected.  Notice that pure-Python modules behave the same way:\nit is a part of how Python works.\n",
            "subsections": []
        },
        "The goal is to make extension modules safe at the C level, not to make": {
            "content": "hacks behave intuitively.  Mutating 'sys.modules' \"manually\" counts as a\nhack.\n\nFile: python3.12.info,  Node: Making Modules Safe with Multiple Interpreters,  Next: Heap Types<2>,  Prev: Background<2>,  Up: Isolating Extension Modules\n\n\n* Menu:\n\n* Managing Global State::\n* Managing Per-Module State::\n* Opt-Out; Limiting to One Module Object per Process: Opt-Out Limiting to One Module Object per Process.\n* Module State Access from Functions::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Managing Global State,  Next: Managing Per-Module State,  Up: Making Modules Safe with Multiple Interpreters": {
            "content": "9.19.3.1 Managing Global State\n..............................\n",
            "subsections": []
        },
        "Sometimes, the state associated with a Python module is not specific to": {
            "content": "that module, but to the entire process (or something else \"more global\"\nthan a module).  For example:\n\n- The 'readline' module manages 'the' terminal.\n\n- A module running on a circuit board wants to control 'the' on-board\nLED.\n",
            "subsections": []
        },
        "In these cases, the Python module should provide 'access' to the global": {
            "content": "state, rather than 'own' it.  If possible, write the module so that\nmultiple copies of it can access the state independently (along with\nother libraries, whether for Python or other languages).  If that is not\npossible, consider explicit locking.\n",
            "subsections": []
        },
        "If it is necessary to use process-global state, the simplest way to": {
            "content": "avoid issues with multiple interpreters is to explicitly prevent a\nmodule from being loaded more than once per process--see *note Opt-Out;\nLimiting to One Module Object per Process: 4ddb.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "9.19.3.2 Managing Per-Module State\n..................................\n\nTo use per-module state, use *note multi-phase extension module\ninitialization: 46ff.  This signals that your module supports multiple\ninterpreters correctly.\n",
            "subsections": []
        },
        "Set 'PyModuleDef.msize' to a positive number to request that many bytes": {
            "content": "of storage local to the module.  Usually, this will be set to the size\nof some module-specific 'struct', which can store all of the module's\nC-level state.  In particular, it is where you should put pointers to\nclasses (including exceptions, but excluding static types) and settings\n(e.g.  'csv''s *note fieldsizelimit: 1564.) which the C code needs to\nfunction.\n\nNote: Another option is to store state in the module's 'dict',\nbut you must avoid crashing when users modify 'dict' from\nPython code.  This usually means error- and type-checking at the C\nlevel, which is easy to get wrong and hard to test sufficiently.\n\nHowever, if module state is not needed in C code, storing it in\n'dict' only is a good idea.\n",
            "subsections": []
        },
        "If the module state includes 'PyObject' pointers, the module object must": {
            "content": "hold references to those objects and implement the module-level hooks\n'mtraverse', 'mclear' and 'mfree'.  These work like 'tptraverse',\n'tpclear' and 'tpfree' of a class.  Adding them will require some work\nand make the code longer; this is the price for modules which can be\nunloaded cleanly.\n",
            "subsections": []
        },
        "An example of a module with per-module state is currently available as": {
            "content": "xxlimited(1); example module initialization shown at the bottom of the\nfile.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/blob/master/Modules/xxlimited.c\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "9.19.3.3 Opt-Out: Limiting to One Module Object per Process\n...........................................................\n\nA non-negative 'PyModuleDef.msize' signals that a module supports\nmultiple interpreters correctly.  If this is not yet the case for your\nmodule, you can explicitly make your module loadable only once per\nprocess.  For example:\n\nstatic int loaded = 0;\n\nstatic int\nexecmodule(PyObject* module)\n{\nif (loaded) {\nPyErrSetString(PyExcImportError,\n\"cannot load module more than once per process\");\nreturn -1;\n}\nloaded = 1;\n// ... rest of initialization\n}\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Module State Access from Functions,  Prev: Opt-Out Limiting to One Module Object per Process,  Up: Making Modules Safe with Multiple Interpreters": {
            "content": "9.19.3.4 Module State Access from Functions\n...........................................\n\nAccessing the state from module-level functions is straightforward.",
            "subsections": []
        },
        "Functions get the module object as their first argument; for extracting": {
            "content": "the state, you can use 'PyModuleGetState':\n\nstatic PyObject *\nfunc(PyObject *module, PyObject *args)\n{\nmystruct *state = (mystruct*)PyModuleGetState(module);\nif (state == NULL) {\nreturn NULL;\n}\n// ... rest of logic\n}\n\nNote: 'PyModuleGetState' may return 'NULL' without setting an\nexception if there is no module state, i.e.  'PyModuleDef.msize'\nwas zero.  In your own module, you're in control of 'msize', so\nthis is easy to prevent.\n\nFile: python3.12.info,  Node: Heap Types<2>,  Next: Open Issues,  Prev: Making Modules Safe with Multiple Interpreters,  Up: Isolating Extension Modules\n\n",
            "subsections": []
        },
        "Traditionally, types defined in C code are 'static'; that is, 'static": {
            "content": "",
            "subsections": []
        },
        "PyTypeObject' structures defined directly in code and initialized using": {
            "content": "'PyTypeReady()'.\n",
            "subsections": []
        },
        "Such types are necessarily shared across the process.  Sharing them": {
            "content": "between module objects requires paying attention to any state they own\nor access.  To limit the possible issues, static types are immutable at\nthe Python level: for example, you can't set 'str.myattribute = 123'.\n\n'CPython implementation detail:' Sharing truly immutable objects between\ninterpreters is fine, as long as they don't provide access to mutable\nobjects.  However, in CPython, every Python object has a mutable\nimplementation detail: the reference count.  Changes to the refcount are\nguarded by the GIL. Thus, code that shares any Python objects across\ninterpreters implicitly depends on CPython's current, process-wide GIL.\n",
            "subsections": []
        },
        "Because they are immutable and process-global, static types cannot": {
            "content": "access \"their\" module state.  If any method of such a type requires\naccess to module state, the type must be converted to a 'heap-allocated\ntype', or 'heap type' for short.  These correspond more closely to\nclasses created by Python's 'class' statement.\n\nFor new modules, using heap types by default is a good rule of thumb.\n\n* Menu:\n\n* Changing Static Types to Heap Types::\n* Defining Heap Types::\n* Garbage-Collection Protocol::\n* Module State Access from Classes::\n* Module State Access from Regular Methods::\n* Module State Access from Slot Methods, Getters and Setters: Module State Access from Slot Methods Getters and Setters.\n* Lifetime of the Module State::\n\nFile: python3.12.info,  Node: Changing Static Types to Heap Types,  Next: Defining Heap Types,  Up: Heap Types<2>\n\n9.19.4.1 Changing Static Types to Heap Types\n............................................\n",
            "subsections": []
        },
        "Static types can be converted to heap types, but note that the heap type": {
            "content": "API was not designed for \"lossless\" conversion from static types--that\nis, creating a type that works exactly like a given static type.  So,\nwhen rewriting the class definition in a new API, you are likely to\nunintentionally change a few details (e.g.  pickleability or inherited\nslots).  Always test the details that are important to you.\n",
            "subsections": []
        },
        "Watch out for the following two points in particular (but note that this": {
            "content": "is not a comprehensive list):\n\n* Unlike static types, heap type objects are mutable by default.  Use\nthe *note PyTPFLAGSIMMUTABLETYPE: 2b2. flag to prevent\nmutability.\n\n* Heap types inherit *note tpnew: 2e1. by default, so it may become\npossible to instantiate them from Python code.  You can prevent\nthis with the *note PyTPFLAGSDISALLOWINSTANTIATION: 2e4. flag.\n\nFile: python3.12.info,  Node: Defining Heap Types,  Next: Garbage-Collection Protocol,  Prev: Changing Static Types to Heap Types,  Up: Heap Types<2>\n\n9.19.4.2 Defining Heap Types\n............................\n\nHeap types can be created by filling a *note PyTypeSpec: 1425.\nstructure, a description or \"blueprint\" of a class, and calling *note\nPyTypeFromModuleAndSpec(): 2aa. to construct a new class object.\n\nNote: Other functions, like *note PyTypeFromSpec(): 2df, can also\ncreate heap types, but *note PyTypeFromModuleAndSpec(): 2aa.\nassociates the module with the class, allowing access to the module\nstate from methods.\n",
            "subsections": []
        },
        "The class should generally be stored in 'both' the module state (for": {
            "content": "safe access from C) and the module's 'dict' (for access from Python\ncode).\n\nFile: python3.12.info,  Node: Garbage-Collection Protocol,  Next: Module State Access from Classes,  Prev: Defining Heap Types,  Up: Heap Types<2>\n\n9.19.4.3 Garbage-Collection Protocol\n....................................\n",
            "subsections": []
        },
        "Instances of heap types hold a reference to their type.  This ensures": {
            "content": "that the type isn't destroyed before all its instances are, but may\nresult in reference cycles that need to be broken by the garbage\ncollector.\n",
            "subsections": []
        },
        "To avoid memory leaks, instances of heap types must implement the": {
            "content": "garbage collection protocol.  That is, heap types should:\n\n- Have the *note PyTPFLAGSHAVEGC: 568. flag.\n\n- Define a traverse function using 'Pytptraverse', which visits the\ntype (e.g.  using 'PyVISIT(PyTYPE(self))').\n\nPlease refer to the the documentation of *note PyTPFLAGSHAVEGC: 568.\nand *note tptraverse: 569. for additional considerations.\n",
            "subsections": []
        },
        "The API for defining heap types grew organically, leaving it somewhat": {
            "content": "awkward to use in its current state.  The following sections will guide\nyou through common issues.\n\n* Menu:\n\n* tptraverse in Python 3.8 and lower: tptraverse in Python 3 8 and lower.\n* Delegating tptraverse::\n* Defining tpdealloc::\n* Not overriding tpfree::\n* Avoiding PyObjectNew::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: tptraverse in Python 3 8 and lower,  Next: Delegating tptraverse,  Up: Garbage-Collection Protocol": {
            "content": "9.19.4.4 'tptraverse' in Python 3.8 and lower\n..............................................\n",
            "subsections": []
        },
        "The requirement to visit the type from 'tptraverse' was added in Python": {
            "content": "3.9.  If you support Python 3.8 and lower, the traverse function must\n'not' visit the type, so it must be more complicated:\n\nstatic int mytraverse(PyObject *self, visitproc visit, void *arg)\n{\nif (PyVersion >= 0x03090000) {\nPyVISIT(PyTYPE(self));\n}\nreturn 0;\n}\n\nUnfortunately, *note PyVersion: 53d. was only added in Python 3.11.  As\na replacement, use:\n\n* *note PYVERSIONHEX: 53e, if not using the stable ABI, or\n\n* *note sys.versioninfo: 46c. (via *note PySysGetObject(): 57f. and\n*note PyArgParseTuple(): 2d1.).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Delegating tptraverse,  Next: Defining tpdealloc,  Prev: tptraverse in Python 3 8 and lower,  Up: Garbage-Collection Protocol": {
            "content": "9.19.4.5 Delegating 'tptraverse'\n.................................\n\nIf your traverse function delegates to the *note tptraverse: 569. of\nits base class (or another type), ensure that 'PyTYPE(self)' is visited\nonly once.  Note that only heap type are expected to visit the type in\n'tptraverse'.\n\nFor example, if your traverse function includes:\n\nbase->tptraverse(self, visit, arg)\n\n...and 'base' may be a static type, then it should also include:\n\nif (base->tpflags & PyTPFLAGSHEAPTYPE) {\n// a heap type's tptraverse already visited PyTYPE(self)\n} else {\nif (PyVersion >= 0x03090000) {\nPyVISIT(PyTYPE(self));\n}\n}\n\nIt is not necessary to handle the type's reference count in *note\ntpnew: 2e1. and *note tpclear: 46e3.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Defining tpdealloc,  Next: Not overriding tpfree,  Prev: Delegating tptraverse,  Up: Garbage-Collection Protocol": {
            "content": "9.19.4.6 Defining 'tpdealloc'\n..............................\n\nIf your type has a custom *note tpdealloc: 46d0. function, it needs to:\n\n- call *note PyObjectGCUnTrack(): 1361. before any fields are\ninvalidated, and\n\n- decrement the reference count of the type.\n",
            "subsections": []
        },
        "To keep the type valid while 'tpfree' is called, the type's refcount": {
            "content": "needs to be decremented 'after' the instance is deallocated.  For\nexample:\n\nstatic void mydealloc(PyObject *self)\n{\nPyObjectGCUnTrack(self);\n...\nPyTypeObject *type = PyTYPE(self);\ntype->tpfree(self);\nPyDECREF(type);\n}\n",
            "subsections": []
        },
        "The default 'tpdealloc' function does this, so if your type does 'not'": {
            "content": "override 'tpdealloc' you don't need to add it.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Not overriding tpfree,  Next: Avoiding PyObjectNew,  Prev: Defining tpdealloc,  Up: Garbage-Collection Protocol": {
            "content": "9.19.4.7 Not overriding 'tpfree'\n.................................\n\nThe *note tpfree: 46d1. slot of a heap type must be set to *note\nPyObjectGCDel(): 135f.  This is the default; do not override it.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Avoiding PyObjectNew,  Prev: Not overriding tpfree,  Up: Garbage-Collection Protocol": {
            "content": "9.19.4.8 Avoiding 'PyObjectNew'\n................................\n\nGC-tracked objects need to be allocated using GC-aware functions.\n\nIf you use use *note PyObjectNew(): 7a9. or *note PyObjectNewVar():\n7aa.:\n\n- Get and call type's *note tpalloc: 46d2. slot, if possible.  That\nis, replace 'TYPE *o = PyObjectNew(TYPE, typeobj)' with:\n\nTYPE *o = typeobj->tpalloc(typeobj, 0);\n\nReplace 'o = PyObjectNewVar(TYPE, typeobj, size)' with the same,\nbut use size instead of the 0.\n\n- If the above is not possible (e.g.  inside a custom 'tpalloc'),\ncall *note PyObjectGCNew(): 8d7. or *note PyObjectGCNewVar():\n8d8.:\n\nTYPE *o = PyObjectGCNew(TYPE, typeobj);\n\nTYPE *o = PyObjectGCNewVar(TYPE, typeobj, size);\n\nFile: python3.12.info,  Node: Module State Access from Classes,  Next: Module State Access from Regular Methods,  Prev: Garbage-Collection Protocol,  Up: Heap Types<2>\n\n9.19.4.9 Module State Access from Classes\n.........................................\n\nIf you have a type object defined with *note PyTypeFromModuleAndSpec():\n2aa, you can call *note PyTypeGetModule(): 790. to get the associated\nmodule, and then *note PyModuleGetState(): 7a4. to get the module's\nstate.\n",
            "subsections": []
        },
        "To save a some tedious error-handling boilerplate code, you can combine": {
            "content": "these two steps with *note PyTypeGetModuleState(): 791, resulting in:\n\nmystruct *state = (mystruct*)PyTypeGetModuleState(type);\nif (state == NULL) {\nreturn NULL;\n}\n\nFile: python3.12.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>\n\n9.19.4.10 Module State Access from Regular Methods\n..................................................\n",
            "subsections": []
        },
        "Accessing the module-level state from methods of a class is somewhat": {
            "content": "more complicated, but is possible thanks to API introduced in Python\n3.9.  To get the state, you need to first get the 'defining class', and\nthen get the module state from it.\n",
            "subsections": []
        },
        "The largest roadblock is getting 'the class a method was defined in', or": {
            "content": "that method's \"defining class\" for short.  The defining class can have a\nreference to the module it is part of.\n",
            "subsections": []
        },
        "Do not confuse the defining class with 'PyTYPE(self)'.  If the method": {
            "content": "is called on a 'subclass' of your type, 'PyTYPE(self)' will refer to\nthat subclass, which may be defined in different module than yours.\n\nNote: The following Python code can illustrate the concept.\n'Base.getdefiningclass' returns 'Base' even if 'type(self) ==\nSub':\n\nclass Base:\ndef gettypeofself(self):\nreturn type(self)\n\ndef getdefiningclass(self):\nreturn class\n\nclass Sub(Base):\npass\n\nFor a method to get its \"defining class\", it must use the *note\nMETHMETHOD | METHFASTCALL | METHKEYWORDS: 13de. *note calling\nconvention: 1332. and the corresponding *note PyCMethod: 54f. signature:\n\nPyObject *PyCMethod(\nPyObject *self,               // object the method was called on\nPyTypeObject *definingclass, // defining class\nPyObject *const *args,        // C array of arguments\nPyssizet nargs,             // length of \"args\"\nPyObject *kwnames)            // NULL, or dict of keyword arguments\n\nOnce you have the defining class, call *note PyTypeGetModuleState():\n791. to get the state of its associated module.\n\nFor example:\n\nstatic PyObject *\nexamplemethod(PyObject *self,\nPyTypeObject *definingclass,\nPyObject *const *args,\nPyssizet nargs,\nPyObject *kwnames)\n{\nmystruct *state = (mystruct*)PyTypeGetModuleState(definingclass);\nif (state == NULL) {\nreturn NULL;\n}\n... // rest of logic\n}\n\nPyDocSTRVAR(examplemethoddoc, \"...\");\n\nstatic PyMethodDef mymethods[] = {\n{\"examplemethod\",\n(PyCFunction)(void(*)(void))examplemethod,\nMETHMETHOD|METHFASTCALL|METHKEYWORDS,\nexamplemethoddoc}\n{NULL},\n}\n\nFile: python3.12.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>\n\n9.19.4.11 Module State Access from Slot Methods, Getters and Setters\n....................................................................\n\nNote: This is new in Python 3.11.\n\nSlot methods--the fast C equivalents for special methods, such as *note\nnbadd: 49aa. for *note add: 1c93. or *note tpnew: 2e1. for\ninitialization--have a very simple API that doesn't allow passing in the\ndefining class, unlike with *note PyCMethod: 54f.  The same goes for\ngetters and setters defined with *note PyGetSetDef: 9fc.\n\nTo access the module state in these cases, use the *note",
            "subsections": []
        },
        "PyTypeGetModuleByDef(): 54e. function, and pass in the module": {
            "content": "definition.  Once you have the module, call *note PyModuleGetState():\n7a4. to get the state:\n\nPyObject *module = PyTypeGetModuleByDef(PyTYPE(self), &moduledef);\nmystruct *state = (mystruct*)PyModuleGetState(module);\nif (state == NULL) {\nreturn NULL;\n}\n\n'PyTypeGetModuleByDef()' works by searching the *note method resolution\norder: 1e8b. (i.e.  all superclasses) for the first superclass that has\na corresponding module.\n\nNote: In very exotic cases (inheritance chains spanning multiple\nmodules created from the same definition),\n'PyTypeGetModuleByDef()' might not return the module of the true\ndefining class.  However, it will always return a module with the\nsame definition, ensuring a compatible C memory layout.\n\nFile: python3.12.info,  Node: Lifetime of the Module State,  Prev: Module State Access from Slot Methods Getters and Setters,  Up: Heap Types<2>\n\n9.19.4.12 Lifetime of the Module State\n......................................\n\nWhen a module object is garbage-collected, its module state is freed.",
            "subsections": []
        },
        "For each pointer to (a part of) the module state, you must hold a": {
            "content": "reference to the module object.\n\nUsually this is not an issue, because types created with *note",
            "subsections": []
        },
        "PyTypeFromModuleAndSpec(): 2aa, and their instances, hold a reference": {
            "content": "to the module.  However, you must be careful in reference counting when\nyou reference module state from other places, such as callbacks for\nexternal libraries.\n\nFile: python3.12.info,  Node: Open Issues,  Prev: Heap Types<2>,  Up: Isolating Extension Modules\n\n\nSeveral issues around per-module state and heap types are still open.\n",
            "subsections": []
        },
        "Discussions about improving the situation are best held on the capi-sig": {
            "content": "mailing list(1).\n\n* Menu:\n\n* Per-Class Scope::\n* Lossless Conversion to Heap Types::\n\n---------- Footnotes ----------\n\n(1) https://mail.python.org/mailman3/lists/capi-sig.python.org/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Per-Class Scope,  Next: Lossless Conversion to Heap Types,  Up: Open Issues": {
            "content": "9.19.5.1 Per-Class Scope\n........................\n",
            "subsections": []
        },
        "It is currently (as of Python 3.11) not possible to attach state to": {
            "content": "individual 'types' without relying on CPython implementation details\n(which may change in the future--perhaps, ironically, to allow a proper\nsolution for per-class scope).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Lossless Conversion to Heap Types,  Prev: Per-Class Scope,  Up: Open Issues": {
            "content": "9.19.5.2 Lossless Conversion to Heap Types\n..........................................\n\nThe heap type API was not designed for \"lossless\" conversion from static\ntypes; that is, creating a type that works exactly like a given static\ntype.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python Frequently Asked Questions,  Next: Glossary,  Prev: Python HOWTOs,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "10 Python Frequently Asked Questions": {
            "content": "* Menu:\n\n* General Python FAQ::\n* Programming FAQ::\n* Design and History FAQ::\n* Library and Extension FAQ::\n* Extending/Embedding FAQ::\n* Python on Windows FAQ::\n* Graphic User Interface FAQ::\n* \"Why is Python Installed on my Computer?\" FAQ::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: General Python FAQ,  Next: Programming FAQ,  Up: Python Frequently Asked Questions": {
            "content": "",
            "subsections": [
                {
                    "name": "10.1 General Python FAQ",
                    "content": "* Menu:\n\n* General Information::\n* Python in the real world::\n"
                }
            ]
        },
        "File: python3.12.info,  Node: General Information,  Next: Python in the real world,  Up: General Python FAQ": {
            "content": "* Menu:\n\n* What is Python?::\n* What is the Python Software Foundation?::\n* Are there copyright restrictions on the use of Python?::\n* Why was Python created in the first place?::\n* What is Python good for?::\n* How does the Python version numbering scheme work?::\n* How do I obtain a copy of the Python source?::\n* How do I get documentation on Python?::\n* I've never programmed before. Is there a Python tutorial?: I've never programmed before Is there a Python tutorial?.\n* Is there a newsgroup or mailing list devoted to Python?::\n* How do I get a beta test version of Python?::\n* How do I submit bug reports and patches for Python?::\n* Are there any published articles about Python that I can reference?::\n* Are there any books on Python?::\n* Where in the world is www.python.org located?: Where in the world is www python org located?.\n* Why is it called Python?::\n* Do I have to like \"Monty Python's Flying Circus\"?::\n\nFile: python3.12.info,  Node: What is Python?,  Next: What is the Python Software Foundation?,  Up: General Information\n\n10.1.1.1 What is Python?\n........................\n",
            "subsections": []
        },
        "Python is an interpreted, interactive, object-oriented programming": {
            "content": "language.  It incorporates modules, exceptions, dynamic typing, very\nhigh level dynamic data types, and classes.  It supports multiple\nprogramming paradigms beyond object-oriented programming, such as\nprocedural and functional programming.  Python combines remarkable power\nwith very clear syntax.  It has interfaces to many system calls and\nlibraries, as well as to various window systems, and is extensible in C\nor C++.  It is also usable as an extension language for applications\nthat need a programmable interface.  Finally, Python is portable: it\nruns on many Unix variants including Linux and macOS, and on Windows.\n\nTo find out more, start with *note The Python Tutorial: 195d.  The",
            "subsections": []
        },
        "Beginner's Guide to Python(1) links to other introductory tutorials and": {
            "content": "resources for learning Python.\n\n---------- Footnotes ----------\n\n(1) https://wiki.python.org/moin/BeginnersGuide\n\nFile: python3.12.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\n\n10.1.1.2 What is the Python Software Foundation?\n................................................\n",
            "subsections": []
        },
        "The Python Software Foundation is an independent non-profit organization": {
            "content": "that holds the copyright on Python versions 2.1 and newer.  The PSF's\nmission is to advance open source technology related to the Python\nprogramming language and to publicize the use of Python.  The PSF's home\npage is at 'https://www.python.org/psf/'.\n",
            "subsections": []
        },
        "Donations to the PSF are tax-exempt in the US. If you use Python and": {
            "content": "find it helpful, please contribute via the PSF donation page(1).\n\n---------- Footnotes ----------\n\n(1) https://www.python.org/psf/donations/\n\nFile: python3.12.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\n\n10.1.1.3 Are there copyright restrictions on the use of Python?\n...............................................................\n",
            "subsections": []
        },
        "You can do anything you want with the source, as long as you leave the": {
            "content": "copyrights in and display those copyrights in any documentation about",
            "subsections": []
        },
        "Python that you produce.  If you honor the copyright rules, it's OK to": {
            "content": "use Python for commercial use, to sell copies of Python in source or\nbinary form (modified or unmodified), or to sell products that\nincorporate Python in some form.  We would still like to know about all\ncommercial use of Python, of course.\n",
            "subsections": []
        },
        "See the license page(1) to find further explanations and the full text": {
            "content": "of the PSF License.\n",
            "subsections": []
        },
        "The Python logo is trademarked, and in certain cases permission is": {
            "content": "required to use it.  Consult the Trademark Usage Policy(2) for more\ninformation.\n\n---------- Footnotes ----------\n\n(1) https://docs.python.org/3/license.html\n\n(2) https://www.python.org/psf/trademarks/\n\nFile: python3.12.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\n\n10.1.1.4 Why was Python created in the first place?\n...................................................\n",
            "subsections": []
        },
        "Here's a 'very' brief summary of what started it all, written by Guido": {
            "content": "van Rossum:\n\nI had extensive experience with implementing an interpreted\nlanguage in the ABC group at CWI, and from working with this group\nI had learned a lot about language design.  This is the origin of\nmany Python features, including the use of indentation for\nstatement grouping and the inclusion of very-high-level data types\n(although the details are all different in Python).\n\nI had a number of gripes about the ABC language, but also liked\nmany of its features.  It was impossible to extend the ABC language\n(or its implementation) to remedy my complaints - in fact its lack\nof extensibility was one of its biggest problems.  I had some\nexperience with using Modula-2+ and talked with the designers of\nModula-3 and read the Modula-3 report.  Modula-3 is the origin of\nthe syntax and semantics used for exceptions, and some other Python\nfeatures.\n\nI was working in the Amoeba distributed operating system group at\nCWI. We needed a better way to do system administration than by\nwriting either C programs or Bourne shell scripts, since Amoeba had\nits own system call interface which wasn't easily accessible from\nthe Bourne shell.  My experience with error handling in Amoeba made\nme acutely aware of the importance of exceptions as a programming\nlanguage feature.\n\nIt occurred to me that a scripting language with a syntax like ABC\nbut with access to the Amoeba system calls would fill the need.  I\nrealized that it would be foolish to write an Amoeba-specific\nlanguage, so I decided that I needed a language that was generally\nextensible.\n\nDuring the 1989 Christmas holidays, I had a lot of time on my hand,\nso I decided to give it a try.  During the next year, while still\nmostly working on it in my own time, Python was used in the Amoeba\nproject with increasing success, and the feedback from colleagues\nmade me add many early improvements.\n\nIn February 1991, after just over a year of development, I decided\nto post to USENET. The rest is in the 'Misc/HISTORY' file.\n\nFile: python3.12.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\n\n10.1.1.5 What is Python good for?\n.................................\n",
            "subsections": []
        },
        "Python is a high-level general-purpose programming language that can be": {
            "content": "applied to many different classes of problems.\n",
            "subsections": []
        },
        "The language comes with a large standard library that covers areas such": {
            "content": "as string processing (regular expressions, Unicode, calculating\ndifferences between files), internet protocols (HTTP, FTP, SMTP,\nXML-RPC, POP, IMAP), software engineering (unit testing, logging,\nprofiling, parsing Python code), and operating system interfaces (system\ncalls, filesystems, TCP/IP sockets).  Look at the table of contents for\n*note The Python Standard Library: 13d. to get an idea of what's\navailable.  A wide variety of third-party extensions are also available.\nConsult the Python Package Index(1) to find packages of interest to you.\n\n---------- Footnotes ----------\n\n(1) https://pypi.org\n\nFile: python3.12.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\n\n10.1.1.6 How does the Python version numbering scheme work?\n...........................................................\n\nPython versions are numbered \"A.B.C\" or \"A.B\":\n\n* 'A' is the major version number - it is only incremented for really\nmajor changes in the language.\n\n* 'B' is the minor version number - it is incremented for less\nearth-shattering changes.\n\n* 'C' is the micro version number - it is incremented for each bugfix\nrelease.\n",
            "subsections": []
        },
        "Not all releases are bugfix releases.  In the run-up to a new feature": {
            "content": "release, a series of development releases are made, denoted as alpha,\nbeta, or release candidate.  Alphas are early releases in which\ninterfaces aren't yet finalized; it's not unexpected to see an interface\nchange between two alpha releases.  Betas are more stable, preserving\nexisting interfaces but possibly adding new modules, and release\ncandidates are frozen, making no changes except as needed to fix\ncritical bugs.\n\nAlpha, beta and release candidate versions have an additional suffix:\n\n* The suffix for an alpha version is \"aN\" for some small number 'N'.\n\n* The suffix for a beta version is \"bN\" for some small number 'N'.\n\n* The suffix for a release candidate version is \"rcN\" for some small\nnumber 'N'.\n",
            "subsections": []
        },
        "In other words, all versions labeled '2.0aN' precede the versions": {
            "content": "labeled '2.0bN', which precede versions labeled '2.0rcN', and 'those'\nprecede 2.0.\n\nYou may also find version numbers with a \"+\" suffix, e.g.  \"2.2+\".",
            "subsections": []
        },
        "These are unreleased versions, built directly from the CPython": {
            "content": "development repository.  In practice, after a final minor release is\nmade, the version is incremented to the next minor version, which\nbecomes the \"a0\" version, e.g.  \"2.4a0\".\n",
            "subsections": []
        },
        "See the Developer's Guide(1) for more information about the development": {
            "content": "cycle, and PEP 387(2) to learn more about Python's backward\ncompatibility policy.  See also the documentation for *note sys.version:\nb70, *note sys.hexversion: 401c, and *note sys.versioninfo: 46c.\n\n---------- Footnotes ----------\n\n(1) https://devguide.python.org/developer-workflow/development-cycle/\n\n(2) https://peps.python.org/pep-0387/\n\nFile: python3.12.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\n\n10.1.1.7 How do I obtain a copy of the Python source?\n.....................................................\n",
            "subsections": []
        },
        "The latest Python source distribution is always available from": {
            "content": "python.org, at 'https://www.python.org/downloads/'.  The latest\ndevelopment sources can be obtained at\n'https://github.com/python/cpython/'.\n",
            "subsections": []
        },
        "The source distribution is a gzipped tar file containing the complete C": {
            "content": "source, Sphinx-formatted documentation, Python library modules, example\nprograms, and several useful pieces of freely distributable software.\nThe source will compile and run out of the box on most UNIX platforms.\n",
            "subsections": []
        },
        "Consult the Getting Started section of the Python Developer's Guide(1)": {
            "content": "for more information on getting the source code and compiling it.\n\n---------- Footnotes ----------\n\n(1) https://devguide.python.org/setup/\n\nFile: python3.12.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\n\n10.1.1.8 How do I get documentation on Python?\n..............................................\n",
            "subsections": []
        },
        "The standard documentation for the current stable version of Python is": {
            "content": "available at 'https://docs.python.org/3/'.  PDF, plain text, and\ndownloadable HTML versions are also available at\n'https://docs.python.org/3/download.html'.\n",
            "subsections": []
        },
        "The documentation is written in reStructuredText and processed by the": {
            "content": "",
            "subsections": []
        },
        "Sphinx documentation tool(1).  The reStructuredText source for the": {
            "content": "documentation is part of the Python source distribution.\n\n---------- Footnotes ----------\n\n(1) https://www.sphinx-doc.org/\n\nFile: python3.12.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\n\n10.1.1.9 I've never programmed before. Is there a Python tutorial?\n..................................................................\n",
            "subsections": []
        },
        "There are numerous tutorials and books available.  The standard": {
            "content": "documentation includes *note The Python Tutorial: 195d.\n",
            "subsections": []
        },
        "Consult the Beginner's Guide(1) to find information for beginning Python": {
            "content": "programmers, including lists of tutorials.\n\n---------- Footnotes ----------\n\n(1) https://wiki.python.org/moin/BeginnersGuide\n\nFile: python3.12.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\n\n10.1.1.10 Is there a newsgroup or mailing list devoted to Python?\n.................................................................\n",
            "subsections": []
        },
        "There is a newsgroup, 'comp.lang.python', and a mailing list,": {
            "content": "python-list(1).  The newsgroup and mailing list are gatewayed into each\nother - if you can read news it's unnecessary to subscribe to the\nmailing list.  'comp.lang.python' is high-traffic, receiving hundreds of\npostings every day, and Usenet readers are often more able to cope with\nthis volume.\n",
            "subsections": []
        },
        "Announcements of new software releases and events can be found in": {
            "content": "comp.lang.python.announce, a low-traffic moderated list that receives\nabout five postings per day.  It's available as the python-announce\nmailing list(2).\n",
            "subsections": []
        },
        "More info about other mailing lists and newsgroups can be found at": {
            "content": "'https://www.python.org/community/lists/'.\n\n---------- Footnotes ----------\n\n(1) https://mail.python.org/mailman/listinfo/python-list\n\n(2)\nhttps://mail.python.org/mailman3/lists/python-announce-list.python.org/\n\nFile: python3.12.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\n\n10.1.1.11 How do I get a beta test version of Python?\n.....................................................\n",
            "subsections": []
        },
        "Alpha and beta releases are available from": {
            "content": "'https://www.python.org/downloads/'.  All releases are announced on the\ncomp.lang.python and comp.lang.python.announce newsgroups and on the",
            "subsections": []
        },
        "Python home page at 'https://www.python.org/'; an RSS feed of news is": {
            "content": "available.\n",
            "subsections": []
        },
        "You can also access the development version of Python through Git.  See": {
            "content": "The Python Developer's Guide(1) for details.\n\n---------- Footnotes ----------\n\n(1) https://devguide.python.org/\n\nFile: python3.12.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\n\n10.1.1.12 How do I submit bug reports and patches for Python?\n.............................................................\n",
            "subsections": []
        },
        "To report a bug or submit a patch, use the issue tracker at": {
            "content": "'https://github.com/python/cpython/issues'.\n",
            "subsections": []
        },
        "For more information on how Python is developed, consult the Python": {
            "content": "Developer's Guide(1).\n\n---------- Footnotes ----------\n\n(1) https://devguide.python.org/\n\nFile: python3.12.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\n\n10.1.1.13 Are there any published articles about Python that I can reference?\n.............................................................................\n\nIt's probably best to cite your favorite book about Python.\n",
            "subsections": []
        },
        "The very first article(1) about Python was written in 1991 and is now": {
            "content": "quite outdated.\n\nGuido van Rossum and Jelke de Boer, \"Interactively Testing Remote\nServers Using the Python Programming Language\", CWI Quarterly,\nVolume 4, Issue 4 (December 1991), Amsterdam, pp 283-303.\n\n---------- Footnotes ----------\n\n(1) https://ir.cwi.nl/pub/18204\n\nFile: python3.12.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\n\n10.1.1.14 Are there any books on Python?\n........................................\n",
            "subsections": []
        },
        "Yes, there are many, and more are being published.  See the python.org": {
            "content": "wiki at 'https://wiki.python.org/moin/PythonBooks' for a list.\n\nYou can also search online bookstores for \"Python\" and filter out the\nMonty Python references; or perhaps search for \"Python\" and \"language\".\n\nFile: python3.12.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\n\n10.1.1.15 Where in the world is www.python.org located?\n.......................................................\n",
            "subsections": []
        },
        "The Python project's infrastructure is located all over the world and is": {
            "content": "managed by the Python Infrastructure Team.  Details here(1).\n\n---------- Footnotes ----------\n\n(1) https://infra.psf.io\n\nFile: python3.12.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\n\n10.1.1.16 Why is it called Python?\n..................................\n",
            "subsections": []
        },
        "When he began implementing Python, Guido van Rossum was also reading the": {
            "content": "published scripts from \"Monty Python's Flying Circus\"(1), a BBC comedy\nseries from the 1970s.  Van Rossum thought he needed a name that was\nshort, unique, and slightly mysterious, so he decided to call the\nlanguage Python.\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/MontyPython\n\nFile: python3.12.info,  Node: Do I have to like \"Monty Python's Flying Circus\"?,  Prev: Why is it called Python?,  Up: General Information\n\n10.1.1.17 Do I have to like \"Monty Python's Flying Circus\"?\n...........................................................\n",
            "subsections": []
        },
        "No, but it helps.  :)": {
            "content": "",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python in the real world,  Prev: General Information,  Up: General Python FAQ": {
            "content": "* Menu:\n\n* How stable is Python?::\n* How many people are using Python?::\n* Have any significant projects been done in Python?::\n* What new developments are expected for Python in the future?::\n* Is it reasonable to propose incompatible changes to Python?::\n* Is Python a good language for beginning programmers?::\n\nFile: python3.12.info,  Node: How stable is Python?,  Next: How many people are using Python?,  Up: Python in the real world\n\n10.1.2.1 How stable is Python?\n..............................\n",
            "subsections": []
        },
        "Very stable.  New, stable releases have been coming out roughly every 6": {
            "content": "to 18 months since 1991, and this seems likely to continue.  As of\nversion 3.9, Python will have a new feature release every 12 months (\nPEP 602(1)).\n",
            "subsections": []
        },
        "The developers issue bugfix releases of older versions, so the stability": {
            "content": "of existing releases gradually improves.  Bugfix releases, indicated by\na third component of the version number (e.g.  3.5.3, 3.6.2), are\nmanaged for stability; only fixes for known problems are included in a\nbugfix release, and it's guaranteed that interfaces will remain the same\nthroughout a series of bugfix releases.\n",
            "subsections": []
        },
        "The latest stable releases can always be found on the Python download": {
            "content": "page(2).  There are two production-ready versions of Python: 2.x and\n3.x.  The recommended version is 3.x, which is supported by most widely\nused libraries.  Although 2.x is still widely used, it is not maintained\nanymore(3).\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0602/\n\n(2) https://www.python.org/downloads/\n\n(3) https://peps.python.org/pep-0373/\n\nFile: python3.12.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\n\n10.1.2.2 How many people are using Python?\n..........................................\n",
            "subsections": []
        },
        "There are probably millions of users, though it's difficult to obtain an": {
            "content": "exact count.\n",
            "subsections": []
        },
        "Python is available for free download, so there are no sales figures,": {
            "content": "and it's available from many different sites and packaged with many",
            "subsections": []
        },
        "Linux distributions, so download statistics don't tell the whole story": {
            "content": "either.\n",
            "subsections": []
        },
        "The comp.lang.python newsgroup is very active, but not all Python users": {
            "content": "post to the group or even read it.\n\nFile: python3.12.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\n\n10.1.2.3 Have any significant projects been done in Python?\n...........................................................\n",
            "subsections": []
        },
        "See 'https://www.python.org/about/success' for a list of projects that": {
            "content": "use Python.  Consulting the proceedings for past Python conferences(1)\nwill reveal contributions from many different companies and\norganizations.\n",
            "subsections": []
        },
        "High-profile Python projects include the Mailman mailing list manager(2)": {
            "content": "and the Zope application server(3).  Several Linux distributions, most\nnotably Red Hat(4), have written part or all of their installer and\nsystem administration software in Python.  Companies that use Python\ninternally include Google, Yahoo, and Lucasfilm Ltd.\n\n---------- Footnotes ----------\n\n(1) https://www.python.org/community/workshops/\n\n(2) https://www.list.org\n\n(3) https://www.zope.dev\n\n(4) https://www.redhat.com\n\nFile: python3.12.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\n\n10.1.2.4 What new developments are expected for Python in the future?\n.....................................................................\n",
            "subsections": []
        },
        "See 'https://peps.python.org/' for the Python Enhancement Proposals": {
            "content": "(PEPs).  PEPs are design documents describing a suggested new feature\nfor Python, providing a concise technical specification and a rationale.\nLook for a PEP titled \"Python X.Y Release Schedule\", where X.Y is a\nversion that hasn't been publicly released yet.\n\nNew development is discussed on the python-dev mailing list(1).\n\n---------- Footnotes ----------\n\n(1) https://mail.python.org/mailman3/lists/python-dev.python.org/\n\nFile: python3.12.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\n\n10.1.2.5 Is it reasonable to propose incompatible changes to Python?\n....................................................................\n",
            "subsections": []
        },
        "In general, no.  There are already millions of lines of Python code": {
            "content": "around the world, so any change in the language that invalidates more\nthan a very small fraction of existing programs has to be frowned upon.",
            "subsections": []
        },
        "Even if you can provide a conversion program, there's still the problem": {
            "content": "of updating all documentation; many books have been written about\nPython, and we don't want to invalidate them all at a single stroke.\n",
            "subsections": []
        },
        "Providing a gradual upgrade path is necessary if a feature has to be": {
            "content": "changed.  PEP 5(1) describes the procedure followed for introducing\nbackward-incompatible changes while minimizing disruption for users.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0005/\n\nFile: python3.12.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\n\n10.1.2.6 Is Python a good language for beginning programmers?\n.............................................................\n\nYes.\n",
            "subsections": []
        },
        "It is still common to start students with a procedural and statically": {
            "content": "typed language such as Pascal, C, or a subset of C++ or Java.  Students\nmay be better served by learning Python as their first language.  Python\nhas a very simple and consistent syntax and a large standard library\nand, most importantly, using Python in a beginning programming course\nlets students concentrate on important programming skills such as\nproblem decomposition and data type design.  With Python, students can\nbe quickly introduced to basic concepts such as loops and procedures.",
            "subsections": []
        },
        "They can probably even work with user-defined objects in their very": {
            "content": "first course.\n",
            "subsections": []
        },
        "For a student who has never programmed before, using a statically typed": {
            "content": "language seems unnatural.  It presents additional complexity that the\nstudent must master and slows the pace of the course.  The students are\ntrying to learn to think like a computer, decompose problems, design\nconsistent interfaces, and encapsulate data.  While learning to use a\nstatically typed language is important in the long term, it is not\nnecessarily the best topic to address in the students' first programming\ncourse.\n",
            "subsections": []
        },
        "Many other aspects of Python make it a good first language.  Like Java,": {
            "content": "",
            "subsections": []
        },
        "Python has a large standard library so that students can be assigned": {
            "content": "programming projects very early in the course that 'do' something.",
            "subsections": []
        },
        "Assignments aren't restricted to the standard four-function calculator": {
            "content": "and check balancing programs.  By using the standard library, students\ncan gain the satisfaction of working on realistic applications as they\nlearn the fundamentals of programming.  Using the standard library also\nteaches students about code reuse.  Third-party modules such as PyGame\nare also helpful in extending the students' reach.\n",
            "subsections": []
        },
        "Python's interactive interpreter enables students to test language": {
            "content": "features while they're programming.  They can keep a window with the\ninterpreter running while they enter their program's source in another\nwindow.  If they can't remember the methods for a list, they can do\nsomething like this:\n\n>>> L = []\n>>> dir(L)\n['add', 'class', 'contains', 'delattr', 'delitem',\n'dir', 'doc', 'eq', 'format', 'ge',\n'getattribute', 'getitem', 'gt', 'hash', 'iadd',\n'imul', 'init', 'iter', 'le', 'len', 'lt',\n'mul', 'ne', 'new', 'reduce', 'reduceex',\n'repr', 'reversed', 'rmul', 'setattr', 'setitem',\n'sizeof', 'str', 'subclasshook', 'append', 'clear',\n'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove',\n'reverse', 'sort']\n>>> [d for d in dir(L) if '' not in d]\n['append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']\n\n>>> help(L.append)\nHelp on built-in function append:\n\nappend(...)\nL.append(object) -> None -- append object to end\n\n>>> L.append(1)\n>>> L\n[1]\n",
            "subsections": []
        },
        "With the interpreter, documentation is never far from the student as": {
            "content": "they are programming.\n",
            "subsections": []
        },
        "There are also good IDEs for Python.  IDLE is a cross-platform IDE for": {
            "content": "",
            "subsections": []
        },
        "Python that is written in Python using Tkinter.  Emacs users will be": {
            "content": "happy to know that there is a very good Python mode for Emacs.  All of\nthese programming environments provide syntax highlighting,\nauto-indenting, and access to the interactive interpreter while coding.",
            "subsections": []
        },
        "Consult the Python wiki(1) for a full list of Python editing": {
            "content": "environments.\n",
            "subsections": []
        },
        "If you want to discuss Python's use in education, you may be interested": {
            "content": "in joining the edu-sig mailing list(2).\n\n---------- Footnotes ----------\n\n(1) https://wiki.python.org/moin/PythonEditors\n\n(2) https://www.python.org/community/sigs/current/edu-sig\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Programming FAQ,  Next: Design and History FAQ,  Prev: General Python FAQ,  Up: Python Frequently Asked Questions": {
            "content": "",
            "subsections": [
                {
                    "name": "10.2 Programming FAQ",
                    "content": "* Menu:\n\n* General Questions::\n* Core Language::\n* Numbers and strings::\n* Performance: Performance<4>.\n* Sequences (Tuples/Lists): Sequences Tuples/Lists.\n* Objects::\n* Modules: Modules<5>.\n"
                }
            ]
        },
        "File: python3.12.info,  Node: General Questions,  Next: Core Language,  Up: Programming FAQ": {
            "content": "* Menu:\n\n* Is there a source code level debugger with breakpoints, single-stepping, etc.?: Is there a source code level debugger with breakpoints single-stepping etc ?.\n* Are there tools to help find bugs or perform static analysis?::\n* How can I create a stand-alone binary from a Python script?::\n* Are there coding standards or a style guide for Python programs?::\n\nFile: python3.12.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\n\n10.2.1.1 Is there a source code level debugger with breakpoints, single-stepping, etc.?\n.......................................................................................\n\nYes.\n",
            "subsections": []
        },
        "Several debuggers for Python are described below, and the built-in": {
            "content": "function *note breakpoint(): 8f9. allows you to drop into any of them.\n",
            "subsections": []
        },
        "The pdb module is a simple but adequate console-mode debugger for": {
            "content": "Python.  It is part of the standard Python library, and is *note\ndocumented in the Library Reference Manual: a0.  You can also write your\nown debugger by using the code for pdb as an example.\n",
            "subsections": []
        },
        "The IDLE interactive development environment, which is part of the": {
            "content": "standard Python distribution (normally available as\nTools/scripts/idle3(1)), includes a graphical debugger.\n\nPythonWin is a Python IDE that includes a GUI debugger based on pdb.",
            "subsections": []
        },
        "The PythonWin debugger colors breakpoints and has quite a few cool": {
            "content": "features such as debugging non-PythonWin programs.  PythonWin is\navailable as part of pywin32(2) project and as a part of the\nActivePython(3) distribution.\n\nEric(4) is an IDE built on PyQt and the Scintilla editing component.\n\ntrepan3k(5) is a gdb-like debugger.\n",
            "subsections": []
        },
        "Visual Studio Code(6) is an IDE with debugging tools that integrates": {
            "content": "with version-control software.\n",
            "subsections": []
        },
        "There are a number of commercial Python IDEs that include graphical": {
            "content": "debuggers.  They include:\n\n* Wing IDE(7)\n\n* Komodo IDE(8)\n\n* PyCharm(9)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/blob/main/Tools/scripts/idle3\n\n(2) https://github.com/mhammond/pywin32\n\n(3) https://www.activestate.com/products/python/\n\n(4) https://eric-ide.python-projects.org/\n\n(5) https://github.com/rocky/python3-trepan/\n\n(6) https://code.visualstudio.com/\n\n(7) https://wingware.com/\n\n(8) https://www.activestate.com/products/komodo-ide/\n\n(9) https://www.jetbrains.com/pycharm/\n\nFile: python3.12.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\n\n10.2.1.2 Are there tools to help find bugs or perform static analysis?\n......................................................................\n\nYes.\n",
            "subsections": []
        },
        "Pylint(1) and Pyflakes(2) do basic checking that will help you catch": {
            "content": "bugs sooner.\n",
            "subsections": []
        },
        "Static type checkers such as Mypy(3), Pyre(4), and Pytype(5) can check": {
            "content": "type hints in Python source code.\n\n---------- Footnotes ----------\n\n(1) https://pylint.pycqa.org/en/latest/index.html\n\n(2) https://github.com/PyCQA/pyflakes\n\n(3) https://mypy-lang.org/\n\n(4) https://pyre-check.org/\n\n(5) https://github.com/google/pytype\n\nFile: python3.12.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\n\n10.2.1.3 How can I create a stand-alone binary from a Python script?\n....................................................................\n",
            "subsections": []
        },
        "You don't need the ability to compile Python to C code if all you want": {
            "content": "is a stand-alone program that users can download and run without having\nto install the Python distribution first.  There are a number of tools\nthat determine the set of modules required by a program and bind these\nmodules together with a Python binary to produce a single executable.\n",
            "subsections": []
        },
        "One is to use the freeze tool, which is included in the Python source": {
            "content": "tree as Tools/freeze(1).  It converts Python byte code to C arrays; with\na C compiler you can embed all your modules into a new program, which is\nthen linked with the standard Python modules.\n",
            "subsections": []
        },
        "It works by scanning your source recursively for import statements (in": {
            "content": "both forms) and looking for the modules in the standard Python path as\nwell as in the source directory (for built-in modules).  It then turns\nthe bytecode for modules written in Python into C code (array\ninitializers that can be turned into code objects using the marshal\nmodule) and creates a custom-made config file that only contains those\nbuilt-in modules which are actually used in the program.  It then\ncompiles the generated C code and links it with the rest of the Python\ninterpreter to form a self-contained binary which acts exactly like your\nscript.\n",
            "subsections": []
        },
        "The following packages can help with the creation of console and GUI": {
            "content": "executables:\n\n* Nuitka(2) (Cross-platform)\n\n* PyInstaller(3) (Cross-platform)\n\n* PyOxidizer(4) (Cross-platform)\n\n* cxFreeze(5) (Cross-platform)\n\n* py2app(6) (macOS only)\n\n* py2exe(7) (Windows only)\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/main/Tools/freeze\n\n(2) https://nuitka.net/\n\n(3) https://pyinstaller.org/\n\n(4) https://pyoxidizer.readthedocs.io/en/stable/\n\n(5) https://marcelotduarte.github.io/cxFreeze/\n\n(6) https://github.com/ronaldoussoren/py2app\n\n(7) https://www.py2exe.org/\n\nFile: python3.12.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\n\n10.2.1.4 Are there coding standards or a style guide for Python programs?\n.........................................................................\n",
            "subsections": []
        },
        "Yes.  The coding style required for standard library modules is": {
            "content": "documented as PEP 8(1).\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0008/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Core Language,  Next: Numbers and strings,  Prev: General Questions,  Up: Programming FAQ": {
            "content": "* Menu:\n\n* Why am I getting an UnboundLocalError when the variable has a value?::\n* What are the rules for local and global variables in Python?::\n* Why do lambdas defined in a loop with different values all return the same result?::\n* How do I share global variables across modules?::\n* What are the \"best practices\" for using import in a module?::\n* Why are default values shared between objects?::\n* How can I pass optional or keyword parameters from one function to another?::\n* What is the difference between arguments and parameters?::\n* Why did changing list 'y' also change list 'x'?::\n* How do I write a function with output parameters (call by reference)?: How do I write a function with output parameters call by reference ?.\n* How do you make a higher order function in Python?::\n* How do I copy an object in Python?::\n* How can I find the methods or attributes of an object?::\n* How can my code discover the name of an object?::\n* What's up with the comma operator's precedence?::\n* Is there an equivalent of C's \"?;\" ternary operator?: Is there an equivalent of C's \"? \" ternary operator?.\n* Is it possible to write obfuscated one-liners in Python?::\n* What does the slash(/) in the parameter list of a function mean?: What does the slash / in the parameter list of a function mean?.\n\nFile: python3.12.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\n\n10.2.2.1 Why am I getting an UnboundLocalError when the variable has a value?\n.............................................................................\n\nIt can be a surprise to get the *note UnboundLocalError: 1390. in\npreviously working code when it is modified by adding an assignment\nstatement somewhere in the body of a function.\n\nThis code:\n\n>>> x = 10\n>>> def bar():\n...     print(x)\n...\n>>> bar()\n10\n\nworks, but this code:\n\n>>> x = 10\n>>> def foo():\n...     print(x)\n...     x += 1\n\nresults in an 'UnboundLocalError':\n\n>>> foo()\nTraceback (most recent call last):\n...\nUnboundLocalError: local variable 'x' referenced before assignment\n",
            "subsections": []
        },
        "This is because when you make an assignment to a variable in a scope,": {
            "content": "that variable becomes local to that scope and shadows any similarly\nnamed variable in the outer scope.  Since the last statement in foo\nassigns a new value to 'x', the compiler recognizes it as a local\nvariable.  Consequently when the earlier 'print(x)' attempts to print\nthe uninitialized local variable and an error results.\n",
            "subsections": []
        },
        "In the example above you can access the outer scope variable by": {
            "content": "declaring it global:\n\n>>> x = 10\n>>> def foobar():\n...     global x\n...     print(x)\n...     x += 1\n...\n>>> foobar()\n10\n",
            "subsections": []
        },
        "This explicit declaration is required in order to remind you that": {
            "content": "(unlike the superficially analogous situation with class and instance\nvariables) you are actually modifying the value of the variable in the\nouter scope:\n\n>>> print(x)\n11\n\nYou can do a similar thing in a nested scope using the *note nonlocal:\n111f. keyword:\n\n>>> def foo():\n...    x = 10\n...    def bar():\n...        nonlocal x\n...        print(x)\n...        x += 1\n...    bar()\n...    print(x)\n...\n>>> foo()\n10\n11\n\nFile: python3.12.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\n\n10.2.2.2 What are the rules for local and global variables in Python?\n.....................................................................\n",
            "subsections": []
        },
        "In Python, variables that are only referenced inside a function are": {
            "content": "implicitly global.  If a variable is assigned a value anywhere within\nthe function's body, it's assumed to be a local unless explicitly\ndeclared as global.\n",
            "subsections": []
        },
        "Though a bit surprising at first, a moment's consideration explains": {
            "content": "this.  On one hand, requiring *note global: 19a3. for assigned variables\nprovides a bar against unintended side-effects.  On the other hand, if\n'global' was required for all global references, you'd be using 'global'\nall the time.  You'd have to declare as global every reference to a\nbuilt-in function or to a component of an imported module.  This clutter\nwould defeat the usefulness of the 'global' declaration for identifying\nside-effects.\n\nFile: python3.12.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\n\n10.2.2.3 Why do lambdas defined in a loop with different values all return the same result?\n...........................................................................................\n",
            "subsections": []
        },
        "Assume you use a for loop to define a few different lambdas (or even": {
            "content": "plain functions), e.g.:\n\n>>> squares = []\n>>> for x in range(5):\n...     squares.append(lambda: x2)\n\nThis gives you a list that contains 5 lambdas that calculate 'x2'.",
            "subsections": []
        },
        "You might expect that, when called, they would return, respectively,": {
            "content": "'0', '1', '4', '9', and '16'.  However, when you actually try you will\nsee that they all return '16':\n\n>>> squares[2]()\n16\n>>> squares[4]()\n16\n",
            "subsections": []
        },
        "This happens because 'x' is not local to the lambdas, but is defined in": {
            "content": "the outer scope, and it is accessed when the lambda is called -- not when\nit is defined.  At the end of the loop, the value of 'x' is '4', so all\nthe functions now return '42', i.e.  '16'.  You can also verify this\nby changing the value of 'x' and see how the results of the lambdas\nchange:\n\n>>> x = 8\n>>> squares[2]()\n64\n",
            "subsections": []
        },
        "In order to avoid this, you need to save the values in variables local": {
            "content": "to the lambdas, so that they don't rely on the value of the global 'x':\n\n>>> squares = []\n>>> for x in range(5):\n...     squares.append(lambda n=x: n2)\n\nHere, 'n=x' creates a new variable 'n' local to the lambda and computed\nwhen the lambda is defined so that it has the same value that 'x' had at\nthat point in the loop.  This means that the value of 'n' will be '0' in\nthe first lambda, '1' in the second, '2' in the third, and so on.\nTherefore each lambda will now return the correct result:\n\n>>> squares[2]()\n4\n>>> squares[4]()\n16\n",
            "subsections": []
        },
        "Note that this behaviour is not peculiar to lambdas, but applies to": {
            "content": "regular functions too.\n\nFile: python3.12.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\n\n10.2.2.4 How do I share global variables across modules?\n........................................................\n",
            "subsections": []
        },
        "The canonical way to share information across modules within a single": {
            "content": "program is to create a special module (often called config or cfg).",
            "subsections": []
        },
        "Just import the config module in all modules of your application; the": {
            "content": "module then becomes available as a global name.  Because there is only\none instance of each module, any changes made to the module object get\nreflected everywhere.  For example:\n\nconfig.py:\n\nx = 0   # Default value of the 'x' configuration setting\n\nmod.py:\n\nimport config\nconfig.x = 1\n\nmain.py:\n\nimport config\nimport mod\nprint(config.x)\n",
            "subsections": []
        },
        "Note that using a module is also the basis for implementing the": {
            "content": "singleton design pattern, for the same reason.\n\nFile: python3.12.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\n\n10.2.2.5 What are the \"best practices\" for using import in a module?\n....................................................................\n\nIn general, don't use 'from modulename import *'.  Doing so clutters the\nimporter's namespace, and makes it much harder for linters to detect\nundefined names.\n",
            "subsections": []
        },
        "Import modules at the top of a file.  Doing so makes it clear what other": {
            "content": "modules your code requires and avoids questions of whether the module\nname is in scope.  Using one import per line makes it easy to add and\ndelete module imports, but using multiple imports per line uses less\nscreen space.\n\nIt's good practice if you import modules in the following order:\n\n1. standard library modules - e.g.  *note sys: d3, *note os: 9c, *note\nargparse: 6, *note re: b4.\n\n2. third-party library modules (anything installed in Python's\nsite-packages directory) - e.g.  'dateutil', 'requests',\n'PIL.Image'\n\n3. locally developed modules\n",
            "subsections": []
        },
        "It is sometimes necessary to move imports to a function or class to": {
            "content": "avoid problems with circular imports.  Gordon McMillan says:\n\nCircular imports are fine where both modules use the \"import\n<module>\" form of import.  They fail when the 2nd module wants to\ngrab a name out of the first (\"from module import name\") and the\nimport is at the top level.  That's because names in the 1st are\nnot yet available, because the first module is busy importing the\n2nd.\n",
            "subsections": []
        },
        "In this case, if the second module is only used in one function, then": {
            "content": "the import can easily be moved into that function.  By the time the\nimport is called, the first module will have finished initializing, and\nthe second module can do its import.\n",
            "subsections": []
        },
        "It may also be necessary to move imports out of the top level of code if": {
            "content": "some of the modules are platform-specific.  In that case, it may not\neven be possible to import all of the modules at the top of the file.",
            "subsections": []
        },
        "In this case, importing the correct modules in the corresponding": {
            "content": "platform-specific code is a good option.\n",
            "subsections": []
        },
        "Only move imports into a local scope, such as inside a function": {
            "content": "definition, if it's necessary to solve a problem such as avoiding a\ncircular import or are trying to reduce the initialization time of a\nmodule.  This technique is especially helpful if many of the imports are\nunnecessary depending on how the program executes.  You may also want to\nmove imports into a function if the modules are only ever used in that\nfunction.  Note that loading a module the first time may be expensive\nbecause of the one time initialization of the module, but loading a\nmodule multiple times is virtually free, costing only a couple of\ndictionary lookups.  Even if the module name has gone out of scope, the\nmodule is probably available in *note sys.modules: 16d7.\n\nFile: python3.12.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\n\n10.2.2.6 Why are default values shared between objects?\n.......................................................\n",
            "subsections": []
        },
        "This type of bug commonly bites neophyte programmers.  Consider this": {
            "content": "function:\n\ndef foo(mydict={}):  # Danger: shared reference to one dict for all calls\n... compute something ...\nmydict[key] = value\nreturn mydict\n\nThe first time you call this function, 'mydict' contains a single item.",
            "subsections": []
        },
        "The second time, 'mydict' contains two items because when 'foo()' begins": {
            "content": "executing, 'mydict' starts out with an item already in it.\n",
            "subsections": []
        },
        "It is often expected that a function call creates new objects for": {
            "content": "default values.  This is not what happens.  Default values are created\nexactly once, when the function is defined.  If that object is changed,\nlike the dictionary in this example, subsequent calls to the function\nwill refer to this changed object.\n",
            "subsections": []
        },
        "By definition, immutable objects such as numbers, strings, tuples, and": {
            "content": "'None', are safe from change.  Changes to mutable objects such as\ndictionaries, lists, and class instances can lead to confusion.\n",
            "subsections": []
        },
        "Because of this feature, it is good programming practice to not use": {
            "content": "mutable objects as default values.  Instead, use 'None' as the default\nvalue and inside the function, check if the parameter is 'None' and\ncreate a new list/dictionary/whatever if it is.  For example, don't\nwrite:\n\ndef foo(mydict={}):\n...\n\nbut:\n\ndef foo(mydict=None):\nif mydict is None:\nmydict = {}  # create a new dict for local namespace\n",
            "subsections": []
        },
        "This feature can be useful.  When you have a function that's": {
            "content": "time-consuming to compute, a common technique is to cache the parameters\nand the resulting value of each call to the function, and return the\ncached value if the same value is requested again.  This is called\n\"memoizing\", and can be implemented like this:\n\n# Callers can only provide two parameters and optionally pass cache by keyword\ndef expensive(arg1, arg2, *, cache={}):\nif (arg1, arg2) in cache:\nreturn cache[(arg1, arg2)]\n\n# Calculate the value\nresult = ... expensive computation ...\ncache[(arg1, arg2)] = result           # Store result in the cache\nreturn result\n",
            "subsections": []
        },
        "You could use a global variable containing a dictionary instead of the": {
            "content": "default value; it's a matter of taste.\n\nFile: python3.12.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\n\n10.2.2.7 How can I pass optional or keyword parameters from one function to another?\n....................................................................................\n\nCollect the arguments using the '*' and '' specifiers in the\nfunction's parameter list; this gives you the positional arguments as a\ntuple and the keyword arguments as a dictionary.  You can then pass\nthese arguments when calling another function by using '*' and '':\n\ndef f(x, *args, kwargs):\n...\nkwargs['width'] = '14.3c'\n...\ng(x, *args, kwargs)\n\nFile: python3.12.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\n\n10.2.2.8 What is the difference between arguments and parameters?\n.................................................................\n\n*note Parameters: 1c1e. are defined by the names that appear in a\nfunction definition, whereas *note arguments: 154. are the values\nactually passed to a function when calling it.  Parameters define what\n*note kind of arguments: 1c1e. a function can accept.  For example,\ngiven the function definition:\n\ndef func(foo, bar=None, kwargs):\npass\n\n'foo', 'bar' and 'kwargs' are parameters of 'func'.  However, when\ncalling 'func', for example:\n\nfunc(42, bar=314, extra=somevar)\n\nthe values '42', '314', and 'somevar' are arguments.\n\nFile: python3.12.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\n\n10.2.2.9 Why did changing list 'y' also change list 'x'?\n........................................................\n\nIf you wrote code like:\n\n>>> x = []\n>>> y = x\n>>> y.append(10)\n>>> y\n[10]\n>>> x\n[10]\n\nyou might be wondering why appending an element to 'y' changed 'x' too.\n\nThere are two factors that produce this result:\n\n1. Variables are simply names that refer to objects.  Doing 'y = x'\ndoesn't create a copy of the list - it creates a new variable 'y'\nthat refers to the same object 'x' refers to.  This means that\nthere is only one object (the list), and both 'x' and 'y' refer to\nit.\n\n2. Lists are *note mutable: 1987, which means that you can change\ntheir content.\n",
            "subsections": []
        },
        "After the call to 'append()', the content of the mutable object has": {
            "content": "changed from '[]' to '[10]'.  Since both the variables refer to the same\nobject, using either name accesses the modified value '[10]'.\n\nIf we instead assign an immutable object to 'x':\n\n>>> x = 5  # ints are immutable\n>>> y = x\n>>> x = x + 1  # 5 can't be mutated, we are creating a new object here\n>>> x\n6\n>>> y\n5\n\nwe can see that in this case 'x' and 'y' are not equal anymore.  This is\nbecause integers are *note immutable: 1982, and when we do 'x = x + 1'\nwe are not mutating the int '5' by incrementing its value; instead, we\nare creating a new object (the int '6') and assigning it to 'x' (that\nis, changing which object 'x' refers to).  After this assignment we have\ntwo objects (the ints '6' and '5') and two variables that refer to them\n('x' now refers to '6' but 'y' still refers to '5').\n",
            "subsections": []
        },
        "Some operations (for example 'y.append(10)' and 'y.sort()') mutate the": {
            "content": "object, whereas superficially similar operations (for example 'y = y +\n[10]' and *note sorted(y): a12.) create a new object.  In general in",
            "subsections": []
        },
        "Python (and in all cases in the standard library) a method that mutates": {
            "content": "an object will return 'None' to help avoid getting the two types of\noperations confused.  So if you mistakenly write 'y.sort()' thinking it\nwill give you a sorted copy of 'y', you'll instead end up with 'None',\nwhich will likely cause your program to generate an easily diagnosed\nerror.\n",
            "subsections": []
        },
        "However, there is one class of operations where the same operation": {
            "content": "sometimes has different behaviors with different types: the augmented\nassignment operators.  For example, '+=' mutates lists but not tuples or\nints ('alist += [1, 2, 3]' is equivalent to 'alist.extend([1, 2, 3])'\nand mutates 'alist', whereas 'sometuple += (1, 2, 3)' and 'someint +=\n1' create new objects).\n\nIn other words:\n\n* If we have a mutable object (*note list: 3dc, *note dict: 237,\n*note set: 39d, etc.), we can use some specific operations to\nmutate it and all the variables that refer to it will see the\nchange.\n\n* If we have an immutable object (*note str: 157, *note int: 17e,\n*note tuple: 4b8, etc.), all the variables that refer to it will\nalways see the same value, but operations that transform that value\ninto a new value always return a new object.\n",
            "subsections": []
        },
        "If you want to know if two variables refer to the same object or not,": {
            "content": "you can use the *note is: 251. operator, or the built-in function *note\nid(): 1279.\n\nFile: python3.12.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\n\n10.2.2.10 How do I write a function with output parameters (call by reference)?\n...............................................................................\n",
            "subsections": []
        },
        "Remember that arguments are passed by assignment in Python.  Since": {
            "content": "assignment just creates references to objects, there's no alias between\nan argument name in the caller and callee, and so no call-by-reference\nper se.  You can achieve the desired effect in a number of ways.\n\n1. By returning a tuple of the results:\n\n>>> def func1(a, b):\n...     a = 'new-value'        # a and b are local names\n...     b = b + 1              # assigned to new objects\n...     return a, b            # return new values\n...\n>>> x, y = 'old-value', 99\n>>> func1(x, y)\n('new-value', 100)\n\nThis is almost always the clearest solution.\n\n2. By using global variables.  This isn't thread-safe, and is not\nrecommended.\n\n3. By passing a mutable (changeable in-place) object:\n\n>>> def func2(a):\n...     a[0] = 'new-value'     # 'a' references a mutable list\n...     a[1] = a[1] + 1        # changes a shared object\n...\n>>> args = ['old-value', 99]\n>>> func2(args)\n>>> args\n['new-value', 100]\n\n4. By passing in a dictionary that gets mutated:\n\n>>> def func3(args):\n...     args['a'] = 'new-value'     # args is a mutable dictionary\n...     args['b'] = args['b'] + 1   # change it in-place\n...\n>>> args = {'a': 'old-value', 'b': 99}\n>>> func3(args)\n>>> args\n{'a': 'new-value', 'b': 100}\n\n5. Or bundle up values in a class instance:\n\n>>> class Namespace:\n...     def init(self, /, args):\n...         for key, value in args.items():\n...             setattr(self, key, value)\n...\n>>> def func4(args):\n...     args.a = 'new-value'        # args is a mutable Namespace\n...     args.b = args.b + 1         # change object in-place\n...\n>>> args = Namespace(a='old-value', b=99)\n>>> func4(args)\n>>> vars(args)\n{'a': 'new-value', 'b': 100}\n\nThere's almost never a good reason to get this complicated.\n\nYour best choice is to return a tuple containing the multiple results.\n\nFile: python3.12.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\n\n10.2.2.11 How do you make a higher order function in Python?\n............................................................\n",
            "subsections": []
        },
        "You have two choices: you can use nested scopes or you can use callable": {
            "content": "objects.  For example, suppose you wanted to define 'linear(a,b)' which\nreturns a function 'f(x)' that computes the value 'a*x+b'.  Using nested\nscopes:\n\ndef linear(a, b):\ndef result(x):\nreturn a * x + b\nreturn result\n\nOr using a callable object:\n\nclass linear:\n\ndef init(self, a, b):\nself.a, self.b = a, b\n\ndef call(self, x):\nreturn self.a * x + self.b\n\nIn both cases,\n\ntaxes = linear(0.3, 2)\n\ngives a callable object where 'taxes(10e6) == 0.3 * 10e6 + 2'.\n",
            "subsections": []
        },
        "The callable object approach has the disadvantage that it is a bit": {
            "content": "slower and results in slightly longer code.  However, note that a\ncollection of callables can share their signature via inheritance:\n\nclass exponential(linear):\n# init inherited\ndef call(self, x):\nreturn self.a * (x  self.b)\n\nObject can encapsulate state for several methods:\n\nclass counter:\n\nvalue = 0\n\ndef set(self, x):\nself.value = x\n\ndef up(self):\nself.value = self.value + 1\n\ndef down(self):\nself.value = self.value - 1\n\ncount = counter()\ninc, dec, reset = count.up, count.down, count.set\n",
            "subsections": []
        },
        "Here 'inc()', 'dec()' and 'reset()' act like functions which share the": {
            "content": "same counting variable.\n\nFile: python3.12.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\n\n10.2.2.12 How do I copy an object in Python?\n............................................\n\nIn general, try *note copy.copy(): 289. or *note copy.deepcopy(): 9af.\nfor the general case.  Not all objects can be copied, but most can.\n\nSome objects can be copied more easily.  Dictionaries have a *note\ncopy(): a14. method:\n\nnewdict = olddict.copy()\n\nSequences can be copied by slicing:\n\nnewl = l[:]\n\nFile: python3.12.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\n\n10.2.2.13 How can I find the methods or attributes of an object?\n................................................................\n\nFor an instance 'x' of a user-defined class, *note dir(x): 3ff. returns\nan alphabetized list of the names containing the instance attributes and\nmethods and attributes defined by its class.\n\nFile: python3.12.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\n\n10.2.2.14 How can my code discover the name of an object?\n.........................................................\n\nGenerally speaking, it can't, because objects don't really have names.",
            "subsections": []
        },
        "Essentially, assignment always binds a name to a value; the same is true": {
            "content": "of 'def' and 'class' statements, but in that case the value is a\ncallable.  Consider the following code:\n\n>>> class A:\n...     pass\n...\n>>> B = A\n>>> a = B()\n>>> b = a\n>>> print(b)\n<main.A object at 0x16D07CC>\n>>> print(a)\n<main.A object at 0x16D07CC>\n",
            "subsections": []
        },
        "Arguably the class has a name: even though it is bound to two names and": {
            "content": "invoked through the name 'B' the created instance is still reported as\nan instance of class 'A'.  However, it is impossible to say whether the\ninstance's name is 'a' or 'b', since both names are bound to the same\nvalue.\n\nGenerally speaking it should not be necessary for your code to \"know the\nnames\" of particular values.  Unless you are deliberately writing\nintrospective programs, this is usually an indication that a change of\napproach might be beneficial.\n",
            "subsections": []
        },
        "In comp.lang.python, Fredrik Lundh once gave an excellent analogy in": {
            "content": "answer to this question:\n\nThe same way as you get the name of that cat you found on your\nporch: the cat (object) itself cannot tell you its name, and it\ndoesn't really care - so the only way to find out what it's called\nis to ask all your neighbours (namespaces) if it's their cat\n(object)...\n\n....and don't be surprised if you'll find that it's known by many\nnames, or no name at all!\n\nFile: python3.12.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\n\n10.2.2.15 What's up with the comma operator's precedence?\n.........................................................\n\nComma is not an operator in Python.  Consider this session:\n\n>>> \"a\" in \"b\", \"a\"\n(False, 'a')\n",
            "subsections": []
        },
        "Since the comma is not an operator, but a separator between expressions": {
            "content": "the above is evaluated as if you had entered:\n\n(\"a\" in \"b\"), \"a\"\n\nnot:\n\n\"a\" in (\"b\", \"a\")\n\nThe same is true of the various assignment operators ('=', '+=' etc).",
            "subsections": []
        },
        "They are not truly operators but syntactic delimiters in assignment": {
            "content": "statements.\n\nFile: python3.12.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\n\n10.2.2.16 Is there an equivalent of C's \"?:\" ternary operator?\n..............................................................\n\nYes, there is.  The syntax is as follows:\n\n[ontrue] if [expression] else [onfalse]\n\nx, y = 50, 25\nsmall = x if x < y else y\n",
            "subsections": []
        },
        "Before this syntax was introduced in Python 2.5, a common idiom was to": {
            "content": "use logical operators:\n\n[expression] and [ontrue] or [onfalse]\n",
            "subsections": []
        },
        "However, this idiom is unsafe, as it can give wrong results when": {
            "content": "'ontrue' has a false boolean value.  Therefore, it is always better to\nuse the '... if ... else ...' form.\n\nFile: python3.12.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\n\n10.2.2.17 Is it possible to write obfuscated one-liners in Python?\n..................................................................\n\nYes.  Usually this is done by nesting *note lambda: 1115. within\n'lambda'.  See the following three examples, slightly adapted from Ulf\nBartelt:\n\nfrom functools import reduce\n\n# Primes < 1000\nprint(list(filter(None,map(lambda y:y*reduce(lambda x,y:x*y!=0,\nmap(lambda x,y=y:y%x,range(2,int(pow(y,0.5)+1))),1),range(2,1000)))))\n\n# First 10 Fibonacci numbers\nprint(list(map(lambda x,f=lambda x,f:(f(x-1,f)+f(x-2,f)) if x>1 else 1:\nf(x,f), range(10))))\n\n# Mandelbrot set\nprint((lambda Ru,Ro,Iu,Io,IM,Sx,Sy:reduce(lambda x,y:x+'\\n'+y,map(lambda y,\nIu=Iu,Io=Io,Ru=Ru,Ro=Ro,Sy=Sy,L=lambda yc,Iu=Iu,Io=Io,Ru=Ru,Ro=Ro,i=IM,\nSx=Sx,Sy=Sy:reduce(lambda x,y:x+y,map(lambda x,xc=Ru,yc=yc,Ru=Ru,Ro=Ro,\ni=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\n>=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(\n64+F(Ru+x*(Ro-Ru)/Sx,yc,0,0,i)),range(Sx))):L(Iu+y*(Io-Iu)/Sy),range(Sy\n))))(-2.1, 0.7, -1.2, 1.2, 30, 80, 24))\n#    \\ /  \\ /  |   |   | lines on screen\n#        V          V      |   | columns on screen\n#        |          |      | maximum of \"iterations\"\n#        |          | range on y axis\n#        | range on x axis\n\nDon't try this at home, kids!\n\nFile: python3.12.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\n\n10.2.2.18 What does the slash(/) in the parameter list of a function mean?\n..........................................................................\n\nA slash in the argument list of a function denotes that the parameters\nprior to it are positional-only.  Positional-only parameters are the\nones without an externally usable name.  Upon calling a function that\naccepts positional-only parameters, arguments are mapped to parameters\nbased solely on their position.  For example, *note divmod(): 7c5. is a\nfunction that accepts positional-only parameters.  Its documentation\nlooks like this:\n\n>>> help(divmod)\nHelp on built-in function divmod in module builtins:\n\ndivmod(x, y, /)\nReturn the tuple (x//y, x%y).  Invariant: div*y + mod == x.\n",
            "subsections": []
        },
        "The slash at the end of the parameter list means that both parameters": {
            "content": "are positional-only.  Thus, calling *note divmod(): 7c5. with keyword\narguments would lead to an error:\n\n>>> divmod(x=3, y=4)\nTraceback (most recent call last):\nFile \"<stdin>\", line 1, in <module>\nTypeError: divmod() takes no keyword arguments\n\nFile: python3.12.info,  Node: Numbers and strings,  Next: Performance<4>,  Prev: Core Language,  Up: Programming FAQ\n\n\n* Menu:\n\n* How do I specify hexadecimal and octal integers?::\n* Why does -22 // 10 return -3?::\n* How do I get int literal attribute instead of SyntaxError?::\n* How do I convert a string to a number?::\n* How do I convert a number to a string?::\n* How do I modify a string in place?::\n* How do I use strings to call functions/methods?::\n* 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?.\n* Is there a scanf() or sscanf() equivalent?: Is there a scanf or sscanf equivalent?.\n* What does 'UnicodeDecodeError' or 'UnicodeEncodeError' error mean?::\n* Can I end a raw string with an odd number of backslashes?::\n\nFile: python3.12.info,  Node: How do I specify hexadecimal and octal integers?,  Next: Why does -22 // 10 return -3?,  Up: Numbers and strings\n\n10.2.3.1 How do I specify hexadecimal and octal integers?\n.........................................................\n",
            "subsections": []
        },
        "To specify an octal digit, precede the octal value with a zero, and then": {
            "content": "a lower or uppercase \"o\".  For example, to set the variable \"a\" to the\noctal value \"10\" (8 in decimal), type:\n\n>>> a = 0o10\n>>> a\n8\n",
            "subsections": []
        },
        "Hexadecimal is just as easy.  Simply precede the hexadecimal number with": {
            "content": "a zero, and then a lower or uppercase \"x\".  Hexadecimal digits can be\nspecified in lower or uppercase.  For example, in the Python\ninterpreter:\n\n>>> a = 0xa5\n>>> a\n165\n>>> b = 0XB2\n>>> b\n178\n\nFile: python3.12.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\n\n10.2.3.2 Why does -22 // 10 return -3?\n......................................\n\nIt's primarily driven by the desire that 'i % j' have the same sign as\n'j'.  If you want that, and also want:\n\ni == (i // j) * j + (i % j)\n\nthen integer division has to return the floor.  C also requires that\nidentity to hold, and then compilers that truncate 'i // j' need to make\n'i % j' have the same sign as 'i'.\n\nThere are few real use cases for 'i % j' when 'j' is negative.  When 'j'\nis positive, there are many, and in virtually all of them it's more\nuseful for 'i % j' to be '>= 0'.  If the clock says 10 now, what did it\nsay 200 hours ago?  '-190 % 12 == 2' is useful; '-190 % 12 == -10' is a\nbug waiting to bite.\n\nFile: python3.12.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\n\n10.2.3.3 How do I get int literal attribute instead of SyntaxError?\n...................................................................\n",
            "subsections": []
        },
        "Trying to lookup an 'int' literal attribute in the normal manner gives a": {
            "content": "*note SyntaxError: 146. because the period is seen as a decimal point:\n\n>>> 1.class\nFile \"<stdin>\", line 1\n1.class\n^\nSyntaxError: invalid decimal literal\n",
            "subsections": []
        },
        "The solution is to separate the literal from the period with either a": {
            "content": "space or parentheses.\n\n>>> 1 .class\n<class 'int'>\n>>> (1).class\n<class 'int'>\n\nFile: python3.12.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\n\n10.2.3.4 How do I convert a string to a number?\n...............................................\n\nFor integers, use the built-in *note int(): 17e. type constructor, e.g.\n'int('144') == 144'.  Similarly, *note float(): 4b7. converts to\nfloating-point, e.g.  'float('144') == 144.0'.\n",
            "subsections": []
        },
        "By default, these interpret the number as decimal, so that 'int('0144')": {
            "content": "== 144' holds true, and 'int('0x144')' raises *note ValueError: 183.\n'int(string, base)' takes the base to convert from as a second optional\nargument, so 'int( '0x144', 16) == 324'.  If the base is specified as 0,\nthe number is interpreted using Python's rules: a leading '0o' indicates\noctal, and '0x' indicates a hex number.\n\nDo not use the built-in function *note eval(): 690. if all you need is\nto convert strings to numbers.  *note eval(): 690. will be significantly\nslower and it presents a security risk: someone could pass you a Python\nexpression that might have unwanted side effects.  For example, someone\ncould pass 'import('os').system(\"rm -rf $HOME\")' which would erase\nyour home directory.\n\n*note eval(): 690. also has the effect of interpreting numbers as Python\nexpressions, so that e.g.  'eval('09')' gives a syntax error because\nPython does not allow leading '0' in a decimal number (except '0').\n\nFile: python3.12.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\n\n10.2.3.5 How do I convert a number to a string?\n...............................................\n",
            "subsections": []
        },
        "To convert, e.g., the number '144' to the string ''144'', use the": {
            "content": "built-in type constructor *note str(): 157.  If you want a hexadecimal\nor octal representation, use the built-in functions *note hex(): 1143.\nor *note oct(): 1142.  For fancy formatting, see the *note f-strings:\n7cd. and *note Format String Syntax: 1205. sections, e.g.\n'\"{:04d}\".format(144)' yields ''0144'' and '\"{:.3f}\".format(1.0/3.0)'\nyields ''0.333''.\n\nFile: python3.12.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\n\n10.2.3.6 How do I modify a string in place?\n...........................................\n",
            "subsections": []
        },
        "You can't, because strings are immutable.  In most situations, you": {
            "content": "should simply construct a new string from the various parts you want to\nassemble it from.  However, if you need an object with the ability to\nmodify in-place unicode data, try using an *note io.StringIO: d94.\nobject or the *note array: 7. module:\n\n>>> import io\n>>> s = \"Hello, world\"\n>>> sio = io.StringIO(s)\n>>> sio.getvalue()\n'Hello, world'\n>>> sio.seek(7)\n7\n>>> sio.write(\"there!\")\n6\n>>> sio.getvalue()\n'Hello, there!'\n\n>>> import array\n>>> a = array.array('u', s)\n>>> print(a)\narray('u', 'Hello, world')\n>>> a[0] = 'y'\n>>> print(a)\narray('u', 'yello, world')\n>>> a.tounicode()\n'yello, world'\n\nFile: python3.12.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\n\n10.2.3.7 How do I use strings to call functions/methods?\n........................................................\n\nThere are various techniques.\n\n* The best is to use a dictionary that maps strings to functions.\nThe primary advantage of this technique is that the strings do not\nneed to match the names of the functions.  This is also the primary\ntechnique used to emulate a case construct:\n\ndef a():\npass\n\ndef b():\npass\n\ndispatch = {'go': a, 'stop': b}  # Note lack of parens for funcs\n\ndispatch[getinput()]()  # Note trailing parens to call function\n\n* Use the built-in function *note getattr(): a15.:\n\nimport foo\ngetattr(foo, 'bar')()\n\nNote that *note getattr(): a15. works on any object, including\nclasses, class instances, modules, and so on.\n\nThis is used in several places in the standard library, like this:\n\nclass Foo:\ndef dofoo(self):\n...\n\ndef dobar(self):\n...\n\nf = getattr(fooinstance, 'do' + opname)\nf()\n\n* Use *note locals(): 173. to resolve the function name:\n\ndef myFunc():\nprint(\"hello\")\n\nfname = \"myFunc\"\n\nf = locals()[fname]\nf()\n\nFile: python3.12.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\n\n10.2.3.8 Is there an equivalent to Perl's chomp() for removing trailing newlines from strings?\n..............................................................................................\n\nYou can use 'S.rstrip(\"\\r\\n\")' to remove all occurrences of any line\nterminator from the end of the string 'S' without removing other\ntrailing whitespace.  If the string 'S' represents more than one line,\nwith several empty lines at the end, the line terminators for all the\nblank lines will be removed:\n\n>>> lines = (\"line 1 \\r\\n\"\n...          \"\\r\\n\"\n...          \"\\r\\n\")\n>>> lines.rstrip(\"\\n\\r\")\n'line 1 '\n",
            "subsections": []
        },
        "Since this is typically only desired when reading text one line at a": {
            "content": "time, using 'S.rstrip()' this way works well.\n\nFile: python3.12.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\n\n10.2.3.9 Is there a scanf() or sscanf() equivalent?\n...................................................\n\nNot as such.\n",
            "subsections": []
        },
        "For simple input parsing, the easiest approach is usually to split the": {
            "content": "line into whitespace-delimited words using the *note split(): d0e.\nmethod of string objects and then convert decimal strings to numeric\nvalues using *note int(): 17e. or *note float(): 4b7.  'split()'\nsupports an optional \"sep\" parameter which is useful if the line uses\nsomething other than whitespace as a separator.\n",
            "subsections": []
        },
        "For more complicated input parsing, regular expressions are more": {
            "content": "powerful than C's 'sscanf' and better suited for the task.\n\nFile: python3.12.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\n\n10.2.3.10 What does 'UnicodeDecodeError' or 'UnicodeEncodeError' error mean?\n............................................................................\n\nSee the *note Unicode HOWTO: 111c.\n\nFile: python3.12.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\n\n10.2.3.11 Can I end a raw string with an odd number of backslashes?\n...................................................................\n\nA raw string ending with an odd number of backslashes will escape the\nstring's quote:\n\n>>> r'C:\\this\\will\\not\\work\\'\nFile \"<stdin>\", line 1\nr'C:\\this\\will\\not\\work\\'\n^\nSyntaxError: unterminated string literal (detected at line 1)\n",
            "subsections": []
        },
        "There are several workarounds for this.  One is to use regular strings": {
            "content": "and double the backslashes:\n\n>>> 'C:\\\\this\\\\will\\\\work\\\\'\n'C:\\\\this\\\\will\\\\work\\\\'\n",
            "subsections": []
        },
        "Another is to concatenate a regular string containing an escaped": {
            "content": "backslash to the raw string:\n\n>>> r'C:\\this\\will\\work' '\\\\'\n'C:\\\\this\\\\will\\\\work\\\\'\n\nIt is also possible to use *note os.path.join(): 1474. to append a\nbackslash on Windows:\n\n>>> os.path.join(r'C:\\this\\will\\work', '')\n'C:\\\\this\\\\will\\\\work\\\\'\n\nNote that while a backslash will \"escape\" a quote for the purposes of\ndetermining where the raw string ends, no escaping occurs when\ninterpreting the value of the raw string.  That is, the backslash\nremains present in the value of the raw string:\n\n>>> r'backslash\\'preserved'\n\"backslash\\\\'preserved\"\n\nAlso see the specification in the *note language reference: 1bc5.\n\nFile: python3.12.info,  Node: Performance<4>,  Next: Sequences Tuples/Lists,  Prev: Numbers and strings,  Up: Programming FAQ\n\n\n* Menu:\n\n* My program is too slow. How do I speed it up?: My program is too slow How do I speed it up?.\n* What is the most efficient way to concatenate many strings together?::\n\nFile: python3.12.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>\n\n10.2.4.1 My program is too slow. How do I speed it up?\n......................................................\n",
            "subsections": []
        },
        "That's a tough one, in general.  First, here are a list of things to": {
            "content": "remember before diving further:\n\n* Performance characteristics vary across Python implementations.\nThis FAQ focuses on *note CPython: 4c9.\n\n* Behaviour can vary across operating systems, especially when\ntalking about I/O or multi-threading.\n\n* You should always find the hot spots in your program 'before'\nattempting to optimize any code (see the *note profile: aa.\nmodule).\n\n* Writing benchmark scripts will allow you to iterate quickly when\nsearching for improvements (see the *note timeit: e9. module).\n\n* It is highly recommended to have good code coverage (through unit\ntesting or any other technique) before potentially introducing\nregressions hidden in sophisticated optimizations.\n",
            "subsections": []
        },
        "That being said, there are many tricks to speed up Python code.  Here": {
            "content": "are some general principles which go a long way towards reaching\nacceptable performance levels:\n\n* Making your algorithms faster (or changing to faster ones) can\nyield much larger benefits than trying to sprinkle\nmicro-optimization tricks all over your code.\n\n* Use the right data structures.  Study documentation for the *note\nBuilt-in Types: 1e99. and the *note collections: 1b. module.\n\n* When the standard library provides a primitive for doing something,\nit is likely (although not guaranteed) to be faster than any\nalternative you may come up with.  This is doubly true for\nprimitives written in C, such as builtins and some extension types.\nFor example, be sure to use either the *note list.sort(): a13.\nbuilt-in method or the related *note sorted(): a12. function to do\nsorting (and see the *note Sorting Techniques: 1e89. for examples\nof moderately advanced usage).\n\n* Abstractions tend to create indirections and force the interpreter\nto work more.  If the levels of indirection outweigh the amount of\nuseful work done, your program will be slower.  You should avoid\nexcessive abstraction, especially under the form of tiny functions\nor methods (which are also often detrimental to readability).\n",
            "subsections": []
        },
        "If you have reached the limit of what pure Python can allow, there are": {
            "content": "tools to take you further away.  For example, Cython(1) can compile a\nslightly modified version of Python code into a C extension, and can be\nused on many different platforms.  Cython can take advantage of\ncompilation (and optional type annotations) to make your code\nsignificantly faster than when interpreted.  If you are confident in\nyour C programming skills, you can also *note write a C extension\nmodule: 195e. yourself.\n\nSee also\n........\n\nThe wiki page devoted to performance tips(2).\n\n---------- Footnotes ----------\n\n(1) https://cython.org\n\n(2) https://wiki.python.org/moin/PythonSpeed/PerformanceTips\n\nFile: python3.12.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>\n\n10.2.4.2 What is the most efficient way to concatenate many strings together?\n.............................................................................\n\n*note str: 157. and *note bytes: 295. objects are immutable, therefore\nconcatenating many strings together is inefficient as each concatenation\ncreates a new object.  In the general case, the total runtime cost is\nquadratic in the total string length.\n\nTo accumulate many *note str: 157. objects, the recommended idiom is to\nplace them into a list and call *note str.join(): 1eb6. at the end:\n\nchunks = []\nfor s in mystrings:\nchunks.append(s)\nresult = ''.join(chunks)\n\n(another reasonably efficient idiom is to use *note io.StringIO: d94.)\n\nTo accumulate many *note bytes: 295. objects, the recommended idiom is\nto extend a *note bytearray: 294. object using in-place concatenation\n(the '+=' operator):\n\nresult = bytearray()\nfor b in mybytesobjects:\nresult += b\n\nFile: python3.12.info,  Node: Sequences Tuples/Lists,  Next: Objects,  Prev: Performance<4>,  Up: Programming FAQ\n\n\n* Menu:\n\n* How do I convert between tuples and lists?::\n* What's a negative index?::\n* How do I iterate over a sequence in reverse order?::\n* How do you remove duplicates from a list?::\n* How do you remove multiple items from a list::\n* How do you make an array in Python?::\n* How do I create a multidimensional list?::\n* How do I apply a method or function to a sequence of objects?::\n* Why does atuple[i] += ['item'] raise an exception when the addition works?::\n* 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?.\n* How can I sort one list by values from another list?::\n\nFile: python3.12.info,  Node: How do I convert between tuples and lists?,  Next: What's a negative index?,  Up: Sequences Tuples/Lists\n\n10.2.5.1 How do I convert between tuples and lists?\n...................................................\n",
            "subsections": []
        },
        "The type constructor 'tuple(seq)' converts any sequence (actually, any": {
            "content": "iterable) into a tuple with the same items in the same order.\n\nFor example, 'tuple([1, 2, 3])' yields '(1, 2, 3)' and 'tuple('abc')'\nyields '('a', 'b', 'c')'.  If the argument is a tuple, it does not make\na copy but returns the same object, so it is cheap to call *note\ntuple(): 4b8. when you aren't sure that an object is already a tuple.\n",
            "subsections": []
        },
        "The type constructor 'list(seq)' converts any sequence or iterable into": {
            "content": "a list with the same items in the same order.  For example, 'list((1, 2,\n3))' yields '[1, 2, 3]' and 'list('abc')' yields '['a', 'b', 'c']'.  If\nthe argument is a list, it makes a copy just like 'seq[:]' would.\n\nFile: python3.12.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\n\n10.2.5.2 What's a negative index?\n.................................\n\nPython sequences are indexed with positive numbers and negative numbers.",
            "subsections": []
        },
        "For positive numbers 0 is the first index 1 is the second index and so": {
            "content": "forth.  For negative indices -1 is the last index and -2 is the\npenultimate (next to last) index and so forth.  Think of 'seq[-n]' as\nthe same as 'seq[len(seq)-n]'.\n\nUsing negative indices can be very convenient.  For example 'S[:-1]' is\nall of the string except for its last character, which is useful for\nremoving the trailing newline from a string.\n\nFile: python3.12.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\n\n10.2.5.3 How do I iterate over a sequence in reverse order?\n...........................................................\n\nUse the *note reversed(): 661. built-in function:\n\nfor x in reversed(sequence):\n...  # do something with x ...\n",
            "subsections": []
        },
        "This won't touch your original sequence, but build a new copy with": {
            "content": "reversed order to iterate over.\n\nFile: python3.12.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\n\n10.2.5.4 How do you remove duplicates from a list?\n..................................................\n\nSee the Python Cookbook for a long discussion of many ways to do this:\n\n'https://code.activestate.com/recipes/52560/'\n",
            "subsections": []
        },
        "If you don't mind reordering the list, sort it and then scan from the": {
            "content": "end of the list, deleting duplicates as you go:\n\nif mylist:\nmylist.sort()\nlast = mylist[-1]\nfor i in range(len(mylist)-2, -1, -1):\nif last == mylist[i]:\ndel mylist[i]\nelse:\nlast = mylist[i]\n",
            "subsections": []
        },
        "If all elements of the list may be used as set keys (i.e.  they are all": {
            "content": "*note hashable: 3db.) this is often faster\n\nmylist = list(set(mylist))\n",
            "subsections": []
        },
        "This converts the list into a set, thereby removing duplicates, and then": {
            "content": "back into a list.\n\nFile: python3.12.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\n\n10.2.5.5 How do you remove multiple items from a list\n.....................................................\n",
            "subsections": []
        },
        "As with removing duplicates, explicitly iterating in reverse with a": {
            "content": "delete condition is one possibility.  However, it is easier and faster\nto use slice replacement with an implicit or explicit forward iteration.\nHere are three variations.:\n\nmylist[:] = filter(keepfunction, mylist)\nmylist[:] = (x for x in mylist if keepcondition)\nmylist[:] = [x for x in mylist if keepcondition]\n\nThe list comprehension may be fastest.\n\nFile: python3.12.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\n\n10.2.5.6 How do you make an array in Python?\n............................................\n\nUse a list:\n\n[\"this\", 1, \"is\", \"an\", \"array\"]\n",
            "subsections": []
        },
        "Lists are equivalent to C or Pascal arrays in their time complexity; the": {
            "content": "primary difference is that a Python list can contain objects of many\ndifferent types.\n",
            "subsections": []
        },
        "The 'array' module also provides methods for creating arrays of fixed": {
            "content": "types with compact representations, but they are slower to index than\nlists.  Also note that NumPy(1) and other third party packages define\narray-like structures with various characteristics as well.\n",
            "subsections": []
        },
        "To get Lisp-style linked lists, you can emulate 'cons cells' using": {
            "content": "tuples:\n\nlisplist = (\"like\",  (\"this\",  (\"example\", None) ) )\n",
            "subsections": []
        },
        "If mutability is desired, you could use lists instead of tuples.  Here": {
            "content": "the analogue of a Lisp 'car' is 'lisplist[0]' and the analogue of 'cdr'\nis 'lisplist[1]'.  Only do this if you're sure you really need to,\nbecause it's usually a lot slower than using Python lists.\n\n---------- Footnotes ----------\n\n(1) https://numpy.org/\n\nFile: python3.12.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\n\n10.2.5.7 How do I create a multidimensional list?\n.................................................\n\nYou probably tried to make a multidimensional array like this:\n\n>>> A = [[None] * 2] * 3\n\nThis looks correct if you print it:\n\n>>> A\n[[None, None], [None, None], [None, None]]\n\nBut when you assign a value, it shows up in multiple places:\n\n>>> A[0][0] = 5\n>>> A\n[[5, None], [5, None], [5, None]]\n\nThe reason is that replicating a list with '*' doesn't create copies, it\nonly creates references to the existing objects.  The '*3' creates a\nlist containing 3 references to the same list of length two.  Changes to\none row will show in all rows, which is almost certainly not what you\nwant.\n",
            "subsections": []
        },
        "The suggested approach is to create a list of the desired length first": {
            "content": "and then fill in each element with a newly created list:\n\nA = [None] * 3\nfor i in range(3):\nA[i] = [None] * 2\n",
            "subsections": []
        },
        "This generates a list containing 3 different lists of length two.  You": {
            "content": "can also use a list comprehension:\n\nw, h = 2, 3\nA = [[None] * w for i in range(h)]\n",
            "subsections": []
        },
        "Or, you can use an extension that provides a matrix datatype; NumPy(1)": {
            "content": "is the best known.\n\n---------- Footnotes ----------\n\n(1) https://numpy.org/\n\nFile: python3.12.info,  Node: How do I apply a method or function to a sequence of objects?,  Next: Why does atuple[i] += ['item'] raise an exception when the addition works?,  Prev: How do I create a multidimensional list?,  Up: Sequences Tuples/Lists\n\n10.2.5.8 How do I apply a method or function to a sequence of objects?\n......................................................................\n",
            "subsections": []
        },
        "To call a method or function and accumulate the return values is a list,": {
            "content": "a *note list comprehension: 49d. is an elegant solution:\n\nresult = [obj.method() for obj in mylist]\n\nresult = [function(obj) for obj in mylist]\n",
            "subsections": []
        },
        "To just run the method or function without saving the return values, a": {
            "content": "plain *note for: 24e. loop will suffice:\n\nfor obj in mylist:\nobj.method()\n\nfor obj in mylist:\nfunction(obj)\n\nFile: python3.12.info,  Node: Why does atuple[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\n\n10.2.5.9 Why does atuple[i] += ['item'] raise an exception when the addition works?\n....................................................................................\n",
            "subsections": []
        },
        "This is because of a combination of the fact that augmented assignment": {
            "content": "operators are 'assignment' operators, and the difference between mutable\nand immutable objects in Python.\n",
            "subsections": []
        },
        "This discussion applies in general when augmented assignment operators": {
            "content": "are applied to elements of a tuple that point to mutable objects, but\nwe'll use a 'list' and '+=' as our exemplar.\n\nIf you wrote:\n\n>>> atuple = (1, 2)\n>>> atuple[0] += 1\nTraceback (most recent call last):\n...\nTypeError: 'tuple' object does not support item assignment\n",
            "subsections": []
        },
        "The reason for the exception should be immediately clear: '1' is added": {
            "content": "to the object 'atuple[0]' points to ('1'), producing the result object,\n'2', but when we attempt to assign the result of the computation, '2',\nto element '0' of the tuple, we get an error because we can't change\nwhat an element of a tuple points to.\n",
            "subsections": []
        },
        "Under the covers, what this augmented assignment statement is doing is": {
            "content": "approximately this:\n\n>>> result = atuple[0] + 1\n>>> atuple[0] = result\nTraceback (most recent call last):\n...\nTypeError: 'tuple' object does not support item assignment\n",
            "subsections": []
        },
        "It is the assignment part of the operation that produces the error,": {
            "content": "since a tuple is immutable.\n\nWhen you write something like:\n\n>>> atuple = (['foo'], 'bar')\n>>> atuple[0] += ['item']\nTraceback (most recent call last):\n...\nTypeError: 'tuple' object does not support item assignment\n",
            "subsections": []
        },
        "The exception is a bit more surprising, and even more surprising is the": {
            "content": "fact that even though there was an error, the append worked:\n\n>>> atuple[0]\n['foo', 'item']\n",
            "subsections": []
        },
        "To see why this happens, you need to know that (a) if an object": {
            "content": "implements an *note iadd(): 1c95. magic method, it gets called when\nthe '+=' augmented assignment is executed, and its return value is what\ngets used in the assignment statement; and (b) for lists, 'iadd()'\nis equivalent to calling 'extend()' on the list and returning the list.\nThat's why we say that for lists, '+=' is a \"shorthand\" for\n'list.extend()':\n\n>>> alist = []\n>>> alist += [1]\n>>> alist\n[1]\n\nThis is equivalent to:\n\n>>> result = alist.iadd([1])\n>>> alist = result\n",
            "subsections": []
        },
        "The object pointed to by alist has been mutated, and the pointer to the": {
            "content": "mutated object is assigned back to 'alist'.  The end result of the\nassignment is a no-op, since it is a pointer to the same object that\n'alist' was previously pointing to, but the assignment still happens.\n\nThus, in our tuple example what is happening is equivalent to:\n\n>>> result = atuple[0].iadd(['item'])\n>>> atuple[0] = result\nTraceback (most recent call last):\n...\nTypeError: 'tuple' object does not support item assignment\n",
            "subsections": []
        },
        "The 'iadd()' succeeds, and thus the list is extended, but even": {
            "content": "though 'result' points to the same object that 'atuple[0]' already\npoints to, that final assignment still results in an error, because\ntuples are immutable.\n\nFile: python3.12.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 atuple[i] += ['item'] raise an exception when the addition works?,  Up: Sequences Tuples/Lists\n\n10.2.5.10 I want to do a complicated sort: can you do a Schwartzian Transform in Python?\n........................................................................................\n",
            "subsections": []
        },
        "The technique, attributed to Randal Schwartz of the Perl community,": {
            "content": "sorts the elements of a list by a metric which maps each element to its\n\"sort value\".  In Python, use the 'key' argument for the *note\nlist.sort(): a13. method:\n\nIsorted = L[:]\nIsorted.sort(key=lambda s: int(s[10:15]))\n\nFile: python3.12.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\n\n10.2.5.11 How can I sort one list by values from another list?\n..............................................................\n",
            "subsections": []
        },
        "Merge them into an iterator of tuples, sort the resulting list, and then": {
            "content": "pick out the element you want.\n\n>>> list1 = [\"what\", \"I'm\", \"sorting\", \"by\"]\n>>> list2 = [\"something\", \"else\", \"to\", \"sort\"]\n>>> pairs = zip(list1, list2)\n>>> pairs = sorted(pairs)\n>>> pairs\n[(\"I'm\", 'else'), ('by', 'sort'), ('sorting', 'to'), ('what', 'something')]\n>>> result = [x[1] for x in pairs]\n>>> result\n['else', 'sort', 'to', 'something']\n\nFile: python3.12.info,  Node: Objects,  Next: Modules<5>,  Prev: Sequences Tuples/Lists,  Up: Programming FAQ\n\n\n* Menu:\n\n* What is a class?::\n* What is a method?::\n* What is self?::\n* How do I check if an object is an instance of a given class or of a subclass of it?::\n* What is delegation?::\n* How do I call a method defined in a base class from a derived class that extends it?::\n* How can I organize my code to make it easier to change the base class?::\n* How do I create static class data and static class methods?::\n* How can I overload constructors (or methods) in Python?: How can I overload constructors or methods in Python?.\n* I try to use spam and I get an error about SomeClassNamespam.: I try to use spam and I get an error about SomeClassNamespam.\n* 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.\n* How do I get a list of all instances of a given class?::\n* Why does the result of id() appear to be not unique?: Why does the result of id appear to be not unique?.\n* When can I rely on identity tests with the is operator?::\n* How can a subclass control what data is stored in an immutable instance?::\n* How do I cache method calls?::\n\nFile: python3.12.info,  Node: What is a class?,  Next: What is a method?,  Up: Objects\n\n10.2.6.1 What is a class?\n.........................\n\nA class is the particular object type created by executing a class\nstatement.  Class objects are used as templates to create instance\nobjects, which embody both the data (attributes) and code (methods)\nspecific to a datatype.\n\nA class can be based on one or more other classes, called its base\nclass(es).  It then inherits the attributes and methods of its base\nclasses.  This allows an object model to be successively refined by\ninheritance.  You might have a generic 'Mailbox' class that provides\nbasic accessor methods for a mailbox, and subclasses such as\n'MboxMailbox', 'MaildirMailbox', 'OutlookMailbox' that handle various\nspecific mailbox formats.\n\nFile: python3.12.info,  Node: What is a method?,  Next: What is self?,  Prev: What is a class?,  Up: Objects\n\n10.2.6.2 What is a method?\n..........................\n\nA method is a function on some object 'x' that you normally call as\n'x.name(arguments...)'.  Methods are defined as functions inside the\nclass definition:\n\nclass C:\ndef meth(self, arg):\nreturn arg * 2 + self.attribute\n\nFile: python3.12.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\n\n10.2.6.3 What is self?\n......................\n\nSelf is merely a conventional name for the first argument of a method.\nA method defined as 'meth(self, a, b, c)' should be called as 'x.meth(a,\nb, c)' for some instance 'x' of the class in which the definition\noccurs; the called method will think it is called as 'meth(x, a, b, c)'.\n\nSee also *note Why must 'self' be used explicitly in method definitions\nand calls?: 4e47.\n\nFile: python3.12.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\n\n10.2.6.4 How do I check if an object is an instance of a given class or of a subclass of it?\n............................................................................................\n\nUse the built-in function *note isinstance(obj, cls): 14b.  You can\ncheck if an object is an instance of any of a number of classes by\nproviding a tuple instead of a single class, e.g.  'isinstance(obj,\n(class1, class2, ...))', and can also check whether an object is one of",
            "subsections": []
        },
        "Python's built-in types, e.g.  'isinstance(obj, str)' or": {
            "content": "'isinstance(obj, (int, float, complex))'.\n\nNote that *note isinstance(): 14b. also checks for virtual inheritance\nfrom an *note abstract base class: 102a.  So, the test will return\n'True' for a registered class even if hasn't directly or indirectly\ninherited from it.  To test for \"true inheritance\", scan the *note MRO:\n3249. of the class:\n\nfrom collections.abc import Mapping\n\nclass P:\npass\n\nclass C(P):\npass\n\nMapping.register(P)\n\n>>> c = C()\n>>> isinstance(c, C)        # direct\nTrue\n>>> isinstance(c, P)        # indirect\nTrue\n>>> isinstance(c, Mapping)  # virtual\nTrue\n\n# Actual inheritance chain\n>>> type(c).mro\n(<class 'C'>, <class 'P'>, <class 'object'>)\n\n# Test for \"true inheritance\"\n>>> Mapping in type(c).mro\nFalse\n\nNote that most programs do not use *note isinstance(): 14b. on\nuser-defined classes very often.  If you are developing the classes\nyourself, a more proper object-oriented style is to define methods on\nthe classes that encapsulate a particular behaviour, instead of checking\nthe object's class and doing a different thing based on what class it\nis.  For example, if you have a function that does something:\n\ndef search(obj):\nif isinstance(obj, Mailbox):\n...  # code to search a mailbox\nelif isinstance(obj, Document):\n...  # code to search a document\nelif ...\n\nA better approach is to define a 'search()' method on all the classes\nand just call it:\n\nclass Mailbox:\ndef search(self):\n...  # code to search a mailbox\n\nclass Document:\ndef search(self):\n...  # code to search a document\n\nobj.search()\n\nFile: python3.12.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\n\n10.2.6.5 What is delegation?\n............................\n",
            "subsections": []
        },
        "Delegation is an object oriented technique (also called a design": {
            "content": "pattern).  Let's say you have an object 'x' and want to change the\nbehaviour of just one of its methods.  You can create a new class that\nprovides a new implementation of the method you're interested in\nchanging and delegates all other methods to the corresponding method of\n'x'.\n",
            "subsections": []
        },
        "Python programmers can easily implement delegation.  For example, the": {
            "content": "following class implements a class that behaves like a file but converts\nall written data to uppercase:\n\nclass UpperOut:\n\ndef init(self, outfile):\nself.outfile = outfile\n\ndef write(self, s):\nself.outfile.write(s.upper())\n\ndef getattr(self, name):\nreturn getattr(self.outfile, name)\n",
            "subsections": []
        },
        "Here the 'UpperOut' class redefines the 'write()' method to convert the": {
            "content": "argument string to uppercase before calling the underlying\n'self.outfile.write()' method.  All other methods are delegated to the\nunderlying 'self.outfile' object.  The delegation is accomplished via\nthe *note getattr(): 1f8. method; consult *note the language\nreference: 1c69. for more information about controlling attribute\naccess.\n",
            "subsections": []
        },
        "Note that for more general cases delegation can get trickier.  When": {
            "content": "attributes must be set as well as retrieved, the class must define a\n*note setattr(): 1c35. method too, and it must do so carefully.  The\nbasic implementation of 'setattr()' is roughly equivalent to the\nfollowing:\n\nclass X:\n...\ndef setattr(self, name, value):\nself.dict[name] = value\n...\n\nMost 'setattr()' implementations must modify *note self.dict:\naa8. to store local state for self without causing an infinite\nrecursion.\n\nFile: python3.12.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\n\n10.2.6.6 How do I call a method defined in a base class from a derived class that extends it?\n.............................................................................................\n\nUse the built-in *note super(): 204. function:\n\nclass Derived(Base):\ndef meth(self):\nsuper().meth()  # calls Base.meth\n\nIn the example, *note super(): 204. will automatically determine the\ninstance from which it was called (the 'self' value), look up the *note\nmethod resolution order: 1e8b. (MRO) with 'type(self).mro', and\nreturn the next in line after 'Derived' in the MRO: 'Base'.\n\nFile: python3.12.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\n\n10.2.6.7 How can I organize my code to make it easier to change the base class?\n...............................................................................\n\nYou could assign the base class to an alias and derive from the alias.\nThen all you have to change is the value assigned to the alias.",
            "subsections": []
        },
        "Incidentally, this trick is also handy if you want to decide dynamically": {
            "content": "(e.g.  depending on availability of resources) which base class to use.\nExample:\n\nclass Base:\n...\n\nBaseAlias = Base\n\nclass Derived(BaseAlias):\n...\n\nFile: python3.12.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\n\n10.2.6.8 How do I create static class data and static class methods?\n....................................................................\n\nBoth static data and static methods (in the sense of C++ or Java) are\nsupported in Python.\n",
            "subsections": []
        },
        "For static data, simply define a class attribute.  To assign a new value": {
            "content": "to the attribute, you have to explicitly use the class name in the\nassignment:\n\nclass C:\ncount = 0   # number of times C.init called\n\ndef init(self):\nC.count = C.count + 1\n\ndef getcount(self):\nreturn C.count  # or return self.count\n\n'c.count' also refers to 'C.count' for any 'c' such that 'isinstance(c,\nC)' holds, unless overridden by 'c' itself or by some class on the\nbase-class search path from 'c.class' back to 'C'.\n\nCaution: within a method of C, an assignment like 'self.count = 42'\ncreates a new and unrelated instance named \"count\" in 'self''s own dict.",
            "subsections": []
        },
        "Rebinding of a class-static data name must always specify the class": {
            "content": "whether inside a method or not:\n\nC.count = 314\n\nStatic methods are possible:\n\nclass C:\n@staticmethod\ndef static(arg1, arg2, arg3):\n# No 'self' parameter!\n...\n",
            "subsections": []
        },
        "However, a far more straightforward way to get the effect of a static": {
            "content": "method is via a simple module-level function:\n\ndef getcount():\nreturn C.count\n",
            "subsections": []
        },
        "If your code is structured so as to define one class (or tightly related": {
            "content": "class hierarchy) per module, this supplies the desired encapsulation.\n\nFile: python3.12.info,  Node: How can I overload constructors or methods in Python?,  Next: I try to use spam and I get an error about SomeClassNamespam,  Prev: How do I create static class data and static class methods?,  Up: Objects\n\n10.2.6.9 How can I overload constructors (or methods) in Python?\n................................................................\n",
            "subsections": []
        },
        "This answer actually applies to all methods, but the question usually": {
            "content": "comes up first in the context of constructors.\n\nIn C++ you'd write\n\nclass C {\nC() { cout << \"No arguments\\n\"; }\nC(int i) { cout << \"Argument is \" << i << \"\\n\"; }\n}\n",
            "subsections": []
        },
        "In Python you have to write a single constructor that catches all cases": {
            "content": "using default arguments.  For example:\n\nclass C:\ndef init(self, i=None):\nif i is None:\nprint(\"No arguments\")\nelse:\nprint(\"Argument is\", i)\n\nThis is not entirely equivalent, but close enough in practice.\n\nYou could also try a variable-length argument list, e.g.\n\ndef init(self, *args):\n...\n\nThe same approach works for all method definitions.\n\nFile: python3.12.info,  Node: I try to use spam and I get an error about SomeClassNamespam,  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\n\n10.2.6.10 I try to use spam and I get an error about SomeClassNamespam.\n............................................................................\n\nVariable names with double leading underscores are \"mangled\" to provide\na simple but effective way to define class private variables.  Any\nidentifier of the form 'spam' (at least two leading underscores, at\nmost one trailing underscore) is textually replaced with\n'classnamespam', where 'classname' is the current class name with any\nleading underscores stripped.\n",
            "subsections": []
        },
        "This doesn't guarantee privacy: an outside user can still deliberately": {
            "content": "access the \"classnamespam\" attribute, and private values are visible\nin the object's 'dict'.  Many Python programmers never bother to use\nprivate variable names at all.\n\nFile: python3.12.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 SomeClassNamespam,  Up: Objects\n\n10.2.6.11 My class defines del but it is not called when I delete the object.\n.................................................................................\n\nThere are several possible reasons for this.\n\nThe *note del: 14fb. statement does not necessarily call *note\ndel(): 1c66. - it simply decrements the object's reference count,\nand if this reaches zero 'del()' is called.\n",
            "subsections": []
        },
        "If your data structures contain circular links (e.g.  a tree where each": {
            "content": "child has a parent reference and each parent has a list of children) the\nreference counts will never go back to zero.  Once in a while Python\nruns an algorithm to detect such cycles, but the garbage collector might\nrun some time after the last reference to your data structure vanishes,\nso your 'del()' method may be called at an inconvenient and random\ntime.  This is inconvenient if you're trying to reproduce a problem.",
            "subsections": []
        },
        "Worse, the order in which object's 'del()' methods are executed is": {
            "content": "arbitrary.  You can run *note gc.collect(): 865. to force a collection,\nbut there 'are' pathological cases where objects will never be\ncollected.\n",
            "subsections": []
        },
        "Despite the cycle collector, it's still a good idea to define an": {
            "content": "explicit 'close()' method on objects to be called whenever you're done\nwith them.  The 'close()' method can then remove attributes that refer\nto subobjects.  Don't call 'del()' directly - 'del()' should\ncall 'close()' and 'close()' should make sure that it can be called more\nthan once for the same object.\n\nAnother way to avoid cyclical references is to use the *note weakref:\n10f. module, which allows you to point to objects without incrementing\ntheir reference count.  Tree data structures, for instance, should use\nweak references for their parent and sibling references (if they need\nthem!).\n",
            "subsections": []
        },
        "Finally, if your 'del()' method raises an exception, a warning": {
            "content": "message is printed to *note sys.stderr: 757.\n\nFile: python3.12.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\n\n10.2.6.12 How do I get a list of all instances of a given class?\n................................................................\n",
            "subsections": []
        },
        "Python does not keep track of all instances of a class (or of a built-in": {
            "content": "type).  You can program the class's constructor to keep track of all\ninstances by keeping a list of weak references to each instance.\n\nFile: python3.12.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\n\n10.2.6.13 Why does the result of 'id()' appear to be not unique?\n................................................................\n\nThe *note id(): 1279. builtin returns an integer that is guaranteed to\nbe unique during the lifetime of the object.  Since in CPython, this is\nthe object's memory address, it happens frequently that after an object\nis deleted from memory, the next freshly created object is allocated at\nthe same position in memory.  This is illustrated by this example:\n\n>>> id(1000)\n13901272\n>>> id(2000)\n13901272\n",
            "subsections": []
        },
        "The two ids belong to different integer objects that are created before,": {
            "content": "and deleted immediately after execution of the 'id()' call.  To be sure\nthat objects whose id you want to examine are still alive, create\nanother reference to the object:\n\n>>> a = 1000; b = 2000\n>>> id(a)\n13901272\n>>> id(b)\n13891296\n\nFile: python3.12.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\n\n10.2.6.14 When can I rely on identity tests with the 'is' operator?\n...................................................................\n",
            "subsections": []
        },
        "The 'is' operator tests for object identity.  The test 'a is b' is": {
            "content": "equivalent to 'id(a) == id(b)'.\n",
            "subsections": []
        },
        "The most important property of an identity test is that an object is": {
            "content": "always identical to itself, 'a is a' always returns 'True'.  Identity\ntests are usually faster than equality tests.  And unlike equality\ntests, identity tests are guaranteed to return a boolean 'True' or\n'False'.\n",
            "subsections": []
        },
        "However, identity tests can 'only' be substituted for equality tests": {
            "content": "when object identity is assured.  Generally, there are three\ncircumstances where identity is guaranteed:\n\n1) Assignments create new names but do not change object identity.\nAfter the assignment 'new = old', it is guaranteed that 'new is old'.\n\n2) Putting an object in a container that stores object references does\nnot change object identity.  After the list assignment 's[0] = x', it is\nguaranteed that 's[0] is x'.\n\n3) If an object is a singleton, it means that only one instance of that\nobject can exist.  After the assignments 'a = None' and 'b = None', it\nis guaranteed that 'a is b' because 'None' is a singleton.\n",
            "subsections": []
        },
        "In most other circumstances, identity tests are inadvisable and equality": {
            "content": "tests are preferred.  In particular, identity tests should not be used\nto check constants such as *note int: 17e. and *note str: 157. which\naren't guaranteed to be singletons:\n\n>>> a = 1000\n>>> b = 500\n>>> c = b + 500\n>>> a is c\nFalse\n\n>>> a = 'Python'\n>>> b = 'Py'\n>>> c = b + 'thon'\n>>> a is c\nFalse\n\nLikewise, new instances of mutable containers are never identical:\n\n>>> a = []\n>>> b = []\n>>> a is b\nFalse\n",
            "subsections": []
        },
        "In the standard library code, you will see several common patterns for": {
            "content": "correctly using identity tests:\n\n1) As recommended by PEP 8(1), an identity test is the preferred way to\ncheck for 'None'.  This reads like plain English in code and avoids\nconfusion with other objects that may have boolean values that evaluate\nto false.\n\n2) Detecting optional arguments can be tricky when 'None' is a valid\ninput value.  In those situations, you can create a singleton sentinel\nobject guaranteed to be distinct from other objects.  For example, here\nis how to implement a method that behaves like *note dict.pop(): 1f51.:\n\nsentinel = object()\n\ndef pop(self, key, default=sentinel):\nif key in self:\nvalue = self[key]\ndel self[key]\nreturn value\nif default is sentinel:\nraise KeyError(key)\nreturn default\n\n3) Container implementations sometimes need to augment equality tests\nwith identity tests.  This prevents the code from being confused by\nobjects such as 'float('NaN')' that are not equal to themselves.\n",
            "subsections": []
        },
        "For example, here is the implementation of": {
            "content": "'collections.abc.Sequence.contains()':\n\ndef contains(self, value):\nfor v in self:\nif v is value or v == value:\nreturn True\nreturn False\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0008/\n\nFile: python3.12.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\n\n10.2.6.15 How can a subclass control what data is stored in an immutable instance?\n..................................................................................\n\nWhen subclassing an immutable type, override the *note new(): 2e2.\nmethod instead of the *note init(): 47d. method.  The latter only\nruns 'after' an instance is created, which is too late to alter data in\nan immutable instance.\n",
            "subsections": []
        },
        "All of these immutable classes have a different signature than their": {
            "content": "parent class:\n\nfrom datetime import date\n\nclass FirstOfMonthDate(date):\n\"Always choose the first day of the month\"\ndef new(cls, year, month, day):\nreturn super().new(cls, year, month, 1)\n\nclass NamedInt(int):\n\"Allow text names for some numbers\"\nxlat = {'zero': 0, 'one': 1, 'ten': 10}\ndef new(cls, value):\nvalue = cls.xlat.get(value, value)\nreturn super().new(cls, value)\n\nclass TitleStr(str):\n\"Convert str to name suitable for a URL path\"\ndef new(cls, s):\ns = s.lower().replace(' ', '-')\ns = ''.join([c for c in s if c.isalnum() or c == '-'])\nreturn super().new(cls, s)\n\nThe classes can be used like this:\n\n>>> FirstOfMonthDate(2012, 2, 14)\nFirstOfMonthDate(2012, 2, 1)\n>>> NamedInt('ten')\n10\n>>> NamedInt(20)\n20\n>>> TitleStr('Blog: Why Python Rocks')\n'blog-why-python-rocks'\n\nFile: python3.12.info,  Node: How do I cache method calls?,  Prev: How can a subclass control what data is stored in an immutable instance?,  Up: Objects\n\n10.2.6.16 How do I cache method calls?\n......................................\n\nThe two principal tools for caching methods are *note\nfunctools.cachedproperty(): 299. and *note functools.lrucache(): 815.",
            "subsections": []
        },
        "The former stores results at the instance level and the latter at the": {
            "content": "class level.\n",
            "subsections": []
        },
        "The 'cachedproperty' approach only works with methods that do not take": {
            "content": "any arguments.  It does not create a reference to the instance.  The\ncached method result will be kept only as long as the instance is alive.\n",
            "subsections": []
        },
        "The advantage is that when an instance is no longer used, the cached": {
            "content": "method result will be released right away.  The disadvantage is that if\ninstances accumulate, so too will the accumulated method results.  They\ncan grow without bound.\n\nThe 'lrucache' approach works with methods that have *note hashable:\n3db. arguments.  It creates a reference to the instance unless special\nefforts are made to pass in weak references.\n",
            "subsections": []
        },
        "The advantage of the least recently used algorithm is that the cache is": {
            "content": "bounded by the specified 'maxsize'.  The disadvantage is that instances\nare kept alive until they age out of the cache or until the cache is\ncleared.\n\nThis example shows the various techniques:\n\nclass Weather:\n\"Lookup weather information on a government website\"\n\ndef init(self, stationid):\nself.stationid = stationid\n# The stationid is private and immutable\n\ndef currenttemperature(self):\n\"Latest hourly observation\"\n# Do not cache this because old results\n# can be out of date.\n\n@cachedproperty\ndef location(self):\n\"Return the longitude/latitude coordinates of the station\"\n# Result only depends on the stationid\n\n@lrucache(maxsize=20)\ndef historicrainfall(self, date, units='mm'):\n\"Rainfall on a given date\"\n# Depends on the stationid, date, and units.\n",
            "subsections": []
        },
        "The above example assumes that the 'stationid' never changes.  If the": {
            "content": "relevant instance attributes are mutable, the 'cachedproperty' approach\ncan't be made to work because it cannot detect changes to the\nattributes.\n",
            "subsections": []
        },
        "To make the 'lrucache' approach work when the 'stationid' is mutable,": {
            "content": "the class needs to define the *note eq(): 931. and *note hash():\n932. methods so that the cache can detect relevant attribute updates:\n\nclass Weather:\n\"Example with a mutable station identifier\"\n\ndef init(self, stationid):\nself.stationid = stationid\n\ndef changestation(self, stationid):\nself.stationid = stationid\n\ndef eq(self, other):\nreturn self.stationid == other.stationid\n\ndef hash(self):\nreturn hash(self.stationid)\n\n@lrucache(maxsize=20)\ndef historicrainfall(self, date, units='cm'):\n'Rainfall on a given date'\n# Depends on the stationid, date, and units.\n\nFile: python3.12.info,  Node: Modules<5>,  Prev: Objects,  Up: Programming FAQ\n\n\n* Menu:\n\n* How do I create a .pyc file?: How do I create a pyc file?.\n* How do I find the current module name?::\n* How can I have modules that mutually import each other?::\n* import('x.y.z') returns <module 'x'>; how do I get z?: import 'x y z' returns <module 'x'>; how do I get z?.\n* 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?.\n\nFile: python3.12.info,  Node: How do I create a pyc file?,  Next: How do I find the current module name?,  Up: Modules<5>\n\n10.2.7.1 How do I create a .pyc file?\n.....................................\n",
            "subsections": []
        },
        "When a module is imported for the first time (or when the source file": {
            "content": "has changed since the current compiled file was created) a '.pyc' file\ncontaining the compiled code should be created in a 'pycache'\nsubdirectory of the directory containing the '.py' file.  The '.pyc'\nfile will have a filename that starts with the same name as the '.py'\nfile, and ends with '.pyc', with a middle component that depends on the\nparticular 'python' binary that created it.  (See PEP 3147(1) for\ndetails.)\n",
            "subsections": []
        },
        "One reason that a '.pyc' file may not be created is a permissions": {
            "content": "problem with the directory containing the source file, meaning that the\n'pycache' subdirectory cannot be created.  This can happen, for\nexample, if you develop as one user but run as another, such as if you\nare testing with a web server.\n\nUnless the *note PYTHONDONTWRITEBYTECODE: 1223. environment variable is\nset, creation of a .pyc file is automatic if you're importing a module\nand Python has the ability (permissions, free space, etc...) to create a\n'pycache' subdirectory and write the compiled module to that\nsubdirectory.\n",
            "subsections": []
        },
        "Running Python on a top level script is not considered an import and no": {
            "content": "'.pyc' will be created.  For example, if you have a top-level module\n'foo.py' that imports another module 'xyz.py', when you run 'foo' (by\ntyping 'python foo.py' as a shell command), a '.pyc' will be created for\n'xyz' because 'xyz' is imported, but no '.pyc' file will be created for\n'foo' since 'foo.py' isn't being imported.\n",
            "subsections": []
        },
        "If you need to create a '.pyc' file for 'foo' - that is, to create a": {
            "content": "'.pyc' file for a module that is not imported - you can, using the *note\npycompile: ae. and *note compileall: 1e. modules.\n\nThe *note pycompile: ae. module can manually compile any module.  One\nway is to use the 'compile()' function in that module interactively:\n\n>>> import pycompile\n>>> pycompile.compile('foo.py')\n",
            "subsections": []
        },
        "This will write the '.pyc' to a 'pycache' subdirectory in the same": {
            "content": "location as 'foo.py' (or you can override that with the optional\nparameter 'cfile').\n",
            "subsections": []
        },
        "You can also automatically compile all files in a directory or": {
            "content": "directories using the *note compileall: 1e. module.  You can do it from\nthe shell prompt by running 'compileall.py' and providing the path of a\ndirectory containing Python files to compile:\n\npython -m compileall .\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-3147/\n\nFile: python3.12.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>\n\n10.2.7.2 How do I find the current module name?\n...............................................\n\nA module can find out its own module name by looking at the predefined\nglobal variable 'name'.  If this has the value ''main'', the\nprogram is running as a script.  Many modules that are usually used by\nimporting them also provide a command-line interface or a self-test, and\nonly execute this code after checking 'name':\n\ndef main():\nprint('Running test...')\n...\n\nif name == 'main':\nmain()\n\nFile: python3.12.info,  Node: How can I have modules that mutually import each other?,  Next: import 'x y z' returns <module 'x'>; how do I get z?,  Prev: How do I find the current module name?,  Up: Modules<5>\n\n10.2.7.3 How can I have modules that mutually import each other?\n................................................................\n\nSuppose you have the following modules:\n\n'foo.py':\n\nfrom bar import barvar\nfoovar = 1\n\n'bar.py':\n\nfrom foo import foovar\nbarvar = 2\n\nThe problem is that the interpreter will perform the following steps:\n\n* main imports 'foo'\n\n* Empty globals for 'foo' are created\n\n* 'foo' is compiled and starts executing\n\n* 'foo' imports 'bar'\n\n* Empty globals for 'bar' are created\n\n* 'bar' is compiled and starts executing\n\n* 'bar' imports 'foo' (which is a no-op since there already is a\nmodule named 'foo')\n\n* The import mechanism tries to read 'foovar' from 'foo' globals, to\nset 'bar.foovar = foo.foovar'\n",
            "subsections": []
        },
        "The last step fails, because Python isn't done with interpreting 'foo'": {
            "content": "yet and the global symbol dictionary for 'foo' is still empty.\n",
            "subsections": []
        },
        "The same thing happens when you use 'import foo', and then try to access": {
            "content": "'foo.foovar' in global code.\n\nThere are (at least) three possible workarounds for this problem.\n\nGuido van Rossum recommends avoiding all uses of 'from <module> import\n...', and placing all code inside functions.  Initializations of global\nvariables and class variables should use constants or built-in functions\nonly.  This means everything from an imported module is referenced as\n'<module>.<name>'.\n",
            "subsections": []
        },
        "Jim Roskind suggests performing steps in the following order in each": {
            "content": "module:\n\n* exports (globals, functions, and classes that don't need imported\nbase classes)\n\n* 'import' statements\n\n* active code (including globals that are initialized from imported\nvalues).\n",
            "subsections": []
        },
        "Van Rossum doesn't like this approach much because the imports appear in": {
            "content": "a strange place, but it does work.\n",
            "subsections": []
        },
        "Matthias Urlichs recommends restructuring your code so that the": {
            "content": "recursive import is not necessary in the first place.\n\nThese solutions are not mutually exclusive.\n\nFile: python3.12.info,  Node: import 'x y z' returns <module 'x'>; 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>\n\n10.2.7.4 import('x.y.z') returns <module 'x'>; how do I get z?\n..................................................................\n\nConsider using the convenience function *note importmodule(): 26a. from\n*note importlib: 71. instead:\n\nz = importlib.importmodule('x.y.z')\n\nFile: python3.12.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 <module 'x'>; how do I get z?,  Up: Modules<5>\n\n10.2.7.5 When I edit an imported module and reimport it, the changes don't show up. Why does this happen?\n.........................................................................................................\n",
            "subsections": []
        },
        "For reasons of efficiency as well as consistency, Python only reads the": {
            "content": "module file on the first time a module is imported.  If it didn't, in a\nprogram consisting of many modules where each one imports the same basic\nmodule, the basic module would be parsed and re-parsed many times.  To\nforce re-reading of a changed module, do this:\n\nimport importlib\nimport modname\nimportlib.reload(modname)\n\nWarning: this technique is not 100% fool-proof.  In particular, modules\ncontaining statements like\n\nfrom modname import someobjects\n\nwill continue to work with the old version of the imported objects.  If\nthe module contains class definitions, existing class instances will\n'not' be updated to use the new class definition.  This can result in\nthe following paradoxical behaviour:\n\n>>> import importlib\n>>> import cls\n>>> c = cls.C()                # Create an instance of C\n>>> importlib.reload(cls)\n<module 'cls' from 'cls.py'>\n>>> isinstance(c, cls.C)       # isinstance is false?!?\nFalse\n\nThe nature of the problem is made clear if you print out the \"identity\"\nof the class objects:\n\n>>> hex(id(c.class))\n'0x7352a0'\n>>> hex(id(cls.C))\n'0x4198d0'\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Design and History FAQ,  Next: Library and Extension FAQ,  Prev: Programming FAQ,  Up: Python Frequently Asked Questions": {
            "content": "",
            "subsections": [
                {
                    "name": "10.3 Design and History FAQ",
                    "content": "* Menu:\n\n* Why does Python use indentation for grouping of statements?::\n* Why am I getting strange results with simple arithmetic operations?::\n* Why are floating-point calculations so inaccurate?::\n* Why are Python strings immutable?::\n* Why must 'self' be used explicitly in method definitions and calls?::\n* Why can't I use an assignment in an expression?::\n* 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 ?.\n* 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?.\n* How fast are exceptions?::\n* Why isn't there a switch or case statement in Python?::\n* Can't you emulate threads in the interpreter instead of relying on an OS-specific thread implementation?::\n* Why can't lambda expressions contain statements?::\n* Can Python be compiled to machine code, C or some other language?: Can Python be compiled to machine code C or some other language?.\n* How does Python manage memory?::\n* Why doesn't CPython use a more traditional garbage collection scheme?::\n* Why isn't all memory freed when CPython exits?::\n* Why are there separate tuple and list data types?::\n* How are lists implemented in CPython?::\n* How are dictionaries implemented in CPython?::\n* Why must dictionary keys be immutable?::\n* Why doesn't list.sort() return the sorted list?: Why doesn't list sort return the sorted list?.\n* How do you specify and enforce an interface spec in Python?::\n* Why is there no goto?::\n* Why can't raw strings (r-strings) end with a backslash?: Why can't raw strings r-strings end with a backslash?.\n* Why doesn't Python have a \"with\" statement for attribute assignments?::\n* Why don't generators support the with statement?::\n* Why are colons required for the if/while/def/class statements?::\n* Why does Python allow commas at the end of lists and tuples?::\n\nFile: python3.12.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\n\n"
                }
            ]
        },
        "Guido van Rossum believes that using indentation for grouping is": {
            "content": "extremely elegant and contributes a lot to the clarity of the average\nPython program.  Most people learn to love this feature after a while.\n",
            "subsections": []
        },
        "Since there are no begin/end brackets there cannot be a disagreement": {
            "content": "between grouping perceived by the parser and the human reader.\nOccasionally C programmers will encounter a fragment of code like this:\n\nif (x <= y)\nx++;\ny--;\nz++;\n\nOnly the 'x++' statement is executed if the condition is true, but the\nindentation leads many to believe otherwise.  Even experienced C\nprogrammers will sometimes stare at it a long time wondering as to why\n'y' is being decremented even for 'x > y'.\n",
            "subsections": []
        },
        "Because there are no begin/end brackets, Python is much less prone to": {
            "content": "coding-style conflicts.  In C there are many different ways to place the\nbraces.  After becoming used to reading and writing code using a\nparticular style, it is normal to feel somewhat uneasy when reading (or\nbeing required to write) in a different one.\n\nMany coding styles place begin/end brackets on a line by themselves.",
            "subsections": []
        },
        "This makes programs considerably longer and wastes valuable screen": {
            "content": "space, making it harder to get a good overview of a program.  Ideally, a\nfunction should fit on one screen (say, 20-30 lines).  20 lines of",
            "subsections": []
        },
        "Python can do a lot more work than 20 lines of C. This is not solely due": {
            "content": "to the lack of begin/end brackets - the lack of declarations and the\nhigh-level data types are also responsible - but the indentation-based\nsyntax certainly helps.\n\nFile: python3.12.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\n\n\nSee the next question.\n\nFile: python3.12.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\n\n\nUsers are often surprised by results like this:\n\n>>> 1.2 - 1.0\n0.19999999999999996\n\nand think it is a bug in Python.  It's not.  This has little to do with",
            "subsections": []
        },
        "Python, and much more to do with how the underlying platform handles": {
            "content": "floating-point numbers.\n\nThe *note float: 4b7. type in CPython uses a C 'double' for storage.  A\n*note float: 4b7. object's value is stored in binary floating-point with\na fixed precision (typically 53 bits) and Python uses C operations,\nwhich in turn rely on the hardware implementation in the processor, to\nperform floating-point operations.  This means that as far as\nfloating-point operations are concerned, Python behaves like many\npopular languages including C and Java.\n",
            "subsections": []
        },
        "Many numbers that can be written easily in decimal notation cannot be": {
            "content": "expressed exactly in binary floating-point.  For example, after:\n\n>>> x = 1.2\n\nthe value stored for 'x' is a (very good) approximation to the decimal\nvalue '1.2', but is not exactly equal to it.  On a typical machine, the\nactual stored value is:\n\n1.0011001100110011001100110011001100110011001100110011 (binary)\n\nwhich is exactly:\n\n1.1999999999999999555910790149937383830547332763671875 (decimal)\n",
            "subsections": []
        },
        "The typical precision of 53 bits provides Python floats with 15-16": {
            "content": "decimal digits of accuracy.\n\nFor a fuller explanation, please see the *note floating point\narithmetic: 1a94. chapter in the Python tutorial.\n\nFile: python3.12.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\n\n\nThere are several advantages.\n",
            "subsections": []
        },
        "One is performance: knowing that a string is immutable means we can": {
            "content": "allocate space for it at creation time, and the storage requirements are\nfixed and unchanging.  This is also one of the reasons for the\ndistinction between tuples and lists.\n",
            "subsections": []
        },
        "Another advantage is that strings in Python are considered as": {
            "content": "\"elemental\" as numbers.  No amount of activity will change the value 8\nto anything else, and in Python, no amount of activity will change the\nstring \"eight\" to anything else.\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "The idea was borrowed from Modula-3.  It turns out to be very useful,": {
            "content": "for a variety of reasons.\n",
            "subsections": []
        },
        "First, it's more obvious that you are using a method or instance": {
            "content": "attribute instead of a local variable.  Reading 'self.x' or\n'self.meth()' makes it absolutely clear that an instance variable or\nmethod is used even if you don't know the class definition by heart.  In\nC++, you can sort of tell by the lack of a local variable declaration\n(assuming globals are rare or easily recognizable) - but in Python,\nthere are no local variable declarations, so you'd have to look up the\nclass definition to be sure.  Some C++ and Java coding standards call\nfor instance attributes to have an 'm' prefix, so this explicitness is\nstill useful in those languages, too.\n",
            "subsections": []
        },
        "Second, it means that no special syntax is necessary if you want to": {
            "content": "explicitly reference or call the method from a particular class.  In\nC++, if you want to use a method from a base class which is overridden\nin a derived class, you have to use the '::' operator - in Python you\ncan write 'baseclass.methodname(self, <argument list>)'.  This is\nparticularly useful for *note init(): 47d. methods, and in general\nin cases where a derived class method wants to extend the base class\nmethod of the same name and thus has to call the base class method\nsomehow.\n",
            "subsections": []
        },
        "Finally, for instance variables it solves a syntactic problem with": {
            "content": "assignment: since local variables in Python are (by definition!)  those\nvariables to which a value is assigned in a function body (and that\naren't explicitly declared global), there has to be some way to tell the\ninterpreter that an assignment was meant to assign to an instance\nvariable instead of to a local variable, and it should preferably be\nsyntactic (for efficiency reasons).  C++ does this through declarations,\nbut Python doesn't have declarations and it would be a pity having to\nintroduce them just for this purpose.  Using the explicit 'self.var'\nsolves this nicely.  Similarly, for using instance variables, having to\nwrite 'self.var' means that references to unqualified names inside a\nmethod don't have to search the instance's directories.  To put it\nanother way, local variables and instance variables live in two\ndifferent namespaces, and you need to tell Python which namespace to\nuse.\n\nFile: python3.12.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\n\n\nStarting in Python 3.8, you can!\n\nAssignment expressions using the walrus operator ':=' assign a variable\nin an expression:\n\nwhile chunk := fp.read(200):\nprint(chunk)\n\nSee PEP 572(1) for more information.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0572/\n\nFile: python3.12.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\n\n\nAs Guido said:\n\n(a) For some operations, prefix notation just reads better than\npostfix - prefix (and infix!)  operations have a long tradition in\nmathematics which likes notations where the visuals help the\nmathematician thinking about a problem.  Compare the easy with\nwhich we rewrite a formula like x*(a+b) into x*a + x*b to the\nclumsiness of doing the same thing using a raw OO notation.\n\n(b) When I read code that says len(x) I 'know' that it is asking\nfor the length of something.  This tells me two things: the result\nis an integer, and the argument is some kind of container.  To the\ncontrary, when I read x.len(), I have to already know that x is\nsome kind of container implementing an interface or inheriting from\na class that has a standard len().  Witness the confusion we\noccasionally have when a class that is not implementing a mapping\nhas a get() or keys() method, or something that isn't a file has a\nwrite() method.\n\n-- 'https://mail.python.org/pipermail/python-3000/2006-November/004643.html'\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "Strings became much more like other standard types starting in Python": {
            "content": "1.6, when methods were added which give the same functionality that has\nalways been available using the functions of the string module.  Most of\nthese new methods have been widely accepted, but the one which appears\nto make some programmers feel uncomfortable is:\n\n\", \".join(['1', '2', '4', '8', '16'])\n\nwhich gives the result:\n\n\"1, 2, 4, 8, 16\"\n\nThere are two common arguments against this usage.\n\nThe first runs along the lines of: \"It looks really ugly using a method\nof a string literal (string constant)\", to which the answer is that it\nmight, but a string literal is just a fixed value.  If the methods are\nto be allowed on names bound to strings there is no logical reason to\nmake them unavailable on literals.\n\nThe second objection is typically cast as: \"I am really telling a\nsequence to join its members together with a string constant\".  Sadly,\nyou aren't.  For some reason there seems to be much less difficulty with\nhaving *note split(): d0e. as a string method, since in that case it is\neasy to see that\n\n\"1, 2, 4, 8, 16\".split(\", \")\n\nis an instruction to a string literal to return the substrings delimited\nby the given separator (or, by default, arbitrary runs of white space).\n\n*note join(): 1eb6. is a string method because in using it you are\ntelling the separator string to iterate over a sequence of strings and\ninsert itself between adjacent elements.  This method can be used with\nany argument which obeys the rules for sequence objects, including any\nnew classes you might define yourself.  Similar methods exist for bytes\nand bytearray objects.\n\nFile: python3.12.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\n\n\nA *note try: 4bc./*note except: 379. block is extremely efficient if no\nexceptions are raised.  Actually catching an exception is expensive.  In\nversions of Python prior to 2.0 it was common to use this idiom:\n\ntry:\nvalue = mydict[key]\nexcept KeyError:\nmydict[key] = getvalue(key)\nvalue = mydict[key]\n",
            "subsections": []
        },
        "This only made sense when you expected the dict to have the key almost": {
            "content": "all the time.  If that wasn't the case, you coded it like this:\n\nif key in mydict:\nvalue = mydict[key]\nelse:\nvalue = mydict[key] = getvalue(key)\n\nFor this specific case, you could also use 'value = dict.setdefault(key,\ngetvalue(key))', but only if the 'getvalue()' call is cheap enough\nbecause it is evaluated in all cases.\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "In general, structured switch statements execute one block of code when": {
            "content": "an expression has a particular value or set of values.  Since Python\n3.10 one can easily match literal values, or constants within a\nnamespace, with a 'match ... case' statement.  An older alternative is a\nsequence of 'if... elif... elif... else'.\n",
            "subsections": []
        },
        "For cases where you need to choose from a very large number of": {
            "content": "possibilities, you can create a dictionary mapping case values to\nfunctions to call.  For example:\n\nfunctions = {'a': function1,\n'b': function2,\n'c': self.method1}\n\nfunc = functions[value]\nfunc()\n",
            "subsections": []
        },
        "For calling methods on objects, you can simplify yet further by using": {
            "content": "the *note getattr(): a15. built-in to retrieve methods with a particular\nname:\n\nclass MyVisitor:\ndef visita(self):\n...\n\ndef dispatch(self, value):\nmethodname = 'visit' + str(value)\nmethod = getattr(self, methodname)\nmethod()\n",
            "subsections": []
        },
        "It's suggested that you use a prefix for the method names, such as": {
            "content": "'visit' in this example.  Without such a prefix, if values are coming\nfrom an untrusted source, an attacker would be able to call any method\non your object.\n",
            "subsections": []
        },
        "Imitating switch with fallthrough, as with C's switch-case-default, is": {
            "content": "possible, much harder, and less needed.\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "Answer 1: Unfortunately, the interpreter pushes at least one C stack": {
            "content": "frame for each Python stack frame.  Also, extensions can call back into",
            "subsections": []
        },
        "Python at almost random moments.  Therefore, a complete threads": {
            "content": "implementation requires thread support for C.\n",
            "subsections": []
        },
        "Answer 2: Fortunately, there is Stackless Python(1), which has a": {
            "content": "completely redesigned interpreter loop that avoids the C stack.\n\n---------- Footnotes ----------\n\n(1) https://github.com/stackless-dev/stackless/wiki\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "Python lambda expressions cannot contain statements because Python's": {
            "content": "syntactic framework can't handle statements nested inside expressions.",
            "subsections": []
        },
        "However, in Python, this is not a serious problem.  Unlike lambda forms": {
            "content": "in other languages, where they add functionality, Python lambdas are\nonly a shorthand notation if you're too lazy to define a function.\n",
            "subsections": []
        },
        "Functions are already first class objects in Python, and can be declared": {
            "content": "in a local scope.  Therefore the only advantage of using a lambda\ninstead of a locally defined function is that you don't need to invent a\nname for the function - but that's just a local variable to which the\nfunction object (which is exactly the same type of object that a lambda\nexpression yields) is assigned!\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "Cython(1) compiles a modified version of Python with optional": {
            "content": "annotations into C extensions.  Nuitka(2) is an up-and-coming compiler\nof Python into C++ code, aiming to support the full Python language.\n\n---------- Footnotes ----------\n\n(1) https://cython.org/\n\n(2) https://www.nuitka.net/\n\nFile: python3.12.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\n\n\nThe details of Python memory management depend on the implementation.\nThe standard implementation of Python, *note CPython: 4c9, uses\nreference counting to detect inaccessible objects, and another mechanism\nto collect reference cycles, periodically executing a cycle detection\nalgorithm which looks for inaccessible cycles and deletes the objects\ninvolved.  The *note gc: 5b. module provides functions to perform a\ngarbage collection, obtain debugging statistics, and tune the\ncollector's parameters.\n",
            "subsections": []
        },
        "Other implementations (such as Jython(1) or PyPy(2)), however, can rely": {
            "content": "on a different mechanism such as a full-blown garbage collector.  This\ndifference can cause some subtle porting problems if your Python code\ndepends on the behavior of the reference counting implementation.\n",
            "subsections": []
        },
        "In some Python implementations, the following code (which is fine in": {
            "content": "CPython) will probably run out of file descriptors:\n\nfor file in verylonglistoffiles:\nf = open(file)\nc = f.read(1)\n",
            "subsections": []
        },
        "Indeed, using CPython's reference counting and destructor scheme, each": {
            "content": "new assignment to 'f' closes the previous file.  With a traditional GC,\nhowever, those file objects will only get collected (and closed) at\nvarying and possibly long intervals.\n",
            "subsections": []
        },
        "If you want to write code that will work with any Python implementation,": {
            "content": "you should explicitly close the file or use the *note with: 396.\nstatement; this will work regardless of memory management scheme:\n\nfor file in verylonglistoffiles:\nwith open(file) as f:\nc = f.read(1)\n\n---------- Footnotes ----------\n\n(1) https://www.jython.org\n\n(2) https://www.pypy.org\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "For one thing, this is not a C standard feature and hence it's not": {
            "content": "portable.  (Yes, we know about the Boehm GC library.  It has bits of\nassembler code for 'most' common platforms, not for all of them, and\nalthough it is mostly transparent, it isn't completely transparent;\npatches are required to get Python to work with it.)\n",
            "subsections": []
        },
        "Traditional GC also becomes a problem when Python is embedded into other": {
            "content": "applications.  While in a standalone Python it's fine to replace the\nstandard 'malloc()' and 'free()' with versions provided by the GC\nlibrary, an application embedding Python may want to have its 'own'\nsubstitute for 'malloc()' and 'free()', and may not want Python's.",
            "subsections": []
        },
        "Right now, CPython works with anything that implements 'malloc()' and": {
            "content": "'free()' properly.\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "Objects referenced from the global namespaces of Python modules are not": {
            "content": "always deallocated when Python exits.  This may happen if there are\ncircular references.  There are also certain bits of memory that are\nallocated by the C library that are impossible to free (e.g.  a tool\nlike Purify will complain about these).  Python is, however, aggressive\nabout cleaning up memory on exit and does try to destroy every single\nobject.\n",
            "subsections": []
        },
        "If you want to force Python to delete certain things on deallocation use": {
            "content": "the *note atexit: a. module to run a function that will force those\ndeletions.\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "Lists and tuples, while similar in many respects, are generally used in": {
            "content": "fundamentally different ways.  Tuples can be thought of as being similar\nto Pascal 'records' or C 'structs'; they're small collections of related\ndata which may be of different types which are operated on as a group.",
            "subsections": []
        },
        "For example, a Cartesian coordinate is appropriately represented as a": {
            "content": "tuple of two or three numbers.\n",
            "subsections": []
        },
        "Lists, on the other hand, are more like arrays in other languages.  They": {
            "content": "tend to hold a varying number of objects all of which have the same type\nand which are operated on one-by-one.  For example, *note\nos.listdir('.'): f6a. returns a list of strings representing the files\nin the current directory.  Functions which operate on this output would\ngenerally not break if you added another file or two to the directory.\n",
            "subsections": []
        },
        "Tuples are immutable, meaning that once a tuple has been created, you": {
            "content": "can't replace any of its elements with a new value.  Lists are mutable,\nmeaning that you can always change a list's elements.  Only immutable\nelements can be used as dictionary keys, and hence only tuples and not\nlists can be used as keys.\n\nFile: python3.12.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\n\n\nCPython's lists are really variable-length arrays, not Lisp-style linked\nlists.  The implementation uses a contiguous array of references to\nother objects, and keeps a pointer to this array and the array's length\nin a list head structure.\n\nThis makes indexing a list 'a[i]' an operation whose cost is independent\nof the size of the list or the value of the index.\n\nWhen items are appended or inserted, the array of references is resized.",
            "subsections": []
        },
        "Some cleverness is applied to improve the performance of appending items": {
            "content": "repeatedly; when the array must be grown, some extra space is allocated\nso the next few times don't require an actual resize.\n\nFile: python3.12.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\n\n\nCPython's dictionaries are implemented as resizable hash tables.",
            "subsections": []
        },
        "Compared to B-trees, this gives better performance for lookup (the most": {
            "content": "common operation by far) under most circumstances, and the\nimplementation is simpler.\n",
            "subsections": []
        },
        "Dictionaries work by computing a hash code for each key stored in the": {
            "content": "dictionary using the *note hash(): 3b1. built-in function.  The hash\ncode varies widely depending on the key and a per-process seed; for\nexample, ''Python'' could hash to '-539294296' while ''python'', a\nstring that differs by a single bit, could hash to '1142331976'.  The\nhash code is then used to calculate a location in an internal array\nwhere the value will be stored.  Assuming that you're storing keys that\nall have different hash values, this means that dictionaries take\nconstant time - 'O'(1), in Big-O notation - to retrieve a key.\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "The hash table implementation of dictionaries uses a hash value": {
            "content": "calculated from the key value to find the key.  If the key were a\nmutable object, its value could change, and thus its hash could also\nchange.  But since whoever changes the key object can't tell that it was\nbeing used as a dictionary key, it can't move the entry around in the\ndictionary.  Then, when you try to look up the same object in the\ndictionary it won't be found because its hash value is different.  If\nyou tried to look up the old value it wouldn't be found either, because\nthe value of the object found in that hash bin would be different.\n",
            "subsections": []
        },
        "If you want a dictionary indexed with a list, simply convert the list to": {
            "content": "a tuple first; the function 'tuple(L)' creates a tuple with the same\nentries as the list 'L'.  Tuples are immutable and can therefore be used\nas dictionary keys.\n\nSome unacceptable solutions that have been proposed:\n\n- Hash lists by their address (object ID). This doesn't work because\nif you construct a new list with the same value it won't be found;\ne.g.:\n\nmydict = {[1, 2]: '12'}\nprint(mydict[[1, 2]])\n\nwould raise a *note KeyError: 8cf. exception because the id of the\n'[1, 2]' used in the second line differs from that in the first\nline.  In other words, dictionary keys should be compared using\n'==', not using *note is: 251.\n\n- Make a copy when using a list as a key.  This doesn't work because\nthe list, being a mutable object, could contain a reference to\nitself, and then the copying code would run into an infinite loop.\n\n- Allow lists as keys but tell the user not to modify them.  This\nwould allow a class of hard-to-track bugs in programs when you\nforgot or modified a list by accident.  It also invalidates an\nimportant invariant of dictionaries: every value in 'd.keys()' is\nusable as a key of the dictionary.\n\n- Mark lists as read-only once they are used as a dictionary key.\nThe problem is that it's not just the top-level object that could\nchange its value; you could use a tuple containing a list as a key.\nEntering anything as a key into a dictionary would require marking\nall objects reachable from there as read-only - and again,\nself-referential objects could cause an infinite loop.\n",
            "subsections": []
        },
        "There is a trick to get around this if you need to, but use it at your": {
            "content": "own risk: You can wrap a mutable structure inside a class instance which\nhas both a *note eq(): 931. and a *note hash(): 932. method.",
            "subsections": []
        },
        "You must then make sure that the hash value for all such wrapper objects": {
            "content": "that reside in a dictionary (or other hash based structure), remain\nfixed while the object is in the dictionary (or other structure).\n\nclass ListWrapper:\ndef init(self, thelist):\nself.thelist = thelist\n\ndef eq(self, other):\nreturn self.thelist == other.thelist\n\ndef hash(self):\nl = self.thelist\nresult = 98767 - len(l)*555\nfor i, el in enumerate(l):\ntry:\nresult = result + (hash(el) % 9999999) * 1001 + i\nexcept Exception:\nresult = (result % 7777777) + i * 333\nreturn result\n",
            "subsections": []
        },
        "Note that the hash computation is complicated by the possibility that": {
            "content": "some members of the list may be unhashable and also by the possibility\nof arithmetic overflow.\n\nFurthermore it must always be the case that if 'o1 == o2' (ie\n'o1.eq(o2) is True') then 'hash(o1) == hash(o2)' (ie, 'o1.hash()\n== o2.hash()'), regardless of whether the object is in a dictionary\nor not.  If you fail to meet these restrictions dictionaries and other\nhash based structures will misbehave.\n",
            "subsections": []
        },
        "In the case of 'ListWrapper', whenever the wrapper object is in a": {
            "content": "dictionary the wrapped list must not change to avoid anomalies.  Don't\ndo this unless you are prepared to think hard about the requirements and\nthe consequences of not meeting them correctly.  Consider yourself\nwarned.\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "In situations where performance matters, making a copy of the list just": {
            "content": "to sort it would be wasteful.  Therefore, *note list.sort(): a13. sorts\nthe list in place.  In order to remind you of that fact, it does not\nreturn the sorted list.  This way, you won't be fooled into accidentally\noverwriting a list when you need a sorted copy but also need to keep the\nunsorted version around.\n\nIf you want to return a new list, use the built-in *note sorted(): a12.\nfunction instead.  This function creates a new list from a provided\niterable, sorts it and returns it.  For example, here's how to iterate\nover the keys of a dictionary in sorted order:\n\nfor key in sorted(mydict):\n...  # do whatever with mydict[key]...\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "An interface specification for a module as provided by languages such as": {
            "content": "C++ and Java describes the prototypes for the methods and functions of\nthe module.  Many feel that compile-time enforcement of interface\nspecifications helps in the construction of large programs.\n\nPython 2.6 adds an *note abc: 4. module that lets you define Abstract\nBase Classes (ABCs).  You can then use *note isinstance(): 14b. and\n*note issubclass(): 5b4. to check whether an instance or a class\nimplements a particular ABC. The *note collections.abc: 1c. module\ndefines a set of useful ABCs such as *note Iterable: 1f5b, *note\nContainer: 1f5d, and *note MutableMapping: f1e.\n",
            "subsections": []
        },
        "For Python, many of the advantages of interface specifications can be": {
            "content": "obtained by an appropriate test discipline for components.\n\nA good test suite for a module can both provide a regression test and\nserve as a module interface specification and a set of examples.  Many\nPython modules can be run as a script to provide a simple \"self test.\"",
            "subsections": []
        },
        "Even modules which use complex external interfaces can often be tested": {
            "content": "in isolation using trivial \"stub\" emulations of the external interface.\nThe *note doctest: 36. and *note unittest: 101. modules or third-party\ntest frameworks can be used to construct exhaustive test suites that\nexercise every line of code in a module.\n",
            "subsections": []
        },
        "An appropriate testing discipline can help build large complex": {
            "content": "applications in Python as well as having interface specifications would.",
            "subsections": []
        },
        "In fact, it can be better because an interface specification cannot test": {
            "content": "certain properties of a program.  For example, the 'list.append()'\nmethod is expected to add new elements to the end of some internal list;\nan interface specification cannot test that your 'list.append()'\nimplementation will actually do this correctly, but it's trivial to\ncheck this property in a test suite.\n",
            "subsections": []
        },
        "Writing test suites is very helpful, and you might want to design your": {
            "content": "code to make it easily tested.  One increasingly popular technique,\ntest-driven development, calls for writing parts of the test suite\nfirst, before you write any of the actual code.  Of course Python allows\nyou to be sloppy and not write test cases at all.\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "In the 1970s people realized that unrestricted goto could lead to messy": {
            "content": "\"spaghetti\" code that was hard to understand and revise.  In a\nhigh-level language, it is also unneeded as long as there are ways to\nbranch (in Python, with *note if: 24f. statements and *note or: 252,\n*note and: 24c, and *note if: 24f./*note else: 24d. expressions) and\nloop (with *note while: 198b. and *note for: 24e. statements, possibly\ncontaining *note continue: 7ed. and *note break: 8de.).\n\nOne can also use exceptions to provide a \"structured goto\" that works\neven across function calls.  Many feel that exceptions can conveniently\nemulate all reasonable uses of the 'go' or 'goto' constructs of C,\nFortran, and other languages.  For example:\n\nclass label(Exception): pass  # declare a label\n\ntry:\n...\nif condition: raise label()  # goto label\n...\nexcept label:  # where to goto\npass\n...\n",
            "subsections": []
        },
        "This doesn't allow you to jump into the middle of a loop, but that's": {
            "content": "usually considered an abuse of 'goto' anyway.  Use sparingly.\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "More precisely, they can't end with an odd number of backslashes: the": {
            "content": "unpaired backslash at the end escapes the closing quote character,\nleaving an unterminated string.\n",
            "subsections": []
        },
        "Raw strings were designed to ease creating input for processors (chiefly": {
            "content": "regular expression engines) that want to do their own backslash escape\nprocessing.  Such processors consider an unmatched trailing backslash to\nbe an error anyway, so raw strings disallow that.  In return, they allow\nyou to pass on the string quote character by escaping it with a\nbackslash.  These rules work well when r-strings are used for their\nintended purpose.\n",
            "subsections": []
        },
        "If you're trying to build Windows pathnames, note that all Windows": {
            "content": "system calls accept forward slashes too:\n\nf = open(\"/mydir/file.txt\")  # works fine!\n",
            "subsections": []
        },
        "If you're trying to build a pathname for a DOS command, try e.g.  one of": {
            "content": "dir = r\"\\this\\is\\my\\dos\\dir\" \"\\\\\"\ndir = r\"\\this\\is\\my\\dos\\dir\\ \"[:-1]\ndir = \"\\\\this\\\\is\\\\my\\\\dos\\\\dir\\\\\"\n\nFile: python3.12.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\n\n\nPython has a *note with: 396. statement that wraps the execution of a\nblock, calling code on the entrance and exit from the block.  Some\nlanguages have a construct that looks like this:\n\nwith obj:\na = 1               # equivalent to obj.a = 1\ntotal = total + 1   # obj.total = obj.total + 1\n\nIn Python, such a construct would be ambiguous.\n\nOther languages, such as Object Pascal, Delphi, and C++, use static\ntypes, so it's possible to know, in an unambiguous way, what member is\nbeing assigned to.  This is the main point of static typing - the\ncompiler 'always' knows the scope of every variable at compile time.\n",
            "subsections": []
        },
        "Python uses dynamic types.  It is impossible to know in advance which": {
            "content": "attribute will be referenced at runtime.  Member attributes may be added\nor removed from objects on the fly.  This makes it impossible to know,\nfrom a simple reading, what attribute is being referenced: a local one,\na global one, or a member attribute?\n\nFor instance, take the following incomplete snippet:\n\ndef foo(a):\nwith a:\nprint(x)\n\nThe snippet assumes that 'a' must have a member attribute called 'x'.\nHowever, there is nothing in Python that tells the interpreter this.\nWhat should happen if 'a' is, let us say, an integer?  If there is a\nglobal variable named 'x', will it be used inside the *note with: 396.\nblock?  As you see, the dynamic nature of Python makes such choices much\nharder.\n\nThe primary benefit of *note with: 396. and similar language features\n(reduction of code volume) can, however, easily be achieved in Python by\nassignment.  Instead of:\n\nfunction(args).mydict[index][index].a = 21\nfunction(args).mydict[index][index].b = 42\nfunction(args).mydict[index][index].c = 63\n\nwrite this:\n\nref = function(args).mydict[index][index]\nref.a = 21\nref.b = 42\nref.c = 63\n",
            "subsections": []
        },
        "This also has the side-effect of increasing execution speed because name": {
            "content": "bindings are resolved at run-time in Python, and the second version only\nneeds to perform the resolution once.\n",
            "subsections": []
        },
        "Similar proposals that would introduce syntax to further reduce code": {
            "content": "volume, such as using a 'leading dot', have been rejected in favour of\nexplicitness (see\n'https://mail.python.org/pipermail/python-ideas/2016-May/040070.html').\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "For technical reasons, a generator used directly as a context manager": {
            "content": "would not work correctly.  When, as is most common, a generator is used\nas an iterator run to completion, no closing is needed.  When it is,\nwrap it as *note contextlib.closing(generator): 263d. in the *note with:\n396. statement.\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "The colon is required primarily to enhance readability (one of the": {
            "content": "results of the experimental ABC language).  Consider this:\n\nif a == b\nprint(a)\n\nversus\n\nif a == b:\nprint(a)\n",
            "subsections": []
        },
        "Notice how the second one is slightly easier to read.  Notice further": {
            "content": "how a colon sets off the example in this FAQ answer; it's a standard\nusage in English.\n",
            "subsections": []
        },
        "Another minor reason is that the colon makes it easier for editors with": {
            "content": "syntax highlighting; they can look for colons to decide when indentation\nneeds to be increased instead of having to do a more elaborate parsing\nof the program text.\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "Python lets you add a trailing comma at the end of lists, tuples, and": {
            "content": "dictionaries:\n\n[1, 2, 3,]\n('a', 'b', 'c',)\nd = {\n\"A\": [1, 5],\n\"B\": [6, 7],  # last trailing comma is optional but good style\n}\n\nThere are several reasons to allow this.\n",
            "subsections": []
        },
        "When you have a literal value for a list, tuple, or dictionary spread": {
            "content": "across multiple lines, it's easier to add more elements because you\ndon't have to remember to add a comma to the previous line.  The lines\ncan also be reordered without creating a syntax error.\n",
            "subsections": []
        },
        "Accidentally omitting the comma can lead to errors that are hard to": {
            "content": "diagnose.  For example:\n\nx = [\n\"fee\",\n\"fie\"\n\"foo\",\n\"fum\"\n]\n",
            "subsections": []
        },
        "This list looks like it has four elements, but it actually contains": {
            "content": "three: \"fee\", \"fiefoo\" and \"fum\".  Always adding the comma avoids this\nsource of error.\n",
            "subsections": []
        },
        "Allowing the trailing comma may also make programmatic code generation": {
            "content": "easier.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Library and Extension FAQ,  Next: Extending/Embedding FAQ,  Prev: Design and History FAQ,  Up: Python Frequently Asked Questions": {
            "content": "",
            "subsections": [
                {
                    "name": "10.4 Library and Extension FAQ",
                    "content": "* Menu:\n\n* General Library Questions::\n* Common tasks::\n* Threads::\n* Input and Output: Input and Output<2>.\n* Network/Internet Programming::\n* Databases::\n* Mathematics and Numerics::\n"
                }
            ]
        },
        "File: python3.12.info,  Node: General Library Questions,  Next: Common tasks,  Up: Library and Extension FAQ": {
            "content": "* Menu:\n\n* How do I find a module or application to perform task X?::\n* Where is the math.py (socket.py, regex.py, etc.) source file?: Where is the math py socket py regex py etc source file?.\n* How do I make a Python script executable on Unix?::\n* Is there a curses/termcap package for Python?::\n* Is there an equivalent to C's onexit() in Python?: Is there an equivalent to C's onexit in Python?.\n* Why don't my signal handlers work?::\n\nFile: python3.12.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\n\n10.4.1.1 How do I find a module or application to perform task X?\n.................................................................\n\nCheck *note the Library Reference: 13d. to see if there's a relevant\nstandard library module.  (Eventually you'll learn what's in the\nstandard library and will be able to skip this step.)\n",
            "subsections": []
        },
        "For third-party packages, search the Python Package Index(1) or try": {
            "content": "Google(2) or another web search engine.  Searching for \"Python\" plus a\nkeyword or two for your topic of interest will usually find something\nhelpful.\n\n---------- Footnotes ----------\n\n(1) https://pypi.org\n\n(2) https://www.google.com\n\nFile: python3.12.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\n\n10.4.1.2 Where is the math.py (socket.py, regex.py, etc.) source file?\n......................................................................\n",
            "subsections": []
        },
        "If you can't find a source file for a module it may be a built-in or": {
            "content": "dynamically loaded module implemented in C, C++ or other compiled\nlanguage.  In this case you may not have the source file or it may be\nsomething like 'mathmodule.c', somewhere in a C source directory (not on\nthe Python Path).\n\nThere are (at least) three kinds of modules in Python:\n\n1. modules written in Python (.py);\n\n2. modules written in C and dynamically loaded (.dll, .pyd, .so, .sl,\netc);\n\n3. modules written in C and linked with the interpreter; to get a list\nof these, type:\n\nimport sys\nprint(sys.builtinmodulenames)\n\nFile: python3.12.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\n\n10.4.1.3 How do I make a Python script executable on Unix?\n..........................................................\n",
            "subsections": []
        },
        "You need to do two things: the script file's mode must be executable and": {
            "content": "the first line must begin with '#!' followed by the path of the Python\ninterpreter.\n\nThe first is done by executing 'chmod +x scriptfile' or perhaps 'chmod\n755 scriptfile'.\n",
            "subsections": []
        },
        "The second can be done in a number of ways.  The most straightforward": {
            "content": "way is to write\n\n#!/usr/local/bin/python\n\nas the very first line of your file, using the pathname for where the\nPython interpreter is installed on your platform.\n",
            "subsections": []
        },
        "If you would like the script to be independent of where the Python": {
            "content": "interpreter lives, you can use the 'env' program.  Almost all Unix\nvariants support the following, assuming the Python interpreter is in a\ndirectory on the user's 'PATH':\n\n#!/usr/bin/env python\n\n'Don't' do this for CGI scripts.  The 'PATH' variable for CGI scripts is\noften very minimal, so you need to use the actual absolute pathname of\nthe interpreter.\n",
            "subsections": []
        },
        "Occasionally, a user's environment is so full that the '/usr/bin/env'": {
            "content": "program fails; or there's no env program at all.  In that case, you can\ntry the following hack (due to Alex Rezinsky):\n\n#! /bin/sh\n\"\"\":\"\nexec python $0 ${1+\"$@\"}\n\"\"\"\n\nThe minor disadvantage is that this defines the script's doc string.",
            "subsections": []
        },
        "However, you can fix that by adding": {
            "content": "doc = \"\"\"...Whatever...\"\"\"\n\nFile: python3.12.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\n\n10.4.1.4 Is there a curses/termcap package for Python?\n......................................................\n",
            "subsections": []
        },
        "For Unix variants: The standard Python source distribution comes with a": {
            "content": "curses module in the Modules(1) subdirectory, though it's not compiled\nby default.  (Note that this is not available in the Windows\ndistribution - there is no curses module for Windows.)\n\nThe *note curses: 29. module supports basic curses features as well as\nmany additional functions from ncurses and SYSV curses such as colour,\nalternative character set support, pads, and mouse support.  This means\nthe module isn't compatible with operating systems that only have BSD\ncurses, but there don't seem to be any currently maintained OSes that\nfall into this category.\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Modules\n\nFile: python3.12.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\n\n10.4.1.5 Is there an equivalent to C's onexit() in Python?\n..........................................................\n\nThe *note atexit: a. module provides a register function that is similar\nto C's 'onexit()'.\n\nFile: python3.12.info,  Node: Why don't my signal handlers work?,  Prev: Is there an equivalent to C's onexit in Python?,  Up: General Library Questions\n\n10.4.1.6 Why don't my signal handlers work?\n...........................................\n",
            "subsections": []
        },
        "The most common problem is that the signal handler is declared with the": {
            "content": "wrong argument list.  It is called as\n\nhandler(signum, frame)\n\nso it should be declared with two parameters:\n\ndef handler(signum, frame):\n...\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Common tasks,  Next: Threads,  Prev: General Library Questions,  Up: Library and Extension FAQ": {
            "content": "* Menu:\n\n* How do I test a Python program or component?::\n* How do I create documentation from doc strings?::\n* How do I get a single keypress at a time?::\n\nFile: python3.12.info,  Node: How do I test a Python program or component?,  Next: How do I create documentation from doc strings?,  Up: Common tasks\n\n10.4.2.1 How do I test a Python program or component?\n.....................................................\n\nPython comes with two testing frameworks.  The *note doctest: 36. module\nfinds examples in the docstrings for a module and runs them, comparing\nthe output with the expected output given in the docstring.\n\nThe *note unittest: 101. module is a fancier testing framework modelled\non Java and Smalltalk testing frameworks.\n",
            "subsections": []
        },
        "To make testing easier, you should use good modular design in your": {
            "content": "program.  Your program should have almost all functionality encapsulated\nin either functions or class methods - and this sometimes has the\nsurprising and delightful effect of making the program run faster\n(because local variable accesses are faster than global accesses).",
            "subsections": []
        },
        "Furthermore the program should avoid depending on mutating global": {
            "content": "variables, since this makes testing much more difficult to do.\n\nThe \"global main logic\" of your program may be as simple as\n\nif name == \"main\":\nmainlogic()\n\nat the bottom of the main module of your program.\n",
            "subsections": []
        },
        "Once your program is organized as a tractable collection of function and": {
            "content": "class behaviours, you should write test functions that exercise the\nbehaviours.  A test suite that automates a sequence of tests can be\nassociated with each module.  This sounds like a lot of work, but since",
            "subsections": []
        },
        "Python is so terse and flexible it's surprisingly easy.  You can make": {
            "content": "coding much more pleasant and fun by writing your test functions in\nparallel with the \"production code\", since this makes it easy to find\nbugs and even design flaws earlier.\n\n\"Support modules\" that are not intended to be the main module of a\nprogram may include a self-test of the module.\n\nif name == \"main\":\nselftest()\n",
            "subsections": []
        },
        "Even programs that interact with complex external interfaces may be": {
            "content": "tested when the external interfaces are unavailable by using \"fake\"\ninterfaces implemented in Python.\n\nFile: python3.12.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\n\n10.4.2.2 How do I create documentation from doc strings?\n........................................................\n\nThe *note pydoc: b0. module can create HTML from the doc strings in your",
            "subsections": []
        },
        "Python source code.  An alternative for creating API documentation": {
            "content": "purely from docstrings is epydoc(1).  Sphinx(2) can also include\ndocstring content.\n\n---------- Footnotes ----------\n\n(1) https://epydoc.sourceforge.net/\n\n(2) https://www.sphinx-doc.org\n\nFile: python3.12.info,  Node: How do I get a single keypress at a time?,  Prev: How do I create documentation from doc strings?,  Up: Common tasks\n\n10.4.2.3 How do I get a single keypress at a time?\n..................................................\n",
            "subsections": []
        },
        "For Unix variants there are several solutions.  It's straightforward to": {
            "content": "do this using curses, but curses is a fairly large module to learn.\n\nFile: python3.12.info,  Node: Threads,  Next: Input and Output<2>,  Prev: Common tasks,  Up: Library and Extension FAQ\n\n\n* Menu:\n\n* How do I program using threads?::\n* None of my threads seem to run; why?: None of my threads seem to run why?.\n* How do I parcel out work among a bunch of worker threads?::\n* What kinds of global value mutation are thread-safe?::\n* Can't we get rid of the Global Interpreter Lock?::\n\nFile: python3.12.info,  Node: How do I program using threads?,  Next: None of my threads seem to run why?,  Up: Threads\n\n10.4.3.1 How do I program using threads?\n........................................\n\nBe sure to use the *note threading: e7. module and not the *note\nthread: 2. module.  The *note threading: e7. module builds convenient\nabstractions on top of the low-level primitives provided by the *note\nthread: 2. module.\n\nFile: python3.12.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\n\n10.4.3.2 None of my threads seem to run: why?\n.............................................\n",
            "subsections": []
        },
        "As soon as the main thread exits, all threads are killed.  Your main": {
            "content": "thread is running too quickly, giving the threads no time to do any\nwork.\n\nA simple fix is to add a sleep to the end of the program that's long\nenough for all the threads to finish:\n\nimport threading, time\n\ndef threadtask(name, n):\nfor i in range(n):\nprint(name, i)\n\nfor i in range(10):\nT = threading.Thread(target=threadtask, args=(str(i), i))\nT.start()\n\ntime.sleep(10)  # <---------------------------!\n",
            "subsections": []
        },
        "But now (on many platforms) the threads don't run in parallel, but": {
            "content": "appear to run sequentially, one at a time!  The reason is that the OS\nthread scheduler doesn't start a new thread until the previous thread is\nblocked.\n\nA simple fix is to add a tiny sleep to the start of the run function:\n\ndef threadtask(name, n):\ntime.sleep(0.001)  # <--------------------!\nfor i in range(n):\nprint(name, i)\n\nfor i in range(10):\nT = threading.Thread(target=threadtask, args=(str(i), i))\nT.start()\n\ntime.sleep(10)\n\nInstead of trying to guess a good delay value for *note time.sleep():\n469, it's better to use some kind of semaphore mechanism.  One idea is\nto use the *note queue: b1. module to create a queue object, let each\nthread append a token to the queue when it finishes, and let the main\nthread read as many tokens from the queue as there are threads.\n\nFile: python3.12.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\n\n10.4.3.3 How do I parcel out work among a bunch of worker threads?\n..................................................................\n\nThe easiest way is to use the *note concurrent.futures: 1f. module,\nespecially the *note ThreadPoolExecutor: 529. class.\n",
            "subsections": []
        },
        "Or, if you want fine control over the dispatching algorithm, you can": {
            "content": "write your own logic manually.  Use the *note queue: b1. module to\ncreate a queue containing a list of jobs.  The *note Queue: 1203. class\nmaintains a list of objects and has a '.put(obj)' method that adds items\nto the queue and a '.get()' method to return them.  The class will take\ncare of the locking necessary to ensure that each job is handed out\nexactly once.\n\nHere's a trivial example:\n\nimport threading, queue, time\n\n# The worker thread gets jobs off the queue.  When the queue is empty, it\n# assumes there will be no more work and exits.\n# (Realistically workers will run until terminated.)\ndef worker():\nprint('Running worker')\ntime.sleep(0.1)\nwhile True:\ntry:\narg = q.get(block=False)\nexcept queue.Empty:\nprint('Worker', threading.currentthread(), end=' ')\nprint('queue empty')\nbreak\nelse:\nprint('Worker', threading.currentthread(), end=' ')\nprint('running with argument', arg)\ntime.sleep(0.5)\n\n# Create queue\nq = queue.Queue()\n\n# Start a pool of 5 workers\nfor i in range(5):\nt = threading.Thread(target=worker, name='worker %i' % (i+1))\nt.start()\n\n# Begin adding work to the queue\nfor i in range(50):\nq.put(i)\n\n# Give threads time to run\nprint('Main thread sleeping')\ntime.sleep(5)\n\nWhen run, this will produce the following output:\n\nRunning worker\nRunning worker\nRunning worker\nRunning worker\nRunning worker\nMain thread sleeping\nWorker <Thread(worker 1, started 130283832797456)> running with argument 0\nWorker <Thread(worker 2, started 130283824404752)> running with argument 1\nWorker <Thread(worker 3, started 130283816012048)> running with argument 2\nWorker <Thread(worker 4, started 130283807619344)> running with argument 3\nWorker <Thread(worker 5, started 130283799226640)> running with argument 4\nWorker <Thread(worker 1, started 130283832797456)> running with argument 5\n...\n\nConsult the module's documentation for more details; the *note Queue:\n1203. class provides a featureful interface.\n\nFile: python3.12.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\n\n10.4.3.4 What kinds of global value mutation are thread-safe?\n.............................................................\n\nA *note global interpreter lock: 141. (GIL) is used internally to ensure\nthat only one thread runs in the Python VM at a time.  In general,",
            "subsections": []
        },
        "Python offers to switch among threads only between bytecode": {
            "content": "instructions; how frequently it switches can be set via *note\nsys.setswitchinterval(): 76a.  Each bytecode instruction and therefore\nall the C implementation code reached from each instruction is therefore\natomic from the point of view of a Python program.\n",
            "subsections": []
        },
        "In theory, this means an exact accounting requires an exact": {
            "content": "understanding of the PVM bytecode implementation.  In practice, it means\nthat operations on shared variables of built-in data types (ints, lists,\ndicts, etc) that \"look atomic\" really are.\n",
            "subsections": []
        },
        "For example, the following operations are all atomic (L, L1, L2 are": {
            "content": "lists, D, D1, D2 are dicts, x, y are objects, i, j are ints):\n\nL.append(x)\nL1.extend(L2)\nx = L[i]\nx = L.pop()\nL1[i:j] = L2\nL.sort()\nx = y\nx.field = y\nD[x] = y\nD1.update(D2)\nD.keys()\n\nThese aren't:\n\ni = i+1\nL.append(L[-1])\nL[i] = L[j]\nD[x] = D[x] + 1\n",
            "subsections": []
        },
        "Operations that replace other objects may invoke those other objects'": {
            "content": "*note del(): 1c66. method when their reference count reaches zero,\nand that can affect things.  This is especially true for the mass\nupdates to dictionaries and lists.  When in doubt, use a mutex!\n\nFile: python3.12.info,  Node: Can't we get rid of the Global Interpreter Lock?,  Prev: What kinds of global value mutation are thread-safe?,  Up: Threads\n\n10.4.3.5 Can't we get rid of the Global Interpreter Lock?\n.........................................................\n\nThe *note global interpreter lock: 141. (GIL) is often seen as a\nhindrance to Python's deployment on high-end multiprocessor server\nmachines, because a multi-threaded Python program effectively only uses\none CPU, due to the insistence that (almost) all Python code can only\nrun while the GIL is held.\n",
            "subsections": []
        },
        "Back in the days of Python 1.5, Greg Stein actually implemented a": {
            "content": "comprehensive patch set (the \"free threading\" patches) that removed the\nGIL and replaced it with fine-grained locking.  Adam Olsen recently did\na similar experiment in his python-safethread(1) project.",
            "subsections": []
        },
        "Unfortunately, both experiments exhibited a sharp drop in single-thread": {
            "content": "performance (at least 30% slower), due to the amount of fine-grained\nlocking necessary to compensate for the removal of the GIL.\n",
            "subsections": []
        },
        "This doesn't mean that you can't make good use of Python on multi-CPU": {
            "content": "machines!  You just have to be creative with dividing the work up\nbetween multiple 'processes' rather than multiple 'threads'.  The *note\nProcessPoolExecutor: 707. class in the new *note concurrent.futures: 1f.\nmodule provides an easy way of doing so; the *note multiprocessing: 8f.\nmodule provides a lower-level API in case you want more control over\ndispatching of tasks.\n",
            "subsections": []
        },
        "Judicious use of C extensions will also help; if you use a C extension": {
            "content": "to perform a time-consuming task, the extension can release the GIL\nwhile the thread of execution is in the C code and allow other threads\nto get some work done.  Some standard library modules such as *note\nzlib: 12d. and *note hashlib: 63. already do this.\n",
            "subsections": []
        },
        "It has been suggested that the GIL should be a per-interpreter-state": {
            "content": "lock rather than truly global; interpreters then wouldn't be able to\nshare objects.  Unfortunately, this isn't likely to happen either.  It\nwould be a tremendous amount of work, because many object\nimplementations currently have global state.  For example, small\nintegers and short strings are cached; these caches would have to be\nmoved to the interpreter state.  Other object types have their own free\nlist; these free lists would have to be moved to the interpreter state.\nAnd so on.\n",
            "subsections": []
        },
        "And I doubt that it can even be done in finite time, because the same": {
            "content": "problem exists for 3rd party extensions.  It is likely that 3rd party\nextensions are being written at a faster rate than you can convert them\nto store all their global state in the interpreter state.\n",
            "subsections": []
        },
        "And finally, once you have multiple interpreters not sharing any state,": {
            "content": "what have you gained over running each interpreter in a separate\nprocess?\n\n---------- Footnotes ----------\n\n(1) https://code.google.com/archive/p/python-safethread\n\nFile: python3.12.info,  Node: Input and Output<2>,  Next: Network/Internet Programming,  Prev: Threads,  Up: Library and Extension FAQ\n\n\n* Menu:\n\n* How do I delete a file? (And other file questions...): How do I delete a file? And other file questions....\n* How do I copy a file?::\n* How do I read (or write) binary data?: How do I read or write binary data?.\n* 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?.\n* How do I access the serial (RS232) port?: How do I access the serial RS232 port?.\n* Why doesn't closing sys.stdout (stdin, stderr) really close it?: Why doesn't closing sys stdout stdin stderr really close it?.\n\nFile: python3.12.info,  Node: How do I delete a file? And other file questions...,  Next: How do I copy a file?,  Up: Input and Output<2>\n\n10.4.4.1 How do I delete a file? (And other file questions...)\n............................................................\n",
            "subsections": []
        },
        "Use 'os.remove(filename)' or 'os.unlink(filename)'; for documentation,": {
            "content": "see the *note os: 9c. module.  The two functions are identical; *note\nunlink(): f66. is simply the name of the Unix system call for this\nfunction.\n\nTo remove a directory, use *note os.rmdir(): f64.; use *note os.mkdir():\nf60. to create one.  'os.makedirs(path)' will create any intermediate\ndirectories in 'path' that don't exist.  'os.removedirs(path)' will\nremove intermediate directories as long as they're empty; if you want to\ndelete an entire directory tree and its contents, use *note\nshutil.rmtree(): 1d5.\n\nTo rename a file, use 'os.rename(oldpath, newpath)'.\n\nTo truncate a file, open it using 'f = open(filename, \"rb+\")', and use\n'f.truncate(offset)'; offset defaults to the current seek position.\nThere's also 'os.ftruncate(fd, offset)' for files opened with *note\nos.open(): bee, where 'fd' is the file descriptor (a small integer).\n\nThe *note shutil: c0. module also contains a number of functions to work\non files including *note copyfile(): 886, *note copytree(): 854, and\n*note rmtree(): 1d5.\n\nFile: python3.12.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>\n\n10.4.4.2 How do I copy a file?\n..............................\n\nThe *note shutil: c0. module contains a *note copyfile(): 886. function.",
            "subsections": []
        },
        "Note that on Windows NTFS volumes, it does not copy alternate data": {
            "content": "streams(1) nor resource forks(2) on macOS HFS+ volumes, though both are\nnow rarely used.  It also doesn't copy file permissions and metadata,\nthough using *note shutil.copy2(): 888. instead will preserve most\n(though not all) of it.\n\n---------- Footnotes ----------\n\n(1) https://en.wikipedia.org/wiki/NTFS#Alternatedatastream(ADS)\n\n(2) https://en.wikipedia.org/wiki/Resourcefork\n\nFile: python3.12.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>\n\n10.4.4.3 How do I read (or write) binary data?\n..............................................\n\nTo read or write complex binary data formats, it's best to use the *note\nstruct: cf. module.  It allows you to take a string containing binary\ndata (usually numbers) and convert it to Python objects; and vice versa.\n",
            "subsections": []
        },
        "For example, the following code reads two 2-byte integers and one 4-byte": {
            "content": "integer in big-endian format from a file:\n\nimport struct\n\nwith open(filename, \"rb\") as f:\ns = f.read(8)\nx, y, z = struct.unpack(\">hhl\", s)\n\nThe '>' in the format string forces big-endian data; the letter 'h'\nreads one \"short integer\" (2 bytes), and 'l' reads one \"long integer\" (4\nbytes) from the string.\n",
            "subsections": []
        },
        "For data that is more regular (e.g.  a homogeneous list of ints or": {
            "content": "floats), you can also use the *note array: 7. module.\n\nNote: To read and write binary data, it is mandatory to open the\nfile in binary mode (here, passing '\"rb\"' to *note open(): 26e.).\nIf you use '\"r\"' instead (the default), the file will be open in\ntext mode and 'f.read()' will return *note str: 157. objects rather\nthan *note bytes: 295. objects.\n\nFile: python3.12.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>\n\n10.4.4.4 I can't seem to use os.read() on a pipe created with os.popen(); why?\n..............................................................................\n\n*note os.read(): bf1. is a low-level function which takes a file\ndescriptor, a small integer representing the opened file.  *note\nos.popen(): 8b5. creates a high-level file object, the same type\nreturned by the built-in *note open(): 26e. function.  Thus, to read 'n'\nbytes from a pipe 'p' created with *note os.popen(): 8b5, you need to\nuse 'p.read(n)'.\n\nFile: python3.12.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>\n\n10.4.4.5 How do I access the serial (RS232) port?\n.................................................\n\nFor Win32, OSX, Linux, BSD, Jython, IronPython:\n\n'https://pypi.org/project/pyserial/'\n\nFor Unix, see a Usenet post by Mitch Chapman:\n\n'https://groups.google.com/groups?selm=34A04430.CF9@ohioee.com'\n\nFile: python3.12.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>\n\n10.4.4.6 Why doesn't closing sys.stdout (stdin, stderr) really close it?\n........................................................................\n\nPython *note file objects: 1037. are a high-level layer of abstraction\non low-level C file descriptors.\n\nFor most file objects you create in Python via the built-in *note\nopen(): 26e. function, 'f.close()' marks the Python file object as being\nclosed from Python's point of view, and also arranges to close the\nunderlying C file descriptor.  This also happens automatically in 'f''s\ndestructor, when 'f' becomes garbage.\n",
            "subsections": []
        },
        "But stdin, stdout and stderr are treated specially by Python, because of": {
            "content": "the special status also given to them by C. Running 'sys.stdout.close()'\nmarks the Python-level file object as being closed, but does 'not' close\nthe associated C file descriptor.\n",
            "subsections": []
        },
        "To close the underlying C file descriptor for one of these three, you": {
            "content": "should first be sure that's what you really want to do (e.g., you may\nconfuse extension modules trying to do I/O). If it is, use *note\nos.close(): 9b5.:\n\nos.close(stdin.fileno())\nos.close(stdout.fileno())\nos.close(stderr.fileno())\n\nOr you can use the numeric constants 0, 1 and 2, respectively.\n\nFile: python3.12.info,  Node: Network/Internet Programming,  Next: Databases,  Prev: Input and Output<2>,  Up: Library and Extension FAQ\n\n\n* Menu:\n\n* What WWW tools are there for Python?::\n* How can I mimic CGI form submission (METHOD=POST)?: How can I mimic CGI form submission METHOD=POST ?.\n* What module should I use to help with generating HTML?::\n* How do I send mail from a Python script?::\n* How do I avoid blocking in the connect() method of a socket?: How do I avoid blocking in the connect method of a socket?.\n\nFile: python3.12.info,  Node: What WWW tools are there for Python?,  Next: How can I mimic CGI form submission METHOD=POST ?,  Up: Network/Internet Programming\n\n10.4.5.1 What WWW tools are there for Python?\n.............................................\n\nSee the chapters titled *note Internet Protocols and Support: 3581. and\n*note Internet Data Handling: 319a. in the Library Reference Manual.",
            "subsections": []
        },
        "Python has many modules that will help you build server-side and": {
            "content": "client-side web systems.\n\nA summary of available frameworks is maintained by Paul Boddie at\n'https://wiki.python.org/moin/WebProgramming'.\n",
            "subsections": []
        },
        "Cameron Laird maintains a useful set of pages about Python web": {
            "content": "technologies at\n'https://web.archive.org/web/20210224183619/http://phaseit.net/claird/comp.lang.python/webpython'.\n\nFile: python3.12.info,  Node: How can I mimic CGI form submission METHOD=POST ?,  Next: What module should I use to help with generating HTML?,  Prev: What WWW tools are there for Python?,  Up: Network/Internet Programming\n\n10.4.5.2 How can I mimic CGI form submission (METHOD=POST)?\n...........................................................\n\nI would like to retrieve web pages that are the result of POSTing a\nform.  Is there existing code that would let me do this easily?\n\nYes.  Here's a simple example that uses *note urllib.request: 106.:\n\n#!/usr/local/bin/python\n\nimport urllib.request\n\n# build the query string\nqs = \"First=Josephine&MI=Q&Last=Public\"\n\n# connect and send the server a path\nreq = urllib.request.urlopen('http://www.some-server.out-there'\n'/cgi-bin/some-cgi-script', data=qs)\nwith req:\nmsg, hdrs = req.read(), req.info()\n",
            "subsections": []
        },
        "Note that in general for percent-encoded POST operations, query strings": {
            "content": "must be quoted using *note urllib.parse.urlencode(): cf8.  For example,\nto send 'name=Guy Steele, Jr.':\n\n>>> import urllib.parse\n>>> urllib.parse.urlencode({'name': 'Guy Steele, Jr.'})\n'name=Guy+Steele%2C+Jr.'\n\nSee also\n........\n\n*note HOWTO Fetch Internet Resources Using The urllib Package: 364d. for\nextensive examples.\n\nFile: python3.12.info,  Node: What module should I use to help with generating HTML?,  Next: How do I send mail from a Python script?,  Prev: How can I mimic CGI form submission METHOD=POST ?,  Up: Network/Internet Programming\n\n10.4.5.3 What module should I use to help with generating HTML?\n...............................................................\n",
            "subsections": []
        },
        "You can find a collection of useful links on the Web Programming wiki": {
            "content": "page(1).\n\n---------- Footnotes ----------\n\n(1) https://wiki.python.org/moin/WebProgramming\n\nFile: python3.12.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\n\n10.4.5.4 How do I send mail from a Python script?\n.................................................\n\nUse the standard library module *note smtplib: c4.\n",
            "subsections": []
        },
        "Here's a very simple interactive mail sender that uses it.  This method": {
            "content": "will work on any host that supports an SMTP listener.\n\nimport sys, smtplib\n\nfromaddr = input(\"From: \")\ntoaddrs  = input(\"To: \").split(',')\nprint(\"Enter message, end with ^D:\")\nmsg = ''\nwhile True:\nline = sys.stdin.readline()\nif not line:\nbreak\nmsg += line\n\n# The actual mail send\nserver = smtplib.SMTP('localhost')\nserver.sendmail(fromaddr, toaddrs, msg)\nserver.quit()\n\nA Unix-only alternative uses sendmail.  The location of the sendmail\nprogram varies between systems; sometimes it is '/usr/lib/sendmail',\nsometimes '/usr/sbin/sendmail'.  The sendmail manual page will help you\nout.  Here's some sample code:\n\nimport os\n\nSENDMAIL = \"/usr/sbin/sendmail\"  # sendmail location\np = os.popen(\"%s -t -i\" % SENDMAIL, \"w\")\np.write(\"To: receiver@example.com\\n\")\np.write(\"Subject: test\\n\")\np.write(\"\\n\")  # blank line separating headers from body\np.write(\"Some text\\n\")\np.write(\"some more text\\n\")\nsts = p.close()\nif sts != 0:\nprint(\"Sendmail exit status\", sts)\n\nFile: python3.12.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\n\n10.4.5.5 How do I avoid blocking in the connect() method of a socket?\n.....................................................................\n\nThe *note select: bc. module is commonly used to help with asynchronous\nI/O on sockets.\n",
            "subsections": []
        },
        "To prevent the TCP connect from blocking, you can set the socket to": {
            "content": "non-blocking mode.  Then when you do the *note connect(): bff, you will\neither connect immediately (unlikely) or get an exception that contains\nthe error number as '.errno'.  'errno.EINPROGRESS' indicates that the\nconnection is in progress, but hasn't finished yet.  Different OSes will\nreturn different values, so you're going to have to check what's\nreturned on your system.\n\nYou can use the *note connectex(): 1393. method to avoid creating an\nexception.  It will just return the errno value.  To poll, you can call\n*note connectex(): 1393. again later - '0' or 'errno.EISCONN' indicate\nthat you're connected - or you can pass this socket to *note\nselect.select(): bfc. to check if it's writable.\n\nNote: The *note asyncio: 9. module provides a general purpose\nsingle-threaded and concurrent asynchronous library, which can be\nused for writing non-blocking network code.  The third-party\nTwisted(1) library is a popular and feature-rich alternative.\n\n---------- Footnotes ----------\n\n(1) https://twisted.org/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Databases,  Next: Mathematics and Numerics,  Prev: Network/Internet Programming,  Up: Library and Extension FAQ": {
            "content": "* Menu:\n\n* Are there any interfaces to database packages in Python?::\n* How do you implement persistent objects in Python?::\n\nFile: python3.12.info,  Node: Are there any interfaces to database packages in Python?,  Next: How do you implement persistent objects in Python?,  Up: Databases\n\n10.4.6.1 Are there any interfaces to database packages in Python?\n.................................................................\n\nYes.\n\nInterfaces to disk-based hashes such as *note DBM: 32. and *note GDBM:\n31. are also included with standard Python.  There is also the *note\nsqlite3: c9. module, which provides a lightweight disk-based relational\ndatabase.\n",
            "subsections": []
        },
        "Support for most relational databases is available.  See the": {
            "content": "DatabaseProgramming wiki page(1) for details.\n\n---------- Footnotes ----------\n\n(1) https://wiki.python.org/moin/DatabaseProgramming\n\nFile: python3.12.info,  Node: How do you implement persistent objects in Python?,  Prev: Are there any interfaces to database packages in Python?,  Up: Databases\n\n10.4.6.2 How do you implement persistent objects in Python?\n...........................................................\n\nThe *note pickle: a1. library module solves this in a very general way\n(though you still can't store things like open files, sockets or\nwindows), and the *note shelve: be. library module uses pickle and\n(g)dbm to create persistent mappings containing arbitrary Python\nobjects.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Mathematics and Numerics,  Prev: Databases,  Up: Library and Extension FAQ": {
            "content": "* Menu:\n\n* How do I generate random numbers in Python?::\n\nFile: python3.12.info,  Node: How do I generate random numbers in Python?,  Up: Mathematics and Numerics\n\n10.4.7.1 How do I generate random numbers in Python?\n....................................................\n\nThe standard module *note random: b3. implements a random number\ngenerator.  Usage is simple:\n\nimport random\nrandom.random()\n\nThis returns a random floating point number in the range [0, 1).\n",
            "subsections": []
        },
        "There are also many other specialized generators in this module, such": {
            "content": "as:\n\n* 'randrange(a, b)' chooses an integer in the range [a, b).\n\n* 'uniform(a, b)' chooses a floating point number in the range [a,\nb).\n\n* 'normalvariate(mean, sdev)' samples the normal (Gaussian)\ndistribution.\n\nSome higher-level functions operate on sequences directly, such as:\n\n* 'choice(S)' chooses a random element from a given sequence.\n\n* 'shuffle(L)' shuffles a list in-place, i.e.  permutes it randomly.\n",
            "subsections": []
        },
        "There's also a 'Random' class you can instantiate to create independent": {
            "content": "multiple random number generators.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Extending/Embedding FAQ,  Next: Python on Windows FAQ,  Prev: Library and Extension FAQ,  Up: Python Frequently Asked Questions": {
            "content": "",
            "subsections": [
                {
                    "name": "10.5 Extending/Embedding FAQ",
                    "content": "* Menu:\n\n* Can I create my own functions in C?::\n* Can I create my own functions in C++?::\n* Writing C is hard; are there any alternatives?::\n* How can I execute arbitrary Python statements from C?::\n* How can I evaluate an arbitrary Python expression from C?::\n* How do I extract C values from a Python object?::\n* How do I use PyBuildValue() to create a tuple of arbitrary length?: How do I use PyBuildValue to create a tuple of arbitrary length?.\n* How do I call an object's method from C?::\n* How do I catch the output from PyErrPrint() (or anything that prints to stdout/stderr)?: How do I catch the output from PyErrPrint or anything that prints to stdout/stderr ?.\n* How do I access a module written in Python from C?::\n* How do I interface to C++ objects from Python?::\n* I added a module using the Setup file and the make fails; why?::\n* How do I debug an extension?::\n* 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?.\n* How do I tell \"incomplete input\" from \"invalid input\"?::\n* How do I find undefined g++ symbols builtinnew or purevirtual?::\n* 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 ?.\n\nFile: python3.12.info,  Node: Can I create my own functions in C?,  Next: Can I create my own functions in C++?,  Up: Extending/Embedding FAQ\n\n"
                }
            ]
        },
        "Yes, you can create built-in modules containing functions, variables,": {
            "content": "exceptions and even new types in C. This is explained in the document\n*note Extending and Embedding the Python Interpreter: 195e.\n\nMost intermediate or advanced Python books will also cover this topic.\n\nFile: python3.12.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\n\n\nYes, using the C compatibility features found in C++.  Place 'extern \"C\"\n{ ... }' around the Python include files and put 'extern \"C\"' before\neach function that is going to be called by the Python interpreter.\nGlobal or static C++ objects with constructors are probably not a good\nidea.\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "There are a number of alternatives to writing your own C extensions,": {
            "content": "depending on what you're trying to do.\n",
            "subsections": []
        },
        "Cython(1) and its relative Pyrex(2) are compilers that accept a slightly": {
            "content": "modified form of Python and generate the corresponding C code.  Cython\nand Pyrex make it possible to write an extension without having to learn\nPython's C API.\n\nIf you need to interface to some C or C++ library for which no Python\nextension currently exists, you can try wrapping the library's data\ntypes and functions with a tool such as SWIG(3). SIP(4), CXX(5)\nBoost(6), or Weave(7) are also alternatives for wrapping C++ libraries.\n\n---------- Footnotes ----------\n\n(1) https://cython.org\n\n(2) https://www.csse.canterbury.ac.nz/greg.ewing/python/Pyrex/\n\n(3) https://www.swig.org\n\n(4) https://github.com/Python-SIP/sip\n\n(5) https://cxx.sourceforge.net/\n\n(6) https://www.boost.org/libs/python/doc/index.html\n\n(7) https://github.com/scipy/weave\n\nFile: python3.12.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\n\n\nThe highest-level function to do this is *note PyRunSimpleString():\n470d. which takes a single string argument to be executed in the context\nof the module 'main' and returns '0' for success and '-1' when an\nexception occurred (including *note SyntaxError: 146.).  If you want\nmore control, use *note PyRunString(): 174e.; see the source for *note\nPyRunSimpleString(): 470d. in 'Python/pythonrun.c'.\n\nFile: python3.12.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\n\n\nCall the function *note PyRunString(): 174e. from the previous question\nwith the start symbol *note Pyevalinput: 48cd.; it parses an\nexpression, evaluates it and returns its value.\n\nFile: python3.12.info,  Node: How do I extract C values from a Python object?,  Next: How do I use PyBuildValue to create a tuple of arbitrary length?,  Prev: How can I evaluate an arbitrary Python expression from C?,  Up: Extending/Embedding FAQ\n\n\nThat depends on the object's type.  If it's a tuple, *note\nPyTupleSize(): 485a. returns its length and *note PyTupleGetItem():\n46b5. returns the item at a specified index.  Lists have similar\nfunctions, *note PyListSize(): 1270. and *note PyListGetItem(): 46b6.\n\nFor bytes, *note PyBytesSize(): 475d. returns its length and *note",
            "subsections": []
        },
        "PyBytesAsStringAndSize(): 4757. provides a pointer to its value and its": {
            "content": "length.  Note that Python bytes objects may contain null bytes so C's\n'strlen()' should not be used.\n",
            "subsections": []
        },
        "To test the type of an object, first make sure it isn't 'NULL', and then": {
            "content": "use *note PyBytesCheck(): 1209, *note PyTupleCheck(): 4a29, *note\nPyListCheck(): 4a39, etc.\n",
            "subsections": []
        },
        "There is also a high-level API to Python objects which is provided by": {
            "content": "the so-called 'abstract' interface - read 'Include/abstract.h' for\nfurther details.  It allows interfacing with any kind of Python sequence\nusing calls like *note PySequenceLength(): 4838, *note",
            "subsections": []
        },
        "PySequenceGetItem(): 17d4, etc.  as well as many other useful protocols": {
            "content": "such as numbers (*note PyNumberIndex(): 6a1. et al.)  and mappings in\nthe PyMapping APIs.\n\nFile: python3.12.info,  Node: How do I use PyBuildValue 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\n\n\nYou can't.  Use *note PyTuplePack(): 4859. instead.\n\nFile: python3.12.info,  Node: How do I call an object's method from C?,  Next: How do I catch the output from PyErrPrint or anything that prints to stdout/stderr ?,  Prev: How do I use PyBuildValue to create a tuple of arbitrary length?,  Up: Extending/Embedding FAQ\n\n\nThe *note PyObjectCallMethod(): 2d4. function can be used to call an\narbitrary method of an object.  The parameters are the object, the name\nof the method to call, a format string like that used with *note\nPyBuildValue(): 6bb, and the argument values:\n\nPyObject *\nPyObjectCallMethod(PyObject *object, const char *methodname,\nconst char *argformat, ...);\n",
            "subsections": []
        },
        "This works for any object that has methods - whether built-in or": {
            "content": "user-defined.  You are responsible for eventually *note PyDECREF():\n2cf.'ing the return value.\n\nTo call, e.g., a file object's \"seek\" method with arguments 10, 0\n(assuming the file object pointer is \"f\"):\n\nres = PyObjectCallMethod(f, \"seek\", \"(ii)\", 10, 0);\nif (res == NULL) {\n... an exception occurred ...\n}\nelse {\nPyDECREF(res);\n}\n\nNote that since *note PyObjectCallObject(): 46a9. 'always' wants a\ntuple for the argument list, to call a function without arguments, pass\n\"()\" for the format, and to call a function with one argument, surround\nthe argument in parentheses, e.g.  \"(i)\".\n\nFile: python3.12.info,  Node: How do I catch the output from PyErrPrint 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\n\n\nIn Python code, define an object that supports the 'write()' method.\nAssign this object to *note sys.stdout: 90c. and *note sys.stderr: 757.",
            "subsections": []
        },
        "Call printerror, or just allow the standard traceback mechanism to": {
            "content": "work.  Then, the output will go wherever your 'write()' method sends it.\n\nThe easiest way to do this is to use the *note io.StringIO: d94. class:\n\n>>> import io, sys\n>>> sys.stdout = io.StringIO()\n>>> print('foo')\n>>> print('hello world!')\n>>> sys.stderr.write(sys.stdout.getvalue())\nfoo\nhello world!\n\nA custom object to do the same would look like this:\n\n>>> import io, sys\n>>> class StdoutCatcher(io.TextIOBase):\n...     def init(self):\n...         self.data = []\n...     def write(self, stuff):\n...         self.data.append(stuff)\n...\n>>> import sys\n>>> sys.stdout = StdoutCatcher()\n>>> print('foo')\n>>> print('hello world!')\n>>> sys.stderr.write(''.join(sys.stdout.data))\nfoo\nhello world!\n\nFile: python3.12.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 PyErrPrint or anything that prints to stdout/stderr ?,  Up: Extending/Embedding FAQ\n\n\nYou can get a pointer to the module object as follows:\n\nmodule = PyImportImportModule(\"<modulename>\");\n",
            "subsections": []
        },
        "If the module hasn't been imported yet (i.e.  it is not yet present in": {
            "content": "*note sys.modules: 16d7.), this initializes the module; otherwise it\nsimply returns the value of 'sys.modules[\"<modulename>\"]'.  Note that it\ndoesn't enter the module into any namespace - it only ensures it has\nbeen initialized and is stored in *note sys.modules: 16d7.\n",
            "subsections": []
        },
        "You can then access the module's attributes (i.e.  any name defined in": {
            "content": "the module) as follows:\n\nattr = PyObjectGetAttrString(module, \"<attrname>\");\n\nCalling *note PyObjectSetAttrString(): 4828. to assign to variables in\nthe module also works.\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "Depending on your requirements, there are many approaches.  To do this": {
            "content": "manually, begin by reading *note the \"Extending and Embedding\" document:\n195e.  Realize that for the Python run-time system, there isn't a whole\nlot of difference between C and C++ - so the strategy of building a new\nPython type around a C structure (pointer) type will also work for C++\nobjects.\n\nFor C++ libraries, see *note Writing C is hard; are there any\nalternatives?: 4ea2.\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "Setup must end in a newline, if there is no newline there, the build": {
            "content": "process fails.  (Fixing this requires some ugly shell script hackery,\nand this bug is so minor that it doesn't seem worth the effort.)\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "When using GDB with dynamically loaded extensions, you can't set a": {
            "content": "breakpoint in your extension until your extension is loaded.\n\nIn your '.gdbinit' file (or interactively), add the command:\n\nbr PyImportLoadDynamicModule\n\nThen, when you run GDB:\n\n$ gdb /local/bin/python\ngdb) run myscript.py\ngdb) continue # repeat until your extension is loaded\ngdb) finish   # so that your extension is loaded\ngdb) br myfunction.c:50\ngdb) continue\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "Most packaged versions of Python don't include the": {
            "content": "'/usr/lib/python2.`x'/config/' directory, which contains various files\nrequired for compiling Python extensions.\n\nFor Red Hat, install the python-devel RPM to get the necessary files.\n\nFor Debian, run 'apt-get install python-dev'.\n\nFile: python3.12.info,  Node: How do I tell \"incomplete input\" from \"invalid input\"?,  Next: How do I find undefined g++ symbols builtinnew or purevirtual?,  Prev: I want to compile a Python module on my Linux system but some files are missing Why?,  Up: Extending/Embedding FAQ\n\n",
            "subsections": []
        },
        "Sometimes you want to emulate the Python interactive interpreter's": {
            "content": "behavior, where it gives you a continuation prompt when the input is\nincomplete (e.g.  you typed the start of an \"if\" statement or you didn't\nclose your parentheses or triple string quotes), but it gives you a\nsyntax error message immediately when the input is invalid.\n\nIn Python you can use the *note codeop: 1a. module, which approximates\nthe parser's behavior sufficiently.  IDLE uses this, for example.\n\nThe easiest way to do it in C is to call *note PyRunInteractiveLoop():\n48d4. (perhaps in a separate thread) and let the Python interpreter\nhandle the input for you.  You can also set the *note",
            "subsections": []
        },
        "PyOSReadlineFunctionPointer(): 2e8. to point at your custom input": {
            "content": "function.  See 'Modules/readline.c' and 'Parser/myreadline.c' for more\nhints.\n\nFile: python3.12.info,  Node: How do I find undefined g++ symbols builtinnew or purevirtual?,  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\n\n\nTo dynamically load g++ extension modules, you must recompile Python,\nrelink it using g++ (change LINKCC in the Python Modules Makefile), and\nlink your extension module using g++ (e.g., 'g++ -shared -o mymodule.so\nmymodule.o').\n\nFile: python3.12.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 builtinnew or purevirtual?,  Up: Extending/Embedding FAQ\n\n\nYes, you can inherit from built-in classes such as *note int: 17e, *note\nlist: 3dc, *note dict: 237, etc.\n",
            "subsections": []
        },
        "The Boost Python Library (BPL,": {
            "content": "'https://www.boost.org/libs/python/doc/index.html') provides a way of\ndoing this from C++ (i.e.  you can inherit from an extension class\nwritten in C++ using the BPL).\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python on Windows FAQ,  Next: Graphic User Interface FAQ,  Prev: Extending/Embedding FAQ,  Up: Python Frequently Asked Questions": {
            "content": "",
            "subsections": [
                {
                    "name": "10.6 Python on Windows FAQ",
                    "content": "* Menu:\n\n* How do I run a Python program under Windows?::\n* How do I make Python scripts executable?::\n* Why does Python sometimes take so long to start?::\n* How do I make an executable from a Python script?::\n* Is a *.pyd file the same as a DLL?: Is a * pyd file the same as a DLL?.\n* How can I embed Python into a Windows application?::\n* How do I keep editors from inserting tabs into my Python source?::\n* How do I check for a keypress without blocking?::\n* 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?.\n\nFile: python3.12.info,  Node: How do I run a Python program under Windows?,  Next: How do I make Python scripts executable?,  Up: Python on Windows FAQ\n\n"
                }
            ]
        },
        "This is not necessarily a straightforward question.  If you are already": {
            "content": "familiar with running programs from the Windows command line then\neverything will seem obvious; otherwise, you might need a little more\nguidance.\n",
            "subsections": []
        },
        "Unless you use some sort of integrated development environment, you will": {
            "content": "end up 'typing' Windows commands into what is referred to as a \"Command\nprompt window\".  Usually you can create such a window from your search\nbar by searching for 'cmd'.  You should be able to recognize when you\nhave started such a window because you will see a Windows \"command\nprompt\", which usually looks like this:\n\nC:\\>\n",
            "subsections": []
        },
        "The letter may be different, and there might be other things after it,": {
            "content": "so you might just as easily see something like:\n\nD:\\YourName\\Projects\\Python>\n\ndepending on how your computer has been set up and what else you have\nrecently done with it.  Once you have started such a window, you are\nwell on the way to running Python programs.\n",
            "subsections": []
        },
        "You need to realize that your Python scripts have to be processed by": {
            "content": "another program called the Python 'interpreter'.  The interpreter reads\nyour script, compiles it into bytecodes, and then executes the bytecodes\nto run your program.  So, how do you arrange for the interpreter to\nhandle your Python?\n",
            "subsections": []
        },
        "First, you need to make sure that your command window recognises the": {
            "content": "word \"py\" as an instruction to start the interpreter.  If you have\nopened a command window, you should try entering the command 'py' and\nhitting return:\n\nC:\\Users\\YourName> py\n\nYou should then see something like:\n\nPython 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>>\n\nYou have started the interpreter in \"interactive mode\".  That means you\ncan enter Python statements or expressions interactively and have them\nexecuted or evaluated while you wait.  This is one of Python's strongest\nfeatures.  Check it by entering a few expressions of your choice and\nseeing the results:\n\n>>> print(\"Hello\")\nHello\n>>> \"Hello\" * 3\n'HelloHelloHello'\n",
            "subsections": []
        },
        "Many people use the interactive mode as a convenient yet highly": {
            "content": "programmable calculator.  When you want to end your interactive Python\nsession, call the *note exit(): 1e94. function or hold the 'Ctrl' key\ndown while you enter a 'Z', then hit the \"'Enter'\" key to get back to\nyour Windows command prompt.\n\nYou may also find that you have a Start-menu entry such as Start ???\nPrograms ??? Python 3.x ??? Python (command line) that results in you seeing\nthe '>>>' prompt in a new window.  If so, the window will disappear\nafter you call the *note exit(): 1e94. function or enter the 'Ctrl-Z'\ncharacter; Windows is running a single \"python\" command in the window,\nand closes it when you terminate the interpreter.\n",
            "subsections": []
        },
        "Now that we know the 'py' command is recognized, you can give your": {
            "content": "",
            "subsections": []
        },
        "Python script to it.  You'll have to give either an absolute or a": {
            "content": "relative path to the Python script.  Let's say your Python script is\nlocated in your desktop and is named 'hello.py', and your command prompt\nis nicely opened in your home directory so you're seeing something\nsimilar to:\n\nC:\\Users\\YourName>\n",
            "subsections": []
        },
        "So now you'll ask the 'py' command to give your script to Python by": {
            "content": "typing 'py' followed by your script path:\n\nC:\\Users\\YourName> py Desktop\\hello.py\nhello\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "On Windows, the standard Python installer already associates the .py": {
            "content": "extension with a file type (Python.File) and gives that file type an\nopen command that runs the interpreter ('D:\\Program\nFiles\\Python\\python.exe \"%1\" %*').  This is enough to make scripts\nexecutable from the command prompt as 'foo.py'.  If you'd rather be able\nto execute the script by simple typing 'foo' with no extension you need\nto add .py to the PATHEXT environment variable.\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "Usually Python starts very quickly on Windows, but occasionally there": {
            "content": "are bug reports that Python suddenly begins to take a long time to start\nup.  This is made even more puzzling because Python will work fine on\nother Windows systems which appear to be configured identically.\n",
            "subsections": []
        },
        "The problem may be caused by a misconfiguration of virus checking": {
            "content": "software on the problem machine.  Some virus scanners have been known to\nintroduce startup overhead of two orders of magnitude when the scanner\nis configured to monitor all reads from the filesystem.  Try checking\nthe configuration of virus scanning software on your systems to ensure\nthat they are indeed configured identically.  McAfee, when configured to\nscan all file system read activity, is a particular offender.\n\nFile: python3.12.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\n\n\nSee *note How can I create a stand-alone binary from a Python script?:\n4e10. for a list of tools that can be used to make executables.\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "Yes, .pyd files are dll's, but there are a few differences.  If you have": {
            "content": "a DLL named 'foo.pyd', then it must have a function 'PyInitfoo()'.  You\ncan then write Python \"import foo\", and Python will search for foo.pyd\n(as well as foo.py, foo.pyc) and if it finds it, will attempt to call\n'PyInitfoo()' to initialize it.  You do not link your .exe with\nfoo.lib, as that would cause Windows to require the DLL to be present.\n",
            "subsections": []
        },
        "Note that the search path for foo.pyd is PYTHONPATH, not the same as the": {
            "content": "path that Windows uses to search for foo.dll.  Also, foo.pyd need not be\npresent to run your program, whereas if you linked your program with a\ndll, the dll is required.  Of course, foo.pyd is required if you want to\nsay 'import foo'.  In a DLL, linkage is declared in the source code with\n'declspec(dllexport)'.  In a .pyd, linkage is defined in a list of\navailable functions.\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "Embedding the Python interpreter in a Windows app can be summarized as": {
            "content": "follows:\n\n1. Do 'not' build Python into your .exe file directly.  On Windows,\nPython must be a DLL to handle importing modules that are\nthemselves DLL's.  (This is the first key undocumented fact.)\nInstead, link to 'python`NN'.dll'; it is typically installed in\n'C:\\Windows\\System'.  'NN' is the Python version, a number such as\n\"33\" for Python 3.3.\n\nYou can link to Python in two different ways.  Load-time linking\nmeans linking against 'python`NN'.lib', while run-time linking\nmeans linking against 'python`NN'.dll'.  (General note:\n'python`NN'.lib' is the so-called \"import lib\" corresponding to\n'python`NN'.dll'.  It merely defines symbols for the linker.)\n\nRun-time linking greatly simplifies link options; everything\nhappens at run time.  Your code must load 'python`NN'.dll' using\nthe Windows 'LoadLibraryEx()' routine.  The code must also use\naccess routines and data in 'python`NN'.dll' (that is, Python's C\nAPI's) using pointers obtained by the Windows 'GetProcAddress()'\nroutine.  Macros can make using these pointers transparent to any C\ncode that calls routines in Python's C API.\n\n2. If you use SWIG, it is easy to create a Python \"extension module\"\nthat will make the app's data and methods available to Python.\nSWIG will handle just about all the grungy details for you.  The\nresult is C code that you link 'into' your .exe file (!)  You do\n'not' have to create a DLL file, and this also simplifies linking.\n\n3. SWIG will create an init function (a C function) whose name depends\non the name of the extension module.  For example, if the name of\nthe module is leo, the init function will be called initleo().  If\nyou use SWIG shadow classes, as you should, the init function will\nbe called initleoc().  This initializes a mostly hidden helper\nclass used by the shadow class.\n\nThe reason you can link the C code in step 2 into your .exe file is\nthat calling the initialization function is equivalent to importing\nthe module into Python!  (This is the second key undocumented\nfact.)\n\n4. In short, you can use the following code to initialize the Python\ninterpreter with your extension module.\n\n#include <Python.h>\n...\nPyInitialize();  // Initialize Python.\ninitmyAppc();  // Initialize (import) the helper class.\nPyRunSimpleString(\"import myApp\");  // Import the shadow class.\n\n5. There are two problems with Python's C API which will become\napparent if you use a compiler other than MSVC, the compiler used\nto build pythonNN.dll.\n\nProblem 1: The so-called \"Very High Level\" functions that take\n'FILE *' arguments will not work in a multi-compiler environment\nbecause each compiler's notion of a 'struct FILE' will be\ndifferent.  From an implementation standpoint these are very low\nlevel functions.\n\nProblem 2: SWIG generates the following code when generating\nwrappers to void functions:\n\nPyINCREF(PyNone);\nresultobj = PyNone;\nreturn resultobj;\n\nAlas, PyNone is a macro that expands to a reference to a complex\ndata structure called PyNoneStruct inside pythonNN.dll.  Again,\nthis code will fail in a mult-compiler environment.  Replace such\ncode by:\n\nreturn PyBuildValue(\"\");\n\nIt may be possible to use SWIG's '%typemap' command to make the\nchange automatically, though I have not been able to get this to\nwork (I'm a complete SWIG newbie).\n\n6. Using a Python shell script to put up a Python interpreter window\nfrom inside your Windows app is not a good idea; the resulting\nwindow will be independent of your app's windowing system.  Rather,\nyou (or the wxPythonWindow class) should create a \"native\"\ninterpreter window.  It is easy to connect that window to the\nPython interpreter.  You can redirect Python's i/o to any object\nthat supports read and write, so all you need is a Python object\n(defined in your extension module) that contains read() and write()\nmethods.\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "The FAQ does not recommend using tabs, and the Python style guide, PEP": {
            "content": "8(1), recommends 4 spaces for distributed Python code; this is also the\nEmacs python-mode default.\n",
            "subsections": []
        },
        "Under any editor, mixing tabs and spaces is a bad idea.  MSVC is no": {
            "content": "different in this respect, and is easily configured to use spaces: Take\nTools ??? Options ??? Tabs, and for file type \"Default\" set \"Tab size\" and\n\"Indent size\" to 4, and select the \"Insert spaces\" radio button.\n\nPython raises *note IndentationError: 59a. or *note TabError: 29b. if\nmixed tabs and spaces are causing problems in leading whitespace.  You\nmay also run the *note tabnanny: d7. module to check a directory tree in\nbatch mode.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0008/\n\nFile: python3.12.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\n\n\nUse the *note msvcrt: 8e. module.  This is a standard Windows-specific\nextension module.  It defines a function 'kbhit()' which checks whether\na keyboard hit is present, and 'getch()' which gets one character\nwithout echoing it.\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "This can occur on Python 3.5 and later when using Windows 8.1 or earlier": {
            "content": "without all updates having been installed.  First ensure your operating\nsystem is supported and is up to date, and if that does not resolve the\nissue, visit the Microsoft support page(1) for guidance on manually\ninstalling the C Runtime update.\n\n---------- Footnotes ----------\n\n(1) https://support.microsoft.com/en-us/help/3118401/\n\nFile: python3.12.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\n",
            "subsections": [
                {
                    "name": "10.7 Graphic User Interface FAQ",
                    "content": "* Menu:\n\n* General GUI Questions::\n* What GUI toolkits exist for Python?::\n* Tkinter questions::\n\nFile: python3.12.info,  Node: General GUI Questions,  Next: What GUI toolkits exist for Python?,  Up: Graphic User Interface FAQ\n\n\nFile: python3.12.info,  Node: What GUI toolkits exist for Python?,  Next: Tkinter questions,  Prev: General GUI Questions,  Up: Graphic User Interface FAQ\n\n"
                }
            ]
        },
        "Standard builds of Python include an object-oriented interface to the": {
            "content": "Tcl/Tk widget set, called *note tkinter: 3a7e.  This is probably the\neasiest to install (since it comes included with most binary\ndistributions(1) of Python) and use.  For more info about Tk, including\npointers to the source, see the Tcl/Tk home page(2).  Tcl/Tk is fully\nportable to the macOS, Windows, and Unix platforms.\n",
            "subsections": []
        },
        "Depending on what platform(s) you are aiming at, there are also several": {
            "content": "alternatives.  A list of cross-platform(3) and platform-specific(4) GUI\nframeworks can be found on the python wiki.\n\n---------- Footnotes ----------\n\n(1) https://www.python.org/downloads/\n\n(2) https://www.tcl.tk\n\n(3)\nhttps://wiki.python.org/moin/GuiProgramming#Cross-PlatformFrameworks\n\n(4)\nhttps://wiki.python.org/moin/GuiProgramming#Platform-specificFrameworks\n\nFile: python3.12.info,  Node: Tkinter questions,  Prev: What GUI toolkits exist for Python?,  Up: Graphic User Interface FAQ\n\n\n* Menu:\n\n* How do I freeze Tkinter applications?::\n* Can I have Tk events handled while waiting for I/O?::\n* I can't get key bindings to work in Tkinter; why?: I can't get key bindings to work in Tkinter why?.\n\nFile: python3.12.info,  Node: How do I freeze Tkinter applications?,  Next: Can I have Tk events handled while waiting for I/O?,  Up: Tkinter questions\n\n10.7.3.1 How do I freeze Tkinter applications?\n..............................................\n",
            "subsections": []
        },
        "Freeze is a tool to create stand-alone applications.  When freezing": {
            "content": "",
            "subsections": []
        },
        "Tkinter applications, the applications will not be truly stand-alone, as": {
            "content": "the application will still need the Tcl and Tk libraries.\n",
            "subsections": []
        },
        "One solution is to ship the application with the Tcl and Tk libraries,": {
            "content": "and point to them at run-time using the 'TCLLIBRARY' and 'TKLIBRARY'\nenvironment variables.\n",
            "subsections": []
        },
        "To get truly stand-alone applications, the Tcl scripts that form the": {
            "content": "library have to be integrated into the application as well.  One tool\nsupporting that is SAM (stand-alone modules), which is part of the Tix\ndistribution ('https://tix.sourceforge.net/').\n",
            "subsections": []
        },
        "Build Tix with SAM enabled, perform the appropriate call to": {
            "content": "'Tclsaminit()', etc.  inside Python's 'Modules/tkappinit.c', and link\nwith libtclsam and libtksam (you might include the Tix libraries as\nwell).\n\nFile: python3.12.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\n\n10.7.3.2 Can I have Tk events handled while waiting for I/O?\n............................................................\n\nOn platforms other than Windows, yes, and you don't even need threads!",
            "subsections": []
        },
        "But you'll have to restructure your I/O code a bit.  Tk has the": {
            "content": "equivalent of Xt's 'XtAddInput()' call, which allows you to register a\ncallback function which will be called from the Tk mainloop when I/O is\npossible on a file descriptor.  See *note File Handlers: 3a9b.\n\nFile: python3.12.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\n\n10.7.3.3 I can't get key bindings to work in Tkinter: why?\n..........................................................\n\nAn often-heard complaint is that event handlers *note bound: 3a96. to\nevents with the 'bind()' method don't get handled even when the\nappropriate key is pressed.\n",
            "subsections": []
        },
        "The most common cause is that the widget to which the binding applies": {
            "content": "doesn't have \"keyboard focus\".  Check out the Tk documentation for the\nfocus command.  Usually a widget is given the keyboard focus by clicking\nin it (but not for labels; see the takefocus option).\n\nFile: python3.12.info,  Node: \"Why is Python Installed on my Computer?\" FAQ,  Prev: Graphic User Interface FAQ,  Up: Python Frequently Asked Questions\n",
            "subsections": [
                {
                    "name": "10.8 \"Why is Python Installed on my Computer?\" FAQ",
                    "content": "* Menu:\n\n* What is Python?: What is Python?<2>.\n* Why is Python installed on my machine?::\n* Can I delete Python?::\n\nFile: python3.12.info,  Node: What is Python?<2>,  Next: Why is Python installed on my machine?,  Up: \"Why is Python Installed on my Computer?\" FAQ\n\n"
                }
            ]
        },
        "Python is a programming language.  It's used for many different": {
            "content": "applications.  It's used in some high schools and colleges as an\nintroductory programming language because Python is easy to learn, but\nit's also used by professional software developers at places such as\nGoogle, NASA, and Lucasfilm Ltd.\n",
            "subsections": []
        },
        "If you wish to learn more about Python, start with the Beginner's Guide": {
            "content": "to Python(1).\n\n---------- Footnotes ----------\n\n(1) https://wiki.python.org/moin/BeginnersGuide\n\nFile: python3.12.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\n\n",
            "subsections": []
        },
        "If you find Python installed on your system but don't remember": {
            "content": "installing it, there are several possible ways it could have gotten\nthere.\n\n* Perhaps another user on the computer wanted to learn programming\nand installed it; you'll have to figure out who's been using the\nmachine and might have installed it.\n\n* A third-party application installed on the machine might have been\nwritten in Python and included a Python installation.  There are\nmany such applications, from GUI programs to network servers and\nadministrative scripts.\n\n* Some Windows machines also have Python installed.  At this writing\nwe're aware of computers from Hewlett-Packard and Compaq that\ninclude Python.  Apparently some of HP/Compaq's administrative\ntools are written in Python.\n\n* Many Unix-compatible operating systems, such as macOS and some\nLinux distributions, have Python installed by default; it's\nincluded in the base installation.\n\nFile: python3.12.info,  Node: Can I delete Python?,  Prev: Why is Python installed on my machine?,  Up: \"Why is Python Installed on my Computer?\" FAQ\n\n\nThat depends on where Python came from.\n",
            "subsections": []
        },
        "If someone installed it deliberately, you can remove it without hurting": {
            "content": "anything.  On Windows, use the Add/Remove Programs icon in the Control\nPanel.\n",
            "subsections": []
        },
        "If Python was installed by a third-party application, you can also": {
            "content": "remove it, but that application will no longer work.  You should use\nthat application's uninstaller rather than removing Python directly.\n",
            "subsections": []
        },
        "If Python came with your operating system, removing it is not": {
            "content": "recommended.  If you remove it, whatever tools were written in Python\nwill no longer run, and some of them might be important to you.",
            "subsections": []
        },
        "Reinstalling the whole system would then be required to fix things": {
            "content": "again.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Glossary,  Next: About these documents,  Prev: Python Frequently Asked Questions,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "11 Glossary": {
            "content": "'>>>'\n\nThe default Python prompt of the interactive shell.  Often seen for\ncode examples which can be executed interactively in the\ninterpreter.\n\n'...'\n\nCan refer to:\n\n* The default Python prompt of the interactive shell when\nentering the code for an indented code block, when within a\npair of matching left and right delimiters (parentheses,\nsquare brackets, curly braces or triple quotes), or after\nspecifying a decorator.\n\n* The *note Ellipsis: 1e91. built-in constant.\n\n2to3\n\nA tool that tries to convert Python 2.x code to Python 3.x code by\nhandling most of the incompatibilities which can be detected by\nparsing the source and traversing the parse tree.\n\n2to3 is available in the standard library as *note lib2to3: 7f.; a\nstandalone entry point is provided as 'Tools/scripts/2to3'.  See\n*note 2to3 -- Automated Python 2 to 3 code translation: 4f4.\n\nabstract base class\n\nAbstract base classes complement *note duck-typing: 4ece. by\nproviding a way to define interfaces when other techniques like\n*note hasattr(): 1f7. would be clumsy or subtly wrong (for example\nwith *note magic methods: 1c6b.).  ABCs introduce virtual\nsubclasses, which are classes that don't inherit from a class but\nare still recognized by *note isinstance(): 14b. and *note\nissubclass(): 5b4.; see the *note abc: 4. module documentation.\nPython comes with many built-in ABCs for data structures (in the\n*note collections.abc: 1c. module), numbers (in the *note numbers:\n99. module), streams (in the *note io: 79. module), import finders\nand loaders (in the *note importlib.abc: 72. module).  You can\ncreate your own ABCs with the *note abc: 4. module.\n\nannotation\n\nA label associated with a variable, a class attribute or a function\nparameter or return value, used by convention as a *note type hint:\n1c89.\n\nAnnotations of local variables cannot be accessed at runtime, but\nannotations of global variables, class attributes, and functions\nare stored in the 'annotations' special attribute of modules,\nclasses, and functions, respectively.\n\nSee *note variable annotation: bb0, *note function annotation:\n19bc, PEP 484(1) and PEP 526(2), which describe this functionality.\nAlso see *note Annotations Best Practices: 5cd. for best practices\non working with annotations.\n\nargument\n\nA value passed to a *note function: 1d62. (or *note method: 4ecf.)\nwhen calling the function.  There are two kinds of argument:\n\n* 'keyword argument': an argument preceded by an identifier\n(e.g.  'name=') in a function call or passed as a value in a\ndictionary preceded by ''.  For example, '3' and '5' are\nboth keyword arguments in the following calls to *note\ncomplex(): 3ad.:\n\ncomplex(real=3, imag=5)\ncomplex({'real': 3, 'imag': 5})\n\n* 'positional argument': an argument that is not a keyword\nargument.  Positional arguments can appear at the beginning of\nan argument list and/or be passed as elements of an *note\niterable: 109d. preceded by '*'.  For example, '3' and '5' are\nboth positional arguments in the following calls:\n\ncomplex(3, 5)\ncomplex(*(3, 5))\n\nArguments are assigned to the named local variables in a function\nbody.  See the *note Calls: bd8. section for the rules governing\nthis assignment.  Syntactically, any expression can be used to\nrepresent an argument; the evaluated value is assigned to the local\nvariable.\n\nSee also the *note parameter: 1c1e. glossary entry, the FAQ\nquestion on *note the difference between arguments and parameters:\n4e1b, and PEP 362(3).\n\nasynchronous context manager\n\nAn object which controls the environment seen in an *note async\nwith: 399. statement by defining *note aenter(): 1cd7. and\n*note aexit(): 1cd8. methods.  Introduced by PEP 492(4).\n\nasynchronous generator\n\nA function which returns an *note asynchronous generator iterator:\n4014.  It looks like a coroutine function defined with *note async\ndef: 394. except that it contains *note yield: 7f1. expressions for\nproducing a series of values usable in an *note async for: 8e0.\nloop.\n\nUsually refers to an asynchronous generator function, but may refer\nto an 'asynchronous generator iterator' in some contexts.  In cases\nwhere the intended meaning isn't clear, using the full terms avoids\nambiguity.\n\nAn asynchronous generator function may contain *note await: 516.\nexpressions as well as *note async for: 8e0, and *note async with:\n399. statements.\n\nasynchronous generator iterator\n\nAn object created by a *note asynchronous generator: 1d47.\nfunction.\n\nThis is an *note asynchronous iterator: bd4. which when called\nusing the *note anext(): 1c2a. method returns an awaitable\nobject which will execute the body of the asynchronous generator\nfunction until the next *note yield: 7f1. expression.\n\nEach *note yield: 7f1. temporarily suspends processing, remembering\nthe location execution state (including local variables and pending\ntry-statements).  When the 'asynchronous generator iterator'\neffectively resumes with another awaitable returned by *note\nanext(): 1c2a, it picks up where it left off.  See PEP 492(5)\nand PEP 525(6).\n\nasynchronous iterable\n\nAn object, that can be used in an *note async for: 8e0. statement.\nMust return an *note asynchronous iterator: bd4. from its *note\naiter(): a41. method.  Introduced by PEP 492(7).\n\nasynchronous iterator\n\nAn object that implements the *note aiter(): a41. and *note\nanext(): 1c2a. methods.  *note anext(): 1c2a. must return\nan *note awaitable: ac3. object.  *note async for: 8e0. resolves\nthe awaitables returned by an asynchronous iterator's *note\nanext(): 1c2a. method until it raises a *note\nStopAsyncIteration: 17a6. exception.  Introduced by PEP 492(8).\n\nattribute\n\nA value associated with an object which is usually referenced by\nname using dotted expressions.  For example, if an object 'o' has\nan attribute 'a' it would be referenced as 'o.a'.\n\nIt is possible to give an object an attribute whose name is not an\nidentifier as defined by *note Identifiers and keywords: 1bb5, for\nexample using *note setattr(): 1e63, if the object allows it.  Such\nan attribute will not be accessible using a dotted expression, and\nwould instead need to be retrieved with *note getattr(): a15.\n\nawaitable\n\nAn object that can be used in an *note await: 516. expression.  Can\nbe a *note coroutine: 1ae. or an object with an *note await():\n1cce. method.  See also PEP 492(9).\n",
            "subsections": []
        },
        "BDFL": {
            "content": "Benevolent Dictator For Life, a.k.a.  Guido van Rossum(10),\nPython's creator.\n\nbinary file\n\nA *note file object: 1037. able to read and write *note bytes-like\nobjects: b82.  Examples of binary files are files opened in binary\nmode (''rb'', ''wb'' or ''rb+''), *note sys.stdin.buffer: 293,\n*note sys.stdout.buffer: 90c, and instances of *note io.BytesIO:\nd08. and *note gzip.GzipFile: 25e.\n\nSee also *note text file: 1a0b. for a file object able to read and\nwrite *note str: 157. objects.\n\nborrowed reference\n\nIn Python's C API, a borrowed reference is a reference to an\nobject, where the code using the object does not own the reference.\nIt becomes a dangling pointer if the object is destroyed.  For\nexample, a garbage collection can remove the last *note strong\nreference: 57c. to the object and so destroy it.\n\nCalling *note PyINCREF(): 2ce. on the *note borrowed reference:\n4732. is recommended to convert it to a *note strong reference:\n57c. in-place, except when the object cannot be destroyed before\nthe last usage of the borrowed reference.  The *note PyNewRef():\n6ab. function can be used to create a new *note strong reference:\n57c.\n\nbytes-like object\n\nAn object that supports the *note Buffer Protocol: 148. and can\nexport a C-*note contiguous: 1f33. buffer.  This includes all *note\nbytes: 295, *note bytearray: 294, and *note array.array: 18f.\nobjects, as well as many common *note memoryview: 17f. objects.\nBytes-like objects can be used for various operations that work\nwith binary data; these include compression, saving to a binary\nfile, and sending over a socket.\n\nSome operations need the binary data to be mutable.  The\ndocumentation often refers to these as \"read-write bytes-like\nobjects\".  Example mutable buffer objects include *note bytearray:\n294. and a *note memoryview: 17f. of a *note bytearray: 294.  Other\noperations require the binary data to be stored in immutable\nobjects (\"read-only bytes-like objects\"); examples of these include\n*note bytes: 295. and a *note memoryview: 17f. of a *note bytes:\n295. object.\n\nbytecode\n\nPython source code is compiled into bytecode, the internal\nrepresentation of a Python program in the CPython interpreter.  The\nbytecode is also cached in '.pyc' files so that executing the same\nfile is faster the second time (recompilation from source to\nbytecode can be avoided).  This \"intermediate language\" is said to\nrun on a *note virtual machine: 3147. that executes the machine\ncode corresponding to each bytecode.  Do note that bytecodes are\nnot expected to work between different Python virtual machines, nor\nto be stable between Python releases.\n\nA list of bytecode instructions can be found in the documentation\nfor *note the dis module: 371.\n\ncallable\n\nA callable is an object that can be called, possibly with a set of\narguments (see *note argument: 154.), with the following syntax:\n\ncallable(argument1, argument2, argumentN)\n\nA *note function: 1d62, and by extension a *note method: 4ecf, is a\ncallable.  An instance of a class that implements the *note\ncall(): 2b1. method is also a callable.\n\ncallback\n\nA subroutine function which is passed as an argument to be executed\nat some point in the future.\n\nclass\n\nA template for creating user-defined objects.  Class definitions\nnormally contain method definitions which operate on instances of\nthe class.\n\nclass variable\n\nA variable defined in a class and intended to be modified only at\nclass level (i.e., not in an instance of the class).\n\ncomplex number\n\nAn extension of the familiar real number system in which all\nnumbers are expressed as a sum of a real part and an imaginary\npart.  Imaginary numbers are real multiples of the imaginary unit\n(the square root of '-1'), often written 'i' in mathematics or 'j'\nin engineering.  Python has built-in support for complex numbers,\nwhich are written with this latter notation; the imaginary part is\nwritten with a 'j' suffix, e.g., '3+1j'.  To get access to complex\nequivalents of the *note math: 89. module, use *note cmath: 16.\nUse of complex numbers is a fairly advanced mathematical feature.\nIf you're not aware of a need for them, it's almost certain you can\nsafely ignore them.\n\ncontext manager\n\nAn object which controls the environment seen in a *note with: 396.\nstatement by defining *note enter(): 389. and *note exit():\n1175. methods.  See PEP 343(11).\n\ncontext variable\n\nA variable which can have different values depending on its\ncontext.  This is similar to Thread-Local Storage in which each\nexecution thread may have a different value for a variable.\nHowever, with context variables, there may be several contexts in\none execution thread and the main usage for context variables is to\nkeep track of variables in concurrent asynchronous tasks.  See\n*note contextvars: 22.\n\ncontiguous\n\nA buffer is considered contiguous exactly if it is either\n'C-contiguous' or 'Fortran contiguous'.  Zero-dimensional buffers\nare C and Fortran contiguous.  In one-dimensional arrays, the items\nmust be laid out in memory next to each other, in order of\nincreasing indexes starting from zero.  In multidimensional\nC-contiguous arrays, the last index varies the fastest when\nvisiting items in order of memory address.  However, in Fortran\ncontiguous arrays, the first index varies the fastest.\n\ncoroutine\n\nCoroutines are a more generalized form of subroutines.  Subroutines\nare entered at one point and exited at another point.  Coroutines\ncan be entered, exited, and resumed at many different points.  They\ncan be implemented with the *note async def: 394. statement.  See\nalso PEP 492(12).\n\ncoroutine function\n\nA function which returns a *note coroutine: 1ae. object.  A\ncoroutine function may be defined with the *note async def: 394.\nstatement, and may contain *note await: 516, *note async for: 8e0,\nand *note async with: 399. keywords.  These were introduced by PEP\n492(13).\n\nCPython\n\nThe canonical implementation of the Python programming language, as\ndistributed on python.org(14).  The term \"CPython\" is used when\nnecessary to distinguish this implementation from others such as\nJython or IronPython.\n\ndecorator\n\nA function returning another function, usually applied as a\nfunction transformation using the '@wrapper' syntax.  Common\nexamples for decorators are *note classmethod(): 246. and *note\nstaticmethod(): 5cc.\n\nThe decorator syntax is merely syntactic sugar, the following two\nfunction definitions are semantically equivalent:\n\ndef f(arg):\n...\nf = staticmethod(f)\n\n@staticmethod\ndef f(arg):\n...\n\nThe same concept exists for classes, but is less commonly used\nthere.  See the documentation for *note function definitions: 19bb.\nand *note class definitions: 114c. for more about decorators.\n\ndescriptor\n\nAny object which defines the methods *note get(): 1518, *note\nset(): 1c6f, or *note delete(): 1c70.  When a class\nattribute is a descriptor, its special binding behavior is\ntriggered upon attribute lookup.  Normally, using 'a.b' to get, set\nor delete an attribute looks up the object named 'b' in the class\ndictionary for 'a', but if 'b' is a descriptor, the respective\ndescriptor method gets called.  Understanding descriptors is a key\nto a deep understanding of Python because they are the basis for\nmany features including functions, methods, properties, class\nmethods, static methods, and reference to super classes.\n\nFor more information about descriptors' methods, see *note\nImplementing Descriptors: a98. or the *note Descriptor How To\nGuide: 1346.\n\ndictionary\n\nAn associative array, where arbitrary keys are mapped to values.\nThe keys can be any object with *note hash(): 932. and *note\neq(): 931. methods.  Called a hash in Perl.\n\ndictionary comprehension\n\nA compact way to process all or part of the elements in an iterable\nand return a dictionary with the results.  'results = {n: n  2\nfor n in range(10)}' generates a dictionary containing key 'n'\nmapped to value 'n  2'.  See *note Displays for lists, sets and\ndictionaries: 393.\n\ndictionary view\n\nThe objects returned from *note dict.keys(): 5bf, *note\ndict.values(): 5c0, and *note dict.items(): 5c1. are called\ndictionary views.  They provide a dynamic view on the dictionary's\nentries, which means that when the dictionary changes, the view\nreflects these changes.  To force the dictionary view to become a\nfull list use 'list(dictview)'.  See *note Dictionary view objects:\n1f50.\n\ndocstring\n\nA string literal which appears as the first expression in a class,\nfunction or module.  While ignored when the suite is executed, it\nis recognized by the compiler and put into the 'doc' attribute\nof the enclosing class, function or module.  Since it is available\nvia introspection, it is the canonical place for documentation of\nthe object.\n\nduck-typing\n\nA programming style which does not look at an object's type to\ndetermine if it has the right interface; instead, the method or\nattribute is simply called or used (\"If it looks like a duck and\nquacks like a duck, it must be a duck.\") By emphasizing interfaces\nrather than specific types, well-designed code improves its\nflexibility by allowing polymorphic substitution.  Duck-typing\navoids tests using *note type(): ba0. or *note isinstance(): 14b.\n(Note, however, that duck-typing can be complemented with *note\nabstract base classes: 102a.)  Instead, it typically employs *note\nhasattr(): 1f7. tests or *note EAFP: 2874. programming.\n",
            "subsections": []
        },
        "EAFP": {
            "content": "Easier to ask for forgiveness than permission.  This common Python\ncoding style assumes the existence of valid keys or attributes and\ncatches exceptions if the assumption proves false.  This clean and\nfast style is characterized by the presence of many *note try: 4bc.\nand *note except: 379. statements.  The technique contrasts with\nthe *note LBYL: 4ed6. style common to many other languages such as\nC.\n\nexpression\n\nA piece of syntax which can be evaluated to some value.  In other\nwords, an expression is an accumulation of expression elements like\nliterals, names, attribute access, operators or function calls\nwhich all return a value.  In contrast to many other languages, not\nall language constructs are expressions.  There are also *note\nstatement: 247d.s which cannot be used as expressions, such as\n*note while: 198b.  Assignments are also statements, not\nexpressions.\n\nextension module\n\nA module written in C or C++, using Python's C API to interact with\nthe core and with user code.\n\nf-string\n\nString literals prefixed with ''f'' or ''F'' are commonly called\n\"f-strings\" which is short for *note formatted string literals:\n7cd.  See also PEP 498(15).\n\nfile object\n\nAn object exposing a file-oriented API (with methods such as\n'read()' or 'write()') to an underlying resource.  Depending on the\nway it was created, a file object can mediate access to a real\non-disk file or to another type of storage or communication device\n(for example standard input/output, in-memory buffers, sockets,\npipes, etc.).  File objects are also called 'file-like objects' or\n'streams'.\n\nThere are actually three categories of file objects: raw *note\nbinary files: 1a0c, buffered *note binary files: 1a0c. and *note\ntext files: 1a0b.  Their interfaces are defined in the *note io:\n79. module.  The canonical way to create a file object is by using\nthe *note open(): 26e. function.\n\nfile-like object\n\nA synonym for *note file object: 1037.\n\nfilesystem encoding and error handler\n\nEncoding and error handler used by Python to decode bytes from the\noperating system and encode Unicode to the operating system.\n\nThe filesystem encoding must guarantee to successfully decode all\nbytes below 128.  If the file system encoding fails to provide this\nguarantee, API functions can raise *note UnicodeError: 111b.\n\nThe *note sys.getfilesystemencoding(): aa2. and *note\nsys.getfilesystemencodeerrors(): b35. functions can be used to get\nthe filesystem encoding and error handler.\n\nThe *note filesystem encoding and error handler: 291. are\nconfigured at Python startup by the *note PyConfigRead(): 57e.\nfunction: see *note filesystemencoding: 313. and *note\nfilesystemerrors: 314. members of *note PyConfig: 318.\n\nSee also the *note locale encoding: 27fa.\n\nfinder\n\nAn object that tries to find the *note loader: 13e6. for a module\nthat is being imported.\n\nSince Python 3.3, there are two types of finder: *note meta path\nfinders: ee7. for use with *note sys.metapath: b80, and *note path\nentry finders: ee8. for use with *note sys.pathhooks: e9b.\n\nSee PEP 302(16), PEP 420(17) and PEP 451(18) for much more detail.\n\nfloor division\n\nMathematical division that rounds down to nearest integer.  The\nfloor division operator is '//'.  For example, the expression '11\n// 4' evaluates to '2' in contrast to the '2.75' returned by float\ntrue division.  Note that '(-11) // 4' is '-3' because that is\n'-2.75' rounded 'downward'.  See PEP 238(19).\n\nfunction\n\nA series of statements which returns some value to a caller.  It\ncan also be passed zero or more *note arguments: 154. which may be\nused in the execution of the body.  See also *note parameter: 1c1e,\n*note method: 4ecf, and the *note Function definitions: 19bb.\nsection.\n\nfunction annotation\n\nAn *note annotation: 168. of a function parameter or return value.\n\nFunction annotations are usually used for *note type hints: 1c89.:\nfor example, this function is expected to take two *note int: 17e.\narguments and is also expected to have an *note int: 17e. return\nvalue:\n\ndef sumtwonumbers(a: int, b: int) -> int:\nreturn a + b\n\nFunction annotation syntax is explained in section *note Function\ndefinitions: 19bb.\n\nSee *note variable annotation: bb0. and PEP 484(20), which describe\nthis functionality.  Also see *note Annotations Best Practices:\n5cd. for best practices on working with annotations.\n\nfuture\n\nA *note future statement: 390, 'from future import <feature>',\ndirects the compiler to compile the current module using syntax or\nsemantics that will become standard in a future release of Python.\nThe *note future: 0. module documents the possible values of\n'feature'.  By importing this module and evaluating its variables,\nyou can see when a new feature was first added to the language and\nwhen it will (or did) become the default:\n\n>>> import future\n>>> future.division\nFeature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)\n\ngarbage collection\n\nThe process of freeing memory when it is not used anymore.  Python\nperforms garbage collection via reference counting and a cyclic\ngarbage collector that is able to detect and break reference\ncycles.  The garbage collector can be controlled using the *note\ngc: 5b. module.\n\ngenerator\n\nA function which returns a *note generator iterator: a22.  It looks\nlike a normal function except that it contains *note yield: 7f1.\nexpressions for producing a series of values usable in a for-loop\nor that can be retrieved one at a time with the *note next(): 5cb.\nfunction.\n\nUsually refers to a generator function, but may refer to a\n'generator iterator' in some contexts.  In cases where the intended\nmeaning isn't clear, using the full terms avoids ambiguity.\n\ngenerator iterator\n\nAn object created by a *note generator: eda. function.\n\nEach *note yield: 7f1. temporarily suspends processing, remembering\nthe location execution state (including local variables and pending\ntry-statements).  When the 'generator iterator' resumes, it picks\nup where it left off (in contrast to functions which start fresh on\nevery invocation).\n\ngenerator expression\n\nAn expression that returns an iterator.  It looks like a normal\nexpression followed by a 'for' clause defining a loop variable,\nrange, and an optional 'if' clause.  The combined expression\ngenerates values for an enclosing function:\n\n>>> sum(i*i for i in range(10))         # sum of squares 0, 1, 4, ... 81\n285\n\ngeneric function\n\nA function composed of multiple functions implementing the same\noperation for different types.  Which implementation should be used\nduring a call is determined by the dispatch algorithm.\n\nSee also the *note single dispatch: 818. glossary entry, the *note\nfunctools.singledispatch(): 406. decorator, and PEP 443(21).\n\ngeneric type\n\nA *note type: 1699. that can be parameterized; typically a *note\ncontainer class: 1c92. such as *note list: 3dc. or *note dict: 237.\nUsed for *note type hints: 1c89. and *note annotations: 168.\n\nFor more details, see *note generic alias types: 480, PEP 483(22),\nPEP 484(23), PEP 585(24), and the *note typing: ff. module.\n",
            "subsections": []
        },
        "GIL": {
            "content": "See *note global interpreter lock: 141.\n\nglobal interpreter lock\n\nThe mechanism used by the *note CPython: 4c9. interpreter to assure\nthat only one thread executes Python *note bytecode: 370. at a\ntime.  This simplifies the CPython implementation by making the\nobject model (including critical built-in types such as *note dict:\n237.) implicitly safe against concurrent access.  Locking the\nentire interpreter makes it easier for the interpreter to be\nmulti-threaded, at the expense of much of the parallelism afforded\nby multi-processor machines.\n\nHowever, some extension modules, either standard or third-party,\nare designed so as to release the GIL when doing computationally\nintensive tasks such as compression or hashing.  Also, the GIL is\nalways released when doing I/O.\n\nPast efforts to create a \"free-threaded\" interpreter (one which\nlocks shared data at a much finer granularity) have not been\nsuccessful because performance suffered in the common\nsingle-processor case.  It is believed that overcoming this\nperformance issue would make the implementation much more\ncomplicated and therefore costlier to maintain.\n\nhash-based pyc\n\nA bytecode cache file that uses the hash rather than the\nlast-modified time of the corresponding source file to determine\nits validity.  See *note Cached bytecode invalidation: 3b2.\n\nhashable\n\nAn object is 'hashable' if it has a hash value which never changes\nduring its lifetime (it needs a *note hash(): 932. method), and\ncan be compared to other objects (it needs an *note eq(): 931.\nmethod).  Hashable objects which compare equal must have the same\nhash value.\n\nHashability makes an object usable as a dictionary key and a set\nmember, because these data structures use the hash value\ninternally.\n\nMost of Python's immutable built-in objects are hashable; mutable\ncontainers (such as lists or dictionaries) are not; immutable\ncontainers (such as tuples and frozensets) are only hashable if\ntheir elements are hashable.  Objects which are instances of\nuser-defined classes are hashable by default.  They all compare\nunequal (except with themselves), and their hash value is derived\nfrom their *note id(): 1279.\n",
            "subsections": []
        },
        "LBYL": {
            "content": "Look before you leap.  This coding style explicitly tests for\npre-conditions before making calls or lookups.  This style\ncontrasts with the *note EAFP: 2874. approach and is characterized\nby the presence of many *note if: 24f. statements.\n\nIn a multi-threaded environment, the LBYL approach can risk\nintroducing a race condition between \"the looking\" and \"the\nleaping\".  For example, the code, 'if key in mapping: return\nmapping[key]' can fail if another thread removes 'key' from\n'mapping' after the test, but before the lookup.  This issue can be\nsolved with locks or by using the EAFP approach.\n\nlist\n\nA built-in Python *note sequence: 236.  Despite its name it is more\nakin to an array in other languages than to a linked list since\naccess to elements is 'O'(1).\n\nlist comprehension\n\nA compact way to process all or part of the elements in a sequence\nand return a list with the results.  'result = ['{:#04x}'.format(x)\nfor x in range(256) if x % 2 == 0]' generates a list of strings\ncontaining even hex numbers (0x..)  in the range from 0 to 255.\nThe *note if: 24f. clause is optional.  If omitted, all elements in\n'range(256)' are processed.\n\nloader\n\nAn object that loads a module.  It must define a method named\n'loadmodule()'.  A loader is typically returned by a *note finder:\n1cfc.  See PEP 302(25) for details and *note importlib.abc.Loader:\nd2b. for an *note abstract base class: 102a.\n\nlocale encoding\n\nOn Unix, it is the encoding of the LCCTYPE locale.  It can be set\nwith *note locale.setlocale(locale.LCCTYPE, newlocale): 500.\n\nOn Windows, it is the ANSI code page (ex: '\"cp1252\"').\n\nOn Android and VxWorks, Python uses '\"utf-8\"' as the locale\nencoding.\n\n*note locale.getencoding(): 41f. can be used to get the locale\nencoding.\n\nSee also the *note filesystem encoding and error handler: 291.\n\nmagic method\n\nAn informal synonym for *note special method: 160d.\n\nmapping\n\nA container object that supports arbitrary key lookups and\nimplements the methods specified in the *note\ncollections.abc.Mapping: 6e2. or *note\ncollections.abc.MutableMapping: f1e. *note abstract base classes:\n683.  Examples include *note dict: 237, *note\ncollections.defaultdict: 1031, *note collections.OrderedDict: 39f.\nand *note collections.Counter: f09.\n\nmeta path finder\n\nA *note finder: 1cfc. returned by a search of *note sys.metapath:\nb80.  Meta path finders are related to, but different from *note\npath entry finders: ee8.\n\nSee *note importlib.abc.MetaPathFinder: 669. for the methods that\nmeta path finders implement.\n\nmetaclass\n\nThe class of a class.  Class definitions create a class name, a\nclass dictionary, and a list of base classes.  The metaclass is\nresponsible for taking those three arguments and creating the\nclass.  Most object oriented programming languages provide a\ndefault implementation.  What makes Python special is that it is\npossible to create custom metaclasses.  Most users never need this\ntool, but when the need arises, metaclasses can provide powerful,\nelegant solutions.  They have been used for logging attribute\naccess, adding thread-safety, tracking object creation,\nimplementing singletons, and many other tasks.\n\nMore information can be found in *note Metaclasses: 1c7b.\n\nmethod\n\nA function which is defined inside a class body.  If called as an\nattribute of an instance of that class, the method will get the\ninstance object as its first *note argument: 154. (which is usually\ncalled 'self').  See *note function: 1d62. and *note nested scope:\n1e71.\n\nmethod resolution order\n\nMethod Resolution Order is the order in which base classes are\nsearched for a member during lookup.  See The Python 2.3 Method\nResolution Order(26) for details of the algorithm used by the\nPython interpreter since the 2.3 release.\n\nmodule\n\nAn object that serves as an organizational unit of Python code.\nModules have a namespace containing arbitrary Python objects.\nModules are loaded into Python by the process of *note importing:\n1cf0.\n\nSee also *note package: 1cf3.\n\nmodule spec\n\nA namespace containing the import-related information used to load\na module.  An instance of *note importlib.machinery.ModuleSpec:\n1d07.\n",
            "subsections": []
        },
        "MRO": {
            "content": "See *note method resolution order: 1e8b.\n\nmutable\n\nMutable objects can change their value but keep their *note id():\n1279.  See also *note immutable: 1982.\n\nnamed tuple\n\nThe term \"named tuple\" applies to any type or class that inherits\nfrom tuple and whose indexable elements are also accessible using\nnamed attributes.  The type or class may have other features as\nwell.\n\nSeveral built-in types are named tuples, including the values\nreturned by *note time.localtime(): 1353. and *note os.stat(): 1bf.\nAnother example is *note sys.floatinfo: 175f.:\n\n>>> sys.floatinfo[1]                   # indexed access\n1024\n>>> sys.floatinfo.maxexp              # named field access\n1024\n>>> isinstance(sys.floatinfo, tuple)   # kind of tuple\nTrue\n\nSome named tuples are built-in types (such as the above examples).\nAlternatively, a named tuple can be created from a regular class\ndefinition that inherits from *note tuple: 4b8. and that defines\nnamed fields.  Such a class can be written by hand, or it can be\ncreated by inheriting *note typing.NamedTuple: 1f9, or with the\nfactory function *note collections.namedtuple(): 711.  The latter\ntechniques also add some extra methods that may not be found in\nhand-written or built-in named tuples.\n\nnamespace\n\nThe place where a variable is stored.  Namespaces are implemented\nas dictionaries.  There are the local, global and built-in\nnamespaces as well as nested namespaces in objects (in methods).\nNamespaces support modularity by preventing naming conflicts.  For\ninstance, the functions *note builtins.open: 26e. and *note\nos.open(): bee. are distinguished by their namespaces.  Namespaces\nalso aid readability and maintainability by making it clear which\nmodule implements a function.  For instance, writing *note\nrandom.seed(): 10ec. or *note itertools.islice(): 988. makes it\nclear that those functions are implemented by the *note random: b3.\nand *note itertools: 7b. modules, respectively.\n\nnamespace package\n\nA PEP 420(27) *note package: 1cf3. which serves only as a container\nfor subpackages.  Namespace packages may have no physical\nrepresentation, and specifically are not like a *note regular\npackage: 1cf5. because they have no 'init.py' file.\n\nSee also *note module: 1463.\n\nnested scope\n\nThe ability to refer to a variable in an enclosing definition.  For\ninstance, a function defined inside another function can refer to\nvariables in the outer function.  Note that nested scopes by\ndefault work only for reference and not for assignment.  Local\nvariables both read and write in the innermost scope.  Likewise,\nglobal variables read and write to the global namespace.  The *note\nnonlocal: 111f. allows writing to outer scopes.\n\nnew-style class\n\nOld name for the flavor of classes now used for all class objects.\nIn earlier Python versions, only new-style classes could use\nPython's newer, versatile features like *note slots: 1344,\ndescriptors, properties, *note getattribute(): a16, class\nmethods, and static methods.\n\nobject\n\nAny data with state (attributes or value) and defined behavior\n(methods).  Also the ultimate base class of any *note new-style\nclass: 257c.\n\npackage\n\nA Python *note module: 1463. which can contain submodules or\nrecursively, subpackages.  Technically, a package is a Python\nmodule with a 'path' attribute.\n\nSee also *note regular package: 1cf5. and *note namespace package:\n19ed.\n\nparameter\n\nA named entity in a *note function: 1d62. (or method) definition\nthat specifies an *note argument: 154. (or in some cases,\narguments) that the function can accept.  There are five kinds of\nparameter:\n\n* 'positional-or-keyword': specifies an argument that can be\npassed either *note positionally: 154. or as a *note keyword\nargument: 154.  This is the default kind of parameter, for\nexample 'foo' and 'bar' in the following:\n\ndef func(foo, bar=None): ...\n\n* 'positional-only': specifies an argument that can be supplied\nonly by position.  Positional-only parameters can be defined\nby including a '/' character in the parameter list of the\nfunction definition after them, for example 'posonly1' and\n'posonly2' in the following:\n\ndef func(posonly1, posonly2, /, positionalorkeyword): ...\n\n* 'keyword-only': specifies an argument that can be supplied\nonly by keyword.  Keyword-only parameters can be defined by\nincluding a single var-positional parameter or bare '*' in the\nparameter list of the function definition before them, for\nexample 'kwonly1' and 'kwonly2' in the following:\n\ndef func(arg, *, kwonly1, kwonly2): ...\n\n* 'var-positional': specifies that an arbitrary sequence of\npositional arguments can be provided (in addition to any\npositional arguments already accepted by other parameters).\nSuch a parameter can be defined by prepending the parameter\nname with '*', for example 'args' in the following:\n\ndef func(*args, kwargs): ...\n\n* 'var-keyword': specifies that arbitrarily many keyword\narguments can be provided (in addition to any keyword\narguments already accepted by other parameters).  Such a\nparameter can be defined by prepending the parameter name with\n'', for example 'kwargs' in the example above.\n\nParameters can specify both optional and required arguments, as\nwell as default values for some optional arguments.\n\nSee also the *note argument: 154. glossary entry, the FAQ question\non *note the difference between arguments and parameters: 4e1b, the\n*note inspect.Parameter: c73. class, the *note Function\ndefinitions: 19bb. section, and PEP 362(28).\n\npath entry\n\nA single location on the *note import path: 1cfe. which the *note\npath based finder: 1d01. consults to find modules for importing.\n\npath entry finder\n\nA *note finder: 1cfc. returned by a callable on *note\nsys.pathhooks: e9b. (i.e.  a *note path entry hook: 1d14.) which\nknows how to locate modules given a *note path entry: 1d12.\n\nSee *note importlib.abc.PathEntryFinder: 66a. for the methods that\npath entry finders implement.\n\npath entry hook\n\nA callable on the *note sys.pathhooks: e9b. list which returns a\n*note path entry finder: ee8. if it knows how to find modules on a\nspecific *note path entry: 1d12.\n\npath based finder\n\nOne of the default *note meta path finders: ee7. which searches an\n*note import path: 1cfe. for modules.\n\npath-like object\n\nAn object representing a file system path.  A path-like object is\neither a *note str: 157. or *note bytes: 295. object representing a\npath, or an object implementing the *note os.PathLike: a9a.\nprotocol.  An object that supports the *note os.PathLike: a9a.\nprotocol can be converted to a *note str: 157. or *note bytes: 295.\nfile system path by calling the *note os.fspath(): a9c. function;\n*note os.fsdecode(): a9d. and *note os.fsencode(): a9e. can be used\nto guarantee a *note str: 157. or *note bytes: 295. result instead,\nrespectively.  Introduced by PEP 519(29).\n",
            "subsections": []
        },
        "PEP": {
            "content": "Python Enhancement Proposal.  A PEP is a design document providing\ninformation to the Python community, or describing a new feature\nfor Python or its processes or environment.  PEPs should provide a\nconcise technical specification and a rationale for proposed\nfeatures.\n\nPEPs are intended to be the primary mechanisms for proposing major\nnew features, for collecting community input on an issue, and for\ndocumenting the design decisions that have gone into Python.  The\nPEP author is responsible for building consensus within the\ncommunity and documenting dissenting opinions.\n\nSee PEP 1(30).\n\nportion\n\nA set of files in a single directory (possibly stored in a zip\nfile) that contribute to a namespace package, as defined in PEP\n420(31).\n\npositional argument\n\nSee *note argument: 154.\n\nprovisional API\n\nA provisional API is one which has been deliberately excluded from\nthe standard library's backwards compatibility guarantees.  While\nmajor changes to such interfaces are not expected, as long as they\nare marked provisional, backwards incompatible changes (up to and\nincluding removal of the interface) may occur if deemed necessary\nby core developers.  Such changes will not be made gratuitously -\nthey will occur only if serious fundamental flaws are uncovered\nthat were missed prior to the inclusion of the API.\n\nEven for provisional APIs, backwards incompatible changes are seen\nas a \"solution of last resort\" - every attempt will still be made\nto find a backwards compatible resolution to any identified\nproblems.\n\nThis process allows the standard library to continue to evolve over\ntime, without locking in problematic design errors for extended\nperiods of time.  See PEP 411(32) for more details.\n\nprovisional package\n\nSee *note provisional API: 93a.\n",
            "subsections": []
        },
        "Python 3000": {
            "content": "Nickname for the Python 3.x release line (coined long ago when the\nrelease of version 3 was something in the distant future.)  This is\nalso abbreviated \"Py3k\".\n",
            "subsections": []
        },
        "Pythonic": {
            "content": "An idea or piece of code which closely follows the most common\nidioms of the Python language, rather than implementing code using\nconcepts common to other languages.  For example, a common idiom in\nPython is to loop over all elements of an iterable using a *note\nfor: 24e. statement.  Many other languages don't have this type of\nconstruct, so people unfamiliar with Python sometimes use a\nnumerical counter instead:\n\nfor i in range(len(food)):\nprint(food[i])\n\nAs opposed to the cleaner, Pythonic method:\n\nfor piece in food:\nprint(piece)\n\nqualified name\n\nA dotted name showing the \"path\" from a module's global scope to a\nclass, function or method defined in that module, as defined in PEP\n3155(33).  For top-level functions and classes, the qualified name\nis the same as the object's name:\n\n>>> class C:\n...     class D:\n...         def meth(self):\n...             pass\n...\n>>> C.qualname\n'C'\n>>> C.D.qualname\n'C.D'\n>>> C.D.meth.qualname\n'C.D.meth'\n\nWhen used to refer to modules, the 'fully qualified name' means the\nentire dotted path to the module, including any parent packages,\ne.g.  'email.mime.text':\n\n>>> import email.mime.text\n>>> email.mime.text.name\n'email.mime.text'\n\nreference count\n\nThe number of references to an object.  When the reference count of\nan object drops to zero, it is deallocated.  Some objects are\n\"immortal\" and have reference counts that are never modified, and\ntherefore the objects are never deallocated.  Reference counting is\ngenerally not visible to Python code, but it is a key element of\nthe *note CPython: 4c9. implementation.  Programmers can call the\n*note sys.getrefcount(): 4013. function to return the reference\ncount for a particular object.\n\nregular package\n\nA traditional *note package: 1cf3, such as a directory containing\nan 'init.py' file.\n\nSee also *note namespace package: 19ed.\n\nslots\n\nA declaration inside a class that saves memory by pre-declaring\nspace for instance attributes and eliminating instance\ndictionaries.  Though popular, the technique is somewhat tricky to\nget right and is best reserved for rare cases where there are large\nnumbers of instances in a memory-critical application.\n\nsequence\n\nAn *note iterable: 109d. which supports efficient element access\nusing integer indices via the *note getitem(): 4b9. special\nmethod and defines a *note len(): 1c68. method that returns the\nlength of the sequence.  Some built-in sequence types are *note\nlist: 3dc, *note str: 157, *note tuple: 4b8, and *note bytes: 295.\nNote that *note dict: 237. also supports *note getitem(): 4b9.\nand 'len()', but is considered a mapping rather than a sequence\nbecause the lookups use arbitrary *note immutable: 1982. keys\nrather than integers.\n\nThe *note collections.abc.Sequence: 1038. abstract base class\ndefines a much richer interface that goes beyond just *note\ngetitem(): 4b9. and *note len(): 1c68, adding 'count()',\n'index()', *note contains(): 1c63, and *note reversed():\n1c62.  Types that implement this expanded interface can be\nregistered explicitly using *note register(): f00.  For more\ndocumentation on sequence methods generally, see *note Common\nSequence Operations: 1eb4.\n\nset comprehension\n\nA compact way to process all or part of the elements in an iterable\nand return a set with the results.  'results = {c for c in\n'abracadabra' if c not in 'abc'}' generates the set of strings\n'{'r', 'd'}'.  See *note Displays for lists, sets and dictionaries:\n393.\n\nsingle dispatch\n\nA form of *note generic function: 817. dispatch where the\nimplementation is chosen based on the type of a single argument.\n\nslice\n\nAn object usually containing a portion of a *note sequence: 236.  A\nslice is created using the subscript notation, '[]' with colons\nbetween numbers when several are given, such as in\n'variablename[1:3:5]'.  The bracket (subscript) notation uses\n*note slice: 180. objects internally.\n\nspecial method\n\nA method that is called implicitly by Python to execute a certain\noperation on a type, such as addition.  Such methods have names\nstarting and ending with double underscores.  Special methods are\ndocumented in *note Special method names: ab9.\n\nstatement\n\nA statement is part of a suite (a \"block\" of code).  A statement is\neither an *note expression: 1c8d. or one of several constructs with\na keyword, such as *note if: 24f, *note while: 198b. or *note for:\n24e.\n\nstatic type checker\n\nAn external tool that reads Python code and analyzes it, looking\nfor issues such as incorrect types.  See also *note type hints:\n1c89. and the *note typing: ff. module.\n\nstrong reference\n\nIn Python's C API, a strong reference is a reference to an object\nwhich is owned by the code holding the reference.  The strong\nreference is taken by calling *note PyINCREF(): 2ce. when the\nreference is created and released with *note PyDECREF(): 2cf. when\nthe reference is deleted.\n\nThe *note PyNewRef(): 6ab. function can be used to create a strong\nreference to an object.  Usually, the *note PyDECREF(): 2cf.\nfunction must be called on the strong reference before exiting the\nscope of the strong reference, to avoid leaking one reference.\n\nSee also *note borrowed reference: 4732.\n\ntext encoding\n\nA string in Python is a sequence of Unicode code points (in range\n'U+0000'-'U+10FFFF').  To store or transfer a string, it needs to\nbe serialized as a sequence of bytes.\n\nSerializing a string into a sequence of bytes is known as\n\"encoding\", and recreating the string from the sequence of bytes is\nknown as \"decoding\".\n\nThere are a variety of different text serialization *note codecs:\nc15, which are collectively referred to as \"text encodings\".\n\ntext file\n\nA *note file object: 1037. able to read and write *note str: 157.\nobjects.  Often, a text file actually accesses a byte-oriented\ndatastream and handles the *note text encoding: 1e83.\nautomatically.  Examples of text files are files opened in text\nmode (''r'' or ''w''), *note sys.stdin: 293, *note sys.stdout: 90c,\nand instances of *note io.StringIO: d94.\n\nSee also *note binary file: 1a0c. for a file object able to read\nand write *note bytes-like objects: b82.\n\ntriple-quoted string\n\nA string which is bound by three instances of either a quotation\nmark (\") or an apostrophe (').  While they don't provide any\nfunctionality not available with single-quoted strings, they are\nuseful for a number of reasons.  They allow you to include\nunescaped single and double quotes within a string and they can\nspan multiple lines without the use of the continuation character,\nmaking them especially useful when writing docstrings.\n\ntype\n\nThe type of a Python object determines what kind of object it is;\nevery object has a type.  An object's type is accessible as its\n*note class: 1304. attribute or can be retrieved with\n'type(obj)'.\n\ntype alias\n\nA synonym for a type, created by assigning the type to an\nidentifier.\n\nType aliases are useful for simplifying *note type hints: 1c89.\nFor example:\n\ndef removegrayshades(\ncolors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\npass\n\ncould be made more readable like this:\n\nColor = tuple[int, int, int]\n\ndef removegrayshades(colors: list[Color]) -> list[Color]:\npass\n\nSee *note typing: ff. and PEP 484(34), which describe this\nfunctionality.\n\ntype hint\n\nAn *note annotation: 168. that specifies the expected type for a\nvariable, a class attribute, or a function parameter or return\nvalue.\n\nType hints are optional and are not enforced by Python but they are\nuseful to *note static type checkers: 2132.  They can also aid IDEs\nwith code completion and refactoring.\n\nType hints of global variables, class attributes, and functions,\nbut not local variables, can be accessed using *note\ntyping.gettypehints(): 47f.\n\nSee *note typing: ff. and PEP 484(35), which describe this\nfunctionality.\n\nuniversal newlines\n\nA manner of interpreting text streams in which all of the following\nare recognized as ending a line: the Unix end-of-line convention\n''\\n'', the Windows convention ''\\r\\n'', and the old Macintosh\nconvention ''\\r''.  See PEP 278(36) and PEP 3116(37), as well as\n*note bytes.splitlines(): 1f21. for an additional use.\n\nvariable annotation\n\nAn *note annotation: 168. of a variable or a class attribute.\n\nWhen annotating a variable or a class attribute, assignment is\noptional:\n\nclass C:\nfield: 'annotation'\n\nVariable annotations are usually used for *note type hints: 1c89.:\nfor example this variable is expected to take *note int: 17e.\nvalues:\n\ncount: int = 0\n\nVariable annotation syntax is explained in section *note Annotated\nassignment statements: 1dae.\n\nSee *note function annotation: 19bc, PEP 484(38) and PEP 526(39),\nwhich describe this functionality.  Also see *note Annotations Best\nPractices: 5cd. for best practices on working with annotations.\n\nvirtual environment\n\nA cooperatively isolated runtime environment that allows Python\nusers and applications to install and upgrade Python distribution\npackages without interfering with the behaviour of other Python\napplications running on the same system.\n\nSee also *note venv: 10c.\n\nvirtual machine\n\nA computer defined entirely in software.  Python's virtual machine\nexecutes the *note bytecode: 370. emitted by the bytecode compiler.\n\nZen of Python\n\nListing of Python design principles and philosophies that are\nhelpful in understanding and using the language.  The listing can\nbe found by typing \"'import this'\" at the interactive prompt.\n\n---------- Footnotes ----------\n\n(1) https://peps.python.org/pep-0484/\n\n(2) https://peps.python.org/pep-0526/\n\n(3) https://peps.python.org/pep-0362/\n\n(4) https://peps.python.org/pep-0492/\n\n(5) https://peps.python.org/pep-0492/\n\n(6) https://peps.python.org/pep-0525/\n\n(7) https://peps.python.org/pep-0492/\n\n(8) https://peps.python.org/pep-0492/\n\n(9) https://peps.python.org/pep-0492/\n\n(10) https://gvanrossum.github.io/\n\n(11) https://peps.python.org/pep-0343/\n\n(12) https://peps.python.org/pep-0492/\n\n(13) https://peps.python.org/pep-0492/\n\n(14) https://www.python.org\n\n(15) https://peps.python.org/pep-0498/\n\n(16) https://peps.python.org/pep-0302/\n\n(17) https://peps.python.org/pep-0420/\n\n(18) https://peps.python.org/pep-0451/\n\n(19) https://peps.python.org/pep-0238/\n\n(20) https://peps.python.org/pep-0484/\n\n(21) https://peps.python.org/pep-0443/\n\n(22) https://peps.python.org/pep-0483/\n\n(23) https://peps.python.org/pep-0484/\n\n(24) https://peps.python.org/pep-0585/\n\n(25) https://peps.python.org/pep-0302/\n\n(26) https://www.python.org/download/releases/2.3/mro/\n\n(27) https://peps.python.org/pep-0420/\n\n(28) https://peps.python.org/pep-0362/\n\n(29) https://peps.python.org/pep-0519/\n\n(30) https://peps.python.org/pep-0001/\n\n(31) https://peps.python.org/pep-0420/\n\n(32) https://peps.python.org/pep-0411/\n\n(33) https://peps.python.org/pep-3155/\n\n(34) https://peps.python.org/pep-0484/\n\n(35) https://peps.python.org/pep-0484/\n\n(36) https://peps.python.org/pep-0278/\n\n(37) https://peps.python.org/pep-3116/\n\n(38) https://peps.python.org/pep-0484/\n\n(39) https://peps.python.org/pep-0526/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: About these documents,  Next: Dealing with Bugs,  Prev: Glossary,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "12 About these documents": {
            "content": "",
            "subsections": []
        },
        "These documents are generated from reStructuredText(1) sources by": {
            "content": "",
            "subsections": []
        },
        "Sphinx(2), a document processor specifically written for the Python": {
            "content": "documentation.\n",
            "subsections": []
        },
        "Development of the documentation and its toolchain is an entirely": {
            "content": "volunteer effort, just like Python itself.  If you want to contribute,\nplease take a look at the *note Dealing with Bugs: 471c. page for\ninformation on how to do so.  New volunteers are always welcome!\n\nMany thanks go to:\n\n* Fred L. Drake, Jr., the creator of the original Python\ndocumentation toolset and writer of much of the content;\n\n* the Docutils(3) project for creating reStructuredText and the\nDocutils suite;\n\n* Fredrik Lundh for his Alternative Python Reference project from\nwhich Sphinx got many good ideas.\n\n* Menu:\n\n* Contributors to the Python Documentation::\n\n---------- Footnotes ----------\n\n(1) https://docutils.sourceforge.io/rst.html\n\n(2) https://www.sphinx-doc.org/\n\n(3) https://docutils.sourceforge.io/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Contributors to the Python Documentation,  Up: About these documents": {
            "content": "",
            "subsections": [
                {
                    "name": "12.1 Contributors to the Python Documentation",
                    "content": ""
                }
            ]
        },
        "Many people have contributed to the Python language, the Python standard": {
            "content": "library, and the Python documentation.  See Misc/ACKS(1) in the Python\nsource distribution for a partial list of contributors.\n",
            "subsections": []
        },
        "It is only with the input and contributions of the Python community that": {
            "content": "Python has such wonderful documentation - Thank You!\n\n---------- Footnotes ----------\n\n(1) https://github.com/python/cpython/tree/3.12/Misc/ACKS\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Dealing with Bugs,  Next: Copyright,  Prev: About these documents,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "13 Dealing with Bugs": {
            "content": "",
            "subsections": []
        },
        "Python is a mature programming language which has established a": {
            "content": "reputation for stability.  In order to maintain this reputation, the\ndevelopers would like to know of any deficiencies you find in Python.\n",
            "subsections": []
        },
        "It can be sometimes faster to fix bugs yourself and contribute patches": {
            "content": "to Python as it streamlines the process and involves less people.  Learn\nhow to *note contribute: 4ee9.\n\n* Menu:\n\n* Documentation bugs::\n* Using the Python issue tracker::\n* Getting started contributing to Python yourself::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Documentation bugs,  Next: Using the Python issue tracker,  Up: Dealing with Bugs": {
            "content": "",
            "subsections": [
                {
                    "name": "13.1 Documentation bugs",
                    "content": ""
                }
            ]
        },
        "If you find a bug in this documentation or would like to propose an": {
            "content": "improvement, please submit a bug report on the *note tracker: 4eeb.  If\nyou have a suggestion on how to fix it, include that as well.\n",
            "subsections": []
        },
        "You can also open a discussion item on our Documentation Discourse": {
            "content": "forum(1).\n",
            "subsections": []
        },
        "If you're short on time, you can also email documentation bug reports to": {
            "content": "<docs@python.org> (behavioral bugs can be sent to\n<python-list@python.org>).  'docs@' is a mailing list run by volunteers;\nyour request will be noticed, though it may take a while to be\nprocessed.\n\nSee also\n........\n",
            "subsections": []
        },
        "Documentation bugs(2)": {
            "content": "A list of documentation bugs that have been submitted to the Python\nissue tracker.\n",
            "subsections": []
        },
        "Issue Tracking(3)": {
            "content": "Overview of the process involved in reporting an improvement on the\ntracker.\n",
            "subsections": []
        },
        "Helping with Documentation(4)": {
            "content": "Comprehensive guide for individuals that are interested in\ncontributing to Python documentation.\n",
            "subsections": []
        },
        "Documentation Translations(5)": {
            "content": "A list of GitHub pages for documentation translation and their\nprimary contacts.\n\n---------- Footnotes ----------\n\n(1) https://discuss.python.org/c/documentation/26\n\n(2)\nhttps://github.com/python/cpython/issues?q=is%3Aissue+is%3Aopen+label%3Adocs\n\n(3) https://devguide.python.org/tracker/\n\n(4)\nhttps://devguide.python.org/docquality/#helping-with-documentation\n\n(5) https://devguide.python.org/documentation/translating/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Using the Python issue tracker,  Next: Getting started contributing to Python yourself,  Prev: Documentation bugs,  Up: Dealing with Bugs": {
            "content": "",
            "subsections": [
                {
                    "name": "13.2 Using the Python issue tracker",
                    "content": ""
                }
            ]
        },
        "Issue reports for Python itself should be submitted via the GitHub": {
            "content": "issues tracker ('https://github.com/python/cpython/issues').  The GitHub\nissues tracker offers a web form which allows pertinent information to\nbe entered and submitted to the developers.\n",
            "subsections": []
        },
        "The first step in filing a report is to determine whether the problem": {
            "content": "has already been reported.  The advantage in doing so, aside from saving\nthe developers' time, is that you learn what has been done to fix it; it\nmay be that the problem has already been fixed for the next release, or\nadditional information is needed (in which case you are welcome to\nprovide it if you can!).  To do this, search the tracker using the\nsearch box at the top of the page.\n",
            "subsections": []
        },
        "If the problem you're reporting is not already in the list, log in to": {
            "content": "",
            "subsections": []
        },
        "GitHub.  If you don't already have a GitHub account, create a new": {
            "content": "account using the \"Sign up\" link.  It is not possible to submit a bug\nreport anonymously.\n\nBeing now logged in, you can submit an issue.  Click on the \"New issue\"\nbutton in the top bar to report a new issue.\n\nThe submission form has two fields, \"Title\" and \"Comment\".\n\nFor the \"Title\" field, enter a 'very' short description of the problem;\nfewer than ten words is good.\n\nIn the \"Comment\" field, describe the problem in detail, including what\nyou expected to happen and what did happen.  Be sure to include whether\nany extension modules were involved, and what hardware and software\nplatform you were using (including version information as appropriate).\n",
            "subsections": []
        },
        "Each issue report will be reviewed by a developer who will determine": {
            "content": "what needs to be done to correct the problem.  You will receive an\nupdate each time an action is taken on the issue.\n\nSee also\n........\n",
            "subsections": []
        },
        "How to Report Bugs Effectively(1)": {
            "content": "Article which goes into some detail about how to create a useful\nbug report.  This describes what kind of information is useful and\nwhy it is useful.\n",
            "subsections": []
        },
        "Bug Writing Guidelines(2)": {
            "content": "Information about writing a good bug report.  Some of this is\nspecific to the Mozilla project, but describes general good\npractices.\n\n---------- Footnotes ----------\n\n(1) https://www.chiark.greenend.org.uk/~sgtatham/bugs.html\n\n(2) https://bugzilla.mozilla.org/page.cgi?id=bug-writing.html\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Getting started contributing to Python yourself,  Prev: Using the Python issue tracker,  Up: Dealing with Bugs": {
            "content": "",
            "subsections": [
                {
                    "name": "13.3 Getting started contributing to Python yourself",
                    "content": ""
                }
            ]
        },
        "Beyond just reporting bugs that you find, you are also welcome to submit": {
            "content": "patches to fix them.  You can find more information on how to get\nstarted patching Python in the Python Developer's Guide(1).  If you have\nquestions, the core-mentorship mailing list(2) is a friendly place to\nget answers to any and all questions pertaining to the process of fixing\nissues in Python.\n\n---------- Footnotes ----------\n\n(1) https://devguide.python.org/\n\n(2)\nhttps://mail.python.org/mailman3/lists/core-mentorship.python.org/\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Copyright,  Next: History and License,  Prev: Dealing with Bugs,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "14 Copyright": {
            "content": "Python and this documentation is:\n\nCopyright (C) 2001-2023 Python Software Foundation.  All rights reserved.\n\nCopyright (C) 2000 BeOpen.com.  All rights reserved.\n\nCopyright (C) 1995-2000 Corporation for National Research Initiatives.\nAll rights reserved.\n",
            "subsections": []
        },
        "Copyright (C) 1991-1995 Stichting Mathematisch Centrum.  All rights": {
            "content": "reserved.\n\n\n\nSee *note History and License: 4ef0. for complete license and\npermissions information.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: History and License,  Next: Python Module Index,  Prev: Copyright,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "15 History and License": {
            "content": "* Menu:\n\n* History of the software::\n* Terms and conditions for accessing or otherwise using Python::\n* Licenses and Acknowledgements for Incorporated Software::\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: History of the software,  Next: Terms and conditions for accessing or otherwise using Python,  Up: History and License": {
            "content": "",
            "subsections": [
                {
                    "name": "15.1 History of the software",
                    "content": ""
                }
            ]
        },
        "Python was created in the early 1990s by Guido van Rossum at Stichting": {
            "content": "",
            "subsections": []
        },
        "Mathematisch Centrum (CWI, see 'https://www.cwi.nl/') in the Netherlands": {
            "content": "as a successor of a language called ABC. Guido remains Python's\nprincipal author, although it includes many contributions from others.\n",
            "subsections": []
        },
        "In 1995, Guido continued his work on Python at the Corporation for": {
            "content": "",
            "subsections": []
        },
        "National Research Initiatives (CNRI, see": {
            "content": "'https://www.cnri.reston.va.us/') in Reston, Virginia where he released\nseveral versions of the software.\n",
            "subsections": []
        },
        "In May 2000, Guido and the Python core development team moved to": {
            "content": "",
            "subsections": []
        },
        "BeOpen.com to form the BeOpen PythonLabs team.  In October of the same": {
            "content": "year, the PythonLabs team moved to Digital Creations (now Zope",
            "subsections": []
        },
        "Corporation; see 'https://www.zope.org/').  In 2001, the Python Software": {
            "content": "",
            "subsections": []
        },
        "Foundation (PSF, see 'https://www.python.org/psf/') was formed, a": {
            "content": "non-profit organization created specifically to own Python-related",
            "subsections": []
        },
        "Intellectual Property.  Zope Corporation is a sponsoring member of the": {
            "content": "PSF.\n",
            "subsections": []
        },
        "All Python releases are Open Source (see 'https://opensource.org/' for": {
            "content": "the Open Source Definition).  Historically, most, but not all, Python\nreleases have also been GPL-compatible; the table below summarizes the\nvarious releases.\n\nRelease              Derived from       Year             Owner            GPL compatible?\n\n------------------------------------------------------------------------------------------------\n\n0.9.0 thru 1.2       n/a                1991-1995        CWI              yes\n\n\n1.3 thru 1.5.2       1.2                1995-1999        CNRI             yes\n\n\n1.6                  1.5.2              2000             CNRI             no\n\n\n2.0                  1.6                2000             BeOpen.com       no\n\n\n1.6.1                1.6                2001             CNRI             no\n\n\n2.1                  2.0+1.6.1          2001             PSF              no\n\n\n2.0.1                2.0+1.6.1          2001             PSF              yes\n\n\n2.1.1                2.1+2.0.1          2001             PSF              yes\n\n\n2.1.2                2.1.1              2002             PSF              yes\n\n\n2.1.3                2.1.2              2002             PSF              yes\n\n\n2.2 and above        2.1.1              2001-now         PSF              yes\n\n\nNote: GPL-compatible doesn't mean that we're distributing Python\nunder the GPL. All Python licenses, unlike the GPL, let you\ndistribute a modified version without making your changes open\nsource.  The GPL-compatible licenses make it possible to combine\nPython with other software that is released under the GPL; the\nothers don't.\n",
            "subsections": []
        },
        "Thanks to the many outside volunteers who have worked under Guido's": {
            "content": "direction to make these releases possible.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "",
            "subsections": [
                {
                    "name": "15.2 Terms and conditions for accessing or otherwise using Python",
                    "content": "Python software and documentation are licensed under the *note PSF\nLicense Agreement: 4ef5.\n"
                }
            ]
        },
        "Starting with Python 3.8.6, examples, recipes, and other code in the": {
            "content": "documentation are dual licensed under the PSF License Agreement and the\n*note Zero-Clause BSD license: 4ef6.\n",
            "subsections": []
        },
        "Some software incorporated into Python is under different licenses.  The": {
            "content": "licenses are listed with code falling under that license.  See *note",
            "subsections": []
        },
        "Licenses and Acknowledgements for Incorporated Software: 4ef7. for an": {
            "content": "incomplete list of these licenses.\n\n* Menu:\n\n* PSF LICENSE AGREEMENT FOR PYTHON 3.12.3: PSF LICENSE AGREEMENT FOR PYTHON 3 12 3.\n* BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0: BEOPEN COM LICENSE AGREEMENT FOR PYTHON 2 0.\n* CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1: CNRI LICENSE AGREEMENT FOR PYTHON 1 6 1.\n* CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2: CWI LICENSE AGREEMENT FOR PYTHON 0 9 0 THROUGH 1 2.\n* ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON 3.12.3 DOCUMENTATION: ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON 3 12 3 DOCUMENTATION.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: PSF LICENSE AGREEMENT FOR PYTHON 3 12 3,  Next: BEOPEN COM LICENSE AGREEMENT FOR PYTHON 2 0,  Up: Terms and conditions for accessing or otherwise using Python": {
            "content": "1. This LICENSE AGREEMENT is between the Python Software Foundation (\"PSF\"), and\nthe Individual or Organization (\"Licensee\") accessing and otherwise using Python\n3.12.3 software in source or binary form and its associated documentation.\n\n2. Subject to the terms and conditions of this License Agreement, PSF hereby\ngrants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,\nanalyze, test, perform and/or display publicly, prepare derivative works,\ndistribute, and otherwise use Python 3.12.3 alone or in any derivative\nversion, provided, however, that PSF's License Agreement and PSF's notice of\ncopyright, i.e., \"Copyright (C) 2001-2023 Python Software Foundation; All Rights\nReserved\" are retained in Python 3.12.3 alone or in any derivative version\nprepared by Licensee.\n\n3. In the event Licensee prepares a derivative work that is based on or\nincorporates Python 3.12.3 or any part thereof, and wants to make the\nderivative work available to others as provided herein, then Licensee hereby\nagrees to include in any such work a brief summary of the changes made to Python\n3.12.3.\n\n4. PSF is making Python 3.12.3 available to Licensee on an \"AS IS\" basis.\nPSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.  BY WAY OF\nEXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY REPRESENTATION OR\nWARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE\nUSE OF PYTHON 3.12.3 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.\n\n5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON 3.12.3\nFOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF\nMODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 3.12.3, OR ANY DERIVATIVE\nTHEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.\n\n6. This License Agreement will automatically terminate upon a material breach of\nits terms and conditions.\n\n7. Nothing in this License Agreement shall be deemed to create any relationship\nof agency, partnership, or joint venture between PSF and Licensee.  This License\nAgreement does not grant permission to use PSF trademarks or trade name in a\ntrademark sense to endorse or promote products or services of Licensee, or any\nthird party.\n\n8. By copying, installing or otherwise using Python 3.12.3, Licensee agrees\nto be bound by the terms and conditions of this License Agreement.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: BEOPEN COM LICENSE AGREEMENT FOR PYTHON 2 0,  Next: CNRI LICENSE AGREEMENT FOR PYTHON 1 6 1,  Prev: PSF LICENSE AGREEMENT FOR PYTHON 3 12 3,  Up: Terms and conditions for accessing or otherwise using Python": {
            "content": "BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1\n\n1. This LICENSE AGREEMENT is between BeOpen.com (\"BeOpen\"), having an office at\n160 Saratoga Avenue, Santa Clara, CA 95051, and the Individual or Organization\n(\"Licensee\") accessing and otherwise using this software in source or binary\nform and its associated documentation (\"the Software\").\n\n2. Subject to the terms and conditions of this BeOpen Python License Agreement,\nBeOpen hereby grants Licensee a non-exclusive, royalty-free, world-wide license\nto reproduce, analyze, test, perform and/or display publicly, prepare derivative\nworks, distribute, and otherwise use the Software alone or in any derivative\nversion, provided, however, that the BeOpen Python License is retained in the\nSoftware, alone or in any derivative version prepared by Licensee.\n\n3. BeOpen is making the Software available to Licensee on an \"AS IS\" basis.\nBEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.  BY WAY OF\nEXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND DISCLAIMS ANY REPRESENTATION OR\nWARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE\nUSE OF THE SOFTWARE WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.\n\n4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE SOFTWARE FOR\nANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF USING,\nMODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY DERIVATIVE THEREOF, EVEN IF\nADVISED OF THE POSSIBILITY THEREOF.\n\n5. This License Agreement will automatically terminate upon a material breach of\nits terms and conditions.\n\n6. This License Agreement shall be governed by and interpreted in all respects\nby the law of the State of California, excluding conflict of law provisions.\nNothing in this License Agreement shall be deemed to create any relationship of\nagency, partnership, or joint venture between BeOpen and Licensee.  This License\nAgreement does not grant permission to use BeOpen trademarks or trade names in a\ntrademark sense to endorse or promote products or services of Licensee, or any\nthird party.  As an exception, the \"BeOpen Python\" logos available at\n'http://www.pythonlabs.com/logos.html' may be used according to the permissions\ngranted on that web page.\n\n7. By copying, installing or otherwise using the software, Licensee agrees to be\nbound by the terms and conditions of this License Agreement.\n",
            "subsections": []
        },
        "File: python3.12.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": {
            "content": "1. This LICENSE AGREEMENT is between the Corporation for National Research\nInitiatives, having an office at 1895 Preston White Drive, Reston, VA 20191\n(\"CNRI\"), and the Individual or Organization (\"Licensee\") accessing and\notherwise using Python 1.6.1 software in source or binary form and its\nassociated documentation.\n\n2. Subject to the terms and conditions of this License Agreement, CNRI hereby\ngrants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,\nanalyze, test, perform and/or display publicly, prepare derivative works,\ndistribute, and otherwise use Python 1.6.1 alone or in any derivative version,\nprovided, however, that CNRI's License Agreement and CNRI's notice of copyright,\ni.e., \"Copyright (C) 1995-2001 Corporation for National Research Initiatives; All\nRights Reserved\" are retained in Python 1.6.1 alone or in any derivative version\nprepared by Licensee.  Alternately, in lieu of CNRI's License Agreement,\nLicensee may substitute the following text (omitting the quotes): \"Python 1.6.1\nis made available subject to the terms and conditions in CNRI's License\nAgreement.  This Agreement together with Python 1.6.1 may be located on the\ninternet using the following unique, persistent identifier (known as a handle):\n1895.22/1013.  This Agreement may also be obtained from a proxy server on the\ninternet using the following URL: 'http://hdl.handle.net/1895.22/1013'.\"\n\n3. In the event Licensee prepares a derivative work that is based on or\nincorporates Python 1.6.1 or any part thereof, and wants to make the derivative\nwork available to others as provided herein, then Licensee hereby agrees to\ninclude in any such work a brief summary of the changes made to Python 1.6.1.\n\n4. CNRI is making Python 1.6.1 available to Licensee on an \"AS IS\" basis.  CNRI\nMAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.  BY WAY OF EXAMPLE,\nBUT NOT LIMITATION, CNRI MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY\nOF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF\nPYTHON 1.6.1 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.\n\n5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON 1.6.1 FOR\nANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF\nMODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1, OR ANY DERIVATIVE\nTHEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.\n\n6. This License Agreement will automatically terminate upon a material breach of\nits terms and conditions.\n\n7. This License Agreement shall be governed by the federal intellectual property\nlaw of the United States, including without limitation the federal copyright\nlaw, and, to the extent such U.S. federal law does not apply, by the law of the\nCommonwealth of Virginia, excluding Virginia's conflict of law provisions.\nNotwithstanding the foregoing, with regard to derivative works based on Python\n1.6.1 that incorporate non-separable material that was previously distributed\nunder the GNU General Public License (GPL), the law of the Commonwealth of\nVirginia shall govern this License Agreement only as to issues arising under or\nwith respect to Paragraphs 4, 5, and 7 of this License Agreement.  Nothing in\nthis License Agreement shall be deemed to create any relationship of agency,\npartnership, or joint venture between CNRI and Licensee.  This License Agreement\ndoes not grant permission to use CNRI trademarks or trade name in a trademark\nsense to endorse or promote products or services of Licensee, or any third\nparty.\n\n8. By clicking on the \"ACCEPT\" button where indicated, or by copying, installing\nor otherwise using Python 1.6.1, Licensee agrees to be bound by the terms and\nconditions of this License Agreement.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: CWI LICENSE AGREEMENT FOR PYTHON 0 9 0 THROUGH 1 2,  Next: ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON 3 12 3 DOCUMENTATION,  Prev: CNRI LICENSE AGREEMENT FOR PYTHON 1 6 1,  Up: Terms and conditions for accessing or otherwise using Python": {
            "content": "Copyright (C) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam, The\nNetherlands.  All rights reserved.\n\nPermission to use, copy, modify, and distribute this software and its\ndocumentation for any purpose and without fee is hereby granted, provided that\nthe above copyright notice appear in all copies and that both that copyright\nnotice and this permission notice appear in supporting documentation, and that\nthe name of Stichting Mathematisch Centrum or CWI not be used in advertising or\npublicity pertaining to distribution of the software without specific, written\nprior permission.\n\nSTICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS\nSOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO\nEVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE FOR ANY SPECIAL, INDIRECT\nOR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,\nDATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS\nACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS\nSOFTWARE.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON 3 12 3 DOCUMENTATION,  Prev: CWI LICENSE AGREEMENT FOR PYTHON 0 9 0 THROUGH 1 2,  Up: Terms and conditions for accessing or otherwise using Python": {
            "content": "Permission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Licenses and Acknowledgements for Incorporated Software,  Prev: Terms and conditions for accessing or otherwise using Python,  Up: History and License": {
            "content": "",
            "subsections": [
                {
                    "name": "15.3 Licenses and Acknowledgements for Incorporated Software",
                    "content": ""
                }
            ]
        },
        "This section is an incomplete, but growing list of licenses and": {
            "content": "acknowledgements for third-party software incorporated in the Python\ndistribution.\n\n* Menu:\n\n* Mersenne Twister::\n* Sockets: Sockets<2>.\n* Asynchronous socket services::\n* Cookie management::\n* Execution tracing::\n* UUencode and UUdecode functions::\n* XML Remote Procedure Calls::\n* testepoll::\n* Select kqueue::\n* SipHash24::\n* strtod and dtoa::\n* OpenSSL: OpenSSL<2>.\n* expat::\n* libffi::\n* zlib: zlib<3>.\n* cfuhash::\n* libmpdec::\n* W3C C14N test suite::\n* Audioop::\n* asyncio: asyncio<11>.\n\nFile: python3.12.info,  Node: Mersenne Twister,  Next: Sockets<2>,  Up: Licenses and Acknowledgements for Incorporated Software\n\n\nThe 'random' C extension underlying the *note random: b3. module\nincludes code based on a download from\n'http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/emt19937ar.html'.\nThe following are the verbatim comments from the original code:\n\nA C-program for MT19937, with initialization improved 2002/1/26.\nCoded by Takuji Nishimura and Makoto Matsumoto.\n\nBefore using, initialize the state by using initgenrand(seed)\nor initbyarray(initkey, keylength).\n\nCopyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions\nare met:\n\n1. Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright\nnotice, this list of conditions and the following disclaimer in the\ndocumentation and/or other materials provided with the distribution.\n\n3. The names of its contributors may not be used to endorse or promote\nproducts derived from this software without specific prior written\npermission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR\nCONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\nEXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\nPROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\nLIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\nNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\nAny feedback is very welcome.\nhttp://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html\nemail: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)\n\nFile: python3.12.info,  Node: Sockets<2>,  Next: Asynchronous socket services,  Prev: Mersenne Twister,  Up: Licenses and Acknowledgements for Incorporated Software\n\n\nThe *note socket: c6. module uses the functions, 'getaddrinfo()', and\n'getnameinfo()', which are coded in separate source files from the WIDE\nProject, 'https://www.wide.ad.jp/'.\n\nCopyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions\nare met:\n1. Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n2. Redistributions in binary form must reproduce the above copyright\nnotice, this list of conditions and the following disclaimer in the\ndocumentation and/or other materials provided with the distribution.\n3. Neither the name of the project nor the names of its contributors\nmay be used to endorse or promote products derived from this software\nwithout specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\nARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\nOR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\nHOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\nLIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\nOUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGE.\n\nFile: python3.12.info,  Node: Asynchronous socket services,  Next: Cookie management,  Prev: Sockets<2>,  Up: Licenses and Acknowledgements for Incorporated Software\n\n",
            "subsections": []
        },
        "The 'test.support.asynchat' and 'test.support.asyncore' modules contain": {
            "content": "the following notice:\n\nCopyright 1996 by Sam Rushing\n\nAll Rights Reserved\n\nPermission to use, copy, modify, and distribute this software and\nits documentation for any purpose and without fee is hereby\ngranted, provided that the above copyright notice appear in all\ncopies and that both that copyright notice and this permission\nnotice appear in supporting documentation, and that the name of Sam\nRushing not be used in advertising or publicity pertaining to\ndistribution of the software without specific, written prior\npermission.\n\nSAM RUSHING DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,\nINCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN\nNO EVENT SHALL SAM RUSHING BE LIABLE FOR ANY SPECIAL, INDIRECT OR\nCONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS\nOF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,\nNEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN\nCONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Cookie management,  Next: Execution tracing,  Prev: Asynchronous socket services,  Up: Licenses and Acknowledgements for Incorporated Software": {
            "content": "The *note http.cookies: 6c. module contains the following notice:\n\nCopyright 2000 by Timothy O'Malley <timo@alum.mit.edu>\n\nAll Rights Reserved\n\nPermission to use, copy, modify, and distribute this software\nand its documentation for any purpose and without fee is hereby\ngranted, provided that the above copyright notice appear in all\ncopies and that both that copyright notice and this permission\nnotice appear in supporting documentation, and that the name of\nTimothy O'Malley  not be used in advertising or publicity\npertaining to distribution of the software without specific, written\nprior permission.\n\nTimothy O'Malley DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS\nSOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS, IN NO EVENT SHALL Timothy O'Malley BE LIABLE FOR\nANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\nWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\nWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS\nACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Execution tracing,  Next: UUencode and UUdecode functions,  Prev: Cookie management,  Up: Licenses and Acknowledgements for Incorporated Software": {
            "content": "The *note trace: f8. module contains the following notice:\n\nportions copyright 2001, Autonomous Zones Industries, Inc., all rights...\nerr...  reserved and offered to the public under the terms of the\nPython 2.2 license.\nAuthor: Zooko O'Whielacronx\nhttp://zooko.com/\nmailto:zooko@zooko.com\n\nCopyright 2000, Mojam Media, Inc., all rights reserved.\nAuthor: Skip Montanaro\n\nCopyright 1999, Bioreason, Inc., all rights reserved.\nAuthor: Andrew Dalke\n\nCopyright 1995-1997, Automatrix, Inc., all rights reserved.\nAuthor: Skip Montanaro\n\nCopyright 1991-1995, Stichting Mathematisch Centrum, all rights reserved.\n\n\nPermission to use, copy, modify, and distribute this Python software and\nits associated documentation for any purpose without fee is hereby\ngranted, provided that the above copyright notice appears in all copies,\nand that both that copyright notice and this permission notice appear in\nsupporting documentation, and that the name of neither Automatrix,\nBioreason or Mojam Media be used in advertising or publicity pertaining to\ndistribution of the software without specific, written prior permission.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: UUencode and UUdecode functions,  Next: XML Remote Procedure Calls,  Prev: Execution tracing,  Up: Licenses and Acknowledgements for Incorporated Software": {
            "content": "The *note uu: 10a. module contains the following notice:\n\nCopyright 1994 by Lance Ellinghouse\nCathedral City, California Republic, United States of America.\nAll Rights Reserved\nPermission to use, copy, modify, and distribute this software and its\ndocumentation for any purpose and without fee is hereby granted,\nprovided that the above copyright notice appear in all copies and that\nboth that copyright notice and this permission notice appear in\nsupporting documentation, and that the name of Lance Ellinghouse\nnot be used in advertising or publicity pertaining to distribution\nof the software without specific, written prior permission.\nLANCE ELLINGHOUSE DISCLAIMS ALL WARRANTIES WITH REGARD TO\nTHIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND\nFITNESS, IN NO EVENT SHALL LANCE ELLINGHOUSE CENTRUM BE LIABLE\nFOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\nWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\nACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT\nOF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n\nModified by Jack Jansen, CWI, July 1995:\n- Use binascii module to do the actual line-by-line conversion\nbetween ascii and binary. This results in a 1000-fold speedup. The C\nversion is still 5 times faster, though.\n- Arguments more compliant with Python standard\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: XML Remote Procedure Calls,  Next: testepoll,  Prev: UUencode and UUdecode functions,  Up: Licenses and Acknowledgements for Incorporated Software": {
            "content": "The *note xmlrpc.client: 128. module contains the following notice:\n\nThe XML-RPC client interface is\n\nCopyright (c) 1999-2002 by Secret Labs AB\nCopyright (c) 1999-2002 by Fredrik Lundh\n\nBy obtaining, using, and/or copying this software and/or its\nassociated documentation, you agree that you have read, understood,\nand will comply with the following terms and conditions:\n\nPermission to use, copy, modify, and distribute this software and\nits associated documentation for any purpose and without fee is\nhereby granted, provided that the above copyright notice appears in\nall copies, and that both that copyright notice and this permission\nnotice appear in supporting documentation, and that the name of\nSecret Labs AB or the author not be used in advertising or publicity\npertaining to distribution of the software without specific, written\nprior permission.\n\nSECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD\nTO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT-\nABILITY AND FITNESS.  IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR\nBE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY\nDAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\nWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS\nACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE\nOF THIS SOFTWARE.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: testepoll,  Next: Select kqueue,  Prev: XML Remote Procedure Calls,  Up: Licenses and Acknowledgements for Incorporated Software": {
            "content": "The 'test.testepoll' module contains the following notice:\n\nCopyright (c) 2001-2006 Twisted Matrix Laboratories.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Select kqueue,  Next: SipHash24,  Prev: testepoll,  Up: Licenses and Acknowledgements for Incorporated Software": {
            "content": "The *note select: bc. module contains the following notice for the\nkqueue interface:\n\nCopyright (c) 2000 Doug White, 2006 James Knight, 2007 Christian Heimes\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions\nare met:\n1. Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n2. Redistributions in binary form must reproduce the above copyright\nnotice, this list of conditions and the following disclaimer in the\ndocumentation and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\nARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\nOR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\nHOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\nLIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\nOUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGE.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: SipHash24,  Next: strtod and dtoa,  Prev: Select kqueue,  Up: Licenses and Acknowledgements for Incorporated Software": {
            "content": "",
            "subsections": []
        },
        "The file 'Python/pyhash.c' contains Marek Majkowski' implementation of": {
            "content": "Dan Bernstein's SipHash24 algorithm.  It contains the following note:\n\n<MIT License>\nCopyright (c) 2013  Marek Majkowski <marek@popcount.org>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n</MIT License>\n\nOriginal location:\nhttps://github.com/majek/csiphash/\n\nSolution inspired by code from:\nSamuel Neves (supercop/cryptoauth/siphash24/little)\ndjb (supercop/cryptoauth/siphash24/little2)\nJean-Philippe Aumasson (https://131002.net/siphash/siphash24.c)\n\nFile: python3.12.info,  Node: strtod and dtoa,  Next: OpenSSL<2>,  Prev: SipHash24,  Up: Licenses and Acknowledgements for Incorporated Software\n\n",
            "subsections": []
        },
        "The file 'Python/dtoa.c', which supplies C functions dtoa and strtod for": {
            "content": "conversion of C doubles to and from strings, is derived from the file of\nthe same name by David M. Gay, currently available from\n'https://web.archive.org/web/20220517033456/http://www.netlib.org/fp/dtoa.c'.",
            "subsections": []
        },
        "The original file, as retrieved on March 16, 2009, contains the": {
            "content": "following copyright and licensing notice:\n\n/\n*\n* The author of this software is David M. Gay.\n*\n* Copyright (c) 1991, 2000, 2001 by Lucent Technologies.\n*\n* Permission to use, copy, modify, and distribute this software for any\n* purpose without fee is hereby granted, provided that this entire notice\n* is included in all copies of any software which is or includes a copy\n* or modification of this software and in all copies of the supporting\n* documentation for such software.\n*\n* THIS SOFTWARE IS BEING PROVIDED \"AS IS\", WITHOUT ANY EXPRESS OR IMPLIED\n* WARRANTY.  IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY\n* REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY\n* OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.\n*\n*/\n\nFile: python3.12.info,  Node: OpenSSL<2>,  Next: expat,  Prev: strtod and dtoa,  Up: Licenses and Acknowledgements for Incorporated Software\n\n\nThe modules *note hashlib: 63, *note posix: a8, *note ssl: ca, *note\ncrypt: 26. use the OpenSSL library for added performance if made\navailable by the operating system.  Additionally, the Windows and macOS\ninstallers for Python may include a copy of the OpenSSL libraries, so we\ninclude a copy of the OpenSSL license here.  For the OpenSSL 3.0\nrelease, and later releases derived from that, the Apache License v2\napplies:\n\nApache License\nVersion 2.0, January 2004\nhttps://www.apache.org/licenses/\n\nTERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n1. Definitions.\n\n\"License\" shall mean the terms and conditions for use, reproduction,\nand distribution as defined by Sections 1 through 9 of this document.\n\n\"Licensor\" shall mean the copyright owner or entity authorized by\nthe copyright owner that is granting the License.\n\n\"Legal Entity\" shall mean the union of the acting entity and all\nother entities that control, are controlled by, or are under common\ncontrol with that entity. For the purposes of this definition,\n\"control\" means (i) the power, direct or indirect, to cause the\ndirection or management of such entity, whether by contract or\notherwise, or (ii) ownership of fifty percent (50%) or more of the\noutstanding shares, or (iii) beneficial ownership of such entity.\n\n\"You\" (or \"Your\") shall mean an individual or Legal Entity\nexercising permissions granted by this License.\n\n\"Source\" form shall mean the preferred form for making modifications,\nincluding but not limited to software source code, documentation\nsource, and configuration files.\n\n\"Object\" form shall mean any form resulting from mechanical\ntransformation or translation of a Source form, including but\nnot limited to compiled object code, generated documentation,\nand conversions to other media types.\n\n\"Work\" shall mean the work of authorship, whether in Source or\nObject form, made available under the License, as indicated by a\ncopyright notice that is included in or attached to the work\n(an example is provided in the Appendix below).\n\n\"Derivative Works\" shall mean any work, whether in Source or Object\nform, that is based on (or derived from) the Work and for which the\neditorial revisions, annotations, elaborations, or other modifications\nrepresent, as a whole, an original work of authorship. For the purposes\nof this License, Derivative Works shall not include works that remain\nseparable from, or merely link (or bind by name) to the interfaces of,\nthe Work and Derivative Works thereof.\n\n\"Contribution\" shall mean any work of authorship, including\nthe original version of the Work and any modifications or additions\nto that Work or Derivative Works thereof, that is intentionally\nsubmitted to Licensor for inclusion in the Work by the copyright owner\nor by an individual or Legal Entity authorized to submit on behalf of\nthe copyright owner. For the purposes of this definition, \"submitted\"\nmeans any form of electronic, verbal, or written communication sent\nto the Licensor or its representatives, including but not limited to\ncommunication on electronic mailing lists, source code control systems,\nand issue tracking systems that are managed by, or on behalf of, the\nLicensor for the purpose of discussing and improving the Work, but\nexcluding communication that is conspicuously marked or otherwise\ndesignated in writing by the copyright owner as \"Not a Contribution.\"\n\n\"Contributor\" shall mean Licensor and any individual or Legal Entity\non behalf of whom a Contribution has been received by Licensor and\nsubsequently incorporated within the Work.\n\n2. Grant of Copyright License. Subject to the terms and conditions of\nthis License, each Contributor hereby grants to You a perpetual,\nworldwide, non-exclusive, no-charge, royalty-free, irrevocable\ncopyright license to reproduce, prepare Derivative Works of,\npublicly display, publicly perform, sublicense, and distribute the\nWork and such Derivative Works in Source or Object form.\n\n3. Grant of Patent License. Subject to the terms and conditions of\nthis License, each Contributor hereby grants to You a perpetual,\nworldwide, non-exclusive, no-charge, royalty-free, irrevocable\n(except as stated in this section) patent license to make, have made,\nuse, offer to sell, sell, import, and otherwise transfer the Work,\nwhere such license applies only to those patent claims licensable\nby such Contributor that are necessarily infringed by their\nContribution(s) alone or by combination of their Contribution(s)\nwith the Work to which such Contribution(s) was submitted. If You\ninstitute patent litigation against any entity (including a\ncross-claim or counterclaim in a lawsuit) alleging that the Work\nor a Contribution incorporated within the Work constitutes direct\nor contributory patent infringement, then any patent licenses\ngranted to You under this License for that Work shall terminate\nas of the date such litigation is filed.\n\n4. Redistribution. You may reproduce and distribute copies of the\nWork or Derivative Works thereof in any medium, with or without\nmodifications, and in Source or Object form, provided that You\nmeet the following conditions:\n\n(a) You must give any other recipients of the Work or\nDerivative Works a copy of this License; and\n\n(b) You must cause any modified files to carry prominent notices\nstating that You changed the files; and\n\n(c) You must retain, in the Source form of any Derivative Works\nthat You distribute, all copyright, patent, trademark, and\nattribution notices from the Source form of the Work,\nexcluding those notices that do not pertain to any part of\nthe Derivative Works; and\n\n(d) If the Work includes a \"NOTICE\" text file as part of its\ndistribution, then any Derivative Works that You distribute must\ninclude a readable copy of the attribution notices contained\nwithin such NOTICE file, excluding those notices that do not\npertain to any part of the Derivative Works, in at least one\nof the following places: within a NOTICE text file distributed\nas part of the Derivative Works; within the Source form or\ndocumentation, if provided along with the Derivative Works; or,\nwithin a display generated by the Derivative Works, if and\nwherever such third-party notices normally appear. The contents\nof the NOTICE file are for informational purposes only and\ndo not modify the License. You may add Your own attribution\nnotices within Derivative Works that You distribute, alongside\nor as an addendum to the NOTICE text from the Work, provided\nthat such additional attribution notices cannot be construed\nas modifying the License.\n\nYou may add Your own copyright statement to Your modifications and\nmay provide additional or different license terms and conditions\nfor use, reproduction, or distribution of Your modifications, or\nfor any such Derivative Works as a whole, provided Your use,\nreproduction, and distribution of the Work otherwise complies with\nthe conditions stated in this License.\n\n5. Submission of Contributions. Unless You explicitly state otherwise,\nany Contribution intentionally submitted for inclusion in the Work\nby You to the Licensor shall be under the terms and conditions of\nthis License, without any additional terms or conditions.\nNotwithstanding the above, nothing herein shall supersede or modify\nthe terms of any separate license agreement you may have executed\nwith Licensor regarding such Contributions.\n\n6. Trademarks. This License does not grant permission to use the trade\nnames, trademarks, service marks, or product names of the Licensor,\nexcept as required for reasonable and customary use in describing the\norigin of the Work and reproducing the content of the NOTICE file.\n\n7. Disclaimer of Warranty. Unless required by applicable law or\nagreed to in writing, Licensor provides the Work (and each\nContributor provides its Contributions) on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied, including, without limitation, any warranties or conditions\nof TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\nPARTICULAR PURPOSE. You are solely responsible for determining the\nappropriateness of using or redistributing the Work and assume any\nrisks associated with Your exercise of permissions under this License.\n\n8. Limitation of Liability. In no event and under no legal theory,\nwhether in tort (including negligence), contract, or otherwise,\nunless required by applicable law (such as deliberate and grossly\nnegligent acts) or agreed to in writing, shall any Contributor be\nliable to You for damages, including any direct, indirect, special,\nincidental, or consequential damages of any character arising as a\nresult of this License or out of the use or inability to use the\nWork (including but not limited to damages for loss of goodwill,\nwork stoppage, computer failure or malfunction, or any and all\nother commercial damages or losses), even if such Contributor\nhas been advised of the possibility of such damages.\n\n9. Accepting Warranty or Additional Liability. While redistributing\nthe Work or Derivative Works thereof, You may choose to offer,\nand charge a fee for, acceptance of support, warranty, indemnity,\nor other liability obligations and/or rights consistent with this\nLicense. However, in accepting such obligations, You may act only\non Your own behalf and on Your sole responsibility, not on behalf\nof any other Contributor, and only if You agree to indemnify,\ndefend, and hold each Contributor harmless for any liability\nincurred by, or claims asserted against, such Contributor by reason\nof your accepting any such warranty or additional liability.\n\nEND OF TERMS AND CONDITIONS\n\nFile: python3.12.info,  Node: expat,  Next: libffi,  Prev: OpenSSL<2>,  Up: Licenses and Acknowledgements for Incorporated Software\n\n\nThe *note pyexpat: 121. extension is built using an included copy of the\nexpat sources unless the build is configured '--with-system-expat':\n\nCopyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd\nand Clark Cooper\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nFile: python3.12.info,  Node: libffi,  Next: zlib<3>,  Prev: expat,  Up: Licenses and Acknowledgements for Incorporated Software\n\n\nThe 'ctypes' C extension underlying the *note ctypes: 28. module is\nbuilt using an included copy of the libffi sources unless the build is\nconfigured '--with-system-libffi':\n\nCopyright (c) 1996-2008  Red Hat, Inc and others.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n``Software''), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\nDEALINGS IN THE SOFTWARE.\n\nFile: python3.12.info,  Node: zlib<3>,  Next: cfuhash,  Prev: libffi,  Up: Licenses and Acknowledgements for Incorporated Software\n\n\nThe *note zlib: 12d. extension is built using an included copy of the\nzlib sources if the zlib version found on the system is too old to be\nused for the build:\n\nCopyright (C) 1995-2011 Jean-loup Gailly and Mark Adler\n\nThis software is provided 'as-is', without any express or implied\nwarranty.  In no event will the authors be held liable for any damages\narising from the use of this software.\n\nPermission is granted to anyone to use this software for any purpose,\nincluding commercial applications, and to alter it and redistribute it\nfreely, subject to the following restrictions:\n\n1. The origin of this software must not be misrepresented; you must not\nclaim that you wrote the original software. If you use this software\nin a product, an acknowledgment in the product documentation would be\nappreciated but is not required.\n\n2. Altered source versions must be plainly marked as such, and must not be\nmisrepresented as being the original software.\n\n3. This notice may not be removed or altered from any source distribution.\n\nJean-loup Gailly        Mark Adler\njloup@gzip.org          madler@alumni.caltech.edu\n\nFile: python3.12.info,  Node: cfuhash,  Next: libmpdec,  Prev: zlib<3>,  Up: Licenses and Acknowledgements for Incorporated Software\n\n\nThe implementation of the hash table used by the *note tracemalloc: fa.\nis based on the cfuhash project:\n\nCopyright (c) 2005 Don Owens\nAll rights reserved.\n\nThis code is released under the BSD license:\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions\nare met:\n\n* Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above\ncopyright notice, this list of conditions and the following\ndisclaimer in the documentation and/or other materials provided\nwith the distribution.\n\n* Neither the name of the author nor the names of its\ncontributors may be used to endorse or promote products derived\nfrom this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\nFOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\nCOPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\nINCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\nHOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\nSTRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\nARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\nOF THE POSSIBILITY OF SUCH DAMAGE.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: libmpdec,  Next: W3C C14N test suite,  Prev: cfuhash,  Up: Licenses and Acknowledgements for Incorporated Software": {
            "content": "The 'decimal' C extension underlying the *note decimal: 33. module is\nbuilt using an included copy of the libmpdec library unless the build is\nconfigured '--with-system-libmpdec':\n\nCopyright (c) 2008-2020 Stefan Krah. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions\nare met:\n\n1. Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright\nnotice, this list of conditions and the following disclaimer in the\ndocumentation and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\nARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\nOR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\nHOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\nLIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\nOUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGE.\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: W3C C14N test suite,  Next: Audioop,  Prev: libmpdec,  Up: Licenses and Acknowledgements for Incorporated Software": {
            "content": "The C14N 2.0 test suite in the *note test: dc. package\n('Lib/test/xmltestdata/c14n-20/') was retrieved from the W3C website at\n'https://www.w3.org/TR/xml-c14n2-testcases/' and is distributed under\nthe 3-clause BSD license:\n\nCopyright (c) 2013 W3C(R) (MIT, ERCIM, Keio, Beihang),\nAll Rights Reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions\nare met:\n\n* Redistributions of works must retain the original copyright notice,\nthis list of conditions and the following disclaimer.\n* Redistributions in binary form must reproduce the original copyright\nnotice, this list of conditions and the following disclaimer in the\ndocumentation and/or other materials provided with the distribution.\n* Neither the name of the W3C nor the names of its contributors may be\nused to endorse or promote products derived from this work without\nspecific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\nFile: python3.12.info,  Node: Audioop,  Next: asyncio<11>,  Prev: W3C C14N test suite,  Up: Licenses and Acknowledgements for Incorporated Software\n\n\nThe audioop module uses the code base in g771.c file of the SoX project.\n'https://sourceforge.net/projects/sox/files/sox/12.17.7/sox-12.17.7.tar.gz'\n\nThis source code is a product of Sun Microsystems, Inc.  and is\nprovided for unrestricted use.  Users may copy or modify this\nsource code without charge.\n\nSUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND\nINCLUDING THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR\nA PARTICULAR PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR\nTRADE PRACTICE.\n\nSun source code is provided with no support and without any\nobligation on the part of Sun Microsystems, Inc.  to assist in its\nuse, correction, modification or enhancement.\n\nSUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\nINFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS\nSOFTWARE OR ANY PART THEREOF.\n\nIn no event will Sun Microsystems, Inc.  be liable for any lost\nrevenue or profits or other special, indirect and consequential\ndamages, even if Sun has been advised of the possibility of such\ndamages.\n\nSun Microsystems, Inc.  2550 Garcia Avenue Mountain View,\nCalifornia 94043\n\nFile: python3.12.info,  Node: asyncio<11>,  Prev: Audioop,  Up: Licenses and Acknowledgements for Incorporated Software\n\n\nParts of the *note asyncio: 9. module are incorporated from uvloop\n0.16(1), which is distributed under the MIT license:\n\nCopyright (c) 2015-2021 MagicStack Inc.  http://magic.io\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n---------- Footnotes ----------\n\n(1) https://github.com/MagicStack/uvloop/tree/v0.16.0\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Python Module Index,  Next: Index,  Prev: History and License,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "Python Module Index": {
            "content": "* Menu:\n\n* future: 0. Future statement definitions\n* main: 1. The environment where top-level code is run. Covers\ncommand-line interfaces, import-time\nbehavior, and ''name ==\n'main'''.\n* thread: 2. Low-level threading API.\n* tkinter: 3. A binary module that contains the low-level interface\nto Tcl/Tk.\n* abc: 4. Abstract base classes according to :pep:'3119'.\n* aifc: 5. Read and write audio files in AIFF or AIFC format.\n* argparse: 6. Command-line option and argument parsing library.\n* array: 7. Space efficient arrays of uniformly typed numeric\nvalues.\n* ast: 8. Abstract Syntax Tree classes and manipulation.\n* asyncio: 9. Asynchronous I/O.\n* atexit: a. Register and execute cleanup functions.\n* audioop: b. Manipulate raw audio data.\n* base64: c. RFC 4648: Base16, Base32, Base64 Data\nEncodings; Base85 and Ascii85\n* bdb: d. Debugger framework.\n* binascii: e. Tools for converting between binary and various ASCII-\nencoded binary representations.\n* bisect: f. Array bisection algorithms for binary searching.\n* builtins: 10. The module that provides the built-in namespace.\n* bz2: 11. Interfaces for bzip2 compression and decompression.\n* calendar: 12. Functions for working with calendars, including\nsome emulation of the Unix cal program.\n* cgi: 13. Helpers for running Python scripts via the Common\nGateway Interface.\n* cgitb: 14. Configurable traceback handler for CGI scripts.\n* chunk: 15. Module to read IFF chunks.\n* cmath: 16. Mathematical functions for complex numbers.\n* cmd: 17. Build line-oriented command interpreters.\n* code: 18. Facilities to implement read-eval-print loops.\n* codecs: 19. Encode and decode data and streams.\n* codeop: 1a. Compile (possibly incomplete) Python code.\n* collections: 1b. Container datatypes\n* collections.abc: 1c. Abstract base classes for containers\n* colorsys: 1d. Conversion functions between RGB and other color\nsystems.\n* compileall: 1e. Tools for byte-compiling all Python source files in a\ndirectory tree.\n* concurrent.futures: 1f. Execute computations concurrently using threads or\nprocesses.\n* configparser: 20. Configuration file parser.\n* contextlib: 21. Utilities for with-statement contexts.\n* contextvars: 22. Context Variables\n* copy: 23. Shallow and deep copy operations.\n* copyreg: 24. Register pickle support functions.\n* cProfile: 25.\n* crypt: 26. The crypt() function used to check Unix passwords.\n* csv: 27. Write and read tabular data to and from delimited\nfiles.\n* ctypes: 28. A foreign function library for Python.\n* curses: 29. An interface to the curses library, providing\nportable terminal handling.\n* curses.ascii: 2a. Constants and set-membership functions for ASCII\ncharacters.\n* curses.panel: 2b. A panel stack extension that adds depth to curses\nwindows.\n* curses.textpad: 2c. Emacs-like input editing in a curses window.\n* dataclasses: 2d. Generate special methods on user-defined classes.\n* datetime: 2e. Basic date and time types.\n* dbm: 2f. Interfaces to various Unix \"database\" formats.\n* dbm.dumb: 30. Portable implementation of the simple DBM interface.\n* dbm.gnu: 31. GNU database manager\n* dbm.ndbm: 32. The New Database Manager\n* decimal: 33. Implementation of the General Decimal Arithmetic\nSpecification.\n* difflib: 34. Helpers for computing differences between objects.\n* dis: 35. Disassembler for Python bytecode.\n* doctest: 36. Test pieces of code within docstrings.\n* email: 37. Package supporting the parsing,\nmanipulating, and generating email messages.\n* email.charset: 38. Character Sets\n* email.contentmanager: 39. Storing and Retrieving Content from MIME Parts\n* email.encoders: 3a. Encoders for email message payloads.\n* email.errors: 3b. The exception classes used by the email package.\n* email.generator: 3c. Generate flat text email messages from a message\nstructure.\n* email.header: 3d. Representing non-ASCII headers\n* email.headerregistry: 3e. Automatic Parsing of headers based on the field name\n* email.iterators: 3f. Iterate over a message object tree.\n* email.message: 40. The base class representing email messages.\n* email.mime: 41. Build MIME messages.\n* email.mime.application: 42.\n* email.mime.audio: 43.\n* email.mime.base: 44.\n* email.mime.image: 45.\n* email.mime.message: 46.\n* email.mime.multipart: 47.\n* email.mime.nonmultipart: 48.\n* email.mime.text: 49.\n* email.parser: 4a. Parse flat text email messages to produce a message\nobject structure.\n* email.policy: 4b. Controlling the parsing and generating of messages\n* email.utils: 4c. Miscellaneous email package utilities.\n* encodings.idna: 4d. Internationalized Domain Names implementation\n* encodings.mbcs: 4e. Windows ANSI codepage\n* encodings.utf8sig: 4f. UTF-8 codec with BOM signature\n* ensurepip: 50. Bootstrapping the \"pip\" installer into an existing\nPython installation or virtual environment.\n* enum: 51. Implementation of an enumeration class.\n* errno: 52. Standard errno system symbols.\n* faulthandler: 53. Dump the Python traceback.\n* fcntl: 54. The fcntl() and ioctl() system calls.\n* filecmp: 55. Compare files efficiently.\n* fileinput: 56. Loop over standard input or a list of files.\n* fnmatch: 57. Unix shell style filename pattern matching.\n* fractions: 58. Rational numbers.\n* ftplib: 59. FTP protocol client (requires sockets).\n* functools: 5a. Higher-order functions and operations on callable\nobjects.\n* gc: 5b. Interface to the cycle-detecting garbage collector.\n* getopt: 5c. Portable parser for command line options; support both\nshort and long option names.\n* getpass: 5d. Portable reading of passwords and retrieval of the\nuserid.\n* gettext: 5e. Multilingual internationalization services.\n* glob: 5f. Unix shell style pathname pattern expansion.\n* graphlib: 60. Functionality to operate with graph-like structures\n* grp: 61. The group database (getgrnam() and friends).\n* gzip: 62. Interfaces for gzip compression and decompression\nusing file objects.\n* hashlib: 63. Secure hash and message digest algorithms.\n* heapq: 64. Heap queue algorithm (a.k.a. priority queue).\n* hmac: 65. Keyed-Hashing for Message Authentication (HMAC)\nimplementation\n* html: 66. Helpers for manipulating HTML.\n* html.entities: 67. Definitions of HTML general entities.\n* html.parser: 68. A simple parser that can handle HTML and XHTML.\n* http: 69. HTTP status codes and messages\n* http.client: 6a. HTTP and HTTPS protocol client (requires sockets).\n* http.cookiejar: 6b. Classes for automatic handling of HTTP cookies.\n* http.cookies: 6c. Support for HTTP state management (cookies).\n* http.server: 6d. HTTP server and request handlers.\n* idlelib: 6e. Implementation package for the IDLE shell/editor.\n* imaplib: 6f. IMAP4 protocol client (requires sockets).\n* imghdr: 70. Determine the type of image contained in a file or\nbyte stream.\n* importlib: 71. The implementation of the import machinery.\n* importlib.abc: 72. Abstract base classes related to import\n* importlib.machinery: 73. Importers and path hooks\n* importlib.metadata: 74. Accessing package metadata\n* importlib.resources: 75. Package resource reading, opening, and\naccess\n* importlib.resources.abc: 76. Abstract base classes for resources\n* importlib.util: 77. Utility code for importers\n* inspect: 78. Extract information and source code from live objects.\n* io: 79. Core tools for working with streams.\n* ipaddress: 7a. IPv4/IPv6 manipulation library.\n* itertools: 7b. Functions creating iterators for efficient looping.\n* json: 7c. Encode and decode the JSON format.\n* json.tool: 7d. A command line to validate and pretty-print JSON.\n* keyword: 7e. Test whether a string is a keyword in Python.\n* lib2to3: 7f. The 2to3 library\n* linecache: 80. Provides random access to individual lines from text\nfiles.\n* locale: 81. Internationalization services.\n* logging: 82. Flexible event logging system for applications.\n* logging.config: 83. Configuration of the logging module.\n* logging.handlers: 84. Handlers for the logging module.\n* lzma: 85. A Python wrapper for the liblzma compression library.\n* mailbox: 86. Manipulate mailboxes in various formats\n* mailcap: 87. Mailcap file handling.\n* marshal: 88. Convert Python objects to streams of bytes and back\n(with different constraints).\n* math: 89. Mathematical functions (sin() etc.).\n* mimetypes: 8a. Mapping of filename extensions to MIME types.\n* mmap: 8b. Interface to memory-mapped files for Unix and Windows.\n* modulefinder: 8c. Find modules used by a script.\n* msilib: 8d. Creation of Microsoft Installer files, and CAB\nfiles.\n* msvcrt: 8e. Miscellaneous useful routines from the MS VC++\nruntime.\n* multiprocessing: 8f. Process-based parallelism.\n* multiprocessing.connection: 90. API for dealing with sockets.\n* multiprocessing.dummy: 91. Dumb wrapper around threading.\n* multiprocessing.managers: 92. Share data between process with shared objects.\n* multiprocessing.pool: 93. Create pools of processes.\n* multiprocessing.sharedmemory: 94. Provides shared memory for direct access\nacross processes.\n* multiprocessing.sharedctypes: 95. Allocate ctypes objects from shared memory.\n* netrc: 96. Loading of .netrc files.\n* nis: 97. Interface to Sun's NIS (Yellow Pages) library.\n* nntplib: 98. NNTP protocol client (requires sockets).\n* numbers: 99. Numeric abstract base classes (Complex,\nReal, Integral, etc.).\n* operator: 9a. Functions corresponding to the standard operators.\n* optparse: 9b. Command-line option parsing library.\n* os: 9c. Miscellaneous operating system interfaces.\n* os.path: 9d. Operations on pathnames.\n* ossaudiodev: 9e. Access to OSS-compatible audio devices.\n* pathlib: 9f. Object-oriented filesystem paths\n* pdb: a0. The Python debugger for interactive interpreters.\n* pickle: a1. Convert Python objects to streams of bytes and back.\n* pickletools: a2. Contains extensive comments about the pickle protocols\nand pickle-machine opcodes, as well as some\nuseful functions.\n* pipes: a3. A Python interface to Unix shell pipelines.\n* pkgutil: a4. Utilities for the import system.\n* platform: a5. Retrieves as much platform identifying data as\npossible.\n* plistlib: a6. Generate and parse Apple plist files.\n* poplib: a7. POP3 protocol client (requires sockets).\n* posix: a8. The most common POSIX system calls (normally used via\nmodule os).\n* pprint: a9. Data pretty printer.\n* profile: aa. Python source profiler.\n* pstats: ab. Statistics object for use with the profiler.\n* pty: ac. Pseudo-Terminal Handling for Unix.\n* pwd: ad. The password database (getpwnam() and friends).\n* pycompile: ae. Generate byte-code files from Python source files.\n* pyclbr: af. Supports information extraction for a Python module\nbrowser.\n* pydoc: b0. Documentation generator and online help system.\n* queue: b1. A synchronized queue class.\n* quopri: b2. Encode and decode files using the MIME quoted-\nprintable encoding.\n* random: b3. Generate pseudo-random numbers with various common\ndistributions.\n* re: b4. Regular expression operations.\n* readline: b5. GNU readline support for Python.\n* reprlib: b6. Alternate repr() implementation with size limits.\n* resource: b7. An interface to provide resource usage information on\nthe current process.\n* rlcompleter: b8. Python identifier completion, suitable for the\nGNU readline library.\n* runpy: b9. Locate and run Python modules without importing them\nfirst.\n* sched: ba. General purpose event scheduler.\n* secrets: bb. Generate secure random numbers for managing secrets.\n* select: bc. Wait for I/O completion on multiple streams.\n* selectors: bd. High-level I/O multiplexing.\n* shelve: be. Python object persistence.\n* shlex: bf. Simple lexical analysis for Unix shell-like languages.\n* shutil: c0. High-level file operations, including copying.\n* signal: c1. Set handlers for asynchronous events.\n* site: c2. Module responsible for site-specific configuration.\n* sitecustomize: c3.\n* smtplib: c4. SMTP protocol client (requires sockets).\n* sndhdr: c5. Determine type of a sound file.\n* socket: c6. Low-level networking interface.\n* socketserver: c7. A framework for network servers.\n* spwd: c8. The shadow password database (getspnam() and friends).\n* sqlite3: c9. A DB-API 2.0 implementation using SQLite 3.x.\n* ssl: ca. TLS/SSL wrapper for socket objects\n* stat: cb. Utilities for interpreting the results of\nos.stat(), os.lstat() and os.fstat().\n* statistics: cc. Mathematical statistics functions\n* string: cd. Common string operations.\n* stringprep: ce. String preparation, as per RFC 3453\n* struct: cf. Interpret bytes as packed binary data.\n* subprocess: d0. Subprocess management.\n* sunau: d1. Provide an interface to the Sun AU sound format.\n* symtable: d2. Interface to the compiler's internal symbol tables.\n* sys: d3. Access system-specific parameters and functions.\n* sys.monitoring: d4. Access and control event monitoring\n* sysconfig: d5. Python's configuration information\n* syslog: d6. An interface to the Unix syslog library routines.\n* tabnanny: d7. Tool for detecting white space related problems in\nPython source files in a directory tree.\n* tarfile: d8. Read and write tar-format archive files.\n* telnetlib: d9. Telnet client class.\n* tempfile: da. Generate temporary files and directories.\n* termios: db. POSIX style tty control.\n* test: dc. Regression tests package containing the testing suite\nfor Python.\n* test.regrtest: dd. Drives the regression test suite.\n* test.support: de. Support for Python's regression test suite.\n* test.support.bytecodehelper: df. Support tools for testing correct bytecode\ngeneration.\n* test.support.importhelper: e0. Support for import tests.\n* test.support.oshelper: e1. Support for os tests.\n* test.support.scripthelper: e2. Support for Python's script execution tests.\n* test.support.sockethelper: e3. Support for socket tests.\n* test.support.threadinghelper: e4. Support for threading tests.\n* test.support.warningshelper: e5. Support for warnings tests.\n* textwrap: e6. Text wrapping and filling\n* threading: e7. Thread-based parallelism.\n* time: e8. Time access and conversions.\n* timeit: e9. Measure the execution time of small code snippets.\n* tkinter: ea. Interface to Tcl/Tk for graphical user interfaces\n* tkinter.colorchooser: eb. Color choosing dialog\n* tkinter.commondialog: ec. Tkinter base class for dialogs\n* tkinter.dnd: ed. Tkinter drag-and-drop interface\n* tkinter.filedialog: ee. Dialog classes for file selection\n* tkinter.font: ef. Tkinter font-wrapping class\n* tkinter.messagebox: f0. Various types of alert dialogs\n* tkinter.scrolledtext: f1. Text widget with a vertical scroll bar.\n* tkinter.simpledialog: f2. Simple dialog windows\n* tkinter.tix: f3. Tk Extension Widgets for Tkinter\n* tkinter.ttk: f4. Tk themed widget set\n* token: f5. Constants representing terminal nodes of the parse\ntree.\n* tokenize: f6. Lexical scanner for Python source code.\n* tomllib: f7. Parse TOML files.\n* trace: f8. Trace or track Python statement execution.\n* traceback: f9. Print or retrieve a stack traceback.\n* tracemalloc: fa. Trace memory allocations.\n* tty: fb. Utility functions that perform common terminal control\noperations.\n* turtle: fc. An educational framework for simple graphics\napplications\n* turtledemo: fd. A viewer for example turtle scripts\n* types: fe. Names for built-in types.\n* typing: ff. Support for type hints (see :pep:'484').\n* unicodedata: 100. Access the Unicode Database.\n* unittest: 101. Unit testing framework for Python.\n* unittest.mock: 102. Mock object library.\n* urllib: 103.\n* urllib.error: 104. Exception classes raised by urllib.request.\n* urllib.parse: 105. Parse URLs into or assemble them from components.\n* urllib.request: 106. Extensible library for opening URLs.\n* urllib.response: 107. Response classes used by urllib.\n* urllib.robotparser: 108. Load a robots.txt file and answer questions about\nfetchability of other URLs.\n* usercustomize: 109.\n* uu: 10a. Encode and decode files in uuencode format.\n* uuid: 10b. UUID objects (universally unique identifiers)\naccording to RFC 4122\n* venv: 10c. Creation of virtual environments.\n* warnings: 10d. Issue warning messages and control their disposition.\n* wave: 10e. Provide an interface to the WAV sound format.\n* weakref: 10f. Support for weak references and weak dictionaries.\n* webbrowser: 110. Easy-to-use controller for web browsers.\n* winreg: 111. Routines and objects for manipulating the Windows\nregistry.\n* winsound: 112. Access to the sound-playing machinery for Windows.\n* wsgiref: 113. WSGI Utilities and Reference Implementation.\n* wsgiref.handlers: 114. WSGI server/gateway base classes.\n* wsgiref.headers: 115. WSGI response header tools.\n* wsgiref.simpleserver: 116. A simple WSGI HTTP server.\n* wsgiref.types: 117. WSGI types for static type checking\n* wsgiref.util: 118. WSGI environment utilities.\n* wsgiref.validate: 119. WSGI conformance checker.\n* xdrlib: 11a. Encoders and decoders for the External Data\nRepresentation (XDR).\n* xml: 11b. Package containing XML processing modules\n* xml.dom: 11c. Document Object Model API for Python.\n* xml.dom.minidom: 11d. Minimal Document Object Model (DOM) implementation.\n* xml.dom.pulldom: 11e. Support for building partial DOM trees from SAX\nevents.\n* xml.etree.ElementInclude: 11f.\n* xml.etree.ElementTree: 120. Implementation of the ElementTree API.\n* xml.parsers.expat: 121. An interface to the Expat non-validating XML parser.\n* xml.parsers.expat.errors: 122.\n* xml.parsers.expat.model: 123.\n* xml.sax: 124. Package containing SAX2 base classes and convenience\nfunctions.\n* xml.sax.handler: 125. Base classes for SAX event handlers.\n* xml.sax.saxutils: 126. Convenience functions and classes for use with SAX.\n* xml.sax.xmlreader: 127. Interface which SAX-compliant XML parsers must\nimplement.\n* xmlrpc.client: 128. XML-RPC client access.\n* xmlrpc.server: 129. Basic XML-RPC server implementations.\n* zipapp: 12a. Manage executable Python zip archives\n* zipfile: 12b. Read and write ZIP-format archive files.\n* zipimport: 12c. Support for importing Python modules from ZIP\narchives.\n* zlib: 12d. Low-level interface to compression and decompression\nroutines compatible with gzip.\n* zoneinfo: 12e. IANA time zone support\n",
            "subsections": []
        },
        "File: python3.12.info,  Node: Index,  Prev: Python Module Index,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "Index": {
            "content": "* Menu:\n\n*  (underscore); gettext:               GNU gettext API.    (line   32)\n*  (underscore); in numeric literal:    Numeric literals.   (line   13)\n*  (underscore); in numeric literal <1>: Integer literals.  (line   39)\n*  (underscore); in string formatting:  Format Specification Mini-Language.\n(line  111)\n* , identifiers:                       Soft Keywords.      (line   21)\n* abs() (in module operator):        operator -- Standard operators as functions.\n(line   73)\n* abs() (object method):             Emulating numeric types.\n(line  108)\n* add() (in module operator):        operator -- Standard operators as functions.\n(line   78)\n* add() (object method):             Emulating numeric types.\n(line   11)\n* aenter() (object method):          Asynchronous Context Managers.\n(line   12)\n* aexit() (object method):           Asynchronous Context Managers.\n(line   17)\n* aiter() (object method):           Asynchronous Iterators.\n(line   12)\n* all:                               Importing * From a Package.\n(line    6)\n* all (optional module attribute):   The import statement.\n(line   84)\n* all (package variable):            Importing Modules<2>.\n(line    9)\n* and() (enum.Flag method):          Data Types<2>.      (line  457)\n* and() (in module operator):        operator -- Standard operators as functions.\n(line   83)\n* and() (object method):             Emulating numeric types.\n(line   11)\n* anext() (agen method):             Asynchronous generator-iterator methods.\n(line   10)\n* anext() (object method):           Asynchronous Iterators.\n(line   16)\n* annotations (class attribute):     Custom classes.     (line   35)\n* annotations (function attribute):  Special writable attributes.\n(line    6)\n* annotations (function attribute) <1>: Special writable attributes.\n(line   45)\n* annotations (module attribute):    Modules<3>.         (line   21)\n* args (genericalias attribute):     Special Attributes of GenericAlias objects.\n(line   15)\n* await() (object method):           Awaitable Objects.  (line   14)\n* bases (class attribute):           Custom classes.     (line   35)\n* bases (class attribute) <1>:       Special Attributes. (line   19)\n* bool() (object method):            Basic customization.\n(line  305)\n* bool() (object method) <1>:        Emulating container types.\n(line   40)\n* bound (typing.TypeVar attribute):  Building generic types and type aliases.\n(line  174)\n* breakpointhook (in module sys):    sys -- System-specific parameters and functions.\n(line  409)\n* buffer() (object method):          Emulating buffer types.\n(line   15)\n* bytes() (email.message.EmailMessage method): email message Representing an email message.\n(line  129)\n* bytes() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  138)\n* bytes() (object method):           Basic customization.\n(line  143)\n* cached:                            Import-related module attributes.\n(line   89)\n* call() (email.headerregistry.HeaderRegistry method): email headerregistry Custom Header Objects.\n(line  389)\n* call() (enum.EnumType method):     Data Types<2>.      (line   17)\n* call() (in module operator):       operator -- Standard operators as functions.\n(line  221)\n* call() (object method):            Emulating callable objects.\n(line    6)\n* call() (object method) <1>:        Calls.              (line  156)\n* call() (weakref.finalize method):  weakref -- Weak references.\n(line  295)\n* callback (weakref.ref attribute):  weakref -- Weak references.\n(line  126)\n* cause (BaseException attribute):   Exception context.  (line    9)\n* cause (exception attribute):       The raise statement.\n(line   30)\n* cause (exception attribute) <1>:   Exception context.  (line    6)\n* cause (traceback.TracebackException attribute): TracebackException Objects.\n(line   39)\n* ceil() (fractions.Fraction method): fractions -- Rational numbers.\n(line  184)\n* ceil() (object method):            Emulating numeric types.\n(line  138)\n* class (instance attribute):        Class instances.    (line   30)\n* class (instance attribute) <1>:    Special Attributes. (line   15)\n* class (method cell):               Creating the class object.\n(line    6)\n* class (module attribute):          Customizing module attribute access.\n(line    6)\n* class (unittest.mock.Mock attribute): The Mock Class.  (line  538)\n* classgetitem() (object class method): Emulating generic types.\n(line   32)\n* classcell (class namespace entry): Creating the class object.\n(line    6)\n* closure (function attribute):      Special read-only attributes.\n(line    6)\n* closure (function attribute) <1>:  Special read-only attributes.\n(line   16)\n* code (function attribute):         Special writable attributes.\n(line    6)\n* code (function attribute) <1>:     Special writable attributes.\n(line   36)\n* code (function object attribute):  Code Objects.       (line    6)\n* complex() (object method):         Emulating numeric types.\n(line  116)\n* concat() (in module operator):     operator -- Standard operators as functions.\n(line  176)\n* constraints (typing.TypeVar attribute): Building generic types and type aliases.\n(line  183)\n* contains() (email.message.EmailMessage method): email message Representing an email message.\n(line  179)\n* contains() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  300)\n* contains() (enum.EnumType method): Data Types<2>.      (line   62)\n* contains() (enum.Flag method):     Data Types<2>.      (line  397)\n* contains() (in module operator):   operator -- Standard operators as functions.\n(line  181)\n* contains() (mailbox.Mailbox method): Mailbox objects.  (line  203)\n* contains() (object method):        Emulating container types.\n(line  149)\n* context (BaseException attribute): Exception context.  (line    9)\n* context (exception attribute):     The raise statement.\n(line   30)\n* context (exception attribute) <1>: Exception context.  (line    6)\n* context (traceback.TracebackException attribute): TracebackException Objects.\n(line   43)\n* contravariant (typing.TypeVar attribute): Building generic types and type aliases.\n(line  162)\n* copy() (copy protocol):            copy -- Shallow and deep copy operations.\n(line   73)\n* covariant (typing.TypeVar attribute): Building generic types and type aliases.\n(line  158)\n* debug:                             The assert statement.\n(line   21)\n* debug (built-in variable):         Built-in Constants. (line   66)\n* deepcopy() (copy protocol):        copy -- Shallow and deep copy operations.\n(line   73)\n* defaults (function attribute):     Special writable attributes.\n(line    6)\n* defaults (function attribute) <1>: Special writable attributes.\n(line   30)\n* del() (io.IOBase method):          I/O Base Classes.   (line  164)\n* del() (object method):             Basic customization.\n(line   53)\n* delattr() (object method):         Customizing attribute access.\n(line   68)\n* delete() (object method):          Implementing Descriptors.\n(line   40)\n* delitem() (email.message.EmailMessage method): email message Representing an email message.\n(line  226)\n* delitem() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  334)\n* delitem() (in module operator):    operator -- Standard operators as functions.\n(line  191)\n* delitem() (mailbox.Mailbox method): Mailbox objects.   (line   76)\n* delitem() (mailbox.MH method):     MH objects.         (line   76)\n* delitem() (object method):         Emulating container types.\n(line  107)\n* dict (class attribute):            Custom classes.     (line   35)\n* dict (function attribute):         Special writable attributes.\n(line    6)\n* dict (function attribute) <1>:     Special writable attributes.\n(line   40)\n* dict (instance attribute):         Class instances.    (line   30)\n* dict (module attribute):           Modules<3>.         (line   47)\n* dict (module attribute) <1>:       Module Objects.     (line   47)\n* dict (object attribute):           Special Attributes. (line   10)\n* dir (module attribute):            Customizing module attribute access.\n(line    6)\n* dir() (enum.Enum method):          Data Types<2>.      (line  175)\n* dir() (enum.EnumType method):      Data Types<2>.      (line   75)\n* dir() (object method):             Customizing attribute access.\n(line   77)\n* dir() (unittest.mock.Mock method): The Mock Class.     (line  278)\n* displayhook (in module sys):       sys -- System-specific parameters and functions.\n(line  409)\n* divmod() (object method):          Emulating numeric types.\n(line   11)\n* doc (class attribute):             Custom classes.     (line   35)\n* doc (function attribute):          Special writable attributes.\n(line    6)\n* doc (function attribute) <1>:      Special writable attributes.\n(line   12)\n* doc (method attribute):            Instance methods.   (line    9)\n* doc (method attribute) <1>:        Instance methods.   (line   18)\n* doc (module attribute):            Modules<3>.         (line   21)\n* doc (module attribute) <1>:        Module Objects.     (line   26)\n* doc (types.ModuleType attribute):  Standard Interpreter Types.\n(line  132)\n* enter() (contextmanager method):   Context Manager Types.\n(line   12)\n* enter() (object method):           With Statement Context Managers.\n(line   21)\n* enter() (winreg.PyHKEY method):    Registry Handle Objects.\n(line   56)\n* eq() (email.charset.Charset method): email charset Representing character sets.\n(line  150)\n* eq() (email.header.Header method): email header Internationalized headers.\n(line  170)\n* eq() (in module operator):         operator -- Standard operators as functions.\n(line   24)\n* eq() (instance method):            Comparisons<2>.     (line   50)\n* eq() (memoryview method):          Memory Views.       (line  112)\n* eq() (object method):              Basic customization.\n(line  172)\n* excepthook (in module sys):        sys -- System-specific parameters and functions.\n(line  409)\n* excepthook (in module threading):  threading -- Thread-based parallelism.\n(line  111)\n* exit() (contextmanager method):    Context Manager Types.\n(line   32)\n* exit() (object method):            With Statement Context Managers.\n(line   27)\n* exit() (winreg.PyHKEY method):     Registry Handle Objects.\n(line   56)\n* file:                              Import-related module attributes.\n(line   87)\n* file (module attribute):           Modules<3>.         (line   21)\n* file (module attribute) <1>:       Module Objects.     (line   26)\n* file (module attribute) <2>:       Module Objects.     (line   90)\n* float() (object method):           Emulating numeric types.\n(line  116)\n* floor() (fractions.Fraction method): fractions -- Rational numbers.\n(line  174)\n* floor() (object method):           Emulating numeric types.\n(line  138)\n* floordiv() (in module operator):   operator -- Standard operators as functions.\n(line   88)\n* floordiv() (object method):        Emulating numeric types.\n(line   11)\n* format:                            Built-in Functions. (line  702)\n* format() (datetime.date method):   date Objects.       (line  289)\n* format() (datetime.datetime method): datetime Objects. (line  735)\n* format() (datetime.time method):   time Objects.       (line  225)\n* format() (enum.Enum method):       Data Types<2>.      (line  316)\n* format() (fractions.Fraction method): fractions -- Rational numbers.\n(line  201)\n* format() (ipaddress.IPv4Address method): Address objects.\n(line  177)\n* format() (ipaddress.IPv6Address method): Address objects.\n(line  309)\n* format() (object method):          Basic customization.\n(line  149)\n* fspath() (os.PathLike method):     Process Parameters. (line  127)\n* func (method attribute):           Instance methods.   (line    9)\n* func (method attribute) <1>:       Instance methods.   (line   15)\n* future:                            Glossary.           (line  528)\n* future; future statement:          Future statements.  (line    6)\n* ge() (in module operator):         operator -- Standard operators as functions.\n(line   24)\n* ge() (instance method):            Comparisons<2>.     (line   50)\n* ge() (object method):              Basic customization.\n(line  172)\n* get() (object method):             Implementing Descriptors.\n(line   13)\n* getattr (module attribute):        Customizing module attribute access.\n(line    6)\n* getattr() (object method):         Customizing attribute access.\n(line   10)\n* getattribute() (object method):    Customizing attribute access.\n(line   32)\n* getitem() (email.headerregistry.HeaderRegistry method): email headerregistry Custom Header Objects.\n(line  384)\n* getitem() (email.message.EmailMessage method): email message Representing an email message.\n(line  189)\n* getitem() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  309)\n* getitem() (enum.EnumType method):  Data Types<2>.      (line   83)\n* getitem() (in module operator):    operator -- Standard operators as functions.\n(line  196)\n* getitem() (mailbox.Mailbox method): Mailbox objects.   (line  148)\n* getitem() (mapping object method): Special method names.\n(line    6)\n* getitem() (object method):         Emulating container types.\n(line   77)\n* getitem() (re.Match method):       Match Objects.      (line   90)\n* getnewargs() (object method):      Pickling Class Instances.\n(line   47)\n* getnewargsex() (object method):   Pickling Class Instances.\n(line   29)\n* getstate() (copy protocol):        Handling Stateful Objects.\n(line    6)\n* getstate() (object method):        Pickling Class Instances.\n(line   61)\n* globals (function attribute):      Special read-only attributes.\n(line    6)\n* globals (function attribute) <1>:  Special read-only attributes.\n(line   10)\n* gt() (in module operator):         operator -- Standard operators as functions.\n(line   24)\n* gt() (instance method):            Comparisons<2>.     (line   50)\n* gt() (object method):              Basic customization.\n(line  172)\n* hash() (object method):            Basic customization.\n(line  225)\n* iadd() (in module operator):       In-place Operators. (line   36)\n* iadd() (object method):            Emulating numeric types.\n(line   77)\n* iand() (in module operator):       In-place Operators. (line   41)\n* iand() (object method):            Emulating numeric types.\n(line   77)\n* iconcat() (in module operator):    In-place Operators. (line   46)\n* ifloordiv() (in module operator):  In-place Operators. (line   52)\n* ifloordiv() (object method):       Emulating numeric types.\n(line   77)\n* ilshift() (in module operator):    In-place Operators. (line   57)\n* ilshift() (object method):         Emulating numeric types.\n(line   77)\n* imatmul() (in module operator):    In-place Operators. (line   72)\n* imatmul() (object method):         Emulating numeric types.\n(line   77)\n* imod() (in module operator):       In-place Operators. (line   62)\n* imod() (object method):            Emulating numeric types.\n(line   77)\n* import() (in module importlib):    Functions<12>.      (line    6)\n* imul() (in module operator):       In-place Operators. (line   67)\n* imul() (object method):            Emulating numeric types.\n(line   77)\n* index() (in module operator):      operator -- Standard operators as functions.\n(line   93)\n* index() (object method):           Emulating numeric types.\n(line  124)\n* infervariance (typing.TypeVar attribute): Building generic types and type aliases.\n(line  167)\n* init() (asyncio.Future method):    Future and Task private constructors.\n(line   17)\n* init() (asyncio.Task method):      Future and Task private constructors.\n(line   23)\n* init() (difflib.HtmlDiff method):  difflib -- Helpers for computing deltas.\n(line   92)\n* init() (enum.Enum method):         Data Types<2>.      (line  225)\n* init() (logging.Handler method):   Handler Objects.    (line   13)\n* init() (logging.logging.Formatter method): Formatters. (line   13)\n* init() (object method):            Basic customization.\n(line   37)\n* initsubclass() (enum.Enum method): Data Types<2>.     (line  238)\n* initsubclass() (object class method): Customizing class creation.\n(line   13)\n* instancecheck() (class method):    Customizing instance and subclass checks.\n(line   15)\n* int() (object method):             Emulating numeric types.\n(line  116)\n* interactivehook (in module sys):   sys -- System-specific parameters and functions.\n(line 1129)\n* inv() (in module operator):        operator -- Standard operators as functions.\n(line  102)\n* invert() (in module operator):     operator -- Standard operators as functions.\n(line  102)\n* invert() (object method):          Emulating numeric types.\n(line  108)\n* ior() (in module operator):        In-place Operators. (line   79)\n* ior() (object method):             Emulating numeric types.\n(line   77)\n* ipow() (in module operator):       In-place Operators. (line   84)\n* ipow() (object method):            Emulating numeric types.\n(line   77)\n* irshift() (in module operator):    In-place Operators. (line   89)\n* irshift() (object method):         Emulating numeric types.\n(line   77)\n* isub() (in module operator):       In-place Operators. (line   94)\n* isub() (object method):            Emulating numeric types.\n(line   77)\n* iter() (container method):         Iterator Types.     (line   14)\n* iter() (enum.EnumType method):     Data Types<2>.      (line   91)\n* iter() (iterator method):          Iterator Types.     (line   29)\n* iter() (mailbox.Mailbox method):   Mailbox objects.    (line  116)\n* iter() (object method):            Emulating container types.\n(line  121)\n* iter() (unittest.TestSuite method): Grouping tests.    (line   60)\n* itruediv() (in module operator):   In-place Operators. (line   99)\n* itruediv() (object method):        Emulating numeric types.\n(line   77)\n* ixor() (in module operator):       In-place Operators. (line  104)\n* ixor() (object method):            Emulating numeric types.\n(line   77)\n* kwdefaults (function attribute):   Special writable attributes.\n(line    6)\n* kwdefaults (function attribute) <1>: Special writable attributes.\n(line   52)\n* le() (in module operator):         operator -- Standard operators as functions.\n(line   24)\n* le() (instance method):            Comparisons<2>.     (line   50)\n* le() (object method):              Basic customization.\n(line  172)\n* len() (email.message.EmailMessage method): email message Representing an email message.\n(line  175)\n* len() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  296)\n* len() (enum.EnumType method):      Data Types<2>.      (line   98)\n* len() (mailbox.Mailbox method):    Mailbox objects.    (line  208)\n* len() (mapping object method):     Basic customization.\n(line  307)\n* len() (object method):             Emulating container types.\n(line   38)\n* lengthhint() (object method):     Emulating container types.\n(line   53)\n* loader:                            Import-related module attributes.\n(line   20)\n* loader (module attribute):         Module Objects.     (line   26)\n* loader (types.ModuleType attribute): Standard Interpreter Types.\n(line  136)\n* lshift() (in module operator):     operator -- Standard operators as functions.\n(line  110)\n* lshift() (object method):          Emulating numeric types.\n(line   11)\n* lt() (in module operator):         operator -- Standard operators as functions.\n(line   24)\n* lt() (instance method):            Comparisons<2>.     (line   50)\n* lt() (object method):              Basic customization.\n(line  172)\n* matmul() (in module operator):     operator -- Standard operators as functions.\n(line  125)\n* matmul() (object method):          Emulating numeric types.\n(line   11)\n* members (enum.EnumType attribute): Data Types<2>.      (line  105)\n* missing():                         Mapping Types -- dict.\n(line   89)\n* missing() (collections.defaultdict method): defaultdict objects.\n(line   22)\n* missing() (object method):         Emulating container types.\n(line  116)\n* mod() (in module operator):        operator -- Standard operators as functions.\n(line  115)\n* mod() (object method):             Emulating numeric types.\n(line   11)\n* module (class attribute):          Custom classes.     (line   35)\n* module (function attribute):       Special writable attributes.\n(line    6)\n* module (function attribute) <1>:   Special writable attributes.\n(line   26)\n* module (method attribute):         Instance methods.   (line    9)\n* module (method attribute) <1>:     Instance methods.   (line   28)\n* module (typing.NewType attribute): Other special directives.\n(line   98)\n* module (typing.TypeAliasType attribute): Building generic types and type aliases.\n(line  456)\n* mro (class attribute):             Special Attributes. (line   42)\n* mroentries() (object method):     Resolving MRO entries.\n(line    6)\n* mul() (in module operator):        operator -- Standard operators as functions.\n(line  120)\n* mul() (object method):             Emulating numeric types.\n(line   11)\n* name:                              Import-related module attributes.\n(line   14)\n* name (class attribute):            Custom classes.     (line   35)\n* name (definition attribute):       Special Attributes. (line   23)\n* name (function attribute):         Special writable attributes.\n(line    6)\n* name (function attribute) <1>:     Special writable attributes.\n(line   16)\n* name (method attribute):           Instance methods.   (line    9)\n* name (method attribute) <1>:       Instance methods.   (line   24)\n* name (module attribute):           Modules<3>.         (line   21)\n* name (module attribute) <1>:       Module Objects.     (line   26)\n* name (module attribute) <2>:       Module Objects.     (line   62)\n* name (types.ModuleType attribute): Standard Interpreter Types.\n(line  154)\n* name (typing.NewType attribute):   Other special directives.\n(line  102)\n* name (typing.ParamSpec attribute): Building generic types and type aliases.\n(line  384)\n* name (typing.TypeAliasType attribute): Building generic types and type aliases.\n(line  448)\n* name (typing.TypeVar attribute):   Building generic types and type aliases.\n(line  154)\n* name (typing.TypeVarTuple attribute): Building generic types and type aliases.\n(line  302)\n* ne() (email.charset.Charset method): email charset Representing character sets.\n(line  155)\n* ne() (email.header.Header method): email header Internationalized headers.\n(line  175)\n* ne() (in module operator):         operator -- Standard operators as functions.\n(line   24)\n* ne() (instance method):            Comparisons<2>.     (line   50)\n* ne() (object method):              Basic customization.\n(line  172)\n* neg() (in module operator):        operator -- Standard operators as functions.\n(line  132)\n* neg() (object method):             Emulating numeric types.\n(line  108)\n* new() (enum.Enum method):          Data Types<2>.      (line  266)\n* new() (object method):             Basic customization.\n(line    6)\n* next() (csv.csvreader method):     Reader Objects.     (line    9)\n* next() (generator method):         Generator-iterator methods.\n(line   12)\n* next() (iterator method):          Iterator Types.     (line   37)\n* not() (in module operator):        operator -- Standard operators as functions.\n(line   49)\n* notes (BaseException attribute):   Base classes.       (line   58)\n* notes (traceback.TracebackException attribute): TracebackException Objects.\n(line   61)\n* objclass (object attribute):       Implementing Descriptors.\n(line   48)\n* optionalkeys (typing.TypedDict attribute): Other special directives.\n(line  390)\n* or() (enum.Flag method):           Data Types<2>.      (line  450)\n* or() (in module operator):         operator -- Standard operators as functions.\n(line  137)\n* or() (object method):              Emulating numeric types.\n(line   11)\n* origin (genericalias attribute):   Special Attributes of GenericAlias objects.\n(line    8)\n* package:                           Import-related module attributes.\n(line   34)\n* package (module attribute):        Module Objects.     (line   26)\n* package (types.ModuleType attribute): Standard Interpreter Types.\n(line  159)\n* parameters (genericalias attribute): Special Attributes of GenericAlias objects.\n(line   24)\n* path:                              Import-related module attributes.\n(line   76)\n* pos() (in module operator):        operator -- Standard operators as functions.\n(line  142)\n* pos() (object method):             Emulating numeric types.\n(line  108)\n* postinit() (in module dataclasses): Post-init processing.\n(line    6)\n* pow() (in module operator):        operator -- Standard operators as functions.\n(line  147)\n* pow() (object method):             Emulating numeric types.\n(line   11)\n* prepare (metaclass method):        Preparing the class namespace.\n(line    6)\n* PYVENVLAUNCHER:                   PyConfig.           (line  179)\n* PYVENVLAUNCHER <1>:               PyConfig.           (line  678)\n* qualname (definition attribute):   Special Attributes. (line   28)\n* qualname (function attribute):     Special writable attributes.\n(line   20)\n* radd() (object method):            Emulating numeric types.\n(line   41)\n* rand() (object method):            Emulating numeric types.\n(line   41)\n* rdivmod() (object method):         Emulating numeric types.\n(line   41)\n* reduce() (object method):          Pickling Class Instances.\n(line  124)\n* reduceex() (object method):       Pickling Class Instances.\n(line  179)\n* releasebuffer() (object method):  Emulating buffer types.\n(line   25)\n* repr() (enum.Enum method):         Data Types<2>.      (line  283)\n* repr() (multiprocessing.managers.BaseProxy method): Proxy Objects.\n(line  145)\n* repr() (netrc.netrc method):       netrc Objects.      (line   16)\n* repr() (object method):            Basic customization.\n(line  112)\n* requiredkeys (typing.TypedDict attribute): Other special directives.\n(line  386)\n* reversed() (enum.EnumType method): Data Types<2>.      (line  110)\n* reversed() (object method):        Emulating container types.\n(line  128)\n* rfloordiv() (object method):       Emulating numeric types.\n(line   41)\n* rlshift() (object method):         Emulating numeric types.\n(line   41)\n* rmatmul() (object method):         Emulating numeric types.\n(line   41)\n* rmod() (object method):            Emulating numeric types.\n(line   41)\n* rmul() (object method):            Emulating numeric types.\n(line   41)\n* ror() (object method):             Emulating numeric types.\n(line   41)\n* round() (fractions.Fraction method): fractions -- Rational numbers.\n(line  190)\n* round() (object method):           Emulating numeric types.\n(line  138)\n* rpow() (object method):            Emulating numeric types.\n(line   41)\n* rrshift() (object method):         Emulating numeric types.\n(line   41)\n* rshift() (in module operator):     operator -- Standard operators as functions.\n(line  152)\n* rshift() (object method):          Emulating numeric types.\n(line   11)\n* rsub() (object method):            Emulating numeric types.\n(line   41)\n* rtruediv() (object method):        Emulating numeric types.\n(line   41)\n* rxor() (object method):            Emulating numeric types.\n(line   41)\n* self (method attribute):           Instance methods.   (line    9)\n* self (method attribute) <1>:       Instance methods.   (line   11)\n* set() (object method):             Implementing Descriptors.\n(line   31)\n* setname() (object method):        Customizing class creation.\n(line   47)\n* setattr() (object method):         Customizing attribute access.\n(line   53)\n* setitem() (email.message.EmailMessage method): email message Representing an email message.\n(line  204)\n* setitem() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  320)\n* setitem() (in module operator):    operator -- Standard operators as functions.\n(line  205)\n* setitem() (mailbox.Mailbox method): Mailbox objects.   (line   90)\n* setitem() (mailbox.Maildir method): Maildir objects.   (line   92)\n* setitem() (object method):         Emulating container types.\n(line   98)\n* setstate() (copy protocol):        Handling Stateful Objects.\n(line    6)\n* setstate() (object method):        Pickling Class Instances.\n(line   88)\n* slots:                             Glossary.           (line 1219)\n* spec:                              Import-related module attributes.\n(line   60)\n* spec (types.ModuleType attribute): Standard Interpreter Types.\n(line  180)\n* stderr (in module sys):            sys -- System-specific parameters and functions.\n(line 1811)\n* stdin (in module sys):             sys -- System-specific parameters and functions.\n(line 1811)\n* stdout (in module sys):            sys -- System-specific parameters and functions.\n(line 1811)\n* str() (datetime.date method):      date Objects.       (line  262)\n* str() (datetime.datetime method):  datetime Objects.   (line  705)\n* str() (datetime.time method):      time Objects.       (line  215)\n* str() (email.charset.Charset method): email charset Representing character sets.\n(line  145)\n* str() (email.header.Header method): email header Internationalized headers.\n(line  158)\n* str() (email.headerregistry.Address method): email headerregistry Custom Header Objects.\n(line  446)\n* str() (email.headerregistry.Group method): email headerregistry Custom Header Objects.\n(line  481)\n* str() (email.message.EmailMessage method): email message Representing an email message.\n(line   95)\n* str() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  101)\n* str() (enum.Enum method):          Data Types<2>.      (line  300)\n* str() (multiprocessing.managers.BaseProxy method): Proxy Objects.\n(line  149)\n* str() (object method):             Basic customization.\n(line  128)\n* sub() (in module operator):        operator -- Standard operators as functions.\n(line  157)\n* sub() (object method):             Emulating numeric types.\n(line   11)\n* subclasscheck() (class method):    Customizing instance and subclass checks.\n(line   21)\n* subclasses() (class method):       Special Attributes. (line   53)\n* subclasshook() (abc.ABCMeta method): abc -- Abstract Base Classes.\n(line   92)\n* supertype (typing.NewType attribute): Other special directives.\n(line  106)\n* suppresscontext (BaseException attribute): Exception context.\n(line    9)\n* suppresscontext (exception attribute): Exception context.\n(line    6)\n* suppresscontext (traceback.TracebackException attribute): TracebackException Objects.\n(line   56)\n* total (typing.TypedDict attribute): Other special directives.\n(line  361)\n* traceback (BaseException attribute): Base classes.     (line   44)\n* traceback (exception attribute):   The raise statement.\n(line    6)\n* truediv() (importlib.abc.Traversable method): importlib abc - Abstract base classes related to import.\n(line  571)\n* truediv() (importlib.resources.abc.Traversable method): importlib resources abc - Abstract base classes for resources.\n(line  136)\n* truediv() (in module operator):    operator -- Standard operators as functions.\n(line  162)\n* truediv() (object method):         Emulating numeric types.\n(line   11)\n* trunc() (object method):           Emulating numeric types.\n(line  138)\n* typeparams (class attribute):     Custom classes.     (line   35)\n* typeparams (definition attribute): Special Attributes.\n(line   35)\n* typeparams (function attribute):  Special writable attributes.\n(line    6)\n* typeparams (function attribute) <1>: Special writable attributes.\n(line   56)\n* typeparams (typing.TypeAliasType attribute): Building generic types and type aliases.\n(line  464)\n* unpacked (genericalias attribute): Special Attributes of GenericAlias objects.\n(line   40)\n* unraisablehook (in module sys):    sys -- System-specific parameters and functions.\n(line  409)\n* value (typing.TypeAliasType attribute): Building generic types and type aliases.\n(line  476)\n* version (in module curses):        Constants<6>.       (line   20)\n* xor() (enum.Flag method):          Data Types<2>.      (line  466)\n* xor() (in module operator):        operator -- Standard operators as functions.\n(line  168)\n* xor() (object method):             Emulating numeric types.\n(line   11)\n* , identifiers:                        Soft Keywords.      (line   22)\n* anonymous (ctypes.Structure attribute): Structured data types.\n(line   87)\n* asdict() (collections.somenamedtuple method): namedtuple Factory Function for Tuples with Named Fields.\n(line  110)\n* bbase (ctypes.CData attribute):    Data types.         (line   71)\n* bneedsfree (ctypes.CData attribute): Data types.       (line   78)\n* callmethod() (multiprocessing.managers.BaseProxy method): Proxy Objects.\n(line   96)\n* CData (class in ctypes):              Data types.         (line    6)\n* cleartypecache() (in module sys):   sys -- System-specific parameters and functions.\n(line  182)\n* currentexceptions() (in module sys): sys -- System-specific parameters and functions.\n(line  211)\n* currentframes() (in module sys):     sys -- System-specific parameters and functions.\n(line  191)\n* debugmallocstats() (in module sys):   sys -- System-specific parameters and functions.\n(line  267)\n* emscripteninfo (in module sys):      sys -- System-specific parameters and functions.\n(line  332)\n* enablelegacywindowsfsencoding() (in module sys): sys -- System-specific parameters and functions.\n(line 1725)\n* entertask() (in module asyncio):     Task lifetime support.\n(line   22)\n* exit() (in module os):                Process Management. (line  122)\n* Feature (class in future):        Module Contents<5>. (line   44)\n* fielddefaults (collections.somenamedtuple attribute): namedtuple Factory Function for Tuples with Named Fields.\n(line  153)\n* fields (ast.AST attribute):           Node classes.       (line   22)\n* fields (collections.somenamedtuple attribute): namedtuple Factory Function for Tuples with Named Fields.\n(line  140)\n* fields (ctypes.Structure attribute): Structured data types.\n(line   43)\n* flush() (wsgiref.handlers.BaseHandler method): wsgiref handlers - server/gateway base classes.\n(line  117)\n* frozen (C struct):                    Importing Modules<2>.\n(line  254)\n* FuncPtr (class in ctypes):            Foreign functions.  (line   12)\n* generatenextvalue() (enum.Enum method): Data Types<2>. (line  196)\n* getchildmock() (unittest.mock.Mock method): The Mock Class.\n(line  287)\n* getpreferredschemes() (in module sysconfig): Installation path functions.\n(line   41)\n* getframe() (in module sys):           sys -- System-specific parameters and functions.\n(line  866)\n* getframemodulename() (in module sys): sys -- System-specific parameters and functions.\n(line  881)\n* getvalue() (multiprocessing.managers.BaseProxy method): Proxy Objects.\n(line  138)\n* handle (ctypes.PyDLL attribute):      Loading shared libraries.\n(line  154)\n* ignore (enum.Enum attribute):        Data Types<2>.      (line  166)\n* incompatibleextensionmodulerestrictions() (in module importlib.util): importlib util - Utility code for importers.\n(line  168)\n* inittab (C struct):                   Importing Modules<2>.\n(line  290)\n* inittab.initfunc (C member):          Importing Modules<2>.\n(line  302)\n* inittab.name (C member):              Importing Modules<2>.\n(line  298)\n* leavetask() (in module asyncio):     Task lifetime support.\n(line   30)\n* length (ctypes.Array attribute):     Arrays and pointers.\n(line   18)\n* log (logging.LoggerAdapter attribute): LoggerAdapter Objects.\n(line   29)\n* make() (collections.somenamedtuple class method): namedtuple Factory Function for Tuples with Named Fields.\n(line  101)\n* makeResult() (unittest.TextTestRunner method): Loading and running tests.\n(line  486)\n* missing() (enum.Enum method):        Data Types<2>.      (line  243)\n* name (ctypes.PyDLL attribute):        Loading shared libraries.\n(line  158)\n* name (enum.Enum attribute):          Data Types<2>.      (line  153)\n* numericrepr() (enum.Flag method):   Data Types<2>.      (line  486)\n* objects (ctypes.CData attribute):    Data types.         (line   83)\n* order (enum.Enum attribute):         Data Types<2>.      (line  161)\n* pack (ctypes.Structure attribute):   Structured data types.\n(line   79)\n* parse() (gettext.NullTranslations method): The NullTranslations class.\n(line   21)\n* Pointer (class in ctypes):            Arrays and pointers.\n(line   31)\n* Pycdiff (C function):               Complex Numbers as C Structures.\n(line   28)\n* Pycneg (C function):                Complex Numbers as C Structures.\n(line   34)\n* Pycpow (C function):                Complex Numbers as C Structures.\n(line   54)\n* Pycprod (C function):               Complex Numbers as C Structures.\n(line   39)\n* Pycquot (C function):               Complex Numbers as C Structures.\n(line   45)\n* Pycsum (C function):                Complex Numbers as C Structures.\n(line   22)\n* PyInitializeMain (C function):       Multi-Phase Initialization Private Provisional API.\n(line   44)\n* PyNoneStruct (C var):                Allocating Objects on the Heap.\n(line   59)\n* PyBytesResize (C function):          Bytes Objects<2>.   (line  182)\n* PyCFunctionFast (C type):             Implementing functions and methods.\n(line   29)\n* PyCFunctionFastWithKeywords (C type): Implementing functions and methods.\n(line   38)\n* PyCodeGetExtra (C function):         Extra information.  (line   45)\n* PyCodeSetExtra (C function):         Extra information.  (line   58)\n* PyEvalRequestCodeExtraIndex (C function): Extra information.\n(line   29)\n* PyFrameEvalFunction (C type):         Low-level API.      (line  150)\n* PyInterpreterFrame (C struct):        Internal Frames.    (line    8)\n* PyInterpreterStateGetEvalFrameFunc (C function): Low-level API.\n(line  165)\n* PyInterpreterStateSetEvalFrameFunc (C function): Low-level API.\n(line  175)\n* PyObjectGetDictPtr (C function):     Object Protocol.    (line  153)\n* PyObjectNew (C function):            Allocating Objects on the Heap.\n(line    6)\n* PyObjectNewVar (C function):         Allocating Objects on the Heap.\n(line    9)\n* PyTupleResize (C function):          Tuple Objects.      (line   89)\n* registertask() (in module asyncio):  Task lifetime support.\n(line   10)\n* replace() (collections.somenamedtuple method): namedtuple Factory Function for Tuples with Named Fields.\n(line  128)\n* setroot() (xml.etree.ElementTree.ElementTree method): ElementTree Objects.\n(line   15)\n* SimpleCData (class in ctypes):        Fundamental data types<2>.\n(line    6)\n* structure() (in module email.iterators): email iterators Iterators.\n(line   44)\n* type (ctypes.Pointer attribute):    Arrays and pointers.\n(line   46)\n* type (ctypes.Array attribute):       Arrays and pointers.\n(line   24)\n* unregistertask() (in module asyncio): Task lifetime support.\n(line   16)\n* value (enum.Enum attribute):         Data Types<2>.      (line  157)\n* write() (wsgiref.handlers.BaseHandler method): wsgiref handlers - server/gateway base classes.\n(line  109)\n* xoptions (in module sys):             sys -- System-specific parameters and functions.\n(line 1994)\n* - (minus); binary operator:            Binary arithmetic operations.\n(line   78)\n* - (minus); binary operator <1>:        Numeric Types -- int float complex.\n(line   27)\n* - (minus); in doctests:                Option Flags.       (line  171)\n* - (minus); in glob-style wildcards:    glob -- Unix style pathname pattern expansion.\n(line   10)\n* - (minus); in glob-style wildcards <1>: fnmatch -- Unix filename pattern matching.\n(line   15)\n* - (minus); in printf-style formatting: printf-style String Formatting.\n(line   66)\n* - (minus); in printf-style formatting <1>: printf-style Bytes Formatting.\n(line   63)\n* - (minus); in regular expressions:     Regular Expression Syntax.\n(line  177)\n* - (minus); in string formatting:       Format Specification Mini-Language.\n(line   71)\n* - (minus); unary operator:             Unary arithmetic and bitwise operations.\n(line   10)\n* - (minus); unary operator <1>:         Numeric Types -- int float complex.\n(line   27)\n* -=; augmented assignment:              Augmented assignment statements.\n(line    6)\n* ->; function annotations:              Function Annotations.\n(line    6)\n* ->; function annotations <1>:          Function definitions.\n(line  106)\n* , (comma):                             Parenthesized forms.\n(line   20)\n* , (comma); argument list:              Slicings.           (line   39)\n* , (comma); expression list:            List displays.      (line    6)\n* , (comma); expression list <1>:        Set displays.       (line    6)\n* , (comma); expression list <2>:        Expression lists.   (line    6)\n* , (comma); expression list <3>:        The assert statement.\n(line    6)\n* , (comma); expression list <4>:        Class definitions.  (line    6)\n* , (comma); identifier list:            The global statement.\n(line    6)\n* , (comma); identifier list <1>:        The nonlocal statement.\n(line    6)\n* , (comma); import statement:           The import statement.\n(line    6)\n* , (comma); in dictionary displays:     Dictionary displays.\n(line    6)\n* , (comma); in string formatting:       Format Specification Mini-Language.\n(line  105)\n* , (comma); in target list:             Assignment statements.\n(line   35)\n* , (comma); parameter list:             Function definitions.\n(line    6)\n* , (comma); slicing:                    Slicings.           (line    6)\n* , (comma); with statement:             The with statement. (line    6)\n* ; (colon); annotated variable:         Annotated assignment statements.\n(line    6)\n* ; (colon); compound statement:         The if statement.   (line    6)\n* ; (colon); compound statement <1>:     The while statement.\n(line    6)\n* ; (colon); compound statement <2>:     The for statement.  (line    6)\n* ; (colon); compound statement <3>:     The try statement.  (line    6)\n* ; (colon); compound statement <4>:     The with statement. (line    6)\n* ; (colon); compound statement <5>:     The match statement.\n(line    6)\n* ; (colon); compound statement <6>:     Function definitions.\n(line    6)\n* ; (colon); compound statement <7>:     Class definitions.  (line    6)\n* ; (colon); function annotations:       Function Annotations.\n(line    6)\n* ; (colon); function annotations <1>:   Function definitions.\n(line  106)\n* ; (colon); in dictionary expressions:  Dictionary displays.\n(line    6)\n* ; (colon); in formatted string literal: String literal concatenation.\n(line   24)\n* ; (colon); in SQL statements:          Cursor objects.     (line   24)\n* ; (colon); in string formatting:       Format String Syntax.\n(line   13)\n* ; (colon); lambda expression:          Lambdas.            (line    6)\n* ; (colon); path separator (POSIX):     Miscellaneous System Information.\n(line  118)\n* ; (colon); slicing:                    Slicings.           (line    6)\n* ; (semicolon):                         Compound statements.\n(line   18)\n* ; (semicolon) <1>:                     Miscellaneous System Information.\n(line  118)\n* ;= (colon equals):                     Boolean operations. (line   38)\n* ! (exclamation); in a command interpreter: Cmd Objects.    (line   27)\n* ! (exclamation); in curses module:     curses ascii -- Utilities for ASCII characters.\n(line  229)\n* ! (exclamation); in formatted string literal: String literal concatenation.\n(line   24)\n* ! (exclamation); in glob-style wildcards: glob -- Unix style pathname pattern expansion.\n(line   10)\n* ! (exclamation); in glob-style wildcards <1>: fnmatch -- Unix filename pattern matching.\n(line   15)\n* ! (exclamation); in string formatting: Format String Syntax.\n(line   13)\n* ! (exclamation); in struct format strings: Byte Order Size and Alignment.\n(line   13)\n* ! (pdb command):                       Debugger Commands.  (line  378)\n* ! patterns:                            Patterns.           (line    6)\n* ? (question mark); in a command interpreter: Cmd Objects.  (line   27)\n* ? (question mark); in argparse module: nargs.              (line   24)\n* ? (question mark); in AST grammar:     Node classes.       (line   22)\n* ? (question mark); in glob-style wildcards: glob -- Unix style pathname pattern expansion.\n(line   10)\n* ? (question mark); in glob-style wildcards <1>: fnmatch -- Unix filename pattern matching.\n(line   15)\n* ? (question mark); in regular expressions: Regular Expression Syntax.\n(line   80)\n* ? (question mark); in SQL statements:  Cursor objects.     (line   24)\n* ? (question mark); in struct format strings: Format Characters.\n(line   86)\n* ? (question mark); in struct format strings <1>: Format Characters.\n(line  168)\n* ? (question mark); replacement character: Error Handlers.  (line   15)\n* ??; in regular expressions:            Regular Expression Syntax.\n(line   85)\n* ?+; in regular expressions:            Regular Expression Syntax.\n(line   95)\n* . (dot); attribute reference:          Attribute references.\n(line    6)\n* . (dot); in glob-style wildcards:      glob -- Unix style pathname pattern expansion.\n(line   10)\n* . (dot); in numeric literal:           Integer literals.   (line   40)\n* . (dot); in pathnames:                 Miscellaneous System Information.\n(line   84)\n* . (dot); in pathnames <1>:             Miscellaneous System Information.\n(line  112)\n* . (dot); in printf-style formatting:   printf-style String Formatting.\n(line   26)\n* . (dot); in printf-style formatting <1>: printf-style Bytes Formatting.\n(line   23)\n* . (dot); in regular expressions:       Regular Expression Syntax.\n(line   46)\n* . (dot); in string formatting:         Format String Syntax.\n(line   13)\n* ..; in pathnames:                      Miscellaneous System Information.\n(line   90)\n* ...:                                   Glossary.           (line   10)\n* ...; ellipsis literal:                 Ellipsis.           (line    6)\n* ...; ellipsis literal <1>:             Built-in Constants. (line   59)\n* ...; ellipsis literal <2>:             The Null Object.    (line   12)\n* ...; in doctests:                      Option Flags.       (line   49)\n* ...; interpreter prompt:               How are Docstring Examples Recognized?.\n(line   26)\n* ...; interpreter prompt <1>:           sys -- System-specific parameters and functions.\n(line 1421)\n* ...; placeholder:                      textwrap -- Text wrapping and filling.\n(line  276)\n* ...; placeholder <1>:                  PrettyPrinter Objects.\n(line    8)\n* ...; placeholder <2>:                  reprlib -- Alternate repr implementation.\n(line   61)\n* .ini; file:                            configparser -- Configuration file parser.\n(line    8)\n* .pdbrc; file:                          Debugger Commands.  (line   56)\n* ' (single quote); string literal:      Literals.           (line    8)\n* '''; string literal:                   String and Bytes literals.\n(line   36)\n* \" (double quote); string literal:      Literals.           (line    8)\n* \"\"\"; string literal:                   String and Bytes literals.\n(line   36)\n* (?; in regular expressions:            Regular Expression Syntax.\n(line  241)\n* (?;; in regular expressions:           Regular Expression Syntax.\n(line  280)\n* (?!; in regular expressions:           Regular Expression Syntax.\n(line  398)\n* (?(; in regular expressions:           Regular Expression Syntax.\n(line  441)\n* (?#; in regular expressions:           Regular Expression Syntax.\n(line  387)\n* (?<!; in regular expressions:          Regular Expression Syntax.\n(line  432)\n* (?<=; in regular expressions:          Regular Expression Syntax.\n(line  404)\n* (?=; in regular expressions:           Regular Expression Syntax.\n(line  391)\n* (?P<; in regular expressions:          Regular Expression Syntax.\n(line  343)\n* (?P=; in regular expressions:          Regular Expression Syntax.\n(line  382)\n* () (parentheses); call:                Slicings.           (line   39)\n* () (parentheses); class definition:    Class definitions.  (line    6)\n* () (parentheses); function definition: Function definitions.\n(line    6)\n* () (parentheses); generator expression: Generator expressions.\n(line    6)\n* () (parentheses); in assignment target list: Assignment statements.\n(line   35)\n* () (parentheses); in printf-style formatting: printf-style String Formatting.\n(line   26)\n* () (parentheses); in printf-style formatting <1>: printf-style Bytes Formatting.\n(line   23)\n* () (parentheses); in regular expressions: Regular Expression Syntax.\n(line  232)\n* () (parentheses); tuple display:       Parenthesized forms.\n(line    6)\n* [] (square brackets); in assignment target list: Assignment statements.\n(line   35)\n* [] (square brackets); in glob-style wildcards: glob -- Unix style pathname pattern expansion.\n(line   10)\n* [] (square brackets); in glob-style wildcards <1>: fnmatch -- Unix filename pattern matching.\n(line   15)\n* [] (square brackets); in regular expressions: Regular Expression Syntax.\n(line  170)\n* [] (square brackets); in string formatting: Format String Syntax.\n(line   13)\n* [] (square brackets); list expression: List displays.      (line    6)\n* [] (square brackets); subscription:    Subscriptions.      (line    6)\n* {} (curly brackets); dictionary expression: Dictionary displays.\n(line    6)\n* {} (curly brackets); in formatted string literal: String literal concatenation.\n(line   24)\n* {} (curly brackets); in regular expressions: Regular Expression Syntax.\n(line  114)\n* {} (curly brackets); in string formatting: Format String Syntax.\n(line   13)\n* {} (curly brackets); set expression:   Set displays.       (line    6)\n* @ (at); class definition:              Class definitions.  (line   44)\n* @ (at); function definition:           Function definitions.\n(line   32)\n* @ (at); in struct format strings:      Byte Order Size and Alignment.\n(line   13)\n* * (asterisk); function definition:     Function definitions.\n(line   90)\n* * (asterisk); import statement:        The import statement.\n(line   80)\n* * (asterisk); in argparse module:      nargs.              (line   57)\n* * (asterisk); in assignment target list: Assignment statements.\n(line   35)\n* * (asterisk); in AST grammar:          Node classes.       (line   22)\n* * (asterisk); in expression lists:     Expression lists.   (line   16)\n* * (asterisk); in function calls:       Arbitrary Argument Lists.\n(line    6)\n* * (asterisk); in function calls <1>:   Calls.              (line   73)\n* * (asterisk); in glob-style wildcards: glob -- Unix style pathname pattern expansion.\n(line   10)\n* * (asterisk); in glob-style wildcards <1>: fnmatch -- Unix filename pattern matching.\n(line   15)\n* * (asterisk); in printf-style formatting: printf-style String Formatting.\n(line   26)\n* * (asterisk); in printf-style formatting <1>: printf-style Bytes Formatting.\n(line   23)\n* * (asterisk); in regular expressions:  Regular Expression Syntax.\n(line   68)\n* *?; in regular expressions:            Regular Expression Syntax.\n(line   85)\n* ; function definition:               Function definitions.\n(line   90)\n* ; in dictionary displays:            Dictionary displays.\n(line   23)\n* ; in function calls:                 Unpacking Argument Lists.\n(line   19)\n* ; in function calls <1>:             Calls.              (line  100)\n* ; in glob-style wildcards:           glob -- Unix style pathname pattern expansion.\n(line   54)\n* =; augmented assignment:             Augmented assignment statements.\n(line    6)\n* *+; in regular expressions:            Regular Expression Syntax.\n(line   95)\n* *=; augmented assignment:              Augmented assignment statements.\n(line    6)\n* / (slash); function definition:        Function definitions.\n(line   90)\n* / (slash); in pathnames:               Miscellaneous System Information.\n(line   96)\n* / (slash); in pathnames <1>:           Miscellaneous System Information.\n(line  105)\n* //=; augmented assignment:             Augmented assignment statements.\n(line    6)\n* /=; augmented assignment:              Augmented assignment statements.\n(line    6)\n* \\ (backslash); escape sequence:        String and Bytes literals.\n(line   75)\n* \\ (backslash); escape sequence <1>:    Error Handlers.     (line   15)\n* \\ (backslash); in pathnames (Windows): Miscellaneous System Information.\n(line   96)\n* \\ (backslash); in regular expressions: Regular Expression Syntax.\n(line  155)\n* \\ (backslash); in regular expressions <1>: Regular Expression Syntax.\n(line  189)\n* \\ (backslash); in regular expressions <2>: Regular Expression Syntax.\n(line  460)\n* \\\\; escape sequence:                   String and Bytes literals.\n(line   75)\n* \\\\; in regular expressions:            Regular Expression Syntax.\n(line  582)\n* \\a; escape sequence:                   String and Bytes literals.\n(line   75)\n* \\A; in regular expressions:            Regular Expression Syntax.\n(line  472)\n* \\a; in regular expressions:            Regular Expression Syntax.\n(line  582)\n* \\b; escape sequence:                   String and Bytes literals.\n(line   75)\n* \\b; in regular expressions:            Regular Expression Syntax.\n(line  476)\n* \\B; in regular expressions:            Regular Expression Syntax.\n(line  494)\n* \\b; in regular expressions <1>:        Regular Expression Syntax.\n(line  582)\n* \\d; in regular expressions:            Regular Expression Syntax.\n(line  505)\n* \\D; in regular expressions:            Regular Expression Syntax.\n(line  520)\n* \\f; escape sequence:                   String and Bytes literals.\n(line   75)\n* \\f; in regular expressions:            Regular Expression Syntax.\n(line  582)\n* \\g; in regular expressions:            Functions<2>.       (line  184)\n* \\n; escape sequence:                   String and Bytes literals.\n(line   75)\n* \\N; escape sequence:                   String and Bytes literals.\n(line   75)\n* \\N; escape sequence <1>:               Error Handlers.     (line   54)\n* \\n; in regular expressions:            Regular Expression Syntax.\n(line  582)\n* \\N; in regular expressions:            Regular Expression Syntax.\n(line  582)\n* \\r; escape sequence:                   String and Bytes literals.\n(line   75)\n* \\r; in regular expressions:            Regular Expression Syntax.\n(line  582)\n* \\s; in regular expressions:            Regular Expression Syntax.\n(line  527)\n* \\S; in regular expressions:            Regular Expression Syntax.\n(line  543)\n* \\t; escape sequence:                   String and Bytes literals.\n(line   75)\n* \\t; in regular expressions:            Regular Expression Syntax.\n(line  582)\n* \\u; escape sequence:                   String and Bytes literals.\n(line   75)\n* \\U; escape sequence:                   String and Bytes literals.\n(line   75)\n* \\u; escape sequence <1>:               Error Handlers.     (line   15)\n* \\U; escape sequence <1>:               Error Handlers.     (line   15)\n* \\u; in regular expressions:            Regular Expression Syntax.\n(line  582)\n* \\U; in regular expressions:            Regular Expression Syntax.\n(line  582)\n* \\v; escape sequence:                   String and Bytes literals.\n(line   75)\n* \\v; in regular expressions:            Regular Expression Syntax.\n(line  582)\n* \\w; in regular expressions:            Regular Expression Syntax.\n(line  550)\n* \\W; in regular expressions:            Regular Expression Syntax.\n(line  567)\n* \\x; escape sequence:                   String and Bytes literals.\n(line   75)\n* \\x; escape sequence <1>:               Error Handlers.     (line   15)\n* \\x; in regular expressions:            Regular Expression Syntax.\n(line  582)\n* \\Z; in regular expressions:            Regular Expression Syntax.\n(line  578)\n* &=; augmented assignment:              Augmented assignment statements.\n(line    6)\n* # (hash); comment:                     An Informal Introduction to Python.\n(line   14)\n* # (hash); comment <1>:                 Comments.           (line    6)\n* # (hash); comment <2>:                 site -- Site-specific configuration hook.\n(line   45)\n* # (hash); in doctests:                 Option Flags.       (line  172)\n* # (hash); in printf-style formatting:  printf-style String Formatting.\n(line   66)\n* # (hash); in printf-style formatting <1>: printf-style Bytes Formatting.\n(line   63)\n* # (hash); in regular expressions:      Flags.              (line  130)\n* # (hash); in string formatting:        Format Specification Mini-Language.\n(line   93)\n* # (hash); source encoding declaration: Encoding declarations.\n(line    6)\n* % (percent); datetime format:          timezone Objects.   (line   71)\n* % (percent); datetime format <1>:      Functions<5>.       (line  281)\n* % (percent); datetime format <2>:      Functions<5>.       (line  424)\n* % (percent); environment variables expansion (Windows): os path -- Common pathname manipulations.\n(line  154)\n* % (percent); environment variables expansion (Windows) <1>: Functions<13>.\n(line  228)\n* % (percent); interpolation in configuration files: Interpolation of values.\n(line   10)\n* % (percent); printf-style formatting:  printf-style String Formatting.\n(line    6)\n* % (percent); printf-style formatting <1>: printf-style Bytes Formatting.\n(line    6)\n* %=; augmented assignment:              Augmented assignment statements.\n(line    6)\n* %APPDATA%:                             Redirection of local data registry and temporary paths.\n(line   13)\n* ^ (caret); in curses module:           curses ascii -- Utilities for ASCII characters.\n(line  229)\n* ^ (caret); in regular expressions:     Regular Expression Syntax.\n(line   52)\n* ^ (caret); in regular expressions <1>: Regular Expression Syntax.\n(line  193)\n* ^ (caret); in string formatting:       Format Specification Mini-Language.\n(line   42)\n* ^ (caret); marker:                     What About Exceptions?.\n(line   93)\n* ^ (caret); marker <1>:                 traceback -- Print or retrieve a stack traceback.\n(line   58)\n* ^=; augmented assignment:              Augmented assignment statements.\n(line    6)\n* + (plus); binary operator:             Binary arithmetic operations.\n(line   69)\n* + (plus); binary operator <1>:         Numeric Types -- int float complex.\n(line   27)\n* + (plus); in argparse module:          nargs.              (line   69)\n* + (plus); in doctests:                 Option Flags.       (line  172)\n* + (plus); in printf-style formatting:  printf-style String Formatting.\n(line   66)\n* + (plus); in printf-style formatting <1>: printf-style Bytes Formatting.\n(line   63)\n* + (plus); in regular expressions:      Regular Expression Syntax.\n(line   74)\n* + (plus); in string formatting:        Format Specification Mini-Language.\n(line   71)\n* + (plus); unary operator:              Unary arithmetic and bitwise operations.\n(line   14)\n* + (plus); unary operator <1>:          Numeric Types -- int float complex.\n(line   27)\n* +?; in regular expressions:            Regular Expression Syntax.\n(line   85)\n* ++; in regular expressions:            Regular Expression Syntax.\n(line   95)\n* +=; augmented assignment:              Augmented assignment statements.\n(line    6)\n* < (less); in string formatting:        Format Specification Mini-Language.\n(line   42)\n* < (less); in struct format strings:    Byte Order Size and Alignment.\n(line   13)\n* <<=; augmented assignment:             Augmented assignment statements.\n(line    6)\n* <BLANKLINE>:                           Option Flags.       (line   30)\n* = (equals); assignment statement:      Assignment statements.\n(line    6)\n* = (equals); class definition:          Metaclasses.        (line    6)\n* = (equals); for help in debugging using string literals: String literal concatenation.\n(line   24)\n* = (equals); function definition:       Function definitions.\n(line   65)\n* = (equals); in function calls:         Slicings.           (line   38)\n* = (equals); in string formatting:      Format Specification Mini-Language.\n(line   42)\n* = (equals); in struct format strings:  Byte Order Size and Alignment.\n(line   13)\n* > (greater); in string formatting:     Format Specification Mini-Language.\n(line   42)\n* > (greater); in struct format strings: Byte Order Size and Alignment.\n(line   13)\n* >>=; augmented assignment:             Augmented assignment statements.\n(line    6)\n* >>>:                                   Glossary.           (line    6)\n* >>>; interpreter prompt:               How are Docstring Examples Recognized?.\n(line   26)\n* >>>; interpreter prompt <1>:           sys -- System-specific parameters and functions.\n(line 1421)\n* | (vertical bar); in regular expressions: Regular Expression Syntax.\n(line  219)\n* |=; augmented assignment:              Augmented assignment statements.\n(line    6)\n* ~ (tilde); home directory expansion:   os path -- Common pathname manipulations.\n(line  130)\n* $ (dollar); environment variables expansion: os path -- Common pathname manipulations.\n(line  154)\n* $ (dollar); in regular expressions:    Regular Expression Syntax.\n(line   57)\n* $ (dollar); in template strings:       Template strings.   (line   13)\n* $ (dollar); interpolation in configuration files: Interpolation of values.\n(line   41)\n* 0b; integer literal:                   Numeric literals.   (line   14)\n* 0o; integer literal:                   Numeric literals.   (line   14)\n* 0x; integer literal:                   Numeric literals.   (line   14)\n* 2-digit years:                         time -- Time access and conversions.\n(line   34)\n* 2to3:                                  Glossary.           (line   23)\n* A (in module re):                      Flags.              (line   16)\n* AALTCHARSET (in module curses):       Constants<6>.       (line   67)\n* AATTRIBUTES (in module curses):       Constants<6>.       (line  128)\n* ABLINK (in module curses):            Constants<6>.       (line   70)\n* ABOLD (in module curses):             Constants<6>.       (line   73)\n* ACHARTEXT (in module curses):         Constants<6>.       (line  131)\n* ACOLOR (in module curses):            Constants<6>.       (line  134)\n* ADIM (in module curses):              Constants<6>.       (line   76)\n* AHORIZONTAL (in module curses):       Constants<6>.       (line  101)\n* AINVIS (in module curses):            Constants<6>.       (line   79)\n* AITALIC (in module curses):           Constants<6>.       (line   82)\n* ALEFT (in module curses):             Constants<6>.       (line  104)\n* ALOW (in module curses):              Constants<6>.       (line  107)\n* ANORMAL (in module curses):           Constants<6>.       (line   85)\n* APROTECT (in module curses):          Constants<6>.       (line   88)\n* AREVERSE (in module curses):          Constants<6>.       (line   91)\n* ARIGHT (in module curses):            Constants<6>.       (line  110)\n* ASTANDOUT (in module curses):         Constants<6>.       (line   95)\n* ATOP (in module curses):              Constants<6>.       (line  113)\n* AUNDERLINE (in module curses):        Constants<6>.       (line   98)\n* AVERTICAL (in module curses):         Constants<6>.       (line  116)\n* A-LAW:                                 aifc -- Read and write AIFF and AIFC files.\n(line  163)\n* a-LAW:                                 audioop -- Manipulate raw audio data.\n(line   20)\n* A-LAW <1>:                             sndhdr -- Determine type of sound file.\n(line    8)\n* a2bbase64() (in module binascii):     binascii -- Convert between binary and ASCII.\n(line   40)\n* a2bhex() (in module binascii):        binascii -- Convert between binary and ASCII.\n(line  144)\n* a2bqp() (in module binascii):         binascii -- Convert between binary and ASCII.\n(line   70)\n* a2buu() (in module binascii):         binascii -- Convert between binary and ASCII.\n(line   25)\n* a85decode() (in module base64):        base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line  190)\n* a85encode() (in module base64):        base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line  167)\n* ABC (class in abc):                    abc -- Abstract Base Classes.\n(line   27)\n* ABCMeta (class in abc):                abc -- Abstract Base Classes.\n(line   52)\n* ABDAY1 (in module locale):            locale -- Internationalization services.\n(line  226)\n* ABDAY2 (in module locale):            locale -- Internationalization services.\n(line  226)\n* ABDAY3 (in module locale):            locale -- Internationalization services.\n(line  226)\n* ABDAY4 (in module locale):            locale -- Internationalization services.\n(line  226)\n* ABDAY5 (in module locale):            locale -- Internationalization services.\n(line  226)\n* ABDAY6 (in module locale):            locale -- Internationalization services.\n(line  226)\n* ABDAY7 (in module locale):            locale -- Internationalization services.\n(line  226)\n* abiflags (in module sys):              sys -- System-specific parameters and functions.\n(line   12)\n* ABMON1 (in module locale):            locale -- Internationalization services.\n(line  251)\n* ABMON10 (in module locale):           locale -- Internationalization services.\n(line  251)\n* ABMON11 (in module locale):           locale -- Internationalization services.\n(line  251)\n* ABMON12 (in module locale):           locale -- Internationalization services.\n(line  251)\n* ABMON2 (in module locale):            locale -- Internationalization services.\n(line  251)\n* ABMON3 (in module locale):            locale -- Internationalization services.\n(line  251)\n* ABMON4 (in module locale):            locale -- Internationalization services.\n(line  251)\n* ABMON5 (in module locale):            locale -- Internationalization services.\n(line  251)\n* ABMON6 (in module locale):            locale -- Internationalization services.\n(line  251)\n* ABMON7 (in module locale):            locale -- Internationalization services.\n(line  251)\n* ABMON8 (in module locale):            locale -- Internationalization services.\n(line  251)\n* ABMON9 (in module locale):            locale -- Internationalization services.\n(line  251)\n* abort (C function):                    Process Control.    (line    7)\n* ABORT (in module tkinter.messagebox):  tkinter messagebox -- Tkinter message prompts.\n(line  147)\n* abort() (asyncio.Barrier method):      Barrier.            (line   87)\n* abort() (asyncio.DatagramTransport method): Datagram Transports.\n(line   15)\n* abort() (asyncio.WriteTransport method): Write-only Transports.\n(line    6)\n* abort() (ftplib.FTP method):           FTP objects.        (line  152)\n* abort() (in module os):                Process Management. (line   16)\n* abort() (threading.Barrier method):    Barrier Objects.    (line   82)\n* ABORTRETRYIGNORE (in module tkinter.messagebox): tkinter messagebox -- Tkinter message prompts.\n(line  162)\n* ABOVENORMALPRIORITYCLASS (in module subprocess): Windows Constants.\n(line   52)\n* above() (curses.panel.Panel method):   Panel Objects.      (line   13)\n* abs() (decimal.Context method):        Context objects.    (line  249)\n* abs() (in module operator):            operator -- Standard operators as functions.\n(line   73)\n* absolute() (pathlib.Path method):      Methods<2>.         (line  490)\n* AbsoluteLinkError:                     tarfile -- Read and write tar archive files.\n(line  253)\n* AbsolutePathError:                     tarfile -- Read and write tar archive files.\n(line  239)\n* abspath() (in module os.path):         os path -- Common pathname manipulations.\n(line   49)\n* abstract base class:                   Glossary.           (line   32)\n* AbstractAsyncContextManager (class in contextlib): Utilities.\n(line   19)\n* AbstractBasicAuthHandler (class in urllib.request): urllib request -- Extensible library for opening URLs.\n(line  342)\n* AbstractChildWatcher (class in asyncio): Process Watchers. (line   43)\n* abstractclassmethod() (in module abc): abc -- Abstract Base Classes.\n(line  238)\n* AbstractContextManager (class in contextlib): Utilities.   (line    8)\n* AbstractDigestAuthHandler (class in urllib.request): urllib request -- Extensible library for opening URLs.\n(line  381)\n* AbstractEventLoop (class in asyncio):  Event Loop Implementations.\n(line   43)\n* AbstractEventLoopPolicy (class in asyncio): Policy Objects.\n(line    8)\n* abstractmethod() (in module abc):      abc -- Abstract Base Classes.\n(line  161)\n* abstractproperty() (in module abc):    abc -- Abstract Base Classes.\n(line  282)\n* AbstractSet (class in typing):         Aliases to container ABCs in collections abc.\n(line    6)\n* abstractstaticmethod() (in module abc): abc -- Abstract Base Classes.\n(line  260)\n* accept() (multiprocessing.connection.Listener method): Listeners and Clients.\n(line   84)\n* accept() (socket.socket method):       Socket Objects.     (line   13)\n* access() (in module os):               Files and Directories.\n(line   51)\n* accumulate() (in module itertools):    Itertool Functions. (line   10)\n* ACK (in module curses.ascii):          curses ascii -- Utilities for ASCII characters.\n(line   37)\n* aclose() (agen method):                Asynchronous generator-iterator methods.\n(line   61)\n* aclose() (contextlib.AsyncExitStack method): Utilities.    (line  650)\n* aclosing() (in module contextlib):     Utilities.          (line  188)\n* acos() (in module cmath):              Trigonometric functions<2>.\n(line    6)\n* acos() (in module math):               Trigonometric functions.\n(line    6)\n* acosh() (in module cmath):             Hyperbolic functions<2>.\n(line    6)\n* acosh() (in module math):              Hyperbolic functions.\n(line    9)\n* acquire() (thread.lock method):       thread -- Low-level threading API.\n(line  143)\n* acquire() (asyncio.Condition method):  Condition.          (line   47)\n* acquire() (asyncio.Lock method):       Lock.               (line   35)\n* acquire() (asyncio.Semaphore method):  Semaphore.          (line   42)\n* acquire() (logging.Handler method):    Handler Objects.    (line   26)\n* acquire() (multiprocessing.Lock method): Synchronization primitives.\n(line   64)\n* acquire() (multiprocessing.RLock method): Synchronization primitives.\n(line  118)\n* acquire() (threading.Condition method): Condition Objects. (line   85)\n* acquire() (threading.Lock method):     Lock Objects.       (line   43)\n* acquire() (threading.RLock method):    RLock Objects.      (line   35)\n* acquire() (threading.Semaphore method): Semaphore Objects. (line   34)\n* ACSBBSS (in module curses):           Constants<6>.       (line  472)\n* ACSBLOCK (in module curses):          Constants<6>.       (line  475)\n* ACSBOARD (in module curses):          Constants<6>.       (line  478)\n* ACSBSBS (in module curses):           Constants<6>.       (line  481)\n* ACSBSSB (in module curses):           Constants<6>.       (line  484)\n* ACSBSSS (in module curses):           Constants<6>.       (line  487)\n* ACSBTEE (in module curses):           Constants<6>.       (line  490)\n* ACSBULLET (in module curses):         Constants<6>.       (line  493)\n* ACSCKBOARD (in module curses):        Constants<6>.       (line  496)\n* ACSDARROW (in module curses):         Constants<6>.       (line  499)\n* ACSDEGREE (in module curses):         Constants<6>.       (line  502)\n* ACSDIAMOND (in module curses):        Constants<6>.       (line  505)\n* ACSGEQUAL (in module curses):         Constants<6>.       (line  508)\n* ACSHLINE (in module curses):          Constants<6>.       (line  511)\n* ACSLANTERN (in module curses):        Constants<6>.       (line  514)\n* ACSLARROW (in module curses):         Constants<6>.       (line  517)\n* ACSLEQUAL (in module curses):         Constants<6>.       (line  520)\n* ACSLLCORNER (in module curses):       Constants<6>.       (line  523)\n* ACSLRCORNER (in module curses):       Constants<6>.       (line  526)\n* ACSLTEE (in module curses):           Constants<6>.       (line  529)\n* ACSNEQUAL (in module curses):         Constants<6>.       (line  532)\n* ACSPI (in module curses):             Constants<6>.       (line  535)\n* ACSPLMINUS (in module curses):        Constants<6>.       (line  538)\n* ACSPLUS (in module curses):           Constants<6>.       (line  541)\n* ACSRARROW (in module curses):         Constants<6>.       (line  544)\n* ACSRTEE (in module curses):           Constants<6>.       (line  547)\n* ACSS1 (in module curses):             Constants<6>.       (line  550)\n* ACSS3 (in module curses):             Constants<6>.       (line  553)\n* ACSS7 (in module curses):             Constants<6>.       (line  556)\n* ACSS9 (in module curses):             Constants<6>.       (line  559)\n* ACSSBBS (in module curses):           Constants<6>.       (line  562)\n* ACSSBSB (in module curses):           Constants<6>.       (line  565)\n* ACSSBSS (in module curses):           Constants<6>.       (line  568)\n* ACSSSBB (in module curses):           Constants<6>.       (line  571)\n* ACSSSBS (in module curses):           Constants<6>.       (line  574)\n* ACSSSSB (in module curses):           Constants<6>.       (line  577)\n* ACSSSSS (in module curses):           Constants<6>.       (line  580)\n* ACSSTERLING (in module curses):       Constants<6>.       (line  583)\n* ACSTTEE (in module curses):           Constants<6>.       (line  586)\n* ACSUARROW (in module curses):         Constants<6>.       (line  589)\n* ACSULCORNER (in module curses):       Constants<6>.       (line  592)\n* ACSURCORNER (in module curses):       Constants<6>.       (line  595)\n* ACSVLINE (in module curses):          Constants<6>.       (line  598)\n* Action (class in argparse):            Action classes.     (line   11)\n* action (optparse.Option attribute):    Option attributes.  (line   19)\n* ACTIONS (optparse.Option attribute):   Adding new actions. (line   31)\n* activatestacktrampoline() (in module sys): sys -- System-specific parameters and functions.\n(line 1691)\n* activechildren() (in module multiprocessing): Miscellaneous<3>.\n(line    6)\n* activecount() (in module threading):  threading -- Thread-based parallelism.\n(line   54)\n* actual() (tkinter.font.Font method):   tkinter font -- Tkinter font wrapper.\n(line   47)\n* Add (class in ast):                    Expressions<2>.     (line   54)\n* addalias() (in module email.charset): email charset Representing character sets.\n(line  193)\n* addalternative() (email.message.EmailMessage method): email message Representing an email message.\n(line  640)\n* addargumentgroup() (argparse.ArgumentParser method): Argument groups.\n(line    6)\n* addargument() (argparse.ArgumentParser method): The addargument method.\n(line    6)\n* addattachment() (email.message.EmailMessage method): email message Representing an email message.\n(line  652)\n* addcgivars() (wsgiref.handlers.BaseHandler method): wsgiref handlers - server/gateway base classes.\n(line  135)\n* addcharset() (in module email.charset): email charset Representing character sets.\n(line  164)\n* addchildhandler() (asyncio.AbstractChildWatcher method): Process Watchers.\n(line   45)\n* addcodec() (in module email.charset): email charset Representing character sets.\n(line  202)\n* addcookieheader() (http.cookiejar.CookieJar method): CookieJar and FileCookieJar Objects.\n(line   11)\n* adddata() (in module msilib):         msilib -- Read and write Microsoft Installer files.\n(line   76)\n* adddlldirectory() (in module os):    Process Management. (line   24)\n* adddonecallback() (asyncio.Future method): Future Object.\n(line   81)\n* adddonecallback() (asyncio.Task method): Task Object.    (line  101)\n* adddonecallback() (concurrent.futures.Future method): Future Objects.\n(line   66)\n* addfallback() (gettext.NullTranslations method): The NullTranslations class.\n(line   28)\n* addfile() (msilib.Directory method):  Directory Objects.  (line   30)\n* addflag() (mailbox.MaildirMessage method): MaildirMessage objects.\n(line   76)\n* addflag() (mailbox.mboxMessage method): mboxMessage objects.\n(line   79)\n* addflag() (mailbox.MMDFMessage method): MMDFMessage objects.\n(line   78)\n* addfolder() (mailbox.Maildir method): Maildir objects.    (line   72)\n* addfolder() (mailbox.MH method):      MH objects.         (line   42)\n* addgethandler() (email.contentmanager.ContentManager method): email contentmanager Managing MIME Content.\n(line   75)\n* addhandler() (urllib.request.OpenerDirector method): OpenerDirector Objects.\n(line    8)\n* addheader() (email.message.EmailMessage method): email message Representing an email message.\n(line  260)\n* addheader() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  367)\n* addheader() (urllib.request.Request method): Request Objects.\n(line   79)\n* addheader() (wsgiref.headers.Headers method): wsgiref headers - WSGI response header tools.\n(line   61)\n* addhistory() (in module readline):    History list.       (line   38)\n* addlabel() (mailbox.BabylMessage method): BabylMessage objects.\n(line   55)\n* addmutuallyexclusivegroup() (argparse.ArgumentParser method): Mutual exclusion.\n(line    6)\n* addnote() (BaseException method):     Base classes.       (line   50)\n* addoption() (optparse.OptionParser method): Defining options.\n(line   14)\n* addparent() (urllib.request.BaseHandler method): BaseHandler Objects.\n(line   10)\n* addpassword() (urllib.request.HTTPPasswordMgr method): HTTPPasswordMgr Objects.\n(line    9)\n* addpassword() (urllib.request.HTTPPasswordMgrWithPriorAuth method): HTTPPasswordMgrWithPriorAuth Objects.\n(line   10)\n* addreader() (asyncio.loop method):    Watching file descriptors.\n(line    6)\n* addrelated() (email.message.EmailMessage method): email message Representing an email message.\n(line  627)\n* addsection() (configparser.ConfigParser method): ConfigParser Objects.\n(line   88)\n* addsection() (configparser.RawConfigParser method): RawConfigParser Objects.\n(line   26)\n* addsequence() (mailbox.MHMessage method): MHMessage objects.\n(line   41)\n* addsethandler() (email.contentmanager.ContentManager method): email contentmanager Managing MIME Content.\n(line   80)\n* addsignalhandler() (asyncio.loop method): Unix signals.  (line    6)\n* addstream() (in module msilib):       msilib -- Read and write Microsoft Installer files.\n(line  106)\n* addsubparsers() (argparse.ArgumentParser method): Sub-commands.\n(line    6)\n* addtables() (in module msilib):       msilib -- Read and write Microsoft Installer files.\n(line   97)\n* addtype() (in module mimetypes):      mimetypes -- Map filenames to MIME types.\n(line  107)\n* addunredirectedheader() (urllib.request.Request method): Request Objects.\n(line   91)\n* addwriter() (asyncio.loop method):    Watching file descriptors.\n(line   17)\n* add() (decimal.Context method):        Context objects.    (line  253)\n* add() (frozenset method):              Set Types -- set frozenset.\n(line  195)\n* add() (graphlib.TopologicalSorter method): graphlib -- Functionality to operate with graph-like structures.\n(line   81)\n* add() (in module audioop):             audioop -- Manipulate raw audio data.\n(line   34)\n* add() (in module operator):            operator -- Standard operators as functions.\n(line   78)\n* add() (mailbox.Mailbox method):        Mailbox objects.    (line   59)\n* add() (mailbox.Maildir method):        Maildir objects.    (line   92)\n* add() (msilib.RadioButtonGroup method): GUI classes.       (line   32)\n* add() (pstats.Stats method):           The Stats Class.    (line   49)\n* add() (tarfile.TarFile method):        TarFile Objects.    (line  263)\n* add() (tkinter.ttk.Notebook method):   ttk Notebook.       (line    8)\n* addAsyncCleanup() (unittest.IsolatedAsyncioTestCase method): Test cases.\n(line  883)\n* addaudithook() (in module sys):        sys -- System-specific parameters and functions.\n(line   25)\n* addch() (curses.window method):        Window Objects.     (line    9)\n* addClassCleanup() (unittest.TestCase class method): Test cases.\n(line  810)\n* addCleanup() (unittest.TestCase method): Test cases.       (line  770)\n* addcomponent() (turtle.Shape method):  Public classes.     (line   66)\n* addDuration() (unittest.TestResult method): Loading and running tests.\n(line  433)\n* addError() (unittest.TestResult method): Loading and running tests.\n(line  363)\n* addExpectedFailure() (unittest.TestResult method): Loading and running tests.\n(line  399)\n* addFailure() (unittest.TestResult method): Loading and running tests.\n(line  374)\n* addfile() (tarfile.TarFile method):    TarFile Objects.    (line  281)\n* addFilter() (logging.Handler method):  Handler Objects.    (line   52)\n* addFilter() (logging.Logger method):   Logger Objects.     (line  324)\n* addHandler() (logging.Logger method):  Logger Objects.     (line  341)\n* addinfourl (class in urllib.response): urllib response -- Response classes used by urllib.\n(line   12)\n* addition:                              Binary arithmetic operations.\n(line   69)\n* addLevelName() (in module logging):    Module-Level Functions.\n(line  126)\n* addModuleCleanup() (in module unittest): setUpModule and tearDownModule.\n(line   22)\n* addnstr() (curses.window method):      Window Objects.     (line   23)\n* AddPackagePath() (in module modulefinder): modulefinder -- Find modules used by a script.\n(line   16)\n* addrspec (email.headerregistry.Address attribute): email headerregistry Custom Header Objects.\n(line  440)\n* Address (class in email.headerregistry): email headerregistry Custom Header Objects.\n(line  402)\n* address (email.headerregistry.SingleAddressHeader attribute): email headerregistry Custom Header Objects.\n(line  222)\n* address (multiprocessing.connection.Listener attribute): Listeners and Clients.\n(line   99)\n* address (multiprocessing.managers.BaseManager attribute): Managers.\n(line  137)\n* addressexclude() (ipaddress.IPv4Network method): Network objects.\n(line  160)\n* addressexclude() (ipaddress.IPv6Network method): Network objects.\n(line  342)\n* addressfamily (socketserver.BaseServer attribute): Server Objects<2>.\n(line   65)\n* addressstring() (http.server.BaseHTTPRequestHandler method): http server -- HTTP servers.\n(line  334)\n* addresses (email.headerregistry.AddressHeader attribute): email headerregistry Custom Header Objects.\n(line  195)\n* addresses (email.headerregistry.Group attribute): email headerregistry Custom Header Objects.\n(line  476)\n* AddressHeader (class in email.headerregistry): email headerregistry Custom Header Objects.\n(line  180)\n* addressof() (in module ctypes):        Utility functions.  (line    6)\n* AddressValueError:                     Custom Exceptions.  (line    9)\n* addshape() (in module turtle):         Settings and special methods.\n(line   71)\n* addsitedir() (in module site):         Module contents<5>. (line   51)\n* addSkip() (unittest.TestResult method): Loading and running tests.\n(line  391)\n* addstr() (curses.window method):       Window Objects.     (line   31)\n* addSubTest() (unittest.TestResult method): Loading and running tests.\n(line  417)\n* addSuccess() (unittest.TestResult method): Loading and running tests.\n(line  385)\n* addTest() (unittest.TestSuite method): Grouping tests.     (line   25)\n* addTests() (unittest.TestSuite method): Grouping tests.    (line   30)\n* addTypeEqualityFunc() (unittest.TestCase method): Test cases.\n(line  587)\n* addUnexpectedSuccess() (unittest.TestResult method): Loading and running tests.\n(line  409)\n* adjustintmaxstrdigits() (in module test.support): test support -- Utilities for the Python test suite.\n(line  733)\n* adjusted() (decimal.Decimal method):   Decimal objects.    (line  114)\n* adler32() (in module zlib):            zlib -- Compression compatible with gzip.\n(line   28)\n* ADPCM, Intel/DVI:                      audioop -- Manipulate raw audio data.\n(line   20)\n* adpcm2lin() (in module audioop):       audioop -- Manipulate raw audio data.\n(line   41)\n* AFALG (in module socket):             Constants<8>.       (line  255)\n* AFCAN (in module socket):             Constants<8>.       (line  121)\n* AFDIVERT (in module socket):          Constants<8>.       (line  194)\n* AFHYPERV (in module socket):          Constants<8>.       (line  337)\n* AFINET (in module socket):            Constants<8>.       (line   11)\n* AFINET6 (in module socket):           Constants<8>.       (line   11)\n* AFLINK (in module socket):            Constants<8>.       (line  279)\n* AFPACKET (in module socket):          Constants<8>.       (line  204)\n* AFQIPCRTR (in module socket):         Constants<8>.       (line  307)\n* AFRDS (in module socket):             Constants<8>.       (line  226)\n* AFUNIX (in module socket):            Constants<8>.       (line   11)\n* AFUNSPEC (in module socket):          Constants<8>.       (line   21)\n* AFVSOCK (in module socket):           Constants<8>.       (line  266)\n* aifc() (aifc.aifc method):             aifc -- Read and write AIFF and AIFC files.\n(line  137)\n* AIFF:                                  aifc -- Read and write AIFF and AIFC files.\n(line    8)\n* AIFF <1>:                              chunk -- Read IFF chunked data.\n(line    8)\n* AIFF-C:                                aifc -- Read and write AIFF and AIFC files.\n(line    8)\n* AIFF-C <1>:                            chunk -- Read IFF chunked data.\n(line    8)\n* aiff() (aifc.aifc method):             aifc -- Read and write AIFF and AIFC files.\n(line  131)\n* alarm() (in module signal):            Module contents<2>. (line  269)\n* alaw2lin() (in module audioop):        audioop -- Manipulate raw audio data.\n(line   48)\n* ALERTDESCRIPTIONHANDSHAKEFAILURE (in module ssl): Constants<9>.\n(line  503)\n* ALERTDESCRIPTIONINTERNALERROR (in module ssl): Constants<9>.\n(line  503)\n* AlertDescription (class in ssl):       Constants<9>.       (line  517)\n* algorithm (sys.hashinfo attribute):   sys -- System-specific parameters and functions.\n(line 1014)\n* algorithmsavailable (in module hashlib): Attributes.      (line   17)\n* algorithmsguaranteed (in module hashlib): Attributes.     (line    8)\n* alias (class in ast):                  Imports.            (line   40)\n* alias (pdb command):                   Debugger Commands.  (line  350)\n* alignment() (in module ctypes):        Utility functions.  (line   14)\n* alive (weakref.finalize attribute):    weakref -- Weak references.\n(line  312)\n* ALLCOMPLETED (in module asyncio):     Waiting Primitives. (line   45)\n* ALLCOMPLETED (in module concurrent.futures): Module Functions.\n(line   40)\n* allerrors (in module ftplib):         Module variables.   (line   27)\n* allfeatures (in module xml.sax.handler): xml sax handler -- Base classes for SAX handlers.\n(line   95)\n* allframes (tracemalloc.Filter attribute): Filter.         (line   58)\n* allproperties (in module xml.sax.handler): xml sax handler -- Base classes for SAX handlers.\n(line  127)\n* allsuffixes() (in module importlib.machinery): importlib machinery - Importers and path hooks.\n(line   57)\n* alltasks() (in module asyncio):       Introspection.      (line   16)\n* allocatelock() (in module thread):   thread -- Low-level threading API.\n(line   83)\n* allocfunc (C type):                    Slot Type typedefs. (line    6)\n* ALLOWMISSING (in module os.path):     os path -- Common pathname manipulations.\n(line  373)\n* allowreuseaddress (socketserver.BaseServer attribute): Server Objects<2>.\n(line   92)\n* alloweddomains() (http.cookiejar.DefaultCookiePolicy method): DefaultCookiePolicy Objects.\n(line   65)\n* ALTDIGITS (in module locale):         locale -- Internationalization services.\n(line  331)\n* alt() (in module curses.ascii):        curses ascii -- Utilities for ASCII characters.\n(line  221)\n* altsep (in module os):                 Miscellaneous System Information.\n(line  105)\n* altzone (in module time):              Timezone Constants. (line    6)\n* ALWAYSEQ (in module test.support):    test support -- Utilities for the Python test suite.\n(line  175)\n* ALWAYSTYPEDACTIONS (optparse.Option attribute): Adding new actions.\n(line   43)\n* AmbiguousOptionError:                  Exceptions<19>.     (line   25)\n* AMPER (in module token):               token -- Constants used with Python parse trees.\n(line  102)\n* AMPEREQUAL (in module token):          token -- Constants used with Python parse trees.\n(line  190)\n* Anchor (class in importlib.resources): importlib resources - Package resource reading opening and access.\n(line   45)\n* anchor (pathlib.PurePath attribute):   Methods and properties.\n(line   58)\n* And (class in ast):                    Expressions<2>.     (line   87)\n* and() (in module operator):           operator -- Standard operators as functions.\n(line   83)\n* AnnAssign (class in ast):              Statements.         (line   43)\n* Annotated (in module typing):          Special forms.      (line  228)\n* annotated; assignment:                 Annotated assignment statements.\n(line    6)\n* annotation:                            Glossary.           (line   47)\n* annotation (inspect.Parameter attribute): Introspecting callables with the Signature object.\n(line  207)\n* annotation; type annotation; type hint: Type Annotation Types -- Generic Alias Union.\n(line    6)\n* anonymous; function:                   Lambdas.            (line    6)\n* answerchallenge() (in module multiprocessing.connection): Listeners and Clients.\n(line   25)\n* anticipatefailure() (in module test.support): test support -- Utilities for the Python test suite.\n(line  451)\n* Any (in module typing):                Special types.      (line    9)\n* ANY (in module unittest.mock):         ANY.                (line    6)\n* ANYCONTIGUOUS (inspect.BufferFlags attribute): Buffer flags.\n(line   29)\n* AnyStr (in module typing):             Special types.      (line   21)\n* apiversion (in module sys):           sys -- System-specific parameters and functions.\n(line 1952)\n* apilevel (in module sqlite3):          Module constants.   (line   60)\n* apop() (poplib.POP3 method):           POP3 Objects.       (line   42)\n* APPDATA:                               PEP 370 Per-user site-packages Directory.\n(line   26)\n* appendhistoryfile() (in module readline): History file.  (line   20)\n* append() (array.array method):         array -- Efficient arrays of numeric values.\n(line  114)\n* append() (collections.deque method):   deque objects.      (line   35)\n* append() (email.header.Header method): email header Internationalized headers.\n(line   96)\n* append() (imaplib.IMAP4 method):       IMAP4 Objects.      (line   33)\n* append() (msilib.CAB method):          CAB Objects.        (line   15)\n* append() (pipes.Template method):      Template Objects.   (line   22)\n* append() (sequence method):            Mutable Sequence Types.\n(line   16)\n* append() (xml.etree.ElementTree.Element method): Element Objects.\n(line   87)\n* appendChild() (xml.dom.Node method):   Node Objects.       (line  115)\n* appendleft() (collections.deque method): deque objects.    (line   39)\n* applicationuri() (in module wsgiref.util): wsgiref util - WSGI environment utilities.\n(line   34)\n* apply (2to3 fixer):                    Fixers.             (line   10)\n* applyasync() (multiprocessing.pool.Pool method): Process Pools.\n(line   71)\n* applydefaults() (inspect.BoundArguments method): Introspecting callables with the Signature object.\n(line  348)\n* apply() (multiprocessing.pool.Pool method): Process Pools. (line   63)\n* APRIL (in module calendar):            calendar -- General calendar-related functions.\n(line  414)\n* architecture() (in module platform):   Cross Platform.     (line    6)\n* archive (zipimport.zipimporter attribute): zipimporter Objects.\n(line   96)\n* AREGTYPE (in module tarfile):          tarfile -- Read and write tar archive files.\n(line  278)\n* aRepr (in module reprlib):             reprlib -- Alternate repr implementation.\n(line   44)\n* arg (class in ast):                    Function and class definitions.\n(line   73)\n* args (BaseException attribute):        Base classes.       (line   17)\n* args (functools.partial attribute):    partial Objects.    (line   15)\n* args (inspect.BoundArguments attribute): Introspecting callables with the Signature object.\n(line  334)\n* args (pdb command):                    Debugger Commands.  (line  253)\n* args (subprocess.CompletedProcess attribute): Using the subprocess Module.\n(line  105)\n* args (subprocess.Popen attribute):     Popen Objects.      (line  101)\n* args (typing.ParamSpec attribute):     Building generic types and type aliases.\n(line  369)\n* argsfrominterpreterflags() (in module test.support): test support -- Utilities for the Python test suite.\n(line  318)\n* argtypes (ctypes.FuncPtr attribute):  Foreign functions.  (line   36)\n* argument:                              Glossary.           (line   63)\n* argument; call semantics:              Slicings.           (line   39)\n* argument; difference from parameter:   How can I pass optional or keyword parameters from one function to another?.\n(line   17)\n* argument; function definition:         Function definitions.\n(line   65)\n* ArgumentDefaultsHelpFormatter (class in argparse): formatterclass.\n(line   10)\n* ArgumentError:                         Exceptions<8>.      (line    6)\n* ArgumentError <1>:                     Foreign functions.  (line   84)\n* ArgumentParser (class in argparse):    ArgumentParser objects.\n(line    6)\n* arguments (class in ast):              Function and class definitions.\n(line   54)\n* arguments (inspect.BoundArguments attribute): Introspecting callables with the Signature object.\n(line  315)\n* ArgumentTypeError:                     Exceptions<8>.      (line   14)\n* argv (in module sys):                  sys -- System-specific parameters and functions.\n(line   69)\n* argv (in module sys) <1>:              Process-wide parameters.\n(line  271)\n* arithmetic:                            Numeric Types -- int float complex.\n(line   27)\n* arithmetic; conversion:                Arithmetic conversions.\n(line    6)\n* ArithmeticError:                       Base classes.       (line   72)\n* array (class in array):                array -- Efficient arrays of numeric values.\n(line   81)\n* Array (class in ctypes):               Arrays and pointers.\n(line    6)\n* Array() (in module multiprocessing.sharedctypes): The multiprocessing sharedctypes module.\n(line   51)\n* Array() (in module multiprocessing):   Shared ctypes Objects.\n(line   42)\n* Array() (multiprocessing.managers.SyncManager method): Managers.\n(line  213)\n* arrays:                                array -- Efficient arrays of numeric values.\n(line    6)\n* arraysize (sqlite3.Cursor attribute):  Cursor objects.     (line  170)\n* article() (nntplib.NNTP method):       Methods<3>.         (line  241)\n* AS pattern, OR pattern, capture pattern, wildcard pattern: Patterns.\n(line    6)\n* asbytes() (email.message.EmailMessage method): email message Representing an email message.\n(line  107)\n* asbytes() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  106)\n* ascompleted() (in module asyncio):    Waiting Primitives. (line   60)\n* ascompleted() (in module concurrent.futures): Module Functions.\n(line   44)\n* asfile() (in module importlib.resources): importlib resources - Package resource reading opening and access.\n(line   73)\n* asintegerratio() (decimal.Decimal method): Decimal objects.\n(line  122)\n* asintegerratio() (float method):     Additional Methods on Float.\n(line    9)\n* asintegerratio() (fractions.Fraction method): fractions -- Rational numbers.\n(line  118)\n* asintegerratio() (int method):       Additional Methods on Integer Types.\n(line  162)\n* asposix() (pathlib.PurePath method):  Methods and properties.\n(line  163)\n* asstring() (email.message.EmailMessage method): email message Representing an email message.\n(line   61)\n* asstring() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line   60)\n* astuple() (decimal.Decimal method):   Decimal objects.    (line  136)\n* asuri() (pathlib.PurePath method):    Methods and properties.\n(line  174)\n* as; except clause:                     except clause.      (line   30)\n* as; import statement:                  The import statement.\n(line   39)\n* as; match statement:                   The match statement.\n(line    6)\n* as; with statement:                    The with statement. (line    6)\n* ASCII:                                 Notation.           (line   32)\n* ASCII <1>:                             Literals.           (line    8)\n* ASCII (in module re):                  Flags.              (line   16)\n* asciiletters (in module string):      String constants.   (line    8)\n* asciilowercase (in module string):    String constants.   (line   14)\n* asciiuppercase (in module string):    String constants.   (line   19)\n* ascii() (in module curses.ascii):      curses ascii -- Utilities for ASCII characters.\n(line  212)\n* asctime() (in module time):            Functions<5>.       (line    6)\n* asdict() (in module dataclasses):      Module contents<4>. (line  315)\n* asend() (agen method):                 Asynchronous generator-iterator methods.\n(line   28)\n* asin() (in module cmath):              Trigonometric functions<2>.\n(line   12)\n* asin() (in module math):               Trigonometric functions.\n(line   11)\n* asinh() (in module cmath):             Hyperbolic functions<2>.\n(line   11)\n* asinh() (in module math):              Hyperbolic functions.\n(line   13)\n* askcolor() (in module tkinter.colorchooser): tkinter colorchooser -- Color choosing dialog.\n(line   17)\n* askdirectory() (in module tkinter.filedialog): Native Load/Save Dialogs.\n(line   54)\n* askfloat() (in module tkinter.simpledialog): tkinter simpledialog -- Standard Tkinter input dialogs.\n(line   14)\n* askinteger() (in module tkinter.simpledialog): tkinter simpledialog -- Standard Tkinter input dialogs.\n(line   14)\n* askokcancel() (in module tkinter.messagebox): tkinter messagebox -- Tkinter message prompts.\n(line  119)\n* askopenfile() (in module tkinter.filedialog): Native Load/Save Dialogs.\n(line   31)\n* askopenfilename() (in module tkinter.filedialog): Native Load/Save Dialogs.\n(line   42)\n* askopenfilenames() (in module tkinter.filedialog): Native Load/Save Dialogs.\n(line   42)\n* askopenfiles() (in module tkinter.filedialog): Native Load/Save Dialogs.\n(line   31)\n* askquestion() (in module tkinter.messagebox): tkinter messagebox -- Tkinter message prompts.\n(line  113)\n* askretrycancel() (in module tkinter.messagebox): tkinter messagebox -- Tkinter message prompts.\n(line  126)\n* asksaveasfile() (in module tkinter.filedialog): Native Load/Save Dialogs.\n(line   37)\n* asksaveasfilename() (in module tkinter.filedialog): Native Load/Save Dialogs.\n(line   49)\n* askstring() (in module tkinter.simpledialog): tkinter simpledialog -- Standard Tkinter input dialogs.\n(line   14)\n* askyesno() (in module tkinter.messagebox): tkinter messagebox -- Tkinter message prompts.\n(line  133)\n* askyesnocancel() (in module tkinter.messagebox): tkinter messagebox -- Tkinter message prompts.\n(line  139)\n* Assert (class in ast):                 Statements.         (line  130)\n* assertanyawait() (unittest.mock.AsyncMock method): The Mock Class.\n(line  810)\n* assertanycall() (unittest.mock.Mock method): The Mock Class.\n(line  148)\n* assertawaitedoncewith() (unittest.mock.AsyncMock method): The Mock Class.\n(line  793)\n* assertawaitedonce() (unittest.mock.AsyncMock method): The Mock Class.\n(line  760)\n* assertawaitedwith() (unittest.mock.AsyncMock method): The Mock Class.\n(line  776)\n* assertawaited() (unittest.mock.AsyncMock method): The Mock Class.\n(line  740)\n* assertcalledoncewith() (unittest.mock.Mock method): The Mock Class.\n(line  134)\n* assertcalledonce() (unittest.mock.Mock method): The Mock Class.\n(line  107)\n* assertcalledwith() (unittest.mock.Mock method): The Mock Class.\n(line  124)\n* assertcalled() (unittest.mock.Mock method): The Mock Class.\n(line   96)\n* asserthasawaits() (unittest.mock.AsyncMock method): The Mock Class.\n(line  827)\n* asserthascalls() (unittest.mock.Mock method): The Mock Class.\n(line  164)\n* assertnever() (in module typing):     Functions and decorators.\n(line   44)\n* assertnotawaited() (unittest.mock.AsyncMock method): The Mock Class.\n(line  854)\n* assertnotcalled() (unittest.mock.Mock method): The Mock Class.\n(line  185)\n* assertpythonfailure() (in module test.support.scripthelper): test support scripthelper -- Utilities for the Python execution tests.\n(line   57)\n* assertpythonok() (in module test.support.scripthelper): test support scripthelper -- Utilities for the Python execution tests.\n(line   40)\n* asserttype() (in module typing):      Functions and decorators.\n(line   15)\n* assertAlmostEqual() (unittest.TestCase method): Test cases.\n(line  510)\n* assertCountEqual() (unittest.TestCase method): Test cases. (line  566)\n* assertDictEqual() (unittest.TestCase method): Test cases.  (line  675)\n* assertEqual() (unittest.TestCase method): Test cases.      (line  177)\n* assertFalse() (unittest.TestCase method): Test cases.      (line  202)\n* assertGreater() (unittest.TestCase method): Test cases.    (line  535)\n* assertGreaterEqual() (unittest.TestCase method): Test cases.\n(line  535)\n* assertIn() (unittest.TestCase method): Test cases.         (line  229)\n* assertInBytecode() (test.support.bytecodehelper.BytecodeTestCase method): test support bytecodehelper -- Support tools for testing correct bytecode generation.\n(line   22)\n* AssertionError:                        Concrete exceptions.\n(line    8)\n* assertIs() (unittest.TestCase method): Test cases.         (line  214)\n* assertIsInstance() (unittest.TestCase method): Test cases. (line  236)\n* assertIsNone() (unittest.TestCase method): Test cases.     (line  222)\n* assertIsNot() (unittest.TestCase method): Test cases.      (line  214)\n* assertIsNotNone() (unittest.TestCase method): Test cases.  (line  222)\n* assertLess() (unittest.TestCase method): Test cases.       (line  535)\n* assertLessEqual() (unittest.TestCase method): Test cases.  (line  535)\n* assertListEqual() (unittest.TestCase method): Test cases.  (line  652)\n* assertLogs() (unittest.TestCase method): Test cases.       (line  410)\n* assertMultiLineEqual() (unittest.TestCase method): Test cases.\n(line  627)\n* assertNoLogs() (unittest.TestCase method): Test cases.     (line  454)\n* assertNotAlmostEqual() (unittest.TestCase method): Test cases.\n(line  510)\n* assertNotEqual() (unittest.TestCase method): Test cases.   (line  197)\n* assertNotIn() (unittest.TestCase method): Test cases.      (line  229)\n* assertNotInBytecode() (test.support.bytecodehelper.BytecodeTestCase method): test support bytecodehelper -- Support tools for testing correct bytecode generation.\n(line   28)\n* assertNotIsInstance() (unittest.TestCase method): Test cases.\n(line  236)\n* assertNotRegex() (unittest.TestCase method): Test cases.   (line  548)\n* assertRaises() (unittest.TestCase method): Test cases.     (line  276)\n* assertRaisesRegex() (unittest.TestCase method): Test cases.\n(line  317)\n* assertRegex() (unittest.TestCase method): Test cases.      (line  548)\n* asserts (2to3 fixer):                  Fixers.             (line   15)\n* assertSequenceEqual() (unittest.TestCase method): Test cases.\n(line  637)\n* assertSetEqual() (unittest.TestCase method): Test cases.   (line  663)\n* assertTrue() (unittest.TestCase method): Test cases.       (line  202)\n* assertTupleEqual() (unittest.TestCase method): Test cases. (line  652)\n* assertWarns() (unittest.TestCase method): Test cases.      (line  344)\n* assertWarnsRegex() (unittest.TestCase method): Test cases. (line  385)\n* Assign (class in ast):                 Statements.         (line    6)\n* assignment expression:                 Boolean operations. (line   38)\n* assignment; statement:                 Mutable sequences.  (line    6)\n* assignment; statement <1>:             Assignment statements.\n(line    6)\n* AST (class in ast):                    Node classes.       (line    6)\n* ast command line option; -a:           Command-Line Usage<4>.\n(line   29)\n* ast command line option; -h:           Command-Line Usage<4>.\n(line   15)\n* ast command line option; -help:        Command-Line Usage<4>.\n(line   15)\n* ast command line option; -i:           Command-Line Usage<4>.\n(line   33)\n* ast command line option; -include-attributes: Command-Line Usage<4>.\n(line   29)\n* ast command line option; -indent:      Command-Line Usage<4>.\n(line   33)\n* ast command line option; -m:           Command-Line Usage<4>.\n(line   19)\n* ast command line option; -mode:        Command-Line Usage<4>.\n(line   19)\n* ast command line option; -no-type-comments: Command-Line Usage<4>.\n(line   25)\n* astimezone() (datetime.datetime method): datetime Objects. (line  454)\n* astuple() (in module dataclasses):     Module contents<4>. (line  347)\n* ASYNC (in module token):               token -- Constants used with Python parse trees.\n(line  250)\n* async for; in comprehensions:          Displays for lists sets and dictionaries.\n(line   14)\n* AsyncContextDecorator (class in contextlib): Utilities.    (line  462)\n* AsyncContextManager (class in typing): Aliases to contextlib ABCs.\n(line   16)\n* asynccontextmanager() (in module contextlib): Utilities.   (line   94)\n* AsyncExitStack (class in contextlib):  Utilities.          (line  621)\n* AsyncFor (class in ast):               Async and await.    (line   44)\n* AsyncFunctionDef (class in ast):       Async and await.    (line    6)\n* AsyncGenerator (class in collections.abc): Collections Abstract Base Classes - Detailed Descriptions.\n(line  153)\n* AsyncGenerator (class in typing):      Aliases to asynchronous ABCs in collections abc.\n(line   26)\n* AsyncGeneratorType (in module types):  Standard Interpreter Types.\n(line   49)\n* asynchronous context manager:          Glossary.           (line   96)\n* asynchronous generator:                Glossary.           (line  102)\n* asynchronous generator iterator:       Glossary.           (line  119)\n* asynchronous generator; asynchronous iterator: Asynchronous generator functions.\n(line    6)\n* asynchronous generator; function:      Asynchronous generator functions.\n(line    6)\n* asynchronous iterable:                 Glossary.           (line  136)\n* asynchronous iterator:                 Glossary.           (line  142)\n* asyncio.subprocess.DEVNULL (built-in variable): Constants<7>.\n(line   23)\n* asyncio.subprocess.PIPE (built-in variable): Constants<7>. (line    6)\n* asyncio.subprocess.Process (built-in class): Interacting with Subprocesses.\n(line   11)\n* asyncio.subprocess.STDOUT (built-in variable): Constants<7>.\n(line   17)\n* AsyncIterable (class in collections.abc): Collections Abstract Base Classes - Detailed Descriptions.\n(line  139)\n* AsyncIterable (class in typing):       Aliases to asynchronous ABCs in collections abc.\n(line   66)\n* AsyncIterator (class in collections.abc): Collections Abstract Base Classes - Detailed Descriptions.\n(line  146)\n* AsyncIterator (class in typing):       Aliases to asynchronous ABCs in collections abc.\n(line   76)\n* AsyncMock (class in unittest.mock):    The Mock Class.     (line  668)\n* AsyncResult (class in multiprocessing.pool): Process Pools.\n(line  191)\n* asyncSetUp() (unittest.IsolatedAsyncioTestCase method): Test cases.\n(line  859)\n* asyncTearDown() (unittest.IsolatedAsyncioTestCase method): Test cases.\n(line  868)\n* AsyncWith (class in ast):              Async and await.    (line   44)\n* AT (in module token):                  token -- Constants used with Python parse trees.\n(line  222)\n* ateof() (asyncio.StreamReader method): StreamReader.      (line   76)\n* atan() (in module cmath):              Trigonometric functions<2>.\n(line   17)\n* atan() (in module math):               Trigonometric functions.\n(line   16)\n* atan2() (in module math):              Trigonometric functions.\n(line   21)\n* atanh() (in module cmath):             Hyperbolic functions<2>.\n(line   17)\n* atanh() (in module math):              Hyperbolic functions.\n(line   17)\n* ATEQUAL (in module token):             token -- Constants used with Python parse trees.\n(line  226)\n* atexit (weakref.finalize attribute):   weakref -- Weak references.\n(line  317)\n* athrow() (agen method):                Asynchronous generator-iterator methods.\n(line   43)\n* atof() (in module locale):             locale -- Internationalization services.\n(line  507)\n* atoi() (in module locale):             locale -- Internationalization services.\n(line  513)\n* atom:                                  Atoms.              (line    6)\n* attachloop() (asyncio.AbstractChildWatcher method): Process Watchers.\n(line   63)\n* attachmock() (unittest.mock.Mock method): The Mock Class. (line  236)\n* attach() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  167)\n* AttlistDeclHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line  246)\n* attrgetter() (in module operator):     operator -- Standard operators as functions.\n(line  234)\n* attrib (xml.etree.ElementTree.Element attribute): Element Objects.\n(line   45)\n* attribute:                             The standard type hierarchy.\n(line   13)\n* attribute <1>:                         Glossary.           (line  151)\n* Attribute (class in ast):              Expressions<2>.     (line  171)\n* attribute; assignment:                 Assignment statements.\n(line    6)\n* attribute; assignment <1>:             Assignment statements.\n(line   76)\n* attribute; deletion:                   The del statement<2>.\n(line   20)\n* attribute; reference:                  Attribute references.\n(line    6)\n* AttributeError:                        Concrete exceptions.\n(line   12)\n* attributes (xml.dom.Node attribute):   Node Objects.       (line   26)\n* AttributesImpl (class in xml.sax.xmlreader): xml sax xmlreader -- Interface for XML parsers.\n(line   69)\n* AttributesNSImpl (class in xml.sax.xmlreader): xml sax xmlreader -- Interface for XML parsers.\n(line   80)\n* attroff() (curses.window method):      Window Objects.     (line   53)\n* attron() (curses.window method):       Window Objects.     (line   58)\n* attrset() (curses.window method):      Window Objects.     (line   63)\n* Audio Interchange File Format:         aifc -- Read and write AIFF and AIFC files.\n(line    8)\n* Audio Interchange File Format <1>:     chunk -- Read IFF chunked data.\n(line    8)\n* AUDIOFILEENCODINGADPCMG721 (in module sunau): sunau -- Read and write Sun AU files.\n(line   94)\n* AUDIOFILEENCODINGADPCMG722 (in module sunau): sunau -- Read and write Sun AU files.\n(line   94)\n* AUDIOFILEENCODINGADPCMG7233 (in module sunau): sunau -- Read and write Sun AU files.\n(line   94)\n* AUDIOFILEENCODINGADPCMG7235 (in module sunau): sunau -- Read and write Sun AU files.\n(line   94)\n* AUDIOFILEENCODINGALAW8 (in module sunau): sunau -- Read and write Sun AU files.\n(line   84)\n* AUDIOFILEENCODINGDOUBLE (in module sunau): sunau -- Read and write Sun AU files.\n(line   94)\n* AUDIOFILEENCODINGFLOAT (in module sunau): sunau -- Read and write Sun AU files.\n(line   94)\n* AUDIOFILEENCODINGLINEAR16 (in module sunau): sunau -- Read and write Sun AU files.\n(line   84)\n* AUDIOFILEENCODINGLINEAR24 (in module sunau): sunau -- Read and write Sun AU files.\n(line   84)\n* AUDIOFILEENCODINGLINEAR32 (in module sunau): sunau -- Read and write Sun AU files.\n(line   84)\n* AUDIOFILEENCODINGLINEAR8 (in module sunau): sunau -- Read and write Sun AU files.\n(line   84)\n* AUDIOFILEENCODINGMULAW8 (in module sunau): sunau -- Read and write Sun AU files.\n(line   84)\n* AUDIOFILEMAGIC (in module sunau):    sunau -- Read and write Sun AU files.\n(line   78)\n* AUDIODEV:                              ossaudiodev -- Access to OSS-compatible audio devices.\n(line   58)\n* audit events:                          Debugging and Profiling.\n(line   13)\n* audit() (in module sys):               sys -- System-specific parameters and functions.\n(line   90)\n* auditing:                              sys -- System-specific parameters and functions.\n(line   92)\n* AugAssign (class in ast):              Statements.         (line   96)\n* augmented; assignment:                 Augmented assignment statements.\n(line    6)\n* AUGUST (in module calendar):           calendar -- General calendar-related functions.\n(line  414)\n* auth() (ftplib.FTPTLS method):        FTPTLS objects.    (line   88)\n* auth() (smtplib.SMTP method):          SMTP Objects.       (line  141)\n* authenticate() (imaplib.IMAP4 method): IMAP4 Objects.      (line   37)\n* AuthenticationError:                   Process and exceptions.\n(line  240)\n* authenticators() (netrc.netrc method): netrc Objects.      (line    8)\n* authkey (multiprocessing.Process attribute): Process and exceptions.\n(line  141)\n* auto (class in enum):                  Utilities and Decorators.\n(line    6)\n* autocommit (sqlite3.Connection attribute): Connection objects.\n(line  703)\n* autorange() (timeit.Timer method):     Python Interface.   (line   92)\n* availabletimezones() (in module zoneinfo): Functions<3>.  (line    6)\n* avg() (in module audioop):             audioop -- Manipulate raw audio data.\n(line   54)\n* avgpp() (in module audioop):           audioop -- Manipulate raw audio data.\n(line   58)\n* avoidssymlinkattacks (shutil.rmtree attribute): Directory and files operations.\n(line  312)\n* Await (class in ast):                  Async and await.    (line   14)\n* AWAIT (in module token):               token -- Constants used with Python parse trees.\n(line  248)\n* awaitargs (unittest.mock.AsyncMock attribute): The Mock Class.\n(line  883)\n* awaitargslist (unittest.mock.AsyncMock attribute): The Mock Class.\n(line  901)\n* awaitcount (unittest.mock.AsyncMock attribute): The Mock Class.\n(line  867)\n* await; in comprehensions:              Displays for lists sets and dictionaries.\n(line   45)\n* awaitable:                             Glossary.           (line  163)\n* Awaitable (class in collections.abc):  Collections Abstract Base Classes - Detailed Descriptions.\n(line  103)\n* Awaitable (class in typing):           Aliases to asynchronous ABCs in collections abc.\n(line   86)\n* b'; bytes literal:                     String and Bytes literals.\n(line   46)\n* b\"; bytes literal:                     String and Bytes literals.\n(line   46)\n* b16decode() (in module base64):        base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line  155)\n* b16encode() (in module base64):        base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line  150)\n* b2abase64() (in module binascii):     binascii -- Convert between binary and ASCII.\n(line   61)\n* b2ahex() (in module binascii):        binascii -- Convert between binary and ASCII.\n(line  114)\n* b2aqp() (in module binascii):         binascii -- Convert between binary and ASCII.\n(line   77)\n* b2auu() (in module binascii):         binascii -- Convert between binary and ASCII.\n(line   31)\n* b32decode() (in module base64):        base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line  111)\n* b32encode() (in module base64):        base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line  106)\n* b32hexdecode() (in module base64):     base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line  138)\n* b32hexencode() (in module base64):     base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line  131)\n* b64decode() (in module base64):        base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line   58)\n* b64encode() (in module base64):        base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line   43)\n* b85decode() (in module base64):        base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line  222)\n* b85encode() (in module base64):        base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line  211)\n* Babyl (class in mailbox):              Babyl objects.      (line    6)\n* BabylMessage (class in mailbox):       BabylMessage objects.\n(line    6)\n* back() (in module turtle):             Turtle motion.      (line   24)\n* backslash character:                   Explicit line joining.\n(line    6)\n* backslashreplaceerrors() (in module codecs): Error Handlers.\n(line  161)\n* backslashreplace; error handler's name: Error Handlers.    (line   15)\n* backup() (sqlite3.Connection method):  Connection objects. (line  501)\n* backward() (in module turtle):         Turtle motion.      (line   24)\n* BadGzipFile:                           gzip -- Support for gzip files.\n(line   63)\n* BadOptionError:                        Exceptions<19>.     (line   21)\n* BadStatusLine:                         http client -- HTTP protocol client.\n(line  178)\n* BadZipFile:                            zipfile -- Work with ZIP archives.\n(line   24)\n* BadZipfile:                            zipfile -- Work with ZIP archives.\n(line   30)\n* Balloon (class in tkinter.tix):        Basic Widgets.      (line    6)\n* Barrier (class in asyncio):            Barrier.            (line    6)\n* Barrier (class in multiprocessing):    Synchronization primitives.\n(line   13)\n* Barrier (class in threading):          Barrier Objects.    (line   36)\n* Barrier() (multiprocessing.managers.SyncManager method): Managers.\n(line  160)\n* baseexecprefix (in module sys):      sys -- System-specific parameters and functions.\n(line  121)\n* baseprefix (in module sys):           sys -- System-specific parameters and functions.\n(line  135)\n* base64; encoding:                      base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line    8)\n* BaseCGIHandler (class in wsgiref.handlers): wsgiref handlers - server/gateway base classes.\n(line   53)\n* BaseCookie (class in http.cookies):    http cookies -- HTTP state management.\n(line   39)\n* BaseException:                         Base classes.       (line    9)\n* BaseExceptionGroup:                    Exception groups.   (line   14)\n* BaseHandler (class in urllib.request): urllib request -- Extensible library for opening URLs.\n(line  282)\n* BaseHandler (class in wsgiref.handlers): wsgiref handlers - server/gateway base classes.\n(line   89)\n* BaseHeader (class in email.headerregistry): email headerregistry Custom Header Objects.\n(line   37)\n* BaseHTTPRequestHandler (class in http.server): http server -- HTTP servers.\n(line   52)\n* BaseManager (class in multiprocessing.managers): Managers. (line   23)\n* basename() (in module os.path):        os path -- Common pathname manipulations.\n(line   57)\n* BaseProtocol (class in asyncio):       Base Protocols.     (line    6)\n* BaseProxy (class in multiprocessing.managers): Proxy Objects.\n(line   92)\n* BaseRequestHandler (class in socketserver): Request Handler Objects.\n(line    6)\n* BaseRotatingHandler (class in logging.handlers): BaseRotatingHandler.\n(line   12)\n* BaseSelector (class in selectors):     Classes<4>.         (line   53)\n* BaseServer (class in socketserver):    Server Objects<2>.  (line    6)\n* basestring (2to3 fixer):               Fixers.             (line   60)\n* BaseTransport (class in asyncio):      Transports Hierarchy.\n(line    6)\n* basicConfig() (in module logging):     Module-Level Functions.\n(line  202)\n* BasicContext (class in decimal):       Context objects.    (line   65)\n* BasicInterpolation (class in configparser): Interpolation of values.\n(line   10)\n* batched() (in module itertools):       Itertool Functions. (line   72)\n* baudrate() (in module curses):         Functions<6>.       (line   18)\n* bbox() (tkinter.ttk.Treeview method):  ttk Treeview.       (line    8)\n* BDADDRANY (in module socket):         Constants<8>.       (line  290)\n* BDADDRLOCAL (in module socket):       Constants<8>.       (line  290)\n* Bdb (class in bdb):                    bdb -- Debugger framework.\n(line  129)\n* BdbQuit:                               bdb -- Debugger framework.\n(line   15)\n* BDFL:                                  Glossary.           (line  169)\n* beep() (in module curses):             Functions<6>.       (line   26)\n* Beep() (in module winsound):           winsound -- Sound-playing interface for Windows.\n(line   12)\n* BEFOREASYNCWITH (opcode):            Python Bytecode Instructions.\n(line  301)\n* BEFOREWITH (opcode):                  Python Bytecode Instructions.\n(line  450)\n* beginfill() (in module turtle):       Filling.            (line   16)\n* beginpoly() (in module turtle):       Special Turtle methods.\n(line    6)\n* BEL (in module curses.ascii):          curses ascii -- Utilities for ASCII characters.\n(line   40)\n* BELOWNORMALPRIORITYCLASS (in module subprocess): Windows Constants.\n(line   59)\n* below() (curses.panel.Panel method):   Panel Objects.      (line   17)\n* benchmarking:                          Functions<5>.       (line  201)\n* benchmarking <1>:                      Functions<5>.       (line  225)\n* benchmarking <2>:                      Functions<5>.       (line  549)\n* Benchmarking:                          timeit -- Measure execution time of small code snippets.\n(line    8)\n* betavariate() (in module random):      Real-valued distributions.\n(line   33)\n* bgcolor() (in module turtle):          Window control.     (line    6)\n* bgpic() (in module turtle):            Window control.     (line   21)\n* bias() (in module audioop):            audioop -- Manipulate raw audio data.\n(line   64)\n* bidirectional() (in module unicodedata): unicodedata -- Unicode Database.\n(line   54)\n* bigaddrspacetest() (in module test.support): test support -- Utilities for the Python test suite.\n(line  561)\n* BigEndianStructure (class in ctypes):  Structured data types.\n(line   22)\n* BigEndianUnion (class in ctypes):      Structured data types.\n(line   10)\n* bigmemtest() (in module test.support): test support -- Utilities for the Python test suite.\n(line  545)\n* Binary (class in msilib):              msilib -- Read and write Microsoft Installer files.\n(line   91)\n* Binary (class in xmlrpc.client):       Binary Objects.     (line    6)\n* binary file:                           Glossary.           (line  174)\n* binary literal:                        Numeric literals.   (line    6)\n* binary mode:                           Built-in Functions. (line 1326)\n* binary semaphores:                     thread -- Low-level threading API.\n(line    6)\n* BINARYOP (opcode):                    Python Bytecode Instructions.\n(line  182)\n* BINARYSLICE (opcode):                 Python Bytecode Instructions.\n(line  218)\n* BINARYSUBSCR (opcode):                Python Bytecode Instructions.\n(line  193)\n* binary; arithmetic; operation:         Binary arithmetic operations.\n(line    6)\n* binary; bitwise; operation:            Binary bitwise operations.\n(line    6)\n* binary; literals:                      Numeric Types -- int float complex.\n(line   19)\n* binaryfunc (C type):                   Slot Type typedefs. (line  112)\n* BinaryIO (class in typing):            ABCs for working with IO.\n(line    6)\n* bind (widgets):                        Bindings and Events.\n(line    6)\n* bindpartial() (inspect.Signature method): Introspecting callables with the Signature object.\n(line  128)\n* bindport() (in module test.support.sockethelper): test support sockethelper -- Utilities for socket tests.\n(line   37)\n* bindtextdomaincodeset() (in module locale): Access to message catalogs.\n(line   16)\n* bindunixsocket() (in module test.support.sockethelper): test support sockethelper -- Utilities for socket tests.\n(line   54)\n* bind() (inspect.Signature method):     Introspecting callables with the Signature object.\n(line  121)\n* bind() (socket.socket method):         Socket Objects.     (line   30)\n* binding; name:                         Binding of names.   (line    6)\n* binding; name <1>:                     Assignment statements.\n(line    6)\n* bindtextdomain() (in module gettext):  GNU gettext API.    (line   14)\n* bindtextdomain() (in module locale):   Access to message catalogs.\n(line   14)\n* binomialvariate() (in module random):  Discrete distributions.\n(line    8)\n* BinOp (class in ast):                  Expressions<2>.     (line   42)\n* bisectleft() (in module bisect):      bisect -- Array bisection algorithm.\n(line   24)\n* bisectright() (in module bisect):     bisect -- Array bisection algorithm.\n(line   49)\n* bisect() (in module bisect):           bisect -- Array bisection algorithm.\n(line   49)\n* bitcount() (int method):              Additional Methods on Integer Types.\n(line   35)\n* bitlength() (int method):             Additional Methods on Integer Types.\n(line    9)\n* BitAnd (class in ast):                 Expressions<2>.     (line   54)\n* bitmap() (msilib.Dialog method):       GUI classes.        (line   58)\n* BitOr (class in ast):                  Expressions<2>.     (line   54)\n* bitsperdigit (sys.intinfo attribute): sys -- System-specific parameters and functions.\n(line 1103)\n* bitwise; and:                          Binary bitwise operations.\n(line   12)\n* bitwise; operations:                   Bitwise Operations on Integer Types.\n(line    6)\n* bitwise; or:                           Binary bitwise operations.\n(line   20)\n* bitwise; xor:                          Binary bitwise operations.\n(line   16)\n* BitXor (class in ast):                 Expressions<2>.     (line   54)\n* bk() (in module turtle):               Turtle motion.      (line   24)\n* bkgd() (curses.window method):         Window Objects.     (line   68)\n* bkgdset() (curses.window method):      Window Objects.     (line   80)\n* blake2b, blake2s:                      BLAKE2.             (line    6)\n* blake2b.MAXDIGESTSIZE (in module hashlib): Constants<5>. (line   24)\n* blake2b.MAXKEYSIZE (in module hashlib): Constants<5>.    (line   18)\n* blake2b.PERSONSIZE (in module hashlib): Constants<5>.     (line   12)\n* blake2b.SALTSIZE (in module hashlib): Constants<5>.       (line    6)\n* blake2b() (in module hashlib):         Creating hash objects.\n(line    8)\n* blake2s.MAXDIGESTSIZE (in module hashlib): Constants<5>. (line   26)\n* blake2s.MAXKEYSIZE (in module hashlib): Constants<5>.    (line   20)\n* blake2s.PERSONSIZE (in module hashlib): Constants<5>.     (line   14)\n* blake2s.SALTSIZE (in module hashlib): Constants<5>.       (line    8)\n* blake2s() (in module hashlib):         Creating hash objects.\n(line   13)\n* blank line:                            Blank lines.        (line    6)\n* BLKTYPE (in module tarfile):           tarfile -- Read and write tar archive files.\n(line  295)\n* Blob (class in sqlite3):               Blob objects.       (line    6)\n* blobopen() (sqlite3.Connection method): Connection objects.\n(line   30)\n* block:                                 Structure of a program.\n(line    6)\n* blockonclose (socketserver.ThreadingMixIn attribute): Server Creation Notes.\n(line   45)\n* blocksize (hmac.HMAC attribute):      hmac -- Keyed-Hashing for Message Authentication.\n(line   93)\n* blockeddomains() (http.cookiejar.DefaultCookiePolicy method): DefaultCookiePolicy Objects.\n(line   52)\n* BlockingIOError:                       OS exceptions.      (line    9)\n* BlockingIOError <1>:                   High-level Module Interface.\n(line   67)\n* blocksize (http.client.HTTPConnection attribute): HTTPConnection Objects.\n(line  156)\n* BNF:                                   Notation.           (line    6)\n* BNF <1>:                               Expressions.        (line    6)\n* bodyencode() (email.charset.Charset method): email charset Representing character sets.\n(line  135)\n* bodyencoding (email.charset.Charset attribute): email charset Representing character sets.\n(line   67)\n* bodylineiterator() (in module email.iterators): email iterators Iterators.\n(line   14)\n* body() (nntplib.NNTP method):          Methods<3>.         (line  272)\n* body() (tkinter.simpledialog.Dialog method): tkinter simpledialog -- Standard Tkinter input dialogs.\n(line   25)\n* BOLD (in module tkinter.font):         tkinter font -- Tkinter font wrapper.\n(line   15)\n* BOM (in module codecs):                codecs -- Codec registry and base classes.\n(line  250)\n* BOMBE (in module codecs):             codecs -- Codec registry and base classes.\n(line  250)\n* BOMLE (in module codecs):             codecs -- Codec registry and base classes.\n(line  250)\n* BOMUTF16 (in module codecs):          codecs -- Codec registry and base classes.\n(line  250)\n* BOMUTF16BE (in module codecs):       codecs -- Codec registry and base classes.\n(line  250)\n* BOMUTF16LE (in module codecs):       codecs -- Codec registry and base classes.\n(line  250)\n* BOMUTF32 (in module codecs):          codecs -- Codec registry and base classes.\n(line  250)\n* BOMUTF32BE (in module codecs):       codecs -- Codec registry and base classes.\n(line  250)\n* BOMUTF32LE (in module codecs):       codecs -- Codec registry and base classes.\n(line  250)\n* BOMUTF8 (in module codecs):           codecs -- Codec registry and base classes.\n(line  250)\n* bool (built-in class):                 Built-in Functions. (line  131)\n* BOOLEANSTATES (configparser.ConfigParser attribute): Customizing Parser Behaviour.\n(line  246)\n* Boolean; operation:                    Boolean operations. (line    6)\n* Boolean; operations:                   Truth Value Testing.\n(line    6)\n* Boolean; operations <1>:               Boolean Operations -- and or not.\n(line    6)\n* Boolean; type:                         Built-in Functions. (line  141)\n* Boolean; values:                       Boolean Type - bool.\n(line    9)\n* BoolOp (class in ast):                 Expressions<2>.     (line   70)\n* bootstrap() (in module ensurepip):     Module API.         (line   13)\n* border() (curses.window method):       Window Objects.     (line   91)\n* borrowed reference:                    Glossary.           (line  185)\n* bottompanel() (in module curses.panel): Functions<7>.     (line    8)\n* bottom() (curses.panel.Panel method):  Panel Objects.      (line   21)\n* BoundArguments (class in inspect):     Introspecting callables with the Signature object.\n(line  309)\n* BoundaryError:                         email errors Exception and Defect classes.\n(line   38)\n* BoundedSemaphore (class in asyncio):   BoundedSemaphore.   (line    6)\n* BoundedSemaphore (class in multiprocessing): Synchronization primitives.\n(line   19)\n* BoundedSemaphore (class in threading): Semaphore Objects.  (line   73)\n* BoundedSemaphore() (multiprocessing.managers.SyncManager method): Managers.\n(line  167)\n* box() (curses.window method):          Window Objects.     (line  130)\n* bpbynumber (bdb.Breakpoint attribute): bdb -- Debugger framework.\n(line  110)\n* bpformat() (bdb.Breakpoint method):    bdb -- Debugger framework.\n(line   56)\n* bplist (bdb.Breakpoint attribute):     bdb -- Debugger framework.\n(line  115)\n* bpprint() (bdb.Breakpoint method):     bdb -- Debugger framework.\n(line   75)\n* BRANCH (monitoring event):             Events.             (line    8)\n* Break (class in ast):                  Control flow.       (line  102)\n* break (pdb command):                   Debugger Commands.  (line   94)\n* breakanywhere() (bdb.Bdb method):     bdb -- Debugger framework.\n(line  262)\n* breakhere() (bdb.Bdb method):         bdb -- Debugger framework.\n(line  254)\n* breaklongwords (textwrap.TextWrapper attribute): textwrap -- Text wrapping and filling.\n(line  248)\n* breakonhyphens (textwrap.TextWrapper attribute): textwrap -- Text wrapping and filling.\n(line  258)\n* Breakpoint (class in bdb):             bdb -- Debugger framework.\n(line   22)\n* breakpointhook() (in module sys):      sys -- System-specific parameters and functions.\n(line  230)\n* breakpoints:                           Help menu Shell and Editor.\n(line   29)\n* broadcastaddress (ipaddress.IPv4Network attribute): Network objects.\n(line   91)\n* broadcastaddress (ipaddress.IPv6Network attribute): Network objects.\n(line  311)\n* broken (asyncio.Barrier attribute):    Barrier.            (line  103)\n* broken (threading.Barrier attribute):  Barrier Objects.    (line  101)\n* BrokenBarrierError:                    Barrier Objects.    (line  106)\n* BrokenBarrierError <1>:                Barrier.            (line  108)\n* BrokenExecutor:                        Exception classes.  (line   18)\n* BrokenPipeError:                       OS exceptions.      (line   38)\n* BrokenProcessPool:                     Exception classes.  (line   41)\n* BrokenThreadPool:                      Exception classes.  (line   33)\n* BROWSER:                               webbrowser -- Convenient web-browser controller.\n(line   20)\n* BROWSER <1>:                           webbrowser -- Convenient web-browser controller.\n(line  101)\n* BS (in module curses.ascii):           curses ascii -- Utilities for ASCII characters.\n(line   43)\n* BsdDbShelf (class in shelve):          Restrictions.       (line   60)\n* buf (multiprocessing.sharedmemory.SharedMemory attribute): multiprocessing sharedmemory -- Shared memory for direct access across processes.\n(line   93)\n* buffer (2to3 fixer):                   Fixers.             (line   64)\n* Buffer (class in collections.abc):     Collections Abstract Base Classes - Detailed Descriptions.\n(line  160)\n* buffer (io.TextIOBase attribute):      Text I/O<2>.        (line   30)\n* buffer (unittest.TestResult attribute): Loading and running tests.\n(line  288)\n* buffer interface; (see buffer protocol): Iterator Protocol.\n(line   78)\n* buffer object; (see buffer protocol):  Iterator Protocol.  (line   77)\n* buffer protocol:                       Iterator Protocol.  (line   78)\n* buffer protocol; binary sequence types: printf-style String Formatting.\n(line  189)\n* buffer protocol; str (built-in class): Text Sequence Type -- str.\n(line   61)\n* buffer size, I/O:                      Built-in Functions. (line 1326)\n* bufferinfo() (array.array method):    array -- Efficient arrays of numeric values.\n(line  118)\n* buffersize (xml.parsers.expat.xmlparser attribute): XMLParser Objects<2>.\n(line  120)\n* buffertext (xml.parsers.expat.xmlparser attribute): XMLParser Objects<2>.\n(line  127)\n* bufferupdated() (asyncio.BufferedProtocol method): Buffered Streaming Protocols.\n(line   33)\n* bufferused (xml.parsers.expat.xmlparser attribute): XMLParser Objects<2>.\n(line  138)\n* BufferedIOBase (class in io):          I/O Base Classes.   (line  224)\n* BufferedProtocol (class in asyncio):   Base Protocols.     (line   15)\n* BufferedRandom (class in io):          Buffered Streams.   (line  138)\n* BufferedReader (class in io):          Buffered Streams.   (line   56)\n* BufferedRWPair (class in io):          Buffered Streams.   (line  153)\n* BufferedWriter (class in io):          Buffered Streams.   (line   97)\n* BufferError:                           Base classes.       (line   78)\n* BufferFlags (class in inspect):        Buffer flags.       (line    6)\n* BufferingFormatter (class in logging): Formatter Objects.  (line  132)\n* BufferingHandler (class in logging.handlers): MemoryHandler.\n(line   19)\n* BufferTooShort:                        Process and exceptions.\n(line  232)\n* bufsize() (ossaudiodev.ossaudiodevice method): Audio Device Objects.\n(line  214)\n* BUILDCONSTKEYMAP (opcode):          Python Bytecode Instructions.\n(line  625)\n* BUILDLIST (opcode):                   Python Bytecode Instructions.\n(line  607)\n* BUILDMAP (opcode):                    Python Bytecode Instructions.\n(line  615)\n* buildopener() (in module urllib.request): urllib request -- Extensible library for opening URLs.\n(line  135)\n* BUILDSET (opcode):                    Python Bytecode Instructions.\n(line  611)\n* BUILDSLICE (opcode):                  Python Bytecode Instructions.\n(line 1035)\n* BUILDSTRING (opcode):                 Python Bytecode Instructions.\n(line  634)\n* BUILDTUPLE (opcode):                  Python Bytecode Instructions.\n(line  598)\n* built-in function; import:         Importing Modules<2>.\n(line   28)\n* built-in function; import():       Built-in Functions. (line 2003)\n* built-in function; abs:                Emulating numeric types.\n(line  113)\n* built-in function; abs <1>:            Number Protocol.    (line  100)\n* built-in function; abs():              Built-in Functions. (line   43)\n* built-in function; aiter():            Built-in Functions. (line   50)\n* built-in function; all():              Built-in Functions. (line   60)\n* built-in function; anext():            Built-in Functions. (line   71)\n* built-in function; any():              Built-in Functions. (line   90)\n* built-in function; ascii:              Object Protocol.    (line  211)\n* built-in function; ascii():            Built-in Functions. (line  101)\n* built-in function; bin():              Built-in Functions. (line  109)\n* built-in function; breakpoint():       Built-in Functions. (line  143)\n* built-in function; bytes:              Basic customization.\n(line  145)\n* built-in function; bytes <1>:          Object Protocol.    (line  234)\n* built-in function; call:               Calls.              (line  141)\n* built-in function; callable():         Built-in Functions. (line  226)\n* built-in function; chr:                Immutable sequences.\n(line   15)\n* built-in function; chr():              Built-in Functions. (line  238)\n* built-in function; classmethod:        Implementing functions and methods.\n(line  197)\n* built-in function; classmethod():      Built-in Functions. (line  249)\n* built-in function; compile:            The global statement.\n(line   28)\n* built-in function; compile <1>:        Code Objects.       (line    6)\n* built-in function; compile <2>:        Standard Interpreter Types.\n(line   58)\n* built-in function; compile <3>:        Importing Modules<2>.\n(line  114)\n* built-in function; compile():          Built-in Functions. (line  285)\n* built-in function; complex:            Emulating numeric types.\n(line  120)\n* built-in function; complex <1>:        Numeric Types -- int float complex.\n(line   27)\n* built-in function; delattr():          Built-in Functions. (line  399)\n* built-in function; dir():              Built-in Functions. (line  422)\n* built-in function; divmod:             Emulating numeric types.\n(line   26)\n* built-in function; divmod <1>:         Emulating numeric types.\n(line   56)\n* built-in function; divmod <2>:         Number Protocol.    (line   71)\n* built-in function; divmod():           Built-in Functions. (line  483)\n* built-in function; enumerate():        Built-in Functions. (line  495)\n* built-in function; eval:               The global statement.\n(line   28)\n* built-in function; eval <1>:           Expression input.   (line    6)\n* built-in function; eval <2>:           Code Objects.       (line   17)\n* built-in function; eval <3>:           Functions<4>.       (line   57)\n* built-in function; eval <4>:           PrettyPrinter Objects.\n(line  101)\n* built-in function; eval():             Built-in Functions. (line  518)\n* built-in function; exec:               The global statement.\n(line   28)\n* built-in function; exec <1>:           Built-in Functions. (line  568)\n* built-in function; exec <2>:           Code Objects.       (line   17)\n* built-in function; exec():             Built-in Functions. (line  568)\n* built-in function; filter():           Built-in Functions. (line  622)\n* built-in function; float:              Emulating numeric types.\n(line  120)\n* built-in function; float <1>:          Numeric Types -- int float complex.\n(line   27)\n* built-in function; float <2>:          Number Protocol.    (line  266)\n* built-in function; format():           Built-in Functions. (line  702)\n* built-in function; getattr():          Built-in Functions. (line  735)\n* built-in function; globals():          Built-in Functions. (line  752)\n* built-in function; hasattr():          Built-in Functions. (line  758)\n* built-in function; hash:               Basic customization.\n(line  227)\n* built-in function; hash <1>:           Immutable Sequence Types.\n(line    6)\n* built-in function; hash <2>:           Object Protocol.    (line  284)\n* built-in function; hash <3>:           PyTypeObject Slots. (line  315)\n* built-in function; hash():             Built-in Functions. (line  765)\n* built-in function; help:               Operating System Interface.\n(line   20)\n* built-in function; help():             Built-in Functions. (line  777)\n* built-in function; hex():              Built-in Functions. (line  801)\n* built-in function; id:                 Objects values and types.\n(line   11)\n* built-in function; id():               Built-in Functions. (line  832)\n* built-in function; input():            Built-in Functions. (line  845)\n* built-in function; int:                Emulating numeric types.\n(line  120)\n* built-in function; int <1>:            Numeric Types -- int float complex.\n(line   27)\n* built-in function; int <2>:            Number Protocol.    (line  258)\n* built-in function; isinstance():       Built-in Functions. (line  928)\n* built-in function; issubclass():       Built-in Functions. (line  944)\n* built-in function; iter():             Built-in Functions. (line  957)\n* built-in function; len:                Sequences.          (line    6)\n* built-in function; len <1>:            Set types.          (line    6)\n* built-in function; len <2>:            Mappings.           (line    6)\n* built-in function; len <3>:            Emulating container types.\n(line   40)\n* built-in function; len <4>:            Common Sequence Operations.\n(line   21)\n* built-in function; len <5>:            Mapping Types -- dict.\n(line    6)\n* built-in function; len <6>:            Object Protocol.    (line  333)\n* built-in function; len <7>:            Sequence Protocol.  (line   16)\n* built-in function; len <8>:            Mapping Protocol.   (line   19)\n* built-in function; len <9>:            List Objects.       (line   38)\n* built-in function; len <10>:           Dictionary Objects. (line  144)\n* built-in function; len <11>:           Set Objects.        (line   99)\n* built-in function; len():              Built-in Functions. (line  986)\n* built-in function; locals():           Built-in Functions. (line 1004)\n* built-in function; map():              Built-in Functions. (line 1016)\n* built-in function; max:                Common Sequence Operations.\n(line   21)\n* built-in function; max():              Built-in Functions. (line 1026)\n* built-in function; min:                Common Sequence Operations.\n(line   21)\n* built-in function; min():              Built-in Functions. (line 1060)\n* built-in function; multiprocessing.Manager(): Managers.    (line   12)\n* built-in function; next():             Built-in Functions. (line 1089)\n* built-in function; oct():              Built-in Functions. (line 1108)\n* built-in function; open:               Reading and Writing Files.\n(line    6)\n* built-in function; open <1>:           I/O objects also known as file objects.\n(line    6)\n* built-in function; open():             Built-in Functions. (line 1133)\n* built-in function; ord:                Immutable sequences.\n(line   15)\n* built-in function; ord():              Built-in Functions. (line 1371)\n* built-in function; pow:                Emulating numeric types.\n(line   26)\n* built-in function; pow <1>:            Emulating numeric types.\n(line   26)\n* built-in function; pow <2>:            Emulating numeric types.\n(line   56)\n* built-in function; pow <3>:            Emulating numeric types.\n(line   67)\n* built-in function; pow <4>:            Number Protocol.    (line   80)\n* built-in function; pow <5>:            Number Protocol.    (line  206)\n* built-in function; pow():              Built-in Functions. (line 1378)\n* built-in function; print:              Basic customization.\n(line  149)\n* built-in function; print():            Built-in Functions. (line 1416)\n* built-in function; property.deleter(): Built-in Functions. (line 1491)\n* built-in function; property.getter():  Built-in Functions. (line 1487)\n* built-in function; property.setter():  Built-in Functions. (line 1489)\n* built-in function; range:              The for statement.  (line   37)\n* built-in function; repr:               Expression statements.\n(line   17)\n* built-in function; repr <1>:           Finalization and De-allocation.\n(line   90)\n* built-in function; repr <2>:           Object Protocol.    (line  198)\n* built-in function; repr <3>:           PyTypeObject Slots. (line  253)\n* built-in function; repr():             Built-in Functions. (line 1533)\n* built-in function; reversed():         Built-in Functions. (line 1556)\n* built-in function; round:              Emulating numeric types.\n(line  143)\n* built-in function; round():            Built-in Functions. (line 1563)\n* built-in function; setattr():          Built-in Functions. (line 1602)\n* built-in function; slice:              Slice objects.      (line    6)\n* built-in function; slice <1>:          Python Bytecode Instructions.\n(line 1037)\n* built-in function; sorted():           Built-in Functions. (line 1651)\n* built-in function; staticmethod:       Implementing functions and methods.\n(line  204)\n* built-in function; staticmethod():     Built-in Functions. (line 1687)\n* built-in function; sum():              Built-in Functions. (line 1740)\n* built-in function; tuple:              Sequence Protocol.  (line  120)\n* built-in function; tuple <1>:          List Objects.       (line  126)\n* built-in function; type:               Objects values and types.\n(line   11)\n* built-in function; type <1>:           Metaclasses.        (line    6)\n* built-in function; type <2>:           Type Objects.       (line    6)\n* built-in function; type <3>:           Object Protocol.    (line  315)\n* built-in function; vars():             Built-in Functions. (line 1883)\n* built-in function; xml.etree.ElementInclude.defaultloader(): Functions<10>.\n(line    6)\n* built-in function; xml.etree.ElementInclude.include(): Functions<10>.\n(line   17)\n* built-in function; zip():              Built-in Functions. (line 1906)\n* built-in method; call:                 Calls.              (line  141)\n* built-in; method:                      Built-in methods.   (line    6)\n* built-in; types:                       Built-in Types.     (line    9)\n* builtinmodulenames (in module sys):  sys -- System-specific parameters and functions.\n(line  156)\n* BuiltinFunctionType (in module types): Standard Interpreter Types.\n(line   81)\n* BuiltinImporter (class in importlib.machinery): importlib machinery - Importers and path hooks.\n(line   67)\n* BuiltinMethodType (in module types):   Standard Interpreter Types.\n(line   81)\n* busyretry() (in module test.support): test support -- Utilities for the Python test suite.\n(line  197)\n* BUTTONALT (in module curses):         Constants<6>.       (line  629)\n* BUTTONCTRL (in module curses):        Constants<6>.       (line  626)\n* BUTTONSHIFT (in module curses):       Constants<6>.       (line  623)\n* ButtonBox (class in tkinter.tix):      Basic Widgets.      (line   13)\n* buttonbox() (tkinter.simpledialog.Dialog method): tkinter simpledialog -- Standard Tkinter input dialogs.\n(line   30)\n* BUTTONnCLICKED (in module curses):    Constants<6>.       (line  614)\n* BUTTONnDOUBLECLICKED (in module curses): Constants<6>.   (line  617)\n* BUTTONnPRESSED (in module curses):    Constants<6>.       (line  608)\n* BUTTONnRELEASED (in module curses):   Constants<6>.       (line  611)\n* BUTTONnTRIPLECLICKED (in module curses): Constants<6>.   (line  620)\n* bye() (in module turtle):              Methods specific to Screen not inherited from TurtleScreen.\n(line    6)\n* byref() (in module ctypes):            Utility functions.  (line   19)\n* byte:                                  Immutable sequences.\n(line   39)\n* bytearray:                             Mutable sequences.  (line   25)\n* bytearray (built-in class):            Bytearray Objects.  (line    9)\n* bytearray; formatting:                 printf-style Bytes Formatting.\n(line    6)\n* bytearray; interpolation:              printf-style Bytes Formatting.\n(line    6)\n* bytearray; methods:                    Bytes and Bytearray Operations.\n(line    6)\n* bytecode:                              Code objects.       (line    6)\n* bytecode <1>:                          Glossary.           (line  219)\n* Bytecode (class in dis):               Bytecode analysis.  (line   12)\n* BYTECODESUFFIXES (in module importlib.machinery): importlib machinery - Importers and path hooks.\n(line   40)\n* Bytecode.codeobj (in module dis):      Bytecode analysis.  (line   46)\n* Bytecode.firstline (in module dis):   Bytecode analysis.  (line   50)\n* BytecodeTestCase (class in test.support.bytecodehelper): test support bytecodehelper -- Support tools for testing correct bytecode generation.\n(line   13)\n* byteorder (in module sys):             sys -- System-specific parameters and functions.\n(line  149)\n* bytes:                                 Immutable sequences.\n(line   39)\n* bytes (built-in class):                Bytes Objects.      (line   12)\n* bytes (uuid.UUID attribute):           uuid -- UUID objects according to RFC 4122.\n(line   86)\n* bytes literal:                         Literals.           (line    8)\n* bytesle (uuid.UUID attribute):        uuid -- UUID objects according to RFC 4122.\n(line   91)\n* byteswarning (sys.flags attribute):   sys -- System-specific parameters and functions.\n(line  547)\n* bytes-like object:                     Glossary.           (line  200)\n* bytes; formatting:                     printf-style Bytes Formatting.\n(line    6)\n* bytes; interpolation:                  printf-style Bytes Formatting.\n(line    6)\n* bytes; methods:                        Bytes and Bytearray Operations.\n(line    6)\n* bytes; str (built-in class):           Text Sequence Type -- str.\n(line   61)\n* BytesFeedParser (class in email.parser): FeedParser API.   (line   28)\n* BytesGenerator (class in email.generator): email generator Generating MIME documents.\n(line   43)\n* BytesHeaderParser (class in email.parser): Parser API.     (line   68)\n* BytesIO (class in io):                 Buffered Streams.   (line    9)\n* BytesParser (class in email.parser):   Parser API.         (line   18)\n* ByteString (class in collections.abc): Collections Abstract Base Classes - Detailed Descriptions.\n(line   62)\n* ByteString (class in typing):          Aliases to container ABCs in collections abc.\n(line   14)\n* byteswap() (array.array method):       array -- Efficient arrays of numeric values.\n(line  138)\n* byteswap() (in module audioop):        audioop -- Manipulate raw audio data.\n(line   69)\n* BytesWarning:                          Warnings.           (line   76)\n* BZ2Compressor (class in bz2):          Incremental de compression.\n(line    6)\n* BZ2Decompressor (class in bz2):        Incremental de compression.\n(line   33)\n* BZ2File (class in bz2):                De compression of files.\n(line   40)\n* C:                                     String and Bytes literals.\n(line   75)\n* cbool (class in ctypes):              Fundamental data types<2>.\n(line  207)\n* cbyte (class in ctypes):              Fundamental data types<2>.\n(line   45)\n* cchar (class in ctypes):              Fundamental data types<2>.\n(line   51)\n* ccharp (class in ctypes):            Fundamental data types<2>.\n(line   58)\n* CCONTIGUOUS (inspect.BufferFlags attribute): Buffer flags.\n(line   25)\n* ccontiguous (memoryview attribute):   Memory Views.       (line  473)\n* cdouble (class in ctypes):            Fundamental data types<2>.\n(line   65)\n* cfloat (class in ctypes):             Fundamental data types<2>.\n(line   76)\n* cint (class in ctypes):               Fundamental data types<2>.\n(line   81)\n* cint16 (class in ctypes):             Fundamental data types<2>.\n(line   93)\n* cint32 (class in ctypes):             Fundamental data types<2>.\n(line   98)\n* cint64 (class in ctypes):             Fundamental data types<2>.\n(line  103)\n* cint8 (class in ctypes):              Fundamental data types<2>.\n(line   88)\n* clong (class in ctypes):              Fundamental data types<2>.\n(line  108)\n* clongdouble (class in ctypes):        Fundamental data types<2>.\n(line   70)\n* clonglong (class in ctypes):          Fundamental data types<2>.\n(line  113)\n* CRAISE (monitoring event):            Events.             (line   16)\n* CRETURN (monitoring event):           Events.             (line   21)\n* cshort (class in ctypes):             Fundamental data types<2>.\n(line  119)\n* csizet (class in ctypes):            Fundamental data types<2>.\n(line  124)\n* cssizet (class in ctypes):           Fundamental data types<2>.\n(line  128)\n* ctimet (class in ctypes):            Fundamental data types<2>.\n(line  134)\n* cubyte (class in ctypes):             Fundamental data types<2>.\n(line  140)\n* cuint (class in ctypes):              Fundamental data types<2>.\n(line  146)\n* cuint16 (class in ctypes):            Fundamental data types<2>.\n(line  158)\n* cuint32 (class in ctypes):            Fundamental data types<2>.\n(line  163)\n* cuint64 (class in ctypes):            Fundamental data types<2>.\n(line  168)\n* cuint8 (class in ctypes):             Fundamental data types<2>.\n(line  153)\n* culong (class in ctypes):             Fundamental data types<2>.\n(line  173)\n* culonglong (class in ctypes):         Fundamental data types<2>.\n(line  178)\n* cushort (class in ctypes):            Fundamental data types<2>.\n(line  184)\n* cvoidp (class in ctypes):            Fundamental data types<2>.\n(line  189)\n* cwchar (class in ctypes):             Fundamental data types<2>.\n(line  194)\n* cwcharp (class in ctypes):           Fundamental data types<2>.\n(line  201)\n* C-contiguous:                          shape strides suboffsets.\n(line   26)\n* C-contiguous <1>:                      Glossary.           (line  295)\n* C; language:                           The standard type hierarchy.\n(line    6)\n* C; language <1>:                       numbers Real float. (line    6)\n* C; language <2>:                       Built-in functions. (line    6)\n* C; language <3>:                       Comparisons.        (line    6)\n* C; language <4>:                       Numeric Types -- int float complex.\n(line    6)\n* C; structures:                         struct -- Interpret bytes as packed binary data.\n(line    8)\n* C14NWriterTarget (class in xml.etree.ElementTree): TreeBuilder Objects.\n(line   94)\n* CAB (class in msilib):                 CAB Objects.        (line    6)\n* CACHE (opcode):                        Python Bytecode Instructions.\n(line  126)\n* cachefromsource() (in module importlib.util): importlib util - Utility code for importers.\n(line   21)\n* cache() (in module functools):         functools -- Higher-order functions and operations on callable objects.\n(line   16)\n* cached (importlib.machinery.ModuleSpec attribute): importlib machinery - Importers and path hooks.\n(line  422)\n* cachedproperty() (in module functools): functools -- Higher-order functions and operations on callable objects.\n(line   49)\n* CacheFTPHandler (class in urllib.request): urllib request -- Extensible library for opening URLs.\n(line  440)\n* calcobjsize() (in module test.support): test support -- Utilities for the Python test suite.\n(line  434)\n* calcsize() (in module struct):         Functions and Exceptions.\n(line   55)\n* calcvobjsize() (in module test.support): test support -- Utilities for the Python test suite.\n(line  440)\n* Calendar (class in calendar):          calendar -- General calendar-related functions.\n(line   27)\n* calendar command line option; -c:      Command-Line Usage. (line  111)\n* calendar command line option; -css:    Command-Line Usage. (line  111)\n* calendar command line option; -e:      Command-Line Usage. (line   66)\n* calendar command line option; -encoding: Command-Line Usage.\n(line   66)\n* calendar command line option; -h:      Command-Line Usage. (line   57)\n* calendar command line option; -help:   Command-Line Usage. (line   57)\n* calendar command line option; -L:      Command-Line Usage. (line   61)\n* calendar command line option; -l:      Command-Line Usage. (line   94)\n* calendar command line option; -lines:  Command-Line Usage. (line   94)\n* calendar command line option; -locale: Command-Line Usage. (line   61)\n* calendar command line option; -m:      Command-Line Usage. (line  105)\n* calendar command line option; -months: Command-Line Usage. (line  105)\n* calendar command line option; -s:      Command-Line Usage. (line  100)\n* calendar command line option; -spacing: Command-Line Usage.\n(line  100)\n* calendar command line option; -t:      Command-Line Usage. (line   71)\n* calendar command line option; -type:   Command-Line Usage. (line   71)\n* calendar command line option; -w:      Command-Line Usage. (line   88)\n* calendar command line option; -width:  Command-Line Usage. (line   88)\n* calendar command line option; month:   Command-Line Usage. (line   80)\n* calendar command line option; year:    Command-Line Usage. (line   75)\n* calendar() (in module calendar):       calendar -- General calendar-related functions.\n(line  352)\n* call:                                  Slicings.           (line   39)\n* Call (class in ast):                   Expressions<2>.     (line  122)\n* CALL (monitoring event):               Events.             (line   12)\n* CALL (opcode):                         Python Bytecode Instructions.\n(line  949)\n* callargs (unittest.mock.Mock attribute): The Mock Class.  (line  416)\n* callargslist (unittest.mock.Mock attribute): The Mock Class.\n(line  460)\n* callat() (asyncio.loop method):       Scheduling delayed callbacks.\n(line   37)\n* callcount (unittest.mock.Mock attribute): The Mock Class. (line  309)\n* callexceptionhandler() (asyncio.loop method): Error Handling API.\n(line   45)\n* CALLFUNCTIONEX (opcode):             Python Bytecode Instructions.\n(line  983)\n* CALLINTRINSIC1 (opcode):             Python Bytecode Instructions.\n(line 1158)\n* CALLINTRINSIC2 (opcode):             Python Bytecode Instructions.\n(line 1219)\n* calllater() (asyncio.loop method):    Scheduling delayed callbacks.\n(line   10)\n* calllist() (unittest.mock.call method): call.             (line   20)\n* callsoonthreadsafe() (asyncio.loop method): Scheduling callbacks.\n(line   24)\n* callsoon() (asyncio.loop method):     Scheduling callbacks.\n(line    6)\n* calltracing() (in module sys):        sys -- System-specific parameters and functions.\n(line  165)\n* call; instance:                        Emulating callable objects.\n(line    8)\n* call() (in module operator):           operator -- Standard operators as functions.\n(line  221)\n* call() (in module subprocess):         Older high-level API.\n(line   10)\n* call() (in module unittest.mock):      call.               (line    6)\n* callable:                              Glossary.           (line  234)\n* Callable (class in collections.abc):   Collections Abstract Base Classes - Detailed Descriptions.\n(line   19)\n* Callable (in module typing):           Aliases to other ABCs in collections abc.\n(line   22)\n* CallableProxyType (in module weakref): weakref -- Weak references.\n(line  340)\n* callback:                              Glossary.           (line  245)\n* callback (optparse.Option attribute):  Option attributes.  (line   68)\n* callbackargs (optparse.Option attribute): Option attributes.\n(line   74)\n* callbackkwargs (optparse.Option attribute): Option attributes.\n(line   74)\n* callback() (contextlib.ExitStack method): Utilities.       (line  582)\n* callbacks (in module gc):              gc -- Garbage Collector interface.\n(line  258)\n* called (unittest.mock.Mock attribute): The Mock Class.     (line  297)\n* CalledProcessError:                    Using the subprocess Module.\n(line  205)\n* calloc (C function):                   Overview<4>.        (line   33)\n* CAN (in module curses.ascii):          curses ascii -- Utilities for ASCII characters.\n(line   97)\n* CANBCM (in module socket):            Constants<8>.       (line  137)\n* canchangecolor() (in module curses): Functions<6>.       (line   30)\n* canfetch() (urllib.robotparser.RobotFileParser method): urllib robotparser -- Parser for robots txt.\n(line   33)\n* CANISOTP (in module socket):          Constants<8>.       (line  176)\n* CANJ1939 (in module socket):          Constants<8>.       (line  185)\n* CANRAWFDFRAMES (in module socket):  Constants<8>.       (line  152)\n* CANRAWJOINFILTERS (in module socket): Constants<8>.     (line  165)\n* cansymlink() (in module test.support.oshelper): test support oshelper -- Utilities for os tests.\n(line   75)\n* canwriteeof() (asyncio.StreamWriter method): StreamWriter.\n(line   47)\n* canwriteeof() (asyncio.WriteTransport method): Write-only Transports.\n(line   14)\n* canxattr() (in module test.support.oshelper): test support oshelper -- Utilities for os tests.\n(line   79)\n* CANCEL (in module tkinter.messagebox): tkinter messagebox -- Tkinter message prompts.\n(line  155)\n* cancelcommand() (tkinter.filedialog.FileDialog method): Native Load/Save Dialogs.\n(line   82)\n* canceldumptracebacklater() (in module faulthandler): Dumping the tracebacks after a timeout.\n(line   29)\n* canceljointhread() (multiprocessing.Queue method): Pipes and Queues.\n(line  182)\n* cancel() (asyncio.Future method):      Future Object.      (line  113)\n* cancel() (asyncio.Handle method):      Callback Handles.   (line   18)\n* cancel() (asyncio.Task method):        Task Object.        (line  199)\n* cancel() (concurrent.futures.Future method): Future Objects.\n(line   16)\n* cancel() (sched.scheduler method):     Scheduler Objects.  (line   41)\n* cancel() (threading.Timer method):     Timer Objects.      (line   35)\n* cancel() (tkinter.dnd.DndHandler method): tkinter dnd -- Drag and drop support.\n(line   48)\n* cancelled() (asyncio.Future method):   Future Object.      (line   71)\n* cancelled() (asyncio.Handle method):   Callback Handles.   (line   23)\n* cancelled() (asyncio.Task method):     Task Object.        (line  260)\n* cancelled() (concurrent.futures.Future method): Future Objects.\n(line   23)\n* CancelledError:                        Exception classes.  (line    6)\n* CancelledError <1>:                    Exceptions<11>.     (line   18)\n* cancelling() (asyncio.Task method):    Task Object.        (line  309)\n* CannotSendHeader:                      http client -- HTTP protocol client.\n(line  170)\n* CannotSendRequest:                     http client -- HTTP protocol client.\n(line  166)\n* canonic() (bdb.Bdb method):            bdb -- Debugger framework.\n(line  149)\n* canonical() (decimal.Context method):  Context objects.    (line  257)\n* canonical() (decimal.Decimal method):  Decimal objects.    (line  141)\n* canonicalize() (in module xml.etree.ElementTree): Functions<9>.\n(line    6)\n* capa() (poplib.POP3 method):           POP3 Objects.       (line   24)\n* capitalize() (bytearray method):       Bytes and Bytearray Operations.\n(line  471)\n* capitalize() (bytes method):           Bytes and Bytearray Operations.\n(line  471)\n* capitalize() (str method):             String Methods<2>.  (line   22)\n* capturedstderr() (in module test.support): test support -- Utilities for the Python test suite.\n(line  328)\n* capturedstdin() (in module test.support): test support -- Utilities for the Python test suite.\n(line  328)\n* capturedstdout() (in module test.support): test support -- Utilities for the Python test suite.\n(line  328)\n* captureWarnings() (in module logging): Integration with the warnings module.\n(line    9)\n* capwords() (in module string):         Helper functions.   (line    6)\n* case block:                            Irrefutable Case Blocks.\n(line    6)\n* casefold() (str method):               String Methods<2>.  (line   32)\n* cast() (in module ctypes):             Utility functions.  (line   33)\n* cast() (in module typing):             Functions and decorators.\n(line    6)\n* cast() (memoryview method):            Memory Views.       (line  273)\n* cat() (in module nis):                 nis -- Interface to Sun's NIS Yellow Pages.\n(line   38)\n* catchthreadingexception() (in module test.support.threadinghelper): test support threadinghelper -- Utilities for threading tests.\n(line   47)\n* catchunraisableexception() (in module test.support): test support -- Utilities for the Python test suite.\n(line  591)\n* catchwarnings (class in warnings):    Available Context Managers.\n(line    6)\n* category() (in module unicodedata):    unicodedata -- Unicode Database.\n(line   49)\n* cbreak() (in module curses):           Functions<6>.       (line   35)\n* cbrt() (in module math):               Power and logarithmic functions.\n(line    6)\n* CC:                                    New Improved and Deprecated Modules<4>.\n(line   58)\n* ccc() (ftplib.FTPTLS method):         FTPTLS objects.    (line   98)\n* cdf() (statistics.NormalDist method):  NormalDist objects. (line   80)\n* CDLL (class in ctypes):                Loading shared libraries.\n(line    9)\n* ceil() (in module math):               Numeric Types -- int float complex.\n(line  107)\n* ceil() (in module math) <1>:           Number-theoretic and representation functions.\n(line    6)\n* CellType (in module types):            Standard Interpreter Types.\n(line   70)\n* center() (bytearray method):           Bytes and Bytearray Operations.\n(line  291)\n* center() (bytes method):               Bytes and Bytearray Operations.\n(line  291)\n* center() (str method):                 String Methods<2>.  (line   48)\n* CERTNONE (in module ssl):             Constants<9>.       (line   11)\n* CERTOPTIONAL (in module ssl):         Constants<9>.       (line   24)\n* CERTREQUIRED (in module ssl):         Constants<9>.       (line   40)\n* certstorestats() (ssl.SSLContext method): SSL Contexts.  (line   78)\n* certtimetoseconds() (in module ssl): Certificate handling.\n(line    6)\n* CertificateError:                      Exceptions<14>.     (line   94)\n* certificates:                          SSL Contexts.       (line  650)\n* CFLAGS:                                New Improved and Deprecated Modules<4>.\n(line   59)\n* CFLAGS <1>:                            Compiler flags.     (line   26)\n* CFLAGS <2>:                            Compiler flags.     (line   28)\n* CFLAGS <3>:                            Compiler flags.     (line   32)\n* CFLAGS <4>:                            Compiler flags.     (line   54)\n* CFLAGS <5>:                            Linker flags.       (line   18)\n* CFLAGSNODIST:                         Compiler flags.     (line   24)\n* CFLAGSNODIST <1>:                     Compiler flags.     (line   61)\n* CFLAGSNODIST <2>:                     Linker flags.       (line   26)\n* cfmakecbreak() (in module tty):        tty -- Terminal control functions.\n(line   28)\n* cfmakeraw() (in module tty):           tty -- Terminal control functions.\n(line   20)\n* CFUNCTYPE() (in module ctypes):        Function prototypes.\n(line   15)\n* cget() (tkinter.font.Font method):     tkinter font -- Tkinter font wrapper.\n(line   51)\n* cgidirectories (http.server.CGIHTTPRequestHandler attribute): http server -- HTTP servers.\n(line  507)\n* CGI; debugging:                        Debugging CGI scripts.\n(line    6)\n* CGI; exceptions:                       cgitb -- Traceback manager for CGI scripts.\n(line    8)\n* CGI; protocol:                         cgi -- Common Gateway Interface support.\n(line    8)\n* CGI; security:                         Caring about security.\n(line    6)\n* CGI; tracebacks:                       cgitb -- Traceback manager for CGI scripts.\n(line    8)\n* CGIHandler (class in wsgiref.handlers): wsgiref handlers - server/gateway base classes.\n(line   11)\n* CGIHTTPRequestHandler (class in http.server): http server -- HTTP servers.\n(line  481)\n* CGIXMLRPCRequestHandler (class in xmlrpc.server): xmlrpc server -- Basic XML-RPC servers.\n(line   51)\n* chain() (in module itertools):         Itertool Functions. (line  106)\n* chaining; comparisons:                 Comparisons.        (line   19)\n* chaining; comparisons <1>:             Comparisons<2>.     (line    6)\n* ChainMap (class in collections):       ChainMap objects.   (line   16)\n* ChainMap (class in typing):            Aliases to types in collections.\n(line   28)\n* changecwd() (in module test.support.oshelper): test support oshelper -- Utilities for os tests.\n(line   83)\n* CHANNELBINDINGTYPES (in module ssl): Constants<9>.       (line  464)\n* channels() (ossaudiodev.ossaudiodevice method): Audio Device Objects.\n(line  133)\n* CHARMAX (in module locale):           locale -- Internationalization services.\n(line  575)\n* character:                             Immutable sequences.\n(line   15)\n* character <1>:                         Subscriptions.      (line   55)\n* character <2>:                         unicodedata -- Unicode Database.\n(line    6)\n* CharacterDataHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line  278)\n* characterswritten (BlockingIOError attribute): OS exceptions.\n(line   19)\n* characters() (xml.sax.handler.ContentHandler method): ContentHandler Objects.\n(line  129)\n* Charset (class in email.charset):      email charset Representing character sets.\n(line   24)\n* charset() (gettext.NullTranslations method): The NullTranslations class.\n(line   68)\n* chdir() (in module contextlib):        Utilities.          (line  364)\n* chdir() (in module os):                Files and Directories.\n(line  115)\n* check (lzma.LZMADecompressor attribute): Compressing and decompressing data in memory.\n(line  159)\n* checkall() (in module test.support): test support -- Utilities for the Python test suite.\n(line  671)\n* checkcall() (in module subprocess):   Older high-level API.\n(line   42)\n* checkdisallowinstantiation() (in module test.support): test support -- Utilities for the Python test suite.\n(line  725)\n* CHECKEGMATCH (opcode):               Python Bytecode Instructions.\n(line  413)\n* CHECKEXCMATCH (opcode):              Python Bytecode Instructions.\n(line  405)\n* checkfreeafteriterating() (in module test.support): test support -- Utilities for the Python test suite.\n(line  659)\n* checkhostname (ssl.SSLContext attribute): SSL Contexts.   (line  482)\n* checkimpldetail() (in module test.support): test support -- Utilities for the Python test suite.\n(line  292)\n* checknoresourcewarning() (in module test.support.warningshelper): test support warningshelper -- Utilities for warnings tests.\n(line   25)\n* checkoutput() (doctest.OutputChecker method): OutputChecker objects.\n(line   17)\n* checkoutput() (in module subprocess): Older high-level API.\n(line   78)\n* checkreturncode() (subprocess.CompletedProcess method): Using the subprocess Module.\n(line  134)\n* checksyntaxerror() (in module test.support): test support -- Utilities for the Python test suite.\n(line  565)\n* checksyntaxwarning() (in module test.support.warningshelper): test support warningshelper -- Utilities for warnings tests.\n(line   32)\n* checkunusedargs() (string.Formatter method): Custom String Formatting.\n(line   91)\n* checkwarnings() (in module test.support.warningshelper): test support warningshelper -- Utilities for warnings tests.\n(line   48)\n* check() (imaplib.IMAP4 method):        IMAP4 Objects.      (line   58)\n* check() (in module tabnanny):          tabnanny -- Detection of ambiguous indentation.\n(line   17)\n* checkbox() (msilib.Dialog method):     GUI classes.        (line   76)\n* checkcache() (in module linecache):    linecache -- Random access to text lines.\n(line   43)\n* CHECKEDHASH (pycompile.PycInvalidationMode attribute): pycompile -- Compile Python source files.\n(line  109)\n* checkfuncname() (in module bdb):       bdb -- Debugger framework.\n(line  447)\n* CheckList (class in tkinter.tix):      Hierarchical ListBox.\n(line   13)\n* checksizeof() (in module test.support): test support -- Utilities for the Python test suite.\n(line  446)\n* checksum; Cyclic Redundancy Check:     zlib -- Compression compatible with gzip.\n(line  123)\n* chflags() (in module os):              Files and Directories.\n(line  134)\n* chgat() (curses.window method):        Window Objects.     (line  136)\n* childNodes (xml.dom.Node attribute):   Node Objects.       (line   49)\n* ChildProcessError:                     OS exceptions.      (line   25)\n* children (pyclbr.Class attribute):     Class Objects<2>.   (line   34)\n* children (pyclbr.Function attribute):  Function Objects.   (line   34)\n* children (tkinter.Tk attribute):       Tkinter Modules.    (line   88)\n* chksum (tarfile.TarInfo attribute):    TarInfo Objects.    (line  137)\n* chmod() (in module os):                Files and Directories.\n(line  175)\n* chmod() (pathlib.Path method):         Methods<2>.         (line   54)\n* choice() (in module random):           Functions for sequences.\n(line    6)\n* choice() (in module secrets):          Random numbers.     (line   15)\n* choices (optparse.Option attribute):   Option attributes.  (line   63)\n* choices() (in module random):          Functions for sequences.\n(line   11)\n* Chooser (class in tkinter.colorchooser): tkinter colorchooser -- Color choosing dialog.\n(line   15)\n* chown() (in module os):                Files and Directories.\n(line  240)\n* chown() (in module shutil):            Directory and files operations.\n(line  384)\n* chroot() (in module os):               Files and Directories.\n(line  266)\n* CHRTYPE (in module tarfile):           tarfile -- Read and write tar archive files.\n(line  291)\n* Chunk (class in chunk):                chunk -- Read IFF chunked data.\n(line   52)\n* cipher; DES:                           crypt -- Function to check Unix passwords.\n(line    8)\n* cipher() (ssl.SSLSocket method):       SSL Sockets.        (line  213)\n* circle() (in module turtle):           Turtle motion.      (line  211)\n* CIRCUMFLEX (in module token):          token -- Constants used with Python parse trees.\n(line  154)\n* CIRCUMFLEXEQUAL (in module token):     token -- Constants used with Python parse trees.\n(line  198)\n* Clamped (class in decimal):            Signals.            (line   20)\n* class:                                 Glossary.           (line  250)\n* Class (class in pyclbr):               Class Objects<2>.   (line    6)\n* Class (class in symtable):             Examining Symbol Tables.\n(line  102)\n* class instance; attribute:             Class instances.    (line    6)\n* class instance; attribute; assignment: Class instances.    (line   21)\n* class instance; call:                  Calls.              (line  150)\n* class object; call:                    Custom classes.     (line   20)\n* class object; call <1>:                Custom classes.     (line   32)\n* class object; call <2>:                Calls.              (line  146)\n* class variable:                        Glossary.           (line  256)\n* class; attribute:                      Custom classes.     (line   20)\n* class; attribute; assignment:          Custom classes.     (line   29)\n* class; body:                           Executing the class body.\n(line    6)\n* class; constructor:                    Basic customization.\n(line   39)\n* class; definition:                     The return statement.\n(line    6)\n* class; definition <1>:                 Class definitions.  (line    6)\n* class; instance:                       Class instances.    (line    6)\n* class; name:                           Class definitions.  (line    6)\n* ClassDef (class in ast):               Function and class definitions.\n(line  182)\n* ClassMethodDescriptorType (in module types): Standard Interpreter Types.\n(line  116)\n* ClassVar (in module typing):           Special forms.      (line  158)\n* clause:                                Compound statements.\n(line   18)\n* CLDCONTINUED (in module os):          Process Management. (line 1035)\n* CLDDUMPED (in module os):             Process Management. (line 1035)\n* CLDEXITED (in module os):             Process Management. (line 1035)\n* CLDKILLED (in module os):             Process Management. (line 1035)\n* CLDSTOPPED (in module os):            Process Management. (line 1035)\n* CLDTRAPPED (in module os):            Process Management. (line 1035)\n* clean() (mailbox.Maildir method):      Maildir objects.    (line   83)\n* cleandoc() (in module inspect):        Retrieving source code.\n(line   71)\n* CleanImport (class in test.support.importhelper): test support importhelper -- Utilities for import tests.\n(line   87)\n* cleanup functions:                     Process Control.    (line   33)\n* CLEANUPTHROW (opcode):                Python Bytecode Instructions.\n(line  291)\n* cleanup() (tempfile.TemporaryDirectory method): tempfile -- Generate temporary files and directories.\n(line  202)\n* clear (pdb command):                   Debugger Commands.  (line  116)\n* Clear Breakpoint:                      Help menu Shell and Editor.\n(line   30)\n* clearallbreaks() (bdb.Bdb method):   bdb -- Debugger framework.\n(line  361)\n* clearallfilebreaks() (bdb.Bdb method): bdb -- Debugger framework.\n(line  356)\n* clearbpbynumber() (bdb.Bdb method):   bdb -- Debugger framework.\n(line  350)\n* clearbreak() (bdb.Bdb method):        bdb -- Debugger framework.\n(line  345)\n* clearcache() (in module filecmp):     filecmp -- File and Directory Comparisons.\n(line   56)\n* clearcache() (zoneinfo.ZoneInfo class method): The ZoneInfo class.\n(line   58)\n* clearcontent() (email.message.EmailMessage method): email message Representing an email message.\n(line  672)\n* clearflags() (decimal.Context method): Context objects.   (line  171)\n* clearframes() (in module traceback):  traceback -- Print or retrieve a stack traceback.\n(line  183)\n* clearhistory() (in module readline):  History list.       (line    8)\n* clearoverloads() (in module typing):  Functions and decorators.\n(line  303)\n* clearsessioncookies() (http.cookiejar.CookieJar method): CookieJar and FileCookieJar Objects.\n(line   90)\n* cleartraces() (in module tracemalloc): Functions<11>.     (line    6)\n* cleartraps() (decimal.Context method): Context objects.   (line  175)\n* clear() (asyncio.Event method):        Event.              (line   58)\n* clear() (collections.deque method):    deque objects.      (line   43)\n* clear() (curses.window method):        Window Objects.     (line  152)\n* clear() (dict method):                 Mapping Types -- dict.\n(line  135)\n* clear() (email.message.EmailMessage method): email message Representing an email message.\n(line  668)\n* clear() (frame method):                Frame object methods.\n(line    8)\n* clear() (frozenset method):            Set Types -- set frozenset.\n(line  213)\n* clear() (http.cookiejar.CookieJar method): CookieJar and FileCookieJar Objects.\n(line   78)\n* clear() (in module turtle):            More drawing control.\n(line   23)\n* clear() (mailbox.Mailbox method):      Mailbox objects.    (line  212)\n* clear() (sequence method):             Mutable Sequence Types.\n(line   16)\n* clear() (threading.Event method):      Event Objects.      (line   36)\n* clear() (xml.etree.ElementTree.Element method): Element Objects.\n(line   58)\n* clearcache() (in module linecache):    linecache -- Random access to text lines.\n(line   38)\n* ClearData() (msilib.Record method):    Record Objects.     (line   37)\n* clearok() (curses.window method):      Window Objects.     (line  157)\n* clearscreen() (in module turtle):      Window control.     (line   46)\n* clearstamp() (in module turtle):       Turtle motion.      (line  282)\n* clearstamps() (in module turtle):      Turtle motion.      (line  301)\n* clientaddress (http.server.BaseHTTPRequestHandler attribute): http server -- HTTP servers.\n(line   72)\n* clientaddress (socketserver.BaseRequestHandler attribute): Request Handler Objects.\n(line   47)\n* Client() (in module multiprocessing.connection): Listeners and Clients.\n(line   34)\n* CLOCKBOOTTIME (in module time):       Clock ID Constants. (line    9)\n* clockgetres() (in module time):       Functions<5>.       (line   40)\n* clockgettimens() (in module time):   Functions<5>.       (line   63)\n* clockgettime() (in module time):      Functions<5>.       (line   50)\n* CLOCKHIGHRES (in module time):        Clock ID Constants. (line   23)\n* CLOCKMONOTONIC (in module time):      Clock ID Constants. (line   34)\n* CLOCKMONOTONICRAW (in module time):  Clock ID Constants. (line   43)\n* CLOCKPROCESSCPUTIMEID (in module time): Clock ID Constants.\n(line   52)\n* CLOCKPROF (in module time):           Clock ID Constants. (line   60)\n* CLOCKREALTIME (in module time):       Clock ID Constants. (line  111)\n* clockseq (uuid.UUID attribute):       uuid -- UUID objects according to RFC 4122.\n(line  125)\n* clockseqhivariant (uuid.UUID attribute): uuid -- UUID objects according to RFC 4122.\n(line  113)\n* clockseqlow (uuid.UUID attribute):   uuid -- UUID objects according to RFC 4122.\n(line  116)\n* clocksettimens() (in module time):   Functions<5>.       (line   84)\n* clocksettime() (in module time):      Functions<5>.       (line   72)\n* CLOCKTAI (in module time):            Clock ID Constants. (line   68)\n* CLOCKTHREADCPUTIMEID (in module time): Clock ID Constants.\n(line   80)\n* CLOCKUPTIME (in module time):         Clock ID Constants. (line   88)\n* CLOCKUPTIMERAW (in module time):     Clock ID Constants. (line   98)\n* CLONEFILES (in module os):            Process Parameters. (line  623)\n* CLONEFS (in module os):               Process Parameters. (line  623)\n* CLONENEWCGROUP (in module os):        Process Parameters. (line  623)\n* CLONENEWIPC (in module os):           Process Parameters. (line  623)\n* CLONENEWNET (in module os):           Process Parameters. (line  623)\n* CLONENEWNS (in module os):            Process Parameters. (line  623)\n* CLONENEWPID (in module os):           Process Parameters. (line  623)\n* CLONENEWTIME (in module os):          Process Parameters. (line  623)\n* CLONENEWUSER (in module os):          Process Parameters. (line  623)\n* CLONENEWUTS (in module os):           Process Parameters. (line  623)\n* CLONESIGHAND (in module os):          Process Parameters. (line  623)\n* CLONESYSVSEM (in module os):          Process Parameters. (line  623)\n* CLONETHREAD (in module os):           Process Parameters. (line  623)\n* CLONEVM (in module os):               Process Parameters. (line  623)\n* clone() (email.generator.BytesGenerator method): email generator Generating MIME documents.\n(line  112)\n* clone() (email.generator.Generator method): email generator Generating MIME documents.\n(line  208)\n* clone() (email.policy.Policy method):  email policy Policy Objects.\n(line  223)\n* clone() (in module turtle):            Special Turtle methods.\n(line   32)\n* clone() (pipes.Template method):       Template Objects.   (line   12)\n* cloneNode() (xml.dom.Node method):     Node Objects.       (line  147)\n* close (in module os):                  Sub-interpreter support.\n(line  192)\n* closeconnection (http.server.BaseHTTPRequestHandler attribute): http server -- HTTP servers.\n(line   81)\n* close() (aifc.aifc method):            aifc -- Read and write AIFF and AIFC files.\n(line  119)\n* close() (asyncio.AbstractChildWatcher method): Process Watchers.\n(line   81)\n* close() (asyncio.BaseTransport method): Base Transport.    (line    6)\n* close() (asyncio.loop method):         Running and stopping the loop.\n(line   43)\n* close() (asyncio.Runner method):       Runner context manager.\n(line   49)\n* close() (asyncio.Server method):       Server Objects.     (line   32)\n* close() (asyncio.StreamWriter method): StreamWriter.       (line   37)\n* close() (asyncio.SubprocessTransport method): Subprocess Transports.\n(line   59)\n* close() (chunk.Chunk method):          chunk -- Read IFF chunked data.\n(line   81)\n* close() (contextlib.ExitStack method): Utilities.          (line  614)\n* close() (coroutine method):            Coroutine Objects.  (line   50)\n* close() (dbm.dumb.dumbdbm method):     dbm dumb -- Portable DBM implementation.\n(line   84)\n* close() (dbm.gnu.gdbm method):         dbm gnu -- GNU database manager.\n(line  113)\n* close() (dbm.ndbm.ndbm method):        dbm ndbm -- New Database Manager.\n(line   66)\n* close() (email.parser.BytesFeedParser method): FeedParser API.\n(line   65)\n* close() (ftplib.FTP method):           FTP objects.        (line  369)\n* close() (generator method):            Generator-iterator methods.\n(line   65)\n* close() (html.parser.HTMLParser method): HTMLParser Methods.\n(line   15)\n* close() (http.client.HTTPConnection method): HTTPConnection Objects.\n(line  152)\n* close() (imaplib.IMAP4 method):        IMAP4 Objects.      (line   62)\n* close() (in module fileinput):         fileinput -- Iterate over lines from multiple input streams.\n(line  132)\n* close() (in module os):                File Descriptor Operations.\n(line   21)\n* close() (in module socket):            Other functions<2>. (line    9)\n* close() (io.IOBase method):            I/O Base Classes.   (line   48)\n* close() (logging.FileHandler method):  FileHandler.        (line   27)\n* close() (logging.Handler method):      Handler Objects.    (line   73)\n* close() (logging.handlers.MemoryHandler method): MemoryHandler.\n(line   56)\n* close() (logging.handlers.NTEventLogHandler method): NTEventLogHandler.\n(line   29)\n* close() (logging.handlers.SocketHandler method): SocketHandler.\n(line   20)\n* close() (logging.handlers.SysLogHandler method): SysLogHandler.\n(line   46)\n* close() (mailbox.Mailbox method):      Mailbox objects.    (line  269)\n* close() (mailbox.Maildir method):      Maildir objects.    (line  114)\n* close() (mailbox.MH method):           MH objects.         (line  104)\n* close() (mmap.mmap method):            mmap -- Memory-mapped file support.\n(line  176)\n* Close() (msilib.Database method):      Database Objects.   (line   22)\n* Close() (msilib.View method):          View Objects.       (line   35)\n* close() (multiprocessing.connection.Connection method): Connection Objects.\n(line   35)\n* close() (multiprocessing.connection.Listener method): Listeners and Clients.\n(line   91)\n* close() (multiprocessing.pool.Pool method): Process Pools. (line  168)\n* close() (multiprocessing.Process method): Process and exceptions.\n(line  196)\n* close() (multiprocessing.Queue method): Pipes and Queues.  (line  163)\n* close() (multiprocessing.sharedmemory.SharedMemory method): multiprocessing sharedmemory -- Shared memory for direct access across processes.\n(line   71)\n* close() (multiprocessing.SimpleQueue method): Pipes and Queues.\n(line  209)\n* close() (os.scandir method):           Files and Directories.\n(line  860)\n* close() (ossaudiodev.ossaudiodevice method): Audio Device Objects.\n(line   22)\n* close() (ossaudiodev.ossmixerdevice method): Mixer Device Objects.\n(line    8)\n* close() (select.devpoll method):       /dev/poll Polling Objects.\n(line   12)\n* close() (select.epoll method):         Edge and Level Trigger Polling epoll Objects.\n(line   65)\n* close() (select.kqueue method):        Kqueue Objects.     (line    6)\n* close() (selectors.BaseSelector method): Classes<4>.       (line  137)\n* close() (shelve.Shelf method):         shelve -- Python object persistence.\n(line   77)\n* close() (socket.socket method):        Socket Objects.     (line   41)\n* close() (sqlite3.Blob method):         Blob objects.       (line   37)\n* close() (sqlite3.Connection method):   Connection objects. (line   84)\n* close() (sqlite3.Cursor method):       Cursor objects.     (line  153)\n* close() (sunau.AUread method):        AUread Objects.    (line    9)\n* close() (sunau.AUwrite method):       AUwrite Objects.   (line   59)\n* close() (tarfile.TarFile method):      TarFile Objects.    (line  311)\n* close() (telnetlib.Telnet method):     Telnet Objects.     (line   88)\n* close() (urllib.request.BaseHandler method): BaseHandler Objects.\n(line   14)\n* close() (wave.Waveread method):       Waveread Objects.  (line   13)\n* close() (wave.Wavewrite method):      Wavewrite Objects. (line   29)\n* Close() (winreg.PyHKEY method):        Registry Handle Objects.\n(line   34)\n* close() (xml.etree.ElementTree.TreeBuilder method): TreeBuilder Objects.\n(line   28)\n* close() (xml.etree.ElementTree.XMLParser method): XMLParser Objects.\n(line   20)\n* close() (xml.etree.ElementTree.XMLPullParser method): XMLPullParser Objects.\n(line   41)\n* close() (xml.sax.xmlreader.IncrementalParser method): IncrementalParser Objects.\n(line   13)\n* close() (zipfile.ZipFile method):      ZipFile Objects.    (line  107)\n* closed (http.client.HTTPResponse attribute): HTTPResponse Objects.\n(line   75)\n* closed (io.IOBase attribute):          I/O Base Classes.   (line   58)\n* closed (mmap.mmap attribute):          mmap -- Memory-mapped file support.\n(line  182)\n* closed (ossaudiodev.ossaudiodevice attribute): Audio Device Objects.\n(line  230)\n* closed (select.devpoll attribute):     /dev/poll Polling Objects.\n(line   18)\n* closed (select.epoll attribute):       Edge and Level Trigger Polling epoll Objects.\n(line   69)\n* closed (select.kqueue attribute):      Kqueue Objects.     (line   10)\n* CloseKey() (in module winreg):         Functions<13>.      (line    8)\n* closelog() (in module syslog):         syslog -- Unix syslog library routines.\n(line   78)\n* closerange() (in module os):           File Descriptor Operations.\n(line   32)\n* closing() (in module contextlib):      Utilities.          (line  153)\n* clrtobot() (curses.window method):     Window Objects.     (line  162)\n* clrtoeol() (curses.window method):     Window Objects.     (line  168)\n* Cmd (class in cmd):                    cmd -- Support for line-oriented command interpreters.\n(line   15)\n* cmd (subprocess.CalledProcessError attribute): Using the subprocess Module.\n(line  216)\n* cmd (subprocess.TimeoutExpired attribute): Using the subprocess Module.\n(line  173)\n* cmdloop() (cmd.Cmd method):            Cmd Objects.        (line    8)\n* cmdqueue (cmd.Cmd attribute):          Cmd Objects.        (line  143)\n* cmpop (in module dis):                Opcode collections. (line   21)\n* cmptokey() (in module functools):    functools -- Higher-order functions and operations on callable objects.\n(line  118)\n* cmp() (in module filecmp):             filecmp -- File and Directory Comparisons.\n(line   16)\n* cmpfiles() (in module filecmp):        filecmp -- File and Directory Comparisons.\n(line   36)\n* CMSGLEN() (in module socket):         Other functions<2>. (line  308)\n* CMSGSPACE() (in module socket):       Other functions<2>. (line  325)\n* coargcount (code object attribute):   Code objects.       (line   16)\n* coargcount (codeobject attribute):    Special read-only attributes<2>.\n(line   14)\n* COASYNCGENERATOR (in module inspect): Code Objects Bit Flags.\n(line   52)\n* cocellvars (code object attribute):   Code objects.       (line   16)\n* cocellvars (codeobject attribute):    Special read-only attributes<2>.\n(line   39)\n* cocode (code object attribute):       Code objects.       (line   16)\n* cocode (codeobject attribute):        Special read-only attributes<2>.\n(line   48)\n* coconsts (code object attribute):     Code objects.       (line   16)\n* coconsts (codeobject attribute):      Special read-only attributes<2>.\n(line   52)\n* COCOROUTINE (in module inspect):      Code Objects Bit Flags.\n(line   35)\n* cofilename (code object attribute):   Code objects.       (line   16)\n* cofilename (codeobject attribute):    Special read-only attributes<2>.\n(line   60)\n* cofirstlineno (code object attribute): Code objects.      (line   16)\n* cofirstlineno (codeobject attribute): Special read-only attributes<2>.\n(line   64)\n* coflags (code object attribute):      Code objects.       (line   16)\n* coflags (codeobject attribute):       Special read-only attributes<2>.\n(line   79)\n* cofreevars (code object attribute):   Code objects.       (line   16)\n* cofreevars (codeobject attribute):    Special read-only attributes<2>.\n(line   44)\n* COFUTUREDIVISION (C var):            The Very High Level Layer.\n(line  377)\n* COGENERATOR (in module inspect):      Code Objects Bit Flags.\n(line   30)\n* COITERABLECOROUTINE (in module inspect): Code Objects Bit Flags.\n(line   43)\n* cokwonlyargcount (code object attribute): Code objects.   (line   16)\n* cokwonlyargcount (codeobject attribute): Special read-only attributes<2>.\n(line   25)\n* colines() (codeobject method):        Methods on code objects.\n(line   43)\n* colnotab (code object attribute):     Code objects.       (line   16)\n* colnotab (codeobject attribute):      Special read-only attributes<2>.\n(line   67)\n* coname (code object attribute):       Code objects.       (line   16)\n* coname (codeobject attribute):        Special read-only attributes<2>.\n(line    6)\n* conames (code object attribute):      Code objects.       (line   16)\n* conames (codeobject attribute):       Special read-only attributes<2>.\n(line   56)\n* CONESTED (in module inspect):         Code Objects Bit Flags.\n(line   26)\n* CONEWLOCALS (in module inspect):      Code Objects Bit Flags.\n(line   13)\n* conlocals (code object attribute):    Code objects.       (line   16)\n* conlocals (codeobject attribute):     Special read-only attributes<2>.\n(line   30)\n* COOPTIMIZED (in module inspect):      Code Objects Bit Flags.\n(line    9)\n* copositions() (codeobject method):    Methods on code objects.\n(line    6)\n* coposonlyargcount (code object attribute): Code objects.  (line   16)\n* coposonlyargcount (codeobject attribute): Special read-only attributes<2>.\n(line   20)\n* coqualname (code object attribute):   Code objects.       (line   16)\n* coqualname (codeobject attribute):    Special read-only attributes<2>.\n(line    9)\n* costacksize (code object attribute):  Code objects.       (line   16)\n* costacksize (codeobject attribute):   Special read-only attributes<2>.\n(line   76)\n* COVARARGS (in module inspect):        Code Objects Bit Flags.\n(line   18)\n* COVARKEYWORDS (in module inspect):    Code Objects Bit Flags.\n(line   22)\n* covarnames (code object attribute):   Code objects.       (line   16)\n* covarnames (codeobject attribute):    Special read-only attributes<2>.\n(line   34)\n* code (SystemExit attribute):           Concrete exceptions.\n(line  376)\n* code (urllib.error.HTTPError attribute): urllib error -- Exception classes raised by urllib request.\n(line   42)\n* code (urllib.response.addinfourl attribute): urllib response -- Response classes used by urllib.\n(line   40)\n* code (xml.etree.ElementTree.ParseError attribute): Exceptions<17>.\n(line   14)\n* code (xml.parsers.expat.ExpatError attribute): ExpatError Exceptions.\n(line    9)\n* code object:                           Code objects.       (line    6)\n* code object <1>:                       Methods.            (line   43)\n* code object <2>:                       marshal -- Internal Python object serialization.\n(line   30)\n* code object <3>:                       Cell Objects.       (line   54)\n* codecontext (inspect.FrameInfo attribute): The interpreter stack.\n(line   32)\n* codecontext (inspect.Traceback attribute): The interpreter stack.\n(line   72)\n* codeinfo() (in module dis):           Analysis functions. (line   11)\n* code; block:                           Execution model.    (line    6)\n* Codec (class in codecs):               Stateless Encoding and Decoding.\n(line    9)\n* CodecInfo (class in codecs):           codecs -- Codec registry and base classes.\n(line   58)\n* Codecs:                                codecs -- Codec registry and base classes.\n(line    8)\n* Codecs; decode:                        codecs -- Codec registry and base classes.\n(line    8)\n* Codecs; encode:                        codecs -- Codec registry and base classes.\n(line    8)\n* codedvalue (http.cookies.Morsel attribute): Morsel Objects.\n(line   50)\n* codepoint2name (in module html.entities): html entities -- Definitions of HTML general entities.\n(line   35)\n* codes (in module xml.parsers.expat.errors): Expat error constants.\n(line   16)\n* CODESET (in module locale):            locale -- Internationalization services.\n(line  184)\n* CodeType (class in types):             Standard Interpreter Types.\n(line   56)\n* coding; style:                         Intermezzo Coding Style.\n(line    6)\n* coloffset (ast.AST attribute):        Node classes.       (line   39)\n* collapseaddresses() (in module ipaddress): Other Module Level Functions.\n(line   43)\n* collapserfc2231value() (in module email.utils): email utils Miscellaneous utilities.\n(line  200)\n* collect() (in module gc):              gc -- Garbage Collector interface.\n(line   34)\n* collectedDurations (unittest.TestResult attribute): Loading and running tests.\n(line  272)\n* Collection (class in collections.abc): Collections Abstract Base Classes - Detailed Descriptions.\n(line   34)\n* Collection (class in typing):          Aliases to container ABCs in collections abc.\n(line   23)\n* colno (json.JSONDecodeError attribute): Exceptions<15>.    (line   27)\n* colno (re.error attribute):            Exceptions<3>.      (line   32)\n* COLON (in module token):               token -- Constants used with Python parse trees.\n(line   70)\n* colon (mailbox.Maildir attribute):     Maildir objects.    (line   45)\n* COLONEQUAL (in module token):          token -- Constants used with Python parse trees.\n(line  238)\n* COLORBLACK (in module curses):        Constants<6>.       (line  641)\n* COLORBLUE (in module curses):         Constants<6>.       (line  644)\n* colorcontent() (in module curses):    Functions<6>.       (line   45)\n* COLORCYAN (in module curses):         Constants<6>.       (line  647)\n* COLORGREEN (in module curses):        Constants<6>.       (line  650)\n* COLORMAGENTA (in module curses):      Constants<6>.       (line  653)\n* colorpair() (in module curses):       Functions<6>.       (line   53)\n* COLORPAIRS (in module curses):        Constants<6>.       (line   41)\n* COLORRED (in module curses):          Constants<6>.       (line  656)\n* COLORWHITE (in module curses):        Constants<6>.       (line  659)\n* COLORYELLOW (in module curses):       Constants<6>.       (line  662)\n* color() (in module turtle):            Color control.      (line  104)\n* colormode() (in module turtle):        Settings and special methods.\n(line   34)\n* COLORS (in module curses):             Constants<6>.       (line   36)\n* COLS (in module curses):               Constants<6>.       (line   46)\n* column() (tkinter.ttk.Treeview method): ttk Treeview.      (line   35)\n* columnize() (cmd.Cmd method):          Cmd Objects.        (line   88)\n* COLUMNS:                               Functions<6>.       (line  595)\n* COLUMNS <1>:                           Functions<6>.       (line  598)\n* columns (os.terminalsize attribute):  Querying the size of a terminal.\n(line   30)\n* comb() (in module math):               Number-theoretic and representation functions.\n(line   13)\n* combinationswithreplacement() (in module itertools): Itertool Functions.\n(line  182)\n* combinations() (in module itertools):  Itertool Functions. (line  131)\n* combine() (datetime.datetime class method): datetime Objects.\n(line  176)\n* combining() (in module unicodedata):   unicodedata -- Unicode Database.\n(line   59)\n* ComboBox (class in tkinter.tix):       Basic Widgets.      (line   18)\n* Combobox (class in tkinter.ttk):       ttk Combobox.       (line    6)\n* comma:                                 Parenthesized forms.\n(line   20)\n* COMMA (in module token):               token -- Constants used with Python parse trees.\n(line   74)\n* command (http.server.BaseHTTPRequestHandler attribute): http server -- HTTP servers.\n(line   94)\n* command line:                          Complete Python programs.\n(line   25)\n* command line option; -?:               Generic options.    (line    6)\n* command line option; -b:               Miscellaneous options.\n(line    6)\n* command line option; -B:               Miscellaneous options.\n(line   16)\n* command line option; -build:           Cross Compiling Options.\n(line   12)\n* command line option; -c:               Interface options.  (line   36)\n* command line option; -check-hash-based-pycs: Miscellaneous options.\n(line   21)\n* command line option; -d:               Miscellaneous options.\n(line   35)\n* command line option; -disable-ipv6:    General Options.    (line   16)\n* command line option; -disable-test-modules: Install Options.\n(line   24)\n* command line option; -E:               Miscellaneous options.\n(line   43)\n* command line option; -enable-big-digits: General Options.  (line   21)\n* command line option; -enable-bolt:     Performance options.\n(line   52)\n* command line option; -enable-framework: macOS Options.     (line   15)\n* command line option; -enable-framework <1>: macOS Options. (line   17)\n* command line option; -enable-loadable-sqlite-extensions: General Options.\n(line    6)\n* command line option; -enable-optimizations: Performance options.\n(line   10)\n* command line option; -enable-profiling: Performance options.\n(line   99)\n* command line option; -enable-pystats:  General Options.    (line  131)\n* command line option; -enable-shared:   Linker options.     (line    6)\n* command line option; -enable-universalsdk: macOS Options.  (line    8)\n* command line option; -enable-universalsdk <1>: macOS Options.\n(line   10)\n* command line option; -enable-wasm-dynamic-linking: WebAssembly Options.\n(line   16)\n* command line option; -enable-wasm-pthreads: WebAssembly Options.\n(line   26)\n* command line option; -exec-prefix:     Install Options.    (line   16)\n* command line option; -h:               Generic options.    (line    6)\n* command line option; -help:            Generic options.    (line    6)\n* command line option; -help-all:        Generic options.    (line   27)\n* command line option; -help-env:        Generic options.    (line   13)\n* command line option; -help-xoptions:   Generic options.    (line   20)\n* command line option; -host:            Cross Compiling Options.\n(line   16)\n* command line option; -i:               Miscellaneous options.\n(line   50)\n* command line option; -I:               Miscellaneous options.\n(line   61)\n* command line option; -J:               Options you shouldn't use.\n(line    6)\n* command line option; -m:               Interface options.  (line   50)\n* command line option; -O:               Miscellaneous options.\n(line   73)\n* command line option; -OO:              Miscellaneous options.\n(line   83)\n* command line option; -P:               Miscellaneous options.\n(line   92)\n* command line option; -prefix:          Install Options.    (line    6)\n* command line option; -q:               Miscellaneous options.\n(line  111)\n* command line option; -R:               Miscellaneous options.\n(line  118)\n* command line option; -s:               Miscellaneous options.\n(line  143)\n* command line option; -S:               Miscellaneous options.\n(line  155)\n* command line option; -u:               Miscellaneous options.\n(line  163)\n* command line option; -V:               Generic options.    (line   33)\n* command line option; -v:               Miscellaneous options.\n(line  173)\n* command line option; -version:         Generic options.    (line   33)\n* command line option; -W:               Miscellaneous options.\n(line  186)\n* command line option; -with-address-sanitizer: Debug options.\n(line   54)\n* command line option; -with-assertions: Debug options.      (line   29)\n* command line option; -with-build-python: Cross Compiling Options.\n(line   20)\n* command line option; -with-builtin-hashlib-hashes: Security Options.\n(line   21)\n* command line option; -with-computed-gotos: Performance options.\n(line   77)\n* command line option; -with-dbmliborder: General Options.   (line   68)\n* command line option; -with-dtrace:     Debug options.      (line   46)\n* command line option; -with-emscripten-target: WebAssembly Options.\n(line    6)\n* command line option; -with-ensurepip:  Install Options.    (line   32)\n* command line option; -with-framework-name: macOS Options.  (line   46)\n* command line option; -with-hash-algorithm: Security Options.\n(line    6)\n* command line option; -with-libc:       Libraries options.  (line   44)\n* command line option; -with-libm:       Libraries options.  (line   39)\n* command line option; -with-libs:       Libraries options.  (line    6)\n* command line option; -with-lto:        Performance options.\n(line   36)\n* command line option; -with-memory-sanitizer: Debug options.\n(line   61)\n* command line option; -with-openssl:    Libraries options.  (line   49)\n* command line option; -with-openssl-rpath: Libraries options.\n(line   55)\n* command line option; -with-pkg-config: General Options.    (line  118)\n* command line option; -with-platlibdir: General Options.    (line   96)\n* command line option; -with-pydebug:    Debug options.      (line    6)\n* command line option; -with-readline:   Libraries options.  (line   22)\n* command line option; -with-ssl-default-suites: Security Options.\n(line   40)\n* command line option; -with-strict-overflow: Performance options.\n(line  103)\n* command line option; -with-suffix:     General Options.    (line   32)\n* command line option; -with-system-expat: Libraries options.\n(line   10)\n* command line option; -with-system-libmpdec: Libraries options.\n(line   15)\n* command line option; -with-trace-refs: Debug options.      (line   11)\n* command line option; -with-tzpath:     General Options.    (line   44)\n* command line option; -with-undefined-behavior-sanitizer: Debug options.\n(line   68)\n* command line option; -with-universal-archs: macOS Options. (line   23)\n* command line option; -with-valgrind:   Debug options.      (line   42)\n* command line option; -with-wheel-pkg-dir: General Options. (line  106)\n* command line option; -without-c-locale-coercion: General Options.\n(line   81)\n* command line option; -without-decimal-contextvar: General Options.\n(line   57)\n* command line option; -without-doc-strings: Performance options.\n(line   89)\n* command line option; -without-freelists: General Options.  (line   90)\n* command line option; -without-pymalloc: Performance options.\n(line   82)\n* command line option; -without-readline: Libraries options. (line   31)\n* command line option; -without-static-libpython: Linker options.\n(line   11)\n* command line option; -x:               Miscellaneous options.\n(line  246)\n* command line option; -X:               Miscellaneous options.\n(line  251)\n* command line option; CONFIGSITE:      Cross Compiling Options.\n(line   26)\n* CommandCompiler (class in codeop):     codeop -- Compile Python code.\n(line   65)\n* commands (pdb command):                Debugger Commands.  (line  150)\n* comment:                               Comments.           (line    6)\n* comment (http.cookiejar.Cookie attribute): Cookie Objects<2>.\n(line   62)\n* comment (http.cookies.Morsel attribute): Morsel Objects.   (line   13)\n* COMMENT (in module token):             token -- Constants used with Python parse trees.\n(line  264)\n* comment (zipfile.ZipFile attribute):   ZipFile Objects.    (line  354)\n* comment (zipfile.ZipInfo attribute):   ZipInfo Objects.    (line   89)\n* commenturl (http.cookiejar.Cookie attribute): Cookie Objects<2>.\n(line   67)\n* Comment() (in module xml.etree.ElementTree): Functions<9>. (line   72)\n* comment() (xml.etree.ElementTree.TreeBuilder method): TreeBuilder Objects.\n(line   49)\n* comment() (xml.sax.handler.LexicalHandler method): LexicalHandler Objects.\n(line   18)\n* commenters (shlex.shlex attribute):    shlex Objects.      (line   85)\n* CommentHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line  336)\n* commit() (msilib.CAB method):          CAB Objects.        (line   24)\n* Commit() (msilib.Database method):     Database Objects.   (line   11)\n* commit() (sqlite3.Connection method):  Connection objects. (line   68)\n* common (filecmp.dircmp attribute):     The dircmp class.   (line   59)\n* Common Gateway Interface:              cgi -- Common Gateway Interface support.\n(line    8)\n* commondirs (filecmp.dircmp attribute): The dircmp class.  (line   71)\n* commonfiles (filecmp.dircmp attribute): The dircmp class. (line   75)\n* commonfunny (filecmp.dircmp attribute): The dircmp class. (line   79)\n* commontypes (in module mimetypes):    mimetypes -- Map filenames to MIME types.\n(line  144)\n* commonpath() (in module os.path):      os path -- Common pathname manipulations.\n(line   68)\n* commonprefix() (in module os.path):    os path -- Common pathname manipulations.\n(line   83)\n* communicate() (asyncio.subprocess.Process method): Interacting with Subprocesses.\n(line   50)\n* communicate() (subprocess.Popen method): Popen Objects.    (line   36)\n* Compare (class in ast):                Expressions<2>.     (line   92)\n* comparedigest() (in module hmac):     hmac -- Keyed-Hashing for Message Authentication.\n(line  111)\n* comparedigest() (in module secrets):  Other functions.    (line    6)\n* comparenetworks() (ipaddress.IPv4Network method): Network objects.\n(line  237)\n* comparenetworks() (ipaddress.IPv6Network method): Network objects.\n(line  352)\n* COMPAREOP (opcode):                   Python Bytecode Instructions.\n(line  725)\n* comparesignal() (decimal.Context method): Context objects.\n(line  265)\n* comparesignal() (decimal.Decimal method): Decimal objects.\n(line  158)\n* compareto() (tracemalloc.Snapshot method): Snapshot.      (line   13)\n* comparetotalmag() (decimal.Context method): Context objects.\n(line  273)\n* comparetotalmag() (decimal.Decimal method): Decimal objects.\n(line  190)\n* comparetotal() (decimal.Context method): Context objects. (line  269)\n* comparetotal() (decimal.Decimal method): Decimal objects. (line  165)\n* compare() (decimal.Context method):    Context objects.    (line  261)\n* compare() (decimal.Decimal method):    Decimal objects.    (line  147)\n* compare() (difflib.Differ method):     Differ Objects.     (line   38)\n* comparison:                            Comparisons.        (line    6)\n* COMPARISONFLAGS (in module doctest):  Option Flags.       (line  104)\n* comparisons:                           Basic customization.\n(line  179)\n* Compat32 (class in email.policy):      email policy Policy Objects.\n(line  562)\n* compat32 (in module email.policy):     email policy Policy Objects.\n(line  617)\n* Compile (class in codeop):             codeop -- Compile Python code.\n(line   56)\n* compilecommand() (in module code):    code -- Interpreter base classes.\n(line   47)\n* compilecommand() (in module codeop):  codeop -- Compile Python code.\n(line   29)\n* compiledir() (in module compileall):  Public functions.   (line    6)\n* compilefile() (in module compileall): Public functions.   (line   96)\n* compilepath() (in module compileall): Public functions.   (line  161)\n* compile() (in module pycompile):      pycompile -- Compile Python source files.\n(line   24)\n* compile() (in module re):              Functions<2>.       (line    6)\n* compileall command line option; -b:    Command-line use.   (line   59)\n* compileall command line option; -d:    Command-line use.   (line   32)\n* compileall command line option; -e:    Command-line use.   (line  100)\n* compileall command line option; -f:    Command-line use.   (line   22)\n* compileall command line option; -hardlink-dupes: Command-line use.\n(line  104)\n* compileall command line option; -i:    Command-line use.   (line   53)\n* compileall command line option; -invalidation-mode: Command-line use.\n(line   80)\n* compileall command line option; -j:    Command-line use.   (line   74)\n* compileall command line option; -l:    Command-line use.   (line   17)\n* compileall command line option; -o:    Command-line use.   (line   94)\n* compileall command line option; -p:    Command-line use.   (line   42)\n* compileall command line option; -q:    Command-line use.   (line   26)\n* compileall command line option; -r:    Command-line use.   (line   67)\n* compileall command line option; -s:    Command-line use.   (line   40)\n* compileall command line option; -x:    Command-line use.   (line   47)\n* compileall command line option; directory: Command-line use.\n(line    9)\n* compileall command line option; file:  Command-line use.   (line    9)\n* compilerflag (future.Feature attribute): Module Contents<5>.\n(line   81)\n* completestatement() (in module sqlite3): Module functions.\n(line  102)\n* complete() (rlcompleter.Completer method): rlcompleter -- Completion function for GNU readline.\n(line   43)\n* completedefault() (cmd.Cmd method):    Cmd Objects.        (line   82)\n* CompletedProcess (class in subprocess): Using the subprocess Module.\n(line  100)\n* Completer (class in rlcompleter):      rlcompleter -- Completion function for GNU readline.\n(line   39)\n* complex (built-in class):              Built-in Functions. (line  365)\n* Complex (class in numbers):            The numeric tower.  (line    6)\n* complex literal:                       Numeric literals.   (line    6)\n* complex number:                        Glossary.           (line  261)\n* complex number; literals:              Numeric Types -- int float complex.\n(line   19)\n* complex; number:                       numbers Complex complex.\n(line    6)\n* compound; statement:                   Compound statements.\n(line    6)\n* comprehension (class in ast):          Comprehensions.     (line   52)\n* comprehensions:                        Displays for lists sets and dictionaries.\n(line    6)\n* compresssize (zipfile.ZipInfo attribute): ZipInfo Objects.\n(line  140)\n* compresstype (zipfile.ZipInfo attribute): ZipInfo Objects.\n(line   85)\n* compress() (bz2.BZ2Compressor method): Incremental de compression.\n(line   15)\n* compress() (in module bz2):            One-shot de compression.\n(line    6)\n* compress() (in module gzip):           gzip -- Support for gzip files.\n(line  187)\n* compress() (in module itertools):      Itertool Functions. (line  233)\n* compress() (in module lzma):           Compressing and decompressing data in memory.\n(line  183)\n* compress() (in module zlib):           zlib -- Compression compatible with gzip.\n(line   43)\n* compress() (lzma.LZMACompressor method): Compressing and decompressing data in memory.\n(line   81)\n* compress() (zlib.Compress method):     zlib -- Compression compatible with gzip.\n(line  203)\n* compressed (ipaddress.IPv4Address attribute): Address objects.\n(line   58)\n* compressed (ipaddress.IPv4Network attribute): Network objects.\n(line  107)\n* compressed (ipaddress.IPv6Address attribute): Address objects.\n(line  233)\n* compressed (ipaddress.IPv6Network attribute): Network objects.\n(line  319)\n* compression() (ssl.SSLSocket method):  SSL Sockets.        (line  231)\n* CompressionError:                      tarfile -- Read and write tar archive files.\n(line  209)\n* compressobj() (in module zlib):        zlib -- Compression compatible with gzip.\n(line   80)\n* COMSPEC:                               Process Management. (line  764)\n* COMSPEC <1>:                           Popen Constructor.  (line  112)\n* concat() (in module operator):         operator -- Standard operators as functions.\n(line  176)\n* Concatenate (in module typing):        Special forms.      (line   67)\n* concatenation; operation:              Common Sequence Operations.\n(line   21)\n* cond (bdb.Breakpoint attribute):       bdb -- Debugger framework.\n(line   96)\n* Condition (class in asyncio):          Condition.          (line    6)\n* Condition (class in multiprocessing):  Synchronization primitives.\n(line   32)\n* Condition (class in threading):        Condition Objects.  (line   72)\n* condition (pdb command):               Debugger Commands.  (line  143)\n* condition() (msilib.Control method):   GUI classes.        (line   22)\n* Condition() (multiprocessing.managers.SyncManager method): Managers.\n(line  172)\n* Conditional; expression:               Boolean operations. (line    6)\n* conditional; expression:               Conditional expressions.\n(line    6)\n* config() (tkinter.font.Font method):   tkinter font -- Tkinter font wrapper.\n(line   55)\n* ConfigParser (class in configparser):  ConfigParser Objects.\n(line    6)\n* configuration information:             sysconfig -- Provide access to Python's configuration information.\n(line   10)\n* configuration; file:                   configparser -- Configuration file parser.\n(line    8)\n* configuremock() (unittest.mock.Mock method): The Mock Class.\n(line  243)\n* configure() (tkinter.ttk.Style method): Ttk Styling.       (line   24)\n* CONFORM (enum.FlagBoundary attribute): Data Types<2>.      (line  645)\n* confstrnames (in module os):          Miscellaneous System Information.\n(line   28)\n* confstr() (in module os):              Miscellaneous System Information.\n(line    6)\n* conjugate() (complex number method):   Numeric Types -- int float complex.\n(line   94)\n* conjugate() (decimal.Decimal method):  Decimal objects.    (line  202)\n* conjugate() (numbers.Complex method):  The numeric tower.  (line   23)\n* connectacceptedsocket() (asyncio.loop method): Creating network servers.\n(line  135)\n* connectex() (socket.socket method):   Socket Objects.     (line   86)\n* connectreadpipe() (asyncio.loop method): Working with pipes.\n(line    6)\n* connectwritepipe() (asyncio.loop method): Working with pipes.\n(line   22)\n* connect() (ftplib.FTP method):         FTP objects.        (line   89)\n* connect() (http.client.HTTPConnection method): HTTPConnection Objects.\n(line  143)\n* connect() (in module sqlite3):         Module functions.   (line    6)\n* connect() (multiprocessing.managers.BaseManager method): Managers.\n(line   76)\n* connect() (smtplib.SMTP method):       SMTP Objects.       (line   33)\n* connect() (socket.socket method):      Socket Objects.     (line   62)\n* Connection (class in multiprocessing.connection): Connection Objects.\n(line   13)\n* Connection (class in sqlite3):         Connection objects. (line    6)\n* connection (sqlite3.Cursor attribute): Cursor objects.     (line  176)\n* connectionlost() (asyncio.BaseProtocol method): Base Protocol.\n(line   23)\n* connectionmade() (asyncio.BaseProtocol method): Base Protocol.\n(line   15)\n* ConnectionAbortedError:                OS exceptions.      (line   45)\n* ConnectionError:                       OS exceptions.      (line   30)\n* ConnectionRefusedError:                OS exceptions.      (line   51)\n* ConnectionResetError:                  OS exceptions.      (line   57)\n* ConnectRegistry() (in module winreg):  Functions<13>.      (line   17)\n* const (optparse.Option attribute):     Option attributes.  (line   58)\n* constant:                              Literals.           (line    6)\n* Constant (class in ast):               Literals<3>.        (line    6)\n* constructor() (in module copyreg):     copyreg -- Register pickle support functions.\n(line   17)\n* consumed (asyncio.LimitOverrunError attribute): Exceptions<11>.\n(line   67)\n* container:                             Objects values and types.\n(line   67)\n* container <1>:                         Custom classes.     (line   20)\n* Container (class in collections.abc):  Collections Abstract Base Classes - Detailed Descriptions.\n(line    6)\n* Container (class in typing):           Aliases to container ABCs in collections abc.\n(line   33)\n* container; iteration over:             Iterator Types.     (line    6)\n* CONTAINSOP (opcode):                  Python Bytecode Instructions.\n(line  736)\n* contains() (in module operator):       operator -- Standard operators as functions.\n(line  181)\n* content (urllib.error.ContentTooShortError attribute): urllib error -- Exception classes raised by urllib request.\n(line   71)\n* contentdisposition (email.headerregistry.ContentDispositionHeader attribute): email headerregistry Custom Header Objects.\n(line  285)\n* contentmanager (email.policy.EmailPolicy attribute): email policy Policy Objects.\n(line  418)\n* contenttype (email.headerregistry.ContentTypeHeader attribute): email headerregistry Custom Header Objects.\n(line  272)\n* ContentDispositionHeader (class in email.headerregistry): email headerregistry Custom Header Objects.\n(line  280)\n* ContentHandler (class in xml.sax.handler): xml sax handler -- Base classes for SAX handlers.\n(line   18)\n* ContentManager (class in email.contentmanager): email contentmanager Managing MIME Content.\n(line   12)\n* contents (ctypes.Pointer attribute):  Arrays and pointers.\n(line   50)\n* contents() (importlib.abc.ResourceReader method): importlib abc - Abstract base classes related to import.\n(line  519)\n* contents() (importlib.resources.abc.ResourceReader method): importlib resources abc - Abstract base classes for resources.\n(line   68)\n* contents() (in module importlib.resources): Deprecated functions.\n(line  134)\n* ContentTooShortError:                  urllib error -- Exception classes raised by urllib request.\n(line   65)\n* ContentTransferEncoding (class in email.headerregistry): email headerregistry Custom Header Objects.\n(line  290)\n* ContentTypeHeader (class in email.headerregistry): email headerregistry Custom Header Objects.\n(line  267)\n* Context (class in contextvars):        Manual Context Management.\n(line   20)\n* Context (class in decimal):            Context objects.    (line  115)\n* context (ssl.SSLSocket attribute):     SSL Sockets.        (line  324)\n* context management protocol:           Context Manager Types.\n(line    6)\n* context manager:                       With Statement Context Managers.\n(line   14)\n* context manager <1>:                   Context Manager Types.\n(line    6)\n* context manager <2>:                   Glossary.           (line  275)\n* context variable:                      Glossary.           (line  281)\n* contextdiff() (in module difflib):    difflib -- Helpers for computing deltas.\n(line  155)\n* ContextDecorator (class in contextlib): Utilities.         (line  382)\n* ContextManager (class in typing):      Aliases to contextlib ABCs.\n(line    6)\n* contextmanager() (in module contextlib): Utilities.        (line   31)\n* ContextVar (class in contextvars):     Context Variables.  (line    6)\n* CONTIG (inspect.BufferFlags attribute): Buffer flags.      (line   33)\n* CONTIGRO (inspect.BufferFlags attribute): Buffer flags.   (line   35)\n* contiguous:                            shape strides suboffsets.\n(line   26)\n* contiguous <1>:                        Glossary.           (line  291)\n* contiguous (memoryview attribute):     Memory Views.       (line  487)\n* Continue (class in ast):               Control flow.       (line  102)\n* continue (pdb command):                Debugger Commands.  (line  216)\n* CONTINUOUS (enum.EnumCheck attribute): Data Types<2>.      (line  584)\n* Control (class in msilib):             GUI classes.        (line    9)\n* Control (class in tkinter.tix):        Basic Widgets.      (line   24)\n* control() (msilib.Dialog method):      GUI classes.        (line   45)\n* control() (select.kqueue method):      Kqueue Objects.     (line   22)\n* controlnames (in module curses.ascii): curses ascii -- Utilities for ASCII characters.\n(line  240)\n* controls() (ossaudiodev.ossmixerdevice method): Mixer Device Objects.\n(line   23)\n* CONTTYPE (in module tarfile):          tarfile -- Read and write tar archive files.\n(line  307)\n* ConversionError:                       Exceptions<20>.     (line   13)\n* convertarglinetoargs() (argparse.ArgumentParser method): Customizing file parsing.\n(line    6)\n* convertfield() (string.Formatter method): Custom String Formatting.\n(line  108)\n* Cookie (class in http.cookiejar):      http cookiejar -- Cookie handling for HTTP clients.\n(line  112)\n* CookieError:                           http cookies -- HTTP state management.\n(line   34)\n* CookieJar (class in http.cookiejar):   http cookiejar -- Cookie handling for HTTP clients.\n(line   45)\n* cookiejar (urllib.request.HTTPCookieProcessor attribute): HTTPCookieProcessor Objects.\n(line    8)\n* CookiePolicy (class in http.cookiejar): http cookiejar -- Cookie handling for HTTP clients.\n(line   76)\n* Coordinated Universal Time:            time -- Time access and conversions.\n(line   39)\n* Copy:                                  Help menu Shell and Editor.\n(line   30)\n* COPY (opcode):                         Python Bytecode Instructions.\n(line  108)\n* copyabs() (decimal.Context method):   Context objects.    (line  278)\n* copyabs() (decimal.Decimal method):   Decimal objects.    (line  207)\n* copycontext() (in module contextvars): Manual Context Management.\n(line    6)\n* copydecimal() (decimal.Context method): Context objects.  (line  185)\n* copyfilerange() (in module os):      File Descriptor Operations.\n(line   44)\n* COPYFREEVARS (opcode):               Python Bytecode Instructions.\n(line  928)\n* copylocation() (in module ast):       ast Helpers.        (line  155)\n* copynegate() (decimal.Context method): Context objects.   (line  282)\n* copynegate() (decimal.Decimal method): Decimal objects.   (line  213)\n* copysign() (decimal.Context method):  Context objects.    (line  286)\n* copysign() (decimal.Decimal method):  Decimal objects.    (line  219)\n* copy; protocol:                        Pickling Class Instances.\n(line  111)\n* copy() (collections.deque method):     deque objects.      (line   47)\n* copy() (contextvars.Context method):   Manual Context Management.\n(line   75)\n* copy() (decimal.Context method):       Context objects.    (line  181)\n* copy() (dict method):                  Mapping Types -- dict.\n(line  139)\n* copy() (frozenset method):             Set Types -- set frozenset.\n(line  123)\n* copy() (hashlib.hash method):          Hash Objects.       (line   51)\n* copy() (hmac.HMAC method):             hmac -- Keyed-Hashing for Message Authentication.\n(line   81)\n* copy() (http.cookies.Morsel method):   Morsel Objects.     (line   96)\n* copy() (imaplib.IMAP4 method):         IMAP4 Objects.      (line   68)\n* copy() (in module copy):               copy -- Shallow and deep copy operations.\n(line   18)\n* copy() (in module multiprocessing.sharedctypes): The multiprocessing sharedctypes module.\n(line   83)\n* copy() (in module shutil):             Directory and files operations.\n(line  121)\n* copy() (pipes.Template method):        Template Objects.   (line   48)\n* copy() (sequence method):              Mutable Sequence Types.\n(line   16)\n* copy() (tkinter.font.Font method):     tkinter font -- Tkinter font wrapper.\n(line   59)\n* copy() (types.MappingProxyType method): Standard Interpreter Types.\n(line  300)\n* copy() (zlib.Compress method):         zlib -- Compression compatible with gzip.\n(line  224)\n* copy() (zlib.Decompress method):       zlib -- Compression compatible with gzip.\n(line  293)\n* copy2() (in module shutil):            Directory and files operations.\n(line  153)\n* copyfile() (in module shutil):         Directory and files operations.\n(line   17)\n* copyfileobj() (in module shutil):      Directory and files operations.\n(line    6)\n* copying files:                         shutil -- High-level file operations.\n(line    8)\n* copymode() (in module shutil):         Directory and files operations.\n(line   59)\n* copyright (built-in variable):         Constants added by the site module.\n(line   18)\n* copyright (in module sys):             sys -- System-specific parameters and functions.\n(line  177)\n* copyright (in module sys) <1>:         Process-wide parameters.\n(line  243)\n* copysign() (in module math):           Number-theoretic and representation functions.\n(line   30)\n* copystat() (in module shutil):         Directory and files operations.\n(line   77)\n* copytree() (in module shutil):         Directory and files operations.\n(line  192)\n* coroutine:                             Special method lookup.\n(line   74)\n* coroutine <1>:                         Yield expressions.  (line   54)\n* coroutine <2>:                         Glossary.           (line  302)\n* Coroutine (class in collections.abc):  Collections Abstract Base Classes - Detailed Descriptions.\n(line  121)\n* Coroutine (class in typing):           Aliases to asynchronous ABCs in collections abc.\n(line    6)\n* coroutine function:                    Glossary.           (line  310)\n* coroutine; function:                   Coroutine functions.\n(line    6)\n* coroutine() (in module types):         Coroutine Utility Functions.\n(line    6)\n* CoroutineType (in module types):       Standard Interpreter Types.\n(line   42)\n* correlation() (in module statistics):  Function details.   (line  494)\n* cos() (in module cmath):               Trigonometric functions<2>.\n(line   23)\n* cos() (in module math):                Trigonometric functions.\n(line   31)\n* cosh() (in module cmath):              Hyperbolic functions<2>.\n(line   23)\n* cosh() (in module math):               Hyperbolic functions.\n(line   21)\n* count (tracemalloc.Statistic attribute): Statistic.        (line   15)\n* count (tracemalloc.StatisticDiff attribute): StatisticDiff.\n(line   15)\n* countdiff (tracemalloc.StatisticDiff attribute): StatisticDiff.\n(line   20)\n* count() (array.array method):          array -- Efficient arrays of numeric values.\n(line  146)\n* count() (bytearray method):            Bytes and Bytearray Operations.\n(line   36)\n* count() (bytes method):                Bytes and Bytearray Operations.\n(line   36)\n* count() (collections.deque method):    deque objects.      (line   53)\n* count() (in module itertools):         Itertool Functions. (line  246)\n* count() (multiprocessing.sharedmemory.ShareableList method): multiprocessing sharedmemory -- Shared memory for direct access across processes.\n(line  309)\n* count() (sequence method):             Common Sequence Operations.\n(line   21)\n* count() (str method):                  String Methods<2>.  (line   55)\n* Counter (class in collections):        Counter objects.    (line   24)\n* Counter (class in typing):             Aliases to types in collections.\n(line   39)\n* countOf() (in module operator):        operator -- Standard operators as functions.\n(line  187)\n* countTestCases() (unittest.TestCase method): Test cases.   (line  736)\n* countTestCases() (unittest.TestSuite method): Grouping tests.\n(line   55)\n* covariance() (in module statistics):   Function details.   (line  472)\n* CoverageResults (class in trace):      Programmatic Interface.\n(line   47)\n* CPPFLAGS:                              New Improved and Deprecated Modules<4>.\n(line   59)\n* CPPFLAGS <1>:                          Preprocessor flags. (line    8)\n* CPPFLAGS <2>:                          Preprocessor flags. (line   18)\n* CPPFLAGS <3>:                          Linker flags.       (line   50)\n* CPU time:                              Functions<5>.       (line  225)\n* CPU time <1>:                          Functions<5>.       (line  549)\n* cpucount() (in module multiprocessing): Miscellaneous<3>. (line   13)\n* cpucount() (in module os):            Miscellaneous System Information.\n(line   37)\n* CPython:                               Glossary.           (line  318)\n* cpythononly() (in module test.support): test support -- Utilities for the Python test suite.\n(line  523)\n* CR (in module curses.ascii):           curses ascii -- Utilities for ASCII characters.\n(line   64)\n* crawldelay() (urllib.robotparser.RobotFileParser method): urllib robotparser -- Parser for robots txt.\n(line   50)\n* CRC (zipfile.ZipInfo attribute):       ZipInfo Objects.    (line  136)\n* crchqx() (in module binascii):        binascii -- Convert between binary and ASCII.\n(line   91)\n* crc32() (in module binascii):          binascii -- Convert between binary and ASCII.\n(line   98)\n* crc32() (in module zlib):              zlib -- Compression compatible with gzip.\n(line  121)\n* createaggregate() (sqlite3.Connection method): Connection objects.\n(line  153)\n* createarchive() (in module zipapp):   Python API.         (line    8)\n* createautospec() (in module unittest.mock): createautospec.\n(line    6)\n* CREATEBREAKAWAYFROMJOB (in module subprocess): Windows Constants.\n(line  124)\n* createcollation() (sqlite3.Connection method): Connection objects.\n(line  293)\n* createconfiguration() (venv.EnvBuilder method): API<2>.   (line  143)\n* createconnection() (asyncio.loop method): Opening network connections.\n(line    6)\n* createconnection() (in module socket): Creating sockets.  (line   83)\n* createdatagramendpoint() (asyncio.loop method): Opening network connections.\n(line  157)\n* createdecimalfromfloat() (decimal.Context method): Context objects.\n(line  213)\n* createdecimal() (decimal.Context method): Context objects.\n(line  189)\n* createdefaultcontext() (in module ssl): Context creation.\n(line    9)\n* CREATEDEFAULTERRORMODE (in module subprocess): Windows Constants.\n(line  114)\n* createeagertaskfactory() (in module asyncio): Eager Task Factory.\n(line   32)\n* createemptyfile() (in module test.support.oshelper): test support oshelper -- Utilities for os tests.\n(line   92)\n* createfunction() (sqlite3.Connection method): Connection objects.\n(line  111)\n* createfuture() (asyncio.loop method): Creating Futures and Tasks.\n(line    6)\n* createmodule() (importlib.abc.Loader method): importlib abc - Abstract base classes related to import.\n(line  103)\n* createmodule() (importlib.machinery.ExtensionFileLoader method): importlib machinery - Importers and path hooks.\n(line  314)\n* createmodule() (zipimport.zipimporter method): zipimporter Objects.\n(line   23)\n* CREATENEWCONSOLE (in module subprocess): Windows Constants.\n(line   38)\n* CREATENEWPROCESSGROUP (in module subprocess): Windows Constants.\n(line   43)\n* CREATENOWINDOW (in module subprocess): Windows Constants.\n(line   99)\n* createserver() (asyncio.loop method): Creating network servers.\n(line    6)\n* createserver() (in module socket):    Creating sockets.   (line  114)\n* createstats() (profile.Profile method): profile and cProfile Module Reference.\n(line   86)\n* createstringbuffer() (in module ctypes): Utility functions.\n(line   40)\n* createsubprocessexec() (in module asyncio): Creating Subprocesses.\n(line    6)\n* createsubprocessshell() (in module asyncio): Creating Subprocesses.\n(line   23)\n* createsystem (zipfile.ZipInfo attribute): ZipInfo Objects.\n(line  100)\n* createtask() (asyncio.loop method):   Creating Futures and Tasks.\n(line   17)\n* createtask() (asyncio.TaskGroup method): Task Groups.     (line   17)\n* createtask() (in module asyncio):     Creating Tasks.     (line   10)\n* createunicodebuffer() (in module ctypes): Utility functions.\n(line   58)\n* createunixconnection() (asyncio.loop method): Opening network connections.\n(line  238)\n* createunixserver() (asyncio.loop method): Creating network servers.\n(line  111)\n* createversion (zipfile.ZipInfo attribute): ZipInfo Objects.\n(line  104)\n* createwindowfunction() (sqlite3.Connection method): Connection objects.\n(line  204)\n* create() (imaplib.IMAP4 method):       IMAP4 Objects.      (line   72)\n* create() (in module venv):             API<2>.             (line  223)\n* create() (venv.EnvBuilder method):     API<2>.             (line   57)\n* createAttribute() (xml.dom.Document method): Document Objects.\n(line   46)\n* createAttributeNS() (xml.dom.Document method): Document Objects.\n(line   53)\n* createComment() (xml.dom.Document method): Document Objects.\n(line   34)\n* createDocument() (xml.dom.DOMImplementation method): DOMImplementation Objects.\n(line   16)\n* createDocumentType() (xml.dom.DOMImplementation method): DOMImplementation Objects.\n(line   26)\n* createElement() (xml.dom.Document method): Document Objects.\n(line   14)\n* createElementNS() (xml.dom.Document method): Document Objects.\n(line   21)\n* createfilehandler() (tkinter.Widget.tk method): File Handlers.\n(line   27)\n* CreateKey() (in module winreg):        Functions<13>.      (line   35)\n* CreateKeyEx() (in module winreg):      Functions<13>.      (line   63)\n* createLock() (logging.Handler method): Handler Objects.    (line   20)\n* createLock() (logging.NullHandler method): NullHandler.    (line   24)\n* createProcessingInstruction() (xml.dom.Document method): Document Objects.\n(line   40)\n* CreateRecord() (in module msilib):     msilib -- Read and write Microsoft Installer files.\n(line   57)\n* createSocket() (logging.handlers.SocketHandler method): SocketHandler.\n(line   72)\n* createSocket() (logging.handlers.SysLogHandler method): SysLogHandler.\n(line   50)\n* createTextNode() (xml.dom.Document method): Document Objects.\n(line   28)\n* credits (built-in variable):           Constants added by the site module.\n(line   18)\n* CRITICAL (in module logging):          Logging Levels.     (line   45)\n* critical() (in module logging):        Module-Level Functions.\n(line   84)\n* critical() (logging.Logger method):    Logger Objects.     (line  306)\n* CRNCYSTR (in module locale):           locale -- Internationalization services.\n(line  292)\n* cross() (in module audioop):           audioop -- Manipulate raw audio data.\n(line   77)\n* CRTASSEMBLYVERSION (in module msvcrt): Other Functions.  (line   12)\n* crypt() (in module crypt):             Module Functions<2>.\n(line    8)\n* crypt(3):                              crypt -- Function to check Unix passwords.\n(line    8)\n* crypt(3) <1>:                          crypt -- Function to check Unix passwords.\n(line   22)\n* crypt(3) <2>:                          Module Functions<2>.\n(line   32)\n* cryptography:                          Cryptographic Services.\n(line    6)\n* cssclassmonth (calendar.HTMLCalendar attribute): calendar -- General calendar-related functions.\n(line  233)\n* cssclassmonthhead (calendar.HTMLCalendar attribute): calendar -- General calendar-related functions.\n(line  226)\n* cssclassnoday (calendar.HTMLCalendar attribute): calendar -- General calendar-related functions.\n(line  212)\n* cssclassyear (calendar.HTMLCalendar attribute): calendar -- General calendar-related functions.\n(line  240)\n* cssclassyearhead (calendar.HTMLCalendar attribute): calendar -- General calendar-related functions.\n(line  247)\n* cssclasses (calendar.HTMLCalendar attribute): calendar -- General calendar-related functions.\n(line  199)\n* cssclassesweekdayhead (calendar.HTMLCalendar attribute): calendar -- General calendar-related functions.\n(line  219)\n* csv:                                   csv -- CSV File Reading and Writing.\n(line    8)\n* cte (email.headerregistry.ContentTransferEncoding attribute): email headerregistry Custom Header Objects.\n(line  294)\n* ctetype (email.policy.Policy attribute): email policy Policy Objects.\n(line  160)\n* ctermid() (in module os):              Process Parameters. (line    9)\n* ctime() (datetime.date method):        date Objects.       (line  266)\n* ctime() (datetime.datetime method):    datetime Objects.   (line  710)\n* ctime() (in module time):              Functions<5>.       (line   93)\n* CTRLBREAKEVENT (in module signal):   Module contents<2>. (line  199)\n* CTRLCEVENT (in module signal):       Module contents<2>. (line  190)\n* ctrl() (in module curses.ascii):       curses ascii -- Utilities for ASCII characters.\n(line  216)\n* curdir (in module os):                 Miscellaneous System Information.\n(line   84)\n* currency() (in module locale):         locale -- Internationalization services.\n(line  472)\n* currentprocess() (in module multiprocessing): Miscellaneous<3>.\n(line   29)\n* currenttask() (in module asyncio):    Introspection.      (line    6)\n* currentthread() (in module threading): threading -- Thread-based parallelism.\n(line   62)\n* current() (tkinter.ttk.Combobox method): ttk Combobox.     (line    8)\n* CurrentByteIndex (xml.parsers.expat.xmlparser attribute): XMLParser Objects<2>.\n(line  195)\n* CurrentColumnNumber (xml.parsers.expat.xmlparser attribute): XMLParser Objects<2>.\n(line  199)\n* currentframe() (in module inspect):    The interpreter stack.\n(line  161)\n* CurrentLineNumber (xml.parsers.expat.xmlparser attribute): XMLParser Objects<2>.\n(line  203)\n* cursset() (in module curses):         Functions<6>.       (line   61)\n* Cursor (class in sqlite3):             Cursor objects.     (line   19)\n* cursor() (sqlite3.Connection method):  Connection objects. (line   23)\n* cursyncup() (curses.window method):    Window Objects.     (line  172)\n* Cut:                                   Help menu Shell and Editor.\n(line   30)\n* cwd() (ftplib.FTP method):             FTP objects.        (line  336)\n* cwd() (pathlib.Path class method):     Methods<2>.         (line   17)\n* cycle() (in module itertools):         Itertool Functions. (line  268)\n* CycleError:                            Exceptions<4>.      (line    8)\n* Cyclic Redundancy Check:               zlib -- Compression compatible with gzip.\n(line  123)\n* DFMT (in module locale):              locale -- Internationalization services.\n(line  195)\n* DTFMT (in module locale):            locale -- Internationalization services.\n(line  189)\n* daemon (multiprocessing.Process attribute): Process and exceptions.\n(line  101)\n* daemon (threading.Thread attribute):   Thread Objects.     (line  202)\n* daemonthreads (socketserver.ThreadingMixIn attribute): Server Creation Notes.\n(line   55)\n* dangling; else:                        Compound statements.\n(line   55)\n* data:                                  Objects values and types.\n(line    6)\n* data (collections.UserDict attribute): UserDict objects.   (line   24)\n* data (collections.UserList attribute): UserList objects.   (line   29)\n* data (collections.UserString attribute): UserString objects.\n(line   24)\n* data (select.kevent attribute):        Kevent Objects.     (line  175)\n* data (selectors.SelectorKey attribute): Classes<4>.        (line   48)\n* data (urllib.request.Request attribute): Request Objects.  (line   39)\n* data (xml.dom.Comment attribute):      Comment Objects.    (line    9)\n* data (xml.dom.ProcessingInstruction attribute): ProcessingInstruction Objects.\n(line   14)\n* data (xml.dom.Text attribute):         Text and CDATASection Objects.\n(line   15)\n* data (xmlrpc.client.Binary attribute): Binary Objects.     (line   12)\n* datafilter() (in module tarfile):     Default named filters.\n(line   36)\n* dataopen() (urllib.request.DataHandler method): DataHandler Objects.\n(line    6)\n* datareceived() (asyncio.Protocol method): Streaming Protocols.\n(line   13)\n* data; tabular:                         csv -- CSV File Reading and Writing.\n(line    8)\n* data; type:                            The standard type hierarchy.\n(line    6)\n* data() (xml.etree.ElementTree.TreeBuilder method): TreeBuilder Objects.\n(line   33)\n* DatabaseError:                         Exceptions<6>.      (line   44)\n* databases:                             dbm dumb -- Portable DBM implementation.\n(line    8)\n* dataclasstransform() (in module typing): Functions and decorators.\n(line  114)\n* dataclass() (in module dataclasses):   Module contents<4>. (line    6)\n* DataError:                             Exceptions<6>.      (line   51)\n* datagramreceived() (asyncio.DatagramProtocol method): Datagram Protocols.\n(line    9)\n* DatagramHandler (class in logging.handlers): DatagramHandler.\n(line   10)\n* DatagramProtocol (class in asyncio):   Base Protocols.     (line   20)\n* DatagramRequestHandler (class in socketserver): Request Handler Objects.\n(line   56)\n* DatagramTransport (class in asyncio):  Transports Hierarchy.\n(line   43)\n* DataHandler (class in urllib.request): urllib request -- Extensible library for opening URLs.\n(line  430)\n* date (class in datetime):              date Objects.       (line   13)\n* datetime (zipfile.ZipInfo attribute): ZipInfo Objects.    (line   55)\n* datetimestring() (http.server.BaseHTTPRequestHandler method): http server -- HTTP servers.\n(line  321)\n* date() (datetime.datetime method):     datetime Objects.   (line  419)\n* date() (nntplib.NNTP method):          Methods<3>.         (line  298)\n* DateHeader (class in email.headerregistry): email headerregistry Custom Header Objects.\n(line  136)\n* datetime (class in datetime):          datetime Objects.   (line   17)\n* DateTime (class in xmlrpc.client):     DateTime Objects.   (line    6)\n* datetime (email.headerregistry.DateHeader attribute): email headerregistry Custom Header Objects.\n(line  145)\n* Day (class in calendar):               calendar -- General calendar-related functions.\n(line  392)\n* day (datetime.date attribute):         date Objects.       (line  124)\n* day (datetime.datetime attribute):     datetime Objects.   (line  293)\n* DAY1 (in module locale):              locale -- Internationalization services.\n(line  212)\n* DAY2 (in module locale):              locale -- Internationalization services.\n(line  212)\n* DAY3 (in module locale):              locale -- Internationalization services.\n(line  212)\n* DAY4 (in module locale):              locale -- Internationalization services.\n(line  212)\n* DAY5 (in module locale):              locale -- Internationalization services.\n(line  212)\n* DAY6 (in module locale):              locale -- Internationalization services.\n(line  212)\n* DAY7 (in module locale):              locale -- Internationalization services.\n(line  212)\n* dayabbr (in module calendar):         calendar -- General calendar-related functions.\n(line  374)\n* dayname (in module calendar):         calendar -- General calendar-related functions.\n(line  369)\n* daylight (in module time):             Timezone Constants. (line   13)\n* Daylight Saving Time:                  time -- Time access and conversions.\n(line   43)\n* DbfilenameShelf (class in shelve):     Restrictions.       (line   73)\n* DC1 (in module curses.ascii):          curses ascii -- Utilities for ASCII characters.\n(line   76)\n* DC2 (in module curses.ascii):          curses ascii -- Utilities for ASCII characters.\n(line   79)\n* DC3 (in module curses.ascii):          curses ascii -- Utilities for ASCII characters.\n(line   82)\n* DC4 (in module curses.ascii):          curses ascii -- Utilities for ASCII characters.\n(line   85)\n* dcgettext() (in module locale):        Access to message catalogs.\n(line   10)\n* deactivatestacktrampoline() (in module sys): sys -- System-specific parameters and functions.\n(line 1707)\n* deallocation, object:                  Finalization and De-allocation.\n(line    6)\n* debug (imaplib.IMAP4 attribute):       IMAP4 Objects.      (line  397)\n* DEBUG (in module logging):             Logging Levels.     (line   24)\n* DEBUG (in module re):                  Flags.              (line   32)\n* debug (pdb command):                   Debugger Commands.  (line  406)\n* debug (shlex.shlex attribute):         shlex Objects.      (line  162)\n* debug (sys.flags attribute):           sys -- System-specific parameters and functions.\n(line  517)\n* debug (zipfile.ZipFile attribute):     ZipFile Objects.    (line  348)\n* DEBUGBYTECODESUFFIXES (in module importlib.machinery): importlib machinery - Importers and path hooks.\n(line   20)\n* DEBUGCOLLECTABLE (in module gc):      gc -- Garbage Collector interface.\n(line  302)\n* DEBUGLEAK (in module gc):             gc -- Garbage Collector interface.\n(line  322)\n* DEBUGSAVEALL (in module gc):          gc -- Garbage Collector interface.\n(line  316)\n* debugsrc() (in module doctest):       Debugging.          (line  147)\n* DEBUGSTATS (in module gc):            gc -- Garbage Collector interface.\n(line  297)\n* DEBUGUNCOLLECTABLE (in module gc):    gc -- Garbage Collector interface.\n(line  306)\n* debug() (in module doctest):           Debugging.          (line  124)\n* debug() (in module logging):           Module-Level Functions.\n(line   44)\n* debug() (logging.Logger method):       Logger Objects.     (line  185)\n* debug() (pipes.Template method):       Template Objects.   (line   16)\n* debug() (unittest.TestCase method):    Test cases.         (line  120)\n* debug() (unittest.TestSuite method):   Grouping tests.     (line   48)\n* debugger:                              threading -- Thread-based parallelism.\n(line  178)\n* debugger <1>:                          Debug menu Shell window only.\n(line   15)\n* debugger <2>:                          sys -- System-specific parameters and functions.\n(line  902)\n* debugger <3>:                          sys -- System-specific parameters and functions.\n(line 1540)\n* debugger; configuration; file:         Debugger Commands.  (line   56)\n* debugging:                             pdb -- The Python Debugger.\n(line    8)\n* debugging; assertions:                 The assert statement.\n(line    6)\n* debuglevel (http.client.HTTPResponse attribute): HTTPResponse Objects.\n(line   69)\n* DebugRunner (class in doctest):        Debugging.          (line  168)\n* DECEMBER (in module calendar):         calendar -- General calendar-related functions.\n(line  414)\n* Decimal (class in decimal):            Decimal objects.    (line    6)\n* decimal literal:                       Numeric literals.   (line    6)\n* decimal() (in module unicodedata):     unicodedata -- Unicode Database.\n(line   31)\n* DecimalException (class in decimal):   Signals.            (line   28)\n* decode (codecs.CodecInfo attribute):   codecs -- Codec registry and base classes.\n(line   69)\n* decodeheader() (in module email.header): email header Internationalized headers.\n(line  183)\n* decodeheader() (in module nntplib):   Utility functions<2>.\n(line    8)\n* decodeparams() (in module email.utils): email utils Miscellaneous utilities.\n(line  217)\n* decoderfc2231() (in module email.utils): email utils Miscellaneous utilities.\n(line  187)\n* decodesource() (in module importlib.util): importlib util - Utility code for importers.\n(line   72)\n* decode() (bytearray method):           Bytes and Bytearray Operations.\n(line   92)\n* decode() (bytes method):               Bytes and Bytearray Operations.\n(line   92)\n* decode() (codecs.Codec method):        Stateless Encoding and Decoding.\n(line   29)\n* decode() (codecs.IncrementalDecoder method): IncrementalDecoder Objects.\n(line   28)\n* decode() (in module base64):           base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line  232)\n* decode() (in module codecs):           codecs -- Codec registry and base classes.\n(line   34)\n* decode() (in module quopri):           quopri -- Encode and decode MIME quoted-printable data.\n(line   19)\n* decode() (in module uu):               uu -- Encode and decode uuencode files.\n(line   41)\n* decode() (json.JSONDecoder method):    Encoders and Decoders.\n(line   86)\n* decode() (xmlrpc.client.Binary method): Binary Objects.    (line   20)\n* decode() (xmlrpc.client.DateTime method): DateTime Objects.\n(line   13)\n* decodebytes() (in module base64):      base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line  239)\n* DecodedGenerator (class in email.generator): email generator Generating MIME documents.\n(line  232)\n* decodestring() (in module quopri):     quopri -- Encode and decode MIME quoted-printable data.\n(line   41)\n* decomposition() (in module unicodedata): unicodedata -- Unicode Database.\n(line   75)\n* decompress() (bz2.BZ2Decompressor method): Incremental de compression.\n(line   45)\n* decompress() (in module bz2):          One-shot de compression.\n(line   16)\n* decompress() (in module gzip):         gzip -- Support for gzip files.\n(line  206)\n* decompress() (in module lzma):         Compressing and decompressing data in memory.\n(line  192)\n* decompress() (in module zlib):         zlib -- Compression compatible with gzip.\n(line  135)\n* decompress() (lzma.LZMADecompressor method): Compressing and decompressing data in memory.\n(line  132)\n* decompress() (zlib.Decompress method): zlib -- Compression compatible with gzip.\n(line  262)\n* decompressobj() (in module zlib):      zlib -- Compression compatible with gzip.\n(line  180)\n* decorator:                             Glossary.           (line  325)\n* DEDENT (in module token):              token -- Constants used with Python parse trees.\n(line   52)\n* DEDENT token:                          Indentation.        (line   33)\n* DEDENT token <1>:                      Compound statements.\n(line   55)\n* dedent() (in module textwrap):         textwrap -- Text wrapping and filling.\n(line   76)\n* deepcopy() (in module copy):           copy -- Shallow and deep copy operations.\n(line   22)\n* defprogmode() (in module curses):    Functions<6>.       (line   70)\n* defshellmode() (in module curses):   Functions<6>.       (line   77)\n* default (in module email.policy):      email policy Policy Objects.\n(line  503)\n* DEFAULT (in module unittest.mock):     DEFAULT.            (line    6)\n* default (inspect.Parameter attribute): Introspecting callables with the Signature object.\n(line  201)\n* default (optparse.Option attribute):   Option attributes.  (line   44)\n* DEFAULTBUFFERSIZE (in module io):    High-level Module Interface.\n(line    6)\n* defaultbufsize (in module xml.dom.pulldom): xml dom pulldom -- Support for building partial DOM trees.\n(line  104)\n* defaultexceptionhandler() (asyncio.loop method): Error Handling API.\n(line   34)\n* defaultfactory (collections.defaultdict attribute): defaultdict objects.\n(line   49)\n* DEFAULTFORMAT (in module tarfile):    tarfile -- Read and write tar archive files.\n(line  339)\n* DEFAULTIGNORES (in module filecmp):   The dircmp class.   (line  111)\n* defaultmaxstrdigits (sys.intinfo attribute): sys -- System-specific parameters and functions.\n(line 1112)\n* defaultopen() (urllib.request.BaseHandler method): BaseHandler Objects.\n(line   30)\n* DEFAULTPROTOCOL (in module pickle):   Module Interface.   (line   21)\n* defaulttimer() (in module timeit):    Python Interface.   (line   32)\n* default; parameter; value:             Function definitions.\n(line   65)\n* default() (cmd.Cmd method):            Cmd Objects.        (line   76)\n* default() (json.JSONEncoder method):   Encoders and Decoders.\n(line  198)\n* DefaultContext (class in decimal):     Context objects.    (line   90)\n* DefaultCookiePolicy (class in http.cookiejar): http cookiejar -- Cookie handling for HTTP clients.\n(line   81)\n* defaultdict (class in collections):    defaultdict objects.\n(line    6)\n* DefaultDict (class in typing):         Aliases to types in collections.\n(line    6)\n* DefaultEventLoopPolicy (class in asyncio): Policy Objects. (line   54)\n* DefaultHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line  351)\n* DefaultHandlerExpand() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line  358)\n* defaults() (configparser.ConfigParser method): ConfigParser Objects.\n(line   79)\n* DefaultSelector (class in selectors):  Classes<4>.         (line  161)\n* defaultTestLoader (in module unittest): Loading and running tests.\n(line  452)\n* defaultTestResult() (unittest.TestCase method): Test cases.\n(line  741)\n* defects (email.headerregistry.BaseHeader attribute): email headerregistry Custom Header Objects.\n(line   52)\n* defects (email.message.EmailMessage attribute): email message Representing an email message.\n(line  712)\n* defects (email.message.Message attribute): email message Message Representing an email message using the compat32 API.\n(line  723)\n* defpath (in module os):                Miscellaneous System Information.\n(line  124)\n* DefragResult (class in urllib.parse):  Structured Parse Results.\n(line   40)\n* DefragResultBytes (class in urllib.parse): Structured Parse Results.\n(line   65)\n* degrees() (in module math):            Angular conversion. (line    6)\n* degrees() (in module turtle):          Settings for measurement.\n(line    6)\n* Del (class in ast):                    Variables.          (line   11)\n* DEL (in module curses.ascii):          curses ascii -- Utilities for ASCII characters.\n(line  124)\n* delparam() (email.message.EmailMessage method): email message Representing an email message.\n(line  383)\n* delparam() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  542)\n* delayoutput() (in module curses):     Functions<6>.       (line   85)\n* delay() (in module turtle):            Animation control.  (line    6)\n* delayload (http.cookiejar.FileCookieJar attribute): CookieJar and FileCookieJar Objects.\n(line  159)\n* delch() (curses.window method):        Window Objects.     (line  177)\n* dele() (poplib.POP3 method):           POP3 Objects.       (line   68)\n* Delete (class in ast):                 Statements.         (line  143)\n* DELETEATTR (opcode):                  Python Bytecode Instructions.\n(line  551)\n* DELETEDEREF (opcode):                 Python Bytecode Instructions.\n(line  918)\n* DELETEFAST (opcode):                  Python Bytecode Instructions.\n(line  868)\n* DELETEGLOBAL (opcode):                Python Bytecode Instructions.\n(line  565)\n* DELETENAME (opcode):                  Python Bytecode Instructions.\n(line  505)\n* DELETESUBSCR (opcode):                Python Bytecode Instructions.\n(line  210)\n* delete() (ftplib.FTP method):          FTP objects.        (line  329)\n* delete() (imaplib.IMAP4 method):       IMAP4 Objects.      (line   76)\n* delete() (tkinter.ttk.Treeview method): ttk Treeview.      (line   73)\n* deleteacl() (imaplib.IMAP4 method):    IMAP4 Objects.      (line   80)\n* deletefilehandler() (tkinter.Widget.tk method): File Handlers.\n(line   37)\n* DeleteKey() (in module winreg):        Functions<13>.      (line  102)\n* DeleteKeyEx() (in module winreg):      Functions<13>.      (line  124)\n* deleteln() (curses.window method):     Window Objects.     (line  181)\n* deleteMe() (bdb.Breakpoint method):    bdb -- Debugger framework.\n(line   42)\n* DeleteValue() (in module winreg):      Functions<13>.      (line  160)\n* deletion; target:                      The del statement<2>.\n(line    6)\n* deletion; target; list:                The del statement<2>.\n(line    6)\n* delimiter (csv.Dialect attribute):     Dialects and Formatting Parameters.\n(line   19)\n* delimiters:                            Delimiters.         (line    6)\n* delitem() (in module operator):        operator -- Standard operators as functions.\n(line  191)\n* deliverchallenge() (in module multiprocessing.connection): Listeners and Clients.\n(line   15)\n* delocalize() (in module locale):       locale -- Internationalization services.\n(line  493)\n* demoapp() (in module wsgiref.simpleserver): wsgiref simpleserver - a simple WSGI HTTP server.\n(line   36)\n* denominator (fractions.Fraction attribute): fractions -- Rational numbers.\n(line  114)\n* denominator (numbers.Rational attribute): The numeric tower.\n(line   55)\n* DeprecationWarning:                    Warnings.           (line   17)\n* deque (class in collections):          deque objects.      (line    6)\n* Deque (class in typing):               Aliases to types in collections.\n(line   49)\n* dequeue() (logging.handlers.QueueListener method): QueueListener.\n(line   50)\n* DERcerttoPEMcert() (in module ssl): Certificate handling.\n(line   52)\n* derive() (BaseExceptionGroup method):  Exception groups.   (line   72)\n* derwin() (curses.window method):       Window Objects.     (line  186)\n* descrgetfunc (C type):                 Slot Type typedefs. (line   69)\n* description (inspect.Parameter.kind attribute): Introspecting callables with the Signature object.\n(line  267)\n* description (sqlite3.Cursor attribute): Cursor objects.    (line  189)\n* description() (nntplib.NNTP method):   Methods<3>.         (line  149)\n* descriptions() (nntplib.NNTP method):  Methods<3>.         (line  135)\n* descriptor:                            Glossary.           (line  347)\n* descrsetfunc (C type):                 Slot Type typedefs. (line   74)\n* deserialize() (sqlite3.Connection method): Connection objects.\n(line  669)\n* dest (optparse.Option attribute):      Option attributes.  (line   35)\n* destructor:                            Basic customization.\n(line   55)\n* destructor <1>:                        Assignment statements.\n(line   71)\n* destructor (C type):                   Slot Type typedefs. (line   24)\n* detach() (io.BufferedIOBase method):   I/O Base Classes.   (line  259)\n* detach() (io.TextIOBase method):       Text I/O<2>.        (line   37)\n* detach() (socket.socket method):       Socket Objects.     (line  100)\n* detach() (tkinter.ttk.Treeview method): ttk Treeview.      (line   79)\n* detach() (weakref.finalize method):    weakref -- Weak references.\n(line  301)\n* Detach() (winreg.PyHKEY method):       Registry Handle Objects.\n(line   40)\n* DETACHEDPROCESS (in module subprocess): Windows Constants.\n(line  106)\n* detectapimismatch() (in module test.support): test support -- Utilities for the Python test suite.\n(line  633)\n* detectencoding() (in module tokenize): Tokenizing Input.  (line   77)\n* deterministic profiling:               Introduction to the profilers.\n(line    6)\n* devmode (sys.flags attribute):        sys -- System-specific parameters and functions.\n(line  556)\n* deviceencoding() (in module os):      File Descriptor Operations.\n(line   81)\n* devmajor (tarfile.TarInfo attribute):  TarInfo Objects.    (line  141)\n* devminor (tarfile.TarInfo attribute):  TarInfo Objects.    (line  145)\n* devnull (in module os):                Miscellaneous System Information.\n(line  139)\n* DEVNULL (in module subprocess):        Using the subprocess Module.\n(line  141)\n* devpoll() (in module select):          select -- Waiting for I/O completion.\n(line   37)\n* DevpollSelector (class in selectors):  Classes<4>.         (line  184)\n* dgettext() (in module gettext):        GNU gettext API.    (line   39)\n* dgettext() (in module locale):         Access to message catalogs.\n(line    8)\n* Dialect (class in csv):                Module Contents<3>. (line  182)\n* dialect (csv.csvreader attribute):     Reader Objects.     (line   19)\n* dialect (csv.csvwriter attribute):     Writer Objects.     (line   33)\n* Dialog (class in msilib):              GUI classes.        (line   38)\n* Dialog (class in tkinter.commondialog): tkinter commondialog -- Dialog window templates.\n(line   14)\n* Dialog (class in tkinter.simpledialog): tkinter simpledialog -- Standard Tkinter input dialogs.\n(line   21)\n* dict (2to3 fixer):                     Fixers.             (line   70)\n* dict (built-in class):                 Mapping Types -- dict.\n(line   19)\n* Dict (class in ast):                   Literals<3>.        (line  105)\n* Dict (class in typing):                Aliases to built-in types.\n(line    6)\n* DICTMERGE (opcode):                   Python Bytecode Instructions.\n(line  674)\n* DICTUPDATE (opcode):                  Python Bytecode Instructions.\n(line  663)\n* dict() (multiprocessing.managers.SyncManager method): Managers.\n(line  222)\n* DictComp (class in ast):               Comprehensions.     (line    6)\n* dictConfig() (in module logging.config): Configuration functions.\n(line   13)\n* dictionary:                            Glossary.           (line  364)\n* dictionary comprehension:              Glossary.           (line  370)\n* dictionary view:                       Glossary.           (line  378)\n* dictionary; comprehensions:            Dictionary displays.\n(line    6)\n* dictionary; display:                   Dictionary displays.\n(line    6)\n* DictReader (class in csv):             Module Contents<3>. (line  102)\n* DictWriter (class in csv):             Module Contents<3>. (line  146)\n* diffbytes() (in module difflib):      difflib -- Helpers for computing deltas.\n(line  335)\n* difffiles (filecmp.dircmp attribute): The dircmp class.   (line   90)\n* Differ (class in difflib):             difflib -- Helpers for computing deltas.\n(line   50)\n* differenceupdate() (frozenset method): Set Types -- set frozenset.\n(line  182)\n* difference() (frozenset method):       Set Types -- set frozenset.\n(line  109)\n* dig (sys.floatinfo attribute):        sys -- System-specific parameters and functions.\n(line  618)\n* digestsize (hmac.HMAC attribute):     hmac -- Keyed-Hashing for Message Authentication.\n(line   89)\n* digest() (hashlib.hash method):        Hash Objects.       (line   38)\n* digest() (hashlib.shake method):       SHAKE variable length digests.\n(line   15)\n* digest() (hmac.HMAC method):           hmac -- Keyed-Hashing for Message Authentication.\n(line   55)\n* digest() (in module hmac):             hmac -- Keyed-Hashing for Message Authentication.\n(line   30)\n* digit() (in module unicodedata):       unicodedata -- Unicode Database.\n(line   37)\n* digits (in module string):             String constants.   (line   24)\n* dir() (ftplib.FTP method):             FTP objects.        (line  311)\n* dircmp (class in filecmp):             The dircmp class.   (line    6)\n* Directory (class in msilib):           Directory Objects.  (line    6)\n* Directory (class in tkinter.filedialog): Native Load/Save Dialogs.\n(line   71)\n* directory; changing:                   Files and Directories.\n(line  117)\n* directory; creating:                   Files and Directories.\n(line  528)\n* directory; deleting:                   Directory and files operations.\n(line  265)\n* directory; deleting <1>:               Files and Directories.\n(line  718)\n* directory; traversal:                  Files and Directories.\n(line 1628)\n* directory; traversal <1>:              Files and Directories.\n(line 1728)\n* directory; walking:                    Files and Directories.\n(line 1628)\n* directory; walking <1>:                Files and Directories.\n(line 1728)\n* DirEntry (class in os):                Files and Directories.\n(line  899)\n* DirList (class in tkinter.tix):        File Selectors.     (line    6)\n* dirname() (in module os.path):         os path -- Common pathname manipulations.\n(line  101)\n* dirsdoubleevent() (tkinter.filedialog.FileDialog method): Native Load/Save Dialogs.\n(line   86)\n* dirsselectevent() (tkinter.filedialog.FileDialog method): Native Load/Save Dialogs.\n(line   90)\n* DirSelectBox (class in tkinter.tix):   File Selectors.     (line   26)\n* DirSelectDialog (class in tkinter.tix): File Selectors.    (line   20)\n* DirsOnSysPath (class in test.support.importhelper): test support importhelper -- Utilities for import tests.\n(line   97)\n* DirTree (class in tkinter.tix):        File Selectors.     (line   13)\n* DIRTYPE (in module tarfile):           tarfile -- Read and write tar archive files.\n(line  299)\n* dis command line option; -h:           Command-line interface<2>.\n(line   13)\n* dis command line option; -help:        Command-line interface<2>.\n(line   13)\n* dis() (dis.Bytecode method):           Bytecode analysis.  (line   54)\n* dis() (in module dis):                 Analysis functions. (line   40)\n* dis() (in module pickletools):         Programmatic Interface<2>.\n(line    6)\n* DISABLE (in module sys.monitoring):    Disabling events.   (line    6)\n* disable (pdb command):                 Debugger Commands.  (line  123)\n* disablefaulthandler() (in module test.support): test support -- Utilities for the Python test suite.\n(line  352)\n* disablegc() (in module test.support): test support -- Utilities for the Python test suite.\n(line  364)\n* disableinterspersedargs() (optparse.OptionParser method): Querying and manipulating your option parser.\n(line   10)\n* disable() (bdb.Breakpoint method):     bdb -- Debugger framework.\n(line   52)\n* disable() (in module faulthandler):    Fault handler state.\n(line   25)\n* disable() (in module gc):              gc -- Garbage Collector interface.\n(line   26)\n* disable() (in module logging):         Module-Level Functions.\n(line  103)\n* disable() (profile.Profile method):    profile and cProfile Module Reference.\n(line   82)\n* disabled (logging.Logger attribute):   Logger Objects.     (line   96)\n* DisableReflectionKey() (in module winreg): Functions<13>.  (line  482)\n* disassemble() (in module dis):         Analysis functions. (line   95)\n* discard (http.cookiejar.Cookie attribute): Cookie Objects<2>.\n(line   58)\n* discard() (frozenset method):          Set Types -- set frozenset.\n(line  204)\n* discard() (mailbox.Mailbox method):    Mailbox objects.    (line   76)\n* discard() (mailbox.MH method):         MH objects.         (line   76)\n* disco() (in module dis):               Analysis functions. (line   95)\n* discover() (unittest.TestLoader method): Loading and running tests.\n(line  117)\n* diskusage() (in module shutil):       Directory and files operations.\n(line  365)\n* dispatchcall() (bdb.Bdb method):      bdb -- Debugger framework.\n(line  211)\n* dispatchexception() (bdb.Bdb method): bdb -- Debugger framework.\n(line  231)\n* dispatchline() (bdb.Bdb method):      bdb -- Debugger framework.\n(line  201)\n* dispatchreturn() (bdb.Bdb method):    bdb -- Debugger framework.\n(line  221)\n* dispatchtable (pickle.Pickler attribute): Module Interface.\n(line  176)\n* DISPLAY:                               Tkinter Modules.    (line   27)\n* display (pdb command):                 Debugger Commands.  (line  281)\n* displayname (email.headerregistry.Address attribute): email headerregistry Custom Header Objects.\n(line  425)\n* displayname (email.headerregistry.Group attribute): email headerregistry Custom Header Objects.\n(line  470)\n* displayhook() (in module sys):         sys -- System-specific parameters and functions.\n(line  288)\n* dist() (in module math):               Trigonometric functions.\n(line   35)\n* distance() (in module turtle):         Tell Turtle's state.\n(line   68)\n* distb() (in module dis):               Analysis functions. (line   80)\n* Div (class in ast):                    Expressions<2>.     (line   54)\n* divideint() (decimal.Context method): Context objects.    (line  294)\n* divide() (decimal.Context method):     Context objects.    (line  290)\n* division:                              Binary arithmetic operations.\n(line   31)\n* DivisionByZero (class in decimal):     Signals.            (line   33)\n* divmod() (decimal.Context method):     Context objects.    (line  298)\n* DLE (in module curses.ascii):          curses ascii -- Utilities for ASCII characters.\n(line   73)\n* DllCanUnloadNow() (in module ctypes):  Utility functions.  (line   76)\n* DllGetClassObject() (in module ctypes): Utility functions. (line   82)\n* dllhandle (in module sys):             sys -- System-specific parameters and functions.\n(line  282)\n* dndstart() (in module tkinter.dnd):   tkinter dnd -- Drag and drop support.\n(line   65)\n* DndHandler (class in tkinter.dnd):     tkinter dnd -- Drag and drop support.\n(line   43)\n* dngettext() (in module gettext):       GNU gettext API.    (line   58)\n* dnpgettext() (in module gettext):      GNU gettext API.    (line   69)\n* doclear() (bdb.Bdb method):           bdb -- Debugger framework.\n(line  290)\n* docommand() (curses.textpad.Textbox method): Textbox objects.\n(line   30)\n* doGET() (http.server.SimpleHTTPRequestHandler method): http server -- HTTP servers.\n(line  386)\n* dohandshake() (ssl.SSLSocket method): SSL Sockets.        (line  126)\n* doHEAD() (http.server.SimpleHTTPRequestHandler method): http server -- HTTP servers.\n(line  379)\n* dohelp() (cmd.Cmd method):            Cmd Objects.        (line   49)\n* doPOST() (http.server.CGIHTTPRequestHandler method): http server -- HTTP servers.\n(line  515)\n* doc (json.JSONDecodeError attribute):  Exceptions<15>.     (line   15)\n* docheader (cmd.Cmd attribute):        Cmd Objects.        (line  155)\n* DocCGIXMLRPCRequestHandler (class in xmlrpc.server): Documenting XMLRPC server.\n(line   22)\n* DocFileSuite() (in module doctest):    Unittest API.       (line   24)\n* doClassCleanups() (unittest.TestCase class method): Test cases.\n(line  835)\n* doCleanups() (unittest.TestCase method): Test cases.       (line  793)\n* docmd() (smtplib.SMTP method):         SMTP Objects.       (line   17)\n* docstring:                             Class definitions.  (line    6)\n* docstring <1>:                         Glossary.           (line  388)\n* docstring (doctest.DocTest attribute): DocTest Objects.    (line   49)\n* docstrings:                            Defining Functions. (line   21)\n* docstrings <1>:                        Documentation Strings.\n(line    6)\n* DocTest (class in doctest):            DocTest Objects.    (line    6)\n* DocTestFailure:                        Debugging.          (line  186)\n* DocTestFinder (class in doctest):      DocTestFinder objects.\n(line    6)\n* DocTestParser (class in doctest):      DocTestParser objects.\n(line    6)\n* DocTestRunner (class in doctest):      DocTestRunner objects.\n(line    6)\n* DocTestSuite() (in module doctest):    Unittest API.       (line   99)\n* doctype() (xml.etree.ElementTree.TreeBuilder method): TreeBuilder Objects.\n(line   67)\n* documentation string:                  Special read-only attributes<2>.\n(line   99)\n* documentation strings:                 Defining Functions. (line   21)\n* documentation strings <1>:             Documentation Strings.\n(line    6)\n* documentation; generation:             pydoc -- Documentation generator and online help system.\n(line    8)\n* documentation; online:                 pydoc -- Documentation generator and online help system.\n(line    8)\n* documentElement (xml.dom.Document attribute): Document Objects.\n(line   10)\n* DocXMLRPCRequestHandler (class in xmlrpc.server): Documenting XMLRPC server.\n(line   27)\n* DocXMLRPCServer (class in xmlrpc.server): Documenting XMLRPC server.\n(line   11)\n* domain (email.headerregistry.Address attribute): email headerregistry Custom Header Objects.\n(line  436)\n* domain (http.cookiejar.Cookie attribute): Cookie Objects<2>.\n(line   41)\n* domain (http.cookies.Morsel attribute): Morsel Objects.    (line   13)\n* domain (tracemalloc.DomainFilter attribute): DomainFilter. (line   20)\n* domain (tracemalloc.Filter attribute): Filter.             (line   31)\n* domain (tracemalloc.Trace attribute):  Trace.              (line   15)\n* domaininitialdot (http.cookiejar.Cookie attribute): Cookie Objects<2>.\n(line   90)\n* domainreturnok() (http.cookiejar.CookiePolicy method): CookiePolicy Objects.\n(line   27)\n* domainspecified (http.cookiejar.Cookie attribute): Cookie Objects<2>.\n(line   86)\n* DomainFilter (class in tracemalloc):   DomainFilter.       (line    6)\n* DomainLiberal (http.cookiejar.DefaultCookiePolicy attribute): DefaultCookiePolicy Objects.\n(line  156)\n* DomainRFC2965Match (http.cookiejar.DefaultCookiePolicy attribute): DefaultCookiePolicy Objects.\n(line  149)\n* DomainStrict (http.cookiejar.DefaultCookiePolicy attribute): DefaultCookiePolicy Objects.\n(line  161)\n* DomainStrictNoDots (http.cookiejar.DefaultCookiePolicy attribute): DefaultCookiePolicy Objects.\n(line  136)\n* DomainStrictNonDomain (http.cookiejar.DefaultCookiePolicy attribute): DefaultCookiePolicy Objects.\n(line  142)\n* DOMEventStream (class in xml.dom.pulldom): DOMEventStream Objects.\n(line    6)\n* DOMException:                          Exceptions<18>.     (line   18)\n* doModuleCleanups() (in module unittest): setUpModule and tearDownModule.\n(line   44)\n* DomstringSizeErr:                      Exceptions<18>.     (line   23)\n* done() (asyncio.Future method):        Future Object.      (line   63)\n* done() (asyncio.Task method):          Task Object.        (line   66)\n* done() (concurrent.futures.Future method): Future Objects. (line   32)\n* done() (graphlib.TopologicalSorter method): graphlib -- Functionality to operate with graph-like structures.\n(line  135)\n* done() (in module turtle):             Using screen events.\n(line  106)\n* done() (xdrlib.Unpacker method):       Unpacker Objects.   (line   26)\n* DONTACCEPTBLANKLINE (in module doctest): Option Flags.   (line   30)\n* DONTACCEPTTRUEFOR1 (in module doctest): Option Flags.  (line   18)\n* dontwritebytecode (in module sys):   sys -- System-specific parameters and functions.\n(line  324)\n* dontwritebytecode (sys.flags attribute): sys -- System-specific parameters and functions.\n(line  532)\n* doRollover() (logging.handlers.RotatingFileHandler method): RotatingFileHandler.\n(line   43)\n* doRollover() (logging.handlers.TimedRotatingFileHandler method): TimedRotatingFileHandler.\n(line  106)\n* DOT (in module token):                 token -- Constants used with Python parse trees.\n(line  118)\n* dot() (in module turtle):              Turtle motion.      (line  252)\n* DOTALL (in module re):                 Flags.              (line  108)\n* doublequote (csv.Dialect attribute):   Dialects and Formatting Parameters.\n(line   24)\n* DOUBLESLASH (in module token):         token -- Constants used with Python parse trees.\n(line  214)\n* DOUBLESLASHEQUAL (in module token):    token -- Constants used with Python parse trees.\n(line  218)\n* DOUBLESTAR (in module token):          token -- Constants used with Python parse trees.\n(line  166)\n* DOUBLESTAREQUAL (in module token):     token -- Constants used with Python parse trees.\n(line  210)\n* doupdate() (in module curses):         Functions<6>.       (line   89)\n* down (pdb command):                    Debugger Commands.  (line   84)\n* down() (in module turtle):             Drawing state.      (line    6)\n* dpgettext() (in module gettext):       GNU gettext API.    (line   65)\n* drain() (asyncio.StreamWriter method): StreamWriter.       (line   66)\n* drive (pathlib.PurePath attribute):    Methods and properties.\n(line    8)\n* dropwhitespace (textwrap.TextWrapper attribute): textwrap -- Text wrapping and filling.\n(line  201)\n* dropwhile() (in module itertools):     Itertool Functions. (line  287)\n* dst() (datetime.datetime method):      datetime Objects.   (line  513)\n* dst() (datetime.time method):          time Objects.       (line  243)\n* dst() (datetime.timezone method):      timezone Objects.   (line   57)\n* dst() (datetime.tzinfo method):        tzinfo Objects.     (line   65)\n* DTDHandler (class in xml.sax.handler): xml sax handler -- Base classes for SAX handlers.\n(line   24)\n* duck-typing:                           Glossary.           (line  397)\n* dumpstats() (profile.Profile method): profile and cProfile Module Reference.\n(line   96)\n* dumpstats() (pstats.Stats method):    The Stats Class.    (line   59)\n* dumptracebacklater() (in module faulthandler): Dumping the tracebacks after a timeout.\n(line    6)\n* dumptraceback() (in module faulthandler): Dumping the traceback.\n(line    6)\n* dump() (in module ast):                ast Helpers.        (line  263)\n* dump() (in module json):               Basic Usage.        (line    6)\n* dump() (in module marshal):            marshal -- Internal Python object serialization.\n(line   47)\n* dump() (in module pickle):             Module Interface.   (line   35)\n* dump() (in module plistlib):           plistlib -- Generate and parse Apple plist files.\n(line   81)\n* dump() (in module xml.etree.ElementTree): Functions<9>.    (line   86)\n* dump() (pickle.Pickler method):        Module Interface.   (line  155)\n* dump() (tracemalloc.Snapshot method):  Snapshot.           (line   29)\n* dumps() (in module json):              Basic Usage.        (line   78)\n* dumps() (in module marshal):           marshal -- Internal Python object serialization.\n(line   82)\n* dumps() (in module pickle):            Module Interface.   (line   47)\n* dumps() (in module plistlib):          plistlib -- Generate and parse Apple plist files.\n(line  111)\n* dumps() (in module xmlrpc.client):     Convenience Functions.\n(line    6)\n* dup() (in module os):                  File Descriptor Operations.\n(line   93)\n* dup() (socket.socket method):          Socket Objects.     (line  108)\n* dup2() (in module os):                 File Descriptor Operations.\n(line  107)\n* DuplicateOptionError:                  Exceptions<7>.      (line   24)\n* DuplicateSectionError:                 Exceptions<7>.      (line   14)\n* dwFlags (subprocess.STARTUPINFO attribute): Windows Popen Helpers.\n(line   19)\n* DynamicClassAttribute() (in module types): Additional Utility Classes and Functions.\n(line   40)\n* e (in module cmath):                   Constants<3>.       (line   10)\n* e (in module math):                    Constants<2>.       (line   10)\n* e; in numeric literal:                 Integer literals.   (line   40)\n* E2BIG (in module errno):               errno -- Standard errno system symbols.\n(line   54)\n* EACCES (in module errno):              errno -- Standard errno system symbols.\n(line   80)\n* EADDRINUSE (in module errno):          errno -- Standard errno system symbols.\n(line  432)\n* EADDRNOTAVAIL (in module errno):       errno -- Standard errno system symbols.\n(line  436)\n* EADV (in module errno):                errno -- Standard errno system symbols.\n(line  306)\n* EAFNOSUPPORT (in module errno):        errno -- Standard errno system symbols.\n(line  428)\n* EAFP:                                  Glossary.           (line  410)\n* EAGAIN (in module errno):              errno -- Standard errno system symbols.\n(line   71)\n* eagertaskfactory() (in module asyncio): Eager Task Factory.\n(line    6)\n* EALREADY (in module errno):            errno -- Standard errno system symbols.\n(line  501)\n* eastasianwidth() (in module unicodedata): unicodedata -- Unicode Database.\n(line   64)\n* EBADE (in module errno):               errno -- Standard errno system symbols.\n(line  242)\n* EBADF (in module errno):               errno -- Standard errno system symbols.\n(line   62)\n* EBADFD (in module errno):              errno -- Standard errno system symbols.\n(line  342)\n* EBADMSG (in module errno):             errno -- Standard errno system symbols.\n(line  330)\n* EBADR (in module errno):               errno -- Standard errno system symbols.\n(line  246)\n* EBADRQC (in module errno):             errno -- Standard errno system symbols.\n(line  258)\n* EBADSLT (in module errno):             errno -- Standard errno system symbols.\n(line  262)\n* EBFONT (in module errno):              errno -- Standard errno system symbols.\n(line  270)\n* EBUSY (in module errno):               errno -- Standard errno system symbols.\n(line   93)\n* ECANCELED (in module errno):           errno -- Standard errno system symbols.\n(line  554)\n* ECHILD (in module errno):              errno -- Standard errno system symbols.\n(line   66)\n* echo() (in module curses):             Functions<6>.       (line  105)\n* echochar() (curses.window method):     Window Objects.     (line  196)\n* ECHRNG (in module errno):              errno -- Standard errno system symbols.\n(line  210)\n* ECOMM (in module errno):               errno -- Standard errno system symbols.\n(line  314)\n* ECONNABORTED (in module errno):        errno -- Standard errno system symbols.\n(line  452)\n* ECONNREFUSED (in module errno):        errno -- Standard errno system symbols.\n(line  488)\n* ECONNRESET (in module errno):          errno -- Standard errno system symbols.\n(line  457)\n* EDEADLK (in module errno):             errno -- Standard errno system symbols.\n(line  173)\n* EDEADLOCK (in module errno):           errno -- Standard errno system symbols.\n(line  266)\n* EDESTADDRREQ (in module errno):        errno -- Standard errno system symbols.\n(line  390)\n* edit() (curses.textpad.Textbox method): Textbox objects.   (line   19)\n* EDOM (in module errno):                errno -- Standard errno system symbols.\n(line  165)\n* EDOTDOT (in module errno):             errno -- Standard errno system symbols.\n(line  326)\n* EDQUOT (in module errno):              errno -- Standard errno system symbols.\n(line  535)\n* EEXIST (in module errno):              errno -- Standard errno system symbols.\n(line   97)\n* EFAULT (in module errno):              errno -- Standard errno system symbols.\n(line   85)\n* EFBIG (in module errno):               errno -- Standard errno system symbols.\n(line  140)\n* EFDCLOEXEC (in module os):            Files and Directories.\n(line 1902)\n* EFDNONBLOCK (in module os):           Files and Directories.\n(line 1911)\n* EFDSEMAPHORE (in module os):          Files and Directories.\n(line 1920)\n* effective() (in module bdb):           bdb -- Debugger framework.\n(line  458)\n* ehloorheloifneeded() (smtplib.SMTP method): SMTP Objects.\n(line   75)\n* ehlo() (smtplib.SMTP method):          SMTP Objects.       (line   58)\n* EHOSTDOWN (in module errno):           errno -- Standard errno system symbols.\n(line  493)\n* EHOSTUNREACH (in module errno):        errno -- Standard errno system symbols.\n(line  497)\n* EIDRM (in module errno):               errno -- Standard errno system symbols.\n(line  206)\n* EILSEQ (in module errno):              errno -- Standard errno system symbols.\n(line  370)\n* EINPROGRESS (in module errno):         errno -- Standard errno system symbols.\n(line  506)\n* EINTR (in module errno):               errno -- Standard errno system symbols.\n(line   41)\n* EINVAL (in module errno):              errno -- Standard errno system symbols.\n(line  120)\n* EIO (in module errno):                 errno -- Standard errno system symbols.\n(line   46)\n* EISCONN (in module errno):             errno -- Standard errno system symbols.\n(line  466)\n* EISDIR (in module errno):              errno -- Standard errno system symbols.\n(line  115)\n* EISNAM (in module errno):              errno -- Standard errno system symbols.\n(line  527)\n* EJECT (enum.FlagBoundary attribute):   Data Types<2>.      (line  659)\n* EL2HLT (in module errno):              errno -- Standard errno system symbols.\n(line  238)\n* EL2NSYNC (in module errno):            errno -- Standard errno system symbols.\n(line  214)\n* EL3HLT (in module errno):              errno -- Standard errno system symbols.\n(line  218)\n* EL3RST (in module errno):              errno -- Standard errno system symbols.\n(line  222)\n* Element (class in xml.etree.ElementTree): Element Objects. (line    6)\n* elementcreate() (tkinter.ttk.Style method): Ttk Styling.  (line  131)\n* elementnames() (tkinter.ttk.Style method): Ttk Styling.   (line  188)\n* elementoptions() (tkinter.ttk.Style method): Ttk Styling. (line  192)\n* ElementDeclHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line  240)\n* elements() (collections.Counter method): Counter objects.  (line   67)\n* ElementTree (class in xml.etree.ElementTree): ElementTree Objects.\n(line    6)\n* ELIBACC (in module errno):             errno -- Standard errno system symbols.\n(line  350)\n* ELIBBAD (in module errno):             errno -- Standard errno system symbols.\n(line  354)\n* ELIBEXEC (in module errno):            errno -- Standard errno system symbols.\n(line  366)\n* ELIBMAX (in module errno):             errno -- Standard errno system symbols.\n(line  362)\n* ELIBSCN (in module errno):             errno -- Standard errno system symbols.\n(line  358)\n* Ellinghouse, Lance:                    uu -- Encode and decode uuencode files.\n(line   24)\n* Ellipsis (built-in variable):          Built-in Constants. (line   59)\n* ELLIPSIS (in module doctest):          Option Flags.       (line   49)\n* ELLIPSIS (in module token):            token -- Constants used with Python parse trees.\n(line  234)\n* EllipsisType (in module types):        Standard Interpreter Types.\n(line  188)\n* ELNRNG (in module errno):              errno -- Standard errno system symbols.\n(line  226)\n* ELOOP (in module errno):               errno -- Standard errno system symbols.\n(line  193)\n* else; conditional expression:          Conditional expressions.\n(line    6)\n* EM (in module curses.ascii):           curses ascii -- Utilities for ASCII characters.\n(line  100)\n* EmailMessage (class in email.message): email message Representing an email message.\n(line   52)\n* EmailPolicy (class in email.policy):   email policy Policy Objects.\n(line  359)\n* EMFILE (in module errno):              errno -- Standard errno system symbols.\n(line  128)\n* emit() (logging.FileHandler method):   FileHandler.        (line   31)\n* emit() (logging.Handler method):       Handler Objects.    (line  107)\n* emit() (logging.handlers.BufferingHandler method): MemoryHandler.\n(line   24)\n* emit() (logging.handlers.DatagramHandler method): DatagramHandler.\n(line   29)\n* emit() (logging.handlers.HTTPHandler method): HTTPHandler. (line   36)\n* emit() (logging.handlers.NTEventLogHandler method): NTEventLogHandler.\n(line   38)\n* emit() (logging.handlers.QueueHandler method): QueueHandler.\n(line   35)\n* emit() (logging.handlers.RotatingFileHandler method): RotatingFileHandler.\n(line   47)\n* emit() (logging.handlers.SMTPHandler method): SMTPHandler. (line   35)\n* emit() (logging.handlers.SocketHandler method): SocketHandler.\n(line   24)\n* emit() (logging.handlers.SysLogHandler method): SysLogHandler.\n(line   61)\n* emit() (logging.handlers.TimedRotatingFileHandler method): TimedRotatingFileHandler.\n(line  110)\n* emit() (logging.handlers.WatchedFileHandler method): WatchedFileHandler.\n(line   50)\n* emit() (logging.NullHandler method):   NullHandler.        (line   16)\n* emit() (logging.StreamHandler method): StreamHandler.      (line   17)\n* EMLINK (in module errno):              errno -- Standard errno system symbols.\n(line  156)\n* Empty:                                 queue -- A synchronized queue class.\n(line   82)\n* empty (inspect.Parameter attribute):   Introspecting callables with the Signature object.\n(line  184)\n* empty (inspect.Signature attribute):   Introspecting callables with the Signature object.\n(line   99)\n* EMPTYNAMESPACE (in module xml.dom):   Module Contents<4>. (line   35)\n* empty; list:                           List displays.      (line    6)\n* empty; tuple:                          Immutable sequences.\n(line   29)\n* empty; tuple <1>:                      Parenthesized forms.\n(line   16)\n* empty() (asyncio.Queue method):        Queue.              (line   27)\n* empty() (multiprocessing.Queue method): Pipes and Queues.  (line  108)\n* empty() (multiprocessing.SimpleQueue method): Pipes and Queues.\n(line  219)\n* empty() (queue.Queue method):          Queue Objects.      (line   15)\n* empty() (queue.SimpleQueue method):    SimpleQueue Objects.\n(line   14)\n* empty() (sched.scheduler method):      Scheduler Objects.  (line   47)\n* emptyline() (cmd.Cmd method):          Cmd Objects.        (line   70)\n* emscriptenversion (sys.emscripteninfo attribute): sys -- System-specific parameters and functions.\n(line  338)\n* EMSGSIZE (in module errno):            errno -- Standard errno system symbols.\n(line  394)\n* EMULTIHOP (in module errno):           errno -- Standard errno system symbols.\n(line  322)\n* enable (pdb command):                  Debugger Commands.  (line  130)\n* enablecallbacktracebacks() (in module sqlite3): Module functions.\n(line  123)\n* enableinterspersedargs() (optparse.OptionParser method): Querying and manipulating your option parser.\n(line   31)\n* enableloadextension() (sqlite3.Connection method): Connection objects.\n(line  405)\n* enabletraversal() (tkinter.ttk.Notebook method): ttk Notebook.\n(line   75)\n* ENABLEUSERSITE (in module site):     Module contents<5>. (line   10)\n* enable() (bdb.Breakpoint method):      bdb -- Debugger framework.\n(line   48)\n* enable() (imaplib.IMAP4 method):       IMAP4 Objects.      (line   84)\n* enable() (in module cgitb):            cgitb -- Traceback manager for CGI scripts.\n(line   33)\n* enable() (in module faulthandler):     Fault handler state.\n(line    6)\n* enable() (in module gc):               gc -- Garbage Collector interface.\n(line   22)\n* enable() (profile.Profile method):     profile and cProfile Module Reference.\n(line   78)\n* EnableControlFlowGuard:                Build<24>.          (line   47)\n* enabled (bdb.Breakpoint attribute):    bdb -- Debugger framework.\n(line  106)\n* EnableReflectionKey() (in module winreg): Functions<13>.   (line  500)\n* ENAMETOOLONG (in module errno):        errno -- Standard errno system symbols.\n(line  177)\n* ENAVAIL (in module errno):             errno -- Standard errno system symbols.\n(line  523)\n* enclose() (curses.window method):      Window Objects.     (line  201)\n* encode (codecs.CodecInfo attribute):   codecs -- Codec registry and base classes.\n(line   69)\n* encode7or8bit() (in module email.encoders): email encoders Encoders.\n(line   57)\n* encodebase64() (in module email.encoders): email encoders Encoders.\n(line   49)\n* encodenoop() (in module email.encoders): email encoders Encoders.\n(line   63)\n* encodequopri() (in module email.encoders): email encoders Encoders.\n(line   42)\n* encoderfc2231() (in module email.utils): email utils Miscellaneous utilities.\n(line  191)\n* encode() (codecs.Codec method):        Stateless Encoding and Decoding.\n(line   11)\n* encode() (codecs.IncrementalEncoder method): IncrementalEncoder Objects.\n(line   28)\n* encode() (email.header.Header method): email header Internationalized headers.\n(line  125)\n* encode() (in module base64):           base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line  247)\n* encode() (in module codecs):           codecs -- Codec registry and base classes.\n(line   23)\n* encode() (in module quopri):           quopri -- Encode and decode MIME quoted-printable data.\n(line   29)\n* encode() (in module uu):               uu -- Encode and decode uuencode files.\n(line   29)\n* encode() (json.JSONEncoder method):    Encoders and Decoders.\n(line  217)\n* encode() (str method):                 String Methods<2>.  (line   64)\n* encode() (xmlrpc.client.Binary method): Binary Objects.    (line   25)\n* encode() (xmlrpc.client.DateTime method): DateTime Objects.\n(line   17)\n* encodebytes() (in module base64):      base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line  257)\n* EncodedFile() (in module codecs):      codecs -- Codec registry and base classes.\n(line  203)\n* encodePriority() (logging.handlers.SysLogHandler method): SysLogHandler.\n(line   95)\n* encodestring() (in module quopri):     quopri -- Encode and decode MIME quoted-printable data.\n(line   46)\n* encoding (curses.window attribute):    Window Objects.     (line  211)\n* ENCODING (in module tarfile):          tarfile -- Read and write tar archive files.\n(line  273)\n* ENCODING (in module token):            token -- Constants used with Python parse trees.\n(line  288)\n* encoding (io.TextIOBase attribute):    Text I/O<2>.        (line   15)\n* encoding (UnicodeError attribute):     Concrete exceptions.\n(line  414)\n* encoding declarations (source file):   Encoding declarations.\n(line    6)\n* encodingsmap (in module mimetypes):   mimetypes -- Map filenames to MIME types.\n(line  136)\n* encodingsmap (mimetypes.MimeTypes attribute): MimeTypes Objects.\n(line   33)\n* EncodingWarning:                       Warnings.           (line   68)\n* end (UnicodeError attribute):          Concrete exceptions.\n(line  430)\n* ENDASYNCFOR (opcode):                Python Bytecode Instructions.\n(line  278)\n* endcoloffset (ast.AST attribute):    Node classes.       (line   39)\n* endfill() (in module turtle):         Filling.            (line   20)\n* ENDFOR (opcode):                      Python Bytecode Instructions.\n(line   93)\n* endheaders() (http.server.BaseHTTPRequestHandler method): http server -- HTTP servers.\n(line  276)\n* endlineno (ast.AST attribute):        Node classes.       (line   39)\n* endlineno (SyntaxError attribute):    Concrete exceptions.\n(line  308)\n* endlineno (traceback.TracebackException attribute): TracebackException Objects.\n(line   86)\n* endns() (xml.etree.ElementTree.TreeBuilder method): TreeBuilder Objects.\n(line   86)\n* endoffset (SyntaxError attribute):    Concrete exceptions.\n(line  314)\n* endoffset (traceback.TracebackException attribute): TracebackException Objects.\n(line  102)\n* endpoly() (in module turtle):         Special Turtle methods.\n(line   11)\n* ENDSEND (opcode):                     Python Bytecode Instructions.\n(line  101)\n* end() (re.Match method):               Match Objects.      (line  147)\n* end() (xml.etree.ElementTree.TreeBuilder method): TreeBuilder Objects.\n(line   38)\n* endCDATA() (xml.sax.handler.LexicalHandler method): LexicalHandler Objects.\n(line   39)\n* EndCdataSectionHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line  347)\n* EndDoctypeDeclHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line  235)\n* endDocument() (xml.sax.handler.ContentHandler method): ContentHandler Objects.\n(line   40)\n* endDTD() (xml.sax.handler.LexicalHandler method): LexicalHandler Objects.\n(line   28)\n* endElement() (xml.sax.handler.ContentHandler method): ContentHandler Objects.\n(line   95)\n* EndElementHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line  270)\n* endElementNS() (xml.sax.handler.ContentHandler method): ContentHandler Objects.\n(line  121)\n* endheaders() (http.client.HTTPConnection method): HTTPConnection Objects.\n(line  184)\n* ENDMARKER (in module token):           token -- Constants used with Python parse trees.\n(line   40)\n* EndNamespaceDeclHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line  326)\n* endpos (re.Match attribute):           Match Objects.      (line  186)\n* endPrefixMapping() (xml.sax.handler.ContentHandler method): ContentHandler Objects.\n(line   73)\n* endswith() (bytearray method):         Bytes and Bytearray Operations.\n(line  122)\n* endswith() (bytes method):             Bytes and Bytearray Operations.\n(line  122)\n* endswith() (str method):               String Methods<2>.  (line   89)\n* endwin() (in module curses):           Functions<6>.       (line  110)\n* ENETDOWN (in module errno):            errno -- Standard errno system symbols.\n(line  440)\n* ENETRESET (in module errno):           errno -- Standard errno system symbols.\n(line  448)\n* ENETUNREACH (in module errno):         errno -- Standard errno system symbols.\n(line  444)\n* ENFILE (in module errno):              errno -- Standard errno system symbols.\n(line  124)\n* ENOANO (in module errno):              errno -- Standard errno system symbols.\n(line  254)\n* ENOBUFS (in module errno):             errno -- Standard errno system symbols.\n(line  462)\n* ENOCSI (in module errno):              errno -- Standard errno system symbols.\n(line  234)\n* ENODATA (in module errno):             errno -- Standard errno system symbols.\n(line  278)\n* ENODEV (in module errno):              errno -- Standard errno system symbols.\n(line  106)\n* ENOENT (in module errno):              errno -- Standard errno system symbols.\n(line   31)\n* ENOEXEC (in module errno):             errno -- Standard errno system symbols.\n(line   58)\n* ENOLCK (in module errno):              errno -- Standard errno system symbols.\n(line  181)\n* ENOLINK (in module errno):             errno -- Standard errno system symbols.\n(line  302)\n* ENOMEM (in module errno):              errno -- Standard errno system symbols.\n(line   76)\n* ENOMSG (in module errno):              errno -- Standard errno system symbols.\n(line  202)\n* ENONET (in module errno):              errno -- Standard errno system symbols.\n(line  290)\n* ENOPKG (in module errno):              errno -- Standard errno system symbols.\n(line  294)\n* ENOPROTOOPT (in module errno):         errno -- Standard errno system symbols.\n(line  402)\n* ENOSPC (in module errno):              errno -- Standard errno system symbols.\n(line  144)\n* ENOSR (in module errno):               errno -- Standard errno system symbols.\n(line  286)\n* ENOSTR (in module errno):              errno -- Standard errno system symbols.\n(line  274)\n* ENOSYS (in module errno):              errno -- Standard errno system symbols.\n(line  185)\n* ENOTBLK (in module errno):             errno -- Standard errno system symbols.\n(line   89)\n* ENOTCAPABLE (in module errno):         errno -- Standard errno system symbols.\n(line  545)\n* ENOTCONN (in module errno):            errno -- Standard errno system symbols.\n(line  470)\n* ENOTDIR (in module errno):             errno -- Standard errno system symbols.\n(line  110)\n* ENOTEMPTY (in module errno):           errno -- Standard errno system symbols.\n(line  189)\n* ENOTNAM (in module errno):             errno -- Standard errno system symbols.\n(line  519)\n* ENOTRECOVERABLE (in module errno):     errno -- Standard errno system symbols.\n(line  566)\n* ENOTSOCK (in module errno):            errno -- Standard errno system symbols.\n(line  386)\n* ENOTSUP (in module errno):             errno -- Standard errno system symbols.\n(line  418)\n* ENOTTY (in module errno):              errno -- Standard errno system symbols.\n(line  132)\n* ENOTUNIQ (in module errno):            errno -- Standard errno system symbols.\n(line  338)\n* ENQ (in module curses.ascii):          curses ascii -- Utilities for ASCII characters.\n(line   34)\n* enqueuesentinel() (logging.handlers.QueueListener method): QueueListener.\n(line   91)\n* enqueue() (logging.handlers.QueueHandler method): QueueHandler.\n(line   78)\n* ensuredirectories() (venv.EnvBuilder method): API<2>.     (line   85)\n* ensurefuture() (in module asyncio):   Future Functions.   (line   19)\n* enterasynccontext() (contextlib.AsyncExitStack method): Utilities.\n(line  631)\n* entercontext() (contextlib.ExitStack method): Utilities.  (line  546)\n* enter() (sched.scheduler method):      Scheduler Objects.  (line   30)\n* enterabs() (sched.scheduler method):   Scheduler Objects.  (line    9)\n* enterAsyncContext() (unittest.IsolatedAsyncioTestCase method): Test cases.\n(line  888)\n* enterClassContext() (unittest.TestCase class method): Test cases.\n(line  826)\n* enterContext() (unittest.TestCase method): Test cases.     (line  784)\n* enterModuleContext() (in module unittest): setUpModule and tearDownModule.\n(line   35)\n* entities (xml.dom.DocumentType attribute): DocumentType Objects.\n(line   38)\n* EntityDeclHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line  299)\n* entitydefs (in module html.entities):  html entities -- Definitions of HTML general entities.\n(line   25)\n* EntityResolver (class in xml.sax.handler): xml sax handler -- Base classes for SAX handlers.\n(line   31)\n* Enum (class in enum):                  Data Types<2>.      (line  120)\n* enumcertificates() (in module ssl):   Certificate handling.\n(line   87)\n* enumcrls() (in module ssl):           Certificate handling.\n(line  110)\n* EnumCheck (class in enum):             Data Types<2>.      (line  563)\n* enumerate() (in module threading):     threading -- Thread-based parallelism.\n(line  142)\n* EnumKey() (in module winreg):          Functions<13>.      (line  172)\n* EnumType (class in enum):              Data Types<2>.      (line    6)\n* EnumValue() (in module winreg):        Functions<13>.      (line  191)\n* EnvBuilder (class in venv):            API<2>.             (line   11)\n* environ (in module os):                Process Parameters. (line   16)\n* environ (in module posix):             Notable Module Contents.\n(line    9)\n* environb (in module os):               Process Parameters. (line   58)\n* environment:                           Resolution of names.\n(line   12)\n* environment variable; PYVENVLAUNCHER: PyConfig.       (line  179)\n* environment variable; PYVENVLAUNCHER <1>: PyConfig.   (line  678)\n* environment variable; %APPDATA%:       Redirection of local data registry and temporary paths.\n(line   13)\n* environment variable; APPDATA:         PEP 370 Per-user site-packages Directory.\n(line   26)\n* environment variable; AUDIODEV:        ossaudiodev -- Access to OSS-compatible audio devices.\n(line   58)\n* environment variable; BASECFLAGS:      Compiler flags.     (line   66)\n* environment variable; BASECPPFLAGS:    Preprocessor flags. (line   22)\n* environment variable; BLDSHARED:       Linker flags.       (line   67)\n* environment variable; BROWSER:         webbrowser -- Convenient web-browser controller.\n(line   20)\n* environment variable; BROWSER <1>:     webbrowser -- Convenient web-browser controller.\n(line  101)\n* environment variable; CC:              New Improved and Deprecated Modules<4>.\n(line   58)\n* environment variable; CC <1>:          Compiler flags.     (line    6)\n* environment variable; CCSHARED:        Compiler flags.     (line   81)\n* environment variable; CFLAGS:          New Improved and Deprecated Modules<4>.\n(line   59)\n* environment variable; CFLAGS <1>:      Compiler flags.     (line   18)\n* environment variable; CFLAGS <2>:      Compiler flags.     (line   26)\n* environment variable; CFLAGS <3>:      Compiler flags.     (line   28)\n* environment variable; CFLAGS <4>:      Compiler flags.     (line   32)\n* environment variable; CFLAGS <5>:      Compiler flags.     (line   54)\n* environment variable; CFLAGS <6>:      Linker flags.       (line   18)\n* environment variable; CFLAGSALIASING: Compiler flags.     (line   74)\n* environment variable; CFLAGSNODIST:   Compiler flags.     (line   22)\n* environment variable; CFLAGSNODIST <1>: Compiler flags.   (line   24)\n* environment variable; CFLAGSNODIST <2>: Compiler flags.   (line   61)\n* environment variable; CFLAGSNODIST <3>: Linker flags.     (line   26)\n* environment variable; CFLAGSFORSHARED: Compiler flags.     (line   87)\n* environment variable; COLUMNS:         Functions<6>.       (line  595)\n* environment variable; COLUMNS <1>:     Functions<6>.       (line  598)\n* environment variable; COMPILEALLOPTS: Compiler flags.     (line   41)\n* environment variable; COMSPEC:         Process Management. (line  764)\n* environment variable; COMSPEC <1>:     Popen Constructor.  (line  112)\n* environment variable; CONFIGURECFLAGS: Compiler flags.    (line   52)\n* environment variable; CONFIGURECFLAGSNODIST: Compiler flags.\n(line   59)\n* environment variable; CONFIGURECPPFLAGS: Preprocessor flags.\n(line    6)\n* environment variable; CONFIGURELDFLAGS: Linker flags.     (line   13)\n* environment variable; CONFIGURELDFLAGSNODIST: Linker flags.\n(line   38)\n* environment variable; CPPFLAGS:        New Improved and Deprecated Modules<4>.\n(line   59)\n* environment variable; CPPFLAGS <1>:    Preprocessor flags. (line    8)\n* environment variable; CPPFLAGS <2>:    Preprocessor flags. (line   13)\n* environment variable; CPPFLAGS <3>:    Preprocessor flags. (line   18)\n* environment variable; CPPFLAGS <4>:    Linker flags.       (line   50)\n* environment variable; CXX:             Compiler flags.     (line   12)\n* environment variable; DISPLAY:         Tkinter Modules.    (line   27)\n* environment variable; EnableControlFlowGuard: Build<24>.   (line   47)\n* environment variable; EXTRACFLAGS:    Compiler flags.     (line   48)\n* environment variable; HOME:            os path<4>.         (line   15)\n* environment variable; HOME <1>:        Changes in the Python API<4>.\n(line  117)\n* environment variable; HOME <2>:        Windows<35>.        (line   15)\n* environment variable; HOME <3>:        Windows<35>.        (line   18)\n* environment variable; HOME <4>:        os path -- Common pathname manipulations.\n(line  135)\n* environment variable; HOME <5>:        os path -- Common pathname manipulations.\n(line  152)\n* environment variable; HOME <6>:        Tkinter Modules.    (line   66)\n* environment variable; HOMEDRIVE:       os path -- Common pathname manipulations.\n(line  142)\n* environment variable; HOMEPATH:        os path -- Common pathname manipulations.\n(line  142)\n* environment variable; IDLESTARTUP:     IDLE<30>.           (line  176)\n* environment variable; IDLESTARTUP <1>: IDLE<34>.           (line    9)\n* environment variable; IDLESTARTUP <2>: IDLE<40>.           (line    9)\n* environment variable; IDLESTARTUP <3>: Startup and Code Execution.\n(line    7)\n* environment variable; KDEDIR:          webbrowser -- Convenient web-browser controller.\n(line  175)\n* environment variable; LANG:            GNU gettext API.    (line   21)\n* environment variable; LANG <1>:        Class-based API.    (line   26)\n* environment variable; LANG <2>:        locale -- Internationalization services.\n(line   49)\n* environment variable; LANG <3>:        locale -- Internationalization services.\n(line  344)\n* environment variable; LANG <4>:        locale -- Internationalization services.\n(line  348)\n* environment variable; LANGUAGE:        GNU gettext API.    (line   20)\n* environment variable; LANGUAGE <1>:    Class-based API.    (line   25)\n* environment variable; LCALL:          GNU gettext API.    (line   20)\n* environment variable; LCALL <1>:      Class-based API.    (line   25)\n* environment variable; LCMESSAGES:     GNU gettext API.    (line   20)\n* environment variable; LCMESSAGES <1>: Class-based API.    (line   26)\n* environment variable; LDCXXSHARED:     Build and C API Changes<8>.\n(line  154)\n* environment variable; LDFLAGS:         New Improved and Deprecated Modules<4>.\n(line   59)\n* environment variable; LDFLAGS <1>:     Preprocessor flags. (line   18)\n* environment variable; LDFLAGS <2>:     Linker flags.       (line   15)\n* environment variable; LDFLAGS <3>:     Linker flags.       (line   18)\n* environment variable; LDFLAGS <4>:     Linker flags.       (line   28)\n* environment variable; LDFLAGS <5>:     Linker flags.       (line   31)\n* environment variable; LDFLAGS <6>:     Linker flags.       (line   35)\n* environment variable; LDFLAGS <7>:     Linker flags.       (line   45)\n* environment variable; LDFLAGS <8>:     Linker flags.       (line   50)\n* environment variable; LDFLAGSNODIST:  Linker flags.       (line   24)\n* environment variable; LDFLAGSNODIST <1>: Linker flags.    (line   26)\n* environment variable; LDFLAGSNODIST <2>: Linker flags.    (line   40)\n* environment variable; LDSHARED:        Linker flags.       (line   61)\n* environment variable; LIBS:            Linker flags.       (line   54)\n* environment variable; LINES:           Functions<6>.       (line  125)\n* environment variable; LINES <1>:       Functions<6>.       (line  595)\n* environment variable; LINES <2>:       Functions<6>.       (line  597)\n* environment variable; LINKCC:          Linker flags.       (line    6)\n* environment variable; LOGNAME:         Process Parameters. (line  239)\n* environment variable; LOGNAME <1>:     getpass -- Portable password input.\n(line   44)\n* environment variable; MIXERDEV:        ossaudiodev -- Access to OSS-compatible audio devices.\n(line   78)\n* environment variable; noproxy:        urllib request -- Extensible library for opening URLs.\n(line  313)\n* environment variable; OPT:             Debug options.      (line   34)\n* environment variable; OPT <1>:         Compiler flags.     (line   70)\n* environment variable; PAGER:           pydoc -- Documentation generator and online help system.\n(line   46)\n* environment variable; PATH:            Changes in the Python API<4>.\n(line  144)\n* environment variable; PATH <1>:        Changes in 'python' Command Behavior<2>.\n(line    6)\n* environment variable; PATH <2>:        Changes in 'python' Command Behavior<2>.\n(line   11)\n* environment variable; PATH <3>:        Changes in 'python' Command Behavior<2>.\n(line   12)\n* environment variable; PATH <4>:        Windows<16>.        (line   56)\n* environment variable; PATH <5>:        Windows<20>.        (line   14)\n* environment variable; PATH <6>:        Security<29>.       (line   16)\n* environment variable; PATH <7>:        Security<29>.       (line   20)\n* environment variable; PATH <8>:        The Module Search Path.\n(line   17)\n* environment variable; PATH <9>:        Executable Python Scripts.\n(line   11)\n* environment variable; PATH <10>:       Environment variables.\n(line   27)\n* environment variable; PATH <11>:       Miscellaneous.      (line   16)\n* environment variable; PATH <12>:       Installation steps. (line   34)\n* environment variable; PATH <13>:       Installation steps. (line   58)\n* environment variable; PATH <14>:       Installing Without UI.\n(line   77)\n* environment variable; PATH <15>:       Installing Without UI.\n(line   81)\n* environment variable; PATH <16>:       Excursus Setting environment variables.\n(line   23)\n* environment variable; PATH <17>:       Excursus Setting environment variables.\n(line   35)\n* environment variable; PATH <18>:       Finding the Python executable.\n(line   14)\n* environment variable; PATH <19>:       Finding the Python executable.\n(line   21)\n* environment variable; PATH <20>:       Finding the Python executable.\n(line   22)\n* environment variable; PATH <21>:       Python Launcher for Windows.\n(line   13)\n* environment variable; PATH <22>:       From the command-line.\n(line    9)\n* environment variable; PATH <23>:       Shebang Lines.      (line   53)\n* environment variable; PATH <24>:       Shebang Lines.      (line   55)\n* environment variable; PATH <25>:       Shebang Lines.      (line   60)\n* environment variable; PATH <26>:       Process Management. (line   45)\n* environment variable; PATH <27>:       Process Management. (line   86)\n* environment variable; PATH <28>:       Process Management. (line   89)\n* environment variable; PATH <29>:       Process Management. (line   92)\n* environment variable; PATH <30>:       Process Management. (line  532)\n* environment variable; PATH <31>:       Process Management. (line  619)\n* environment variable; PATH <32>:       Process Management. (line  623)\n* environment variable; PATH <33>:       Process Management. (line  625)\n* environment variable; PATH <34>:       Miscellaneous System Information.\n(line  121)\n* environment variable; PATH <35>:       Popen Constructor.  (line   34)\n* environment variable; PATH <36>:       webbrowser -- Convenient web-browser controller.\n(line  212)\n* environment variable; PATH <37>:       How venvs work.     (line   16)\n* environment variable; PATH <38>:       How venvs work.     (line   61)\n* environment variable; PATH <39>:       How venvs work.     (line   66)\n* environment variable; PATH <40>:       site -- Site-specific configuration hook.\n(line   59)\n* environment variable; PATH <41>:       Installing your CGI script on a Unix system.\n(line   29)\n* environment variable; PATH <42>:       Common problems and solutions.\n(line   23)\n* environment variable; PATH <43>:       Embedding Python<2>.\n(line   31)\n* environment variable; PATH <44>:       Embedding Python<2>.\n(line   37)\n* environment variable; PATH <45>:       How do I make a Python script executable on Unix?.\n(line   24)\n* environment variable; PATH <46>:       How do I make a Python script executable on Unix?.\n(line   28)\n* environment variable; PATHEXT:         Other Improvements<2>.\n(line   30)\n* environment variable; PATHEXT <1>:     Library<33>.        (line  138)\n* environment variable; PATHEXT <2>:     Installing Without UI.\n(line   77)\n* environment variable; PATHEXT <3>:     Installing Without UI.\n(line   81)\n* environment variable; PIPUSER:        Windows<37>.        (line  102)\n* environment variable; POSIXLYCORRECT: getopt -- C-style parser for command line options.\n(line   71)\n* environment variable; PROFILETASK:    Performance options.\n(line   12)\n* environment variable; PROFILETASK <1>: Performance options.\n(line   27)\n* environment variable; PURIFY:          Compiler flags.     (line  130)\n* environment variable; PYBUILTINMODULECFLAGS: Compiler flags.\n(line  121)\n* environment variable; PYCFLAGS:       Compiler flags.     (line   94)\n* environment variable; PYCFLAGSNODIST: Compiler flags.    (line   99)\n* environment variable; PYCORECFLAGS:  Compiler flags.     (line  115)\n* environment variable; PYCORELDFLAGS: Linker flags.       (line   83)\n* environment variable; PYCPPFLAGS:     Preprocessor flags. (line   26)\n* environment variable; PYLDFLAGS:      Linker flags.       (line   73)\n* environment variable; PYLDFLAGSNODIST: Linker flags.     (line   77)\n* environment variable; PYPYTHON:       Customizing default Python versions.\n(line   18)\n* environment variable; PYSTDMODULECFLAGS: Compiler flags. (line  106)\n* environment variable; PYLAUNCHERALLOWINSTALL: Windows.   (line   31)\n* environment variable; PYLAUNCHERALLOWINSTALL <1>: Windows<18>.\n(line   14)\n* environment variable; PYLAUNCHERALLOWINSTALL <2>: Install on demand.\n(line    6)\n* environment variable; PYLAUNCHERALWAYSINSTALL: Install on demand.\n(line   12)\n* environment variable; PYLAUNCHERDEBUG: Diagnostics.       (line    6)\n* environment variable; PYLAUNCHERDRYRUN: Dry Run.          (line    6)\n* environment variable; PYLAUNCHERDRYRUN <1>: Install on demand.\n(line   14)\n* environment variable; PYLAUNCHERNOSEARCHPATH: Shebang Lines.\n(line   58)\n* environment variable; PYTHONDOM:      Module Contents<4>. (line   23)\n* environment variable; PYTHONASYNCIODEBUG: Environment variables.\n(line  267)\n* environment variable; PYTHONASYNCIODEBUG <1>: Enabling debug mode.\n(line   10)\n* environment variable; PYTHONASYNCIODEBUG <2>: Debug Mode.  (line   11)\n* environment variable; PYTHONASYNCIODEBUG <3>: Effects of the Python Development Mode.\n(line   65)\n* environment variable; PYTHONBREAKPOINT: PEP 553 Built-in breakpoint.\n(line   13)\n* environment variable; PYTHONBREAKPOINT <1>: Environment variables.\n(line   81)\n* environment variable; PYTHONBREAKPOINT <2>: Built-in Functions.\n(line  158)\n* environment variable; PYTHONBREAKPOINT <3>: sys -- System-specific parameters and functions.\n(line  245)\n* environment variable; PYTHONBREAKPOINT <4>: sys -- System-specific parameters and functions.\n(line  259)\n* environment variable; PYTHONBREAKPOINT <5>: sys -- System-specific parameters and functions.\n(line  263)\n* environment variable; PYTHONCASEOK:    Changes in the Python API<3>.\n(line   29)\n* environment variable; PYTHONCASEOK <1>: PEP 235 Importing Modules on Case-Insensitive Platforms.\n(line   17)\n* environment variable; PYTHONCASEOK <2>: Library<37>.       (line  144)\n* environment variable; PYTHONCASEOK <3>: Environment variables.\n(line  122)\n* environment variable; PYTHONCASEOK <4>: Built-in Functions.\n(line 2071)\n* environment variable; PYTHONCOERCECLOCALE: PEP 538 Legacy C Locale Coercion.\n(line   13)\n* environment variable; PYTHONCOERCECLOCALE <1>: Environment variables.\n(line  347)\n* environment variable; PYTHONCOERCECLOCALE <2>: General Options.\n(line   88)\n* environment variable; PYTHONCOERCECLOCALE <3>: Python UTF-8 Mode.\n(line   57)\n* environment variable; PYTHONCOERCECLOCALE <4>: Python Configuration.\n(line   15)\n* environment variable; PYTHONDEBUG:     Miscellaneous options.\n(line   37)\n* environment variable; PYTHONDEBUG <1>: Environment variables.\n(line   94)\n* environment variable; PYTHONDEBUG <2>: Python Debug Build. (line   20)\n* environment variable; PYTHONDEBUG <3>: Global configuration variables.\n(line   38)\n* environment variable; PYTHONDEBUG <4>: PyConfig.           (line  639)\n* environment variable; PYTHONDEVMODE:   Python Development Mode -X dev.\n(line    6)\n* environment variable; PYTHONDEVMODE <1>: Miscellaneous options.\n(line  284)\n* environment variable; PYTHONDEVMODE <2>: Environment variables.\n(line  403)\n* environment variable; PYTHONDEVMODE <3>: Python Development Mode.\n(line   14)\n* environment variable; PYTHONDEVMODE <4>: PyConfig.         (line  284)\n* environment variable; PYTHONDONTWRITEBYTECODE: Interpreter Changes<2>.\n(line   16)\n* environment variable; PYTHONDONTWRITEBYTECODE <1>: New and Improved Modules<2>.\n(line  626)\n* environment variable; PYTHONDONTWRITEBYTECODE <2>: Miscellaneous options.\n(line   19)\n* environment variable; PYTHONDONTWRITEBYTECODE <3>: Environment variables.\n(line  127)\n* environment variable; PYTHONDONTWRITEBYTECODE <4>: sys -- System-specific parameters and functions.\n(line  329)\n* environment variable; PYTHONDONTWRITEBYTECODE <5>: Global configuration variables.\n(line   52)\n* environment variable; PYTHONDONTWRITEBYTECODE <6>: PyConfig.\n(line  909)\n* environment variable; PYTHONDONTWRITEBYTECODE <7>: How do I create a pyc file?.\n(line   21)\n* environment variable; PYTHONDUMPREFS:  Debug build uses the same ABI as release build.\n(line   15)\n* environment variable; PYTHONDUMPREFS <1>: Build<41>.       (line   54)\n* environment variable; PYTHONDUMPREFS <2>: Debug-mode variables.\n(line    6)\n* environment variable; PYTHONDUMPREFS <3>: Debug options.   (line   22)\n* environment variable; PYTHONDUMPREFS <4>: PyConfig.        (line  295)\n* environment variable; PYTHONDUMPREFS <5>: PyObject Slots.  (line   66)\n* environment variable; PYTHONDUMPREFSFILE: Core and Builtins<26>.\n(line  154)\n* environment variable; PYTHONDUMPREFSFILE=FILENAME: Debug-mode variables.\n(line   14)\n* environment variable; PYTHONEXECUTABLE: Environment variables.\n(line  208)\n* environment variable; PYTHONEXECUTABLE <1>: PyConfig.      (line  675)\n* environment variable; PYTHONFAULTHANDLER: faulthandler<4>. (line   11)\n* environment variable; PYTHONFAULTHANDLER <1>: Miscellaneous options.\n(line  256)\n* environment variable; PYTHONFAULTHANDLER <2>: Environment variables.\n(line  235)\n* environment variable; PYTHONFAULTHANDLER <3>: Effects of the Python Development Mode.\n(line   59)\n* environment variable; PYTHONFAULTHANDLER <4>: faulthandler -- Dump the Python traceback.\n(line   14)\n* environment variable; PYTHONFAULTHANDLER <5>: PyConfig.    (line  329)\n* environment variable; PYTHONHASHSEED:  Builtin functions and types.\n(line   17)\n* environment variable; PYTHONHASHSEED <1>: Porting Python code.\n(line    6)\n* environment variable; PYTHONHASHSEED <2>: Core and Builtins<53>.\n(line   30)\n* environment variable; PYTHONHASHSEED <3>: Miscellaneous options.\n(line  120)\n* environment variable; PYTHONHASHSEED <4>: Miscellaneous options.\n(line  136)\n* environment variable; PYTHONHASHSEED <5>: Environment variables.\n(line  142)\n* environment variable; PYTHONHASHSEED <6>: Environment variables.\n(line  147)\n* environment variable; PYTHONHASHSEED <7>: Basic customization.\n(line  301)\n* environment variable; PYTHONHASHSEED <8>: Global configuration variables.\n(line   77)\n* environment variable; PYTHONHASHSEED <9>: Global configuration variables.\n(line   80)\n* environment variable; PYTHONHASHSEED <10>: PyConfig.       (line  399)\n* environment variable; PYTHONHOME:      Pending Removal in Python 3 15<2>.\n(line   32)\n* environment variable; PYTHONHOME <1>:  Summary - Release highlights<6>.\n(line  107)\n* environment variable; PYTHONHOME <2>:  Miscellaneous options.\n(line   46)\n* environment variable; PYTHONHOME <3>:  Environment variables.\n(line   11)\n* environment variable; PYTHONHOME <4>:  Environment variables.\n(line   19)\n* environment variable; PYTHONHOME <5>:  Environment variables.\n(line   21)\n* environment variable; PYTHONHOME <6>:  Environment variables.\n(line   38)\n* environment variable; PYTHONHOME <7>:  Finding modules.    (line   29)\n* environment variable; PYTHONHOME <8>:  Finding modules.    (line   47)\n* environment variable; PYTHONHOME <9>:  Finding modules.    (line   81)\n* environment variable; PYTHONHOME <10>: test support scripthelper -- Utilities for the Python execution tests.\n(line   25)\n* environment variable; PYTHONHOME <11>: The initialization of the sys path module search path.\n(line   30)\n* environment variable; PYTHONHOME <12>: Virtual environments<2>.\n(line   14)\n* environment variable; PYTHONHOME <13>: Embedding Python<2>.\n(line   38)\n* environment variable; PYTHONHOME <14>: Embedding Python<2>.\n(line   44)\n* environment variable; PYTHONHOME <15>: Global configuration variables.\n(line   92)\n* environment variable; PYTHONHOME <16>: Process-wide parameters.\n(line  350)\n* environment variable; PYTHONHOME <17>: Process-wide parameters.\n(line  366)\n* environment variable; PYTHONHOME <18>: PyConfig.           (line  411)\n* environment variable; PYTHONINSPECT:   Other Changes and Fixes<2>.\n(line   13)\n* environment variable; PYTHONINSPECT <1>: Miscellaneous options.\n(line   58)\n* environment variable; PYTHONINSPECT <2>: Environment variables.\n(line  103)\n* environment variable; PYTHONINSPECT <3>: Global configuration variables.\n(line  109)\n* environment variable; PYTHONINSPECT <4>: PyConfig.         (line  436)\n* environment variable; PYTHONINTMAXSTRDIGITS: Core and Builtins<18>.\n(line  106)\n* environment variable; PYTHONINTMAXSTRDIGITS <1>: Miscellaneous options.\n(line  272)\n* environment variable; PYTHONINTMAXSTRDIGITS <2>: Environment variables.\n(line  160)\n* environment variable; PYTHONINTMAXSTRDIGITS <3>: Configuring the limit.\n(line    9)\n* environment variable; PYTHONINTMAXSTRDIGITS <4>: Configuring the limit.\n(line   16)\n* environment variable; PYTHONINTMAXSTRDIGITS <5>: sys -- System-specific parameters and functions.\n(line 1120)\n* environment variable; PYTHONINTMAXSTRDIGITS <6>: PyConfig. (line  467)\n* environment variable; PYTHONIOENCODING: Other Improvements<2>.\n(line   75)\n* environment variable; PYTHONIOENCODING <1>: Interpreter Changes<2>.\n(line   23)\n* environment variable; PYTHONIOENCODING <2>: Environment variables.\n(line  168)\n* environment variable; PYTHONIOENCODING <3>: Environment variables.\n(line  384)\n* environment variable; PYTHONIOENCODING <4>: Python UTF-8 Mode.\n(line   29)\n* environment variable; PYTHONIOENCODING <5>: sys -- System-specific parameters and functions.\n(line 1783)\n* environment variable; PYTHONIOENCODING <6>: Process-wide parameters.\n(line   19)\n* environment variable; PYTHONIOENCODING <7>: Process-wide parameters.\n(line   23)\n* environment variable; PYTHONIOENCODING <8>: PyConfig.      (line  798)\n* environment variable; PYTHONLEGACYWINDOWSFSENCODING: PEP 529 Change Windows filesystem encoding to UTF-8.\n(line   18)\n* environment variable; PYTHONLEGACYWINDOWSFSENCODING <1>: Environment variables.\n(line  320)\n* environment variable; PYTHONLEGACYWINDOWSFSENCODING <2>: sys -- System-specific parameters and functions.\n(line 1731)\n* environment variable; PYTHONLEGACYWINDOWSFSENCODING <3>: Global configuration variables.\n(line  151)\n* environment variable; PYTHONLEGACYWINDOWSFSENCODING <4>: PyPreConfig.\n(line  112)\n* environment variable; PYTHONLEGACYWINDOWSSTDIO: PEP 528 Change Windows console encoding to UTF-8.\n(line   12)\n* environment variable; PYTHONLEGACYWINDOWSSTDIO <1>: Environment variables.\n(line  182)\n* environment variable; PYTHONLEGACYWINDOWSSTDIO <2>: Environment variables.\n(line  334)\n* environment variable; PYTHONLEGACYWINDOWSSTDIO <3>: sys -- System-specific parameters and functions.\n(line 1787)\n* environment variable; PYTHONLEGACYWINDOWSSTDIO <4>: Global configuration variables.\n(line  169)\n* environment variable; PYTHONLEGACYWINDOWSSTDIO <5>: PyConfig.\n(line  506)\n* environment variable; PYTHONMALLOC:    PYTHONMALLOC environment variable.\n(line    6)\n* environment variable; PYTHONMALLOC <1>: Changes in the C API<5>.\n(line    9)\n* environment variable; PYTHONMALLOC <2>: Core and Builtins<73>.\n(line   90)\n* environment variable; PYTHONMALLOC <3>: Environment variables.\n(line  274)\n* environment variable; PYTHONMALLOC <4>: Environment variables.\n(line  311)\n* environment variable; PYTHONMALLOC <5>: Performance options.\n(line   87)\n* environment variable; PYTHONMALLOC <6>: Effects of the Python Development Mode.\n(line   46)\n* environment variable; PYTHONMALLOC <7>: Effects of the Python Development Mode.\n(line   50)\n* environment variable; PYTHONMALLOC <8>: Overview<4>.       (line   75)\n* environment variable; PYTHONMALLOC <9>: Default Memory Allocators.\n(line   26)\n* environment variable; PYTHONMALLOC <10>: Debug hooks on the Python memory allocators.\n(line   11)\n* environment variable; PYTHONMALLOC <11>: The pymalloc allocator.\n(line   27)\n* environment variable; PYTHONMALLOCSTATS: Core and Builtins<73>.\n(line   96)\n* environment variable; PYTHONMALLOCSTATS <1>: Environment variables.\n(line  305)\n* environment variable; PYTHONMALLOCSTATS <2>: PyConfig.     (line  522)\n* environment variable; PYTHONMALLOCSTATS <3>: Overview<4>.  (line   78)\n* environment variable; PYTHONNODEBUGRANGES: PEP 657 Fine-grained error locations in tracebacks.\n(line   63)\n* environment variable; PYTHONNODEBUGRANGES <1>: Miscellaneous options.\n(line  305)\n* environment variable; PYTHONNODEBUGRANGES <2>: Environment variables.\n(line  433)\n* environment variable; PYTHONNODEBUGRANGES <3>: Methods on code objects.\n(line   40)\n* environment variable; PYTHONNODEBUGRANGES <4>: PyConfig.   (line  237)\n* environment variable; PYTHONNOUSERSITE: PEP 370 Per-user site-packages Directory.\n(line   30)\n* environment variable; PYTHONNOUSERSITE <1>: Miscellaneous options.\n(line  148)\n* environment variable; PYTHONNOUSERSITE <2>: Environment variables.\n(line  186)\n* environment variable; PYTHONNOUSERSITE <3>: Module contents<5>.\n(line   15)\n* environment variable; PYTHONNOUSERSITE <4>: Global configuration variables.\n(line  203)\n* environment variable; PYTHONNOUSERSITE <5>: PyConfig.      (line  862)\n* environment variable; PYTHONOPTIMIZE:  Miscellaneous options.\n(line   78)\n* environment variable; PYTHONOPTIMIZE <1>: Environment variables.\n(line   75)\n* environment variable; PYTHONOPTIMIZE <2>: Global configuration variables.\n(line  214)\n* environment variable; PYTHONOPTIMIZE <3>: PyConfig.        (line  589)\n* environment variable; PYTHONPATH:      Changes in 'python' Command Behavior<2>.\n(line    8)\n* environment variable; PYTHONPATH <1>:  Changes in 'python' Command Behavior<2>.\n(line    9)\n* environment variable; PYTHONPATH <2>:  The Module Search Path.\n(line   16)\n* environment variable; PYTHONPATH <3>:  Standard Modules.   (line   34)\n* environment variable; PYTHONPATH <4>:  Standard Modules.   (line   35)\n* environment variable; PYTHONPATH <5>:  Miscellaneous options.\n(line   45)\n* environment variable; PYTHONPATH <6>:  Environment variables.\n(line   24)\n* environment variable; PYTHONPATH <7>:  Environment variables.\n(line   32)\n* environment variable; PYTHONPATH <8>:  Environment variables.\n(line   39)\n* environment variable; PYTHONPATH <9>:  Environment variables.\n(line   42)\n* environment variable; PYTHONPATH <10>: Excursus Setting environment variables.\n(line   38)\n* environment variable; PYTHONPATH <11>: Finding modules.    (line   15)\n* environment variable; PYTHONPATH <12>: Finding modules.    (line   38)\n* environment variable; PYTHONPATH <13>: Finding modules.    (line   81)\n* environment variable; PYTHONPATH <14>: Configuration.      (line    6)\n* environment variable; PYTHONPATH <15>: Path entry finders. (line   23)\n* environment variable; PYTHONPATH <16>: test support scripthelper -- Utilities for the Python execution tests.\n(line   26)\n* environment variable; PYTHONPATH <17>: sys -- System-specific parameters and functions.\n(line 1263)\n* environment variable; PYTHONPATH <18>: sys -- System-specific parameters and functions.\n(line 1268)\n* environment variable; PYTHONPATH <19>: The initialization of the sys path module search path.\n(line   14)\n* environment variable; PYTHONPATH <20>: The initialization of the sys path module search path.\n(line   18)\n* environment variable; PYTHONPATH <21>: Installing your CGI script on a Unix system.\n(line   29)\n* environment variable; PYTHONPATH <22>: Building C and C++ Extensions.\n(line    9)\n* environment variable; PYTHONPATH <23>: Embedding Python<2>.\n(line   39)\n* environment variable; PYTHONPATH <24>: Embedding Python<2>.\n(line   44)\n* environment variable; PYTHONPATH <25>: Global configuration variables.\n(line   91)\n* environment variable; PYTHONPATH <26>: PyConfig.           (line  555)\n* environment variable; PYTHONPERFSUPPORT: Other Language Changes.\n(line   85)\n* environment variable; PYTHONPERFSUPPORT <1>: Miscellaneous options.\n(line  321)\n* environment variable; PYTHONPERFSUPPORT <2>: Environment variables.\n(line  444)\n* environment variable; PYTHONPERFSUPPORT <3>: PyConfig.     (line  836)\n* environment variable; PYTHONPERFSUPPORT <4>: How to enable perf profiling support.\n(line    7)\n* environment variable; PYTHONPLATLIBDIR: Core and Builtins<34>.\n(line  275)\n* environment variable; PYTHONPLATLIBDIR <1>: Environment variables.\n(line   54)\n* environment variable; PYTHONPLATLIBDIR <2>: The initialization of the sys path module search path.\n(line   51)\n* environment variable; PYTHONPLATLIBDIR <3>: PyConfig.      (line  534)\n* environment variable; PYTHONPROFILEIMPORTTIME: Other Language Changes<6>.\n(line   47)\n* environment variable; PYTHONPROFILEIMPORTTIME <1>: Core and Builtins<55>.\n(line   66)\n* environment variable; PYTHONPROFILEIMPORTTIME <2>: Miscellaneous options.\n(line  279)\n* environment variable; PYTHONPROFILEIMPORTTIME <3>: Environment variables.\n(line  259)\n* environment variable; PYTHONPROFILEIMPORTTIME <4>: PyConfig.\n(line  421)\n* environment variable; PYTHONPYCACHEPREFIX: Parallel filesystem cache for compiled bytecode files.\n(line    6)\n* environment variable; PYTHONPYCACHEPREFIX <1>: Core and Builtins<46>.\n(line  402)\n* environment variable; PYTHONPYCACHEPREFIX <2>: Miscellaneous options.\n(line  293)\n* environment variable; PYTHONPYCACHEPREFIX <3>: Environment variables.\n(line  133)\n* environment variable; PYTHONPYCACHEPREFIX <4>: sys -- System-specific parameters and functions.\n(line  375)\n* environment variable; PYTHONPYCACHEPREFIX <5>: PyConfig.   (line  697)\n* environment variable; PYTHONREGRTESTUNICODEGUARD: Tests<17>.\n(line   13)\n* environment variable; PYTHONSAFEPATH:  Summary - Release highlights<2>.\n(line   27)\n* environment variable; PYTHONSAFEPATH <1>: Other Language Changes<2>.\n(line   37)\n* environment variable; PYTHONSAFEPATH <2>: Security<13>.    (line    6)\n* environment variable; PYTHONSAFEPATH <3>: Miscellaneous options.\n(line  106)\n* environment variable; PYTHONSAFEPATH <4>: Environment variables.\n(line   46)\n* environment variable; PYTHONSAFEPATH <5>: sys -- System-specific parameters and functions.\n(line 1280)\n* environment variable; PYTHONSAFEPATH <6>: Security Considerations<4>.\n(line   49)\n* environment variable; PYTHONSAFEPATH <7>: PyConfig.        (line  160)\n* environment variable; PYTHONSTARTUP:   sys<10>.            (line   17)\n* environment variable; PYTHONSTARTUP <1>: sys<10>.          (line   21)\n* environment variable; PYTHONSTARTUP <2>: IDLE<30>.         (line  176)\n* environment variable; PYTHONSTARTUP <3>: IDLE<34>.         (line    9)\n* environment variable; PYTHONSTARTUP <4>: IDLE<40>.         (line    9)\n* environment variable; PYTHONSTARTUP <5>: The Interactive Startup File.\n(line    8)\n* environment variable; PYTHONSTARTUP <6>: Miscellaneous options.\n(line   55)\n* environment variable; PYTHONSTARTUP <7>: Environment variables.\n(line   61)\n* environment variable; PYTHONSTARTUP <8>: Example.          (line   10)\n* environment variable; PYTHONSTARTUP <9>: Startup and Code Execution.\n(line    7)\n* environment variable; PYTHONSTARTUP <10>: sys -- System-specific parameters and functions.\n(line 1133)\n* environment variable; PYTHONSTARTUP <11>: Readline configuration.\n(line   12)\n* environment variable; PYTHONTRACEMALLOC: Miscellaneous options.\n(line  269)\n* environment variable; PYTHONTRACEMALLOC <1>: Environment variables.\n(line  246)\n* environment variable; PYTHONTRACEMALLOC <2>: tracemalloc -- Trace memory allocations.\n(line   25)\n* environment variable; PYTHONTRACEMALLOC <3>: tracemalloc -- Trace memory allocations.\n(line   32)\n* environment variable; PYTHONTRACEMALLOC <4>: Functions<11>.\n(line   90)\n* environment variable; PYTHONTRACEMALLOC <5>: PyConfig.     (line  824)\n* environment variable; PYTHONTZPATH:    Environment configuration.\n(line   11)\n* environment variable; PYTHONTZPATH <1>: Exceptions and warnings.\n(line   14)\n* environment variable; PYTHONUNBUFFERED: Core and Builtins<39>.\n(line  107)\n* environment variable; PYTHONUNBUFFERED <1>: Miscellaneous options.\n(line  168)\n* environment variable; PYTHONUNBUFFERED <2>: Environment variables.\n(line  111)\n* environment variable; PYTHONUNBUFFERED <3>: sys -- System-specific parameters and functions.\n(line 1794)\n* environment variable; PYTHONUNBUFFERED <4>: Global configuration variables.\n(line  242)\n* environment variable; PYTHONUNBUFFERED <5>: PyConfig.      (line  201)\n* environment variable; PYTHONUSERBASE:  PEP 370 Per-user site-packages Directory.\n(line   23)\n* environment variable; PYTHONUSERBASE <1>: Environment variables.\n(line  196)\n* environment variable; PYTHONUSERBASE <2>: Module contents<5>.\n(line   39)\n* environment variable; PYTHONUSERBASE <3>: Module contents<5>.\n(line   67)\n* environment variable; PYTHONUSERSITE:  test support scripthelper -- Utilities for the Python execution tests.\n(line   26)\n* environment variable; PYTHONUTF8:      PEP 540 Forced UTF-8 Runtime Mode.\n(line    6)\n* environment variable; PYTHONUTF8 <1>:  Miscellaneous options.\n(line  289)\n* environment variable; PYTHONUTF8 <2>:  Environment variables.\n(line  394)\n* environment variable; PYTHONUTF8 <3>:  Environment variables.\n(line  412)\n* environment variable; PYTHONUTF8 <4>:  UTF-8 mode.         (line   18)\n* environment variable; PYTHONUTF8 <5>:  Python UTF-8 Mode.  (line   52)\n* environment variable; PYTHONUTF8 <6>:  Python UTF-8 Mode.  (line   54)\n* environment variable; PYTHONUTF8 <7>:  sys -- System-specific parameters and functions.\n(line 1785)\n* environment variable; PYTHONUTF8 <8>:  PyPreConfig.        (line  141)\n* environment variable; PYTHONUTF8 <9>:  Python Configuration.\n(line   14)\n* environment variable; PYTHONVERBOSE:   Miscellaneous options.\n(line  184)\n* environment variable; PYTHONVERBOSE <1>: Environment variables.\n(line  116)\n* environment variable; PYTHONVERBOSE <2>: Global configuration variables.\n(line  259)\n* environment variable; PYTHONVERBOSE <3>: PyConfig.         (line  879)\n* environment variable; PYTHONWARNDEFAULTENCODING: Optional EncodingWarning and encoding=\"locale\" option.\n(line   19)\n* environment variable; PYTHONWARNDEFAULTENCODING <1>: Library<28>.\n(line   45)\n* environment variable; PYTHONWARNDEFAULTENCODING <2>: Miscellaneous options.\n(line  297)\n* environment variable; PYTHONWARNDEFAULTENCODING <3>: Environment variables.\n(line  423)\n* environment variable; PYTHONWARNDEFAULTENCODING <4>: Opt-in EncodingWarning.\n(line    9)\n* environment variable; PYTHONWARNINGS:  warnings<2>.        (line   21)\n* environment variable; PYTHONWARNINGS <1>: Other Language Changes<11>.\n(line  160)\n* environment variable; PYTHONWARNINGS <2>: Changes to the Handling of Deprecation Warnings.\n(line   25)\n* environment variable; PYTHONWARNINGS <3>: Interpreter Changes.\n(line    6)\n* environment variable; PYTHONWARNINGS <4>: Documentation<18>.\n(line   67)\n* environment variable; PYTHONWARNINGS <5>: Miscellaneous options.\n(line  237)\n* environment variable; PYTHONWARNINGS <6>: Environment variables.\n(line  214)\n* environment variable; PYTHONWARNINGS <7>: Effects of the Python Development Mode.\n(line   30)\n* environment variable; PYTHONWARNINGS <8>: The Warnings Filter.\n(line   46)\n* environment variable; PYTHONWARNINGS <9>: The Warnings Filter.\n(line   56)\n* environment variable; PYTHONWARNINGS <10>: Describing Warning Filters.\n(line    7)\n* environment variable; PYTHONWARNINGS <11>: Describing Warning Filters.\n(line   21)\n* environment variable; PYTHONWARNINGS <12>: Default Warning Filter.\n(line    7)\n* environment variable; PYTHONWARNINGS <13>: PyConfig.       (line  898)\n* environment variable; SOURCEDATEEPOCH: pycompile<3>.    (line    7)\n* environment variable; SOURCEDATEEPOCH <1>: Library<46>.  (line  452)\n* environment variable; SOURCEDATEEPOCH <2>: Build<49>.    (line   15)\n* environment variable; SOURCEDATEEPOCH <3>: pycompile -- Compile Python source files.\n(line   66)\n* environment variable; SOURCEDATEEPOCH <4>: pycompile -- Compile Python source files.\n(line   82)\n* environment variable; SOURCEDATEEPOCH <5>: pycompile -- Compile Python source files.\n(line   86)\n* environment variable; SOURCEDATEEPOCH <6>: Command-line use.\n(line   90)\n* environment variable; SSLKEYLOGFILE:   Context creation.   (line   34)\n* environment variable; SSLKEYLOGFILE <1>: Context creation. (line   68)\n* environment variable; SystemRoot:      Popen Constructor.  (line  308)\n* environment variable; TEMP:            Redirection of local data registry and temporary paths.\n(line    7)\n* environment variable; TEMP <1>:        tempfile -- Generate temporary files and directories.\n(line  329)\n* environment variable; TERM:            Functions<6>.       (line  485)\n* environment variable; TERM <1>:        Functions<6>.       (line  512)\n* environment variable; TMP:             tempfile -- Generate temporary files and directories.\n(line  331)\n* environment variable; TMPDIR:          Tests<16>.          (line   68)\n* environment variable; TMPDIR <1>:      tempfile -- Generate temporary files and directories.\n(line  327)\n* environment variable; TZ:              Functions<5>.       (line  575)\n* environment variable; TZ <1>:          Functions<5>.       (line  576)\n* environment variable; TZ <2>:          Functions<5>.       (line  584)\n* environment variable; TZ <3>:          Functions<5>.       (line  589)\n* environment variable; TZ <4>:          Functions<5>.       (line  591)\n* environment variable; TZ <5>:          Functions<5>.       (line  651)\n* environment variable; USER:            getpass -- Portable password input.\n(line   44)\n* environment variable; USERNAME:        os path -- Common pathname manipulations.\n(line  144)\n* environment variable; USERNAME <1>:    Process Parameters. (line  239)\n* environment variable; USERNAME <2>:    getpass -- Portable password input.\n(line   45)\n* environment variable; USERPROFILE:     os path<4>.         (line   14)\n* environment variable; USERPROFILE <1>: Changes in the Python API<4>.\n(line  116)\n* environment variable; USERPROFILE <2>: Windows<35>.        (line   15)\n* environment variable; USERPROFILE <3>: os path -- Common pathname manipulations.\n(line  141)\n* environment variables; deleting:       Process Parameters. (line  582)\n* environment variables; setting:        Process Parameters. (line  354)\n* EnvironmentError:                      Concrete exceptions.\n(line  466)\n* Environments; virtual:                 venv -- Creation of virtual environments.\n(line   10)\n* EnvironmentVarGuard (class in test.support.oshelper): test support oshelper -- Utilities for os tests.\n(line   49)\n* ENXIO (in module errno):               errno -- Standard errno system symbols.\n(line   50)\n* eof (bz2.BZ2Decompressor attribute):   Incremental de compression.\n(line   72)\n* eof (lzma.LZMADecompressor attribute): Compressing and decompressing data in memory.\n(line  165)\n* eof (shlex.shlex attribute):           shlex Objects.      (line  178)\n* eof (ssl.MemoryBIO attribute):         Memory BIO Support<2>.\n(line  139)\n* eof (zlib.Decompress attribute):       zlib -- Compression compatible with gzip.\n(line  252)\n* eofreceived() (asyncio.BufferedProtocol method): Buffered Streaming Protocols.\n(line   40)\n* eofreceived() (asyncio.Protocol method): Streaming Protocols.\n(line   30)\n* EOFError:                              Concrete exceptions.\n(line   26)\n* EOFError (built-in exception):         File Objects.       (line   44)\n* EOPNOTSUPP (in module errno):          errno -- Standard errno system symbols.\n(line  414)\n* EOT (in module curses.ascii):          curses ascii -- Utilities for ASCII characters.\n(line   31)\n* EOVERFLOW (in module errno):           errno -- Standard errno system symbols.\n(line  334)\n* EOWNERDEAD (in module errno):          errno -- Standard errno system symbols.\n(line  560)\n* EPERM (in module errno):               errno -- Standard errno system symbols.\n(line   26)\n* EPFNOSUPPORT (in module errno):        errno -- Standard errno system symbols.\n(line  424)\n* epilogue (email.message.EmailMessage attribute): email message Representing an email message.\n(line  704)\n* epilogue (email.message.Message attribute): email message Message Representing an email message using the compat32 API.\n(line  713)\n* EPIPE (in module errno):               errno -- Standard errno system symbols.\n(line  160)\n* epoch:                                 time -- Time access and conversions.\n(line   20)\n* epoll() (in module select):            select -- Waiting for I/O completion.\n(line   56)\n* EpollSelector (class in selectors):    Classes<4>.         (line  175)\n* EPROTO (in module errno):              errno -- Standard errno system symbols.\n(line  318)\n* EPROTONOSUPPORT (in module errno):     errno -- Standard errno system symbols.\n(line  406)\n* EPROTOTYPE (in module errno):          errno -- Standard errno system symbols.\n(line  398)\n* epsilon (sys.floatinfo attribute):    sys -- System-specific parameters and functions.\n(line  611)\n* Eq (class in ast):                     Expressions<2>.     (line  109)\n* eq() (in module operator):             operator -- Standard operators as functions.\n(line   24)\n* EQEQUAL (in module token):             token -- Constants used with Python parse trees.\n(line  134)\n* EQFULL (in module errno):              errno -- Standard errno system symbols.\n(line  539)\n* EQUAL (in module token):               token -- Constants used with Python parse trees.\n(line  114)\n* ERA (in module locale):                locale -- Internationalization services.\n(line  299)\n* ERADFMT (in module locale):          locale -- Internationalization services.\n(line  321)\n* ERADTFMT (in module locale):        locale -- Internationalization services.\n(line  316)\n* ERATFMT (in module locale):          locale -- Internationalization services.\n(line  326)\n* ERANGE (in module errno):              errno -- Standard errno system symbols.\n(line  169)\n* erase() (curses.window method):        Window Objects.     (line  221)\n* erasechar() (in module curses):        Functions<6>.       (line  114)\n* EREMCHG (in module errno):             errno -- Standard errno system symbols.\n(line  346)\n* EREMOTE (in module errno):             errno -- Standard errno system symbols.\n(line  298)\n* EREMOTEIO (in module errno):           errno -- Standard errno system symbols.\n(line  531)\n* ERESTART (in module errno):            errno -- Standard errno system symbols.\n(line  374)\n* erf() (in module math):                Special functions.  (line    6)\n* erfc() (in module math):               Special functions.  (line   20)\n* EROFS (in module errno):               errno -- Standard errno system symbols.\n(line  152)\n* ERR (in module curses):                Constants<6>.       (line    8)\n* errcheck (ctypes.FuncPtr attribute):  Foreign functions.  (line   60)\n* errcode (xmlrpc.client.ProtocolError attribute): ProtocolError Objects.\n(line   17)\n* errmsg (xmlrpc.client.ProtocolError attribute): ProtocolError Objects.\n(line   21)\n* errno (OSError attribute):             Concrete exceptions.\n(line  162)\n* error:                                 Exceptions<3>.      (line    6)\n* error <1>:                             Functions and Exceptions.\n(line    8)\n* Error:                                 copy -- Shallow and deep copy operations.\n(line   26)\n* Error <1>:                             Directory and files operations.\n(line  454)\n* error <2>:                             dbm -- Interfaces to Unix \"databases\".\n(line   16)\n* error <3>:                             dbm gnu -- GNU database manager.\n(line   17)\n* error <4>:                             dbm ndbm -- New Database Manager.\n(line   23)\n* error <5>:                             dbm dumb -- Portable DBM implementation.\n(line   23)\n* Error <2>:                             Exceptions<6>.      (line   15)\n* error <6>:                             zlib -- Compression compatible with gzip.\n(line   24)\n* Error <3>:                             Module Contents<3>. (line  322)\n* Error <4>:                             Exceptions<7>.      (line    6)\n* error <7>:                             os -- Miscellaneous operating system interfaces.\n(line   51)\n* error <8>:                             getopt -- C-style parser for command line options.\n(line   85)\n* error <9>:                             Functions<6>.       (line    8)\n* error <10>:                            thread -- Low-level threading API.\n(line   21)\n* error <11>:                            Exceptions<13>.     (line    6)\n* error <12>:                            select -- Waiting for I/O completion.\n(line   30)\n* Error <5>:                             Exceptions<16>.     (line    8)\n* Error <6>:                             binascii -- Convert between binary and ASCII.\n(line  157)\n* error <13>:                            xml parsers expat -- Fast XML parsing using Expat.\n(line   31)\n* Error <7>:                             webbrowser -- Convenient web-browser controller.\n(line   50)\n* Error <8>:                             wave -- Read and write WAV files.\n(line   52)\n* Error <9>:                             locale -- Internationalization services.\n(line   22)\n* error <14>:                            resource -- Resource usage information.\n(line   19)\n* error <15>:                            audioop -- Manipulate raw audio data.\n(line   29)\n* error <16>:                            nis -- Interface to Sun's NIS Yellow Pages.\n(line   63)\n* Error <10>:                            sunau -- Read and write Sun AU files.\n(line   71)\n* Error <11>:                            uu -- Encode and decode uuencode files.\n(line   55)\n* Error <12>:                            Exceptions<20>.     (line    8)\n* ERROR (in module logging):             Logging Levels.     (line   40)\n* ERROR (in module tkinter.messagebox):  tkinter messagebox -- Tkinter message prompts.\n(line  192)\n* error handling:                        Exceptions<2>.      (line    6)\n* errorbody (wsgiref.handlers.BaseHandler attribute): wsgiref handlers - server/gateway base classes.\n(line  263)\n* errorcontenttype (http.server.BaseHTTPRequestHandler attribute): http server -- HTTP servers.\n(line  158)\n* errorheaders (wsgiref.handlers.BaseHandler attribute): wsgiref handlers - server/gateway base classes.\n(line  256)\n* errorleader() (shlex.shlex method):   shlex Objects.      (line   69)\n* errormessageformat (http.server.BaseHTTPRequestHandler attribute): http server -- HTTP servers.\n(line  150)\n* erroroutput() (wsgiref.handlers.BaseHandler method): wsgiref handlers - server/gateway base classes.\n(line  228)\n* errorperm:                            Module variables.   (line   16)\n* errorproto:                           Module variables.   (line   21)\n* errorproto <1>:                       poplib -- POP3 protocol client.\n(line   90)\n* errorreceived() (asyncio.DatagramProtocol method): Datagram Protocols.\n(line   15)\n* errorreply:                           Module variables.   (line    6)\n* errorstatus (wsgiref.handlers.BaseHandler attribute): wsgiref handlers - server/gateway base classes.\n(line  250)\n* errortemp:                            Module variables.   (line   11)\n* error() (argparse.ArgumentParser method): Exiting methods. (line   18)\n* error() (in module logging):           Module-Level Functions.\n(line   78)\n* error() (logging.Logger method):       Logger Objects.     (line  301)\n* error() (urllib.request.OpenerDirector method): OpenerDirector Objects.\n(line   58)\n* error() (xml.sax.handler.ErrorHandler method): ErrorHandler Objects.\n(line   16)\n* ErrorByteIndex (xml.parsers.expat.xmlparser attribute): XMLParser Objects<2>.\n(line  170)\n* errorcode (in module errno):           errno -- Standard errno system symbols.\n(line   13)\n* ErrorCode (xml.parsers.expat.xmlparser attribute): XMLParser Objects<2>.\n(line  174)\n* ErrorColumnNumber (xml.parsers.expat.xmlparser attribute): XMLParser Objects<2>.\n(line  180)\n* ErrorHandler (class in xml.sax.handler): xml sax handler -- Base classes for SAX handlers.\n(line   38)\n* errorlevel (tarfile.TarFile attribute): TarFile Objects.   (line  214)\n* ErrorLineNumber (xml.parsers.expat.xmlparser attribute): XMLParser Objects<2>.\n(line  184)\n* errors:                                Exceptions<2>.      (line    6)\n* errors (io.TextIOBase attribute):      Text I/O<2>.        (line   20)\n* errors (unittest.TestLoader attribute): Loading and running tests.\n(line   17)\n* errors (unittest.TestResult attribute): Loading and running tests.\n(line  241)\n* Errors; logging:                       logging -- Logging facility for Python.\n(line    8)\n* ErrorStream (class in wsgiref.types):  wsgiref types - WSGI types for static type checking.\n(line   28)\n* ErrorString() (in module xml.parsers.expat): xml parsers expat -- Fast XML parsing using Expat.\n(line   42)\n* ERRORTOKEN (in module token):          token -- Constants used with Python parse trees.\n(line  268)\n* ESC (in module curses.ascii):          curses ascii -- Utilities for ASCII characters.\n(line  106)\n* escape (shlex.shlex attribute):        shlex Objects.      (line  110)\n* escape sequence:                       String and Bytes literals.\n(line   75)\n* escape() (in module glob):             glob -- Unix style pathname pattern expansion.\n(line   97)\n* escape() (in module html):             html -- HyperText Markup Language support.\n(line   12)\n* escape() (in module re):               Functions<2>.       (line  222)\n* escape() (in module xml.sax.saxutils): xml sax saxutils -- SAX Utilities.\n(line   14)\n* escapechar (csv.Dialect attribute):    Dialects and Formatting Parameters.\n(line   35)\n* escapedquotes (shlex.shlex attribute): shlex Objects.      (line  122)\n* ESHUTDOWN (in module errno):           errno -- Standard errno system symbols.\n(line  474)\n* ESOCKTNOSUPPORT (in module errno):     errno -- Standard errno system symbols.\n(line  410)\n* ESPIPE (in module errno):              errno -- Standard errno system symbols.\n(line  148)\n* ESRCH (in module errno):               errno -- Standard errno system symbols.\n(line   36)\n* ESRMNT (in module errno):              errno -- Standard errno system symbols.\n(line  310)\n* ESTALE (in module errno):              errno -- Standard errno system symbols.\n(line  511)\n* ESTRPIPE (in module errno):            errno -- Standard errno system symbols.\n(line  378)\n* ETB (in module curses.ascii):          curses ascii -- Utilities for ASCII characters.\n(line   94)\n* ETHPALL (in module socket):          Constants<8>.       (line  214)\n* ETHERTYPEARP (in module socket):      Constants<8>.       (line  357)\n* ETHERTYPEIP (in module socket):       Constants<8>.       (line  357)\n* ETHERTYPEIPV6 (in module socket):     Constants<8>.       (line  357)\n* ETHERTYPEVLAN (in module socket):     Constants<8>.       (line  357)\n* ETIME (in module errno):               errno -- Standard errno system symbols.\n(line  282)\n* ETIMEDOUT (in module errno):           errno -- Standard errno system symbols.\n(line  483)\n* Etiny() (decimal.Context method):      Context objects.    (line  232)\n* ETOOMANYREFS (in module errno):        errno -- Standard errno system symbols.\n(line  479)\n* Etop() (decimal.Context method):       Context objects.    (line  238)\n* ETX (in module curses.ascii):          curses ascii -- Utilities for ASCII characters.\n(line   28)\n* ETXTBSY (in module errno):             errno -- Standard errno system symbols.\n(line  136)\n* EUCLEAN (in module errno):             errno -- Standard errno system symbols.\n(line  515)\n* EUNATCH (in module errno):             errno -- Standard errno system symbols.\n(line  230)\n* EUSERS (in module errno):              errno -- Standard errno system symbols.\n(line  382)\n* evaluation; order:                     Evaluation order.   (line    6)\n* Event (class in asyncio):              Event.              (line    6)\n* Event (class in multiprocessing):      Synchronization primitives.\n(line   42)\n* Event (class in threading):            Event Objects.      (line   14)\n* event scheduling:                      sched -- Event scheduler.\n(line    8)\n* EVENTREAD (in module selectors):      Classes<4>.         (line   23)\n* EVENTWRITE (in module selectors):     Classes<4>.         (line   26)\n* event() (msilib.Control method):       GUI classes.        (line   14)\n* Event() (multiprocessing.managers.SyncManager method): Managers.\n(line  183)\n* eventfdread() (in module os):         Files and Directories.\n(line 1882)\n* eventfdwrite() (in module os):        Files and Directories.\n(line 1892)\n* eventfd() (in module os):              Files and Directories.\n(line 1829)\n* events (selectors.SelectorKey attribute): Classes<4>.      (line   44)\n* events (widgets):                      Bindings and Events.\n(line    6)\n* EWOULDBLOCK (in module errno):         errno -- Standard errno system symbols.\n(line  197)\n* EXCANTCREAT (in module os):           Process Management. (line  206)\n* EXCONFIG (in module os):              Process Management. (line  242)\n* EXDATAERR (in module os):             Process Management. (line  155)\n* EXIOERR (in module os):               Process Management. (line  213)\n* EXNOHOST (in module os):              Process Management. (line  174)\n* EXNOINPUT (in module os):             Process Management. (line  161)\n* EXNOPERM (in module os):              Process Management. (line  235)\n* EXNOTFOUND (in module os):            Process Management. (line  249)\n* EXNOUSER (in module os):              Process Management. (line  168)\n* EXOK (in module os):                  Process Management. (line  140)\n* EXOSERR (in module os):               Process Management. (line  192)\n* EXOSFILE (in module os):              Process Management. (line  199)\n* EXPROTOCOL (in module os):            Process Management. (line  228)\n* EXSOFTWARE (in module os):            Process Management. (line  186)\n* EXTEMPFAIL (in module os):            Process Management. (line  220)\n* EXUNAVAILABLE (in module os):         Process Management. (line  180)\n* EXUSAGE (in module os):               Process Management. (line  148)\n* Example (class in doctest):            Example Objects.    (line    6)\n* example (doctest.DocTestFailure attribute): Debugging.     (line  200)\n* example (doctest.UnexpectedException attribute): Debugging.\n(line  221)\n* examples (doctest.DocTest attribute):  DocTest Objects.    (line   17)\n* excinfo (doctest.UnexpectedException attribute): Debugging.\n(line  225)\n* excinfo (in module sys):              Traceback objects.  (line    6)\n* excinfo (in module sys) <1>:          Exceptions<21>.     (line   45)\n* excinfo() (in module sys):            sys -- System-specific parameters and functions.\n(line  437)\n* excmsg (doctest.Example attribute):   Example Objects.    (line   31)\n* exctype (traceback.TracebackException attribute): TracebackException Objects.\n(line   74)\n* excel (class in csv):                  Module Contents<3>. (line  201)\n* exceltab (class in csv):              Module Contents<3>. (line  207)\n* except (2to3 fixer):                   Fixers.             (line   82)\n* ExceptHandler (class in ast):          Control flow.       (line  210)\n* excepthook() (in module sys):          sys -- System-specific parameters and functions.\n(line  381)\n* excepthook() (in module sys) <1>:      cgitb -- Traceback manager for CGI scripts.\n(line   36)\n* excepthook() (in module threading):    threading -- Thread-based parallelism.\n(line   72)\n* exception:                             Exceptions<2>.      (line    6)\n* exception <1>:                         The raise statement.\n(line    6)\n* Exception:                             Base classes.       (line   66)\n* EXCEPTION (in module tkinter):        File Handlers.      (line   41)\n* exception handler:                     Exceptions<2>.      (line    6)\n* EXCEPTIONHANDLED (monitoring event):  Events.             (line   26)\n* exception; AssertionError:             The assert statement.\n(line   21)\n* exception; AttributeError:             Attribute references.\n(line   10)\n* exception; chaining:                   The raise statement.\n(line   30)\n* exception; chaining <1>:               Exception context.  (line    6)\n* exception; GeneratorExit:              Generator-iterator methods.\n(line   65)\n* exception; GeneratorExit <1>:          Asynchronous generator-iterator methods.\n(line   61)\n* exception; handler:                    Traceback objects.  (line    6)\n* exception; ImportError:                The import statement.\n(line    6)\n* exception; NameError:                  Identifiers Names.  (line   10)\n* exception; StopAsyncIteration:         Asynchronous generator-iterator methods.\n(line   10)\n* exception; StopIteration:              Generator-iterator methods.\n(line   12)\n* exception; StopIteration <1>:          The yield statement.\n(line    6)\n* exception; TypeError:                  Unary arithmetic and bitwise operations.\n(line   23)\n* exception; ValueError:                 Shifting operations.\n(line   18)\n* exception; ZeroDivisionError:          Binary arithmetic operations.\n(line   31)\n* exception() (asyncio.Future method):   Future Object.      (line  123)\n* exception() (asyncio.Task method):     Task Object.        (line   87)\n* exception() (concurrent.futures.Future method): Future Objects.\n(line   52)\n* exception() (in module logging):       Module-Level Functions.\n(line   90)\n* exception() (in module sys):           sys -- System-specific parameters and functions.\n(line  425)\n* exception() (logging.Logger method):   Logger Objects.     (line  317)\n* ExceptionGroup:                        Exception groups.   (line   12)\n* exceptions (BaseExceptionGroup attribute): Exception groups.\n(line   38)\n* exceptions (traceback.TracebackException attribute): TracebackException Objects.\n(line   48)\n* exceptions; in CGI scripts:            cgitb -- Traceback manager for CGI scripts.\n(line    8)\n* EXCLAMATION (in module token):         token -- Constants used with Python parse trees.\n(line  242)\n* exclusive; or:                         Binary bitwise operations.\n(line   16)\n* EXDEV (in module errno):               errno -- Standard errno system symbols.\n(line  102)\n* exec (2to3 fixer):                     Fixers.             (line   86)\n* execmodule() (importlib.abc.InspectLoader method): importlib abc - Abstract base classes related to import.\n(line  288)\n* execmodule() (importlib.abc.Loader method): importlib abc - Abstract base classes related to import.\n(line  114)\n* execmodule() (importlib.abc.SourceLoader method): importlib abc - Abstract base classes related to import.\n(line  435)\n* execmodule() (importlib.machinery.ExtensionFileLoader method): importlib machinery - Importers and path hooks.\n(line  321)\n* execmodule() (zipimport.zipimporter method): zipimporter Objects.\n(line   31)\n* execprefix (in module sys):           sys -- System-specific parameters and functions.\n(line  457)\n* execfile (2to3 fixer):                 Fixers.             (line   90)\n* execl() (in module os):                Process Management. (line   53)\n* execle() (in module os):               Process Management. (line   53)\n* execlp() (in module os):               Process Management. (line   53)\n* execlpe() (in module os):              Process Management. (line   53)\n* executable (in module sys):            sys -- System-specific parameters and functions.\n(line  474)\n* executable (in module sys) <1>:        Process-wide parameters.\n(line  142)\n* Executable Zip Files:                  zipapp -- Manage executable Python zip archives.\n(line   10)\n* Execute() (msilib.View method):        View Objects.       (line    6)\n* execute() (sqlite3.Connection method): Connection objects. (line   93)\n* execute() (sqlite3.Cursor method):     Cursor objects.     (line   24)\n* executemany() (sqlite3.Connection method): Connection objects.\n(line   99)\n* executemany() (sqlite3.Cursor method): Cursor objects.     (line   59)\n* executescript() (sqlite3.Connection method): Connection objects.\n(line  105)\n* executescript() (sqlite3.Cursor method): Cursor objects.   (line  100)\n* execution model:                       Execution model.    (line    6)\n* execution; frame:                      Structure of a program.\n(line   18)\n* execution; frame <1>:                  Class definitions.  (line    6)\n* execution; stack:                      Traceback objects.  (line    6)\n* ExecutionLoader (class in importlib.abc): importlib abc - Abstract base classes related to import.\n(line  301)\n* Executor (class in concurrent.futures): Executor Objects.  (line    6)\n* execv() (in module os):                Process Management. (line   53)\n* execve() (in module os):               Process Management. (line   53)\n* execvp() (in module os):               Process Management. (line   53)\n* execvpe() (in module os):              Process Management. (line   53)\n* ExFileSelectBox (class in tkinter.tix): File Selectors.    (line   34)\n* EXFULL (in module errno):              errno -- Standard errno system symbols.\n(line  250)\n* exists() (in module os.path):          os path -- Common pathname manipulations.\n(line  109)\n* exists() (pathlib.Path method):        Methods<2>.         (line   72)\n* exists() (tkinter.ttk.Treeview method): ttk Treeview.      (line   89)\n* exists() (zipfile.Path method):        Path Objects.       (line   55)\n* exit (built-in variable):              Constants added by the site module.\n(line   11)\n* exit (C function):                     Process Control.    (line   23)\n* exit() (argparse.ArgumentParser method): Exiting methods.  (line    6)\n* exit() (in module thread):            thread -- Low-level threading API.\n(line   78)\n* exit() (in module sys):                sys -- System-specific parameters and functions.\n(line  481)\n* exitcode (multiprocessing.Process attribute): Process and exceptions.\n(line  126)\n* exitfunc (2to3 fixer):                 Fixers.             (line   96)\n* exitonclick() (in module turtle):      Methods specific to Screen not inherited from TurtleScreen.\n(line   10)\n* ExitStack (class in contextlib):       Utilities.          (line  503)\n* exp() (decimal.Context method):        Context objects.    (line  303)\n* exp() (decimal.Decimal method):        Decimal objects.    (line  232)\n* exp() (in module cmath):               Power and logarithmic functions<2>.\n(line    6)\n* exp() (in module math):                Power and logarithmic functions.\n(line   12)\n* exp2() (in module math):               Power and logarithmic functions.\n(line   18)\n* expandtabs (textwrap.TextWrapper attribute): textwrap -- Text wrapping and filling.\n(line  167)\n* expand() (re.Match method):            Match Objects.      (line   23)\n* ExpandEnvironmentStrings() (in module winreg): Functions<13>.\n(line  228)\n* expandNode() (xml.dom.pulldom.DOMEventStream method): DOMEventStream Objects.\n(line   21)\n* expandtabs() (bytearray method):       Bytes and Bytearray Operations.\n(line  482)\n* expandtabs() (bytes method):           Bytes and Bytearray Operations.\n(line  482)\n* expandtabs() (str method):             String Methods<2>.  (line   96)\n* expanduser() (in module os.path):      os path -- Common pathname manipulations.\n(line  130)\n* expanduser() (pathlib.Path method):    Methods<2>.         (line   90)\n* expandvars() (in module os.path):      os path -- Common pathname manipulations.\n(line  154)\n* Expat:                                 xml parsers expat -- Fast XML parsing using Expat.\n(line   12)\n* ExpatError:                            xml parsers expat -- Fast XML parsing using Expat.\n(line   25)\n* expect() (telnetlib.Telnet method):    Telnet Objects.     (line  120)\n* expected (asyncio.IncompleteReadError attribute): Exceptions<11>.\n(line   52)\n* expectedFailure() (in module unittest): Skipping tests and expected failures.\n(line   98)\n* expectedFailures (unittest.TestResult attribute): Loading and running tests.\n(line  261)\n* expired() (asyncio.Timeout method):    Timeouts.           (line   72)\n* expires (http.cookiejar.Cookie attribute): Cookie Objects<2>.\n(line   53)\n* expires (http.cookies.Morsel attribute): Morsel Objects.   (line   13)\n* exploded (ipaddress.IPv4Address attribute): Address objects.\n(line   60)\n* exploded (ipaddress.IPv4Network attribute): Network objects.\n(line  109)\n* exploded (ipaddress.IPv6Address attribute): Address objects.\n(line  241)\n* exploded (ipaddress.IPv6Network attribute): Network objects.\n(line  321)\n* expm1() (in module math):              Power and logarithmic functions.\n(line   24)\n* expovariate() (in module random):      Real-valued distributions.\n(line   38)\n* Expr (class in ast):                   Expressions<2>.     (line    6)\n* expression:                            Expressions.        (line    6)\n* expression <1>:                        Glossary.           (line  420)\n* Expression (class in ast):             Root nodes.         (line   27)\n* expression; list:                      Expression lists.   (line    6)\n* expression; list <1>:                  Expression statements.\n(line    6)\n* expression; list <2>:                  Expression statements.\n(line    6)\n* expression; statement:                 Expression statements.\n(line    6)\n* expunge() (imaplib.IMAP4 method):      IMAP4 Objects.      (line   93)\n* extendpath() (in module pkgutil):     pkgutil -- Package extension utility.\n(line   19)\n* extend() (array.array method):         array -- Efficient arrays of numeric values.\n(line  150)\n* extend() (collections.deque method):   deque objects.      (line   59)\n* extend() (sequence method):            Mutable Sequence Types.\n(line   16)\n* extend() (xml.etree.ElementTree.Element method): Element Objects.\n(line   93)\n* EXTENDEDARG (opcode):                 Python Bytecode Instructions.\n(line 1053)\n* ExtendedContext (class in decimal):    Context objects.    (line   76)\n* ExtendedInterpolation (class in configparser): Interpolation of values.\n(line   41)\n* extendleft() (collections.deque method): deque objects.    (line   64)\n* extension module:                      Glossary.           (line  431)\n* EXTENSIONSUFFIXES (in module importlib.machinery): importlib machinery - Importers and path hooks.\n(line   50)\n* extension; module:                     The standard type hierarchy.\n(line    6)\n* ExtensionFileLoader (class in importlib.machinery): importlib machinery - Importers and path hooks.\n(line  288)\n* extensionsmap (http.server.SimpleHTTPRequestHandler attribute): http server -- HTTP servers.\n(line  366)\n* External Data Representation:          Data stream format. (line    6)\n* External Data Representation <1>:      xdrlib -- Encode and decode XDR data.\n(line    8)\n* externalattr (zipfile.ZipInfo attribute): ZipInfo Objects.\n(line  128)\n* ExternalClashError:                    Exceptions<16>.     (line   24)\n* ExternalEntityParserCreate() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line   44)\n* ExternalEntityRefHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line  374)\n* extra (zipfile.ZipInfo attribute):     ZipInfo Objects.    (line   94)\n* extractcookies() (http.cookiejar.CookieJar method): CookieJar and FileCookieJar Objects.\n(line   31)\n* extractstack() (in module traceback): traceback -- Print or retrieve a stack traceback.\n(line  115)\n* extracttb() (in module traceback):    traceback -- Print or retrieve a stack traceback.\n(line  103)\n* extractversion (zipfile.ZipInfo attribute): ZipInfo Objects.\n(line  108)\n* extract() (tarfile.TarFile method):    TarFile Objects.    (line  169)\n* extract() (traceback.StackSummary class method): StackSummary Objects.\n(line   12)\n* extract() (zipfile.ZipFile method):    ZipFile Objects.    (line  179)\n* extractall() (tarfile.TarFile method): TarFile Objects.    (line  132)\n* extractall() (zipfile.ZipFile method): ZipFile Objects.    (line  206)\n* ExtractError:                          tarfile -- Read and write tar archive files.\n(line  219)\n* extractfile() (tarfile.TarFile method): TarFile Objects.   (line  202)\n* extractionfilter (tarfile.TarFile attribute): TarFile Objects.\n(line  234)\n* extsep (in module os):                 Miscellaneous System Information.\n(line  112)\n* fback (frame attribute):              Frame objects.      (line   10)\n* fback (frame attribute) <1>:          Special read-only attributes<3>.\n(line    6)\n* fbuiltins (frame attribute):          Frame objects.      (line   10)\n* fbuiltins (frame attribute) <1>:      Special read-only attributes<3>.\n(line   24)\n* fcode (frame attribute):              Frame objects.      (line   10)\n* fcode (frame attribute) <1>:          Special read-only attributes<3>.\n(line   10)\n* FCONTIGUOUS (inspect.BufferFlags attribute): Buffer flags.\n(line   27)\n* fcontiguous (memoryview attribute):   Memory Views.       (line  480)\n* fglobals (frame attribute):           Frame objects.      (line   10)\n* fglobals (frame attribute) <1>:       Special read-only attributes<3>.\n(line   20)\n* flasti (frame attribute):             Frame objects.      (line   10)\n* flasti (frame attribute) <1>:         Special read-only attributes<3>.\n(line   28)\n* flineno (frame attribute):            Special read-only attributes<3>.\n(line   32)\n* flineno (frame attribute) <1>:        Special writable attributes<2>.\n(line   23)\n* flocals (frame attribute):            Frame objects.      (line   10)\n* flocals (frame attribute) <1>:        Special read-only attributes<3>.\n(line   16)\n* FLOCK (in module os):                 File Descriptor Operations.\n(line  266)\n* FOK (in module os):                   Files and Directories.\n(line  106)\n* FTEST (in module os):                 File Descriptor Operations.\n(line  266)\n* FTLOCK (in module os):                File Descriptor Operations.\n(line  266)\n* ftrace (frame attribute):             Special read-only attributes<3>.\n(line   33)\n* ftrace (frame attribute) <1>:         Special writable attributes<2>.\n(line    6)\n* ftracelines (frame attribute):       Special read-only attributes<3>.\n(line   33)\n* ftracelines (frame attribute) <1>:   Special writable attributes<2>.\n(line   12)\n* ftraceopcodes (frame attribute):     Special read-only attributes<3>.\n(line   33)\n* ftraceopcodes (frame attribute) <1>: Special writable attributes<2>.\n(line   16)\n* FULOCK (in module os):                File Descriptor Operations.\n(line  266)\n* f-string:                              String literal concatenation.\n(line   24)\n* f-string <1>:                          Glossary.           (line  436)\n* f'; formatted string literal:          String and Bytes literals.\n(line   65)\n* f\"; formatted string literal:          String and Bytes literals.\n(line   65)\n* fabs() (in module math):               Number-theoretic and representation functions.\n(line   36)\n* factorial() (in module math):          Number-theoretic and representation functions.\n(line   40)\n* factory() (importlib.util.LazyLoader class method): importlib util - Utility code for importers.\n(line  222)\n* FAILFAST (in module doctest):         Option Flags.       (line  140)\n* fail() (unittest.TestCase method):     Test cases.         (line  687)\n* failfast (unittest.TestResult attribute): Loading and running tests.\n(line  299)\n* failureException:                      Unittest API.       (line  140)\n* failureException (unittest.TestCase attribute): Test cases.\n(line  692)\n* failures (unittest.TestResult attribute): Loading and running tests.\n(line  247)\n* FakePath (class in test.support.oshelper): test support oshelper -- Utilities for os tests.\n(line   60)\n* False:                                 numbers Integral.   (line   27)\n* false:                                 Truth Value Testing.\n(line    6)\n* False <1>:                             Truth Value Testing.\n(line   23)\n* False <2>:                             Boolean Type - bool.\n(line    9)\n* False (Built-in object):               Truth Value Testing.\n(line   15)\n* False (built-in variable):             Built-in Constants. (line    8)\n* families() (in module tkinter.font):   tkinter font -- Tkinter font wrapper.\n(line   88)\n* family (socket.socket attribute):      Socket Objects.     (line  618)\n* FancyURLopener (class in urllib.request): Legacy interface.\n(line  147)\n* fast (pickle.Pickler attribute):       Module Interface.   (line  215)\n* FastChildWatcher (class in asyncio):   Process Watchers.   (line  142)\n* fatalError() (xml.sax.handler.ErrorHandler method): ErrorHandler Objects.\n(line   24)\n* Fault (class in xmlrpc.client):        Fault Objects.      (line    6)\n* faultCode (xmlrpc.client.Fault attribute): Fault Objects.  (line   11)\n* faultString (xmlrpc.client.Fault attribute): Fault Objects.\n(line   15)\n* fchdir() (in module os):               Files and Directories.\n(line  274)\n* fchmod() (in module os):               File Descriptor Operations.\n(line  121)\n* fchown() (in module os):               File Descriptor Operations.\n(line  135)\n* FCICreate() (in module msilib):        msilib -- Read and write Microsoft Installer files.\n(line   28)\n* fcntl() (in module fcntl):             fcntl -- The fcntl and ioctl system calls.\n(line   49)\n* fd (selectors.SelectorKey attribute):  Classes<4>.         (line   40)\n* fdcount() (in module test.support.oshelper): test support oshelper -- Utilities for os tests.\n(line   97)\n* fd() (in module turtle):               Turtle motion.      (line    6)\n* fdatasync() (in module os):            File Descriptor Operations.\n(line  150)\n* fdopen() (in module os):               File Object Creation.\n(line    9)\n* Feature (class in msilib):             Features<3>.        (line    6)\n* featureexternalges (in module xml.sax.handler): xml sax handler -- Base classes for SAX handlers.\n(line   81)\n* featureexternalpes (in module xml.sax.handler): xml sax handler -- Base classes for SAX handlers.\n(line   88)\n* featurenamespaceprefixes (in module xml.sax.handler): xml sax handler -- Base classes for SAX handlers.\n(line   60)\n* featurenamespaces (in module xml.sax.handler): xml sax handler -- Base classes for SAX handlers.\n(line   53)\n* featurestringinterning (in module xml.sax.handler): xml sax handler -- Base classes for SAX handlers.\n(line   67)\n* featurevalidation (in module xml.sax.handler): xml sax handler -- Base classes for SAX handlers.\n(line   74)\n* FEBRUARY (in module calendar):         calendar -- General calendar-related functions.\n(line  414)\n* feedeof() (asyncio.StreamReader method): StreamReader.    (line   16)\n* feed() (email.parser.BytesFeedParser method): FeedParser API.\n(line   56)\n* feed() (html.parser.HTMLParser method): HTMLParser Methods.\n(line    8)\n* feed() (xml.etree.ElementTree.XMLParser method): XMLParser Objects.\n(line   27)\n* feed() (xml.etree.ElementTree.XMLPullParser method): XMLPullParser Objects.\n(line   18)\n* feed() (xml.sax.xmlreader.IncrementalParser method): IncrementalParser Objects.\n(line    9)\n* FeedParser (class in email.parser):    FeedParser API.     (line   71)\n* fetch() (imaplib.IMAP4 method):        IMAP4 Objects.      (line   99)\n* Fetch() (msilib.View method):          View Objects.       (line   18)\n* fetchall() (sqlite3.Cursor method):    Cursor objects.     (line  146)\n* fetchmany() (sqlite3.Cursor method):   Cursor objects.     (line  129)\n* fetchone() (sqlite3.Cursor method):    Cursor objects.     (line  122)\n* FF (in module curses.ascii):           curses ascii -- Utilities for ASCII characters.\n(line   61)\n* fflags (select.kevent attribute):      Kevent Objects.     (line   90)\n* Field (class in dataclasses):          Module contents<4>. (line  288)\n* fieldsizelimit() (in module csv):    Module Contents<3>. (line   95)\n* field() (in module dataclasses):       Module contents<4>. (line  194)\n* fieldnames (csv.DictReader attribute): Reader Objects.     (line   31)\n* fields (uuid.UUID attribute):          uuid -- UUID objects according to RFC 4122.\n(line   96)\n* fields() (in module dataclasses):      Module contents<4>. (line  307)\n* FIFOTYPE (in module tarfile):          tarfile -- Read and write tar archive files.\n(line  303)\n* file (bdb.Breakpoint attribute):       bdb -- Debugger framework.\n(line   82)\n* file (pyclbr.Class attribute):         Class Objects<2>.   (line   12)\n* file (pyclbr.Function attribute):      Function Objects.   (line   11)\n* file object:                           Glossary.           (line  442)\n* file object; io module:                Overview<2>.        (line    6)\n* file object; open() built-in function: Built-in Functions. (line 1133)\n* FILEATTRIBUTEARCHIVE (in module stat): stat -- Interpreting stat results.\n(line  394)\n* FILEATTRIBUTECOMPRESSED (in module stat): stat -- Interpreting stat results.\n(line  394)\n* FILEATTRIBUTEDEVICE (in module stat): stat -- Interpreting stat results.\n(line  394)\n* FILEATTRIBUTEDIRECTORY (in module stat): stat -- Interpreting stat results.\n(line  394)\n* FILEATTRIBUTEENCRYPTED (in module stat): stat -- Interpreting stat results.\n(line  394)\n* FILEATTRIBUTEHIDDEN (in module stat): stat -- Interpreting stat results.\n(line  394)\n* FILEATTRIBUTEINTEGRITYSTREAM (in module stat): stat -- Interpreting stat results.\n(line  394)\n* FILEATTRIBUTENOSCRUBDATA (in module stat): stat -- Interpreting stat results.\n(line  394)\n* FILEATTRIBUTENORMAL (in module stat): stat -- Interpreting stat results.\n(line  394)\n* FILEATTRIBUTENOTCONTENTINDEXED (in module stat): stat -- Interpreting stat results.\n(line  394)\n* FILEATTRIBUTEOFFLINE (in module stat): stat -- Interpreting stat results.\n(line  394)\n* FILEATTRIBUTEREADONLY (in module stat): stat -- Interpreting stat results.\n(line  394)\n* FILEATTRIBUTEREPARSEPOINT (in module stat): stat -- Interpreting stat results.\n(line  394)\n* FILEATTRIBUTESPARSEFILE (in module stat): stat -- Interpreting stat results.\n(line  394)\n* FILEATTRIBUTESYSTEM (in module stat): stat -- Interpreting stat results.\n(line  394)\n* FILEATTRIBUTETEMPORARY (in module stat): stat -- Interpreting stat results.\n(line  394)\n* FILEATTRIBUTEVIRTUAL (in module stat): stat -- Interpreting stat results.\n(line  394)\n* filedigest() (in module hashlib):     File hashing.       (line    9)\n* fileopen() (urllib.request.FileHandler method): FileHandler Objects.\n(line    6)\n* filesize (zipfile.ZipInfo attribute): ZipInfo Objects.    (line  144)\n* file-like object:                      Glossary.           (line  458)\n* file; byte-code:                       pycompile -- Compile Python source files.\n(line    8)\n* file; copying:                         shutil -- High-level file operations.\n(line    8)\n* file; large files:                     Large File Support. (line    6)\n* file; mime.types:                      mimetypes -- Map filenames to MIME types.\n(line  124)\n* file; modes:                           Built-in Functions. (line 1159)\n* fileConfig() (in module logging.config): Configuration functions.\n(line   61)\n* FileCookieJar (class in http.cookiejar): http cookiejar -- Cookie handling for HTTP clients.\n(line   56)\n* FileDialog (class in tkinter.filedialog): Native Load/Save Dialogs.\n(line   78)\n* FileEntry (class in tkinter.tix):      File Selectors.     (line   50)\n* FileExistsError:                       OS exceptions.      (line   63)\n* FileFinder (class in importlib.machinery): importlib machinery - Importers and path hooks.\n(line  153)\n* FileHandler (class in logging):        FileHandler.        (line   10)\n* FileHandler (class in urllib.request): urllib request -- Extensible library for opening URLs.\n(line  426)\n* FileInput (class in fileinput):        fileinput -- Iterate over lines from multiple input streams.\n(line  139)\n* FileIO (class in io):                  Raw File I/O.       (line    6)\n* filelineno() (in module fileinput):    fileinput -- Iterate over lines from multiple input streams.\n(line  104)\n* FileLoader (class in importlib.abc):   importlib abc - Abstract base classes related to import.\n(line  320)\n* filemode() (in module stat):           stat -- Interpreting stat results.\n(line  121)\n* filename (doctest.DocTest attribute):  DocTest Objects.    (line   36)\n* filename (http.cookiejar.FileCookieJar attribute): CookieJar and FileCookieJar Objects.\n(line  154)\n* filename (inspect.FrameInfo attribute): The interpreter stack.\n(line   17)\n* filename (inspect.Traceback attribute): The interpreter stack.\n(line   57)\n* filename (netrc.NetrcParseError attribute): netrc -- netrc file processing.\n(line   54)\n* filename (OSError attribute):          Concrete exceptions.\n(line  184)\n* filename (SyntaxError attribute):      Concrete exceptions.\n(line  289)\n* filename (traceback.FrameSummary attribute): FrameSummary Objects.\n(line   27)\n* filename (traceback.TracebackException attribute): TracebackException Objects.\n(line   78)\n* filename (tracemalloc.Frame attribute): Frame.             (line   13)\n* filename (zipfile.ZipFile attribute):  ZipFile Objects.    (line  344)\n* filename (zipfile.ZipInfo attribute):  ZipInfo Objects.    (line   51)\n* filenameonly (in module tabnanny):    tabnanny -- Detection of ambiguous indentation.\n(line   31)\n* filenamepattern (tracemalloc.Filter attribute): Filter.   (line   54)\n* filename() (in module fileinput):      fileinput -- Iterate over lines from multiple input streams.\n(line   86)\n* filename2 (OSError attribute):         Concrete exceptions.\n(line  184)\n* filenames; pathname expansion:         glob -- Unix style pathname pattern expansion.\n(line    8)\n* filenames; wildcard expansion:         fnmatch -- Unix filename pattern matching.\n(line    8)\n* fileno() (bz2.BZ2File method):         De compression of files.\n(line   87)\n* fileno() (http.client.HTTPResponse method): HTTPResponse Objects.\n(line   36)\n* fileno() (in module fileinput):        fileinput -- Iterate over lines from multiple input streams.\n(line   91)\n* fileno() (io.IOBase method):           I/O Base Classes.   (line   62)\n* fileno() (multiprocessing.connection.Connection method): Connection Objects.\n(line   31)\n* fileno() (ossaudiodev.ossaudiodevice method): Audio Device Objects.\n(line   28)\n* fileno() (ossaudiodev.ossmixerdevice method): Mixer Device Objects.\n(line   14)\n* fileno() (select.devpoll method):      /dev/poll Polling Objects.\n(line   24)\n* fileno() (select.epoll method):        Edge and Level Trigger Polling epoll Objects.\n(line   73)\n* fileno() (select.kqueue method):       Kqueue Objects.     (line   14)\n* fileno() (selectors.DevpollSelector method): Classes<4>.   (line  188)\n* fileno() (selectors.EpollSelector method): Classes<4>.     (line  179)\n* fileno() (selectors.KqueueSelector method): Classes<4>.    (line  199)\n* fileno() (socket.socket method):       Socket Objects.     (line  118)\n* fileno() (socketserver.BaseServer method): Server Objects<2>.\n(line   14)\n* fileno() (telnetlib.Telnet method):    Telnet Objects.     (line   96)\n* FileNotFoundError:                     OS exceptions.      (line   68)\n* fileobj (selectors.SelectorKey attribute): Classes<4>.     (line   36)\n* filesdoubleevent() (tkinter.filedialog.FileDialog method): Native Load/Save Dialogs.\n(line   94)\n* filesselectevent() (tkinter.filedialog.FileDialog method): Native Load/Save Dialogs.\n(line   98)\n* files() (importlib.abc.TraversableResources method): importlib abc - Abstract base classes related to import.\n(line  611)\n* files() (importlib.resources.abc.TraversableResources method): importlib resources abc - Abstract base classes for resources.\n(line  169)\n* files() (in module importlib.resources): importlib resources - Package resource reading opening and access.\n(line   51)\n* FileSelectBox (class in tkinter.tix):  File Selectors.     (line   42)\n* filesystem encoding and error handler: Glossary.           (line  462)\n* FileType (class in argparse):          FileType objects.   (line    6)\n* FileWrapper (class in wsgiref.types):  wsgiref types - WSGI types for static type checking.\n(line   32)\n* FileWrapper (class in wsgiref.util):   wsgiref util - WSGI environment utilities.\n(line  116)\n* fill() (in module textwrap):           textwrap -- Text wrapping and filling.\n(line   33)\n* fill() (textwrap.TextWrapper method):  textwrap -- Text wrapping and filling.\n(line  295)\n* fillcolor() (in module turtle):        Color control.      (line   58)\n* filling() (in module turtle):          Filling.            (line    6)\n* fillvalue (reprlib.Repr attribute):    Repr Objects.       (line   10)\n* filter (2to3 fixer):                   Fixers.             (line  101)\n* Filter (class in logging):             Filter Objects.     (line   13)\n* Filter (class in tracemalloc):         Filter.             (line    6)\n* filter (select.kevent attribute):      Kevent Objects.     (line   15)\n* filtercommand() (tkinter.filedialog.FileDialog method): Native Load/Save Dialogs.\n(line  102)\n* FILTERDIR (in module unittest.mock):  FILTERDIR.         (line    6)\n* filtertraces() (tracemalloc.Snapshot method): Snapshot.   (line   35)\n* filter() (in module curses):           Functions<6>.       (line  121)\n* filter() (in module fnmatch):          fnmatch -- Unix filename pattern matching.\n(line   70)\n* filter() (logging.Filter method):      Filter Objects.     (line   20)\n* filter() (logging.Handler method):     Handler Objects.    (line   60)\n* filter() (logging.Logger method):      Logger Objects.     (line  332)\n* FilterError:                           tarfile -- Read and write tar archive files.\n(line  230)\n* filterfalse() (in module itertools):   Itertool Functions. (line  305)\n* filterwarnings() (in module warnings): Available Functions.\n(line  107)\n* Final (in module typing):              Special forms.      (line  186)\n* final() (in module typing):            Functions and decorators.\n(line  311)\n* finalization, of objects:              Finalization and De-allocation.\n(line    6)\n* finalize (class in weakref):           weakref -- Weak references.\n(line  268)\n* finalizer:                             Basic customization.\n(line   55)\n* findclass() (pickle protocol):        Restricting Globals.\n(line    6)\n* findclass() (pickle.Unpickler method): Module Interface.  (line  287)\n* findlibrary() (in module ctypes.util): Utility functions. (line   89)\n* findloader() (in module pkgutil):     pkgutil -- Package extension utility.\n(line   54)\n* findlongestmatch() (difflib.SequenceMatcher method): SequenceMatcher Objects.\n(line   64)\n* findmsvcrt() (in module ctypes.util): Utility functions.  (line   98)\n* findspec() (importlib.abc.MetaPathFinder method): importlib abc - Abstract base classes related to import.\n(line   35)\n* findspec() (importlib.abc.PathEntryFinder method): importlib abc - Abstract base classes related to import.\n(line   71)\n* findspec() (importlib.machinery.FileFinder method): importlib machinery - Importers and path hooks.\n(line  183)\n* findspec() (importlib.machinery.PathFinder class method): importlib machinery - Importers and path hooks.\n(line  116)\n* findspec() (in module importlib.util): importlib util - Utility code for importers.\n(line  101)\n* findspec() (zipimport.zipimporter method): zipimporter Objects.\n(line   38)\n* findunusedport() (in module test.support.sockethelper): test support sockethelper -- Utilities for socket tests.\n(line   15)\n* finduserpassword() (urllib.request.HTTPPasswordMgr method): HTTPPasswordMgr Objects.\n(line   16)\n* finduserpassword() (urllib.request.HTTPPasswordMgrWithPriorAuth method): HTTPPasswordMgrWithPriorAuth Objects.\n(line   19)\n* find() (bytearray method):             Bytes and Bytearray Operations.\n(line  133)\n* find() (bytes method):                 Bytes and Bytearray Operations.\n(line  133)\n* find() (doctest.DocTestFinder method): DocTestFinder objects.\n(line   32)\n* find() (in module gettext):            Class-based API.    (line   14)\n* find() (mmap.mmap method):             mmap -- Memory-mapped file support.\n(line  188)\n* find() (str method):                   String Methods<2>.  (line  117)\n* find() (xml.etree.ElementTree.Element method): Element Objects.\n(line  101)\n* find() (xml.etree.ElementTree.ElementTree method): ElementTree Objects.\n(line   21)\n* findall() (in module re):              Functions<2>.       (line  111)\n* findall() (re.Pattern method):         Regular Expression Objects.\n(line   85)\n* findall() (xml.etree.ElementTree.Element method): Element Objects.\n(line  110)\n* findall() (xml.etree.ElementTree.ElementTree method): ElementTree Objects.\n(line   26)\n* findCaller() (logging.Logger method):  Logger Objects.     (line  349)\n* finder:                                Finders and loaders.\n(line    6)\n* finder <1>:                            Glossary.           (line  482)\n* finder; findspec:                     The meta path.      (line    6)\n* findfactor() (in module audioop):      audioop -- Manipulate raw audio data.\n(line   82)\n* findfile() (in module test.support):   test support -- Utilities for the Python test suite.\n(line  271)\n* findfit() (in module audioop):         audioop -- Manipulate raw audio data.\n(line   91)\n* finditer() (in module re):             Functions<2>.       (line  133)\n* finditer() (re.Pattern method):        Regular Expression Objects.\n(line   91)\n* findlabels() (in module dis):          Analysis functions. (line  165)\n* findlinestarts() (in module dis):      Analysis functions. (line  151)\n* findmatch() (in module mailcap):       mailcap -- Mailcap file handling.\n(line   28)\n* findmax() (in module audioop):         audioop -- Manipulate raw audio data.\n(line  102)\n* findtext() (xml.etree.ElementTree.Element method): Element Objects.\n(line  119)\n* findtext() (xml.etree.ElementTree.ElementTree method): ElementTree Objects.\n(line   31)\n* finishrequest() (socketserver.BaseServer method): Server Objects<2>.\n(line  125)\n* finish() (socketserver.BaseRequestHandler method): Request Handler Objects.\n(line   35)\n* finish() (tkinter.dnd.DndHandler method): tkinter dnd -- Drag and drop support.\n(line   52)\n* FIRSTCOMPLETED (in module asyncio):   Waiting Primitives. (line   35)\n* FIRSTCOMPLETED (in module concurrent.futures): Module Functions.\n(line   30)\n* FIRSTEXCEPTION (in module asyncio):   Waiting Primitives. (line   39)\n* FIRSTEXCEPTION (in module concurrent.futures): Module Functions.\n(line   34)\n* firstChild (xml.dom.Node attribute):   Node Objects.       (line   54)\n* firstkey() (dbm.gnu.gdbm method):      dbm gnu -- GNU database manager.\n(line   80)\n* firstweekday() (in module calendar):   calendar -- General calendar-related functions.\n(line  300)\n* fixmissinglocations() (in module ast): ast Helpers.      (line  139)\n* fixsentenceendings (textwrap.TextWrapper attribute): textwrap -- Text wrapping and filling.\n(line  222)\n* Flag (class in enum):                  Data Types<2>.      (line  390)\n* flagbits (zipfile.ZipInfo attribute): ZipInfo Objects.    (line  116)\n* FlagBoundary (class in enum):          Data Types<2>.      (line  622)\n* flags (in module sys):                 sys -- System-specific parameters and functions.\n(line  512)\n* flags (re.Pattern attribute):          Regular Expression Objects.\n(line  107)\n* flags (select.kevent attribute):       Kevent Objects.     (line   52)\n* flash() (in module curses):            Functions<6>.       (line  132)\n* flatten() (email.generator.BytesGenerator method): email generator Generating MIME documents.\n(line   80)\n* flatten() (email.generator.Generator method): email generator Generating MIME documents.\n(line  175)\n* flattening; objects:                   pickle -- Python object serialization.\n(line    8)\n* float (built-in class):                Built-in Functions. (line  639)\n* floatinfo (in module sys):            sys -- System-specific parameters and functions.\n(line  596)\n* floatreprstyle (in module sys):      sys -- System-specific parameters and functions.\n(line  704)\n* floating point literal:                Numeric literals.   (line    6)\n* floating point; literals:              Numeric Types -- int float complex.\n(line   19)\n* floating point; number:                numbers Real float. (line    6)\n* FloatingPointError:                    Concrete exceptions.\n(line   33)\n* FloatOperation (class in decimal):     Signals.            (line  100)\n* flock() (in module fcntl):             fcntl -- The fcntl and ioctl system calls.\n(line  130)\n* floor division:                        Glossary.           (line  494)\n* floor() (in module math):              Numeric Types -- int float complex.\n(line  107)\n* floor() (in module math) <1>:          Number-theoretic and representation functions.\n(line   48)\n* FloorDiv (class in ast):               Expressions<2>.     (line   54)\n* floordiv() (in module operator):       operator -- Standard operators as functions.\n(line   88)\n* flushheaders() (http.server.BaseHTTPRequestHandler method): http server -- HTTP servers.\n(line  285)\n* flushstdstreams() (in module test.support): test support -- Utilities for the Python test suite.\n(line  403)\n* flush() (bz2.BZ2Compressor method):    Incremental de compression.\n(line   25)\n* flush() (io.BufferedWriter method):    Buffered Streams.   (line  125)\n* flush() (io.IOBase method):            I/O Base Classes.   (line   68)\n* flush() (logging.Handler method):      Handler Objects.    (line   68)\n* flush() (logging.handlers.BufferingHandler method): MemoryHandler.\n(line   30)\n* flush() (logging.handlers.MemoryHandler method): MemoryHandler.\n(line   61)\n* flush() (logging.StreamHandler method): StreamHandler.     (line   25)\n* flush() (lzma.LZMACompressor method):  Compressing and decompressing data in memory.\n(line   91)\n* flush() (mailbox.Mailbox method):      Mailbox objects.    (line  249)\n* flush() (mailbox.Maildir method):      Maildir objects.    (line  103)\n* flush() (mailbox.MH method):           MH objects.         (line   99)\n* flush() (mmap.mmap method):            mmap -- Memory-mapped file support.\n(line  198)\n* flush() (xml.etree.ElementTree.XMLParser method): XMLParser Objects.\n(line   31)\n* flush() (xml.etree.ElementTree.XMLPullParser method): XMLPullParser Objects.\n(line   22)\n* flush() (zlib.Compress method):        zlib -- Compression compatible with gzip.\n(line  211)\n* flush() (zlib.Decompress method):      zlib -- Compression compatible with gzip.\n(line  283)\n* flushinp() (in module curses):         Functions<6>.       (line  139)\n* FlushKey() (in module winreg):         Functions<13>.      (line  239)\n* fma() (decimal.Context method):        Context objects.    (line  307)\n* fma() (decimal.Decimal method):        Decimal objects.    (line  270)\n* fmean() (in module statistics):        Function details.   (line   49)\n* fmod() (in module math):               Number-theoretic and representation functions.\n(line   54)\n* FMTBINARY (in module plistlib):       plistlib -- Generate and parse Apple plist files.\n(line  141)\n* FMTXML (in module plistlib):          plistlib -- Generate and parse Apple plist files.\n(line  135)\n* fnmatch() (in module fnmatch):         fnmatch -- Unix filename pattern matching.\n(line   45)\n* fnmatchcase() (in module fnmatch):     fnmatch -- Unix filename pattern matching.\n(line   64)\n* focus() (tkinter.ttk.Treeview method): ttk Treeview.       (line   93)\n* fold (datetime.datetime attribute):    datetime Objects.   (line  319)\n* fold (datetime.time attribute):        time Objects.       (line   71)\n* foldbinary() (email.policy.Compat32 method): email policy Policy Objects.\n(line  607)\n* foldbinary() (email.policy.EmailPolicy method): email policy Policy Objects.\n(line  486)\n* foldbinary() (email.policy.Policy method): email policy Policy Objects.\n(line  350)\n* fold() (email.headerregistry.BaseHeader method): email headerregistry Custom Header Objects.\n(line   72)\n* fold() (email.policy.Compat32 method): email policy Policy Objects.\n(line  599)\n* fold() (email.policy.EmailPolicy method): email policy Policy Objects.\n(line  466)\n* fold() (email.policy.Policy method):   email policy Policy Objects.\n(line  335)\n* Font (class in tkinter.font):          tkinter font -- Tkinter font wrapper.\n(line   20)\n* For (class in ast):                    Control flow.       (line   45)\n* FORITER (opcode):                     Python Bytecode Instructions.\n(line  822)\n* for; in comprehensions:                Displays for lists sets and dictionaries.\n(line   14)\n* forget() (in module test.support.importhelper): test support importhelper -- Utilities for import tests.\n(line   11)\n* forget() (tkinter.ttk.Notebook method): ttk Notebook.      (line   18)\n* fork() (in module os):                 Process Management. (line  255)\n* fork() (in module pty):                pty -- Pseudo-terminal utilities.\n(line   22)\n* ForkingMixIn (class in socketserver):  Server Creation Notes.\n(line   27)\n* ForkingTCPServer (class in socketserver): Server Creation Notes.\n(line   67)\n* ForkingUDPServer (class in socketserver): Server Creation Notes.\n(line   67)\n* ForkingUnixDatagramServer (class in socketserver): Server Creation Notes.\n(line   67)\n* ForkingUnixStreamServer (class in socketserver): Server Creation Notes.\n(line   67)\n* forkpty() (in module os):              Process Management. (line  299)\n* Form (class in tkinter.tix):           Form Geometry Manager.\n(line    9)\n* FORMAT (inspect.BufferFlags attribute): Buffer flags.      (line   19)\n* format (memoryview attribute):         Memory Views.       (line  421)\n* format (multiprocessing.sharedmemory.ShareableList attribute): multiprocessing sharedmemory -- Shared memory for direct access across processes.\n(line  318)\n* format (struct.Struct attribute):      Classes<3>.         (line   54)\n* formatdatetime() (in module email.utils): email utils Miscellaneous utilities.\n(line  173)\n* formatexc() (in module traceback):    traceback -- Print or retrieve a stack traceback.\n(line  170)\n* formatexceptiononly() (in module traceback): traceback -- Print or retrieve a stack traceback.\n(line  132)\n* formatexceptiononly() (traceback.TracebackException method): TracebackException Objects.\n(line  142)\n* formatexception() (in module traceback): traceback -- Print or retrieve a stack traceback.\n(line  154)\n* formatfield() (string.Formatter method): Custom String Formatting.\n(line  102)\n* formatframesummary() (traceback.StackSummary method): StackSummary Objects.\n(line   53)\n* formathelp() (argparse.ArgumentParser method): Printing help.\n(line   30)\n* formatlist() (in module traceback):   traceback -- Print or retrieve a stack traceback.\n(line  122)\n* formatmap() (str method):             String Methods<2>.  (line  161)\n* formatstackentry() (bdb.Bdb method): bdb -- Debugger framework.\n(line  406)\n* formatstack() (in module traceback):  traceback -- Print or retrieve a stack traceback.\n(line  179)\n* formatstring() (in module locale):    locale -- Internationalization services.\n(line  455)\n* formattb() (in module traceback):     traceback -- Print or retrieve a stack traceback.\n(line  175)\n* formatusage() (argparse.ArgumentParser method): Printing help.\n(line   25)\n* FORMATVALUE (opcode):                 Python Bytecode Instructions.\n(line 1061)\n* format() (built-in function); str() (object method): Basic customization.\n(line  128)\n* format() (logging.BufferingFormatter method): Formatter Objects.\n(line  155)\n* format() (logging.Formatter method):   Formatter Objects.  (line   52)\n* format() (logging.Handler method):     Handler Objects.    (line  102)\n* format() (pprint.PrettyPrinter method): PrettyPrinter Objects.\n(line  115)\n* format() (str method):                 String Methods<2>.  (line  131)\n* format() (string.Formatter method):    Custom String Formatting.\n(line   17)\n* format() (traceback.StackSummary method): StackSummary Objects.\n(line   38)\n* format() (traceback.TracebackException method): TracebackException Objects.\n(line  130)\n* format() (tracemalloc.Traceback method): Traceback.        (line   37)\n* formataddr() (in module email.utils):  email utils Miscellaneous utilities.\n(line   71)\n* formatargvalues() (in module inspect): Classes and functions<2>.\n(line   73)\n* formatdate() (in module email.utils):  email utils Miscellaneous utilities.\n(line  152)\n* FormatError:                           Exceptions<16>.     (line   31)\n* FormatError() (in module ctypes):      Utility functions.  (line  108)\n* formatException() (logging.Formatter method): Formatter Objects.\n(line  117)\n* formatFooter() (logging.BufferingFormatter method): Formatter Objects.\n(line  148)\n* formatHeader() (logging.BufferingFormatter method): Formatter Objects.\n(line  141)\n* formatmonth() (calendar.HTMLCalendar method): calendar -- General calendar-related functions.\n(line  169)\n* formatmonth() (calendar.TextCalendar method): calendar -- General calendar-related functions.\n(line  134)\n* formatmonthname() (calendar.HTMLCalendar method): calendar -- General calendar-related functions.\n(line  190)\n* formatStack() (logging.Formatter method): Formatter Objects.\n(line  125)\n* formatted string literal:              String literal concatenation.\n(line   24)\n* FormattedValue (class in ast):         Literals<3>.        (line   18)\n* Formatter (class in logging):          Formatter Objects.  (line    6)\n* Formatter (class in string):           Custom String Formatting.\n(line   13)\n* formatTime() (logging.Formatter method): Formatter Objects.\n(line   77)\n* formatting, string (%):                printf-style String Formatting.\n(line    6)\n* formatting; bytearray (%):             printf-style Bytes Formatting.\n(line    6)\n* formatting; bytes (%):                 printf-style Bytes Formatting.\n(line    6)\n* formatwarning() (in module warnings):  Available Functions.\n(line   98)\n* formatyear() (calendar.HTMLCalendar method): calendar -- General calendar-related functions.\n(line  175)\n* formatyear() (calendar.TextCalendar method): calendar -- General calendar-related functions.\n(line  148)\n* formatyearpage() (calendar.HTMLCalendar method): calendar -- General calendar-related functions.\n(line  180)\n* Fortran contiguous:                    shape strides suboffsets.\n(line   25)\n* Fortran contiguous <1>:                Glossary.           (line  295)\n* forward() (in module turtle):          Turtle motion.      (line    6)\n* ForwardRef (class in typing):          Introspection helpers.\n(line  103)\n* fp (urllib.error.HTTPError attribute): urllib error -- Exception classes raised by urllib request.\n(line   61)\n* fpathconf() (in module os):            File Descriptor Operations.\n(line  159)\n* Fraction (class in fractions):         fractions -- Rational numbers.\n(line   16)\n* Frame (class in tracemalloc):          Frame.              (line    6)\n* frame (inspect.FrameInfo attribute):   The interpreter stack.\n(line   13)\n* frame (tkinter.scrolledtext.ScrolledText attribute): tkinter scrolledtext -- Scrolled Text Widget.\n(line   26)\n* FrameInfo (class in inspect):          The interpreter stack.\n(line   11)\n* FrameSummary (class in traceback):     FrameSummary Objects.\n(line   11)\n* FrameType (in module types):           Standard Interpreter Types.\n(line  239)\n* free (C function):                     Overview<4>.        (line   33)\n* freetoolid() (in module sys.monitoring): Registering and using tools.\n(line   13)\n* free; variable:                        Binding of names.   (line   48)\n* freedesktoposrelease() (in module platform): Linux Platforms.\n(line    6)\n* freefunc (C type):                     Slot Type typedefs. (line   27)\n* freeze utility:                        Importing Modules<2>.\n(line  256)\n* freezesupport() (in module multiprocessing): Miscellaneous<3>.\n(line   44)\n* freeze() (in module gc):               gc -- Garbage Collector interface.\n(line  205)\n* frexp() (in module math):              Number-theoretic and representation functions.\n(line   70)\n* FRIDAY (in module calendar):           calendar -- General calendar-related functions.\n(line  379)\n* fromaddress() (ctypes.CData method): Data types.         (line   42)\n* frombuffercopy() (ctypes.CData method): Data types.     (line   31)\n* frombuffer() (ctypes.CData method):  Data types.         (line   19)\n* frombytes() (int class method):       Additional Methods on Integer Types.\n(line  111)\n* fromcallable() (inspect.Signature class method): Introspecting callables with the Signature object.\n(line  153)\n* fromdecimal() (fractions.Fraction class method): fractions -- Rational numbers.\n(line  143)\n* fromexception() (traceback.TracebackException class method): TracebackException Objects.\n(line  113)\n* fromfile() (zipfile.ZipInfo class method): ZipInfo Objects.\n(line   14)\n* fromfile() (zoneinfo.ZoneInfo class method): The ZoneInfo class.\n(line   28)\n* fromfloat() (decimal.Decimal class method): Decimal objects.\n(line  243)\n* fromfloat() (fractions.Fraction class method): fractions -- Rational numbers.\n(line  132)\n* fromiterable() (itertools.chain class method): Itertool Functions.\n(line  119)\n* fromlist() (traceback.StackSummary class method): StackSummary Objects.\n(line   31)\n* fromparam() (ctypes.CData method):   Data types.         (line   51)\n* fromsamples() (statistics.NormalDist class method): NormalDist objects.\n(line   45)\n* fromtraceback() (dis.Bytecode class method): Bytecode analysis.\n(line   40)\n* from; import statement:                Binding of names.   (line    9)\n* from; import statement <1>:            The import statement.\n(line   52)\n* from; yield from expression:           Yield expressions.  (line   66)\n* frombuf() (tarfile.TarInfo class method): TarInfo Objects. (line   37)\n* frombytes() (array.array method):      array -- Efficient arrays of numeric values.\n(line  158)\n* fromfd() (in module socket):           Creating sockets.   (line  158)\n* fromfd() (select.epoll method):        Edge and Level Trigger Polling epoll Objects.\n(line   77)\n* fromfd() (select.kqueue method):       Kqueue Objects.     (line   18)\n* fromfile() (array.array method):       array -- Efficient arrays of numeric values.\n(line  168)\n* fromhex() (bytearray class method):    Bytearray Objects.  (line   36)\n* fromhex() (bytes class method):        Bytes Objects.      (line   62)\n* fromhex() (float class method):        Additional Methods on Float.\n(line   39)\n* fromisocalendar() (datetime.date class method): date Objects.\n(line   91)\n* fromisocalendar() (datetime.datetime class method): datetime Objects.\n(line  242)\n* fromisoformat() (datetime.date class method): date Objects.\n(line   63)\n* fromisoformat() (datetime.datetime class method): datetime Objects.\n(line  193)\n* fromisoformat() (datetime.time class method): time Objects.\n(line  107)\n* fromkeys() (collections.Counter method): Counter objects.  (line  117)\n* fromkeys() (dict class method):        Mapping Types -- dict.\n(line  143)\n* fromlist() (array.array method):       array -- Efficient arrays of numeric values.\n(line  176)\n* fromordinal() (datetime.date class method): date Objects.  (line   54)\n* fromordinal() (datetime.datetime class method): datetime Objects.\n(line  167)\n* fromshare() (in module socket):        Creating sockets.   (line  175)\n* fromstring() (in module xml.etree.ElementTree): Functions<9>.\n(line   99)\n* fromstringlist() (in module xml.etree.ElementTree): Functions<9>.\n(line  107)\n* fromtarfile() (tarfile.TarInfo class method): TarInfo Objects.\n(line   44)\n* fromtimestamp() (datetime.date class method): date Objects.\n(line   35)\n* fromtimestamp() (datetime.datetime class method): datetime Objects.\n(line   96)\n* fromunicode() (array.array method):    array -- Efficient arrays of numeric values.\n(line  182)\n* fromutc() (datetime.timezone method):  timezone Objects.   (line   61)\n* fromutc() (datetime.tzinfo method):    tzinfo Objects.     (line  163)\n* FrozenImporter (class in importlib.machinery): importlib machinery - Importers and path hooks.\n(line   80)\n* FrozenInstanceError:                   Module contents<4>. (line  480)\n* frozenset (built-in class):            Set Types -- set frozenset.\n(line   33)\n* FrozenSet (class in typing):           Aliases to built-in types.\n(line   55)\n* FS (in module curses.ascii):           curses ascii -- Utilities for ASCII characters.\n(line  109)\n* fsiscaseinsensitive() (in module test.support.oshelper): test support oshelper -- Utilities for os tests.\n(line  101)\n* FSNONASCII (in module test.support.oshelper): test support oshelper -- Utilities for os tests.\n(line   11)\n* fsdecode() (in module os):             Process Parameters. (line   95)\n* fsencode() (in module os):             Process Parameters. (line   82)\n* fspath() (in module os):               Process Parameters. (line  108)\n* fstat() (in module os):                File Descriptor Operations.\n(line  181)\n* fstatvfs() (in module os):             File Descriptor Operations.\n(line  193)\n* fstring:                               String literal concatenation.\n(line   24)\n* FSTRINGEND (in module token):         token -- Constants used with Python parse trees.\n(line  262)\n* FSTRINGMIDDLE (in module token):      token -- Constants used with Python parse trees.\n(line  260)\n* FSTRINGSTART (in module token):       token -- Constants used with Python parse trees.\n(line  258)\n* fsum() (in module math):               Number-theoretic and representation functions.\n(line   78)\n* fsync() (in module os):                File Descriptor Operations.\n(line  201)\n* FTP:                                   urllib request Restrictions.\n(line   37)\n* FTP (class in ftplib):                 FTP objects.        (line    6)\n* ftpopen() (urllib.request.FTPHandler method): FTPHandler Objects.\n(line    6)\n* FTPTLS (class in ftplib):             FTPTLS objects.    (line    6)\n* FTP; ftplib (standard module):         ftplib -- FTP protocol client.\n(line    8)\n* FTP; protocol:                         urllib request Restrictions.\n(line    6)\n* FTP; protocol <1>:                     ftplib -- FTP protocol client.\n(line    8)\n* FTPHandler (class in urllib.request):  urllib request -- Extensible library for opening URLs.\n(line  436)\n* ftruncate() (in module os):            File Descriptor Operations.\n(line  214)\n* Full:                                  queue -- A synchronized queue class.\n(line   88)\n* FULL (inspect.BufferFlags attribute):  Buffer flags.       (line   45)\n* FULLRO (inspect.BufferFlags attribute): Buffer flags.     (line   47)\n* fullurl (urllib.request.Request attribute): Request Objects.\n(line   11)\n* full() (asyncio.Queue method):         Queue.              (line   31)\n* full() (multiprocessing.Queue method): Pipes and Queues.   (line  114)\n* full() (queue.Queue method):           Queue Objects.      (line   22)\n* fullmatch() (in module re):            Functions<2>.       (line   59)\n* fullmatch() (re.Pattern method):       Regular Expression Objects.\n(line   62)\n* fullytrustedfilter() (in module tarfile): Default named filters.\n(line    9)\n* func (functools.partial attribute):    partial Objects.    (line    9)\n* funcattrs (2to3 fixer):                Fixers.             (line  105)\n* funcname (bdb.Breakpoint attribute):   bdb -- Debugger framework.\n(line  101)\n* function:                              Glossary.           (line  501)\n* Function (class in pyclbr):            Function Objects.   (line    6)\n* Function (class in symtable):          Examining Symbol Tables.\n(line   75)\n* function (inspect.FrameInfo attribute): The interpreter stack.\n(line   27)\n* function (inspect.Traceback attribute): The interpreter stack.\n(line   67)\n* function annotation:                   Glossary.           (line  509)\n* function; annotations:                 Function Annotations.\n(line    6)\n* function; annotations <1>:             Function definitions.\n(line  106)\n* function; argument:                    Callable types.     (line    6)\n* function; call:                        Callable types.     (line    6)\n* function; call <1>:                    Calls.              (line  132)\n* function; call <2>:                    Calls.              (line  141)\n* function; definition:                  The return statement.\n(line    6)\n* function; definition <1>:              Function definitions.\n(line    6)\n* function; generator:                   The yield statement.\n(line    6)\n* function; name:                        Function definitions.\n(line    6)\n* function; name <1>:                    Function definitions.\n(line    6)\n* FunctionDef (class in ast):            Function and class definitions.\n(line    6)\n* FunctionTestCase (class in unittest):  Test cases.         (line  947)\n* FunctionType (class in ast):           Root nodes.         (line   58)\n* FunctionType (in module types):        Standard Interpreter Types.\n(line   25)\n* funnyfiles (filecmp.dircmp attribute): The dircmp class.  (line   95)\n* future (2to3 fixer):                   Fixers.             (line  111)\n* Future (class in asyncio):             Future Object.      (line    6)\n* Future (class in concurrent.futures):  Future Objects.     (line   10)\n* future; statement:                     Future statements.  (line    6)\n* FutureWarning:                         Warnings.           (line   51)\n* fwalk() (in module os):                Files and Directories.\n(line 1725)\n* G.722:                                 aifc -- Read and write AIFF and AIFC files.\n(line  163)\n* gaierror:                              Exceptions<13>.     (line   27)\n* gamma() (in module math):              Special functions.  (line   29)\n* gammavariate() (in module random):     Real-valued distributions.\n(line   48)\n* garbage (in module gc):                gc -- Garbage Collector interface.\n(line  239)\n* garbage collection:                    Objects values and types.\n(line   37)\n* garbage collection <1>:                Glossary.           (line  543)\n* gather() (curses.textpad.Textbox method): Textbox objects. (line  109)\n* gather() (in module asyncio):          Running Tasks Concurrently.\n(line    6)\n* gauss() (in module random):            Real-valued distributions.\n(line   61)\n* gccollect() (in module test.support): test support -- Utilities for the Python test suite.\n(line  356)\n* gcd() (in module math):                Number-theoretic and representation functions.\n(line   93)\n* gcvisitobjectst (C type):             Querying Garbage Collector State.\n(line   26)\n* ge() (in module operator):             operator -- Standard operators as functions.\n(line   24)\n* genuuid() (in module msilib):         msilib -- Read and write Microsoft Installer files.\n(line  111)\n* generatetokens() (in module tokenize): Tokenizing Input.  (line   38)\n* generator:                             Glossary.           (line  552)\n* generator <1>:                         Glossary.           (line  552)\n* Generator (class in collections.abc):  Collections Abstract Base Classes - Detailed Descriptions.\n(line   53)\n* Generator (class in email.generator):  email generator Generating MIME documents.\n(line  140)\n* Generator (class in typing):           Aliases to other ABCs in collections abc.\n(line   37)\n* generator expression:                  Glossary.           (line  574)\n* generator expression <1>:              Glossary.           (line  574)\n* generator iterator:                    Glossary.           (line  562)\n* generator; expression:                 Generator expressions.\n(line    6)\n* generator; function:                   Generator functions.\n(line    6)\n* generator; function <1>:               Yield expressions.  (line    6)\n* generator; function <2>:               The yield statement.\n(line    6)\n* generator; iterator:                   Generator functions.\n(line    6)\n* generator; iterator <1>:               The yield statement.\n(line    6)\n* GeneratorExit:                         Concrete exceptions.\n(line   37)\n* GeneratorExp (class in ast):           Comprehensions.     (line    6)\n* GeneratorType (in module types):       Standard Interpreter Types.\n(line   37)\n* Generic (class in typing):             Building generic types and type aliases.\n(line   15)\n* generic function:                      Glossary.           (line  583)\n* generic type:                          Glossary.           (line  591)\n* genericvisit() (ast.NodeVisitor method): ast Helpers.     (line  195)\n* Generic; Alias:                        Generic Alias Type. (line    6)\n* generic; special; attribute:           The standard type hierarchy.\n(line   13)\n* GenericAlias (class in types):         Standard Interpreter Types.\n(line  194)\n* genops() (in module pickletools):      Programmatic Interface<2>.\n(line   22)\n* geometricmean() (in module statistics): Function details. (line   77)\n* GETAITER (opcode):                    Python Bytecode Instructions.\n(line  262)\n* getallbreaks() (bdb.Bdb method):     bdb -- Debugger framework.\n(line  390)\n* getallstartmethods() (in module multiprocessing): Miscellaneous<3>.\n(line   71)\n* getall() (email.message.EmailMessage method): email message Representing an email message.\n(line  254)\n* getall() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  361)\n* getall() (wsgiref.headers.Headers method): wsgiref headers - WSGI response header tools.\n(line   51)\n* GETANEXT (opcode):                    Python Bytecode Instructions.\n(line  271)\n* getannotations() (in module inspect): Classes and functions<2>.\n(line  156)\n* getapp() (wsgiref.simpleserver.WSGIServer method): wsgiref simpleserver - a simple WSGI HTTP server.\n(line   66)\n* getarchiveformats() (in module shutil): Archiving operations.\n(line   68)\n* getargs() (in module typing):         Introspection helpers.\n(line   66)\n* getasyncgenhooks() (in module sys):  sys -- System-specific parameters and functions.\n(line  964)\n* getattribute() (in module test.support): test support -- Utilities for the Python test suite.\n(line  586)\n* GETAWAITABLE (opcode):                Python Bytecode Instructions.\n(line  243)\n* getbegidx() (in module readline):     Completion.         (line   40)\n* getblocking() (in module os):         File Descriptor Operations.\n(line  227)\n* getbodyencoding() (email.charset.Charset method): email charset Representing character sets.\n(line   96)\n* getbody() (email.message.EmailMessage method): email message Representing an email message.\n(line  518)\n* getboundary() (email.message.EmailMessage method): email message Representing an email message.\n(line  403)\n* getboundary() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  578)\n* getbpbynumber() (bdb.Bdb method):     bdb -- Debugger framework.\n(line  366)\n* getbreak() (bdb.Bdb method):          bdb -- Debugger framework.\n(line  375)\n* getbreaks() (bdb.Bdb method):         bdb -- Debugger framework.\n(line  380)\n* getbuffer() (asyncio.BufferedProtocol method): Buffered Streaming Protocols.\n(line   21)\n* getbuffer() (xdrlib.Packer method):   Packer Objects.     (line    8)\n* getbuffer() (xdrlib.Unpacker method): Unpacker Objects.   (line   22)\n* getbytes() (mailbox.Mailbox method):  Mailbox objects.    (line  167)\n* getcacerts() (ssl.SSLContext method): SSL Contexts.      (line  168)\n* getcachetoken() (in module abc):     abc -- Abstract Base Classes.\n(line  326)\n* getchannelbinding() (ssl.SSLSocket method): SSL Sockets. (line  242)\n* getcharset() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  265)\n* getcharsets() (email.message.EmailMessage method): email message Representing an email message.\n(line  431)\n* getcharsets() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  612)\n* getchildwatcher() (asyncio.AbstractEventLoopPolicy method): Policy Objects.\n(line   33)\n* getchildwatcher() (in module asyncio): Process Watchers. (line   25)\n* getchildren() (symtable.SymbolTable method): Examining Symbol Tables.\n(line   71)\n* getchildren() (tkinter.ttk.Treeview method): ttk Treeview.\n(line   19)\n* getciphers() (ssl.SSLContext method): SSL Contexts.       (line  182)\n* getclockinfo() (in module time):     Functions<5>.       (line  105)\n* getclosematches() (in module difflib): difflib -- Helpers for computing deltas.\n(line  204)\n* getcode() (importlib.abc.InspectLoader method): importlib abc - Abstract base classes related to import.\n(line  236)\n* getcode() (importlib.abc.SourceLoader method): importlib abc - Abstract base classes related to import.\n(line  430)\n* getcode() (importlib.machinery.ExtensionFileLoader method): importlib machinery - Importers and path hooks.\n(line  333)\n* getcode() (importlib.machinery.SourcelessFileLoader method): importlib machinery - Importers and path hooks.\n(line  269)\n* getcode() (zipimport.zipimporter method): zipimporter Objects.\n(line   45)\n* getcompleterdelims() (in module readline): Completion.   (line   50)\n* getcompleter() (in module readline):  Completion.         (line   29)\n* getcompletiontype() (in module readline): Completion.    (line   34)\n* getconfighfilename() (in module sysconfig): Other functions<3>.\n(line   68)\n* getconfigvar() (in module sysconfig): Configuration variables.\n(line   26)\n* getconfigvars() (in module sysconfig): Configuration variables.\n(line   16)\n* getcontentcharset() (email.message.EmailMessage method): email message Representing an email message.\n(line  424)\n* getcontentcharset() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  601)\n* getcontentdisposition() (email.message.EmailMessage method): email message Representing an email message.\n(line  455)\n* getcontentdisposition() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  626)\n* getcontentmaintype() (email.message.EmailMessage method): email message Representing an email message.\n(line  324)\n* getcontentmaintype() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  431)\n* getcontentsubtype() (email.message.EmailMessage method): email message Representing an email message.\n(line  330)\n* getcontentsubtype() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  437)\n* getcontenttype() (email.message.EmailMessage method): email message Representing an email message.\n(line  308)\n* getcontenttype() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  415)\n* getcontent() (email.contentmanager.ContentManager method): email contentmanager Managing MIME Content.\n(line   19)\n* getcontent() (email.message.EmailMessage method): email message Representing an email message.\n(line  582)\n* getcontent() (in module email.contentmanager): Content Manager Instances.\n(line   24)\n* getcontext() (asyncio.Handle method): Callback Handles.   (line   11)\n* getcontext() (asyncio.Task method):   Task Object.        (line  170)\n* getcontext() (in module multiprocessing): Miscellaneous<3>.\n(line   80)\n* getcoro() (asyncio.Task method):      Task Object.        (line  157)\n* getcoroutineorigintrackingdepth() (in module sys): sys -- System-specific parameters and functions.\n(line  978)\n* getcount() (in module gc):            gc -- Garbage Collector interface.\n(line  113)\n* getcurrenthistorylength() (in module readline): History list.\n(line   14)\n* getdata() (importlib.abc.FileLoader method): importlib abc - Abstract base classes related to import.\n(line  352)\n* getdata() (importlib.abc.ResourceLoader method): importlib abc - Abstract base classes related to import.\n(line  217)\n* getdata() (in module pkgutil):        pkgutil -- Package extension utility.\n(line  184)\n* getdata() (zipimport.zipimporter method): zipimporter Objects.\n(line   50)\n* getdate() (mailbox.MaildirMessage method): MaildirMessage objects.\n(line   92)\n* getdebug() (asyncio.loop method):     Enabling debug mode.\n(line    6)\n* getdebug() (in module gc):            gc -- Garbage Collector interface.\n(line   58)\n* getdefaultdomain() (in module nis):  nis -- Interface to Sun's NIS Yellow Pages.\n(line   57)\n* getdefaultscheme() (in module sysconfig): Installation path functions.\n(line   14)\n* getdefaulttype() (email.message.EmailMessage method): email message Representing an email message.\n(line  335)\n* getdefaulttype() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  442)\n* getdefaultverifypaths() (in module ssl): Certificate handling.\n(line   62)\n* getdefault() (argparse.ArgumentParser method): Parser defaults.\n(line   33)\n* getdialect() (in module csv):         Module Contents<3>. (line   85)\n* getdisassemblyasstring() (test.support.bytecodehelper.BytecodeTestCase method): test support bytecodehelper -- Support tools for testing correct bytecode generation.\n(line   18)\n* getdocstring() (in module ast):       ast Helpers.        (line  116)\n* getdoctest() (doctest.DocTestParser method): DocTestParser objects.\n(line   13)\n* getendidx() (in module readline):     Completion.         (line   40)\n* getenviron() (wsgiref.simpleserver.WSGIRequestHandler method): wsgiref simpleserver - a simple WSGI HTTP server.\n(line   88)\n* geterrno() (in module ctypes):        Utility functions.  (line  121)\n* getescdelay() (in module curses):     Functions<6>.       (line  448)\n* geteventlooppolicy() (in module asyncio): Getting and Setting the Policy.\n(line    9)\n* geteventloop() (asyncio.AbstractEventLoopPolicy method): Policy Objects.\n(line   12)\n* geteventloop() (in module asyncio):  Event Loop.         (line   39)\n* getevents() (in module sys.monitoring): Setting events globally.\n(line    9)\n* getexamples() (doctest.DocTestParser method): DocTestParser objects.\n(line   22)\n* getexceptionhandler() (asyncio.loop method): Error Handling API.\n(line   27)\n* getexecpath() (in module os):        Process Parameters. (line  167)\n* getextrainfo() (asyncio.BaseTransport method): Base Transport.\n(line   21)\n* getextrainfo() (asyncio.StreamWriter method): StreamWriter.\n(line   61)\n* getfield() (string.Formatter method): Custom String Formatting.\n(line   55)\n* getfilebreaks() (bdb.Bdb method):    bdb -- Debugger framework.\n(line  385)\n* getfile() (mailbox.Babyl method):     Babyl objects.      (line   49)\n* getfile() (mailbox.Mailbox method):   Mailbox objects.    (line  183)\n* getfile() (mailbox.Maildir method):   Maildir objects.    (line  120)\n* getfile() (mailbox.mbox method):      mbox objects.       (line   32)\n* getfile() (mailbox.MH method):        MH objects.         (line   93)\n* getfile() (mailbox.MMDF method):      MMDF objects.       (line   29)\n* getfilename() (email.message.EmailMessage method): email message Representing an email message.\n(line  393)\n* getfilename() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  568)\n* getfilename() (importlib.abc.ExecutionLoader method): importlib abc - Abstract base classes related to import.\n(line  307)\n* getfilename() (importlib.abc.FileLoader method): importlib abc - Abstract base classes related to import.\n(line  348)\n* getfilename() (importlib.machinery.ExtensionFileLoader method): importlib machinery - Importers and path hooks.\n(line  341)\n* getfilename() (zipimport.zipimporter method): zipimporter Objects.\n(line   58)\n* getfilter() (tkinter.filedialog.FileDialog method): Native Load/Save Dialogs.\n(line  106)\n* getflags() (mailbox.MaildirMessage method): MaildirMessage objects.\n(line   63)\n* getflags() (mailbox.mboxMessage method): mboxMessage objects.\n(line   64)\n* getflags() (mailbox.MMDFMessage method): MMDFMessage objects.\n(line   63)\n* getfolder() (mailbox.Maildir method): Maildir objects.    (line   66)\n* getfolder() (mailbox.MH method):      MH objects.         (line   36)\n* getfrees() (symtable.Function method): Examining Symbol Tables.\n(line   97)\n* getfreezecount() (in module gc):     gc -- Garbage Collector interface.\n(line  230)\n* getfrom() (mailbox.mboxMessage method): mboxMessage objects.\n(line   47)\n* getfrom() (mailbox.MMDFMessage method): MMDFMessage objects.\n(line   46)\n* getfullurl() (urllib.request.Request method): Request Objects.\n(line  107)\n* getglobals() (symtable.Function method): Examining Symbol Tables.\n(line   89)\n* getgroupedopcodes() (difflib.SequenceMatcher method): SequenceMatcher Objects.\n(line  168)\n* gethandleinheritable() (in module os): Inheritance of File Descriptors.\n(line   35)\n* getheader() (urllib.request.Request method): Request Objects.\n(line  121)\n* gethistoryitem() (in module readline): History list.     (line   20)\n* gethistorylength() (in module readline): History file.   (line   30)\n* getid() (symtable.SymbolTable method): Examining Symbol Tables.\n(line   22)\n* getident() (in module thread):       thread -- Low-level threading API.\n(line   88)\n* getident() (in module threading):     threading -- Thread-based parallelism.\n(line  119)\n* getidentifiers() (string.Template method): Template strings.\n(line   75)\n* getidentifiers() (symtable.SymbolTable method): Examining Symbol Tables.\n(line   56)\n* getimporter() (in module pkgutil):    pkgutil -- Package extension utility.\n(line   72)\n* getinfo() (mailbox.MaildirMessage method): MaildirMessage objects.\n(line  102)\n* getinheritable() (in module os):      Inheritance of File Descriptors.\n(line   26)\n* getinheritable() (socket.socket method): Socket Objects.  (line  127)\n* getinstructions() (in module dis):    Analysis functions. (line  129)\n* getintmaxstrdigits() (in module sys): sys -- System-specific parameters and functions.\n(line  807)\n* getinterpreter() (in module zipapp):  Python API.         (line   83)\n* GETITER (opcode):                     Python Bytecode Instructions.\n(line  160)\n* getkey() (selectors.BaseSelector method): Classes<4>.     (line  145)\n* getlabels() (mailbox.Babyl method):   Babyl objects.      (line   35)\n* getlabels() (mailbox.BabylMessage method): BabylMessage objects.\n(line   47)\n* getlasterror() (in module ctypes):   Utility functions.  (line  129)\n* GETLEN (opcode):                      Python Bytecode Instructions.\n(line  461)\n* getlinebuffer() (in module readline): Line buffer.       (line    8)\n* getlineno() (symtable.SymbolTable method): Examining Symbol Tables.\n(line   38)\n* getloader() (in module pkgutil):      pkgutil -- Package extension utility.\n(line   86)\n* getlocalevents() (in module sys.monitoring): Per code object events.\n(line    8)\n* getlocals() (symtable.Function method): Examining Symbol Tables.\n(line   85)\n* getlogger() (in module multiprocessing): Logging<2>.      (line   11)\n* getloop() (asyncio.Future method):    Future Object.      (line  136)\n* getloop() (asyncio.Runner method):    Runner context manager.\n(line   57)\n* getloop() (asyncio.Server method):    Server Objects.     (line   44)\n* getmakefilefilename() (in module sysconfig): Other functions<3>.\n(line   72)\n* getmap() (selectors.BaseSelector method): Classes<4>.     (line  153)\n* getmatchingblocks() (difflib.SequenceMatcher method): SequenceMatcher Objects.\n(line  107)\n* getmessage() (mailbox.Mailbox method): Mailbox objects.   (line  160)\n* getmethod() (urllib.request.Request method): Request Objects.\n(line   69)\n* getmethods() (symtable.Class method): Examining Symbol Tables.\n(line  107)\n* getmixedtypekey() (in module ipaddress): Other Module Level Functions.\n(line   56)\n* getname() (asyncio.Task method):      Task Object.        (line  177)\n* getname() (symtable.Symbol method):   Examining Symbol Tables.\n(line  117)\n* getname() (symtable.SymbolTable method): Examining Symbol Tables.\n(line   26)\n* getnamespace() (symtable.Symbol method): Examining Symbol Tables.\n(line  188)\n* getnamespaces() (symtable.Symbol method): Examining Symbol Tables.\n(line  184)\n* getnativeid() (in module thread):   thread -- Low-level threading API.\n(line   96)\n* getnativeid() (in module threading): threading -- Thread-based parallelism.\n(line  129)\n* getnonlocals() (symtable.Function method): Examining Symbol Tables.\n(line   93)\n* getnonstandardattr() (http.cookiejar.Cookie method): Cookie Objects<2>.\n(line  102)\n* getnowait() (asyncio.Queue method):   Queue.              (line   44)\n* getnowait() (multiprocessing.Queue method): Pipes and Queues.\n(line  155)\n* getnowait() (queue.Queue method):     Queue Objects.      (line   61)\n* getnowait() (queue.SimpleQueue method): SimpleQueue Objects.\n(line   51)\n* getobjecttraceback() (in module tracemalloc): Functions<11>.\n(line   12)\n* getobjects() (in module gc):          gc -- Garbage Collector interface.\n(line   62)\n* getopcodes() (difflib.SequenceMatcher method): SequenceMatcher Objects.\n(line  125)\n* getoptiongroup() (optparse.OptionParser method): Grouping Options.\n(line  103)\n* getoption() (optparse.OptionParser method): Querying and manipulating your option parser.\n(line   37)\n* getorigin() (in module typing):       Introspection helpers.\n(line   44)\n* getoriginalbases() (in module types): Dynamic Type Creation.\n(line   72)\n* getoriginalstdout() (in module test.support): test support -- Utilities for the Python test suite.\n(line  313)\n* getosfhandle() (in module msvcrt):    File Operations.    (line   55)\n* getoutputcharset() (email.charset.Charset method): email charset Representing character sets.\n(line  111)\n* getoverloads() (in module typing):    Functions and decorators.\n(line  286)\n* getpagesize() (in module test.support): test support -- Utilities for the Python test suite.\n(line  280)\n* getparam() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  477)\n* getparameters() (symtable.Function method): Examining Symbol Tables.\n(line   80)\n* getparams() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  456)\n* getpathnames() (in module sysconfig): Installation path functions.\n(line   57)\n* getpath() (in module sysconfig):      Installation path functions.\n(line   62)\n* getpaths() (in module sysconfig):     Installation path functions.\n(line   93)\n* getpayload() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  180)\n* getpid() (asyncio.SubprocessTransport method): Subprocess Transports.\n(line    6)\n* getpipetransport() (asyncio.SubprocessTransport method): Subprocess Transports.\n(line   10)\n* getplatform() (in module sysconfig):  Other functions<3>. (line   11)\n* getpoly() (in module turtle):         Special Turtle methods.\n(line   17)\n* getposition() (xdrlib.Unpacker method): Unpacker Objects. (line   12)\n* getpreferredscheme() (in module sysconfig): Installation path functions.\n(line   24)\n* getprotocol() (asyncio.BaseTransport method): Base Transport.\n(line   88)\n* getproxyresponseheaders() (http.client.HTTPConnection method): HTTPConnection Objects.\n(line  134)\n* getpythonversion() (in module sysconfig): Other functions<3>.\n(line    6)\n* getready() (graphlib.TopologicalSorter method): graphlib -- Functionality to operate with graph-like structures.\n(line  150)\n* getrecsrc() (ossaudiodev.ossmixerdevice method): Mixer Device Objects.\n(line   84)\n* getreferents() (in module gc):        gc -- Garbage Collector interface.\n(line  145)\n* getreferrers() (in module gc):        gc -- Garbage Collector interface.\n(line  123)\n* getrequest() (socketserver.BaseServer method): Server Objects<2>.\n(line  131)\n* getreturncode() (asyncio.SubprocessTransport method): Subprocess Transports.\n(line   29)\n* getrunningloop() (in module asyncio): Event Loop.        (line   29)\n* getschemenames() (in module sysconfig): Installation path functions.\n(line    9)\n* getscheme() (wsgiref.handlers.BaseHandler method): wsgiref handlers - server/gateway base classes.\n(line  191)\n* getselection() (tkinter.filedialog.FileDialog method): Native Load/Save Dialogs.\n(line  110)\n* getsequences() (mailbox.MH method):   MH objects.         (line   53)\n* getsequences() (mailbox.MHMessage method): MHMessage objects.\n(line   32)\n* getservercertificate() (in module ssl): Certificate handling.\n(line   29)\n* getserver() (multiprocessing.managers.BaseManager method): Managers.\n(line   63)\n* getshapepoly() (in module turtle):    Appearance.         (line  188)\n* getsocket() (telnetlib.Telnet method): Telnet Objects.    (line   92)\n* getsourcesegment() (in module ast):  ast Helpers.        (line  127)\n* getsource() (importlib.abc.InspectLoader method): importlib abc - Abstract base classes related to import.\n(line  250)\n* getsource() (importlib.abc.SourceLoader method): importlib abc - Abstract base classes related to import.\n(line  448)\n* getsource() (importlib.machinery.ExtensionFileLoader method): importlib machinery - Importers and path hooks.\n(line  337)\n* getsource() (importlib.machinery.SourcelessFileLoader method): importlib machinery - Importers and path hooks.\n(line  274)\n* getsource() (zipimport.zipimporter method): zipimporter Objects.\n(line   66)\n* getstack() (asyncio.Task method):     Task Object.        (line  121)\n* getstack() (bdb.Bdb method):          bdb -- Debugger framework.\n(line  397)\n* getstartmethod() (in module multiprocessing): Miscellaneous<3>.\n(line   92)\n* getstarttagtext() (html.parser.HTMLParser method): HTMLParser Methods.\n(line   32)\n* getstatsprofile() (pstats.Stats method): The Stats Class.\n(line  225)\n* getstats() (in module gc):            gc -- Garbage Collector interface.\n(line   73)\n* getstderr() (wsgiref.handlers.BaseHandler method): wsgiref handlers - server/gateway base classes.\n(line  129)\n* getstderr() (wsgiref.simpleserver.WSGIRequestHandler method): wsgiref simpleserver - a simple WSGI HTTP server.\n(line   98)\n* getstdin() (wsgiref.handlers.BaseHandler method): wsgiref handlers - server/gateway base classes.\n(line  123)\n* getstring() (mailbox.Mailbox method): Mailbox objects.    (line  175)\n* getsubdir() (mailbox.MaildirMessage method): MaildirMessage objects.\n(line   47)\n* getsymbols() (symtable.SymbolTable method): Examining Symbol Tables.\n(line   66)\n* gettabsize() (in module curses):      Functions<6>.       (line  463)\n* gettaskfactory() (asyncio.loop method): Creating Futures and Tasks.\n(line   49)\n* getterminalsize() (in module os):    Querying the size of a terminal.\n(line    8)\n* getterminalsize() (in module shutil): Querying the size of the output terminal.\n(line    6)\n* getthreshold() (in module gc):        gc -- Garbage Collector interface.\n(line  118)\n* gettoken() (shlex.shlex method):      shlex Objects.      (line    8)\n* gettool() (in module sys.monitoring): Registering and using tools.\n(line   22)\n* gettracebacklimit() (in module tracemalloc): Functions<11>.\n(line   22)\n* gettracedmemory() (in module tracemalloc): Functions<11>.\n(line   32)\n* gettracemallocmemory() (in module tracemalloc): Functions<11>.\n(line   56)\n* gettypehints() (in module typing):   Introspection helpers.\n(line    6)\n* gettype() (symtable.SymbolTable method): Examining Symbol Tables.\n(line   10)\n* getunixfrom() (email.message.EmailMessage method): email message Representing an email message.\n(line  152)\n* getunixfrom() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  162)\n* getunpackformats() (in module shutil): Archiving operations.\n(line  190)\n* getusage() (optparse.OptionParser method): Other methods. (line   22)\n* getvalue() (string.Formatter method): Custom String Formatting.\n(line   65)\n* getversion() (optparse.OptionParser method): Printing a version string.\n(line   34)\n* getvisible() (mailbox.BabylMessage method): BabylMessage objects.\n(line   63)\n* getwch() (curses.window method):      Window Objects.     (line  241)\n* getwritebufferlimits() (asyncio.WriteTransport method): Write-only Transports.\n(line   23)\n* getwritebuffersize() (asyncio.WriteTransport method): Write-only Transports.\n(line   19)\n* GETYIELDFROMITER (opcode):          Python Bytecode Instructions.\n(line  164)\n* get() (asyncio.Queue method):          Queue.              (line   39)\n* get() (configparser.ConfigParser method): ConfigParser Objects.\n(line  190)\n* get() (contextvars.Context method):    Manual Context Management.\n(line   90)\n* get() (contextvars.ContextVar method): Context Variables.  (line   30)\n* get() (dict method):                   Mapping Types -- dict.\n(line  155)\n* get() (email.message.EmailMessage method): email message Representing an email message.\n(line  245)\n* get() (email.message.Message method):  email message Message Representing an email message using the compat32 API.\n(line  353)\n* get() (in module webbrowser):          webbrowser -- Convenient web-browser controller.\n(line   83)\n* get() (mailbox.Mailbox method):        Mailbox objects.    (line  148)\n* get() (multiprocessing.pool.AsyncResult method): Process Pools.\n(line  196)\n* get() (multiprocessing.Queue method):  Pipes and Queues.   (line  140)\n* get() (multiprocessing.SimpleQueue method): Pipes and Queues.\n(line  223)\n* get() (ossaudiodev.ossmixerdevice method): Mixer Device Objects.\n(line   60)\n* get() (queue.Queue method):            Queue Objects.      (line   44)\n* get() (queue.SimpleQueue method):      SimpleQueue Objects.\n(line   40)\n* get() (tkinter.ttk.Combobox method):   ttk Combobox.       (line   15)\n* get() (tkinter.ttk.Spinbox method):    ttk Spinbox.        (line    8)\n* get() (types.MappingProxyType method): Standard Interpreter Types.\n(line  304)\n* get() (xml.etree.ElementTree.Element method): Element Objects.\n(line   64)\n* getacl() (imaplib.IMAP4 method):       IMAP4 Objects.      (line  106)\n* getaddresses() (in module email.utils): email utils Miscellaneous utilities.\n(line   85)\n* getaddrinfo() (asyncio.loop method):   DNS.                (line    6)\n* getaddrinfo() (in module socket):      Other functions<2>. (line   17)\n* getallocatedblocks() (in module sys):  sys -- System-specific parameters and functions.\n(line  716)\n* getandroidapilevel() (in module sys):  sys -- System-specific parameters and functions.\n(line  737)\n* getannotation() (imaplib.IMAP4 method): IMAP4 Objects.     (line  111)\n* getargvalues() (in module inspect):    Classes and functions<2>.\n(line   62)\n* getasyncgenlocals() (in module inspect): Current State of Generators Coroutines and Asynchronous Generators.\n(line  100)\n* getasyncgenstate() (in module inspect): Current State of Generators Coroutines and Asynchronous Generators.\n(line   47)\n* getatime() (in module os.path):        os path -- Common pathname manipulations.\n(line  166)\n* getattrstatic() (in module inspect):  Fetching attributes statically.\n(line   16)\n* getattrfunc (C type):                  Slot Type typedefs. (line   43)\n* getAttribute() (xml.dom.Element method): Element Objects<2>.\n(line   31)\n* getAttributeNode() (xml.dom.Element method): Element Objects<2>.\n(line   37)\n* getAttributeNodeNS() (xml.dom.Element method): Element Objects<2>.\n(line   47)\n* getAttributeNS() (xml.dom.Element method): Element Objects<2>.\n(line   41)\n* getattrofunc (C type):                 Slot Type typedefs. (line   54)\n* GetBase() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line   31)\n* getbegyx() (curses.window method):     Window Objects.     (line  225)\n* getbkgd() (curses.window method):      Window Objects.     (line  229)\n* getblocking() (socket.socket method):  Socket Objects.     (line  164)\n* getboolean() (configparser.ConfigParser method): ConfigParser Objects.\n(line  224)\n* getbuffer() (io.BytesIO method):       Buffered Streams.   (line   21)\n* getbufferproc (C type):                Slot Type typedefs. (line  100)\n* getByteStream() (xml.sax.xmlreader.InputSource method): InputSource Objects.\n(line   48)\n* getcallargs() (in module inspect):     Classes and functions<2>.\n(line   92)\n* getcanvas() (in module turtle):        Settings and special methods.\n(line   55)\n* getcapabilities() (nntplib.NNTP method): Methods<3>.       (line   34)\n* getcaps() (in module mailcap):         mailcap -- Mailcap file handling.\n(line   78)\n* getch() (curses.window method):        Window Objects.     (line  234)\n* getch() (in module msvcrt):            Console I/O.        (line   10)\n* getCharacterStream() (xml.sax.xmlreader.InputSource method): InputSource Objects.\n(line   64)\n* getche() (in module msvcrt):           Console I/O.        (line   25)\n* getChild() (logging.Logger method):    Logger Objects.     (line  161)\n* getChildren() (logging.Logger method): Logger Objects.     (line  173)\n* getclasstree() (in module inspect):    Classes and functions<2>.\n(line    6)\n* getclosurevars() (in module inspect):  Classes and functions<2>.\n(line  123)\n* getcode() (http.client.HTTPResponse method): HTTPResponse Objects.\n(line   89)\n* getcode() (urllib.response.addinfourl method): urllib response -- Response classes used by urllib.\n(line   45)\n* GetColumnInfo() (msilib.View method):  View Objects.       (line   12)\n* getColumnNumber() (xml.sax.xmlreader.Locator method): Locator Objects.\n(line    8)\n* getcomments() (in module inspect):     Retrieving source code.\n(line   18)\n* getcompname() (aifc.aifc method):      aifc -- Read and write AIFF and AIFC files.\n(line   76)\n* getcompname() (sunau.AUread method):  AUread Objects.    (line   35)\n* getcompname() (wave.Waveread method): Waveread Objects.  (line   41)\n* getcomptype() (aifc.aifc method):      aifc -- Read and write AIFF and AIFC files.\n(line   70)\n* getcomptype() (sunau.AUread method):  AUread Objects.    (line   30)\n* getcomptype() (wave.Waveread method): Waveread Objects.  (line   36)\n* getconfig() (sqlite3.Connection method): Connection objects.\n(line  619)\n* getContentHandler() (xml.sax.xmlreader.XMLReader method): XMLReader Objects.\n(line   21)\n* getcontext() (in module decimal):      Context objects.    (line   14)\n* getcoroutinelocals() (in module inspect): Current State of Generators Coroutines and Asynchronous Generators.\n(line   92)\n* getcoroutinestate() (in module inspect): Current State of Generators Coroutines and Asynchronous Generators.\n(line   28)\n* getctime() (in module os.path):        os path -- Common pathname manipulations.\n(line  182)\n* getcwd() (in module os):               Files and Directories.\n(line  286)\n* getcwdb() (in module os):              Files and Directories.\n(line  290)\n* getcwdu (2to3 fixer):                  Fixers.             (line  115)\n* getdecoder() (in module codecs):       codecs -- Codec registry and base classes.\n(line  107)\n* getdefaultencoding() (in module sys):  sys -- System-specific parameters and functions.\n(line  745)\n* getdefaultlocale() (in module locale): locale -- Internationalization services.\n(line  336)\n* getdefaulttimeout() (in module socket): Other functions<2>.\n(line  347)\n* getdlopenflags() (in module sys):      sys -- System-specific parameters and functions.\n(line  750)\n* getdoc() (in module inspect):          Retrieving source code.\n(line    6)\n* getDOMImplementation() (in module xml.dom): Module Contents<4>.\n(line   17)\n* getDTDHandler() (xml.sax.xmlreader.XMLReader method): XMLReader Objects.\n(line   30)\n* getEffectiveLevel() (logging.Logger method): Logger Objects.\n(line  151)\n* getegid() (in module os):              Process Parameters. (line  177)\n* getElementsByTagName() (xml.dom.Document method): Document Objects.\n(line   61)\n* getElementsByTagName() (xml.dom.Element method): Element Objects<2>.\n(line   14)\n* getElementsByTagNameNS() (xml.dom.Document method): Document Objects.\n(line   66)\n* getElementsByTagNameNS() (xml.dom.Element method): Element Objects<2>.\n(line   18)\n* getencoder() (in module codecs):       codecs -- Codec registry and base classes.\n(line   99)\n* getencoding() (in module locale):      locale -- Internationalization services.\n(line  397)\n* getEncoding() (xml.sax.xmlreader.InputSource method): InputSource Objects.\n(line   32)\n* getEntityResolver() (xml.sax.xmlreader.XMLReader method): XMLReader Objects.\n(line   39)\n* getenv() (in module os):               Process Parameters. (line  135)\n* getenvb() (in module os):              Process Parameters. (line  151)\n* getErrorHandler() (xml.sax.xmlreader.XMLReader method): XMLReader Objects.\n(line   50)\n* geteuid() (in module os):              Process Parameters. (line  185)\n* getEvent() (xml.dom.pulldom.DOMEventStream method): DOMEventStream Objects.\n(line   11)\n* getEventCategory() (logging.handlers.NTEventLogHandler method): NTEventLogHandler.\n(line   43)\n* getEventType() (logging.handlers.NTEventLogHandler method): NTEventLogHandler.\n(line   49)\n* getException() (xml.sax.SAXException method): SAXException Objects.\n(line   13)\n* getFeature() (xml.sax.xmlreader.XMLReader method): XMLReader Objects.\n(line   69)\n* GetFieldCount() (msilib.Record method): Record Objects.    (line    6)\n* getfile() (in module inspect):         Retrieving source code.\n(line   27)\n* getFilesToDelete() (logging.handlers.TimedRotatingFileHandler method): TimedRotatingFileHandler.\n(line  115)\n* getfilesystemencodeerrors() (in module sys): sys -- System-specific parameters and functions.\n(line  790)\n* getfilesystemencoding() (in module sys): sys -- System-specific parameters and functions.\n(line  759)\n* getfirst() (cgi.FieldStorage method):  Higher Level Interface.\n(line   56)\n* getfloat() (configparser.ConfigParser method): ConfigParser Objects.\n(line  217)\n* getfmts() (ossaudiodev.ossaudiodevice method): Audio Device Objects.\n(line   80)\n* getfqdn() (in module socket):          Other functions<2>. (line   71)\n* getframeinfo() (in module inspect):    The interpreter stack.\n(line  123)\n* getframerate() (aifc.aifc method):     aifc -- Read and write AIFF and AIFC files.\n(line   62)\n* getframerate() (sunau.AUread method): AUread Objects.    (line   22)\n* getframerate() (wave.Waveread method): Waveread Objects. (line   28)\n* getfullargspec() (in module inspect):  Classes and functions<2>.\n(line   17)\n* getgeneratorlocals() (in module inspect): Current State of Generators Coroutines and Asynchronous Generators.\n(line   72)\n* getgeneratorstate() (in module inspect): Current State of Generators Coroutines and Asynchronous Generators.\n(line   12)\n* getgid() (in module os):               Process Parameters. (line  191)\n* getgrall() (in module grp):            grp -- The group database.\n(line   58)\n* getgrgid() (in module grp):            grp -- The group database.\n(line   44)\n* getgrnam() (in module grp):            grp -- The group database.\n(line   53)\n* getgrouplist() (in module os):         Process Parameters. (line  200)\n* getgroups() (in module os):            Process Parameters. (line  211)\n* getHandlerByName() (in module logging): Module-Level Functions.\n(line  181)\n* getHandlerNames() (in module logging): Module-Level Functions.\n(line  188)\n* getheader() (http.client.HTTPResponse method): HTTPResponse Objects.\n(line   24)\n* getheaders() (http.client.HTTPResponse method): HTTPResponse Objects.\n(line   32)\n* gethostbyaddr() (in module socket):    Process Parameters. (line  552)\n* gethostbyaddr() (in module socket) <1>: Other functions<2>.\n(line  128)\n* gethostbynameex() (in module socket): Other functions<2>. (line   98)\n* gethostbyname() (in module socket):    Other functions<2>. (line   83)\n* gethostname() (in module socket):      Process Parameters. (line  552)\n* gethostname() (in module socket) <1>:  Other functions<2>. (line  115)\n* getincrementaldecoder() (in module codecs): codecs -- Codec registry and base classes.\n(line  123)\n* getincrementalencoder() (in module codecs): codecs -- Codec registry and base classes.\n(line  115)\n* getinfo() (zipfile.ZipFile method):    ZipFile Objects.    (line  112)\n* getinnerframes() (in module inspect):  The interpreter stack.\n(line  146)\n* GetInputContext() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line   37)\n* getint() (configparser.ConfigParser method): ConfigParser Objects.\n(line  210)\n* GetInteger() (msilib.Record method):   Record Objects.     (line   11)\n* getitem() (in module operator):        operator -- Standard operators as functions.\n(line  196)\n* getiterfunc (C type):                  Slot Type typedefs. (line   88)\n* getitimer() (in module signal):        Module contents<2>. (line  435)\n* getkey() (curses.window method):       Window Objects.     (line  249)\n* GetLastError() (in module ctypes):     Utility functions.  (line  114)\n* getLength() (xml.sax.xmlreader.Attributes method): The Attributes Interface.\n(line   11)\n* getLevelName() (in module logging):    Module-Level Functions.\n(line  148)\n* getLevelNamesMapping() (in module logging): Module-Level Functions.\n(line  139)\n* getlimit() (sqlite3.Connection method): Connection objects.\n(line  563)\n* getline() (in module linecache):       linecache -- Random access to text lines.\n(line   23)\n* getLineNumber() (xml.sax.xmlreader.Locator method): Locator Objects.\n(line   12)\n* getlist() (cgi.FieldStorage method):   Higher Level Interface.\n(line   67)\n* getloadavg() (in module os):           Miscellaneous System Information.\n(line   49)\n* getlocale() (in module locale):        locale -- Internationalization services.\n(line  362)\n* getLogger() (in module logging):       Module-Level Functions.\n(line    9)\n* getLoggerClass() (in module logging):  Module-Level Functions.\n(line   21)\n* getlogin() (in module os):             Process Parameters. (line  234)\n* getLogRecordFactory() (in module logging): Module-Level Functions.\n(line   32)\n* getMandatoryRelease() (future.Feature method): Module Contents<5>.\n(line   67)\n* getmark() (aifc.aifc method):          aifc -- Read and write AIFF and AIFC files.\n(line   95)\n* getmark() (sunau.AUread method):      AUread Objects.    (line   77)\n* getmark() (wave.Waveread method):     Waveread Objects.  (line   68)\n* getmarkers() (aifc.aifc method):       aifc -- Read and write AIFF and AIFC files.\n(line   88)\n* getmarkers() (sunau.AUread method):   AUread Objects.    (line   73)\n* getmarkers() (wave.Waveread method):  Waveread Objects.  (line   64)\n* getmaxyx() (curses.window method):     Window Objects.     (line  256)\n* getmember() (tarfile.TarFile method):  TarFile Objects.    (line   97)\n* getmembersstatic() (in module inspect): Types and members.\n(line  303)\n* getmembers() (in module inspect):      Types and members.  (line  290)\n* getmembers() (tarfile.TarFile method): TarFile Objects.    (line  105)\n* getMessage() (logging.LogRecord method): LogRecord Objects.\n(line   64)\n* getMessage() (xml.sax.SAXException method): SAXException Objects.\n(line    9)\n* getMessageID() (logging.handlers.NTEventLogHandler method): NTEventLogHandler.\n(line   60)\n* getmodule() (in module inspect):       Retrieving source code.\n(line   33)\n* getmodulename() (in module inspect):   Types and members.  (line  319)\n* getmouse() (in module curses):         Functions<6>.       (line  145)\n* getmro() (in module inspect):          Classes and functions<2>.\n(line   84)\n* getmtime() (in module os.path):        os path -- Common pathname manipulations.\n(line  173)\n* getname() (chunk.Chunk method):        chunk -- Read IFF chunked data.\n(line   72)\n* getName() (threading.Thread method):   Thread Objects.     (line  159)\n* getNameByQName() (xml.sax.xmlreader.AttributesNS method): The AttributesNS Interface.\n(line   16)\n* getnameinfo() (asyncio.loop method):   DNS.                (line   11)\n* getnameinfo() (in module socket):      Other functions<2>. (line  144)\n* getnames() (tarfile.TarFile method):   TarFile Objects.    (line  111)\n* getNames() (xml.sax.xmlreader.Attributes method): The Attributes Interface.\n(line   15)\n* getnchannels() (aifc.aifc method):     aifc -- Read and write AIFF and AIFC files.\n(line   54)\n* getnchannels() (sunau.AUread method): AUread Objects.    (line   14)\n* getnchannels() (wave.Waveread method): Waveread Objects. (line   19)\n* getnframes() (aifc.aifc method):       aifc -- Read and write AIFF and AIFC files.\n(line   66)\n* getnframes() (sunau.AUread method):   AUread Objects.    (line   26)\n* getnframes() (wave.Waveread method):  Waveread Objects.  (line   32)\n* getnode:                               uuid -- UUID objects according to RFC 4122.\n(line  179)\n* getnode() (in module uuid):            uuid -- UUID objects according to RFC 4122.\n(line  161)\n* getopt() (in module getopt):           getopt -- C-style parser for command line options.\n(line   25)\n* GetoptError:                           getopt -- C-style parser for command line options.\n(line   74)\n* getOptionalRelease() (future.Feature method): Module Contents<5>.\n(line   62)\n* getouterframes() (in module inspect):  The interpreter stack.\n(line  131)\n* getoutput() (in module subprocess):    Legacy Shell Invocation Functions.\n(line   45)\n* getpagesize() (in module resource):    Resource Usage.     (line  101)\n* getparams() (aifc.aifc method):        aifc -- Read and write AIFF and AIFC files.\n(line   82)\n* getparams() (sunau.AUread method):    AUread Objects.    (line   41)\n* getparams() (wave.Waveread method):   Waveread Objects.  (line   46)\n* getparyx() (curses.window method):     Window Objects.     (line  260)\n* getpass() (in module getpass):         getpass -- Portable password input.\n(line   18)\n* GetPassWarning:                        getpass -- Portable password input.\n(line   35)\n* getpeercert() (ssl.SSLSocket method):  SSL Sockets.        (line  144)\n* getpeername() (socket.socket method):  Socket Objects.     (line  135)\n* getpen() (in module turtle):           Special Turtle methods.\n(line   40)\n* getpgid() (in module os):              Process Parameters. (line  245)\n* getpgrp() (in module os):              Process Parameters. (line  253)\n* getpid() (in module os):               Process Parameters. (line  259)\n* getpos() (html.parser.HTMLParser method): HTMLParser Methods.\n(line   28)\n* getppid() (in module os):              Process Parameters. (line  266)\n* getpreferredencoding() (in module locale): locale -- Internationalization services.\n(line  373)\n* getpriority() (in module os):          Process Parameters. (line  277)\n* getprofile() (in module sys):          sys -- System-specific parameters and functions.\n(line  896)\n* getprofile() (in module threading):    threading -- Thread-based parallelism.\n(line  200)\n* GetProperty() (msilib.SummaryInformation method): Summary Information Objects.\n(line    6)\n* getProperty() (xml.sax.xmlreader.XMLReader method): XMLReader Objects.\n(line   83)\n* GetPropertyCount() (msilib.SummaryInformation method): Summary Information Objects.\n(line   17)\n* getprotobyname() (in module socket):   Other functions<2>. (line  164)\n* getproxies() (in module urllib.request): urllib request -- Extensible library for opening URLs.\n(line  170)\n* getPublicId() (xml.sax.xmlreader.InputSource method): InputSource Objects.\n(line   10)\n* getPublicId() (xml.sax.xmlreader.Locator method): Locator Objects.\n(line   16)\n* getpwall() (in module pwd):            pwd -- The password database.\n(line   67)\n* getpwnam() (in module pwd):            pwd -- The password database.\n(line   63)\n* getpwuid() (in module pwd):            pwd -- The password database.\n(line   59)\n* getQNameByName() (xml.sax.xmlreader.AttributesNS method): The AttributesNS Interface.\n(line   20)\n* getQNames() (xml.sax.xmlreader.AttributesNS method): The AttributesNS Interface.\n(line   24)\n* getquota() (imaplib.IMAP4 method):     IMAP4 Objects.      (line  116)\n* getquotaroot() (imaplib.IMAP4 method): IMAP4 Objects.      (line  121)\n* getrandbits() (in module random):      Functions for integers.\n(line   37)\n* getrandbits() (random.Random method):  Alternative Generator.\n(line   41)\n* getrandom() (in module os):            Random numbers<2>.  (line    6)\n* getreader() (in module codecs):        codecs -- Codec registry and base classes.\n(line  131)\n* getrecursionlimit() (in module sys):   sys -- System-specific parameters and functions.\n(line  830)\n* getrefcount() (in module sys):         sys -- System-specific parameters and functions.\n(line  815)\n* GetReparseDeferralEnabled() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line  111)\n* getresgid() (in module os):            Process Parameters. (line  324)\n* getresponse() (http.client.HTTPConnection method): HTTPConnection Objects.\n(line   75)\n* getresuid() (in module os):            Process Parameters. (line  315)\n* getrlimit() (in module resource):      Resource Limits.    (line   24)\n* getroot() (xml.etree.ElementTree.ElementTree method): ElementTree Objects.\n(line   36)\n* getrusage() (in module resource):      Resource Usage.     (line    8)\n* getsample() (in module audioop):       audioop -- Manipulate raw audio data.\n(line  111)\n* getsampwidth() (aifc.aifc method):     aifc -- Read and write AIFF and AIFC files.\n(line   58)\n* getsampwidth() (sunau.AUread method): AUread Objects.    (line   18)\n* getsampwidth() (wave.Waveread method): Waveread Objects. (line   24)\n* getscreen() (in module turtle):        Special Turtle methods.\n(line   51)\n* getservbyname() (in module socket):    Other functions<2>. (line  175)\n* getservbyport() (in module socket):    Other functions<2>. (line  186)\n* GetSetDescriptorType (in module types): Standard Interpreter Types.\n(line  244)\n* getshapes() (in module turtle):        Settings and special methods.\n(line   64)\n* getsid() (in module os):               Process Parameters. (line  510)\n* getsignal() (in module signal):        Module contents<2>. (line  284)\n* getsitepackages() (in module site):    Module contents<5>. (line   57)\n* getsize() (chunk.Chunk method):        chunk -- Read IFF chunked data.\n(line   77)\n* getsize() (in module os.path):         os path -- Common pathname manipulations.\n(line  193)\n* getsizeof() (in module sys):           sys -- System-specific parameters and functions.\n(line  837)\n* getsockname() (socket.socket method):  Socket Objects.     (line  143)\n* getsockopt() (socket.socket method):   Socket Objects.     (line  149)\n* getsource() (in module inspect):       Retrieving source code.\n(line   59)\n* getsourcefile() (in module inspect):   Retrieving source code.\n(line   38)\n* getsourcelines() (in module inspect):  Retrieving source code.\n(line   45)\n* getspall() (in module spwd):           spwd -- The shadow password database.\n(line   77)\n* getspnam() (in module spwd):           spwd -- The shadow password database.\n(line   69)\n* getstate() (codecs.IncrementalDecoder method): IncrementalDecoder Objects.\n(line   44)\n* getstate() (codecs.IncrementalEncoder method): IncrementalEncoder Objects.\n(line   42)\n* getstate() (in module random):         Bookkeeping functions.\n(line   32)\n* getstate() (random.Random method):     Alternative Generator.\n(line   23)\n* getstatusoutput() (in module subprocess): Legacy Shell Invocation Functions.\n(line   11)\n* getstr() (curses.window method):       Window Objects.     (line  266)\n* GetString() (msilib.Record method):    Record Objects.     (line   16)\n* getSubject() (logging.handlers.SMTPHandler method): SMTPHandler.\n(line   39)\n* GetSummaryInformation() (msilib.Database method): Database Objects.\n(line   16)\n* getswitchinterval() (in module sys):   sys -- System-specific parameters and functions.\n(line  859)\n* getSystemId() (xml.sax.xmlreader.InputSource method): InputSource Objects.\n(line   18)\n* getSystemId() (xml.sax.xmlreader.Locator method): Locator Objects.\n(line   20)\n* getsyx() (in module curses):           Functions<6>.       (line  163)\n* gettarinfo() (tarfile.TarFile method): TarFile Objects.    (line  289)\n* gettempdir() (in module tempfile):     tempfile -- Generate temporary files and directories.\n(line  318)\n* gettempdirb() (in module tempfile):    tempfile -- Generate temporary files and directories.\n(line  350)\n* gettempprefix() (in module tempfile):  tempfile -- Generate temporary files and directories.\n(line  356)\n* gettempprefixb() (in module tempfile): tempfile -- Generate temporary files and directories.\n(line  361)\n* getter (C type):                       Defining Getters and Setters.\n(line   33)\n* getTestCaseNames() (unittest.TestLoader method): Loading and running tests.\n(line  111)\n* gettext() (gettext.GNUTranslations method): The GNUTranslations class.\n(line   38)\n* gettext() (gettext.NullTranslations method): The NullTranslations class.\n(line   35)\n* gettext() (in module gettext):         GNU gettext API.    (line   32)\n* gettext() (in module locale):          Access to message catalogs.\n(line    6)\n* gettimeout() (socket.socket method):   Socket Objects.     (line  173)\n* gettrace() (in module sys):            sys -- System-specific parameters and functions.\n(line  900)\n* gettrace() (in module threading):      threading -- Thread-based parallelism.\n(line  176)\n* getturtle() (in module turtle):        Special Turtle methods.\n(line   40)\n* getType() (xml.sax.xmlreader.Attributes method): The Attributes Interface.\n(line   19)\n* getuid() (in module os):               Process Parameters. (line  333)\n* getunicodeinternedsize() (in module sys): sys -- System-specific parameters and functions.\n(line  731)\n* geturl() (http.client.HTTPResponse method): HTTPResponse Objects.\n(line   79)\n* geturl() (urllib.parse.urllib.parse.SplitResult method): Structured Parse Results.\n(line   12)\n* geturl() (urllib.response.addinfourl method): urllib response -- Response classes used by urllib.\n(line   30)\n* getuser() (in module getpass):         getpass -- Portable password input.\n(line   40)\n* getuserbase() (in module site):        Module contents<5>. (line   63)\n* getusersitepackages() (in module site): Module contents<5>.\n(line   71)\n* getvalue() (io.BytesIO method):        Buffered Streams.   (line   38)\n* getvalue() (io.StringIO method):       Text I/O<2>.        (line  264)\n* getValue() (xml.sax.xmlreader.Attributes method): The Attributes Interface.\n(line   24)\n* getValueByQName() (xml.sax.xmlreader.AttributesNS method): The AttributesNS Interface.\n(line   12)\n* getwch() (in module msvcrt):           Console I/O.        (line   20)\n* getwche() (in module msvcrt):          Console I/O.        (line   30)\n* getweakrefcount() (in module weakref): weakref -- Weak references.\n(line  156)\n* getweakrefs() (in module weakref):     weakref -- Weak references.\n(line  161)\n* getwelcome() (ftplib.FTP method):      FTP objects.        (line  121)\n* getwelcome() (nntplib.NNTP method):    Methods<3>.         (line   28)\n* getwelcome() (poplib.POP3 method):     POP3 Objects.       (line   20)\n* getwin() (in module curses):           Functions<6>.       (line  169)\n* getwindowsversion() (in module sys):   sys -- System-specific parameters and functions.\n(line  911)\n* getwriter() (in module codecs):        codecs -- Codec registry and base classes.\n(line  139)\n* getxattr() (in module os):             Linux extended attributes.\n(line   10)\n* getyx() (curses.window method):        Window Objects.     (line  277)\n* gid (tarfile.TarInfo attribute):       TarInfo Objects.    (line  113)\n* GIL:                                   Glossary.           (line  600)\n* glob() (in module glob):               glob -- Unix style pathname pattern expansion.\n(line   32)\n* glob() (msilib.Directory method):      Directory Objects.  (line   39)\n* glob() (pathlib.Path method):          Methods<2>.         (line  102)\n* Global (class in ast):                 Function and class definitions.\n(line  156)\n* global interpreter lock:               Thread State and the Global Interpreter Lock.\n(line    6)\n* global interpreter lock <1>:           Glossary.           (line  604)\n* globalenum() (in module enum):        Utilities and Decorators.\n(line   91)\n* global; name; binding:                 The global statement.\n(line    6)\n* global; namespace:                     Special read-only attributes.\n(line    6)\n* globs (doctest.DocTest attribute):     DocTest Objects.    (line   22)\n* gmtime() (in module time):             Functions<5>.       (line  139)\n* gname (tarfile.TarInfo attribute):     TarInfo Objects.    (line  129)\n* GNOME:                                 The Catalog constructor.\n(line    6)\n* GNUFORMAT (in module tarfile):        tarfile -- Read and write tar archive files.\n(line  331)\n* gnugetopt() (in module getopt):       getopt -- C-style parser for command line options.\n(line   62)\n* GNUTranslations (class in gettext):    The GNUTranslations class.\n(line   33)\n* GNUTYPELONGLINK (in module tarfile):  tarfile -- Read and write tar archive files.\n(line  315)\n* GNUTYPELONGNAME (in module tarfile):  tarfile -- Read and write tar archive files.\n(line  311)\n* GNUTYPESPARSE (in module tarfile):    tarfile -- Read and write tar archive files.\n(line  319)\n* go() (tkinter.filedialog.FileDialog method): Native Load/Save Dialogs.\n(line  114)\n* got (doctest.DocTestFailure attribute): Debugging.         (line  204)\n* goto() (in module turtle):             Turtle motion.      (line   74)\n* grammar:                               Notation.           (line    6)\n* Graphical User Interface:              Graphical User Interfaces with Tk.\n(line    6)\n* GREATER (in module token):             token -- Constants used with Python parse trees.\n(line  110)\n* GREATEREQUAL (in module token):        token -- Constants used with Python parse trees.\n(line  146)\n* Greenwich Mean Time:                   time -- Time access and conversions.\n(line   39)\n* GRNDNONBLOCK (in module os):          Random numbers<2>.  (line   76)\n* GRNDRANDOM (in module os):            Random numbers<2>.  (line   89)\n* Group (class in email.headerregistry): email headerregistry Custom Header Objects.\n(line  456)\n* group() (nntplib.NNTP method):         Methods<3>.         (line  158)\n* group() (pathlib.Path method):         Methods<2>.         (line  146)\n* group() (re.Match method):             Match Objects.      (line   36)\n* groupby() (in module itertools):       Itertool Functions. (line  319)\n* groupdict() (re.Match method):         Match Objects.      (line  136)\n* groupindex (re.Pattern attribute):     Regular Expression Objects.\n(line  118)\n* grouping:                              Indentation.        (line    6)\n* groups (email.headerregistry.AddressHeader attribute): email headerregistry Custom Header Objects.\n(line  188)\n* groups (re.Pattern attribute):         Regular Expression Objects.\n(line  114)\n* groups() (re.Match method):            Match Objects.      (line  113)\n* GS (in module curses.ascii):           curses ascii -- Utilities for ASCII characters.\n(line  112)\n* Gt (class in ast):                     Expressions<2>.     (line  109)\n* gt() (in module operator):             operator -- Standard operators as functions.\n(line   24)\n* GtE (class in ast):                    Expressions<2>.     (line  109)\n* guard:                                 Guards.             (line    6)\n* guessallextensions() (in module mimetypes): mimetypes -- Map filenames to MIME types.\n(line   51)\n* guessallextensions() (mimetypes.MimeTypes method): MimeTypes Objects.\n(line   65)\n* guessextension() (in module mimetypes): mimetypes -- Map filenames to MIME types.\n(line   63)\n* guessextension() (mimetypes.MimeTypes method): MimeTypes Objects.\n(line   55)\n* guessscheme() (in module wsgiref.util): wsgiref util - WSGI environment utilities.\n(line   14)\n* guesstype() (in module mimetypes):    mimetypes -- Map filenames to MIME types.\n(line   24)\n* guesstype() (mimetypes.MimeTypes method): MimeTypes Objects.\n(line   60)\n* GUI:                                   Graphical User Interfaces with Tk.\n(line    6)\n* gzip command line option; -best:       Command line options.\n(line   14)\n* gzip command line option; -d:          Command line options.\n(line   18)\n* gzip command line option; -decompress: Command line options.\n(line   18)\n* gzip command line option; -fast:       Command line options.\n(line   10)\n* gzip command line option; -h:          Command line options.\n(line   22)\n* gzip command line option; -help:       Command line options.\n(line   22)\n* gzip command line option; file:        Command line options.\n(line    6)\n* GzipFile (class in gzip):              gzip -- Support for gzip files.\n(line   71)\n* halfdelay() (in module curses):        Functions<6>.       (line  211)\n* Handle (class in asyncio):             Callback Handles.   (line    6)\n* handle an exception:                   Exceptions<2>.      (line    6)\n* handlecharref() (html.parser.HTMLParser method): HTMLParser Methods.\n(line   92)\n* handlecomment() (html.parser.HTMLParser method): HTMLParser Methods.\n(line  101)\n* handledata() (html.parser.HTMLParser method): HTMLParser Methods.\n(line   80)\n* handledecl() (html.parser.HTMLParser method): HTMLParser Methods.\n(line  114)\n* handledefect() (email.policy.Policy method): email policy Policy Objects.\n(line  234)\n* handleendtag() (html.parser.HTMLParser method): HTMLParser Methods.\n(line   64)\n* handleentityref() (html.parser.HTMLParser method): HTMLParser Methods.\n(line   85)\n* handleerror() (socketserver.BaseServer method): Server Objects<2>.\n(line  137)\n* handleexpect100() (http.server.BaseHTTPRequestHandler method): http server -- HTTP servers.\n(line  206)\n* handleonerequest() (http.server.BaseHTTPRequestHandler method): http server -- HTTP servers.\n(line  200)\n* handlepi() (html.parser.HTMLParser method): HTMLParser Methods.\n(line  122)\n* handlerequest() (socketserver.BaseServer method): Server Objects<2>.\n(line   21)\n* handlerequest() (xmlrpc.server.CGIXMLRPCRequestHandler method): CGIXMLRPCRequestHandler.\n(line   50)\n* handlestartendtag() (html.parser.HTMLParser method): HTMLParser Methods.\n(line   71)\n* handlestarttag() (html.parser.HTMLParser method): HTMLParser Methods.\n(line   45)\n* handletimeout() (socketserver.BaseServer method): Server Objects<2>.\n(line  147)\n* handle() (http.server.BaseHTTPRequestHandler method): http server -- HTTP servers.\n(line  193)\n* handle() (logging.Handler method):     Handler Objects.    (line   81)\n* handle() (logging.handlers.QueueListener method): QueueListener.\n(line   67)\n* handle() (logging.Logger method):      Logger Objects.     (line  364)\n* handle() (logging.NullHandler method): NullHandler.        (line   20)\n* handle() (socketserver.BaseRequestHandler method): Request Handler Objects.\n(line   20)\n* handle() (wsgiref.simpleserver.WSGIRequestHandler method): wsgiref simpleserver - a simple WSGI HTTP server.\n(line  103)\n* handleError() (logging.Handler method): Handler Objects.   (line   88)\n* handleError() (logging.handlers.SocketHandler method): SocketHandler.\n(line   33)\n* Handler (class in logging):            Handler Objects.    (line   11)\n* handler() (in module cgitb):           cgitb -- Traceback manager for CGI scripts.\n(line   69)\n* Handlers (class in signal):            Module contents<2>. (line   24)\n* handlers (logging.Logger attribute):   Logger Objects.     (line   86)\n* hardlinkto() (pathlib.Path method):   Methods<2>.         (line  604)\n* harmonicmean() (in module statistics): Function details.  (line   97)\n* HASALPN (in module ssl):              Constants<9>.       (line  381)\n* haschildren() (symtable.SymbolTable method): Examining Symbol Tables.\n(line   51)\n* hascolors() (in module curses):       Functions<6>.       (line  176)\n* hasdualstackipv6() (in module socket): Creating sockets. (line  151)\n* HASECDH (in module ssl):              Constants<9>.       (line  397)\n* hasextendedcolorsupport() (in module curses): Functions<6>.\n(line  181)\n* hasextn() (smtplib.SMTP method):      SMTP Objects.       (line   85)\n* hasheader() (csv.Sniffer method):     Module Contents<3>. (line  236)\n* hasheader() (urllib.request.Request method): Request Objects.\n(line   95)\n* hasic() (in module curses):           Functions<6>.       (line  192)\n* hasil() (in module curses):           Functions<6>.       (line  199)\n* hasipv6 (in module socket):           Constants<8>.       (line  285)\n* haskey (2to3 fixer):                  Fixers.             (line  119)\n* haskey() (in module curses):          Functions<6>.       (line  206)\n* haslocation (importlib.machinery.ModuleSpec attribute): importlib machinery - Importers and path hooks.\n(line  438)\n* HASNEVERCHECKCOMMONNAME (in module ssl): Constants<9>. (line  389)\n* hasnonstandardattr() (http.cookiejar.Cookie method): Cookie Objects<2>.\n(line   98)\n* HASNPN (in module ssl):               Constants<9>.       (line  412)\n* hasoption() (configparser.ConfigParser method): ConfigParser Objects.\n(line  108)\n* hasoption() (optparse.OptionParser method): Querying and manipulating your option parser.\n(line   42)\n* hassection() (configparser.ConfigParser method): ConfigParser Objects.\n(line   99)\n* HASSNI (in module ssl):               Constants<9>.       (line  405)\n* HASSSLv2 (in module ssl):             Constants<9>.       (line  422)\n* HASSSLv3 (in module ssl):             Constants<9>.       (line  429)\n* hasticket (ssl.SSLSession attribute): SSL session.        (line   20)\n* HASTLSv1 (in module ssl):             Constants<9>.       (line  436)\n* HASTLSv11 (in module ssl):           Constants<9>.       (line  443)\n* HASTLSv12 (in module ssl):           Constants<9>.       (line  450)\n* HASTLSv13 (in module ssl):           Constants<9>.       (line  457)\n* hasarg (in module dis):                Opcode collections. (line   25)\n* hasAttribute() (xml.dom.Element method): Element Objects<2>.\n(line   22)\n* hasAttributeNS() (xml.dom.Element method): Element Objects<2>.\n(line   26)\n* hasAttributes() (xml.dom.Node method): Node Objects.       (line   94)\n* hasChildNodes() (xml.dom.Node method): Node Objects.       (line   98)\n* hascompare (in module dis):            Opcode collections. (line   59)\n* hasconst (in module dis):              Opcode collections. (line   31)\n* hasexc (in module dis):                Opcode collections. (line   63)\n* hasFeature() (xml.dom.DOMImplementation method): DOMImplementation Objects.\n(line   11)\n* hasfree (in module dis):               Opcode collections. (line   35)\n* hash character:                        Comments.           (line    6)\n* hashbits (sys.hashinfo attribute):   sys -- System-specific parameters and functions.\n(line 1019)\n* hashinfo (in module sys):             sys -- System-specific parameters and functions.\n(line  988)\n* hashrandomization (sys.flags attribute): sys -- System-specific parameters and functions.\n(line  553)\n* hash-based pyc:                        Glossary.           (line  627)\n* hash.blocksize (in module hashlib):   Hash Objects.       (line   13)\n* hash.digestsize (in module hashlib):  Hash Objects.       (line    9)\n* hashable:                              Dictionary displays.\n(line   37)\n* hashable <1>:                          Glossary.           (line  633)\n* Hashable (class in collections.abc):   Collections Abstract Base Classes - Detailed Descriptions.\n(line   11)\n* Hashable (class in typing):            Aliases to other ABCs in collections abc.\n(line   75)\n* hasHandlers() (logging.Logger method): Logger Objects.     (line  379)\n* hashfunc (C type):                     Slot Type typedefs. (line   79)\n* hasjabs (in module dis):               Opcode collections. (line   51)\n* hasjrel (in module dis):               Opcode collections. (line   47)\n* haslocal (in module dis):              Opcode collections. (line   55)\n* hasname (in module dis):               Opcode collections. (line   43)\n* HAVEARGUMENT (opcode):                Python Bytecode Instructions.\n(line 1140)\n* HAVECONTEXTVAR (in module decimal):   Constants<4>.       (line   32)\n* HAVEDOCSTRINGS (in module test.support): test support -- Utilities for the Python test suite.\n(line  163)\n* HAVETHREADS (in module decimal):      Constants<4>.       (line   25)\n* HCIDATADIR (in module socket):       Constants<8>.       (line  298)\n* HCIFILTER (in module socket):         Constants<8>.       (line  298)\n* HCITIMESTAMP (in module socket):     Constants<8>.       (line  298)\n* head() (nntplib.NNTP method):          Methods<3>.         (line  266)\n* Header (class in email.header):        email header Internationalized headers.\n(line   60)\n* headerencodelines() (email.charset.Charset method): email charset Representing character sets.\n(line  125)\n* headerencode() (email.charset.Charset method): email charset Representing character sets.\n(line  118)\n* headerencoding (email.charset.Charset attribute): email charset Representing character sets.\n(line   59)\n* headerfactory (email.policy.EmailPolicy attribute): email policy Policy Objects.\n(line  407)\n* headerfetchparse() (email.policy.Compat32 method): email policy Policy Objects.\n(line  593)\n* headerfetchparse() (email.policy.EmailPolicy method): email policy Policy Objects.\n(line  457)\n* headerfetchparse() (email.policy.Policy method): email policy Policy Objects.\n(line  318)\n* headeritems() (urllib.request.Request method): Request Objects.\n(line  126)\n* headermaxcount() (email.policy.EmailPolicy method): email policy Policy Objects.\n(line  434)\n* headermaxcount() (email.policy.Policy method): email policy Policy Objects.\n(line  259)\n* headeroffset (zipfile.ZipInfo attribute): ZipInfo Objects.\n(line  132)\n* headersourceparse() (email.policy.Compat32 method): email policy Policy Objects.\n(line  581)\n* headersourceparse() (email.policy.EmailPolicy method): email policy Policy Objects.\n(line  440)\n* headersourceparse() (email.policy.Policy method): email policy Policy Objects.\n(line  281)\n* headerstoreparse() (email.policy.Compat32 method): email policy Policy Objects.\n(line  589)\n* headerstoreparse() (email.policy.EmailPolicy method): email policy Policy Objects.\n(line  448)\n* headerstoreparse() (email.policy.Policy method): email policy Policy Objects.\n(line  302)\n* HeaderDefect:                          email errors Exception and Defect classes.\n(line   67)\n* HeaderError:                           tarfile -- Read and write tar archive files.\n(line  225)\n* HeaderParseError:                      email errors Exception and Defect classes.\n(line   26)\n* HeaderParser (class in email.parser):  Parser API.         (line  107)\n* HeaderRegistry (class in email.headerregistry): email headerregistry Custom Header Objects.\n(line  299)\n* Headers (class in wsgiref.headers):    wsgiref headers - WSGI response header tools.\n(line    9)\n* headers (http.client.HTTPResponse attribute): HTTPResponse Objects.\n(line   56)\n* headers (http.server.BaseHTTPRequestHandler attribute): http server -- HTTP servers.\n(line  110)\n* headers (urllib.error.HTTPError attribute): urllib error -- Exception classes raised by urllib request.\n(line   54)\n* headers (urllib.response.addinfourl attribute): urllib response -- Response classes used by urllib.\n(line   19)\n* headers (xmlrpc.client.ProtocolError attribute): ProtocolError Objects.\n(line   25)\n* HeaderWriteError:                      email errors Exception and Defect classes.\n(line   57)\n* heading() (in module turtle):          Tell Turtle's state.\n(line   58)\n* heading() (tkinter.ttk.Treeview method): ttk Treeview.     (line   99)\n* heapify() (in module heapq):           heapq -- Heap queue algorithm.\n(line   56)\n* heapmin() (in module msvcrt):          Other Functions.    (line    6)\n* heappop() (in module heapq):           heapq -- Heap queue algorithm.\n(line   42)\n* heappush() (in module heapq):          heapq -- Heap queue algorithm.\n(line   37)\n* heappushpop() (in module heapq):       heapq -- Heap queue algorithm.\n(line   49)\n* heapreplace() (in module heapq):       heapq -- Heap queue algorithm.\n(line   60)\n* helo() (smtplib.SMTP method):          SMTP Objects.       (line   47)\n* help (optparse.Option attribute):      Option attributes.  (line   80)\n* help (pdb command):                    Debugger Commands.  (line   70)\n* help; online:                          pydoc -- Documentation generator and online help system.\n(line    8)\n* help() (nntplib.NNTP method):          Methods<3>.         (line  214)\n* herror:                                Exceptions<13>.     (line   13)\n* hex (uuid.UUID attribute):             uuid -- UUID objects according to RFC 4122.\n(line  128)\n* hex() (bytearray method):              Bytearray Objects.  (line   52)\n* hex() (bytes method):                  Bytes Objects.      (line   78)\n* hex() (float method):                  Additional Methods on Float.\n(line   33)\n* hex() (memoryview method):             Memory Views.       (line  188)\n* hexadecimal literal:                   Numeric literals.   (line    6)\n* hexadecimal; literals:                 Numeric Types -- int float complex.\n(line   19)\n* hexdigest() (hashlib.hash method):     Hash Objects.       (line   44)\n* hexdigest() (hashlib.shake method):    SHAKE variable length digests.\n(line   21)\n* hexdigest() (hmac.HMAC method):        hmac -- Keyed-Hashing for Message Authentication.\n(line   68)\n* hexdigits (in module string):          String constants.   (line   28)\n* hexlify() (in module binascii):        binascii -- Convert between binary and ASCII.\n(line  114)\n* hexversion (in module sys):            sys -- System-specific parameters and functions.\n(line 1032)\n* hidden() (curses.panel.Panel method):  Panel Objects.      (line   25)\n* hidecookie2 (http.cookiejar.CookiePolicy attribute): CookiePolicy Objects.\n(line   76)\n* hide() (curses.panel.Panel method):    Panel Objects.      (line   30)\n* hide() (tkinter.ttk.Notebook method):  ttk Notebook.       (line   23)\n* hideturtle() (in module turtle):       Visibility.         (line    6)\n* HierarchyRequestErr:                   Exceptions<18>.     (line   29)\n* HIGHPRIORITYCLASS (in module subprocess): Windows Constants.\n(line   66)\n* HIGHESTPROTOCOL (in module pickle):   Module Interface.   (line   14)\n* hits (bdb.Breakpoint attribute):       bdb -- Debugger framework.\n(line  124)\n* HKEYCLASSESROOT (in module winreg):  HKEY* Constants.   (line    6)\n* HKEYCURRENTCONFIG (in module winreg): HKEY* Constants.  (line   38)\n* HKEYCURRENTUSER (in module winreg):  HKEY* Constants.   (line   12)\n* HKEYDYNDATA (in module winreg):      HKEY* Constants.   (line   43)\n* HKEYLOCALMACHINE (in module winreg): HKEY* Constants.   (line   19)\n* HKEYPERFORMANCEDATA (in module winreg): HKEY* Constants.\n(line   31)\n* HKEYUSERS (in module winreg):         HKEY* Constants.   (line   25)\n* hline() (curses.window method):        Window Objects.     (line  282)\n* HList (class in tkinter.tix):          Hierarchical ListBox.\n(line    6)\n* hlstorgb() (in module colorsys):     colorsys -- Conversions between color systems.\n(line   40)\n* HOME:                                  os path<4>.         (line   15)\n* HOME <1>:                              Changes in the Python API<4>.\n(line  117)\n* HOME <2>:                              Windows<35>.        (line   15)\n* HOME <3>:                              Windows<35>.        (line   18)\n* HOME <4>:                              os path -- Common pathname manipulations.\n(line  135)\n* HOME <5>:                              os path -- Common pathname manipulations.\n(line  152)\n* HOME <6>:                              Tkinter Modules.    (line   66)\n* home() (in module turtle):             Turtle motion.      (line  195)\n* home() (pathlib.Path class method):    Methods<2>.         (line   25)\n* HOMEDRIVE:                             os path -- Common pathname manipulations.\n(line  142)\n* HOMEPATH:                              os path -- Common pathname manipulations.\n(line  142)\n* hookcompressed() (in module fileinput): fileinput -- Iterate over lines from multiple input streams.\n(line  196)\n* hookencoded() (in module fileinput):  fileinput -- Iterate over lines from multiple input streams.\n(line  216)\n* hooks; import:                         Import hooks.       (line    6)\n* hooks; meta:                           Import hooks.       (line    6)\n* hooks; path:                           Import hooks.       (line    6)\n* host (urllib.request.Request attribute): Request Objects.  (line   25)\n* hostmask (ipaddress.IPv4Network attribute): Network objects.\n(line   97)\n* hostmask (ipaddress.IPv6Network attribute): Network objects.\n(line  313)\n* hostnamecheckscommonname (ssl.SSLContext attribute): SSL Contexts.\n(line  603)\n* hosts (netrc.netrc attribute):         netrc Objects.      (line   23)\n* hosts() (ipaddress.IPv4Network method): Network objects.   (line  136)\n* hosts() (ipaddress.IPv6Network method): Network objects.   (line  331)\n* hour (datetime.datetime attribute):    datetime Objects.   (line  298)\n* hour (datetime.time attribute):        time Objects.       (line   50)\n* HRESULT (class in ctypes):             Fundamental data types<2>.\n(line  213)\n* hStdError (subprocess.STARTUPINFO attribute): Windows Popen Helpers.\n(line   42)\n* hStdInput (subprocess.STARTUPINFO attribute): Windows Popen Helpers.\n(line   27)\n* hStdOutput (subprocess.STARTUPINFO attribute): Windows Popen Helpers.\n(line   35)\n* hsvtorgb() (in module colorsys):     colorsys -- Conversions between color systems.\n(line   48)\n* HT (in module curses.ascii):           curses ascii -- Utilities for ASCII characters.\n(line   49)\n* ht() (in module turtle):               Visibility.         (line    6)\n* HTML:                                  html parser -- Simple HTML and XHTML parser.\n(line    8)\n* HTML <1>:                              urllib request Restrictions.\n(line   29)\n* html() (in module cgitb):              cgitb -- Traceback manager for CGI scripts.\n(line   60)\n* html5 (in module html.entities):       html entities -- Definitions of HTML general entities.\n(line   14)\n* HTMLCalendar (class in calendar):      calendar -- General calendar-related functions.\n(line  163)\n* HtmlDiff (class in difflib):           difflib -- Helpers for computing deltas.\n(line   82)\n* HTMLParser (class in html.parser):     html parser -- Simple HTML and XHTML parser.\n(line   14)\n* htonl() (in module socket):            Other functions<2>. (line  214)\n* htons() (in module socket):            Other functions<2>. (line  221)\n* HTTP (in module email.policy):         email policy Policy Objects.\n(line  524)\n* httperror301() (urllib.request.HTTPRedirectHandler method): HTTPRedirectHandler Objects.\n(line   35)\n* httperror302() (urllib.request.HTTPRedirectHandler method): HTTPRedirectHandler Objects.\n(line   42)\n* httperror303() (urllib.request.HTTPRedirectHandler method): HTTPRedirectHandler Objects.\n(line   48)\n* httperror307() (urllib.request.HTTPRedirectHandler method): HTTPRedirectHandler Objects.\n(line   54)\n* httperror308() (urllib.request.HTTPRedirectHandler method): HTTPRedirectHandler Objects.\n(line   61)\n* httperror401() (urllib.request.HTTPBasicAuthHandler method): HTTPBasicAuthHandler Objects.\n(line    6)\n* httperror401() (urllib.request.HTTPDigestAuthHandler method): HTTPDigestAuthHandler Objects.\n(line    6)\n* httperror407() (urllib.request.ProxyBasicAuthHandler method): ProxyBasicAuthHandler Objects.\n(line    6)\n* httperror407() (urllib.request.ProxyDigestAuthHandler method): ProxyDigestAuthHandler Objects.\n(line    6)\n* httperrorauthreqed() (urllib.request.AbstractBasicAuthHandler method): AbstractBasicAuthHandler Objects.\n(line    6)\n* httperrorauthreqed() (urllib.request.AbstractDigestAuthHandler method): AbstractDigestAuthHandler Objects.\n(line    6)\n* httperrordefault() (urllib.request.BaseHandler method): BaseHandler Objects.\n(line   66)\n* httpopen() (urllib.request.HTTPHandler method): HTTPHandler Objects.\n(line    6)\n* HTTPPORT (in module http.client):     http client -- HTTP protocol client.\n(line  201)\n* httpresponse() (urllib.request.HTTPErrorProcessor method): HTTPErrorProcessor Objects.\n(line    6)\n* httpversion (wsgiref.handlers.BaseHandler attribute): wsgiref handlers - server/gateway base classes.\n(line  304)\n* HTTP; http (standard module):          http -- HTTP modules.\n(line    8)\n* HTTP; http.client (standard module):   http client -- HTTP protocol client.\n(line    8)\n* HTTP; protocol:                        urllib request Restrictions.\n(line    6)\n* HTTP; protocol <1>:                    urllib request Restrictions.\n(line   29)\n* HTTP; protocol <2>:                    http -- HTTP modules.\n(line    8)\n* HTTP; protocol <3>:                    http client -- HTTP protocol client.\n(line    8)\n* HTTP; protocol <4>:                    http server -- HTTP servers.\n(line    8)\n* HTTP; protocol <5>:                    cgi -- Common Gateway Interface support.\n(line    8)\n* http.server; security:                 Security Considerations<3>.\n(line    6)\n* HTTPBasicAuthHandler (class in urllib.request): urllib request -- Extensible library for opening URLs.\n(line  365)\n* HTTPConnection (class in http.client): http client -- HTTP protocol client.\n(line   32)\n* HTTPCookieProcessor (class in urllib.request): urllib request -- Extensible library for opening URLs.\n(line  296)\n* httpd:                                 http server -- HTTP servers.\n(line    8)\n* HTTPDefaultErrorHandler (class in urllib.request): urllib request -- Extensible library for opening URLs.\n(line  287)\n* HTTPDigestAuthHandler (class in urllib.request): urllib request -- Extensible library for opening URLs.\n(line  389)\n* HTTPError:                             urllib error -- Exception classes raised by urllib request.\n(line   30)\n* HTTPErrorProcessor (class in urllib.request): urllib request -- Extensible library for opening URLs.\n(line  449)\n* HTTPException:                         http client -- HTTP protocol client.\n(line  132)\n* HTTPHandler (class in logging.handlers): HTTPHandler.      (line   10)\n* HTTPHandler (class in urllib.request): urllib request -- Extensible library for opening URLs.\n(line  413)\n* HTTPMessage (class in http.client):    HTTPMessage Objects.\n(line    6)\n* HTTPMethod (class in http):            HTTP status category.\n(line   38)\n* httponly (http.cookies.Morsel attribute): Morsel Objects.  (line   13)\n* HTTPPasswordMgr (class in urllib.request): urllib request -- Extensible library for opening URLs.\n(line  322)\n* HTTPPasswordMgrWithDefaultRealm (class in urllib.request): urllib request -- Extensible library for opening URLs.\n(line  326)\n* HTTPPasswordMgrWithPriorAuth (class in urllib.request): urllib request -- Extensible library for opening URLs.\n(line  332)\n* HTTPRedirectHandler (class in urllib.request): urllib request -- Extensible library for opening URLs.\n(line  292)\n* HTTPResponse (class in http.client):   http client -- HTTP protocol client.\n(line  100)\n* httpsopen() (urllib.request.HTTPSHandler method): HTTPSHandler Objects.\n(line    6)\n* HTTPSPORT (in module http.client):    http client -- HTTP protocol client.\n(line  205)\n* httpsresponse() (urllib.request.HTTPErrorProcessor method): HTTPErrorProcessor Objects.\n(line   18)\n* HTTPSConnection (class in http.client): http client -- HTTP protocol client.\n(line   63)\n* HTTPServer (class in http.server):     http server -- HTTP servers.\n(line   31)\n* HTTPSHandler (class in urllib.request): urllib request -- Extensible library for opening URLs.\n(line  417)\n* HTTPStatus (class in http):            http -- HTTP modules.\n(line   27)\n* HVGUIDBROADCAST (in module socket):  Constants<8>.       (line  337)\n* HVGUIDCHILDREN (in module socket):   Constants<8>.       (line  337)\n* HVGUIDLOOPBACK (in module socket):   Constants<8>.       (line  337)\n* HVGUIDPARENT (in module socket):     Constants<8>.       (line  337)\n* HVGUIDWILDCARD (in module socket):   Constants<8>.       (line  337)\n* HVGUIDZERO (in module socket):       Constants<8>.       (line  337)\n* HVPROTOCOLRAW (in module socket):    Constants<8>.       (line  337)\n* HVSOCKETADDRESSFLAGPASSTHRU (in module socket): Constants<8>.\n(line  337)\n* HVSOCKETCONNECTTIMEOUT (in module socket): Constants<8>. (line  337)\n* HVSOCKETCONNECTTIMEOUTMAX (in module socket): Constants<8>.\n(line  337)\n* HVSOCKETCONNECTEDSUSPEND (in module socket): Constants<8>.\n(line  337)\n* hypot() (in module math):              Trigonometric functions.\n(line   47)\n* I (in module re):                      Flags.              (line   38)\n* I/O control; buffering:                Built-in Functions. (line 1326)\n* I/O control; buffering <1>:            Socket Objects.     (line  212)\n* iadd() (in module operator):           In-place Operators. (line   36)\n* iand() (in module operator):           In-place Operators. (line   41)\n* iconcat() (in module operator):        In-place Operators. (line   46)\n* id (ssl.SSLSession attribute):         SSL session.        (line   12)\n* id() (unittest.TestCase method):       Test cases.         (line  751)\n* idcok() (curses.window method):        Window Objects.     (line  289)\n* ident (select.kevent attribute):       Kevent Objects.     (line    8)\n* ident (threading.Thread attribute):    Thread Objects.     (line  167)\n* identchars (cmd.Cmd attribute):        Cmd Objects.        (line  135)\n* identifier:                            Identifiers and keywords.\n(line    6)\n* identifier <1>:                        Identifiers Names.  (line    6)\n* identifycolumn() (tkinter.ttk.Treeview method): ttk Treeview.\n(line  143)\n* identifyelement() (tkinter.ttk.Treeview method): ttk Treeview.\n(line  172)\n* identifyregion() (tkinter.ttk.Treeview method): ttk Treeview.\n(line  150)\n* identifyrow() (tkinter.ttk.Treeview method): ttk Treeview.\n(line  139)\n* identify() (tkinter.ttk.Notebook method): ttk Notebook.    (line   32)\n* identify() (tkinter.ttk.Treeview method): ttk Treeview.    (line  133)\n* identify() (tkinter.ttk.Widget method): ttk Widget.        (line   11)\n* identity of an object:                 Objects values and types.\n(line   11)\n* identity; test:                        Membership test operations.\n(line   39)\n* idioms (2to3 fixer):                   Fixers.             (line  123)\n* IDLE:                                  IDLE<57>.           (line    8)\n* IDLE <1>:                              Glossary.           (line  653)\n* IDLEPRIORITYCLASS (in module subprocess): Windows Constants.\n(line   73)\n* IDLESTARTUP:                           IDLE<30>.           (line  176)\n* IDLESTARTUP <1>:                       IDLE<34>.           (line    9)\n* IDLESTARTUP <2>:                       IDLE<40>.           (line    9)\n* IDLESTARTUP <3>:                       Startup and Code Execution.\n(line    7)\n* idlok() (curses.window method):        Window Objects.     (line  297)\n* If (class in ast):                     Control flow.       (line    9)\n* ifindextoname() (in module socket):   Other functions<2>. (line  416)\n* ifnameindex() (in module socket):     Other functions<2>. (line  373)\n* ifnametoindex() (in module socket):   Other functions<2>. (line  398)\n* if; conditional expression:            Conditional expressions.\n(line    6)\n* if; in comprehensions:                 Displays for lists sets and dictionaries.\n(line   14)\n* IfExp (class in ast):                  Expressions<2>.     (line  158)\n* ifloordiv() (in module operator):      In-place Operators. (line   52)\n* iglob() (in module glob):              glob -- Unix style pathname pattern expansion.\n(line   78)\n* ignorableWhitespace() (xml.sax.handler.ContentHandler method): ContentHandler Objects.\n(line  150)\n* ignore (bdb.Breakpoint attribute):     bdb -- Debugger framework.\n(line  120)\n* IGNORE (in module tkinter.messagebox): tkinter messagebox -- Tkinter message prompts.\n(line  151)\n* ignore (pdb command):                  Debugger Commands.  (line  134)\n* ignoreenvironment (sys.flags attribute): sys -- System-specific parameters and functions.\n(line  541)\n* ignoreerrors() (in module codecs):    Error Handlers.     (line  147)\n* IGNOREEXCEPTIONDETAIL (in module doctest): Option Flags. (line   58)\n* ignorepatterns() (in module shutil):  Directory and files operations.\n(line  185)\n* ignorewarnings() (in module test.support.warningshelper): test support warningshelper -- Utilities for warnings tests.\n(line   11)\n* ignore; error handler's name:          Error Handlers.     (line   15)\n* IGNORECASE (in module re):             Flags.              (line   38)\n* ihave() (nntplib.NNTP method):         Methods<3>.         (line  291)\n* IISCGIHandler (class in wsgiref.handlers): wsgiref handlers - server/gateway base classes.\n(line   24)\n* IllegalMonthError:                     calendar -- General calendar-related functions.\n(line  442)\n* IllegalWeekdayError:                   calendar -- General calendar-related functions.\n(line  451)\n* ilshift() (in module operator):        In-place Operators. (line   57)\n* imag (numbers.Complex attribute):      The numeric tower.  (line   19)\n* imag (sys.hashinfo attribute):        sys -- System-specific parameters and functions.\n(line 1010)\n* imaginary literal:                     Numeric literals.   (line    6)\n* imapunordered() (multiprocessing.pool.Pool method): Process Pools.\n(line  141)\n* imap() (multiprocessing.pool.Pool method): Process Pools.  (line  126)\n* IMAP4 (class in imaplib):              imaplib -- IMAP4 protocol client.\n(line   26)\n* IMAP4SSL (class in imaplib):          imaplib -- IMAP4 protocol client.\n(line   75)\n* IMAP4SSL; protocol:                   imaplib -- IMAP4 protocol client.\n(line    8)\n* IMAP4stream (class in imaplib):       imaplib -- IMAP4 protocol client.\n(line  105)\n* IMAP4stream; protocol:                imaplib -- IMAP4 protocol client.\n(line    8)\n* IMAP4; protocol:                       imaplib -- IMAP4 protocol client.\n(line    8)\n* IMAP4.abort:                           imaplib -- IMAP4 protocol client.\n(line   59)\n* IMAP4.error:                           imaplib -- IMAP4 protocol client.\n(line   54)\n* IMAP4.readonly:                        imaplib -- IMAP4 protocol client.\n(line   66)\n* imatmul() (in module operator):        In-place Operators. (line   72)\n* immedok() (curses.window method):      Window Objects.     (line  303)\n* immutable:                             Glossary.           (line  659)\n* immutable object:                      Objects values and types.\n(line   11)\n* immutable; data; type:                 Literals<2>.        (line   17)\n* immutable; object:                     Literals<2>.        (line   17)\n* immutable; object <1>:                 Dictionary displays.\n(line   37)\n* immutable; sequence; types:            Immutable Sequence Types.\n(line    6)\n* imod() (in module operator):           In-place Operators. (line   62)\n* impldetail() (in module test.support): test support -- Utilities for the Python test suite.\n(line  527)\n* implementation (in module sys):        sys -- System-specific parameters and functions.\n(line 1055)\n* import (2to3 fixer):                   Fixers.             (line  139)\n* Import (class in ast):                 Imports.            (line    6)\n* import hooks:                          Import hooks.       (line    6)\n* import machinery:                      The import system.  (line    6)\n* import path:                           Glossary.           (line  667)\n* importfreshmodule() (in module test.support.importhelper): test support importhelper -- Utilities for import tests.\n(line   16)\n* IMPORTFROM (opcode):                  Python Bytecode Instructions.\n(line  751)\n* importmodule() (in module importlib): Functions<12>.      (line   15)\n* importmodule() (in module test.support.importhelper): test support importhelper -- Utilities for import tests.\n(line   52)\n* IMPORTNAME (opcode):                  Python Bytecode Instructions.\n(line  742)\n* importer:                              Glossary.           (line  680)\n* ImportError:                           Concrete exceptions.\n(line   45)\n* ImportFrom (class in ast):             Imports.            (line   21)\n* importing:                             Glossary.           (line  675)\n* imports (2to3 fixer):                  Fixers.             (line  143)\n* imports2 (2to3 fixer):                 Fixers.             (line  147)\n* ImportWarning:                         Warnings.           (line   57)\n* ImproperConnectionState:               http client -- HTTP protocol client.\n(line  162)\n* imul() (in module operator):           In-place Operators. (line   67)\n* In (class in ast):                     Expressions<2>.     (line  109)\n* indll() (ctypes.CData method):       Data types.         (line   63)\n* intablea1() (in module stringprep):  stringprep -- Internet String Preparation.\n(line   40)\n* intableb1() (in module stringprep):  stringprep -- Internet String Preparation.\n(line   45)\n* intablec11c12() (in module stringprep): stringprep -- Internet String Preparation.\n(line   69)\n* intablec11() (in module stringprep): stringprep -- Internet String Preparation.\n(line   60)\n* intablec12() (in module stringprep): stringprep -- Internet String Preparation.\n(line   64)\n* intablec21c22() (in module stringprep): stringprep -- Internet String Preparation.\n(line   84)\n* intablec21() (in module stringprep): stringprep -- Internet String Preparation.\n(line   74)\n* intablec22() (in module stringprep): stringprep -- Internet String Preparation.\n(line   79)\n* intablec3() (in module stringprep):  stringprep -- Internet String Preparation.\n(line   89)\n* intablec4() (in module stringprep):  stringprep -- Internet String Preparation.\n(line   93)\n* intablec5() (in module stringprep):  stringprep -- Internet String Preparation.\n(line   98)\n* intablec6() (in module stringprep):  stringprep -- Internet String Preparation.\n(line  102)\n* intablec7() (in module stringprep):  stringprep -- Internet String Preparation.\n(line  107)\n* intablec8() (in module stringprep):  stringprep -- Internet String Preparation.\n(line  112)\n* intablec9() (in module stringprep):  stringprep -- Internet String Preparation.\n(line  117)\n* intabled1() (in module stringprep):  stringprep -- Internet String Preparation.\n(line  121)\n* intabled2() (in module stringprep):  stringprep -- Internet String Preparation.\n(line  126)\n* intransaction (sqlite3.Connection attribute): Connection objects.\n(line  737)\n* inch() (curses.window method):         Window Objects.     (line  311)\n* inclusive (tracemalloc.DomainFilter attribute): DomainFilter.\n(line   12)\n* inclusive (tracemalloc.Filter attribute): Filter.          (line   39)\n* inclusive; or:                         Binary bitwise operations.\n(line   20)\n* Incomplete:                            binascii -- Convert between binary and ASCII.\n(line  161)\n* IncompleteRead:                        http client -- HTTP protocol client.\n(line  158)\n* IncompleteReadError:                   Exceptions<11>.     (line   44)\n* incritem():                           Exceptions<21>.     (line   78)\n* incritem() <1>:                       Exceptions<21>.     (line  123)\n* incrementlineno() (in module ast):    ast Helpers.        (line  149)\n* IncrementalDecoder (class in codecs):  IncrementalDecoder Objects.\n(line   11)\n* incrementaldecoder (codecs.CodecInfo attribute): codecs -- Codec registry and base classes.\n(line   78)\n* IncrementalEncoder (class in codecs):  IncrementalEncoder Objects.\n(line   11)\n* incrementalencoder (codecs.CodecInfo attribute): codecs -- Codec registry and base classes.\n(line   78)\n* IncrementalNewlineDecoder (class in io): Text I/O<2>.      (line  286)\n* IncrementalParser (class in xml.sax.xmlreader): xml sax xmlreader -- Interface for XML parsers.\n(line   20)\n* indent (doctest.Example attribute):    Example Objects.    (line   47)\n* INDENT (in module token):              token -- Constants used with Python parse trees.\n(line   50)\n* indent (reprlib.Repr attribute):       Repr Objects.       (line   54)\n* INDENT token:                          Indentation.        (line   33)\n* indent() (in module textwrap):         textwrap -- Text wrapping and filling.\n(line  102)\n* indent() (in module xml.etree.ElementTree): Functions<9>.  (line  118)\n* indentation:                           Indentation.        (line    6)\n* IndentationError:                      Concrete exceptions.\n(line  329)\n* index (inspect.FrameInfo attribute):   The interpreter stack.\n(line   37)\n* index (inspect.Traceback attribute):   The interpreter stack.\n(line   77)\n* index operation:                       Sequences.          (line    6)\n* index() (array.array method):          array -- Efficient arrays of numeric values.\n(line  190)\n* index() (bytearray method):            Bytes and Bytearray Operations.\n(line  154)\n* index() (bytes method):                Bytes and Bytearray Operations.\n(line  154)\n* index() (collections.deque method):    deque objects.      (line   70)\n* index() (in module operator):          operator -- Standard operators as functions.\n(line   93)\n* index() (multiprocessing.sharedmemory.ShareableList method): multiprocessing sharedmemory -- Shared memory for direct access across processes.\n(line  313)\n* index() (sequence method):             Common Sequence Operations.\n(line   21)\n* index() (str method):                  String Methods<2>.  (line  176)\n* index() (tkinter.ttk.Notebook method): ttk Notebook.       (line   37)\n* index() (tkinter.ttk.Treeview method): ttk Treeview.       (line  178)\n* IndexError:                            Concrete exceptions.\n(line   73)\n* indexOf() (in module operator):        operator -- Standard operators as functions.\n(line  201)\n* IndexSizeErr:                          Exceptions<18>.     (line   34)\n* indices() (slice method):              Slice objects.      (line   16)\n* INDIRECT (inspect.BufferFlags attribute): Buffer flags.    (line   31)\n* inetaton() (in module socket):        Other functions<2>. (line  231)\n* inetntoa() (in module socket):        Other functions<2>. (line  251)\n* inetntop() (in module socket):        Other functions<2>. (line  286)\n* inetpton() (in module socket):        Other functions<2>. (line  268)\n* Inexact (class in decimal):            Signals.            (line   42)\n* inf (in module cmath):                 Constants<3>.       (line   20)\n* inf (in module math):                  Constants<2>.       (line   24)\n* inf (sys.hashinfo attribute):         sys -- System-specific parameters and functions.\n(line 1002)\n* infile (shlex.shlex attribute):        shlex Objects.      (line  140)\n* Infinity:                              Built-in Functions. (line  641)\n* infj (in module cmath):                Constants<3>.       (line   26)\n* INFO (in module logging):              Logging Levels.     (line   29)\n* INFO (in module tkinter.messagebox):   tkinter messagebox -- Tkinter message prompts.\n(line  194)\n* info() (dis.Bytecode method):          Bytecode analysis.  (line   60)\n* info() (gettext.NullTranslations method): The NullTranslations class.\n(line   63)\n* info() (http.client.HTTPResponse method): HTTPResponse Objects.\n(line   84)\n* info() (in module logging):            Module-Level Functions.\n(line   62)\n* info() (logging.Logger method):        Logger Objects.     (line  287)\n* info() (urllib.response.addinfourl method): urllib response -- Response classes used by urllib.\n(line   35)\n* infolist() (zipfile.ZipFile method):   ZipFile Objects.    (line  119)\n* inheritance:                           Class definitions.  (line    6)\n* ini file:                              configparser -- Configuration file parser.\n(line    8)\n* initcolor() (in module curses):       Functions<6>.       (line  220)\n* initdatabase() (in module msilib):    msilib -- Read and write Microsoft Installer files.\n(line   62)\n* initpair() (in module curses):        Functions<6>.       (line  232)\n* init() (in module mimetypes):          mimetypes -- Map filenames to MIME types.\n(line   78)\n* inited (in module mimetypes):          mimetypes -- Map filenames to MIME types.\n(line  117)\n* initgroups() (in module os):           Process Parameters. (line  342)\n* initialindent (textwrap.TextWrapper attribute): textwrap -- Text wrapping and filling.\n(line  210)\n* initproc (C type):                     Slot Type typedefs. (line   35)\n* initscr() (in module curses):          Functions<6>.       (line  245)\n* inode() (os.DirEntry method):          Files and Directories.\n(line  950)\n* input:                                 Expression input.   (line    6)\n* input (2to3 fixer):                    Fixers.             (line  153)\n* inputcharset (email.charset.Charset attribute): email charset Representing character sets.\n(line   53)\n* inputcodec (email.charset.Charset attribute): email charset Representing character sets.\n(line   82)\n* input() (in module fileinput):         fileinput -- Iterate over lines from multiple input streams.\n(line   56)\n* InputOnly (class in tkinter.tix):      Miscellaneous Widgets.\n(line    6)\n* InputSource (class in xml.sax.xmlreader): xml sax xmlreader -- Interface for XML parsers.\n(line   51)\n* InputStream (class in wsgiref.types):  wsgiref types - WSGI types for static type checking.\n(line   24)\n* inquiry (C type):                      Supporting Cyclic Garbage Collection.\n(line  197)\n* insch() (curses.window method):        Window Objects.     (line  317)\n* insdelln() (curses.window method):     Window Objects.     (line  324)\n* inserttext() (in module readline):    Line buffer.        (line   13)\n* insert() (array.array method):         array -- Efficient arrays of numeric values.\n(line  201)\n* insert() (collections.deque method):   deque objects.      (line   78)\n* insert() (sequence method):            Mutable Sequence Types.\n(line   16)\n* insert() (tkinter.ttk.Notebook method): ttk Notebook.      (line   42)\n* insert() (tkinter.ttk.Treeview method): ttk Treeview.      (line  183)\n* insert() (xml.etree.ElementTree.Element method): Element Objects.\n(line  130)\n* insertBefore() (xml.dom.Node method):  Node Objects.       (line  121)\n* insertln() (curses.window method):     Window Objects.     (line  332)\n* insnstr() (curses.window method):      Window Objects.     (line  337)\n* insortleft() (in module bisect):      bisect -- Array bisection algorithm.\n(line   63)\n* insortright() (in module bisect):     bisect -- Array bisection algorithm.\n(line   80)\n* insort() (in module bisect):           bisect -- Array bisection algorithm.\n(line   80)\n* inspect (sys.flags attribute):         sys -- System-specific parameters and functions.\n(line  520)\n* inspect command line option; -details: Command Line Interface<3>.\n(line   13)\n* InspectLoader (class in importlib.abc): importlib abc - Abstract base classes related to import.\n(line  231)\n* insstr() (curses.window method):       Window Objects.     (line  348)\n* installopener() (in module urllib.request): urllib request -- Extensible library for opening URLs.\n(line  126)\n* installscripts() (venv.EnvBuilder method): API<2>.        (line  193)\n* install() (gettext.NullTranslations method): The NullTranslations class.\n(line   72)\n* install() (in module gettext):         Class-based API.    (line   69)\n* installHandler() (in module unittest): Signal Handling.    (line   29)\n* instance; call:                        Calls.              (line  156)\n* instate() (tkinter.ttk.Widget method): ttk Widget.         (line   18)\n* instr() (curses.window method):        Window Objects.     (line  358)\n* instream (shlex.shlex attribute):      shlex Objects.      (line  146)\n* Instruction (class in dis):            Python Bytecode Instructions.\n(line   10)\n* INSTRUCTION (monitoring event):        Events.             (line   30)\n* Instruction.arg (in module dis):       Python Bytecode Instructions.\n(line   24)\n* Instruction.argrepr (in module dis):   Python Bytecode Instructions.\n(line   32)\n* Instruction.argval (in module dis):    Python Bytecode Instructions.\n(line   28)\n* Instruction.isjumptarget (in module dis): Python Bytecode Instructions.\n(line   45)\n* Instruction.offset (in module dis):    Python Bytecode Instructions.\n(line   37)\n* Instruction.opcode (in module dis):    Python Bytecode Instructions.\n(line   14)\n* Instruction.opname (in module dis):    Python Bytecode Instructions.\n(line   20)\n* Instruction.positions (in module dis): Python Bytecode Instructions.\n(line   49)\n* Instruction.startsline (in module dis): Python Bytecode Instructions.\n(line   41)\n* int (built-in class):                  Built-in Functions. (line  870)\n* int (uuid.UUID attribute):             uuid -- UUID objects according to RFC 4122.\n(line  132)\n* intinfo (in module sys):              sys -- System-specific parameters and functions.\n(line 1098)\n* intmaxstrdigits (sys.flags attribute): sys -- System-specific parameters and functions.\n(line  566)\n* Int2AP() (in module imaplib):          imaplib -- IMAP4 protocol client.\n(line  119)\n* integer:                               Immutable sequences.\n(line   15)\n* integer literal:                       Numeric literals.   (line    6)\n* integer; literals:                     Numeric Types -- int float complex.\n(line   19)\n* integer; representation:               numbers Integral.   (line    9)\n* Integral (class in numbers):           The numeric tower.  (line   59)\n* Integrated Development Environment:    IDLE<57>.           (line    8)\n* IntegrityError:                        Exceptions<6>.      (line   65)\n* Intel/DVI ADPCM:                       audioop -- Manipulate raw audio data.\n(line   20)\n* IntEnum (class in enum):               Data Types<2>.      (line  337)\n* interact (pdb command):                Debugger Commands.  (line  342)\n* interact() (code.InteractiveConsole method): Interactive Console Objects.\n(line   10)\n* interact() (in module code):           code -- Interpreter base classes.\n(line   32)\n* interact() (telnetlib.Telnet method):  Telnet Objects.     (line  112)\n* interactive:                           Glossary.           (line  685)\n* Interactive (class in ast):            Root nodes.         (line   38)\n* interactive (sys.flags attribute):     sys -- System-specific parameters and functions.\n(line  523)\n* interactive mode:                      Complete Python programs.\n(line   19)\n* InteractiveConsole (class in code):    code -- Interpreter base classes.\n(line   25)\n* InteractiveInterpreter (class in code): code -- Interpreter base classes.\n(line   15)\n* InterfaceError:                        Exceptions<6>.      (line   37)\n* intern (2to3 fixer):                   Fixers.             (line  157)\n* intern() (in module sys):              sys -- System-specific parameters and functions.\n(line 1143)\n* internal type:                         Internal types.     (line    6)\n* internalattr (zipfile.ZipInfo attribute): ZipInfo Objects.\n(line  124)\n* Internaldate2tuple() (in module imaplib): imaplib -- IMAP4 protocol client.\n(line  113)\n* InternalError:                         Exceptions<6>.      (line   71)\n* internalSubset (xml.dom.DocumentType attribute): DocumentType Objects.\n(line   27)\n* Internet:                              Internet Protocols and Support.\n(line    6)\n* INTERNETTIMEOUT (in module test.support): test support -- Utilities for the Python test suite.\n(line   65)\n* interpolated string literal:           String literal concatenation.\n(line   24)\n* interpolation, string (%):             printf-style String Formatting.\n(line    6)\n* interpolation; bytearray (%):          printf-style Bytes Formatting.\n(line    6)\n* interpolation; bytes (%):              printf-style Bytes Formatting.\n(line    6)\n* InterpolationDepthError:               Exceptions<7>.      (line   42)\n* InterpolationError:                    Exceptions<7>.      (line   37)\n* InterpolationMissingOptionError:       Exceptions<7>.      (line   49)\n* InterpolationSyntaxError:              Exceptions<7>.      (line   54)\n* interpreted:                           Glossary.           (line  694)\n* interpreter:                           Top-level components.\n(line    6)\n* interpreter lock:                      Thread State and the Global Interpreter Lock.\n(line    6)\n* interpreter prompts:                   sys -- System-specific parameters and functions.\n(line 1421)\n* interpreter shutdown:                  Glossary.           (line  705)\n* interpreterrequiresenvironment() (in module test.support.scripthelper): test support scripthelper -- Utilities for the Python execution tests.\n(line    9)\n* interruptmain() (in module thread):  thread -- Low-level threading API.\n(line   56)\n* interrupt() (sqlite3.Connection method): Connection objects.\n(line  331)\n* InterruptedError:                      OS exceptions.      (line   73)\n* intersectionupdate() (frozenset method): Set Types -- set frozenset.\n(line  175)\n* intersection() (frozenset method):     Set Types -- set frozenset.\n(line  102)\n* IntFlag (class in enum):               Data Types<2>.      (line  501)\n* intro (cmd.Cmd attribute):             Cmd Objects.        (line  150)\n* InuseAttributeErr:                     Exceptions<18>.     (line   39)\n* invcdf() (statistics.NormalDist method): NormalDist objects.\n(line   86)\n* inv() (in module operator):            operator -- Standard operators as functions.\n(line  102)\n* InvalidAccessErr:                      Exceptions<18>.     (line   44)\n* invalidatecaches() (importlib.abc.MetaPathFinder method): importlib abc - Abstract base classes related to import.\n(line   49)\n* invalidatecaches() (importlib.abc.PathEntryFinder method): importlib abc - Abstract base classes related to import.\n(line   84)\n* invalidatecaches() (importlib.machinery.FileFinder method): importlib machinery - Importers and path hooks.\n(line  190)\n* invalidatecaches() (importlib.machinery.PathFinder class method): importlib machinery - Importers and path hooks.\n(line  139)\n* invalidatecaches() (in module importlib): Functions<12>.  (line   40)\n* invalidatecaches() (zipimport.zipimporter method): zipimporter Objects.\n(line   89)\n* InvalidCharacterErr:                   Exceptions<18>.     (line   49)\n* InvalidModificationErr:                Exceptions<18>.     (line   57)\n* InvalidOperation (class in decimal):   Signals.            (line   50)\n* InvalidStateErr:                       Exceptions<18>.     (line   61)\n* InvalidStateError:                     Exception classes.  (line   26)\n* InvalidStateError <1>:                 Exceptions<11>.     (line   30)\n* InvalidTZPathWarning:                  Exceptions and warnings.\n(line   12)\n* InvalidURL:                            http client -- HTTP protocol client.\n(line  141)\n* inversion:                             Unary arithmetic and bitwise operations.\n(line   18)\n* Invert (class in ast):                 Expressions<2>.     (line   28)\n* invert() (in module operator):         operator -- Standard operators as functions.\n(line  102)\n* invocation:                            Callable types.     (line    6)\n* IO (class in typing):                  ABCs for working with IO.\n(line    6)\n* IOREPARSETAGAPPEXECLINK (in module stat): stat -- Interpreting stat results.\n(line  418)\n* IOREPARSETAGMOUNTPOINT (in module stat): stat -- Interpreting stat results.\n(line  418)\n* IOREPARSETAGSYMLINK (in module stat): stat -- Interpreting stat results.\n(line  418)\n* IOBase (class in io):                  I/O Base Classes.   (line    6)\n* IOCTLVMSOCKETSGETLOCALCID (in module socket): Constants<8>.\n(line  266)\n* ioctl() (in module fcntl):             fcntl -- The fcntl and ioctl system calls.\n(line   75)\n* ioctl() (socket.socket method):        Socket Objects.     (line  179)\n* IOError:                               Concrete exceptions.\n(line  468)\n* ior() (in module operator):            In-place Operators. (line   79)\n* ip (ipaddress.IPv4Interface attribute): Interface objects. (line   19)\n* ip (ipaddress.IPv6Interface attribute): Interface objects. (line   74)\n* ipaddress() (in module ipaddress):    Convenience factory functions.\n(line    9)\n* ipinterface() (in module ipaddress):  Convenience factory functions.\n(line   37)\n* ipnetwork() (in module ipaddress):    Convenience factory functions.\n(line   23)\n* ipow() (in module operator):           In-place Operators. (line   84)\n* ipv4mapped (ipaddress.IPv6Address attribute): Address objects.\n(line  281)\n* IPv4Address (class in ipaddress):      Address objects.    (line   13)\n* IPv4Interface (class in ipaddress):    Interface objects.  (line    9)\n* IPv4Network (class in ipaddress):      Network objects.    (line   13)\n* IPV6ENABLED (in module test.support.sockethelper): test support sockethelper -- Utilities for socket tests.\n(line   11)\n* IPv6Address (class in ipaddress):      Address objects.    (line  202)\n* IPv6Interface (class in ipaddress):    Interface objects.  (line   64)\n* IPv6Network (class in ipaddress):      Network objects.    (line  253)\n* irrefutable case block:                Irrefutable Case Blocks.\n(line    6)\n* irshift() (in module operator):        In-place Operators. (line   89)\n* Is (class in ast):                     Expressions<2>.     (line  109)\n* is() (in module operator):            operator -- Standard operators as functions.\n(line   63)\n* isabsolute() (pathlib.PurePath method): Methods and properties.\n(line  186)\n* isactive() (asyncio.AbstractChildWatcher method): Process Watchers.\n(line   72)\n* isactive() (graphlib.TopologicalSorter method): graphlib -- Functionality to operate with graph-like structures.\n(line  110)\n* isalive() (multiprocessing.Process method): Process and exceptions.\n(line   93)\n* isalive() (threading.Thread method):  Thread Objects.     (line  193)\n* isandroid (in module test.support):   test support -- Utilities for the Python test suite.\n(line   40)\n* isannotated() (symtable.Symbol method): Examining Symbol Tables.\n(line  151)\n* isassigned() (symtable.Symbol method): Examining Symbol Tables.\n(line  162)\n* isasync (pyclbr.Function attribute):  Function Objects.   (line   41)\n* isattachment() (email.message.EmailMessage method): email message Representing an email message.\n(line  445)\n* isauthenticated() (urllib.request.HTTPPasswordMgrWithPriorAuth method): HTTPPasswordMgrWithPriorAuth Objects.\n(line   30)\n* isblockdevice() (pathlib.Path method): Methods<2>.       (line  216)\n* isblocked() (http.cookiejar.DefaultCookiePolicy method): DefaultCookiePolicy Objects.\n(line   60)\n* iscanonical() (decimal.Context method): Context objects.  (line  311)\n* iscanonical() (decimal.Decimal method): Decimal objects.  (line  278)\n* ischardevice() (pathlib.Path method): Methods<2>.        (line  225)\n* ISCHARACTERJUNK() (in module difflib): difflib -- Helpers for computing deltas.\n(line  360)\n* ischecksupported() (in module lzma): Miscellaneous<2>.   (line    6)\n* isclosed() (asyncio.loop method):     Running and stopping the loop.\n(line   39)\n* isclosing() (asyncio.BaseTransport method): Base Transport.\n(line   17)\n* isclosing() (asyncio.StreamWriter method): StreamWriter.  (line  108)\n* isdataclass() (in module dataclasses): Module contents<4>.\n(line  437)\n* isdeclaredglobal() (symtable.Symbol method): Examining Symbol Tables.\n(line  142)\n* isdir() (importlib.abc.Traversable method): importlib abc - Abstract base classes related to import.\n(line  559)\n* isdir() (importlib.resources.abc.Traversable method): importlib resources abc - Abstract base classes for resources.\n(line  103)\n* isdir() (os.DirEntry method):         Files and Directories.\n(line  961)\n* isdir() (pathlib.Path method):        Methods<2>.         (line  151)\n* isdir() (zipfile.Path method):        Path Objects.       (line   47)\n* isdir() (zipfile.ZipInfo method):     ZipInfo Objects.    (line   43)\n* isenabled() (in module faulthandler): Fault handler state.\n(line   30)\n* isexpired() (http.cookiejar.Cookie method): Cookie Objects<2>.\n(line  113)\n* isfifo() (pathlib.Path method):       Methods<2>.         (line  208)\n* isfile() (importlib.abc.Traversable method): importlib abc - Abstract base classes related to import.\n(line  563)\n* isfile() (importlib.resources.abc.Traversable method): importlib resources abc - Abstract base classes for resources.\n(line  107)\n* isfile() (os.DirEntry method):        Files and Directories.\n(line  990)\n* isfile() (pathlib.Path method):       Methods<2>.         (line  160)\n* isfile() (zipfile.Path method):       Path Objects.       (line   51)\n* isfinalized() (in module gc):         gc -- Garbage Collector interface.\n(line  185)\n* isfinalizing() (in module sys):       sys -- System-specific parameters and functions.\n(line 1158)\n* isfinite() (decimal.Context method):  Context objects.    (line  315)\n* isfinite() (decimal.Decimal method):  Decimal objects.    (line  285)\n* isfree() (symtable.Symbol method):    Examining Symbol Tables.\n(line  157)\n* isglobal (ipaddress.IPv4Address attribute): Address objects.\n(line  135)\n* isglobal (ipaddress.IPv6Address attribute): Address objects.\n(line  261)\n* isglobal() (symtable.Symbol method):  Examining Symbol Tables.\n(line  134)\n* ishopbyhop() (in module wsgiref.util): wsgiref util - WSGI environment utilities.\n(line  111)\n* isimported() (symtable.Symbol method): Examining Symbol Tables.\n(line  125)\n* isinfinite() (decimal.Context method): Context objects.   (line  319)\n* isinfinite() (decimal.Decimal method): Decimal objects.   (line  290)\n* isinteger() (float method):           Additional Methods on Float.\n(line   16)\n* isinteger() (fractions.Fraction method): fractions -- Rational numbers.\n(line  126)\n* isinteger() (int method):             Additional Methods on Integer Types.\n(line  171)\n* isjunction() (os.DirEntry method):    Files and Directories.\n(line 1025)\n* isjunction() (pathlib.Path method):   Methods<2>.         (line  169)\n* isjython (in module test.support):    test support -- Utilities for the Python test suite.\n(line   36)\n* ISLINEJUNK() (in module difflib):    difflib -- Helpers for computing deltas.\n(line  353)\n* islinetouched() (curses.window method): Window Objects.   (line  368)\n* islinklocal (ipaddress.IPv4Address attribute): Address objects.\n(line  172)\n* islinklocal (ipaddress.IPv4Network attribute): Network objects.\n(line   80)\n* islinklocal (ipaddress.IPv6Address attribute): Address objects.\n(line  269)\n* islinklocal (ipaddress.IPv6Network attribute): Network objects.\n(line  307)\n* islocal() (symtable.Symbol method):   Examining Symbol Tables.\n(line  147)\n* isloopback (ipaddress.IPv4Address attribute): Address objects.\n(line  167)\n* isloopback (ipaddress.IPv4Network attribute): Network objects.\n(line   78)\n* isloopback (ipaddress.IPv6Address attribute): Address objects.\n(line  267)\n* isloopback (ipaddress.IPv6Network attribute): Network objects.\n(line  305)\n* ismount() (pathlib.Path method):      Methods<2>.         (line  176)\n* ismulticast (ipaddress.IPv4Address attribute): Address objects.\n(line   92)\n* ismulticast (ipaddress.IPv4Network attribute): Network objects.\n(line   70)\n* ismulticast (ipaddress.IPv6Address attribute): Address objects.\n(line  257)\n* ismulticast (ipaddress.IPv6Network attribute): Network objects.\n(line  297)\n* ismultipart() (email.message.EmailMessage method): email message Representing an email message.\n(line  134)\n* ismultipart() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  145)\n* isnamespace() (symtable.Symbol method): Examining Symbol Tables.\n(line  166)\n* isnan() (decimal.Context method):     Context objects.    (line  323)\n* isnan() (decimal.Decimal method):     Decimal objects.    (line  295)\n* isnested() (symtable.SymbolTable method): Examining Symbol Tables.\n(line   47)\n* isnonlocal() (symtable.Symbol method): Examining Symbol Tables.\n(line  138)\n* isnormal() (decimal.Context method):  Context objects.    (line  328)\n* isnormal() (decimal.Decimal method):  Decimal objects.    (line  300)\n* isnormalized() (in module unicodedata): unicodedata -- Unicode Database.\n(line  117)\n* isnotallowed() (http.cookiejar.DefaultCookiePolicy method): DefaultCookiePolicy Objects.\n(line   74)\n* isnot() (in module operator):         operator -- Standard operators as functions.\n(line   67)\n* ISOP (opcode):                        Python Bytecode Instructions.\n(line  730)\n* isoptimized() (symtable.SymbolTable method): Examining Symbol Tables.\n(line   43)\n* ispackage() (importlib.abc.InspectLoader method): importlib abc - Abstract base classes related to import.\n(line  262)\n* ispackage() (importlib.abc.SourceLoader method): importlib abc - Abstract base classes related to import.\n(line  453)\n* ispackage() (importlib.machinery.ExtensionFileLoader method): importlib machinery - Importers and path hooks.\n(line  328)\n* ispackage() (importlib.machinery.SourceFileLoader method): importlib machinery - Importers and path hooks.\n(line  220)\n* ispackage() (importlib.machinery.SourcelessFileLoader method): importlib machinery - Importers and path hooks.\n(line  264)\n* ispackage() (zipimport.zipimporter method): zipimporter Objects.\n(line   73)\n* isparameter() (symtable.Symbol method): Examining Symbol Tables.\n(line  130)\n* isprivate (ipaddress.IPv4Address attribute): Address objects.\n(line   97)\n* isprivate (ipaddress.IPv4Network attribute): Network objects.\n(line   72)\n* isprivate (ipaddress.IPv6Address attribute): Address objects.\n(line  259)\n* isprivate (ipaddress.IPv6Network attribute): Network objects.\n(line  299)\n* ispythonbuild() (in module sysconfig): Other functions<3>.\n(line   50)\n* isqnan() (decimal.Context method):    Context objects.    (line  333)\n* isqnan() (decimal.Decimal method):    Decimal objects.    (line  306)\n* isreading() (asyncio.ReadTransport method): Read-only Transports.\n(line    6)\n* isreferenced() (symtable.Symbol method): Examining Symbol Tables.\n(line  121)\n* isrelativeto() (pathlib.PurePath method): Methods and properties.\n(line  205)\n* isreserved (ipaddress.IPv4Address attribute): Address objects.\n(line  163)\n* isreserved (ipaddress.IPv4Network attribute): Network objects.\n(line   76)\n* isreserved (ipaddress.IPv6Address attribute): Address objects.\n(line  265)\n* isreserved (ipaddress.IPv6Network attribute): Network objects.\n(line  303)\n* isreserved() (pathlib.PurePath method): Methods and properties.\n(line  229)\n* isresourceenabled() (in module test.support): test support -- Utilities for the Python test suite.\n(line  245)\n* isresource() (importlib.abc.ResourceReader method): importlib abc - Abstract base classes related to import.\n(line  513)\n* isresource() (importlib.resources.abc.ResourceReader method): importlib resources abc - Abstract base classes for resources.\n(line   62)\n* isresource() (in module importlib.resources): Deprecated functions.\n(line  122)\n* isrunning() (asyncio.loop method):    Running and stopping the loop.\n(line   35)\n* issafe (uuid.UUID attribute):         uuid -- UUID objects according to RFC 4122.\n(line  152)\n* isserving() (asyncio.Server method):  Server Objects.     (line   92)\n* isset() (asyncio.Event method):       Event.              (line   65)\n* isset() (threading.Event method):     Event Objects.      (line   24)\n* issigned() (decimal.Context method):  Context objects.    (line  338)\n* issigned() (decimal.Decimal method):  Decimal objects.    (line  311)\n* issitelocal (ipaddress.IPv6Address attribute): Address objects.\n(line  273)\n* issitelocal (ipaddress.IPv6Network attribute): Network objects.\n(line  357)\n* isskippedline() (bdb.Bdb method):    bdb -- Debugger framework.\n(line  245)\n* issnan() (decimal.Context method):    Context objects.    (line  342)\n* issnan() (decimal.Decimal method):    Decimal objects.    (line  317)\n* issocket() (pathlib.Path method):     Methods<2>.         (line  199)\n* isstacktrampolineactive() (in module sys): sys -- System-specific parameters and functions.\n(line 1717)\n* issubnormal() (decimal.Context method): Context objects.  (line  347)\n* issubnormal() (decimal.Decimal method): Decimal objects.  (line  322)\n* issymlink() (os.DirEntry method):     Files and Directories.\n(line 1006)\n* issymlink() (pathlib.Path method):    Methods<2>.         (line  191)\n* istarfile() (in module tarfile):      tarfile -- Read and write tar archive files.\n(line  190)\n* istermresized() (in module curses):  Functions<6>.       (line  253)\n* istracing() (in module tracemalloc):  Functions<11>.      (line   61)\n* istracked() (in module gc):           gc -- Garbage Collector interface.\n(line  160)\n* istypeddict() (in module typing):     Introspection helpers.\n(line   84)\n* isunspecified (ipaddress.IPv4Address attribute): Address objects.\n(line  158)\n* isunspecified (ipaddress.IPv4Network attribute): Network objects.\n(line   74)\n* isunspecified (ipaddress.IPv6Address attribute): Address objects.\n(line  263)\n* isunspecified (ipaddress.IPv6Network attribute): Network objects.\n(line  301)\n* isvalid() (string.Template method):   Template strings.   (line   67)\n* iswintouched() (curses.window method): Window Objects.    (line  375)\n* iszero() (decimal.Context method):    Context objects.    (line  351)\n* iszero() (decimal.Decimal method):    Decimal objects.    (line  327)\n* iszipfile() (in module zipfile):      zipfile -- Work with ZIP archives.\n(line   72)\n* isabs() (in module os.path):           os path -- Common pathname manipulations.\n(line  200)\n* isabstract() (in module inspect):      Types and members.  (line  482)\n* IsADirectoryError:                     OS exceptions.      (line   83)\n* isalnum() (bytearray method):          Bytes and Bytearray Operations.\n(line  509)\n* isalnum() (bytes method):              Bytes and Bytearray Operations.\n(line  509)\n* isalnum() (in module curses.ascii):    curses ascii -- Utilities for ASCII characters.\n(line  134)\n* isalnum() (str method):                String Methods<2>.  (line  181)\n* isalpha() (bytearray method):          Bytes and Bytearray Operations.\n(line  527)\n* isalpha() (bytes method):              Bytes and Bytearray Operations.\n(line  527)\n* isalpha() (in module curses.ascii):    curses ascii -- Utilities for ASCII characters.\n(line  139)\n* isalpha() (str method):                String Methods<2>.  (line  188)\n* isascii() (bytearray method):          Bytes and Bytearray Operations.\n(line  542)\n* isascii() (bytes method):              Bytes and Bytearray Operations.\n(line  542)\n* isascii() (in module curses.ascii):    curses ascii -- Utilities for ASCII characters.\n(line  144)\n* isascii() (str method):                String Methods<2>.  (line  198)\n* isasyncgen() (in module inspect):      Types and members.  (line  442)\n* isasyncgenfunction() (in module inspect): Types and members.\n(line  425)\n* isatty() (chunk.Chunk method):         chunk -- Read IFF chunked data.\n(line   91)\n* isatty() (in module os):               File Descriptor Operations.\n(line  246)\n* isatty() (io.IOBase method):           I/O Base Classes.   (line   73)\n* isawaitable() (in module inspect):     Types and members.  (line  404)\n* isblank() (in module curses.ascii):    curses ascii -- Utilities for ASCII characters.\n(line  148)\n* isblk() (tarfile.TarInfo method):      TarInfo Objects.    (line  210)\n* isbuiltin() (in module inspect):       Types and members.  (line  462)\n* ischr() (tarfile.TarInfo method):      TarInfo Objects.    (line  206)\n* isclass() (in module inspect):         Types and members.  (line  339)\n* isclose() (in module cmath):           Classification functions.\n(line   23)\n* isclose() (in module math):            Number-theoretic and representation functions.\n(line  106)\n* iscntrl() (in module curses.ascii):    curses ascii -- Utilities for ASCII characters.\n(line  152)\n* iscode() (in module inspect):          Types and members.  (line  458)\n* iscoroutine() (in module asyncio):     Introspection.      (line   26)\n* iscoroutine() (in module inspect):     Types and members.  (line  397)\n* iscoroutinefunction() (in module inspect): Types and members.\n(line  365)\n* isctrl() (in module curses.ascii):     curses ascii -- Utilities for ASCII characters.\n(line  193)\n* isDaemon() (threading.Thread method):  Thread Objects.     (line  215)\n* isdatadescriptor() (in module inspect): Types and members. (line  504)\n* isdecimal() (str method):              String Methods<2>.  (line  206)\n* isdev() (tarfile.TarInfo method):      TarInfo Objects.    (line  218)\n* isdevdrive() (in module os.path):      os path -- Common pathname manipulations.\n(line  258)\n* isdigit() (bytearray method):          Bytes and Bytearray Operations.\n(line  550)\n* isdigit() (bytes method):              Bytes and Bytearray Operations.\n(line  550)\n* isdigit() (in module curses.ascii):    curses ascii -- Utilities for ASCII characters.\n(line  157)\n* isdigit() (str method):                String Methods<2>.  (line  214)\n* isdir() (in module os.path):           os path -- Common pathname manipulations.\n(line  216)\n* isdir() (tarfile.TarInfo method):      TarInfo Objects.    (line  194)\n* isdisjoint() (frozenset method):       Set Types -- set frozenset.\n(line   68)\n* isdown() (in module turtle):           Drawing state.      (line   86)\n* iselement() (in module xml.etree.ElementTree): Functions<9>.\n(line  130)\n* isenabled() (in module gc):            gc -- Garbage Collector interface.\n(line   30)\n* isEnabledFor() (logging.Logger method): Logger Objects.    (line  143)\n* isendwin() (in module curses):         Functions<6>.       (line  258)\n* ISEOF() (in module token):             token -- Constants used with Python parse trees.\n(line   34)\n* isfifo() (tarfile.TarInfo method):     TarInfo Objects.    (line  214)\n* isfile() (in module os.path):          os path -- Common pathname manipulations.\n(line  208)\n* isfile() (tarfile.TarInfo method):     TarInfo Objects.    (line  185)\n* isfinite() (in module cmath):          Classification functions.\n(line    6)\n* isfinite() (in module math):           Number-theoretic and representation functions.\n(line  139)\n* isfirstline() (in module fileinput):   fileinput -- Iterate over lines from multiple input streams.\n(line  111)\n* isframe() (in module inspect):         Types and members.  (line  454)\n* isfunction() (in module inspect):      Types and members.  (line  348)\n* isfuture() (in module asyncio):        Future Functions.   (line    6)\n* isgenerator() (in module inspect):     Types and members.  (line  361)\n* isgeneratorfunction() (in module inspect): Types and members.\n(line  353)\n* isgetsetdescriptor() (in module inspect): Types and members.\n(line  517)\n* isgraph() (in module curses.ascii):    curses ascii -- Utilities for ASCII characters.\n(line  162)\n* isidentifier() (str method):           String Methods<2>.  (line  224)\n* isinf() (in module cmath):             Classification functions.\n(line   13)\n* isinf() (in module math):              Number-theoretic and representation functions.\n(line  146)\n* isinstance (2to3 fixer):               Fixers.             (line  161)\n* isjunction() (in module os.path):      os path -- Common pathname manipulations.\n(line  224)\n* iskeyword() (in module keyword):       keyword -- Testing for Python keywords.\n(line   13)\n* isleap() (in module calendar):         calendar -- General calendar-related functions.\n(line  304)\n* islice() (in module itertools):        Itertool Functions. (line  380)\n* islink() (in module os.path):          os path -- Common pathname manipulations.\n(line  232)\n* islnk() (tarfile.TarInfo method):      TarInfo Objects.    (line  202)\n* islower() (bytearray method):          Bytes and Bytearray Operations.\n(line  564)\n* islower() (bytes method):              Bytes and Bytearray Operations.\n(line  564)\n* islower() (in module curses.ascii):    curses ascii -- Utilities for ASCII characters.\n(line  166)\n* islower() (str method):                String Methods<2>.  (line  242)\n* ismemberdescriptor() (in module inspect): Types and members.\n(line  526)\n* ismeta() (in module curses.ascii):     curses ascii -- Utilities for ASCII characters.\n(line  197)\n* ismethod() (in module inspect):        Types and members.  (line  344)\n* ismethoddescriptor() (in module inspect): Types and members.\n(line  486)\n* ismethodwrapper() (in module inspect): Types and members.  (line  467)\n* ismodule() (in module inspect):        Types and members.  (line  335)\n* ismount() (in module os.path):         os path -- Common pathname manipulations.\n(line  240)\n* isnan() (in module cmath):             Classification functions.\n(line   18)\n* isnan() (in module math):              Number-theoretic and representation functions.\n(line  151)\n* ISNONTERMINAL() (in module token):     token -- Constants used with Python parse trees.\n(line   30)\n* IsNot (class in ast):                  Expressions<2>.     (line  109)\n* isnumeric() (str method):              String Methods<2>.  (line  248)\n* isocalendar() (datetime.date method):  date Objects.       (line  226)\n* isocalendar() (datetime.datetime method): datetime Objects.\n(line  623)\n* isoformat() (datetime.date method):    date Objects.       (line  253)\n* isoformat() (datetime.datetime method): datetime Objects.  (line  628)\n* isoformat() (datetime.time method):    time Objects.       (line  161)\n* isolated (sys.flags attribute):        sys -- System-specific parameters and functions.\n(line  526)\n* IsolatedAsyncioTestCase (class in unittest): Test cases.   (line  852)\n* isolationlevel (sqlite3.Connection attribute): Connection objects.\n(line  747)\n* isoweekday() (datetime.date method):   date Objects.       (line  219)\n* isoweekday() (datetime.datetime method): datetime Objects. (line  617)\n* isprint() (in module curses.ascii):    curses ascii -- Utilities for ASCII characters.\n(line  170)\n* isprintable() (str method):            String Methods<2>.  (line  258)\n* ispunct() (in module curses.ascii):    curses ascii -- Utilities for ASCII characters.\n(line  174)\n* isqrt() (in module math):              Number-theoretic and representation functions.\n(line  156)\n* isreadable() (in module pprint):       Functions<4>.       (line   55)\n* isreadable() (pprint.PrettyPrinter method): PrettyPrinter Objects.\n(line   99)\n* isrecursive() (in module pprint):      Functions<4>.       (line   64)\n* isrecursive() (pprint.PrettyPrinter method): PrettyPrinter Objects.\n(line  107)\n* isreg() (tarfile.TarInfo method):      TarInfo Objects.    (line  190)\n* isReservedKey() (http.cookies.Morsel method): Morsel Objects.\n(line   62)\n* isroutine() (in module inspect):       Types and members.  (line  477)\n* isSameNode() (xml.dom.Node method):    Node Objects.       (line  102)\n* issoftkeyword() (in module keyword):   keyword -- Testing for Python keywords.\n(line   24)\n* isspace() (bytearray method):          Bytes and Bytearray Operations.\n(line  581)\n* isspace() (bytes method):              Bytes and Bytearray Operations.\n(line  581)\n* isspace() (in module curses.ascii):    curses ascii -- Utilities for ASCII characters.\n(line  179)\n* isspace() (str method):                String Methods<2>.  (line  270)\n* isstdin() (in module fileinput):       fileinput -- Iterate over lines from multiple input streams.\n(line  116)\n* issubset() (frozenset method):         Set Types -- set frozenset.\n(line   74)\n* issuperset() (frozenset method):       Set Types -- set frozenset.\n(line   85)\n* issym() (tarfile.TarInfo method):      TarInfo Objects.    (line  198)\n* ISTERMINAL() (in module token):        token -- Constants used with Python parse trees.\n(line   26)\n* istitle() (bytearray method):          Bytes and Bytearray Operations.\n(line  589)\n* istitle() (bytes method):              Bytes and Bytearray Operations.\n(line  589)\n* istitle() (str method):                String Methods<2>.  (line  280)\n* istraceback() (in module inspect):     Types and members.  (line  450)\n* isub() (in module operator):           In-place Operators. (line   94)\n* isupper() (bytearray method):          Bytes and Bytearray Operations.\n(line  603)\n* isupper() (bytes method):              Bytes and Bytearray Operations.\n(line  603)\n* isupper() (in module curses.ascii):    curses ascii -- Utilities for ASCII characters.\n(line  184)\n* isupper() (str method):                String Methods<2>.  (line  287)\n* isvisible() (in module turtle):        Visibility.         (line   22)\n* isxdigit() (in module curses.ascii):   curses ascii -- Utilities for ASCII characters.\n(line  188)\n* ITALIC (in module tkinter.font):       tkinter font -- Tkinter font wrapper.\n(line   15)\n* item selection:                        Sequences.          (line    6)\n* item() (tkinter.ttk.Treeview method):  ttk Treeview.       (line  202)\n* item() (xml.dom.NamedNodeMap method):  NamedNodeMap Objects.\n(line   12)\n* item() (xml.dom.NodeList method):      NodeList Objects.   (line   15)\n* itemgetter() (in module operator):     operator -- Standard operators as functions.\n(line  271)\n* items() (configparser.ConfigParser method): ConfigParser Objects.\n(line  237)\n* items() (contextvars.Context method):  Manual Context Management.\n(line  113)\n* items() (dict method):                 Mapping Types -- dict.\n(line  161)\n* items() (email.message.EmailMessage method): email message Representing an email message.\n(line  240)\n* items() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  348)\n* items() (mailbox.Mailbox method):      Mailbox objects.    (line  142)\n* items() (types.MappingProxyType method): Standard Interpreter Types.\n(line  311)\n* items() (xml.etree.ElementTree.Element method): Element Objects.\n(line   71)\n* itemsize (array.array attribute):      array -- Efficient arrays of numeric values.\n(line  109)\n* itemsize (memoryview attribute):       Memory Views.       (line  433)\n* ItemsView (class in collections.abc):  Collections Abstract Base Classes - Detailed Descriptions.\n(line   96)\n* ItemsView (class in typing):           Aliases to container ABCs in collections abc.\n(line   41)\n* iterattachments() (email.message.EmailMessage method): email message Representing an email message.\n(line  560)\n* iterchildnodes() (in module ast):    ast Helpers.        (line  166)\n* iterfields() (in module ast):         ast Helpers.        (line  161)\n* iterimporters() (in module pkgutil):  pkgutil -- Package extension utility.\n(line  106)\n* itermodules() (in module pkgutil):    pkgutil -- Package extension utility.\n(line  124)\n* iterparts() (email.message.EmailMessage method): email message Representing an email message.\n(line  576)\n* iterunpack() (in module struct):      Functions and Exceptions.\n(line   42)\n* iterunpack() (struct.Struct method):  Classes<3>.         (line   46)\n* iter() (xml.etree.ElementTree.Element method): Element Objects.\n(line  136)\n* iter() (xml.etree.ElementTree.ElementTree method): ElementTree Objects.\n(line   40)\n* iterable:                              Glossary.           (line  719)\n* Iterable (class in collections.abc):   Collections Abstract Base Classes - Detailed Descriptions.\n(line   23)\n* Iterable (class in typing):            Aliases to other ABCs in collections abc.\n(line    6)\n* iterable; unpacking:                   Expression lists.   (line   16)\n* iterator:                              Glossary.           (line  741)\n* Iterator (class in collections.abc):   Collections Abstract Base Classes - Detailed Descriptions.\n(line   40)\n* Iterator (class in typing):            Aliases to other ABCs in collections abc.\n(line   14)\n* iterator protocol:                     Iterator Types.     (line    6)\n* iterdecode() (in module codecs):       codecs -- Codec registry and base classes.\n(line  234)\n* iterdir() (importlib.abc.Traversable method): importlib abc - Abstract base classes related to import.\n(line  555)\n* iterdir() (importlib.resources.abc.Traversable method): importlib resources abc - Abstract base classes for resources.\n(line   99)\n* iterdir() (pathlib.Path method):       Methods<2>.         (line  234)\n* iterdir() (zipfile.Path method):       Path Objects.       (line   43)\n* iterdump() (sqlite3.Connection method): Connection objects.\n(line  480)\n* iterencode() (in module codecs):       codecs -- Codec registry and base classes.\n(line  222)\n* iterencode() (json.JSONEncoder method): Encoders and Decoders.\n(line  225)\n* iterfind() (xml.etree.ElementTree.Element method): Element Objects.\n(line  147)\n* iterfind() (xml.etree.ElementTree.ElementTree method): ElementTree Objects.\n(line   47)\n* iteritems() (mailbox.Mailbox method):  Mailbox objects.    (line  133)\n* iterkeys() (mailbox.Mailbox method):   Mailbox objects.    (line  107)\n* itermonthdates() (calendar.Calendar method): calendar -- General calendar-related functions.\n(line   45)\n* itermonthdays() (calendar.Calendar method): calendar -- General calendar-related functions.\n(line   53)\n* itermonthdays2() (calendar.Calendar method): calendar -- General calendar-related functions.\n(line   61)\n* itermonthdays3() (calendar.Calendar method): calendar -- General calendar-related functions.\n(line   69)\n* itermonthdays4() (calendar.Calendar method): calendar -- General calendar-related functions.\n(line   79)\n* iternextfunc (C type):                 Slot Type typedefs. (line   92)\n* iterparse() (in module xml.etree.ElementTree): Functions<9>.\n(line  136)\n* itertext() (xml.etree.ElementTree.Element method): Element Objects.\n(line  156)\n* itertools (2to3 fixer):                Fixers.             (line  174)\n* itertoolsimports (2to3 fixer):        Fixers.             (line  168)\n* itervalues() (mailbox.Mailbox method): Mailbox objects.    (line  116)\n* iterweekdays() (calendar.Calendar method): calendar -- General calendar-related functions.\n(line   39)\n* ITIMERPROF (in module signal):        Module contents<2>. (line  223)\n* ITIMERREAL (in module signal):        Module contents<2>. (line  213)\n* ITIMERVIRTUAL (in module signal):     Module contents<2>. (line  218)\n* ItimerError:                           Module contents<2>. (line  256)\n* itruediv() (in module operator):       In-place Operators. (line   99)\n* ixor() (in module operator):           In-place Operators. (line  104)\n* j; in numeric literal:                 Floating point literals.\n(line   28)\n* Jansen, Jack:                          uu -- Encode and decode uuencode files.\n(line   24)\n* JANUARY (in module calendar):          calendar -- General calendar-related functions.\n(line  414)\n* javaver() (in module platform):       Java Platform.      (line    6)\n* Java; language:                        numbers Real float. (line    6)\n* jointhread() (in module test.support.threadinghelper): test support threadinghelper -- Utilities for threading tests.\n(line   11)\n* jointhread() (multiprocessing.Queue method): Pipes and Queues.\n(line  170)\n* join() (asyncio.Queue method):         Queue.              (line   49)\n* join() (bytearray method):             Bytes and Bytearray Operations.\n(line  166)\n* join() (bytes method):                 Bytes and Bytearray Operations.\n(line  166)\n* join() (in module os.path):            os path -- Common pathname manipulations.\n(line  275)\n* join() (in module shlex):              shlex -- Simple lexical analysis.\n(line   29)\n* join() (multiprocessing.JoinableQueue method): Pipes and Queues.\n(line  252)\n* join() (multiprocessing.pool.Pool method): Process Pools.  (line  180)\n* join() (multiprocessing.Process method): Process and exceptions.\n(line   66)\n* join() (queue.Queue method):           Queue Objects.      (line   83)\n* join() (str method):                   String Methods<2>.  (line  302)\n* join() (threading.Thread method):      Thread Objects.     (line  127)\n* JoinableQueue (class in multiprocessing): Pipes and Queues.\n(line  231)\n* JoinedStr (class in ast):              Literals<3>.        (line   42)\n* joinpath() (importlib.abc.Traversable method): importlib abc - Abstract base classes related to import.\n(line  567)\n* joinpath() (importlib.resources.abc.Traversable method): importlib resources abc - Abstract base classes for resources.\n(line  111)\n* joinpath() (pathlib.PurePath method):  Methods and properties.\n(line  243)\n* joinpath() (zipfile.Path method):      Path Objects.       (line   94)\n* jsoutput() (http.cookies.BaseCookie method): Cookie Objects.\n(line   32)\n* jsoutput() (http.cookies.Morsel method): Morsel Objects.  (line   73)\n* json.tool command line option; -compact: Command line options<2>.\n(line   48)\n* json.tool command line option; -h:     Command line options<2>.\n(line   54)\n* json.tool command line option; -help:  Command line options<2>.\n(line   54)\n* json.tool command line option; -indent: Command line options<2>.\n(line   48)\n* json.tool command line option; -json-lines: Command line options<2>.\n(line   42)\n* json.tool command line option; -no-ensure-ascii: Command line options<2>.\n(line   35)\n* json.tool command line option; -no-indent: Command line options<2>.\n(line   48)\n* json.tool command line option; -sort-keys: Command line options<2>.\n(line   29)\n* json.tool command line option; -tab:   Command line options<2>.\n(line   48)\n* json.tool command line option; infile: Command line options<2>.\n(line    6)\n* json.tool command line option; outfile: Command line options<2>.\n(line   24)\n* JSONDecodeError:                       Exceptions<15>.     (line    6)\n* JSONDecoder (class in json):           Encoders and Decoders.\n(line    6)\n* JSONEncoder (class in json):           Encoders and Decoders.\n(line  103)\n* JULY (in module calendar):             calendar -- General calendar-related functions.\n(line  414)\n* JUMP (monitoring event):               Events.             (line   34)\n* JUMP (opcode):                         Python Bytecode Instructions.\n(line 1293)\n* jump (pdb command):                    Debugger Commands.  (line  220)\n* JUMPBACKWARD (opcode):                Python Bytecode Instructions.\n(line  761)\n* JUMPBACKWARDNOINTERRUPT (opcode):   Python Bytecode Instructions.\n(line  767)\n* JUMPFORWARD (opcode):                 Python Bytecode Instructions.\n(line  757)\n* JUMPNOINTERRUPT (opcode):            Python Bytecode Instructions.\n(line 1295)\n* JUNE (in module calendar):             calendar -- General calendar-related functions.\n(line  414)\n* kbhit() (in module msvcrt):            Console I/O.        (line    6)\n* KDEDIR:                                webbrowser -- Convenient web-browser controller.\n(line  175)\n* KEEP (enum.FlagBoundary attribute):    Data Types<2>.      (line  673)\n* kevent() (in module select):           select -- Waiting for I/O completion.\n(line  109)\n* key:                                   Dictionary displays.\n(line    6)\n* key (http.cookies.Morsel attribute):   Morsel Objects.     (line   54)\n* key (zoneinfo.ZoneInfo attribute):     The ZoneInfo class. (line   75)\n* key function:                          Glossary.           (line  767)\n* KEYA1 (in module curses):             Constants<6>.       (line  236)\n* KEYA3 (in module curses):             Constants<6>.       (line  239)\n* KEYALLACCESS (in module winreg):     Access Rights.      (line    8)\n* KEYB2 (in module curses):             Constants<6>.       (line  242)\n* KEYBACKSPACE (in module curses):      Constants<6>.       (line  166)\n* KEYBEG (in module curses):            Constants<6>.       (line  254)\n* KEYBREAK (in module curses):          Constants<6>.       (line  148)\n* KEYBTAB (in module curses):           Constants<6>.       (line  251)\n* KEYC1 (in module curses):             Constants<6>.       (line  245)\n* KEYC3 (in module curses):             Constants<6>.       (line  248)\n* KEYCANCEL (in module curses):         Constants<6>.       (line  257)\n* KEYCATAB (in module curses):          Constants<6>.       (line  218)\n* KEYCLEAR (in module curses):          Constants<6>.       (line  191)\n* KEYCLOSE (in module curses):          Constants<6>.       (line  260)\n* KEYCOMMAND (in module curses):        Constants<6>.       (line  263)\n* KEYCOPY (in module curses):           Constants<6>.       (line  266)\n* KEYCREATE (in module curses):         Constants<6>.       (line  269)\n* KEYCREATELINK (in module winreg):    Access Rights.      (line   51)\n* KEYCREATESUBKEY (in module winreg): Access Rights.      (line   38)\n* KEYCTAB (in module curses):           Constants<6>.       (line  215)\n* KEYDC (in module curses):             Constants<6>.       (line  182)\n* KEYDL (in module curses):             Constants<6>.       (line  176)\n* KEYDOWN (in module curses):           Constants<6>.       (line  151)\n* KEYEIC (in module curses):            Constants<6>.       (line  188)\n* KEYEND (in module curses):            Constants<6>.       (line  272)\n* KEYENTER (in module curses):          Constants<6>.       (line  221)\n* KEYENUMERATESUBKEYS (in module winreg): Access Rights.  (line   42)\n* KEYEOL (in module curses):            Constants<6>.       (line  197)\n* KEYEOS (in module curses):            Constants<6>.       (line  194)\n* KEYEXECUTE (in module winreg):        Access Rights.      (line   26)\n* KEYEXIT (in module curses):           Constants<6>.       (line  275)\n* KEYF0 (in module curses):             Constants<6>.       (line  169)\n* KEYFIND (in module curses):           Constants<6>.       (line  278)\n* KEYFn (in module curses):             Constants<6>.       (line  173)\n* KEYHELP (in module curses):           Constants<6>.       (line  281)\n* KEYHOME (in module curses):           Constants<6>.       (line  163)\n* KEYIC (in module curses):             Constants<6>.       (line  185)\n* KEYIL (in module curses):             Constants<6>.       (line  179)\n* KEYLEFT (in module curses):           Constants<6>.       (line  157)\n* KEYLL (in module curses):             Constants<6>.       (line  233)\n* KEYMARK (in module curses):           Constants<6>.       (line  284)\n* KEYMAX (in module curses):            Constants<6>.       (line  425)\n* KEYMESSAGE (in module curses):        Constants<6>.       (line  287)\n* KEYMIN (in module curses):            Constants<6>.       (line  145)\n* KEYMOUSE (in module curses):          Constants<6>.       (line  419)\n* KEYMOVE (in module curses):           Constants<6>.       (line  290)\n* KEYNEXT (in module curses):           Constants<6>.       (line  293)\n* KEYNOTIFY (in module winreg):         Access Rights.      (line   46)\n* KEYNPAGE (in module curses):          Constants<6>.       (line  206)\n* KEYOPEN (in module curses):           Constants<6>.       (line  296)\n* KEYOPTIONS (in module curses):        Constants<6>.       (line  299)\n* KEYPPAGE (in module curses):          Constants<6>.       (line  209)\n* KEYPREVIOUS (in module curses):       Constants<6>.       (line  302)\n* KEYPRINT (in module curses):          Constants<6>.       (line  230)\n* KEYQUERYVALUE (in module winreg):    Access Rights.      (line   30)\n* KEYREAD (in module winreg):           Access Rights.      (line   20)\n* KEYREDO (in module curses):           Constants<6>.       (line  305)\n* KEYREFERENCE (in module curses):      Constants<6>.       (line  308)\n* KEYREFRESH (in module curses):        Constants<6>.       (line  311)\n* KEYREPLACE (in module curses):        Constants<6>.       (line  314)\n* KEYRESET (in module curses):          Constants<6>.       (line  227)\n* KEYRESIZE (in module curses):         Constants<6>.       (line  422)\n* KEYRESTART (in module curses):        Constants<6>.       (line  317)\n* KEYRESUME (in module curses):         Constants<6>.       (line  320)\n* KEYRIGHT (in module curses):          Constants<6>.       (line  160)\n* KEYSAVE (in module curses):           Constants<6>.       (line  323)\n* KEYSBEG (in module curses):           Constants<6>.       (line  326)\n* KEYSCANCEL (in module curses):        Constants<6>.       (line  329)\n* KEYSCOMMAND (in module curses):       Constants<6>.       (line  332)\n* KEYSCOPY (in module curses):          Constants<6>.       (line  335)\n* KEYSCREATE (in module curses):        Constants<6>.       (line  338)\n* KEYSDC (in module curses):            Constants<6>.       (line  341)\n* KEYSDL (in module curses):            Constants<6>.       (line  344)\n* KEYSELECT (in module curses):         Constants<6>.       (line  347)\n* KEYSEND (in module curses):           Constants<6>.       (line  350)\n* KEYSEOL (in module curses):           Constants<6>.       (line  353)\n* KEYSETVALUE (in module winreg):      Access Rights.      (line   34)\n* KEYSEXIT (in module curses):          Constants<6>.       (line  356)\n* KEYSF (in module curses):             Constants<6>.       (line  200)\n* KEYSFIND (in module curses):          Constants<6>.       (line  359)\n* KEYSHELP (in module curses):          Constants<6>.       (line  362)\n* KEYSHOME (in module curses):          Constants<6>.       (line  365)\n* KEYSIC (in module curses):            Constants<6>.       (line  368)\n* KEYSLEFT (in module curses):          Constants<6>.       (line  371)\n* KEYSMESSAGE (in module curses):       Constants<6>.       (line  374)\n* KEYSMOVE (in module curses):          Constants<6>.       (line  377)\n* KEYSNEXT (in module curses):          Constants<6>.       (line  380)\n* KEYSOPTIONS (in module curses):       Constants<6>.       (line  383)\n* KEYSPREVIOUS (in module curses):      Constants<6>.       (line  386)\n* KEYSPRINT (in module curses):         Constants<6>.       (line  389)\n* KEYSR (in module curses):             Constants<6>.       (line  203)\n* KEYSREDO (in module curses):          Constants<6>.       (line  392)\n* KEYSREPLACE (in module curses):       Constants<6>.       (line  395)\n* KEYSRESET (in module curses):         Constants<6>.       (line  224)\n* KEYSRIGHT (in module curses):         Constants<6>.       (line  398)\n* KEYSRSUME (in module curses):         Constants<6>.       (line  401)\n* KEYSSAVE (in module curses):          Constants<6>.       (line  404)\n* KEYSSUSPEND (in module curses):       Constants<6>.       (line  407)\n* KEYSTAB (in module curses):           Constants<6>.       (line  212)\n* KEYSUNDO (in module curses):          Constants<6>.       (line  410)\n* KEYSUSPEND (in module curses):        Constants<6>.       (line  413)\n* KEYUNDO (in module curses):           Constants<6>.       (line  416)\n* KEYUP (in module curses):             Constants<6>.       (line  154)\n* KEYWOW6432KEY (in module winreg):    64-bit Specific.    (line   14)\n* KEYWOW6464KEY (in module winreg):    64-bit Specific.    (line    8)\n* KEYWRITE (in module winreg):          Access Rights.      (line   15)\n* key/value pair:                        Dictionary displays.\n(line    6)\n* KeyboardInterrupt:                     Concrete exceptions.\n(line   84)\n* KeyboardInterrupt (built-in exception): Signal Handling<2>.\n(line    7)\n* KeyboardInterrupt (built-in exception) <1>: Signal Handling<2>.\n(line   34)\n* KeyboardInterrupt (built-in exception) <2>: Signal Handling<2>.\n(line   43)\n* KeyError:                              Concrete exceptions.\n(line   79)\n* keylogfilename (ssl.SSLContext attribute): SSL Contexts.  (line  517)\n* keyname() (in module curses):          Functions<6>.       (line  263)\n* keypad() (curses.window method):       Window Objects.     (line  380)\n* keyrefs() (weakref.WeakKeyDictionary method): weakref -- Weak references.\n(line  210)\n* keys() (contextvars.Context method):   Manual Context Management.\n(line  105)\n* keys() (dict method):                  Mapping Types -- dict.\n(line  166)\n* keys() (email.message.EmailMessage method): email message Representing an email message.\n(line  232)\n* keys() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  340)\n* keys() (mailbox.Mailbox method):       Mailbox objects.    (line  111)\n* keys() (sqlite3.Row method):           Row objects.        (line   19)\n* keys() (types.MappingProxyType method): Standard Interpreter Types.\n(line  316)\n* keys() (xml.etree.ElementTree.Element method): Element Objects.\n(line   76)\n* KeysView (class in collections.abc):   Collections Abstract Base Classes - Detailed Descriptions.\n(line   96)\n* KeysView (class in typing):            Aliases to container ABCs in collections abc.\n(line   50)\n* keyword:                               Keywords.           (line    6)\n* keyword <1>:                           Soft Keywords.      (line    6)\n* keyword (class in ast):                Expressions<2>.     (line  152)\n* keyword argument:                      Glossary.           (line  789)\n* keyword; as:                           The import statement.\n(line    6)\n* keyword; as <1>:                       The try statement.  (line    6)\n* keyword; as <2>:                       The with statement. (line    6)\n* keyword; as <3>:                       The match statement.\n(line    6)\n* keyword; async:                        Coroutine function definition.\n(line    9)\n* keyword; await:                        Calls.              (line  158)\n* keyword; await <1>:                    Coroutine function definition.\n(line    9)\n* keyword; case:                         The match statement.\n(line    6)\n* keyword; elif:                         The if statement.   (line    6)\n* keyword; else:                         The break statement.\n(line   12)\n* keyword; else <1>:                     The if statement.   (line    6)\n* keyword; else <2>:                     The while statement.\n(line    6)\n* keyword; else <3>:                     The for statement.  (line    6)\n* keyword; else <4>:                     The try statement.  (line    6)\n* keyword; else <5>:                     except* clause.     (line   55)\n* keyword; except:                       The try statement.  (line    6)\n* keyword; exceptstar:                  except clause.      (line   82)\n* keyword; finally:                      The return statement.\n(line   17)\n* keyword; finally <1>:                  The break statement.\n(line   18)\n* keyword; finally <2>:                  The continue statement.\n(line    6)\n* keyword; finally <3>:                  The try statement.  (line    6)\n* keyword; finally <4>:                  else clause.        (line   11)\n* keyword; from:                         Yield expressions.  (line    6)\n* keyword; from <1>:                     The import statement.\n(line    6)\n* keyword; if:                           The match statement.\n(line    6)\n* keyword; in:                           The for statement.  (line    6)\n* keyword; yield:                        Yield expressions.  (line    6)\n* keywords (functools.partial attribute): partial Objects.   (line   20)\n* killpython() (in module test.support.scripthelper): test support scripthelper -- Utilities for the Python execution tests.\n(line   77)\n* kill() (asyncio.subprocess.Process method): Interacting with Subprocesses.\n(line  106)\n* kill() (asyncio.SubprocessTransport method): Subprocess Transports.\n(line   35)\n* kill() (in module os):                 Process Management. (line  325)\n* kill() (multiprocessing.Process method): Process and exceptions.\n(line  189)\n* kill() (subprocess.Popen method):      Popen Objects.      (line   92)\n* killchar() (in module curses):         Functions<6>.       (line  273)\n* killpg() (in module os):               Process Management. (line  349)\n* kind (inspect.Parameter attribute):    Introspecting callables with the Signature object.\n(line  213)\n* knownfiles (in module mimetypes):      mimetypes -- Map filenames to MIME types.\n(line  122)\n* kqueue() (in module select):           select -- Waiting for I/O completion.\n(line   98)\n* KqueueSelector (class in selectors):   Classes<4>.         (line  195)\n* KWNAMES (opcode):                     Python Bytecode Instructions.\n(line 1004)\n* KWONLY (in module dataclasses):       Module contents<4>. (line  453)\n* kwargs (inspect.BoundArguments attribute): Introspecting callables with the Signature object.\n(line  339)\n* kwargs (typing.ParamSpec attribute):   Building generic types and type aliases.\n(line  371)\n* kwlist (in module keyword):            keyword -- Testing for Python keywords.\n(line   17)\n* L (in module re):                      Flags.              (line   58)\n* LabelEntry (class in tkinter.tix):     Basic Widgets.      (line   31)\n* LabelFrame (class in tkinter.tix):     Basic Widgets.      (line   37)\n* lambda:                                Glossary.           (line  793)\n* Lambda (class in ast):                 Function and class definitions.\n(line   32)\n* lambda; expression:                    Lambdas.            (line    6)\n* lambda; expression <1>:                Function definitions.\n(line  121)\n* lambda; form:                          Lambdas.            (line    6)\n* LambdaType (in module types):          Standard Interpreter Types.\n(line   25)\n* LANG:                                  GNU gettext API.    (line   21)\n* LANG <1>:                              Class-based API.    (line   26)\n* LANG <2>:                              locale -- Internationalization services.\n(line   49)\n* LANG <3>:                              locale -- Internationalization services.\n(line  344)\n* LANG <4>:                              locale -- Internationalization services.\n(line  348)\n* LANGUAGE:                              GNU gettext API.    (line   20)\n* LANGUAGE <1>:                          Class-based API.    (line   25)\n* large files:                           Large File Support. (line    6)\n* LARGEST (in module test.support):      test support -- Utilities for the Python test suite.\n(line  185)\n* LargeZipFile:                          zipfile -- Work with ZIP archives.\n(line   37)\n* lastaccepted (multiprocessing.connection.Listener attribute): Listeners and Clients.\n(line  103)\n* lastexc (in module sys):              sys -- System-specific parameters and functions.\n(line 1165)\n* lasttraceback (in module sys):        Traceback objects.  (line    6)\n* lasttraceback (in module sys) <1>:    sys -- System-specific parameters and functions.\n(line 1178)\n* lasttype (in module sys):             sys -- System-specific parameters and functions.\n(line 1178)\n* lastvalue (in module sys):            sys -- System-specific parameters and functions.\n(line 1178)\n* last() (nntplib.NNTP method):          Methods<3>.         (line  237)\n* lastChild (xml.dom.Node attribute):    Node Objects.       (line   59)\n* lastcmd (cmd.Cmd attribute):           Cmd Objects.        (line  139)\n* lastgroup (re.Match attribute):        Match Objects.      (line  201)\n* lastindex (re.Match attribute):        Match Objects.      (line  193)\n* lastResort (in module logging):        Module-Level Attributes.\n(line    6)\n* lastrowid (sqlite3.Cursor attribute):  Cursor objects.     (line  199)\n* layout() (tkinter.ttk.Style method):   Ttk Styling.        (line   96)\n* lazycache() (in module linecache):     linecache -- Random access to text lines.\n(line   50)\n* LazyLoader (class in importlib.util):  importlib util - Utility code for importers.\n(line  192)\n* LBRACE (in module token):              token -- Constants used with Python parse trees.\n(line  126)\n* LBYL:                                  Glossary.           (line  800)\n* LCALL:                                GNU gettext API.    (line   20)\n* LCALL <1>:                            Class-based API.    (line   25)\n* LCALL (in module locale):             locale -- Internationalization services.\n(line  566)\n* LCCOLLATE (in module locale):         locale -- Internationalization services.\n(line  532)\n* LCCTYPE (in module locale):           locale -- Internationalization services.\n(line  518)\n* LCMESSAGES:                           GNU gettext API.    (line   20)\n* LCMESSAGES <1>:                       Class-based API.    (line   26)\n* LCMESSAGES (in module locale):        locale -- Internationalization services.\n(line  548)\n* LCMONETARY (in module locale):        locale -- Internationalization services.\n(line  543)\n* LCNUMERIC (in module locale):         locale -- Internationalization services.\n(line  558)\n* LCTIME (in module locale):            locale -- Internationalization services.\n(line  538)\n* lchflags() (in module os):             Files and Directories.\n(line  298)\n* lchmod() (in module os):               Files and Directories.\n(line  312)\n* lchmod() (pathlib.Path method):        Methods<2>.         (line  356)\n* lchown() (in module os):               Files and Directories.\n(line  331)\n* lcm() (in module math):                Number-theoretic and representation functions.\n(line  169)\n* LDCXXSHARED:                           Build and C API Changes<8>.\n(line  154)\n* ldexp() (in module math):              Number-theoretic and representation functions.\n(line  179)\n* LDFLAGS:                               New Improved and Deprecated Modules<4>.\n(line   59)\n* LDFLAGS <1>:                           Preprocessor flags. (line   18)\n* LDFLAGS <2>:                           Linker flags.       (line   15)\n* LDFLAGS <3>:                           Linker flags.       (line   18)\n* LDFLAGS <4>:                           Linker flags.       (line   28)\n* LDFLAGS <5>:                           Linker flags.       (line   31)\n* LDFLAGS <6>:                           Linker flags.       (line   35)\n* LDFLAGS <7>:                           Linker flags.       (line   50)\n* LDFLAGSNODIST:                        Linker flags.       (line   26)\n* LDFLAGSNODIST <1>:                    Linker flags.       (line   40)\n* le() (in module operator):             operator -- Standard operators as functions.\n(line   24)\n* leading whitespace:                    Indentation.        (line    6)\n* leapdays() (in module calendar):       calendar -- General calendar-related functions.\n(line  309)\n* leaveok() (curses.window method):      Window Objects.     (line  387)\n* left (filecmp.dircmp attribute):       The dircmp class.   (line   41)\n* leftlist (filecmp.dircmp attribute):  The dircmp class.   (line   49)\n* leftonly (filecmp.dircmp attribute):  The dircmp class.   (line   63)\n* left() (in module turtle):             Turtle motion.      (line   57)\n* LEFTSHIFT (in module token):           token -- Constants used with Python parse trees.\n(line  158)\n* LEFTSHIFTEQUAL (in module token):      token -- Constants used with Python parse trees.\n(line  202)\n* LEGACYTRANSACTIONCONTROL (in module sqlite3): Module constants.\n(line    6)\n* lenfunc (C type):                      Slot Type typedefs. (line   96)\n* length (xml.dom.NamedNodeMap attribute): NamedNodeMap Objects.\n(line    8)\n* length (xml.dom.NodeList attribute):   NodeList Objects.   (line   21)\n* lengthhint() (in module operator):    operator -- Standard operators as functions.\n(line  210)\n* LESS (in module token):                token -- Constants used with Python parse trees.\n(line  106)\n* LESSEQUAL (in module token):           token -- Constants used with Python parse trees.\n(line  142)\n* level (logging.Logger attribute):      Logger Objects.     (line   32)\n* lexical analysis:                      Lexical analysis.   (line    6)\n* lexical definitions:                   Notation.           (line   32)\n* LexicalHandler (class in xml.sax.handler): xml sax handler -- Base classes for SAX handlers.\n(line   45)\n* lexists() (in module os.path):         os path -- Common pathname manipulations.\n(line  122)\n* LF (in module curses.ascii):           curses ascii -- Utilities for ASCII characters.\n(line   52)\n* lgamma() (in module math):             Special functions.  (line   35)\n* libcver() (in module platform):       Unix Platforms.     (line    6)\n* LIBRARIESASSEMBLYNAMEPREFIX (in module msvcrt): Other Functions.\n(line   21)\n* library (in module dbm.ndbm):          dbm ndbm -- New Database Manager.\n(line   29)\n* library (ssl.SSLError attribute):      Exceptions<14>.     (line   19)\n* LibraryLoader (class in ctypes):       Loading shared libraries.\n(line  167)\n* license (built-in variable):           Constants added by the site module.\n(line   24)\n* LifoQueue (class in asyncio):          LIFO Queue.         (line    6)\n* LifoQueue (class in queue):            queue -- A synchronized queue class.\n(line   42)\n* light-weight processes:                thread -- Low-level threading API.\n(line    6)\n* limitdenominator() (fractions.Fraction method): fractions -- Rational numbers.\n(line  152)\n* LimitOverrunError:                     Exceptions<11>.     (line   61)\n* lin2adpcm() (in module audioop):       audioop -- Manipulate raw audio data.\n(line  115)\n* lin2alaw() (in module audioop):        audioop -- Manipulate raw audio data.\n(line  129)\n* lin2lin() (in module audioop):         audioop -- Manipulate raw audio data.\n(line  136)\n* lin2ulaw() (in module audioop):        audioop -- Manipulate raw audio data.\n(line  151)\n* line (bdb.Breakpoint attribute):       bdb -- Debugger framework.\n(line   86)\n* LINE (monitoring event):               Events.             (line   38)\n* line (traceback.FrameSummary attribute): FrameSummary Objects.\n(line   42)\n* line continuation:                     Explicit line joining.\n(line    6)\n* line joining:                          Logical lines.      (line    6)\n* line joining <1>:                      Explicit line joining.\n(line    6)\n* line structure:                        Line structure.     (line    6)\n* linebuffering (io.TextIOWrapper attribute): Text I/O<2>.  (line  170)\n* linenum (csv.csvreader attribute):    Reader Objects.     (line   23)\n* line-buffered I/O:                     Built-in Functions. (line 1326)\n* line() (msilib.Dialog method):         GUI classes.        (line   62)\n* linearregression() (in module statistics): Function details.\n(line  542)\n* lineno (ast.AST attribute):            Node classes.       (line   39)\n* lineno (doctest.DocTest attribute):    DocTest Objects.    (line   42)\n* lineno (doctest.Example attribute):    Example Objects.    (line   41)\n* lineno (inspect.FrameInfo attribute):  The interpreter stack.\n(line   22)\n* lineno (inspect.Traceback attribute):  The interpreter stack.\n(line   62)\n* lineno (json.JSONDecodeError attribute): Exceptions<15>.   (line   23)\n* lineno (netrc.NetrcParseError attribute): netrc -- netrc file processing.\n(line   58)\n* lineno (pyclbr.Class attribute):       Class Objects<2>.   (line   24)\n* lineno (pyclbr.Function attribute):    Function Objects.   (line   23)\n* lineno (re.error attribute):           Exceptions<3>.      (line   28)\n* lineno (shlex.shlex attribute):        shlex Objects.      (line  169)\n* lineno (SyntaxError attribute):        Concrete exceptions.\n(line  293)\n* lineno (traceback.FrameSummary attribute): FrameSummary Objects.\n(line   33)\n* lineno (traceback.TracebackException attribute): TracebackException Objects.\n(line   82)\n* lineno (tracemalloc.Filter attribute): Filter.             (line   49)\n* lineno (tracemalloc.Frame attribute):  Frame.              (line   17)\n* lineno (xml.parsers.expat.ExpatError attribute): ExpatError Exceptions.\n(line   27)\n* lineno() (in module fileinput):        fileinput -- Iterate over lines from multiple input streams.\n(line   97)\n* LINES:                                 Functions<6>.       (line  125)\n* LINES <1>:                             Functions<6>.       (line  595)\n* LINES <2>:                             Functions<6>.       (line  597)\n* LINES (in module curses):              Constants<6>.       (line   53)\n* lines (os.terminalsize attribute):    Querying the size of a terminal.\n(line   34)\n* linesep (email.policy.Policy attribute): email policy Policy Objects.\n(line  153)\n* linesep (in module os):                Miscellaneous System Information.\n(line  130)\n* lineterminator (csv.Dialect attribute): Dialects and Formatting Parameters.\n(line   45)\n* LineTooLong:                           http client -- HTTP protocol client.\n(line  183)\n* link() (in module os):                 Files and Directories.\n(line  345)\n* LinkFallbackError:                     tarfile -- Read and write tar archive files.\n(line  262)\n* linkname (tarfile.TarInfo attribute):  TarInfo Objects.    (line   95)\n* LinkOutsideDestinationError:           tarfile -- Read and write tar archive files.\n(line  257)\n* list:                                  Glossary.           (line  814)\n* list (built-in class):                 Lists<2>.           (line   10)\n* List (class in ast):                   Literals<3>.        (line   67)\n* List (class in typing):                Aliases to built-in types.\n(line   23)\n* list (pdb command):                    Debugger Commands.  (line  230)\n* list comprehension:                    Glossary.           (line  820)\n* LISTAPPEND (opcode):                  Python Bytecode Instructions.\n(line  321)\n* listdialects() (in module csv):       Module Contents<3>. (line   91)\n* LISTEXTEND (opcode):                  Python Bytecode Instructions.\n(line  641)\n* listfolders() (mailbox.Maildir method): Maildir objects.  (line   62)\n* listfolders() (mailbox.MH method):    MH objects.         (line   32)\n* list; comprehensions:                  List displays.      (line    6)\n* list; display:                         List displays.      (line    6)\n* list() (imaplib.IMAP4 method):         IMAP4 Objects.      (line  126)\n* list() (multiprocessing.managers.SyncManager method): Managers.\n(line  231)\n* list() (nntplib.NNTP method):          Methods<3>.         (line  104)\n* list() (poplib.POP3 method):           POP3 Objects.       (line   57)\n* list() (tarfile.TarFile method):       TarFile Objects.    (line  116)\n* ListComp (class in ast):               Comprehensions.     (line    6)\n* listdir() (in module os):              Files and Directories.\n(line  367)\n* listdrives() (in module os):           Files and Directories.\n(line  404)\n* listen() (in module logging.config):   Configuration functions.\n(line  118)\n* listen() (in module turtle):           Using screen events.\n(line    6)\n* listen() (socket.socket method):       Socket Objects.     (line  197)\n* Listener (class in multiprocessing.connection): Listeners and Clients.\n(line   50)\n* listener (logging.handlers.QueueHandler attribute): QueueHandler.\n(line   84)\n* listMethods() (xmlrpc.client.ServerProxy.system method): ServerProxy Objects.\n(line   17)\n* listmounts() (in module os):           Files and Directories.\n(line  423)\n* ListNoteBook (class in tkinter.tix):   Manager Widgets.    (line   13)\n* listvolumes() (in module os):          Files and Directories.\n(line  447)\n* listxattr() (in module os):            Linux extended attributes.\n(line   26)\n* literal:                               Literals.           (line    6)\n* literal <1>:                           Literals<2>.        (line    6)\n* Literal (in module typing):            Special forms.      (line  125)\n* literaleval() (in module ast):        ast Helpers.        (line   78)\n* LiteralString (in module typing):      Special types.      (line   57)\n* LittleEndianStructure (class in ctypes): Structured data types.\n(line   26)\n* LittleEndianUnion (class in ctypes):   Structured data types.\n(line   16)\n* ljust() (bytearray method):            Bytes and Bytearray Operations.\n(line  303)\n* ljust() (bytes method):                Bytes and Bytearray Operations.\n(line  303)\n* ljust() (str method):                  String Methods<2>.  (line  310)\n* LKLOCK (in module msvcrt):            File Operations.    (line   19)\n* LKNBLCK (in module msvcrt):           File Operations.    (line   27)\n* LKNBRLCK (in module msvcrt):          File Operations.    (line   27)\n* LKRLCK (in module msvcrt):            File Operations.    (line   19)\n* LKUNLCK (in module msvcrt):           File Operations.    (line   33)\n* ll (pdb command):                      Debugger Commands.  (line  246)\n* LMTP (class in smtplib):               smtplib -- SMTP protocol client.\n(line  106)\n* ln() (decimal.Context method):         Context objects.    (line  355)\n* ln() (decimal.Decimal method):         Decimal objects.    (line  332)\n* LNKTYPE (in module tarfile):           tarfile -- Read and write tar archive files.\n(line  283)\n* Load (class in ast):                   Variables.          (line   11)\n* LOADASSERTIONERROR (opcode):         Python Bytecode Instructions.\n(line  438)\n* LOADATTR (opcode):                    Python Bytecode Instructions.\n(line  681)\n* LOADBUILDCLASS (opcode):             Python Bytecode Instructions.\n(line  445)\n* loadcertchain() (ssl.SSLContext method): SSL Contexts.   (line   91)\n* LOADCLOSURE (opcode):                 Python Bytecode Instructions.\n(line  879)\n* LOADCONST (opcode):                   Python Bytecode Instructions.\n(line  569)\n* loaddefaultcerts() (ssl.SSLContext method): SSL Contexts.\n(line  122)\n* LOADDEREF (opcode):                   Python Bytecode Instructions.\n(line  891)\n* loaddhparams() (ssl.SSLContext method): SSL Contexts.    (line  342)\n* loadextension() (sqlite3.Connection method): Connection objects.\n(line  453)\n* LOADFAST (opcode):                    Python Bytecode Instructions.\n(line  839)\n* LOADFASTANDCLEAR (opcode):          Python Bytecode Instructions.\n(line  856)\n* LOADFASTCHECK (opcode):              Python Bytecode Instructions.\n(line  848)\n* LOADFROMDICTORDEREF (opcode):      Python Bytecode Instructions.\n(line  899)\n* LOADFROMDICTORGLOBALS (opcode):    Python Bytecode Instructions.\n(line  588)\n* LOADGLOBAL (opcode):                  Python Bytecode Instructions.\n(line  832)\n* LOADLOCALS (opcode):                  Python Bytecode Instructions.\n(line  579)\n* LOADMETHOD (opcode):                  Python Bytecode Instructions.\n(line 1300)\n* loadmodule() (importlib.abc.FileLoader method): importlib abc - Abstract base classes related to import.\n(line  341)\n* loadmodule() (importlib.abc.InspectLoader method): importlib abc - Abstract base classes related to import.\n(line  294)\n* loadmodule() (importlib.abc.Loader method): importlib abc - Abstract base classes related to import.\n(line  127)\n* loadmodule() (importlib.abc.SourceLoader method): importlib abc - Abstract base classes related to import.\n(line  441)\n* loadmodule() (importlib.machinery.SourceFileLoader method): importlib machinery - Importers and path hooks.\n(line  235)\n* loadmodule() (importlib.machinery.SourcelessFileLoader method): importlib machinery - Importers and path hooks.\n(line  279)\n* loadmodule() (zipimport.zipimporter method): zipimporter Objects.\n(line   79)\n* LOADNAME (opcode):                    Python Bytecode Instructions.\n(line  573)\n* loadpackagetests() (in module test.support): test support -- Utilities for the Python test suite.\n(line  618)\n* LOADSUPERATTR (opcode):              Python Bytecode Instructions.\n(line  699)\n* loadverifylocations() (ssl.SSLContext method): SSL Contexts.\n(line  139)\n* load() (http.cookiejar.FileCookieJar method): CookieJar and FileCookieJar Objects.\n(line  126)\n* load() (http.cookies.BaseCookie method): Cookie Objects.   (line   40)\n* load() (in module json):               Basic Usage.        (line   94)\n* load() (in module marshal):            marshal -- Internal Python object serialization.\n(line   63)\n* load() (in module pickle):             Module Interface.   (line   58)\n* load() (in module plistlib):           plistlib -- Generate and parse Apple plist files.\n(line   46)\n* load() (in module tomllib):            tomllib -- Parse TOML files.\n(line   32)\n* load() (pickle.Unpickler method):      Module Interface.   (line  268)\n* load() (tracemalloc.Snapshot class method): Snapshot.      (line   50)\n* loader:                                Finders and loaders.\n(line    6)\n* loader <1>:                            Glossary.           (line  829)\n* Loader (class in importlib.abc):       importlib abc - Abstract base classes related to import.\n(line   91)\n* loader (importlib.machinery.ModuleSpec attribute): importlib machinery - Importers and path hooks.\n(line  387)\n* loaderstate (importlib.machinery.ModuleSpec attribute): importlib machinery - Importers and path hooks.\n(line  416)\n* LoadError:                             http cookiejar -- Cookie handling for HTTP clients.\n(line   34)\n* LoadFileDialog (class in tkinter.filedialog): Native Load/Save Dialogs.\n(line  135)\n* LoadKey() (in module winreg):          Functions<13>.      (line  258)\n* LoadLibrary() (ctypes.LibraryLoader method): Loading shared libraries.\n(line  178)\n* loads() (in module json):              Basic Usage.        (line  154)\n* loads() (in module marshal):           marshal -- Internal Python object serialization.\n(line   95)\n* loads() (in module pickle):            Module Interface.   (line   76)\n* loads() (in module plistlib):          plistlib -- Generate and parse Apple plist files.\n(line   74)\n* loads() (in module tomllib):           tomllib -- Parse TOML files.\n(line   48)\n* loads() (in module xmlrpc.client):     Convenience Functions.\n(line   19)\n* loadTestsFromModule() (unittest.TestLoader method): Loading and running tests.\n(line   41)\n* loadTestsFromName() (unittest.TestLoader method): Loading and running tests.\n(line   70)\n* loadTestsFromNames() (unittest.TestLoader method): Loading and running tests.\n(line  104)\n* loadTestsFromTestCase() (unittest.TestLoader method): Loading and running tests.\n(line   29)\n* local (class in threading):            Thread-Local Data.  (line   15)\n* LOCALCREDS (in module socket):        Constants<8>.       (line  314)\n* LOCALCREDSPERSISTENT (in module socket): Constants<8>.   (line  314)\n* localcontext() (in module decimal):    Context objects.    (line   25)\n* LOCALE (in module re):                 Flags.              (line   58)\n* locale encoding:                       Glossary.           (line  836)\n* localeconv() (in module locale):       locale -- Internationalization services.\n(line   53)\n* LocaleHTMLCalendar (class in calendar): calendar -- General calendar-related functions.\n(line  276)\n* LocaleTextCalendar (class in calendar): calendar -- General calendar-related functions.\n(line  270)\n* localize() (in module locale):         locale -- Internationalization services.\n(line  500)\n* localName (xml.dom.Attr attribute):    Attr Objects.       (line   13)\n* localName (xml.dom.Node attribute):    Node Objects.       (line   64)\n* localtime() (in module email.utils):   email utils Miscellaneous utilities.\n(line   13)\n* localtime() (in module time):          Functions<5>.       (line  149)\n* Locator (class in xml.sax.xmlreader):  xml sax xmlreader -- Interface for XML parsers.\n(line   43)\n* Lock (class in asyncio):               Lock.               (line    6)\n* Lock (class in multiprocessing):       Synchronization primitives.\n(line   46)\n* Lock (class in threading):             Lock Objects.       (line   33)\n* lock (sys.threadinfo attribute):      sys -- System-specific parameters and functions.\n(line 1869)\n* LOCKEX (in module fcntl):             fcntl -- The fcntl and ioctl system calls.\n(line  158)\n* LOCKNB (in module fcntl):             fcntl -- The fcntl and ioctl system calls.\n(line  162)\n* LOCKSH (in module fcntl):             fcntl -- The fcntl and ioctl system calls.\n(line  154)\n* LOCKUN (in module fcntl):             fcntl -- The fcntl and ioctl system calls.\n(line  150)\n* lock, interpreter:                     Thread State and the Global Interpreter Lock.\n(line    6)\n* lock() (mailbox.Babyl method):         Babyl objects.      (line   59)\n* lock() (mailbox.Mailbox method):       Mailbox objects.    (line  256)\n* lock() (mailbox.Maildir method):       Maildir objects.    (line  108)\n* lock() (mailbox.mbox method):          mbox objects.       (line   38)\n* lock() (mailbox.MH method):            MH objects.         (line   84)\n* lock() (mailbox.MMDF method):          MMDF objects.       (line   35)\n* Lock() (multiprocessing.managers.SyncManager method): Managers.\n(line  188)\n* locked() (thread.lock method):        thread -- Low-level threading API.\n(line  173)\n* locked() (asyncio.Condition method):   Condition.          (line   63)\n* locked() (asyncio.Lock method):        Lock.               (line   58)\n* locked() (asyncio.Semaphore method):   Semaphore.          (line   50)\n* locked() (threading.Lock method):      Lock Objects.       (line   87)\n* lockf() (in module fcntl):             fcntl -- The fcntl and ioctl system calls.\n(line  143)\n* lockf() (in module os):                File Descriptor Operations.\n(line  251)\n* locking() (in module msvcrt):          File Operations.    (line    6)\n* LockType (in module thread):          thread -- Low-level threading API.\n(line   28)\n* logdatetimestring() (http.server.BaseHTTPRequestHandler method): http server -- HTTP servers.\n(line  330)\n* logerror() (http.server.BaseHTTPRequestHandler method): http server -- HTTP servers.\n(line  299)\n* logexception() (wsgiref.handlers.BaseHandler method): wsgiref handlers - server/gateway base classes.\n(line  212)\n* logmessage() (http.server.BaseHTTPRequestHandler method): http server -- HTTP servers.\n(line  305)\n* logrequest() (http.server.BaseHTTPRequestHandler method): http server -- HTTP servers.\n(line  292)\n* logtostderr() (in module multiprocessing): Logging<2>.   (line   24)\n* log() (in module cmath):               Power and logarithmic functions<2>.\n(line   11)\n* log() (in module logging):             Module-Level Functions.\n(line   97)\n* log() (in module math):                Power and logarithmic functions.\n(line   40)\n* log() (logging.Logger method):         Logger Objects.     (line  312)\n* log10() (decimal.Context method):      Context objects.    (line  359)\n* log10() (decimal.Decimal method):      Decimal objects.    (line  338)\n* log10() (in module cmath):             Power and logarithmic functions<2>.\n(line   17)\n* log10() (in module math):              Power and logarithmic functions.\n(line   67)\n* log1p() (in module math):              Power and logarithmic functions.\n(line   48)\n* log2() (in module math):               Power and logarithmic functions.\n(line   53)\n* logb() (decimal.Context method):       Context objects.    (line  363)\n* logb() (decimal.Decimal method):       Decimal objects.    (line  344)\n* Logger (class in logging):             Logger Objects.     (line   23)\n* LoggerAdapter (class in logging):      LoggerAdapter Objects.\n(line   11)\n* logical line:                          Logical lines.      (line    6)\n* logicaland() (decimal.Context method): Context objects.   (line  367)\n* logicaland() (decimal.Decimal method): Decimal objects.   (line  352)\n* logicalinvert() (decimal.Context method): Context objects.\n(line  372)\n* logicalinvert() (decimal.Decimal method): Decimal objects.\n(line  358)\n* logicalor() (decimal.Context method): Context objects.    (line  376)\n* logicalor() (decimal.Decimal method): Decimal objects.    (line  363)\n* logicalxor() (decimal.Context method): Context objects.   (line  381)\n* logicalxor() (decimal.Decimal method): Decimal objects.   (line  369)\n* logincrammd5() (imaplib.IMAP4 method): IMAP4 Objects.    (line  137)\n* logintty() (in module os):            File Descriptor Operations.\n(line  277)\n* login() (ftplib.FTP method):           FTP objects.        (line  128)\n* login() (imaplib.IMAP4 method):        IMAP4 Objects.      (line  132)\n* login() (nntplib.NNTP method):         Methods<3>.         (line   48)\n* login() (smtplib.SMTP method):         SMTP Objects.       (line  102)\n* LOGNAME:                               Process Parameters. (line  239)\n* LOGNAME <1>:                           getpass -- Portable password input.\n(line   44)\n* lognormvariate() (in module random):   Real-valued distributions.\n(line   78)\n* logout() (imaplib.IMAP4 method):       IMAP4 Objects.      (line  143)\n* LogRecord (class in logging):          LogRecord Objects.  (line   11)\n* long (2to3 fixer):                     Fixers.             (line  181)\n* LONGMAX (C macro):                    Integer Objects.    (line  113)\n* LONGTIMEOUT (in module test.support): test support -- Utilities for the Python test suite.\n(line   93)\n* longMessage (unittest.TestCase attribute): Test cases.     (line  701)\n* longname() (in module curses):         Functions<6>.       (line  280)\n* lookuperror() (in module codecs):     Error Handlers.     (line  130)\n* lookup() (in module codecs):           codecs -- Codec registry and base classes.\n(line   47)\n* lookup() (in module unicodedata):      unicodedata -- Unicode Database.\n(line   16)\n* lookup() (symtable.SymbolTable method): Examining Symbol Tables.\n(line   61)\n* lookup() (tkinter.ttk.Style method):   Ttk Styling.        (line   81)\n* LookupError:                           Base classes.       (line   83)\n* loop control; target:                  The break statement.\n(line   12)\n* loop; over mutable sequence:           Common Sequence Operations.\n(line   75)\n* loop; statement:                       The break statement.\n(line    6)\n* loop; statement <1>:                   The continue statement.\n(line    6)\n* loop; statement <2>:                   The while statement.\n(line    6)\n* loop; statement <3>:                   The for statement.  (line    6)\n* LOOPBACKTIMEOUT (in module test.support): test support -- Utilities for the Python test suite.\n(line   48)\n* lower() (bytearray method):            Bytes and Bytearray Operations.\n(line  621)\n* lower() (bytes method):                Bytes and Bytearray Operations.\n(line  621)\n* lower() (str method):                  String Methods<2>.  (line  317)\n* LPAR (in module token):                token -- Constants used with Python parse trees.\n(line   54)\n* lpAttributeList (subprocess.STARTUPINFO attribute): Windows Popen Helpers.\n(line   60)\n* lrucache() (in module functools):     functools -- Higher-order functions and operations on callable objects.\n(line  143)\n* lseek() (in module os):                File Descriptor Operations.\n(line  288)\n* LShift (class in ast):                 Expressions<2>.     (line   54)\n* lshift() (in module operator):         operator -- Standard operators as functions.\n(line  110)\n* LSQB (in module token):                token -- Constants used with Python parse trees.\n(line   62)\n* lstat() (in module os):                Files and Directories.\n(line  468)\n* lstat() (pathlib.Path method):         Methods<2>.         (line  361)\n* lstrip() (bytearray method):           Bytes and Bytearray Operations.\n(line  315)\n* lstrip() (bytes method):               Bytes and Bytearray Operations.\n(line  315)\n* lstrip() (str method):                 String Methods<2>.  (line  325)\n* lsub() (imaplib.IMAP4 method):         IMAP4 Objects.      (line  150)\n* Lt (class in ast):                     Expressions<2>.     (line  109)\n* lt() (in module operator):             operator -- Standard operators as functions.\n(line   24)\n* lt() (in module turtle):               Turtle motion.      (line   57)\n* LtE (class in ast):                    Expressions<2>.     (line  109)\n* LWPCookieJar (class in http.cookiejar): FileCookieJar subclasses and co-operation with web browsers.\n(line   28)\n* LZMACompressor (class in lzma):        Compressing and decompressing data in memory.\n(line    6)\n* LZMADecompressor (class in lzma):      Compressing and decompressing data in memory.\n(line  100)\n* LZMAError:                             lzma -- Compression using the LZMA algorithm.\n(line   24)\n* LZMAFile (class in lzma):              Reading and writing compressed files.\n(line   45)\n* M (in module re):                      Flags.              (line   82)\n* macver() (in module platform):        macOS Platform.     (line    6)\n* machine() (in module platform):        Cross Platform.     (line   35)\n* macros (netrc.netrc attribute):        netrc Objects.      (line   29)\n* MADVAUTOSYNC (in module mmap):        MADV* Constants.   (line    6)\n* MADVCORE (in module mmap):            MADV* Constants.   (line    6)\n* MADVDODUMP (in module mmap):          MADV* Constants.   (line    6)\n* MADVDOFORK (in module mmap):          MADV* Constants.   (line    6)\n* MADVDONTDUMP (in module mmap):        MADV* Constants.   (line    6)\n* MADVDONTFORK (in module mmap):        MADV* Constants.   (line    6)\n* MADVDONTNEED (in module mmap):        MADV* Constants.   (line    6)\n* MADVFREE (in module mmap):            MADV* Constants.   (line    6)\n* MADVFREEREUSABLE (in module mmap):   MADV* Constants.   (line    6)\n* MADVFREEREUSE (in module mmap):      MADV* Constants.   (line    6)\n* MADVHUGEPAGE (in module mmap):        MADV* Constants.   (line    6)\n* MADVHWPOISON (in module mmap):        MADV* Constants.   (line    6)\n* MADVMERGEABLE (in module mmap):       MADV* Constants.   (line    6)\n* MADVNOCORE (in module mmap):          MADV* Constants.   (line    6)\n* MADVNOHUGEPAGE (in module mmap):      MADV* Constants.   (line    6)\n* MADVNORMAL (in module mmap):          MADV* Constants.   (line    6)\n* MADVNOSYNC (in module mmap):          MADV* Constants.   (line    6)\n* MADVPROTECT (in module mmap):         MADV* Constants.   (line    6)\n* MADVRANDOM (in module mmap):          MADV* Constants.   (line    6)\n* MADVREMOVE (in module mmap):          MADV* Constants.   (line    6)\n* MADVSEQUENTIAL (in module mmap):      MADV* Constants.   (line    6)\n* MADVSOFTOFFLINE (in module mmap):    MADV* Constants.   (line    6)\n* MADVUNMERGEABLE (in module mmap):     MADV* Constants.   (line    6)\n* MADVWILLNEED (in module mmap):        MADV* Constants.   (line    6)\n* madvise() (mmap.mmap method):          mmap -- Memory-mapped file support.\n(line  216)\n* magic method:                          Glossary.           (line  851)\n* MAGICNUMBER (in module importlib.util): importlib util - Utility code for importers.\n(line   13)\n* magic; method:                         Glossary.           (line  855)\n* MagicMock (class in unittest.mock):    Magic Mock.         (line    9)\n* Mailbox (class in mailbox):            Mailbox objects.    (line    6)\n* Maildir (class in mailbox):            Maildir objects.    (line    6)\n* MaildirMessage (class in mailbox):     MaildirMessage objects.\n(line    6)\n* mainthread() (in module threading):   threading -- Thread-based parallelism.\n(line  150)\n* main():                                Process-wide parameters.\n(line    9)\n* main() <1>:                            Process-wide parameters.\n(line   42)\n* main() <2>:                            Process-wide parameters.\n(line  271)\n* main() (in module site):               Module contents<5>. (line   41)\n* main() (in module unittest):           Loading and running tests.\n(line  509)\n* mainloop() (in module turtle):         Using screen events.\n(line  106)\n* maintype (email.headerregistry.ContentTypeHeader attribute): email headerregistry Custom Header Objects.\n(line  276)\n* major (email.headerregistry.MIMEVersionHeader attribute): email headerregistry Custom Header Objects.\n(line  247)\n* major() (in module os):                Files and Directories.\n(line  607)\n* makealternative() (email.message.EmailMessage method): email message Representing an email message.\n(line  607)\n* makearchive() (in module shutil):     Archiving operations.\n(line   14)\n* makebadfd() (in module test.support.oshelper): test support oshelper -- Utilities for os tests.\n(line  106)\n* MAKECELL (opcode):                    Python Bytecode Instructions.\n(line  872)\n* makecookies() (http.cookiejar.CookieJar method): CookieJar and FileCookieJar Objects.\n(line   61)\n* makedataclass() (in module dataclasses): Module contents<4>.\n(line  367)\n* makefile() (difflib.HtmlDiff method): difflib -- Helpers for computing deltas.\n(line  112)\n* MAKEFUNCTION (opcode):                Python Bytecode Instructions.\n(line 1012)\n* makeheader() (in module email.header): email header Internationalized headers.\n(line  200)\n* makelegacypyc() (in module test.support.importhelper): test support importhelper -- Utilities for import tests.\n(line   80)\n* makemixed() (email.message.EmailMessage method): email message Representing an email message.\n(line  617)\n* makemsgid() (in module email.utils):  email utils Miscellaneous utilities.\n(line   27)\n* makeparser() (in module xml.sax):     xml sax -- Support for SAX2 parsers.\n(line   28)\n* makepkg() (in module test.support.scripthelper): test support scripthelper -- Utilities for the Python execution tests.\n(line   97)\n* makerelated() (email.message.EmailMessage method): email message Representing an email message.\n(line  598)\n* makescript() (in module test.support.scripthelper): test support scripthelper -- Utilities for the Python execution tests.\n(line   82)\n* makeserver() (in module wsgiref.simpleserver): wsgiref simpleserver - a simple WSGI HTTP server.\n(line   14)\n* maketable() (difflib.HtmlDiff method): difflib -- Helpers for computing deltas.\n(line  144)\n* makezippkg() (in module test.support.scripthelper): test support scripthelper -- Utilities for the Python execution tests.\n(line  103)\n* makezipscript() (in module test.support.scripthelper): test support scripthelper -- Utilities for the Python execution tests.\n(line   89)\n* makedev() (in module os):              Files and Directories.\n(line  617)\n* makedirs() (in module os):             Files and Directories.\n(line  526)\n* makeelement() (xml.etree.ElementTree.Element method): Element Objects.\n(line  164)\n* makefile() (socket method):            I/O objects also known as file objects.\n(line    6)\n* makefile() (socket.socket method):     Socket Objects.     (line  209)\n* makeLogRecord() (in module logging):   Module-Level Functions.\n(line  194)\n* makePickle() (logging.handlers.SocketHandler method): SocketHandler.\n(line   45)\n* makeRecord() (logging.Logger method):  Logger Objects.     (line  373)\n* makeSocket() (logging.handlers.DatagramHandler method): DatagramHandler.\n(line   37)\n* makeSocket() (logging.handlers.SocketHandler method): SocketHandler.\n(line   39)\n* maketrans() (bytearray static method): Bytes and Bytearray Operations.\n(line  176)\n* maketrans() (bytes static method):     Bytes and Bytearray Operations.\n(line  176)\n* maketrans() (str static method):       String Methods<2>.  (line  347)\n* malloc (C function):                   Overview<4>.        (line   33)\n* manager (logging.LoggerAdapter attribute): LoggerAdapter Objects.\n(line   25)\n* manglefrom (email.policy.Compat32 attribute): email policy Policy Objects.\n(line  574)\n* manglefrom (email.policy.Policy attribute): email policy Policy Objects.\n(line  187)\n* mantdig (sys.floatinfo attribute):   sys -- System-specific parameters and functions.\n(line  623)\n* map (2to3 fixer):                      Fixers.             (line  185)\n* MAPADD (opcode):                      Python Bytecode Instructions.\n(line  330)\n* MAPALIGNEDSUPER (in module mmap):    MAP* Constants.    (line    6)\n* MAPANON (in module mmap):             MAP* Constants.    (line    6)\n* MAPANONYMOUS (in module mmap):        MAP* Constants.    (line    6)\n* mapasync() (multiprocessing.pool.Pool method): Process Pools.\n(line  107)\n* MAPCONCEAL (in module mmap):          MAP* Constants.    (line    6)\n* MAPDENYWRITE (in module mmap):        MAP* Constants.    (line    6)\n* MAPEXECUTABLE (in module mmap):       MAP* Constants.    (line    6)\n* MAPPOPULATE (in module mmap):         MAP* Constants.    (line    6)\n* MAPPRIVATE (in module mmap):          MAP* Constants.    (line    6)\n* MAPSHARED (in module mmap):           MAP* Constants.    (line    6)\n* MAPSTACK (in module mmap):            MAP* Constants.    (line    6)\n* maptableb2() (in module stringprep): stringprep -- Internet String Preparation.\n(line   50)\n* maptableb3() (in module stringprep): stringprep -- Internet String Preparation.\n(line   55)\n* maptotype() (email.headerregistry.HeaderRegistry method): email headerregistry Custom Header Objects.\n(line  376)\n* map() (concurrent.futures.Executor method): Executor Objects.\n(line   22)\n* map() (multiprocessing.pool.Pool method): Process Pools.   (line   90)\n* map() (tkinter.ttk.Style method):      Ttk Styling.        (line   48)\n* mapLogRecord() (logging.handlers.HTTPHandler method): HTTPHandler.\n(line   27)\n* mapping:                               Glossary.           (line  855)\n* Mapping (class in collections.abc):    Collections Abstract Base Classes - Detailed Descriptions.\n(line   91)\n* Mapping (class in typing):             Aliases to container ABCs in collections abc.\n(line   58)\n* mapping() (msilib.Control method):     GUI classes.        (line   18)\n* MappingProxyType (class in types):     Standard Interpreter Types.\n(line  268)\n* MappingView (class in collections.abc): Collections Abstract Base Classes - Detailed Descriptions.\n(line   96)\n* MappingView (class in typing):         Aliases to container ABCs in collections abc.\n(line   71)\n* mapPriority() (logging.handlers.SysLogHandler method): SysLogHandler.\n(line  201)\n* maps (collections.ChainMap attribute): ChainMap objects.   (line   39)\n* maps() (in module nis):                nis -- Interface to Sun's NIS Yellow Pages.\n(line   50)\n* MARCH (in module calendar):            calendar -- General calendar-related functions.\n(line  414)\n* markcoroutinefunction() (in module inspect): Types and members.\n(line  381)\n* marshalling; objects:                  pickle -- Python object serialization.\n(line    8)\n* masking; operations:                   Bitwise Operations on Integer Types.\n(line    6)\n* master (tkinter.Tk attribute):         Tkinter Modules.    (line   77)\n* Match (class in ast):                  Pattern matching.   (line    6)\n* Match (class in re):                   Match Objects.      (line   15)\n* Match (class in typing):               Aliases to other concrete types.\n(line   10)\n* matchcase (class in ast):             Pattern matching.   (line   15)\n* MATCHCLASS (opcode):                  Python Bytecode Instructions.\n(line 1086)\n* MATCHKEYS (opcode):                   Python Bytecode Instructions.\n(line  486)\n* MATCHMAPPING (opcode):                Python Bytecode Instructions.\n(line  467)\n* MATCHSEQUENCE (opcode):               Python Bytecode Instructions.\n(line  476)\n* matchvalue() (test.support.Matcher method): test support -- Utilities for the Python test suite.\n(line  781)\n* match; case:                           The match statement.\n(line    6)\n* match() (in module nis):               nis -- Interface to Sun's NIS Yellow Pages.\n(line   25)\n* match() (in module re):                Functions<2>.       (line   44)\n* match() (pathlib.PurePath method):     Methods and properties.\n(line  257)\n* match() (re.Pattern method):           Regular Expression Objects.\n(line   43)\n* MatchAs (class in ast):                Pattern matching.   (line  306)\n* MatchClass (class in ast):             Pattern matching.   (line  239)\n* Matcher (class in test.support):       test support -- Utilities for the Python test suite.\n(line  775)\n* matches() (test.support.Matcher method): test support -- Utilities for the Python test suite.\n(line  777)\n* MatchMapping (class in ast):           Pattern matching.   (line  192)\n* MatchOr (class in ast):                Pattern matching.   (line  347)\n* MatchSequence (class in ast):          Pattern matching.   (line  120)\n* MatchSingleton (class in ast):         Pattern matching.   (line   95)\n* MatchStar (class in ast):              Pattern matching.   (line  151)\n* MatchValue (class in ast):             Pattern matching.   (line   67)\n* matmul() (in module operator):         operator -- Standard operators as functions.\n(line  125)\n* MatMult (class in ast):                Expressions<2>.     (line   54)\n* matrix multiplication:                 Binary arithmetic operations.\n(line   26)\n* max (datetime.date attribute):         date Objects.       (line  105)\n* max (datetime.datetime attribute):     datetime Objects.   (line  273)\n* max (datetime.time attribute):         time Objects.       (line   37)\n* max (datetime.timedelta attribute):    timedelta Objects.  (line   78)\n* max (sys.floatinfo attribute):        sys -- System-specific parameters and functions.\n(line  628)\n* max10exp (sys.floatinfo attribute): sys -- System-specific parameters and functions.\n(line  637)\n* maxcount (email.headerregistry.BaseHeader attribute): email headerregistry Custom Header Objects.\n(line   60)\n* MAXEMAX (in module decimal):          Constants<4>.       (line   16)\n* maxexp (sys.floatinfo attribute):    sys -- System-specific parameters and functions.\n(line  632)\n* MAXINTERPOLATIONDEPTH (in module configparser): ConfigParser Objects.\n(line  307)\n* maxlinelength (email.policy.Policy attribute): email policy Policy Objects.\n(line  146)\n* maxlines (textwrap.TextWrapper attribute): textwrap -- Text wrapping and filling.\n(line  268)\n* maxmag() (decimal.Context method):    Context objects.    (line  390)\n* maxmag() (decimal.Decimal method):    Decimal objects.    (line  382)\n* maxmemuse (in module test.support):   test support -- Utilities for the Python test suite.\n(line  145)\n* MAXPREC (in module decimal):          Constants<4>.       (line   13)\n* maxprefixlen (ipaddress.IPv4Address attribute): Address objects.\n(line   49)\n* maxprefixlen (ipaddress.IPv4Network attribute): Network objects.\n(line   65)\n* maxprefixlen (ipaddress.IPv6Address attribute): Address objects.\n(line  255)\n* maxprefixlen (ipaddress.IPv6Network attribute): Network objects.\n(line  295)\n* MAXPyssizet (in module test.support): test support -- Utilities for the Python test suite.\n(line  141)\n* max() (decimal.Context method):        Context objects.    (line  386)\n* max() (decimal.Decimal method):        Decimal objects.    (line  375)\n* max() (in module audioop):             audioop -- Manipulate raw audio data.\n(line  158)\n* maxarray (reprlib.Repr attribute):     Repr Objects.       (line   22)\n* maxdeque (reprlib.Repr attribute):     Repr Objects.       (line   22)\n* maxdict (reprlib.Repr attribute):      Repr Objects.       (line   22)\n* maxDiff (unittest.TestCase attribute): Test cases.         (line  718)\n* maxfrozenset (reprlib.Repr attribute): Repr Objects.       (line   22)\n* MAXIMUMSUPPORTED (ssl.TLSVersion attribute): Constants<9>.\n(line  558)\n* maximumversion (ssl.SSLContext attribute): SSL Contexts.  (line  528)\n* maxlen (collections.deque attribute):  deque objects.      (line  120)\n* maxlevel (reprlib.Repr attribute):     Repr Objects.       (line   17)\n* maxlist (reprlib.Repr attribute):      Repr Objects.       (line   22)\n* maxlong (reprlib.Repr attribute):      Repr Objects.       (line   34)\n* maxother (reprlib.Repr attribute):     Repr Objects.       (line   47)\n* maxpp() (in module audioop):           audioop -- Manipulate raw audio data.\n(line  163)\n* maxset (reprlib.Repr attribute):       Repr Objects.       (line   22)\n* maxsize (asyncio.Queue attribute):     Queue.              (line   23)\n* maxsize (in module sys):               sys -- System-specific parameters and functions.\n(line 1186)\n* maxstring (reprlib.Repr attribute):    Repr Objects.       (line   39)\n* maxtuple (reprlib.Repr attribute):     Repr Objects.       (line   22)\n* maxunicode (in module sys):            sys -- System-specific parameters and functions.\n(line 1192)\n* MAXYEAR (in module datetime):          Constants.          (line   13)\n* MAY (in module calendar):              calendar -- General calendar-related functions.\n(line  414)\n* MBICONASTERISK (in module winsound):  winsound -- Sound-playing interface for Windows.\n(line  128)\n* MBICONEXCLAMATION (in module winsound): winsound -- Sound-playing interface for Windows.\n(line  132)\n* MBICONHAND (in module winsound):      winsound -- Sound-playing interface for Windows.\n(line  136)\n* MBICONQUESTION (in module winsound):  winsound -- Sound-playing interface for Windows.\n(line  140)\n* MBOK (in module winsound):            winsound -- Sound-playing interface for Windows.\n(line  144)\n* mbox (class in mailbox):               mbox objects.       (line    6)\n* mboxMessage (class in mailbox):        mboxMessage objects.\n(line    6)\n* md5() (in module hashlib):             Constructors.       (line   20)\n* mean (statistics.NormalDist attribute): NormalDist objects.\n(line   21)\n* mean() (in module statistics):         Function details.   (line   10)\n* measure() (tkinter.font.Font method):  tkinter font -- Tkinter font wrapper.\n(line   63)\n* median (statistics.NormalDist attribute): NormalDist objects.\n(line   26)\n* mediangrouped() (in module statistics): Function details. (line  200)\n* medianhigh() (in module statistics):  Function details.   (line  182)\n* medianlow() (in module statistics):   Function details.   (line  164)\n* median() (in module statistics):       Function details.   (line  137)\n* member() (in module enum):             Utilities and Decorators.\n(line   79)\n* MemberDescriptorType (in module types): Standard Interpreter Types.\n(line  252)\n* membership; test:                      Membership test operations.\n(line   36)\n* memfdcreate() (in module os):         Files and Directories.\n(line 1785)\n* memmove() (in module ctypes):          Utility functions.  (line  137)\n* MemoryBIO (class in ssl):              Memory BIO Support<2>.\n(line  130)\n* MemoryError:                           Concrete exceptions.\n(line  100)\n* MemoryHandler (class in logging.handlers): MemoryHandler.  (line   41)\n* memoryview (built-in class):           Memory Views.       (line   10)\n* memset() (in module ctypes):           Utility functions.  (line  143)\n* merge() (in module heapq):             heapq -- Heap queue algorithm.\n(line   79)\n* message (BaseExceptionGroup attribute): Exception groups.  (line   33)\n* Message (class in email.message):      email message Message Representing an email message using the compat32 API.\n(line   49)\n* Message (class in mailbox):            Message objects.    (line    6)\n* Message (class in tkinter.messagebox): tkinter messagebox -- Tkinter message prompts.\n(line   21)\n* message digest, MD5:                   hashlib -- Secure hashes and message digests.\n(line    8)\n* messagefactory (email.policy.Policy attribute): email policy Policy Objects.\n(line  196)\n* messagefrombinaryfile() (in module email): Parser API.  (line  130)\n* messagefrombytes() (in module email): Parser API.        (line  117)\n* messagefromfile() (in module email): Parser API.         (line  153)\n* messagefromstring() (in module email): Parser API.       (line  143)\n* MessageBeep() (in module winsound):    winsound -- Sound-playing interface for Windows.\n(line   31)\n* MessageClass (http.server.BaseHTTPRequestHandler attribute): http server -- HTTP servers.\n(line  174)\n* MessageDefect:                         email errors Exception and Defect classes.\n(line   62)\n* MessageError:                          email errors Exception and Defect classes.\n(line   13)\n* MessageParseError:                     email errors Exception and Defect classes.\n(line   19)\n* messages (in module xml.parsers.expat.errors): Expat error constants.\n(line   22)\n* meta hooks:                            Import hooks.       (line    6)\n* meta path finder:                      Glossary.           (line  865)\n* metapath (in module sys):             sys -- System-specific parameters and functions.\n(line 1202)\n* meta() (in module curses):             Functions<6>.       (line  287)\n* metaclass:                             Metaclasses.        (line    6)\n* metaclass <1>:                         Glossary.           (line  874)\n* metaclass (2to3 fixer):                Fixers.             (line  191)\n* metaclass hint:                        Determining the appropriate metaclass.\n(line    6)\n* MetaPathFinder (class in importlib.abc): importlib abc - Abstract base classes related to import.\n(line   27)\n* metavar (optparse.Option attribute):   Option attributes.  (line   88)\n* MetavarTypeHelpFormatter (class in argparse): formatterclass.\n(line   10)\n* Meter (class in tkinter.tix):          Basic Widgets.      (line   44)\n* METHCLASS (C macro):                  Implementing functions and methods.\n(line  195)\n* METHCOEXIST (C macro):                Implementing functions and methods.\n(line  212)\n* METHFASTCALL (C macro):               Implementing functions and methods.\n(line  124)\n* METHKEYWORDS (C macro):               Implementing functions and methods.\n(line  108)\n* METHMETHOD (C macro):                 Implementing functions and methods.\n(line  151)\n* METHNOARGS (C macro):                 Implementing functions and methods.\n(line  169)\n* METHO (C macro):                      Implementing functions and methods.\n(line  182)\n* METHSTATIC (C macro):                 Implementing functions and methods.\n(line  202)\n* METHVARARGS (C macro):                Implementing functions and methods.\n(line   98)\n* method:                                Glossary.           (line  889)\n* method (urllib.request.Request attribute): Request Objects.\n(line   52)\n* method resolution order:               Glossary.           (line  897)\n* METHODBLOWFISH (in module crypt):     Hashing Methods.    (line   22)\n* methodcalls (unittest.mock.Mock attribute): The Mock Class.\n(line  483)\n* METHODCRYPT (in module crypt):        Hashing Methods.    (line   34)\n* METHODMD5 (in module crypt):          Hashing Methods.    (line   29)\n* METHODSHA256 (in module crypt):       Hashing Methods.    (line   17)\n* METHODSHA512 (in module crypt):       Hashing Methods.    (line   11)\n* method; call:                          Calls.              (line  141)\n* methodattrs (2to3 fixer):              Fixers.             (line  196)\n* methodcaller() (in module operator):   operator -- Standard operators as functions.\n(line  321)\n* MethodDescriptorType (in module types): Standard Interpreter Types.\n(line  109)\n* methodHelp() (xmlrpc.client.ServerProxy.system method): ServerProxy Objects.\n(line   43)\n* methods (in module crypt):             Module Attributes.  (line    8)\n* methods (pyclbr.Class attribute):      Class Objects<2>.   (line   49)\n* methodSignature() (xmlrpc.client.ServerProxy.system method): ServerProxy Objects.\n(line   22)\n* MethodType (in module types):          Standard Interpreter Types.\n(line   77)\n* MethodType (in module types) <1>:      Function Objects<3>.\n(line   14)\n* MethodType (in module types) <2>:      Method Objects<2>.  (line   12)\n* MethodWrapperType (in module types):   Standard Interpreter Types.\n(line   96)\n* metrics() (tkinter.font.Font method):  tkinter font -- Tkinter font wrapper.\n(line   69)\n* MFDALLOWSEALING (in module os):      Files and Directories.\n(line 1803)\n* MFDCLOEXEC (in module os):            Files and Directories.\n(line 1803)\n* MFDHUGE16GB (in module os):          Files and Directories.\n(line 1803)\n* MFDHUGE16MB (in module os):          Files and Directories.\n(line 1803)\n* MFDHUGE1GB (in module os):           Files and Directories.\n(line 1803)\n* MFDHUGE1MB (in module os):           Files and Directories.\n(line 1803)\n* MFDHUGE256MB (in module os):         Files and Directories.\n(line 1803)\n* MFDHUGE2GB (in module os):           Files and Directories.\n(line 1803)\n* MFDHUGE2MB (in module os):           Files and Directories.\n(line 1803)\n* MFDHUGE32MB (in module os):          Files and Directories.\n(line 1803)\n* MFDHUGE512KB (in module os):         Files and Directories.\n(line 1803)\n* MFDHUGE512MB (in module os):         Files and Directories.\n(line 1803)\n* MFDHUGE64KB (in module os):          Files and Directories.\n(line 1803)\n* MFDHUGE8MB (in module os):           Files and Directories.\n(line 1803)\n* MFDHUGEMASK (in module os):          Files and Directories.\n(line 1803)\n* MFDHUGESHIFT (in module os):         Files and Directories.\n(line 1803)\n* MFDHUGETLB (in module os):            Files and Directories.\n(line 1803)\n* MH (class in mailbox):                 MH objects.         (line    6)\n* MHMessage (class in mailbox):          MHMessage objects.  (line    6)\n* microsecond (datetime.datetime attribute): datetime Objects.\n(line  310)\n* microsecond (datetime.time attribute): time Objects.       (line   62)\n* MIME; base64 encoding:                 base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line    8)\n* MIME; content type:                    mimetypes -- Map filenames to MIME types.\n(line    8)\n* MIME; headers:                         mimetypes -- Map filenames to MIME types.\n(line   26)\n* MIME; headers <1>:                     cgi -- Common Gateway Interface support.\n(line    8)\n* MIME; quoted-printable encoding:       quopri -- Encode and decode MIME quoted-printable data.\n(line    8)\n* MIMEApplication (class in email.mime.application): email mime Creating email and MIME objects from scratch.\n(line   95)\n* MIMEAudio (class in email.mime.audio): email mime Creating email and MIME objects from scratch.\n(line  125)\n* MIMEBase (class in email.mime.base):   email mime Creating email and MIME objects from scratch.\n(line   30)\n* MIMEImage (class in email.mime.image): email mime Creating email and MIME objects from scratch.\n(line  157)\n* MIMEMessage (class in email.mime.message): email mime Creating email and MIME objects from scratch.\n(line  190)\n* MIMEMultipart (class in email.mime.multipart): email mime Creating email and MIME objects from scratch.\n(line   66)\n* MIMENonMultipart (class in email.mime.nonmultipart): email mime Creating email and MIME objects from scratch.\n(line   55)\n* MIMEPart (class in email.message):     email message Representing an email message.\n(line  718)\n* MIMEText (class in email.mime.text):   email mime Creating email and MIME objects from scratch.\n(line  208)\n* MimeTypes (class in mimetypes):        MimeTypes Objects.  (line   10)\n* MIMEVersionHeader (class in email.headerregistry): email headerregistry Custom Header Objects.\n(line  234)\n* min (datetime.date attribute):         date Objects.       (line  101)\n* min (datetime.datetime attribute):     datetime Objects.   (line  268)\n* min (datetime.time attribute):         time Objects.       (line   33)\n* min (datetime.timedelta attribute):    timedelta Objects.  (line   73)\n* min (sys.floatinfo attribute):        sys -- System-specific parameters and functions.\n(line  642)\n* min10exp (sys.floatinfo attribute): sys -- System-specific parameters and functions.\n(line  655)\n* MINEMIN (in module decimal):          Constants<4>.       (line   19)\n* MINETINY (in module decimal):         Constants<4>.       (line   22)\n* minexp (sys.floatinfo attribute):    sys -- System-specific parameters and functions.\n(line  650)\n* minmag() (decimal.Context method):    Context objects.    (line  398)\n* minmag() (decimal.Decimal method):    Decimal objects.    (line  394)\n* min() (decimal.Context method):        Context objects.    (line  394)\n* min() (decimal.Decimal method):        Decimal objects.    (line  387)\n* MINEQUAL (in module token):            token -- Constants used with Python parse trees.\n(line  174)\n* MINIMUMSUPPORTED (ssl.TLSVersion attribute): Constants<9>.\n(line  556)\n* minimumversion (ssl.SSLContext attribute): SSL Contexts.  (line  546)\n* minmax() (in module audioop):          audioop -- Manipulate raw audio data.\n(line  167)\n* minor (email.headerregistry.MIMEVersionHeader attribute): email headerregistry Custom Header Objects.\n(line  251)\n* minor() (in module os):                Files and Directories.\n(line  612)\n* minus:                                 Unary arithmetic and bitwise operations.\n(line   10)\n* MINUS (in module token):               token -- Constants used with Python parse trees.\n(line   86)\n* minus() (decimal.Context method):      Context objects.    (line  402)\n* minute (datetime.datetime attribute):  datetime Objects.   (line  302)\n* minute (datetime.time attribute):      time Objects.       (line   54)\n* MINYEAR (in module datetime):          Constants.          (line    8)\n* mirrored() (in module unicodedata):    unicodedata -- Unicode Database.\n(line   69)\n* mischeader (cmd.Cmd attribute):       Cmd Objects.        (line  160)\n* MISSING (contextvars.Token attribute): Context Variables.  (line   94)\n* MISSING (in module dataclasses):       Module contents<4>. (line  449)\n* MISSING (in module sys.monitoring):    Callback function arguments.\n(line    6)\n* MISSINGCDOCSTRINGS (in module test.support): test support -- Utilities for the Python test suite.\n(line  155)\n* missingcompilerexecutable() (in module test.support): test support -- Utilities for the Python test suite.\n(line  664)\n* MissingSectionHeaderError:             Exceptions<7>.      (line   60)\n* MIXERDEV:                              ossaudiodev -- Access to OSS-compatible audio devices.\n(line   78)\n* mkd() (ftplib.FTP method):             FTP objects.        (line  340)\n* mkdir() (in module os):                Files and Directories.\n(line  500)\n* mkdir() (pathlib.Path method):         Methods<2>.         (line  367)\n* mkdir() (zipfile.ZipFile method):      ZipFile Objects.    (line  330)\n* mkdtemp() (in module tempfile):        tempfile -- Generate temporary files and directories.\n(line  287)\n* mkfifo() (in module os):               Files and Directories.\n(line  566)\n* mknod() (in module os):                Files and Directories.\n(line  587)\n* mksalt() (in module crypt):            Module Functions<2>.\n(line   39)\n* mkstemp() (in module tempfile):        tempfile -- Generate temporary files and directories.\n(line  229)\n* mktemp() (in module tempfile):         Deprecated functions and variables.\n(line   15)\n* mktimetz() (in module email.utils):   email utils Miscellaneous utilities.\n(line  146)\n* mktime() (in module time):             Functions<5>.       (line  162)\n* mlsd() (ftplib.FTP method):            FTP objects.        (line  286)\n* mmap (class in mmap):                  mmap -- Memory-mapped file support.\n(line   55)\n* MMDF (class in mailbox):               MMDF objects.       (line    6)\n* MMDFMessage (class in mailbox):        MMDFMessage objects.\n(line    6)\n* Mock (class in unittest.mock):         The Mock Class.     (line   24)\n* mockaddspec() (unittest.mock.Mock method): The Mock Class.\n(line  227)\n* mockcalls (unittest.mock.Mock attribute): The Mock Class. (line  501)\n* mockopen() (in module unittest.mock): mockopen.          (line    6)\n* Mod (class in ast):                    Expressions<2>.     (line   54)\n* mod() (in module operator):            operator -- Standard operators as functions.\n(line  115)\n* mode (io.FileIO attribute):            Raw File I/O.       (line   56)\n* mode (ossaudiodev.ossaudiodevice attribute): Audio Device Objects.\n(line  238)\n* mode (statistics.NormalDist attribute): NormalDist objects.\n(line   31)\n* mode (tarfile.TarInfo attribute):      TarInfo Objects.    (line   78)\n* mode() (in module statistics):         Function details.   (line  249)\n* mode() (in module turtle):             Settings and special methods.\n(line    6)\n* modf() (in module math):               Number-theoretic and representation functions.\n(line  184)\n* modified() (urllib.robotparser.RobotFileParser method): urllib robotparser -- Parser for robots txt.\n(line   45)\n* Modify() (msilib.View method):         View Objects.       (line   23)\n* modify() (select.devpoll method):      /dev/poll Polling Objects.\n(line   49)\n* modify() (select.epoll method):        Edge and Level Trigger Polling epoll Objects.\n(line   85)\n* modify() (select.poll method):         Polling Objects.    (line   60)\n* modify() (selectors.BaseSelector method): Classes<4>.      (line   94)\n* module:                                Glossary.           (line  904)\n* Module (class in ast):                 Root nodes.         (line    6)\n* module (pyclbr.Class attribute):       Class Objects<2>.   (line   16)\n* module (pyclbr.Function attribute):    Function Objects.   (line   15)\n* Module browser:                        File menu Shell and Editor.\n(line   22)\n* module spec:                           Finders and loaders.\n(line    6)\n* module spec <1>:                       Glossary.           (line  913)\n* modulefromspec() (in module importlib.util): importlib util - Utility code for importers.\n(line  121)\n* module; future:                    future -- Future statement definitions.\n(line    6)\n* module; main:                      Resolution of names.\n(line   53)\n* module; main <1>:                  Complete Python programs.\n(line    6)\n* module; main <2>:                  Complete Python programs.\n(line   19)\n* module; main <3>:                  main -- Top-level code environment.\n(line    6)\n* module; main <4>:                  runpy -- Locating and executing Python modules.\n(line   30)\n* module; main <5>:                  runpy -- Locating and executing Python modules.\n(line  102)\n* module; main <6>:                  Embedding Python<2>.\n(line   12)\n* module; main <7>:                  Initializing and finalizing the interpreter.\n(line    7)\n* module; main <8>:                  Sub-interpreter support.\n(line  112)\n* module; main <9>:                  Sub-interpreter support.\n(line  193)\n* module; locale:                       locale -- Internationalization services.\n(line   16)\n* module; thread:                       thread -- Low-level threading API.\n(line    6)\n* module; thread <1>:                   High-level API.     (line   49)\n* module; tkinter:                      Tkinter Modules.    (line  150)\n* module; abc:                           abc -- Abstract Base Classes.\n(line    6)\n* module; aifc:                          aifc -- Read and write AIFF and AIFC files.\n(line    6)\n* module; argparse:                      argparse -- Parser for command-line options arguments and sub-commands.\n(line    6)\n* module; array:                         Mutable sequences.  (line   10)\n* module; array <1>:                     Binary Sequence Types -- bytes bytearray memoryview.\n(line    6)\n* module; array <2>:                     array -- Efficient arrays of numeric values.\n(line    6)\n* module; ast:                           ast -- Abstract Syntax Trees.\n(line    6)\n* module; asyncio:                       asyncio -- Asynchronous I/O.\n(line    6)\n* module; atexit:                        atexit -- Exit handlers.\n(line    6)\n* module; audioop:                       audioop -- Manipulate raw audio data.\n(line    6)\n* module; base64:                        base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line    6)\n* module; base64 <1>:                    binascii -- Convert between binary and ASCII.\n(line    6)\n* module; bdb:                           bdb -- Debugger framework.\n(line    6)\n* module; bdb <1>:                       pdb -- The Python Debugger.\n(line   17)\n* module; binascii:                      binascii -- Convert between binary and ASCII.\n(line    6)\n* module; bisect:                        bisect -- Array bisection algorithm.\n(line    6)\n* module; builtins:                      The dir Function.   (line   47)\n* module; builtins <1>:                  Complete Python programs.\n(line    6)\n* module; builtins <2>:                  Built-in Functions. (line 2006)\n* module; builtins <3>:                  builtins -- Built-in objects.\n(line    6)\n* module; builtins <4>:                  Embedding Python<2>.\n(line   12)\n* module; builtins <5>:                  Initializing and finalizing the interpreter.\n(line    7)\n* module; builtins <6>:                  Sub-interpreter support.\n(line  112)\n* module; builtins <7>:                  Sub-interpreter support.\n(line  193)\n* module; bz2:                           bz2 -- Support for bzip2 compression.\n(line    6)\n* module; calendar:                      calendar -- General calendar-related functions.\n(line    6)\n* module; cgi:                           cgi -- Common Gateway Interface support.\n(line    6)\n* module; cgitb:                         cgitb -- Traceback manager for CGI scripts.\n(line    6)\n* module; chunk:                         chunk -- Read IFF chunked data.\n(line    6)\n* module; cmath:                         cmath -- Mathematical functions for complex numbers.\n(line    6)\n* module; cmd:                           cmd -- Support for line-oriented command interpreters.\n(line    6)\n* module; cmd <1>:                       pdb -- The Python Debugger.\n(line   17)\n* module; code:                          code -- Interpreter base classes.\n(line    6)\n* module; codecs:                        codecs -- Codec registry and base classes.\n(line    6)\n* module; codeop:                        codeop -- Compile Python code.\n(line    6)\n* module; collections:                   Mutable sequences.  (line   11)\n* module; collections <1>:               collections -- Container datatypes.\n(line    6)\n* module; collections.abc:               collections abc -- Abstract Base Classes for Containers.\n(line    6)\n* module; colorsys:                      colorsys -- Conversions between color systems.\n(line    6)\n* module; compileall:                    compileall -- Byte-compile Python libraries.\n(line    6)\n* module; concurrent.futures:            concurrent futures -- Launching parallel tasks.\n(line    6)\n* module; configparser:                  configparser -- Configuration file parser.\n(line    6)\n* module; contextlib:                    contextlib -- Utilities for with-statement contexts.\n(line    6)\n* module; contextvars:                   contextvars -- Context Variables.\n(line    6)\n* module; copy:                          copy -- Shallow and deep copy operations.\n(line    6)\n* module; copy <1>:                      copyreg -- Register pickle support functions.\n(line    8)\n* module; copyreg:                       copyreg -- Register pickle support functions.\n(line    6)\n* module; cProfile:                      profile and cProfile Module Reference.\n(line    6)\n* module; crypt:                         pwd -- The password database.\n(line   45)\n* module; crypt <1>:                     crypt -- Function to check Unix passwords.\n(line    6)\n* module; csv:                           csv -- CSV File Reading and Writing.\n(line    6)\n* module; ctypes:                        ctypes -- A foreign function library for Python.\n(line    6)\n* module; curses:                        curses -- Terminal handling for character-cell displays.\n(line    6)\n* module; curses.ascii:                  curses ascii -- Utilities for ASCII characters.\n(line    6)\n* module; curses.panel:                  curses panel -- A panel stack extension for curses.\n(line    6)\n* module; curses.textpad:                curses textpad -- Text input widget for curses programs.\n(line    6)\n* module; dataclasses:                   dataclasses -- Data Classes.\n(line    6)\n* module; datetime:                      datetime -- Basic date and time types.\n(line    6)\n* module; dbm:                           dbm -- Interfaces to Unix \"databases\".\n(line    6)\n* module; dbm.dumb:                      dbm dumb -- Portable DBM implementation.\n(line    6)\n* module; dbm.gnu:                       Dictionaries<2>.    (line   25)\n* module; dbm.gnu <1>:                   Restrictions.       (line    6)\n* module; dbm.gnu <2>:                   dbm gnu -- GNU database manager.\n(line    6)\n* module; dbm.ndbm:                      Dictionaries<2>.    (line   25)\n* module; dbm.ndbm <1>:                  Restrictions.       (line    6)\n* module; dbm.ndbm <2>:                  dbm ndbm -- New Database Manager.\n(line    6)\n* module; decimal:                       decimal -- Decimal fixed point and floating point arithmetic.\n(line    6)\n* module; difflib:                       difflib -- Helpers for computing deltas.\n(line    6)\n* module; dis:                           dis -- Disassembler for Python bytecode.\n(line    6)\n* module; doctest:                       doctest -- Test interactive Python examples.\n(line    6)\n* module; email:                         email -- An email and MIME handling package.\n(line    6)\n* module; email.charset:                 email charset Representing character sets.\n(line    6)\n* module; email.contentmanager:          email contentmanager Managing MIME Content.\n(line    6)\n* module; email.encoders:                email encoders Encoders.\n(line    6)\n* module; email.errors:                  email errors Exception and Defect classes.\n(line    6)\n* module; email.generator:               email generator Generating MIME documents.\n(line    6)\n* module; email.header:                  email header Internationalized headers.\n(line    6)\n* module; email.headerregistry:          email headerregistry Custom Header Objects.\n(line    6)\n* module; email.iterators:               email iterators Iterators.\n(line    6)\n* module; email.message:                 email message Representing an email message.\n(line    6)\n* module; email.mime:                    email mime Creating email and MIME objects from scratch.\n(line    6)\n* module; email.mime.application:        email mime Creating email and MIME objects from scratch.\n(line   95)\n* module; email.mime.audio:              email mime Creating email and MIME objects from scratch.\n(line  125)\n* module; email.mime.base:               email mime Creating email and MIME objects from scratch.\n(line   30)\n* module; email.mime.image:              email mime Creating email and MIME objects from scratch.\n(line  157)\n* module; email.mime.message:            email mime Creating email and MIME objects from scratch.\n(line  190)\n* module; email.mime.multipart:          email mime Creating email and MIME objects from scratch.\n(line   66)\n* module; email.mime.nonmultipart:       email mime Creating email and MIME objects from scratch.\n(line   55)\n* module; email.mime.text:               email mime Creating email and MIME objects from scratch.\n(line  208)\n* module; email.parser:                  email parser Parsing email messages.\n(line    6)\n* module; email.policy:                  email policy Policy Objects.\n(line    6)\n* module; email.utils:                   email utils Miscellaneous utilities.\n(line    6)\n* module; encodings.idna:                encodings idna -- Internationalized Domain Names in Applications.\n(line    6)\n* module; encodings.mbcs:                encodings mbcs -- Windows ANSI codepage.\n(line    6)\n* module; encodings.utf8sig:           encodings utf8sig -- UTF-8 codec with BOM signature.\n(line    6)\n* module; ensurepip:                     ensurepip -- Bootstrapping the pip installer.\n(line    6)\n* module; enum:                          enum -- Support for enumerations.\n(line    6)\n* module; errno:                         Concrete exceptions.\n(line  145)\n* module; errno <1>:                     errno -- Standard errno system symbols.\n(line    6)\n* module; faulthandler:                  faulthandler -- Dump the Python traceback.\n(line    6)\n* module; fcntl:                         fcntl -- The fcntl and ioctl system calls.\n(line    6)\n* module; filecmp:                       filecmp -- File and Directory Comparisons.\n(line    6)\n* module; fileinput:                     fileinput -- Iterate over lines from multiple input streams.\n(line    6)\n* module; fnmatch:                       fnmatch -- Unix filename pattern matching.\n(line    6)\n* module; fractions:                     fractions -- Rational numbers.\n(line    6)\n* module; ftplib:                        ftplib -- FTP protocol client.\n(line    6)\n* module; functools:                     functools -- Higher-order functions and operations on callable objects.\n(line    6)\n* module; gc:                            gc -- Garbage Collector interface.\n(line    6)\n* module; getopt:                        getopt -- C-style parser for command line options.\n(line    6)\n* module; getpass:                       getpass -- Portable password input.\n(line    6)\n* module; gettext:                       gettext -- Multilingual internationalization services.\n(line    6)\n* module; glob:                          glob -- Unix style pathname pattern expansion.\n(line    6)\n* module; glob <1>:                      fnmatch -- Unix filename pattern matching.\n(line   34)\n* module; graphlib:                      graphlib -- Functionality to operate with graph-like structures.\n(line    6)\n* module; grp:                           grp -- The group database.\n(line    6)\n* module; gzip:                          gzip -- Support for gzip files.\n(line    6)\n* module; hashlib:                       hashlib -- Secure hashes and message digests.\n(line    6)\n* module; heapq:                         heapq -- Heap queue algorithm.\n(line    6)\n* module; hmac:                          hmac -- Keyed-Hashing for Message Authentication.\n(line    6)\n* module; html:                          html -- HyperText Markup Language support.\n(line    6)\n* module; html.entities:                 html entities -- Definitions of HTML general entities.\n(line    6)\n* module; html.parser:                   html parser -- Simple HTML and XHTML parser.\n(line    6)\n* module; http:                          http -- HTTP modules.\n(line    6)\n* module; http.client:                   http client -- HTTP protocol client.\n(line    6)\n* module; http.cookiejar:                http cookiejar -- Cookie handling for HTTP clients.\n(line    6)\n* module; http.cookies:                  http cookies -- HTTP state management.\n(line    6)\n* module; http.server:                   http server -- HTTP servers.\n(line    6)\n* module; idlelib:                       idlelib.            (line    6)\n* module; imaplib:                       imaplib -- IMAP4 protocol client.\n(line    6)\n* module; imghdr:                        imghdr -- Determine the type of an image.\n(line    6)\n* module; importing:                     The import statement.\n(line    6)\n* module; importlib:                     importlib -- The implementation of import.\n(line    6)\n* module; importlib.abc:                 importlib abc - Abstract base classes related to import.\n(line    6)\n* module; importlib.machinery:           importlib machinery - Importers and path hooks.\n(line    6)\n* module; importlib.metadata:            importlib metadata - Accessing package metadata.\n(line    6)\n* module; importlib.resources:           importlib resources - Package resource reading opening and access.\n(line    6)\n* module; importlib.resources.abc:       importlib resources abc - Abstract base classes for resources.\n(line    6)\n* module; importlib.util:                importlib util - Utility code for importers.\n(line    6)\n* module; inspect:                       inspect -- Inspect live objects.\n(line    6)\n* module; io:                            I/O objects also known as file objects.\n(line    6)\n* module; io <1>:                        io -- Core tools for working with streams.\n(line    6)\n* module; ipaddress:                     ipaddress -- IPv4/IPv6 manipulation library.\n(line    6)\n* module; itertools:                     itertools -- Functions creating iterators for efficient looping.\n(line    6)\n* module; json:                          Saving structured data with json.\n(line    6)\n* module; json <1>:                      json -- JSON encoder and decoder.\n(line    6)\n* module; json.tool:                     Command Line Interface<2>.\n(line    6)\n* module; keyword:                       keyword -- Testing for Python keywords.\n(line    6)\n* module; lib2to3:                       lib2to3 -- 2to3's library.\n(line    6)\n* module; linecache:                     linecache -- Random access to text lines.\n(line    6)\n* module; locale:                        locale -- Internationalization services.\n(line    6)\n* module; logging:                       logging -- Logging facility for Python.\n(line    6)\n* module; logging.config:                logging config -- Logging configuration.\n(line    6)\n* module; logging.handlers:              logging handlers -- Logging handlers.\n(line    6)\n* module; lzma:                          lzma -- Compression using the LZMA algorithm.\n(line    6)\n* module; mailbox:                       mailbox -- Manipulate mailboxes in various formats.\n(line    6)\n* module; mailcap:                       mailcap -- Mailcap file handling.\n(line    6)\n* module; marshal:                       marshal -- Internal Python object serialization.\n(line    6)\n* module; math:                          Numeric Types -- int float complex.\n(line  107)\n* module; math <1>:                      math -- Mathematical functions.\n(line    6)\n* module; math <2>:                      Constants<3>.       (line   47)\n* module; mimetypes:                     mimetypes -- Map filenames to MIME types.\n(line    6)\n* module; mmap:                          mmap -- Memory-mapped file support.\n(line    6)\n* module; modulefinder:                  modulefinder -- Find modules used by a script.\n(line    6)\n* module; msilib:                        msilib -- Read and write Microsoft Installer files.\n(line    6)\n* module; msvcrt:                        msvcrt -- Useful routines from the MS VC++ runtime.\n(line    6)\n* module; multiprocessing:               multiprocessing -- Process-based parallelism.\n(line    6)\n* module; multiprocessing.connection:    Listeners and Clients.\n(line    6)\n* module; multiprocessing.dummy:         The multiprocessing dummy module.\n(line    6)\n* module; multiprocessing.managers:      Managers.           (line   19)\n* module; multiprocessing.pool:          Process Pools.      (line    6)\n* module; multiprocessing.sharedmemory: multiprocessing sharedmemory -- Shared memory for direct access across processes.\n(line    6)\n* module; multiprocessing.sharedctypes:  The multiprocessing sharedctypes module.\n(line    6)\n* module; namespace:                     Modules<3>.         (line   21)\n* module; netrc:                         netrc -- netrc file processing.\n(line    6)\n* module; nis:                           nis -- Interface to Sun's NIS Yellow Pages.\n(line    6)\n* module; nntplib:                       nntplib -- NNTP protocol client.\n(line    6)\n* module; numbers:                       numbers -- Numeric abstract base classes.\n(line    6)\n* module; operator:                      operator -- Standard operators as functions.\n(line    6)\n* module; optparse:                      optparse -- Parser for command line options.\n(line    6)\n* module; os:                            os -- Miscellaneous operating system interfaces.\n(line    6)\n* module; os <1>:                        posix -- The most common POSIX system calls.\n(line   14)\n* module; os.path:                       os path -- Common pathname manipulations.\n(line    6)\n* module; ossaudiodev:                   ossaudiodev -- Access to OSS-compatible audio devices.\n(line    6)\n* module; pathlib:                       pathlib -- Object-oriented filesystem paths.\n(line    6)\n* module; pdb:                           pdb -- The Python Debugger.\n(line    6)\n* module; pickle:                        copy -- Shallow and deep copy operations.\n(line   68)\n* module; pickle <1>:                    pickle -- Python object serialization.\n(line    6)\n* module; pickle <2>:                    copyreg -- Register pickle support functions.\n(line    8)\n* module; pickle <3>:                    shelve -- Python object persistence.\n(line    8)\n* module; pickle <4>:                    marshal -- Internal Python object serialization.\n(line   15)\n* module; pickletools:                   pickletools -- Tools for pickle developers.\n(line    6)\n* module; pipes:                         pipes -- Interface to shell pipelines.\n(line    6)\n* module; pkgutil:                       pkgutil -- Package extension utility.\n(line    6)\n* module; platform:                      platform -- Access to underlying platform's identifying data.\n(line    6)\n* module; plistlib:                      plistlib -- Generate and parse Apple plist files.\n(line    6)\n* module; poplib:                        poplib -- POP3 protocol client.\n(line    6)\n* module; posix:                         posix -- The most common POSIX system calls.\n(line    6)\n* module; pprint:                        pprint -- Data pretty printer.\n(line    6)\n* module; profile:                       profile and cProfile Module Reference.\n(line    6)\n* module; pstats:                        The Stats Class.    (line    9)\n* module; pty:                           File Descriptor Operations.\n(line  468)\n* module; pty <1>:                       pty -- Pseudo-terminal utilities.\n(line    6)\n* module; pwd:                           os path -- Common pathname manipulations.\n(line  135)\n* module; pwd <1>:                       pwd -- The password database.\n(line    6)\n* module; pycompile:                    pycompile -- Compile Python source files.\n(line    6)\n* module; pyclbr:                        pyclbr -- Python module browser support.\n(line    6)\n* module; pydoc:                         pydoc -- Documentation generator and online help system.\n(line    6)\n* module; pyexpat:                       xml parsers expat -- Fast XML parsing using Expat.\n(line   20)\n* module; queue:                         queue -- A synchronized queue class.\n(line    6)\n* module; quopri:                        quopri -- Encode and decode MIME quoted-printable data.\n(line    6)\n* module; random:                        random -- Generate pseudo-random numbers.\n(line    6)\n* module; re:                            String Methods<2>.  (line    6)\n* module; re <1>:                        re -- Regular expression operations.\n(line    6)\n* module; re <2>:                        fnmatch -- Unix filename pattern matching.\n(line    8)\n* module; readline:                      readline -- GNU readline interface.\n(line    6)\n* module; reprlib:                       reprlib -- Alternate repr implementation.\n(line    6)\n* module; resource:                      resource -- Resource usage information.\n(line    6)\n* module; rlcompleter:                   rlcompleter -- Completion function for GNU readline.\n(line    6)\n* module; runpy:                         runpy -- Locating and executing Python modules.\n(line    6)\n* module; sched:                         sched -- Event scheduler.\n(line    6)\n* module; search; path:                  The Module Search Path.\n(line    6)\n* module; search; path <1>:              linecache -- Random access to text lines.\n(line   30)\n* module; search; path <2>:              sys -- System-specific parameters and functions.\n(line 1262)\n* module; search; path <3>:              site -- Site-specific configuration hook.\n(line   14)\n* module; search; path <4>:              Embedding Python<2>.\n(line   12)\n* module; search; path <5>:              Initializing and finalizing the interpreter.\n(line    7)\n* module; search; path <6>:              Process-wide parameters.\n(line  158)\n* module; search; path <7>:              Process-wide parameters.\n(line  178)\n* module; secrets:                       secrets -- Generate secure random numbers for managing secrets.\n(line    6)\n* module; select:                        select -- Waiting for I/O completion.\n(line    6)\n* module; selectors:                     selectors -- High-level I/O multiplexing.\n(line    6)\n* module; shelve:                        shelve -- Python object persistence.\n(line    6)\n* module; shelve <1>:                    marshal -- Internal Python object serialization.\n(line   15)\n* module; shlex:                         shlex -- Simple lexical analysis.\n(line    6)\n* module; shutil:                        shutil -- High-level file operations.\n(line    6)\n* module; signal:                        thread -- Low-level threading API.\n(line  190)\n* module; signal <1>:                    signal -- Set handlers for asynchronous events.\n(line    6)\n* module; signal <2>:                    Signal Handling<2>. (line    7)\n* module; signal <3>:                    Signal Handling<2>. (line   34)\n* module; signal <4>:                    Signal Handling<2>. (line   43)\n* module; site:                          site -- Site-specific configuration hook.\n(line    6)\n* module; sitecustomize:                 sitecustomize.      (line    6)\n* module; smtplib:                       smtplib -- SMTP protocol client.\n(line    6)\n* module; sndhdr:                        sndhdr -- Determine type of sound file.\n(line    6)\n* module; socket:                        socket -- Low-level networking interface.\n(line    6)\n* module; socket <1>:                    Internet Protocols and Support.\n(line    6)\n* module; socketserver:                  socketserver -- A framework for network servers.\n(line    6)\n* module; spwd:                          spwd -- The shadow password database.\n(line    6)\n* module; sqlite3:                       sqlite3 -- DB-API 2 0 interface for SQLite databases.\n(line    6)\n* module; ssl:                           ssl -- TLS/SSL wrapper for socket objects.\n(line    6)\n* module; stat:                          stat -- Interpreting stat results.\n(line    6)\n* module; stat <1>:                      Files and Directories.\n(line 1097)\n* module; statistics:                    statistics -- Mathematical statistics functions.\n(line    6)\n* module; string:                        string -- Common string operations.\n(line    6)\n* module; stringprep:                    stringprep -- Internet String Preparation.\n(line    6)\n* module; struct:                        struct -- Interpret bytes as packed binary data.\n(line    6)\n* module; struct <1>:                    Socket Objects.     (line  570)\n* module; subprocess:                    subprocess -- Subprocess management.\n(line    6)\n* module; sunau:                         sunau -- Read and write Sun AU files.\n(line    6)\n* module; symtable:                      symtable -- Access to the compiler's symbol tables.\n(line    6)\n* module; sys:                           Standard Modules.   (line    6)\n* module; sys <1>:                       except clause.      (line   59)\n* module; sys <2>:                       Complete Python programs.\n(line    6)\n* module; sys <3>:                       Built-in Functions. (line 1326)\n* module; sys <4>:                       sys -- System-specific parameters and functions.\n(line    6)\n* module; sys <5>:                       Embedding Python<2>.\n(line   12)\n* module; sys <6>:                       Initializing and finalizing the interpreter.\n(line    7)\n* module; sys <7>:                       Sub-interpreter support.\n(line  112)\n* module; sys <8>:                       Sub-interpreter support.\n(line  193)\n* module; sys.monitoring:                sys monitoring -- Execution event monitoring.\n(line    6)\n* module; sysconfig:                     sysconfig -- Provide access to Python's configuration information.\n(line    6)\n* module; syslog:                        syslog -- Unix syslog library routines.\n(line    6)\n* module; tabnanny:                      tabnanny -- Detection of ambiguous indentation.\n(line    6)\n* module; tarfile:                       tarfile -- Read and write tar archive files.\n(line    6)\n* module; telnetlib:                     telnetlib -- Telnet client.\n(line    6)\n* module; tempfile:                      tempfile -- Generate temporary files and directories.\n(line    6)\n* module; termios:                       termios -- POSIX style tty control.\n(line    6)\n* module; test:                          test -- Regression tests package for Python.\n(line    6)\n* module; test.regrtest:                 Running tests using the command-line interface.\n(line    6)\n* module; test.support:                  test support -- Utilities for the Python test suite.\n(line    6)\n* module; test.support.bytecodehelper:  test support bytecodehelper -- Support tools for testing correct bytecode generation.\n(line    6)\n* module; test.support.importhelper:    test support importhelper -- Utilities for import tests.\n(line    6)\n* module; test.support.oshelper:        test support oshelper -- Utilities for os tests.\n(line    6)\n* module; test.support.scripthelper:    test support scripthelper -- Utilities for the Python execution tests.\n(line    6)\n* module; test.support.sockethelper:    test support sockethelper -- Utilities for socket tests.\n(line    6)\n* module; test.support.threadinghelper: test support threadinghelper -- Utilities for threading tests.\n(line    6)\n* module; test.support.warningshelper:  test support warningshelper -- Utilities for warnings tests.\n(line    6)\n* module; textwrap:                      textwrap -- Text wrapping and filling.\n(line    6)\n* module; threading:                     threading -- Thread-based parallelism.\n(line    6)\n* module; time:                          time -- Time access and conversions.\n(line    6)\n* module; timeit:                        timeit -- Measure execution time of small code snippets.\n(line    6)\n* module; tkinter:                       tkinter -- Python interface to Tcl/Tk.\n(line    6)\n* module; tkinter.colorchooser:          tkinter colorchooser -- Color choosing dialog.\n(line    6)\n* module; tkinter.commondialog:          tkinter commondialog -- Dialog window templates.\n(line    6)\n* module; tkinter.dnd:                   tkinter dnd -- Drag and drop support.\n(line    6)\n* module; tkinter.filedialog:            tkinter filedialog -- File selection dialogs.\n(line    6)\n* module; tkinter.font:                  tkinter font -- Tkinter font wrapper.\n(line    6)\n* module; tkinter.messagebox:            tkinter messagebox -- Tkinter message prompts.\n(line    6)\n* module; tkinter.scrolledtext:          tkinter scrolledtext -- Scrolled Text Widget.\n(line    6)\n* module; tkinter.simpledialog:          tkinter simpledialog -- Standard Tkinter input dialogs.\n(line    6)\n* module; tkinter.tix:                   tkinter tix -- Extension widgets for Tk.\n(line    6)\n* module; tkinter.ttk:                   tkinter ttk -- Tk themed widgets.\n(line    6)\n* module; token:                         token -- Constants used with Python parse trees.\n(line    6)\n* module; tokenize:                      tokenize -- Tokenizer for Python source.\n(line    6)\n* module; tomllib:                       tomllib -- Parse TOML files.\n(line    6)\n* module; trace:                         trace -- Trace or track Python statement execution.\n(line    6)\n* module; traceback:                     traceback -- Print or retrieve a stack traceback.\n(line    6)\n* module; tracemalloc:                   tracemalloc -- Trace memory allocations.\n(line    6)\n* module; tty:                           tty -- Terminal control functions.\n(line    6)\n* module; turtle:                        turtle -- Turtle graphics.\n(line    6)\n* module; turtledemo:                    turtledemo -- Demo scripts.\n(line    6)\n* module; types:                         Type Objects.       (line    6)\n* module; types <1>:                     types -- Dynamic type creation and names for built-in types.\n(line    6)\n* module; typing:                        typing -- Support for type hints.\n(line    6)\n* module; unicodedata:                   unicodedata -- Unicode Database.\n(line    6)\n* module; unittest:                      unittest -- Unit testing framework.\n(line    6)\n* module; unittest.mock:                 unittest mock -- mock object library.\n(line    6)\n* module; urllib:                        urllib -- URL handling modules.\n(line    6)\n* module; urllib.error:                  urllib error -- Exception classes raised by urllib request.\n(line    6)\n* module; urllib.parse:                  urllib parse -- Parse URLs into components.\n(line    6)\n* module; urllib.request:                urllib request -- Extensible library for opening URLs.\n(line    6)\n* module; urllib.request <1>:            http client -- HTTP protocol client.\n(line    8)\n* module; urllib.response:               urllib response -- Response classes used by urllib.\n(line    6)\n* module; urllib.robotparser:            urllib robotparser -- Parser for robots txt.\n(line    6)\n* module; usercustomize:                 usercustomize.      (line    6)\n* module; uu:                            binascii -- Convert between binary and ASCII.\n(line    6)\n* module; uu <1>:                        uu -- Encode and decode uuencode files.\n(line    6)\n* module; uuid:                          uuid -- UUID objects according to RFC 4122.\n(line    8)\n* module; venv:                          venv -- Creation of virtual environments.\n(line    6)\n* module; warnings:                      warnings -- Warning control.\n(line    6)\n* module; wave:                          wave -- Read and write WAV files.\n(line    6)\n* module; weakref:                       weakref -- Weak references.\n(line    6)\n* module; webbrowser:                    webbrowser -- Convenient web-browser controller.\n(line    6)\n* module; winreg:                        winreg -- Windows registry access.\n(line    6)\n* module; winsound:                      winsound -- Sound-playing interface for Windows.\n(line    6)\n* module; wsgiref:                       wsgiref -- WSGI Utilities and Reference Implementation.\n(line    6)\n* module; wsgiref.handlers:              wsgiref handlers - server/gateway base classes.\n(line    6)\n* module; wsgiref.headers:               wsgiref headers - WSGI response header tools.\n(line    6)\n* module; wsgiref.simpleserver:         wsgiref simpleserver - a simple WSGI HTTP server.\n(line    6)\n* module; wsgiref.types:                 wsgiref types - WSGI types for static type checking.\n(line    6)\n* module; wsgiref.util:                  wsgiref util - WSGI environment utilities.\n(line    6)\n* module; wsgiref.validate:              wsgiref validate -- WSGI conformance checker.\n(line    6)\n* module; xdrlib:                        xdrlib -- Encode and decode XDR data.\n(line    6)\n* module; xml:                           XML Processing Modules.\n(line    6)\n* module; xml.dom:                       xml dom -- The Document Object Model API.\n(line    6)\n* module; xml.dom.minidom:               xml dom minidom -- Minimal DOM implementation.\n(line    6)\n* module; xml.dom.pulldom:               xml dom pulldom -- Support for building partial DOM trees.\n(line    6)\n* module; xml.etree.ElementInclude:      Functions<10>.      (line    6)\n* module; xml.etree.ElementTree:         xml etree ElementTree -- The ElementTree XML API.\n(line    6)\n* module; xml.parsers.expat:             xml parsers expat -- Fast XML parsing using Expat.\n(line    6)\n* module; xml.parsers.expat.errors:      Expat error constants.\n(line    6)\n* module; xml.parsers.expat.model:       Content Model Descriptions.\n(line    6)\n* module; xml.sax:                       xml sax -- Support for SAX2 parsers.\n(line    6)\n* module; xml.sax.handler:               xml sax handler -- Base classes for SAX handlers.\n(line    6)\n* module; xml.sax.saxutils:              xml sax saxutils -- SAX Utilities.\n(line    6)\n* module; xml.sax.xmlreader:             xml sax xmlreader -- Interface for XML parsers.\n(line    6)\n* module; xmlrpc.client:                 xmlrpc client -- XML-RPC client access.\n(line    6)\n* module; xmlrpc.server:                 xmlrpc server -- Basic XML-RPC servers.\n(line    6)\n* module; zipapp:                        zipapp -- Manage executable Python zip archives.\n(line    6)\n* module; zipfile:                       zipfile -- Work with ZIP archives.\n(line    6)\n* module; zipimport:                     zipimport -- Import modules from Zip archives.\n(line    6)\n* module; zlib:                          zlib -- Compression compatible with gzip.\n(line    6)\n* module; zoneinfo:                      zoneinfo -- IANA time zone support.\n(line    6)\n* ModuleFinder (class in modulefinder):  modulefinder -- Find modules used by a script.\n(line   26)\n* ModuleInfo (class in pkgutil):         pkgutil -- Package extension utility.\n(line   13)\n* ModuleNotFoundError:                   Concrete exceptions.\n(line   65)\n* modules (in module sys):               sys -- System-specific parameters and functions.\n(line 1235)\n* modules (in module sys) <1>:           Importing Modules<2>.\n(line    9)\n* modules (in module sys) <2>:           Initializing and finalizing the interpreter.\n(line    7)\n* modules (modulefinder.ModuleFinder attribute): modulefinder -- Find modules used by a script.\n(line   49)\n* modulescleanup() (in module test.support.importhelper): test support importhelper -- Utilities for import tests.\n(line   71)\n* modulessetup() (in module test.support.importhelper): test support importhelper -- Utilities for import tests.\n(line   67)\n* ModuleSpec (class in importlib.machinery): importlib machinery - Importers and path hooks.\n(line  364)\n* ModuleType (class in types):           Standard Interpreter Types.\n(line  123)\n* ModuleType (in module types):          Module Objects.     (line    7)\n* modulo:                                Binary arithmetic operations.\n(line   41)\n* modulus (sys.hashinfo attribute):     sys -- System-specific parameters and functions.\n(line  998)\n* MON1 (in module locale):              locale -- Internationalization services.\n(line  236)\n* MON10 (in module locale):             locale -- Internationalization services.\n(line  236)\n* MON11 (in module locale):             locale -- Internationalization services.\n(line  236)\n* MON12 (in module locale):             locale -- Internationalization services.\n(line  236)\n* MON2 (in module locale):              locale -- Internationalization services.\n(line  236)\n* MON3 (in module locale):              locale -- Internationalization services.\n(line  236)\n* MON4 (in module locale):              locale -- Internationalization services.\n(line  236)\n* MON5 (in module locale):              locale -- Internationalization services.\n(line  236)\n* MON6 (in module locale):              locale -- Internationalization services.\n(line  236)\n* MON7 (in module locale):              locale -- Internationalization services.\n(line  236)\n* MON8 (in module locale):              locale -- Internationalization services.\n(line  236)\n* MON9 (in module locale):              locale -- Internationalization services.\n(line  236)\n* MONDAY (in module calendar):           calendar -- General calendar-related functions.\n(line  379)\n* monotonicns() (in module time):       Functions<5>.       (line  193)\n* monotonic() (in module time):          Functions<5>.       (line  175)\n* month (calendar.IllegalMonthError attribute): calendar -- General calendar-related functions.\n(line  447)\n* Month (class in calendar):             calendar -- General calendar-related functions.\n(line  432)\n* month (datetime.date attribute):       date Objects.       (line  120)\n* month (datetime.datetime attribute):   datetime Objects.   (line  289)\n* monthabbr (in module calendar):       calendar -- General calendar-related functions.\n(line  407)\n* monthname (in module calendar):       calendar -- General calendar-related functions.\n(line  400)\n* month() (in module calendar):          calendar -- General calendar-related functions.\n(line  342)\n* monthcalendar() (in module calendar):  calendar -- General calendar-related functions.\n(line  331)\n* monthdatescalendar() (calendar.Calendar method): calendar -- General calendar-related functions.\n(line   89)\n* monthdays2calendar() (calendar.Calendar method): calendar -- General calendar-related functions.\n(line   95)\n* monthdayscalendar() (calendar.Calendar method): calendar -- General calendar-related functions.\n(line  101)\n* monthrange() (in module calendar):     calendar -- General calendar-related functions.\n(line  326)\n* Morsel (class in http.cookies):        Morsel Objects.     (line    6)\n* mostcommon() (collections.Counter method): Counter objects.\n(line   78)\n* mouseinterval() (in module curses):    Functions<6>.       (line  292)\n* mousemask() (in module curses):        Functions<6>.       (line  299)\n* movetoend() (collections.OrderedDict method): OrderedDict objects.\n(line   74)\n* move() (curses.panel.Panel method):    Panel Objects.      (line   35)\n* move() (curses.window method):         Window Objects.     (line  396)\n* move() (in module shutil):             Directory and files operations.\n(line  321)\n* move() (mmap.mmap method):             mmap -- Memory-mapped file support.\n(line  229)\n* move() (tkinter.ttk.Treeview method):  ttk Treeview.       (line  211)\n* MozillaCookieJar (class in http.cookiejar): FileCookieJar subclasses and co-operation with web browsers.\n(line    9)\n* MRO:                                   Glossary.           (line  919)\n* mro() (class method):                  Special Attributes. (line   47)\n* msg (http.client.HTTPResponse attribute): HTTPResponse Objects.\n(line   40)\n* msg (json.JSONDecodeError attribute):  Exceptions<15>.     (line   11)\n* msg (netrc.NetrcParseError attribute): netrc -- netrc file processing.\n(line   50)\n* msg (re.error attribute):              Exceptions<3>.      (line   15)\n* msg (traceback.TracebackException attribute): TracebackException Objects.\n(line  109)\n* msg() (telnetlib.Telnet method):       Telnet Objects.     (line   77)\n* msi:                                   msilib -- Read and write Microsoft Installer files.\n(line    8)\n* mtinteract() (telnetlib.Telnet method): Telnet Objects.   (line  116)\n* mtime (gzip.GzipFile attribute):       gzip -- Support for gzip files.\n(line  142)\n* mtime (tarfile.TarInfo attribute):     TarInfo Objects.    (line   69)\n* mtime() (urllib.robotparser.RobotFileParser method): urllib robotparser -- Parser for robots txt.\n(line   39)\n* mul() (in module audioop):             audioop -- Manipulate raw audio data.\n(line  172)\n* mul() (in module operator):            operator -- Standard operators as functions.\n(line  120)\n* Mult (class in ast):                   Expressions<2>.     (line   54)\n* MultiCall (class in xmlrpc.client):    MultiCall Objects.  (line    9)\n* MULTILINE (in module re):              Flags.              (line   82)\n* MultiLoopChildWatcher (class in asyncio): Process Watchers.\n(line  106)\n* multimode() (in module statistics):    Function details.   (line  277)\n* MultipartConversionError:              email errors Exception and Defect classes.\n(line   42)\n* multiplication:                        Binary arithmetic operations.\n(line   16)\n* multiply() (decimal.Context method):   Context objects.    (line  407)\n* mutable:                               Glossary.           (line  923)\n* mutable object:                        Objects values and types.\n(line   11)\n* mutable sequence; loop over:           Common Sequence Operations.\n(line   75)\n* mutable; sequence; types:              Mutable Sequence Types.\n(line    6)\n* MutableMapping (class in collections.abc): Collections Abstract Base Classes - Detailed Descriptions.\n(line   91)\n* MutableMapping (class in typing):      Aliases to container ABCs in collections abc.\n(line   79)\n* MutableSequence (class in collections.abc): Collections Abstract Base Classes - Detailed Descriptions.\n(line   62)\n* MutableSequence (class in typing):     Aliases to container ABCs in collections abc.\n(line   87)\n* MutableSet (class in collections.abc): Collections Abstract Base Classes - Detailed Descriptions.\n(line   86)\n* MutableSet (class in typing):          Aliases to container ABCs in collections abc.\n(line   95)\n* mvderwin() (curses.window method):     Window Objects.     (line  400)\n* mvwin() (curses.window method):        Window Objects.     (line  407)\n* myrights() (imaplib.IMAP4 method):     IMAP4 Objects.      (line  157)\n* NTOKENS (in module token):            token -- Constants used with Python parse trees.\n(line  270)\n* nwaiting (asyncio.Barrier attribute): Barrier.            (line   98)\n* nwaiting (threading.Barrier attribute): Barrier Objects.  (line   97)\n* NAK (in module curses.ascii):          curses ascii -- Utilities for ASCII characters.\n(line   88)\n* name:                                  Identifiers and keywords.\n(line    6)\n* name <1>:                              Binding of names.   (line    6)\n* name <2>:                              Identifiers Names.  (line    6)\n* Name (class in ast):                   Variables.          (line    6)\n* name (codecs.CodecInfo attribute):     codecs -- Codec registry and base classes.\n(line   65)\n* name (contextvars.ContextVar attribute): Context Variables.\n(line   24)\n* name (doctest.DocTest attribute):      DocTest Objects.    (line   30)\n* name (email.headerregistry.BaseHeader attribute): email headerregistry Custom Header Objects.\n(line   45)\n* name (enum.Enum attribute):            Data Types<2>.      (line  124)\n* name (gzip.GzipFile attribute):        gzip -- Support for gzip files.\n(line  155)\n* name (hashlib.hash attribute):         Hash Objects.       (line   19)\n* name (hmac.HMAC attribute):            hmac -- Keyed-Hashing for Message Authentication.\n(line   99)\n* name (http.cookiejar.Cookie attribute): Cookie Objects<2>. (line   28)\n* name (ImportError attribute):          Concrete exceptions.\n(line   54)\n* name (importlib.abc.FileLoader attribute): importlib abc - Abstract base classes related to import.\n(line  333)\n* name (importlib.abc.Traversable attribute): importlib abc - Abstract base classes related to import.\n(line  550)\n* name (importlib.machinery.ExtensionFileLoader attribute): importlib machinery - Importers and path hooks.\n(line  306)\n* name (importlib.machinery.ModuleSpec attribute): importlib machinery - Importers and path hooks.\n(line  380)\n* name (importlib.machinery.SourceFileLoader attribute): importlib machinery - Importers and path hooks.\n(line  212)\n* name (importlib.machinery.SourcelessFileLoader attribute): importlib machinery - Importers and path hooks.\n(line  256)\n* name (importlib.resources.abc.Traversable attribute): importlib resources abc - Abstract base classes for resources.\n(line   94)\n* name (in module os):                   os -- Miscellaneous operating system interfaces.\n(line   55)\n* NAME (in module token):                token -- Constants used with Python parse trees.\n(line   42)\n* name (in module webbrowser):           Browser Controller Objects.\n(line    9)\n* name (inspect.Parameter attribute):    Introspecting callables with the Signature object.\n(line  189)\n* name (io.FileIO attribute):            Raw File I/O.       (line   60)\n* name (logging.Logger attribute):       Logger Objects.     (line   25)\n* name (multiprocessing.Process attribute): Process and exceptions.\n(line   82)\n* name (multiprocessing.sharedmemory.SharedMemory attribute): multiprocessing sharedmemory -- Shared memory for direct access across processes.\n(line   97)\n* name (os.DirEntry attribute):          Files and Directories.\n(line  925)\n* name (ossaudiodev.ossaudiodevice attribute): Audio Device Objects.\n(line  234)\n* name (pathlib.PurePath attribute):     Methods and properties.\n(line  115)\n* name (pyclbr.Class attribute):         Class Objects<2>.   (line   20)\n* name (pyclbr.Function attribute):      Function Objects.   (line   19)\n* name (sys.threadinfo attribute):      sys -- System-specific parameters and functions.\n(line 1856)\n* name (tarfile.TarInfo attribute):      TarInfo Objects.    (line   61)\n* name (tempfile.TemporaryDirectory attribute): tempfile -- Generate temporary files and directories.\n(line  194)\n* name (threading.Thread attribute):     Thread Objects.     (line  153)\n* name (traceback.FrameSummary attribute): FrameSummary Objects.\n(line   37)\n* name (xml.dom.Attr attribute):         Attr Objects.       (line    8)\n* name (xml.dom.DocumentType attribute): DocumentType Objects.\n(line   33)\n* name (zipfile.Path attribute):         Path Objects.       (line   21)\n* name; binding:                         The import statement.\n(line    6)\n* name; binding <1>:                     The import statement.\n(line   52)\n* name; binding <2>:                     Function definitions.\n(line    6)\n* name; binding <3>:                     Function definitions.\n(line    6)\n* name; binding <4>:                     Class definitions.  (line    6)\n* name; mangling:                        Private Variables.  (line   13)\n* name; mangling <1>:                    Identifiers Names.  (line   14)\n* name() (in module unicodedata):        unicodedata -- Unicode Database.\n(line   25)\n* name2codepoint (in module html.entities): html entities -- Definitions of HTML general entities.\n(line   30)\n* named expression:                      Boolean operations. (line   37)\n* Named Shared Memory:                   multiprocessing sharedmemory -- Shared memory for direct access across processes.\n(line   10)\n* named tuple:                           Glossary.           (line  928)\n* NAMEDFLAGS (enum.EnumCheck attribute): Data Types<2>.     (line  599)\n* NamedExpr (class in ast):              Expressions<2>.     (line  185)\n* NamedTemporaryFile() (in module tempfile): tempfile -- Generate temporary files and directories.\n(line   74)\n* NamedTuple (class in typing):          Other special directives.\n(line   10)\n* namedtuple() (in module collections):  namedtuple Factory Function for Tuples with Named Fields.\n(line   11)\n* NameError:                             Concrete exceptions.\n(line  111)\n* NameError (built-in exception):        Resolution of names.\n(line   16)\n* namelist() (zipfile.ZipFile method):   ZipFile Objects.    (line  126)\n* nameprep() (in module encodings.idna): encodings idna -- Internationalized Domain Names in Applications.\n(line   50)\n* namer (logging.handlers.BaseRotatingHandler attribute): BaseRotatingHandler.\n(line   17)\n* namereplaceerrors() (in module codecs): Error Handlers.   (line  181)\n* namereplace; error handler's name:     Error Handlers.     (line   54)\n* names() (in module tkinter.font):      tkinter font -- Tkinter font wrapper.\n(line   92)\n* namespace:                             Naming and binding. (line    6)\n* namespace <1>:                         Glossary.           (line  955)\n* Namespace (class in argparse):         The Namespace object.\n(line    6)\n* Namespace (class in multiprocessing.managers): Managers.   (line  243)\n* namespace package:                     Glossary.           (line  969)\n* NAMESPACEDNS (in module uuid):        uuid -- UUID objects according to RFC 4122.\n(line  206)\n* NAMESPACEOID (in module uuid):        uuid -- UUID objects according to RFC 4122.\n(line  215)\n* NAMESPACEURL (in module uuid):        uuid -- UUID objects according to RFC 4122.\n(line  211)\n* NAMESPACEX500 (in module uuid):       uuid -- UUID objects according to RFC 4122.\n(line  219)\n* namespace() (imaplib.IMAP4 method):    IMAP4 Objects.      (line  162)\n* Namespace() (multiprocessing.managers.SyncManager method): Managers.\n(line  193)\n* NamespaceErr:                          Exceptions<18>.     (line   66)\n* NamespaceLoader (class in importlib.machinery): importlib machinery - Importers and path hooks.\n(line  347)\n* namespaceURI (xml.dom.Node attribute): Node Objects.       (line   74)\n* nametofont() (in module tkinter.font): tkinter font -- Tkinter font wrapper.\n(line   96)\n* NaN:                                   Built-in Functions. (line  641)\n* nan (in module cmath):                 Constants<3>.       (line   33)\n* nan (in module math):                  Constants<2>.       (line   31)\n* nan (sys.hashinfo attribute):         sys -- System-specific parameters and functions.\n(line 1006)\n* nanj (in module cmath):                Constants<3>.       (line   40)\n* NannyNag:                              tabnanny -- Detection of ambiguous indentation.\n(line   37)\n* napms() (in module curses):            Functions<6>.       (line  308)\n* nargs (optparse.Option attribute):     Option attributes.  (line   50)\n* nativeid (threading.Thread attribute): Thread Objects.    (line  175)\n* nbytes (memoryview attribute):         Memory Views.       (line  380)\n* ncursesversion (in module curses):    Constants<6>.       (line   24)\n* ND (inspect.BufferFlags attribute):    Buffer flags.       (line   21)\n* ndiff() (in module difflib):           difflib -- Helpers for computing deltas.\n(line  232)\n* ndim (memoryview attribute):           Memory Views.       (line  446)\n* ne (2to3 fixer):                       Fixers.             (line  201)\n* ne() (in module operator):             operator -- Standard operators as functions.\n(line   24)\n* needsinput (bz2.BZ2Decompressor attribute): Incremental de compression.\n(line   85)\n* needsinput (lzma.LZMADecompressor attribute): Compressing and decompressing data in memory.\n(line  175)\n* neg() (in module operator):            operator -- Standard operators as functions.\n(line  132)\n* negation:                              Unary arithmetic and bitwise operations.\n(line   10)\n* nested scope:                          Glossary.           (line  978)\n* netmask (ipaddress.IPv4Network attribute): Network objects.\n(line  101)\n* netmask (ipaddress.IPv6Network attribute): Network objects.\n(line  315)\n* NetmaskValueError:                     Custom Exceptions.  (line   13)\n* netrc (class in netrc):                netrc -- netrc file processing.\n(line   13)\n* NetrcParseError:                       netrc -- netrc file processing.\n(line   44)\n* netscape (http.cookiejar.CookiePolicy attribute): CookiePolicy Objects.\n(line   68)\n* network (ipaddress.IPv4Interface attribute): Interface objects.\n(line   28)\n* network (ipaddress.IPv6Interface attribute): Interface objects.\n(line   76)\n* Network News Transfer Protocol:        nntplib -- NNTP protocol client.\n(line    8)\n* networkaddress (ipaddress.IPv4Network attribute): Network objects.\n(line   86)\n* networkaddress (ipaddress.IPv6Network attribute): Network objects.\n(line  309)\n* Never (in module typing):              Special types.      (line   89)\n* NEVEREQ (in module test.support):     test support -- Utilities for the Python test suite.\n(line  180)\n* newchild() (collections.ChainMap method): ChainMap objects.\n(line   46)\n* newclass() (in module types):         Dynamic Type Creation.\n(line    6)\n* neweventloop() (asyncio.AbstractEventLoopPolicy method): Policy Objects.\n(line   27)\n* neweventloop() (in module asyncio):  Event Loop.         (line   67)\n* newpanel() (in module curses.panel):  Functions<7>.       (line   12)\n* new-style class:                       Glossary.           (line  988)\n* new() (in module hashlib):             Constructors.       (line    6)\n* new() (in module hmac):                hmac -- Keyed-Hashing for Message Authentication.\n(line   12)\n* newfunc (C type):                      Slot Type typedefs. (line   31)\n* newgroups() (nntplib.NNTP method):     Methods<3>.         (line   80)\n* NEWLINE (in module token):             token -- Constants used with Python parse trees.\n(line   48)\n* NEWLINE token:                         Logical lines.      (line    6)\n* NEWLINE token <1>:                     Compound statements.\n(line   55)\n* newlines (io.TextIOBase attribute):    Text I/O<2>.        (line   24)\n* newnews() (nntplib.NNTP method):       Methods<3>.         (line   95)\n* newpad() (in module curses):           Functions<6>.       (line  312)\n* NewType (class in typing):             Other special directives.\n(line   85)\n* newwin() (in module curses):           Functions<6>.       (line  332)\n* next (2to3 fixer):                     Fixers.             (line  205)\n* next (pdb command):                    Debugger Commands.  (line  192)\n* nextminus() (decimal.Context method): Context objects.    (line  411)\n* nextminus() (decimal.Decimal method): Decimal objects.    (line  399)\n* nextplus() (decimal.Context method):  Context objects.    (line  415)\n* nextplus() (decimal.Decimal method):  Decimal objects.    (line  405)\n* nexttoward() (decimal.Context method): Context objects.   (line  419)\n* nexttoward() (decimal.Decimal method): Decimal objects.   (line  411)\n* next() (nntplib.NNTP method):          Methods<3>.         (line  233)\n* next() (tarfile.TarFile method):       TarFile Objects.    (line  126)\n* next() (tkinter.ttk.Treeview method):  ttk Treeview.       (line  222)\n* nextafter() (in module math):          Number-theoretic and representation functions.\n(line  189)\n* nextfile() (in module fileinput):      fileinput -- Iterate over lines from multiple input streams.\n(line  121)\n* nextkey() (dbm.gnu.gdbm method):       dbm gnu -- GNU database manager.\n(line   88)\n* nextSibling (xml.dom.Node attribute):  Node Objects.       (line   42)\n* ngettext() (gettext.GNUTranslations method): The GNUTranslations class.\n(line   47)\n* ngettext() (gettext.NullTranslations method): The NullTranslations class.\n(line   41)\n* ngettext() (in module gettext):        GNU gettext API.    (line   44)\n* nice() (in module os):                 Process Management. (line  358)\n* NL (in module curses.ascii):           curses ascii -- Utilities for ASCII characters.\n(line   55)\n* NL (in module token):                  token -- Constants used with Python parse trees.\n(line  266)\n* nllanginfo() (in module locale):      locale -- Internationalization services.\n(line  172)\n* nl() (in module curses):               Functions<6>.       (line  342)\n* nlargest() (in module heapq):          heapq -- Heap queue algorithm.\n(line  106)\n* nlst() (ftplib.FTP method):            FTP objects.        (line  301)\n* NNTP (class in nntplib):               nntplib -- NNTP protocol client.\n(line   63)\n* nntpimplementation (nntplib.NNTP attribute): Attributes<2>.\n(line   14)\n* NNTPSSL (class in nntplib):           nntplib -- NNTP protocol client.\n(line  106)\n* nntpversion (nntplib.NNTP attribute): Attributes<2>.      (line    6)\n* NNTP; protocol:                        nntplib -- NNTP protocol client.\n(line    8)\n* NNTPDataError:                         nntplib -- NNTP protocol client.\n(line  170)\n* NNTPError:                             nntplib -- NNTP protocol client.\n(line  139)\n* NNTPPermanentError:                    nntplib -- NNTP protocol client.\n(line  160)\n* NNTPProtocolError:                     nntplib -- NNTP protocol client.\n(line  165)\n* NNTPReplyError:                        nntplib -- NNTP protocol client.\n(line  150)\n* NNTPTemporaryError:                    nntplib -- NNTP protocol client.\n(line  155)\n* NO (in module tkinter.messagebox):     tkinter messagebox -- Tkinter message prompts.\n(line  159)\n* nocache() (zoneinfo.ZoneInfo class method): The ZoneInfo class.\n(line   41)\n* NOEVENTS (monitoring event):          Events.             (line   94)\n* noproxy:                              urllib request -- Extensible library for opening URLs.\n(line  313)\n* nosite (sys.flags attribute):         sys -- System-specific parameters and functions.\n(line  538)\n* notracing() (in module test.support): test support -- Utilities for the Python test suite.\n(line  533)\n* notypecheckdecorator() (in module typing): Functions and decorators.\n(line  360)\n* notypecheck() (in module typing):    Functions and decorators.\n(line  348)\n* nousersite (sys.flags attribute):    sys -- System-specific parameters and functions.\n(line  535)\n* nocbreak() (in module curses):         Functions<6>.       (line  348)\n* NoDataAllowedErr:                      Exceptions<18>.     (line   83)\n* node (uuid.UUID attribute):            uuid -- UUID objects according to RFC 4122.\n(line  119)\n* node() (in module platform):           Cross Platform.     (line   40)\n* nodelay() (curses.window method):      Window Objects.     (line  411)\n* nodeName (xml.dom.Node attribute):     Node Objects.       (line   79)\n* NodeTransformer (class in ast):        ast Helpers.        (line  218)\n* nodeType (xml.dom.Node attribute):     Node Objects.       (line    8)\n* nodeValue (xml.dom.Node attribute):    Node Objects.       (line   88)\n* NodeVisitor (class in ast):            ast Helpers.        (line  178)\n* noecho() (in module curses):           Functions<6>.       (line  353)\n* NOEXPR (in module locale):             locale -- Internationalization services.\n(line  281)\n* NOFLAG (in module re):                 Flags.              (line   96)\n* NoModificationAllowedErr:              Exceptions<18>.     (line   88)\n* nonblock() (ossaudiodev.ossaudiodevice method): Audio Device Objects.\n(line   75)\n* NonCallableMagicMock (class in unittest.mock): Magic Mock. (line   22)\n* NonCallableMock (class in unittest.mock): The Mock Class.  (line  559)\n* None (Built-in object):                Truth Value Testing.\n(line   15)\n* None (built-in variable):              Built-in Constants. (line   18)\n* NoneType (in module types):            Standard Interpreter Types.\n(line   19)\n* nonl() (in module curses):             Functions<6>.       (line  357)\n* Nonlocal (class in ast):               Function and class definitions.\n(line  156)\n* nonmember() (in module enum):          Utilities and Decorators.\n(line   85)\n* nonzero (2to3 fixer):                  Fixers.             (line  211)\n* noop() (imaplib.IMAP4 method):         IMAP4 Objects.      (line  166)\n* noop() (poplib.POP3 method):           POP3 Objects.       (line   79)\n* NoOptionError:                         Exceptions<7>.      (line   32)\n* NOP (opcode):                          Python Bytecode Instructions.\n(line   82)\n* noqiflush() (in module curses):        Functions<6>.       (line  367)\n* noraw() (in module curses):            Functions<6>.       (line  375)\n* NoReturn (in module typing):           Special types.      (line  115)\n* NORMAL (in module tkinter.font):       tkinter font -- Tkinter font wrapper.\n(line   15)\n* NORMALPRIORITYCLASS (in module subprocess): Windows Constants.\n(line   80)\n* NormalDist (class in statistics):      NormalDist objects. (line   13)\n* NORMALIZEWHITESPACE (in module doctest): Option Flags.    (line   39)\n* normalize() (decimal.Context method):  Context objects.    (line  423)\n* normalize() (decimal.Decimal method):  Decimal objects.    (line  419)\n* normalize() (in module locale):        locale -- Internationalization services.\n(line  419)\n* normalize() (in module unicodedata):   unicodedata -- Unicode Database.\n(line   81)\n* normalize() (xml.dom.Node method):     Node Objects.       (line  141)\n* normalvariate() (in module random):    Real-valued distributions.\n(line   85)\n* normcase() (in module os.path):        os path -- Common pathname manipulations.\n(line  297)\n* normpath() (in module os.path):        os path -- Common pathname manipulations.\n(line  306)\n* NoSectionError:                        Exceptions<7>.      (line   10)\n* NoSuchMailboxError:                    Exceptions<16>.     (line   12)\n* Not (class in ast):                    Expressions<2>.     (line   28)\n* not() (in module operator):           operator -- Standard operators as functions.\n(line   49)\n* NotADirectoryError:                    OS exceptions.      (line   89)\n* notation:                              Notation.           (line    6)\n* notationDecl() (xml.sax.handler.DTDHandler method): DTDHandler Objects.\n(line    8)\n* NotationDeclHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line  313)\n* notations (xml.dom.DocumentType attribute): DocumentType Objects.\n(line   46)\n* NotConnected:                          http client -- HTTP protocol client.\n(line  137)\n* NoteBook (class in tkinter.tix):       Manager Widgets.    (line   22)\n* Notebook (class in tkinter.ttk):       ttk Notebook.       (line    6)\n* NotEmptyError:                         Exceptions<16>.     (line   19)\n* NotEq (class in ast):                  Expressions<2>.     (line  109)\n* NOTEQUAL (in module token):            token -- Constants used with Python parse trees.\n(line  138)\n* NotFoundErr:                           Exceptions<18>.     (line   72)\n* notifyall() (asyncio.Condition method): Condition.        (line   67)\n* notifyall() (threading.Condition method): Condition Objects.\n(line  172)\n* notify() (asyncio.Condition method):   Condition.          (line   54)\n* notify() (threading.Condition method): Condition Objects.  (line  152)\n* notimeout() (curses.window method):    Window Objects.     (line  415)\n* NotImplemented (built-in variable):    Built-in Constants. (line   25)\n* NotImplementedError:                   Concrete exceptions.\n(line  123)\n* NotImplementedType (in module types):  Standard Interpreter Types.\n(line  103)\n* NotIn (class in ast):                  Expressions<2>.     (line  109)\n* NotRequired (in module typing):        Special forms.      (line  219)\n* NOTSET (in module logging):            Logging Levels.     (line   16)\n* NotStandaloneHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line  364)\n* NotSupportedErr:                       Exceptions<18>.     (line   78)\n* NotSupportedError:                     Exceptions<6>.      (line   85)\n* noutrefresh() (curses.window method):  Window Objects.     (line  423)\n* NOVEMBER (in module calendar):         calendar -- General calendar-related functions.\n(line  414)\n* now() (datetime.datetime class method): datetime Objects.  (line   60)\n* npgettext() (gettext.GNUTranslations method): The GNUTranslations class.\n(line   79)\n* npgettext() (gettext.NullTranslations method): The NullTranslations class.\n(line   55)\n* npgettext() (in module gettext):       GNU gettext API.    (line   67)\n* NSIG (in module signal):               Module contents<2>. (line  208)\n* nsmallest() (in module heapq):         heapq -- Heap queue algorithm.\n(line  114)\n* NTOFFSET (in module token):           token -- Constants used with Python parse trees.\n(line  272)\n* NTEventLogHandler (class in logging.handlers): NTEventLogHandler.\n(line   11)\n* ntohl() (in module socket):            Other functions<2>. (line  197)\n* ntohs() (in module socket):            Other functions<2>. (line  204)\n* ntransfercmd() (ftplib.FTP method):    FTP objects.        (line  278)\n* NUL (in module curses.ascii):          curses ascii -- Utilities for ASCII characters.\n(line   19)\n* null; operation:                       The pass statement. (line    6)\n* null; operation <1>:                   The pass statement. (line    6)\n* nullcontext() (in module contextlib):  Utilities.          (line  221)\n* NullHandler (class in logging):        NullHandler.        (line   12)\n* NullTranslations (class in gettext):   The NullTranslations class.\n(line   13)\n* numaddresses (ipaddress.IPv4Network attribute): Network objects.\n(line  128)\n* numaddresses (ipaddress.IPv6Network attribute): Network objects.\n(line  327)\n* numtickets (ssl.SSLContext attribute): SSL Contexts.      (line  553)\n* number:                                Numeric literals.   (line    6)\n* Number (class in numbers):             numbers -- Numeric abstract base classes.\n(line   15)\n* NUMBER (in module token):              token -- Constants used with Python parse trees.\n(line   44)\n* numberclass() (decimal.Context method): Context objects.  (line  427)\n* numberclass() (decimal.Decimal method): Decimal objects.  (line  442)\n* numerator (fractions.Fraction attribute): fractions -- Rational numbers.\n(line  110)\n* numerator (numbers.Rational attribute): The numeric tower. (line   51)\n* numeric literal:                       Numeric literals.   (line    6)\n* numeric; conversions:                  Numeric Types -- int float complex.\n(line  107)\n* numeric; literals:                     Numeric Types -- int float complex.\n(line   19)\n* numeric() (in module unicodedata):     unicodedata -- Unicode Database.\n(line   43)\n* numinput() (in module turtle):         Input methods.      (line   22)\n* numliterals (2to3 fixer):              Fixers.             (line  216)\n* OAPPEND (in module os):               File Descriptor Operations.\n(line  406)\n* OASYNC (in module os):                File Descriptor Operations.\n(line  449)\n* OBINARY (in module os):               File Descriptor Operations.\n(line  428)\n* OCLOEXEC (in module os):              File Descriptor Operations.\n(line  416)\n* OCREAT (in module os):                File Descriptor Operations.\n(line  406)\n* ODIRECT (in module os):               File Descriptor Operations.\n(line  449)\n* ODIRECTORY (in module os):            File Descriptor Operations.\n(line  449)\n* ODSYNC (in module os):                File Descriptor Operations.\n(line  416)\n* OEVTONLY (in module os):              File Descriptor Operations.\n(line  438)\n* OEXCL (in module os):                 File Descriptor Operations.\n(line  406)\n* OEXLOCK (in module os):               File Descriptor Operations.\n(line  449)\n* OFSYNC (in module os):                File Descriptor Operations.\n(line  438)\n* ONDELAY (in module os):               File Descriptor Operations.\n(line  416)\n* ONOATIME (in module os):              File Descriptor Operations.\n(line  449)\n* ONOCTTY (in module os):               File Descriptor Operations.\n(line  416)\n* ONOFOLLOW (in module os):             File Descriptor Operations.\n(line  449)\n* ONOFOLLOWANY (in module os):         File Descriptor Operations.\n(line  438)\n* ONOINHERIT (in module os):            File Descriptor Operations.\n(line  428)\n* ONONBLOCK (in module os):             File Descriptor Operations.\n(line  416)\n* OPATH (in module os):                 File Descriptor Operations.\n(line  449)\n* ORANDOM (in module os):               File Descriptor Operations.\n(line  428)\n* ORDONLY (in module os):               File Descriptor Operations.\n(line  406)\n* ORDWR (in module os):                 File Descriptor Operations.\n(line  406)\n* ORSYNC (in module os):                File Descriptor Operations.\n(line  416)\n* OSEQUENTIAL (in module os):           File Descriptor Operations.\n(line  428)\n* OSHLOCK (in module os):               File Descriptor Operations.\n(line  449)\n* OSHORTLIVED (in module os):          File Descriptor Operations.\n(line  428)\n* OSYMLINK (in module os):              File Descriptor Operations.\n(line  438)\n* OSYNC (in module os):                 File Descriptor Operations.\n(line  416)\n* OTEMPORARY (in module os):            File Descriptor Operations.\n(line  428)\n* OTEXT (in module os):                 File Descriptor Operations.\n(line  428)\n* OTMPFILE (in module os):              File Descriptor Operations.\n(line  449)\n* OTRUNC (in module os):                File Descriptor Operations.\n(line  406)\n* OWRONLY (in module os):               File Descriptor Operations.\n(line  406)\n* obj (memoryview attribute):            Memory Views.       (line  369)\n* object:                                Objects values and types.\n(line    6)\n* object <1>:                            Glossary.           (line  996)\n* object (built-in class):               Built-in Functions. (line 1098)\n* object (UnicodeError attribute):       Concrete exceptions.\n(line  422)\n* object; asynchronous-generator:        Asynchronous generator functions<2>.\n(line   66)\n* object; Boolean:                       numbers Integral.   (line   27)\n* object; Boolean <1>:                   Numeric Types -- int float complex.\n(line    6)\n* object; built-in function:             Built-in functions. (line    6)\n* object; built-in function <1>:         Calls.              (line  141)\n* object; built-in method:               Built-in methods.   (line    6)\n* object; built-in method <1>:           Calls.              (line  141)\n* object; bytearray:                     Mutable Sequence Types.\n(line    6)\n* object; bytearray <1>:                 Binary Sequence Types -- bytes bytearray memoryview.\n(line    6)\n* object; bytearray <2>:                 Bytearray Objects.  (line    6)\n* object; bytearray <3>:                 Byte Array Objects. (line    6)\n* object; bytes:                         Binary Sequence Types -- bytes bytearray memoryview.\n(line    6)\n* object; bytes <1>:                     Bytes Objects.      (line    6)\n* object; bytes <2>:                     Bytes Objects<2>.   (line    9)\n* object; callable:                      Callable types.     (line    6)\n* object; callable <1>:                  Slicings.           (line   39)\n* object; Capsule:                       Capsules<2>.        (line    6)\n* object; class:                         Custom classes.     (line   20)\n* object; class <1>:                     Calls.              (line  146)\n* object; class <2>:                     Class definitions.  (line    6)\n* object; class instance:                Custom classes.     (line   20)\n* object; class instance <1>:            Class instances.    (line    6)\n* object; class instance <2>:            Calls.              (line  150)\n* object; code:                          Code objects.       (line    6)\n* object; code <1>:                      Methods.            (line   44)\n* object; code <2>:                      marshal -- Internal Python object serialization.\n(line   30)\n* object; code <3>:                      Cell Objects.       (line   55)\n* object; complex:                       numbers Complex complex.\n(line    6)\n* object; complex number:                Numeric Types -- int float complex.\n(line    6)\n* object; complex number <1>:            Complex Number Objects.\n(line    6)\n* object; deallocation:                  Finalization and De-allocation.\n(line    6)\n* object; dictionary:                    Dictionaries<2>.    (line    6)\n* object; dictionary <1>:                Custom classes.     (line   20)\n* object; dictionary <2>:                Basic customization.\n(line  227)\n* object; dictionary <3>:                Dictionary displays.\n(line    6)\n* object; dictionary <4>:                Subscriptions.      (line    6)\n* object; dictionary <5>:                Assignment statements.\n(line  115)\n* object; dictionary <6>:                Mapping Types -- dict.\n(line    6)\n* object; dictionary <7>:                Dictionary Objects. (line    6)\n* object; Ellipsis:                      Ellipsis.           (line    6)\n* object; file:                          Reading and Writing Files.\n(line    6)\n* object; file <1>:                      File Objects.       (line    6)\n* object; finalization:                  Finalization and De-allocation.\n(line    6)\n* object; floating point:                numbers Real float. (line    6)\n* object; floating point <1>:            Numeric Types -- int float complex.\n(line    6)\n* object; floating point <2>:            Floating Point Objects.\n(line    6)\n* object; frame:                         Frame objects.      (line    6)\n* object; frozenset:                     Set types.          (line   29)\n* object; frozenset <1>:                 Set Objects.        (line    6)\n* object; function:                      User-defined functions.\n(line    6)\n* object; function <1>:                  Built-in functions. (line    6)\n* object; function <2>:                  Calls.              (line  132)\n* object; function <3>:                  Calls.              (line  141)\n* object; function <4>:                  Function definitions.\n(line    6)\n* object; function <5>:                  Function Objects<3>.\n(line    6)\n* object; generator:                     Special read-only attributes<2>.\n(line   83)\n* object; generator <1>:                 Generator expressions.\n(line    6)\n* object; generator <2>:                 Yield expressions.  (line  110)\n* object; GenericAlias:                  Generic Alias Type. (line    6)\n* object; immutable:                     Immutable sequences.\n(line    6)\n* object; immutable sequence:            Immutable sequences.\n(line    6)\n* object; instance:                      Custom classes.     (line   20)\n* object; instance <1>:                  Class instances.    (line    6)\n* object; instance <2>:                  Calls.              (line  150)\n* object; instancemethod:                Instance Method Objects.\n(line    6)\n* object; integer:                       numbers Integral.   (line    6)\n* object; integer <1>:                   Numeric Types -- int float complex.\n(line    6)\n* object; integer <2>:                   Integer Objects.    (line    6)\n* object; io.StringIO:                   Text Sequence Type -- str.\n(line   36)\n* object; list:                          Mutable sequences.  (line   18)\n* object; list <1>:                      List displays.      (line    6)\n* object; list <2>:                      Attribute references.\n(line   10)\n* object; list <3>:                      Subscriptions.      (line    6)\n* object; list <4>:                      Slicings.           (line    6)\n* object; list <5>:                      Assignment statements.\n(line  106)\n* object; list <6>:                      Mutable Sequence Types.\n(line    6)\n* object; list <7>:                      Lists<2>.           (line    6)\n* object; list <8>:                      List Objects.       (line    6)\n* object; long integer:                  Integer Objects.    (line    6)\n* object; mapping:                       Mappings.           (line    6)\n* object; mapping <1>:                   Class instances.    (line   26)\n* object; mapping <2>:                   Subscriptions.      (line    6)\n* object; mapping <3>:                   Assignment statements.\n(line  115)\n* object; mapping <4>:                   Mapping Types -- dict.\n(line    6)\n* object; mapping <5>:                   Container Objects.  (line    6)\n* object; memoryview:                    Binary Sequence Types -- bytes bytearray memoryview.\n(line    6)\n* object; memoryview <1>:                Ellipsis Object.    (line   13)\n* object; method:                        Instance Objects.   (line   31)\n* object; method <1>:                    Instance methods.   (line    6)\n* object; method <2>:                    Built-in methods.   (line    6)\n* object; method <3>:                    Calls.              (line  141)\n* object; method <4>:                    Methods.            (line    6)\n* object; method <5>:                    Method Objects<2>.  (line    6)\n* object; module:                        Modules<3>.         (line    6)\n* object; module <1>:                    Attribute references.\n(line   10)\n* object; module <2>:                    Module Objects.     (line    6)\n* object; mutable:                       Mutable sequences.  (line    6)\n* object; mutable <1>:                   Assignment statements.\n(line    6)\n* object; mutable <2>:                   Assignment statements.\n(line  101)\n* object; mutable sequence:              Mutable sequences.  (line    6)\n* object; None:                          None.               (line    6)\n* object; None <1>:                      Expression statements.\n(line   17)\n* object; None <2>:                      The None Object.    (line    6)\n* object; NotImplemented:                NotImplemented.     (line    6)\n* object; numeric:                       numbers Number.     (line    6)\n* object; numeric <1>:                   Class instances.    (line   26)\n* object; numeric <2>:                   Comparisons<2>.     (line   43)\n* object; numeric <3>:                   Numeric Types -- int float complex.\n(line    6)\n* object; numeric <4>:                   Numeric Objects.    (line    6)\n* object; range:                         Ranges.             (line    6)\n* object; sequence:                      Sequences.          (line    6)\n* object; sequence <1>:                  Class instances.    (line   26)\n* object; sequence <2>:                  Subscriptions.      (line    6)\n* object; sequence <3>:                  Slicings.           (line    6)\n* object; sequence <4>:                  Membership test operations.\n(line   36)\n* object; sequence <5>:                  Assignment statements.\n(line  106)\n* object; sequence <6>:                  The for statement.  (line    6)\n* object; sequence <7>:                  Common Sequence Operations.\n(line    6)\n* object; sequence <8>:                  Sequence Objects.   (line    6)\n* object; set:                           Set types.          (line   23)\n* object; set <1>:                       Set displays.       (line    6)\n* object; set <2>:                       Set Types -- set frozenset.\n(line    6)\n* object; set <3>:                       Set Objects.        (line    6)\n* object; set type:                      Set types.          (line    6)\n* object; slice:                         Emulating container types.\n(line   65)\n* object; socket:                        socket -- Low-level networking interface.\n(line   23)\n* object; string:                        Subscriptions.      (line    6)\n* object; string <1>:                    Slicings.           (line    6)\n* object; string <2>:                    Ranges.             (line  125)\n* object; traceback:                     Traceback objects.  (line    6)\n* object; traceback <1>:                 The raise statement.\n(line   21)\n* object; traceback <2>:                 except clause.      (line   59)\n* object; traceback <3>:                 sys -- System-specific parameters and functions.\n(line  448)\n* object; traceback <4>:                 traceback -- Print or retrieve a stack traceback.\n(line   16)\n* object; tuple:                         Immutable sequences.\n(line   29)\n* object; tuple <1>:                     Subscriptions.      (line    6)\n* object; tuple <2>:                     Slicings.           (line    6)\n* object; tuple <3>:                     Expression lists.   (line   11)\n* object; tuple <4>:                     Immutable Sequence Types.\n(line    6)\n* object; tuple <5>:                     Tuples.             (line    6)\n* object; tuple <6>:                     Tuple Objects.      (line    6)\n* object; type:                          Built-in Functions. (line 1846)\n* object; type <1>:                      Objects Types and Reference Counts.\n(line    6)\n* object; type <2>:                      Type Objects<2>.    (line    6)\n* object; Union:                         Union Type.         (line    6)\n* object; user-defined function:         User-defined functions.\n(line    6)\n* object; user-defined function <1>:     Calls.              (line  132)\n* object; user-defined function <2>:     Function definitions.\n(line    6)\n* object; user-defined method:           Instance methods.   (line    6)\n* object.matchargs (built-in variable): Customizing positional arguments in class pattern matching.\n(line   12)\n* object.slots (built-in variable):  slots<2>.       (line   14)\n* objects; comparing:                    Comparisons<2>.     (line   43)\n* objobjargproc (C type):                Slot Type typedefs. (line  138)\n* objobjproc (C type):                   Slot Type typedefs. (line  134)\n* obufcount() (ossaudiodev.ossaudiodevice method): Audio Device Objects.\n(line  218)\n* obuffree() (ossaudiodev.ossaudiodevice method): Audio Device Objects.\n(line  223)\n* octal literal:                         Numeric literals.   (line    6)\n* octal; literals:                       Numeric Types -- int float complex.\n(line   19)\n* octdigits (in module string):          String constants.   (line   32)\n* OCTOBER (in module calendar):          calendar -- General calendar-related functions.\n(line  414)\n* offset (SyntaxError attribute):        Concrete exceptions.\n(line  298)\n* offset (tarfile.TarInfo attribute):    TarInfo Objects.    (line  149)\n* offset (traceback.TracebackException attribute): TracebackException Objects.\n(line   97)\n* offset (xml.parsers.expat.ExpatError attribute): ExpatError Exceptions.\n(line   32)\n* offsetdata (tarfile.TarInfo attribute): TarInfo Objects.  (line  153)\n* OK (in module curses):                 Constants<6>.       (line   13)\n* OK (in module tkinter.messagebox):     tkinter messagebox -- Tkinter message prompts.\n(line  153)\n* okcommand() (tkinter.filedialog.LoadFileDialog method): Native Load/Save Dialogs.\n(line  140)\n* okcommand() (tkinter.filedialog.SaveFileDialog method): Native Load/Save Dialogs.\n(line  150)\n* okevent() (tkinter.filedialog.FileDialog method): Native Load/Save Dialogs.\n(line  119)\n* OKCANCEL (in module tkinter.messagebox): tkinter messagebox -- Tkinter message prompts.\n(line  171)\n* oldvalue (contextvars.Token attribute): Context Variables.\n(line   87)\n* OleDLL (class in ctypes):              Loading shared libraries.\n(line   35)\n* onmotion() (tkinter.dnd.DndHandler method): tkinter dnd -- Drag and drop support.\n(line   56)\n* onrelease() (tkinter.dnd.DndHandler method): tkinter dnd -- Drag and drop support.\n(line   61)\n* onclick() (in module turtle):          Using screen events.\n(line   56)\n* ondrag() (in module turtle):           Using events.       (line   57)\n* onecmd() (cmd.Cmd method):             Cmd Objects.        (line   59)\n* onkey() (in module turtle):            Using screen events.\n(line   12)\n* onkeypress() (in module turtle):       Using screen events.\n(line   35)\n* onkeyrelease() (in module turtle):     Using screen events.\n(line   12)\n* onrelease() (in module turtle):        Using events.       (line   30)\n* onscreenclick() (in module turtle):    Using screen events.\n(line   56)\n* ontimer() (in module turtle):          Using screen events.\n(line   86)\n* OP (in module token):                  token -- Constants used with Python parse trees.\n(line  246)\n* OPALL (in module ssl):                Constants<9>.       (line  210)\n* OPCIPHERSERVERPREFERENCE (in module ssl): Constants<9>. (line  299)\n* OPENABLEKTLS (in module ssl):        Constants<9>.       (line  357)\n* OPENABLEMIDDLEBOXCOMPAT (in module ssl): Constants<9>.  (line  323)\n* OPIGNOREUNEXPECTEDEOF (in module ssl): Constants<9>.    (line  349)\n* OPLEGACYSERVERCONNECT (in module ssl): Constants<9>.    (line  374)\n* OPNOCOMPRESSION (in module ssl):     Constants<9>.       (line  332)\n* OPNORENEGOTIATION (in module ssl):   Constants<9>.       (line  289)\n* OPNOSSLv2 (in module ssl):           Constants<9>.       (line  218)\n* OPNOSSLv3 (in module ssl):           Constants<9>.       (line  228)\n* OPNOTICKET (in module ssl):          Constants<9>.       (line  343)\n* OPNOTLSv1 (in module ssl):           Constants<9>.       (line  238)\n* OPNOTLSv11 (in module ssl):         Constants<9>.       (line  250)\n* OPNOTLSv12 (in module ssl):         Constants<9>.       (line  262)\n* OPNOTLSv13 (in module ssl):         Constants<9>.       (line  274)\n* OPSINGLEDHUSE (in module ssl):      Constants<9>.       (line  307)\n* OPSINGLEECDHUSE (in module ssl):    Constants<9>.       (line  315)\n* Open (class in tkinter.filedialog):    Native Load/Save Dialogs.\n(line   60)\n* openbinary() (in module importlib.resources): Deprecated functions.\n(line   30)\n* opencode() (in module io):            High-level Module Interface.\n(line   22)\n* openconnection() (in module asyncio): Streams.            (line   42)\n* openflags (in module dbm.gnu):        dbm gnu -- GNU database manager.\n(line   71)\n* opennewtab() (in module webbrowser): webbrowser -- Convenient web-browser controller.\n(line   78)\n* opennewtab() (webbrowser.controller method): Browser Controller Objects.\n(line   25)\n* opennew() (in module webbrowser):     webbrowser -- Convenient web-browser controller.\n(line   73)\n* opennew() (webbrowser.controller method): Browser Controller Objects.\n(line   19)\n* openosfhandle() (in module msvcrt):   File Operations.    (line   44)\n* openresource() (importlib.abc.ResourceReader method): importlib abc - Abstract base classes related to import.\n(line  498)\n* openresource() (importlib.resources.abc.ResourceReader method): importlib resources abc - Abstract base classes for resources.\n(line   47)\n* opentext() (in module importlib.resources): Deprecated functions.\n(line   46)\n* openunixconnection() (in module asyncio): Streams.       (line  116)\n* openunknown() (urllib.request.URLopener method): Legacy interface.\n(line  109)\n* openurlresource() (in module test.support): test support -- Utilities for the Python test suite.\n(line  575)\n* open() (imaplib.IMAP4 method):         IMAP4 Objects.      (line  170)\n* open() (importlib.abc.Traversable method): importlib abc - Abstract base classes related to import.\n(line  575)\n* open() (importlib.resources.abc.Traversable method): importlib resources abc - Abstract base classes for resources.\n(line  141)\n* open() (in module aifc):               aifc -- Read and write AIFF and AIFC files.\n(line   33)\n* open() (in module bz2):                De compression of files.\n(line    6)\n* open() (in module codecs):             codecs -- Codec registry and base classes.\n(line  173)\n* open() (in module dbm.dumb):           dbm dumb -- Portable DBM implementation.\n(line   29)\n* open() (in module dbm.gnu):            dbm gnu -- GNU database manager.\n(line   23)\n* open() (in module dbm.ndbm):           dbm ndbm -- New Database Manager.\n(line   33)\n* open() (in module dbm):                dbm -- Interfaces to Unix \"databases\".\n(line   42)\n* open() (in module gzip):               gzip -- Support for gzip files.\n(line   28)\n* open() (in module io):                 High-level Module Interface.\n(line   12)\n* open() (in module lzma):               Reading and writing compressed files.\n(line    6)\n* open() (in module os):                 File Descriptor Operations.\n(line  361)\n* open() (in module ossaudiodev):        ossaudiodev -- Access to OSS-compatible audio devices.\n(line   46)\n* open() (in module shelve):             shelve -- Python object persistence.\n(line   17)\n* open() (in module sunau):              sunau -- Read and write Sun AU files.\n(line   51)\n* open() (in module tarfile):            tarfile -- Read and write tar archive files.\n(line   41)\n* open() (in module tokenize):           Tokenizing Input.   (line  100)\n* open() (in module wave):               wave -- Read and write WAV files.\n(line   21)\n* open() (in module webbrowser):         webbrowser -- Convenient web-browser controller.\n(line   56)\n* open() (pathlib.Path method):          Methods<2>.         (line  391)\n* open() (pipes.Template method):        Template Objects.   (line   42)\n* open() (tarfile.TarFile class method): TarFile Objects.    (line   92)\n* open() (telnetlib.Telnet method):      Telnet Objects.     (line   64)\n* open() (urllib.request.OpenerDirector method): OpenerDirector Objects.\n(line   46)\n* open() (urllib.request.URLopener method): Legacy interface.\n(line   98)\n* open() (webbrowser.controller method): Browser Controller Objects.\n(line   13)\n* open() (zipfile.Path method):          Path Objects.       (line   25)\n* open() (zipfile.ZipFile method):       ZipFile Objects.    (line  130)\n* OpenDatabase() (in module msilib):     msilib -- Read and write Microsoft Installer files.\n(line   47)\n* OpenerDirector (class in urllib.request): urllib request -- Extensible library for opening URLs.\n(line  276)\n* OpenKey() (in module winreg):          Functions<13>.      (line  286)\n* OpenKeyEx() (in module winreg):        Functions<13>.      (line  286)\n* openlog() (in module syslog):          syslog -- Unix syslog library routines.\n(line   51)\n* openmixer() (in module ossaudiodev):   ossaudiodev -- Access to OSS-compatible audio devices.\n(line   74)\n* openpty() (in module os):              File Descriptor Operations.\n(line  466)\n* openpty() (in module pty):             pty -- Pseudo-terminal utilities.\n(line   35)\n* OPENSSLVERSION (in module ssl):       Constants<9>.       (line  472)\n* OPENSSLVERSIONINFO (in module ssl):  Constants<9>.       (line  482)\n* OPENSSLVERSIONNUMBER (in module ssl): Constants<9>.      (line  492)\n* OpenSSL; (use in module hashlib):      Hash algorithms.    (line   18)\n* OpenSSL; (use in module ssl):          ssl -- TLS/SSL wrapper for socket objects.\n(line    8)\n* OpenView() (msilib.Database method):   Database Objects.   (line    6)\n* OperationalError:                      Exceptions<6>.      (line   57)\n* operations on; dictionary; type:       Mapping Types -- dict.\n(line    6)\n* operations on; integer; types:         Bitwise Operations on Integer Types.\n(line    6)\n* operations on; list; type:             Mutable Sequence Types.\n(line   16)\n* operations on; mapping; types:         Mapping Types -- dict.\n(line    6)\n* operations on; numeric; types:         Numeric Types -- int float complex.\n(line   94)\n* operations on; sequence; types:        Common Sequence Operations.\n(line   21)\n* operations on; sequence; types <1>:    Mutable Sequence Types.\n(line   16)\n* operator (2to3 fixer):                 Fixers.             (line  220)\n* operator; - (minus):                   Unary arithmetic and bitwise operations.\n(line   10)\n* operator; - (minus) <1>:               Binary arithmetic operations.\n(line   78)\n* operator; - (minus) <2>:               Numeric Types -- int float complex.\n(line   27)\n* operator; !=:                          Comparisons.        (line    6)\n* operator; != <1>:                      Comparisons<2>.     (line    6)\n* operator; @ (at):                      Binary arithmetic operations.\n(line   26)\n* operator; * (asterisk):                Binary arithmetic operations.\n(line   16)\n* operator; * (asterisk) <1>:            Numeric Types -- int float complex.\n(line   27)\n* operator; :                          The power operator. (line    6)\n* operator;  <1>:                      Numeric Types -- int float complex.\n(line   27)\n* operator; / (slash):                   Binary arithmetic operations.\n(line   31)\n* operator; / (slash) <1>:               Numeric Types -- int float complex.\n(line   27)\n* operator; //:                          Binary arithmetic operations.\n(line   31)\n* operator; // <1>:                      Numeric Types -- int float complex.\n(line   27)\n* operator; & (ampersand):               Binary bitwise operations.\n(line   12)\n* operator; & (ampersand) <1>:           Bitwise Operations on Integer Types.\n(line    6)\n* operator; % (percent):                 Binary arithmetic operations.\n(line   41)\n* operator; % (percent) <1>:             Numeric Types -- int float complex.\n(line   27)\n* operator; ^ (caret):                   Binary bitwise operations.\n(line   16)\n* operator; ^ (caret) <1>:               Bitwise Operations on Integer Types.\n(line    6)\n* operator; + (plus):                    Unary arithmetic and bitwise operations.\n(line   14)\n* operator; + (plus) <1>:                Binary arithmetic operations.\n(line   69)\n* operator; + (plus) <2>:                Numeric Types -- int float complex.\n(line   27)\n* operator; < (less):                    Comparisons.        (line    6)\n* operator; < (less) <1>:                Comparisons<2>.     (line    6)\n* operator; <<:                          Shifting operations.\n(line    6)\n* operator; << <1>:                      Bitwise Operations on Integer Types.\n(line    6)\n* operator; <=:                          Comparisons.        (line    6)\n* operator; <= <1>:                      Comparisons<2>.     (line    6)\n* operator; ==:                          Comparisons.        (line    6)\n* operator; == <1>:                      Comparisons<2>.     (line    6)\n* operator; > (greater):                 Comparisons.        (line    6)\n* operator; > (greater) <1>:             Comparisons<2>.     (line    6)\n* operator; >=:                          Comparisons.        (line    6)\n* operator; >= <1>:                      Comparisons<2>.     (line    6)\n* operator; >>:                          Shifting operations.\n(line    6)\n* operator; >> <1>:                      Bitwise Operations on Integer Types.\n(line    6)\n* operator; | (vertical bar):            Binary bitwise operations.\n(line   20)\n* operator; | (vertical bar) <1>:        Bitwise Operations on Integer Types.\n(line    6)\n* operator; ~ (tilde):                   Unary arithmetic and bitwise operations.\n(line   18)\n* operator; ~ (tilde) <1>:               Bitwise Operations on Integer Types.\n(line    6)\n* operator; and:                         Boolean operations. (line   21)\n* operator; and <1>:                     Truth Value Testing.\n(line   23)\n* operator; and <2>:                     Boolean Operations -- and or not.\n(line   22)\n* operator; comparison:                  Comparisons<2>.     (line    6)\n* operator; in:                          Membership test operations.\n(line   36)\n* operator; in <1>:                      Comparisons<2>.     (line   64)\n* operator; in <2>:                      Common Sequence Operations.\n(line   21)\n* operator; is:                          Membership test operations.\n(line   39)\n* operator; is <1>:                      Comparisons<2>.     (line    6)\n* operator; is not:                      Membership test operations.\n(line   39)\n* operator; is not <1>:                  Comparisons<2>.     (line    6)\n* operator; not:                         Boolean operations. (line   18)\n* operator; not <1>:                     Boolean Operations -- and or not.\n(line   22)\n* operator; not in:                      Membership test operations.\n(line   36)\n* operator; not in <1>:                  Comparisons<2>.     (line   64)\n* operator; not in <2>:                  Common Sequence Operations.\n(line   21)\n* operator; or:                          Boolean operations. (line   25)\n* operator; or <1>:                      Truth Value Testing.\n(line   23)\n* operator; or <2>:                      Boolean Operations -- and or not.\n(line   22)\n* operator; overloading:                 Special method names.\n(line    6)\n* operator; precedence:                  Operator precedence.\n(line    6)\n* operators:                             Operators.          (line    6)\n* opmap (in module dis):                 Opcode collections. (line   17)\n* opname (in module dis):                Opcode collections. (line   13)\n* OPT:                                   Debug options.      (line   34)\n* optimargsfrominterpreterflags() (in module test.support): test support -- Utilities for the Python test suite.\n(line  323)\n* optimize (sys.flags attribute):        sys -- System-specific parameters and functions.\n(line  529)\n* optimize() (in module pickletools):    Programmatic Interface<2>.\n(line   31)\n* OPTIMIZEDBYTECODESUFFIXES (in module importlib.machinery): importlib machinery - Importers and path hooks.\n(line   30)\n* Option (class in optparse):            Option attributes.  (line    6)\n* Optional (in module typing):           Special forms.      (line   45)\n* OptionConflictError:                   Exceptions<19>.     (line   11)\n* OptionError:                           Exceptions<19>.     (line    6)\n* OptionGroup (class in optparse):       Grouping Options.   (line   12)\n* OptionMenu (class in tkinter.tix):     Basic Widgets.      (line   49)\n* OptionParser (class in optparse):      Creating the parser.\n(line    9)\n* Options (class in ssl):                Constants<9>.       (line  339)\n* options (doctest.Example attribute):   Example Objects.    (line   53)\n* options (ssl.SSLContext attribute):    SSL Contexts.       (line  561)\n* options() (configparser.ConfigParser method): ConfigParser Objects.\n(line  104)\n* OptionValueError:                      Exceptions<19>.     (line   16)\n* optionxform() (configparser.ConfigParser method): ConfigParser Objects.\n(line  286)\n* Or (class in ast):                     Expressions<2>.     (line   87)\n* or() (in module operator):            operator -- Standard operators as functions.\n(line  137)\n* orderedattributes (xml.parsers.expat.xmlparser attribute): XMLParser Objects<2>.\n(line  145)\n* OrderedDict (class in collections):    OrderedDict objects.\n(line   60)\n* OrderedDict (class in typing):         Aliases to types in collections.\n(line   17)\n* origargv (in module sys):             sys -- System-specific parameters and functions.\n(line 1247)\n* origin (importlib.machinery.ModuleSpec attribute): importlib machinery - Importers and path hooks.\n(line  394)\n* originreqhost (urllib.request.Request attribute): Request Objects.\n(line   30)\n* originserver (wsgiref.handlers.BaseHandler attribute): wsgiref handlers - server/gateway base classes.\n(line  292)\n* osenviron (wsgiref.handlers.BaseHandler attribute): wsgiref handlers - server/gateway base classes.\n(line  169)\n* OSError:                               Concrete exceptions.\n(line  140)\n* OSSAudioError:                         ossaudiodev -- Access to OSS-compatible audio devices.\n(line   33)\n* output:                                Expression statements.\n(line   17)\n* output (subprocess.CalledProcessError attribute): Using the subprocess Module.\n(line  220)\n* output (subprocess.TimeoutExpired attribute): Using the subprocess Module.\n(line  181)\n* output (unittest.TestCase attribute):  Test cases.         (line  439)\n* outputcharset (email.charset.Charset attribute): email charset Representing character sets.\n(line   74)\n* outputcodec (email.charset.Charset attribute): email charset Representing character sets.\n(line   88)\n* outputdifference() (doctest.OutputChecker method): OutputChecker objects.\n(line   27)\n* output() (http.cookies.BaseCookie method): Cookie Objects. (line   24)\n* output() (http.cookies.Morsel method): Morsel Objects.     (line   66)\n* OutputChecker (class in doctest):      OutputChecker objects.\n(line    6)\n* OutputString() (http.cookies.Morsel method): Morsel Objects.\n(line   81)\n* OutsideDestinationError:               tarfile -- Read and write tar archive files.\n(line  243)\n* over() (nntplib.NNTP method):          Methods<3>.         (line  167)\n* Overflow (class in decimal):           Signals.            (line   67)\n* OverflowError:                         Concrete exceptions.\n(line  205)\n* OverflowError (built-in exception):    Integer Objects.    (line  113)\n* OverflowError (built-in exception) <1>: Integer Objects.   (line  152)\n* OverflowError (built-in exception) <2>: Integer Objects.   (line  194)\n* OverflowError (built-in exception) <3>: Integer Objects.   (line  206)\n* OverflowError (built-in exception) <4>: Integer Objects.   (line  218)\n* OverflowError (built-in exception) <5>: Integer Objects.   (line  231)\n* overlap() (statistics.NormalDist method): NormalDist objects.\n(line   96)\n* overlaps() (ipaddress.IPv4Network method): Network objects.\n(line  155)\n* overlaps() (ipaddress.IPv6Network method): Network objects.\n(line  340)\n* overlay() (curses.window method):      Window Objects.     (line  430)\n* overload() (in module typing):         Functions and decorators.\n(line  247)\n* override() (in module typing):         Functions and decorators.\n(line  368)\n* overwrite() (curses.window method):    Window Objects.     (line  443)\n* owner() (pathlib.Path method):         Methods<2>.         (line  403)\n* p (pdb command):                       Debugger Commands.  (line  258)\n* PALL (in module os):                  Process Management. (line  948)\n* PDETACH (in module os):               Process Management. (line  681)\n* PNOWAIT (in module os):               Process Management. (line  661)\n* PNOWAITO (in module os):              Process Management. (line  661)\n* POVERLAY (in module os):              Process Management. (line  681)\n* PPGID (in module os):                 Process Management. (line  948)\n* PPID (in module os):                  Process Management. (line  948)\n* PPIDFD (in module os):                Process Management. (line  948)\n* PWAIT (in module os):                 Process Management. (line  671)\n* packarray() (xdrlib.Packer method):   Packer Objects.     (line   86)\n* packbytes() (xdrlib.Packer method):   Packer Objects.     (line   54)\n* packdouble() (xdrlib.Packer method):  Packer Objects.     (line   26)\n* packfarray() (xdrlib.Packer method):  Packer Objects.     (line   78)\n* packfloat() (xdrlib.Packer method):   Packer Objects.     (line   22)\n* packfopaque() (xdrlib.Packer method): Packer Objects.     (line   38)\n* packfstring() (xdrlib.Packer method): Packer Objects.     (line   32)\n* packinto() (in module struct):        Functions and Exceptions.\n(line   19)\n* packinto() (struct.Struct method):    Classes<3>.         (line   29)\n* packlist() (xdrlib.Packer method):    Packer Objects.     (line   61)\n* packopaque() (xdrlib.Packer method):  Packer Objects.     (line   49)\n* packstring() (xdrlib.Packer method):  Packer Objects.     (line   43)\n* pack() (in module struct):             Functions and Exceptions.\n(line   13)\n* pack() (mailbox.MH method):            MH objects.         (line   64)\n* pack() (struct.Struct method):         Classes<3>.         (line   24)\n* package:                               Packages<2>.        (line    6)\n* package <1>:                           site -- Site-specific configuration hook.\n(line   64)\n* package <2>:                           Glossary.           (line 1002)\n* Package (in module importlib.resources): Deprecated functions.\n(line   11)\n* package variable; all:             Importing Modules<2>.\n(line    9)\n* package; namespace:                    Namespace packages. (line    6)\n* package; portion:                      Namespace packages. (line    6)\n* package; regular:                      Regular packages.   (line    6)\n* packed (ipaddress.IPv4Address attribute): Address objects. (line   71)\n* packed (ipaddress.IPv6Address attribute): Address objects. (line  249)\n* Packer (class in xdrlib):              xdrlib -- Encode and decode XDR data.\n(line   21)\n* packing (widgets):                     The Packer.         (line    6)\n* packing; binary; data:                 struct -- Interpret bytes as packed binary data.\n(line    8)\n* PAGER:                                 pydoc -- Documentation generator and online help system.\n(line   46)\n* paircontent() (in module curses):     Functions<6>.       (line  380)\n* pairnumber() (in module curses):      Functions<6>.       (line  386)\n* pairwise() (in module itertools):      Itertool Functions. (line  428)\n* PanedWindow (class in tkinter.tix):    Manager Widgets.    (line    6)\n* parameter:                             Glossary.           (line 1011)\n* Parameter (class in inspect):          Introspecting callables with the Signature object.\n(line  174)\n* parameter; call semantics:             Calls.              (line   25)\n* parameter; difference from argument:   How can I pass optional or keyword parameters from one function to another?.\n(line   16)\n* parameter; function definition:        Class Patterns.     (line  140)\n* ParameterizedMIMEHeader (class in email.headerregistry): email headerregistry Custom Header Objects.\n(line  255)\n* parameters (inspect.Signature attribute): Introspecting callables with the Signature object.\n(line  104)\n* params (email.headerregistry.ParameterizedMIMEHeader attribute): email headerregistry Custom Header Objects.\n(line  263)\n* ParamSpec (class in ast):              Type parameters.    (line   33)\n* ParamSpec (class in typing):           Building generic types and type aliases.\n(line  312)\n* ParamSpecArgs (in module typing):      Building generic types and type aliases.\n(line  413)\n* ParamSpecKwargs (in module typing):    Building generic types and type aliases.\n(line  415)\n* paramstyle (in module sqlite3):        Module constants.   (line   65)\n* pardir (in module os):                 Miscellaneous System Information.\n(line   90)\n* paren (2to3 fixer):                    Fixers.             (line  252)\n* parent (importlib.machinery.ModuleSpec attribute): importlib machinery - Importers and path hooks.\n(line  430)\n* parent (logging.Logger attribute):     Logger Objects.     (line   41)\n* parent (pathlib.PurePath attribute):   Methods and properties.\n(line   87)\n* parent (pyclbr.Class attribute):       Class Objects<2>.   (line   28)\n* parent (pyclbr.Function attribute):    Function Objects.   (line   27)\n* parent (urllib.request.BaseHandler attribute): BaseHandler Objects.\n(line   25)\n* parentprocess() (in module multiprocessing): Miscellaneous<3>.\n(line   36)\n* parent() (tkinter.ttk.Treeview method): ttk Treeview.      (line  227)\n* parenthesized form:                    Parenthesized forms.\n(line    6)\n* parentNode (xml.dom.Node attribute):   Node Objects.       (line   17)\n* parents (collections.ChainMap attribute): ChainMap objects.\n(line   62)\n* parents (pathlib.PurePath attribute):  Methods and properties.\n(line   71)\n* paretovariate() (in module random):    Real-valued distributions.\n(line  101)\n* parseandbind() (in module readline): Init file.          (line    8)\n* parseargs() (argparse.ArgumentParser method): The parseargs method.\n(line    6)\n* parseargs() (optparse.OptionParser method): Parsing arguments<2>.\n(line    9)\n* PARSECOLNAMES (in module sqlite3):    Module constants.   (line   13)\n* parseconfigh() (in module sysconfig): Other functions<3>.\n(line   57)\n* PARSEDECLTYPES (in module sqlite3):   Module constants.   (line   26)\n* parseheader() (in module cgi):        Functions<14>.      (line   53)\n* parseheaders() (in module http.client): http client -- HTTP protocol client.\n(line  111)\n* parseintermixedargs() (argparse.ArgumentParser method): Intermixed parsing.\n(line    6)\n* parseknownargs() (argparse.ArgumentParser method): Partial parsing.\n(line    6)\n* parseknownintermixedargs() (argparse.ArgumentParser method): Intermixed parsing.\n(line    9)\n* parsemultipart() (in module cgi):     Functions<14>.      (line   24)\n* parseqs() (in module urllib.parse):   URL Parsing.        (line  152)\n* parseqsl() (in module urllib.parse):  URL Parsing.        (line  198)\n* parse() (doctest.DocTestParser method): DocTestParser objects.\n(line   29)\n* parse() (email.parser.BytesParser method): Parser API.     (line   35)\n* parse() (email.parser.Parser method):  Parser API.         (line   87)\n* parse() (in module ast):               ast Helpers.        (line    9)\n* parse() (in module cgi):               Functions<14>.      (line    9)\n* parse() (in module xml.dom.minidom):   xml dom minidom -- Minimal DOM implementation.\n(line   37)\n* parse() (in module xml.dom.pulldom):   xml dom pulldom -- Support for building partial DOM trees.\n(line   86)\n* parse() (in module xml.etree.ElementTree): Functions<9>.   (line  174)\n* parse() (in module xml.sax):           xml sax -- Support for SAX2 parsers.\n(line   39)\n* parse() (string.Formatter method):     Custom String Formatting.\n(line   40)\n* parse() (urllib.robotparser.RobotFileParser method): urllib robotparser -- Parser for robots txt.\n(line   29)\n* parse() (xml.etree.ElementTree.ElementTree method): ElementTree Objects.\n(line   54)\n* Parse() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line    8)\n* parse() (xml.sax.xmlreader.XMLReader method): XMLReader Objects.\n(line    8)\n* parseaddr() (in module email.utils):   email utils Miscellaneous utilities.\n(line   57)\n* parsebytes() (email.parser.BytesParser method): Parser API.\n(line   55)\n* parsedatetodatetime() (in module email.utils): email utils Miscellaneous utilities.\n(line  130)\n* parsedatetz() (in module email.utils): email utils Miscellaneous utilities.\n(line  119)\n* parsedate() (in module email.utils):   email utils Miscellaneous utilities.\n(line  107)\n* ParseError (class in xml.etree.ElementTree): Exceptions<17>.\n(line    6)\n* ParseFile() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line   16)\n* ParseFlags() (in module imaplib):      imaplib -- IMAP4 protocol client.\n(line  124)\n* parser:                                Lexical analysis.   (line    6)\n* Parser (class in email.parser):        Parser API.         (line   76)\n* ParserCreate() (in module xml.parsers.expat): xml parsers expat -- Fast XML parsing using Expat.\n(line   46)\n* ParseResult (class in urllib.parse):   Structured Parse Results.\n(line   48)\n* ParseResultBytes (class in urllib.parse): Structured Parse Results.\n(line   73)\n* parsestr() (email.parser.Parser method): Parser API.       (line   97)\n* parseString() (in module xml.dom.minidom): xml dom minidom -- Minimal DOM implementation.\n(line   50)\n* parseString() (in module xml.dom.pulldom): xml dom pulldom -- Support for building partial DOM trees.\n(line   99)\n* parseString() (in module xml.sax):     xml sax -- Support for SAX2 parsers.\n(line   50)\n* ParsingError:                          Exceptions<7>.      (line   65)\n* partial (asyncio.IncompleteReadError attribute): Exceptions<11>.\n(line   56)\n* partial() (imaplib.IMAP4 method):      IMAP4 Objects.      (line  188)\n* partial() (in module functools):       functools -- Higher-order functions and operations on callable objects.\n(line  320)\n* partialmethod (class in functools):    functools -- Higher-order functions and operations on callable objects.\n(line  351)\n* parties (asyncio.Barrier attribute):   Barrier.            (line   94)\n* parties (threading.Barrier attribute): Barrier Objects.    (line   93)\n* partition() (bytearray method):        Bytes and Bytearray Operations.\n(line  187)\n* partition() (bytes method):            Bytes and Bytearray Operations.\n(line  187)\n* partition() (str method):              String Methods<2>.  (line  363)\n* parts (pathlib.PurePath attribute):    Accessing individual parts.\n(line    9)\n* Pass (class in ast):                   Statements.         (line  159)\n* pass() (poplib.POP3 method):          POP3 Objects.       (line   36)\n* Paste:                                 Help menu Shell and Editor.\n(line   30)\n* patch.dict() (in module unittest.mock): patch dict.        (line    6)\n* patch.multiple() (in module unittest.mock): patch multiple.\n(line    6)\n* patch.object() (in module unittest.mock): patch object.    (line    6)\n* patch.stopall() (in module unittest.mock): patch methods start and stop.\n(line   70)\n* patch() (in module test.support):      test support -- Utilities for the Python test suite.\n(line  646)\n* patch() (in module unittest.mock):     patch.              (line    9)\n* PATH:                                  Changes in the Python API<4>.\n(line  144)\n* PATH <1>:                              Changes in 'python' Command Behavior<2>.\n(line    6)\n* PATH <2>:                              Changes in 'python' Command Behavior<2>.\n(line   11)\n* PATH <3>:                              Changes in 'python' Command Behavior<2>.\n(line   12)\n* PATH <4>:                              Windows<16>.        (line   56)\n* PATH <5>:                              Windows<20>.        (line   14)\n* PATH <6>:                              Security<29>.       (line   16)\n* PATH <7>:                              Security<29>.       (line   20)\n* PATH <8>:                              The Module Search Path.\n(line   17)\n* PATH <9>:                              Executable Python Scripts.\n(line   11)\n* PATH <10>:                             Environment variables.\n(line   27)\n* PATH <11>:                             Miscellaneous.      (line   16)\n* PATH <12>:                             Installation steps. (line   34)\n* PATH <13>:                             Installation steps. (line   58)\n* PATH <14>:                             Installing Without UI.\n(line   77)\n* PATH <15>:                             Installing Without UI.\n(line   81)\n* PATH <16>:                             Excursus Setting environment variables.\n(line   23)\n* PATH <17>:                             Excursus Setting environment variables.\n(line   35)\n* PATH <18>:                             Finding the Python executable.\n(line   14)\n* PATH <19>:                             Finding the Python executable.\n(line   21)\n* PATH <20>:                             Finding the Python executable.\n(line   22)\n* PATH <21>:                             Python Launcher for Windows.\n(line   13)\n* PATH <22>:                             From the command-line.\n(line    9)\n* PATH <23>:                             Shebang Lines.      (line   53)\n* PATH <24>:                             Shebang Lines.      (line   55)\n* PATH <25>:                             Shebang Lines.      (line   60)\n* PATH <26>:                             Process Management. (line   45)\n* PATH <27>:                             Process Management. (line   86)\n* PATH <28>:                             Process Management. (line   89)\n* PATH <29>:                             Process Management. (line   92)\n* PATH <30>:                             Process Management. (line  532)\n* PATH <31>:                             Process Management. (line  619)\n* PATH <32>:                             Process Management. (line  623)\n* PATH <33>:                             Process Management. (line  625)\n* PATH <34>:                             Miscellaneous System Information.\n(line  121)\n* PATH <35>:                             Popen Constructor.  (line   34)\n* PATH <36>:                             webbrowser -- Convenient web-browser controller.\n(line  212)\n* PATH <37>:                             How venvs work.     (line   16)\n* PATH <38>:                             How venvs work.     (line   61)\n* PATH <39>:                             How venvs work.     (line   66)\n* PATH <40>:                             site -- Site-specific configuration hook.\n(line   59)\n* PATH <41>:                             Installing your CGI script on a Unix system.\n(line   29)\n* PATH <42>:                             Common problems and solutions.\n(line   23)\n* PATH <43>:                             Embedding Python<2>.\n(line   31)\n* PATH <44>:                             Embedding Python<2>.\n(line   37)\n* PATH <45>:                             How do I make a Python script executable on Unix?.\n(line   24)\n* PATH <46>:                             How do I make a Python script executable on Unix?.\n(line   28)\n* Path (class in pathlib):               Concrete paths.     (line   11)\n* Path (class in zipfile):               Path Objects.       (line    6)\n* path (http.cookiejar.Cookie attribute): Cookie Objects<2>. (line   45)\n* path (http.cookies.Morsel attribute):  Morsel Objects.     (line   13)\n* path (http.server.BaseHTTPRequestHandler attribute): http server -- HTTP servers.\n(line   98)\n* path (ImportError attribute):          Concrete exceptions.\n(line   58)\n* path (importlib.abc.FileLoader attribute): importlib abc - Abstract base classes related to import.\n(line  337)\n* path (importlib.machinery.ExtensionFileLoader attribute): importlib machinery - Importers and path hooks.\n(line  310)\n* path (importlib.machinery.FileFinder attribute): importlib machinery - Importers and path hooks.\n(line  179)\n* path (importlib.machinery.SourceFileLoader attribute): importlib machinery - Importers and path hooks.\n(line  216)\n* path (importlib.machinery.SourcelessFileLoader attribute): importlib machinery - Importers and path hooks.\n(line  260)\n* path (in module sys):                  sys -- System-specific parameters and functions.\n(line 1260)\n* path (in module sys) <1>:              Embedding Python<2>.\n(line   12)\n* path (in module sys) <2>:              Initializing and finalizing the interpreter.\n(line    7)\n* path (in module sys) <3>:              Process-wide parameters.\n(line  158)\n* path (in module sys) <4>:              Process-wide parameters.\n(line  178)\n* path (os.DirEntry attribute):          Files and Directories.\n(line  935)\n* path based finder:                     The Path Based Finder.\n(line    6)\n* path based finder <1>:                 Glossary.           (line 1083)\n* Path browser:                          File menu Shell and Editor.\n(line   22)\n* path entry:                            Glossary.           (line 1063)\n* path entry finder:                     Glossary.           (line 1068)\n* path entry hook:                       Glossary.           (line 1077)\n* path hooks:                            Import hooks.       (line    6)\n* pathhook() (importlib.machinery.FileFinder class method): importlib machinery - Importers and path hooks.\n(line  194)\n* pathhooks (in module sys):            sys -- System-specific parameters and functions.\n(line 1293)\n* pathimportercache (in module sys):   sys -- System-specific parameters and functions.\n(line 1302)\n* pathmtime() (importlib.abc.SourceLoader method): importlib abc - Abstract base classes related to import.\n(line  403)\n* pathreturnok() (http.cookiejar.CookiePolicy method): CookiePolicy Objects.\n(line   56)\n* pathstats() (importlib.abc.SourceLoader method): importlib abc - Abstract base classes related to import.\n(line  381)\n* pathstats() (importlib.machinery.SourceFileLoader method): importlib machinery - Importers and path hooks.\n(line  225)\n* path-like object:                      Glossary.           (line 1088)\n* path; configuration; file:             site -- Site-specific configuration hook.\n(line   64)\n* path; operations:                      pathlib -- Object-oriented filesystem paths.\n(line   10)\n* path; operations <1>:                  os path -- Common pathname manipulations.\n(line    9)\n* Path.stem (in module zipfile):         Path Objects.       (line   66)\n* Path.suffix (in module zipfile):       Path Objects.       (line   60)\n* Path.suffixes (in module zipfile):     Path Objects.       (line   72)\n* path() (in module importlib.resources): Deprecated functions.\n(line  102)\n* pathconfnames (in module os):         Files and Directories.\n(line  646)\n* pathconf() (in module os):             Files and Directories.\n(line  622)\n* PathEntryFinder (class in importlib.abc): importlib abc - Abstract base classes related to import.\n(line   59)\n* PATHEXT:                               Other Improvements<2>.\n(line   30)\n* PATHEXT <1>:                           Library<33>.        (line  138)\n* PATHEXT <2>:                           Installing Without UI.\n(line   77)\n* PATHEXT <3>:                           Installing Without UI.\n(line   81)\n* PathFinder (class in importlib.machinery): importlib machinery - Importers and path hooks.\n(line  107)\n* PathLike (class in os):                Process Parameters. (line  120)\n* pathname2url() (in module urllib.request): urllib request -- Extensible library for opening URLs.\n(line  157)\n* pathsep (in module os):                Miscellaneous System Information.\n(line  118)\n* Pattern (class in re):                 Regular Expression Objects.\n(line    6)\n* Pattern (class in typing):             Aliases to other concrete types.\n(line   10)\n* pattern (re.error attribute):          Exceptions<3>.      (line   19)\n* pattern (re.Pattern attribute):        Regular Expression Objects.\n(line  124)\n* pattern matching:                      The match statement.\n(line    6)\n* pausereading() (asyncio.ReadTransport method): Read-only Transports.\n(line   12)\n* pausewriting() (asyncio.BaseProtocol method): Base Protocol.\n(line   40)\n* pause() (in module signal):            Module contents<2>. (line  312)\n* PAXFORMAT (in module tarfile):        tarfile -- Read and write tar archive files.\n(line  335)\n* paxheaders (tarfile.TarFile attribute): TarFile Objects.  (line  316)\n* paxheaders (tarfile.TarInfo attribute): TarInfo Objects.  (line  161)\n* pbkdf2hmac() (in module hashlib):     Key derivation.     (line   11)\n* pd() (in module turtle):               Drawing state.      (line    6)\n* Pdb (class in pdb):                    pdb -- The Python Debugger.\n(line   17)\n* Pdb (class in pdb) <1>:                pdb -- The Python Debugger.\n(line  176)\n* pdf() (statistics.NormalDist method):  NormalDist objects. (line   68)\n* peek() (bz2.BZ2File method):           De compression of files.\n(line   73)\n* peek() (gzip.GzipFile method):         gzip -- Support for gzip files.\n(line  127)\n* peek() (io.BufferedReader method):     Buffered Streams.   (line   75)\n* peek() (lzma.LZMAFile method):         Reading and writing compressed files.\n(line   86)\n* peek() (weakref.finalize method):      weakref -- Weak references.\n(line  307)\n* PEMcerttoDERcert() (in module ssl): Certificate handling.\n(line   57)\n* pen() (in module turtle):              Drawing state.      (line   33)\n* pencolor() (in module turtle):         Color control.      (line    6)\n* pending (ssl.MemoryBIO attribute):     Memory BIO Support<2>.\n(line  135)\n* pending() (ssl.SSLSocket method):      SSL Sockets.        (line  319)\n* PendingDeprecationWarning:             Warnings.           (line   28)\n* pendown() (in module turtle):          Drawing state.      (line    6)\n* pensize() (in module turtle):          Drawing state.      (line   18)\n* penup() (in module turtle):            Drawing state.      (line   12)\n* PEP:                                   Glossary.           (line 1100)\n* PERCENT (in module token):             token -- Constants used with Python parse trees.\n(line  122)\n* PERCENTEQUAL (in module token):        token -- Constants used with Python parse trees.\n(line  186)\n* perfcounterns() (in module time):    Functions<5>.       (line  216)\n* perfcounter() (in module time):       Functions<5>.       (line  199)\n* Performance:                           timeit -- Measure execution time of small code snippets.\n(line    8)\n* perm() (in module math):               Number-theoretic and representation functions.\n(line  215)\n* PermissionError:                       OS exceptions.      (line   97)\n* permutations() (in module itertools):  Itertool Functions. (line  449)\n* Persist() (msilib.SummaryInformation method): Summary Information Objects.\n(line   29)\n* persistence:                           pickle -- Python object serialization.\n(line    8)\n* persistentid (pickle protocol):       Persistence of External Objects.\n(line    6)\n* persistentid() (pickle.Pickler method): Module Interface. (line  160)\n* persistentload (pickle protocol):     Persistence of External Objects.\n(line    6)\n* persistentload() (pickle.Unpickler method): Module Interface.\n(line  275)\n* persistent; objects:                   pickle -- Python object serialization.\n(line    8)\n* PFCAN (in module socket):             Constants<8>.       (line  121)\n* PFDIVERT (in module socket):          Constants<8>.       (line  194)\n* PFPACKET (in module socket):          Constants<8>.       (line  204)\n* PFRDS (in module socket):             Constants<8>.       (line  226)\n* pformat() (in module pprint):          Functions<4>.       (line   46)\n* pformat() (pprint.PrettyPrinter method): PrettyPrinter Objects.\n(line   83)\n* pgettext() (gettext.GNUTranslations method): The GNUTranslations class.\n(line   68)\n* pgettext() (gettext.NullTranslations method): The NullTranslations class.\n(line   47)\n* pgettext() (in module gettext):        GNU gettext API.    (line   63)\n* PGO (in module test.support):          test support -- Utilities for the Python test suite.\n(line  107)\n* phase() (in module cmath):             Conversions to and from polar coordinates.\n(line   22)\n* Philbrick, Geoff:                      Keyword Parameters for Extension Functions.\n(line   25)\n* physical line:                         Logical lines.      (line    6)\n* physical line <1>:                     Explicit line joining.\n(line    6)\n* physical line <2>:                     String and Bytes literals.\n(line   75)\n* pi (in module cmath):                  Constants<3>.       (line    6)\n* pi (in module math):                   Constants<2>.       (line    6)\n* pi() (xml.etree.ElementTree.TreeBuilder method): TreeBuilder Objects.\n(line   56)\n* pickle() (in module copyreg):          copyreg -- Register pickle support functions.\n(line   23)\n* PickleBuffer (class in pickle):        Module Interface.   (line  302)\n* PickleError:                           Module Interface.   (line   95)\n* Pickler (class in pickle):             Module Interface.   (line  121)\n* pickletools command line option; -a:   Command line options<3>.\n(line    6)\n* pickletools command line option; -annotate: Command line options<3>.\n(line    6)\n* pickletools command line option; -indentlevel: Command line options<3>.\n(line   14)\n* pickletools command line option; -l:   Command line options<3>.\n(line   14)\n* pickletools command line option; -m:   Command line options<3>.\n(line   18)\n* pickletools command line option; -memo: Command line options<3>.\n(line   18)\n* pickletools command line option; -o:   Command line options<3>.\n(line   10)\n* pickletools command line option; -output: Command line options<3>.\n(line   10)\n* pickletools command line option; -p:   Command line options<3>.\n(line   23)\n* pickletools command line option; -preamble: Command line options<3>.\n(line   23)\n* pickling; objects:                     pickle -- Python object serialization.\n(line    8)\n* PicklingError:                         Module Interface.   (line  100)\n* pid (asyncio.subprocess.Process attribute): Interacting with Subprocesses.\n(line  138)\n* pid (multiprocessing.Process attribute): Process and exceptions.\n(line  121)\n* pid (subprocess.Popen attribute):      Popen Objects.      (line  142)\n* PIDFDNONBLOCK (in module os):         Process Management. (line  377)\n* pidfdopen() (in module os):           Process Management. (line  365)\n* pidfdsendsignal() (in module signal): Module contents<2>.\n(line  330)\n* PidfdChildWatcher (class in asyncio):  Process Watchers.   (line  156)\n* PIPUSER:                              Windows<37>.        (line  102)\n* PIPE (in module subprocess):           Using the subprocess Module.\n(line  149)\n* PIPEBUF (in module select):           select -- Waiting for I/O completion.\n(line  163)\n* pipeconnectionlost() (asyncio.SubprocessProtocol method): Subprocess Protocols.\n(line   19)\n* pipedatareceived() (asyncio.SubprocessProtocol method): Subprocess Protocols.\n(line   10)\n* PIPEMAXSIZE (in module test.support): test support -- Utilities for the Python test suite.\n(line  111)\n* Pipe() (in module multiprocessing):    Pipes and Queues.   (line   74)\n* pipe() (in module os):                 File Descriptor Operations.\n(line  478)\n* pipe2() (in module os):                File Descriptor Operations.\n(line  489)\n* placeholder (textwrap.TextWrapper attribute): textwrap -- Text wrapping and filling.\n(line  276)\n* platform (in module sys):              sys -- System-specific parameters and functions.\n(line 1312)\n* platform (in module sys) <1>:          Process-wide parameters.\n(line  226)\n* platform() (in module platform):       Cross Platform.     (line   45)\n* platlibdir (in module sys):            sys -- System-specific parameters and functions.\n(line 1380)\n* PlaySound() (in module winsound):      winsound -- Sound-playing interface for Windows.\n(line   20)\n* plist; file:                           plistlib -- Generate and parse Apple plist files.\n(line    8)\n* plock() (in module os):                Process Management. (line  389)\n* plus:                                  Unary arithmetic and bitwise operations.\n(line   14)\n* PLUS (in module token):                token -- Constants used with Python parse trees.\n(line   82)\n* plus() (decimal.Context method):       Context objects.    (line  431)\n* PLUSEQUAL (in module token):           token -- Constants used with Python parse trees.\n(line  170)\n* pm() (in module pdb):                  pdb -- The Python Debugger.\n(line  166)\n* POINTER() (in module ctypes):          Utility functions.  (line  149)\n* pointer() (in module ctypes):          Utility functions.  (line  155)\n* polar() (in module cmath):             Conversions to and from polar coordinates.\n(line   40)\n* Policy (class in email.policy):        email policy Policy Objects.\n(line  129)\n* poll() (in module select):             select -- Waiting for I/O completion.\n(line   90)\n* poll() (multiprocessing.connection.Connection method): Connection Objects.\n(line   42)\n* poll() (select.devpoll method):        /dev/poll Polling Objects.\n(line   65)\n* poll() (select.epoll method):          Edge and Level Trigger Polling epoll Objects.\n(line   96)\n* poll() (select.poll method):           Polling Objects.    (line   77)\n* poll() (subprocess.Popen method):      Popen Objects.      (line    8)\n* PollSelector (class in selectors):     Classes<4>.         (line  171)\n* Pool (class in multiprocessing.pool):  Process Pools.      (line    9)\n* popall() (contextlib.ExitStack method): Utilities.        (line  594)\n* POPBLOCK (opcode):                    Python Bytecode Instructions.\n(line 1288)\n* POPEXCEPT (opcode):                   Python Bytecode Instructions.\n(line  378)\n* POPJUMPIFFALSE (opcode):            Python Bytecode Instructions.\n(line  786)\n* POPJUMPIFNONE (opcode):             Python Bytecode Instructions.\n(line  810)\n* POPJUMPIFNOTNONE (opcode):         Python Bytecode Instructions.\n(line  798)\n* POPJUMPIFTRUE (opcode):             Python Bytecode Instructions.\n(line  774)\n* popsource() (shlex.shlex method):     shlex Objects.      (line   63)\n* POPTOP (opcode):                      Python Bytecode Instructions.\n(line   87)\n* pop() (array.array method):            array -- Efficient arrays of numeric values.\n(line  207)\n* pop() (collections.deque method):      deque objects.      (line   87)\n* pop() (dict method):                   Mapping Types -- dict.\n(line  171)\n* pop() (frozenset method):              Set Types -- set frozenset.\n(line  208)\n* pop() (mailbox.Mailbox method):        Mailbox objects.    (line  216)\n* pop() (sequence method):               Mutable Sequence Types.\n(line   16)\n* POP3 (class in poplib):                poplib -- POP3 protocol client.\n(line   35)\n* POP3SSL (class in poplib):            poplib -- POP3 protocol client.\n(line   55)\n* POP3; protocol:                        poplib -- POP3 protocol client.\n(line    8)\n* Popen (class in subprocess):           Popen Constructor.  (line   11)\n* popen() (in module os):                I/O objects also known as file objects.\n(line    6)\n* popen() (in module os) <1>:            Process Management. (line  396)\n* popen() (in module os) <2>:            select -- Waiting for I/O completion.\n(line  144)\n* popitem() (collections.OrderedDict method): OrderedDict objects.\n(line   67)\n* popitem() (dict method):               Mapping Types -- dict.\n(line  177)\n* popitem() (mailbox.Mailbox method):    Mailbox objects.    (line  225)\n* popleft() (collections.deque method):  deque objects.      (line   92)\n* PopupMenu (class in tkinter.tix):      Basic Widgets.      (line   53)\n* port (http.cookiejar.Cookie attribute): Cookie Objects<2>. (line   36)\n* portspecified (http.cookiejar.Cookie attribute): Cookie Objects<2>.\n(line   81)\n* portion:                               Glossary.           (line 1116)\n* pos (json.JSONDecodeError attribute):  Exceptions<15>.     (line   19)\n* pos (re.error attribute):              Exceptions<3>.      (line   23)\n* pos (re.Match attribute):              Match Objects.      (line  179)\n* pos() (in module operator):            operator -- Standard operators as functions.\n(line  142)\n* pos() (in module turtle):              Tell Turtle's state.\n(line    6)\n* position (xml.etree.ElementTree.ParseError attribute): Exceptions<17>.\n(line   20)\n* position() (in module turtle):         Tell Turtle's state.\n(line    6)\n* positional argument:                   Glossary.           (line 1122)\n* Positions (class in dis):              Python Bytecode Instructions.\n(line   58)\n* positions (inspect.FrameInfo attribute): The interpreter stack.\n(line   42)\n* positions (inspect.Traceback attribute): The interpreter stack.\n(line   82)\n* Positions.coloffset (in module dis):  Python Bytecode Instructions.\n(line   67)\n* Positions.endcoloffset (in module dis): Python Bytecode Instructions.\n(line   69)\n* Positions.endlineno (in module dis):  Python Bytecode Instructions.\n(line   65)\n* Positions.lineno (in module dis):      Python Bytecode Instructions.\n(line   63)\n* POSIX Shared Memory:                   multiprocessing sharedmemory -- Shared memory for direct access across processes.\n(line   10)\n* POSIXFADVDONTNEED (in module os):    File Descriptor Operations.\n(line  523)\n* POSIXFADVNOREUSE (in module os):     File Descriptor Operations.\n(line  523)\n* POSIXFADVNORMAL (in module os):      File Descriptor Operations.\n(line  523)\n* POSIXFADVRANDOM (in module os):      File Descriptor Operations.\n(line  523)\n* POSIXFADVSEQUENTIAL (in module os):  File Descriptor Operations.\n(line  523)\n* POSIXFADVWILLNEED (in module os):    File Descriptor Operations.\n(line  523)\n* posixfadvise() (in module os):        File Descriptor Operations.\n(line  509)\n* posixfallocate() (in module os):      File Descriptor Operations.\n(line  500)\n* POSIXSPAWNCLOSE (in module os):      Process Management. (line  462)\n* POSIXSPAWNDUP2 (in module os):       Process Management. (line  468)\n* POSIXSPAWNOPEN (in module os):       Process Management. (line  456)\n* posixspawn() (in module os):          Process Management. (line  434)\n* posixspawnp() (in module os):         Process Management. (line  524)\n* POSIX; I/O control:                    termios -- POSIX style tty control.\n(line    6)\n* POSIXLYCORRECT:                       getopt -- C-style parser for command line options.\n(line   71)\n* PosixPath (class in pathlib):          Concrete paths.     (line   22)\n* posthandshakeauth (ssl.SSLContext attribute): SSL Contexts.\n(line  579)\n* postmortem() (in module pdb):         pdb -- The Python Debugger.\n(line  159)\n* postsetup() (venv.EnvBuilder method): API<2>.             (line  172)\n* post() (nntplib.NNTP method):          Methods<3>.         (line  278)\n* post() (ossaudiodev.ossaudiodevice method): Audio Device Objects.\n(line  179)\n* postcmd() (cmd.Cmd method):            Cmd Objects.        (line  104)\n* postloop() (cmd.Cmd method):           Cmd Objects.        (line  122)\n* Pow (class in ast):                    Expressions<2>.     (line   54)\n* pow() (in module math):                Power and logarithmic functions.\n(line   72)\n* pow() (in module operator):            operator -- Standard operators as functions.\n(line  147)\n* power; operation:                      The power operator. (line    6)\n* power() (decimal.Context method):      Context objects.    (line  437)\n* pp (pdb command):                      Debugger Commands.  (line  266)\n* pp() (in module pprint):               Functions<4>.       (line    6)\n* pprint() (in module pprint):           Functions<4>.       (line   27)\n* pprint() (pprint.PrettyPrinter method): PrettyPrinter Objects.\n(line   89)\n* prcal() (in module calendar):          calendar -- General calendar-related functions.\n(line  347)\n* pread() (in module os):                File Descriptor Operations.\n(line  537)\n* preadv() (in module os):               File Descriptor Operations.\n(line  550)\n* preamble (email.message.EmailMessage attribute): email message Representing an email message.\n(line  680)\n* preamble (email.message.Message attribute): email message Message Representing an email message using the compat32 API.\n(line  689)\n* precmd() (cmd.Cmd method):             Cmd Objects.        (line   94)\n* prefix (in module sys):                sys -- System-specific parameters and functions.\n(line 1405)\n* prefix (xml.dom.Attr attribute):       Attr Objects.       (line   18)\n* prefix (xml.dom.Node attribute):       Node Objects.       (line   69)\n* prefix (zipimport.zipimporter attribute): zipimporter Objects.\n(line  101)\n* PREFIXES (in module site):             Module contents<5>. (line    6)\n* prefixlen (ipaddress.IPv4Network attribute): Network objects.\n(line  132)\n* prefixlen (ipaddress.IPv6Network attribute): Network objects.\n(line  329)\n* preloop() (cmd.Cmd method):            Cmd Objects.        (line  116)\n* prepareclass() (in module types):     Dynamic Type Creation.\n(line   23)\n* prepareinputsource() (in module xml.sax.saxutils): xml sax saxutils -- SAX Utilities.\n(line   81)\n* prepare() (graphlib.TopologicalSorter method): graphlib -- Functionality to operate with graph-like structures.\n(line  100)\n* prepare() (logging.handlers.QueueHandler method): QueueHandler.\n(line   45)\n* prepare() (logging.handlers.QueueListener method): QueueListener.\n(line   58)\n* PrepareProtocol (class in sqlite3):    PrepareProtocol objects.\n(line    6)\n* prepend() (pipes.Template method):     Template Objects.   (line   37)\n* PrettyPrinter (class in pprint):       PrettyPrinter Objects.\n(line    8)\n* prev() (tkinter.ttk.Treeview method):  ttk Treeview.       (line  232)\n* previousSibling (xml.dom.Node attribute): Node Objects.    (line   32)\n* primary:                               Primaries.          (line    6)\n* print (2to3 fixer):                    Fixers.             (line  258)\n* printcallees() (pstats.Stats method): The Stats Class.    (line  217)\n* printcallers() (pstats.Stats method): The Stats Class.    (line  196)\n* printdirectory() (in module cgi):     Functions<14>.      (line   84)\n* printenvironusage() (in module cgi): Functions<14>.      (line   88)\n* printenviron() (in module cgi):       Functions<14>.      (line   76)\n* printexc() (in module traceback):     traceback -- Print or retrieve a stack traceback.\n(line   80)\n* printexc() (timeit.Timer method):     Python Interface.   (line  135)\n* printexception() (in module traceback): traceback -- Print or retrieve a stack traceback.\n(line   46)\n* printform() (in module cgi):          Functions<14>.      (line   80)\n* printhelp() (argparse.ArgumentParser method): Printing help.\n(line   16)\n* printlast() (in module traceback):    traceback -- Print or retrieve a stack traceback.\n(line   85)\n* printstack() (asyncio.Task method):   Task Object.        (line  143)\n* printstack() (in module traceback):   traceback -- Print or retrieve a stack traceback.\n(line   91)\n* printstats() (profile.Profile method): profile and cProfile Module Reference.\n(line   91)\n* printstats() (pstats.Stats method):   The Stats Class.    (line  164)\n* printtb() (in module traceback):      traceback -- Print or retrieve a stack traceback.\n(line   34)\n* printusage() (argparse.ArgumentParser method): Printing help.\n(line   10)\n* printusage() (optparse.OptionParser method): Other methods.\n(line   15)\n* printversion() (optparse.OptionParser method): Printing a version string.\n(line   26)\n* printwarning() (in module test.support): test support -- Utilities for the Python test suite.\n(line  411)\n* print() (built-in function); str() (object method): Basic customization.\n(line  128)\n* print() (traceback.TracebackException method): TracebackException Objects.\n(line  123)\n* printable (in module string):          String constants.   (line   41)\n* printdir() (zipfile.ZipFile method):   ZipFile Objects.    (line  228)\n* printf-style formatting:               printf-style String Formatting.\n(line    6)\n* printf-style formatting <1>:           printf-style Bytes Formatting.\n(line    6)\n* PRIODARWINBG (in module os):         Process Parameters. (line  303)\n* PRIODARWINNONUI (in module os):      Process Parameters. (line  303)\n* PRIODARWINPROCESS (in module os):    Process Parameters. (line  303)\n* PRIODARWINTHREAD (in module os):     Process Parameters. (line  303)\n* PRIOPGRP (in module os):              Process Parameters. (line  292)\n* PRIOPROCESS (in module os):           Process Parameters. (line  292)\n* PRIOUSER (in module os):              Process Parameters. (line  292)\n* PriorityQueue (class in asyncio):      Priority Queue.     (line    6)\n* PriorityQueue (class in queue):        queue -- A synchronized queue class.\n(line   50)\n* private; names:                        Identifiers Names.  (line   14)\n* prlimit() (in module resource):        Resource Limits.    (line   56)\n* prmonth() (calendar.TextCalendar method): calendar -- General calendar-related functions.\n(line  143)\n* prmonth() (in module calendar):        calendar -- General calendar-related functions.\n(line  338)\n* ProactorEventLoop (class in asyncio):  Event Loop Implementations.\n(line   32)\n* procedure; call:                       Expression statements.\n(line   17)\n* Process (class in multiprocessing):    Process and exceptions.\n(line    6)\n* processexited() (asyncio.SubprocessProtocol method): Subprocess Protocols.\n(line   26)\n* processrequest() (socketserver.BaseServer method): Server Objects<2>.\n(line  156)\n* processtimens() (in module time):    Functions<5>.       (line  236)\n* processtime() (in module time):       Functions<5>.       (line  223)\n* processtokens() (in module tabnanny): tabnanny -- Detection of ambiguous indentation.\n(line   42)\n* process; group:                        Process Parameters. (line  193)\n* process; group <1>:                    Process Parameters. (line  255)\n* process; id:                           Process Parameters. (line  261)\n* process; id of parent:                 Process Parameters. (line  268)\n* process; killing:                      Process Management. (line  327)\n* process; killing <1>:                  Process Management. (line  351)\n* process; scheduling priority:          Process Parameters. (line  279)\n* process; scheduling priority <1>:      Process Parameters. (line  467)\n* process; signalling:                   Process Management. (line  327)\n* process; signalling <1>:               Process Management. (line  351)\n* process() (logging.LoggerAdapter method): LoggerAdapter Objects.\n(line   16)\n* ProcessError:                          Process and exceptions.\n(line  228)\n* processes, light-weight:               thread -- Low-level threading API.\n(line    6)\n* ProcessingInstruction() (in module xml.etree.ElementTree): Functions<9>.\n(line  181)\n* processingInstruction() (xml.sax.handler.ContentHandler method): ContentHandler Objects.\n(line  164)\n* ProcessingInstructionHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line  274)\n* ProcessLookupError:                    OS exceptions.      (line  107)\n* processor time:                        Functions<5>.       (line  225)\n* processor time <1>:                    Functions<5>.       (line  549)\n* processor() (in module platform):      Cross Platform.     (line   66)\n* ProcessPoolExecutor (class in concurrent.futures): ProcessPoolExecutor.\n(line   21)\n* prod() (in module math):               Number-theoretic and representation functions.\n(line  232)\n* product() (in module itertools):       Itertool Functions. (line  509)\n* Profile (class in profile):            profile and cProfile Module Reference.\n(line   35)\n* profile function:                      threading -- Thread-based parallelism.\n(line  184)\n* profile function <1>:                  threading -- Thread-based parallelism.\n(line  202)\n* profile function <2>:                  sys -- System-specific parameters and functions.\n(line  898)\n* profile function <3>:                  sys -- System-specific parameters and functions.\n(line 1452)\n* PROFILETASK:                          Performance options.\n(line   12)\n* profiler:                              sys -- System-specific parameters and functions.\n(line  898)\n* profiler <1>:                          sys -- System-specific parameters and functions.\n(line 1452)\n* profiling, deterministic:              Introduction to the profilers.\n(line    6)\n* program:                               Complete Python programs.\n(line    6)\n* ProgrammingError:                      Exceptions<6>.      (line   78)\n* Progressbar (class in tkinter.ttk):    ttk Progressbar.    (line    6)\n* prompt (cmd.Cmd attribute):            Cmd Objects.        (line  131)\n* promptuserpasswd() (urllib.request.FancyURLopener method): Legacy interface.\n(line  184)\n* prompts, interpreter:                  sys -- System-specific parameters and functions.\n(line 1421)\n* propagate (logging.Logger attribute):  Logger Objects.     (line   49)\n* property (built-in class):             Built-in Functions. (line 1440)\n* property list:                         plistlib -- Generate and parse Apple plist files.\n(line    8)\n* propertydeclarationhandler (in module xml.sax.handler): xml sax handler -- Base classes for SAX handlers.\n(line  106)\n* propertydomnode (in module xml.sax.handler): xml sax handler -- Base classes for SAX handlers.\n(line  113)\n* propertylexicalhandler (in module xml.sax.handler): xml sax handler -- Base classes for SAX handlers.\n(line   99)\n* propertyxmlstring (in module xml.sax.handler): xml sax handler -- Base classes for SAX handlers.\n(line  120)\n* property() (in module enum):           Utilities and Decorators.\n(line   38)\n* PropertyMock (class in unittest.mock): The Mock Class.     (line  628)\n* protc() (ftplib.FTPTLS method):      FTPTLS objects.    (line  110)\n* protp() (ftplib.FTPTLS method):      FTPTLS objects.    (line  106)\n* proto (socket.socket attribute):       Socket Objects.     (line  626)\n* Protocol (class in asyncio):           Base Protocols.     (line   10)\n* Protocol (class in typing):            Other special directives.\n(line  115)\n* protocol (ssl.SSLContext attribute):   SSL Contexts.       (line  598)\n* PROTOCOLSSLv23 (in module ssl):       Constants<9>.       (line  161)\n* PROTOCOLSSLv3 (in module ssl):        Constants<9>.       (line  167)\n* PROTOCOLTLS (in module ssl):          Constants<9>.       (line  131)\n* PROTOCOLTLSCLIENT (in module ssl):   Constants<9>.       (line  144)\n* PROTOCOLTLSSERVER (in module ssl):   Constants<9>.       (line  153)\n* PROTOCOLTLSv1 (in module ssl):        Constants<9>.       (line  183)\n* PROTOCOLTLSv11 (in module ssl):      Constants<9>.       (line  190)\n* PROTOCOLTLSv12 (in module ssl):      Constants<9>.       (line  200)\n* protocolversion (http.server.BaseHTTPRequestHandler attribute): http server -- HTTP servers.\n(line  163)\n* PROTOCOLVERSION (imaplib.IMAP4 attribute): IMAP4 Objects. (line  392)\n* protocol; context management:          Context Manager Types.\n(line    6)\n* protocol; iterator:                    Iterator Types.     (line    6)\n* protocol; Telnet:                      telnetlib -- Telnet client.\n(line    8)\n* ProtocolError (class in xmlrpc.client): ProtocolError Objects.\n(line    6)\n* provisional API:                       Glossary.           (line 1126)\n* provisional package:                   Glossary.           (line 1146)\n* proxy() (in module weakref):           weakref -- Weak references.\n(line  136)\n* proxyauth() (imaplib.IMAP4 method):    IMAP4 Objects.      (line  193)\n* ProxyBasicAuthHandler (class in urllib.request): urllib request -- Extensible library for opening URLs.\n(line  374)\n* ProxyDigestAuthHandler (class in urllib.request): urllib request -- Extensible library for opening URLs.\n(line  406)\n* ProxyHandler (class in urllib.request): urllib request -- Extensible library for opening URLs.\n(line  300)\n* ProxyType (in module weakref):         weakref -- Weak references.\n(line  336)\n* ProxyTypes (in module weakref):        weakref -- Weak references.\n(line  344)\n* pryear() (calendar.TextCalendar method): calendar -- General calendar-related functions.\n(line  158)\n* ps1 (in module sys):                   sys -- System-specific parameters and functions.\n(line 1418)\n* ps2 (in module sys):                   sys -- System-specific parameters and functions.\n(line 1418)\n* pstdev() (in module statistics):       Function details.   (line  291)\n* pthreadgetcpuclockid() (in module time): Functions<5>.    (line   21)\n* pthreadkill() (in module signal):     Module contents<2>. (line  344)\n* pthreadsigmask() (in module signal):  Module contents<2>. (line  374)\n* pthreads:                              thread -- Low-level threading API.\n(line   16)\n* pthreads (sys.emscripteninfo attribute): sys -- System-specific parameters and functions.\n(line  348)\n* pu() (in module turtle):               Drawing state.      (line   12)\n* publicId (xml.dom.DocumentType attribute): DocumentType Objects.\n(line   17)\n* PullDom (class in xml.dom.pulldom):    xml dom pulldom -- Support for building partial DOM trees.\n(line   78)\n* punctuation (in module string):        String constants.   (line   36)\n* punctuationchars (shlex.shlex attribute): shlex Objects.  (line  183)\n* PurePath (class in pathlib):           Pure paths.         (line   10)\n* PurePosixPath (class in pathlib):      Pure paths.         (line   72)\n* PureWindowsPath (class in pathlib):    Pure paths.         (line   82)\n* purge() (in module re):                Functions<2>.       (line  255)\n* Purpose.CLIENTAUTH (in module ssl):   Constants<9>.       (line  533)\n* Purpose.SERVERAUTH (in module ssl):   Constants<9>.       (line  524)\n* pushasynccallback() (contextlib.AsyncExitStack method): Utilities.\n(line  645)\n* pushasyncexit() (contextlib.AsyncExitStack method): Utilities.\n(line  640)\n* PUSHEXCINFO (opcode):                Python Bytecode Instructions.\n(line  397)\n* PUSHNULL (opcode):                    Python Bytecode Instructions.\n(line  997)\n* pushsource() (shlex.shlex method):    shlex Objects.      (line   56)\n* pushtoken() (shlex.shlex method):     shlex Objects.      (line   16)\n* push() (code.InteractiveConsole method): Interactive Console Objects.\n(line   28)\n* push() (contextlib.ExitStack method):  Utilities.          (line  561)\n* pushbutton() (msilib.Dialog method):   GUI classes.        (line   66)\n* putnowait() (asyncio.Queue method):   Queue.              (line   66)\n* putnowait() (multiprocessing.Queue method): Pipes and Queues.\n(line  136)\n* putnowait() (queue.Queue method):     Queue Objects.      (line   40)\n* putnowait() (queue.SimpleQueue method): SimpleQueue Objects.\n(line   35)\n* put() (asyncio.Queue method):          Queue.              (line   61)\n* put() (multiprocessing.Queue method):  Pipes and Queues.   (line  120)\n* put() (multiprocessing.SimpleQueue method): Pipes and Queues.\n(line  227)\n* put() (queue.Queue method):            Queue Objects.      (line   29)\n* put() (queue.SimpleQueue method):      SimpleQueue Objects.\n(line   20)\n* putch() (in module msvcrt):            Console I/O.        (line   35)\n* putenv() (in module os):               Process Parameters. (line  352)\n* putheader() (http.client.HTTPConnection method): HTTPConnection Objects.\n(line  177)\n* putp() (in module curses):             Functions<6>.       (line  392)\n* putrequest() (http.client.HTTPConnection method): HTTPConnection Objects.\n(line  166)\n* putwch() (in module msvcrt):           Console I/O.        (line   39)\n* putwin() (curses.window method):       Window Objects.     (line  456)\n* pvariance() (in module statistics):    Function details.   (line  300)\n* pwd() (ftplib.FTP method):             FTP objects.        (line  344)\n* pwrite() (in module os):               File Descriptor Operations.\n(line  609)\n* pwritev() (in module os):              File Descriptor Operations.\n(line  620)\n* PyABS (C macro):                      Useful macros.      (line   34)\n* PyAddPendingCall (C function):        Asynchronous Notifications.\n(line   10)\n* PyALWAYSINLINE (C macro):            Useful macros.      (line   40)\n* PyAtExit (C function):                Process Control.    (line   32)\n* PyAUDITREAD (C macro):               Member flags.       (line   12)\n* PyAuditHookFunction (C type):         System Functions.   (line  188)\n* PyBEGINALLOWTHREADS (C macro):      Releasing the GIL from extension code.\n(line   21)\n* PyBEGINALLOWTHREADS (C macro) <1>:  High-level API.     (line  163)\n* PyBLOCKTHREADS (C macro):            High-level API.     (line  177)\n* Pybuffer (C type):                    Buffer structure.   (line   25)\n* Pybuffer.buf (C member):              Buffer structure.   (line   27)\n* Pybuffer.format (C member):           Buffer structure.   (line   89)\n* Pybuffer.internal (C member):         Buffer structure.   (line  152)\n* Pybuffer.itemsize (C member):         Buffer structure.   (line   69)\n* Pybuffer.len (C member):              Buffer structure.   (line   52)\n* Pybuffer.ndim (C member):             Buffer structure.   (line   98)\n* Pybuffer.obj (C member):              Buffer structure.   (line   39)\n* Pybuffer.readonly (C member):         Buffer structure.   (line   64)\n* Pybuffer.shape (C member):            Buffer structure.   (line  107)\n* Pybuffer.strides (C member):          Buffer structure.   (line  120)\n* Pybuffer.suboffsets (C member):       Buffer structure.   (line  133)\n* PyBuildValue (C function):            Building values.    (line    6)\n* PyBytesMain (C function):             The Very High Level Layer.\n(line   41)\n* PyBytesWarningFlag (C var):           Global configuration variables.\n(line   15)\n* PyCHARMASK (C macro):                 Useful macros.      (line   65)\n* PyCLEAR (C function):                 Reference Counting. (line  136)\n* PyCompileString (C function):         The Very High Level Layer.\n(line  244)\n* PyCompileString (C function) <1>:     The Very High Level Layer.\n(line  335)\n* PyCompileString (C function) <2>:     The Very High Level Layer.\n(line  340)\n* PyCompileString (C function) <3>:     The Very High Level Layer.\n(line  347)\n* PyCompileStringExFlags (C function):  The Very High Level Layer.\n(line  278)\n* PyCompileStringFlags (C function):    The Very High Level Layer.\n(line  251)\n* PyCompileStringObject (C function):   The Very High Level Layer.\n(line  257)\n* Pycomplex (C type):                   Complex Numbers as C Structures.\n(line   10)\n* PyDEBUG (C macro):                    Debugging Builds.   (line   17)\n* PyDEBUG (in module test.support):     test support -- Utilities for the Python test suite.\n(line  116)\n* PyDebugFlag (C var):                  Global configuration variables.\n(line   29)\n* PyDecodeLocale (C function):          Operating System Utilities.\n(line  115)\n* PyDECREF (C function):                Reference Counts<2>.\n(line   18)\n* PyDECREF (C function) <1>:            Reference Counting. (line   98)\n* PyDecRef (C function):                Reference Counting. (line  159)\n* PyDEPRECATED (C macro):               Useful macros.      (line   70)\n* PyDontWriteBytecodeFlag (C var):      Global configuration variables.\n(line   43)\n* PyEllipsis (C var):                   Ellipsis Object.    (line    6)\n* PyEncodeLocale (C function):          Operating System Utilities.\n(line  168)\n* PyENDALLOWTHREADS (C macro):        Releasing the GIL from extension code.\n(line   21)\n* PyENDALLOWTHREADS (C macro) <1>:    High-level API.     (line  170)\n* PyEndInterpreter (C function):        Sub-interpreter support.\n(line  202)\n* PyEnterRecursiveCall (C function):    Recursion Control.  (line   13)\n* PyEQ (C macro):                       PyTypeObject Slots. (line  989)\n* Pyevalinput (C var):                 The Very High Level Layer.\n(line  333)\n* PyExit (C function):                  Process Control.    (line   22)\n* PyExitStatusException (C function):   PyStatus.           (line   65)\n* PyFalse (C var):                      Boolean Objects.    (line   21)\n* PyFatalError (C function):            Process Control.    (line    6)\n* PyFatalError():                       Process-wide parameters.\n(line  271)\n* PyFdIsInteractive (C function):       Operating System Utilities.\n(line   18)\n* Pyfileinput (C var):                 The Very High Level Layer.\n(line  338)\n* PyFinalize (C function):              Initializing and finalizing the interpreter.\n(line   84)\n* PyFinalizeEx (C function):            Process Control.    (line   23)\n* PyFinalizeEx (C function) <1>:        Process Control.    (line   33)\n* PyFinalizeEx (C function) <2>:        Initializing and finalizing the interpreter.\n(line    7)\n* PyFinalizeEx (C function) <3>:        Initializing and finalizing the interpreter.\n(line   45)\n* PyFinalizeEx (C function) <4>:        Sub-interpreter support.\n(line  165)\n* PyFinalizeEx (C function) <5>:        Sub-interpreter support.\n(line  203)\n* PyFrozenFlag (C var):                 Global configuration variables.\n(line   57)\n* PyGE (C macro):                       PyTypeObject Slots. (line  998)\n* PyGenericAlias (C function):          Objects for Type Hinting.\n(line   10)\n* PyGenericAliasType (C var):           Objects for Type Hinting.\n(line   42)\n* PyGetArgcArgv (C function):           PyGetArgcArgv.     (line    6)\n* PyGetBuildInfo (C function):          Process-wide parameters.\n(line  258)\n* PyGetCompiler (C function):           Process-wide parameters.\n(line  247)\n* PyGetCopyright (C function):          Process-wide parameters.\n(line  237)\n* PyGETENV (C macro):                   Useful macros.      (line   81)\n* PyGetExecPrefix (C function):         Embedding Python<2>.\n(line   42)\n* PyGetExecPrefix (C function) <1>:     Process-wide parameters.\n(line   97)\n* PyGetPath (C function):               Embedding Python<2>.\n(line   42)\n* PyGetPath (C function) <1>:           Process-wide parameters.\n(line  157)\n* PyGetPath():                          Process-wide parameters.\n(line   42)\n* PyGetPath() <1>:                      Process-wide parameters.\n(line  178)\n* PyGetPlatform (C function):           Process-wide parameters.\n(line  225)\n* PyGetPrefix (C function):             Embedding Python<2>.\n(line   42)\n* PyGetPrefix (C function) <1>:         Process-wide parameters.\n(line   78)\n* PyGetProgramFullPath (C function):    Embedding Python<2>.\n(line   42)\n* PyGetProgramFullPath (C function) <1>: Process-wide parameters.\n(line  141)\n* PyGetProgramName (C function):        Process-wide parameters.\n(line   65)\n* PyGetPythonHome (C function):         Process-wide parameters.\n(line  363)\n* PyGetVersion (C function):            Process-wide parameters.\n(line  211)\n* PyGT (C macro):                       PyTypeObject Slots. (line  995)\n* Pyhasht (C type):                    PyHash API.         (line    8)\n* PyHashRandomizationFlag (C var):      Global configuration variables.\n(line   70)\n* PyIgnoreEnvironmentFlag (C var):      Global configuration variables.\n(line   85)\n* PyINCREF (C function):                Reference Counts<2>.\n(line   18)\n* PyINCREF (C function) <1>:            Reference Counting. (line   38)\n* PyIncRef (C function):                Reference Counting. (line  153)\n* PyInitialize (C function):            Embedding Python<2>.\n(line   12)\n* PyInitialize (C function) <1>:        Initializing and finalizing the interpreter.\n(line    6)\n* PyInitialize (C function) <2>:        Sub-interpreter support.\n(line  165)\n* PyInitialize():                       Process-wide parameters.\n(line    9)\n* PyInitialize() <1>:                   Process-wide parameters.\n(line   42)\n* PyInitializeEx (C function):          Initializing and finalizing the interpreter.\n(line   30)\n* PyInitializeFromConfig (C function):  Initialization with PyConfig.\n(line    8)\n* PyInspectFlag (C var):                Global configuration variables.\n(line   98)\n* PyInteractiveFlag (C var):            Global configuration variables.\n(line  114)\n* PyIs (C function):                    Base object types and macros.\n(line   55)\n* PyISTYPE (C function):               Base object types and macros.\n(line   94)\n* PyIsFalse (C function):               Base object types and macros.\n(line   75)\n* PyIsInitialized (C function):         Embedding Python<2>.\n(line   51)\n* PyIsInitialized (C function) <1>:     Initializing and finalizing the interpreter.\n(line   39)\n* PyIsNone (C function):                Base object types and macros.\n(line   61)\n* PyIsolatedFlag (C var):               Global configuration variables.\n(line  124)\n* PyIsTrue (C function):                Base object types and macros.\n(line   68)\n* PyLE (C macro):                       PyTypeObject Slots. (line  986)\n* PyLeaveRecursiveCall (C function):    Recursion Control.  (line   33)\n* PyLegacyWindowsFSEncodingFlag (C var): Global configuration variables.\n(line  140)\n* PyLegacyWindowsStdioFlag (C var):     Global configuration variables.\n(line  160)\n* PyLIMITEDAPI (C macro):              Limited C API.      (line   11)\n* PyLT (C macro):                       PyTypeObject Slots. (line  983)\n* PyMain (C function):                  The Very High Level Layer.\n(line   24)\n* PYMAJORVERSION (C macro):            API and ABI Versioning.\n(line   13)\n* PyMAX (C macro):                      Useful macros.      (line   86)\n* PyMEMBERSIZE (C macro):              Useful macros.      (line   92)\n* PYMICROVERSION (C macro):            API and ABI Versioning.\n(line   21)\n* PyMIN (C macro):                      Useful macros.      (line   98)\n* PYMINORVERSION (C macro):            API and ABI Versioning.\n(line   17)\n* Pymodcreate (C macro):               Multi-phase initialization.\n(line   63)\n* Pymodexec (C macro):                 Multi-phase initialization.\n(line   97)\n* Pymodmultipleinterpreters (C macro): Multi-phase initialization.\n(line  109)\n* PyMODMULTIPLEINTERPRETERSNOTSUPPORTED (C macro): Multi-phase initialization.\n(line  113)\n* PyMODMULTIPLEINTERPRETERSSUPPORTED (C macro): Multi-phase initialization.\n(line  117)\n* PyMODPERINTERPRETERGILSUPPORTED (C macro): Multi-phase initialization.\n(line  123)\n* PyNE (C macro):                       PyTypeObject Slots. (line  992)\n* PyNewInterpreter (C function):        Sub-interpreter support.\n(line  192)\n* PyNewInterpreterFromConfig (C function): Sub-interpreter support.\n(line  109)\n* PyNewRef (C function):                Reference Counting. (line   66)\n* PyNOINLINE (C macro):                Useful macros.      (line  104)\n* PyNone (C var):                       The None Object.    (line   11)\n* PyNoSiteFlag (C var):                 Global configuration variables.\n(line  178)\n* PyNotImplemented (C var):             Object Protocol.    (line    6)\n* PyNoUserSiteDirectory (C var):        Global configuration variables.\n(line  194)\n* pyobject (class in ctypes):           Fundamental data types<2>.\n(line  218)\n* PyOptimizeFlag (C var):               Global configuration variables.\n(line  208)\n* PyPreInitialize (C function):         Preinitialize Python with PyPreConfig.\n(line   21)\n* PyPreInitializeFromArgs (C function): Preinitialize Python with PyPreConfig.\n(line   38)\n* PyPreInitializeFromBytesArgs (C function): Preinitialize Python with PyPreConfig.\n(line   28)\n* PyPRINTRAW (C macro):                Object Protocol.    (line   17)\n* PyPRINTRAW (C macro) <1>:            File Objects.       (line   93)\n* PYPYTHON:                             Customizing default Python versions.\n(line   18)\n* PyQuietFlag (C var):                  Global configuration variables.\n(line  219)\n* PyREADONLY (C macro):                 Member flags.       (line    8)\n* PyREFCNT (C function):                Reference Counting. (line    9)\n* PyRELATIVEOFFSET (C macro):          Member flags.       (line   17)\n* PYRELEASELEVEL (C macro):            API and ABI Versioning.\n(line   25)\n* PYRELEASESERIAL (C macro):           API and ABI Versioning.\n(line   30)\n* PyReprEnter (C function):             Recursion Control.  (line   47)\n* PyReprLeave (C function):             Recursion Control.  (line   64)\n* PYRESUME (monitoring event):          Events.             (line   43)\n* PYRETURN (monitoring event):          Events.             (line   48)\n* PyRETURNFALSE (C macro):             Boolean Objects.    (line   35)\n* PyRETURNNONE (C macro):              The None Object.    (line   18)\n* PyRETURNNOTIMPLEMENTED (C macro):    Object Protocol.    (line   11)\n* PyRETURNRICHCOMPARE (C macro):       PyTypeObject Slots. (line 1004)\n* PyRETURNTRUE (C macro):              Boolean Objects.    (line   39)\n* PyRunMain (C function):               PyRunMain.         (line    6)\n* PySETREFCNT (C function):            Reference Counting. (line   28)\n* PySETSIZE (C function):              Base object types and macros.\n(line  117)\n* PySETTYPE (C function):              Base object types and macros.\n(line  101)\n* PySetPath (C function):               Process-wide parameters.\n(line  177)\n* PySetPath():                          Process-wide parameters.\n(line  158)\n* PySetProgramName (C function):        Embedding Python<2>.\n(line   42)\n* PySetProgramName (C function) <1>:    Process-wide parameters.\n(line   41)\n* PySetProgramName():                   Initializing and finalizing the interpreter.\n(line    7)\n* PySetProgramName() <1>:               Process-wide parameters.\n(line   66)\n* PySetProgramName() <2>:               Process-wide parameters.\n(line  142)\n* PySetPythonHome (C function):         Process-wide parameters.\n(line  344)\n* PySETREF (C macro):                   Reference Counting. (line  165)\n* PySetStandardStreamEncoding (C function): Process-wide parameters.\n(line    6)\n* Pysingleinput (C var):               The Very High Level Layer.\n(line  345)\n* PySIZE (C function):                  Base object types and macros.\n(line  107)\n* Pyssizet (C type):                   Types.              (line   14)\n* PYSSIZETMAX (C macro):              Integer Objects.    (line  194)\n* PYSTART (monitoring event):           Events.             (line   53)\n* PySTRINGIFY (C macro):                Useful macros.      (line  116)\n* PyTBOOL (C macro):                   Member types.       (line   59)\n* PyTBYTE (C macro):                   Member types.       (line   20)\n* PyTCHAR (C macro):                   Member types.       (line   68)\n* PyTDOUBLE (C macro):                 Member types.       (line   56)\n* PyTFLOAT (C macro):                  Member types.       (line   53)\n* PyTINT (C macro):                    Member types.       (line   26)\n* PyTLONG (C macro):                   Member types.       (line   29)\n* PyTLONGLONG (C macro):               Member types.       (line   32)\n* PyTOBJECTEX (C macro):              Member types.       (line   71)\n* PyTPYSSIZET (C macro):               Member types.       (line   50)\n* PyTSHORT (C macro):                  Member types.       (line   23)\n* PyTSTRING (C macro):                 Member types.       (line   62)\n* PyTSTRINGINPLACE (C macro):         Member types.       (line   65)\n* PyTUBYTE (C macro):                  Member types.       (line   35)\n* PyTUINT (C macro):                   Member types.       (line   38)\n* PyTULONG (C macro):                  Member types.       (line   44)\n* PyTULONGLONG (C macro):              Member types.       (line   47)\n* PyTUSHORT (C macro):                 Member types.       (line   41)\n* PYTHROW (monitoring event):           Events.             (line   58)\n* PyTPFLAGSBASEEXCSUBCLASS (C macro): PyTypeObject Slots.\n(line  657)\n* PyTPFLAGSBASETYPE (C macro):         PyTypeObject Slots. (line  511)\n* PyTPFLAGSBYTESSUBCLASS (C macro):   PyTypeObject Slots. (line  651)\n* PyTPFLAGSDEFAULT (C macro):          PyTypeObject Slots. (line  561)\n* PyTPFLAGSDICTSUBCLASS (C macro):    PyTypeObject Slots. (line  655)\n* PyTPFLAGSDISALLOWINSTANTIATION (C macro): PyTypeObject Slots.\n(line  713)\n* PyTPFLAGSHAVEFINALIZE (C macro):    PyTypeObject Slots. (line  670)\n* PyTPFLAGSHAVEGC (C macro):          PyTypeObject Slots. (line  539)\n* PyTPFLAGSHAVEVECTORCALL (C macro):  PyTypeObject Slots. (line  681)\n* PyTPFLAGSHEAPTYPE (C macro):         PyTypeObject Slots. (line  495)\n* PyTPFLAGSIMMUTABLETYPE (C macro):    PyTypeObject Slots. (line  699)\n* PyTPFLAGSITEMSATEND (C macro):     PyTypeObject Slots. (line  625)\n* PyTPFLAGSLISTSUBCLASS (C macro):    PyTypeObject Slots. (line  647)\n* PyTPFLAGSLONGSUBCLASS (C macro):    PyTypeObject Slots. (line  645)\n* PyTPFLAGSMANAGEDDICT (C macro):     PyTypeObject Slots. (line  597)\n* PyTPFLAGSMANAGEDWEAKREF (C macro):  PyTypeObject Slots. (line  613)\n* PyTPFLAGSMAPPING (C macro):          PyTypeObject Slots. (line  741)\n* PyTPFLAGSMETHODDESCRIPTOR (C macro): PyTypeObject Slots.\n(line  572)\n* PyTPFLAGSREADY (C macro):            PyTypeObject Slots. (line  521)\n* PyTPFLAGSREADYING (C macro):         PyTypeObject Slots. (line  530)\n* PyTPFLAGSSEQUENCE (C macro):         PyTypeObject Slots. (line  765)\n* PyTPFLAGSTUPLESUBCLASS (C macro):   PyTypeObject Slots. (line  649)\n* PyTPFLAGSTYPESUBCLASS (C macro):    PyTypeObject Slots. (line  659)\n* PyTPFLAGSUNICODESUBCLASS (C macro): PyTypeObject Slots. (line  653)\n* PyTPFLAGSVALIDVERSIONTAG (C macro): PyTypeObject Slots.\n(line  789)\n* Pytracefunc (C type):                 Profiling and Tracing.\n(line   18)\n* PyTrue (C var):                       Boolean Objects.    (line   28)\n* PytssNEEDSINIT (C macro):           Thread Specific Storage TSS API.\n(line   28)\n* Pytsst (C type):                     Thread Specific Storage TSS API.\n(line   17)\n* PyTYPE (C function):                  Base object types and macros.\n(line   82)\n* PyUCS1 (C type):                      Unicode Type.       (line    9)\n* PyUCS2 (C type):                      Unicode Type.       (line    9)\n* PyUCS4 (C type):                      Unicode Type.       (line    9)\n* Pyuhasht (C type):                   PyHash API.         (line   14)\n* PyUNBLOCKTHREADS (C macro):          High-level API.     (line  182)\n* PyUnbufferedStdioFlag (C var):        Global configuration variables.\n(line  234)\n* PyUNICODE (C type):                   Unicode Type.       (line   19)\n* PyUNICODEISHIGHSURROGATE (C function): Unicode Character Properties.\n(line  114)\n* PyUNICODEISLOWSURROGATE (C function): Unicode Character Properties.\n(line  118)\n* PyUNICODEISSURROGATE (C function):  Unicode Character Properties.\n(line  110)\n* PyUNICODEISALNUM (C function):       Unicode Character Properties.\n(line   52)\n* PyUNICODEISALPHA (C function):       Unicode Character Properties.\n(line   47)\n* PyUNICODEISDECIMAL (C function):     Unicode Character Properties.\n(line   35)\n* PyUNICODEISDIGIT (C function):       Unicode Character Properties.\n(line   39)\n* PyUNICODEISLINEBREAK (C function):   Unicode Character Properties.\n(line   30)\n* PyUNICODEISLOWER (C function):       Unicode Character Properties.\n(line   15)\n* PyUNICODEISNUMERIC (C function):     Unicode Character Properties.\n(line   43)\n* PyUNICODEISPRINTABLE (C function):   Unicode Character Properties.\n(line   57)\n* PyUNICODEISSPACE (C function):       Unicode Character Properties.\n(line   10)\n* PyUNICODEISTITLE (C function):       Unicode Character Properties.\n(line   25)\n* PyUNICODEISUPPER (C function):       Unicode Character Properties.\n(line   20)\n* PyUNICODEJOINSURROGATES (C function): Unicode Character Properties.\n(line  122)\n* PyUNICODETODECIMAL (C function):     Unicode Character Properties.\n(line   91)\n* PyUNICODETODIGIT (C function):       Unicode Character Properties.\n(line   97)\n* PyUNICODETOLOWER (C function):       Unicode Character Properties.\n(line   70)\n* PyUNICODETONUMERIC (C function):     Unicode Character Properties.\n(line  103)\n* PyUNICODETOTITLE (C function):       Unicode Character Properties.\n(line   84)\n* PyUNICODETOUPPER (C function):       Unicode Character Properties.\n(line   77)\n* PyUNREACHABLE (C macro):              Useful macros.      (line  123)\n* PyUNUSED (C macro):                   Useful macros.      (line  148)\n* PYUNWIND (monitoring event):          Events.             (line   62)\n* PyVaBuildValue (C function):          Building values.    (line  202)\n* PYVECTORCALLARGUMENTSOFFSET (C macro): The Vectorcall Protocol.\n(line   69)\n* PyVerboseFlag (C var):                Global configuration variables.\n(line  247)\n* PyVersion (C var):                    API and ABI Versioning.\n(line   69)\n* PYVERSIONHEX (C macro):              API and ABI Versioning.\n(line   34)\n* PyVISIT (C function):                 Supporting Cyclic Garbage Collection.\n(line  180)\n* PyXDECREF (C function):               Exceptions<21>.     (line  123)\n* PyXDECREF (C function) <1>:           Reference Counting. (line  130)\n* PyXINCREF (C function):               Reference Counting. (line   59)\n* PyXNewRef (C function):               Reference Counting. (line   90)\n* PyXSETREF (C macro):                  Reference Counting. (line  191)\n* PYYIELD (monitoring event):           Events.             (line   66)\n* PyAIterCheck (C function):            Iterator Protocol.  (line   14)\n* PyAnySetCheck (C function):           Set Objects.        (line   54)\n* PyAnySetCheckExact (C function):      Set Objects.        (line   67)\n* PyArgParse (C function):              API Functions.      (line   46)\n* PyArgParseTuple (C function):         Extracting Parameters in Extension Functions.\n(line    6)\n* PyArgParseTuple (C function) <1>:     API Functions.      (line    6)\n* PyArgParseTupleAndKeywords (C function): Keyword Parameters for Extension Functions.\n(line    6)\n* PyArgParseTupleAndKeywords (C function) <1>: API Functions.\n(line   19)\n* PyArgUnpackTuple (C function):        API Functions.      (line   57)\n* PyArgValidateKeywordArguments (C function): API Functions.\n(line   38)\n* PyArgVaParse (C function):            API Functions.      (line   13)\n* PyArgVaParseTupleAndKeywords (C function): API Functions. (line   31)\n* PyASCIIObject (C type):                Unicode Type.       (line   28)\n* PyAsyncMethods (C type):               Async Object Structures.\n(line    8)\n* PyAsyncMethods.amaiter (C member):    Async Object Structures.\n(line   35)\n* PyAsyncMethods.amanext (C member):    Async Object Structures.\n(line   47)\n* PyAsyncMethods.amawait (C member):    Async Object Structures.\n(line   23)\n* PyAsyncMethods.amsend (C member):     Async Object Structures.\n(line   56)\n* PyBoolCheck (C function):             Boolean Objects.    (line   16)\n* PyBoolFromLong (C function):          Boolean Objects.    (line   43)\n* PyBoolType (C var):                   Boolean Objects.    (line   11)\n* PyBUFANYCONTIGUOUS (C macro):        contiguity requests.\n(line   20)\n* PyBUFCCONTIGUOUS (C macro):          contiguity requests.\n(line   14)\n* PyBUFCONTIG (C macro):                compound requests.  (line   36)\n* PyBUFCONTIGRO (C macro):             compound requests.  (line   39)\n* PyBUFFCONTIGUOUS (C macro):          contiguity requests.\n(line   17)\n* PyBUFFORMAT (C macro):                readonly format.    (line   14)\n* PyBUFFULL (C macro):                  compound requests.  (line   18)\n* PyBUFFULLRO (C macro):               compound requests.  (line   21)\n* PyBUFINDIRECT (C macro):              shape strides suboffsets.\n(line   14)\n* PyBUFMAXNDIM (C macro):              Buffer structure.   (line  162)\n* PyBUFND (C macro):                    shape strides suboffsets.\n(line   20)\n* PyBUFREAD (C macro):                  MemoryView objects. (line   18)\n* PyBUFRECORDS (C macro):               compound requests.  (line   24)\n* PyBUFRECORDSRO (C macro):            compound requests.  (line   27)\n* PyBUFSIMPLE (C macro):                shape strides suboffsets.\n(line   23)\n* PyBUFSTRIDED (C macro):               compound requests.  (line   30)\n* PyBUFSTRIDEDRO (C macro):            compound requests.  (line   33)\n* PyBUFSTRIDES (C macro):               shape strides suboffsets.\n(line   17)\n* PyBUFWRITABLE (C macro):              readonly format.    (line    6)\n* PyBUFWRITE (C macro):                 MemoryView objects. (line   22)\n* PyBufferFillContiguousStrides (C function): Buffer-related functions.\n(line   87)\n* PyBufferFillInfo (C function):        Buffer-related functions.\n(line   96)\n* PyBufferFromContiguous (C function):  Buffer-related functions.\n(line   63)\n* PyBufferGetPointer (C function):      Buffer-related functions.\n(line   57)\n* PyBufferIsContiguous (C function):    Buffer-related functions.\n(line   49)\n* PyBufferRelease (C function):         Buffer-related functions.\n(line   31)\n* PyBufferSizeFromFormat (C function):  Buffer-related functions.\n(line   41)\n* PyBufferToContiguous (C function):    Buffer-related functions.\n(line   70)\n* PyBufferProcs (C type):                Buffer Protocol.    (line   20)\n* PyBufferProcs (C type) <1>:            Buffer Object Structures.\n(line    6)\n* PyBufferProcs.bfgetbuffer (C member): Buffer Object Structures.\n(line   12)\n* PyBufferProcs.bfreleasebuffer (C member): Buffer Object Structures.\n(line   60)\n* PyByteArrayASSTRING (C function):    Macros.             (line    8)\n* PyByteArrayAsString (C function):     Direct API functions.\n(line   29)\n* PyByteArrayCheck (C function):        Type check macros.  (line    6)\n* PyByteArrayCheckExact (C function):   Type check macros.  (line   11)\n* PyByteArrayConcat (C function):       Direct API functions.\n(line   18)\n* PyByteArrayFromObject (C function):   Direct API functions.\n(line    6)\n* PyByteArrayFromStringAndSize (C function): Direct API functions.\n(line   12)\n* PyByteArrayGETSIZE (C function):     Macros.             (line   13)\n* PyByteArrayResize (C function):       Direct API functions.\n(line   34)\n* PyByteArraySize (C function):         Direct API functions.\n(line   24)\n* PyByteArrayType (C var):              Byte Array Objects. (line   11)\n* PyByteArrayObject (C type):            Byte Array Objects. (line    6)\n* PyBytesASSTRING (C function):        Bytes Objects<2>.   (line  138)\n* PyBytesAsString (C function):         Bytes Objects<2>.   (line  127)\n* PyBytesAsStringAndSize (C function):  Bytes Objects<2>.   (line  143)\n* PyBytesCheck (C function):            Bytes Objects<2>.   (line   19)\n* PyBytesCheckExact (C function):       Bytes Objects<2>.   (line   24)\n* PyBytesConcat (C function):           Bytes Objects<2>.   (line  165)\n* PyBytesConcatAndDel (C function):     Bytes Objects<2>.   (line  175)\n* PyBytesFromFormat (C function):       Bytes Objects<2>.   (line   43)\n* PyBytesFromFormatV (C function):      Bytes Objects<2>.   (line  108)\n* PyBytesFromObject (C function):       Bytes Objects<2>.   (line  114)\n* PyBytesFromString (C function):       Bytes Objects<2>.   (line   30)\n* PyBytesFromStringAndSize (C function): Bytes Objects<2>.  (line   36)\n* PyBytesGETSIZE (C function):         Bytes Objects<2>.   (line  123)\n* PyBytesSize (C function):             Bytes Objects<2>.   (line  119)\n* PyBytesType (C var):                  Bytes Objects<2>.   (line   14)\n* PyBytesObject (C type):                Bytes Objects<2>.   (line    9)\n* pycacheprefix (in module sys):        sys -- System-specific parameters and functions.\n(line  360)\n* PyCallableCheck (C function):         Call Support API.   (line    6)\n* PyCallIterCheck (C function):         Iterator Objects.   (line   34)\n* PyCallIterNew (C function):           Iterator Objects.   (line   39)\n* PyCallIterType (C var):               Iterator Objects.   (line   29)\n* PyCapsule (C type):                    Capsules<2>.        (line   11)\n* PyCapsuleCheckExact (C function):     Capsules<2>.        (line   29)\n* PyCapsuleDestructor (C type):         Capsules<2>.        (line   20)\n* PyCapsuleGetContext (C function):     Capsules<2>.        (line   76)\n* PyCapsuleGetDestructor (C function):  Capsules<2>.        (line   65)\n* PyCapsuleGetName (C function):        Capsules<2>.        (line   86)\n* PyCapsuleGetPointer (C function):     Capsules<2>.        (line   54)\n* PyCapsuleImport (C function):         Capsules<2>.        (line   96)\n* PyCapsuleIsValid (C function):        Capsules<2>.        (line  108)\n* PyCapsuleNew (C function):            Capsules<2>.        (line   34)\n* PyCapsuleSetContext (C function):     Capsules<2>.        (line  124)\n* PyCapsuleSetDestructor (C function):  Capsules<2>.        (line  132)\n* PyCapsuleSetName (C function):        Capsules<2>.        (line  140)\n* PyCapsuleSetPointer (C function):     Capsules<2>.        (line  150)\n* PyCellCheck (C function):             Cell Objects.       (line   24)\n* PyCellGet (C function):               Cell Objects.       (line   33)\n* PyCellGET (C function):               Cell Objects.       (line   37)\n* PyCellNew (C function):               Cell Objects.       (line   29)\n* PyCellSet (C function):               Cell Objects.       (line   42)\n* PyCellSET (C function):               Cell Objects.       (line   49)\n* PyCellType (C var):                   Cell Objects.       (line   20)\n* PyCellObject (C type):                 Cell Objects.       (line   16)\n* PyCFALLOWTOPLEVELAWAIT (in module ast): Compiler Flags.\n(line    9)\n* PyCFONLYAST (in module ast):         Compiler Flags.     (line   16)\n* PyCFTYPECOMMENTS (in module ast):    Compiler Flags.     (line   21)\n* PyCFunction (C type):                  Implementing functions and methods.\n(line    6)\n* PyCFunctionNew (C function):          Implementing functions and methods.\n(line  257)\n* PyCFunctionNewEx (C function):        Implementing functions and methods.\n(line  252)\n* PyCFunctionWithKeywords (C type):      Implementing functions and methods.\n(line   20)\n* PycInvalidationMode (class in pycompile): pycompile -- Compile Python source files.\n(line   92)\n* PyCMethod (C type):                    Implementing functions and methods.\n(line   49)\n* PyCMethodNew (C function):            Implementing functions and methods.\n(line  225)\n* PyCodeAddr2Line (C function):         Code Objects<2>.    (line   90)\n* PyCodeAddr2Location (C function):     Code Objects<2>.    (line   99)\n* PyCodeAddWatcher (C function):        Code Objects<2>.    (line  156)\n* PyCodeCheck (C function):             Code Objects<2>.    (line   20)\n* PyCodeClearWatcher (C function):      Code Objects<2>.    (line  165)\n* PyCodeGetCellvars (C function):       Code Objects<2>.    (line  135)\n* PyCodeGetCode (C function):           Code Objects<2>.    (line  111)\n* PyCodeGetFirstFree (C function):      Code Objects<2>.    (line   30)\n* PyCodeGetFreevars (C function):       Code Objects<2>.    (line  146)\n* PyCodeGetNumFree (C function):        Code Objects<2>.    (line   25)\n* PyCodeGetVarnames (C function):       Code Objects<2>.    (line  125)\n* PyCodeNew (C function):               Code Objects<2>.    (line   57)\n* PyCodeNewEmpty (C function):          Code Objects<2>.    (line   84)\n* PyCodeNewWithPosOnlyArgs (C function): Code Objects<2>.   (line   75)\n* PyCodeType (C var):                   Code Objects<2>.    (line   15)\n* PyCodeWatchCallback (C type):         Code Objects<2>.    (line  181)\n* PyCodecBackslashReplaceErrors (C function): Registry API for Unicode encoding error handlers.\n(line   55)\n* PyCodecDecode (C function):           Codec registry and support functions.\n(line   38)\n* PyCodecDecoder (C function):          Codec lookup API.   (line   16)\n* PyCodecEncode (C function):           Codec registry and support functions.\n(line   27)\n* PyCodecEncoder (C function):          Codec lookup API.   (line   11)\n* PyCodecIgnoreErrors (C function):     Registry API for Unicode encoding error handlers.\n(line   39)\n* PyCodecIncrementalDecoder (C function): Codec lookup API. (line   27)\n* PyCodecIncrementalEncoder (C function): Codec lookup API. (line   21)\n* PyCodecKnownEncoding (C function):    Codec registry and support functions.\n(line   22)\n* PyCodecLookupError (C function):      Registry API for Unicode encoding error handlers.\n(line   27)\n* PyCodecNameReplaceErrors (C function): Registry API for Unicode encoding error handlers.\n(line   61)\n* PyCodecRegister (C function):         Codec registry and support functions.\n(line    6)\n* PyCodecRegisterError (C function):    Registry API for Unicode encoding error handlers.\n(line    6)\n* PyCodecReplaceErrors (C function):    Registry API for Unicode encoding error handlers.\n(line   44)\n* PyCodecStreamReader (C function):     Codec lookup API.   (line   33)\n* PyCodecStreamWriter (C function):     Codec lookup API.   (line   39)\n* PyCodecStrictErrors (C function):     Registry API for Unicode encoding error handlers.\n(line   34)\n* PyCodecUnregister (C function):       Codec registry and support functions.\n(line   14)\n* PyCodecXMLCharRefReplaceErrors (C function): Registry API for Unicode encoding error handlers.\n(line   49)\n* PyCodeEvent (C type):                  Code Objects<2>.    (line  174)\n* PyCodeObject (C type):                 Code Objects<2>.    (line   10)\n* PyCompactUnicodeObject (C type):       Unicode Type.       (line   28)\n* PyCompileError:                        pycompile -- Compile Python source files.\n(line   19)\n* PyCompilerFlags (C struct):            The Very High Level Layer.\n(line  351)\n* PyCompilerFlags.cffeatureversion (C member): The Very High Level Layer.\n(line  367)\n* PyCompilerFlags.cfflags (C member):   The Very High Level Layer.\n(line  363)\n* PyComplexAsCComplex (C function):     Complex Numbers as Python Objects.\n(line   47)\n* PyComplexCheck (C function):          Complex Numbers as Python Objects.\n(line   16)\n* PyComplexCheckExact (C function):     Complex Numbers as Python Objects.\n(line   22)\n* PyComplexFromCComplex (C function):   Complex Numbers as Python Objects.\n(line   28)\n* PyComplexFromDoubles (C function):    Complex Numbers as Python Objects.\n(line   33)\n* PyComplexImagAsDouble (C function):   Complex Numbers as Python Objects.\n(line   43)\n* PyComplexRealAsDouble (C function):   Complex Numbers as Python Objects.\n(line   39)\n* PyComplexType (C var):                Complex Numbers as Python Objects.\n(line   11)\n* PyComplexObject (C type):              Complex Numbers as Python Objects.\n(line    6)\n* PyConfig (C type):                     PyConfig.           (line    6)\n* PyConfigClear (C function):           PyConfig.           (line   97)\n* PyConfigInitIsolatedConfig (C function): PyConfig.        (line   20)\n* PyConfigInitPythonConfig (C function): PyConfig.          (line   15)\n* PyConfigRead (C function):            PyConfig.           (line   66)\n* PyConfigSetArgv (C function):         PyConfig.           (line   41)\n* PyConfigSetBytesArgv (C function):    PyConfig.           (line   49)\n* PyConfigSetBytesString (C function):  PyConfig.           (line   32)\n* PyConfigSetString (C function):       PyConfig.           (line   25)\n* PyConfigSetWideStringList (C function): PyConfig.         (line   58)\n* PyConfig.argv (C member):              PyConfig.           (line  128)\n* PyConfig.baseexecprefix (C member):  PyConfig.           (line  167)\n* PyConfig.baseexecutable (C member):   PyConfig.           (line  175)\n* PyConfig.baseprefix (C member):       PyConfig.           (line  187)\n* PyConfig.bufferedstdio (C member):    PyConfig.           (line  195)\n* PyConfig.byteswarning (C member):     PyConfig.           (line  208)\n* PyConfig.checkhashpycsmode (C member): PyConfig.        (line  245)\n* PyConfig.codedebugranges (C member): PyConfig.           (line  231)\n* PyConfig.configurecstdio (C member): PyConfig.           (line  265)\n* PyConfig.devmode (C member):          PyConfig.           (line  280)\n* PyConfig.dumprefs (C member):         PyConfig.           (line  289)\n* PyConfig.execprefix (C member):       PyConfig.           (line  303)\n* PyConfig.executable (C member):        PyConfig.           (line  313)\n* PyConfig.faulthandler (C member):      PyConfig.           (line  322)\n* PyConfig.filesystemencoding (C member): PyConfig.         (line  334)\n* PyConfig.filesystemerrors (C member): PyConfig.           (line  367)\n* PyConfig.hashseed (C member):         PyConfig.           (line  389)\n* PyConfig.home (C member):              PyConfig.           (line  404)\n* PyConfig.importtime (C member):       PyConfig.           (line  417)\n* PyConfig.inspect (C member):           PyConfig.           (line  426)\n* PyConfig.installsignalhandlers (C member): PyConfig.     (line  441)\n* PyConfig.intmaxstrdigits (C member): PyConfig.          (line  455)\n* PyConfig.interactive (C member):       PyConfig.           (line  447)\n* PyConfig.isolated (C member):          PyConfig.           (line  475)\n* PyConfig.legacywindowsstdio (C member): PyConfig.        (line  500)\n* PyConfig.mallocstats (C member):      PyConfig.           (line  517)\n* PyConfig.modulesearchpaths (C member): PyConfig.         (line  561)\n* PyConfig.modulesearchpathsset (C member): PyConfig.     (line  563)\n* PyConfig.optimizationlevel (C member): PyConfig.          (line  577)\n* PyConfig.origargv (C member):         PyConfig.           (line  593)\n* PyConfig.parseargv (C member):        PyConfig.           (line  611)\n* PyConfig.parserdebug (C member):      PyConfig.           (line  632)\n* PyConfig.pathconfigwarnings (C member): PyConfig.         (line  646)\n* PyConfig.perfprofiling (C member):    PyConfig.           (line  828)\n* PyConfig.platlibdir (C member):        PyConfig.           (line  530)\n* PyConfig.prefix (C member):            PyConfig.           (line  658)\n* PyConfig.programname (C member):      PyConfig.           (line  667)\n* PyConfig.pycacheprefix (C member):    PyConfig.           (line  691)\n* PyConfig.pythonpathenv (C member):    PyConfig.           (line  550)\n* PyConfig.quiet (C member):             PyConfig.           (line  704)\n* PyConfig.runcommand (C member):       PyConfig.           (line  713)\n* PyConfig.runfilename (C member):      PyConfig.           (line  721)\n* PyConfig.runmodule (C member):        PyConfig.           (line  735)\n* PyConfig.safepath (C member):         PyConfig.           (line  145)\n* PyConfig.showrefcount (C member):    PyConfig.           (line  743)\n* PyConfig.siteimport (C member):       PyConfig.           (line  755)\n* PyConfig.skipsourcefirstline (C member): PyConfig.      (line  774)\n* PyConfig.stdioencoding (C member):    PyConfig.           (line  786)\n* PyConfig.stdioerrors (C member):      PyConfig.           (line  788)\n* PyConfig.tracemalloc (C member):       PyConfig.           (line  817)\n* PyConfig.useenvironment (C member):   PyConfig.           (line  843)\n* PyConfig.usehashseed (C member):     PyConfig.           (line  391)\n* PyConfig.usersitedirectory (C member): PyConfig.         (line  854)\n* PyConfig.verbose (C member):           PyConfig.           (line  867)\n* PyConfig.warndefaultencoding (C member): PyConfig.       (line  221)\n* PyConfig.warnoptions (C member):       PyConfig.           (line  884)\n* PyConfig.writebytecode (C member):    PyConfig.           (line  904)\n* PyConfig.xoptions (C member):          PyConfig.           (line  917)\n* PyContext (C type):                    Context Variables Objects.\n(line   26)\n* PyContextCheckExact (C function):     Context Variables Objects.\n(line   55)\n* PyContextCopy (C function):           Context Variables Objects.\n(line   76)\n* PyContextCopyCurrent (C function):    Context Variables Objects.\n(line   80)\n* PyContextEnter (C function):          Context Variables Objects.\n(line   84)\n* PyContextExit (C function):           Context Variables Objects.\n(line   89)\n* PyContextNew (C function):            Context Variables Objects.\n(line   72)\n* PyContextType (C var):                Context Variables Objects.\n(line   41)\n* PyContextToken (C type):               Context Variables Objects.\n(line   36)\n* PyContextTokenCheckExact (C function): Context Variables Objects.\n(line   65)\n* PyContextTokenType (C var):           Context Variables Objects.\n(line   49)\n* PyContextVar (C type):                 Context Variables Objects.\n(line   31)\n* PyContextVarCheckExact (C function):  Context Variables Objects.\n(line   60)\n* PyContextVarGet (C function):         Context Variables Objects.\n(line  105)\n* PyContextVarNew (C function):         Context Variables Objects.\n(line   97)\n* PyContextVarReset (C function):       Context Variables Objects.\n(line  129)\n* PyContextVarSet (C function):         Context Variables Objects.\n(line  123)\n* PyContextVarType (C var):             Context Variables Objects.\n(line   45)\n* PyCoroCheckExact (C function):        Coroutine Objects<2>.\n(line   19)\n* PyCoroNew (C function):               Coroutine Objects<2>.\n(line   24)\n* PyCoroType (C var):                   Coroutine Objects<2>.\n(line   15)\n* PyCoroObject (C type):                 Coroutine Objects<2>.\n(line   11)\n* PyDateCheck (C function):             DateTime Objects<2>.\n(line   75)\n* PyDateCheckExact (C function):        DateTime Objects<2>.\n(line   81)\n* PyDateFromDate (C function):          DateTime Objects<2>.\n(line  132)\n* PyDateFromTimestamp (C function):     DateTime Objects<2>.\n(line  305)\n* PyDateTimeCheck (C function):         DateTime Objects<2>.\n(line   86)\n* PyDateTimeCheckExact (C function):    DateTime Objects<2>.\n(line   92)\n* PyDateTimeDate (C type):              DateTime Objects<2>.\n(line   14)\n* PyDateTimeDATEGETFOLD (C function): DateTime Objects<2>.\n(line  228)\n* PyDateTimeDATEGETHOUR (C function): DateTime Objects<2>.\n(line  211)\n* PyDateTimeDATEGETMICROSECOND (C function): DateTime Objects<2>.\n(line  223)\n* PyDateTimeDATEGETMINUTE (C function): DateTime Objects<2>.\n(line  215)\n* PyDateTimeDATEGETSECOND (C function): DateTime Objects<2>.\n(line  219)\n* PyDateTimeDATEGETTZINFO (C function): DateTime Objects<2>.\n(line  234)\n* PyDateTimeDateTime (C type):          DateTime Objects<2>.\n(line   19)\n* PyDateTimeDateTimeType (C var):       DateTime Objects<2>.\n(line   40)\n* PyDateTimeDateType (C var):           DateTime Objects<2>.\n(line   34)\n* PyDateTimeDelta (C type):             DateTime Objects<2>.\n(line   29)\n* PyDateTimeDELTAGETDAYS (C function): DateTime Objects<2>.\n(line  278)\n* PyDateTimeDELTAGETMICROSECONDS (C function): DateTime Objects<2>.\n(line  290)\n* PyDateTimeDELTAGETSECONDS (C function): DateTime Objects<2>.\n(line  284)\n* PyDateTimeDeltaType (C var):          DateTime Objects<2>.\n(line   52)\n* PyDateTimeFromDateAndTime (C function): DateTime Objects<2>.\n(line  137)\n* PyDateTimeFromDateAndTimeAndFold (C function): DateTime Objects<2>.\n(line  144)\n* PyDateTimeFromTimestamp (C function): DateTime Objects<2>.\n(line  299)\n* PyDateTimeGETDAY (C function):       DateTime Objects<2>.\n(line  203)\n* PyDateTimeGETMONTH (C function):     DateTime Objects<2>.\n(line  199)\n* PyDateTimeGETYEAR (C function):      DateTime Objects<2>.\n(line  195)\n* PyDateTimeTime (C type):              DateTime Objects<2>.\n(line   24)\n* PyDateTimeTIMEGETFOLD (C function): DateTime Objects<2>.\n(line  261)\n* PyDateTimeTIMEGETHOUR (C function): DateTime Objects<2>.\n(line  245)\n* PyDateTimeTIMEGETMICROSECOND (C function): DateTime Objects<2>.\n(line  257)\n* PyDateTimeTIMEGETMINUTE (C function): DateTime Objects<2>.\n(line  249)\n* PyDateTimeTIMEGETSECOND (C function): DateTime Objects<2>.\n(line  253)\n* PyDateTimeTIMEGETTZINFO (C function): DateTime Objects<2>.\n(line  267)\n* PyDateTimeTimeType (C var):           DateTime Objects<2>.\n(line   46)\n* PyDateTimeTimeZoneUTC (C var):       DateTime Objects<2>.\n(line   66)\n* PyDateTimeTZInfoType (C var):         DateTime Objects<2>.\n(line   58)\n* PyDeltaCheck (C function):            DateTime Objects<2>.\n(line  108)\n* PyDeltaCheckExact (C function):       DateTime Objects<2>.\n(line  114)\n* PyDeltaFromDSU (C function):          DateTime Objects<2>.\n(line  166)\n* PyDescrIsData (C function):           Descriptor Objects. (line   37)\n* PyDescrNewClassMethod (C function):   Descriptor Objects. (line   32)\n* PyDescrNewGetSet (C function):        Descriptor Objects. (line   13)\n* PyDescrNewMember (C function):        Descriptor Objects. (line   18)\n* PyDescrNewMethod (C function):        Descriptor Objects. (line   23)\n* PyDescrNewWrapper (C function):       Descriptor Objects. (line   28)\n* PyDictAddWatcher (C function):        Dictionary Objects. (line  231)\n* PyDictCheck (C function):             Dictionary Objects. (line   16)\n* PyDictCheckExact (C function):        Dictionary Objects. (line   21)\n* PyDictClear (C function):             Dictionary Objects. (line   38)\n* PyDictClearWatcher (C function):      Dictionary Objects. (line  240)\n* PyDictContains (C function):          Dictionary Objects. (line   42)\n* PyDictCopy (C function):              Dictionary Objects. (line   48)\n* PyDictDelItem (C function):           Dictionary Objects. (line   67)\n* PyDictDelItemString (C function):     Dictionary Objects. (line   74)\n* PyDictGetItem (C function):           Dictionary Objects. (line   79)\n* PyDictGetItemString (C function):     Dictionary Objects. (line  103)\n* PyDictGetItemWithError (C function):  Dictionary Objects. (line   95)\n* PyDictItems (C function):             Dictionary Objects. (line  128)\n* PyDictKeys (C function):              Dictionary Objects. (line  133)\n* PyDictMerge (C function):             Dictionary Objects. (line  197)\n* PyDictMergeFromSeq2 (C function):     Dictionary Objects. (line  216)\n* PyDictNew (C function):               Dictionary Objects. (line   26)\n* PyDictNext (C function):              Dictionary Objects. (line  149)\n* PyDictSetDefault (C function):        Dictionary Objects. (line  116)\n* PyDictSetItem (C function):           Dictionary Objects. (line   53)\n* PyDictSetItemString (C function):     Dictionary Objects. (line   61)\n* PyDictSize (C function):              Dictionary Objects. (line  143)\n* PyDictType (C var):                   Dictionary Objects. (line   11)\n* PyDictUnwatch (C function):           Dictionary Objects. (line  257)\n* PyDictUpdate (C function):            Dictionary Objects. (line  208)\n* PyDictValues (C function):            Dictionary Objects. (line  138)\n* PyDictWatch (C function):             Dictionary Objects. (line  248)\n* PyDictWatchCallback (C type):         Dictionary Objects. (line  276)\n* PyDictWatchEvent (C type):            Dictionary Objects. (line  267)\n* PyDictObject (C type):                 Dictionary Objects. (line    6)\n* PyDictProxyNew (C function):          Dictionary Objects. (line   30)\n* PyDLL (class in ctypes):               Loading shared libraries.\n(line   67)\n* PyDocSTR (C macro):                   Useful macros.      (line  174)\n* PyDocSTRVAR (C macro):                Useful macros.      (line  156)\n* PyErrBadArgument (C function):        Raising exceptions. (line   45)\n* PyErrBadInternalCall (C function):    Raising exceptions. (line  218)\n* PyErrCheckSignals (C function):       Signal Handling<2>. (line    6)\n* PyErrClear (C function):              Exceptions<21>.     (line   25)\n* PyErrClear (C function) <1>:          Exceptions<21>.     (line  123)\n* PyErrClear (C function) <2>:          Printing and clearing.\n(line    6)\n* PyErrDisplayException (C function):   Printing and clearing.\n(line   56)\n* PyErrExceptionMatches (C function):   Exceptions<21>.     (line  123)\n* PyErrExceptionMatches (C function) <1>: Querying the error indicator.\n(line   22)\n* PyErrFetch (C function):              Finalization and De-allocation.\n(line   33)\n* PyErrFetch (C function) <1>:          Querying the error indicator.\n(line   74)\n* PyErrFormat (C function):             Raising exceptions. (line   24)\n* PyErrFormatV (C function):            Raising exceptions. (line   33)\n* PyErrGetExcInfo (C function):         Querying the error indicator.\n(line  178)\n* PyErrGetHandledException (C function): Querying the error indicator.\n(line  149)\n* PyErrGetRaisedException (C function): Querying the error indicator.\n(line   36)\n* PyErrGivenExceptionMatches (C function): Querying the error indicator.\n(line   28)\n* PyErrNewException (C function):       Exception Classes.  (line    6)\n* PyErrNewExceptionWithDoc (C function): Exception Classes. (line   23)\n* PyErrNoMemory (C function):           Raising exceptions. (line   51)\n* PyErrNormalizeException (C function): Querying the error indicator.\n(line  125)\n* PyErrOccurred (C function):           Exceptions<21>.     (line   12)\n* PyErrOccurred (C function) <1>:       Querying the error indicator.\n(line    6)\n* PyErrPrint (C function):              Printing and clearing.\n(line   30)\n* PyErrPrintEx (C function):            Printing and clearing.\n(line   10)\n* PyErrResourceWarning (C function):    Issuing warnings.   (line   69)\n* PyErrRestore (C function):            Finalization and De-allocation.\n(line   33)\n* PyErrRestore (C function) <1>:        Querying the error indicator.\n(line  102)\n* PyErrSetExcFromWindowsErr (C function): Raising exceptions.\n(line  116)\n* PyErrSetExcFromWindowsErrWithFilename (C function): Raising exceptions.\n(line  162)\n* PyErrSetExcFromWindowsErrWithFilenameObject (C function): Raising exceptions.\n(line  138)\n* PyErrSetExcFromWindowsErrWithFilenameObjects (C function): Raising exceptions.\n(line  150)\n* PyErrSetExcInfo (C function):         Querying the error indicator.\n(line  197)\n* PyErrSetFromErrno (C function):       Raising exceptions. (line   57)\n* PyErrSetFromErrnoWithFilename (C function): Raising exceptions.\n(line   94)\n* PyErrSetFromErrnoWithFilenameObject (C function): Raising exceptions.\n(line   73)\n* PyErrSetFromErrnoWithFilenameObjects (C function): Raising exceptions.\n(line   83)\n* PyErrSetFromWindowsErr (C function):  Raising exceptions. (line  101)\n* PyErrSetFromWindowsErrWithFilename (C function): Raising exceptions.\n(line  125)\n* PyErrSetHandledException (C function): Querying the error indicator.\n(line  165)\n* PyErrSetImportError (C function):     Raising exceptions. (line  172)\n* PyErrSetImportErrorSubclass (C function): Raising exceptions.\n(line  183)\n* PyErrSetInterrupt (C function):       Signal Handling<2>. (line   33)\n* PyErrSetInterruptEx (C function):     Signal Handling<2>. (line   42)\n* PyErrSetNone (C function):            Raising exceptions. (line   41)\n* PyErrSetObject (C function):          Raising exceptions. (line   19)\n* PyErrSetRaisedException (C function): Querying the error indicator.\n(line   64)\n* PyErrSetString (C function):          Exceptions<21>.     (line   25)\n* PyErrSetString (C function) <1>:      Raising exceptions. (line   10)\n* PyErrSyntaxLocation (C function):     Raising exceptions. (line  212)\n* PyErrSyntaxLocationEx (C function):   Raising exceptions. (line  203)\n* PyErrSyntaxLocationObject (C function): Raising exceptions.\n(line  193)\n* PyErrWarnEx (C function):             Issuing warnings.   (line   19)\n* PyErrWarnExplicit (C function):       Issuing warnings.   (line   53)\n* PyErrWarnExplicitObject (C function): Issuing warnings.   (line   41)\n* PyErrWarnFormat (C function):         Issuing warnings.   (line   61)\n* PyErrWriteUnraisable (C function):    Printing and clearing.\n(line   34)\n* PyEvalAcquireLock (C function):       Low-level API.      (line  240)\n* PyEvalAcquireThread (C function):     Low-level API.      (line  208)\n* PyEvalAcquireThread():                High-level API.     (line   31)\n* PyEvalEvalCode (C function):          The Very High Level Layer.\n(line  287)\n* PyEvalEvalCodeEx (C function):        The Very High Level Layer.\n(line  294)\n* PyEvalEvalFrame (C function):         The Very High Level Layer.\n(line  307)\n* PyEvalEvalFrameEx (C function):       The Very High Level Layer.\n(line  313)\n* PyEvalGetBuiltins (C function):       Reflection.         (line    6)\n* PyEvalGetFrame (C function):          Reflection.         (line   22)\n* PyEvalGetFuncDesc (C function):       Reflection.         (line   34)\n* PyEvalGetFuncName (C function):       Reflection.         (line   29)\n* PyEvalGetGlobals (C function):        Reflection.         (line   17)\n* PyEvalGetLocals (C function):         Reflection.         (line   12)\n* PyEvalInitThreads (C function):       High-level API.     (line   30)\n* PyEvalInitThreads():                  Initializing and finalizing the interpreter.\n(line    7)\n* PyEvalMergeCompilerFlags (C function): The Very High Level Layer.\n(line  328)\n* PyEvalReleaseLock (C function):       Low-level API.      (line  261)\n* PyEvalReleaseThread (C function):     Low-level API.      (line  229)\n* PyEvalReleaseThread():                High-level API.     (line   31)\n* PyEvalRestoreThread (C function):     Releasing the GIL from extension code.\n(line   33)\n* PyEvalRestoreThread (C function) <1>: High-level API.     (line   67)\n* PyEvalRestoreThread():                High-level API.     (line   31)\n* PyEvalSaveThread (C function):        Releasing the GIL from extension code.\n(line   33)\n* PyEvalSaveThread (C function) <1>:    High-level API.     (line   60)\n* PyEvalSaveThread():                   High-level API.     (line   31)\n* PyEvalSetProfile (C function):        Profiling and Tracing.\n(line  117)\n* PyEvalSetProfileAllThreads (C function): Profiling and Tracing.\n(line  132)\n* PyEvalSetTrace (C function):          Profiling and Tracing.\n(line  147)\n* PyEvalSetTraceAllThreads (C function): Profiling and Tracing.\n(line  162)\n* PyEvalThreadsInitialized (C function): High-level API.    (line   49)\n* PyExcArithmeticError (C var):         Standard Exceptions.\n(line   11)\n* PyExcAssertionError (C var):          Standard Exceptions.\n(line   11)\n* PyExcAttributeError (C var):          Standard Exceptions.\n(line   11)\n* PyExcBaseException (C var):           Standard Exceptions.\n(line   11)\n* PyExcBlockingIOError (C var):         Standard Exceptions.\n(line   11)\n* PyExcBrokenPipeError (C var):         Standard Exceptions.\n(line   11)\n* PyExcBufferError (C var):             Standard Exceptions.\n(line   11)\n* PyExcBytesWarning (C var):            Standard Warning Categories.\n(line   11)\n* PyExcChildProcessError (C var):       Standard Exceptions.\n(line   11)\n* PyExcConnectionAbortedError (C var):  Standard Exceptions.\n(line   11)\n* PyExcConnectionError (C var):         Standard Exceptions.\n(line   11)\n* PyExcConnectionRefusedError (C var):  Standard Exceptions.\n(line   11)\n* PyExcConnectionResetError (C var):    Standard Exceptions.\n(line   11)\n* PyExcDeprecationWarning (C var):      Standard Warning Categories.\n(line   11)\n* PyExcEnvironmentError (C var):        Standard Exceptions.\n(line  190)\n* PyExcEOFError (C var):                Standard Exceptions.\n(line   11)\n* PyExcException (C var):               Standard Exceptions.\n(line   11)\n* PyExcFileExistsError (C var):         Standard Exceptions.\n(line   11)\n* PyExcFileNotFoundError (C var):       Standard Exceptions.\n(line   11)\n* PyExcFloatingPointError (C var):      Standard Exceptions.\n(line   11)\n* PyExcFutureWarning (C var):           Standard Warning Categories.\n(line   11)\n* PyExcGeneratorExit (C var):           Standard Exceptions.\n(line   11)\n* PyExcImportError (C var):             Standard Exceptions.\n(line   11)\n* PyExcImportWarning (C var):           Standard Warning Categories.\n(line   11)\n* PyExcIndentationError (C var):        Standard Exceptions.\n(line   11)\n* PyExcIndexError (C var):              Standard Exceptions.\n(line   11)\n* PyExcInterruptedError (C var):        Standard Exceptions.\n(line   11)\n* PyExcIOError (C var):                 Standard Exceptions.\n(line  190)\n* PyExcIsADirectoryError (C var):       Standard Exceptions.\n(line   11)\n* PyExcKeyboardInterrupt (C var):       Standard Exceptions.\n(line   11)\n* PyExcKeyError (C var):                Standard Exceptions.\n(line   11)\n* PyExcLookupError (C var):             Standard Exceptions.\n(line   11)\n* PyExcMemoryError (C var):             Standard Exceptions.\n(line   11)\n* PyExcModuleNotFoundError (C var):     Standard Exceptions.\n(line   11)\n* PyExcNameError (C var):               Standard Exceptions.\n(line   11)\n* PyExcNotADirectoryError (C var):      Standard Exceptions.\n(line   11)\n* PyExcNotImplementedError (C var):     Standard Exceptions.\n(line   11)\n* PyExcOSError (C var):                 Standard Exceptions.\n(line   11)\n* PyExcOverflowError (C var):           Standard Exceptions.\n(line   11)\n* PyExcPendingDeprecationWarning (C var): Standard Warning Categories.\n(line   11)\n* PyExcPermissionError (C var):         Standard Exceptions.\n(line   11)\n* PyExcProcessLookupError (C var):      Standard Exceptions.\n(line   11)\n* PyExcRecursionError (C var):          Standard Exceptions.\n(line   11)\n* PyExcReferenceError (C var):          Standard Exceptions.\n(line   11)\n* PyExcResourceWarning (C var):         Standard Warning Categories.\n(line   11)\n* PyExcRuntimeError (C var):            Standard Exceptions.\n(line   11)\n* PyExcRuntimeWarning (C var):          Standard Warning Categories.\n(line   11)\n* PyExcStopAsyncIteration (C var):      Standard Exceptions.\n(line   11)\n* PyExcStopIteration (C var):           Standard Exceptions.\n(line   11)\n* PyExcSyntaxError (C var):             Standard Exceptions.\n(line   11)\n* PyExcSyntaxWarning (C var):           Standard Warning Categories.\n(line   11)\n* PyExcSystemError (C var):             Standard Exceptions.\n(line   11)\n* PyExcSystemExit (C var):              Standard Exceptions.\n(line   11)\n* PyExcTabError (C var):                Standard Exceptions.\n(line   11)\n* PyExcTimeoutError (C var):            Standard Exceptions.\n(line   11)\n* PyExcTypeError (C var):               Standard Exceptions.\n(line   11)\n* PyExcUnboundLocalError (C var):       Standard Exceptions.\n(line   11)\n* PyExcUnicodeDecodeError (C var):      Standard Exceptions.\n(line   11)\n* PyExcUnicodeEncodeError (C var):      Standard Exceptions.\n(line   11)\n* PyExcUnicodeError (C var):            Standard Exceptions.\n(line   11)\n* PyExcUnicodeTranslateError (C var):   Standard Exceptions.\n(line   11)\n* PyExcUnicodeWarning (C var):          Standard Warning Categories.\n(line   11)\n* PyExcUserWarning (C var):             Standard Warning Categories.\n(line   11)\n* PyExcValueError (C var):              Standard Exceptions.\n(line   11)\n* PyExcWarning (C var):                 Standard Warning Categories.\n(line   11)\n* PyExcWindowsError (C var):            Standard Exceptions.\n(line  190)\n* PyExcZeroDivisionError (C var):       Standard Exceptions.\n(line   11)\n* PyExceptionGetArgs (C function):      Exception Objects.  (line   53)\n* PyExceptionGetCause (C function):     Exception Objects.  (line   35)\n* PyExceptionGetContext (C function):   Exception Objects.  (line   19)\n* PyExceptionGetTraceback (C function): Exception Objects.  (line    6)\n* PyExceptionSetArgs (C function):      Exception Objects.  (line   57)\n* PyExceptionSetCause (C function):     Exception Objects.  (line   43)\n* PyExceptionSetContext (C function):   Exception Objects.  (line   28)\n* PyExceptionSetTraceback (C function): Exception Objects.  (line   14)\n* PyFileFromFd (C function):            File Objects.       (line   15)\n* PyFileGetLine (C function):           File Objects.       (line   41)\n* PyFileSetOpenCodeHook (C function):   File Objects.       (line   57)\n* PyFileSetOpenCodeHook.PyOpenCodeHookFunction (C type): File Objects.\n(line   65)\n* PyFileWriteObject (C function):       File Objects.       (line   91)\n* PyFileWriteString (C function):       File Objects.       (line  101)\n* PyFloatASDOUBLE (C function):        Floating Point Objects.\n(line   50)\n* PyFloatAsDouble (C function):         Floating Point Objects.\n(line   38)\n* PyFloatCheck (C function):            Floating Point Objects.\n(line   16)\n* PyFloatCheckExact (C function):       Floating Point Objects.\n(line   22)\n* PyFloatFromDouble (C function):       Floating Point Objects.\n(line   33)\n* PyFloatFromString (C function):       Floating Point Objects.\n(line   28)\n* PyFloatGetInfo (C function):          Floating Point Objects.\n(line   55)\n* PyFloatGetMax (C function):           Floating Point Objects.\n(line   61)\n* PyFloatGetMin (C function):           Floating Point Objects.\n(line   65)\n* PyFloatPack2 (C function):            Pack functions.     (line   22)\n* PyFloatPack4 (C function):            Pack functions.     (line   26)\n* PyFloatPack8 (C function):            Pack functions.     (line   30)\n* PyFloatType (C var):                  Floating Point Objects.\n(line   11)\n* PyFloatUnpack2 (C function):          Unpack functions.   (line   20)\n* PyFloatUnpack4 (C function):          Unpack functions.   (line   24)\n* PyFloatUnpack8 (C function):          Unpack functions.   (line   28)\n* PyFloatObject (C type):                Floating Point Objects.\n(line    6)\n* PyFrameCheck (C function):            Frame Objects.      (line   29)\n* PyFrameGetBack (C function):          Frame Objects.      (line   36)\n* PyFrameGetBuiltins (C function):      Frame Objects.      (line   46)\n* PyFrameGetCode (C function):          Frame Objects.      (line   55)\n* PyFrameGetGenerator (C function):     Frame Objects.      (line   66)\n* PyFrameGetGlobals (C function):       Frame Objects.      (line   77)\n* PyFrameGetLasti (C function):         Frame Objects.      (line   86)\n* PyFrameGetLineNumber (C function):    Frame Objects.      (line  129)\n* PyFrameGetLocals (C function):        Frame Objects.      (line  119)\n* PyFrameGetVar (C function):           Frame Objects.      (line   94)\n* PyFrameGetVarString (C function):     Frame Objects.      (line  111)\n* PyFrameType (C var):                  Frame Objects.      (line   21)\n* PyFrameObject (C type):                Frame Objects.      (line    6)\n* PyFrozenSetCheck (C function):        Set Objects.        (line   49)\n* PyFrozenSetCheckExact (C function):   Set Objects.        (line   73)\n* PyFrozenSetNew (C function):          Set Objects.        (line   86)\n* PyFrozenSetType (C var):              Set Objects.        (line   35)\n* PyFunctionAddWatcher (C function):    Function Objects<3>.\n(line  115)\n* PyFunctionCheck (C function):         Function Objects<3>.\n(line   18)\n* PyFunctionClearWatcher (C function):  Function Objects<3>.\n(line  125)\n* PyFunctionGetAnnotations (C function): Function Objects<3>.\n(line  102)\n* PyFunctionGetClosure (C function):    Function Objects<3>.\n(line   88)\n* PyFunctionGetCode (C function):       Function Objects<3>.\n(line   46)\n* PyFunctionGetDefaults (C function):   Function Objects<3>.\n(line   64)\n* PyFunctionGetGlobals (C function):    Function Objects<3>.\n(line   50)\n* PyFunctionGetModule (C function):     Function Objects<3>.\n(line   55)\n* PyFunctionNew (C function):           Function Objects<3>.\n(line   24)\n* PyFunctionNewWithQualName (C function): Function Objects<3>.\n(line   36)\n* PyFunctionSetAnnotations (C function): Function Objects<3>.\n(line  107)\n* PyFunctionSetClosure (C function):    Function Objects<3>.\n(line   94)\n* PyFunctionSetDefaults (C function):   Function Objects<3>.\n(line   70)\n* PyFunctionSetVectorcall (C function): Function Objects<3>.\n(line   78)\n* PyFunctionType (C var):               Function Objects<3>.\n(line   12)\n* PyFunctionWatchCallback (C type):     Function Objects<3>.\n(line  143)\n* PyFunctionWatchEvent (C type):        Function Objects<3>.\n(line  134)\n* PyFunctionObject (C type):             Function Objects<3>.\n(line    8)\n* PYFUNCTYPE() (in module ctypes):       Function prototypes.\n(line   33)\n* PyGCCollect (C function):             Controlling the Garbage Collector State.\n(line    9)\n* PyGCDisable (C function):             Controlling the Garbage Collector State.\n(line   27)\n* PyGCEnable (C function):              Controlling the Garbage Collector State.\n(line   20)\n* PyGCIsEnabled (C function):           Controlling the Garbage Collector State.\n(line   34)\n* PyGenCheck (C function):              Generator Objects.  (line   19)\n* PyGenCheckExact (C function):         Generator Objects.  (line   24)\n* PyGenNew (C function):                Generator Objects.  (line   29)\n* PyGenNewWithQualName (C function):    Generator Objects.  (line   34)\n* PyGenType (C var):                    Generator Objects.  (line   15)\n* PyGenObject (C type):                  Generator Objects.  (line   11)\n* PyGetSetDef (C type):                  Defining Getters and Setters.\n(line    6)\n* PyGetSetDef.closure (C member):        Defining Getters and Setters.\n(line   28)\n* PyGetSetDef.doc (C member):            Defining Getters and Setters.\n(line   24)\n* PyGetSetDef.get (C member):            Defining Getters and Setters.\n(line   15)\n* PyGetSetDef.name (C member):           Defining Getters and Setters.\n(line   11)\n* PyGetSetDef.set (C member):            Defining Getters and Setters.\n(line   19)\n* PyGILStateCheck (C function):         High-level API.     (line  147)\n* PyGILStateEnsure (C function):        High-level API.     (line   97)\n* PyGILStateGetThisThreadState (C function): High-level API.\n(line  138)\n* PyGILStateRelease (C function):       High-level API.     (line  128)\n* PyHashFuncDef (C type):               PyHash API.         (line   20)\n* PyHashFuncDef.hashbits (C member):   PyHash API.         (line   28)\n* PyHashFuncDef.name (C member):        PyHash API.         (line   24)\n* PyHashFuncDef.seedbits (C member):   PyHash API.         (line   32)\n* PyHashGetFuncDef (C function):        PyHash API.         (line   38)\n* PyImportAddModule (C function):       Importing Modules<2>.\n(line  105)\n* PyImportAddModuleObject (C function): Importing Modules<2>.\n(line   87)\n* PyImportAppendInittab (C function):   Importing Modules<2>.\n(line  280)\n* PyImportExecCodeModule (C function):  Importing Modules<2>.\n(line  111)\n* PyImportExecCodeModuleEx (C function): Importing Modules<2>.\n(line  151)\n* PyImportExecCodeModuleObject (C function): Importing Modules<2>.\n(line  160)\n* PyImportExecCodeModuleWithPathnames (C function): Importing Modules<2>.\n(line  174)\n* PyImportExtendInittab (C function):   Importing Modules<2>.\n(line  307)\n* PyImportFrozenModules (C var):        Importing Modules<2>.\n(line  272)\n* PyImportGetImporter (C function):     Importing Modules<2>.\n(line  222)\n* PyImportGetMagicNumber (C function):  Importing Modules<2>.\n(line  190)\n* PyImportGetMagicTag (C function):     Importing Modules<2>.\n(line  198)\n* PyImportGetModule (C function):       Importing Modules<2>.\n(line  212)\n* PyImportGetModuleDict (C function):   Importing Modules<2>.\n(line  206)\n* PyImportImport (C function):          Importing Modules<2>.\n(line   69)\n* PyImportImportFrozenModule (C function): Importing Modules<2>.\n(line  249)\n* PyImportImportFrozenModuleObject (C function): Importing Modules<2>.\n(line  235)\n* PyImportImportModule (C function):    Importing Modules<2>.\n(line    6)\n* PyImportImportModuleEx (C function):  Importing Modules<2>.\n(line   25)\n* PyImportImportModuleLevel (C function): Importing Modules<2>.\n(line   59)\n* PyImportImportModuleLevelObject (C function): Importing Modules<2>.\n(line   42)\n* PyImportImportModuleNoBlock (C function): Importing Modules<2>.\n(line   14)\n* PyImportReloadModule (C function):    Importing Modules<2>.\n(line   80)\n* PyIndexCheck (C function):            Number Protocol.    (line  306)\n* PyInitmodulename (C function):        Building C and C++ Extensions.\n(line   16)\n* PyInstanceMethodCheck (C function):   Instance Method Objects.\n(line   15)\n* PyInstanceMethodFunction (C function): Instance Method Objects.\n(line   27)\n* PyInstanceMethodGETFUNCTION (C function): Instance Method Objects.\n(line   32)\n* PyInstanceMethodNew (C function):     Instance Method Objects.\n(line   21)\n* PyInstanceMethodType (C var):         Instance Method Objects.\n(line   10)\n* PyInterpreterConfig (C type):          Sub-interpreter support.\n(line   24)\n* PyInterpreterConfigDEFAULTGIL (C macro): Sub-interpreter support.\n(line   93)\n* PyInterpreterConfigOWNGIL (C macro): Sub-interpreter support.\n(line  102)\n* PyInterpreterConfigSHAREDGIL (C macro): Sub-interpreter support.\n(line   98)\n* PyInterpreterConfig.allowdaemonthreads (C member): Sub-interpreter support.\n(line   69)\n* PyInterpreterConfig.allowexec (C member): Sub-interpreter support.\n(line   54)\n* PyInterpreterConfig.allowfork (C member): Sub-interpreter support.\n(line   45)\n* PyInterpreterConfig.allowthreads (C member): Sub-interpreter support.\n(line   64)\n* PyInterpreterConfig.checkmultiinterpextensions (C member): Sub-interpreter support.\n(line   76)\n* PyInterpreterConfig.gil (C member):    Sub-interpreter support.\n(line   88)\n* PyInterpreterConfig.usemainobmalloc (C member): Sub-interpreter support.\n(line   35)\n* PyInterpreterState (C type):           High-level API.     (line    9)\n* PyInterpreterStateClear (C function): Low-level API.      (line   21)\n* PyInterpreterStateDelete (C function): Low-level API.     (line   30)\n* PyInterpreterStateGet (C function):   Low-level API.      (line  115)\n* PyInterpreterStateGetDict (C function): Low-level API.    (line  137)\n* PyInterpreterStateGetID (C function): Low-level API.      (line  127)\n* PyInterpreterStateHead (C function):  Advanced Debugger Support.\n(line    9)\n* PyInterpreterStateMain (C function):  Advanced Debugger Support.\n(line   15)\n* PyInterpreterStateNew (C function):   Low-level API.      (line   12)\n* PyInterpreterStateNext (C function):  Advanced Debugger Support.\n(line   20)\n* PyInterpreterStateThreadHead (C function): Advanced Debugger Support.\n(line   26)\n* PyIterCheck (C function):             Iterator Protocol.  (line    8)\n* PyIterNext (C function):              Iterator Protocol.  (line   21)\n* PyIterSend (C function):              Iterator Protocol.  (line   62)\n* PYLAUNCHERALLOWINSTALL:              Windows.            (line   31)\n* PYLAUNCHERALLOWINSTALL <1>:          Windows<18>.        (line   14)\n* PYLAUNCHERALLOWINSTALL <2>:          Install on demand.  (line    6)\n* PYLAUNCHERALWAYSINSTALL:             Install on demand.  (line   12)\n* PYLAUNCHERDEBUG:                      Diagnostics.        (line    6)\n* PYLAUNCHERDRYRUN:                     Dry Run.            (line    6)\n* PYLAUNCHERDRYRUN <1>:                 Install on demand.  (line   14)\n* PYLAUNCHERNOSEARCHPATH:             Shebang Lines.      (line   58)\n* PyListAppend (C function):            List Objects.       (line   91)\n* PyListAsTuple (C function):           List Objects.       (line  124)\n* PyListCheck (C function):             List Objects.       (line   16)\n* PyListCheckExact (C function):        List Objects.       (line   21)\n* PyListGETITEM (C function):          List Objects.       (line   56)\n* PyListGETSIZE (C function):          List Objects.       (line   43)\n* PyListGetItem (C function):           Reference Count Details.\n(line  117)\n* PyListGetItem (C function) <1>:       List Objects.       (line   47)\n* PyListGetSlice (C function):          List Objects.       (line   97)\n* PyListInsert (C function):            List Objects.       (line   84)\n* PyListNew (C function):               List Objects.       (line   26)\n* PyListReverse (C function):           List Objects.       (line  119)\n* PyListSETITEM (C function):          List Objects.       (line   72)\n* PyListSetItem (C function):           Reference Count Details.\n(line   26)\n* PyListSetItem (C function) <1>:       List Objects.       (line   61)\n* PyListSetSlice (C function):          List Objects.       (line  105)\n* PyListSize (C function):              List Objects.       (line   37)\n* PyListSort (C function):              List Objects.       (line  114)\n* PyListType (C var):                   List Objects.       (line   11)\n* PyListObject (C type):                 List Objects.       (line    6)\n* PyLongAsDouble (C function):          Integer Objects.    (line  280)\n* PyLongAsLong (C function):            Integer Objects.    (line  112)\n* PyLongAsLongAndOverflow (C function): Integer Objects.    (line  131)\n* PyLongAsLongLong (C function):        Integer Objects.    (line  151)\n* PyLongAsLongLongAndOverflow (C function): Integer Objects.\n(line  170)\n* PyLongAsSizet (C function):          Integer Objects.    (line  217)\n* PyLongAsSsizet (C function):         Integer Objects.    (line  192)\n* PyLongAsUnsignedLong (C function):    Integer Objects.    (line  205)\n* PyLongAsUnsignedLongLong (C function): Integer Objects.   (line  229)\n* PyLongAsUnsignedLongLongMask (C function): Integer Objects.\n(line  262)\n* PyLongAsUnsignedLongMask (C function): Integer Objects.   (line  245)\n* PyLongAsVoidPtr (C function):         Integer Objects.    (line  291)\n* PyLongCheck (C function):             Integer Objects.    (line   22)\n* PyLongCheckExact (C function):        Integer Objects.    (line   27)\n* PyLongFromDouble (C function):        Integer Objects.    (line   69)\n* PyLongFromLong (C function):          Integer Objects.    (line   32)\n* PyLongFromLongLong (C function):      Integer Objects.    (line   58)\n* PyLongFromSizet (C function):        Integer Objects.    (line   53)\n* PyLongFromSsizet (C function):       Integer Objects.    (line   48)\n* PyLongFromString (C function):        Integer Objects.    (line   74)\n* PyLongFromUnicodeObject (C function): Integer Objects.    (line   99)\n* PyLongFromUnsignedLong (C function):  Integer Objects.    (line   42)\n* PyLongFromUnsignedLongLong (C function): Integer Objects. (line   63)\n* PyLongFromVoidPtr (C function):       Integer Objects.    (line  106)\n* PyLongType (C var):                   Integer Objects.    (line   17)\n* PyLongObject (C type):                 Integer Objects.    (line   13)\n* PyMappingCheck (C function):          Mapping Protocol.   (line    9)\n* PyMappingDelItem (C function):        Mapping Protocol.   (line   37)\n* PyMappingDelItemString (C function):  Mapping Protocol.   (line   41)\n* PyMappingGetItemString (C function):  Mapping Protocol.   (line   24)\n* PyMappingHasKey (C function):         Mapping Protocol.   (line   48)\n* PyMappingHasKeyString (C function):   Mapping Protocol.   (line   57)\n* PyMappingItems (C function):          Mapping Protocol.   (line   84)\n* PyMappingKeys (C function):           Mapping Protocol.   (line   68)\n* PyMappingLength (C function):         Mapping Protocol.   (line   17)\n* PyMappingSetItemString (C function):  Mapping Protocol.   (line   31)\n* PyMappingSize (C function):           Mapping Protocol.   (line   17)\n* PyMappingValues (C function):         Mapping Protocol.   (line   76)\n* PyMappingMethods (C type):             Mapping Object Structures.\n(line    6)\n* PyMappingMethods.mpasssubscript (C member): Mapping Object Structures.\n(line   27)\n* PyMappingMethods.mplength (C member): Mapping Object Structures.\n(line   11)\n* PyMappingMethods.mpsubscript (C member): Mapping Object Structures.\n(line   18)\n* PyMarshalReadLastObjectFromFile (C function): Data marshalling support.\n(line   74)\n* PyMarshalReadLongFromFile (C function): Data marshalling support.\n(line   47)\n* PyMarshalReadObjectFromFile (C function): Data marshalling support.\n(line   65)\n* PyMarshalReadObjectFromString (C function): Data marshalling support.\n(line   90)\n* PyMarshalReadShortFromFile (C function): Data marshalling support.\n(line   56)\n* PyMarshalWriteLongToFile (C function): Data marshalling support.\n(line   20)\n* PyMarshalWriteObjectToFile (C function): Data marshalling support.\n(line   30)\n* PyMarshalWriteObjectToString (C function): Data marshalling support.\n(line   39)\n* PyMemCalloc (C function):             Memory Interface.   (line   28)\n* PyMemDel (C function):                Memory Interface.   (line   84)\n* PYMEMDOMAINMEM (C macro):            Customize Memory Allocators.\n(line   52)\n* PYMEMDOMAINOBJ (C macro):            Customize Memory Allocators.\n(line   64)\n* PYMEMDOMAINRAW (C macro):            Customize Memory Allocators.\n(line   40)\n* PyMemFree (C function):               Memory Interface.   (line   56)\n* PyMemGetAllocator (C function):       Customize Memory Allocators.\n(line   76)\n* PyMemMalloc (C function):             Memory Interface.   (line   19)\n* PyMemNew (C macro):                   Memory Interface.   (line   68)\n* PyMemRawCalloc (C function):          Raw Memory Interface.\n(line   24)\n* PyMemRawFree (C function):            Raw Memory Interface.\n(line   53)\n* PyMemRawMalloc (C function):          Raw Memory Interface.\n(line   15)\n* PyMemRawRealloc (C function):         Raw Memory Interface.\n(line   36)\n* PyMemRealloc (C function):            Memory Interface.   (line   40)\n* PyMemResize (C macro):                Memory Interface.   (line   74)\n* PyMemSetAllocator (C function):       Customize Memory Allocators.\n(line   81)\n* PyMemSetupDebugHooks (C function):    Customize Memory Allocators.\n(line  124)\n* PyMemAllocatorDomain (C type):         Customize Memory Allocators.\n(line   36)\n* PyMemAllocatorEx (C type):             Customize Memory Allocators.\n(line    8)\n* PyMemberGetOne (C function):          Accessing attributes of extension types.\n(line   71)\n* PyMemberSetOne (C function):          Accessing attributes of extension types.\n(line   80)\n* PyMemberDef (C type):                  Accessing attributes of extension types.\n(line    6)\n* PyMemberDef.doc (C member):            Accessing attributes of extension types.\n(line   36)\n* PyMemberDef.flags (C member):          Accessing attributes of extension types.\n(line   31)\n* PyMemberDef.name (C member):           Accessing attributes of extension types.\n(line   14)\n* PyMemberDef.offset (C member):         Accessing attributes of extension types.\n(line   26)\n* PyMemberDef.type (C member):           Accessing attributes of extension types.\n(line   21)\n* PyMemoryViewCheck (C function):       MemoryView objects. (line   54)\n* PyMemoryViewFromBuffer (C function):  MemoryView objects. (line   35)\n* PyMemoryViewFromMemory (C function):  MemoryView objects. (line   26)\n* PyMemoryViewFromObject (C function):  MemoryView objects. (line   10)\n* PyMemoryViewGETBASE (C function):    MemoryView objects. (line   68)\n* PyMemoryViewGETBUFFER (C function):  MemoryView objects. (line   60)\n* PyMemoryViewGetContiguous (C function): MemoryView objects.\n(line   42)\n* PyMethodCheck (C function):           Method Objects<2>.  (line   16)\n* PyMethodFunction (C function):        Method Objects<2>.  (line   29)\n* PyMethodGETFUNCTION (C function):    Method Objects<2>.  (line   33)\n* PyMethodGETSELF (C function):        Method Objects<2>.  (line   42)\n* PyMethodNew (C function):             Method Objects<2>.  (line   22)\n* PyMethodSelf (C function):            Method Objects<2>.  (line   38)\n* PyMethodType (C var):                 Method Objects<2>.  (line   10)\n* PyMethodDef (C type):                  Implementing functions and methods.\n(line   63)\n* PyMethodDef.mldoc (C member):         Implementing functions and methods.\n(line   80)\n* PyMethodDef.mlflags (C member):       Implementing functions and methods.\n(line   76)\n* PyMethodDef.mlmeth (C member):        Implementing functions and methods.\n(line   72)\n* PyMethodDef.mlname (C member):        Implementing functions and methods.\n(line   68)\n* PyMODINITFUNC (C macro):              Useful macros.      (line   11)\n* PyModuleAddFunctions (C function):    Low-level module creation functions.\n(line   51)\n* PyModuleAddIntConstant (C function):  Support functions.  (line  108)\n* PyModuleAddIntMacro (C macro):        Support functions.  (line  122)\n* PyModuleAddObject (C function):       Support functions.  (line   54)\n* PyModuleAddObjectRef (C function):    Support functions.  (line   11)\n* PyModuleAddStringConstant (C function): Support functions.\n(line  115)\n* PyModuleAddStringMacro (C macro):     Support functions.  (line  129)\n* PyModuleAddType (C function):         Support functions.  (line  133)\n* PyModuleCheck (C function):           Module Objects.     (line   13)\n* PyModuleCheckExact (C function):      Module Objects.     (line   18)\n* PyModuleCreate (C function):          Single-phase initialization.\n(line   10)\n* PyModuleCreate2 (C function):         Single-phase initialization.\n(line   16)\n* PyModuleExecDef (C function):         Low-level module creation functions.\n(line   35)\n* PyModuleFromDefAndSpec (C function):  Low-level module creation functions.\n(line   11)\n* PyModuleFromDefAndSpec2 (C function): Low-level module creation functions.\n(line   20)\n* PyModuleGetDef (C function):          Module Objects.     (line   81)\n* PyModuleGetDict (C function):         Module Objects.     (line   44)\n* PyModuleGetFilename (C function):     Module Objects.     (line  100)\n* PyModuleGetFilenameObject (C function): Module Objects.   (line   87)\n* PyModuleGetName (C function):         Module Objects.     (line   70)\n* PyModuleGetNameObject (C function):   Module Objects.     (line   59)\n* PyModuleGetState (C function):        Module Objects.     (line   75)\n* PyModuleNew (C function):             Module Objects.     (line   39)\n* PyModuleNewObject (C function):       Module Objects.     (line   23)\n* PyModuleSetDocString (C function):    Low-level module creation functions.\n(line   42)\n* PyModuleType (C var):                 Module Objects.     (line    6)\n* PyModuleDef (C type):                  Initializing C modules.\n(line   17)\n* PyModuleDefInit (C function):         Multi-phase initialization.\n(line   33)\n* PyModuleDefSlot (C type):             Multi-phase initialization.\n(line   47)\n* PyModuleDefSlot.slot (C member):      Multi-phase initialization.\n(line   49)\n* PyModuleDefSlot.value (C member):     Multi-phase initialization.\n(line   53)\n* PyModuleDef.mbase (C member):         Initializing C modules.\n(line   23)\n* PyModuleDef.mclear (C member):        Initializing C modules.\n(line   91)\n* PyModuleDef.mdoc (C member):          Initializing C modules.\n(line   31)\n* PyModuleDef.mfree (C member):         Initializing C modules.\n(line  113)\n* PyModuleDef.mmethods (C member):      Initializing C modules.\n(line   58)\n* PyModuleDef.mname (C member):         Initializing C modules.\n(line   27)\n* PyModuleDef.msize (C member):         Initializing C modules.\n(line   36)\n* PyModuleDef.mslots (C member):        Initializing C modules.\n(line   64)\n* PyModuleDef.mslots.mreload (C member): Initializing C modules.\n(line   73)\n* PyModuleDef.mtraverse (C member):     Initializing C modules.\n(line   75)\n* PyNumberAbsolute (C function):        Number Protocol.    (line   98)\n* PyNumberAdd (C function):             Number Protocol.    (line   13)\n* PyNumberAnd (C function):             Number Protocol.    (line  124)\n* PyNumberAsSsizet (C function):       Number Protocol.    (line  291)\n* PyNumberCheck (C function):           Number Protocol.    (line    6)\n* PyNumberDivmod (C function):          Number Protocol.    (line   68)\n* PyNumberFloat (C function):           Number Protocol.    (line  264)\n* PyNumberFloorDivide (C function):     Number Protocol.    (line   43)\n* PyNumberIndex (C function):           Number Protocol.    (line  272)\n* PyNumberInPlaceAdd (C function):      Number Protocol.    (line  145)\n* PyNumberInPlaceAnd (C function):      Number Protocol.    (line  232)\n* PyNumberInPlaceFloorDivide (C function): Number Protocol. (line  176)\n* PyNumberInPlaceLshift (C function):   Number Protocol.    (line  216)\n* PyNumberInPlaceMatrixMultiply (C function): Number Protocol.\n(line  166)\n* PyNumberInPlaceMultiply (C function): Number Protocol.    (line  159)\n* PyNumberInPlaceOr (C function):       Number Protocol.    (line  248)\n* PyNumberInPlacePower (C function):    Number Protocol.    (line  203)\n* PyNumberInPlaceRemainder (C function): Number Protocol.   (line  196)\n* PyNumberInPlaceRshift (C function):   Number Protocol.    (line  224)\n* PyNumberInPlaceSubtract (C function): Number Protocol.    (line  152)\n* PyNumberInPlaceTrueDivide (C function): Number Protocol.  (line  184)\n* PyNumberInPlaceXor (C function):      Number Protocol.    (line  240)\n* PyNumberInvert (C function):          Number Protocol.    (line  105)\n* PyNumberLong (C function):            Number Protocol.    (line  256)\n* PyNumberLshift (C function):          Number Protocol.    (line  110)\n* PyNumberMatrixMultiply (C function):  Number Protocol.    (line   34)\n* PyNumberMultiply (C function):        Number Protocol.    (line   27)\n* PyNumberNegative (C function):        Number Protocol.    (line   88)\n* PyNumberOr (C function):              Number Protocol.    (line  138)\n* PyNumberPositive (C function):        Number Protocol.    (line   93)\n* PyNumberPower (C function):           Number Protocol.    (line   77)\n* PyNumberRemainder (C function):       Number Protocol.    (line   61)\n* PyNumberRshift (C function):          Number Protocol.    (line  117)\n* PyNumberSubtract (C function):        Number Protocol.    (line   20)\n* PyNumberToBase (C function):          Number Protocol.    (line  281)\n* PyNumberTrueDivide (C function):      Number Protocol.    (line   50)\n* PyNumberXor (C function):             Number Protocol.    (line  131)\n* PyNumberMethods (C type):              Number Object Structures.\n(line    6)\n* PyNumberMethods.nbabsolute (C member): Number Object Structures.\n(line   93)\n* PyNumberMethods.nbadd (C member):     Number Object Structures.\n(line   70)\n* PyNumberMethods.nband (C member):     Number Object Structures.\n(line  107)\n* PyNumberMethods.nbbool (C member):    Number Object Structures.\n(line   96)\n* PyNumberMethods.nbdivmod (C member):  Number Object Structures.\n(line   81)\n* PyNumberMethods.nbfloat (C member):   Number Object Structures.\n(line  117)\n* PyNumberMethods.nbfloordivide (C member): Number Object Structures.\n(line  150)\n* PyNumberMethods.nbindex (C member):   Number Object Structures.\n(line  162)\n* PyNumberMethods.nbinplaceadd (C member): Number Object Structures.\n(line  120)\n* PyNumberMethods.nbinplaceand (C member): Number Object Structures.\n(line  141)\n* PyNumberMethods.nbinplacefloordivide (C member): Number Object Structures.\n(line  156)\n* PyNumberMethods.nbinplacelshift (C member): Number Object Structures.\n(line  135)\n* PyNumberMethods.nbinplacematrixmultiply (C member): Number Object Structures.\n(line  168)\n* PyNumberMethods.nbinplacemultiply (C member): Number Object Structures.\n(line  126)\n* PyNumberMethods.nbinplaceor (C member): Number Object Structures.\n(line  147)\n* PyNumberMethods.nbinplacepower (C member): Number Object Structures.\n(line  132)\n* PyNumberMethods.nbinplaceremainder (C member): Number Object Structures.\n(line  129)\n* PyNumberMethods.nbinplacershift (C member): Number Object Structures.\n(line  138)\n* PyNumberMethods.nbinplacesubtract (C member): Number Object Structures.\n(line  123)\n* PyNumberMethods.nbinplacetruedivide (C member): Number Object Structures.\n(line  159)\n* PyNumberMethods.nbinplacexor (C member): Number Object Structures.\n(line  144)\n* PyNumberMethods.nbint (C member):     Number Object Structures.\n(line  113)\n* PyNumberMethods.nbinvert (C member):  Number Object Structures.\n(line   98)\n* PyNumberMethods.nblshift (C member):  Number Object Structures.\n(line  101)\n* PyNumberMethods.nbmatrixmultiply (C member): Number Object Structures.\n(line  165)\n* PyNumberMethods.nbmultiply (C member): Number Object Structures.\n(line   75)\n* PyNumberMethods.nbnegative (C member): Number Object Structures.\n(line   87)\n* PyNumberMethods.nbor (C member):      Number Object Structures.\n(line  111)\n* PyNumberMethods.nbpositive (C member): Number Object Structures.\n(line   90)\n* PyNumberMethods.nbpower (C member):   Number Object Structures.\n(line   84)\n* PyNumberMethods.nbremainder (C member): Number Object Structures.\n(line   78)\n* PyNumberMethods.nbreserved (C member): Number Object Structures.\n(line  115)\n* PyNumberMethods.nbrshift (C member):  Number Object Structures.\n(line  104)\n* PyNumberMethods.nbsubtract (C member): Number Object Structures.\n(line   72)\n* PyNumberMethods.nbtruedivide (C member): Number Object Structures.\n(line  153)\n* PyNumberMethods.nbxor (C member):     Number Object Structures.\n(line  109)\n* PyObject (C type):                     Base object types and macros.\n(line   14)\n* PyObjectAsCharBuffer (C function):    Old Buffer Protocol.\n(line   21)\n* PyObjectASCII (C function):           Object Protocol.    (line  209)\n* PyObjectAsFileDescriptor (C function): File Objects.      (line   33)\n* PyObjectAsReadBuffer (C function):    Old Buffer Protocol.\n(line   30)\n* PyObjectAsWriteBuffer (C function):   Old Buffer Protocol.\n(line   49)\n* PyObjectBytes (C function):           Object Protocol.    (line  232)\n* PyObjectCall (C function):            Object Calling API. (line   57)\n* PyObjectCallFunction (C function):    Object Calling API. (line  108)\n* PyObjectCallFunctionObjArgs (C function): Object Calling API.\n(line  149)\n* PyObjectCallMethod (C function):      Object Calling API. (line  127)\n* PyObjectCallMethodNoArgs (C function): Object Calling API.\n(line  174)\n* PyObjectCallMethodObjArgs (C function): Object Calling API.\n(line  162)\n* PyObjectCallMethodOneArg (C function): Object Calling API.\n(line  186)\n* PyObjectCallNoArgs (C function):      Object Calling API. (line   73)\n* PyObjectCallObject (C function):      Calling Python Functions from C.\n(line   64)\n* PyObjectCallObject (C function) <1>:  Object Calling API. (line   96)\n* PyObjectCalloc (C function):          Object allocators.  (line   30)\n* PyObjectCallOneArg (C function):      Object Calling API. (line   85)\n* PyObjectCheckBuffer (C function):     Buffer-related functions.\n(line    6)\n* PyObjectCheckReadBuffer (C function): Old Buffer Protocol.\n(line   39)\n* PyObjectClearWeakRefs (C function):   Weak Reference Objects<2>.\n(line   71)\n* PyObjectCopyData (C function):        Buffer-related functions.\n(line   80)\n* PyObjectDel (C function):             Allocating Objects on the Heap.\n(line   51)\n* PyObjectDelAttr (C function):         Object Protocol.    (line  116)\n* PyObjectDelAttrString (C function):   Object Protocol.    (line  122)\n* PyObjectDelItem (C function):         Object Protocol.    (line  365)\n* PyObjectDir (C function):             Object Protocol.    (line  370)\n* PyObjectFormat (C function):          Object Protocol.    (line  186)\n* PyObjectFree (C function):            Object allocators.  (line   58)\n* PyObjectGCDel (C function):          Supporting Cyclic Garbage Collection.\n(line  133)\n* PyObjectGCIsFinalized (C function):  Supporting Cyclic Garbage Collection.\n(line  123)\n* PyObjectGCIsTracked (C function):    Supporting Cyclic Garbage Collection.\n(line  113)\n* PyObjectGCNew (C macro):             Supporting Cyclic Garbage Collection.\n(line   56)\n* PyObjectGCNewVar (C macro):          Supporting Cyclic Garbage Collection.\n(line   61)\n* PyObjectGCResize (C macro):          Supporting Cyclic Garbage Collection.\n(line   87)\n* PyObjectGCTrack (C function):        Supporting Cyclic Garbage Collection.\n(line   97)\n* PyObjectGCUnTrack (C function):      Supporting Cyclic Garbage Collection.\n(line  138)\n* PyObjectGenericGetAttr (C function):  Object Protocol.    (line   70)\n* PyObjectGenericGetDict (C function):  Object Protocol.    (line  129)\n* PyObjectGenericSetAttr (C function):  Object Protocol.    (line  104)\n* PyObjectGenericSetDict (C function):  Object Protocol.    (line  145)\n* PyObjectGetAIter (C function):        Object Protocol.    (line  388)\n* PyObjectGetArenaAllocator (C function): Customize pymalloc Arena Allocator.\n(line   26)\n* PyObjectGetAttr (C function):         Object Protocol.    (line   56)\n* PyObjectGetAttrString (C function):   Object Protocol.    (line   63)\n* PyObjectGetBuffer (C function):       Buffer-related functions.\n(line   12)\n* PyObjectGetItem (C function):         Object Protocol.    (line  351)\n* PyObjectGetItemData (C function):     Object Protocol.    (line  429)\n* PyObjectGetIter (C function):         Object Protocol.    (line  380)\n* PyObjectGetTypeData (C function):     Object Protocol.    (line  399)\n* PyObjectHasAttr (C function):         Object Protocol.    (line   32)\n* PyObjectHasAttrString (C function):   Object Protocol.    (line   43)\n* PyObjectHash (C function):            Object Protocol.    (line  283)\n* PyObjectHashNotImplemented (C function): Object Protocol. (line  293)\n* PyObjectHEAD (C macro):               Base object types and macros.\n(line   35)\n* PyObjectHEADINIT (C macro):          Base object types and macros.\n(line  123)\n* PyObjectInit (C function):            Allocating Objects on the Heap.\n(line   13)\n* PyObjectInitVar (C function):         Allocating Objects on the Heap.\n(line   22)\n* PyObjectISGC (C function):           Supporting Cyclic Garbage Collection.\n(line  105)\n* PyObjectIsInstance (C function):      Object Protocol.    (line  262)\n* PyObjectIsSubclass (C function):      Object Protocol.    (line  242)\n* PyObjectIsTrue (C function):          Object Protocol.    (line  301)\n* PyObjectLength (C function):          Object Protocol.    (line  331)\n* PyObjectLengthHint (C function):      Object Protocol.    (line  340)\n* PyObjectMalloc (C function):          Object allocators.  (line   21)\n* PyObjectNew (C macro):                Allocating Objects on the Heap.\n(line   28)\n* PyObjectNewVar (C macro):             Allocating Objects on the Heap.\n(line   38)\n* PyObjectNot (C function):             Object Protocol.    (line  307)\n* PyObjectPrint (C function):           Object Protocol.    (line   24)\n* PyObjectRealloc (C function):         Object allocators.  (line   42)\n* PyObjectRepr (C function):            Object Protocol.    (line  196)\n* PyObjectRichCompare (C function):     Object Protocol.    (line  163)\n* PyObjectRichCompareBool (C function): Object Protocol.    (line  175)\n* PyObjectSetArenaAllocator (C function): Customize pymalloc Arena Allocator.\n(line   31)\n* PyObjectSetAttr (C function):         Object Protocol.    (line   82)\n* PyObjectSetAttrString (C function):   Object Protocol.    (line   94)\n* PyObjectSetItem (C function):         Object Protocol.    (line  358)\n* PyObjectSize (C function):            Object Protocol.    (line  331)\n* PyObjectStr (C function):             Object Protocol.    (line  220)\n* PyObjectType (C function):            Object Protocol.    (line  313)\n* PyObjectTypeCheck (C function):       Object Protocol.    (line  326)\n* PyObjectVARHEAD (C macro):           Base object types and macros.\n(line   45)\n* PyObjectVectorcall (C function):      Object Calling API. (line  198)\n* PyObjectVectorcallDict (C function):  Object Calling API. (line  212)\n* PyObjectVectorcallMethod (C function): Object Calling API.\n(line  228)\n* PyObject.obnext (C member):          PyObject Slots.     (line   50)\n* PyObject.obprev (C member):          PyObject Slots.     (line   50)\n* PyObject.obrefcnt (C member):         PyObject Slots.     (line   13)\n* PyObject.obtype (C member):           PyObject Slots.     (line   26)\n* PyObjectArenaAllocator (C type):       Customize pymalloc Arena Allocator.\n(line    8)\n* PyOSAfterFork (C function):           Operating System Utilities.\n(line   79)\n* PyOSAfterForkChild (C function):     Operating System Utilities.\n(line   56)\n* PyOSAfterForkParent (C function):    Operating System Utilities.\n(line   42)\n* PyOSBeforeFork (C function):          Operating System Utilities.\n(line   29)\n* PyOSCheckStack (C function):          Operating System Utilities.\n(line   89)\n* PyOSdoubletostring (C function):    String conversion and formatting.\n(line  118)\n* PyOSFSPath (C function):              Operating System Utilities.\n(line    6)\n* PyOSgetsig (C function):              Operating System Utilities.\n(line  103)\n* PyOSInputHook (C var):                The Very High Level Layer.\n(line  159)\n* PyOSReadlineFunctionPointer (C var):  The Very High Level Layer.\n(line  171)\n* PyOSsetsig (C function):              Operating System Utilities.\n(line  108)\n* PyOSsighandlert (C type):            Operating System Utilities.\n(line  100)\n* PyOSsnprintf (C function):            String conversion and formatting.\n(line    8)\n* PyOSstricmp (C function):             String conversion and formatting.\n(line  152)\n* PyOSstringtodouble (C function):    String conversion and formatting.\n(line   85)\n* PyOSstrnicmp (C function):            String conversion and formatting.\n(line  157)\n* PyOSstrtol (C function):              String conversion and formatting.\n(line   72)\n* PyOSstrtoul (C function):             String conversion and formatting.\n(line   50)\n* PyOSvsnprintf (C function):           String conversion and formatting.\n(line   14)\n* PyPreConfig (C type):                  PyPreConfig.        (line    6)\n* PyPreConfigInitIsolatedConfig (C function): PyPreConfig.  (line   18)\n* PyPreConfigInitPythonConfig (C function): PyPreConfig.    (line   12)\n* PyPreConfig.allocator (C member):      PyPreConfig.        (line   26)\n* PyPreConfig.coerceclocale (C member): PyPreConfig.       (line   71)\n* PyPreConfig.coerceclocalewarn (C member): PyPreConfig.  (line   82)\n* PyPreConfig.configurelocale (C member): PyPreConfig.      (line   60)\n* PyPreConfig.devmode (C member):       PyPreConfig.        (line   88)\n* PyPreConfig.isolated (C member):       PyPreConfig.        (line   95)\n* PyPreConfig.legacywindowsfsencoding (C member): PyPreConfig.\n(line  101)\n* PyPreConfig.parseargv (C member):     PyPreConfig.        (line  120)\n* PyPreConfig.useenvironment (C member): PyPreConfig.       (line  129)\n* PyPreConfig.utf8mode (C member):      PyPreConfig.        (line  136)\n* PyPropertyType (C var):               Descriptor Objects. (line    9)\n* PyRunAnyFile (C function):            The Very High Level Layer.\n(line   47)\n* PyRunAnyFileEx (C function):          The Very High Level Layer.\n(line   59)\n* PyRunAnyFileExFlags (C function):     The Very High Level Layer.\n(line   65)\n* PyRunAnyFileFlags (C function):       The Very High Level Layer.\n(line   53)\n* PyRunFile (C function):               The Very High Level Layer.\n(line  214)\n* PyRunFileEx (C function):             The Very High Level Layer.\n(line  220)\n* PyRunFileExFlags (C function):        The Very High Level Layer.\n(line  234)\n* PyRunFileFlags (C function):          The Very High Level Layer.\n(line  227)\n* PyRunInteractiveLoop (C function):    The Very High Level Layer.\n(line  143)\n* PyRunInteractiveLoopFlags (C function): The Very High Level Layer.\n(line  150)\n* PyRunInteractiveOne (C function):     The Very High Level Layer.\n(line  122)\n* PyRunInteractiveOneFlags (C function): The Very High Level Layer.\n(line  129)\n* PyRunSimpleFile (C function):         The Very High Level Layer.\n(line   97)\n* PyRunSimpleFileEx (C function):       The Very High Level Layer.\n(line  103)\n* PyRunSimpleFileExFlags (C function):  The Very High Level Layer.\n(line  109)\n* PyRunSimpleString (C function):       The Very High Level Layer.\n(line   77)\n* PyRunSimpleStringFlags (C function):  The Very High Level Layer.\n(line   83)\n* PyRunString (C function):             The Very High Level Layer.\n(line  195)\n* PyRunStringFlags (C function):        The Very High Level Layer.\n(line  201)\n* PySendResult (C type):                 Iterator Protocol.  (line   55)\n* PySeqIterCheck (C function):          Iterator Objects.   (line   18)\n* PySeqIterNew (C function):            Iterator Objects.   (line   23)\n* PySeqIterType (C var):                Iterator Objects.   (line   12)\n* PySequenceCheck (C function):         Sequence Protocol.  (line    6)\n* PySequenceConcat (C function):        Sequence Protocol.  (line   21)\n* PySequenceContains (C function):      Sequence Protocol.  (line   99)\n* PySequenceCount (C function):         Sequence Protocol.  (line   92)\n* PySequenceDelItem (C function):       Sequence Protocol.  (line   75)\n* PySequenceDelSlice (C function):      Sequence Protocol.  (line   86)\n* PySequenceFast (C function):          Sequence Protocol.  (line  128)\n* PySequenceFastGETITEM (C function): Sequence Protocol.  (line  152)\n* PySequenceFastGETSIZE (C function): Sequence Protocol.  (line  143)\n* PySequenceFastITEMS (C function):    Sequence Protocol.  (line  158)\n* PySequenceGetItem (C function):       Reference Count Details.\n(line  117)\n* PySequenceGetItem (C function) <1>:   Sequence Protocol.  (line   51)\n* PySequenceGetSlice (C function):      Sequence Protocol.  (line   57)\n* PySequenceIndex (C function):         Sequence Protocol.  (line  105)\n* PySequenceInPlaceConcat (C function): Sequence Protocol.  (line   35)\n* PySequenceInPlaceRepeat (C function): Sequence Protocol.  (line   43)\n* PySequenceITEM (C function):          Sequence Protocol.  (line  169)\n* PySequenceLength (C function):        Sequence Protocol.  (line   14)\n* PySequenceList (C function):          Sequence Protocol.  (line  111)\n* PySequenceRepeat (C function):        Sequence Protocol.  (line   28)\n* PySequenceSetItem (C function):       Sequence Protocol.  (line   64)\n* PySequenceSetSlice (C function):      Sequence Protocol.  (line   80)\n* PySequenceSize (C function):          Sequence Protocol.  (line   14)\n* PySequenceTuple (C function):         Sequence Protocol.  (line  118)\n* PySequenceMethods (C type):            Sequence Object Structures.\n(line    6)\n* PySequenceMethods.sqassitem (C member): Sequence Object Structures.\n(line   50)\n* PySequenceMethods.sqconcat (C member): Sequence Object Structures.\n(line   19)\n* PySequenceMethods.sqcontains (C member): Sequence Object Structures.\n(line   60)\n* PySequenceMethods.sqinplaceconcat (C member): Sequence Object Structures.\n(line   68)\n* PySequenceMethods.sqinplacerepeat (C member): Sequence Object Structures.\n(line   79)\n* PySequenceMethods.sqitem (C member):  Sequence Object Structures.\n(line   34)\n* PySequenceMethods.sqlength (C member): Sequence Object Structures.\n(line   11)\n* PySequenceMethods.sqrepeat (C member): Sequence Object Structures.\n(line   26)\n* PySetAdd (C function):                Set Objects.        (line  119)\n* PySetCheck (C function):              Set Objects.        (line   44)\n* PySetCheckExact (C function):         Set Objects.        (line   60)\n* PySetClear (C function):              Set Objects.        (line  152)\n* PySetContains (C function):           Set Objects.        (line  110)\n* PySetDiscard (C function):            Set Objects.        (line  134)\n* PySetGETSIZE (C function):           Set Objects.        (line  106)\n* PySetNew (C function):                Set Objects.        (line   78)\n* PySetPop (C function):                Set Objects.        (line  144)\n* PySetSize (C function):               Set Objects.        (line   98)\n* PySetType (C var):                    Set Objects.        (line   31)\n* PySetObject (C type):                  Set Objects.        (line   19)\n* PySignalSetWakeupFd (C function):     Signal Handling<2>. (line   67)\n* PySliceAdjustIndices (C function):    Slice Objects.      (line   97)\n* PySliceCheck (C function):            Slice Objects.      (line   11)\n* PySliceGetIndices (C function):       Slice Objects.      (line   26)\n* PySliceGetIndicesEx (C function):     Slice Objects.      (line   42)\n* PySliceNew (C function):              Slice Objects.      (line   16)\n* PySliceType (C var):                  Slice Objects.      (line    6)\n* PySliceUnpack (C function):           Slice Objects.      (line   84)\n* PyStateAddModule (C function):        Module lookup.      (line   25)\n* PyStateFindModule (C function):       Module lookup.      (line   15)\n* PyStateRemoveModule (C function):     Module lookup.      (line   49)\n* PyStatus (C type):                     PyStatus.           (line    6)\n* PyStatusError (C function):           PyStatus.           (line   34)\n* PyStatusException (C function):       PyStatus.           (line   51)\n* PyStatusExit (C function):            PyStatus.           (line   45)\n* PyStatusIsError (C function):         PyStatus.           (line   57)\n* PyStatusIsExit (C function):          PyStatus.           (line   61)\n* PyStatusNoMemory (C function):        PyStatus.           (line   41)\n* PyStatusOk (C function):              PyStatus.           (line   30)\n* PyStatus.errmsg (C member):           PyStatus.           (line   20)\n* PyStatus.exitcode (C member):          PyStatus.           (line   16)\n* PyStatus.func (C member):              PyStatus.           (line   24)\n* PyStructSequenceDesc (C type):        Struct Sequence Objects.\n(line   31)\n* PyStructSequenceDesc.doc (C member):  Struct Sequence Objects.\n(line   39)\n* PyStructSequenceDesc.fields (C member): Struct Sequence Objects.\n(line   43)\n* PyStructSequenceDesc.ninsequence (C member): Struct Sequence Objects.\n(line   48)\n* PyStructSequenceDesc.name (C member): Struct Sequence Objects.\n(line   35)\n* PyStructSequenceField (C type):       Struct Sequence Objects.\n(line   53)\n* PyStructSequenceField.doc (C member): Struct Sequence Objects.\n(line   67)\n* PyStructSequenceField.name (C member): Struct Sequence Objects.\n(line   61)\n* PyStructSequenceGETITEM (C function): Struct Sequence Objects.\n(line   89)\n* PyStructSequenceGetItem (C function): Struct Sequence Objects.\n(line   83)\n* PyStructSequenceInitType (C function): Struct Sequence Objects.\n(line   18)\n* PyStructSequenceInitType2 (C function): Struct Sequence Objects.\n(line   23)\n* PyStructSequenceNew (C function):     Struct Sequence Objects.\n(line   77)\n* PyStructSequenceNewType (C function): Struct Sequence Objects.\n(line   11)\n* PyStructSequenceSETITEM (C function): Struct Sequence Objects.\n(line  103)\n* PyStructSequenceSetItem (C function): Struct Sequence Objects.\n(line   94)\n* PyStructSequenceUnnamedField (C var): Struct Sequence Objects.\n(line   71)\n* PySysAddAuditHook (C function):       System Functions.   (line  154)\n* PySysAddWarnOption (C function):      System Functions.   (line   27)\n* PySysAddWarnOptionUnicode (C function): System Functions. (line   39)\n* PySysAddXOption (C function):         System Functions.   (line  104)\n* PySysAudit (C function):              System Functions.   (line  127)\n* PySysFormatStderr (C function):       System Functions.   (line   97)\n* PySysFormatStdout (C function):       System Functions.   (line   89)\n* PySysGetObject (C function):          System Functions.   (line   11)\n* PySysGetXOptions (C function):        System Functions.   (line  119)\n* PySysResetWarnOptions (C function):   System Functions.   (line   22)\n* PySysSetArgv (C function):            Initializing and finalizing the interpreter.\n(line    7)\n* PySysSetArgv (C function) <1>:        Process-wide parameters.\n(line  322)\n* PySysSetArgvEx (C function):          Initializing and finalizing the interpreter.\n(line    7)\n* PySysSetArgvEx (C function) <1>:      Process-wide parameters.\n(line  269)\n* PySysSetObject (C function):          System Functions.   (line   16)\n* PySysSetPath (C function):            System Functions.   (line   55)\n* PySysWriteStderr (C function):        System Functions.   (line   84)\n* PySysWriteStdout (C function):        System Functions.   (line   67)\n* Python 3000:                           Glossary.           (line 1150)\n* Python Editor:                         IDLE<57>.           (line    8)\n* Python Enhancement Proposals; PEP 1:   New Development Process.\n(line   67)\n* Python Enhancement Proposals; PEP 1 <1>: New Development Process.\n(line   82)\n* Python Enhancement Proposals; PEP 1 <2>: Glossary.         (line 1116)\n* Python Enhancement Proposals; PEP 100: Unicode<2>.         (line   15)\n* Python Enhancement Proposals; PEP 11:  Build Changes<2>.   (line    6)\n* Python Enhancement Proposals; PEP 11 <1>: PEP 538 Legacy C Locale Coercion.\n(line   19)\n* Python Enhancement Proposals; PEP 11 <2>: Unsupported Operating Systems.\n(line    6)\n* Python Enhancement Proposals; PEP 11 <3>: Library Changes. (line   15)\n* Python Enhancement Proposals; PEP 11 <4>: Build<16>.       (line   56)\n* Python Enhancement Proposals; PEP 11 <5>: Build<16>.       (line  107)\n* Python Enhancement Proposals; PEP 11 <6>: Build<52>.       (line   14)\n* Python Enhancement Proposals; PEP 11 <7>: Build Requirements.\n(line   34)\n* Python Enhancement Proposals; PEP 11 <8>: Using Python on Windows.\n(line   18)\n* Python Enhancement Proposals; PEP 11 <9>: Other Platforms. (line    8)\n* Python Enhancement Proposals; PEP 11#tier-3: Build Changes<2>.\n(line    6)\n* Python Enhancement Proposals; PEP 201: New Development Process.\n(line   86)\n* Python Enhancement Proposals; PEP 205: PEP 205 Weak References.\n(line   82)\n* Python Enhancement Proposals; PEP 205 <1>: weakref -- Weak references.\n(line  353)\n* Python Enhancement Proposals; PEP 207: PEP 207 Rich Comparisons.\n(line   71)\n* Python Enhancement Proposals; PEP 207 <1>: PEP 207 Rich Comparisons.\n(line   77)\n* Python Enhancement Proposals; PEP 208: PEP 208 New Coercion Model.\n(line   30)\n* Python Enhancement Proposals; PEP 217: PEP 217 Interactive Display Hook.\n(line   27)\n* Python Enhancement Proposals; PEP 218: PEP 218 Built-In Set Objects.\n(line   50)\n* Python Enhancement Proposals; PEP 218 <1>: Other Language Changes<16>.\n(line   12)\n* Python Enhancement Proposals; PEP 218 <2>: PEP 218 A Standard Set Datatype.\n(line   81)\n* Python Enhancement Proposals; PEP 227: PEP 227 Nested Scopes.\n(line   96)\n* Python Enhancement Proposals; PEP 227 <1>: PEP 227 Nested Scopes<2>.\n(line   96)\n* Python Enhancement Proposals; PEP 227 <2>: Module Contents<5>.\n(line   14)\n* Python Enhancement Proposals; PEP 229: PEP 229 New Build System.\n(line   39)\n* Python Enhancement Proposals; PEP 230: PEP 230 Warning Framework.\n(line   73)\n* Python Enhancement Proposals; PEP 232: PEP 232 Function Attributes.\n(line   36)\n* Python Enhancement Proposals; PEP 234: PEP 234 Iterators.  (line  124)\n* Python Enhancement Proposals; PEP 235: Introduction<10>.   (line   51)\n* Python Enhancement Proposals; PEP 236: PEP 227 Nested Scopes<2>.\n(line   87)\n* Python Enhancement Proposals; PEP 236 <1>: PEP 227 Nested Scopes<2>.\n(line   88)\n* Python Enhancement Proposals; PEP 236 <2>: PEP 236 future Directives.\n(line   29)\n* Python Enhancement Proposals; PEP 236 <3>: Future statements.\n(line   85)\n* Python Enhancement Proposals; PEP 236 <4>: Module Contents<5>.\n(line   96)\n* Python Enhancement Proposals; PEP 237: Integers.           (line    6)\n* Python Enhancement Proposals; PEP 237 <1>: PEP 237 Unifying Long Integers and Integers.\n(line   22)\n* Python Enhancement Proposals; PEP 237 <2>: Other Language Changes<16>.\n(line   18)\n* Python Enhancement Proposals; PEP 237 <3>: PEP 237 Unifying Long Integers and Integers<2>.\n(line   37)\n* Python Enhancement Proposals; PEP 237 <4>: printf-style String Formatting.\n(line  182)\n* Python Enhancement Proposals; PEP 237 <5>: printf-style Bytes Formatting.\n(line  189)\n* Python Enhancement Proposals; PEP 238: Integers.           (line   10)\n* Python Enhancement Proposals; PEP 238 <1>: PEP 238 Changing the Division Operator.\n(line   21)\n* Python Enhancement Proposals; PEP 238 <2>: PEP 238 Changing the Division Operator.\n(line   27)\n* Python Enhancement Proposals; PEP 238 <3>: PEP 238 Changing the Division Operator.\n(line   68)\n* Python Enhancement Proposals; PEP 238 <4>: Module Contents<5>.\n(line   20)\n* Python Enhancement Proposals; PEP 238 <5>: The Very High Level Layer.\n(line  380)\n* Python Enhancement Proposals; PEP 238 <6>: Glossary.       (line  501)\n* Python Enhancement Proposals; PEP 241: PEP 241 Metadata in Python Packages.\n(line   16)\n* Python Enhancement Proposals; PEP 241 <1>: PEP 241 Metadata in Python Packages.\n(line   29)\n* Python Enhancement Proposals; PEP 241 <2>: PEP 241 Metadata in Python Packages.\n(line   36)\n* Python Enhancement Proposals; PEP 243: PEP 241 Metadata in Python Packages.\n(line   40)\n* Python Enhancement Proposals; PEP 246: Documentation<18>.  (line   48)\n* Python Enhancement Proposals; PEP 246 <1>: PrepareProtocol objects.\n(line    8)\n* Python Enhancement Proposals; PEP 247: hmac<3>.            (line   20)\n* Python Enhancement Proposals; PEP 249: sqlite3.            (line   11)\n* Python Enhancement Proposals; PEP 249 <1>: The sqlite3 package.\n(line   18)\n* Python Enhancement Proposals; PEP 249 <2>: The sqlite3 package.\n(line  110)\n* Python Enhancement Proposals; PEP 249 <3>: Library<17>.    (line  121)\n* Python Enhancement Proposals; PEP 249 <4>: Library<20>.    (line  296)\n* Python Enhancement Proposals; PEP 249 <5>: sqlite3 -- DB-API 2 0 interface for SQLite databases.\n(line   16)\n* Python Enhancement Proposals; PEP 249 <6>: sqlite3 -- DB-API 2 0 interface for SQLite databases.\n(line   43)\n* Python Enhancement Proposals; PEP 249 <7>: Module functions.\n(line   75)\n* Python Enhancement Proposals; PEP 249 <8>: Connection objects.\n(line  705)\n* Python Enhancement Proposals; PEP 249 <9>: Connection objects.\n(line  708)\n* Python Enhancement Proposals; PEP 249 <10>: Connection objects.\n(line  720)\n* Python Enhancement Proposals; PEP 249 <11>: Exceptions<6>. (line    6)\n* Python Enhancement Proposals; PEP 249 <12>: How to use placeholders to bind values in SQL queries.\n(line   53)\n* Python Enhancement Proposals; PEP 249 <13>: Transaction control via the autocommit attribute.\n(line   10)\n* Python Enhancement Proposals; PEP 249 <14>: Transaction control via the autocommit attribute.\n(line   30)\n* Python Enhancement Proposals; PEP 252: Related Links.      (line   17)\n* Python Enhancement Proposals; PEP 252 <1>: Related Links.  (line   17)\n* Python Enhancement Proposals; PEP 252 <2>: Implementing Descriptors.\n(line   24)\n* Python Enhancement Proposals; PEP 253: Old and New Classes.\n(line   28)\n* Python Enhancement Proposals; PEP 253 <1>: Multiple Inheritance The Diamond Rule.\n(line    8)\n* Python Enhancement Proposals; PEP 253 <2>: Related Links.  (line   17)\n* Python Enhancement Proposals; PEP 253 <3>: Related Links.  (line   19)\n* Python Enhancement Proposals; PEP 253 <4>: Related Links.  (line   21)\n* Python Enhancement Proposals; PEP 255: PEP 255 Simple Generators.\n(line   45)\n* Python Enhancement Proposals; PEP 255 <1>: PEP 255 Simple Generators.\n(line  131)\n* Python Enhancement Proposals; PEP 255 <2>: PEP 255 Simple Generators<2>.\n(line   43)\n* Python Enhancement Proposals; PEP 255 <3>: PEP 255 Simple Generators<2>.\n(line  129)\n* Python Enhancement Proposals; PEP 255 <4>: Yield expressions.\n(line   90)\n* Python Enhancement Proposals; PEP 255 <5>: Module Contents<5>.\n(line   17)\n* Python Enhancement Proposals; PEP 261: Unicode Changes.    (line   18)\n* Python Enhancement Proposals; PEP 261 <1>: Unicode Changes.\n(line   61)\n* Python Enhancement Proposals; PEP 263: Other Language Changes<15>.\n(line   99)\n* Python Enhancement Proposals; PEP 263 <1>: PEP 263 Source Code Encodings.\n(line   29)\n* Python Enhancement Proposals; PEP 263 <2>: Core and Builtins<24>.\n(line   84)\n* Python Enhancement Proposals; PEP 263 <3>: Introduction<10>.\n(line   55)\n* Python Enhancement Proposals; PEP 263 <4>: Tokenizing Input.\n(line   35)\n* Python Enhancement Proposals; PEP 263 <5>: Tokenizing Input.\n(line   89)\n* Python Enhancement Proposals; PEP 263 <6>: Unicode Literals in Python Source Code.\n(line   48)\n* Python Enhancement Proposals; PEP 264: Other Changes and Fixes<3>.\n(line   55)\n* Python Enhancement Proposals; PEP 273: PEP 273 Importing Modules from ZIP Archives.\n(line   41)\n* Python Enhancement Proposals; PEP 273 <1>: PEP 273 Importing Modules from ZIP Archives.\n(line   44)\n* Python Enhancement Proposals; PEP 273 <2>: zipimport -- Import modules from Zip archives.\n(line   42)\n* Python Enhancement Proposals; PEP 273 <3>: zipimport -- Import modules from Zip archives.\n(line   45)\n* Python Enhancement Proposals; PEP 274: New Syntax.         (line   38)\n* Python Enhancement Proposals; PEP 277: PEP 277 Unicode file name support for Windows NT.\n(line   32)\n* Python Enhancement Proposals; PEP 278: PEP 278 Universal Newline Support.\n(line   33)\n* Python Enhancement Proposals; PEP 278 <1>: Glossary.       (line 1392)\n* Python Enhancement Proposals; PEP 279: PEP 279 enumerate.  (line   27)\n* Python Enhancement Proposals; PEP 282: PEP 282 The logging Package.\n(line  105)\n* Python Enhancement Proposals; PEP 282 <1>: PEP 282 The logging Package.\n(line  111)\n* Python Enhancement Proposals; PEP 282 <2>: Archiving operations.\n(line   47)\n* Python Enhancement Proposals; PEP 282 <3>: Integration with the warnings module.\n(line   36)\n* Python Enhancement Proposals; PEP 285: PEP 285 A Boolean Type.\n(line   47)\n* Python Enhancement Proposals; PEP 285 <1>: PEP 285 A Boolean Type.\n(line   70)\n* Python Enhancement Proposals; PEP 288: PEP 342 New Generator Features.\n(line  146)\n* Python Enhancement Proposals; PEP 289: PEP 289 Generator Expressions.\n(line   55)\n* Python Enhancement Proposals; PEP 289 <1>: Other Language Changes<16>.\n(line   15)\n* Python Enhancement Proposals; PEP 289 <2>: Python documentation.\n(line   12)\n* Python Enhancement Proposals; PEP 292: PEP 292 Simpler String Substitutions.\n(line   45)\n* Python Enhancement Proposals; PEP 292 <1>: Template strings.\n(line    6)\n* Python Enhancement Proposals; PEP 293: PEP 293 Codec Error Handling Callbacks.\n(line   33)\n* Python Enhancement Proposals; PEP 3000: Python 3 0.        (line   43)\n* Python Enhancement Proposals; PEP 301: PEP 301 Package Index and Metadata for Distutils.\n(line   45)\n* Python Enhancement Proposals; PEP 302: Using importlib as the Implementation of Import.\n(line   13)\n* Python Enhancement Proposals; PEP 302 <1>: Visible Changes.\n(line   18)\n* Python Enhancement Proposals; PEP 302 <2>: Porting Python code.\n(line   71)\n* Python Enhancement Proposals; PEP 302 <3>: New Improved and Deprecated Modules<2>.\n(line  106)\n* Python Enhancement Proposals; PEP 302 <4>: New Improved and Removed Modules.\n(line  290)\n* Python Enhancement Proposals; PEP 302 <5>: PEP 273 Importing Modules from ZIP Archives.\n(line   46)\n* Python Enhancement Proposals; PEP 302 <6>: PEP 302 New Import Hooks.\n(line   13)\n* Python Enhancement Proposals; PEP 302 <7>: PEP 302 New Import Hooks.\n(line   38)\n* Python Enhancement Proposals; PEP 302 <8>: PEP 302 New Import Hooks.\n(line   62)\n* Python Enhancement Proposals; PEP 302 <9>: The import system.\n(line   42)\n* Python Enhancement Proposals; PEP 302 <10>: References.    (line   10)\n* Python Enhancement Proposals; PEP 302 <11>: Built-in Functions.\n(line 2014)\n* Python Enhancement Proposals; PEP 302 <12>: linecache -- Random access to text lines.\n(line   31)\n* Python Enhancement Proposals; PEP 302 <13>: sys -- System-specific parameters and functions.\n(line 1300)\n* Python Enhancement Proposals; PEP 302 <14>: sys -- System-specific parameters and functions.\n(line 1310)\n* Python Enhancement Proposals; PEP 302 <15>: zipimport -- Import modules from Zip archives.\n(line   47)\n* Python Enhancement Proposals; PEP 302 <16>: pkgutil -- Package extension utility.\n(line   64)\n* Python Enhancement Proposals; PEP 302 <17>: pkgutil -- Package extension utility.\n(line   83)\n* Python Enhancement Proposals; PEP 302 <18>: pkgutil -- Package extension utility.\n(line   98)\n* Python Enhancement Proposals; PEP 302 <19>: pkgutil -- Package extension utility.\n(line  121)\n* Python Enhancement Proposals; PEP 302 <20>: pkgutil -- Package extension utility.\n(line  142)\n* Python Enhancement Proposals; PEP 302 <21>: pkgutil -- Package extension utility.\n(line  181)\n* Python Enhancement Proposals; PEP 302 <22>: runpy -- Locating and executing Python modules.\n(line   32)\n* Python Enhancement Proposals; PEP 302 <23>: Introduction<10>.\n(line   59)\n* Python Enhancement Proposals; PEP 302 <24>: importlib abc - Abstract base classes related to import.\n(line   93)\n* Python Enhancement Proposals; PEP 302 <25>: importlib abc - Abstract base classes related to import.\n(line  210)\n* Python Enhancement Proposals; PEP 302 <26>: importlib abc - Abstract base classes related to import.\n(line  234)\n* Python Enhancement Proposals; PEP 302 <27>: importlib abc - Abstract base classes related to import.\n(line  305)\n* Python Enhancement Proposals; PEP 302 <28>: Glossary.      (line  493)\n* Python Enhancement Proposals; PEP 302 <29>: Glossary.      (line  835)\n* Python Enhancement Proposals; PEP 305: PEP 305 Comma-separated Files.\n(line   42)\n* Python Enhancement Proposals; PEP 305 <1>: csv -- CSV File Reading and Writing.\n(line   38)\n* Python Enhancement Proposals; PEP 307: PEP 307 Pickle Enhancements.\n(line    8)\n* Python Enhancement Proposals; PEP 307 <1>: PEP 307 Pickle Enhancements.\n(line   30)\n* Python Enhancement Proposals; PEP 307 <2>: PEP 307 Pickle Enhancements.\n(line   42)\n* Python Enhancement Proposals; PEP 307 <3>: Data stream format.\n(line   32)\n* Python Enhancement Proposals; PEP 308: PEP 308 Conditional Expressions.\n(line   72)\n* Python Enhancement Proposals; PEP 308 <1>: PEP 308 Conditional Expressions.\n(line   78)\n* Python Enhancement Proposals; PEP 308 <2>: Conditional expressions.\n(line   16)\n* Python Enhancement Proposals; PEP 309: PEP 309 Partial Function Application.\n(line   73)\n* Python Enhancement Proposals; PEP 3100: Python 3 0.        (line   44)\n* Python Enhancement Proposals; PEP 3101: PEP 3101 A New Approach To String Formatting.\n(line    3)\n* Python Enhancement Proposals; PEP 3101 <1>: PEP 3101 A New Approach To String Formatting.\n(line    8)\n* Python Enhancement Proposals; PEP 3101 <2>: PEP 3101 Advanced String Formatting.\n(line  161)\n* Python Enhancement Proposals; PEP 3101 <3>: Custom String Formatting.\n(line    8)\n* Python Enhancement Proposals; PEP 3101 <4>: Custom String Formatting.\n(line   60)\n* Python Enhancement Proposals; PEP 3102: New Syntax.        (line   13)\n* Python Enhancement Proposals; PEP 3104: New Syntax.        (line   24)\n* Python Enhancement Proposals; PEP 3104 <1>: The nonlocal statement.\n(line   24)\n* Python Enhancement Proposals; PEP 3105: Print Is A Function.\n(line    8)\n* Python Enhancement Proposals; PEP 3105 <1>: PEP 3105 print As a Function.\n(line   35)\n* Python Enhancement Proposals; PEP 3105 <2>: Module Contents<5>.\n(line   30)\n* Python Enhancement Proposals; PEP 3106: PEP 3106 Dictionary Views.\n(line   58)\n* Python Enhancement Proposals; PEP 3107: PEP 563 Postponed Evaluation of Annotations.\n(line    7)\n* Python Enhancement Proposals; PEP 3107 <1>: PEP 484 - Type Hints.\n(line    7)\n* Python Enhancement Proposals; PEP 3107 <2>: New Syntax.    (line    6)\n* Python Enhancement Proposals; PEP 3107 <3>: Function Annotations.\n(line    7)\n* Python Enhancement Proposals; PEP 3107 <4>: Function definitions.\n(line  140)\n* Python Enhancement Proposals; PEP 3108: Library Changes.   (line    7)\n* Python Enhancement Proposals; PEP 3108 <1>: Library Changes.\n(line   17)\n* Python Enhancement Proposals; PEP 3108 <2>: Library Changes.\n(line   95)\n* Python Enhancement Proposals; PEP 3109: Changed Syntax.    (line    6)\n* Python Enhancement Proposals; PEP 3109 <1>: Changes To Exceptions.\n(line   29)\n* Python Enhancement Proposals; PEP 3110: Changed Syntax.    (line   16)\n* Python Enhancement Proposals; PEP 3110 <1>: Changes To Exceptions.\n(line   35)\n* Python Enhancement Proposals; PEP 3110 <2>: PEP 3110 Exception-Handling Changes.\n(line   48)\n* Python Enhancement Proposals; PEP 3111: Builtins.          (line   12)\n* Python Enhancement Proposals; PEP 3112: PEP 3112 Byte Literals.\n(line   75)\n* Python Enhancement Proposals; PEP 3112 <1>: Module Contents<5>.\n(line   33)\n* Python Enhancement Proposals; PEP 3113: Removed Syntax.    (line    6)\n* Python Enhancement Proposals; PEP 3114: Operators And Special Methods.\n(line   19)\n* Python Enhancement Proposals; PEP 3115: types<6>.          (line   10)\n* Python Enhancement Proposals; PEP 3115 <1>: Changed Syntax.\n(line   18)\n* Python Enhancement Proposals; PEP 3115 <2>: Preparing the class namespace.\n(line   21)\n* Python Enhancement Proposals; PEP 3115 <3>: Class definitions.\n(line   83)\n* Python Enhancement Proposals; PEP 3115 <4>: Dynamic Type Creation.\n(line   54)\n* Python Enhancement Proposals; PEP 3116: Optimizations<11>. (line    8)\n* Python Enhancement Proposals; PEP 3116 <1>: PEP 3116 New I/O Library.\n(line   69)\n* Python Enhancement Proposals; PEP 3116 <2>: Glossary.      (line 1392)\n* Python Enhancement Proposals; PEP 3118: Pickle protocol 5 with out-of-band data buffers.\n(line   13)\n* Python Enhancement Proposals; PEP 3118 <1>: PEP 3118 New memoryview implementation and buffer protocol documentation.\n(line    6)\n* Python Enhancement Proposals; PEP 3118 <2>: API changes.   (line   29)\n* Python Enhancement Proposals; PEP 3118 <3>: Build and C API Changes<4>.\n(line    8)\n* Python Enhancement Proposals; PEP 3118 <4>: Build and C API Changes<7>.\n(line   12)\n* Python Enhancement Proposals; PEP 3118 <5>: PEP 3118 Revised Buffer Protocol.\n(line   46)\n* Python Enhancement Proposals; PEP 3118 <6>: Library<57>.   (line   99)\n* Python Enhancement Proposals; PEP 3118 <7>: Library<62>.   (line   61)\n* Python Enhancement Proposals; PEP 3118 <8>: Library<91>.   (line  957)\n* Python Enhancement Proposals; PEP 3118 <9>: Memory Views.  (line  114)\n* Python Enhancement Proposals; PEP 3119: PEP 3119 Abstract Base Classes.\n(line  139)\n* Python Enhancement Proposals; PEP 3119 <1>: Customizing instance and subclass checks.\n(line   35)\n* Python Enhancement Proposals; PEP 3119 <2>: Examples and Recipes.\n(line   73)\n* Python Enhancement Proposals; PEP 3119 <3>: abc -- Abstract Base Classes.\n(line   11)\n* Python Enhancement Proposals; PEP 3119 <4>: Object Protocol.\n(line  253)\n* Python Enhancement Proposals; PEP 3119 <5>: Object Protocol.\n(line  272)\n* Python Enhancement Proposals; PEP 3120: Text Vs Data Instead Of Unicode Vs 8-bit.\n(line  107)\n* Python Enhancement Proposals; PEP 3120 <1>: Lexical analysis.\n(line   12)\n* Python Enhancement Proposals; PEP 3120 <2>: Introduction<10>.\n(line   91)\n* Python Enhancement Proposals; PEP 3121: Build and C API Changes<7>.\n(line   14)\n* Python Enhancement Proposals; PEP 3121 <1>: Core and Builtins<34>.\n(line  230)\n* Python Enhancement Proposals; PEP 3121 <2>: Initializing C modules.\n(line   56)\n* Python Enhancement Proposals; PEP 3123: Build and C API Changes<7>.\n(line   16)\n* Python Enhancement Proposals; PEP 3127: PEP 3127 Integer Literal Support and Syntax.\n(line   47)\n* Python Enhancement Proposals; PEP 3129: PEP 3129 Class Decorators.\n(line   24)\n* Python Enhancement Proposals; PEP 3129 <1>: Function definitions.\n(line  162)\n* Python Enhancement Proposals; PEP 3129 <2>: Class definitions.\n(line   89)\n* Python Enhancement Proposals; PEP 3131: Text Vs Data Instead Of Unicode Vs 8-bit.\n(line  109)\n* Python Enhancement Proposals; PEP 3131 <1>: Library<46>.   (line  599)\n* Python Enhancement Proposals; PEP 3131 <2>: Identifiers and keywords.\n(line   10)\n* Python Enhancement Proposals; PEP 3131 <3>: Identifiers and keywords.\n(line   19)\n* Python Enhancement Proposals; PEP 3132: New Syntax.        (line   28)\n* Python Enhancement Proposals; PEP 3132 <1>: Assignment statements.\n(line  158)\n* Python Enhancement Proposals; PEP 3134: Changed Syntax.    (line    6)\n* Python Enhancement Proposals; PEP 3134 <1>: Changes To Exceptions.\n(line   40)\n* Python Enhancement Proposals; PEP 3134 <2>: Changes To Exceptions.\n(line   61)\n* Python Enhancement Proposals; PEP 3134 <3>: Library<20>.   (line   48)\n* Python Enhancement Proposals; PEP 3134 <4>: Base classes.  (line   29)\n* Python Enhancement Proposals; PEP 3135: Builtins.          (line    6)\n* Python Enhancement Proposals; PEP 3135 <1>: Creating the class object.\n(line   53)\n* Python Enhancement Proposals; PEP 3137: PEP 3137 The memoryview Object.\n(line   49)\n* Python Enhancement Proposals; PEP 3138: Text Vs Data Instead Of Unicode Vs 8-bit.\n(line  103)\n* Python Enhancement Proposals; PEP 314: PEP 314 Metadata for Python Software Packages v1 1.\n(line   42)\n* Python Enhancement Proposals; PEP 3141: PEP 3141 A Type Hierarchy for Numbers.\n(line   43)\n* Python Enhancement Proposals; PEP 3141 <1>: numbers -- Numeric abstract base classes.\n(line   10)\n* Python Enhancement Proposals; PEP 3141 <2>: abc -- Abstract Base Classes.\n(line   12)\n* Python Enhancement Proposals; PEP 3144: ipaddress<5>.      (line   10)\n* Python Enhancement Proposals; PEP 3147: PEP 421 Adding sys implementation.\n(line   21)\n* Python Enhancement Proposals; PEP 3147 <1>: PEP 3147 PYC Repository Directories.\n(line   69)\n* Python Enhancement Proposals; PEP 3147 <2>: \"Compiled\" Python files.\n(line   47)\n* Python Enhancement Proposals; PEP 3147 <3>: Import-related module attributes.\n(line  104)\n* Python Enhancement Proposals; PEP 3147 <4>: test support importhelper -- Utilities for import tests.\n(line   82)\n* Python Enhancement Proposals; PEP 3147 <5>: runpy -- Locating and executing Python modules.\n(line   87)\n* Python Enhancement Proposals; PEP 3147 <6>: Introduction<10>.\n(line   95)\n* Python Enhancement Proposals; PEP 3147 <7>: importlib util - Utility code for importers.\n(line   24)\n* Python Enhancement Proposals; PEP 3147 <8>: importlib util - Utility code for importers.\n(line   60)\n* Python Enhancement Proposals; PEP 3147 <9>: importlib util - Utility code for importers.\n(line   64)\n* Python Enhancement Proposals; PEP 3147 <10>: pycompile -- Compile Python source files.\n(line   30)\n* Python Enhancement Proposals; PEP 3147 <11>: pycompile -- Compile Python source files.\n(line   70)\n* Python Enhancement Proposals; PEP 3147 <12>: Command-line use.\n(line   63)\n* Python Enhancement Proposals; PEP 3147 <13>: Public functions.\n(line   40)\n* Python Enhancement Proposals; PEP 3147 <14>: Public functions.\n(line  122)\n* Python Enhancement Proposals; PEP 3147 <15>: Importing Modules<2>.\n(line  200)\n* Python Enhancement Proposals; PEP 3147 <16>: How do I create a pyc file?.\n(line   12)\n* Python Enhancement Proposals; PEP 3148: PEP 3148 The concurrent futures module.\n(line   51)\n* Python Enhancement Proposals; PEP 3148 <1>: Module Functions.\n(line   61)\n* Python Enhancement Proposals; PEP 3149: PEP 3149 ABI Version Tagged so Files.\n(line   33)\n* Python Enhancement Proposals; PEP 3149 <1>: Core and Builtins<88>.\n(line    9)\n* Python Enhancement Proposals; PEP 3149 <2>: sys -- System-specific parameters and functions.\n(line   15)\n* Python Enhancement Proposals; PEP 3151: PEP 3151 Reworking the OS and IO exception hierarchy.\n(line   84)\n* Python Enhancement Proposals; PEP 3151 <1>: OS exceptions. (line  123)\n* Python Enhancement Proposals; PEP 3151 <2>: Exceptions<13>.\n(line   10)\n* Python Enhancement Proposals; PEP 3151 <3>: select -- Waiting for I/O completion.\n(line   34)\n* Python Enhancement Proposals; PEP 3151 <4>: resource -- Resource usage information.\n(line   23)\n* Python Enhancement Proposals; PEP 3151 <5>: Standard Exceptions.\n(line  181)\n* Python Enhancement Proposals; PEP 3154: Summary - Release Highlights<2>.\n(line   57)\n* Python Enhancement Proposals; PEP 3154 <1>: pickle<4>.     (line   16)\n* Python Enhancement Proposals; PEP 3154 <2>: Library<46>.   (line 1279)\n* Python Enhancement Proposals; PEP 3154 <3>: Data stream format.\n(line   42)\n* Python Enhancement Proposals; PEP 3155: PEP 3155 Qualified name for classes and functions.\n(line   63)\n* Python Enhancement Proposals; PEP 3155 <1>: Glossary.      (line 1179)\n* Python Enhancement Proposals; PEP 3156: Summary - Release Highlights<2>.\n(line   31)\n* Python Enhancement Proposals; PEP 3156 <1>: Summary - Release Highlights<2>.\n(line   44)\n* Python Enhancement Proposals; PEP 3156 <2>: asyncio<10>.   (line    6)\n* Python Enhancement Proposals; PEP 3156 <3>: asyncio<10>.   (line   17)\n* Python Enhancement Proposals; PEP 3156 <4>: selectors<2>.  (line    6)\n* Python Enhancement Proposals; PEP 318: PEP 318 Decorators for Functions and Methods.\n(line  101)\n* Python Enhancement Proposals; PEP 318 <1>: PEP 318 Decorators for Functions and Methods.\n(line  125)\n* Python Enhancement Proposals; PEP 318 <2>: Other Language Changes<16>.\n(line    9)\n* Python Enhancement Proposals; PEP 318 <3>: Function definitions.\n(line  159)\n* Python Enhancement Proposals; PEP 318 <4>: Class definitions.\n(line   92)\n* Python Enhancement Proposals; PEP 322: PEP 322 Reverse Iteration.\n(line   35)\n* Python Enhancement Proposals; PEP 322 <1>: Other Language Changes<16>.\n(line   13)\n* Python Enhancement Proposals; PEP 324: PEP 324 New subprocess Module.\n(line   86)\n* Python Enhancement Proposals; PEP 324 <1>: subprocess -- Subprocess management.\n(line   25)\n* Python Enhancement Proposals; PEP 325: PEP 342 New Generator Features.\n(line  147)\n* Python Enhancement Proposals; PEP 327: The Context type.   (line   56)\n* Python Enhancement Proposals; PEP 328: Porting Python code.\n(line   36)\n* Python Enhancement Proposals; PEP 328 <1>: Removed Syntax. (line   29)\n* Python Enhancement Proposals; PEP 328 <2>: PEP 328 Absolute and Relative Imports.\n(line    6)\n* Python Enhancement Proposals; PEP 328 <3>: PEP 328 Absolute and Relative Imports.\n(line   82)\n* Python Enhancement Proposals; PEP 328 <4>: PEP 328 Multi-line Imports.\n(line   35)\n* Python Enhancement Proposals; PEP 328 <5>: Other Language Changes<16>.\n(line   21)\n* Python Enhancement Proposals; PEP 328 <6>: References.     (line   20)\n* Python Enhancement Proposals; PEP 328 <7>: Built-in Functions.\n(line 2032)\n* Python Enhancement Proposals; PEP 328 <8>: Module Contents<5>.\n(line   23)\n* Python Enhancement Proposals; PEP 328 <9>: Introduction<10>.\n(line   63)\n* Python Enhancement Proposals; PEP 331: PEP 331 Locale-Independent Float/String Conversions.\n(line   38)\n* Python Enhancement Proposals; PEP 333: The wsgiref package.\n(line    8)\n* Python Enhancement Proposals; PEP 333 <1>: The wsgiref package.\n(line   31)\n* Python Enhancement Proposals; PEP 3333: New Modules<2>.    (line    9)\n* Python Enhancement Proposals; PEP 3333 <1>: PEP 3333 Python Web Server Gateway Interface v1 0 1.\n(line   50)\n* Python Enhancement Proposals; PEP 3333 <2>: wsgiref -- WSGI Utilities and Reference Implementation.\n(line   26)\n* Python Enhancement Proposals; PEP 3333 <3>: wsgiref util - WSGI environment utilities.\n(line    8)\n* Python Enhancement Proposals; PEP 3333 <4>: wsgiref util - WSGI environment utilities.\n(line   10)\n* Python Enhancement Proposals; PEP 3333 <5>: wsgiref util - WSGI environment utilities.\n(line   30)\n* Python Enhancement Proposals; PEP 3333 <6>: wsgiref util - WSGI environment utilities.\n(line   76)\n* Python Enhancement Proposals; PEP 3333 <7>: wsgiref headers - WSGI response header tools.\n(line   12)\n* Python Enhancement Proposals; PEP 3333 <8>: wsgiref simpleserver - a simple WSGI HTTP server.\n(line   21)\n* Python Enhancement Proposals; PEP 3333 <9>: wsgiref simpleserver - a simple WSGI HTTP server.\n(line   96)\n* Python Enhancement Proposals; PEP 3333 <10>: wsgiref validate -- WSGI conformance checker.\n(line   13)\n* Python Enhancement Proposals; PEP 3333 <11>: wsgiref validate -- WSGI conformance checker.\n(line   40)\n* Python Enhancement Proposals; PEP 3333 <12>: wsgiref handlers - server/gateway base classes.\n(line  237)\n* Python Enhancement Proposals; PEP 3333 <13>: wsgiref handlers - server/gateway base classes.\n(line  253)\n* Python Enhancement Proposals; PEP 3333 <14>: wsgiref handlers - server/gateway base classes.\n(line  260)\n* Python Enhancement Proposals; PEP 3333 <15>: wsgiref handlers - server/gateway base classes.\n(line  269)\n* Python Enhancement Proposals; PEP 3333 <16>: wsgiref handlers - server/gateway base classes.\n(line  312)\n* Python Enhancement Proposals; PEP 3333 <17>: wsgiref types - WSGI types for static type checking.\n(line    7)\n* Python Enhancement Proposals; PEP 3333 <18>: wsgiref types - WSGI types for static type checking.\n(line   14)\n* Python Enhancement Proposals; PEP 338: PEP 338 Executing Modules as Scripts.\n(line   21)\n* Python Enhancement Proposals; PEP 338 <1>: Interface options.\n(line   99)\n* Python Enhancement Proposals; PEP 338 <2>: References.     (line   24)\n* Python Enhancement Proposals; PEP 338 <3>: runpy -- Locating and executing Python modules.\n(line  179)\n* Python Enhancement Proposals; PEP 339: Build and C API Changes<10>.\n(line   46)\n* Python Enhancement Proposals; PEP 341: PEP 341 Unified try/except/finally.\n(line   44)\n* Python Enhancement Proposals; PEP 342: PEP 342 New Generator Features.\n(line   42)\n* Python Enhancement Proposals; PEP 342 <1>: PEP 342 New Generator Features.\n(line  140)\n* Python Enhancement Proposals; PEP 342 <2>: Porting to Python 2 5.\n(line   15)\n* Python Enhancement Proposals; PEP 342 <3>: Yield expressions.\n(line   95)\n* Python Enhancement Proposals; PEP 342 <4>: Collections Abstract Base Classes - Detailed Descriptions.\n(line   56)\n* Python Enhancement Proposals; PEP 342 <5>: Passing values into a generator.\n(line   25)\n* Python Enhancement Proposals; PEP 342 <6>: Python documentation.\n(line   14)\n* Python Enhancement Proposals; PEP 343: The contextlib module.\n(line   64)\n* Python Enhancement Proposals; PEP 343 <1>: PEP 342 New Generator Features.\n(line  129)\n* Python Enhancement Proposals; PEP 343 <2>: The contextlib module<2>.\n(line   64)\n* Python Enhancement Proposals; PEP 343 <3>: With Statement Context Managers.\n(line   45)\n* Python Enhancement Proposals; PEP 343 <4>: The with statement.\n(line  111)\n* Python Enhancement Proposals; PEP 343 <5>: Using a context manager as a function decorator.\n(line   51)\n* Python Enhancement Proposals; PEP 343 <6>: Module Contents<5>.\n(line   27)\n* Python Enhancement Proposals; PEP 343 <7>: Glossary.       (line  281)\n* Python Enhancement Proposals; PEP 347: Build and C API Changes<10>.\n(line   10)\n* Python Enhancement Proposals; PEP 352: Changes To Exceptions.\n(line    9)\n* Python Enhancement Proposals; PEP 352 <1>: Deprecations and Removals.\n(line    9)\n* Python Enhancement Proposals; PEP 352 <2>: PEP 352 Exceptions as New-Style Classes.\n(line   57)\n* Python Enhancement Proposals; PEP 353: Porting to Python 3 10<2>.\n(line    9)\n* Python Enhancement Proposals; PEP 353 <1>: PEP 353 Using ssizet as the index type.\n(line   49)\n* Python Enhancement Proposals; PEP 353 <2>: PEP 353 Using ssizet as the index type.\n(line   55)\n* Python Enhancement Proposals; PEP 353 <3>: Build and C API Changes<10>.\n(line   20)\n* Python Enhancement Proposals; PEP 353 <4>: C API<30>.      (line   78)\n* Python Enhancement Proposals; PEP 353 <5>: Types.          (line   17)\n* Python Enhancement Proposals; PEP 356: What's New in Python 2 5.\n(line   10)\n* Python Enhancement Proposals; PEP 357: PEP 357 The 'index' method.\n(line   39)\n* Python Enhancement Proposals; PEP 361: What's New in Python 2 6.\n(line   10)\n* Python Enhancement Proposals; PEP 362: PEP 362 Function Signature Object.\n(line   19)\n* Python Enhancement Proposals; PEP 362 <1>: Introspecting callables with the Signature object.\n(line  379)\n* Python Enhancement Proposals; PEP 362 <2>: Glossary.       (line   96)\n* Python Enhancement Proposals; PEP 362 <3>: Glossary.       (line 1063)\n* Python Enhancement Proposals; PEP 366: Visible Changes.    (line   24)\n* Python Enhancement Proposals; PEP 366 <1>: Import-related module attributes.\n(line   41)\n* Python Enhancement Proposals; PEP 366 <2>: Import-related module attributes.\n(line   45)\n* Python Enhancement Proposals; PEP 366 <3>: References.     (line   17)\n* Python Enhancement Proposals; PEP 366 <4>: References.     (line   21)\n* Python Enhancement Proposals; PEP 366 <5>: runpy -- Locating and executing Python modules.\n(line  183)\n* Python Enhancement Proposals; PEP 366 <6>: Introduction<10>.\n(line   67)\n* Python Enhancement Proposals; PEP 370: PEP 370 Per-user site-packages Directory.\n(line   36)\n* Python Enhancement Proposals; PEP 370 <1>: Library<18>.    (line  605)\n* Python Enhancement Proposals; PEP 370 <2>: Miscellaneous options.\n(line  153)\n* Python Enhancement Proposals; PEP 370 <3>: Environment variables.\n(line  194)\n* Python Enhancement Proposals; PEP 370 <4>: Environment variables.\n(line  206)\n* Python Enhancement Proposals; PEP 370 <5>: Command Line Interface<4>.\n(line   37)\n* Python Enhancement Proposals; PEP 371: PEP 371 The multiprocessing Package.\n(line  145)\n* Python Enhancement Proposals; PEP 372: PEP 372 Ordered Dictionaries.\n(line   31)\n* Python Enhancement Proposals; PEP 372 <1>: PEP 372 Adding an Ordered Dictionary to collections.\n(line   97)\n* Python Enhancement Proposals; PEP 373: The Future for Python 2 x.\n(line   23)\n* Python Enhancement Proposals; PEP 378: PEP 378 Format Specifier for Thousands Separator.\n(line   32)\n* Python Enhancement Proposals; PEP 378 <1>: PEP 378 Format Specifier for Thousands Separator<2>.\n(line   37)\n* Python Enhancement Proposals; PEP 378 <2>: Format Specification Mini-Language.\n(line  109)\n* Python Enhancement Proposals; PEP 380: PEP 380 Syntax for Delegating to a Subgenerator.\n(line   66)\n* Python Enhancement Proposals; PEP 380 <1>: Yield expressions.\n(line  100)\n* Python Enhancement Proposals; PEP 380#use-of-stopiteration-to-return-values: The STOPITERATION event.\n(line    6)\n* Python Enhancement Proposals; PEP 383: Documentation<19>.  (line   29)\n* Python Enhancement Proposals; PEP 383 <1>: Error Handlers. (line   50)\n* Python Enhancement Proposals; PEP 383 <2>: Socket families.\n(line   15)\n* Python Enhancement Proposals; PEP 383 <3>: Locale Encoding.\n(line   15)\n* Python Enhancement Proposals; PEP 383 <4>: Locale Encoding.\n(line   52)\n* Python Enhancement Proposals; PEP 383 <5>: File System Encoding.\n(line    7)\n* Python Enhancement Proposals; PEP 384: Removed<6>.         (line   53)\n* Python Enhancement Proposals; PEP 384 <1>: PEP 384 Defining a Stable ABI.\n(line   24)\n* Python Enhancement Proposals; PEP 384 <2>: C API<24>.      (line  100)\n* Python Enhancement Proposals; PEP 385: Code Repository.    (line   13)\n* Python Enhancement Proposals; PEP 387: Warnings.           (line   26)\n* Python Enhancement Proposals; PEP 387 <1>: Warnings.       (line   41)\n* Python Enhancement Proposals; PEP 387 <2>: C API Stability.\n(line    7)\n* Python Enhancement Proposals; PEP 387 <3>: How does the Python version numbering scheme work?.\n(line   46)\n* Python Enhancement Proposals; PEP 389: PEP 389 Argparse Command Line Parsing Module.\n(line   92)\n* Python Enhancement Proposals; PEP 389 <1>: PEP 389 The argparse Module for Parsing Command Lines.\n(line  100)\n* Python Enhancement Proposals; PEP 391: PEP 391 Dictionary Based Configuration for Logging.\n(line   52)\n* Python Enhancement Proposals; PEP 391 <1>: PEP 391 Dictionary-Based Configuration For Logging.\n(line   95)\n* Python Enhancement Proposals; PEP 392: What's New In Python 3 2.\n(line   17)\n* Python Enhancement Proposals; PEP 393: Removed<6>.         (line   26)\n* Python Enhancement Proposals; PEP 393 <1>: Porting to Python 3 9<2>.\n(line   45)\n* Python Enhancement Proposals; PEP 393 <2>: Removed<8>.     (line  101)\n* Python Enhancement Proposals; PEP 393 <3>: PEP 393 Flexible String Representation.\n(line   16)\n* Python Enhancement Proposals; PEP 393 <4>: Functionality.  (line    6)\n* Python Enhancement Proposals; PEP 393 <5>: Performance and resource usage.\n(line   29)\n* Python Enhancement Proposals; PEP 393 <6>: Optimizations<9>.\n(line    8)\n* Python Enhancement Proposals; PEP 393 <7>: Build and C API Changes<4>.\n(line   12)\n* Python Enhancement Proposals; PEP 393 <8>: Deprecated Python modules functions and methods<4>.\n(line   10)\n* Python Enhancement Proposals; PEP 393 <9>: Deprecated functions and types of the C API<3>.\n(line    6)\n* Python Enhancement Proposals; PEP 393 <10>: Porting C code.\n(line   17)\n* Python Enhancement Proposals; PEP 393 <11>: C API<22>.     (line  143)\n* Python Enhancement Proposals; PEP 393 <12>: Encodings and Unicode.\n(line    7)\n* Python Enhancement Proposals; PEP 393 <13>: sys -- System-specific parameters and functions.\n(line 1197)\n* Python Enhancement Proposals; PEP 393 <14>: Unicode Objects.\n(line    6)\n* Python Enhancement Proposals; PEP 397: PEP 486 Make the Python Launcher aware of virtual environments.\n(line    6)\n* Python Enhancement Proposals; PEP 397 <1>: PEP 397 Python Launcher for Windows.\n(line   31)\n* Python Enhancement Proposals; PEP 397 <2>: Python Launcher for Windows.\n(line   18)\n* Python Enhancement Proposals; PEP 398: What's New In Python 3 3.\n(line   13)\n* Python Enhancement Proposals; PEP 4:   Library Changes.    (line   13)\n* Python Enhancement Proposals; PEP 405: PEP 405 Virtual Environments.\n(line   22)\n* Python Enhancement Proposals; PEP 405 <1>: venv -- Creation of virtual environments.\n(line   45)\n* Python Enhancement Proposals; PEP 409: PEP 409 Suppressing exception context.\n(line   63)\n* Python Enhancement Proposals; PEP 411: sys -- System-specific parameters and functions.\n(line  976)\n* Python Enhancement Proposals; PEP 411 <1>: sys -- System-specific parameters and functions.\n(line  986)\n* Python Enhancement Proposals; PEP 411 <2>: sys -- System-specific parameters and functions.\n(line 1669)\n* Python Enhancement Proposals; PEP 411 <3>: sys -- System-specific parameters and functions.\n(line 1689)\n* Python Enhancement Proposals; PEP 411 <4>: Glossary.       (line 1146)\n* Python Enhancement Proposals; PEP 412: PEP 412 Key-Sharing Dictionary.\n(line   15)\n* Python Enhancement Proposals; PEP 412 <1>: functools -- Higher-order functions and operations on callable objects.\n(line   90)\n* Python Enhancement Proposals; PEP 414: PEP 414 Explicit Unicode literals.\n(line   17)\n* Python Enhancement Proposals; PEP 414 <1>: String and Bytes literals.\n(line   62)\n* Python Enhancement Proposals; PEP 418: time<7>.            (line    6)\n* Python Enhancement Proposals; PEP 420: PEP 420 Implicit Namespace Packages.\n(line    9)\n* Python Enhancement Proposals; PEP 420 <1>: PEP 420 Implicit Namespace Packages.\n(line   14)\n* Python Enhancement Proposals; PEP 420 <2>: Core and Builtins<73>.\n(line   56)\n* Python Enhancement Proposals; PEP 420 <3>: Core and Builtins<78>.\n(line  114)\n* Python Enhancement Proposals; PEP 420 <4>: The import system.\n(line   45)\n* Python Enhancement Proposals; PEP 420 <5>: Namespace packages.\n(line   27)\n* Python Enhancement Proposals; PEP 420 <6>: module path.\n(line   21)\n* Python Enhancement Proposals; PEP 420 <7>: module path.\n(line   21)\n* Python Enhancement Proposals; PEP 420 <8>: References.     (line   11)\n* Python Enhancement Proposals; PEP 420 <9>: References.     (line   13)\n* Python Enhancement Proposals; PEP 420 <10>: References.    (line   13)\n* Python Enhancement Proposals; PEP 420 <11>: Introduction<10>.\n(line   71)\n* Python Enhancement Proposals; PEP 420 <12>: Glossary.      (line  493)\n* Python Enhancement Proposals; PEP 420 <13>: Glossary.      (line  973)\n* Python Enhancement Proposals; PEP 420 <14>: Glossary.      (line 1121)\n* Python Enhancement Proposals; PEP 421: SimpleNamespace.    (line   16)\n* Python Enhancement Proposals; PEP 421 <1>: sys -- System-specific parameters and functions.\n(line 1091)\n* Python Enhancement Proposals; PEP 421 <2>: sys -- System-specific parameters and functions.\n(line 1096)\n* Python Enhancement Proposals; PEP 424: Other Language Changes<9>.\n(line   57)\n* Python Enhancement Proposals; PEP 424 <1>: operator<3>.    (line    8)\n* Python Enhancement Proposals; PEP 428: Summary - Release Highlights<2>.\n(line   39)\n* Python Enhancement Proposals; PEP 428 <1>: pathlib<9>.     (line   17)\n* Python Enhancement Proposals; PEP 428 <2>: pathlib -- Object-oriented filesystem paths.\n(line   41)\n* Python Enhancement Proposals; PEP 429: What's New In Python 3 4.\n(line   16)\n* Python Enhancement Proposals; PEP 432: Other CPython implementation changes.\n(line    7)\n* Python Enhancement Proposals; PEP 432 <1>: Core and Builtins<56>.\n(line  312)\n* Python Enhancement Proposals; PEP 432 <2>: Multi-Phase Initialization Private Provisional API.\n(line    7)\n* Python Enhancement Proposals; PEP 432 <3>: Multi-Phase Initialization Private Provisional API.\n(line   57)\n* Python Enhancement Proposals; PEP 434: PEP 434 IDLE Enhancement Exception for All Branches.\n(line    6)\n* Python Enhancement Proposals; PEP 434 <1>: idlelib.        (line   17)\n* Python Enhancement Proposals; PEP 435: Summary - Release Highlights<2>.\n(line   36)\n* Python Enhancement Proposals; PEP 435 <1>: enum<8>.        (line    6)\n* Python Enhancement Proposals; PEP 435 <2>: enum<8>.        (line   15)\n* Python Enhancement Proposals; PEP 436: Summary - Release Highlights<2>.\n(line  120)\n* Python Enhancement Proposals; PEP 436 <1>: PEP 436 Argument Clinic.\n(line    6)\n* Python Enhancement Proposals; PEP 436 <2>: PEP 436 Argument Clinic.\n(line   28)\n* Python Enhancement Proposals; PEP 441: zipapp<2>.          (line    6)\n* Python Enhancement Proposals; PEP 441 <1>: zipapp<2>.      (line   24)\n* Python Enhancement Proposals; PEP 442: Removed<7>.         (line   69)\n* Python Enhancement Proposals; PEP 442 <1>: Summary - Release Highlights<2>.\n(line  113)\n* Python Enhancement Proposals; PEP 442 <2>: Summary - Release Highlights<2>.\n(line  115)\n* Python Enhancement Proposals; PEP 442 <3>: PEP 442 Safe Object Finalization.\n(line    6)\n* Python Enhancement Proposals; PEP 442 <4>: PEP 442 Safe Object Finalization.\n(line   21)\n* Python Enhancement Proposals; PEP 442 <5>: C API<37>.      (line   55)\n* Python Enhancement Proposals; PEP 442 <6>: gc -- Garbage Collector interface.\n(line  254)\n* Python Enhancement Proposals; PEP 442 <7>: Finalization and De-allocation.\n(line   89)\n* Python Enhancement Proposals; PEP 442 <8>: PyTypeObject Slots.\n(line 1595)\n* Python Enhancement Proposals; PEP 443: Summary - Release Highlights<2>.\n(line   55)\n* Python Enhancement Proposals; PEP 443 <1>: functools<5>.   (line   22)\n* Python Enhancement Proposals; PEP 443 <2>: Glossary.       (line  591)\n* Python Enhancement Proposals; PEP 445: Summary - Release Highlights<2>.\n(line  118)\n* Python Enhancement Proposals; PEP 445 <1>: PEP 445 Customization of CPython Memory Allocators.\n(line    6)\n* Python Enhancement Proposals; PEP 445 <2>: PEP 445 Customization of CPython Memory Allocators.\n(line   12)\n* Python Enhancement Proposals; PEP 445 <3>: Other Improvements<2>.\n(line   63)\n* Python Enhancement Proposals; PEP 446: Summary - Release Highlights<2>.\n(line   14)\n* Python Enhancement Proposals; PEP 446 <1>: Summary - Release Highlights<2>.\n(line   78)\n* Python Enhancement Proposals; PEP 446 <2>: PEP 446 Newly Created File Descriptors Are Non-Inheritable.\n(line    6)\n* Python Enhancement Proposals; PEP 446 <3>: PEP 446 Newly Created File Descriptors Are Non-Inheritable.\n(line   26)\n* Python Enhancement Proposals; PEP 448: PEP 448 - Additional Unpacking Generalizations.\n(line    6)\n* Python Enhancement Proposals; PEP 448 <1>: PEP 448 - Additional Unpacking Generalizations.\n(line   39)\n* Python Enhancement Proposals; PEP 448 <2>: Documentation<66>.\n(line   10)\n* Python Enhancement Proposals; PEP 448 <3>: Documentation<70>.\n(line    9)\n* Python Enhancement Proposals; PEP 448 <4>: Core and Builtins<81>.\n(line   12)\n* Python Enhancement Proposals; PEP 448 <5>: Core and Builtins<84>.\n(line    9)\n* Python Enhancement Proposals; PEP 448 <6>: Dictionary displays.\n(line   29)\n* Python Enhancement Proposals; PEP 448 <7>: Calls.          (line  122)\n* Python Enhancement Proposals; PEP 448 <8>: Expression lists.\n(line   22)\n* Python Enhancement Proposals; PEP 450: Summary - Release Highlights<2>.\n(line   47)\n* Python Enhancement Proposals; PEP 450 <1>: statistics<5>.  (line    6)\n* Python Enhancement Proposals; PEP 450 <2>: statistics<5>.  (line   14)\n* Python Enhancement Proposals; PEP 451: zipimport.          (line    8)\n* Python Enhancement Proposals; PEP 451 <1>: zipimport<2>.   (line    6)\n* Python Enhancement Proposals; PEP 451 <2>: PEP 489 Multi-phase extension module initialization.\n(line    7)\n* Python Enhancement Proposals; PEP 451 <3>: Summary - Release Highlights<2>.\n(line   22)\n* Python Enhancement Proposals; PEP 451 <4>: PEP 451 A ModuleSpec Type for the Import System.\n(line    6)\n* Python Enhancement Proposals; PEP 451 <5>: Library<18>.    (line  457)\n* Python Enhancement Proposals; PEP 451 <6>: Core and Builtins<73>.\n(line   75)\n* Python Enhancement Proposals; PEP 451 <7>: References.     (line   26)\n* Python Enhancement Proposals; PEP 451 <8>: sys -- System-specific parameters and functions.\n(line 1229)\n* Python Enhancement Proposals; PEP 451 <9>: pkgutil -- Package extension utility.\n(line   67)\n* Python Enhancement Proposals; PEP 451 <10>: pkgutil -- Package extension utility.\n(line  101)\n* Python Enhancement Proposals; PEP 451 <11>: runpy -- Locating and executing Python modules.\n(line   91)\n* Python Enhancement Proposals; PEP 451 <12>: runpy -- Locating and executing Python modules.\n(line  169)\n* Python Enhancement Proposals; PEP 451 <13>: runpy -- Locating and executing Python modules.\n(line  187)\n* Python Enhancement Proposals; PEP 451 <14>: Introduction<10>.\n(line   75)\n* Python Enhancement Proposals; PEP 451 <15>: Multi-phase initialization.\n(line   73)\n* Python Enhancement Proposals; PEP 451 <16>: Glossary.      (line  493)\n* Python Enhancement Proposals; PEP 453: Summary - Release Highlights<2>.\n(line   12)\n* Python Enhancement Proposals; PEP 453 <1>: Summary - Release Highlights<2>.\n(line   34)\n* Python Enhancement Proposals; PEP 453 <2>: Bootstrapping pip By Default.\n(line    6)\n* Python Enhancement Proposals; PEP 453 <3>: Documentation Changes.\n(line   21)\n* Python Enhancement Proposals; PEP 453 <4>: ensurepip<2>.   (line    7)\n* Python Enhancement Proposals; PEP 453 <5>: venv<6>.        (line   13)\n* Python Enhancement Proposals; PEP 453 <6>: Other Improvements<2>.\n(line   73)\n* Python Enhancement Proposals; PEP 453 <7>: PEP 477 Backport ensurepip PEP 453 to Python 2 7.\n(line    6)\n* Python Enhancement Proposals; PEP 453 <8>: Bootstrapping pip By Default<2>.\n(line    6)\n* Python Enhancement Proposals; PEP 453 <9>: Documentation Changes<2>.\n(line   21)\n* Python Enhancement Proposals; PEP 453 <10>: ensurepip -- Bootstrapping the pip installer.\n(line   35)\n* Python Enhancement Proposals; PEP 454: Summary - Release Highlights<2>.\n(line   50)\n* Python Enhancement Proposals; PEP 454 <1>: tracemalloc<4>. (line    6)\n* Python Enhancement Proposals; PEP 454 <2>: tracemalloc<4>. (line   22)\n* Python Enhancement Proposals; PEP 456: Summary - Release Highlights<2>.\n(line   75)\n* Python Enhancement Proposals; PEP 456 <1>: PEP 456 Secure and Interchangeable Hash Algorithm.\n(line    6)\n* Python Enhancement Proposals; PEP 456 <2>: PyHash API.     (line   45)\n* Python Enhancement Proposals; PEP 461: PEP 461 - percent formatting support for bytes and bytearray.\n(line    6)\n* Python Enhancement Proposals; PEP 461 <1>: PEP 461 - percent formatting support for bytes and bytearray.\n(line   41)\n* Python Enhancement Proposals; PEP 461 <2>: printf-style Bytes Formatting.\n(line  198)\n* Python Enhancement Proposals; PEP 465: PEP 465 - A dedicated infix operator for matrix multiplication.\n(line    6)\n* Python Enhancement Proposals; PEP 465 <1>: PEP 465 - A dedicated infix operator for matrix multiplication.\n(line   44)\n* Python Enhancement Proposals; PEP 465 <2>: Build and C API Changes<3>.\n(line   43)\n* Python Enhancement Proposals; PEP 465 <3>: Tools/Demos<48>.\n(line   39)\n* Python Enhancement Proposals; PEP 466: PEP 466 Network Security Enhancements for Python 2 7.\n(line    6)\n* Python Enhancement Proposals; PEP 466 <1>: PEP 466 Network Security Enhancements for Python 2 7.\n(line   11)\n* Python Enhancement Proposals; PEP 466 <2>: PEP 466 Network Security Enhancements for Python 2 7.\n(line   21)\n* Python Enhancement Proposals; PEP 466 <3>: PEP 466 Network Security Enhancements for Python 2 7.\n(line   32)\n* Python Enhancement Proposals; PEP 468: PEP 468 Preserving Keyword Argument Order.\n(line   12)\n* Python Enhancement Proposals; PEP 468 <1>: Library<64>.    (line   87)\n* Python Enhancement Proposals; PEP 468 <2>: OrderedDict objects.\n(line  106)\n* Python Enhancement Proposals; PEP 471: PEP 471 - os scandir function - a better and faster directory iterator.\n(line    6)\n* Python Enhancement Proposals; PEP 471 <1>: PEP 471 - os scandir function - a better and faster directory iterator.\n(line   29)\n* Python Enhancement Proposals; PEP 471 <2>: Library<90>.    (line    6)\n* Python Enhancement Proposals; PEP 475: PEP 475 Retry system calls failing with EINTR.\n(line   32)\n* Python Enhancement Proposals; PEP 475 <1>: PEP 475 Retry system calls failing with EINTR.\n(line   77)\n* Python Enhancement Proposals; PEP 475 <2>: Changes in the Python API<8>.\n(line    6)\n* Python Enhancement Proposals; PEP 475 <3>: Library<55>.    (line  228)\n* Python Enhancement Proposals; PEP 475 <4>: Library<88>.    (line  143)\n* Python Enhancement Proposals; PEP 475 <5>: Built-in Functions.\n(line 1357)\n* Python Enhancement Proposals; PEP 475 <6>: OS exceptions.  (line   80)\n* Python Enhancement Proposals; PEP 475 <7>: File Descriptor Operations.\n(line  395)\n* Python Enhancement Proposals; PEP 475 <8>: File Descriptor Operations.\n(line  704)\n* Python Enhancement Proposals; PEP 475 <9>: File Descriptor Operations.\n(line  878)\n* Python Enhancement Proposals; PEP 475 <10>: Process Management.\n(line  917)\n* Python Enhancement Proposals; PEP 475 <11>: Functions<5>.  (line  275)\n* Python Enhancement Proposals; PEP 475 <12>: Socket Objects.\n(line   28)\n* Python Enhancement Proposals; PEP 475 <13>: Socket Objects.\n(line   82)\n* Python Enhancement Proposals; PEP 475 <14>: Socket Objects.\n(line  248)\n* Python Enhancement Proposals; PEP 475 <15>: Socket Objects.\n(line  262)\n* Python Enhancement Proposals; PEP 475 <16>: Socket Objects.\n(line  338)\n* Python Enhancement Proposals; PEP 475 <17>: Socket Objects.\n(line  412)\n* Python Enhancement Proposals; PEP 475 <18>: Socket Objects.\n(line  431)\n* Python Enhancement Proposals; PEP 475 <19>: Socket Objects.\n(line  450)\n* Python Enhancement Proposals; PEP 475 <20>: Socket Objects.\n(line  494)\n* Python Enhancement Proposals; PEP 475 <21>: select -- Waiting for I/O completion.\n(line  160)\n* Python Enhancement Proposals; PEP 475 <22>: /dev/poll Polling Objects.\n(line   82)\n* Python Enhancement Proposals; PEP 475 <23>: Edge and Level Trigger Polling epoll Objects.\n(line  102)\n* Python Enhancement Proposals; PEP 475 <24>: Polling Objects.\n(line   94)\n* Python Enhancement Proposals; PEP 475 <25>: Kqueue Objects.\n(line   36)\n* Python Enhancement Proposals; PEP 475 <26>: Classes<4>.    (line  133)\n* Python Enhancement Proposals; PEP 475 <27>: Module contents<2>.\n(line  587)\n* Python Enhancement Proposals; PEP 475 <28>: Module contents<2>.\n(line  606)\n* Python Enhancement Proposals; PEP 476: PEP 476 Enabling certificate verification by default for stdlib http clients<2>.\n(line    6)\n* Python Enhancement Proposals; PEP 477: PEP 477 Backport ensurepip PEP 453 to Python 2 7.\n(line    6)\n* Python Enhancement Proposals; PEP 478: What's New In Python 3 5.\n(line   17)\n* Python Enhancement Proposals; PEP 479: Changes in Python Behavior.\n(line   11)\n* Python Enhancement Proposals; PEP 479 <1>: PEP 479 Change StopIteration handling inside generators.\n(line   12)\n* Python Enhancement Proposals; PEP 479 <2>: PEP 479 Change StopIteration handling inside generators.\n(line   47)\n* Python Enhancement Proposals; PEP 479 <3>: Library<46>.    (line 1267)\n* Python Enhancement Proposals; PEP 479 <4>: Library<50>.    (line   52)\n* Python Enhancement Proposals; PEP 479 <5>: Core and Builtins<52>.\n(line   34)\n* Python Enhancement Proposals; PEP 479 <6>: Library<58>.    (line   95)\n* Python Enhancement Proposals; PEP 479 <7>: Library<71>.    (line   80)\n* Python Enhancement Proposals; PEP 479 <8>: Library<77>.    (line  326)\n* Python Enhancement Proposals; PEP 479 <9>: Concrete exceptions.\n(line  264)\n* Python Enhancement Proposals; PEP 479 <10>: Concrete exceptions.\n(line  266)\n* Python Enhancement Proposals; PEP 479 <11>: Module Contents<5>.\n(line   36)\n* Python Enhancement Proposals; PEP 483: PEP 484 - Type Hints.\n(line   47)\n* Python Enhancement Proposals; PEP 483 <1>: Glossary.       (line  599)\n* Python Enhancement Proposals; PEP 484: PEP 695 Type Parameter Syntax.\n(line    6)\n* Python Enhancement Proposals; PEP 484 <1>: New Features Related to Type Hints.\n(line    6)\n* Python Enhancement Proposals; PEP 484 <2>: PEP 692 Using TypedDict for more precise kwargs typing.\n(line    6)\n* Python Enhancement Proposals; PEP 484 <3>: New Features Related to Type Hints<2>.\n(line    6)\n* Python Enhancement Proposals; PEP 484 <4>: PEP 646 Variadic generics.\n(line    6)\n* Python Enhancement Proposals; PEP 484 <5>: New Features Related to Type Hints<3>.\n(line    6)\n* Python Enhancement Proposals; PEP 484 <6>: PEP 612 Parameter Specification Variables.\n(line    7)\n* Python Enhancement Proposals; PEP 484 <7>: PEP 613 TypeAlias.\n(line    6)\n* Python Enhancement Proposals; PEP 484 <8>: ast<2>.         (line   17)\n* Python Enhancement Proposals; PEP 484 <9>: ast<2>.         (line   20)\n* Python Enhancement Proposals; PEP 484 <10>: PEP 560 Core Support for typing module and Generic Types.\n(line    6)\n* Python Enhancement Proposals; PEP 484 <11>: PEP 526 Syntax for variable annotations.\n(line    6)\n* Python Enhancement Proposals; PEP 484 <12>: PEP 484 - Type Hints.\n(line   16)\n* Python Enhancement Proposals; PEP 484 <13>: PEP 484 - Type Hints.\n(line   41)\n* Python Enhancement Proposals; PEP 484 <14>: Function Annotations.\n(line    8)\n* Python Enhancement Proposals; PEP 484 <15>: Emulating generic types.\n(line   15)\n* Python Enhancement Proposals; PEP 484 <16>: Annotated assignment statements.\n(line   45)\n* Python Enhancement Proposals; PEP 484 <17>: Function definitions.\n(line  144)\n* Python Enhancement Proposals; PEP 484 <18>: Special Attributes of GenericAlias objects.\n(line   50)\n* Python Enhancement Proposals; PEP 484 <19>: NewType.       (line   63)\n* Python Enhancement Proposals; PEP 484 <20>: Nominal vs structural subtyping.\n(line    6)\n* Python Enhancement Proposals; PEP 484 <21>: Nominal vs structural subtyping.\n(line   14)\n* Python Enhancement Proposals; PEP 484 <22>: Building generic types and type aliases.\n(line  112)\n* Python Enhancement Proposals; PEP 484 <23>: Functions and decorators.\n(line  280)\n* Python Enhancement Proposals; PEP 484 <24>: Root nodes.    (line   61)\n* Python Enhancement Proposals; PEP 484 <25>: ast Helpers.   (line   16)\n* Python Enhancement Proposals; PEP 484 <26>: ast Helpers.   (line   27)\n* Python Enhancement Proposals; PEP 484 <27>: Compiler Flags.\n(line   23)\n* Python Enhancement Proposals; PEP 484 <28>: Glossary.      (line   61)\n* Python Enhancement Proposals; PEP 484 <29>: Glossary.      (line  526)\n* Python Enhancement Proposals; PEP 484 <30>: Glossary.      (line  599)\n* Python Enhancement Proposals; PEP 484 <31>: Glossary.      (line 1367)\n* Python Enhancement Proposals; PEP 484 <32>: Glossary.      (line 1384)\n* Python Enhancement Proposals; PEP 484 <33>: Glossary.      (line 1414)\n* Python Enhancement Proposals; PEP 484#annotating-instance-and-class-methods: PEP 673 Self type.\n(line    8)\n* Python Enhancement Proposals; PEP 485: PEP 485 A function for testing approximate equality.\n(line    6)\n* Python Enhancement Proposals; PEP 485 <1>: PEP 485 A function for testing approximate equality.\n(line   36)\n* Python Enhancement Proposals; PEP 485 <2>: Library<86>.    (line   10)\n* Python Enhancement Proposals; PEP 485 <3>: Number-theoretic and representation functions.\n(line  137)\n* Python Enhancement Proposals; PEP 485 <4>: Classification functions.\n(line   54)\n* Python Enhancement Proposals; PEP 486: PEP 486 Make the Python Launcher aware of virtual environments.\n(line    6)\n* Python Enhancement Proposals; PEP 486 <1>: PEP 486 Make the Python Launcher aware of virtual environments.\n(line   14)\n* Python Enhancement Proposals; PEP 486 <2>: Windows<69>.    (line    6)\n* Python Enhancement Proposals; PEP 487: PEP 487 Simpler customization of class creation.\n(line   32)\n* Python Enhancement Proposals; PEP 487 <1>: PEP 487 Descriptor Protocol Enhancements.\n(line    6)\n* Python Enhancement Proposals; PEP 487 <2>: PEP 487 Descriptor Protocol Enhancements.\n(line   33)\n* Python Enhancement Proposals; PEP 487 <3>: Changes in the Python API<7>.\n(line  104)\n* Python Enhancement Proposals; PEP 487 <4>: Documentation<56>.\n(line   52)\n* Python Enhancement Proposals; PEP 487 <5>: Documentation<63>.\n(line    8)\n* Python Enhancement Proposals; PEP 487 <6>: Core and Builtins<70>.\n(line   46)\n* Python Enhancement Proposals; PEP 488: PEP 488 Elimination of PYO files.\n(line    6)\n* Python Enhancement Proposals; PEP 488 <1>: PEP 488 Elimination of PYO files.\n(line   20)\n* Python Enhancement Proposals; PEP 488 <2>: Changes in the Python API<8>.\n(line   79)\n* Python Enhancement Proposals; PEP 488 <3>: Core and Builtins<88>.\n(line   15)\n* Python Enhancement Proposals; PEP 488 <4>: Miscellaneous options.\n(line   78)\n* Python Enhancement Proposals; PEP 488 <5>: Miscellaneous options.\n(line   80)\n* Python Enhancement Proposals; PEP 488 <6>: Miscellaneous options.\n(line   87)\n* Python Enhancement Proposals; PEP 488 <7>: Miscellaneous options.\n(line   89)\n* Python Enhancement Proposals; PEP 488 <8>: test support importhelper -- Utilities for import tests.\n(line   82)\n* Python Enhancement Proposals; PEP 488 <9>: Introduction<10>.\n(line   79)\n* Python Enhancement Proposals; PEP 488 <10>: importlib util - Utility code for importers.\n(line   24)\n* Python Enhancement Proposals; PEP 488 <11>: importlib util - Utility code for importers.\n(line   64)\n* Python Enhancement Proposals; PEP 488 <12>: pycompile -- Compile Python source files.\n(line   31)\n* Python Enhancement Proposals; PEP 489: PEP 489 Multi-phase extension module initialization.\n(line    6)\n* Python Enhancement Proposals; PEP 489 <1>: PEP 489 Multi-phase extension module initialization.\n(line   18)\n* Python Enhancement Proposals; PEP 489 <2>: Build and C API Changes<3>.\n(line   37)\n* Python Enhancement Proposals; PEP 489 <3>: Library<14>.    (line   20)\n* Python Enhancement Proposals; PEP 489 <4>: Library<30>.    (line   64)\n* Python Enhancement Proposals; PEP 489 <5>: Library<30>.    (line   79)\n* Python Enhancement Proposals; PEP 489 <6>: Core and Builtins<31>.\n(line   70)\n* Python Enhancement Proposals; PEP 489 <7>: Library<31>.    (line   68)\n* Python Enhancement Proposals; PEP 489 <8>: Library<31>.    (line  177)\n* Python Enhancement Proposals; PEP 489 <9>: Core and Builtins<32>.\n(line   50)\n* Python Enhancement Proposals; PEP 489 <10>: Library<32>.   (line  103)\n* Python Enhancement Proposals; PEP 489 <11>: C API<28>.     (line   11)\n* Python Enhancement Proposals; PEP 489 <12>: C API<28>.     (line   14)\n* Python Enhancement Proposals; PEP 489 <13>: C API<28>.     (line   17)\n* Python Enhancement Proposals; PEP 489 <14>: C API<28>.     (line   20)\n* Python Enhancement Proposals; PEP 489 <15>: C API<28>.     (line   23)\n* Python Enhancement Proposals; PEP 489 <16>: C API<28>.     (line   26)\n* Python Enhancement Proposals; PEP 489 <17>: C API<28>.     (line   29)\n* Python Enhancement Proposals; PEP 489 <18>: C API<28>.     (line   38)\n* Python Enhancement Proposals; PEP 489 <19>: C API<28>.     (line   41)\n* Python Enhancement Proposals; PEP 489 <20>: C API<28>.     (line   44)\n* Python Enhancement Proposals; PEP 489 <21>: C API<28>.     (line   47)\n* Python Enhancement Proposals; PEP 489 <22>: Library<33>.   (line   31)\n* Python Enhancement Proposals; PEP 489 <23>: Core and Builtins<34>.\n(line   20)\n* Python Enhancement Proposals; PEP 489 <24>: Core and Builtins<34>.\n(line   30)\n* Python Enhancement Proposals; PEP 489 <25>: Core and Builtins<34>.\n(line   33)\n* Python Enhancement Proposals; PEP 489 <26>: Core and Builtins<34>.\n(line   36)\n* Python Enhancement Proposals; PEP 489 <27>: Core and Builtins<34>.\n(line   39)\n* Python Enhancement Proposals; PEP 489 <28>: Core and Builtins<34>.\n(line   49)\n* Python Enhancement Proposals; PEP 489 <29>: Core and Builtins<34>.\n(line   52)\n* Python Enhancement Proposals; PEP 489 <30>: Core and Builtins<34>.\n(line   55)\n* Python Enhancement Proposals; PEP 489 <31>: Core and Builtins<34>.\n(line   74)\n* Python Enhancement Proposals; PEP 489 <32>: Core and Builtins<34>.\n(line   90)\n* Python Enhancement Proposals; PEP 489 <33>: Core and Builtins<34>.\n(line  102)\n* Python Enhancement Proposals; PEP 489 <34>: Library<34>.   (line   75)\n* Python Enhancement Proposals; PEP 489 <35>: Library<34>.   (line   78)\n* Python Enhancement Proposals; PEP 489 <36>: Library<34>.   (line  423)\n* Python Enhancement Proposals; PEP 489 <37>: Core and Builtins<35>.\n(line   28)\n* Python Enhancement Proposals; PEP 489 <38>: Core and Builtins<35>.\n(line   35)\n* Python Enhancement Proposals; PEP 489 <39>: Core and Builtins<35>.\n(line   50)\n* Python Enhancement Proposals; PEP 489 <40>: Core and Builtins<36>.\n(line   46)\n* Python Enhancement Proposals; PEP 489 <41>: Core and Builtins<36>.\n(line   49)\n* Python Enhancement Proposals; PEP 489 <42>: Core and Builtins<36>.\n(line   51)\n* Python Enhancement Proposals; PEP 489 <43>: Core and Builtins<36>.\n(line   71)\n* Python Enhancement Proposals; PEP 489 <44>: Core and Builtins<36>.\n(line   75)\n* Python Enhancement Proposals; PEP 489 <45>: Core and Builtins<37>.\n(line   17)\n* Python Enhancement Proposals; PEP 489 <46>: Core and Builtins<37>.\n(line   20)\n* Python Enhancement Proposals; PEP 489 <47>: Core and Builtins<37>.\n(line   40)\n* Python Enhancement Proposals; PEP 489 <48>: Core and Builtins<37>.\n(line   54)\n* Python Enhancement Proposals; PEP 489 <49>: Core and Builtins<37>.\n(line  109)\n* Python Enhancement Proposals; PEP 489 <50>: Core and Builtins<37>.\n(line  118)\n* Python Enhancement Proposals; PEP 489 <51>: Core and Builtins<38>.\n(line   29)\n* Python Enhancement Proposals; PEP 489 <52>: Core and Builtins<38>.\n(line   32)\n* Python Enhancement Proposals; PEP 489 <53>: Core and Builtins<38>.\n(line   52)\n* Python Enhancement Proposals; PEP 489 <54>: Core and Builtins<38>.\n(line   55)\n* Python Enhancement Proposals; PEP 489 <55>: Core and Builtins<38>.\n(line   58)\n* Python Enhancement Proposals; PEP 489 <56>: Core and Builtins<39>.\n(line   62)\n* Python Enhancement Proposals; PEP 489 <57>: Introduction<10>.\n(line   83)\n* Python Enhancement Proposals; PEP 489 <58>: importlib machinery - Importers and path hooks.\n(line   77)\n* Python Enhancement Proposals; PEP 489 <59>: importlib machinery - Importers and path hooks.\n(line  298)\n* Python Enhancement Proposals; PEP 489 <60>: importlib machinery - Importers and path hooks.\n(line  317)\n* Python Enhancement Proposals; PEP 489 <61>: importlib machinery - Importers and path hooks.\n(line  323)\n* Python Enhancement Proposals; PEP 489 <62>: importlib util - Utility code for importers.\n(line  183)\n* Python Enhancement Proposals; PEP 489 <63>: The Module's Method Table and Initialization Function.\n(line  129)\n* Python Enhancement Proposals; PEP 489 <64>: Building C and C++ Extensions.\n(line   40)\n* Python Enhancement Proposals; PEP 489 <65>: Multi-phase initialization.\n(line  140)\n* Python Enhancement Proposals; PEP 489 <66>: Sub-interpreter support.\n(line   81)\n* Python Enhancement Proposals; PEP 492: PEP 525 Asynchronous Generators.\n(line    6)\n* Python Enhancement Proposals; PEP 492 <1>: New Keywords.   (line    7)\n* Python Enhancement Proposals; PEP 492 <2>: PEP 492 - Coroutines with async and await syntax.\n(line    6)\n* Python Enhancement Proposals; PEP 492 <3>: PEP 492 - Coroutines with async and await syntax.\n(line   97)\n* Python Enhancement Proposals; PEP 492 <4>: New Keywords<2>.\n(line    7)\n* Python Enhancement Proposals; PEP 492 <5>: Changes in the C API<6>.\n(line   25)\n* Python Enhancement Proposals; PEP 492 <6>: Core and Builtins<55>.\n(line   98)\n* Python Enhancement Proposals; PEP 492 <7>: Library<72>.    (line   51)\n* Python Enhancement Proposals; PEP 492 <8>: Library<78>.    (line   16)\n* Python Enhancement Proposals; PEP 492 <9>: Core and Builtins<85>.\n(line   14)\n* Python Enhancement Proposals; PEP 492 <10>: Awaitable Objects.\n(line   32)\n* Python Enhancement Proposals; PEP 492 <11>: Yield expressions.\n(line  107)\n* Python Enhancement Proposals; PEP 492 <12>: The async with statement.\n(line   45)\n* Python Enhancement Proposals; PEP 492 <13>: Collections Abstract Base Classes - Detailed Descriptions.\n(line  156)\n* Python Enhancement Proposals; PEP 492 <14>: Code Objects Bit Flags.\n(line   38)\n* Python Enhancement Proposals; PEP 492 <15>: Code Objects Bit Flags.\n(line   47)\n* Python Enhancement Proposals; PEP 492 <16>: Glossary.      (line  102)\n* Python Enhancement Proposals; PEP 492 <17>: Glossary.      (line  135)\n* Python Enhancement Proposals; PEP 492 <18>: Glossary.      (line  142)\n* Python Enhancement Proposals; PEP 492 <19>: Glossary.      (line  151)\n* Python Enhancement Proposals; PEP 492 <20>: Glossary.      (line  169)\n* Python Enhancement Proposals; PEP 492 <21>: Glossary.      (line  310)\n* Python Enhancement Proposals; PEP 492 <22>: Glossary.      (line  317)\n* Python Enhancement Proposals; PEP 493: PEP 493 HTTPS verification migration tools for Python 2 7.\n(line    6)\n* Python Enhancement Proposals; PEP 494: What's New In Python 3 6.\n(line   17)\n* Python Enhancement Proposals; PEP 495: PEP 495 Local Time Disambiguation.\n(line   13)\n* Python Enhancement Proposals; PEP 495 <1>: PEP 495 Local Time Disambiguation.\n(line   36)\n* Python Enhancement Proposals; PEP 495 <2>: Library<70>.    (line   96)\n* Python Enhancement Proposals; PEP 495 <3>: Using ZoneInfo. (line   34)\n* Python Enhancement Proposals; PEP 498: PEP 498 Formatted string literals.\n(line    6)\n* Python Enhancement Proposals; PEP 498 <1>: PEP 498 Formatted string literals.\n(line   27)\n* Python Enhancement Proposals; PEP 498 <2>: Core and Builtins<73>.\n(line  283)\n* Python Enhancement Proposals; PEP 498 <3>: f-strings.      (line  154)\n* Python Enhancement Proposals; PEP 498 <4>: Glossary.       (line  442)\n* Python Enhancement Proposals; PEP 5:   PEP 230 Warning Framework.\n(line   66)\n* Python Enhancement Proposals; PEP 5 <1>: Is it reasonable to propose incompatible changes to Python?.\n(line   14)\n* Python Enhancement Proposals; PEP 506: secrets.            (line   19)\n* Python Enhancement Proposals; PEP 506 <1>: Library<73>.    (line   60)\n* Python Enhancement Proposals; PEP 506 <2>: secrets -- Generate secure random numbers for managing secrets.\n(line   24)\n* Python Enhancement Proposals; PEP 511: Changes in the Python API<7>.\n(line   33)\n* Python Enhancement Proposals; PEP 514: Windows py exe launcher improvements.\n(line    8)\n* Python Enhancement Proposals; PEP 514 <1>: Windows<18>.    (line   12)\n* Python Enhancement Proposals; PEP 514 <2>: Windows<61>.    (line    8)\n* Python Enhancement Proposals; PEP 514 <3>: From the command-line.\n(line   45)\n* Python Enhancement Proposals; PEP 515: fractions<2>.       (line    6)\n* Python Enhancement Proposals; PEP 515 <1>: PEP 515 Underscores in Numeric Literals.\n(line    6)\n* Python Enhancement Proposals; PEP 515 <2>: PEP 515 Underscores in Numeric Literals.\n(line   32)\n* Python Enhancement Proposals; PEP 515 <3>: Core and Builtins<69>.\n(line   15)\n* Python Enhancement Proposals; PEP 515 <4>: Core and Builtins<69>.\n(line   43)\n* Python Enhancement Proposals; PEP 515 <5>: Format Specification Mini-Language.\n(line  117)\n* Python Enhancement Proposals; PEP 515 <6>: fractions -- Rational numbers.\n(line   97)\n* Python Enhancement Proposals; PEP 519: PEP 519 Adding a file system path protocol.\n(line   62)\n* Python Enhancement Proposals; PEP 519 <1>: Library<70>.    (line    6)\n* Python Enhancement Proposals; PEP 519 <2>: Core and Builtins<72>.\n(line   19)\n* Python Enhancement Proposals; PEP 519 <3>: Library<72>.    (line   31)\n* Python Enhancement Proposals; PEP 519 <4>: Library<72>.    (line   42)\n* Python Enhancement Proposals; PEP 519 <5>: Library<72>.    (line   44)\n* Python Enhancement Proposals; PEP 519 <6>: C API<58>.      (line    6)\n* Python Enhancement Proposals; PEP 519 <7>: Glossary.       (line 1100)\n* Python Enhancement Proposals; PEP 520: PEP 520 Preserving Class Attribute Definition Order.\n(line   17)\n* Python Enhancement Proposals; PEP 523: New Features<2>.    (line   19)\n* Python Enhancement Proposals; PEP 523 <1>: Porting to Python 3 11<2>.\n(line   33)\n* Python Enhancement Proposals; PEP 523 <2>: Porting to Python 3 9<2>.\n(line    6)\n* Python Enhancement Proposals; PEP 523 <3>: PEP 523 Adding a frame evaluation API to CPython.\n(line   12)\n* Python Enhancement Proposals; PEP 523 <4>: PEP 523 Adding a frame evaluation API to CPython.\n(line   26)\n* Python Enhancement Proposals; PEP 523 <5>: Core and Builtins<11>.\n(line   26)\n* Python Enhancement Proposals; PEP 523 <6>: Tools/Demos<30>.\n(line    7)\n* Python Enhancement Proposals; PEP 523 <7>: Tools/Demos<34>.\n(line    7)\n* Python Enhancement Proposals; PEP 523 <8>: Core and Builtins<69>.\n(line   83)\n* Python Enhancement Proposals; PEP 523 <9>: Internal Frames.\n(line    6)\n* Python Enhancement Proposals; PEP 523 <10>: Low-level API. (line  171)\n* Python Enhancement Proposals; PEP 523 <11>: Low-level API. (line  180)\n* Python Enhancement Proposals; PEP 524: Summary - Release highlights<6>.\n(line   77)\n* Python Enhancement Proposals; PEP 524 <1>: os<7>.          (line   20)\n* Python Enhancement Proposals; PEP 524 <2>: os<7>.          (line   25)\n* Python Enhancement Proposals; PEP 524 <3>: Library<69>.    (line  150)\n* Python Enhancement Proposals; PEP 524 <4>: Library<69>.    (line  154)\n* Python Enhancement Proposals; PEP 524 <5>: Random numbers<2>.\n(line   42)\n* Python Enhancement Proposals; PEP 525: PEP 525 Asynchronous Generators.\n(line   23)\n* Python Enhancement Proposals; PEP 525 <1>: Core and Builtins<69>.\n(line   49)\n* Python Enhancement Proposals; PEP 525 <2>: Yield expressions.\n(line  105)\n* Python Enhancement Proposals; PEP 525 <3>: Collections Abstract Base Classes - Detailed Descriptions.\n(line  156)\n* Python Enhancement Proposals; PEP 525 <4>: sys -- System-specific parameters and functions.\n(line  973)\n* Python Enhancement Proposals; PEP 525 <5>: sys -- System-specific parameters and functions.\n(line 1664)\n* Python Enhancement Proposals; PEP 525 <6>: Code Objects Bit Flags.\n(line   56)\n* Python Enhancement Proposals; PEP 525 <7>: Glossary.       (line  136)\n* Python Enhancement Proposals; PEP 526: Other Language Changes<3>.\n(line   56)\n* Python Enhancement Proposals; PEP 526 <1>: ast<2>.         (line   18)\n* Python Enhancement Proposals; PEP 526 <2>: PEP 563 Postponed Evaluation of Annotations.\n(line    8)\n* Python Enhancement Proposals; PEP 526 <3>: PEP 526 Syntax for variable annotations.\n(line   30)\n* Python Enhancement Proposals; PEP 526 <4>: typing<7>.      (line   23)\n* Python Enhancement Proposals; PEP 526 <5>: Core and Builtins<69>.\n(line   51)\n* Python Enhancement Proposals; PEP 526 <6>: Annotated assignment statements.\n(line   39)\n* Python Enhancement Proposals; PEP 526 <7>: Function definitions.\n(line  148)\n* Python Enhancement Proposals; PEP 526 <8>: Special forms.  (line  162)\n* Python Enhancement Proposals; PEP 526 <9>: Other special directives.\n(line   69)\n* Python Enhancement Proposals; PEP 526 <10>: Other special directives.\n(line  239)\n* Python Enhancement Proposals; PEP 526 <11>: dataclasses -- Data Classes.\n(line   16)\n* Python Enhancement Proposals; PEP 526 <12>: Class variables.\n(line    8)\n* Python Enhancement Proposals; PEP 526 <13>: ast Helpers.   (line   16)\n* Python Enhancement Proposals; PEP 526 <14>: Compiler Flags.\n(line   23)\n* Python Enhancement Proposals; PEP 526 <15>: Glossary.      (line   61)\n* Python Enhancement Proposals; PEP 526 <16>: Glossary.      (line 1414)\n* Python Enhancement Proposals; PEP 528: PEP 528 Change Windows console encoding to UTF-8.\n(line   17)\n* Python Enhancement Proposals; PEP 528 <1>: UTF-8 mode.     (line   34)\n* Python Enhancement Proposals; PEP 528 <2>: Global configuration variables.\n(line  172)\n* Python Enhancement Proposals; PEP 528 <3>: PyConfig.       (line  514)\n* Python Enhancement Proposals; PEP 529: Changes in the Python API<4>.\n(line    7)\n* Python Enhancement Proposals; PEP 529 <1>: PEP 529 Change Windows filesystem encoding to UTF-8.\n(line   22)\n* Python Enhancement Proposals; PEP 529 <2>: Documentation<19>.\n(line   29)\n* Python Enhancement Proposals; PEP 529 <3>: Library<41>.    (line  619)\n* Python Enhancement Proposals; PEP 529 <4>: Windows<56>.    (line   14)\n* Python Enhancement Proposals; PEP 529 <5>: Environment variables.\n(line  332)\n* Python Enhancement Proposals; PEP 529 <6>: UTF-8 mode.     (line   37)\n* Python Enhancement Proposals; PEP 529 <7>: Files and Directories.\n(line  295)\n* Python Enhancement Proposals; PEP 529 <8>: sys -- System-specific parameters and functions.\n(line  784)\n* Python Enhancement Proposals; PEP 529 <9>: sys -- System-specific parameters and functions.\n(line 1740)\n* Python Enhancement Proposals; PEP 529 <10>: File System Encoding.\n(line    7)\n* Python Enhancement Proposals; PEP 529 <11>: Global configuration variables.\n(line  154)\n* Python Enhancement Proposals; PEP 530: PEP 530 Asynchronous Comprehensions.\n(line    6)\n* Python Enhancement Proposals; PEP 530 <1>: PEP 530 Asynchronous Comprehensions.\n(line   19)\n* Python Enhancement Proposals; PEP 530 <2>: Core and Builtins<69>.\n(line  145)\n* Python Enhancement Proposals; PEP 530 <3>: Displays for lists sets and dictionaries.\n(line   54)\n* Python Enhancement Proposals; PEP 538: PEP 538 Legacy C Locale Coercion.\n(line   11)\n* Python Enhancement Proposals; PEP 538 <1>: PEP 538 Legacy C Locale Coercion.\n(line   36)\n* Python Enhancement Proposals; PEP 538 <2>: PEP 538 Legacy C Locale Coercion.\n(line   48)\n* Python Enhancement Proposals; PEP 538 <3>: PEP 540 Forced UTF-8 Runtime Mode.\n(line   27)\n* Python Enhancement Proposals; PEP 538 <4>: Documentation<46>.\n(line   68)\n* Python Enhancement Proposals; PEP 538 <5>: Documentation<47>.\n(line    6)\n* Python Enhancement Proposals; PEP 538 <6>: Core and Builtins<56>.\n(line  134)\n* Python Enhancement Proposals; PEP 538 <7>: Environment variables.\n(line  401)\n* Python Enhancement Proposals; PEP 538 <8>: General Options.\n(line   88)\n* Python Enhancement Proposals; PEP 538 <9>: locale -- Internationalization services.\n(line  522)\n* Python Enhancement Proposals; PEP 538 <10>: Python Configuration.\n(line   13)\n* Python Enhancement Proposals; PEP 539: PEP 539 New C API for Thread-Local Storage.\n(line   12)\n* Python Enhancement Proposals; PEP 539 <1>: PEP 539 New C API for Thread-Local Storage.\n(line   30)\n* Python Enhancement Proposals; PEP 539 <2>: C API<47>.      (line   13)\n* Python Enhancement Proposals; PEP 539 <3>: Thread Specific Storage TSS API.\n(line   15)\n* Python Enhancement Proposals; PEP 540: PEP 540 Forced UTF-8 Runtime Mode.\n(line   18)\n* Python Enhancement Proposals; PEP 540 <1>: PEP 540 Forced UTF-8 Runtime Mode.\n(line   35)\n* Python Enhancement Proposals; PEP 540 <2>: Core and Builtins<53>.\n(line   63)\n* Python Enhancement Proposals; PEP 540 <3>: Python UTF-8 Mode.\n(line    6)\n* Python Enhancement Proposals; PEP 540 <4>: locale -- Internationalization services.\n(line  522)\n* Python Enhancement Proposals; PEP 540 <5>: Python Configuration.\n(line   14)\n* Python Enhancement Proposals; PEP 544: typing<6>.          (line   32)\n* Python Enhancement Proposals; PEP 544 <1>: Nominal vs structural subtyping.\n(line   23)\n* Python Enhancement Proposals; PEP 544 <2>: Other special directives.\n(line  137)\n* Python Enhancement Proposals; PEP 545: PEP 545 Python Documentation Translations.\n(line    6)\n* Python Enhancement Proposals; PEP 545 <1>: PEP 545 Python Documentation Translations.\n(line   20)\n* Python Enhancement Proposals; PEP 552: Other CPython Implementation Changes.\n(line   16)\n* Python Enhancement Proposals; PEP 552 <1>: PEP 552 Hash-based pyc Files.\n(line   15)\n* Python Enhancement Proposals; PEP 552 <2>: PEP 552 Hash-based pyc Files.\n(line   35)\n* Python Enhancement Proposals; PEP 552 <3>: Library<46>.    (line  794)\n* Python Enhancement Proposals; PEP 552 <4>: Core and Builtins<53>.\n(line   75)\n* Python Enhancement Proposals; PEP 552 <5>: Introduction<10>.\n(line   87)\n* Python Enhancement Proposals; PEP 552 <6>: pycompile -- Compile Python source files.\n(line   82)\n* Python Enhancement Proposals; PEP 552 <7>: PyConfig.       (line  263)\n* Python Enhancement Proposals; PEP 553: PEP 553 Built-in breakpoint.\n(line   20)\n* Python Enhancement Proposals; PEP 553 <1>: Core and Builtins<55>.\n(line   72)\n* Python Enhancement Proposals; PEP 554: PEP 684 A Per-Interpreter GIL.\n(line   10)\n* Python Enhancement Proposals; PEP 554 <1>: A Per-Interpreter GIL.\n(line   13)\n* Python Enhancement Proposals; PEP 557: dataclasses<3>.     (line   26)\n* Python Enhancement Proposals; PEP 557 <1>: dataclasses -- Data Classes.\n(line   13)\n* Python Enhancement Proposals; PEP 560: PEP 560 Core Support for typing module and Generic Types.\n(line   19)\n* Python Enhancement Proposals; PEP 560 <1>: types<3>.       (line   12)\n* Python Enhancement Proposals; PEP 560 <2>: Core and Builtins<53>.\n(line   66)\n* Python Enhancement Proposals; PEP 560 <3>: Resolving MRO entries.\n(line   30)\n* Python Enhancement Proposals; PEP 560 <4>: classgetitem versus getitem.\n(line   85)\n* Python Enhancement Proposals; PEP 560 <5>: Dynamic Type Creation.\n(line   60)\n* Python Enhancement Proposals; PEP 560 <6>: Dynamic Type Creation.\n(line   76)\n* Python Enhancement Proposals; PEP 560 <7>: Dynamic Type Creation.\n(line  114)\n* Python Enhancement Proposals; PEP 562: PEP 562 Customization of Access to Module Attributes.\n(line   16)\n* Python Enhancement Proposals; PEP 562 <1>: Library<53>.    (line   63)\n* Python Enhancement Proposals; PEP 562 <2>: Core and Builtins<53>.\n(line   69)\n* Python Enhancement Proposals; PEP 562 <3>: Customizing module attribute access.\n(line   52)\n* Python Enhancement Proposals; PEP 563: PEP 563 may not be the future.\n(line    6)\n* Python Enhancement Proposals; PEP 563 <1>: PEP 563 Postponed Evaluation of Annotations.\n(line   51)\n* Python Enhancement Proposals; PEP 563 <2>: Library<27>.    (line  300)\n* Python Enhancement Proposals; PEP 563 <3>: Core and Builtins<33>.\n(line   83)\n* Python Enhancement Proposals; PEP 563 <4>: Future statements.\n(line   34)\n* Python Enhancement Proposals; PEP 563 <5>: Function definitions.\n(line  153)\n* Python Enhancement Proposals; PEP 563 <6>: Introspection helpers.\n(line   33)\n* Python Enhancement Proposals; PEP 563 <7>: Constant.       (line   29)\n* Python Enhancement Proposals; PEP 563 <8>: Module Contents<5>.\n(line  124)\n* Python Enhancement Proposals; PEP 563 <9>: Module Contents<5>.\n(line   40)\n* Python Enhancement Proposals; PEP 564: PEP 564 New Time Functions With Nanosecond Resolution.\n(line    8)\n* Python Enhancement Proposals; PEP 564 <1>: PEP 564 New Time Functions With Nanosecond Resolution.\n(line   33)\n* Python Enhancement Proposals; PEP 564 <2>: time<4>.        (line    6)\n* Python Enhancement Proposals; PEP 564 <3>: Library<55>.    (line  299)\n* Python Enhancement Proposals; PEP 565: PEP 565 Show DeprecationWarning in main.\n(line   41)\n* Python Enhancement Proposals; PEP 565 <1>: Warnings.       (line   23)\n* Python Enhancement Proposals; PEP 566: Distribution metadata.\n(line   19)\n* Python Enhancement Proposals; PEP 567: contextvars.        (line   20)\n* Python Enhancement Proposals; PEP 567 <1>: asyncio<6>.     (line   19)\n* Python Enhancement Proposals; PEP 567 <2>: Documentation<46>.\n(line   86)\n* Python Enhancement Proposals; PEP 567 <3>: Documentation<48>.\n(line    9)\n* Python Enhancement Proposals; PEP 567 <4>: Core and Builtins<52>.\n(line   63)\n* Python Enhancement Proposals; PEP 567 <5>: contextvars -- Context Variables.\n(line   18)\n* Python Enhancement Proposals; PEP 567 <6>: Scheduling callbacks.\n(line   38)\n* Python Enhancement Proposals; PEP 567 <7>: Scheduling delayed callbacks.\n(line   31)\n* Python Enhancement Proposals; PEP 567 <8>: Scheduling delayed callbacks.\n(line   49)\n* Python Enhancement Proposals; PEP 567 <9>: Future Object.  (line  104)\n* Python Enhancement Proposals; PEP 570: Positional-only parameters.\n(line   70)\n* Python Enhancement Proposals; PEP 570 <1>: Changes in the Python API<4>.\n(line  160)\n* Python Enhancement Proposals; PEP 570 <2>: Core and Builtins<43>.\n(line   36)\n* Python Enhancement Proposals; PEP 570 <3>: Function definitions.\n(line  104)\n* Python Enhancement Proposals; PEP 572: Other Language Changes.\n(line   31)\n* Python Enhancement Proposals; PEP 572 <1>: Assignment expressions.\n(line   41)\n* Python Enhancement Proposals; PEP 572 <2>: CPython bytecode changes<5>.\n(line   27)\n* Python Enhancement Proposals; PEP 572 <3>: Core and Builtins<15>.\n(line   40)\n* Python Enhancement Proposals; PEP 572 <4>: Documentation<37>.\n(line    6)\n* Python Enhancement Proposals; PEP 572 <5>: Core and Builtins<41>.\n(line  184)\n* Python Enhancement Proposals; PEP 572 <6>: Core and Builtins<46>.\n(line   92)\n* Python Enhancement Proposals; PEP 572 <7>: Dictionary displays.\n(line   47)\n* Python Enhancement Proposals; PEP 572 <8>: Assignment expressions<2>.\n(line   29)\n* Python Enhancement Proposals; PEP 572 <9>: Capture Patterns.\n(line   17)\n* Python Enhancement Proposals; PEP 572 <10>: Why can't I use an assignment in an expression?.\n(line   14)\n* Python Enhancement Proposals; PEP 573: Summary - Release highlights<4>.\n(line   27)\n* Python Enhancement Proposals; PEP 573 <1>: New Features<8>.\n(line    6)\n* Python Enhancement Proposals; PEP 573 <2>: Core and Builtins<35>.\n(line   19)\n* Python Enhancement Proposals; PEP 573 <3>: C API<31>.      (line   57)\n* Python Enhancement Proposals; PEP 574: Pickle protocol 5 with out-of-band data buffers.\n(line   17)\n* Python Enhancement Proposals; PEP 574 <1>: Data stream format.\n(line   46)\n* Python Enhancement Proposals; PEP 574 <2>: Example<4>.     (line   63)\n* Python Enhancement Proposals; PEP 578: PEP 578 Python Runtime Audit Hooks.\n(line   12)\n* Python Enhancement Proposals; PEP 578 <1>: Audit events table.\n(line    8)\n* Python Enhancement Proposals; PEP 578 <2>: sys -- System-specific parameters and functions.\n(line   57)\n* Python Enhancement Proposals; PEP 578 <3>: System Functions.\n(line  176)\n* Python Enhancement Proposals; PEP 584: Summary - Release highlights<4>.\n(line    8)\n* Python Enhancement Proposals; PEP 584 <1>: Dictionary Merge & Update Operators.\n(line   19)\n* Python Enhancement Proposals; PEP 584 <2>: Library<36>.    (line  192)\n* Python Enhancement Proposals; PEP 584 <3>: Library<36>.    (line  195)\n* Python Enhancement Proposals; PEP 584 <4>: Library<36>.    (line  209)\n* Python Enhancement Proposals; PEP 584 <5>: Library<37>.    (line   49)\n* Python Enhancement Proposals; PEP 584 <6>: Library<37>.    (line   62)\n* Python Enhancement Proposals; PEP 584 <7>: Library<37>.    (line  120)\n* Python Enhancement Proposals; PEP 584 <8>: Library<37>.    (line  142)\n* Python Enhancement Proposals; PEP 584 <9>: ChainMap objects.\n(line   90)\n* Python Enhancement Proposals; PEP 584 <10>: defaultdict objects.\n(line   56)\n* Python Enhancement Proposals; PEP 584 <11>: OrderedDict objects.\n(line  111)\n* Python Enhancement Proposals; PEP 584 <12>: weakref -- Weak references.\n(line  201)\n* Python Enhancement Proposals; PEP 584 <13>: weakref -- Weak references.\n(line  221)\n* Python Enhancement Proposals; PEP 584 <14>: Standard Interpreter Types.\n(line  277)\n* Python Enhancement Proposals; PEP 584 <15>: Process Parameters.\n(line   55)\n* Python Enhancement Proposals; PEP 584 <16>: Process Parameters.\n(line   71)\n* Python Enhancement Proposals; PEP 585: Summary - Release highlights<4>.\n(line   10)\n* Python Enhancement Proposals; PEP 585 <1>: Type Hinting Generics in Standard Collections.\n(line   18)\n* Python Enhancement Proposals; PEP 585 <2>: Library<15>.    (line  158)\n* Python Enhancement Proposals; PEP 585 <3>: Library<24>.    (line  123)\n* Python Enhancement Proposals; PEP 585 <4>: Documentation<25>.\n(line   31)\n* Python Enhancement Proposals; PEP 585 <5>: Special Attributes of GenericAlias objects.\n(line   54)\n* Python Enhancement Proposals; PEP 585 <6>: collections abc -- Abstract Base Classes for Containers.\n(line   86)\n* Python Enhancement Proposals; PEP 585 <7>: Standard Interpreter Types.\n(line  220)\n* Python Enhancement Proposals; PEP 585 <8>: Introspection helpers.\n(line  112)\n* Python Enhancement Proposals; PEP 585 <9>: Deprecated aliases.\n(line   10)\n* Python Enhancement Proposals; PEP 585 <10>: Aliases to built-in types.\n(line   20)\n* Python Enhancement Proposals; PEP 585 <11>: Aliases to built-in types.\n(line   40)\n* Python Enhancement Proposals; PEP 585 <12>: Aliases to built-in types.\n(line   52)\n* Python Enhancement Proposals; PEP 585 <13>: Aliases to built-in types.\n(line   60)\n* Python Enhancement Proposals; PEP 585 <14>: Aliases to built-in types.\n(line   71)\n* Python Enhancement Proposals; PEP 585 <15>: Aliases to built-in types.\n(line   84)\n* Python Enhancement Proposals; PEP 585 <16>: Aliases to types in collections.\n(line   14)\n* Python Enhancement Proposals; PEP 585 <17>: Aliases to types in collections.\n(line   25)\n* Python Enhancement Proposals; PEP 585 <18>: Aliases to types in collections.\n(line   36)\n* Python Enhancement Proposals; PEP 585 <19>: Aliases to types in collections.\n(line   46)\n* Python Enhancement Proposals; PEP 585 <20>: Aliases to types in collections.\n(line   56)\n* Python Enhancement Proposals; PEP 585 <21>: Aliases to other concrete types.\n(line   26)\n* Python Enhancement Proposals; PEP 585 <22>: Aliases to container ABCs in collections abc.\n(line   11)\n* Python Enhancement Proposals; PEP 585 <23>: Aliases to container ABCs in collections abc.\n(line   30)\n* Python Enhancement Proposals; PEP 585 <24>: Aliases to container ABCs in collections abc.\n(line   38)\n* Python Enhancement Proposals; PEP 585 <25>: Aliases to container ABCs in collections abc.\n(line   47)\n* Python Enhancement Proposals; PEP 585 <26>: Aliases to container ABCs in collections abc.\n(line   55)\n* Python Enhancement Proposals; PEP 585 <27>: Aliases to container ABCs in collections abc.\n(line   68)\n* Python Enhancement Proposals; PEP 585 <28>: Aliases to container ABCs in collections abc.\n(line   76)\n* Python Enhancement Proposals; PEP 585 <29>: Aliases to container ABCs in collections abc.\n(line   84)\n* Python Enhancement Proposals; PEP 585 <30>: Aliases to container ABCs in collections abc.\n(line   93)\n* Python Enhancement Proposals; PEP 585 <31>: Aliases to container ABCs in collections abc.\n(line  100)\n* Python Enhancement Proposals; PEP 585 <32>: Aliases to container ABCs in collections abc.\n(line  108)\n* Python Enhancement Proposals; PEP 585 <33>: Aliases to container ABCs in collections abc.\n(line  116)\n* Python Enhancement Proposals; PEP 585 <34>: Aliases to asynchronous ABCs in collections abc.\n(line   23)\n* Python Enhancement Proposals; PEP 585 <35>: Aliases to asynchronous ABCs in collections abc.\n(line   63)\n* Python Enhancement Proposals; PEP 585 <36>: Aliases to asynchronous ABCs in collections abc.\n(line   73)\n* Python Enhancement Proposals; PEP 585 <37>: Aliases to asynchronous ABCs in collections abc.\n(line   83)\n* Python Enhancement Proposals; PEP 585 <38>: Aliases to asynchronous ABCs in collections abc.\n(line   93)\n* Python Enhancement Proposals; PEP 585 <39>: Aliases to other ABCs in collections abc.\n(line   11)\n* Python Enhancement Proposals; PEP 585 <40>: Aliases to other ABCs in collections abc.\n(line   19)\n* Python Enhancement Proposals; PEP 585 <41>: Aliases to other ABCs in collections abc.\n(line   31)\n* Python Enhancement Proposals; PEP 585 <42>: Aliases to other ABCs in collections abc.\n(line   72)\n* Python Enhancement Proposals; PEP 585 <43>: Aliases to other ABCs in collections abc.\n(line   87)\n* Python Enhancement Proposals; PEP 585 <44>: Aliases to contextlib ABCs.\n(line   14)\n* Python Enhancement Proposals; PEP 585 <45>: Aliases to contextlib ABCs.\n(line   25)\n* Python Enhancement Proposals; PEP 585 <46>: Deprecation Timeline of Major Features.\n(line   18)\n* Python Enhancement Proposals; PEP 585 <47>: Glossary.      (line  600)\n* Python Enhancement Proposals; PEP 586: typing<3>.          (line    8)\n* Python Enhancement Proposals; PEP 586 <1>: typing<5>.      (line    6)\n* Python Enhancement Proposals; PEP 586 <2>: typing<6>.      (line   18)\n* Python Enhancement Proposals; PEP 586 <3>: Special forms.  (line  147)\n* Python Enhancement Proposals; PEP 587: Deprecated<4>.      (line   34)\n* Python Enhancement Proposals; PEP 587 <1>: PEP 587 Python Initialization Configuration.\n(line    6)\n* Python Enhancement Proposals; PEP 587 <2>: PEP 587 Python Initialization Configuration.\n(line   83)\n* Python Enhancement Proposals; PEP 587 <3>: C API<22>.      (line  125)\n* Python Enhancement Proposals; PEP 587 <4>: Core and Builtins<41>.\n(line   76)\n* Python Enhancement Proposals; PEP 587 <5>: C API<38>.      (line    6)\n* Python Enhancement Proposals; PEP 587 <6>: Python Initialization Configuration.\n(line   32)\n* Python Enhancement Proposals; PEP 589: typing<6>.          (line    8)\n* Python Enhancement Proposals; PEP 589 <1>: Other special directives.\n(line  428)\n* Python Enhancement Proposals; PEP 590: Porting to Python 3 11<2>.\n(line   98)\n* Python Enhancement Proposals; PEP 590 <1>: Optimizations<3>.\n(line   55)\n* Python Enhancement Proposals; PEP 590 <2>: Summary - Release highlights<4>.\n(line   33)\n* Python Enhancement Proposals; PEP 590 <3>: Optimizations<4>.\n(line   37)\n* Python Enhancement Proposals; PEP 590 <4>: PEP 590 Vectorcall a fast calling protocol for CPython.\n(line   14)\n* Python Enhancement Proposals; PEP 590 <5>: Core and Builtins<17>.\n(line  113)\n* Python Enhancement Proposals; PEP 590 <6>: Library<20>.    (line   69)\n* Python Enhancement Proposals; PEP 590 <7>: Core and Builtins<22>.\n(line   57)\n* Python Enhancement Proposals; PEP 590 <8>: Core and Builtins<25>.\n(line  118)\n* Python Enhancement Proposals; PEP 590 <9>: Core and Builtins<26>.\n(line  348)\n* Python Enhancement Proposals; PEP 590 <10>: Core and Builtins<28>.\n(line   27)\n* Python Enhancement Proposals; PEP 590 <11>: Core and Builtins<28>.\n(line   74)\n* Python Enhancement Proposals; PEP 590 <12>: Core and Builtins<34>.\n(line   10)\n* Python Enhancement Proposals; PEP 590 <13>: Core and Builtins<34>.\n(line   16)\n* Python Enhancement Proposals; PEP 590 <14>: Core and Builtins<36>.\n(line   39)\n* Python Enhancement Proposals; PEP 590 <15>: Core and Builtins<36>.\n(line   91)\n* Python Enhancement Proposals; PEP 590 <16>: Core and Builtins<37>.\n(line   42)\n* Python Enhancement Proposals; PEP 590 <17>: Core and Builtins<37>.\n(line   50)\n* Python Enhancement Proposals; PEP 590 <18>: Core and Builtins<37>.\n(line   67)\n* Python Enhancement Proposals; PEP 590 <19>: C API<38>.     (line   17)\n* Python Enhancement Proposals; PEP 590 <20>: The Vectorcall Protocol.\n(line    8)\n* Python Enhancement Proposals; PEP 591: typing<6>.          (line   25)\n* Python Enhancement Proposals; PEP 591 <1>: Special forms.  (line  204)\n* Python Enhancement Proposals; PEP 591 <2>: Functions and decorators.\n(line  335)\n* Python Enhancement Proposals; PEP 593: Summary - Release highlights<4>.\n(line   20)\n* Python Enhancement Proposals; PEP 593 <1>: typing<4>.      (line    6)\n* Python Enhancement Proposals; PEP 593 <2>: Library<38>.    (line   91)\n* Python Enhancement Proposals; PEP 593 <3>: Special forms.  (line  359)\n* Python Enhancement Proposals; PEP 593 <4>: Introspection helpers.\n(line   37)\n* Python Enhancement Proposals; PEP 594: Pending Removal in Python 3 13.\n(line    9)\n* Python Enhancement Proposals; PEP 594 <1>: asynchat and asyncore.\n(line    6)\n* Python Enhancement Proposals; PEP 594 <2>: smtpd.          (line    6)\n* Python Enhancement Proposals; PEP 594 <3>: Summary - Release highlights<2>.\n(line   46)\n* Python Enhancement Proposals; PEP 594 <4>: Modules.        (line    6)\n* Python Enhancement Proposals; PEP 594 <5>: Library<17>.    (line  102)\n* Python Enhancement Proposals; PEP 594 <6>: Library<18>.    (line  684)\n* Python Enhancement Proposals; PEP 594 <7>: Library<19>.    (line   93)\n* Python Enhancement Proposals; PEP 594 <8>: Library<20>.    (line  124)\n* Python Enhancement Proposals; PEP 594 <9>: Library<20>.    (line  150)\n* Python Enhancement Proposals; PEP 594 <10>: Tests<18>.     (line   25)\n* Python Enhancement Proposals; PEP 594 <11>: nntplib -- NNTP protocol client.\n(line    9)\n* Python Enhancement Proposals; PEP 594#aifc: aifc -- Read and write AIFF and AIFC files.\n(line    9)\n* Python Enhancement Proposals; PEP 594#audioop: audioop -- Manipulate raw audio data.\n(line    7)\n* Python Enhancement Proposals; PEP 594#cgi: cgi -- Common Gateway Interface support.\n(line    9)\n* Python Enhancement Proposals; PEP 594#cgitb: cgitb -- Traceback manager for CGI scripts.\n(line    9)\n* Python Enhancement Proposals; PEP 594#chunk: chunk -- Read IFF chunked data.\n(line    9)\n* Python Enhancement Proposals; PEP 594#crypt: crypt -- Function to check Unix passwords.\n(line    9)\n* Python Enhancement Proposals; PEP 594#imghdr: imghdr -- Determine the type of an image.\n(line    9)\n* Python Enhancement Proposals; PEP 594#mailcap: mailcap -- Mailcap file handling.\n(line    9)\n* Python Enhancement Proposals; PEP 594#msilib: msilib -- Read and write Microsoft Installer files.\n(line    9)\n* Python Enhancement Proposals; PEP 594#nis: nis -- Interface to Sun's NIS Yellow Pages.\n(line    7)\n* Python Enhancement Proposals; PEP 594#ossaudiodev: ossaudiodev -- Access to OSS-compatible audio devices.\n(line    7)\n* Python Enhancement Proposals; PEP 594#pipes: pipes -- Interface to shell pipelines.\n(line    9)\n* Python Enhancement Proposals; PEP 594#sndhdr: sndhdr -- Determine type of sound file.\n(line    9)\n* Python Enhancement Proposals; PEP 594#spwd: spwd -- The shadow password database.\n(line    7)\n* Python Enhancement Proposals; PEP 594#sunau: sunau -- Read and write Sun AU files.\n(line    9)\n* Python Enhancement Proposals; PEP 594#telnetlib: telnetlib -- Telnet client.\n(line    9)\n* Python Enhancement Proposals; PEP 594#uu-and-the-uu-encoding: uu -- Encode and decode uuencode files.\n(line    9)\n* Python Enhancement Proposals; PEP 594#xdrlib: xdrlib -- Encode and decode XDR data.\n(line    9)\n* Python Enhancement Proposals; PEP 596: What's New In Python 3 9.\n(line   16)\n* Python Enhancement Proposals; PEP 597: Summary - Release highlights<3>.\n(line   46)\n* Python Enhancement Proposals; PEP 597 <1>: Library<28>.    (line   44)\n* Python Enhancement Proposals; PEP 597 <2>: Opt-in EncodingWarning.\n(line    6)\n* Python Enhancement Proposals; PEP 602: Summary - Release highlights<4>.\n(line   59)\n* Python Enhancement Proposals; PEP 602 <1>: How stable is Python?.\n(line    8)\n* Python Enhancement Proposals; PEP 604: Summary - Release highlights<3>.\n(line   27)\n* Python Enhancement Proposals; PEP 604 <1>: PEP 604 New Type Union Operator.\n(line   28)\n* Python Enhancement Proposals; PEP 604 <2>: Library<31>.    (line   25)\n* Python Enhancement Proposals; PEP 604 <3>: Documentation<34>.\n(line    6)\n* Python Enhancement Proposals; PEP 604 <4>: Union Type.     (line  104)\n* Python Enhancement Proposals; PEP 604 <5>: Manually Un-Stringizing Stringized Annotations.\n(line   42)\n* Python Enhancement Proposals; PEP 612: Summary - Release highlights<3>.\n(line   29)\n* Python Enhancement Proposals; PEP 612 <1>: PEP 612 Parameter Specification Variables.\n(line   25)\n* Python Enhancement Proposals; PEP 612 <2>: Library<26>.    (line  691)\n* Python Enhancement Proposals; PEP 612 <3>: Library<27>.    (line   95)\n* Python Enhancement Proposals; PEP 612 <4>: Core and Builtins<31>.\n(line   59)\n* Python Enhancement Proposals; PEP 612 <5>: Library<31>.    (line   25)\n* Python Enhancement Proposals; PEP 612 <6>: Library<31>.    (line  119)\n* Python Enhancement Proposals; PEP 612 <7>: Annotating callable objects.\n(line   76)\n* Python Enhancement Proposals; PEP 612 <8>: User-defined generic types.\n(line  179)\n* Python Enhancement Proposals; PEP 612 <9>: Special forms.  (line  118)\n* Python Enhancement Proposals; PEP 612 <10>: Building generic types and type aliases.\n(line  406)\n* Python Enhancement Proposals; PEP 612 <11>: Aliases to other ABCs in collections abc.\n(line   35)\n* Python Enhancement Proposals; PEP 613: Summary - Release highlights<3>.\n(line   31)\n* Python Enhancement Proposals; PEP 613 <1>: PEP 613 TypeAlias.\n(line   21)\n* Python Enhancement Proposals; PEP 613 <2>: Library<33>.    (line   98)\n* Python Enhancement Proposals; PEP 613 <3>: Special types.  (line  223)\n* Python Enhancement Proposals; PEP 614: Summary - Release highlights<4>.\n(line   12)\n* Python Enhancement Proposals; PEP 614 <1>: Other Language Changes<4>.\n(line   38)\n* Python Enhancement Proposals; PEP 614 <2>: Core and Builtins<37>.\n(line  112)\n* Python Enhancement Proposals; PEP 614 <3>: Function definitions.\n(line   54)\n* Python Enhancement Proposals; PEP 614 <4>: Class definitions.\n(line   60)\n* Python Enhancement Proposals; PEP 615: Summary - Release highlights<4>.\n(line   51)\n* Python Enhancement Proposals; PEP 615 <1>: zoneinfo.       (line   37)\n* Python Enhancement Proposals; PEP 615 <2>: Library<35>.    (line   54)\n* Python Enhancement Proposals; PEP 615 <3>: zoneinfo -- IANA time zone support.\n(line   14)\n* Python Enhancement Proposals; PEP 616: Summary - Release highlights<4>.\n(line   16)\n* Python Enhancement Proposals; PEP 616 <1>: New String Methods to Remove Prefixes and Suffixes.\n(line    9)\n* Python Enhancement Proposals; PEP 616 <2>: Core and Builtins<36>.\n(line   82)\n* Python Enhancement Proposals; PEP 617: PEP 701 Syntactic formalization of f-strings.\n(line   69)\n* Python Enhancement Proposals; PEP 617 <1>: Modules.        (line   30)\n* Python Enhancement Proposals; PEP 617 <2>: Parenthesized context managers.\n(line   45)\n* Python Enhancement Proposals; PEP 617 <3>: Summary - Release highlights<4>.\n(line   30)\n* Python Enhancement Proposals; PEP 617 <4>: New Parser.     (line   21)\n* Python Enhancement Proposals; PEP 617 <5>: Deprecated<7>.  (line   96)\n* Python Enhancement Proposals; PEP 617 <6>: Library<26>.    (line  178)\n* Python Enhancement Proposals; PEP 617 <7>: Library<36>.    (line   35)\n* Python Enhancement Proposals; PEP 617 <8>: Full Grammar specification.\n(line   16)\n* Python Enhancement Proposals; PEP 617 <9>: lib2to3 -- 2to3's library.\n(line   11)\n* Python Enhancement Proposals; PEP 618: Summary - Release highlights<3>.\n(line   19)\n* Python Enhancement Proposals; PEP 618 <1>: Other Language Changes<3>.\n(line   17)\n* Python Enhancement Proposals; PEP 618 <2>: Core and Builtins<34>.\n(line  209)\n* Python Enhancement Proposals; PEP 623: Summary - Release highlights.\n(line  107)\n* Python Enhancement Proposals; PEP 623 <1>: Optimizations.  (line    7)\n* Python Enhancement Proposals; PEP 623 <2>: Removed<2>.     (line   11)\n* Python Enhancement Proposals; PEP 623 <3>: Summary - Release highlights<3>.\n(line   41)\n* Python Enhancement Proposals; PEP 623 <4>: C API<15>.      (line   22)\n* Python Enhancement Proposals; PEP 623 <5>: Core and Builtins<29>.\n(line   10)\n* Python Enhancement Proposals; PEP 623 <6>: Documentation<29>.\n(line   10)\n* Python Enhancement Proposals; PEP 623 <7>: Unicode Objects.\n(line   17)\n* Python Enhancement Proposals; PEP 624: Summary - Release highlights<2>.\n(line   49)\n* Python Enhancement Proposals; PEP 624 <1>: Removed<4>.     (line   97)\n* Python Enhancement Proposals; PEP 624 <2>: Summary - Release highlights<3>.\n(line   44)\n* Python Enhancement Proposals; PEP 624 <3>: C API<22>.      (line  143)\n* Python Enhancement Proposals; PEP 624#alternative-apis: Removed<4>.\n(line   97)\n* Python Enhancement Proposals; PEP 626: Deprecated.         (line  215)\n* Python Enhancement Proposals; PEP 626 <1>: Summary - Release highlights<3>.\n(line   23)\n* Python Enhancement Proposals; PEP 626 <2>: Core and Builtins<18>.\n(line  422)\n* Python Enhancement Proposals; PEP 626 <3>: Methods on code objects.\n(line   81)\n* Python Enhancement Proposals; PEP 626 <4>: Analysis functions.\n(line  161)\n* Python Enhancement Proposals; PEP 628: cmath.              (line    7)\n* Python Enhancement Proposals; PEP 628 <1>: math<6>.        (line    7)\n* Python Enhancement Proposals; PEP 628 <2>: Library<70>.    (line   32)\n* Python Enhancement Proposals; PEP 632: Summary - Release highlights.\n(line  111)\n* Python Enhancement Proposals; PEP 632 <1>: distutils.      (line    7)\n* Python Enhancement Proposals; PEP 632 <2>: Summary - Release highlights<3>.\n(line   39)\n* Python Enhancement Proposals; PEP 632 <3>: distutils<2>.   (line   14)\n* Python Enhancement Proposals; PEP 632 <4>: Library<17>.    (line   38)\n* Python Enhancement Proposals; PEP 634: Summary - Release highlights<3>.\n(line    8)\n* Python Enhancement Proposals; PEP 634 <1>: Other Key Features.\n(line   53)\n* Python Enhancement Proposals; PEP 634 <2>: Core and Builtins<19>.\n(line   55)\n* Python Enhancement Proposals; PEP 634 <3>: Core and Builtins<27>.\n(line   54)\n* Python Enhancement Proposals; PEP 634 <4>: Core and Builtins<29>.\n(line   57)\n* Python Enhancement Proposals; PEP 634 <5>: Customizing positional arguments in class pattern matching.\n(line   32)\n* Python Enhancement Proposals; PEP 634 <6>: The match statement.\n(line   33)\n* Python Enhancement Proposals; PEP 634 <7>: Class Patterns. (line  136)\n* Python Enhancement Proposals; PEP 634 <8>: lib2to3 -- 2to3's library.\n(line   13)\n* Python Enhancement Proposals; PEP 634 <9>: PyTypeObject Slots.\n(line  761)\n* Python Enhancement Proposals; PEP 634 <10>: PyTypeObject Slots.\n(line  785)\n* Python Enhancement Proposals; PEP 635: Summary - Release highlights<3>.\n(line   10)\n* Python Enhancement Proposals; PEP 635 <1>: Other Key Features.\n(line   54)\n* Python Enhancement Proposals; PEP 636: Summary - Release highlights<3>.\n(line   12)\n* Python Enhancement Proposals; PEP 636 <1>: Other Key Features.\n(line   54)\n* Python Enhancement Proposals; PEP 636 <2>: match Statements.\n(line  180)\n* Python Enhancement Proposals; PEP 636 <3>: The match statement.\n(line   35)\n* Python Enhancement Proposals; PEP 636 <4>: Class Patterns. (line  138)\n* Python Enhancement Proposals; PEP 644: hashlib.            (line    8)\n* Python Enhancement Proposals; PEP 644 <1>: Summary - Release highlights<3>.\n(line   37)\n* Python Enhancement Proposals; PEP 644 <2>: hashlib<3>.     (line    7)\n* Python Enhancement Proposals; PEP 644 <3>: ssl<2>.         (line    7)\n* Python Enhancement Proposals; PEP 644 <4>: Build Changes<3>.\n(line    6)\n* Python Enhancement Proposals; PEP 644 <5>: Library<18>.    (line  525)\n* Python Enhancement Proposals; PEP 644 <6>: Build<25>.      (line    9)\n* Python Enhancement Proposals; PEP 644 <7>: ssl -- TLS/SSL wrapper for socket objects.\n(line   57)\n* Python Enhancement Proposals; PEP 646: PEP 646 Variadic generics.\n(line    7)\n* Python Enhancement Proposals; PEP 646 <1>: PEP 646 Variadic generics.\n(line   18)\n* Python Enhancement Proposals; PEP 646 <2>: Building generic types and type aliases.\n(line  300)\n* Python Enhancement Proposals; PEP 647: Summary - Release highlights<3>.\n(line   33)\n* Python Enhancement Proposals; PEP 647 <1>: PEP 647 User-Defined Type Guards.\n(line    9)\n* Python Enhancement Proposals; PEP 647 <2>: Library<27>.    (line  182)\n* Python Enhancement Proposals; PEP 647 <3>: Special forms.  (line  433)\n* Python Enhancement Proposals; PEP 649: Annotation scopes.  (line   10)\n* Python Enhancement Proposals; PEP 649 <1>: Module Contents<5>.\n(line  125)\n* Python Enhancement Proposals; PEP 652: PEP 652 Maintaining the Stable ABI.\n(line   11)\n* Python Enhancement Proposals; PEP 652 <1>: C API<23>.      (line   41)\n* Python Enhancement Proposals; PEP 654: PEP 654 Exception Groups and except*.\n(line    6)\n* Python Enhancement Proposals; PEP 654 <1>: PEP 654 Exception Groups and except*.\n(line   13)\n* Python Enhancement Proposals; PEP 654 <2>: New opcodes.    (line   18)\n* Python Enhancement Proposals; PEP 654 <3>: Core and Builtins<18>.\n(line  174)\n* Python Enhancement Proposals; PEP 654 <4>: Core and Builtins<23>.\n(line  146)\n* Python Enhancement Proposals; PEP 654 <5>: Core and Builtins<25>.\n(line   88)\n* Python Enhancement Proposals; PEP 655: PEP 655 Marking individual TypedDict items as required or not-required.\n(line   30)\n* Python Enhancement Proposals; PEP 655 <1>: Library<19>.    (line  265)\n* Python Enhancement Proposals; PEP 655 <2>: Special forms.  (line  215)\n* Python Enhancement Proposals; PEP 655 <3>: Special forms.  (line  224)\n* Python Enhancement Proposals; PEP 655 <4>: Other special directives.\n(line  434)\n* Python Enhancement Proposals; PEP 657: PEP 657 Fine-grained error locations in tracebacks.\n(line   55)\n* Python Enhancement Proposals; PEP 657 <1>: inspect<2>.     (line   17)\n* Python Enhancement Proposals; PEP 657 <2>: Library<19>.    (line  222)\n* Python Enhancement Proposals; PEP 657 <3>: Core and Builtins<26>.\n(line  337)\n* Python Enhancement Proposals; PEP 659: PEP 659 Specializing Adaptive Interpreter.\n(line    6)\n* Python Enhancement Proposals; PEP 659 <1>: PEP 659 Specializing Adaptive Interpreter.\n(line   30)\n* Python Enhancement Proposals; PEP 669: PEP 669 Low impact monitoring for CPython.\n(line    6)\n* Python Enhancement Proposals; PEP 669 <1>: Core and Builtins<11>.\n(line  203)\n* Python Enhancement Proposals; PEP 670: Summary - Release highlights<2>.\n(line   51)\n* Python Enhancement Proposals; PEP 670 <1>: Porting to Python 3 11<2>.\n(line   12)\n* Python Enhancement Proposals; PEP 673: PEP 673 Self type.  (line   32)\n* Python Enhancement Proposals; PEP 673 <1>: Library<21>.    (line  134)\n* Python Enhancement Proposals; PEP 673 <2>: Special types.  (line  189)\n* Python Enhancement Proposals; PEP 675: PEP 675 Arbitrary literal string type.\n(line   32)\n* Python Enhancement Proposals; PEP 675 <1>: Library<20>.    (line   59)\n* Python Enhancement Proposals; PEP 675 <2>: Special types.  (line   85)\n* Python Enhancement Proposals; PEP 676: Documentation<20>.  (line    8)\n* Python Enhancement Proposals; PEP 678: Other Language Changes.\n(line   36)\n* Python Enhancement Proposals; PEP 678 <1>: PEP 678 Exceptions can be enriched with notes.\n(line   11)\n* Python Enhancement Proposals; PEP 678 <2>: Core and Builtins<11>.\n(line  183)\n* Python Enhancement Proposals; PEP 678 <3>: Core and Builtins<12>.\n(line   57)\n* Python Enhancement Proposals; PEP 678 <4>: Core and Builtins<19>.\n(line  118)\n* Python Enhancement Proposals; PEP 680: Summary - Release highlights<2>.\n(line   20)\n* Python Enhancement Proposals; PEP 680 <1>: New Modules<2>. (line    6)\n* Python Enhancement Proposals; PEP 680 <2>: Library<20>.    (line  205)\n* Python Enhancement Proposals; PEP 681: PEP 681 Data class transforms.\n(line   30)\n* Python Enhancement Proposals; PEP 681 <1>: Library<19>.    (line  109)\n* Python Enhancement Proposals; PEP 681 <2>: Functions and decorators.\n(line  243)\n* Python Enhancement Proposals; PEP 682: Other Language Changes<2>.\n(line   49)\n* Python Enhancement Proposals; PEP 682 <1>: Format Specification Mini-Language.\n(line   91)\n* Python Enhancement Proposals; PEP 683: New Features<2>.    (line  146)\n* Python Enhancement Proposals; PEP 683 <1>: Core and Builtins<11>.\n(line   73)\n* Python Enhancement Proposals; PEP 684: PEP 684 A Per-Interpreter GIL.\n(line    6)\n* Python Enhancement Proposals; PEP 684 <1>: New Features<2>.\n(line  181)\n* Python Enhancement Proposals; PEP 686: Python UTF-8 Mode.  (line   71)\n* Python Enhancement Proposals; PEP 686 <1>: Text Encoding.  (line   32)\n* Python Enhancement Proposals; PEP 687: Library<11>.        (line  290)\n* Python Enhancement Proposals; PEP 687 <1>: Library<11>.    (line  297)\n* Python Enhancement Proposals; PEP 687 <2>: Library<11>.    (line  330)\n* Python Enhancement Proposals; PEP 687 <3>: Library<11>.    (line  333)\n* Python Enhancement Proposals; PEP 687 <4>: Library<11>.    (line  343)\n* Python Enhancement Proposals; PEP 687 <5>: Library<11>.    (line  400)\n* Python Enhancement Proposals; PEP 687 <6>: Core and Builtins<12>.\n(line   78)\n* Python Enhancement Proposals; PEP 687 <7>: Library<13>.    (line  111)\n* Python Enhancement Proposals; PEP 687 <8>: Library<13>.    (line  118)\n* Python Enhancement Proposals; PEP 688: PEP 688 Making the buffer protocol accessible in Python.\n(line    6)\n* Python Enhancement Proposals; PEP 688 <1>: Core and Builtins<11>.\n(line  211)\n* Python Enhancement Proposals; PEP 688 <2>: Emulating buffer types.\n(line   39)\n* Python Enhancement Proposals; PEP 688 <3>: Collections Abstract Base Classes - Detailed Descriptions.\n(line  163)\n* Python Enhancement Proposals; PEP 689: C API<10>.          (line   26)\n* Python Enhancement Proposals; PEP 692: PEP 692 Using TypedDict for more precise kwargs typing.\n(line   10)\n* Python Enhancement Proposals; PEP 692 <1>: PEP 692 Using TypedDict for more precise kwargs typing.\n(line   21)\n* Python Enhancement Proposals; PEP 692 <2>: Library<11>.    (line  117)\n* Python Enhancement Proposals; PEP 692 <3>: Documentation<11>.\n(line   11)\n* Python Enhancement Proposals; PEP 692 <4>: Special forms.  (line  479)\n* Python Enhancement Proposals; PEP 693: What's New In Python 3 12.\n(line   16)\n* Python Enhancement Proposals; PEP 695: PEP 695 Type Parameter Syntax.\n(line   10)\n* Python Enhancement Proposals; PEP 695 <1>: PEP 695 Type Parameter Syntax.\n(line   61)\n* Python Enhancement Proposals; PEP 695 <2>: CPython bytecode changes.\n(line   41)\n* Python Enhancement Proposals; PEP 695 <3>: Library<4>.     (line    7)\n* Python Enhancement Proposals; PEP 695 <4>: Library<9>.     (line   12)\n* Python Enhancement Proposals; PEP 695 <5>: Library<10>.    (line   43)\n* Python Enhancement Proposals; PEP 695 <6>: Library<10>.    (line   49)\n* Python Enhancement Proposals; PEP 695 <7>: Core and Builtins<11>.\n(line   13)\n* Python Enhancement Proposals; PEP 695 <8>: Core and Builtins<11>.\n(line  108)\n* Python Enhancement Proposals; PEP 695 <9>: Library<11>.    (line    7)\n* Python Enhancement Proposals; PEP 695 <10>: Annotation scopes.\n(line   55)\n* Python Enhancement Proposals; PEP 695 <11>: The type statement.\n(line   40)\n* Python Enhancement Proposals; PEP 695 <12>: Building generic types and type aliases.\n(line  112)\n* Python Enhancement Proposals; PEP 695 <13>: Building generic types and type aliases.\n(line  194)\n* Python Enhancement Proposals; PEP 695 <14>: Building generic types and type aliases.\n(line  309)\n* Python Enhancement Proposals; PEP 695 <15>: Building generic types and type aliases.\n(line  397)\n* Python Enhancement Proposals; PEP 695 <16>: Deprecation Timeline of Major Features.\n(line   33)\n* Python Enhancement Proposals; PEP 697: New Features<2>.    (line    6)\n* Python Enhancement Proposals; PEP 697 <1>: New Features<2>.\n(line   33)\n* Python Enhancement Proposals; PEP 697 <2>: C API<8>.       (line   38)\n* Python Enhancement Proposals; PEP 698: PEP 698 Override Decorator for Static Typing.\n(line   30)\n* Python Enhancement Proposals; PEP 698 <1>: Library<13>.    (line  100)\n* Python Enhancement Proposals; PEP 698 <2>: Functions and decorators.\n(line  403)\n* Python Enhancement Proposals; PEP 699: Deprecated<2>.      (line    6)\n* Python Enhancement Proposals; PEP 699 <1>: Pending Removal in Python 3 14<2>.\n(line    7)\n* Python Enhancement Proposals; PEP 699 <2>: Build<12>.      (line   15)\n* Python Enhancement Proposals; PEP 7:   Build and C API Changes<2>.\n(line    9)\n* Python Enhancement Proposals; PEP 7 <1>: Build Requirements.\n(line   34)\n* Python Enhancement Proposals; PEP 7 <2>: Coding standards. (line    7)\n* Python Enhancement Proposals; PEP 7 <3>: Useful macros.    (line  162)\n* Python Enhancement Proposals; PEP 7 <4>: Useful macros.    (line  180)\n* Python Enhancement Proposals; PEP 701: PEP 701 Syntactic formalization of f-strings.\n(line    6)\n* Python Enhancement Proposals; PEP 701 <1>: PEP 701 Syntactic formalization of f-strings.\n(line   66)\n* Python Enhancement Proposals; PEP 701 <2>: tokenize.       (line    6)\n* Python Enhancement Proposals; PEP 701 <3>: Optimizations.  (line   26)\n* Python Enhancement Proposals; PEP 701 <4>: Changes in the Python API.\n(line   76)\n* Python Enhancement Proposals; PEP 701 <5>: Changes in the Python API.\n(line   78)\n* Python Enhancement Proposals; PEP 701 <6>: Changes in the Python API.\n(line  100)\n* Python Enhancement Proposals; PEP 706: Other Language Changes.\n(line   78)\n* Python Enhancement Proposals; PEP 706 <1>: tarfile<2>.     (line   13)\n* Python Enhancement Proposals; PEP 706 <2>: tarfile<3>.     (line   13)\n* Python Enhancement Proposals; PEP 706 <3>: tarfile<4>.     (line   13)\n* Python Enhancement Proposals; PEP 706 <4>: tarfile<6>.     (line   13)\n* Python Enhancement Proposals; PEP 706 <5>: Extraction filters.\n(line   22)\n* Python Enhancement Proposals; PEP 709: PEP 709 Comprehension inlining.\n(line    9)\n* Python Enhancement Proposals; PEP 709 <1>: PEP 709 Comprehension inlining.\n(line   35)\n* Python Enhancement Proposals; PEP 709 <2>: CPython bytecode changes.\n(line   33)\n* Python Enhancement Proposals; PEP 709 <3>: Core and Builtins<11>.\n(line  213)\n* Python Enhancement Proposals; PEP 8:   Library Changes.    (line   26)\n* Python Enhancement Proposals; PEP 8 <1>: Library<55>.      (line  124)\n* Python Enhancement Proposals; PEP 8 <2>: IDLE<56>.         (line   81)\n* Python Enhancement Proposals; PEP 8 <3>: Intermezzo Coding Style.\n(line   13)\n* Python Enhancement Proposals; PEP 8 <4>: Editors and IDEs. (line    7)\n* Python Enhancement Proposals; PEP 8 <5>: Value comparisons.\n(line   61)\n* Python Enhancement Proposals; PEP 8 <6>: Built-in Functions.\n(line 1676)\n* Python Enhancement Proposals; PEP 8 <7>: Odds and Ends<2>. (line   35)\n* Python Enhancement Proposals; PEP 8 <8>: Are there coding standards or a style guide for Python programs?.\n(line    7)\n* Python Enhancement Proposals; PEP 8 <9>: When can I rely on identity tests with the is operator?.\n(line   57)\n* Python Enhancement Proposals; PEP 8 <10>: How do I keep editors from inserting tabs into my Python source?.\n(line    6)\n* pythonbranch() (in module platform):  Cross Platform.     (line   85)\n* pythonbuild() (in module platform):   Cross Platform.     (line   75)\n* pythoncompiler() (in module platform): Cross Platform.    (line   80)\n* PYTHONDOM:                            Module Contents<4>. (line   23)\n* pythonimplementation() (in module platform): Cross Platform.\n(line   89)\n* pythonisoptimized() (in module test.support): test support -- Utilities for the Python test suite.\n(line  251)\n* pythonrevision() (in module platform): Cross Platform.    (line   94)\n* pythonversiontuple() (in module platform): Cross Platform.\n(line  106)\n* pythonversion() (in module platform): Cross Platform.     (line   99)\n* python-m-pycompile command line option; -: Command-Line Interface<6>.\n(line   13)\n* python-m-pycompile command line option; -q: Command-Line Interface<6>.\n(line   19)\n* python-m-pycompile command line option; -quiet: Command-Line Interface<6>.\n(line   19)\n* python-m-pycompile command line option; <file>: Command-Line Interface<6>.\n(line   13)\n* python-m-sqlite3-[-h]-[-v]-[filename]-[sql] command line option; -h: Command-line interface.\n(line   14)\n* python-m-sqlite3-[-h]-[-v]-[filename]-[sql] command line option; -help: Command-line interface.\n(line   14)\n* python-m-sqlite3-[-h]-[-v]-[filename]-[sql] command line option; -v: Command-line interface.\n(line   18)\n* python-m-sqlite3-[-h]-[-v]-[filename]-[sql] command line option; -version: Command-line interface.\n(line   18)\n* PYTHONASYNCIODEBUG:                    Enabling debug mode.\n(line   10)\n* PYTHONASYNCIODEBUG <1>:                Debug Mode.         (line   11)\n* PYTHONASYNCIODEBUG <2>:                Effects of the Python Development Mode.\n(line   65)\n* PYTHONBREAKPOINT:                      PEP 553 Built-in breakpoint.\n(line   13)\n* PYTHONBREAKPOINT <1>:                  Built-in Functions. (line  158)\n* PYTHONBREAKPOINT <2>:                  sys -- System-specific parameters and functions.\n(line  245)\n* PYTHONBREAKPOINT <3>:                  sys -- System-specific parameters and functions.\n(line  259)\n* PYTHONBREAKPOINT <4>:                  sys -- System-specific parameters and functions.\n(line  263)\n* PYTHONCASEOK:                          Changes in the Python API<3>.\n(line   29)\n* PYTHONCASEOK <1>:                      PEP 235 Importing Modules on Case-Insensitive Platforms.\n(line   17)\n* PYTHONCASEOK <2>:                      Library<37>.        (line  144)\n* PYTHONCASEOK <3>:                      Built-in Functions. (line 2071)\n* PYTHONCOERCECLOCALE:                   PEP 538 Legacy C Locale Coercion.\n(line   13)\n* PYTHONCOERCECLOCALE <1>:               General Options.    (line   88)\n* PYTHONCOERCECLOCALE <2>:               Python UTF-8 Mode.  (line   57)\n* PYTHONCOERCECLOCALE <3>:               Python Configuration.\n(line   15)\n* PYTHONDEBUG:                           Miscellaneous options.\n(line   37)\n* PYTHONDEBUG <1>:                       Python Debug Build. (line   20)\n* PYTHONDEBUG <2>:                       Global configuration variables.\n(line   38)\n* PYTHONDEBUG <3>:                       PyConfig.           (line  639)\n* PYTHONDEVMODE:                         Python Development Mode -X dev.\n(line    6)\n* PYTHONDEVMODE <1>:                     Miscellaneous options.\n(line  284)\n* PYTHONDEVMODE <2>:                     Python Development Mode.\n(line   14)\n* PYTHONDEVMODE <3>:                     PyConfig.           (line  284)\n* PYTHONDONTWRITEBYTECODE:               Interpreter Changes<2>.\n(line   16)\n* PYTHONDONTWRITEBYTECODE <1>:           New and Improved Modules<2>.\n(line  626)\n* PYTHONDONTWRITEBYTECODE <2>:           Miscellaneous options.\n(line   19)\n* PYTHONDONTWRITEBYTECODE <3>:           sys -- System-specific parameters and functions.\n(line  329)\n* PYTHONDONTWRITEBYTECODE <4>:           Global configuration variables.\n(line   52)\n* PYTHONDONTWRITEBYTECODE <5>:           PyConfig.           (line  909)\n* PYTHONDONTWRITEBYTECODE <6>:           How do I create a pyc file?.\n(line   21)\n* PYTHONDUMPREFS:                        Debug build uses the same ABI as release build.\n(line   15)\n* PYTHONDUMPREFS <1>:                    Build<41>.          (line   54)\n* PYTHONDUMPREFS <2>:                    Debug options.      (line   22)\n* PYTHONDUMPREFS <3>:                    PyConfig.           (line  295)\n* PYTHONDUMPREFS <4>:                    PyObject Slots.     (line   66)\n* PYTHONDUMPREFSFILE:                    Core and Builtins<26>.\n(line  154)\n* PYTHONEXECUTABLE:                      PyConfig.           (line  675)\n* PYTHONFAULTHANDLER:                    faulthandler<4>.    (line   11)\n* PYTHONFAULTHANDLER <1>:                Miscellaneous options.\n(line  256)\n* PYTHONFAULTHANDLER <2>:                Effects of the Python Development Mode.\n(line   59)\n* PYTHONFAULTHANDLER <3>:                faulthandler -- Dump the Python traceback.\n(line   14)\n* PYTHONFAULTHANDLER <4>:                PyConfig.           (line  329)\n* PYTHONHASHSEED:                        Builtin functions and types.\n(line   17)\n* PYTHONHASHSEED <1>:                    Porting Python code.\n(line    6)\n* PYTHONHASHSEED <2>:                    Core and Builtins<53>.\n(line   30)\n* PYTHONHASHSEED <3>:                    Miscellaneous options.\n(line  120)\n* PYTHONHASHSEED <4>:                    Miscellaneous options.\n(line  136)\n* PYTHONHASHSEED <5>:                    Environment variables.\n(line  147)\n* PYTHONHASHSEED <6>:                    Basic customization.\n(line  301)\n* PYTHONHASHSEED <7>:                    Global configuration variables.\n(line   77)\n* PYTHONHASHSEED <8>:                    Global configuration variables.\n(line   80)\n* PYTHONHASHSEED <9>:                    PyConfig.           (line  399)\n* PYTHONHOME:                            Pending Removal in Python 3 15<2>.\n(line   32)\n* PYTHONHOME <1>:                        Summary - Release highlights<6>.\n(line  107)\n* PYTHONHOME <2>:                        Miscellaneous options.\n(line   46)\n* PYTHONHOME <3>:                        Environment variables.\n(line   19)\n* PYTHONHOME <4>:                        Environment variables.\n(line   21)\n* PYTHONHOME <5>:                        Environment variables.\n(line   38)\n* PYTHONHOME <6>:                        Finding modules.    (line   29)\n* PYTHONHOME <7>:                        Finding modules.    (line   47)\n* PYTHONHOME <8>:                        Finding modules.    (line   81)\n* PYTHONHOME <9>:                        test support scripthelper -- Utilities for the Python execution tests.\n(line   25)\n* PYTHONHOME <10>:                       The initialization of the sys path module search path.\n(line   30)\n* PYTHONHOME <11>:                       Virtual environments<2>.\n(line   14)\n* PYTHONHOME <12>:                       Embedding Python<2>.\n(line   38)\n* PYTHONHOME <13>:                       Embedding Python<2>.\n(line   44)\n* PYTHONHOME <14>:                       Global configuration variables.\n(line   92)\n* PYTHONHOME <15>:                       Process-wide parameters.\n(line  350)\n* PYTHONHOME <16>:                       Process-wide parameters.\n(line  366)\n* PYTHONHOME <17>:                       PyConfig.           (line  411)\n* Pythonic:                              Glossary.           (line 1156)\n* PYTHONINSPECT:                         Other Changes and Fixes<2>.\n(line   13)\n* PYTHONINSPECT <1>:                     Miscellaneous options.\n(line   58)\n* PYTHONINSPECT <2>:                     Global configuration variables.\n(line  109)\n* PYTHONINSPECT <3>:                     PyConfig.           (line  436)\n* PYTHONINTMAXSTRDIGITS:                 Core and Builtins<18>.\n(line  106)\n* PYTHONINTMAXSTRDIGITS <1>:             Miscellaneous options.\n(line  272)\n* PYTHONINTMAXSTRDIGITS <2>:             Configuring the limit.\n(line    9)\n* PYTHONINTMAXSTRDIGITS <3>:             Configuring the limit.\n(line   16)\n* PYTHONINTMAXSTRDIGITS <4>:             sys -- System-specific parameters and functions.\n(line 1120)\n* PYTHONINTMAXSTRDIGITS <5>:             PyConfig.           (line  467)\n* PYTHONIOENCODING:                      Other Improvements<2>.\n(line   75)\n* PYTHONIOENCODING <1>:                  Interpreter Changes<2>.\n(line   23)\n* PYTHONIOENCODING <2>:                  Environment variables.\n(line  384)\n* PYTHONIOENCODING <3>:                  Python UTF-8 Mode.  (line   29)\n* PYTHONIOENCODING <4>:                  sys -- System-specific parameters and functions.\n(line 1783)\n* PYTHONIOENCODING <5>:                  Process-wide parameters.\n(line   19)\n* PYTHONIOENCODING <6>:                  Process-wide parameters.\n(line   23)\n* PYTHONIOENCODING <7>:                  PyConfig.           (line  798)\n* PYTHONLEGACYWINDOWSFSENCODING:         PEP 529 Change Windows filesystem encoding to UTF-8.\n(line   18)\n* PYTHONLEGACYWINDOWSFSENCODING <1>:     sys -- System-specific parameters and functions.\n(line 1731)\n* PYTHONLEGACYWINDOWSFSENCODING <2>:     Global configuration variables.\n(line  151)\n* PYTHONLEGACYWINDOWSFSENCODING <3>:     PyPreConfig.        (line  112)\n* PYTHONLEGACYWINDOWSSTDIO:              PEP 528 Change Windows console encoding to UTF-8.\n(line   12)\n* PYTHONLEGACYWINDOWSSTDIO <1>:          Environment variables.\n(line  182)\n* PYTHONLEGACYWINDOWSSTDIO <2>:          sys -- System-specific parameters and functions.\n(line 1787)\n* PYTHONLEGACYWINDOWSSTDIO <3>:          Global configuration variables.\n(line  169)\n* PYTHONLEGACYWINDOWSSTDIO <4>:          PyConfig.           (line  506)\n* PYTHONMALLOC:                          PYTHONMALLOC environment variable.\n(line    6)\n* PYTHONMALLOC <1>:                      Changes in the C API<5>.\n(line    9)\n* PYTHONMALLOC <2>:                      Core and Builtins<73>.\n(line   90)\n* PYTHONMALLOC <3>:                      Environment variables.\n(line  311)\n* PYTHONMALLOC <4>:                      Performance options.\n(line   87)\n* PYTHONMALLOC <5>:                      Effects of the Python Development Mode.\n(line   46)\n* PYTHONMALLOC <6>:                      Effects of the Python Development Mode.\n(line   50)\n* PYTHONMALLOC <7>:                      Overview<4>.        (line   75)\n* PYTHONMALLOC <8>:                      Default Memory Allocators.\n(line   26)\n* PYTHONMALLOC <9>:                      Debug hooks on the Python memory allocators.\n(line   11)\n* PYTHONMALLOC <10>:                     The pymalloc allocator.\n(line   27)\n* PYTHONMALLOCSTATS:                     Core and Builtins<73>.\n(line   96)\n* PYTHONMALLOCSTATS <1>:                 PyConfig.           (line  522)\n* PYTHONMALLOCSTATS <2>:                 Overview<4>.        (line   78)\n* PYTHONNODEBUGRANGES:                   PEP 657 Fine-grained error locations in tracebacks.\n(line   63)\n* PYTHONNODEBUGRANGES <1>:               Miscellaneous options.\n(line  305)\n* PYTHONNODEBUGRANGES <2>:               Methods on code objects.\n(line   40)\n* PYTHONNODEBUGRANGES <3>:               PyConfig.           (line  237)\n* PYTHONNOUSERSITE:                      PEP 370 Per-user site-packages Directory.\n(line   30)\n* PYTHONNOUSERSITE <1>:                  Miscellaneous options.\n(line  148)\n* PYTHONNOUSERSITE <2>:                  Module contents<5>. (line   15)\n* PYTHONNOUSERSITE <3>:                  Global configuration variables.\n(line  203)\n* PYTHONNOUSERSITE <4>:                  PyConfig.           (line  862)\n* PYTHONOPTIMIZE:                        Miscellaneous options.\n(line   78)\n* PYTHONOPTIMIZE <1>:                    Global configuration variables.\n(line  214)\n* PYTHONOPTIMIZE <2>:                    PyConfig.           (line  589)\n* PYTHONPATH:                            Changes in 'python' Command Behavior<2>.\n(line    8)\n* PYTHONPATH <1>:                        Changes in 'python' Command Behavior<2>.\n(line    9)\n* PYTHONPATH <2>:                        The Module Search Path.\n(line   16)\n* PYTHONPATH <3>:                        Standard Modules.   (line   34)\n* PYTHONPATH <4>:                        Standard Modules.   (line   35)\n* PYTHONPATH <5>:                        Miscellaneous options.\n(line   45)\n* PYTHONPATH <6>:                        Environment variables.\n(line   32)\n* PYTHONPATH <7>:                        Environment variables.\n(line   39)\n* PYTHONPATH <8>:                        Environment variables.\n(line   42)\n* PYTHONPATH <9>:                        Excursus Setting environment variables.\n(line   38)\n* PYTHONPATH <10>:                       Finding modules.    (line   15)\n* PYTHONPATH <11>:                       Finding modules.    (line   38)\n* PYTHONPATH <12>:                       Finding modules.    (line   81)\n* PYTHONPATH <13>:                       Configuration.      (line    6)\n* PYTHONPATH <14>:                       Path entry finders. (line    6)\n* PYTHONPATH <15>:                       Path entry finders. (line   23)\n* PYTHONPATH <16>:                       test support scripthelper -- Utilities for the Python execution tests.\n(line   26)\n* PYTHONPATH <17>:                       sys -- System-specific parameters and functions.\n(line 1263)\n* PYTHONPATH <18>:                       sys -- System-specific parameters and functions.\n(line 1268)\n* PYTHONPATH <19>:                       The initialization of the sys path module search path.\n(line   14)\n* PYTHONPATH <20>:                       The initialization of the sys path module search path.\n(line   18)\n* PYTHONPATH <21>:                       Installing your CGI script on a Unix system.\n(line   29)\n* PYTHONPATH <22>:                       Building C and C++ Extensions.\n(line    9)\n* PYTHONPATH <23>:                       Embedding Python<2>.\n(line   39)\n* PYTHONPATH <24>:                       Embedding Python<2>.\n(line   44)\n* PYTHONPATH <25>:                       Global configuration variables.\n(line   91)\n* PYTHONPATH <26>:                       PyConfig.           (line  555)\n* PYTHONPERFSUPPORT:                     Other Language Changes.\n(line   85)\n* PYTHONPERFSUPPORT <1>:                 Miscellaneous options.\n(line  321)\n* PYTHONPERFSUPPORT <2>:                 PyConfig.           (line  836)\n* PYTHONPERFSUPPORT <3>:                 How to enable perf profiling support.\n(line    7)\n* PYTHONPLATLIBDIR:                      Core and Builtins<34>.\n(line  275)\n* PYTHONPLATLIBDIR <1>:                  The initialization of the sys path module search path.\n(line   51)\n* PYTHONPLATLIBDIR <2>:                  PyConfig.           (line  534)\n* PYTHONPROFILEIMPORTTIME:               Other Language Changes<6>.\n(line   47)\n* PYTHONPROFILEIMPORTTIME <1>:           Core and Builtins<55>.\n(line   66)\n* PYTHONPROFILEIMPORTTIME <2>:           Miscellaneous options.\n(line  279)\n* PYTHONPROFILEIMPORTTIME <3>:           PyConfig.           (line  421)\n* PYTHONPYCACHEPREFIX:                   Parallel filesystem cache for compiled bytecode files.\n(line    6)\n* PYTHONPYCACHEPREFIX <1>:               Core and Builtins<46>.\n(line  402)\n* PYTHONPYCACHEPREFIX <2>:               Miscellaneous options.\n(line  293)\n* PYTHONPYCACHEPREFIX <3>:               sys -- System-specific parameters and functions.\n(line  375)\n* PYTHONPYCACHEPREFIX <4>:               PyConfig.           (line  697)\n* PYTHONREGRTESTUNICODEGUARD:          Tests<17>.          (line   13)\n* PYTHONSAFEPATH:                        Summary - Release highlights<2>.\n(line   27)\n* PYTHONSAFEPATH <1>:                    Other Language Changes<2>.\n(line   37)\n* PYTHONSAFEPATH <2>:                    Security<13>.       (line    6)\n* PYTHONSAFEPATH <3>:                    Miscellaneous options.\n(line  106)\n* PYTHONSAFEPATH <4>:                    sys -- System-specific parameters and functions.\n(line 1280)\n* PYTHONSAFEPATH <5>:                    Security Considerations<4>.\n(line   49)\n* PYTHONSAFEPATH <6>:                    PyConfig.           (line  160)\n* PYTHONSTARTUP:                         sys<10>.            (line   17)\n* PYTHONSTARTUP <1>:                     sys<10>.            (line   21)\n* PYTHONSTARTUP <2>:                     IDLE<30>.           (line  176)\n* PYTHONSTARTUP <3>:                     IDLE<34>.           (line    9)\n* PYTHONSTARTUP <4>:                     IDLE<40>.           (line    9)\n* PYTHONSTARTUP <5>:                     The Interactive Startup File.\n(line    8)\n* PYTHONSTARTUP <6>:                     Miscellaneous options.\n(line   55)\n* PYTHONSTARTUP <7>:                     Example.            (line   10)\n* PYTHONSTARTUP <8>:                     Startup and Code Execution.\n(line    7)\n* PYTHONSTARTUP <9>:                     sys -- System-specific parameters and functions.\n(line 1133)\n* PYTHONSTARTUP <10>:                    Readline configuration.\n(line   12)\n* PYTHONTRACEMALLOC:                     Miscellaneous options.\n(line  269)\n* PYTHONTRACEMALLOC <1>:                 tracemalloc -- Trace memory allocations.\n(line   25)\n* PYTHONTRACEMALLOC <2>:                 tracemalloc -- Trace memory allocations.\n(line   32)\n* PYTHONTRACEMALLOC <3>:                 Functions<11>.      (line   90)\n* PYTHONTRACEMALLOC <4>:                 PyConfig.           (line  824)\n* PYTHONTZPATH:                          Exceptions and warnings.\n(line   14)\n* PYTHONUNBUFFERED:                      Core and Builtins<39>.\n(line  107)\n* PYTHONUNBUFFERED <1>:                  Miscellaneous options.\n(line  168)\n* PYTHONUNBUFFERED <2>:                  sys -- System-specific parameters and functions.\n(line 1794)\n* PYTHONUNBUFFERED <3>:                  Global configuration variables.\n(line  242)\n* PYTHONUNBUFFERED <4>:                  PyConfig.           (line  201)\n* PYTHONUSERBASE:                        PEP 370 Per-user site-packages Directory.\n(line   23)\n* PYTHONUSERBASE <1>:                    Module contents<5>. (line   39)\n* PYTHONUSERBASE <2>:                    Module contents<5>. (line   67)\n* PYTHONUSERSITE:                        test support scripthelper -- Utilities for the Python execution tests.\n(line   26)\n* PYTHONUTF8:                            PEP 540 Forced UTF-8 Runtime Mode.\n(line    6)\n* PYTHONUTF8 <1>:                        Miscellaneous options.\n(line  289)\n* PYTHONUTF8 <2>:                        Environment variables.\n(line  394)\n* PYTHONUTF8 <3>:                        UTF-8 mode.         (line   18)\n* PYTHONUTF8 <4>:                        Python UTF-8 Mode.  (line   52)\n* PYTHONUTF8 <5>:                        Python UTF-8 Mode.  (line   54)\n* PYTHONUTF8 <6>:                        sys -- System-specific parameters and functions.\n(line 1785)\n* PYTHONUTF8 <7>:                        PyPreConfig.        (line  141)\n* PYTHONUTF8 <8>:                        Python Configuration.\n(line   14)\n* PYTHONVERBOSE:                         Miscellaneous options.\n(line  184)\n* PYTHONVERBOSE <1>:                     Global configuration variables.\n(line  259)\n* PYTHONVERBOSE <2>:                     PyConfig.           (line  879)\n* PYTHONWARNDEFAULTENCODING:             Optional EncodingWarning and encoding=\"locale\" option.\n(line   19)\n* PYTHONWARNDEFAULTENCODING <1>:         Library<28>.        (line   45)\n* PYTHONWARNDEFAULTENCODING <2>:         Miscellaneous options.\n(line  297)\n* PYTHONWARNDEFAULTENCODING <3>:         Opt-in EncodingWarning.\n(line    9)\n* PYTHONWARNINGS:                        warnings<2>.        (line   21)\n* PYTHONWARNINGS <1>:                    Other Language Changes<11>.\n(line  160)\n* PYTHONWARNINGS <2>:                    Changes to the Handling of Deprecation Warnings.\n(line   25)\n* PYTHONWARNINGS <3>:                    Interpreter Changes.\n(line    6)\n* PYTHONWARNINGS <4>:                    Documentation<18>.  (line   67)\n* PYTHONWARNINGS <5>:                    Miscellaneous options.\n(line  237)\n* PYTHONWARNINGS <6>:                    Effects of the Python Development Mode.\n(line   30)\n* PYTHONWARNINGS <7>:                    The Warnings Filter.\n(line   46)\n* PYTHONWARNINGS <8>:                    The Warnings Filter.\n(line   56)\n* PYTHONWARNINGS <9>:                    Describing Warning Filters.\n(line    7)\n* PYTHONWARNINGS <10>:                   Describing Warning Filters.\n(line   21)\n* PYTHONWARNINGS <11>:                   Default Warning Filter.\n(line    7)\n* PYTHONWARNINGS <12>:                   PyConfig.           (line  898)\n* PyThreadcreatekey (C function):      Thread Local Storage TLS API.\n(line   18)\n* PyThreaddeletekey (C function):      Thread Local Storage TLS API.\n(line   21)\n* PyThreaddeletekeyvalue (C function): Thread Local Storage TLS API.\n(line   30)\n* PyThreadgetkeyvalue (C function):   Thread Local Storage TLS API.\n(line   27)\n* PyThreadReInitTLS (C function):       Thread Local Storage TLS API.\n(line   33)\n* PyThreadsetkeyvalue (C function):   Thread Local Storage TLS API.\n(line   24)\n* PyThreadtssalloc (C function):       Dynamic Allocation. (line   11)\n* PyThreadtsscreate (C function):      Methods<4>.         (line   16)\n* PyThreadtssdelete (C function):      Methods<4>.         (line   24)\n* PyThreadtssfree (C function):        Dynamic Allocation. (line   17)\n* PyThreadtssget (C function):         Methods<4>.         (line   39)\n* PyThreadtssiscreated (C function):  Methods<4>.         (line   11)\n* PyThreadtssset (C function):         Methods<4>.         (line   33)\n* PyThreadState (C type):                Thread State and the Global Interpreter Lock.\n(line   23)\n* PyThreadState (C type) <1>:            High-level API.     (line   21)\n* PyThreadStateClear (C function):      Low-level API.      (line   44)\n* PyThreadStateDelete (C function):     Low-level API.      (line   52)\n* PyThreadStateDeleteCurrent (C function): Low-level API.   (line   58)\n* PyThreadStateEnterTracing (C function): Low-level API.    (line   96)\n* PyThreadStateGet (C function):        High-level API.     (line   81)\n* PyThreadStateGetDict (C function):    Low-level API.      (line  184)\n* PyThreadStateGetFrame (C function):   Low-level API.      (line   65)\n* PyThreadStateGetID (C function):      Low-level API.      (line   79)\n* PyThreadStateGetInterpreter (C function): Low-level API.  (line   87)\n* PyThreadStateLeaveTracing (C function): Low-level API.    (line  105)\n* PyThreadStateNew (C function):        Low-level API.      (line   37)\n* PyThreadStateNext (C function):       Advanced Debugger Support.\n(line   32)\n* PyThreadStateSetAsyncExc (C function): Low-level API.     (line  193)\n* PyThreadStateSwap (C function):       High-level API.     (line   87)\n* PyThreadState.interp (C member):       High-level API.     (line   26)\n* PyTimeCheck (C function):             DateTime Objects<2>.\n(line   97)\n* PyTimeCheckExact (C function):        DateTime Objects<2>.\n(line  103)\n* PyTimeFromTime (C function):          DateTime Objects<2>.\n(line  153)\n* PyTimeFromTimeAndFold (C function):   DateTime Objects<2>.\n(line  158)\n* PyTimeZoneFromOffset (C function):    DateTime Objects<2>.\n(line  174)\n* PyTimeZoneFromOffsetAndName (C function): DateTime Objects<2>.\n(line  182)\n* PyTraceCCALL (C var):                Profiling and Tracing.\n(line   94)\n* PyTraceCEXCEPTION (C var):           Profiling and Tracing.\n(line   99)\n* PyTraceCRETURN (C var):              Profiling and Tracing.\n(line  104)\n* PyTraceCALL (C var):                  Profiling and Tracing.\n(line   62)\n* PyTraceEXCEPTION (C var):             Profiling and Tracing.\n(line   70)\n* PyTraceLINE (C var):                  Profiling and Tracing.\n(line   82)\n* PyTraceOPCODE (C var):                Profiling and Tracing.\n(line  109)\n* PyTraceRETURN (C var):                Profiling and Tracing.\n(line   89)\n* PyTraceMallocTrack (C function):      tracemalloc C API.  (line    8)\n* PyTraceMallocUntrack (C function):    tracemalloc C API.  (line   20)\n* PyTupleCheck (C function):            Tuple Objects.      (line   16)\n* PyTupleCheckExact (C function):       Tuple Objects.      (line   21)\n* PyTupleGETITEM (C function):         Tuple Objects.      (line   54)\n* PyTupleGETSIZE (C function):         Tuple Objects.      (line   42)\n* PyTupleGetItem (C function):          Tuple Objects.      (line   47)\n* PyTupleGetSlice (C function):         Tuple Objects.      (line   59)\n* PyTupleNew (C function):              Tuple Objects.      (line   26)\n* PyTuplePack (C function):             Tuple Objects.      (line   31)\n* PyTupleSETITEM (C function):         Tuple Objects.      (line   78)\n* PyTupleSetItem (C function):          Reference Count Details.\n(line   26)\n* PyTupleSetItem (C function) <1>:      Tuple Objects.      (line   67)\n* PyTupleSize (C function):             Tuple Objects.      (line   38)\n* PyTupleType (C var):                  Tuple Objects.      (line   11)\n* PyTupleObject (C type):                Tuple Objects.      (line    6)\n* PyTypeAddWatcher (C function):        Type Objects<2>.    (line   67)\n* PyTypeCheck (C function):             Type Objects<2>.    (line   15)\n* PyTypeCheckExact (C function):        Type Objects<2>.    (line   21)\n* PyTypeClearCache (C function):        Type Objects<2>.    (line   27)\n* PyTypeClearWatcher (C function):      Type Objects<2>.    (line   76)\n* PyTypeFromMetaclass (C function):     Creating Heap-Allocated Types.\n(line    9)\n* PyTypeFromModuleAndSpec (C function): Creating Heap-Allocated Types.\n(line   59)\n* PyTypeFromSpec (C function):          Creating Heap-Allocated Types.\n(line   96)\n* PyTypeFromSpecWithBases (C function): Creating Heap-Allocated Types.\n(line   79)\n* PyTypeGenericAlloc (C function):      Type Objects<2>.    (line  134)\n* PyTypeGenericNew (C function):        Type Objects<2>.    (line  141)\n* PyTypeGetDict (C function):           Type Objects<2>.    (line   43)\n* PyTypeGetFlags (C function):          Type Objects<2>.    (line   31)\n* PyTypeGetModule (C function):         Type Objects<2>.    (line  197)\n* PyTypeGetModuleByDef (C function):    Type Objects<2>.    (line  231)\n* PyTypeGetModuleState (C function):    Type Objects<2>.    (line  217)\n* PyTypeGetName (C function):           Type Objects<2>.    (line  164)\n* PyTypeGetQualName (C function):       Type Objects<2>.    (line  172)\n* PyTypeGetSlot (C function):           Type Objects<2>.    (line  180)\n* PyTypeGetTypeDataSize (C function):   Object Protocol.    (line  412)\n* PyTypeHasFeature (C function):        Type Objects<2>.    (line  115)\n* PyTypeISGC (C function):             Type Objects<2>.    (line  120)\n* PyTypeIsSubtype (C function):         Type Objects<2>.    (line  125)\n* PyTypeModified (C function):          Type Objects<2>.    (line   61)\n* PyTypeReady (C function):             Type Objects<2>.    (line  148)\n* PyTypeSlot (C type):                  Creating Heap-Allocated Types.\n(line  177)\n* PyTypeSlot.pfunc (C member):          Creating Heap-Allocated Types.\n(line  244)\n* PyTypeSlot.slot (C member):           Creating Heap-Allocated Types.\n(line  182)\n* PyTypeSpec (C type):                  Creating Heap-Allocated Types.\n(line  112)\n* PyTypeSpec.basicsize (C member):      Creating Heap-Allocated Types.\n(line  121)\n* PyTypeSpec.flags (C member):          Creating Heap-Allocated Types.\n(line  163)\n* PyTypeSpec.itemsize (C member):       Creating Heap-Allocated Types.\n(line  137)\n* PyTypeSpec.name (C member):           Creating Heap-Allocated Types.\n(line  116)\n* PyTypeSpec.slots (C member):          Creating Heap-Allocated Types.\n(line  170)\n* PyTypeType (C var):                   Type Objects<2>.    (line   10)\n* PyTypeWatch (C function):             Type Objects<2>.    (line   88)\n* PyTypeWatchCallback (C type):         Type Objects<2>.    (line  104)\n* PyTypeObject (C type):                 Type Objects<2>.    (line    6)\n* PyTypeObject.tpalloc (C member):      PyTypeObject Slots. (line 1337)\n* PyTypeObject.tpasasync (C member):   PyTypeObject Slots. (line  235)\n* PyTypeObject.tpasbuffer (C member):  PyTypeObject Slots. (line  442)\n* PyTypeObject.tpasmapping (C member): PyTypeObject Slots. (line  301)\n* PyTypeObject.tpasnumber (C member):  PyTypeObject Slots. (line  277)\n* PyTypeObject.tpassequence (C member): PyTypeObject Slots.\n(line  289)\n* PyTypeObject.tpbase (C member):       PyTypeObject Slots. (line 1159)\n* PyTypeObject.tpbases (C member):      PyTypeObject Slots. (line 1452)\n* PyTypeObject.tpbasicsize (C member):  PyTypeObject Slots. (line   47)\n* PyTypeObject.tpcache (C member):      PyTypeObject Slots. (line 1486)\n* PyTypeObject.tpcall (C member):       PyTypeObject Slots. (line  350)\n* PyTypeObject.tpclear (C member):      PyTypeObject Slots. (line  883)\n* PyTypeObject.tpdealloc (C member):    PyTypeObject Slots. (line  100)\n* PyTypeObject.tpdel (C member):        PyTypeObject Slots. (line 1525)\n* PyTypeObject.tpdescrget (C member):  PyTypeObject Slots. (line 1227)\n* PyTypeObject.tpdescrset (C member):  PyTypeObject Slots. (line 1240)\n* PyTypeObject.tpdict (C member):       PyTypeObject Slots. (line 1191)\n* PyTypeObject.tpdictoffset (C member): PyTypeObject Slots. (line 1256)\n* PyTypeObject.tpdoc (C member):        PyTypeObject Slots. (line  798)\n* PyTypeObject.tpfinalize (C member):   PyTypeObject Slots. (line 1537)\n* PyTypeObject.tpflags (C member):      PyTypeObject Slots. (line  454)\n* PyTypeObject.tpfree (C member):       PyTypeObject Slots. (line 1399)\n* PyTypeObject.tpgetattr (C member):    PyTypeObject Slots. (line  194)\n* PyTypeObject.tpgetattro (C member):   PyTypeObject Slots. (line  388)\n* PyTypeObject.tpgetset (C member):     PyTypeObject Slots. (line 1143)\n* PyTypeObject.tphash (C member):       PyTypeObject Slots. (line  313)\n* PyTypeObject.tpinit (C member):       PyTypeObject Slots. (line 1301)\n* PyTypeObject.tpisgc (C member):      PyTypeObject Slots. (line 1423)\n* PyTypeObject.tpitemsize (C member):   PyTypeObject Slots. (line   47)\n* PyTypeObject.tpiter (C member):       PyTypeObject Slots. (line 1072)\n* PyTypeObject.tpiternext (C member):   PyTypeObject Slots. (line 1088)\n* PyTypeObject.tpmembers (C member):    PyTypeObject Slots. (line 1127)\n* PyTypeObject.tpmethods (C member):    PyTypeObject Slots. (line 1111)\n* PyTypeObject.tpmro (C member):        PyTypeObject Slots. (line 1472)\n* PyTypeObject.tpname (C member):       PyTypeObject Slots. (line   12)\n* PyTypeObject.tpnew (C member):        PyTypeObject Slots. (line 1360)\n* PyTypeObject.tprepr (C member):       PyTypeObject Slots. (line  251)\n* PyTypeObject.tprichcompare (C member): PyTypeObject Slots.\n(line  959)\n* PyTypeObject.tpsetattr (C member):    PyTypeObject Slots. (line  214)\n* PyTypeObject.tpsetattro (C member):   PyTypeObject Slots. (line  414)\n* PyTypeObject.tpstr (C member):        PyTypeObject Slots. (line  362)\n* PyTypeObject.tpsubclasses (C member): PyTypeObject Slots. (line 1494)\n* PyTypeObject.tptraverse (C member):   PyTypeObject Slots. (line  808)\n* PyTypeObject.tpvectorcall (C member): PyTypeObject Slots. (line 1597)\n* PyTypeObject.tpvectorcalloffset (C member): PyTypeObject Slots.\n(line  154)\n* PyTypeObject.tpversiontag (C member): PyTypeObject Slots.\n(line 1529)\n* PyTypeObject.tpwatched (C member):    PyTypeObject Slots. (line 1613)\n* PyTypeObject.tpweaklist (C member):   PyTypeObject Slots. (line 1510)\n* PyTypeObject.tpweaklistoffset (C member): PyTypeObject Slots.\n(line 1036)\n* PyTZInfoCheck (C function):           DateTime Objects<2>.\n(line  119)\n* PyTZInfoCheckExact (C function):      DateTime Objects<2>.\n(line  125)\n* PyUnicode1BYTEDATA (C function):     Unicode Type.       (line   75)\n* PyUnicode1BYTEKIND (C macro):        Unicode Type.       (line   90)\n* PyUnicode2BYTEDATA (C function):     Unicode Type.       (line   75)\n* PyUnicode2BYTEKIND (C macro):        Unicode Type.       (line   90)\n* PyUnicode4BYTEDATA (C function):     Unicode Type.       (line   75)\n* PyUnicode4BYTEKIND (C macro):        Unicode Type.       (line   90)\n* PyUnicodeAsASCIIString (C function):  ASCII Codecs.       (line   16)\n* PyUnicodeAsCharmapString (C function): Character Map Codecs.\n(line   31)\n* PyUnicodeAsEncodedString (C function): Generic Codecs.    (line   18)\n* PyUnicodeAsLatin1String (C function): Latin-1 Codecs.     (line   17)\n* PyUnicodeAsMBCSString (C function):   MBCS codecs for Windows.\n(line   29)\n* PyUnicodeAsRawUnicodeEscapeString (C function): Raw-Unicode-Escape Codecs.\n(line   15)\n* PyUnicodeAsUCS4 (C function):         Creating and accessing Unicode strings.\n(line  326)\n* PyUnicodeAsUCS4Copy (C function):     Creating and accessing Unicode strings.\n(line  336)\n* PyUnicodeAsUnicodeEscapeString (C function): Unicode-Escape Codecs.\n(line   15)\n* PyUnicodeAsUTF16String (C function):  UTF-16 Codecs.      (line   48)\n* PyUnicodeAsUTF32String (C function):  UTF-32 Codecs.      (line   47)\n* PyUnicodeAsUTF8 (C function):         UTF-8 Codecs.       (line   59)\n* PyUnicodeAsUTF8AndSize (C function):  UTF-8 Codecs.       (line   32)\n* PyUnicodeAsUTF8String (C function):   UTF-8 Codecs.       (line   25)\n* PyUnicodeAsWideChar (C function):     wchart Support.    (line   16)\n* PyUnicodeAsWideCharString (C function): wchart Support.  (line   34)\n* PyUnicodeCheck (C function):          Unicode Type.       (line   47)\n* PyUnicodeCheckExact (C function):     Unicode Type.       (line   52)\n* PyUnicodeCompare (C function):        Methods and Slot Functions.\n(line   89)\n* PyUnicodeCompareWithASCIIString (C function): Methods and Slot Functions.\n(line   97)\n* PyUnicodeConcat (C function):         Methods and Slot Functions.\n(line   12)\n* PyUnicodeContains (C function):       Methods and Slot Functions.\n(line  131)\n* PyUnicodeCopyCharacters (C function): Creating and accessing Unicode strings.\n(line  268)\n* PyUnicodeCount (C function):          Methods and Slot Functions.\n(line   75)\n* PyUnicodeDATA (C function):           Unicode Type.       (line  109)\n* PyUnicodeDecode (C function):         Generic Codecs.     (line    8)\n* PyUnicodeDecodeASCII (C function):    ASCII Codecs.       (line    9)\n* PyUnicodeDecodeCharmap (C function):  Character Map Codecs.\n(line   15)\n* PyUnicodeDecodeFSDefault (C function): File System Encoding.\n(line   59)\n* PyUnicodeDecodeFSDefaultAndSize (C function): File System Encoding.\n(line   42)\n* PyUnicodeDecodeLatin1 (C function):   Latin-1 Codecs.     (line   10)\n* PyUnicodeDecodeLocale (C function):   Locale Encoding.    (line   37)\n* PyUnicodeDecodeLocaleAndSize (C function): Locale Encoding.\n(line    9)\n* PyUnicodeDecodeMBCS (C function):     MBCS codecs for Windows.\n(line   12)\n* PyUnicodeDecodeMBCSStateful (C function): MBCS codecs for Windows.\n(line   19)\n* PyUnicodeDecodeRawUnicodeEscape (C function): Raw-Unicode-Escape Codecs.\n(line    8)\n* PyUnicodeDecodeUnicodeEscape (C function): Unicode-Escape Codecs.\n(line    8)\n* PyUnicodeDecodeUTF16 (C function):    UTF-16 Codecs.      (line    8)\n* PyUnicodeDecodeUTF16Stateful (C function): UTF-16 Codecs. (line   36)\n* PyUnicodeDecodeUTF32 (C function):    UTF-32 Codecs.      (line    8)\n* PyUnicodeDecodeUTF32Stateful (C function): UTF-32 Codecs. (line   35)\n* PyUnicodeDecodeUTF7 (C function):     UTF-7 Codecs.       (line    8)\n* PyUnicodeDecodeUTF7Stateful (C function): UTF-7 Codecs.   (line   15)\n* PyUnicodeDecodeUTF8 (C function):     UTF-8 Codecs.       (line    8)\n* PyUnicodeDecodeUTF8Stateful (C function): UTF-8 Codecs.   (line   15)\n* PyUnicodeEncodeCodePage (C function): MBCS codecs for Windows.\n(line   36)\n* PyUnicodeEncodeFSDefault (C function): File System Encoding.\n(line   71)\n* PyUnicodeEncodeLocale (C function):   Locale Encoding.    (line   46)\n* PyUnicodeFill (C function):           Creating and accessing Unicode strings.\n(line  279)\n* PyUnicodeFind (C function):           Methods and Slot Functions.\n(line   48)\n* PyUnicodeFindChar (C function):       Methods and Slot Functions.\n(line   59)\n* PyUnicodeFormat (C function):         Methods and Slot Functions.\n(line  125)\n* PyUnicodeFromEncodedObject (C function): Creating and accessing Unicode strings.\n(line  244)\n* PyUnicodeFromFormat (C function):     Creating and accessing Unicode strings.\n(line   60)\n* PyUnicodeFromFormatV (C function):    Creating and accessing Unicode strings.\n(line  227)\n* PyUnicodeFromKindAndData (C function): Creating and accessing Unicode strings.\n(line   21)\n* PyUnicodeFromObject (C function):     Creating and accessing Unicode strings.\n(line  233)\n* PyUnicodeFromString (C function):     Creating and accessing Unicode strings.\n(line   54)\n* PyUnicodeFromStringAndSize (C function): Creating and accessing Unicode strings.\n(line   37)\n* PyUnicodeFromWideChar (C function):   wchart Support.    (line    8)\n* PyUnicodeFSConverter (C function):    File System Encoding.\n(line   13)\n* PyUnicodeFSDecoder (C function):      File System Encoding.\n(line   29)\n* PyUnicodeGETLENGTH (C function):     Unicode Type.       (line   66)\n* PyUnicodeGetLength (C function):      Creating and accessing Unicode strings.\n(line  261)\n* PyUnicodeInternFromString (C function): Methods and Slot Functions.\n(line  153)\n* PyUnicodeInternInPlace (C function):  Methods and Slot Functions.\n(line  139)\n* PyUnicodeIsIdentifier (C function):   Unicode Type.       (line  158)\n* PyUnicodeJoin (C function):           Methods and Slot Functions.\n(line   34)\n* PyUnicodeKIND (C function):           Unicode Type.       (line  100)\n* PyUnicodeMAXCHARVALUE (C function): Unicode Type.       (line  148)\n* PyUnicodeNew (C function):            Creating and accessing Unicode strings.\n(line    9)\n* PyUnicodeREAD (C function):           Unicode Type.       (line  130)\n* PyUnicodeREADCHAR (C function):      Unicode Type.       (line  139)\n* PyUnicodeReadChar (C function):       Creating and accessing Unicode strings.\n(line  308)\n* PyUnicodeREADY (C function):          Unicode Type.       (line   57)\n* PyUnicodeReplace (C function):        Methods and Slot Functions.\n(line   81)\n* PyUnicodeRichCompare (C function):    Methods and Slot Functions.\n(line  107)\n* PyUnicodeSplit (C function):          Methods and Slot Functions.\n(line   17)\n* PyUnicodeSplitlines (C function):     Methods and Slot Functions.\n(line   26)\n* PyUnicodeSubstring (C function):      Creating and accessing Unicode strings.\n(line  317)\n* PyUnicodeTailmatch (C function):      Methods and Slot Functions.\n(line   40)\n* PyUnicodeTranslate (C function):      Character Map Codecs.\n(line   46)\n* PyUnicodeType (C var):                Unicode Type.       (line   39)\n* PyUnicodeWRITE (C function):          Unicode Type.       (line  117)\n* PyUnicodeWriteChar (C function):      Creating and accessing Unicode strings.\n(line  294)\n* PyUnicodeDecodeErrorCreate (C function): Unicode Exception Objects.\n(line    9)\n* PyUnicodeDecodeErrorGetEncoding (C function): Unicode Exception Objects.\n(line   17)\n* PyUnicodeDecodeErrorGetEnd (C function): Unicode Exception Objects.\n(line   54)\n* PyUnicodeDecodeErrorGetObject (C function): Unicode Exception Objects.\n(line   25)\n* PyUnicodeDecodeErrorGetReason (C function): Unicode Exception Objects.\n(line   74)\n* PyUnicodeDecodeErrorGetStart (C function): Unicode Exception Objects.\n(line   34)\n* PyUnicodeDecodeErrorSetEnd (C function): Unicode Exception Objects.\n(line   64)\n* PyUnicodeDecodeErrorSetReason (C function): Unicode Exception Objects.\n(line   83)\n* PyUnicodeDecodeErrorSetStart (C function): Unicode Exception Objects.\n(line   44)\n* PyUnicodeEncodeErrorGetEncoding (C function): Unicode Exception Objects.\n(line   17)\n* PyUnicodeEncodeErrorGetEnd (C function): Unicode Exception Objects.\n(line   54)\n* PyUnicodeEncodeErrorGetObject (C function): Unicode Exception Objects.\n(line   25)\n* PyUnicodeEncodeErrorGetReason (C function): Unicode Exception Objects.\n(line   74)\n* PyUnicodeEncodeErrorGetStart (C function): Unicode Exception Objects.\n(line   34)\n* PyUnicodeEncodeErrorSetEnd (C function): Unicode Exception Objects.\n(line   64)\n* PyUnicodeEncodeErrorSetReason (C function): Unicode Exception Objects.\n(line   83)\n* PyUnicodeEncodeErrorSetStart (C function): Unicode Exception Objects.\n(line   44)\n* PyUnicodeObject (C type):              Unicode Type.       (line   28)\n* PyUnicodeTranslateErrorGetEnd (C function): Unicode Exception Objects.\n(line   54)\n* PyUnicodeTranslateErrorGetObject (C function): Unicode Exception Objects.\n(line   25)\n* PyUnicodeTranslateErrorGetReason (C function): Unicode Exception Objects.\n(line   74)\n* PyUnicodeTranslateErrorGetStart (C function): Unicode Exception Objects.\n(line   34)\n* PyUnicodeTranslateErrorSetEnd (C function): Unicode Exception Objects.\n(line   64)\n* PyUnicodeTranslateErrorSetReason (C function): Unicode Exception Objects.\n(line   83)\n* PyUnicodeTranslateErrorSetStart (C function): Unicode Exception Objects.\n(line   44)\n* PyUnstable:                            Unstable C API.     (line    6)\n* PyUnstableCodeGetExtra (C function): Extra information.  (line   35)\n* PyUnstableCodeNew (C function):      Code Objects<2>.    (line   34)\n* PyUnstableCodeNewWithPosOnlyArgs (C function): Code Objects<2>.\n(line   61)\n* PyUnstableCodeSetExtra (C function): Extra information.  (line   51)\n* PyUnstableEvalRequestCodeExtraIndex (C function): Extra information.\n(line   14)\n* PyUnstableExcPrepReraiseStar (C function): Exception Objects.\n(line   61)\n* PyUnstableGCVisitObjects (C function): Querying Garbage Collector State.\n(line    9)\n* PyUnstableInterpreterFrameGetCode (C function): Internal Frames.\n(line   14)\n* PyUnstableInterpreterFrameGetLasti (C function): Internal Frames.\n(line   24)\n* PyUnstableInterpreterFrameGetLine (C function): Internal Frames.\n(line   32)\n* PyUnstableLongCompactValue (C function): Integer Objects.\n(line  317)\n* PyUnstableLongIsCompact (C function): Integer Objects.   (line  301)\n* PyUnstableObjectGCNewWithExtraData (C function): Supporting Cyclic Garbage Collection.\n(line   66)\n* PyUnstablePerfMapStateFini (C function): Support for Perf Maps.\n(line   48)\n* PyUnstablePerfMapStateInit (C function): Support for Perf Maps.\n(line   19)\n* PyUnstableTypeAssignVersionTag (C function): Type Objects<2>.\n(line  248)\n* PyUnstableWritePerfMapEntry (C function): Support for Perf Maps.\n(line   33)\n* PyVarObject (C type):                  Base object types and macros.\n(line   26)\n* PyVarObjectHEADINIT (C macro):       Base object types and macros.\n(line  131)\n* PyVarObject.obsize (C member):        PyVarObject Slots.  (line    6)\n* PyVectorcallCall (C function):        Vectorcall Support API.\n(line   33)\n* PyVectorcallFunction (C function):    Vectorcall Support API.\n(line   19)\n* PyVectorcallNARGS (C function):       Vectorcall Support API.\n(line    6)\n* PyWeakrefCheck (C function):          Weak Reference Objects<2>.\n(line   11)\n* PyWeakrefCheckProxy (C function):     Weak Reference Objects<2>.\n(line   21)\n* PyWeakrefCheckRef (C function):       Weak Reference Objects<2>.\n(line   16)\n* PyWeakrefGETOBJECT (C function):     Weak Reference Objects<2>.\n(line   66)\n* PyWeakrefGetObject (C function):      Weak Reference Objects<2>.\n(line   54)\n* PyWeakrefNewProxy (C function):       Weak Reference Objects<2>.\n(line   40)\n* PyWeakrefNewRef (C function):         Weak Reference Objects<2>.\n(line   26)\n* PyWideStringList (C type):             PyWideStringList.   (line    6)\n* PyWideStringListAppend (C function):  PyWideStringList.   (line   15)\n* PyWideStringListInsert (C function):  PyWideStringList.   (line   22)\n* PyWideStringList.items (C member):     PyWideStringList.   (line   41)\n* PyWideStringList.length (C member):    PyWideStringList.   (line   37)\n* PyWrapperNew (C function):            Descriptor Objects. (line   43)\n* PyZipFile (class in zipfile):          PyZipFile Objects.  (line   10)\n* qiflush() (in module curses):          Functions<6>.       (line  398)\n* QName (class in xml.etree.ElementTree): QName Objects.     (line    6)\n* qsize() (asyncio.Queue method):        Queue.              (line   73)\n* qsize() (multiprocessing.Queue method): Pipes and Queues.  (line   98)\n* qsize() (queue.Queue method):          Queue Objects.      (line    9)\n* qsize() (queue.SimpleQueue method):    SimpleQueue Objects.\n(line    9)\n* qualified name:                        Glossary.           (line 1175)\n* quantiles() (in module statistics):    Function details.   (line  420)\n* quantiles() (statistics.NormalDist method): NormalDist objects.\n(line  103)\n* quantize() (decimal.Context method):   Context objects.    (line  478)\n* quantize() (decimal.Decimal method):   Decimal objects.    (line  476)\n* QueryInfoKey() (in module winreg):     Functions<13>.      (line  319)\n* QueryReflectionKey() (in module winreg): Functions<13>.    (line  516)\n* QueryValue() (in module winreg):       Functions<13>.      (line  348)\n* QueryValueEx() (in module winreg):     Functions<13>.      (line  368)\n* QUESTION (in module tkinter.messagebox): tkinter messagebox -- Tkinter message prompts.\n(line  196)\n* Queue (class in asyncio):              Queue.              (line    6)\n* Queue (class in multiprocessing):      Pipes and Queues.   (line   84)\n* Queue (class in queue):                queue -- A synchronized queue class.\n(line   34)\n* queue (sched.scheduler attribute):     Scheduler Objects.  (line   73)\n* Queue() (multiprocessing.managers.SyncManager method): Managers.\n(line  198)\n* QueueEmpty:                            Exceptions<10>.     (line    6)\n* QueueFull:                             Exceptions<10>.     (line   11)\n* QueueHandler (class in logging.handlers): QueueHandler.    (line   21)\n* QueueListener (class in logging.handlers): QueueListener.  (line   25)\n* quickratio() (difflib.SequenceMatcher method): SequenceMatcher Objects.\n(line  204)\n* quiet (sys.flags attribute):           sys -- System-specific parameters and functions.\n(line  550)\n* quit (built-in variable):              Constants added by the site module.\n(line   11)\n* quit (pdb command):                    Debugger Commands.  (line  402)\n* quit() (ftplib.FTP method):            FTP objects.        (line  360)\n* quit() (nntplib.NNTP method):          Methods<3>.         (line   22)\n* quit() (poplib.POP3 method):           POP3 Objects.       (line   83)\n* quit() (smtplib.SMTP method):          SMTP Objects.       (line  341)\n* quit() (tkinter.filedialog.FileDialog method): Native Load/Save Dialogs.\n(line  123)\n* quitting (bdb.Bdb attribute):          bdb -- Debugger framework.\n(line  329)\n* QUOTEALL (in module csv):             Module Contents<3>. (line  266)\n* quotefrombytes() (in module urllib.parse): URL Quoting.  (line   53)\n* QUOTEMINIMAL (in module csv):         Module Contents<3>. (line  270)\n* QUOTENONE (in module csv):            Module Contents<3>. (line  284)\n* QUOTENONNUMERIC (in module csv):      Module Contents<3>. (line  276)\n* QUOTENOTNULL (in module csv):         Module Contents<3>. (line  295)\n* quoteplus() (in module urllib.parse): URL Quoting.        (line   42)\n* QUOTESTRINGS (in module csv):         Module Contents<3>. (line  307)\n* quote() (in module email.utils):       email utils Miscellaneous utilities.\n(line   45)\n* quote() (in module shlex):             shlex -- Simple lexical analysis.\n(line   43)\n* quote() (in module urllib.parse):      URL Quoting.        (line   13)\n* quoteattr() (in module xml.sax.saxutils): xml sax saxutils -- SAX Utilities.\n(line   38)\n* quotechar (csv.Dialect attribute):     Dialects and Formatting Parameters.\n(line   54)\n* quoted-printable; encoding:            quopri -- Encode and decode MIME quoted-printable data.\n(line    8)\n* quotes (shlex.shlex attribute):        shlex Objects.      (line  115)\n* quoting (csv.Dialect attribute):       Dialects and Formatting Parameters.\n(line   62)\n* ROK (in module os):                   Files and Directories.\n(line  106)\n* r'; raw string literal:                String and Bytes literals.\n(line   51)\n* r\"; raw string literal:                String and Bytes literals.\n(line   51)\n* radians() (in module math):            Angular conversion. (line   10)\n* radians() (in module turtle):          Settings for measurement.\n(line   28)\n* RadioButtonGroup (class in msilib):    GUI classes.        (line   27)\n* radiogroup() (msilib.Dialog method):   GUI classes.        (line   71)\n* radix (sys.floatinfo attribute):      sys -- System-specific parameters and functions.\n(line  659)\n* radix() (decimal.Context method):      Context objects.    (line  483)\n* radix() (decimal.Decimal method):      Decimal objects.    (line  504)\n* RADIXCHAR (in module locale):          locale -- Internationalization services.\n(line  266)\n* raise (2to3 fixer):                    Fixers.             (line  262)\n* Raise (class in ast):                  Statements.         (line  115)\n* RAISE (monitoring event):              Events.             (line   71)\n* raise an exception:                    Exceptions<2>.      (line    6)\n* raiseondefect (email.policy.Policy attribute): email policy Policy Objects.\n(line  181)\n* raisesignal() (in module signal):     Module contents<2>. (line  324)\n* RAISEVARARGS (opcode):                Python Bytecode Instructions.\n(line  936)\n* raiseExceptions (in module logging):   Module-Level Attributes.\n(line   19)\n* raising; exception:                    The raise statement.\n(line    6)\n* RANDadd() (in module ssl):            Random generation.  (line   30)\n* RANDbytes() (in module ssl):          Random generation.  (line    6)\n* RANDstatus() (in module ssl):         Random generation.  (line   23)\n* randbelow() (in module secrets):       Random numbers.     (line   19)\n* randbits() (in module secrets):        Random numbers.     (line   23)\n* randbytes() (in module random):        Functions for bytes.\n(line    6)\n* randint() (in module random):          Functions for integers.\n(line   32)\n* Random (class in random):              Alternative Generator.\n(line    6)\n* random() (in module random):           Real-valued distributions.\n(line   11)\n* random() (random.Random method):       Alternative Generator.\n(line   33)\n* randrange() (in module random):        Functions for integers.\n(line    6)\n* range (built-in class):                Ranges.             (line   10)\n* RARROW (in module token):              token -- Constants used with Python parse trees.\n(line  230)\n* ratecv() (in module audioop):          audioop -- Manipulate raw audio data.\n(line  178)\n* ratio() (difflib.SequenceMatcher method): SequenceMatcher Objects.\n(line  180)\n* Rational (class in numbers):           The numeric tower.  (line   41)\n* raw (io.BufferedIOBase attribute):     I/O Base Classes.   (line  252)\n* raw string:                            String and Bytes literals.\n(line   36)\n* rawdatamanager (in module email.contentmanager): Content Manager Instances.\n(line   11)\n* rawdecode() (json.JSONDecoder method): Encoders and Decoders.\n(line   94)\n* rawinput (2to3 fixer):                Fixers.             (line  269)\n* rawinput() (code.InteractiveConsole method): Interactive Console Objects.\n(line   45)\n* raw() (in module curses):              Functions<6>.       (line  405)\n* raw() (pickle.PickleBuffer method):    Module Interface.   (line  318)\n* RawArray() (in module multiprocessing.sharedctypes): The multiprocessing sharedctypes module.\n(line   16)\n* RawConfigParser (class in configparser): RawConfigParser Objects.\n(line    6)\n* RawDescriptionHelpFormatter (class in argparse): formatterclass.\n(line   10)\n* RawIOBase (class in io):               I/O Base Classes.   (line  170)\n* RawPen (class in turtle):              Public classes.     (line    6)\n* RawTextHelpFormatter (class in argparse): formatterclass. (line   10)\n* RawTurtle (class in turtle):           Public classes.     (line    6)\n* RawValue() (in module multiprocessing.sharedctypes): The multiprocessing sharedctypes module.\n(line   33)\n* RBRACE (in module token):              token -- Constants used with Python parse trees.\n(line  130)\n* re (re.Match attribute):               Match Objects.      (line  206)\n* READ (inspect.BufferFlags attribute):  Buffer flags.       (line   49)\n* readall() (telnetlib.Telnet method):  Telnet Objects.     (line   17)\n* readbinary() (in module importlib.resources): Deprecated functions.\n(line   67)\n* readbyte() (mmap.mmap method):        mmap -- Memory-mapped file support.\n(line  246)\n* readbytes() (importlib.abc.Traversable method): importlib abc - Abstract base classes related to import.\n(line  584)\n* readbytes() (importlib.resources.abc.Traversable method): importlib resources abc - Abstract base classes for resources.\n(line  150)\n* readbytes() (pathlib.Path method):    Methods<2>.         (line  408)\n* readbytes() (zipfile.Path method):    Path Objects.       (line   90)\n* readdict() (configparser.ConfigParser method): ConfigParser Objects.\n(line  174)\n* readeager() (telnetlib.Telnet method): Telnet Objects.    (line   34)\n* readenviron() (in module wsgiref.handlers): wsgiref handlers - server/gateway base classes.\n(line  310)\n* readevents() (xml.etree.ElementTree.XMLPullParser method): XMLPullParser Objects.\n(line   48)\n* readfile() (configparser.ConfigParser method): ConfigParser Objects.\n(line  152)\n* readhistoryfile() (in module readline): History file.    (line    8)\n* readinitfile() (in module readline): Init file.          (line   13)\n* readlazy() (telnetlib.Telnet method): Telnet Objects.     (line   42)\n* readmimetypes() (in module mimetypes): mimetypes -- Map filenames to MIME types.\n(line   99)\n* READRESTRICTED (C macro):             Member flags.       (line   32)\n* readsbdata() (telnetlib.Telnet method): Telnet Objects.  (line   58)\n* readsome() (telnetlib.Telnet method): Telnet Objects.     (line   21)\n* readstring() (configparser.ConfigParser method): ConfigParser Objects.\n(line  164)\n* readtext() (importlib.abc.Traversable method): importlib abc - Abstract base classes related to import.\n(line  588)\n* readtext() (importlib.resources.abc.Traversable method): importlib resources abc - Abstract base classes for resources.\n(line  154)\n* readtext() (in module importlib.resources): Deprecated functions.\n(line   83)\n* readtext() (pathlib.Path method):     Methods<2>.         (line  421)\n* readtext() (zipfile.Path method):     Path Objects.       (line   78)\n* readtoken() (shlex.shlex method):     shlex Objects.      (line   20)\n* readuntil() (telnetlib.Telnet method): Telnet Objects.    (line    8)\n* readveryeager() (telnetlib.Telnet method): Telnet Objects.\n(line   26)\n* readverylazy() (telnetlib.Telnet method): Telnet Objects.\n(line   50)\n* readwindowsregistry() (mimetypes.MimeTypes method): MimeTypes Objects.\n(line   86)\n* read() (asyncio.StreamReader method):  StreamReader.       (line   20)\n* read() (chunk.Chunk method):           chunk -- Read IFF chunked data.\n(line  108)\n* read() (codecs.StreamReader method):   StreamReader Objects.\n(line   34)\n* read() (configparser.ConfigParser method): ConfigParser Objects.\n(line  115)\n* read() (http.client.HTTPResponse method): HTTPResponse Objects.\n(line   13)\n* read() (imaplib.IMAP4 method):         IMAP4 Objects.      (line  198)\n* read() (in module os):                 File Descriptor Operations.\n(line  686)\n* read() (io.BufferedIOBase method):     I/O Base Classes.   (line  273)\n* read() (io.BufferedReader method):     Buffered Streams.   (line   82)\n* read() (io.RawIOBase method):          I/O Base Classes.   (line  184)\n* read() (io.TextIOBase method):         Text I/O<2>.        (line   52)\n* read() (mimetypes.MimeTypes method):   MimeTypes Objects.  (line   70)\n* read() (mmap.mmap method):             mmap -- Memory-mapped file support.\n(line  236)\n* read() (ossaudiodev.ossaudiodevice method): Audio Device Objects.\n(line   32)\n* read() (sqlite3.Blob method):          Blob objects.       (line   45)\n* read() (ssl.MemoryBIO method):         Memory BIO Support<2>.\n(line  144)\n* read() (ssl.SSLSocket method):         SSL Sockets.        (line   76)\n* read() (urllib.robotparser.RobotFileParser method): urllib robotparser -- Parser for robots txt.\n(line   25)\n* read() (zipfile.ZipFile method):       ZipFile Objects.    (line  237)\n* read1() (bz2.BZ2File method):          De compression of files.\n(line  111)\n* read1() (io.BufferedIOBase method):    I/O Base Classes.   (line  290)\n* read1() (io.BufferedReader method):    Buffered Streams.   (line   88)\n* read1() (io.BytesIO method):           Buffered Streams.   (line   43)\n* READABLE (in module tkinter):         File Handlers.      (line   41)\n* readable() (bz2.BZ2File method):       De compression of files.\n(line   93)\n* readable() (io.IOBase method):         I/O Base Classes.   (line   78)\n* readall() (io.RawIOBase method):       I/O Base Classes.   (line  199)\n* reader() (in module csv):              Module Contents<3>. (line    8)\n* ReadError:                             tarfile -- Read and write tar archive files.\n(line  204)\n* readexactly() (asyncio.StreamReader method): StreamReader. (line   46)\n* readfp() (mimetypes.MimeTypes method): MimeTypes Objects.  (line   78)\n* readframes() (aifc.aifc method):       aifc -- Read and write AIFF and AIFC files.\n(line  100)\n* readframes() (sunau.AUread method):   AUread Objects.    (line   47)\n* readframes() (wave.Waveread method):  Waveread Objects.  (line   52)\n* readinto() (bz2.BZ2File method):       De compression of files.\n(line  121)\n* readinto() (http.client.HTTPResponse method): HTTPResponse Objects.\n(line   17)\n* readinto() (io.BufferedIOBase method): I/O Base Classes.   (line  301)\n* readinto() (io.RawIOBase method):      I/O Base Classes.   (line  204)\n* readinto1() (io.BufferedIOBase method): I/O Base Classes.  (line  314)\n* readinto1() (io.BytesIO method):       Buffered Streams.   (line   49)\n* readline() (asyncio.StreamReader method): StreamReader.    (line   35)\n* readline() (codecs.StreamReader method): StreamReader Objects.\n(line   60)\n* readline() (imaplib.IMAP4 method):     IMAP4 Objects.      (line  203)\n* readline() (io.IOBase method):         I/O Base Classes.   (line   83)\n* readline() (io.TextIOBase method):     Text I/O<2>.        (line   58)\n* readline() (mmap.mmap method):         mmap -- Memory-mapped file support.\n(line  251)\n* readlines() (codecs.StreamReader method): StreamReader Objects.\n(line   71)\n* readlines() (io.IOBase method):        I/O Base Classes.   (line   92)\n* readlink() (in module os):             Files and Directories.\n(line  655)\n* readlink() (pathlib.Path method):      Methods<2>.         (line  436)\n* readmoduleex() (in module pyclbr):    pyclbr -- Python module browser support.\n(line   31)\n* readmodule() (in module pyclbr):       pyclbr -- Python module browser support.\n(line   19)\n* READONLY (C macro):                    Member flags.       (line   37)\n* readonly (memoryview attribute):       Memory Views.       (line  417)\n* ReadTransport (class in asyncio):      Transports Hierarchy.\n(line   20)\n* readuntil() (asyncio.StreamReader method): StreamReader.   (line   55)\n* readv() (in module os):                File Descriptor Operations.\n(line  822)\n* ready() (multiprocessing.pool.AsyncResult method): Process Pools.\n(line  209)\n* Real (class in numbers):               The numeric tower.  (line   28)\n* real (numbers.Complex attribute):      The numeric tower.  (line   15)\n* Real Media File Format:                chunk -- Read IFF chunked data.\n(line    8)\n* realmaxmemuse (in module test.support): test support -- Utilities for the Python test suite.\n(line  150)\n* realquickratio() (difflib.SequenceMatcher method): SequenceMatcher Objects.\n(line  209)\n* realloc (C function):                  Overview<4>.        (line   33)\n* realpath() (in module os.path):        os path -- Common pathname manipulations.\n(line  326)\n* REALTIMEPRIORITYCLASS (in module subprocess): Windows Constants.\n(line   87)\n* reapchildren() (in module test.support): test support -- Utilities for the Python test suite.\n(line  579)\n* reapthreads() (in module test.support.threadinghelper): test support threadinghelper -- Utilities for threading tests.\n(line   17)\n* reason (http.client.HTTPResponse attribute): HTTPResponse Objects.\n(line   65)\n* reason (ssl.SSLError attribute):       Exceptions<14>.     (line   27)\n* reason (UnicodeError attribute):       Concrete exceptions.\n(line  418)\n* reason (urllib.error.HTTPError attribute): urllib error -- Exception classes raised by urllib request.\n(line   49)\n* reason (urllib.error.URLError attribute): urllib error -- Exception classes raised by urllib request.\n(line   22)\n* reattach() (tkinter.ttk.Treeview method): ttk Treeview.    (line  237)\n* rebinding; name:                       Assignment statements.\n(line    6)\n* reccontrols() (ossaudiodev.ossmixerdevice method): Mixer Device Objects.\n(line   54)\n* recent() (imaplib.IMAP4 method):       IMAP4 Objects.      (line  208)\n* reconfigure() (io.TextIOWrapper method): Text I/O<2>.      (line  181)\n* recordoriginalstdout() (in module test.support): test support -- Utilities for the Python test suite.\n(line  308)\n* RECORDS (inspect.BufferFlags attribute): Buffer flags.     (line   41)\n* records (unittest.TestCase attribute): Test cases.         (line  434)\n* RECORDSRO (inspect.BufferFlags attribute): Buffer flags.  (line   43)\n* rect() (in module cmath):              Conversions to and from polar coordinates.\n(line   46)\n* rectangle() (in module curses.textpad): curses textpad -- Text input widget for curses programs.\n(line   15)\n* RecursionError:                        Concrete exceptions.\n(line  215)\n* recursiverepr() (in module reprlib):  reprlib -- Alternate repr implementation.\n(line   61)\n* recvbytesinto() (multiprocessing.connection.Connection method): Connection Objects.\n(line   79)\n* recvbytes() (multiprocessing.connection.Connection method): Connection Objects.\n(line   65)\n* recvfds() (in module socket):         Other functions<2>. (line  448)\n* recvinto() (socket.socket method):    Socket Objects.     (line  389)\n* recv() (multiprocessing.connection.Connection method): Connection Objects.\n(line   24)\n* recv() (socket.socket method):         Socket Objects.     (line  232)\n* recvfrominto() (socket.socket method): Socket Objects.    (line  379)\n* recvfrom() (socket.socket method):     Socket Objects.     (line  250)\n* recvmsginto() (socket.socket method): Socket Objects.     (line  340)\n* recvmsg() (socket.socket method):      Socket Objects.     (line  268)\n* redirectrequest() (urllib.request.HTTPRedirectHandler method): HTTPRedirectHandler Objects.\n(line   15)\n* redirectstderr() (in module contextlib): Utilities.       (line  355)\n* redirectstdout() (in module contextlib): Utilities.       (line  315)\n* redisplay() (in module readline):      Line buffer.        (line   19)\n* redrawln() (curses.window method):     Window Objects.     (line  462)\n* redrawwin() (curses.window method):    Window Objects.     (line  468)\n* reduce (2to3 fixer):                   Fixers.             (line  273)\n* reduce() (in module functools):        functools -- Higher-order functions and operations on callable objects.\n(line  396)\n* reduceroverride() (pickle.Pickler method): Module Interface.\n(line  200)\n* ref (class in weakref):                weakref -- Weak references.\n(line   90)\n* refcounttest() (in module test.support): test support -- Utilities for the Python test suite.\n(line  538)\n* reference count:                       Glossary.           (line 1202)\n* reference counting:                    Objects values and types.\n(line   37)\n* ReferenceError:                        Concrete exceptions.\n(line  224)\n* ReferenceType (in module weakref):     weakref -- Weak references.\n(line  332)\n* refoldsource (email.policy.EmailPolicy attribute): email policy Policy Objects.\n(line  387)\n* refresh() (curses.window method):      Window Objects.     (line  473)\n* REGBINARY (in module winreg):         Value Types.        (line    8)\n* REGDWORD (in module winreg):          Value Types.        (line   12)\n* REGDWORDBIGENDIAN (in module winreg): Value Types.      (line   21)\n* REGDWORDLITTLEENDIAN (in module winreg): Value Types.   (line   16)\n* REGEXPANDSZ (in module winreg):      Value Types.        (line   25)\n* REGFULLRESOURCEDESCRIPTOR (in module winreg): Value Types.\n(line   60)\n* REGLINK (in module winreg):           Value Types.        (line   30)\n* REGMULTISZ (in module winreg):       Value Types.        (line   34)\n* REGNONE (in module winreg):           Value Types.        (line   39)\n* REGQWORD (in module winreg):          Value Types.        (line   43)\n* REGQWORDLITTLEENDIAN (in module winreg): Value Types.   (line   49)\n* REGRESOURCELIST (in module winreg):  Value Types.        (line   56)\n* REGRESOURCEREQUIREMENTSLIST (in module winreg): Value Types.\n(line   64)\n* REGSZ (in module winreg):             Value Types.        (line   68)\n* RegexFlag (class in re):               Flags.              (line    9)\n* registeradapter() (in module sqlite3): Module functions.  (line  136)\n* registerarchiveformat() (in module shutil): Archiving operations.\n(line   92)\n* registeratfork() (in module os):     Process Management. (line  544)\n* registercallback() (in module sys.monitoring): Registering callback functions.\n(line    8)\n* registerconverter() (in module sqlite3): Module functions.\n(line  143)\n* registerdefect() (email.policy.Policy method): email policy Policy Objects.\n(line  245)\n* registerdialect() (in module csv):    Module Contents<3>. (line   70)\n* registererror() (in module codecs):   Error Handlers.     (line  101)\n* registerfunction() (xmlrpc.server.CGIXMLRPCRequestHandler method): CGIXMLRPCRequestHandler.\n(line    9)\n* registerfunction() (xmlrpc.server.SimpleXMLRPCServer method): SimpleXMLRPCServer Objects.\n(line   10)\n* registerinstance() (xmlrpc.server.CGIXMLRPCRequestHandler method): CGIXMLRPCRequestHandler.\n(line   26)\n* registerinstance() (xmlrpc.server.SimpleXMLRPCServer method): SimpleXMLRPCServer Objects.\n(line   27)\n* registerintrospectionfunctions() (xmlrpc.server.CGIXMLRPCRequestHandler method): CGIXMLRPCRequestHandler.\n(line   41)\n* registerintrospectionfunctions() (xmlrpc.server.SimpleXMLRPCServer method): SimpleXMLRPCServer Objects.\n(line   55)\n* registermulticallfunctions() (xmlrpc.server.CGIXMLRPCRequestHandler method): CGIXMLRPCRequestHandler.\n(line   46)\n* registermulticallfunctions() (xmlrpc.server.SimpleXMLRPCServer method): SimpleXMLRPCServer Objects.\n(line   60)\n* registernamespace() (in module xml.etree.ElementTree): Functions<9>.\n(line  196)\n* registeroptionflag() (in module doctest): Option Flags.   (line  161)\n* registershape() (in module turtle):   Settings and special methods.\n(line   71)\n* registerunpackformat() (in module shutil): Archiving operations.\n(line  162)\n* register() (abc.ABCMeta method):       abc -- Abstract Base Classes.\n(line   69)\n* register() (in module atexit):         atexit -- Exit handlers.\n(line   25)\n* register() (in module codecs):         codecs -- Codec registry and base classes.\n(line  150)\n* register() (in module faulthandler):   Dumping the traceback on a user signal.\n(line    6)\n* register() (in module webbrowser):     webbrowser -- Convenient web-browser controller.\n(line   89)\n* register() (multiprocessing.managers.BaseManager method): Managers.\n(line   92)\n* register() (select.devpoll method):    /dev/poll Polling Objects.\n(line   30)\n* register() (select.epoll method):      Edge and Level Trigger Polling epoll Objects.\n(line   81)\n* register() (select.poll method):       Polling Objects.    (line   15)\n* register() (selectors.BaseSelector method): Classes<4>.    (line   65)\n* registerDOMImplementation() (in module xml.dom): Module Contents<4>.\n(line    8)\n* registerResult() (in module unittest): Signal Handling.    (line   35)\n* REGTYPE (in module tarfile):           tarfile -- Read and write tar archive files.\n(line  278)\n* regular package:                       Glossary.           (line 1212)\n* relativeto() (pathlib.PurePath method): Methods and properties.\n(line  302)\n* relative; import:                      The import statement.\n(line   99)\n* relative; URL:                         urllib parse -- Parse URLs into components.\n(line    8)\n* release() (thread.lock method):       thread -- Low-level threading API.\n(line  168)\n* release() (asyncio.Condition method):  Condition.          (line   78)\n* release() (asyncio.Lock method):       Lock.               (line   49)\n* release() (asyncio.Semaphore method):  Semaphore.          (line   54)\n* release() (in module platform):        Cross Platform.     (line  114)\n* release() (logging.Handler method):    Handler Objects.    (line   31)\n* release() (memoryview method):         Memory Views.       (line  239)\n* release() (multiprocessing.Lock method): Synchronization primitives.\n(line   92)\n* release() (multiprocessing.RLock method): Synchronization primitives.\n(line  148)\n* release() (pickle.PickleBuffer method): Module Interface.  (line  326)\n* release() (threading.Condition method): Condition Objects. (line   91)\n* release() (threading.Lock method):     Lock Objects.       (line   73)\n* release() (threading.RLock method):    RLock Objects.      (line   66)\n* release() (threading.Semaphore method): Semaphore Objects. (line   63)\n* releasebufferproc (C type):            Slot Type typedefs. (line  104)\n* reload (2to3 fixer):                   Fixers.             (line  277)\n* reload() (in module importlib):        Functions<12>.      (line   55)\n* relpath() (in module os.path):         os path -- Common pathname manipulations.\n(line  380)\n* remaindernear() (decimal.Context method): Context objects.\n(line  494)\n* remaindernear() (decimal.Decimal method): Decimal objects.\n(line  510)\n* remainder() (decimal.Context method):  Context objects.    (line  487)\n* remainder() (in module math):          Number-theoretic and representation functions.\n(line  243)\n* RemoteDisconnected:                    http client -- HTTP protocol client.\n(line  188)\n* removechildhandler() (asyncio.AbstractChildWatcher method): Process Watchers.\n(line   56)\n* removedonecallback() (asyncio.Future method): Future Object.\n(line  106)\n* removedonecallback() (asyncio.Task method): Task Object. (line  111)\n* removeflag() (mailbox.MaildirMessage method): MaildirMessage objects.\n(line   84)\n* removeflag() (mailbox.mboxMessage method): mboxMessage objects.\n(line   85)\n* removeflag() (mailbox.MMDFMessage method): MMDFMessage objects.\n(line   84)\n* removefolder() (mailbox.Maildir method): Maildir objects. (line   77)\n* removefolder() (mailbox.MH method):   MH objects.         (line   47)\n* removeheader() (urllib.request.Request method): Request Objects.\n(line  100)\n* removehistoryitem() (in module readline): History list.  (line   26)\n* removelabel() (mailbox.BabylMessage method): BabylMessage objects.\n(line   59)\n* removeoption() (configparser.ConfigParser method): ConfigParser Objects.\n(line  273)\n* removeoption() (optparse.OptionParser method): Querying and manipulating your option parser.\n(line   47)\n* removepyc() (msilib.Directory method): Directory Objects. (line   45)\n* removereader() (asyncio.loop method): Watching file descriptors.\n(line   12)\n* removesection() (configparser.ConfigParser method): ConfigParser Objects.\n(line  280)\n* removesequence() (mailbox.MHMessage method): MHMessage objects.\n(line   46)\n* removesignalhandler() (asyncio.loop method): Unix signals.\n(line   26)\n* removewriter() (asyncio.loop method): Watching file descriptors.\n(line   26)\n* remove() (array.array method):         array -- Efficient arrays of numeric values.\n(line  213)\n* remove() (collections.deque method):   deque objects.      (line   97)\n* remove() (frozenset method):           Set Types -- set frozenset.\n(line  199)\n* remove() (in module os):               Files and Directories.\n(line  692)\n* remove() (mailbox.Mailbox method):     Mailbox objects.    (line   76)\n* remove() (mailbox.MH method):          MH objects.         (line   76)\n* remove() (sequence method):            Mutable Sequence Types.\n(line   16)\n* remove() (xml.etree.ElementTree.Element method): Element Objects.\n(line  170)\n* removeAttribute() (xml.dom.Element method): Element Objects<2>.\n(line   52)\n* removeAttributeNode() (xml.dom.Element method): Element Objects<2>.\n(line   57)\n* removeAttributeNS() (xml.dom.Element method): Element Objects<2>.\n(line   62)\n* removeChild() (xml.dom.Node method):   Node Objects.       (line  128)\n* removedirs() (in module os):           Files and Directories.\n(line  716)\n* removeFilter() (logging.Handler method): Handler Objects.  (line   56)\n* removeFilter() (logging.Logger method): Logger Objects.    (line  328)\n* removeHandler() (in module unittest):  Signal Handling.    (line   52)\n* removeHandler() (logging.Logger method): Logger Objects.   (line  345)\n* removeprefix() (bytearray method):     Bytes and Bytearray Operations.\n(line   52)\n* removeprefix() (bytes method):         Bytes and Bytearray Operations.\n(line   52)\n* removeprefix() (str method):           String Methods<2>.  (line  371)\n* removeResult() (in module unittest):   Signal Handling.    (line   46)\n* removesuffix() (bytearray method):     Bytes and Bytearray Operations.\n(line   72)\n* removesuffix() (bytes method):         Bytes and Bytearray Operations.\n(line   72)\n* removesuffix() (str method):           String Methods<2>.  (line  384)\n* removexattr() (in module os):          Linux extended attributes.\n(line   41)\n* rename() (ftplib.FTP method):          FTP objects.        (line  325)\n* rename() (imaplib.IMAP4 method):       IMAP4 Objects.      (line  213)\n* rename() (in module os):               Files and Directories.\n(line  733)\n* rename() (pathlib.Path method):        Methods<2>.         (line  448)\n* renames (2to3 fixer):                  Fixers.             (line  281)\n* renames() (in module os):              Files and Directories.\n(line  770)\n* reopenIfNeeded() (logging.handlers.WatchedFileHandler method): WatchedFileHandler.\n(line   41)\n* reorganize() (dbm.gnu.gdbm method):    dbm gnu -- GNU database manager.\n(line   99)\n* repeat() (in module itertools):        Itertool Functions. (line  545)\n* repeat() (in module timeit):           Python Interface.   (line   18)\n* repeat() (timeit.Timer method):        Python Interface.   (line  110)\n* repetition; operation:                 Common Sequence Operations.\n(line   21)\n* replaceerrors() (in module codecs):   Error Handlers.     (line  154)\n* replaceheader() (email.message.EmailMessage method): email message Representing an email message.\n(line  301)\n* replaceheader() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  408)\n* replacehistoryitem() (in module readline): History list. (line   32)\n* replacewhitespace (textwrap.TextWrapper attribute): textwrap -- Text wrapping and filling.\n(line  182)\n* replace; error handler's name:         Error Handlers.     (line   15)\n* replace() (bytearray method):          Bytes and Bytearray Operations.\n(line  200)\n* replace() (bytes method):              Bytes and Bytearray Operations.\n(line  200)\n* replace() (codeobject method):         Methods on code objects.\n(line   85)\n* replace() (curses.panel.Panel method): Panel Objects.      (line   39)\n* replace() (datetime.date method):      date Objects.       (line  179)\n* replace() (datetime.datetime method):  datetime Objects.   (line  441)\n* replace() (datetime.time method):      time Objects.       (line  149)\n* replace() (in module dataclasses):     Module contents<4>. (line  409)\n* replace() (in module os):              Files and Directories.\n(line  788)\n* replace() (inspect.Parameter method):  Introspecting callables with the Signature object.\n(line  286)\n* replace() (inspect.Signature method):  Introspecting callables with the Signature object.\n(line  136)\n* replace() (pathlib.Path method):       Methods<2>.         (line  476)\n* replace() (str method):                String Methods<2>.  (line  397)\n* replace() (tarfile.TarInfo method):    TarInfo Objects.    (line  166)\n* replaceChild() (xml.dom.Node method):  Node Objects.       (line  135)\n* ReplacePackage() (in module modulefinder): modulefinder -- Find modules used by a script.\n(line   21)\n* REPORTCDIFF (in module doctest):      Option Flags.       (line  115)\n* reportfailure() (doctest.DocTestRunner method): DocTestRunner objects.\n(line   70)\n* reportfullclosure() (filecmp.dircmp method): The dircmp class.\n(line   28)\n* REPORTNDIFF (in module doctest):      Option Flags.       (line  120)\n* REPORTONLYFIRSTFAILURE (in module doctest): Option Flags.\n(line  129)\n* reportpartialclosure() (filecmp.dircmp method): The dircmp class.\n(line   23)\n* reportstart() (doctest.DocTestRunner method): DocTestRunner objects.\n(line   48)\n* reportsuccess() (doctest.DocTestRunner method): DocTestRunner objects.\n(line   59)\n* REPORTUDIFF (in module doctest):      Option Flags.       (line  110)\n* reportunexpectedexception() (doctest.DocTestRunner method): DocTestRunner objects.\n(line   81)\n* report() (filecmp.dircmp method):      The dircmp class.   (line   18)\n* report() (modulefinder.ModuleFinder method): modulefinder -- Find modules used by a script.\n(line   38)\n* REPORTINGFLAGS (in module doctest):   Option Flags.       (line  153)\n* repr (2to3 fixer):                     Fixers.             (line  285)\n* Repr (class in reprlib):               reprlib -- Alternate repr implementation.\n(line   17)\n* repr() (built-in function); repr() (object method): Basic customization.\n(line  112)\n* repr() (in module reprlib):            reprlib -- Alternate repr implementation.\n(line   51)\n* repr() (reprlib.Repr method):          Repr Objects.       (line  107)\n* repr1() (reprlib.Repr method):         Repr Objects.       (line  112)\n* ReprEnum (class in enum):              Data Types<2>.      (line  547)\n* reprfunc (C type):                     Slot Type typedefs. (line   39)\n* Request (class in urllib.request):     urllib request -- Extensible library for opening URLs.\n(line  191)\n* request (socketserver.BaseRequestHandler attribute): Request Handler Objects.\n(line   42)\n* requestqueuesize (socketserver.BaseServer attribute): Server Objects<2>.\n(line   98)\n* requestrate() (urllib.robotparser.RobotFileParser method): urllib robotparser -- Parser for robots txt.\n(line   60)\n* requesturi() (in module wsgiref.util): wsgiref util - WSGI environment utilities.\n(line   27)\n* requestversion (http.server.BaseHTTPRequestHandler attribute): http server -- HTTP servers.\n(line  105)\n* request() (http.client.HTTPConnection method): HTTPConnection Objects.\n(line    8)\n* RequestHandlerClass (socketserver.BaseServer attribute): Server Objects<2>.\n(line   71)\n* requestline (http.server.BaseHTTPRequestHandler attribute): http server -- HTTP servers.\n(line   87)\n* Required (in module typing):           Special forms.      (line  209)\n* requiresbz2() (in module test.support): test support -- Utilities for the Python test suite.\n(line  502)\n* requiresdocstrings() (in module test.support): test support -- Utilities for the Python test suite.\n(line  514)\n* requiresfreebsdversion() (in module test.support): test support -- Utilities for the Python test suite.\n(line  475)\n* requiresgzip() (in module test.support): test support -- Utilities for the Python test suite.\n(line  498)\n* requiresIEEE754() (in module test.support): test support -- Utilities for the Python test suite.\n(line  490)\n* requireslimitedapi() (in module test.support): test support -- Utilities for the Python test suite.\n(line  518)\n* requireslinuxversion() (in module test.support): test support -- Utilities for the Python test suite.\n(line  480)\n* requireslzma() (in module test.support): test support -- Utilities for the Python test suite.\n(line  506)\n* requiresmacversion() (in module test.support): test support -- Utilities for the Python test suite.\n(line  485)\n* requiresresource() (in module test.support): test support -- Utilities for the Python test suite.\n(line  510)\n* requireszlib() (in module test.support): test support -- Utilities for the Python test suite.\n(line  494)\n* requires() (in module test.support):   test support -- Utilities for the Python test suite.\n(line  259)\n* RERAISE (monitoring event):            Events.             (line   76)\n* RERAISE (opcode):                      Python Bytecode Instructions.\n(line  386)\n* reschedule() (asyncio.Timeout method): Timeouts.           (line   68)\n* reserved (zipfile.ZipInfo attribute):  ZipInfo Objects.    (line  112)\n* reserved word:                         Keywords.           (line    6)\n* RESERVEDFUTURE (in module uuid):      uuid -- UUID objects according to RFC 4122.\n(line  239)\n* RESERVEDMICROSOFT (in module uuid):   uuid -- UUID objects according to RFC 4122.\n(line  235)\n* RESERVEDNCS (in module uuid):         uuid -- UUID objects according to RFC 4122.\n(line  227)\n* resetmock() (unittest.mock.AsyncMock method): The Mock Class.\n(line  861)\n* resetmock() (unittest.mock.Mock method): The Mock Class.  (line  199)\n* resetpeak() (in module tracemalloc):  Functions<11>.      (line   38)\n* resetprogmode() (in module curses):  Functions<6>.       (line  411)\n* resetshellmode() (in module curses): Functions<6>.       (line  416)\n* resettzpath() (in module zoneinfo):   Functions<3>.       (line   27)\n* reset() (asyncio.Barrier method):      Barrier.            (line   78)\n* reset() (bdb.Bdb method):              bdb -- Debugger framework.\n(line  159)\n* reset() (codecs.IncrementalDecoder method): IncrementalDecoder Objects.\n(line   40)\n* reset() (codecs.IncrementalEncoder method): IncrementalEncoder Objects.\n(line   35)\n* reset() (codecs.StreamReader method):  StreamReader Objects.\n(line   83)\n* reset() (codecs.StreamWriter method):  StreamWriter Objects.\n(line   42)\n* reset() (contextvars.ContextVar method): Context Variables.\n(line   58)\n* reset() (html.parser.HTMLParser method): HTMLParser Methods.\n(line   23)\n* reset() (in module turtle):            More drawing control.\n(line    6)\n* reset() (ossaudiodev.ossaudiodevice method): Audio Device Objects.\n(line  172)\n* reset() (pipes.Template method):       Template Objects.   (line    8)\n* reset() (threading.Barrier method):    Barrier Objects.    (line   71)\n* reset() (xdrlib.Packer method):        Packer Objects.     (line   12)\n* reset() (xdrlib.Unpacker method):      Unpacker Objects.   (line    8)\n* reset() (xml.dom.pulldom.DOMEventStream method): DOMEventStream Objects.\n(line   37)\n* reset() (xml.sax.xmlreader.IncrementalParser method): IncrementalParser Objects.\n(line   19)\n* resetbuffer() (code.InteractiveConsole method): Interactive Console Objects.\n(line   41)\n* resetlocale() (in module locale):      locale -- Internationalization services.\n(line  430)\n* resetscreen() (in module turtle):      Window control.     (line   59)\n* resetty() (in module curses):          Functions<6>.       (line  421)\n* resetwarnings() (in module warnings):  Available Functions.\n(line  129)\n* resizeterm() (in module curses):      Functions<6>.       (line  426)\n* resize() (curses.window method):       Window Objects.     (line  492)\n* resize() (in module ctypes):           Utility functions.  (line  163)\n* resize() (mmap.mmap method):           mmap -- Memory-mapped file support.\n(line  257)\n* resizemode() (in module turtle):       Appearance.         (line   24)\n* resizeterm() (in module curses):       Functions<6>.       (line  436)\n* resolution (datetime.date attribute):  date Objects.       (line  109)\n* resolution (datetime.datetime attribute): datetime Objects.\n(line  278)\n* resolution (datetime.time attribute):  time Objects.       (line   42)\n* resolution (datetime.timedelta attribute): timedelta Objects.\n(line   84)\n* resolvebases() (in module types):     Dynamic Type Creation.\n(line   58)\n* resolvename() (in module importlib.util): importlib util - Utility code for importers.\n(line   80)\n* resolvename() (in module pkgutil):    pkgutil -- Package extension utility.\n(line  210)\n* resolve() (pathlib.Path method):       Methods<2>.         (line  501)\n* resolveEntity() (xml.sax.handler.EntityResolver method): EntityResolver Objects.\n(line    6)\n* Resource (in module importlib.resources): Deprecated functions.\n(line   22)\n* resourcepath() (importlib.abc.ResourceReader method): importlib abc - Abstract base classes related to import.\n(line  506)\n* resourcepath() (importlib.resources.abc.ResourceReader method): importlib resources abc - Abstract base classes for resources.\n(line   55)\n* ResourceDenied:                        test support -- Utilities for the Python test suite.\n(line   22)\n* ResourceLoader (class in importlib.abc): importlib abc - Abstract base classes related to import.\n(line  207)\n* ResourceReader (class in importlib.abc): importlib abc - Abstract base classes related to import.\n(line  461)\n* ResourceReader (class in importlib.resources.abc): importlib resources abc - Abstract base classes for resources.\n(line   12)\n* ResourceWarning:                       Warnings.           (line   81)\n* response (nntplib.NNTPError attribute): nntplib -- NNTP protocol client.\n(line  145)\n* response() (imaplib.IMAP4 method):     IMAP4 Objects.      (line  217)\n* ResponseNotReady:                      http client -- HTTP protocol client.\n(line  174)\n* responses (http.server.BaseHTTPRequestHandler attribute): http server -- HTTP servers.\n(line  180)\n* responses (in module http.client):     http client -- HTTP protocol client.\n(line  209)\n* restart (pdb command):                 Debugger Commands.  (line  393)\n* restartevents() (in module sys.monitoring): Disabling events.\n(line   21)\n* restore() (in module difflib):         difflib -- Helpers for computing deltas.\n(line  270)\n* restore() (test.support.SaveSignals method): test support -- Utilities for the Python test suite.\n(line  770)\n* RESTRICTED (C macro):                  Member flags.       (line   32)\n* restricted; execution:                 Builtins and restricted execution.\n(line    6)\n* restype (ctypes.FuncPtr attribute):   Foreign functions.  (line   22)\n* result() (asyncio.Future method):      Future Object.      (line   32)\n* result() (asyncio.Task method):        Task Object.        (line   73)\n* result() (concurrent.futures.Future method): Future Objects.\n(line   37)\n* results() (trace.Trace method):        Programmatic Interface.\n(line   40)\n* RESUME (opcode):                       Python Bytecode Instructions.\n(line 1102)\n* resumereading() (asyncio.ReadTransport method): Read-only Transports.\n(line   21)\n* resumewriting() (asyncio.BaseProtocol method): Base Protocol.\n(line   44)\n* retr() (poplib.POP3 method):           POP3 Objects.       (line   63)\n* retrbinary() (ftplib.FTP method):      FTP objects.        (line  175)\n* retrieve() (urllib.request.URLopener method): Legacy interface.\n(line  113)\n* retrlines() (ftplib.FTP method):       FTP objects.        (line  200)\n* RETRY (in module tkinter.messagebox):  tkinter messagebox -- Tkinter message prompts.\n(line  149)\n* RETRYCANCEL (in module tkinter.messagebox): tkinter messagebox -- Tkinter message prompts.\n(line  176)\n* Return (class in ast):                 Function and class definitions.\n(line  122)\n* return (pdb command):                  Debugger Commands.  (line  212)\n* returnannotation (inspect.Signature attribute): Introspecting callables with the Signature object.\n(line  115)\n* RETURNCONST (opcode):                 Python Bytecode Instructions.\n(line  354)\n* RETURNGENERATOR (opcode):             Python Bytecode Instructions.\n(line 1120)\n* returnok() (http.cookiejar.CookiePolicy method): CookiePolicy Objects.\n(line   18)\n* RETURNVALUE (opcode):                 Python Bytecode Instructions.\n(line  350)\n* returnvalue (unittest.mock.Mock attribute): The Mock Class.\n(line  322)\n* returncode (asyncio.subprocess.Process attribute): Interacting with Subprocesses.\n(line  146)\n* returncode (subprocess.CalledProcessError attribute): Using the subprocess Module.\n(line  211)\n* returncode (subprocess.CompletedProcess attribute): Using the subprocess Module.\n(line  110)\n* returncode (subprocess.Popen attribute): Popen Objects.    (line  149)\n* retval (pdb command):                  Debugger Commands.  (line  412)\n* revealtype() (in module typing):      Functions and decorators.\n(line   82)\n* reverseorder() (pstats.Stats method): The Stats Class.    (line  157)\n* reversepointer (ipaddress.IPv4Address attribute): Address objects.\n(line   77)\n* reversepointer (ipaddress.IPv6Address attribute): Address objects.\n(line  251)\n* reverse() (array.array method):        array -- Efficient arrays of numeric values.\n(line  217)\n* reverse() (collections.deque method):  deque objects.      (line  102)\n* reverse() (in module audioop):         audioop -- Manipulate raw audio data.\n(line  191)\n* reverse() (sequence method):           Mutable Sequence Types.\n(line   16)\n* Reversible (class in collections.abc): Collections Abstract Base Classes - Detailed Descriptions.\n(line   46)\n* Reversible (class in typing):          Aliases to other ABCs in collections abc.\n(line   82)\n* revert() (http.cookiejar.FileCookieJar method): CookieJar and FileCookieJar Objects.\n(line  142)\n* rewind() (aifc.aifc method):           aifc -- Read and write AIFF and AIFC files.\n(line  106)\n* rewind() (sunau.AUread method):       AUread Objects.    (line   53)\n* rewind() (wave.Waveread method):      Waveread Objects.  (line   57)\n* RFC4122 (in module uuid):             uuid -- UUID objects according to RFC 4122.\n(line  231)\n* RFC; RFC 1014:                         xdrlib -- Encode and decode XDR data.\n(line   14)\n* RFC; RFC 1014 <1>:                     xdrlib -- Encode and decode XDR data.\n(line   35)\n* RFC; RFC 1123:                         Functions<5>.       (line  681)\n* RFC; RFC 1123 <1>:                     Functions<5>.       (line  692)\n* RFC; RFC 1123 <2>:                     Functions<5>.       (line  707)\n* RFC; RFC 1321:                         hashlib -- Secure hashes and message digests.\n(line   14)\n* RFC; RFC 1422:                         Certificates.       (line   38)\n* RFC; RFC 1422 <1>:                     TLS 1 3.            (line   41)\n* RFC; RFC 1521:                         Security Considerations<2>.\n(line   18)\n* RFC; RFC 1521 <1>:                     quopri -- Encode and decode MIME quoted-printable data.\n(line   11)\n* RFC; RFC 1521 <2>:                     quopri -- Encode and decode MIME quoted-printable data.\n(line   37)\n* RFC; RFC 1522:                         binascii -- Convert between binary and ASCII.\n(line   86)\n* RFC; RFC 1522 <1>:                     quopri -- Encode and decode MIME quoted-printable data.\n(line   25)\n* RFC; RFC 1522 <2>:                     quopri -- Encode and decode MIME quoted-printable data.\n(line   39)\n* RFC; RFC 1524:                         mailcap -- Mailcap file handling.\n(line   23)\n* RFC; RFC 1524 <1>:                     mailcap -- Mailcap file handling.\n(line   42)\n* RFC; RFC 1730:                         imaplib -- IMAP4 protocol client.\n(line   14)\n* RFC; RFC 1738:                         URL Quoting.        (line  187)\n* RFC; RFC 1750:                         Random generation.  (line   34)\n* RFC; RFC 1766:                         locale -- Internationalization services.\n(line  356)\n* RFC; RFC 1766 <1>:                     locale -- Internationalization services.\n(line  369)\n* RFC; RFC 1808:                         urllib.             (line   23)\n* RFC; RFC 1808 <1>:                     URL Parsing.        (line   42)\n* RFC; RFC 1808 <2>:                     URL Quoting.        (line  181)\n* RFC; RFC 1832:                         xdrlib -- Encode and decode XDR data.\n(line   39)\n* RFC; RFC 1832 <1>:                     xdrlib -- Encode and decode XDR data.\n(line   41)\n* RFC; RFC 1869:                         smtplib -- SMTP protocol client.\n(line   13)\n* RFC; RFC 1869 <1>:                     smtplib -- SMTP protocol client.\n(line  192)\n* RFC; RFC 1870:                         smtpd<4>.           (line    6)\n* RFC; RFC 1939:                         poplib -- POP3 protocol client.\n(line   11)\n* RFC; RFC 1939 <1>:                     poplib -- POP3 protocol client.\n(line   13)\n* RFC; RFC 2033:                         New and Improved Modules<2>.\n(line  568)\n* RFC; RFC 2045:                         email -- An email and MIME handling package.\n(line   16)\n* RFC; RFC 2045 <1>:                     email message Representing an email message.\n(line  316)\n* RFC; RFC 2045 <2>:                     email message Representing an email message.\n(line  318)\n* RFC; RFC 2045 <3>:                     email message Representing an email message.\n(line  321)\n* RFC; RFC 2045 <4>:                     email headerregistry Custom Header Objects.\n(line  239)\n* RFC; RFC 2045 <5>:                     email headerregistry Custom Header Objects.\n(line  297)\n* RFC; RFC 2045 <6>:                     email message Message Representing an email message using the compat32 API.\n(line  421)\n* RFC; RFC 2045 <7>:                     email message Message Representing an email message using the compat32 API.\n(line  425)\n* RFC; RFC 2045 <8>:                     email message Message Representing an email message using the compat32 API.\n(line  428)\n* RFC; RFC 2045 <9>:                     email message Message Representing an email message using the compat32 API.\n(line  525)\n* RFC; RFC 2045 <10>:                    email header Internationalized headers.\n(line   31)\n* RFC; RFC 2045 <11>:                    base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line   30)\n* RFC; RFC 2045 <12>:                    base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line   31)\n* RFC; RFC 2045 <13>:                    base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line  255)\n* RFC; RFC 2045 <14>:                    base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line  263)\n* RFC; RFC 2045#section-6.8:             Binary Objects.     (line   31)\n* RFC; RFC 2046:                         email -- An email and MIME handling package.\n(line   16)\n* RFC; RFC 2046 <1>:                     Content Manager Instances.\n(line   84)\n* RFC; RFC 2046 <2>:                     email header Internationalized headers.\n(line   32)\n* RFC; RFC 2047:                         PEP 3333 Python Web Server Gateway Interface v1 0 1.\n(line   21)\n* RFC; RFC 2047 <1>:                     email<5>.           (line   27)\n* RFC; RFC 2047 <2>:                     email -- An email and MIME handling package.\n(line   16)\n* RFC; RFC 2047 <3>:                     email policy Policy Objects.\n(line  363)\n* RFC; RFC 2047 <4>:                     email policy Policy Objects.\n(line  369)\n* RFC; RFC 2047 <5>:                     email headerregistry Custom Header Objects.\n(line   78)\n* RFC; RFC 2047 <6>:                     email headerregistry Custom Header Objects.\n(line  123)\n* RFC; RFC 2047 <7>:                     email headerregistry Custom Header Objects.\n(line  128)\n* RFC; RFC 2047 <8>:                     email header Internationalized headers.\n(line   32)\n* RFC; RFC 2047 <9>:                     email header Internationalized headers.\n(line   55)\n* RFC; RFC 2047 <10>:                    email header Internationalized headers.\n(line  117)\n* RFC; RFC 2047 <11>:                    email header Internationalized headers.\n(line  141)\n* RFC; RFC 2047 <12>:                    email utils Miscellaneous utilities.\n(line   78)\n* RFC; RFC 2060:                         imaplib -- IMAP4 protocol client.\n(line   13)\n* RFC; RFC 2060 <1>:                     IMAP4 Objects.      (line  316)\n* RFC; RFC 2068:                         http cookies -- HTTP state management.\n(line   16)\n* RFC; RFC 2104:                         New and Improved Modules<3>.\n(line   35)\n* RFC; RFC 2104 <1>:                     hmac -- Keyed-Hashing for Message Authentication.\n(line   10)\n* RFC; RFC 2109:                         http cookies -- HTTP state management.\n(line   15)\n* RFC; RFC 2109 <1>:                     http cookies -- HTTP state management.\n(line   36)\n* RFC; RFC 2109 <2>:                     http cookies -- HTTP state management.\n(line   67)\n* RFC; RFC 2109 <3>:                     Morsel Objects.     (line    8)\n* RFC; RFC 2109 <4>:                     Morsel Objects.     (line   11)\n* RFC; RFC 2109 <5>:                     Morsel Objects.     (line   92)\n* RFC; RFC 2109 <6>:                     Morsel Objects.     (line  104)\n* RFC; RFC 2109 <7>:                     http cookiejar -- Cookie handling for HTTP clients.\n(line   18)\n* RFC; RFC 2109 <8>:                     http cookiejar -- Cookie handling for HTTP clients.\n(line  102)\n* RFC; RFC 2109 <9>:                     http cookiejar -- Cookie handling for HTTP clients.\n(line  114)\n* RFC; RFC 2109 <10>:                    http cookiejar -- Cookie handling for HTTP clients.\n(line  141)\n* RFC; RFC 2109 <11>:                    DefaultCookiePolicy Objects.\n(line   86)\n* RFC; RFC 2109 <12>:                    Cookie Objects<2>.  (line   11)\n* RFC; RFC 2109 <13>:                    Cookie Objects<2>.  (line   23)\n* RFC; RFC 2109 <14>:                    Cookie Objects<2>.  (line   74)\n* RFC; RFC 2183:                         email -- An email and MIME handling package.\n(line   16)\n* RFC; RFC 2183 <1>:                     email message Representing an email message.\n(line  460)\n* RFC; RFC 2183 <2>:                     email message Message Representing an email message using the compat32 API.\n(line  631)\n* RFC; RFC 2231:                         email -- An email and MIME handling package.\n(line   16)\n* RFC; RFC 2231 <1>:                     email message Representing an email message.\n(line  280)\n* RFC; RFC 2231 <2>:                     email message Representing an email message.\n(line  283)\n* RFC; RFC 2231 <3>:                     email message Representing an email message.\n(line  365)\n* RFC; RFC 2231 <4>:                     email message Message Representing an email message using the compat32 API.\n(line  384)\n* RFC; RFC 2231 <5>:                     email message Message Representing an email message using the compat32 API.\n(line  388)\n* RFC; RFC 2231 <6>:                     email message Message Representing an email message using the compat32 API.\n(line  490)\n* RFC; RFC 2231 <7>:                     email message Message Representing an email message using the compat32 API.\n(line  498)\n* RFC; RFC 2231 <8>:                     email message Message Representing an email message using the compat32 API.\n(line  532)\n* RFC; RFC 2231 <9>:                     email header Internationalized headers.\n(line   32)\n* RFC; RFC 2231 <10>:                    email utils Miscellaneous utilities.\n(line  189)\n* RFC; RFC 2231 <11>:                    email utils Miscellaneous utilities.\n(line  194)\n* RFC; RFC 2231 <12>:                    email utils Miscellaneous utilities.\n(line  203)\n* RFC; RFC 2231 <13>:                    email utils Miscellaneous utilities.\n(line  210)\n* RFC; RFC 2231 <14>:                    email utils Miscellaneous utilities.\n(line  219)\n* RFC; RFC 2295:                         HTTP status codes.  (line  184)\n* RFC; RFC 2324:                         HTTP status codes.  (line  133)\n* RFC; RFC 2342:                         New and Improved Modules<3>.\n(line   94)\n* RFC; RFC 2342 <1>:                     IMAP4 Objects.      (line  164)\n* RFC; RFC 2368:                         URL Quoting.        (line  177)\n* RFC; RFC 2373:                         Address objects.    (line   95)\n* RFC; RFC 2373 <1>:                     Address objects.    (line  161)\n* RFC; RFC 2373 <2>:                     Address objects.    (line  170)\n* RFC; RFC 2396:                         urllib parse<5>.    (line    6)\n* RFC; RFC 2396 <1>:                     urllib.             (line   24)\n* RFC; RFC 2396 <2>:                     URL Parsing.        (line  257)\n* RFC; RFC 2396 <3>:                     URL Quoting.        (line   25)\n* RFC; RFC 2396 <4>:                     URL Quoting.        (line  172)\n* RFC; RFC 2397:                         DataHandler Objects.\n(line    9)\n* RFC; RFC 2449:                         POP3 Objects.       (line   26)\n* RFC; RFC 2487:                         New and Improved Modules<3>.\n(line   86)\n* RFC; RFC 2518:                         HTTP status codes.  (line   19)\n* RFC; RFC 2595:                         poplib -- POP3 protocol client.\n(line   14)\n* RFC; RFC 2595 <1>:                     POP3 Objects.       (line  116)\n* RFC; RFC 2616:                         PEP 3333 Python Web Server Gateway Interface v1 0 1.\n(line   20)\n* RFC; RFC 2616 <1>:                     wsgiref util - WSGI environment utilities.\n(line  114)\n* RFC; RFC 2616 <2>:                     wsgiref validate -- WSGI conformance checker.\n(line   27)\n* RFC; RFC 2616 <3>:                     HTTPRedirectHandler Objects.\n(line    8)\n* RFC; RFC 2616 <4>:                     HTTPRedirectHandler Objects.\n(line   28)\n* RFC; RFC 2616 <5>:                     Legacy interface.   (line  164)\n* RFC; RFC 2616 <6>:                     urllib error -- Exception classes raised by urllib request.\n(line   44)\n* RFC; RFC 2616 <7>:                     Introduction<15>.   (line   34)\n* RFC; RFC 2616 <8>:                     HTTPError.          (line   15)\n* RFC; RFC 2616 <9>:                     Error Codes.        (line   12)\n* RFC; RFC 2616#section-14.23:           HTTPConnection Objects.\n(line   31)\n* RFC; RFC 2616#section-5.1.2:           HTTPConnection Objects.\n(line   13)\n* RFC; RFC 2616#section-5.1.2 <1>:       HTTPConnection Objects.\n(line   32)\n* RFC; RFC 2640:                         Changes in the Python API<3>.\n(line   36)\n* RFC; RFC 2640 <1>:                     Tests<34>.          (line   22)\n* RFC; RFC 2640 <2>:                     ftplib -- FTP protocol client.\n(line   18)\n* RFC; RFC 2640 <3>:                     FTP objects.        (line   64)\n* RFC; RFC 2640 <4>:                     FTPTLS objects.    (line   64)\n* RFC; RFC 2732:                         urllib parse<6>.    (line   10)\n* RFC; RFC 2732 <1>:                     New and Improved Modules.\n(line  643)\n* RFC; RFC 2732 <2>:                     URL Quoting.        (line  168)\n* RFC; RFC 2774:                         HTTP status codes.  (line  193)\n* RFC; RFC 2818:                         ssl<11>.            (line   16)\n* RFC; RFC 2821:                         email -- An email and MIME handling package.\n(line   12)\n* RFC; RFC 2822:                         New and Improved Modules<3>.\n(line   98)\n* RFC; RFC 2822 <1>:                     Batteries Included. (line   16)\n* RFC; RFC 2822 <2>:                     Functions<5>.       (line  683)\n* RFC; RFC 2822 <3>:                     Functions<5>.       (line  694)\n* RFC; RFC 2822 <4>:                     Functions<5>.       (line  408)\n* RFC; RFC 2822 <5>:                     Functions<5>.       (line  709)\n* RFC; RFC 2822 <6>:                     email message Message Representing an email message using the compat32 API.\n(line  274)\n* RFC; RFC 2822 <7>:                     email header Internationalized headers.\n(line   20)\n* RFC; RFC 2822 <8>:                     email header Internationalized headers.\n(line   23)\n* RFC; RFC 2822 <9>:                     email header Internationalized headers.\n(line   31)\n* RFC; RFC 2822 <10>:                    email header Internationalized headers.\n(line   88)\n* RFC; RFC 2822 <11>:                    email header Internationalized headers.\n(line  116)\n* RFC; RFC 2822 <12>:                    email header Internationalized headers.\n(line  134)\n* RFC; RFC 2822 <13>:                    email utils Miscellaneous utilities.\n(line   29)\n* RFC; RFC 2822 <14>:                    email utils Miscellaneous utilities.\n(line  109)\n* RFC; RFC 2822 <15>:                    email utils Miscellaneous utilities.\n(line  112)\n* RFC; RFC 2822 <16>:                    email utils Miscellaneous utilities.\n(line  237)\n* RFC; RFC 2822 <17>:                    email utils Miscellaneous utilities.\n(line  155)\n* RFC; RFC 2822 <18>:                    Message objects.    (line   17)\n* RFC; RFC 2822 <19>:                    http client -- HTTP protocol client.\n(line  115)\n* RFC; RFC 2822 <20>:                    http server -- HTTP servers.\n(line  117)\n* RFC; RFC 2964:                         http cookiejar -- Cookie handling for HTTP clients.\n(line  154)\n* RFC; RFC 2965:                         urllib request -- Extensible library for opening URLs.\n(line  235)\n* RFC; RFC 2965 <1>:                     urllib request -- Extensible library for opening URLs.\n(line  243)\n* RFC; RFC 2965 <2>:                     Request Objects.    (line   50)\n* RFC; RFC 2965 <3>:                     http cookiejar -- Cookie handling for HTTP clients.\n(line   16)\n* RFC; RFC 2965 <4>:                     http cookiejar -- Cookie handling for HTTP clients.\n(line  102)\n* RFC; RFC 2965 <5>:                     http cookiejar -- Cookie handling for HTTP clients.\n(line  114)\n* RFC; RFC 2965 <6>:                     http cookiejar -- Cookie handling for HTTP clients.\n(line  143)\n* RFC; RFC 2965 <7>:                     http cookiejar -- Cookie handling for HTTP clients.\n(line  145)\n* RFC; RFC 2965 <8>:                     http cookiejar -- Cookie handling for HTTP clients.\n(line  152)\n* RFC; RFC 2965 <9>:                     FileCookieJar subclasses and co-operation with web browsers.\n(line   16)\n* RFC; RFC 2965 <10>:                    CookiePolicy Objects.\n(line   74)\n* RFC; RFC 2965 <11>:                    CookiePolicy Objects.\n(line   79)\n* RFC; RFC 2965 <12>:                    DefaultCookiePolicy Objects.\n(line    8)\n* RFC; RFC 2965 <13>:                    DefaultCookiePolicy Objects.\n(line   90)\n* RFC; RFC 2965 <14>:                    DefaultCookiePolicy Objects.\n(line  101)\n* RFC; RFC 2965 <15>:                    DefaultCookiePolicy Objects.\n(line  105)\n* RFC; RFC 2965 <16>:                    DefaultCookiePolicy Objects.\n(line  114)\n* RFC; RFC 2965 <17>:                    DefaultCookiePolicy Objects.\n(line  151)\n* RFC; RFC 2965 <18>:                    Cookie Objects<2>.  (line   23)\n* RFC; RFC 2965 <19>:                    Examples<28>.       (line   25)\n* RFC; RFC 2980:                         nntplib -- NNTP protocol client.\n(line   16)\n* RFC; RFC 2980 <1>:                     Methods<3>.         (line  317)\n* RFC; RFC 3056:                         Address objects.    (line  298)\n* RFC; RFC 3164:                         Logging to syslog with RFC5424 support.\n(line    7)\n* RFC; RFC 3171:                         Address objects.    (line   94)\n* RFC; RFC 3207:                         New and Improved Modules<2>.\n(line  573)\n* RFC; RFC 3229:                         HTTP status codes.  (line   52)\n* RFC; RFC 3280:                         SSL Sockets.        (line  157)\n* RFC; RFC 3330:                         Address objects.    (line  169)\n* RFC; RFC 3339:                         Displaying the date/time in messages.\n(line   18)\n* RFC; RFC 3454:                         Security<11>.       (line   19)\n* RFC; RFC 3454 <1>:                     stringprep -- Internet String Preparation.\n(line   17)\n* RFC; RFC 3454 <2>:                     stringprep -- Internet String Preparation.\n(line   26)\n* RFC; RFC 3490:                         Text Encodings.     (line   14)\n* RFC; RFC 3490 <1>:                     encodings idna -- Internationalized Domain Names in Applications.\n(line    6)\n* RFC; RFC 3490 <2>:                     encodings idna -- Internationalized Domain Names in Applications.\n(line   57)\n* RFC; RFC 3490 <3>:                     encodings idna -- Internationalized Domain Names in Applications.\n(line   62)\n* RFC; RFC 3490#section-3.1:             encodings idna -- Internationalized Domain Names in Applications.\n(line   27)\n* RFC; RFC 3491:                         Security<11>.       (line   21)\n* RFC; RFC 3492:                         Text Encodings.     (line   36)\n* RFC; RFC 3492 <1>:                     encodings idna -- Internationalized Domain Names in Applications.\n(line    7)\n* RFC; RFC 3493:                         Example<8>.         (line  227)\n* RFC; RFC 3501:                         IMAP4 Objects.      (line  327)\n* RFC; RFC 3542:                         Library<46>.        (line  351)\n* RFC; RFC 3542 <1>:                     Other functions<2>. (line  313)\n* RFC; RFC 3548:                         New Improved and Deprecated Modules<3>.\n(line   16)\n* RFC; RFC 3548 <1>:                     binascii -- Convert between binary and ASCII.\n(line   50)\n* RFC; RFC 3548 <2>:                     binascii -- Convert between binary and ASCII.\n(line   65)\n* RFC; RFC 3659:                         FTP objects.        (line  289)\n* RFC; RFC 3879:                         Address objects.    (line  276)\n* RFC; RFC 3927:                         Address objects.    (line  174)\n* RFC; RFC 3977:                         nntplib -- NNTP protocol client.\n(line   16)\n* RFC; RFC 3977 <1>:                     Attributes<2>.      (line   10)\n* RFC; RFC 3977 <2>:                     Methods<3>.         (line   36)\n* RFC; RFC 3977 <3>:                     Methods<3>.         (line  138)\n* RFC; RFC 3977 <4>:                     Methods<3>.         (line  318)\n* RFC; RFC 3986:                         urllib parse.       (line   17)\n* RFC; RFC 3986 <1>:                     urllib parse<3>.    (line    7)\n* RFC; RFC 3986 <2>:                     urllib parse<4>.    (line    7)\n* RFC; RFC 3986 <3>:                     urllib parse<5>.    (line    6)\n* RFC; RFC 3986 <4>:                     urllib.             (line   22)\n* RFC; RFC 3986 <5>:                     New and Improved Modules.\n(line  622)\n* RFC; RFC 3986 <6>:                     Porting to Python 2 7.\n(line   80)\n* RFC; RFC 3986 <7>:                     URL Parsing.        (line  142)\n* RFC; RFC 3986 <8>:                     URL Parsing.        (line  368)\n* RFC; RFC 3986 <9>:                     URL parsing security.\n(line   25)\n* RFC; RFC 3986 <10>:                    URL Quoting.        (line   25)\n* RFC; RFC 3986 <11>:                    URL Quoting.        (line  160)\n* RFC; RFC 3986 <12>:                    http server -- HTTP servers.\n(line  102)\n* RFC; RFC 4007:                         Address objects.    (line  219)\n* RFC; RFC 4007 <1>:                     Address objects.    (line  290)\n* RFC; RFC 4086:                         TLS 1 3.            (line   45)\n* RFC; RFC 4122:                         New Improved and Removed Modules.\n(line  418)\n* RFC; RFC 4122 <1>:                     New Improved and Removed Modules.\n(line  423)\n* RFC; RFC 4122 <2>:                     uuid -- UUID objects according to RFC 4122.\n(line    6)\n* RFC; RFC 4122 <3>:                     uuid -- UUID objects according to RFC 4122.\n(line   15)\n* RFC; RFC 4122 <4>:                     uuid -- UUID objects according to RFC 4122.\n(line   73)\n* RFC; RFC 4122 <5>:                     uuid -- UUID objects according to RFC 4122.\n(line  138)\n* RFC; RFC 4122 <6>:                     uuid -- UUID objects according to RFC 4122.\n(line  167)\n* RFC; RFC 4122 <7>:                     uuid -- UUID objects according to RFC 4122.\n(line  233)\n* RFC; RFC 4122 <8>:                     uuid -- UUID objects according to RFC 4122.\n(line  246)\n* RFC; RFC 4180:                         csv -- CSV File Reading and Writing.\n(line   13)\n* RFC; RFC 4193:                         Address objects.    (line  278)\n* RFC; RFC 4217:                         FTPTLS objects.    (line   11)\n* RFC; RFC 4291:                         Library<26>.        (line  653)\n* RFC; RFC 4291 <1>:                     Address objects.    (line  213)\n* RFC; RFC 4380:                         Address objects.    (line  305)\n* RFC; RFC 4627:                         json -- JSON encoder and decoder.\n(line   11)\n* RFC; RFC 4627 <1>:                     Top-level Non-Object Non-Array Values.\n(line    6)\n* RFC; RFC 4642:                         nntplib -- NNTP protocol client.\n(line  118)\n* RFC; RFC 4648:                         Documentation<26>.  (line   32)\n* RFC; RFC 4648 <1>:                     base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line   12)\n* RFC; RFC 4648 <2>:                     base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line   16)\n* RFC; RFC 4648 <3>:                     base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line   24)\n* RFC; RFC 4648 <4>:                     base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line  120)\n* RFC; RFC 4648 <5>:                     base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line  134)\n* RFC; RFC 4648 <6>:                     base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line  141)\n* RFC; RFC 4648 <7>:                     Security Considerations<2>.\n(line    6)\n* RFC; RFC 4648 <8>:                     Security Considerations<4>.\n(line    8)\n* RFC; RFC 4918:                         HTTP status codes.  (line   46)\n* RFC; RFC 4918 <1>:                     HTTP status codes.  (line  139)\n* RFC; RFC 4918 <2>:                     HTTP status codes.  (line  142)\n* RFC; RFC 4918 <3>:                     HTTP status codes.  (line  145)\n* RFC; RFC 4918 <4>:                     HTTP status codes.  (line  187)\n* RFC; RFC 4954:                         SMTP Objects.       (line  135)\n* RFC; RFC 4954 <1>:                     SMTP Objects.       (line  158)\n* RFC; RFC 5161:                         imaplib<2>.         (line   11)\n* RFC; RFC 5161 <1>:                     IMAP4 Objects.      (line   86)\n* RFC; RFC 5246:                         Constants<9>.       (line  508)\n* RFC; RFC 5246 <1>:                     TLS 1 3.            (line   53)\n* RFC; RFC 5280:                         Other Changes.      (line   20)\n* RFC; RFC 5280 <1>:                     Changes in the Python API<8>.\n(line   95)\n* RFC; RFC 5280 <2>:                     Certificate handling.\n(line   22)\n* RFC; RFC 5280 <3>:                     TLS 1 3.            (line   49)\n* RFC; RFC 5321:                         smtpd<4>.           (line    6)\n* RFC; RFC 5321 <1>:                     email headerregistry Custom Header Objects.\n(line  452)\n* RFC; RFC 5322:                         email -- An email and MIME handling package.\n(line   15)\n* RFC; RFC 5322 <1>:                     email message Representing an email message.\n(line   20)\n* RFC; RFC 5322 <2>:                     email message Representing an email message.\n(line   31)\n* RFC; RFC 5322 <3>:                     Parser API.         (line   42)\n* RFC; RFC 5322 <4>:                     email generator Generating MIME documents.\n(line  102)\n* RFC; RFC 5322 <5>:                     email generator Generating MIME documents.\n(line  195)\n* RFC; RFC 5322 <6>:                     email policy Policy Objects.\n(line  149)\n* RFC; RFC 5322 <7>:                     email policy Policy Objects.\n(line  342)\n* RFC; RFC 5322 <8>:                     email policy Policy Objects.\n(line  363)\n* RFC; RFC 5322 <9>:                     email policy Policy Objects.\n(line  369)\n* RFC; RFC 5322 <10>:                    email policy Policy Objects.\n(line  381)\n* RFC; RFC 5322 <11>:                    email policy Policy Objects.\n(line  414)\n* RFC; RFC 5322 <12>:                    email errors Exception and Defect classes.\n(line   28)\n* RFC; RFC 5322 <13>:                    email headerregistry Custom Header Objects.\n(line   16)\n* RFC; RFC 5322 <14>:                    email headerregistry Custom Header Objects.\n(line  117)\n* RFC; RFC 5322 <15>:                    email headerregistry Custom Header Objects.\n(line  122)\n* RFC; RFC 5322 <16>:                    email headerregistry Custom Header Objects.\n(line  123)\n* RFC; RFC 5322 <17>:                    email headerregistry Custom Header Objects.\n(line  138)\n* RFC; RFC 5322 <18>:                    email headerregistry Custom Header Objects.\n(line  159)\n* RFC; RFC 5322 <19>:                    email headerregistry Custom Header Objects.\n(line  415)\n* RFC; RFC 5322 <20>:                    email headerregistry Custom Header Objects.\n(line  449)\n* RFC; RFC 5322 <21>:                    email headerregistry Custom Header Objects.\n(line  483)\n* RFC; RFC 5322 <22>:                    email message Message Representing an email message using the compat32 API.\n(line   21)\n* RFC; RFC 5322 <23>:                    SMTP Objects.       (line  314)\n* RFC; RFC 5424:                         SysLogHandler.      (line   71)\n* RFC; RFC 5424 <1>:                     Inserting a BOM into messages sent to a SysLogHandler.\n(line    6)\n* RFC; RFC 5424 <2>:                     Inserting a BOM into messages sent to a SysLogHandler.\n(line   19)\n* RFC; RFC 5424 <3>:                     Inserting a BOM into messages sent to a SysLogHandler.\n(line   43)\n* RFC; RFC 5424 <4>:                     Logging to syslog with RFC5424 support.\n(line    6)\n* RFC; RFC 5424#section-6:               Inserting a BOM into messages sent to a SysLogHandler.\n(line    9)\n* RFC; RFC 5735:                         Address objects.    (line  160)\n* RFC; RFC 5789:                         HTTP methods.       (line   37)\n* RFC; RFC 5842:                         HTTP status codes.  (line   49)\n* RFC; RFC 5842 <1>:                     HTTP status codes.  (line  190)\n* RFC; RFC 5891:                         encodings idna -- Internationalized Domain Names in Applications.\n(line   11)\n* RFC; RFC 5894:                         Security<11>.       (line   20)\n* RFC; RFC 5895:                         encodings idna -- Internationalized Domain Names in Applications.\n(line   11)\n* RFC; RFC 5929:                         SSL Sockets.        (line  251)\n* RFC; RFC 6066:                         Constants<9>.       (line  408)\n* RFC; RFC 6066 <1>:                     SSL Contexts.       (line  280)\n* RFC; RFC 6066 <2>:                     TLS 1 3.            (line   57)\n* RFC; RFC 6152:                         smtpd<2>.           (line   15)\n* RFC; RFC 6531:                         email<2>.           (line   19)\n* RFC; RFC 6531 <1>:                     smtpd<2>.           (line   21)\n* RFC; RFC 6531 <2>:                     smtplib<2>.         (line   15)\n* RFC; RFC 6531 <3>:                     email message Representing an email message.\n(line  103)\n* RFC; RFC 6531 <4>:                     email policy Policy Objects.\n(line  385)\n* RFC; RFC 6531 <5>:                     smtplib -- SMTP protocol client.\n(line   69)\n* RFC; RFC 6532:                         email<2>.           (line   18)\n* RFC; RFC 6532 <1>:                     email -- An email and MIME handling package.\n(line   15)\n* RFC; RFC 6532 <2>:                     email message Representing an email message.\n(line   20)\n* RFC; RFC 6532 <3>:                     Parser API.         (line   43)\n* RFC; RFC 6532 <4>:                     email policy Policy Objects.\n(line  383)\n* RFC; RFC 6585:                         HTTP status codes.  (line  154)\n* RFC; RFC 6585 <1>:                     HTTP status codes.  (line  157)\n* RFC; RFC 6585 <2>:                     HTTP status codes.  (line  160)\n* RFC; RFC 6585 <3>:                     HTTP status codes.  (line  196)\n* RFC; RFC 6855:                         imaplib<2>.         (line   12)\n* RFC; RFC 6855 <1>:                     imaplib<2>.         (line   14)\n* RFC; RFC 6855 <2>:                     IMAP4 Objects.      (line   88)\n* RFC; RFC 6855 <3>:                     IMAP4 Objects.      (line   90)\n* RFC; RFC 6856:                         poplib<2>.          (line    6)\n* RFC; RFC 6856 <1>:                     POP3 Objects.       (line  109)\n* RFC; RFC 7159:                         json -- JSON encoder and decoder.\n(line   10)\n* RFC; RFC 7159 <1>:                     Standard Compliance and Interoperability.\n(line    6)\n* RFC; RFC 7159 <2>:                     Top-level Non-Object Non-Array Values.\n(line    9)\n* RFC; RFC 7230:                         urllib request -- Extensible library for opening URLs.\n(line  206)\n* RFC; RFC 7230 <1>:                     HTTPConnection Objects.\n(line  192)\n* RFC; RFC 7231:                         HTTP status codes.  (line   13)\n* RFC; RFC 7231 <1>:                     HTTP status codes.  (line   16)\n* RFC; RFC 7231 <2>:                     HTTP status codes.  (line   25)\n* RFC; RFC 7231 <3>:                     HTTP status codes.  (line   28)\n* RFC; RFC 7231 <4>:                     HTTP status codes.  (line   31)\n* RFC; RFC 7231 <5>:                     HTTP status codes.  (line   34)\n* RFC; RFC 7231 <6>:                     HTTP status codes.  (line   37)\n* RFC; RFC 7231 <7>:                     HTTP status codes.  (line   40)\n* RFC; RFC 7231 <8>:                     HTTP status codes.  (line   55)\n* RFC; RFC 7231 <9>:                     HTTP status codes.  (line   58)\n* RFC; RFC 7231 <10>:                    HTTP status codes.  (line   61)\n* RFC; RFC 7231 <11>:                    HTTP status codes.  (line   64)\n* RFC; RFC 7231 <12>:                    HTTP status codes.  (line   70)\n* RFC; RFC 7231 <13>:                    HTTP status codes.  (line   73)\n* RFC; RFC 7231 <14>:                    HTTP status codes.  (line   79)\n* RFC; RFC 7231 <15>:                    HTTP status codes.  (line   85)\n* RFC; RFC 7231 <16>:                    HTTP status codes.  (line   88)\n* RFC; RFC 7231 <17>:                    HTTP status codes.  (line   91)\n* RFC; RFC 7231 <18>:                    HTTP status codes.  (line   94)\n* RFC; RFC 7231 <19>:                    HTTP status codes.  (line   97)\n* RFC; RFC 7231 <20>:                    HTTP status codes.  (line  103)\n* RFC; RFC 7231 <21>:                    HTTP status codes.  (line  106)\n* RFC; RFC 7231 <22>:                    HTTP status codes.  (line  109)\n* RFC; RFC 7231 <23>:                    HTTP status codes.  (line  112)\n* RFC; RFC 7231 <24>:                    HTTP status codes.  (line  118)\n* RFC; RFC 7231 <25>:                    HTTP status codes.  (line  121)\n* RFC; RFC 7231 <26>:                    HTTP status codes.  (line  124)\n* RFC; RFC 7231 <27>:                    HTTP status codes.  (line  130)\n* RFC; RFC 7231 <28>:                    HTTP status codes.  (line  151)\n* RFC; RFC 7231 <29>:                    HTTP status codes.  (line  166)\n* RFC; RFC 7231 <30>:                    HTTP status codes.  (line  169)\n* RFC; RFC 7231 <31>:                    HTTP status codes.  (line  172)\n* RFC; RFC 7231 <32>:                    HTTP status codes.  (line  175)\n* RFC; RFC 7231 <33>:                    HTTP status codes.  (line  178)\n* RFC; RFC 7231 <34>:                    HTTP status codes.  (line  181)\n* RFC; RFC 7231 <35>:                    HTTP status category.\n(line   15)\n* RFC; RFC 7231 <36>:                    HTTP status category.\n(line   18)\n* RFC; RFC 7231 <37>:                    HTTP status category.\n(line   21)\n* RFC; RFC 7231 <38>:                    HTTP status category.\n(line   24)\n* RFC; RFC 7231 <39>:                    HTTP status category.\n(line   27)\n* RFC; RFC 7231 <40>:                    HTTP methods.       (line   13)\n* RFC; RFC 7231 <41>:                    HTTP methods.       (line   16)\n* RFC; RFC 7231 <42>:                    HTTP methods.       (line   19)\n* RFC; RFC 7231 <43>:                    HTTP methods.       (line   22)\n* RFC; RFC 7231 <44>:                    HTTP methods.       (line   25)\n* RFC; RFC 7231 <45>:                    HTTP methods.       (line   28)\n* RFC; RFC 7231 <46>:                    HTTP methods.       (line   31)\n* RFC; RFC 7231 <47>:                    HTTP methods.       (line   34)\n* RFC; RFC 7232:                         HTTP status codes.  (line   67)\n* RFC; RFC 7232 <1>:                     HTTP status codes.  (line  115)\n* RFC; RFC 7233:                         HTTP status codes.  (line   43)\n* RFC; RFC 7233 <1>:                     HTTP status codes.  (line  127)\n* RFC; RFC 7235:                         HTTP status codes.  (line   82)\n* RFC; RFC 7235 <1>:                     HTTP status codes.  (line  100)\n* RFC; RFC 7238:                         HTTP status codes.  (line   76)\n* RFC; RFC 7301:                         Application-Layer Protocol Negotiation Support.\n(line   10)\n* RFC; RFC 7301 <1>:                     Constants<9>.       (line  385)\n* RFC; RFC 7301 <2>:                     SSL Contexts.       (line  248)\n* RFC; RFC 7525:                         TLS 1 3.            (line   65)\n* RFC; RFC 7538:                         Library<25>.        (line  170)\n* RFC; RFC 7540:                         HTTP status codes.  (line  136)\n* RFC; RFC 7693:                         BLAKE2.             (line    6)\n* RFC; RFC 7725:                         HTTP status codes.  (line  163)\n* RFC; RFC 7914:                         Key derivation.     (line   53)\n* RFC; RFC 821:                          smtplib -- SMTP protocol client.\n(line   12)\n* RFC; RFC 821 <1>:                      smtplib -- SMTP protocol client.\n(line  187)\n* RFC; RFC 822:                          New and Improved Modules<3>.\n(line   98)\n* RFC; RFC 822 <1>:                      Functions<5>.       (line  676)\n* RFC; RFC 822 <2>:                      Functions<5>.       (line  679)\n* RFC; RFC 822 <3>:                      Functions<5>.       (line  687)\n* RFC; RFC 822 <4>:                      Functions<5>.       (line  690)\n* RFC; RFC 822 <5>:                      Functions<5>.       (line  702)\n* RFC; RFC 822 <6>:                      Functions<5>.       (line  705)\n* RFC; RFC 822 <7>:                      email Examples.     (line   36)\n* RFC; RFC 822 <8>:                      email header Internationalized headers.\n(line   21)\n* RFC; RFC 822 <9>:                      HTTPConnection Objects.\n(line  179)\n* RFC; RFC 822 <10>:                     SMTP Objects.       (line   94)\n* RFC; RFC 822 <11>:                     SMTP Objects.       (line  229)\n* RFC; RFC 822 <12>:                     SMTP Objects.       (line  230)\n* RFC; RFC 822 <13>:                     SMTP Example.       (line   10)\n* RFC; RFC 822 <14>:                     The GNUTranslations class.\n(line   13)\n* RFC; RFC 8297:                         HTTP status codes.  (line   22)\n* RFC; RFC 8305:                         Opening network connections.\n(line   77)\n* RFC; RFC 8305 <1>:                     Opening network connections.\n(line   86)\n* RFC; RFC 8470:                         HTTP status codes.  (line  148)\n* RFC; RFC 854:                          telnetlib -- Telnet client.\n(line   15)\n* RFC; RFC 854 <1>:                      telnetlib -- Telnet client.\n(line   68)\n* RFC; RFC 9239:                         Library<18>.        (line   76)\n* RFC; RFC 959:                          ftplib -- FTP protocol client.\n(line   16)\n* RFC; RFC 977:                          nntplib -- NNTP protocol client.\n(line   16)\n* rfc2109 (http.cookiejar.Cookie attribute): Cookie Objects<2>.\n(line   72)\n* rfc2109asnetscape (http.cookiejar.DefaultCookiePolicy attribute): DefaultCookiePolicy Objects.\n(line   83)\n* rfc2965 (http.cookiejar.CookiePolicy attribute): CookiePolicy Objects.\n(line   72)\n* rfile (http.server.BaseHTTPRequestHandler attribute): http server -- HTTP servers.\n(line  119)\n* rfile (socketserver.DatagramRequestHandler attribute): Request Handler Objects.\n(line   63)\n* rfind() (bytearray method):            Bytes and Bytearray Operations.\n(line  214)\n* rfind() (bytes method):                Bytes and Bytearray Operations.\n(line  214)\n* rfind() (mmap.mmap method):            mmap -- Memory-mapped file support.\n(line  273)\n* rfind() (str method):                  String Methods<2>.  (line  403)\n* rgbtohls() (in module colorsys):     colorsys -- Conversions between color systems.\n(line   36)\n* rgbtohsv() (in module colorsys):     colorsys -- Conversions between color systems.\n(line   44)\n* rgbtoyiq() (in module colorsys):     colorsys -- Conversions between color systems.\n(line   28)\n* rglob() (pathlib.Path method):         Methods<2>.         (line  529)\n* richcmpfunc (C type):                  Slot Type typedefs. (line   83)\n* right (filecmp.dircmp attribute):      The dircmp class.   (line   45)\n* rightlist (filecmp.dircmp attribute): The dircmp class.   (line   54)\n* rightonly (filecmp.dircmp attribute): The dircmp class.   (line   67)\n* right() (in module turtle):            Turtle motion.      (line   40)\n* RIGHTSHIFT (in module token):          token -- Constants used with Python parse trees.\n(line  162)\n* RIGHTSHIFTEQUAL (in module token):     token -- Constants used with Python parse trees.\n(line  206)\n* rindex() (bytearray method):           Bytes and Bytearray Operations.\n(line  228)\n* rindex() (bytes method):               Bytes and Bytearray Operations.\n(line  228)\n* rindex() (str method):                 String Methods<2>.  (line  410)\n* rjust() (bytearray method):            Bytes and Bytearray Operations.\n(line  345)\n* rjust() (bytes method):                Bytes and Bytearray Operations.\n(line  345)\n* rjust() (str method):                  String Methods<2>.  (line  415)\n* RLIMINFINITY (in module resource):    Resource Limits.    (line   20)\n* RLIMITAS (in module resource):        Resource Limits.    (line  148)\n* RLIMITCORE (in module resource):      Resource Limits.    (line   91)\n* RLIMITCPU (in module resource):       Resource Limits.    (line   98)\n* RLIMITDATA (in module resource):      Resource Limits.    (line  110)\n* RLIMITFSIZE (in module resource):     Resource Limits.    (line  106)\n* RLIMITKQUEUES (in module resource):   Resource Limits.    (line  224)\n* RLIMITMEMLOCK (in module resource):   Resource Limits.    (line  138)\n* RLIMITMSGQUEUE (in module resource):  Resource Limits.    (line  153)\n* RLIMITNICE (in module resource):      Resource Limits.    (line  161)\n* RLIMITNOFILE (in module resource):    Resource Limits.    (line  129)\n* RLIMITNPROC (in module resource):     Resource Limits.    (line  125)\n* RLIMITNPTS (in module resource):      Resource Limits.    (line  216)\n* RLIMITOFILE (in module resource):     Resource Limits.    (line  134)\n* RLIMITRSS (in module resource):       Resource Limits.    (line  120)\n* RLIMITRTPRIO (in module resource):    Resource Limits.    (line  170)\n* RLIMITRTTIME (in module resource):    Resource Limits.    (line  178)\n* RLIMITSBSIZE (in module resource):    Resource Limits.    (line  195)\n* RLIMITSIGPENDING (in module resource): Resource Limits.   (line  187)\n* RLIMITSTACK (in module resource):     Resource Limits.    (line  114)\n* RLIMITSWAP (in module resource):      Resource Limits.    (line  205)\n* RLIMITVMEM (in module resource):      Resource Limits.    (line  142)\n* RLock (class in multiprocessing):      Synchronization primitives.\n(line  102)\n* RLock (class in threading):            RLock Objects.      (line   23)\n* RLock() (multiprocessing.managers.SyncManager method): Managers.\n(line  203)\n* rmd() (ftplib.FTP method):             FTP objects.        (line  348)\n* rmdir() (in module os):                Files and Directories.\n(line  809)\n* rmdir() (in module test.support.oshelper): test support oshelper -- Utilities for os tests.\n(line  111)\n* rmdir() (pathlib.Path method):         Methods<2>.         (line  557)\n* RMFF:                                  chunk -- Read IFF chunked data.\n(line    8)\n* rms() (in module audioop):             audioop -- Manipulate raw audio data.\n(line  196)\n* rmtree() (in module shutil):           Directory and files operations.\n(line  262)\n* rmtree() (in module test.support.oshelper): test support oshelper -- Utilities for os tests.\n(line  118)\n* RobotFileParser (class in urllib.robotparser): urllib robotparser -- Parser for robots txt.\n(line   16)\n* robots.txt:                            urllib robotparser -- Parser for robots txt.\n(line    8)\n* rollback() (sqlite3.Connection method): Connection objects.\n(line   76)\n* rollover() (tempfile.SpooledTemporaryFile method): tempfile -- Generate temporary files and directories.\n(line  162)\n* ROMAN (in module tkinter.font):        tkinter font -- Tkinter font wrapper.\n(line   15)\n* root (pathlib.PurePath attribute):     Methods and properties.\n(line   24)\n* rotate() (collections.deque method):   deque objects.      (line  109)\n* rotate() (decimal.Context method):     Context objects.    (line  500)\n* rotate() (decimal.Decimal method):     Decimal objects.    (line  529)\n* rotate() (logging.handlers.BaseRotatingHandler method): BaseRotatingHandler.\n(line   75)\n* RotatingFileHandler (class in logging.handlers): RotatingFileHandler.\n(line    9)\n* rotationfilename() (logging.handlers.BaseRotatingHandler method): BaseRotatingHandler.\n(line   58)\n* rotator (logging.handlers.BaseRotatingHandler attribute): BaseRotatingHandler.\n(line   49)\n* ROUND05UP (in module decimal):        Rounding modes.     (line   34)\n* ROUNDCEILING (in module decimal):     Rounding modes.     (line    6)\n* ROUNDDOWN (in module decimal):        Rounding modes.     (line   10)\n* ROUNDFLOOR (in module decimal):       Rounding modes.     (line   14)\n* ROUNDHALFDOWN (in module decimal):   Rounding modes.     (line   18)\n* ROUNDHALFEVEN (in module decimal):   Rounding modes.     (line   22)\n* ROUNDHALFUP (in module decimal):     Rounding modes.     (line   26)\n* ROUNDUP (in module decimal):          Rounding modes.     (line   30)\n* Rounded (class in decimal):            Signals.            (line   77)\n* rounds (sys.floatinfo attribute):     sys -- System-specific parameters and functions.\n(line  663)\n* Row (class in sqlite3):                Row objects.        (line    6)\n* rowfactory (sqlite3.Connection attribute): Connection objects.\n(line  766)\n* rowfactory (sqlite3.Cursor attribute): Cursor objects.    (line  226)\n* rowcount (sqlite3.Cursor attribute):   Cursor objects.     (line  215)\n* RPAR (in module token):                token -- Constants used with Python parse trees.\n(line   58)\n* rpartition() (bytearray method):       Bytes and Bytearray Operations.\n(line  240)\n* rpartition() (bytes method):           Bytes and Bytearray Operations.\n(line  240)\n* rpartition() (str method):             String Methods<2>.  (line  422)\n* rpcpaths (xmlrpc.server.SimpleXMLRPCRequestHandler attribute): SimpleXMLRPCServer Objects.\n(line   64)\n* rpop() (poplib.POP3 method):           POP3 Objects.       (line   47)\n* RS (in module curses.ascii):           curses ascii -- Utilities for ASCII characters.\n(line  115)\n* rset() (poplib.POP3 method):           POP3 Objects.       (line   75)\n* RShift (class in ast):                 Expressions<2>.     (line   54)\n* rshift() (in module operator):         operator -- Standard operators as functions.\n(line  152)\n* rsplit() (bytearray method):           Bytes and Bytearray Operations.\n(line  357)\n* rsplit() (bytes method):               Bytes and Bytearray Operations.\n(line  357)\n* rsplit() (str method):                 String Methods<2>.  (line  430)\n* RSQB (in module token):                token -- Constants used with Python parse trees.\n(line   66)\n* rstrip() (bytearray method):           Bytes and Bytearray Operations.\n(line  368)\n* rstrip() (bytes method):               Bytes and Bytearray Operations.\n(line  368)\n* rstrip() (str method):                 String Methods<2>.  (line  439)\n* rt() (in module turtle):               Turtle motion.      (line   40)\n* RTLDDEEPBIND (in module os):          Miscellaneous System Information.\n(line  144)\n* RTLDGLOBAL (in module os):            Miscellaneous System Information.\n(line  144)\n* RTLDLAZY (in module os):              Miscellaneous System Information.\n(line  144)\n* RTLDLOCAL (in module os):             Miscellaneous System Information.\n(line  144)\n* RTLDNODELETE (in module os):          Miscellaneous System Information.\n(line  144)\n* RTLDNOLOAD (in module os):            Miscellaneous System Information.\n(line  144)\n* RTLDNOW (in module os):               Miscellaneous System Information.\n(line  144)\n* ruler (cmd.Cmd attribute):             Cmd Objects.        (line  172)\n* run (pdb command):                     Debugger Commands.  (line  393)\n* Run script:                            Format menu Editor window only.\n(line   53)\n* runcoroutinethreadsafe() (in module asyncio): Scheduling From Other Threads.\n(line    6)\n* rundocstringexamples() (in module doctest): Basic API.   (line  127)\n* runforever() (asyncio.loop method):   Running and stopping the loop.\n(line   16)\n* runinexecutor() (asyncio.loop method): Executing code in thread or process pools.\n(line    6)\n* runinsubinterp() (in module test.support): test support -- Utilities for the Python test suite.\n(line  654)\n* runmodule() (in module runpy):        runpy -- Locating and executing Python modules.\n(line   27)\n* runpath() (in module runpy):          runpy -- Locating and executing Python modules.\n(line   99)\n* runpythonuntilend() (in module test.support.scripthelper): test support scripthelper -- Utilities for the Python execution tests.\n(line   30)\n* runscript() (modulefinder.ModuleFinder method): modulefinder -- Find modules used by a script.\n(line   44)\n* rununtilcomplete() (asyncio.loop method): Running and stopping the loop.\n(line    6)\n* runwithlocale() (in module test.support): test support -- Utilities for the Python test suite.\n(line  462)\n* runwithtz() (in module test.support): test support -- Utilities for the Python test suite.\n(line  470)\n* run() (asyncio.Runner method):         Runner context manager.\n(line   36)\n* run() (bdb.Bdb method):                bdb -- Debugger framework.\n(line  424)\n* run() (contextvars.Context method):    Manual Context Management.\n(line   36)\n* run() (doctest.DocTestRunner method):  DocTestRunner objects.\n(line   95)\n* run() (in module asyncio):             Running an asyncio Program.\n(line    6)\n* run() (in module pdb):                 pdb -- The Python Debugger.\n(line  123)\n* run() (in module profile):             profile and cProfile Module Reference.\n(line    9)\n* run() (in module subprocess):          Using the subprocess Module.\n(line   11)\n* run() (multiprocessing.Process method): Process and exceptions.\n(line   35)\n* run() (pdb.Pdb method):                pdb -- The Python Debugger.\n(line  210)\n* run() (profile.Profile method):        profile and cProfile Module Reference.\n(line  100)\n* run() (sched.scheduler method):        Scheduler Objects.  (line   51)\n* run() (threading.Thread method):       Thread Objects.     (line  104)\n* run() (trace.Trace method):            Programmatic Interface.\n(line   22)\n* run() (unittest.IsolatedAsyncioTestCase method): Test cases.\n(line  897)\n* run() (unittest.TestCase method):      Test cases.         (line   83)\n* run() (unittest.TestSuite method):     Grouping tests.     (line   41)\n* run() (unittest.TextTestRunner method): Loading and running tests.\n(line  501)\n* run() (wsgiref.handlers.BaseHandler method): wsgiref handlers - server/gateway base classes.\n(line   99)\n* runcall() (bdb.Bdb method):            bdb -- Debugger framework.\n(line  441)\n* runcall() (in module pdb):             pdb -- The Python Debugger.\n(line  142)\n* runcall() (pdb.Pdb method):            pdb -- The Python Debugger.\n(line  210)\n* runcall() (profile.Profile method):    profile and cProfile Module Reference.\n(line  109)\n* runcode() (code.InteractiveInterpreter method): Interactive Interpreter Objects.\n(line   33)\n* runctx() (bdb.Bdb method):             bdb -- Debugger framework.\n(line  436)\n* runctx() (in module profile):          profile and cProfile Module Reference.\n(line   23)\n* runctx() (profile.Profile method):     profile and cProfile Module Reference.\n(line  104)\n* runctx() (trace.Trace method):         Programmatic Interface.\n(line   28)\n* runeval() (bdb.Bdb method):            bdb -- Debugger framework.\n(line  430)\n* runeval() (in module pdb):             pdb -- The Python Debugger.\n(line  135)\n* runeval() (pdb.Pdb method):            pdb -- The Python Debugger.\n(line  210)\n* runfunc() (trace.Trace method):        Programmatic Interface.\n(line   35)\n* Runner (class in asyncio):             Runner context manager.\n(line    6)\n* running() (concurrent.futures.Future method): Future Objects.\n(line   27)\n* runsource() (code.InteractiveInterpreter method): Interactive Interpreter Objects.\n(line    6)\n* runtime (sys.emscripteninfo attribute): sys -- System-specific parameters and functions.\n(line  343)\n* runtimecheckable() (in module typing): Other special directives.\n(line  159)\n* RuntimeError:                          Concrete exceptions.\n(line  232)\n* RuntimeWarning:                        Warnings.           (line   47)\n* RUSAGEBOTH (in module resource):      Resource Usage.     (line  122)\n* RUSAGECHILDREN (in module resource):  Resource Usage.     (line  116)\n* RUSAGESELF (in module resource):      Resource Usage.     (line  110)\n* RUSAGETHREAD (in module resource):    Resource Usage.     (line  128)\n* RWFAPPEND (in module os):             File Descriptor Operations.\n(line  672)\n* RWFDSYNC (in module os):              File Descriptor Operations.\n(line  652)\n* RWFHIPRI (in module os):              File Descriptor Operations.\n(line  596)\n* RWFNOWAIT (in module os):             File Descriptor Operations.\n(line  581)\n* RWFSYNC (in module os):               File Descriptor Operations.\n(line  662)\n* S (in module re):                      Flags.              (line  108)\n* SENFMT (in module stat):              stat -- Interpreting stat results.\n(line  317)\n* SIEXEC (in module stat):              stat -- Interpreting stat results.\n(line  331)\n* SIFBLK (in module stat):              stat -- Interpreting stat results.\n(line  206)\n* SIFCHR (in module stat):              stat -- Interpreting stat results.\n(line  214)\n* SIFDIR (in module stat):              stat -- Interpreting stat results.\n(line  210)\n* SIFDOOR (in module stat):             stat -- Interpreting stat results.\n(line  222)\n* SIFIFO (in module stat):              stat -- Interpreting stat results.\n(line  218)\n* SIFLNK (in module stat):              stat -- Interpreting stat results.\n(line  198)\n* SIFMT() (in module stat):             stat -- Interpreting stat results.\n(line   78)\n* SIFPORT (in module stat):             stat -- Interpreting stat results.\n(line  228)\n* SIFREG (in module stat):              stat -- Interpreting stat results.\n(line  202)\n* SIFSOCK (in module stat):             stat -- Interpreting stat results.\n(line  194)\n* SIFWHT (in module stat):              stat -- Interpreting stat results.\n(line  234)\n* SIMODE() (in module stat):            stat -- Interpreting stat results.\n(line   71)\n* SIREAD (in module stat):              stat -- Interpreting stat results.\n(line  323)\n* SIRGRP (in module stat):              stat -- Interpreting stat results.\n(line  289)\n* SIROTH (in module stat):              stat -- Interpreting stat results.\n(line  305)\n* SIRUSR (in module stat):              stat -- Interpreting stat results.\n(line  273)\n* SIRWXG (in module stat):              stat -- Interpreting stat results.\n(line  285)\n* SIRWXO (in module stat):              stat -- Interpreting stat results.\n(line  301)\n* SIRWXU (in module stat):              stat -- Interpreting stat results.\n(line  269)\n* SISBLK() (in module stat):            stat -- Interpreting stat results.\n(line   30)\n* SISCHR() (in module stat):            stat -- Interpreting stat results.\n(line   25)\n* SISDIR() (in module stat):            stat -- Interpreting stat results.\n(line   21)\n* SISDOOR() (in module stat):           stat -- Interpreting stat results.\n(line   50)\n* SISFIFO() (in module stat):           stat -- Interpreting stat results.\n(line   38)\n* SISGID (in module stat):              stat -- Interpreting stat results.\n(line  251)\n* SISLNK() (in module stat):            stat -- Interpreting stat results.\n(line   42)\n* SISPORT() (in module stat):           stat -- Interpreting stat results.\n(line   56)\n* SISREG() (in module stat):            stat -- Interpreting stat results.\n(line   34)\n* SISSOCK() (in module stat):           stat -- Interpreting stat results.\n(line   46)\n* SISUID (in module stat):              stat -- Interpreting stat results.\n(line  247)\n* SISVTX (in module stat):              stat -- Interpreting stat results.\n(line  262)\n* SISWHT() (in module stat):            stat -- Interpreting stat results.\n(line   62)\n* SIWGRP (in module stat):              stat -- Interpreting stat results.\n(line  293)\n* SIWOTH (in module stat):              stat -- Interpreting stat results.\n(line  309)\n* SIWRITE (in module stat):             stat -- Interpreting stat results.\n(line  327)\n* SIWUSR (in module stat):              stat -- Interpreting stat results.\n(line  277)\n* SIXGRP (in module stat):              stat -- Interpreting stat results.\n(line  297)\n* SIXOTH (in module stat):              stat -- Interpreting stat results.\n(line  313)\n* SIXUSR (in module stat):              stat -- Interpreting stat results.\n(line  281)\n* safe (uuid.SafeUUID attribute):        uuid -- UUID objects according to RFC 4122.\n(line   33)\n* safepath (sys.flags attribute):       sys -- System-specific parameters and functions.\n(line  563)\n* safesubstitute() (string.Template method): Template strings.\n(line   50)\n* SafeChildWatcher (class in asyncio):   Process Watchers.   (line  126)\n* saferepr() (in module pprint):         Functions<4>.       (line   71)\n* SafeUUID (class in uuid):              uuid -- UUID objects according to RFC 4122.\n(line   29)\n* samefiles (filecmp.dircmp attribute): The dircmp class.   (line   85)\n* samequantum() (decimal.Context method): Context objects.  (line  504)\n* samequantum() (decimal.Decimal method): Decimal objects.  (line  541)\n* samefile() (in module os.path):        os path -- Common pathname manipulations.\n(line  395)\n* samefile() (pathlib.Path method):      Methods<2>.         (line  561)\n* SameFileError:                         Directory and files operations.\n(line   52)\n* sameopenfile() (in module os.path):    os path -- Common pathname manipulations.\n(line  411)\n* samesite (http.cookies.Morsel attribute): Morsel Objects.  (line   13)\n* samestat() (in module os.path):        os path -- Common pathname manipulations.\n(line  422)\n* sample() (in module random):           Functions for sequences.\n(line   70)\n* samples() (statistics.NormalDist method): NormalDist objects.\n(line   58)\n* SATURDAY (in module calendar):         calendar -- General calendar-related functions.\n(line  379)\n* save() (http.cookiejar.FileCookieJar method): CookieJar and FileCookieJar Objects.\n(line  106)\n* save() (test.support.SaveSignals method): test support -- Utilities for the Python test suite.\n(line  765)\n* SaveAs (class in tkinter.filedialog):  Native Load/Save Dialogs.\n(line   60)\n* SAVEDCWD (in module test.support.oshelper): test support oshelper -- Utilities for os tests.\n(line   15)\n* SaveFileDialog (class in tkinter.filedialog): Native Load/Save Dialogs.\n(line  145)\n* SaveKey() (in module winreg):          Functions<13>.      (line  395)\n* SaveSignals (class in test.support):   test support -- Utilities for the Python test suite.\n(line  760)\n* savetty() (in module curses):          Functions<6>.       (line  443)\n* SAX2DOM (class in xml.dom.pulldom):    xml dom pulldom -- Support for building partial DOM trees.\n(line   82)\n* SAXException:                          xml sax -- Support for SAX2 parsers.\n(line   86)\n* SAXNotRecognizedException:             xml sax -- Support for SAX2 parsers.\n(line  111)\n* SAXNotSupportedException:              xml sax -- Support for SAX2 parsers.\n(line  118)\n* SAXParseException:                     xml sax -- Support for SAX2 parsers.\n(line  103)\n* scaleb() (decimal.Context method):     Context objects.    (line  508)\n* scaleb() (decimal.Decimal method):     Decimal objects.    (line  551)\n* scandir() (in module os):              Files and Directories.\n(line  826)\n* scanf (C function):                    Simulating scanf.   (line    6)\n* SCHEDBATCH (in module os):            Interface to the scheduler.\n(line   19)\n* SCHEDFIFO (in module os):             Interface to the scheduler.\n(line   32)\n* schedgetprioritymax() (in module os): Interface to the scheduler.\n(line   63)\n* schedgetprioritymin() (in module os): Interface to the scheduler.\n(line   58)\n* schedgetaffinity() (in module os):    Interface to the scheduler.\n(line  109)\n* schedgetparam() (in module os):       Interface to the scheduler.\n(line   87)\n* schedgetscheduler() (in module os):   Interface to the scheduler.\n(line   75)\n* SCHEDIDLE (in module os):             Interface to the scheduler.\n(line   24)\n* SCHEDOTHER (in module os):            Interface to the scheduler.\n(line   15)\n* schedparam (class in os):             Interface to the scheduler.\n(line   46)\n* schedpriority (os.schedparam attribute): Interface to the scheduler.\n(line   54)\n* SCHEDRESETONFORK (in module os):    Interface to the scheduler.\n(line   40)\n* SCHEDRR (in module os):               Interface to the scheduler.\n(line   36)\n* schedrrgetinterval() (in module os): Interface to the scheduler.\n(line   93)\n* schedsetaffinity() (in module os):    Interface to the scheduler.\n(line  102)\n* schedsetparam() (in module os):       Interface to the scheduler.\n(line   81)\n* schedsetscheduler() (in module os):   Interface to the scheduler.\n(line   68)\n* SCHEDSPORADIC (in module os):         Interface to the scheduler.\n(line   28)\n* schedyield() (in module os):          Interface to the scheduler.\n(line   98)\n* scheduler (class in sched):            sched -- Event scheduler.\n(line   13)\n* schema (in module msilib):             Precomputed tables. (line   10)\n* SCMCREDS2 (in module socket):         Constants<8>.       (line  314)\n* scope:                                 Naming and binding. (line    6)\n* scope <1>:                             Resolution of names.\n(line    6)\n* scopeid (ipaddress.IPv6Address attribute): Address objects.\n(line  288)\n* Screen (class in turtle):              Public classes.     (line   30)\n* screensize() (in module turtle):       Window control.     (line   63)\n* scriptfromexamples() (in module doctest): Debugging.     (line   72)\n* scroll() (curses.window method):       Window Objects.     (line  500)\n* ScrolledCanvas (class in turtle):      Public classes.     (line   34)\n* ScrolledText (class in tkinter.scrolledtext): tkinter scrolledtext -- Scrolled Text Widget.\n(line   24)\n* scrollok() (curses.window method):     Window Objects.     (line  504)\n* scrypt() (in module hashlib):          Key derivation.     (line   49)\n* seal() (in module unittest.mock):      Sealing mocks.      (line    6)\n* search() (imaplib.IMAP4 method):       IMAP4 Objects.      (line  222)\n* search() (in module re):               Functions<2>.       (line   36)\n* search() (re.Pattern method):          Regular Expression Objects.\n(line   15)\n* second (datetime.datetime attribute):  datetime Objects.   (line  306)\n* second (datetime.time attribute):      time Objects.       (line   58)\n* seconds since the epoch:               time -- Time access and conversions.\n(line   24)\n* SECTCRE (configparser.ConfigParser attribute): Customizing Parser Behaviour.\n(line  301)\n* sections() (configparser.ConfigParser method): ConfigParser Objects.\n(line   83)\n* secure (http.cookiejar.Cookie attribute): Cookie Objects<2>.\n(line   49)\n* secure (http.cookies.Morsel attribute): Morsel Objects.    (line   13)\n* secure hash algorithm, SHA1, SHA2, SHA224, SHA256, SHA384, SHA512, SHA3, Shake, Blake2: hashlib -- Secure hashes and message digests.\n(line    8)\n* Secure Sockets Layer:                  ssl -- TLS/SSL wrapper for socket objects.\n(line    8)\n* security considerations:               Exceptions<20>.     (line   27)\n* securitylevel (ssl.SSLContext attribute): SSL Contexts.   (line  615)\n* see() (tkinter.ttk.Treeview method):   ttk Treeview.       (line  241)\n* seedbits (sys.hashinfo attribute):   sys -- System-specific parameters and functions.\n(line 1023)\n* seed() (in module random):             Bookkeeping functions.\n(line    6)\n* seed() (random.Random method):         Alternative Generator.\n(line   18)\n* SEEKCUR (in module os):               File Descriptor Operations.\n(line  312)\n* SEEKDATA (in module os):              File Descriptor Operations.\n(line  336)\n* SEEKEND (in module os):               File Descriptor Operations.\n(line  312)\n* SEEKHOLE (in module os):              File Descriptor Operations.\n(line  336)\n* SEEKSET (in module os):               File Descriptor Operations.\n(line  312)\n* seek() (chunk.Chunk method):           chunk -- Read IFF chunked data.\n(line   95)\n* seek() (io.IOBase method):             I/O Base Classes.   (line  106)\n* seek() (io.TextIOBase method):         Text I/O<2>.        (line   66)\n* seek() (io.TextIOWrapper method):      Text I/O<2>.        (line  204)\n* seek() (mmap.mmap method):             mmap -- Memory-mapped file support.\n(line  283)\n* seek() (sqlite3.Blob method):          Blob objects.       (line   63)\n* seekable() (bz2.BZ2File method):       De compression of files.\n(line   99)\n* seekable() (io.IOBase method):         I/O Base Classes.   (line  129)\n* Select (class in tkinter.tix):         Basic Widgets.      (line   59)\n* select() (imaplib.IMAP4 method):       IMAP4 Objects.      (line  239)\n* select() (in module select):           select -- Waiting for I/O completion.\n(line  116)\n* select() (selectors.BaseSelector method): Classes<4>.      (line  108)\n* select() (tkinter.ttk.Notebook method): ttk Notebook.      (line   53)\n* selectedalpnprotocol() (ssl.SSLSocket method): SSL Sockets.\n(line  257)\n* selectednpnprotocol() (ssl.SSLSocket method): SSL Sockets.\n(line  267)\n* selectionadd() (tkinter.ttk.Treeview method): ttk Treeview.\n(line  264)\n* selectionremove() (tkinter.ttk.Treeview method): ttk Treeview.\n(line  271)\n* selectionset() (tkinter.ttk.Treeview method): ttk Treeview.\n(line  257)\n* selectiontoggle() (tkinter.ttk.Treeview method): ttk Treeview.\n(line  278)\n* selection() (tkinter.ttk.Treeview method): ttk Treeview.   (line  249)\n* selector (urllib.request.Request attribute): Request Objects.\n(line   34)\n* SelectorEventLoop (class in asyncio):  Event Loop Implementations.\n(line   12)\n* SelectorKey (class in selectors):      Classes<4>.         (line   29)\n* SelectSelector (class in selectors):   Classes<4>.         (line  167)\n* Self (in module typing):               Special types.      (line  133)\n* Semaphore (class in asyncio):          Semaphore.          (line    6)\n* Semaphore (class in multiprocessing):  Synchronization primitives.\n(line  167)\n* Semaphore (class in threading):        Semaphore Objects.  (line   19)\n* Semaphore() (multiprocessing.managers.SyncManager method): Managers.\n(line  208)\n* semaphores, binary:                    thread -- Low-level threading API.\n(line    6)\n* SEMI (in module token):                token -- Constants used with Python parse trees.\n(line   78)\n* SEND (opcode):                         Python Bytecode Instructions.\n(line 1129)\n* sendbytes() (multiprocessing.connection.Connection method): Connection Objects.\n(line   54)\n* senderror() (http.server.BaseHTTPRequestHandler method): http server -- HTTP servers.\n(line  217)\n* sendfds() (in module socket):         Other functions<2>. (line  434)\n* sendheader() (http.server.BaseHTTPRequestHandler method): http server -- HTTP servers.\n(line  253)\n* sendmessage() (smtplib.SMTP method):  SMTP Objects.       (line  304)\n* sendresponseonly() (http.server.BaseHTTPRequestHandler method): http server -- HTTP servers.\n(line  266)\n* sendresponse() (http.server.BaseHTTPRequestHandler method): http server -- HTTP servers.\n(line  237)\n* sendsignal() (asyncio.subprocess.Process method): Interacting with Subprocesses.\n(line   86)\n* sendsignal() (asyncio.SubprocessTransport method): Subprocess Transports.\n(line   44)\n* sendsignal() (subprocess.Popen method): Popen Objects.    (line   75)\n* send() (coroutine method):             Coroutine Objects.  (line   23)\n* send() (generator method):             Generator-iterator methods.\n(line   27)\n* send() (http.client.HTTPConnection method): HTTPConnection Objects.\n(line  211)\n* send() (imaplib.IMAP4 method):         IMAP4 Objects.      (line  246)\n* send() (logging.handlers.DatagramHandler method): DatagramHandler.\n(line   43)\n* send() (logging.handlers.SocketHandler method): SocketHandler.\n(line   63)\n* send() (multiprocessing.connection.Connection method): Connection Objects.\n(line   15)\n* send() (socket.socket method):         Socket Objects.     (line  398)\n* sendall() (socket.socket method):      Socket Objects.     (line  414)\n* sendcmd() (ftplib.FTP method):         FTP objects.        (line  157)\n* sendfile() (asyncio.loop method):      Transferring files. (line    6)\n* sendfile() (in module os):             File Descriptor Operations.\n(line  707)\n* sendfile() (socket.socket method):     Socket Objects.     (line  507)\n* sendfile() (wsgiref.handlers.BaseHandler method): wsgiref handlers - server/gateway base classes.\n(line  279)\n* SendfileNotAvailableError:             Exceptions<11>.     (line   37)\n* sendfunc (C type):                     Slot Type typedefs. (line  116)\n* sendmail() (smtplib.SMTP method):      SMTP Objects.       (line  226)\n* sendmsgafalg() (socket.socket method): Socket Objects.    (line  496)\n* sendmsg() (socket.socket method):      Socket Objects.     (line  452)\n* sendto() (asyncio.DatagramTransport method): Datagram Transports.\n(line    6)\n* sendto() (socket.socket method):       Socket Objects.     (line  433)\n* sentinel (in module unittest.mock):    sentinel.           (line    6)\n* sentinel (multiprocessing.Process attribute): Process and exceptions.\n(line  156)\n* sep (in module os):                    Miscellaneous System Information.\n(line   96)\n* SEPTEMBER (in module calendar):        calendar -- General calendar-related functions.\n(line  414)\n* sequence:                              Glossary.           (line 1227)\n* Sequence (class in collections.abc):   Collections Abstract Base Classes - Detailed Descriptions.\n(line   62)\n* Sequence (class in typing):            Aliases to container ABCs in collections abc.\n(line  103)\n* sequence (in module msilib):           Precomputed tables. (line   16)\n* sequence; item:                        Subscriptions.      (line    6)\n* sequence; iteration:                   Iterator Types.     (line    6)\n* SequenceMatcher (class in difflib):    SequenceMatcher Objects.\n(line    8)\n* serialize() (sqlite3.Connection method): Connection objects.\n(line  648)\n* serializing; objects:                  pickle -- Python object serialization.\n(line    8)\n* serveforever() (asyncio.Server method): Server Objects.   (line   66)\n* serveforever() (socketserver.BaseServer method): Server Objects<2>.\n(line   32)\n* Server (class in asyncio):             Server Objects.     (line   12)\n* server (http.server.BaseHTTPRequestHandler attribute): http server -- HTTP servers.\n(line   77)\n* server (socketserver.BaseRequestHandler attribute): Request Handler Objects.\n(line   52)\n* serveractivate() (socketserver.BaseServer method): Server Objects<2>.\n(line  164)\n* serveraddress (socketserver.BaseServer attribute): Server Objects<2>.\n(line   76)\n* serverbind() (socketserver.BaseServer method): Server Objects<2>.\n(line  170)\n* serverclose() (socketserver.BaseServer method): Server Objects<2>.\n(line   61)\n* serverhostname (ssl.SSLSocket attribute): SSL Sockets.    (line  337)\n* serverside (ssl.SSLSocket attribute): SSL Sockets.        (line  330)\n* serversoftware (wsgiref.handlers.BaseHandler attribute): wsgiref handlers - server/gateway base classes.\n(line  179)\n* serverversion (http.server.BaseHTTPRequestHandler attribute): http server -- HTTP servers.\n(line  136)\n* serverversion (http.server.SimpleHTTPRequestHandler attribute): http server -- HTTP servers.\n(line  361)\n* ServerProxy (class in xmlrpc.client):  xmlrpc client -- XML-RPC client access.\n(line   30)\n* serviceactions() (socketserver.BaseServer method): Server Objects<2>.\n(line   45)\n* session (ssl.SSLSocket attribute):     SSL Sockets.        (line  350)\n* sessionreused (ssl.SSLSocket attribute): SSL Sockets.     (line  360)\n* sessionstats() (ssl.SSLContext method): SSL Contexts.     (line  470)\n* set (built-in class):                  Set Types -- set frozenset.\n(line   33)\n* Set (class in ast):                    Literals<3>.        (line   92)\n* Set (class in collections.abc):        Collections Abstract Base Classes - Detailed Descriptions.\n(line   86)\n* Set (class in typing):                 Aliases to built-in types.\n(line   43)\n* Set Breakpoint:                        Help menu Shell and Editor.\n(line   30)\n* set comprehension:                     Glossary.           (line 1248)\n* SETADD (opcode):                      Python Bytecode Instructions.\n(line  312)\n* setall():                             Reference Count Details.\n(line   98)\n* setalloweddomains() (http.cookiejar.DefaultCookiePolicy method): DefaultCookiePolicy Objects.\n(line   70)\n* setalpnprotocols() (ssl.SSLContext method): SSL Contexts.\n(line  242)\n* setapp() (wsgiref.simpleserver.WSGIServer method): wsgiref simpleserver - a simple WSGI HTTP server.\n(line   61)\n* setasyncgenhooks() (in module sys):  sys -- System-specific parameters and functions.\n(line 1646)\n* setauthorizer() (sqlite3.Connection method): Connection objects.\n(line  337)\n* setautohistory() (in module readline): History list.     (line   43)\n* setblockeddomains() (http.cookiejar.DefaultCookiePolicy method): DefaultCookiePolicy Objects.\n(line   56)\n* setblocking() (in module os):         File Descriptor Operations.\n(line  768)\n* setboundary() (email.message.EmailMessage method): email message Representing an email message.\n(line  411)\n* setboundary() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  586)\n* setbreak() (bdb.Bdb method):          bdb -- Debugger framework.\n(line  337)\n* setcharset() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  235)\n* setchildwatcher() (asyncio.AbstractEventLoopPolicy method): Policy Objects.\n(line   44)\n* setchildwatcher() (in module asyncio): Process Watchers. (line   31)\n* setchildren() (tkinter.ttk.Treeview method): ttk Treeview.\n(line   25)\n* setciphers() (ssl.SSLContext method): SSL Contexts.       (line  228)\n* setcompleterdelims() (in module readline): Completion.   (line   50)\n* setcompleter() (in module readline):  Completion.         (line   14)\n* setcompletiondisplaymatcheshook() (in module readline): Completion.\n(line   59)\n* setcontent() (email.contentmanager.ContentManager method): email contentmanager Managing MIME Content.\n(line   40)\n* setcontent() (email.message.EmailMessage method): email message Representing an email message.\n(line  590)\n* setcontent() (in module email.contentmanager): Content Manager Instances.\n(line   35)\n* setcontinue() (bdb.Bdb method):       bdb -- Debugger framework.\n(line  322)\n* setcookieifok() (http.cookiejar.CookieJar method): CookieJar and FileCookieJar Objects.\n(line   69)\n* setcookie() (http.cookiejar.CookieJar method): CookieJar and FileCookieJar Objects.\n(line   73)\n* setcoroutineorigintrackingdepth() (in module sys): sys -- System-specific parameters and functions.\n(line 1671)\n* setcurrent() (msilib.Feature method): Features<3>.        (line   14)\n* setdata() (importlib.abc.SourceLoader method): importlib abc - Abstract base classes related to import.\n(line  417)\n* setdata() (importlib.machinery.SourceFileLoader method): importlib machinery - Importers and path hooks.\n(line  230)\n* setdate() (mailbox.MaildirMessage method): MaildirMessage objects.\n(line   97)\n* setdebug() (asyncio.loop method):     Enabling debug mode.\n(line   14)\n* setdebug() (in module gc):            gc -- Garbage Collector interface.\n(line   51)\n* setdebuglevel() (ftplib.FTP method):  FTP objects.        (line   74)\n* setdebuglevel() (http.client.HTTPConnection method): HTTPConnection Objects.\n(line   87)\n* setdebuglevel() (nntplib.NNTP method): Methods<3>.        (line  307)\n* setdebuglevel() (poplib.POP3 method): POP3 Objects.       (line   11)\n* setdebuglevel() (smtplib.SMTP method): SMTP Objects.      (line    8)\n* setdebuglevel() (telnetlib.Telnet method): Telnet Objects.\n(line   83)\n* setdefaultexecutor() (asyncio.loop method): Executing code in thread or process pools.\n(line   71)\n* setdefaulttype() (email.message.EmailMessage method): email message Representing an email message.\n(line  342)\n* setdefaulttype() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  449)\n* setdefaultverifypaths() (ssl.SSLContext method): SSL Contexts.\n(line  219)\n* setdefaults() (argparse.ArgumentParser method): Parser defaults.\n(line    6)\n* setdefaults() (optparse.OptionParser method): Other methods.\n(line   27)\n* setecdhcurve() (ssl.SSLContext method): SSL Contexts.    (line  355)\n* seterrno() (in module ctypes):        Utility functions.  (line  171)\n* setescdelay() (in module curses):     Functions<6>.       (line  454)\n* seteventlooppolicy() (in module asyncio): Getting and Setting the Policy.\n(line   13)\n* seteventloop() (asyncio.AbstractEventLoopPolicy method): Policy Objects.\n(line   23)\n* seteventloop() (in module asyncio):  Event Loop.         (line   63)\n* setevents() (in module sys.monitoring): Setting events globally.\n(line   13)\n* setexceptionhandler() (asyncio.loop method): Error Handling API.\n(line    8)\n* setexception() (asyncio.Future method): Future Object.    (line   56)\n* setexception() (concurrent.futures.Future method): Future Objects.\n(line  117)\n* setexecutable() (in module multiprocessing): Miscellaneous<3>.\n(line  110)\n* setfilter() (tkinter.filedialog.FileDialog method): Native Load/Save Dialogs.\n(line  127)\n* setflags() (mailbox.MaildirMessage method): MaildirMessage objects.\n(line   72)\n* setflags() (mailbox.mboxMessage method): mboxMessage objects.\n(line   72)\n* setflags() (mailbox.MMDFMessage method): MMDFMessage objects.\n(line   71)\n* setforkserverpreload() (in module multiprocessing): Miscellaneous<3>.\n(line  125)\n* setfrom() (mailbox.mboxMessage method): mboxMessage objects.\n(line   53)\n* setfrom() (mailbox.MMDFMessage method): MMDFMessage objects.\n(line   52)\n* sethandleinheritable() (in module os): Inheritance of File Descriptors.\n(line   41)\n* sethistorylength() (in module readline): History file.   (line   30)\n* setinfo() (mailbox.MaildirMessage method): MaildirMessage objects.\n(line  108)\n* setinheritable() (in module os):      Inheritance of File Descriptors.\n(line   31)\n* setinheritable() (socket.socket method): Socket Objects.  (line  524)\n* setintmaxstrdigits() (in module sys): sys -- System-specific parameters and functions.\n(line 1442)\n* setlabels() (mailbox.BabylMessage method): BabylMessage objects.\n(line   51)\n* setlasterror() (in module ctypes):   Utility functions.  (line  180)\n* setliteral (2to3 fixer):              Fixers.             (line  289)\n* setlocalevents() (in module sys.monitoring): Per code object events.\n(line   13)\n* setmemlimit() (in module test.support): test support -- Utilities for the Python test suite.\n(line  303)\n* setname() (asyncio.Task method):      Task Object.        (line  187)\n* setnext() (bdb.Bdb method):           bdb -- Debugger framework.\n(line  304)\n* setnonstandardattr() (http.cookiejar.Cookie method): Cookie Objects<2>.\n(line  107)\n* setnpnprotocols() (ssl.SSLContext method): SSL Contexts. (line  257)\n* setok() (http.cookiejar.CookiePolicy method): CookiePolicy Objects.\n(line    9)\n* setoptionnegotiationcallback() (telnetlib.Telnet method): Telnet Objects.\n(line  142)\n* setparam() (email.message.EmailMessage method): email message Representing an email message.\n(line  351)\n* setparam() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  517)\n* setpasv() (ftplib.FTP method):        FTP objects.        (line  213)\n* setpayload() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  225)\n* setpolicy() (http.cookiejar.CookieJar method): CookieJar and FileCookieJar Objects.\n(line   57)\n* setposition() (xdrlib.Unpacker method): Unpacker Objects. (line   16)\n* setpreinputhook() (in module readline): Startup hooks.  (line   14)\n* setprogresshandler() (sqlite3.Connection method): Connection objects.\n(line  366)\n* setprotocol() (asyncio.BaseTransport method): Base Transport.\n(line   81)\n* setproxy() (urllib.request.Request method): Request Objects.\n(line  115)\n* setquit() (bdb.Bdb method):           bdb -- Debugger framework.\n(line  327)\n* setrecsrc() (ossaudiodev.ossmixerdevice method): Mixer Device Objects.\n(line   89)\n* setresult() (asyncio.Future method):  Future Object.      (line   49)\n* setresult() (concurrent.futures.Future method): Future Objects.\n(line  105)\n* setreturn() (bdb.Bdb method):         bdb -- Debugger framework.\n(line  308)\n* setrunningornotifycancel() (concurrent.futures.Future method): Future Objects.\n(line   85)\n* setselection() (tkinter.filedialog.FileDialog method): Native Load/Save Dialogs.\n(line  131)\n* setseq1() (difflib.SequenceMatcher method): SequenceMatcher Objects.\n(line   54)\n* setseq2() (difflib.SequenceMatcher method): SequenceMatcher Objects.\n(line   59)\n* setseqs() (difflib.SequenceMatcher method): SequenceMatcher Objects.\n(line   44)\n* setsequences() (mailbox.MH method):   MH objects.         (line   58)\n* setsequences() (mailbox.MHMessage method): MHMessage objects.\n(line   37)\n* setserverdocumentation() (xmlrpc.server.DocCGIXMLRPCRequestHandler method): DocCGIXMLRPCRequestHandler.\n(line   24)\n* setserverdocumentation() (xmlrpc.server.DocXMLRPCServer method): DocXMLRPCServer Objects.\n(line   24)\n* setservername() (xmlrpc.server.DocCGIXMLRPCRequestHandler method): DocCGIXMLRPCRequestHandler.\n(line   18)\n* setservername() (xmlrpc.server.DocXMLRPCServer method): DocXMLRPCServer Objects.\n(line   18)\n* setservertitle() (xmlrpc.server.DocCGIXMLRPCRequestHandler method): DocCGIXMLRPCRequestHandler.\n(line   13)\n* setservertitle() (xmlrpc.server.DocXMLRPCServer method): DocXMLRPCServer Objects.\n(line   13)\n* setservernamecallback (ssl.SSLContext attribute): SSL Contexts.\n(line  326)\n* setstartmethod() (in module multiprocessing): Miscellaneous<3>.\n(line  142)\n* setstartuphook() (in module readline): Startup hooks.    (line    6)\n* setstep() (bdb.Bdb method):           bdb -- Debugger framework.\n(line  300)\n* setsubdir() (mailbox.MaildirMessage method): MaildirMessage objects.\n(line   58)\n* settabsize() (in module curses):      Functions<6>.       (line  469)\n* settaskfactory() (asyncio.loop method): Creating Futures and Tasks.\n(line   37)\n* setthreshold() (in module gc):        gc -- Garbage Collector interface.\n(line   92)\n* settracecallback() (sqlite3.Connection method): Connection objects.\n(line  380)\n* settrace() (bdb.Bdb method):          bdb -- Debugger framework.\n(line  317)\n* settrace() (in module bdb):           bdb -- Debugger framework.\n(line  474)\n* settrace() (in module pdb):           pdb -- The Python Debugger.\n(line  149)\n* settrace() (pdb.Pdb method):          pdb -- The Python Debugger.\n(line  210)\n* settunnel() (http.client.HTTPConnection method): HTTPConnection Objects.\n(line   97)\n* settype() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  550)\n* setunittestreportflags() (in module doctest): Unittest API.\n(line  173)\n* setunixfrom() (email.message.EmailMessage method): email message Representing an email message.\n(line  146)\n* setunixfrom() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  157)\n* setuntil() (bdb.Bdb method):          bdb -- Debugger framework.\n(line  312)\n* SETUPDATE (opcode):                   Python Bytecode Instructions.\n(line  652)\n* seturl() (urllib.robotparser.RobotFileParser method): urllib robotparser -- Parser for robots txt.\n(line   21)\n* setusage() (optparse.OptionParser method): Other methods. (line    8)\n* setuserptr() (curses.panel.Panel method): Panel Objects.  (line   43)\n* setvisible() (mailbox.BabylMessage method): BabylMessage objects.\n(line   68)\n* setwakeupfd() (in module signal):    Module contents<2>. (line  442)\n* setwritebufferlimits() (asyncio.WriteTransport method): Write-only Transports.\n(line   33)\n* set; comprehensions:                   Set displays.       (line    6)\n* set; display:                          Set displays.       (line    6)\n* set() (asyncio.Event method):          Event.              (line   51)\n* set() (configparser.ConfigParser method): ConfigParser Objects.\n(line  252)\n* set() (configparser.RawConfigParser method): RawConfigParser Objects.\n(line   37)\n* set() (contextvars.ContextVar method): Context Variables.  (line   46)\n* set() (http.cookies.Morsel method):    Morsel Objects.     (line   58)\n* set() (ossaudiodev.ossmixerdevice method): Mixer Device Objects.\n(line   72)\n* set() (test.support.oshelper.EnvironmentVarGuard method): test support oshelper -- Utilities for os tests.\n(line   66)\n* set() (threading.Event method):        Event Objects.      (line   30)\n* set() (tkinter.ttk.Combobox method):   ttk Combobox.       (line   19)\n* set() (tkinter.ttk.Spinbox method):    ttk Spinbox.        (line   12)\n* set() (tkinter.ttk.Treeview method):   ttk Treeview.       (line  285)\n* set() (xml.etree.ElementTree.Element method): Element Objects.\n(line   81)\n* setacl() (imaplib.IMAP4 method):       IMAP4 Objects.      (line  253)\n* setannotation() (imaplib.IMAP4 method): IMAP4 Objects.     (line  258)\n* setattrfunc (C type):                  Slot Type typedefs. (line   48)\n* setAttribute() (xml.dom.Element method): Element Objects<2>.\n(line   67)\n* setAttributeNode() (xml.dom.Element method): Element Objects<2>.\n(line   71)\n* setAttributeNodeNS() (xml.dom.Element method): Element Objects<2>.\n(line   79)\n* setAttributeNS() (xml.dom.Element method): Element Objects<2>.\n(line   87)\n* setattrofunc (C type):                 Slot Type typedefs. (line   61)\n* SetBase() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line   22)\n* setblocking() (socket.socket method):  Socket Objects.     (line  531)\n* setByteStream() (xml.sax.xmlreader.InputSource method): InputSource Objects.\n(line   36)\n* setcbreak() (in module tty):           tty -- Terminal control functions.\n(line   54)\n* setCharacterStream() (xml.sax.xmlreader.InputSource method): InputSource Objects.\n(line   55)\n* SetComp (class in ast):                Comprehensions.     (line    6)\n* setcomptype() (aifc.aifc method):      aifc -- Read and write AIFF and AIFC files.\n(line  161)\n* setcomptype() (sunau.AUwrite method): AUwrite Objects.   (line   28)\n* setcomptype() (wave.Wavewrite method): Wavewrite Objects.\n(line   59)\n* setconfig() (sqlite3.Connection method): Connection objects.\n(line  632)\n* setContentHandler() (xml.sax.xmlreader.XMLReader method): XMLReader Objects.\n(line   25)\n* setcontext() (in module decimal):      Context objects.    (line   18)\n* setDaemon() (threading.Thread method): Thread Objects.     (line  215)\n* setdefault() (dict method):            Mapping Types -- dict.\n(line  198)\n* setdefault() (http.cookies.Morsel method): Morsel Objects. (line  102)\n* setdefaulttimeout() (in module socket): Other functions<2>.\n(line  354)\n* setdlopenflags() (in module sys):      sys -- System-specific parameters and functions.\n(line 1429)\n* setDocumentLocator() (xml.sax.handler.ContentHandler method): ContentHandler Objects.\n(line   10)\n* setDTDHandler() (xml.sax.xmlreader.XMLReader method): XMLReader Objects.\n(line   34)\n* setegid() (in module os):              Process Parameters. (line  377)\n* setEncoding() (xml.sax.xmlreader.InputSource method): InputSource Objects.\n(line   22)\n* setEntityResolver() (xml.sax.xmlreader.XMLReader method): XMLReader Objects.\n(line   43)\n* setErrorHandler() (xml.sax.xmlreader.XMLReader method): XMLReader Objects.\n(line   54)\n* seteuid() (in module os):              Process Parameters. (line  383)\n* setFeature() (xml.sax.xmlreader.XMLReader method): XMLReader Objects.\n(line   76)\n* setfirstweekday() (in module calendar): calendar -- General calendar-related functions.\n(line  289)\n* setfmt() (ossaudiodev.ossaudiodevice method): Audio Device Objects.\n(line  125)\n* setFormatter() (logging.Handler method): Handler Objects.  (line   48)\n* setframerate() (aifc.aifc method):     aifc -- Read and write AIFF and AIFC files.\n(line  151)\n* setframerate() (sunau.AUwrite method): AUwrite Objects.  (line   19)\n* setframerate() (wave.Wavewrite method): Wavewrite Objects.\n(line   45)\n* setgid() (in module os):               Process Parameters. (line  389)\n* setgroups() (in module os):            Process Parameters. (line  395)\n* seth() (in module turtle):             Turtle motion.      (line  166)\n* setheading() (in module turtle):       Turtle motion.      (line  166)\n* sethostname() (in module socket):      Other functions<2>. (line  361)\n* setinputsizes() (sqlite3.Cursor method): Cursor objects.   (line  162)\n* SetInteger() (msilib.Record method):   Record Objects.     (line   32)\n* setitem() (in module operator):        operator -- Standard operators as functions.\n(line  205)\n* setitimer() (in module signal):        Module contents<2>. (line  413)\n* setLevel() (logging.Handler method):   Handler Objects.    (line   35)\n* setLevel() (logging.Logger method):    Logger Objects.     (line  104)\n* setlimit() (sqlite3.Connection method): Connection objects.\n(line  586)\n* setlocale() (in module locale):        locale -- Internationalization services.\n(line   27)\n* setLocale() (xml.sax.xmlreader.XMLReader method): XMLReader Objects.\n(line   60)\n* setLoggerClass() (in module logging):  Module-Level Functions.\n(line  321)\n* setlogmask() (in module syslog):       syslog -- Unix syslog library routines.\n(line   98)\n* setLogRecordFactory() (in module logging): Module-Level Functions.\n(line  332)\n* setmark() (aifc.aifc method):          aifc -- Read and write AIFF and AIFC files.\n(line  179)\n* setMaxConns() (urllib.request.CacheFTPHandler method): CacheFTPHandler Objects.\n(line   13)\n* setmode() (in module msvcrt):          File Operations.    (line   38)\n* setName() (threading.Thread method):   Thread Objects.     (line  159)\n* setnchannels() (aifc.aifc method):     aifc -- Read and write AIFF and AIFC files.\n(line  143)\n* setnchannels() (sunau.AUwrite method): AUwrite Objects.  (line    9)\n* setnchannels() (wave.Wavewrite method): Wavewrite Objects.\n(line   37)\n* setnframes() (aifc.aifc method):       aifc -- Read and write AIFF and AIFC files.\n(line  155)\n* setnframes() (sunau.AUwrite method):  AUwrite Objects.   (line   23)\n* setnframes() (wave.Wavewrite method): Wavewrite Objects. (line   52)\n* setns() (in module os):                Process Parameters. (line  410)\n* setoutputsize() (sqlite3.Cursor method): Cursor objects.   (line  166)\n* SetParamEntityParsing() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line   54)\n* setparameters() (ossaudiodev.ossaudiodevice method): Audio Device Objects.\n(line  189)\n* setparams() (aifc.aifc method):        aifc -- Read and write AIFF and AIFC files.\n(line  171)\n* setparams() (sunau.AUwrite method):   AUwrite Objects.   (line   33)\n* setparams() (wave.Wavewrite method):  Wavewrite Objects. (line   64)\n* setpassword() (zipfile.ZipFile method): ZipFile Objects.   (line  232)\n* setpgid() (in module os):              Process Parameters. (line  457)\n* setpgrp() (in module os):              Process Parameters. (line  449)\n* setpos() (aifc.aifc method):           aifc -- Read and write AIFF and AIFC files.\n(line  111)\n* setpos() (in module turtle):           Turtle motion.      (line   74)\n* setpos() (sunau.AUread method):       AUread Objects.    (line   60)\n* setpos() (wave.Waveread method):      Waveread Objects.  (line   75)\n* setposition() (in module turtle):      Turtle motion.      (line   74)\n* setpriority() (in module os):          Process Parameters. (line  465)\n* setprofileallthreads() (in module threading): threading -- Thread-based parallelism.\n(line  189)\n* setprofile() (in module sys):          sys -- System-specific parameters and functions.\n(line 1450)\n* setprofile() (in module threading):    threading -- Thread-based parallelism.\n(line  182)\n* SetProperty() (msilib.SummaryInformation method): Summary Information Objects.\n(line   22)\n* setProperty() (xml.sax.xmlreader.XMLReader method): XMLReader Objects.\n(line   90)\n* setPublicId() (xml.sax.xmlreader.InputSource method): InputSource Objects.\n(line    6)\n* setquota() (imaplib.IMAP4 method):     IMAP4 Objects.      (line  263)\n* setraw() (in module tty):              tty -- Terminal control functions.\n(line   43)\n* setrecursionlimit() (in module sys):   sys -- System-specific parameters and functions.\n(line 1507)\n* setregid() (in module os):             Process Parameters. (line  482)\n* SetReparseDeferralEnabled() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line   82)\n* setresgid() (in module os):            Process Parameters. (line  488)\n* setresuid() (in module os):            Process Parameters. (line  496)\n* setreuid() (in module os):             Process Parameters. (line  504)\n* setrlimit() (in module resource):      Resource Limits.    (line   31)\n* setsampwidth() (aifc.aifc method):     aifc -- Read and write AIFF and AIFC files.\n(line  147)\n* setsampwidth() (sunau.AUwrite method): AUwrite Objects.  (line   13)\n* setsampwidth() (wave.Wavewrite method): Wavewrite Objects.\n(line   41)\n* setscrreg() (curses.window method):    Window Objects.     (line  514)\n* setsid() (in module os):               Process Parameters. (line  517)\n* setsockopt() (socket.socket method):   Socket Objects.     (line  564)\n* setstate() (codecs.IncrementalDecoder method): IncrementalDecoder Objects.\n(line   60)\n* setstate() (codecs.IncrementalEncoder method): IncrementalEncoder Objects.\n(line   51)\n* setstate() (in module random):         Bookkeeping functions.\n(line   38)\n* setstate() (random.Random method):     Alternative Generator.\n(line   28)\n* setStream() (logging.StreamHandler method): StreamHandler. (line   32)\n* SetStream() (msilib.Record method):    Record Objects.     (line   26)\n* SetString() (msilib.Record method):    Record Objects.     (line   21)\n* setswitchinterval (in module sys):     Thread State and the Global Interpreter Lock.\n(line   15)\n* setswitchinterval() (in module sys):   sys -- System-specific parameters and functions.\n(line 1525)\n* setswitchinterval() (in module test.support): test support -- Utilities for the Python test suite.\n(line  286)\n* setSystemId() (xml.sax.xmlreader.InputSource method): InputSource Objects.\n(line   14)\n* setsyx() (in module curses):           Functions<6>.       (line  477)\n* setTarget() (logging.handlers.MemoryHandler method): MemoryHandler.\n(line   68)\n* setter (C type):                       Defining Getters and Setters.\n(line   42)\n* settiltangle() (in module turtle):     Appearance.         (line  117)\n* settimeout() (socket.socket method):   Socket Objects.     (line  548)\n* setTimeout() (urllib.request.CacheFTPHandler method): CacheFTPHandler Objects.\n(line    9)\n* settraceallthreads() (in module threading): threading -- Thread-based parallelism.\n(line  165)\n* settrace() (in module sys):            sys -- System-specific parameters and functions.\n(line 1538)\n* settrace() (in module threading):      threading -- Thread-based parallelism.\n(line  158)\n* setuid() (in module os):               Process Parameters. (line  524)\n* setundobuffer() (in module turtle):    Special Turtle methods.\n(line   61)\n* SETUPANNOTATIONS (opcode):            Python Bytecode Instructions.\n(line  369)\n* SETUPCLEANUP (opcode):                Python Bytecode Instructions.\n(line 1270)\n* setupenviron() (wsgiref.handlers.BaseHandler method): wsgiref handlers - server/gateway base classes.\n(line  199)\n* SETUPFINALLY (opcode):                Python Bytecode Instructions.\n(line 1263)\n* setuppython() (venv.EnvBuilder method): API<2>.           (line  148)\n* setupscripts() (venv.EnvBuilder method): API<2>.          (line  156)\n* setuptestingdefaults() (in module wsgiref.util): wsgiref util - WSGI environment utilities.\n(line   70)\n* SETUPWITH (opcode):                   Python Bytecode Instructions.\n(line 1278)\n* setup() (in module turtle):            Methods specific to Screen not inherited from TurtleScreen.\n(line   20)\n* setup() (socketserver.BaseRequestHandler method): Request Handler Objects.\n(line   14)\n* setUp() (unittest.TestCase method):    Test cases.         (line   33)\n* setUpClass() (unittest.TestCase method): Test cases.       (line   55)\n* setupterm() (in module curses):        Functions<6>.       (line  482)\n* SetValue() (in module winreg):         Functions<13>.      (line  419)\n* SetValueEx() (in module winreg):       Functions<13>.      (line  450)\n* setworldcoordinates() (in module turtle): Window control.  (line   90)\n* setx() (in module turtle):             Turtle motion.      (line  138)\n* setxattr() (in module os):             Linux extended attributes.\n(line   57)\n* sety() (in module turtle):             Turtle motion.      (line  152)\n* SFAPPEND (in module stat):            stat -- Interpreting stat results.\n(line  374)\n* SFARCHIVED (in module stat):          stat -- Interpreting stat results.\n(line  366)\n* SFIMMUTABLE (in module stat):         stat -- Interpreting stat results.\n(line  370)\n* SFMNOWAIT (in module os):             File Descriptor Operations.\n(line  747)\n* SFNOCACHE (in module os):             File Descriptor Operations.\n(line  758)\n* SFNODISKIO (in module os):            File Descriptor Operations.\n(line  747)\n* SFNOUNLINK (in module stat):          stat -- Interpreting stat results.\n(line  378)\n* SFSNAPSHOT (in module stat):          stat -- Interpreting stat results.\n(line  382)\n* SFSYNC (in module os):                File Descriptor Operations.\n(line  747)\n* sha1() (in module hashlib):            Constructors.       (line   22)\n* sha224() (in module hashlib):          Constructors.       (line   24)\n* sha256() (in module hashlib):          Constructors.       (line   26)\n* sha3224() (in module hashlib):        Constructors.       (line   32)\n* sha3256() (in module hashlib):        Constructors.       (line   34)\n* sha3384() (in module hashlib):        Constructors.       (line   36)\n* sha3512() (in module hashlib):        Constructors.       (line   38)\n* sha384() (in module hashlib):          Constructors.       (line   28)\n* sha512() (in module hashlib):          Constructors.       (line   30)\n* shake128() (in module hashlib):       SHAKE variable length digests.\n(line    6)\n* shake256() (in module hashlib):       SHAKE variable length digests.\n(line    8)\n* Shape (class in turtle):               Public classes.     (line   43)\n* shape (memoryview attribute):          Memory Views.       (line  451)\n* shape() (in module turtle):            Appearance.         (line    6)\n* shapesize() (in module turtle):        Appearance.         (line   52)\n* shapetransform() (in module turtle):   Appearance.         (line  156)\n* share() (socket.socket method):        Socket Objects.     (line  598)\n* ShareableList (class in multiprocessing.sharedmemory): multiprocessing sharedmemory -- Shared memory for direct access across processes.\n(line  249)\n* ShareableList() (multiprocessing.managers.SharedMemoryManager method): multiprocessing sharedmemory -- Shared memory for direct access across processes.\n(line  209)\n* Shared Memory:                         multiprocessing sharedmemory -- Shared memory for direct access across processes.\n(line   10)\n* sharedciphers() (ssl.SSLSocket method): SSL Sockets.      (line  220)\n* sharedmemory (sys.emscripteninfo attribute): sys -- System-specific parameters and functions.\n(line  352)\n* SharedMemory (class in multiprocessing.sharedmemory): multiprocessing sharedmemory -- Shared memory for direct access across processes.\n(line   33)\n* SharedMemory() (multiprocessing.managers.SharedMemoryManager method): multiprocessing sharedmemory -- Shared memory for direct access across processes.\n(line  204)\n* SharedMemoryManager (class in multiprocessing.managers): multiprocessing sharedmemory -- Shared memory for direct access across processes.\n(line  177)\n* shearfactor() (in module turtle):      Appearance.         (line   83)\n* Shelf (class in shelve):               Restrictions.       (line   27)\n* shield() (in module asyncio):          Shielding From Cancellation.\n(line    6)\n* shiftpathinfo() (in module wsgiref.util): wsgiref util - WSGI environment utilities.\n(line   40)\n* shift() (decimal.Context method):      Context objects.    (line  513)\n* shift() (decimal.Decimal method):      Decimal objects.    (line  557)\n* shifting; operation:                   Shifting operations.\n(line    6)\n* shifting; operations:                  Bitwise Operations on Integer Types.\n(line    6)\n* shlex (class in shlex):                shlex -- Simple lexical analysis.\n(line   92)\n* shm (multiprocessing.sharedmemory.ShareableList attribute): multiprocessing sharedmemory -- Shared memory for direct access across processes.\n(line  323)\n* SHORTTIMEOUT (in module test.support): test support -- Utilities for the Python test suite.\n(line   80)\n* shortDescription() (unittest.TestCase method): Test cases. (line  757)\n* shorten() (in module textwrap):        textwrap -- Text wrapping and filling.\n(line   49)\n* shouldFlush() (logging.handlers.BufferingHandler method): MemoryHandler.\n(line   36)\n* shouldFlush() (logging.handlers.MemoryHandler method): MemoryHandler.\n(line   72)\n* shouldStop (unittest.TestResult attribute): Loading and running tests.\n(line  279)\n* showcode() (in module dis):           Analysis functions. (line   26)\n* showflagvalues() (in module enum):   Utilities and Decorators.\n(line  101)\n* show() (curses.panel.Panel method):    Panel Objects.      (line   49)\n* show() (tkinter.commondialog.Dialog method): tkinter commondialog -- Dialog window templates.\n(line   16)\n* show() (tkinter.messagebox.Message method): tkinter messagebox -- Tkinter message prompts.\n(line   82)\n* showerror() (in module tkinter.messagebox): tkinter messagebox -- Tkinter message prompts.\n(line  105)\n* showinfo() (in module tkinter.messagebox): tkinter messagebox -- Tkinter message prompts.\n(line   91)\n* showsyntaxerror() (code.InteractiveInterpreter method): Interactive Interpreter Objects.\n(line   44)\n* showtraceback() (code.InteractiveInterpreter method): Interactive Interpreter Objects.\n(line   53)\n* showturtle() (in module turtle):       Visibility.         (line   15)\n* showwarning() (in module tkinter.messagebox): tkinter messagebox -- Tkinter message prompts.\n(line   99)\n* showwarning() (in module warnings):    Available Functions.\n(line   86)\n* shuffle() (in module random):          Functions for sequences.\n(line   54)\n* shutdownasyncgens() (asyncio.loop method): Running and stopping the loop.\n(line   56)\n* shutdowndefaultexecutor() (asyncio.loop method): Running and stopping the loop.\n(line   77)\n* shutdown() (concurrent.futures.Executor method): Executor Objects.\n(line   53)\n* shutdown() (imaplib.IMAP4 method):     IMAP4 Objects.      (line  268)\n* shutdown() (in module logging):        Module-Level Functions.\n(line  310)\n* shutdown() (multiprocessing.managers.BaseManager method): Managers.\n(line   84)\n* shutdown() (socket.socket method):     Socket Objects.     (line  589)\n* shutdown() (socketserver.BaseServer method): Server Objects<2>.\n(line   54)\n* SI (in module curses.ascii):           curses ascii -- Utilities for ASCII characters.\n(line   70)\n* sideeffect (unittest.mock.Mock attribute): The Mock Class.\n(line  348)\n* SIGBLOCK (in module signal):          Module contents<2>. (line  231)\n* SIGDFL (in module signal):            Module contents<2>. (line   45)\n* SIGIGN (in module signal):            Module contents<2>. (line   53)\n* SIGSETMASK (in module signal):        Module contents<2>. (line  246)\n* SIGUNBLOCK (in module signal):        Module contents<2>. (line  238)\n* SIGABRT (in module signal):            Module contents<2>. (line   58)\n* SIGALRM (in module signal):            Module contents<2>. (line   62)\n* SIGBREAK (in module signal):           Module contents<2>. (line   68)\n* SIGBUS (in module signal):             Module contents<2>. (line   74)\n* SIGCHLD (in module signal):            Module contents<2>. (line   80)\n* SIGCLD (in module signal):             Module contents<2>. (line   86)\n* SIGCONT (in module signal):            Module contents<2>. (line   92)\n* SIGFPE (in module signal):             Module contents<2>. (line   98)\n* SIGHUP (in module signal):             Module contents<2>. (line  108)\n* SIGILL (in module signal):             Module contents<2>. (line  115)\n* SIGINT (C macro):                      Signal Handling<2>. (line    7)\n* SIGINT (C macro) <1>:                  Signal Handling<2>. (line   34)\n* SIGINT (in module signal):             Module contents<2>. (line  119)\n* siginterrupt() (in module signal):     Module contents<2>. (line  485)\n* SIGKILL (in module signal):            Module contents<2>. (line  125)\n* Sigmasks (class in signal):            Module contents<2>. (line   31)\n* signal() (in module signal):           Module contents<2>. (line  500)\n* Signals (class in signal):             Module contents<2>. (line   17)\n* Signature (class in inspect):          Introspecting callables with the Signature object.\n(line   74)\n* signature (inspect.BoundArguments attribute): Introspecting callables with the Signature object.\n(line  344)\n* signature() (in module inspect):       Introspecting callables with the Signature object.\n(line   12)\n* sigpending() (in module signal):       Module contents<2>. (line  528)\n* SIGPIPE (in module signal):            Module contents<2>. (line  133)\n* SIGSEGV (in module signal):            Module contents<2>. (line  141)\n* SIGSTKFLT (in module signal):          Module contents<2>. (line  145)\n* SIGTERM (in module signal):            Module contents<2>. (line  157)\n* sigtimedwait() (in module signal):     Module contents<2>. (line  589)\n* SIGUSR1 (in module signal):            Module contents<2>. (line  161)\n* SIGUSR2 (in module signal):            Module contents<2>. (line  167)\n* sigwait() (in module signal):          Module contents<2>. (line  543)\n* sigwaitinfo() (in module signal):      Module contents<2>. (line  560)\n* SIGWINCH (in module signal):           Module contents<2>. (line  173)\n* SIMPLE (inspect.BufferFlags attribute): Buffer flags.      (line   15)\n* Simple Mail Transfer Protocol:         smtplib -- SMTP protocol client.\n(line    8)\n* simple; statement:                     Simple statements.  (line    6)\n* SimpleCookie (class in http.cookies):  http cookies -- HTTP state management.\n(line   49)\n* simplefilter() (in module warnings):   Available Functions.\n(line  120)\n* SimpleHandler (class in wsgiref.handlers): wsgiref handlers - server/gateway base classes.\n(line   70)\n* SimpleHTTPRequestHandler (class in http.server): http server -- HTTP servers.\n(line  342)\n* SimpleNamespace (class in types):      Additional Utility Classes and Functions.\n(line    6)\n* SimpleQueue (class in multiprocessing): Pipes and Queues.  (line  204)\n* SimpleQueue (class in queue):          queue -- A synchronized queue class.\n(line   75)\n* SimpleXMLRPCRequestHandler (class in xmlrpc.server): xmlrpc server -- Basic XML-RPC servers.\n(line   64)\n* SimpleXMLRPCServer (class in xmlrpc.server): xmlrpc server -- Basic XML-RPC servers.\n(line   25)\n* sin() (in module cmath):               Trigonometric functions<2>.\n(line   27)\n* sin() (in module math):                Trigonometric functions.\n(line   65)\n* single dispatch:                       Glossary.           (line 1256)\n* SingleAddressHeader (class in email.headerregistry): email headerregistry Custom Header Objects.\n(line  217)\n* singledispatch() (in module functools): functools -- Higher-order functions and operations on callable objects.\n(line  424)\n* singledispatchmethod (class in functools): functools -- Higher-order functions and operations on callable objects.\n(line  580)\n* singleton; tuple:                      Immutable sequences.\n(line   29)\n* sinh() (in module cmath):              Hyperbolic functions<2>.\n(line   27)\n* sinh() (in module math):               Hyperbolic functions.\n(line   25)\n* SIOKEEPALIVEVALS (in module socket): Constants<8>.       (line  239)\n* SIOLOOPBACKFASTPATH (in module socket): Constants<8>.   (line  239)\n* SIORCVALL (in module socket):         Constants<8>.       (line  239)\n* site command line option; -user-base:  Command Line Interface<4>.\n(line   18)\n* site command line option; -user-site:  Command Line Interface<4>.\n(line   22)\n* sitemaps() (urllib.robotparser.RobotFileParser method): urllib robotparser -- Parser for robots txt.\n(line   71)\n* site-packages; directory:              site -- Site-specific configuration hook.\n(line   24)\n* sitecustomize:                         The Customization Modules.\n(line    6)\n* sitecustomize <1>:                     The Customization Modules.\n(line   19)\n* sixtofour (ipaddress.IPv6Address attribute): Address objects.\n(line  295)\n* size (multiprocessing.sharedmemory.SharedMemory attribute): multiprocessing sharedmemory -- Shared memory for direct access across processes.\n(line  102)\n* size (struct.Struct attribute):        Classes<3>.         (line   61)\n* size (tarfile.TarInfo attribute):      TarInfo Objects.    (line   65)\n* size (tracemalloc.Statistic attribute): Statistic.         (line   19)\n* size (tracemalloc.StatisticDiff attribute): StatisticDiff. (line   26)\n* size (tracemalloc.Trace attribute):    Trace.              (line   23)\n* sizediff (tracemalloc.StatisticDiff attribute): StatisticDiff.\n(line   32)\n* SIZEMAX (C macro):                    Integer Objects.    (line  218)\n* size() (ftplib.FTP method):            FTP objects.        (line  352)\n* size() (mmap.mmap method):             mmap -- Memory-mapped file support.\n(line  291)\n* Sized (class in collections.abc):      Collections Abstract Base Classes - Detailed Descriptions.\n(line   15)\n* Sized (class in typing):               Aliases to other ABCs in collections abc.\n(line   90)\n* sizeofdigit (sys.intinfo attribute): sys -- System-specific parameters and functions.\n(line 1108)\n* sizeof() (in module ctypes):           Utility functions.  (line  189)\n* SKIP (in module doctest):              Option Flags.       (line   92)\n* skipifbrokenmultiprocessingsynchronize() (in module test.support): test support -- Utilities for the Python test suite.\n(line  717)\n* skipunlessbindunixsocket() (in module test.support.sockethelper): test support sockethelper -- Utilities for socket tests.\n(line   59)\n* skipunlesssymlink() (in module test.support.oshelper): test support oshelper -- Utilities for os tests.\n(line  126)\n* skipunlessxattr() (in module test.support.oshelper): test support oshelper -- Utilities for os tests.\n(line  131)\n* skip() (chunk.Chunk method):           chunk -- Read IFF chunked data.\n(line  116)\n* skip() (in module unittest):           Skipping tests and expected failures.\n(line   85)\n* skipIf() (in module unittest):         Skipping tests and expected failures.\n(line   90)\n* skipinitialspace (csv.Dialect attribute): Dialects and Formatting Parameters.\n(line   68)\n* skipped (unittest.TestResult attribute): Loading and running tests.\n(line  254)\n* skippedEntity() (xml.sax.handler.ContentHandler method): ContentHandler Objects.\n(line  176)\n* SkipTest:                              Skipping tests and expected failures.\n(line  105)\n* skipTest() (unittest.TestCase method): Test cases.         (line   97)\n* skipUnless() (in module unittest):     Skipping tests and expected failures.\n(line   94)\n* SLASH (in module token):               token -- Constants used with Python parse trees.\n(line   94)\n* SLASHEQUAL (in module token):          token -- Constants used with Python parse trees.\n(line  182)\n* slave() (nntplib.NNTP method):         Methods<3>.         (line  303)\n* sleep() (in module asyncio):           Sleeping.           (line    6)\n* sleep() (in module time):              Functions<5>.       (line  243)\n* sleepingretry() (in module test.support): test support -- Utilities for the Python test suite.\n(line  219)\n* slice:                                 Slicings.           (line    6)\n* slice <1>:                             Glossary.           (line 1261)\n* slice (built-in class):                Built-in Functions. (line 1623)\n* Slice (class in ast):                  Subscripting.       (line   27)\n* slice; assignment:                     Mutable Sequence Types.\n(line   16)\n* slice; operation:                      Common Sequence Operations.\n(line   21)\n* slicing:                               Sequences.          (line   14)\n* slicing <1>:                           Mutable sequences.  (line    6)\n* slicing <2>:                           Slicings.           (line    6)\n* slicing; assignment:                   Assignment statements.\n(line  125)\n* slowcallbackduration (asyncio.loop attribute): Enabling debug mode.\n(line   21)\n* SMALLEST (in module test.support):     test support -- Utilities for the Python test suite.\n(line  190)\n* SMTP (class in smtplib):               smtplib -- SMTP protocol client.\n(line   22)\n* SMTP (in module email.policy):         email policy Policy Objects.\n(line  509)\n* SMTPSSL (class in smtplib):           smtplib -- SMTP protocol client.\n(line   76)\n* SMTP; protocol:                        smtplib -- SMTP protocol client.\n(line    8)\n* SMTPAuthenticationError:               smtplib -- SMTP protocol client.\n(line  179)\n* SMTPConnectError:                      smtplib -- SMTP protocol client.\n(line  164)\n* SMTPDataError:                         smtplib -- SMTP protocol client.\n(line  160)\n* SMTPException:                         smtplib -- SMTP protocol client.\n(line  125)\n* SMTPHandler (class in logging.handlers): SMTPHandler.      (line   10)\n* SMTPHeloError:                         smtplib -- SMTP protocol client.\n(line  169)\n* SMTPNotSupportedError:                 smtplib -- SMTP protocol client.\n(line  173)\n* SMTPRecipientsRefused:                 smtplib -- SMTP protocol client.\n(line  153)\n* SMTPResponseException:                 smtplib -- SMTP protocol client.\n(line  139)\n* SMTPSenderRefused:                     smtplib -- SMTP protocol client.\n(line  147)\n* SMTPServerDisconnected:                smtplib -- SMTP protocol client.\n(line  133)\n* SMTPUTF8 (in module email.policy):     email policy Policy Objects.\n(line  515)\n* Snapshot (class in tracemalloc):       Snapshot.           (line    6)\n* SNDALIAS (in module winsound):        winsound -- Sound-playing interface for Windows.\n(line   47)\n* SNDASYNC (in module winsound):        winsound -- Sound-playing interface for Windows.\n(line  109)\n* SNDFILENAME (in module winsound):     winsound -- Sound-playing interface for Windows.\n(line   42)\n* SNDLOOP (in module winsound):         winsound -- Sound-playing interface for Windows.\n(line   88)\n* SNDMEMORY (in module winsound):       winsound -- Sound-playing interface for Windows.\n(line   94)\n* SNDNODEFAULT (in module winsound):    winsound -- Sound-playing interface for Windows.\n(line  113)\n* SNDNOSTOP (in module winsound):       winsound -- Sound-playing interface for Windows.\n(line  118)\n* SNDNOWAIT (in module winsound):       winsound -- Sound-playing interface for Windows.\n(line  122)\n* SNDPURGE (in module winsound):        winsound -- Sound-playing interface for Windows.\n(line  103)\n* snicallback (ssl.SSLContext attribute): SSL Contexts.     (line  275)\n* sniff() (csv.Sniffer method):          Module Contents<3>. (line  229)\n* Sniffer (class in csv):                Module Contents<3>. (line  222)\n* SO (in module curses.ascii):           curses ascii -- Utilities for ASCII characters.\n(line   67)\n* SOINCOMINGCPU (in module socket):    Constants<8>.       (line  328)\n* sockaccept() (asyncio.loop method):   Working with socket objects directly.\n(line  107)\n* SOCKCLOEXEC (in module socket):       Constants<8>.       (line   38)\n* sockconnect() (asyncio.loop method):  Working with socket objects directly.\n(line   88)\n* SOCKDGRAM (in module socket):         Constants<8>.       (line   27)\n* SOCKMAXSIZE (in module test.support): test support -- Utilities for the Python test suite.\n(line  123)\n* SOCKNONBLOCK (in module socket):      Constants<8>.       (line   38)\n* SOCKRAW (in module socket):           Constants<8>.       (line   27)\n* SOCKRDM (in module socket):           Constants<8>.       (line   27)\n* sockrecvinto() (asyncio.loop method): Working with socket objects directly.\n(line   26)\n* sockrecv() (asyncio.loop method):     Working with socket objects directly.\n(line   12)\n* sockrecvfrominto() (asyncio.loop method): Working with socket objects directly.\n(line   48)\n* sockrecvfrom() (asyncio.loop method): Working with socket objects directly.\n(line   37)\n* socksendall() (asyncio.loop method):  Working with socket objects directly.\n(line   59)\n* socksendfile() (asyncio.loop method): Working with socket objects directly.\n(line  130)\n* socksendto() (asyncio.loop method):   Working with socket objects directly.\n(line   77)\n* SOCKSEQPACKET (in module socket):     Constants<8>.       (line   27)\n* SOCKSTREAM (in module socket):        Constants<8>.       (line   27)\n* socket (class in socket):              Creating sockets.   (line    8)\n* socket (socketserver.BaseServer attribute): Server Objects<2>.\n(line   85)\n* sockettype (socketserver.BaseServer attribute): Server Objects<2>.\n(line  108)\n* socket() (imaplib.IMAP4 method):       IMAP4 Objects.      (line  274)\n* socket() (in module socket):           select -- Waiting for I/O completion.\n(line  144)\n* SocketHandler (class in logging.handlers): SocketHandler.  (line   10)\n* socketpair() (in module socket):       Creating sockets.   (line   64)\n* sockets (asyncio.Server attribute):    Server Objects.     (line  103)\n* SocketType (in module socket):         Creating sockets.   (line  185)\n* soft keyword:                          Soft Keywords.      (line    6)\n* SOFTKEYWORD (in module token):        token -- Constants used with Python parse trees.\n(line  256)\n* softkwlist (in module keyword):        keyword -- Testing for Python keywords.\n(line   30)\n* SOH (in module curses.ascii):          curses ascii -- Utilities for ASCII characters.\n(line   22)\n* SOLALG (in module socket):            Constants<8>.       (line  255)\n* SOLRDS (in module socket):            Constants<8>.       (line  226)\n* SOMAXCONN (in module socket):          Constants<8>.       (line   54)\n* sortstats() (pstats.Stats method):    The Stats Class.    (line   67)\n* sort() (imaplib.IMAP4 method):         IMAP4 Objects.      (line  278)\n* sort() (list method):                  Lists<2>.           (line   39)\n* sortdict() (in module test.support):   test support -- Utilities for the Python test suite.\n(line  267)\n* sortTestMethodsUsing (unittest.TestLoader attribute): Loading and running tests.\n(line  190)\n* source (doctest.Example attribute):    Example Objects.    (line   17)\n* source (pdb command):                  Debugger Commands.  (line  275)\n* source (shlex.shlex attribute):        shlex Objects.      (line  151)\n* source character set:                  Encoding declarations.\n(line    6)\n* SOURCEDATEEPOCH:                     pycompile<3>.      (line    7)\n* SOURCEDATEEPOCH <1>:                 Library<46>.        (line  452)\n* SOURCEDATEEPOCH <2>:                 Build<49>.          (line   15)\n* SOURCEDATEEPOCH <3>:                 pycompile -- Compile Python source files.\n(line   66)\n* SOURCEDATEEPOCH <4>:                 pycompile -- Compile Python source files.\n(line   82)\n* SOURCEDATEEPOCH <5>:                 pycompile -- Compile Python source files.\n(line   86)\n* SOURCEDATEEPOCH <6>:                 Command-line use.   (line   90)\n* sourcefromcache() (in module importlib.util): importlib util - Utility code for importers.\n(line   58)\n* sourcehash() (in module importlib.util): importlib util - Utility code for importers.\n(line  160)\n* SOURCESUFFIXES (in module importlib.machinery): importlib machinery - Importers and path hooks.\n(line   13)\n* sourcetocode() (importlib.abc.InspectLoader static method): importlib abc - Abstract base classes related to import.\n(line  271)\n* SourceFileLoader (class in importlib.machinery): importlib machinery - Importers and path hooks.\n(line  204)\n* sourcehook() (shlex.shlex method):     shlex Objects.      (line   26)\n* SourcelessFileLoader (class in importlib.machinery): importlib machinery - Importers and path hooks.\n(line  244)\n* SourceLoader (class in importlib.abc): importlib abc - Abstract base classes related to import.\n(line  356)\n* SP (in module curses.ascii):           curses ascii -- Utilities for ASCII characters.\n(line  121)\n* space:                                 Indentation.        (line    6)\n* space; in printf-style formatting:     printf-style String Formatting.\n(line   66)\n* space; in printf-style formatting <1>: printf-style Bytes Formatting.\n(line   63)\n* space; in string formatting:           Format Specification Mini-Language.\n(line   71)\n* span() (re.Match method):              Match Objects.      (line  172)\n* sparse (tarfile.TarInfo attribute):    TarInfo Objects.    (line  157)\n* spawnpython() (in module test.support.scripthelper): test support scripthelper -- Utilities for the Python execution tests.\n(line   69)\n* spawn() (in module pty):               pty -- Pseudo-terminal utilities.\n(line   42)\n* spawnl() (in module os):               Process Management. (line  580)\n* spawnle() (in module os):              Process Management. (line  580)\n* spawnlp() (in module os):              Process Management. (line  580)\n* spawnlpe() (in module os):             Process Management. (line  580)\n* spawnv() (in module os):               Process Management. (line  580)\n* spawnve() (in module os):              Process Management. (line  580)\n* spawnvp() (in module os):              Process Management. (line  580)\n* spawnvpe() (in module os):             Process Management. (line  580)\n* specfromfilelocation() (in module importlib.util): importlib util - Utility code for importers.\n(line  148)\n* specfromloader() (in module importlib.util): importlib util - Utility code for importers.\n(line  137)\n* special method:                        Glossary.           (line 1269)\n* special; attribute:                    The standard type hierarchy.\n(line   13)\n* special; method:                       Glossary.           (line 1273)\n* SpecialFileError:                      tarfile -- Read and write tar archive files.\n(line  248)\n* specifiedattributes (xml.parsers.expat.xmlparser attribute): XMLParser Objects<2>.\n(line  155)\n* speed() (in module turtle):            Turtle motion.      (line  328)\n* speed() (ossaudiodev.ossaudiodevice method): Audio Device Objects.\n(line  140)\n* Spinbox (class in tkinter.ttk):        ttk Spinbox.        (line    6)\n* SPLICEFMORE (in module os):          File Descriptor Operations.\n(line  816)\n* SPLICEFMOVE (in module os):          File Descriptor Operations.\n(line  816)\n* SPLICEFNONBLOCK (in module os):      File Descriptor Operations.\n(line  816)\n* splice() (in module os):               File Descriptor Operations.\n(line  788)\n* split() (BaseExceptionGroup method):   Exception groups.   (line   66)\n* split() (bytearray method):            Bytes and Bytearray Operations.\n(line  398)\n* split() (bytes method):                Bytes and Bytearray Operations.\n(line  398)\n* split() (in module os.path):           os path -- Common pathname manipulations.\n(line  436)\n* split() (in module re):                Functions<2>.       (line   68)\n* split() (in module shlex):             shlex -- Simple lexical analysis.\n(line   17)\n* split() (re.Pattern method):           Regular Expression Objects.\n(line   80)\n* split() (str method):                  String Methods<2>.  (line  461)\n* splitdrive() (in module os.path):      os path -- Common pathname manipulations.\n(line  451)\n* splitext() (in module os.path):        os path -- Common pathname manipulations.\n(line  506)\n* splitlines() (bytearray method):       Bytes and Bytearray Operations.\n(line  640)\n* splitlines() (bytes method):           Bytes and Bytearray Operations.\n(line  640)\n* splitlines() (str method):             String Methods<2>.  (line  501)\n* SplitResult (class in urllib.parse):   Structured Parse Results.\n(line   55)\n* SplitResultBytes (class in urllib.parse): Structured Parse Results.\n(line   82)\n* splitroot() (in module os.path):       os path -- Common pathname manipulations.\n(line  475)\n* SpooledTemporaryFile (class in tempfile): tempfile -- Generate temporary files and directories.\n(line  152)\n* sprintf-style formatting:              printf-style String Formatting.\n(line    6)\n* sprintf-style formatting <1>:          printf-style Bytes Formatting.\n(line    6)\n* SQLITEDBCONFIGDEFENSIVE (in module sqlite3): Module constants.\n(line  142)\n* SQLITEDBCONFIGDQSDDL (in module sqlite3): Module constants.\n(line  142)\n* SQLITEDBCONFIGDQSDML (in module sqlite3): Module constants.\n(line  142)\n* SQLITEDBCONFIGENABLEFKEY (in module sqlite3): Module constants.\n(line  142)\n* SQLITEDBCONFIGENABLEFTS3TOKENIZER (in module sqlite3): Module constants.\n(line  142)\n* SQLITEDBCONFIGENABLELOADEXTENSION (in module sqlite3): Module constants.\n(line  142)\n* SQLITEDBCONFIGENABLEQPSG (in module sqlite3): Module constants.\n(line  142)\n* SQLITEDBCONFIGENABLETRIGGER (in module sqlite3): Module constants.\n(line  142)\n* SQLITEDBCONFIGENABLEVIEW (in module sqlite3): Module constants.\n(line  142)\n* SQLITEDBCONFIGLEGACYALTERTABLE (in module sqlite3): Module constants.\n(line  142)\n* SQLITEDBCONFIGLEGACYFILEFORMAT (in module sqlite3): Module constants.\n(line  142)\n* SQLITEDBCONFIGNOCKPTONCLOSE (in module sqlite3): Module constants.\n(line  142)\n* SQLITEDBCONFIGRESETDATABASE (in module sqlite3): Module constants.\n(line  142)\n* SQLITEDBCONFIGTRIGGEREQP (in module sqlite3): Module constants.\n(line  142)\n* SQLITEDBCONFIGTRUSTEDSCHEMA (in module sqlite3): Module constants.\n(line  142)\n* SQLITEDBCONFIGWRITABLESCHEMA (in module sqlite3): Module constants.\n(line  142)\n* SQLITEDENY (in module sqlite3):       Module constants.   (line   44)\n* sqliteerrorcode (sqlite3.Error attribute): Exceptions<6>. (line   24)\n* sqliteerrorname (sqlite3.Error attribute): Exceptions<6>. (line   30)\n* SQLITEIGNORE (in module sqlite3):     Module constants.   (line   44)\n* SQLITEOK (in module sqlite3):         Module constants.   (line   44)\n* sqliteversion (in module sqlite3):    Module constants.   (line   73)\n* sqliteversioninfo (in module sqlite3): Module constants. (line   78)\n* sqrt() (decimal.Context method):       Context objects.    (line  517)\n* sqrt() (decimal.Decimal method):       Decimal objects.    (line  568)\n* sqrt() (in module cmath):              Power and logarithmic functions<2>.\n(line   22)\n* sqrt() (in module math):               Power and logarithmic functions.\n(line   90)\n* ssizeargfunc (C type):                 Slot Type typedefs. (line  126)\n* ssizeobjargproc (C type):              Slot Type typedefs. (line  130)\n* SSL:                                   ssl -- TLS/SSL wrapper for socket objects.\n(line    8)\n* sslversion (ftplib.FTPTLS attribute): FTPTLS objects.   (line   83)\n* SSLCertVerificationError:              Exceptions<14>.     (line   79)\n* SSLContext (class in ssl):             SSL Contexts.       (line   14)\n* SSLEOFError:                           Exceptions<14>.     (line   71)\n* SSLError:                              Exceptions<14>.     (line    6)\n* SSLErrorNumber (class in ssl):         Constants<9>.       (line  542)\n* SSLKEYLOGFILE:                         Context creation.   (line   34)\n* SSLKEYLOGFILE <1>:                     Context creation.   (line   68)\n* SSLObject (class in ssl):              Memory BIO Support<2>.\n(line   30)\n* sslobjectclass (ssl.SSLContext attribute): SSL Contexts.  (line  461)\n* SSLSession (class in ssl):             SSL session.        (line    8)\n* SSLSocket (class in ssl):              SSL Sockets.        (line    6)\n* sslsocketclass (ssl.SSLContext attribute): SSL Contexts.  (line  435)\n* SSLSyscallError:                       Exceptions<14>.     (line   62)\n* SSLv3 (ssl.TLSVersion attribute):      Constants<9>.       (line  564)\n* SSLWantReadError:                      Exceptions<14>.     (line   44)\n* SSLWantWriteError:                     Exceptions<14>.     (line   53)\n* SSLZeroReturnError:                    Exceptions<14>.     (line   35)\n* STATIME (in module stat):             stat -- Interpreting stat results.\n(line  163)\n* statime (os.statresult attribute):   Files and Directories.\n(line 1171)\n* statimens (os.statresult attribute): Files and Directories.\n(line 1188)\n* stbirthtime (os.statresult attribute): Files and Directories.\n(line 1214)\n* stbirthtimens (os.statresult attribute): Files and Directories.\n(line 1222)\n* stblksize (os.statresult attribute): Files and Directories.\n(line 1259)\n* stblocks (os.statresult attribute):  Files and Directories.\n(line 1254)\n* stcreator (os.statresult attribute): Files and Directories.\n(line 1295)\n* STCTIME (in module stat):             stat -- Interpreting stat results.\n(line  171)\n* stctime (os.statresult attribute):   Files and Directories.\n(line 1179)\n* stctimens (os.statresult attribute): Files and Directories.\n(line 1202)\n* STDEV (in module stat):               stat -- Interpreting stat results.\n(line  142)\n* stdev (os.statresult attribute):     Files and Directories.\n(line 1147)\n* stfileattributes (os.statresult attribute): Files and Directories.\n(line 1305)\n* stflags (os.statresult attribute):   Files and Directories.\n(line 1269)\n* stfstype (os.statresult attribute):  Files and Directories.\n(line 1284)\n* stgen (os.statresult attribute):     Files and Directories.\n(line 1277)\n* STGID (in module stat):               stat -- Interpreting stat results.\n(line  154)\n* stgid (os.statresult attribute):     Files and Directories.\n(line 1159)\n* STINO (in module stat):               stat -- Interpreting stat results.\n(line  138)\n* stino (os.statresult attribute):     Files and Directories.\n(line 1138)\n* STMODE (in module stat):              stat -- Interpreting stat results.\n(line  134)\n* stmode (os.statresult attribute):    Files and Directories.\n(line 1134)\n* STMTIME (in module stat):             stat -- Interpreting stat results.\n(line  167)\n* stmtime (os.statresult attribute):   Files and Directories.\n(line 1175)\n* stmtimens (os.statresult attribute): Files and Directories.\n(line 1195)\n* STNLINK (in module stat):             stat -- Interpreting stat results.\n(line  146)\n* stnlink (os.statresult attribute):   Files and Directories.\n(line 1151)\n* strdev (os.statresult attribute):    Files and Directories.\n(line 1265)\n* streparsetag (os.statresult attribute): Files and Directories.\n(line 1315)\n* strsize (os.statresult attribute):   Files and Directories.\n(line 1291)\n* STSIZE (in module stat):              stat -- Interpreting stat results.\n(line  158)\n* stsize (os.statresult attribute):    Files and Directories.\n(line 1163)\n* sttype (os.statresult attribute):    Files and Directories.\n(line 1299)\n* STUID (in module stat):               stat -- Interpreting stat results.\n(line  150)\n* stuid (os.statresult attribute):     Files and Directories.\n(line 1155)\n* st() (in module turtle):               Visibility.         (line   15)\n* stack (traceback.TracebackException attribute): TracebackException Objects.\n(line   70)\n* stack viewer:                          Debug menu Shell window only.\n(line   15)\n* stackeffect() (in module dis):        Analysis functions. (line  170)\n* stacksize() (in module thread):      thread -- Low-level threading API.\n(line  109)\n* stacksize() (in module threading):    threading -- Thread-based parallelism.\n(line  206)\n* stack; trace:                          Traceback objects.  (line    6)\n* stack() (in module inspect):           The interpreter stack.\n(line  171)\n* stackable; streams:                    codecs -- Codec registry and base classes.\n(line    8)\n* StackSummary (class in traceback):     StackSummary Objects.\n(line   10)\n* stamp() (in module turtle):            Turtle motion.      (line  272)\n* Standard C:                            String and Bytes literals.\n(line   75)\n* standard input:                        Complete Python programs.\n(line   25)\n* standardb64decode() (in module base64): base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line   87)\n* standardb64encode() (in module base64): base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line   82)\n* standard; output:                      Expression statements.\n(line   17)\n* standarderror (2to3 fixer):            Fixers.             (line  294)\n* standend() (curses.window method):     Window Objects.     (line  519)\n* standout() (curses.window method):     Window Objects.     (line  524)\n* STAR (in module token):                token -- Constants used with Python parse trees.\n(line   90)\n* STAREQUAL (in module token):           token -- Constants used with Python parse trees.\n(line  178)\n* starmapasync() (multiprocessing.pool.Pool method): Process Pools.\n(line  159)\n* starmap() (in module itertools):       Itertool Functions. (line  567)\n* starmap() (multiprocessing.pool.Pool method): Process Pools.\n(line  148)\n* Starred (class in ast):                Variables.          (line   43)\n* start (range attribute):               Ranges.             (line   61)\n* start (slice attribute):               Built-in Functions. (line 1631)\n* start (slice object attribute):        Slice objects.      (line   10)\n* start (slice object attribute) <1>:    Slicings.           (line   26)\n* start (UnicodeError attribute):        Concrete exceptions.\n(line  426)\n* startcolor() (in module curses):      Functions<6>.       (line  490)\n* startcomponent() (msilib.Directory method): Directory Objects.\n(line   20)\n* startnewthread() (in module thread): thread -- Low-level threading API.\n(line   32)\n* startns() (xml.etree.ElementTree.TreeBuilder method): TreeBuilder Objects.\n(line   76)\n* startserver() (in module asyncio):    Streams.            (line   76)\n* startserving() (asyncio.Server method): Server Objects.   (line   50)\n* startthreads() (in module test.support.threadinghelper): test support threadinghelper -- Utilities for threading tests.\n(line   22)\n* starttls() (asyncio.loop method):     TLS Upgrade.        (line    6)\n* starttls() (asyncio.StreamWriter method): StreamWriter.   (line   81)\n* startunixserver() (in module asyncio): Streams.          (line  144)\n* start() (in module tracemalloc):       Functions<11>.      (line   68)\n* start() (logging.handlers.QueueListener method): QueueListener.\n(line   75)\n* start() (multiprocessing.managers.BaseManager method): Managers.\n(line   57)\n* start() (multiprocessing.Process method): Process and exceptions.\n(line   58)\n* start() (re.Match method):             Match Objects.      (line  147)\n* start() (threading.Thread method):     Thread Objects.     (line   93)\n* start() (tkinter.ttk.Progressbar method): ttk Progressbar. (line    8)\n* start() (xml.etree.ElementTree.TreeBuilder method): TreeBuilder Objects.\n(line   43)\n* startCDATA() (xml.sax.handler.LexicalHandler method): LexicalHandler Objects.\n(line   32)\n* StartCdataSectionHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line  341)\n* StartDoctypeDeclHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line  224)\n* startDocument() (xml.sax.handler.ContentHandler method): ContentHandler Objects.\n(line   32)\n* startDTD() (xml.sax.handler.LexicalHandler method): LexicalHandler Objects.\n(line   23)\n* startElement() (xml.sax.handler.ContentHandler method): ContentHandler Objects.\n(line   82)\n* StartElementHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line  262)\n* startElementNS() (xml.sax.handler.ContentHandler method): ContentHandler Objects.\n(line  102)\n* STARTFUSESHOWWINDOW (in module subprocess): Windows Constants.\n(line   33)\n* STARTFUSESTDHANDLES (in module subprocess): Windows Constants.\n(line   27)\n* startfile() (in module os):            Process Management. (line  693)\n* StartNamespaceDeclHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line  320)\n* startPrefixMapping() (xml.sax.handler.ContentHandler method): ContentHandler Objects.\n(line   49)\n* StartResponse (class in wsgiref.types): wsgiref types - WSGI types for static type checking.\n(line   11)\n* startswith() (bytearray method):       Bytes and Bytearray Operations.\n(line  253)\n* startswith() (bytes method):           Bytes and Bytearray Operations.\n(line  253)\n* startswith() (str method):             String Methods<2>.  (line  574)\n* startTest() (unittest.TestResult method): Loading and running tests.\n(line  342)\n* startTestRun() (unittest.TestResult method): Loading and running tests.\n(line  351)\n* starttls() (imaplib.IMAP4 method):     IMAP4 Objects.      (line  296)\n* starttls() (nntplib.NNTP method):      Methods<3>.         (line   62)\n* starttls() (smtplib.SMTP method):      SMTP Objects.       (line  185)\n* STARTUPINFO (class in subprocess):     Windows Popen Helpers.\n(line    9)\n* statresult (class in os):             Files and Directories.\n(line 1126)\n* stat() (in module os):                 Files and Directories.\n(line 1071)\n* stat() (nntplib.NNTP method):          Methods<3>.         (line  219)\n* stat() (os.DirEntry method):           Files and Directories.\n(line 1036)\n* stat() (pathlib.Path method):          Methods<2>.         (line   37)\n* stat() (poplib.POP3 method):           POP3 Objects.       (line   52)\n* state() (tkinter.ttk.Widget method):   ttk Widget.         (line   25)\n* statement:                             Glossary.           (line 1276)\n* statement grouping:                    Indentation.        (line    6)\n* statement; assert:                     The assert statement.\n(line    6)\n* statement; assert <1>:                 Concrete exceptions.\n(line   10)\n* statement; assignment, annotated:      Annotated assignment statements.\n(line    6)\n* statement; assignment, augmented:      Augmented assignment statements.\n(line    6)\n* statement; async def:                  Coroutines<2>.      (line    8)\n* statement; async for:                  Coroutine function definition.\n(line   28)\n* statement; async with:                 The async for statement.\n(line   43)\n* statement; break:                      The break statement.\n(line    6)\n* statement; break <1>:                  The while statement.\n(line   17)\n* statement; break <2>:                  The for statement.  (line   21)\n* statement; break <3>:                  except* clause.     (line   55)\n* statement; break <4>:                  finally clause.     (line   29)\n* statement; class:                      Class definitions.  (line    6)\n* statement; continue:                   The continue statement.\n(line    6)\n* statement; continue <1>:               The while statement.\n(line   17)\n* statement; continue <2>:               The for statement.  (line   21)\n* statement; continue <3>:               except* clause.     (line   54)\n* statement; continue <4>:               finally clause.     (line   29)\n* statement; def:                        Function definitions.\n(line    6)\n* statement; del:                        Basic customization.\n(line   55)\n* statement; del <1>:                    The del statement<2>.\n(line    6)\n* statement; del <2>:                    Mutable Sequence Types.\n(line   16)\n* statement; del <3>:                    Mapping Types -- dict.\n(line    6)\n* statement; except:                     Built-in Exceptions.\n(line    6)\n* statement; for:                        for Statements.     (line    6)\n* statement; for <1>:                    The break statement.\n(line    6)\n* statement; for <2>:                    The continue statement.\n(line    6)\n* statement; for <3>:                    The for statement.  (line    6)\n* statement; global:                     The del statement<2>.\n(line   15)\n* statement; global <1>:                 The global statement.\n(line    6)\n* statement; if:                         The if statement.   (line    6)\n* statement; if <1>:                     Truth Value Testing.\n(line    6)\n* statement; import:                     Modules<3>.         (line    6)\n* statement; import <1>:                 The import statement.\n(line    6)\n* statement; import <2>:                 Built-in Functions. (line 2006)\n* statement; import <3>:                 site -- Site-specific configuration hook.\n(line   45)\n* statement; match:                      The match statement.\n(line    6)\n* statement; nonlocal:                   The nonlocal statement.\n(line    6)\n* statement; pass:                       The pass statement. (line    6)\n* statement; raise:                      The raise statement.\n(line    6)\n* statement; raise <1>:                  Built-in Exceptions.\n(line   14)\n* statement; return:                     The return statement.\n(line    6)\n* statement; return <1>:                 except* clause.     (line   55)\n* statement; return <2>:                 finally clause.     (line   29)\n* statement; try:                        Traceback objects.  (line   31)\n* statement; try <1>:                    The try statement.  (line    6)\n* statement; try <2>:                    Built-in Exceptions.\n(line    6)\n* statement; type:                       The type statement. (line    6)\n* statement; while:                      The break statement.\n(line    6)\n* statement; while <1>:                  The continue statement.\n(line    6)\n* statement; while <2>:                  The while statement.\n(line    6)\n* statement; while <3>:                  Truth Value Testing.\n(line    6)\n* statement; with:                       With Statement Context Managers.\n(line   14)\n* statement; with <1>:                   The with statement. (line    6)\n* statement; yield:                      The yield statement.\n(line    6)\n* static type checker:                   Glossary.           (line 1283)\n* staticorder() (graphlib.TopologicalSorter method): graphlib -- Functionality to operate with graph-like structures.\n(line  162)\n* Statistic (class in tracemalloc):      Statistic.          (line    6)\n* StatisticDiff (class in tracemalloc):  StatisticDiff.      (line    6)\n* statistics() (tracemalloc.Snapshot method): Snapshot.      (line   56)\n* StatisticsError:                       Exceptions<5>.      (line    8)\n* Stats (class in pstats):               The Stats Class.    (line    9)\n* status (http.client.HTTPResponse attribute): HTTPResponse Objects.\n(line   61)\n* status (urllib.response.addinfourl attribute): urllib response -- Response classes used by urllib.\n(line   24)\n* status() (imaplib.IMAP4 method):       IMAP4 Objects.      (line  309)\n* statvfs() (in module os):              Files and Directories.\n(line 1367)\n* STDERRORHANDLE (in module subprocess): Windows Constants.\n(line   18)\n* STDINPUTHANDLE (in module subprocess): Windows Constants.\n(line    8)\n* STDOUTPUTHANDLE (in module subprocess): Windows Constants.\n(line   13)\n* StdButtonBox (class in tkinter.tix):   Basic Widgets.      (line   65)\n* stderr (asyncio.subprocess.Process attribute): Interacting with Subprocesses.\n(line  126)\n* stderr (in module sys):                I/O objects also known as file objects.\n(line    6)\n* stderr (in module sys) <1>:            sys -- System-specific parameters and functions.\n(line 1742)\n* stderr (in module sys) <2>:            Sub-interpreter support.\n(line  112)\n* stderr (in module sys) <3>:            Sub-interpreter support.\n(line  193)\n* stderr (subprocess.CalledProcessError attribute): Using the subprocess Module.\n(line  229)\n* stderr (subprocess.CompletedProcess attribute): Using the subprocess Module.\n(line  128)\n* stderr (subprocess.Popen attribute):   Popen Objects.      (line  127)\n* stderr (subprocess.TimeoutExpired attribute): Using the subprocess Module.\n(line  193)\n* stdev (statistics.NormalDist attribute): NormalDist objects.\n(line   35)\n* stdev() (in module statistics):        Function details.   (line  355)\n* stdin (asyncio.subprocess.Process attribute): Interacting with Subprocesses.\n(line  116)\n* stdin (in module sys):                 I/O objects also known as file objects.\n(line    6)\n* stdin (in module sys) <1>:             sys -- System-specific parameters and functions.\n(line 1742)\n* stdin (in module sys) <2>:             Sub-interpreter support.\n(line  112)\n* stdin (in module sys) <3>:             Sub-interpreter support.\n(line  193)\n* stdin (subprocess.Popen attribute):    Popen Objects.      (line  108)\n* stdin; stdout; sdterr:                 Process-wide parameters.\n(line    9)\n* stdio:                                 I/O objects also known as file objects.\n(line    6)\n* stdlibmodulenames (in module sys):   sys -- System-specific parameters and functions.\n(line 1832)\n* stdout (asyncio.subprocess.Process attribute): Interacting with Subprocesses.\n(line  121)\n* STDOUT (in module subprocess):         Using the subprocess Module.\n(line  156)\n* stdout (in module sys):                I/O objects also known as file objects.\n(line    6)\n* stdout (in module sys) <1>:            sys -- System-specific parameters and functions.\n(line 1742)\n* stdout (in module sys) <2>:            Sub-interpreter support.\n(line  112)\n* stdout (in module sys) <3>:            Sub-interpreter support.\n(line  193)\n* stdout (subprocess.CalledProcessError attribute): Using the subprocess Module.\n(line  225)\n* stdout (subprocess.CompletedProcess attribute): Using the subprocess Module.\n(line  118)\n* stdout (subprocess.Popen attribute):   Popen Objects.      (line  117)\n* stdout (subprocess.TimeoutExpired attribute): Using the subprocess Module.\n(line  189)\n* stem (pathlib.PurePath attribute):     Methods and properties.\n(line  152)\n* step (pdb command):                    Debugger Commands.  (line  186)\n* step (range attribute):                Ranges.             (line   70)\n* step (slice attribute):                Built-in Functions. (line 1635)\n* step (slice object attribute):         Slice objects.      (line   10)\n* step (slice object attribute) <1>:     Slicings.           (line   26)\n* step() (tkinter.ttk.Progressbar method): ttk Progressbar.  (line   15)\n* stereocontrols() (ossaudiodev.ossmixerdevice method): Mixer Device Objects.\n(line   44)\n* stls() (poplib.POP3 method):           POP3 Objects.       (line  114)\n* stop (range attribute):                Ranges.             (line   66)\n* stop (slice attribute):                Built-in Functions. (line 1633)\n* stop (slice object attribute):         Slice objects.      (line   10)\n* stop (slice object attribute) <1>:     Slicings.           (line   26)\n* stophere() (bdb.Bdb method):          bdb -- Debugger framework.\n(line  249)\n* STOPITERATION (monitoring event):     Events.             (line   81)\n* stop() (asyncio.loop method):          Running and stopping the loop.\n(line   31)\n* stop() (in module tracemalloc):        Functions<11>.      (line   98)\n* stop() (logging.handlers.QueueListener method): QueueListener.\n(line   82)\n* stop() (tkinter.ttk.Progressbar method): ttk Progressbar.  (line   21)\n* stop() (unittest.TestResult method):   Loading and running tests.\n(line  322)\n* StopAsyncIteration:                    Concrete exceptions.\n(line  270)\n* StopIteration:                         Concrete exceptions.\n(line  238)\n* stopListening() (in module logging.config): Configuration functions.\n(line  174)\n* stopTest() (unittest.TestResult method): Loading and running tests.\n(line  346)\n* stopTestRun() (unittest.TestResult method): Loading and running tests.\n(line  357)\n* storbinary() (ftplib.FTP method):      FTP objects.        (line  218)\n* Store (class in ast):                  Variables.          (line   11)\n* STOREACTIONS (optparse.Option attribute): Adding new actions.\n(line   35)\n* STOREATTR (opcode):                   Python Bytecode Instructions.\n(line  540)\n* STOREDEREF (opcode):                  Python Bytecode Instructions.\n(line  910)\n* STOREFAST (opcode):                   Python Bytecode Instructions.\n(line  864)\n* STOREGLOBAL (opcode):                 Python Bytecode Instructions.\n(line  561)\n* STORENAME (opcode):                   Python Bytecode Instructions.\n(line  498)\n* STORESLICE (opcode):                  Python Bytecode Instructions.\n(line  229)\n* STORESUBSCR (opcode):                 Python Bytecode Instructions.\n(line  201)\n* store() (imaplib.IMAP4 method):        IMAP4 Objects.      (line  313)\n* storlines() (ftplib.FTP method):       FTP objects.        (line  247)\n* str (built-in class):                  Text Sequence Type -- str.\n(line   45)\n* str (built-in class); (see also string): Ranges.           (line  126)\n* strdigitscheckthreshold (sys.intinfo attribute): sys -- System-specific parameters and functions.\n(line 1117)\n* str() (in module locale):              locale -- Internationalization services.\n(line  487)\n* strcoll() (in module locale):          locale -- Internationalization services.\n(line  440)\n* StreamError:                           tarfile -- Read and write tar archive files.\n(line  214)\n* StreamHandler (class in logging):      StreamHandler.      (line   11)\n* StreamReader (class in asyncio):       StreamReader.       (line    6)\n* StreamReader (class in codecs):        StreamReader Objects.\n(line   10)\n* streamreader (codecs.CodecInfo attribute): codecs -- Codec registry and base classes.\n(line   87)\n* StreamReaderWriter (class in codecs):  StreamReaderWriter Objects.\n(line   12)\n* StreamRecoder (class in codecs):       StreamRecoder Objects.\n(line   13)\n* StreamRequestHandler (class in socketserver): Request Handler Objects.\n(line   56)\n* streams:                               codecs -- Codec registry and base classes.\n(line    8)\n* StreamWriter (class in asyncio):       StreamWriter.       (line    6)\n* StreamWriter (class in codecs):        StreamWriter Objects.\n(line   10)\n* streamwriter (codecs.CodecInfo attribute): codecs -- Codec registry and base classes.\n(line   87)\n* StrEnum (class in enum):               Data Types<2>.      (line  367)\n* strerror (C function):                 Raising exceptions. (line   59)\n* strerror (OSError attribute):          Concrete exceptions.\n(line  178)\n* strerror() (in module os):             Process Parameters. (line  530)\n* strftime() (datetime.date method):     date Objects.       (line  282)\n* strftime() (datetime.datetime method): datetime Objects.   (line  729)\n* strftime() (datetime.time method):     time Objects.       (line  219)\n* strftime() (in module time):           Functions<5>.       (line  281)\n* strict (csv.Dialect attribute):        Dialects and Formatting Parameters.\n(line   73)\n* STRICT (enum.FlagBoundary attribute):  Data Types<2>.      (line  627)\n* strict (in module email.policy):       email policy Policy Objects.\n(line  530)\n* strictdomain (http.cookiejar.DefaultCookiePolicy attribute): DefaultCookiePolicy Objects.\n(line   95)\n* stricterrors() (in module codecs):    Error Handlers.     (line  141)\n* strictnsdomain (http.cookiejar.DefaultCookiePolicy attribute): DefaultCookiePolicy Objects.\n(line  117)\n* strictnssetinitialdollar (http.cookiejar.DefaultCookiePolicy attribute): DefaultCookiePolicy Objects.\n(line  122)\n* strictnssetpath (http.cookiejar.DefaultCookiePolicy attribute): DefaultCookiePolicy Objects.\n(line  127)\n* strictnsunverifiable (http.cookiejar.DefaultCookiePolicy attribute): DefaultCookiePolicy Objects.\n(line  112)\n* strictrfc2965unverifiable (http.cookiejar.DefaultCookiePolicy attribute): DefaultCookiePolicy Objects.\n(line  103)\n* strict; error handler's name:          Error Handlers.     (line   15)\n* STRIDED (inspect.BufferFlags attribute): Buffer flags.     (line   37)\n* STRIDEDRO (inspect.BufferFlags attribute): Buffer flags.  (line   39)\n* STRIDES (inspect.BufferFlags attribute): Buffer flags.     (line   23)\n* strides (memoryview attribute):        Memory Views.       (line  459)\n* STRING (in module token):              token -- Constants used with Python parse trees.\n(line   46)\n* string (re.Match attribute):           Match Objects.      (line  211)\n* string literal:                        Literals.           (line    8)\n* stringat() (in module ctypes):        Utility functions.  (line  194)\n* string; format() (object method):  Basic customization.\n(line  149)\n* string; str() (object method):     Basic customization.\n(line  128)\n* string; conversion:                    Basic customization.\n(line  149)\n* string; conversion <1>:                Expression statements.\n(line   17)\n* string; format() (built-in function):  Built-in Functions. (line  702)\n* string; formatted literal:             String literal concatenation.\n(line   24)\n* string; formatting, printf:            printf-style String Formatting.\n(line    6)\n* string; immutable sequences:           Immutable sequences.\n(line   13)\n* string; interpolated literal:          String literal concatenation.\n(line   24)\n* string; interpolation, printf:         printf-style String Formatting.\n(line    6)\n* string; item:                          Subscriptions.      (line   55)\n* string; methods:                       Text Sequence Type -- str.\n(line   85)\n* string; object representation:         Finalization and De-allocation.\n(line   91)\n* string; PyObjectStr (C function):     Object Protocol.    (line  220)\n* string; str (built-in class):          Text Sequence Type -- str.\n(line   45)\n* string; str() (built-in function):     Built-in Functions. (line 1729)\n* string; text sequence type:            Ranges.             (line  126)\n* StringIO (class in io):                Text I/O<2>.        (line  239)\n* strings, documentation:                Defining Functions. (line   21)\n* strings, documentation <1>:            Documentation Strings.\n(line    6)\n* stripdirs() (pstats.Stats method):    The Stats Class.    (line   34)\n* strip() (bytearray method):            Bytes and Bytearray Operations.\n(line  443)\n* strip() (bytes method):                Bytes and Bytearray Operations.\n(line  443)\n* strip() (str method):                  String Methods<2>.  (line  581)\n* stripspaces (curses.textpad.Textbox attribute): Textbox objects.\n(line  115)\n* strong reference:                      Glossary.           (line 1289)\n* strptime() (datetime.datetime class method): datetime Objects.\n(line  251)\n* strptime() (in module time):           Functions<5>.       (line  424)\n* strsignal() (in module signal):        Module contents<2>. (line  295)\n* Struct (class in struct):              Classes<3>.         (line    8)\n* structtime (class in time):           Functions<5>.       (line  458)\n* structmember.h:                        Member types.       (line   85)\n* Structure (class in ctypes):           Structured data types.\n(line   33)\n* strxfrm() (in module locale):          locale -- Internationalization services.\n(line  447)\n* STX (in module curses.ascii):          curses ascii -- Utilities for ASCII characters.\n(line   25)\n* Style (class in tkinter.ttk):          Ttk Styling.        (line   20)\n* Sub (class in ast):                    Expressions<2>.     (line   54)\n* SUB (in module curses.ascii):          curses ascii -- Utilities for ASCII characters.\n(line  103)\n* sub() (in module operator):            operator -- Standard operators as functions.\n(line  157)\n* sub() (in module re):                  Functions<2>.       (line  143)\n* sub() (re.Pattern method):             Regular Expression Objects.\n(line   97)\n* subclassing; immutable types:          Basic customization.\n(line    8)\n* subdirs (filecmp.dircmp attribute):    The dircmp class.   (line  100)\n* SubElement() (in module xml.etree.ElementTree): Functions<9>.\n(line  206)\n* subgroup() (BaseExceptionGroup method): Exception groups.  (line   43)\n* submit() (concurrent.futures.Executor method): Executor Objects.\n(line   12)\n* submodulesearchlocations (importlib.machinery.ModuleSpec attribute): importlib machinery - Importers and path hooks.\n(line  405)\n* subn() (in module re):                 Functions<2>.       (line  212)\n* subn() (re.Pattern method):            Regular Expression Objects.\n(line  102)\n* subnetof() (ipaddress.IPv4Network method): Network objects.\n(line  215)\n* subnetof() (ipaddress.IPv6Network method): Network objects.\n(line  348)\n* subnets() (ipaddress.IPv4Network method): Network objects. (line  173)\n* subnets() (ipaddress.IPv6Network method): Network objects. (line  344)\n* Subnormal (class in decimal):          Signals.            (line   86)\n* suboffsets (memoryview attribute):     Memory Views.       (line  468)\n* subpad() (curses.window method):       Window Objects.     (line  528)\n* subprocessexec() (asyncio.loop method): Running Subprocesses.\n(line   16)\n* subprocessshell() (asyncio.loop method): Running Subprocesses.\n(line  115)\n* SubprocessError:                       Using the subprocess Module.\n(line  162)\n* SubprocessProtocol (class in asyncio): Base Protocols.     (line   24)\n* SubprocessTransport (class in asyncio): Transports Hierarchy.\n(line   50)\n* subscribe() (imaplib.IMAP4 method):    IMAP4 Objects.      (line  337)\n* Subscript (class in ast):              Subscripting.       (line    6)\n* subscript; assignment:                 Mutable Sequence Types.\n(line   16)\n* subscript; operation:                  Common Sequence Operations.\n(line   21)\n* subscription:                          Sequences.          (line    6)\n* subscription <1>:                      Mutable sequences.  (line    6)\n* subscription <2>:                      Mappings.           (line    6)\n* subscription <3>:                      Subscriptions.      (line    6)\n* subscription; assignment:              Assignment statements.\n(line  101)\n* subsequentindent (textwrap.TextWrapper attribute): textwrap -- Text wrapping and filling.\n(line  216)\n* substitute() (string.Template method): Template strings.   (line   40)\n* subTest() (unittest.TestCase method):  Test cases.         (line  105)\n* subtract() (collections.Counter method): Counter objects.  (line   89)\n* subtract() (decimal.Context method):   Context objects.    (line  521)\n* subtraction:                           Binary arithmetic operations.\n(line   78)\n* subtype (email.headerregistry.ContentTypeHeader attribute): email headerregistry Custom Header Objects.\n(line  278)\n* subwin() (curses.window method):       Window Objects.     (line  535)\n* successful() (multiprocessing.pool.AsyncResult method): Process Pools.\n(line  213)\n* suffix (pathlib.PurePath attribute):   Methods and properties.\n(line  130)\n* suffixmap (in module mimetypes):      mimetypes -- Map filenames to MIME types.\n(line  128)\n* suffixmap (mimetypes.MimeTypes attribute): MimeTypes Objects.\n(line   23)\n* suffixes (pathlib.PurePath attribute): Methods and properties.\n(line  141)\n* suite:                                 Compound statements.\n(line   18)\n* suiteClass (unittest.TestLoader attribute): Loading and running tests.\n(line  196)\n* sumlist():                            Reference Count Details.\n(line  143)\n* sumsequence():                        Reference Count Details.\n(line  170)\n* sumsequence() <1>:                    Exceptions<21>.     (line   65)\n* summarizeaddressrange() (in module ipaddress): Other Module Level Functions.\n(line   27)\n* summarize() (doctest.DocTestRunner method): DocTestRunner objects.\n(line  116)\n* sumprod() (in module math):            Number-theoretic and representation functions.\n(line  265)\n* SUNDAY (in module calendar):           calendar -- General calendar-related functions.\n(line  379)\n* super (built-in class):                Built-in Functions. (line 1759)\n* super (pyclbr.Class attribute):        Class Objects<2>.   (line   41)\n* supernetof() (ipaddress.IPv4Network method): Network objects.\n(line  226)\n* supernetof() (ipaddress.IPv6Network method): Network objects.\n(line  350)\n* supernet() (ipaddress.IPv4Network method): Network objects.\n(line  199)\n* supernet() (ipaddress.IPv6Network method): Network objects.\n(line  346)\n* supportsbytesenviron (in module os): Process Parameters. (line  536)\n* supportsdirfd (in module os):        Files and Directories.\n(line 1410)\n* supportseffectiveids (in module os): Files and Directories.\n(line 1435)\n* supportsfd (in module os):            Files and Directories.\n(line 1454)\n* supportsfollowsymlinks (in module os): Files and Directories.\n(line 1473)\n* supportsunicodefilenames (in module os.path): os path -- Common pathname manipulations.\n(line  536)\n* SupportsAbs (class in typing):         Protocols<3>.       (line    9)\n* SupportsBytes (class in typing):       Protocols<3>.       (line   14)\n* SupportsComplex (class in typing):     Protocols<3>.       (line   18)\n* SupportsFloat (class in typing):       Protocols<3>.       (line   22)\n* SupportsIndex (class in typing):       Protocols<3>.       (line   26)\n* SupportsInt (class in typing):         Protocols<3>.       (line   32)\n* SupportsRound (class in typing):       Protocols<3>.       (line   36)\n* suppress() (in module contextlib):     Utilities.          (line  269)\n* SuppressCrashReport (class in test.support): test support -- Utilities for the Python test suite.\n(line  745)\n* surrogateescape; error handler's name: Error Handlers.     (line   15)\n* surrogatepass; error handler's name:   Error Handlers.     (line   73)\n* SWHIDE (in module subprocess):        Windows Constants.  (line   23)\n* SWAP (opcode):                         Python Bytecode Instructions.\n(line  118)\n* swapattr() (in module test.support):  test support -- Utilities for the Python test suite.\n(line  369)\n* swapitem() (in module test.support):  test support -- Utilities for the Python test suite.\n(line  386)\n* swapcase() (bytearray method):         Bytes and Bytearray Operations.\n(line  664)\n* swapcase() (bytes method):             Bytes and Bytearray Operations.\n(line  664)\n* swapcase() (str method):               String Methods<2>.  (line  605)\n* Symbol (class in symtable):            Examining Symbol Tables.\n(line  112)\n* SymbolTable (class in symtable):       Examining Symbol Tables.\n(line    6)\n* symlinkto() (pathlib.Path method):    Methods<2>.         (line  580)\n* symlink() (in module os):              Files and Directories.\n(line 1496)\n* symmetricdifferenceupdate() (frozenset method): Set Types -- set frozenset.\n(line  188)\n* symmetricdifference() (frozenset method): Set Types -- set frozenset.\n(line  116)\n* symtable() (in module symtable):       Generating Symbol Tables.\n(line    6)\n* SYMTYPE (in module tarfile):           tarfile -- Read and write tar archive files.\n(line  287)\n* SYN (in module curses.ascii):          curses ascii -- Utilities for ASCII characters.\n(line   91)\n* sync() (dbm.dumb.dumbdbm method):      dbm dumb -- Portable DBM implementation.\n(line   79)\n* sync() (dbm.gnu.gdbm method):          dbm gnu -- GNU database manager.\n(line  108)\n* sync() (in module os):                 Files and Directories.\n(line 1541)\n* sync() (ossaudiodev.ossaudiodevice method): Audio Device Objects.\n(line  165)\n* sync() (shelve.Shelf method):          shelve -- Python object persistence.\n(line   69)\n* syncdown() (curses.window method):     Window Objects.     (line  545)\n* synchronized() (in module multiprocessing.sharedctypes): The multiprocessing sharedctypes module.\n(line   88)\n* SyncManager (class in multiprocessing.managers): Managers. (line  150)\n* syncok() (curses.window method):       Window Objects.     (line  551)\n* syncup() (curses.window method):       Window Objects.     (line  556)\n* syntax:                                Notation.           (line    6)\n* SyntaxErr:                             Exceptions<18>.     (line   93)\n* SyntaxError:                           Concrete exceptions.\n(line  277)\n* SyntaxWarning:                         Warnings.           (line   43)\n* sysexc (2to3 fixer):                  Fixers.             (line  298)\n* sysversion (http.server.BaseHTTPRequestHandler attribute): http server -- HTTP servers.\n(line  143)\n* sys.excinfo:                          Traceback objects.  (line    6)\n* sys.exception:                         Traceback objects.  (line    6)\n* sys.lasttraceback:                    Traceback objects.  (line    6)\n* sys.metapath:                         The meta path.      (line    6)\n* sys.modules:                           The module cache.   (line    6)\n* sys.path:                              Path entry finders. (line    6)\n* sys.pathhooks:                        Path entry finders. (line    6)\n* sys.pathimportercache:               Path entry finders. (line    6)\n* sys.stderr:                            I/O objects also known as file objects.\n(line    6)\n* sys.stdin:                             I/O objects also known as file objects.\n(line    6)\n* sys.stdout:                            I/O objects also known as file objects.\n(line    6)\n* sysconfnames (in module os):          Miscellaneous System Information.\n(line   67)\n* sysconf() (in module os):              Miscellaneous System Information.\n(line   57)\n* syslog() (in module syslog):           syslog -- Unix syslog library routines.\n(line   20)\n* SysLogHandler (class in logging.handlers): SysLogHandler.  (line   10)\n* systemalias() (in module platform):   Cross Platform.     (line  125)\n* systemmustvalidatecert() (in module test.support): test support -- Utilities for the Python test suite.\n(line  457)\n* system() (in module os):               Process Management. (line  748)\n* system() (in module platform):         Cross Platform.     (line  119)\n* SystemError:                           Concrete exceptions.\n(line  339)\n* SystemError (built-in exception):      Module Objects.     (line   62)\n* SystemError (built-in exception) <1>:  Module Objects.     (line   90)\n* SystemExit:                            Concrete exceptions.\n(line  353)\n* SystemExit (built-in exception):       Exceptions<2>.      (line   26)\n* systemId (xml.dom.DocumentType attribute): DocumentType Objects.\n(line   22)\n* SystemRandom (class in random):        Alternative Generator.\n(line   46)\n* SystemRandom (class in secrets):       Random numbers.     (line    9)\n* SystemRoot:                            Popen Constructor.  (line  308)\n* TBOOL (C macro):                      Member types.       (line   85)\n* TBYTE (C macro):                      Member types.       (line   85)\n* TCHAR (C macro):                      Member types.       (line   85)\n* TDOUBLE (C macro):                    Member types.       (line   85)\n* TFLOAT (C macro):                     Member types.       (line   85)\n* TFMT (in module locale):              locale -- Internationalization services.\n(line  201)\n* TFMTAMPM (in module locale):         locale -- Internationalization services.\n(line  207)\n* TINT (C macro):                       Member types.       (line   85)\n* TLONG (C macro):                      Member types.       (line   85)\n* TLONGLONG (C macro):                  Member types.       (line   85)\n* TNONE (C macro):                      Member types.       (line   96)\n* TOBJECT (C macro):                    Member types.       (line   90)\n* TOBJECTEX (C macro):                 Member types.       (line   85)\n* TPYSSIZET (C macro):                  Member types.       (line   85)\n* TSHORT (C macro):                     Member types.       (line   85)\n* TSTRING (C macro):                    Member types.       (line   85)\n* TSTRINGINPLACE (C macro):            Member types.       (line   85)\n* TUBYTE (C macro):                     Member types.       (line   85)\n* TUINT (C macro):                      Member types.       (line   85)\n* TULONG (C macro):                     Member types.       (line   85)\n* TULONGULONG (C macro):                Member types.       (line   85)\n* TUSHORT (C macro):                    Member types.       (line   85)\n* tab:                                   Indentation.        (line    6)\n* TAB (in module curses.ascii):          curses ascii -- Utilities for ASCII characters.\n(line   46)\n* tab() (tkinter.ttk.Notebook method):   ttk Notebook.       (line   62)\n* TabError:                              Concrete exceptions.\n(line  334)\n* tabs() (tkinter.ttk.Notebook method):  ttk Notebook.       (line   71)\n* tabsize (textwrap.TextWrapper attribute): textwrap -- Text wrapping and filling.\n(line  173)\n* tag (xml.etree.ElementTree.Element attribute): Element Objects.\n(line   16)\n* tagbind() (tkinter.ttk.Treeview method): ttk Treeview.    (line  293)\n* tagconfigure() (tkinter.ttk.Treeview method): ttk Treeview.\n(line  299)\n* taghas() (tkinter.ttk.Treeview method): ttk Treeview.     (line  309)\n* tagName (xml.dom.Element attribute):   Element Objects<2>. (line    9)\n* tail (xml.etree.ElementTree.Element attribute): Element Objects.\n(line   21)\n* takesnapshot() (in module tracemalloc): Functions<11>.    (line  110)\n* takewhile() (in module itertools):     Itertool Functions. (line  583)\n* tan() (in module cmath):               Trigonometric functions<2>.\n(line   31)\n* tan() (in module math):                Trigonometric functions.\n(line   69)\n* tanh() (in module cmath):              Hyperbolic functions<2>.\n(line   31)\n* tanh() (in module math):               Hyperbolic functions.\n(line   29)\n* tarfilter() (in module tarfile):      Default named filters.\n(line   15)\n* TarError:                              tarfile -- Read and write tar archive files.\n(line  200)\n* TarFile (class in tarfile):            TarFile Objects.    (line   22)\n* tarfile command line option; -c:       Command-line options<2>.\n(line   11)\n* tarfile command line option; -create:  Command-line options<2>.\n(line   11)\n* tarfile command line option; -e:       Command-line options<2>.\n(line   16)\n* tarfile command line option; -extract: Command-line options<2>.\n(line   16)\n* tarfile command line option; -filter:  Command-line options<2>.\n(line   31)\n* tarfile command line option; -l:       Command-line options<2>.\n(line    6)\n* tarfile command line option; -list:    Command-line options<2>.\n(line    6)\n* tarfile command line option; -t:       Command-line options<2>.\n(line   22)\n* tarfile command line option; -test:    Command-line options<2>.\n(line   22)\n* tarfile command line option; -v:       Command-line options<2>.\n(line   27)\n* tarfile command line option; -verbose: Command-line options<2>.\n(line   27)\n* target:                                Assignment statements.\n(line   27)\n* target (xml.dom.ProcessingInstruction attribute): ProcessingInstruction Objects.\n(line    9)\n* target; list:                          Assignment statements.\n(line   27)\n* target; list <1>:                      The for statement.  (line    6)\n* target; list; assignment:              Assignment statements.\n(line   35)\n* TarInfo (class in tarfile):            TarInfo Objects.    (line   33)\n* tarinfo (tarfile.FilterError attribute): tarfile -- Read and write tar archive files.\n(line  234)\n* Task (class in asyncio):               Task Object.        (line    6)\n* taskdone() (asyncio.Queue method):    Queue.              (line   77)\n* taskdone() (multiprocessing.JoinableQueue method): Pipes and Queues.\n(line  237)\n* taskdone() (queue.Queue method):      Queue Objects.      (line   68)\n* TaskGroup (class in asyncio):          Task Groups.        (line    9)\n* tau (in module cmath):                 Constants<3>.       (line   14)\n* tau (in module math):                  Constants<2>.       (line   14)\n* tbframe (traceback attribute):        Traceback objects.  (line   31)\n* tbframe (traceback attribute) <1>:    Traceback objects.  (line   33)\n* tblasti (traceback attribute):        Traceback objects.  (line   31)\n* tblasti (traceback attribute) <1>:    Traceback objects.  (line   44)\n* tblineno (traceback attribute):       Traceback objects.  (line   31)\n* tblineno (traceback attribute) <1>:   Traceback objects.  (line   41)\n* tblocals (unittest.TestResult attribute): Loading and running tests.\n(line  306)\n* tbnext (traceback attribute):         Traceback objects.  (line   52)\n* tbnext (traceback attribute) <1>:     Traceback objects.  (line   52)\n* tbreak (pdb command):                  Debugger Commands.  (line  111)\n* tcdrain() (in module termios):         termios -- POSIX style tty control.\n(line   65)\n* tcflow() (in module termios):          termios -- POSIX style tty control.\n(line   76)\n* tcflush() (in module termios):         termios -- POSIX style tty control.\n(line   70)\n* tcgetattr() (in module termios):       termios -- POSIX style tty control.\n(line   28)\n* tcgetpgrp() (in module os):            File Descriptor Operations.\n(line  839)\n* tcgetwinsize() (in module termios):    termios -- POSIX style tty control.\n(line   83)\n* Tcl() (in module tkinter):             Tkinter Modules.    (line   94)\n* TCPServer (class in socketserver):     socketserver -- A framework for network servers.\n(line   21)\n* TCSADRAIN (in module termios):         termios -- POSIX style tty control.\n(line   50)\n* TCSAFLUSH (in module termios):         termios -- POSIX style tty control.\n(line   54)\n* TCSANOW (in module termios):           termios -- POSIX style tty control.\n(line   46)\n* tcsendbreak() (in module termios):     termios -- POSIX style tty control.\n(line   59)\n* tcsetattr() (in module termios):       termios -- POSIX style tty control.\n(line   39)\n* tcsetpgrp() (in module os):            File Descriptor Operations.\n(line  846)\n* tcsetwinsize() (in module termios):    termios -- POSIX style tty control.\n(line   91)\n* tearDown() (unittest.TestCase method): Test cases.         (line   41)\n* tearDownClass() (unittest.TestCase method): Test cases.    (line   69)\n* tee() (in module itertools):           Itertool Functions. (line  603)\n* teleport() (in module turtle):         Turtle motion.      (line  104)\n* tell() (aifc.aifc method):             aifc -- Read and write AIFF and AIFC files.\n(line  115)\n* tell() (chunk.Chunk method):           chunk -- Read IFF chunked data.\n(line  104)\n* tell() (io.IOBase method):             I/O Base Classes.   (line  135)\n* tell() (io.TextIOBase method):         Text I/O<2>.        (line   88)\n* tell() (io.TextIOWrapper method):      Text I/O<2>.        (line  233)\n* tell() (mmap.mmap method):             mmap -- Memory-mapped file support.\n(line  296)\n* tell() (sqlite3.Blob method):          Blob objects.       (line   59)\n* tell() (sunau.AUread method):         AUread Objects.    (line   65)\n* tell() (sunau.AUwrite method):        AUwrite Objects.   (line   39)\n* tell() (wave.Waveread method):        Waveread Objects.  (line   79)\n* tell() (wave.Wavewrite method):       Wavewrite Objects. (line   70)\n* Telnet (class in telnetlib):           telnetlib -- Telnet client.\n(line   35)\n* TEMP:                                  Redirection of local data registry and temporary paths.\n(line    7)\n* TEMP <1>:                              tempfile -- Generate temporary files and directories.\n(line  329)\n* tempcwd() (in module test.support.oshelper): test support oshelper -- Utilities for os tests.\n(line  135)\n* tempdir() (in module test.support.oshelper): test support oshelper -- Utilities for os tests.\n(line  150)\n* tempumask() (in module test.support.oshelper): test support oshelper -- Utilities for os tests.\n(line  160)\n* tempdir (in module tempfile):          tempfile -- Generate temporary files and directories.\n(line  376)\n* Template (class in pipes):             pipes -- Interface to shell pipelines.\n(line   25)\n* Template (class in string):            Template strings.   (line   35)\n* template (string.Template attribute):  Template strings.   (line   85)\n* temporary (bdb.Breakpoint attribute):  bdb -- Debugger framework.\n(line   91)\n* temporary; file:                       tempfile -- Generate temporary files and directories.\n(line    8)\n* temporary; file name:                  tempfile -- Generate temporary files and directories.\n(line    8)\n* TemporaryDirectory (class in tempfile): tempfile -- Generate temporary files and directories.\n(line  184)\n* TemporaryFile() (in module tempfile):  tempfile -- Generate temporary files and directories.\n(line   28)\n* teredo (ipaddress.IPv6Address attribute): Address objects. (line  302)\n* TERM:                                  Functions<6>.       (line  485)\n* TERM <1>:                              Functions<6>.       (line  512)\n* termattrs() (in module curses):        Functions<6>.       (line  504)\n* terminalsize (class in os):           Querying the size of a terminal.\n(line   25)\n* terminate() (asyncio.subprocess.Process method): Interacting with Subprocesses.\n(line   96)\n* terminate() (asyncio.SubprocessTransport method): Subprocess Transports.\n(line   49)\n* terminate() (multiprocessing.pool.Pool method): Process Pools.\n(line  174)\n* terminate() (multiprocessing.Process method): Process and exceptions.\n(line  172)\n* terminate() (subprocess.Popen method): Popen Objects.      (line   86)\n* termination model:                     Exceptions<2>.      (line   20)\n* terminator (logging.StreamHandler attribute): StreamHandler.\n(line   47)\n* termname() (in module curses):         Functions<6>.       (line  510)\n* ternary; operator:                     Conditional expressions.\n(line    6)\n* ternaryfunc (C type):                  Slot Type typedefs. (line  122)\n* test (doctest.DocTestFailure attribute): Debugging.        (line  195)\n* test (doctest.UnexpectedException attribute): Debugging.   (line  216)\n* TESTDATADIR (in module test.support): test support -- Utilities for the Python test suite.\n(line  137)\n* TESTHOMEDIR (in module test.support): test support -- Utilities for the Python test suite.\n(line  133)\n* TESTHTTPURL (in module test.support): test support -- Utilities for the Python test suite.\n(line  171)\n* TESTSUPPORTDIR (in module test.support): test support -- Utilities for the Python test suite.\n(line  128)\n* test() (in module cgi):                Functions<14>.      (line   70)\n* TestCase (class in unittest):          Test cases.         (line    6)\n* TestFailed:                            test support -- Utilities for the Python test suite.\n(line   16)\n* testfile() (in module doctest):        Basic API.          (line   12)\n* TESTFN (in module test.support.oshelper): test support oshelper -- Utilities for os tests.\n(line   19)\n* TESTFNNONASCII (in module test.support.oshelper): test support oshelper -- Utilities for os tests.\n(line   25)\n* TESTFNUNDECODABLE (in module test.support.oshelper): test support oshelper -- Utilities for os tests.\n(line   39)\n* TESTFNUNENCODABLE (in module test.support.oshelper): test support oshelper -- Utilities for os tests.\n(line   33)\n* TESTFNUNICODE (in module test.support.oshelper): test support oshelper -- Utilities for os tests.\n(line   45)\n* TestLoader (class in unittest):        Loading and running tests.\n(line    6)\n* testMethodPrefix (unittest.TestLoader attribute): Loading and running tests.\n(line  182)\n* testmod() (in module doctest):         Basic API.          (line   90)\n* testNamePatterns (unittest.TestLoader attribute): Loading and running tests.\n(line  204)\n* TestResult (class in unittest):        Loading and running tests.\n(line  221)\n* tests (in module imghdr):              imghdr -- Determine the type of an image.\n(line   79)\n* tests (in module sndhdr):              sndhdr -- Determine type of sound file.\n(line   88)\n* testsource() (in module doctest):      Debugging.          (line  106)\n* testsRun (unittest.TestResult attribute): Loading and running tests.\n(line  284)\n* TestSuite (class in unittest):         Grouping tests.     (line    6)\n* testzip() (zipfile.ZipFile method):    ZipFile Objects.    (line  254)\n* Text (class in typing):                Aliases to other concrete types.\n(line   29)\n* text (in module msilib):               Precomputed tables. (line   23)\n* text (SyntaxError attribute):          Concrete exceptions.\n(line  304)\n* text (traceback.TracebackException attribute): TracebackException Objects.\n(line   93)\n* text (xml.etree.ElementTree.Element attribute): Element Objects.\n(line   21)\n* text encoding:                         Glossary.           (line 1304)\n* text file:                             Glossary.           (line 1317)\n* text mode:                             Built-in Functions. (line 1326)\n* textencoding() (in module io):        High-level Module Interface.\n(line   38)\n* textfactory (sqlite3.Connection attribute): Connection objects.\n(line  778)\n* text() (in module cgitb):              cgitb -- Traceback manager for CGI scripts.\n(line   51)\n* text() (msilib.Dialog method):         GUI classes.        (line   54)\n* Textbox (class in curses.textpad):     Textbox objects.    (line    8)\n* TextCalendar (class in calendar):      calendar -- General calendar-related functions.\n(line  128)\n* textdomain() (in module gettext):      GNU gettext API.    (line   26)\n* textdomain() (in module locale):       Access to message catalogs.\n(line   12)\n* textinput() (in module turtle):        Input methods.      (line    6)\n* TextIO (class in typing):              ABCs for working with IO.\n(line    6)\n* TextIOBase (class in io):              Text I/O<2>.        (line    6)\n* TextIOWrapper (class in io):           Text I/O<2>.        (line   99)\n* TextTestResult (class in unittest):    Loading and running tests.\n(line  441)\n* TextTestRunner (class in unittest):    Loading and running tests.\n(line  458)\n* TextWrapper (class in textwrap):       textwrap -- Text wrapping and filling.\n(line  140)\n* themecreate() (tkinter.ttk.Style method): Ttk Styling.    (line  196)\n* themenames() (tkinter.ttk.Style method): Ttk Styling.     (line  244)\n* themesettings() (tkinter.ttk.Style method): Ttk Styling.  (line  206)\n* themeuse() (tkinter.ttk.Style method): Ttk Styling.       (line  248)\n* THOUSEP (in module locale):            locale -- Internationalization services.\n(line  270)\n* Thread (class in threading):           Thread Objects.     (line   57)\n* threadinfo (in module sys):           sys -- System-specific parameters and functions.\n(line 1851)\n* threadtimens() (in module time):     Functions<5>.       (line  565)\n* threadtime() (in module time):        Functions<5>.       (line  547)\n* thread() (imaplib.IMAP4 method):       IMAP4 Objects.      (line  341)\n* ThreadedChildWatcher (class in asyncio): Process Watchers. (line   90)\n* threadingcleanup() (in module test.support.threadinghelper): test support threadinghelper -- Utilities for threading tests.\n(line   31)\n* threadingsetup() (in module test.support.threadinghelper): test support threadinghelper -- Utilities for threading tests.\n(line   37)\n* ThreadingHTTPServer (class in http.server): http server -- HTTP servers.\n(line   38)\n* ThreadingMixIn (class in socketserver): Server Creation Notes.\n(line   27)\n* ThreadingTCPServer (class in socketserver): Server Creation Notes.\n(line   67)\n* ThreadingUDPServer (class in socketserver): Server Creation Notes.\n(line   67)\n* ThreadingUnixDatagramServer (class in socketserver): Server Creation Notes.\n(line   67)\n* ThreadingUnixStreamServer (class in socketserver): Server Creation Notes.\n(line   67)\n* ThreadPool (class in multiprocessing.pool): The multiprocessing dummy module.\n(line   16)\n* ThreadPoolExecutor (class in concurrent.futures): ThreadPoolExecutor.\n(line   39)\n* threads; POSIX:                        thread -- Low-level threading API.\n(line   16)\n* threadsafety (in module sqlite3):      Module constants.   (line   83)\n* throw (2to3 fixer):                    Fixers.             (line  303)\n* throw() (coroutine method):            Coroutine Objects.  (line   33)\n* throw() (generator method):            Generator-iterator methods.\n(line   38)\n* THURSDAY (in module calendar):         calendar -- General calendar-related functions.\n(line  379)\n* ticketlifetimehint (ssl.SSLSession attribute): SSL session.\n(line   18)\n* tigetflag() (in module curses):        Functions<6>.       (line  515)\n* tigetnum() (in module curses):         Functions<6>.       (line  522)\n* tigetstr() (in module curses):         Functions<6>.       (line  529)\n* TILDE (in module token):               token -- Constants used with Python parse trees.\n(line  150)\n* tilt() (in module turtle):             Appearance.         (line  101)\n* tiltangle() (in module turtle):        Appearance.         (line  136)\n* time (class in datetime):              time Objects.       (line   10)\n* time (ssl.SSLSession attribute):       SSL session.        (line   14)\n* time (uuid.UUID attribute):            uuid -- UUID objects according to RFC 4122.\n(line  122)\n* timehiversion (uuid.UUID attribute): uuid -- UUID objects according to RFC 4122.\n(line  110)\n* timelow (uuid.UUID attribute):        uuid -- UUID objects according to RFC 4122.\n(line  104)\n* timemid (uuid.UUID attribute):        uuid -- UUID objects according to RFC 4122.\n(line  107)\n* timens() (in module time):            Functions<5>.       (line  540)\n* time() (asyncio.loop method):          Scheduling delayed callbacks.\n(line   56)\n* time() (datetime.datetime method):     datetime Objects.   (line  423)\n* time() (in module time):               Functions<5>.       (line  516)\n* Time2Internaldate() (in module imaplib): imaplib -- IMAP4 protocol client.\n(line  128)\n* timedelta (class in datetime):         timedelta Objects.  (line    9)\n* TimedRotatingFileHandler (class in logging.handlers): TimedRotatingFileHandler.\n(line   10)\n* timegm() (in module calendar):         calendar -- General calendar-related functions.\n(line  358)\n* timeit command line option; -h:        Command-Line Interface<4>.\n(line   44)\n* timeit command line option; -help:     Command-Line Interface<4>.\n(line   44)\n* timeit command line option; -n:        Command-Line Interface<4>.\n(line   13)\n* timeit command line option; -number:   Command-Line Interface<4>.\n(line   13)\n* timeit command line option; -p:        Command-Line Interface<4>.\n(line   25)\n* timeit command line option; -process:  Command-Line Interface<4>.\n(line   25)\n* timeit command line option; -r:        Command-Line Interface<4>.\n(line   17)\n* timeit command line option; -repeat:   Command-Line Interface<4>.\n(line   17)\n* timeit command line option; -s:        Command-Line Interface<4>.\n(line   21)\n* timeit command line option; -setup:    Command-Line Interface<4>.\n(line   21)\n* timeit command line option; -u:        Command-Line Interface<4>.\n(line   33)\n* timeit command line option; -unit:     Command-Line Interface<4>.\n(line   33)\n* timeit command line option; -v:        Command-Line Interface<4>.\n(line   40)\n* timeit command line option; -verbose:  Command-Line Interface<4>.\n(line   40)\n* timeit() (in module timeit):           Python Interface.   (line    8)\n* timeit() (timeit.Timer method):        Python Interface.   (line   71)\n* timeout:                               Exceptions<13>.     (line   40)\n* Timeout (class in asyncio):            Timeouts.           (line   50)\n* timeout (socketserver.BaseServer attribute): Server Objects<2>.\n(line  114)\n* timeout (ssl.SSLSession attribute):    SSL session.        (line   16)\n* timeout (subprocess.TimeoutExpired attribute): Using the subprocess Module.\n(line  177)\n* timeoutat() (in module asyncio):      Timeouts.           (line   98)\n* TIMEOUTMAX (in module thread):       thread -- Low-level threading API.\n(line  133)\n* TIMEOUTMAX (in module threading):     threading -- Thread-based parallelism.\n(line  232)\n* timeout() (curses.window method):      Window Objects.     (line  561)\n* timeout() (in module asyncio):         Timeouts.           (line    6)\n* TimeoutError:                          OS exceptions.      (line  112)\n* TimeoutError <1>:                      Process and exceptions.\n(line  244)\n* TimeoutError <2>:                      Exception classes.  (line   10)\n* TimeoutError <3>:                      Exceptions<11>.     (line   10)\n* TimeoutExpired:                        Using the subprocess Module.\n(line  168)\n* Timer (class in threading):            Timer Objects.      (line   25)\n* Timer (class in timeit):               Python Interface.   (line   41)\n* TimerHandle (class in asyncio):        Callback Handles.   (line   29)\n* times() (in module os):                Process Management. (line  784)\n* TIMESTAMP (pycompile.PycInvalidationMode attribute): pycompile -- Compile Python source files.\n(line  102)\n* timestamp() (datetime.datetime method): datetime Objects.  (line  575)\n* timetuple() (datetime.date method):    date Objects.       (line  192)\n* timetuple() (datetime.datetime method): datetime Objects.  (line  529)\n* timetz() (datetime.datetime method):   datetime Objects.   (line  432)\n* timezone (class in datetime):          timezone Objects.   (line   14)\n* timezone (in module time):             Timezone Constants. (line   17)\n* title() (bytearray method):            Bytes and Bytearray Operations.\n(line  689)\n* title() (bytes method):                Bytes and Bytearray Operations.\n(line  689)\n* title() (in module turtle):            Methods specific to Screen not inherited from TurtleScreen.\n(line   49)\n* title() (str method):                  String Methods<2>.  (line  611)\n* Tix:                                   tkinter tix -- Extension widgets for Tk.\n(line    8)\n* tixaddbitmapdir() (tkinter.tix.tixCommand method): Tix Commands.\n(line   47)\n* tixcget() (tkinter.tix.tixCommand method): Tix Commands.  (line   32)\n* tixconfigure() (tkinter.tix.tixCommand method): Tix Commands.\n(line   20)\n* tixfiledialog() (tkinter.tix.tixCommand method): Tix Commands.\n(line   57)\n* tixgetbitmap() (tkinter.tix.tixCommand method): Tix Commands.\n(line   37)\n* tixgetimage() (tkinter.tix.tixCommand method): Tix Commands.\n(line   68)\n* tixoptionget() (tkinter.tix.tixCommand method): Tix Commands.\n(line   82)\n* tixresetoptions() (tkinter.tix.tixCommand method): Tix Commands.\n(line   86)\n* tixCommand (class in tkinter.tix):     Tix Commands.       (line    6)\n* Tk:                                    Graphical User Interfaces with Tk.\n(line    6)\n* Tk (class in tkinter.tix):             Using Tix.          (line    6)\n* Tk (class in tkinter):                 Tkinter Modules.    (line   14)\n* tk (tkinter.Tk attribute):             Tkinter Modules.    (line   70)\n* Tk Option Data Types:                  Tk Option Data Types.\n(line    6)\n* Tkinter:                               Graphical User Interfaces with Tk.\n(line    6)\n* TList (class in tkinter.tix):          Tabular ListBox.    (line    6)\n* TLS:                                   ssl -- TLS/SSL wrapper for socket objects.\n(line    8)\n* TLSv1 (ssl.TLSVersion attribute):      Constants<9>.       (line  566)\n* TLSv11 (ssl.TLSVersion attribute):    Constants<9>.       (line  568)\n* TLSv12 (ssl.TLSVersion attribute):    Constants<9>.       (line  570)\n* TLSv13 (ssl.TLSVersion attribute):    Constants<9>.       (line  572)\n* TLSVersion (class in ssl):             Constants<9>.       (line  548)\n* tmday (time.structtime attribute):   Functions<5>.       (line  475)\n* tmgmtoff (time.structtime attribute): Functions<5>.      (line  501)\n* tmhour (time.structtime attribute):  Functions<5>.       (line  478)\n* tmisdst (time.structtime attribute): Functions<5>.       (line  495)\n* tmmin (time.structtime attribute):   Functions<5>.       (line  481)\n* tmmon (time.structtime attribute):   Functions<5>.       (line  472)\n* tmsec (time.structtime attribute):   Functions<5>.       (line  484)\n* tmwday (time.structtime attribute):  Functions<5>.       (line  489)\n* tmyday (time.structtime attribute):  Functions<5>.       (line  492)\n* tmyear (time.structtime attribute):  Functions<5>.       (line  469)\n* tmzone (time.structtime attribute):  Functions<5>.       (line  498)\n* TMP:                                   tempfile -- Generate temporary files and directories.\n(line  331)\n* TMPDIR:                                Tests<16>.          (line   68)\n* TMPDIR <1>:                            tempfile -- Generate temporary files and directories.\n(line  327)\n* tobytes() (int method):               Additional Methods on Integer Types.\n(line   56)\n* toengstring() (decimal.Context method): Context objects. (line  525)\n* toengstring() (decimal.Decimal method): Decimal objects. (line  572)\n* tointegralexact() (decimal.Context method): Context objects.\n(line  535)\n* tointegralexact() (decimal.Decimal method): Decimal objects.\n(line  591)\n* tointegralvalue() (decimal.Decimal method): Decimal objects.\n(line  599)\n* tointegral() (decimal.Decimal method): Decimal objects.   (line  585)\n* toscistring() (decimal.Context method): Context objects. (line  539)\n* tothread() (in module asyncio):       Running in Threads. (line    6)\n* ToASCII() (in module encodings.idna):  encodings idna -- Internationalized Domain Names in Applications.\n(line   55)\n* tobuf() (tarfile.TarInfo method):      TarInfo Objects.    (line   49)\n* tobytes() (array.array method):        array -- Efficient arrays of numeric values.\n(line  221)\n* tobytes() (memoryview method):         Memory Views.       (line  163)\n* today() (datetime.date class method):  date Objects.       (line   29)\n* today() (datetime.datetime class method): datetime Objects.\n(line   47)\n* tofile() (array.array method):         array -- Efficient arrays of numeric values.\n(line  230)\n* tokname (in module token):            token -- Constants used with Python parse trees.\n(line   20)\n* token:                                 Lexical analysis.   (line    6)\n* Token (class in contextvars):          Context Variables.  (line   75)\n* token (shlex.shlex attribute):         shlex Objects.      (line  173)\n* tokenbytes() (in module secrets):     Generating tokens.  (line   10)\n* tokenhex() (in module secrets):       Generating tokens.  (line   19)\n* tokenurlsafe() (in module secrets):   Generating tokens.  (line   28)\n* TokenError:                            Tokenizing Input.   (line  107)\n* tokenize command line option; -e:      Command-Line Usage<5>.\n(line   19)\n* tokenize command line option; -exact:  Command-Line Usage<5>.\n(line   19)\n* tokenize command line option; -h:      Command-Line Usage<5>.\n(line   15)\n* tokenize command line option; -help:   Command-Line Usage<5>.\n(line   15)\n* tokenize() (in module tokenize):       Tokenizing Input.   (line    8)\n* tolist() (array.array method):         array -- Efficient arrays of numeric values.\n(line  235)\n* tolist() (memoryview method):          Memory Views.       (line  204)\n* TOMLDecodeError:                       tomllib -- Parse TOML files.\n(line   60)\n* tomono() (in module audioop):          audioop -- Manipulate raw audio data.\n(line  203)\n* toordinal() (datetime.date method):    date Objects.       (line  207)\n* toordinal() (datetime.datetime method): datetime Objects.  (line  570)\n* toppanel() (in module curses.panel):  Functions<7>.       (line   19)\n* top() (curses.panel.Panel method):     Panel Objects.      (line   53)\n* top() (poplib.POP3 method):            POP3 Objects.       (line   87)\n* TopologicalSorter (class in graphlib): graphlib -- Functionality to operate with graph-like structures.\n(line   10)\n* toprettyxml() (xml.dom.minidom.Node method): DOM Objects.  (line   72)\n* toreadonly() (memoryview method):      Memory Views.       (line  220)\n* tostereo() (in module audioop):        audioop -- Manipulate raw audio data.\n(line  209)\n* tostring() (in module xml.etree.ElementTree): Functions<9>.\n(line  219)\n* tostringlist() (in module xml.etree.ElementTree): Functions<9>.\n(line  241)\n* totalchanges (sqlite3.Connection attribute): Connection objects.\n(line  788)\n* totalnframe (tracemalloc.Traceback attribute): Traceback. (line   28)\n* totalordering() (in module functools): functools -- Higher-order functions and operations on callable objects.\n(line  271)\n* totalseconds() (datetime.timedelta method): timedelta Objects.\n(line  222)\n* total() (collections.Counter method):  Counter objects.    (line  104)\n* touch() (pathlib.Path method):         Methods<2>.         (line  613)\n* touchline() (curses.window method):    Window Objects.     (line  571)\n* touchwin() (curses.window method):     Window Objects.     (line  578)\n* tounicode() (array.array method):      array -- Efficient arrays of numeric values.\n(line  239)\n* ToUnicode() (in module encodings.idna): encodings idna -- Internationalized Domain Names in Applications.\n(line   60)\n* towards() (in module turtle):          Tell Turtle's state.\n(line   15)\n* toxml() (xml.dom.minidom.Node method): DOM Objects.        (line   52)\n* tparm() (in module curses):            Functions<6>.       (line  536)\n* Trace (class in trace):                Programmatic Interface.\n(line    6)\n* Trace (class in tracemalloc):          Trace.              (line    6)\n* trace command line option; -c:         Main options.       (line   12)\n* trace command line option; -C:         Modifiers.          (line   11)\n* trace command line option; -count:     Main options.       (line   12)\n* trace command line option; -coverdir:  Modifiers.          (line   11)\n* trace command line option; -f:         Modifiers.          (line    6)\n* trace command line option; -file:      Modifiers.          (line    6)\n* trace command line option; -g:         Modifiers.          (line   33)\n* trace command line option; -help:      Command-Line Usage<3>.\n(line   15)\n* trace command line option; -ignore-dir: Filters.           (line   14)\n* trace command line option; -ignore-module: Filters.        (line    8)\n* trace command line option; -l:         Main options.       (line   23)\n* trace command line option; -listfuncs: Main options.       (line   23)\n* trace command line option; -m:         Modifiers.          (line   17)\n* trace command line option; -missing:   Modifiers.          (line   17)\n* trace command line option; -no-report: Modifiers.          (line   27)\n* trace command line option; -r:         Main options.       (line   27)\n* trace command line option; -R:         Modifiers.          (line   27)\n* trace command line option; -report:    Main options.       (line   27)\n* trace command line option; -s:         Modifiers.          (line   22)\n* trace command line option; -summary:   Modifiers.          (line   22)\n* trace command line option; -t:         Main options.       (line   19)\n* trace command line option; -T:         Main options.       (line   33)\n* trace command line option; -timing:    Modifiers.          (line   33)\n* trace command line option; -trace:     Main options.       (line   19)\n* trace command line option; -trackcalls: Main options.      (line   33)\n* trace command line option; -version:   Command-Line Usage<3>.\n(line   19)\n* trace function:                        threading -- Thread-based parallelism.\n(line  160)\n* trace function <1>:                    threading -- Thread-based parallelism.\n(line  178)\n* trace function <2>:                    sys -- System-specific parameters and functions.\n(line  902)\n* trace function <3>:                    sys -- System-specific parameters and functions.\n(line 1540)\n* tracedispatch() (bdb.Bdb method):     bdb -- Debugger framework.\n(line  165)\n* trace() (in module inspect):           The interpreter stack.\n(line  184)\n* Traceback (class in inspect):          The interpreter stack.\n(line   55)\n* Traceback (class in tracemalloc):      Traceback.          (line    6)\n* traceback (tracemalloc.Statistic attribute): Statistic.    (line   23)\n* traceback (tracemalloc.StatisticDiff attribute): StatisticDiff.\n(line   38)\n* traceback (tracemalloc.Trace attribute): Trace.            (line   27)\n* tracebacklimit (tracemalloc.Snapshot attribute): Snapshot.\n(line   83)\n* tracebacklimit (wsgiref.handlers.BaseHandler attribute): wsgiref handlers - server/gateway base classes.\n(line  222)\n* TracebackException (class in traceback): TracebackException Objects.\n(line   11)\n* tracebacklimit (in module sys):        sys -- System-specific parameters and functions.\n(line 1887)\n* tracebacks; in CGI scripts:            cgitb -- Traceback manager for CGI scripts.\n(line    8)\n* TracebackType (class in types):        Standard Interpreter Types.\n(line  230)\n* tracer() (in module turtle):           Animation control.  (line   23)\n* traces (tracemalloc.Snapshot attribute): Snapshot.         (line   89)\n* trailing; comma:                       Expression lists.   (line   24)\n* transfercmd() (ftplib.FTP method):     FTP objects.        (line  257)\n* transientinternet() (in module test.support.sockethelper): test support sockethelper -- Utilities for socket tests.\n(line   64)\n* translate() (bytearray method):        Bytes and Bytearray Operations.\n(line  265)\n* translate() (bytes method):            Bytes and Bytearray Operations.\n(line  265)\n* translate() (in module fnmatch):       fnmatch -- Unix filename pattern matching.\n(line   76)\n* translate() (str method):              String Methods<2>.  (line  645)\n* translation() (in module gettext):     Class-based API.    (line   44)\n* transport (asyncio.StreamWriter attribute): StreamWriter.  (line   57)\n* Transport (class in asyncio):          Transports Hierarchy.\n(line   29)\n* Transport Layer Security:              ssl -- TLS/SSL wrapper for socket objects.\n(line    8)\n* Traversable (class in importlib.abc):  importlib abc - Abstract base classes related to import.\n(line  537)\n* Traversable (class in importlib.resources.abc): importlib resources abc - Abstract base classes for resources.\n(line   86)\n* TraversableResources (class in importlib.abc): importlib abc - Abstract base classes related to import.\n(line  592)\n* TraversableResources (class in importlib.resources.abc): importlib resources abc - Abstract base classes for resources.\n(line  158)\n* traverseproc (C type):                 Supporting Cyclic Garbage Collection.\n(line  165)\n* Tree (class in tkinter.tix):           Hierarchical ListBox.\n(line   20)\n* TreeBuilder (class in xml.etree.ElementTree): TreeBuilder Objects.\n(line    6)\n* Treeview (class in tkinter.ttk):       ttk Treeview.       (line    6)\n* triangular() (in module random):       Real-valued distributions.\n(line   25)\n* triple-quoted string:                  String and Bytes literals.\n(line   36)\n* triple-quoted string <1>:              Glossary.           (line 1329)\n* True:                                  numbers Integral.   (line   27)\n* true:                                  Truth Value Testing.\n(line   10)\n* True <1>:                              Truth Value Testing.\n(line   23)\n* True <2>:                              Boolean Type - bool.\n(line    9)\n* True (built-in variable):              Built-in Constants. (line   13)\n* truediv() (in module operator):        operator -- Standard operators as functions.\n(line  162)\n* trunc() (in module math):              Numeric Types -- int float complex.\n(line  107)\n* trunc() (in module math) <1>:          Number-theoretic and representation functions.\n(line  282)\n* truncate() (in module os):             Files and Directories.\n(line 1549)\n* truncate() (io.IOBase method):         I/O Base Classes.   (line  139)\n* truth; value:                          Truth Value Testing.\n(line    6)\n* truth() (in module operator):          operator -- Standard operators as functions.\n(line   57)\n* Try (class in ast):                    Control flow.       (line  135)\n* TryStar (class in ast):                Control flow.       (line  179)\n* ttk:                                   tkinter ttk -- Tk themed widgets.\n(line    8)\n* tty; I/O control:                      termios -- POSIX style tty control.\n(line    6)\n* ttyname() (in module os):              File Descriptor Operations.\n(line  854)\n* TUESDAY (in module calendar):          calendar -- General calendar-related functions.\n(line  379)\n* tuple (built-in class):                Tuples.             (line   12)\n* Tuple (class in ast):                  Literals<3>.        (line   67)\n* Tuple (in module typing):              Aliases to built-in types.\n(line   63)\n* tupleparams (2to3 fixer):             Fixers.             (line  307)\n* Turtle (class in turtle):              Public classes.     (line   16)\n* turtles() (in module turtle):          Settings and special methods.\n(line   97)\n* TurtleScreen (class in turtle):        Public classes.     (line   22)\n* turtlesize() (in module turtle):       Appearance.         (line   52)\n* type:                                  The standard type hierarchy.\n(line    6)\n* type <1>:                              Glossary.           (line 1339)\n* type (built-in class):                 Built-in Functions. (line 1842)\n* Type (class in typing):                Aliases to built-in types.\n(line   74)\n* type (optparse.Option attribute):      Option attributes.  (line   27)\n* type (socket.socket attribute):        Socket Objects.     (line  622)\n* type (tarfile.TarInfo attribute):      TarInfo Objects.    (line   86)\n* type (urllib.request.Request attribute): Request Objects.  (line   21)\n* type alias:                            Glossary.           (line 1346)\n* type hint:                             Glossary.           (line 1368)\n* type of an object:                     Objects values and types.\n(line   11)\n* type parameters:                       Type parameter lists.\n(line    8)\n* typecheckonly() (in module typing):  Functions and decorators.\n(line  407)\n* TYPECHECKER (optparse.Option attribute): Adding new types.\n(line   16)\n* TYPECHECKING (in module typing):      Constant.           (line    6)\n* typecomment (ast.arg attribute):      Function and class definitions.\n(line   79)\n* typecomment (ast.Assign attribute):   Statements.         (line   15)\n* typecomment (ast.For attribute):      Control flow.       (line   55)\n* typecomment (ast.FunctionDef attribute): Function and class definitions.\n(line   25)\n* typecomment (ast.With attribute):     Control flow.       (line  248)\n* TYPECOMMENT (in module token):        token -- Constants used with Python parse trees.\n(line  254)\n* TYPEIGNORE (in module token):         token -- Constants used with Python parse trees.\n(line  252)\n* type; hierarchy:                       The standard type hierarchy.\n(line    6)\n* typeahead() (in module curses):        Functions<6>.       (line  544)\n* TypeAlias (class in ast):              Statements.         (line  169)\n* TypeAlias (in module typing):          Special types.      (line  193)\n* TypeAliasType (class in typing):       Building generic types and type aliases.\n(line  435)\n* typecode (array.array attribute):      array -- Efficient arrays of numeric values.\n(line  105)\n* typecodes (in module array):           array -- Efficient arrays of numeric values.\n(line   75)\n* TYPEDACTIONS (optparse.Option attribute): Adding new actions.\n(line   39)\n* typedsubpartiterator() (in module email.iterators): email iterators Iterators.\n(line   26)\n* TypedDict (class in typing):           Other special directives.\n(line  217)\n* TypeError:                             Concrete exceptions.\n(line  381)\n* TypeGuard (in module typing):          Special forms.      (line  365)\n* types (2to3 fixer):                    Fixers.             (line  312)\n* TYPES (optparse.Option attribute):     Adding new types.   (line   11)\n* typesmap (in module mimetypes):       mimetypes -- Map filenames to MIME types.\n(line  140)\n* typesmap (mimetypes.MimeTypes attribute): MimeTypes Objects.\n(line   39)\n* typesmapinv (mimetypes.MimeTypes attribute): MimeTypes Objects.\n(line   47)\n* types, internal:                       Internal types.     (line    6)\n* TypeVar (class in ast):                Type parameters.    (line    9)\n* TypeVar (class in typing):             Building generic types and type aliases.\n(line   54)\n* TypeVarTuple (class in ast):           Type parameters.    (line   57)\n* TypeVarTuple (class in typing):        Building generic types and type aliases.\n(line  197)\n* TZ:                                    Functions<5>.       (line  575)\n* TZ <1>:                                Functions<5>.       (line  576)\n* TZ <2>:                                Functions<5>.       (line  584)\n* TZ <3>:                                Functions<5>.       (line  589)\n* TZ <4>:                                Functions<5>.       (line  591)\n* TZ <5>:                                Functions<5>.       (line  651)\n* tzinfo (class in datetime):            tzinfo Objects.     (line    6)\n* tzinfo (datetime.datetime attribute):  datetime Objects.   (line  314)\n* tzinfo (datetime.time attribute):      time Objects.       (line   66)\n* tzname (in module time):               Timezone Constants. (line   23)\n* tzname() (datetime.datetime method):   datetime Objects.   (line  523)\n* tzname() (datetime.time method):       time Objects.       (line  253)\n* tzname() (datetime.timezone method):   timezone Objects.   (line   42)\n* tzname() (datetime.tzinfo method):     tzinfo Objects.     (line  123)\n* TZPATH (in module zoneinfo):           Globals.            (line    6)\n* tzset() (in module time):              Functions<5>.       (line  572)\n* U (in module re):                      Flags.              (line  117)\n* u-LAW:                                 aifc -- Read and write AIFF and AIFC files.\n(line  163)\n* u-LAW <1>:                             audioop -- Manipulate raw audio data.\n(line   20)\n* u-LAW <2>:                             sndhdr -- Determine type of sound file.\n(line    8)\n* u'; string literal:                    Literals.           (line    8)\n* u\"; string literal:                    Literals.           (line    8)\n* UAdd (class in ast):                   Expressions<2>.     (line   28)\n* ucd320 (in module unicodedata):     unicodedata -- Unicode Database.\n(line  131)\n* udata (select.kevent attribute):       Kevent Objects.     (line  179)\n* UDPServer (class in socketserver):     socketserver -- A framework for network servers.\n(line   31)\n* UFAPPEND (in module stat):            stat -- Interpreting stat results.\n(line  346)\n* UFCOMPRESSED (in module stat):        stat -- Interpreting stat results.\n(line  358)\n* UFHIDDEN (in module stat):            stat -- Interpreting stat results.\n(line  362)\n* UFIMMUTABLE (in module stat):         stat -- Interpreting stat results.\n(line  342)\n* UFNODUMP (in module stat):            stat -- Interpreting stat results.\n(line  338)\n* UFNOUNLINK (in module stat):          stat -- Interpreting stat results.\n(line  354)\n* UFOPAQUE (in module stat):            stat -- Interpreting stat results.\n(line  350)\n* UID (class in plistlib):               plistlib -- Generate and parse Apple plist files.\n(line  122)\n* uid (tarfile.TarInfo attribute):       TarInfo Objects.    (line  105)\n* uid() (imaplib.IMAP4 method):          IMAP4 Objects.      (line  364)\n* uidl() (poplib.POP3 method):           POP3 Objects.       (line   99)\n* ulaw2lin() (in module audioop):        audioop -- Manipulate raw audio data.\n(line  216)\n* ULONGMAX (C macro):                   Integer Objects.    (line  206)\n* ulp() (in module math):                Number-theoretic and representation functions.\n(line  291)\n* umask() (in module os):                Process Parameters. (line  543)\n* unalias (pdb command):                 Debugger Commands.  (line  374)\n* uname (tarfile.TarInfo attribute):     TarInfo Objects.    (line  121)\n* uname() (in module os):                Process Parameters. (line  550)\n* uname() (in module platform):          Cross Platform.     (line  136)\n* UNARYINVERT (opcode):                 Python Bytecode Instructions.\n(line  156)\n* UNARYNEGATIVE (opcode):               Python Bytecode Instructions.\n(line  148)\n* UNARYNOT (opcode):                    Python Bytecode Instructions.\n(line  152)\n* unary; arithmetic; operation:          Unary arithmetic and bitwise operations.\n(line    6)\n* unary; bitwise; operation:             Unary arithmetic and bitwise operations.\n(line    6)\n* unaryfunc (C type):                    Slot Type typedefs. (line  108)\n* UnaryOp (class in ast):                Expressions<2>.     (line   23)\n* unbinding; name:                       The del statement<2>.\n(line   15)\n* UnboundLocalError:                     Resolution of names.\n(line   16)\n* UnboundLocalError <1>:                 Concrete exceptions.\n(line  399)\n* unbuffered I/O:                        Built-in Functions. (line 1326)\n* UNC paths; and os.makedirs():          Files and Directories.\n(line  528)\n* uncancel() (asyncio.Task method):      Task Object.        (line  269)\n* UNCHECKEDHASH (pycompile.PycInvalidationMode attribute): pycompile -- Compile Python source files.\n(line  115)\n* unconsumedtail (zlib.Decompress attribute): zlib -- Compression compatible with gzip.\n(line  243)\n* unctrl() (in module curses.ascii):     curses ascii -- Utilities for ASCII characters.\n(line  229)\n* unctrl() (in module curses):           Functions<6>.       (line  556)\n* Underflow (class in decimal):          Signals.            (line   93)\n* undisplay (pdb command):               Debugger Commands.  (line  335)\n* undo() (in module turtle):             Turtle motion.      (line  317)\n* undobufferentries() (in module turtle): Special Turtle methods.\n(line   74)\n* undocheader (cmd.Cmd attribute):      Cmd Objects.        (line  166)\n* unescape() (in module html):           html -- HyperText Markup Language support.\n(line   23)\n* unescape() (in module xml.sax.saxutils): xml sax saxutils -- SAX Utilities.\n(line   28)\n* UnexpectedException:                   Debugging.          (line  208)\n* unexpectedSuccesses (unittest.TestResult attribute): Loading and running tests.\n(line  267)\n* unfreeze() (in module gc):             gc -- Garbage Collector interface.\n(line  223)\n* ungetwch() (in module curses):        Functions<6>.       (line  576)\n* ungetch() (in module curses):          Functions<6>.       (line  563)\n* ungetch() (in module msvcrt):          Console I/O.        (line   44)\n* ungetmouse() (in module curses):       Functions<6>.       (line  585)\n* ungetwch() (in module msvcrt):         Console I/O.        (line   50)\n* unhexlify() (in module binascii):      binascii -- Convert between binary and ASCII.\n(line  144)\n* Unicode:                               Immutable sequences.\n(line   15)\n* Unicode <1>:                           unicodedata -- Unicode Database.\n(line    6)\n* Unicode <2>:                           codecs -- Codec registry and base classes.\n(line    8)\n* unicode (2to3 fixer):                  Fixers.             (line  317)\n* UNICODE (in module re):                Flags.              (line  117)\n* Unicode Consortium:                    String and Bytes literals.\n(line   36)\n* Unicode; database:                     unicodedata -- Unicode Database.\n(line    6)\n* UnicodeDecodeError:                    Concrete exceptions.\n(line  439)\n* UnicodeEncodeError:                    Concrete exceptions.\n(line  434)\n* UnicodeError:                          Concrete exceptions.\n(line  405)\n* UnicodeTranslateError:                 Concrete exceptions.\n(line  444)\n* UnicodeWarning:                        Warnings.           (line   64)\n* unidataversion (in module unicodedata): unicodedata -- Unicode Database.\n(line  127)\n* unifieddiff() (in module difflib):    difflib -- Helpers for computing deltas.\n(line  292)\n* uniform() (in module random):          Real-valued distributions.\n(line   16)\n* UnimplementedFileMode:                 http client -- HTTP protocol client.\n(line  154)\n* Union (class in ctypes):               Structured data types.\n(line    6)\n* Union (in module typing):              Special forms.      (line    9)\n* union; type:                           Union Type.         (line    6)\n* union() (frozenset method):            Set Types -- set frozenset.\n(line   96)\n* UnionType (class in types):            Standard Interpreter Types.\n(line  224)\n* UNIQUE (enum.EnumCheck attribute):     Data Types<2>.      (line  569)\n* unique() (in module enum):             Utilities and Decorators.\n(line   52)\n* unittest command line option; -b:      Command-line options<3>.\n(line    8)\n* unittest command line option; -buffer: Command-line options<3>.\n(line    8)\n* unittest command line option; -c:      Command-line options<3>.\n(line   15)\n* unittest command line option; -catch:  Command-line options<3>.\n(line   15)\n* unittest command line option; -durations: Command-line options<3>.\n(line   49)\n* unittest command line option; -f:      Command-line options<3>.\n(line   24)\n* unittest command line option; -failfast: Command-line options<3>.\n(line   24)\n* unittest command line option; -k:      Command-line options<3>.\n(line   28)\n* unittest command line option; -locals: Command-line options<3>.\n(line   45)\n* unittest-discover command line option; -p: Test Discovery. (line   35)\n* unittest-discover command line option; -pattern: Test Discovery.\n(line   35)\n* unittest-discover command line option; -s: Test Discovery. (line   31)\n* unittest-discover command line option; -start-directory: Test Discovery.\n(line   31)\n* unittest-discover command line option; -t: Test Discovery. (line   39)\n* unittest-discover command line option; -top-level-directory: Test Discovery.\n(line   39)\n* unittest-discover command line option; -v: Test Discovery. (line   27)\n* unittest-discover command line option; -verbose: Test Discovery.\n(line   27)\n* universal newlines:                    Glossary.           (line 1385)\n* universal newlines; bytearray.splitlines method: Bytes and Bytearray Operations.\n(line  640)\n* universal newlines; bytes.splitlines method: Bytes and Bytearray Operations.\n(line  640)\n* universal newlines; csv.reader function: Module Contents<3>.\n(line    8)\n* universal newlines; importlib.abc.InspectLoader.getsource method: importlib abc - Abstract base classes related to import.\n(line  247)\n* universal newlines; io.IncrementalNewlineDecoder class: Text I/O<2>.\n(line  286)\n* universal newlines; io.TextIOWrapper class: Text I/O<2>.   (line  126)\n* universal newlines; open() built-in function: Built-in Functions.\n(line 1264)\n* universal newlines; str.splitlines method: String Methods<2>.\n(line  501)\n* universal newlines; subprocess module: Frequently Used Arguments.\n(line   33)\n* universal newlines; What's new:        PEP 3116 New I/O Library.\n(line   42)\n* universal newlines; What's new <1>:    New Improved and Removed Modules.\n(line  138)\n* universal newlines; What's new <2>:    PEP 324 New subprocess Module.\n(line   36)\n* universal newlines; What's new <3>:    PEP 277 Unicode file name support for Windows NT.\n(line   36)\n* UNIX:                                  Complete Python programs.\n(line   25)\n* unixdialect (class in csv):           Module Contents<3>. (line  213)\n* unixshell (in module test.support):   test support -- Utilities for the Python test suite.\n(line   44)\n* UNIX; file control:                    fcntl -- The fcntl and ioctl system calls.\n(line    6)\n* UNIX; I/O control:                     fcntl -- The fcntl and ioctl system calls.\n(line    6)\n* UnixDatagramServer (class in socketserver): socketserver -- A framework for network servers.\n(line   38)\n* UnixStreamServer (class in socketserver): socketserver -- A framework for network servers.\n(line   38)\n* unknown (uuid.SafeUUID attribute):     uuid -- UUID objects according to RFC 4122.\n(line   42)\n* unknowndecl() (html.parser.HTMLParser method): HTMLParser Methods.\n(line  136)\n* unknownopen() (urllib.request.BaseHandler method): BaseHandler Objects.\n(line   56)\n* unknownopen() (urllib.request.UnknownHandler method): UnknownHandler Objects.\n(line    6)\n* UnknownHandler (class in urllib.request): urllib request -- Extensible library for opening URLs.\n(line  445)\n* UnknownProtocol:                       http client -- HTTP protocol client.\n(line  146)\n* UnknownTransferEncoding:               http client -- HTTP protocol client.\n(line  150)\n* unlink() (in module os):               Files and Directories.\n(line 1567)\n* unlink() (in module test.support.oshelper): test support oshelper -- Utilities for os tests.\n(line  164)\n* unlink() (multiprocessing.sharedmemory.SharedMemory method): multiprocessing sharedmemory -- Shared memory for direct access across processes.\n(line   79)\n* unlink() (pathlib.Path method):        Methods<2>.         (line  622)\n* unlink() (xml.dom.minidom.Node method): DOM Objects.       (line   10)\n* unload() (in module test.support.importhelper): test support importhelper -- Utilities for import tests.\n(line   76)\n* unlock() (mailbox.Babyl method):       Babyl objects.      (line   59)\n* unlock() (mailbox.Mailbox method):     Mailbox objects.    (line  265)\n* unlock() (mailbox.Maildir method):     Maildir objects.    (line  108)\n* unlock() (mailbox.mbox method):        mbox objects.       (line   38)\n* unlock() (mailbox.MH method):          MH objects.         (line   84)\n* unlock() (mailbox.MMDF method):        MMDF objects.       (line   35)\n* Unpack (in module typing):             Special forms.      (line  438)\n* unpackarchive() (in module shutil):   Archiving operations.\n(line  125)\n* unpackarray() (xdrlib.Unpacker method): Unpacker Objects. (line   91)\n* unpackbytes() (xdrlib.Unpacker method): Unpacker Objects. (line   70)\n* unpackdouble() (xdrlib.Unpacker method): Unpacker Objects.\n(line   40)\n* UNPACKEX (opcode):                    Python Bytecode Instructions.\n(line  519)\n* unpackfarray() (xdrlib.Unpacker method): Unpacker Objects.\n(line   85)\n* unpackfloat() (xdrlib.Unpacker method): Unpacker Objects. (line   36)\n* unpackfopaque() (xdrlib.Unpacker method): Unpacker Objects.\n(line   54)\n* unpackfrom() (in module struct):      Functions and Exceptions.\n(line   34)\n* unpackfrom() (struct.Struct method):  Classes<3>.         (line   40)\n* unpackfstring() (xdrlib.Unpacker method): Unpacker Objects.\n(line   48)\n* unpacklist() (xdrlib.Unpacker method): Unpacker Objects.  (line   77)\n* unpackopaque() (xdrlib.Unpacker method): Unpacker Objects.\n(line   65)\n* UNPACKSEQUENCE (opcode):              Python Bytecode Instructions.\n(line  510)\n* unpackstring() (xdrlib.Unpacker method): Unpacker Objects.\n(line   59)\n* unpack() (in module struct):           Functions and Exceptions.\n(line   26)\n* unpack() (struct.Struct method):       Classes<3>.         (line   34)\n* Unpacker (class in xdrlib):            xdrlib -- Encode and decode XDR data.\n(line   27)\n* unpacking; dictionary:                 Dictionary displays.\n(line   23)\n* unpacking; in function calls:          Calls.              (line   73)\n* unparse() (in module ast):             ast Helpers.        (line   62)\n* unparsedEntityDecl() (xml.sax.handler.DTDHandler method): DTDHandler Objects.\n(line   12)\n* UnparsedEntityDeclHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line  290)\n* Unpickler (class in pickle):           Module Interface.   (line  227)\n* UnpicklingError:                       Module Interface.   (line  108)\n* unquoteplus() (in module urllib.parse): URL Quoting.      (line   81)\n* unquotetobytes() (in module urllib.parse): URL Quoting.  (line   91)\n* unquote() (in module email.utils):     email utils Miscellaneous utilities.\n(line   50)\n* unquote() (in module urllib.parse):    URL Quoting.        (line   61)\n* unraisablehook() (in module sys):      sys -- System-specific parameters and functions.\n(line 1895)\n* unreachable object:                    Objects values and types.\n(line   37)\n* unrecognized escape sequence:          Escape sequences.   (line  107)\n* unregisterarchiveformat() (in module shutil): Archiving operations.\n(line  120)\n* unregisterdialect() (in module csv):  Module Contents<3>. (line   79)\n* unregisterunpackformat() (in module shutil): Archiving operations.\n(line  186)\n* unregister() (in module atexit):       atexit -- Exit handlers.\n(line   57)\n* unregister() (in module codecs):       codecs -- Codec registry and base classes.\n(line  161)\n* unregister() (in module faulthandler): Dumping the traceback on a user signal.\n(line   23)\n* unregister() (select.devpoll method):  /dev/poll Polling Objects.\n(line   55)\n* unregister() (select.epoll method):    Edge and Level Trigger Polling epoll Objects.\n(line   89)\n* unregister() (select.poll method):     Polling Objects.    (line   67)\n* unregister() (selectors.BaseSelector method): Classes<4>.  (line   80)\n* unsafe (uuid.SafeUUID attribute):      uuid -- UUID objects according to RFC 4122.\n(line   38)\n* unselect() (imaplib.IMAP4 method):     IMAP4 Objects.      (line  375)\n* unset() (test.support.oshelper.EnvironmentVarGuard method): test support oshelper -- Utilities for os tests.\n(line   71)\n* unsetenv() (in module os):             Process Parameters. (line  580)\n* unshare() (in module os):              Process Parameters. (line  599)\n* UnstructuredHeader (class in email.headerregistry): email headerregistry Custom Header Objects.\n(line  115)\n* unsubscribe() (imaplib.IMAP4 method):  IMAP4 Objects.      (line  371)\n* UnsupportedOperation:                  High-level Module Interface.\n(line   72)\n* until (pdb command):                   Debugger Commands.  (line  201)\n* untokenize() (in module tokenize):     Tokenizing Input.   (line   57)\n* untouchwin() (curses.window method):   Window Objects.     (line  583)\n* unuseddata (bz2.BZ2Decompressor attribute): Incremental de compression.\n(line   78)\n* unuseddata (lzma.LZMADecompressor attribute): Compressing and decompressing data in memory.\n(line  169)\n* unuseddata (zlib.Decompress attribute): zlib -- Compression compatible with gzip.\n(line  235)\n* unverifiable (urllib.request.Request attribute): Request Objects.\n(line   47)\n* unwrap() (in module inspect):          Classes and functions<2>.\n(line  139)\n* unwrap() (in module urllib.parse):     URL Parsing.        (line  396)\n* unwrap() (ssl.SSLSocket method):       SSL Sockets.        (line  278)\n* up (pdb command):                      Debugger Commands.  (line   89)\n* up() (in module turtle):               Drawing state.      (line   12)\n* updateabstractmethods() (in module abc): abc -- Abstract Base Classes.\n(line  337)\n* updateauthenticated() (urllib.request.HTTPPasswordMgrWithPriorAuth method): HTTPPasswordMgrWithPriorAuth Objects.\n(line   24)\n* updatelinescols() (in module curses): Functions<6>.      (line  569)\n* updatepanels() (in module curses.panel): Functions<7>.    (line   23)\n* updatevisible() (mailbox.BabylMessage method): BabylMessage objects.\n(line   76)\n* updatewrapper() (in module functools): functools -- Higher-order functions and operations on callable objects.\n(line  630)\n* update() (collections.Counter method): Counter objects.    (line  122)\n* update() (dict method):                Mapping Types -- dict.\n(line  204)\n* update() (frozenset method):           Set Types -- set frozenset.\n(line  169)\n* update() (hashlib.hash method):        Hash Objects.       (line   31)\n* update() (hmac.HMAC method):           hmac -- Keyed-Hashing for Message Authentication.\n(line   46)\n* update() (http.cookies.Morsel method): Morsel Objects.     (line   88)\n* update() (in module turtle):           Animation control.  (line   46)\n* update() (mailbox.Mailbox method):     Mailbox objects.    (line  235)\n* update() (mailbox.Maildir method):     Maildir objects.    (line   92)\n* update() (trace.CoverageResults method): Programmatic Interface.\n(line   52)\n* upgradedependencies() (venv.EnvBuilder method): API<2>.   (line  161)\n* upper() (bytearray method):            Bytes and Bytearray Operations.\n(line  732)\n* upper() (bytes method):                Bytes and Bytearray Operations.\n(line  732)\n* upper() (str method):                  String Methods<2>.  (line  663)\n* urandom() (in module os):              Random numbers<2>.  (line   29)\n* URL:                                   urllib parse -- Parse URLs into components.\n(line    8)\n* URL <1>:                               urllib robotparser -- Parser for robots txt.\n(line    8)\n* URL <2>:                               http server -- HTTP servers.\n(line    8)\n* URL <3>:                               cgi -- Common Gateway Interface support.\n(line    8)\n* url (http.client.HTTPResponse attribute): HTTPResponse Objects.\n(line   51)\n* url (urllib.error.HTTPError attribute): urllib error -- Exception classes raised by urllib request.\n(line   38)\n* url (urllib.response.addinfourl attribute): urllib response -- Response classes used by urllib.\n(line   14)\n* url (xmlrpc.client.ProtocolError attribute): ProtocolError Objects.\n(line   13)\n* URL; parsing:                          urllib parse -- Parse URLs into components.\n(line    8)\n* url2pathname() (in module urllib.request): urllib request -- Extensible library for opening URLs.\n(line  164)\n* urlcleanup() (in module urllib.request): Legacy interface. (line   62)\n* urldefrag() (in module urllib.parse):  URL Parsing.        (line  370)\n* urlencode() (in module urllib.parse):  URL Quoting.        (line  104)\n* URLError:                              urllib error -- Exception classes raised by urllib request.\n(line   17)\n* urljoin() (in module urllib.parse):    URL Parsing.        (line  340)\n* urllib (2to3 fixer):                   Fixers.             (line  321)\n* urlopen() (in module urllib.request):  urllib request -- Extensible library for opening URLs.\n(line   34)\n* URLopener (class in urllib.request):   Legacy interface.   (line   67)\n* urlparse() (in module urllib.parse):   URL Parsing.        (line    9)\n* urlretrieve() (in module urllib.request): Legacy interface.\n(line   10)\n* urlsafeb64decode() (in module base64): base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line   99)\n* urlsafeb64encode() (in module base64): base64 -- Base16 Base32 Base64 Base85 Data Encodings.\n(line   92)\n* urlsplit() (in module urllib.parse):   URL Parsing.        (line  250)\n* urlunparse() (in module urllib.parse): URL Parsing.        (line  242)\n* urlunsplit() (in module urllib.parse): URL Parsing.        (line  331)\n* urn (uuid.UUID attribute):             uuid -- UUID objects according to RFC 4122.\n(line  136)\n* US (in module curses.ascii):           curses ascii -- Utilities for ASCII characters.\n(line  118)\n* usedefaultcolors() (in module curses): Functions<6>.     (line  600)\n* useenv() (in module curses):          Functions<6>.       (line  590)\n* userawinput (cmd.Cmd attribute):      Cmd Objects.        (line  177)\n* USESTACKCHECK (C macro):              Operating System Utilities.\n(line   91)\n* usetoolid() (in module sys.monitoring): Registering and using tools.\n(line    6)\n* UseForeignDTD() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line   63)\n* USER:                                  getpass -- Portable password input.\n(line   44)\n* USERBASE (in module site):            Module contents<5>. (line   30)\n* usercall() (bdb.Bdb method):          bdb -- Debugger framework.\n(line  269)\n* userexception() (bdb.Bdb method):     bdb -- Debugger framework.\n(line  285)\n* userline() (bdb.Bdb method):          bdb -- Debugger framework.\n(line  274)\n* userreturn() (bdb.Bdb method):        bdb -- Debugger framework.\n(line  280)\n* USERSITE (in module site):            Module contents<5>. (line   19)\n* user-defined; function:                User-defined functions.\n(line    6)\n* user-defined; function; call:          Calls.              (line  132)\n* user-defined; method:                  Instance methods.   (line    6)\n* user; effective id:                    Process Parameters. (line  187)\n* user; id:                              Process Parameters. (line  335)\n* user; id, setting:                     Process Parameters. (line  526)\n* user() (poplib.POP3 method):           POP3 Objects.       (line   31)\n* usercustomize:                         The Customization Modules.\n(line    6)\n* usercustomize <1>:                     The Customization Modules.\n(line   21)\n* UserDict (class in collections):       UserDict objects.   (line   12)\n* UserList (class in collections):       UserList objects.   (line   16)\n* USERNAME:                              os path -- Common pathname manipulations.\n(line  144)\n* USERNAME <1>:                          Process Parameters. (line  239)\n* USERNAME <2>:                          getpass -- Portable password input.\n(line   45)\n* username (email.headerregistry.Address attribute): email headerregistry Custom Header Objects.\n(line  431)\n* USERPROFILE:                           os path<4>.         (line   14)\n* USERPROFILE <1>:                       Changes in the Python API<4>.\n(line  116)\n* USERPROFILE <2>:                       Windows<35>.        (line   15)\n* USERPROFILE <3>:                       os path -- Common pathname manipulations.\n(line  141)\n* userptr() (curses.panel.Panel method): Panel Objects.      (line   57)\n* UserString (class in collections):     UserString objects. (line   12)\n* UserWarning:                           Warnings.           (line   13)\n* USTARFORMAT (in module tarfile):      tarfile -- Read and write tar archive files.\n(line  327)\n* USub (class in ast):                   Expressions<2>.     (line   28)\n* UTC:                                   time -- Time access and conversions.\n(line   39)\n* utc (datetime.timezone attribute):     timezone Objects.   (line   68)\n* UTC (in module datetime):              Constants.          (line   18)\n* utcfromtimestamp() (datetime.datetime class method): datetime Objects.\n(line  127)\n* utcnow() (datetime.datetime class method): datetime Objects.\n(line   77)\n* utcoffset() (datetime.datetime method): datetime Objects.  (line  503)\n* utcoffset() (datetime.time method):    time Objects.       (line  233)\n* utcoffset() (datetime.timezone method): timezone Objects.  (line   30)\n* utcoffset() (datetime.tzinfo method):  tzinfo Objects.     (line   38)\n* utctimetuple() (datetime.datetime method): datetime Objects.\n(line  548)\n* utf8 (email.policy.EmailPolicy attribute): email policy Policy Objects.\n(line  379)\n* utf8enabled (imaplib.IMAP4 attribute): IMAP4 Objects.     (line  403)\n* utf8mode (sys.flags attribute):       sys -- System-specific parameters and functions.\n(line  560)\n* utf8() (poplib.POP3 method):           POP3 Objects.       (line  106)\n* utime() (in module os):                Files and Directories.\n(line 1581)\n* UUID (class in uuid):                  uuid -- UUID objects according to RFC 4122.\n(line   47)\n* uuid command line option; -h:          Command-Line Usage<2>.\n(line   15)\n* uuid command line option; -help:       Command-Line Usage<2>.\n(line   15)\n* uuid command line option; -n:          Command-Line Usage<2>.\n(line   25)\n* uuid command line option; -N:          Command-Line Usage<2>.\n(line   33)\n* uuid command line option; -name:       Command-Line Usage<2>.\n(line   33)\n* uuid command line option; -namespace:  Command-Line Usage<2>.\n(line   25)\n* uuid command line option; -u:          Command-Line Usage<2>.\n(line   19)\n* uuid command line option; -uuid:       Command-Line Usage<2>.\n(line   19)\n* uuid1:                                 uuid -- UUID objects according to RFC 4122.\n(line  187)\n* uuid1() (in module uuid):              uuid -- UUID objects according to RFC 4122.\n(line  179)\n* uuid3:                                 uuid -- UUID objects according to RFC 4122.\n(line  193)\n* uuid3() (in module uuid):              uuid -- UUID objects according to RFC 4122.\n(line  187)\n* uuid4:                                 uuid -- UUID objects according to RFC 4122.\n(line  197)\n* uuid4() (in module uuid):              uuid -- UUID objects according to RFC 4122.\n(line  193)\n* uuid5:                                 uuid -- UUID objects according to RFC 4122.\n(line  203)\n* uuid5() (in module uuid):              uuid -- UUID objects according to RFC 4122.\n(line  197)\n* UuidCreate() (in module msilib):       msilib -- Read and write Microsoft Installer files.\n(line   41)\n* v4inttopacked() (in module ipaddress): Other Module Level Functions.\n(line    8)\n* v6inttopacked() (in module ipaddress): Other Module Level Functions.\n(line   20)\n* validsignals() (in module signal):    Module contents<2>. (line  304)\n* validator() (in module wsgiref.validate): wsgiref validate -- WSGI conformance checker.\n(line   22)\n* value:                                 Dictionary displays.\n(line    6)\n* value (ctypes.SimpleCData attribute): Fundamental data types<2>.\n(line   17)\n* value (enum.Enum attribute):           Data Types<2>.      (line  131)\n* value (http.cookiejar.Cookie attribute): Cookie Objects<2>.\n(line   32)\n* value (http.cookies.Morsel attribute): Morsel Objects.     (line   46)\n* value (StopIteration attribute):       Concrete exceptions.\n(line  244)\n* value (xml.dom.Attr attribute):        Attr Objects.       (line   23)\n* value of an object:                    Objects values and types.\n(line   11)\n* valuedecode() (http.cookies.BaseCookie method): Cookie Objects.\n(line    6)\n* valueencode() (http.cookies.BaseCookie method): Cookie Objects.\n(line   13)\n* Value() (in module multiprocessing.sharedctypes): The multiprocessing sharedctypes module.\n(line   67)\n* Value() (in module multiprocessing):   Shared ctypes Objects.\n(line    9)\n* Value() (multiprocessing.managers.SyncManager method): Managers.\n(line  217)\n* ValueError:                            Concrete exceptions.\n(line  449)\n* valuerefs() (weakref.WeakValueDictionary method): weakref -- Weak references.\n(line  227)\n* Values (class in optparse):            Defining options.   (line   84)\n* values() (contextvars.Context method): Manual Context Management.\n(line  109)\n* values() (dict method):                Mapping Types -- dict.\n(line  215)\n* values() (email.message.EmailMessage method): email message Representing an email message.\n(line  236)\n* values() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  344)\n* values() (mailbox.Mailbox method):     Mailbox objects.    (line  128)\n* values() (types.MappingProxyType method): Standard Interpreter Types.\n(line  320)\n* ValuesView (class in collections.abc): Collections Abstract Base Classes - Detailed Descriptions.\n(line   96)\n* ValuesView (class in typing):          Aliases to container ABCs in collections abc.\n(line  111)\n* var (contextvars.Token attribute):     Context Variables.  (line   82)\n* variable annotation:                   Glossary.           (line 1393)\n* variance (statistics.NormalDist attribute): NormalDist objects.\n(line   40)\n* variance() (in module statistics):     Function details.   (line  364)\n* variant (uuid.UUID attribute):         uuid -- UUID objects according to RFC 4122.\n(line  140)\n* VBAR (in module token):                token -- Constants used with Python parse trees.\n(line   98)\n* vbar (tkinter.scrolledtext.ScrolledText attribute): tkinter scrolledtext -- Scrolled Text Widget.\n(line   30)\n* VBAREQUAL (in module token):           token -- Constants used with Python parse trees.\n(line  194)\n* VCASSEMBLYPUBLICKEYTOKEN (in module msvcrt): Other Functions.\n(line   16)\n* Vec2D (class in turtle):               Public classes.     (line   86)\n* vectorcallfunc (C type):               The Vectorcall Protocol.\n(line   41)\n* VERBOSE (in module re):                Flags.              (line  127)\n* verbose (in module tabnanny):          tabnanny -- Detection of ambiguous indentation.\n(line   26)\n* verbose (in module test.support):      test support -- Utilities for the Python test suite.\n(line   30)\n* verbose (sys.flags attribute):         sys -- System-specific parameters and functions.\n(line  544)\n* VERIFYALLOWPROXYCERTS (in module ssl): Constants<9>.    (line   98)\n* verifyclientposthandshake() (ssl.SSLSocket method): SSL Sockets.\n(line  287)\n* verifycode (ssl.SSLCertVerificationError attribute): Exceptions<14>.\n(line   86)\n* VERIFYCRLCHECKCHAIN (in module ssl): Constants<9>.      (line   84)\n* VERIFYCRLCHECKLEAF (in module ssl): Constants<9>.       (line   73)\n* VERIFYDEFAULT (in module ssl):        Constants<9>.       (line   65)\n* verifyflags (ssl.SSLContext attribute): SSL Contexts.     (line  622)\n* verifygeneratedheaders (email.policy.Policy attribute): email policy Policy Objects.\n(line  204)\n* verifymessage (ssl.SSLCertVerificationError attribute): Exceptions<14>.\n(line   90)\n* verifymode (ssl.SSLContext attribute): SSL Contexts.      (line  637)\n* verifyrequest() (socketserver.BaseServer method): Server Objects<2>.\n(line  175)\n* VERIFYX509PARTIALCHAIN (in module ssl): Constants<9>.   (line  114)\n* VERIFYX509STRICT (in module ssl):    Constants<9>.       (line   91)\n* VERIFYX509TRUSTEDFIRST (in module ssl): Constants<9>.   (line  105)\n* verify() (in module enum):             Utilities and Decorators.\n(line   71)\n* verify() (smtplib.SMTP method):        SMTP Objects.       (line   91)\n* VerifyFlags (class in ssl):            Constants<9>.       (line  125)\n* VerifyMode (class in ssl):             Constants<9>.       (line   59)\n* version (email.headerregistry.MIMEVersionHeader attribute): email headerregistry Custom Header Objects.\n(line  242)\n* version (http.client.HTTPResponse attribute): HTTPResponse Objects.\n(line   46)\n* version (http.cookiejar.Cookie attribute): Cookie Objects<2>.\n(line   20)\n* version (http.cookies.Morsel attribute): Morsel Objects.   (line   13)\n* version (in module curses):            Constants<6>.       (line   18)\n* version (in module marshal):           marshal -- Internal Python object serialization.\n(line  110)\n* version (in module sqlite3):           Module constants.   (line  122)\n* version (in module sys):               sys -- System-specific parameters and functions.\n(line 1943)\n* version (in module sys) <1>:           Process-wide parameters.\n(line  217)\n* version (in module sys) <2>:           Process-wide parameters.\n(line  254)\n* version (in module sys) <3>:           Process-wide parameters.\n(line  265)\n* version (ipaddress.IPv4Address attribute): Address objects.\n(line   45)\n* version (ipaddress.IPv4Network attribute): Network objects.\n(line   63)\n* version (ipaddress.IPv6Address attribute): Address objects.\n(line  253)\n* version (ipaddress.IPv6Network attribute): Network objects.\n(line  293)\n* version (sys.threadinfo attribute):   sys -- System-specific parameters and functions.\n(line 1880)\n* version (urllib.request.URLopener attribute): Legacy interface.\n(line  139)\n* version (uuid.UUID attribute):         uuid -- UUID objects according to RFC 4122.\n(line  147)\n* versioninfo (in module sqlite3):      Module constants.   (line  132)\n* versioninfo (in module sys):          sys -- System-specific parameters and functions.\n(line 1958)\n* versionstring() (http.server.BaseHTTPRequestHandler method): http server -- HTTP servers.\n(line  315)\n* version() (in module ensurepip):       Module API.         (line    8)\n* version() (in module platform):        Cross Platform.     (line  131)\n* version() (ssl.SSLSocket method):      SSL Sockets.        (line  309)\n* vformat() (string.Formatter method):   Custom String Formatting.\n(line   26)\n* virtual environment:                   Glossary.           (line 1416)\n* virtual machine:                       Glossary.           (line 1425)\n* visitConstant() (ast.NodeVisitor method): ast Helpers.    (line  204)\n* visit() (ast.NodeVisitor method):      ast Helpers.        (line  188)\n* visitproc (C type):                    Supporting Cyclic Garbage Collection.\n(line  153)\n* vline() (curses.window method):        Window Objects.     (line  588)\n* voidcmd() (ftplib.FTP method):         FTP objects.        (line  165)\n* volume (zipfile.ZipInfo attribute):    ZipInfo Objects.    (line  120)\n* vonmisesvariate() (in module random):  Real-valued distributions.\n(line   93)\n* VT (in module curses.ascii):           curses ascii -- Utilities for ASCII characters.\n(line   58)\n* WOK (in module os):                   Files and Directories.\n(line  106)\n* waitclosed() (asyncio.Server method): Server Objects.     (line   98)\n* waitclosed() (asyncio.StreamWriter method): StreamWriter. (line  115)\n* waitfor() (asyncio.Condition method): Condition.          (line   97)\n* waitfor() (in module asyncio):        Timeouts.           (line  118)\n* waitfor() (threading.Condition method): Condition Objects.\n(line  128)\n* waitprocess() (in module test.support): test support -- Utilities for the Python test suite.\n(line  419)\n* waitthreadsexit() (in module test.support.threadinghelper): test support threadinghelper -- Utilities for threading tests.\n(line   41)\n* wait() (asyncio.Barrier method):       Barrier.            (line   52)\n* wait() (asyncio.Condition method):     Condition.          (line   85)\n* wait() (asyncio.Event method):         Event.              (line   44)\n* wait() (asyncio.subprocess.Process method): Interacting with Subprocesses.\n(line   38)\n* wait() (in module asyncio):            Waiting Primitives. (line    6)\n* wait() (in module concurrent.futures): Module Functions.   (line    6)\n* wait() (in module multiprocessing.connection): Listeners and Clients.\n(line  113)\n* wait() (in module os):                 Process Management. (line  812)\n* wait() (multiprocessing.pool.AsyncResult method): Process Pools.\n(line  204)\n* wait() (subprocess.Popen method):      Popen Objects.      (line   13)\n* wait() (threading.Barrier method):     Barrier Objects.    (line   43)\n* wait() (threading.Condition method):   Condition Objects.  (line   97)\n* wait() (threading.Event method):       Event Objects.      (line   42)\n* wait3() (in module os):                Process Management. (line  920)\n* wait4() (in module os):                Process Management. (line  934)\n* waitid() (in module os):               Process Management. (line  836)\n* waitpid() (in module os):              Process Management. (line  874)\n* waitstatustoexitcode() (in module os): Process Management.\n(line 1052)\n* walkpackages() (in module pkgutil):   pkgutil -- Package extension utility.\n(line  145)\n* walkstack() (in module traceback):    traceback -- Print or retrieve a stack traceback.\n(line  191)\n* walktb() (in module traceback):       traceback -- Print or retrieve a stack traceback.\n(line  200)\n* walk() (email.message.EmailMessage method): email message Representing an email message.\n(line  467)\n* walk() (email.message.Message method): email message Message Representing an email message using the compat32 API.\n(line  635)\n* walk() (in module ast):                ast Helpers.        (line  171)\n* walk() (in module os):                 Files and Directories.\n(line 1625)\n* walk() (pathlib.Path method):          Methods<2>.         (line  255)\n* walrus operator:                       Boolean operations. (line   38)\n* want (doctest.Example attribute):      Example Objects.    (line   23)\n* warndefaultencoding (sys.flags attribute): sys -- System-specific parameters and functions.\n(line  570)\n* warnexplicit() (in module warnings):  Available Functions.\n(line   62)\n* warn() (in module warnings):           Available Functions.\n(line    6)\n* Warning:                               Warnings.           (line    9)\n* Warning <1>:                           Exceptions<6>.      (line    8)\n* WARNING (in module logging):           Logging Levels.     (line   33)\n* WARNING (in module tkinter.messagebox): tkinter messagebox -- Tkinter message prompts.\n(line  198)\n* warning() (in module logging):         Module-Level Functions.\n(line   68)\n* warning() (logging.Logger method):     Logger Objects.     (line  292)\n* warning() (xml.sax.handler.ErrorHandler method): ErrorHandler Objects.\n(line   29)\n* warnings:                              warnings -- Warning control.\n(line    8)\n* WarningsRecorder (class in test.support.warningshelper): test support warningshelper -- Utilities for warnings tests.\n(line  118)\n* warnoptions (in module sys):           sys -- System-specific parameters and functions.\n(line 1971)\n* wasSuccessful() (unittest.TestResult method): Loading and running tests.\n(line  313)\n* WatchedFileHandler (class in logging.handlers): WatchedFileHandler.\n(line   24)\n* Waveread (class in wave):             Waveread Objects.  (line    6)\n* Wavewrite (class in wave):            Wavewrite Objects. (line    6)\n* WCONTINUED (in module os):             Process Management. (line  974)\n* WCOREDUMP() (in module os):            Process Management. (line 1091)\n* WeakKeyDictionary (class in weakref):  weakref -- Weak references.\n(line  166)\n* WeakMethod (class in weakref):         weakref -- Weak references.\n(line  236)\n* WeakSet (class in weakref):            weakref -- Weak references.\n(line  231)\n* WeakValueDictionary (class in weakref): weakref -- Weak references.\n(line  214)\n* WEDNESDAY (in module calendar):        calendar -- General calendar-related functions.\n(line  379)\n* weekday (calendar.IllegalWeekdayError attribute): calendar -- General calendar-related functions.\n(line  456)\n* weekday() (datetime.date method):      date Objects.       (line  213)\n* weekday() (datetime.datetime method):  datetime Objects.   (line  611)\n* weekday() (in module calendar):        calendar -- General calendar-related functions.\n(line  316)\n* weekheader() (in module calendar):     calendar -- General calendar-related functions.\n(line  321)\n* weibullvariate() (in module random):   Real-valued distributions.\n(line  105)\n* WEXITED (in module os):                Process Management. (line  983)\n* WEXITSTATUS() (in module os):          Process Management. (line 1137)\n* wfile (http.server.BaseHTTPRequestHandler attribute): http server -- HTTP servers.\n(line  124)\n* wfile (socketserver.DatagramRequestHandler attribute): Request Handler Objects.\n(line   68)\n* what() (in module imghdr):             imghdr -- Determine the type of an image.\n(line   19)\n* what() (in module sndhdr):             sndhdr -- Determine type of sound file.\n(line   29)\n* whathdr() (in module sndhdr):          sndhdr -- Determine type of sound file.\n(line   38)\n* whatis (pdb command):                  Debugger Commands.  (line  271)\n* when() (asyncio.Timeout method):       Timeouts.           (line   63)\n* when() (asyncio.TimerHandle method):   Callback Handles.   (line   36)\n* where (pdb command):                   Debugger Commands.  (line   78)\n* which() (in module shutil):            Directory and files operations.\n(line  400)\n* whichdb() (in module dbm):             dbm -- Interfaces to Unix \"databases\".\n(line   23)\n* While (class in ast):                  Control flow.       (line   79)\n* whitespace (in module string):         String constants.   (line   47)\n* whitespace (shlex.shlex attribute):    shlex Objects.      (line  104)\n* whitespacesplit (shlex.shlex attribute): shlex Objects.   (line  128)\n* Widget (class in tkinter.ttk):         ttk Widget.         (line    9)\n* width (sys.hashinfo attribute):       sys -- System-specific parameters and functions.\n(line  994)\n* width (textwrap.TextWrapper attribute): textwrap -- Text wrapping and filling.\n(line  160)\n* width() (in module turtle):            Drawing state.      (line   18)\n* WIFCONTINUED() (in module os):         Process Management. (line 1101)\n* WIFEXITED() (in module os):            Process Management. (line 1129)\n* WIFSIGNALED() (in module os):          Process Management. (line 1122)\n* WIFSTOPPED() (in module os):           Process Management. (line 1111)\n* win32edition() (in module platform):  Windows Platform.   (line   22)\n* win32isiot() (in module platform):   Windows Platform.   (line   31)\n* win32ver() (in module platform):      Windows Platform.   (line    6)\n* WinDLL (class in ctypes):              Loading shared libraries.\n(line   53)\n* window manager (widgets):              The Window Manager. (line    6)\n* windowheight() (in module turtle):    Settings and special methods.\n(line  104)\n* windowwidth() (in module turtle):     Settings and special methods.\n(line  111)\n* window() (curses.panel.Panel method):  Panel Objects.      (line   62)\n* Windows:                               Complete Python programs.\n(line   25)\n* Windows ini file:                      configparser -- Configuration file parser.\n(line    8)\n* WindowsError:                          Concrete exceptions.\n(line  470)\n* WindowsPath (class in pathlib):        Concrete paths.     (line   32)\n* WindowsProactorEventLoopPolicy (class in asyncio): Policy Objects.\n(line   78)\n* WindowsRegistryFinder (class in importlib.machinery): importlib machinery - Importers and path hooks.\n(line   92)\n* WindowsSelectorEventLoopPolicy (class in asyncio): Policy Objects.\n(line   71)\n* winerror (OSError attribute):          Concrete exceptions.\n(line  166)\n* WinError() (in module ctypes):         Utility functions.  (line  203)\n* WINFUNCTYPE() (in module ctypes):      Function prototypes.\n(line   25)\n* WinSock:                               select -- Waiting for I/O completion.\n(line  152)\n* winver (in module sys):                sys -- System-specific parameters and functions.\n(line 1977)\n* With (class in ast):                   Control flow.       (line  242)\n* WITHEXCEPTSTART (opcode):            Python Bytecode Instructions.\n(line  425)\n* withhostmask (ipaddress.IPv4Interface attribute): Interface objects.\n(line   55)\n* withhostmask (ipaddress.IPv4Network attribute): Network objects.\n(line  123)\n* withhostmask (ipaddress.IPv6Interface attribute): Interface objects.\n(line   82)\n* withhostmask (ipaddress.IPv6Network attribute): Network objects.\n(line  325)\n* withname() (pathlib.PurePath method): Methods and properties.\n(line  347)\n* withnetmask (ipaddress.IPv4Interface attribute): Interface objects.\n(line   46)\n* withnetmask (ipaddress.IPv4Network attribute): Network objects.\n(line  118)\n* withnetmask (ipaddress.IPv6Interface attribute): Interface objects.\n(line   80)\n* withnetmask (ipaddress.IPv6Network attribute): Network objects.\n(line  323)\n* withprefixlen (ipaddress.IPv4Interface attribute): Interface objects.\n(line   37)\n* withprefixlen (ipaddress.IPv4Network attribute): Network objects.\n(line  105)\n* withprefixlen (ipaddress.IPv6Interface attribute): Interface objects.\n(line   78)\n* withprefixlen (ipaddress.IPv6Network attribute): Network objects.\n(line  317)\n* withpymalloc() (in module test.support): test support -- Utilities for the Python test suite.\n(line  255)\n* withsegments() (pathlib.PurePath method): Methods and properties.\n(line  403)\n* withstem() (pathlib.PurePath method): Methods and properties.\n(line  363)\n* withsuffix() (pathlib.PurePath method): Methods and properties.\n(line  386)\n* withtraceback() (BaseException method): Base classes.     (line   25)\n* withitem (class in ast):               Control flow.       (line  253)\n* WNOHANG (in module os):                Process Management. (line 1017)\n* WNOWAIT (in module os):                Process Management. (line 1025)\n* wordchars (shlex.shlex attribute):     shlex Objects.      (line   91)\n* World Wide Web:                        Internet Protocols and Support.\n(line    6)\n* World Wide Web <1>:                    urllib parse -- Parse URLs into components.\n(line    8)\n* World Wide Web <2>:                    urllib robotparser -- Parser for robots txt.\n(line    8)\n* wrapbio() (ssl.SSLContext method):    SSL Contexts.       (line  444)\n* wrapfuture() (in module asyncio):     Future Functions.   (line   51)\n* wrapsocket() (ssl.SSLContext method): SSL Contexts.       (line  377)\n* wrap() (in module textwrap):           textwrap -- Text wrapping and filling.\n(line   16)\n* wrap() (textwrap.TextWrapper method):  textwrap -- Text wrapping and filling.\n(line  286)\n* wrapper() (in module curses):          Functions<6>.       (line  609)\n* WrapperDescriptorType (in module types): Standard Interpreter Types.\n(line   88)\n* wraps() (in module functools):         functools -- Higher-order functions and operations on callable objects.\n(line  674)\n* WRITABLE (in module tkinter):         File Handlers.      (line   41)\n* WRITABLE (inspect.BufferFlags attribute): Buffer flags.    (line   17)\n* writable() (bz2.BZ2File method):       De compression of files.\n(line  105)\n* writable() (io.IOBase method):         I/O Base Classes.   (line  152)\n* WRITE (inspect.BufferFlags attribute): Buffer flags.       (line   51)\n* writebyte() (mmap.mmap method):       mmap -- Memory-mapped file support.\n(line  316)\n* writebytes() (pathlib.Path method):   Methods<2>.         (line  635)\n* writedocstringdict() (in module turtle): Translation of docstrings into different languages.\n(line   10)\n* writeeof() (asyncio.StreamWriter method): StreamWriter.   (line   52)\n* writeeof() (asyncio.WriteTransport method): Write-only Transports.\n(line   74)\n* writeeof() (ssl.MemoryBIO method):    Memory BIO Support<2>.\n(line  157)\n* writehistoryfile() (in module readline): History file.   (line   14)\n* WRITERESTRICTED (C macro):            Member flags.       (line   32)\n* writeresults() (trace.CoverageResults method): Programmatic Interface.\n(line   57)\n* writetext() (pathlib.Path method):    Methods<2>.         (line  650)\n* writethrough (io.TextIOWrapper attribute): Text I/O<2>.   (line  174)\n* write() (asyncio.StreamWriter method): StreamWriter.       (line   15)\n* write() (asyncio.WriteTransport method): Write-only Transports.\n(line   60)\n* write() (code.InteractiveInterpreter method): Interactive Interpreter Objects.\n(line   63)\n* write() (codecs.StreamWriter method):  StreamWriter Objects.\n(line   31)\n* write() (configparser.ConfigParser method): ConfigParser Objects.\n(line  259)\n* write() (email.generator.BytesGenerator method): email generator Generating MIME documents.\n(line  118)\n* write() (email.generator.Generator method): email generator Generating MIME documents.\n(line  214)\n* write() (in module os):                File Descriptor Operations.\n(line  862)\n* write() (in module turtle):            More drawing control.\n(line   29)\n* write() (io.BufferedIOBase method):    I/O Base Classes.   (line  327)\n* write() (io.BufferedWriter method):    Buffered Streams.   (line  131)\n* write() (io.RawIOBase method):         I/O Base Classes.   (line  212)\n* write() (io.TextIOBase method):        Text I/O<2>.        (line   94)\n* write() (mmap.mmap method):            mmap -- Memory-mapped file support.\n(line  300)\n* write() (ossaudiodev.ossaudiodevice method): Audio Device Objects.\n(line   39)\n* write() (sqlite3.Blob method):         Blob objects.       (line   53)\n* write() (ssl.MemoryBIO method):        Memory BIO Support<2>.\n(line  149)\n* write() (ssl.SSLSocket method):        SSL Sockets.        (line   96)\n* write() (telnetlib.Telnet method):     Telnet Objects.     (line  100)\n* write() (xml.etree.ElementTree.ElementTree method): ElementTree Objects.\n(line   62)\n* write() (zipfile.ZipFile method):      ZipFile Objects.    (line  264)\n* writeall() (ossaudiodev.ossaudiodevice method): Audio Device Objects.\n(line   51)\n* writeframes() (aifc.aifc method):      aifc -- Read and write AIFF and AIFC files.\n(line  190)\n* writeframes() (sunau.AUwrite method): AUwrite Objects.   (line   52)\n* writeframes() (wave.Wavewrite method): Wavewrite Objects.\n(line   83)\n* writeframesraw() (aifc.aifc method):   aifc -- Read and write AIFF and AIFC files.\n(line  198)\n* writeframesraw() (sunau.AUwrite method): AUwrite Objects.\n(line   45)\n* writeframesraw() (wave.Wavewrite method): Wavewrite Objects.\n(line   76)\n* writeheader() (csv.DictWriter method): Writer Objects.     (line   39)\n* writelines() (asyncio.StreamWriter method): StreamWriter.  (line   26)\n* writelines() (asyncio.WriteTransport method): Write-only Transports.\n(line   67)\n* writelines() (codecs.StreamWriter method): StreamWriter Objects.\n(line   35)\n* writelines() (io.IOBase method):       I/O Base Classes.   (line  158)\n* writepy() (zipfile.PyZipFile method):  PyZipFile Objects.  (line   20)\n* writer() (in module csv):              Module Contents<3>. (line   39)\n* writerow() (csv.csvwriter method):     Writer Objects.     (line   16)\n* writerows() (csv.csvwriter method):    Writer Objects.     (line   25)\n* writestr() (zipfile.ZipFile method):   ZipFile Objects.    (line  300)\n* WriteTransport (class in asyncio):     Transports Hierarchy.\n(line   11)\n* writev() (in module os):               File Descriptor Operations.\n(line  881)\n* writexml() (xml.dom.minidom.Node method): DOM Objects.     (line   27)\n* writing; values:                       Expression statements.\n(line   17)\n* WrongDocumentErr:                      Exceptions<18>.     (line   97)\n* wscomma (2to3 fixer):                 Fixers.             (line  326)\n* wsgifilewrapper (wsgiref.handlers.BaseHandler attribute): wsgiref handlers - server/gateway base classes.\n(line  272)\n* wsgimultiprocess (wsgiref.handlers.BaseHandler attribute): wsgiref handlers - server/gateway base classes.\n(line  156)\n* wsgimultithread (wsgiref.handlers.BaseHandler attribute): wsgiref handlers - server/gateway base classes.\n(line  149)\n* wsgirunonce (wsgiref.handlers.BaseHandler attribute): wsgiref handlers - server/gateway base classes.\n(line  163)\n* WSGIApplication (in module wsgiref.types): wsgiref types - WSGI types for static type checking.\n(line   20)\n* WSGIEnvironment (in module wsgiref.types): wsgiref types - WSGI types for static type checking.\n(line   16)\n* WSGIRequestHandler (class in wsgiref.simpleserver): wsgiref simpleserver - a simple WSGI HTTP server.\n(line   75)\n* WSGIServer (class in wsgiref.simpleserver): wsgiref simpleserver - a simple WSGI HTTP server.\n(line   45)\n* wShowWindow (subprocess.STARTUPINFO attribute): Windows Popen Helpers.\n(line   49)\n* WSTOPPED (in module os):               Process Management. (line  995)\n* WSTOPSIG() (in module os):             Process Management. (line 1146)\n* wstringat() (in module ctypes):       Utility functions.  (line  214)\n* WTERMSIG() (in module os):             Process Management. (line 1155)\n* WUNTRACED (in module os):              Process Management. (line 1006)\n* WWW:                                   Internet Protocols and Support.\n(line    6)\n* WWW <1>:                               urllib parse -- Parse URLs into components.\n(line    8)\n* WWW <2>:                               urllib robotparser -- Parser for robots txt.\n(line    8)\n* WWW; server:                           http server -- HTTP servers.\n(line    8)\n* WWW; server <1>:                       cgi -- Common Gateway Interface support.\n(line    8)\n* X (in module re):                      Flags.              (line  127)\n* XOK (in module os):                   Files and Directories.\n(line  106)\n* X509 certificate:                      SSL Contexts.       (line  649)\n* xatom() (imaplib.IMAP4 method):        IMAP4 Objects.      (line  385)\n* XATTRCREATE (in module os):           Linux extended attributes.\n(line   88)\n* XATTRREPLACE (in module os):          Linux extended attributes.\n(line   94)\n* XATTRSIZEMAX (in module os):         Linux extended attributes.\n(line   83)\n* xcor() (in module turtle):             Tell Turtle's state.\n(line   34)\n* XDR:                                   xdrlib -- Encode and decode XDR data.\n(line    8)\n* xhdr() (nntplib.NNTP method):          Methods<3>.         (line  320)\n* XHTML:                                 html parser -- Simple HTML and XHTML parser.\n(line    8)\n* XHTMLNAMESPACE (in module xml.dom):   Module Contents<4>. (line   53)\n* XMLERRORABORTED (in module xml.parsers.expat.errors): Expat error constants.\n(line  180)\n* XMLERRORAMPLIFICATIONLIMITBREACH (in module xml.parsers.expat.errors): Expat error constants.\n(line  215)\n* XMLERRORASYNCENTITY (in module xml.parsers.expat.errors): Expat error constants.\n(line   29)\n* XMLERRORATTRIBUTEEXTERNALENTITYREF (in module xml.parsers.expat.errors): Expat error constants.\n(line   31)\n* XMLERRORBADCHARREF (in module xml.parsers.expat.errors): Expat error constants.\n(line   37)\n* XMLERRORBINARYENTITYREF (in module xml.parsers.expat.errors): Expat error constants.\n(line   42)\n* XMLERRORCANTCHANGEFEATUREONCEPARSING (in module xml.parsers.expat.errors): Expat error constants.\n(line  135)\n* XMLERRORDUPLICATEATTRIBUTE (in module xml.parsers.expat.errors): Expat error constants.\n(line   47)\n* XMLERRORENTITYDECLAREDINPE (in module xml.parsers.expat.errors): Expat error constants.\n(line  126)\n* XMLERROREXTERNALENTITYHANDLING (in module xml.parsers.expat.errors): Expat error constants.\n(line  116)\n* XMLERRORFEATUREREQUIRESXMLDTD (in module xml.parsers.expat.errors): Expat error constants.\n(line  128)\n* XMLERRORFINISHED (in module xml.parsers.expat.errors): Expat error constants.\n(line  184)\n* XMLERRORINCOMPLETEPE (in module xml.parsers.expat.errors): Expat error constants.\n(line  152)\n* XMLERRORINCORRECTENCODING (in module xml.parsers.expat.errors): Expat error constants.\n(line   51)\n* XMLERRORINVALIDARGUMENT (in module xml.parsers.expat.errors): Expat error constants.\n(line  207)\n* XMLERRORINVALIDTOKEN (in module xml.parsers.expat.errors): Expat error constants.\n(line   53)\n* XMLERRORJUNKAFTERDOCELEMENT (in module xml.parsers.expat.errors): Expat error constants.\n(line   59)\n* XMLERRORMISPLACEDXMLPI (in module xml.parsers.expat.errors): Expat error constants.\n(line   64)\n* XMLERRORNOBUFFER (in module xml.parsers.expat.errors): Expat error constants.\n(line  211)\n* XMLERRORNOELEMENTS (in module xml.parsers.expat.errors): Expat error constants.\n(line   69)\n* XMLERRORNOMEMORY (in module xml.parsers.expat.errors): Expat error constants.\n(line   74)\n* XMLERRORNOTSTANDALONE (in module xml.parsers.expat.errors): Expat error constants.\n(line  118)\n* XMLERRORNOTSUSPENDED (in module xml.parsers.expat.errors): Expat error constants.\n(line  175)\n* XMLERRORPARAMENTITYREF (in module xml.parsers.expat.errors): Expat error constants.\n(line   78)\n* XMLERRORPARTIALCHAR (in module xml.parsers.expat.errors): Expat error constants.\n(line   82)\n* XMLERRORPUBLICID (in module xml.parsers.expat.errors): Expat error constants.\n(line  165)\n* XMLERRORRECURSIVEENTITYREF (in module xml.parsers.expat.errors): Expat error constants.\n(line   86)\n* XMLERRORRESERVEDNAMESPACEURI (in module xml.parsers.expat.errors): Expat error constants.\n(line  202)\n* XMLERRORRESERVEDPREFIXXML (in module xml.parsers.expat.errors): Expat error constants.\n(line  192)\n* XMLERRORRESERVEDPREFIXXMLNS (in module xml.parsers.expat.errors): Expat error constants.\n(line  197)\n* XMLERRORSUSPENDPE (in module xml.parsers.expat.errors): Expat error constants.\n(line  190)\n* XMLERRORSUSPENDED (in module xml.parsers.expat.errors): Expat error constants.\n(line  169)\n* XMLERRORSYNTAX (in module xml.parsers.expat.errors): Expat error constants.\n(line   91)\n* XMLERRORTAGMISMATCH (in module xml.parsers.expat.errors): Expat error constants.\n(line   95)\n* XMLERRORTEXTDECL (in module xml.parsers.expat.errors): Expat error constants.\n(line  160)\n* XMLERRORUNBOUNDPREFIX (in module xml.parsers.expat.errors): Expat error constants.\n(line  142)\n* XMLERRORUNCLOSEDCDATASECTION (in module xml.parsers.expat.errors): Expat error constants.\n(line  112)\n* XMLERRORUNCLOSEDTOKEN (in module xml.parsers.expat.errors): Expat error constants.\n(line   99)\n* XMLERRORUNDECLARINGPREFIX (in module xml.parsers.expat.errors): Expat error constants.\n(line  147)\n* XMLERRORUNDEFINEDENTITY (in module xml.parsers.expat.errors): Expat error constants.\n(line  104)\n* XMLERRORUNEXPECTEDSTATE (in module xml.parsers.expat.errors): Expat error constants.\n(line  124)\n* XMLERRORUNKNOWNENCODING (in module xml.parsers.expat.errors): Expat error constants.\n(line  108)\n* XMLERRORXMLDECL (in module xml.parsers.expat.errors): Expat error constants.\n(line  156)\n* XMLNAMESPACE (in module xml.dom):     Module Contents<4>. (line   42)\n* XML() (in module xml.etree.ElementTree): Functions<9>.     (line  267)\n* xmlcharrefreplaceerrors() (in module codecs): Error Handlers.\n(line  172)\n* xmlcharrefreplace; error handler's name: Error Handlers.   (line   54)\n* XmlDeclHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>.\n(line  213)\n* XMLFilterBase (class in xml.sax.saxutils): xml sax saxutils -- SAX Utilities.\n(line   72)\n* XMLGenerator (class in xml.sax.saxutils): xml sax saxutils -- SAX Utilities.\n(line   56)\n* XMLID() (in module xml.etree.ElementTree): Functions<9>.   (line  275)\n* XMLNSNAMESPACE (in module xml.dom):   Module Contents<4>. (line   47)\n* XMLParser (class in xml.etree.ElementTree): XMLParser Objects.\n(line    6)\n* XMLParserType (in module xml.parsers.expat): xml parsers expat -- Fast XML parsing using Expat.\n(line   35)\n* XMLPullParser (class in xml.etree.ElementTree): XMLPullParser Objects.\n(line    6)\n* XMLReader (class in xml.sax.xmlreader): xml sax xmlreader -- Interface for XML parsers.\n(line   16)\n* xor() (in module operator):            operator -- Standard operators as functions.\n(line  168)\n* xover() (nntplib.NNTP method):         Methods<3>.         (line  336)\n* xrange (2to3 fixer):                   Fixers.             (line  331)\n* xreadlines (2to3 fixer):               Fixers.             (line  336)\n* xview() (tkinter.ttk.Treeview method): ttk Treeview.       (line  317)\n* ycor() (in module turtle):             Tell Turtle's state.\n(line   46)\n* year (datetime.date attribute):        date Objects.       (line  116)\n* year (datetime.datetime attribute):    datetime Objects.   (line  285)\n* Year 2038:                             time -- Time access and conversions.\n(line   29)\n* yeardatescalendar() (calendar.Calendar method): calendar -- General calendar-related functions.\n(line  106)\n* yeardays2calendar() (calendar.Calendar method): calendar -- General calendar-related functions.\n(line  114)\n* yeardayscalendar() (calendar.Calendar method): calendar -- General calendar-related functions.\n(line  121)\n* YES (in module tkinter.messagebox):    tkinter messagebox -- Tkinter message prompts.\n(line  157)\n* YESEXPR (in module locale):            locale -- Internationalization services.\n(line  275)\n* YESNO (in module tkinter.messagebox):  tkinter messagebox -- Tkinter message prompts.\n(line  181)\n* YESNOCANCEL (in module tkinter.messagebox): tkinter messagebox -- Tkinter message prompts.\n(line  186)\n* Yield (class in ast):                  Function and class definitions.\n(line  133)\n* YIELDVALUE (opcode):                  Python Bytecode Instructions.\n(line  360)\n* yield; examples:                       Generator-iterator methods.\n(line   75)\n* yield; expression:                     Yield expressions.  (line    6)\n* yield; yield from (in What's New):     PEP 3151 Reworking the OS and IO exception hierarchy.\n(line   87)\n* YieldFrom (class in ast):              Function and class definitions.\n(line  133)\n* yiqtorgb() (in module colorsys):     colorsys -- Conversions between color systems.\n(line   32)\n* yview() (tkinter.ttk.Treeview method): ttk Treeview.       (line  321)\n* z; in string formatting:               Format Specification Mini-Language.\n(line   87)\n* Zen of Python:                         Glossary.           (line 1431)\n* ZeroDivisionError:                     Concrete exceptions.\n(line  456)\n* zfill() (bytearray method):            Bytes and Bytearray Operations.\n(line  751)\n* zfill() (bytes method):                Bytes and Bytearray Operations.\n(line  751)\n* zfill() (str method):                  String Methods<2>.  (line  674)\n* zip (2to3 fixer):                      Fixers.             (line  340)\n* ZIPBZIP2 (in module zipfile):         zipfile -- Work with ZIP archives.\n(line   89)\n* ZIPDEFLATED (in module zipfile):      zipfile -- Work with ZIP archives.\n(line   84)\n* ziplongest() (in module itertools):   Itertool Functions. (line  641)\n* ZIPLZMA (in module zipfile):          zipfile -- Work with ZIP archives.\n(line   96)\n* ZIPSTORED (in module zipfile):        zipfile -- Work with ZIP archives.\n(line   80)\n* zipapp command line option; -c:        Command-Line Interface<5>.\n(line   45)\n* zipapp command line option; -compress: Command-Line Interface<5>.\n(line   45)\n* zipapp command line option; -h:        Command-Line Interface<5>.\n(line   61)\n* zipapp command line option; -help:     Command-Line Interface<5>.\n(line   61)\n* zipapp command line option; -info:     Command-Line Interface<5>.\n(line   55)\n* zipapp command line option; -m:        Command-Line Interface<5>.\n(line   35)\n* zipapp command line option; -main:     Command-Line Interface<5>.\n(line   35)\n* zipapp command line option; -o:        Command-Line Interface<5>.\n(line   18)\n* zipapp command line option; -output:   Command-Line Interface<5>.\n(line   18)\n* zipapp command line option; -p:        Command-Line Interface<5>.\n(line   29)\n* zipapp command line option; -python:   Command-Line Interface<5>.\n(line   29)\n* ZipFile (class in zipfile):            ZipFile Objects.    (line    6)\n* zipfile command line option; -c:       Command-line options.\n(line   11)\n* zipfile command line option; -create:  Command-line options.\n(line   11)\n* zipfile command line option; -e:       Command-line options.\n(line   16)\n* zipfile command line option; -extract: Command-line options.\n(line   16)\n* zipfile command line option; -l:       Command-line options.\n(line    6)\n* zipfile command line option; -list:    Command-line options.\n(line    6)\n* zipfile command line option; -metadata-encoding: Command-line options.\n(line   26)\n* zipfile command line option; -t:       Command-line options.\n(line   21)\n* zipfile command line option; -test:    Command-line options.\n(line   21)\n* zipimporter (class in zipimport):      zipimporter Objects.\n(line    8)\n* ZipImportError:                        zipimport -- Import modules from Zip archives.\n(line   56)\n* ZipInfo (class in zipfile):            zipfile -- Work with ZIP archives.\n(line   59)\n* ZLIBRUNTIMEVERSION (in module zlib): zlib -- Compression compatible with gzip.\n(line  313)\n* ZLIBVERSION (in module zlib):         zlib -- Compression compatible with gzip.\n(line  306)\n* ZoneInfo (class in zoneinfo):          The ZoneInfo class. (line    6)\n* ZoneInfoNotFoundError:                 Exceptions and warnings.\n(line    6)\n* zscore() (statistics.NormalDist method): NormalDist objects.\n(line  114)\n\n\n\n\nFile: python3.12.info,  Node: Tasks,  Next: Queues<2>,  Up: High-level API Index\n\n5.18.1.116 Tasks\n................\n",
            "subsections": []
        },
        "Utilities to run asyncio programs, create Tasks, and await on multiple": {
            "content": "things with timeouts.\n\n*note run(): 197.                                      Create event loop, run a coroutine, close the loop.\n\n\n*note Runner: 3c9.                                     A context manager that simplifies multiple async\nfunction calls.\n\n\n*note Task: 201.                                       Task object.\n\n\n*note TaskGroup: 3c3.                                  A context manager that holds a group of tasks.\nProvides a convenient and reliable way to wait for\nall tasks in the group to finish.\n\n\n*note createtask(): 3c5.                              Start an asyncio Task, then returns it.\n\n\n*note currenttask(): 198.                             Return the current Task.\n\n\n*note alltasks(): 777.                                Return all tasks that are not yet finished for an\nevent loop.\n\n\n'await' *note sleep(): 89d.                            Sleep for a number of seconds.\n\n\n'await' *note gather(): 3c6.                           Schedule and wait for things concurrently.\n\n\n'await' *note waitfor(): 3c8.                         Run with a timeout.\n\n\n'await' *note shield(): 89e.                           Shield from cancellation.\n\n\n'await' *note wait(): 19a.                             Monitor for completion.\n\n\n*note timeout(): 3c7.                                  Run with a timeout.  Useful in cases when 'waitfor'\nis not suitable.\n\n\n*note tothread(): 701.                                Asynchronously run a function in a separate OS\nthread.\n\n\n*note runcoroutinethreadsafe(): 68e.                 Schedule a coroutine from another OS thread.\n\n\n'for in' *note ascompleted(): 19b.                    Monitor for completion with a 'for' loop.\n\n",
            "subsections": []
        },
        "Queues should be used to distribute work amongst multiple asyncio Tasks,": {
            "content": "implement connection pools, and pub/sub patterns.\n\n*note Queue: 8a4.                                      A FIFO queue.\n\n\n*note PriorityQueue: 2f7a.                             A priority queue.\n\n\n*note LifoQueue: 2f7c.                                 A LIFO queue.\n\n",
            "subsections": []
        },
        "Lifecycle": {
            "content": ".........\n\n*note loop.rununtilcomplete(): ac2.                  Run a Future/Task/awaitable until complete.\n\n\n*note loop.runforever(): 2f8f.                        Run the event loop forever.\n\n\n*note loop.stop(): ac9.                                Stop the event loop.\n\n\n*note loop.close(): 2f91.                              Close the event loop.\n\n\n*note loop.isrunning(): 2f90.                         Return 'True' if the event loop is running.\n\n\n*note loop.isclosed(): c20.                           Return 'True' if the event loop is closed.\n\n\n'await' *note loop.shutdownasyncgens(): aca.          Close asynchronous generators.\n\n",
            "subsections": []
        },
        "Debugging": {
            "content": ".........\n\n*note loop.setdebug(): c1e.                           Enable or disable the debug mode.\n\n\n*note loop.getdebug(): c1f.                           Get the current debug mode.\n\n",
            "subsections": []
        },
        "Scheduling Callbacks": {
            "content": "....................\n\n*note loop.callsoon(): 93b.                           Invoke a callback soon.\n\n\n*note loop.callsoonthreadsafe(): 93c.                A thread-safe variant of\n*note loop.callsoon(): 93b.\n\n\n*note loop.calllater(): 93d.                          Invoke a callback 'after' the given time.\n\n\n*note loop.callat(): 93e.                             Invoke a callback 'at' the given time.\n\n",
            "subsections": []
        },
        "Thread/Process Pool": {
            "content": "...................\n\n'await' *note loop.runinexecutor(): 702.             Run a CPU-bound or other blocking function in a\n*note concurrent.futures: 1f. executor.\n\n\n*note loop.setdefaultexecutor(): 52a.                Set the default executor for\n*note loop.runinexecutor(): 702.\n\n",
            "subsections": []
        },
        "Tasks and Futures": {
            "content": ".................\n\n*note loop.createfuture(): ac5.                       Create a *note Future: a11. object.\n\n\n*note loop.createtask(): 802.                         Schedule coroutine as a *note Task: 201.\n\n\n*note loop.settaskfactory(): c22.                    Set a factory used by *note loop.createtask(): 802.\nto create *note Tasks: 201.\n\n\n*note loop.gettaskfactory(): c23.                    Get the factory *note loop.createtask(): 802. uses\nto create *note Tasks: 201.\n\n",
            "subsections": []
        },
        "DNS": {
            "content": "...\n\n'await' *note loop.getaddrinfo(): a5a.                 Asynchronous version of\n*note socket.getaddrinfo(): 149f.\n\n\n'await' *note loop.getnameinfo(): a5b.                 Asynchronous version of\n*note socket.getnameinfo(): 1466.\n\n",
            "subsections": []
        },
        "Networking and IPC": {
            "content": "..................\n\n'await' *note loop.createconnection(): 3cc.           Open a TCP connection.\n\n\n'await' *note loop.createserver(): 94a.               Create a TCP server.\n\n\n'await' *note loop.createunixconnection(): 2f0e.     Open a Unix socket connection.\n\n\n'await' *note loop.createunixserver(): 94b.          Create a Unix socket server.\n\n\n'await' *note loop.connectacceptedsocket(): 952.     Wrap a *note socket: bfd. into a '(transport,\nprotocol)' pair.\n\n\n'await' *note loop.createdatagramendpoint(): 517.    Open a datagram (UDP) connection.\n\n\n'await' *note loop.sendfile(): 2fa4.                   Send a file over a transport.\n\n\n'await' *note loop.starttls(): 940.                   Upgrade an existing connection to TLS.\n\n\n'await' *note loop.connectreadpipe(): 2f54.          Wrap a read end of a pipe into a '(transport,\nprotocol)' pair.\n\n\n'await' *note loop.connectwritepipe(): 2f55.         Wrap a write end of a pipe into a '(transport,\nprotocol)' pair.\n\n",
            "subsections": []
        },
        "Unix Signals": {
            "content": "............\n\n*note loop.addsignalhandler(): 2fb1.                 Add a handler for a *note signal: c1.\n\n\n*note loop.removesignalhandler(): 2fb2.              Remove a handler for a *note signal: c1.\n\n",
            "subsections": []
        },
        "Error Handling": {
            "content": "..............\n\n*note loop.callexceptionhandler(): 2fb6.             Call the exception handler.\n\n\n*note loop.setexceptionhandler(): 2fb5.              Set a new exception handler.\n\n\n*note loop.getexceptionhandler(): ac6.               Get the current exception handler.\n\n\n*note loop.defaultexceptionhandler(): 2fb7.          The default exception handler implementation.\n\n",
            "subsections": []
        },
        "Read Transports": {
            "content": "...............\n\n*note transport.isreading(): 954.                     Return 'True' if the transport is receiving.\n\n\n*note transport.pausereading(): 956.                  Pause receiving.\n\n\n*note transport.resumereading(): 955.                 Resume receiving.\n\n\nTransports that can Send data (TCP and Unix connections, pipes, etc).\nReturned from methods like *note loop.createconnection(): 3cc, *note\nloop.createunixconnection(): 2f0e, *note loop.connectwritepipe():\n2f55, etc:\n",
            "subsections": []
        },
        "Write Transports": {
            "content": "................\n\n*note transport.write(): 2fec.                         Write data to the transport.\n\n\n*note transport.writelines(): 1472.                    Write buffers to the transport.\n\n\n*note transport.canwriteeof(): 2fe6.                 Return *note True: a53. if the transport supports\nsending EOF.\n\n\n*note transport.writeeof(): 2fe7.                     Close and send EOF after flushing buffered data.\n\n\n*note transport.abort(): 2fe5.                         Close the transport immediately.\n\n\n*note transport.getwritebuffersize(): 2fe8.         Return the current size of the output buffer.\n\n\n*note transport.getwritebufferlimits(): c21.        Return high and low water marks for write flow\ncontrol.\n\n\n*note transport.setwritebufferlimits(): 2fe9.       Set new high and low water marks for write flow\ncontrol.\n\n\nTransports returned by *note loop.createdatagramendpoint(): 517.:\n",
            "subsections": []
        },
        "Datagram Transports": {
            "content": "...................\n\n*note transport.sendto(): 2fee.                        Send data to the remote peer.\n\n\n*note transport.abort(): 2fef.                         Close the transport immediately.\n\n\nLow-level transport abstraction over subprocesses.  Returned by *note\nloop.subprocessexec(): 2f51. and *note loop.subprocessshell(): 2f52.:\n",
            "subsections": []
        },
        "Subprocess Transports": {
            "content": ".....................\n\n*note transport.getpid(): 2ff1.                       Return the subprocess process id.\n\n\n*note transport.getpipetransport(): 2ff2.            Return the transport for the requested communication\npipe ('stdin', 'stdout', or 'stderr').\n\n\n*note transport.getreturncode(): 2ff3.                Return the subprocess return code.\n\n\n*note transport.kill(): 2ff4.                          Kill the subprocess.\n\n\n*note transport.sendsignal(): 2ff6.                   Send a signal to the subprocess.\n\n\n*note transport.terminate(): 2ff5.                     Stop the subprocess.\n\n\n*note transport.close(): 2ff7.                         Kill the subprocess and close all pipes.\n\n\nFile: python3.12.info,  Node: Protocols<2>,  Next: Event Loop Policies,  Prev: Transports<2>,  Up: Low-level API Index\n\n5.18.1.126 Protocols\n....................\n\nProtocol classes can implement the following 'callback methods':\n\n'callback' *note connectionmade(): 2f9b.              Called when a connection is made.\n\n\n'callback' *note connectionlost(): 2fdd.              Called when the connection is lost or closed.\n\n\n'callback' *note pausewriting(): 2fea.                Called when the transport's buffer goes over the\nhigh water mark.\n\n\n'callback' *note resumewriting(): 2feb.               Called when the transport's buffer drains below the\nlow water mark.\n\n",
            "subsections": []
        },
        "Streaming Protocols (TCP, Unix Sockets, Pipes)": {
            "content": "..............................................\n\n'callback' *note datareceived(): 14e1.                Called when some data is received.\n\n\n'callback' *note eofreceived(): 2ffb.                 Called when an EOF is received.\n\n",
            "subsections": []
        },
        "Buffered Streaming Protocols": {
            "content": "............................\n\n'callback' *note getbuffer(): 2ffd.                   Called to allocate a new receive buffer.\n\n\n'callback' *note bufferupdated(): 2ffe.               Called when the buffer was updated with the received\ndata.\n\n\n'callback' *note eofreceived(): 2fff.                 Called when an EOF is received.\n\n",
            "subsections": []
        },
        "Datagram Protocols": {
            "content": "..................\n\n'callback' *note datagramreceived(): 3001.            Called when a datagram is received.\n\n\n'callback' *note errorreceived(): 3002.               Called when a previous send or receive operation\nraises an *note OSError: 613.\n\n",
            "subsections": []
        },
        "Subprocess Protocols": {
            "content": "....................\n\n'callback' *note pipedatareceived(): 151e.           Called when the child process writes data into its\n'stdout' or 'stderr' pipe.\n\n\n'callback' *note pipeconnectionlost(): 3004.         Called when one of the pipes communicating with the\nchild process is closed.\n\n\n'callback' *note processexited(): 151d.               Called when the child process has exited.  It can be\ncalled before *note pipedatareceived(): 151e. and\n*note pipeconnectionlost(): 3004. methods.\n\n\nFile: python3.12.info,  Node: Event Loop Policies,  Prev: Protocols<2>,  Up: Low-level API Index\n\n5.18.1.127 Event Loop Policies\n..............................\n",
            "subsections": []
        },
        "Policies is a low-level mechanism to alter the behavior of functions": {
            "content": "like *note asyncio.geteventloop(): 21e.  See also the main *note\npolicies section: 2f87. for more details.\n",
            "subsections": []
        },
        "Accessing Policies": {
            "content": "..................\n\n*note asyncio.geteventlooppolicy(): 3013.           Return the current process-wide policy.\n\n\n*note asyncio.seteventlooppolicy(): 3014.           Set a new process-wide policy.\n\n\n*note AbstractEventLoopPolicy: 3011.                   Base class for policy objects.\n\n",
            "subsections": []
        }
    },
    "flags": [],
    "examples": [],
    "see_also": []
}